From d5caceac594b767c7e8930669e8b782a95399dd4 Mon Sep 17 00:00:00 2001 From: abhishek-01k Date: Tue, 3 Dec 2024 13:52:41 +0530 Subject: [PATCH] Updates --- .../{index-kIiSzqeW.js => index-6To_q7Ed.js} | 4 +- .../{index-CF567lxi.js => index-AUj9uiFZ.js} | 2 +- .../{index-DQigAB7X.js => index-lKOqBfdS.js} | 90 ++++++++++--------- ...{native-CSxBbLxR.js => native-BCwCyULO.js} | 2 +- ...pto-D2ugBmJb.js => nodecrypto-CtIF-oIC.js} | 2 +- ...{purejs-CAiGQDMH.js => purejs-DPZGIi36.js} | 2 +- .../{utils-Ci-V-obq.js => utils-CY2aEMoz.js} | 2 +- ...ypto-BwsVVJaH.js => webcrypto-CPaydEYP.js} | 2 +- index.html | 2 +- 9 files changed, 56 insertions(+), 52 deletions(-) rename assets/{index-kIiSzqeW.js => index-6To_q7Ed.js} (86%) rename assets/{index-CF567lxi.js => index-AUj9uiFZ.js} (99%) rename assets/{index-DQigAB7X.js => index-lKOqBfdS.js} (95%) rename assets/{native-CSxBbLxR.js => native-BCwCyULO.js} (81%) rename assets/{nodecrypto-D2ugBmJb.js => nodecrypto-CtIF-oIC.js} (64%) rename assets/{purejs-CAiGQDMH.js => purejs-DPZGIi36.js} (92%) rename assets/{utils-Ci-V-obq.js => utils-CY2aEMoz.js} (98%) rename assets/{webcrypto-BwsVVJaH.js => webcrypto-CPaydEYP.js} (90%) diff --git a/assets/index-kIiSzqeW.js b/assets/index-6To_q7Ed.js similarity index 86% rename from assets/index-kIiSzqeW.js rename to assets/index-6To_q7Ed.js index dd1daa7..2fdb814 100644 --- a/assets/index-kIiSzqeW.js +++ b/assets/index-6To_q7Ed.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CF567lxi.js","assets/index-DQigAB7X.js","assets/index-BqexNBF0.css"])))=>i.map(i=>d[i]); -import{B as pe,_ as me}from"./index-DQigAB7X.js";const he=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,ge=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ye=e=>ge(e)&&e[he]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/push-wallet/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_BACKEND_URL:"https://push-auth.push.org",VITE_APP_DYNAMIC_ENV_ID:"7a6006b6-fa19-4e7a-abcf-34add623dff5",VITE_APP_ENV:"dev",VITE_DEV_MODE:"testing"},F=e=>typeof e=="object"&&e!==null,L=new WeakMap,x=new WeakSet,ve=(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 b=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(b,!0),l.set(o,[g,b]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(b,j))return;const O=Reflect.get(o,j),A={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete A.value,A.get=()=>I(O);else if(L.has(O)){const[y,H]=L.get(O);A.value=c(y,H(),I)}Object.defineProperty(b,j,A)}),Object.preventExtensions(b)},d=new WeakMap,f=[1,1],W=o=>{if(!F(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,b=(i,a=++f[0])=>{I!==a&&(I=a,v.forEach(r=>r(i,a)))};let j=f[1];const O=(i=++f[1])=>(j!==i&&!v.size&&(j=i,y.forEach(([a])=>{const r=a[1](i);r>I&&(I=r)})),I),A=i=>(a,r)=>{const h=[...a];h[1]=[i,...h[1]],b(h,r)},y=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&y.has(i))throw new Error("prop listener already exists");if(v.size){const r=a[3](A(i));y.set(i,[a,r])}else y.set(i,[a])},Z=i=>{var a;const r=y.get(i);r&&(y.delete(i),(a=r[1])==null||a.call(r))},ue=i=>(v.add(i),v.size===1&&y.forEach(([r,h],U)=>{if((z?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const $=r[3](A(U));y.set(U,[r,$])}),()=>{v.delete(i),v.size===0&&y.forEach(([r,h],U)=>{h&&(h(),y.set(U,[r]))})}),q=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),R=t(q,{deleteProperty(i,a){const r=Reflect.get(i,a);Z(a);const h=Reflect.deleteProperty(i,a);return h&&b(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),$=Reflect.get(i,a,h);if(U&&(e($,r)||d.has(r)&&e($,d.get(r))))return!0;Z(a),F(r)&&(r=ye(r)||r);let V=r;if(r instanceof Promise)r.then(C=>{r.status="fulfilled",r.value=C,b(["resolve",[a],C])}).catch(C=>{r.status="rejected",r.reason=C,b(["reject",[a],C])});else{!L.has(r)&&s(r)&&(V=W(r));const C=!x.has(V)&&L.get(V);C&&H(a,C)}return Reflect.set(i,a,V,h),b(["set",[a],r,$]),!0}});d.set(o,R);const fe=[q,O,c,ue];return L.set(R,fe),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(R[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(q,i,a)}),R})=>[W,L,x,e,t,s,n,l,c,d,f],[be]=ve();function P(e={}){return be(e)}function S(e,t,s){const n=L.get(e);(z?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let l;const c=[],d=n[3];let f=!1;const o=d(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function we(e,t){const s=L.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[n,l,c]=s;return c(n,l(),t)}const u=P({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:u,subscribe(e){return S(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=pe.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}},Ie=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:Ie,userSessionId:"",events:[],connectedWalletId:void 0}),_e={state:p,subscribe(e){return S(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}),w={state:_,subscribe(e){return S(_,()=>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}),N={state:B,subscribe(e){return S(B,()=>e(B))},setConfig(e){var t,s;_e.initialize(),w.setChains(e.chains),w.setIsAuth(!!e.enableAuthMode),w.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),w.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),m.setModalVersionInStorage(),Object.assign(B,e)}};var Ee=Object.defineProperty,se=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ce=(e,t)=>{for(var s in t||(t={}))Oe.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))We.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=Ce({sdkType:Q,sdkVersion:X},t),n=new URL(e,G);return n.searchParams.append("projectId",N.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=${N.state.projectId}&sdkType=${Q}&sdkVersion=${X}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${N.state.projectId}&sdkType=${Q}&sdkVersion=${X}`}};var Le=Object.defineProperty,oe=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Me=(e,t)=>{for(var s in t||(t={}))Pe.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Ae.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:[]}),Re={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=N.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(m.isArray(e)){const n={recommendedIds:e.join(",")},{listings:l}=await M.getAllListings(n),c=Object.values(l);c.sort((d,f)=>{const W=e.indexOf(d.id),o=e.indexOf(f.id);return W-o}),E.recomendedWallets=c}else{const{chains:s,isAuth:n}=w.state,l=s==null?void 0:s.join(","),c=m.isArray(t),d={page:1,sdks:n?"auth_v1":void 0,entries:m.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await M.getMobileListings(d):await M.getDesktopListings(d);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=Me({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=N.state,{recomendedWallets:l}=E;if(n==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):m.isArray(s)&&(t.excludedIds=s.join(",")),m.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),w.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:d}=e,{listings:f,total:W}=ae?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),g=d?"search":"wallets";return E[g]={listings:[...E[g].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},T=P({open:!1}),J={state:T,subscribe(e){return S(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=w.state;if(m.removeWalletConnectDeepLink(),w.setWalletConnectUri(e==null?void 0:e.uri),w.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=w.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),T.open=!0,t())},200)}})},close(){T.open=!1}};var De=Object.defineProperty,ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ue=(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))je.call(t,s)&&le(e,s,t[s]);return e};function Te(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const k=P({themeMode:Te()?"dark":"light"}),ce={state:k,subscribe(e){return S(k,()=>e(k))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(k.themeMode=t),s&&(k.themeVariables=Ue({},s))}},D=P({open:!1,message:"",variant:"success"}),Ve={state:D,subscribe(e){return S(D,()=>e(D))},openToast(e,t){D.open=!0,D.message=e,D.variant=t},closeToast(){D.open=!1}};class Ne{constructor(t){this.openModal=J.open,this.closeModal=J.close,this.subscribeModal=J.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),N.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await me(()=>import("./index-CF567lxi.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),w.setIsUiLoaded(!0)}}}const xe=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Ne},Symbol.toStringTag,{value:"Module"}));export{m as C,Re as E,J as M,w as O,de as R,ce as T,Ve as a,_e as b,N as c,xe as i}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-AUj9uiFZ.js","assets/index-lKOqBfdS.js","assets/index-BqexNBF0.css"])))=>i.map(i=>d[i]); +import{B as pe,_ as me}from"./index-lKOqBfdS.js";const he=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,ge=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ye=e=>ge(e)&&e[he]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/push-wallet/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_BACKEND_URL:"https://push-auth.push.org",VITE_APP_DYNAMIC_ENV_ID:"82e8732d-11b8-428d-a553-7087d0c44171",VITE_APP_ENV:"dev",VITE_DEV_MODE:"testing"},F=e=>typeof e=="object"&&e!==null,L=new WeakMap,x=new WeakSet,ve=(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(L.has(O)){const[y,H]=L.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 $=r[3](A(U));y.set(U,[r,$])}),()=>{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),$=Reflect.get(i,a,h);if(U&&(e($,r)||d.has(r)&&e($,d.get(r))))return!0;Z(a),F(r)&&(r=ye(r)||r);let V=r;if(r instanceof Promise)r.then(C=>{r.status="fulfilled",r.value=C,w(["resolve",[a],C])}).catch(C=>{r.status="rejected",r.reason=C,w(["reject",[a],C])});else{!L.has(r)&&s(r)&&(V=W(r));const C=!x.has(V)&&L.get(V);C&&H(a,C)}return Reflect.set(i,a,V,h),w(["set",[a],r,$]),!0}});d.set(o,R);const fe=[q,O,c,ue];return L.set(R,fe),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(R[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(q,i,a)}),R})=>[W,L,x,e,t,s,n,l,c,d,f],[we]=ve();function P(e={}){return we(e)}function S(e,t,s){const n=L.get(e);(z?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let l;const c=[],d=n[3];let f=!1;const o=d(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function be(e,t){const s=L.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[n,l,c]=s;return c(n,l(),t)}const u=P({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:u,subscribe(e){return S(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=pe.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}},Ie=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:Ie,userSessionId:"",events:[],connectedWalletId:void 0}),_e={state:p,subscribe(e){return S(p.events,()=>e(be(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},_=P({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),b={state:_,subscribe(e){return S(_,()=>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}),N={state:B,subscribe(e){return S(B,()=>e(B))},setConfig(e){var t,s;_e.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 Ee=Object.defineProperty,se=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,We=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ce=(e,t)=>{for(var s in t||(t={}))Oe.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))We.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=Ce({sdkType:Q,sdkVersion:X},t),n=new URL(e,G);return n.searchParams.append("projectId",N.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=${N.state.projectId}&sdkType=${Q}&sdkVersion=${X}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${N.state.projectId}&sdkType=${Q}&sdkVersion=${X}`}};var Le=Object.defineProperty,oe=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Me=(e,t)=>{for(var s in t||(t={}))Pe.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Ae.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:[]}),Re={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=N.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=Me({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=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 S(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 De=Object.defineProperty,ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ue=(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))je.call(t,s)&&le(e,s,t[s]);return e};function Te(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const k=P({themeMode:Te()?"dark":"light"}),ce={state:k,subscribe(e){return S(k,()=>e(k))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(k.themeMode=t),s&&(k.themeVariables=Ue({},s))}},D=P({open:!1,message:"",variant:"success"}),Ve={state:D,subscribe(e){return S(D,()=>e(D))},openToast(e,t){D.open=!0,D.message=e,D.variant=t},closeToast(){D.open=!1}};class Ne{constructor(t){this.openModal=J.open,this.closeModal=J.close,this.subscribeModal=J.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),N.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await me(()=>import("./index-AUj9uiFZ.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),b.setIsUiLoaded(!0)}}}const xe=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Ne},Symbol.toStringTag,{value:"Module"}));export{m as C,Re as E,J as M,b as O,de as R,ce as T,Ve as a,_e as b,N as c,xe as i}; diff --git a/assets/index-CF567lxi.js b/assets/index-AUj9uiFZ.js similarity index 99% rename from assets/index-CF567lxi.js rename to assets/index-AUj9uiFZ.js index 84187c3..0ec2edb 100644 --- a/assets/index-CF567lxi.js +++ b/assets/index-AUj9uiFZ.js @@ -1,4 +1,4 @@ -import{T as $t,M as oe,R as N,E as k,C as $,a as X,b as Br,O as Z,c as ht}from"./index-kIiSzqeW.js";import{e as Wr,d as Ur}from"./index-DQigAB7X.js";/** +import{T as $t,M as oe,R as N,E as k,C as $,a as X,b as Br,O as Z,c as ht}from"./index-6To_q7Ed.js";import{e as Wr,d as Ur}from"./index-lKOqBfdS.js";/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause diff --git a/assets/index-DQigAB7X.js b/assets/index-lKOqBfdS.js similarity index 95% rename from assets/index-DQigAB7X.js rename to assets/index-lKOqBfdS.js index d940b77..4649651 100644 --- a/assets/index-DQigAB7X.js +++ b/assets/index-lKOqBfdS.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/webcrypto-BwsVVJaH.js","assets/utils-Ci-V-obq.js","assets/nodecrypto-D2ugBmJb.js"])))=>i.map(i=>d[i]); -var pS=Object.defineProperty;var mS=(fr,br,wr)=>br in fr?pS(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr;var Uu=(fr,br,wr)=>mS(fr,typeof br!="symbol"?br+"":br,wr);function _mergeNamespaces(fr,br){for(var wr=0;wrEr[kr]})}}}return Object.freeze(Object.defineProperty(fr,Symbol.toStringTag,{value:"Module"}))}(function(){const br=document.createElement("link").relList;if(br&&br.supports&&br.supports("modulepreload"))return;for(const kr of document.querySelectorAll('link[rel="modulepreload"]'))Er(kr);new MutationObserver(kr=>{for(const jr of kr)if(jr.type==="childList")for(const Br of jr.addedNodes)Br.tagName==="LINK"&&Br.rel==="modulepreload"&&Er(Br)}).observe(document,{childList:!0,subtree:!0});function wr(kr){const jr={};return kr.integrity&&(jr.integrity=kr.integrity),kr.referrerPolicy&&(jr.referrerPolicy=kr.referrerPolicy),kr.crossOrigin==="use-credentials"?jr.credentials="include":kr.crossOrigin==="anonymous"?jr.credentials="omit":jr.credentials="same-origin",jr}function Er(kr){if(kr.ep)return;kr.ep=!0;const jr=wr(kr);fetch(kr.href,jr)}})();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs$2(fr){return fr&&fr.__esModule&&Object.prototype.hasOwnProperty.call(fr,"default")?fr.default:fr}function getAugmentedNamespace(fr){if(fr.__esModule)return fr;var br=fr.default;if(typeof br=="function"){var wr=function Er(){return this instanceof Er?Reflect.construct(br,arguments,this.constructor):br.apply(this,arguments)};wr.prototype=br.prototype}else wr={};return Object.defineProperty(wr,"__esModule",{value:!0}),Object.keys(fr).forEach(function(Er){var kr=Object.getOwnPropertyDescriptor(fr,Er);Object.defineProperty(wr,Er,kr.get?kr:{enumerable:!0,get:function(){return fr[Er]}})}),wr}var jsxRuntime={exports:{}},reactJsxRuntime_production_min={},react={exports:{}},react_production_min={};/** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/webcrypto-CPaydEYP.js","assets/utils-CY2aEMoz.js","assets/nodecrypto-CtIF-oIC.js"])))=>i.map(i=>d[i]); +var pS=Object.defineProperty;var mS=(fr,br,wr)=>br in fr?pS(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr;var Fu=(fr,br,wr)=>mS(fr,typeof br!="symbol"?br+"":br,wr);function _mergeNamespaces(fr,br){for(var wr=0;wrEr[kr]})}}}return Object.freeze(Object.defineProperty(fr,Symbol.toStringTag,{value:"Module"}))}(function(){const br=document.createElement("link").relList;if(br&&br.supports&&br.supports("modulepreload"))return;for(const kr of document.querySelectorAll('link[rel="modulepreload"]'))Er(kr);new MutationObserver(kr=>{for(const jr of kr)if(jr.type==="childList")for(const Br of jr.addedNodes)Br.tagName==="LINK"&&Br.rel==="modulepreload"&&Er(Br)}).observe(document,{childList:!0,subtree:!0});function wr(kr){const jr={};return kr.integrity&&(jr.integrity=kr.integrity),kr.referrerPolicy&&(jr.referrerPolicy=kr.referrerPolicy),kr.crossOrigin==="use-credentials"?jr.credentials="include":kr.crossOrigin==="anonymous"?jr.credentials="omit":jr.credentials="same-origin",jr}function Er(kr){if(kr.ep)return;kr.ep=!0;const jr=wr(kr);fetch(kr.href,jr)}})();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs$2(fr){return fr&&fr.__esModule&&Object.prototype.hasOwnProperty.call(fr,"default")?fr.default:fr}function getAugmentedNamespace(fr){if(fr.__esModule)return fr;var br=fr.default;if(typeof br=="function"){var wr=function Er(){return this instanceof Er?Reflect.construct(br,arguments,this.constructor):br.apply(this,arguments)};wr.prototype=br.prototype}else wr={};return Object.defineProperty(wr,"__esModule",{value:!0}),Object.keys(fr).forEach(function(Er){var kr=Object.getOwnPropertyDescriptor(fr,Er);Object.defineProperty(wr,Er,kr.get?kr:{enumerable:!0,get:function(){return fr[Er]}})}),wr}var jsxRuntime={exports:{}},reactJsxRuntime_production_min={},react={exports:{}},react_production_min={};/** * @license React * react.production.min.js * @@ -65,7 +65,7 @@ Error generating stack: `+jr.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function _extends$1m(){return _extends$1m=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&(wr[kr]=fr[kr]);return wr}function isModifiedEvent(fr){return!!(fr.metaKey||fr.altKey||fr.ctrlKey||fr.shiftKey)}function shouldProcessLinkClick(fr,br){return fr.button===0&&(!br||br==="_self")&&!isModifiedEvent(fr)}const _excluded$1f=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],REACT_ROUTER_VERSION="6";try{window.__reactRouterVersion=REACT_ROUTER_VERSION}catch{}const START_TRANSITION="startTransition",startTransitionImpl=React[START_TRANSITION];function BrowserRouter(fr){let{basename:br,children:wr,future:Er,window:kr}=fr,jr=reactExports.useRef();jr.current==null&&(jr.current=createBrowserHistory({window:kr,v5Compat:!0}));let Br=jr.current,[Wr,qr]=reactExports.useState({action:Br.action,location:Br.location}),{v7_startTransition:Gr}=Er||{},Vr=reactExports.useCallback(Zr=>{Gr&&startTransitionImpl?startTransitionImpl(()=>qr(Zr)):qr(Zr)},[qr,Gr]);return reactExports.useLayoutEffect(()=>Br.listen(Vr),[Br,Vr]),reactExports.useEffect(()=>logV6DeprecationWarnings(Er),[Er]),reactExports.createElement(Router,{basename:br,children:wr,location:Wr.location,navigationType:Wr.action,navigator:Br,future:Er})}const isBrowser$1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ABSOLUTE_URL_REGEX=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Link$1=reactExports.forwardRef(function(br,wr){let{onClick:Er,relative:kr,reloadDocument:jr,replace:Br,state:Wr,target:qr,to:Gr,preventScrollReset:Vr,viewTransition:Zr}=br,Jr=_objectWithoutPropertiesLoose$1i(br,_excluded$1f),{basename:Qr}=reactExports.useContext(NavigationContext),_n,En=!1;if(typeof Gr=="string"&&ABSOLUTE_URL_REGEX.test(Gr)&&(_n=Gr,isBrowser$1))try{let jn=new URL(window.location.href),eo=Gr.startsWith("//")?new URL(jn.protocol+Gr):new URL(Gr),ro=stripBasename(eo.pathname,Qr);eo.origin===jn.origin&&ro!=null?Gr=ro+eo.search+eo.hash:En=!0}catch{}let Cn=useHref(Gr,{relative:kr}),In=useLinkClickHandler(Gr,{replace:Br,state:Wr,target:qr,preventScrollReset:Vr,relative:kr,viewTransition:Zr});function An(jn){Er&&Er(jn),jn.defaultPrevented||In(jn)}return reactExports.createElement("a",_extends$1m({},Jr,{href:_n||Cn,onClick:En||jr?Er:An,ref:wr,target:qr}))});var DataRouterHook;(function(fr){fr.UseScrollRestoration="useScrollRestoration",fr.UseSubmit="useSubmit",fr.UseSubmitFetcher="useSubmitFetcher",fr.UseFetcher="useFetcher",fr.useViewTransitionState="useViewTransitionState"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(fr){fr.UseFetcher="useFetcher",fr.UseFetchers="useFetchers",fr.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));function useLinkClickHandler(fr,br){let{target:wr,replace:Er,state:kr,preventScrollReset:jr,relative:Br,viewTransition:Wr}=br===void 0?{}:br,qr=useNavigate(),Gr=useLocation(),Vr=useResolvedPath(fr,{relative:Br});return reactExports.useCallback(Zr=>{if(shouldProcessLinkClick(Zr,wr)){Zr.preventDefault();let Jr=Er!==void 0?Er:createPath(Gr)===createPath(Vr);qr(fr,{replace:Jr,state:kr,preventScrollReset:jr,relative:Br,viewTransition:Wr})}},[Gr,qr,Vr,Er,kr,wr,fr,jr,Br,Wr])}function getDefaultExportFromCjs$1(fr){return fr&&fr.__esModule&&Object.prototype.hasOwnProperty.call(fr,"default")?fr.default:fr}var browser$j={exports:{}},process$1=browser$j.exports={},cachedSetTimeout$1,cachedClearTimeout$1;function defaultSetTimout$1(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout$1(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?cachedSetTimeout$1=setTimeout:cachedSetTimeout$1=defaultSetTimout$1}catch{cachedSetTimeout$1=defaultSetTimout$1}try{typeof clearTimeout=="function"?cachedClearTimeout$1=clearTimeout:cachedClearTimeout$1=defaultClearTimeout$1}catch{cachedClearTimeout$1=defaultClearTimeout$1}})();function runTimeout$1(fr){if(cachedSetTimeout$1===setTimeout)return setTimeout(fr,0);if((cachedSetTimeout$1===defaultSetTimout$1||!cachedSetTimeout$1)&&setTimeout)return cachedSetTimeout$1=setTimeout,setTimeout(fr,0);try{return cachedSetTimeout$1(fr,0)}catch{try{return cachedSetTimeout$1.call(null,fr,0)}catch{return cachedSetTimeout$1.call(this,fr,0)}}}function runClearTimeout$1(fr){if(cachedClearTimeout$1===clearTimeout)return clearTimeout(fr);if((cachedClearTimeout$1===defaultClearTimeout$1||!cachedClearTimeout$1)&&clearTimeout)return cachedClearTimeout$1=clearTimeout,clearTimeout(fr);try{return cachedClearTimeout$1(fr)}catch{try{return cachedClearTimeout$1.call(null,fr)}catch{return cachedClearTimeout$1.call(this,fr)}}}var queue$1=[],draining$1=!1,currentQueue$1,queueIndex$1=-1;function cleanUpNextTick$1(){!draining$1||!currentQueue$1||(draining$1=!1,currentQueue$1.length?queue$1=currentQueue$1.concat(queue$1):queueIndex$1=-1,queue$1.length&&drainQueue$1())}function drainQueue$1(){if(!draining$1){var fr=runTimeout$1(cleanUpNextTick$1);draining$1=!0;for(var br=queue$1.length;br;){for(currentQueue$1=queue$1,queue$1=[];++queueIndex$11)for(var wr=1;wr=0)&&(wr[kr]=fr[kr]);return wr}function isModifiedEvent(fr){return!!(fr.metaKey||fr.altKey||fr.ctrlKey||fr.shiftKey)}function shouldProcessLinkClick(fr,br){return fr.button===0&&(!br||br==="_self")&&!isModifiedEvent(fr)}function createSearchParams(fr){return fr===void 0&&(fr=""),new URLSearchParams(typeof fr=="string"||Array.isArray(fr)||fr instanceof URLSearchParams?fr:Object.keys(fr).reduce((br,wr)=>{let Er=fr[wr];return br.concat(Array.isArray(Er)?Er.map(kr=>[wr,kr]):[[wr,Er]])},[]))}function getSearchParamsForLocation(fr,br){let wr=createSearchParams(fr);return br&&br.forEach((Er,kr)=>{wr.has(kr)||br.getAll(kr).forEach(jr=>{wr.append(kr,jr)})}),wr}const _excluded$1f=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],REACT_ROUTER_VERSION="6";try{window.__reactRouterVersion=REACT_ROUTER_VERSION}catch{}const START_TRANSITION="startTransition",startTransitionImpl=React[START_TRANSITION];function BrowserRouter(fr){let{basename:br,children:wr,future:Er,window:kr}=fr,jr=reactExports.useRef();jr.current==null&&(jr.current=createBrowserHistory({window:kr,v5Compat:!0}));let Br=jr.current,[Wr,qr]=reactExports.useState({action:Br.action,location:Br.location}),{v7_startTransition:Gr}=Er||{},Vr=reactExports.useCallback(Zr=>{Gr&&startTransitionImpl?startTransitionImpl(()=>qr(Zr)):qr(Zr)},[qr,Gr]);return reactExports.useLayoutEffect(()=>Br.listen(Vr),[Br,Vr]),reactExports.useEffect(()=>logV6DeprecationWarnings(Er),[Er]),reactExports.createElement(Router,{basename:br,children:wr,location:Wr.location,navigationType:Wr.action,navigator:Br,future:Er})}const isBrowser$1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ABSOLUTE_URL_REGEX=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Link$1=reactExports.forwardRef(function(br,wr){let{onClick:Er,relative:kr,reloadDocument:jr,replace:Br,state:Wr,target:qr,to:Gr,preventScrollReset:Vr,viewTransition:Zr}=br,Jr=_objectWithoutPropertiesLoose$1i(br,_excluded$1f),{basename:Qr}=reactExports.useContext(NavigationContext),_n,En=!1;if(typeof Gr=="string"&&ABSOLUTE_URL_REGEX.test(Gr)&&(_n=Gr,isBrowser$1))try{let jn=new URL(window.location.href),eo=Gr.startsWith("//")?new URL(jn.protocol+Gr):new URL(Gr),ro=stripBasename(eo.pathname,Qr);eo.origin===jn.origin&&ro!=null?Gr=ro+eo.search+eo.hash:En=!0}catch{}let Cn=useHref(Gr,{relative:kr}),In=useLinkClickHandler(Gr,{replace:Br,state:Wr,target:qr,preventScrollReset:Vr,relative:kr,viewTransition:Zr});function An(jn){Er&&Er(jn),jn.defaultPrevented||In(jn)}return reactExports.createElement("a",_extends$1m({},Jr,{href:_n||Cn,onClick:En||jr?Er:An,ref:wr,target:qr}))});var DataRouterHook;(function(fr){fr.UseScrollRestoration="useScrollRestoration",fr.UseSubmit="useSubmit",fr.UseSubmitFetcher="useSubmitFetcher",fr.UseFetcher="useFetcher",fr.useViewTransitionState="useViewTransitionState"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(fr){fr.UseFetcher="useFetcher",fr.UseFetchers="useFetchers",fr.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));function useLinkClickHandler(fr,br){let{target:wr,replace:Er,state:kr,preventScrollReset:jr,relative:Br,viewTransition:Wr}=br===void 0?{}:br,qr=useNavigate(),Gr=useLocation(),Vr=useResolvedPath(fr,{relative:Br});return reactExports.useCallback(Zr=>{if(shouldProcessLinkClick(Zr,wr)){Zr.preventDefault();let Jr=Er!==void 0?Er:createPath(Gr)===createPath(Vr);qr(fr,{replace:Jr,state:kr,preventScrollReset:jr,relative:Br,viewTransition:Wr})}},[Gr,qr,Vr,Er,kr,wr,fr,jr,Br,Wr])}function useSearchParams(fr){let br=reactExports.useRef(createSearchParams(fr)),wr=reactExports.useRef(!1),Er=useLocation(),kr=reactExports.useMemo(()=>getSearchParamsForLocation(Er.search,wr.current?null:br.current),[Er.search]),jr=useNavigate(),Br=reactExports.useCallback((Wr,qr)=>{const Gr=createSearchParams(typeof Wr=="function"?Wr(kr):Wr);wr.current=!0,jr("?"+Gr,qr)},[jr,kr]);return[kr,Br]}function getDefaultExportFromCjs$1(fr){return fr&&fr.__esModule&&Object.prototype.hasOwnProperty.call(fr,"default")?fr.default:fr}var browser$j={exports:{}},process$1=browser$j.exports={},cachedSetTimeout$1,cachedClearTimeout$1;function defaultSetTimout$1(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout$1(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?cachedSetTimeout$1=setTimeout:cachedSetTimeout$1=defaultSetTimout$1}catch{cachedSetTimeout$1=defaultSetTimout$1}try{typeof clearTimeout=="function"?cachedClearTimeout$1=clearTimeout:cachedClearTimeout$1=defaultClearTimeout$1}catch{cachedClearTimeout$1=defaultClearTimeout$1}})();function runTimeout$1(fr){if(cachedSetTimeout$1===setTimeout)return setTimeout(fr,0);if((cachedSetTimeout$1===defaultSetTimout$1||!cachedSetTimeout$1)&&setTimeout)return cachedSetTimeout$1=setTimeout,setTimeout(fr,0);try{return cachedSetTimeout$1(fr,0)}catch{try{return cachedSetTimeout$1.call(null,fr,0)}catch{return cachedSetTimeout$1.call(this,fr,0)}}}function runClearTimeout$1(fr){if(cachedClearTimeout$1===clearTimeout)return clearTimeout(fr);if((cachedClearTimeout$1===defaultClearTimeout$1||!cachedClearTimeout$1)&&clearTimeout)return cachedClearTimeout$1=clearTimeout,clearTimeout(fr);try{return cachedClearTimeout$1(fr)}catch{try{return cachedClearTimeout$1.call(null,fr)}catch{return cachedClearTimeout$1.call(this,fr)}}}var queue$1=[],draining$1=!1,currentQueue$1,queueIndex$1=-1;function cleanUpNextTick$1(){!draining$1||!currentQueue$1||(draining$1=!1,currentQueue$1.length?queue$1=currentQueue$1.concat(queue$1):queueIndex$1=-1,queue$1.length&&drainQueue$1())}function drainQueue$1(){if(!draining$1){var fr=runTimeout$1(cleanUpNextTick$1);draining$1=!0;for(var br=queue$1.length;br;){for(currentQueue$1=queue$1,queue$1=[];++queueIndex$11)for(var wr=1;wryo)&&(No=(Uo=Uo.replace(" ",":")).length),0vo&&(vo=(zn=zn.trim()).charCodeAt(0)),vo){case 38:return zn.replace(In,"$1"+wn.trim());case 58:return wn.trim()+zn.replace(In,"$1"+wn.trim());default:if(0<1*fo&&0lo.charCodeAt(8))break;case 115:go=go.replace(lo,"-webkit-"+lo)+";"+go;break;case 207:case 102:go=go.replace(lo,"-webkit-"+(102fo.charCodeAt(0)&&(fo=fo.trim()),Nn=fo,fo=[Nn],0yo)&&(No=(Fo=Fo.replace(" ",":")).length),0vo&&(vo=(zn=zn.trim()).charCodeAt(0)),vo){case 38:return zn.replace(In,"$1"+wn.trim());case 58:return wn.trim()+zn.replace(In,"$1"+wn.trim());default:if(0<1*fo&&0lo.charCodeAt(8))break;case 115:go=go.replace(lo,"-webkit-"+lo)+";"+go;break;case 207:case 102:go=go.replace(lo,"-webkit-"+(102fo.charCodeAt(0)&&(fo=fo.trim()),Nn=fo,fo=[Nn],01?br-1:0),Er=1;Er0?" Args: "+wr.join(", "):""))}var j$6=function(){function fr(wr){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=wr}var br=fr.prototype;return br.indexOfGroup=function(wr){for(var Er=0,kr=0;kr=this.groupSizes.length){for(var kr=this.groupSizes,jr=kr.length,Br=jr;wr>=Br;)(Br<<=1)<0&&D$7(16,""+wr);this.groupSizes=new Uint32Array(Br),this.groupSizes.set(kr),this.length=Br;for(var Wr=jr;Wr=this.length||this.groupSizes[wr]===0)return Er;for(var kr=this.groupSizes[wr],jr=this.indexOfGroup(wr),Br=jr+kr,Wr=jr;Wr=k$7&&(k$7=br+1),T$4.set(fr,br),x$7.set(br,fr)},M$4="style["+N$5+'][data-styled-version="5.3.11"]',G$5=new RegExp("^"+N$5+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),L$5=function(fr,br,wr){for(var Er,kr=wr.split(","),jr=0,Br=kr.length;jr=0;Gr--){var Vr=qr[Gr];if(Vr&&Vr.nodeType===1&&Vr.hasAttribute(N$5))return Vr}}(wr),jr=kr!==void 0?kr.nextSibling:null;Er.setAttribute(N$5,"active"),Er.setAttribute("data-styled-version","5.3.11");var Br=Y();return Br&&Er.setAttribute("nonce",Br),wr.insertBefore(Er,jr),Er},H$4=function(){function fr(wr){var Er=this.element=q$5(wr);Er.appendChild(document.createTextNode("")),this.sheet=function(kr){if(kr.sheet)return kr.sheet;for(var jr=document.styleSheets,Br=0,Wr=jr.length;Br=0){var kr=document.createTextNode(Er),jr=this.nodes[wr];return this.element.insertBefore(kr,jr||null),this.length++,!0}return!1},br.deleteRule=function(wr){this.element.removeChild(this.nodes[wr]),this.length--},br.getRule=function(wr){return wr0&&(Zr+=Jr+",")}),jr+=""+Gr+Vr+'{content:"'+Zr+`"}/*!sc*/ -`}}}return jr}(this)},fr}(),Z$4=/(a)(d)/gi,K$3=function(fr){return String.fromCharCode(fr+(fr>25?39:97))};function Q$5(fr){var br,wr="";for(br=Math.abs(fr);br>52;br=br/52|0)wr=K$3(br%52)+wr;return(K$3(br%52)+wr).replace(Z$4,"$1-$2")}var ee$4=function(fr,br){for(var wr=br.length;wr;)fr=33*fr^br.charCodeAt(--wr);return fr},te$2=function(fr){return ee$4(5381,fr)};function ne$2(fr){for(var br=0;br>>0);if(!wr.hasNameForId(kr,Wr)){var qr=Er(Br,"."+Wr,void 0,kr);wr.insertRules(kr,Wr,qr)}jr.push(Wr),this.staticRulesId=Wr}else{for(var Gr=this.rules.length,Vr=ee$4(this.baseHash,Er.hash),Zr="",Jr=0;Jr>>0);if(!wr.hasNameForId(kr,Cn)){var In=Er(Zr,"."+Cn,void 0,kr);wr.insertRules(kr,Cn,In)}jr.push(Cn)}}return jr.join(" ")},fr}(),se$2=/^\s*\/\/.*$/gm,ie$3=[":","[",".","#"];function ae$4(fr){var br,wr,Er,kr,jr=w$8,Br=jr.options,Wr=Br===void 0?w$8:Br,qr=jr.plugins,Gr=qr===void 0?S$5:qr,Vr=new stylis_min(Wr),Zr=[],Jr=function(En){function Cn(In){if(In)try{En(In+"}")}catch{}}return function(In,An,jn,eo,ro,to,_i,oo,io,co){switch(In){case 1:if(io===0&&An.charCodeAt(0)===64)return En(An+";"),"";break;case 2:if(oo===0)return An+"/*|*/";break;case 3:switch(oo){case 102:case 112:return En(jn[0]+An),"";default:return An+(co===0?"/*|*/":"")}case-2:An.split("/*|*/}").forEach(Cn)}}}(function(En){Zr.push(En)}),Qr=function(En,Cn,In){return Cn===0&&ie$3.indexOf(In[wr.length])!==-1||In.match(kr)?En:"."+br};function _n(En,Cn,In,An){An===void 0&&(An="&");var jn=En.replace(se$2,""),eo=Cn&&In?In+" "+Cn+" { "+jn+" }":jn;return br=An,wr=Cn,Er=new RegExp("\\"+wr+"\\b","g"),kr=new RegExp("(\\"+wr+"\\b){2,}"),Vr(In||!Cn?"":Cn,eo)}return Vr.use([].concat(Gr,[function(En,Cn,In){En===2&&In.length&&In[0].lastIndexOf(wr)>0&&(In[0]=In[0].replace(Er,Qr))},Jr,function(En){if(En===-2){var Cn=Zr;return Zr=[],Cn}}])),_n.hash=Gr.length?Gr.reduce(function(En,Cn){return Cn.name||D$7(15),ee$4(En,Cn.name)},5381).toString():"",_n}var ce$5=t$7.createContext();ce$5.Consumer;var le$4=t$7.createContext(),de$4=(le$4.Consumer,new X$5),he$2=ae$4();function pe$3(){return reactExports.useContext(ce$5)||de$4}function fe$1(){return reactExports.useContext(le$4)||he$2}var ye$1=function(){function fr(br,wr){var Er=this;this.inject=function(kr,jr){jr===void 0&&(jr=he$2);var Br=Er.name+jr.hash;kr.hasNameForId(Er.id,Br)||kr.insertRules(Er.id,Br,jr(Er.rules,Br,"@keyframes"))},this.toString=function(){return D$7(12,String(Er.name))},this.name=br,this.id="sc-keyframes-"+br,this.rules=wr}return fr.prototype.getName=function(br){return br===void 0&&(br=he$2),this.name+br.hash},fr}(),ve$2=/([A-Z])/,ge$3=/([A-Z])/g,Se$1=/^ms-/,we$1=function(fr){return"-"+fr.toLowerCase()};function Ee$1(fr){return ve$2.test(fr)?fr.replace(ge$3,we$1).replace(Se$1,"-ms-"):fr}var be=function(fr){return fr==null||fr===!1||fr===""};function _e$2(fr,br,wr,Er){if(Array.isArray(fr)){for(var kr,jr=[],Br=0,Wr=fr.length;Br1?br-1:0),Er=1;Er?@[\\\]^`{|}~-]+/g,De$3=/(^-|-$)/g;function je$1(fr){return fr.replace(Re$1,"-").replace(De$3,"")}var Te$2=function(fr){return Q$5(te$2(fr)>>>0)};function xe$1(fr){return typeof fr=="string"&&!0}var ke$3=function(fr){return typeof fr=="function"||typeof fr=="object"&&fr!==null&&!Array.isArray(fr)},Ve$2=function(fr){return fr!=="__proto__"&&fr!=="constructor"&&fr!=="prototype"};function Be$3(fr,br,wr){var Er=fr[wr];ke$3(br)&&ke$3(Er)?ze$2(Er,br):fr[wr]=br}function ze$2(fr){for(var br=arguments.length,wr=new Array(br>1?br-1:0),Er=1;Er=0||(co[oo]=to[oo]);return co}(br,["componentId"]),ro=jn&&jn+"-"+(xe$1(An)?An:je$1(b$6(An)));return Ye$1(An,y$8({},eo,{attrs:Jr,componentId:ro}),wr)},Object.defineProperty(_n,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(An){this._foldedDefaultProps=Er?ze$2({},fr.defaultProps,An):An}}),Object.defineProperty(_n,"toString",{value:function(){return"."+_n.styledComponentId}}),kr&&hoistNonReactStatics$1(_n,fr,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),_n}var qe$2=function(fr){return function br(wr,Er,kr){if(kr===void 0&&(kr=w$8),!reactIsExports$1.isValidElementType(Er))return D$7(1,String(Er));var jr=function(){return wr(Er,kr,Ae$2.apply(void 0,arguments))};return jr.withConfig=function(Br){return br(wr,Er,y$8({},kr,{},Br))},jr.attrs=function(Br){return br(wr,Er,y$8({},kr,{attrs:Array.prototype.concat(kr.attrs,Br).filter(Boolean)}))},jr}(Ye$1,fr)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(fr){qe$2[fr]=qe$2(fr)});var He$2=function(){function fr(wr,Er){this.rules=wr,this.componentId=Er,this.isStatic=ne$2(wr),X$5.registerId(this.componentId+1)}var br=fr.prototype;return br.createStyles=function(wr,Er,kr,jr){var Br=jr(_e$2(this.rules,Er,kr,jr).join(""),""),Wr=this.componentId+wr;kr.insertRules(Wr,Wr,Br)},br.removeStyles=function(wr,Er){Er.clearRules(this.componentId+wr)},br.renderStyles=function(wr,Er,kr,jr){wr>2&&X$5.registerId(this.componentId+wr),this.removeStyles(wr,kr),this.createStyles(wr,Er,kr,jr)},fr}();function $e$2(fr){for(var br=arguments.length,wr=new Array(br>1?br-1:0),Er=1;Er1?br-1:0),Er=1;Er(fr.IS_CONNECTED="isConnected",fr.REQ_TO_CONNECT="reqToConnect",fr.REQ_TO_SIGN="reqToSign",fr.REQ_WALLET_DETAILS="reqWalletDetails",fr.ERROR="error",fr.CONNECTION_STATUS="connectionStatus",fr.WALLET_DETAILS="walletDetails",fr.SIGNATURE="signature",fr))(ACTION||{});const c1=class c1{constructor(br,wr){this.pushWallet=br,this.onConnectionRequest=wr,this.initializeListener()}initializeListener(){c1.messageListener&&window.removeEventListener("message",c1.messageListener),c1.messageListener=async br=>{var kr,jr,Br,Wr,qr,Gr;if(br.origin==="http://localhost:5174")return;const{action:wr,data:Er}=br.data;if(this.pushWallet===void 0)(kr=br.source)==null||kr.postMessage({action:ACTION.ERROR,error:"PushWallet Not Logged In"},br.origin),global$1.myEvent=br;else switch(wr){case ACTION.REQ_WALLET_DETAILS:{const Vr=this.pushWallet.signerAccount;(jr=br.source)==null||jr.postMessage({action:ACTION.WALLET_DETAILS,address:Vr},br.origin);break}case ACTION.IS_CONNECTED:{const Vr=this.pushWallet.ConnectionStatus(br.origin);(Br=br.source)==null||Br.postMessage({action:ACTION.CONNECTION_STATUS,isPending:Vr.isPending,isConnected:Vr.isConnected},br.origin);break}case ACTION.REQ_TO_CONNECT:{this.pushWallet.requestToConnect(br.origin,this.onConnectionRequest);const Vr=this.pushWallet.ConnectionStatus(br.origin);(Wr=br.source)==null||Wr.postMessage({action:ACTION.CONNECTION_STATUS,isPending:Vr.isPending,isConnected:Vr.isConnected},br.origin);break}case ACTION.REQ_TO_SIGN:{try{const Vr=await this.pushWallet.sign(Er,br.origin);(qr=br.source)==null||qr.postMessage({action:ACTION.SIGNATURE,signature:Vr},br.origin)}catch{(Gr=br.source)==null||Gr.postMessage({action:ACTION.ERROR,error:"Origin Not Connected"},br.origin)}break}}},window.addEventListener("message",c1.messageListener)}};Uu(c1,"messageListener");let PostMessageHandler=c1;function bind$1(fr,br){return function(){return fr.apply(br,arguments)}}const{toString:toString$a}=Object.prototype,{getPrototypeOf}=Object,kindOf=(fr=>br=>{const wr=toString$a.call(br);return fr[wr]||(fr[wr]=wr.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest=fr=>(fr=fr.toLowerCase(),br=>kindOf(br)===fr),typeOfTest=fr=>br=>typeof br===fr,{isArray:isArray$c}=Array,isUndefined=typeOfTest("undefined");function isBuffer$4(fr){return fr!==null&&!isUndefined(fr)&&fr.constructor!==null&&!isUndefined(fr.constructor)&&isFunction$6(fr.constructor.isBuffer)&&fr.constructor.isBuffer(fr)}const isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(fr){let br;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?br=ArrayBuffer.isView(fr):br=fr&&fr.buffer&&isArrayBuffer(fr.buffer),br}const isString$2=typeOfTest("string"),isFunction$6=typeOfTest("function"),isNumber=typeOfTest("number"),isObject$a=fr=>fr!==null&&typeof fr=="object",isBoolean$1=fr=>fr===!0||fr===!1,isPlainObject$1=fr=>{if(kindOf(fr)!=="object")return!1;const br=getPrototypeOf(fr);return(br===null||br===Object.prototype||Object.getPrototypeOf(br)===null)&&!(Symbol.toStringTag in fr)&&!(Symbol.iterator in fr)},isDate$1=kindOfTest("Date"),isFile=kindOfTest("File"),isBlob$1=kindOfTest("Blob"),isFileList=kindOfTest("FileList"),isStream=fr=>isObject$a(fr)&&isFunction$6(fr.pipe),isFormData=fr=>{let br;return fr&&(typeof FormData=="function"&&fr instanceof FormData||isFunction$6(fr.append)&&((br=kindOf(fr))==="formdata"||br==="object"&&isFunction$6(fr.toString)&&fr.toString()==="[object FormData]"))},isURLSearchParams=kindOfTest("URLSearchParams"),[isReadableStream,isRequest,isResponse,isHeaders]=["ReadableStream","Request","Response","Headers"].map(kindOfTest),trim$3=fr=>fr.trim?fr.trim():fr.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach$1(fr,br,{allOwnKeys:wr=!1}={}){if(fr===null||typeof fr>"u")return;let Er,kr;if(typeof fr!="object"&&(fr=[fr]),isArray$c(fr))for(Er=0,kr=fr.length;Er0;)if(kr=wr[Er],br===kr.toLowerCase())return kr;return null}const _global=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global$1,isContextDefined=fr=>!isUndefined(fr)&&fr!==_global;function merge(){const{caseless:fr}=isContextDefined(this)&&this||{},br={},wr=(Er,kr)=>{const jr=fr&&findKey(br,kr)||kr;isPlainObject$1(br[jr])&&isPlainObject$1(Er)?br[jr]=merge(br[jr],Er):isPlainObject$1(Er)?br[jr]=merge({},Er):isArray$c(Er)?br[jr]=Er.slice():br[jr]=Er};for(let Er=0,kr=arguments.length;Er(forEach$1(br,(kr,jr)=>{wr&&isFunction$6(kr)?fr[jr]=bind$1(kr,wr):fr[jr]=kr},{allOwnKeys:Er}),fr),stripBOM=fr=>(fr.charCodeAt(0)===65279&&(fr=fr.slice(1)),fr),inherits=(fr,br,wr,Er)=>{fr.prototype=Object.create(br.prototype,Er),fr.prototype.constructor=fr,Object.defineProperty(fr,"super",{value:br.prototype}),wr&&Object.assign(fr.prototype,wr)},toFlatObject=(fr,br,wr,Er)=>{let kr,jr,Br;const Wr={};if(br=br||{},fr==null)return br;do{for(kr=Object.getOwnPropertyNames(fr),jr=kr.length;jr-- >0;)Br=kr[jr],(!Er||Er(Br,fr,br))&&!Wr[Br]&&(br[Br]=fr[Br],Wr[Br]=!0);fr=wr!==!1&&getPrototypeOf(fr)}while(fr&&(!wr||wr(fr,br))&&fr!==Object.prototype);return br},endsWith=(fr,br,wr)=>{fr=String(fr),(wr===void 0||wr>fr.length)&&(wr=fr.length),wr-=br.length;const Er=fr.indexOf(br,wr);return Er!==-1&&Er===wr},toArray$2=fr=>{if(!fr)return null;if(isArray$c(fr))return fr;let br=fr.length;if(!isNumber(br))return null;const wr=new Array(br);for(;br-- >0;)wr[br]=fr[br];return wr},isTypedArray$5=(fr=>br=>fr&&br instanceof fr)(typeof Uint8Array<"u"&&getPrototypeOf(Uint8Array)),forEachEntry=(fr,br)=>{const Er=(fr&&fr[Symbol.iterator]).call(fr);let kr;for(;(kr=Er.next())&&!kr.done;){const jr=kr.value;br.call(fr,jr[0],jr[1])}},matchAll=(fr,br)=>{let wr;const Er=[];for(;(wr=fr.exec(br))!==null;)Er.push(wr);return Er},isHTMLForm=kindOfTest("HTMLFormElement"),toCamelCase=fr=>fr.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(wr,Er,kr){return Er.toUpperCase()+kr}),hasOwnProperty$l=(({hasOwnProperty:fr})=>(br,wr)=>fr.call(br,wr))(Object.prototype),isRegExp=kindOfTest("RegExp"),reduceDescriptors=(fr,br)=>{const wr=Object.getOwnPropertyDescriptors(fr),Er={};forEach$1(wr,(kr,jr)=>{let Br;(Br=br(kr,jr,fr))!==!1&&(Er[jr]=Br||kr)}),Object.defineProperties(fr,Er)},freezeMethods=fr=>{reduceDescriptors(fr,(br,wr)=>{if(isFunction$6(fr)&&["arguments","caller","callee"].indexOf(wr)!==-1)return!1;const Er=fr[wr];if(isFunction$6(Er)){if(br.enumerable=!1,"writable"in br){br.writable=!1;return}br.set||(br.set=()=>{throw Error("Can not rewrite read-only method '"+wr+"'")})}})},toObjectSet=(fr,br)=>{const wr={},Er=kr=>{kr.forEach(jr=>{wr[jr]=!0})};return isArray$c(fr)?Er(fr):Er(String(fr).split(br)),wr},noop$5=()=>{},toFiniteNumber=(fr,br)=>fr!=null&&Number.isFinite(fr=+fr)?fr:br,ALPHA="abcdefghijklmnopqrstuvwxyz",DIGIT="0123456789",ALPHABET$5={DIGIT,ALPHA,ALPHA_DIGIT:ALPHA+ALPHA.toUpperCase()+DIGIT},generateString=(fr=16,br=ALPHABET$5.ALPHA_DIGIT)=>{let wr="";const{length:Er}=br;for(;fr--;)wr+=br[Math.random()*Er|0];return wr};function isSpecCompliantForm(fr){return!!(fr&&isFunction$6(fr.append)&&fr[Symbol.toStringTag]==="FormData"&&fr[Symbol.iterator])}const toJSONObject=fr=>{const br=new Array(10),wr=(Er,kr)=>{if(isObject$a(Er)){if(br.indexOf(Er)>=0)return;if(!("toJSON"in Er)){br[kr]=Er;const jr=isArray$c(Er)?[]:{};return forEach$1(Er,(Br,Wr)=>{const qr=wr(Br,kr+1);!isUndefined(qr)&&(jr[Wr]=qr)}),br[kr]=void 0,jr}}return Er};return wr(fr,0)},isAsyncFn=kindOfTest("AsyncFunction"),isThenable=fr=>fr&&(isObject$a(fr)||isFunction$6(fr))&&isFunction$6(fr.then)&&isFunction$6(fr.catch),_setImmediate=((fr,br)=>fr?setImmediate:br?((wr,Er)=>(_global.addEventListener("message",({source:kr,data:jr})=>{kr===_global&&jr===wr&&Er.length&&Er.shift()()},!1),kr=>{Er.push(kr),_global.postMessage(wr,"*")}))(`axios@${Math.random()}`,[]):wr=>setTimeout(wr))(typeof setImmediate=="function",isFunction$6(_global.postMessage)),asap=typeof queueMicrotask<"u"?queueMicrotask.bind(_global):typeof process$1$1<"u"&&process$1$1.nextTick||_setImmediate,utils$d={isArray:isArray$c,isArrayBuffer,isBuffer:isBuffer$4,isFormData,isArrayBufferView,isString:isString$2,isNumber,isBoolean:isBoolean$1,isObject:isObject$a,isPlainObject:isPlainObject$1,isReadableStream,isRequest,isResponse,isHeaders,isUndefined,isDate:isDate$1,isFile,isBlob:isBlob$1,isRegExp,isFunction:isFunction$6,isStream,isURLSearchParams,isTypedArray:isTypedArray$5,isFileList,forEach:forEach$1,merge,extend,trim:trim$3,stripBOM,inherits,toFlatObject,kindOf,kindOfTest,endsWith,toArray:toArray$2,forEachEntry,matchAll,isHTMLForm,hasOwnProperty:hasOwnProperty$l,hasOwnProp:hasOwnProperty$l,reduceDescriptors,freezeMethods,toObjectSet,toCamelCase,noop:noop$5,toFiniteNumber,findKey,global:_global,isContextDefined,ALPHABET:ALPHABET$5,generateString,isSpecCompliantForm,toJSONObject,isAsyncFn,isThenable,setImmediate:_setImmediate,asap};var buffer$2={},base64Js={};base64Js.byteLength=byteLength;base64Js.toByteArray=toByteArray;base64Js.fromByteArray=fromByteArray;var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i$9=0,len=code.length;i$90)throw new Error("Invalid string. Length must be a multiple of 4");var wr=fr.indexOf("=");wr===-1&&(wr=br);var Er=wr===br?0:4-wr%4;return[wr,Er]}function byteLength(fr){var br=getLens(fr),wr=br[0],Er=br[1];return(wr+Er)*3/4-Er}function _byteLength(fr,br,wr){return(br+wr)*3/4-wr}function toByteArray(fr){var br,wr=getLens(fr),Er=wr[0],kr=wr[1],jr=new Arr(_byteLength(fr,Er,kr)),Br=0,Wr=kr>0?Er-4:Er,qr;for(qr=0;qr>16&255,jr[Br++]=br>>8&255,jr[Br++]=br&255;return kr===2&&(br=revLookup[fr.charCodeAt(qr)]<<2|revLookup[fr.charCodeAt(qr+1)]>>4,jr[Br++]=br&255),kr===1&&(br=revLookup[fr.charCodeAt(qr)]<<10|revLookup[fr.charCodeAt(qr+1)]<<4|revLookup[fr.charCodeAt(qr+2)]>>2,jr[Br++]=br>>8&255,jr[Br++]=br&255),jr}function tripletToBase64(fr){return lookup[fr>>18&63]+lookup[fr>>12&63]+lookup[fr>>6&63]+lookup[fr&63]}function encodeChunk(fr,br,wr){for(var Er,kr=[],jr=br;jrWr?Wr:Br+jr));return Er===1?(br=fr[wr-1],kr.push(lookup[br>>2]+lookup[br<<4&63]+"==")):Er===2&&(br=(fr[wr-2]<<8)+fr[wr-1],kr.push(lookup[br>>10]+lookup[br>>4&63]+lookup[br<<2&63]+"=")),kr.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ieee754.read=function(fr,br,wr,Er,kr){var jr,Br,Wr=kr*8-Er-1,qr=(1<>1,Vr=-7,Zr=wr?kr-1:0,Jr=wr?-1:1,Qr=fr[br+Zr];for(Zr+=Jr,jr=Qr&(1<<-Vr)-1,Qr>>=-Vr,Vr+=Wr;Vr>0;jr=jr*256+fr[br+Zr],Zr+=Jr,Vr-=8);for(Br=jr&(1<<-Vr)-1,jr>>=-Vr,Vr+=Er;Vr>0;Br=Br*256+fr[br+Zr],Zr+=Jr,Vr-=8);if(jr===0)jr=1-Gr;else{if(jr===qr)return Br?NaN:(Qr?-1:1)*(1/0);Br=Br+Math.pow(2,Er),jr=jr-Gr}return(Qr?-1:1)*Br*Math.pow(2,jr-Er)};ieee754.write=function(fr,br,wr,Er,kr,jr){var Br,Wr,qr,Gr=jr*8-kr-1,Vr=(1<>1,Jr=kr===23?Math.pow(2,-24)-Math.pow(2,-77):0,Qr=Er?0:jr-1,_n=Er?1:-1,En=br<0||br===0&&1/br<0?1:0;for(br=Math.abs(br),isNaN(br)||br===1/0?(Wr=isNaN(br)?1:0,Br=Vr):(Br=Math.floor(Math.log(br)/Math.LN2),br*(qr=Math.pow(2,-Br))<1&&(Br--,qr*=2),Br+Zr>=1?br+=Jr/qr:br+=Jr*Math.pow(2,1-Zr),br*qr>=2&&(Br++,qr/=2),Br+Zr>=Vr?(Wr=0,Br=Vr):Br+Zr>=1?(Wr=(br*qr-1)*Math.pow(2,kr),Br=Br+Zr):(Wr=br*Math.pow(2,Zr-1)*Math.pow(2,kr),Br=0));kr>=8;fr[wr+Qr]=Wr&255,Qr+=_n,Wr/=256,kr-=8);for(Br=Br<0;fr[wr+Qr]=Br&255,Qr+=_n,Br/=256,Gr-=8);fr[wr+Qr-_n]|=En*128};/*! +`}}}return jr}(this)},fr}(),Z$4=/(a)(d)/gi,K$3=function(fr){return String.fromCharCode(fr+(fr>25?39:97))};function Q$5(fr){var br,wr="";for(br=Math.abs(fr);br>52;br=br/52|0)wr=K$3(br%52)+wr;return(K$3(br%52)+wr).replace(Z$4,"$1-$2")}var ee$4=function(fr,br){for(var wr=br.length;wr;)fr=33*fr^br.charCodeAt(--wr);return fr},te$2=function(fr){return ee$4(5381,fr)};function ne$2(fr){for(var br=0;br>>0);if(!wr.hasNameForId(kr,Wr)){var qr=Er(Br,"."+Wr,void 0,kr);wr.insertRules(kr,Wr,qr)}jr.push(Wr),this.staticRulesId=Wr}else{for(var Gr=this.rules.length,Vr=ee$4(this.baseHash,Er.hash),Zr="",Jr=0;Jr>>0);if(!wr.hasNameForId(kr,Cn)){var In=Er(Zr,"."+Cn,void 0,kr);wr.insertRules(kr,Cn,In)}jr.push(Cn)}}return jr.join(" ")},fr}(),se$2=/^\s*\/\/.*$/gm,ie$3=[":","[",".","#"];function ae$4(fr){var br,wr,Er,kr,jr=w$8,Br=jr.options,Wr=Br===void 0?w$8:Br,qr=jr.plugins,Gr=qr===void 0?S$5:qr,Vr=new stylis_min(Wr),Zr=[],Jr=function(En){function Cn(In){if(In)try{En(In+"}")}catch{}}return function(In,An,jn,eo,ro,to,_i,oo,io,co){switch(In){case 1:if(io===0&&An.charCodeAt(0)===64)return En(An+";"),"";break;case 2:if(oo===0)return An+"/*|*/";break;case 3:switch(oo){case 102:case 112:return En(jn[0]+An),"";default:return An+(co===0?"/*|*/":"")}case-2:An.split("/*|*/}").forEach(Cn)}}}(function(En){Zr.push(En)}),Qr=function(En,Cn,In){return Cn===0&&ie$3.indexOf(In[wr.length])!==-1||In.match(kr)?En:"."+br};function _n(En,Cn,In,An){An===void 0&&(An="&");var jn=En.replace(se$2,""),eo=Cn&&In?In+" "+Cn+" { "+jn+" }":jn;return br=An,wr=Cn,Er=new RegExp("\\"+wr+"\\b","g"),kr=new RegExp("(\\"+wr+"\\b){2,}"),Vr(In||!Cn?"":Cn,eo)}return Vr.use([].concat(Gr,[function(En,Cn,In){En===2&&In.length&&In[0].lastIndexOf(wr)>0&&(In[0]=In[0].replace(Er,Qr))},Jr,function(En){if(En===-2){var Cn=Zr;return Zr=[],Cn}}])),_n.hash=Gr.length?Gr.reduce(function(En,Cn){return Cn.name||D$7(15),ee$4(En,Cn.name)},5381).toString():"",_n}var ce$5=t$7.createContext();ce$5.Consumer;var le$4=t$7.createContext(),de$4=(le$4.Consumer,new X$5),he$2=ae$4();function pe$3(){return reactExports.useContext(ce$5)||de$4}function fe$1(){return reactExports.useContext(le$4)||he$2}var ye$1=function(){function fr(br,wr){var Er=this;this.inject=function(kr,jr){jr===void 0&&(jr=he$2);var Br=Er.name+jr.hash;kr.hasNameForId(Er.id,Br)||kr.insertRules(Er.id,Br,jr(Er.rules,Br,"@keyframes"))},this.toString=function(){return D$7(12,String(Er.name))},this.name=br,this.id="sc-keyframes-"+br,this.rules=wr}return fr.prototype.getName=function(br){return br===void 0&&(br=he$2),this.name+br.hash},fr}(),ve$2=/([A-Z])/,ge$3=/([A-Z])/g,Se$1=/^ms-/,we$1=function(fr){return"-"+fr.toLowerCase()};function Ee$1(fr){return ve$2.test(fr)?fr.replace(ge$3,we$1).replace(Se$1,"-ms-"):fr}var be=function(fr){return fr==null||fr===!1||fr===""};function _e$2(fr,br,wr,Er){if(Array.isArray(fr)){for(var kr,jr=[],Br=0,Wr=fr.length;Br1?br-1:0),Er=1;Er?@[\\\]^`{|}~-]+/g,De$3=/(^-|-$)/g;function je$1(fr){return fr.replace(Re$1,"-").replace(De$3,"")}var Te$2=function(fr){return Q$5(te$2(fr)>>>0)};function xe$1(fr){return typeof fr=="string"&&!0}var ke$3=function(fr){return typeof fr=="function"||typeof fr=="object"&&fr!==null&&!Array.isArray(fr)},Ve$2=function(fr){return fr!=="__proto__"&&fr!=="constructor"&&fr!=="prototype"};function Be$3(fr,br,wr){var Er=fr[wr];ke$3(br)&&ke$3(Er)?ze$2(Er,br):fr[wr]=br}function ze$2(fr){for(var br=arguments.length,wr=new Array(br>1?br-1:0),Er=1;Er=0||(co[oo]=to[oo]);return co}(br,["componentId"]),ro=jn&&jn+"-"+(xe$1(An)?An:je$1(b$6(An)));return Ye$1(An,y$8({},eo,{attrs:Jr,componentId:ro}),wr)},Object.defineProperty(_n,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(An){this._foldedDefaultProps=Er?ze$2({},fr.defaultProps,An):An}}),Object.defineProperty(_n,"toString",{value:function(){return"."+_n.styledComponentId}}),kr&&hoistNonReactStatics$1(_n,fr,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),_n}var qe$2=function(fr){return function br(wr,Er,kr){if(kr===void 0&&(kr=w$8),!reactIsExports$1.isValidElementType(Er))return D$7(1,String(Er));var jr=function(){return wr(Er,kr,Ae$2.apply(void 0,arguments))};return jr.withConfig=function(Br){return br(wr,Er,y$8({},kr,{},Br))},jr.attrs=function(Br){return br(wr,Er,y$8({},kr,{attrs:Array.prototype.concat(kr.attrs,Br).filter(Boolean)}))},jr}(Ye$1,fr)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(fr){qe$2[fr]=qe$2(fr)});var He$2=function(){function fr(wr,Er){this.rules=wr,this.componentId=Er,this.isStatic=ne$2(wr),X$5.registerId(this.componentId+1)}var br=fr.prototype;return br.createStyles=function(wr,Er,kr,jr){var Br=jr(_e$2(this.rules,Er,kr,jr).join(""),""),Wr=this.componentId+wr;kr.insertRules(Wr,Wr,Br)},br.removeStyles=function(wr,Er){Er.clearRules(this.componentId+wr)},br.renderStyles=function(wr,Er,kr,jr){wr>2&&X$5.registerId(this.componentId+wr),this.removeStyles(wr,kr),this.createStyles(wr,Er,kr,jr)},fr}();function $e$2(fr){for(var br=arguments.length,wr=new Array(br>1?br-1:0),Er=1;Er1?br-1:0),Er=1;Er(fr.IS_CONNECTED="isConnected",fr.REQ_TO_CONNECT="reqToConnect",fr.REQ_TO_SIGN="reqToSign",fr.REQ_WALLET_DETAILS="reqWalletDetails",fr.ERROR="error",fr.CONNECTION_STATUS="connectionStatus",fr.WALLET_DETAILS="walletDetails",fr.SIGNATURE="signature",fr))(ACTION||{});const uy=class uy{constructor(br,wr){this.pushWallet=br,this.onConnectionRequest=wr,this.initializeListener()}initializeListener(){uy.messageListener&&window.removeEventListener("message",uy.messageListener),uy.messageListener=async br=>{var kr,jr,Br,Wr,qr,Gr;if(br.origin==="http://localhost:5173")return;const{action:wr,data:Er}=br.data;if(this.pushWallet===void 0)(kr=br.source)==null||kr.postMessage({action:ACTION.ERROR,error:"PushWallet Not Logged In"},br.origin),global$1.myEvent=br;else switch(wr){case ACTION.REQ_WALLET_DETAILS:{const Vr=this.pushWallet.signerAccount;(jr=br.source)==null||jr.postMessage({action:ACTION.WALLET_DETAILS,address:Vr},br.origin);break}case ACTION.IS_CONNECTED:{const Vr=this.pushWallet.ConnectionStatus(br.origin);(Br=br.source)==null||Br.postMessage({action:ACTION.CONNECTION_STATUS,isPending:Vr.isPending,isConnected:Vr.isConnected},br.origin);break}case ACTION.REQ_TO_CONNECT:{this.pushWallet.requestToConnect(br.origin,this.onConnectionRequest);const Vr=this.pushWallet.ConnectionStatus(br.origin);(Wr=br.source)==null||Wr.postMessage({action:ACTION.CONNECTION_STATUS,isPending:Vr.isPending,isConnected:Vr.isConnected},br.origin);break}case ACTION.REQ_TO_SIGN:{try{const Vr=await this.pushWallet.sign(Er,br.origin);(qr=br.source)==null||qr.postMessage({action:ACTION.SIGNATURE,signature:Vr},br.origin)}catch{(Gr=br.source)==null||Gr.postMessage({action:ACTION.ERROR,error:"Origin Not Connected"},br.origin)}break}}},window.addEventListener("message",uy.messageListener)}};Fu(uy,"messageListener");let PostMessageHandler=uy;function bind$1(fr,br){return function(){return fr.apply(br,arguments)}}const{toString:toString$a}=Object.prototype,{getPrototypeOf}=Object,kindOf=(fr=>br=>{const wr=toString$a.call(br);return fr[wr]||(fr[wr]=wr.slice(8,-1).toLowerCase())})(Object.create(null)),kindOfTest=fr=>(fr=fr.toLowerCase(),br=>kindOf(br)===fr),typeOfTest=fr=>br=>typeof br===fr,{isArray:isArray$c}=Array,isUndefined=typeOfTest("undefined");function isBuffer$4(fr){return fr!==null&&!isUndefined(fr)&&fr.constructor!==null&&!isUndefined(fr.constructor)&&isFunction$6(fr.constructor.isBuffer)&&fr.constructor.isBuffer(fr)}const isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(fr){let br;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?br=ArrayBuffer.isView(fr):br=fr&&fr.buffer&&isArrayBuffer(fr.buffer),br}const isString$2=typeOfTest("string"),isFunction$6=typeOfTest("function"),isNumber=typeOfTest("number"),isObject$a=fr=>fr!==null&&typeof fr=="object",isBoolean$1=fr=>fr===!0||fr===!1,isPlainObject$1=fr=>{if(kindOf(fr)!=="object")return!1;const br=getPrototypeOf(fr);return(br===null||br===Object.prototype||Object.getPrototypeOf(br)===null)&&!(Symbol.toStringTag in fr)&&!(Symbol.iterator in fr)},isDate$1=kindOfTest("Date"),isFile=kindOfTest("File"),isBlob$1=kindOfTest("Blob"),isFileList=kindOfTest("FileList"),isStream=fr=>isObject$a(fr)&&isFunction$6(fr.pipe),isFormData=fr=>{let br;return fr&&(typeof FormData=="function"&&fr instanceof FormData||isFunction$6(fr.append)&&((br=kindOf(fr))==="formdata"||br==="object"&&isFunction$6(fr.toString)&&fr.toString()==="[object FormData]"))},isURLSearchParams=kindOfTest("URLSearchParams"),[isReadableStream,isRequest,isResponse,isHeaders]=["ReadableStream","Request","Response","Headers"].map(kindOfTest),trim$3=fr=>fr.trim?fr.trim():fr.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function forEach$1(fr,br,{allOwnKeys:wr=!1}={}){if(fr===null||typeof fr>"u")return;let Er,kr;if(typeof fr!="object"&&(fr=[fr]),isArray$c(fr))for(Er=0,kr=fr.length;Er0;)if(kr=wr[Er],br===kr.toLowerCase())return kr;return null}const _global=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global$1,isContextDefined=fr=>!isUndefined(fr)&&fr!==_global;function merge(){const{caseless:fr}=isContextDefined(this)&&this||{},br={},wr=(Er,kr)=>{const jr=fr&&findKey(br,kr)||kr;isPlainObject$1(br[jr])&&isPlainObject$1(Er)?br[jr]=merge(br[jr],Er):isPlainObject$1(Er)?br[jr]=merge({},Er):isArray$c(Er)?br[jr]=Er.slice():br[jr]=Er};for(let Er=0,kr=arguments.length;Er(forEach$1(br,(kr,jr)=>{wr&&isFunction$6(kr)?fr[jr]=bind$1(kr,wr):fr[jr]=kr},{allOwnKeys:Er}),fr),stripBOM=fr=>(fr.charCodeAt(0)===65279&&(fr=fr.slice(1)),fr),inherits=(fr,br,wr,Er)=>{fr.prototype=Object.create(br.prototype,Er),fr.prototype.constructor=fr,Object.defineProperty(fr,"super",{value:br.prototype}),wr&&Object.assign(fr.prototype,wr)},toFlatObject=(fr,br,wr,Er)=>{let kr,jr,Br;const Wr={};if(br=br||{},fr==null)return br;do{for(kr=Object.getOwnPropertyNames(fr),jr=kr.length;jr-- >0;)Br=kr[jr],(!Er||Er(Br,fr,br))&&!Wr[Br]&&(br[Br]=fr[Br],Wr[Br]=!0);fr=wr!==!1&&getPrototypeOf(fr)}while(fr&&(!wr||wr(fr,br))&&fr!==Object.prototype);return br},endsWith=(fr,br,wr)=>{fr=String(fr),(wr===void 0||wr>fr.length)&&(wr=fr.length),wr-=br.length;const Er=fr.indexOf(br,wr);return Er!==-1&&Er===wr},toArray$2=fr=>{if(!fr)return null;if(isArray$c(fr))return fr;let br=fr.length;if(!isNumber(br))return null;const wr=new Array(br);for(;br-- >0;)wr[br]=fr[br];return wr},isTypedArray$5=(fr=>br=>fr&&br instanceof fr)(typeof Uint8Array<"u"&&getPrototypeOf(Uint8Array)),forEachEntry=(fr,br)=>{const Er=(fr&&fr[Symbol.iterator]).call(fr);let kr;for(;(kr=Er.next())&&!kr.done;){const jr=kr.value;br.call(fr,jr[0],jr[1])}},matchAll=(fr,br)=>{let wr;const Er=[];for(;(wr=fr.exec(br))!==null;)Er.push(wr);return Er},isHTMLForm=kindOfTest("HTMLFormElement"),toCamelCase=fr=>fr.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(wr,Er,kr){return Er.toUpperCase()+kr}),hasOwnProperty$l=(({hasOwnProperty:fr})=>(br,wr)=>fr.call(br,wr))(Object.prototype),isRegExp=kindOfTest("RegExp"),reduceDescriptors=(fr,br)=>{const wr=Object.getOwnPropertyDescriptors(fr),Er={};forEach$1(wr,(kr,jr)=>{let Br;(Br=br(kr,jr,fr))!==!1&&(Er[jr]=Br||kr)}),Object.defineProperties(fr,Er)},freezeMethods=fr=>{reduceDescriptors(fr,(br,wr)=>{if(isFunction$6(fr)&&["arguments","caller","callee"].indexOf(wr)!==-1)return!1;const Er=fr[wr];if(isFunction$6(Er)){if(br.enumerable=!1,"writable"in br){br.writable=!1;return}br.set||(br.set=()=>{throw Error("Can not rewrite read-only method '"+wr+"'")})}})},toObjectSet=(fr,br)=>{const wr={},Er=kr=>{kr.forEach(jr=>{wr[jr]=!0})};return isArray$c(fr)?Er(fr):Er(String(fr).split(br)),wr},noop$5=()=>{},toFiniteNumber=(fr,br)=>fr!=null&&Number.isFinite(fr=+fr)?fr:br,ALPHA="abcdefghijklmnopqrstuvwxyz",DIGIT="0123456789",ALPHABET$5={DIGIT,ALPHA,ALPHA_DIGIT:ALPHA+ALPHA.toUpperCase()+DIGIT},generateString=(fr=16,br=ALPHABET$5.ALPHA_DIGIT)=>{let wr="";const{length:Er}=br;for(;fr--;)wr+=br[Math.random()*Er|0];return wr};function isSpecCompliantForm(fr){return!!(fr&&isFunction$6(fr.append)&&fr[Symbol.toStringTag]==="FormData"&&fr[Symbol.iterator])}const toJSONObject=fr=>{const br=new Array(10),wr=(Er,kr)=>{if(isObject$a(Er)){if(br.indexOf(Er)>=0)return;if(!("toJSON"in Er)){br[kr]=Er;const jr=isArray$c(Er)?[]:{};return forEach$1(Er,(Br,Wr)=>{const qr=wr(Br,kr+1);!isUndefined(qr)&&(jr[Wr]=qr)}),br[kr]=void 0,jr}}return Er};return wr(fr,0)},isAsyncFn=kindOfTest("AsyncFunction"),isThenable=fr=>fr&&(isObject$a(fr)||isFunction$6(fr))&&isFunction$6(fr.then)&&isFunction$6(fr.catch),_setImmediate=((fr,br)=>fr?setImmediate:br?((wr,Er)=>(_global.addEventListener("message",({source:kr,data:jr})=>{kr===_global&&jr===wr&&Er.length&&Er.shift()()},!1),kr=>{Er.push(kr),_global.postMessage(wr,"*")}))(`axios@${Math.random()}`,[]):wr=>setTimeout(wr))(typeof setImmediate=="function",isFunction$6(_global.postMessage)),asap=typeof queueMicrotask<"u"?queueMicrotask.bind(_global):typeof process$1$1<"u"&&process$1$1.nextTick||_setImmediate,utils$d={isArray:isArray$c,isArrayBuffer,isBuffer:isBuffer$4,isFormData,isArrayBufferView,isString:isString$2,isNumber,isBoolean:isBoolean$1,isObject:isObject$a,isPlainObject:isPlainObject$1,isReadableStream,isRequest,isResponse,isHeaders,isUndefined,isDate:isDate$1,isFile,isBlob:isBlob$1,isRegExp,isFunction:isFunction$6,isStream,isURLSearchParams,isTypedArray:isTypedArray$5,isFileList,forEach:forEach$1,merge,extend,trim:trim$3,stripBOM,inherits,toFlatObject,kindOf,kindOfTest,endsWith,toArray:toArray$2,forEachEntry,matchAll,isHTMLForm,hasOwnProperty:hasOwnProperty$l,hasOwnProp:hasOwnProperty$l,reduceDescriptors,freezeMethods,toObjectSet,toCamelCase,noop:noop$5,toFiniteNumber,findKey,global:_global,isContextDefined,ALPHABET:ALPHABET$5,generateString,isSpecCompliantForm,toJSONObject,isAsyncFn,isThenable,setImmediate:_setImmediate,asap};var buffer$2={},base64Js={};base64Js.byteLength=byteLength;base64Js.toByteArray=toByteArray;base64Js.fromByteArray=fromByteArray;var lookup=[],revLookup=[],Arr=typeof Uint8Array<"u"?Uint8Array:Array,code="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i$9=0,len=code.length;i$90)throw new Error("Invalid string. Length must be a multiple of 4");var wr=fr.indexOf("=");wr===-1&&(wr=br);var Er=wr===br?0:4-wr%4;return[wr,Er]}function byteLength(fr){var br=getLens(fr),wr=br[0],Er=br[1];return(wr+Er)*3/4-Er}function _byteLength(fr,br,wr){return(br+wr)*3/4-wr}function toByteArray(fr){var br,wr=getLens(fr),Er=wr[0],kr=wr[1],jr=new Arr(_byteLength(fr,Er,kr)),Br=0,Wr=kr>0?Er-4:Er,qr;for(qr=0;qr>16&255,jr[Br++]=br>>8&255,jr[Br++]=br&255;return kr===2&&(br=revLookup[fr.charCodeAt(qr)]<<2|revLookup[fr.charCodeAt(qr+1)]>>4,jr[Br++]=br&255),kr===1&&(br=revLookup[fr.charCodeAt(qr)]<<10|revLookup[fr.charCodeAt(qr+1)]<<4|revLookup[fr.charCodeAt(qr+2)]>>2,jr[Br++]=br>>8&255,jr[Br++]=br&255),jr}function tripletToBase64(fr){return lookup[fr>>18&63]+lookup[fr>>12&63]+lookup[fr>>6&63]+lookup[fr&63]}function encodeChunk(fr,br,wr){for(var Er,kr=[],jr=br;jrWr?Wr:Br+jr));return Er===1?(br=fr[wr-1],kr.push(lookup[br>>2]+lookup[br<<4&63]+"==")):Er===2&&(br=(fr[wr-2]<<8)+fr[wr-1],kr.push(lookup[br>>10]+lookup[br>>4&63]+lookup[br<<2&63]+"=")),kr.join("")}var ieee754={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ieee754.read=function(fr,br,wr,Er,kr){var jr,Br,Wr=kr*8-Er-1,qr=(1<>1,Vr=-7,Zr=wr?kr-1:0,Jr=wr?-1:1,Qr=fr[br+Zr];for(Zr+=Jr,jr=Qr&(1<<-Vr)-1,Qr>>=-Vr,Vr+=Wr;Vr>0;jr=jr*256+fr[br+Zr],Zr+=Jr,Vr-=8);for(Br=jr&(1<<-Vr)-1,jr>>=-Vr,Vr+=Er;Vr>0;Br=Br*256+fr[br+Zr],Zr+=Jr,Vr-=8);if(jr===0)jr=1-Gr;else{if(jr===qr)return Br?NaN:(Qr?-1:1)*(1/0);Br=Br+Math.pow(2,Er),jr=jr-Gr}return(Qr?-1:1)*Br*Math.pow(2,jr-Er)};ieee754.write=function(fr,br,wr,Er,kr,jr){var Br,Wr,qr,Gr=jr*8-kr-1,Vr=(1<>1,Jr=kr===23?Math.pow(2,-24)-Math.pow(2,-77):0,Qr=Er?0:jr-1,_n=Er?1:-1,En=br<0||br===0&&1/br<0?1:0;for(br=Math.abs(br),isNaN(br)||br===1/0?(Wr=isNaN(br)?1:0,Br=Vr):(Br=Math.floor(Math.log(br)/Math.LN2),br*(qr=Math.pow(2,-Br))<1&&(Br--,qr*=2),Br+Zr>=1?br+=Jr/qr:br+=Jr*Math.pow(2,1-Zr),br*qr>=2&&(Br++,qr/=2),Br+Zr>=Vr?(Wr=0,Br=Vr):Br+Zr>=1?(Wr=(br*qr-1)*Math.pow(2,kr),Br=Br+Zr):(Wr=br*Math.pow(2,Zr-1)*Math.pow(2,kr),Br=0));kr>=8;fr[wr+Qr]=Wr&255,Qr+=_n,Wr/=256,kr-=8);for(Br=Br<0;fr[wr+Qr]=Br&255,Qr+=_n,Br/=256,Gr-=8);fr[wr+Qr-_n]|=En*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */(function(fr){const br=base64Js,wr=ieee754,Er=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;fr.Buffer=Vr,fr.SlowBuffer=ro,fr.INSPECT_MAX_BYTES=50;const kr=2147483647;fr.kMaxLength=kr;const{Uint8Array:jr,ArrayBuffer:Br,SharedArrayBuffer:Wr}=globalThis;Vr.TYPED_ARRAY_SUPPORT=qr(),!Vr.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function qr(){try{const ko=new jr(1),wo={foo:function(){return 42}};return Object.setPrototypeOf(wo,jr.prototype),Object.setPrototypeOf(ko,wo),ko.foo()===42}catch{return!1}}Object.defineProperty(Vr.prototype,"parent",{enumerable:!0,get:function(){if(Vr.isBuffer(this))return this.buffer}}),Object.defineProperty(Vr.prototype,"offset",{enumerable:!0,get:function(){if(Vr.isBuffer(this))return this.byteOffset}});function Gr(ko){if(ko>kr)throw new RangeError('The value "'+ko+'" is invalid for option "size"');const wo=new jr(ko);return Object.setPrototypeOf(wo,Vr.prototype),wo}function Vr(ko,wo,bo){if(typeof ko=="number"){if(typeof wo=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return _n(ko)}return Zr(ko,wo,bo)}Vr.poolSize=8192;function Zr(ko,wo,bo){if(typeof ko=="string")return En(ko,wo);if(Br.isView(ko))return In(ko);if(ko==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof ko);if(Ml(ko,Br)||ko&&Ml(ko.buffer,Br)||typeof Wr<"u"&&(Ml(ko,Wr)||ko&&Ml(ko.buffer,Wr)))return An(ko,wo,bo);if(typeof ko=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Io=ko.valueOf&&ko.valueOf();if(Io!=null&&Io!==ko)return Vr.from(Io,wo,bo);const Ho=jn(ko);if(Ho)return Ho;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof ko[Symbol.toPrimitive]=="function")return Vr.from(ko[Symbol.toPrimitive]("string"),wo,bo);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof ko)}Vr.from=function(ko,wo,bo){return Zr(ko,wo,bo)},Object.setPrototypeOf(Vr.prototype,jr.prototype),Object.setPrototypeOf(Vr,jr);function Jr(ko){if(typeof ko!="number")throw new TypeError('"size" argument must be of type number');if(ko<0)throw new RangeError('The value "'+ko+'" is invalid for option "size"')}function Qr(ko,wo,bo){return Jr(ko),ko<=0?Gr(ko):wo!==void 0?typeof bo=="string"?Gr(ko).fill(wo,bo):Gr(ko).fill(wo):Gr(ko)}Vr.alloc=function(ko,wo,bo){return Qr(ko,wo,bo)};function _n(ko){return Jr(ko),Gr(ko<0?0:eo(ko)|0)}Vr.allocUnsafe=function(ko){return _n(ko)},Vr.allocUnsafeSlow=function(ko){return _n(ko)};function En(ko,wo){if((typeof wo!="string"||wo==="")&&(wo="utf8"),!Vr.isEncoding(wo))throw new TypeError("Unknown encoding: "+wo);const bo=to(ko,wo)|0;let Io=Gr(bo);const Ho=Io.write(ko,wo);return Ho!==bo&&(Io=Io.slice(0,Ho)),Io}function Cn(ko){const wo=ko.length<0?0:eo(ko.length)|0,bo=Gr(wo);for(let Io=0;Io=kr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kr.toString(16)+" bytes");return ko|0}function ro(ko){return+ko!=ko&&(ko=0),Vr.alloc(+ko)}Vr.isBuffer=function(wo){return wo!=null&&wo._isBuffer===!0&&wo!==Vr.prototype},Vr.compare=function(wo,bo){if(Ml(wo,jr)&&(wo=Vr.from(wo,wo.offset,wo.byteLength)),Ml(bo,jr)&&(bo=Vr.from(bo,bo.offset,bo.byteLength)),!Vr.isBuffer(wo)||!Vr.isBuffer(bo))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(wo===bo)return 0;let Io=wo.length,Ho=bo.length;for(let Do=0,zo=Math.min(Io,Ho);DoHo.length?(Vr.isBuffer(zo)||(zo=Vr.from(zo)),zo.copy(Ho,Do)):jr.prototype.set.call(Ho,zo,Do);else if(Vr.isBuffer(zo))zo.copy(Ho,Do);else throw new TypeError('"list" argument must be an Array of Buffers');Do+=zo.length}return Ho};function to(ko,wo){if(Vr.isBuffer(ko))return ko.length;if(Br.isView(ko)||Ml(ko,Br))return ko.byteLength;if(typeof ko!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof ko);const bo=ko.length,Io=arguments.length>2&&arguments[2]===!0;if(!Io&&bo===0)return 0;let Ho=!1;for(;;)switch(wo){case"ascii":case"latin1":case"binary":return bo;case"utf8":case"utf-8":return No(ko).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return bo*2;case"hex":return bo>>>1;case"base64":return Vo(ko).length;default:if(Ho)return Io?-1:No(ko).length;wo=(""+wo).toLowerCase(),Ho=!0}}Vr.byteLength=to;function _i(ko,wo,bo){let Io=!1;if((wo===void 0||wo<0)&&(wo=0),wo>this.length||((bo===void 0||bo>this.length)&&(bo=this.length),bo<=0)||(bo>>>=0,wo>>>=0,bo<=wo))return"";for(ko||(ko="utf8");;)switch(ko){case"hex":return wn(this,wo,bo);case"utf8":case"utf-8":return Rn(this,wo,bo);case"ascii":return Zn(this,wo,bo);case"latin1":case"binary":return Nn(this,wo,bo);case"base64":return Sn(this,wo,bo);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zn(this,wo,bo);default:if(Io)throw new TypeError("Unknown encoding: "+ko);ko=(ko+"").toLowerCase(),Io=!0}}Vr.prototype._isBuffer=!0;function oo(ko,wo,bo){const Io=ko[wo];ko[wo]=ko[bo],ko[bo]=Io}Vr.prototype.swap16=function(){const wo=this.length;if(wo%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let bo=0;bobo&&(wo+=" ... "),""},Er&&(Vr.prototype[Er]=Vr.prototype.inspect),Vr.prototype.compare=function(wo,bo,Io,Ho,Do){if(Ml(wo,jr)&&(wo=Vr.from(wo,wo.offset,wo.byteLength)),!Vr.isBuffer(wo))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof wo);if(bo===void 0&&(bo=0),Io===void 0&&(Io=wo?wo.length:0),Ho===void 0&&(Ho=0),Do===void 0&&(Do=this.length),bo<0||Io>wo.length||Ho<0||Do>this.length)throw new RangeError("out of range index");if(Ho>=Do&&bo>=Io)return 0;if(Ho>=Do)return-1;if(bo>=Io)return 1;if(bo>>>=0,Io>>>=0,Ho>>>=0,Do>>>=0,this===wo)return 0;let zo=Do-Ho,nu=Io-bo;const Ll=Math.min(zo,nu),_l=this.slice(Ho,Do),bu=wo.slice(bo,Io);for(let xl=0;xl2147483647?bo=2147483647:bo<-2147483648&&(bo=-2147483648),bo=+bo,$a(bo)&&(bo=Ho?0:ko.length-1),bo<0&&(bo=ko.length+bo),bo>=ko.length){if(Ho)return-1;bo=ko.length-1}else if(bo<0)if(Ho)bo=0;else return-1;if(typeof wo=="string"&&(wo=Vr.from(wo,Io)),Vr.isBuffer(wo))return wo.length===0?-1:co(ko,wo,bo,Io,Ho);if(typeof wo=="number")return wo=wo&255,typeof jr.prototype.indexOf=="function"?Ho?jr.prototype.indexOf.call(ko,wo,bo):jr.prototype.lastIndexOf.call(ko,wo,bo):co(ko,[wo],bo,Io,Ho);throw new TypeError("val must be string, number or Buffer")}function co(ko,wo,bo,Io,Ho){let Do=1,zo=ko.length,nu=wo.length;if(Io!==void 0&&(Io=String(Io).toLowerCase(),Io==="ucs2"||Io==="ucs-2"||Io==="utf16le"||Io==="utf-16le")){if(ko.length<2||wo.length<2)return-1;Do=2,zo/=2,nu/=2,bo/=2}function Ll(bu,xl){return Do===1?bu[xl]:bu.readUInt16BE(xl*Do)}let _l;if(Ho){let bu=-1;for(_l=bo;_lzo&&(bo=zo-nu),_l=bo;_l>=0;_l--){let bu=!0;for(let xl=0;xlHo&&(Io=Ho)):Io=Ho;const Do=wo.length;Io>Do/2&&(Io=Do/2);let zo;for(zo=0;zo>>0,isFinite(Io)?(Io=Io>>>0,Ho===void 0&&(Ho="utf8")):(Ho=Io,Io=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Do=this.length-bo;if((Io===void 0||Io>Do)&&(Io=Do),wo.length>0&&(Io<0||bo<0)||bo>this.length)throw new RangeError("Attempt to write outside buffer bounds");Ho||(Ho="utf8");let zo=!1;for(;;)switch(Ho){case"hex":return so(this,wo,bo,Io);case"utf8":case"utf-8":return no(this,wo,bo,Io);case"ascii":case"latin1":case"binary":return Tn(this,wo,bo,Io);case"base64":return Hr(this,wo,bo,Io);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Xr(this,wo,bo,Io);default:if(zo)throw new TypeError("Unknown encoding: "+Ho);Ho=(""+Ho).toLowerCase(),zo=!0}},Vr.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Sn(ko,wo,bo){return wo===0&&bo===ko.length?br.fromByteArray(ko):br.fromByteArray(ko.slice(wo,bo))}function Rn(ko,wo,bo){bo=Math.min(ko.length,bo);const Io=[];let Ho=wo;for(;Ho239?4:Do>223?3:Do>191?2:1;if(Ho+nu<=bo){let Ll,_l,bu,xl;switch(nu){case 1:Do<128&&(zo=Do);break;case 2:Ll=ko[Ho+1],(Ll&192)===128&&(xl=(Do&31)<<6|Ll&63,xl>127&&(zo=xl));break;case 3:Ll=ko[Ho+1],_l=ko[Ho+2],(Ll&192)===128&&(_l&192)===128&&(xl=(Do&15)<<12|(Ll&63)<<6|_l&63,xl>2047&&(xl<55296||xl>57343)&&(zo=xl));break;case 4:Ll=ko[Ho+1],_l=ko[Ho+2],bu=ko[Ho+3],(Ll&192)===128&&(_l&192)===128&&(bu&192)===128&&(xl=(Do&15)<<18|(Ll&63)<<12|(_l&63)<<6|bu&63,xl>65535&&xl<1114112&&(zo=xl))}}zo===null?(zo=65533,nu=1):zo>65535&&(zo-=65536,Io.push(zo>>>10&1023|55296),zo=56320|zo&1023),Io.push(zo),Ho+=nu}return On(Io)}const Pn=4096;function On(ko){const wo=ko.length;if(wo<=Pn)return String.fromCharCode.apply(String,ko);let bo="",Io=0;for(;IoIo)&&(bo=Io);let Ho="";for(let Do=wo;DoIo&&(wo=Io),bo<0?(bo+=Io,bo<0&&(bo=0)):bo>Io&&(bo=Io),bobo)throw new RangeError("Trying to access beyond buffer length")}Vr.prototype.readUintLE=Vr.prototype.readUIntLE=function(wo,bo,Io){wo=wo>>>0,bo=bo>>>0,Io||fo(wo,bo,this.length);let Ho=this[wo],Do=1,zo=0;for(;++zo>>0,bo=bo>>>0,Io||fo(wo,bo,this.length);let Ho=this[wo+--bo],Do=1;for(;bo>0&&(Do*=256);)Ho+=this[wo+--bo]*Do;return Ho},Vr.prototype.readUint8=Vr.prototype.readUInt8=function(wo,bo){return wo=wo>>>0,bo||fo(wo,1,this.length),this[wo]},Vr.prototype.readUint16LE=Vr.prototype.readUInt16LE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,2,this.length),this[wo]|this[wo+1]<<8},Vr.prototype.readUint16BE=Vr.prototype.readUInt16BE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,2,this.length),this[wo]<<8|this[wo+1]},Vr.prototype.readUint32LE=Vr.prototype.readUInt32LE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,4,this.length),(this[wo]|this[wo+1]<<8|this[wo+2]<<16)+this[wo+3]*16777216},Vr.prototype.readUint32BE=Vr.prototype.readUInt32BE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,4,this.length),this[wo]*16777216+(this[wo+1]<<16|this[wo+2]<<8|this[wo+3])},Vr.prototype.readBigUInt64LE=Zl(function(wo){wo=wo>>>0,na(wo,"offset");const bo=this[wo],Io=this[wo+7];(bo===void 0||Io===void 0)&&qo(wo,this.length-8);const Ho=bo+this[++wo]*2**8+this[++wo]*2**16+this[++wo]*2**24,Do=this[++wo]+this[++wo]*2**8+this[++wo]*2**16+Io*2**24;return BigInt(Ho)+(BigInt(Do)<>>0,na(wo,"offset");const bo=this[wo],Io=this[wo+7];(bo===void 0||Io===void 0)&&qo(wo,this.length-8);const Ho=bo*2**24+this[++wo]*2**16+this[++wo]*2**8+this[++wo],Do=this[++wo]*2**24+this[++wo]*2**16+this[++wo]*2**8+Io;return(BigInt(Ho)<>>0,bo=bo>>>0,Io||fo(wo,bo,this.length);let Ho=this[wo],Do=1,zo=0;for(;++zo=Do&&(Ho-=Math.pow(2,8*bo)),Ho},Vr.prototype.readIntBE=function(wo,bo,Io){wo=wo>>>0,bo=bo>>>0,Io||fo(wo,bo,this.length);let Ho=bo,Do=1,zo=this[wo+--Ho];for(;Ho>0&&(Do*=256);)zo+=this[wo+--Ho]*Do;return Do*=128,zo>=Do&&(zo-=Math.pow(2,8*bo)),zo},Vr.prototype.readInt8=function(wo,bo){return wo=wo>>>0,bo||fo(wo,1,this.length),this[wo]&128?(255-this[wo]+1)*-1:this[wo]},Vr.prototype.readInt16LE=function(wo,bo){wo=wo>>>0,bo||fo(wo,2,this.length);const Io=this[wo]|this[wo+1]<<8;return Io&32768?Io|4294901760:Io},Vr.prototype.readInt16BE=function(wo,bo){wo=wo>>>0,bo||fo(wo,2,this.length);const Io=this[wo+1]|this[wo]<<8;return Io&32768?Io|4294901760:Io},Vr.prototype.readInt32LE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,4,this.length),this[wo]|this[wo+1]<<8|this[wo+2]<<16|this[wo+3]<<24},Vr.prototype.readInt32BE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,4,this.length),this[wo]<<24|this[wo+1]<<16|this[wo+2]<<8|this[wo+3]},Vr.prototype.readBigInt64LE=Zl(function(wo){wo=wo>>>0,na(wo,"offset");const bo=this[wo],Io=this[wo+7];(bo===void 0||Io===void 0)&&qo(wo,this.length-8);const Ho=this[wo+4]+this[wo+5]*2**8+this[wo+6]*2**16+(Io<<24);return(BigInt(Ho)<>>0,na(wo,"offset");const bo=this[wo],Io=this[wo+7];(bo===void 0||Io===void 0)&&qo(wo,this.length-8);const Ho=(bo<<24)+this[++wo]*2**16+this[++wo]*2**8+this[++wo];return(BigInt(Ho)<>>0,bo||fo(wo,4,this.length),wr.read(this,wo,!0,23,4)},Vr.prototype.readFloatBE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,4,this.length),wr.read(this,wo,!1,23,4)},Vr.prototype.readDoubleLE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,8,this.length),wr.read(this,wo,!0,52,8)},Vr.prototype.readDoubleBE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,8,this.length),wr.read(this,wo,!1,52,8)};function vo(ko,wo,bo,Io,Ho,Do){if(!Vr.isBuffer(ko))throw new TypeError('"buffer" argument must be a Buffer instance');if(wo>Ho||woko.length)throw new RangeError("Index out of range")}Vr.prototype.writeUintLE=Vr.prototype.writeUIntLE=function(wo,bo,Io,Ho){if(wo=+wo,bo=bo>>>0,Io=Io>>>0,!Ho){const nu=Math.pow(2,8*Io)-1;vo(this,wo,bo,Io,nu,0)}let Do=1,zo=0;for(this[bo]=wo&255;++zo>>0,Io=Io>>>0,!Ho){const nu=Math.pow(2,8*Io)-1;vo(this,wo,bo,Io,nu,0)}let Do=Io-1,zo=1;for(this[bo+Do]=wo&255;--Do>=0&&(zo*=256);)this[bo+Do]=wo/zo&255;return bo+Io},Vr.prototype.writeUint8=Vr.prototype.writeUInt8=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,1,255,0),this[bo]=wo&255,bo+1},Vr.prototype.writeUint16LE=Vr.prototype.writeUInt16LE=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,2,65535,0),this[bo]=wo&255,this[bo+1]=wo>>>8,bo+2},Vr.prototype.writeUint16BE=Vr.prototype.writeUInt16BE=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,2,65535,0),this[bo]=wo>>>8,this[bo+1]=wo&255,bo+2},Vr.prototype.writeUint32LE=Vr.prototype.writeUInt32LE=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,4,4294967295,0),this[bo+3]=wo>>>24,this[bo+2]=wo>>>16,this[bo+1]=wo>>>8,this[bo]=wo&255,bo+4},Vr.prototype.writeUint32BE=Vr.prototype.writeUInt32BE=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,4,4294967295,0),this[bo]=wo>>>24,this[bo+1]=wo>>>16,this[bo+2]=wo>>>8,this[bo+3]=wo&255,bo+4};function go(ko,wo,bo,Io,Ho){Wo(wo,Io,Ho,ko,bo,7);let Do=Number(wo&BigInt(4294967295));ko[bo++]=Do,Do=Do>>8,ko[bo++]=Do,Do=Do>>8,ko[bo++]=Do,Do=Do>>8,ko[bo++]=Do;let zo=Number(wo>>BigInt(32)&BigInt(4294967295));return ko[bo++]=zo,zo=zo>>8,ko[bo++]=zo,zo=zo>>8,ko[bo++]=zo,zo=zo>>8,ko[bo++]=zo,bo}function uo(ko,wo,bo,Io,Ho){Wo(wo,Io,Ho,ko,bo,7);let Do=Number(wo&BigInt(4294967295));ko[bo+7]=Do,Do=Do>>8,ko[bo+6]=Do,Do=Do>>8,ko[bo+5]=Do,Do=Do>>8,ko[bo+4]=Do;let zo=Number(wo>>BigInt(32)&BigInt(4294967295));return ko[bo+3]=zo,zo=zo>>8,ko[bo+2]=zo,zo=zo>>8,ko[bo+1]=zo,zo=zo>>8,ko[bo]=zo,bo+8}Vr.prototype.writeBigUInt64LE=Zl(function(wo,bo=0){return go(this,wo,bo,BigInt(0),BigInt("0xffffffffffffffff"))}),Vr.prototype.writeBigUInt64BE=Zl(function(wo,bo=0){return uo(this,wo,bo,BigInt(0),BigInt("0xffffffffffffffff"))}),Vr.prototype.writeIntLE=function(wo,bo,Io,Ho){if(wo=+wo,bo=bo>>>0,!Ho){const Ll=Math.pow(2,8*Io-1);vo(this,wo,bo,Io,Ll-1,-Ll)}let Do=0,zo=1,nu=0;for(this[bo]=wo&255;++Do>0)-nu&255;return bo+Io},Vr.prototype.writeIntBE=function(wo,bo,Io,Ho){if(wo=+wo,bo=bo>>>0,!Ho){const Ll=Math.pow(2,8*Io-1);vo(this,wo,bo,Io,Ll-1,-Ll)}let Do=Io-1,zo=1,nu=0;for(this[bo+Do]=wo&255;--Do>=0&&(zo*=256);)wo<0&&nu===0&&this[bo+Do+1]!==0&&(nu=1),this[bo+Do]=(wo/zo>>0)-nu&255;return bo+Io},Vr.prototype.writeInt8=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,1,127,-128),wo<0&&(wo=255+wo+1),this[bo]=wo&255,bo+1},Vr.prototype.writeInt16LE=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,2,32767,-32768),this[bo]=wo&255,this[bo+1]=wo>>>8,bo+2},Vr.prototype.writeInt16BE=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,2,32767,-32768),this[bo]=wo>>>8,this[bo+1]=wo&255,bo+2},Vr.prototype.writeInt32LE=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,4,2147483647,-2147483648),this[bo]=wo&255,this[bo+1]=wo>>>8,this[bo+2]=wo>>>16,this[bo+3]=wo>>>24,bo+4},Vr.prototype.writeInt32BE=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,4,2147483647,-2147483648),wo<0&&(wo=4294967295+wo+1),this[bo]=wo>>>24,this[bo+1]=wo>>>16,this[bo+2]=wo>>>8,this[bo+3]=wo&255,bo+4},Vr.prototype.writeBigInt64LE=Zl(function(wo,bo=0){return go(this,wo,bo,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),Vr.prototype.writeBigInt64BE=Zl(function(wo,bo=0){return uo(this,wo,bo,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function lo(ko,wo,bo,Io,Ho,Do){if(bo+Io>ko.length)throw new RangeError("Index out of range");if(bo<0)throw new RangeError("Index out of range")}function Eo(ko,wo,bo,Io,Ho){return wo=+wo,bo=bo>>>0,Ho||lo(ko,wo,bo,4),wr.write(ko,wo,bo,Io,23,4),bo+4}Vr.prototype.writeFloatLE=function(wo,bo,Io){return Eo(this,wo,bo,!0,Io)},Vr.prototype.writeFloatBE=function(wo,bo,Io){return Eo(this,wo,bo,!1,Io)};function mo(ko,wo,bo,Io,Ho){return wo=+wo,bo=bo>>>0,Ho||lo(ko,wo,bo,8),wr.write(ko,wo,bo,Io,52,8),bo+8}Vr.prototype.writeDoubleLE=function(wo,bo,Io){return mo(this,wo,bo,!0,Io)},Vr.prototype.writeDoubleBE=function(wo,bo,Io){return mo(this,wo,bo,!1,Io)},Vr.prototype.copy=function(wo,bo,Io,Ho){if(!Vr.isBuffer(wo))throw new TypeError("argument should be a Buffer");if(Io||(Io=0),!Ho&&Ho!==0&&(Ho=this.length),bo>=wo.length&&(bo=wo.length),bo||(bo=0),Ho>0&&Ho=this.length)throw new RangeError("Index out of range");if(Ho<0)throw new RangeError("sourceEnd out of bounds");Ho>this.length&&(Ho=this.length),wo.length-bo>>0,Io=Io===void 0?this.length:Io>>>0,wo||(wo=0);let Do;if(typeof wo=="number")for(Do=bo;Do2**32?Ho=Bo(String(bo)):typeof bo=="bigint"&&(Ho=String(bo),(bo>BigInt(2)**BigInt(32)||bo<-(BigInt(2)**BigInt(32)))&&(Ho=Bo(Ho)),Ho+="n"),Io+=` It must be ${wo}. Received ${Ho}`,Io},RangeError);function Bo(ko){let wo="",bo=ko.length;const Io=ko[0]==="-"?1:0;for(;bo>=Io+4;bo-=3)wo=`_${ko.slice(bo-3,bo)}${wo}`;return`${ko.slice(0,bo)}${wo}`}function Lo(ko,wo,bo){na(wo,"offset"),(ko[wo]===void 0||ko[wo+bo]===void 0)&&qo(wo,ko.length-(bo+1))}function Wo(ko,wo,bo,Io,Ho,Do){if(ko>bo||ko= 0${zo} and < 2${zo} ** ${(Do+1)*8}${zo}`:nu=`>= -(2${zo} ** ${(Do+1)*8-1}${zo}) and < 2 ** ${(Do+1)*8-1}${zo}`,new yo.ERR_OUT_OF_RANGE("value",nu,ko)}Lo(Io,Ho,Do)}function na(ko,wo){if(typeof ko!="number")throw new yo.ERR_INVALID_ARG_TYPE(wo,"number",ko)}function qo(ko,wo,bo){throw Math.floor(ko)!==ko?(na(ko,bo),new yo.ERR_OUT_OF_RANGE("offset","an integer",ko)):wo<0?new yo.ERR_BUFFER_OUT_OF_BOUNDS:new yo.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${wo}`,ko)}const ga=/[^+/0-9A-Za-z-_]/g;function wl(ko){if(ko=ko.split("=")[0],ko=ko.trim().replace(ga,""),ko.length<2)return"";for(;ko.length%4!==0;)ko=ko+"=";return ko}function No(ko,wo){wo=wo||1/0;let bo;const Io=ko.length;let Ho=null;const Do=[];for(let zo=0;zo55295&&bo<57344){if(!Ho){if(bo>56319){(wo-=3)>-1&&Do.push(239,191,189);continue}else if(zo+1===Io){(wo-=3)>-1&&Do.push(239,191,189);continue}Ho=bo;continue}if(bo<56320){(wo-=3)>-1&&Do.push(239,191,189),Ho=bo;continue}bo=(Ho-55296<<10|bo-56320)+65536}else Ho&&(wo-=3)>-1&&Do.push(239,191,189);if(Ho=null,bo<128){if((wo-=1)<0)break;Do.push(bo)}else if(bo<2048){if((wo-=2)<0)break;Do.push(bo>>6|192,bo&63|128)}else if(bo<65536){if((wo-=3)<0)break;Do.push(bo>>12|224,bo>>6&63|128,bo&63|128)}else if(bo<1114112){if((wo-=4)<0)break;Do.push(bo>>18|240,bo>>12&63|128,bo>>6&63|128,bo&63|128)}else throw new Error("Invalid code point")}return Do}function Fo(ko){const wo=[];for(let bo=0;bo>8,Ho=bo%256,Do.push(Ho),Do.push(Io);return Do}function Vo(ko){return br.toByteArray(wl(ko))}function Uo(ko,wo,bo,Io){let Ho;for(Ho=0;Ho=wo.length||Ho>=ko.length);++Ho)wo[Ho+bo]=ko[Ho];return Ho}function Ml(ko,wo){return ko instanceof wo||ko!=null&&ko.constructor!=null&&ko.constructor.name!=null&&ko.constructor.name===wo.name}function $a(ko){return ko!==ko}const Jo=function(){const ko="0123456789abcdef",wo=new Array(256);for(let bo=0;bo<16;++bo){const Io=bo*16;for(let Ho=0;Ho<16;++Ho)wo[Io+Ho]=ko[bo]+ko[Ho]}return wo}();function Zl(ko){return typeof BigInt>"u"?Cl:ko}function Cl(){throw new Error("BigInt not supported")}})(buffer$2);const Buffer$2=buffer$2.Buffer,Blob$3=buffer$2.Blob,BlobOptions=buffer$2.BlobOptions,Buffer$1$1=buffer$2.Buffer,File=buffer$2.File,FileOptions=buffer$2.FileOptions,INSPECT_MAX_BYTES=buffer$2.INSPECT_MAX_BYTES,SlowBuffer=buffer$2.SlowBuffer,TranscodeEncoding=buffer$2.TranscodeEncoding,atob$1=buffer$2.atob,btoa$2=buffer$2.btoa,constants$7=buffer$2.constants,isAscii=buffer$2.isAscii,isUtf8=buffer$2.isUtf8,kMaxLength=buffer$2.kMaxLength,kStringMaxLength=buffer$2.kStringMaxLength,resolveObjectURL=buffer$2.resolveObjectURL,transcode=buffer$2.transcode,dist$2=Object.freeze(Object.defineProperty({__proto__:null,Blob:Blob$3,BlobOptions,Buffer:Buffer$1$1,File,FileOptions,INSPECT_MAX_BYTES,SlowBuffer,TranscodeEncoding,atob:atob$1,btoa:btoa$2,constants:constants$7,default:Buffer$2,isAscii,isUtf8,kMaxLength,kStringMaxLength,resolveObjectURL,transcode},Symbol.toStringTag,{value:"Module"}));function AxiosError$1(fr,br,wr,Er,kr){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=fr,this.name="AxiosError",br&&(this.code=br),wr&&(this.config=wr),Er&&(this.request=Er),kr&&(this.response=kr,this.status=kr.status?kr.status:null)}utils$d.inherits(AxiosError$1,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:utils$d.toJSONObject(this.config),code:this.code,status:this.status}}});const prototype$1=AxiosError$1.prototype,descriptors$1={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(fr=>{descriptors$1[fr]={value:fr}});Object.defineProperties(AxiosError$1,descriptors$1);Object.defineProperty(prototype$1,"isAxiosError",{value:!0});AxiosError$1.from=(fr,br,wr,Er,kr,jr)=>{const Br=Object.create(prototype$1);return utils$d.toFlatObject(fr,Br,function(qr){return qr!==Error.prototype},Wr=>Wr!=="isAxiosError"),AxiosError$1.call(Br,fr.message,br,wr,Er,kr),Br.cause=fr,Br.name=fr.name,jr&&Object.assign(Br,jr),Br};const httpAdapter=null;function isVisitable(fr){return utils$d.isPlainObject(fr)||utils$d.isArray(fr)}function removeBrackets(fr){return utils$d.endsWith(fr,"[]")?fr.slice(0,-2):fr}function renderKey(fr,br,wr){return fr?fr.concat(br).map(function(kr,jr){return kr=removeBrackets(kr),!wr&&jr?"["+kr+"]":kr}).join(wr?".":""):br}function isFlatArray(fr){return utils$d.isArray(fr)&&!fr.some(isVisitable)}const predicates=utils$d.toFlatObject(utils$d,{},null,function(br){return/^is[A-Z]/.test(br)});function toFormData$1(fr,br,wr){if(!utils$d.isObject(fr))throw new TypeError("target must be an object");br=br||new FormData,wr=utils$d.toFlatObject(wr,{metaTokens:!0,dots:!1,indexes:!1},!1,function(En,Cn){return!utils$d.isUndefined(Cn[En])});const Er=wr.metaTokens,kr=wr.visitor||Vr,jr=wr.dots,Br=wr.indexes,qr=(wr.Blob||typeof Blob<"u"&&Blob)&&utils$d.isSpecCompliantForm(br);if(!utils$d.isFunction(kr))throw new TypeError("visitor must be a function");function Gr(_n){if(_n===null)return"";if(utils$d.isDate(_n))return _n.toISOString();if(!qr&&utils$d.isBlob(_n))throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");return utils$d.isArrayBuffer(_n)||utils$d.isTypedArray(_n)?qr&&typeof Blob=="function"?new Blob([_n]):Buffer$2.from(_n):_n}function Vr(_n,En,Cn){let In=_n;if(_n&&!Cn&&typeof _n=="object"){if(utils$d.endsWith(En,"{}"))En=Er?En:En.slice(0,-2),_n=JSON.stringify(_n);else if(utils$d.isArray(_n)&&isFlatArray(_n)||(utils$d.isFileList(_n)||utils$d.endsWith(En,"[]"))&&(In=utils$d.toArray(_n)))return En=removeBrackets(En),In.forEach(function(jn,eo){!(utils$d.isUndefined(jn)||jn===null)&&br.append(Br===!0?renderKey([En],eo,jr):Br===null?En:En+"[]",Gr(jn))}),!1}return isVisitable(_n)?!0:(br.append(renderKey(Cn,En,jr),Gr(_n)),!1)}const Zr=[],Jr=Object.assign(predicates,{defaultVisitor:Vr,convertValue:Gr,isVisitable});function Qr(_n,En){if(!utils$d.isUndefined(_n)){if(Zr.indexOf(_n)!==-1)throw Error("Circular reference detected in "+En.join("."));Zr.push(_n),utils$d.forEach(_n,function(In,An){(!(utils$d.isUndefined(In)||In===null)&&kr.call(br,In,utils$d.isString(An)?An.trim():An,En,Jr))===!0&&Qr(In,En?En.concat(An):[An])}),Zr.pop()}}if(!utils$d.isObject(fr))throw new TypeError("data must be an object");return Qr(fr),br}function encode$4(fr){const br={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(fr).replace(/[!'()~]|%20|%00/g,function(Er){return br[Er]})}function AxiosURLSearchParams(fr,br){this._pairs=[],fr&&toFormData$1(fr,this,br)}const prototype=AxiosURLSearchParams.prototype;prototype.append=function(br,wr){this._pairs.push([br,wr])};prototype.toString=function(br){const wr=br?function(Er){return br.call(this,Er,encode$4)}:encode$4;return this._pairs.map(function(kr){return wr(kr[0])+"="+wr(kr[1])},"").join("&")};function encode$3(fr){return encodeURIComponent(fr).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(fr,br,wr){if(!br)return fr;const Er=wr&&wr.encode||encode$3;utils$d.isFunction(wr)&&(wr={serialize:wr});const kr=wr&&wr.serialize;let jr;if(kr?jr=kr(br,wr):jr=utils$d.isURLSearchParams(br)?br.toString():new AxiosURLSearchParams(br,wr).toString(Er),jr){const Br=fr.indexOf("#");Br!==-1&&(fr=fr.slice(0,Br)),fr+=(fr.indexOf("?")===-1?"?":"&")+jr}return fr}class InterceptorManager{constructor(){this.handlers=[]}use(br,wr,Er){return this.handlers.push({fulfilled:br,rejected:wr,synchronous:Er?Er.synchronous:!1,runWhen:Er?Er.runWhen:null}),this.handlers.length-1}eject(br){this.handlers[br]&&(this.handlers[br]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(br){utils$d.forEach(this.handlers,function(Er){Er!==null&&br(Er)})}}const transitionalDefaults={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},URLSearchParams$1=typeof URLSearchParams<"u"?URLSearchParams:AxiosURLSearchParams,FormData$1=typeof FormData<"u"?FormData:null,Blob$2=typeof Blob<"u"?Blob:null,platform$3={isBrowser:!0,classes:{URLSearchParams:URLSearchParams$1,FormData:FormData$1,Blob:Blob$2},protocols:["http","https","file","blob","url","data"]},hasBrowserEnv=typeof window<"u"&&typeof document<"u",_navigator=typeof navigator=="object"&&navigator||void 0,hasStandardBrowserEnv=hasBrowserEnv&&(!_navigator||["ReactNative","NativeScript","NS"].indexOf(_navigator.product)<0),hasStandardBrowserWebWorkerEnv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",origin=hasBrowserEnv&&window.location.href||"http://localhost",utils$c=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv,hasStandardBrowserEnv,hasStandardBrowserWebWorkerEnv,navigator:_navigator,origin},Symbol.toStringTag,{value:"Module"})),platform$2={...utils$c,...platform$3};function toURLEncodedForm(fr,br){return toFormData$1(fr,new platform$2.classes.URLSearchParams,Object.assign({visitor:function(wr,Er,kr,jr){return platform$2.isNode&&utils$d.isBuffer(wr)?(this.append(Er,wr.toString("base64")),!1):jr.defaultVisitor.apply(this,arguments)}},br))}function parsePropPath(fr){return utils$d.matchAll(/\w+|\[(\w*)]/g,fr).map(br=>br[0]==="[]"?"":br[1]||br[0])}function arrayToObject(fr){const br={},wr=Object.keys(fr);let Er;const kr=wr.length;let jr;for(Er=0;Er=wr.length;return Br=!Br&&utils$d.isArray(kr)?kr.length:Br,qr?(utils$d.hasOwnProp(kr,Br)?kr[Br]=[kr[Br],Er]:kr[Br]=Er,!Wr):((!kr[Br]||!utils$d.isObject(kr[Br]))&&(kr[Br]=[]),br(wr,Er,kr[Br],jr)&&utils$d.isArray(kr[Br])&&(kr[Br]=arrayToObject(kr[Br])),!Wr)}if(utils$d.isFormData(fr)&&utils$d.isFunction(fr.entries)){const wr={};return utils$d.forEachEntry(fr,(Er,kr)=>{br(parsePropPath(Er),kr,wr,0)}),wr}return null}function stringifySafely(fr,br,wr){if(utils$d.isString(fr))try{return(br||JSON.parse)(fr),utils$d.trim(fr)}catch(Er){if(Er.name!=="SyntaxError")throw Er}return(0,JSON.stringify)(fr)}const defaults={transitional:transitionalDefaults,adapter:["xhr","http","fetch"],transformRequest:[function(br,wr){const Er=wr.getContentType()||"",kr=Er.indexOf("application/json")>-1,jr=utils$d.isObject(br);if(jr&&utils$d.isHTMLForm(br)&&(br=new FormData(br)),utils$d.isFormData(br))return kr?JSON.stringify(formDataToJSON(br)):br;if(utils$d.isArrayBuffer(br)||utils$d.isBuffer(br)||utils$d.isStream(br)||utils$d.isFile(br)||utils$d.isBlob(br)||utils$d.isReadableStream(br))return br;if(utils$d.isArrayBufferView(br))return br.buffer;if(utils$d.isURLSearchParams(br))return wr.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),br.toString();let Wr;if(jr){if(Er.indexOf("application/x-www-form-urlencoded")>-1)return toURLEncodedForm(br,this.formSerializer).toString();if((Wr=utils$d.isFileList(br))||Er.indexOf("multipart/form-data")>-1){const qr=this.env&&this.env.FormData;return toFormData$1(Wr?{"files[]":br}:br,qr&&new qr,this.formSerializer)}}return jr||kr?(wr.setContentType("application/json",!1),stringifySafely(br)):br}],transformResponse:[function(br){const wr=this.transitional||defaults.transitional,Er=wr&&wr.forcedJSONParsing,kr=this.responseType==="json";if(utils$d.isResponse(br)||utils$d.isReadableStream(br))return br;if(br&&utils$d.isString(br)&&(Er&&!this.responseType||kr)){const Br=!(wr&&wr.silentJSONParsing)&&kr;try{return JSON.parse(br)}catch(Wr){if(Br)throw Wr.name==="SyntaxError"?AxiosError$1.from(Wr,AxiosError$1.ERR_BAD_RESPONSE,this,null,this.response):Wr}}return br}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:platform$2.classes.FormData,Blob:platform$2.classes.Blob},validateStatus:function(br){return br>=200&&br<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};utils$d.forEach(["delete","get","head","post","put","patch"],fr=>{defaults.headers[fr]={}});const ignoreDuplicateOf=utils$d.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),parseHeaders=fr=>{const br={};let wr,Er,kr;return fr&&fr.split(` + */(function(fr){const br=base64Js,wr=ieee754,Er=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;fr.Buffer=Vr,fr.SlowBuffer=ro,fr.INSPECT_MAX_BYTES=50;const kr=2147483647;fr.kMaxLength=kr;const{Uint8Array:jr,ArrayBuffer:Br,SharedArrayBuffer:Wr}=globalThis;Vr.TYPED_ARRAY_SUPPORT=qr(),!Vr.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function qr(){try{const ko=new jr(1),wo={foo:function(){return 42}};return Object.setPrototypeOf(wo,jr.prototype),Object.setPrototypeOf(ko,wo),ko.foo()===42}catch{return!1}}Object.defineProperty(Vr.prototype,"parent",{enumerable:!0,get:function(){if(Vr.isBuffer(this))return this.buffer}}),Object.defineProperty(Vr.prototype,"offset",{enumerable:!0,get:function(){if(Vr.isBuffer(this))return this.byteOffset}});function Gr(ko){if(ko>kr)throw new RangeError('The value "'+ko+'" is invalid for option "size"');const wo=new jr(ko);return Object.setPrototypeOf(wo,Vr.prototype),wo}function Vr(ko,wo,bo){if(typeof ko=="number"){if(typeof wo=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return _n(ko)}return Zr(ko,wo,bo)}Vr.poolSize=8192;function Zr(ko,wo,bo){if(typeof ko=="string")return En(ko,wo);if(Br.isView(ko))return In(ko);if(ko==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof ko);if(Ol(ko,Br)||ko&&Ol(ko.buffer,Br)||typeof Wr<"u"&&(Ol(ko,Wr)||ko&&Ol(ko.buffer,Wr)))return An(ko,wo,bo);if(typeof ko=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Io=ko.valueOf&&ko.valueOf();if(Io!=null&&Io!==ko)return Vr.from(Io,wo,bo);const Ho=jn(ko);if(Ho)return Ho;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof ko[Symbol.toPrimitive]=="function")return Vr.from(ko[Symbol.toPrimitive]("string"),wo,bo);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof ko)}Vr.from=function(ko,wo,bo){return Zr(ko,wo,bo)},Object.setPrototypeOf(Vr.prototype,jr.prototype),Object.setPrototypeOf(Vr,jr);function Jr(ko){if(typeof ko!="number")throw new TypeError('"size" argument must be of type number');if(ko<0)throw new RangeError('The value "'+ko+'" is invalid for option "size"')}function Qr(ko,wo,bo){return Jr(ko),ko<=0?Gr(ko):wo!==void 0?typeof bo=="string"?Gr(ko).fill(wo,bo):Gr(ko).fill(wo):Gr(ko)}Vr.alloc=function(ko,wo,bo){return Qr(ko,wo,bo)};function _n(ko){return Jr(ko),Gr(ko<0?0:eo(ko)|0)}Vr.allocUnsafe=function(ko){return _n(ko)},Vr.allocUnsafeSlow=function(ko){return _n(ko)};function En(ko,wo){if((typeof wo!="string"||wo==="")&&(wo="utf8"),!Vr.isEncoding(wo))throw new TypeError("Unknown encoding: "+wo);const bo=to(ko,wo)|0;let Io=Gr(bo);const Ho=Io.write(ko,wo);return Ho!==bo&&(Io=Io.slice(0,Ho)),Io}function Cn(ko){const wo=ko.length<0?0:eo(ko.length)|0,bo=Gr(wo);for(let Io=0;Io=kr)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+kr.toString(16)+" bytes");return ko|0}function ro(ko){return+ko!=ko&&(ko=0),Vr.alloc(+ko)}Vr.isBuffer=function(wo){return wo!=null&&wo._isBuffer===!0&&wo!==Vr.prototype},Vr.compare=function(wo,bo){if(Ol(wo,jr)&&(wo=Vr.from(wo,wo.offset,wo.byteLength)),Ol(bo,jr)&&(bo=Vr.from(bo,bo.offset,bo.byteLength)),!Vr.isBuffer(wo)||!Vr.isBuffer(bo))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(wo===bo)return 0;let Io=wo.length,Ho=bo.length;for(let Do=0,zo=Math.min(Io,Ho);DoHo.length?(Vr.isBuffer(zo)||(zo=Vr.from(zo)),zo.copy(Ho,Do)):jr.prototype.set.call(Ho,zo,Do);else if(Vr.isBuffer(zo))zo.copy(Ho,Do);else throw new TypeError('"list" argument must be an Array of Buffers');Do+=zo.length}return Ho};function to(ko,wo){if(Vr.isBuffer(ko))return ko.length;if(Br.isView(ko)||Ol(ko,Br))return ko.byteLength;if(typeof ko!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof ko);const bo=ko.length,Io=arguments.length>2&&arguments[2]===!0;if(!Io&&bo===0)return 0;let Ho=!1;for(;;)switch(wo){case"ascii":case"latin1":case"binary":return bo;case"utf8":case"utf-8":return No(ko).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return bo*2;case"hex":return bo>>>1;case"base64":return Vo(ko).length;default:if(Ho)return Io?-1:No(ko).length;wo=(""+wo).toLowerCase(),Ho=!0}}Vr.byteLength=to;function _i(ko,wo,bo){let Io=!1;if((wo===void 0||wo<0)&&(wo=0),wo>this.length||((bo===void 0||bo>this.length)&&(bo=this.length),bo<=0)||(bo>>>=0,wo>>>=0,bo<=wo))return"";for(ko||(ko="utf8");;)switch(ko){case"hex":return wn(this,wo,bo);case"utf8":case"utf-8":return Rn(this,wo,bo);case"ascii":return Zn(this,wo,bo);case"latin1":case"binary":return Nn(this,wo,bo);case"base64":return Sn(this,wo,bo);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return zn(this,wo,bo);default:if(Io)throw new TypeError("Unknown encoding: "+ko);ko=(ko+"").toLowerCase(),Io=!0}}Vr.prototype._isBuffer=!0;function oo(ko,wo,bo){const Io=ko[wo];ko[wo]=ko[bo],ko[bo]=Io}Vr.prototype.swap16=function(){const wo=this.length;if(wo%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let bo=0;bobo&&(wo+=" ... "),""},Er&&(Vr.prototype[Er]=Vr.prototype.inspect),Vr.prototype.compare=function(wo,bo,Io,Ho,Do){if(Ol(wo,jr)&&(wo=Vr.from(wo,wo.offset,wo.byteLength)),!Vr.isBuffer(wo))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof wo);if(bo===void 0&&(bo=0),Io===void 0&&(Io=wo?wo.length:0),Ho===void 0&&(Ho=0),Do===void 0&&(Do=this.length),bo<0||Io>wo.length||Ho<0||Do>this.length)throw new RangeError("out of range index");if(Ho>=Do&&bo>=Io)return 0;if(Ho>=Do)return-1;if(bo>=Io)return 1;if(bo>>>=0,Io>>>=0,Ho>>>=0,Do>>>=0,this===wo)return 0;let zo=Do-Ho,nu=Io-bo;const Ll=Math.min(zo,nu),_l=this.slice(Ho,Do),bu=wo.slice(bo,Io);for(let xl=0;xl2147483647?bo=2147483647:bo<-2147483648&&(bo=-2147483648),bo=+bo,$a(bo)&&(bo=Ho?0:ko.length-1),bo<0&&(bo=ko.length+bo),bo>=ko.length){if(Ho)return-1;bo=ko.length-1}else if(bo<0)if(Ho)bo=0;else return-1;if(typeof wo=="string"&&(wo=Vr.from(wo,Io)),Vr.isBuffer(wo))return wo.length===0?-1:co(ko,wo,bo,Io,Ho);if(typeof wo=="number")return wo=wo&255,typeof jr.prototype.indexOf=="function"?Ho?jr.prototype.indexOf.call(ko,wo,bo):jr.prototype.lastIndexOf.call(ko,wo,bo):co(ko,[wo],bo,Io,Ho);throw new TypeError("val must be string, number or Buffer")}function co(ko,wo,bo,Io,Ho){let Do=1,zo=ko.length,nu=wo.length;if(Io!==void 0&&(Io=String(Io).toLowerCase(),Io==="ucs2"||Io==="ucs-2"||Io==="utf16le"||Io==="utf-16le")){if(ko.length<2||wo.length<2)return-1;Do=2,zo/=2,nu/=2,bo/=2}function Ll(bu,xl){return Do===1?bu[xl]:bu.readUInt16BE(xl*Do)}let _l;if(Ho){let bu=-1;for(_l=bo;_lzo&&(bo=zo-nu),_l=bo;_l>=0;_l--){let bu=!0;for(let xl=0;xlHo&&(Io=Ho)):Io=Ho;const Do=wo.length;Io>Do/2&&(Io=Do/2);let zo;for(zo=0;zo>>0,isFinite(Io)?(Io=Io>>>0,Ho===void 0&&(Ho="utf8")):(Ho=Io,Io=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Do=this.length-bo;if((Io===void 0||Io>Do)&&(Io=Do),wo.length>0&&(Io<0||bo<0)||bo>this.length)throw new RangeError("Attempt to write outside buffer bounds");Ho||(Ho="utf8");let zo=!1;for(;;)switch(Ho){case"hex":return so(this,wo,bo,Io);case"utf8":case"utf-8":return no(this,wo,bo,Io);case"ascii":case"latin1":case"binary":return Tn(this,wo,bo,Io);case"base64":return Hr(this,wo,bo,Io);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Xr(this,wo,bo,Io);default:if(zo)throw new TypeError("Unknown encoding: "+Ho);Ho=(""+Ho).toLowerCase(),zo=!0}},Vr.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Sn(ko,wo,bo){return wo===0&&bo===ko.length?br.fromByteArray(ko):br.fromByteArray(ko.slice(wo,bo))}function Rn(ko,wo,bo){bo=Math.min(ko.length,bo);const Io=[];let Ho=wo;for(;Ho239?4:Do>223?3:Do>191?2:1;if(Ho+nu<=bo){let Ll,_l,bu,xl;switch(nu){case 1:Do<128&&(zo=Do);break;case 2:Ll=ko[Ho+1],(Ll&192)===128&&(xl=(Do&31)<<6|Ll&63,xl>127&&(zo=xl));break;case 3:Ll=ko[Ho+1],_l=ko[Ho+2],(Ll&192)===128&&(_l&192)===128&&(xl=(Do&15)<<12|(Ll&63)<<6|_l&63,xl>2047&&(xl<55296||xl>57343)&&(zo=xl));break;case 4:Ll=ko[Ho+1],_l=ko[Ho+2],bu=ko[Ho+3],(Ll&192)===128&&(_l&192)===128&&(bu&192)===128&&(xl=(Do&15)<<18|(Ll&63)<<12|(_l&63)<<6|bu&63,xl>65535&&xl<1114112&&(zo=xl))}}zo===null?(zo=65533,nu=1):zo>65535&&(zo-=65536,Io.push(zo>>>10&1023|55296),zo=56320|zo&1023),Io.push(zo),Ho+=nu}return On(Io)}const Pn=4096;function On(ko){const wo=ko.length;if(wo<=Pn)return String.fromCharCode.apply(String,ko);let bo="",Io=0;for(;IoIo)&&(bo=Io);let Ho="";for(let Do=wo;DoIo&&(wo=Io),bo<0?(bo+=Io,bo<0&&(bo=0)):bo>Io&&(bo=Io),bobo)throw new RangeError("Trying to access beyond buffer length")}Vr.prototype.readUintLE=Vr.prototype.readUIntLE=function(wo,bo,Io){wo=wo>>>0,bo=bo>>>0,Io||fo(wo,bo,this.length);let Ho=this[wo],Do=1,zo=0;for(;++zo>>0,bo=bo>>>0,Io||fo(wo,bo,this.length);let Ho=this[wo+--bo],Do=1;for(;bo>0&&(Do*=256);)Ho+=this[wo+--bo]*Do;return Ho},Vr.prototype.readUint8=Vr.prototype.readUInt8=function(wo,bo){return wo=wo>>>0,bo||fo(wo,1,this.length),this[wo]},Vr.prototype.readUint16LE=Vr.prototype.readUInt16LE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,2,this.length),this[wo]|this[wo+1]<<8},Vr.prototype.readUint16BE=Vr.prototype.readUInt16BE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,2,this.length),this[wo]<<8|this[wo+1]},Vr.prototype.readUint32LE=Vr.prototype.readUInt32LE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,4,this.length),(this[wo]|this[wo+1]<<8|this[wo+2]<<16)+this[wo+3]*16777216},Vr.prototype.readUint32BE=Vr.prototype.readUInt32BE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,4,this.length),this[wo]*16777216+(this[wo+1]<<16|this[wo+2]<<8|this[wo+3])},Vr.prototype.readBigUInt64LE=Zl(function(wo){wo=wo>>>0,na(wo,"offset");const bo=this[wo],Io=this[wo+7];(bo===void 0||Io===void 0)&&qo(wo,this.length-8);const Ho=bo+this[++wo]*2**8+this[++wo]*2**16+this[++wo]*2**24,Do=this[++wo]+this[++wo]*2**8+this[++wo]*2**16+Io*2**24;return BigInt(Ho)+(BigInt(Do)<>>0,na(wo,"offset");const bo=this[wo],Io=this[wo+7];(bo===void 0||Io===void 0)&&qo(wo,this.length-8);const Ho=bo*2**24+this[++wo]*2**16+this[++wo]*2**8+this[++wo],Do=this[++wo]*2**24+this[++wo]*2**16+this[++wo]*2**8+Io;return(BigInt(Ho)<>>0,bo=bo>>>0,Io||fo(wo,bo,this.length);let Ho=this[wo],Do=1,zo=0;for(;++zo=Do&&(Ho-=Math.pow(2,8*bo)),Ho},Vr.prototype.readIntBE=function(wo,bo,Io){wo=wo>>>0,bo=bo>>>0,Io||fo(wo,bo,this.length);let Ho=bo,Do=1,zo=this[wo+--Ho];for(;Ho>0&&(Do*=256);)zo+=this[wo+--Ho]*Do;return Do*=128,zo>=Do&&(zo-=Math.pow(2,8*bo)),zo},Vr.prototype.readInt8=function(wo,bo){return wo=wo>>>0,bo||fo(wo,1,this.length),this[wo]&128?(255-this[wo]+1)*-1:this[wo]},Vr.prototype.readInt16LE=function(wo,bo){wo=wo>>>0,bo||fo(wo,2,this.length);const Io=this[wo]|this[wo+1]<<8;return Io&32768?Io|4294901760:Io},Vr.prototype.readInt16BE=function(wo,bo){wo=wo>>>0,bo||fo(wo,2,this.length);const Io=this[wo+1]|this[wo]<<8;return Io&32768?Io|4294901760:Io},Vr.prototype.readInt32LE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,4,this.length),this[wo]|this[wo+1]<<8|this[wo+2]<<16|this[wo+3]<<24},Vr.prototype.readInt32BE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,4,this.length),this[wo]<<24|this[wo+1]<<16|this[wo+2]<<8|this[wo+3]},Vr.prototype.readBigInt64LE=Zl(function(wo){wo=wo>>>0,na(wo,"offset");const bo=this[wo],Io=this[wo+7];(bo===void 0||Io===void 0)&&qo(wo,this.length-8);const Ho=this[wo+4]+this[wo+5]*2**8+this[wo+6]*2**16+(Io<<24);return(BigInt(Ho)<>>0,na(wo,"offset");const bo=this[wo],Io=this[wo+7];(bo===void 0||Io===void 0)&&qo(wo,this.length-8);const Ho=(bo<<24)+this[++wo]*2**16+this[++wo]*2**8+this[++wo];return(BigInt(Ho)<>>0,bo||fo(wo,4,this.length),wr.read(this,wo,!0,23,4)},Vr.prototype.readFloatBE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,4,this.length),wr.read(this,wo,!1,23,4)},Vr.prototype.readDoubleLE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,8,this.length),wr.read(this,wo,!0,52,8)},Vr.prototype.readDoubleBE=function(wo,bo){return wo=wo>>>0,bo||fo(wo,8,this.length),wr.read(this,wo,!1,52,8)};function vo(ko,wo,bo,Io,Ho,Do){if(!Vr.isBuffer(ko))throw new TypeError('"buffer" argument must be a Buffer instance');if(wo>Ho||woko.length)throw new RangeError("Index out of range")}Vr.prototype.writeUintLE=Vr.prototype.writeUIntLE=function(wo,bo,Io,Ho){if(wo=+wo,bo=bo>>>0,Io=Io>>>0,!Ho){const nu=Math.pow(2,8*Io)-1;vo(this,wo,bo,Io,nu,0)}let Do=1,zo=0;for(this[bo]=wo&255;++zo>>0,Io=Io>>>0,!Ho){const nu=Math.pow(2,8*Io)-1;vo(this,wo,bo,Io,nu,0)}let Do=Io-1,zo=1;for(this[bo+Do]=wo&255;--Do>=0&&(zo*=256);)this[bo+Do]=wo/zo&255;return bo+Io},Vr.prototype.writeUint8=Vr.prototype.writeUInt8=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,1,255,0),this[bo]=wo&255,bo+1},Vr.prototype.writeUint16LE=Vr.prototype.writeUInt16LE=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,2,65535,0),this[bo]=wo&255,this[bo+1]=wo>>>8,bo+2},Vr.prototype.writeUint16BE=Vr.prototype.writeUInt16BE=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,2,65535,0),this[bo]=wo>>>8,this[bo+1]=wo&255,bo+2},Vr.prototype.writeUint32LE=Vr.prototype.writeUInt32LE=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,4,4294967295,0),this[bo+3]=wo>>>24,this[bo+2]=wo>>>16,this[bo+1]=wo>>>8,this[bo]=wo&255,bo+4},Vr.prototype.writeUint32BE=Vr.prototype.writeUInt32BE=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,4,4294967295,0),this[bo]=wo>>>24,this[bo+1]=wo>>>16,this[bo+2]=wo>>>8,this[bo+3]=wo&255,bo+4};function go(ko,wo,bo,Io,Ho){Wo(wo,Io,Ho,ko,bo,7);let Do=Number(wo&BigInt(4294967295));ko[bo++]=Do,Do=Do>>8,ko[bo++]=Do,Do=Do>>8,ko[bo++]=Do,Do=Do>>8,ko[bo++]=Do;let zo=Number(wo>>BigInt(32)&BigInt(4294967295));return ko[bo++]=zo,zo=zo>>8,ko[bo++]=zo,zo=zo>>8,ko[bo++]=zo,zo=zo>>8,ko[bo++]=zo,bo}function uo(ko,wo,bo,Io,Ho){Wo(wo,Io,Ho,ko,bo,7);let Do=Number(wo&BigInt(4294967295));ko[bo+7]=Do,Do=Do>>8,ko[bo+6]=Do,Do=Do>>8,ko[bo+5]=Do,Do=Do>>8,ko[bo+4]=Do;let zo=Number(wo>>BigInt(32)&BigInt(4294967295));return ko[bo+3]=zo,zo=zo>>8,ko[bo+2]=zo,zo=zo>>8,ko[bo+1]=zo,zo=zo>>8,ko[bo]=zo,bo+8}Vr.prototype.writeBigUInt64LE=Zl(function(wo,bo=0){return go(this,wo,bo,BigInt(0),BigInt("0xffffffffffffffff"))}),Vr.prototype.writeBigUInt64BE=Zl(function(wo,bo=0){return uo(this,wo,bo,BigInt(0),BigInt("0xffffffffffffffff"))}),Vr.prototype.writeIntLE=function(wo,bo,Io,Ho){if(wo=+wo,bo=bo>>>0,!Ho){const Ll=Math.pow(2,8*Io-1);vo(this,wo,bo,Io,Ll-1,-Ll)}let Do=0,zo=1,nu=0;for(this[bo]=wo&255;++Do>0)-nu&255;return bo+Io},Vr.prototype.writeIntBE=function(wo,bo,Io,Ho){if(wo=+wo,bo=bo>>>0,!Ho){const Ll=Math.pow(2,8*Io-1);vo(this,wo,bo,Io,Ll-1,-Ll)}let Do=Io-1,zo=1,nu=0;for(this[bo+Do]=wo&255;--Do>=0&&(zo*=256);)wo<0&&nu===0&&this[bo+Do+1]!==0&&(nu=1),this[bo+Do]=(wo/zo>>0)-nu&255;return bo+Io},Vr.prototype.writeInt8=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,1,127,-128),wo<0&&(wo=255+wo+1),this[bo]=wo&255,bo+1},Vr.prototype.writeInt16LE=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,2,32767,-32768),this[bo]=wo&255,this[bo+1]=wo>>>8,bo+2},Vr.prototype.writeInt16BE=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,2,32767,-32768),this[bo]=wo>>>8,this[bo+1]=wo&255,bo+2},Vr.prototype.writeInt32LE=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,4,2147483647,-2147483648),this[bo]=wo&255,this[bo+1]=wo>>>8,this[bo+2]=wo>>>16,this[bo+3]=wo>>>24,bo+4},Vr.prototype.writeInt32BE=function(wo,bo,Io){return wo=+wo,bo=bo>>>0,Io||vo(this,wo,bo,4,2147483647,-2147483648),wo<0&&(wo=4294967295+wo+1),this[bo]=wo>>>24,this[bo+1]=wo>>>16,this[bo+2]=wo>>>8,this[bo+3]=wo&255,bo+4},Vr.prototype.writeBigInt64LE=Zl(function(wo,bo=0){return go(this,wo,bo,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),Vr.prototype.writeBigInt64BE=Zl(function(wo,bo=0){return uo(this,wo,bo,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function lo(ko,wo,bo,Io,Ho,Do){if(bo+Io>ko.length)throw new RangeError("Index out of range");if(bo<0)throw new RangeError("Index out of range")}function Eo(ko,wo,bo,Io,Ho){return wo=+wo,bo=bo>>>0,Ho||lo(ko,wo,bo,4),wr.write(ko,wo,bo,Io,23,4),bo+4}Vr.prototype.writeFloatLE=function(wo,bo,Io){return Eo(this,wo,bo,!0,Io)},Vr.prototype.writeFloatBE=function(wo,bo,Io){return Eo(this,wo,bo,!1,Io)};function mo(ko,wo,bo,Io,Ho){return wo=+wo,bo=bo>>>0,Ho||lo(ko,wo,bo,8),wr.write(ko,wo,bo,Io,52,8),bo+8}Vr.prototype.writeDoubleLE=function(wo,bo,Io){return mo(this,wo,bo,!0,Io)},Vr.prototype.writeDoubleBE=function(wo,bo,Io){return mo(this,wo,bo,!1,Io)},Vr.prototype.copy=function(wo,bo,Io,Ho){if(!Vr.isBuffer(wo))throw new TypeError("argument should be a Buffer");if(Io||(Io=0),!Ho&&Ho!==0&&(Ho=this.length),bo>=wo.length&&(bo=wo.length),bo||(bo=0),Ho>0&&Ho=this.length)throw new RangeError("Index out of range");if(Ho<0)throw new RangeError("sourceEnd out of bounds");Ho>this.length&&(Ho=this.length),wo.length-bo>>0,Io=Io===void 0?this.length:Io>>>0,wo||(wo=0);let Do;if(typeof wo=="number")for(Do=bo;Do2**32?Ho=Bo(String(bo)):typeof bo=="bigint"&&(Ho=String(bo),(bo>BigInt(2)**BigInt(32)||bo<-(BigInt(2)**BigInt(32)))&&(Ho=Bo(Ho)),Ho+="n"),Io+=` It must be ${wo}. Received ${Ho}`,Io},RangeError);function Bo(ko){let wo="",bo=ko.length;const Io=ko[0]==="-"?1:0;for(;bo>=Io+4;bo-=3)wo=`_${ko.slice(bo-3,bo)}${wo}`;return`${ko.slice(0,bo)}${wo}`}function Lo(ko,wo,bo){na(wo,"offset"),(ko[wo]===void 0||ko[wo+bo]===void 0)&&qo(wo,ko.length-(bo+1))}function Wo(ko,wo,bo,Io,Ho,Do){if(ko>bo||ko= 0${zo} and < 2${zo} ** ${(Do+1)*8}${zo}`:nu=`>= -(2${zo} ** ${(Do+1)*8-1}${zo}) and < 2 ** ${(Do+1)*8-1}${zo}`,new yo.ERR_OUT_OF_RANGE("value",nu,ko)}Lo(Io,Ho,Do)}function na(ko,wo){if(typeof ko!="number")throw new yo.ERR_INVALID_ARG_TYPE(wo,"number",ko)}function qo(ko,wo,bo){throw Math.floor(ko)!==ko?(na(ko,bo),new yo.ERR_OUT_OF_RANGE("offset","an integer",ko)):wo<0?new yo.ERR_BUFFER_OUT_OF_BOUNDS:new yo.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${wo}`,ko)}const ga=/[^+/0-9A-Za-z-_]/g;function wl(ko){if(ko=ko.split("=")[0],ko=ko.trim().replace(ga,""),ko.length<2)return"";for(;ko.length%4!==0;)ko=ko+"=";return ko}function No(ko,wo){wo=wo||1/0;let bo;const Io=ko.length;let Ho=null;const Do=[];for(let zo=0;zo55295&&bo<57344){if(!Ho){if(bo>56319){(wo-=3)>-1&&Do.push(239,191,189);continue}else if(zo+1===Io){(wo-=3)>-1&&Do.push(239,191,189);continue}Ho=bo;continue}if(bo<56320){(wo-=3)>-1&&Do.push(239,191,189),Ho=bo;continue}bo=(Ho-55296<<10|bo-56320)+65536}else Ho&&(wo-=3)>-1&&Do.push(239,191,189);if(Ho=null,bo<128){if((wo-=1)<0)break;Do.push(bo)}else if(bo<2048){if((wo-=2)<0)break;Do.push(bo>>6|192,bo&63|128)}else if(bo<65536){if((wo-=3)<0)break;Do.push(bo>>12|224,bo>>6&63|128,bo&63|128)}else if(bo<1114112){if((wo-=4)<0)break;Do.push(bo>>18|240,bo>>12&63|128,bo>>6&63|128,bo&63|128)}else throw new Error("Invalid code point")}return Do}function Uo(ko){const wo=[];for(let bo=0;bo>8,Ho=bo%256,Do.push(Ho),Do.push(Io);return Do}function Vo(ko){return br.toByteArray(wl(ko))}function Fo(ko,wo,bo,Io){let Ho;for(Ho=0;Ho=wo.length||Ho>=ko.length);++Ho)wo[Ho+bo]=ko[Ho];return Ho}function Ol(ko,wo){return ko instanceof wo||ko!=null&&ko.constructor!=null&&ko.constructor.name!=null&&ko.constructor.name===wo.name}function $a(ko){return ko!==ko}const Jo=function(){const ko="0123456789abcdef",wo=new Array(256);for(let bo=0;bo<16;++bo){const Io=bo*16;for(let Ho=0;Ho<16;++Ho)wo[Io+Ho]=ko[bo]+ko[Ho]}return wo}();function Zl(ko){return typeof BigInt>"u"?Cl:ko}function Cl(){throw new Error("BigInt not supported")}})(buffer$2);const Buffer$2=buffer$2.Buffer,Blob$3=buffer$2.Blob,BlobOptions=buffer$2.BlobOptions,Buffer$1$1=buffer$2.Buffer,File=buffer$2.File,FileOptions=buffer$2.FileOptions,INSPECT_MAX_BYTES=buffer$2.INSPECT_MAX_BYTES,SlowBuffer=buffer$2.SlowBuffer,TranscodeEncoding=buffer$2.TranscodeEncoding,atob$1=buffer$2.atob,btoa$2=buffer$2.btoa,constants$7=buffer$2.constants,isAscii=buffer$2.isAscii,isUtf8=buffer$2.isUtf8,kMaxLength=buffer$2.kMaxLength,kStringMaxLength=buffer$2.kStringMaxLength,resolveObjectURL=buffer$2.resolveObjectURL,transcode=buffer$2.transcode,dist$2=Object.freeze(Object.defineProperty({__proto__:null,Blob:Blob$3,BlobOptions,Buffer:Buffer$1$1,File,FileOptions,INSPECT_MAX_BYTES,SlowBuffer,TranscodeEncoding,atob:atob$1,btoa:btoa$2,constants:constants$7,default:Buffer$2,isAscii,isUtf8,kMaxLength,kStringMaxLength,resolveObjectURL,transcode},Symbol.toStringTag,{value:"Module"}));function AxiosError$1(fr,br,wr,Er,kr){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=fr,this.name="AxiosError",br&&(this.code=br),wr&&(this.config=wr),Er&&(this.request=Er),kr&&(this.response=kr,this.status=kr.status?kr.status:null)}utils$d.inherits(AxiosError$1,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:utils$d.toJSONObject(this.config),code:this.code,status:this.status}}});const prototype$1=AxiosError$1.prototype,descriptors$1={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(fr=>{descriptors$1[fr]={value:fr}});Object.defineProperties(AxiosError$1,descriptors$1);Object.defineProperty(prototype$1,"isAxiosError",{value:!0});AxiosError$1.from=(fr,br,wr,Er,kr,jr)=>{const Br=Object.create(prototype$1);return utils$d.toFlatObject(fr,Br,function(qr){return qr!==Error.prototype},Wr=>Wr!=="isAxiosError"),AxiosError$1.call(Br,fr.message,br,wr,Er,kr),Br.cause=fr,Br.name=fr.name,jr&&Object.assign(Br,jr),Br};const httpAdapter=null;function isVisitable(fr){return utils$d.isPlainObject(fr)||utils$d.isArray(fr)}function removeBrackets(fr){return utils$d.endsWith(fr,"[]")?fr.slice(0,-2):fr}function renderKey(fr,br,wr){return fr?fr.concat(br).map(function(kr,jr){return kr=removeBrackets(kr),!wr&&jr?"["+kr+"]":kr}).join(wr?".":""):br}function isFlatArray(fr){return utils$d.isArray(fr)&&!fr.some(isVisitable)}const predicates=utils$d.toFlatObject(utils$d,{},null,function(br){return/^is[A-Z]/.test(br)});function toFormData$1(fr,br,wr){if(!utils$d.isObject(fr))throw new TypeError("target must be an object");br=br||new FormData,wr=utils$d.toFlatObject(wr,{metaTokens:!0,dots:!1,indexes:!1},!1,function(En,Cn){return!utils$d.isUndefined(Cn[En])});const Er=wr.metaTokens,kr=wr.visitor||Vr,jr=wr.dots,Br=wr.indexes,qr=(wr.Blob||typeof Blob<"u"&&Blob)&&utils$d.isSpecCompliantForm(br);if(!utils$d.isFunction(kr))throw new TypeError("visitor must be a function");function Gr(_n){if(_n===null)return"";if(utils$d.isDate(_n))return _n.toISOString();if(!qr&&utils$d.isBlob(_n))throw new AxiosError$1("Blob is not supported. Use a Buffer instead.");return utils$d.isArrayBuffer(_n)||utils$d.isTypedArray(_n)?qr&&typeof Blob=="function"?new Blob([_n]):Buffer$2.from(_n):_n}function Vr(_n,En,Cn){let In=_n;if(_n&&!Cn&&typeof _n=="object"){if(utils$d.endsWith(En,"{}"))En=Er?En:En.slice(0,-2),_n=JSON.stringify(_n);else if(utils$d.isArray(_n)&&isFlatArray(_n)||(utils$d.isFileList(_n)||utils$d.endsWith(En,"[]"))&&(In=utils$d.toArray(_n)))return En=removeBrackets(En),In.forEach(function(jn,eo){!(utils$d.isUndefined(jn)||jn===null)&&br.append(Br===!0?renderKey([En],eo,jr):Br===null?En:En+"[]",Gr(jn))}),!1}return isVisitable(_n)?!0:(br.append(renderKey(Cn,En,jr),Gr(_n)),!1)}const Zr=[],Jr=Object.assign(predicates,{defaultVisitor:Vr,convertValue:Gr,isVisitable});function Qr(_n,En){if(!utils$d.isUndefined(_n)){if(Zr.indexOf(_n)!==-1)throw Error("Circular reference detected in "+En.join("."));Zr.push(_n),utils$d.forEach(_n,function(In,An){(!(utils$d.isUndefined(In)||In===null)&&kr.call(br,In,utils$d.isString(An)?An.trim():An,En,Jr))===!0&&Qr(In,En?En.concat(An):[An])}),Zr.pop()}}if(!utils$d.isObject(fr))throw new TypeError("data must be an object");return Qr(fr),br}function encode$4(fr){const br={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(fr).replace(/[!'()~]|%20|%00/g,function(Er){return br[Er]})}function AxiosURLSearchParams(fr,br){this._pairs=[],fr&&toFormData$1(fr,this,br)}const prototype=AxiosURLSearchParams.prototype;prototype.append=function(br,wr){this._pairs.push([br,wr])};prototype.toString=function(br){const wr=br?function(Er){return br.call(this,Er,encode$4)}:encode$4;return this._pairs.map(function(kr){return wr(kr[0])+"="+wr(kr[1])},"").join("&")};function encode$3(fr){return encodeURIComponent(fr).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(fr,br,wr){if(!br)return fr;const Er=wr&&wr.encode||encode$3;utils$d.isFunction(wr)&&(wr={serialize:wr});const kr=wr&&wr.serialize;let jr;if(kr?jr=kr(br,wr):jr=utils$d.isURLSearchParams(br)?br.toString():new AxiosURLSearchParams(br,wr).toString(Er),jr){const Br=fr.indexOf("#");Br!==-1&&(fr=fr.slice(0,Br)),fr+=(fr.indexOf("?")===-1?"?":"&")+jr}return fr}class InterceptorManager{constructor(){this.handlers=[]}use(br,wr,Er){return this.handlers.push({fulfilled:br,rejected:wr,synchronous:Er?Er.synchronous:!1,runWhen:Er?Er.runWhen:null}),this.handlers.length-1}eject(br){this.handlers[br]&&(this.handlers[br]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(br){utils$d.forEach(this.handlers,function(Er){Er!==null&&br(Er)})}}const transitionalDefaults={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},URLSearchParams$1=typeof URLSearchParams<"u"?URLSearchParams:AxiosURLSearchParams,FormData$1=typeof FormData<"u"?FormData:null,Blob$2=typeof Blob<"u"?Blob:null,platform$3={isBrowser:!0,classes:{URLSearchParams:URLSearchParams$1,FormData:FormData$1,Blob:Blob$2},protocols:["http","https","file","blob","url","data"]},hasBrowserEnv=typeof window<"u"&&typeof document<"u",_navigator=typeof navigator=="object"&&navigator||void 0,hasStandardBrowserEnv=hasBrowserEnv&&(!_navigator||["ReactNative","NativeScript","NS"].indexOf(_navigator.product)<0),hasStandardBrowserWebWorkerEnv=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",origin=hasBrowserEnv&&window.location.href||"http://localhost",utils$c=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv,hasStandardBrowserEnv,hasStandardBrowserWebWorkerEnv,navigator:_navigator,origin},Symbol.toStringTag,{value:"Module"})),platform$2={...utils$c,...platform$3};function toURLEncodedForm(fr,br){return toFormData$1(fr,new platform$2.classes.URLSearchParams,Object.assign({visitor:function(wr,Er,kr,jr){return platform$2.isNode&&utils$d.isBuffer(wr)?(this.append(Er,wr.toString("base64")),!1):jr.defaultVisitor.apply(this,arguments)}},br))}function parsePropPath(fr){return utils$d.matchAll(/\w+|\[(\w*)]/g,fr).map(br=>br[0]==="[]"?"":br[1]||br[0])}function arrayToObject(fr){const br={},wr=Object.keys(fr);let Er;const kr=wr.length;let jr;for(Er=0;Er=wr.length;return Br=!Br&&utils$d.isArray(kr)?kr.length:Br,qr?(utils$d.hasOwnProp(kr,Br)?kr[Br]=[kr[Br],Er]:kr[Br]=Er,!Wr):((!kr[Br]||!utils$d.isObject(kr[Br]))&&(kr[Br]=[]),br(wr,Er,kr[Br],jr)&&utils$d.isArray(kr[Br])&&(kr[Br]=arrayToObject(kr[Br])),!Wr)}if(utils$d.isFormData(fr)&&utils$d.isFunction(fr.entries)){const wr={};return utils$d.forEachEntry(fr,(Er,kr)=>{br(parsePropPath(Er),kr,wr,0)}),wr}return null}function stringifySafely(fr,br,wr){if(utils$d.isString(fr))try{return(br||JSON.parse)(fr),utils$d.trim(fr)}catch(Er){if(Er.name!=="SyntaxError")throw Er}return(0,JSON.stringify)(fr)}const defaults={transitional:transitionalDefaults,adapter:["xhr","http","fetch"],transformRequest:[function(br,wr){const Er=wr.getContentType()||"",kr=Er.indexOf("application/json")>-1,jr=utils$d.isObject(br);if(jr&&utils$d.isHTMLForm(br)&&(br=new FormData(br)),utils$d.isFormData(br))return kr?JSON.stringify(formDataToJSON(br)):br;if(utils$d.isArrayBuffer(br)||utils$d.isBuffer(br)||utils$d.isStream(br)||utils$d.isFile(br)||utils$d.isBlob(br)||utils$d.isReadableStream(br))return br;if(utils$d.isArrayBufferView(br))return br.buffer;if(utils$d.isURLSearchParams(br))return wr.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),br.toString();let Wr;if(jr){if(Er.indexOf("application/x-www-form-urlencoded")>-1)return toURLEncodedForm(br,this.formSerializer).toString();if((Wr=utils$d.isFileList(br))||Er.indexOf("multipart/form-data")>-1){const qr=this.env&&this.env.FormData;return toFormData$1(Wr?{"files[]":br}:br,qr&&new qr,this.formSerializer)}}return jr||kr?(wr.setContentType("application/json",!1),stringifySafely(br)):br}],transformResponse:[function(br){const wr=this.transitional||defaults.transitional,Er=wr&&wr.forcedJSONParsing,kr=this.responseType==="json";if(utils$d.isResponse(br)||utils$d.isReadableStream(br))return br;if(br&&utils$d.isString(br)&&(Er&&!this.responseType||kr)){const Br=!(wr&&wr.silentJSONParsing)&&kr;try{return JSON.parse(br)}catch(Wr){if(Br)throw Wr.name==="SyntaxError"?AxiosError$1.from(Wr,AxiosError$1.ERR_BAD_RESPONSE,this,null,this.response):Wr}}return br}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:platform$2.classes.FormData,Blob:platform$2.classes.Blob},validateStatus:function(br){return br>=200&&br<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};utils$d.forEach(["delete","get","head","post","put","patch"],fr=>{defaults.headers[fr]={}});const ignoreDuplicateOf=utils$d.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),parseHeaders=fr=>{const br={};let wr,Er,kr;return fr&&fr.split(` `).forEach(function(Br){kr=Br.indexOf(":"),wr=Br.substring(0,kr).trim().toLowerCase(),Er=Br.substring(kr+1).trim(),!(!wr||br[wr]&&ignoreDuplicateOf[wr])&&(wr==="set-cookie"?br[wr]?br[wr].push(Er):br[wr]=[Er]:br[wr]=br[wr]?br[wr]+", "+Er:Er)}),br},$internals=Symbol("internals");function normalizeHeader(fr){return fr&&String(fr).trim().toLowerCase()}function normalizeValue(fr){return fr===!1||fr==null?fr:utils$d.isArray(fr)?fr.map(normalizeValue):String(fr)}function parseTokens(fr){const br=Object.create(null),wr=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let Er;for(;Er=wr.exec(fr);)br[Er[1]]=Er[2];return br}const isValidHeaderName=fr=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(fr.trim());function matchHeaderValue(fr,br,wr,Er,kr){if(utils$d.isFunction(Er))return Er.call(this,br,wr);if(kr&&(br=wr),!!utils$d.isString(br)){if(utils$d.isString(Er))return br.indexOf(Er)!==-1;if(utils$d.isRegExp(Er))return Er.test(br)}}function formatHeader(fr){return fr.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(br,wr,Er)=>wr.toUpperCase()+Er)}function buildAccessors(fr,br){const wr=utils$d.toCamelCase(" "+br);["get","set","has"].forEach(Er=>{Object.defineProperty(fr,Er+wr,{value:function(kr,jr,Br){return this[Er].call(this,br,kr,jr,Br)},configurable:!0})})}let AxiosHeaders$1=class{constructor(br){br&&this.set(br)}set(br,wr,Er){const kr=this;function jr(Wr,qr,Gr){const Vr=normalizeHeader(qr);if(!Vr)throw new Error("header name must be a non-empty string");const Zr=utils$d.findKey(kr,Vr);(!Zr||kr[Zr]===void 0||Gr===!0||Gr===void 0&&kr[Zr]!==!1)&&(kr[Zr||qr]=normalizeValue(Wr))}const Br=(Wr,qr)=>utils$d.forEach(Wr,(Gr,Vr)=>jr(Gr,Vr,qr));if(utils$d.isPlainObject(br)||br instanceof this.constructor)Br(br,wr);else if(utils$d.isString(br)&&(br=br.trim())&&!isValidHeaderName(br))Br(parseHeaders(br),wr);else if(utils$d.isHeaders(br))for(const[Wr,qr]of br.entries())jr(qr,Wr,Er);else br!=null&&jr(wr,br,Er);return this}get(br,wr){if(br=normalizeHeader(br),br){const Er=utils$d.findKey(this,br);if(Er){const kr=this[Er];if(!wr)return kr;if(wr===!0)return parseTokens(kr);if(utils$d.isFunction(wr))return wr.call(this,kr,Er);if(utils$d.isRegExp(wr))return wr.exec(kr);throw new TypeError("parser must be boolean|regexp|function")}}}has(br,wr){if(br=normalizeHeader(br),br){const Er=utils$d.findKey(this,br);return!!(Er&&this[Er]!==void 0&&(!wr||matchHeaderValue(this,this[Er],Er,wr)))}return!1}delete(br,wr){const Er=this;let kr=!1;function jr(Br){if(Br=normalizeHeader(Br),Br){const Wr=utils$d.findKey(Er,Br);Wr&&(!wr||matchHeaderValue(Er,Er[Wr],Wr,wr))&&(delete Er[Wr],kr=!0)}}return utils$d.isArray(br)?br.forEach(jr):jr(br),kr}clear(br){const wr=Object.keys(this);let Er=wr.length,kr=!1;for(;Er--;){const jr=wr[Er];(!br||matchHeaderValue(this,this[jr],jr,br,!0))&&(delete this[jr],kr=!0)}return kr}normalize(br){const wr=this,Er={};return utils$d.forEach(this,(kr,jr)=>{const Br=utils$d.findKey(Er,jr);if(Br){wr[Br]=normalizeValue(kr),delete wr[jr];return}const Wr=br?formatHeader(jr):String(jr).trim();Wr!==jr&&delete wr[jr],wr[Wr]=normalizeValue(kr),Er[Wr]=!0}),this}concat(...br){return this.constructor.concat(this,...br)}toJSON(br){const wr=Object.create(null);return utils$d.forEach(this,(Er,kr)=>{Er!=null&&Er!==!1&&(wr[kr]=br&&utils$d.isArray(Er)?Er.join(", "):Er)}),wr}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([br,wr])=>br+": "+wr).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(br){return br instanceof this?br:new this(br)}static concat(br,...wr){const Er=new this(br);return wr.forEach(kr=>Er.set(kr)),Er}static accessor(br){const Er=(this[$internals]=this[$internals]={accessors:{}}).accessors,kr=this.prototype;function jr(Br){const Wr=normalizeHeader(Br);Er[Wr]||(buildAccessors(kr,Br),Er[Wr]=!0)}return utils$d.isArray(br)?br.forEach(jr):jr(br),this}};AxiosHeaders$1.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);utils$d.reduceDescriptors(AxiosHeaders$1.prototype,({value:fr},br)=>{let wr=br[0].toUpperCase()+br.slice(1);return{get:()=>fr,set(Er){this[wr]=Er}}});utils$d.freezeMethods(AxiosHeaders$1);function transformData(fr,br){const wr=this||defaults,Er=br||wr,kr=AxiosHeaders$1.from(Er.headers);let jr=Er.data;return utils$d.forEach(fr,function(Wr){jr=Wr.call(wr,jr,kr.normalize(),br?br.status:void 0)}),kr.normalize(),jr}function isCancel$1(fr){return!!(fr&&fr.__CANCEL__)}function CanceledError$1(fr,br,wr){AxiosError$1.call(this,fr??"canceled",AxiosError$1.ERR_CANCELED,br,wr),this.name="CanceledError"}utils$d.inherits(CanceledError$1,AxiosError$1,{__CANCEL__:!0});function settle(fr,br,wr){const Er=wr.config.validateStatus;!wr.status||!Er||Er(wr.status)?fr(wr):br(new AxiosError$1("Request failed with status code "+wr.status,[AxiosError$1.ERR_BAD_REQUEST,AxiosError$1.ERR_BAD_RESPONSE][Math.floor(wr.status/100)-4],wr.config,wr.request,wr))}function parseProtocol(fr){const br=/^([-+\w]{1,25})(:?\/\/|:)/.exec(fr);return br&&br[1]||""}function speedometer(fr,br){fr=fr||10;const wr=new Array(fr),Er=new Array(fr);let kr=0,jr=0,Br;return br=br!==void 0?br:1e3,function(qr){const Gr=Date.now(),Vr=Er[jr];Br||(Br=Gr),wr[kr]=qr,Er[kr]=Gr;let Zr=jr,Jr=0;for(;Zr!==kr;)Jr+=wr[Zr++],Zr=Zr%fr;if(kr=(kr+1)%fr,kr===jr&&(jr=(jr+1)%fr),Gr-Br{wr=Vr,kr=null,jr&&(clearTimeout(jr),jr=null),fr.apply(null,Gr)};return[(...Gr)=>{const Vr=Date.now(),Zr=Vr-wr;Zr>=Er?Br(Gr,Vr):(kr=Gr,jr||(jr=setTimeout(()=>{jr=null,Br(kr)},Er-Zr)))},()=>kr&&Br(kr)]}const progressEventReducer=(fr,br,wr=3)=>{let Er=0;const kr=speedometer(50,250);return throttle(jr=>{const Br=jr.loaded,Wr=jr.lengthComputable?jr.total:void 0,qr=Br-Er,Gr=kr(qr),Vr=Br<=Wr;Er=Br;const Zr={loaded:Br,total:Wr,progress:Wr?Br/Wr:void 0,bytes:qr,rate:Gr||void 0,estimated:Gr&&Wr&&Vr?(Wr-Br)/Gr:void 0,event:jr,lengthComputable:Wr!=null,[br?"download":"upload"]:!0};fr(Zr)},wr)},progressEventDecorator=(fr,br)=>{const wr=fr!=null;return[Er=>br[0]({lengthComputable:wr,total:fr,loaded:Er}),br[1]]},asyncDecorator=fr=>(...br)=>utils$d.asap(()=>fr(...br)),isURLSameOrigin=platform$2.hasStandardBrowserEnv?((fr,br)=>wr=>(wr=new URL(wr,platform$2.origin),fr.protocol===wr.protocol&&fr.host===wr.host&&(br||fr.port===wr.port)))(new URL(platform$2.origin),platform$2.navigator&&/(msie|trident)/i.test(platform$2.navigator.userAgent)):()=>!0,cookies=platform$2.hasStandardBrowserEnv?{write(fr,br,wr,Er,kr,jr){const Br=[fr+"="+encodeURIComponent(br)];utils$d.isNumber(wr)&&Br.push("expires="+new Date(wr).toGMTString()),utils$d.isString(Er)&&Br.push("path="+Er),utils$d.isString(kr)&&Br.push("domain="+kr),jr===!0&&Br.push("secure"),document.cookie=Br.join("; ")},read(fr){const br=document.cookie.match(new RegExp("(^|;\\s*)("+fr+")=([^;]*)"));return br?decodeURIComponent(br[3]):null},remove(fr){this.write(fr,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function isAbsoluteURL(fr){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(fr)}function combineURLs(fr,br){return br?fr.replace(/\/?\/$/,"")+"/"+br.replace(/^\/+/,""):fr}function buildFullPath(fr,br){return fr&&!isAbsoluteURL(br)?combineURLs(fr,br):br}const headersToObject=fr=>fr instanceof AxiosHeaders$1?{...fr}:fr;function mergeConfig$1(fr,br){br=br||{};const wr={};function Er(Gr,Vr,Zr,Jr){return utils$d.isPlainObject(Gr)&&utils$d.isPlainObject(Vr)?utils$d.merge.call({caseless:Jr},Gr,Vr):utils$d.isPlainObject(Vr)?utils$d.merge({},Vr):utils$d.isArray(Vr)?Vr.slice():Vr}function kr(Gr,Vr,Zr,Jr){if(utils$d.isUndefined(Vr)){if(!utils$d.isUndefined(Gr))return Er(void 0,Gr,Zr,Jr)}else return Er(Gr,Vr,Zr,Jr)}function jr(Gr,Vr){if(!utils$d.isUndefined(Vr))return Er(void 0,Vr)}function Br(Gr,Vr){if(utils$d.isUndefined(Vr)){if(!utils$d.isUndefined(Gr))return Er(void 0,Gr)}else return Er(void 0,Vr)}function Wr(Gr,Vr,Zr){if(Zr in br)return Er(Gr,Vr);if(Zr in fr)return Er(void 0,Gr)}const qr={url:jr,method:jr,data:jr,baseURL:Br,transformRequest:Br,transformResponse:Br,paramsSerializer:Br,timeout:Br,timeoutMessage:Br,withCredentials:Br,withXSRFToken:Br,adapter:Br,responseType:Br,xsrfCookieName:Br,xsrfHeaderName:Br,onUploadProgress:Br,onDownloadProgress:Br,decompress:Br,maxContentLength:Br,maxBodyLength:Br,beforeRedirect:Br,transport:Br,httpAgent:Br,httpsAgent:Br,cancelToken:Br,socketPath:Br,responseEncoding:Br,validateStatus:Wr,headers:(Gr,Vr,Zr)=>kr(headersToObject(Gr),headersToObject(Vr),Zr,!0)};return utils$d.forEach(Object.keys(Object.assign({},fr,br)),function(Vr){const Zr=qr[Vr]||kr,Jr=Zr(fr[Vr],br[Vr],Vr);utils$d.isUndefined(Jr)&&Zr!==Wr||(wr[Vr]=Jr)}),wr}const resolveConfig=fr=>{const br=mergeConfig$1({},fr);let{data:wr,withXSRFToken:Er,xsrfHeaderName:kr,xsrfCookieName:jr,headers:Br,auth:Wr}=br;br.headers=Br=AxiosHeaders$1.from(Br),br.url=buildURL(buildFullPath(br.baseURL,br.url),fr.params,fr.paramsSerializer),Wr&&Br.set("Authorization","Basic "+btoa((Wr.username||"")+":"+(Wr.password?unescape(encodeURIComponent(Wr.password)):"")));let qr;if(utils$d.isFormData(wr)){if(platform$2.hasStandardBrowserEnv||platform$2.hasStandardBrowserWebWorkerEnv)Br.setContentType(void 0);else if((qr=Br.getContentType())!==!1){const[Gr,...Vr]=qr?qr.split(";").map(Zr=>Zr.trim()).filter(Boolean):[];Br.setContentType([Gr||"multipart/form-data",...Vr].join("; "))}}if(platform$2.hasStandardBrowserEnv&&(Er&&utils$d.isFunction(Er)&&(Er=Er(br)),Er||Er!==!1&&isURLSameOrigin(br.url))){const Gr=kr&&jr&&cookies.read(jr);Gr&&Br.set(kr,Gr)}return br},isXHRAdapterSupported=typeof XMLHttpRequest<"u",xhrAdapter=isXHRAdapterSupported&&function(fr){return new Promise(function(wr,Er){const kr=resolveConfig(fr);let jr=kr.data;const Br=AxiosHeaders$1.from(kr.headers).normalize();let{responseType:Wr,onUploadProgress:qr,onDownloadProgress:Gr}=kr,Vr,Zr,Jr,Qr,_n;function En(){Qr&&Qr(),_n&&_n(),kr.cancelToken&&kr.cancelToken.unsubscribe(Vr),kr.signal&&kr.signal.removeEventListener("abort",Vr)}let Cn=new XMLHttpRequest;Cn.open(kr.method.toUpperCase(),kr.url,!0),Cn.timeout=kr.timeout;function In(){if(!Cn)return;const jn=AxiosHeaders$1.from("getAllResponseHeaders"in Cn&&Cn.getAllResponseHeaders()),ro={data:!Wr||Wr==="text"||Wr==="json"?Cn.responseText:Cn.response,status:Cn.status,statusText:Cn.statusText,headers:jn,config:fr,request:Cn};settle(function(_i){wr(_i),En()},function(_i){Er(_i),En()},ro),Cn=null}"onloadend"in Cn?Cn.onloadend=In:Cn.onreadystatechange=function(){!Cn||Cn.readyState!==4||Cn.status===0&&!(Cn.responseURL&&Cn.responseURL.indexOf("file:")===0)||setTimeout(In)},Cn.onabort=function(){Cn&&(Er(new AxiosError$1("Request aborted",AxiosError$1.ECONNABORTED,fr,Cn)),Cn=null)},Cn.onerror=function(){Er(new AxiosError$1("Network Error",AxiosError$1.ERR_NETWORK,fr,Cn)),Cn=null},Cn.ontimeout=function(){let eo=kr.timeout?"timeout of "+kr.timeout+"ms exceeded":"timeout exceeded";const ro=kr.transitional||transitionalDefaults;kr.timeoutErrorMessage&&(eo=kr.timeoutErrorMessage),Er(new AxiosError$1(eo,ro.clarifyTimeoutError?AxiosError$1.ETIMEDOUT:AxiosError$1.ECONNABORTED,fr,Cn)),Cn=null},jr===void 0&&Br.setContentType(null),"setRequestHeader"in Cn&&utils$d.forEach(Br.toJSON(),function(eo,ro){Cn.setRequestHeader(ro,eo)}),utils$d.isUndefined(kr.withCredentials)||(Cn.withCredentials=!!kr.withCredentials),Wr&&Wr!=="json"&&(Cn.responseType=kr.responseType),Gr&&([Jr,_n]=progressEventReducer(Gr,!0),Cn.addEventListener("progress",Jr)),qr&&Cn.upload&&([Zr,Qr]=progressEventReducer(qr),Cn.upload.addEventListener("progress",Zr),Cn.upload.addEventListener("loadend",Qr)),(kr.cancelToken||kr.signal)&&(Vr=jn=>{Cn&&(Er(!jn||jn.type?new CanceledError$1(null,fr,Cn):jn),Cn.abort(),Cn=null)},kr.cancelToken&&kr.cancelToken.subscribe(Vr),kr.signal&&(kr.signal.aborted?Vr():kr.signal.addEventListener("abort",Vr)));const An=parseProtocol(kr.url);if(An&&platform$2.protocols.indexOf(An)===-1){Er(new AxiosError$1("Unsupported protocol "+An+":",AxiosError$1.ERR_BAD_REQUEST,fr));return}Cn.send(jr||null)})},composeSignals=(fr,br)=>{const{length:wr}=fr=fr?fr.filter(Boolean):[];if(br||wr){let Er=new AbortController,kr;const jr=function(Gr){if(!kr){kr=!0,Wr();const Vr=Gr instanceof Error?Gr:this.reason;Er.abort(Vr instanceof AxiosError$1?Vr:new CanceledError$1(Vr instanceof Error?Vr.message:Vr))}};let Br=br&&setTimeout(()=>{Br=null,jr(new AxiosError$1(`timeout ${br} of ms exceeded`,AxiosError$1.ETIMEDOUT))},br);const Wr=()=>{fr&&(Br&&clearTimeout(Br),Br=null,fr.forEach(Gr=>{Gr.unsubscribe?Gr.unsubscribe(jr):Gr.removeEventListener("abort",jr)}),fr=null)};fr.forEach(Gr=>Gr.addEventListener("abort",jr));const{signal:qr}=Er;return qr.unsubscribe=()=>utils$d.asap(Wr),qr}},streamChunk=function*(fr,br){let wr=fr.byteLength;if(wr{const kr=readBytes(fr,br);let jr=0,Br,Wr=qr=>{Br||(Br=!0,Er&&Er(qr))};return new ReadableStream({async pull(qr){try{const{done:Gr,value:Vr}=await kr.next();if(Gr){Wr(),qr.close();return}let Zr=Vr.byteLength;if(wr){let Jr=jr+=Zr;wr(Jr)}qr.enqueue(new Uint8Array(Vr))}catch(Gr){throw Wr(Gr),Gr}},cancel(qr){return Wr(qr),kr.return()}},{highWaterMark:2})},isFetchSupported=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",isReadableStreamSupported=isFetchSupported&&typeof ReadableStream=="function",encodeText=isFetchSupported&&(typeof TextEncoder=="function"?(fr=>br=>fr.encode(br))(new TextEncoder):async fr=>new Uint8Array(await new Response(fr).arrayBuffer())),test=(fr,...br)=>{try{return!!fr(...br)}catch{return!1}},supportsRequestStream=isReadableStreamSupported&&test(()=>{let fr=!1;const br=new Request(platform$2.origin,{body:new ReadableStream,method:"POST",get duplex(){return fr=!0,"half"}}).headers.has("Content-Type");return fr&&!br}),DEFAULT_CHUNK_SIZE=64*1024,supportsResponseStream=isReadableStreamSupported&&test(()=>utils$d.isReadableStream(new Response("").body)),resolvers={stream:supportsResponseStream&&(fr=>fr.body)};isFetchSupported&&(fr=>{["text","arrayBuffer","blob","formData","stream"].forEach(br=>{!resolvers[br]&&(resolvers[br]=utils$d.isFunction(fr[br])?wr=>wr[br]():(wr,Er)=>{throw new AxiosError$1(`Response type '${br}' is not supported`,AxiosError$1.ERR_NOT_SUPPORT,Er)})})})(new Response);const getBodyLength=async fr=>{if(fr==null)return 0;if(utils$d.isBlob(fr))return fr.size;if(utils$d.isSpecCompliantForm(fr))return(await new Request(platform$2.origin,{method:"POST",body:fr}).arrayBuffer()).byteLength;if(utils$d.isArrayBufferView(fr)||utils$d.isArrayBuffer(fr))return fr.byteLength;if(utils$d.isURLSearchParams(fr)&&(fr=fr+""),utils$d.isString(fr))return(await encodeText(fr)).byteLength},resolveBodyLength=async(fr,br)=>{const wr=utils$d.toFiniteNumber(fr.getContentLength());return wr??getBodyLength(br)},fetchAdapter=isFetchSupported&&(async fr=>{let{url:br,method:wr,data:Er,signal:kr,cancelToken:jr,timeout:Br,onDownloadProgress:Wr,onUploadProgress:qr,responseType:Gr,headers:Vr,withCredentials:Zr="same-origin",fetchOptions:Jr}=resolveConfig(fr);Gr=Gr?(Gr+"").toLowerCase():"text";let Qr=composeSignals([kr,jr&&jr.toAbortSignal()],Br),_n;const En=Qr&&Qr.unsubscribe&&(()=>{Qr.unsubscribe()});let Cn;try{if(qr&&supportsRequestStream&&wr!=="get"&&wr!=="head"&&(Cn=await resolveBodyLength(Vr,Er))!==0){let ro=new Request(br,{method:"POST",body:Er,duplex:"half"}),to;if(utils$d.isFormData(Er)&&(to=ro.headers.get("content-type"))&&Vr.setContentType(to),ro.body){const[_i,oo]=progressEventDecorator(Cn,progressEventReducer(asyncDecorator(qr)));Er=trackStream(ro.body,DEFAULT_CHUNK_SIZE,_i,oo)}}utils$d.isString(Zr)||(Zr=Zr?"include":"omit");const In="credentials"in Request.prototype;_n=new Request(br,{...Jr,signal:Qr,method:wr.toUpperCase(),headers:Vr.normalize().toJSON(),body:Er,duplex:"half",credentials:In?Zr:void 0});let An=await fetch(_n);const jn=supportsResponseStream&&(Gr==="stream"||Gr==="response");if(supportsResponseStream&&(Wr||jn&&En)){const ro={};["status","statusText","headers"].forEach(io=>{ro[io]=An[io]});const to=utils$d.toFiniteNumber(An.headers.get("content-length")),[_i,oo]=Wr&&progressEventDecorator(to,progressEventReducer(asyncDecorator(Wr),!0))||[];An=new Response(trackStream(An.body,DEFAULT_CHUNK_SIZE,_i,()=>{oo&&oo(),En&&En()}),ro)}Gr=Gr||"text";let eo=await resolvers[utils$d.findKey(resolvers,Gr)||"text"](An,fr);return!jn&&En&&En(),await new Promise((ro,to)=>{settle(ro,to,{data:eo,headers:AxiosHeaders$1.from(An.headers),status:An.status,statusText:An.statusText,config:fr,request:_n})})}catch(In){throw En&&En(),In&&In.name==="TypeError"&&/fetch/i.test(In.message)?Object.assign(new AxiosError$1("Network Error",AxiosError$1.ERR_NETWORK,fr,_n),{cause:In.cause||In}):AxiosError$1.from(In,In&&In.code,fr,_n)}}),knownAdapters={http:httpAdapter,xhr:xhrAdapter,fetch:fetchAdapter};utils$d.forEach(knownAdapters,(fr,br)=>{if(fr){try{Object.defineProperty(fr,"name",{value:br})}catch{}Object.defineProperty(fr,"adapterName",{value:br})}});const renderReason=fr=>`- ${fr}`,isResolvedHandle=fr=>utils$d.isFunction(fr)||fr===null||fr===!1,adapters={getAdapter:fr=>{fr=utils$d.isArray(fr)?fr:[fr];const{length:br}=fr;let wr,Er;const kr={};for(let jr=0;jr`adapter ${Wr} `+(qr===!1?"is not supported by the environment":"is not available in the build"));let Br=br?jr.length>1?`since : `+jr.map(renderReason).join(` `):" "+renderReason(jr[0]):"as no adapter specified";throw new AxiosError$1("There is no suitable adapter to dispatch the request "+Br,"ERR_NOT_SUPPORT")}return Er},adapters:knownAdapters};function throwIfCancellationRequested(fr){if(fr.cancelToken&&fr.cancelToken.throwIfRequested(),fr.signal&&fr.signal.aborted)throw new CanceledError$1(null,fr)}function dispatchRequest(fr){return throwIfCancellationRequested(fr),fr.headers=AxiosHeaders$1.from(fr.headers),fr.data=transformData.call(fr,fr.transformRequest),["post","put","patch"].indexOf(fr.method)!==-1&&fr.headers.setContentType("application/x-www-form-urlencoded",!1),adapters.getAdapter(fr.adapter||defaults.adapter)(fr).then(function(Er){return throwIfCancellationRequested(fr),Er.data=transformData.call(fr,fr.transformResponse,Er),Er.headers=AxiosHeaders$1.from(Er.headers),Er},function(Er){return isCancel$1(Er)||(throwIfCancellationRequested(fr),Er&&Er.response&&(Er.response.data=transformData.call(fr,fr.transformResponse,Er.response),Er.response.headers=AxiosHeaders$1.from(Er.response.headers))),Promise.reject(Er)})}const VERSION$4="1.7.8",validators$1={};["object","boolean","number","function","string","symbol"].forEach((fr,br)=>{validators$1[fr]=function(Er){return typeof Er===fr||"a"+(br<1?"n ":" ")+fr}});const deprecatedWarnings={};validators$1.transitional=function(br,wr,Er){function kr(jr,Br){return"[Axios v"+VERSION$4+"] Transitional option '"+jr+"'"+Br+(Er?". "+Er:"")}return(jr,Br,Wr)=>{if(br===!1)throw new AxiosError$1(kr(Br," has been removed"+(wr?" in "+wr:"")),AxiosError$1.ERR_DEPRECATED);return wr&&!deprecatedWarnings[Br]&&(deprecatedWarnings[Br]=!0,console.warn(kr(Br," has been deprecated since v"+wr+" and will be removed in the near future"))),br?br(jr,Br,Wr):!0}};validators$1.spelling=function(br){return(wr,Er)=>(console.warn(`${Er} is likely a misspelling of ${br}`),!0)};function assertOptions(fr,br,wr){if(typeof fr!="object")throw new AxiosError$1("options must be an object",AxiosError$1.ERR_BAD_OPTION_VALUE);const Er=Object.keys(fr);let kr=Er.length;for(;kr-- >0;){const jr=Er[kr],Br=br[jr];if(Br){const Wr=fr[jr],qr=Wr===void 0||Br(Wr,jr,fr);if(qr!==!0)throw new AxiosError$1("option "+jr+" must be "+qr,AxiosError$1.ERR_BAD_OPTION_VALUE);continue}if(wr!==!0)throw new AxiosError$1("Unknown option "+jr,AxiosError$1.ERR_BAD_OPTION)}}const validator$2={assertOptions,validators:validators$1},validators=validator$2.validators;let Axios$1=class{constructor(br){this.defaults=br,this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}async request(br,wr){try{return await this._request(br,wr)}catch(Er){if(Er instanceof Error){let kr={};Error.captureStackTrace?Error.captureStackTrace(kr):kr=new Error;const jr=kr.stack?kr.stack.replace(/^.+\n/,""):"";try{Er.stack?jr&&!String(Er.stack).endsWith(jr.replace(/^.+\n.+\n/,""))&&(Er.stack+=` -`+jr):Er.stack=jr}catch{}}throw Er}}_request(br,wr){typeof br=="string"?(wr=wr||{},wr.url=br):wr=br||{},wr=mergeConfig$1(this.defaults,wr);const{transitional:Er,paramsSerializer:kr,headers:jr}=wr;Er!==void 0&&validator$2.assertOptions(Er,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),kr!=null&&(utils$d.isFunction(kr)?wr.paramsSerializer={serialize:kr}:validator$2.assertOptions(kr,{encode:validators.function,serialize:validators.function},!0)),validator$2.assertOptions(wr,{baseUrl:validators.spelling("baseURL"),withXsrfToken:validators.spelling("withXSRFToken")},!0),wr.method=(wr.method||this.defaults.method||"get").toLowerCase();let Br=jr&&utils$d.merge(jr.common,jr[wr.method]);jr&&utils$d.forEach(["delete","get","head","post","put","patch","common"],_n=>{delete jr[_n]}),wr.headers=AxiosHeaders$1.concat(Br,jr);const Wr=[];let qr=!0;this.interceptors.request.forEach(function(En){typeof En.runWhen=="function"&&En.runWhen(wr)===!1||(qr=qr&&En.synchronous,Wr.unshift(En.fulfilled,En.rejected))});const Gr=[];this.interceptors.response.forEach(function(En){Gr.push(En.fulfilled,En.rejected)});let Vr,Zr=0,Jr;if(!qr){const _n=[dispatchRequest.bind(this),void 0];for(_n.unshift.apply(_n,Wr),_n.push.apply(_n,Gr),Jr=_n.length,Vr=Promise.resolve(wr);Zr{if(!Er._listeners)return;let jr=Er._listeners.length;for(;jr-- >0;)Er._listeners[jr](kr);Er._listeners=null}),this.promise.then=kr=>{let jr;const Br=new Promise(Wr=>{Er.subscribe(Wr),jr=Wr}).then(kr);return Br.cancel=function(){Er.unsubscribe(jr)},Br},br(function(jr,Br,Wr){Er.reason||(Er.reason=new CanceledError$1(jr,Br,Wr),wr(Er.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(br){if(this.reason){br(this.reason);return}this._listeners?this._listeners.push(br):this._listeners=[br]}unsubscribe(br){if(!this._listeners)return;const wr=this._listeners.indexOf(br);wr!==-1&&this._listeners.splice(wr,1)}toAbortSignal(){const br=new AbortController,wr=Er=>{br.abort(Er)};return this.subscribe(wr),br.signal.unsubscribe=()=>this.unsubscribe(wr),br.signal}static source(){let br;return{token:new cS(function(kr){br=kr}),cancel:br}}};function spread$1(fr){return function(wr){return fr.apply(null,wr)}}function isAxiosError$1(fr){return utils$d.isObject(fr)&&fr.isAxiosError===!0}const HttpStatusCode$1={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(HttpStatusCode$1).forEach(([fr,br])=>{HttpStatusCode$1[br]=fr});function createInstance(fr){const br=new Axios$1(fr),wr=bind$1(Axios$1.prototype.request,br);return utils$d.extend(wr,Axios$1.prototype,br,{allOwnKeys:!0}),utils$d.extend(wr,br,null,{allOwnKeys:!0}),wr.create=function(kr){return createInstance(mergeConfig$1(fr,kr))},wr}const axios$1=createInstance(defaults);axios$1.Axios=Axios$1;axios$1.CanceledError=CanceledError$1;axios$1.CancelToken=CancelToken$1;axios$1.isCancel=isCancel$1;axios$1.VERSION=VERSION$4;axios$1.toFormData=toFormData$1;axios$1.AxiosError=AxiosError$1;axios$1.Cancel=axios$1.CanceledError;axios$1.all=function(br){return Promise.all(br)};axios$1.spread=spread$1;axios$1.isAxiosError=isAxiosError$1;axios$1.mergeConfig=mergeConfig$1;axios$1.AxiosHeaders=AxiosHeaders$1;axios$1.formToJSON=fr=>formDataToJSON(utils$d.isHTMLForm(fr)?new FormData(fr):fr);axios$1.getAdapter=adapters.getAdapter;axios$1.HttpStatusCode=HttpStatusCode$1;axios$1.default=axios$1;const{Axios,AxiosError,CanceledError,isCancel,CancelToken,VERSION:VERSION$3,all,Cancel,isAxiosError,spread,toFormData,AxiosHeaders,HttpStatusCode,formToJSON,getAdapter,mergeConfig}=axios$1,axios=Object.freeze(Object.defineProperty({__proto__:null,Axios,AxiosError,AxiosHeaders,Cancel,CancelToken,CanceledError,HttpStatusCode,VERSION:VERSION$3,all,default:axios$1,formToJSON,getAdapter,isAxiosError,isCancel,mergeConfig,spread,toFormData},Symbol.toStringTag,{value:"Module"})),api$2=axios$1.create({timeout:15e3,baseURL:"https://push-auth.push.org"});api$2.interceptors.request.use(fr=>{const br=sessionStorage.getItem("jwt");return br&&(fr.headers.Authorization=`Bearer ${br}`),fr},fr=>Promise.reject(fr));const extractStateFromUrl=()=>new URLSearchParams(location.search).get("state"),fetchJwtUsingState=async({stateParam:fr})=>{try{const br=await api$2.get("/auth/jwt",{params:{state:fr}}),{token:wr}=br.data;if(!wr)throw new Error("Token not found in response");return wr}catch(br){return console.error("Error fetching JWT:",br),null}};function __awaiter$k(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var eventemitter3$2={exports:{}};(function(fr){var br=Object.prototype.hasOwnProperty,wr="~";function Er(){}Object.create&&(Er.prototype=Object.create(null),new Er().__proto__||(wr=!1));function kr(qr,Gr,Vr){this.fn=qr,this.context=Gr,this.once=Vr||!1}function jr(qr,Gr,Vr,Zr,Jr){if(typeof Vr!="function")throw new TypeError("The listener must be a function");var Qr=new kr(Vr,Zr||qr,Jr),_n=wr?wr+Gr:Gr;return qr._events[_n]?qr._events[_n].fn?qr._events[_n]=[qr._events[_n],Qr]:qr._events[_n].push(Qr):(qr._events[_n]=Qr,qr._eventsCount++),qr}function Br(qr,Gr){--qr._eventsCount===0?qr._events=new Er:delete qr._events[Gr]}function Wr(){this._events=new Er,this._eventsCount=0}Wr.prototype.eventNames=function(){var Gr=[],Vr,Zr;if(this._eventsCount===0)return Gr;for(Zr in Vr=this._events)br.call(Vr,Zr)&&Gr.push(wr?Zr.slice(1):Zr);return Object.getOwnPropertySymbols?Gr.concat(Object.getOwnPropertySymbols(Vr)):Gr},Wr.prototype.listeners=function(Gr){var Vr=wr?wr+Gr:Gr,Zr=this._events[Vr];if(!Zr)return[];if(Zr.fn)return[Zr.fn];for(var Jr=0,Qr=Zr.length,_n=new Array(Qr);Jr{if(typeof fr!="object"||typeof br!="object")return br;const wr=Object.assign({},fr);for(const Er in br)Object.prototype.hasOwnProperty.call(br,Er)&&(typeof br[Er]=="object"&&Object.prototype.hasOwnProperty.call(fr,Er)&&typeof fr[Er]=="object"?wr[Er]=deepMerge$1(fr[Er],br[Er]):wr[Er]=br[Er]);return wr},processArgs=fr=>{const br=fr.args.filter(Er=>typeof Er=="object"),wr=fr.args.filter(Er=>typeof Er!="object"||Er instanceof Error).map(Er=>Er.toString());return{objectArgs:br,remainingArgs:wr}},IGNORE_MESSAGES=["Failed to send logs to server"],messageQueue=[];let Logger$1=class iy{constructor(br,wr){this.name=br,this.meta=void 0,wr===void 0?this.level=LogLevel.WARN:this.level=wr}static setEmitErrors(br){br!==void 0&&(iy.globalKeys.emitErrors=br)}static setEnvironmentId(br){br!==void 0&&(iy.globalKeys.environmentId=br)}setMetaData(br,wr){this.meta||(this.meta={});const Er={};br.split(".").reduce((kr,jr,Br,Wr)=>{if(Br===Wr.length-1)kr[jr]=wr;else return kr[jr]||(kr[jr]={}),kr[jr]},Er),this.meta=deepMerge$1(this.meta,Er)}getNameArray(br){return Array.isArray(br)?br:[br]}createLogger(br,wr){return new iy([...this.getNameArray(this.name),...this.getNameArray(br)],wr??this.level)}get logLevel(){return LogLevel[this.level]}setLogLevel(br){if(br in LogLevel&&typeof br=="string")this.level=LogLevel[br];else if(br in LogLevel&&typeof br=="number")this.level=br;else throw new Error(`Invalid log level: ${br}`)}formatMessage(br,wr){var Er;return wr instanceof Error||wr instanceof Object&&Object.prototype.hasOwnProperty.call(wr,"stack")?wr=wr.stack:wr instanceof Object&&(wr=JSON.stringify(wr)),`${(Array.isArray(this.name)?this.name:[this.name]).map(jr=>`[${jr}]`).join("")} [${(Er=LogLevel[br])!==null&&Er!==void 0?Er:"TROUBLESHOOTING"}]: ${wr}`}captureAndSend(br,wr,...Er){return __awaiter$k(this,void 0,void 0,function*(){iy.globalKeys.emitErrors&&!IGNORE_MESSAGES.includes(wr==null?void 0:wr.toString())&&typeof window<"u"&&this.emitHttpLogs(br,wr,{args:Er})})}emitHttpLogs(br,wr,{args:Er=[],transformMeta:kr=jr=>jr}){messageQueue.push({args:Er,level:br,message:wr}),messageQueue.length===1&&queueMicrotask(()=>__awaiter$k(this,void 0,void 0,function*(){var jr,Br;const Wr=[];messageQueue.forEach(qr=>{var Gr,Vr,Zr,Jr,Qr,_n;const En={},{objectArgs:Cn,remainingArgs:In}=processArgs(qr);Object.assign(En,...Cn),Object.assign(En,{level:LogLevel[qr.level],message:[qr.message,...In].join(" "),meta:kr(this.meta),url:{hostname:(Gr=window.location)===null||Gr===void 0?void 0:Gr.hostname,origin:(Vr=window.location)===null||Vr===void 0?void 0:Vr.origin,pathname:(Zr=window.location)===null||Zr===void 0?void 0:Zr.pathname,port:(Jr=window.location)===null||Jr===void 0?void 0:Jr.port,protocol:(Qr=window.location)===null||Qr===void 0?void 0:Qr.protocol},userAgent:(_n=window.navigator)===null||_n===void 0?void 0:_n.userAgent}),Wr.push(En)});try{if(!(!((jr=iy.globalKeys)===null||jr===void 0)&&jr.environmentId))throw new Error("Environment ID not set");yield fetch(`https://logs.dynamicauth.com/api/v1/${(Br=iy.globalKeys)===null||Br===void 0?void 0:Br.environmentId}`,{body:JSON.stringify(Wr),headers:{"Content-Type":"application/json"},method:"POST",mode:"cors",referrerPolicy:"origin-when-cross-origin"})}catch(qr){this.debug("Failed to send logs to server",qr)}messageQueue.length=0}))}instrument(br,wr){return this.emitHttpLogs(LogLevel.INFO,br,{args:[wr],transformMeta:()=>{}})}log(br,wr,...Er){if(!(typeof window<"u"&&(window==null?void 0:window.dynamic_enableTroubleshootMode)===!0)&&(br{packageVersions[fr]=br,versionCheckTimeout&&(clearTimeout(versionCheckTimeout),versionCheckTimeout=null),versionCheckTimeout=setTimeout(()=>{const Er=Object.values(packageVersions),[kr]=Er;if(!Er.every(Br=>Br===kr)){const Br=packageVersions["@dynamic-labs/sdk-react-core"]||kr,Wr=getErrorMessage(Br);logger$b.error(new Error(Wr))}versionCheckTimeout=null},100)},getErrorMessage=fr=>` +`+jr):Er.stack=jr}catch{}}throw Er}}_request(br,wr){typeof br=="string"?(wr=wr||{},wr.url=br):wr=br||{},wr=mergeConfig$1(this.defaults,wr);const{transitional:Er,paramsSerializer:kr,headers:jr}=wr;Er!==void 0&&validator$2.assertOptions(Er,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},!1),kr!=null&&(utils$d.isFunction(kr)?wr.paramsSerializer={serialize:kr}:validator$2.assertOptions(kr,{encode:validators.function,serialize:validators.function},!0)),validator$2.assertOptions(wr,{baseUrl:validators.spelling("baseURL"),withXsrfToken:validators.spelling("withXSRFToken")},!0),wr.method=(wr.method||this.defaults.method||"get").toLowerCase();let Br=jr&&utils$d.merge(jr.common,jr[wr.method]);jr&&utils$d.forEach(["delete","get","head","post","put","patch","common"],_n=>{delete jr[_n]}),wr.headers=AxiosHeaders$1.concat(Br,jr);const Wr=[];let qr=!0;this.interceptors.request.forEach(function(En){typeof En.runWhen=="function"&&En.runWhen(wr)===!1||(qr=qr&&En.synchronous,Wr.unshift(En.fulfilled,En.rejected))});const Gr=[];this.interceptors.response.forEach(function(En){Gr.push(En.fulfilled,En.rejected)});let Vr,Zr=0,Jr;if(!qr){const _n=[dispatchRequest.bind(this),void 0];for(_n.unshift.apply(_n,Wr),_n.push.apply(_n,Gr),Jr=_n.length,Vr=Promise.resolve(wr);Zr{if(!Er._listeners)return;let jr=Er._listeners.length;for(;jr-- >0;)Er._listeners[jr](kr);Er._listeners=null}),this.promise.then=kr=>{let jr;const Br=new Promise(Wr=>{Er.subscribe(Wr),jr=Wr}).then(kr);return Br.cancel=function(){Er.unsubscribe(jr)},Br},br(function(jr,Br,Wr){Er.reason||(Er.reason=new CanceledError$1(jr,Br,Wr),wr(Er.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(br){if(this.reason){br(this.reason);return}this._listeners?this._listeners.push(br):this._listeners=[br]}unsubscribe(br){if(!this._listeners)return;const wr=this._listeners.indexOf(br);wr!==-1&&this._listeners.splice(wr,1)}toAbortSignal(){const br=new AbortController,wr=Er=>{br.abort(Er)};return this.subscribe(wr),br.signal.unsubscribe=()=>this.unsubscribe(wr),br.signal}static source(){let br;return{token:new cS(function(kr){br=kr}),cancel:br}}};function spread$1(fr){return function(wr){return fr.apply(null,wr)}}function isAxiosError$1(fr){return utils$d.isObject(fr)&&fr.isAxiosError===!0}const HttpStatusCode$1={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(HttpStatusCode$1).forEach(([fr,br])=>{HttpStatusCode$1[br]=fr});function createInstance(fr){const br=new Axios$1(fr),wr=bind$1(Axios$1.prototype.request,br);return utils$d.extend(wr,Axios$1.prototype,br,{allOwnKeys:!0}),utils$d.extend(wr,br,null,{allOwnKeys:!0}),wr.create=function(kr){return createInstance(mergeConfig$1(fr,kr))},wr}const axios$1=createInstance(defaults);axios$1.Axios=Axios$1;axios$1.CanceledError=CanceledError$1;axios$1.CancelToken=CancelToken$1;axios$1.isCancel=isCancel$1;axios$1.VERSION=VERSION$4;axios$1.toFormData=toFormData$1;axios$1.AxiosError=AxiosError$1;axios$1.Cancel=axios$1.CanceledError;axios$1.all=function(br){return Promise.all(br)};axios$1.spread=spread$1;axios$1.isAxiosError=isAxiosError$1;axios$1.mergeConfig=mergeConfig$1;axios$1.AxiosHeaders=AxiosHeaders$1;axios$1.formToJSON=fr=>formDataToJSON(utils$d.isHTMLForm(fr)?new FormData(fr):fr);axios$1.getAdapter=adapters.getAdapter;axios$1.HttpStatusCode=HttpStatusCode$1;axios$1.default=axios$1;const{Axios,AxiosError,CanceledError,isCancel,CancelToken,VERSION:VERSION$3,all,Cancel,isAxiosError,spread,toFormData,AxiosHeaders,HttpStatusCode,formToJSON,getAdapter,mergeConfig}=axios$1,axios=Object.freeze(Object.defineProperty({__proto__:null,Axios,AxiosError,AxiosHeaders,Cancel,CancelToken,CanceledError,HttpStatusCode,VERSION:VERSION$3,all,default:axios$1,formToJSON,getAdapter,isAxiosError,isCancel,mergeConfig,spread,toFormData},Symbol.toStringTag,{value:"Module"})),api$2=axios$1.create({timeout:15e3,baseURL:"https://push-auth.push.org"});api$2.interceptors.request.use(fr=>{const br=sessionStorage.getItem("jwt");return br&&(fr.headers.Authorization=`Bearer ${br}`),fr},fr=>Promise.reject(fr));const extractStateFromUrl=()=>{const fr=new URLSearchParams(location.search),br=fr.get("app");if(console.log("APPP URL",br),br){const Er=new URL(br),kr=Er.searchParams.get("state");Er.searchParams.delete("state");const jr=Er.toString();return console.log("modifiedAppUrl",jr),history.replaceState(null,"",`?app=${jr}`),console.log("Extracted State:",kr),kr}return fr.get("state")},fetchJwtUsingState=async({stateParam:fr})=>{try{const br=await api$2.get("/auth/jwt",{params:{state:fr}}),{token:wr}=br.data;if(!wr)throw new Error("Token not found in response");return wr}catch(br){return console.error("Error fetching JWT:",br),null}};function __awaiter$k(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var eventemitter3$2={exports:{}};(function(fr){var br=Object.prototype.hasOwnProperty,wr="~";function Er(){}Object.create&&(Er.prototype=Object.create(null),new Er().__proto__||(wr=!1));function kr(qr,Gr,Vr){this.fn=qr,this.context=Gr,this.once=Vr||!1}function jr(qr,Gr,Vr,Zr,Jr){if(typeof Vr!="function")throw new TypeError("The listener must be a function");var Qr=new kr(Vr,Zr||qr,Jr),_n=wr?wr+Gr:Gr;return qr._events[_n]?qr._events[_n].fn?qr._events[_n]=[qr._events[_n],Qr]:qr._events[_n].push(Qr):(qr._events[_n]=Qr,qr._eventsCount++),qr}function Br(qr,Gr){--qr._eventsCount===0?qr._events=new Er:delete qr._events[Gr]}function Wr(){this._events=new Er,this._eventsCount=0}Wr.prototype.eventNames=function(){var Gr=[],Vr,Zr;if(this._eventsCount===0)return Gr;for(Zr in Vr=this._events)br.call(Vr,Zr)&&Gr.push(wr?Zr.slice(1):Zr);return Object.getOwnPropertySymbols?Gr.concat(Object.getOwnPropertySymbols(Vr)):Gr},Wr.prototype.listeners=function(Gr){var Vr=wr?wr+Gr:Gr,Zr=this._events[Vr];if(!Zr)return[];if(Zr.fn)return[Zr.fn];for(var Jr=0,Qr=Zr.length,_n=new Array(Qr);Jr{if(typeof fr!="object"||typeof br!="object")return br;const wr=Object.assign({},fr);for(const Er in br)Object.prototype.hasOwnProperty.call(br,Er)&&(typeof br[Er]=="object"&&Object.prototype.hasOwnProperty.call(fr,Er)&&typeof fr[Er]=="object"?wr[Er]=deepMerge$1(fr[Er],br[Er]):wr[Er]=br[Er]);return wr},processArgs=fr=>{const br=fr.args.filter(Er=>typeof Er=="object"),wr=fr.args.filter(Er=>typeof Er!="object"||Er instanceof Error).map(Er=>Er.toString());return{objectArgs:br,remainingArgs:wr}},IGNORE_MESSAGES=["Failed to send logs to server"],messageQueue=[];let Logger$1=class i1{constructor(br,wr){this.name=br,this.meta=void 0,wr===void 0?this.level=LogLevel.WARN:this.level=wr}static setEmitErrors(br){br!==void 0&&(i1.globalKeys.emitErrors=br)}static setEnvironmentId(br){br!==void 0&&(i1.globalKeys.environmentId=br)}setMetaData(br,wr){this.meta||(this.meta={});const Er={};br.split(".").reduce((kr,jr,Br,Wr)=>{if(Br===Wr.length-1)kr[jr]=wr;else return kr[jr]||(kr[jr]={}),kr[jr]},Er),this.meta=deepMerge$1(this.meta,Er)}getNameArray(br){return Array.isArray(br)?br:[br]}createLogger(br,wr){return new i1([...this.getNameArray(this.name),...this.getNameArray(br)],wr??this.level)}get logLevel(){return LogLevel[this.level]}setLogLevel(br){if(br in LogLevel&&typeof br=="string")this.level=LogLevel[br];else if(br in LogLevel&&typeof br=="number")this.level=br;else throw new Error(`Invalid log level: ${br}`)}formatMessage(br,wr){var Er;return wr instanceof Error||wr instanceof Object&&Object.prototype.hasOwnProperty.call(wr,"stack")?wr=wr.stack:wr instanceof Object&&(wr=JSON.stringify(wr)),`${(Array.isArray(this.name)?this.name:[this.name]).map(jr=>`[${jr}]`).join("")} [${(Er=LogLevel[br])!==null&&Er!==void 0?Er:"TROUBLESHOOTING"}]: ${wr}`}captureAndSend(br,wr,...Er){return __awaiter$k(this,void 0,void 0,function*(){i1.globalKeys.emitErrors&&!IGNORE_MESSAGES.includes(wr==null?void 0:wr.toString())&&typeof window<"u"&&this.emitHttpLogs(br,wr,{args:Er})})}emitHttpLogs(br,wr,{args:Er=[],transformMeta:kr=jr=>jr}){messageQueue.push({args:Er,level:br,message:wr}),messageQueue.length===1&&queueMicrotask(()=>__awaiter$k(this,void 0,void 0,function*(){var jr,Br;const Wr=[];messageQueue.forEach(qr=>{var Gr,Vr,Zr,Jr,Qr,_n;const En={},{objectArgs:Cn,remainingArgs:In}=processArgs(qr);Object.assign(En,...Cn),Object.assign(En,{level:LogLevel[qr.level],message:[qr.message,...In].join(" "),meta:kr(this.meta),url:{hostname:(Gr=window.location)===null||Gr===void 0?void 0:Gr.hostname,origin:(Vr=window.location)===null||Vr===void 0?void 0:Vr.origin,pathname:(Zr=window.location)===null||Zr===void 0?void 0:Zr.pathname,port:(Jr=window.location)===null||Jr===void 0?void 0:Jr.port,protocol:(Qr=window.location)===null||Qr===void 0?void 0:Qr.protocol},userAgent:(_n=window.navigator)===null||_n===void 0?void 0:_n.userAgent}),Wr.push(En)});try{if(!(!((jr=i1.globalKeys)===null||jr===void 0)&&jr.environmentId))throw new Error("Environment ID not set");yield fetch(`https://logs.dynamicauth.com/api/v1/${(Br=i1.globalKeys)===null||Br===void 0?void 0:Br.environmentId}`,{body:JSON.stringify(Wr),headers:{"Content-Type":"application/json"},method:"POST",mode:"cors",referrerPolicy:"origin-when-cross-origin"})}catch(qr){this.debug("Failed to send logs to server",qr)}messageQueue.length=0}))}instrument(br,wr){return this.emitHttpLogs(LogLevel.INFO,br,{args:[wr],transformMeta:()=>{}})}log(br,wr,...Er){if(!(typeof window<"u"&&(window==null?void 0:window.dynamic_enableTroubleshootMode)===!0)&&(br{packageVersions[fr]=br,versionCheckTimeout&&(clearTimeout(versionCheckTimeout),versionCheckTimeout=null),versionCheckTimeout=setTimeout(()=>{const Er=Object.values(packageVersions),[kr]=Er;if(!Er.every(Br=>Br===kr)){const Br=packageVersions["@dynamic-labs/sdk-react-core"]||kr,Wr=getErrorMessage(Br);logger$b.error(new Error(Wr))}versionCheckTimeout=null},100)},getErrorMessage=fr=>` 🚨 Version Mismatch Error One or more \`@dynamic-labs\` packages are installed with mismatched versions. All \`@dynamic-labs\` packages must be on the same version to work correctly. @@ -128,16 +128,16 @@ Make sure your charset is UTF-8`);wr=(wr>>>8&255)*192+(wr&255),fr.put(wr,13)}};v The chosen QR Code version cannot contain this amount of data. Minimum version required to store current data is: `+jr+`. `);const Br=createData(br,wr,kr),Wr=Utils$1.getSymbolSize(br),qr=new BitMatrix(Wr);return setupFinderPattern(qr,br),setupTimingPattern(qr),setupAlignmentPattern(qr,br),setupFormatInfo(qr,wr,0),br>=7&&setupVersionInfo(qr,br),setupData(qr,Br),isNaN(Er)&&(Er=MaskPattern.getBestMask(qr,setupFormatInfo.bind(null,qr,wr))),MaskPattern.applyMask(Er,qr),setupFormatInfo(qr,wr,Er),{modules:qr,version:br,errorCorrectionLevel:wr,maskPattern:Er,segments:kr}}qrcode.create=function(br,wr){if(typeof br>"u"||br==="")throw new Error("No input text");let Er=ECLevel.M,kr,jr;return typeof wr<"u"&&(Er=ECLevel.from(wr.errorCorrectionLevel,ECLevel.M),kr=Version.from(wr.version),jr=MaskPattern.from(wr.maskPattern),wr.toSJISFunc&&Utils$1.setToSJISFunction(wr.toSJISFunc)),createSymbol(br,kr,Er,jr)};var canvas={},utils$a={};(function(fr){function br(wr){if(typeof wr=="number"&&(wr=wr.toString()),typeof wr!="string")throw new Error("Color should be defined as hex string");let Er=wr.slice().replace("#","").split("");if(Er.length<3||Er.length===5||Er.length>8)throw new Error("Invalid hex color: "+wr);(Er.length===3||Er.length===4)&&(Er=Array.prototype.concat.apply([],Er.map(function(jr){return[jr,jr]}))),Er.length===6&&Er.push("F","F");const kr=parseInt(Er.join(""),16);return{r:kr>>24&255,g:kr>>16&255,b:kr>>8&255,a:kr&255,hex:"#"+Er.slice(0,6).join("")}}fr.getOptions=function(Er){Er||(Er={}),Er.color||(Er.color={});const kr=typeof Er.margin>"u"||Er.margin===null||Er.margin<0?4:Er.margin,jr=Er.width&&Er.width>=21?Er.width:void 0,Br=Er.scale||4;return{width:jr,scale:jr?4:Br,margin:kr,color:{dark:br(Er.color.dark||"#000000ff"),light:br(Er.color.light||"#ffffffff")},type:Er.type,rendererOpts:Er.rendererOpts||{}}},fr.getScale=function(Er,kr){return kr.width&&kr.width>=Er+kr.margin*2?kr.width/(Er+kr.margin*2):kr.scale},fr.getImageWidth=function(Er,kr){const jr=fr.getScale(Er,kr);return Math.floor((Er+kr.margin*2)*jr)},fr.qrToImageData=function(Er,kr,jr){const Br=kr.modules.size,Wr=kr.modules.data,qr=fr.getScale(Br,jr),Gr=Math.floor((Br+jr.margin*2)*qr),Vr=jr.margin*qr,Zr=[jr.color.light,jr.color.dark];for(let Jr=0;Jr=Vr&&Qr>=Vr&&Jr"u"&&(!Br||!Br.getContext)&&(qr=Br,Br=void 0),Br||(Gr=Er()),qr=br.getOptions(qr);const Vr=br.getImageWidth(jr.modules.size,qr),Zr=Gr.getContext("2d"),Jr=Zr.createImageData(Vr,Vr);return br.qrToImageData(Jr.data,jr,qr),wr(Zr,Gr,Vr),Zr.putImageData(Jr,0,0),Gr},fr.renderToDataURL=function(jr,Br,Wr){let qr=Wr;typeof qr>"u"&&(!Br||!Br.getContext)&&(qr=Br,Br=void 0),qr||(qr={});const Gr=fr.render(jr,Br,qr),Vr=qr.type||"image/png",Zr=qr.rendererOpts||{};return Gr.toDataURL(Vr,Zr.quality)}})(canvas);var svgTag={};const Utils=utils$a;function getColorAttrib(fr,br){const wr=fr.a/255,Er=br+'="'+fr.hex+'"';return wr<1?Er+" "+br+'-opacity="'+wr.toFixed(2).slice(1)+'"':Er}function svgCmd(fr,br,wr){let Er=fr+br;return typeof wr<"u"&&(Er+=" "+wr),Er}function qrToPath(fr,br,wr){let Er="",kr=0,jr=!1,Br=0;for(let Wr=0;Wr0&&qr>0&&fr[Wr-1]||(Er+=jr?svgCmd("M",qr+wr,.5+Gr+wr):svgCmd("m",kr,0),kr=0,jr=!1),qr+1':"",Gr="',Vr='viewBox="0 0 '+Wr+" "+Wr+'"',Jr=''+qr+Gr+` -`;return typeof Er=="function"&&Er(null,Jr),Jr};const canPromise=canPromise$1,QRCode$1=qrcode,CanvasRenderer=canvas,SvgRenderer=svgTag;function renderCanvas(fr,br,wr,Er,kr){const jr=[].slice.call(arguments,1),Br=jr.length,Wr=typeof jr[Br-1]=="function";if(!Wr&&!canPromise())throw new Error("Callback required as last argument");if(Wr){if(Br<2)throw new Error("Too few arguments provided");Br===2?(kr=wr,wr=br,br=Er=void 0):Br===3&&(br.getContext&&typeof kr>"u"?(kr=Er,Er=void 0):(kr=Er,Er=wr,wr=br,br=void 0))}else{if(Br<1)throw new Error("Too few arguments provided");return Br===1?(wr=br,br=Er=void 0):Br===2&&!br.getContext&&(Er=wr,wr=br,br=void 0),new Promise(function(qr,Gr){try{const Vr=QRCode$1.create(wr,Er);qr(fr(Vr,br,Er))}catch(Vr){Gr(Vr)}})}try{const qr=QRCode$1.create(wr,Er);kr(null,fr(qr,br,Er))}catch(qr){kr(qr)}}browser$h.create=QRCode$1.create;browser$h.toCanvas=renderCanvas.bind(null,CanvasRenderer.render);browser$h.toDataURL=renderCanvas.bind(null,CanvasRenderer.renderToDataURL);browser$h.toString=renderCanvas.bind(null,function(fr,br,wr){return SvgRenderer.render(fr,wr)});var isArray$2=Array.isArray,keyList=Object.keys,hasProp=Object.prototype.hasOwnProperty,hasElementType=typeof Element<"u";function equal$1(fr,br){if(fr===br)return!0;if(fr&&br&&typeof fr=="object"&&typeof br=="object"){var wr=isArray$2(fr),Er=isArray$2(br),kr,jr,Br;if(wr&&Er){if(jr=fr.length,jr!=br.length)return!1;for(kr=jr;kr--!==0;)if(!equal$1(fr[kr],br[kr]))return!1;return!0}if(wr!=Er)return!1;var Wr=fr instanceof Date,qr=br instanceof Date;if(Wr!=qr)return!1;if(Wr&&qr)return fr.getTime()==br.getTime();var Gr=fr instanceof RegExp,Vr=br instanceof RegExp;if(Gr!=Vr)return!1;if(Gr&&Vr)return fr.toString()==br.toString();var Zr=keyList(fr);if(jr=Zr.length,jr!==keyList(br).length)return!1;for(kr=jr;kr--!==0;)if(!hasProp.call(br,Zr[kr]))return!1;if(hasElementType&&fr instanceof Element&&br instanceof Element)return fr===br;for(kr=jr;kr--!==0;)if(Br=Zr[kr],!(Br==="_owner"&&fr.$$typeof)&&!equal$1(fr[Br],br[Br]))return!1;return!0}return fr!==fr&&br!==br}var reactFastCompare=function(br,wr){try{return equal$1(br,wr)}catch(Er){if(Er.message&&Er.message.match(/stack|recursion/i)||Er.number===-2146828260)return console.warn("Warning: react-fast-compare does not handle circular references.",Er.name,Er.message),!1;throw Er}};const isEqual=getDefaultExportFromCjs$2(reactFastCompare);var isMergeableObject=function(br){return isNonNullObject(br)&&!isSpecial(br)};function isNonNullObject(fr){return!!fr&&typeof fr=="object"}function isSpecial(fr){var br=Object.prototype.toString.call(fr);return br==="[object RegExp]"||br==="[object Date]"||isReactElement(fr)}var canUseSymbol=typeof Symbol=="function"&&Symbol.for,REACT_ELEMENT_TYPE=canUseSymbol?Symbol.for("react.element"):60103;function isReactElement(fr){return fr.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget(fr){return Array.isArray(fr)?[]:{}}function cloneUnlessOtherwiseSpecified(fr,br){return br.clone!==!1&&br.isMergeableObject(fr)?deepmerge(emptyTarget(fr),fr,br):fr}function defaultArrayMerge(fr,br,wr){return fr.concat(br).map(function(Er){return cloneUnlessOtherwiseSpecified(Er,wr)})}function mergeObject(fr,br,wr){var Er={};return wr.isMergeableObject(fr)&&Object.keys(fr).forEach(function(kr){Er[kr]=cloneUnlessOtherwiseSpecified(fr[kr],wr)}),Object.keys(br).forEach(function(kr){!wr.isMergeableObject(br[kr])||!fr[kr]?Er[kr]=cloneUnlessOtherwiseSpecified(br[kr],wr):Er[kr]=deepmerge(fr[kr],br[kr],wr)}),Er}function deepmerge(fr,br,wr){wr=wr||{},wr.arrayMerge=wr.arrayMerge||defaultArrayMerge,wr.isMergeableObject=wr.isMergeableObject||isMergeableObject;var Er=Array.isArray(br),kr=Array.isArray(fr),jr=Er===kr;return jr?Er?wr.arrayMerge(fr,br,wr):mergeObject(fr,br,wr):cloneUnlessOtherwiseSpecified(br,wr)}deepmerge.all=function(br,wr){if(!Array.isArray(br))throw new Error("first argument should be an array");return br.reduce(function(Er,kr){return deepmerge(Er,kr,wr)},{})};var deepmerge_1=deepmerge,freeGlobal$1=typeof global$1=="object"&&global$1&&global$1.Object===Object&&global$1,freeSelf$1=typeof self=="object"&&self&&self.Object===Object&&self,root$1=freeGlobal$1||freeSelf$1||Function("return this")(),Symbol$1=root$1.Symbol,objectProto$d=Object.prototype,hasOwnProperty$a=objectProto$d.hasOwnProperty,nativeObjectToString$1=objectProto$d.toString,symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag(fr){var br=hasOwnProperty$a.call(fr,symToStringTag$1),wr=fr[symToStringTag$1];try{fr[symToStringTag$1]=void 0;var Er=!0}catch{}var kr=nativeObjectToString$1.call(fr);return Er&&(br?fr[symToStringTag$1]=wr:delete fr[symToStringTag$1]),kr}var objectProto$c=Object.prototype,nativeObjectToString=objectProto$c.toString;function objectToString(fr){return nativeObjectToString.call(fr)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$1?Symbol$1.toStringTag:void 0;function baseGetTag(fr){return fr==null?fr===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(fr)?getRawTag(fr):objectToString(fr)}function overArg(fr,br){return function(wr){return fr(br(wr))}}var getPrototype=overArg(Object.getPrototypeOf,Object);function isObjectLike(fr){return fr!=null&&typeof fr=="object"}var objectTag$3="[object Object]",funcProto$2=Function.prototype,objectProto$b=Object.prototype,funcToString$2=funcProto$2.toString,hasOwnProperty$9=objectProto$b.hasOwnProperty,objectCtorString=funcToString$2.call(Object);function isPlainObject(fr){if(!isObjectLike(fr)||baseGetTag(fr)!=objectTag$3)return!1;var br=getPrototype(fr);if(br===null)return!0;var wr=hasOwnProperty$9.call(br,"constructor")&&br.constructor;return typeof wr=="function"&&wr instanceof wr&&funcToString$2.call(wr)==objectCtorString}function listCacheClear(){this.__data__=[],this.size=0}function eq(fr,br){return fr===br||fr!==fr&&br!==br}function assocIndexOf(fr,br){for(var wr=fr.length;wr--;)if(eq(fr[wr][0],br))return wr;return-1}var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(fr){var br=this.__data__,wr=assocIndexOf(br,fr);if(wr<0)return!1;var Er=br.length-1;return wr==Er?br.pop():splice.call(br,wr,1),--this.size,!0}function listCacheGet(fr){var br=this.__data__,wr=assocIndexOf(br,fr);return wr<0?void 0:br[wr][1]}function listCacheHas(fr){return assocIndexOf(this.__data__,fr)>-1}function listCacheSet(fr,br){var wr=this.__data__,Er=assocIndexOf(wr,fr);return Er<0?(++this.size,wr.push([fr,br])):wr[Er][1]=br,this}function ListCache(fr){var br=-1,wr=fr==null?0:fr.length;for(this.clear();++br-1&&fr%1==0&&fr-1&&fr%1==0&&fr<=MAX_SAFE_INTEGER}var argsTag$1="[object Arguments]",arrayTag$1="[object Array]",boolTag$2="[object Boolean]",dateTag$2="[object Date]",errorTag$1="[object Error]",funcTag$1="[object Function]",mapTag$4="[object Map]",numberTag$2="[object Number]",objectTag$2="[object Object]",regexpTag$2="[object RegExp]",setTag$4="[object Set]",stringTag$2="[object String]",weakMapTag$2="[object WeakMap]",arrayBufferTag$2="[object ArrayBuffer]",dataViewTag$3="[object DataView]",float32Tag$2="[object Float32Array]",float64Tag$2="[object Float64Array]",int8Tag$2="[object Int8Array]",int16Tag$2="[object Int16Array]",int32Tag$2="[object Int32Array]",uint8Tag$2="[object Uint8Array]",uint8ClampedTag$2="[object Uint8ClampedArray]",uint16Tag$2="[object Uint16Array]",uint32Tag$2="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag$2]=typedArrayTags[float64Tag$2]=typedArrayTags[int8Tag$2]=typedArrayTags[int16Tag$2]=typedArrayTags[int32Tag$2]=typedArrayTags[uint8Tag$2]=typedArrayTags[uint8ClampedTag$2]=typedArrayTags[uint16Tag$2]=typedArrayTags[uint32Tag$2]=!0;typedArrayTags[argsTag$1]=typedArrayTags[arrayTag$1]=typedArrayTags[arrayBufferTag$2]=typedArrayTags[boolTag$2]=typedArrayTags[dataViewTag$3]=typedArrayTags[dateTag$2]=typedArrayTags[errorTag$1]=typedArrayTags[funcTag$1]=typedArrayTags[mapTag$4]=typedArrayTags[numberTag$2]=typedArrayTags[objectTag$2]=typedArrayTags[regexpTag$2]=typedArrayTags[setTag$4]=typedArrayTags[stringTag$2]=typedArrayTags[weakMapTag$2]=!1;function baseIsTypedArray(fr){return isObjectLike(fr)&&isLength(fr.length)&&!!typedArrayTags[baseGetTag(fr)]}function baseUnary(fr){return function(br){return fr(br)}}var freeExports$1=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule$1=freeExports$1&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports$1=freeModule$1&&freeModule$1.exports===freeExports$1,freeProcess=moduleExports$1&&freeGlobal$1.process,nodeUtil=function(){try{var fr=freeModule$1&&freeModule$1.require&&freeModule$1.require("util").types;return fr||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch{}}(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray$1=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,objectProto$5=Object.prototype,hasOwnProperty$3=objectProto$5.hasOwnProperty;function arrayLikeKeys(fr,br){var wr=isArray$1(fr),Er=!wr&&isArguments$1(fr),kr=!wr&&!Er&&isBuffer(fr),jr=!wr&&!Er&&!kr&&isTypedArray$1(fr),Br=wr||Er||kr||jr,Wr=Br?baseTimes(fr.length,String):[],qr=Wr.length;for(var Gr in fr)(br||hasOwnProperty$3.call(fr,Gr))&&!(Br&&(Gr=="length"||kr&&(Gr=="offset"||Gr=="parent")||jr&&(Gr=="buffer"||Gr=="byteLength"||Gr=="byteOffset")||isIndex(Gr,qr)))&&Wr.push(Gr);return Wr}var objectProto$4=Object.prototype;function isPrototype(fr){var br=fr&&fr.constructor,wr=typeof br=="function"&&br.prototype||objectProto$4;return fr===wr}var nativeKeys=overArg(Object.keys,Object),objectProto$3=Object.prototype,hasOwnProperty$2=objectProto$3.hasOwnProperty;function baseKeys(fr){if(!isPrototype(fr))return nativeKeys(fr);var br=[];for(var wr in Object(fr))hasOwnProperty$2.call(fr,wr)&&wr!="constructor"&&br.push(wr);return br}function isArrayLike(fr){return fr!=null&&isLength(fr.length)&&!isFunction$2(fr)}function keys$1(fr){return isArrayLike(fr)?arrayLikeKeys(fr):baseKeys(fr)}function baseAssign(fr,br){return fr&©Object(br,keys$1(br),fr)}function nativeKeysIn(fr){var br=[];if(fr!=null)for(var wr in Object(fr))br.push(wr);return br}var objectProto$2=Object.prototype,hasOwnProperty$1=objectProto$2.hasOwnProperty;function baseKeysIn(fr){if(!isObject$4(fr))return nativeKeysIn(fr);var br=isPrototype(fr),wr=[];for(var Er in fr)Er=="constructor"&&(br||!hasOwnProperty$1.call(fr,Er))||wr.push(Er);return wr}function keysIn(fr){return isArrayLike(fr)?arrayLikeKeys(fr,!0):baseKeysIn(fr)}function baseAssignIn(fr,br){return fr&©Object(br,keysIn(br),fr)}var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,Buffer=moduleExports?root$1.Buffer:void 0,allocUnsafe$1=Buffer?Buffer.allocUnsafe:void 0;function cloneBuffer(fr,br){if(br)return fr.slice();var wr=fr.length,Er=allocUnsafe$1?allocUnsafe$1(wr):new fr.constructor(wr);return fr.copy(Er),Er}function copyArray(fr,br){var wr=-1,Er=fr.length;for(br||(br=Array(Er));++wr=0)&&(wr[kr]=fr[kr]);return wr}var isFunction$1=function(br){return typeof br=="function"},isObject$3=function(br){return br!==null&&typeof br=="object"},isInteger$1=function(br){return String(Math.floor(Number(br)))===br},isString=function(br){return Object.prototype.toString.call(br)==="[object String]"},isEmptyChildren=function(br){return reactExports.Children.count(br)===0},isPromise=function(br){return isObject$3(br)&&isFunction$1(br.then)};function getIn(fr,br,wr,Er){Er===void 0&&(Er=0);for(var kr=toPath(br);fr&&Er=0?[]:{}}}return(jr===0?fr:kr)[Br[jr]]===wr?fr:(wr===void 0?delete kr[Br[jr]]:kr[Br[jr]]=wr,jr===0&&wr===void 0&&delete Er[Br[jr]],Er)}function setNestedObjectValues(fr,br,wr,Er){wr===void 0&&(wr=new WeakMap),Er===void 0&&(Er={});for(var kr=0,jr=Object.keys(fr);kr0?Fo.map(function(Vo){return oo(Vo,getIn(No,Vo))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(Nl).then(function(Vo){return Vo.reduce(function(Uo,Ml,$a){return Ml==="DO_NOT_DELETE_YOU_WILL_BE_FIRED"||Ml&&(Uo=setIn(Uo,Fo[$a],Ml)),Uo},{})})},[oo]),co=reactExports.useCallback(function(No){return Promise.all([io(No),Jr.validationSchema?_i(No):{},Jr.validate?to(No):{}]).then(function(Fo){var Nl=Fo[0],Vo=Fo[1],Uo=Fo[2],Ml=deepmerge_1.all([Nl,Vo,Uo],{arrayMerge});return Ml})},[Jr.validate,Jr.validationSchema,io,to,_i]),so=useEventCallback$1(function(No){return No===void 0&&(No=eo.values),ro({type:"SET_ISVALIDATING",payload:!0}),co(No).then(function(Fo){return In.current&&(ro({type:"SET_ISVALIDATING",payload:!1}),ro({type:"SET_ERRORS",payload:Fo})),Fo})});reactExports.useEffect(function(){Br&&In.current===!0&&isEqual(Qr.current,Jr.initialValues)&&so(Qr.current)},[Br,so]);var no=reactExports.useCallback(function(No){var Fo=No&&No.values?No.values:Qr.current,Nl=No&&No.errors?No.errors:_n.current?_n.current:Jr.initialErrors||{},Vo=No&&No.touched?No.touched:En.current?En.current:Jr.initialTouched||{},Uo=No&&No.status?No.status:Cn.current?Cn.current:Jr.initialStatus;Qr.current=Fo,_n.current=Nl,En.current=Vo,Cn.current=Uo;var Ml=function(){ro({type:"RESET_FORM",payload:{isSubmitting:!!No&&!!No.isSubmitting,errors:Nl,touched:Vo,status:Uo,values:Fo,isValidating:!!No&&!!No.isValidating,submitCount:No&&No.submitCount&&typeof No.submitCount=="number"?No.submitCount:0}})};if(Jr.onReset){var $a=Jr.onReset(eo.values,yo);isPromise($a)?$a.then(Ml):Ml()}else Ml()},[Jr.initialErrors,Jr.initialStatus,Jr.initialTouched]);reactExports.useEffect(function(){In.current===!0&&!isEqual(Qr.current,Jr.initialValues)&&(Gr&&(Qr.current=Jr.initialValues,no()),Br&&so(Qr.current))},[Gr,Jr.initialValues,no,Br,so]),reactExports.useEffect(function(){Gr&&In.current===!0&&!isEqual(_n.current,Jr.initialErrors)&&(_n.current=Jr.initialErrors||emptyErrors,ro({type:"SET_ERRORS",payload:Jr.initialErrors||emptyErrors}))},[Gr,Jr.initialErrors]),reactExports.useEffect(function(){Gr&&In.current===!0&&!isEqual(En.current,Jr.initialTouched)&&(En.current=Jr.initialTouched||emptyTouched,ro({type:"SET_TOUCHED",payload:Jr.initialTouched||emptyTouched}))},[Gr,Jr.initialTouched]),reactExports.useEffect(function(){Gr&&In.current===!0&&!isEqual(Cn.current,Jr.initialStatus)&&(Cn.current=Jr.initialStatus,ro({type:"SET_STATUS",payload:Jr.initialStatus}))},[Gr,Jr.initialStatus,Jr.initialTouched]);var Tn=useEventCallback$1(function(No){if(An.current[No]&&isFunction$1(An.current[No].validate)){var Fo=getIn(eo.values,No),Nl=An.current[No].validate(Fo);return isPromise(Nl)?(ro({type:"SET_ISVALIDATING",payload:!0}),Nl.then(function(Vo){return Vo}).then(function(Vo){ro({type:"SET_FIELD_ERROR",payload:{field:No,value:Vo}}),ro({type:"SET_ISVALIDATING",payload:!1})})):(ro({type:"SET_FIELD_ERROR",payload:{field:No,value:Nl}}),Promise.resolve(Nl))}else if(Jr.validationSchema)return ro({type:"SET_ISVALIDATING",payload:!0}),_i(eo.values,No).then(function(Vo){return Vo}).then(function(Vo){ro({type:"SET_FIELD_ERROR",payload:{field:No,value:Vo[No]}}),ro({type:"SET_ISVALIDATING",payload:!1})});return Promise.resolve()}),Hr=reactExports.useCallback(function(No,Fo){var Nl=Fo.validate;An.current[No]={validate:Nl}},[]),Xr=reactExports.useCallback(function(No){delete An.current[No]},[]),Sn=useEventCallback$1(function(No,Fo){ro({type:"SET_TOUCHED",payload:No});var Nl=Fo===void 0?kr:Fo;return Nl?so(eo.values):Promise.resolve()}),Rn=reactExports.useCallback(function(No){ro({type:"SET_ERRORS",payload:No})},[]),Pn=useEventCallback$1(function(No,Fo){var Nl=isFunction$1(No)?No(eo.values):No;ro({type:"SET_VALUES",payload:Nl});var Vo=Fo===void 0?wr:Fo;return Vo?so(Nl):Promise.resolve()}),On=reactExports.useCallback(function(No,Fo){ro({type:"SET_FIELD_ERROR",payload:{field:No,value:Fo}})},[]),Zn=useEventCallback$1(function(No,Fo,Nl){ro({type:"SET_FIELD_VALUE",payload:{field:No,value:Fo}});var Vo=Nl===void 0?wr:Nl;return Vo?so(setIn(eo.values,No,Fo)):Promise.resolve()}),Nn=reactExports.useCallback(function(No,Fo){var Nl=Fo,Vo=No,Uo;if(!isString(No)){No.persist&&No.persist();var Ml=No.target?No.target:No.currentTarget,$a=Ml.type,Jo=Ml.name,Zl=Ml.id,Cl=Ml.value,ko=Ml.checked,wo=Ml.outerHTML,bo=Ml.options,Io=Ml.multiple;Nl=Fo||Jo||Zl,Vo=/number|range/.test($a)?(Uo=parseFloat(Cl),isNaN(Uo)?"":Uo):/checkbox/.test($a)?getValueForCheckbox(getIn(eo.values,Nl),ko,Cl):bo&&Io?getSelectedValues(bo):Cl}Nl&&Zn(Nl,Vo)},[Zn,eo.values]),wn=useEventCallback$1(function(No){if(isString(No))return function(Fo){return Nn(Fo,No)};Nn(No)}),zn=useEventCallback$1(function(No,Fo,Nl){Fo===void 0&&(Fo=!0),ro({type:"SET_FIELD_TOUCHED",payload:{field:No,value:Fo}});var Vo=Nl===void 0?kr:Nl;return Vo?so(eo.values):Promise.resolve()}),fo=reactExports.useCallback(function(No,Fo){No.persist&&No.persist();var Nl=No.target,Vo=Nl.name,Uo=Nl.id,Ml=Nl.outerHTML,$a=Fo||Vo||Uo;zn($a,!0)},[zn]),vo=useEventCallback$1(function(No){if(isString(No))return function(Fo){return fo(Fo,No)};fo(No)}),go=reactExports.useCallback(function(No){isFunction$1(No)?ro({type:"SET_FORMIK_STATE",payload:No}):ro({type:"SET_FORMIK_STATE",payload:function(){return No}})},[]),uo=reactExports.useCallback(function(No){ro({type:"SET_STATUS",payload:No})},[]),lo=reactExports.useCallback(function(No){ro({type:"SET_ISSUBMITTING",payload:No})},[]),Eo=useEventCallback$1(function(){return ro({type:"SUBMIT_ATTEMPT"}),so().then(function(No){var Fo=No instanceof Error,Nl=!Fo&&Object.keys(No).length===0;if(Nl){var Vo;try{if(Vo=_o(),Vo===void 0)return}catch(Uo){throw Uo}return Promise.resolve(Vo).then(function(Uo){return In.current&&ro({type:"SUBMIT_SUCCESS"}),Uo}).catch(function(Uo){if(In.current)throw ro({type:"SUBMIT_FAILURE"}),Uo})}else if(In.current&&(ro({type:"SUBMIT_FAILURE"}),Fo))throw No})}),mo=useEventCallback$1(function(No){No&&No.preventDefault&&isFunction$1(No.preventDefault)&&No.preventDefault(),No&&No.stopPropagation&&isFunction$1(No.stopPropagation)&&No.stopPropagation(),Eo().catch(function(Fo){console.warn("Warning: An unhandled error was caught from submitForm()",Fo)})}),yo={resetForm:no,validateForm:so,validateField:Tn,setErrors:Rn,setFieldError:On,setFieldTouched:zn,setFieldValue:Zn,setStatus:uo,setSubmitting:lo,setTouched:Sn,setValues:Pn,setFormikState:go,submitForm:Eo},_o=useEventCallback$1(function(){return Vr(eo.values,yo)}),Bo=useEventCallback$1(function(No){No&&No.preventDefault&&isFunction$1(No.preventDefault)&&No.preventDefault(),No&&No.stopPropagation&&isFunction$1(No.stopPropagation)&&No.stopPropagation(),no()}),Lo=reactExports.useCallback(function(No){return{value:getIn(eo.values,No),error:getIn(eo.errors,No),touched:!!getIn(eo.touched,No),initialValue:getIn(Qr.current,No),initialTouched:!!getIn(En.current,No),initialError:getIn(_n.current,No)}},[eo.errors,eo.touched,eo.values]),Wo=reactExports.useCallback(function(No){return{setValue:function(Nl,Vo){return Zn(No,Nl,Vo)},setTouched:function(Nl,Vo){return zn(No,Nl,Vo)},setError:function(Nl){return On(No,Nl)}}},[Zn,zn,On]),na=reactExports.useCallback(function(No){var Fo=isObject$3(No),Nl=Fo?No.name:No,Vo=getIn(eo.values,Nl),Uo={name:Nl,value:Vo,onChange:wn,onBlur:vo};if(Fo){var Ml=No.type,$a=No.value,Jo=No.as,Zl=No.multiple;Ml==="checkbox"?$a===void 0?Uo.checked=!!Vo:(Uo.checked=!!(Array.isArray(Vo)&&~Vo.indexOf($a)),Uo.value=$a):Ml==="radio"?(Uo.checked=Vo===$a,Uo.value=$a):Jo==="select"&&Zl&&(Uo.value=Uo.value||[],Uo.multiple=!0)}return Uo},[vo,wn,eo.values]),qo=reactExports.useMemo(function(){return!isEqual(Qr.current,eo.values)},[Qr.current,eo.values]),ga=reactExports.useMemo(function(){return typeof Wr<"u"?qo?eo.errors&&Object.keys(eo.errors).length===0:Wr!==!1&&isFunction$1(Wr)?Wr(Jr):Wr:eo.errors&&Object.keys(eo.errors).length===0},[Wr,qo,eo.errors,Jr]),wl=_extends$1e({},eo,{initialValues:Qr.current,initialErrors:_n.current,initialTouched:En.current,initialStatus:Cn.current,handleBlur:vo,handleChange:wn,handleReset:Bo,handleSubmit:mo,resetForm:no,setErrors:Rn,setFormikState:go,setFieldTouched:zn,setFieldValue:Zn,setFieldError:On,setStatus:uo,setSubmitting:lo,setTouched:Sn,setValues:Pn,submitForm:Eo,validateForm:so,validateField:Tn,isValid:ga,dirty:qo,unregisterField:Xr,registerField:Hr,getFieldProps:na,getFieldMeta:Lo,getFieldHelpers:Wo,validateOnBlur:kr,validateOnChange:wr,validateOnMount:Br});return wl}function Formik(fr){var br=useFormik(fr),wr=fr.component,Er=fr.children,kr=fr.render,jr=fr.innerRef;return reactExports.useImperativeHandle(jr,function(){return br}),reactExports.createElement(FormikProvider,{value:br},wr?reactExports.createElement(wr,br):kr?kr(br):Er?isFunction$1(Er)?Er(br):isEmptyChildren(Er)?null:reactExports.Children.only(Er):null)}function warnAboutMissingIdentifier(fr){var br=fr.htmlContent,wr=fr.documentationAnchorLink,Er=fr.handlerName;console.warn("Warning: Formik called `"+Er+"`, but you forgot to pass an `id` or `name` attribute to your input:\n "+br+` +`;return typeof Er=="function"&&Er(null,Jr),Jr};const canPromise=canPromise$1,QRCode$1=qrcode,CanvasRenderer=canvas,SvgRenderer=svgTag;function renderCanvas(fr,br,wr,Er,kr){const jr=[].slice.call(arguments,1),Br=jr.length,Wr=typeof jr[Br-1]=="function";if(!Wr&&!canPromise())throw new Error("Callback required as last argument");if(Wr){if(Br<2)throw new Error("Too few arguments provided");Br===2?(kr=wr,wr=br,br=Er=void 0):Br===3&&(br.getContext&&typeof kr>"u"?(kr=Er,Er=void 0):(kr=Er,Er=wr,wr=br,br=void 0))}else{if(Br<1)throw new Error("Too few arguments provided");return Br===1?(wr=br,br=Er=void 0):Br===2&&!br.getContext&&(Er=wr,wr=br,br=void 0),new Promise(function(qr,Gr){try{const Vr=QRCode$1.create(wr,Er);qr(fr(Vr,br,Er))}catch(Vr){Gr(Vr)}})}try{const qr=QRCode$1.create(wr,Er);kr(null,fr(qr,br,Er))}catch(qr){kr(qr)}}browser$h.create=QRCode$1.create;browser$h.toCanvas=renderCanvas.bind(null,CanvasRenderer.render);browser$h.toDataURL=renderCanvas.bind(null,CanvasRenderer.renderToDataURL);browser$h.toString=renderCanvas.bind(null,function(fr,br,wr){return SvgRenderer.render(fr,wr)});var isArray$2=Array.isArray,keyList=Object.keys,hasProp=Object.prototype.hasOwnProperty,hasElementType=typeof Element<"u";function equal$1(fr,br){if(fr===br)return!0;if(fr&&br&&typeof fr=="object"&&typeof br=="object"){var wr=isArray$2(fr),Er=isArray$2(br),kr,jr,Br;if(wr&&Er){if(jr=fr.length,jr!=br.length)return!1;for(kr=jr;kr--!==0;)if(!equal$1(fr[kr],br[kr]))return!1;return!0}if(wr!=Er)return!1;var Wr=fr instanceof Date,qr=br instanceof Date;if(Wr!=qr)return!1;if(Wr&&qr)return fr.getTime()==br.getTime();var Gr=fr instanceof RegExp,Vr=br instanceof RegExp;if(Gr!=Vr)return!1;if(Gr&&Vr)return fr.toString()==br.toString();var Zr=keyList(fr);if(jr=Zr.length,jr!==keyList(br).length)return!1;for(kr=jr;kr--!==0;)if(!hasProp.call(br,Zr[kr]))return!1;if(hasElementType&&fr instanceof Element&&br instanceof Element)return fr===br;for(kr=jr;kr--!==0;)if(Br=Zr[kr],!(Br==="_owner"&&fr.$$typeof)&&!equal$1(fr[Br],br[Br]))return!1;return!0}return fr!==fr&&br!==br}var reactFastCompare=function(br,wr){try{return equal$1(br,wr)}catch(Er){if(Er.message&&Er.message.match(/stack|recursion/i)||Er.number===-2146828260)return console.warn("Warning: react-fast-compare does not handle circular references.",Er.name,Er.message),!1;throw Er}};const isEqual=getDefaultExportFromCjs$2(reactFastCompare);var isMergeableObject=function(br){return isNonNullObject(br)&&!isSpecial(br)};function isNonNullObject(fr){return!!fr&&typeof fr=="object"}function isSpecial(fr){var br=Object.prototype.toString.call(fr);return br==="[object RegExp]"||br==="[object Date]"||isReactElement(fr)}var canUseSymbol=typeof Symbol=="function"&&Symbol.for,REACT_ELEMENT_TYPE=canUseSymbol?Symbol.for("react.element"):60103;function isReactElement(fr){return fr.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget(fr){return Array.isArray(fr)?[]:{}}function cloneUnlessOtherwiseSpecified(fr,br){return br.clone!==!1&&br.isMergeableObject(fr)?deepmerge(emptyTarget(fr),fr,br):fr}function defaultArrayMerge(fr,br,wr){return fr.concat(br).map(function(Er){return cloneUnlessOtherwiseSpecified(Er,wr)})}function mergeObject(fr,br,wr){var Er={};return wr.isMergeableObject(fr)&&Object.keys(fr).forEach(function(kr){Er[kr]=cloneUnlessOtherwiseSpecified(fr[kr],wr)}),Object.keys(br).forEach(function(kr){!wr.isMergeableObject(br[kr])||!fr[kr]?Er[kr]=cloneUnlessOtherwiseSpecified(br[kr],wr):Er[kr]=deepmerge(fr[kr],br[kr],wr)}),Er}function deepmerge(fr,br,wr){wr=wr||{},wr.arrayMerge=wr.arrayMerge||defaultArrayMerge,wr.isMergeableObject=wr.isMergeableObject||isMergeableObject;var Er=Array.isArray(br),kr=Array.isArray(fr),jr=Er===kr;return jr?Er?wr.arrayMerge(fr,br,wr):mergeObject(fr,br,wr):cloneUnlessOtherwiseSpecified(br,wr)}deepmerge.all=function(br,wr){if(!Array.isArray(br))throw new Error("first argument should be an array");return br.reduce(function(Er,kr){return deepmerge(Er,kr,wr)},{})};var deepmerge_1=deepmerge,freeGlobal$1=typeof global$1=="object"&&global$1&&global$1.Object===Object&&global$1,freeSelf$1=typeof self=="object"&&self&&self.Object===Object&&self,root$1=freeGlobal$1||freeSelf$1||Function("return this")(),Symbol$1=root$1.Symbol,objectProto$d=Object.prototype,hasOwnProperty$a=objectProto$d.hasOwnProperty,nativeObjectToString$1=objectProto$d.toString,symToStringTag$1=Symbol$1?Symbol$1.toStringTag:void 0;function getRawTag(fr){var br=hasOwnProperty$a.call(fr,symToStringTag$1),wr=fr[symToStringTag$1];try{fr[symToStringTag$1]=void 0;var Er=!0}catch{}var kr=nativeObjectToString$1.call(fr);return Er&&(br?fr[symToStringTag$1]=wr:delete fr[symToStringTag$1]),kr}var objectProto$c=Object.prototype,nativeObjectToString=objectProto$c.toString;function objectToString(fr){return nativeObjectToString.call(fr)}var nullTag="[object Null]",undefinedTag="[object Undefined]",symToStringTag=Symbol$1?Symbol$1.toStringTag:void 0;function baseGetTag(fr){return fr==null?fr===void 0?undefinedTag:nullTag:symToStringTag&&symToStringTag in Object(fr)?getRawTag(fr):objectToString(fr)}function overArg(fr,br){return function(wr){return fr(br(wr))}}var getPrototype=overArg(Object.getPrototypeOf,Object);function isObjectLike(fr){return fr!=null&&typeof fr=="object"}var objectTag$3="[object Object]",funcProto$2=Function.prototype,objectProto$b=Object.prototype,funcToString$2=funcProto$2.toString,hasOwnProperty$9=objectProto$b.hasOwnProperty,objectCtorString=funcToString$2.call(Object);function isPlainObject(fr){if(!isObjectLike(fr)||baseGetTag(fr)!=objectTag$3)return!1;var br=getPrototype(fr);if(br===null)return!0;var wr=hasOwnProperty$9.call(br,"constructor")&&br.constructor;return typeof wr=="function"&&wr instanceof wr&&funcToString$2.call(wr)==objectCtorString}function listCacheClear(){this.__data__=[],this.size=0}function eq(fr,br){return fr===br||fr!==fr&&br!==br}function assocIndexOf(fr,br){for(var wr=fr.length;wr--;)if(eq(fr[wr][0],br))return wr;return-1}var arrayProto=Array.prototype,splice=arrayProto.splice;function listCacheDelete(fr){var br=this.__data__,wr=assocIndexOf(br,fr);if(wr<0)return!1;var Er=br.length-1;return wr==Er?br.pop():splice.call(br,wr,1),--this.size,!0}function listCacheGet(fr){var br=this.__data__,wr=assocIndexOf(br,fr);return wr<0?void 0:br[wr][1]}function listCacheHas(fr){return assocIndexOf(this.__data__,fr)>-1}function listCacheSet(fr,br){var wr=this.__data__,Er=assocIndexOf(wr,fr);return Er<0?(++this.size,wr.push([fr,br])):wr[Er][1]=br,this}function ListCache(fr){var br=-1,wr=fr==null?0:fr.length;for(this.clear();++br-1&&fr%1==0&&fr-1&&fr%1==0&&fr<=MAX_SAFE_INTEGER}var argsTag$1="[object Arguments]",arrayTag$1="[object Array]",boolTag$2="[object Boolean]",dateTag$2="[object Date]",errorTag$1="[object Error]",funcTag$1="[object Function]",mapTag$4="[object Map]",numberTag$2="[object Number]",objectTag$2="[object Object]",regexpTag$2="[object RegExp]",setTag$4="[object Set]",stringTag$2="[object String]",weakMapTag$2="[object WeakMap]",arrayBufferTag$2="[object ArrayBuffer]",dataViewTag$3="[object DataView]",float32Tag$2="[object Float32Array]",float64Tag$2="[object Float64Array]",int8Tag$2="[object Int8Array]",int16Tag$2="[object Int16Array]",int32Tag$2="[object Int32Array]",uint8Tag$2="[object Uint8Array]",uint8ClampedTag$2="[object Uint8ClampedArray]",uint16Tag$2="[object Uint16Array]",uint32Tag$2="[object Uint32Array]",typedArrayTags={};typedArrayTags[float32Tag$2]=typedArrayTags[float64Tag$2]=typedArrayTags[int8Tag$2]=typedArrayTags[int16Tag$2]=typedArrayTags[int32Tag$2]=typedArrayTags[uint8Tag$2]=typedArrayTags[uint8ClampedTag$2]=typedArrayTags[uint16Tag$2]=typedArrayTags[uint32Tag$2]=!0;typedArrayTags[argsTag$1]=typedArrayTags[arrayTag$1]=typedArrayTags[arrayBufferTag$2]=typedArrayTags[boolTag$2]=typedArrayTags[dataViewTag$3]=typedArrayTags[dateTag$2]=typedArrayTags[errorTag$1]=typedArrayTags[funcTag$1]=typedArrayTags[mapTag$4]=typedArrayTags[numberTag$2]=typedArrayTags[objectTag$2]=typedArrayTags[regexpTag$2]=typedArrayTags[setTag$4]=typedArrayTags[stringTag$2]=typedArrayTags[weakMapTag$2]=!1;function baseIsTypedArray(fr){return isObjectLike(fr)&&isLength(fr.length)&&!!typedArrayTags[baseGetTag(fr)]}function baseUnary(fr){return function(br){return fr(br)}}var freeExports$1=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule$1=freeExports$1&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports$1=freeModule$1&&freeModule$1.exports===freeExports$1,freeProcess=moduleExports$1&&freeGlobal$1.process,nodeUtil=function(){try{var fr=freeModule$1&&freeModule$1.require&&freeModule$1.require("util").types;return fr||freeProcess&&freeProcess.binding&&freeProcess.binding("util")}catch{}}(),nodeIsTypedArray=nodeUtil&&nodeUtil.isTypedArray,isTypedArray$1=nodeIsTypedArray?baseUnary(nodeIsTypedArray):baseIsTypedArray,objectProto$5=Object.prototype,hasOwnProperty$3=objectProto$5.hasOwnProperty;function arrayLikeKeys(fr,br){var wr=isArray$1(fr),Er=!wr&&isArguments$1(fr),kr=!wr&&!Er&&isBuffer(fr),jr=!wr&&!Er&&!kr&&isTypedArray$1(fr),Br=wr||Er||kr||jr,Wr=Br?baseTimes(fr.length,String):[],qr=Wr.length;for(var Gr in fr)(br||hasOwnProperty$3.call(fr,Gr))&&!(Br&&(Gr=="length"||kr&&(Gr=="offset"||Gr=="parent")||jr&&(Gr=="buffer"||Gr=="byteLength"||Gr=="byteOffset")||isIndex(Gr,qr)))&&Wr.push(Gr);return Wr}var objectProto$4=Object.prototype;function isPrototype(fr){var br=fr&&fr.constructor,wr=typeof br=="function"&&br.prototype||objectProto$4;return fr===wr}var nativeKeys=overArg(Object.keys,Object),objectProto$3=Object.prototype,hasOwnProperty$2=objectProto$3.hasOwnProperty;function baseKeys(fr){if(!isPrototype(fr))return nativeKeys(fr);var br=[];for(var wr in Object(fr))hasOwnProperty$2.call(fr,wr)&&wr!="constructor"&&br.push(wr);return br}function isArrayLike(fr){return fr!=null&&isLength(fr.length)&&!isFunction$2(fr)}function keys$1(fr){return isArrayLike(fr)?arrayLikeKeys(fr):baseKeys(fr)}function baseAssign(fr,br){return fr&©Object(br,keys$1(br),fr)}function nativeKeysIn(fr){var br=[];if(fr!=null)for(var wr in Object(fr))br.push(wr);return br}var objectProto$2=Object.prototype,hasOwnProperty$1=objectProto$2.hasOwnProperty;function baseKeysIn(fr){if(!isObject$4(fr))return nativeKeysIn(fr);var br=isPrototype(fr),wr=[];for(var Er in fr)Er=="constructor"&&(br||!hasOwnProperty$1.call(fr,Er))||wr.push(Er);return wr}function keysIn(fr){return isArrayLike(fr)?arrayLikeKeys(fr,!0):baseKeysIn(fr)}function baseAssignIn(fr,br){return fr&©Object(br,keysIn(br),fr)}var freeExports=typeof exports=="object"&&exports&&!exports.nodeType&&exports,freeModule=freeExports&&typeof module=="object"&&module&&!module.nodeType&&module,moduleExports=freeModule&&freeModule.exports===freeExports,Buffer=moduleExports?root$1.Buffer:void 0,allocUnsafe$1=Buffer?Buffer.allocUnsafe:void 0;function cloneBuffer(fr,br){if(br)return fr.slice();var wr=fr.length,Er=allocUnsafe$1?allocUnsafe$1(wr):new fr.constructor(wr);return fr.copy(Er),Er}function copyArray(fr,br){var wr=-1,Er=fr.length;for(br||(br=Array(Er));++wr=0)&&(wr[kr]=fr[kr]);return wr}var isFunction$1=function(br){return typeof br=="function"},isObject$3=function(br){return br!==null&&typeof br=="object"},isInteger$1=function(br){return String(Math.floor(Number(br)))===br},isString=function(br){return Object.prototype.toString.call(br)==="[object String]"},isEmptyChildren=function(br){return reactExports.Children.count(br)===0},isPromise=function(br){return isObject$3(br)&&isFunction$1(br.then)};function getIn(fr,br,wr,Er){Er===void 0&&(Er=0);for(var kr=toPath(br);fr&&Er=0?[]:{}}}return(jr===0?fr:kr)[Br[jr]]===wr?fr:(wr===void 0?delete kr[Br[jr]]:kr[Br[jr]]=wr,jr===0&&wr===void 0&&delete Er[Br[jr]],Er)}function setNestedObjectValues(fr,br,wr,Er){wr===void 0&&(wr=new WeakMap),Er===void 0&&(Er={});for(var kr=0,jr=Object.keys(fr);kr0?Uo.map(function(Vo){return oo(Vo,getIn(No,Vo))}):[Promise.resolve("DO_NOT_DELETE_YOU_WILL_BE_FIRED")];return Promise.all(Nl).then(function(Vo){return Vo.reduce(function(Fo,Ol,$a){return Ol==="DO_NOT_DELETE_YOU_WILL_BE_FIRED"||Ol&&(Fo=setIn(Fo,Uo[$a],Ol)),Fo},{})})},[oo]),co=reactExports.useCallback(function(No){return Promise.all([io(No),Jr.validationSchema?_i(No):{},Jr.validate?to(No):{}]).then(function(Uo){var Nl=Uo[0],Vo=Uo[1],Fo=Uo[2],Ol=deepmerge_1.all([Nl,Vo,Fo],{arrayMerge});return Ol})},[Jr.validate,Jr.validationSchema,io,to,_i]),so=useEventCallback$1(function(No){return No===void 0&&(No=eo.values),ro({type:"SET_ISVALIDATING",payload:!0}),co(No).then(function(Uo){return In.current&&(ro({type:"SET_ISVALIDATING",payload:!1}),ro({type:"SET_ERRORS",payload:Uo})),Uo})});reactExports.useEffect(function(){Br&&In.current===!0&&isEqual(Qr.current,Jr.initialValues)&&so(Qr.current)},[Br,so]);var no=reactExports.useCallback(function(No){var Uo=No&&No.values?No.values:Qr.current,Nl=No&&No.errors?No.errors:_n.current?_n.current:Jr.initialErrors||{},Vo=No&&No.touched?No.touched:En.current?En.current:Jr.initialTouched||{},Fo=No&&No.status?No.status:Cn.current?Cn.current:Jr.initialStatus;Qr.current=Uo,_n.current=Nl,En.current=Vo,Cn.current=Fo;var Ol=function(){ro({type:"RESET_FORM",payload:{isSubmitting:!!No&&!!No.isSubmitting,errors:Nl,touched:Vo,status:Fo,values:Uo,isValidating:!!No&&!!No.isValidating,submitCount:No&&No.submitCount&&typeof No.submitCount=="number"?No.submitCount:0}})};if(Jr.onReset){var $a=Jr.onReset(eo.values,yo);isPromise($a)?$a.then(Ol):Ol()}else Ol()},[Jr.initialErrors,Jr.initialStatus,Jr.initialTouched]);reactExports.useEffect(function(){In.current===!0&&!isEqual(Qr.current,Jr.initialValues)&&(Gr&&(Qr.current=Jr.initialValues,no()),Br&&so(Qr.current))},[Gr,Jr.initialValues,no,Br,so]),reactExports.useEffect(function(){Gr&&In.current===!0&&!isEqual(_n.current,Jr.initialErrors)&&(_n.current=Jr.initialErrors||emptyErrors,ro({type:"SET_ERRORS",payload:Jr.initialErrors||emptyErrors}))},[Gr,Jr.initialErrors]),reactExports.useEffect(function(){Gr&&In.current===!0&&!isEqual(En.current,Jr.initialTouched)&&(En.current=Jr.initialTouched||emptyTouched,ro({type:"SET_TOUCHED",payload:Jr.initialTouched||emptyTouched}))},[Gr,Jr.initialTouched]),reactExports.useEffect(function(){Gr&&In.current===!0&&!isEqual(Cn.current,Jr.initialStatus)&&(Cn.current=Jr.initialStatus,ro({type:"SET_STATUS",payload:Jr.initialStatus}))},[Gr,Jr.initialStatus,Jr.initialTouched]);var Tn=useEventCallback$1(function(No){if(An.current[No]&&isFunction$1(An.current[No].validate)){var Uo=getIn(eo.values,No),Nl=An.current[No].validate(Uo);return isPromise(Nl)?(ro({type:"SET_ISVALIDATING",payload:!0}),Nl.then(function(Vo){return Vo}).then(function(Vo){ro({type:"SET_FIELD_ERROR",payload:{field:No,value:Vo}}),ro({type:"SET_ISVALIDATING",payload:!1})})):(ro({type:"SET_FIELD_ERROR",payload:{field:No,value:Nl}}),Promise.resolve(Nl))}else if(Jr.validationSchema)return ro({type:"SET_ISVALIDATING",payload:!0}),_i(eo.values,No).then(function(Vo){return Vo}).then(function(Vo){ro({type:"SET_FIELD_ERROR",payload:{field:No,value:Vo[No]}}),ro({type:"SET_ISVALIDATING",payload:!1})});return Promise.resolve()}),Hr=reactExports.useCallback(function(No,Uo){var Nl=Uo.validate;An.current[No]={validate:Nl}},[]),Xr=reactExports.useCallback(function(No){delete An.current[No]},[]),Sn=useEventCallback$1(function(No,Uo){ro({type:"SET_TOUCHED",payload:No});var Nl=Uo===void 0?kr:Uo;return Nl?so(eo.values):Promise.resolve()}),Rn=reactExports.useCallback(function(No){ro({type:"SET_ERRORS",payload:No})},[]),Pn=useEventCallback$1(function(No,Uo){var Nl=isFunction$1(No)?No(eo.values):No;ro({type:"SET_VALUES",payload:Nl});var Vo=Uo===void 0?wr:Uo;return Vo?so(Nl):Promise.resolve()}),On=reactExports.useCallback(function(No,Uo){ro({type:"SET_FIELD_ERROR",payload:{field:No,value:Uo}})},[]),Zn=useEventCallback$1(function(No,Uo,Nl){ro({type:"SET_FIELD_VALUE",payload:{field:No,value:Uo}});var Vo=Nl===void 0?wr:Nl;return Vo?so(setIn(eo.values,No,Uo)):Promise.resolve()}),Nn=reactExports.useCallback(function(No,Uo){var Nl=Uo,Vo=No,Fo;if(!isString(No)){No.persist&&No.persist();var Ol=No.target?No.target:No.currentTarget,$a=Ol.type,Jo=Ol.name,Zl=Ol.id,Cl=Ol.value,ko=Ol.checked,wo=Ol.outerHTML,bo=Ol.options,Io=Ol.multiple;Nl=Uo||Jo||Zl,Vo=/number|range/.test($a)?(Fo=parseFloat(Cl),isNaN(Fo)?"":Fo):/checkbox/.test($a)?getValueForCheckbox(getIn(eo.values,Nl),ko,Cl):bo&&Io?getSelectedValues(bo):Cl}Nl&&Zn(Nl,Vo)},[Zn,eo.values]),wn=useEventCallback$1(function(No){if(isString(No))return function(Uo){return Nn(Uo,No)};Nn(No)}),zn=useEventCallback$1(function(No,Uo,Nl){Uo===void 0&&(Uo=!0),ro({type:"SET_FIELD_TOUCHED",payload:{field:No,value:Uo}});var Vo=Nl===void 0?kr:Nl;return Vo?so(eo.values):Promise.resolve()}),fo=reactExports.useCallback(function(No,Uo){No.persist&&No.persist();var Nl=No.target,Vo=Nl.name,Fo=Nl.id,Ol=Nl.outerHTML,$a=Uo||Vo||Fo;zn($a,!0)},[zn]),vo=useEventCallback$1(function(No){if(isString(No))return function(Uo){return fo(Uo,No)};fo(No)}),go=reactExports.useCallback(function(No){isFunction$1(No)?ro({type:"SET_FORMIK_STATE",payload:No}):ro({type:"SET_FORMIK_STATE",payload:function(){return No}})},[]),uo=reactExports.useCallback(function(No){ro({type:"SET_STATUS",payload:No})},[]),lo=reactExports.useCallback(function(No){ro({type:"SET_ISSUBMITTING",payload:No})},[]),Eo=useEventCallback$1(function(){return ro({type:"SUBMIT_ATTEMPT"}),so().then(function(No){var Uo=No instanceof Error,Nl=!Uo&&Object.keys(No).length===0;if(Nl){var Vo;try{if(Vo=_o(),Vo===void 0)return}catch(Fo){throw Fo}return Promise.resolve(Vo).then(function(Fo){return In.current&&ro({type:"SUBMIT_SUCCESS"}),Fo}).catch(function(Fo){if(In.current)throw ro({type:"SUBMIT_FAILURE"}),Fo})}else if(In.current&&(ro({type:"SUBMIT_FAILURE"}),Uo))throw No})}),mo=useEventCallback$1(function(No){No&&No.preventDefault&&isFunction$1(No.preventDefault)&&No.preventDefault(),No&&No.stopPropagation&&isFunction$1(No.stopPropagation)&&No.stopPropagation(),Eo().catch(function(Uo){console.warn("Warning: An unhandled error was caught from submitForm()",Uo)})}),yo={resetForm:no,validateForm:so,validateField:Tn,setErrors:Rn,setFieldError:On,setFieldTouched:zn,setFieldValue:Zn,setStatus:uo,setSubmitting:lo,setTouched:Sn,setValues:Pn,setFormikState:go,submitForm:Eo},_o=useEventCallback$1(function(){return Vr(eo.values,yo)}),Bo=useEventCallback$1(function(No){No&&No.preventDefault&&isFunction$1(No.preventDefault)&&No.preventDefault(),No&&No.stopPropagation&&isFunction$1(No.stopPropagation)&&No.stopPropagation(),no()}),Lo=reactExports.useCallback(function(No){return{value:getIn(eo.values,No),error:getIn(eo.errors,No),touched:!!getIn(eo.touched,No),initialValue:getIn(Qr.current,No),initialTouched:!!getIn(En.current,No),initialError:getIn(_n.current,No)}},[eo.errors,eo.touched,eo.values]),Wo=reactExports.useCallback(function(No){return{setValue:function(Nl,Vo){return Zn(No,Nl,Vo)},setTouched:function(Nl,Vo){return zn(No,Nl,Vo)},setError:function(Nl){return On(No,Nl)}}},[Zn,zn,On]),na=reactExports.useCallback(function(No){var Uo=isObject$3(No),Nl=Uo?No.name:No,Vo=getIn(eo.values,Nl),Fo={name:Nl,value:Vo,onChange:wn,onBlur:vo};if(Uo){var Ol=No.type,$a=No.value,Jo=No.as,Zl=No.multiple;Ol==="checkbox"?$a===void 0?Fo.checked=!!Vo:(Fo.checked=!!(Array.isArray(Vo)&&~Vo.indexOf($a)),Fo.value=$a):Ol==="radio"?(Fo.checked=Vo===$a,Fo.value=$a):Jo==="select"&&Zl&&(Fo.value=Fo.value||[],Fo.multiple=!0)}return Fo},[vo,wn,eo.values]),qo=reactExports.useMemo(function(){return!isEqual(Qr.current,eo.values)},[Qr.current,eo.values]),ga=reactExports.useMemo(function(){return typeof Wr<"u"?qo?eo.errors&&Object.keys(eo.errors).length===0:Wr!==!1&&isFunction$1(Wr)?Wr(Jr):Wr:eo.errors&&Object.keys(eo.errors).length===0},[Wr,qo,eo.errors,Jr]),wl=_extends$1e({},eo,{initialValues:Qr.current,initialErrors:_n.current,initialTouched:En.current,initialStatus:Cn.current,handleBlur:vo,handleChange:wn,handleReset:Bo,handleSubmit:mo,resetForm:no,setErrors:Rn,setFormikState:go,setFieldTouched:zn,setFieldValue:Zn,setFieldError:On,setStatus:uo,setSubmitting:lo,setTouched:Sn,setValues:Pn,submitForm:Eo,validateForm:so,validateField:Tn,isValid:ga,dirty:qo,unregisterField:Xr,registerField:Hr,getFieldProps:na,getFieldMeta:Lo,getFieldHelpers:Wo,validateOnBlur:kr,validateOnChange:wr,validateOnMount:Br});return wl}function Formik(fr){var br=useFormik(fr),wr=fr.component,Er=fr.children,kr=fr.render,jr=fr.innerRef;return reactExports.useImperativeHandle(jr,function(){return br}),reactExports.createElement(FormikProvider,{value:br},wr?reactExports.createElement(wr,br):kr?kr(br):Er?isFunction$1(Er)?Er(br):isEmptyChildren(Er)?null:reactExports.Children.only(Er):null)}function warnAboutMissingIdentifier(fr){var br=fr.htmlContent,wr=fr.documentationAnchorLink,Er=fr.handlerName;console.warn("Warning: Formik called `"+Er+"`, but you forgot to pass an `id` or `name` attribute to your input:\n "+br+` Formik cannot determine which value to update. For more info see https://formik.org/docs/api/formik#`+wr+` `)}function yupToFormErrors(fr){var br={};if(fr.inner){if(fr.inner.length===0)return setIn(br,fr.path,fr.message);for(var kr=fr.inner,wr=Array.isArray(kr),Er=0,kr=wr?kr:kr[Symbol.iterator]();;){var jr;if(wr){if(Er>=kr.length)break;jr=kr[Er++]}else{if(Er=kr.next(),Er.done)break;jr=Er.value}var Br=jr;getIn(br,Br.path)||(br=setIn(br,Br.path,Br.message))}}return br}function validateYupSchema(fr,br,wr,Er){wr===void 0&&(wr=!1),Er===void 0&&(Er={});var kr=prepareDataForValidation(fr);return br[wr?"validateSync":"validate"](kr,{abortEarly:!1,context:Er})}function prepareDataForValidation(fr){var br=Array.isArray(fr)?[]:{};for(var wr in fr)if(Object.prototype.hasOwnProperty.call(fr,wr)){var Er=String(wr);Array.isArray(fr[Er])===!0?br[Er]=fr[Er].map(function(kr){return Array.isArray(kr)===!0||isPlainObject(kr)?prepareDataForValidation(kr):kr!==""?kr:void 0}):isPlainObject(fr[Er])?br[Er]=prepareDataForValidation(fr[Er]):br[Er]=fr[Er]!==""?fr[Er]:void 0}return br}function arrayMerge(fr,br,wr){var Er=fr.slice();return br.forEach(function(jr,Br){if(typeof Er[Br]>"u"){var Wr=wr.clone!==!1,qr=Wr&&wr.isMergeableObject(jr);Er[Br]=qr?deepmerge_1(Array.isArray(jr)?[]:{},jr,wr):jr}else wr.isMergeableObject(jr)?Er[Br]=deepmerge_1(fr[Br],jr,wr):fr.indexOf(jr)===-1&&Er.push(jr)}),Er}function getSelectedValues(fr){return Array.from(fr).filter(function(br){return br.selected}).map(function(br){return br.value})}function getValueForCheckbox(fr,br,wr){if(typeof fr=="boolean")return!!br;var Er=[],kr=!1,jr=-1;if(Array.isArray(fr))Er=fr,jr=fr.indexOf(wr),kr=jr>=0;else if(!wr||wr=="true"||wr=="false")return!!br;return br&&wr&&!kr?Er.concat(wr):kr?Er.slice(0,jr).concat(Er.slice(jr+1)):Er}var useIsomorphicLayoutEffect$3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?reactExports.useLayoutEffect:reactExports.useEffect;function useEventCallback$1(fr){var br=reactExports.useRef(fr);return useIsomorphicLayoutEffect$3(function(){br.current=fr}),reactExports.useCallback(function(){for(var wr=arguments.length,Er=new Array(wr),kr=0;kr{if(!fr.groupedWallets.length)throw new Error("Wallet group must have at least one wallet");const[br]=fr.groupedWallets;if(br.chainGroup)return"multi-chain";if(br.walletGroup)return"multi-wallet"},WalletGroupContext=t$7.createContext(void 0),useWalletGroupContext=()=>{const fr=t$7.useContext(WalletGroupContext);if(fr===void 0)throw new Error("usage of useWalletGroupContext not wrapped in `WalletGroupContextProvider`.");return fr},WalletGroupContextProvider=({children:fr})=>{const[br,wr]=t$7.useState(),{setView:Er}=useViewContext(),jr={navigateToWalletGroup:t$7.useCallback(Br=>{wr(Br);const Wr=getWalletGroupType(Br),qr={"multi-chain":"wallet-group","multi-wallet":"select-wallet-in-wallet-group"},Gr=Wr?qr[Wr]:qr["multi-chain"];Er(Gr)},[wr,Er]),selectedWalletGroup:br};return jsxRuntimeExports.jsx(WalletGroupContext.Provider,{value:jr,children:fr})},IpConfigurationContext=reactExports.createContext(void 0),IpConfigurationContextProvider=({children:fr})=>{const[br,wr]=reactExports.useState(null),Er=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){if(br)return br;try{const Br=yield fetch("http://ip-api.com/json");if(!Br.ok)return;const Wr=yield Br.json();if(Wr.status!=="success")return;const{country:qr,countryCode:Gr}=Wr,Vr={country:qr,countryCode:Gr};return wr(Vr),Vr}catch(Br){logger$7.warn("Error fetching IP configuration",Br);return}}),[br,wr]),kr=()=>{wr(null)},jr=reactExports.useMemo(()=>({getIpConfiguration:Er,removeIpConfiguration:kr}),[Er]);return jsxRuntimeExports.jsx(IpConfigurationContext.Provider,{value:jr,children:fr})},useIpConfigurationContext=()=>{const fr=reactExports.useContext(IpConfigurationContext);if(fr===void 0)throw new Error("usage of useIpConfigurationContext not wrapped in `IpConfigurationContextProvider`.");return fr},getReferencedAccount=(fr,br)=>{const wr=fr==null?void 0:fr.verifiedCredentials.find(Er=>Er.id===br);return fr==null?void 0:fr.verifiedCredentials.find(Er=>Er.id===(wr==null?void 0:wr.refId))},useInternalDynamicContext=()=>{const fr=reactExports.useContext(DynamicContext);if(fr===void 0)throw new Error("useInternalDynamicContext must be used within a DynamicContextProvider");return fr},ACTIVE_SESSION="session_active",ERROR_SENDING_CODE="error_sending_code",ERROR_PROCESSING_REVEAL_REQUEST="error_processing_reveal_request",INVALID_REQUEST$1="invalid_request",INVALID_WALLET_DATA="invalid_wallet",SECURE_ENCLAVE_PROVIDER_NOT_ENABLED="secure_enclave_provider_not_enabled",USER_NOT_LOGGED_IN="user_not_logged_in",CODE_SENT="code_sent",SESSION_CREATED="session_created",SESSION_RESTORED="session_restored",ACCESS_BLOCKED_ERROR_CODE=451,generateMessages=(fr,br,wr,Er,kr,jr)=>__awaiter$e(void 0,void 0,void 0,function*(){if(fr===void 0)throw new DynamicError("Unable to fetch the public address from the wallet");if(!br.connectedChain)throw new DynamicError("Wallet is not connected");let Br=yield br.getNetwork();Br===void 0&&(br.key==="bloctoevm"?Br=137:br.connectedChain==="EVM"&&(Br=1));const Wr=br.parseAddress(fr),qr=generateMessageToSign({blockchain:br.connectedChain,chainId:Br,domain:window.location.host,nonce:wr,publicKey:Wr,requestId:Er,resources:br.providerResources,statement:kr?jr.replace(/(\r\n|\n|\r)/gm," ").trim():void 0,uri:window.location.origin+window.location.pathname}),Gr=yield br.proveOwnership(Wr,qr);if(!Gr)throw new DynamicError("Unable to sign the message");return{messageToSign:qr,signedMessage:Gr}}),getVerifyArgs=fr=>__awaiter$e(void 0,[fr],void 0,function*({walletConnector:br,nonce:wr,walletProvider:Er,environmentId:kr,displaySiweStatement:jr,skipEmptyAccountCheck:Br,siweStatement:Wr,publicWalletAddress:qr,signedMessageOverride:Gr,messageToSignOverride:Vr}){const Zr=br.connectedChain;if(Gr&&Vr){const[Cn,In]=yield Promise.all([br.getNetwork(),br.getAdditionalAddresses(qr)]);return{additionalWalletAddresses:In,chain:Zr,messageToSign:Vr,network:String(Cn),publicWalletAddress:qr,signedMessage:Gr,skipEmptyAccountCheck:Br,walletName:br.key,walletProvider:Er}}const{messageToSign:Jr,signedMessage:Qr}=yield generateMessages(qr,br,wr,kr,jr,Wr),[_n,En]=yield Promise.all([br.getNetwork(),br.getAdditionalAddresses(qr)]);return{additionalWalletAddresses:En,chain:Zr,messageToSign:Jr,network:String(_n),publicWalletAddress:qr,signedMessage:Qr,skipEmptyAccountCheck:Br,walletName:br.key,walletProvider:Er}}),createUserProfileFromSdkUser=fr=>{var br,wr,Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En,Cn,In,An,jn,eo,ro,to;const _i={alias:(br=fr.alias)!==null&&br!==void 0?br:void 0,btcWallet:(wr=fr.btcWallet)!==null&&wr!==void 0?wr:void 0,ckbWallet:(Er=fr.ckbWallet)!==null&&Er!==void 0?Er:void 0,country:(kr=fr.country)!==null&&kr!==void 0?kr:void 0,discordNotification:(jr=fr.discordNotification)!==null&&jr!==void 0?jr:void 0,dogeWallet:(Br=fr.dogeWallet)!==null&&Br!==void 0?Br:void 0,email:(Wr=fr.email)!==null&&Wr!==void 0?Wr:void 0,emailNotification:(qr=fr.emailNotification)!==null&&qr!==void 0?qr:void 0,firstName:(Gr=fr.firstName)!==null&&Gr!==void 0?Gr:void 0,jobTitle:(Vr=fr.jobTitle)!==null&&Vr!==void 0?Vr:void 0,kasWallet:(Zr=fr.kasWallet)!==null&&Zr!==void 0?Zr:void 0,kdaWallet:(Jr=fr.kdaWallet)!==null&&Jr!==void 0?Jr:void 0,lastName:(Qr=fr.lastName)!==null&&Qr!==void 0?Qr:void 0,ltcWallet:(_n=fr.ltcWallet)!==null&&_n!==void 0?_n:void 0,newsletterNotification:(En=fr.newsletterNotification)!==null&&En!==void 0?En:void 0,phoneNumber:(Cn=fr.phoneNumber)!==null&&Cn!==void 0?Cn:void 0,policiesConsent:(In=fr.policiesConsent)!==null&&In!==void 0?In:void 0,tShirtSize:(An=fr.tShirtSize)!==null&&An!==void 0?An:void 0,team:(jn=fr.team)!==null&&jn!==void 0?jn:void 0,username:(eo=fr.username)!==null&&eo!==void 0?eo:void 0};return Object.assign({environmentId:fr.projectEnvironmentId,lastVerifiedCredentialId:(ro=fr.lastVerifiedCredentialId)!==null&&ro!==void 0?ro:void 0,lists:fr.lists,metadata:fr.metadata,mfaBackupCodeAcknowledgement:fr.mfaBackupCodeAcknowledgement,missingFields:fr.missingFields,newUser:fr.newUser,scope:fr.scope,sessionId:(to=fr.sessionId)!==null&&to!==void 0?to:"missing-sessionId",userId:fr.id,verifiedCredentials:fr.verifiedCredentials||[]},_i)},storeAuthToken=(fr,br)=>{StorageService.setItem(AUTH_TOKEN,fr,{priority:["secureStorage","localStorage"]}),StorageService.setItem(AUTH_MIN_TOKEN$1,br,{priority:["secureStorage","localStorage"]})},storeExpiresAt=fr=>{StorageService.setItem(AUTH_EXPIRES_AT,fr)},storeAuthTokenAndUser=({user:fr,jwt:br,minifiedJwt:wr,expiresAt:Er})=>{if(storeExpiresAt(Er),br&&wr&&(storeAuthToken(br,wr),isCookieEnabled$1())){const jr=new Date(Er*1e3).toUTCString(),Br=`${DYNAMIC_AUTH_COOKIE_NAME}=${wr}; expires=${jr}; path=/; SameSite=Lax`;document.cookie=Br}const kr=createUserProfileFromSdkUser(fr);return setUser(kr),kr},storeSelectedWallet=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,walletId:wr}){try{const Er=yield sdkApi$1().selectUserWallet({environmentId:br,userWalletSelectionRequest:{walletId:wr}});return storeAuthTokenAndUser(Er)}catch(Er){logger$6.error("error storing selected wallet",Er);return}}),linkWallet=(fr,br)=>__awaiter$e(void 0,[fr,br],void 0,function*(wr,{messageToSign:Er,network:kr,signedMessage:jr,publicWalletAddress:Br,chain:Wr,walletName:qr,walletProvider:Gr,additionalWalletAddresses:Vr,backup:Zr,password:Jr,passwordSource:Qr}){const _n=VerifyRequestFromJSON({additionalWalletAddresses:Vr,backup:Zr,chain:Wr,messageToSign:Er,network:kr,password:Jr,passwordSource:Qr,publicWalletAddress:Br,signedMessage:jr,walletName:qr,walletProvider:Gr});try{const En=yield sdkApi$1().verifyLink({environmentId:wr,verifyRequest:_n});return storeAuthTokenAndUser(En),En}catch(En){logger$6.error(En);const Cn=yield En.json();throw Cn.code==="reassign_wallet_confirm"||Cn.code==="reassign_wallet_error"?new WalletUsedError(Cn.code):Cn.code==="merge_accounts_confirmation"?new MergeAccountsConfirmationError({code:Cn.code,mergeConflicts:Cn.payload.mergeConflicts,walletAddress:Br}):Cn.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(Cn.error.message):new DynamicError(Cn.error)}}),unlinkWallet=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,primaryWalletId:wr,walletId:Er,onSuccess:kr}){try{const jr=yield sdkApi$1().verifyUnlink({environmentId:br,verifyUnlinkRequest:{primaryWalletId:wr,walletId:Er}});return kr==null||kr(),storeAuthTokenAndUser(jr)}catch{return}}),transferWallet=(fr,br)=>__awaiter$e(void 0,[fr,br],void 0,function*(wr,{network:Er,messageToSign:kr,signedMessage:jr,publicWalletAddress:Br,chain:Wr,walletName:qr,walletProvider:Gr,skipEmptyAccountCheck:Vr=!1}){const Zr={chain:Wr,messageToSign:kr,network:Er,publicWalletAddress:Br,signedMessage:jr,skipEmptyAccountCheck:Vr,walletName:qr,walletProvider:Gr};try{const Jr=yield sdkApi$1().verifyTransfer({environmentId:wr,verifyRequest:Zr});return storeAuthTokenAndUser(Jr)}catch(Jr){logger$6.error("error transferring wallet",Jr);return}}),verifyWallet=(fr,br)=>__awaiter$e(void 0,[fr,br],void 0,function*(wr,{messageToSign:Er,signedMessage:kr,publicWalletAddress:jr,chain:Br,walletName:Wr,walletProvider:qr,captchaToken:Gr,network:Vr,oauth:Zr,additionalWalletAddresses:Jr,sessionPublicKey:Qr}){const _n=VerifyRequestFromJSON({additionalWalletAddresses:Jr,captchaToken:Gr,chain:Br,messageToSign:Er,network:Vr,oauth:Zr,publicWalletAddress:jr,sessionPublicKey:Qr,signedMessage:kr,walletName:Wr,walletProvider:qr});try{return yield sdkApi$1().verify({environmentId:wr,verifyRequest:_n})}catch(En){logger$6.error(En);const Cn=yield En.json();if(Cn.code==="wallet_not_deployed")throw new WalletNotDeployedError;if(Cn.error.code==="chainalysis_blocked_wallet")throw new ChainalysisError(Cn.payload.walletPublicKey);if(Cn.error.code==="gate_blocked")throw new GateBlockedError(Cn.payload.walletPublicKey);if(Cn.error.code==="missing_from_list")throw new NoAccessError({walletPublicKey:Cn.payload.walletPublicKey});if(Cn.code==="email_associated_with_different_provider")throw new AccountExistsError(Cn.error,Cn.payload);if(Cn.error.code==="sandbox_maximum_threshold_reached")throw new SandboxMaximumThresholdReachedError(Cn.error.message);return}}),getSiweStatement=({appName:fr,siweStatement:br})=>{const wr=`Welcome to ${fr}. Signing is the only way we can truly know that you are the owner of the wallet you are connecting. Signing is a safe, gas-less transaction that does not in any way give ${fr} permission to perform any transactions with your wallet.`;return br||wr},getWalletProvider=fr=>fr.isEmbeddedWallet?"embeddedWallet":fr.canConnectViaCustodialService?"custodialService":fr.isInstalledOnBrowser()?"browserExtension":isMobile()?"deepLink":"qrCode",findEmbeddedWalletFromVerifiedCredentials=(fr,br)=>{var wr;const Er=(wr=fr==null?void 0:fr.verifiedCredentials)===null||wr===void 0?void 0:wr.filter(({walletProvider:kr})=>kr===WalletProviderEnum.EmbeddedWallet);return Er!=null&&Er.length&&(br!=null&&br.length)?Er.find(({chain:kr})=>kr&&br.includes(VerifiedCredentialNameToChainEnum[kr])):Er==null?void 0:Er.shift()},isProviderEnabled=(fr,br)=>fr.some(wr=>{const Er=wr.provider===br&&!!wr.enabledAt;return wr.provider===ProviderEnum.MagicLink?Er&&!!wr.providerProjectId:Er}),isTurnkeyEnabled=fr=>{var br;return isProviderEnabled((br=fr==null?void 0:fr.providers)!==null&&br!==void 0?br:[],ProviderEnum.Turnkey)},isCoinbaseWaasEnabled=fr=>{var br;return isProviderEnabled((br=fr==null?void 0:fr.providers)!==null&&br!==void 0?br:[],ProviderEnum.CoinbaseWaas)},hasEmbeddedWallet=(fr,br)=>{var wr;return!!(fr&&(!((wr=fr.verifiedCredentials)===null||wr===void 0)&&wr.some(({walletProvider:Er,walletName:kr})=>Er===WalletProviderEnum.EmbeddedWallet&&(!br||(kr==null?void 0:kr.startsWith(br))))))},findPrimaryEmbeddedChain=fr=>{var br,wr,Er;return((Er=(((wr=(br=fr==null?void 0:fr.sdk)===null||br===void 0?void 0:br.embeddedWallets)===null||wr===void 0?void 0:wr.chainConfigurations)||[]).find(jr=>jr.primary))===null||Er===void 0?void 0:Er.name)==="SOL"?ChainEnum.Sol:ChainEnum.Evm},getUserVerifiedCredentialType=(fr,br)=>{var wr,Er,kr;if(!fr)return;if(br)return(Er=(wr=fr.verifiedCredentials)===null||wr===void 0?void 0:wr.find(Br=>Br.format===br))===null||Er===void 0?void 0:Er.format;const jr=(kr=fr.verifiedCredentials)===null||kr===void 0?void 0:kr.find(Br=>Br.id===fr.lastVerifiedCredentialId);return jr==null?void 0:jr.format},findWalletOptionFor=(fr,br)=>{var wr;const Er=fr.walletName;if(Er==="turnkeyhd"){const kr=fr.chain?VerifiedCredentialNameToChainEnum[fr.chain]:void 0;return br.find(jr=>Er===jr.key&&jr.walletConnector.connectedChain===kr)}return(wr=br.find(kr=>Er===kr.key))!==null&&wr!==void 0?wr:br.find(kr=>kr.key==="fallbackconnector")},chainIconMap={algorand:AlgorandIcon,bitcoin:BitcoinIcon,cosmos:CosmosIcon,evm:EthereumIcon,flow:FlowIcon,solana:SolanaIcon,starknet:StarknetIcon},getChainIcon=fr=>{var br,wr,Er;const kr=(wr=(br=getChainInfo(fr))===null||br===void 0?void 0:br.name)!==null&&wr!==void 0?wr:"";return(Er=chainIconMap[kr])!==null&&Er!==void 0?Er:SvgError},getEnabledKYC=fr=>{var br;return(br=fr==null?void 0:fr.filter(({enabled:wr})=>!!wr))!==null&&br!==void 0?br:[]},filterFields=["social"],mapUserFieldsToKycSettings=(fr,br)=>Object.entries(fr).reduce((Er,[kr,jr])=>{if(jr){const Br=br.find(Wr=>Wr.name===kr);Br&&!Br.enabled&&Er.push(Object.assign({},Br))}return Er},[]),getEditableUserProfileFields=fr=>getEnabledKYC(fr).filter(({name:br,type:wr})=>wr===KycFieldType.Custom||!filterFields.includes(br)),getNonEditableUserProfileFields=({projectSettingsKyc:fr=[],user:br})=>br?mapUserFieldsToKycSettings(br,fr).filter(({name:Er})=>!filterFields.includes(Er)):[],getUserProfileFields=({projectSettingsKyc:fr=[],customFields:br=[],user:wr})=>{var Er;const kr=getEditableUserProfileFields([...fr,...br]),jr=getNonEditableUserProfileFields({projectSettingsKyc:fr,user:wr});let Br=[...kr,...jr];const Wr=(Er=wr==null?void 0:wr.verifiedCredentials)===null||Er===void 0?void 0:Er.find(({walletProvider:Vr})=>Vr===WalletProviderEnum.EmbeddedWallet),qr=!!(wr!=null&&wr.email),Gr=!!(wr!=null&&wr.phoneNumber);return Wr&&(Br=Br.map(Vr=>Vr.name==="email"&&qr||Vr.name==="phoneNumber"&&Gr?Object.assign(Object.assign({},Vr),{enabled:!1}):Vr)),Br.sort((Vr,Zr)=>{const Jr=fr.findIndex(_n=>_n.name===Vr.name),Qr=fr.findIndex(_n=>_n.name===Zr.name);return Jr-Qr})},isSocialKycEnabled=fr=>{var br;return!!(!((br=fr==null?void 0:fr.kyc.find(({name:wr})=>wr==="social"))===null||br===void 0)&&br.enabled)};function _assertThisInitialized(fr){if(fr===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return fr}function generateQuery(fr){return Object.entries(fr).filter(function(br){br[0];var wr=br[1];return wr||wr===!1}).map(function(br){var wr=br[0],Er=br[1];return encodeURIComponent(wr)+"="+encodeURIComponent(Er)}).join("&")}var SCRIPT_ID="hcaptcha-api-script-id",HCAPTCHA_LOAD_FN_NAME="hcaptchaOnLoad",resolveFn,rejectFn,mountPromise=new Promise(function(fr,br){resolveFn=fr,rejectFn=br}),mountCaptchaScript=function(br){if(br===void 0&&(br={}),document.getElementById(SCRIPT_ID))return mountPromise;window[HCAPTCHA_LOAD_FN_NAME]=resolveFn;var wr=br.apihost||"https://js.hcaptcha.com";delete br.apihost;var Er=document.createElement("script");Er.id=SCRIPT_ID,Er.src=wr+"/1/api.js?render=explicit&onload="+HCAPTCHA_LOAD_FN_NAME,Er.async=!0,Er.onerror=function(jr){return rejectFn("script-error")};var kr=generateQuery(br);return Er.src+=kr!==""?"&"+kr:"",document.head.appendChild(Er),mountPromise},HCaptcha=function(fr){_inheritsLoose(br,fr);function br(Er){var kr;kr=fr.call(this,Er)||this,kr.renderCaptcha=kr.renderCaptcha.bind(_assertThisInitialized(kr)),kr.resetCaptcha=kr.resetCaptcha.bind(_assertThisInitialized(kr)),kr.removeCaptcha=kr.removeCaptcha.bind(_assertThisInitialized(kr)),kr.isReady=kr.isReady.bind(_assertThisInitialized(kr)),kr.loadCaptcha=kr.loadCaptcha.bind(_assertThisInitialized(kr)),kr.handleOnLoad=kr.handleOnLoad.bind(_assertThisInitialized(kr)),kr.handleSubmit=kr.handleSubmit.bind(_assertThisInitialized(kr)),kr.handleExpire=kr.handleExpire.bind(_assertThisInitialized(kr)),kr.handleError=kr.handleError.bind(_assertThisInitialized(kr)),kr.handleOpen=kr.handleOpen.bind(_assertThisInitialized(kr)),kr.handleClose=kr.handleClose.bind(_assertThisInitialized(kr)),kr.handleChallengeExpired=kr.handleChallengeExpired.bind(_assertThisInitialized(kr));var jr=typeof hcaptcha<"u";return kr.ref=reactExports.createRef(),kr.apiScriptRequested=!1,kr.state={isApiReady:jr,isRemoved:!1,elementId:Er.id,captchaId:""},kr}var wr=br.prototype;return wr.componentDidMount=function(){var kr=this.state.isApiReady;if(kr){this.renderCaptcha();return}this.loadCaptcha()},wr.componentWillUnmount=function(){var kr=this.state.captchaId;this.isReady()&&(hcaptcha.reset(kr),hcaptcha.remove(kr))},wr.shouldComponentUpdate=function(kr,jr){return!(this.state.isApiReady!==jr.isApiReady||this.state.isRemoved!==jr.isRemoved)},wr.componentDidUpdate=function(kr){var jr=this,Br=["sitekey","size","theme","tabindex","languageOverride","endpoint"],Wr=Br.every(function(qr){return kr[qr]===jr.props[qr]});Wr||this.removeCaptcha(function(){jr.renderCaptcha()})},wr.loadCaptcha=function(){if(!this.apiScriptRequested){var kr=this.props,jr=kr.apihost,Br=kr.assethost,Wr=kr.endpoint,qr=kr.host,Gr=kr.imghost,Vr=kr.languageOverride,Zr=kr.reCaptchaCompat,Jr=kr.reportapi,Qr=kr.sentry,_n=kr.custom,En={apihost:jr,assethost:Br,endpoint:Wr,hl:Vr,host:qr,imghost:Gr,recaptchacompat:Zr===!1?"off":null,reportapi:Jr,sentry:Qr,custom:_n};mountCaptchaScript(En).then(this.handleOnLoad).catch(this.handleError),this.apiScriptRequested=!0}},wr.renderCaptcha=function(kr){var jr=this.state.isApiReady;if(jr){var Br=Object.assign({"open-callback":this.handleOpen,"close-callback":this.handleClose,"error-callback":this.handleError,"chalexpired-callback":this.handleChallengeExpired,"expired-callback":this.handleExpire,callback:this.handleSubmit},this.props,{hl:this.props.hl||this.props.languageOverride,languageOverride:void 0}),Wr=hcaptcha.render(this.ref.current,Br);this.setState({isRemoved:!1,captchaId:Wr},function(){kr&&kr()})}},wr.resetCaptcha=function(){var kr=this.state.captchaId;this.isReady()&&hcaptcha.reset(kr)},wr.removeCaptcha=function(kr){var jr=this.state.captchaId;this.isReady()&&this.setState({isRemoved:!0},function(){hcaptcha.remove(jr),kr&&kr()})},wr.handleOnLoad=function(){var kr=this;this.setState({isApiReady:!0},function(){kr.renderCaptcha(function(){var jr=kr.props.onLoad;jr&&jr()})})},wr.handleSubmit=function(kr){var jr=this.props.onVerify,Br=this.state,Wr=Br.isRemoved,qr=Br.captchaId;if(!(typeof hcaptcha>"u"||Wr)){var Gr=hcaptcha.getResponse(qr),Vr=hcaptcha.getRespKey(qr);jr(Gr,Vr)}},wr.handleExpire=function(){var kr=this.props.onExpire,jr=this.state.captchaId;this.isReady()&&(hcaptcha.reset(jr),kr&&kr())},wr.handleError=function(kr){var jr=this.props.onError,Br=this.state.captchaId;this.isReady()&&hcaptcha.reset(Br),jr&&jr(kr)},wr.isReady=function(){var kr=this.state,jr=kr.isApiReady,Br=kr.isRemoved;return jr&&!Br},wr.handleOpen=function(){!this.isReady()||!this.props.onOpen||this.props.onOpen()},wr.handleClose=function(){!this.isReady()||!this.props.onClose||this.props.onClose()},wr.handleChallengeExpired=function(){!this.isReady()||!this.props.onChalExpired||this.props.onChalExpired()},wr.execute=function(kr){kr===void 0&&(kr=null);var jr=this.state.captchaId;if(this.isReady())return kr&&typeof kr!="object"&&(kr=null),hcaptcha.execute(jr,kr)},wr.setData=function(kr){var jr=this.state.captchaId;this.isReady()&&(kr&&typeof kr!="object"&&(kr=null),hcaptcha.setData(jr,kr))},wr.getResponse=function(){return hcaptcha.getResponse(this.state.captchaId)},wr.getRespKey=function(){return hcaptcha.getRespKey(this.state.captchaId)},wr.render=function(){var kr=this.state.elementId;return reactExports.createElement("div",{ref:this.ref,id:kr})},br}(reactExports.Component);const createTurnkeyEmbeddedWallet=fr=>__awaiter$e(void 0,[fr],void 0,function*({attestation:br,challenge:wr,environmentId:Er,chains:kr=[EmbeddedWalletChainEnum.Evm],passkeyAlias:jr}){const Br=[{chains:kr,embeddedWalletProvider:EmbeddedWalletProviderEnum.Turnkeyhd,isAuthenticatorAttached:!1,passkeyAlias:jr}];br&&wr&&(Br[0]=Object.assign(Object.assign({},Br[0]),{embeddedWalletSpecificOpts:{attestation:br,challenge:wr},isAuthenticatorAttached:!0}));try{const Wr=yield sdkApi$1().createEmbeddedWallets({createEmbeddedWalletsRequest:{embeddedWallets:Br},environmentId:Er});return storeAuthTokenAndUser(Wr)}catch(Wr){logger$6.error("Error creating embedded wallet: ",Wr);return}}),initEmbeddedWalletSession$1=fr=>__awaiter$e(void 0,[fr],void 0,function*({authenticatorType:br,walletId:wr,publicKey:Er,environmentId:kr}){return br==="passkey"?sdkApi$1().initPasskeyRecovery({environmentId:kr,initPasskeyRecoveryRequest:{turnkeyRecoveryTargetPublicKey:Er,walletId:wr}}):sdkApi$1().initEmailAuth({environmentId:kr,initEmailAuthRequest:{turnkeyEmailAuthTargetPublicKey:Er,walletId:wr}})}),completePasskeyRecovery$1=fr=>__awaiter$e(void 0,[fr],void 0,function*({walletId:br,attestation:wr,challenge:Er,environmentId:kr}){try{const jr=yield sdkApi$1().completePasskeyRecovery({completePasskeyRecoveryRequest:{attestation:wr,challenge:Er,walletId:br},environmentId:kr});return storeAuthTokenAndUser(jr)}catch(jr){logger$6.error("Error completing passkey recovery: ",jr);return}}),updatePasskeyRecoveryEmail=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,updateRecoveryEmailRequest:wr}){try{yield sdkApi$1().updateEmbeddedWalletRecoveryEmail({environmentId:br,updateRecoveryEmailRequest:wr})}catch(Er){throw logger$6.error("Error while trying to update recovery email: ",Er),new DynamicError("Error updating recovery email")}}),getUserPasskeys=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br}){try{return yield sdkApi$1().getUserPasskeys({environmentId:br})}catch(wr){return logger$6.error(wr),{count:0,passkeys:[]}}}),updateUserPasskey=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,id:wr,alias:Er}){try{return yield sdkApi$1().updatePasskey({environmentId:br,updateUserPasskeyRequest:{alias:Er,id:wr}})}catch(kr){logger$6.error(kr);return}}),exportEmbeddedWallet=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,walletId:wr,activityId:Er}){try{return yield sdkApi$1().embeddedWalletExport({activityId:Er,environmentId:br,walletId:wr})}catch(kr){return logger$6.error(kr),{exportBundle:""}}}),getWalletAuthToken=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,type:wr}){try{return(yield sdkApi$1().getAuthToken({environmentId:br,type:wr})).token}catch{return}}),getEmbeddedWalletBackup=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br}){try{return(yield sdkApi$1().getEmbeddedWalletBackups({environmentId:br})).secret}catch{return}}),getEmbeddedWalletPasscode=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br}){try{return(yield sdkApi$1().getEmbeddedWalletPasscode({environmentId:br})).secret}catch{return}}),claimEmbeddedWallet=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,walletId:wr}){var Er,kr;try{const jr=yield sdkApi$1().claimEmbeddedWallet({embeddedWalletPasscodeClaimRequest:{walletId:wr},environmentId:br});return storeAuthTokenAndUser(jr),jr}catch(jr){logger$6.error(jr);const Br=yield(Er=jr==null?void 0:jr.json)===null||Er===void 0?void 0:Er.call(jr);if(!(!((kr=Br==null?void 0:Br.error)===null||kr===void 0)&&kr.code))return{code:"unknown_error"};throw jr}}),registerSessionKey=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,publicKey:wr}){try{return yield sdkApi$1().registerSessionKey({environmentId:br,registerSessionKeyRequest:{publicKey:wr}}),wr}catch(Er){logger$6.error("Error registering session key",Er);return}}),getCreateEmbeddedWalletAccountRequest=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,chain:wr}){try{return yield sdkApi$1().getCreateWalletAccountRequest({chain:wr,environmentId:br})}catch(Er){throw logger$6.error("Error fetching create embedded wallet account request: ",Er),new DynamicError("Error fetching create embedded wallet account request")}}),createEmbeddedWalletAccount=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,createEmbeddedWalletAccountRequest:wr}){try{return yield sdkApi$1().createWalletAccount({createWalletAccountRequest:{turnkeySignedRequest:wr},environmentId:br})}catch(Er){throw logger$6.error("Error creating embedded wallet account: ",Er),new DynamicError("Error creating embedded wallet account")}}),createPartialStoreSetter=({get:fr,set:br})=>(wr,Er)=>br(Object.assign(Object.assign({},fr()),{[wr]:Er})),{getSendBalanceState,setSendBalanceState,useSendBalanceState,resetSendBalanceState}=createStoreState("sendBalanceState"),setSendBalanceVariable=createPartialStoreSetter({get:getSendBalanceState,set:setSendBalanceState});function base$8(fr){if(fr.length>=255)throw new TypeError("Alphabet too long");for(var br=new Uint8Array(256),wr=0;wr>>0,jn=new Uint8Array(An);Cn!==In;){for(var eo=Qr[Cn],ro=0,to=An-1;(eo!==0||ro>>0,jn[to]=eo%Br>>>0,eo=eo/Br>>>0;if(eo!==0)throw new Error("Non-zero carry");En=ro,Cn++}for(var _i=An-En;_i!==An&&jn[_i]===0;)_i++;for(var oo=Wr.repeat(_n);_i>>0,An=new Uint8Array(In);Qr[_n];){var jn=br[Qr.charCodeAt(_n)];if(jn===255)return;for(var eo=0,ro=In-1;(jn!==0||eo>>0,An[ro]=jn%256>>>0,jn=jn/256>>>0;if(jn!==0)throw new Error("Non-zero carry");Cn=eo,_n++}for(var to=In-Cn;to!==In&&An[to]===0;)to++;for(var _i=new Uint8Array(En+(In-to)),oo=En;to!==In;)_i[oo++]=An[to++];return _i}function Jr(Qr){var _n=Zr(Qr);if(_n)return _n;throw new Error("Non-base"+Br+" character")}return{encode:Vr,decodeUnsafe:Zr,decode:Jr}}var src$6=base$8;const basex$4=src$6,ALPHABET$4="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var bs58$7=basex$4(ALPHABET$4);const bs58$8=getDefaultExportFromCjs$2(bs58$7),useEffectOnce=fr=>{reactExports.useEffect(fr,[])},useIsomorphicLayoutEffect$2=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,useInterval=(fr,br)=>{const wr=reactExports.useRef(fr);useIsomorphicLayoutEffect$2(()=>{wr.current=fr},[fr]),reactExports.useEffect(()=>{if(!br&&br!==0)return;const Er=setInterval(()=>wr.current(),br);return()=>clearInterval(Er)},[br])},useMutation=(fr,br={})=>{const[wr,Er]=reactExports.useState({isLoading:!1}),kr=reactExports.useCallback(jr=>__awaiter$e(void 0,void 0,void 0,function*(){var Br,Wr;let qr;Er({isLoading:!0});try{const Gr=fr(jr);Gr instanceof Promise?qr=yield Gr:qr=Gr,Er({data:qr,isLoading:!1});try{(Br=br==null?void 0:br.onSuccess)===null||Br===void 0||Br.call(br,qr,jr)}catch(Vr){logger$7.error(Vr)}return qr}catch(Gr){Er({error:Gr,isLoading:!1}),logger$7.error(Gr);try{(Wr=br==null?void 0:br.onFailure)===null||Wr===void 0||Wr.call(br,Gr,jr)}catch(Vr){logger$7.error(Vr)}}}),[fr,br]);return Object.assign(Object.assign({},wr),{hasData:!!wr.data,hasError:!!wr.error,mutate:kr})},Badge=({className:fr="",dot:br,text:wr,copykey:Er,variant:kr="secondary"})=>jsxRuntimeExports.jsxs("div",{className:classNames$1("badge__container",`badge__container__${kr}`,fr),children:[br&&jsxRuntimeExports.jsx("span",{"data-testid":"badge__dot",className:"badge__dot"}),jsxRuntimeExports.jsx("span",{copykey:Er,children:wr})]}),{getTokenBalancesState,setTokenBalancesState,useTokenBalancesState}=createStoreState("tokenBalancesState"),setTokenBalanceVariable=createPartialStoreSetter({get:getTokenBalancesState,set:setTokenBalancesState}),DotsMenuDropdown=({options:fr,setShowMenu:br})=>jsxRuntimeExports.jsx("div",{className:"dots-menu-dropdown__container",style:{zIndex:tooltipZIndex},children:fr.map(wr=>wr.hide?null:jsxRuntimeExports.jsxs("div",{className:"dots-menu-dropdown__item",onClick:()=>{wr.callback(),br(!1)},children:[wr.Icon&&jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",children:wr.Icon}),jsxRuntimeExports.jsxs(Typography,{className:"dots-menu-dropdown__item-text",color:wr.fontColor?wr.fontColor:"secondary",weight:wr.fontWeight,children:[wr.text," ",wr.badge?jsxRuntimeExports.jsx(Badge,{text:wr.badge}):null]}),wr.endSlot&&jsxRuntimeExports.jsx("div",{className:"dots-menu-dropdown__item__end-slot",children:wr.endSlot})]},wr.text))});var _path$11,_excluded$1d=["title","titleId"];function _extends$1d(){return _extends$1d=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$1d(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgThreeDots=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$1d(br,_excluded$1d);return reactExports.createElement("svg",_extends$1d({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$11||(_path$11=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 2a1.333 1.333 0 1 1 0 2.667A1.333 1.333 0 0 1 8 2Zm0 4.667a1.333 1.333 0 1 1 0 2.666 1.333 1.333 0 0 1 0-2.666Zm0 4.666A1.333 1.333 0 1 1 8 14a1.333 1.333 0 0 1 0-2.667Z",fill:"currentColor"})))};const DotsMenu=({options:fr,buttonClassName:br,buttonClassNameWithOpenMenu:wr,direction:Er="right",iconOverride:kr})=>{const jr=reactExports.useRef(null),Br=reactExports.useRef(null),[Wr,qr]=reactExports.useState(!1);return useOnClickOutside(Br,()=>qr(!1)),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(IconButton,{ref:jr,onClick:()=>qr(!0),"data-testid":"dotsMenu",className:Wr?wr:br,children:kr||jsxRuntimeExports.jsx(Icon,{children:jsxRuntimeExports.jsx(SvgThreeDots,{})})}),jsxRuntimeExports.jsx(Dropdown$1,{isOpen:Wr,onClickOutside:()=>qr(!1),onScroll:()=>qr(!1),anchorRef:jr,ref:Br,anchorOrigin:Er==="right"?"bottom-left":"top-right",transformOrigin:Er==="right"?"top-left":"bottom-right",children:jsxRuntimeExports.jsx(DotsMenuDropdown,{options:fr,setShowMenu:qr})})]})},DEFAULT_BREAKPOINT=12,DEFAULT_CUT_END=4,DEFAULT_CUT_START=4,shortenString=(fr,br,wr)=>fr.replace(fr.substring(br,wr),"..."),shortenEmail=(fr,br)=>{if(!fr)return"";const wr=(br==null?void 0:br.breakpoint)||DEFAULT_BREAKPOINT,Er=(br==null?void 0:br.cutStart)||DEFAULT_CUT_START,kr=(br==null?void 0:br.cutEnd)||DEFAULT_CUT_END;let[jr,Br]=fr.split("@");return(jr==null?void 0:jr.length)>wr&&(jr=shortenString(jr,Er,jr.length-kr)),(Br==null?void 0:Br.length)>wr&&(Br=shortenString(Br,Er,Br.length-kr)),`${jr}@${Br}`},detectBrowserName=fr=>{const br=navigator.userAgent;if(br.match(/brave/i))return"brave";if(br.match(/edg/i))return"edge";if(br.match(/chrome|chromium|crios/i))return"chrome";if(br.match(/firefox|fxios/i))return"firefox";if(br.match(/safari/i))return"safari"};jsxRuntimeExports.jsx(AndroidIcon,{}),jsxRuntimeExports.jsx(BraveIcon,{}),jsxRuntimeExports.jsx(ChromeIcon,{}),jsxRuntimeExports.jsx(EdgeIcon,{}),jsxRuntimeExports.jsx(FirefoxIcon,{}),jsxRuntimeExports.jsx(AppleIcon,{}),jsxRuntimeExports.jsx(OperaIcon,{}),jsxRuntimeExports.jsx(SafariIcon,{});const useFetchCurrency=(fr,br)=>{const wr=()=>__awaiter$e(void 0,void 0,void 0,function*(){var jr,Br,Wr,qr;if(!fr)return null;const Gr=yield fr.getNetwork(),Vr=getChainInfoWithOverrides((jr=fr.connectedChain)!==null&&jr!==void 0?jr:"");if(!Gr)return Vr==null?void 0:Vr.symbol;const Zr=fr.connectedChain==="STARK"?"starknetNetworks":"evmNetworks",Jr=(Br=fr[Zr])===null||Br===void 0?void 0:Br.find(Qr=>Qr.chainId===Gr);return(qr=(Wr=Jr==null?void 0:Jr.nativeCurrency)===null||Wr===void 0?void 0:Wr.symbol)!==null&&qr!==void 0?qr:Vr==null?void 0:Vr.symbol}),{data:Er,isLoading:kr}=usePromise(wr,{deps:[br]});return{currency:Er,isLoading:kr}};var _path$10,_excluded$1c=["title","titleId"];function _extends$1c(){return _extends$1c=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$1c(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgArrowLeft=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$1c(br,_excluded$1c);return reactExports.createElement("svg",_extends$1c({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$10||(_path$10=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.707 4.293a1 1 0 0 1 0 1.414L5.414 11H21a1 1 0 1 1 0 2H5.414l5.293 5.293a1 1 0 0 1-1.414 1.414l-7-7a1 1 0 0 1 0-1.414l7-7a1 1 0 0 1 1.414 0Z",fill:"currentColor"})))},_path$$,_excluded$1b=["title","titleId"];function _extends$1b(){return _extends$1b=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$1b(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgClose=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$1b(br,_excluded$1b);return reactExports.createElement("svg",_extends$1b({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$$||(_path$$=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.41 4.41a.833.833 0 0 1 1.18 0L10 8.822l4.41-4.41a.833.833 0 1 1 1.18 1.178L11.178 10l4.41 4.41a.833.833 0 1 1-1.178 1.18L10 11.177 5.588 15.59a.833.833 0 1 1-1.178-1.178L8.82 10l-4.41-4.41a.833.833 0 0 1 0-1.18Z",fill:"currentcolor"})))},_g$d,_excluded$1a=["title","titleId"];function _extends$1a(){return _extends$1a=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$1a(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgSend=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$1a(br,_excluded$1a);return reactExports.createElement("svg",_extends$1a({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_g$d||(_g$d=reactExports.createElement("g",{clipPath:"url(#send_svg__clip0_6894_96)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m3.846 9.3.03-.01 14.64-5.728c.199-.078.399-.156.567-.205.156-.046.465-.126.794-.02.374.123.664.413.786.787.107.33.027.638-.019.794-.049.168-.127.368-.205.567L14.702 20.15c-.08.204-.16.408-.239.568-.073.147-.226.436-.537.614a1.277 1.277 0 0 1-1.136.072c-.323-.137-.496-.405-.58-.542-.09-.149-.184-.342-.278-.535l-2.693-5.52-5.546-2.724-.027-.014c-.193-.094-.385-.189-.533-.28-.137-.082-.403-.256-.54-.578a1.277 1.277 0 0 1 .074-1.136c.178-.31.466-.463.612-.536.16-.079.363-.158.567-.238Zm.972 1.425 4.88 2.396 2.912-2.913a.848.848 0 0 1 1.2-.017.848.848 0 0 1-.017 1.2l-2.898 2.898 2.384 4.888 5.433-13.888-13.894 5.436Z",fill:"currentColor",fillOpacity:.4}))))};const usingSessionKey=fr=>isSessionKeyCompatibleWalletConnector(fr)||isAccountAbstractionConnector(fr)&&isSessionKeyCompatibleWalletConnector(fr.getEOAConnector()),getGasFiatValue=(fr,br,wr)=>{if(!(fr!=null&&fr.price)||!br.fee.gas)return;let Er=fr.price;return wr&&(Er=wr),(Number(br.format(br.fee.gas))*Er).toFixed(2)},getTotalFiatCost=(fr,br,wr,Er)=>{const kr=getGasFiatValue(fr,br,wr);return!kr||!(fr!=null&&fr.price)?void 0:(Number(kr)+Number(Er)*fr.price).toFixed(2)},getEnabledEmbeddedWalletsAuthenticators=fr=>{if(!fr||!Object.keys(fr).length)return{};const br={};return Object.keys(fr).filter(wr=>{var Er;return(Er=fr[wr])===null||Er===void 0?void 0:Er.isEnabled}).forEach(wr=>br[wr]=fr[wr]),br},updateUserProfileFields=(fr,br)=>__awaiter$e(void 0,void 0,void 0,function*(){try{const wr=yield sdkApi$1().updateSelf({environmentId:fr,userFields:br}),Er=yield storeAuthTokenAndUser(wr);return Object.assign(Object.assign({},wr),{userProfile:Er})}catch(wr){if(logger$6.error(wr),wr instanceof Response){const Er=yield wr.json();if(Er.code==="email_already_exists")throw new EmailAlreadyExistsError;if(Er.code==="custom_field_data_not_unique")throw new CustomFieldNotUniqueError;if(Er.code==="username_already_exists")throw new UsernameAlreadyExistsError;if(Er.code==="too_many_verification_attempts")throw new TooManyEmailVerificationsError;if(Er.code==="invalid_phone"||Er.code==="invalid_sms_verification")throw new InvalidPhoneNumberError(Er.error)}throw wr}}),mergeUserAccounts=fr=>__awaiter$e(void 0,void 0,void 0,function*(){try{const br=yield sdkApi$1().mergeUsers({environmentId:fr});return storeAuthTokenAndUser(br)}catch(br){throw logger$6.error(br),br}}),verifyMergeUsers=(fr,br)=>__awaiter$e(void 0,void 0,void 0,function*(){try{const wr=yield sdkApi$1().verifyMergeUsers({environmentId:fr,mergeUserConflictResolutions:{mergeUserResolutions:br}});return storeAuthTokenAndUser(wr)}catch(wr){throw logger$6.error(wr),wr}}),refreshUserJwt=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br}){try{const wr=yield sdkApi$1().refreshAuth({environmentId:br});return storeAuthTokenAndUser(wr)}catch{return}}),getAuthenticatedUser=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br}){try{return yield sdkApi$1().getAuthenticatedUser({environmentId:br})}catch(wr){if(wr.status===401)throw logger$6.error("No valid auth for getAuthenticatedUser",wr),new CookieInvalidError;logger$6.error("Other error getting authenticated user",wr);return}}),sessionExpirationUnit={days:86400,hours:3600,minutes:60},getEmbeddedWalletSessionExpiration=fr=>{if(!fr)return 0;const{unit:br,amount:wr}=fr,Er=wr||0,kr=sessionExpirationUnit[br]||0;return Er*kr},useElementById=()=>{const fr=reactExports.useRef(null);return{createRootElement:(wr="dynamic-modal",Er)=>{if(typeof window>"u")return fr;const kr=window.document.getElementById(wr);if(kr)return fr.current=kr,fr;const jr=Er?window.document.getElementById(Er):void 0;return fr.current=window.document.createElement("div"),fr.current.setAttribute("id",wr),fr.current.setAttribute("class",wr),fr.current.setAttribute("data-testid",wr),fr.current.style.pointerEvents="auto",jr?jr.appendChild(fr.current):window.document.body.appendChild(fr.current),fr}}},removeElementById=fr=>{let br;if(typeof window<"u"){br=window.document.getElementById(fr);const wr=br==null?void 0:br.parentElement;if(!br||!wr)return;wr.removeChild(br)}},iframeContainerId$1="dyn-passkey-recovery-id",iframeElementId$1="dyn-passkey-recovery-element-id",initEmbeddedWalletSession=fr=>__awaiter$e(void 0,[fr],void 0,function*({authenticatorType:br,iframeContainer:wr,iframeElementId:Er,environmentId:kr,user:jr,wallet:Br,sessionExpiration:Wr}){var qr;if(!jr)throw new DynamicError(USER_NOT_LOGGED_IN);if(!(Br!=null&&Br.connector)||!(Br!=null&&Br.id)||!isPasskeyWalletConnector(Br==null?void 0:Br.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const Gr=(qr=Br.connector)===null||qr===void 0?void 0:qr.getAuthenticatorHandler();if(br==="passkey"&&Gr.isSessionActive())return addNewPasskeyAuthenticator({environmentId:kr,user:jr,wallet:Br});const Vr=yield Gr.initRecovery(br,wr,Er,Wr);if(!Vr)throw new DynamicError("Something went wrong");const Zr=yield initEmbeddedWalletSession$1({authenticatorType:br,environmentId:kr,publicKey:Vr,walletId:Br.id});Gr.recoveryUserId=br==="passkey"?Zr.turnkeyRecoveryUserId:Zr.turnkeyUserId}),passkeyRecoveryBundleValidation=fr=>__awaiter$e(void 0,[fr],void 0,function*({user:br,bundleInput:wr,wallet:Er}){var kr,jr,Br,Wr;if(!wr)throw new DynamicError("Code must be informed");if(!(Er!=null&&Er.connector)||!(Er!=null&&Er.id)||!isPasskeyWalletConnector(Er==null?void 0:Er.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");if(!br)throw new DynamicError(USER_NOT_LOGGED_IN);const qr=(Br=(jr=(kr=br.verifiedCredentials)===null||kr===void 0?void 0:kr.find(({walletName:Zr})=>Zr==null?void 0:Zr.startsWith("turnkey")))===null||jr===void 0?void 0:jr.walletProperties)===null||Br===void 0?void 0:Br.turnkeySubOrganizationId,Gr=(Wr=Er.connector)===null||Wr===void 0?void 0:Wr.getAuthenticatorHandler();yield Gr.verifyRecoveryCode(wr,qr);const Vr={createdAt:new Date().getTime(),emailCode:wr,userId:Gr.recoveryUserId};StorageService.setItem(EMBEDDED_WALLET_SESSION_SETTINGS,Vr)}),resentRecoveryEmail=fr=>__awaiter$e(void 0,[fr],void 0,function*({authenticatorType:br,user:wr,environmentId:Er,wallet:kr}){var jr;if(!wr)throw new DynamicError(USER_NOT_LOGGED_IN);if(!(kr!=null&&kr.connector)||!(kr!=null&&kr.id)||!isPasskeyWalletConnector(kr==null?void 0:kr.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const Br=(jr=kr.connector)===null||jr===void 0?void 0:jr.getAuthenticatorHandler().publicKey;if(!Br)throw new DynamicError("Could not proceed with your request. Please restart the process.");return initEmbeddedWalletSession$1({authenticatorType:br,environmentId:Er,publicKey:Br,walletId:kr==null?void 0:kr.id})}),completePasskeyRecovery=fr=>__awaiter$e(void 0,[fr],void 0,function*({user:br,environmentId:wr,wallet:Er}){const{connector:kr,user:jr}=yield recoverTurnkeyWallet({addPasskeyAuthenticator:!1,environmentId:wr,user:br,wallet:Er});return kr.getAuthenticatorHandler().clear(),removeElementById(iframeElementId$1),jr}),addNewPasskeyAuthenticator=fr=>__awaiter$e(void 0,[fr],void 0,function*({user:br,environmentId:wr,wallet:Er}){const{user:kr}=yield recoverTurnkeyWallet({addPasskeyAuthenticator:!0,environmentId:wr,user:br,wallet:Er});return kr}),recoverTurnkeyWallet=fr=>__awaiter$e(void 0,[fr],void 0,function*({wallet:br,user:wr,environmentId:Er,addPasskeyAuthenticator:kr}){var jr,Br,Wr;if(!wr)throw new DynamicError(USER_NOT_LOGGED_IN);if(!br||!br.connector||!br.id||!isPasskeyWalletConnector(br.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const qr=br.connector;qr.setEmail(wr.email);const Gr=(Wr=(Br=(jr=wr.verifiedCredentials)===null||jr===void 0?void 0:jr.find(({walletName:Cn})=>Cn==null?void 0:Cn.startsWith("turnkey")))===null||Br===void 0?void 0:Br.walletProperties)===null||Wr===void 0?void 0:Wr.turnkeySubOrganizationId;if(!Gr)throw new DynamicError("The authentication token is invalid - turnkeySubOrganizationId is missing");const Vr=br.connector.getAuthenticatorHandler(),{attestation:Zr,challenge:Jr}=yield qr.getWebAuthnAttestation();kr?yield Vr.addPasskeyAuthenticator({attestation:Zr,challenge:Jr,turnkeySubOrganizationId:Gr}):yield Vr.completeRecovery({attestation:Zr,challenge:Jr,turnkeySubOrganizationId:Gr});const Qr=yield completePasskeyRecovery$1({attestation:Zr,challenge:Jr,environmentId:Er,walletId:br.id});if(!Qr)throw new DynamicError("No user returned from passkey recovery");const _n=qr.connectedChain;if(!findEmbeddedWalletFromVerifiedCredentials(Qr,[_n]))throw new DynamicError("EmbeddedWalletVerifiedCredential not found");return qr.setVerifiedCredentials(Qr.verifiedCredentials),{connector:qr,user:Qr}}),canRestoreEmbeddedWalletSession=fr=>{if(!(fr!=null&&fr.amount))return!1;const br=StorageService.getItem(EMBEDDED_WALLET_SESSION_SETTINGS);if(!br)return!1;const wr=fr.amount*(fr.unit==="minutes"?60:3600),Er=(br==null?void 0:br.createdAt)+wr*1e3,kr=new Date(Er);return new Date>=kr?(StorageService.removeItem(EMBEDDED_WALLET_SESSION_SETTINGS),!1):!0},restoreEmbeddedWalletSession=fr=>__awaiter$e(void 0,[fr],void 0,function*({user:br,iframeContainer:wr,iframeElementId:Er,wallet:kr,sessionExpiration:jr}){var Br,Wr,qr,Gr;if(!br)throw new DynamicError(USER_NOT_LOGGED_IN);if(!(kr!=null&&kr.connector)||!(kr!=null&&kr.id)||!isPasskeyWalletConnector(kr==null?void 0:kr.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const Vr=StorageService.getItem(EMBEDDED_WALLET_SESSION_SETTINGS),Zr=(Br=kr.connector)===null||Br===void 0?void 0:Br.getAuthenticatorHandler();if(!Vr||Zr.recoveryUserId)return!1;if(!(yield Zr.initRecovery("email",wr,Er,jr)))throw new DynamicError("Could not open embedded wallet connection communication");Zr.recoveryUserId=Vr.userId;const Qr=(Gr=(qr=(Wr=br.verifiedCredentials)===null||Wr===void 0?void 0:Wr.find(({walletName:_n})=>_n==null?void 0:_n.startsWith("turnkey")))===null||qr===void 0?void 0:qr.walletProperties)===null||Gr===void 0?void 0:Gr.turnkeySubOrganizationId;return yield Zr.verifyRecoveryCode(Vr.emailCode,Qr),!0}),addEmailRecovery=fr=>__awaiter$e(void 0,[fr],void 0,function*({user:br,environmentId:wr,wallet:Er}){var kr,jr;if(!(br!=null&&br.email))throw new DynamicError(USER_NOT_LOGGED_IN);if(!(Er!=null&&Er.connector)||!(Er!=null&&Er.id)||!isPasskeyWalletConnector(Er==null?void 0:Er.connector)||!isEmailWalletConnector(Er==null?void 0:Er.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const{turnkeySubOrganizationId:Br,turnkeyUserId:Wr}=(jr=(kr=br.verifiedCredentials)===null||kr===void 0?void 0:kr.find(({walletName:Vr})=>Vr==null?void 0:Vr.startsWith("turnkey")))===null||jr===void 0?void 0:jr.walletProperties;if(!Br||!Wr)throw new DynamicError("The authentication token is invalid - turnkeySubOrganizationId or turnkeyUserID is missing");const qr=Er.connector.getAuthenticatorHandler(),{signedRequest:Gr}=yield qr.addEmailRecovery({email:br.email,organizationId:Br,turnkeyUserId:Wr});return yield updatePasskeyRecoveryEmail({environmentId:wr,updateRecoveryEmailRequest:{turnkeySignedRequest:Gr}}),Er.connector.setEmail(br.email),refreshUserJwt({environmentId:wr})}),useInitEmbeddedWalletAuthMethod=()=>{const{primaryWallet:fr,environmentId:br,user:wr,projectSettings:Er,setShowAuthFlow:kr}=useInternalDynamicContext(),{setView:jr}=useViewContext(),[Br,Wr]=reactExports.useState(!1),[qr,Gr]=reactExports.useState(),{getEOAWallet:Vr}=useSmartWallets();return{error:qr,initAuthMethod:Jr=>__awaiter$e(void 0,[Jr],void 0,function*({authenticatorType:Qr,iframeContainer:_n,currentAction:En}){var Cn,In,An,jn,eo;Wr(!0);const ro=(Cn=fr&&Vr(fr))!==null&&Cn!==void 0?Cn:fr,to=((An=(In=Er==null?void 0:Er.sdk.embeddedWallets)===null||In===void 0?void 0:In.sessionKeyDuration)===null||An===void 0?void 0:An.amount)||0,_i=((eo=(jn=Er==null?void 0:Er.sdk.embeddedWallets)===null||jn===void 0?void 0:jn.sessionKeyDuration)===null||eo===void 0?void 0:eo.unit)==="minutes"?60:3600,oo=Qr==="email"||!(ro==null?void 0:ro.connector).getAuthenticatorHandler().isSessionActive();try{yield initEmbeddedWalletSession({authenticatorType:Qr,environmentId:br,iframeContainer:_n,iframeElementId:iframeElementId$1,sessionExpiration:to*_i||void 0,user:wr,wallet:ro}),oo?(jr("passkey-recovery-bundle",{authenticatorType:Qr,currentAction:En}),kr(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1})):kr(!1)}catch(io){Gr(io),logger$6.error("Failed to create embedded wallet session",io),dynamicEvents.emit("passkeyRecoveryFailed",io)}finally{Wr(!1)}}),isLoading:Br}},usePasskeyRecovery=()=>{var fr,br,wr;const{environmentId:Er,primaryWallet:kr,projectSettings:jr,setShowAuthFlow:Br,user:Wr}=useInternalDynamicContext(),{createRootElement:qr}=useElementById(),Gr=qr(iframeContainerId$1),{isTurnkeyWalletWithoutAuthenticator:Vr,hasRecoveryEmail:Zr}=useIsTurnkeyWallet(),{initAuthMethod:Jr}=useInitEmbeddedWalletAuthMethod(),{setDisplayedDestination:Qr,setVerificationUUID:_n}=useVerification(),{getEOAWallet:En}=useSmartWallets(),{setView:Cn}=useViewContext(),In=(fr=kr&&En(kr))!==null&&fr!==void 0?fr:kr,An=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){var _i,oo;if(!(!((_i=jr==null?void 0:jr.sdk.embeddedWallets)===null||_i===void 0)&&_i.sessionKeyDuration)||!canRestoreEmbeddedWalletSession((oo=jr==null?void 0:jr.sdk.embeddedWallets)===null||oo===void 0?void 0:oo.sessionKeyDuration))return!1;const io=getEmbeddedWalletSessionExpiration(jr.sdk.embeddedWallets.sessionKeyDuration);try{return yield restoreEmbeddedWalletSession({iframeContainer:Gr.current,iframeElementId:iframeElementId$1,sessionExpiration:io,user:Wr,wallet:kr})}catch(co){logger$6.error("Failed to restore embedded wallet",co)}return!1}),[Wr,Gr,kr,(wr=(br=jr==null?void 0:jr.sdk)===null||br===void 0?void 0:br.embeddedWallets)===null||wr===void 0?void 0:wr.sessionKeyDuration]),jn=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){if(!In||!isPasskeyWalletConnector(In.connector))return!1;const _i=In.connector.getAuthenticatorHandler();return!(!Vr||_i.isSessionActive()||(yield An()))}),[In,Vr,An]),eo=reactExports.useCallback((_i,oo)=>__awaiter$e(void 0,void 0,void 0,function*(){var io;(()=>{if(!Wr)throw new Error(USER_NOT_LOGGED_IN);if(!isTurnkeyEnabled(jr))throw new Error("Dynamic embedded wallet is not enabled. Go to the dashboard and make sure to have both Dynamic embedded wallet and at least one EVM network enabled. Also, check if EthereumWalletConnectors is in the DynamicContextProvider > settings > walletConnectors.");if(!hasEmbeddedWallet(Wr))throw new Error("Dynamic embedded wallet not found");if(In&&!isPasskeyWalletConnector(In.connector))throw new Error("Dynamic embedded wallet not found.")})();const so=(In==null?void 0:In.connector).getAuthenticatorHandler();if(_i==="passkey"&&so.isSessionActive())return yield addNewPasskeyAuthenticator({environmentId:Er,user:Wr,wallet:In}),Br(!1),In;const no=getEnabledEmbeddedWalletsAuthenticators((io=jr==null?void 0:jr.sdk.embeddedWallets)===null||io===void 0?void 0:io.supportedSecurityMethods),Tn=no?Object.keys(no):[];if(!Zr)Cn("passkey-recovery-add-email",{shouldInitRecovery:!0}),Br(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1});else if(!_i&&Tn.length>1)Cn("embedded-wallet-auth-choice",{currentAction:oo}),Br(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1});else{const[Hr]=Tn;_i&&!Tn.includes(_i)&&(_i=Hr),yield Jr({authenticatorType:_i||Hr,currentAction:oo,iframeContainer:Gr.current})}return new Promise((Hr,Xr)=>{dynamicEvents.once("passkeyRecoveryCompleted",Sn=>Hr(Sn)),dynamicEvents.once("passkeyRecoveryFailed",Sn=>Xr(Sn))})}),[In,jr,Zr,Er,Wr,Br,Cn,Jr,Gr]),ro=_i=>__awaiter$e(void 0,void 0,void 0,function*(){try{let oo=Wr;Wr!=null&&Wr.email||(oo=yield to(_i)),yield addEmailRecovery({environmentId:Er,user:oo,wallet:kr}),dynamicEvents.emit("embeddedWalletRecoveryEmailCompleted","")}catch(oo){logger$6.error("Failed to add recovery email",oo),dynamicEvents.emit("embeddedWalletRecoveryEmailFailed",oo)}}),to=_i=>__awaiter$e(void 0,void 0,void 0,function*(){try{const{nextView:oo,emailVerification:io,userProfile:co}=yield updateUserProfileFields(Er,{email:_i});return oo===NextViewEnum.Done?co:(Cn("verify-email",{isEmailRecoveryFlow:!0}),Qr(_i),_n(io==null?void 0:io.verificationUUID),new Promise((so,no)=>{dynamicEvents.once("emailVerificationResult",Tn=>{Tn&&so(co),no("Failed to verify email")})}))}catch(oo){throw logger$6.error("Failed to update user email",oo),oo}});return{addRecoveryEmail:ro,initPasskeyRecoveryProcess:eo,shouldInitRecovery:jn}};var _circle$5,_g$c,_excluded$19=["title","titleId"];function _extends$19(){return _extends$19=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$19(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgSpinner=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$19(br,_excluded$19);return reactExports.createElement("svg",_extends$19({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,reactExports.createElement("circle",{cx:12,cy:12,r:11,stroke:"currentColor",strokeWidth:2,style:{opacity:.1}}),reactExports.createElement("mask",{id:"spinner_svg__a",style:{maskType:"alpha"},maskUnits:"userSpaceOnUse",x:0,y:0,width:24,height:24},_circle$5||(_circle$5=reactExports.createElement("circle",{cx:12,cy:12,r:11,stroke:"currentColor",strokeWidth:2}))),_g$c||(_g$c=reactExports.createElement("g",{mask:"url(#spinner_svg__a)"},reactExports.createElement("path",{fill:"currentColor",d:"M12-16.5h27v27H12z"}))))};const Spinner$2=({className:fr=""})=>jsxRuntimeExports.jsx(SvgSpinner,{className:classNames$1("spinner",fr)}),Button$1=({buttonClassName:fr="",buttonPadding:br="medium",buttonVariant:wr="primary",children:Er,feedback:kr,expanded:jr,dataTestId:Br,disabled:Wr=!1,showInternalLoading:qr=!0,loading:Gr=!1,onClick:Vr,type:Zr,startSlot:Jr,endSlot:Qr})=>{const[_n,En]=reactExports.useState(!1),[Cn,In]=reactExports.useState(!1),An={"brand-primary":"button--brand-primary",primary:"button--primary",secondary:"button--secondary",tertiary:"button--tertiary"},eo=classNames$1("button",{"button--expanded":!!jr,"button--loading":!!Gr},br?{default:"button--padding-default",large:"button--padding-large","login-screen-height":"button--padding-login-screen-height",medium:"button--padding-medium",none:"button--padding-none",small:"button--padding-small"}[br]:"",wr?An[wr]:"",fr),ro=_i=>__awaiter$e(void 0,void 0,void 0,function*(){if(Vr){const oo=Vr(_i);if(oo instanceof Promise){qr&&En(!0);try{yield oo}finally{En(!1)}}}kr&&(In(!0),setTimeout(()=>{In(!1)},2e3))}),to=jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Jr&&jsxRuntimeExports.jsx("div",{className:"button__start-slot",children:Jr}),(kr||Er)&&(Cn&&kr?kr:Er),Qr&&jsxRuntimeExports.jsx("div",{className:"button__end-slot",children:Qr})]});return jsxRuntimeExports.jsxs("button",{type:Zr,onClick:ro,className:eo,disabled:Wr||_n||Gr,"data-testid":Br,children:[(_n||Gr)&&jsxRuntimeExports.jsx("div",{className:"button__spinner-container","data-testid":"button__spinner",children:jsxRuntimeExports.jsx(Spinner$2,{className:"button__spinner"})}),to]})},TypographyButton=fr=>{var br,{children:wr,typographyProps:Er={variant:"button_primary"},copykey:kr}=fr,jr=__rest$9(fr,["children","typographyProps","copykey"]);return jsxRuntimeExports.jsx(Button$1,Object.assign({},jr,{children:jsxRuntimeExports.jsx(Typography,Object.assign({variant:"button_primary",as:"span"},Er,{color:(br=Er.color)!==null&&br!==void 0?br:"primary",copykey:kr,children:wr}))}))},useResizeObserver=(fr,br)=>{const[wr,Er]=reactExports.useState(),kr=reactExports.useCallback(jr=>{if(!Array.isArray(jr))return;const[Br]=jr;Er(Br.contentRect)},[br,Er]);return reactExports.useLayoutEffect(()=>{if(!fr.current)return;let jr=new ResizeObserver(kr);return jr.observe(fr.current),()=>{jr==null||jr.disconnect(),jr=null}},[fr]),[wr]},VerticalDrawerTransition=fr=>{var{style:br,children:wr,className:Er}=fr,kr=__rest$9(fr,["style","children","className"]);const jr=reactExports.useRef(null),Br=reactExports.useRef(null),[Wr]=useResizeObserver(Br),qr=reactExports.useMemo(()=>Wr==null?void 0:Wr.height,[Wr]),{mount:Gr,stage:Vr,currentDuration:Zr}=useTransition(Object.assign({animateOnMount:!1},kr)),Jr=reactExports.useMemo(()=>!Gr||Vr==="EXITING"||Vr==="UNMOUNT"?0:qr,[Vr,qr,Gr]);return jsxRuntimeExports.jsx("div",{ref:jr,className:classNames$1(Er,"vertical-drawer-animation"),style:Object.assign(Object.assign({},br),{maxHeight:Jr,transitionDuration:`${Zr}ms`}),children:jsxRuntimeExports.jsx("div",{ref:Br,children:Gr&&wr})})},ModalHeader=({alignContent:fr,children:br,leading:wr,displayLeading:Er=!0,trailing:kr,displayTrailing:jr=!0,style:Br,displayBorder:Wr})=>{const qr=Er&&wr&&reactExports.Children.count(wr),Gr=jr&&kr&&reactExports.Children.count(kr);return jsxRuntimeExports.jsxs("div",{className:classNames$1("modal-header",{"modal-header--align-content-bottom":fr==="bottom","modal-header--border":Wr,"modal-header--empty":!qr&&!br&&!Gr}),style:Br,children:[Er&&jsxRuntimeExports.jsx("div",{className:classNames$1("modal-header__leading",{"modal-header__leading--empty":!qr}),children:wr}),br,jr&&jsxRuntimeExports.jsx("div",{className:classNames$1("modal-header__trailing",{"modal-header__trailing--empty":!Gr}),children:kr})]})};var _g$b,_defs$b,_excluded$18=["title","titleId"];function _extends$18(){return _extends$18=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$18(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgDynamicLogo=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$18(br,_excluded$18);return reactExports.createElement("svg",_extends$18({fill:"none",viewBox:"0 0 114 21",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_g$b||(_g$b=reactExports.createElement("g",{clipPath:"url(#dynamic-logo_svg__a)",fill:"currentColor"},reactExports.createElement("path",{d:"M10.053 2.002c-.43.4-.85.793-1.273 1.184-1.959 1.818-3.918 3.638-5.879 5.453-.45.417-.915.817-1.48 1.061C.75 9.99.365 9.81.15 9.085-.153 8.072.009 7.128.59 6.258 1.087 5.517 1.71 4.9 2.354 4.3A178.857 178.857 0 0 1 5.45 1.47c.457-.408.957-.78 1.567-.905 1.828-.368 2.994 1.384 3.038 1.436l-.002.001zM1.259 11.254c1.112-.32 1.946-1.026 2.758-1.768 2.59-2.363 5.176-4.728 7.777-7.078A16.823 16.823 0 0 1 13.609.96C14.42.408 15.303.33 16.173.855c.314.189.623.409.878.672a106.565 106.565 0 0 1 5.28 5.866c.298.358.542.774.744 1.196.375.785.279 1.561-.178 2.293-.409.655-.956 1.192-1.52 1.702a699.92 699.92 0 0 1-6.653 5.96c-.6.53-1.26 1.004-1.94 1.422-1.282.791-2.568.693-3.737-.244A16.245 16.245 0 0 1 7.14 17.92c-1.883-2.087-3.73-4.203-5.592-6.31-.094-.106-.18-.22-.29-.358v.002zM39.574.915h2.808V16.14h-2.808v-1.284c-.827 1.06-2.003 1.587-3.526 1.587-1.522 0-2.717-.555-3.755-1.664s-1.556-2.469-1.556-4.078c0-1.609.518-2.968 1.556-4.077s2.288-1.665 3.755-1.665 2.7.53 3.526 1.587V.913v.002zm-5.17 11.996c.573.572 1.294.859 2.166.859s1.589-.287 2.155-.86c.566-.572.849-1.309.849-2.207 0-.898-.283-1.635-.85-2.207-.565-.572-1.283-.859-2.154-.859s-1.593.287-2.166.86c-.574.571-.86 1.308-.86 2.206 0 .898.286 1.635.86 2.208zM51.766 5.264h3.004l-3.968 10.894c-.566 1.554-1.315 2.682-2.251 3.385-.934.704-2.098 1.02-3.489.947v-2.61c.755.015 1.352-.144 1.796-.477.442-.334.796-.87 1.057-1.61L43.453 5.268h3.069l2.837 7.308 2.409-7.308-.002-.002zM61.908 4.959c1.19 0 2.174.398 2.949 1.196.777.798 1.163 1.9 1.163 3.305v6.678h-2.808v-6.33c0-.723-.196-1.279-.588-1.664-.392-.383-.914-.576-1.567-.576-.725 0-1.306.224-1.74.674s-.654 1.124-.654 2.022v5.872h-2.808V5.261h2.808v1.218c.683-1.014 1.763-1.522 3.243-1.522l.002.002zM76.243 5.264h2.808V16.14h-2.808v-1.283c-.842 1.06-2.024 1.587-3.548 1.587s-2.695-.555-3.733-1.665-1.556-2.468-1.556-4.077c0-1.61.518-2.968 1.556-4.078C70 5.514 71.242 4.96 72.695 4.96c1.524 0 2.706.53 3.548 1.587V5.262v.002zm-5.182 7.646c.566.572 1.284.86 2.156.86s1.592-.288 2.166-.86c.573-.572.86-1.309.86-2.207 0-.898-.287-1.635-.86-2.207-.574-.572-1.295-.86-2.166-.86s-1.59.288-2.156.86c-.566.572-.849 1.309-.849 2.207 0 .898.283 1.635.85 2.207zM92.864 4.959c1.249 0 2.246.406 2.993 1.218.748.813 1.121 1.9 1.121 3.263v6.7H94.17V9.637c0-.652-.16-1.16-.48-1.523s-.769-.544-1.35-.544c-.638 0-1.135.211-1.49.631-.356.42-.533 1.03-.533 1.828v6.113h-2.808V9.638c0-.651-.16-1.159-.48-1.522-.32-.363-.77-.544-1.35-.544-.623 0-1.121.21-1.491.631-.37.42-.555 1.03-.555 1.828v6.113h-2.808V5.269h2.808v1.153c.653-.972 1.661-1.457 3.027-1.457 1.365 0 2.321.522 2.96 1.566.724-1.044 1.807-1.566 3.242-1.566l.002-.006zM100.15 3.959c-.464 0-.868-.17-1.208-.511a1.653 1.653 0 0 1-.512-1.207c0-.465.17-.87.512-1.219.34-.348.744-.522 1.208-.522.464 0 .888.174 1.23.522.341.348.511.754.511 1.219 0 .464-.17.866-.511 1.207-.34.34-.751.511-1.23.511zM98.757 16.14V5.265h2.808V16.14h-2.808zM108.69 16.443c-1.641 0-3.008-.55-4.103-1.654-1.095-1.101-1.643-2.464-1.643-4.088s.548-2.987 1.643-4.089 2.464-1.653 4.103-1.653c1.06 0 2.024.253 2.895.76.871.508 1.532 1.19 1.981 2.045l-2.416 1.413a2.464 2.464 0 0 0-.989-1.067 2.878 2.878 0 0 0-1.491-.39c-.842 0-1.539.28-2.091.837-.551.559-.827 1.272-.827 2.142 0 .87.276 1.563.827 2.12.552.56 1.249.837 2.091.837.566 0 1.069-.126 1.513-.381.442-.254.773-.606.99-1.056l2.438 1.393a5.463 5.463 0 0 1-2.024 2.055c-.871.515-1.835.772-2.895.772l-.002.004z"}))),_defs$b||(_defs$b=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"dynamic-logo_svg__a"},reactExports.createElement("path",{transform:"translate(0 .5)",fill:"#fff",d:"M0 0h113.61v20H0z"})))))};const DynamicWidgetFooter=({children:fr})=>jsxRuntimeExports.jsx("div",{className:"dynamic-widget-footer","data-testid":"dynamic-widget-footer",children:fr}),URL$2="https://dynamic.xyz",alignClassNames={center:"powered-by-dynamic--center",right:"powered-by-dynamic--right"},PoweredByDynamic=({align:fr="center",classNameLogo:br,classNameRoot:wr,classNameText:Er,asFooter:kr})=>{var jr;const{projectSettings:Br}=useInternalDynamicContext();if(((jr=Br==null?void 0:Br.sdk)===null||jr===void 0?void 0:jr.displayDynamicMessaging)===!1)return null;const Wr=jsxRuntimeExports.jsxs("a",{target:"_blank",href:URL$2,className:classNames$1("powered-by-dynamic",alignClassNames[fr],wr),rel:"noreferrer",children:[jsxRuntimeExports.jsx(Typography,{as:"span",color:"tertiary",weight:"regular",variant:"body_mini",className:classNames$1("powered-by-dynamic__text",Er),children:"Powered by"}),jsxRuntimeExports.jsx(SvgDynamicLogo,{className:classNames$1("powered-by-dynamic__logo",br)})]});return kr?jsxRuntimeExports.jsx(DynamicWidgetFooter,{children:Wr}):Wr},roundToNthDecimal=(fr,br)=>{if(!fr)return;const wr=Math.pow(10,br),Er=Math.round(fr*wr)/wr,kr="0".repeat(br-1);return Er===0?`<0.${kr}1`:Er},useCurrencySymbol=(fr,br)=>(fr==null?void 0:fr.symbol)||br,getValueRounded=(fr,br)=>{let wr;return fr?wr=br.value?br.format(br.value):"0":wr=br!=null&&br.nonNativeValue&&(br!=null&&br.formatNonNativeToken)?br.formatNonNativeToken(br.nonNativeValue,br.nonNativeDecimal||18):"0",roundToNthDecimal(Number(wr),6)},calculateFiatPrice=(fr,br,wr)=>{if(fr===void 0||isNaN(fr)||!wr||!br)return 0;const Er=BigInt(Math.pow(10,wr)),kr=Number(br.toFixed(wr));try{const jr=BigInt(fr*Number(Er)),Br=BigInt(kr*Number(Er)),Wr=jr*Br;return Number(Wr/Er)/Number(Er)}catch{return}},getDisplayFiatPrice=(fr,br)=>{if(!(br!=null&&br.price))return"--";const wr=calculateFiatPrice(fr,br.price,br.decimals);return wr===void 0?"--":wr===0||wr>=.01?wr.toFixed(2):"<0.01"},useHandleRecovery=(fr,br,wr,Er,kr,jr)=>{const Br=()=>__awaiter$e(void 0,void 0,void 0,function*(){(yield Er())&&fr&&!br(fr)&&(yield kr("email","sendTransaction")),wr==null||wr("callHandlerOutsideModal")});useEffectOnce(()=>{jr&&Br()})},useHandleSubmitWithChecks=(fr,br,wr)=>Er=>__awaiter$e(void 0,void 0,void 0,function*(){const{walletConnector:kr,usingSessionKey:jr,onClickSend:Br,isTurnkeyWallet:Wr,userNeedsCrossDomainPasskey:qr}=fr,{shouldInitRecovery:Gr,initPasskeyRecoveryProcess:Vr}=br,{setView:Zr,setShowAuthFlow:Jr}=wr;if(kr&&jr(kr)){Br(Er);return}if((yield Gr())&&(yield Vr("email","sendTransaction")),Wr&&qr){Zr("passkey-new-domain-detected"),Jr(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1}),dynamicEvents.once("passkeyRecoveryCompleted",()=>{Br(Er)});return}Br(Er)});var _path$_,_excluded$17=["title","titleId"];function _extends$17(){return _extends$17=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$17(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgTooltip=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$17(br,_excluded$17);return reactExports.createElement("svg",_extends$17({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$_||(_path$_=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm10-5a1 1 0 0 1 1 1v4a1 1 0 1 1-2 0V8a1 1 0 0 1 1-1Zm-1 9a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1Z",fill:"#ABACB2"})))};const shortenWalletAddress=(fr,br=6,wr=4)=>fr?fr.replace(fr.substring(br,Number(fr.length)-wr),"..."):"",getNetworkInfoEntry=(fr,br)=>{if(!fr||!fr.symbol)return;const wr=fr.symbol==="ETH"||fr.symbol==="EVM"?"evm":fr.symbol.toLowerCase(),Er=br[wr]||br[ChainEnumToVerifiedCredentialName[wr.toUpperCase()]];if(Er)return wr==="evm"?Er.find(kr=>kr.chainId===(fr==null?void 0:fr.chainId)):Er[0]},getEvmChainName=fr=>({1:"Ethereum",10:"OP Mainnet",11155111:"Sepolia",137:"Polygon",42161:"Arbitrum One",43114:"Avalanche",8453:"Base"})[fr]||"Unknown";var _path$Z,_excluded$16=["title","titleId"];function _extends$16(){return _extends$16=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$16(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgTooltipArrow=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$16(br,_excluded$16);return reactExports.createElement("svg",_extends$16({width:8,height:4,viewBox:"0 0 8 4",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$Z||(_path$Z=reactExports.createElement("path",{d:"M4 3.75 7.031 0H.97L4 3.75Z",fill:"currentColor"})))};const debounce=(fr,br)=>{let wr;const Er=()=>{fr()};return()=>{clearTimeout(wr),wr=window.setTimeout(Er,br)}},useHover=({initialValue:fr=!1,falseOnClick:br=!1,onHover:wr,onHoverOff:Er})=>{const[kr,jr]=reactExports.useState(fr);return[kr,{onMouseDown:()=>jr(!0),onMouseEnter:()=>{wr==null||wr(),jr(!0)},onMouseLeave:()=>{Er==null||Er(),jr(!1)},onMouseUp:()=>jr(br)}]},Tooltip$2=({children:fr,content:br,className:wr,as:Er="span",copykey:kr})=>{const{createRootElement:jr}=useElementById(),Br=jr("dynamic-tooltips"),[Wr,qr]=reactExports.useState([0,0]),Gr=reactExports.useRef(null),[Vr,Zr]=reactExports.useState(!1),Jr=reactExports.useCallback(()=>{if(Gr.current){const _n=Gr.current.getBoundingClientRect();qr([_n.left+_n.width/2,_n.top-6])}},[]),[,Qr]=useHover({falseOnClick:!0,initialValue:!1,onHover:()=>{Jr(),Zr(!0)},onHoverOff:()=>{Zr(!1)}});return reactExports.useEffect(()=>{Jr();const _n=debounce(()=>{Jr()},3);return window.addEventListener("resize",_n),()=>{window.removeEventListener("resize",_n)}},[Jr]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[reactDomExports.createPortal(jsxRuntimeExports.jsx(ShadowDOM,{zIndex:tooltipZIndex,children:jsxRuntimeExports.jsxs("div",{"data-testid":"dynamicTooltip",className:classNames$1("dynamic-tooltip",{"dynamic-tooltip--visible":Vr},wr),style:{left:Wr[0],top:Wr[1]},copykey:kr,children:[br,jsxRuntimeExports.jsx(SvgTooltipArrow,{className:"dynamic-tooltip__arrow"})]})}),Br.current),jsxRuntimeExports.jsx(Er,Object.assign({ref:Gr},Qr,{children:fr}))]})},useFetchChain=fr=>{const br=()=>__awaiter$e(void 0,void 0,void 0,function*(){var kr,jr;if(!fr)return{chainId:void 0,name:"",symbol:void 0};const Br=yield fr.getNetwork(),{connectedChain:Wr}=fr,qr=getChainInfoWithOverrides(Wr||""),Gr={chainId:Br,name:qr==null?void 0:qr.displayName,symbol:qr==null?void 0:qr.symbol};if(Br&&fr.evmNetworks){const Vr=fr.evmNetworks.find(Zr=>Zr.chainId===Br);Gr.name=(jr=(kr=Vr==null?void 0:Vr.vanityName)!==null&&kr!==void 0?kr:Vr==null?void 0:Vr.name)!==null&&jr!==void 0?jr:Gr.name,Gr.icon=Vr==null?void 0:Vr.iconUrls[0]}return Gr}),{data:wr,isLoading:Er}=usePromise(br,{deps:[fr]});return{chain:wr,isLoading:Er}},useNetworkConfigurationsFromProjectSettings=({projectSettings:fr,cosmosNetworkOverrides:br,evmNetworksOverrides:wr})=>reactExports.useMemo(()=>{var Er,kr,jr,Br;const Wr=fr==null?void 0:fr.networks;if(!Wr)return{};const qr=Wr.find(In=>In.chainName==="evm"),Gr=Wr.find(In=>In.chainName==="solana"),Vr=Wr.find(In=>In.chainName==="cosmos"),Zr=Wr.find(In=>In.chainName==="starknet");let Jr=(Er=Vr==null?void 0:Vr.networks)===null||Er===void 0?void 0:Er.map(In=>createNetwork(In,parseInt));Jr=overrideNetworks(br,Jr);let Qr=(kr=qr==null?void 0:qr.networks)===null||kr===void 0?void 0:kr.map(In=>createNetwork(In,parseInt));Qr=overrideNetworks(wr,Qr);const _n=(jr=Zr==null?void 0:Zr.networks)===null||jr===void 0?void 0:jr.map(In=>createNetwork(In)),En=(Br=Gr==null?void 0:Gr.networks)===null||Br===void 0?void 0:Br.map(In=>createNetwork(In));return wr&&(Array.isArray(wr)?Qr=wr:Qr=wr(Qr??[])),{cosmos:Jr,evm:Qr,solana:En,starknet:_n}},[fr==null?void 0:fr.networks,br,wr]),createNetwork=(fr,br=wr=>wr)=>({bech32Prefix:fr.bech32Prefix,blockExplorerUrls:fr.blockExplorerUrls,chainId:br(fr.chainId),iconUrls:fr.iconUrls,lcdUrl:fr.lcdUrl,name:fr.name,nativeCurrency:fr.nativeCurrency,networkId:br(fr.networkId),privateCustomerRpcUrls:fr.privateCustomerRpcUrls,rpcUrls:fr.rpcUrls,vanityName:fr.vanityName}),overrideNetworks=(fr,br)=>fr?Array.isArray(fr)?fr:fr(br??[]):br,TransactionCard=({transaction:fr,simulationResult:br,isGasSponsored:wr})=>{var Er,kr,jr,Br,Wr,qr;const{t:Gr}=useTranslation(),{primaryWallet:Vr,projectSettings:Zr,overrides:Jr}=useInternalDynamicContext(),Qr=useNetworkConfigurationsFromProjectSettings({evmNetworksOverrides:Jr==null?void 0:Jr.evmNetworks,projectSettings:Zr}),{chain:_n}=useFetchChain(Vr==null?void 0:Vr.connector),En=getNetworkInfoEntry(_n,Qr),{symbol:Cn,decimals:In}=(Er=En==null?void 0:En.nativeCurrency)!==null&&Er!==void 0?Er:{},An=br==null?void 0:br.showTotalFiat,jn=reactExports.useMemo(()=>{var Tn;const Hr=(Tn=br==null?void 0:br.priceData)===null||Tn===void 0?void 0:Tn.nativeTokenUsdPrice;if(!(!Hr||!In))return Number(Hr)*Number(fr.fee.gas)/Math.pow(10,In)},[br,In,fr.fee.gas]),eo=Tn=>{if(Tn)return Tn<.01?"<$0.01":`~$${Tn.toFixed(2)}`},ro=reactExports.useMemo(()=>{var Tn;return(((Tn=br==null?void 0:br.outAssets)===null||Tn===void 0?void 0:Tn.reduce((Xr,Sn)=>{var Rn;const Pn=((Rn=Sn.transferOut)===null||Rn===void 0?void 0:Rn.reduce((On,Zn)=>On+Number((Zn==null?void 0:Zn.usdPrice)||0),0))||0;return Xr+Pn},0))||0)+(Cn==="SOL"?0:jn||0)},[br==null?void 0:br.outAssets,Cn,jn]),to=Tn=>{if(Tn)return Tn<.01?"<$0.01":`~$${Tn.toFixed(2)}`},_i=(Tn,Hr,Xr)=>{var Sn,Rn;(Tn.asset.type==="NATIVE"||Tn.asset.type==="SOL")&&Tn.asset.chainName==="Solana"&&fr.fee.gas&&(Tn.amount=(Number(Tn.amount)-Number(fr.fee.gas)/Math.pow(10,9)).toString(),Tn.usdPrice=(Number(Tn.usdPrice)-Number(jn)).toString());const Pn=()=>{const Zn=Number(Tn.amount);return Number.isInteger(Zn)?Zn:Zn<1e-6?"<0.000001":Zn.toFixed(6)},On=()=>{const Zn=Number(Tn.usdPrice);return Zn<.01?"<$0.01":`$${Zn.toFixed(2)}`};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:`transaction-card__${Tn.direction}`,children:jsxRuntimeExports.jsxs("div",{className:"transaction-card__info-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",children:Tn.direction==="in"?"Receive":"Send"}),jsxRuntimeExports.jsxs("div",{className:"transaction-card__amount-symbol",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__token-info",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__token-row",children:[jsxRuntimeExports.jsxs(Typography,{variant:"body_normal",color:Tn.direction==="in"?"green-1":"error-1",children:[Tn.direction==="out"?"-":"+",Pn()]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:(Sn=Tn.asset.symbol||Tn.asset.name)!==null&&Sn!==void 0?Sn:Cn})]}),Number(Tn.usdPrice)>0&&jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:Tn.direction==="in"?"green-1":"error-1",children:On()})]}),jsxRuntimeExports.jsx("div",{className:"transaction-card__icon",children:jsxRuntimeExports.jsx("div",{className:"transaction-card__icon__container",children:jsxRuntimeExports.jsx("img",{src:Tn.asset.logoUrl||(En==null?void 0:En.nativeCurrency.iconUrl),alt:(Rn=Tn.asset.symbol)!==null&&Rn!==void 0?Rn:Cn,width:32,height:32,className:"transaction-card__icon__container__main"})})})]})]})}),Hr{var Hr;return((Hr=Tn.transferIn)===null||Hr===void 0?void 0:Hr.map(Xr=>{var Sn,Rn;return{amount:(Sn=Xr==null?void 0:Xr.value)!==null&&Sn!==void 0?Sn:"",asset:Tn.asset,direction:"in",usdPrice:(Rn=Xr==null?void 0:Xr.usdPrice)!==null&&Rn!==void 0?Rn:""}}))||[]}))||[],so=[...(((jr=br==null?void 0:br.outAssets)===null||jr===void 0?void 0:jr.flatMap(Tn=>{var Hr;return((Hr=Tn.transferOut)===null||Hr===void 0?void 0:Hr.map(Xr=>{var Sn,Rn;return{amount:(Sn=Xr==null?void 0:Xr.value)!==null&&Sn!==void 0?Sn:"",asset:Tn.asset,direction:"out",usdPrice:(Rn=Xr==null?void 0:Xr.usdPrice)!==null&&Rn!==void 0?Rn:""}}))||[]}))||[]).filter(Tn=>!((Tn.asset.type==="NATIVE"||Tn.asset.type==="SOL")&&Tn.asset.chainName==="Solana"&&Number(Tn.amount)===Number(fr.fee.gas)/Math.pow(10,9))),...oo],no=()=>jn?eo(jn):fr.fee.gas?`${fr.format(fr.fee.gas,{precision:6})} ${Cn}`:`-- ${Cn}`;return jsxRuntimeExports.jsxs("div",{className:"transaction-card-container",children:[so.length>0&&jsxRuntimeExports.jsx("div",{className:"transaction-card",children:jsxRuntimeExports.jsx("div",{className:"transaction-card__assets-container",children:so.map((Tn,Hr,Xr)=>jsxRuntimeExports.jsx(t$7.Fragment,{children:_i(Tn,Hr,Xr)},`asset-${Hr}`))})}),jsxRuntimeExports.jsx("div",{className:"transaction-card",children:jsxRuntimeExports.jsxs("div",{className:"transaction-card__details",children:[(fr.to||((Br=br==null?void 0:br.counterparties)===null||Br===void 0?void 0:Br[0]))&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__row",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",copykey:"dyn_send_transaction.confirmation.data.destination",children:Gr("dyn_send_transaction.confirmation.data.destination")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary","data-testid":"transaction-destination",children:shortenWalletAddress((Wr=fr.to)!==null&&Wr!==void 0?Wr:(qr=br==null?void 0:br.counterparties)===null||qr===void 0?void 0:qr[0],4,4)})]}),jsxRuntimeExports.jsx("div",{className:"transaction-card__divider"})]}),jsxRuntimeExports.jsxs("div",{className:"transaction-card__row",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",copykey:"dyn_send_transaction.confirmation.data.network",children:Gr("dyn_send_transaction.confirmation.data.network")}),jsxRuntimeExports.jsxs("div",{className:"transaction-card__network-info",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:(En==null?void 0:En.name)||"Ethereum"}),jsxRuntimeExports.jsx("img",{src:En==null?void 0:En.iconUrls[0],alt:(En==null?void 0:En.name)||"Network icon",width:16,height:16,className:"transaction-card__network-icon"})]})]}),!wr&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"transaction-card__divider"}),jsxRuntimeExports.jsxs("div",{className:"transaction-card__row",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__label-with-tooltip",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",copykey:"dyn_send_transaction.confirmation.data.gas_estimate",children:Gr("dyn_send_transaction.confirmation.data.gas_estimate")}),jsxRuntimeExports.jsx(Tooltip$2,{content:"Network fees are paid to process your transaction",className:"transaction-confirmation",children:jsxRuntimeExports.jsx(Icon,{size:"small",className:"fee-tooltip",children:jsxRuntimeExports.jsx(SvgTooltip,{})})})]}),jsxRuntimeExports.jsx("div",{className:"transaction-card__value",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary","data-testid":"transaction-estimated-gas-fee",children:no()})})]})]}),An&&ro!==void 0&&ro>0&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"transaction-card__divider"}),jsxRuntimeExports.jsxs("div",{className:"transaction-card__row",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"bold",copykey:"dyn_send_transaction.confirmation.data.total",children:Gr("dyn_send_transaction.confirmation.data.total")}),jsxRuntimeExports.jsx("div",{className:"transaction-card__total-amount",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary","data-testid":"transaction-estimated-total",children:to(ro)})})]})]})]})})]})},OldTransactionCard=({transaction:fr,currentToken:br,currencySymbol:wr,valueRounded:Er,transactionValue:kr,isGasSponsored:jr,gasFiatValue:Br,totalGasFiatValue:Wr,currency:qr,total:Gr,t:Vr,walletKey:Zr})=>{const{primaryWallet:Jr,projectSettings:Qr,overrides:_n}=useInternalDynamicContext(),En=useNetworkConfigurationsFromProjectSettings({evmNetworksOverrides:_n==null?void 0:_n.evmNetworks,projectSettings:Qr}),{chain:Cn}=useFetchChain(Jr==null?void 0:Jr.connector),In=getNetworkInfoEntry(Cn,En),An=()=>jsxRuntimeExports.jsx("div",{className:"transaction-card",children:jsxRuntimeExports.jsx("div",{className:"transaction-card__assets-container",children:jsxRuntimeExports.jsx("div",{className:"transaction-card__out",children:jsxRuntimeExports.jsxs("div",{className:"transaction-card__info-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",children:Vr("dyn_send_transaction.confirmation.data.transfer.send")}),jsxRuntimeExports.jsxs("div",{className:"transaction-card__amount-symbol",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__token-info",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__token-row",children:[jsxRuntimeExports.jsxs(Typography,{variant:"body_normal",color:"error-1","data-testid":"transaction-transfer-amount",children:["-",Er||(fr!=null&&fr.value?fr.format(fr.value,{precision:6}):"")]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",children:wr})]}),kr&&jsxRuntimeExports.jsxs(Typography,{variant:"body_small",color:"error-1","data-testid":"transaction-transfer-amount-fiat",children:["$",getDisplayFiatPrice(Number(kr)||Number(Er)||0,br)]})]}),jsxRuntimeExports.jsx("div",{className:"transaction-card__icon",children:jsxRuntimeExports.jsx("div",{className:"transaction-card__icon__container",children:jsxRuntimeExports.jsx("img",{src:(br==null?void 0:br.logoURI)||(In==null?void 0:In.nativeCurrency.iconUrl),alt:wr,width:32,height:32,className:"transaction-card__icon__container__main"})})})]})]})})})}),jn=()=>jsxRuntimeExports.jsx("div",{className:"transaction-card",children:jsxRuntimeExports.jsxs("div",{className:"transaction-card__details",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__row",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",copykey:"dyn_send_transaction.confirmation.data.destination",children:Vr("dyn_send_transaction.confirmation.data.destination")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary","data-testid":"transaction-destination",children:shortenWalletAddress(fr.to,4,4)})]}),!jr&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"transaction-card__divider"}),jsxRuntimeExports.jsxs("div",{className:"transaction-card__row",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary","data-testid":"transaction-network",copykey:"dyn_send_transaction.confirmation.data.network",children:Vr("dyn_send_transaction.confirmation.data.network")}),jsxRuntimeExports.jsxs("div",{className:"transaction-card__network-info",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:(In==null?void 0:In.name)||"Ethereum"}),jsxRuntimeExports.jsx("img",{src:(In==null?void 0:In.iconUrls[0])||(Cn==null?void 0:Cn.icon),alt:(In==null?void 0:In.name)||"Network icon",width:16,height:16,className:"transaction-card__network-icon"})]})]}),jsxRuntimeExports.jsx("div",{className:"transaction-card__divider"}),jsxRuntimeExports.jsxs("div",{className:"transaction-card__row",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-card__label-with-tooltip",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",copykey:"dyn_send_transaction.confirmation.data.gas_estimate",children:Vr("dyn_send_transaction.confirmation.data.gas_estimate")}),jsxRuntimeExports.jsx(Tooltip$2,{content:"Network fees are paid to process your transaction",className:"transaction-confirmation",children:jsxRuntimeExports.jsx(Icon,{size:"small",className:"fee-tooltip",children:jsxRuntimeExports.jsx(SvgTooltip,{})})})]}),jsxRuntimeExports.jsx("div",{className:"transaction-card__value",children:br!=null&&br.price?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary","data-testid":"transaction-estimated-gas-fee",children:Number(Br)<=.01?"<$0.01":`$${Br}`}):jsxRuntimeExports.jsxs(Typography,{variant:"body_normal",color:"primary","data-testid":"transaction-estimated-gas-fee",children:[fr.fee.gas?fr.format(fr.fee.gas,{precision:6}):"--"," ",qr]})})]}),jsxRuntimeExports.jsx("div",{className:"transaction-card__divider"}),jsxRuntimeExports.jsxs("div",{className:"transaction-card__row",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"bold",copykey:"dyn_send_transaction.confirmation.data.total",children:Vr("dyn_send_transaction.confirmation.data.total")}),jsxRuntimeExports.jsx("div",{className:"transaction-card__value",children:br!=null&&br.price?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary","data-testid":"transaction-total",children:Number(Wr)<=.01?"<$0.01":`$${Wr}`}):jsxRuntimeExports.jsxs(Typography,{variant:"body_normal",color:"primary","data-testid":"transaction-total",children:[Gr?fr.format(Gr,{precision:6}):"--"," ",qr]})})]})]})]})});return jsxRuntimeExports.jsxs("div",{className:"transaction-card-container",children:[An(),jn()]})},TransactionConfirmationPageLayout=({onClickClose:fr,isLoading:br,onClickBack:wr,onClickSend:Er,disableSendButton:kr,displayPoweredByDynamicFooter:jr=!1,alert:Br,walletConnector:Wr,transaction:qr,currentToken:Gr,children:Vr,hideModal:Zr,onSuccess:Jr,transactionValue:Qr,total:_n,isGasSponsored:En,isNativeToken:Cn,walletKey:In,simulationResult:An,sendBalanceTransaction:jn})=>{var eo;const{t:ro}=useTranslation(),{isTurnkeyWallet:to}=useIsTurnkeyWallet(),{setShowAuthFlow:_i}=useInternalDynamicContext(),{setView:oo}=useViewContext(),{userNeedsCrossDomainPasskey:io}=usePasskeyContext(),{initPasskeyRecoveryProcess:co,shouldInitRecovery:so}=usePasskeyRecovery(),{currency:no}=useFetchCurrency(Wr),Tn=useCurrencySymbol(Gr,no),{nativePrice:Hr}=useSendBalanceState();useHandleRecovery(Wr,usingSessionKey,Jr,so,co,Zr);const Xr=useHandleSubmitWithChecks({isTurnkeyWallet:to,onClickSend:Er,userNeedsCrossDomainPasskey:io,usingSessionKey,walletConnector:Wr},{initPasskeyRecoveryProcess:co,shouldInitRecovery:so},{setShowAuthFlow:_i,setView:oo}),Sn=fr&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:fr,"data-testid":"close",disabled:br,children:jsxRuntimeExports.jsx(SvgClose,{})}),Rn=wr&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:wr,"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgArrowLeft,{})}),Pn=getGasFiatValue(Gr,qr,Hr),On=getTotalFiatCost(Gr,qr,Hr,Qr);return Zr?null:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Sn,leading:Rn,alignContent:"bottom",children:jsxRuntimeExports.jsx("div",{className:"send-balance-page-layout__header-content",children:jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",copykey:"dyn_send_transaction.data.confirmation_tx",children:ro("dyn_send_transaction.data.confirmation_tx")})})}),jsxRuntimeExports.jsx("div",{className:"transaction-confirmation__banner",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",copykey:"dyn_send_transaction.data.banner",children:ro("dyn_send_transaction.data.banner")})}),jsxRuntimeExports.jsx(PasskeyCreatedSuccessBanner,{}),jsxRuntimeExports.jsxs("div",{className:"transaction-confirmation__body",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-confirmation__content",children:[jn?jsxRuntimeExports.jsx(OldTransactionCard,{transaction:qr,currentToken:Gr,currencySymbol:Tn,valueRounded:(eo=getValueRounded(!!Cn,qr))===null||eo===void 0?void 0:eo.toString(),transactionValue:Qr,isGasSponsored:En,gasFiatValue:Pn||"0",totalGasFiatValue:On||"0",currency:no,total:_n,t:ro,walletKey:In}):jsxRuntimeExports.jsx(TransactionCard,{transaction:qr,isGasSponsored:En,simulationResult:An}),Vr&&jsxRuntimeExports.jsx("div",{className:"transaction-confirmation__rows",children:Vr})]}),jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{}),children:Br&&jsxRuntimeExports.jsx("div",{className:"transaction-confirmation__warning",children:Br})}),jsxRuntimeExports.jsxs("div",{className:"transaction-confirmation__actions",children:[(wr||fr)&&jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"primary",buttonPadding:"small",onClick:wr||fr,expanded:!0,disabled:br,copykey:"dyn_send_transaction.confirmation.cancel_button",children:ro("dyn_send_transaction.confirmation.cancel_button")}),jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"brand-primary",buttonPadding:"small",onClick:Xr,expanded:!0,loading:br,disabled:kr,copykey:"dyn_send_transaction.confirmation.send",startSlot:jsxRuntimeExports.jsx(Icon,{size:"small",color:"text-secondary",children:jsxRuntimeExports.jsx(SvgSend,{})}),dataTestId:"transaction-confirmation-send",children:ro("dyn_send_transaction.confirmation.send")})]}),jr&&jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"transaction-confirmation__footer"})]})]})},getAppOrigin=()=>{if(typeof window<"u")return window.location.origin},simulateBlockaidEVMTransaction=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,chainId:wr,from:Er,to:kr,value:jr,data:Br}){try{const qr={environmentId:br,simulateEVMTransactionRequest:{chainId:wr,data:Br,from:Er,to:kr,value:jr}};return yield sdkApi$1().simulateEVMTransaction(qr)}catch(Wr){logger$6.warn("simulateBlockaidEVMTransaction error",Wr);return}}),simulateBlockaidSVMTransaction=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,chain:wr,accountAddress:Er,transactions:kr}){var jr;try{const Br={environmentId:br,simulateSVMTransactionRequest:{accountAddress:Er,chain:wr,domain:(jr=getAppOrigin())!==null&&jr!==void 0?jr:"https://example.com",method:"signAllTransactions",transactions:kr}};return yield sdkApi$1().simulateSVMTransaction(Br)}catch(Br){logger$6.warn("simulateBlockaidSVMTransaction error",Br);return}}),useTransactionTotal=({transactionValue:fr,gasTotalPrice:br,isGasSponsored:wr=!1})=>reactExports.useMemo(()=>wr?fr!==void 0?fr:BigInt(0):br!==void 0&&fr!==void 0?br+fr:fr||br,[br,fr,wr]),magicRpcError=-32603,errorCodesMapping={"-32002":"Insufficient funds for this transaction.",0:"The operation either timed out or was not allowed.",16:"Invalid Passkey signature. Select the passkey for this account and device.",3:"You reached the limit of passkeys for this account.",5:"Invalid Passkey signature.",INSUFFICIENT_FUNDS:"Insufficient funds for this transaction.",[magicRpcError.toString()]:"A network error has occurred. Please try again later"},errorReasonsMapping={"provided ENS name resolves to null":"Invalid address. Please check that the entered address is correct."},getCode$1=fr=>{var br;const wr=fr;return(wr==null?void 0:wr.code)||((br=wr==null?void 0:wr.cause)===null||br===void 0?void 0:br.code)},getMessage=fr=>{const br=fr;return br==null?void 0:br.message},hasReason=fr=>"reason"in fr&&fr.reason!==void 0,isTransactionExecutionError$1=fr=>fr!=null&&typeof fr=="object"&&"walk"in fr&&typeof fr.walk=="function",transactionErrorMessage=fr=>{let br=fr;if(isTransactionExecutionError$1(fr)&&(br=fr.walk()),logger$6.debug("transaction error:",br),TransactionGasCannotBeSponsoredError.isInstance(br))return;if(InsufficientFundsError$1.isInstance(br)||isMagicInsufficientFundsError(br))return errorCodesMapping.INSUFFICIENT_FUNDS;const wr=getCode$1(br);return wr!==void 0&&errorCodesMapping[wr]?errorCodesMapping[wr]:hasReason(br)&&errorReasonsMapping[br.reason]?errorReasonsMapping[br.reason]:"Something went wrong."},isMagicInsufficientFundsError=fr=>{const br=getCode$1(fr),wr=getMessage(fr);return br===magicRpcError&&!!(wr!=null&&wr.includes("insufficient funds for gas * price + value"))},FEE_REFRESH_INTERVAL=2e4;var SimulationStatus;(function(fr){fr.LOADING="loading",fr.FAILED="failed",fr.SKIPPED="skipped",fr.SUCCESS="success"})(SimulationStatus||(SimulationStatus={}));const TransactionConfirmationView=({transaction:fr,onError:br,onSuccess:wr,mutation:Er,onClickBack:kr,walletConnector:jr,onClickClose:Br,title:Wr,displayPoweredByDynamicFooter:qr=!1,copykey:Gr,hideModal:Vr,currentToken:Zr,isNativeToken:Jr,transactionValue:Qr,isModal:_n,sendBalanceTransaction:En})=>{var Cn;const{primaryWallet:In,environmentId:An}=useInternalDynamicContext(),[jn,eo]=reactExports.useState(!1),ro=useForceUpdate$1(),{t:to}=useTranslation(),{currency:_i}=useFetchCurrency(jr),oo=reactExports.useMemo(()=>{if(!(In!=null&&In.connector))return;const zn=In.connector;return zn._selectedChainId||zn.lastUsedChainId},[In==null?void 0:In.connector]),[io,co]=reactExports.useState({status:SimulationStatus.LOADING});useEffectOnce(()=>{__awaiter$e(void 0,void 0,void 0,function*(){var fo,vo;if(En||Vr){co({status:SimulationStatus.SKIPPED});return}if(!oo&&(In==null?void 0:In.chain)!=="SOL"){co({status:SimulationStatus.FAILED});return}try{let go;if(oo)go=yield simulateBlockaidEVMTransaction({chainId:String(oo),data:fr.data||"0x",environmentId:An,from:fr.from,to:fr.to||"",value:((vo=fr.value)===null||vo===void 0?void 0:vo.toString())||"0"});else{const uo=(fo=fr.multipleTransactions)===null||fo===void 0?void 0:fo.map(lo=>bs58$8.encode(lo.serialize({requireAllSignatures:!1})));if(!uo){co({status:SimulationStatus.FAILED});return}go=yield simulateBlockaidSVMTransaction({accountAddress:fr.from,chain:yield jr==null?void 0:jr.getNetwork(),environmentId:An,transactions:uo})}if(!go){co({status:SimulationStatus.FAILED});return}co({result:go,status:SimulationStatus.SUCCESS})}catch(go){logger$6.debug("Simulation failed:",go),co({status:SimulationStatus.FAILED})}})});const so=()=>{(In==null?void 0:In.chain)==="SOL"&&fr.fee.gas!==void 0||fr.fetchFee().finally(ro)},{isLoading:no}=usePromise(()=>isAccountAbstractionConnector(jr)?jr.canSponsorTransactionGas(fr):!1,{initialData:!1,onReject:logger$6.error,onResolve:zn=>{eo(zn),!zn&&isAccountAbstractionConnector(jr)&&jr.disableGasSponsorshipOnce()}});reactExports.useEffect(()=>{var zn;!((zn=fr.isGasSponsored)===null||zn===void 0)&&zn.call(fr)&&eo(!0)},[fr]);const{mutate:Tn,isLoading:Hr,error:Xr}=useMutation(Er,{onFailure:zn=>{so(),TransactionGasCannotBeSponsoredError.isInstance(zn)&&(logger$6.debug(zn),eo(!1),isAccountAbstractionConnector(jr)&&jr.disableGasSponsorshipOnce()),logger$6.error(zn),br==null||br(zn)},onSuccess:zn=>wr==null?void 0:wr(zn)});useInterval(so,Hr?null:FEE_REFRESH_INTERVAL),useEffectOnce(so);const Sn=useTransactionTotal({gasTotalPrice:fr.fee.gas,isGasSponsored:jn,transactionValue:fr.value}),Rn=Xr&&transactionErrorMessage(Xr),{data:Pn,isLoading:On}=usePromise(()=>fr.getBalance()),Zn=reactExports.useMemo(()=>!Sn||!Pn?!1:Pn{if(!(!Sn||!Pn))return Sn-Pn},[Sn,Pn]),wn=reactExports.useMemo(()=>{if(Rn)return null;if(TransactionGasCannotBeSponsoredError.isInstance(Xr))return jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",copykey:"dyn_send_transaction.error_message.gas_not_sponsored",children:to("dyn_send_transaction.error_message.gas_not_sponsored")});if(io.status===SimulationStatus.FAILED)return jsxRuntimeExports.jsxs(Alert,{icon:"error",variant:"warning",contentDataTestId:"warning_content",copykey:"dyn_send_transaction.warning_message.failed_simulation",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",copykey:"dyn_send_transaction.warning_message.failed_simulation.title",children:to("dyn_send_transaction.warning_message.failed_simulation.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",copykey:"dyn_send_transaction.warning_message.failed_simulation.description",children:to("dyn_send_transaction.warning_message.failed_simulation.description")})]});if(!no&&!On&&Nn===void 0&&fr.fee.gas&&!jn)return jsxRuntimeExports.jsxs(Alert,{icon:"error",variant:"error",contentDataTestId:"warning_content",copykey:"dyn_send_transaction.warning_message.insufficient_gas_funds",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",copykey:"dyn_send_transaction.warning_message.insufficient_gas_funds.title",children:to("dyn_send_transaction.warning_message.insufficient_gas_funds.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",copykey:"dyn_send_transaction.warning_message.insufficient_gas_funds.description",children:to("dyn_send_transaction.warning_message.insufficient_gas_funds.description",{amountLeft:fr.format(fr.fee.gas,{precision:6}),currencySymbol:_i})})]});if(!(Zn&&Nn))return;const fo=fr.format(Nn,{precision:5});return jsxRuntimeExports.jsxs(Alert,{icon:"error",variant:"warning",contentDataTestId:"warning_content",copykey:"dyn_send_transaction.warning_message.insufficient_funds",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",copykey:"dyn_send_transaction.warning_message.insufficient_funds.title",children:to("dyn_send_transaction.warning_message.insufficient_funds.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",copykey:"dyn_send_transaction.warning_message.insufficient_funds.description",children:to("dyn_send_transaction.warning_message.insufficient_funds.description",{amountLeft:fo,currencySymbol:_i})})]})},[Rn,Xr,io,no,On,Nn,fr,jn,Zn,to,_i]);return reactExports.useEffect(()=>{var zn,fo;io.status===SimulationStatus.SUCCESS&&!En&&((zn=io.result)===null||zn===void 0?void 0:zn.outAssets.length)===0&&!oo&&!(!((fo=fr.isGasSponsored)===null||fo===void 0)&&fo.call(fr))&&co({result:io.result,status:SimulationStatus.FAILED})},[io,oo,fr,En]),io.status===SimulationStatus.LOADING?null:jsxRuntimeExports.jsx(TransactionConfirmationPageLayout,{total:Sn,currentToken:Zr,transactionValue:Qr,isNativeToken:Jr,onClickBack:kr,onClickClose:Br,copykey:Gr,title:Wr,hideModal:Vr,isLoading:Hr,onClickSend:()=>Tn(),onSuccess:zn=>wr==null?void 0:wr(zn),displayPoweredByDynamicFooter:qr,disableSendButton:On,error:Rn,alert:wn,walletConnector:jr,transaction:fr,isGasSponsored:jn,isGasSponsoredLoading:no,walletKey:(In==null?void 0:In.key)||"",simulationResult:(Cn=io.result)!==null&&Cn!==void 0?Cn:void 0,sendBalanceTransaction:En})},PasskeyContext=reactExports.createContext(void 0),PasskeyContextProviderWithBrowser=({children:fr})=>{var br,wr,Er,kr,jr,Br,Wr,qr;const{userHasEmbeddedWallet:Gr}=useEmbeddedWallet(),{isSessionKeyCompatible:Vr,isTurnkeyWalletWithoutAuthenticator:Zr}=useIsTurnkeyWallet(),{environmentId:Jr,projectSettings:Qr,user:_n}=useInternalDynamicContext(),[En,Cn]=reactExports.useState(!1),[In,An]=reactExports.useState(void 0),[jn,eo]=reactExports.useState(void 0),[ro,to]=useLocalStorage$1(EMBEDDED_WALLET_SECURE_BANNER,!0),_i=reactExports.useMemo(()=>{var Tn,Hr,Xr,Sn;const Rn=!!(!((Sn=(Xr=(Hr=(Tn=Qr==null?void 0:Qr.sdk)===null||Tn===void 0?void 0:Tn.embeddedWallets)===null||Hr===void 0?void 0:Hr.supportedSecurityMethods)===null||Xr===void 0?void 0:Xr.passkey)===null||Sn===void 0)&&Sn.isEnabled);return ro!==!1&&Zr&&Rn},[Zr,ro,(kr=(Er=(wr=(br=Qr==null?void 0:Qr.sdk)===null||br===void 0?void 0:br.embeddedWallets)===null||wr===void 0?void 0:wr.supportedSecurityMethods)===null||Er===void 0?void 0:Er.passkey)===null||kr===void 0?void 0:kr.isEnabled]),oo=reactExports.useCallback(()=>{var Tn,Hr,Xr,Sn;const Rn=!!(!((Sn=(Xr=(Hr=(Tn=Qr==null?void 0:Qr.sdk)===null||Tn===void 0?void 0:Tn.embeddedWallets)===null||Hr===void 0?void 0:Hr.supportedSecurityMethods)===null||Xr===void 0?void 0:Xr.passkey)===null||Sn===void 0)&&Sn.isEnabled);return!Vr&&(!_i&&Zr&&Rn)},[(qr=(Wr=(Br=(jr=Qr==null?void 0:Qr.sdk)===null||jr===void 0?void 0:jr.embeddedWallets)===null||Br===void 0?void 0:Br.supportedSecurityMethods)===null||Wr===void 0?void 0:Wr.passkey)===null||qr===void 0?void 0:qr.isEnabled,_i,Vr,Zr]),io=usePromise(()=>__awaiter$e(void 0,void 0,void 0,function*(){return(yield getUserPasskeys({environmentId:Jr})).passkeys}),{deps:[Jr,_n,Gr(),En],enabled:!!(Jr&&_n&&Gr())}),co=reactExports.useMemo(()=>{if(typeof window>"u")return!1;const Tn=PlatformService.getHostname();return io.data?io.data.some(Hr=>{if(!Hr.origin)return!1;try{const Xr=new URL(Hr.origin).hostname;return Xr===getTLD()||Xr===Tn}catch(Xr){return logger$6.error(Xr),!1}}):!1},[io.data]),so=!Zr&&!co,no=reactExports.useMemo(()=>{var Tn;return{passkey:In,passkeyEdited:En,passkeyIcon:jn,setPasskey:An,setPasskeyEdited:Cn,setPasskeyIcon:eo,setShowSecureAccountBanner:to,showAlert:oo,showSecureAccountBanner:_i,userHasPasskeysForCurrentOrigin:co,userNeedsCrossDomainPasskey:so,userPasskeys:(Tn=io.data)!==null&&Tn!==void 0?Tn:[],userPasskeysLoading:io.isLoading}},[In,En,jn,co,io.data,io.isLoading,so,oo,to,_i]);return jsxRuntimeExports.jsx(PasskeyContext.Provider,{value:no,children:fr})},PasskeyContextProvider=({children:fr})=>jsxRuntimeExports.jsx(PasskeyContextProviderWithBrowser,{children:fr}),usePasskeyContext=()=>{const fr=reactExports.useContext(PasskeyContext);if(fr===void 0)throw new Error("usage of PasskeyContext not wrapped in `PasskeyContextProvider`.");return fr},useOnlyConnectedMode=()=>{const{authMode:fr,user:br}=useInternalDynamicContext();return fr==="connect-only"&&!br},useKYCFlag=()=>{const fr=useOnlyConnectedMode(),{projectSettings:br,user:wr}=useInternalDynamicContext();return fr?!1:getUserProfileFields({customFields:br==null?void 0:br.customFields,projectSettingsKyc:br==null?void 0:br.kyc,user:wr}).length>0||isSocialKycEnabled(br)},useViewController=fr=>{const[br,wr]=reactExports.useState(null);return{goToInitialView:()=>wr(null),setView:wr,view:br||fr}},DynamicWidgetContext=reactExports.createContext(void 0),DynamicWidgetContextProvider=({children:fr})=>{const br=reactExports.useRef(null),wr=reactExports.useRef(null),Er=reactExports.useRef(null),{setShowDynamicUserProfile:kr,showDynamicUserProfile:jr,multiWallet:Br}=useInternalDynamicContext(),Wr=useKYCFlag(),{view:qr,setView:Gr,goToInitialView:Vr}=useViewController(Wr&&!Br?"profile":"wallets"),[Zr,Jr]=reactExports.useState({}),Qr=reactExports.useCallback((In,An)=>{Gr(In),Jr(An||{})},[Gr]),_n=reactExports.useCallback(()=>{if(Wr)return Qr("profile");Qr("wallets")},[Wr,Br]),En=reactExports.useMemo(()=>qr==="manage-passkeys"||qr==="manage-mfa"?"settings":!Wr&&!Br&&qr!=="settings"&&qr!=="profile"?"wallets":qr==="edit-profile"?"profile":qr==="global-wallet"?"wallets":qr,[qr,Wr,Br]);useInternalDynamicEvents("logout",()=>Vr());const Cn=reactExports.useMemo(()=>({availableWalletsContainerRef:Er,dynamicWidgetView:qr,goToInitialDynamicWidgetView:Vr,goToProfileView:_n,inlineControlsRef:wr,isOpen:jr,overridenWidgetView:En,setDynamicWidgetView:Qr,setIsOpen:kr,viewProps:Zr,widgetRef:br}),[qr,Vr,_n,jr,Qr,kr,En,Zr]);return jsxRuntimeExports.jsx(DynamicWidgetContext.Provider,{value:Cn,children:fr})},useWidgetContext=()=>{const fr=reactExports.useContext(DynamicWidgetContext);if(fr===void 0)throw new Error("usage of useWidgetContext not wrapped in `DynamicWidgetContextProvider`.");return fr};var _path$Y,_excluded$15=["title","titleId"];function _extends$15(){return _extends$15=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$15(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgAdd=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$15(br,_excluded$15);return reactExports.createElement("svg",_extends$15({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$Y||(_path$Y=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 2c.368 0 .667.298.667.667v4.666h4.666a.667.667 0 1 1 0 1.334H8.667v4.666a.667.667 0 1 1-1.334 0V8.667H2.667a.667.667 0 0 1 0-1.334h4.666V2.667C7.333 2.298 7.632 2 8 2Z",fill:"currentColor",fillOpacity:.4})))},_path$X,_excluded$14=["title","titleId"];function _extends$14(){return _extends$14=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$14(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgLink=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$14(br,_excluded$14);return reactExports.createElement("svg",_extends$14({width:17,height:16,viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$X||(_path$X=reactExports.createElement("path",{d:"M11.833 4.667H9.167V6h2.666c1.1 0 2 .9 2 2s-.9 2-2 2H9.167v1.333h2.666a3.335 3.335 0 0 0 0-6.666Zm-4 5.333H5.167c-1.1 0-2-.9-2-2s.9-2 2-2h2.666V4.667H5.167a3.335 3.335 0 0 0 0 6.666h2.666V10Zm-2-2.667h5.334v1.334H5.833V7.333Z",fill:"currentColor"})))};const getActiveOauthCredential=fr=>{var br;return(br=fr==null?void 0:fr.verifiedCredentials)===null||br===void 0?void 0:br.find(wr=>wr.format==="oauth"&&wr.id===fr.lastVerifiedCredentialId)},getCustomCountries=fr=>{const br=R$5.map(M$3).map(wr=>(wr.iso2==="br"&&(wr.format="(..) .....-...."),wr.iso2==="fr"&&(wr.format="(.) .. .. .. .."),Se(wr)));return fr?br.filter(([,wr])=>fr.includes(wr)):br},formatPhone=fr=>{var br;const{country:wr}=X$4({countries:getCustomCountries(),phone:fr});if(!wr)return fr;const Er=de$3({dialCode:wr.dialCode,phone:fr}),kr=Q$4({country:wr,phone:fr}),jr=/\./g;if(((br=kr.match(jr))!==null&&br!==void 0?br:[]).length!==removeNonDigits(Er).length)return fr;let Br=0;const Wr=kr.replace(jr,()=>Er[Br++]);return`+${wr.dialCode} ${Wr}`},removeNonDigits=fr=>fr.replace(/\D+/g,""),getUserIdentifier=fr=>{const br=getActiveOauthCredential(fr);return br!=null&&br.publicIdentifier?br.publicIdentifier:fr!=null&&fr.email?shortenEmail(fr.email):fr!=null&&fr.phoneNumber?formatPhone(fr.phoneNumber):"My Profile"},Image$1=({src:fr,alt:br="",fallback:wr,className:Er,dataTestId:kr})=>{const[jr,Br]=reactExports.useState(!1),Wr=()=>{Br(!0)};return fr&&!jr?jsxRuntimeExports.jsx("img",{src:fr,alt:br,onError:Wr,className:Er,"data-testid":kr}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:wr})},UserAvatar=({user:fr,containerClassName:br,renderWithFallback:wr=!0})=>{const kr=(()=>{var jr,Br,Wr;return(Wr=(Br=(jr=fr==null?void 0:fr.verifiedCredentials)===null||jr===void 0?void 0:jr.find(Gr=>{var Vr;return fr.lastVerifiedCredentialId===Gr.id&&((Vr=Gr.oauthAccountPhotos)===null||Vr===void 0?void 0:Vr.length)}))===null||Br===void 0?void 0:Br.oauthAccountPhotos)===null||Wr===void 0?void 0:Wr[0]})();return!kr&&!wr?null:jsxRuntimeExports.jsx("div",{className:classNames$1("user-profile-social-account__connected-avatar",br),children:jsxRuntimeExports.jsx(Image$1,{className:"user-profile-social-account__image",src:kr,alt:"User avatar",dataTestId:"user-avatar",fallback:jsxRuntimeExports.jsx(UserProfileIcon,{})})})},SecureEmbeddedWalletCard=({className:fr})=>{const{t:br}=useTranslation(),{primaryWallet:wr}=useInternalDynamicContext(),{initPasskeyRecoveryProcess:Er}=usePasskeyRecovery(),{showSecureAccountBanner:kr,setShowSecureAccountBanner:jr}=usePasskeyContext(),{getEOAWallet:Br}=useSmartWallets(),Wr=wr&&Br(wr),qr=wr&&isSessionKeyCompatibleWallet(wr)||Wr&&isSessionKeyCompatibleWallet(Wr);return!kr||qr?null:jsxRuntimeExports.jsxs("div",{className:classNames$1("secure-embedded-wallet-card",fr),children:[jsxRuntimeExports.jsxs("div",{className:"secure-embedded-wallet-card__text-content","data-testid":"secure-wallet-button",onClick:()=>Er(),children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",copykey:"dyn_secure_pregenerated_wallet.description",children:br("dyn_secure_pregenerated_wallet.description")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"bold",color:"brand-primary",copykey:"dyn_secure_pregenerated_wallet.action",className:"secure-embedded-wallet-card__link",children:br("dyn_secure_pregenerated_wallet.action")})]}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(IconButton,{color:"text-secondary",onClick:()=>jr(!1),children:jsxRuntimeExports.jsx(SvgClose,{width:16,height:16})})})]})},ONRAMP_PROVIDERS=["banxa"],isOnrampProvider=fr=>ONRAMP_PROVIDERS.includes(fr.provider),getWalletAdditionalAddressByType=(fr,br)=>{var wr,Er;return(Er=(wr=br==null?void 0:br.additionalAddresses)===null||wr===void 0?void 0:wr.find(kr=>kr.type===fr))===null||Er===void 0?void 0:Er.address},getOnrampProviders=fr=>__awaiter$e(void 0,[fr],void 0,function*({chain:br,environmentId:wr,networkId:Er,token:kr,walletAddress:jr}){const{onramps:Br}=yield sdkApi$1().getSupportedOnramps({chain:br,environmentId:wr,networkId:Er?String(Er):void 0,token:kr,walletAddress:jr});if(!Br||Br.length===0)throw new Error("No onramps");return Br}),FundingContext=reactExports.createContext(void 0),FundingContextProvider=({children:fr})=>{var br,wr;const Er=reactExports.useRef(null),[kr,jr]=reactExports.useState(!1),[Br,Wr]=reactExports.useState(!1),[qr,Gr]=reactExports.useState(""),{environmentId:Vr,network:Zr,primaryWallet:Jr,projectSettings:Qr}=useInternalDynamicContext(),_n=(wr=(br=Qr==null?void 0:Qr.providers)===null||br===void 0?void 0:br.some(In=>isOnrampProvider(In)&&!!In.enabledAt))!==null&&wr!==void 0?wr:!1,En=reactExports.useCallback((...In)=>__awaiter$e(void 0,[...In],void 0,function*({address:An,token:jn}={}){var eo;if(!_n||!Jr)return;const ro=(eo=getChainInfo(Jr.chain))===null||eo===void 0?void 0:eo.name;if(!ro)return;const to=isBitcoinConnector(Jr.connector)&&getWalletAdditionalAddressByType(WalletAddressType.Payment,Jr),_i=Zr&&ro==="evm";try{const[{url:oo}]=yield getOnrampProviders({chain:ro,environmentId:Vr,networkId:_i?Zr.toString():void 0,token:jn,walletAddress:An||to||Jr.address});if(!oo)throw new Error("No onramp url found");Gr(oo),Wr(!0)}catch{Wr(!1)}}),[Vr,_n,Zr,Jr]),Cn=reactExports.useMemo(()=>({fundingEnabled:_n,fundingRef:Er,fundingUrl:qr,setShowFunding:jr,showFunding:kr,supportsFunding:Br,updateSupportsFunding:En}),[_n,qr,kr,Br,En]);return reactExports.useEffect(()=>{En()},[Vr,_n,Zr,Jr==null?void 0:Jr.address]),jsxRuntimeExports.jsx(FundingContext.Provider,{value:Cn,children:fr})},useFundingContext=()=>{const fr=reactExports.useContext(FundingContext);if(fr===void 0)throw new Error("usage of useFundingContext not wrapped in `FundingContextProvider`.");return fr},useConfirmationModal=({elementId:fr})=>{const{createRootElement:br}=useElementById(),wr=br(fr),[Er,kr]=reactExports.useState(null),jr=reactExports.useCallback(Br=>__awaiter$e(void 0,void 0,void 0,function*(){return new Promise((qr,Gr)=>{try{kr(Br(qr,Gr))}catch(Vr){Gr(Vr)}}).finally(()=>{kr(void 0)})}),[kr]);return{modal:Er?jsxRuntimeExports.jsx("div",{children:reactDomExports.createPortal(Er,wr.current)}):void 0,open:jr}},usePreventPageScroll=fr=>{const br=()=>{var Er;const kr=document.querySelector("html"),jr=document.querySelector("body");if(!kr||!jr)return;const Br=(Er=window==null?void 0:window.screen)===null||Er===void 0?void 0:Er.height;!(jr.scrollHeight>Br)||Br===0||(kr.classList.add("dynamic-no-scroll"),jr.classList.add("dynamic-no-scroll"))},wr=Er=>{const kr=document.querySelector("html"),jr=document.querySelector("body");!kr||!jr||(kr.classList.remove("dynamic-no-scroll"),jr.classList.remove("dynamic-no-scroll"),isIOS()&&window.scrollTo(Er.x,Er.y))};reactExports.useEffect(()=>{if(!fr)return;const Er={x:window.scrollX,y:window.scrollY};return br(),()=>{wr(Er)}},[fr])},Modal$1=({children:fr,className:br,isShown:wr=!0,transitionProps:Er})=>jsxRuntimeExports.jsx("div",{className:classNames$1("modal",br),children:jsxRuntimeExports.jsx(SlideInUpTransition,Object.assign({},Er,{isShown:wr,children:jsxRuntimeExports.jsx("div",{className:"modal__items",children:fr})}))}),ModalCard=({children:fr,borderRadius:br="default",border:wr=!1,sharpBottomRadiusOnMobile:Er=!0,dataTestId:kr="modal-card"})=>jsxRuntimeExports.jsx("div",{"data-testid":kr,className:classNames$1("modal-card",{"modal-card--sharp-mobile-bottom-radius":Er,"modal-card--with-border":wr},`modal-card--radius-${br}`),children:fr}),useKeyboardEventListener=({disabled:fr,inputKey:br,onKeyPressed:wr})=>{reactExports.useEffect(()=>{const Er=kr=>{fr||kr.key!==br||wr(kr)};return document.addEventListener("keydown",Er),()=>{document.removeEventListener("keydown",Er)}},[fr,br,wr])},ModalComponent=({children:fr,handleClose:br,withBackdrop:wr=!0,zIndex:Er,whiteList:kr})=>{const{view:jr}=useViewContext(),Br=(jr==null?void 0:jr.type)&&jr.type!=="collect-user-data"&&jr.type!=="login-with-email-verification"&&jr.type!=="login-with-sms-verification"&&jr.type!=="verify-sms"&&jr.type!=="verify-email"&&jr.type!=="mfa-verification"&&jr.type!=="mfa-display-backup-codes",Wr=qr=>{Br&&(qr.stopPropagation(),br(qr))};return useKeyboardEventListener({disabled:!Br,inputKey:"Escape",onKeyPressed:br}),jsxRuntimeExports.jsxs(FocusLockCombination,{className:"portal__container",whiteList:kr,children:[wr&&jsxRuntimeExports.jsx("div",{"data-testid":"portal-backdrop",role:"button",onClick:qr=>{Wr(qr)},tabIndex:0,"aria-label":"Close modal",style:{zIndex:Er?Er-2:void 0},className:"portal__backdrop"}),jsxRuntimeExports.jsx("div",{style:{zIndex:Er},children:fr})]})},Portal$4=({children:fr,isShown:br,handleClose:wr,withBackdrop:Er,zIndex:kr,transitionEvents:jr,elementId:Br="dynamic-modal"})=>{const{createRootElement:Wr}=useElementById(),qr=Wr(Br);return reactDomExports.createPortal(jsxRuntimeExports.jsx(ShadowDOM,{zIndex:kr,dataTestId:"dynamic-modal-shadow",children:jsxRuntimeExports.jsx(OpacityTransition,Object.assign({isShown:br},jr,{children:jsxRuntimeExports.jsx(ModalComponent,{handleClose:wr,withBackdrop:Er,whiteList:Gr=>qr.current.contains(Gr),children:fr})}))}),qr.current)},ChainIcon=({chain:fr,chainName:br})=>{const wr=getChainIcon(br);return jsxRuntimeExports.jsx(Icon,{size:"small",children:fr!=null&&fr.icon?jsxRuntimeExports.jsx("img",{src:fr.icon,alt:`${fr.name} icon`}):jsxRuntimeExports.jsx(wr,{})})},getOrdinalNumber=fr=>fr<1?"":fr%10===1&&fr%100!==11?`${fr}st`:fr%10===2&&fr%100!==12?`${fr}nd`:fr%10===3&&fr%100!==13?`${fr}rd`:`${fr}th`,FormFieldLabel=({children:fr,htmlFor:br,className:wr,divider:Er})=>jsxRuntimeExports.jsx("label",{className:classNames$1("form-field-label",{"form-field-label__with-divider":Er},wr),htmlFor:br,children:fr});var _path$W,_excluded$13=["title","titleId"];function _extends$13(){return _extends$13=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$13(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgStroke=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$13(br,_excluded$13);return reactExports.createElement("svg",_extends$13({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$W||(_path$W=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.293 19.707a1 1 0 0 1 0-1.414L14.586 12 8.293 5.707a1 1 0 0 1 1.414-1.414l7 7a1 1 0 0 1 0 1.414l-7 7a1 1 0 0 1-1.414 0Z",fill:"currentColor"})))};const Skeleton$1=({count:fr=1,className:br,style:wr})=>{const Er=[];for(let kr=0;krjsxRuntimeExports.jsx("span",{"data-testid":"loading-skeleton",children:kr},`skeleton-${jr}`))})},erc20Abi$2=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}],OverlayCard=({isOpen:fr,children:br,onClickOverlay:wr,style:Er,className:kr})=>{const jr=useOverlayCardTarget(fr);usePreventPageScroll(fr&&!jr);const Br=reactExports.useRef(null);useOnClickOutside(Br,()=>wr==null?void 0:wr());const Wr=jsxRuntimeExports.jsxs("div",{className:classNames$1("overlay-card",{"overlay-card--disabled":!fr}),style:{position:jr===void 0?"fixed":"absolute"},children:[jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(OpacityTransition,{className:"overlay-card__animation"}),children:fr&&jsxRuntimeExports.jsx("div",{onClick:wr,className:"overlay-card__overlay"})}),jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(SlideInUpTransition,{className:"overlay-card__animation overlay-card__animation--limit-height"}),children:fr&&jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(OpacityTransition,{className:"overlay-card__animation"}),children:fr&&jsxRuntimeExports.jsx("div",{ref:Br,className:classNames$1(kr,"overlay-card__content"),style:Er,children:br})})})]});return jr?reactDomExports.createPortal(Wr,jr):reactDomExports.createPortal(jsxRuntimeExports.jsx(ShadowDOM,{children:Wr}),document.body)},MenuList=({isOpen:fr,onClickClose:br,popperProps:wr,dropdownClassName:Er,dropdownStyle:kr,overlayCardClassName:jr,overlayCardStyle:Br,className:Wr,style:qr,children:Gr,mobileTitle:Vr})=>{const Zr=jsxRuntimeExports.jsx(IconButton,{onClick:br,type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})});return isMobile()?jsxRuntimeExports.jsxs(OverlayCard,{isOpen:fr,onClickOverlay:br,className:classNames$1(jr,Wr),style:Object.assign(Object.assign({},qr),Br),children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Zr,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary",children:Vr})}),jsxRuntimeExports.jsx("div",{className:"menu-list__overlay-card__container",children:Gr})]}):jsxRuntimeExports.jsx(Dropdown$1,Object.assign({isOpen:fr,onClickOutside:br,onScroll:br,className:classNames$1(Er,Wr),style:Object.assign(Object.assign({},qr),kr)},wr,{children:Gr}))},TokensBalanceDropdown=({tokenBalances:fr,currentToken:br,setCurrentToken:wr,isLoading:Er,setFieldValue:kr,setErrors:jr})=>{const{t:Br}=useTranslation(),[Wr,qr]=reactExports.useState(!1),Gr=(fr==null?void 0:fr.filter(En=>En.name))||[],{primaryWallet:Vr}=useInternalDynamicContext(),Zr=reactExports.useRef(null),Jr=En=>__awaiter$e(void 0,void 0,void 0,function*(){if(!Vr||!("getPublicClient"in Vr)||typeof Vr.getPublicClient!="function")return;const Cn=yield Vr.getPublicClient();if(!Cn)return;const In={abi:erc20Abi$2,address:En.address},An=yield Cn.multicall({contracts:[Object.assign(Object.assign({},In),{args:[Vr==null?void 0:Vr.address],functionName:"balanceOf"}),Object.assign(Object.assign({},In),{functionName:"decimals"})]}),[jn,eo]=An.map(ro=>Number(ro.result));if(jn&&eo){if(En.balance=jn/Math.pow(10,eo),En.rawBalance=jn,fr){const ro=fr.findIndex(to=>to.name===En.name);fr[ro]=En}En.decimals=eo}}),Qr=En=>__awaiter$e(void 0,void 0,void 0,function*(){var Cn,In;const An=(Cn=fr==null?void 0:fr.find(jn=>jn.name===En))!==null&&Cn!==void 0?Cn:void 0;An!=null&&An.address&&(An!=null&&An.address.startsWith("0x"))&&Jr(An),An&&(fr&&(!((In=fr[0])===null||In===void 0)&&In.price)&&setSendBalanceVariable("nativePrice",fr[0].price),wr(An),kr("amount",""),setSendBalanceVariable("amount",0),jr({})),qr(!Wr)});if(Er)return jsxRuntimeExports.jsx(Skeleton$1,{});const _n=(En,Cn)=>En!=null&&En.logoURI?jsxRuntimeExports.jsx("img",{src:En.logoURI,alt:En==null?void 0:En.name,width:Cn,height:Cn}):jsxRuntimeExports.jsx("div",{className:"token-balance-item__skeleton-icon","data-testid":"token-balance-item__skeleton-icon"});return jsxRuntimeExports.jsxs("div",{className:"tokens-balance-dropdown",ref:Zr,onClick:()=>qr(!Wr),"data-testid":"tokens-balance-dropdown",children:[!Er&&jsxRuntimeExports.jsxs("div",{className:"tokens-balance-dropdown__selected",children:[_n(br,"20"),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:br==null?void 0:br.name}),jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"small",className:classNames$1("evm-network-control__arrow-icon",{"evm-network-control__arrow-icon--active":Wr}),children:jsxRuntimeExports.jsx(SvgStroke,{})})]}),jsxRuntimeExports.jsx(MenuList,{className:"tokens-balance-dropdown__menu_list",isOpen:Wr,popperProps:{anchorOrigin:"bottom-left",anchorRef:Zr},mobileTitle:"Select token",children:Gr.length>0?Gr.map(En=>jsxRuntimeExports.jsxs("button",{className:"tokens-balance-dropdown__menu_list_item",onClick:()=>Qr(En.name),children:[jsxRuntimeExports.jsxs("div",{className:"tokens-balance-dropdown__menu_list_item__name",children:[_n(En,"16"),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",children:En.name})]}),jsxRuntimeExports.jsxs("div",{className:"tokens-balance-dropdown__menu_list_item__balance",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:En.symbol}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",children:roundToNthDecimal(En.balance,6)})]})]},En.address)):jsxRuntimeExports.jsx("div",{className:"token-balance-list__empty",children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:Br("dyn_wallet_information.multi_asset.empty_state")})})})]})},sendBalanceFormInitialValues={amount:"",recipient:""},getDisplayErrorMessage$1=(fr,br,wr,Er)=>{const kr={amount:{invalidDecimals:br("dyn_send_transaction.validation.amount.invalid_decimals",{decimals:Er}),invalidFormat:br("dyn_send_transaction.validation.amount.invalid_decimals",{decimals:Er}),overBalance:br("dyn_send_transaction.validation.amount.over_balance"),required:br("dyn_send_transaction.validation.amount.required")},recipient:{invalidFormat:br("dyn_send_transaction.validation.recipient.invalid_format"),required:br("dyn_send_transaction.validation.recipient.required")}},jr=fr[wr];return jr?kr[wr][jr].replace("{decimals}",getOrdinalNumber(Er??0)):""},SendBalanceForm=({initialValues:fr,onSubmit:br,decimals:wr=18,validateAddress:Er=()=>!0,validateAmount:kr=()=>!0,currentToken:jr,transaction:Br,tokenBalances:Wr,setCurrentToken:qr,isLoading:Gr})=>{const{t:Vr}=useTranslation(),{showFiat:Zr}=useInternalDynamicContext(),Jr=reactExports.useRef(null),[Qr,_n]=reactExports.useState(0),{amount:En}=useSendBalanceState();reactExports.useEffect(()=>{if(Jr.current){const In=Jr.current.offsetWidth;_n(In+15)}},[jr]);const Cn=reactExports.useMemo(()=>{const In=new RegExp(`^\\d*(\\.\\d{1,${wr}})?$`);return create$5().shape({amount:create$6().required("required").matches(/^\d*(\.\d+)?$/,"invalidFormat").matches(In,"invalidDecimals").test({message:"overBalance",test:An=>kr(An)}),recipient:create$6().required("required").test({message:"invalidFormat",test:An=>Er(An)})})},[wr,Er,kr]);return jsxRuntimeExports.jsx(Formik,{initialValues:fr||sendBalanceFormInitialValues,validationSchema:Cn,onSubmit:In=>br(In),validateOnChange:!1,validateOnBlur:!1,children:({errors:In,touched:An,values:jn,handleChange:eo,setFieldValue:ro,setErrors:to,handleBlur:_i,setFieldTouched:oo,validateField:io})=>{var co;return jsxRuntimeExports.jsxs(Form,{className:"send-balance-form",children:[jsxRuntimeExports.jsxs("div",{className:"send-balance-page-layout__balance-container",children:[jsxRuntimeExports.jsx(FormFieldLabel,{children:"Select any token"}),jsxRuntimeExports.jsx(TokensBalanceDropdown,{tokenBalances:Wr??(jr&&[jr]),currentToken:jr,setCurrentToken:qr,isLoading:Gr,setFieldValue:ro,setErrors:to})]}),jsxRuntimeExports.jsxs("div",{className:"send-balance-form__amount-container",children:[jsxRuntimeExports.jsx(Field$2,{variant:"regular",className:`send-balance-form__amount-container__field ${Zr?"fiat":""}`,name:"amount",id:"amount",onChange:so=>{const no=so.target.value;if(!(no!==""&&!/^(?:\d+|\d*\.\d*|)$/.test(no))){if(to({}),eo(so),!no||Number.isNaN(no)){setSendBalanceVariable("amount",0);return}setSendBalanceVariable("amount",jr!=null&&jr.price?Number(no):void 0)}},onBlur:so=>{_i(so),oo("amount",!0),io("amount")},placeholder:Vr("dyn_send_transaction.data.amount.placeholder"),as:Input,error:In.amount,copykey:"dyn_send_transaction.data.amount.label",message:An.amount&&getDisplayErrorMessage$1(In,Vr,"amount",wr),style:{paddingLeft:`${Qr}px`}}),jsxRuntimeExports.jsx("div",{className:"send-balance-form__amount-container__floating_value",ref:Jr,children:jsxRuntimeExports.jsx(Typography,{variant:"title",weight:"regular",color:"secondary",children:jr==null?void 0:jr.symbol})}),jsxRuntimeExports.jsx("div",{className:"send-balance-form__amount-container__balance",children:Zr&&!Number.isNaN(En)&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_mini",weight:"bold",color:"secondary",children:"$"}),jsxRuntimeExports.jsx(Typography,{variant:"body_mini",weight:"regular",color:"secondary",children:getDisplayFiatPrice(En,jr)})]})})]}),jsxRuntimeExports.jsx(Typography,{className:"send-balance-form__amount_available",variant:"body_small",weight:"regular",color:"secondary",as:"div",children:jsxRuntimeExports.jsxs("div",{style:{display:"flex",gap:"0.225rem"},children:[jsxRuntimeExports.jsx(Typography,{className:"send-balance-form__amount_available__line",variant:"body_small",weight:"bold",color:"primary",as:"div",children:(co=roundToNthDecimal(jr==null?void 0:jr.balance,6))!==null&&co!==void 0?co:0}),`${jr==null?void 0:jr.symbol} Available`]})}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",children:"Recipient Address"}),jsxRuntimeExports.jsx(Field$2,{className:"send-balance-form__field",placeholder:Vr("dyn_send_transaction.data.recipient.placeholder"),label:Vr("dyn_send_transaction.data.recipient.label"),id:"recipient",name:"recipient",as:Input,error:In.recipient,copykey:"dyn_send_transaction.data.recipient.label",message:An.recipient&&getDisplayErrorMessage$1(In,Vr,"recipient")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"sendBalanceFormSubmitButton",expanded:!0,type:"submit",buttonVariant:"primary",buttonPadding:"small",buttonClassName:"send-balance-form__button",copykey:"dyn_send_transaction.preview_transaction",children:Vr("dyn_send_transaction.preview_transaction")})]})}})},zeroAddress$2="0x0000000000000000000000000000000000000000",nativeSolanaAddress$1="11111111111111111111111111111111",SendBalancePageLayout=({error:fr,onClickClose:br,onClickBack:wr,onSubmit:Er,displayPoweredByDynamicFooter:kr=!1,transaction:jr,networkCurrencyDecimals:Br,tokenBalances:Wr,currentToken:qr,setCurrentToken:Gr,isLoading:Vr,isNativeToken:Zr})=>{var Jr;const{t:Qr}=useTranslation(),{primaryWallet:_n,projectSettings:En,overrides:Cn}=useInternalDynamicContext(),In=useNetworkConfigurationsFromProjectSettings({evmNetworksOverrides:Cn==null?void 0:Cn.evmNetworks,projectSettings:En}),An=_n==null?void 0:_n.connector,{chain:jn}=useFetchChain(An),eo=br&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:br,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})}),ro=wr&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:wr,"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgArrowLeft,{})}),{data:to}=usePromise(()=>jr.getBalance(),{deps:[jr]});reactExports.useEffect(()=>{const oo=()=>__awaiter$e(void 0,void 0,void 0,function*(){const co=getNetworkInfoEntry(jn,In);if(!co){logger$6.error("Token info not found. Please make sure you are on a supported chain and it is enabled. See https://docs.dynamic.xyz/chains/enabling-chains");return}const so={address:(jn==null?void 0:jn.name)==="Solana"?nativeSolanaAddress$1:zeroAddress$2,balance:0,decimals:co.nativeCurrency.decimals,logoURI:co.nativeCurrency.iconUrl||co.iconUrls[0],name:co.name,rawBalance:0,symbol:co.nativeCurrency.symbol},no=yield _n==null?void 0:_n.getBalance();no&&(so.balance=Number(no),so.rawBalance=Number(no)/Math.pow(10,so.decimals)),Gr(so)});__awaiter$e(void 0,void 0,void 0,function*(){Vr||(Wr===void 0||Array.isArray(Wr)&&Wr.length===0?yield oo():qr||Gr(Wr[0]))})},[Wr,jn]);const _i=()=>Zr?jr.value?jr.format(jr.value):"":jr!=null&&jr.formatNonNativeToken&&(jr!=null&&jr.nonNativeValue)&&(jr!=null&&jr.nonNativeDecimal)?jr.formatNonNativeToken(jr.nonNativeValue,jr.nonNativeDecimal):"";return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{leading:ro,trailing:eo,alignContent:"bottom",children:jsxRuntimeExports.jsx("div",{className:"send-balance-page-layout__header-content",children:jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",copykey:"dyn_send_transaction.data.send",children:Qr("dyn_send_transaction.data.send")})})}),jsxRuntimeExports.jsxs("div",{className:"send-balance-page-layout__body",children:[jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{}),children:fr&&jsxRuntimeExports.jsx("div",{className:"send-balance-page-layout__error",children:jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",children:fr})})}),jsxRuntimeExports.jsx(SendBalanceForm,{tokenBalances:Wr,setCurrentToken:Gr,isLoading:Vr,onSubmit:({amount:oo,recipient:io})=>{Zr?jr.value=jr.parse(oo):jr.parseNonNativeToken&&(jr.nonNativeValue=jr.parseNonNativeToken(oo,(qr==null?void 0:qr.decimals)||18),jr.value=BigInt(0),jr.nonNativeAddress=qr==null?void 0:qr.address,jr.nonNativeDecimal=qr==null?void 0:qr.decimals),jr.to=io,Er()},initialValues:{amount:_i(),recipient:(Jr=jr.to)!==null&&Jr!==void 0?Jr:""},decimals:Zr?Br:qr==null?void 0:qr.decimals,validateAddress:oo=>oo?jr.validateAddressFormat(oo):!0,validateAmount:oo=>oo?Zr?to?jr.parse(oo)<=to:!1:!(qr!=null&&qr.rawBalance)||!jr.parseNonNativeToken?!1:Number(jr.parseNonNativeToken(oo,(qr==null?void 0:qr.decimals)||18))<=qr.rawBalance:!1,currentToken:qr,transaction:jr}),kr&&jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"send-balance-page-layout__footer"})]})]})};var _path$V,_excluded$12=["title","titleId"];function _extends$12(){return _extends$12=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$12(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgCheckBlue=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$12(br,_excluded$12);return reactExports.createElement("svg",_extends$12({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$V||(_path$V=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm12.845-39.155a1.667 1.667 0 1 0-2.357-2.357L27.5 37.976l-5.488-5.488a1.667 1.667 0 1 0-2.357 2.357l6.666 6.667c.651.65 1.707.65 2.357 0l16.667-16.667Z",fill:"#4779FF"})))};const TransactionStatusLayout=({destinationAddress:fr,transactionValue:br,networkCurrency:wr,onDone:Er,displayPoweredByDynamicFooter:kr=!0,onClickClose:jr,transaction:Br,currentToken:Wr,isNativeToken:qr})=>{const{t:Gr}=useTranslation(),{showFiat:Vr}=useInternalDynamicContext(),{nativePrice:Zr}=useSendBalanceState(),Jr=jr&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:jr,"data-testid":"close",children:jsxRuntimeExports.jsx(SvgClose,{})}),Qr=getTotalFiatCost(Wr,Br,Zr,br);return jsxRuntimeExports.jsxs("div",{className:"transaction-status-layout",children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Jr,alignContent:"bottom",children:jsxRuntimeExports.jsx(Icon,{size:"large",className:"transaction-status-layout__status-icon",children:jsxRuntimeExports.jsx(SvgCheckBlue,{})})}),jsxRuntimeExports.jsxs("div",{className:"transaction-status-layout__body",children:[jsxRuntimeExports.jsxs("div",{className:"transaction-status-layout__sent_to",children:[jsxRuntimeExports.jsxs(Typography,{variant:"body_small",color:"secondary",className:"transaction-status-layout__title",copykey:"dyn_send_transaction.succeeded.title",children:[Gr("dyn_send_transaction.succeeded.title")," "]}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",className:"transaction-status-layout__title",copykey:"dyn_send_transaction.succeeded.title",children:shortenWalletAddress(fr,3,3)})]}),jsxRuntimeExports.jsx("div",{className:"transaction-status-layout__content",children:jsxRuntimeExports.jsx("div",{className:"transaction-status-layout__rows",children:jsxRuntimeExports.jsxs(Typography,{variant:"title",color:"primary",className:"transaction-status-layout__title",copykey:"dyn_send_transaction.succeeded.title",children:[`${getValueRounded(qr,Br)} ${wr} `,Vr&&(Wr==null?void 0:Wr.price)&&`($${Number(Qr)<=.01?"<0.01":Qr})`]})})}),jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{}),children:jsxRuntimeExports.jsx("div",{className:"transaction-confirmation__warning",children:jsxRuntimeExports.jsx(Alert,{variant:"info",copykey:"dyn_send_transaction.info_message.refresh_balance_time",children:Gr("dyn_send_transaction.info_message.refresh_balance_time")})})}),jsxRuntimeExports.jsx("div",{className:"transaction-status-layout__actions",children:jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"brand-primary",buttonPadding:"small",expanded:!0,onClick:Er,loading:!1,copykey:"dyn_send_transaction.succeeded.continue_button",dataTestId:"transaction-done-continue",children:Gr("dyn_send_transaction.succeeded.continue_button")})}),kr&&jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"transaction-status-layout__footer"})]})]})},useNetworkDataFromWallet=fr=>{var br,wr;const{data:Er}=usePromise(()=>fr==null?void 0:fr.connector.getNetwork(),{enabled:!!fr}),{networkConfigurations:kr}=useInternalDynamicContext();if(!(!fr||!Er))return fr.chain==="SOL"?(br=kr==null?void 0:kr.solana)===null||br===void 0?void 0:br[0]:(wr=kr==null?void 0:kr[fr.connector.connectedChain.toLowerCase()])===null||wr===void 0?void 0:wr.find(jr=>jr.chainId===Er)},getAccountTokenBalances=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,chainName:wr=ChainEnum.Evm,networkId:Er,accountAddress:kr,includeNative:jr=!1,includePrices:Br=!1,forceRefresh:Wr=!1}){return yield sdkApi$1({customHeaders:Wr?{"Cache-Control":"no-cache"}:void 0}).getAccountBalances({accountAddress:kr,chainName:wr,environmentId:br,includeNative:jr,includePrices:Br,networkId:Er})}),useTokenBalances=({accountAddress:fr,networkId:br,chainName:wr=ChainEnum.Evm,tokenAddresses:Er,includeFiat:kr=!1,includeNativeBalance:jr=!1}={})=>{const Br=useTokenBalancesState(),{tokenBalances:Wr,isLoading:qr,error:Gr}=Br,{primaryWallet:Vr,environmentId:Zr,network:Jr,user:Qr,projectSettings:_n,authMode:En}=useInternalDynamicContext(),Cn=Vr==null?void 0:Vr.connector,In=wr??(Cn==null?void 0:Cn.connectedChain),An=fr??(Vr==null?void 0:Vr.address),jn=br??Jr,eo=reactExports.useCallback((..._i)=>__awaiter$e(void 0,[..._i],void 0,function*(oo=!1){var io;if(En!=="connect-only"&&!Qr){setTokenBalanceVariable("error",USER_NOT_LOGGED_IN);return}if(En==="connect-only"&&!(!((io=_n==null?void 0:_n.sdk.featureFlags)===null||io===void 0)&&io.connectOnlyMultiAsset))return;if(![ChainEnum.Evm,ChainEnum.Sol].includes(In)){setTokenBalanceVariable("error",`Chain ${In} is not supported for token balances`);return}const so=wr===ChainEnum.Evm&&jn&&Object.values(GetAccountBalancesNetworkIdEnum).includes(jn)||wr===ChainEnum.Sol;if(qr||!An||!so){setTokenBalanceVariable("tokenBalances",void 0);return}setTokenBalanceVariable("isLoading",!0);try{const no=yield getAccountTokenBalances({accountAddress:An,chainName:In,environmentId:Zr,forceRefresh:oo,includeNative:jr,includePrices:kr,networkId:wr===ChainEnum.Evm?Number(jn):0});if(!no)return;setTokenBalanceVariable("error",void 0),setTokenBalanceVariable("tokenBalances",no)}catch(no){const Tn=(no==null?void 0:no.code)===429?"Too many requests fetching balances":no==null?void 0:no.message;setTokenBalanceVariable("error",Tn)}finally{setTokenBalanceVariable("isLoading",!1)}}),[Qr,In,wr,jn,qr,An,Zr,jr,kr]);useInternalDynamicEvents("tokenBalancesChanged",()=>eo(!0)),reactExports.useEffect(()=>{eo()},[An,jn]);const ro=Er==null?void 0:Er.map(_i=>_i.toLowerCase()),to=ro?Wr==null?void 0:Wr.filter(_i=>ro==null?void 0:ro.includes(_i.address.toLowerCase())):Wr;return{error:Gr,fetchAccountBalances:eo,isError:!!Gr,isLoading:qr,tokenBalances:to}},zeroAddress$1="0x0000000000000000000000000000000000000000",nativeSolanaAddress="11111111111111111111111111111111",usingNative=fr=>fr.address===zeroAddress$1||fr.address===nativeSolanaAddress,getTransactionValue=(fr,br)=>br?fr.value?fr.format(fr.value,{precision:6}):"0":fr.nonNativeValue&&fr.formatNonNativeToken?fr.formatNonNativeToken(fr.nonNativeValue,fr.nonNativeDecimal||18):"0",SendBalanceView=({initialRecipientAddress:fr="",initialValue:br,onClickBack:wr,onClickClose:Er,onError:kr,onSuccess:jr,onDone:Br,displayPoweredByDynamicFooter:Wr=!1})=>{const[qr,Gr]=reactExports.useState("form"),{primaryWallet:Vr}=useInternalDynamicContext(),{t:Zr}=useTranslation(),[Jr,Qr]=reactExports.useState(!1),[_n,En]=reactExports.useState(void 0),[Cn,In]=reactExports.useState(void 0),{showFiat:An}=useInternalDynamicContext(),jn=Vr==null?void 0:Vr.connector,{chain:eo}=useFetchChain(jn),{tokenBalances:ro,isLoading:to}=useTokenBalances({chainName:(jn==null?void 0:jn.connectedChain)==="SOL"?ChainEnum.Sol:ChainEnum.Evm,includeFiat:An,includeNativeBalance:!0});if(!Vr)throw new DynamicError("Primary wallet is not available, send balance cannot be displayed");const _i=Pn=>{const On=Pn.filter(Nn=>Nn.address!==zeroAddress$1&&Nn.address!==nativeSolanaAddress),Zn=Pn.find(Nn=>usingNative(Nn));return Zn?[Zn].concat(On):On};if(jn&&!isSendBalanceWalletConnector(jn))throw new DynamicError("Primary wallet is not eligible for this operation. It must implement ISendBalanceWalletConnector");const[oo,io]=reactExports.useState(null);reactExports.useEffect(()=>{const Pn=(jn==null?void 0:jn.connectedChain)!=="SOL"?getEvmChainName(Number(eo==null?void 0:eo.chainId)):void 0;return setSendBalanceVariable("chainName",Pn||(eo==null?void 0:eo.name)||(jn==null?void 0:jn.connectedChain)),()=>{resetSendBalanceState()}},[eo==null?void 0:eo.name,jn==null?void 0:jn.connectedChain]),reactExports.useEffect(()=>{ro&&In(_i(ro))},[ro]),reactExports.useEffect(()=>{jn&&(_n&&Qr(usingNative(_n)),jn.createUiTransaction(Vr==null?void 0:Vr.address).then(Pn=>{fr&&(Pn.to=fr),br&&(Pn.value=br),_n&&!usingNative(_n)&&(Pn.nonNativeAddress=_n==null?void 0:_n.address,Pn.nonNativeValue=BigInt(0),Pn.nonNativeDecimal=_n==null?void 0:_n.decimals),io(Pn)}).catch(Pn=>{if(logger$6.debug("[SendBalanceView] Error creating transaction",Pn),Pn instanceof DynamicError&&Pn.code==="0"){Br==null||Br();return}kr==null||kr(Pn)}))},[_n]);const co=useNetworkDataFromWallet(Vr);if(!oo||!co)return jsxRuntimeExports.jsx("div",{className:"send-balance-widget-view__spinner","data-testid":"send-balance-spinner",children:jsxRuntimeExports.jsx(Spinner$2,{})});const so=Pn=>__awaiter$e(void 0,void 0,void 0,function*(){(jn==null?void 0:jn.connectedChain)==="SOL"&&setTimeout(()=>dynamicEvents.emit("tokenBalancesChanged"),5e3),jn!=null&&jn.confirmTransactionStatus&&(yield jn==null?void 0:jn.confirmTransactionStatus(Pn),dynamicEvents.emit("tokenBalancesChanged"))}),no=(_n==null?void 0:_n.symbol)||co.nativeCurrency.symbol,Tn=(eo==null?void 0:eo.name)&&jsxRuntimeExports.jsx(ChainIcon,{chain:eo,chainName:eo.name}),Hr=()=>jsxRuntimeExports.jsx(SendBalancePageLayout,{transaction:oo,onClickBack:wr,networkName:co.vanityName||co.name,networkIcon:Tn,networkCurrencyDecimals:co.nativeCurrency.symbol==="SOL"?9:co.nativeCurrency.decimals,walletAddress:shortenWalletAddress(_n==null?void 0:_n.address,3,3),walletKey:Vr==null?void 0:Vr.connector.key,onClickClose:Er,displayPoweredByDynamicFooter:Wr,onSubmit:()=>Gr("confirmation"),tokenBalances:Cn??(_n&&[_n]),currentToken:_n,setCurrentToken:En,isLoading:to,isNativeToken:Jr}),Xr=()=>jsxRuntimeExports.jsx(TransactionConfirmationView,{walletConnector:Vr==null?void 0:Vr.connector,transaction:oo,mutation:()=>oo.submit(),copykey:"dyn_send_transaction.confirmation.title",title:Zr("dyn_send_transaction.confirmation.title"),onClickBack:()=>Gr("form"),onError:kr,displayPoweredByDynamicFooter:Wr,onSuccess:Pn=>__awaiter$e(void 0,void 0,void 0,function*(){Pn&&(jr==null||jr(Pn),Gr("success"),so(Pn))}),currentToken:_n,isNativeToken:Jr,transactionValue:getTransactionValue(oo,Jr),sendBalanceTransaction:!0}),Sn=()=>{var Pn;return jsxRuntimeExports.jsx(TransactionStatusLayout,{transactionValue:getTransactionValue(oo,Jr),destinationAddress:(Pn=oo.to)!==null&&Pn!==void 0?Pn:"",networkCurrency:no,networkName:co.name||"",NetworkIcon:Tn,onClickClose:Er,onDone:()=>Br==null?void 0:Br(),displayPoweredByDynamicFooter:Wr,transaction:oo,currentToken:_n,isNativeToken:Jr})};return(()=>{switch(qr){case"form":return Hr();case"confirmation":return Xr();case"success":return Sn()}})()},SendBalanceModal=({initialRecipientAddress:fr,initialValue:br,onReject:wr,onSuccess:Er})=>{usePreventPageScroll(!0);const[kr,jr]=reactExports.useState(!0),Br=reactExports.useRef(null),Wr=reactExports.useRef(null),qr=reactExports.useCallback(()=>{if(Wr.current){Er(Wr.current);return}wr(Br.current||new UserRejectedTransactionError)},[wr,Er]),Gr=()=>{jr(!1)};return jsxRuntimeExports.jsx(Portal$4,{handleClose:Gr,isShown:kr,zIndex:authModalZIndex,withBackdrop:!0,elementId:"dynamic-send-balance",transitionEvents:{onUnmount:qr},children:jsxRuntimeExports.jsx(Modal$1,{children:jsxRuntimeExports.jsx(ModalCard,{children:jsxRuntimeExports.jsx(VerticalDrawerTransition,{isShown:!0,children:jsxRuntimeExports.jsx(PopperProvider$1,{children:jsxRuntimeExports.jsx(SendBalanceView,{initialRecipientAddress:fr,initialValue:br,onError:Vr=>Br.current=Vr,onClickClose:Gr,onDone:Gr,displayPoweredByDynamicFooter:!0,onSuccess:Vr=>{Br.current=null,Wr.current=Vr}})})})})})})},noWalletError=new DynamicError("No wallet connected"),invalidWalletTypeError=new DynamicError("Primary wallet must use embedded wallet"),SendBalanceContext=reactExports.createContext(void 0),SendBalanceContextProvider=({children:fr})=>{const{primaryWallet:br}=useInternalDynamicContext(),{open:wr,modal:Er}=useConfirmationModal({elementId:"dynamic-send-balance"}),kr=reactExports.useCallback(jr=>__awaiter$e(void 0,void 0,void 0,function*(){return wr((Br,Wr)=>{if(!br)throw noWalletError;if(!isSendBalanceWalletConnector(br.connector))throw invalidWalletTypeError;return jsxRuntimeExports.jsx(SendBalanceModal,{onReject:Wr,onSuccess:Br,initialRecipientAddress:jr==null?void 0:jr.recipientAddress,initialValue:jr==null?void 0:jr.value})})}),[wr,br]);return jsxRuntimeExports.jsxs(SendBalanceContext.Provider,{value:{open:kr},children:[Er,fr]})},useSendBalance=()=>{const fr=reactExports.useContext(SendBalanceContext);if(fr===void 0)throw new Error("usage of useSendBalance not wrapped in `SendBalanceContextProvider`.");if(reactExports.useContext(PasskeyContext)===void 0)throw new Error("usage of useSendBalance not wrapped in `PasskeyContextProvider`.");return fr};var _path$U,_excluded$11=["title","titleId"];function _extends$11(){return _extends$11=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$11(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgChevronDown=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$11(br,_excluded$11);return reactExports.createElement("svg",_extends$11({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$U||(_path$U=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.862 5.529c.26-.26.682-.26.943 0L8 9.724l4.195-4.195a.667.667 0 1 1 .943.943L8.47 11.138a.667.667 0 0 1-.943 0L2.862 6.472a.667.667 0 0 1 0-.943Z",fill:"#7B7D86"})))};const replaceAll=(fr,br,wr)=>{const Er=new RegExp(br,"g");return fr.replace(Er,wr)},copyToClipboard=fr=>{navigator.clipboard.writeText(fr)},smartFloor=fr=>Math.floor(ceil(fr,13)),WITHOUT_DECIMAL_VALUE=1e3,MAX_BALANCE_VALUE=1e6,PRECISION_FLOOR_DIVIDER=1e4,roundBalance=(fr,br=4)=>{const wr=parseFloat(replaceAll(fr,'"',""));if(wr>MAX_BALANCE_VALUE){const Br=Math.floor(wr);return`${Math.floor(Br/MAX_BALANCE_VALUE*PRECISION_FLOOR_DIVIDER)/PRECISION_FLOOR_DIVIDER}M`}if(wr>WITHOUT_DECIMAL_VALUE)return String(Math.floor(wr));const Er=Math.pow(10,br),kr=1/Er;if(wr0)return`< ${kr}`;const jr=smartFloor(wr*Er)/Er;return jr===0?"0.0":String(jr)},getExportKeysOption=(fr,br)=>{var wr;if(!fr||!(br!=null&&br.length)||!isMagicConnector(fr))return;const Er=(wr=br.find(kr=>kr.provider===ProviderEnum.MagicLink))===null||wr===void 0?void 0:wr.keyExportUrl;if(Er)return()=>{window.open(Er,"_blank")}};var _path$T,_excluded$10=["title","titleId"];function _extends$10(){return _extends$10=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$10(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgEmbeddedWalletIcon=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$10(br,_excluded$10);return reactExports.createElement("svg",_extends$10({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$T||(_path$T=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32 64c17.673 0 32-14.327 32-32C64 14.327 49.673 0 32 0 14.327 0 0 14.327 0 32c0 17.673 14.327 32 32 32Zm8.334-45.333a3.333 3.333 0 0 0-3.333-3.334h-15a6.669 6.669 0 0 0-6.56 5.473 6.649 6.649 0 0 1 4.893-2.14h20ZM42 22a6.667 6.667 0 0 1 6.667 6.667V42A6.667 6.667 0 0 1 42 48.667H22A6.667 6.667 0 0 1 15.334 42V28.667A6.667 6.667 0 0 1 22 22h20Z",fill:"#4779FF","data-testid":"wallet-icon-embedded"})))},_path$S,_path2$7,_excluded$$=["title","titleId"];function _extends$$(){return _extends$$=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$$(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgSmartWallet=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$$(br,_excluded$$);return reactExports.createElement("svg",_extends$$({width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$S||(_path$S=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16 32c8.837 0 16-7.163 16-16S24.837 0 16 0 0 7.163 0 16s7.163 16 16 16Zm4.667-23.467c0-1.03-.836-1.866-1.867-1.866h-8.4A3.734 3.734 0 0 0 6.727 9.73a3.723 3.723 0 0 1 2.74-1.198h11.2ZM21.6 10.4a3.733 3.733 0 0 1 3.733 3.733V21.6a3.733 3.733 0 0 1-3.733 3.733H10.4A3.733 3.733 0 0 1 6.667 21.6v-7.467A3.733 3.733 0 0 1 10.4 10.4h11.2Z",fill:"#4779FF"})),_path2$7||(_path2$7=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M17.455 12.667c.2 0 .38.123.452.31l.572 1.486c.145.379.191.488.254.576a.97.97 0 0 0 .228.228c.088.063.197.109.576.255l1.486.57a.485.485 0 0 1 0 .906l-1.486.571c-.379.146-.488.192-.576.255a.97.97 0 0 0-.228.228c-.063.088-.109.197-.254.576l-.572 1.485a.485.485 0 0 1-.905 0l-.571-1.485c-.146-.379-.192-.488-.254-.576a.97.97 0 0 0-.229-.229c-.088-.062-.197-.108-.576-.254l-1.485-.571a.485.485 0 0 1 0-.905l1.485-.572c.38-.145.488-.191.576-.254a.97.97 0 0 0 .229-.228c.062-.088.108-.197.254-.576l.571-1.486a.485.485 0 0 1 .453-.31ZM13.333 18c.184 0 .352.104.434.268l.38.76c.137.275.18.353.23.42.05.065.11.124.176.175.066.051.144.093.418.23l.761.38a.485.485 0 0 1 0 .867l-.76.38c-.274.138-.353.18-.42.23a.968.968 0 0 0-.175.176c-.05.066-.093.145-.23.419l-.38.76a.485.485 0 0 1-.867 0l-.38-.76c-.138-.274-.18-.353-.23-.419a.968.968 0 0 0-.176-.176c-.066-.05-.145-.092-.419-.23l-.76-.38a.485.485 0 0 1 0-.867l.76-.38c.274-.137.353-.179.419-.23a.968.968 0 0 0 .176-.176c.05-.066.092-.144.23-.418l.38-.761a.485.485 0 0 1 .433-.268Z",fill:"#4779FF"})))};const pixelToRem=fr=>`${fr/16}rem`,useMediaQuery=fr=>{const br=jr=>typeof window<"u"?window.matchMedia(jr).matches:!1,[wr,Er]=reactExports.useState(br(fr)),kr=()=>Er(br(fr));return reactExports.useEffect(()=>{const jr=window.matchMedia(fr);return kr(),jr.addEventListener("change",kr),()=>{jr.removeEventListener("change",kr)}},[fr]),wr},useColorSchemePreference=()=>useMediaQuery("(prefers-color-scheme: dark)")?"dark":"light",useIconThemeVariant=()=>{const{theme:{theme:{name:fr}}}=useThemeContext(),br=useColorSchemePreference();return fr==="auto"?br:fr},useFindSocialIcon=()=>{const fr=useIconThemeVariant();return reactExports.useCallback(br=>findSocialIcon(br,fr),[fr])},WalletIconWithNetwork=({iconSize:fr=24,chainName:br,Icon:wr,showNetwork:Er=!0,walletKey:kr})=>{const jr=br?getChainIcon(br):void 0;return jsxRuntimeExports.jsxs("div",{className:"wallet-icon-with-network__container",children:[wr?jsxRuntimeExports.jsx(wr,{style:{height:pixelToRem(fr),width:pixelToRem(fr)}}):jsxRuntimeExports.jsx(WalletIcon,{walletKey:kr,style:{height:pixelToRem(fr),width:pixelToRem(fr)}}),jr&&Er&&jsxRuntimeExports.jsx("div",{"data-testid":"network-container",className:classNames$1("wallet-icon-with-network__network-container"),children:jsxRuntimeExports.jsx(jr,{})})]})},getWalletIcon=({findSocialIcon:fr,wallet:br,user:wr})=>{if(isEmailOTPWalletConnector(br.connector))return SignInWithEmailIcon;if(isSocialWalletConnector(br.connector)){const Er=getReferencedAccount(wr,br.id);if(!Er||!Er.oauthProvider)return SignInWithEmailIcon;const{oauthProvider:kr}=Er;try{return fr(kr)}catch(jr){logger$6.error(jr)}}return isAccountAbstractionConnector(br.connector)?SvgSmartWallet:isEmbeddedConnector(br.connector)?SvgEmbeddedWalletIcon:null},AuthProviderIcon=({iconSize:fr=64,showNetworkIcon:br=!1,wallet:wr})=>{const{primaryWallet:Er,selectedWalletConnector:kr,user:jr,userWithMissingInfo:Br}=useInternalDynamicContext(),{deniedOauthProvider:Wr,deniedAddress:qr}=useAccessDeniedContext(),{isLoadingEmbeddedWallet:Gr}=useWalletContext(),Vr=useFindSocialIcon();if(Wr){const Qr=Vr(Wr);return Qr?jsxRuntimeExports.jsx(Qr,{style:{height:pixelToRem(fr),width:pixelToRem(fr)}}):null}if(qr)return jsxRuntimeExports.jsx(WalletIcon,{walletKey:kr==null?void 0:kr.key,style:{height:pixelToRem(fr),width:pixelToRem(fr)}});const Zr=wr||Er;if(!Zr)return Gr?jsxRuntimeExports.jsx(WalletIconWithNetwork,{iconSize:fr,Icon:SvgEmbeddedWalletIcon,chainName:"EVM",showNetwork:!1}):null;const Jr=getWalletIcon({findSocialIcon:Vr,user:jr??Br,wallet:Zr});return jsxRuntimeExports.jsx(WalletIconWithNetwork,{iconSize:fr,Icon:Jr??null,chainName:Zr.chain,showNetwork:br,walletKey:Zr.key})},StatusDot=({variant:fr,containerClassName:br})=>jsxRuntimeExports.jsx("div",{"data-testid":"status-dot-container",className:classNames$1("status-dot__container",br||""),children:jsxRuntimeExports.jsx("div",{"data-testid":"status-dot",className:classNames$1("status-dot",`status-dot--${fr}`)})}),isNetworkUnsupported=(fr,br)=>!(br!=null&&br.find(wr=>fr&&wr.chainId===parseChainId(fr)));var _path$R,_excluded$_=["title","titleId"];function _extends$_(){return _extends$_=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$_(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgCheck=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$_(br,_excluded$_);return reactExports.createElement("svg",_extends$_({width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$R||(_path$R=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.496 3.67a.583.583 0 0 1 0 .826l-5.834 5.833a.583.583 0 0 1-.824 0L2.504 7.996a.583.583 0 1 1 .825-.825L5.25 9.09l5.42-5.42a.583.583 0 0 1 .826 0Z",fill:"currentColor"})))};const defaultCustomColor="#4779FF",Spinner$1=({className:fr="",size:br=16,customSpinnerColor:wr=""})=>{const{theme:Er}=useThemeContext(),kr=wr||Er.customColor||defaultCustomColor;return jsxRuntimeExports.jsxs("svg",{style:{height:pixelToRem(br),width:pixelToRem(br)},viewBox:"0 0 42 42",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:fr,"data-testid":"spinner",children:[jsxRuntimeExports.jsx("mask",{id:"path-1-inside-1_1433_60360",fill:"white",children:jsxRuntimeExports.jsx("path",{d:"M40.53 42C41.3419 42 42.0027 41.3416 41.9743 40.5303C41.7987 35.5162 40.726 30.5699 38.8029 25.9273C36.6922 20.8316 33.5985 16.2016 29.6985 12.3015C25.7984 8.40145 21.1684 5.30776 16.0727 3.19706C11.4301 1.27403 6.48384 0.201284 1.46972 0.0257219C0.658363 -0.00268681 0 0.658141 0 1.47C0 2.28186 0.658382 2.93711 1.46967 2.96766C6.09758 3.1419 10.6617 4.138 14.9476 5.91326C19.6866 7.87621 23.9925 10.7534 27.6196 14.3804C31.2467 18.0075 34.1238 22.3134 36.0867 27.0524C37.862 31.3383 38.8581 35.9024 39.0323 40.5303C39.0629 41.3416 39.7181 42 40.53 42Z"})}),jsxRuntimeExports.jsx("path",{d:"M40.53 42C41.3419 42 42.0027 41.3416 41.9743 40.5303C41.7987 35.5162 40.726 30.5699 38.8029 25.9273C36.6922 20.8316 33.5985 16.2016 29.6985 12.3015C25.7984 8.40145 21.1684 5.30776 16.0727 3.19706C11.4301 1.27403 6.48384 0.201284 1.46972 0.0257219C0.658363 -0.00268681 0 0.658141 0 1.47C0 2.28186 0.658382 2.93711 1.46967 2.96766C6.09758 3.1419 10.6617 4.138 14.9476 5.91326C19.6866 7.87621 23.9925 10.7534 27.6196 14.3804C31.2467 18.0075 34.1238 22.3134 36.0867 27.0524C37.862 31.3383 38.8581 35.9024 39.0323 40.5303C39.0629 41.3416 39.7181 42 40.53 42Z",stroke:"url(#paint0_linear_1433_60360)",strokeWidth:"4",mask:"url(#path-1-inside-1_1433_60360)"}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_1433_60360",x1:"41",y1:"42",x2:"1.5",y2:"-1.82007e-07",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:kr}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:kr,stopOpacity:"0"})]})})]})},Network=({iconUrl:fr,isActive:br,networkName:wr,className:Er,checkboxClassName:kr="",isChanging:jr,notSupported:Br=!1})=>jsxRuntimeExports.jsxs("div",{className:classNames$1("network",Er,{"network--not-supported":Br}),children:[jsxRuntimeExports.jsxs("div",{className:"network__container",children:[fr?jsxRuntimeExports.jsx("img",{src:fr,className:"network__title-icon",alt:`${wr} icon`}):jsxRuntimeExports.jsx(SvgError,{}),jsxRuntimeExports.jsxs("div",{className:"network__title-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"button_primary",className:"network__title-copy",as:"span",weight:"medium",color:Br?"secondary":"primary",children:wr}),Br&&jsxRuntimeExports.jsx(Typography,{variant:"body_mini",className:"network__title-copy",as:"span",weight:"medium",color:Br?"secondary":"primary","data-testid":"network-not-supported",children:"Switch network in your wallet"})]})]}),jsxRuntimeExports.jsxs("div",{className:classNames$1("network__status-container",{"network__status-container--active":br},kr),"data-testid":"single-network-checkbox",children:[br&&jsxRuntimeExports.jsx(SvgCheck,{className:"network__status-icon"}),jr&&jsxRuntimeExports.jsx(Spinner$1,{className:"network__status-spinner-icon",size:12})]})]}),NetworkAction=({iconUrl:fr,networkId:br,network:wr,onClick:Er,networkName:kr,checkboxClassName:jr="",newNetworkId:Br,notSupported:Wr})=>jsxRuntimeExports.jsx("div",{className:classNames$1("network-action",{"network--not-supported":Wr}),onClick:()=>{!Wr&&Er(br)},"data-testid":"network-action",children:jsxRuntimeExports.jsx(Network,{iconUrl:fr,isActive:br===wr,networkName:kr,checkboxClassName:jr,isChanging:Br===br,notSupported:Wr})}),NetworkControlSkeleton=({className:fr})=>jsxRuntimeExports.jsxs("div",{className:classNames$1("network-control-skeleton",fr),"data-testid":"network-control-loading",children:[jsxRuntimeExports.jsx("div",{className:"network-control-skeleton__icon"}),jsxRuntimeExports.jsx(Skeleton$1,{className:"network-control-skeleton__skeleton"})]}),UnsupportedNetwork=({showMsg:fr})=>{const{t:br}=useTranslation();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Icon,{size:"small",children:jsxRuntimeExports.jsx(SvgError,{})}),fr&&jsxRuntimeExports.jsx(Typography,{className:"evm-network-control__network-name",as:"span",color:"error-1",variant:"body_small",copykey:"dyn_network_not_supported.button",children:br("dyn_network_not_supported.button")})]})},EvmNetworkControl=({evmNetworks:fr,className:br="",activeClassName:wr="",network:Er,walletConnector:kr,isOpen:jr,setIsOpen:Br,showNetworkName:Wr=!1})=>{var qr;const Gr=fr==null?void 0:fr.find(Vr=>Er&&Vr.chainId===parseChainId(Er));if(fr&&!fr.length)return jsxRuntimeExports.jsx("div",{"data-testid":"EvmNetworkControl",className:classNames$1("evm-network-control__container evm-network-control__container--error",br),children:jsxRuntimeExports.jsx(UnsupportedNetwork,{showMsg:Wr})});if(!Er)return jsxRuntimeExports.jsx("div",{"data-testid":"EvmNetworkControl",className:classNames$1("evm-network-control__container",br),children:jsxRuntimeExports.jsx(NetworkControlSkeleton,{})});if((fr==null?void 0:fr.length)===1){const Vr=classNames$1(br,"evm-network-control__container","evm-network-control__container--error",{[wr]:jr,"evm-network-control__container":!!(kr!=null&&kr.supportsNetworkSwitching())});return Gr?jsxRuntimeExports.jsxs("div",{"data-testid":"EvmNetworkControl",onClick:()=>Er&&Br(!jr),className:classNames$1("evm-network-control__container",{[wr]:jr},br),children:[Gr.iconUrls.length>0&&jsxRuntimeExports.jsx(Icon,{size:"small",children:jsxRuntimeExports.jsx("img",{src:Gr.iconUrls[0],alt:`${Gr.name} icon`})}),Wr&&jsxRuntimeExports.jsx(Typography,{className:"evm-network-control__network-name",as:"span",variant:"body_small",children:Gr.vanityName||Gr.name})]}):jsxRuntimeExports.jsxs("button",{"data-testid":"EvmNetworkControl",type:"button",onClick:()=>Br(!jr),className:Vr,children:[jsxRuntimeExports.jsx(UnsupportedNetwork,{showMsg:Wr}),jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"small",className:classNames$1("evm-network-control__arrow-icon",{"evm-network-control__arrow-icon--active":jr}),children:jsxRuntimeExports.jsx(SvgStroke,{})})]})}return jsxRuntimeExports.jsxs("button",{"data-testid":"EvmNetworkControl",type:"button",onClick:Vr=>{Vr.stopPropagation(),Er&&Br(!jr)},className:classNames$1(br,{[wr]:jr,"evm-network-control__container":!!(kr!=null&&kr.supportsNetworkSwitching()),"evm-network-control__container--error":!(Gr!=null&&Gr.name)}),children:[Gr!=null&&Gr.name?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[((qr=Gr==null?void 0:Gr.iconUrls)===null||qr===void 0?void 0:qr[0])&&jsxRuntimeExports.jsx(Icon,{size:"small",children:jsxRuntimeExports.jsx("img",{src:Gr.iconUrls[0],alt:`${Gr.name} icon`})}),Wr&&jsxRuntimeExports.jsx(Typography,{className:"evm-network-control__network-name",as:"span",variant:"body_small",children:Gr.vanityName||Gr.name})]}):jsxRuntimeExports.jsx(UnsupportedNetwork,{showMsg:Wr}),fr&&fr.length>1&&jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"small",className:classNames$1("evm-network-control__arrow-icon",{"evm-network-control__arrow-icon--active":jr}),children:jsxRuntimeExports.jsx(SvgStroke,{})})]})},capitalize$1=fr=>{var br;return((br=fr[0])===null||br===void 0?void 0:br.toUpperCase())+fr.slice(1).toLowerCase()},NonNetworkSwitchingSupportedControl=({walletConnector:fr,className:br,showNetworkName:wr=!1})=>{const{chain:Er,isLoading:kr}=useFetchChain(fr),jr=(Er==null?void 0:Er.name)||"",Br=getChainIcon(fr.connectedChain||"");return kr?jsxRuntimeExports.jsx(NetworkControlSkeleton,{className:br}):jsxRuntimeExports.jsxs("div",{"data-testid":"NonNetworkSwitchingSupportedControl",className:classNames$1("non-network-switching-supported-control",br),children:[jsxRuntimeExports.jsx(Icon,{size:"small",children:Er!=null&&Er.icon?jsxRuntimeExports.jsx("img",{src:Er.icon,alt:`${Er.name} icon`}):jsxRuntimeExports.jsx(Br,{})}),wr&&jsxRuntimeExports.jsx(Typography,{className:classNames$1("non-network-switching-supported-control__network-name"),as:"span",variant:"body_small",children:capitalize$1(jr)}),jsxRuntimeExports.jsx("span",{})]})},NetworkControl=({loading:fr,walletConnector:br,buttonClassName:wr,network:Er,evmNetworks:kr,activeClassName:jr,isOpen:Br,setIsOpen:Wr,showNetworkName:qr})=>{const Gr=(br==null?void 0:br.connectedChain)===ChainEnum.Evm&&typeof Er=="string";return fr||Gr?jsxRuntimeExports.jsx(NetworkControlSkeleton,{className:wr}):br!=null&&br.connectedChain&&!br.supportsNetworkSwitching()?jsxRuntimeExports.jsx(NonNetworkSwitchingSupportedControl,{className:wr,showNetworkName:qr,walletConnector:br}):jsxRuntimeExports.jsx(EvmNetworkControl,{showNetworkName:qr,evmNetworks:kr,activeClassName:jr,className:wr,network:Er,loading:fr,isOpen:Br,walletConnector:br,setIsOpen:Wr})},NetworkPicker=({activeClassName:fr="",buttonClassName:br="",checkboxClassName:wr="",connector:Er,evmNetworks:kr,isNetworkPickerOpen:jr,listClassName:Br="",mainClassName:Wr="",setIsNetworkPickerOpen:qr,showNetworkName:Gr,customCallbackOnSuccess:Vr,currentNetwork:Zr,isLoading:Jr=!1})=>{const Qr=reactExports.useRef(null),[_n,En]=reactExports.useState(void 0),{loadingNetwork:Cn}=useInternalDynamicContext(),{data:In}=usePromise(()=>isWalletConnectConnector(Er)?Er.getSupportedNetworks():Promise.resolve(kr.map(({networkId:ro})=>`${ro}`)),{deps:[Er,kr,jr],initialData:void 0}),An=isNetworkUnsupported(Zr,kr)||(kr==null?void 0:kr.length)>1,jn=reactExports.useRef(null),eo=ro=>__awaiter$e(void 0,void 0,void 0,function*(){En(ro);try{yield Er==null?void 0:Er.switchNetwork({networkChainId:ro}),Vr==null||Vr()}catch(to){logger$6.debug(to)}finally{En(void 0),qr(!1)}});return jsxRuntimeExports.jsxs("div",{className:classNames$1("non-widget-network-picker",Wr),ref:Qr,"data-testid":"network-picker",children:[jsxRuntimeExports.jsxs("div",{className:"network-picker-network-control",children:[jsxRuntimeExports.jsx(NetworkControl,{evmNetworks:kr,activeClassName:fr,network:Zr,loading:Cn||Jr,isOpen:jr,setIsOpen:qr,walletConnector:Er,showNetworkName:Gr,buttonClassName:br}),jsxRuntimeExports.jsx("div",{ref:jn,className:"network-picker-network-control__anchor"})]}),An&&jsxRuntimeExports.jsx(MenuList,{className:Br,isOpen:jr,onClickClose:()=>qr(!1),popperProps:{anchorOrigin:"bottom-left",anchorRef:jn},mobileTitle:"Select network",children:kr.map(({name:ro,networkId:to,vanityName:_i,iconUrls:oo})=>jsxRuntimeExports.jsx(NetworkAction,{iconUrl:oo==null?void 0:oo[0],networkId:to,networkName:_i||ro,network:Zr,onClick:eo,checkboxClassName:wr,newNetworkId:_n,notSupported:In&&!In.includes(`${to}`)},to))})]})},useFetchNameService=fr=>{const{getNameService:br,network:wr}=useInternalDynamicContext(),{data:Er}=usePromise(()=>br(fr),{deps:[fr,wr,br]});return Er},useFetchBalance=({wallet:fr,chain:br,network:wr})=>{const[Er,kr]=reactExports.useState("0.0"),jr=!br||fr.connector.supportsNetworkSwitching()&&!wr,Br=()=>__awaiter$e(void 0,void 0,void 0,function*(){if(jr)return;const qr=yield fr.getBalance();kr(qr)}),{isLoading:Wr}=usePromise(Br,{deps:[fr.address,wr==null?void 0:wr.toString(),br],enabled:!jr});return{balance:Er,isLoading:Wr}},Balance=({wallet:fr,network:br,className:wr})=>{const{currency:Er,isLoading:kr}=useFetchCurrency(fr.connector,br),{balance:jr,isLoading:Br}=useFetchBalance({chain:Er,network:br,wallet:fr});return jr?jsxRuntimeExports.jsxs(Typography,{className:wr,variant:"body_normal",color:"primary",children:[Br?jsxRuntimeExports.jsx(Skeleton$1,{className:"balance-skeleton"}):roundBalance(jr)," ",!kr&&jsxRuntimeExports.jsx(Typography,{as:"span",variant:"body_normal",color:"secondary",children:Er})]}):null},MULTI_ASSET_SUPPORTED_NETWORKS=Object.values(GetAccountBalancesNetworkIdEnum),isMultiAssetSupportedNetwork=(fr,br)=>!!((fr==null?void 0:fr.connectedChain)===ChainEnum.Sol||(fr==null?void 0:fr.connectedChain)===ChainEnum.Evm&&typeof br=="number"&&MULTI_ASSET_SUPPORTED_NETWORKS.includes(br));var _path$Q,_path2$6,_excluded$Z=["title","titleId"];function _extends$Z(){return _extends$Z=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$Z(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgCopy=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$Z(br,_excluded$Z);return reactExports.createElement("svg",_extends$Z({width:18,height:18,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$Q||(_path$Q=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.333 1.667a2.5 2.5 0 0 0-2.5 2.5v1.666H7.5V4.167c0-.46.373-.834.833-.834h7.5c.46 0 .833.373.833.834v7.5c0 .46-.373.833-.833.833h-1.667v1.667h1.667a2.5 2.5 0 0 0 2.5-2.5v-7.5a2.5 2.5 0 0 0-2.5-2.5h-7.5Z",fill:"currentColor"})),_path2$6||(_path2$6=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M1.667 8.333a2.5 2.5 0 0 1 2.5-2.5h7.5a2.5 2.5 0 0 1 2.5 2.5v7.5a2.5 2.5 0 0 1-2.5 2.5h-7.5a2.5 2.5 0 0 1-2.5-2.5v-7.5Zm2.5-.833a.833.833 0 0 0-.833.833v7.5c0 .46.373.834.833.834h7.5c.46 0 .833-.373.833-.834v-7.5a.833.833 0 0 0-.833-.833h-7.5Z",fill:"currentColor"})))};const TextButton=fr=>{var{className:br=""}=fr,wr=__rest$9(fr,["className"]);return jsxRuntimeExports.jsx("button",Object.assign({className:classNames$1("text-button",br)},wr))},CopyButton=({children:fr,className:br="",textToCopy:wr,onClick:Er,variant:kr="text",copykey:jr,buttonPadding:Br="small",buttonVariant:Wr="primary",buttonClassName:qr="",startSlot:Gr,disabled:Vr})=>{const[Zr,Jr]=reactExports.useState(!1),Qr=()=>{navigator.clipboard.writeText(wr),Jr(!0),Er==null||Er()},_n=()=>jsxRuntimeExports.jsx(Tooltip$2,{className:"copy-button__tooltip",content:Zr?"Copied":"Copy",children:fr});return kr==="text"?jsxRuntimeExports.jsx(TextButton,{className:classNames$1("copy-button__container",br),onClick:()=>Qr(),onMouseLeave:()=>Jr(!1),copykey:jr,disabled:Vr,children:jsxRuntimeExports.jsx(_n,{})}):jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,buttonPadding:Br,buttonVariant:Wr,buttonClassName:qr,onClick:()=>Qr(),copykey:jr,startSlot:Gr,disabled:Vr,children:jsxRuntimeExports.jsx(_n,{})})},ActiveBitcoinWalletAddresses=({menuOption:fr,wallet:br})=>{var wr,Er;const{t:kr}=useTranslation(),jr=(wr=getWalletAdditionalAddressByType(WalletAddressType.Ordinals,br))!==null&&wr!==void 0?wr:br==null?void 0:br.address,Br=(Er=getWalletAdditionalAddressByType(WalletAddressType.Payment,br))!==null&&Er!==void 0?Er:br==null?void 0:br.address;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"active-wallet-information__address-container",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{className:"active-wallet-information__address",weight:"regular",variant:"body_small",color:"secondary",children:kr("dyn_active_wallet_info.ordinals_address")}),jsxRuntimeExports.jsx(Typography,{className:"active-wallet-information__address",weight:"medium",variant:"body_normal",color:"primary",children:shortenWalletAddress(jr,4,4)})]}),jsxRuntimeExports.jsx(DotsMenu,{"data-testid":"dots-menu",options:fr,buttonClassName:"active-wallet-information__dots-menu",buttonClassNameWithOpenMenu:"active-wallet-information__dots-menu"})]}),jsxRuntimeExports.jsxs("div",{className:"active-wallet-information__address-container",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{className:"active-wallet-information__address",weight:"regular",variant:"body_small",color:"secondary",children:kr("dyn_active_wallet_info.payment_address")}),jsxRuntimeExports.jsx(Typography,{className:"active-wallet-information__address",weight:"regular",variant:"body_small",color:"primary",children:shortenWalletAddress(Br,4,4)})]}),jsxRuntimeExports.jsx(CopyButton,{textToCopy:Br??"",children:jsxRuntimeExports.jsx(Icon,{size:"xsmall",children:jsxRuntimeExports.jsx(SvgCopy,{})})})]})]})};var _path$P,_excluded$Y=["title","titleId"];function _extends$Y(){return _extends$Y=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$Y(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgGear=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$Y(br,_excluded$Y);return reactExports.createElement("svg",_extends$Y({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$P||(_path$P=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.353 4.081c.674-2.775 4.62-2.775 5.294 0a.724.724 0 0 0 1.08.448c2.44-1.486 5.23 1.305 3.744 3.744a.724.724 0 0 0 .448 1.08c2.775.674 2.775 4.62 0 5.294a.724.724 0 0 0-.448 1.08c1.486 2.44-1.305 5.23-3.744 3.744a.724.724 0 0 0-1.08.448c-.674 2.775-4.62 2.775-5.294 0a.724.724 0 0 0-1.08-.448c-2.44 1.486-5.23-1.305-3.744-3.744a.724.724 0 0 0-.448-1.08c-2.775-.674-2.775-4.62 0-5.294a.724.724 0 0 0 .448-1.08c-1.486-2.44 1.305-5.23 3.744-3.744a.724.724 0 0 0 1.08-.448Zm3.35.472c-.178-.737-1.227-.737-1.407 0a2.724 2.724 0 0 1-4.064 1.684c-.648-.395-1.39.347-.995.995.96 1.575.109 3.63-1.684 4.064-.737.18-.737 1.229 0 1.408a2.724 2.724 0 0 1 1.684 4.064c-.395.648.347 1.39.995.995a2.724 2.724 0 0 1 4.064 1.684c.18.737 1.229.737 1.408 0a2.724 2.724 0 0 1 4.064-1.684c.648.395 1.39-.347.995-.995a2.724 2.724 0 0 1 1.684-4.064c.737-.18.737-1.229 0-1.408a2.724 2.724 0 0 1-1.684-4.064c.395-.648-.347-1.39-.995-.995-1.575.96-3.63.109-4.064-1.684ZM12 10a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm-4 2a4 4 0 1 1 8 0 4 4 0 0 1-8 0Z",fill:"#ABACB2"})))};const IconWithStatus=({Icon:fr,InnerIcon:br,primaryWalletKey:wr,containerClassName:Er,iconSize:kr=16,variant:jr="green"})=>{const Br=wr?jsxRuntimeExports.jsx("div",{className:"inner-icon__container",children:jsxRuntimeExports.jsx("div",{className:classNames$1("inner-icon"),children:jsxRuntimeExports.jsx(Icon,{size:"medium",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:wr})})})}):jsxRuntimeExports.jsx("div",{className:"inner-icon__container",children:jsxRuntimeExports.jsx("div",{className:classNames$1("inner-icon",`inner-icon--${jr}`),children:br&&jsxRuntimeExports.jsx(br,{})})});return jsxRuntimeExports.jsxs("div",{className:classNames$1("icon-with-status__container",Er||""),children:[typeof fr=="string"?jsxRuntimeExports.jsx("img",{style:{height:pixelToRem(kr),width:pixelToRem(kr)},src:fr,alt:"",className:"icon"}):jsxRuntimeExports.jsx(fr,{style:{height:pixelToRem(kr),width:pixelToRem(kr)}}),br||wr?Br:jsxRuntimeExports.jsx(StatusDot,{variant:jr,containerClassName:"icon-with-status__status-dot"})]})},ActiveWalletAddress=({address:fr,nameServiceName:br,menuOption:wr,fullWidth:Er=!1,isLoading:kr=!1})=>{const{showAlert:jr}=usePasskeyContext();return jsxRuntimeExports.jsxs("div",{className:"active-wallet-information__address-container",children:[jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{className:Er?"active-wallet-information__handle--full-width":"active-wallet-information__handle",color:"primary",variant:"body_normal",children:br}),jsxRuntimeExports.jsx(Typography,{className:"active-wallet-information__address",weight:br?"regular":"medium",variant:br?"body_small":"body_normal",color:br?"secondary":"primary",children:kr?jsxRuntimeExports.jsx(Skeleton$1,{className:"active-wallet-information__address-skeleton"}):shortenWalletAddress(fr,4,4)})]}),jsxRuntimeExports.jsx(DotsMenu,{"data-testid":"dots-menu",options:wr,buttonClassName:"active-wallet-information__dots-menu",buttonClassNameWithOpenMenu:"active-wallet-information__dots-menu",iconOverride:jr()?jsxRuntimeExports.jsx(IconWithStatus,{Icon:()=>jsxRuntimeExports.jsx(SvgGear,{width:16,height:16}),variant:"yellow"}):jsxRuntimeExports.jsx(SvgGear,{width:16,height:16})})]})},currencyFormatter=new Intl.NumberFormat("en-US",{currency:"USD",style:"currency"}),TokenBalanceItem=({tokenBalance:fr})=>{const{showFiat:br}=useInternalDynamicContext(),wr=kr=>{const jr=Math.round(kr*1e6)/1e6;return jr===0?"<0.000001":jr},Er=()=>{var kr;return fr.marketValue!==0&&!fr.marketValue?"$-":fr.marketValue>=.01?currencyFormatter.format(parseFloat((kr=fr.marketValue)===null||kr===void 0?void 0:kr.toFixed(2))):"<$0.01"};return jsxRuntimeExports.jsxs("div",{className:"token-balance-item",children:[jsxRuntimeExports.jsxs("div",{className:"token-balance-item__name",children:[fr.logoURI?jsxRuntimeExports.jsx(Image$1,{src:fr.logoURI,alt:fr.symbol,className:"token-balance-item__icon",dataTestId:"token-balance-item-icon"}):jsxRuntimeExports.jsx("div",{className:"token-balance-item__skeleton-icon","data-testid":"token-balance-item__skeleton-icon"}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",className:"token-balance-item__title",color:"primary",children:fr.name})})]}),jsxRuntimeExports.jsxs("div",{className:"flex",children:[br?jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"bold",color:"primary",style:{textAlign:"right"},children:Er()}):null,jsxRuntimeExports.jsx("div",{className:"token-balance-item__value",children:jsxRuntimeExports.jsxs("div",{className:"token-balance-item__value__balance","data-testid":"token-balance-item-balance",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",style:{marginRight:"2px"},children:wr(fr.balance)}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:fr.symbol})]})})]})]},fr.address)},Divider=({text:fr,className:br,style:wr,fullWidth:Er=!1,children:kr})=>jsxRuntimeExports.jsxs("div",{className:classNames$1("divider",br,{"divider__full-width":Er}),style:wr,children:[jsxRuntimeExports.jsx("div",{className:"divider__dash"}),!!fr&&jsxRuntimeExports.jsx(Typography,{className:"divider__text",variant:"body_small",color:"secondary",children:fr}),kr&&jsxRuntimeExports.jsx("div",{children:kr}),jsxRuntimeExports.jsx("div",{className:"divider__dash"})]}),TokenBalanceList=({tokenBalances:fr})=>{const{t:br}=useTranslation();return jsxRuntimeExports.jsx("ul",{className:"token-balance-list",children:(fr==null?void 0:fr.length)===0?jsxRuntimeExports.jsx("div",{className:"token-balance-list__empty",children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:br("dyn_wallet_information.multi_asset.empty_state")})}):fr==null?void 0:fr.map((wr,Er)=>jsxRuntimeExports.jsxs(t$7.Fragment,{children:[jsxRuntimeExports.jsx(TokenBalanceItem,{tokenBalance:wr}),fr.length!==Er+1?jsxRuntimeExports.jsx(Divider,{className:"token-balance-list__divider"}):null]},Er))})},ICON_SIZE=28,ActiveWalletInformation=({isLoading:fr=!1})=>{var br,wr,Er,kr,jr,Br;const{t:Wr}=useTranslation(),[qr,Gr]=reactExports.useState(!1),[Vr,Zr]=reactExports.useState(!1),[Jr,Qr]=reactExports.useState(!1),_n=reactExports.useRef(null),{primaryWallet:En,network:Cn,projectSettings:In,user:An,authMode:jn,showFiat:eo,multiAsset:ro}=useInternalDynamicContext(),{setDynamicWidgetView:to}=useWidgetContext(),{isTurnkeyWalletWithoutAuthenticator:_i}=useIsTurnkeyWallet(),{isLoading:oo,tokenBalances:io,error:co}=useTokenBalances({chainName:En==null?void 0:En.connector.connectedChain,includeFiat:eo,includeNativeBalance:!0}),so=En==null?void 0:En.connector,no=(io==null?void 0:io.filter(na=>na.name))||[],Tn=En==null?void 0:En.address,Hr=useFetchNameService(Tn),{getEOAWallet:Xr}=useSmartWallets(),{data:Sn}=usePromise(()=>__awaiter$e(void 0,void 0,void 0,function*(){return!!(yield En==null?void 0:En.connector.isTestnet())}),{deps:[Cn],initialData:!1}),Rn=getExportKeysOption(En==null?void 0:En.connector,In==null?void 0:In.providers),{showAlert:Pn}=usePasskeyContext(),On=(br=En&&Xr(En))!==null&&br!==void 0?br:En,Zn=En&&isBitcoinConnector(En==null?void 0:En.connector),Nn=!!(On&&(!((Er=(wr=On==null?void 0:On.connector)===null||wr===void 0?void 0:wr.key)===null||Er===void 0)&&Er.startsWith("turnkey")||!((jr=(kr=On==null?void 0:On.connector)===null||kr===void 0?void 0:kr.key)===null||jr===void 0)&&jr.startsWith("coinbasempc"))),wn=[{Icon:null,callback:()=>(Hr==null?void 0:Hr.name)&&navigator.clipboard.writeText(Hr==null?void 0:Hr.name),hide:!(Hr!=null&&Hr.name),text:"Copy ENS"},{Icon:null,callback:()=>Tn&&navigator.clipboard.writeText(Tn),hide:!Tn,text:"Copy wallet address"},{Icon:null,callback:()=>to("settings"),endSlot:Pn()?jsxRuntimeExports.jsx(StatusDot,{variant:"yellow"}):void 0,hide:!Nn,text:"Wallet settings"},{Icon:null,callback:Rn||(()=>logger$6.info("No option to export private keys")),hide:!Rn,text:"Export private keys"}],zn=(En==null?void 0:En.connector)&&(En==null?void 0:En.connector).evmNetworks||[],fo=Sn&&!_i,vo=In==null?void 0:In.sdk.hideNetworkInDynamicWidget,go=()=>Zn?jsxRuntimeExports.jsx(ActiveBitcoinWalletAddresses,{wallet:En,menuOption:wn}):jsxRuntimeExports.jsx(ActiveWalletAddress,{address:Tn,nameServiceName:(Hr==null?void 0:Hr.name)||(An==null?void 0:An.email),menuOption:wn,isLoading:fr,fullWidth:vo}),uo=(jn==="connect-and-sign"||jn==="connect-only"&&((Br=In==null?void 0:In.sdk.featureFlags)===null||Br===void 0?void 0:Br.connectOnlyMultiAsset))&&ro,lo=isMultiAssetSupportedNetwork(so,Cn),mo=!(co==="Too many requests fetching balances")&&lo&&uo;no.sort((na,qo)=>((qo==null?void 0:qo.marketValue)||0)-((na==null?void 0:na.marketValue)||0));const yo=no.reduce((na,qo)=>na+((qo==null?void 0:qo.marketValue)||0),0),_o=new Intl.NumberFormat("en-US",{currency:"USD",style:"currency"}),Bo=()=>En?jsxRuntimeExports.jsx(Balance,{className:"balance-header__balance",wallet:En,network:Cn}):jsxRuntimeExports.jsx(Skeleton$1,{className:"balance-header__skeleton"}),Lo=()=>{_n.current&&Qr(_n.current.scrollTop>0)},Wo=()=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:`${Jr?"shadow":""}`,children:jsxRuntimeExports.jsxs("button",{onClick:()=>{oo||Zr(!Vr)},className:"balance-header",children:[jsxRuntimeExports.jsxs("div",{className:"balance-header__title",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",style:{marginRight:"8px"},children:"Balance:"}),eo?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",children:yo===0||yo>=.01?_o.format(parseFloat(yo.toFixed(2))):"<$0.01"}):Bo()]}),jsxRuntimeExports.jsx("div",{className:Vr?"balance-header__chevron":"",children:jsxRuntimeExports.jsx(SvgChevronDown,{})})]})}),jsxRuntimeExports.jsx(AccordionItem,{isOpen:Vr,className:`multi-asset-balance-container__accordion ${"multi-asset-balance-container__accordion"+(Vr?"--expanded":"--collapsed")}`,handleScroll:Lo,ref:_n,children:jsxRuntimeExports.jsx(TokenBalanceList,{tokenBalances:no})})]});return fr?jsxRuntimeExports.jsx(Skeleton$1,{}):jsxRuntimeExports.jsxs("div",{className:"active-wallet-information-container","data-testid":"active-wallet-information",children:[jsxRuntimeExports.jsxs("div",{className:"active-wallet-information",children:[jsxRuntimeExports.jsxs("div",{className:"active-wallet-information__header",children:[jsxRuntimeExports.jsx("div",{className:"active-wallet-information__avatar",children:Hr!=null&&Hr.avatar?jsxRuntimeExports.jsx("div",{className:"active-wallet-information__avatar__name-service",children:jsxRuntimeExports.jsx("img",{src:Hr==null?void 0:Hr.avatar,alt:""})}):jsxRuntimeExports.jsx("div",{className:"active-wallet-information__wallet-img",children:jsxRuntimeExports.jsx(AuthProviderIcon,{iconSize:ICON_SIZE})})}),jsxRuntimeExports.jsxs("div",{className:"active-wallet-information__details",children:[jsxRuntimeExports.jsx("div",{className:classNames$1("active-wallet-information__addresses-container",{"active-wallet-information__addresses-container--centered":!(Hr!=null&&Hr.name)}),children:go()}),!vo&&jsxRuntimeExports.jsx(NetworkPicker,{currentNetwork:Cn,connector:En==null?void 0:En.connector,isNetworkPickerOpen:qr,setIsNetworkPickerOpen:Gr,mainClassName:"active-wallet-information__network-picker",buttonClassName:"active-wallet-information__network-picker-button",evmNetworks:zn,showNetworkName:!0,isLoading:fr})]})]}),fo&&jsxRuntimeExports.jsx(Alert,{variant:"warning",copykey:"dyn_active_wallet_info.testnet_warning",children:Wr("dyn_active_wallet_info.testnet_warning")})]}),mo?jsxRuntimeExports.jsx("div",{className:"multi-asset-balance-container",children:Wo()}):jsxRuntimeExports.jsxs("div",{className:"balance-container",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",children:"Balance"}),Bo()]})]})},UnknownWalletInformation=({address:fr})=>{const{handleLogOut:br}=useInternalDynamicContext(),wr=[{Icon:null,callback:()=>fr&&navigator.clipboard.writeText(fr),hide:!fr,text:"Copy wallet address"},{Icon:null,callback:br,text:"Disconnect"}];return jsxRuntimeExports.jsx("div",{className:"unknown-wallet-information-container",children:jsxRuntimeExports.jsx("div",{className:"unknown-wallet-information",children:jsxRuntimeExports.jsx("div",{className:"unknown-wallet-information__header",children:jsxRuntimeExports.jsx("div",{className:"unknown-wallet-information__details",children:jsxRuntimeExports.jsxs("div",{className:"unknown-wallet-information__actions-container",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{className:"unknown-wallet-information__address",weight:"medium",variant:"body_normal",color:"primary",children:shortenWalletAddress(fr,4,4)})}),jsxRuntimeExports.jsx(DotsMenu,{options:wr,buttonClassName:"unknown-wallet-information__dots-menu",buttonClassNameWithOpenMenu:"unknown-wallet-information__dots-menu"})]})})})})})},LinkButton=t$7.memo(({connector:fr})=>{const{setDynamicWidgetView:br}=useWidgetContext(),wr=()=>{br("global-wallet")};return fr.globalWallet?jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"link-button",buttonPadding:"small",buttonVariant:"primary",onClick:wr,startSlot:jsxRuntimeExports.jsx(Icon,{size:"small",color:"text-secondary",children:jsxRuntimeExports.jsx(SvgLink,{})}),children:"Connect"}):null});LinkButton.displayName="LinkButton";const DynamicWidgetWalletHeader=({variant:fr})=>{const{primaryWallet:br,user:wr}=useInternalDynamicContext(),{open:Er}=useSendBalance(),{supportsFunding:kr,setShowFunding:jr,fundingEnabled:Br}=useFundingContext(),{setDynamicWidgetView:Wr,setIsOpen:qr}=useWidgetContext(),{isLoadingEmbeddedWallet:Gr}=useWalletContext(),{t:Vr}=useTranslation(),Zr=reactExports.useMemo(()=>{const En=br==null?void 0:br.connector;return En?isSendBalanceWalletConnector(En):!1},[br]),Jr=()=>{fr==="dropdown"?(qr(!1),Er().catch(En=>logger$6.error(En))):Wr("send-balance")},Qr=()=>{const En=wr==null?void 0:wr.verifiedCredentials.find(Cn=>Cn.walletName==="unknown");return br||Gr?jsxRuntimeExports.jsx(ActiveWalletInformation,{isLoading:Gr}):En?jsxRuntimeExports.jsx(UnknownWalletInformation,{address:En.address}):jsxRuntimeExports.jsx("div",{className:"dynamic-widget-wallet-header__icon-container",children:jsxRuntimeExports.jsx(UserAvatar,{user:wr})})},_n=Zr||Br;return jsxRuntimeExports.jsxs("div",{className:"dynamic-widget-wallet-header","data-testid":"dynamic-widget-wallet-header",children:[Qr(),Gr&&jsxRuntimeExports.jsx("div",{className:"dynamic-widget-wallet-header__wallet-info",children:jsxRuntimeExports.jsx("div",{className:"dynamic-widget-wallet-header__wallet-loading",children:jsxRuntimeExports.jsx(Alert,{variant:"info",icon:jsxRuntimeExports.jsx(Spinner$2,{className:"button__spinner"}),children:Vr("dyn_creating_wallet.loading_message")})})}),br?jsxRuntimeExports.jsxs("div",{"data-testid":"primaryWalletStatus",className:"dynamic-widget-wallet-header__wallet-info",children:[jsxRuntimeExports.jsx(SecureEmbeddedWalletCard,{className:"dynamic-widget-wallet-header__wallet-info__secure-wallet"}),_n&&jsxRuntimeExports.jsxs("div",{className:"dynamic-widget-wallet-header__wallet-actions",children:[Br&&jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"buy-crypto-button",buttonPadding:"small",buttonVariant:"primary",onClick:()=>jr(!0),disabled:!kr,startSlot:jsxRuntimeExports.jsx(Icon,{size:"small",color:"text-secondary",children:jsxRuntimeExports.jsx(SvgAdd,{})}),children:"Buy"}),Zr&&jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"send-balance-button",buttonPadding:"small",buttonVariant:"primary",onClick:Jr,startSlot:jsxRuntimeExports.jsx(Icon,{size:"small",color:"text-secondary",children:jsxRuntimeExports.jsx(SvgSend,{})}),children:"Send"}),jsxRuntimeExports.jsx(LinkButton,{connector:br.connector})]})]}):jsxRuntimeExports.jsx(Typography,{className:"dynamic-widget-wallet-header__email",variant:"body_normal",weight:"regular",children:!Gr&&getUserIdentifier(wr)})]})};t$7.memo(DynamicWidgetWalletHeader);const DynamicWidgetHeader=({variant:fr})=>{const{overridenWidgetView:br}=useWidgetContext(),{multiWallet:wr}=useInternalDynamicContext();return jsxRuntimeExports.jsxs("div",{className:"dynamic-widget-header",children:[jsxRuntimeExports.jsx(PasskeyCreatedSuccessBanner,{className:"dynamic-widget-header__passkey-success"}),(br==="wallets"||br==="profile"&&!wr)&&jsxRuntimeExports.jsx(DynamicWidgetWalletHeader,{variant:fr})]})};t$7.memo(DynamicWidgetHeader);const DynamicBridgeWalletCard=({className:fr,networkIcon:br,networkName:wr,children:Er})=>{const{t:kr}=useTranslation();return jsxRuntimeExports.jsxs("div",{className:classNames$1("dynamic-bridge-wallet-card",fr),children:[jsxRuntimeExports.jsxs("div",{className:"dynamic-bridge-wallet-card__network",children:[br&&t$7.cloneElement(br,{className:"dynamic-bridge-wallet-card__network-icon"}),wr&&jsxRuntimeExports.jsx(Typography,{className:"dynamic-bridge-wallet-card__network-name",variant:"body_small",color:"primary",weight:"medium",as:"span",copykey:"dyn_bridge.widget.wallet_network",children:kr("dyn_bridge.widget.wallet_network",{networkName:wr})})]}),Er]})},WalletInformationCard=({address:fr,ens:br,balance:wr,icon:Er,network:kr,menu:jr})=>{const{t:Br}=useTranslation(),Wr=reactExports.useMemo(()=>{const qr=shortenWalletAddress(fr);return br?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_normal",truncate:!0,children:br}),jsxRuntimeExports.jsx(Typography,{weight:"regular",variant:"body_small",color:"secondary",children:qr})]}):jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"body_normal",color:"primary",children:qr})},[br,fr]);return jsxRuntimeExports.jsxs("div",{className:"wallet-information-card",children:[jsxRuntimeExports.jsxs("div",{className:"wallet-information-card__header",children:[jsxRuntimeExports.jsxs("div",{className:"wallet-information-card__details-container",children:[Er&&jsxRuntimeExports.jsx(Icon,{className:"wallet-information-card__icon",children:Er}),jsxRuntimeExports.jsx("div",{className:"wallet-information-card__details",children:Wr}),jsxRuntimeExports.jsx("div",{className:"wallet-information-card__menu",children:jr})]}),kr]}),jsxRuntimeExports.jsxs("div",{className:"wallet-information-card__balance-container",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",copykey:"dyn_wallet_information.balance",children:Br("dyn_wallet_information.balance")}),wr]})]})},DynamicBridgeWalletCardBody=({walletAddress:fr,walletBalance:br,walletKey:wr,onDisconnectClick:Er})=>{const{t:kr}=useTranslation(),jr=useFetchNameService(fr),Br=[{Icon:null,callback:()=>(jr==null?void 0:jr.name)&&navigator.clipboard.writeText(jr==null?void 0:jr.name),hide:!(jr!=null&&jr.name),text:kr("dyn_bridge.widget.copy.ens")},{Icon:null,callback:()=>fr&&navigator.clipboard.writeText(fr),hide:!fr,text:kr("dyn_bridge.widget.copy.address")},{Icon:null,callback:()=>Er==null?void 0:Er(),hide:!Er,text:kr("dyn_bridge.widget.disconnect")}];return jsxRuntimeExports.jsx(WalletInformationCard,{ens:jr==null?void 0:jr.name,address:fr,icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:wr}),balance:br,menu:jsxRuntimeExports.jsx(DotsMenu,{options:Br}),copykey:"dyn_bridge.widget"})},DynamicBridgeWidgetEmptyCard=({chain:fr})=>{const{t:br}=useTranslation(),{bridgeChainsToConnect:wr,setShowAuthFlow:Er,setShowBridgeWidget:kr}=useInternalDynamicContext();if(!(wr!=null&&wr.length)||!fr)return null;const jr=getChainInfoWithOverrides(fr),Br=getChainIcon(fr);return jsxRuntimeExports.jsxs("div",{role:"button",className:"dynamic-bridge-widget-empty-card",onClick:()=>{kr(!1),Er(!0)},children:[jsxRuntimeExports.jsx(Br,{className:"dynamic-bridge-widget-empty-card__icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"medium",as:"span",color:"primary",className:"dynamic-bridge-widget-empty-card__text",copykey:"dyn_bridge.widget.connect_with_network",children:br("dyn_bridge.widget.connect_with_network",{blockchainName:jr==null?void 0:jr.blockchainName})})]})},SecondaryWallets=({hideUnlinkAction:fr=!1})=>{const{disconnectWallet:br,getConnectedWalletById:wr,bridgeChains:Er}=useInternalDynamicContext(),kr=wr("connect-wallet-1"),jr=kr&&getChainIcon(kr==null?void 0:kr.chain),Br=kr&&getChainInfoWithOverrides(kr==null?void 0:kr.chain);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!kr&&jsxRuntimeExports.jsx(DynamicBridgeWidgetEmptyCard,{chain:Er==null?void 0:Er[1].chain}),kr&&jr&&jsxRuntimeExports.jsx(DynamicBridgeWalletCard,{networkIcon:jsxRuntimeExports.jsx(jr,{}),networkName:Br==null?void 0:Br.displayName,children:jsxRuntimeExports.jsx(DynamicBridgeWalletCardBody,{walletKey:kr.connector.key,walletAddress:kr.address,walletBalance:jsxRuntimeExports.jsx(Balance,{wallet:kr,network:kr.chain}),onDisconnectClick:fr?void 0:()=>br(kr.id)},kr.id)})]})},MemoSecondaryWallets=t$7.memo(SecondaryWallets),useSmartWallets=()=>{const{user:fr,walletConnectorOptions:br}=useInternalDynamicContext(),wr=reactExports.useCallback(jr=>{const{verifiedCredentials:Br}=fr??{};if(!Br)return;const Wr=Br.find(qr=>qr.id===jr.id);return(Wr==null?void 0:Wr.walletProvider)===WalletProviderEnum.SmartContractWallet?Wr:void 0},[fr]),Er=reactExports.useCallback(jr=>{var Br,Wr,qr;const Gr=fr==null?void 0:fr.verifiedCredentials;if(!Gr)return;const Vr=wr(jr),Zr=Gr.find(En=>En.id===(Vr==null?void 0:Vr.signerRefId));if(!(Zr!=null&&Zr.address)||!(Zr!=null&&Zr.chain))return;const{walletConnector:Jr}=(Br=findWalletOptionFor(Zr,br))!==null&&Br!==void 0?Br:{},_n=!((Wr=Zr.walletName)===null||Wr===void 0?void 0:Wr.startsWith("turnkey"))||!!(!((qr=Zr.walletProperties)===null||qr===void 0)&&qr.isAuthenticatorAttached);return Jr==null?void 0:Jr.createWallet({address:Zr.address,chain:Jr.connectedChain,connector:Jr,id:Zr.id,isAuthenticated:_n,key:Jr.key})},[wr,fr==null?void 0:fr.verifiedCredentials,br]),kr=reactExports.useCallback(jr=>{var Br;const Wr=fr==null?void 0:fr.verifiedCredentials;if(!Wr)return;const qr=Wr.find(Zr=>Zr.id===jr.id),Gr=Wr.find(Zr=>Zr.signerRefId===(qr==null?void 0:qr.id));if(!(Gr!=null&&Gr.address)||!(Gr!=null&&Gr.chain))return;const{walletConnector:Vr}=(Br=findWalletOptionFor(Gr,br))!==null&&Br!==void 0?Br:{};return Vr==null?void 0:Vr.createWallet({address:Gr.address,chain:Vr.connectedChain,connector:Vr,id:Gr.id,isAuthenticated:!0,key:Vr.key})},[fr==null?void 0:fr.verifiedCredentials,br]);return reactExports.useMemo(()=>({getEOAWallet:Er,getSmartWallet:kr,isSmartWallet:jr=>wr(jr)!==void 0}),[Er,wr,kr])},useIsTurnkeyWallet=()=>{var fr,br,wr;const{primaryWallet:Er,user:kr}=useInternalDynamicContext(),{getEOAWallet:jr}=useSmartWallets(),Br=(fr=Er&&jr(Er))!==null&&fr!==void 0?fr:Er,Wr=()=>{if(!Br||!kr||!Br.connector.key.startsWith("turnkey"))return;const Cn=Br.id,In=kr.verifiedCredentials.find(An=>An.id===Cn);if(In)return In},qr=()=>{if(!Br||!kr)return!1;const Cn=kr.verifiedCredentials.find(An=>{var jn,eo;return((jn=An.walletName)===null||jn===void 0?void 0:jn.startsWith("turnkey"))&&((eo=An.walletProperties)===null||eo===void 0?void 0:eo.isAuthenticatorAttached)===!1});return kr.verifiedCredentials.find(An=>Cn&&An.signerRefId===Cn.id)},Gr=Wr(),Vr=!!qr(),Zr=!!(Gr||Vr),Jr=!!(!((br=Gr==null?void 0:Gr.walletProperties)===null||br===void 0)&&br.isAuthenticatorAttached),Qr=Zr&&!Jr||Vr,_n=Zr&&!!getUserVerifiedCredentialType(kr,JwtVerifiedCredentialFormatEnum.Email),En=Zr&&!!(!((wr=Gr==null?void 0:Gr.walletProperties)===null||wr===void 0)&&wr.isSessionKeyCompatible);return{hasRecoveryEmail:_n,hasTurnkeyVerifiedCredentialAuthenticator:Jr,isSessionKeyCompatible:En,isTurnkeyWallet:Zr,isTurnkeyWalletWithoutAuthenticator:Qr,turnkeyVerifiedCredential:Gr}},findTurnkeyWalletByChain=(fr,br)=>{const wr=br?VerifiedCredentialNameToChainEnum[br]:void 0;return fr==null?void 0:fr.find(({key:Er,walletConnector:kr})=>Er.startsWith("turnkey")&&(kr==null?void 0:kr.connectedChain)===wr)},findTurnkeyWalletByPrimaryChain=(fr,br,wr)=>{var Er;const kr=((Er=br==null?void 0:br.find(Wr=>Wr.primary))===null||Er===void 0?void 0:Er.name)||ChainEnum.Evm,jr=findTurnkeyWalletByChain(fr,ChainEnumToVerifiedCredentialName[kr]),Br=wr==null?void 0:wr.find(({walletName:Wr,chain:qr})=>(Wr==null?void 0:Wr.startsWith("turnkey"))&&qr===ChainEnumToVerifiedCredentialName[kr]);if(jr)return Object.assign(Object.assign({},Br),jr)},getUserWalletsFromVerifiedCredentials=fr=>{var br;return(br=fr.verifiedCredentials)===null||br===void 0?void 0:br.filter(({walletProvider:wr})=>wr)},addPasskeyIdentifierToWalletConnector=(fr,br)=>{var wr;const Er=(br==null?void 0:br.phoneNumber)||((wr=br==null?void 0:br.verifiedCredentials.find(kr=>kr.oauthDisplayName))===null||wr===void 0?void 0:wr.oauthDisplayName)||"";fr.setPasskeyIdentifier(Er)},getEmbeddedWalletAuthHandler=fr=>{if(!fr||!("getAuthenticatorHandler"in fr))throw new DynamicError("Invalid connector type");return fr.getAuthenticatorHandler()},initExport=fr=>__awaiter$e(void 0,[fr],void 0,function*({iframeContainer:br,iframeElementId:wr,wallet:Er}){var kr;if(!(Er!=null&&Er.connector)||!(Er!=null&&Er.id)||!isPasskeyWalletConnector(Er==null?void 0:Er.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings",INVALID_WALLET_DATA);const jr=(kr=Er.connector)===null||kr===void 0?void 0:kr.getExportHandler();if(!(yield jr.initExport(br,wr)))throw new DynamicError("Something went wrong",ERROR_PROCESSING_REVEAL_REQUEST);return jr}),handleExportInitCheck=({user:fr,wallet:br})=>{var wr,Er;if(!fr)throw new DynamicError(USER_NOT_LOGGED_IN);if(!(br!=null&&br.connector)||!(br!=null&&br.id)||!isPasskeyWalletConnector(br==null?void 0:br.connector))throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");const kr=br.connector;kr.setEmail(fr.email);const jr=(Er=(wr=fr.verifiedCredentials)===null||wr===void 0?void 0:wr.find(({walletName:Gr})=>Gr==null?void 0:Gr.startsWith("turnkey")))===null||Er===void 0?void 0:Er.walletProperties,Br=jr==null?void 0:jr.turnkeyHDWalletId,Wr=jr==null?void 0:jr.turnkeyPrivateKeyId,qr=jr==null?void 0:jr.turnkeySubOrganizationId;if(!qr||Br===void 0&&Wr===void 0)throw new DynamicError("Invalid token!");return{connector:kr,organizationId:qr,privateKeyId:Wr,turnkeyHDWalletId:Br}},extractExportBundle=({address:fr,privateKeyId:br,activity:wr})=>{var Er,kr,jr;const Br=fr?(Er=wr.result)===null||Er===void 0?void 0:Er.exportWalletAccountResult:(kr=wr.result)===null||kr===void 0?void 0:kr.exportWalletResult,Wr=br?(jr=wr.result)===null||jr===void 0?void 0:jr.exportPrivateKeyResult:Br;return Wr==null?void 0:Wr.exportBundle},exportCredential=fr=>__awaiter$e(void 0,[fr],void 0,function*({user:br,wallet:wr,environmentId:Er,address:kr}){const{connector:jr,turnkeyHDWalletId:Br,privateKeyId:Wr,organizationId:qr}=handleExportInitCheck({user:br,wallet:wr}),Gr=jr.getExportHandler();if(!Gr.publicKey)throw new DynamicError("Must initialize export first",ERROR_PROCESSING_REVEAL_REQUEST);let Zr;Br?Zr=yield Gr.exportWallet({address:kr,organizationId:qr,walletId:Br}):Wr&&(Zr=yield Gr.exportPrivateKey({organizationId:qr,privateKeyId:Wr}));const Jr=Zr.id,Qr=Zr.status;let _n;if(Qr==="ACTIVITY_STATUS_COMPLETED")_n=extractExportBundle({activity:Zr,address:kr,privateKeyId:Wr});else{const En=yield exportEmbeddedWallet({activityId:Jr,environmentId:Er,walletId:(wr==null?void 0:wr.id)||""});_n=En==null?void 0:En.exportBundle}if(!_n)throw new DynamicError("Invalid export response",ERROR_PROCESSING_REVEAL_REQUEST);return kr||Wr?Gr.verifyExportPrivateKey({chain:wr==null?void 0:wr.chain,exportBundle:_n,organizationId:qr}):Gr.verifyExportWallet({exportBundle:_n,organizationId:qr})}),cleanupExport=fr=>__awaiter$e(void 0,[fr],void 0,function*({wallet:br}){var wr;const Er=br==null?void 0:br.connector;(wr=Er==null?void 0:Er.getExportHandler())===null||wr===void 0||wr.clear()}),validateTurnkeyProviderEnabled=fr=>{const br=isTurnkeyEnabled(fr);if(!br)throw new DynamicError("No embedded wallet is enabled. Go to the dashboard and make sure to have both Embedded wallets and at least one EVM network enabled. Also, check if EthereumWalletConnectors is in the DynamicContextProvider > settings > walletConnectors.",SECURE_ENCLAVE_PROVIDER_NOT_ENABLED);return br},createEmbeddedWalletRequest=fr=>__awaiter$e(void 0,[fr],void 0,function*({user:br,walletConnector:wr,environmentId:Er,chains:kr,webAuthnAttestation:jr,withAuthenticator:Br}){if(!wr)throw new DynamicError("Connector is missing. Please make sure you added EthereumWalletConnectors and/or SolanaWalletConnectors to DynamicProvider settings");if(!br)throw new DynamicError("User is not defined");wr.setEmail(br.email);let Wr;if(Br||jr!==void 0){br.email||addPasskeyIdentifierToWalletConnector(wr,br);const{attestation:Zr,challenge:Jr,displayName:Qr}=jr||(yield wr.getWebAuthnAttestation());Wr={attestation:Zr,challenge:Jr,passkeyAlias:Qr}}const qr=yield createTurnkeyEmbeddedWallet(Object.assign({chains:kr,environmentId:Er},Wr));if(!qr)throw new DynamicError("Failed to create embedded wallet");const Gr=wr.connectedChain,Vr=findEmbeddedWalletFromVerifiedCredentials(qr,[Gr]);if(!Vr)throw new DynamicError("EmbeddedWalletVerifiedCredential not found");return wr.setVerifiedCredentials(qr.verifiedCredentials),{embeddedWalletVerifiedCredential:Vr,updatedUser:qr,walletConnector:wr}}),findPasskeyEmailWalletConnector=(fr,br)=>fr.map(({walletConnector:Er})=>Er).find(Er=>isPasskeyWalletConnector(Er)&&isEmailWalletConnector(Er)&&Er.connectedChain===br),findOwner=(fr,br)=>br.find(wr=>wr.id===fr.signerRefId),findSmartWallet=(fr,br)=>br.find(wr=>wr.signerRefId===fr.id),isOwnerOfASmartWallet=(fr,br)=>!!findSmartWallet(fr,br),initializeSmartWallet=fr=>__awaiter$e(void 0,[fr],void 0,function*({account:br,verifiedCredentials:wr,walletConnectorOptions:Er,primaryWalletId:kr}){var jr,Br,Wr,qr,Gr;const Vr=findOwner(br,wr);if(!Vr)throw new Error("could not find associated eoa account for smart wallet");const Zr=findWalletOptionFor(Vr,Er);if(!Zr)throw new Error("could not find owner wallet from wallet options");if(Zr&&isTurnkeyWalletConnector(Zr.walletConnector)){const En=(Br=(jr=Zr.walletConnector)===null||jr===void 0?void 0:jr.verifiedCredentials)===null||Br===void 0?void 0:Br.reduce((Cn,In)=>In.smartWalletRefAddress&&br.address&&br.chain&&isSameAddress$1(In.smartWalletRefAddress,br.address,VerifiedCredentialNameToChainEnum[br.chain])?[In,...Cn]:[...Cn,In],[]);En&&Zr.walletConnector.setVerifiedCredentials(En)}const Jr=findWalletOptionFor(br,Er);if(!Jr)throw new Error("could not find smart wallet from wallet options");const Qr=Jr.walletConnector;if(!isAccountAbstractionConnector(Qr))throw new Error("could not initialize smart wallet");if(!Vr.address||!br.address)throw new Error("could not find owner or smart wallet address");const _n=kr===Vr.id||kr===br.id;yield Qr.registerEoa({ecdsaProviderType:(Wr=br.walletProperties)===null||Wr===void 0?void 0:Wr.ecdsaProviderType,entryPointVersion:(qr=br.walletProperties)===null||qr===void 0?void 0:qr.entryPointVersion,eoaAddress:Vr.address,eoaConnector:Zr.walletConnector,kernelVersion:(Gr=br.walletProperties)===null||Gr===void 0?void 0:Gr.kernelVersion,shouldSetEoaConnector:_n,smartWalletAddress:br.address})}),useCreateDynamicEmbeddedWalletMutation=()=>{var fr,br;const{setPrimaryWalletId:wr,user:Er,setShowAuthFlow:kr,projectSettings:jr}=useInternalDynamicContext(),[Br,Wr]=reactExports.useState(!1),[qr,Gr]=reactExports.useState(),Vr=((br=(fr=jr==null?void 0:jr.sdk)===null||fr===void 0?void 0:fr.embeddedWallets)===null||br===void 0?void 0:br.chainConfigurations)||[],Zr=findPrimaryEmbeddedChain(jr),Jr=Vr.filter(_n=>_n.enabled).map(_n=>_n.name==="SOL"?EmbeddedWalletChainEnum.Sol:EmbeddedWalletChainEnum.Evm);return{createDynamicEmbeddedWalletMutation:reactExports.useCallback(_n=>__awaiter$e(void 0,[_n],void 0,function*({environmentId:En,walletConnectorOptions:Cn,withAuthenticator:In,options:An,chains:jn}){var eo,ro;if(Wr(!0),!Er)throw new DynamicError(USER_NOT_LOGGED_IN);try{const{embeddedWalletVerifiedCredential:to,updatedUser:_i,walletConnector:oo}=yield createEmbeddedWalletRequest({chains:jn??Jr,environmentId:En,user:Er,walletConnector:findPasskeyEmailWalletConnector(Cn,Zr),webAuthnAttestation:An==null?void 0:An.webAuthnAttestation,withAuthenticator:In}),io=(eo=_i.verifiedCredentials)===null||eo===void 0?void 0:eo.find(({walletName:Tn})=>Tn==null?void 0:Tn.startsWith("turnkey")),co=!!(!((ro=io==null?void 0:io.walletProperties)===null||ro===void 0)&&ro.isAuthenticatorAttached),so=oo.createWallet({address:(yield oo.getAddress())||"",chain:oo.connectedChain,connector:oo,id:to.id,isAuthenticated:co,key:to.walletName||oo.key}),no=findSmartWallet(to,_i.verifiedCredentials);no?(yield initializeSmartWallet({account:no,primaryWalletId:no.id,verifiedCredentials:_i.verifiedCredentials,walletConnectorOptions:Cn}),wr(no.id)):wr(to.id),dynamicEvents.emit("embeddedWalletCreated",so,io,_i),kr(!1,{performMultiWalletChecks:!1})}catch(to){logger$6.error("Failed to create embedded wallet",to),Gr(to),dynamicEvents.emit("embeddedWalletFailed",to)}finally{Wr(!1)}}),[Jr,Zr,wr,kr,Er]),error:qr,isLoading:Br}},useTurnkey=()=>{const{projectSettings:fr,setPrimaryWalletId:br,walletConnectorOptions:wr,setShowAuthFlow:Er,environmentId:kr,user:jr,primaryWallet:Br}=useInternalDynamicContext(),{setView:Wr}=useViewContext(),{createDynamicEmbeddedWalletMutation:qr}=useCreateDynamicEmbeddedWalletMutation(),{getEOAWallet:Gr}=useSmartWallets(),Vr=reactExports.useCallback((_n,En)=>__awaiter$e(void 0,void 0,void 0,function*(){return new Promise((Cn,In)=>{dynamicEvents.once("embeddedWalletCreated",An=>{Cn(An)}),dynamicEvents.once("embeddedWalletFailed",An=>In(An)),qr({chains:_n,environmentId:kr,options:En,walletConnectorOptions:wr,withAuthenticator:!1}).then(()=>{Er(!1,{performMultiWalletChecks:!1})}).catch(An=>{In(An)})})}),[qr,kr,wr,Er]),Zr=reactExports.useCallback(_n=>__awaiter$e(void 0,void 0,void 0,function*(){return Er(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1}),Wr("passkey-intro",{chains:_n}),new Promise((En,Cn)=>{dynamicEvents.once("embeddedWalletCreated",In=>En(In)),dynamicEvents.once("embeddedWalletFailed",In=>{if(In instanceof DOMException&&In.name==="NotAllowedError"){logger$6.error("User cancelled the passkey creation.",In);return}Cn(In)})})}),[Er,Wr]),Jr=reactExports.useCallback(_n=>__awaiter$e(void 0,void 0,void 0,function*(){var En,Cn;const{chain:In}=_n,An=findTurnkeyWalletByChain(wr,In);let jn=null;if(jr){(En=An==null?void 0:An.walletConnector)===null||En===void 0||En.setVerifiedCredentials(jr.verifiedCredentials);const _i=findSmartWallet(_n,jr.verifiedCredentials);_i?(yield initializeSmartWallet({account:_i,primaryWalletId:_i.id,verifiedCredentials:jr.verifiedCredentials,walletConnectorOptions:wr}),jn=_i.id):jn=_n.id}jn&&br(jn);const eo=!!(!((Cn=_n.walletProperties)===null||Cn===void 0)&&Cn.isAuthenticatorAttached);if(!(An!=null&&An.walletConnector))throw new Error("Could not find the embedded wallet connector");const ro=An.walletConnector,to=ro.createWallet({address:(yield ro.getAddress())||"",chain:ro.connectedChain,connector:ro,id:_n.id,isAuthenticated:eo,key:_n.walletName||ro.key||""});return Promise.resolve(to)}),[br,wr,jr]);return{createTurnkeyWallet:reactExports.useCallback((_n,En)=>__awaiter$e(void 0,void 0,void 0,function*(){var Cn,In,An,jn,eo,ro;if(!jr)throw new Error(USER_NOT_LOGGED_IN);const to=((Cn=fr==null?void 0:fr.sdk.embeddedWallets)===null||Cn===void 0?void 0:Cn.automaticEmbeddedWalletCreation)===!1,_i=((In=fr==null?void 0:fr.sdk.embeddedWallets)===null||In===void 0?void 0:In.defaultWalletVersion)===EmbeddedWalletVersionEnum.V2,oo=findPrimaryEmbeddedChain(fr),io=findEmbeddedWalletFromVerifiedCredentials(jr,_n??[oo]),co=getUserWalletsFromVerifiedCredentials(jr);if(!(co!=null&&co.length)||!io&&to){const so=getUserVerifiedCredentialType(jr,JwtVerifiedCredentialFormatEnum.Email);return!(!((An=fr==null?void 0:fr.sdk.embeddedWallets)===null||An===void 0)&&An.forceAuthenticatorAtSignup)&&so||En!=null&&En.webAuthnAttestation||_i?Vr(_n,En):Zr(_n)}else if(io&&jr.newUser&&(!((jn=fr==null?void 0:fr.sdk.embeddedWallets)===null||jn===void 0)&&jn.automaticEmbeddedWalletCreation)){const so=findPasskeyEmailWalletConnector(wr,oo);if(!so)throw new Error("Could not find the embedded wallet connector");const no=so.createWallet({address:(yield so.getAddress())||"",chain:so.connectedChain,connector:so,id:io.id,isAuthenticated:!!(!((eo=io==null?void 0:io.walletProperties)===null||eo===void 0)&&eo.isAuthenticatorAttached),key:(ro=io.walletName)!==null&&ro!==void 0?ro:so.key});br(io.id),dynamicEvents.emit("embeddedWalletCreated",no,io,jr)}if(Er(!1,{performMultiWalletChecks:!1}),!io)throw new Error("Primary wallet is not an embedded wallet");return Jr(io)}),[jr,fr,Br,Gr,Er,Jr,Vr,Zr,wr,br])}},isConnectorSessionKeyActive=fr=>{var br;return!fr||!isSessionKeyCompatibleWalletConnector(fr)?!1:!!(!((br=fr.sessionKeys)===null||br===void 0)&&br.publicKey)},useSecureEnclaveEmbeddedWallet=()=>{var fr,br,wr,Er;const{projectSettings:kr,primaryWallet:jr,user:Br,environmentId:Wr,walletConnectorOptions:qr}=useInternalDynamicContext(),{createTurnkeyWallet:Gr}=useTurnkey(),{hasRecoveryEmail:Vr}=useIsTurnkeyWallet(),{createRootElement:Zr}=useElementById(),{isLoadingEmbeddedWallet:Jr,setIsLoadingEmbeddedWallet:Qr}=useWalletContext(),{getEOAWallet:_n}=useSmartWallets(),En=(fr=jr&&_n(jr))!==null&&fr!==void 0?fr:jr,Cn=reactExports.useCallback(()=>hasEmbeddedWallet(Br,"turnkey"),[Br]),In=reactExports.useCallback(()=>isSessionKeyCompatibleWalletConnector(En==null?void 0:En.connector)?EmbeddedWalletVersion.V2:EmbeddedWalletVersion.V1,[En==null?void 0:En.connector]),{shouldInitRecovery:An,initPasskeyRecoveryProcess:jn}=usePasskeyRecovery(),eo=reactExports.useCallback((Xr,Sn)=>__awaiter$e(void 0,void 0,void 0,function*(){var Rn;if(!Br)throw new DynamicError(USER_NOT_LOGGED_IN);const Pn=getUserWalletsFromVerifiedCredentials(Br),On=findPrimaryEmbeddedChain(kr),Zn=findEmbeddedWalletFromVerifiedCredentials(Br,Xr??[On]),Nn=((Rn=kr==null?void 0:kr.sdk.embeddedWallets)===null||Rn===void 0?void 0:Rn.automaticEmbeddedWalletCreation)===!1;if(Pn!=null&&Pn.length&&!Zn&&!Nn)throw new EmbeddedWalletException("User already has a linked branded wallet, and manual mode creation is not enabled.");return validateTurnkeyProviderEnabled(kr),Qr(!1),Gr(Xr,Sn)}),[Gr,kr,Qr,Br]),ro=reactExports.useCallback(Xr=>__awaiter$e(void 0,[Xr],void 0,function*({chain:Sn}){var Rn,Pn,On;if(!Br)throw new Error(USER_NOT_LOGGED_IN);validateTurnkeyProviderEnabled(kr);const Zn=findPrimaryEmbeddedChain(kr),Nn=findEmbeddedWalletFromVerifiedCredentials(Br,[Zn]);if(!((Rn=Nn==null?void 0:Nn.walletProperties)===null||Rn===void 0?void 0:Rn.turnkeyHDWalletId))throw new DynamicError("No HD wallet was found for this user to derive a wallet account. Use createEmbeddedWallet first","NoHdWalletFound");const zn=yield getCreateEmbeddedWalletAccountRequest({chain:Sn,environmentId:Wr});isSessionKeyCompatibleWalletConnector(En==null?void 0:En.connector)?yield(Pn=En==null?void 0:En.connector)===null||Pn===void 0?void 0:Pn.createOrRestoreSession({ignoreRestore:!0}):(yield An())&&(yield jn("email"));const fo=yield(On=En==null?void 0:En.connector)===null||On===void 0?void 0:On.stampCreateWalletAccountRequest({request:zn});return yield createEmbeddedWalletAccount({createEmbeddedWalletAccountRequest:fo,environmentId:Wr}),refreshUserJwt({environmentId:Wr})}),[Wr,En==null?void 0:En.connector,jn,kr,An,Br]),to=reactExports.useCallback(Xr=>__awaiter$e(void 0,void 0,void 0,function*(){var Sn,Rn,Pn,On,Zn,Nn;if(!Br)throw new DynamicError(USER_NOT_LOGGED_IN);const wn=jr==null?void 0:jr.connector;if(wn&&isSessionKeyCompatibleWalletConnector(wn))return wn.createOrRestoreSession();const zn=En==null?void 0:En.connector;if(zn&&isSessionKeyCompatibleWalletConnector(zn))return zn.createOrRestoreSession();const fo=getEmbeddedWalletAuthHandler(En==null?void 0:En.connector);if(fo.isSessionActive())return ACTIVE_SESSION;const vo=Zr(iframeContainerId$2);if(canRestoreEmbeddedWalletSession((Sn=kr==null?void 0:kr.sdk.embeddedWallets)===null||Sn===void 0?void 0:Sn.sessionKeyDuration))try{if(yield restoreEmbeddedWalletSession({iframeContainer:vo.current,iframeElementId:iframeElementId$2,sessionExpiration:getEmbeddedWalletSessionExpiration((Pn=(Rn=kr==null?void 0:kr.sdk)===null||Rn===void 0?void 0:Rn.embeddedWallets)===null||Pn===void 0?void 0:Pn.sessionKeyDuration),user:Br,wallet:jr}))return SESSION_RESTORED}catch(lo){logger$6.error("Failed to restore embedded wallet",lo)}if(!(Xr!=null&&Xr.oneTimeCode))throw new DynamicError("One-time code is required to create a session.",INVALID_REQUEST$1);if(!Cn()||!Vr)throw new DynamicError("User does not have a secure enclave wallet or a verified email",INVALID_WALLET_DATA);const go=(Nn=(Zn=(On=Br==null?void 0:Br.verifiedCredentials)===null||On===void 0?void 0:On.find(({walletName:lo})=>lo==null?void 0:lo.startsWith("turnkey")))===null||Zn===void 0?void 0:Zn.walletProperties)===null||Nn===void 0?void 0:Nn.turnkeySubOrganizationId;yield fo.verifyRecoveryCode(Xr.oneTimeCode,go);const uo={createdAt:new Date().getTime(),emailCode:Xr.oneTimeCode,userId:fo.recoveryUserId};return StorageService.setItem(EMBEDDED_WALLET_SESSION_SETTINGS,uo),SESSION_CREATED}),[Zr,Br,Vr,jr,(wr=(br=kr==null?void 0:kr.sdk)===null||br===void 0?void 0:br.embeddedWallets)===null||wr===void 0?void 0:wr.sessionKeyDuration,Cn,En==null?void 0:En.connector]),_i=reactExports.useCallback(Xr=>__awaiter$e(void 0,void 0,void 0,function*(){var Sn,Rn;if(!Br)throw new DynamicError(USER_NOT_LOGGED_IN);validateTurnkeyProviderEnabled(kr);const Pn=findTurnkeyWalletByPrimaryChain(qr,(Sn=kr==null?void 0:kr.sdk.embeddedWallets)===null||Sn===void 0?void 0:Sn.chainConfigurations,Br.verifiedCredentials);if(!(Pn!=null&&Pn.walletConnector))throw new DynamicError("Wallet connector not found",INVALID_WALLET_DATA);const On=Pn.walletConnector;On.setEmail(Br==null?void 0:Br.email),Br&&!(Br!=null&&Br.email)&&addPasskeyIdentifierToWalletConnector(On,Br);const Zn=getUserVerifiedCredentialType(Br,JwtVerifiedCredentialFormatEnum.Email);if(!("id"in Pn)||!Zn)return On.getWebAuthnAttestation();const Nn=(Rn=Pn==null?void 0:Pn.walletProperties)===null||Rn===void 0?void 0:Rn.turnkeySubOrganizationId;if(!Nn)throw new DynamicError("No sub organization id found for the wallet",INVALID_WALLET_DATA);const wn=getEmbeddedWalletAuthHandler(On);yield to(Xr);const{attestation:zn,challenge:fo,displayName:vo}=yield On.getWebAuthnAttestation();if(yield wn.addPasskeyAuthenticator({attestation:zn,challenge:fo,turnkeySubOrganizationId:Nn}),!(yield completePasskeyRecovery$1({attestation:zn,challenge:fo,environmentId:Wr,walletId:Pn==null?void 0:Pn.id})))throw new DynamicError("Error completing passkey recovery");return{attestation:zn,challenge:fo,displayName:vo}}),[to,Wr,kr,Br,qr]),oo=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){if(!Br)throw new DynamicError(USER_NOT_LOGGED_IN);return(yield getUserPasskeys({environmentId:Wr})).passkeys}),[Br,Wr]),io=reactExports.useMemo(()=>{var Xr;const Sn=En==null?void 0:En.connector;return!Sn||!("getAuthenticatorHandler"in Sn)?!1:(Xr=getEmbeddedWalletAuthHandler(Sn))===null||Xr===void 0?void 0:Xr.isSessionActive()},[En==null?void 0:En.connector]),co=reactExports.useMemo(()=>isConnectorSessionKeyActive(En==null?void 0:En.connector),[En==null?void 0:En.connector]),so=reactExports.useMemo(()=>isConnectorSessionKeyActive(jr==null?void 0:jr.connector),[jr==null?void 0:jr.connector]),no=io||so||co,Tn=reactExports.useCallback(Xr=>__awaiter$e(void 0,[Xr],void 0,function*({type:Sn,htmlContainerId:Rn}){var Pn,On,Zn,Nn,wn,zn;if(!Br)throw new DynamicError(USER_NOT_LOGGED_IN);yield cleanupExport({wallet:En});const fo=findTurnkeyWalletByPrimaryChain(qr,(Pn=kr==null?void 0:kr.sdk.embeddedWallets)===null||Pn===void 0?void 0:Pn.chainConfigurations,Br==null?void 0:Br.verifiedCredentials),vo=(On=fo==null?void 0:fo.walletProperties)===null||On===void 0?void 0:On.turnkeyHDWalletId;Sn==="recoveryPhrase"&&!vo&&(Sn="privateKey");const go=Zr(revealIframeElementId,Rn||revealIframeContainerId);go.current.style.display="none",isSessionKeyCompatibleWalletConnector(En==null?void 0:En.connector)&&(yield(Zn=En==null?void 0:En.connector)===null||Zn===void 0?void 0:Zn.createOrRestoreSession()),yield initExport({iframeContainer:go.current,iframeElementId:revealIframeElementId,wallet:En});try{yield exportCredential({address:Sn==="privateKey"?En==null?void 0:En.address:void 0,environmentId:Wr,user:Br,wallet:En})}catch{isSessionKeyCompatibleWalletConnector(En==null?void 0:En.connector)&&(!((Nn=En==null?void 0:En.connector)===null||Nn===void 0)&&Nn.removeSessionKeys)&&(yield(wn=En==null?void 0:En.connector)===null||wn===void 0?void 0:wn.removeSessionKeys(),yield(zn=En==null?void 0:En.connector)===null||zn===void 0?void 0:zn.createOrRestoreSession({ignoreRestore:!0})),yield exportCredential({address:Sn==="privateKey"?En==null?void 0:En.address:void 0,environmentId:Wr,user:Br,wallet:En})}return go.current.style.display="block",!0}),[Zr,Wr,En,(Er=kr==null?void 0:kr.sdk.embeddedWallets)===null||Er===void 0?void 0:Er.chainConfigurations,Br,qr]),Hr=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){var Xr,Sn;if(!Br)throw new DynamicError(USER_NOT_LOGGED_IN);const Rn=findTurnkeyWalletByPrimaryChain(qr,(Xr=kr==null?void 0:kr.sdk.embeddedWallets)===null||Xr===void 0?void 0:Xr.chainConfigurations,Br.verifiedCredentials);if(!Rn||!("id"in Rn))throw new DynamicError("User does not have a valid secure enclave wallet",INVALID_WALLET_DATA);const Pn=getEmbeddedWalletAuthHandler(Rn==null?void 0:Rn.walletConnector),On=Rn.id;if(Pn.isSessionActive())throw new DynamicError("Session is active. No need to create a new one",ACTIVE_SESSION);const Nn=Zr(iframeContainerId$2),wn=yield Pn.initRecovery("email",Nn.current,iframeElementId$2,getEmbeddedWalletSessionExpiration((Sn=kr==null?void 0:kr.sdk.embeddedWallets)===null||Sn===void 0?void 0:Sn.sessionKeyDuration));if(!wn)throw new DynamicError(ERROR_SENDING_CODE);const zn=yield initEmbeddedWalletSession$1({authenticatorType:"email",environmentId:Wr,publicKey:wn,walletId:On});return Pn.recoveryUserId=zn.turnkeyUserId,CODE_SENT}),[Zr,Br,Wr,kr,qr]);return reactExports.useMemo(()=>({createEmbeddedWallet:eo,createEmbeddedWalletAccount:ro,createOrRestoreSession:to,createPasskey:_i,getPasskeys:oo,getWalletVersion:In,isLoadingEmbeddedWallet:Jr,isSessionActive:no,revealEmbeddedWalletKey:Tn,sendOneTimeCode:Hr,userHasEmbeddedWallet:Cn}),[eo,ro,to,_i,oo,In,Jr,no,Tn,Hr,Cn])},findCoinbaseMPCWallet=fr=>fr==null?void 0:fr.find(({key:br})=>br==="coinbasempc"),requiresPasswordForEmbeddedWallet=fr=>{var br,wr;const Er=(wr=(br=fr==null?void 0:fr.sdk.embeddedWallets)===null||br===void 0?void 0:br.supportedSecurityMethods)===null||wr===void 0?void 0:wr.password;return Er?Er.isEnabled&&Er.isDefault:!1},requiresPasswordForEmbeddedWalletOnSignup=fr=>{const br=fr==null?void 0:fr.sdk.embeddedWallets;return br?requiresPasswordForEmbeddedWallet(fr)&&!!br.forceAuthenticatorAtSignup:!1},validateMPCProviderEnabled=fr=>{if(!fr)throw new Error("Project settings are missing");if(!isCoinbaseWaasEnabled(fr))throw new Error("No embedded wallet is enabled. Go to the dashboard and make sure to have both Embedded wallets and at least one EVM network enabled. Also, check if EthereumWalletConnectors is in the DynamicContextProvider > settings > walletConnectors.")},useEmbeddedWalletPassword=()=>{const{primaryWallet:fr,setShowAuthFlow:br,environmentId:wr}=useInternalDynamicContext(),{setView:Er}=useViewContext(),kr=reactExports.useCallback((Br,Wr)=>__awaiter$e(void 0,void 0,void 0,function*(){return br(!0,{ignoreIfIsEmbeddedWidget:!1}),Br?Er("wallet-claim-intro"):Er("create-password-view",{isSignUp:Wr,notCalledFromWalletUtils:!0}),new Promise((qr,Gr)=>{dynamicEvents.once("embeddedWalletCreatePasswordCompleted",Vr=>qr(Vr)),dynamicEvents.once("embeddedWalletCreatePasswordFailed",Vr=>Gr(Vr))})}),[br,Er]);return{claimWallet:reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){try{if(!fr)throw new Error("No primary wallet");if("code"in(yield claimEmbeddedWallet({environmentId:wr,walletId:fr.id}))){logger$6.error("Error updating jwt after claiming wallet");return}}catch(Br){throw logger$6.error("Error claiming wallet",Br),new Error("Error claiming wallet")}}),[wr,fr]),createPassword:kr}},generateRandomPassword=(fr=20)=>{const br="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()";let wr="";for(let Er=0;Er({fetchAuthToken:()=>__awaiter$e(void 0,void 0,void 0,function*(){return(yield getWalletAuthToken({environmentId:fr,type:EmbeddedWalletAuthType.Mpc}))||""}),fetchBackupCode:()=>__awaiter$e(void 0,void 0,void 0,function*(){return(yield getEmbeddedWalletBackup({environmentId:fr}))||""}),fetchPasscode:()=>__awaiter$e(void 0,void 0,void 0,function*(){return(yield getEmbeddedWalletPasscode({environmentId:fr}))||""})}),DYNAMIC_PASSWORD_LENGTH=20,useCoinbaseMPC=()=>{const{user:fr,setPrimaryWalletId:br,walletConnectorOptions:wr,environmentId:Er,consumeNonce:kr,displaySiweStatement:jr,appName:Br,siweStatement:Wr,handleLogOut:qr,setShowAuthFlow:Gr}=useInternalDynamicContext(),{setError:Vr}=useErrorContext(),Zr=reactExports.useCallback((En,Cn,In)=>__awaiter$e(void 0,void 0,void 0,function*(){var An;return Cn.setVerifiedCredentials(En.verifiedCredentials),br(In.id),Cn.createWallet({address:(yield Cn==null?void 0:Cn.getAddress())||"",chain:Cn.connectedChain,connector:Cn,id:In.id,isAuthenticated:!0,key:(An=In.walletName)!==null&&An!==void 0?An:Cn.key})}),[br]),Jr=reactExports.useCallback(En=>__awaiter$e(void 0,[En],void 0,function*({connector:Cn,backupCode:In,password:An,source:jn}){const eo=kr();if(eo===void 0)throw new DynamicError("Missing nonce");const ro=yield Cn.getAddress();if(!ro)throw new DynamicError("Missing address");const to=yield getVerifyArgs({displaySiweStatement:jr,environmentId:Er,nonce:eo,publicWalletAddress:ro,siweStatement:getSiweStatement({appName:Br,siweStatement:Wr}),walletConnector:Cn,walletProvider:"embeddedWallet"}),_i=jn===PasswordSourceTypeEnum.Dynamic?{password:An,passwordSource:jn}:{},oo=yield linkWallet(Er,Object.assign(Object.assign(Object.assign({},_i),to),{backup:In}));if(!oo)throw new DynamicError("Unable to link wallet");const io=createUserProfileFromSdkUser(oo.user),co=io.verifiedCredentials.find(so=>so.id===io.lastVerifiedCredentialId&&so.format==="blockchain");if(!co)throw new DynamicError("No primary wallet found");return br(co.id),Cn.setVerifiedCredentials(io.verifiedCredentials),{newSelectedCredentialWallet:co,updatedUser:io}}),[Br,kr,jr,Er,br,Wr]),Qr=reactExports.useCallback((En,Cn)=>__awaiter$e(void 0,void 0,void 0,function*(){var In;const An=Cn||generateRandomPassword(DYNAMIC_PASSWORD_LENGTH),jn=Cn?PasswordSourceTypeEnum.User:PasswordSourceTypeEnum.Dynamic;try{const eo=yield En.generateWallet(jn,An),{updatedUser:ro,newSelectedCredentialWallet:to}=yield Jr({backupCode:eo,connector:En,password:An,source:jn}),_i=En.createWallet({address:(yield En==null?void 0:En.getAddress())||"",chain:En==null?void 0:En.connectedChain,connector:En,id:to.id,isAuthenticated:!0,key:(In=to.walletName)!==null&&In!==void 0?In:En.key});return dynamicEvents.emit("embeddedWalletCreated",_i,to,ro),_i}catch(eo){logger$6.error(eo),eo instanceof DynamicError&&eo.code==="create_embedded_wallet_error"&&(yield qr(),Vr(eo.message))}}),[Jr,qr,Vr]);return{createCoinbaseMPCWallet:reactExports.useCallback((...En)=>__awaiter$e(void 0,[...En],void 0,function*(Cn=[EmbeddedWalletChainEnum.Evm],In){var An;if(!fr)throw new DynamicError(USER_NOT_LOGGED_IN);const jn=(An=findCoinbaseMPCWallet(wr))===null||An===void 0?void 0:An.walletConnector;if(!jn||!isCoinbaseMpcWalletConnector(jn)){const to=new DynamicError("CoinbaseWaaSWalletConnectors not found");throw logger$6.error("Failed to create embedded wallet",to),dynamicEvents.emit("embeddedWalletFailed",to),Vr(to.message),to}Gr(!1);const{fetchAuthToken:eo}=getCoinbaseMPCConnectorFetchers({environmentId:Er});eo&&jn.setAuthTokenFetcher(eo);const ro=findEmbeddedWalletFromVerifiedCredentials(fr,Cn);return ro?Zr(fr,jn,ro):Qr(jn,In)}),[fr,wr,Gr,Er,Qr,Vr,Zr])}},useMPCEmbeddedWallet=()=>{const{projectSettings:fr,walletConnectorOptions:br,user:wr}=useInternalDynamicContext(),{createPassword:Er}=useEmbeddedWalletPassword(),{createCoinbaseMPCWallet:kr}=useCoinbaseMPC(),{isLoadingEmbeddedWallet:jr,setIsLoadingEmbeddedWallet:Br}=useWalletContext(),Wr=()=>hasEmbeddedWallet(wr,"coinbase"),qr=reactExports.useCallback(Qr=>__awaiter$e(void 0,void 0,void 0,function*(){return Er(Qr)}),[Er]),Gr=reactExports.useCallback(Qr=>__awaiter$e(void 0,void 0,void 0,function*(){var _n,En,Cn;if(!wr)throw new DynamicError(USER_NOT_LOGGED_IN);const In=getUserWalletsFromVerifiedCredentials(wr),An=findEmbeddedWalletFromVerifiedCredentials(wr,Qr),jn=((_n=fr==null?void 0:fr.sdk.embeddedWallets)===null||_n===void 0?void 0:_n.automaticEmbeddedWalletCreation)===!1;if(In!=null&&In.length&&!An&&!jn)throw new EmbeddedWalletException("User already has a linked branded wallet, and manual mode creation is not enabled.");validateMPCProviderEnabled(fr);const eo=(En=findCoinbaseMPCWallet(br))===null||En===void 0?void 0:En.walletConnector;if(!isCoinbaseMpcWalletConnector(eo))throw new Error("Coinbase MPC wallet connector not found");eo.setRequiredPassword((Cn=requiresPasswordForEmbeddedWallet(fr))!==null&&Cn!==void 0?Cn:!1)}),[wr,fr,br]),Vr=reactExports.useCallback(Qr=>__awaiter$e(void 0,void 0,void 0,function*(){try{return yield Gr(Qr),!0}catch{return!1}}),[Gr]),Zr=reactExports.useCallback(Qr=>__awaiter$e(void 0,void 0,void 0,function*(){if(!wr)throw new DynamicError(USER_NOT_LOGGED_IN);yield Gr(Qr),Br(!0);let _n;!findEmbeddedWalletFromVerifiedCredentials(wr,Qr)&&requiresPasswordForEmbeddedWalletOnSignup(fr)&&(_n=yield Er(!1,!0));const Cn=yield kr(Qr,_n);return Br(!1),Cn}),[wr,kr,Er,Gr,fr,Br]);return{canCreateMPCWallet:Vr,createEmbeddedWallet:Zr,createPassword:qr,isLoadingEmbeddedWallet:jr,revealEmbeddedWalletKey:()=>__awaiter$e(void 0,void 0,void 0,function*(){throw new DynamicError("Coinbase MPC wallet does not support headless reveal yet")}),userHasEmbeddedWallet:Wr}},useEmbeddedWallet=()=>{const{user:fr,projectSettings:br,setPrimaryWalletId:wr}=useInternalDynamicContext(),{isTurnkeyWallet:Er}=useIsTurnkeyWallet(),{createEmbeddedWallet:kr,canCreateMPCWallet:jr,createPassword:Br,revealEmbeddedWalletKey:Wr}=useMPCEmbeddedWallet(),{createEmbeddedWallet:qr,createEmbeddedWalletAccount:Gr,createOrRestoreSession:Vr,createPasskey:Zr,revealEmbeddedWalletKey:Jr,getPasskeys:Qr,isSessionActive:_n,sendOneTimeCode:En,getWalletVersion:Cn}=useSecureEnclaveEmbeddedWallet(),{isLoadingEmbeddedWallet:In}=useWalletContext(),An=reactExports.useCallback(()=>hasEmbeddedWallet(fr),[fr]),jn=reactExports.useCallback(()=>{if(!fr)throw new DynamicError(USER_NOT_LOGGED_IN);if(!An())throw new DynamicError("Embedded wallet not found");if(Er)return Cn()},[Cn,Er,fr,An]),eo=reactExports.useCallback((_i,oo)=>__awaiter$e(void 0,void 0,void 0,function*(){return(yield jr(_i))?yield kr(_i):yield qr(_i,oo)}),[jr,kr,qr]),ro=_i=>__awaiter$e(void 0,void 0,void 0,function*(){if(!fr)throw new DynamicError(USER_NOT_LOGGED_IN);if(!An())throw new DynamicError("Embedded wallet not found");return Er?Jr(_i):Wr()}),to=reactExports.useCallback(_i=>{var oo,io,co,so,no;const Tn=isTurnkeyEnabled(br)||isCoinbaseWaasEnabled(br),Hr=StorageService.getItem(PRIMARY_WALLET_ID);if(!Tn||Hr)return!1;if(_i){const Xr=findPrimaryEmbeddedChain(br),Sn=(oo=findEmbeddedWalletFromVerifiedCredentials(_i,[Xr]))===null||oo===void 0?void 0:oo.id,Rn=(co=(io=_i.verifiedCredentials)===null||io===void 0?void 0:io.find(On=>On.walletProvider===WalletProviderEnum.SmartContractWallet))===null||co===void 0?void 0:co.id,Pn=Rn||Sn;if(Pn)return wr(Pn),!1}return!(!isCoinbaseWaasEnabled(br)&&isTurnkeyEnabled(br)&&!(!((no=(so=br==null?void 0:br.sdk)===null||so===void 0?void 0:so.embeddedWallets)===null||no===void 0)&&no.automaticEmbeddedWalletCreation))},[br,wr]);return{createEmbeddedWallet:eo,createEmbeddedWalletAccount:Gr,createOrRestoreSession:Vr,createPasskey:Zr,createPassword:Br,getPasskeys:Qr,getWalletVersion:jn,isLoadingEmbeddedWallet:In,isSessionActive:_n,revealWalletKey:ro,sendOneTimeCode:En,shouldAutoCreateEmbeddedWallet:to,userHasEmbeddedWallet:An}},useHandleAuthenticatedUser=()=>{const{handlers:fr}=useInternalDynamicContext(),{handleAuthenticatedUser:br}=fr??{},wr=reactExports.useRef(br);return wr.current=br,reactExports.useCallback(Er=>__awaiter$e(void 0,void 0,void 0,function*(){wr.current&&(yield runSafe(()=>{var kr;return(kr=wr.current)===null||kr===void 0?void 0:kr.call(wr,{user:Er})}))}),[])},sleepToShowSuccessMessage=()=>sleep$1(1500),useUserAuth=({authMethod:fr})=>{const{handleLogOut:br,setShowAuthFlow:wr,setCallback:Er,setMultiWalletWidgetState:kr,walletConnectorOptions:jr}=useInternalDynamicContext(),{setDeniedOauthUsername:Br,setDeniedOauthProvider:Wr}=useAccessDeniedContext(),{view:qr,setView:Gr,goToInitialView:Vr}=useViewContext(),{setLoading:Zr}=useLoadingContext(),{setErrorMessage:Jr,setError:Qr}=useErrorContext(),{setExistentAccountData:_n}=useAccountExistsContext(),En=useHandleAuthenticatedUser(),{shouldAutoCreateEmbeddedWallet:Cn}=useEmbeddedWallet(),In=_i=>_i.user,An=_i=>__awaiter$e(void 0,[_i],void 0,function*({isSignIn:oo=!0,verifyFunction:io,onVerifySuccess:co,onSettled:so,onError:no,showSuccessMessage:Tn=!1,skipDefaultErrorHandling:Hr=!1}){var Xr;logger$6.debug("initAuth",{authMethod:fr,isSignIn:oo});try{const Sn=yield io();if(!Sn)throw yield to(),new DynamicError("No user returned from verify function");let Rn;if(In(Sn)?Rn=storeAuthTokenAndUser(Sn):Rn=Sn,co==null||co(Rn),jr.forEach(On=>{On.walletConnector.setVerifiedCredentials(Rn.verifiedCredentials)}),hasPendingMfaAction(Rn)||oo&&(!((Xr=Rn.missingFields)===null||Xr===void 0)&&Xr.length))return;kr("idle"),yield En(Rn);const Pn=Cn(Rn);Tn&&(yield sleepToShowSuccessMessage()),oo&&Er("authSuccess"),Pn||wr(!1),so==null||so()}catch(Sn){if(logger$6.debug(Sn),Hr){no==null||no(Sn);return}jn(Sn,{onError:no})}finally{Zr(!1),so==null||so()}}),jn=(_i,{options:oo={},onError:io})=>{var co;if(_i instanceof MfaInvalidOtpError||_i instanceof MfaRateLimitedError||_i instanceof EmailAlreadyExistsError||_i instanceof CustomFieldNotUniqueError||_i instanceof UsernameAlreadyExistsError||_i instanceof TooManyEmailVerificationsError||_i instanceof InvalidPhoneNumberError)throw _i;if(_i instanceof NoAccessError){Wr(_i==null?void 0:_i.socialProvider),Br((co=_i==null?void 0:_i.socialUsername)!==null&&co!==void 0?co:""),Gr("no-access");return}if(_i instanceof AccountExistsError){_n(_i.errorPayload),Gr("account-exists");return}if(_i instanceof SandboxMaximumThresholdReachedError){Gr("sandbox-maximum-threshold-reached");return}if(_i instanceof UserHasAccountWithEmailError){Gr("merge-user-accounts-with-same-email",{returnToView:"isEmailRecoveryFlow"in oo&&oo.isEmailRecoveryFlow?"passkey-recovery-add-email":void 0});return}if(io){io==null||io(_i);return}_i.code?Jr(_i.code):Qr(_i.message)},eo=_i=>__awaiter$e(void 0,[_i],void 0,function*({missingFields:oo,isEmailVerificationRequired:io,isSmsVerificationRequired:co}){if(io&&oo.find(so=>so.name==="email")){Gr("verify-email");return}if(co&&oo.find(so=>so.name==="phoneNumber")){Gr("verify-sms");return}Gr(qr.type)}),ro=_i=>__awaiter$e(void 0,[_i],void 0,function*({completeSignInFlow:oo,updateJwtFunction:io,onValidUpdatedJwt:co,options:so={}}){logger$6.debug("completeAuth",{authMethod:fr});try{const{updateUserProfileResponse:no,isSmsVerificationRequired:Tn,isEmailVerificationRequired:Hr,missingFields:Xr}=yield io();co==null||co();const Sn=storeAuthTokenAndUser({expiresAt:no.expiresAt,jwt:no.jwt,minifiedJwt:no.minifiedJwt,user:no.user});if(Xr.length>0){yield eo({isEmailVerificationRequired:Hr,isSmsVerificationRequired:Tn,missingFields:Xr});return}if(yield En(Sn),Er("authSuccess"),oo&&(yield oo(no)))return;!Cn()&&Sn.mfaBackupCodeAcknowledgement!==MfaBackupCodeAcknowledgement.Pending&&wr(!1)}catch(no){logger$6.debug(no),jn(no,{options:so})}finally{Zr(!1)}}),to=()=>__awaiter$e(void 0,void 0,void 0,function*(){logger$6.debug("cancelAuth",{authMethod:fr}),yield br(),Vr()});return{cancelAuth:to,completeAuth:ro,handleAuthError:jn,initAuth:An}},SECURE_ENCLAVE_WALLET_SESSION_KEYS="dynamic_secure_enclave_session_keys",SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS={priority:["secureStorage","localStorage"]},buf2hex=fr=>[...new Uint8Array(fr)].map(br=>br.toString(16).padStart(2,"0")).join(""),base64urlDecode=fr=>(fr=(fr==null?void 0:fr.replace(/-/g,"+").replace(/_/g,"/"))||"",Uint8Array.from(atob(fr),br=>br.charCodeAt(0))),compressRawPublicKey=fr=>{const br=new Uint8Array(fr),wr=br.byteLength,Er=br.slice(0,1+wr>>>1);return Er[0]=2|br[wr-1]&1,Er.buffer},p256Keygen=()=>__awaiter$e(void 0,void 0,void 0,function*(){const fr=yield crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!0,["sign","verify"]),br=yield crypto.subtle.exportKey("raw",fr.publicKey),wr=yield crypto.subtle.exportKey("jwk",fr.privateKey),Er=compressRawPublicKey(br),kr=base64urlDecode(wr.d);return{private:buf2hex(kr),public:buf2hex(Er),public_uncompressed:buf2hex(br)}}),useEmbeddedWalletSessionKeys=fr=>{const br=(...jr)=>__awaiter$e(void 0,[...jr],void 0,function*({ignoreRestore:Br=!1}={}){const Wr=StorageService.getItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS,SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS);if(Wr&&!Br)return JSON.parse(Buffer$2.from(Wr,"base64").toString());const{publicKey:qr,privateKey:Gr}=yield wr();return yield registerSessionKey({environmentId:fr,publicKey:qr}),{privateKey:Gr,publicKey:qr}}),wr=()=>__awaiter$e(void 0,void 0,void 0,function*(){const{private:jr,public:Br}=yield p256Keygen(),qr=JSON.stringify({privateKey:jr,publicKey:Br}),Gr=Buffer$2.from(qr).toString("base64");return StorageService.setItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS,Gr,SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS),{privateKey:jr,publicKey:Br}}),Er=reactExports.useCallback(()=>StorageService.removeItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS,SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS),[]);return{generateSessionKey:wr,registerEmbeddedWalletSessionKey:br,removeSessionKey:Er,shouldRegisterSessionKeysOnSignin:()=>!1}},useVerifyWallet=({consumeNonce:fr,displaySiweStatement:br,environmentId:wr,projectSettings:Er,setIsSingleWalletAccount:kr})=>{const{setExistentAccountData:jr}=useAccountExistsContext(),{setDeniedAddress:Br,setDeniedOauthProvider:Wr}=useAccessDeniedContext(),{setView:qr,goToInitialView:Gr}=useViewContext(),{setErrorMessage:Vr,setError:Zr}=useErrorContext(),{multiWalletWidgetState:Jr,debugError:Qr,multiWallet:_n,appName:En,primaryWalletId:Cn,setShowAuthFlow:In,setPrimaryWalletId:An,siweStatement:jn,connectedWallets:eo,authMode:ro,user:to,setAuthMode:_i,removeConnectedWalletsInfo:oo,events:io,primaryWallet:co,enableConnectOnlyFallback:so,selectedWalletConnector:no}=useInternalDynamicContext(),{addedWalletsIds:Tn}=useInternalUserWallets(),{initAuth:Hr}=useUserAuth({authMethod:"wallet"}),{generateSessionKey:Xr,shouldRegisterSessionKeysOnSignin:Sn}=useEmbeddedWalletSessionKeys(wr),Rn=!to,Pn=so&&(Rn||!_n),On=(fo,vo,go,uo,lo,Eo,mo,yo)=>__awaiter$e(void 0,void 0,void 0,function*(){const _o=fr();if(_o===void 0)throw new DynamicError("Missing nonce");const Bo=yield getVerifyArgs({displaySiweStatement:br,environmentId:wr,getAddressOpts:go,messageToSignOverride:yo,nonce:_o,publicWalletAddress:uo,signedMessageOverride:mo,siweStatement:getSiweStatement({appName:En,siweStatement:jn}),walletConnector:fo,walletProvider:vo});if(Sn()){const Wo=yield Xr();Bo.sessionPublicKey=Wo.publicKey}let Lo;return!to||!_n?Lo=verifyWallet(wr,Object.assign(Object.assign({},Bo),{captchaToken:lo,oauth:Eo})):Lo=linkWallet(wr,Bo),{verifyArgs:Bo,verifyFunction:()=>Lo}}),Zn=({walletConnector:fo,verifiedCredentials:vo,lastVerifiedCredentialId:go})=>{const uo=vo.find(lo=>lo.id===go&&lo.format==="blockchain");if(uo){const lo=vo.find(Eo=>Eo.id===Cn);(Rn||!co||Jr==="awaiting_signature"&&uo.walletName===(lo==null?void 0:lo.walletName)||(lo==null?void 0:lo.chain)==="flow"&&fo.connectedChain==="FLOW")&&An(uo.id)}},Nn=fo=>{var vo;In(!0),qr("wallet-used"),kr(!1),fo.code==="reassign_wallet_error"&&(!((vo=Er==null?void 0:Er.sdk)===null||vo===void 0)&&vo.preventOrphanedAccounts&&qr("wallet-cannot-be-transferred"),kr(!0))},wn=({walletConnector:fo,endSession:vo=!0})=>{oo(),vo&&(fo==null||fo.endSession())},zn=(fo,vo,go,uo)=>{var lo;if(fo.message==="ignore")return;if(no&&no.key===vo.key&&dynamicEvents.emit("authFailure",{address:go,connectorName:vo.name,option:vo.name,type:"wallet"},{error:fo}),fo instanceof WalletUsedError)return wn({endSession:!1,walletConnector:vo}),Nn(fo);if(fo instanceof MergeAccountsConfirmationError){qr("merge-user-accounts",Object.assign({},fo)),In(!0);return}if(fo instanceof ChainalysisError){wn({walletConnector:vo}),Br(go),qr("chainalysis-blocked-wallet");return}if(fo instanceof GateBlockedError){wn({walletConnector:vo}),Br(go),qr("gate-blocked-wallet");return}if(fo instanceof SandboxMaximumThresholdReachedError){qr("sandbox-maximum-threshold-reached");return}if(fo instanceof NoAccessError){wn({walletConnector:vo}),Br(go),isSocialWalletConnector(vo)&&Wr(uo==null?void 0:uo.provider),qr("no-access");return}if(fo instanceof AccountExistsError){wn({walletConnector:vo}),jr(fo.errorPayload),qr("account-exists");return}if(eo.length&&ro==="connect-only")throw new DynamicError(fo.message);const Eo=(lo=fo==null?void 0:fo.message)===null||lo===void 0?void 0:lo.includes("User rejected the request");if(Pn&&!Eo){logger$6.warn("Verification failed, changing to connect-only"),_i("connect-only"),qr("wallet-list");return}else wn({walletConnector:vo}),Gr();logger$6.error(fo),Qr?Zr(`${fo.message} - ${fo.stack}`):Vr(fo.code)};return fo=>__awaiter$e(void 0,[fo],void 0,function*({walletConnector:vo,getAddressOpts:go,publicWalletAddress:uo,captchaToken:lo,oauth:Eo,signedMessageOverride:mo,messageToSignOverride:yo}){const _o=getWalletProvider(vo);dynamicEvents.emit("authInit",{address:uo,connectorName:vo.name,option:vo.name,type:"wallet"});try{const{verifyFunction:Bo,verifyArgs:Lo}=yield On(vo,_o,go,uo,lo,Eo,mo,yo);yield Hr({isSignIn:Rn,onError:Wo=>{zn(Wo,vo,uo,Eo)},onVerifySuccess:Wo=>{var na;if(!Wo)throw new DynamicError(USER_NOT_LOGGED_IN);try{(na=io==null?void 0:io.onSignedMessage)===null||na===void 0||na.call(io,{messageToSign:Lo.messageToSign,signedMessage:Lo.signedMessage})}catch{logger$6.warn("Error calling onSignedMessage callback")}StorageService.setItem(LAST_USED_WALLET,vo.key),_i("connect-and-sign"),Zn({lastVerifiedCredentialId:Wo.lastVerifiedCredentialId,verifiedCredentials:Wo.verifiedCredentials,walletConnector:vo});const qo=Wo.lastVerifiedCredentialId;qo&&Tn.current.push(qo)},options:{address:uo,connectorName:vo.name},skipDefaultErrorHandling:!0,verifyFunction:Bo})}catch(Bo){zn(Bo,vo,uo,Eo)}})},useEffectOnceCondition=(fr,br)=>{const wr=reactExports.useRef(!1),Er=reactExports.useRef(fr);Er.current=fr,reactExports.useEffect(()=>{br&&!wr.current&&(Er.current(),wr.current=!0)},[br])},SOCIAL_STORAGE_KEY="dynamic_social_storage",searchSocialStorageByState=fr=>{var br;const wr=StorageService.getItem(SOCIAL_STORAGE_KEY);if(!wr)return;const Er=Object.entries(wr),[kr]=(br=Er.find(([,{state:jr}])=>jr===fr))!==null&&br!==void 0?br:[];if(kr)return wr[kr]},setSocialStorageFor=(fr,br)=>{var wr;const Er=(wr=StorageService.getItem(SOCIAL_STORAGE_KEY))!==null&&wr!==void 0?wr:{};Er[fr]=Object.assign({provider:fr},br),StorageService.setItem(SOCIAL_STORAGE_KEY,Er)},deleteSocialStorage=fr=>{var br;const wr=(br=StorageService.getItem(SOCIAL_STORAGE_KEY))!==null&&br!==void 0?br:{};delete wr[fr],StorageService.setItem(SOCIAL_STORAGE_KEY,wr)},getSocialSignInProviderForProviderEnum=fr=>{if(!fr)return;const br=Object.values(SocialSignInProviderEnum);for(const wr of br)if(wr===fr)return wr},digestSHA256=fr=>{const wr=new TextEncoder().encode(fr);return window.crypto.subtle.digest("SHA-256",wr)},encodeBase64URL=fr=>{const br=[];return new Uint8Array(fr).forEach(wr=>br.push(wr)),btoa(String.fromCharCode.apply(null,br)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},stringifyURIQuery=fr=>{const br=[];for(const wr in fr)br.push(encodeURIComponent(wr)+"="+encodeURIComponent(fr[wr]));return br.join("&")},getProviderByType=(fr,br)=>fr.find(wr=>wr.provider===br),APPLE_LOGIN_DATA={customMobileUrl:!0,response_mode:"form_post",response_type:["code","id_token"]},getMobileOauthUrl=(fr,br)=>{if(!(!(br!=null&&br.customMobileUrl)||!isMobile()||!fr.redirectUrl))return fr.redirectUrl.replace("redirect","authorizeHtml")},getOauthLoginUrl=(fr,br)=>{var wr,Er;const kr=getProviderByType(fr,br);if(!(kr!=null&&kr.clientId))return"";let jr;br===ProviderEnum.Apple&&(jr=APPLE_LOGIN_DATA);let Br;if(br===ProviderEnum.Telegram)Br=(wr=kr.authorizationUrl)!==null&&wr!==void 0?wr:"";else if(kr.baseAuthUrl)Br=kr.baseAuthUrl;else return"";const Wr=getMobileOauthUrl(kr,jr),qr={client_id:kr.clientId,redirect_uri:(Er=kr.redirectUrl)!==null&&Er!==void 0?Er:"",response_type:"code"};br===ProviderEnum.Tiktok&&(delete qr.client_id,qr.client_key=kr.clientId),kr.scopes&&(qr.scope=kr.scopes),jr!=null&&jr.prompt&&(qr.prompt=jr.prompt.join(" ")),jr!=null&&jr.response_mode&&(qr.response_mode=jr.response_mode),jr!=null&&jr.response_type&&(qr.response_type=jr.response_type.join(" "));const Gr=stringifyURIQuery(qr);return`${Wr??Br}?${Gr}`},randomString=fr=>{const br="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";let wr="";for(let Er=fr;Er>0;--Er)wr+=br[Math.floor(Math.random()*br.length)];return wr},initAuth=(fr,br,wr)=>__awaiter$e(void 0,void 0,void 0,function*(){try{yield sdkApi$1().initAuth({environmentId:fr,oauthInitAuthRequest:wr,providerType:br})}catch(Er){logger$6.error(Er)}}),verifyOAuth=(fr,br,wr)=>__awaiter$e(void 0,[fr,br,wr],void 0,function*(Er,kr,{code:jr,codeVerifier:Br,state:Wr}){const qr={code:jr,codeVerifier:Br,state:Wr};try{const Gr=yield sdkApi$1().oauthVerify({environmentId:Er,oauthRequest:qr,providerType:kr});return storeAuthTokenAndUser(Gr)}catch(Gr){return handleVerifyError(Gr)}}),signInOAuth=(fr,br,wr)=>__awaiter$e(void 0,[fr,br,wr],void 0,function*(Er,kr,{code:jr,codeVerifier:Br,state:Wr,captchaToken:qr,sessionPublicKey:Gr}){const Vr={captchaToken:qr,code:jr,codeVerifier:Br,sessionPublicKey:Gr,state:Wr};try{const Zr=yield sdkApi$1().oauthSignIn({environmentId:Er,oauthRequest:Vr,providerType:kr});return storeAuthTokenAndUser(Zr)}catch(Zr){return handleSignInError(Zr)}}),getOAuthResult=(fr,br,wr)=>__awaiter$e(void 0,[fr,br,wr],void 0,function*(Er,kr,{state:jr}){const Br={state:jr};try{return yield sdkApi$1().oauthResult({environmentId:Er,oauthResultRequest:Br,providerType:kr})}catch(Wr){logger$6.error(Wr);return}}),farcasterSignIn=(fr,br)=>__awaiter$e(void 0,void 0,void 0,function*(){try{const wr=yield sdkApi$1().farcasterSignIn({environmentId:fr,farcasterSignInRequest:br});return storeAuthTokenAndUser(wr)}catch(wr){return handleSignInError(wr)}}),farcasterVerify=fr=>__awaiter$e(void 0,void 0,void 0,function*(){try{const br=yield sdkApi$1().farcasterVerify(fr);return storeAuthTokenAndUser(br)}catch(br){return handleVerifyError(br)}}),telegramSignIn=(fr,br)=>__awaiter$e(void 0,void 0,void 0,function*(){const wr={environmentId:fr,oauthResultRequest:br};try{const Er=yield sdkApi$1().telegramSignIn(wr);return storeAuthTokenAndUser(Er)}catch(Er){return handleSignInError(Er)}}),isUserLinkedWithTelegram=(fr,br)=>__awaiter$e(void 0,void 0,void 0,function*(){const wr={environmentId:fr,oauthResultRequest:br};try{return yield sdkApi$1().telegramCheckAuth(wr),!0}catch{return!1}}),telegramVerify=(fr,br)=>__awaiter$e(void 0,void 0,void 0,function*(){const wr={environmentId:fr,oauthResultRequest:br};try{const Er=yield sdkApi$1().telegramVerify(wr);return storeAuthTokenAndUser(Er)}catch(Er){return handleVerifyError(Er)}}),handleVerifyError=fr=>__awaiter$e(void 0,void 0,void 0,function*(){logger$6.error(fr);const br=yield fr.json();if(br.code==="social_account_already_exists")throw new SocialAccountAlreadyExistsError;if(br.error.code==="sandbox_maximum_threshold_reached")throw new SandboxMaximumThresholdReachedError(br.error.message)}),handleSignInError=fr=>__awaiter$e(void 0,void 0,void 0,function*(){var br,wr,Er;logger$6.error(fr);const kr=yield fr.json();if(kr.error.code==="gate_blocked")throw new GateBlockedError(kr.payload.walletPublicKey);if(kr.error.code==="missing_from_list")throw new NoAccessError({socialProvider:(br=kr==null?void 0:kr.payload)===null||br===void 0?void 0:br.socialProvider,socialUsername:(wr=kr==null?void 0:kr.payload)===null||wr===void 0?void 0:wr.socialUsername,walletPublicKey:(Er=kr==null?void 0:kr.payload)===null||Er===void 0?void 0:Er.walletPublicKey});if(kr.code==="email_associated_with_different_provider")throw new AccountExistsError(kr.error,kr.payload);if(kr.error.code==="sandbox_maximum_threshold_reached")throw new SandboxMaximumThresholdReachedError(kr.error.message)}),CONNECT_URL="https://relay.farcaster.xyz/v1/channel",STATUS_URL="https://relay.farcaster.xyz/v1/channel/status",STATUS_TIMEOUT=3e5,STATUS_INTERVAL=1e3,connect=fr=>__awaiter$e(void 0,void 0,void 0,function*(){try{const br=yield FetchService.fetch(CONNECT_URL,{body:JSON.stringify(fr),headers:{"Content-Type":"application/json"},method:"POST"});if(!br.ok)throw new Error(`HTTP error! status: ${br.status}`);return yield br.json()}catch(br){logger$6.error("Error connecting with farcaster:",br);return}}),status=fr=>__awaiter$e(void 0,void 0,void 0,function*(){try{const br=yield FetchService.fetch(STATUS_URL,{headers:{Authorization:`Bearer ${fr.channelToken}`,"Content-Type":"application/json"},method:"GET"});if(!br.ok)throw new Error(`HTTP error! status: ${br.status}`);return yield br.json()}catch(br){logger$6.error("Error fetching farcaster connect status:",br);return}}),watchStatus=(fr,...br)=>__awaiter$e(void 0,[fr,...br],void 0,function*(wr,{timeout:Er=STATUS_TIMEOUT,interval:kr=STATUS_INTERVAL}={}){const jr=Date.now()+Er;let Br=!0,Wr;dynamicEvents.on("farcasterConnectCancelled",()=>{Br=!1,Wr==null||Wr(),Wr=void 0});const qr=Gr=>{Wr=Gr,setTimeout(Gr,kr)};for(;Br&&Date.now(){const{environmentId:kr,setShowAuthFlow:jr,socialSettings:Br,projectSettings:Wr,consumeNonce:qr,redirectUrl:Gr}=useInternalDynamicContext(),Vr=reactExports.useMemo(()=>(Br==null?void 0:Br.strategy)||"redirect",[Br]),{setErrorMessage:Zr,setError:Jr}=useErrorContext(),{initAuth:Qr}=useUserAuth({authMethod:"social"}),{generateSessionKey:_n,shouldRegisterSessionKeysOnSignin:En}=useEmbeddedWalletSessionKeys(kr),[Cn,In]=reactExports.useState(!1),[An,jn]=reactExports.useState(),eo=reactExports.useCallback(()=>{jn(void 0),Jr(void 0)},[Jr]),ro=reactExports.useCallback((Tn,Hr,Xr)=>{In(!1),wr==null||wr(),br==null||br(),Tn&&(Xr!=null&&Xr.raiseAuthFailure)&&dynamicEvents.emit("authFailure",{option:Tn,provider:Tn,type:"social"},Hr)},[wr,br]),to=reactExports.useCallback((Tn,Hr,Xr,Sn)=>{const Rn={code:Hr,message:Xr};logger$6.error(Xr),jn(Rn),Zr(Hr),ro(Tn,{error:Rn},Sn)},[ro,Zr]),_i=reactExports.useCallback((Tn,Hr)=>Tn?socialProviders.includes(Tn)?!0:(to(Tn,SocialOAuthErrorCode.INVALID_PROVIDER,`Invalid social provider. Valid providers are: ${socialProviders.join(", ")}`,{raiseAuthFailure:Hr==="signin"}),!1):(to(Tn,SocialOAuthErrorCode.NO_PROVIDER,"Provider is required",{raiseAuthFailure:Hr==="signin"}),!1),[to]),oo=reactExports.useCallback((Tn,Hr)=>__awaiter$e(void 0,void 0,void 0,function*(){try{if(!(yield Hr())){to(Tn,SocialOAuthErrorCode.VERIFICATION_ERROR,`Failed to link social account: ${Tn}`,{raiseAuthFailure:!1});return}br==null||br()}catch(Xr){Xr instanceof SocialAccountAlreadyExistsError&&to(Tn,SocialOAuthErrorCode.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_PROFILE,`Social account already linked to a different profile: ${Tn}`,{raiseAuthFailure:!1})}}),[to,br]),io=reactExports.useCallback((Tn,Hr)=>__awaiter$e(void 0,void 0,void 0,function*(){yield Qr({onError:()=>to(Tn,SocialOAuthErrorCode.SIGNIN_ERROR,`Failed to sign-in with social account: ${Tn}`,{raiseAuthFailure:!0}),onSettled:br,options:{provider:Tn},verifyFunction:()=>Hr()})}),[to,Qr,br]),co=reactExports.useCallback(Tn=>__awaiter$e(void 0,[Tn],void 0,function*({authMode:Hr,provider:Xr,state:Sn,authCode:Rn,captchaToken:Pn,verifier:On,telegramAuthToken:Zn,forceCreateUser:Nn=!1}){try{let wn;if(En()&&(wn=(yield _n()).publicKey),Hr==="signin"){if(Xr===ProviderEnum.Telegram&&Zn)return yield io(Xr,()=>telegramSignIn(kr,{forceCreateUser:Nn,sessionPublicKey:wn,telegramAuthToken:Zn}));Xr===ProviderEnum.Telegram?yield io(Xr,()=>telegramSignIn(kr,{code:Rn,sessionPublicKey:wn,state:Sn})):yield io(Xr,()=>signInOAuth(kr,Xr,{captchaToken:Pn,code:Rn,codeVerifier:On,sessionPublicKey:wn,state:Sn}))}else Xr===ProviderEnum.Telegram?yield oo(Xr,()=>telegramVerify(kr,{code:Rn,state:Sn})):yield oo(Xr,()=>verifyOAuth(kr,Xr,{code:Rn,codeVerifier:On,state:Sn}))}catch(wn){logger$6.error("Social connection failed with unexpected error:",wn),ro(Xr,{error:wn},{raiseAuthFailure:Hr==="signin"})}}),[kr,_n,oo,ro,En,io]),so=reactExports.useCallback((Tn,Hr)=>__awaiter$e(void 0,[Tn,Hr],void 0,function*(Xr,{captchaToken:Sn,redirectUrl:Rn}){const Pn=qr(),On=PlatformService.getHost(),Zn=yield connect({domain:On,nonce:Pn,redirectUrl:Rn||Gr,siweUri:PlatformService.getOrigin()});if(!(Zn!=null&&Zn.url)||!(Zn!=null&&Zn.channelToken)){to(ProviderEnum.Farcaster,SocialOAuthErrorCode.GENERAL_ERROR,"Farcaster didn't return a valid url.",{raiseAuthFailure:Xr==="signin"});return}isMobile()?yield PlatformService.openURL(Zn.url):(jr(!0),Er==null||Er(Zn.url));const Nn=yield watchStatus({channelToken:Zn.channelToken});if(Nn==="cancelled"){In(!1);return}if(Nn==="timeout"||Nn==="rejected"||!(Nn!=null&&Nn.message)||!(Nn!=null&&Nn.custody)||!(Nn!=null&&Nn.signature)||!(Nn!=null&&Nn.nonce)){to(ProviderEnum.Farcaster,SocialOAuthErrorCode.GENERAL_ERROR,"Farcaster didn't return valid data.",{raiseAuthFailure:Xr==="signin"});return}const{custody:wn,message:zn,signature:fo,nonce:vo}=Nn;if(Xr==="signin"){let go;En()&&(go=(yield _n()).publicKey);const uo=()=>farcasterSignIn(kr,{address:wn,captchaToken:Sn,domain:On,message:zn,nonce:vo,sessionPublicKey:go,signature:fo});yield io(ProviderEnum.Farcaster,uo)}else{const go=()=>farcasterVerify({environmentId:kr,farcasterSignInRequest:{address:wn,captchaToken:Sn,domain:On,message:zn,nonce:vo,signature:fo}});yield oo(ProviderEnum.Farcaster,go),jr(!1,{clearErrors:!1})}In(!1)}),[qr,Gr,kr,_n,to,oo,Er,jr,En,io]),no=reactExports.useCallback(Tn=>__awaiter$e(void 0,[Tn],void 0,function*({authMode:Hr,provider:Xr,validator:Sn,captchaToken:Rn,redirectUrl:Pn,telegramAuthToken:On}){var Zn,Nn;if(eo(),In(!0),!Hr){logger$6.error('Auth mode is required. Please use either "link" or "signin"');return}if(!_i(Xr,Hr)||Sn&&!Sn(Xr))return;if(dynamicEvents.emit("authInit",{option:Xr,provider:Xr,type:"social"}),Xr===ProviderEnum.Farcaster)return so(Hr,{captchaToken:Rn,redirectUrl:Pn});const wn=randomString(32),zn=randomString(43),fo=providersRequiringPkce.includes(Xr);setSocialStorageFor(Xr,{captchaToken:Rn,codeVerifier:fo?zn:void 0,mode:Hr,state:wn});const vo=getOauthLoginUrl((Zn=Wr==null?void 0:Wr.providers)!==null&&Zn!==void 0?Zn:[],Xr);if(!vo){to(Xr,SocialOAuthErrorCode.NO_OAUTH_URL,`Failed to get login url to connect social account: ${Xr}`,{raiseAuthFailure:Hr==="signin"});return}const go=new URL(vo);if(go.searchParams.set("state",wn),fo){const lo=yield digestSHA256(zn);go.searchParams.set("code_challenge",encodeBase64URL(lo)),go.searchParams.set("code_challenge_method","S256")}const uo=isMobile();try{const lo=yield Oauth2Service.getOauthCode({apiProvider:getProviderByType((Nn=Wr==null?void 0:Wr.providers)!==null&&Nn!==void 0?Nn:[],Xr),getOAuthResultFromApi:()=>getOAuthResult(kr,Xr,{state:wn}),initWebAuth:({redirectUrl:Eo}={})=>initAuth(kr,Xr,{redirectUrl:Eo?removeDynamicOauthParamsFromUrl(Eo):void 0,state:wn}),isMobile:uo,oauthLoginUrl:go,onSettled:br,provider:Xr,redirectUrl:Pn??Gr,sessionTimeout:fr,setIsProcessing:In,state:wn,strategy:Vr});yield co({authCode:lo,authMode:Hr,captchaToken:Rn,provider:Xr,state:wn,telegramAuthToken:On,verifier:zn})}catch(lo){if(Oauth2Service.isGetOauthCodeError(lo)){to(Xr,lo.code,lo.message,{raiseAuthFailure:Hr==="signin"});return}logger$6.error("Social connection failed with unexpected error:",lo),ro(Xr,{error:lo},{raiseAuthFailure:Hr==="signin"})}}),[_i,eo,co,so,Gr,kr,to,ro,br,Wr==null?void 0:Wr.providers,fr,Vr]);return reactExports.useMemo(()=>({checkValidProvider:_i,completeConnection:co,connectSocialAccount:no,error:An,handleError:to,isProcessing:Cn,setError:jn,setIsProcessing:In}),[_i,co,no,An,to,Cn])},removeDynamicOauthParamsFromUrl=fr=>{const br=new URL(fr);return br.searchParams.delete("dynamicOauthState"),br.searchParams.delete("dynamicOauthCode"),br.toString()},useRedirectSocialHandler=({setSocialProvider:fr})=>{const{setView:br}=useViewContext(),{setDynamicWidgetView:wr}=useWidgetContext(),[Er,kr]=reactExports.useState(null),{sdkHasLoaded:jr,setShowAuthFlow:Br,isRenderingEmbeddedAuthFlow:Wr,setShowDynamicUserProfile:qr}=useInternalDynamicContext(),{completeConnection:Gr}=useSocialAuth({sessionTimeout:1e4}),Vr=reactExports.useCallback(Jr=>{const Qr=getSocialSignInProviderForProviderEnum(Jr.provider);fr(Qr),br("social-redirect-view"),Wr.current||Br(!0)},[fr,br,Wr,Br]),Zr=reactExports.useCallback(()=>{wr("profile"),qr(!0)},[wr,qr]);useEffectOnce(()=>{if(isSSR())return;const Jr=new URL(window.location.href),Qr=Jr.searchParams.get("dynamicOauthState"),_n=Jr.searchParams.get("dynamicOauthCode");if(!Qr||!_n)return;const En=searchSocialStorageByState(Qr);En&&(En.code=_n,kr(En),deleteSocialStorage(En.provider))}),useEffectOnceCondition(()=>__awaiter$e(void 0,void 0,void 0,function*(){if(Er){if(Er.mode==="signin"){if(getUser()){logger$6.error(new DynamicError("User is already logged in"));return}Vr(Er)}else if(Er.mode==="link"){if(!getUser()){logger$6.error(new DynamicError("User not logged in"));return}Zr()}yield Gr({authCode:Er.code,authMode:Er.mode,captchaToken:Er.captchaToken,provider:Er.provider,state:Er.state,verifier:Er.codeVerifier})}}),!!Er&&jr)},SocialRedirectContext=reactExports.createContext(void 0),SocialRedirectContextProvider=({children:fr})=>{var br,wr,Er,kr;const{setShowAuthFlow:jr,walletConnectorOptions:Br,setSelectedWalletConnectorKey:Wr,walletUiUtils:qr,consumeNonce:Gr,displaySiweStatement:Vr,environmentId:Zr,projectSettings:Jr,setIsSingleWalletAccount:Qr,setShowDynamicUserProfile:_n,setPrimaryWalletId:En,secondaryWallets:Cn,sdkHasLoaded:In,user:An,connectWallet:jn,primaryWallet:eo,socialProvidersFilter:ro=wn=>wn}=useInternalDynamicContext(),{setErrorMessage:to}=useErrorContext(),{setView:_i}=useViewContext(),{getCaptchaToken:oo}=useCaptchaContext(),io=useVerifyWallet({consumeNonce:Gr,displaySiweStatement:Vr,environmentId:Zr,projectSettings:Jr,setIsSingleWalletAccount:Qr}),co=(br=Jr==null?void 0:Jr.sdk.socialSignIn)===null||br===void 0?void 0:br.signInProvider,so=(Er=(wr=Jr==null?void 0:Jr.sdk.socialSignIn)===null||wr===void 0?void 0:wr.providers)!==null&&Er!==void 0?Er:[],no=(kr=ro(so.filter(wn=>wn.enabled).map(wn=>wn.provider)))!==null&&kr!==void 0?kr:[],Tn=Br.map(({walletConnector:wn})=>wn).find(isSocialWalletConnector),[Hr,Xr]=reactExports.useState("idle"),[Sn,Rn]=reactExports.useState(),On=(eo?[eo,...Cn]:Cn).find(wn=>wn.connector.key===(Tn==null?void 0:Tn.key)),Zn=reactExports.useMemo(()=>On?getReferencedAccount(An,On.id):void 0,[An,On]);useInternalDynamicEvents("logout",()=>Rn(void 0));const Nn=reactExports.useCallback(wn=>{logger$6.error(wn),An?(jr(!1,{emitCancelAuth:!0}),_n(!0)):(jr(!0),_i("wallet-list"),to("-1"))},[An,to,jr,_n,_i]);return reactExports.useEffect(()=>{var wn,zn;if(!Jr||!Tn||!In){new URLSearchParams(window.location.search).has("magic_oauth_request_id")&&(_i("social-redirect-view"),jr(!0));return}const fo=new URLSearchParams(window.location.search);if(fo.has("error")&&fo.has("provider")){const vo=fo.get("error_description");Nn(vo??"Unknown error"),(wn=Tn.getSession)===null||wn===void 0||wn.call(Tn);return}if(fo.has("magic_oauth_request_id")){const vo=fo.get("provider");Rn(vo),Xr("loading"),_i("social-redirect-view"),jr(!0),An||Wr(Tn.key),(zn=Tn.getSession)===null||zn===void 0||zn.call(Tn).then(go=>__awaiter$e(void 0,void 0,void 0,function*(){if(An){if(!Zn)throw new Error("Social account not found");Zn.oauthAccountId===go.oauthId?(On==null?void 0:On.id)!==(eo==null?void 0:eo.id)&&(En(On.id),jr(!1),_n(!0)):(yield Tn.endSession(),_i("social-wrong-account"))}else{yield jn(Tn);const uo=yield Tn.getAddress();qr.disabledConfirmationOnce(),yield io({captchaToken:oo(),oauth:{accessToken:go.accessToken,didToken:go.didToken,provider:vo},publicWalletAddress:uo,walletConnector:Tn})}Rn(void 0),Xr("success")})).catch(go=>{Rn(void 0),Xr("error"),Nn(go)})}},[Zn,An,Jr,In,Cn,En,Wr,jr,_n,_i,Tn,io,qr,On,Nn,jn,eo==null?void 0:eo.id,oo]),useRedirectSocialHandler({setSocialProvider:Rn}),jsxRuntimeExports.jsx(SocialRedirectContext.Provider,{value:{enabledSocialProviders:no,redirectStatus:Hr,setSocialProvider:Rn,signInProvider:co,socialAccount:Zn,socialProvider:Sn,socialWalletConnector:Tn},children:fr})},useSocialRedirectContext=()=>{const fr=reactExports.useContext(SocialRedirectContext);if(fr===void 0)throw new Error("useSocialRedirectContext must be used within a SocialRedirectContextProvider");return fr},AnimatePresence=({children:fr,animationComponent:br})=>{const[wr,Er]=reactExports.useState(!0),kr=useForceUpdate$1(),jr=reactExports.useRef(null),Br=reactExports.useMemo(()=>!!fr,[fr]),Wr=usePrevious$1(Br),qr=reactExports.useCallback(()=>{jr.current=null,kr()},[kr]);return reactExports.useEffect(()=>{reactExports.isValidElement(fr)&&(jr.current=reactExports.Children.map(fr,Gr=>reactExports.cloneElement(Gr)))},[fr]),reactExports.useEffect(()=>{Br&&!Wr&&Er(!0),Wr&&!Br&&Er(!1)},[Br,Wr]),reactExports.cloneElement(br,{children:fr||jr.current,isShown:wr,onUnmount:qr})},ErrorContainer=({children:fr,className:br,isMultiWalletError:wr=!1,withIcon:Er=!0,variant:kr="error",copykey:jr})=>{const Br=classNames$1("error-container",`error-container--${kr}`,br,{"error-container--multi-wallet":wr}),Wr=classNames$1("error",{"error--with-icon":Er});return jsxRuntimeExports.jsxs("div",{className:Br,"data-testid":`error-container--${kr}`,children:[Er&&jsxRuntimeExports.jsx(SvgError,{}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",className:Wr,copykey:jr,children:fr})]})};var PasskeySuccessEnum;(function(fr){fr[fr.CREATED=0]="CREATED",fr[fr.EDITED=1]="EDITED"})(PasskeySuccessEnum||(PasskeySuccessEnum={}));const PasskeyCreatedSuccessBanner=({className:fr})=>{const{passkeySuccessPopup:br}=useInternalDynamicContext(),{t:wr}=useTranslation();return jsxRuntimeExports.jsxs(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(OpacityTransition,{}),children:[br===PasskeySuccessEnum.EDITED&&jsxRuntimeExports.jsx(ErrorContainer,{variant:"success",className:fr,copykey:"dyn_passkey_success.edited",children:wr("dyn_passkey_success.edited")}),br===PasskeySuccessEnum.CREATED&&jsxRuntimeExports.jsx(ErrorContainer,{variant:"success",className:fr,copykey:"dyn_passkey_success.created",children:wr("dyn_passkey_success.created")})]})};var css_248z$1='@layer shadow-reset{.dynamic-shadow-dom-content{all:initial}}@layer preflight{a,hr{color:inherit}progress,sub,sup{vertical-align:baseline}blockquote,body,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,menu,ol,p,pre,ul{margin:0}fieldset,legend,menu,ol,ul{padding:0}*,:after,:before{border:0 solid;box-sizing:border-box}html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit}hr{border-top-width:1px;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;-moz-appearance:button;appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none;appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;appearance:button;font:inherit}summary{display:list-item}menu,ol,ul{list-style:none}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}}.accordion-item{overflow:hidden;position:relative;transition-duration:.15s;transition-property:max-height;transition-timing-function:ease-out}.accordion-item--full-height{height:100vh}.accordion-item__curtain{background-color:var(--dynamic-overlay);left:0;opacity:0;position:absolute;right:0;top:0;transition:opacity 50ms ease-in;z-index:1}.accordion-item__curtain--dimmed{bottom:0;opacity:1}.vertical-accordion__container{display:flex;flex-direction:column}.alert{align-items:center;border-radius:calc(var(--dynamic-border-radius)/3);display:flex;gap:.75rem;padding:.75rem}.alert--error{background-color:var(--dynamic-error-2);color:var(--dynamic-error-1)}.alert--warning{background-color:var(--dynamic-alert-2);color:var(--dynamic-alert-1)}.alert--info{background-color:var(--dynamic-brand-secondary-color);color:var(--dynamic-brand-primary-color)}.alert__icon{flex-shrink:0}.badge__container{align-items:center;border-radius:9999px;display:flex;font-size:.625rem;font-weight:500;gap:.25rem;padding:.25rem .5rem;position:relative;transition:color .3s,background-color .3s;white-space:nowrap}.badge__container__primary{background-color:var(--dynamic-badge-primary-background);color:var(--dynamic-badge-primary-color)}.badge__container__secondary{background-color:var(--dynamic-badge-background);color:var(--dynamic-badge-color)}.badge__dot{background-color:var(--dynamic-badge-dot-background);border-radius:9999px;height:.375rem;transition:color .3s,background-color .3s;width:.375rem}.button{align-items:center;cursor:pointer;display:flex;gap:.375rem;justify-content:center;position:relative;transition:all .2s ease}.button:disabled:not(.button--loading){cursor:default;opacity:.5}.button--expanded{width:100%}.button--brand-primary{background:var(--dynamic-brand-primary-color);border:var(--dynamic-button-primary-border);box-shadow:var(--dynamic-shadow-down-1);color:#fff;padding:var(--dynamic-button-primary-padding)}.button--brand-primary .typography{font-size:var(--dynamic-button-primary-font-size)}.button--brand-primary:hover:enabled{box-shadow:var(--dynamic-button-shadow)}.button--brand-primary:active:enabled,.button--primary{box-shadow:var(--dynamic-shadow-down-1)}.button--primary{background:var(--dynamic-button-primary-background);border:var(--dynamic-button-primary-border);padding:var(--dynamic-button-primary-padding)}.button--primary .typography{font-size:var(--dynamic-button-primary-font-size)}.button--primary:hover:enabled{box-shadow:var(--dynamic-button-shadow)}.button--primary:active:enabled,.button--secondary{box-shadow:var(--dynamic-shadow-down-1)}.button--secondary{background:var(--dynamic-button-secondary-background);border:var(--dynamic-button-secondary-border);padding:var(--dynamic-button-secondary-padding)}.button--secondary .typography{font-size:var(--dynamic-button-primary-font-size)}.button--secondary:hover:enabled{background:var(--dynamic-hover)}.button--secondary:active:enabled{background:var(--dynamic-base-3)}.button--tertiary,.button--tertiary .typography{color:var(--dynamic-text-secondary)}.button--tertiary:hover:enabled,.button--tertiary:hover:enabled .typography{color:var(--dynamic-text-primary)}.button--padding-default{border-radius:calc(var(--dynamic-border-radius)/2);padding:.625rem 1rem}.button--padding-large{border-radius:var(--dynamic-button-border-radius);padding:.875rem 1.25rem}.button--padding-medium{border-radius:calc(var(--dynamic-button-border-radius)/1.5);padding:.625rem 1rem}.button--padding-small{border-radius:calc(var(--dynamic-button-border-radius)/2);padding:.5rem .75rem}.button--padding-none{padding:0}.button--padding-login-screen-height{border-radius:calc(var(--dynamic-border-radius)/2);height:2.5rem;padding:0 1rem}.button__spinner{margin-left:auto;margin-right:auto}.button__end-slot,.button__start-slot{display:inline-flex}.button__spinner-container{align-items:center;bottom:0;color:var(--dynamic-text-primary);display:flex;justify-content:center;left:0;position:absolute;right:0;top:0}.button--loading>:not(.button__spinner-container){opacity:0}.checkbox--hidden{cursor:pointer;display:block;height:1rem;opacity:0;position:absolute;width:1rem;z-index:10}.checkbox--hidden:checked+.checkbox--visible{background:var(--dynamic-brand-primary-color);border-style:none}.checkbox--hidden:checked+.checkbox--visible>.checkbox__icon{opacity:1}.checkbox--hidden:disabled{pointer-events:none}.checkbox--visible{align-items:center;background:var(--dynamic-base-3);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/4);display:flex;height:1rem;justify-content:center;position:absolute;transition-duration:.2s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);width:1rem;z-index:0}.checkbox__container{height:1rem;position:relative;width:1rem}.checkbox__icon{color:#fff;height:.75rem;opacity:0;transition-duration:.2s;transition-property:opacity;width:.75rem}.connect-button{background:var(--dynamic-connect-button-background);border:var(--dynamic-connect-button-border);border-radius:calc(var(--dynamic-connect-button-radius, var(--dynamic-border-radius))/2);box-shadow:var(--dynamic-connect-button-shadow)}.connect-button:hover:enabled{background:var(--dynamic-connect-button-background-hover);border:var(--dynamic-connect-button-border-hover);box-shadow:var(--dynamic-connect-button-shadow-hover)}.connect-button:hover:enabled .typography{color:var(--dynamic-connect-button-color-hover)}.connect-button .typography{color:var(--dynamic-connect-button-color)}.copy-button__container{position:relative}.copy-button__tooltip{background-color:var(--dynamic-text-primary);color:var(--dynamic-base-2);font-size:.75rem}@keyframes enter-tile{0%{opacity:0;transform:translateY(.5rem)}to{opacity:1;transform:translateY(0)}}.enter-list-tile-animation{animation-duration:.2s;animation-fill-mode:both;animation-iteration-count:1;animation-name:enter-tile;animation-timing-function:ease-out}.error-container{align-items:center;display:flex;justify-content:center;margin-bottom:.5rem;padding:.5rem .75rem}.error-container img,.error-container svg{height:1.25rem;width:1.25rem}.error-container--error{background:var(--dynamic-error-2);color:var(--dynamic-error-1)}.error-container--info{background:var(--dynamic-base-3);color:var(--dynamic-text-primary)}.error-container--success{background:var(--dynamic-success-2);color:var(--dynamic-success-1)}.error-container--multi-wallet{margin-bottom:.75rem}.error--with-icon{margin-left:.875rem}.icon--color-brand-primary{color:var(--dynamic-brand-primary-color)}.icon--color-text-primary{color:var(--dynamic-text-primary)}.icon--color-text-secondary{color:var(--dynamic-text-secondary)}.icon--color-text-tertiary{color:var(--dynamic-text-tertiary)}.icon--color-text-error{color:var(--dynamic-error-1)}.icon--color-success-1{color:var(--dynamic-success-1)}.icon--size-xsmall{height:.75rem;width:.75rem}.icon--size-small{height:1rem;width:1rem}.icon--size-mini{height:1.25rem;width:1.25rem}.icon--size-medium{height:1.5rem;width:1.5rem}.icon--size-mlarge{height:1.875rem;width:1.875rem}.icon--size-large{height:2.375rem;width:2.375rem}.icon-button{align-items:center;border-radius:100%;color:var(--dynamic-text-tertiary);display:flex;justify-content:center}.icon-button svg:hover{color:var(--dynamic-text-secondary)}.icon-button svg:active{color:var(--dynamic-text-primary)}.indicator__container{align-items:center;background:var(--dynamic-base-1);border-radius:100%;bottom:0;display:flex;justify-content:center;position:absolute;right:0}.indicator__icon{background:var(--dynamic-success-1);border-radius:100%}.indicator__wallet-connect{background:#4084ed;bottom:0;color:#fff;position:absolute;right:-.125rem}.icon-with-spinner__container,.indicator__wallet-connect{align-items:center;border-radius:9999px;display:flex;justify-content:center}.icon-with-spinner__container{position:relative}.icon-with-spinner__container img{height:100%;width:100%}.icon-with-spinner__icon-container{align-items:center;display:flex;justify-content:center;position:relative}.icon-with-spinner__spinner-container{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));position:absolute;right:0;top:0}.icon-with-spinner__spinner{grid-column-start:2;grid-row-start:1;height:100%;width:100%}.icon-with-spinner__animation{animation:spin 1.4s linear infinite}.icon-with-status__container{margin-bottom:12px;max-width:-moz-fit-content;max-width:fit-content;position:relative}.icon-with-status__container .icon{border-radius:100%}.icon-with-status__status-dot{bottom:-.125rem;position:absolute;right:-.25rem}.icon-with-status__container .inner-icon__container{background:var(--dynamic-base-1);border-radius:100%;bottom:-.125rem;padding:.1875rem;position:absolute;right:-.1875rem}.icon-with-status__container .inner-icon{border-radius:100%}.icon-with-status__container .inner-icon svg{height:1rem;width:1rem}.icon-with-status__container .inner-icon--green{background:var(--dynamic-success-1)}.icon-with-status__container .inner-icon--red{background:var(--dynamic-error-1)}.icon-with-status__container .inner-icon path{fill:var(--dynamic-base-1)}.icon-with-status__container .status-dot__container{align-items:center;background:var(--dynamic-base-1);border-radius:100%;bottom:-.125rem;display:flex;height:.625rem;justify-content:center;position:absolute;right:-.25rem;width:.625rem}.icon-with-status__container .status-dot{border-radius:100%;height:.375rem;width:.375rem}.icon-with-status__container .status-dot--green{background:var(--dynamic-success-1)}.icon-with-status__container .status-dot--red{background:var(--dynamic-error-1)}.info-item__container{color:var(--dynamic-text-tertiary);display:flex}.info-item__container a{text-decoration:underline}.info-item__container .info-item__icon-container{border-radius:calc(var(--dynamic-border-radius)/3);color:var(--dynamic-text-tertiary);display:flex;margin-right:1.125rem}.info-item__container .info-item__icon-container svg{height:1.5rem;width:1.5rem}.info-item__container .info-item__secondary-text{margin-top:.25rem}.phone-number-field{display:flex;flex-direction:column}.phone-number-field__fields{align-items:stretch;display:flex;position:relative;width:100%}.phone-number-field__fields__country-code{align-items:center;background-color:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)*.4) 0 0 calc(var(--dynamic-border-radius)*.4);border-right:none;cursor:pointer;display:flex;padding-left:.75rem;position:relative;transition:all .2s ease;width:6.25rem}.phone-number-field__fields__country-code--disabled{background-color:var(--dynamic-base-3);pointer-events:none}.phone-number-field__fields__country-code__flag{margin-right:.5rem}.phone-number-field__fields__country-code__plus{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.phone-number-field__fields__country-code__container{align-items:center;display:flex;flex:1;pointer-events:none}.phone-number-field__fields__country-code .phone-number-field__fields__country-code__container .phone-number-field__fields__country-code__container__input{border:none;flex:1;padding:0;width:100%}.phone-number-field__fields__country-code__chevron{cursor:pointer;position:absolute;right:.5rem;width:1rem}.phone-number-field__fields__phone-number{align-items:center;display:flex;flex:1;position:relative}.phone-number-field__fields .phone-number-field__fields__phone-number .phone-number-field__fields__phone-number__input{border-radius:0 calc(var(--dynamic-border-radius)*.4) calc(var(--dynamic-border-radius)*.4) 0;padding-left:.75rem}.phone-number-field__fields__placeholder{align-self:center;color:var(--dynamic-text-secondary);left:7.0625rem;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.phone-number-field__fields__inline-submit{align-self:center;position:absolute;right:.75rem}.phone-number-field__dropdown{width:calc(var(--dynamic-modal-width) - 3rem)}.phone-number-field__dropdown__items{display:flex;flex-direction:column}.phone-number-field__dropdown__items__country{align-items:center;cursor:pointer;display:flex;gap:.375rem;padding:.375rem .75rem}.phone-number-field__dropdown__items__country__flag{width:1.5rem}.phone-number-field__dropdown__items__country__name{font-size:var(--dynamic-text-size-body-small)}.phone-number-field__dropdown__items__country__code{color:var(--dynamic-text-secondary);font-size:var(--dynamic-text-size-body-small)}.phone-number-field__dropdown__items__country:hover{background-color:var(--dynamic-base-4)}.phone-number-field__dropdown__items__country--selected{background-color:var(--dynamic-base-3)}.phone-number-field__error-message{color:var(--dynamic-error-1);padding:.5rem 0}.phone-number-field input::-webkit-inner-spin-button,.phone-number-field input::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.phone-number-field input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.inline-submit-button{--icon-arrow:var(--dynamic-text-tertiary);--icon-background:var(--dynamic-base-3);transition:all .2s}.inline-submit-button path,.inline-submit-button rect{transition:all .2s}.inline-submit-button--active,.inline-submit-button:hover{--icon-arrow:var(--dynamic-text-secondary);--icon-background:var(--dynamic-hover)}.inline-submit-button--ready,.inline-submit-button--ready:hover{--icon-arrow:var(--dynamic-base-2);--icon-background:var(--dynamic-brand-primary-color)}.input__container{position:relative}.input__container .input__suffix{position:absolute;right:1rem;top:1rem}.input__container .input{background:var(--dynamic-base-2);border-color:var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)*.4);border-width:.0625rem;color:var(--dynamic-text-primary);font-size:.9375rem;font-weight:400;margin:0;outline:none;transition:all .2s ease;width:100%}.input__container .input:disabled{background:var(--dynamic-base-3);border-color:var(--dynamic-base-4)}.input__container .input:disabled .input__label{color:var(--dynamic-text-tertiary)}.input__container .input__label{color:var(--dynamic-text-secondary);cursor:text;font-size:.625rem;pointer-events:none}.input__container .input:not(.input__error):focus,.input__container .input:not(.input__error):hover{background:var(--dynamic-base-2);border-color:var(--dynamic-base-4)}.input__container .input__error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.input__container .input__error~.input__label,.input__container .input__error~.input__trailing{color:var(--dynamic-error-1)}.input__container .input__has_trailing{padding-right:4rem}.input__container .input__trailing{color:var(--dynamic-text-secondary);font-size:.75rem;font-weight:500;position:absolute;right:.75rem;top:50%;transform:translateY(-50%)}.input__container--dense .input{padding:1.125rem .75rem .375rem}.input__container--dense .input::-moz-placeholder{color:transparent}.input__container--dense .input::placeholder{color:transparent}.input__container--dense .input--no-label{padding-block:.75rem}.input__container--dense .input__label{left:.75rem;position:absolute;top:.4375rem;transition:all .2s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none}.input__container--dense .input:-moz-placeholder-shown~.input__label{font-size:.9375rem;top:.75rem}.input__container--dense .input:placeholder-shown~.input__label{font-size:.9375rem;top:.75rem}.input__container--dense .input:focus~.input__label{font-size:.625rem;top:.4375rem}.input__container--regular{display:flex;flex-direction:column}.input__container--regular .input{padding:.75rem}.input__container--regular .input__label{align-items:center;display:inline-flex;font-size:.75rem;line-height:1rem;margin-bottom:.5rem;order:-1}.input__container--regular .input__label:after{background:var(--dynamic-base-4);content:"";flex:1;height:1px;margin-left:.75rem;right:0}.input__container--regular .input__suffix{top:2.375rem}.input__message{color:var(--dynamic-text-primary);padding:.5rem 0}.input__message__error{color:var(--dynamic-error-1)}.list-tile{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;gap:.625rem;padding:var(--dynamic-wallet-list-tile-padding);transition-duration:var(--dynamic-wallet-list-tile-animation-duration);transition-property:all;transition-timing-function:ease-out;width:100%}.list-tile:not(:disabled):active{transform:scale(.95)}.list-tile:not(:disabled):hover{background-color:var(--dynamic-wallet-list-tile-background-hover);border:var(--dynamic-wallet-list-tile-border-hover);box-shadow:var(--dynamic-wallet-list-tile-shadow-hover)}.list-tile__children{flex-grow:1;text-align:left}.modal-header{align-items:center;background:var(--dynamic-header-background);display:flex;justify-content:center;padding:var(--dynamic-header-padding);width:100%}.modal-header--border{border-bottom:var(--dynamic-header-border-bottom)}.modal-header--align-content-bottom{align-items:start}.modal-header--empty{padding-bottom:0}.modal-header__leading,.modal-header__trailing{align-items:center;display:flex;flex:1;gap:.25rem;height:1.5rem;justify-content:flex-start;margin-right:auto}.modal-header__leading--empty{height:0}.modal-header__trailing{justify-content:flex-end;margin-left:auto;margin-right:0}.modal-header__trailing--empty{height:0}.evm-network-control__container{align-items:center;background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);bottom:0;color:var(--dynamic-text-primary);display:flex;gap:.375rem;max-width:100%;padding:.25rem;position:absolute;right:0;transform:translateX(50%)}.evm-network-control__container--error{border:1px solid var(--dynamic-error-1);color:var(--dynamic-error-1);cursor:auto}.evm-network-control__network-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.evm-network-control__arrow-icon{min-width:1rem;transform:rotate(90deg);transition:transform .15s linear}.evm-network-control__arrow-icon--active{transform:rotate(-90deg)}@keyframes spinner-animation{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.network{color:var(--dynamic-text-primary);display:flex;justify-content:space-between;width:100%}.network .network__container{align-items:flex-start;display:flex}.network .network__title-icon{height:1rem;margin-right:.5rem;margin-top:.0625rem;width:1rem}.network .network__title-container{display:flex;flex-direction:column;gap:.25rem}.network .network__title-copy{white-space:nowrap}.network .network__status-container{align-items:center;border-radius:100%;display:flex;height:1rem;justify-content:center;width:1rem}.network .network__status-container .network__status-icon{color:#fff;height:.75rem;width:.75rem}.network .network__status-container .network__status-icon svg path{fill:currentcolor}.network .network__status-container .network__status-spinner-icon{animation:spinner-animation 2s linear infinite;height:.75rem;margin-right:-.9375rem;margin-top:-.75rem;transform-origin:0 100%;width:.75rem}.network .network__status-container--active{background-color:var(--dynamic-brand-primary-color)}.network-action{align-items:center;display:flex;padding:.5rem 1rem}@media (pointer:coarse){.network-action{padding:.5rem 1.5rem}}.network-action:not(.network--not-supported){cursor:pointer}.network-action:not(.network--not-supported):hover{background-color:var(--dynamic-hover)}.network-control-skeleton{align-items:center;border-radius:calc(var(--dynamic-border-radius)/2);display:flex;gap:.375rem;justify-content:center;padding:.1875rem .25rem}.network-control-skeleton__icon{background-color:var(--dynamic-base-3);border:1px solid var(--dynamic-base-4);border-radius:100%;height:1.125rem;width:1.125rem}.network-control-skeleton__skeleton{width:1.875rem}.non-network-switching-supported-control{align-items:center;background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);bottom:0;color:var(--dynamic-text-primary);display:flex;gap:.375rem;justify-content:center;padding:.25rem;position:absolute;right:0;transform:translateX(50%)}.non-network-switching-supported-control--error{background-color:var(--dynamic-error-2);cursor:auto}.non-network-switching-supported-control__network-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.network-picker-network-control{display:flex;flex-direction:column}.network-picker-network-control__anchor{padding-top:.125rem;position:relative}.pin-field__container{display:flex;flex:1;gap:2.5%;justify-content:space-between;margin-top:1rem;max-width:19.5rem;width:100%}.pin-input__input{background:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:.75rem;color:var(--dynamic-text-primary);font-size:1rem;height:2.75rem;max-width:2.75rem;outline:.125rem solid transparent;outline-offset:.125rem;text-align:center;width:100%}.pin-input__input:last-child{margin-right:0}.pin-input__input:disabled{cursor:not-allowed;opacity:.5}.pin-input__input--error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1);color:var(--dynamic-error-1)}.pin-input__input--success{background:var(--dynamic-success-2);border-color:var(--dynamic-success-1);color:var(--dynamic-success-1)}.portal__container{align-items:center;display:flex;height:100%;justify-content:center;width:100%}.portal__backdrop{-webkit-backdrop-filter:var(--dynamic-modal-backdrop-filter);backdrop-filter:var(--dynamic-modal-backdrop-filter);background:var(--dynamic-modal-backdrop-background);cursor:default;height:100%;left:0;position:fixed;top:0;width:100%}.search__container{align-items:center;background:var(--dynamic-search-bar-background);border:var(--dynamic-search-bar-border);border-radius:var(--dynamic-search-border-radius);cursor:text;display:flex;gap:.625rem;height:2.625rem;justify-content:space-between;min-height:2.25rem;padding-left:.75rem;padding-right:.75rem}.search__container,.search__container svg{color:var(--dynamic-text-tertiary)}.search__container:hover:not(.search__container--active,.search__container:focus-within){background:var(--dynamic-search-bar-background-hover);border:var(--dynamic-search-bar-border-hover);color:var(--dynamic-text-secondary)}.search__container:hover:not(.search__container--active,.search__container:focus-within) svg{color:var(--dynamic-text-secondary)}.search__container--active,.search__container:focus-within{background:var(--dynamic-search-bar-background-focus);border:var(--dynamic-search-bar-border-focus);color:var(--dynamic-text-primary)}.search__container--active svg,.search__container:focus-within svg{color:var(--dynamic-text-secondary)}.search-icon__container{align-items:center;color:var(--dynamic-text-tertiary);display:flex;height:1rem;justify-content:center;width:1rem}.search__input{background:none;border:0;color:var(--dynamic-text-primary);display:flex;flex-grow:1;font-size:var(--dynamic-text-size-body-small);font-weight:500;line-height:1rem;margin:0;outline:none;padding-bottom:.25rem;padding-top:.25rem}.search__input::-moz-placeholder{color:var(--dynamic-text-tertiary)}.search__input::placeholder{color:var(--dynamic-text-tertiary)}.search__input:hover::-moz-placeholder{color:var(--dynamic-text-secondary)}.search__input:hover::placeholder{color:var(--dynamic-text-secondary)}.search__input:focus::-moz-placeholder{color:transparent}.search__input:focus::placeholder{color:transparent}.search__button--clear{color:var(--dynamic-text-secondary);font-size:var(--dynamic-text-size-body-mini)}.search__button--clear:hover{color:var(--dynamic-text-primary)}.select__container{cursor:pointer;position:relative}.select__container .select{-webkit-appearance:none;-moz-appearance:none;appearance:none;bottom:0;left:0;opacity:0;outline:none;position:absolute;right:0;top:0}.select__container .select::-moz-placeholder{color:transparent}.select__container .select::placeholder{color:transparent}.select__container .select__body{background:var(--dynamic-base-2);border-color:var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)*.4);border-width:.0625rem;display:block;margin:0;padding:1.125rem .75rem .375rem;position:relative;transition:all .2s ease;width:100%}.select__container .select__value{color:var(--dynamic-text-primary);font-size:.9375rem;font-weight:400}.select__container .select__label{color:var(--dynamic-text-secondary);font-size:.9375rem;left:.75rem;pointer-events:none;position:absolute;top:.75rem;transition:all .2s ease}.select__container .select__control_icon{align-items:center;bottom:0;color:var(--dynamic-text-secondary);display:flex;position:absolute;right:.75rem;top:0}.select__container .select__has_value .select__label{font-size:.625rem;top:.4375rem}.select__container .select:has(.select__error)~.select__body{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.select__container .select__error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.select__container .select__error .select__control_icon,.select__container .select__error .select__label{color:var(--dynamic-error-1)}.select__message{color:var(--dynamic-text-primary);padding-top:.5rem}.select__message__error{color:var(--dynamic-error-1)}.separator{border-top:.0625rem solid var(--dynamic-base-3)}@keyframes shimmer{to{transform:translateX(100%)}}.skeleton{background:var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)/6);display:inline-flex;line-height:1;min-width:100%;overflow:hidden;position:relative;z-index:0}.skeleton:after{animation:shimmer 2s infinite;background-image:var(--dynamic-loading-animation-gradient);bottom:0;content:"";left:0;position:absolute;right:0;top:0;transform:translateX(-100%)}.spinner{animation:spin 1s linear infinite}.spinner path{stroke:var(--dynamic-brand-primary-color)}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.status-dot__container{align-items:center;background:var(--dynamic-base-1);border-radius:100%;display:flex;height:.625rem;justify-content:center;width:.625rem}.status-dot{border-radius:100%;height:.375rem;width:.375rem}.status-dot--green{background:var(--dynamic-success-1)}.status-dot--red{background:var(--dynamic-error-1)}.status-dot--yellow{background:var(--dynamic-alert-1)}.switch__container{display:flex}.switch__container.disabled{opacity:.2;pointer-events:none}.switch__container .button{background:var(--dynamic-base-2);border-radius:0;box-shadow:var(--dynamic-shadow-down-1);color:var(--dynamic-text-primary);font-size:var(--dynamic-text-size-button-primary);font-weight:400;margin:0;padding:.75rem 0;width:100%}.switch__container .button:first-child{border-bottom-left-radius:calc(var(--dynamic-border-radius)/3);border-right:0;border-top-left-radius:calc(var(--dynamic-border-radius)/3)}.switch__container .button:last-child{border-bottom-right-radius:calc(var(--dynamic-border-radius)/3);border-top-right-radius:calc(var(--dynamic-border-radius)/3)}.switch__container .button.active{background:var(--dynamic-brand-primary-color);color:#fff}.text-button{align-items:center;border-radius:calc(var(--dynamic-border-radius)/6);color:var(--dynamic-text-secondary);cursor:pointer;display:flex;font-size:.75rem;font-weight:500;gap:.375rem;padding:.125rem .375rem}.text-button:hover{background-color:var(--dynamic-hover)}.auth-mode-switch__container{align-items:center;color:#fff;display:flex;font-size:1rem;gap:.25rem;margin-bottom:.25rem}.auth-mode-switch__container label{cursor:pointer}.toolkit__container{background:var(--dynamic-base-1);border-bottom-right-radius:calc(var(--dynamic-border-radius)/1.5);border-top-right-radius:calc(var(--dynamic-border-radius)/1.5);display:flex;flex-direction:column;gap:1rem;left:0;padding:1.875rem 3.5rem;position:fixed;top:50%;transform:translateY(-50%);width:18.125rem}@media (pointer:coarse){.toolkit__container{display:none}}.switcher__copy{color:var(--dynamic-text-primary);margin-bottom:.25rem}.tos-and-pp__text{color:var(--dynamic-text-secondary);font-size:var(--dynamic-text-size-body-small);margin:0 auto;text-align:center}.tos-and-pp__text .tos-and-pp__link{color:var(--dynamic-text-link);text-decoration:none}.zoom-transition__root{transform-origin:50% 50%}.vertical-drawer-animation{overflow:hidden;transition-property:max-height;transition-timing-function:ease-out}.typography{font-family:var(--dynamic-font-family-primary);font-weight:400;line-height:normal}.typography--title{font-size:var(--dynamic-text-size-title)}.typography--body-normal{font-size:var(--dynamic-text-size-body-normal)}.typography--body-small{font-size:var(--dynamic-text-size-body-small)}.typography--body-mini{font-size:var(--dynamic-text-size-body-mini)}.typography--button-primary{font-size:var(--dynamic-text-size-button-primary);font-weight:700}.typography--button-secondary{font-size:var(--dynamic-text-size-button-secondary);font-weight:700}.typography--button-tertiary{font-size:var(--dynamic-text-size-button-secondary);font-weight:400}.typography--numbers-big{font-family:var(--dynamic-font-family-numbers);font-size:var(--dynamic-text-size-numbers-big)}.typography--numbers-medium{font-family:var(--dynamic-font-family-numbers);font-size:var(--dynamic-text-size-numbers-medium)}.typography--bold{font-weight:700}.typography--medium{font-weight:500}.typography--regular{font-weight:400}.typography--link{color:var(--dynamic-text-link)}.typography--brand-primary{color:var(--dynamic-brand-primary-color)}.typography--primary{color:var(--dynamic-text-primary)}.typography--secondary{color:var(--dynamic-text-secondary)}.typography--tertiary{color:var(--dynamic-text-tertiary)}.typography--uppercase{text-transform:uppercase}.typography--dynamic-error-1{color:var(--dynamic-error-1)}.typography--errror-2{color:var(--dynamic-error-2)}.typography--connection-green-1{color:var(--dynamic-success-1)}.typography--tooltip{color:var(--dynamic-tooltip-text-color)}.typography--inherit{color:inherit}.typography--white{color:#fff}.typography--truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.powered-by-dynamic{align-items:center;color:var(--dynamic-text-tertiary);display:flex;text-decoration:none;width:100%}.powered-by-dynamic--center{justify-content:center}.powered-by-dynamic--right{justify-content:end}.powered-by-dynamic__logo,.powered-by-dynamic__text{display:inline-block}.powered-by-dynamic__text{margin-right:.25rem}.powered-by-dynamic__logo{display:inline-block;margin-top:.0625rem;max-width:3.6875rem;width:3.6875rem}.dynamic-footer{background:var(--dynamic-footer-background);padding:var(--dynamic-footer-padding);width:100%}.dynamic-footer:not(.dynamic-footer__top-border){padding-top:0}.dynamic-footer__top-border{border-top:var(--dynamic-footer-border-top)}.user-address,.user-address__container{align-items:center;display:flex;justify-content:center}.user-address__container{margin-top:.375rem}.user-address__status-dot{margin-right:.375rem}.user-address__seperator{background-color:var(--dynamic-base-4);height:.5rem;margin:0 .5rem;width:.0625rem}.app-origin-tile{align-items:center;display:flex;flex-direction:column;gap:.125rem}.app-origin-tile__title{align-items:center;display:flex;gap:.25rem}.app-origin-tile__logo{height:1rem;width:auto}.options-switcher{background-color:var(--dynamic-base-4);display:flex;min-height:2rem;position:relative}.options-switcher,.options-switcher__active-rail,.options-switcher__button{border-radius:calc(var(--dynamic-border-radius)/3)}.options-switcher__button{color:var(--dynamic-text-secondary);flex:1;font-size:var(--dynamic-text-size-button-secondary);font-weight:500;position:relative}.options-switcher__button--active{color:var(--dynamic-text-primary)}.options-switcher__active-rail{background-color:var(--dynamic-base-2);box-shadow:var(--dynamic-shadow-down-1);height:100%;position:absolute;transition:left .1s ease-in-out}.dynamic-verified-icon{color:var(--dynamic-success-1)}.user-profile-field__value{align-items:center;display:flex;min-height:.9375rem;overflow:auto}.user-profile-field__verify-icon{margin-left:.25rem}.user-profile-section{margin:0 0 .75rem}.user-profile-section__title{margin-bottom:.5rem}.user-profile-section__header{display:flex;flex-direction:row;justify-content:space-between}.user-profile-section__action{display:flex;margin:0 0 .5rem}.user-profile-social-account__connected-avatar{border-radius:100%;height:100%;overflow:hidden;position:relative;width:100%}.user-profile-social-account__connected-provider-icon{background-color:#fff;border-radius:100%;bottom:-.1875rem;height:.875rem;padding:.09375rem;position:absolute;right:-.3125rem;width:.875rem}.user-profile-social-account__image{-o-object-fit:cover;object-fit:cover}.user-profile-social-account{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;gap:.625rem;padding:var(--dynamic-wallet-list-tile-padding);width:100%}.user-profile-social-account__icon{flex-shrink:0;height:1.5rem;position:relative;width:1.5rem}.user-profile-social-account__label{flex-grow:1;text-align:left}.user-profile-social-account__button{box-shadow:none;flex-shrink:0;padding:.1875rem .28125rem}.user-profile-social-account__button .button__spinner-container{left:auto}.user-profile__fields{background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);padding:.75rem}.user-profile__fields,.user-profile__social-accounts{display:flex;flex-direction:column;gap:.5rem}.divider{align-items:center;display:flex;gap:.75rem;justify-content:space-between;padding:1rem 0}.divider__dash{background:var(--dynamic-base-4);height:.0625rem;width:100%}.divider__text{white-space:nowrap}.divider__full-width{width:100%}.dynamic-tooltip{background-color:var(--dynamic-tooltip-color);border-radius:calc(var(--dynamic-border-radius)/4);opacity:0;padding:.125rem .5rem;pointer-events:none;position:absolute;transform:translate(-50%,-100%);transform-origin:50% 50%;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap;z-index:-1}.dynamic-tooltip__arrow{bottom:-.1875rem;color:var(--dynamic-tooltip-color);height:.25rem;left:50%;position:absolute;transform:translateX(-50%);width:.375rem}.dynamic-tooltip--visible{opacity:1;pointer-events:unset;-webkit-user-select:unset;-moz-user-select:unset;user-select:unset;z-index:1}.modal-header-banner{padding:.5rem .75rem;text-align:center}.modal-header-banner__error{background-color:var(--dynamic-error-2)}.modal-header-banner__success{background-color:var(--dynamic-success-2)}.modal-header-banner__notice{background-color:var(--dynamic-brand-secondary-color)}.otp-verification-view{align-items:center;display:flex;flex-direction:column;padding:var(--dynamic-layout-content-padding);text-align:center}.otp-verification-view__icon-with-spinner{margin:0 auto .75rem}.otp-verification-view--message{padding:var(--dynamic-layout-content-error-padding)}.otp-verification-view__status-header{align-items:center;display:flex;justify-content:center}.otp-verification-view__footer{display:flex;flex-direction:column;gap:1rem}.otp-verification-view__destination-container{align-items:center;display:flex;gap:.25rem;justify-content:center}.otp-verification-view__retry-container{margin:1rem auto 0}.overlay-card{bottom:0;height:100%;left:0;max-height:100%;position:absolute;right:0}.overlay-card--disabled{pointer-events:none}.overlay-card__animation{bottom:0;height:100%;left:0;max-height:100%;position:absolute;right:0;top:0}.overlay-card__animation--limit-height{height:80%;max-height:80%;top:unset}.overlay-card__overlay{background-color:var(--dynamic-overlay);bottom:0;left:0;position:absolute;right:0;top:0}.overlay-card__content{background-color:var(--dynamic-base-1);border-radius:calc(var(--dynamic-border-radius)/1.5);border-top:.0625rem solid var(--dynamic-base-4);bottom:0;display:flex;flex-direction:column;left:0;max-height:100%;overflow-y:auto;position:absolute;right:0}@media (pointer:coarse){.overlay-card__content{border-bottom-left-radius:0;border-bottom-right-radius:0}}.overlay-card-target{bottom:0;height:100%;left:0;max-height:100%;overflow:auto;position:absolute;right:0}.icon-list-tile{padding-left:0;padding-right:0}.icon-list-tile--children{align-items:center;display:flex;justify-content:center}.popper-content{display:flex;position:absolute;z-index:100}.popper-content__transform-origin-bottom-left{transform:translateY(-100%)}.popper-content__transform-origin-bottom-right{transform:translate(-100%,-100%)}.popper-content__transform-origin-top-left{transform:translate(0)}.popper-content__transform-origin-top-right{transform:translate(-100%)}.dropdown{align-items:stretch;background-color:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/3);box-shadow:0 .5rem .75rem -.375rem rgba(24,39,75,.06),0 .5rem .75rem -.1875rem rgba(24,39,75,.06);display:flex;flex-direction:column;max-height:var(--max-height);min-width:10rem;overflow-y:auto;padding-block:.1875rem}.dropdown--entering{animation-fill-mode:both;animation-iteration-count:1;animation-name:desktop-dropdown-entering-animation;animation-timing-function:ease-out}.dropdown--exiting{animation-fill-mode:both;animation-iteration-count:1;animation-name:desktop-dropdown-exiting-animation;animation-timing-function:ease-out}.menu-list__overlay-card__container{align-items:stretch;display:flex;flex-direction:column;overflow-y:auto;padding-bottom:1.25rem}.transaction-confirmation.dynamic-tooltip{word-wrap:break-word;color:var(--dynamic-base-1);font-size:12px;line-height:1.4;max-width:145px;white-space:normal;width:-moz-max-content;width:max-content}.transaction-confirmation__banner{margin:-8px auto 0;padding-bottom:16px;text-align:center;width:75%}.transaction-confirmation__actions{align-items:center;display:flex;flex-direction:row;gap:.375rem;padding-top:24px;width:100%}.transaction-confirmation__actions .button--brand-primary .icon--color-text-secondary,.transaction-confirmation__actions .button--brand-primary .typography--primary{color:#fff}.transaction-confirmation__footer{padding-top:1rem}.transaction-confirmation__body{align-items:stretch;display:flex;flex:1;flex-direction:column;overflow:hidden;padding:0 1.5rem 1.5rem}.transaction-confirmation__app-origin-tile{padding:.75rem}.transaction-confirmation__content{display:flex;flex:1;flex-direction:column;justify-content:flex-start;margin-top:.25rem;overflow:auto;width:100%}.transaction-confirmation__rows{max-height:14.375rem;padding:.5rem .75rem;width:100%}.transaction-confirmation__rows .flex{display:flex;justify-content:space-between}.transaction-confirmation__rows .flex-row{flex-direction:row;gap:.5rem}.transaction-confirmation__rows .row{padding:.5rem 0}.transaction-confirmation__rows .gap{gap:.3rem}.transaction-confirmation__secure-wallet{margin-bottom:0;margin-top:1rem}.transaction-confirmation__info{text-align:right}.transaction-confirmation__error{padding-top:.75rem}.transaction-confirmation__warning{padding-top:12px}.transaction-card-container{display:flex;flex-direction:column;gap:.75rem}.transaction-card{background-color:var(--dynamic-base-2);border-radius:.75rem;display:flex;flex-direction:column;padding:.5rem}.transaction-card__icon{align-items:center;display:flex;margin-left:auto}.transaction-card__icon__container{align-items:center;display:flex;justify-content:center;position:relative}.transaction-card__icon__container__main{border-radius:50%;height:2rem;width:2rem}.transaction-card__icon__container__network{background-color:var(--dynamic-base-1);border:1px solid var(--dynamic-base-1);border-radius:50%;bottom:-3px;height:1rem;position:absolute;right:-3px;width:1rem}.transaction-card__total p .typography{gap:.3rem}.transaction-card__info{align-items:center;display:flex;flex-direction:row;gap:.25rem}.transaction-card__assets-container{display:flex;flex-direction:column}.transaction-card__in,.transaction-card__out{padding:.25rem 0;width:100%}.transaction-card__info-container{align-items:center;display:flex;justify-content:space-between;padding:.5rem;width:100%}.transaction-card__amount-symbol{align-items:center;display:flex;gap:.75rem}.transaction-card__token-info{align-items:flex-end;display:flex;flex-direction:column;gap:.125rem}.transaction-card__token-row{align-items:center;display:flex;gap:.5rem}.transaction-card__arrow{color:var(--dynamic-text-secondary);font-size:1.25rem;margin-left:.5rem}.transaction-card__destination{align-items:center;display:flex;gap:.5rem;margin:0}.transaction-card .row{border-top:1px solid var(--dynamic-base-3);display:flex;justify-content:space-between;padding:.6rem 0}.transaction-card .flex-row{display:flex;flex-direction:row;gap:.1rem}.transaction-card .gap-native{gap:.3rem}.transaction-card__divider{border-top:1px solid var(--dynamic-base-3);margin:0 .75rem}.transaction-card__details{display:flex;flex-direction:column}.transaction-card__row{align-items:center;display:flex;justify-content:space-between;padding:.5rem}.transaction-card__value{align-items:flex-end;display:flex;flex-direction:column;gap:.125rem}.transaction-card__network-info{align-items:center;display:flex;gap:.5rem}.transaction-card__network-icon{border-radius:50%}.transaction-card__fee-info{align-items:center;display:flex;gap:.5rem}.transaction-card__fee-info .fee-tooltip{margin-right:.25rem}.transaction-card__label-with-tooltip{align-items:center;display:flex;gap:.25rem}.transaction-card__label-with-tooltip .fee-tooltip{align-items:center;display:flex}.transaction-status-layout{display:flex;flex:1;flex-direction:column;overflow:hidden}.transaction-status-layout .modal-header{padding:3rem .3125rem .625rem}.transaction-status-layout__status-icon{color:var(--dynamic-brand-primary-color);height:4rem;width:4rem}.transaction-status-layout__title{text-align:center}.transaction-status-layout__body{align-items:stretch;display:flex;flex:1;flex-direction:column;padding:.25rem 1.5rem 1.5rem}.transaction-status-layout__sent_to{text-align:center}.transaction-status-layout__sent_to p{display:inline}.transaction-status-layout__content{align-items:center;display:flex;flex-direction:column;justify-content:center;margin-top:.375rem;width:100%}.transaction-status-layout__rows{max-height:14.375rem;overflow-y:auto;padding:.375rem .75rem;width:100%}.transaction-status-layout__rows p{font-size:1.5rem}.transaction-status-layout__rows>.transaction-row:not(:first-child){border-top:1px solid var(--dynamic-base-4)}.transaction-status-layout__actions{margin-top:auto;padding-top:1rem}.transaction-status-layout__actions .button--brand-primary .typography--primary{color:var(--dynamic-base-2)}.transaction-status-layout__footer{padding-top:1rem}.transaction-origin-destination__arrow-icon,.transaction-origin-destination__wallet-icon{display:inline-block}.transaction-origin-destination__arrow-icon,.transaction-origin-destination__text,.transaction-origin-destination__wallet-icon{vertical-align:middle}.transaction-origin-destination__wallet-icon{height:1rem;margin-right:.375rem;width:1rem}.transaction-origin-destination__arrow-icon{color:var(--dynamic-text-tertiary);margin:0 .5625rem}.tokens-balance-dropdown{background-color:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-button-border-radius)/1);cursor:pointer;padding:.875rem .75rem}.tokens-balance-dropdown,.tokens-balance-dropdown__selected{align-items:center;display:flex;gap:.5rem;justify-content:space-between}.tokens-balance-dropdown__selected .evm-network-control__arrow-icon{position:absolute;right:2.625rem}.tokens-balance-dropdown__menu_list{border-radius:calc(var(--dynamic-button-border-radius)/1);padding:.5rem 1rem;width:19.375rem}@media (max-width:640px){.tokens-balance-dropdown__menu_list{margin:0 auto;width:100%}.tokens-balance-dropdown__menu_list .modal-header{padding:1rem 0 1rem 1.25rem}}.tokens-balance-dropdown__menu_list .modal-header__leading,.tokens-balance-dropdown__menu_list .modal-header__trailing{flex:none}.tokens-balance-dropdown__menu_list_item{align-items:center;display:flex;gap:.625rem;justify-content:space-between;padding:.5rem 0;text-align:left}.tokens-balance-dropdown__menu_list_item__name{display:flex;gap:.3125rem;min-width:9.375rem}.tokens-balance-dropdown__menu_list_item__balance{display:flex;gap:.3125rem}.tokens-balance-dropdown__chain{align-items:center;display:flex;gap:.375rem}.tokens-balance-dropdown__chain__icon{height:1rem;width:1rem}.tokens-balance-dropdown__balance-container{align-items:center;display:flex;gap:.25rem}.tokens-balance-dropdown__balance{align-items:center;display:flex;gap:.125rem}.send-balance-page-layout__header-content{align-items:center;display:flex;gap:.5rem}.send-balance-page-layout__body{display:flex;flex:1;flex-direction:column;overflow:auto;padding:.25rem 1.5rem 1.5rem}.send-balance-page-layout__balance-container{display:flex;flex-direction:column;gap:.5rem;padding-bottom:.5rem}.send-balance-page-layout__error{padding-bottom:1rem}.send-balance-page-layout__footer{padding-top:1.5rem}.send-balance-page-layout__network-container{display:flex;justify-content:center;padding-bottom:.5rem}.send-balance-form{display:flex;flex:1;flex-direction:column;gap:.5rem}.send-balance-form__button{margin-top:auto}.send-balance-form__secure-wallet{margin:0}.send-balance-form__field.fiat{padding-left:1.5625rem}.send-balance-form__amount-container{position:relative}.send-balance-form__amount-container__fiat_sign{left:.625rem;position:absolute;top:.6875rem}.send-balance-form__amount-container__double_arrow{position:absolute;right:.625rem;top:.875rem}.send-balance-form__amount-container__balance{display:flex;gap:.25rem;position:absolute;right:.75rem;top:1.4375rem}.send-balance-form__amount-container__field.input{padding-left:3.125rem;transition:none}.send-balance-form__amount-container__floating_value{color:#000;font-size:1rem;left:10px;pointer-events:none;position:absolute;top:1.1875rem;white-space:nowrap}.send-balance-form__amount_available{border-bottom:1px solid var(--dynamic-base-3);padding-bottom:.75rem}.send-balance-form .input__container--regular .input__label:after{content:"";height:0}.select-network-button__icon{display:inline;margin:0 6px 3px;max-height:16px;max-width:16px;vertical-align:middle}.chip{align-items:center;background:var(--dynamic-base-2);border-radius:.75rem;color:var(--dynamic-text-primary);display:inline-flex;gap:.1875rem;height:1.5rem;justify-content:center;padding:.125rem .25rem}.chip__with-icon{padding:.125rem .25rem .125rem .125rem}.chip--icon{border-radius:50%;height:1.25rem;justify-content:center;overflow:hidden;width:1.25rem}.chip--icon,.form-field-label{align-items:center;display:flex}.form-field-label{color:var(--dynamic-text-secondary);cursor:text;font-size:.75rem}.form-field-label__with-divider:after{background:var(--dynamic-base-4);content:"";flex:1;height:1px;margin-left:.75rem;right:0}.step{counter-increment:step;gap:.5rem}.step,.step__icon{align-items:center;display:flex}.step__icon{flex-shrink:0;height:1.25rem;justify-content:center;width:1.25rem}.step__icon--done{background-color:var(--dynamic-success-1);border-radius:50%}.step__icon__check-mark{color:var(--dynamic-base-1);height:1rem;width:1rem}.step__index{align-items:center;border:1px solid var(--dynamic-base-4);border-radius:.625rem;display:flex;height:1.25rem;justify-content:center;min-width:1.25rem;padding:0 .25rem}.step__index-label:before{content:counter(step)}.step__leading{max-width:-moz-fit-content;max-width:fit-content;position:relative}.stepper{counter-reset:step;display:flex;gap:1rem;width:100%}.stepper__divider{flex-grow:1}.modal{left:50%;margin:auto;position:fixed;top:50%;transform:translate(-50%,-50%);width:var(--dynamic-modal-width)}@media (max-width:640px){.modal{bottom:0;max-width:37.5rem;top:auto;transform:translate(-50%);width:100%}}.modal__items{display:flex;flex-direction:column;gap:.75rem}.modal-card{background:var(--dynamic-base-1);border-radius:var(--dynamic-border-radius);box-shadow:var(--dynamic-shadow-down-3);overflow:hidden;width:100%}.modal-card--radius-small{border-radius:calc(var(--dynamic-border-radius)*.75)}.modal-card--with-border{border:1px solid var(--dynamic-base-4)}@media (max-width:640px){.modal-card{bottom:0;max-width:37.5rem;top:auto;transform:translateY(0);width:100%}.modal-card--sharp-mobile-bottom-radius:last-child{border-radius:var(--dynamic-border-radius) var(--dynamic-border-radius) 0 0}}.inline-widget-button{align-items:center;background-color:var(--dynamic-base-1);display:flex;gap:.5rem;min-height:100%;padding:.5rem .75rem;width:-moz-fit-content;width:fit-content}.inline-widget-button:hover{background-color:var(--dynamic-hover)}.inline-widget-button__icon{height:1.25rem;width:1.25rem}.inline-widget-button__vertical-divider{background-color:var(--dynamic-base-3);content:"";height:1rem;width:.0625rem}.inline-widget{align-items:center;background-color:var(--dynamic-base-1);border-radius:calc(var(--dynamic-border-radius)/3);display:flex;justify-content:center;overflow:hidden;width:-moz-fit-content;width:fit-content}.inline-widget>*{border-right:1px solid var(--dynamic-base-3)}.inline-widget>:last-child{border-right:none}.wallet-information-card{background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);display:flex;flex-direction:column}.wallet-information-card__header{border-bottom:1px solid var(--dynamic-base-3);display:flex;gap:.5rem;justify-content:space-between;padding:.75rem}.wallet-information-card__details-container{align-items:center;display:flex;gap:.75rem;justify-content:space-between;min-width:0}.wallet-information-card__menu{flex-shrink:0}.wallet-information-card__icon{height:1.75rem;width:1.75rem}.wallet-information-card__details{display:flex;flex-direction:column;overflow:hidden}.wallet-information-card__balance-container{align-items:center;display:flex;gap:.5rem;justify-content:space-between;padding:.75rem}.social-sign-in{display:flex;flex-wrap:wrap;gap:.375rem;justify-content:space-between}.social-sign-in--tile{flex:1;height:2.5rem}.social-sign-in--tile__full-width{flex:1 0 100%}.social-sign-in--card{display:flex;flex-direction:column;min-height:11.5625rem}.social-sign-in--card--body{display:grid;gap:.375rem;grid-template-columns:auto auto auto auto;padding:.25rem 1.5rem 1.5rem}.social-sign-in--card--tile{height:2.5rem}.sign-typed-data-preview--attribute-row{display:flex;gap:.5rem}.sign-typed-data-preview--fields-list,.sign-typed-data-preview--type-container{display:flex;flex-direction:column;gap:.25rem}.sign-typed-data-preview--type-container{padding-left:1rem}.need-help-section{align-items:center;display:flex;flex-direction:column;gap:.125rem;margin-bottom:.5rem}.need-help-section__links{display:flex;gap:.5rem}.need-help-section__links>*+*{padding-left:.5rem;position:relative}.need-help-section__links>*+:after{border-left:1px solid var(--dynamic-text-secondary);bottom:15%;content:"";left:0;position:absolute;top:15%;width:50%}.need-help-section__helper-link{color:var(--dynamic-text-link)}.textarea__container{position:relative}.textarea__container .textarea__suffix{position:absolute;right:1rem;top:1rem}.textarea__container .textarea{background:var(--dynamic-base-2);border-color:var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)*.4);border-width:.0625rem;color:var(--dynamic-text-primary);font-size:.9375rem;font-weight:400;margin:0;outline:none;resize:none;transition:all .2s ease;width:100%}.textarea__container .textarea:disabled{background:var(--dynamic-base-3);border-color:var(--dynamic-base-4)}.textarea__container .textarea:disabled .textarea__label{color:var(--dynamic-text-tertiary)}.textarea__container .textarea__label{color:var(--dynamic-text-secondary);cursor:text;font-size:.625rem}.textarea__container .textarea:not(.textarea__error):focus,.textarea__container .textarea:not(.textarea__error):hover{background:var(--dynamic-base-2);border-color:var(--dynamic-base-4)}.textarea__container .textarea__error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.textarea__container .textarea__error~.textarea__label,.textarea__container .textarea__error~.textarea__trailing{color:var(--dynamic-error-1)}.textarea__container .textarea__valid{background:var(--dynamic-success-2);border-color:var(--dynamic-success-1)}.textarea__container .textarea__valid~.textarea__label,.textarea__container .textarea__valid~.textarea__trailing{color:var(--dynamic-success-1)}.textarea__container .textarea__has_trailing{padding-right:4rem}.textarea__container .textarea__trailing{color:var(--dynamic-text-secondary);font-size:.75rem;font-weight:500;position:absolute;right:.75rem;top:50%;transform:translateY(-50%)}.textarea__container--dense .textarea{padding:1.125rem .75rem .375rem}.textarea__container--dense .textarea::-moz-placeholder{color:transparent}.textarea__container--dense .textarea::placeholder{color:transparent}.textarea__container--dense .textarea__label{left:.75rem;position:absolute;top:.4375rem;transition:all .2s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none}.textarea__container--dense .textarea:-moz-placeholder-shown~.textarea__label{font-size:.9375rem;top:.75rem}.textarea__container--dense .textarea:placeholder-shown~.textarea__label{font-size:.9375rem;top:.75rem}.textarea__container--dense .textarea:focus~.textarea__label{font-size:.625rem;top:.4375rem}.textarea__container--regular{display:flex;flex-direction:column}.textarea__container--regular .textarea{padding:.75rem}.textarea__container--regular .textarea__label{align-items:center;display:inline-flex;font-size:.75rem;line-height:1rem;margin-bottom:.5rem;order:-1}.textarea__container--regular .textarea__label:after{background:var(--dynamic-base-4);content:"";flex:1;height:1px;margin-left:.75rem;right:0}.textarea__container--regular .textarea__suffix{top:2.375rem}.textarea__message{color:var(--dynamic-text-primary);padding:.5rem 0}.textarea__message__error{color:var(--dynamic-error-1)}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover,select:-webkit-autofill,select:-webkit-autofill:focus,select:-webkit-autofill:hover,textarea:-webkit-autofill,textarea:-webkit-autofill:focus,textarea:-webkit-autofill:hover{-webkit-text-fill-color:var(--dynamic-text-primary)!important;background:var(--dynamic-base-2);border-color:var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)*.4);border-width:.0625rem;color:var(--dynamic-text-primary)!important;-webkit-transition:background-color 5000s ease-in-out 0s;transition:background-color 5000s ease-in-out 0s}.secure-embedded-wallet-card{background:var(--dynamic-brand-secondary-color);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);color:var(--dynamic-text-primary);display:flex;gap:.625rem;padding:.75rem;transition-duration:var(--dynamic-wallet-list-tile-animation-duration);transition-property:all;transition-timing-function:ease-out;width:100%}.secure-embedded-wallet-card__text-content{align-items:flex-start;cursor:pointer;display:flex;flex-direction:column;flex-grow:1;padding:0;text-align:left}.secure-embedded-wallet-card__text-content,.secure-embedded-wallet-card__text-content:hover{background-color:transparent;box-shadow:none}.secure-embedded-wallet-card__link{line-height:20px;text-decoration:underline}.toggle{-webkit-tap-highlight-color:transparent;cursor:pointer;display:inline-block}.toggle--input{display:none}.toggle--input:checked+.toggle--content__variant-primary{background-color:var(--dynamic-brand-primary-color);color:var(--dynamic-brand-primary-color)}.toggle--input:checked+.toggle--content .toggle--knob{left:1.09375rem}.toggle--input:checked+.toggle--content .toggle--knob>*{opacity:1}.toggle--content{background-color:var(--dynamic-base-3);border-radius:.625rem;height:1.25rem;position:relative;transition:background-color .2s ease;width:2.25rem}.toggle--knob{align-items:center;background-color:#fff;border-radius:100%;display:flex;height:1.0625rem;justify-content:center;left:.09375rem;position:absolute;top:.09375rem;transition:left .2s ease;width:1.0625rem}.toggle--knob>*{opacity:0;transition:opacity .2s ease}.list-tile-animated-trailing{position:relative}.list-tile-animated-trailing__child{position:absolute;right:0;transform:translateY(-50%);transition-duration:.2s;transition-property:opacity,transform;transition-timing-function:ease-in}.list-tile-animated-trailing__hover-element{opacity:0;position:absolute;right:0;transform:translate(-.625rem,-50%);transition-duration:.3s}.list-tile:hover .list-tile-animated-trailing__hover-element{opacity:1;transform:translateY(-50%)}.list-tile:hover .list-tile-animated-trailing__child{opacity:0;transform:translate(-.625rem,-50%)}.wallet-group-view-layout__container{padding:var(--dynamic-layout-content-padding)}.wallet-group-view-layout__icon{height:4rem;margin:0 auto .75rem;width:4rem}.wallet-group-view-layout__list{display:flex;flex-direction:column;gap:.5rem}.wallet-group-view-layout__title{padding-bottom:1rem;text-align:center}.retry-send-verification-code-section{align-items:center;display:flex;flex-direction:column}.retry-send-verification-code-section__confirmation{color:var(--dynamic-success-1);display:flex;gap:.3125rem;padding:.125rem .375rem}.toggle-visibility-button__container{position:relative}.toggle-visibility-button__tooltip{background-color:var(--dynamic-text-primary);color:var(--dynamic-base-2);font-size:.75rem}.qrcode{--background:var(--dynamic-base-1);color:var(--dynamic-text-primary);position:relative}.qrcode__container{align-items:center;border-radius:calc(var(--dynamic-border-radius)/1.5);display:flex;height:18.125rem;justify-content:center;margin:auto;width:18.125rem}.qrcode__icon{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.qrcode-container__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.qrcode-container__container--message{padding:var(--dynamic-layout-content-error-padding)}.qrcode-container__container .button__content{display:flex;gap:.375rem}.qrcode-container__top{align-items:center;background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)*.6);display:flex;flex-direction:column;gap:.625rem;margin-bottom:1.25rem;padding:.75rem}.qrcode-container__top .button-container{align-items:center;display:flex;gap:.5rem;width:100%}.qrcode-container__top .button-container svg path{fill-opacity:100%}.qrcode-container__top .button-container .qr-code-button{height:2.375rem}.qrcode-container__content{max-width:20rem;text-align:center}.qrcode-container__tos{margin-top:1rem;max-width:17.5rem;text-align:center}.qrcode-container__tos .tos__link{color:var(--dynamic-text-link)}.qrcode-container__tos .tos__link:hover{text-decoration:underline}.qr-code-wrapper__scan-issue-message{align-items:center;background:var(--dynamic-base-2);border-bottom:var(--dynamic-button-primary-border);border-radius:0;border-top:var(--dynamic-button-primary-border);color:var(--dynamic-text-primary);display:flex;justify-content:center;padding:.5rem .75rem;text-align:center;width:100%}.qr-code-wrapper__scan-issue-button{color:var(--dynamic-text-link);font-size:.75rem;text-decoration:underline}.radio-button{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;gap:.5rem;padding:.75rem;width:100%}.radio-button input{height:1.5rem;width:1.5rem}.mfa-device-skeleton{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;flex-direction:row;gap:.625rem;margin-bottom:.625rem;padding:.625rem;width:auto}.mfa-device-skeleton__details{display:flex;flex-direction:column;flex-grow:1;justify-content:space-between;padding-right:.625rem}.phantom-ledger-icon{position:absolute}.phantom-ledger-icon__container{align-items:center;display:flex;height:100%;position:relative}.account-exists__container{align-items:center;background:var(--dynamic-base-1);display:flex;flex-direction:column;padding:.3125rem}.account-exists__main{padding:var(--dynamic-modal-padding)}.account-exists__social-icon{margin:auto}.account-exists__image{padding:.3125rem;width:4.375rem}.account-exists__content{text-align:center}.account-exists__content--primary{margin-bottom:.375rem}.account-exists__content--secondary{margin-bottom:1rem}.account-exists__button--primary{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);box-shadow:var(--dynamic-shadow-down-1);margin:0}.user-data-form__form{display:flex;flex-direction:column}.user-data-form__error{margin-bottom:.625rem}.user-field__checkbox-container{background:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/2);display:flex;flex-direction:column;padding:.625rem}.user-field__checkbox-container--error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.user-field__consent-checkbox{display:flex;margin-bottom:.5rem}.user-field__consent-checkbox a{color:var(--dynamic-text-link)}.user-field__consent-checkbox:last-child{margin-bottom:0}.user-field__checkbox-label{padding-left:.75rem}.user-field__error-message{color:var(--dynamic-error-1);padding:.25rem}.user-phone-field__optional-label{color:var(--dynamic-text-secondary);font-size:.75rem;font-weight:500;pointer-events:none;position:absolute;right:.75rem;top:50%;transform:translateY(-50%)}.user-data-fields__fields-column{display:flex;flex-direction:column;gap:.375rem;margin-bottom:.5rem;max-height:11.25rem;overflow:auto}.user-data-fields__tooltip{background-color:var(--dynamic-text-primary);color:var(--dynamic-base-2);font-size:.75rem}.collect-user-data::-webkit-scrollbar,.collect-user-data::-webkit-scrollbar-thumb,.collect-user-data::-webkit-scrollbar-track{display:none}.collect-user-data__main-img{width:100%}.collect-user-data__form{padding:var(--dynamic-layout-content-padding)}.collect-user-data__form--error{padding:var(--dynamic-layout-content-error-padding)}.collect-user-data__img-container{align-items:center;display:flex;justify-content:center}.collect-user-data__img{height:1.75rem;width:1.75rem}.collect-user-data__img--rounded{border-radius:9999px}.collect-user-data__wallet-address{margin-left:.5rem}.collect-user-data__success-icon{align-items:center;display:flex;justify-content:center}.collect-user-data__success-icon svg{height:4rem;width:4rem}.collect-user-data__welcome-container{margin:1rem 0;text-align:center}.collect-user-data__welcome-title{margin-bottom:.25rem}.collect-user-data__log-out{margin:.75rem auto 0}.collect-user-data__error--not-supported{align-items:center;border-radius:0;display:flex;justify-content:center;margin:0;width:100%}.collect-user-data__network-picker{margin:auto 0;max-width:-moz-fit-content;max-width:fit-content}.collect-user-data__network-picker-button{border:1px solid var(--dynamic-base-4);position:static;transform:translateX(0)}.collect-user-data__network-picker-button:hover{background:var(--dynamic-hover)}.collect-user-data__network-container{border:var(--dynamic-header-border-bottom);display:flex;justify-content:space-between;padding:var(--dynamic-header-padding);position:relative}.collect-user-data-login-no-wallet::-webkit-scrollbar,.collect-user-data-login-no-wallet::-webkit-scrollbar-thumb,.collect-user-data-login-no-wallet::-webkit-scrollbar-track{display:none}.collect-user-data-login-no-wallet__main-img{width:100%}.collect-user-data-login-no-wallet__user-info-container{align-items:center;border:var(--dynamic-header-border-bottom);display:flex;justify-content:center;padding:var(--dynamic-header-padding)}.collect-user-data-login-no-wallet__user-identification{margin-left:.5rem}.collect-user-data-login-no-wallet__icon-container{height:1.5rem;width:1.5rem}.collect-user-data-login-no-wallet__icon-container .user-profile-social-account__connected-avatar{margin-top:.125rem}.collect-user-data-login-no-wallet__form{padding:var(--dynamic-layout-content-padding)}.collect-user-data-login-no-wallet__success-icon{align-items:center;display:flex;justify-content:center}.collect-user-data-login-no-wallet__success-icon svg{height:4rem;width:4rem}.collect-user-data-login-no-wallet__welcome-container{margin:1rem 0;text-align:center}.collect-user-data-login-no-wallet__welcome-title{margin-bottom:.375rem}.collect-user-data-login-no-wallet__log-out{margin:.75rem auto 0}.email-verification__retry-container{margin:1rem auto 0}.email-verification__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.email-verification__container--error{padding:var(--dynamic-layout-content-error-padding)}.email-verification__icon-with-spinner{margin:0 auto .75rem}.email-verification__error-message{margin:0}.email-verification__error-message,.email-verification__transfer-message{align-items:center;border-radius:0;display:flex;justify-content:center;width:100%}.email-verification__transfer-message{background:var(--dynamic-success-2);color:var(--dynamic-success-1);margin-bottom:.5rem;padding:.5rem .75rem;text-align:center}.email-verification__icon--verified{margin:0 auto 1rem}.email-verification__title{margin-top:.5rem;text-align:center}.email-verification__retry-copy{margin-top:1rem}.email-verification__copy-text-container{margin:0;text-align:center}.email-verification__text-button{color:var(--dynamic-text-link)}.email-verification__text-button:disabled{color:var(--dynamic-text-tertiary);cursor:not-allowed}.email-verification__log-out{margin:.75rem auto 0}.no-qr-code-installed__container{align-items:center;color:var(--dynamic-text-primary);flex-direction:column;margin:-2.25rem 0 0;padding:var(--dynamic-modal-padding);padding-top:0;width:100%}.no-qr-code-installed__container:first-child,.no-qr-code-installed__container:last-child{margin-right:0}.no-qr-code-installed__img{display:flex;height:auto;justify-content:center;margin:auto;text-align:center}.no-qr-code-installed__typography{text-align:center}.no-qr-code-installed__typography--title{margin:1rem 0 .375rem;text-align:center}.no-qr-code-installed__links-section{flex-direction:column;margin:1rem 0}.wallet-help-link__anchor{align-items:center;background:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);color:var(--dynamic-text-primary);display:flex;gap:.625rem;margin-bottom:.5rem;padding:.75rem;position:relative;width:100%}.pending-connect__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.pending-connect__copy-text{color:var(--dynamic-text-secondary);max-width:20rem;text-align:center}.pending-connect__icon-with-spinner{margin:0 auto .75rem}.pending-signature__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.pending-signature__container .pending-signature__icon-with-spinner{margin:0 auto .75rem}.pending-signature__container .pending-signature__copy{color:var(--dynamic-text-secondary);line-height:1.25rem;max-width:20rem;text-align:center}.pending-signature__container .pending-signature__copy--mini{line-height:1rem;margin-top:.25rem}.pending-signature__container .pending-signature__button{box-shadow:var(--dynamic-shadow-down-1);margin-top:.75rem}.social-wrong-account-view__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:0 var(--dynamic-modal-padding) 1.125rem}.social-wrong-account-view__container .social-wrong-account-view__title{color:var(--dynamic-text-primary);line-height:1.5rem}.social-wrong-account-view__container .social-wrong-account-view__copy{color:var(--dynamic-text-secondary);line-height:1.25rem;margin-top:.375rem;max-width:20rem;text-align:center}.social-wrong-account-view__container .social-wrong-account-view__button{box-shadow:var(--dynamic-shadow-down-1);margin-top:.75rem}.social-redirect-view__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:2rem var(--dynamic-modal-padding)}.social-redirect-view__container .social-redirect-view__title{color:var(--dynamic-text-primary);line-height:2.25rem}.sms-verification__text-button{color:var(--dynamic-text-link)}.sms-verification__text-button:disabled{color:var(--dynamic-text-tertiary);cursor:not-allowed}.sms-verification__log-out{margin:.75rem auto 0}.search-instead__container{font-size:.75rem;line-height:1rem;margin-top:2.5rem;padding-bottom:1rem;text-align:center;transition-duration:.3s;transition-property:background-color,border-color,color,fill,stroke;width:100%}.search-instead__container__image{display:flex;justify-content:center;margin:.5rem auto}.wallet-list-item__tile{border-radius:var(--dynamic-wallet-list-tile-border-radius)}.wallet-list-grid-tabs{border-bottom:1px solid var(--dynamic-base-4);border-top:1px solid var(--dynamic-base-4);display:flex;width:100%}.wallet-list-grid-tabs__button{align-items:center;border-left:1px solid var(--dynamic-base-4);display:flex;flex-basis:50%;gap:.25rem;justify-content:center;outline:none;padding:.5rem .625rem}.wallet-list-grid-tabs__button:first-child{border-left:none}.wallet-list-grid-tabs__button--selected{background-color:var(--dynamic-wallet-list-tile-background)}.wallet-list-grid-tabs__button--text{flex-basis:100%}.wallet-list-grid-tabs__icon--selected{filter:grayscale(100%)}.wallet-list__error-container{margin:0}.wallet-list__search-container{padding:var(--dynamic-search-padding)}.wallet-list__tabs-container{margin-bottom:.5rem}.wallet-list__scroll-container{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);max-height:var(--dynamic-wallet-list-max-height);overflow:auto;padding:var(--dynamic-initial-view-content-padding)}.wallet-list__scroll-container--error{padding:var(--dynamic-layout-content-error-padding)}.wallet-list__scroll-container::-webkit-scrollbar,.wallet-list__scroll-container::-webkit-scrollbar-track{display:none}.wallet-list__scroll-container::-webkit-scrollbar-thumb{display:none}.wallet-list__scroll-container:empty{display:flex}.wallet-list__scroll-container--fixed-height{height:var(--dynamic-wallet-list-max-height)}.wallet-list__search-skeleton{height:2.625rem}.wallet-list__search-skeleton,.wallet-list__tile-skeleton{border-radius:calc(var(--dynamic-border-radius)/2);margin-bottom:.5rem}.wallet-list__tile-skeleton{height:3rem;padding:.75rem}.wallet-list__tiny-footer{background:var(--dynamic-base-1);border-top:.0625rem solid var(--dynamic-base-4);box-shadow:var(--dynamic-shadow-up-1);height:var(--dynamic-border-radius);opacity:1;text-align:center;transition:opacity .15s,visibility .15s;visibility:visible}.wallet-list__tiny-footer--hidden{opacity:0;transition:opacity .15s,visibility .15s;visibility:hidden}.wallet-no-access__container{background:var(--dynamic-base-1)}.wallet-no-access__main{padding:var(--dynamic-modal-padding)}.wallet-no-access__social-info-container{align-items:center;display:flex;justify-content:center;margin-top:1.5rem}.wallet-no-access__waitlist-link{align-items:center;display:flex;gap:8px;justify-content:center}.wallet-no-access__social-icon{margin:auto}.wallet-no-access__image{width:100%}.wallet-no-access__user-info-container{align-items:center;display:flex;flex-direction:column;margin-bottom:1rem}.wallet-no-access__content{text-align:center}.wallet-no-access__content--primary{margin-bottom:.375rem}.wallet-no-access__content--secondary{margin-bottom:1rem}.wallet-no-access__wallet-address{margin-left:.375rem}.wallet-no-access__wallet-address-container{align-items:center;display:flex;justify-content:center}.wallet-no-access__button--primary{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);box-shadow:var(--dynamic-shadow-down-1);margin:0}.wallet-no-access__icon--verified{margin:0 auto 1rem}.wallet-sign-spinner__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.wallet-sign-spinner__copy{color:var(--dynamic-text-secondary);margin:0;text-align:center}.wallet-sign-spinner__button{box-shadow:var(--dynamic-shadow-down-1);margin:.75rem 0 0}.wallet-used-view__container{padding:var(--dynamic-layout-content-padding);text-align:center}.wallet-used-view__icon{display:flex;justify-content:center;margin:0 0 .5rem}.wallet-used-view__icon svg{margin:0 auto}.wallet-used-view__shorten-wallet-address{margin:0 0 1rem}.wallet-used-view__copy{margin:0 0 .75rem}.wallet-used-view__accept-button,.wallet-used-view__footer{margin:0 0 .5rem}.wallet-used-view__logout{background:none;border:none;box-shadow:none;margin:auto}.wallet-used-view__checkbox-label{align-items:center;background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);cursor:pointer;display:flex;gap:.5rem;justify-content:center;margin:1rem auto .5rem;padding:.75rem;text-align:left}.wallet-used-view__checkbox-container{flex-shrink:0}.network-not-supported__content-container{padding:var(--dynamic-layout-content-padding)}.network-not-supported__content-container--error{padding:var(--dynamic-layout-content-error-padding)}.network-not-supported__main-img{width:100%}.network-not-supported__img-container{align-items:center;display:flex;justify-content:center}.network-not-supported__img{border-radius:100%;height:4rem;width:4rem}.network-not-supported__welcome-container{margin:1rem 0;text-align:center}.network-not-supported__welcome-title{margin-bottom:.375rem}.network-not-supported__continue{margin-top:1rem}.network-not-supported__log-out{margin:.75rem auto 0}.network-not-supported__error--not-supported{align-items:center;border-radius:0;display:flex;justify-content:center;margin:0;width:100%}.network-not-supported__network-container{margin-top:.5rem;position:relative}.network-not-supported__network-picker{margin:auto;max-width:-moz-fit-content;max-width:fit-content}.network-not-supported__network-picker-button{position:static;transform:translateX(0)}.email-confirmation-waiting-view{align-items:center;display:flex;flex-direction:column;padding-bottom:1.625rem;text-align:center}.email-confirmation-waiting-view__title{padding-bottom:.375rem}.email-confirmation-waiting-view__email-container{align-items:center;display:flex;gap:.25rem;justify-content:center}.email-confirmation-waiting-view__edit-icon-button{display:inline-flex}.email-confirmation-waiting-view__header-icon{display:flex;justify-content:center;margin-top:-2rem}.email-confirmation-waiting-view__note{max-width:16.25rem;padding-top:1rem;text-align:center}.email-confirmation-waiting-view__powered_by_dynamic_footer{padding-top:1rem;width:100%}.login-with-email-form{display:flex;flex-direction:column;gap:.375rem}.login-with-email-form .input__suffix{top:.6875rem}.login-with-email-form .input__suffix .icon-button{--icon-arrow:var(--dynamic-text-tertiary);--icon-background:var(--dynamic-base-3);transition:all .2s}.login-with-email-form .input__suffix .icon-button path,.login-with-email-form .input__suffix .icon-button rect{transition:all .2s}.login-with-email-form .input__suffix .icon-button--active,.login-with-email-form .input__suffix .icon-button:hover{--icon-arrow:var(--dynamic-text-secondary);--icon-background:var(--dynamic-hover)}.login-with-email-form .input__suffix .icon-button--has-content,.login-with-email-form .input__suffix .icon-button--has-content:hover{--icon-arrow:var(--dynamic-base-2);--icon-background:var(--dynamic-brand-primary-color)}.list-item-button{background:none;box-shadow:none}.list-item-button__trailing{position:relative}.list-item-button__trailing-child{position:absolute;right:0;transition-property:opacity,transform;transition-timing-function:ease-in}.list-item-button__trailing-label{transform:translateY(-50%);transition-duration:.2s}.list-item-button__trailing-icon{transition-duration:.3s}.list-item-button:hover .list-item-button__trailing-label,.list-item-button__trailing-icon{opacity:0;transform:translate(-.625rem,-50%)}.list-item-button:hover .list-item-button__trailing-icon{opacity:1;transform:translateY(-50%)}.login-with-email-wallet-list__skeleton{border-radius:calc(var(--dynamic-border-radius)/2);height:2.625rem;margin-bottom:.5rem}.login-with-email-wallet-list__container{display:flex;flex-direction:column;gap:.375rem}.connect-with-wallet-button{height:2.5rem}.toggleable-section{align-items:stretch;display:flex;flex-direction:column;gap:.75rem}.toggleable-section__toggle-prompt{align-items:center;display:flex;justify-content:space-between}.toggleable-section__toggle-prompt__button{cursor:pointer;margin:-.75rem 0 0 -.75rem;outline:none;padding:.75rem 0 0 .75rem}.toggleable-section__toggle-prompt__button__text{outline:none;transition:all .2s}.toggleable-section__toggle-prompt__button:focus .toggleable-section__toggle-prompt__button__text,.toggleable-section__toggle-prompt__button:focus-visible .toggleable-section__toggle-prompt__button__text,.toggleable-section__toggle-prompt__button:hover .toggleable-section__toggle-prompt__button__text{background-color:var(--dynamic-brand-secondary-color)}.login-with-phone-number-form{display:flex;flex-direction:column;gap:.375rem}.login-with-phone-number-form__fields{align-items:stretch;display:flex;position:relative;width:100%}.login-with-phone-number-form__fields__country-code{align-items:center;background-color:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)*.4) 0 0 calc(var(--dynamic-border-radius)*.4);border-right:none;cursor:pointer;display:flex;padding-left:.75rem;position:relative;transition:all .2s ease;width:6.25rem}.login-with-phone-number-form__fields__country-code--disabled{background-color:var(--dynamic-base-3);pointer-events:none}.login-with-phone-number-form__fields__country-code__flag{margin-right:.5rem}.login-with-phone-number-form__fields__country-code__plus{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.login-with-phone-number-form__fields__country-code__container{align-items:center;display:flex;flex:1;pointer-events:none}.login-with-phone-number-form__fields__country-code__container .login-with-phone-number-form__fields__country-code__container__input{border:none;flex:1;padding:0;width:100%}.login-with-phone-number-form__fields__country-code__chevron{cursor:pointer;position:absolute;right:.5rem;width:1rem}.login-with-phone-number-form__fields__phone-number{align-items:center;display:flex;flex:1;position:relative}.login-with-phone-number-form__fields__phone-number .login-with-phone-number-form__fields__phone-number__input{border-radius:0 calc(var(--dynamic-border-radius)*.4) calc(var(--dynamic-border-radius)*.4) 0;padding-left:.75rem}.login-with-phone-number-form__fields__placeholder{align-self:center;color:var(--dynamic-text-secondary);left:7.0625rem;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.login-with-phone-number-form__fields__inline-submit{align-self:center;position:absolute;right:.75rem}.login-with-phone-number-form__dropdown{width:calc(var(--dynamic-modal-width) - 3rem)}.login-with-phone-number-form__dropdown__items{display:flex;flex-direction:column}.login-with-phone-number-form__dropdown__items__country{align-items:center;cursor:pointer;display:flex;gap:.375rem;padding:.375rem .75rem}.login-with-phone-number-form__dropdown__items__country__flag{width:1.5rem}.login-with-phone-number-form__dropdown__items__country__name{font-size:var(--dynamic-text-size-body-small)}.login-with-phone-number-form__dropdown__items__country__code{color:var(--dynamic-text-secondary);font-size:var(--dynamic-text-size-body-small)}.login-with-phone-number-form__dropdown__items__country:hover{background-color:var(--dynamic-base-4)}.login-with-phone-number-form__dropdown__items__country--selected{background-color:var(--dynamic-base-3)}.login-with-phone-number-form__error-message{color:var(--dynamic-error-1);padding:.5rem 0}.login-with-phone-number-form input::-webkit-inner-spin-button,.login-with-phone-number-form input::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.login-with-phone-number-form input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.login-view__text{padding:.5rem 0}.login-view__error-container{margin:0}.login-view__container{padding:var(--dynamic-initial-view-content-padding)}.login-view__container--error{padding:var(--dynamic-layout-content-error-padding)}@media (pointer:coarse){.login-view__container{padding:.75rem}}.login-view__scroll{align-items:stretch;gap:.375rem;height:100%;max-height:36.25rem;overflow:auto}.login-view__scroll,.login-view__scroll__section{display:flex;flex-direction:column}.login-view__scroll__section--emailAndPhone+.login-view__scroll__section--social{margin-top:1rem}.login-view__scroll::-webkit-scrollbar,.login-view__scroll::-webkit-scrollbar-track{display:none}.login-view__scroll::-webkit-scrollbar-thumb{display:none}.login-view__scroll:empty{display:flex}.login-view__scroll--full-height{height:100vh}.login-view__scroll--email-first{flex-direction:column-reverse}.login-view__scroll__web2{display:flex;flex-direction:column;gap:.75rem}.mobile-wallet-redirect{align-items:stretch;display:flex;flex-direction:column;gap:1.5rem;justify-content:center;padding:var(--dynamic-layout-content-padding)}.mobile-wallet-redirect__icon-with-spinner{align-self:center}.mobile-wallet-redirect__copy-text{align-self:center;max-width:20rem;text-align:center}.mobile-wallet-redirect__alert{text-align:center}.mobile-wallet-redirect__wallet-app{align-items:center;background-color:var(--dynamic-base-2);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex-wrap:wrap;gap:.875rem;justify-content:space-between;padding:.625rem .75rem}.mobile-wallet-redirect__wallet-app__group{align-items:center;display:flex;gap:.5rem}.mobile-wallet-redirect__wallet-app__group__app-store{text-align:right}.captcha-verify-user__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:0 1.5rem 1.5rem;text-align:center}.captcha-verify-user__icon{height:4rem;margin-bottom:1rem;width:4rem}.captcha-verify-user__title{margin-bottom:.375rem}.captcha-verify-user__subtitle{margin-bottom:1rem}.captcha-verify-user__dynamic-logo{margin-top:1rem}.network-not-supported-switch-manual{margin-top:-1.5rem;padding:0 1.5rem 1.5rem}.network-not-supported-switch-manual__img-container{align-items:center;display:flex;justify-content:center;margin-bottom:1rem}.network-not-supported-switch-manual__img{border-radius:100%;height:4rem;width:4rem}.network-not-supported-switch-manual__network-container{position:relative}.network-not-supported-switch-manual__content{text-align:center}.network-not-supported-switch-manual__title{margin:0 0 .375rem}.wallet-group__list{display:flex;flex-direction:column}.wallet-locked-view__error-container{align-items:center;display:flex;justify-content:center}.wallet-locked-view__button-header{margin:.75rem}.wallet-locked-view__button{margin:.75rem auto auto}.wallet-locked-view__icon{margin:auto}.wallet-locked-view__content{padding:0 var(--dynamic-modal-padding) 2.1875rem;text-align:center}@media (pointer:coarse){.wallet-locked-view__content{padding:0 .75rem}}.wallet-locked-view__title{margin-top:.75rem}.wallet-locked-view__log-out{margin:.75rem auto 0}.merge-user-accounts__error{margin-bottom:.75rem;padding:.75rem 1.5rem}.merge-user-accounts__container{display:flex;flex-direction:column;gap:1.5rem;padding:0 1.5rem 1.5rem}@media (pointer:coarse){.merge-user-accounts__container{padding:0 .75rem}}.merge-user-accounts-conflicts__error{margin-bottom:.75rem;padding:.75rem 1.5rem}.merge-user-accounts-conflicts__container{display:flex;flex-direction:column}@media (pointer:coarse){.merge-user-accounts-conflicts__container{padding:0 .75rem}}.merge-user-accounts-conflicts__description{padding:0 1.5rem .75rem}.merge-user-accounts-conflicts__fields{display:flex;flex-direction:column;gap:1rem;max-height:22.5rem;overflow-y:auto;padding:.75rem 1.5rem}.merge-user-accounts-conflicts__fields__item{display:flex;flex-direction:column;gap:.5rem}.merge-user-accounts-conflicts__fields__item__button{padding:.5rem .75rem}.merge-user-accounts-conflicts__buttons{background:var(--dynamic-base-1);box-shadow:0 -8px 48px -8px rgba(109,121,165,.16);display:flex;flex-direction:column;gap:.5rem;padding:.75rem 1.5rem}.merge-user-accounts-with-same-email__container{padding:0 1.5rem 1.5rem}@media (pointer:coarse){.merge-user-accounts-with-same-email__container{padding:0 .75rem}}.merge-user-accounts-with-same-email__accounts{align-items:center;display:flex;justify-content:space-between;margin:-1.5rem auto 1.5rem;max-width:270px;width:100%}.merge-user-accounts-with-same-email__accounts__item{align-items:center;display:flex;flex-direction:column;gap:.625rem;justify-content:center;width:100%}.merge-user-accounts-with-same-email__accounts__item__icon{height:3.5rem;width:3.5rem}.merge-user-accounts-with-same-email__accounts__divider{height:16px;margin-top:-1.5rem;width:16px}.merge-user-accounts-with-same-email__accounts__divider__icon>path{fill:var(--dynamic-text-secondary)}.merge-user-accounts-with-same-email__text{text-align:center}.merge-user-accounts-with-same-email__text__header{color:var(--dynamic-text-primary);margin-bottom:.5rem}.merge-user-accounts-with-same-email__text__body{color:var(--dynamic-text-secondary);margin-bottom:1rem}.merge-user-accounts-with-same-email__text--bold{font-weight:700}.merge-user-accounts-with-same-email__buttons{display:flex;flex-direction:column;gap:.5rem}.merge-user-accounts-with-same-email__buttons__button{width:100%}.wallet-cannot-be-transferred-view__container{padding:var(--dynamic-modal-padding);text-align:center}.wallet-cannot-be-transferred-view__icon{display:flex;justify-content:center;margin:0 0 .5rem}.wallet-cannot-be-transferred-view__icon svg{margin:0 auto}.wallet-cannot-be-transferred-view__shorten-wallet-address{margin:0 0 1rem}.wallet-cannot-be-transferred-view__title{margin:0 0 .375rem}.wallet-cannot-be-transferred-view__copy{margin:0 0 .75rem}.wallet-cannot-be-transferred-view__transfer-alt-wallet-button{margin:0 0 1rem}.wallet-cannot-be-transferred-view__footer{margin:0 0 .5rem}.wallet-cannot-be-transferred-view__cancel{background:none;border:none;box-shadow:none;margin:auto}.user-field-editor__header{align-items:center;display:flex;flex-direction:column;gap:1.25rem;text-align:center}.user-field-editor__header__icon{align-items:center;background-color:var(--dynamic-base-2);border-radius:50%;display:flex;height:4rem;justify-content:center;width:4rem}.user-field-editor__body{align-items:center;display:flex;flex-direction:column;gap:.5rem;margin:0 1.5rem 1.5rem;text-align:center}.user-field-editor__body__subtitle{margin-block:-.375rem .5rem}.user-field-editor__body__form{width:100%}.passkey-intro-view{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.passkey-intro-view__header{display:flex;width:100%}.passkey-intro-view__actions{display:flex;flex-direction:column;gap:.625rem;width:100%}.passkey-intro-view__inline-button{align-items:center;display:inline-flex;gap:.5rem;text-align:left}.passkey-intro-view__inline-button svg path{fill:var(--dynamic-base-2)!important}.passkey-intro-view__log-out{font-size:.875rem;justify-content:center;line-height:20px}.passkey-intro-view__log-out:hover{background-color:transparent}.passkey-intro-view__skip{color:var(--dynamic-text-secondary);font-size:.875rem;justify-content:center;line-height:1rem}.passkey-intro-view__skip:hover{background-color:transparent}.passkey-recovery-view{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.passkey-recovery-view__header{align-items:center;display:flex;justify-content:center;margin-bottom:-5rem;width:12.875rem}.passkey-recovery-view__actions{display:flex;flex-direction:column;gap:.625rem;width:100%}.passkey-recovery-view__input-valid{background:var(--dynamic-success-2)!important;border-color:var(--dynamic-success-1)!important}.passkey-recovery-view__input-valid,.passkey-recovery-view__input-valid~.input__label{color:var(--dynamic-success-1)!important}.passkey-recovery-view__form{display:flex;flex-direction:column;width:100%}.passkey-recovery-view__skip{justify-content:center;margin-top:1.5rem}.passkey-recovery-view__inline-button{align-items:center;display:inline-flex;gap:.5rem;text-align:left}.passkey-recovery-view__inline-button svg path{fill:var(--dynamic-base-2)!important}.passkey-recovery-view__resend-code{align-items:center;display:flex;flex-direction:column}.passkey-recovery-view button.text-button:not(.passkey-recovery-view__skip){color:inherit}.edit-passkeys-widget-view,.edit-passkeys-widget-view__body{display:flex;flex-direction:column}.edit-passkeys-widget-view__body{flex:1;gap:.25rem;justify-content:space-between;margin-top:20px;padding:0 1.5rem 1.5rem}.edit-passkeys-widget-view__icon{height:100px;margin-left:auto;margin-right:auto;margin-top:-40px;width:100px}.edit-passkeys-widget-view__title{margin-left:auto;margin-right:auto;margin-top:20px}.passkey-new-domain-detected{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.passkey-new-domain-detected__header{align-items:center;display:flex;justify-content:center}.passkey-new-domain-detected__actions{display:flex;flex-direction:column;gap:.625rem;width:100%}.passkey-new-domain-detected__inline-button{align-items:center;display:inline-flex;gap:.5rem;text-align:left}.passkey-new-domain-detected__inline-button svg path{fill:var(--dynamic-base-2)!important}.passkey-new-domain-detected__log-out{font-size:.875rem;justify-content:center;line-height:20px}.passkey-new-domain-detected__log-out:hover{background-color:transparent}.embedded-reveal-view{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.embedded-reveal-view__header{align-items:center;display:flex;justify-content:center}.embedded-reveal-view__zerodev-warning{background-color:var(--dynamic-error-1);border-radius:.5rem;margin-bottom:1rem;padding:1.25rem}.embedded-reveal-view__zerodev-warning__title-row{align-items:center;display:flex;margin-bottom:.5rem}.embedded-reveal-view__zerodev-warning__icon{flex-shrink:0;height:1.25rem;margin-right:.5rem;width:1.25rem}.embedded-reveal-view__zerodev-warning__link-button{background:none;border:none;cursor:pointer;display:inline;font:inherit;margin-left:.25rem;padding:0}.embedded-reveal-view__zerodev-warning .typography{color:inherit}.embedded-reveal-view__zerodev-warning .typography.underline{text-decoration:underline}.embedded-reveal-view__coinbase{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);color:var(--dynamic-text-secondary);display:flex;flex:1;flex-direction:column;gap:.625rem;max-height:21.875rem;overflow:auto;overflow-wrap:break-word;padding:.75rem}.embedded-reveal-view__body{display:flex;flex:1;flex-direction:column;gap:.75rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.embedded-reveal-view__body__description{display:flex;justify-content:center;text-align:center}.embedded-reveal-view__body__badge{font-size:.75rem}.embedded-reveal-view__body__card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.625rem;max-height:21.875rem;overflow:auto;padding:.75rem}.embedded-reveal-view__body__card__statement{display:flex;gap:.5rem;letter-spacing:-.15px}.embedded-reveal-view__body__card__acknowledgement{display:flex;gap:.5rem;text-align:left}.embedded-reveal-view__body__card__icon{color:var(--dynamic-text-tertiary);height:1.5rem;min-width:1.5rem;width:1.5rem}.embedded-reveal-view__body__card__skeleton{border-radius:.75rem;height:3.75rem}.embedded-reveal-view__body__confirm_card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.75rem;letter-spacing:-.15px;max-height:21.875rem;overflow:auto;padding:1rem}.embedded-reveal-view__body__button{color:#fff}.embedded-auth-choice{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.embedded-auth-choice__header{align-items:center;display:flex;justify-content:center;width:100%}.embedded-auth-choice__skip-button{margin-top:-.25rem}.action-card{background-color:var(--dynamic-base-2);border-radius:.75rem;box-shadow:var(--dynamic-shadow-down-1);display:flex;padding:1rem;text-align:left;transition:all .2s ease}.action-card:hover{box-shadow:var(--dynamic-button-shadow)}.action-card__icon{height:1.75rem;min-width:1.75rem;width:1.75rem}.action-card__icon,.action-card__icon path{fill:var(--dynamic-text-tertiary)}.action-card__action-icon{margin-left:auto;min-width:1rem;transform:rotate(180deg);width:1rem}.action-card__content{display:flex;flex-direction:column;gap:.25rem;margin-left:8px}.action-card__content__row{align-items:flex-start;display:flex;gap:.375rem}.action-card__content__row__badge--primary{background:var(--dynamic-brand-primary-color);color:var(--dynamic-base-2)}.embedded-auth-choice-cards{display:flex;flex-direction:column;gap:.625rem;width:100%}.auth-choice-info{align-items:flex-start;align-self:stretch;background:var(--default-base-2,#fff);border:1px solid var(--default-base-4,#e7e8ed);border-radius:12px;display:flex;flex-direction:column;gap:12px;justify-content:center;padding:16px 12px 12px}.auth-choice-info__container-item{display:flex;flex-direction:row;gap:.5rem;text-align:start}.select-hardware-wallet-view__container{align-items:stretch;display:flex;flex-direction:column;padding:var(--dynamic-layout-content-padding)}.select-hardware-wallet-view__icon{height:6rem;margin:0 auto .75rem;width:4rem}.select-hardware-wallet-view__text{padding-bottom:1rem;text-align:center}.enter-password-view{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.enter-password-view__body{display:flex;flex:1;flex-direction:column;gap:.75rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.enter-password-view__body__icon{display:flex;justify-content:center;text-align:center}.enter-password-view__body__description{text-align:center}.enter-password-view__password-input__suffix-icon{color:var(--dynamic-text-tertiary);height:22px;margin-top:-4px;width:22px}.wallet-redirect-view__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-modal-padding)}.wallet-redirect-view__container .wallet-redirect-view__title{color:var(--dynamic-text-primary);line-height:2.25rem}.wallet-redirect-view__container .powered-by-dynamic{margin-top:1.5rem}.create-password{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.create-password__body{display:flex;flex:1;flex-direction:column;gap:.5rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.create-password__body__header{align-items:center;display:flex;flex-direction:column;gap:1rem;padding:.5rem 0}.create-password__body__card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.3125rem;max-height:21.875rem;overflow:auto;padding:.75rem}.create-password__progress-bar{display:flex;margin:8px 0}.create-password__progress-bar__element{background-color:var(--default-base-4,#e7e8ed);border-radius:24px;height:4px;margin:0 4px;width:100%}.create-password__progress-bar__element__1{background:var(--dynamic-error-1)}.create-password__progress-bar__element__2{background:var(--dynamic-alert-1)}.create-password__progress-bar__element__3{background:var(--dynamic-success-1)}.create-password__password-input__suffix{align-items:center;display:flex;gap:.375rem;margin-top:-.25rem}.create-password__password-input__suffix__icon{color:var(--dynamic-text-tertiary);height:1.375rem;width:1.375rem}.create-password__password-criteria-icon{height:.9375rem;width:.9375rem}.create-password__password-criteria-list{align-items:center;display:flex;gap:.5rem;margin:.125rem 0}.create-password__password-criteria-list__success{color:var(--dynamic-success-1)}.create-password__password-criteria-list__error{color:var(--dynamic-error-1)}.create-password__log-out{margin:0 auto}.save-password-suffix-icon{color:var(--dynamic-text-tertiary);height:22px;margin-top:-4px;width:22px}.save-password-view{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.save-password-view__header{align-items:center;display:flex;justify-content:center}.save-password-view__body{display:flex;flex:1;flex-direction:column;gap:.75rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.save-password-view__body__icon{display:flex;justify-content:center;text-align:center}.save-password-view__body__badge{background-color:var(--default-alert-2,#faedd9);color:var(--dynamic-alert-1);font-size:.75rem}.save-password-view__body__description{text-align:center}.save-password-view__body__actions{display:flex;gap:8px;justify-content:space-between}.save-password-view__body__card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.625rem;max-height:21.875rem;overflow:auto;padding:.75rem}.save-password-view__body__card__statement{display:flex;gap:.5rem;letter-spacing:-.15px}.save-password-view__body__card__acknowledgement{display:flex;gap:.5rem;text-align:left}.save-password-view__body__confirm-card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.5rem;letter-spacing:-.15px;max-height:21.875rem;overflow:auto;padding:.625rem}.mpc-claim-intro{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.mpc-claim-intro__header{align-items:center;display:flex;justify-content:center}.mpc-claim-intro__body{display:flex;flex:1;flex-direction:column;gap:.75rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.mpc-claim-intro__body__description{display:flex;justify-content:center;text-align:center}.mpc-claim-intro__body__badge{font-size:.75rem}.mpc-claim-intro__body__card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.625rem;max-height:21.875rem;overflow:auto;padding:.75rem}.mpc-claim-intro__body__card__statement{display:flex;gap:.5rem;letter-spacing:-.15px}.mpc-claim-intro__body__card__acknowledgement{display:flex;gap:.5rem;text-align:left}.mpc-claim-intro__body__card__icon{color:var(--dynamic-text-tertiary);height:1.5rem;min-width:1.5rem;width:1.5rem}.mpc-claim-intro__body__card__skeleton{border-radius:.75rem;height:3.75rem}.mpc-claim-intro__body__confirm_card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.75rem;letter-spacing:-.15px;max-height:21.875rem;overflow:auto;padding:1rem}.mpc-claim-intro__body__button{color:#fff}#dyn-turnkey-export-container-id{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;overflow:auto;padding:.75rem}#dyn-turnkey-export-element-id{word-wrap:break-word;max-height:-moz-min-content;max-height:min-content;width:100%}.mfa-choose-device-view__body{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.mfa-choose-device-view__copy{color:var(--dynamic-text-secondary);line-height:1.25rem;text-align:center;width:75%}.mfa-choose-device-view__button{box-shadow:var(--dynamic-shadow-down-1);display:flex;flex-direction:column;gap:.25rem;margin-top:.75rem;text-align:left}.mfa-choose-device-view__button__header{align-items:center;display:flex;justify-content:space-between;width:100%}.mfa-choose-device-view__button__description.mfa-choose-device-view__button__description{font-size:var(--dynamic-text-size-body-small)}.mfa-choose-device-view__icon--rotate{color:var(--dynamic-text-tertiary);height:1rem;justify-content:end;transform:rotate(180deg);width:1rem}.mfa-choose-device-view__logout{margin-top:1.125rem}.mfa-secure-device-view__body{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.mfa-secure-device-view__copy{color:var(--dynamic-text-secondary);line-height:1.25rem;text-align:center;width:75%}.mfa-secure-device-view__button,.mfa-secure-device-view__logout-button{box-shadow:var(--dynamic-shadow-down-1);margin-top:.75rem}.mfa-secure-device-view__loading-spinner{height:394px}.mfa-secure-device-view__qrcode{align-items:center;background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)*.6);display:flex;flex-direction:column;gap:.625rem;margin:1rem 0;padding:.75rem}.mfa-secure-device-view__qrcode .button-container{display:flex;gap:.5rem;justify-content:center;width:100%}.mfa-secure-device-view__qrcode .button-container svg path{fill-opacity:100%}.mfa-secure-device-view__qrcode .button-container .qr-code-button{height:2.375rem}.mfa-display-backup-codes-view__body{align-items:center;display:flex;flex-direction:column;gap:1rem;justify-content:center;padding:var(--dynamic-layout-content-padding);text-align:center}.mfa-display-backup-codes-view__warning{border-radius:var(--dynamic-border-radius);padding:.25rem .5rem}.mfa-display-backup-codes-view__loading-spinner{height:19.5rem}.mfa-display-backup-codes-view__codes{display:flex;flex-wrap:wrap;gap:.5rem;justify-content:center}.mfa-display-backup-codes-view__code{background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-button-primary-border);border-radius:var(--dynamic-border-radius);color:var(--dynamic-text-secondary);padding:.75rem 1.125rem;text-align:center;width:8.75rem}.mfa-display-backup-codes-view__actions{display:flex;gap:.5rem;width:100%}.mfa-display-backup-codes-view__actions button{border-radius:calc(var(--dynamic-button-border-radius)/1.5)}.mfa-display-backup-codes-view__complete{display:flex;flex-direction:column;gap:.5rem;width:100%}.mfa-display-backup-codes-view__acknowledgement{border-radius:calc(var(--dynamic-button-border-radius)/1.5);justify-content:left}.mfa-display-backup-codes-view__acknowledgement .typography{font-size:var(--dynamic-text-size-button-secondary);font-weight:500}.mfa-recovery-view{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.mfa-recovery-view__body{padding:.3125rem,0}.mfa-recovery-view__actions{display:flex;flex-direction:column;gap:.625rem;width:100%}.mfa-recovery-view__get-help{padding:.3125rem,0}.mfa-verification-view__choose-another-method{display:flex;justify-content:center;margin-bottom:1.5rem;width:100%}.mfa-verification-view__choose-another-method-button{color:var(--dynamic-text-link)}.access-blocked__container{align-items:center;background:var(--dynamic-base-1);display:flex;flex-direction:column;padding:.3125rem}.access-blocked__icon{margin-bottom:.3125rem}.access-blocked__content{margin:.9375rem 0;padding:0 .625rem .625rem;text-align:center}.switch-wallet{white-space:pre-line}.switch-wallet__body{background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);margin-top:.625rem;padding:1rem 0;width:100%}.switch-wallet__body__divider{gap:0;padding:.75rem 0}.switch-wallet__body__divider svg{transform:rotate(90deg)}.switch-wallet__body__expected-address__prompt{margin-bottom:.5rem;margin-top:1rem}.switch-wallet__body__expected-address__address{font-size:1.5rem;line-height:1.25rem}.sync-wallet-view .qr-code-wrapper{padding-top:.5rem}.sync-wallet-view .prompt-modal-portal,.sync-wallet-view .prompt-modal-portal__container{position:relative}.mfa-qrcode-help-content__container{color:var(--dynamic-text-secondary);padding:1.5rem}.mfa-qrcode-help-content__vertical-container{background-color:#fff;border-radius:calc(var(--dynamic-border-radius)/2);display:flex;flex-direction:column}.mfa-qrcode-help-content__setup-container{font-family:Arial,sans-serif;margin:0 auto;max-width:400px;width:100%}.mfa-qrcode-help-content__step{align-items:center;background-color:#fff;border-radius:calc(var(--dynamic-border-radius)/2);color:gray;display:flex;flex-direction:row;height:100%;justify-content:flex-start;margin-bottom:.625rem;max-width:100%;padding:1rem}.mfa-qrcode-help-content__step__title{margin-bottom:.3125rem}.mfa-qrcode-help-content__step__number{align-items:center;align-self:flex-start;background-color:#e3ebff;border-radius:50%;color:#4779ff;display:flex;height:1.5rem;justify-content:center;margin-right:.625rem;min-width:1.5rem;width:1.5rem}.mfa-qrcode-help-content__step__nocopy-box{align-items:center;border:.0625rem solid #e0e0e0;border-radius:.3125rem;display:flex;justify-content:space-between;padding:.625rem}.mfa-qrcode-help-content__step__nocopy-text{word-break:break-all}.mfa-qrcode-help-content__copy-button{background-color:transparent;border:none;cursor:pointer}.sandbox-threshold__main{align-items:center;background:var(--dynamic-base-1);display:flex;flex-direction:column;justify-content:center;padding:0 var(--dynamic-modal-padding) 1.125rem}.sandbox-threshold__title{color:var(--dynamic-text-primary);line-height:1.5rem;text-align:center}.sandbox-threshold__description{color:var(--dynamic-text-secondary);line-height:1.25rem;margin-bottom:1.5rem;margin-top:.75rem;text-align:center}.sandbox-threshold__button{box-shadow:var(--dynamic-shadow-down-1)}.global-wallet-confirm .popup-content .wallet-connection-view{align-items:center;display:flex;flex-direction:column;padding:24px}.global-wallet-confirm .popup-content .wallet-connection-view .dapp-icon{height:64px;margin-bottom:16px;width:64px}.global-wallet-confirm .popup-content .wallet-connection-view .connection-title{color:var(--dynamic-text-primary);margin-bottom:16px;text-align:center}.global-wallet-confirm .popup-content .wallet-connection-view .dapp-url{color:var(--dynamic-text-secondary);margin-bottom:24px;text-align:center}.global-wallet-confirm .popup-content .wallet-connection-view .button-group{display:flex;gap:16px;width:100%}.global-wallet-confirm .popup-content .wallet-connection-view .button-group button{cursor:pointer;flex:1}.global-wallet-confirm .popup-content .wallet-connection-view .button-group button.cancel-button{background-color:var(--dynamic-base-2)}.global-wallet-confirm .popup-content .wallet-connection-view .button-group button.connect-global-button{background-color:#3b82f6;color:#fff}.info-card .wrapper{background:var(--dynamic-base-2);border:1px solid var(--dynamic-border-2);border-radius:16px;display:flex;flex-direction:column;gap:.75rem;padding:1.5rem;text-align:left}.inline-icon-text{display:inline}.inline-icon-text svg{display:inline-block;height:1em;margin:0 .25em;vertical-align:middle;width:1em}.nowrap{align-items:center;display:inline-flex;white-space:nowrap}.learn-more-link{align-items:center;display:flex;justify-content:center;padding:4px;pointer-events:auto;text-decoration:none}.learn-more-link svg{cursor:pointer;height:.5rem;margin-left:.25rem;width:.5rem}.malicious-site-view .popup-content .wallet-connection-view{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:24px;text-align:center}.malicious-site-view .popup-content .wallet-connection-view .header{align-items:center;display:flex;justify-content:center;margin-bottom:16px;width:100%}.malicious-site-view .popup-content .wallet-connection-view .header .back-button{background:none;border:none;cursor:pointer;left:24px;padding:8px;position:absolute}.malicious-site-view .popup-content .wallet-connection-view .header h1{color:var(--dynamic-text-primary);margin:0}.malicious-site-view .popup-content .wallet-connection-view .warning-card{align-items:center;border-radius:8px;display:flex;flex-direction:column;justify-content:center;margin-bottom:16px;padding:16px;width:100%}.malicious-site-view .popup-content .wallet-connection-view .warning-card .warning-icon{height:48px;margin-bottom:8px;width:48px}.malicious-site-view .popup-content .wallet-connection-view .connection-title{margin-top:16px}.malicious-site-view .popup-content .wallet-connection-view .site-info{color:var(--dynamic-text-secondary);padding:16px}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container{border-radius:12px;display:flex;flex-direction:column;margin-top:16px;padding:16px;position:relative}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container.definitely-malicious{background-color:var(--dynamic-error-2)}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container.unknown{background-color:#f4d09a}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container .subtitle-header-container{align-items:flex-start;display:flex;margin-bottom:4px}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container .subtitle-header-container .caution-icon{height:24px;left:16px;position:absolute;top:16px;width:24px}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container .subtitle-header-container .subtitle-header{flex:1;margin-bottom:0;margin-left:32px;text-align:left}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container .subtitle{margin-top:0;padding-left:32px;text-align:left}.malicious-site-view .popup-content .wallet-connection-view .button-group{display:flex;gap:16px;margin-top:16px;width:100%}.malicious-site-view .popup-content .wallet-connection-view .button-group button{cursor:pointer;flex:1}.malicious-site-view .popup-content .wallet-connection-view .button-group button.cancel-button{background-color:var(--dynamic-base-2)}.malicious-site-view .popup-content .wallet-connection-view .button-group button.proceed-button{background-color:inherit;box-shadow:none}.sign-message-confirmation__actions{align-items:center;display:flex;flex-direction:row;gap:.375rem;padding-bottom:1rem;width:100%}.sign-message-confirmation__body{align-items:stretch;display:flex;flex-direction:column;padding:.5rem 1.5rem 1.5rem}.sign-message-confirmation__message-container{align-items:center;background-color:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:var(--dynamic-shadow-down-1);margin-bottom:.5rem;margin-top:.75rem;max-height:18.75rem;overflow-y:scroll;padding:.75rem;width:100%}.sign-message-confirmation__secure-wallet{margin-block:.5rem}.sign-message-confirmation__message{overflow-wrap:break-word;padding-top:.75rem}.sign-message-confirmation__title{text-align:center}.sign-message-confirmation__error{padding-top:.75rem}.bridge-welcome-layout{display:flex;flex-direction:column;gap:.75rem}.bridge-welcome-layout__body{display:flex;flex-direction:column;gap:1.5rem;padding:0 1.5rem 1.5rem}.bridge-welcome-layout__message-container{display:flex;flex-direction:column;gap:.25rem;text-align:center}.bridge-welcome-layout__chain-icon-group{align-items:center;display:flex;flex-direction:row-reverse;padding-top:.875rem}.bridge-welcome-layout__chain-icon{background-color:var(--dynamic-base-1);border-radius:50%;height:4rem;margin-left:-1.375rem;outline:.25rem solid var(--dynamic-base-1);overflow:hidden;width:4rem}.bridge-welcome-layout__chain-icon:last-child{margin-left:0}.select-wallet-list-layout{display:flex;flex-direction:column;min-height:320px}.select-wallet-list-layout__wallet-list{display:flex;flex-direction:column;flex-grow:1;gap:var(--dynamic-wallet-list-tile-gap);max-height:var(--dynamic-wallet-list-max-height);overflow-y:auto;padding:.25rem 1.5rem 1.5rem}.connected-wallets-list-layout{display:flex;flex-direction:column}.connected-wallets-list-layout__body{display:flex;flex-direction:column;gap:1rem;padding:.25rem 1.5rem 1.5rem}.connected-wallets-list-layout__body__text{text-align:center}.bridge-next-wallet-to-connect-layout__chain-icon{height:4rem;margin:1rem 1rem 0;width:4rem}.bridge-next-wallet-to-connect-layout__body{align-items:center;display:flex;flex-direction:column;gap:1.5rem;padding:1rem 1.5rem 1.5rem;text-align:center}.account-control__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.account-control__icon{min-width:1rem}.account-control__social_icon{height:1rem;width:1rem}.account-control__container{align-items:center;border-radius:calc(var(--dynamic-border-radius)/3);color:var(--dynamic-text-primary);display:flex;gap:.375rem;min-height:100%;padding:.75rem;z-index:10}.account-control__container--multiwallet-disabled{border-bottom-left-radius:0;border-top-left-radius:0}.account-control__container--active,.account-control__container:hover{background-color:var(--dynamic-hover)}.dynamic-widget-inline-controls{background-color:var(--dynamic-base-1);border-radius:calc(var(--dynamic-border-radius)/3);display:flex;font-size:var(--dynamic-text-size-body-small);max-height:2.5rem;min-width:100%;position:relative}.dynamic-widget-inline-controls__network-picker-main{min-width:60px}.dynamic-widget-inline-controls__account-control{max-width:100%;min-width:max(100%,45px)}.dynamic-widget-inline-controls__account-control .account-control__icon{margin-left:auto}.dynamic-widget-inline-controls__account-control-container{min-width:60px;overflow:hidden}.dynamic-widget-inline-controls__network-picker{background:unset;border-bottom-left-radius:calc(var(--dynamic-border-radius)/3);border-bottom-right-radius:unset;border-top-left-radius:calc(var(--dynamic-border-radius)/3);border-top-right-radius:unset;min-width:100%;padding:.75rem;position:unset;transform:unset}.dynamic-widget-inline-controls__network-picker--active,.dynamic-widget-inline-controls__network-picker:hover{background:var(--dynamic-hover)}.dynamic-widget-inline-controls__network-picker-checkbox{margin:0 0 0 .5rem}.dynamic-widget-inline-controls__network-picker-list{top:2.5rem}@media (pointer:coarse){.dynamic-widget-inline-controls__network-picker-list{top:unset}}.dynamic-widget-dropdown{position:absolute;right:0;top:3.0625rem}.dynamic-widget-dropdown__root{min-width:22.5rem}.dynamic-widget-modal{left:50%;margin:0 auto;position:fixed;top:50%;transform:translate(-50%,-50%);width:min(100%,22.5rem)}@media (pointer:coarse){.dynamic-widget-modal{bottom:0;top:unset;transform:translate(-50%);width:100%}}.dynamic-widget-card{background-color:var(--dynamic-base-1);border:.0625rem solid var(--dynamic-base-4);border-radius:var(--dynamic-border-radius);box-shadow:var(--dynamic-shadow-down-3);height:100%;position:relative;transition:max-height .1s linear}@media (pointer:coarse){.dynamic-widget-card{border-bottom-left-radius:0;border-bottom-right-radius:0}}.dynamic-widget-header{padding:1.5rem 1.5rem 0;position:relative}.dynamic-widget-header__switcher{margin:0 0 1rem}.dynamic-widget-header__passkey-success{margin-inline:-1.5rem}.dynamic-widget-wallet-header{position:relative}.dynamic-widget-wallet-header__email{color:var(--dynamic-text-primary);margin:.5rem 0;text-align:center}.dynamic-widget-wallet-header__icon-container{height:4rem;margin:auto;position:relative;width:4rem}.dynamic-widget-wallet-header__icon-container img,.dynamic-widget-wallet-header__icon-container svg{height:100%;width:100%}.dynamic-widget-wallet-header__wallet-info{align-items:center;display:flex;flex-direction:column;justify-content:center;margin:0 0 1rem}.dynamic-widget-wallet-header__wallet-info .text-button{padding:0}.dynamic-widget-wallet-header__wallet-info__secure-wallet{margin-bottom:0;margin-top:1rem}.dynamic-widget-wallet-header__wallet-address{align-items:center;display:flex;justify-content:center}.dynamic-widget-wallet-header__balance{margin-bottom:.0625rem}.dynamic-widget-wallet-header__seperator{background-color:var(--dynamic-base-4);height:.5rem;margin:0 .5rem;width:.0625rem}.dynamic-widget-wallet-header__status-dot{margin-right:.375rem}.dynamic-widget-wallet-header__ens-name{max-width:12.5rem}.dynamic-widget-wallet-header__network-picker.evm-network-control__container{height:1.5rem}.dynamic-widget-wallet-header__network-picker.non-network-switching-supported-control{height:1.5rem;width:1.5rem}.dynamic-widget-wallet-header__network-picker.network-control-skeleton{bottom:0;height:1.5rem;position:absolute;right:0;width:1.5rem}.dynamic-widget-wallet-header__network-picker .evm-network-control__network-name,.dynamic-widget-wallet-header__network-picker .non-network-switching-supported-control__network-name{display:none}.dynamic-widget-wallet-header__wallet-avatar{border-radius:100%;overflow:hidden}.dynamic-widget-wallet-header__wallet-avatar img{height:4rem;width:4rem}.dynamic-widget-wallet-header__wallet-actions{align-items:center;display:flex;gap:.5rem;justify-content:stretch;margin-top:.5rem;width:100%}.dynamic-widget-wallet-header__wallet-loading{margin-bottom:.5rem;margin-top:.5rem;width:100%}.empty-wallet__container{align-items:center;background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);display:flex;flex-direction:column;gap:.75rem;justify-content:center;padding:.5rem;text-align:center;width:100%}.empty-wallet__container--big{margin:0 0 1rem;padding:.75rem}.empty-wallet__icon{height:1.5rem;width:1.5rem}.empty-wallet__icon--big{height:3rem;width:3rem}.empty-wallet__icon>path{fill:var(--dynamic-text-tertiary)}.empty-wallet__text-container{max-width:10rem}.wallet__container{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)/2);display:flex;flex-direction:row;padding:.75rem}.wallet__container:not(:last-child){border-bottom-left-radius:0;border-bottom-right-radius:0;margin-bottom:-.75rem;padding-bottom:1.5rem}.wallet__container:hover .wallet__menu{opacity:1}.wallet__menu{color:var(--dynamic-text-tertiary);opacity:0;transition:opacity .15s ease-in-out}@media (pointer:coarse){.wallet__menu{opacity:1}}.wallet__row{align-items:center;display:flex;flex:1}.wallet__row__seperator{background-color:var(--dynamic-base-4);height:.5rem;margin:0 .5rem;width:.0625rem}.wallet__icon-container{margin-right:.375rem}.wallet__ens-name{max-width:9.375rem}.wallet__actions{max-height:0;overflow:hidden;transition:max-height .3s ease-in-out}.wallet__actions__expanded{max-height:6.25rem}.wallet__actions__inner{padding-top:.75rem}.dynamic-widget-footer{border-bottom-left-radius:var(--dynamic-border-radius);border-bottom-right-radius:var(--dynamic-border-radius);border-top:.0625rem solid var(--dynamic-base-4);color:var(--dynamic-text-primary);display:flex;gap:.5rem;margin-top:auto;padding:1rem 1.5rem}.dynamic-widget-footer__button:hover:enabled svg{color:var(--dynamic-text-secondary)}.dynamic-widget-footer__button svg{color:var(--dynamic-text-tertiary)}.dynamic-widget-footer__button-align-right{margin-left:auto}@media (pointer:coarse){.dynamic-widget-footer{border-bottom-left-radius:unset;border-bottom-right-radius:unset}}.wallet-icon-with-status__container{position:relative}.wallet-icon-with-status__dot-container{align-items:center;background-color:var(--dynamic-base-1);border-radius:100%;bottom:0;display:flex;height:.75rem;justify-content:center;position:absolute;right:0;width:.75rem}.wallet-icon-with-status__dot-container .dot{background-color:var(--dynamic-error-1);border-radius:100%;bottom:0;height:.5rem;right:0;width:.5rem}.wallet-icon-with-status__dot-container .dot--green{background-color:var(--dynamic-success-1)}.wallet-icon-with-status__dot-container--secondary{bottom:0;height:.625rem;right:0;transform:translate(25%,25%);width:.625rem}.wallet-icon-with-status__dot-container--secondary .dot{height:.375rem;width:.375rem}.wallet-icon-with-network__container{position:relative}.wallet-icon-with-network__network-container{align-items:center;background-color:var(--dynamic-base-1);border-radius:100%;bottom:-.1875rem;display:flex;height:.75rem;justify-content:center;position:absolute;right:-.1875rem;width:.75rem}.dots-menu-dropdown__container{padding:.375rem 0}.dots-menu-dropdown__item{align-items:center;cursor:pointer;display:flex;font-size:var(--dynamic-text-size-body-small);gap:.5rem;padding:.5rem .75rem;width:100%}.dots-menu-dropdown__item .typography{white-space:nowrap}.dots-menu-dropdown__item__end-slot{position:absolute;right:.75rem}.dots-menu-dropdown__item:hover{background-color:var(--dynamic-hover)}.dots-menu-dropdown__item:hover .typography{color:var(--dynamic-text-primary)}@media (pointer:coarse){.dots-menu-dropdown__item{font-size:var(--dynamic-text-size-body-normal)}}.dots-menu-dropdown__item-text{align-items:center;display:flex;gap:.5rem}@keyframes desktop-dropdown-entering-animation{0%{opacity:0;transform:scale(.8) translateY(0)}70%{transform:scale(1) translateY(0)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes desktop-dropdown-exiting-animation{0%{opacity:1;transform:scale(1) translateY(0)}25%{opacity:1}50%{transform:scale(1.01) translateY(0)}to{opacity:0;transform:scale(1.02) translateY(1.875rem)}}@keyframes mobile-dropdown-entering-animation{0%{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}@keyframes mobile-dropdown-exiting-animation{0%{transform:translateY(0)}50%{transform:translateY(0)}to{transform:translateY(200%)}}.dots-menu-wrapper{position:relative}.dots-menu-wrapper__container--entering{animation-fill-mode:both;animation-iteration-count:1;animation-name:desktop-dropdown-entering-animation;animation-timing-function:ease-out}@media (pointer:coarse){.dots-menu-wrapper__container--entering{animation-fill-mode:both;animation-iteration-count:1;animation-name:mobile-dropdown-entering-animation;animation-timing-function:ease-out}}.dots-menu-wrapper__container--exiting{animation-fill-mode:both;animation-iteration-count:1;animation-name:desktop-dropdown-exiting-animation;animation-timing-function:ease-out}@media (pointer:coarse){.dots-menu-wrapper__container--exiting{animation-fill-mode:both;animation-iteration-count:1;animation-name:mobile-dropdown-exiting-animation;animation-timing-function:ease-out}}.dots-menu-wrapper__container{background-color:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/3);box-shadow:0 .5rem .75rem -.375rem rgba(24,39,75,.06),0 .5rem .75rem -.1875rem rgba(24,39,75,.06);margin-top:.5rem;position:absolute;right:0;z-index:2147483647}.dots-menu-wrapper__container__alignment__top{bottom:1.375rem}.dots-menu-wrapper__container__alignment__bottom{top:1.375rem}@media (min-width:768px){.dots-menu-wrapper__container{min-width:9.375rem}}@media (pointer:coarse){.dots-menu-wrapper__container{border:none;border-radius:var(--dynamic-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0;bottom:0;left:calc(50% - 18.75rem);margin:auto;max-width:37.5rem;padding-bottom:2rem;padding-top:0;position:fixed;right:calc(50% - 18.75rem);top:unset;width:100%}}.dots-menu-wrapper__header{display:none;padding:.75rem 1.5rem .25rem}@media (pointer:coarse){.dots-menu-wrapper__header{align-items:center;display:flex;justify-content:space-between}}.dots-menu-wrapper__header__icon{min-height:1.5rem;min-width:1.5rem}.dots-menu-wrapper__backdrop{cursor:default;display:none;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10}@media (pointer:coarse){.dots-menu-wrapper__backdrop{background-color:var(--dynamic-overlay);display:block}}.dynamic-widget-wallets-header{display:flex;flex-direction:row;justify-content:space-between;margin:0 1.5rem}.dynamic-widget-wallets-header__title{margin:0 0 .5rem}.dynamic-widget-wallets-header__add_wallet{display:flex;margin:0 0 .5rem}.dynamic-widget-wallets{margin:0 1.5rem;overflow:auto}.dynamic-widget-wallets__body{display:flex;flex-direction:column;gap:1rem}.dynamic-widget-wallets__body__wallet-list{max-height:13rem}.widget-portal{background-color:var(--dynamic-overlay);top:0;z-index:50}.widget-portal,.widget-portal__container{border-radius:calc(var(--dynamic-border-radius)/1.5);bottom:0;left:0;position:absolute;right:0}.widget-portal__container{background-color:var(--dynamic-base-1);border-top:.0625rem solid var(--dynamic-base-4);padding:1.5rem}@media (pointer:coarse){.widget-portal__container{border-bottom-left-radius:0;border-bottom-right-radius:0}}.widget-portal__container--no-padding{padding:0}.widget-portal__container__header{position:relative}.widget-portal__container__close-button{position:absolute;right:0}.single-wallet-buttons{display:flex;gap:.625rem;padding:0 1.5rem 1.5rem}.single-wallet-buttons--center{align-items:center;display:flex;justify-content:center}.single-wallet-buttons__copied{align-items:center;display:flex;gap:8px}.single-wallet-buttons__copied svg{color:var(--dynamic-success-1)}.email-connector-pending-sign-modal-content{align-items:center;display:flex;flex-direction:column;text-align:center;width:100%}.email-connector-pending-sign-modal-content__body{align-items:center;display:flex;flex-direction:column;gap:.5rem}.active-wallet-information{border-bottom:1px solid var(--dynamic-base-3);display:flex;flex-flow:column;gap:.5rem;padding:.75rem}.active-wallet-information__header{display:flex;gap:.5rem}.active-wallet-information__handle{max-width:80px;overflow:hidden;text-overflow:ellipsis}.active-wallet-information__handle--full-width{max-width:230px;overflow:hidden;text-overflow:ellipsis}.active-wallet-information__dots-menu{color:var(--dynamic-text-tertiary);margin-left:.375rem}.active-wallet-information__dots-menu .icon-with-status__container{margin-bottom:0}.active-wallet-information__dots-menu .icon-with-status__container .status-dot__container{right:-.05rem;top:-.05rem}.active-wallet-information-container{background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2)}.active-wallet-information__details{display:flex;flex:1;gap:.5rem;justify-content:space-between;overflow:hidden}.active-wallet-information__avatar img{height:2rem;min-height:2rem;min-width:2rem;width:2rem}.active-wallet-information__avatar__name-service{align-items:center;border-radius:100%;display:flex;overflow:hidden}.active-wallet-information__addresses-container{display:flex;flex-direction:column;gap:.5rem}.active-wallet-information__addresses-container--centered{justify-content:center}.active-wallet-information__address-container{display:flex}.active-wallet-information__address{align-items:center;display:flex}.active-wallet-information__address-skeleton{width:60px}.active-wallet-information__network-picker{overflow:hidden}.active-wallet-information__network-picker-button{border:1px solid var(--dynamic-base-4);height:100%;position:relative;transform:translateX(0)}.active-wallet-information__network-picker-button:hover{background:var(--dynamic-hover)}.balance-header{justify-content:space-between;padding:1rem .75rem;width:100%}.balance-header,.balance-header__title{align-items:center;display:flex}.balance-header__chevron{rotate:180deg}.balance-header__skeleton{display:table-cell;width:2.5rem}.balance-container{align-items:center;display:flex;justify-content:space-between;padding:1rem .75rem;position:relative}.balance-container__skeleton{display:table-cell;width:2.5rem}.multi-asset-balance-container{align-items:center;position:relative}.multi-asset-balance-container .shadow{border-bottom:1px solid var(--dynamic-base-3)}.multi-asset-balance-container__accordion{overflow-y:auto}.multi-asset-balance-container__accordion--collapsed{max-height:0!important}.multi-asset-balance-container__accordion--expanded{height:100%!important;max-height:11.25rem!important}.prompt-modal{padding:1.5rem}.prompt-modal__header{position:relative;width:100%}.prompt-modal__close-button{position:absolute;right:1rem;top:1rem}.balance-skeleton{display:table-cell;width:1.875rem}.token-balance-item{justify-content:space-between;padding:8px 0;width:100%}.token-balance-item,.token-balance-item__name{align-items:center;display:flex}.token-balance-item__title{max-width:8.4375rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.token-balance-item__icon,.token-balance-item__skeleton-icon{border-radius:100%;height:20px;margin-right:6px;overflow:hidden;width:20px}.token-balance-item__skeleton-icon{background-color:var(--dynamic-base-3)}.token-balance-item__value,.token-balance-item__value__balance{display:flex}.token-balance-list{padding:0 .75rem .75rem}.token-balance-list__empty{align-items:center;display:flex;justify-content:center;padding:.625rem}.token-balance-list__divider{padding:0}.footer-options-switcher__container{background-color:var(--dynamic-base-2);border-bottom-left-radius:var(--dynamic-border-radius);border-bottom-right-radius:var(--dynamic-border-radius);display:flex;justify-content:space-around;margin-top:auto;padding:.75rem 0}.footer-options-switcher__label{font-size:12px;margin-top:.25rem}.footer-options-switcher__tab{align-items:center;color:var(--dynamic-text-secondary);cursor:pointer;display:flex;flex-direction:column;text-align:center}.footer-options-switcher__tab--active{color:var(--dynamic-text-primary)}.dynamic-widget-index-view__email-container{display:flex;flex-direction:column;gap:1rem;text-align:center}.dynamic-widget-index-view__footer{display:flex;justify-content:space-between;width:100%}.dynamic-widget-index-view__user-profile{margin:0 0 1rem;padding:0 1.5rem}.dynamic-widget-index-view__user-profile-title{border-bottom:.0625rem solid var(--dynamic-base-4);margin:0 1.5rem .75rem;padding-bottom:.375rem}.profile-view{flex:1;overflow:auto;padding:0 1.5rem 1.5rem}.profile-view__footer{display:flex;justify-content:space-between;width:100%}.dynamic-widget-edit-profile-view{display:flex;flex:1;flex-direction:column;overflow:hidden}.dynamic-widget-edit-profile-view__fields{flex:1;overflow:auto;padding:0 1.5rem 1rem}.dynamic-widget-edit-profile-view__profile-title{border-bottom:.0625rem solid var(--dynamic-base-4);margin:0 1.5rem .75rem;padding-bottom:.375rem}.send-balance-widget-view{display:flex;flex:1;flex-direction:column;max-width:22.5rem;overflow:auto}.send-balance-widget-view__spinner{align-items:center;display:flex;flex:1;justify-content:center}.passkey-card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);padding:.75rem;width:100%}.passkey-card__body{display:flex;flex-direction:row;justify-content:space-between}.passkey-card__left{align-items:center;display:flex;gap:.5rem}.passkey-card__info{align-items:center;border-bottom:1px solid var(--dynamic-base-4);gap:.5rem;padding-bottom:.5rem}.passkey-card__info__icon{justify-self:start;width:1.5rem}.passkey-card__info__tooltip{display:none}@media (hover:none),(pointer:coarse){.passkey-card__info__tooltip{background-color:#555;border:1px solid;border-radius:6px;color:#fff;display:block;font-size:12px;opacity:0;padding:3px;position:absolute;transition:opacity .5s;visibility:hidden;width:-moz-fit-content;width:fit-content}.passkey-card__info__tooltip--visible{opacity:1;transition:opacity .3s;visibility:visible}}.passkey-card__date{padding-top:.5rem}.manage-passkeys-widget-view,.manage-passkeys-widget-view__body{display:flex;flex:1;flex-direction:column}.manage-passkeys-widget-view__body{gap:1rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.manage-passkeys-widget-view__body__cards{display:flex;flex:1;flex-direction:column;gap:.5rem;max-height:23.75rem;overflow:auto}.manage-passkeys-widget-view__body__cards__skeleton{border-radius:.75rem;height:3.75rem}.manage-passkeys-widget-view__reveal{display:flex;flex:1;flex-direction:column;gap:.5rem}.manage-passkeys-widget-view__reveal-helper-text{color:var(--dynamic-text-secondary);font-size:.9375rem;line-height:1.25rem}.manage-passkeys-widget-view__reveal-button{border-radius:var(--dynamic-button-border-radius);justify-content:space-between}.manage-passkeys-widget-view__reveal-button__start-slot{align-items:center;display:flex;font-size:.9375rem}.manage-passkeys-widget-view__reveal-button__icon{color:var(--dynamic-text-tertiary);height:1.75rem;margin-right:.5rem}.manage-passkeys-widget-view__reveal-button__icon--rotate{color:var(--dynamic-text-tertiary);height:1rem;justify-content:end;transform:rotate(180deg)}.settings-view{display:flex;flex:1;flex-direction:column;overflow:hidden;padding:1.5rem}.settings-view__logout-button-container{bottom:60px;color:var(--dynamic-text-secondary);width:100%}.settings-view__logout-button-container__button{width:100%}.settings-view__header{align-items:center;display:flex;gap:.5rem}.settings-view__body{display:flex;flex-direction:column;gap:1rem;height:100%;margin-bottom:1.5rem;overflow-y:auto}.settings-view__body__section{display:flex;flex-direction:column;gap:.75rem}.settings-view__body__section__title{color:var(--dynamic-text-secondary);font-size:.9375rem;line-height:1.25rem}.settings-view__body__section__title__info-icon{align-items:center;display:flex;gap:5px}.settings-view__body__section__title__info-icon svg path{fill:var(--dynamic-alert-1)}.settings-view__body__section__button{border-radius:var(--dynamic-button-border-radius);justify-content:space-between}.settings-view__body__section__button__start-slot{align-items:center;display:flex;font-size:.9375rem}.settings-view__body__section__button__badge .badge__container.badge__container__secondary{margin-left:.625rem}.settings-view__body__section__button__icon{color:var(--dynamic-text-tertiary);height:1.75rem!important;margin-right:.625rem;width:1.75rem!important}.settings-view__body__section__button__icon.email{color:transparent}.settings-view__body__section__button__icon__stroke{stroke:var(--dynamic-text-tertiary);height:1.75rem;margin-right:.625rem;width:1.75rem}.settings-view__body__section__button__icon-secondary{color:var(--dynamic-text-tertiary);height:1rem;justify-content:end;width:1rem}.settings-view__body__section__button__icon-secondary--success{color:var(--dynamic-success-1);height:1rem;justify-content:end;width:1rem}.settings-view__body__section__button__icon-secondary--rotate{color:var(--dynamic-text-tertiary);height:1rem;justify-content:end;transform:rotate(180deg);width:1rem}.manage-mfa-widget-view{display:flex;flex:1;flex-direction:column;overflow:hidden}.manage-mfa-widget-view__description-container{background:var(--dynamic-base-4)}.manage-mfa-widget-view__description-container__text{margin:.625rem}.manage-mfa-widget-view__add-mfa-button-container{bottom:60px;padding:.625rem 1.5rem 1.5rem;width:100%}.manage-mfa-widget-view__add-mfa-button-container__button{width:100%}.manage-mfa-widget-view__no-devices{align-items:center;display:flex;flex-direction:column;gap:1rem;height:100%;justify-content:center;padding:1rem}.manage-mfa-widget-view__scroll-container{flex:1;overflow-y:auto;padding:.625rem 1.5rem 1.5rem}.manage-mfa-widget-view__list-tile{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;flex-direction:row;gap:.625rem;margin-bottom:.625rem;padding:.625rem;width:auto}.manage-mfa-widget-view__list-tile__icon{height:1.5rem;position:relative;width:1.5rem}.manage-mfa-widget-view__list-tile__details{display:flex;flex-direction:column;flex-grow:1;justify-content:space-between;padding-right:.625rem}.manage-mfa-widget-view__list-tile__details__title{display:flex;flex-direction:row;gap:.25rem}.manage-mfa-widget-view__list-tile__dots-menu{color:var(--dynamic-text-tertiary);margin-left:.375rem}.connect-dapps-view{max-width:400px;padding:1.5rem;position:relative}.connect-dapps-view .header{align-items:center;display:flex;justify-content:space-between;margin-bottom:1rem;position:relative}.connect-dapps-view .header h1{flex-grow:1;margin:0 auto;text-align:center}.connect-dapps-view .header button{background:none;border:none;cursor:pointer;padding:.5rem;position:absolute;top:50%;transform:translateY(-50%)}.connect-dapps-view .header button:first-child{left:0}.connect-dapps-view .header button:last-child{right:0}.connect-dapps-view .scanner-wrapper{aspect-ratio:1/1;height:200px;margin-left:-24px;margin-right:-24px;overflow:hidden;position:relative;width:calc(100% + 48px)}.connect-dapps-view .scanner-wrapper video{height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.connect-dapps-view .scanner-overlay{align-items:center;bottom:0;display:flex;justify-content:center;left:0;pointer-events:none;position:absolute;right:0;top:0}.connect-dapps-view .scanner-frame{border-radius:12px;height:80%;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:60%}.connect-dapps-view .corner{border:4px solid #fff;height:16px;position:absolute;width:16px}.connect-dapps-view .top-left{border-bottom:none;border-right:none;border-top-left-radius:8px;left:-3px;top:-3px}.connect-dapps-view .top-right{border-bottom:none;border-left:none;border-top-right-radius:8px;right:-3px;top:-3px}.connect-dapps-view .bottom-left{border-bottom-left-radius:8px;border-right:none;border-top:none;bottom:-3px;left:-3px}.connect-dapps-view .bottom-right{border-bottom-right-radius:8px;border-left:none;border-top:none;bottom:-3px;right:-3px}.connect-dapps-view .scanner-overlay-content{align-items:center;border-radius:8px;display:flex;flex-direction:column;padding:16px;z-index:1}.connect-dapps-view .scanner-icon{height:20px;margin-bottom:2px;-o-object-fit:contain;object-fit:contain;width:20px}.connect-dapps-view .info-card,.connect-dapps-view .wallet-connect-card{margin-bottom:1rem;position:relative}.connect-dapps-view .wallet-connect-card{align-items:center;display:flex;flex-direction:column}.connect-dapps-view .wallet-connect-card h2{align-self:flex-start;margin-bottom:.5rem;width:100%}.connect-dapps-view .input-group{width:100%}.connect-dapps-view .input-suffix{transform:translateY(-20%)}.connect-dapps-view .banner{border-radius:8px;margin-top:.5rem;padding:6px;text-align:center;width:100%}.connect-dapps-view .banner.success{background-color:var(--dynamic-success-2)}.connect-dapps-view .banner.error{background-color:var(--dynamic-error-2)}.connect-dapps-view .info-card .wrapper{background:var(--dynamic-base-2);border:1px solid var(--dynamic-border-2);border-radius:16px;display:flex;flex-direction:column;padding:1.5rem;text-align:left}.connect-dapps-view .info-card .learn-more-link{align-items:center;display:flex;justify-content:center;padding:4px;pointer-events:auto;text-decoration:none}.connect-dapps-view .info-card .learn-more-link svg{cursor:pointer;height:.5rem;margin-left:.25rem;width:.5rem}.connect-dapps-view .inline-logo-text{align-items:center;display:flex;flex-wrap:nowrap}.connect-dapps-view .inline-logo-text .inline-logo{flex-shrink:0;margin:0 4px}.connected-apps-view{display:flex;flex-direction:column;gap:1rem;padding:1.5rem;position:relative}.connected-apps-view .header{align-items:center;display:flex;justify-content:space-between;padding-bottom:.25rem;position:relative}.connected-apps-view .header .title{flex-grow:1;text-align:center}.connected-apps-view .header .arrow-left-icon{transform:rotate(90deg)}.connected-apps-view .subheader{align-items:center;display:flex;flex-grow:1;justify-content:space-between;padding-bottom:.25rem;position:relative;text-align:center}.connected-apps-view .connected-apps-list{display:flex;flex-direction:column;gap:.75rem;list-style-type:none;margin:0;padding:0}.connected-apps-view .connected-app-item{align-items:center;background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);display:flex;padding:.75rem}.connected-apps-view .connected-app-item .app-icon{border-radius:50%;height:2rem;margin-right:.75rem;width:2rem}.connected-apps-view .connected-app-item .app-info{display:flex;flex:1;flex-direction:column}.connected-apps-view .connected-app-item .app-actions{display:flex;gap:.5rem;margin-left:10px}.connected-apps-view .success-message{align-items:center;background-color:var(--dynamic-success-2);border:1px solid var(--dynamic-border-1);border-radius:.5rem;display:flex;padding:.75rem;text-align:left}.connected-apps-view .success-message svg{color:#30a67b;flex-shrink:0;height:1.5rem;margin-right:.75rem;width:1.5rem}.default-prompt-modal{align-items:center;display:flex;flex-direction:column;text-align:center}.default-prompt-modal__icon-with-spinner{margin:0 auto .75rem}.default-prompt-modal__content{flex-direction:column;width:100%}.default-prompt-modal__button .typography,.default-prompt-modal__content{align-items:center;display:flex;gap:.375rem;justify-content:center}.detected-new-wallet-modal__content{align-items:center;display:flex;flex-direction:column;gap:.75rem;text-align:center}.detected-new-wallet-modal__top-section{align-items:center;display:flex;flex-direction:column;gap:1.125rem;text-align:center}.no-qr-code-not-installed-modal-view{align-items:center;display:flex;flex-direction:column;gap:1rem}.no-qr-code-not-installed-modal-view__links-section{width:100%}.qr-code-modal-view{display:flex;flex-direction:column;gap:.5rem}.qr-code-modal-view__title{text-align:center}.qr-code-modal-view .qrcode__container{height:10.9375rem;width:10.9375rem}.qr-code-modal-view__container{align-items:center;display:flex;justify-content:center}.qr-code-modal-view__wrapper{background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)*3/4);padding:.5rem}.qr-code-modal-view .info-item{margin-bottom:.75rem}.qr-code-modal-view .info-item__text{font-size:var(--dynamic-text-size-body-small)}.qr-code-modal-view .info-item svg path{fill:var(--dynamic-text-secondary)}.qr-code-modal-view .button__container{flex-direction:column}.qr-code-modal-view .button__container,.qr-code-modal-view .button__container span{align-items:center;display:flex;gap:.375rem}.unlink-wallet-popup__container{align-items:center;display:flex;flex-direction:column;width:100%}.unlink-wallet-popup__button,.unlink-wallet-popup__label,.unlink-wallet-popup__title{text-align:center}.unlink-wallet-popup__title{padding-bottom:.5rem}.unlink-wallet-popup__label{padding-bottom:.5rem;padding-top:.5rem}.unlink-wallet-popup__button{margin-top:.5rem}.unlink-wallet-popup__button--shadow{box-shadow:var(--dynamic-shadow-down-1)}.dynamic-widget__container{z-index:2147483646}.fund-wallet__backdrop{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background-color:rgba(0,0,0,.25);inset:0;position:fixed;z-index:2147483645}.fund-wallet__modal-container{align-items:center;display:flex;inset:0;justify-content:center;overflow-y:auto;padding:1rem;position:fixed;z-index:2147483646}@media (pointer:coarse){.fund-wallet__modal-container{padding:0}}.fund-wallet__modal{border-radius:1.5rem;margin:auto;max-width:470px;overflow:hidden;width:100%}@media (pointer:coarse){.fund-wallet__modal{border-bottom-left-radius:0;border-bottom-right-radius:0;margin:initial;margin-top:auto}}.fund-wallet__modal-content{text-align:center}#onramp-iframe{border:none;height:635px;width:100%;z-index:2147483647}.embedded-widget{max-width:100%;width:var(--dynamic-modal-width)}.embedded-widget--background-default,.embedded-widget--background-none{background:none}.dynamic-bridge-user-profile__switcher{margin:0 0 1rem;padding:1.5rem 1.5rem 0}.dynamic-bridge-wallet-card__network{margin:0 0 .5rem}.dynamic-bridge-wallet-card__network,.dynamic-bridge-wallet-card__network-icon,.dynamic-bridge-wallet-card__network-name{display:inline-block;vertical-align:middle}.dynamic-bridge-wallet-card__network-icon{height:1rem;margin-right:.375rem;width:1rem}.dynamic-bridge-widget-empty-card{background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);padding:.75rem;transition:transform .1s linear}.dynamic-bridge-widget-empty-card:active{transform:scale(.98)}.dynamic-bridge-widget-empty-card__icon{display:inline-flex;height:1.75rem;margin-right:.63rem;vertical-align:middle;width:1.75rem}.dynamic-bridge-widget-empty-card__text{overflow:hidden;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.dynamic-bridge-widget-wallets-view{display:flex;flex-direction:column;gap:1rem;padding:1.5rem}.dynamic-bridge-widget-wallets-view__logout-button{margin:0 auto}.dynamic-bridge-widget-wallets-view__unlink-button{color:var(--dynamic-text-secondary);margin:auto 0 0 auto}.footer-buttons-item{align-items:center;background:var(--dynamic-base-2);border:0;border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);cursor:pointer;display:flex;padding:.75rem;transition:all .3s;width:100%}.footer-buttons-item__icon--left{margin-right:.625rem}.footer-buttons-item__icon--left img,.footer-buttons-item__icon--left svg{height:1.25rem;width:1.25rem}.new-to-web3-buttons__container{margin-top:1rem}.new-to-web3-buttons__container button{background:var(--dynamic-brand-primary-color);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);color:#fff;padding:.75rem;width:100%}.walletlist-help-content__container{color:var(--dynamic-text-secondary);padding:1.5rem}.walletlist-help-content__icon{align-items:center;display:flex;height:3.5rem;justify-content:center;margin:0 auto;width:3.5rem}.walletlist-help-content__typography-wrapper{color:var(--dynamic-text-primary);margin:1rem 0;text-align:center}.walletlist-help-content__typography-wrapper .walletlist-help-content__typography--label{margin-top:.375rem}.walletlist-help-content__buttons-wrapper{display:flex;flex-direction:column;gap:.375rem;margin-top:1rem}.walletlist-help-content__buttons-wrapper button{text-align:left;width:100%}.walletlist-help-content__custodial-wallet-area--title{margin:.75rem 0;text-align:center}.footer-more-info-content__wrapper{display:flex;flex-direction:column;gap:.75rem;padding:1.5rem}.footer-more-info-content__item--phantom-ledger{font-size:.6875rem;margin-bottom:.5rem}.footer-more-info-content__item--phantom-ledger p{margin-bottom:.5rem}.footer-more-info-content__item--phantom-ledger p:last-child,.footer-more-info-content__item:last-child{margin-bottom:0}.back-button{rotate:-90deg}.help-header{border-bottom:1px solid var(--dynamic-base-4)}.passkey-info-help-content__container{color:var(--dynamic-text-secondary);padding:1.5rem}.passkey-info-help-content__typography-wrapper{color:var(--dynamic-text-primary);display:flex;flex-direction:column;gap:1rem;text-align:left}.passkey-info-help-content__wrapper{flex:1}.passkey-info-help-content__details{display:flex;flex-direction:row;gap:1rem}.header__skeleton{width:7.5rem}.header__typography{margin:0;text-align:center}.header__typography img,.header__typography svg{display:inline-block}.header__tooltip{background-color:var(--dynamic-text-primary);color:var(--dynamic-base-2);font-size:.75rem}.header__icon svg{height:1.5rem;width:1.5rem}.tos-and-pp__footer{background:var(--dynamic-footer-background);border-top:var(--dynamic-footer-border-top);bottom:0;padding:var(--dynamic-footer-padding);position:relative;width:100%}.default-footer__footer{background:var(--dynamic-base-1);border-top:.0625rem solid var(--dynamic-base-4);box-shadow:var(--dynamic-shadow-up-1);height:var(--dynamic-border-radius);opacity:1;text-align:center;transition:opacity .15s,visibility .15s;visibility:visible;width:100%}.default-footer__footer--hidden{opacity:0;transition:opacity .15s,visibility .15s;visibility:hidden}.wallet-progress-stepper{padding:.5rem 1rem}.dynamic-user-profile-layout{display:flex;flex-direction:column;height:33.125rem;overflow:hidden}.dynamic-user-profile-layout--unset-max-height{height:unset}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{box-shadow:unset!important}.dynamic-modal{display:flex;flex-direction:column-reverse;left:50%;letter-spacing:0;position:absolute}.dynamic-shadow-dom-content{font-family:var(--dynamic-font-family-primary)}';const LegacySafariCssOverrides=()=>jsxRuntimeExports.jsx("link",{rel:"stylesheet",href:"https://app.dynamic.xyz/assets/legacySafari/styles.css"}),isShadowDOMFlagEnabled=()=>{if(isSSR())return!1;const fr="shadowDOM.enabled",br=new URLSearchParams(window.location.search);return br.has(fr)?br.get(fr)==="true":!0},ShadowDOMContext=t$7.createContext({}),useShadowDOMContext=()=>t$7.useContext(ShadowDOMContext),ShadowDOMStyle=()=>jsxRuntimeExports.jsx("style",{children:css_248z$1}),ShadowDOM=({mode:fr="open",id:br,className:wr,children:Er,dataTestId:kr,zIndex:jr})=>{const{shadowDOMEnabled:Br,cssOverrides:Wr}=useInternalDynamicContext(),Gr=isShadowDOMFlagEnabled()&&Br,[Vr,Zr]=reactExports.useState(null),[Jr,Qr]=reactExports.useState(),_n=reactExports.useMemo(()=>Wr&&typeof Wr!="string"?()=>Wr:Wr&&typeof Wr=="string"?()=>jsxRuntimeExports.jsx("style",{children:Wr}):null,[Wr]);reactExports.useLayoutEffect(()=>{if(Vr&&Gr)try{const Cn=Vr.attachShadow({mode:fr});Qr(Cn)}catch{}},[Gr,Vr,fr]);const En=!!Object.keys(css_248z$1).length;return Gr?jsxRuntimeExports.jsx(IsBrowser,{children:jsxRuntimeExports.jsx(ShadowDOMContext.Provider,{value:{shadowRoot:Jr},children:jsxRuntimeExports.jsx("div",{"data-testid":kr,ref:Zr,id:br,className:classNames$1("dynamic-shadow-dom",wr),style:{zIndex:jr},children:Jr&&reactDomExports.createPortal(jsxRuntimeExports.jsxs("div",{className:"dynamic-shadow-dom-content",children:[Er,En&&jsxRuntimeExports.jsx(ShadowDOMStyle,{}),isLegacySafari()&&jsxRuntimeExports.jsx(LegacySafariCssOverrides,{}),_n&&jsxRuntimeExports.jsx(_n,{})]}),Jr)})})}):jsxRuntimeExports.jsx(IsBrowser,{children:jsxRuntimeExports.jsxs("div",{"data-testid":kr,ref:Zr,id:br,className:classNames$1("dynamic-shadow-dom",wr),style:{zIndex:jr},children:[Er,En&&jsxRuntimeExports.jsx(ShadowDOMStyle,{}),isLegacySafari()&&jsxRuntimeExports.jsx(LegacySafariCssOverrides,{}),_n&&jsxRuntimeExports.jsx(_n,{})]})})},useUserDataForm=({onSubmit:fr,onError:br,userProfile:wr,shouldEnforcePolicies:Er=!0,fields:kr})=>{var jr;const{mockedSDK:Br}=useMockContext(),[Wr,qr]=reactExports.useState(!1),{fieldsConfig:Gr}=useFields(),Vr=Er&&((jr=kr.find(En=>En.name==="policiesConsent"))===null||jr===void 0?void 0:jr.enabled),Zr=En=>`${En.charAt(0).toUpperCase()+En.slice(1)} is required`,Jr=reactExports.useMemo(()=>create$5().shape(Object.fromEntries(kr.map(({name:En,required:Cn,type:In,validationType:An,validationRules:jn})=>{let eo=In===KycFieldType.Custom?getValueByKey(customFieldValidationMap,An):getValueByKey(Gr,En).validation;return In===KycFieldType.Custom&&jn&&(An===CustomFieldType.Select||An===CustomFieldType.Text)&&(eo=eo,jn.validOptions?eo=eo.oneOf(jn.validOptions.map(ro=>ro.label),"Select a valid option"):jn.regex&&(eo=eo.matches(new RegExp(jn.regex),"Invalid field format"))),[En,Cn?eo.required(Zr(En)):eo]}))),[kr]),Qr=reactExports.useMemo(()=>Object.fromEntries(kr.map(({name:En,type:Cn,validationRules:In,validationType:An})=>{var jn,eo,ro,to;const _i=wr??{};if(Cn===KycFieldType.Custom){let co="";return An===CustomFieldType.Select&&(In!=null&&In.validOptions)&&(co=(jn=In.validOptions[0].label)!==null&&jn!==void 0?jn:""),[En,(()=>{var so;const no=_i.metadata?getValueByKey(_i.metadata,En):void 0;return Array.isArray(no)?no:(so=no==null?void 0:no.toString())!==null&&so!==void 0?so:co})()]}const io=(eo={country:countryCodes[0].code,policiesConsent:!1,tShirtSize:tShirtSizes[0],team:teamNames[0]}[En])!==null&&eo!==void 0?eo:"";return[En,(to=(ro=getValueByKey(_i,En))===null||ro===void 0?void 0:ro.toString())!==null&&to!==void 0?to:io]}))||{},[kr,wr]),_n=reactExports.useCallback((En,Cn)=>__awaiter$e(void 0,void 0,void 0,function*(){const In={},An={};if(!Br)try{if(!(wr!=null&&wr.environmentId))throw new DynamicError("Invalid environment ID");qr(!0);let jn=En;Object.entries(jn).forEach(([eo,ro])=>{const to=kr.find(_i=>_i.name===eo&&_i.type===KycFieldType.Custom);to&&(In[eo]=ro,delete jn[eo],to.unique&&(An[eo]=ro))}),Object.keys(In).length>0&&(jn.metadata=In),Vr&&(jn=Object.assign(Object.assign({},jn),{policiesConsent:!0}),delete jn.policiesConsentArray),yield fr==null?void 0:fr(jn)}catch(jn){logger$6.error(jn),br==null||br(jn),jn instanceof EmailAlreadyExistsError?Cn.setErrors({email:"Email already exists"}):jn instanceof CustomFieldNotUniqueError?Cn.setFormikState(eo=>Object.assign(Object.assign({},eo),{errors:Object.fromEntries(Object.entries(An).map(([ro])=>[ro,Object.entries(An).length>1?"One or more fields are already tied to another user":`${ro} is already tied to another user`])),touched:Object.fromEntries(Object.entries(An).map(([ro])=>[ro,!0])),values:Object.assign(Object.assign({},Qr),An)})):jn instanceof TooManyEmailVerificationsError?Cn.setErrors({email:"Too many email verification attempts."}):jn instanceof UsernameAlreadyExistsError?Cn.setErrors({username:"Username already exists"}):jn instanceof InvalidPhoneNumberError?Cn.setErrors({phoneNumber:jn.message}):Cn.setErrors({api:"Something went wrong. Please try again."})}finally{qr(!1)}}),[Br,wr==null?void 0:wr.environmentId,Vr,fr,kr,br,Qr]);return{enforcePolicies:Vr,fetch:Wr,formikInitialValues:Qr,formikValidationSchema:Jr,onFormSubmit:_n}},getSupportedCountriesForVerificationFromProjectSettings=fr=>{var br,wr;const Er=getProviderByType((br=fr==null?void 0:fr.providers)!==null&&br!==void 0?br:[],ProviderEnum.Sms);return((wr=Er==null?void 0:Er.enabledCountries)!==null&&wr!==void 0?wr:[]).map(kr=>kr.isoCountryCode.toLowerCase())},defaultCountries=["us","ca"],getDefaultCountriesIfEmpty=fr=>fr.length?fr:defaultCountries,useThrottle=(fr,br)=>{const wr=reactExports.useRef(!1),Er=reactExports.useRef(fr);return Er.current=fr,reactExports.useCallback((...kr)=>{wr.current||(Er.current(...kr),wr.current=!0,setTimeout(()=>wr.current=!1,br))},[br])},modulo=(fr,br)=>(fr%br+br)%br,parseDefaultCountry=({defaultIso2:fr,countries:br,initialPhone:wr})=>{if(wr){const{country:qr}=X$4({countries:br,phone:wr});if(qr)return qr}const Er=br.map(M$3),kr=StorageService.getItem(PHONE_INPUT_DEFAULT_COUNTRY),jr=Er.find(({iso2:qr})=>qr===kr);if(jr)return jr;const Br=Er.find(({iso2:qr})=>qr===fr);if(Br)return Br;const Wr=Er.find(({iso2:qr})=>qr==="us");if(Wr)return Wr;if(Er[0])return Er[0];throw new Error("No country list was provided")},MENU_DISPLAY_THROTTLE=50,COUNTRY_INPUT_SCROLL_DELAY=20,usePhoneInputLogic=({countryInputRef:fr,setCountryDropdownOpen:br,setInvalidNumberMessage:wr,onUpdate:Er,initialPhone:kr,countries:jr,defaultIso2:Br})=>{const Wr=reactExports.useRef(Er);Wr.current=Er;const qr=reactExports.useMemo(()=>parseDefaultCountry({countries:jr,defaultIso2:Br,initialPhone:kr}),[jr,Br,kr]),{inputValue:Gr,phone:Vr,country:Zr,setCountry:Jr,handlePhoneValueChange:Qr,inputRef:_n}=ee$3({countries:jr,defaultCountry:qr.iso2,disableDialCodeAndPrefix:!0,value:kr}),[En,Cn]=reactExports.useState(qr.dialCode),In=reactExports.useMemo(()=>Vr.length===("+"+Zr.dialCode).length?"":Vr,[Zr.dialCode,Vr]);reactExports.useEffect(()=>{var On;(On=Wr.current)===null||On===void 0||On.call(Wr,{country:Zr,formattedPhone:Gr,phone:In})},[Zr.iso2,Gr,In]);const[An,jn]=reactExports.useState(""),eo=reactExports.useMemo(()=>An?isNaN(parseInt(An))?jr.filter(On=>{const{name:Zn,iso2:Nn}=M$3(On);return Zn.toLowerCase().includes(An.toLowerCase())||Nn===An.toLowerCase()||Zr.iso2===Nn}):jr.filter(On=>{const{dialCode:Zn,iso2:Nn}=M$3(On);return Zn.includes(An)||Zr.iso2===Nn}):jr,[jr,Zr.iso2,An]),ro=()=>{jn(""),br(!0)},to=reactExports.useCallback(()=>{br(!1)},[br]),_i=reactExports.useRef(qr),oo=({target:On})=>{const Zn=On.value.slice(0,4);Cn(Zn),jn(Zn);const{country:Nn}=X$4({countries:jr,currentCountryIso2:Zr.iso2,phone:Zn});Nn&&(_i.current=Nn,Jr(Nn.iso2),StorageService.setItem(PHONE_INPUT_DEFAULT_COUNTRY,Nn.iso2),setTimeout(()=>Xr(Nn.iso2),COUNTRY_INPUT_SCROLL_DELAY))},io=()=>{!_i.current||En===_i.current.dialCode||(Jr(_i.current.iso2),StorageService.setItem(PHONE_INPUT_DEFAULT_COUNTRY,_i.current.iso2),Cn(_i.current.dialCode),wr(void 0))},co=reactExports.useCallback(On=>{On.preventDefault();const Zn=eo.findIndex(zn=>M$3(zn).iso2===Zr.iso2),Nn=On.key==="ArrowUp"?-1:1,wn=M$3(eo[modulo(Zn+Nn,eo.length)]);Xr(wn.iso2),Cn(wn.dialCode),Jr(wn.iso2),_i.current=wn,StorageService.setItem(PHONE_INPUT_DEFAULT_COUNTRY,wn.iso2),wr(void 0)},[Zr.iso2,eo,wr,Jr]),so=reactExports.useCallback(()=>{var On;to(),(On=_n.current)===null||On===void 0||On.select()},[to,_n]),no=reactExports.useCallback(On=>{if(On.key==="Tab")return to();if(On.key==="ArrowUp"||On.key==="ArrowDown")return co(On);if(On.key==="Enter")return so(On)},[to,co,so]),Tn=reactExports.useMemo(()=>de$3({charAfterDialCode:"+",dialCode:Zr.dialCode,phone:Vr}).length>0,[Zr.dialCode,Vr]),Hr=reactExports.useRef(null),Xr=On=>{var Zn;const Nn=(Zn=Hr.current)===null||Zn===void 0?void 0:Zn.querySelector("#"+On);Nn==null||Nn.scrollIntoView({behavior:"instant",block:"center",inline:"center"})},Sn=useThrottle(On=>{var Zn;const Nn=!!Hr.current,wn=!!On;Hr.current=On,!(Nn||!wn)&&((Zn=fr.current)===null||Zn===void 0||Zn.select(),Xr(Zr.iso2))},MENU_DISPLAY_THROTTLE),Rn=On=>{Cn(On.dialCode),Jr(On.iso2),StorageService.setItem(PHONE_INPUT_DEFAULT_COUNTRY,On.iso2),_i.current=On,wr(void 0)},Pn=reactExports.useMemo(()=>En.length>3?"var(--dynamic-text-size-body-mini)":En.length>2?"var(--dynamic-text-size-body-small)":"var(--dynamic-text-size-body-normal)",[En.length]);return{closeDropdown:to,countryFontSize:Pn,countryInput:En,currentCountry:Zr,filteredCountries:eo,formattedPhone:Gr,handleCountryInput:oo,handleCountryKeyDown:no,handlePhoneInput:Qr,hasInput:Tn,inputRef:_n,onBlurCountry:io,onFocusCountry:ro,onMenuDisplayToggle:Sn,openDropdown:ro,setCountry:Rn}},PhoneNumberField=({isLoading:fr,disabled:br,error:wr,label:Er,onUpdate:kr,appendRight:jr,setIsFocused:Br,setIsHovered:Wr,initialPhone:qr,onBlur:Gr,countries:Vr})=>{const{t:Zr}=useTranslation(),Jr=reactExports.useRef(null),[Qr,_n]=reactExports.useState(!1),En=reactExports.useRef(null),{defaultPhoneInputIso2:Cn}=useInternalDynamicContext(),[In,An]=reactExports.useState(void 0),{formattedPhone:jn,currentCountry:eo,handleCountryInput:ro,handlePhoneInput:to,hasInput:_i,inputRef:oo,countryInput:io,onBlurCountry:co,filteredCountries:so,openDropdown:no,handleCountryKeyDown:Tn,closeDropdown:Hr,setCountry:Xr,onMenuDisplayToggle:Sn,onFocusCountry:Rn,countryFontSize:Pn}=usePhoneInputLogic({countries:Vr,countryInputRef:Jr,defaultIso2:Cn,initialPhone:qr,onUpdate:kr,setCountryDropdownOpen:_n,setInvalidNumberMessage:An});return jsxRuntimeExports.jsxs("div",{className:"phone-number-field",children:[jsxRuntimeExports.jsxs("div",{className:"phone-number-field__fields",onPointerEnter:()=>Wr==null?void 0:Wr(!0),onPointerLeave:()=>Wr==null?void 0:Wr(!1),onFocus:()=>Br==null?void 0:Br(!0),onBlur:On=>{Br==null||Br(!1),Gr==null||Gr(On)},ref:En,children:[jsxRuntimeExports.jsxs("div",{className:classNames$1("phone-number-field__fields__country-code",{"phone-number-field__fields__country-code--disabled":fr||br}),onClick:no,"data-testid":"country-code",children:[jsxRuntimeExports.jsx(q$4,{iso2:eo.iso2,size:"24px",className:"phone-number-field__fields__country-code__flag"}),jsxRuntimeExports.jsx(Typography,{className:"phone-number-field__fields__country-code__plus",variant:"body_normal",weight:"regular",style:{fontSize:Pn},color:"primary",children:"+"}),jsxRuntimeExports.jsx(Input,{label:"",id:"country_code_field",value:io,onChange:ro,disabled:fr||br,containerClassName:"phone-number-field__fields__country-code__container",className:"phone-number-field__fields__country-code__container__input",onBlur:co,ref:Jr,onKeyDown:Tn,onFocus:Rn,style:{fontSize:Pn},"data-testid":"country-code-input",inputMode:"numeric",autoComplete:"tel-country-code"}),jsxRuntimeExports.jsx(Icon,{className:"phone-number-field__fields__country-code__chevron",children:jsxRuntimeExports.jsx(SvgChevronDown,{})})]}),jsxRuntimeExports.jsx(Input,{label:"",id:"phoneNumber",value:jn,onChange:to,disabled:fr||br,containerClassName:"phone-number-field__fields__phone-number",className:"phone-number-field__fields__phone-number__input",ref:oo,error:!!(In||wr),inputMode:"numeric","data-testid":"phone_number_input",autoComplete:"tel-national"}),!_i&&jsxRuntimeExports.jsx(Typography,{className:"phone-number-field__fields__placeholder",variant:"body_normal",weight:"regular",copykey:"dyn_collect_user_data.fields.phone_number.label",children:Er??Zr("dyn_collect_user_data.fields.phone_number.label")}),jr]}),jsxRuntimeExports.jsx(MenuList,{isOpen:Qr,onClickClose:Hr,popperProps:{anchorOrigin:"bottom-left",anchorRef:En},mobileTitle:"Select country",dropdownClassName:"phone-number-field__dropdown",children:jsxRuntimeExports.jsx("div",{className:"phone-number-field__dropdown__items",ref:Sn,children:so.map(On=>{const Zn=M$3(On),{iso2:Nn,name:wn,dialCode:zn}=Zn,fo=Nn===eo.iso2;return jsxRuntimeExports.jsxs("div",{className:classNames$1("phone-number-field__dropdown__items__country",{"phone-number-field__dropdown__items__country--selected":fo}),onClick:()=>{Xr(Zn),Hr()},id:Nn,children:[jsxRuntimeExports.jsx(q$4,{iso2:Nn,size:"24px"}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",children:wn}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:zn})]},Nn)})})}),!!(In||wr)&&jsxRuntimeExports.jsx(Typography,{variant:"body_mini",className:"phone-number-field__error-message",children:wr??In})]})},UserPhoneField=({onChange:fr,value:br,onBlur:wr,disabled:Er,label:kr,required:jr,error:Br,name:Wr,verify:qr})=>{const{selectedPhoneCountry:Gr}=useFieldsState(),{projectSettings:Vr}=useInternalDynamicContext(),Zr=({country:Qr,phone:_n})=>{Gr.current=Qr,_n!==br&&fr({target:{name:Wr,value:_n}})},Jr=reactExports.useMemo(()=>{const Qr=getSupportedCountriesForVerificationFromProjectSettings(Vr);return getCustomCountries(qr?getDefaultCountriesIfEmpty(Qr):void 0)},[qr,Vr]);return jsxRuntimeExports.jsx(PhoneNumberField,{countries:Jr,initialPhone:br,disabled:Er,onUpdate:Zr,onBlur:wr,label:kr,appendRight:!Er&&!jr?jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",className:"user-phone-field__optional-label",children:"Optional"}):void 0,error:Br})},getDisplayErrorMessage=(fr,br)=>{var wr;if(!br)return;const Er={required:kr=>`${kr} is required`};return((wr=Er[br])===null||wr===void 0?void 0:wr.call(Er,fr))||br},Checkbox=({ariaLabel:fr,checked:br,className:wr="",defaultChecked:Er,disabled:kr,id:jr,name:Br,onChange:Wr,value:qr})=>jsxRuntimeExports.jsxs("div",{className:classNames$1("checkbox__container",wr),children:[jsxRuntimeExports.jsx("input",{type:"checkbox",id:jr,"aria-label":fr,"aria-checked":br,className:"checkbox--hidden",value:qr,checked:br,name:Br,disabled:kr,defaultChecked:Er,onChange:Gr=>!!Wr&&(Wr==null?void 0:Wr(Gr,Gr.currentTarget.value)),"data-testid":"input-checkbox"}),jsxRuntimeExports.jsx("div",{className:"checkbox--visible",children:jsxRuntimeExports.jsx(SvgCheck,{className:"checkbox__icon"})})]});var _path$O,_excluded$X=["title","titleId"];function _extends$X(){return _extends$X=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$X(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgArrowDown=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$X(br,_excluded$X);return reactExports.createElement("svg",_extends$X({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$O||(_path$O=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.862 9.529c.26-.26.682-.26.943 0L12 13.724l4.195-4.195a.667.667 0 1 1 .943.942l-4.667 4.667a.667.667 0 0 1-.942 0l-4.667-4.667a.667.667 0 0 1 0-.942Z",fill:"currentColor"})))};const getDisplayValue=fr=>{if(!fr)return;const{selectedIndex:br}=fr;if(br===void 0)return;const wr=fr.options[br];if(wr.hasAttribute("value"))return wr.text},Select=fr=>{var{children:br,className:wr="",id:Er,label:kr,value:jr,error:Br=!1,selectDataTestId:Wr,message:qr}=fr,Gr=__rest$9(fr,["children","className","id","label","value","error","selectDataTestId","message"]);const Vr=reactExports.useRef(null),[Zr,Jr]=reactExports.useState();return reactExports.useLayoutEffect(()=>{if(!jr)return;const Qr=Vr.current;Jr(getDisplayValue(Qr))},[jr,Jr]),jsxRuntimeExports.jsxs("div",{className:"select__field",children:[jsxRuntimeExports.jsxs("div",{className:classNames$1(wr,"select__container"),children:[jsxRuntimeExports.jsxs("label",{className:classNames$1("select__body",{select__error:Br,select__has_value:!!Zr}),htmlFor:Er,children:[jsxRuntimeExports.jsx("span",{className:"select__value",children:Zr||jsxRuntimeExports.jsx("span",{children:" "})}),jsxRuntimeExports.jsx("span",{className:"select__label",children:kr}),jsxRuntimeExports.jsx("div",{className:"select__control_icon",children:jsxRuntimeExports.jsx(Icon,{size:"medium",children:jsxRuntimeExports.jsx(SvgArrowDown,{})})})]}),jsxRuntimeExports.jsx("select",Object.assign({},Gr,{"data-testid":Wr,ref:Vr,id:Er,value:jr,placeholder:kr,className:"select",children:br}))]}),qr&&jsxRuntimeExports.jsx(Typography,{className:classNames$1("select__message",{select__message__error:Br}),variant:"body_mini",children:qr})]})},renderSelectField=({key:fr,name:br,label:wr,type:Er,options:kr,disabled:jr,dataTestId:Br},{errors:Wr,touched:qr})=>jsxRuntimeExports.jsx(Field$2,{copykey:fr,as:Select,type:Er,id:br,name:br,label:wr,error:!!(Wr[br]&&qr[br]),selectDataTestId:Br,message:qr[br]&&getDisplayErrorMessage(wr,Wr[br]),disabled:jr,children:kr.map(Gr=>typeof Gr=="string"?jsxRuntimeExports.jsx("option",{value:Gr,children:Gr},Gr):jsxRuntimeExports.jsx("option",{value:Gr.value,children:Gr.label},Gr.value))},br),renderCheckboxGroup=(fr,br,wr,Er,kr,jr,Br)=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{role:"group","aria-labelledby":"checkbox-group",className:`user-field__checkbox-container ${kr[br]&&jr[br]?"user-field__checkbox-container--error":""}`,children:(Er==null?void 0:Er.checkboxText)&&jsxRuntimeExports.jsxs("div",{className:"user-field__consent-checkbox",children:[jsxRuntimeExports.jsx(Field$2,{as:Checkbox,id:fr,name:br,type:"checkbox",value:"0",disabled:Br,selectDataTestId:"customFieldCheckbox"},fr),jsxRuntimeExports.jsx("label",{htmlFor:fr,className:"user-field__checkbox-label",children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:Er.checkboxText})})]},fr)},"customConsentGroup"),jr[br]&&getDisplayErrorMessage(wr,kr[br])&&jsxRuntimeExports.jsx(Typography,{variant:"body_mini",className:"user-field__error-message",children:`${br.charAt(0).toUpperCase()+br.slice(1)} is required`})]}),renderPoliciesConsentGroup=(fr,br,wr)=>jsxRuntimeExports.jsx("div",{role:"group","aria-labelledby":"checkbox-group",className:"user-field__checkbox-container",children:br==null?void 0:br.map((Er,kr)=>jsxRuntimeExports.jsxs("div",{className:"user-field__consent-checkbox",children:[jsxRuntimeExports.jsx(Field$2,{copykey:fr,as:Checkbox,id:`policiesConsent_${kr}`,name:"policiesConsentArray",type:"checkbox",value:`${kr}`,disabled:wr},`policiesConsent_${kr}`),jsxRuntimeExports.jsx("label",{htmlFor:`policiesConsent_${kr}`,className:"user-field__checkbox-label",children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:Er})})]},`policiesConsent_${kr}`))},"policiesConsentGroup"),UserField=({fieldData:{validationRules:fr,isCustom:br,key:wr,label:Er,type:kr,autoComplete:jr},fieldSettings:{enabled:Br,name:Wr,required:qr,verify:Gr,label:Vr=Er},errors:Zr,touched:Jr,disabled:Qr,policiesConsentInnerComponentArray:_n})=>{if(br){if(kr===CustomFieldType.Select&&(fr!=null&&fr.validOptions)){const En=fr.validOptions.map(Cn=>Cn.label);return renderSelectField({dataTestId:"customFieldSelect",disabled:Qr,key:wr,label:Vr,name:Wr,options:En,type:kr},{errors:Zr,touched:Jr})}else if(kr===CustomFieldType.Checkbox)return renderCheckboxGroup(wr,Wr,Vr,fr,Zr,Jr,Qr)}switch(Wr){case"tShirtSize":return renderSelectField({dataTestId:"tShirtSizeSelect",disabled:Qr,key:wr,label:Vr,name:Wr,options:tShirtSizes,type:kr},{errors:Zr,touched:Jr});case"team":return renderSelectField({dataTestId:"teamSelect",disabled:Qr,key:wr,label:Vr,name:Wr,options:teamNames,type:kr},{errors:Zr,touched:Jr});case"country":return renderSelectField({dataTestId:"countrySelect",disabled:Qr,key:wr,label:Vr,name:Wr,options:countryCodes.map(En=>({label:En.name,value:En.code})),type:kr},{errors:Zr,touched:Jr});case"policiesConsent":return renderPoliciesConsentGroup(wr,_n,Qr);case"phoneNumber":return jsxRuntimeExports.jsx(Field$2,{name:Wr,as:UserPhoneField,disabled:Qr,label:Vr,required:qr,error:Jr[Wr]&&Zr[Wr]?getDisplayErrorMessage(Vr,Zr[Wr]):void 0,verify:Gr,autoComplete:jr},Wr);default:return jsxRuntimeExports.jsx(Field$2,{copykey:wr,disabled:Qr,as:Input,type:kr,id:Wr,name:Wr,label:Vr,optional:Br&&!qr,error:Zr[Wr]&&Jr[Wr],message:Jr[Wr]&&getDisplayErrorMessage(Vr,Zr[Wr]),autoComplete:jr},Wr)}},getTooltipMessageKeyForField=({enabled:fr,name:br,lockForVerification:wr})=>{if(br==="email"&&!fr)return"dyn_collect_user_data.update_email_tooltip";if(br==="phoneNumber"&&!fr)return"dyn_collect_user_data.update_phone_number_tooltip";if(wr)return"dyn_collect_user_data.lock_editing_multiple_verified_fields"},UserDataFields=({errors:fr,policiesConsentInnerComponentArray:br,fields:wr,touched:Er,currentValues:kr,disableEditingMultipleFieldsWithVerification:jr,initialValues:Br})=>{const{fieldsConfig:Wr}=useFields(),{t:qr}=useTranslation(),Gr=reactExports.useMemo(()=>Br&&kr&&wr?wr.filter(Vr=>Vr.verify&&Br[Vr.name]!==kr[Vr.name]).map(Vr=>Vr.name):[],[kr,wr,Br]);return jsxRuntimeExports.jsx("div",{className:"user-data-fields__fields-column",children:wr==null?void 0:wr.map(Vr=>{const{enabled:Zr,name:Jr,verify:Qr}=Vr,_n=jr&&Qr&&Gr.length>0&&!Gr.includes(Jr),En=!Zr||_n,Cn=getTooltipMessageKeyForField({enabled:Zr,lockForVerification:_n,name:Jr});let In;Vr.type!==KycFieldType.Custom?In=Wr[Jr]:In={isCustom:!0,key:Vr.name,label:Vr.name,type:Vr.validationType,validation:customFieldValidationMap[Vr.validationType],validationRules:Vr.validationRules};const An=jsxRuntimeExports.jsx(UserField,{disabled:!!En,errors:fr,fieldData:In,fieldSettings:Vr,touched:Er,policiesConsentInnerComponentArray:br},In.key);return Cn?jsxRuntimeExports.jsx(Tooltip$2,{content:qr(Cn),className:"user-data-fields__tooltip",copykey:Cn,children:An},In.key+"__tooltip"):An})})},UserProfileForm=({filterFields:fr,formClassName:br,fieldsContainerStyle:wr,onEditProfileSubmit:Er,onEditProfileCancel:kr,options:jr={buttonsAsFooter:!0,cancelText:"Cancel",shouldEnforcePolicies:!1,submitText:"Save"}})=>{const{projectSettings:Br,user:Wr}=useInternalDynamicContext(),qr=reactExports.useMemo(()=>{const _n=getUserProfileFields({customFields:Br==null?void 0:Br.customFields,projectSettingsKyc:Br==null?void 0:Br.kyc,user:Wr});return fr?_n.filter(({name:En})=>fr.includes(En)):_n},[fr,Br==null?void 0:Br.customFields,Br==null?void 0:Br.kyc,Wr]),{fetch:Gr,formikInitialValues:Vr,formikValidationSchema:Zr,onFormSubmit:Jr}=useUserDataForm({fields:qr,onSubmit:Er,shouldEnforcePolicies:jr.shouldEnforcePolicies,userProfile:Wr}),Qr=(_n,En,Cn)=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!jr.hideCancelButton&&jsxRuntimeExports.jsx(TypographyButton,Object.assign({disabled:Gr,expanded:!0,buttonPadding:"medium",buttonVariant:"secondary",type:"button",typographyProps:{variant:"button_secondary"},onClick:kr,dataTestId:"cancel-button"},jr.cancelButtonProps,{children:jr.cancelText})),jsxRuntimeExports.jsx(TypographyButton,Object.assign({buttonClassName:"dynamic-widget-footer__button",disabled:Gr||!En||!Cn,expanded:!0,type:"submit",buttonPadding:"medium",typographyProps:{variant:"button_secondary"},loading:_n,startSlot:jsxRuntimeExports.jsx(SvgCheck,{}),dataTestId:"submit-button"},jr.submitButtonProps,{children:jr.submitText}))]});return jsxRuntimeExports.jsx(Formik,{onSubmit:Jr,initialValues:Vr,validationSchema:Zr,validateOnChange:!0,children:({errors:_n,touched:En,isSubmitting:Cn,isValid:In,dirty:An,values:jn})=>jsxRuntimeExports.jsxs(Form,{className:classNames$1("dynamic-widget-edit-profile-view",br),"data-testid":"editUserProfileForm",children:[jsxRuntimeExports.jsx("div",{className:"dynamic-widget-edit-profile-view__fields",style:wr,children:jsxRuntimeExports.jsx(UserDataFields,{errors:_n,fields:qr,touched:En,currentValues:jn,initialValues:Vr,disableEditingMultipleFieldsWithVerification:!0})}),jr.buttonsAsFooter?jsxRuntimeExports.jsx(DynamicWidgetFooter,{children:Qr(Cn,In,An)}):Qr(Cn,In,An)]})})},splitCamelCase=fr=>fr.replace(/([a-z])([A-Z])/g,"$1 $2"),useAssignDefaultValues=(fr,br)=>{const{appName:wr,user:Er}=useInternalDynamicContext(),kr=wr?`${wr} `:"";if(fr.submitText||(fr.submitText="Update"),br.length!==1)return fr.title||(fr.title="Update your info"),fr.subtitle||(fr.subtitle=`Fill out your info for your ${kr}account`),fr;const[jr]=br,Br=splitCamelCase(jr).toLowerCase(),Wr=Er!=null&&Er[jr]?"Update":"Enter";return fr.title||(fr.title=`${Wr} your ${Br}`),fr.subtitle||(fr.subtitle=`Add your ${Br} to your ${kr}account`),fr};var _path$N,_excluded$W=["title","titleId"];function _extends$W(){return _extends$W=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$W(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgAt=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$W(br,_excluded$W);return reactExports.createElement("svg",_extends$W({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$N||(_path$N=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 4a8 8 0 1 0 4 14.928 1 1 0 1 1 1 1.732A9.96 9.96 0 0 1 11.942 22C6.446 21.968 2 17.503 2 12 2 6.477 6.477 2 12 2s10 4.477 10 10v1.5a3.5 3.5 0 0 1-6.396 1.966A5 5 0 1 1 17 12v1.5a1.5 1.5 0 0 0 3 0V12a8 8 0 0 0-8-8Zm3 8a3 3 0 1 0-6 0 3 3 0 0 0 6 0Z",fill:"currentColor"})))},_path$M,_excluded$V=["title","titleId"];function _extends$V(){return _extends$V=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$V(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgJustifiedText=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$V(br,_excluded$V);return reactExports.createElement("svg",_extends$V({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$M||(_path$M=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6a1 1 0 0 1 1-1h16a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1Zm0 6a1 1 0 0 1 1-1h16a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1Zm0 6a1 1 0 0 1 1-1h7a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1Z",fill:"currentColor"})))},_path$L,_excluded$U=["title","titleId"];function _extends$U(){return _extends$U=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$U(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgLocation=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$U(br,_excluded$U);return reactExports.createElement("svg",_extends$U({width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$L||(_path$L=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22.6 8.067a9.333 9.333 0 0 0-13.2 13.2l5.658 5.657c.52.52 1.363.52 1.884 0l5.658-5.658a9.333 9.333 0 0 0 0-13.199ZM7.515 6.181c4.686-4.686 12.284-4.686 16.97 0 4.687 4.687 4.687 12.285 0 16.97l-4.67 4.67c-.041.042.019-.018-.023.024l-.964.964a3.998 3.998 0 0 1-5.655 0l-5.658-5.657c-4.687-4.686-4.687-12.284 0-16.97ZM16 12a2.667 2.667 0 1 0 0 5.333A2.667 2.667 0 0 0 16 12Zm-5.333 2.667a5.333 5.333 0 1 1 10.666 0 5.333 5.333 0 0 1-10.666 0Z",fill:"currentColor"})))},_path$K,_excluded$T=["title","titleId"];function _extends$T(){return _extends$T=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$T(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgMail=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$T(br,_excluded$T);return reactExports.createElement("svg",_extends$T({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$K||(_path$K=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 7a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V7Zm2 2.869V17a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V9.869l-6.336 4.223a3 3 0 0 1-3.328 0L4 9.87Zm16-2.404-7.445 4.963a1 1 0 0 1-1.11 0L4 7.465V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v.465Z",fill:"currentColor"})))},_path$J,_excluded$S=["title","titleId"];function _extends$S(){return _extends$S=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$S(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgPhone=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$S(br,_excluded$S);return reactExports.createElement("svg",_extends$S({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$J||(_path$J=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 5a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H8a3 3 0 0 1-3-3V5Zm3-1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H8Zm3 14a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1Z",fill:"currentColor"})))},_path$I,_excluded$R=["title","titleId"];function _extends$R(){return _extends$R=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$R(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgSizeLabels=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$R(br,_excluded$R);return reactExports.createElement("svg",_extends$R({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$I||(_path$I=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 5a3 3 0 0 1 3-3h4a3 3 0 0 1 3 2.93 3 3 0 0 1 4.192.05l2.829 2.828A3 3 0 0 1 19.069 12 3 3 0 0 1 22 15v4a3 3 0 0 1-3 3H7a5 5 0 0 1-5-5V5Zm9.071 15H19a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-1.929l-6 6Zm4.878-7.707h.001l1.657-1.657a1 1 0 0 0 0-1.414l-2.829-2.829a1 1 0 0 0-1.414 0L12 7.757v8.486l3.95-3.95ZM9.123 19.12A2.99 2.99 0 0 0 10 17V5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v12a3 3 0 0 0 5.123 2.12ZM6 17a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H7a1 1 0 0 1-1-1Z",fill:"currentColor"})))},_path$H,_excluded$Q=["title","titleId"];function _extends$Q(){return _extends$Q=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$Q(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgUserCard=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$Q(br,_excluded$Q);return reactExports.createElement("svg",_extends$Q({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$H||(_path$H=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 5a3 3 0 1 1 6 0h4a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V8a3 3 0 0 1 3-3h4Zm.17 2H5a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1h-4.17a3.001 3.001 0 0 1-5.66 0ZM12 4a1 1 0 0 0-1 1v1a1 1 0 1 0 2 0V5a1 1 0 0 0-1-1Zm-3 7a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm2.4 2.8a3 3 0 1 0-4.8 0 4.01 4.01 0 0 0-1.372 1.867 1 1 0 1 0 1.885.666 2.001 2.001 0 0 1 3.773 0 1 1 0 1 0 1.886-.666A4.01 4.01 0 0 0 11.4 13.8ZM14 11a1 1 0 0 1 1-1h3a1 1 0 1 1 0 2h-3a1 1 0 0 1-1-1Zm0 4a1 1 0 0 1 1-1h2a1 1 0 1 1 0 2h-2a1 1 0 0 1-1-1Z",fill:"currentColor"})))},_path$G,_excluded$P=["title","titleId"];function _extends$P(){return _extends$P=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$P(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgUser=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$P(br,_excluded$P);return reactExports.createElement("svg",_extends$P({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$G||(_path$G=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 4a8 8 0 0 0-6.598 12.526A14.943 14.943 0 0 1 12 15c2.366 0 4.606.548 6.598 1.526A8 8 0 0 0 12 4Zm7.654 14.436A9.96 9.96 0 0 0 22 12c0-5.523-4.477-10-10-10S2 6.477 2 12a9.96 9.96 0 0 0 2.37 6.464A9.978 9.978 0 0 0 12 22a9.978 9.978 0 0 0 7.654-3.564ZM17.2 18.08A12.954 12.954 0 0 0 12 17c-1.85 0-3.607.386-5.199 1.08A7.968 7.968 0 0 0 12 20c1.985 0 3.8-.723 5.199-1.92ZM12 8a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm-4 2a4 4 0 1 1 8 0 4 4 0 0 1-8 0Z",fill:"currentColor"})))},_path$F,_excluded$O=["title","titleId"];function _extends$O(){return _extends$O=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$O(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgWorkSuitcase=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$O(br,_excluded$O);return reactExports.createElement("svg",_extends$O({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$F||(_path$F=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4a3 3 0 0 1 3-3h4a3 3 0 0 1 3 3v1h2a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V8a3 3 0 0 1 3-3h2V4ZM5 7a1 1 0 0 0-1 1v4.57A22.95 22.95 0 0 0 12 14c2.815 0 5.51-.505 8-1.43V8a1 1 0 0 0-1-1H5Zm10-2H9V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1Zm5 9.692A24.971 24.971 0 0 1 12 16c-2.796 0-5.487-.46-8-1.308V18a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3.308ZM11 12a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1Z",fill:"currentColor"})))};const mapFieldToIcon={alias:SvgUser,country:SvgLocation,email:SvgMail,firstName:SvgUserCard,jobTitle:SvgWorkSuitcase,lastName:SvgUserCard,phoneNumber:SvgPhone,tShirtSize:SvgSizeLabels,username:SvgAt},UserFieldsToIcon=({fields:fr,className:br})=>{const wr=fr.length===1?mapFieldToIcon[fr[0]]:void 0;return wr?jsxRuntimeExports.jsx(wr,{className:br}):jsxRuntimeExports.jsx(SvgJustifiedText,{className:br})},UserFieldEditorView=({onClickClose:fr,onSubmit:br,fields:wr,submitText:Er,subtitle:kr,title:jr})=>{({submitText:Er,subtitle:kr,title:jr}=useAssignDefaultValues({submitText:Er,subtitle:kr,title:jr},wr));const Br=fr&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:fr,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{alignContent:"bottom",trailing:Br,children:jsxRuntimeExports.jsxs("div",{className:"user-field-editor__header",children:[jsxRuntimeExports.jsx("div",{className:"user-field-editor__header__icon",children:jsxRuntimeExports.jsx(Icon,{color:"brand-primary",size:"large",children:jsxRuntimeExports.jsx(UserFieldsToIcon,{fields:wr})})}),jr&&jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",children:jr})]})}),jsxRuntimeExports.jsxs("div",{className:"user-field-editor__body",children:[kr&&jsxRuntimeExports.jsx(Typography,{className:"user-field-editor__body__subtitle",variant:"body_normal",color:"secondary",children:kr}),jsxRuntimeExports.jsx(UserProfileForm,{filterFields:wr,onEditProfileSubmit:br,formClassName:"user-field-editor__body__form",fieldsContainerStyle:{padding:0},options:{buttonsAsFooter:!1,hideCancelButton:!0,submitButtonProps:{buttonPadding:"large",startSlot:void 0,typographyProps:{variant:"button_primary"}},submitText:Er}})]}),jsxRuntimeExports.jsx(PoweredByDynamic,{asFooter:!0})]})},UserFieldEditorModal=fr=>{var{onCancel:br,onSubmit:wr,fields:Er}=fr,kr=__rest$9(fr,["onCancel","onSubmit","fields"]);const[jr,Br]=reactExports.useState(!0),Wr=reactExports.useRef(!1),qr=reactExports.useCallback(()=>{Wr.current||br("User cancelled"),Wr.current=!0},[br]),Gr=Zr=>__awaiter$e(void 0,void 0,void 0,function*(){return wr(Zr).then(()=>{Wr.current=!0,Br(!1)})}),Vr=()=>Br(!1);return jsxRuntimeExports.jsx(Portal$4,{handleClose:Vr,isShown:jr,zIndex:authModalZIndex,withBackdrop:!0,elementId:"dynamic-edit-user-field",transitionEvents:{onUnmount:qr},children:jsxRuntimeExports.jsx(Modal$1,{children:jsxRuntimeExports.jsx(ModalCard,{children:jsxRuntimeExports.jsx(UserFieldEditorView,Object.assign({onSubmit:Gr,onClickClose:Vr,fields:Er},kr))})})})},DynamicBaseWidget=({children:fr,shadowDOMProps:br})=>jsxRuntimeExports.jsx(ShadowDOM,Object.assign({},br,{children:jsxRuntimeExports.jsx(PopperProvider$1,{children:fr})})),UserFieldEditorContext=reactExports.createContext(void 0),UserFieldEditorContextProvider=({children:fr})=>{const{modal:br,open:wr}=useConfirmationModal({elementId:"dynamic-edit-user-field"}),Er=reactExports.useCallback((kr,jr)=>__awaiter$e(void 0,void 0,void 0,function*(){return wr((Br,Wr)=>{const qr=Gr=>jr(Gr).then(Vr=>Br({fields:Gr,updateUserResult:Vr}));return jsxRuntimeExports.jsx(DynamicBaseWidget,{children:jsxRuntimeExports.jsx(UserFieldEditorModal,{fields:kr.fields,submitText:kr.submitText,title:kr.title,subtitle:kr.subtitle,onCancel:Wr,onSubmit:qr})})})}),[wr]);return jsxRuntimeExports.jsxs(UserFieldEditorContext.Provider,{value:{open:Er},children:[br,fr]})},VerticalAccordion=({children:fr,className:br,style:wr})=>jsxRuntimeExports.jsx("div",{className:classNames$1(br,"vertical-accordion__container"),style:wr,children:fr}),isUserLinkingWallet=(fr,br,wr)=>(fr==null?void 0:fr.verifiedCredentials)!==void 0&&br==="multi-wallet-wallet-list"&&!wr,useDynamicLayoutData=({view:fr,authMode:br})=>{const{t:wr}=useTranslation(),{isTurnkeyWalletWithoutAuthenticator:Er}=useIsTurnkeyWallet(),{selectedWalletConnector:kr}=useInternalDynamicContext(),jr=reactExports.useMemo(()=>({"login-with-email-or-wallet-full-wallet-list":{copykey:"dyn_login.helper.all_wallet_list",heading:wr("dyn_login.helper.all_wallet_list")},"login-with-wallet-only":{copykey:"dyn_login.helper.wallet_only",heading:wr("dyn_login.helper.wallet_only")},"passkey-intro":{copykey:"dyn_passkey_intro.helper.title",heading:wr("dyn_passkey_intro.helper.title")},"pending-connect":{copykey:"dyn_login.helper.pending_connect.title",heading:wr("dyn_login.helper.pending_connect.title")},"pending-signature":{copykey:"dyn_login.helper.pending_signature.title",heading:wr("dyn_login.helper.pending_signature.title")},"pending-signature-without-back-button":{copykey:"dyn_login.helper.pending_signature_without_back_button.title",heading:wr("dyn_login.helper.pending_signature_without_back_button.title")},"qr-code":{copykey:"dyn_login.helper.qr_code.title",heading:wr("dyn_login.helper.qr_code.title")},"wallet-connect-mobile-wallets-list":{copykey:"dyn_wallet_conect.mobile.wallet_list.helper",heading:wr("dyn_wallet_conect.mobile.wallet_list.helper")},"wallet-list":{copykey:"dyn_wallet_list.helper",heading:wr("dyn_wallet_list.helper")}}),[wr]),Br=reactExports.useMemo(()=>{var Gr;return{"account-exists":{copykey:"dyn_account_exists.title",heading:wr("dyn_account_exists.title")},"chainalysis-blocked-wallet":{copykey:"dyn_chainalysis_blocked_wallet.title",heading:wr("dyn_chainalysis_blocked_wallet.title")},"farcaster-connect-view":{copykey:"dyn_login.qr_code.title",heading:wr("dyn_login.qr_code.title")},"login-with-email-or-wallet":{copykey:"dyn_login.title.all",heading:wr("dyn_login.title.all")},"login-with-email-or-wallet-full-wallet-list":{copykey:"dyn_login.title.all_wallet_list",heading:wr("dyn_login.title.all_wallet_list")},"login-with-email-verification":{copykey:"dyn_otp_verification.confirm_code",heading:wr("dyn_otp_verification.confirm_code")},"login-with-sms-verification":{copykey:"dyn_otp_verification.confirm_code",heading:wr("dyn_otp_verification.confirm_code")},"login-with-wallet-only":{copykey:"dyn_login.title.wallet_only",heading:wr("dyn_login.title.wallet_only")},"merge-user-accounts":{copykey:"dyn_merge_user_accounts.wallet.title",heading:wr("dyn_merge_user_accounts.wallet.title")},"merge-user-accounts-conflicts":{copykey:"dyn_merge_user_accounts_conflicts.title",heading:wr("dyn_merge_user_accounts_conflicts.title")},"mfa-choose-device":{copykey:"dyn_mfa.choose_device_view.title",heading:wr("dyn_mfa.choose_device_view.title")},"mfa-display-backup-codes":{copykey:"dyn_mfa.display_backup_codes_view.title",heading:wr("dyn_mfa.display_backup_codes_view.title")},"mfa-recovery":{copykey:"dyn_mfa.recovery_view.title",heading:wr("dyn_mfa.recovery_view.title")},"mfa-secure-device":{copykey:"dyn_mfa.secure_device_view.title",heading:wr("dyn_mfa.secure_device_view.title")},"mfa-secure-device-help":{copykey:"dyn_mfa.secure_device_view.helper.title",heading:wr("dyn_mfa.secure_device_view.helper.title")},"mfa-verification":{copykey:"dyn_mfa.otp_verification_view.title",heading:wr("dyn_mfa.otp_verification_view.title")},"mobile-wallet-redirect-view":{copykey:"dyn_login.mobile_wallet_redirect.backup_title",heading:(Gr=kr==null?void 0:kr.name)!==null&&Gr!==void 0?Gr:wr("dyn_login.mobile_wallet_redirect.backup_title")},"multi-wallet-wallet-list":{copykey:br==="connect-only"?"dyn_wallet_list.title.connect":"dyn_wallet_list.title.link",heading:wr(br==="connect-only"?"dyn_wallet_list.title.connect":"dyn_wallet_list.title.link")},"network-not-supported":{copykey:"dyn_network_not_supported.title",heading:wr("dyn_network_not_supported.title")},"passkey-recovery-complete":{copykey:Er?"dyn_passkey_secure_modal.complete.title":"dyn_passkey_recovery.complete.title",heading:wr(Er?"dyn_passkey_secure_modal.complete.title":"dyn_passkey_recovery.complete.title")},"passkey-recovery-start":{copykey:Er?"dyn_passkey_secure_modal.start.title":"dyn_passkey_recovery.start.title",heading:wr(Er?"dyn_passkey_secure_modal.start.title":"dyn_passkey_recovery.start.title")},"pending-connect":{copykey:"dyn_login.connect_wallet.title",heading:wr("dyn_login.connect_wallet.title")},"pending-signature":{copykey:"dyn_login.sign_wallet.title",heading:wr("dyn_login.sign_wallet.title")},"qr-code":{copykey:"dyn_login.qr_code.title",heading:wr("dyn_login.qr_code.title")},"select-hardware-wallet":{copykey:"dyn_select_hardware_wallet.title",heading:wr("dyn_select_hardware_wallet.title")},"select-wallet-in-wallet-group":{copykey:"dyn_login.select_wallet_in_wallet_group.title",heading:wr("dyn_login.select_wallet_in_wallet_group.title")},"verify-email":{copykey:"dyn_otp_verification.confirm_code",heading:wr("dyn_otp_verification.confirm_code")},"verify-sms":{copykey:"dyn_otp_verification.confirm_code",heading:wr("dyn_otp_verification.confirm_code")},"wallet-connect-mobile-wallets-list":{copykey:"dyn_wallet_conect.mobile.wallet_list.title",heading:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(WalletConnectIcon,{style:{height:"1.5rem",width:"1.5rem"}})," ",wr("dyn_wallet_conect.mobile.wallet_list.title")]})},"wallet-group":{copykey:"dyn_login.wallet_group.title",heading:wr("dyn_login.wallet_group.title")},"wallet-list":{copykey:"dyn_wallet_list.title.select",heading:wr("dyn_wallet_list.title.select")},"wallet-sign":{copykey:"dyn_wallet_transfer.sign.title",heading:wr("dyn_wallet_transfer.sign.title")},"wallet-used":{copykey:"dyn_wallet_link.title",heading:wr("dyn_wallet_link.title")}}},[br,Er,kr==null?void 0:kr.name,wr]);if(fr==="no-access")return{headerData:{copykey:"dyn_no_access.title",heading:wr("dyn_no_access.title")}};if(fr==="access-blocked")return{headerData:{copykey:"dyn_access_blocked.title",heading:wr("dyn_access_blocked.title")}};const Wr=jr[fr];return{headerData:Br[fr],helpHeaderData:Wr}},useAuthLayoutChecks=()=>{var fr;const{view:br}=useViewContext(),{user:wr,customPrivacyPolicy:Er,customTermsOfServices:kr,privacyPolicyUrl:jr,termsOfServiceUrl:Br,isBridgeFlow:Wr,authMode:qr,projectSettings:Gr}=useInternalDynamicContext(),{isFooterExpanded:Vr}=useFooterAnimationContext(),{mockedSDK:Zr}=useMockContext(),{helpHeaderData:Jr}=useDynamicLayoutData({authMode:qr,view:br.type}),Qr=br.type!=="wallet-list"&&br.type!=="login-with-email-or-wallet-full-wallet-list"&&br.type!=="multi-wallet-wallet-list"&&br.type!=="login-with-wallet-only"||Vr,_n=br.type==="wallet-connect-mobile-wallets-list"||br.type==="wallet-list"||br.type==="login-with-email-or-wallet-full-wallet-list"||br.type==="login-with-wallet-only",En=!!(Jr&&!(br.type==="qr-code"||br.type==="no-qr-not-installed"||br.type==="wallet-used"||br.type==="chainalysis-blocked-wallet"||br.type==="wallet-sign"||br.type==="collect-user-data"||br.type==="passkey-new-domain-detected"||isUserLinkingWallet(wr,br.type,Zr))),Cn=br.type!=="collect-user-data"&&br.type!=="no-access"&&br.type!=="chainalysis-blocked-wallet"&&br.type!=="wallet-locked-view"&&br.type!=="gate-blocked-wallet"&&br.type!=="email-wallet-otp-verification-view"&&br.type!=="bridge-welcome"&&br.type!=="bridge-summary"&&br.type!=="bridge-next-wallet-connection"&&br.type!=="passkey-intro"&&br.type!=="passkey-new-domain-detected"&&br.type!=="social-redirect-view"&&br.type!=="collect-user-data-login-no-wallet"&&br.type!=="passkey-recovery-bundle"&&br.type!=="passkey-recovery-start"&&br.type!=="embedded-reveal-view"&&br.type!=="embedded-reveal-account-view"&&br.type!=="rename-passkey"&&br.type!=="create-password-view"&&br.type!=="embedded-wallet-auth-choice"&&br.type!=="wallet-claim-intro"&&br.type!=="passkey-recovery-add-email"&&br.type!=="global-wallet-confirm"&&br.type!=="global-wallet-malicious"&&br.type!=="global-wallet-info"&&br.type!=="mfa-choose-device"&&br.type!=="mfa-verification",In=Wr&&(br.type==="wallet-list"||br.type==="qr-code"||br.type==="wallet-connect-mobile-wallets-list"||br.type==="pending-connect"||br.type==="pending-signature"||br.type==="pending-signature-without-back-button"||br.type==="bridge-next-wallet-connection"||br.type==="bridge-summary"),An=!!(!isUserLinkingWallet(wr,br.type,Zr)&&(br.type==="wallet-list"||br.type==="wallet-connect-mobile-wallets-list"||(br.type==="login-with-email-or-wallet"||br.type==="login-with-email-or-wallet-full-wallet-list"||br.type==="login-with-wallet-only"||br.type==="multi-wallet-wallet-list")&&(Br||jr||Er||kr))),jn=!!(!((fr=Gr==null?void 0:Gr.sdk)===null||fr===void 0)&&fr.displayDynamicMessaging)&&(br.type==="login-with-email-or-wallet"||br.type==="login-with-email-or-wallet-full-wallet-list"||br.type==="login-with-wallet-only"||br.type==="login-with-email-verification"||br.type==="login-with-sms-verification"||br.type==="verify-email"||br.type==="verify-sms"||br.type==="pending-connect"||br.type==="wallet-group"||br.type==="select-wallet-in-wallet-group"||br.type==="select-hardware-wallet"||br.type==="pending-signature"||br.type==="qr-code"||br.type==="wallet-used"||br.type==="email-wallet-otp-verification-view"||br.type==="farcaster-connect-view"||br.type==="merge-user-accounts"||br.type==="merge-user-accounts-conflicts"||br.type==="mfa-verification"||br.type==="mfa-display-backup-codes"||br.type==="mfa-recovery"),eo=br.type!=="login-with-email-or-wallet-full-wallet-list"&&br.type!=="login-with-email-verification"&&br.type!=="login-with-sms-verification"&&br.type!=="network-not-supported"&&br.type!=="passkey-recovery-complete"&&br.type!=="passkey-recovery-start"&&br.type!=="passkey-recovery-bundle"&&br.type!=="rename-passkey"&&br.type!=="mobile-wallet-redirect-view"&&br.type!=="qr-code"&&br.type!=="mfa-verification"&&br.type!=="mfa-display-backup-codes"&&br.type!=="mfa-recovery",ro=br.type==="pending-signature"||br.type==="no-qr-not-installed"||br.type==="wallet-connect-mobile-wallets-list"||br.type==="login-with-email-verification"||br.type==="login-with-sms-verification"||br.type==="login-with-email-or-wallet-full-wallet-list"||br.type==="wallet-group"||br.type==="select-wallet-in-wallet-group"||br.type==="select-hardware-wallet"||br.type==="pending-connect"||br.type==="mobile-wallet-redirect-view"||br.type==="account-exists"||br.type==="passkey-intro"||br.type==="qr-code"||br.type==="farcaster-connect-view"||br.type==="mfa-verification"||br.type==="mfa-secure-device-help"||br.type==="merge-user-accounts-conflicts"||br.type==="mfa-recovery"||br.type==="merge-user-accounts-with-same-email"&&!wr;return{displayBorderBelowHeader:Qr,isWalletListTypeView:_n,shouldHideDynamicFooterSeparator:jn&&An,showBackButton:ro,showCloseButton:eo,showConnectedWalletProgress:In,showDefaultFooter:!In&&!jn&&!An,showDynamicFooter:jn,showHeader:Cn,showHelpContent:En,showToSFooter:An}},DynamicFooter=()=>{const{shouldHideDynamicFooterSeparator:fr}=useAuthLayoutChecks();return jsxRuntimeExports.jsx("div",{"data-testid":"dynamic-footer",className:classNames$1("dynamic-footer",{"dynamic-footer__top-border":!fr}),children:jsxRuntimeExports.jsx(PoweredByDynamic,{})})};var _path$E,_excluded$N=["title","titleId"];function _extends$N(){return _extends$N=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$N(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgFooterInfoIcon=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$N(br,_excluded$N);return reactExports.createElement("svg",_extends$N({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$E||(_path$E=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.333a6.667 6.667 0 1 0 0 13.334 6.667 6.667 0 0 0 0-13.334ZM1.667 10a8.333 8.333 0 1 1 16.666 0 8.333 8.333 0 0 1-16.666 0Zm7.5-3.333c0-.46.373-.834.833-.834h.008a.833.833 0 1 1 0 1.667H10a.833.833 0 0 1-.833-.833ZM8.333 10c0-.46.374-.833.834-.833H10c.46 0 .833.373.833.833v2.5a.833.833 0 1 1 0 1.667H10a.833.833 0 0 1-.833-.834v-2.5A.833.833 0 0 1 8.333 10Z",fill:"currentcolor"})))},_path$D,_path2$5,_excluded$M=["title","titleId"];function _extends$M(){return _extends$M=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$M(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgQuestionMark=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$M(br,_excluded$M);return reactExports.createElement("svg",_extends$M({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$D||(_path$D=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.25a6.75 6.75 0 1 0 0 13.5 6.75 6.75 0 0 0 0-13.5ZM1.667 10a8.333 8.333 0 1 1 16.666 0 8.333 8.333 0 0 1-16.666 0Z",fill:"currentcolor"})),_path2$5||(_path2$5=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.31 7.044a1.784 1.784 0 0 0-1.133.192 1.513 1.513 0 0 0-.699.783.792.792 0 0 1-1.481-.559c.26-.689.768-1.257 1.42-1.613a3.368 3.368 0 0 1 2.144-.367 3.262 3.262 0 0 1 1.908 1.023c.496.55.775 1.254.774 1.99 0 1.201-.948 1.972-1.587 2.369a6.63 6.63 0 0 1-1.354.635l-.028.01-.008.002h-.003l-.002.001-.235-.756.235.756A.792.792 0 0 1 9.789 10h.001m0 0 .014-.005.06-.021a5.054 5.054 0 0 0 .956-.456c.575-.357.84-.717.84-1.024 0-.332-.125-.66-.367-.928a1.68 1.68 0 0 0-.982-.521M9.265 13.77c0-.438.355-.792.792-.792h.01a.792.792 0 1 1 0 1.584h-.01a.792.792 0 0 1-.792-.792Z",fill:"currentcolor"})))};const Header=({onClose:fr,heading:br,projectSettings:wr,copykey:Er})=>{const{setError:kr}=useErrorContext(),{isFooterExpanded:jr,setIsFooterExpanded:Br}=useFooterAnimationContext(),{selectedWalletConnector:Wr}=useInternalDynamicContext(),{goToInitialView:qr,view:Gr,setView:Vr}=useViewContext(),{showBackButton:Zr,showCloseButton:Jr,showHelpContent:Qr,isWalletListTypeView:_n,displayBorderBelowHeader:En}=useAuthLayoutChecks(),{setExistentAccountData:Cn}=useAccountExistsContext(),{setSocialProvider:In}=useSocialRedirectContext(),An=reactExports.useCallback(()=>{var to;if(!((to=Gr.events)===null||to===void 0)&&to.onBackClick){Gr.events.onBackClick();return}if(Gr.type==="farcaster-connect-view"&&(In(void 0),dynamicEvents.emit("farcasterConnectCancelled"),dynamicEvents.emit("authFailure",{option:ProviderEnum.Farcaster,provider:ProviderEnum.Farcaster,type:"social"},"user-cancelled")),Cn(void 0),kr(void 0),Gr.type==="no-qr-not-installed"&&(Wr!=null&&Wr.canConnectViaQrCode)){Vr("qr-code");return}qr()},[Gr.type,Gr.events,qr,Cn,kr,In,Vr,Wr]),jn=Jr&&fr&&jsxRuntimeExports.jsx(IconButton,{onClick:fr,type:"button",id:"close-button","data-testid":"close-button",className:"header__icon",children:jsxRuntimeExports.jsx(SvgClose,{})}),eo=Qr&&jsxRuntimeExports.jsx(Tooltip$2,{content:"Need some help?",className:"header__tooltip",children:jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>Br(!jr),"data-testid":"info-button",className:"header__icon",children:_n?jsxRuntimeExports.jsx(SvgQuestionMark,{}):jsxRuntimeExports.jsx(SvgFooterInfoIcon,{})})},"info-button"),ro=[];return Zr&&ro.push(jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:An,"data-testid":"back-button",className:"header__icon",children:jsxRuntimeExports.jsx(SvgArrowLeft,{})},"back-button")),jn&&eo&&ro.push(eo),jsxRuntimeExports.jsx(ModalHeader,{leading:ro,trailing:jn||eo,displayBorder:En,children:(!wr||!!br)&&jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:Er,children:wr?br:jsxRuntimeExports.jsx(Skeleton$1,{className:"header__skeleton"})})})},EmptyHelpContent=()=>jsxRuntimeExports.jsx("div",{"data-testid":"empty-help-content"});var _path$C,_excluded$L=["title","titleId"];function _extends$L(){return _extends$L=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$L(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgFooterEyeIcon=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$L(br,_excluded$L);return reactExports.createElement("svg",_extends$L({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$C||(_path$C=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.995 4.167c3.965 0 6.643 2.655 7.937 4.675a2.14 2.14 0 0 1 0 2.316c-1.294 2.02-3.972 4.675-7.937 4.675-3.965 0-6.643-2.655-7.937-4.675a2.14 2.14 0 0 1 0-2.316c1.294-2.02 3.972-4.675 7.937-4.675ZM14.16 10a4.167 4.167 0 1 1-8.333 0 4.167 4.167 0 0 1 8.333 0Zm-4.12 2.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z",fill:"currentColor"})))},_path$B,_excluded$K=["title","titleId"];function _extends$K(){return _extends$K=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$K(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgFooterGasIcon=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$K(br,_excluded$K);return reactExports.createElement("svg",_extends$K({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$B||(_path$B=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.667 18.333a2 2 0 0 0 2-2V3.667a2 2 0 0 0-2-2h-6a2 2 0 0 0-2 2v12.666a2 2 0 0 0 2 2h6ZM9 8.333a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1H4.333a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1H9ZM17.5 5.833c.46 0 .833.373.833.834v7.5H17.5h.833V14.186a1.201 1.201 0 0 1-.005.113 2.881 2.881 0 0 1-.29 1.075c-.155.307-.398.64-.779.893-.386.258-.863.4-1.426.4-.562 0-1.04-.142-1.425-.4a2.295 2.295 0 0 1-.778-.893 2.878 2.878 0 0 1-.296-1.16v-.045l.833-.001h-.834V9.185l-.001-.011a.2.2 0 0 0-.015-.051v-.001s.005.008.016.02V7.5c.354 0 .675.091.944.27.264.176.43.404.53.607A1.856 1.856 0 0 1 15 9.13v.035c0 .001 0 .002-.832.002H15v4.992l.001.02a1.228 1.228 0 0 0 .12.448c.054.11.123.194.211.253.083.055.23.12.501.12s.419-.065.502-.12a.633.633 0 0 0 .211-.253 1.218 1.218 0 0 0 .12-.468V6.667c0-.46.374-.834.834-.834ZM13.378 9.17h.002-.002Z",fill:"currentColor"})))},_path$A,_excluded$J=["title","titleId"];function _extends$J(){return _extends$J=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$J(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgFooterKeyIcon=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$J(br,_excluded$J);return reactExports.createElement("svg",_extends$J({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$A||(_path$A=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.125 6.875a5 5 0 1 0-10 0 5 5 0 0 0 10 0Zm-2.5 0a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0Zm-7.809 3.243a6.258 6.258 0 0 0 1.671 1.865L7.13 14.34l1.752 1.753-1.768 1.767-1.752-1.752-1.718 1.718-1.768-1.767 5.941-5.942Z",fill:"currentColor"})))};const isHardwareWalletEnabled=fr=>fr!=null&&isHardwareWalletConnector(fr)&&fr.isHardwareWalletEnabled,EnterTileAnimation=({children:fr,className:br="",delay:wr=0,dataTestId:Er})=>{const kr=reactExports.useMemo(()=>({animationDelay:wr}),[wr]);return jsxRuntimeExports.jsx("div",{"data-testid":Er,className:classNames$1(br,"enter-list-tile-animation"),style:kr,children:fr})},InfoItem=({title:fr,content:br,Icon:wr,className:Er="",iconClassName:kr="",textClassName:jr=""})=>jsxRuntimeExports.jsxs("div",{className:classNames$1("info-item__container",Er),children:[jsxRuntimeExports.jsx("div",{className:classNames$1("info-item__icon-container",kr,{"icon-container--has-content":!!br}),children:jsxRuntimeExports.jsx(wr,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{as:"h2",className:jr,variant:"body_normal",color:"primary",weight:"medium",children:fr}),br&&jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"regular",className:"info-item__secondary-text",children:br})]})]}),WalletMoreInfoContent=({variant:fr,wallet:br})=>{const wr={info:[{content:"Signing proves you have access to your wallet. It’s a bit like verifying your email by clicking an email confirmation link in your inbox during signup. This does not approve a transaction.",icon:SvgFooterKeyIcon,title:"Confirms you own your wallet"},{icon:SvgFooterGasIcon,title:"There are no associated gas costs"}]},Er=isHardwareWalletEnabled(br)?{info:[{content:"By connecting a wallet to a website, you are allowing the site to read the contents of your wallet. This does not approve a transaction.",icon:SvgFooterEyeIcon,title:"Allows read access"},{content:jsxRuntimeExports.jsxs("div",{className:"footer-more-info-content__item--phantom-ledger",children:[jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_small",weight:"regular",children:"Ledger does not support message signing functionality, commonly used to log in to sites. Instead, we sign a transaction as a proxy to prove ownership of the wallet."}),jsxRuntimeExports.jsxs(Typography,{as:"p",variant:"body_small",weight:"regular",children:[jsxRuntimeExports.jsx("strong",{children:"Important"}),": we do not"," ",jsxRuntimeExports.jsx("strong",{children:"broadcast"})," this transaction, meaning Ledger based login will still be gasless."]}),jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_small",weight:"regular",children:"Phantom in turn shows that a fee may apply as part of the “transaction”."}),jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_small",weight:"regular",children:"As always, please be cautious of the extensions and websites you use to prevent unwanted transactions from being broadcasted to the network."})]}),icon:SvgFooterGasIcon,title:"Why do I see a fee when using ledger"}]}:wr,kr={connect:{info:[{content:"By connecting a wallet to a website, you are allowing the site to read the contents of your wallet. This does not approve a transaction.",icon:SvgFooterEyeIcon,title:"Allows read access"},{icon:SvgFooterGasIcon,title:"There are no associated gas costs"}]},sign:Er};return jsxRuntimeExports.jsx("div",{className:"footer-more-info-content__wrapper",children:kr[fr].info.map((jr,Br)=>jsxRuntimeExports.jsx("div",{className:"footer-more-info-content__item",children:jsxRuntimeExports.jsx(EnterTileAnimation,{delay:`${.3+Br*.2}s`,children:jsxRuntimeExports.jsx(InfoItem,{Icon:jr.icon,title:jr.title,content:jr.content})})},Br))})};var _path$z,_excluded$I=["title","titleId"];function _extends$I(){return _extends$I=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$I(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgPuzzle=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$I(br,_excluded$I);return reactExports.createElement("svg",_extends$I({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$z||(_path$z=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.044 20.998a.693.693 0 0 0 .7-.68V16.59c.239-2.01 1.121-1.413 2.16-.791 2.51 1.502 4.177-2.45 2.148-3.67-1.592-.956-2.281.689-3.448.52-.45-.067-.763-.54-.862-1.261V8.693a.692.692 0 0 0-.7-.68h-3.21c-2.65-.327-.297-1.755-.297-3.083.001-1.066-.99-1.93-2.214-1.93-1.222 0-2.344.864-2.344 1.93 0 1.253 2.435 2.756-.253 3.083H3.7a.692.692 0 0 0-.699.68v2.688c.205 1.146 1.001 1.411 2.021.655.344-.256.924-.554 1.344-.554 1.094 0 1.982.965 1.982 2.154 0 1.19-.887 2.416-1.982 2.416-.39 0-.755-.123-1.063-.338 0 .091-1.913-1.674-2.302.486v4.121c0 .375.315.68.699.68L10.16 21c.085-.393-.191-.844-.45-1.234-2.04-3.075 5.895-3.382 3.855.095-.1.172-.2.338-.277.5-.098.202-.162.45-.149.639l2.905-.002Z",fill:"currentColor"})))};const parseWalletLinks=fr=>{const br=isIPhone()||isIPad(),wr=detectBrowserName()||"chrome";let Er;switch(wr){case"edge":Er=fr.edge;break;case"firefox":Er=fr.firefox;break;case"chrome":default:Er=fr.chrome;break}const kr=!br&&!!fr.android,jr=(br||!isMobile())&&!!fr.ios;return{canShowAndroidAppButton:kr,canShowIosAppButton:jr,currentDesktopUrl:Er,hasMobileAppUrl:kr||jr,userBrowser:wr}},isWalletGroup=fr=>{var br;return!!(!((br=fr.groupedWallets)===null||br===void 0)&&br.length)},getLastUsedWalletKey=()=>StorageService.getItem(LAST_USED_WALLET),getWalletGroupLabel=(fr,br)=>{const wr=br==null?void 0:br.find(Br=>fr.groupedWallets.some(Wr=>Br.walletKey===Wr.walletConnector.key));if(wr)return{isRecommended:!0,label:wr.label||"Recommended"};const Er=getLastUsedWalletKey();if(fr.groupedWallets.some(Br=>Br.walletConnector.key===Er))return{label:"Last used"};if(fr.groupedWallets.some(Br=>Br.isInstalledOnBrowser))return{label:"Installed"};if(getWalletGroupType(fr)==="multi-chain")return{label:"Multichain"}},getWalletLabel=(fr,br)=>{const wr=getLastUsedWalletKey(),{key:Er}=fr.walletConnector,kr=br==null?void 0:br.find(Br=>Br.walletKey===Er);if(kr)return{isRecommended:!0,label:kr.label||"Recommended"};if(Er===wr)return{label:"Last used"};if(fr.isInstalledOnBrowser)return{label:"Installed"}},getWalletListItemLabel=({wallet:fr,recommendedWallets:br})=>isWalletGroup(fr)?getWalletGroupLabel(fr,br):getWalletLabel(fr,br),isProgrammableNetworkSwitchSupported=fr=>{const wr=new URLSearchParams(window.location.search).get("dev_isProgrammableNetworkSwitchSupported");return wr?wr==="true":fr.switchNetworkOnlyFromWallet!==!0},getWalletConnectorNetworks=fr=>{if(!fr)return[];const br=fr;return br.evmNetworks||br.starknetNetworks||[]},isSupportedNetwork=({walletConnector:fr,network:br})=>{const wr=getWalletConnectorNetworks(fr);return wr.length?wr.some(({chainId:kr})=>String(kr)===String(br)):!0},useHandleWalletsToConnect=()=>{const{bridgeChains:fr,bridgeChainsToConnect:br,setShowAuthFlow:wr,bridgeOnboardingCompleted:Er,setBridgeOnboardingCompleted:kr}=useInternalDynamicContext(),{setView:jr,goToInitialView:Br}=useViewContext();return{handleWalletsToConnect:({walletConnector:qr})=>{if(!fr){wr(!1);return}if(!br){kr(!0),wr(!1);return}if(br.length===0||!qr||!qr.connectedChain)return wr(!1),Br();if(br.filter(Zr=>Zr.chain!==(qr==null?void 0:qr.connectedChain)).length===0){Er?(wr(!1),Br()):(kr(!0),jr("bridge-summary"));return}jr("bridge-next-wallet-connection")}}},specialCareWallets=["bloctoevm","perawallet","metamaskstarknet"],showPendingConnectView=(fr,br)=>__awaiter$e(void 0,void 0,void 0,function*(){const wr=getWalletProvider(fr);if(wr==="walletConnect"||wr==="qrCode")return;specialCareWallets.forEach(kr=>{fr.key===kr&&br("pending-connect")}),(yield fr.getConnectedAccounts()).length===0&&br("pending-connect")}),isConnectOnly=(fr,br)=>br==="connect-only"&&!(fr!==void 0),useConnectAndSign=({shouldUpdateWallets:fr=!0,shouldCallCallback:br=!0}={})=>{const{setView:wr,goToInitialView:Er}=useViewContext(),{engageCaptcha:kr,getCaptchaToken:jr}=useCaptchaContext(),{setErrorMessage:Br}=useErrorContext(),{authMode:Wr,connectWallet:qr,consumeNonce:Gr,displaySiweStatement:Vr,environmentId:Zr,projectSettings:Jr,networkValidationMode:Qr,setIsSingleWalletAccount:_n,user:En,walletUiUtils:Cn}=useInternalDynamicContext(),{handleWalletsToConnect:In}=useHandleWalletsToConnect(),An=useVerifyWallet({consumeNonce:Gr,displaySiweStatement:Vr,environmentId:Zr,projectSettings:Jr,setIsSingleWalletAccount:_n}),jn=(ro,to,_i)=>__awaiter$e(void 0,void 0,void 0,function*(){!isEmailWalletConnector(ro)||isBloctoConnector(ro)?wr("pending-signature"):Cn.disabledConfirmationOnce(),yield An({captchaToken:_i,publicWalletAddress:to,walletConnector:ro})}),eo=ro=>{var to;(ro==null?void 0:ro.code)==="user-cancelled"||logger$6.debug(ro),Br((to=ro==null?void 0:ro.code)===null||to===void 0?void 0:to.toString()),Er()};return ro=>__awaiter$e(void 0,[ro],void 0,function*({walletConnector:to,getAddressOpts:_i=void 0}){var oo;try{yield showPendingConnectView(to,wr),isEmailWalletConnector(to)&&(isEmailOTPWalletConnector(to)?wr("email-wallet-otp-verification-view"):isBloctoConnector(to)||wr("wait-for-email-confirmation-view"));const io=yield qr(to,_i,{applyHandleConnectedWallet:br});if(!(io!=null&&io.address))return;const{address:co}=io,so=yield to.getNetwork();if(!isSupportedNetwork({network:so,walletConnector:to})&&(Qr==="always"||Qr==="sign-in"))return isProgrammableNetworkSwitchSupported(to)?wr("network-not-supported"):wr("network-not-supported-manual");if(isConnectOnly(En,Wr)){StorageService.setItem(LAST_USED_WALLET,to.key),fr&&In({walletConnector:to});return}if(!((oo=Jr==null?void 0:Jr.security.hCaptcha)===null||oo===void 0)&&oo.enabled){kr({authMethod:"wallet",onCaptchaSuccess:Hr=>__awaiter$e(void 0,void 0,void 0,function*(){try{yield jn(to,co,Hr)}catch(Xr){eo(Xr)}})});return}yield jn(to,co,jr())}catch(io){eo(io)}})},walletsRequiringTwoStepAuthentication=["dapper"],requiresTwoStepAuthentication=fr=>isMobile()&&!(fr!=null&&fr.canConnectViaCustodialService)||walletsRequiringTwoStepAuthentication.includes((fr==null?void 0:fr.key)||""),useConnectAndSignSplitSteps=()=>{const{setView:fr,goToInitialView:br}=useViewContext(),{setErrorMessage:wr}=useErrorContext(),{getCaptchaToken:Er,engageCaptcha:kr}=useCaptchaContext(),{connectWallet:jr,consumeNonce:Br,displaySiweStatement:Wr,projectSettings:qr,environmentId:Gr,networkValidationMode:Vr,setIsSingleWalletAccount:Zr,setShowAuthFlow:Jr,user:Qr,authMode:_n}=useInternalDynamicContext(),{handleWalletsToConnect:En}=useHandleWalletsToConnect(),Cn=useVerifyWallet({consumeNonce:Br,displaySiweStatement:Wr,environmentId:Gr,projectSettings:qr,setIsSingleWalletAccount:Zr}),In=eo=>{var ro;logger$6.debug(eo),!(eo instanceof MissingPublicAddressError&&isMobile())&&(br(),wr((ro=eo.code)!==null&&ro!==void 0?ro:eo.toString()))};return{onlyConnectUser:eo=>__awaiter$e(void 0,[eo],void 0,function*({walletConnector:ro,getAddressOpts:to=void 0,shouldShowPendingConnectView:_i=!0}){var oo;_i&&(yield showPendingConnectView(ro,fr));try{if(yield jr(ro,to),isConnectOnly(Qr,_n)){StorageService.setItem(LAST_USED_WALLET,ro.key),En({walletConnector:ro});return}if(!((oo=qr==null?void 0:qr.security.hCaptcha)===null||oo===void 0)&&oo.enabled){kr({authMethod:"wallet",onCaptchaSuccess:io=>__awaiter$e(void 0,void 0,void 0,function*(){Jr(!0),fr("pending-signature")})});return}Jr(!0),fr("pending-signature")}catch(io){In(io);return}}),signAlreadyConnectedUser:eo=>__awaiter$e(void 0,[eo],void 0,function*({walletConnector:ro,getAddressOpts:to=void 0}){try{const _i=yield jr(ro,to);if(!(_i!=null&&_i.address))return;const oo=yield ro.getNetwork();if(!isSupportedNetwork({network:oo,walletConnector:ro})&&(Vr==="always"||Vr==="sign-in"))return isProgrammableNetworkSwitchSupported(ro)?fr("network-not-supported"):fr("network-not-supported-manual");yield Cn({captchaToken:Er(),publicWalletAddress:_i.address,walletConnector:ro})}catch(_i){In(_i);return}})}},isSelectedWalletAlreadyConnected=(fr,br,wr)=>wr?fr.map(({connector:Er})=>Er.key).includes(br.key):!1,useWalletItemActions=()=>{const{setMultiWalletWidgetState:fr,setShowAuthFlow:br,setSelectedWalletConnectorKey:wr,walletConnectorOptions:Er,setQrcodeUri:kr,setDesktopUri:jr,user:Br,linkedWallets:Wr,setLegacyIsVerifying:qr,authMode:Gr}=useInternalDynamicContext(),{mockedSDK:Vr}=useMockContext(),{setError:Zr,setErrorMessage:Jr}=useErrorContext(),{setView:Qr,goToInitialView:_n}=useViewContext(),{onlyConnectUser:En}=useConnectAndSignSplitSteps(),Cn=useConnectAndSign(),In=oo=>__awaiter$e(void 0,void 0,void 0,function*(){logger$6.debug("handleCustodialWalletClick",oo);const io=requiresTwoStepAuthentication(oo);logger$6.logVerboseTroubleshootingMessage("[handleCustodialWalletClick]",{twoStepAuthentication:io}),io?(wr(oo.key),yield En({walletConnector:oo})):(wr(oo.key),fr("awaiting_signature",void 0,"linking_new_wallet")),Qr("pending-signature")}),An=oo=>__awaiter$e(void 0,void 0,void 0,function*(){var io;if(logger$6.debug("handleMobileWalletClick",oo),wr(oo.key),oo.key==="phantom"){const so=StorageService.getItem(PHANTOM_SIGNATURE_STATE);StorageService.setItem(PHANTOM_SIGNATURE_STATE,{loseOriginalAccountOnTransfer:(io=so==null?void 0:so.loseOriginalAccountOnTransfer)!==null&&io!==void 0?io:!1,submittedAtTimestamp:new Date().toString(),verificationType:"awaiting_verification"})}const co=()=>{En({shouldShowPendingConnectView:!1,walletConnector:oo})};Qr("mobile-wallet-redirect-view",{onRetry:co}),co()}),jn=oo=>__awaiter$e(void 0,void 0,void 0,function*(){logger$6.debug("handleInstalledExtensionClick",oo),wr(oo.key),Gr==="connect-only"?(Qr("pending-connect"),En({walletConnector:oo})):fr("awaiting_signature",void 0,"linking_new_wallet")}),eo=oo=>__awaiter$e(void 0,void 0,void 0,function*(){logger$6.debug("handleUninstalledClick",oo),wr(oo.key),oo.canConnectViaQrCode?(Cn({getAddressOpts:{onDesktopUri:io=>__awaiter$e(void 0,void 0,void 0,function*(){jr(io)}),onDisplayUri:io=>__awaiter$e(void 0,void 0,void 0,function*(){kr(io)})},walletConnector:oo}),Qr("qr-code")):Qr("no-qr-not-installed"),Zr(void 0)}),ro=oo=>__awaiter$e(void 0,void 0,void 0,function*(){logger$6.debug("handleAlreadyConnectedWallet",oo),br(!1);const io=yield oo.getConnectedAccounts(),co=Wr.find(so=>{var no;return so.address.toLowerCase()===((no=io[0])===null||no===void 0?void 0:no.toLowerCase())});logger$6.logVerboseTroubleshootingMessage("[handleAlreadyConnectedWallet]",{activeAccountAlreadyLinked:co,connectedAccounts:io,linkedWallets:Wr}),co?fr("awaiting_account_switch","linking_new_wallet"):fr("awaiting_signature",void 0,"linking_new_wallet"),wr(oo.key)});return{handleAlreadyConnectedWallet:ro,handleCustodialWalletClick:In,handleInstalledExtensionClick:jn,handleMobileWalletClick:An,handleUninstalledClick:eo,handleWalletItemClick:oo=>__awaiter$e(void 0,void 0,void 0,function*(){const{walletConnector:io,isInstalledOnBrowser:co}=oo,so=io.connectedChain==="FLOW"||isPhantomRedirectConnector(io);if(logger$6.logVerboseTroubleshootingMessage("[handleWalletItemClick]",{mockedSDK:Vr,shouldEndWalletConnectorSession:so,wallet:oo}),Vr)return;so&&(yield io.endSession()),qr(!1);const no=io.key==="metamask";if(Gr!=="connect-only"&&no)try{wr(io.key),Qr("pending-connect"),yield io.chooseAccountsToConnect()}catch(Tn){if(Tn instanceof UserRejectedRequestError$1){Jr("connection_rejected"),_n();return}}isSelectedWalletAlreadyConnected(Wr,io,Br)&&io.connectedChain!=="FLOW"?ro(io):io.canConnectViaCustodialService?In(io):isMobile()?io.key==="walletconnect"?Qr("wallet-connect-mobile-wallets-list"):An(io):co?jn(io):eo(io)}),openWallet:(oo,io)=>{var co;const{openMobileWallet:so=An,openCustodialWallet:no=In,openExtensionWallet:Tn=jn}=io||{},Hr=(co=Er.find(Xr=>Xr.key===oo))===null||co===void 0?void 0:co.walletConnector;Hr&&(isMobile()?so(Hr):Hr.canConnectViaCustodialService?no(Hr):Hr.isInstalledOnBrowser()&&Tn(Hr))}}},ListTileAnimatedTrailing=({hoverElement:fr,children:br})=>jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs("div",{className:"list-tile-animated-trailing",children:[jsxRuntimeExports.jsx("div",{className:"list-tile-animated-trailing__child",children:br}),jsxRuntimeExports.jsx("div",{className:"list-tile-animated-trailing__hover-element",children:fr})]})}),ListTile=({children:fr,onClick:br,leading:wr,disabled:Er=!1,trailing:kr,style:jr,className:Br="",dataTestId:Wr,copykey:qr})=>jsxRuntimeExports.jsxs("button",{"data-testid":Wr,type:"button",className:classNames$1(Br,"list-tile"),onClick:br,style:jr,disabled:Er,children:[wr,jsxRuntimeExports.jsx("div",{className:"list-tile__children",children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"body_normal",color:"primary",as:"span",copykey:qr,children:fr})}),kr]}),WalletListItem=({disabled:fr=!1,wallet:br,onResetSearchValue:wr,recommendedWallets:Er,tile:kr=({leading:jr,name:Br,onClick:Wr,trailing:qr})=>jsxRuntimeExports.jsx(ListTile,{leading:jr,trailing:qr,onClick:Wr,className:"wallet-list-item__tile",dataTestId:"ListTile",children:Br})})=>{const{navigateToWalletGroup:jr}=useWalletGroupContext(),{setView:Br}=useViewContext(),Wr=isWalletGroup(br),{walletBook:qr}=useWalletBookContext(),{handleWalletItemClick:Gr}=useWalletItemActions(),Vr=getWalletListItemLabel({recommendedWallets:Er,wallet:br}),Zr=kr,Jr=()=>__awaiter$e(void 0,void 0,void 0,function*(){if(!fr){if(wr==null||wr(""),Wr)return jr(br);if(isHardwareWalletConnector(br.walletConnector)&&br.walletConnector.canConnectWithHardwareWallet()){Br("select-hardware-wallet",{onSelectWallet:Gr,wallet:br});return}yield Gr(br)}}),Qr=Wr?getWalletGroup(qr,br.key).name:getWalletBookWallet(qr,br.key).name,_n=jsxRuntimeExports.jsx(WalletIcon,{className:"wallet-list-item__leading",walletKey:br.key,style:{height:pixelToRem(28),width:pixelToRem(28)}}),En=jsxRuntimeExports.jsx(ListTileAnimatedTrailing,{hoverElement:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",size:"mini",children:jsxRuntimeExports.jsx(SvgStroke,{})}),children:Vr&&jsxRuntimeExports.jsx(Badge,{dot:!Vr.isRecommended,variant:Vr.isRecommended?"primary":"secondary",text:jsxRuntimeExports.jsx(Typography,{variant:"body_small",children:Vr.label})})});return jsxRuntimeExports.jsx(Zr,{leading:_n,trailing:En,name:Qr,onClick:Jr})},NewToWeb3WalletItem=({children:fr,style:br,wallet:wr})=>jsxRuntimeExports.jsx(WalletListItem,{wallet:wr,tile:fr?({onClick:Er})=>jsxRuntimeExports.jsx("button",{className:"new-to-web3--button",style:br,onClick:Er,children:fr}):void 0}),Item$1=({heading:fr,StartIcon:br,EndIcon:wr,message:Er,url:kr})=>jsxRuntimeExports.jsxs("a",{className:"footer-buttons-item",href:kr,rel:"noopener noreferrer",target:"_blank",children:[jsxRuntimeExports.jsx("div",{className:"footer-buttons-item__icon--left",children:jsxRuntimeExports.jsx(br,{})}),jsxRuntimeExports.jsxs("div",{className:"footer-buttons-item__typography",children:[jsxRuntimeExports.jsx(Typography,{as:"h2",weight:"regular",color:"primary",variant:"body_normal",children:fr}),Er&&jsxRuntimeExports.jsx(Typography,{as:"p",weight:"regular",color:"secondary",children:Er})]}),wr&&jsxRuntimeExports.jsx(wr,{style:{height:"1.5rem",width:"1.5rem"}})]}),WalletExtensionOrAppContinueButton=({wallet:fr,selectedUrl:br})=>{const wr=!!br.length&&!(fr!=null&&fr.isInstalledOnBrowser),Er=()=>{fr!=null&&fr.key&&(StorageService.setItem(NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY,fr.key),window.location.reload())};return jsxRuntimeExports.jsxs("div",{className:"new-to-web3-buttons__container",children:[!isMobile()&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[(fr==null?void 0:fr.isInstalledOnBrowser)&&jsxRuntimeExports.jsx(NewToWeb3WalletItem,{wallet:fr,children:jsxRuntimeExports.jsx(Typography,{as:"p","data-testid":"desktop-interactive-wallet-item",variant:"body_normal",weight:"bold",children:"Continue"})}),wr&&jsxRuntimeExports.jsx("button",{onClick:Er,children:jsxRuntimeExports.jsx(Typography,{as:"p","data-testid":"refresh-once-installed-button",variant:"body_normal",weight:"bold",children:"Continue once installed"})})]}),fr&&isMobile()&&jsxRuntimeExports.jsx(NewToWeb3WalletItem,{wallet:fr,children:jsxRuntimeExports.jsx("p",{"data-testid":"mobile-interactive-wallet-item",children:"Continue once installed"})})]})},WalletListHelpContent=({chains:fr,newToWeb3WalletChainMap:br})=>{var wr,Er;const{walletConnectorOptions:kr}=useInternalDynamicContext(),{walletBook:jr}=useWalletBookContext(),[Br,Wr]=reactExports.useState(""),qr=((wr=fr==null?void 0:fr.filter(In=>!!In.enabled).find(In=>In.name===br.primary_chain))===null||wr===void 0?void 0:wr.name)||"evm",Gr=getValueByKey(br==null?void 0:br.wallets,qr),Vr=kr.find(In=>In.key===Gr),Zr=Vr==null?void 0:Vr.walletConnector.canConnectViaCustodialService,Jr=getWalletLinks(jr,Gr),{currentDesktopUrl:Qr,canShowAndroidAppButton:_n,canShowIosAppButton:En}=parseWalletLinks(Jr),Cn=[{content:"Install Desktop extension",icon:SvgPuzzle,isEnabled:!!(Qr!=null&&Qr.length)&&!isMobile(),url:Qr},{content:"Install iOS app",icon:AppleIcon,isEnabled:En,url:Jr.ios},{content:"Install Android app",icon:AndroidIcon,isEnabled:_n,url:Jr.android}];return Object.keys((Er=jr==null?void 0:jr.wallets)!==null&&Er!==void 0?Er:{}).length?jsxRuntimeExports.jsx("div",{className:"walletlist-help-content__container",children:jsxRuntimeExports.jsxs(EnterTileAnimation,{delay:"300ms",children:[jsxRuntimeExports.jsx("div",{className:"walletlist-help-content__icon",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:Gr,style:{height:pixelToRem(56),width:pixelToRem(56)}})}),jsxRuntimeExports.jsxs("div",{className:"walletlist-help-content__typography-wrapper",children:[jsxRuntimeExports.jsxs(Typography,{as:"p",variant:"title",weight:"medium",children:["We recommend installing"," ",getWalletBookWallet(jr,Gr).name]}),jsxRuntimeExports.jsx(Typography,{as:"label",variant:"body_normal",weight:"regular",color:"secondary",className:"walletlist-help-content__typography--label",children:"Select your preferred option below:"})]}),jsxRuntimeExports.jsx("div",{className:"walletlist-help-content__buttons-wrapper",children:Cn.map((In,An)=>In.isEnabled?jsxRuntimeExports.jsx("button",{onClick:()=>Wr(In.url),children:jsxRuntimeExports.jsx(Item$1,{StartIcon:In.icon,heading:In.content,url:In.url})},An):void 0)}),Zr&&jsxRuntimeExports.jsxs("div",{className:"walletlist-help-content__custodial-wallet-area",children:[jsxRuntimeExports.jsx(Typography,{className:"walletlist-help-content__custodial-wallet-area--title",as:"p",color:"secondary",variant:"body_normal",weight:"regular",children:"If you don't want to install a wallet, then use:"}),jsxRuntimeExports.jsx(NewToWeb3WalletItem,{wallet:Vr})]}),jsxRuntimeExports.jsx(WalletExtensionOrAppContinueButton,{selectedUrl:Br,wallet:Vr})]})}):jsxRuntimeExports.jsx(Skeleton$1,{className:"walletlist-footer-content__container"})};var _path$y,_excluded$H=["title","titleId"];function _extends$H(){return _extends$H=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$H(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgChevronLeft=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$H(br,_excluded$H);return reactExports.createElement("svg",_extends$H({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$y||(_path$y=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.09 3.577a.833.833 0 0 1 0 1.179L7.844 10l5.244 5.244a.833.833 0 0 1-1.178 1.179l-5.834-5.834a.833.833 0 0 1 0-1.178l5.834-5.834a.833.833 0 0 1 1.178 0Z",fill:"currentcolor"})))};const HelpHeader=()=>{const{authMode:fr}=useInternalDynamicContext(),{setIsFooterExpanded:br}=useFooterAnimationContext(),{view:wr}=useViewContext(),{helpHeaderData:Er}=useDynamicLayoutData({authMode:fr,view:wr.type}),{displayBorderBelowHeader:kr}=useAuthLayoutChecks(),jr=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>br(!1),"data-testid":"back-button",className:"header__icon",children:jsxRuntimeExports.jsx(SvgChevronLeft,{className:"back-button "})});return jsxRuntimeExports.jsx("div",{className:"help-header",children:jsxRuntimeExports.jsx(ModalHeader,{trailing:jr,displayLeading:!1,displayBorder:kr,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-help-heading",className:"header__typography",copykey:Er==null?void 0:Er.copykey,children:Er==null?void 0:Er.heading})})})};var _path$x,_excluded$G=["title","titleId"];function _extends$G(){return _extends$G=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$G(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgUserAccount2=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$G(br,_excluded$G);return reactExports.createElement("svg",_extends$G({width:60,height:50,viewBox:"0 0 60 50",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$x||(_path$x=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.931 49.48A29.223 29.223 0 0 0 59.333 30C59.333 13.8 46.2.667 30 .667S.667 13.8.667 30A29.224 29.224 0 0 0 8.07 49.483c5.52-6.63 16.005-9.007 22.387-9.007 6.383 0 15.962 1.903 21.473 9.004ZM19 22.667c0-6.076 4.925-11 11-11s11 4.924 11 11c0 6.075-4.925 11-11 11s-11-4.925-11-11Z",fill:"#4779FF"})))};const PasskeyInfoHelper=()=>{const{t:fr}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"passkey-info-help-content__container",children:jsxRuntimeExports.jsx(EnterTileAnimation,{delay:"300ms",children:jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__typography-wrapper",children:[jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__details",children:[jsxRuntimeExports.jsx(Icon,{size:"medium",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgUserAccount2,{})}),jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__wrapper",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",weight:"medium",copykey:"dyn_passkey_intro.helper.section_1.title",children:fr("dyn_passkey_intro.helper.section_1.title")}),jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-info-help-content__typography--label",copykey:"dyn_passkey_intro.helper.section_1.description",children:fr("dyn_passkey_intro.helper.section_1.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__details",children:[jsxRuntimeExports.jsx(Icon,{size:"medium",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgFooterKeyIcon,{})}),jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__wrapper",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",weight:"medium",copykey:"dyn_passkey_intro.helper.section_2.title",children:fr("dyn_passkey_intro.helper.section_2.title")}),jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-info-help-content__typography--label",copykey:"dyn_passkey_intro.helper.section_2.description",children:fr("dyn_passkey_intro.helper.section_2.description")})]})]})]})})})},HelpContent=()=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(HelpHeader,{}),jsxRuntimeExports.jsx(HelpContentSwitch,{})]}),HelpContentSwitch=()=>{const{view:fr}=useViewContext(),{projectSettings:br,newToWeb3WalletChainMap:wr,selectedWalletConnector:Er}=useInternalDynamicContext(),kr=reactExports.useMemo(()=>fr.type==="wallet-connect-mobile-wallets-list"||fr.type==="wallet-list"||fr.type==="login-with-email-or-wallet-full-wallet-list"||fr.type==="login-with-wallet-only",[fr]),jr=reactExports.useMemo(()=>fr.type==="pending-signature-without-back-button"||fr.type==="pending-signature",[fr]),Br=reactExports.useMemo(()=>fr.type==="pending-connect"||fr.type==="qr-code",[fr]),Wr=reactExports.useMemo(()=>fr.type==="passkey-intro",[fr]);return kr?jsxRuntimeExports.jsx(WalletListHelpContent,{chains:br==null?void 0:br.chains,newToWeb3WalletChainMap:wr}):jr?jsxRuntimeExports.jsx(WalletMoreInfoContent,{variant:"sign",wallet:Er||void 0}):Br?jsxRuntimeExports.jsx(WalletMoreInfoContent,{variant:"connect"}):Wr?jsxRuntimeExports.jsx(PasskeyInfoHelper,{}):jsxRuntimeExports.jsx(EmptyHelpContent,{})},TosAndPp=()=>{const{user:fr,authMode:br,customPrivacyPolicy:wr,customTermsOfServices:Er,privacyPolicyUrl:kr,termsOfServiceUrl:jr}=useInternalDynamicContext(),Br=isConnectOnly(fr,br)?"connecting":"logging in",Wr=()=>{if(jr)return jsxRuntimeExports.jsx("a",{className:"tos-and-pp__link",href:jr,target:"_blank",rel:"noreferrer",children:"Terms of Service"})},qr=()=>{if(kr)return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jr&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:" & "}),jsxRuntimeExports.jsx("a",{className:"tos-and-pp__link",href:kr,target:"_blank",rel:"noreferrer",children:"Privacy Policy"})]})};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[(kr||jr)&&jsxRuntimeExports.jsxs(Typography,{variant:"body_small",weight:"regular",className:"tos-and-pp__text",children:["By ",Br,", you agree to",jsxRuntimeExports.jsx("br",{}),"our ",Wr(),qr(),"."]}),Er,wr]})},ToSFooter=()=>{const{showToSFooter:fr}=useAuthLayoutChecks();return jsxRuntimeExports.jsx("div",{className:"tos-and-pp__footer",children:fr&&jsxRuntimeExports.jsx(TosAndPp,{})})},getChainStepState=(fr,br)=>{const wr=fr===br[0],Er=!br.includes(fr);return wr?"current":Er?"done":"upcoming"},typographyOpacityMap={current:"1",default:"1",done:"0.4",upcoming:"0.15"},Step=({children:fr,className:br,icon:wr,state:Er="default"})=>{const kr=reactExports.useMemo(()=>({opacity:Er==="upcoming"?.5:1}),[Er]),jr=reactExports.useMemo(()=>Er==="done"?jsxRuntimeExports.jsx("div",{className:"step__icon step__icon--done",children:jsxRuntimeExports.jsx(Icon,{className:"step__icon__check-mark",children:jsxRuntimeExports.jsx(SvgCheck,{style:kr})})}):wr?jsxRuntimeExports.jsx(Icon,{className:"step__icon",children:jsxRuntimeExports.jsx("div",{style:kr,children:wr})}):jsxRuntimeExports.jsx("div",{className:"step__index",children:jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_small",style:kr,children:jsxRuntimeExports.jsx("span",{className:"step__index-label"})})}),[wr,Er,kr]);return jsxRuntimeExports.jsxs("div",{className:classNames$1("step",br),children:[jr,jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_small",style:{opacity:typographyOpacityMap[Er]},children:fr})]})},Stepper=({children:fr})=>jsxRuntimeExports.jsx("div",{className:"stepper",children:reactExports.Children.map(fr,(br,wr)=>{const Er=wr===0?void 0:jsxRuntimeExports.jsx(Divider,{className:"stepper__divider"});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Er,br]})})}),WalletProgressStepper=()=>{const{bridgeChainsToConnect:fr=[],bridgeChains:br=[]}=useInternalDynamicContext(),wr=br.map(({chain:kr})=>kr),Er=[...fr].map(({chain:kr})=>kr);return jsxRuntimeExports.jsx("div",{className:"wallet-progress-stepper","data-testid":"wallet-progress-stepper",children:jsxRuntimeExports.jsx(Stepper,{children:wr.map((kr,jr)=>{var Br;const Wr=getChainInfoWithOverrides(kr),qr=getChainIcon(kr);return jsxRuntimeExports.jsx(Step,{state:getChainStepState(kr,Er),icon:jsxRuntimeExports.jsx(qr,{}),children:(Br=Wr==null?void 0:Wr.blockchainName)!==null&&Br!==void 0?Br:Wr==null?void 0:Wr.displayName},kr)})})})},DynamicAuthLayout=({children:fr,className:br,style:wr,onClose:Er,projectSettings:kr,hideBridgeProgressSteppers:jr})=>{const{view:Br}=useViewContext(),{authMode:Wr}=useInternalDynamicContext(),{isFooterExpanded:qr}=useFooterAnimationContext(),{headerData:Gr,helpHeaderData:Vr}=useDynamicLayoutData({authMode:Wr,view:Br.type}),{showConnectedWalletProgress:Zr,showHeader:Jr,showHelpContent:Qr,showToSFooter:_n,showDynamicFooter:En}=useAuthLayoutChecks();return jsxRuntimeExports.jsx(OverlayCardTarget,{children:jsxRuntimeExports.jsxs(VerticalAccordion,{style:wr,className:br,children:[jsxRuntimeExports.jsxs(AccordionItem,{isOpen:!qr,dimOnHide:!0,children:[Zr&&!jr&&jsxRuntimeExports.jsx(WalletProgressStepper,{}),Jr&&jsxRuntimeExports.jsx(Header,{onClose:Er,heading:(Gr==null?void 0:Gr.heading)||"",projectSettings:kr,copykey:Gr==null?void 0:Gr.copykey}),fr,_n&&jsxRuntimeExports.jsx(ToSFooter,{}),En&&jsxRuntimeExports.jsx(DynamicFooter,{})]}),Vr&&Qr&&jsxRuntimeExports.jsx(AccordionItem,{isOpen:qr,children:jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(HelpContent,{})},qr.toString())})]})})},SandboxIndicatorWrapper=({children:fr})=>{const{projectSettings:br}=useInternalDynamicContext(),wr=reactExports.useRef(null),[Er,kr]=reactExports.useState(void 0),jr=(br==null?void 0:br.environmentName)===EnvironmentEnum.Sandbox;return reactExports.useEffect(()=>{var Br;const Wr=(Br=wr.current)===null||Br===void 0?void 0:Br.clientHeight;kr(Wr)},[wr,kr]),jr?jsxRuntimeExports.jsxs("div",{style:{position:"relative"},children:[jsxRuntimeExports.jsx("div",{ref:wr,style:{background:"var(--dynamic-alert-1)",borderTopLeftRadius:"4px",borderTopRightRadius:"4px",color:"white",left:"calc( var(--dynamic-border-radius) + 8px)",padding:"2px 8px 4px",position:"absolute",top:-(Er||0)},"data-testid":"sandbox-indicator",children:capitalize$1((br==null?void 0:br.environmentName)||"")}),fr]}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:fr})},DynamicAuthModal=({children:fr,onClose:br,transitionProps:wr,projectSettings:Er,className:kr})=>{const{showConnectedWalletProgress:jr}=useAuthLayoutChecks();return jsxRuntimeExports.jsxs(Modal$1,{isShown:!!(wr!=null&&wr.isShown),children:[jr&&jsxRuntimeExports.jsx(ModalCard,{borderRadius:"small",children:jsxRuntimeExports.jsx(WalletProgressStepper,{})}),jsxRuntimeExports.jsx(SandboxIndicatorWrapper,{children:jsxRuntimeExports.jsx(ModalCard,{dataTestId:"dynamic-auth-modal",children:jsxRuntimeExports.jsx(DynamicAuthLayout,{className:kr,projectSettings:Er,onClose:br,hideBridgeProgressSteppers:!0,children:fr})})})]})},MockContext=reactExports.createContext(void 0),useMockContext=()=>{const fr=reactExports.useContext(MockContext);return fr===void 0?{mockedSDK:!1}:fr},LoadingContext=reactExports.createContext(void 0),LoadingContextProvider=({children:fr})=>{const[br,wr]=reactExports.useState(!1);useInternalDynamicEvents("logout",()=>wr(!1)),useInternalDynamicEvents("embeddedWalletCreated",()=>wr(!1));const Er=reactExports.useMemo(()=>({loading:br,setLoading:wr}),[br]);return jsxRuntimeExports.jsx(LoadingContext.Provider,{value:Er,children:fr})},useLoadingContext=()=>{const fr=reactExports.useContext(LoadingContext);if(fr===void 0)throw new Error("usage of useLoadingContext not wrapped in `LoadingContextProvider`.");return fr},{getProjectSettings,setProjectSettings,useProjectSettings,resetProjectSettings}=createStoreState("projectSettings"),useFetchProjectSettings=({environmentId:fr,retries:br=2})=>{const wr=useProjectSettings(),Er=!!(wr!=null&&wr.settings),{retrigger:kr}=usePromise(()=>__awaiter$e(void 0,void 0,void 0,function*(){const jr=yield fetchProjectSettings(fr);if(!jr)throw new DynamicError("Settings are not defined");return jr}),{deps:[fr],enabled:!Er,onResolve:jr=>{const Br=new Date().getTime()+3e5;setProjectSettings({expiresAt:Br,settings:jr})},retries:br});useDynamicEvents("logout",kr)},AccordionItem=reactExports.forwardRef(({children:fr,className:br="",isOpen:wr,dataTestId:Er,dimOnHide:kr=!1,handleScroll:jr=()=>{}},Br)=>{const Wr=reactExports.useRef(null),qr=reactExports.useRef(),[Gr]=useResizeObserver(Wr),Vr=reactExports.useMemo(()=>wr?Gr?Gr.height:qr.current:0,[wr,Gr]);return reactExports.useEffect(()=>{const Zr=Gr==null?void 0:Gr.height;Zr&&(qr.current=Zr)},[Gr]),jsxRuntimeExports.jsxs("div",{"data-testid":Er,style:{maxHeight:Vr},className:classNames$1(br,"accordion-item",{"accordion-item--full-height":!!Vr}),onScroll:jr,ref:Br,children:[kr&&jsxRuntimeExports.jsx("div",{"data-testid":"accordion-item-curtain",className:classNames$1("accordion-item__curtain",{"accordion-item__curtain--dimmed":!wr})}),jsxRuntimeExports.jsx("div",{ref:Wr,children:fr})]})});AccordionItem.displayName="AccordionItem";var _g$a,_defs$a,_excluded$F=["title","titleId"];function _extends$F(){return _extends$F=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$F(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgAccessBlocked=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$F(br,_excluded$F);return reactExports.createElement("svg",_extends$F({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_g$a||(_g$a=reactExports.createElement("g",{clipPath:"url(#access-blocked_svg__a)"},reactExports.createElement("circle",{cx:164,cy:114,r:114,fill:"url(#access-blocked_svg__b)",fillOpacity:.12}),reactExports.createElement("circle",{cx:220.352,cy:29.265,r:15.729,transform:"rotate(15 220.352 29.265)",fill:"#4779FF"}),reactExports.createElement("path",{d:"M223.594 23.62a1.573 1.573 0 1 0-3.038-.815l-1.629 6.078a1.573 1.573 0 1 0 3.039.814l1.628-6.077ZM219.225 33.848a1.573 1.573 0 0 0-.814 3.039l.015.004a1.574 1.574 0 0 0 .814-3.039l-.015-.004Z",fill:"#F9F9FB"}),reactExports.createElement("g",{clipPath:"url(#access-blocked_svg__c)",fill:"#4779FF"},reactExports.createElement("path",{d:"M101.972 36.04a8 8 0 0 1 9.798 5.657l-2.897.777a5 5 0 0 0-9.66 2.588l-2.897.776a8 8 0 0 1 5.656-9.797ZM118.498 47.487a5.333 5.333 0 0 0-6.532-3.772l-14.81 3.969a5.333 5.333 0 0 0-3.772 6.532l1.898 7.084a5.333 5.333 0 0 0 6.532 3.77l14.811-3.968a5.334 5.334 0 0 0 3.771-6.532l-1.898-7.083Z"})),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.313.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.336 9.336 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm-3.344 46.703c-1.172-2.936-2.026-7.051-2.236-11.797h9.298c-.21 4.746-1.064 8.861-2.236 11.797-.683 1.709-1.393 2.816-1.971 3.428-.198.21-.346.328-.442.393a2.703 2.703 0 0 1-.442-.392c-.578-.613-1.288-1.72-1.971-3.429Zm0-28.13c-1.208 3.025-2.078 7.301-2.253 12.228h9.332c-.175-4.927-1.045-9.203-2.253-12.227-.683-1.709-1.393-2.816-1.971-3.429a2.703 2.703 0 0 0-.442-.392 2.703 2.703 0 0 0-.442.392c-.578.613-1.288 1.72-1.971 3.429Zm-15.106 12.228h8.746c.21-6.38 1.506-11.989 3.423-15.668-6.57 2.184-11.466 8.283-12.169 15.668Zm.046 4.105h8.716c.253 6.201 1.533 11.642 3.407 15.238-6.442-2.141-11.274-8.046-12.123-15.238Zm34.946 0h-8.716c-.253 6.201-1.533 11.642-3.407 15.238 6.442-2.141 11.275-8.046 12.123-15.238Zm.133-2.267v.065-.131.066Zm-8.833-1.838h8.746c-.703-7.385-5.599-13.484-12.169-15.668 1.917 3.68 3.213 9.289 3.423 15.668Zm-8.909 19.795c0-.001.007-.004.023-.008a.077.077 0 0 1-.023.008Zm.25-.008a.064.064 0 0 1 .022.008s-.007-.001-.022-.008Zm.022-35.907c0 .001-.007.004-.023.008a.077.077 0 0 1 .023-.008Zm-.249.008c-.016-.004-.023-.007-.023-.008 0 0 .007.001.023.008Z",fill:"#4779FF"}))),_defs$a||(_defs$a=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"access-blocked_svg__a"},reactExports.createElement("rect",{width:327,height:112,rx:12,fill:"#fff"})),reactExports.createElement("clipPath",{id:"access-blocked_svg__c"},reactExports.createElement("path",{fill:"#fff",transform:"rotate(-15 188.268 -307.493)",d:"M0 0h32v32H0z"})),reactExports.createElement("linearGradient",{id:"access-blocked_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))};const AccessBlockedView=()=>{const[fr,br]=reactExports.useState(),{t:wr}=useTranslation(),{getIpConfiguration:Er}=useIpConfigurationContext();return usePromise(Er,{deps:[Er,fr],onResolve:kr=>br(kr==null?void 0:kr.country),retries:2}),jsxRuntimeExports.jsxs("div",{className:"access-blocked__container",children:[jsxRuntimeExports.jsx("div",{className:"access-blocked__icon",children:jsxRuntimeExports.jsx(SvgAccessBlocked,{})}),jsxRuntimeExports.jsx("div",{className:"access-blocked__content",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",children:wr("dyn_access_blocked.content",{jurisdiction:fr})})})]})};var _path$w,_excluded$E=["title","titleId"];function _extends$E(){return _extends$E=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$E(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgWalletConnectLogo=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$E(br,_excluded$E);return reactExports.createElement("svg",_extends$E({width:17,height:12,viewBox:"0 0 17 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$w||(_path$w=reactExports.createElement("path",{d:"M3.84 2.345c2.573-3.127 6.747-3.127 9.32 0l.31.376a.463.463 0 0 1 0 .566l-1.06 1.287a.145.145 0 0 1-.232 0l-.427-.518c-1.795-2.18-4.707-2.18-6.502 0l-.457.555a.145.145 0 0 1-.233 0L3.5 3.324a.463.463 0 0 1 0-.566l.34-.413Zm11.512 2.661.943 1.146a.463.463 0 0 1 0 .566l-4.252 5.165a.29.29 0 0 1-.466 0L8.558 8.217a.073.073 0 0 0-.116 0l-3.018 3.666a.29.29 0 0 1-.466 0L.705 6.718a.463.463 0 0 1 0-.566l.943-1.146a.29.29 0 0 1 .466 0l3.018 3.666c.032.04.085.04.117 0l3.018-3.666a.29.29 0 0 1 .466 0l3.018 3.666c.033.04.085.04.117 0l3.018-3.666a.29.29 0 0 1 .466 0Z",fill:"currentColor"})))};const Indicator=({indicator:fr,iconSize:br})=>{const wr={container:br*4/15,icon:br*3/15},Er={container:br/6,icon:br/9};return fr==="walletConnect"?jsxRuntimeExports.jsx("div",{className:"indicator__wallet-connect",style:{height:pixelToRem(wr.container),width:pixelToRem(wr.container)},children:jsxRuntimeExports.jsx(SvgWalletConnectLogo,{style:{height:pixelToRem(wr.icon),width:pixelToRem(wr.icon)}})}):jsxRuntimeExports.jsx("div",{className:"indicator__container indicator__container--connected",style:{height:pixelToRem(Er.container),width:pixelToRem(Er.container)},"data-testid":"connected-indicator",children:jsxRuntimeExports.jsx("div",{className:"indicator__icon",style:{height:pixelToRem(Er.icon),width:pixelToRem(Er.icon)}})})},iconRatio=7/11,IconWithSpinner=({iconSize:fr=24,Icon:br,isSpinning:wr=!1,className:Er="",indicator:kr,customSpinnerColor:jr,treatAsFunctionComponent:Br})=>{const Wr=fr*iconRatio,qr=fr/2,Gr=classNames$1("icon-with-spinner__container",Er),Vr=br;return jsxRuntimeExports.jsxs("div",{className:Gr,style:{height:pixelToRem(fr),width:pixelToRem(fr)},children:[br&&jsxRuntimeExports.jsxs("div",{style:{height:pixelToRem(Wr),width:pixelToRem(Wr)},className:"icon-with-spinner__icon-container",children:[Br||typeof br=="function"?jsxRuntimeExports.jsx(Vr,{height:Wr,width:Wr}):br,kr&&jsxRuntimeExports.jsx(Indicator,{indicator:kr,iconSize:fr})]}),wr&&!isLegacySafari()&&jsxRuntimeExports.jsx("div",{className:"icon-with-spinner__spinner-container icon-with-spinner__animation","data-chromatic":"ignore",style:{height:pixelToRem(fr),width:pixelToRem(fr)},children:jsxRuntimeExports.jsx(Spinner$1,{className:"icon-with-spinner__spinner",customSpinnerColor:jr,size:qr})})]})},IconListTile=fr=>{var{children:br,className:wr}=fr,Er=__rest$9(fr,["children","className"]);return jsxRuntimeExports.jsx(ListTile,Object.assign({},Er,{className:classNames$1(wr,"icon-list-tile"),children:jsxRuntimeExports.jsx("div",{className:"icon-list-tile--children",children:br})}))},isEmailProviderEnabled=fr=>fr!==void 0&&(isProviderEnabled(fr,ProviderEnum.Dynamic)||isProviderEnabled(fr,ProviderEnum.Blocto)||isProviderEnabled(fr,ProviderEnum.MagicLink)),findEmailOtpWalletConnector=fr=>fr.map(({walletConnector:wr})=>wr).find(wr=>isEmailWalletConnector(wr)&&wr.requiresNonDynamicEmailOtp),getEmailProvider=fr=>__awaiter$e(void 0,[fr],void 0,function*({email:br,environmentId:wr}){try{return yield sdkApi$1().getEmailProvider({email:br,environmentId:wr})}catch(Er){const kr=yield Er.json();throw logger$6.error(kr.error),new EmailProviderError(kr.code)}}),createEmailVerification=fr=>__awaiter$e(void 0,[fr],void 0,function*({email:br,environmentId:wr,captchaToken:Er}){try{return yield sdkApi$1().createEmailVerification({emailVerificationCreateRequest:{captchaToken:Er,email:br},environmentId:wr})}catch(kr){const jr=yield kr.json();throw logger$6.error(jr.error),new EmailVerificationError(jr.code)}}),signInWithEmailVerification=fr=>__awaiter$e(void 0,[fr],void 0,function*({verificationToken:br,verificationUUID:wr,environmentId:Er,captchaToken:kr,sessionPublicKey:jr}){try{return yield sdkApi$1().signInWithEmailVerification({emailVerificationVerifyRequest:{captchaToken:kr,sessionPublicKey:jr,verificationToken:br,verificationUUID:wr},environmentId:Er})}catch(Br){const Wr=yield Br.json();throw logger$6.error(Wr.error),Wr.error.code==="missing_from_list"?new NoAccessError({email:Wr.payload.email}):Wr.code==="email_associated_with_different_provider"?new AccountExistsError(Wr.error,Wr.payload):Wr.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(Wr.error.message):new EmailVerificationError(Wr.code)}}),retryEmailVerification=fr=>__awaiter$e(void 0,[fr],void 0,function*({email:br,environmentId:wr,verificationUUID:Er}){try{return yield sdkApi$1().retryEmailVerification({emailVerificationRetryRequest:{email:br,verificationUUID:Er},environmentId:wr})}catch(kr){const jr=yield kr.json();throw logger$6.error(jr.error),new EmailVerificationError(jr.code)}}),verifyEmail=fr=>__awaiter$e(void 0,[fr],void 0,function*({verificationToken:br,verificationUUID:wr,environmentId:Er}){try{return yield sdkApi$1().verifyEmailVerification({emailVerificationVerifyRequest:{verificationToken:br,verificationUUID:wr},environmentId:Er})}catch(kr){const jr=yield kr.json();throw logger$6.error(jr.error),jr.code===UnprocessableEntityErrorCode.UserHasAlreadyAccountWithEmail?new UserHasAccountWithEmailError(jr.error):jr.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(jr.error.message):new EmailVerificationError(jr.code)}}),useConnectWithEmail=({emailWalletConnector:fr,handleConnect:br})=>{const{error:wr}=useErrorContext(),[Er,kr]=reactExports.useState(!1),jr=Br=>__awaiter$e(void 0,void 0,void 0,function*(){if(!(!Br||!fr||Er)){kr(!0),fr.setEmail(Br);try{yield br(fr)}catch(Wr){logger$6.error(Wr),kr(!1)}}});return reactExports.useEffect(()=>{wr&&Er&&kr(!1)},[wr,Er]),{connectWithEmail:jr,loading:Er}},useEmailProvider=({emailWalletConnector:fr})=>{const{projectSettings:br,environmentId:wr}=useInternalDynamicContext(),{setDisplayedDestination:Er,setVerificationUUID:kr}=useVerification(),{setView:jr}=useViewContext(),{handleInstalledExtensionClick:Br}=useWalletItemActions(),{connectWithEmail:Wr,loading:qr}=useConnectWithEmail({emailWalletConnector:fr,handleConnect:Br}),{providers:Gr}=br||{},Zr=fr!==void 0&&(isProviderEnabled(Gr||[],ProviderEnum.MagicLink)||isProviderEnabled(Gr||[],ProviderEnum.Blocto)),Jr=(Cn,In)=>__awaiter$e(void 0,void 0,void 0,function*(){const{email:An,verificationUUID:jn}=yield createEmailVerification({captchaToken:In,email:Cn,environmentId:wr});jr("login-with-email-verification"),Er(An),kr(jn)}),Qr=Cn=>__awaiter$e(void 0,void 0,void 0,function*(){yield Wr(Cn)}),_n=(Cn,In)=>__awaiter$e(void 0,void 0,void 0,function*(){if(Zr){yield Qr(Cn);return}yield Jr(Cn,In)});return{handleEmailSubmitWithOptionalCaptcha:(Cn,In)=>__awaiter$e(void 0,void 0,void 0,function*(){dynamicEvents.emit("authInit",{email:Cn,option:Cn,type:"email"});try{if((fr!==void 0||isTurnkeyEnabled(br))&&(br!=null&&br.sdk.confirmEmailProviderForVerify)){const{emailProvider:An}=yield getEmailProvider({email:Cn,environmentId:wr});if(An===ProviderEnum.Dynamic){yield Jr(Cn,In);return}}yield _n(Cn,In)}catch(An){throw dynamicEvents.emit("authFailure",{email:Cn,option:Cn,type:"email"},{error:An}),An}}),isEmailProviderLoading:qr}},EMAIL_REGEX=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,isEmailValid=fr=>EMAIL_REGEX.test(fr);var _rect$1,_path$v,_excluded$D=["title","titleId"];function _extends$D(){return _extends$D=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$D(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgArrowRightBackground=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$D(br,_excluded$D);return reactExports.createElement("svg",_extends$D({width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_rect$1||(_rect$1=reactExports.createElement("rect",{x:.5,width:24,height:24,rx:12,fill:"var(--icon-background, var(--dynamic-hover))"})),_path$v||(_path$v=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.22 7.47a.75.75 0 0 1 1.06 0l3.75 3.75a.75.75 0 0 1 0 1.06l-3.75 3.75a.75.75 0 1 1-1.06-1.06l2.47-2.47H7.5a.75.75 0 0 1 0-1.5h8.19l-2.47-2.47a.75.75 0 0 1 0-1.06Z",fill:"var(--icon-arrow, var(--dynamic-text-secondary))"})))};const InlineSubmitButton=({disabled:fr,highlighted:br,isFocused:wr,isHovered:Er,className:kr,style:jr,emailSubmitButtonInsideInput:Br=!1})=>Br?jsxRuntimeExports.jsx(IconButton,{"data-testid":"in_line_submit_button",type:"submit",className:classNames$1("inline-submit-button",kr,{"inline-submit-button--active":wr||Er,"inline-submit-button--ready":br}),disabled:fr,style:jr,children:jsxRuntimeExports.jsx(SvgArrowRightBackground,{})}):null,EmailForm=({isLoading:fr,onSubmit:br,isEmailInvalid:wr=!1,currentEmail:Er,emailSubmitButtonInsideInput:kr=!1,buttonCopyKey:jr="dyn_login.email_form.submit_button.label",isDisabled:Br=!1,className:Wr,style:qr})=>{const{t:Gr}=useTranslation(),[Vr,Zr]=reactExports.useState(Er??""),[Jr,Qr]=reactExports.useState(!1),[_n,En]=reactExports.useState(!1),Cn=An=>{const{value:jn}=An.currentTarget;Zr(jn)},In=An=>__awaiter$e(void 0,void 0,void 0,function*(){An.preventDefault(),isEmailValid(Vr)&&(br==null||br(Vr))});return jsxRuntimeExports.jsxs("form",{className:classNames$1("login-with-email-form",Wr),style:qr,"data-testid":"email-form",onSubmit:An=>In(An),children:[jsxRuntimeExports.jsx(Input,{id:"email_field",value:Vr,onChange:Cn,copykey:"dyn_login.email_form.email_field.label",label:Gr("dyn_login.email_form.email_field.label"),error:wr,message:wr&&Gr("dyn_login.helper.email_form.invalid_email"),suffix:jsxRuntimeExports.jsx(InlineSubmitButton,{disabled:fr||Br,highlighted:Vr.length>0,isFocused:_n,isHovered:Jr,emailSubmitButtonInsideInput:kr}),disabled:fr||Br,type:"email",onPointerEnter:()=>Qr(!0),onPointerLeave:()=>Qr(!1),onFocus:()=>En(!0),onBlur:()=>En(!1),autoComplete:"email"}),!kr&&jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"submit_button",buttonClassName:"login-with-email-form__button",type:"submit",loading:fr,disabled:fr||Vr.length<3||Br,buttonVariant:"brand-primary",buttonPadding:"login-screen-height",expanded:!0,copykey:jr,typographyProps:{color:"inherit"},children:Gr(jr)})]})},LoginEmailForm=({isLoading:fr,onSubmit:br,onSubmitError:wr,currentEmail:Er,className:kr,style:jr})=>{var Br,Wr;const{walletConnectorOptions:qr,projectSettings:Gr}=useInternalDynamicContext(),{view:Vr,setView:Zr}=useViewContext(),{setErrorMessage:Jr}=useErrorContext(),{engageCaptcha:Qr}=useCaptchaContext(),[_n,En]=reactExports.useState(!1),Cn=findEmailOtpWalletConnector(qr),{handleEmailSubmitWithOptionalCaptcha:In,isEmailProviderLoading:An}=useEmailProvider({emailWalletConnector:Cn}),jn=reactExports.useMemo(()=>An||fr,[An,fr]),eo=to=>{to.code==="invalid_email_address"?En(!0):Jr(to.code),logger$6.debug(to),wr==null||wr()},ro=to=>__awaiter$e(void 0,void 0,void 0,function*(){var _i;try{if(br==null||br(),!((_i=Gr==null?void 0:Gr.security.hCaptcha)===null||_i===void 0)&&_i.enabled&&(Cn==null?void 0:Cn.key)!=="magicemailotp"){Qr({authMethod:"email",onCaptchaSuccess:oo=>__awaiter$e(void 0,void 0,void 0,function*(){try{yield In(to,oo)}catch(io){Zr(Vr.type),eo(io)}})});return}yield In(to)}catch(oo){eo(oo)}});return isEmailProviderEnabled((Br=Gr==null?void 0:Gr.providers)!==null&&Br!==void 0?Br:[])?jsxRuntimeExports.jsx(EmailForm,{onSubmit:ro,isLoading:jn,currentEmail:Er,emailSubmitButtonInsideInput:(Wr=Gr==null?void 0:Gr.design.modal)===null||Wr===void 0?void 0:Wr.emailSubmitButtonInsideInput,isEmailInvalid:_n,className:kr,style:jr}):(logger$6.error("Failed to render EmailSignInSection - no sign in provider enabled"),null)},AccountExistsView=()=>{const{existentAccountData:fr}=useAccountExistsContext(),{t:br}=useTranslation(),{email:wr,embeddedSocialSigninProvider:Er}=fr||{},kr=getSocialSignInProviderForProviderEnum(Er),{socialProvider:jr,setSocialProvider:Br,socialWalletConnector:Wr}=useSocialRedirectContext(),qr=useFindSocialIcon(),{mutate:Gr}=useMutation(()=>__awaiter$e(void 0,void 0,void 0,function*(){return Br(kr),yield Wr==null?void 0:Wr.endSession(),Wr==null?void 0:Wr.connect(Er)})),Vr=()=>Er?br("dyn_account_exists.description_social"):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[br("dyn_account_exists.description_email")," ",jsxRuntimeExports.jsx("strong",{children:wr})," ",br("dyn_account_exists.trail_message_email")]});return jsxRuntimeExports.jsxs("div",{className:"account-exists__container",children:[jsxRuntimeExports.jsx(UserProfileIcon,{className:"account-exists__image"}),jsxRuntimeExports.jsxs("div",{className:"account-exists__main",children:[jsxRuntimeExports.jsx("div",{className:"account-exists__content",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"account-exists__content--secondary",copykey:"dyn_account_exists",children:Vr()})}),Er?jsxRuntimeExports.jsxs(IconListTile,{dataTestId:`inline-${Er}`,onClick:()=>Gr(),className:"social-sign-in--tile",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:qr(Er),isSpinning:jr===kr,iconSize:32}),jsxRuntimeExports.jsx(Typography,{variant:"button_primary",copykey:"dyn_account_exists.connect",children:br("dyn_account_exists.connect",{socialOauth:capitalize$1(Er==null?void 0:Er.toString())})})]},Er):jsxRuntimeExports.jsx(LoginEmailForm,{isLoading:!1,currentEmail:wr})]})]})},BridgeNextWalletToConnectLayout=({chainName:fr,chainIcon:br,onClickAction:wr,onClickClose:Er})=>{const kr=Er&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:Er,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs("div",{className:"bridge-next-wallet-to-connect-layout",children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:kr,alignContent:"bottom",children:br&&jsxRuntimeExports.jsx("div",{className:"bridge-next-wallet-to-connect-layout__chain-icon",children:br})}),jsxRuntimeExports.jsxs("div",{className:"bridge-next-wallet-to-connect-layout__body",children:[jsxRuntimeExports.jsxs(Typography,{color:"primary",variant:"title",children:["Nice! Now let’s connect your ",fr," wallet"]}),jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,buttonPadding:"large",onClick:wr,children:`Connect ${fr} wallet`})]})]})},BridgeNextWalletConnectionView=()=>{const{setShowAuthFlow:fr,bridgeChainsToConnect:br}=useInternalDynamicContext(),{setView:wr}=useViewContext();if(!(br!=null&&br.length))throw new DynamicError("No wallets to connect");const[Er]=br,{chain:kr}=Er,jr=getChainInfoWithOverrides(kr),Br=getChainIcon(kr);if(!jr)throw new DynamicError("No chain info found for chain",kr);return jsxRuntimeExports.jsx(BridgeNextWalletToConnectLayout,{chainName:jr.blockchainName,chainIcon:jsxRuntimeExports.jsx(Br,{}),onClickAction:()=>wr("wallet-list"),onClickClose:()=>fr(!1,{emitCancelAuth:!0})})},ConnectedWalletsListLayout=({title:fr,body:br,onClickBack:wr,onClickClose:Er,onClickAction:kr,actionButtonText:jr="Continue",children:Br,copykey:Wr})=>{const qr=Er&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:Er,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})}),Gr=wr&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:wr,"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgChevronLeft,{})});return jsxRuntimeExports.jsxs("div",{className:"connected-wallets-list-layout",children:[jsxRuntimeExports.jsx(ModalHeader,{leading:Gr,trailing:qr,children:jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",copykey:Wr,children:fr})}),jsxRuntimeExports.jsxs("div",{className:"connected-wallets-list-layout__body",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",className:"connected-wallets-list-layout__body__text",children:br}),Br,jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"primary",onClick:kr,children:jr})]})]})},BridgeSummaryView=()=>{const{primaryWallet:fr,setShowAuthFlow:br,appName:wr,bridgeChains:Er=[]}=useInternalDynamicContext(),{t:kr}=useTranslation(),jr=()=>br(!1,{emitCancelAuth:!0}),Br=reactExports.useMemo(()=>{const qr=Er.map(({chain:Zr})=>{var Jr;return(Jr=getChainInfoWithOverrides(Zr))===null||Jr===void 0?void 0:Jr.blockchainName}),[Gr,Vr]=qr;return kr("dyn_bridge.summary_view.connection_succeed",{firstBlockchainName:Gr,secondBlockchainName:Vr})},[Er,kr]),Wr=qr=>{const Gr=getChainIcon(qr.chain),Vr=getChainInfoWithOverrides(qr.chain);return jsxRuntimeExports.jsx(DynamicBridgeWalletCard,{networkIcon:jsxRuntimeExports.jsx(Gr,{}),networkName:Vr==null?void 0:Vr.displayName,children:jsxRuntimeExports.jsx(DynamicBridgeWalletCardBody,{walletKey:qr.connector.key,walletAddress:qr.address,walletBalance:jsxRuntimeExports.jsx(Balance,{wallet:qr,network:qr.chain})})})};return jsxRuntimeExports.jsxs(ConnectedWalletsListLayout,{onClickClose:jr,onClickAction:jr,copykey:"dyn_bridge.summary_view.title",title:kr("dyn_bridge.summary_view.title",{appName:wr}),body:Br,children:[fr&&Wr(fr),jsxRuntimeExports.jsx(MemoSecondaryWallets,{hideUnlinkAction:!0})]})},BridgeWelcomeLayout=({body:fr,chains:br=[],onClickAction:wr,onClickClose:Er,title:kr,actionButtonText:jr,copykey:Br})=>{const Wr=Er&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:Er,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs("div",{className:"bridge-welcome-layout",children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Wr,alignContent:"bottom",children:jsxRuntimeExports.jsx("div",{className:"bridge-welcome-layout__chain-icon-group",children:[...br].reverse().map((qr,Gr)=>jsxRuntimeExports.jsx("div",{className:"bridge-welcome-layout__chain-icon",style:{zIndex:Gr},children:qr.icon},qr.id))})}),jsxRuntimeExports.jsxs("div",{className:"bridge-welcome-layout__body",children:[jsxRuntimeExports.jsxs("div",{className:"bridge-welcome-layout__message-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",copykey:Br,children:kr}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",children:fr})]}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Stepper,{children:br.map(qr=>jsxRuntimeExports.jsx(Step,{children:qr.name},qr.id))})}),jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"primary",buttonPadding:"large",onClick:wr,children:jr})]})]})},isChainInfoDefined=fr=>fr!==void 0,BridgeWelcomeView=()=>{const{appName:fr,bridgeChains:br=[],setShowAuthFlow:wr}=useInternalDynamicContext(),{setView:Er}=useViewContext(),{t:kr}=useTranslation(),jr=reactExports.useMemo(()=>{const Wr=br.map(({chain:Vr})=>{var Zr;return(Zr=getChainInfoWithOverrides(Vr))===null||Zr===void 0?void 0:Zr.blockchainName}),[qr,Gr]=Wr;return kr("dyn_bridge.welcome_view.description",{firstBlockchainName:qr,secondBlockchainName:Gr})},[br,kr]),Br=reactExports.useMemo(()=>br.map(({chain:Wr},qr)=>{const Gr=getChainInfoWithOverrides(Wr),Vr=getChainIcon(Wr);if(Gr&&Vr)return{icon:jsxRuntimeExports.jsx(Vr,{}),id:qr,name:Gr.blockchainName}}).filter(isChainInfoDefined),[br]);return jsxRuntimeExports.jsx(BridgeWelcomeLayout,{onClickClose:()=>wr(!1,{emitCancelAuth:!0}),title:kr("dyn_bridge.welcome_view.title",{appName:fr}),copykey:"dyn_bridge.welcome_view.title",body:jr,chains:Br,actionButtonText:kr("dyn_bridge.welcome_view.button"),onClickAction:()=>Er("wallet-list")})},Captcha=({handleSuccess:fr})=>{var br;const{projectSettings:wr}=useInternalDynamicContext();return!((br=wr==null?void 0:wr.security.hCaptcha)===null||br===void 0)&&br.siteKey?jsxRuntimeExports.jsx("form",{"data-testid":"captcha-form",children:jsxRuntimeExports.jsx(HCaptcha,{sitekey:wr.security.hCaptcha.siteKey,onVerify:Er=>fr(Er),theme:document.body.dataset.dynamicTheme})}):null},CaptchaVerifyUser=()=>{const{t:fr}=useTranslation(),{captchaAuthState:br,setCaptchaToken:wr}=useCaptchaContext(),Er=kr=>__awaiter$e(void 0,void 0,void 0,function*(){var jr;wr(kr),yield(jr=br==null?void 0:br.onCaptchaSuccess)===null||jr===void 0?void 0:jr.call(br,kr)});return jsxRuntimeExports.jsxs("div",{className:"captcha-verify-user__container",children:[jsxRuntimeExports.jsx(CaptchaWaveIcon,{className:"captcha-verify-user__icon"}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",color:"primary",className:"captcha-verify-user__title",copykey:"dyn_captcha.verify_user_title",children:fr("dyn_captcha.verify_user_title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"captcha-verify-user__subtitle",copykey:"dyn_captcha.verify_user_subtitle",children:fr("dyn_captcha.verify_user_subtitle")}),jsxRuntimeExports.jsx(Captcha,{handleSuccess:Er}),jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"captcha-verify-user__dynamic-logo"})]})};var _path$u,_excluded$C=["title","titleId"];function _extends$C(){return _extends$C=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$C(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgAltKey=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$C(br,_excluded$C);return reactExports.createElement("svg",_extends$C({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$u||(_path$u=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 4a5 5 0 0 0-4.786 6.453 1 1 0 0 1-.25.997L4 17.414V20h2v-1a1 1 0 0 1 1-1h1v-1a1 1 0 0 1 1-1h1.586l1.964-1.964a1 1 0 0 1 .997-.25A5 5 0 1 0 15 4ZM8 20v1a1 1 0 0 1-1 1H4a2 2 0 0 1-2-2v-2.586A2 2 0 0 1 2.586 16l5.562-5.562a7 7 0 1 1 5.414 5.414l-1.855 1.855A1 1 0 0 1 11 18h-1v1a1 1 0 0 1-1 1H8Zm6-13a1 1 0 0 1 1-1 3 3 0 0 1 3 3 1 1 0 1 1-2 0 1 1 0 0 0-1-1 1 1 0 0 1-1-1Z",fill:"#383C48",fillOpacity:.4})))},_path$t,_excluded$B=["title","titleId"];function _extends$B(){return _extends$B=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$B(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgLock=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$B(br,_excluded$B);return reactExports.createElement("svg",_extends$B({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$t||(_path$t=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 7a5 5 0 0 1 10 0v3h1a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-6a3 3 0 0 1 3-3h1V7Zm2 3h6V7a3 3 0 1 0-6 0v3Zm-3 2a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1H6Zm6 2a1 1 0 0 1 1 1v2a1 1 0 1 1-2 0v-2a1 1 0 0 1 1-1Z",fill:"#383C48",fillOpacity:.4})))},_path$s,_path2$4,_path3$3,_path4$2,_g$9,_path5$2,_defs$9,_excluded$A=["title","titleId"];function _extends$A(){return _extends$A=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$A(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgWalletClaimHero=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$A(br,_excluded$A);return reactExports.createElement("svg",_extends$A({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,reactExports.createElement("g",{clipPath:"url(#wallet-claim-hero_svg__a)"},reactExports.createElement("mask",{id:"wallet-claim-hero_svg__b",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:0,y:0,width:327,height:112},_path$s||(_path$s=reactExports.createElement("path",{d:"M315 0H12C5.373 0 0 5.373 0 12v88c0 6.627 5.373 12 12 12h303c6.627 0 12-5.373 12-12V12c0-6.627-5.373-12-12-12Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#wallet-claim-hero_svg__b)"},_path2$4||(_path2$4=reactExports.createElement("path",{d:"M164 228c62.96 0 114-51.04 114-114S226.96 0 164 0 50 51.04 50 114s51.04 114 114 114Z",fill:"url(#wallet-claim-hero_svg__c)",fillOpacity:.12})),reactExports.createElement("mask",{id:"wallet-claim-hero_svg__d",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:86,y:29,width:40,height:40},_path3$3||(_path3$3=reactExports.createElement("path",{d:"M116.91 29 86 37.282l8.282 30.91 30.91-8.282L116.91 29Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#wallet-claim-hero_svg__d)"},reactExports.createElement("mask",{id:"wallet-claim-hero_svg__e",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:90,y:33,width:31,height:31},_path4$2||(_path4$2=reactExports.createElement("path",{d:"M119.763 44.8c-2.097-7.824-10.139-12.467-17.963-10.371-7.824 2.096-12.468 10.139-10.371 17.963 2.096 7.824 10.139 12.467 17.963 10.37 7.824-2.096 12.467-10.138 10.371-17.962Z",fill:"#fff"}))),_g$9||(_g$9=reactExports.createElement("g",{mask:"url(#wallet-claim-hero_svg__e)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M118.709 55.166a14.617 14.617 0 0 0 1.054-10.366c-2.097-7.824-10.139-12.467-17.963-10.371-7.825 2.096-12.468 10.139-10.371 17.963a14.612 14.612 0 0 0 6.097 8.451c1.808-3.916 6.565-6.42 9.647-7.247 3.083-.826 7.955-1.146 11.536 1.57Zm-19.375-8.688a5.5 5.5 0 1 1 10.625-2.848 5.5 5.5 0 0 1-10.625 2.848Z",fill:"#4779FF"})))),_path5$2||(_path5$2=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.269 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.89 32.064a6.223 6.223 0 0 0-1.78 0c-.68.098-1.313.337-1.815.527l-.135.05-16.681 6.256-.406.152c-1.922.718-3.61 1.348-4.91 2.493a9.333 9.333 0 0 0-2.552 3.683c-.616 1.62-.614 3.421-.611 5.473l.001.434V66.01c0 8.793 4.782 16.125 9.952 21.51 5.205 5.422 11.159 9.252 14.308 11.089l.127.075c.575.337 1.321.775 2.307.987a6.624 6.624 0 0 0 2.61 0c.986-.212 1.732-.65 2.307-.987l.127-.075c3.149-1.837 9.103-5.667 14.308-11.088 5.17-5.386 9.952-12.718 9.952-21.511V51.13l.001-.433c.003-2.052.005-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.988-1.775-4.91-2.493-.134-.05-.27-.1-.406-.152l-16.681-6.255-.135-.05c-.502-.19-1.135-.43-1.815-.528Zm-6.946 16.362a9.282 9.282 0 1 1 13.127 13.128 9.282 9.282 0 0 1-13.127-13.128Zm3.282 3.282a4.64 4.64 0 1 1 6.563 6.563 4.64 4.64 0 0 1-6.563-6.563Zm3.515 14.885a11.63 11.63 0 0 1-2.945-.377v15.598h4.641v-4.51h4.601v-4.642h-4.601V66.47a11.69 11.69 0 0 1-1.696.123Z",fill:"#4779FF"})))),_defs$9||(_defs$9=reactExports.createElement("defs",null,reactExports.createElement("linearGradient",{id:"wallet-claim-hero_svg__c",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})),reactExports.createElement("clipPath",{id:"wallet-claim-hero_svg__a"},reactExports.createElement("path",{fill:"#fff",d:"M0 0h327v112H0z"})))))};const CoinbaseMPCClaimIntro=()=>{const{setShowAuthFlow:fr}=useInternalDynamicContext(),{setView:br}=useViewContext(),{t:wr}=useTranslation(),Er=jsxRuntimeExports.jsx(IconButton,{onClick:()=>fr(!1),type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Er,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_create_password.intro.title",children:wr("dyn_create_password.intro.title")})}),jsxRuntimeExports.jsx("div",{className:"mpc-claim-intro",children:jsxRuntimeExports.jsxs("div",{className:"mpc-claim-intro__body",children:[jsxRuntimeExports.jsx("div",{className:"mpc-claim-intro__body__description",children:jsxRuntimeExports.jsx(SvgWalletClaimHero,{})}),jsxRuntimeExports.jsx("div",{className:"confirm-password-description",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_create_password.intro.description",children:wr("dyn_create_password.intro.description.title")})}),jsxRuntimeExports.jsxs("div",{className:"mpc-claim-intro__body__card",children:[jsxRuntimeExports.jsxs("div",{className:"mpc-claim-intro__body__card__statement",children:[jsxRuntimeExports.jsx("div",{className:"mpc-claim-intro__body__card__icon",children:jsxRuntimeExports.jsx(SvgLock,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_create_password.intro.description.additional_protection.title",children:wr("dyn_create_password.intro.description.additional_protection.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",weight:"regular",copykey:"dyn_create_password.intro.description.additional_protection.description",children:wr("dyn_create_password.intro.description.additional_protection.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mpc-claim-intro__body__card__statement",children:[jsxRuntimeExports.jsx("div",{className:"mpc-claim-intro__body__card__icon",children:jsxRuntimeExports.jsx(SvgAltKey,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_create_password.intro.description.restore_access.title",children:wr("dyn_create_password.intro.description.restore_access.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",weight:"regular",copykey:"dyn_create_password.intro.description.restore_access.description",children:wr("dyn_create_password.intro.description.restore_access.description")})]})]})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},onClick:()=>{br("create-password-view",{notCalledFromWalletUtils:!0})},copykey:"dyn_create_password.intro.continue",children:wr("dyn_create_password.intro.continue")})]})})]})};var _path$r,_excluded$z=["title","titleId"];function _extends$z(){return _extends$z=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$z(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgCheckConnection=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$z(br,_excluded$z);return reactExports.createElement("svg",_extends$z({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$r||(_path$r=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm12.845-39.155a1.667 1.667 0 1 0-2.357-2.357L27.5 37.976l-5.488-5.488a1.667 1.667 0 1 0-2.357 2.357l6.666 6.667c.651.65 1.707.65 2.357 0l16.667-16.667Z",fill:"#4779FF"})))};const createSmsVerification=fr=>__awaiter$e(void 0,[fr],void 0,function*({isoCountryCode:br,phoneNumber:wr,phoneCountryCode:Er,environmentId:kr,captchaToken:jr}){try{return yield sdkApi$1().createSmsVerification({environmentId:kr,smsVerificationCreateRequest:{captchaToken:jr,isoCountryCode:br,phoneCountryCode:Er,phoneNumber:wr}})}catch(Br){const Wr=yield Br.json();throw logger$6.error(Wr.error),new SmsVerificationError(Wr.error,Wr.code)}}),signInWithSmsVerification=fr=>__awaiter$e(void 0,[fr],void 0,function*({verificationToken:br,verificationUUID:wr,environmentId:Er,captchaToken:kr,sessionPublicKey:jr}){var Br;try{return yield sdkApi$1().signInWithSmsVerification({environmentId:Er,smsVerificationVerifyRequest:{captchaToken:kr,sessionPublicKey:jr,verificationToken:br,verificationUUID:wr}})}catch(Wr){const qr=yield Wr.json();throw logger$6.error(qr.error),((Br=qr.error)===null||Br===void 0?void 0:Br.code)==="missing_from_list"?new NoAccessError({phoneNumber:qr.payload.phoneNumber}):qr.code==="wrong_sms_verification_token"?new SmsVerificationError(Locale.getInstance().t("dyn_login.helper.phone_number_form.invalid_sms_verification"),qr.code):qr.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(qr.error.message):new SmsVerificationError(qr.error,qr.code)}}),retrySmsVerification=fr=>__awaiter$e(void 0,[fr],void 0,function*({isoCountryCode:br,phoneCountryCode:wr,phoneNumber:Er,environmentId:kr,verificationUUID:jr}){try{return yield sdkApi$1().retrySmsVerification({environmentId:kr,smsVerificationRetryRequest:{isoCountryCode:br,phoneCountryCode:wr,phoneNumber:Er,verificationUUID:jr}})}catch(Br){const Wr=yield Br.json();throw logger$6.error(Wr.error),new SmsVerificationError(Wr.error,Wr.code)}}),verifySms=fr=>__awaiter$e(void 0,[fr],void 0,function*({verificationToken:br,verificationUUID:wr,environmentId:Er}){try{return yield sdkApi$1().verifySmsVerification({environmentId:Er,smsVerificationVerifyRequest:{verificationToken:br,verificationUUID:wr}})}catch(kr){const jr=yield kr.json();throw logger$6.error(jr.error),jr.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(jr.error.message):new SmsVerificationError(jr.error,jr.code)}}),useOtpVerificationRequestRaw=()=>{const{environmentId:fr,user:br,userWithMissingInfo:wr}=useInternalDynamicContext(),{verificationUUID:Er}=useVerification();return{verifyOtp:reactExports.useCallback((jr,Br,Wr,qr)=>__awaiter$e(void 0,void 0,void 0,function*(){var Gr;if(!br&&!wr)throw new DynamicError(USER_NOT_LOGGED_IN);if(!qr&&!Er)throw new DynamicError("No verification UUID is available");const Jr=yield(Wr==="email"?verifyEmail:verifySms)({environmentId:fr,verificationToken:Br,verificationUUID:qr??Er}),Qr=Jr.user,_n=(Gr=Qr==null?void 0:Qr.missingFields)!==null&&Gr!==void 0?Gr:[],En=getVerificationDestination(Jr.nextView);return storeAuthTokenAndUser(Jr),En?jr({destination:En,missingFields:_n,updateUserProfileResponse:Jr}):{isEmailVerificationRequired:!1,isSmsVerificationRequired:!1,missingFields:_n,updateUserProfileResponse:Jr}}),[Er,fr,br,wr])}},useOtpVerificationRequest=()=>{const fr=useHandleVerificationRequired(),{verifyOtp:br}=useOtpVerificationRequestRaw();return reactExports.useMemo(()=>({verifyOtp:(wr,Er,kr)=>br(fr,wr,Er,kr)}),[fr,br])},getResponseInfo=(fr,br)=>{var wr,Er,kr,jr,Br,Wr,qr;return br==="email"?{displayDestination:(wr=fr.emailVerification)===null||wr===void 0?void 0:wr.email,verificationUUID:(Er=fr.emailVerification)===null||Er===void 0?void 0:Er.verificationUUID}:{displayDestination:formatPhone("+"+((jr=(kr=fr.smsVerification)===null||kr===void 0?void 0:kr.phoneCountryCode)!==null&&jr!==void 0?jr:"")+((Wr=(Br=fr.smsVerification)===null||Br===void 0?void 0:Br.phoneNumber)!==null&&Wr!==void 0?Wr:"")),verificationUUID:(qr=fr.smsVerification)===null||qr===void 0?void 0:qr.verificationUUID}},getVerificationDestination=fr=>{if(fr===NextViewEnum.VerifyEmail)return"email";if(fr===NextViewEnum.VerifySms)return"sms"},useHandleVerificationRequired=()=>{const{setVerificationUUID:fr,setDisplayedDestination:br}=useVerification(),{environmentId:wr}=useInternalDynamicContext(),{verifyOtp:Er}=useOtpVerificationRequestRaw(),kr=reactExports.useCallback((Br,Wr)=>__awaiter$e(void 0,void 0,void 0,function*(){if(Br==="email"&&Wr.emailVerification||Br==="sms"&&Wr.smsVerification)return Wr;const qr=Br==="email"?"email":"phoneNumber";if(!Wr.user[qr])throw new VerificationDataCollectionError(`missing ${qr} field to perform update`);const Gr=yield userFieldsSchema.validate({[qr]:Wr.user[qr]}),{emailVerification:Vr,smsVerification:Zr}=yield updateUserProfileFields(wr,Gr);if(Br==="email"&&!Vr||Br==="sms"&&!Zr)throw new VerificationDataCollectionError(`could not get ${Br} verification data from api`);return Object.assign(Object.assign({},Wr),{emailVerification:Vr,smsVerification:Zr})}),[wr]),jr=reactExports.useCallback(Br=>__awaiter$e(void 0,[Br],void 0,function*({updateUserProfileResponse:Wr,missingFields:qr,destination:Gr}){const Vr=yield kr(Gr,Wr),{displayDestination:Zr,verificationUUID:Jr}=getResponseInfo(Vr,Gr);br(Zr),fr(Jr);const Qr=_n=>__awaiter$e(void 0,void 0,void 0,function*(){return Er(jr,_n,Gr,Jr)});return Gr==="email"?{isEmailVerificationRequired:!0,isSmsVerificationRequired:!1,missingFields:qr,updateUserProfileResponse:Vr,verifyOtp:Qr}:{isEmailVerificationRequired:!1,isSmsVerificationRequired:!0,missingFields:qr,updateUserProfileResponse:Vr,verifyOtp:Qr}}),[kr,br,fr,Er]);return jr},useUpdateUser=fr=>{const{environmentId:br,userWithMissingInfo:wr,setCallback:Er}=useInternalDynamicContext(),{setRetryData:kr}=useVerification(),{selectedPhoneCountry:jr}=useFieldsState(),Br=useHandleVerificationRequired();return reactExports.useCallback((qr,Gr)=>__awaiter$e(void 0,void 0,void 0,function*(){var Vr,Zr;let{metadata:Jr}=qr;Jr=Jr?Object.assign(Object.assign({},wr==null?void 0:wr.metadata),Jr):wr==null?void 0:wr.metadata;const Qr=yield userFieldsSchema.validate(qr,{stripUnknown:fr});Qr.phoneNumber&&Qr.phoneNumber.length>0&&jr.current&&kr({dialCode:jr.current.dialCode,iso2:jr.current.iso2,phone:Qr.phoneNumber});const _n=yield updateUserProfileFields((Vr=Gr==null?void 0:Gr.userEnvironmentId)!==null&&Vr!==void 0?Vr:br,Object.assign(Object.assign({},Qr),{metadata:Jr})),En=(Zr=_n.user.missingFields)!==null&&Zr!==void 0?Zr:[],Cn=getVerificationDestination(_n.nextView);return Cn?Br({destination:Cn,missingFields:En,updateUserProfileResponse:_n}):(Er("userProfileUpdate"),{isEmailVerificationRequired:!1,isSmsVerificationRequired:!1,missingFields:En,updateUserProfileResponse:_n})}),[wr==null?void 0:wr.metadata,fr,jr,kr,br,Br,Er])},validateUpdateRequest=(fr,br,wr)=>{if(!fr.length)return"At least one field must be provided for editing";if(!br)return"No signed-in user";const Er=getUserProfileFields({customFields:wr==null?void 0:wr.customFields,projectSettingsKyc:wr==null?void 0:wr.kyc,user:br});for(const kr of fr)if(!Er.find(({name:jr})=>jr===kr))return`Please ensure field "${kr}" is enabled under "Configurations > Onboarding > Information capture" in your app's dashboard before using it with updateUserWithModal`;return""},saveUserValues=(fr,br,wr,Er,kr)=>__awaiter$e(void 0,[fr,br,wr,Er,kr],void 0,function*({fields:jr,updateUserResult:{isEmailVerificationRequired:Br,isSmsVerificationRequired:Wr}},qr,Gr,Vr,Zr){if(!Br&&!Wr){Vr(jr);return}if(qr(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1}),Br){Gr("verify-email"),dynamicEvents.once("emailVerificationResult",(Jr,Qr)=>{jr.email=Qr,Jr?Vr(jr):Zr("Failed to verify email, no fields were updated")});return}Gr("verify-sms"),dynamicEvents.once("smsVerificationResult",(Jr,{phone:Qr})=>{jr.phoneNumber=Qr,Jr?Vr(jr):Zr("Failed to verify phone number, no fields were updated")})}),useUpdateUserWithModal=fr=>{const{user:br,projectSettings:wr,setShowAuthFlow:Er}=useInternalDynamicContext(),{setView:kr}=useViewContext(),jr=reactExports.useContext(UserFieldEditorContext);if(!jr)throw new DynamicError("useUserUpdateRequest can only be used inside the context of DynamicContextProvider");const{open:Br}=jr;return reactExports.useCallback((qr,Gr)=>new Promise((Vr,Zr)=>{const Jr=validateUpdateRequest(qr,br,wr);if(Jr){Zr(Jr);return}Br({fields:qr,submitText:Gr==null?void 0:Gr.submitText,subtitle:Gr==null?void 0:Gr.subtitle,title:Gr==null?void 0:Gr.title},fr).then(Qr=>saveUserValues(Qr,Er,kr,Vr,Zr)).catch(Qr=>{if(/email already exists/gi.test(Qr))throw Qr;Zr(Qr)})}),[br,wr,Br,fr,Er,kr])},useUserUpdateRequestInternal=({validationSchemaStripUnknown:fr})=>{const br=useUpdateUser(fr),wr=useUpdateUserWithModal(br);return{updateUser:br,updateUserWithModal:wr}},OnboardingUserDataForm=({children:fr,userProfile:br,disableSubmit:wr})=>{const{policiesConsentInnerComponent:Er,userWithMissingInfo:kr}=useInternalDynamicContext(),{error:jr}=useErrorContext(),{completeAuth:Br}=useUserAuth({}),{updateUser:Wr}=useUserUpdateRequestInternal({validationSchemaStripUnknown:!1}),qr=reactExports.useCallback(En=>__awaiter$e(void 0,void 0,void 0,function*(){yield Br({updateJwtFunction:()=>__awaiter$e(void 0,void 0,void 0,function*(){return Wr(En)})})}),[Br,Wr]),{fetch:Gr,formikInitialValues:Vr,formikValidationSchema:Zr,enforcePolicies:Jr,onFormSubmit:Qr}=useUserDataForm({fields:(kr==null?void 0:kr.missingFields)||[],onSubmit:qr,userProfile:br}),_n=[Er].flat();return jsxRuntimeExports.jsx(Formik,{onSubmit:Qr,initialValues:Vr,validationSchema:Zr,children:({errors:En,touched:Cn,values:In})=>{var An;const jn=wr||Jr&&(_n==null?void 0:_n.length)!==((An=In.policiesConsentArray)===null||An===void 0?void 0:An.length);return jsxRuntimeExports.jsx(Form,{className:"user-data-form__form",children:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[fr,jr&&jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",className:"user-data-form__error",children:jr}),jsxRuntimeExports.jsx(UserDataFields,{fields:kr==null?void 0:kr.missingFields,errors:En,touched:Cn,policiesConsentInnerComponentArray:_n}),jsxRuntimeExports.jsx(TypographyButton,{type:"submit",loading:Gr,disabled:jn,buttonVariant:"primary",expanded:!0,buttonPadding:"login-screen-height",children:"Continue"})]})})}})},CollectUserDataView=()=>{var fr;const{appName:br,projectSettings:wr,network:Er,selectedWalletConnector:kr,handleLogOut:jr,onboardingImageUrl:Br,userWithMissingInfo:Wr}=useInternalDynamicContext(),[qr,Gr]=reactExports.useState(!1),Vr=useFetchNameService(),{t:Zr}=useTranslation();if(!Wr)return null;const Jr=(kr==null?void 0:kr.evmNetworks)||[],_n=!(!Er||isSupportedNetwork({network:Er,walletConnector:kr}))&&!!kr,En=(fr=Wr==null?void 0:Wr.verifiedCredentials.find(Cn=>Cn.id===Wr.lastVerifiedCredentialId))===null||fr===void 0?void 0:fr.address;return jsxRuntimeExports.jsxs("div",{className:"collect-user-data","data-testid":"collect-user-data-view",children:[jsxRuntimeExports.jsxs("div",{className:"collect-user-data__network-container",children:[jsxRuntimeExports.jsxs("div",{className:"collect-user-data__img-container",children:[Vr!=null&&Vr.avatar?jsxRuntimeExports.jsx("img",{src:Vr.avatar,alt:"",className:"collect-user-data__img collect-user-data__img--rounded"}):jsxRuntimeExports.jsx(AuthProviderIcon,{iconSize:28}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"medium",className:"collect-user-data__wallet-address",children:(Vr==null?void 0:Vr.name)||shortenWalletAddress(En,3,3)})]}),kr&&jsxRuntimeExports.jsx(NetworkPicker,{currentNetwork:Er,evmNetworks:Jr,connector:kr,showNetworkName:!0,isNetworkPickerOpen:qr,setIsNetworkPickerOpen:Gr,buttonClassName:"collect-user-data__network-picker-button",mainClassName:"collect-user-data__network-picker"})]}),Br&&jsxRuntimeExports.jsx("img",{className:"collect-user-data__main-img",src:Br,alt:"onboarding"}),_n&&jsxRuntimeExports.jsx(ErrorContainer,{withIcon:!1,className:"collect-user-data__error--not-supported",copykey:"dyn_collect_user_data.not_supported_network.error_message",children:Zr("dyn_collect_user_data.not_supported_network.error_message")}),jsxRuntimeExports.jsxs("div",{className:classNames$1("collect-user-data__form",{"collect-user-data__form--error":_n}),children:[jsxRuntimeExports.jsx("div",{className:"collect-user-data__success-icon",children:jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"large",children:jsxRuntimeExports.jsx(SvgCheckConnection,{})})}),jsxRuntimeExports.jsx(OnboardingUserDataForm,{disableSubmit:_n,userProfile:Wr,children:_n?jsxRuntimeExports.jsxs("div",{className:"collect-user-data__welcome-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"collect-user-data__welcome-title",copykey:"dyn_collect_user_data.not_supported_network.title",children:Zr("dyn_collect_user_data.not_supported_network.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_collect_user_data.not_supported_network.description",children:Zr("dyn_collect_user_data.not_supported_network.description")})]}):jsxRuntimeExports.jsxs("div",{className:"collect-user-data__welcome-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"collect-user-data__welcome-title",copykey:"dyn_collect_user_data.greeting",children:(wr==null?void 0:wr.general.collectUserDataWelcomeHeader)||Zr("dyn_collect_user_data.greeting",{appName:br})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_collect_user_data.description",children:(wr==null?void 0:wr.general.collectUserDataWelcomeMessage)||Zr("dyn_collect_user_data.description")})]})}),jsxRuntimeExports.jsx(TextButton,{className:"collect-user-data__log-out",onClick:jr,copykey:"dyn_collect_user_data.log_out_button",children:Zr("dyn_collect_user_data.log_out_button")})]})]})},CollectUserDataViewNoWallet=({userIdentification:fr,userIdentificationOverride:br})=>{var wr;const{appName:Er,handleLogOut:kr,projectSettings:jr,onboardingImageUrl:Br,userWithMissingInfo:Wr}=useInternalDynamicContext(),{t:qr}=useTranslation();return Wr?jsxRuntimeExports.jsxs("div",{className:"collect-user-data-login-no-wallet","data-testid":"collect-user-data-login-no-wallet",children:[Br&&jsxRuntimeExports.jsx("img",{className:"collect-user-data-login-no-wallet__main-img",src:Br,alt:"onboarding"}),jsxRuntimeExports.jsxs("div",{className:"collect-user-data-login-no-wallet__user-info-container",children:[jsxRuntimeExports.jsx("div",{className:"collect-user-data-login-no-wallet__icon-container",children:jsxRuntimeExports.jsx(UserAvatar,{user:Wr})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"medium",className:"collect-user-data-login-no-wallet__user-identification",children:(wr=br??Wr[fr])!==null&&wr!==void 0?wr:getUserIdentifier(Wr)})]}),jsxRuntimeExports.jsxs("div",{className:"collect-user-data-login-no-wallet__form",children:[jsxRuntimeExports.jsx("div",{className:"collect-user-data-login-no-wallet__success-icon",children:jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"large",children:jsxRuntimeExports.jsx(SvgCheckConnection,{})})}),jsxRuntimeExports.jsx(OnboardingUserDataForm,{userProfile:Wr,children:jsxRuntimeExports.jsxs("div",{className:"collect-user-data-login-no-wallet__welcome-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"collect-user-data-login-no-wallet__welcome-title",copykey:"dyn_collect_user_data.greeting",children:(jr==null?void 0:jr.general.collectUserDataWelcomeHeader)||qr("dyn_collect_user_data.greeting",{appName:Er})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_collect_user_data.description",children:(jr==null?void 0:jr.general.collectUserDataWelcomeMessage)||qr("dyn_collect_user_data.description")})]})}),jsxRuntimeExports.jsx(TextButton,{className:"collect-user-data-login-no-wallet__log-out",onClick:kr,copykey:"dyn_collect_user_data.log_out_button",children:qr("dyn_collect_user_data.log_out_button")})]})]}):null};var _path$q,_excluded$y=["title","titleId"];function _extends$y(){return _extends$y=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$y(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgPasswordHero=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$y(br,_excluded$y);return reactExports.createElement("svg",_extends$y({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$q||(_path$q=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm-7.618-38.89v-4.037a8.074 8.074 0 0 1 16.147 0v4.036a13.436 13.436 0 0 1 5.383 10.766c0 7.431-6.025 13.456-13.456 13.456-7.432 0-13.456-6.025-13.456-13.456 0-4.402 2.114-8.31 5.382-10.765Zm13.147-1.702v-2.335a5.074 5.074 0 0 0-10.147 0v2.336a13.416 13.416 0 0 1 5.074-.99c1.795 0 3.507.352 5.073.99ZM34.5 36.663a3.5 3.5 0 1 0-3 0V39.5a1.5 1.5 0 0 0 3 0v-2.837Z",fill:"#4779FF"})))};const validatePassword=fr=>{const br=fr.length>=6,wr=/[A-Z]/.test(fr),Er=/[a-z]/.test(fr),kr=/\d/.test(fr),jr=/\W/.test(fr);let Br=[Er,wr,kr,jr,br].filter(Boolean).length;return Br>=3&&fr.length>=12&&(Br=5),{hasLowerCase:Er,hasNonalphas:jr,hasNumbers:kr,hasProperLength:br,hasUpperCase:wr,securityCriteria:[{description:"Password is atleast 6 characters in length",key:"hasProperLength",value:br},{description:"Contains at least one uppercase letter",key:"hasUpperCase",value:wr},{description:"Contains at least one lowercase letter",key:"hasLowerCase",value:Er},{description:"Contains at least one number",key:"hasNumbers",value:kr},{description:"Contains at least one non-alphanumeric character",key:"hasNonalphas",value:jr}],strength:Br}};var _path$p,_excluded$x=["title","titleId"];function _extends$x(){return _extends$x=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$x(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgEyeOffIcon=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$x(br,_excluded$x);return reactExports.createElement("svg",_extends$x({xmlns:"http://www.w3.org/2000/svg",width:25,height:24,viewBox:"0 0 25 24",fill:"none","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$p||(_path$p=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.793 2.293a1 1 0 0 1 1.414 0l3.04 3.04A10.955 10.955 0 0 1 12.5 4c4.927 0 9.095 3.238 10.497 7.7a1 1 0 0 1 0 .6 11.014 11.014 0 0 1-3.552 5.231l2.762 2.762a1 1 0 0 1-1.414 1.414l-18-18a1 1 0 0 1 0-1.414Zm5.943 4.53 1.732 1.731a4 4 0 0 1 5.478 5.478l2.076 2.076A9.022 9.022 0 0 0 20.989 12 9.004 9.004 0 0 0 8.736 6.822Zm5.696 5.695a2 2 0 0 0-2.45-2.45l2.45 2.45ZM5.125 8.174a1 1 0 0 1 .194 1.4A8.975 8.975 0 0 0 4.012 12a9.004 9.004 0 0 0 10.177 5.842 1 1 0 0 1 .372 1.965c-.668.127-1.357.193-2.06.193-4.927 0-9.095-3.238-10.497-7.7a1 1 0 0 1 0-.6 10.97 10.97 0 0 1 1.72-3.332 1 1 0 0 1 1.4-.194Z",fill:"#ABACB2"})))};const ToggleVisibilityButton=({initialState:fr=!1,onClick:br,className:wr=""})=>{const[Er,kr]=reactExports.useState(fr),jr=Br=>{Br.preventDefault(),kr(Wr=>{const qr=!Wr;return br==null||br(qr),qr})};return jsxRuntimeExports.jsx(TextButton,{className:classNames$1("toggle-visibility-button__container",wr),onClick:Br=>jr(Br),children:jsxRuntimeExports.jsx(Tooltip$2,{className:"toggle-visibility-button__tooltip",content:Er?"Show":"Hide",children:jsxRuntimeExports.jsx(Icon,{size:"medium",color:"text-tertiary",children:Er?jsxRuntimeExports.jsx(SvgFooterEyeIcon,{}):jsxRuntimeExports.jsx(SvgEyeOffIcon,{})})})})},CreatePasswordStep=({password:fr,setPassword:br,currentPassword:wr,setCurrentPassword:Er,onContinue:kr,isChangingPassword:jr,onClose:Br,onLogout:Wr})=>{const{primaryWallet:qr}=useInternalDynamicContext(),[Gr,Vr]=reactExports.useState("password"),[Zr,Jr]=reactExports.useState("password"),Qr=validatePassword(fr).strength,[_n,En]=reactExports.useState(Qr),[Cn,In]=reactExports.useState(""),[An,jn]=reactExports.useState("password"),[eo,ro]=reactExports.useState(!1),[to,_i]=reactExports.useState(""),{t:oo}=useTranslation(),io=!!((fr==null?void 0:fr.length)>=6&&_n>=5&&Cn===fr&&(!jr||wr&&wr!==fr)),co=Br&&jsxRuntimeExports.jsx(IconButton,{onClick:()=>Br(),type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})}),so=(Xr,Sn,Rn=!0)=>jsxRuntimeExports.jsxs("div",{className:"create-password__password-input__suffix",children:[Rn&&jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(CopyButton,{textToCopy:fr,copykey:"dyn_qr_code.copy_button",className:"create-password__password-input__suffix__icon",children:jsxRuntimeExports.jsx(SvgCopy,{className:"create-password__password-input__suffix__icon",onClick:Pn=>{Pn.preventDefault()}})})}),jsxRuntimeExports.jsx(ToggleVisibilityButton,{initialState:Xr==="password",onClick:Pn=>Sn(Pn?"password":"text"),className:"create-password__password-input__suffix__icon"})]}),no=Xr=>__awaiter$e(void 0,void 0,void 0,function*(){Xr.preventDefault();const Sn=qr==null?void 0:qr.connector;if(jr&&isCoinbaseMpcWalletConnector(Sn)){ro(!0);try{if(!(yield Sn.validatePasscode(wr))){_i(oo("dyn_create_password.errors.invalid_current_password"));return}}catch{_i(oo("dyn_create_password.errors.error_changing_password"));return}finally{ro(!1)}}io&&kr()}),Tn=Xr=>{const Sn=Xr.target.value,{strength:Rn}=validatePassword(Sn);if(En(Rn),br(Sn),jr){_i(wr===Sn?oo("dyn_create_password.errors.new_password_same_as_old"):Sn&&Cn&&Sn!==Cn?oo("dyn_create_password.errors.password_mismatch"):"");return}Sn!=null&&Sn.length||_i("")},Hr=Xr=>{const Sn=Xr.target.value;_i(Sn!==fr?oo("dyn_create_password.errors.password_mismatch"):""),In(Sn)};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:co,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_create_password.title",children:oo(jr?"dyn_create_password.title.update":"dyn_create_password.title.create")})}),jsxRuntimeExports.jsx("div",{className:"create-password",children:jsxRuntimeExports.jsxs("form",{className:"create-password__body","data-testid":"create-password-form",onSubmit:no,children:[jsxRuntimeExports.jsxs("div",{className:"create-password__body__header",children:[jsxRuntimeExports.jsx(SvgPasswordHero,{}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",children:oo("dyn_create_password.description")})]}),to&&jsxRuntimeExports.jsx(ErrorContainer,{children:to}),jr&&jsxRuntimeExports.jsx(Input,{id:"current-password",placeholder:oo("dyn_create_password.current_password_input.placeholder"),type:Gr,suffix:so(Gr,Vr,!1),label:oo("dyn_create_password.current_password_input.label"),value:wr,onChange:Xr=>Er(Xr.target.value),autoFocus:!0,copykey:"dyn_create_password.current_password_input"}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Input,{id:"password",placeholder:oo(jr?"dyn_create_password.update_input.placeholder":"dyn_create_password.create_input.placeholder"),type:Zr,suffix:so(Zr,Jr),label:oo(jr?"dyn_create_password.update_input.label":"dyn_create_password.create_input.label"),value:fr,onChange:Tn,autoFocus:!jr,copykey:"dyn_create_password.create_input"})}),fr.length>=1&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"create-password__body__card",children:validatePassword(fr).securityCriteria.map(Xr=>jsxRuntimeExports.jsxs("div",{className:`create-password__password-criteria-list ${Xr.value?"create-password__password-criteria-list__success":"create-password__password-criteria-list__error"}`,children:[jsxRuntimeExports.jsx("div",{children:Xr.value?jsxRuntimeExports.jsx(SvgCheck,{className:"create-password__password-criteria-icon"}):jsxRuntimeExports.jsx(SvgClose,{className:"create-password__password-criteria-icon"})}),jsxRuntimeExports.jsx(Typography,{variant:"body_mini",children:Xr.description})]},Xr.key))}),jsxRuntimeExports.jsx(Input,{id:"confirm-password",placeholder:oo("dyn_create_password.confirm_input.placeholder"),type:An,suffix:so(An,jn,!1),label:oo("dyn_create_password.confirm_input.label"),value:Cn,onChange:Hr,copykey:"dyn_create_password.confirm_input"})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},disabled:!io,copykey:"dyn_create_password.continue",type:"submit",loading:eo,children:oo("dyn_create_password.continue")}),Wr&&jsxRuntimeExports.jsx(TextButton,{className:"create-password__log-out",onClick:Wr,copykey:"dyn_create_password.logout",children:oo("dyn_create_password.logout")})]})})]})};var _path$o,_excluded$w=["title","titleId"];function _extends$w(){return _extends$w=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$w(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgDownload=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$w(br,_excluded$w);return reactExports.createElement("svg",_extends$w({width:21,height:20,viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$o||(_path$o=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.417 14.167c0 .92.746 1.666 1.666 1.666h8.334c.92 0 1.666-.746 1.666-1.666v-.834a.833.833 0 0 1 1.667 0v.834a3.333 3.333 0 0 1-3.333 3.333H6.083a3.333 3.333 0 0 1-3.333-3.333v-.834a.833.833 0 0 1 1.667 0v.834Zm1.91-4.756a.833.833 0 0 1 1.179 0l1.91 1.91V3.333a.833.833 0 0 1 1.667 0v7.989l1.911-1.911a.833.833 0 1 1 1.179 1.178l-3.334 3.334a.833.833 0 0 1-1.178 0l-3.334-3.334a.833.833 0 0 1 0-1.178Z",fill:"#ABACB2"})))},_path$n,_path2$3,_path3$2,_path4$1,_g$8,_path5$1,_defs$8,_excluded$v=["title","titleId"];function _extends$v(){return _extends$v=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$v(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgSavePasswordHero=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$v(br,_excluded$v);return reactExports.createElement("svg",_extends$v({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,reactExports.createElement("g",{clipPath:"url(#save-password-hero_svg__a)"},reactExports.createElement("mask",{id:"save-password-hero_svg__b",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:0,y:0,width:327,height:112},_path$n||(_path$n=reactExports.createElement("path",{d:"M315 0H12C5.373 0 0 5.373 0 12v88c0 6.627 5.373 12 12 12h303c6.627 0 12-5.373 12-12V12c0-6.627-5.373-12-12-12Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#save-password-hero_svg__b)"},_path2$3||(_path2$3=reactExports.createElement("path",{d:"M164 228c62.96 0 114-51.04 114-114S226.96 0 164 0 50 51.04 50 114s51.04 114 114 114Z",fill:"url(#save-password-hero_svg__c)",fillOpacity:.12})),reactExports.createElement("mask",{id:"save-password-hero_svg__d",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:86,y:29,width:40,height:40},_path3$2||(_path3$2=reactExports.createElement("path",{d:"M116.91 29 86 37.282l8.282 30.91 30.91-8.282L116.91 29Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#save-password-hero_svg__d)"},reactExports.createElement("mask",{id:"save-password-hero_svg__e",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:90,y:33,width:31,height:31},_path4$1||(_path4$1=reactExports.createElement("path",{d:"M119.763 44.8c-2.097-7.824-10.139-12.467-17.963-10.37-7.824 2.096-12.468 10.138-10.371 17.962 2.096 7.824 10.139 12.467 17.963 10.37 7.824-2.096 12.467-10.138 10.371-17.962Z",fill:"#fff"}))),_g$8||(_g$8=reactExports.createElement("g",{mask:"url(#save-password-hero_svg__e)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M118.709 55.166a14.617 14.617 0 0 0 1.054-10.366c-2.097-7.824-10.139-12.467-17.963-10.37-7.824 2.096-12.467 10.138-10.37 17.962a14.612 14.612 0 0 0 6.096 8.451c1.808-3.916 6.565-6.42 9.647-7.247 3.083-.826 7.955-1.146 11.536 1.57Zm-19.374-8.688a5.5 5.5 0 1 1 10.624-2.848 5.5 5.5 0 0 1-10.624 2.848Z",fill:"#DD8500"})))),_path5$1||(_path5$1=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.268 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.944 32.064a6.223 6.223 0 0 0-1.78 0c-.68.098-1.313.337-1.816.527l-.134.05-16.681 6.255-.406.152c-1.922.718-3.61 1.347-4.91 2.493a9.331 9.331 0 0 0-2.552 3.682c-.616 1.619-.614 3.42-.611 5.472l.001.434v14.875c0 8.792 4.782 16.123 9.952 21.508 5.204 5.42 11.159 9.25 14.308 11.086l.127.075c.575.337 1.32.775 2.307.987a6.623 6.623 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.149-1.836 9.103-5.665 14.308-11.086 5.169-5.385 9.952-12.716 9.952-21.508V50.695c.003-2.052.006-3.853-.61-5.472a9.331 9.331 0 0 0-2.552-3.682c-1.3-1.145-2.988-1.775-4.91-2.493l-.407-.152-16.68-6.254-.135-.05c-.502-.19-1.135-.43-1.815-.528Zm-.36 18.497c1.726 0 3.126 1.4 3.126 3.126v12.504a3.126 3.126 0 0 1-6.253 0V53.687c0-1.726 1.4-3.126 3.127-3.126Zm-3.127 28.135c0-1.727 1.4-3.126 3.127-3.126h.031a3.127 3.127 0 1 1 0 6.252h-.031a3.127 3.127 0 0 1-3.127-3.126Z",fill:"#DD8500"})))),_defs$8||(_defs$8=reactExports.createElement("defs",null,reactExports.createElement("linearGradient",{id:"save-password-hero_svg__c",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#DD8500"}),reactExports.createElement("stop",{offset:.985,stopColor:"#DD8500",stopOpacity:0})),reactExports.createElement("clipPath",{id:"save-password-hero_svg__a"},reactExports.createElement("path",{fill:"#fff",d:"M0 0h327v112H0z"})))))};const downloadFile=(fr,br)=>{const wr=document.createElement("a"),Er=new Blob([br],{type:"text/plain"});wr.href=URL.createObjectURL(Er),wr.download=fr,document.body.appendChild(wr),wr.click()},SavePasswordStep=({password:fr,error:br,isLoading:wr,onSave:Er,onBack:kr,onClose:jr,onLogout:Br})=>{const{t:Wr}=useTranslation(),[qr,Gr]=reactExports.useState("password"),[Vr,Zr]=reactExports.useState(!1),[Jr,Qr]=reactExports.useState(!1),_n=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>kr(),"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgChevronLeft,{})}),En=jr&&jsxRuntimeExports.jsx(IconButton,{onClick:()=>jr(),type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})}),Cn=jsxRuntimeExports.jsx(ToggleVisibilityButton,{initialState:qr==="password",onClick:An=>Gr(An?"password":"text"),className:"save-password-suffix-icon"}),In=An=>__awaiter$e(void 0,void 0,void 0,function*(){An.preventDefault(),Er()});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{leading:_n,trailing:En,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_save_password.title",children:Wr("dyn_save_password.title")})}),jsxRuntimeExports.jsx("div",{className:"save-password-view",children:jsxRuntimeExports.jsxs("form",{className:"save-password-view__body","data-testid":"save-password-form",onSubmit:In,children:[jsxRuntimeExports.jsx("div",{className:"save-password-view__body__icon",children:jsxRuntimeExports.jsx(SvgSavePasswordHero,{})}),jsxRuntimeExports.jsx("div",{className:"save-password-view__body__icon",children:jsxRuntimeExports.jsx(Badge,{text:Wr("dyn_save_password.badge_text"),className:"save-password-view__body__badge",copykey:"dyn_save_password.badge_text"})}),jsxRuntimeExports.jsxs("div",{className:"save-password-view__body__description",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_save_password.description",children:Wr("dyn_save_password.description")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"secondary",copykey:"dyn_save_password.description",children:Wr("dyn_save_password.warning")})]}),br&&jsxRuntimeExports.jsx(ErrorContainer,{children:br}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Input,{id:"password",placeholder:Wr("dyn_save_password.password_input.placeholder"),type:qr,suffix:Cn,disabled:!0,label:Wr("dyn_save_password.password_input.label"),value:fr,autoFocus:!0,copykey:"dyn_save_password.password_input"})}),jsxRuntimeExports.jsxs("div",{className:"save-password-view__actions",children:[jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"save-password-copy",buttonPadding:"small",buttonVariant:"primary",onClick:An=>{An.preventDefault(),copyToClipboard(fr),Qr(!0)},startSlot:jsxRuntimeExports.jsx(SvgCopy,{}),expanded:!0,copykey:"dyn_save_password.copy_button",children:Wr(Jr?"dyn_save_password.copy_button.copied":"dyn_save_password.copy_button.copy")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"save-password-download",buttonPadding:"small",buttonVariant:"primary",onClick:An=>{An.preventDefault(),downloadFile("wallet-recovery.txt",fr)},startSlot:jsxRuntimeExports.jsx(SvgDownload,{}),expanded:!0,copykey:"dyn_save_password.download_button",children:Wr("dyn_save_password.download_button")})]}),jsxRuntimeExports.jsx("div",{className:"save-password-view__body__confirm-card",children:jsxRuntimeExports.jsxs("button",{className:"save-password-view__body__card__acknowledgement",onClick:An=>{An.stopPropagation(),Zr(!Vr)},type:"button",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Checkbox,{checked:Vr,onChange:An=>{An.stopPropagation(),Zr(!Vr)},className:"save-password-view__body__card__statement__checkbox"})}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",style:{letterSpacing:"-0.15px"},color:"primary",copykey:"dyn_save_password.checkbox_label",children:Wr("dyn_save_password.checkbox_label")})})]})}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"save-password-submit",buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},disabled:!Vr,loading:wr,type:"submit",copykey:"dyn_save_password.continue",children:Wr("dyn_save_password.continue")}),Br&&jsxRuntimeExports.jsx(TextButton,{className:"create-password__log-out",onClick:Br,copykey:"dyn_save_password.logout",children:Wr("dyn_save_password.logout")})]})})]})},CreatePasswordView=({onSuccess:fr,onError:br,closeView:wr,notCalledFromWalletUtils:Er,isSignUp:kr})=>{var jr;const{setShowAuthFlow:Br,user:Wr,projectSettings:qr,primaryWallet:Gr,handleLogOut:Vr,walletConnectorOptions:Zr}=useInternalDynamicContext(),{t:Jr}=useTranslation(),{claimWallet:Qr}=useEmbeddedWalletPassword(),[_n,En]=reactExports.useState("create-password"),Cn=(jr=Wr==null?void 0:Wr.verifiedCredentials.find(Rn=>Rn.walletName==="coinbasempc"))===null||jr===void 0?void 0:jr.walletProperties,In=!!(Cn!=null&&Cn.claimed),An=wr??!0,[jn,eo]=reactExports.useState(""),[ro,to]=reactExports.useState(""),[_i,oo]=reactExports.useState(!1),[io,co]=reactExports.useState(""),so=requiresPasswordForEmbeddedWallet(qr),no=In||!so,Tn=()=>__awaiter$e(void 0,void 0,void 0,function*(){En("save-password")}),Hr=()=>__awaiter$e(void 0,void 0,void 0,function*(){var Rn,Pn,On;oo(!0);try{if(!kr){const Zn=(On=(Rn=Gr==null?void 0:Gr.connector)!==null&&Rn!==void 0?Rn:(Pn=findCoinbaseMPCWallet(Zr))===null||Pn===void 0?void 0:Pn.walletConnector)!==null&&On!==void 0?On:void 0;Er&&isCoinbaseMpcWalletConnector(Zn)&&(yield Zn.changePasscode(ro,jn)),In||(yield Qr())}fr==null||fr(ro),An&&Br(!1,{ignoreIfIsEmbeddedWidget:!1}),dynamicEvents.emit("embeddedWalletCreatePasswordCompleted",ro)}catch(Zn){logger$6.debug(`Error ${In?"updating":"creating"} password`,Zn),dynamicEvents.emit("embeddedWalletCreatePasswordFailed",Zn),Zn instanceof Error&&co(Zn.message),br==null||br(Zn)}finally{oo(!1)}}),Xr=()=>{if(so){const Rn=new Error(Jr("dyn_create_password.errors.user_closed_view"));br==null||br(Rn,!0),dynamicEvents.emit("embeddedWalletCreatePasswordFailed",Rn)}Br(!1)},Sn=Rn=>{Rn==null||Rn.preventDefault();const Pn=new Error(Jr("dyn_create_password.errors.user_closed_view"));br==null||br(Pn,!0),Vr()};return _n==="save-password"?jsxRuntimeExports.jsx(SavePasswordStep,{password:ro,onBack:()=>En("create-password"),error:io,isLoading:_i,onSave:()=>Hr(),onClose:no?()=>Xr():void 0,onLogout:no?void 0:Sn}):jsxRuntimeExports.jsx(CreatePasswordStep,{password:ro,setPassword:to,currentPassword:jn,setCurrentPassword:eo,onContinue:()=>Tn(),isChangingPassword:In,onClose:no?()=>Xr():void 0,onLogout:no?void 0:Sn})};var _path$m,_excluded$u=["title","titleId"];function _extends$u(){return _extends$u=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$u(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgPencilAltIcon=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$u(br,_excluded$u);return reactExports.createElement("svg",_extends$u({width:17,height:16,viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$m||(_path$m=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.638 2.862a.667.667 0 0 0-.943 0L7.167 8.391v.943h.942l5.53-5.53a.667.667 0 0 0 0-.942Zm-1.886-.943a2 2 0 1 1 2.829 2.829l-5.724 5.724a.667.667 0 0 1-.471.195H6.5A.667.667 0 0 1 5.833 10V8.115c0-.177.07-.347.196-.472l5.723-5.724ZM4.5 4a.667.667 0 0 0-.667.667V12c0 .368.299.667.667.667h7.333A.667.667 0 0 0 12.5 12V8.667a.667.667 0 0 1 1.333 0V12a2 2 0 0 1-2 2H4.5a2 2 0 0 1-2-2V4.667a2 2 0 0 1 2-2h3.333a.667.667 0 0 1 0 1.333H4.5Z",fill:"currentColor"})))};const EmailConfirmationWaitingView=()=>{const{setView:fr}=useViewContext(),{clearStatesOnBackClick:br,selectedWalletConnector:wr}=useInternalDynamicContext(),{t:Er}=useTranslation();if(wr&&!isEmailWalletConnector(wr))throw new Error("Wallet connector is not email provider");const kr=wr,jr=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){yield kr==null?void 0:kr.endSession(),fr("login-with-email-or-wallet"),br()}),[fr,kr,br]);return jsxRuntimeExports.jsxs("div",{className:"email-confirmation-waiting-view",children:[jsxRuntimeExports.jsx("div",{className:"email-confirmation-waiting-view__header-icon",children:jsxRuntimeExports.jsx(IconWithSpinner,{Icon:SignInWithEmailIcon,iconSize:80,isSpinning:!0})}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",color:"primary",className:"email-confirmation-waiting-view__title",copykey:"dyn_email_confirmation.title",children:Er("dyn_email_confirmation.title")}),jsxRuntimeExports.jsx(Typography,{weight:"regular",variant:"body_normal",color:"secondary",copykey:"dyn_email_confirmation.description",children:Er("dyn_email_confirmation.description")}),jsxRuntimeExports.jsxs("div",{className:"email-confirmation-waiting-view__email-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"medium",as:"span",children:kr==null?void 0:kr.email}),jsxRuntimeExports.jsx(IconButton,{onClick:jr,className:"email-confirmation-waiting-view__edit-icon-button","data-testid":"email-confirmation-waiting-view__edit-button",children:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgPencilAltIcon,{})})})]}),jsxRuntimeExports.jsx("div",{className:"email-confirmation-waiting-view__note",children:jsxRuntimeExports.jsx(Typography,{weight:"regular",variant:"body_small",color:"secondary",copykey:"dyn_email_confirmation.note",children:Er("dyn_email_confirmation.note")})}),jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"email-confirmation-waiting-view__powered_by_dynamic_footer"})]})};var _circle$4,_path$l,_path2$2,_excluded$t=["title","titleId"];function _extends$t(){return _extends$t=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$t(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgSignInWithEmail=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$t(br,_excluded$t);return reactExports.createElement("svg",_extends$t({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_circle$4||(_circle$4=reactExports.createElement("circle",{cx:32,cy:32,r:32,fill:"currentColor"})),_path$l||(_path$l=reactExports.createElement("path",{d:"M51 29.333a1.333 1.333 0 0 0-1.333 0l-17.334 9.8L15 29.333a1.333 1.333 0 0 0-2 1.16V42a4 4 0 0 0 4 4h30.667a4 4 0 0 0 4-4V30.5A1.333 1.333 0 0 0 51 29.333Z",fill:"#fff"})),_path2$2||(_path2$2=reactExports.createElement("path",{d:"M47.667 18H17a4 4 0 0 0-4 4v2.5a1.334 1.334 0 0 0 .667 1.16l18 10.167a1.333 1.333 0 0 0 1.333 0L51 25.66a1.334 1.334 0 0 0 .667-1.16V22a4 4 0 0 0-4-4Z",fill:"#fff"})))};const MIN_EVENT_TIME=10,useOnUnmount=fr=>{const br=reactExports.useRef(fr);br.current=fr,reactExports.useEffect(()=>{const wr=new Date;return()=>{new Date().getTime()-wr.getTime()!fr||br.length>2?br.split(""):br===""?[]:fr[0]===br[0]?[br[1]]:[br[0]],PinInput=({autoFocus:fr,disabled:br,inputIndex:wr,inputMode:Er,isValidated:kr,name:jr,onChange:Br,pattern:Wr,type:qr,value:Gr,values:Vr,hasError:Zr})=>{const Jr=reactExports.useRef(null),Qr=En=>{const Cn=Vr[wr],In=En.target.value.replace(/\s+/g,""),An=[...Vr],jn=normalizeNewValue(Cn,In).slice(0,An.length-wr),eo=(oo,io)=>An[wr+io]=oo,ro=qr==="number"?/(^$)|(\d+)/:/.*/,to=jn.every(oo=>ro.test(oo));let _i=Jr.current;if(to){jn.length?jn.forEach(eo):An[wr]="",Br(An);for(let oo=0;oo{var Cn;if(En==="Backspace"&&Vr[wr]===""&&wr>0){const In=(Cn=Jr.current)===null||Cn===void 0?void 0:Cn.previousElementSibling;In instanceof HTMLInputElement&&In.focus()}};return reactExports.useEffect(()=>{var En;fr&&wr===0&&((En=Jr==null?void 0:Jr.current)===null||En===void 0||En.focus())},[fr,wr]),jsxRuntimeExports.jsx("input",{ref:Jr,className:classNames$1("pin-input__input",{"pin-input__input--error":!!Zr,"pin-input__input--success":!!kr}),disabled:br,name:jr,value:Gr,onChange:Qr,onKeyDown:_n,"data-testid":wr,pattern:Wr,inputMode:Er})},isComplete=fr=>fr.every(br=>br),PinField=({handleComplete:fr,initialValue:br,inputMode:wr,isLoading:Er,isValidated:kr,pattern:jr,type:Br="number",hasError:Wr,onChange:qr,disabled:Gr})=>{const[Vr,Zr]=reactExports.useState(br),Jr=Qr=>{const _n=Qr.join("");Zr(Qr),qr==null||qr(_n),isComplete(Qr)&&fr(_n)};return jsxRuntimeExports.jsx("div",{className:"pin-field__container",children:Vr.map((Qr,_n)=>jsxRuntimeExports.jsx(PinInput,{values:Vr,inputIndex:_n,value:Qr,onChange:Jr,disabled:Er||Gr,inputMode:wr,isValidated:kr,pattern:jr,type:Br,autoFocus:!0,hasError:Wr},`pin_input_${_n}`))})};var _path$k,_excluded$s=["title","titleId"];function _extends$s(){return _extends$s=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$s(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgCheckCircle=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$s(br,_excluded$s);return reactExports.createElement("svg",_extends$s({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$k||(_path$k=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 2.666a5.333 5.333 0 1 0 0 10.667A5.333 5.333 0 0 0 8 2.666ZM1.333 8a6.667 6.667 0 1 1 13.333 0A6.667 6.667 0 0 1 1.333 8Zm9.138-1.805c.26.26.26.682 0 .943L7.804 9.804a.667.667 0 0 1-.942 0L5.528 8.471a.667.667 0 1 1 .943-.943l.862.862 2.195-2.195c.26-.26.683-.26.943 0Z",fill:"currentColor"})))};const useCountdown=({callback:fr,seconds:br})=>{const[wr,Er]=reactExports.useState(br),kr=reactExports.useRef(),jr=()=>{if(kr.current)return Er(br);Wr()},Br=()=>{clearTimeout(kr.current),kr.current=void 0},Wr=()=>{kr.current=setTimeout(()=>{Er(qr=>qr-1)},1e3)};return reactExports.useEffect(()=>{if(kr.current){if(wr<=0){fr&&fr();return}return Wr(),()=>clearTimeout(kr.current)}},[wr,fr]),{remainingSeconds:wr,startCountdown:jr,stopCountdown:Br}},RetrySendVerificationCodeSection=({retryHandler:fr,secondsToRetry:br=15,disabled:wr=!1,className:Er})=>{const{t:kr}=useTranslation(),[jr,Br]=reactExports.useState(!1),{remainingSeconds:Wr,startCountdown:qr}=useCountdown({callback:()=>Br(!1),seconds:br}),{isLoading:Gr,mutate:Vr}=useMutation(fr,{onSuccess:()=>{Br(!0),qr()}}),Zr=classNames$1("retry-send-verification-code-section",Er);return jr?jsxRuntimeExports.jsxs("div",{className:Zr,children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",copykey:"dyn_otp_verification.resend_code_in",children:kr("dyn_otp_verification.resend_code_in",{remainingSeconds:Wr})}),jsxRuntimeExports.jsxs("span",{className:"retry-send-verification-code-section__confirmation",children:[jsxRuntimeExports.jsx(Icon,{color:"success-1",children:jsxRuntimeExports.jsx(SvgCheckCircle,{})}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"medium",color:"primary",copykey:"dyn_otp_verification.code_sent",children:kr("dyn_otp_verification.code_sent")})]})]}):jsxRuntimeExports.jsxs("div",{className:Zr,children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"medium",color:"secondary",copykey:"dyn_otp_verification.code_not_received",children:kr("dyn_otp_verification.code_not_received")}),jsxRuntimeExports.jsx(TextButton,{className:"email-verification__text-button",disabled:Gr||wr,onClick:()=>Vr(),copykey:"dyn_otp_verification.resend_code",children:kr("dyn_otp_verification.resend_code")})]})},SECONDS_TO_RETRY=15,EmailVerification=({isEmailRecoveryFlow:fr=!1,showRetryButton:br=!0,showTransferMessage:wr=!1})=>{var Er,kr,jr,Br;const{environmentId:Wr,handleLogOut:qr,setPrimaryWalletId:Gr,setShowAuthFlow:Vr,projectSettings:Zr,user:Jr,userWithMissingInfo:Qr,walletConnectorOptions:_n,primaryWallet:En}=useInternalDynamicContext(),{setView:Cn,goToInitialView:In}=useViewContext(),{error:An,setError:jn,setErrorMessage:eo}=useErrorContext(),{loading:ro,setLoading:to}=useLoadingContext(),[_i,oo]=reactExports.useState(br),[io,co]=reactExports.useState(wr),{getEOAWallet:so}=useSmartWallets(),[no,Tn]=reactExports.useState(!1),Hr=reactExports.useRef(no),Xr=na=>{Tn(na),Hr.current=na},{displayedDestination:Sn,verificationUUID:Rn,setVerificationUUID:Pn}=useVerification(),{t:On}=useTranslation(),{addRecoveryEmail:Zn}=usePasskeyRecovery(),{isTurnkeyWallet:Nn,hasTurnkeyVerifiedCredentialAuthenticator:wn,hasRecoveryEmail:zn}=useIsTurnkeyWallet(),fo=isTurnkeyEnabled(Zr),{initAuth:vo,completeAuth:go,cancelAuth:uo}=useUserAuth({authMethod:"email"}),{generateSessionKey:lo,shouldRegisterSessionKeysOnSignin:Eo}=useEmbeddedWalletSessionKeys(Wr),mo=reactExports.useRef(!0);useOnUnmount(()=>{if(!mo.current)return;const na=Sn??"";dynamicEvents.emit("emailVerificationResult",Hr.current,na),Hr.current||dynamicEvents.emit("authFailure",{email:na,option:na,type:"email"},"user-cancelled"),Sn||logger$6.warn("WARNING: emitted emailVerificationResult with incomplete params because useVerification's displayedDestination was undefined")});const{verifyOtp:yo}=useOtpVerificationRequest(),_o=reactExports.useCallback(na=>__awaiter$e(void 0,void 0,void 0,function*(){var qo,ga,wl,No,Fo,Nl;if(na.nextView==="verified-and-transferred"&&(co==null||co(!0)),fr)return Cn("passkey-recovery-add-email",{canSkipAddingEmail:!1,isFromEmailVerification:!0}),!0;if(!Nn)return!1;if(wn&&!zn&&(!((qo=na==null?void 0:na.user)===null||qo===void 0)&&qo.email))return storeAuthTokenAndUser(na),yield Zn(na.user.email),Vr(!1),!0;if(fo){const Vo=(wl=(ga=Zr==null?void 0:Zr.sdk)===null||ga===void 0?void 0:ga.embeddedWallets)===null||wl===void 0?void 0:wl.automaticEmbeddedWalletCreation,Uo=En&&so(En),Ml=En&&isSessionKeyCompatibleWallet(En)||Uo&&isSessionKeyCompatibleWallet(Uo),$a=!!(Vo&&(!(!((Fo=(No=Zr==null?void 0:Zr.sdk)===null||No===void 0?void 0:No.embeddedWallets)===null||Fo===void 0)&&Fo.forceAuthenticatorAtSignup)||Ml));if($a){const Jo=findPrimaryEmbeddedChain(Zr),Zl=findEmbeddedWalletFromVerifiedCredentials(createUserProfileFromSdkUser(na.user),[Jo]);if(!Zl)throw new Error("Could not find an embedded wallet");const Cl=_n==null?void 0:_n.find(wo=>wo.key===Zl.walletName);if(!(Cl!=null&&Cl.walletConnector))throw new Error("Could not find connector for embedded wallet");const ko=Cl.walletConnector.createWallet({address:Zl.address||"",chain:Cl.walletConnector.connectedChain,connector:Cl.walletConnector,id:Zl.id,isAuthenticated:!1,key:(Nl=Zl.walletName)!==null&&Nl!==void 0?Nl:""});Gr(Zl.id),dynamicEvents.emit("embeddedWalletCreated",ko,Zl,Jr)}if($a||!Vo)return Vr(!1),!0}return!1}),[fr,Nn,wn,zn,fo,Cn,Zn,Vr,(kr=(Er=Zr==null?void 0:Zr.sdk)===null||Er===void 0?void 0:Er.embeddedWallets)===null||kr===void 0?void 0:kr.automaticEmbeddedWalletCreation,(Br=(jr=Zr==null?void 0:Zr.sdk)===null||jr===void 0?void 0:jr.embeddedWallets)===null||Br===void 0?void 0:Br.forceAuthenticatorAtSignup,En,so,_n,Gr,Jr]),Bo=reactExports.useCallback(na=>__awaiter$e(void 0,void 0,void 0,function*(){return jn(void 0),to(!0),Rn?!Jr&&!Qr?vo({onVerifySuccess:()=>Xr(!0),options:{email:Sn},showSuccessMessage:!0,verifyFunction:()=>__awaiter$e(void 0,void 0,void 0,function*(){let qo;return Eo()&&(qo=(yield lo()).publicKey),signInWithEmailVerification({environmentId:Wr,sessionPublicKey:qo,verificationToken:na,verificationUUID:Rn})})}):go({completeSignInFlow:qo=>__awaiter$e(void 0,void 0,void 0,function*(){return _o(qo)}),onValidUpdatedJwt:()=>{Xr(!0)},options:{email:Sn,isEmailRecoveryFlow:fr},updateJwtFunction:()=>__awaiter$e(void 0,void 0,void 0,function*(){return yo(na,"email",Rn)})}):uo()}),[jn,to,Rn,Jr,Qr,go,Sn,fr,uo,vo,Wr,_o,yo]),Lo=()=>__awaiter$e(void 0,void 0,void 0,function*(){try{if(!Rn||!Sn)return;to(!0);const{verificationUUID:na}=yield retryEmailVerification({email:Sn,environmentId:Wr,verificationUUID:Rn});Pn(na),jn(void 0)}catch(na){logger$6.debug(na),eo(na.code),na.code==="too_many_email_verification_attempts"&&oo(!1),na.code==="invalid_email_verification"&&In()}finally{to(!1)}}),Wo=reactExports.useMemo(()=>qo=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignInWithEmail,Object.assign({},qo))}),[]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[An&&jsxRuntimeExports.jsx(ErrorContainer,{withIcon:!1,className:"email-verification__error-message",children:An}),jsxRuntimeExports.jsxs("div",{className:classNames$1("email-verification__container",{"email-verification__container--error":!!An}),children:[io&&jsxRuntimeExports.jsx("div",{className:"email-verification__transfer-message",copykey:"dyn_otp_verification.email.complete",children:On("dyn_otp_verification.email.complete")}),no?jsxRuntimeExports.jsx("div",{className:"email-verification__icon-container",children:jsxRuntimeExports.jsx(IconWithStatus,{containerClassName:"email-verification__icon--verified",Icon:Wo,iconSize:64,InnerIcon:SvgCheck})}):jsxRuntimeExports.jsx(IconWithSpinner,{Icon:Wo,iconSize:96,isSpinning:!0,className:"email-verification__icon-with-spinner"}),jsxRuntimeExports.jsxs("div",{className:"email-verification__copy-text-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_otp_verification.description",children:On("dyn_otp_verification.description")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"secondary",children:shortenEmail(Sn)})]}),jsxRuntimeExports.jsx(PinField,{initialValue:Array(6).join(".").split("."),isLoading:ro,handleComplete:Bo,isValidated:no,inputMode:"numeric",pattern:"[0-9]*",hasError:!!An,onChange:()=>jn(void 0)}),_i&&jsxRuntimeExports.jsx(RetrySendVerificationCodeSection,{className:"email-verification__retry-container",retryHandler:Lo,secondsToRetry:SECONDS_TO_RETRY}),(Jr||Qr)&&!fr&&jsxRuntimeExports.jsx(TextButton,{className:"email-verification__log-out",onClick:qr,copykey:"dyn_otp_verification.log_out_button",children:On("dyn_otp_verification.log_out_button")})]})]})},EmailIcon=fr=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignInWithEmail,Object.assign({},fr,{"data-testid":"sign-in-with-email-icon"}))}),typographyColor={error:"error-1",notice:"brand-primary",success:"green-1"},ModalHeaderBanner=({messageKey:fr,type:br="error",disableTruncate:wr=!1})=>{const{t:Er}=useTranslation();return jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{style:{width:"100%"}}),children:!!fr&&jsxRuntimeExports.jsx("div",{className:classNames$1("modal-header-banner",{"modal-header-banner__error":br==="error","modal-header-banner__notice":br==="notice","modal-header-banner__success":br==="success"}),children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:typographyColor[br],truncate:wr===!1,copykey:fr,children:Er(fr||"")})})})},OTPVerificationView=({onClickBack:fr,onClickEditDestination:br,isLoading:wr,disabled:Er,displayedDestination:kr,description:jr,onPinComplete:Br,isValid:Wr,error:qr,retryHandler:Gr,onPinChange:Vr,successBannerTextKey:Zr,MainIcon:Jr,hideHeader:Qr,appendAboveOTPInput:_n,appendToEnd:En})=>{const{t:Cn}=useTranslation(),In=fr&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:fr,"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgArrowLeft,{})}),An=reactExports.useMemo(()=>Wr?"dyn_otp_verification.verification_succeeded":"dyn_otp_verification.confirm_code",[Wr]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!Qr&&jsxRuntimeExports.jsx(ModalHeader,{alignContent:"bottom",leading:fr&&In,children:jsxRuntimeExports.jsx("div",{className:"otp-verification-view__status-header",children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",color:"primary",className:"otp-verification-view__title",copykey:An,children:Cn(An)})})}),Zr&&jsxRuntimeExports.jsx(ModalHeaderBanner,{type:"notice",messageKey:Zr,disableTruncate:!0}),jsxRuntimeExports.jsx(ModalHeaderBanner,{type:"error",messageKey:qr==null?void 0:qr.message}),jsxRuntimeExports.jsxs("div",{className:classNames$1("otp-verification-view",{"otp-verification-view--message":!!(Zr||qr)}),children:[Wr&&jsxRuntimeExports.jsx(IconWithStatus,{Icon:Jr,iconSize:64,InnerIcon:SvgCheck}),!Wr&&jsxRuntimeExports.jsx(IconWithSpinner,{Icon:Jr,iconSize:96,isSpinning:wr,className:"otp-verification-view__icon-with-spinner",treatAsFunctionComponent:!0}),jsxRuntimeExports.jsxs("div",{className:"otp-verification-view__body",children:[Wr&&jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_otp_verification.hang_tight",children:Cn("dyn_otp_verification.hang_tight")}),!Wr&&(jr?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_otp_verification.description",children:jr}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_otp_verification.description",children:Cn("dyn_otp_verification.description")}),jsxRuntimeExports.jsxs("div",{className:"otp-verification-view__destination-container",children:[kr&&jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"secondary",children:kr}),br&&jsxRuntimeExports.jsx(IconButton,{onClick:br,"data-testid":"otp-verification-view__edit-button",children:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgPencilAltIcon,{})})})]})]}))]}),_n,jsxRuntimeExports.jsx(PinField,{initialValue:Array(6).join(".").split("."),isLoading:wr,handleComplete:Br,isValidated:Wr,inputMode:"numeric",pattern:"[0-9]*",hasError:!!qr,onChange:Vr,disabled:Er}),Gr&&jsxRuntimeExports.jsx(RetrySendVerificationCodeSection,{className:"otp-verification-view__retry-container",retryHandler:Gr}),En]})]})},EmailWalletOTPVerificationView=()=>{const{setView:fr}=useViewContext(),[br,wr]=reactExports.useState(),{selectedWalletConnector:Er,clearStatesOnBackClick:kr}=useInternalDynamicContext();if(!Er||!isEmailOTPWalletConnector(Er))throw new Error("Current wallet is not EmailWalletConnector");const{email:jr}=Er;if(!jr)throw new Error("EmailWalletOtpVerificationView requires a email");const Br=()=>{Er.clearEmail(),kr(),fr("login-with-email-or-wallet"),dynamicEvents.emit("authFailure",{email:jr,option:jr,type:"email"},"user-cancelled")},{data:Wr,isLoading:qr,mutate:Gr}=useMutation(Vr=>Er.verifyOneTimePassword(Vr),{onFailure:Vr=>{wr(Vr),dynamicEvents.emit("emailVerificationResult",!1,jr)},onSuccess:()=>{dynamicEvents.emit("emailVerificationResult",!0,jr)}});return jsxRuntimeExports.jsx(OTPVerificationView,{MainIcon:EmailIcon,displayedDestination:shortenEmail(jr),error:br,onClickBack:Br,isLoading:qr,onPinComplete:Gr,isValid:Wr===!0,retryHandler:Er.retryOneTimePassword.bind(Er),onPinChange:()=>wr(void 0),onClickEditDestination:Br,successBannerTextKey:"dyn_magic_verification.banner_text"})};var _g$7,_defs$7,_excluded$r=["title","titleId"];function _extends$r(){return _extends$r=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$r(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgExportEmbeddedHero=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$r(br,_excluded$r);return reactExports.createElement("svg",_extends$r({width:329,height:88,viewBox:"0 0 329 88",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_g$7||(_g$7=reactExports.createElement("g",{clipPath:"url(#export-embedded-hero_svg__a)"},reactExports.createElement("circle",{cx:164.5,cy:114,r:114,fill:"url(#export-embedded-hero_svg__b)",fillOpacity:.12}),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M195 23a4 4 0 0 1 4-4h40a4 4 0 0 1 4 4v8a4 4 0 0 1-4 4h-40a4 4 0 0 1-4-4v-8Zm13.585 4c0 1.473-1.217 2.667-2.717 2.667-1.501 0-2.717-1.194-2.717-2.667 0-1.473 1.216-2.667 2.717-2.667 1.5 0 2.717 1.194 2.717 2.667Zm6.34 2.667c1.5 0 2.717-1.194 2.717-2.667 0-1.473-1.217-2.667-2.717-2.667-1.501 0-2.717 1.194-2.717 2.667 0 1.473 1.216 2.667 2.717 2.667ZM226.698 27c0 1.473-1.216 2.667-2.717 2.667-1.5 0-2.717-1.194-2.717-2.667 0-1.473 1.217-2.667 2.717-2.667 1.501 0 2.717 1.194 2.717 2.667Zm8.057 0c0 .903-.751 1.667-1.717 1.667-.966 0-1.717-.764-1.717-1.667s.751-1.667 1.717-1.667c.966 0 1.717.764 1.717 1.667Zm1 0c0 1.473-1.217 2.667-2.717 2.667-1.501 0-2.717-1.194-2.717-2.667 0-1.473 1.216-2.667 2.717-2.667 1.5 0 2.717 1.194 2.717 2.667ZM110.237 57.018c8.535-2.287 13.601-11.06 11.314-19.596-2.287-8.535-11.061-13.6-19.596-11.313-8.536 2.287-13.601 11.06-11.314 19.596 2.287 8.535 11.061 13.6 19.596 11.313Zm-8.712-17.797-.522-1.949a4.037 4.037 0 0 1 7.798-2.09l.522 1.95a6.727 6.727 0 1 1-7.798 2.09Zm4.573-2.535-.195-.727a1.036 1.036 0 1 0-2.002.537l.194.726a6.81 6.81 0 0 1 2.003-.536Zm1.567 6.87a1.749 1.749 0 0 0-1.586-3.023 1.75 1.75 0 0 0 .137 3.412l.368 1.37a.75.75 0 1 0 1.448-.388l-.367-1.37Z",fill:"#4779FF"}),reactExports.createElement("path",{d:"M171.501 40.667a4.666 4.666 0 0 1 4.667 4.666h-28a9.306 9.306 0 0 0-6.85 2.995c.788-4.357 4.6-7.661 9.183-7.661h21ZM187.834 59.333A9.334 9.334 0 0 0 178.5 50h-28a9.333 9.333 0 0 0-9.333 9.333V78a9.333 9.333 0 0 0 9.333 9.333h28A9.334 9.334 0 0 0 187.834 78V59.333Z",fill:"#4779FF"}),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M174.25 65.25a6 6 0 1 0-12 0 6 6 0 0 0 12 0Zm-3 0a3 3 0 1 0-6 0 3 3 0 0 0 6 0Zm-9.37 3.892a7.497 7.497 0 0 0 2.005 2.237l-2.831 2.83 2.103 2.103-2.121 2.122-2.103-2.103-2.062 2.062-2.121-2.121 7.13-7.13Z",fill:"#fff"}))),_defs$7||(_defs$7=reactExports.createElement("defs",null,reactExports.createElement("linearGradient",{id:"export-embedded-hero_svg__b",x1:164.5,y1:0,x2:164.5,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})),reactExports.createElement("clipPath",{id:"export-embedded-hero_svg__a"},reactExports.createElement("rect",{x:.5,width:328,height:88,rx:12,fill:"#fff"})))))},_path$j,_excluded$q=["title","titleId"];function _extends$q(){return _extends$q=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$q(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgInfo=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$q(br,_excluded$q);return reactExports.createElement("svg",_extends$q({width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$j||(_path$j=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 2.333a6.667 6.667 0 1 0 0 13.334A6.667 6.667 0 0 0 9 2.333ZM.667 9a8.333 8.333 0 1 1 16.666 0A8.333 8.333 0 0 1 .667 9Zm7.5-3.333c0-.46.373-.834.833-.834h.008a.833.833 0 0 1 0 1.667H9a.833.833 0 0 1-.833-.833ZM7.333 9c0-.46.373-.833.834-.833H9c.46 0 .833.373.833.833v2.5a.833.833 0 1 1 0 1.667H9a.833.833 0 0 1-.833-.834v-2.5A.833.833 0 0 1 7.333 9Z",fill:"#383C48"})))},_path$i,_excluded$p=["title","titleId"];function _extends$p(){return _extends$p=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$p(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgWalletV2=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$p(br,_excluded$p);return reactExports.createElement("svg",_extends$p({xmlns:"http://www.w3.org/2000/svg",width:25,height:24,viewBox:"0 0 25 24",fill:"none","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$i||(_path$i=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.5 4a1 1 0 0 0 0 2h14a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3h-14a3 3 0 0 1-3-3V5a3 3 0 0 1 3-3h12a1 1 0 1 1 0 2h-12Zm-1 3.83V19a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V9a1 1 0 0 0-1-1h-14c-.35 0-.687-.06-1-.17Zm11 6.17a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0Z",fill:"#ABACB2"})))};const TurnkeyErrorMap={0:"Operation was canceled.",16:"Invalid Passkey signature. Select the passkey for this account and device.",3:"You reached the limit of passkeys for this account.",5:"Invalid Passkey signature. Select the passkey for this account and device.",7:"The code is invalid or expired."},reactNativePasskeyErrors={RequestFailed:"Request failed. Please try again.",UserCancelled:TurnkeyErrorMap[0]},DOMExceptionErrorMap={NotAllowedError:"Request Cancelled. Select a device or password manager to set up a passkey."},getProperErrorMessage=fr=>{var br;if(typeof fr=="string")return fr;if("reason"in fr)return fr.reason;if(fr instanceof DOMException)return DOMExceptionErrorMap[fr.name]||"Something went wrong";if("cause"in fr){if(((br=fr==null?void 0:fr.cause)===null||br===void 0?void 0:br.code)!==void 0){if(fr.cause.code===ACCESS_BLOCKED_ERROR_CODE)throw new AccessBlockedError;return TurnkeyErrorMap[fr.cause.code]}if(fr.cause&&"error"in fr.cause&&typeof fr.cause.error=="string"&&reactNativePasskeyErrors[fr.cause.error])return reactNativePasskeyErrors[fr.cause.error]}if("code"in fr&&fr.code){if(fr.code===ACCESS_BLOCKED_ERROR_CODE)throw new AccessBlockedError;return TurnkeyErrorMap[fr.code]}return"error"in fr&&typeof fr.error=="string"&&reactNativePasskeyErrors[fr.error]?reactNativePasskeyErrors[fr.error]:"Something went wrong"},iframeContainerId="dyn-turnkey-export-container-id",iframeElementId="dyn-turnkey-export-element-id",EmbeddedRevealView=({exportPrivateKey:fr})=>{var br,wr,Er,kr;const{primaryWallet:jr,user:Br,setShowAuthFlow:Wr,environmentId:qr}=useInternalDynamicContext(),{isTurnkeyWallet:Gr}=useIsTurnkeyWallet(),{shadowRoot:Vr}=useShadowDOMContext(),{setDynamicWidgetView:Zr}=useWidgetContext(),{setView:Jr}=useViewContext(),{getEOAWallet:Qr,isSmartWallet:_n}=useSmartWallets(),[En,Cn]=reactExports.useState(!1),[In,An]=reactExports.useState(!1),jn=reactExports.useRef(null),eo=(wr=(br=Br==null?void 0:Br.verifiedCredentials)===null||br===void 0?void 0:br.find(({walletName:Nn})=>Nn==null?void 0:Nn.startsWith("turnkey")))===null||wr===void 0?void 0:wr.walletProperties,ro=eo==null?void 0:eo.turnkeyHDWalletId,to=(Er=jr&&Qr(jr))!==null&&Er!==void 0?Er:jr,_i=to&&isCoinbaseMpcWalletConnector(to.connector);reactExports.useEffect(()=>()=>{Gr&&cleanupExport({wallet:to})},[]);const{isLoading:oo}=usePromise(()=>__awaiter$e(void 0,void 0,void 0,function*(){var Nn,wn;const zn=jn.current;if(!(!zn||((Nn=zn==null?void 0:zn.children)===null||Nn===void 0?void 0:Nn.length)>0))return isSessionKeyCompatibleWalletConnector(to==null?void 0:to.connector)&&(yield(wn=to==null?void 0:to.connector)===null||wn===void 0?void 0:wn.createOrRestoreSession()),initExport({iframeContainer:zn,iframeElementId,wallet:to})})),{mutate:io,isLoading:co,error:so,data:no}=useMutation(()=>__awaiter$e(void 0,void 0,void 0,function*(){var Nn,wn,zn;if(_i)return(to==null?void 0:to.connector).exportWalletKeys();if(Gr)try{return yield exportCredential({address:fr?to==null?void 0:to.address:void 0,environmentId:qr,user:Br,wallet:to})}catch{return isSessionKeyCompatibleWalletConnector(to==null?void 0:to.connector)&&(!((Nn=to==null?void 0:to.connector)===null||Nn===void 0)&&Nn.removeSessionKeys)&&(yield(wn=to==null?void 0:to.connector)===null||wn===void 0?void 0:wn.removeSessionKeys(),yield(zn=to==null?void 0:to.connector)===null||zn===void 0?void 0:zn.createOrRestoreSession({ignoreRestore:!0})),exportCredential({address:fr?to==null?void 0:to.address:void 0,environmentId:qr,user:Br,wallet:to})}}),{onFailure:Nn=>{logger$6.error("Failed to export",Nn),dynamicEvents.emit("embeddedWalletRevealFailed",Nn)},onSuccess:Nn=>{var wn,zn;if(_i&&Nn&&(Nn!=null&&Nn.length)){const fo=Vr==null?void 0:Vr.getElementById("coinbase-waas-key-export");(wn=fo==null?void 0:fo.contentWindow)===null||wn===void 0||wn.postMessage({key:(zn=Nn[0])===null||zn===void 0?void 0:zn.ecKeyPrivate,type:"export_key"},"*"),An(!0)}}}),Tn=reactExports.useMemo(()=>{if(so){if(so instanceof DynamicError)return so.message;try{return getProperErrorMessage(so)}catch(Nn){Nn instanceof AccessBlockedError&&Jr("access-blocked");return}}},[so,Jr]),{t:Hr}=useTranslation(),Xr=jsxRuntimeExports.jsxs("div",{children:[jr&&_n(jr)&&!co&&no&&!so&&jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__zerodev-warning",children:[jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__zerodev-warning__title-row",children:[jsxRuntimeExports.jsx(SvgInfo,{className:"embedded-reveal-view__zerodev-warning__icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",copykey:"dyn_embedded_reveal.aa_warning.title",children:Hr("dyn_embedded_reveal.aa_warning.title")})]}),jsxRuntimeExports.jsxs(Typography,{variant:"body_normal",weight:"regular",copykey:"dyn_embedded_reveal.aa_warning.subtitle",children:[Hr("dyn_embedded_reveal.aa_warning.subtitle"),jsxRuntimeExports.jsx("button",{onClick:()=>{Wr(!1),Zr("send-balance")},className:"embedded-reveal-view__zerodev-warning__link-button",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"primary",className:"underline",copykey:"dyn_embedded_reveal.aa_warning.button",children:Hr("dyn_embedded_reveal.aa_warning.button")})})]})]}),jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__body__description",children:!co&&no&&!so?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"regular",children:Hr("dyn_embedded_reveal.reveal_description")}):jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__header",children:jsxRuntimeExports.jsx(SvgExportEmbeddedHero,{})})})]});reactExports.useEffect(()=>{var Nn;if(!((Nn=jn==null?void 0:jn.current)===null||Nn===void 0)&&Nn.children&&no){const wn=jn.current.children[0];wn==null||wn.setAttribute("style",!ro||fr?"height: 60px":"height: 100px")}},[jn,no,ro,fr]);const Sn=jsxRuntimeExports.jsx(IconButton,{onClick:()=>Wr(!1),type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})}),Rn=!co&&no&&!so,Pn=Hr(!ro||fr?"dyn_embedded_reveal.private_key_title":"dyn_embedded_reveal.recovery_phrase_title"),On=Rn?Pn:Hr("dyn_embedded_reveal.agreement_title"),Zn=jsxRuntimeExports.jsx("iframe",{src:(kr=ApiEndpoint$1==null?void 0:ApiEndpoint$1.getBaseUrl())===null||kr===void 0?void 0:kr.replace("api/v0","coinbase-waas-key-export.html"),id:"coinbase-waas-key-export",title:"Coinbase WaaS key export",height:In?"100%":0,width:In?"100%":0,style:{borderRadius:"0.75rem"},allow:"clipboard-write"});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Sn,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",children:On})}),jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view",children:jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body",children:[Xr,_i&&Zn,Gr?jsxRuntimeExports.jsx("div",{id:iframeContainerId,style:{display:no?"block":"none"},ref:jn}):null,Rn?jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",onClick:()=>Wr(!1),loading:co,copykey:"dyn_embedded_reveal.done_button_label",typographyProps:{color:"inherit"},children:Hr("dyn_embedded_reveal.done_button_label")}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__body__description",children:jsxRuntimeExports.jsx(Badge,{text:Hr("dyn_embedded_reveal.badge_label"),className:"embedded-reveal-view__body__badge"})}),Tn&&jsxRuntimeExports.jsx(ErrorContainer,{children:Tn}),jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body__card",children:[jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body__card__statement",children:[jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__body__card__icon",children:jsxRuntimeExports.jsx(SvgWalletV2,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_embedded_reveal.statement_1.title",children:Hr("dyn_embedded_reveal.statement_1.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",weight:"regular",copykey:"dyn_embedded_reveal.statement_1.description",children:Hr("dyn_embedded_reveal.statement_1.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body__card__statement",children:[jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__body__card__icon",children:jsxRuntimeExports.jsx(SvgEyeOffIcon,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_embedded_reveal.statement_2.title",children:Hr("dyn_embedded_reveal.statement_2.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",weight:"regular",copykey:"dyn_embedded_reveal.statement_2.description",children:Hr("dyn_embedded_reveal.statement_2.description",{credential_type:Pn==null?void 0:Pn.toLowerCase()})})]})]})]}),jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body__confirm_card",children:[jsxRuntimeExports.jsxs("button",{className:"embedded-reveal-view__body__card__acknowledgement",onClick:()=>Cn(!En),children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Checkbox,{checked:En,onChange:()=>Cn(!En),className:"embedded-reveal-view__body__card__statement__checkbox",id:"embedded-reveal-checkbox-1"})}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_embedded_reveal.checkbox_label",children:Hr("dyn_embedded_reveal.checkbox_label")})})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},onClick:()=>io(),disabled:!En||oo,loading:co,dataTestId:"embedded-reveal-button",copykey:"dyn_embedded_reveal.reveal_button_label",children:Hr("dyn_embedded_reveal.reveal_button_label")})]})]})]})})]})},useTimeout=(fr,br)=>{const wr=reactExports.useRef(fr);useIsomorphicLayoutEffect$2(()=>{wr.current=fr},[fr]),reactExports.useEffect(()=>{if(!br&&br!==0)return;const Er=setTimeout(()=>wr.current(),br);return()=>clearTimeout(Er)},[br])};var _path$h,_excluded$o=["title","titleId"];function _extends$o(){return _extends$o=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$o(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgExternalLink=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$o(br,_excluded$o);return reactExports.createElement("svg",_extends$o({width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$h||(_path$h=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.333 1.333a.667.667 0 1 1 0-1.333h4c.368 0 .667.298.667.667v4a.667.667 0 0 1-1.333 0v-2.39L5.138 7.804a.667.667 0 1 1-.943-.943l5.529-5.529h-2.39ZM2 2.667a.667.667 0 0 0-.667.666V10c0 .368.299.667.667.667h6.667A.667.667 0 0 0 9.333 10V7.333a.667.667 0 0 1 1.334 0V10a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3.333a2 2 0 0 1 2-2h2.667a.667.667 0 0 1 0 1.334H2Z",fill:"currentColor"})))};const browserIconMap={brave:BraveIcon,chrome:ChromeIcon,edge:EdgeIcon,firefox:FirefoxIcon,safari:SafariIcon},getBrowserIcon=fr=>browserIconMap[fr],useWalletDownloadLinks=fr=>{const{walletBook:br}=useWalletBookContext();if(!fr)return[];const wr=getWalletLinks(br,fr.key),{currentDesktopUrl:Er,userBrowser:kr}=parseWalletLinks(wr);return kr&&Er?[{Icon:getBrowserIcon(kr),key:kr,link:Er,name:kr}]:Object.entries(wr).filter(([,jr])=>jr!=="").filter(([jr])=>jr!=="ios"&&jr!=="android").map(([jr,Br])=>({Icon:getBrowserIcon(jr),key:jr,link:Br,name:jr}))},generateMatrix=(fr,br)=>{const wr=Array.prototype.slice.call(browser$h.create(fr,{errorCorrectionLevel:br}).modules.data,0),Er=Math.sqrt(wr.length);return wr.reduce((kr,jr,Br)=>(Br%Er===0?kr.push([jr]):kr[kr.length-1].push(jr))&&kr,[])},QRCode=({ecl:fr="M",Icon:br,logoMargin:wr=0,logoSize:Er=40,size:kr=250,value:jr,accentColor:Br="currentColor",walletKey:Wr=void 0,showQrCodeImage:qr})=>{const{data:Gr}=usePromise(()=>browser$h.toDataURL(jr)),Vr=reactExports.useMemo(()=>{const _n=[],En=generateMatrix(jr||"QR Code value",fr),Cn=kr/En.length;[{x:0,y:0},{x:1,y:0},{x:0,y:1}].forEach(({x:ro,y:to})=>{const _i=(En.length-7)*Cn*ro,oo=(En.length-7)*Cn*to;for(let io=0;io<3;io++)_n.push(jsxRuntimeExports.jsx("rect",{"data-key":`corner-square-${ro}-${to}-${io}`,fill:io%2!==0?"var(--background)":Br,height:Cn*(7-io*2),rx:io===0?10:io===1?7:20,ry:io===0?10:io===1?7:20,width:Cn*(7-io*2),x:_i+Cn*io,y:oo+Cn*io},`corner-square-${ro}-${to}-${io}`))});const An=Math.floor(Er*1.5/Cn),jn=En.length/2-An/2,eo=En.length/2+An/2-1;for(let ro=0;roEn.length-8&&to<7||ro<7&&to>En.length-8||ro>jn&&rojn&&to.9?Br:"currentColor",r:Cn/2.25},`dot-${ro}-${to}`)));return _n},[fr,Er,kr,jr,Br]),Zr=kr/2-Er/2-wr,Qr=!Wr||["coinbase","walletconnect"].includes(Wr)?void 0:"walletConnect";return jsxRuntimeExports.jsx("div",{className:"qrcode__container",children:jsxRuntimeExports.jsx("div",{className:"qrcode",children:qr?jsxRuntimeExports.jsx("img",{"data-testid":"qr-code-image",src:Gr,alt:""}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("svg",{height:"100%",width:"100%",viewBox:`0 0 ${kr} ${kr}`,"data-testid":"qr-code",children:[jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip-logo",children:jsxRuntimeExports.jsx("rect",{height:Er,width:Er,x:Zr,y:Zr,rx:7,ry:7})})}),jsxRuntimeExports.jsx("rect",{fill:"none",height:kr,width:kr}),Vr]}),jsxRuntimeExports.jsx(IconWithSpinner,{Icon:br,iconSize:Er,isSpinning:!0,className:"qrcode__icon",indicator:Qr})]})})})},LoadingQrCode=({Icon:fr,logoSize:br})=>jsxRuntimeExports.jsx("div",{className:"qrcode__container qrcode","data-testid":"loading-qrcode",children:jsxRuntimeExports.jsx(IconWithSpinner,{Icon:fr,iconSize:br,isSpinning:!0,className:"qrcode__icon"})}),QrCodeContainer=({accentColor:fr,walletConnector:br,qrcodeValue:wr,Icon:Er,showCopyToClipboardButton:kr=!1,desktopUri:jr,showQrCodeMessage:Br,showQrCodeImage:Wr})=>{const{t:qr}=useTranslation(),{setView:Gr}=useViewContext(),Vr=useWalletDownloadLinks(br),Zr=()=>jr?jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"get-extension-button",buttonPadding:"small",buttonVariant:"primary",buttonClassName:"qr-code-button",onClick:()=>window.open(jr),copykey:"dyn_qr_code.open_button",typographyProps:{variant:"button_secondary"},startSlot:jsxRuntimeExports.jsx(Icon,{size:"xsmall",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgExternalLink,{})}),children:qr("dyn_qr_code.open_button")}):Vr!=null&&Vr.length?jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"get-extension-button",buttonPadding:"small",buttonVariant:"primary",buttonClassName:"qr-code-button",onClick:()=>Gr("no-qr-not-installed"),copykey:"dyn_qr_code.get_extension_button",typographyProps:{variant:"button_secondary"},startSlot:jsxRuntimeExports.jsx(Icon,{size:"xsmall",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgExternalLink,{})}),children:qr("dyn_qr_code.get_extension_button")}):null;return jsxRuntimeExports.jsxs("div",{className:classNames$1("qrcode-container__container",{"qrcode-container__container--message":Br}),children:[jsxRuntimeExports.jsxs("div",{className:"qrcode-container__top",children:[wr.length?jsxRuntimeExports.jsx(QRCode,{Icon:Er,accentColor:fr,value:wr,logoSize:50,walletKey:br==null?void 0:br.key,showQrCodeImage:Wr}):jsxRuntimeExports.jsx(LoadingQrCode,{Icon:Er,logoSize:50}),jsxRuntimeExports.jsxs("div",{className:"button-container",children:[kr&&jsxRuntimeExports.jsx(CopyButton,{variant:"button",textToCopy:wr,disabled:!wr.length,buttonClassName:"qr-code-button",copykey:"dyn_qr_code.copy_button",startSlot:jsxRuntimeExports.jsx(Icon,{size:"mini",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgLink,{})}),children:qr("dyn_qr_code.copy_button")}),Zr()]})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"regular",className:"qrcode-container__content",copykey:"dyn_qr_code.scan_title",children:qr("dyn_qr_code.scan_title",{app:br?"wallet":"app"})})]})},QrCodeWrapper=({uri:fr,desktopUri:br,icon:wr,accentColor:Er,showCopyToClipboardButton:kr,walletConnector:jr})=>{const[Br,Wr]=reactExports.useState(!1),[qr,Gr]=reactExports.useState(!1);return useTimeout(()=>Wr(!0),fr.length?5e3:null),jsxRuntimeExports.jsxs("div",{"data-testid":"qr-code-wrapper",className:"qr-code-wrapper",children:[jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{style:{width:"100%"}}),children:Br&&!qr&&jsxRuntimeExports.jsxs("div",{className:"qr-code-wrapper__scan-issue-message",children:[jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_small",children:"If you're having issues scanning, click "}),jsxRuntimeExports.jsx("button",{"data-testid":"qr-code-wrapper__scan-issue-button",className:"qr-code-wrapper__scan-issue-button",onClick:()=>Gr(!0),children:"here"})]})}),jsxRuntimeExports.jsx(QrCodeContainer,{showQrCodeMessage:Br,desktopUri:br,accentColor:Er,walletConnector:jr,qrcodeValue:fr,Icon:wr,showCopyToClipboardButton:kr,showQrCodeImage:qr})]})},FarcasterConnectView=({url:fr})=>{const{theme:{theme:br}}=useThemeContext(),wr=useIconThemeVariant(),Er=jsxRuntimeExports.jsx(SocialIcon,{name:"farcaster",variant:wr});return jsxRuntimeExports.jsx(QrCodeWrapper,{uri:fr,accentColor:wr==="dark"?br.colors.textPrimary:"#7b65c0",icon:Er,showCopyToClipboardButton:!0})},GlobalWalletConfirmView=({pairingInfo:fr,onConfirm:br,onCancel:wr})=>{const{t:Er}=useTranslation(),[kr,jr]=reactExports.useState(!1),Br=()=>{jr(!0)};return jsxRuntimeExports.jsx("div",{className:"global-wallet-confirm",children:jsxRuntimeExports.jsx("div",{className:"popup-content",children:jsxRuntimeExports.jsxs("div",{className:"wallet-connection-view",children:[!kr&&jsxRuntimeExports.jsx("img",{src:fr.icons[0],alt:`${fr.name} icon`,className:"dapp-icon",onError:Br}),jsxRuntimeExports.jsx(Typography,{className:"connection-title",variant:"title",font:"bold",children:Er("global_wallet.confirm.description",{name:fr.name})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"dapp-url",children:fr.url}),jsxRuntimeExports.jsxs("div",{className:"button-group",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"cancel-button",onClick:wr,type:"submit",buttonPadding:"large",children:Er("global_wallet.confirm.cancel_button")}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"connect-global-button",onClick:br,type:"submit",buttonPadding:"large",typographyProps:{color:"white"},children:Er("global_wallet.confirm.connect_button")})]})]})})})};var _g$6,_defs$6,_excluded$n=["title","titleId"];function _extends$n(){return _extends$n=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$n(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgBlueWalletconnect=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$n(br,_excluded$n);return reactExports.createElement("svg",_extends$n({width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_g$6||(_g$6=reactExports.createElement("g",{clipPath:"url(#blue-walletconnect_svg__a)"},reactExports.createElement("path",{d:"M6 12A6 6 0 1 0 6 0a6 6 0 0 0 0 12Z",fill:"#4084ED"}),reactExports.createElement("path",{d:"M3.343 4.286a3.761 3.761 0 0 1 5.314 0l.176.176a.186.186 0 0 1 0 .265l-.603.603a.096.096 0 0 1-.133 0l-.243-.244a2.624 2.624 0 0 0-3.708 0l-.26.26a.096.096 0 0 1-.132 0l-.606-.6a.186.186 0 0 1 0-.266l.195-.194Zm6.563 1.248.538.537a.185.185 0 0 1 0 .265L8.018 8.757a.187.187 0 0 1-.264 0L6.034 7.04a.047.047 0 0 0-.068 0l-1.72 1.718a.187.187 0 0 1-.264 0l-2.426-2.42a.186.186 0 0 1 0-.266l.538-.537a.187.187 0 0 1 .265 0l1.72 1.718a.047.047 0 0 0 .067 0l1.72-1.718a.187.187 0 0 1 .265 0l1.72 1.718a.047.047 0 0 0 .068 0l1.72-1.718a.19.19 0 0 1 .267 0Z",fill:"#fff"}))),_defs$6||(_defs$6=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"blue-walletconnect_svg__a"},reactExports.createElement("path",{fill:"#fff",d:"M0 0h12v12H0z"})))))};const InlineIconTypography=({children:fr})=>jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",children:jsxRuntimeExports.jsx("span",{className:"inline-icon-text",children:fr})}),GlobalWalletInfoView=()=>{const{t:fr}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"info-card",children:jsxRuntimeExports.jsxs("div",{className:"wrapper",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"bold",color:"primary",as:"h2",children:"How do I find the URI or QR code?"}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",children:fr("global_wallet.help.step.1")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",children:fr("global_wallet.help.step.2")}),jsxRuntimeExports.jsxs(InlineIconTypography,{children:["3. Open"," ",jsxRuntimeExports.jsxs("span",{className:"nowrap",children:["WalletConnect ",jsxRuntimeExports.jsx(SvgBlueWalletconnect,{})]}),"from the list, this should show a QR code to scan"]}),jsxRuntimeExports.jsxs(InlineIconTypography,{children:["4. If you are not using the QR code, locate and click",jsxRuntimeExports.jsxs("span",{className:"nowrap",children:[jsxRuntimeExports.jsx(SvgCopy,{})," to copy"]})," ","the URI code"]})]})})};var _path$g,_excluded$m=["title","titleId"];function _extends$m(){return _extends$m=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$m(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgExclamation=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$m(br,_excluded$m);return reactExports.createElement("svg",_extends$m({width:7,height:32,viewBox:"0 0 7 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$g||(_path$g=reactExports.createElement("path",{d:"M6.4 3.2a3.2 3.2 0 0 0-6.4 0V16a3.2 3.2 0 0 0 6.4 0V3.2ZM3.2 25.6a3.2 3.2 0 0 0 0 6.4h.032a3.2 3.2 0 0 0 0-6.4H3.2Z",fill:"#F9F9FB"})))},_path$f,_excluded$l=["title","titleId"];function _extends$l(){return _extends$l=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$l(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgExclamationCircle=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$l(br,_excluded$l);return reactExports.createElement("svg",_extends$l({width:17,height:18,viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$f||(_path$f=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 2.333a6.667 6.667 0 1 0 0 13.334 6.667 6.667 0 0 0 0-13.334ZM.167 9a8.333 8.333 0 1 1 16.666 0A8.333 8.333 0 0 1 .167 9ZM8.5 4.833c.46 0 .833.373.833.834V9a.833.833 0 1 1-1.667 0V5.667c0-.46.374-.834.834-.834Zm-.833 7.5c0-.46.373-.833.833-.833h.008a.833.833 0 0 1 0 1.667H8.5a.833.833 0 0 1-.833-.834Z",fill:"#FF4646"})))},_path$e,_excluded$k=["title","titleId"];function _extends$k(){return _extends$k=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$k(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgCautionTriangle=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$k(br,_excluded$k);return reactExports.createElement("svg",_extends$k({width:17,height:16,viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$e||(_path$e=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.335 1.917c.962-1.667 3.368-1.667 4.33 0l5.774 10c.962 1.666-.241 3.75-2.166 3.75H2.726c-1.924 0-3.127-2.084-2.165-3.75l5.774-10Zm2.887.833a.833.833 0 0 0-1.444 0l-5.773 10A.833.833 0 0 0 2.726 14h11.547a.833.833 0 0 0 .722-1.25l-5.773-10ZM8.5 5.667c.46 0 .833.373.833.833v1.667a.833.833 0 0 1-1.666 0V6.5c0-.46.373-.833.833-.833ZM7.667 11.5c0-.46.373-.833.833-.833h.008a.833.833 0 1 1 0 1.666H8.5a.833.833 0 0 1-.833-.833Z",fill:"#DD8500"})))},_circle$3,_excluded$j=["title","titleId"];function _extends$j(){return _extends$j=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$j(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgWarningRed=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$j(br,_excluded$j);return reactExports.createElement("svg",_extends$j({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_circle$3||(_circle$3=reactExports.createElement("circle",{cx:32,cy:32,r:32,fill:"#FF4646"})))},_circle$2,_excluded$i=["title","titleId"];function _extends$i(){return _extends$i=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$i(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgWarningOrange=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$i(br,_excluded$i);return reactExports.createElement("svg",_extends$i({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_circle$2||(_circle$2=reactExports.createElement("circle",{cx:32,cy:32,r:32,fill:"#DD8500"})))};const GlobalWalletMaliciousView=({maliciousSiteInfo:fr})=>{const{t:br}=useTranslation(),{setDynamicWidgetView:wr}=useWidgetContext(),{setShowAuthFlow:Er}=useInternalDynamicContext(),kr=()=>{wr("global-wallet"),Er(!1,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1})},jr=()=>{var Br;(Br=fr.proceedFlow)===null||Br===void 0||Br.call(fr)};return jsxRuntimeExports.jsx("div",{className:"malicious-site-view",children:jsxRuntimeExports.jsx("div",{className:"popup-content",children:jsxRuntimeExports.jsxs("div",{className:"wallet-connection-view",children:[jsxRuntimeExports.jsxs("div",{className:"warning-icon-container",style:{position:"relative"},children:[fr.isDefinitelyMalicious?jsxRuntimeExports.jsx(SvgWarningRed,{className:"warning-icon"}):jsxRuntimeExports.jsx(SvgWarningOrange,{className:"warning-icon"}),jsxRuntimeExports.jsx(SvgExclamation,{className:"exclamation-icon",style:{left:"50%",position:"absolute",top:"50%",transform:"translate(-50%, -50%)"}})]}),jsxRuntimeExports.jsx(Typography,{className:"connection-title",variant:"title",font:"bold",color:"primary",children:fr.isDefinitelyMalicious?br("global_wallet.malicious_site.certain.title"):br("global_wallet.malicious_site.unknown.title")}),jsxRuntimeExports.jsxs("div",{className:`subtitle-container ${fr.isDefinitelyMalicious?"definitely-malicious":"unknown"}`,children:[jsxRuntimeExports.jsxs("div",{className:"subtitle-header-container",children:[fr.isDefinitelyMalicious?jsxRuntimeExports.jsx(SvgExclamationCircle,{className:"caution-icon"}):jsxRuntimeExports.jsx(SvgCautionTriangle,{className:"caution-icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"subtitle-header",color:"primary",children:fr.isDefinitelyMalicious?br("global_wallet.malicious_site.certain.subtitle_header"):br("global_wallet.malicious_site.unknown.subtitle_header")})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"subtitle",color:"secondary",children:fr.isDefinitelyMalicious?br("global_wallet.malicious_site.certain.subtitle_text"):br("global_wallet.malicious_site.unknown.subtitle_text")})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"site-info",color:"secondary",children:fr.url}),jsxRuntimeExports.jsxs("div",{className:"button-group",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"cancel-button",buttonVariant:"primary",type:"submit",buttonPadding:"large",onClick:kr,copykey:"global_wallet.malicious_site.go_back",children:fr.isDefinitelyMalicious?br("global_wallet.malicious_site.certain.go_back"):br("global_wallet.malicious_site.unknown.go_back")}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"proceed-button",buttonVariant:"secondary",type:"submit",buttonPadding:"large",onClick:jr,copykey:"global_wallet.malicious_site.proceed",typographyProps:{color:"error-1"},children:fr.isDefinitelyMalicious?br("global_wallet.malicious_site.certain.proceed"):br("global_wallet.malicious_site.unknown.proceed")})]})]})})})},DefaultFooter=({hideBorder:fr})=>jsxRuntimeExports.jsx("div",{className:classNames$1("default-footer__footer",{"default-footer__footer--hidden":fr}),"data-testid":"default-footer"});var _path$d,_excluded$h=["title","titleId"];function _extends$h(){return _extends$h=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$h(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgSearch=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$h(br,_excluded$h);return reactExports.createElement("svg",_extends$h({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$d||(_path$d=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.667 2.667a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm-5.333 4a5.333 5.333 0 1 1 9.546 3.27l3.592 3.592a.667.667 0 0 1-.943.942L9.937 10.88a5.333 5.333 0 0 1-8.604-4.213Z",fill:"currentColor"})))};const Search=({className:fr="",id:br,label:wr,type:Er,onChange:kr,onBlur:jr,name:Br,value:Wr,onClickClear:qr,copykey:Gr})=>jsxRuntimeExports.jsxs("label",{htmlFor:br,className:classNames$1("search__container",Wr?"search__container--active":void 0),children:[jsxRuntimeExports.jsx("div",{className:"search-icon__container",children:jsxRuntimeExports.jsx(SvgSearch,{})}),jsxRuntimeExports.jsx("input",{name:Br,value:Wr,onChange:kr,onBlur:jr,type:Er,id:br,placeholder:wr,className:classNames$1("search__input",fr),"data-testid":"Search",copykey:Gr}),Wr.length>0&&jsxRuntimeExports.jsx("button",{type:"button",onClick:qr,className:"search__button--clear",children:"Clear"})]}),findLastPriorityIndex=(fr,br)=>br.reduce((wr,Er)=>{const kr=fr.indexOf(Er.toLowerCase());return kr>wr?kr:wr},-1),getCalculatedOffset=({hasWalletFilter:fr,defaultOffset:br,list:wr,priorityList:Er})=>{const kr=findLastPriorityIndex(wr,Er);return br===DEFAULT_NUMBER_OF_WALLETS_TO_SHOW&&!fr&&wr.length>br&&kr!==-1?kr+1:br},findGroupIndex=(fr,br)=>br.findIndex(wr=>isWalletGroup(wr)&&wr.key===fr),groupWalletOptions=(fr,br)=>{const wr=[];return br.forEach(Er=>{var kr;if(!Er.group)return wr.push(Er);const jr=findGroupIndex(Er.group,wr);if(jr>-1)return(kr=wr[jr].groupedWallets)===null||kr===void 0?void 0:kr.push(Er);if(!br.some(Gr=>{var Vr;const Zr=Er.group===Gr.group,Jr=Er.key!==Gr.key,Qr=((Vr=Gr.injectedConfig)===null||Vr===void 0?void 0:Vr.length)&&Gr.injectedConfig.length>1;return Zr&&(Qr||Jr)}))return wr.push(Er);const Wr=getWalletGroup(fr,Er.group),qr={groupedWallets:[Er],key:Wr.key,name:Wr.name};return wr.push(qr)}),wr},filterConnectedWallets=({walletOptions:fr,userWallets:br})=>{const wr=new Set(br.map(Er=>Er.connector.key));return(wr.has("phantom")||wr.has("phantomledger"))&&(wr.add("phantom"),wr.add("phantomledger")),fr.filter(Er=>!wr.has(Er.walletConnector.key))},getPlatformForConnector=fr=>isMobile()||fr.isWalletConnect?"mobile":"browserExtension",staticWalletFilter=(fr,br,wr)=>br.filter(Er=>isWalletEventSupported(findWalletBookWallet(wr,Er.key),"accountChanged",getPlatformForConnector(Er.walletConnector))?!0:!fr.some(kr=>kr.connector.key===Er.key)),filterWalletConnectWallets=({walletOptions:fr,userWallets:br})=>br.some(Er=>Er.connector.isWalletConnect)?fr.filter(Er=>!Er.walletConnector.isWalletConnect):fr,applyMultiWalletFilters=({authMode:fr,userWallets:br,walletOptions:wr,walletBook:Er})=>{const kr=filterWalletConnectWallets({userWallets:br,walletOptions:wr});return fr==="connect-only"?filterConnectedWallets({userWallets:br,walletOptions:kr}):staticWalletFilter(br,kr,Er)},PRIORITY_WALLET_LIST=["metamask","coinbase","walletconnect","phantom","argentx","blocto","solflare","braavos","trust","rainbow","dapper","glow","lilico"],sortedInputList=(fr,br)=>{const wr=[],Er=[],kr=[];fr.forEach(Wr=>{const qr=br.includes(Wr.key);qr?wr.push(Wr):PRIORITY_WALLET_LIST.includes(Wr.key)&&!qr?Er.push(Wr):kr.push(Wr)});const jr=Er.slice().sort((Wr,qr)=>PRIORITY_WALLET_LIST.indexOf(Wr.key)-PRIORITY_WALLET_LIST.indexOf(qr.key));return[...wr.slice().sort((Wr,qr)=>br.indexOf(Wr.key)-br.indexOf(qr.key)),...jr,...kr]},walletListBuilder=({authMode:fr,userWallets:br,multiWallet:wr,numberOfWalletsToShow:Er,inputList:kr,isWalletConnectList:jr,lastUsedWalletKey:Br,searchFilter:Wr,walletsFilter:qr,loginWithEmail:Gr,groupWallets:Vr,walletBook:Zr,showMoreWalletsWithFilter:Jr,recommendedWallets:Qr})=>{let _n=kr;jr&&(_n=kr.filter(co=>co.walletConnector.isWalletConnect&&co.key!=="walletconnect")),wr&&(_n=applyMultiWalletFilters({authMode:fr,userWallets:br,walletBook:Zr,walletOptions:_n}));let En;const Cn=!!qr,In=[],An=[],jn=[],eo=Array.from(new Set((Qr||[]).map(co=>co.walletKey))),ro=orderAndFilterList(_n,qr,jr,eo);ro.forEach(co=>{const so=eo==null?void 0:eo.includes(co.key);if(!isEmbeddedConnector(co.walletConnector)){if(co.key==="unknown"||!co.walletConnector.isAvailable)return;so?In.push(co):Br===co.key?En=co:co.isInstalledOnBrowser?An.push(co):jn.push(co)}});const to=[...En?[En]:[]],_i=[...In,...to,...An,...jn],oo=Vr?groupWalletOptions(Zr,_i):_i,io=Jr&&Cn?calculateWalletOffsetBasedOnInstalledAndLastUsedWallets(ro,to.concat(An),Er):Er;return{numberOfWallets:_i.length,walletsList:listToDisplay(oo,Wr,jr,io,Cn,Gr)}},orderAndFilterList=(fr,br,wr,Er)=>{const kr=sortedInputList(fr,Er);return!wr&&br?br(kr):kr},KEEP_WALLETS_NAME_LIST=["walletconnect","bitcoin.com wallet"],applySearchFilterToWalletOptionList=(fr,br)=>{const wr=fr.trim().toLowerCase(),Er=kr=>{const jr=kr.trim().toLowerCase();return KEEP_WALLETS_NAME_LIST.includes(jr)?jr:jr.replace("wallet","").replace("evm","").replace("starknet","").replace("solana","").replace("flow","").replace("bitcoin","")};return br.filter(kr=>{var jr;return Er(kr.name).includes(wr)||((jr=kr.groupedWallets)===null||jr===void 0?void 0:jr.some(Br=>Er(Br.name).includes(wr)))})},listToDisplay=(fr,br,wr,Er,kr,jr)=>{if(br)return applySearchFilterToWalletOptionList(br,fr);if(wr)return fr;if(jr)return fr.slice(0,Er);{const Br=fr.map(qr=>qr.name.toLowerCase()),Wr=getCalculatedOffset({defaultOffset:Er,hasWalletFilter:kr,list:Br,priorityList:PRIORITY_WALLET_LIST});return fr.slice(0,Wr)}},calculateWalletOffsetBasedOnInstalledAndLastUsedWallets=(fr,br,wr)=>{const Er=fr.slice(0,wr),kr=br.filter(jr=>!Er.includes(jr)).length;return wr+kr};var _path$c,_rect,_rect2,_rect3,_excluded$g=["title","titleId"];function _extends$g(){return _extends$g=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$g(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgNoWalletFound=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$g(br,_excluded$g);return reactExports.createElement("svg",_extends$g({width:121,height:81,viewBox:"0 0 121 81",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$c||(_path$c=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M99.064 34.016c-6.654 0-12.048 5.394-12.048 12.048 0 6.653 5.394 12.047 12.048 12.047 6.653 0 12.047-5.394 12.047-12.047 0-6.654-5.394-12.048-12.047-12.048ZM83 46.064C83 37.192 90.192 30 99.064 30c8.871 0 16.063 7.192 16.063 16.064 0 3.712-1.259 7.13-3.373 9.85l8.658 8.658a2.008 2.008 0 0 1-2.84 2.84l-8.658-8.658a15.994 15.994 0 0 1-9.85 3.373C90.192 62.127 83 54.935 83 46.064Z",fill:"currentColor",fillOpacity:.35})),_rect||(_rect=reactExports.createElement("rect",{y:8,width:121,height:16,rx:4,fill:"currentColor",fillOpacity:.3})),_rect2||(_rect2=reactExports.createElement("rect",{y:30,width:75,height:16,rx:4,fill:"currentColor",fillOpacity:.3})),_rect3||(_rect3=reactExports.createElement("rect",{y:52,width:75,height:16,rx:4,fill:"currentColor",fillOpacity:.3})))};const FilterBridgeChainsName=fr=>br=>br.filter(wr=>wr.walletConnector.supportedChains.includes(fr)),SearchNotFoundMessage=({title:fr,subtitle:br,image:wr})=>{const{t:Er}=useTranslation();return jsxRuntimeExports.jsxs("div",{className:"search-instead__container",children:[wr&&jsxRuntimeExports.jsx(Icon,{className:"search-instead__container__image",color:"text-tertiary",children:wr}),jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",weight:"regular",copykey:"dyn_wallet_list.wallet_missing.title",children:fr||Er("dyn_wallet_list.wallet_missing.title")}),jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"button_primary",weight:"regular",copykey:"dyn_wallet_list.wallet_missing.description",children:br||Er("dyn_wallet_list.wallet_missing.description")})]})},WalletListGridTabs=({items:fr,onSelect:br,value:wr})=>jsxRuntimeExports.jsx("div",{className:"wallet-list-grid-tabs",children:fr.map((Er,kr)=>{const jr=wr===kr,{icon:Br,text:Wr}=Er.label,qr=`${Wr}-${Br}-${fr.indexOf(Er)}`,Gr=typeof Br=="string"?jsxRuntimeExports.jsx("img",{src:Br,alt:Wr}):Br;return jsxRuntimeExports.jsxs("button",{type:"button",className:classNames$1("wallet-list-grid-tabs__button",{"wallet-list-grid-tabs__button--selected":jr,"wallet-list-grid-tabs__button--text":!!Wr}),tabIndex:-1,"aria-label":Wr,onClick:()=>br(kr),children:[Gr&&jsxRuntimeExports.jsx(Icon,{size:"small",className:classNames$1({"wallet-list-grid-tabs__icon--selected":!jr}),children:Gr}),Wr&&jsxRuntimeExports.jsx(Typography,{as:"span",variant:"body_small",weight:jr?"bold":"medium",color:jr?"primary":"secondary",children:Wr})]},qr)})}),getEffectiveWalletFilter=(fr,br)=>fr&&(fr!=null&&fr.walletsFilter)?fr.walletsFilter:br,getEffectiveRecommendedWallets=(fr,br)=>fr&&(fr!=null&&fr.recommendedWallets)?fr.recommendedWallets:br,WalletList$1=({isWalletConnectList:fr=!1})=>{var br;useEffectOnce(()=>()=>StorageService==null?void 0:StorageService.setItem(WALLET_PICKER_SEARCH_KEY,""));const{walletsFilter:wr,walletConnectorOptions:Er,projectSettings:kr,defaultNumberOfWalletsToShow:jr,bridgeChainsToConnect:Br,authMode:Wr,multiWallet:qr,recommendedWallets:Gr,selectedTabIndex:Vr,setSelectedTabIndex:Zr,selectedTabSettings:Jr,tabsItems:Qr}=useInternalDynamicContext(),_n=useUserWallets(),{walletBook:En}=useWalletBookContext(),{error:Cn}=useErrorContext(),{showDefaultFooter:In}=useAuthLayoutChecks(),[An,jn]=reactExports.useState(!0),{t:eo}=useTranslation(),[ro,to]=reactExports.useState((br=StorageService.getItem(WALLET_PICKER_SEARCH_KEY))!==null&&br!==void 0?br:""),_i=(Br==null?void 0:Br.length)&&FilterBridgeChainsName(Br[0].chain),oo=_i&&_i(Er),io=getEffectiveRecommendedWallets(Jr,Gr),{numberOfWallets:co,walletsList:so}=walletListBuilder({authMode:Wr,groupWallets:!0,inputList:oo||Er,isWalletConnectList:fr,lastUsedWalletKey:StorageService.getItem(LAST_USED_WALLET),multiWallet:qr,numberOfWalletsToShow:jr,recommendedWallets:io,searchFilter:ro,showMoreWalletsWithFilter:!0,userWallets:_n,walletBook:En,walletsFilter:getEffectiveWalletFilter(Jr,wr)}),no=!!ro||co>jr&&so.length!==co,Tn=!!(Qr!=null&&Qr.length),Hr=reactExports.useRef(null),Xr=()=>{const Pn=Hr.current;Pn&&((Pn==null?void 0:Pn.scrollTop)>(Pn==null?void 0:Pn.clientHeight)*1.25?jn(!1):jn(!0))},Sn=Pn=>{StorageService.setItem(WALLET_PICKER_SEARCH_KEY,Pn),to(Pn)},Rn=kr?no&&jsxRuntimeExports.jsx("div",{className:classNames$1("wallet-list__search-container",{"wallet-list__search-container--scroll":!Cn}),children:jsxRuntimeExports.jsx(Search,{copykey:"dyn_wallet_list.search.label",label:eo("dyn_wallet_list.search.label",{numberOfWallets:co}),value:ro,onChange:({target:{value:Pn}})=>Sn(Pn),onClickClear:()=>Sn("")})}):jsxRuntimeExports.jsx(Skeleton$1,{className:"wallet-list__search-skeleton"});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Tn&&jsxRuntimeExports.jsx("div",{className:"wallet-list__tabs-container",children:jsxRuntimeExports.jsx(WalletListGridTabs,{items:Qr,value:Vr||0,onSelect:Zr})}),Rn,!!Cn&&jsxRuntimeExports.jsx(ErrorContainer,{className:"wallet-list__error-container",withIcon:!1,children:Cn}),jsxRuntimeExports.jsx("div",{className:"wallet-list__container",children:jsxRuntimeExports.jsxs("div",{className:classNames$1("wallet-list__scroll-container",{"wallet-list__scroll-container--error":!!Cn,"wallet-list__scroll-container--fixed-height":Tn}),"data-testid":"wallet-list-scroll-container",ref:Hr,onScroll:Xr,children:[kr?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Er.length===0&&jsxRuntimeExports.jsx(ErrorContainer,{copykey:"dyn_wallet_list.configuration_mismatch",children:eo("dyn_wallet_list.configuration_mismatch")}),Er.length&&so.length===0?jsxRuntimeExports.jsx(SearchNotFoundMessage,{title:eo("dyn_wallet_list.search.not_found.title"),subtitle:eo("dyn_wallet_list.search.not_found.description"),image:jsxRuntimeExports.jsx(SvgNoWalletFound,{})}):so.map((Pn,On)=>jsxRuntimeExports.jsx(WalletListItem,{wallet:Pn,onResetSearchValue:()=>Sn(""),recommendedWallets:io},`${Pn.key}_${On}`))]}):jsxRuntimeExports.jsx(Skeleton$1,{count:10,className:"wallet-list__tile-skeleton"}),no&&!ro&&kr&&jsxRuntimeExports.jsx(SearchNotFoundMessage,{})]})}),In&&jsxRuntimeExports.jsx(DefaultFooter,{hideBorder:!An})]})},FarcasterQrCodeView=()=>{const{setError:fr}=useErrorContext(),[br,wr]=reactExports.useState(void 0),{connectSocialAccount:Er}=useSocialAuth({onError:()=>fr("Something went wrong"),onFarcasterUrl:kr=>wr(kr),sessionTimeout:2e4});return useEffectOnce(()=>{Er({authMode:"signin",provider:ProviderEnum.Farcaster})}),jsxRuntimeExports.jsx(FarcasterConnectView,{url:br??""})},isPhoneNumberProviderEnabled=fr=>!!(fr&&isProviderEnabled(fr,ProviderEnum.Sms)),useSubmitPhoneNumber=({onSubmit:fr,onSubmitError:br,country:wr,phone:Er,setInvalidNumberMessage:kr})=>{const{engageCaptcha:jr}=useCaptchaContext(),{view:Br,setView:Wr}=useViewContext(),{environmentId:qr,projectSettings:Gr}=useInternalDynamicContext(),{setDisplayedDestination:Vr,setVerificationUUID:Zr,setRetryData:Jr}=useVerification(),{fieldsConfig:Qr}=useFields(),{t:_n}=useTranslation(),En=Cn=>__awaiter$e(void 0,void 0,void 0,function*(){if(wr)try{const In=de$3({dialCode:wr.dialCode,phone:Er}),{verificationUUID:An}=yield createSmsVerification({captchaToken:Cn,environmentId:qr,isoCountryCode:wr.iso2,phoneCountryCode:wr.dialCode,phoneNumber:In});Jr({dialCode:wr.dialCode,iso2:wr.iso2,phone:In}),Wr("login-with-sms-verification"),Vr(formatPhone(Er)),Zr(An);const jn={dialCode:wr.dialCode,iso2:wr.iso2,phone:In};dynamicEvents.emit("authInit",{option:jn,phone:jn,type:"sms"}),fr==null||fr()}catch(In){if(Wr(Br.type),In instanceof SmsVerificationError){let An=_n("dyn_login.helper.phone_number_form.invalid_phone");In.code==="too_many_sms_verification_attempts"&&(An=_n("dyn_login.helper.phone_number_form.too_many_sms_verification_attempts")),In.code&&In.code in translation.dyn_login.helper.phone_number_form&&(An=_n("dyn_login.helper.phone_number_form."+In.code)),kr(An)}else typeof In=="string"&&kr(In);br==null||br()}});return Cn=>__awaiter$e(void 0,void 0,void 0,function*(){var In;if(wr){Cn.preventDefault();try{Qr.phoneNumber.validation.validateSync(Er)}catch(An){const{message:jn}=An;kr(jn),br==null||br();return}if(!((In=Gr==null?void 0:Gr.security.hCaptcha)===null||In===void 0)&&In.enabled){jr({authMethod:"phone",onCaptchaSuccess:En});return}En()}})},PhoneNumberSignInSection=({isLoading:fr,onSubmit:br,onSubmitError:wr})=>{var Er,kr;const{projectSettings:jr}=useInternalDynamicContext(),Br=reactExports.useMemo(()=>{const eo=getSupportedCountriesForVerificationFromProjectSettings(jr);return getCustomCountries(getDefaultCountriesIfEmpty(eo))},[jr]),[Wr,qr]=reactExports.useState(void 0),[Gr,Vr]=reactExports.useState(!1),[Zr,Jr]=reactExports.useState({country:void 0,phone:""}),Qr=reactExports.useCallback(eo=>{Jr(eo),Vr(validatePhoneLength(eo.phone,eo.country))},[]),[_n,En]=reactExports.useState(!1),[Cn,In]=reactExports.useState(!1),An=useSubmitPhoneNumber({country:Zr.country,onSubmit:br,onSubmitError:wr,phone:Zr.phone,setInvalidNumberMessage:qr});if(!isPhoneNumberProviderEnabled((Er=jr==null?void 0:jr.providers)!==null&&Er!==void 0?Er:[]))return logger$6.error("Failed to render PhoneNumberSignInSection - no sign in provider enabled"),null;const jn=!(!((kr=jr==null?void 0:jr.design.modal)===null||kr===void 0)&&kr.emailSubmitButtonInsideInput);return jsxRuntimeExports.jsxs("form",{className:"login-with-phone-number-form",onSubmit:eo=>An(eo),children:[jsxRuntimeExports.jsx(PhoneNumberField,{countries:Br,onUpdate:Qr,error:Wr,setIsHovered:En,setIsFocused:In,appendRight:jsxRuntimeExports.jsx(InlineSubmitButton,{disabled:fr||!Gr,highlighted:Gr,isFocused:Cn,isHovered:_n,className:"login-with-phone-number-form__fields__inline-submit",emailSubmitButtonInsideInput:!jn})}),jn&&jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"big-submit-button",buttonClassName:"login-with-phone-number-form__button",type:"submit",loading:fr,disabled:fr||!Gr,buttonVariant:"brand-primary",buttonPadding:"login-screen-height",expanded:!0,typographyProps:{color:"inherit"},children:"Continue"})]})},getSocialSignInProviderFromString=fr=>{if(!fr)return;const br=Object.values(SocialSignInProviderEnum);for(const wr of br)if(wr===fr)return wr};var _path$b,_excluded$f=["title","titleId"];function _extends$f(){return _extends$f=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$f(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgDotsHorizontal=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$f(br,_excluded$f);return reactExports.createElement("svg",_extends$f({width:21,height:20,viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$b||(_path$b=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.7 10a1.667 1.667 0 1 1 3.333 0A1.667 1.667 0 0 1 2.7 10Zm5.833 0a1.667 1.667 0 1 1 3.334 0 1.667 1.667 0 0 1-3.334 0Zm5.834 0a1.667 1.667 0 1 1 3.333 0 1.667 1.667 0 0 1-3.333 0Z",fill:"currentColor",fillOpacity:.4})))};const providerLabel=fr=>{if(fr)return fr===SocialSignInProviderEnum.Coinbasesocial?"Coinbase":capitalize$1(fr)},INTERNAL_MAX_INLINE_ITEMS=5,SocialSignIn=({providers:fr,onSelectProvider:br,isLoading:wr,selectedProvider:Er,testId:kr,defaultProvider:jr,numOfItemsToDisplay:Br=5,collapsedLayout:Wr})=>{const{t:qr}=useTranslation(),Gr=useIconThemeVariant();jr&&!fr.includes(jr)&&([jr]=fr);const Vr=fr.filter(ro=>ro!==jr),Zr=Math.min(Br,INTERNAL_MAX_INLINE_ITEMS),Jr=Vr.length>Zr,Qr=Jr?Vr.slice(0,Zr-1):Vr.slice(0,Zr),[_n,En]=reactExports.useState(!1),Cn=()=>!wr&&En(!1),In=fr.length===1||!Wr&&fr.length<4,An=ro=>ro,jn=jsxRuntimeExports.jsx(IconButton,{onClick:Cn,type:"button",id:"close-button",disabled:wr,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})}),eo=(ro,to=!1,_i=!1)=>jsxRuntimeExports.jsxs(IconListTile,{dataTestId:_i?`card-${ro}`:`inline-${ro}`,onClick:()=>br(ro),disabled:!!Er,className:classNames$1({"social-sign-in--card--tile":_i,"social-sign-in--tile":!_i,"social-sign-in--tile__full-width":to}),children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:jsxRuntimeExports.jsx(SocialIcon,{name:An(ro),variant:Gr}),isSpinning:Er===ro,iconSize:32}),!_i&&to&&jsxRuntimeExports.jsx(Typography,{variant:"button_primary",copykey:"dyn_login.social.button_label",children:qr("dyn_login.social.button_label",{provider:providerLabel(ro)})})]},An(ro));return fr.length?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"social-sign-in","data-testid":kr,children:[jr&&eo(jr,!0),Qr.map(ro=>eo(ro,In)),Jr&&jsxRuntimeExports.jsx(IconListTile,{dataTestId:"show-more-options",onClick:()=>En(!0),className:"social-sign-in--tile",children:jsxRuntimeExports.jsx(Icon,{color:"text-primary",children:jsxRuntimeExports.jsx(SvgDotsHorizontal,{})})},"show-more-options")]}),jsxRuntimeExports.jsx(OverlayCard,{isOpen:_n,onClickOverlay:Cn,children:jsxRuntimeExports.jsxs("div",{className:"social-sign-in--card",children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:jn,children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"body_normal",color:"primary",as:"span",children:"Choose a social account"})}),jsxRuntimeExports.jsx("div",{className:"social-sign-in--card--body",children:fr.map(ro=>eo(ro,!1,!0))})]})})]}):(logger$6.error("Failed to render SocialSignInSection - no social providers enabled"),null)},MagicSocialSignIn=({defaultProvider:fr,numOfItemsToDisplay:br,collapsedLayout:wr})=>{const{projectSettings:Er}=useInternalDynamicContext(),{socialProvider:kr,setSocialProvider:jr,socialWalletConnector:Br,enabledSocialProviders:Wr}=useSocialRedirectContext(),{engageCaptcha:qr}=useCaptchaContext(),{mutate:Gr,isLoading:Vr}=useMutation(Zr=>__awaiter$e(void 0,void 0,void 0,function*(){var Jr;if(!((Jr=Er==null?void 0:Er.security.hCaptcha)===null||Jr===void 0)&&Jr.enabled){qr({authMethod:"social",onCaptchaSuccess:Qr=>__awaiter$e(void 0,void 0,void 0,function*(){return jr(Zr),yield Br==null?void 0:Br.endSession(),Br==null?void 0:Br.connect(Zr)})});return}return jr(Zr),yield Br==null?void 0:Br.endSession(),Br==null?void 0:Br.connect(Zr)}));return jsxRuntimeExports.jsx(SocialSignIn,{onSelectProvider:Gr,providers:Wr,selectedProvider:kr,isLoading:Vr,testId:"magic-social-sign-in",defaultProvider:fr,numOfItemsToDisplay:br,collapsedLayout:wr})},getProviderEnumForSocialSignInProvider=fr=>{if(!fr)return null;const br=Object.values(ProviderEnum);for(const wr of br)if(wr===fr)return wr;return null},DynamicSocialSignIn=({defaultProvider:fr,numOfItemsToDisplay:br,collapsedLayout:wr})=>{const{setShowAuthFlow:Er,projectSettings:kr}=useInternalDynamicContext(),{setSocialProvider:jr,socialProvider:Br,enabledSocialProviders:Wr}=useSocialRedirectContext(),{setView:qr,goToInitialView:Gr}=useViewContext(),{engageCaptcha:Vr}=useCaptchaContext(),{isProcessing:Zr,connectSocialAccount:Jr}=useSocialAuth({onError:()=>{Gr()},onFarcasterUrl:_n=>qr("farcaster-connect-view",{url:_n}),onSettled:()=>{jr(void 0)},sessionTimeout:2e4}),Qr=_n=>{var En;const Cn=getProviderEnumForSocialSignInProvider(_n);if(jr(_n),!((En=kr==null?void 0:kr.security.hCaptcha)===null||En===void 0)&&En.enabled){Vr({authMethod:"social",onCaptchaSuccess:In=>__awaiter$e(void 0,void 0,void 0,function*(){qr("social-redirect-view"),Er(!0),Jr({authMode:"signin",captchaToken:In,provider:Cn})})});return}qr("social-redirect-view"),Er(!0),Jr({authMode:"signin",provider:Cn})};return jsxRuntimeExports.jsx(SocialSignIn,{onSelectProvider:Qr,providers:Wr,selectedProvider:Br,isLoading:Zr,testId:"dynamic-social-sign-in",defaultProvider:fr,numOfItemsToDisplay:br,collapsedLayout:wr})},SocialSignInSection=({sectionData:fr,collapsedLayout:br})=>{var wr,Er,kr;const{projectSettings:jr}=useInternalDynamicContext(),Br=(wr=jr==null?void 0:jr.providers)!==null&&wr!==void 0?wr:[],Wr={collapsedLayout:br,defaultProvider:getSocialSignInProviderFromString(fr.defaultItem),numOfItemsToDisplay:fr.numOfItemsToDisplay};return isProviderEnabled(Br,ProviderEnum.MagicLink)&&((Er=jr==null?void 0:jr.sdk.socialSignIn)===null||Er===void 0?void 0:Er.signInProvider)===SignInProviderEnum.MagicLink?jsxRuntimeExports.jsx(MagicSocialSignIn,Object.assign({},Wr)):((kr=jr==null?void 0:jr.sdk.socialSignIn)===null||kr===void 0?void 0:kr.signInProvider)===SignInProviderEnum.Dynamic?jsxRuntimeExports.jsx(DynamicSocialSignIn,Object.assign({},Wr)):(logger$6.error("Failed to render SocialSignInSection - no sign in provider enabled"),null)},ToggleableSection=({sections:fr})=>{const[br,wr]=reactExports.useState(!0),Er=br?fr[0]:fr[1];return jsxRuntimeExports.jsxs("div",{className:"toggleable-section",children:[Er.component,jsxRuntimeExports.jsxs("div",{className:"toggleable-section__toggle-prompt",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",copykey:Er.labelCopyKey,children:Er.label}),jsxRuntimeExports.jsx("button",{className:"toggleable-section__toggle-prompt__button",onClick:()=>wr(!br),children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"body_small",color:"brand-primary",className:"toggleable-section__toggle-prompt__button__text",copykey:Er.buttonCopyKey,children:Er.button})})]})]})},ListItemButton=({text:fr,onClick:br,numberOfWallets:wr,disabled:Er=!1,copykey:kr})=>{const jr=reactExports.useMemo(()=>wr<=10?wr:`${Math.floor(wr/10)*10}+`,[wr]),Br=jsxRuntimeExports.jsxs("div",{className:"list-item-button__trailing",children:[jsxRuntimeExports.jsx("div",{className:classNames$1("list-item-button__trailing-child","list-item-button__trailing-label"),children:jsxRuntimeExports.jsx(Badge,{text:`${jr} available`})}),jsxRuntimeExports.jsx("div",{className:classNames$1("list-item-button__trailing-child","list-item-button__trailing-icon"),children:jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"small",children:jsxRuntimeExports.jsx(SvgStroke,{})})})]});return jsxRuntimeExports.jsx(ListTile,{trailing:Br,onClick:br,className:"list-item-button",disabled:Er,copykey:kr,children:fr})},WalletSimpleSignIn=({previewWalletsNumber:fr,disabled:br=!1,onshowAllWallets:wr})=>{const{t:Er}=useTranslation(),{walletConnectorOptions:kr,projectSettings:jr,walletsFilter:Br,authMode:Wr,multiWallet:qr,recommendedWallets:Gr}=useInternalDynamicContext(),Vr=useUserWallets(),{walletBook:Zr}=useWalletBookContext(),{numberOfWallets:Jr,walletsList:Qr}=walletListBuilder({authMode:Wr,groupWallets:!0,inputList:kr,isWalletConnectList:!1,lastUsedWalletKey:StorageService.getItem(LAST_USED_WALLET),loginWithEmail:!0,multiWallet:qr,numberOfWalletsToShow:fr,recommendedWallets:Gr,searchFilter:void 0,userWallets:Vr,walletBook:Zr,walletsFilter:Br});return jr?jsxRuntimeExports.jsxs("div",{className:"login-with-email-wallet-list__container","data-testid":"top-wallets-list",children:[Qr.map((_n,En)=>jsxRuntimeExports.jsx(WalletListItem,{wallet:_n,disabled:br,recommendedWallets:Gr},`${_n.key}_${En}`)),jsxRuntimeExports.jsx(ListItemButton,{copykey:"dyn_wallet_list.view_all",text:Er("dyn_wallet_list.view_all"),onClick:wr,numberOfWallets:Jr,disabled:br})]}):jsxRuntimeExports.jsx(Skeleton$1,{count:fr+1,className:"login-with-email-wallet-list__skeleton"})},WalletSignInSection=({numberOfItensToShow:fr,isLoading:br,onSubmit:wr})=>{const{t:Er}=useTranslation();return fr>0?jsxRuntimeExports.jsx(WalletSimpleSignIn,{previewWalletsNumber:fr,onshowAllWallets:()=>wr==null?void 0:wr(),disabled:br}):jsxRuntimeExports.jsx(IconListTile,{onClick:()=>wr==null?void 0:wr(),disabled:br,className:"connect-with-wallet-button",children:jsxRuntimeExports.jsx(Typography,{variant:"button_primary",copykey:"dyn_login.wallet_list.button_only",children:Er("dyn_login.wallet_list.button_only")})})},LoginViewSection=({viewSection:fr,index:br,walletCount:wr,gotToWalletList:Er})=>{const{loading:kr}=useLoadingContext(),{t:jr}=useTranslation(),{setView:Br}=useViewContext(),[Wr,qr]=reactExports.useState(kr);switch(fr.type){case SdkViewSectionType.Separator:return jsxRuntimeExports.jsx(Divider,{text:fr.label});case SdkViewSectionType.Email:return jsxRuntimeExports.jsx(LoginEmailForm,{onSubmit:()=>qr(!0),onSubmitError:()=>qr(!1),isLoading:Wr});case SdkViewSectionType.Phone:return jsxRuntimeExports.jsx(PhoneNumberSignInSection,{onSubmit:()=>qr(!0),onSubmitError:()=>qr(!1),isLoading:Wr});case SdkViewSectionType.EmailAndPhone:const Gr=[{button:jr("dyn_login.email_or_phone.use_phone"),buttonCopyKey:"dyn_login.email_or_phone.use_phone",component:jsxRuntimeExports.jsx(LoginEmailForm,{onSubmit:()=>qr(!0),onSubmitError:()=>qr(!1),isLoading:Wr}),label:jr("dyn_login.email_or_phone.prefer_phone"),labelCopyKey:"dyn_login.email_or_phone.prefer_phone"},{button:jr("dyn_login.email_or_phone.use_email"),buttonCopyKey:"dyn_login.email_or_phone.use_email",component:jsxRuntimeExports.jsx(PhoneNumberSignInSection,{onSubmit:()=>qr(!0),onSubmitError:()=>qr(!1),isLoading:Wr}),label:jr("dyn_login.email_or_phone.prefer_email"),labelCopyKey:"dyn_login.email_or_phone.prefer_email"}];return fr.defaultItem==="phone"&&Gr.reverse(),jsxRuntimeExports.jsx(ToggleableSection,{sections:Gr});case SdkViewSectionType.Wallet:return jsxRuntimeExports.jsx(WalletSignInSection,{numberOfItensToShow:fr.numOfItemsToDisplay||0,onSubmit:()=>{Br("login-with-email-or-wallet-full-wallet-list"),Er()},isLoading:Wr});case SdkViewSectionType.Social:return jsxRuntimeExports.jsx(SocialSignInSection,{collapsedLayout:wr>1,sectionData:fr});case SdkViewSectionType.Text:return fr.label?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",align:fr.alignment,className:"login-view__text","data-testid":"login-view-section__text",children:fr.label}):null}},getWalletsSection=fr=>({numOfItemsToDisplay:fr,type:SdkViewSectionType.Wallet}),getSocialsSection=(fr,br)=>({defaultItem:br,numOfItemsToDisplay:fr,type:SdkViewSectionType.Social}),getSimpleSection=fr=>({type:fr}),getLoginViewStructure=({socialAboveEmail:fr,showWallets:br,web3Layout:wr,numOfWalletsToDisplay:Er,showEmail:kr,showPhone:jr,showSocial:Br,splitEmailAndSocial:Wr,defaultSocialItem:qr})=>{const Gr=!Wr&&(kr||jr),Vr=Wr?qr:void 0;return[{condition:br&&wr,section:getWalletsSection(Er)},{condition:Br&&fr,hideSeparator:Gr?"below":void 0,section:getSocialsSection(5,Vr)},{condition:kr&&!jr,section:getSimpleSection(SdkViewSectionType.Email)},{condition:!kr&&jr,section:getSimpleSection(SdkViewSectionType.Phone)},{condition:kr&&jr,section:getSimpleSection(SdkViewSectionType.EmailAndPhone)},{condition:Br&&!fr,hideSeparator:Gr?"above":void 0,section:getSocialsSection(5,Vr)},{condition:br&&!wr,section:getWalletsSection(Er)}]},useViewSettings=fr=>{var br,wr,Er;const{projectSettings:kr,overrides:jr}=useInternalDynamicContext(),Br=(wr=(br=kr==null?void 0:kr.sdk)===null||br===void 0?void 0:br.views)===null||wr===void 0?void 0:wr.find(qr=>qr.type===fr);return((Er=jr==null?void 0:jr.views)===null||Er===void 0?void 0:Er.find(qr=>qr.type===fr))||Br},NUMBER_OF_WALLETS=3,useLoginView=()=>{const fr=useViewSettings(SdkViewType.Login),{projectSettings:br,authorizationViewDisplayOrder:wr,loginWithEmail:Er,walletConnectorOptions:kr,walletsFilter:jr}=useInternalDynamicContext(),{t:Br}=useTranslation(),{enabledSocialProviders:Wr}=useSocialRedirectContext(),qr=!!(Wr!=null&&Wr.length),Gr=isEmailProviderEnabled(br==null?void 0:br.providers),Vr=isPhoneNumberProviderEnabled(br==null?void 0:br.providers),Zr=(jr?jr(kr):kr).filter(({key:En})=>En!=="turnkey"),Jr=reactExports.useMemo(()=>{var En;return br?!Er&&!Vr&&!qr?!0:!((En=fr==null?void 0:fr.sections)===null||En===void 0)&&En.length?fr.sections.length===1&&fr.sections[0].type==="wallet":!Gr&&!Vr&&!qr:!1},[fr==null?void 0:fr.sections,br,Er,qr,Vr,Gr]),Qr=reactExports.useCallback(En=>{var Cn;const In=jn=>{var eo;return(eo=jn.networks)===null||eo===void 0?void 0:eo.some(ro=>ro.enabled)};return!((Cn=br==null?void 0:br.chains)===null||Cn===void 0?void 0:Cn.some(jn=>jn.enabled&&In(jn)))&&En.find(jn=>jn.type==="wallet")&&logger$6.error("Failed to render WalletSignInSection - no chains enabled"),Zr!=null&&Zr.length?En:En.filter(jn=>jn.type!=="wallet")},[Zr==null?void 0:Zr.length,br==null?void 0:br.chains]),_n=reactExports.useMemo(()=>{var En,Cn,In,An,jn,eo;if(!((En=fr==null?void 0:fr.sections)===null||En===void 0)&&En.length)return Qr(fr==null?void 0:fr.sections);const{splitEmailAndSocial:ro=!1,socialAboveEmail:to=!1}=(Cn=br==null?void 0:br.design.modal)!==null&&Cn!==void 0?Cn:{},_i=[],oo=getLoginViewStructure({defaultSocialItem:Wr[0],numOfWalletsToDisplay:!((An=(In=br==null?void 0:br.design)===null||In===void 0?void 0:In.modal)===null||An===void 0)&&An.showWalletsButton?0:NUMBER_OF_WALLETS,showEmail:Gr,showPhone:Vr,showSocial:!!(Wr!=null&&Wr.length),showWallets:!!(Zr!=null&&Zr.length)&&!(!((eo=(jn=br==null?void 0:br.design)===null||jn===void 0?void 0:jn.modal)===null||eo===void 0)&&eo.emailOnly),socialAboveEmail:to,splitEmailAndSocial:ro,web3Layout:wr==="web3"}),io={label:Br("dyn_login.separators.default"),type:SdkViewSectionType.Separator};let co=!1;for(const so of oo)so.condition&&(_i.length>0&&!co&&so.hideSeparator!=="above"&&_i.push(io),_i.push(so.section),co=so.hideSeparator==="below");return _i},[wr,Wr,Qr,Gr,Vr,fr==null?void 0:fr.sections,br==null?void 0:br.design.modal,Zr==null?void 0:Zr.length,Br]);return{isWalletOnly:Jr,loginViewSections:_n}},showFarcasterQrCodeView=(fr,br)=>fr.length===1&&fr[0].type===SdkViewSectionType.Social&&br.length===1&&br.includes(SocialSignInProviderEnum.Farcaster)&&!isMobile(),LoginView=()=>{var fr;const{error:br}=useErrorContext(),{setView:wr}=useViewContext(),{isWalletOnly:Er,loginViewSections:kr}=useLoginView(),{enabledSocialProviders:jr}=useSocialRedirectContext(),{showDefaultFooter:Br}=useAuthLayoutChecks(),Wr=((fr=kr.find(Zr=>Zr.type===SdkViewSectionType.Wallet))===null||fr===void 0?void 0:fr.numOfItemsToDisplay)||0,qr=reactExports.useMemo(()=>kr.map((Zr,Jr)=>jsxRuntimeExports.jsx("div",{className:classNames$1("login-view__scroll__section",`login-view__scroll__section--${Zr.type}`),children:jsxRuntimeExports.jsx(LoginViewSection,{gotToWalletList:()=>wr("login-with-email-or-wallet-full-wallet-list"),index:Jr,viewSection:Zr,walletCount:Wr})},`${Zr.type}__${Jr}`)),[kr,Wr]),Gr=br&&jsxRuntimeExports.jsx(ErrorContainer,{className:"login-view__error-container",withIcon:!1,children:br});if(showFarcasterQrCodeView(kr,jr))return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Gr,jsxRuntimeExports.jsx(FarcasterQrCodeView,{})]});if(Er)return jsxRuntimeExports.jsx(WalletList$1,{});const Vr=isMobile()&&Br;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Gr,jsxRuntimeExports.jsx("div",{className:classNames$1("login-view__container",{"login-view__container--error":!!br}),children:jsxRuntimeExports.jsx("div",{className:"login-view__scroll","data-testid":"login-view-scroll",children:qr})}),Vr&&jsxRuntimeExports.jsx(DefaultFooter,{hideBorder:!0})]})},useMergeUserAccounts=()=>{const{environmentId:fr,setShowAuthFlow:br,selectedWalletConnector:wr}=useInternalDynamicContext(),{addedWalletsIds:Er}=useInternalUserWallets();return{mergeUserAccounts:jr=>__awaiter$e(void 0,void 0,void 0,function*(){const Wr=(yield verifyMergeUsers(fr,jr)).lastVerifiedCredentialId;Wr&&Er.current.push(Wr);const qr=yield wr==null?void 0:wr.getConnectedAccounts();qr!=null&&qr.length&&dynamicEvents.emit("triggerComputePrimaryWalletMultiWalletStateFromAccounts",{accounts:qr}),br(!1)})}},RadioButton=({children:fr,checked:br,value:wr,name:Er,disabled:kr=!1,className:jr="",onChange:Br})=>{const Wr=`${Er}_${wr}`;return jsxRuntimeExports.jsxs("div",{className:classNames$1("radio-button",jr),children:[jsxRuntimeExports.jsx("input",{type:"radio",id:Wr,name:Er,value:wr,disabled:kr,defaultChecked:br,onChange:Br}),jsxRuntimeExports.jsx("label",{htmlFor:Wr,children:fr})]})},MergeUserAccountsConflictsView=({mergeConflicts:fr})=>{const{mergeUserAccounts:br}=useMergeUserAccounts(),{t:wr}=useTranslation(),[Er,kr]=reactExports.useState(""),jr=reactExports.useRef(Object.fromEntries(fr.map(({field:qr,currentUser:Gr})=>[`${qr.name}_${qr.type}`,{fieldKey:qr.name,type:qr.type||KycFieldType.Standard,userId:Gr.userId}]))),Br=()=>__awaiter$e(void 0,void 0,void 0,function*(){const qr=Object.values(jr.current).map(({fieldKey:Gr,type:Vr,userId:Zr})=>({fieldKey:Gr,type:Vr,userId:Zr}));try{yield br(qr)}catch(Gr){logger$6.error("Error merging user accounts",Gr),kr(wr("dyn_merge_user_accounts_conflicts.errors.merge_error"))}});if(!(fr!=null&&fr.length))return null;const Wr=(qr,Gr,Vr,Zr)=>{kr(""),Zr&&(jr.current[`${qr}_${Gr}`]={fieldKey:qr,type:Gr||KycFieldType.Standard,userId:Vr})};return jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-conflicts__container",children:[Er&&jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",className:"merge-user-accounts-conflicts__error",children:Er}),jsxRuntimeExports.jsx("div",{className:"merge-user-accounts-conflicts__description",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_merge_user_accounts_conflicts.description",children:wr("dyn_merge_user_accounts_conflicts.description")})}),jsxRuntimeExports.jsx("div",{className:"merge-user-accounts-conflicts__fields",children:fr.map(({field:qr,currentUser:Gr,fromUser:Vr})=>{var Zr;return jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-conflicts__fields__item",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"merge-user-accounts-conflicts__fields__item__name",children:(Zr=qr.label)!==null&&Zr!==void 0?Zr:capitalize$1(qr.name)}),jsxRuntimeExports.jsx(RadioButton,{name:qr.name,value:Gr.value,checked:!0,className:"merge-user-accounts-conflicts__fields__item__button",onChange:Jr=>Wr(qr.name,qr.type,Gr.userId,Jr.target.checked),children:Gr.value}),jsxRuntimeExports.jsx(RadioButton,{name:qr.name,value:Vr.value,className:"merge-user-accounts-conflicts__fields__item__button",onChange:Jr=>Wr(qr.name,qr.type,Vr.userId,Jr.target.checked),children:Vr.value})]},qr.name)})}),jsxRuntimeExports.jsx("div",{className:"merge-user-accounts-conflicts__buttons",children:jsxRuntimeExports.jsx(TypographyButton,{className:"merge-user-accounts-conflicts__buttons__button",onClick:Br,buttonVariant:"primary",buttonPadding:"large",expanded:!0,copykey:"dyn_merge_user_accounts_conflicts.confirm_button",children:wr("dyn_merge_user_accounts_conflicts.confirm_button")})})]})},MergeUserAccountsView=fr=>{const{setView:br}=useViewContext(),{mergeUserAccounts:wr}=useMergeUserAccounts(),{t:Er}=useTranslation(),[kr,jr]=reactExports.useState(""),{mergeConflicts:Br}=fr,Wr=()=>{const Gr=()=>{br("merge-user-accounts",fr)};br("merge-user-accounts-conflicts",{mergeConflicts:(Br==null?void 0:Br.conflicts)||[]},{onBackClick:Gr})},qr=()=>__awaiter$e(void 0,void 0,void 0,function*(){if(Br!=null&&Br.conflicts.length){Wr();return}try{yield wr([])}catch(Gr){logger$6.error("Error merging user accounts",Gr),jr(Er("dyn_merge_user_accounts.errors.merge_error"))}});return jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts",children:[kr&&jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",className:"merge-user-accounts__error",children:kr}),jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts__container",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"merge-user-accounts__title",copykey:"dyn_merge_user_accounts.wallet.content",children:Er("dyn_merge_user_accounts.wallet.content")}),jsxRuntimeExports.jsx(TypographyButton,{onClick:qr,buttonClassName:"merge-user-accounts__button",buttonVariant:"brand-primary",buttonPadding:"large",typographyProps:{color:"inherit"},expanded:!0,copykey:"dyn_merge_user_accounts.confirm_button",children:Er("dyn_merge_user_accounts.confirm_button")})]})]})};var _path$a,_excluded$e=["title","titleId"];function _extends$e(){return _extends$e=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$e(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgDoubleArrowRight=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$e(br,_excluded$e);return reactExports.createElement("svg",_extends$e({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$a||(_path$a=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.862 2.862c.26-.26.682-.26.943 0L8.47 7.529a.667.667 0 0 1 0 .942l-4.666 4.667a.667.667 0 0 1-.943-.943L7.057 8 2.862 3.805a.667.667 0 0 1 0-.943Zm5.333 0c.26-.26.683-.26.943 0l4.667 4.667c.26.26.26.682 0 .942l-4.667 4.667a.667.667 0 0 1-.943-.943L12.39 8 8.195 3.805a.667.667 0 0 1 0-.943Z",fill:"currentColor"})))};const MergeUserAccountsWithSameEmailView=({returnToView:fr})=>{const{environmentId:br,setShowAuthFlow:wr,setCallback:Er,primaryWallet:kr,user:jr}=useInternalDynamicContext(),Br=useHandleAuthenticatedUser(),{t:Wr}=useTranslation(),{setError:qr}=useErrorContext(),{setView:Gr,goToInitialView:Vr}=useViewContext(),{displayedDestination:Zr}=useVerification(),Jr=()=>__awaiter$e(void 0,void 0,void 0,function*(){try{const _n=yield mergeUserAccounts(br);if(!_n)throw new DynamicError("Something went wrong, please try again.");yield Br(_n),wr(!1),Er("authSuccess")}catch{if(qr(Wr("dyn_merge_user_accounts_with_same_email.errors.merge_error")),jr){wr(!1,{emitCancelAuth:!0});return}Vr()}}),Qr=()=>{if(qr(void 0),fr){Gr(fr);return}if(jr){wr(!1);return}Gr("collect-user-data")};return jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__container",children:[jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__accounts",children:[jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__accounts__item",children:[jsxRuntimeExports.jsx(WalletIcon,{walletKey:kr==null?void 0:kr.connector.key,className:"merge-user-accounts-with-same-email__accounts__item__icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"medium",color:"secondary",className:"merge-user-accounts-with-same-email__accounts__item__text",children:shortenWalletAddress(kr==null?void 0:kr.address,3,3)})]}),jsxRuntimeExports.jsx("div",{className:"merge-user-accounts-with-same-email__accounts__divider",children:jsxRuntimeExports.jsx(Icon,{color:"text-secondary",size:"small",children:jsxRuntimeExports.jsx(SvgDoubleArrowRight,{})})}),jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__accounts__item",children:[jsxRuntimeExports.jsx(UserProfileIcon,{className:"merge-user-accounts-with-same-email__accounts__item__icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"medium",color:"secondary",className:"merge-user-accounts-with-same-email__accounts__item__text",children:shortenEmail(Zr,{breakpoint:4,cutEnd:1,cutStart:2})})]})]}),jsxRuntimeExports.jsx(Typography,{weight:"regular",variant:"title",className:"merge-user-accounts-with-same-email__text merge-user-accounts-with-same-email__text__header",copykey:"dyn_merge_user_accounts_with_same_email.title",children:Wr("dyn_merge_user_accounts_with_same_email.title")}),jsxRuntimeExports.jsxs(Typography,{weight:"medium",variant:"body_normal",className:"merge-user-accounts-with-same-email__text merge-user-accounts-with-same-email__text__body",copykey:"dyn_merge_user_accounts_with_same_email.existing_account",children:[Wr("dyn_merge_user_accounts_with_same_email.existing_account")," ",jsxRuntimeExports.jsx("span",{className:"merge-user-accounts-with-same-email__text--bold",children:shortenEmail(Zr,{breakpoint:14})})," ",Wr("dyn_merge_user_accounts_with_same_email.existing_account_trail")]}),jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__buttons",children:[jsxRuntimeExports.jsx(TypographyButton,{className:"merge-user-accounts-with-same-email__buttons__button",onClick:Jr,buttonVariant:"primary",buttonPadding:"large",copykey:"dyn_merge_user_accounts_with_same_email.confirm_button",children:Wr("dyn_merge_user_accounts_with_same_email.confirm_button")}),jsxRuntimeExports.jsx(TypographyButton,{className:"merge-user-accounts-with-same-email__buttons__button",onClick:Qr,buttonVariant:"secondary",buttonPadding:"large",copykey:"dyn_merge_user_accounts_with_same_email.cancel_button",children:Wr("dyn_merge_user_accounts_with_same_email.cancel_button")})]})]})};var _path$9,_path2$1,_path3$1,_path4,_g$5,_path5,_defs$5,_excluded$d=["title","titleId"];function _extends$d(){return _extends$d=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$d(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgSecureAccount=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$d(br,_excluded$d);return reactExports.createElement("svg",_extends$d({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,reactExports.createElement("mask",{id:"secure-account_svg__a",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:0,y:0,width:327,height:112},_path$9||(_path$9=reactExports.createElement("path",{d:"M315 0H12C5.373 0 0 5.373 0 12v88c0 6.627 5.373 12 12 12h303c6.627 0 12-5.373 12-12V12c0-6.627-5.373-12-12-12Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#secure-account_svg__a)"},_path2$1||(_path2$1=reactExports.createElement("path",{d:"M164 228c62.96 0 114-51.04 114-114S226.96 0 164 0 50 51.04 50 114s51.04 114 114 114Z",fill:"url(#secure-account_svg__b)",fillOpacity:.12})),reactExports.createElement("mask",{id:"secure-account_svg__c",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:86,y:29,width:40,height:40},_path3$1||(_path3$1=reactExports.createElement("path",{d:"M116.91 29 86 37.282l8.282 30.91 30.91-8.282L116.91 29Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#secure-account_svg__c)"},reactExports.createElement("mask",{id:"secure-account_svg__d",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:90,y:33,width:31,height:31},_path4||(_path4=reactExports.createElement("path",{d:"M119.763 44.8c-2.097-7.825-10.139-12.468-17.963-10.371-7.824 2.096-12.468 10.138-10.371 17.962 2.096 7.825 10.139 12.468 17.963 10.371 7.824-2.096 12.467-10.138 10.371-17.962Z",fill:"#fff"}))),_g$5||(_g$5=reactExports.createElement("g",{mask:"url(#secure-account_svg__d)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M118.709 55.166a14.617 14.617 0 0 0 1.054-10.366c-2.097-7.824-10.139-12.467-17.963-10.37-7.825 2.096-12.468 10.138-10.371 17.962a14.612 14.612 0 0 0 6.097 8.451c1.808-3.916 6.565-6.42 9.647-7.247 3.083-.826 7.955-1.146 11.536 1.57Zm-19.375-8.688a5.5 5.5 0 1 1 10.625-2.847 5.5 5.5 0 0 1-10.625 2.847Z",fill:"#4779FF"})))),_path5||(_path5=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.268 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.313.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.336 9.336 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm7.008 18.695c0-1.726-1.4-3.126-3.127-3.126h-14.069a6.253 6.253 0 0 0-6.153 5.133 6.234 6.234 0 0 1 4.589-2.007h18.76Zm1.562 3.127c3.454 0 6.253 2.8 6.253 6.253v12.506a6.253 6.253 0 0 1-6.253 6.254h-18.759a6.253 6.253 0 0 1-6.253-6.254V60.14a6.253 6.253 0 0 1 6.253-6.253h18.759Z",fill:"#4779FF"}))),_defs$5||(_defs$5=reactExports.createElement("defs",null,reactExports.createElement("linearGradient",{id:"secure-account_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))};const useIsLoggedIn=()=>{var fr,br,wr;const{user:Er,primaryWallet:kr,authMode:jr,projectSettings:Br}=useInternalDynamicContext(),{getEOAWallet:Wr}=useSmartWallets(),qr=kr&&Wr(kr),Gr=kr&&isSessionKeyCompatibleWallet(kr)||qr&&isSessionKeyCompatibleWallet(qr),Vr=isTurnkeyEnabled(Br),Zr=!!Er||jr==="connect-only"&&!!kr,Jr=(fr=Er==null?void 0:Er.verifiedCredentials)===null||fr===void 0?void 0:fr.filter(({walletProvider:Cn})=>Cn),Qr=!!(Jr!=null&&Jr.find(({walletProvider:Cn})=>Cn==="embeddedWallet")),En=Vr&&((wr=(br=Br==null?void 0:Br.sdk)===null||br===void 0?void 0:br.embeddedWallets)===null||wr===void 0?void 0:wr.automaticEmbeddedWalletCreation)&&(!(Br!=null&&Br.sdk.embeddedWallets.forceAuthenticatorAtSignup)||Gr)&&(!(Jr!=null&&Jr.length)||Qr);return logger$6.logVerboseTroubleshootingMessage("useIsLoggedIn",{authMode:jr,eoaWallet:qr,isSessionKeyCompatible:Gr,isTurnkeyProviderEnabled:Vr,primaryWallet:kr,projectSettings:Br,user:Er}),En?!!(kr&&Zr):Zr},useOverrides=fr=>{const br=reactExports.useRef(fr),wr=useIsLoggedIn();return br.current=fr,reactExports.useMemo(()=>({setAuthMode:Er=>{const{setAuthMode:kr}=br.current;if(wr){logger$6.error("Calling DynamicContext's setAuthMode method when the user already has a wallet is a noop");return}return kr(Er)}}),[wr])},useDynamicContext=()=>{const fr=reactExports.useContext(DynamicContext);if(fr===void 0)throw new Error("useDynamicContext must be used within a DynamicContextProvider");const{accountSwitchState:br,authMode:wr,authToken:Er,awaitingSignatureState:kr,getNameService:jr,handleLogOut:Br,handleUnlinkWallet:Wr,loadingNetwork:qr,locale:Gr,loginWithEmail:Vr,multiWalletWidgetState:Zr,network:Jr,networkConfigurations:Qr,qrcodeUri:_n,sdkHasLoaded:En,setLogInWithEmail:Cn,setMultiWalletWidgetState:In,setShowAuthFlow:An,setShowDynamicUserProfile:jn,setShowQrcodeModal:eo,shadowDOMEnabled:ro,showAuthFlow:to,showQrcodeModal:_i,user:oo,userWithMissingInfo:io,bridgeChains:co,bridgeChainsToConnect:so,primaryWallet:no,setShowBridgeWidget:Tn,sendWagmiSettings:Hr,showDynamicUserProfile:Xr,minAuthToken:Sn,selectedTabIndex:Rn,setSelectedTabIndex:Pn}=fr,{setAuthMode:On}=useOverrides(fr);return{accountSwitchState:br,authMode:wr,authToken:Er,awaitingSignatureState:kr,bridgeChains:co,bridgeChainsToConnect:so,getNameService:jr,handleLogOut:Br,handleUnlinkWallet:Wr,loadingNetwork:qr,locale:Gr,loginWithEmail:Vr,minAuthToken:Sn,multiWalletWidgetState:Zr,network:Jr,networkConfigurations:Qr,primaryWallet:no,qrcodeUri:_n,sdkHasLoaded:En,selectedTabIndex:Rn,sendWagmiSettings:Hr,setAuthMode:On,setLogInWithEmail:Cn,setMultiWalletWidgetState:In,setSelectedTabIndex:Pn,setShowAuthFlow:Zn=>An(Zn,{clearErrors:!0,emitCancelAuth:!0,ignoreIfIsEmbeddedWidget:!0,initializeWalletConnect:!0,performMultiWalletChecks:!0}),setShowBridgeWidget:Tn,setShowDynamicUserProfile:jn,setShowQrcodeModal:eo,shadowDOMEnabled:ro,showAuthFlow:to,showDynamicUserProfile:Xr,showQrcodeModal:_i,user:oo,userWithMissingInfo:io}},getMfaOptions=fr=>{const br=[{Icon:void 0,descriptionKey:"dyn_mfa.choose_device_view.authenticator_app_description",labelKey:"dyn_mfa.choose_device_view.authenticator_app",type:MFADeviceType.Totp}];if(!fr){const wr={Icon:void 0,descriptionKey:"dyn_mfa.choose_device_view.backup_code_description",labelKey:"dyn_mfa.choose_device_view.backup_code",type:"backupCode"};br.push(wr)}return br},MfaChooseDeviceView=({isInitialSetup:fr=!0})=>{const{handleLogOut:br}=useDynamicContext(),{t:wr}=useTranslation(),{setView:Er}=useViewContext(),kr=getMfaOptions(fr),jr=Br=>{if(Br.type==="backupCode"){Er("mfa-recovery",void 0,{onBackClick:()=>{Er("mfa-choose-device",{isInitialSetup:!1})}});return}if(fr){Er("mfa-secure-device",{type:Br.type});return}Er("mfa-verification",{isInitialSetup:fr,showBackButton:!0,type:Br.type})};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{alignContent:"bottom",children:jsxRuntimeExports.jsx("div",{className:"otp-verification-view__status-header",children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",color:"primary",className:"otp-verification-view__title",children:wr(fr?"dyn_mfa.choose_device_view.title":"dyn_mfa.choose_device_view.choose_another_method")})})}),jsxRuntimeExports.jsxs("div",{className:"mfa-choose-device-view__body","data-testid":"mfa-choose-device-view",children:[jsxRuntimeExports.jsx(SvgSecureAccount,{}),jsxRuntimeExports.jsx(Typography,{className:"mfa-choose-device-view__copy",variant:"body_normal",weight:"regular",color:"secondary",children:wr(fr?"dyn_mfa.choose_device_view.select_options":"dyn_mfa.choose_device_view.choose_another_method_description")}),kr.map(Br=>jsxRuntimeExports.jsxs(Button$1,{buttonClassName:"mfa-choose-device-view__button",expanded:!0,onClick:()=>jr(Br),children:[jsxRuntimeExports.jsxs("div",{className:"mfa-choose-device-view__button__header",children:[jsxRuntimeExports.jsx(Typography,{copykey:Br.labelKey,color:"primary",children:wr(Br.labelKey)}),jsxRuntimeExports.jsx(SvgChevronLeft,{className:"mfa-choose-device-view__icon--rotate"})]}),jsxRuntimeExports.jsx(Typography,{className:"mfa-choose-device-view__button__description",color:"secondary",copykey:Br.descriptionKey,children:wr(Br.descriptionKey)})]},Br.type)),jsxRuntimeExports.jsx(TextButton,{className:"mfa-choose-device-view__logout",onClick:br,copykey:"dyn_mfa.choose_device_view.logout",children:wr("dyn_mfa.choose_device_view.logout")})]})]})},getUserMfaDevices=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br}){try{const{devices:wr}=yield sdkApi$1().getUserMfaDevices({environmentId:br});return wr}catch(wr){const Er=yield wr.json();return logger$6.error(Er.error),[]}}),addMfaDevice=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,type:wr}){try{if(wr===MFADeviceType.Totp)return yield sdkApi$1().registerTotpMfaDevice({environmentId:br});throw new Error("Unsupported MFA device type")}catch(Er){const kr=Er instanceof Error?Er.message:(yield Er.json()).error;throw logger$6.error(kr),new Error(kr)}}),updateUserMfaDevice=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,mfaDeviceId:wr}){try{yield sdkApi$1().updateUserMfaDevice({environmentId:br,mfaDeviceId:wr})}catch(Er){const kr=yield Er.json();logger$6.error(kr.error)}}),deleteMfaDevice=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,mfaDeviceId:wr,mfaAuthToken:Er}){try{yield sdkApi$1().deleteMfaDevice({environmentId:br,mfaDeviceId:wr,xMfaAuthToken:Er})}catch(kr){const jr=yield kr.json();logger$6.error(jr.error)}}),verifyMfaDevice=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,type:wr,code:Er}){try{if(wr===MFADeviceType.Totp){const kr={code:Er,type:wr};return yield sdkApi$1().registerTotpMfaDeviceVerify({environmentId:br,mFARegisterTotpDevicePostRequest:kr})}throw new Error("Unsupported MFA device type")}catch(kr){const jr=kr instanceof Error?kr.message:(yield kr.json()).error;logger$6.error(jr);return}}),authMfaDevice=fr=>__awaiter$e(void 0,[fr],void 0,function*({deviceId:br,environmentId:wr,type:Er,code:kr,createMfaToken:jr}){try{if(Er===MFADeviceType.Totp){const Br={code:kr,createMfaToken:jr,id:br||void 0};return yield sdkApi$1().authMfaTotpDevice({environmentId:wr,mFAAuthTotpDevicePostRequest:Br})}throw new Error("Unsupported MFA device type")}catch(Br){if(logger$6.error(Br),Br instanceof Response){const Wr=yield Br.json();if(Wr.code==="mfa_invalid_code")throw new MfaInvalidOtpError;if(Wr.code==="mfa_rate_limited")throw new MfaRateLimitedError}throw Br}}),getRecoveryCodes=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br}){try{const{recoveryCodes:wr}=yield sdkApi$1().getRecoveryCodes({environmentId:br});return wr}catch(wr){const Er=yield wr.json();return logger$6.error(Er.error),[]}}),createNewRecoveryCodes=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br}){try{const{recoveryCodes:wr}=yield sdkApi$1().createNewRecoveryCodes({environmentId:br});return wr}catch(wr){const Er=yield wr.json();return logger$6.error(Er.error),[]}}),authMfaRecovery=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,code:wr}){try{const Er={code:wr};return yield sdkApi$1().authMfaRecovery({environmentId:br,mFAAuthRecoveryDevicePostRequest:Er})}catch(Er){throw logger$6.error(Er),Er instanceof Response&&(yield Er.json()).code==="mfa_invalid_code"?new MfaInvalidOtpError:Er}}),useMfa=()=>{const{completeAuth:fr}=useUserAuth({}),{user:br,userWithMissingInfo:wr,environmentId:Er}=useInternalDynamicContext(),kr=br||wr,jr=()=>__awaiter$e(void 0,void 0,void 0,function*(){if(!kr)throw new Error(USER_NOT_LOGGED_IN);return yield getUserMfaDevices({environmentId:Er})}),Br=En=>__awaiter$e(void 0,void 0,void 0,function*(){if(!kr)throw new Error(USER_NOT_LOGGED_IN);yield updateUserMfaDevice({environmentId:Er,mfaDeviceId:En})}),Wr=(En,Cn)=>__awaiter$e(void 0,void 0,void 0,function*(){if(!kr)throw new Error(USER_NOT_LOGGED_IN);yield deleteMfaDevice({environmentId:Er,mfaAuthToken:Cn,mfaDeviceId:En})}),qr=(...En)=>__awaiter$e(void 0,[...En],void 0,function*(Cn=MFADeviceType.Totp){if(!kr)throw new Error(USER_NOT_LOGGED_IN);const{id:In,secret:An,uri:jn}=yield addMfaDevice({environmentId:Er,type:Cn});return{id:In,secret:An,uri:jn}}),Gr=(En,...Cn)=>__awaiter$e(void 0,[En,...Cn],void 0,function*(In,An=MFADeviceType.Totp,jn){try{if(!kr)throw new Error(USER_NOT_LOGGED_IN);let eo=!1;return yield fr({onValidUpdatedJwt:()=>__awaiter$e(void 0,void 0,void 0,function*(){eo=!0}),updateJwtFunction:()=>__awaiter$e(void 0,void 0,void 0,function*(){const ro=yield authMfaDevice({code:In,createMfaToken:{singleUse:!0},deviceId:jn,environmentId:Er,type:An});return dynamicEvents.emit("mfaCompletionSuccess",{mfaToken:ro.mfaToken}),{isEmailVerificationRequired:!1,isSmsVerificationRequired:!1,missingFields:[],updateUserProfileResponse:ro}})}),eo}catch(eo){throw dynamicEvents.emit("mfaCompletionFailure",{error:eo}),eo}}),Vr=En=>__awaiter$e(void 0,void 0,void 0,function*(){if(!kr)throw new Error(USER_NOT_LOGGED_IN);let Cn=!1;return yield fr({onValidUpdatedJwt:()=>__awaiter$e(void 0,void 0,void 0,function*(){Cn=!0}),updateJwtFunction:()=>__awaiter$e(void 0,void 0,void 0,function*(){const In=yield authMfaRecovery({code:En,environmentId:Er});if(!In)throw new Error("Failed to authenticate recovey code");return{isEmailVerificationRequired:!1,isSmsVerificationRequired:!1,missingFields:[],updateUserProfileResponse:In}})}),Cn}),Zr=(En,...Cn)=>__awaiter$e(void 0,[En,...Cn],void 0,function*(In,An=MFADeviceType.Totp){if(!kr)throw new Error(USER_NOT_LOGGED_IN);const jn=yield verifyMfaDevice({code:In,environmentId:Er,type:An});if(!jn)throw new Error("Failed to verify device");return jn}),Jr=(...En)=>__awaiter$e(void 0,[...En],void 0,function*(Cn=!1){if(!kr)throw new Error(USER_NOT_LOGGED_IN);const An=yield(Cn?createNewRecoveryCodes:getRecoveryCodes)({environmentId:Er});if(!An)throw new Error("Recovery codes not found");return An}),{updateUser:Qr}=useUserUpdateRequestInternal({validationSchemaStripUnknown:!1});return{addDevice:qr,authDevice:Gr,authRecoveryCode:Vr,completeAcknowledgement:()=>__awaiter$e(void 0,void 0,void 0,function*(){yield Qr({mfaBackupCodeAcknowledgement:MfaBackupCodeAcknowledgement.Complete})}),deleteUserDevice:Wr,getRecoveryCodes:Jr,getUserDevices:jr,updateUserDevice:Br,verifyDevice:Zr}},MfaDisplayBackupCodesView=({regenerateCodes:fr=!1})=>{const{setShowAuthFlow:br}=useInternalDynamicContext(),[wr,Er]=reactExports.useState(!1),{t:kr}=useTranslation(),{getRecoveryCodes:jr,completeAcknowledgement:Br}=useMfa(),{data:Wr,isLoading:qr}=usePromise(()=>jr(fr)),Gr=(Wr||[]).join(` + ${fo.stack}`):Vr(fo.code)};return fo=>__awaiter$e(void 0,[fo],void 0,function*({walletConnector:vo,getAddressOpts:go,publicWalletAddress:uo,captchaToken:lo,oauth:Eo,signedMessageOverride:mo,messageToSignOverride:yo}){const _o=getWalletProvider(vo);dynamicEvents.emit("authInit",{address:uo,connectorName:vo.name,option:vo.name,type:"wallet"});try{const{verifyFunction:Bo,verifyArgs:Lo}=yield On(vo,_o,go,uo,lo,Eo,mo,yo);yield Hr({isSignIn:Rn,onError:Wo=>{zn(Wo,vo,uo,Eo)},onVerifySuccess:Wo=>{var na;if(!Wo)throw new DynamicError(USER_NOT_LOGGED_IN);try{(na=io==null?void 0:io.onSignedMessage)===null||na===void 0||na.call(io,{messageToSign:Lo.messageToSign,signedMessage:Lo.signedMessage})}catch{logger$6.warn("Error calling onSignedMessage callback")}StorageService.setItem(LAST_USED_WALLET,vo.key),_i("connect-and-sign"),Zn({lastVerifiedCredentialId:Wo.lastVerifiedCredentialId,verifiedCredentials:Wo.verifiedCredentials,walletConnector:vo});const qo=Wo.lastVerifiedCredentialId;qo&&Tn.current.push(qo)},options:{address:uo,connectorName:vo.name},skipDefaultErrorHandling:!0,verifyFunction:Bo})}catch(Bo){zn(Bo,vo,uo,Eo)}})},useEffectOnceCondition=(fr,br)=>{const wr=reactExports.useRef(!1),Er=reactExports.useRef(fr);Er.current=fr,reactExports.useEffect(()=>{br&&!wr.current&&(Er.current(),wr.current=!0)},[br])},SOCIAL_STORAGE_KEY="dynamic_social_storage",searchSocialStorageByState=fr=>{var br;const wr=StorageService.getItem(SOCIAL_STORAGE_KEY);if(!wr)return;const Er=Object.entries(wr),[kr]=(br=Er.find(([,{state:jr}])=>jr===fr))!==null&&br!==void 0?br:[];if(kr)return wr[kr]},setSocialStorageFor=(fr,br)=>{var wr;const Er=(wr=StorageService.getItem(SOCIAL_STORAGE_KEY))!==null&&wr!==void 0?wr:{};Er[fr]=Object.assign({provider:fr},br),StorageService.setItem(SOCIAL_STORAGE_KEY,Er)},deleteSocialStorage=fr=>{var br;const wr=(br=StorageService.getItem(SOCIAL_STORAGE_KEY))!==null&&br!==void 0?br:{};delete wr[fr],StorageService.setItem(SOCIAL_STORAGE_KEY,wr)},getSocialSignInProviderForProviderEnum=fr=>{if(!fr)return;const br=Object.values(SocialSignInProviderEnum);for(const wr of br)if(wr===fr)return wr},digestSHA256=fr=>{const wr=new TextEncoder().encode(fr);return window.crypto.subtle.digest("SHA-256",wr)},encodeBase64URL=fr=>{const br=[];return new Uint8Array(fr).forEach(wr=>br.push(wr)),btoa(String.fromCharCode.apply(null,br)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")},stringifyURIQuery=fr=>{const br=[];for(const wr in fr)br.push(encodeURIComponent(wr)+"="+encodeURIComponent(fr[wr]));return br.join("&")},getProviderByType=(fr,br)=>fr.find(wr=>wr.provider===br),APPLE_LOGIN_DATA={customMobileUrl:!0,response_mode:"form_post",response_type:["code","id_token"]},getMobileOauthUrl=(fr,br)=>{if(!(!(br!=null&&br.customMobileUrl)||!isMobile()||!fr.redirectUrl))return fr.redirectUrl.replace("redirect","authorizeHtml")},getOauthLoginUrl=(fr,br)=>{var wr,Er;const kr=getProviderByType(fr,br);if(!(kr!=null&&kr.clientId))return"";let jr;br===ProviderEnum.Apple&&(jr=APPLE_LOGIN_DATA);let Br;if(br===ProviderEnum.Telegram)Br=(wr=kr.authorizationUrl)!==null&&wr!==void 0?wr:"";else if(kr.baseAuthUrl)Br=kr.baseAuthUrl;else return"";const Wr=getMobileOauthUrl(kr,jr),qr={client_id:kr.clientId,redirect_uri:(Er=kr.redirectUrl)!==null&&Er!==void 0?Er:"",response_type:"code"};br===ProviderEnum.Tiktok&&(delete qr.client_id,qr.client_key=kr.clientId),kr.scopes&&(qr.scope=kr.scopes),jr!=null&&jr.prompt&&(qr.prompt=jr.prompt.join(" ")),jr!=null&&jr.response_mode&&(qr.response_mode=jr.response_mode),jr!=null&&jr.response_type&&(qr.response_type=jr.response_type.join(" "));const Gr=stringifyURIQuery(qr);return`${Wr??Br}?${Gr}`},randomString=fr=>{const br="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";let wr="";for(let Er=fr;Er>0;--Er)wr+=br[Math.floor(Math.random()*br.length)];return wr},initAuth=(fr,br,wr)=>__awaiter$e(void 0,void 0,void 0,function*(){try{yield sdkApi$1().initAuth({environmentId:fr,oauthInitAuthRequest:wr,providerType:br})}catch(Er){logger$6.error(Er)}}),verifyOAuth=(fr,br,wr)=>__awaiter$e(void 0,[fr,br,wr],void 0,function*(Er,kr,{code:jr,codeVerifier:Br,state:Wr}){const qr={code:jr,codeVerifier:Br,state:Wr};try{const Gr=yield sdkApi$1().oauthVerify({environmentId:Er,oauthRequest:qr,providerType:kr});return storeAuthTokenAndUser(Gr)}catch(Gr){return handleVerifyError(Gr)}}),signInOAuth=(fr,br,wr)=>__awaiter$e(void 0,[fr,br,wr],void 0,function*(Er,kr,{code:jr,codeVerifier:Br,state:Wr,captchaToken:qr,sessionPublicKey:Gr}){const Vr={captchaToken:qr,code:jr,codeVerifier:Br,sessionPublicKey:Gr,state:Wr};try{const Zr=yield sdkApi$1().oauthSignIn({environmentId:Er,oauthRequest:Vr,providerType:kr});return storeAuthTokenAndUser(Zr)}catch(Zr){return handleSignInError(Zr)}}),getOAuthResult=(fr,br,wr)=>__awaiter$e(void 0,[fr,br,wr],void 0,function*(Er,kr,{state:jr}){const Br={state:jr};try{return yield sdkApi$1().oauthResult({environmentId:Er,oauthResultRequest:Br,providerType:kr})}catch(Wr){logger$6.error(Wr);return}}),farcasterSignIn=(fr,br)=>__awaiter$e(void 0,void 0,void 0,function*(){try{const wr=yield sdkApi$1().farcasterSignIn({environmentId:fr,farcasterSignInRequest:br});return storeAuthTokenAndUser(wr)}catch(wr){return handleSignInError(wr)}}),farcasterVerify=fr=>__awaiter$e(void 0,void 0,void 0,function*(){try{const br=yield sdkApi$1().farcasterVerify(fr);return storeAuthTokenAndUser(br)}catch(br){return handleVerifyError(br)}}),telegramSignIn=(fr,br)=>__awaiter$e(void 0,void 0,void 0,function*(){const wr={environmentId:fr,oauthResultRequest:br};try{const Er=yield sdkApi$1().telegramSignIn(wr);return storeAuthTokenAndUser(Er)}catch(Er){return handleSignInError(Er)}}),isUserLinkedWithTelegram=(fr,br)=>__awaiter$e(void 0,void 0,void 0,function*(){const wr={environmentId:fr,oauthResultRequest:br};try{return yield sdkApi$1().telegramCheckAuth(wr),!0}catch{return!1}}),telegramVerify=(fr,br)=>__awaiter$e(void 0,void 0,void 0,function*(){const wr={environmentId:fr,oauthResultRequest:br};try{const Er=yield sdkApi$1().telegramVerify(wr);return storeAuthTokenAndUser(Er)}catch(Er){return handleVerifyError(Er)}}),handleVerifyError=fr=>__awaiter$e(void 0,void 0,void 0,function*(){logger$6.error(fr);const br=yield fr.json();if(br.code==="social_account_already_exists")throw new SocialAccountAlreadyExistsError;if(br.error.code==="sandbox_maximum_threshold_reached")throw new SandboxMaximumThresholdReachedError(br.error.message)}),handleSignInError=fr=>__awaiter$e(void 0,void 0,void 0,function*(){var br,wr,Er;logger$6.error(fr);const kr=yield fr.json();if(kr.error.code==="gate_blocked")throw new GateBlockedError(kr.payload.walletPublicKey);if(kr.error.code==="missing_from_list")throw new NoAccessError({socialProvider:(br=kr==null?void 0:kr.payload)===null||br===void 0?void 0:br.socialProvider,socialUsername:(wr=kr==null?void 0:kr.payload)===null||wr===void 0?void 0:wr.socialUsername,walletPublicKey:(Er=kr==null?void 0:kr.payload)===null||Er===void 0?void 0:Er.walletPublicKey});if(kr.code==="email_associated_with_different_provider")throw new AccountExistsError(kr.error,kr.payload);if(kr.error.code==="sandbox_maximum_threshold_reached")throw new SandboxMaximumThresholdReachedError(kr.error.message)}),CONNECT_URL="https://relay.farcaster.xyz/v1/channel",STATUS_URL="https://relay.farcaster.xyz/v1/channel/status",STATUS_TIMEOUT=3e5,STATUS_INTERVAL=1e3,connect=fr=>__awaiter$e(void 0,void 0,void 0,function*(){try{const br=yield FetchService.fetch(CONNECT_URL,{body:JSON.stringify(fr),headers:{"Content-Type":"application/json"},method:"POST"});if(!br.ok)throw new Error(`HTTP error! status: ${br.status}`);return yield br.json()}catch(br){logger$6.error("Error connecting with farcaster:",br);return}}),status=fr=>__awaiter$e(void 0,void 0,void 0,function*(){try{const br=yield FetchService.fetch(STATUS_URL,{headers:{Authorization:`Bearer ${fr.channelToken}`,"Content-Type":"application/json"},method:"GET"});if(!br.ok)throw new Error(`HTTP error! status: ${br.status}`);return yield br.json()}catch(br){logger$6.error("Error fetching farcaster connect status:",br);return}}),watchStatus=(fr,...br)=>__awaiter$e(void 0,[fr,...br],void 0,function*(wr,{timeout:Er=STATUS_TIMEOUT,interval:kr=STATUS_INTERVAL}={}){const jr=Date.now()+Er;let Br=!0,Wr;dynamicEvents.on("farcasterConnectCancelled",()=>{Br=!1,Wr==null||Wr(),Wr=void 0});const qr=Gr=>{Wr=Gr,setTimeout(Gr,kr)};for(;Br&&Date.now(){const{environmentId:kr,setShowAuthFlow:jr,socialSettings:Br,projectSettings:Wr,consumeNonce:qr,redirectUrl:Gr}=useInternalDynamicContext(),Vr=reactExports.useMemo(()=>(Br==null?void 0:Br.strategy)||"redirect",[Br]),{setErrorMessage:Zr,setError:Jr}=useErrorContext(),{initAuth:Qr}=useUserAuth({authMethod:"social"}),{generateSessionKey:_n,shouldRegisterSessionKeysOnSignin:En}=useEmbeddedWalletSessionKeys(kr),[Cn,In]=reactExports.useState(!1),[An,jn]=reactExports.useState(),eo=reactExports.useCallback(()=>{jn(void 0),Jr(void 0)},[Jr]),ro=reactExports.useCallback((Tn,Hr,Xr)=>{In(!1),wr==null||wr(),br==null||br(),Tn&&(Xr!=null&&Xr.raiseAuthFailure)&&dynamicEvents.emit("authFailure",{option:Tn,provider:Tn,type:"social"},Hr)},[wr,br]),to=reactExports.useCallback((Tn,Hr,Xr,Sn)=>{const Rn={code:Hr,message:Xr};logger$6.error(Xr),jn(Rn),Zr(Hr),ro(Tn,{error:Rn},Sn)},[ro,Zr]),_i=reactExports.useCallback((Tn,Hr)=>Tn?socialProviders.includes(Tn)?!0:(to(Tn,SocialOAuthErrorCode.INVALID_PROVIDER,`Invalid social provider. Valid providers are: ${socialProviders.join(", ")}`,{raiseAuthFailure:Hr==="signin"}),!1):(to(Tn,SocialOAuthErrorCode.NO_PROVIDER,"Provider is required",{raiseAuthFailure:Hr==="signin"}),!1),[to]),oo=reactExports.useCallback((Tn,Hr)=>__awaiter$e(void 0,void 0,void 0,function*(){try{if(!(yield Hr())){to(Tn,SocialOAuthErrorCode.VERIFICATION_ERROR,`Failed to link social account: ${Tn}`,{raiseAuthFailure:!1});return}br==null||br()}catch(Xr){Xr instanceof SocialAccountAlreadyExistsError&&to(Tn,SocialOAuthErrorCode.ACCOUNT_ALREADY_LINKED_TO_DIFFERENT_PROFILE,`Social account already linked to a different profile: ${Tn}`,{raiseAuthFailure:!1})}}),[to,br]),io=reactExports.useCallback((Tn,Hr)=>__awaiter$e(void 0,void 0,void 0,function*(){yield Qr({onError:()=>to(Tn,SocialOAuthErrorCode.SIGNIN_ERROR,`Failed to sign-in with social account: ${Tn}`,{raiseAuthFailure:!0}),onSettled:br,options:{provider:Tn},verifyFunction:()=>Hr()})}),[to,Qr,br]),co=reactExports.useCallback(Tn=>__awaiter$e(void 0,[Tn],void 0,function*({authMode:Hr,provider:Xr,state:Sn,authCode:Rn,captchaToken:Pn,verifier:On,telegramAuthToken:Zn,forceCreateUser:Nn=!1}){try{let wn;if(En()&&(wn=(yield _n()).publicKey),Hr==="signin"){if(Xr===ProviderEnum.Telegram&&Zn)return yield io(Xr,()=>telegramSignIn(kr,{forceCreateUser:Nn,sessionPublicKey:wn,telegramAuthToken:Zn}));Xr===ProviderEnum.Telegram?yield io(Xr,()=>telegramSignIn(kr,{code:Rn,sessionPublicKey:wn,state:Sn})):yield io(Xr,()=>signInOAuth(kr,Xr,{captchaToken:Pn,code:Rn,codeVerifier:On,sessionPublicKey:wn,state:Sn}))}else Xr===ProviderEnum.Telegram?yield oo(Xr,()=>telegramVerify(kr,{code:Rn,state:Sn})):yield oo(Xr,()=>verifyOAuth(kr,Xr,{code:Rn,codeVerifier:On,state:Sn}))}catch(wn){logger$6.error("Social connection failed with unexpected error:",wn),ro(Xr,{error:wn},{raiseAuthFailure:Hr==="signin"})}}),[kr,_n,oo,ro,En,io]),so=reactExports.useCallback((Tn,Hr)=>__awaiter$e(void 0,[Tn,Hr],void 0,function*(Xr,{captchaToken:Sn,redirectUrl:Rn}){const Pn=qr(),On=PlatformService.getHost(),Zn=yield connect({domain:On,nonce:Pn,redirectUrl:Rn||Gr,siweUri:PlatformService.getOrigin()});if(!(Zn!=null&&Zn.url)||!(Zn!=null&&Zn.channelToken)){to(ProviderEnum.Farcaster,SocialOAuthErrorCode.GENERAL_ERROR,"Farcaster didn't return a valid url.",{raiseAuthFailure:Xr==="signin"});return}isMobile()?yield PlatformService.openURL(Zn.url):(jr(!0),Er==null||Er(Zn.url));const Nn=yield watchStatus({channelToken:Zn.channelToken});if(Nn==="cancelled"){In(!1);return}if(Nn==="timeout"||Nn==="rejected"||!(Nn!=null&&Nn.message)||!(Nn!=null&&Nn.custody)||!(Nn!=null&&Nn.signature)||!(Nn!=null&&Nn.nonce)){to(ProviderEnum.Farcaster,SocialOAuthErrorCode.GENERAL_ERROR,"Farcaster didn't return valid data.",{raiseAuthFailure:Xr==="signin"});return}const{custody:wn,message:zn,signature:fo,nonce:vo}=Nn;if(Xr==="signin"){let go;En()&&(go=(yield _n()).publicKey);const uo=()=>farcasterSignIn(kr,{address:wn,captchaToken:Sn,domain:On,message:zn,nonce:vo,sessionPublicKey:go,signature:fo});yield io(ProviderEnum.Farcaster,uo)}else{const go=()=>farcasterVerify({environmentId:kr,farcasterSignInRequest:{address:wn,captchaToken:Sn,domain:On,message:zn,nonce:vo,signature:fo}});yield oo(ProviderEnum.Farcaster,go),jr(!1,{clearErrors:!1})}In(!1)}),[qr,Gr,kr,_n,to,oo,Er,jr,En,io]),no=reactExports.useCallback(Tn=>__awaiter$e(void 0,[Tn],void 0,function*({authMode:Hr,provider:Xr,validator:Sn,captchaToken:Rn,redirectUrl:Pn,telegramAuthToken:On}){var Zn,Nn;if(eo(),In(!0),!Hr){logger$6.error('Auth mode is required. Please use either "link" or "signin"');return}if(!_i(Xr,Hr)||Sn&&!Sn(Xr))return;if(dynamicEvents.emit("authInit",{option:Xr,provider:Xr,type:"social"}),Xr===ProviderEnum.Farcaster)return so(Hr,{captchaToken:Rn,redirectUrl:Pn});const wn=randomString(32),zn=randomString(43),fo=providersRequiringPkce.includes(Xr);setSocialStorageFor(Xr,{captchaToken:Rn,codeVerifier:fo?zn:void 0,mode:Hr,state:wn});const vo=getOauthLoginUrl((Zn=Wr==null?void 0:Wr.providers)!==null&&Zn!==void 0?Zn:[],Xr);if(!vo){to(Xr,SocialOAuthErrorCode.NO_OAUTH_URL,`Failed to get login url to connect social account: ${Xr}`,{raiseAuthFailure:Hr==="signin"});return}const go=new URL(vo);if(go.searchParams.set("state",wn),fo){const lo=yield digestSHA256(zn);go.searchParams.set("code_challenge",encodeBase64URL(lo)),go.searchParams.set("code_challenge_method","S256")}const uo=isMobile();try{const lo=yield Oauth2Service.getOauthCode({apiProvider:getProviderByType((Nn=Wr==null?void 0:Wr.providers)!==null&&Nn!==void 0?Nn:[],Xr),getOAuthResultFromApi:()=>getOAuthResult(kr,Xr,{state:wn}),initWebAuth:({redirectUrl:Eo}={})=>initAuth(kr,Xr,{redirectUrl:Eo?removeDynamicOauthParamsFromUrl(Eo):void 0,state:wn}),isMobile:uo,oauthLoginUrl:go,onSettled:br,provider:Xr,redirectUrl:Pn??Gr,sessionTimeout:fr,setIsProcessing:In,state:wn,strategy:Vr});yield co({authCode:lo,authMode:Hr,captchaToken:Rn,provider:Xr,state:wn,telegramAuthToken:On,verifier:zn})}catch(lo){if(Oauth2Service.isGetOauthCodeError(lo)){to(Xr,lo.code,lo.message,{raiseAuthFailure:Hr==="signin"});return}logger$6.error("Social connection failed with unexpected error:",lo),ro(Xr,{error:lo},{raiseAuthFailure:Hr==="signin"})}}),[_i,eo,co,so,Gr,kr,to,ro,br,Wr==null?void 0:Wr.providers,fr,Vr]);return reactExports.useMemo(()=>({checkValidProvider:_i,completeConnection:co,connectSocialAccount:no,error:An,handleError:to,isProcessing:Cn,setError:jn,setIsProcessing:In}),[_i,co,no,An,to,Cn])},removeDynamicOauthParamsFromUrl=fr=>{const br=new URL(fr);return br.searchParams.delete("dynamicOauthState"),br.searchParams.delete("dynamicOauthCode"),br.toString()},useRedirectSocialHandler=({setSocialProvider:fr})=>{const{setView:br}=useViewContext(),{setDynamicWidgetView:wr}=useWidgetContext(),[Er,kr]=reactExports.useState(null),{sdkHasLoaded:jr,setShowAuthFlow:Br,isRenderingEmbeddedAuthFlow:Wr,setShowDynamicUserProfile:qr}=useInternalDynamicContext(),{completeConnection:Gr}=useSocialAuth({sessionTimeout:1e4}),Vr=reactExports.useCallback(Jr=>{const Qr=getSocialSignInProviderForProviderEnum(Jr.provider);fr(Qr),br("social-redirect-view"),Wr.current||Br(!0)},[fr,br,Wr,Br]),Zr=reactExports.useCallback(()=>{wr("profile"),qr(!0)},[wr,qr]);useEffectOnce(()=>{if(isSSR())return;const Jr=new URL(window.location.href),Qr=Jr.searchParams.get("dynamicOauthState"),_n=Jr.searchParams.get("dynamicOauthCode");if(!Qr||!_n)return;const En=searchSocialStorageByState(Qr);En&&(En.code=_n,kr(En),deleteSocialStorage(En.provider))}),useEffectOnceCondition(()=>__awaiter$e(void 0,void 0,void 0,function*(){if(Er){if(Er.mode==="signin"){if(getUser()){logger$6.error(new DynamicError("User is already logged in"));return}Vr(Er)}else if(Er.mode==="link"){if(!getUser()){logger$6.error(new DynamicError("User not logged in"));return}Zr()}yield Gr({authCode:Er.code,authMode:Er.mode,captchaToken:Er.captchaToken,provider:Er.provider,state:Er.state,verifier:Er.codeVerifier})}}),!!Er&&jr)},SocialRedirectContext=reactExports.createContext(void 0),SocialRedirectContextProvider=({children:fr})=>{var br,wr,Er,kr;const{setShowAuthFlow:jr,walletConnectorOptions:Br,setSelectedWalletConnectorKey:Wr,walletUiUtils:qr,consumeNonce:Gr,displaySiweStatement:Vr,environmentId:Zr,projectSettings:Jr,setIsSingleWalletAccount:Qr,setShowDynamicUserProfile:_n,setPrimaryWalletId:En,secondaryWallets:Cn,sdkHasLoaded:In,user:An,connectWallet:jn,primaryWallet:eo,socialProvidersFilter:ro=wn=>wn}=useInternalDynamicContext(),{setErrorMessage:to}=useErrorContext(),{setView:_i}=useViewContext(),{getCaptchaToken:oo}=useCaptchaContext(),io=useVerifyWallet({consumeNonce:Gr,displaySiweStatement:Vr,environmentId:Zr,projectSettings:Jr,setIsSingleWalletAccount:Qr}),co=(br=Jr==null?void 0:Jr.sdk.socialSignIn)===null||br===void 0?void 0:br.signInProvider,so=(Er=(wr=Jr==null?void 0:Jr.sdk.socialSignIn)===null||wr===void 0?void 0:wr.providers)!==null&&Er!==void 0?Er:[],no=(kr=ro(so.filter(wn=>wn.enabled).map(wn=>wn.provider)))!==null&&kr!==void 0?kr:[],Tn=Br.map(({walletConnector:wn})=>wn).find(isSocialWalletConnector),[Hr,Xr]=reactExports.useState("idle"),[Sn,Rn]=reactExports.useState(),On=(eo?[eo,...Cn]:Cn).find(wn=>wn.connector.key===(Tn==null?void 0:Tn.key)),Zn=reactExports.useMemo(()=>On?getReferencedAccount(An,On.id):void 0,[An,On]);useInternalDynamicEvents("logout",()=>Rn(void 0));const Nn=reactExports.useCallback(wn=>{logger$6.error(wn),An?(jr(!1,{emitCancelAuth:!0}),_n(!0)):(jr(!0),_i("wallet-list"),to("-1"))},[An,to,jr,_n,_i]);return reactExports.useEffect(()=>{var wn,zn;if(!Jr||!Tn||!In){new URLSearchParams(window.location.search).has("magic_oauth_request_id")&&(_i("social-redirect-view"),jr(!0));return}const fo=new URLSearchParams(window.location.search);if(fo.has("error")&&fo.has("provider")){const vo=fo.get("error_description");Nn(vo??"Unknown error"),(wn=Tn.getSession)===null||wn===void 0||wn.call(Tn);return}if(fo.has("magic_oauth_request_id")){const vo=fo.get("provider");Rn(vo),Xr("loading"),_i("social-redirect-view"),jr(!0),An||Wr(Tn.key),(zn=Tn.getSession)===null||zn===void 0||zn.call(Tn).then(go=>__awaiter$e(void 0,void 0,void 0,function*(){if(An){if(!Zn)throw new Error("Social account not found");Zn.oauthAccountId===go.oauthId?(On==null?void 0:On.id)!==(eo==null?void 0:eo.id)&&(En(On.id),jr(!1),_n(!0)):(yield Tn.endSession(),_i("social-wrong-account"))}else{yield jn(Tn);const uo=yield Tn.getAddress();qr.disabledConfirmationOnce(),yield io({captchaToken:oo(),oauth:{accessToken:go.accessToken,didToken:go.didToken,provider:vo},publicWalletAddress:uo,walletConnector:Tn})}Rn(void 0),Xr("success")})).catch(go=>{Rn(void 0),Xr("error"),Nn(go)})}},[Zn,An,Jr,In,Cn,En,Wr,jr,_n,_i,Tn,io,qr,On,Nn,jn,eo==null?void 0:eo.id,oo]),useRedirectSocialHandler({setSocialProvider:Rn}),jsxRuntimeExports.jsx(SocialRedirectContext.Provider,{value:{enabledSocialProviders:no,redirectStatus:Hr,setSocialProvider:Rn,signInProvider:co,socialAccount:Zn,socialProvider:Sn,socialWalletConnector:Tn},children:fr})},useSocialRedirectContext=()=>{const fr=reactExports.useContext(SocialRedirectContext);if(fr===void 0)throw new Error("useSocialRedirectContext must be used within a SocialRedirectContextProvider");return fr},AnimatePresence=({children:fr,animationComponent:br})=>{const[wr,Er]=reactExports.useState(!0),kr=useForceUpdate$1(),jr=reactExports.useRef(null),Br=reactExports.useMemo(()=>!!fr,[fr]),Wr=usePrevious$1(Br),qr=reactExports.useCallback(()=>{jr.current=null,kr()},[kr]);return reactExports.useEffect(()=>{reactExports.isValidElement(fr)&&(jr.current=reactExports.Children.map(fr,Gr=>reactExports.cloneElement(Gr)))},[fr]),reactExports.useEffect(()=>{Br&&!Wr&&Er(!0),Wr&&!Br&&Er(!1)},[Br,Wr]),reactExports.cloneElement(br,{children:fr||jr.current,isShown:wr,onUnmount:qr})},ErrorContainer=({children:fr,className:br,isMultiWalletError:wr=!1,withIcon:Er=!0,variant:kr="error",copykey:jr})=>{const Br=classNames$1("error-container",`error-container--${kr}`,br,{"error-container--multi-wallet":wr}),Wr=classNames$1("error",{"error--with-icon":Er});return jsxRuntimeExports.jsxs("div",{className:Br,"data-testid":`error-container--${kr}`,children:[Er&&jsxRuntimeExports.jsx(SvgError,{}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",className:Wr,copykey:jr,children:fr})]})};var PasskeySuccessEnum;(function(fr){fr[fr.CREATED=0]="CREATED",fr[fr.EDITED=1]="EDITED"})(PasskeySuccessEnum||(PasskeySuccessEnum={}));const PasskeyCreatedSuccessBanner=({className:fr})=>{const{passkeySuccessPopup:br}=useInternalDynamicContext(),{t:wr}=useTranslation();return jsxRuntimeExports.jsxs(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(OpacityTransition,{}),children:[br===PasskeySuccessEnum.EDITED&&jsxRuntimeExports.jsx(ErrorContainer,{variant:"success",className:fr,copykey:"dyn_passkey_success.edited",children:wr("dyn_passkey_success.edited")}),br===PasskeySuccessEnum.CREATED&&jsxRuntimeExports.jsx(ErrorContainer,{variant:"success",className:fr,copykey:"dyn_passkey_success.created",children:wr("dyn_passkey_success.created")})]})};var css_248z$1='@layer shadow-reset{.dynamic-shadow-dom-content{all:initial}}@layer preflight{a,hr{color:inherit}progress,sub,sup{vertical-align:baseline}blockquote,body,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,menu,ol,p,pre,ul{margin:0}fieldset,legend,menu,ol,ul{padding:0}*,:after,:before{border:0 solid;box-sizing:border-box}html{-webkit-text-size-adjust:100%;-moz-text-size-adjust:100%;text-size-adjust:100%;font-feature-settings:normal;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5;-moz-tab-size:4;-o-tab-size:4;tab-size:4}body{line-height:inherit}hr{border-top-width:1px;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;-moz-appearance:button;appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none;appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;appearance:button;font:inherit}summary{display:list-item}menu,ol,ul{list-style:none}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]{display:none}}.accordion-item{overflow:hidden;position:relative;transition-duration:.15s;transition-property:max-height;transition-timing-function:ease-out}.accordion-item--full-height{height:100vh}.accordion-item__curtain{background-color:var(--dynamic-overlay);left:0;opacity:0;position:absolute;right:0;top:0;transition:opacity 50ms ease-in;z-index:1}.accordion-item__curtain--dimmed{bottom:0;opacity:1}.vertical-accordion__container{display:flex;flex-direction:column}.alert{align-items:center;border-radius:calc(var(--dynamic-border-radius)/3);display:flex;gap:.75rem;padding:.75rem}.alert--error{background-color:var(--dynamic-error-2);color:var(--dynamic-error-1)}.alert--warning{background-color:var(--dynamic-alert-2);color:var(--dynamic-alert-1)}.alert--info{background-color:var(--dynamic-brand-secondary-color);color:var(--dynamic-brand-primary-color)}.alert__icon{flex-shrink:0}.badge__container{align-items:center;border-radius:9999px;display:flex;font-size:.625rem;font-weight:500;gap:.25rem;padding:.25rem .5rem;position:relative;transition:color .3s,background-color .3s;white-space:nowrap}.badge__container__primary{background-color:var(--dynamic-badge-primary-background);color:var(--dynamic-badge-primary-color)}.badge__container__secondary{background-color:var(--dynamic-badge-background);color:var(--dynamic-badge-color)}.badge__dot{background-color:var(--dynamic-badge-dot-background);border-radius:9999px;height:.375rem;transition:color .3s,background-color .3s;width:.375rem}.button{align-items:center;cursor:pointer;display:flex;gap:.375rem;justify-content:center;position:relative;transition:all .2s ease}.button:disabled:not(.button--loading){cursor:default;opacity:.5}.button--expanded{width:100%}.button--brand-primary{background:var(--dynamic-brand-primary-color);border:var(--dynamic-button-primary-border);box-shadow:var(--dynamic-shadow-down-1);color:#fff;padding:var(--dynamic-button-primary-padding)}.button--brand-primary .typography{font-size:var(--dynamic-button-primary-font-size)}.button--brand-primary:hover:enabled{box-shadow:var(--dynamic-button-shadow)}.button--brand-primary:active:enabled,.button--primary{box-shadow:var(--dynamic-shadow-down-1)}.button--primary{background:var(--dynamic-button-primary-background);border:var(--dynamic-button-primary-border);padding:var(--dynamic-button-primary-padding)}.button--primary .typography{font-size:var(--dynamic-button-primary-font-size)}.button--primary:hover:enabled{box-shadow:var(--dynamic-button-shadow)}.button--primary:active:enabled,.button--secondary{box-shadow:var(--dynamic-shadow-down-1)}.button--secondary{background:var(--dynamic-button-secondary-background);border:var(--dynamic-button-secondary-border);padding:var(--dynamic-button-secondary-padding)}.button--secondary .typography{font-size:var(--dynamic-button-primary-font-size)}.button--secondary:hover:enabled{background:var(--dynamic-hover)}.button--secondary:active:enabled{background:var(--dynamic-base-3)}.button--tertiary,.button--tertiary .typography{color:var(--dynamic-text-secondary)}.button--tertiary:hover:enabled,.button--tertiary:hover:enabled .typography{color:var(--dynamic-text-primary)}.button--padding-default{border-radius:calc(var(--dynamic-border-radius)/2);padding:.625rem 1rem}.button--padding-large{border-radius:var(--dynamic-button-border-radius);padding:.875rem 1.25rem}.button--padding-medium{border-radius:calc(var(--dynamic-button-border-radius)/1.5);padding:.625rem 1rem}.button--padding-small{border-radius:calc(var(--dynamic-button-border-radius)/2);padding:.5rem .75rem}.button--padding-none{padding:0}.button--padding-login-screen-height{border-radius:calc(var(--dynamic-border-radius)/2);height:2.5rem;padding:0 1rem}.button__spinner{margin-left:auto;margin-right:auto}.button__end-slot,.button__start-slot{display:inline-flex}.button__spinner-container{align-items:center;bottom:0;color:var(--dynamic-text-primary);display:flex;justify-content:center;left:0;position:absolute;right:0;top:0}.button--loading>:not(.button__spinner-container){opacity:0}.checkbox--hidden{cursor:pointer;display:block;height:1rem;opacity:0;position:absolute;width:1rem;z-index:10}.checkbox--hidden:checked+.checkbox--visible{background:var(--dynamic-brand-primary-color);border-style:none}.checkbox--hidden:checked+.checkbox--visible>.checkbox__icon{opacity:1}.checkbox--hidden:disabled{pointer-events:none}.checkbox--visible{align-items:center;background:var(--dynamic-base-3);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/4);display:flex;height:1rem;justify-content:center;position:absolute;transition-duration:.2s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);width:1rem;z-index:0}.checkbox__container{height:1rem;position:relative;width:1rem}.checkbox__icon{color:#fff;height:.75rem;opacity:0;transition-duration:.2s;transition-property:opacity;width:.75rem}.connect-button{background:var(--dynamic-connect-button-background);border:var(--dynamic-connect-button-border);border-radius:calc(var(--dynamic-connect-button-radius, var(--dynamic-border-radius))/2);box-shadow:var(--dynamic-connect-button-shadow)}.connect-button:hover:enabled{background:var(--dynamic-connect-button-background-hover);border:var(--dynamic-connect-button-border-hover);box-shadow:var(--dynamic-connect-button-shadow-hover)}.connect-button:hover:enabled .typography{color:var(--dynamic-connect-button-color-hover)}.connect-button .typography{color:var(--dynamic-connect-button-color)}.copy-button__container{position:relative}.copy-button__tooltip{background-color:var(--dynamic-text-primary);color:var(--dynamic-base-2);font-size:.75rem}@keyframes enter-tile{0%{opacity:0;transform:translateY(.5rem)}to{opacity:1;transform:translateY(0)}}.enter-list-tile-animation{animation-duration:.2s;animation-fill-mode:both;animation-iteration-count:1;animation-name:enter-tile;animation-timing-function:ease-out}.error-container{align-items:center;display:flex;justify-content:center;margin-bottom:.5rem;padding:.5rem .75rem}.error-container img,.error-container svg{height:1.25rem;width:1.25rem}.error-container--error{background:var(--dynamic-error-2);color:var(--dynamic-error-1)}.error-container--info{background:var(--dynamic-base-3);color:var(--dynamic-text-primary)}.error-container--success{background:var(--dynamic-success-2);color:var(--dynamic-success-1)}.error-container--multi-wallet{margin-bottom:.75rem}.error--with-icon{margin-left:.875rem}.icon--color-brand-primary{color:var(--dynamic-brand-primary-color)}.icon--color-text-primary{color:var(--dynamic-text-primary)}.icon--color-text-secondary{color:var(--dynamic-text-secondary)}.icon--color-text-tertiary{color:var(--dynamic-text-tertiary)}.icon--color-text-error{color:var(--dynamic-error-1)}.icon--color-success-1{color:var(--dynamic-success-1)}.icon--size-xsmall{height:.75rem;width:.75rem}.icon--size-small{height:1rem;width:1rem}.icon--size-mini{height:1.25rem;width:1.25rem}.icon--size-medium{height:1.5rem;width:1.5rem}.icon--size-mlarge{height:1.875rem;width:1.875rem}.icon--size-large{height:2.375rem;width:2.375rem}.icon-button{align-items:center;border-radius:100%;color:var(--dynamic-text-tertiary);display:flex;justify-content:center}.icon-button svg:hover{color:var(--dynamic-text-secondary)}.icon-button svg:active{color:var(--dynamic-text-primary)}.indicator__container{align-items:center;background:var(--dynamic-base-1);border-radius:100%;bottom:0;display:flex;justify-content:center;position:absolute;right:0}.indicator__icon{background:var(--dynamic-success-1);border-radius:100%}.indicator__wallet-connect{background:#4084ed;bottom:0;color:#fff;position:absolute;right:-.125rem}.icon-with-spinner__container,.indicator__wallet-connect{align-items:center;border-radius:9999px;display:flex;justify-content:center}.icon-with-spinner__container{position:relative}.icon-with-spinner__container img{height:100%;width:100%}.icon-with-spinner__icon-container{align-items:center;display:flex;justify-content:center;position:relative}.icon-with-spinner__spinner-container{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));position:absolute;right:0;top:0}.icon-with-spinner__spinner{grid-column-start:2;grid-row-start:1;height:100%;width:100%}.icon-with-spinner__animation{animation:spin 1.4s linear infinite}.icon-with-status__container{margin-bottom:12px;max-width:-moz-fit-content;max-width:fit-content;position:relative}.icon-with-status__container .icon{border-radius:100%}.icon-with-status__status-dot{bottom:-.125rem;position:absolute;right:-.25rem}.icon-with-status__container .inner-icon__container{background:var(--dynamic-base-1);border-radius:100%;bottom:-.125rem;padding:.1875rem;position:absolute;right:-.1875rem}.icon-with-status__container .inner-icon{border-radius:100%}.icon-with-status__container .inner-icon svg{height:1rem;width:1rem}.icon-with-status__container .inner-icon--green{background:var(--dynamic-success-1)}.icon-with-status__container .inner-icon--red{background:var(--dynamic-error-1)}.icon-with-status__container .inner-icon path{fill:var(--dynamic-base-1)}.icon-with-status__container .status-dot__container{align-items:center;background:var(--dynamic-base-1);border-radius:100%;bottom:-.125rem;display:flex;height:.625rem;justify-content:center;position:absolute;right:-.25rem;width:.625rem}.icon-with-status__container .status-dot{border-radius:100%;height:.375rem;width:.375rem}.icon-with-status__container .status-dot--green{background:var(--dynamic-success-1)}.icon-with-status__container .status-dot--red{background:var(--dynamic-error-1)}.info-item__container{color:var(--dynamic-text-tertiary);display:flex}.info-item__container a{text-decoration:underline}.info-item__container .info-item__icon-container{border-radius:calc(var(--dynamic-border-radius)/3);color:var(--dynamic-text-tertiary);display:flex;margin-right:1.125rem}.info-item__container .info-item__icon-container svg{height:1.5rem;width:1.5rem}.info-item__container .info-item__secondary-text{margin-top:.25rem}.phone-number-field{display:flex;flex-direction:column}.phone-number-field__fields{align-items:stretch;display:flex;position:relative;width:100%}.phone-number-field__fields__country-code{align-items:center;background-color:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)*.4) 0 0 calc(var(--dynamic-border-radius)*.4);border-right:none;cursor:pointer;display:flex;padding-left:.75rem;position:relative;transition:all .2s ease;width:6.25rem}.phone-number-field__fields__country-code--disabled{background-color:var(--dynamic-base-3);pointer-events:none}.phone-number-field__fields__country-code__flag{margin-right:.5rem}.phone-number-field__fields__country-code__plus{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.phone-number-field__fields__country-code__container{align-items:center;display:flex;flex:1;pointer-events:none}.phone-number-field__fields__country-code .phone-number-field__fields__country-code__container .phone-number-field__fields__country-code__container__input{border:none;flex:1;padding:0;width:100%}.phone-number-field__fields__country-code__chevron{cursor:pointer;position:absolute;right:.5rem;width:1rem}.phone-number-field__fields__phone-number{align-items:center;display:flex;flex:1;position:relative}.phone-number-field__fields .phone-number-field__fields__phone-number .phone-number-field__fields__phone-number__input{border-radius:0 calc(var(--dynamic-border-radius)*.4) calc(var(--dynamic-border-radius)*.4) 0;padding-left:.75rem}.phone-number-field__fields__placeholder{align-self:center;color:var(--dynamic-text-secondary);left:7.0625rem;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.phone-number-field__fields__inline-submit{align-self:center;position:absolute;right:.75rem}.phone-number-field__dropdown{width:calc(var(--dynamic-modal-width) - 3rem)}.phone-number-field__dropdown__items{display:flex;flex-direction:column}.phone-number-field__dropdown__items__country{align-items:center;cursor:pointer;display:flex;gap:.375rem;padding:.375rem .75rem}.phone-number-field__dropdown__items__country__flag{width:1.5rem}.phone-number-field__dropdown__items__country__name{font-size:var(--dynamic-text-size-body-small)}.phone-number-field__dropdown__items__country__code{color:var(--dynamic-text-secondary);font-size:var(--dynamic-text-size-body-small)}.phone-number-field__dropdown__items__country:hover{background-color:var(--dynamic-base-4)}.phone-number-field__dropdown__items__country--selected{background-color:var(--dynamic-base-3)}.phone-number-field__error-message{color:var(--dynamic-error-1);padding:.5rem 0}.phone-number-field input::-webkit-inner-spin-button,.phone-number-field input::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.phone-number-field input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.inline-submit-button{--icon-arrow:var(--dynamic-text-tertiary);--icon-background:var(--dynamic-base-3);transition:all .2s}.inline-submit-button path,.inline-submit-button rect{transition:all .2s}.inline-submit-button--active,.inline-submit-button:hover{--icon-arrow:var(--dynamic-text-secondary);--icon-background:var(--dynamic-hover)}.inline-submit-button--ready,.inline-submit-button--ready:hover{--icon-arrow:var(--dynamic-base-2);--icon-background:var(--dynamic-brand-primary-color)}.input__container{position:relative}.input__container .input__suffix{position:absolute;right:1rem;top:1rem}.input__container .input{background:var(--dynamic-base-2);border-color:var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)*.4);border-width:.0625rem;color:var(--dynamic-text-primary);font-size:.9375rem;font-weight:400;margin:0;outline:none;transition:all .2s ease;width:100%}.input__container .input:disabled{background:var(--dynamic-base-3);border-color:var(--dynamic-base-4)}.input__container .input:disabled .input__label{color:var(--dynamic-text-tertiary)}.input__container .input__label{color:var(--dynamic-text-secondary);cursor:text;font-size:.625rem;pointer-events:none}.input__container .input:not(.input__error):focus,.input__container .input:not(.input__error):hover{background:var(--dynamic-base-2);border-color:var(--dynamic-base-4)}.input__container .input__error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.input__container .input__error~.input__label,.input__container .input__error~.input__trailing{color:var(--dynamic-error-1)}.input__container .input__has_trailing{padding-right:4rem}.input__container .input__trailing{color:var(--dynamic-text-secondary);font-size:.75rem;font-weight:500;position:absolute;right:.75rem;top:50%;transform:translateY(-50%)}.input__container--dense .input{padding:1.125rem .75rem .375rem}.input__container--dense .input::-moz-placeholder{color:transparent}.input__container--dense .input::placeholder{color:transparent}.input__container--dense .input--no-label{padding-block:.75rem}.input__container--dense .input__label{left:.75rem;position:absolute;top:.4375rem;transition:all .2s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none}.input__container--dense .input:-moz-placeholder-shown~.input__label{font-size:.9375rem;top:.75rem}.input__container--dense .input:placeholder-shown~.input__label{font-size:.9375rem;top:.75rem}.input__container--dense .input:focus~.input__label{font-size:.625rem;top:.4375rem}.input__container--regular{display:flex;flex-direction:column}.input__container--regular .input{padding:.75rem}.input__container--regular .input__label{align-items:center;display:inline-flex;font-size:.75rem;line-height:1rem;margin-bottom:.5rem;order:-1}.input__container--regular .input__label:after{background:var(--dynamic-base-4);content:"";flex:1;height:1px;margin-left:.75rem;right:0}.input__container--regular .input__suffix{top:2.375rem}.input__message{color:var(--dynamic-text-primary);padding:.5rem 0}.input__message__error{color:var(--dynamic-error-1)}.list-tile{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;gap:.625rem;padding:var(--dynamic-wallet-list-tile-padding);transition-duration:var(--dynamic-wallet-list-tile-animation-duration);transition-property:all;transition-timing-function:ease-out;width:100%}.list-tile:not(:disabled):active{transform:scale(.95)}.list-tile:not(:disabled):hover{background-color:var(--dynamic-wallet-list-tile-background-hover);border:var(--dynamic-wallet-list-tile-border-hover);box-shadow:var(--dynamic-wallet-list-tile-shadow-hover)}.list-tile__children{flex-grow:1;text-align:left}.modal-header{align-items:center;background:var(--dynamic-header-background);display:flex;justify-content:center;padding:var(--dynamic-header-padding);width:100%}.modal-header--border{border-bottom:var(--dynamic-header-border-bottom)}.modal-header--align-content-bottom{align-items:start}.modal-header--empty{padding-bottom:0}.modal-header__leading,.modal-header__trailing{align-items:center;display:flex;flex:1;gap:.25rem;height:1.5rem;justify-content:flex-start;margin-right:auto}.modal-header__leading--empty{height:0}.modal-header__trailing{justify-content:flex-end;margin-left:auto;margin-right:0}.modal-header__trailing--empty{height:0}.evm-network-control__container{align-items:center;background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);bottom:0;color:var(--dynamic-text-primary);display:flex;gap:.375rem;max-width:100%;padding:.25rem;position:absolute;right:0;transform:translateX(50%)}.evm-network-control__container--error{border:1px solid var(--dynamic-error-1);color:var(--dynamic-error-1);cursor:auto}.evm-network-control__network-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.evm-network-control__arrow-icon{min-width:1rem;transform:rotate(90deg);transition:transform .15s linear}.evm-network-control__arrow-icon--active{transform:rotate(-90deg)}@keyframes spinner-animation{0%{transform:rotate(0)}to{transform:rotate(1turn)}}.network{color:var(--dynamic-text-primary);display:flex;justify-content:space-between;width:100%}.network .network__container{align-items:flex-start;display:flex}.network .network__title-icon{height:1rem;margin-right:.5rem;margin-top:.0625rem;width:1rem}.network .network__title-container{display:flex;flex-direction:column;gap:.25rem}.network .network__title-copy{white-space:nowrap}.network .network__status-container{align-items:center;border-radius:100%;display:flex;height:1rem;justify-content:center;width:1rem}.network .network__status-container .network__status-icon{color:#fff;height:.75rem;width:.75rem}.network .network__status-container .network__status-icon svg path{fill:currentcolor}.network .network__status-container .network__status-spinner-icon{animation:spinner-animation 2s linear infinite;height:.75rem;margin-right:-.9375rem;margin-top:-.75rem;transform-origin:0 100%;width:.75rem}.network .network__status-container--active{background-color:var(--dynamic-brand-primary-color)}.network-action{align-items:center;display:flex;padding:.5rem 1rem}@media (pointer:coarse){.network-action{padding:.5rem 1.5rem}}.network-action:not(.network--not-supported){cursor:pointer}.network-action:not(.network--not-supported):hover{background-color:var(--dynamic-hover)}.network-control-skeleton{align-items:center;border-radius:calc(var(--dynamic-border-radius)/2);display:flex;gap:.375rem;justify-content:center;padding:.1875rem .25rem}.network-control-skeleton__icon{background-color:var(--dynamic-base-3);border:1px solid var(--dynamic-base-4);border-radius:100%;height:1.125rem;width:1.125rem}.network-control-skeleton__skeleton{width:1.875rem}.non-network-switching-supported-control{align-items:center;background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);bottom:0;color:var(--dynamic-text-primary);display:flex;gap:.375rem;justify-content:center;padding:.25rem;position:absolute;right:0;transform:translateX(50%)}.non-network-switching-supported-control--error{background-color:var(--dynamic-error-2);cursor:auto}.non-network-switching-supported-control__network-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.network-picker-network-control{display:flex;flex-direction:column}.network-picker-network-control__anchor{padding-top:.125rem;position:relative}.pin-field__container{display:flex;flex:1;gap:2.5%;justify-content:space-between;margin-top:1rem;max-width:19.5rem;width:100%}.pin-input__input{background:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:.75rem;color:var(--dynamic-text-primary);font-size:1rem;height:2.75rem;max-width:2.75rem;outline:.125rem solid transparent;outline-offset:.125rem;text-align:center;width:100%}.pin-input__input:last-child{margin-right:0}.pin-input__input:disabled{cursor:not-allowed;opacity:.5}.pin-input__input--error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1);color:var(--dynamic-error-1)}.pin-input__input--success{background:var(--dynamic-success-2);border-color:var(--dynamic-success-1);color:var(--dynamic-success-1)}.portal__container{align-items:center;display:flex;height:100%;justify-content:center;width:100%}.portal__backdrop{-webkit-backdrop-filter:var(--dynamic-modal-backdrop-filter);backdrop-filter:var(--dynamic-modal-backdrop-filter);background:var(--dynamic-modal-backdrop-background);cursor:default;height:100%;left:0;position:fixed;top:0;width:100%}.search__container{align-items:center;background:var(--dynamic-search-bar-background);border:var(--dynamic-search-bar-border);border-radius:var(--dynamic-search-border-radius);cursor:text;display:flex;gap:.625rem;height:2.625rem;justify-content:space-between;min-height:2.25rem;padding-left:.75rem;padding-right:.75rem}.search__container,.search__container svg{color:var(--dynamic-text-tertiary)}.search__container:hover:not(.search__container--active,.search__container:focus-within){background:var(--dynamic-search-bar-background-hover);border:var(--dynamic-search-bar-border-hover);color:var(--dynamic-text-secondary)}.search__container:hover:not(.search__container--active,.search__container:focus-within) svg{color:var(--dynamic-text-secondary)}.search__container--active,.search__container:focus-within{background:var(--dynamic-search-bar-background-focus);border:var(--dynamic-search-bar-border-focus);color:var(--dynamic-text-primary)}.search__container--active svg,.search__container:focus-within svg{color:var(--dynamic-text-secondary)}.search-icon__container{align-items:center;color:var(--dynamic-text-tertiary);display:flex;height:1rem;justify-content:center;width:1rem}.search__input{background:none;border:0;color:var(--dynamic-text-primary);display:flex;flex-grow:1;font-size:var(--dynamic-text-size-body-small);font-weight:500;line-height:1rem;margin:0;outline:none;padding-bottom:.25rem;padding-top:.25rem}.search__input::-moz-placeholder{color:var(--dynamic-text-tertiary)}.search__input::placeholder{color:var(--dynamic-text-tertiary)}.search__input:hover::-moz-placeholder{color:var(--dynamic-text-secondary)}.search__input:hover::placeholder{color:var(--dynamic-text-secondary)}.search__input:focus::-moz-placeholder{color:transparent}.search__input:focus::placeholder{color:transparent}.search__button--clear{color:var(--dynamic-text-secondary);font-size:var(--dynamic-text-size-body-mini)}.search__button--clear:hover{color:var(--dynamic-text-primary)}.select__container{cursor:pointer;position:relative}.select__container .select{-webkit-appearance:none;-moz-appearance:none;appearance:none;bottom:0;left:0;opacity:0;outline:none;position:absolute;right:0;top:0}.select__container .select::-moz-placeholder{color:transparent}.select__container .select::placeholder{color:transparent}.select__container .select__body{background:var(--dynamic-base-2);border-color:var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)*.4);border-width:.0625rem;display:block;margin:0;padding:1.125rem .75rem .375rem;position:relative;transition:all .2s ease;width:100%}.select__container .select__value{color:var(--dynamic-text-primary);font-size:.9375rem;font-weight:400}.select__container .select__label{color:var(--dynamic-text-secondary);font-size:.9375rem;left:.75rem;pointer-events:none;position:absolute;top:.75rem;transition:all .2s ease}.select__container .select__control_icon{align-items:center;bottom:0;color:var(--dynamic-text-secondary);display:flex;position:absolute;right:.75rem;top:0}.select__container .select__has_value .select__label{font-size:.625rem;top:.4375rem}.select__container .select:has(.select__error)~.select__body{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.select__container .select__error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.select__container .select__error .select__control_icon,.select__container .select__error .select__label{color:var(--dynamic-error-1)}.select__message{color:var(--dynamic-text-primary);padding-top:.5rem}.select__message__error{color:var(--dynamic-error-1)}.separator{border-top:.0625rem solid var(--dynamic-base-3)}@keyframes shimmer{to{transform:translateX(100%)}}.skeleton{background:var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)/6);display:inline-flex;line-height:1;min-width:100%;overflow:hidden;position:relative;z-index:0}.skeleton:after{animation:shimmer 2s infinite;background-image:var(--dynamic-loading-animation-gradient);bottom:0;content:"";left:0;position:absolute;right:0;top:0;transform:translateX(-100%)}.spinner{animation:spin 1s linear infinite}.spinner path{stroke:var(--dynamic-brand-primary-color)}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.status-dot__container{align-items:center;background:var(--dynamic-base-1);border-radius:100%;display:flex;height:.625rem;justify-content:center;width:.625rem}.status-dot{border-radius:100%;height:.375rem;width:.375rem}.status-dot--green{background:var(--dynamic-success-1)}.status-dot--red{background:var(--dynamic-error-1)}.status-dot--yellow{background:var(--dynamic-alert-1)}.switch__container{display:flex}.switch__container.disabled{opacity:.2;pointer-events:none}.switch__container .button{background:var(--dynamic-base-2);border-radius:0;box-shadow:var(--dynamic-shadow-down-1);color:var(--dynamic-text-primary);font-size:var(--dynamic-text-size-button-primary);font-weight:400;margin:0;padding:.75rem 0;width:100%}.switch__container .button:first-child{border-bottom-left-radius:calc(var(--dynamic-border-radius)/3);border-right:0;border-top-left-radius:calc(var(--dynamic-border-radius)/3)}.switch__container .button:last-child{border-bottom-right-radius:calc(var(--dynamic-border-radius)/3);border-top-right-radius:calc(var(--dynamic-border-radius)/3)}.switch__container .button.active{background:var(--dynamic-brand-primary-color);color:#fff}.text-button{align-items:center;border-radius:calc(var(--dynamic-border-radius)/6);color:var(--dynamic-text-secondary);cursor:pointer;display:flex;font-size:.75rem;font-weight:500;gap:.375rem;padding:.125rem .375rem}.text-button:hover{background-color:var(--dynamic-hover)}.auth-mode-switch__container{align-items:center;color:#fff;display:flex;font-size:1rem;gap:.25rem;margin-bottom:.25rem}.auth-mode-switch__container label{cursor:pointer}.toolkit__container{background:var(--dynamic-base-1);border-bottom-right-radius:calc(var(--dynamic-border-radius)/1.5);border-top-right-radius:calc(var(--dynamic-border-radius)/1.5);display:flex;flex-direction:column;gap:1rem;left:0;padding:1.875rem 3.5rem;position:fixed;top:50%;transform:translateY(-50%);width:18.125rem}@media (pointer:coarse){.toolkit__container{display:none}}.switcher__copy{color:var(--dynamic-text-primary);margin-bottom:.25rem}.tos-and-pp__text{color:var(--dynamic-text-secondary);font-size:var(--dynamic-text-size-body-small);margin:0 auto;text-align:center}.tos-and-pp__text .tos-and-pp__link{color:var(--dynamic-text-link);text-decoration:none}.zoom-transition__root{transform-origin:50% 50%}.vertical-drawer-animation{overflow:hidden;transition-property:max-height;transition-timing-function:ease-out}.typography{font-family:var(--dynamic-font-family-primary);font-weight:400;line-height:normal}.typography--title{font-size:var(--dynamic-text-size-title)}.typography--body-normal{font-size:var(--dynamic-text-size-body-normal)}.typography--body-small{font-size:var(--dynamic-text-size-body-small)}.typography--body-mini{font-size:var(--dynamic-text-size-body-mini)}.typography--button-primary{font-size:var(--dynamic-text-size-button-primary);font-weight:700}.typography--button-secondary{font-size:var(--dynamic-text-size-button-secondary);font-weight:700}.typography--button-tertiary{font-size:var(--dynamic-text-size-button-secondary);font-weight:400}.typography--numbers-big{font-family:var(--dynamic-font-family-numbers);font-size:var(--dynamic-text-size-numbers-big)}.typography--numbers-medium{font-family:var(--dynamic-font-family-numbers);font-size:var(--dynamic-text-size-numbers-medium)}.typography--bold{font-weight:700}.typography--medium{font-weight:500}.typography--regular{font-weight:400}.typography--link{color:var(--dynamic-text-link)}.typography--brand-primary{color:var(--dynamic-brand-primary-color)}.typography--primary{color:var(--dynamic-text-primary)}.typography--secondary{color:var(--dynamic-text-secondary)}.typography--tertiary{color:var(--dynamic-text-tertiary)}.typography--uppercase{text-transform:uppercase}.typography--dynamic-error-1{color:var(--dynamic-error-1)}.typography--errror-2{color:var(--dynamic-error-2)}.typography--connection-green-1{color:var(--dynamic-success-1)}.typography--tooltip{color:var(--dynamic-tooltip-text-color)}.typography--inherit{color:inherit}.typography--white{color:#fff}.typography--truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.powered-by-dynamic{align-items:center;color:var(--dynamic-text-tertiary);display:flex;text-decoration:none;width:100%}.powered-by-dynamic--center{justify-content:center}.powered-by-dynamic--right{justify-content:end}.powered-by-dynamic__logo,.powered-by-dynamic__text{display:inline-block}.powered-by-dynamic__text{margin-right:.25rem}.powered-by-dynamic__logo{display:inline-block;margin-top:.0625rem;max-width:3.6875rem;width:3.6875rem}.dynamic-footer{background:var(--dynamic-footer-background);padding:var(--dynamic-footer-padding);width:100%}.dynamic-footer:not(.dynamic-footer__top-border){padding-top:0}.dynamic-footer__top-border{border-top:var(--dynamic-footer-border-top)}.user-address,.user-address__container{align-items:center;display:flex;justify-content:center}.user-address__container{margin-top:.375rem}.user-address__status-dot{margin-right:.375rem}.user-address__seperator{background-color:var(--dynamic-base-4);height:.5rem;margin:0 .5rem;width:.0625rem}.app-origin-tile{align-items:center;display:flex;flex-direction:column;gap:.125rem}.app-origin-tile__title{align-items:center;display:flex;gap:.25rem}.app-origin-tile__logo{height:1rem;width:auto}.options-switcher{background-color:var(--dynamic-base-4);display:flex;min-height:2rem;position:relative}.options-switcher,.options-switcher__active-rail,.options-switcher__button{border-radius:calc(var(--dynamic-border-radius)/3)}.options-switcher__button{color:var(--dynamic-text-secondary);flex:1;font-size:var(--dynamic-text-size-button-secondary);font-weight:500;position:relative}.options-switcher__button--active{color:var(--dynamic-text-primary)}.options-switcher__active-rail{background-color:var(--dynamic-base-2);box-shadow:var(--dynamic-shadow-down-1);height:100%;position:absolute;transition:left .1s ease-in-out}.dynamic-verified-icon{color:var(--dynamic-success-1)}.user-profile-field__value{align-items:center;display:flex;min-height:.9375rem;overflow:auto}.user-profile-field__verify-icon{margin-left:.25rem}.user-profile-section{margin:0 0 .75rem}.user-profile-section__title{margin-bottom:.5rem}.user-profile-section__header{display:flex;flex-direction:row;justify-content:space-between}.user-profile-section__action{display:flex;margin:0 0 .5rem}.user-profile-social-account__connected-avatar{border-radius:100%;height:100%;overflow:hidden;position:relative;width:100%}.user-profile-social-account__connected-provider-icon{background-color:#fff;border-radius:100%;bottom:-.1875rem;height:.875rem;padding:.09375rem;position:absolute;right:-.3125rem;width:.875rem}.user-profile-social-account__image{-o-object-fit:cover;object-fit:cover}.user-profile-social-account{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;gap:.625rem;padding:var(--dynamic-wallet-list-tile-padding);width:100%}.user-profile-social-account__icon{flex-shrink:0;height:1.5rem;position:relative;width:1.5rem}.user-profile-social-account__label{flex-grow:1;text-align:left}.user-profile-social-account__button{box-shadow:none;flex-shrink:0;padding:.1875rem .28125rem}.user-profile-social-account__button .button__spinner-container{left:auto}.user-profile__fields{background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);padding:.75rem}.user-profile__fields,.user-profile__social-accounts{display:flex;flex-direction:column;gap:.5rem}.divider{align-items:center;display:flex;gap:.75rem;justify-content:space-between;padding:1rem 0}.divider__dash{background:var(--dynamic-base-4);height:.0625rem;width:100%}.divider__text{white-space:nowrap}.divider__full-width{width:100%}.dynamic-tooltip{background-color:var(--dynamic-tooltip-color);border-radius:calc(var(--dynamic-border-radius)/4);opacity:0;padding:.125rem .5rem;pointer-events:none;position:absolute;transform:translate(-50%,-100%);transform-origin:50% 50%;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap;z-index:-1}.dynamic-tooltip__arrow{bottom:-.1875rem;color:var(--dynamic-tooltip-color);height:.25rem;left:50%;position:absolute;transform:translateX(-50%);width:.375rem}.dynamic-tooltip--visible{opacity:1;pointer-events:unset;-webkit-user-select:unset;-moz-user-select:unset;user-select:unset;z-index:1}.modal-header-banner{padding:.5rem .75rem;text-align:center}.modal-header-banner__error{background-color:var(--dynamic-error-2)}.modal-header-banner__success{background-color:var(--dynamic-success-2)}.modal-header-banner__notice{background-color:var(--dynamic-brand-secondary-color)}.otp-verification-view{align-items:center;display:flex;flex-direction:column;padding:var(--dynamic-layout-content-padding);text-align:center}.otp-verification-view__icon-with-spinner{margin:0 auto .75rem}.otp-verification-view--message{padding:var(--dynamic-layout-content-error-padding)}.otp-verification-view__status-header{align-items:center;display:flex;justify-content:center}.otp-verification-view__footer{display:flex;flex-direction:column;gap:1rem}.otp-verification-view__destination-container{align-items:center;display:flex;gap:.25rem;justify-content:center}.otp-verification-view__retry-container{margin:1rem auto 0}.overlay-card{bottom:0;height:100%;left:0;max-height:100%;position:absolute;right:0}.overlay-card--disabled{pointer-events:none}.overlay-card__animation{bottom:0;height:100%;left:0;max-height:100%;position:absolute;right:0;top:0}.overlay-card__animation--limit-height{height:80%;max-height:80%;top:unset}.overlay-card__overlay{background-color:var(--dynamic-overlay);bottom:0;left:0;position:absolute;right:0;top:0}.overlay-card__content{background-color:var(--dynamic-base-1);border-radius:calc(var(--dynamic-border-radius)/1.5);border-top:.0625rem solid var(--dynamic-base-4);bottom:0;display:flex;flex-direction:column;left:0;max-height:100%;overflow-y:auto;position:absolute;right:0}@media (pointer:coarse){.overlay-card__content{border-bottom-left-radius:0;border-bottom-right-radius:0}}.overlay-card-target{bottom:0;height:100%;left:0;max-height:100%;overflow:auto;position:absolute;right:0}.icon-list-tile{padding-left:0;padding-right:0}.icon-list-tile--children{align-items:center;display:flex;justify-content:center}.popper-content{display:flex;position:absolute;z-index:100}.popper-content__transform-origin-bottom-left{transform:translateY(-100%)}.popper-content__transform-origin-bottom-right{transform:translate(-100%,-100%)}.popper-content__transform-origin-top-left{transform:translate(0)}.popper-content__transform-origin-top-right{transform:translate(-100%)}.dropdown{align-items:stretch;background-color:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/3);box-shadow:0 .5rem .75rem -.375rem rgba(24,39,75,.06),0 .5rem .75rem -.1875rem rgba(24,39,75,.06);display:flex;flex-direction:column;max-height:var(--max-height);min-width:10rem;overflow-y:auto;padding-block:.1875rem}.dropdown--entering{animation-fill-mode:both;animation-iteration-count:1;animation-name:desktop-dropdown-entering-animation;animation-timing-function:ease-out}.dropdown--exiting{animation-fill-mode:both;animation-iteration-count:1;animation-name:desktop-dropdown-exiting-animation;animation-timing-function:ease-out}.menu-list__overlay-card__container{align-items:stretch;display:flex;flex-direction:column;overflow-y:auto;padding-bottom:1.25rem}.transaction-confirmation.dynamic-tooltip{word-wrap:break-word;color:var(--dynamic-base-1);font-size:12px;line-height:1.4;max-width:145px;white-space:normal;width:-moz-max-content;width:max-content}.transaction-confirmation__banner{margin:-8px auto 0;padding-bottom:16px;text-align:center;width:75%}.transaction-confirmation__actions{align-items:center;display:flex;flex-direction:row;gap:.375rem;padding-top:24px;width:100%}.transaction-confirmation__actions .button--brand-primary .icon--color-text-secondary,.transaction-confirmation__actions .button--brand-primary .typography--primary{color:#fff}.transaction-confirmation__footer{padding-top:1rem}.transaction-confirmation__body{align-items:stretch;display:flex;flex:1;flex-direction:column;overflow:hidden;padding:0 1.5rem 1.5rem}.transaction-confirmation__app-origin-tile{padding:.75rem}.transaction-confirmation__content{display:flex;flex:1;flex-direction:column;justify-content:flex-start;margin-top:.25rem;overflow:auto;width:100%}.transaction-confirmation__rows{max-height:14.375rem;padding:.5rem .75rem;width:100%}.transaction-confirmation__rows .flex{display:flex;justify-content:space-between}.transaction-confirmation__rows .flex-row{flex-direction:row;gap:.5rem}.transaction-confirmation__rows .row{padding:.5rem 0}.transaction-confirmation__rows .gap{gap:.3rem}.transaction-confirmation__secure-wallet{margin-bottom:0;margin-top:1rem}.transaction-confirmation__info{text-align:right}.transaction-confirmation__error{padding-top:.75rem}.transaction-confirmation__warning{padding-top:12px}.transaction-card-container{display:flex;flex-direction:column;gap:.75rem}.transaction-card{background-color:var(--dynamic-base-2);border-radius:.75rem;display:flex;flex-direction:column;padding:.5rem}.transaction-card__icon{align-items:center;display:flex;margin-left:auto}.transaction-card__icon__container{align-items:center;display:flex;justify-content:center;position:relative}.transaction-card__icon__container__main{border-radius:50%;height:2rem;width:2rem}.transaction-card__icon__container__network{background-color:var(--dynamic-base-1);border:1px solid var(--dynamic-base-1);border-radius:50%;bottom:-3px;height:1rem;position:absolute;right:-3px;width:1rem}.transaction-card__total p .typography{gap:.3rem}.transaction-card__info{align-items:center;display:flex;flex-direction:row;gap:.25rem}.transaction-card__assets-container{display:flex;flex-direction:column}.transaction-card__in,.transaction-card__out{padding:.25rem 0;width:100%}.transaction-card__info-container{align-items:center;display:flex;justify-content:space-between;padding:.5rem;width:100%}.transaction-card__amount-symbol{align-items:center;display:flex;gap:.75rem}.transaction-card__token-info{align-items:flex-end;display:flex;flex-direction:column;gap:.125rem}.transaction-card__token-row{align-items:center;display:flex;gap:.5rem}.transaction-card__arrow{color:var(--dynamic-text-secondary);font-size:1.25rem;margin-left:.5rem}.transaction-card__destination{align-items:center;display:flex;gap:.5rem;margin:0}.transaction-card .row{border-top:1px solid var(--dynamic-base-3);display:flex;justify-content:space-between;padding:.6rem 0}.transaction-card .flex-row{display:flex;flex-direction:row;gap:.1rem}.transaction-card .gap-native{gap:.3rem}.transaction-card__divider{border-top:1px solid var(--dynamic-base-3);margin:0 .75rem}.transaction-card__details{display:flex;flex-direction:column}.transaction-card__row{align-items:center;display:flex;justify-content:space-between;padding:.5rem}.transaction-card__value{align-items:flex-end;display:flex;flex-direction:column;gap:.125rem}.transaction-card__network-info{align-items:center;display:flex;gap:.5rem}.transaction-card__network-icon{border-radius:50%}.transaction-card__fee-info{align-items:center;display:flex;gap:.5rem}.transaction-card__fee-info .fee-tooltip{margin-right:.25rem}.transaction-card__label-with-tooltip{align-items:center;display:flex;gap:.25rem}.transaction-card__label-with-tooltip .fee-tooltip{align-items:center;display:flex}.transaction-status-layout{display:flex;flex:1;flex-direction:column;overflow:hidden}.transaction-status-layout .modal-header{padding:3rem .3125rem .625rem}.transaction-status-layout__status-icon{color:var(--dynamic-brand-primary-color);height:4rem;width:4rem}.transaction-status-layout__title{text-align:center}.transaction-status-layout__body{align-items:stretch;display:flex;flex:1;flex-direction:column;padding:.25rem 1.5rem 1.5rem}.transaction-status-layout__sent_to{text-align:center}.transaction-status-layout__sent_to p{display:inline}.transaction-status-layout__content{align-items:center;display:flex;flex-direction:column;justify-content:center;margin-top:.375rem;width:100%}.transaction-status-layout__rows{max-height:14.375rem;overflow-y:auto;padding:.375rem .75rem;width:100%}.transaction-status-layout__rows p{font-size:1.5rem}.transaction-status-layout__rows>.transaction-row:not(:first-child){border-top:1px solid var(--dynamic-base-4)}.transaction-status-layout__actions{margin-top:auto;padding-top:1rem}.transaction-status-layout__actions .button--brand-primary .typography--primary{color:var(--dynamic-base-2)}.transaction-status-layout__footer{padding-top:1rem}.transaction-origin-destination__arrow-icon,.transaction-origin-destination__wallet-icon{display:inline-block}.transaction-origin-destination__arrow-icon,.transaction-origin-destination__text,.transaction-origin-destination__wallet-icon{vertical-align:middle}.transaction-origin-destination__wallet-icon{height:1rem;margin-right:.375rem;width:1rem}.transaction-origin-destination__arrow-icon{color:var(--dynamic-text-tertiary);margin:0 .5625rem}.tokens-balance-dropdown{background-color:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-button-border-radius)/1);cursor:pointer;padding:.875rem .75rem}.tokens-balance-dropdown,.tokens-balance-dropdown__selected{align-items:center;display:flex;gap:.5rem;justify-content:space-between}.tokens-balance-dropdown__selected .evm-network-control__arrow-icon{position:absolute;right:2.625rem}.tokens-balance-dropdown__menu_list{border-radius:calc(var(--dynamic-button-border-radius)/1);padding:.5rem 1rem;width:19.375rem}@media (max-width:640px){.tokens-balance-dropdown__menu_list{margin:0 auto;width:100%}.tokens-balance-dropdown__menu_list .modal-header{padding:1rem 0 1rem 1.25rem}}.tokens-balance-dropdown__menu_list .modal-header__leading,.tokens-balance-dropdown__menu_list .modal-header__trailing{flex:none}.tokens-balance-dropdown__menu_list_item{align-items:center;display:flex;gap:.625rem;justify-content:space-between;padding:.5rem 0;text-align:left}.tokens-balance-dropdown__menu_list_item__name{display:flex;gap:.3125rem;min-width:9.375rem}.tokens-balance-dropdown__menu_list_item__balance{display:flex;gap:.3125rem}.tokens-balance-dropdown__chain{align-items:center;display:flex;gap:.375rem}.tokens-balance-dropdown__chain__icon{height:1rem;width:1rem}.tokens-balance-dropdown__balance-container{align-items:center;display:flex;gap:.25rem}.tokens-balance-dropdown__balance{align-items:center;display:flex;gap:.125rem}.send-balance-page-layout__header-content{align-items:center;display:flex;gap:.5rem}.send-balance-page-layout__body{display:flex;flex:1;flex-direction:column;overflow:auto;padding:.25rem 1.5rem 1.5rem}.send-balance-page-layout__balance-container{display:flex;flex-direction:column;gap:.5rem;padding-bottom:.5rem}.send-balance-page-layout__error{padding-bottom:1rem}.send-balance-page-layout__footer{padding-top:1.5rem}.send-balance-page-layout__network-container{display:flex;justify-content:center;padding-bottom:.5rem}.send-balance-form{display:flex;flex:1;flex-direction:column;gap:.5rem}.send-balance-form__button{margin-top:auto}.send-balance-form__secure-wallet{margin:0}.send-balance-form__field.fiat{padding-left:1.5625rem}.send-balance-form__amount-container{position:relative}.send-balance-form__amount-container__fiat_sign{left:.625rem;position:absolute;top:.6875rem}.send-balance-form__amount-container__double_arrow{position:absolute;right:.625rem;top:.875rem}.send-balance-form__amount-container__balance{display:flex;gap:.25rem;position:absolute;right:.75rem;top:1.4375rem}.send-balance-form__amount-container__field.input{padding-left:3.125rem;transition:none}.send-balance-form__amount-container__floating_value{color:#000;font-size:1rem;left:10px;pointer-events:none;position:absolute;top:1.1875rem;white-space:nowrap}.send-balance-form__amount_available{border-bottom:1px solid var(--dynamic-base-3);padding-bottom:.75rem}.send-balance-form .input__container--regular .input__label:after{content:"";height:0}.select-network-button__icon{display:inline;margin:0 6px 3px;max-height:16px;max-width:16px;vertical-align:middle}.chip{align-items:center;background:var(--dynamic-base-2);border-radius:.75rem;color:var(--dynamic-text-primary);display:inline-flex;gap:.1875rem;height:1.5rem;justify-content:center;padding:.125rem .25rem}.chip__with-icon{padding:.125rem .25rem .125rem .125rem}.chip--icon{border-radius:50%;height:1.25rem;justify-content:center;overflow:hidden;width:1.25rem}.chip--icon,.form-field-label{align-items:center;display:flex}.form-field-label{color:var(--dynamic-text-secondary);cursor:text;font-size:.75rem}.form-field-label__with-divider:after{background:var(--dynamic-base-4);content:"";flex:1;height:1px;margin-left:.75rem;right:0}.step{counter-increment:step;gap:.5rem}.step,.step__icon{align-items:center;display:flex}.step__icon{flex-shrink:0;height:1.25rem;justify-content:center;width:1.25rem}.step__icon--done{background-color:var(--dynamic-success-1);border-radius:50%}.step__icon__check-mark{color:var(--dynamic-base-1);height:1rem;width:1rem}.step__index{align-items:center;border:1px solid var(--dynamic-base-4);border-radius:.625rem;display:flex;height:1.25rem;justify-content:center;min-width:1.25rem;padding:0 .25rem}.step__index-label:before{content:counter(step)}.step__leading{max-width:-moz-fit-content;max-width:fit-content;position:relative}.stepper{counter-reset:step;display:flex;gap:1rem;width:100%}.stepper__divider{flex-grow:1}.modal{left:50%;margin:auto;position:fixed;top:50%;transform:translate(-50%,-50%);width:var(--dynamic-modal-width)}@media (max-width:640px){.modal{bottom:0;max-width:37.5rem;top:auto;transform:translate(-50%);width:100%}}.modal__items{display:flex;flex-direction:column;gap:.75rem}.modal-card{background:var(--dynamic-base-1);border-radius:var(--dynamic-border-radius);box-shadow:var(--dynamic-shadow-down-3);overflow:hidden;width:100%}.modal-card--radius-small{border-radius:calc(var(--dynamic-border-radius)*.75)}.modal-card--with-border{border:1px solid var(--dynamic-base-4)}@media (max-width:640px){.modal-card{bottom:0;max-width:37.5rem;top:auto;transform:translateY(0);width:100%}.modal-card--sharp-mobile-bottom-radius:last-child{border-radius:var(--dynamic-border-radius) var(--dynamic-border-radius) 0 0}}.inline-widget-button{align-items:center;background-color:var(--dynamic-base-1);display:flex;gap:.5rem;min-height:100%;padding:.5rem .75rem;width:-moz-fit-content;width:fit-content}.inline-widget-button:hover{background-color:var(--dynamic-hover)}.inline-widget-button__icon{height:1.25rem;width:1.25rem}.inline-widget-button__vertical-divider{background-color:var(--dynamic-base-3);content:"";height:1rem;width:.0625rem}.inline-widget{align-items:center;background-color:var(--dynamic-base-1);border-radius:calc(var(--dynamic-border-radius)/3);display:flex;justify-content:center;overflow:hidden;width:-moz-fit-content;width:fit-content}.inline-widget>*{border-right:1px solid var(--dynamic-base-3)}.inline-widget>:last-child{border-right:none}.wallet-information-card{background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);display:flex;flex-direction:column}.wallet-information-card__header{border-bottom:1px solid var(--dynamic-base-3);display:flex;gap:.5rem;justify-content:space-between;padding:.75rem}.wallet-information-card__details-container{align-items:center;display:flex;gap:.75rem;justify-content:space-between;min-width:0}.wallet-information-card__menu{flex-shrink:0}.wallet-information-card__icon{height:1.75rem;width:1.75rem}.wallet-information-card__details{display:flex;flex-direction:column;overflow:hidden}.wallet-information-card__balance-container{align-items:center;display:flex;gap:.5rem;justify-content:space-between;padding:.75rem}.social-sign-in{display:flex;flex-wrap:wrap;gap:.375rem;justify-content:space-between}.social-sign-in--tile{flex:1;height:2.5rem}.social-sign-in--tile__full-width{flex:1 0 100%}.social-sign-in--card{display:flex;flex-direction:column;min-height:11.5625rem}.social-sign-in--card--body{display:grid;gap:.375rem;grid-template-columns:auto auto auto auto;padding:.25rem 1.5rem 1.5rem}.social-sign-in--card--tile{height:2.5rem}.sign-typed-data-preview--attribute-row{display:flex;gap:.5rem}.sign-typed-data-preview--fields-list,.sign-typed-data-preview--type-container{display:flex;flex-direction:column;gap:.25rem}.sign-typed-data-preview--type-container{padding-left:1rem}.need-help-section{align-items:center;display:flex;flex-direction:column;gap:.125rem;margin-bottom:.5rem}.need-help-section__links{display:flex;gap:.5rem}.need-help-section__links>*+*{padding-left:.5rem;position:relative}.need-help-section__links>*+:after{border-left:1px solid var(--dynamic-text-secondary);bottom:15%;content:"";left:0;position:absolute;top:15%;width:50%}.need-help-section__helper-link{color:var(--dynamic-text-link)}.textarea__container{position:relative}.textarea__container .textarea__suffix{position:absolute;right:1rem;top:1rem}.textarea__container .textarea{background:var(--dynamic-base-2);border-color:var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)*.4);border-width:.0625rem;color:var(--dynamic-text-primary);font-size:.9375rem;font-weight:400;margin:0;outline:none;resize:none;transition:all .2s ease;width:100%}.textarea__container .textarea:disabled{background:var(--dynamic-base-3);border-color:var(--dynamic-base-4)}.textarea__container .textarea:disabled .textarea__label{color:var(--dynamic-text-tertiary)}.textarea__container .textarea__label{color:var(--dynamic-text-secondary);cursor:text;font-size:.625rem}.textarea__container .textarea:not(.textarea__error):focus,.textarea__container .textarea:not(.textarea__error):hover{background:var(--dynamic-base-2);border-color:var(--dynamic-base-4)}.textarea__container .textarea__error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.textarea__container .textarea__error~.textarea__label,.textarea__container .textarea__error~.textarea__trailing{color:var(--dynamic-error-1)}.textarea__container .textarea__valid{background:var(--dynamic-success-2);border-color:var(--dynamic-success-1)}.textarea__container .textarea__valid~.textarea__label,.textarea__container .textarea__valid~.textarea__trailing{color:var(--dynamic-success-1)}.textarea__container .textarea__has_trailing{padding-right:4rem}.textarea__container .textarea__trailing{color:var(--dynamic-text-secondary);font-size:.75rem;font-weight:500;position:absolute;right:.75rem;top:50%;transform:translateY(-50%)}.textarea__container--dense .textarea{padding:1.125rem .75rem .375rem}.textarea__container--dense .textarea::-moz-placeholder{color:transparent}.textarea__container--dense .textarea::placeholder{color:transparent}.textarea__container--dense .textarea__label{left:.75rem;position:absolute;top:.4375rem;transition:all .2s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none}.textarea__container--dense .textarea:-moz-placeholder-shown~.textarea__label{font-size:.9375rem;top:.75rem}.textarea__container--dense .textarea:placeholder-shown~.textarea__label{font-size:.9375rem;top:.75rem}.textarea__container--dense .textarea:focus~.textarea__label{font-size:.625rem;top:.4375rem}.textarea__container--regular{display:flex;flex-direction:column}.textarea__container--regular .textarea{padding:.75rem}.textarea__container--regular .textarea__label{align-items:center;display:inline-flex;font-size:.75rem;line-height:1rem;margin-bottom:.5rem;order:-1}.textarea__container--regular .textarea__label:after{background:var(--dynamic-base-4);content:"";flex:1;height:1px;margin-left:.75rem;right:0}.textarea__container--regular .textarea__suffix{top:2.375rem}.textarea__message{color:var(--dynamic-text-primary);padding:.5rem 0}.textarea__message__error{color:var(--dynamic-error-1)}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover,select:-webkit-autofill,select:-webkit-autofill:focus,select:-webkit-autofill:hover,textarea:-webkit-autofill,textarea:-webkit-autofill:focus,textarea:-webkit-autofill:hover{-webkit-text-fill-color:var(--dynamic-text-primary)!important;background:var(--dynamic-base-2);border-color:var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)*.4);border-width:.0625rem;color:var(--dynamic-text-primary)!important;-webkit-transition:background-color 5000s ease-in-out 0s;transition:background-color 5000s ease-in-out 0s}.secure-embedded-wallet-card{background:var(--dynamic-brand-secondary-color);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);color:var(--dynamic-text-primary);display:flex;gap:.625rem;padding:.75rem;transition-duration:var(--dynamic-wallet-list-tile-animation-duration);transition-property:all;transition-timing-function:ease-out;width:100%}.secure-embedded-wallet-card__text-content{align-items:flex-start;cursor:pointer;display:flex;flex-direction:column;flex-grow:1;padding:0;text-align:left}.secure-embedded-wallet-card__text-content,.secure-embedded-wallet-card__text-content:hover{background-color:transparent;box-shadow:none}.secure-embedded-wallet-card__link{line-height:20px;text-decoration:underline}.toggle{-webkit-tap-highlight-color:transparent;cursor:pointer;display:inline-block}.toggle--input{display:none}.toggle--input:checked+.toggle--content__variant-primary{background-color:var(--dynamic-brand-primary-color);color:var(--dynamic-brand-primary-color)}.toggle--input:checked+.toggle--content .toggle--knob{left:1.09375rem}.toggle--input:checked+.toggle--content .toggle--knob>*{opacity:1}.toggle--content{background-color:var(--dynamic-base-3);border-radius:.625rem;height:1.25rem;position:relative;transition:background-color .2s ease;width:2.25rem}.toggle--knob{align-items:center;background-color:#fff;border-radius:100%;display:flex;height:1.0625rem;justify-content:center;left:.09375rem;position:absolute;top:.09375rem;transition:left .2s ease;width:1.0625rem}.toggle--knob>*{opacity:0;transition:opacity .2s ease}.list-tile-animated-trailing{position:relative}.list-tile-animated-trailing__child{position:absolute;right:0;transform:translateY(-50%);transition-duration:.2s;transition-property:opacity,transform;transition-timing-function:ease-in}.list-tile-animated-trailing__hover-element{opacity:0;position:absolute;right:0;transform:translate(-.625rem,-50%);transition-duration:.3s}.list-tile:hover .list-tile-animated-trailing__hover-element{opacity:1;transform:translateY(-50%)}.list-tile:hover .list-tile-animated-trailing__child{opacity:0;transform:translate(-.625rem,-50%)}.wallet-group-view-layout__container{padding:var(--dynamic-layout-content-padding)}.wallet-group-view-layout__icon{height:4rem;margin:0 auto .75rem;width:4rem}.wallet-group-view-layout__list{display:flex;flex-direction:column;gap:.5rem}.wallet-group-view-layout__title{padding-bottom:1rem;text-align:center}.retry-send-verification-code-section{align-items:center;display:flex;flex-direction:column}.retry-send-verification-code-section__confirmation{color:var(--dynamic-success-1);display:flex;gap:.3125rem;padding:.125rem .375rem}.toggle-visibility-button__container{position:relative}.toggle-visibility-button__tooltip{background-color:var(--dynamic-text-primary);color:var(--dynamic-base-2);font-size:.75rem}.qrcode{--background:var(--dynamic-base-1);color:var(--dynamic-text-primary);position:relative}.qrcode__container{align-items:center;border-radius:calc(var(--dynamic-border-radius)/1.5);display:flex;height:18.125rem;justify-content:center;margin:auto;width:18.125rem}.qrcode__icon{bottom:0;left:0;margin:auto;position:absolute;right:0;top:0}.qrcode-container__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.qrcode-container__container--message{padding:var(--dynamic-layout-content-error-padding)}.qrcode-container__container .button__content{display:flex;gap:.375rem}.qrcode-container__top{align-items:center;background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)*.6);display:flex;flex-direction:column;gap:.625rem;margin-bottom:1.25rem;padding:.75rem}.qrcode-container__top .button-container{align-items:center;display:flex;gap:.5rem;width:100%}.qrcode-container__top .button-container svg path{fill-opacity:100%}.qrcode-container__top .button-container .qr-code-button{height:2.375rem}.qrcode-container__content{max-width:20rem;text-align:center}.qrcode-container__tos{margin-top:1rem;max-width:17.5rem;text-align:center}.qrcode-container__tos .tos__link{color:var(--dynamic-text-link)}.qrcode-container__tos .tos__link:hover{text-decoration:underline}.qr-code-wrapper__scan-issue-message{align-items:center;background:var(--dynamic-base-2);border-bottom:var(--dynamic-button-primary-border);border-radius:0;border-top:var(--dynamic-button-primary-border);color:var(--dynamic-text-primary);display:flex;justify-content:center;padding:.5rem .75rem;text-align:center;width:100%}.qr-code-wrapper__scan-issue-button{color:var(--dynamic-text-link);font-size:.75rem;text-decoration:underline}.radio-button{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;gap:.5rem;padding:.75rem;width:100%}.radio-button input{height:1.5rem;width:1.5rem}.mfa-device-skeleton{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;flex-direction:row;gap:.625rem;margin-bottom:.625rem;padding:.625rem;width:auto}.mfa-device-skeleton__details{display:flex;flex-direction:column;flex-grow:1;justify-content:space-between;padding-right:.625rem}.phantom-ledger-icon{position:absolute}.phantom-ledger-icon__container{align-items:center;display:flex;height:100%;position:relative}.account-exists__container{align-items:center;background:var(--dynamic-base-1);display:flex;flex-direction:column;padding:.3125rem}.account-exists__main{padding:var(--dynamic-modal-padding)}.account-exists__social-icon{margin:auto}.account-exists__image{padding:.3125rem;width:4.375rem}.account-exists__content{text-align:center}.account-exists__content--primary{margin-bottom:.375rem}.account-exists__content--secondary{margin-bottom:1rem}.account-exists__button--primary{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);box-shadow:var(--dynamic-shadow-down-1);margin:0}.user-data-form__form{display:flex;flex-direction:column}.user-data-form__error{margin-bottom:.625rem}.user-field__checkbox-container{background:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/2);display:flex;flex-direction:column;padding:.625rem}.user-field__checkbox-container--error{background:var(--dynamic-error-2);border-color:var(--dynamic-error-1)}.user-field__consent-checkbox{display:flex;margin-bottom:.5rem}.user-field__consent-checkbox a{color:var(--dynamic-text-link)}.user-field__consent-checkbox:last-child{margin-bottom:0}.user-field__checkbox-label{padding-left:.75rem}.user-field__error-message{color:var(--dynamic-error-1);padding:.25rem}.user-phone-field__optional-label{color:var(--dynamic-text-secondary);font-size:.75rem;font-weight:500;pointer-events:none;position:absolute;right:.75rem;top:50%;transform:translateY(-50%)}.user-data-fields__fields-column{display:flex;flex-direction:column;gap:.375rem;margin-bottom:.5rem;max-height:11.25rem;overflow:auto}.user-data-fields__tooltip{background-color:var(--dynamic-text-primary);color:var(--dynamic-base-2);font-size:.75rem}.collect-user-data::-webkit-scrollbar,.collect-user-data::-webkit-scrollbar-thumb,.collect-user-data::-webkit-scrollbar-track{display:none}.collect-user-data__main-img{width:100%}.collect-user-data__form{padding:var(--dynamic-layout-content-padding)}.collect-user-data__form--error{padding:var(--dynamic-layout-content-error-padding)}.collect-user-data__img-container{align-items:center;display:flex;justify-content:center}.collect-user-data__img{height:1.75rem;width:1.75rem}.collect-user-data__img--rounded{border-radius:9999px}.collect-user-data__wallet-address{margin-left:.5rem}.collect-user-data__success-icon{align-items:center;display:flex;justify-content:center}.collect-user-data__success-icon svg{height:4rem;width:4rem}.collect-user-data__welcome-container{margin:1rem 0;text-align:center}.collect-user-data__welcome-title{margin-bottom:.25rem}.collect-user-data__log-out{margin:.75rem auto 0}.collect-user-data__error--not-supported{align-items:center;border-radius:0;display:flex;justify-content:center;margin:0;width:100%}.collect-user-data__network-picker{margin:auto 0;max-width:-moz-fit-content;max-width:fit-content}.collect-user-data__network-picker-button{border:1px solid var(--dynamic-base-4);position:static;transform:translateX(0)}.collect-user-data__network-picker-button:hover{background:var(--dynamic-hover)}.collect-user-data__network-container{border:var(--dynamic-header-border-bottom);display:flex;justify-content:space-between;padding:var(--dynamic-header-padding);position:relative}.collect-user-data-login-no-wallet::-webkit-scrollbar,.collect-user-data-login-no-wallet::-webkit-scrollbar-thumb,.collect-user-data-login-no-wallet::-webkit-scrollbar-track{display:none}.collect-user-data-login-no-wallet__main-img{width:100%}.collect-user-data-login-no-wallet__user-info-container{align-items:center;border:var(--dynamic-header-border-bottom);display:flex;justify-content:center;padding:var(--dynamic-header-padding)}.collect-user-data-login-no-wallet__user-identification{margin-left:.5rem}.collect-user-data-login-no-wallet__icon-container{height:1.5rem;width:1.5rem}.collect-user-data-login-no-wallet__icon-container .user-profile-social-account__connected-avatar{margin-top:.125rem}.collect-user-data-login-no-wallet__form{padding:var(--dynamic-layout-content-padding)}.collect-user-data-login-no-wallet__success-icon{align-items:center;display:flex;justify-content:center}.collect-user-data-login-no-wallet__success-icon svg{height:4rem;width:4rem}.collect-user-data-login-no-wallet__welcome-container{margin:1rem 0;text-align:center}.collect-user-data-login-no-wallet__welcome-title{margin-bottom:.375rem}.collect-user-data-login-no-wallet__log-out{margin:.75rem auto 0}.email-verification__retry-container{margin:1rem auto 0}.email-verification__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.email-verification__container--error{padding:var(--dynamic-layout-content-error-padding)}.email-verification__icon-with-spinner{margin:0 auto .75rem}.email-verification__error-message{margin:0}.email-verification__error-message,.email-verification__transfer-message{align-items:center;border-radius:0;display:flex;justify-content:center;width:100%}.email-verification__transfer-message{background:var(--dynamic-success-2);color:var(--dynamic-success-1);margin-bottom:.5rem;padding:.5rem .75rem;text-align:center}.email-verification__icon--verified{margin:0 auto 1rem}.email-verification__title{margin-top:.5rem;text-align:center}.email-verification__retry-copy{margin-top:1rem}.email-verification__copy-text-container{margin:0;text-align:center}.email-verification__text-button{color:var(--dynamic-text-link)}.email-verification__text-button:disabled{color:var(--dynamic-text-tertiary);cursor:not-allowed}.email-verification__log-out{margin:.75rem auto 0}.no-qr-code-installed__container{align-items:center;color:var(--dynamic-text-primary);flex-direction:column;margin:-2.25rem 0 0;padding:var(--dynamic-modal-padding);padding-top:0;width:100%}.no-qr-code-installed__container:first-child,.no-qr-code-installed__container:last-child{margin-right:0}.no-qr-code-installed__img{display:flex;height:auto;justify-content:center;margin:auto;text-align:center}.no-qr-code-installed__typography{text-align:center}.no-qr-code-installed__typography--title{margin:1rem 0 .375rem;text-align:center}.no-qr-code-installed__links-section{flex-direction:column;margin:1rem 0}.wallet-help-link__anchor{align-items:center;background:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);color:var(--dynamic-text-primary);display:flex;gap:.625rem;margin-bottom:.5rem;padding:.75rem;position:relative;width:100%}.pending-connect__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.pending-connect__copy-text{color:var(--dynamic-text-secondary);max-width:20rem;text-align:center}.pending-connect__icon-with-spinner{margin:0 auto .75rem}.pending-signature__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.pending-signature__container .pending-signature__icon-with-spinner{margin:0 auto .75rem}.pending-signature__container .pending-signature__copy{color:var(--dynamic-text-secondary);line-height:1.25rem;max-width:20rem;text-align:center}.pending-signature__container .pending-signature__copy--mini{line-height:1rem;margin-top:.25rem}.pending-signature__container .pending-signature__button{box-shadow:var(--dynamic-shadow-down-1);margin-top:.75rem}.social-wrong-account-view__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:0 var(--dynamic-modal-padding) 1.125rem}.social-wrong-account-view__container .social-wrong-account-view__title{color:var(--dynamic-text-primary);line-height:1.5rem}.social-wrong-account-view__container .social-wrong-account-view__copy{color:var(--dynamic-text-secondary);line-height:1.25rem;margin-top:.375rem;max-width:20rem;text-align:center}.social-wrong-account-view__container .social-wrong-account-view__button{box-shadow:var(--dynamic-shadow-down-1);margin-top:.75rem}.social-redirect-view__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:2rem var(--dynamic-modal-padding)}.social-redirect-view__container .social-redirect-view__title{color:var(--dynamic-text-primary);line-height:2.25rem}.sms-verification__text-button{color:var(--dynamic-text-link)}.sms-verification__text-button:disabled{color:var(--dynamic-text-tertiary);cursor:not-allowed}.sms-verification__log-out{margin:.75rem auto 0}.search-instead__container{font-size:.75rem;line-height:1rem;margin-top:2.5rem;padding-bottom:1rem;text-align:center;transition-duration:.3s;transition-property:background-color,border-color,color,fill,stroke;width:100%}.search-instead__container__image{display:flex;justify-content:center;margin:.5rem auto}.wallet-list-item__tile{border-radius:var(--dynamic-wallet-list-tile-border-radius)}.wallet-list-grid-tabs{border-bottom:1px solid var(--dynamic-base-4);border-top:1px solid var(--dynamic-base-4);display:flex;width:100%}.wallet-list-grid-tabs__button{align-items:center;border-left:1px solid var(--dynamic-base-4);display:flex;flex-basis:50%;gap:.25rem;justify-content:center;outline:none;padding:.5rem .625rem}.wallet-list-grid-tabs__button:first-child{border-left:none}.wallet-list-grid-tabs__button--selected{background-color:var(--dynamic-wallet-list-tile-background)}.wallet-list-grid-tabs__button--text{flex-basis:100%}.wallet-list-grid-tabs__icon--selected{filter:grayscale(100%)}.wallet-list__error-container{margin:0}.wallet-list__search-container{padding:var(--dynamic-search-padding)}.wallet-list__tabs-container{margin-bottom:.5rem}.wallet-list__scroll-container{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);max-height:var(--dynamic-wallet-list-max-height);overflow:auto;padding:var(--dynamic-initial-view-content-padding)}.wallet-list__scroll-container--error{padding:var(--dynamic-layout-content-error-padding)}.wallet-list__scroll-container::-webkit-scrollbar,.wallet-list__scroll-container::-webkit-scrollbar-track{display:none}.wallet-list__scroll-container::-webkit-scrollbar-thumb{display:none}.wallet-list__scroll-container:empty{display:flex}.wallet-list__scroll-container--fixed-height{height:var(--dynamic-wallet-list-max-height)}.wallet-list__search-skeleton{height:2.625rem}.wallet-list__search-skeleton,.wallet-list__tile-skeleton{border-radius:calc(var(--dynamic-border-radius)/2);margin-bottom:.5rem}.wallet-list__tile-skeleton{height:3rem;padding:.75rem}.wallet-list__tiny-footer{background:var(--dynamic-base-1);border-top:.0625rem solid var(--dynamic-base-4);box-shadow:var(--dynamic-shadow-up-1);height:var(--dynamic-border-radius);opacity:1;text-align:center;transition:opacity .15s,visibility .15s;visibility:visible}.wallet-list__tiny-footer--hidden{opacity:0;transition:opacity .15s,visibility .15s;visibility:hidden}.wallet-no-access__container{background:var(--dynamic-base-1)}.wallet-no-access__main{padding:var(--dynamic-modal-padding)}.wallet-no-access__social-info-container{align-items:center;display:flex;justify-content:center;margin-top:1.5rem}.wallet-no-access__waitlist-link{align-items:center;display:flex;gap:8px;justify-content:center}.wallet-no-access__social-icon{margin:auto}.wallet-no-access__image{width:100%}.wallet-no-access__user-info-container{align-items:center;display:flex;flex-direction:column;margin-bottom:1rem}.wallet-no-access__content{text-align:center}.wallet-no-access__content--primary{margin-bottom:.375rem}.wallet-no-access__content--secondary{margin-bottom:1rem}.wallet-no-access__wallet-address{margin-left:.375rem}.wallet-no-access__wallet-address-container{align-items:center;display:flex;justify-content:center}.wallet-no-access__button--primary{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);box-shadow:var(--dynamic-shadow-down-1);margin:0}.wallet-no-access__icon--verified{margin:0 auto 1rem}.wallet-sign-spinner__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.wallet-sign-spinner__copy{color:var(--dynamic-text-secondary);margin:0;text-align:center}.wallet-sign-spinner__button{box-shadow:var(--dynamic-shadow-down-1);margin:.75rem 0 0}.wallet-used-view__container{padding:var(--dynamic-layout-content-padding);text-align:center}.wallet-used-view__icon{display:flex;justify-content:center;margin:0 0 .5rem}.wallet-used-view__icon svg{margin:0 auto}.wallet-used-view__shorten-wallet-address{margin:0 0 1rem}.wallet-used-view__copy{margin:0 0 .75rem}.wallet-used-view__accept-button,.wallet-used-view__footer{margin:0 0 .5rem}.wallet-used-view__logout{background:none;border:none;box-shadow:none;margin:auto}.wallet-used-view__checkbox-label{align-items:center;background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);cursor:pointer;display:flex;gap:.5rem;justify-content:center;margin:1rem auto .5rem;padding:.75rem;text-align:left}.wallet-used-view__checkbox-container{flex-shrink:0}.network-not-supported__content-container{padding:var(--dynamic-layout-content-padding)}.network-not-supported__content-container--error{padding:var(--dynamic-layout-content-error-padding)}.network-not-supported__main-img{width:100%}.network-not-supported__img-container{align-items:center;display:flex;justify-content:center}.network-not-supported__img{border-radius:100%;height:4rem;width:4rem}.network-not-supported__welcome-container{margin:1rem 0;text-align:center}.network-not-supported__welcome-title{margin-bottom:.375rem}.network-not-supported__continue{margin-top:1rem}.network-not-supported__log-out{margin:.75rem auto 0}.network-not-supported__error--not-supported{align-items:center;border-radius:0;display:flex;justify-content:center;margin:0;width:100%}.network-not-supported__network-container{margin-top:.5rem;position:relative}.network-not-supported__network-picker{margin:auto;max-width:-moz-fit-content;max-width:fit-content}.network-not-supported__network-picker-button{position:static;transform:translateX(0)}.email-confirmation-waiting-view{align-items:center;display:flex;flex-direction:column;padding-bottom:1.625rem;text-align:center}.email-confirmation-waiting-view__title{padding-bottom:.375rem}.email-confirmation-waiting-view__email-container{align-items:center;display:flex;gap:.25rem;justify-content:center}.email-confirmation-waiting-view__edit-icon-button{display:inline-flex}.email-confirmation-waiting-view__header-icon{display:flex;justify-content:center;margin-top:-2rem}.email-confirmation-waiting-view__note{max-width:16.25rem;padding-top:1rem;text-align:center}.email-confirmation-waiting-view__powered_by_dynamic_footer{padding-top:1rem;width:100%}.login-with-email-form{display:flex;flex-direction:column;gap:.375rem}.login-with-email-form .input__suffix{top:.6875rem}.login-with-email-form .input__suffix .icon-button{--icon-arrow:var(--dynamic-text-tertiary);--icon-background:var(--dynamic-base-3);transition:all .2s}.login-with-email-form .input__suffix .icon-button path,.login-with-email-form .input__suffix .icon-button rect{transition:all .2s}.login-with-email-form .input__suffix .icon-button--active,.login-with-email-form .input__suffix .icon-button:hover{--icon-arrow:var(--dynamic-text-secondary);--icon-background:var(--dynamic-hover)}.login-with-email-form .input__suffix .icon-button--has-content,.login-with-email-form .input__suffix .icon-button--has-content:hover{--icon-arrow:var(--dynamic-base-2);--icon-background:var(--dynamic-brand-primary-color)}.list-item-button{background:none;box-shadow:none}.list-item-button__trailing{position:relative}.list-item-button__trailing-child{position:absolute;right:0;transition-property:opacity,transform;transition-timing-function:ease-in}.list-item-button__trailing-label{transform:translateY(-50%);transition-duration:.2s}.list-item-button__trailing-icon{transition-duration:.3s}.list-item-button:hover .list-item-button__trailing-label,.list-item-button__trailing-icon{opacity:0;transform:translate(-.625rem,-50%)}.list-item-button:hover .list-item-button__trailing-icon{opacity:1;transform:translateY(-50%)}.login-with-email-wallet-list__skeleton{border-radius:calc(var(--dynamic-border-radius)/2);height:2.625rem;margin-bottom:.5rem}.login-with-email-wallet-list__container{display:flex;flex-direction:column;gap:.375rem}.connect-with-wallet-button{height:2.5rem}.toggleable-section{align-items:stretch;display:flex;flex-direction:column;gap:.75rem}.toggleable-section__toggle-prompt{align-items:center;display:flex;justify-content:space-between}.toggleable-section__toggle-prompt__button{cursor:pointer;margin:-.75rem 0 0 -.75rem;outline:none;padding:.75rem 0 0 .75rem}.toggleable-section__toggle-prompt__button__text{outline:none;transition:all .2s}.toggleable-section__toggle-prompt__button:focus .toggleable-section__toggle-prompt__button__text,.toggleable-section__toggle-prompt__button:focus-visible .toggleable-section__toggle-prompt__button__text,.toggleable-section__toggle-prompt__button:hover .toggleable-section__toggle-prompt__button__text{background-color:var(--dynamic-brand-secondary-color)}.login-with-phone-number-form{display:flex;flex-direction:column;gap:.375rem}.login-with-phone-number-form__fields{align-items:stretch;display:flex;position:relative;width:100%}.login-with-phone-number-form__fields__country-code{align-items:center;background-color:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)*.4) 0 0 calc(var(--dynamic-border-radius)*.4);border-right:none;cursor:pointer;display:flex;padding-left:.75rem;position:relative;transition:all .2s ease;width:6.25rem}.login-with-phone-number-form__fields__country-code--disabled{background-color:var(--dynamic-base-3);pointer-events:none}.login-with-phone-number-form__fields__country-code__flag{margin-right:.5rem}.login-with-phone-number-form__fields__country-code__plus{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none}.login-with-phone-number-form__fields__country-code__container{align-items:center;display:flex;flex:1;pointer-events:none}.login-with-phone-number-form__fields__country-code__container .login-with-phone-number-form__fields__country-code__container__input{border:none;flex:1;padding:0;width:100%}.login-with-phone-number-form__fields__country-code__chevron{cursor:pointer;position:absolute;right:.5rem;width:1rem}.login-with-phone-number-form__fields__phone-number{align-items:center;display:flex;flex:1;position:relative}.login-with-phone-number-form__fields__phone-number .login-with-phone-number-form__fields__phone-number__input{border-radius:0 calc(var(--dynamic-border-radius)*.4) calc(var(--dynamic-border-radius)*.4) 0;padding-left:.75rem}.login-with-phone-number-form__fields__placeholder{align-self:center;color:var(--dynamic-text-secondary);left:7.0625rem;pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.login-with-phone-number-form__fields__inline-submit{align-self:center;position:absolute;right:.75rem}.login-with-phone-number-form__dropdown{width:calc(var(--dynamic-modal-width) - 3rem)}.login-with-phone-number-form__dropdown__items{display:flex;flex-direction:column}.login-with-phone-number-form__dropdown__items__country{align-items:center;cursor:pointer;display:flex;gap:.375rem;padding:.375rem .75rem}.login-with-phone-number-form__dropdown__items__country__flag{width:1.5rem}.login-with-phone-number-form__dropdown__items__country__name{font-size:var(--dynamic-text-size-body-small)}.login-with-phone-number-form__dropdown__items__country__code{color:var(--dynamic-text-secondary);font-size:var(--dynamic-text-size-body-small)}.login-with-phone-number-form__dropdown__items__country:hover{background-color:var(--dynamic-base-4)}.login-with-phone-number-form__dropdown__items__country--selected{background-color:var(--dynamic-base-3)}.login-with-phone-number-form__error-message{color:var(--dynamic-error-1);padding:.5rem 0}.login-with-phone-number-form input::-webkit-inner-spin-button,.login-with-phone-number-form input::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}.login-with-phone-number-form input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}.login-view__text{padding:.5rem 0}.login-view__error-container{margin:0}.login-view__container{padding:var(--dynamic-initial-view-content-padding)}.login-view__container--error{padding:var(--dynamic-layout-content-error-padding)}@media (pointer:coarse){.login-view__container{padding:.75rem}}.login-view__scroll{align-items:stretch;gap:.375rem;height:100%;max-height:36.25rem;overflow:auto}.login-view__scroll,.login-view__scroll__section{display:flex;flex-direction:column}.login-view__scroll__section--emailAndPhone+.login-view__scroll__section--social{margin-top:1rem}.login-view__scroll::-webkit-scrollbar,.login-view__scroll::-webkit-scrollbar-track{display:none}.login-view__scroll::-webkit-scrollbar-thumb{display:none}.login-view__scroll:empty{display:flex}.login-view__scroll--full-height{height:100vh}.login-view__scroll--email-first{flex-direction:column-reverse}.login-view__scroll__web2{display:flex;flex-direction:column;gap:.75rem}.mobile-wallet-redirect{align-items:stretch;display:flex;flex-direction:column;gap:1.5rem;justify-content:center;padding:var(--dynamic-layout-content-padding)}.mobile-wallet-redirect__icon-with-spinner{align-self:center}.mobile-wallet-redirect__copy-text{align-self:center;max-width:20rem;text-align:center}.mobile-wallet-redirect__alert{text-align:center}.mobile-wallet-redirect__wallet-app{align-items:center;background-color:var(--dynamic-base-2);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex-wrap:wrap;gap:.875rem;justify-content:space-between;padding:.625rem .75rem}.mobile-wallet-redirect__wallet-app__group{align-items:center;display:flex;gap:.5rem}.mobile-wallet-redirect__wallet-app__group__app-store{text-align:right}.captcha-verify-user__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:0 1.5rem 1.5rem;text-align:center}.captcha-verify-user__icon{height:4rem;margin-bottom:1rem;width:4rem}.captcha-verify-user__title{margin-bottom:.375rem}.captcha-verify-user__subtitle{margin-bottom:1rem}.captcha-verify-user__dynamic-logo{margin-top:1rem}.network-not-supported-switch-manual{margin-top:-1.5rem;padding:0 1.5rem 1.5rem}.network-not-supported-switch-manual__img-container{align-items:center;display:flex;justify-content:center;margin-bottom:1rem}.network-not-supported-switch-manual__img{border-radius:100%;height:4rem;width:4rem}.network-not-supported-switch-manual__network-container{position:relative}.network-not-supported-switch-manual__content{text-align:center}.network-not-supported-switch-manual__title{margin:0 0 .375rem}.wallet-group__list{display:flex;flex-direction:column}.wallet-locked-view__error-container{align-items:center;display:flex;justify-content:center}.wallet-locked-view__button-header{margin:.75rem}.wallet-locked-view__button{margin:.75rem auto auto}.wallet-locked-view__icon{margin:auto}.wallet-locked-view__content{padding:0 var(--dynamic-modal-padding) 2.1875rem;text-align:center}@media (pointer:coarse){.wallet-locked-view__content{padding:0 .75rem}}.wallet-locked-view__title{margin-top:.75rem}.wallet-locked-view__log-out{margin:.75rem auto 0}.merge-user-accounts__error{margin-bottom:.75rem;padding:.75rem 1.5rem}.merge-user-accounts__container{display:flex;flex-direction:column;gap:1.5rem;padding:0 1.5rem 1.5rem}@media (pointer:coarse){.merge-user-accounts__container{padding:0 .75rem}}.merge-user-accounts-conflicts__error{margin-bottom:.75rem;padding:.75rem 1.5rem}.merge-user-accounts-conflicts__container{display:flex;flex-direction:column}@media (pointer:coarse){.merge-user-accounts-conflicts__container{padding:0 .75rem}}.merge-user-accounts-conflicts__description{padding:0 1.5rem .75rem}.merge-user-accounts-conflicts__fields{display:flex;flex-direction:column;gap:1rem;max-height:22.5rem;overflow-y:auto;padding:.75rem 1.5rem}.merge-user-accounts-conflicts__fields__item{display:flex;flex-direction:column;gap:.5rem}.merge-user-accounts-conflicts__fields__item__button{padding:.5rem .75rem}.merge-user-accounts-conflicts__buttons{background:var(--dynamic-base-1);box-shadow:0 -8px 48px -8px rgba(109,121,165,.16);display:flex;flex-direction:column;gap:.5rem;padding:.75rem 1.5rem}.merge-user-accounts-with-same-email__container{padding:0 1.5rem 1.5rem}@media (pointer:coarse){.merge-user-accounts-with-same-email__container{padding:0 .75rem}}.merge-user-accounts-with-same-email__accounts{align-items:center;display:flex;justify-content:space-between;margin:-1.5rem auto 1.5rem;max-width:270px;width:100%}.merge-user-accounts-with-same-email__accounts__item{align-items:center;display:flex;flex-direction:column;gap:.625rem;justify-content:center;width:100%}.merge-user-accounts-with-same-email__accounts__item__icon{height:3.5rem;width:3.5rem}.merge-user-accounts-with-same-email__accounts__divider{height:16px;margin-top:-1.5rem;width:16px}.merge-user-accounts-with-same-email__accounts__divider__icon>path{fill:var(--dynamic-text-secondary)}.merge-user-accounts-with-same-email__text{text-align:center}.merge-user-accounts-with-same-email__text__header{color:var(--dynamic-text-primary);margin-bottom:.5rem}.merge-user-accounts-with-same-email__text__body{color:var(--dynamic-text-secondary);margin-bottom:1rem}.merge-user-accounts-with-same-email__text--bold{font-weight:700}.merge-user-accounts-with-same-email__buttons{display:flex;flex-direction:column;gap:.5rem}.merge-user-accounts-with-same-email__buttons__button{width:100%}.wallet-cannot-be-transferred-view__container{padding:var(--dynamic-modal-padding);text-align:center}.wallet-cannot-be-transferred-view__icon{display:flex;justify-content:center;margin:0 0 .5rem}.wallet-cannot-be-transferred-view__icon svg{margin:0 auto}.wallet-cannot-be-transferred-view__shorten-wallet-address{margin:0 0 1rem}.wallet-cannot-be-transferred-view__title{margin:0 0 .375rem}.wallet-cannot-be-transferred-view__copy{margin:0 0 .75rem}.wallet-cannot-be-transferred-view__transfer-alt-wallet-button{margin:0 0 1rem}.wallet-cannot-be-transferred-view__footer{margin:0 0 .5rem}.wallet-cannot-be-transferred-view__cancel{background:none;border:none;box-shadow:none;margin:auto}.user-field-editor__header{align-items:center;display:flex;flex-direction:column;gap:1.25rem;text-align:center}.user-field-editor__header__icon{align-items:center;background-color:var(--dynamic-base-2);border-radius:50%;display:flex;height:4rem;justify-content:center;width:4rem}.user-field-editor__body{align-items:center;display:flex;flex-direction:column;gap:.5rem;margin:0 1.5rem 1.5rem;text-align:center}.user-field-editor__body__subtitle{margin-block:-.375rem .5rem}.user-field-editor__body__form{width:100%}.passkey-intro-view{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.passkey-intro-view__header{display:flex;width:100%}.passkey-intro-view__actions{display:flex;flex-direction:column;gap:.625rem;width:100%}.passkey-intro-view__inline-button{align-items:center;display:inline-flex;gap:.5rem;text-align:left}.passkey-intro-view__inline-button svg path{fill:var(--dynamic-base-2)!important}.passkey-intro-view__log-out{font-size:.875rem;justify-content:center;line-height:20px}.passkey-intro-view__log-out:hover{background-color:transparent}.passkey-intro-view__skip{color:var(--dynamic-text-secondary);font-size:.875rem;justify-content:center;line-height:1rem}.passkey-intro-view__skip:hover{background-color:transparent}.passkey-recovery-view{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.passkey-recovery-view__header{align-items:center;display:flex;justify-content:center;margin-bottom:-5rem;width:12.875rem}.passkey-recovery-view__actions{display:flex;flex-direction:column;gap:.625rem;width:100%}.passkey-recovery-view__input-valid{background:var(--dynamic-success-2)!important;border-color:var(--dynamic-success-1)!important}.passkey-recovery-view__input-valid,.passkey-recovery-view__input-valid~.input__label{color:var(--dynamic-success-1)!important}.passkey-recovery-view__form{display:flex;flex-direction:column;width:100%}.passkey-recovery-view__skip{justify-content:center;margin-top:1.5rem}.passkey-recovery-view__inline-button{align-items:center;display:inline-flex;gap:.5rem;text-align:left}.passkey-recovery-view__inline-button svg path{fill:var(--dynamic-base-2)!important}.passkey-recovery-view__resend-code{align-items:center;display:flex;flex-direction:column}.passkey-recovery-view button.text-button:not(.passkey-recovery-view__skip){color:inherit}.edit-passkeys-widget-view,.edit-passkeys-widget-view__body{display:flex;flex-direction:column}.edit-passkeys-widget-view__body{flex:1;gap:.25rem;justify-content:space-between;margin-top:20px;padding:0 1.5rem 1.5rem}.edit-passkeys-widget-view__icon{height:100px;margin-left:auto;margin-right:auto;margin-top:-40px;width:100px}.edit-passkeys-widget-view__title{margin-left:auto;margin-right:auto;margin-top:20px}.passkey-new-domain-detected{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.passkey-new-domain-detected__header{align-items:center;display:flex;justify-content:center}.passkey-new-domain-detected__actions{display:flex;flex-direction:column;gap:.625rem;width:100%}.passkey-new-domain-detected__inline-button{align-items:center;display:inline-flex;gap:.5rem;text-align:left}.passkey-new-domain-detected__inline-button svg path{fill:var(--dynamic-base-2)!important}.passkey-new-domain-detected__log-out{font-size:.875rem;justify-content:center;line-height:20px}.passkey-new-domain-detected__log-out:hover{background-color:transparent}.embedded-reveal-view{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.embedded-reveal-view__header{align-items:center;display:flex;justify-content:center}.embedded-reveal-view__zerodev-warning{background-color:var(--dynamic-error-1);border-radius:.5rem;margin-bottom:1rem;padding:1.25rem}.embedded-reveal-view__zerodev-warning__title-row{align-items:center;display:flex;margin-bottom:.5rem}.embedded-reveal-view__zerodev-warning__icon{flex-shrink:0;height:1.25rem;margin-right:.5rem;width:1.25rem}.embedded-reveal-view__zerodev-warning__link-button{background:none;border:none;cursor:pointer;display:inline;font:inherit;margin-left:.25rem;padding:0}.embedded-reveal-view__zerodev-warning .typography{color:inherit}.embedded-reveal-view__zerodev-warning .typography.underline{text-decoration:underline}.embedded-reveal-view__coinbase{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);color:var(--dynamic-text-secondary);display:flex;flex:1;flex-direction:column;gap:.625rem;max-height:21.875rem;overflow:auto;overflow-wrap:break-word;padding:.75rem}.embedded-reveal-view__body{display:flex;flex:1;flex-direction:column;gap:.75rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.embedded-reveal-view__body__description{display:flex;justify-content:center;text-align:center}.embedded-reveal-view__body__badge{font-size:.75rem}.embedded-reveal-view__body__card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.625rem;max-height:21.875rem;overflow:auto;padding:.75rem}.embedded-reveal-view__body__card__statement{display:flex;gap:.5rem;letter-spacing:-.15px}.embedded-reveal-view__body__card__acknowledgement{display:flex;gap:.5rem;text-align:left}.embedded-reveal-view__body__card__icon{color:var(--dynamic-text-tertiary);height:1.5rem;min-width:1.5rem;width:1.5rem}.embedded-reveal-view__body__card__skeleton{border-radius:.75rem;height:3.75rem}.embedded-reveal-view__body__confirm_card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.75rem;letter-spacing:-.15px;max-height:21.875rem;overflow:auto;padding:1rem}.embedded-reveal-view__body__button{color:#fff}.embedded-auth-choice{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.embedded-auth-choice__header{align-items:center;display:flex;justify-content:center;width:100%}.embedded-auth-choice__skip-button{margin-top:-.25rem}.action-card{background-color:var(--dynamic-base-2);border-radius:.75rem;box-shadow:var(--dynamic-shadow-down-1);display:flex;padding:1rem;text-align:left;transition:all .2s ease}.action-card:hover{box-shadow:var(--dynamic-button-shadow)}.action-card__icon{height:1.75rem;min-width:1.75rem;width:1.75rem}.action-card__icon,.action-card__icon path{fill:var(--dynamic-text-tertiary)}.action-card__action-icon{margin-left:auto;min-width:1rem;transform:rotate(180deg);width:1rem}.action-card__content{display:flex;flex-direction:column;gap:.25rem;margin-left:8px}.action-card__content__row{align-items:flex-start;display:flex;gap:.375rem}.action-card__content__row__badge--primary{background:var(--dynamic-brand-primary-color);color:var(--dynamic-base-2)}.embedded-auth-choice-cards{display:flex;flex-direction:column;gap:.625rem;width:100%}.auth-choice-info{align-items:flex-start;align-self:stretch;background:var(--default-base-2,#fff);border:1px solid var(--default-base-4,#e7e8ed);border-radius:12px;display:flex;flex-direction:column;gap:12px;justify-content:center;padding:16px 12px 12px}.auth-choice-info__container-item{display:flex;flex-direction:row;gap:.5rem;text-align:start}.select-hardware-wallet-view__container{align-items:stretch;display:flex;flex-direction:column;padding:var(--dynamic-layout-content-padding)}.select-hardware-wallet-view__icon{height:6rem;margin:0 auto .75rem;width:4rem}.select-hardware-wallet-view__text{padding-bottom:1rem;text-align:center}.enter-password-view{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.enter-password-view__body{display:flex;flex:1;flex-direction:column;gap:.75rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.enter-password-view__body__icon{display:flex;justify-content:center;text-align:center}.enter-password-view__body__description{text-align:center}.enter-password-view__password-input__suffix-icon{color:var(--dynamic-text-tertiary);height:22px;margin-top:-4px;width:22px}.wallet-redirect-view__container{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-modal-padding)}.wallet-redirect-view__container .wallet-redirect-view__title{color:var(--dynamic-text-primary);line-height:2.25rem}.wallet-redirect-view__container .powered-by-dynamic{margin-top:1.5rem}.create-password{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.create-password__body{display:flex;flex:1;flex-direction:column;gap:.5rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.create-password__body__header{align-items:center;display:flex;flex-direction:column;gap:1rem;padding:.5rem 0}.create-password__body__card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.3125rem;max-height:21.875rem;overflow:auto;padding:.75rem}.create-password__progress-bar{display:flex;margin:8px 0}.create-password__progress-bar__element{background-color:var(--default-base-4,#e7e8ed);border-radius:24px;height:4px;margin:0 4px;width:100%}.create-password__progress-bar__element__1{background:var(--dynamic-error-1)}.create-password__progress-bar__element__2{background:var(--dynamic-alert-1)}.create-password__progress-bar__element__3{background:var(--dynamic-success-1)}.create-password__password-input__suffix{align-items:center;display:flex;gap:.375rem;margin-top:-.25rem}.create-password__password-input__suffix__icon{color:var(--dynamic-text-tertiary);height:1.375rem;width:1.375rem}.create-password__password-criteria-icon{height:.9375rem;width:.9375rem}.create-password__password-criteria-list{align-items:center;display:flex;gap:.5rem;margin:.125rem 0}.create-password__password-criteria-list__success{color:var(--dynamic-success-1)}.create-password__password-criteria-list__error{color:var(--dynamic-error-1)}.create-password__log-out{margin:0 auto}.save-password-suffix-icon{color:var(--dynamic-text-tertiary);height:22px;margin-top:-4px;width:22px}.save-password-view{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.save-password-view__header{align-items:center;display:flex;justify-content:center}.save-password-view__body{display:flex;flex:1;flex-direction:column;gap:.75rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.save-password-view__body__icon{display:flex;justify-content:center;text-align:center}.save-password-view__body__badge{background-color:var(--default-alert-2,#faedd9);color:var(--dynamic-alert-1);font-size:.75rem}.save-password-view__body__description{text-align:center}.save-password-view__body__actions{display:flex;gap:8px;justify-content:space-between}.save-password-view__body__card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.625rem;max-height:21.875rem;overflow:auto;padding:.75rem}.save-password-view__body__card__statement{display:flex;gap:.5rem;letter-spacing:-.15px}.save-password-view__body__card__acknowledgement{display:flex;gap:.5rem;text-align:left}.save-password-view__body__confirm-card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.5rem;letter-spacing:-.15px;max-height:21.875rem;overflow:auto;padding:.625rem}.mpc-claim-intro{display:flex;flex-direction:column;gap:var(--dynamic-wallet-list-tile-gap);height:100%;overflow:auto}.mpc-claim-intro__header{align-items:center;display:flex;justify-content:center}.mpc-claim-intro__body{display:flex;flex:1;flex-direction:column;gap:.75rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.mpc-claim-intro__body__description{display:flex;justify-content:center;text-align:center}.mpc-claim-intro__body__badge{font-size:.75rem}.mpc-claim-intro__body__card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.625rem;max-height:21.875rem;overflow:auto;padding:.75rem}.mpc-claim-intro__body__card__statement{display:flex;gap:.5rem;letter-spacing:-.15px}.mpc-claim-intro__body__card__acknowledgement{display:flex;gap:.5rem;text-align:left}.mpc-claim-intro__body__card__icon{color:var(--dynamic-text-tertiary);height:1.5rem;min-width:1.5rem;width:1.5rem}.mpc-claim-intro__body__card__skeleton{border-radius:.75rem;height:3.75rem}.mpc-claim-intro__body__confirm_card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);display:flex;flex:1;flex-direction:column;gap:.75rem;letter-spacing:-.15px;max-height:21.875rem;overflow:auto;padding:1rem}.mpc-claim-intro__body__button{color:#fff}#dyn-turnkey-export-container-id{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;overflow:auto;padding:.75rem}#dyn-turnkey-export-element-id{word-wrap:break-word;max-height:-moz-min-content;max-height:min-content;width:100%}.mfa-choose-device-view__body{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.mfa-choose-device-view__copy{color:var(--dynamic-text-secondary);line-height:1.25rem;text-align:center;width:75%}.mfa-choose-device-view__button{box-shadow:var(--dynamic-shadow-down-1);display:flex;flex-direction:column;gap:.25rem;margin-top:.75rem;text-align:left}.mfa-choose-device-view__button__header{align-items:center;display:flex;justify-content:space-between;width:100%}.mfa-choose-device-view__button__description.mfa-choose-device-view__button__description{font-size:var(--dynamic-text-size-body-small)}.mfa-choose-device-view__icon--rotate{color:var(--dynamic-text-tertiary);height:1rem;justify-content:end;transform:rotate(180deg);width:1rem}.mfa-choose-device-view__logout{margin-top:1.125rem}.mfa-secure-device-view__body{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:var(--dynamic-layout-content-padding)}.mfa-secure-device-view__copy{color:var(--dynamic-text-secondary);line-height:1.25rem;text-align:center;width:75%}.mfa-secure-device-view__button,.mfa-secure-device-view__logout-button{box-shadow:var(--dynamic-shadow-down-1);margin-top:.75rem}.mfa-secure-device-view__loading-spinner{height:394px}.mfa-secure-device-view__qrcode{align-items:center;background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)*.6);display:flex;flex-direction:column;gap:.625rem;margin:1rem 0;padding:.75rem}.mfa-secure-device-view__qrcode .button-container{display:flex;gap:.5rem;justify-content:center;width:100%}.mfa-secure-device-view__qrcode .button-container svg path{fill-opacity:100%}.mfa-secure-device-view__qrcode .button-container .qr-code-button{height:2.375rem}.mfa-display-backup-codes-view__body{align-items:center;display:flex;flex-direction:column;gap:1rem;justify-content:center;padding:var(--dynamic-layout-content-padding);text-align:center}.mfa-display-backup-codes-view__warning{border-radius:var(--dynamic-border-radius);padding:.25rem .5rem}.mfa-display-backup-codes-view__loading-spinner{height:19.5rem}.mfa-display-backup-codes-view__codes{display:flex;flex-wrap:wrap;gap:.5rem;justify-content:center}.mfa-display-backup-codes-view__code{background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-button-primary-border);border-radius:var(--dynamic-border-radius);color:var(--dynamic-text-secondary);padding:.75rem 1.125rem;text-align:center;width:8.75rem}.mfa-display-backup-codes-view__actions{display:flex;gap:.5rem;width:100%}.mfa-display-backup-codes-view__actions button{border-radius:calc(var(--dynamic-button-border-radius)/1.5)}.mfa-display-backup-codes-view__complete{display:flex;flex-direction:column;gap:.5rem;width:100%}.mfa-display-backup-codes-view__acknowledgement{border-radius:calc(var(--dynamic-button-border-radius)/1.5);justify-content:left}.mfa-display-backup-codes-view__acknowledgement .typography{font-size:var(--dynamic-text-size-button-secondary);font-weight:500}.mfa-recovery-view{align-items:center;display:flex;flex-direction:column;gap:1rem;padding-bottom:1.5rem;padding-left:1.5rem;padding-right:1.5rem;text-align:center}.mfa-recovery-view__body{padding:.3125rem,0}.mfa-recovery-view__actions{display:flex;flex-direction:column;gap:.625rem;width:100%}.mfa-recovery-view__get-help{padding:.3125rem,0}.mfa-verification-view__choose-another-method{display:flex;justify-content:center;margin-bottom:1.5rem;width:100%}.mfa-verification-view__choose-another-method-button{color:var(--dynamic-text-link)}.access-blocked__container{align-items:center;background:var(--dynamic-base-1);display:flex;flex-direction:column;padding:.3125rem}.access-blocked__icon{margin-bottom:.3125rem}.access-blocked__content{margin:.9375rem 0;padding:0 .625rem .625rem;text-align:center}.switch-wallet{white-space:pre-line}.switch-wallet__body{background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);margin-top:.625rem;padding:1rem 0;width:100%}.switch-wallet__body__divider{gap:0;padding:.75rem 0}.switch-wallet__body__divider svg{transform:rotate(90deg)}.switch-wallet__body__expected-address__prompt{margin-bottom:.5rem;margin-top:1rem}.switch-wallet__body__expected-address__address{font-size:1.5rem;line-height:1.25rem}.sync-wallet-view .qr-code-wrapper{padding-top:.5rem}.sync-wallet-view .prompt-modal-portal,.sync-wallet-view .prompt-modal-portal__container{position:relative}.mfa-qrcode-help-content__container{color:var(--dynamic-text-secondary);padding:1.5rem}.mfa-qrcode-help-content__vertical-container{background-color:#fff;border-radius:calc(var(--dynamic-border-radius)/2);display:flex;flex-direction:column}.mfa-qrcode-help-content__setup-container{font-family:Arial,sans-serif;margin:0 auto;max-width:400px;width:100%}.mfa-qrcode-help-content__step{align-items:center;background-color:#fff;border-radius:calc(var(--dynamic-border-radius)/2);color:gray;display:flex;flex-direction:row;height:100%;justify-content:flex-start;margin-bottom:.625rem;max-width:100%;padding:1rem}.mfa-qrcode-help-content__step__title{margin-bottom:.3125rem}.mfa-qrcode-help-content__step__number{align-items:center;align-self:flex-start;background-color:#e3ebff;border-radius:50%;color:#4779ff;display:flex;height:1.5rem;justify-content:center;margin-right:.625rem;min-width:1.5rem;width:1.5rem}.mfa-qrcode-help-content__step__nocopy-box{align-items:center;border:.0625rem solid #e0e0e0;border-radius:.3125rem;display:flex;justify-content:space-between;padding:.625rem}.mfa-qrcode-help-content__step__nocopy-text{word-break:break-all}.mfa-qrcode-help-content__copy-button{background-color:transparent;border:none;cursor:pointer}.sandbox-threshold__main{align-items:center;background:var(--dynamic-base-1);display:flex;flex-direction:column;justify-content:center;padding:0 var(--dynamic-modal-padding) 1.125rem}.sandbox-threshold__title{color:var(--dynamic-text-primary);line-height:1.5rem;text-align:center}.sandbox-threshold__description{color:var(--dynamic-text-secondary);line-height:1.25rem;margin-bottom:1.5rem;margin-top:.75rem;text-align:center}.sandbox-threshold__button{box-shadow:var(--dynamic-shadow-down-1)}.global-wallet-confirm .popup-content .wallet-connection-view{align-items:center;display:flex;flex-direction:column;padding:24px}.global-wallet-confirm .popup-content .wallet-connection-view .dapp-icon{height:64px;margin-bottom:16px;width:64px}.global-wallet-confirm .popup-content .wallet-connection-view .connection-title{color:var(--dynamic-text-primary);margin-bottom:16px;text-align:center}.global-wallet-confirm .popup-content .wallet-connection-view .dapp-url{color:var(--dynamic-text-secondary);margin-bottom:24px;text-align:center}.global-wallet-confirm .popup-content .wallet-connection-view .button-group{display:flex;gap:16px;width:100%}.global-wallet-confirm .popup-content .wallet-connection-view .button-group button{cursor:pointer;flex:1}.global-wallet-confirm .popup-content .wallet-connection-view .button-group button.cancel-button{background-color:var(--dynamic-base-2)}.global-wallet-confirm .popup-content .wallet-connection-view .button-group button.connect-global-button{background-color:#3b82f6;color:#fff}.info-card .wrapper{background:var(--dynamic-base-2);border:1px solid var(--dynamic-border-2);border-radius:16px;display:flex;flex-direction:column;gap:.75rem;padding:1.5rem;text-align:left}.inline-icon-text{display:inline}.inline-icon-text svg{display:inline-block;height:1em;margin:0 .25em;vertical-align:middle;width:1em}.nowrap{align-items:center;display:inline-flex;white-space:nowrap}.learn-more-link{align-items:center;display:flex;justify-content:center;padding:4px;pointer-events:auto;text-decoration:none}.learn-more-link svg{cursor:pointer;height:.5rem;margin-left:.25rem;width:.5rem}.malicious-site-view .popup-content .wallet-connection-view{align-items:center;display:flex;flex-direction:column;justify-content:center;padding:24px;text-align:center}.malicious-site-view .popup-content .wallet-connection-view .header{align-items:center;display:flex;justify-content:center;margin-bottom:16px;width:100%}.malicious-site-view .popup-content .wallet-connection-view .header .back-button{background:none;border:none;cursor:pointer;left:24px;padding:8px;position:absolute}.malicious-site-view .popup-content .wallet-connection-view .header h1{color:var(--dynamic-text-primary);margin:0}.malicious-site-view .popup-content .wallet-connection-view .warning-card{align-items:center;border-radius:8px;display:flex;flex-direction:column;justify-content:center;margin-bottom:16px;padding:16px;width:100%}.malicious-site-view .popup-content .wallet-connection-view .warning-card .warning-icon{height:48px;margin-bottom:8px;width:48px}.malicious-site-view .popup-content .wallet-connection-view .connection-title{margin-top:16px}.malicious-site-view .popup-content .wallet-connection-view .site-info{color:var(--dynamic-text-secondary);padding:16px}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container{border-radius:12px;display:flex;flex-direction:column;margin-top:16px;padding:16px;position:relative}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container.definitely-malicious{background-color:var(--dynamic-error-2)}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container.unknown{background-color:#f4d09a}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container .subtitle-header-container{align-items:flex-start;display:flex;margin-bottom:4px}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container .subtitle-header-container .caution-icon{height:24px;left:16px;position:absolute;top:16px;width:24px}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container .subtitle-header-container .subtitle-header{flex:1;margin-bottom:0;margin-left:32px;text-align:left}.malicious-site-view .popup-content .wallet-connection-view .subtitle-container .subtitle{margin-top:0;padding-left:32px;text-align:left}.malicious-site-view .popup-content .wallet-connection-view .button-group{display:flex;gap:16px;margin-top:16px;width:100%}.malicious-site-view .popup-content .wallet-connection-view .button-group button{cursor:pointer;flex:1}.malicious-site-view .popup-content .wallet-connection-view .button-group button.cancel-button{background-color:var(--dynamic-base-2)}.malicious-site-view .popup-content .wallet-connection-view .button-group button.proceed-button{background-color:inherit;box-shadow:none}.sign-message-confirmation__actions{align-items:center;display:flex;flex-direction:row;gap:.375rem;padding-bottom:1rem;width:100%}.sign-message-confirmation__body{align-items:stretch;display:flex;flex-direction:column;padding:.5rem 1.5rem 1.5rem}.sign-message-confirmation__message-container{align-items:center;background-color:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:var(--dynamic-shadow-down-1);margin-bottom:.5rem;margin-top:.75rem;max-height:18.75rem;overflow-y:scroll;padding:.75rem;width:100%}.sign-message-confirmation__secure-wallet{margin-block:.5rem}.sign-message-confirmation__message{overflow-wrap:break-word;padding-top:.75rem}.sign-message-confirmation__title{text-align:center}.sign-message-confirmation__error{padding-top:.75rem}.bridge-welcome-layout{display:flex;flex-direction:column;gap:.75rem}.bridge-welcome-layout__body{display:flex;flex-direction:column;gap:1.5rem;padding:0 1.5rem 1.5rem}.bridge-welcome-layout__message-container{display:flex;flex-direction:column;gap:.25rem;text-align:center}.bridge-welcome-layout__chain-icon-group{align-items:center;display:flex;flex-direction:row-reverse;padding-top:.875rem}.bridge-welcome-layout__chain-icon{background-color:var(--dynamic-base-1);border-radius:50%;height:4rem;margin-left:-1.375rem;outline:.25rem solid var(--dynamic-base-1);overflow:hidden;width:4rem}.bridge-welcome-layout__chain-icon:last-child{margin-left:0}.select-wallet-list-layout{display:flex;flex-direction:column;min-height:320px}.select-wallet-list-layout__wallet-list{display:flex;flex-direction:column;flex-grow:1;gap:var(--dynamic-wallet-list-tile-gap);max-height:var(--dynamic-wallet-list-max-height);overflow-y:auto;padding:.25rem 1.5rem 1.5rem}.connected-wallets-list-layout{display:flex;flex-direction:column}.connected-wallets-list-layout__body{display:flex;flex-direction:column;gap:1rem;padding:.25rem 1.5rem 1.5rem}.connected-wallets-list-layout__body__text{text-align:center}.bridge-next-wallet-to-connect-layout__chain-icon{height:4rem;margin:1rem 1rem 0;width:4rem}.bridge-next-wallet-to-connect-layout__body{align-items:center;display:flex;flex-direction:column;gap:1.5rem;padding:1rem 1.5rem 1.5rem;text-align:center}.account-control__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.account-control__icon{min-width:1rem}.account-control__social_icon{height:1rem;width:1rem}.account-control__container{align-items:center;border-radius:calc(var(--dynamic-border-radius)/3);color:var(--dynamic-text-primary);display:flex;gap:.375rem;min-height:100%;padding:.75rem;z-index:10}.account-control__container--multiwallet-disabled{border-bottom-left-radius:0;border-top-left-radius:0}.account-control__container--active,.account-control__container:hover{background-color:var(--dynamic-hover)}.dynamic-widget-inline-controls{background-color:var(--dynamic-base-1);border-radius:calc(var(--dynamic-border-radius)/3);display:flex;font-size:var(--dynamic-text-size-body-small);max-height:2.5rem;min-width:100%;position:relative}.dynamic-widget-inline-controls__network-picker-main{min-width:60px}.dynamic-widget-inline-controls__account-control{max-width:100%;min-width:max(100%,45px)}.dynamic-widget-inline-controls__account-control .account-control__icon{margin-left:auto}.dynamic-widget-inline-controls__account-control-container{min-width:60px;overflow:hidden}.dynamic-widget-inline-controls__network-picker{background:unset;border-bottom-left-radius:calc(var(--dynamic-border-radius)/3);border-bottom-right-radius:unset;border-top-left-radius:calc(var(--dynamic-border-radius)/3);border-top-right-radius:unset;min-width:100%;padding:.75rem;position:unset;transform:unset}.dynamic-widget-inline-controls__network-picker--active,.dynamic-widget-inline-controls__network-picker:hover{background:var(--dynamic-hover)}.dynamic-widget-inline-controls__network-picker-checkbox{margin:0 0 0 .5rem}.dynamic-widget-inline-controls__network-picker-list{top:2.5rem}@media (pointer:coarse){.dynamic-widget-inline-controls__network-picker-list{top:unset}}.dynamic-widget-dropdown{position:absolute;right:0;top:3.0625rem}.dynamic-widget-dropdown__root{min-width:22.5rem}.dynamic-widget-modal{left:50%;margin:0 auto;position:fixed;top:50%;transform:translate(-50%,-50%);width:min(100%,22.5rem)}@media (pointer:coarse){.dynamic-widget-modal{bottom:0;top:unset;transform:translate(-50%);width:100%}}.dynamic-widget-card{background-color:var(--dynamic-base-1);border:.0625rem solid var(--dynamic-base-4);border-radius:var(--dynamic-border-radius);box-shadow:var(--dynamic-shadow-down-3);height:100%;position:relative;transition:max-height .1s linear}@media (pointer:coarse){.dynamic-widget-card{border-bottom-left-radius:0;border-bottom-right-radius:0}}.dynamic-widget-header{padding:1.5rem 1.5rem 0;position:relative}.dynamic-widget-header__switcher{margin:0 0 1rem}.dynamic-widget-header__passkey-success{margin-inline:-1.5rem}.dynamic-widget-wallet-header{position:relative}.dynamic-widget-wallet-header__email{color:var(--dynamic-text-primary);margin:.5rem 0;text-align:center}.dynamic-widget-wallet-header__icon-container{height:4rem;margin:auto;position:relative;width:4rem}.dynamic-widget-wallet-header__icon-container img,.dynamic-widget-wallet-header__icon-container svg{height:100%;width:100%}.dynamic-widget-wallet-header__wallet-info{align-items:center;display:flex;flex-direction:column;justify-content:center;margin:0 0 1rem}.dynamic-widget-wallet-header__wallet-info .text-button{padding:0}.dynamic-widget-wallet-header__wallet-info__secure-wallet{margin-bottom:0;margin-top:1rem}.dynamic-widget-wallet-header__wallet-address{align-items:center;display:flex;justify-content:center}.dynamic-widget-wallet-header__balance{margin-bottom:.0625rem}.dynamic-widget-wallet-header__seperator{background-color:var(--dynamic-base-4);height:.5rem;margin:0 .5rem;width:.0625rem}.dynamic-widget-wallet-header__status-dot{margin-right:.375rem}.dynamic-widget-wallet-header__ens-name{max-width:12.5rem}.dynamic-widget-wallet-header__network-picker.evm-network-control__container{height:1.5rem}.dynamic-widget-wallet-header__network-picker.non-network-switching-supported-control{height:1.5rem;width:1.5rem}.dynamic-widget-wallet-header__network-picker.network-control-skeleton{bottom:0;height:1.5rem;position:absolute;right:0;width:1.5rem}.dynamic-widget-wallet-header__network-picker .evm-network-control__network-name,.dynamic-widget-wallet-header__network-picker .non-network-switching-supported-control__network-name{display:none}.dynamic-widget-wallet-header__wallet-avatar{border-radius:100%;overflow:hidden}.dynamic-widget-wallet-header__wallet-avatar img{height:4rem;width:4rem}.dynamic-widget-wallet-header__wallet-actions{align-items:center;display:flex;gap:.5rem;justify-content:stretch;margin-top:.5rem;width:100%}.dynamic-widget-wallet-header__wallet-loading{margin-bottom:.5rem;margin-top:.5rem;width:100%}.empty-wallet__container{align-items:center;background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);display:flex;flex-direction:column;gap:.75rem;justify-content:center;padding:.5rem;text-align:center;width:100%}.empty-wallet__container--big{margin:0 0 1rem;padding:.75rem}.empty-wallet__icon{height:1.5rem;width:1.5rem}.empty-wallet__icon--big{height:3rem;width:3rem}.empty-wallet__icon>path{fill:var(--dynamic-text-tertiary)}.empty-wallet__text-container{max-width:10rem}.wallet__container{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-3);border-radius:calc(var(--dynamic-border-radius)/2);display:flex;flex-direction:row;padding:.75rem}.wallet__container:not(:last-child){border-bottom-left-radius:0;border-bottom-right-radius:0;margin-bottom:-.75rem;padding-bottom:1.5rem}.wallet__container:hover .wallet__menu{opacity:1}.wallet__menu{color:var(--dynamic-text-tertiary);opacity:0;transition:opacity .15s ease-in-out}@media (pointer:coarse){.wallet__menu{opacity:1}}.wallet__row{align-items:center;display:flex;flex:1}.wallet__row__seperator{background-color:var(--dynamic-base-4);height:.5rem;margin:0 .5rem;width:.0625rem}.wallet__icon-container{margin-right:.375rem}.wallet__ens-name{max-width:9.375rem}.wallet__actions{max-height:0;overflow:hidden;transition:max-height .3s ease-in-out}.wallet__actions__expanded{max-height:6.25rem}.wallet__actions__inner{padding-top:.75rem}.dynamic-widget-footer{border-bottom-left-radius:var(--dynamic-border-radius);border-bottom-right-radius:var(--dynamic-border-radius);border-top:.0625rem solid var(--dynamic-base-4);color:var(--dynamic-text-primary);display:flex;gap:.5rem;margin-top:auto;padding:1rem 1.5rem}.dynamic-widget-footer__button:hover:enabled svg{color:var(--dynamic-text-secondary)}.dynamic-widget-footer__button svg{color:var(--dynamic-text-tertiary)}.dynamic-widget-footer__button-align-right{margin-left:auto}@media (pointer:coarse){.dynamic-widget-footer{border-bottom-left-radius:unset;border-bottom-right-radius:unset}}.wallet-icon-with-status__container{position:relative}.wallet-icon-with-status__dot-container{align-items:center;background-color:var(--dynamic-base-1);border-radius:100%;bottom:0;display:flex;height:.75rem;justify-content:center;position:absolute;right:0;width:.75rem}.wallet-icon-with-status__dot-container .dot{background-color:var(--dynamic-error-1);border-radius:100%;bottom:0;height:.5rem;right:0;width:.5rem}.wallet-icon-with-status__dot-container .dot--green{background-color:var(--dynamic-success-1)}.wallet-icon-with-status__dot-container--secondary{bottom:0;height:.625rem;right:0;transform:translate(25%,25%);width:.625rem}.wallet-icon-with-status__dot-container--secondary .dot{height:.375rem;width:.375rem}.wallet-icon-with-network__container{position:relative}.wallet-icon-with-network__network-container{align-items:center;background-color:var(--dynamic-base-1);border-radius:100%;bottom:-.1875rem;display:flex;height:.75rem;justify-content:center;position:absolute;right:-.1875rem;width:.75rem}.dots-menu-dropdown__container{padding:.375rem 0}.dots-menu-dropdown__item{align-items:center;cursor:pointer;display:flex;font-size:var(--dynamic-text-size-body-small);gap:.5rem;padding:.5rem .75rem;width:100%}.dots-menu-dropdown__item .typography{white-space:nowrap}.dots-menu-dropdown__item__end-slot{position:absolute;right:.75rem}.dots-menu-dropdown__item:hover{background-color:var(--dynamic-hover)}.dots-menu-dropdown__item:hover .typography{color:var(--dynamic-text-primary)}@media (pointer:coarse){.dots-menu-dropdown__item{font-size:var(--dynamic-text-size-body-normal)}}.dots-menu-dropdown__item-text{align-items:center;display:flex;gap:.5rem}@keyframes desktop-dropdown-entering-animation{0%{opacity:0;transform:scale(.8) translateY(0)}70%{transform:scale(1) translateY(0)}to{opacity:1;transform:scale(1) translateY(0)}}@keyframes desktop-dropdown-exiting-animation{0%{opacity:1;transform:scale(1) translateY(0)}25%{opacity:1}50%{transform:scale(1.01) translateY(0)}to{opacity:0;transform:scale(1.02) translateY(1.875rem)}}@keyframes mobile-dropdown-entering-animation{0%{opacity:0;transform:translateY(100%)}to{opacity:1;transform:translateY(0)}}@keyframes mobile-dropdown-exiting-animation{0%{transform:translateY(0)}50%{transform:translateY(0)}to{transform:translateY(200%)}}.dots-menu-wrapper{position:relative}.dots-menu-wrapper__container--entering{animation-fill-mode:both;animation-iteration-count:1;animation-name:desktop-dropdown-entering-animation;animation-timing-function:ease-out}@media (pointer:coarse){.dots-menu-wrapper__container--entering{animation-fill-mode:both;animation-iteration-count:1;animation-name:mobile-dropdown-entering-animation;animation-timing-function:ease-out}}.dots-menu-wrapper__container--exiting{animation-fill-mode:both;animation-iteration-count:1;animation-name:desktop-dropdown-exiting-animation;animation-timing-function:ease-out}@media (pointer:coarse){.dots-menu-wrapper__container--exiting{animation-fill-mode:both;animation-iteration-count:1;animation-name:mobile-dropdown-exiting-animation;animation-timing-function:ease-out}}.dots-menu-wrapper__container{background-color:var(--dynamic-base-2);border:.0625rem solid var(--dynamic-base-4);border-radius:calc(var(--dynamic-border-radius)/3);box-shadow:0 .5rem .75rem -.375rem rgba(24,39,75,.06),0 .5rem .75rem -.1875rem rgba(24,39,75,.06);margin-top:.5rem;position:absolute;right:0;z-index:2147483647}.dots-menu-wrapper__container__alignment__top{bottom:1.375rem}.dots-menu-wrapper__container__alignment__bottom{top:1.375rem}@media (min-width:768px){.dots-menu-wrapper__container{min-width:9.375rem}}@media (pointer:coarse){.dots-menu-wrapper__container{border:none;border-radius:var(--dynamic-border-radius);border-bottom-left-radius:0;border-bottom-right-radius:0;bottom:0;left:calc(50% - 18.75rem);margin:auto;max-width:37.5rem;padding-bottom:2rem;padding-top:0;position:fixed;right:calc(50% - 18.75rem);top:unset;width:100%}}.dots-menu-wrapper__header{display:none;padding:.75rem 1.5rem .25rem}@media (pointer:coarse){.dots-menu-wrapper__header{align-items:center;display:flex;justify-content:space-between}}.dots-menu-wrapper__header__icon{min-height:1.5rem;min-width:1.5rem}.dots-menu-wrapper__backdrop{cursor:default;display:none;height:100%;left:0;position:fixed;top:0;width:100%;z-index:10}@media (pointer:coarse){.dots-menu-wrapper__backdrop{background-color:var(--dynamic-overlay);display:block}}.dynamic-widget-wallets-header{display:flex;flex-direction:row;justify-content:space-between;margin:0 1.5rem}.dynamic-widget-wallets-header__title{margin:0 0 .5rem}.dynamic-widget-wallets-header__add_wallet{display:flex;margin:0 0 .5rem}.dynamic-widget-wallets{margin:0 1.5rem;overflow:auto}.dynamic-widget-wallets__body{display:flex;flex-direction:column;gap:1rem}.dynamic-widget-wallets__body__wallet-list{max-height:13rem}.widget-portal{background-color:var(--dynamic-overlay);top:0;z-index:50}.widget-portal,.widget-portal__container{border-radius:calc(var(--dynamic-border-radius)/1.5);bottom:0;left:0;position:absolute;right:0}.widget-portal__container{background-color:var(--dynamic-base-1);border-top:.0625rem solid var(--dynamic-base-4);padding:1.5rem}@media (pointer:coarse){.widget-portal__container{border-bottom-left-radius:0;border-bottom-right-radius:0}}.widget-portal__container--no-padding{padding:0}.widget-portal__container__header{position:relative}.widget-portal__container__close-button{position:absolute;right:0}.single-wallet-buttons{display:flex;gap:.625rem;padding:0 1.5rem 1.5rem}.single-wallet-buttons--center{align-items:center;display:flex;justify-content:center}.single-wallet-buttons__copied{align-items:center;display:flex;gap:8px}.single-wallet-buttons__copied svg{color:var(--dynamic-success-1)}.email-connector-pending-sign-modal-content{align-items:center;display:flex;flex-direction:column;text-align:center;width:100%}.email-connector-pending-sign-modal-content__body{align-items:center;display:flex;flex-direction:column;gap:.5rem}.active-wallet-information{border-bottom:1px solid var(--dynamic-base-3);display:flex;flex-flow:column;gap:.5rem;padding:.75rem}.active-wallet-information__header{display:flex;gap:.5rem}.active-wallet-information__handle{max-width:80px;overflow:hidden;text-overflow:ellipsis}.active-wallet-information__handle--full-width{max-width:230px;overflow:hidden;text-overflow:ellipsis}.active-wallet-information__dots-menu{color:var(--dynamic-text-tertiary);margin-left:.375rem}.active-wallet-information__dots-menu .icon-with-status__container{margin-bottom:0}.active-wallet-information__dots-menu .icon-with-status__container .status-dot__container{right:-.05rem;top:-.05rem}.active-wallet-information-container{background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2)}.active-wallet-information__details{display:flex;flex:1;gap:.5rem;justify-content:space-between;overflow:hidden}.active-wallet-information__avatar img{height:2rem;min-height:2rem;min-width:2rem;width:2rem}.active-wallet-information__avatar__name-service{align-items:center;border-radius:100%;display:flex;overflow:hidden}.active-wallet-information__addresses-container{display:flex;flex-direction:column;gap:.5rem}.active-wallet-information__addresses-container--centered{justify-content:center}.active-wallet-information__address-container{display:flex}.active-wallet-information__address{align-items:center;display:flex}.active-wallet-information__address-skeleton{width:60px}.active-wallet-information__network-picker{overflow:hidden}.active-wallet-information__network-picker-button{border:1px solid var(--dynamic-base-4);height:100%;position:relative;transform:translateX(0)}.active-wallet-information__network-picker-button:hover{background:var(--dynamic-hover)}.balance-header{justify-content:space-between;padding:1rem .75rem;width:100%}.balance-header,.balance-header__title{align-items:center;display:flex}.balance-header__chevron{rotate:180deg}.balance-header__skeleton{display:table-cell;width:2.5rem}.balance-container{align-items:center;display:flex;justify-content:space-between;padding:1rem .75rem;position:relative}.balance-container__skeleton{display:table-cell;width:2.5rem}.multi-asset-balance-container{align-items:center;position:relative}.multi-asset-balance-container .shadow{border-bottom:1px solid var(--dynamic-base-3)}.multi-asset-balance-container__accordion{overflow-y:auto}.multi-asset-balance-container__accordion--collapsed{max-height:0!important}.multi-asset-balance-container__accordion--expanded{height:100%!important;max-height:11.25rem!important}.prompt-modal{padding:1.5rem}.prompt-modal__header{position:relative;width:100%}.prompt-modal__close-button{position:absolute;right:1rem;top:1rem}.balance-skeleton{display:table-cell;width:1.875rem}.token-balance-item{justify-content:space-between;padding:8px 0;width:100%}.token-balance-item,.token-balance-item__name{align-items:center;display:flex}.token-balance-item__title{max-width:8.4375rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.token-balance-item__icon,.token-balance-item__skeleton-icon{border-radius:100%;height:20px;margin-right:6px;overflow:hidden;width:20px}.token-balance-item__skeleton-icon{background-color:var(--dynamic-base-3)}.token-balance-item__value,.token-balance-item__value__balance{display:flex}.token-balance-list{padding:0 .75rem .75rem}.token-balance-list__empty{align-items:center;display:flex;justify-content:center;padding:.625rem}.token-balance-list__divider{padding:0}.footer-options-switcher__container{background-color:var(--dynamic-base-2);border-bottom-left-radius:var(--dynamic-border-radius);border-bottom-right-radius:var(--dynamic-border-radius);display:flex;justify-content:space-around;margin-top:auto;padding:.75rem 0}.footer-options-switcher__label{font-size:12px;margin-top:.25rem}.footer-options-switcher__tab{align-items:center;color:var(--dynamic-text-secondary);cursor:pointer;display:flex;flex-direction:column;text-align:center}.footer-options-switcher__tab--active{color:var(--dynamic-text-primary)}.dynamic-widget-index-view__email-container{display:flex;flex-direction:column;gap:1rem;text-align:center}.dynamic-widget-index-view__footer{display:flex;justify-content:space-between;width:100%}.dynamic-widget-index-view__user-profile{margin:0 0 1rem;padding:0 1.5rem}.dynamic-widget-index-view__user-profile-title{border-bottom:.0625rem solid var(--dynamic-base-4);margin:0 1.5rem .75rem;padding-bottom:.375rem}.profile-view{flex:1;overflow:auto;padding:0 1.5rem 1.5rem}.profile-view__footer{display:flex;justify-content:space-between;width:100%}.dynamic-widget-edit-profile-view{display:flex;flex:1;flex-direction:column;overflow:hidden}.dynamic-widget-edit-profile-view__fields{flex:1;overflow:auto;padding:0 1.5rem 1rem}.dynamic-widget-edit-profile-view__profile-title{border-bottom:.0625rem solid var(--dynamic-base-4);margin:0 1.5rem .75rem;padding-bottom:.375rem}.send-balance-widget-view{display:flex;flex:1;flex-direction:column;max-width:22.5rem;overflow:auto}.send-balance-widget-view__spinner{align-items:center;display:flex;flex:1;justify-content:center}.passkey-card{background:var(--dynamic-base-2);border:1px solid var(--dynamic-base-4);border-radius:.75rem;box-shadow:0 1px 2px 0 rgba(24,39,75,.04);padding:.75rem;width:100%}.passkey-card__body{display:flex;flex-direction:row;justify-content:space-between}.passkey-card__left{align-items:center;display:flex;gap:.5rem}.passkey-card__info{align-items:center;border-bottom:1px solid var(--dynamic-base-4);gap:.5rem;padding-bottom:.5rem}.passkey-card__info__icon{justify-self:start;width:1.5rem}.passkey-card__info__tooltip{display:none}@media (hover:none),(pointer:coarse){.passkey-card__info__tooltip{background-color:#555;border:1px solid;border-radius:6px;color:#fff;display:block;font-size:12px;opacity:0;padding:3px;position:absolute;transition:opacity .5s;visibility:hidden;width:-moz-fit-content;width:fit-content}.passkey-card__info__tooltip--visible{opacity:1;transition:opacity .3s;visibility:visible}}.passkey-card__date{padding-top:.5rem}.manage-passkeys-widget-view,.manage-passkeys-widget-view__body{display:flex;flex:1;flex-direction:column}.manage-passkeys-widget-view__body{gap:1rem;justify-content:space-between;padding:0 1.5rem 1.5rem}.manage-passkeys-widget-view__body__cards{display:flex;flex:1;flex-direction:column;gap:.5rem;max-height:23.75rem;overflow:auto}.manage-passkeys-widget-view__body__cards__skeleton{border-radius:.75rem;height:3.75rem}.manage-passkeys-widget-view__reveal{display:flex;flex:1;flex-direction:column;gap:.5rem}.manage-passkeys-widget-view__reveal-helper-text{color:var(--dynamic-text-secondary);font-size:.9375rem;line-height:1.25rem}.manage-passkeys-widget-view__reveal-button{border-radius:var(--dynamic-button-border-radius);justify-content:space-between}.manage-passkeys-widget-view__reveal-button__start-slot{align-items:center;display:flex;font-size:.9375rem}.manage-passkeys-widget-view__reveal-button__icon{color:var(--dynamic-text-tertiary);height:1.75rem;margin-right:.5rem}.manage-passkeys-widget-view__reveal-button__icon--rotate{color:var(--dynamic-text-tertiary);height:1rem;justify-content:end;transform:rotate(180deg)}.settings-view{display:flex;flex:1;flex-direction:column;overflow:hidden;padding:1.5rem}.settings-view__logout-button-container{bottom:60px;color:var(--dynamic-text-secondary);width:100%}.settings-view__logout-button-container__button{width:100%}.settings-view__header{align-items:center;display:flex;gap:.5rem}.settings-view__body{display:flex;flex-direction:column;gap:1rem;height:100%;margin-bottom:1.5rem;overflow-y:auto}.settings-view__body__section{display:flex;flex-direction:column;gap:.75rem}.settings-view__body__section__title{color:var(--dynamic-text-secondary);font-size:.9375rem;line-height:1.25rem}.settings-view__body__section__title__info-icon{align-items:center;display:flex;gap:5px}.settings-view__body__section__title__info-icon svg path{fill:var(--dynamic-alert-1)}.settings-view__body__section__button{border-radius:var(--dynamic-button-border-radius);justify-content:space-between}.settings-view__body__section__button__start-slot{align-items:center;display:flex;font-size:.9375rem}.settings-view__body__section__button__badge .badge__container.badge__container__secondary{margin-left:.625rem}.settings-view__body__section__button__icon{color:var(--dynamic-text-tertiary);height:1.75rem!important;margin-right:.625rem;width:1.75rem!important}.settings-view__body__section__button__icon.email{color:transparent}.settings-view__body__section__button__icon__stroke{stroke:var(--dynamic-text-tertiary);height:1.75rem;margin-right:.625rem;width:1.75rem}.settings-view__body__section__button__icon-secondary{color:var(--dynamic-text-tertiary);height:1rem;justify-content:end;width:1rem}.settings-view__body__section__button__icon-secondary--success{color:var(--dynamic-success-1);height:1rem;justify-content:end;width:1rem}.settings-view__body__section__button__icon-secondary--rotate{color:var(--dynamic-text-tertiary);height:1rem;justify-content:end;transform:rotate(180deg);width:1rem}.manage-mfa-widget-view{display:flex;flex:1;flex-direction:column;overflow:hidden}.manage-mfa-widget-view__description-container{background:var(--dynamic-base-4)}.manage-mfa-widget-view__description-container__text{margin:.625rem}.manage-mfa-widget-view__add-mfa-button-container{bottom:60px;padding:.625rem 1.5rem 1.5rem;width:100%}.manage-mfa-widget-view__add-mfa-button-container__button{width:100%}.manage-mfa-widget-view__no-devices{align-items:center;display:flex;flex-direction:column;gap:1rem;height:100%;justify-content:center;padding:1rem}.manage-mfa-widget-view__scroll-container{flex:1;overflow-y:auto;padding:.625rem 1.5rem 1.5rem}.manage-mfa-widget-view__list-tile{align-items:center;background-color:var(--dynamic-wallet-list-tile-background);border:var(--dynamic-wallet-list-tile-border);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-wallet-list-tile-shadow);color:var(--dynamic-text-primary);display:flex;flex-direction:row;gap:.625rem;margin-bottom:.625rem;padding:.625rem;width:auto}.manage-mfa-widget-view__list-tile__icon{height:1.5rem;position:relative;width:1.5rem}.manage-mfa-widget-view__list-tile__details{display:flex;flex-direction:column;flex-grow:1;justify-content:space-between;padding-right:.625rem}.manage-mfa-widget-view__list-tile__details__title{display:flex;flex-direction:row;gap:.25rem}.manage-mfa-widget-view__list-tile__dots-menu{color:var(--dynamic-text-tertiary);margin-left:.375rem}.connect-dapps-view{max-width:400px;padding:1.5rem;position:relative}.connect-dapps-view .header{align-items:center;display:flex;justify-content:space-between;margin-bottom:1rem;position:relative}.connect-dapps-view .header h1{flex-grow:1;margin:0 auto;text-align:center}.connect-dapps-view .header button{background:none;border:none;cursor:pointer;padding:.5rem;position:absolute;top:50%;transform:translateY(-50%)}.connect-dapps-view .header button:first-child{left:0}.connect-dapps-view .header button:last-child{right:0}.connect-dapps-view .scanner-wrapper{aspect-ratio:1/1;height:200px;margin-left:-24px;margin-right:-24px;overflow:hidden;position:relative;width:calc(100% + 48px)}.connect-dapps-view .scanner-wrapper video{height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.connect-dapps-view .scanner-overlay{align-items:center;bottom:0;display:flex;justify-content:center;left:0;pointer-events:none;position:absolute;right:0;top:0}.connect-dapps-view .scanner-frame{border-radius:12px;height:80%;left:50%;position:absolute;top:50%;transform:translate(-50%,-50%);width:60%}.connect-dapps-view .corner{border:4px solid #fff;height:16px;position:absolute;width:16px}.connect-dapps-view .top-left{border-bottom:none;border-right:none;border-top-left-radius:8px;left:-3px;top:-3px}.connect-dapps-view .top-right{border-bottom:none;border-left:none;border-top-right-radius:8px;right:-3px;top:-3px}.connect-dapps-view .bottom-left{border-bottom-left-radius:8px;border-right:none;border-top:none;bottom:-3px;left:-3px}.connect-dapps-view .bottom-right{border-bottom-right-radius:8px;border-left:none;border-top:none;bottom:-3px;right:-3px}.connect-dapps-view .scanner-overlay-content{align-items:center;border-radius:8px;display:flex;flex-direction:column;padding:16px;z-index:1}.connect-dapps-view .scanner-icon{height:20px;margin-bottom:2px;-o-object-fit:contain;object-fit:contain;width:20px}.connect-dapps-view .info-card,.connect-dapps-view .wallet-connect-card{margin-bottom:1rem;position:relative}.connect-dapps-view .wallet-connect-card{align-items:center;display:flex;flex-direction:column}.connect-dapps-view .wallet-connect-card h2{align-self:flex-start;margin-bottom:.5rem;width:100%}.connect-dapps-view .input-group{width:100%}.connect-dapps-view .input-suffix{transform:translateY(-20%)}.connect-dapps-view .banner{border-radius:8px;margin-top:.5rem;padding:6px;text-align:center;width:100%}.connect-dapps-view .banner.success{background-color:var(--dynamic-success-2)}.connect-dapps-view .banner.error{background-color:var(--dynamic-error-2)}.connect-dapps-view .info-card .wrapper{background:var(--dynamic-base-2);border:1px solid var(--dynamic-border-2);border-radius:16px;display:flex;flex-direction:column;padding:1.5rem;text-align:left}.connect-dapps-view .info-card .learn-more-link{align-items:center;display:flex;justify-content:center;padding:4px;pointer-events:auto;text-decoration:none}.connect-dapps-view .info-card .learn-more-link svg{cursor:pointer;height:.5rem;margin-left:.25rem;width:.5rem}.connect-dapps-view .inline-logo-text{align-items:center;display:flex;flex-wrap:nowrap}.connect-dapps-view .inline-logo-text .inline-logo{flex-shrink:0;margin:0 4px}.connected-apps-view{display:flex;flex-direction:column;gap:1rem;padding:1.5rem;position:relative}.connected-apps-view .header{align-items:center;display:flex;justify-content:space-between;padding-bottom:.25rem;position:relative}.connected-apps-view .header .title{flex-grow:1;text-align:center}.connected-apps-view .header .arrow-left-icon{transform:rotate(90deg)}.connected-apps-view .subheader{align-items:center;display:flex;flex-grow:1;justify-content:space-between;padding-bottom:.25rem;position:relative;text-align:center}.connected-apps-view .connected-apps-list{display:flex;flex-direction:column;gap:.75rem;list-style-type:none;margin:0;padding:0}.connected-apps-view .connected-app-item{align-items:center;background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);display:flex;padding:.75rem}.connected-apps-view .connected-app-item .app-icon{border-radius:50%;height:2rem;margin-right:.75rem;width:2rem}.connected-apps-view .connected-app-item .app-info{display:flex;flex:1;flex-direction:column}.connected-apps-view .connected-app-item .app-actions{display:flex;gap:.5rem;margin-left:10px}.connected-apps-view .success-message{align-items:center;background-color:var(--dynamic-success-2);border:1px solid var(--dynamic-border-1);border-radius:.5rem;display:flex;padding:.75rem;text-align:left}.connected-apps-view .success-message svg{color:#30a67b;flex-shrink:0;height:1.5rem;margin-right:.75rem;width:1.5rem}.default-prompt-modal{align-items:center;display:flex;flex-direction:column;text-align:center}.default-prompt-modal__icon-with-spinner{margin:0 auto .75rem}.default-prompt-modal__content{flex-direction:column;width:100%}.default-prompt-modal__button .typography,.default-prompt-modal__content{align-items:center;display:flex;gap:.375rem;justify-content:center}.detected-new-wallet-modal__content{align-items:center;display:flex;flex-direction:column;gap:.75rem;text-align:center}.detected-new-wallet-modal__top-section{align-items:center;display:flex;flex-direction:column;gap:1.125rem;text-align:center}.no-qr-code-not-installed-modal-view{align-items:center;display:flex;flex-direction:column;gap:1rem}.no-qr-code-not-installed-modal-view__links-section{width:100%}.qr-code-modal-view{display:flex;flex-direction:column;gap:.5rem}.qr-code-modal-view__title{text-align:center}.qr-code-modal-view .qrcode__container{height:10.9375rem;width:10.9375rem}.qr-code-modal-view__container{align-items:center;display:flex;justify-content:center}.qr-code-modal-view__wrapper{background:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)*3/4);padding:.5rem}.qr-code-modal-view .info-item{margin-bottom:.75rem}.qr-code-modal-view .info-item__text{font-size:var(--dynamic-text-size-body-small)}.qr-code-modal-view .info-item svg path{fill:var(--dynamic-text-secondary)}.qr-code-modal-view .button__container{flex-direction:column}.qr-code-modal-view .button__container,.qr-code-modal-view .button__container span{align-items:center;display:flex;gap:.375rem}.unlink-wallet-popup__container{align-items:center;display:flex;flex-direction:column;width:100%}.unlink-wallet-popup__button,.unlink-wallet-popup__label,.unlink-wallet-popup__title{text-align:center}.unlink-wallet-popup__title{padding-bottom:.5rem}.unlink-wallet-popup__label{padding-bottom:.5rem;padding-top:.5rem}.unlink-wallet-popup__button{margin-top:.5rem}.unlink-wallet-popup__button--shadow{box-shadow:var(--dynamic-shadow-down-1)}.dynamic-widget__container{z-index:2147483646}.fund-wallet__backdrop{-webkit-backdrop-filter:blur(4px);backdrop-filter:blur(4px);background-color:rgba(0,0,0,.25);inset:0;position:fixed;z-index:2147483645}.fund-wallet__modal-container{align-items:center;display:flex;inset:0;justify-content:center;overflow-y:auto;padding:1rem;position:fixed;z-index:2147483646}@media (pointer:coarse){.fund-wallet__modal-container{padding:0}}.fund-wallet__modal{border-radius:1.5rem;margin:auto;max-width:470px;overflow:hidden;width:100%}@media (pointer:coarse){.fund-wallet__modal{border-bottom-left-radius:0;border-bottom-right-radius:0;margin:initial;margin-top:auto}}.fund-wallet__modal-content{text-align:center}#onramp-iframe{border:none;height:635px;width:100%;z-index:2147483647}.embedded-widget{max-width:100%;width:var(--dynamic-modal-width)}.embedded-widget--background-default,.embedded-widget--background-none{background:none}.dynamic-bridge-user-profile__switcher{margin:0 0 1rem;padding:1.5rem 1.5rem 0}.dynamic-bridge-wallet-card__network{margin:0 0 .5rem}.dynamic-bridge-wallet-card__network,.dynamic-bridge-wallet-card__network-icon,.dynamic-bridge-wallet-card__network-name{display:inline-block;vertical-align:middle}.dynamic-bridge-wallet-card__network-icon{height:1rem;margin-right:.375rem;width:1rem}.dynamic-bridge-widget-empty-card{background-color:var(--dynamic-base-2);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);padding:.75rem;transition:transform .1s linear}.dynamic-bridge-widget-empty-card:active{transform:scale(.98)}.dynamic-bridge-widget-empty-card__icon{display:inline-flex;height:1.75rem;margin-right:.63rem;vertical-align:middle;width:1.75rem}.dynamic-bridge-widget-empty-card__text{overflow:hidden;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.dynamic-bridge-widget-wallets-view{display:flex;flex-direction:column;gap:1rem;padding:1.5rem}.dynamic-bridge-widget-wallets-view__logout-button{margin:0 auto}.dynamic-bridge-widget-wallets-view__unlink-button{color:var(--dynamic-text-secondary);margin:auto 0 0 auto}.footer-buttons-item{align-items:center;background:var(--dynamic-base-2);border:0;border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);cursor:pointer;display:flex;padding:.75rem;transition:all .3s;width:100%}.footer-buttons-item__icon--left{margin-right:.625rem}.footer-buttons-item__icon--left img,.footer-buttons-item__icon--left svg{height:1.25rem;width:1.25rem}.new-to-web3-buttons__container{margin-top:1rem}.new-to-web3-buttons__container button{background:var(--dynamic-brand-primary-color);border-radius:calc(var(--dynamic-border-radius)/2);box-shadow:var(--dynamic-shadow-down-1);color:#fff;padding:.75rem;width:100%}.walletlist-help-content__container{color:var(--dynamic-text-secondary);padding:1.5rem}.walletlist-help-content__icon{align-items:center;display:flex;height:3.5rem;justify-content:center;margin:0 auto;width:3.5rem}.walletlist-help-content__typography-wrapper{color:var(--dynamic-text-primary);margin:1rem 0;text-align:center}.walletlist-help-content__typography-wrapper .walletlist-help-content__typography--label{margin-top:.375rem}.walletlist-help-content__buttons-wrapper{display:flex;flex-direction:column;gap:.375rem;margin-top:1rem}.walletlist-help-content__buttons-wrapper button{text-align:left;width:100%}.walletlist-help-content__custodial-wallet-area--title{margin:.75rem 0;text-align:center}.footer-more-info-content__wrapper{display:flex;flex-direction:column;gap:.75rem;padding:1.5rem}.footer-more-info-content__item--phantom-ledger{font-size:.6875rem;margin-bottom:.5rem}.footer-more-info-content__item--phantom-ledger p{margin-bottom:.5rem}.footer-more-info-content__item--phantom-ledger p:last-child,.footer-more-info-content__item:last-child{margin-bottom:0}.back-button{rotate:-90deg}.help-header{border-bottom:1px solid var(--dynamic-base-4)}.passkey-info-help-content__container{color:var(--dynamic-text-secondary);padding:1.5rem}.passkey-info-help-content__typography-wrapper{color:var(--dynamic-text-primary);display:flex;flex-direction:column;gap:1rem;text-align:left}.passkey-info-help-content__wrapper{flex:1}.passkey-info-help-content__details{display:flex;flex-direction:row;gap:1rem}.header__skeleton{width:7.5rem}.header__typography{margin:0;text-align:center}.header__typography img,.header__typography svg{display:inline-block}.header__tooltip{background-color:var(--dynamic-text-primary);color:var(--dynamic-base-2);font-size:.75rem}.header__icon svg{height:1.5rem;width:1.5rem}.tos-and-pp__footer{background:var(--dynamic-footer-background);border-top:var(--dynamic-footer-border-top);bottom:0;padding:var(--dynamic-footer-padding);position:relative;width:100%}.default-footer__footer{background:var(--dynamic-base-1);border-top:.0625rem solid var(--dynamic-base-4);box-shadow:var(--dynamic-shadow-up-1);height:var(--dynamic-border-radius);opacity:1;text-align:center;transition:opacity .15s,visibility .15s;visibility:visible;width:100%}.default-footer__footer--hidden{opacity:0;transition:opacity .15s,visibility .15s;visibility:hidden}.wallet-progress-stepper{padding:.5rem 1rem}.dynamic-user-profile-layout{display:flex;flex-direction:column;height:33.125rem;overflow:hidden}.dynamic-user-profile-layout--unset-max-height{height:unset}input:-webkit-autofill,input:-webkit-autofill:active,input:-webkit-autofill:focus,input:-webkit-autofill:hover{box-shadow:unset!important}.dynamic-modal{display:flex;flex-direction:column-reverse;left:50%;letter-spacing:0;position:absolute}.dynamic-shadow-dom-content{font-family:var(--dynamic-font-family-primary)}';const LegacySafariCssOverrides=()=>jsxRuntimeExports.jsx("link",{rel:"stylesheet",href:"https://app.dynamic.xyz/assets/legacySafari/styles.css"}),isShadowDOMFlagEnabled=()=>{if(isSSR())return!1;const fr="shadowDOM.enabled",br=new URLSearchParams(window.location.search);return br.has(fr)?br.get(fr)==="true":!0},ShadowDOMContext=t$7.createContext({}),useShadowDOMContext=()=>t$7.useContext(ShadowDOMContext),ShadowDOMStyle=()=>jsxRuntimeExports.jsx("style",{children:css_248z$1}),ShadowDOM=({mode:fr="open",id:br,className:wr,children:Er,dataTestId:kr,zIndex:jr})=>{const{shadowDOMEnabled:Br,cssOverrides:Wr}=useInternalDynamicContext(),Gr=isShadowDOMFlagEnabled()&&Br,[Vr,Zr]=reactExports.useState(null),[Jr,Qr]=reactExports.useState(),_n=reactExports.useMemo(()=>Wr&&typeof Wr!="string"?()=>Wr:Wr&&typeof Wr=="string"?()=>jsxRuntimeExports.jsx("style",{children:Wr}):null,[Wr]);reactExports.useLayoutEffect(()=>{if(Vr&&Gr)try{const Cn=Vr.attachShadow({mode:fr});Qr(Cn)}catch{}},[Gr,Vr,fr]);const En=!!Object.keys(css_248z$1).length;return Gr?jsxRuntimeExports.jsx(IsBrowser,{children:jsxRuntimeExports.jsx(ShadowDOMContext.Provider,{value:{shadowRoot:Jr},children:jsxRuntimeExports.jsx("div",{"data-testid":kr,ref:Zr,id:br,className:classNames$1("dynamic-shadow-dom",wr),style:{zIndex:jr},children:Jr&&reactDomExports.createPortal(jsxRuntimeExports.jsxs("div",{className:"dynamic-shadow-dom-content",children:[Er,En&&jsxRuntimeExports.jsx(ShadowDOMStyle,{}),isLegacySafari()&&jsxRuntimeExports.jsx(LegacySafariCssOverrides,{}),_n&&jsxRuntimeExports.jsx(_n,{})]}),Jr)})})}):jsxRuntimeExports.jsx(IsBrowser,{children:jsxRuntimeExports.jsxs("div",{"data-testid":kr,ref:Zr,id:br,className:classNames$1("dynamic-shadow-dom",wr),style:{zIndex:jr},children:[Er,En&&jsxRuntimeExports.jsx(ShadowDOMStyle,{}),isLegacySafari()&&jsxRuntimeExports.jsx(LegacySafariCssOverrides,{}),_n&&jsxRuntimeExports.jsx(_n,{})]})})},useUserDataForm=({onSubmit:fr,onError:br,userProfile:wr,shouldEnforcePolicies:Er=!0,fields:kr})=>{var jr;const{mockedSDK:Br}=useMockContext(),[Wr,qr]=reactExports.useState(!1),{fieldsConfig:Gr}=useFields(),Vr=Er&&((jr=kr.find(En=>En.name==="policiesConsent"))===null||jr===void 0?void 0:jr.enabled),Zr=En=>`${En.charAt(0).toUpperCase()+En.slice(1)} is required`,Jr=reactExports.useMemo(()=>create$5().shape(Object.fromEntries(kr.map(({name:En,required:Cn,type:In,validationType:An,validationRules:jn})=>{let eo=In===KycFieldType.Custom?getValueByKey(customFieldValidationMap,An):getValueByKey(Gr,En).validation;return In===KycFieldType.Custom&&jn&&(An===CustomFieldType.Select||An===CustomFieldType.Text)&&(eo=eo,jn.validOptions?eo=eo.oneOf(jn.validOptions.map(ro=>ro.label),"Select a valid option"):jn.regex&&(eo=eo.matches(new RegExp(jn.regex),"Invalid field format"))),[En,Cn?eo.required(Zr(En)):eo]}))),[kr]),Qr=reactExports.useMemo(()=>Object.fromEntries(kr.map(({name:En,type:Cn,validationRules:In,validationType:An})=>{var jn,eo,ro,to;const _i=wr??{};if(Cn===KycFieldType.Custom){let co="";return An===CustomFieldType.Select&&(In!=null&&In.validOptions)&&(co=(jn=In.validOptions[0].label)!==null&&jn!==void 0?jn:""),[En,(()=>{var so;const no=_i.metadata?getValueByKey(_i.metadata,En):void 0;return Array.isArray(no)?no:(so=no==null?void 0:no.toString())!==null&&so!==void 0?so:co})()]}const io=(eo={country:countryCodes[0].code,policiesConsent:!1,tShirtSize:tShirtSizes[0],team:teamNames[0]}[En])!==null&&eo!==void 0?eo:"";return[En,(to=(ro=getValueByKey(_i,En))===null||ro===void 0?void 0:ro.toString())!==null&&to!==void 0?to:io]}))||{},[kr,wr]),_n=reactExports.useCallback((En,Cn)=>__awaiter$e(void 0,void 0,void 0,function*(){const In={},An={};if(!Br)try{if(!(wr!=null&&wr.environmentId))throw new DynamicError("Invalid environment ID");qr(!0);let jn=En;Object.entries(jn).forEach(([eo,ro])=>{const to=kr.find(_i=>_i.name===eo&&_i.type===KycFieldType.Custom);to&&(In[eo]=ro,delete jn[eo],to.unique&&(An[eo]=ro))}),Object.keys(In).length>0&&(jn.metadata=In),Vr&&(jn=Object.assign(Object.assign({},jn),{policiesConsent:!0}),delete jn.policiesConsentArray),yield fr==null?void 0:fr(jn)}catch(jn){logger$6.error(jn),br==null||br(jn),jn instanceof EmailAlreadyExistsError?Cn.setErrors({email:"Email already exists"}):jn instanceof CustomFieldNotUniqueError?Cn.setFormikState(eo=>Object.assign(Object.assign({},eo),{errors:Object.fromEntries(Object.entries(An).map(([ro])=>[ro,Object.entries(An).length>1?"One or more fields are already tied to another user":`${ro} is already tied to another user`])),touched:Object.fromEntries(Object.entries(An).map(([ro])=>[ro,!0])),values:Object.assign(Object.assign({},Qr),An)})):jn instanceof TooManyEmailVerificationsError?Cn.setErrors({email:"Too many email verification attempts."}):jn instanceof UsernameAlreadyExistsError?Cn.setErrors({username:"Username already exists"}):jn instanceof InvalidPhoneNumberError?Cn.setErrors({phoneNumber:jn.message}):Cn.setErrors({api:"Something went wrong. Please try again."})}finally{qr(!1)}}),[Br,wr==null?void 0:wr.environmentId,Vr,fr,kr,br,Qr]);return{enforcePolicies:Vr,fetch:Wr,formikInitialValues:Qr,formikValidationSchema:Jr,onFormSubmit:_n}},getSupportedCountriesForVerificationFromProjectSettings=fr=>{var br,wr;const Er=getProviderByType((br=fr==null?void 0:fr.providers)!==null&&br!==void 0?br:[],ProviderEnum.Sms);return((wr=Er==null?void 0:Er.enabledCountries)!==null&&wr!==void 0?wr:[]).map(kr=>kr.isoCountryCode.toLowerCase())},defaultCountries=["us","ca"],getDefaultCountriesIfEmpty=fr=>fr.length?fr:defaultCountries,useThrottle=(fr,br)=>{const wr=reactExports.useRef(!1),Er=reactExports.useRef(fr);return Er.current=fr,reactExports.useCallback((...kr)=>{wr.current||(Er.current(...kr),wr.current=!0,setTimeout(()=>wr.current=!1,br))},[br])},modulo=(fr,br)=>(fr%br+br)%br,parseDefaultCountry=({defaultIso2:fr,countries:br,initialPhone:wr})=>{if(wr){const{country:qr}=X$4({countries:br,phone:wr});if(qr)return qr}const Er=br.map(M$3),kr=StorageService.getItem(PHONE_INPUT_DEFAULT_COUNTRY),jr=Er.find(({iso2:qr})=>qr===kr);if(jr)return jr;const Br=Er.find(({iso2:qr})=>qr===fr);if(Br)return Br;const Wr=Er.find(({iso2:qr})=>qr==="us");if(Wr)return Wr;if(Er[0])return Er[0];throw new Error("No country list was provided")},MENU_DISPLAY_THROTTLE=50,COUNTRY_INPUT_SCROLL_DELAY=20,usePhoneInputLogic=({countryInputRef:fr,setCountryDropdownOpen:br,setInvalidNumberMessage:wr,onUpdate:Er,initialPhone:kr,countries:jr,defaultIso2:Br})=>{const Wr=reactExports.useRef(Er);Wr.current=Er;const qr=reactExports.useMemo(()=>parseDefaultCountry({countries:jr,defaultIso2:Br,initialPhone:kr}),[jr,Br,kr]),{inputValue:Gr,phone:Vr,country:Zr,setCountry:Jr,handlePhoneValueChange:Qr,inputRef:_n}=ee$3({countries:jr,defaultCountry:qr.iso2,disableDialCodeAndPrefix:!0,value:kr}),[En,Cn]=reactExports.useState(qr.dialCode),In=reactExports.useMemo(()=>Vr.length===("+"+Zr.dialCode).length?"":Vr,[Zr.dialCode,Vr]);reactExports.useEffect(()=>{var On;(On=Wr.current)===null||On===void 0||On.call(Wr,{country:Zr,formattedPhone:Gr,phone:In})},[Zr.iso2,Gr,In]);const[An,jn]=reactExports.useState(""),eo=reactExports.useMemo(()=>An?isNaN(parseInt(An))?jr.filter(On=>{const{name:Zn,iso2:Nn}=M$3(On);return Zn.toLowerCase().includes(An.toLowerCase())||Nn===An.toLowerCase()||Zr.iso2===Nn}):jr.filter(On=>{const{dialCode:Zn,iso2:Nn}=M$3(On);return Zn.includes(An)||Zr.iso2===Nn}):jr,[jr,Zr.iso2,An]),ro=()=>{jn(""),br(!0)},to=reactExports.useCallback(()=>{br(!1)},[br]),_i=reactExports.useRef(qr),oo=({target:On})=>{const Zn=On.value.slice(0,4);Cn(Zn),jn(Zn);const{country:Nn}=X$4({countries:jr,currentCountryIso2:Zr.iso2,phone:Zn});Nn&&(_i.current=Nn,Jr(Nn.iso2),StorageService.setItem(PHONE_INPUT_DEFAULT_COUNTRY,Nn.iso2),setTimeout(()=>Xr(Nn.iso2),COUNTRY_INPUT_SCROLL_DELAY))},io=()=>{!_i.current||En===_i.current.dialCode||(Jr(_i.current.iso2),StorageService.setItem(PHONE_INPUT_DEFAULT_COUNTRY,_i.current.iso2),Cn(_i.current.dialCode),wr(void 0))},co=reactExports.useCallback(On=>{On.preventDefault();const Zn=eo.findIndex(zn=>M$3(zn).iso2===Zr.iso2),Nn=On.key==="ArrowUp"?-1:1,wn=M$3(eo[modulo(Zn+Nn,eo.length)]);Xr(wn.iso2),Cn(wn.dialCode),Jr(wn.iso2),_i.current=wn,StorageService.setItem(PHONE_INPUT_DEFAULT_COUNTRY,wn.iso2),wr(void 0)},[Zr.iso2,eo,wr,Jr]),so=reactExports.useCallback(()=>{var On;to(),(On=_n.current)===null||On===void 0||On.select()},[to,_n]),no=reactExports.useCallback(On=>{if(On.key==="Tab")return to();if(On.key==="ArrowUp"||On.key==="ArrowDown")return co(On);if(On.key==="Enter")return so(On)},[to,co,so]),Tn=reactExports.useMemo(()=>de$3({charAfterDialCode:"+",dialCode:Zr.dialCode,phone:Vr}).length>0,[Zr.dialCode,Vr]),Hr=reactExports.useRef(null),Xr=On=>{var Zn;const Nn=(Zn=Hr.current)===null||Zn===void 0?void 0:Zn.querySelector("#"+On);Nn==null||Nn.scrollIntoView({behavior:"instant",block:"center",inline:"center"})},Sn=useThrottle(On=>{var Zn;const Nn=!!Hr.current,wn=!!On;Hr.current=On,!(Nn||!wn)&&((Zn=fr.current)===null||Zn===void 0||Zn.select(),Xr(Zr.iso2))},MENU_DISPLAY_THROTTLE),Rn=On=>{Cn(On.dialCode),Jr(On.iso2),StorageService.setItem(PHONE_INPUT_DEFAULT_COUNTRY,On.iso2),_i.current=On,wr(void 0)},Pn=reactExports.useMemo(()=>En.length>3?"var(--dynamic-text-size-body-mini)":En.length>2?"var(--dynamic-text-size-body-small)":"var(--dynamic-text-size-body-normal)",[En.length]);return{closeDropdown:to,countryFontSize:Pn,countryInput:En,currentCountry:Zr,filteredCountries:eo,formattedPhone:Gr,handleCountryInput:oo,handleCountryKeyDown:no,handlePhoneInput:Qr,hasInput:Tn,inputRef:_n,onBlurCountry:io,onFocusCountry:ro,onMenuDisplayToggle:Sn,openDropdown:ro,setCountry:Rn}},PhoneNumberField=({isLoading:fr,disabled:br,error:wr,label:Er,onUpdate:kr,appendRight:jr,setIsFocused:Br,setIsHovered:Wr,initialPhone:qr,onBlur:Gr,countries:Vr})=>{const{t:Zr}=useTranslation(),Jr=reactExports.useRef(null),[Qr,_n]=reactExports.useState(!1),En=reactExports.useRef(null),{defaultPhoneInputIso2:Cn}=useInternalDynamicContext(),[In,An]=reactExports.useState(void 0),{formattedPhone:jn,currentCountry:eo,handleCountryInput:ro,handlePhoneInput:to,hasInput:_i,inputRef:oo,countryInput:io,onBlurCountry:co,filteredCountries:so,openDropdown:no,handleCountryKeyDown:Tn,closeDropdown:Hr,setCountry:Xr,onMenuDisplayToggle:Sn,onFocusCountry:Rn,countryFontSize:Pn}=usePhoneInputLogic({countries:Vr,countryInputRef:Jr,defaultIso2:Cn,initialPhone:qr,onUpdate:kr,setCountryDropdownOpen:_n,setInvalidNumberMessage:An});return jsxRuntimeExports.jsxs("div",{className:"phone-number-field",children:[jsxRuntimeExports.jsxs("div",{className:"phone-number-field__fields",onPointerEnter:()=>Wr==null?void 0:Wr(!0),onPointerLeave:()=>Wr==null?void 0:Wr(!1),onFocus:()=>Br==null?void 0:Br(!0),onBlur:On=>{Br==null||Br(!1),Gr==null||Gr(On)},ref:En,children:[jsxRuntimeExports.jsxs("div",{className:classNames$1("phone-number-field__fields__country-code",{"phone-number-field__fields__country-code--disabled":fr||br}),onClick:no,"data-testid":"country-code",children:[jsxRuntimeExports.jsx(q$4,{iso2:eo.iso2,size:"24px",className:"phone-number-field__fields__country-code__flag"}),jsxRuntimeExports.jsx(Typography,{className:"phone-number-field__fields__country-code__plus",variant:"body_normal",weight:"regular",style:{fontSize:Pn},color:"primary",children:"+"}),jsxRuntimeExports.jsx(Input,{label:"",id:"country_code_field",value:io,onChange:ro,disabled:fr||br,containerClassName:"phone-number-field__fields__country-code__container",className:"phone-number-field__fields__country-code__container__input",onBlur:co,ref:Jr,onKeyDown:Tn,onFocus:Rn,style:{fontSize:Pn},"data-testid":"country-code-input",inputMode:"numeric",autoComplete:"tel-country-code"}),jsxRuntimeExports.jsx(Icon,{className:"phone-number-field__fields__country-code__chevron",children:jsxRuntimeExports.jsx(SvgChevronDown,{})})]}),jsxRuntimeExports.jsx(Input,{label:"",id:"phoneNumber",value:jn,onChange:to,disabled:fr||br,containerClassName:"phone-number-field__fields__phone-number",className:"phone-number-field__fields__phone-number__input",ref:oo,error:!!(In||wr),inputMode:"numeric","data-testid":"phone_number_input",autoComplete:"tel-national"}),!_i&&jsxRuntimeExports.jsx(Typography,{className:"phone-number-field__fields__placeholder",variant:"body_normal",weight:"regular",copykey:"dyn_collect_user_data.fields.phone_number.label",children:Er??Zr("dyn_collect_user_data.fields.phone_number.label")}),jr]}),jsxRuntimeExports.jsx(MenuList,{isOpen:Qr,onClickClose:Hr,popperProps:{anchorOrigin:"bottom-left",anchorRef:En},mobileTitle:"Select country",dropdownClassName:"phone-number-field__dropdown",children:jsxRuntimeExports.jsx("div",{className:"phone-number-field__dropdown__items",ref:Sn,children:so.map(On=>{const Zn=M$3(On),{iso2:Nn,name:wn,dialCode:zn}=Zn,fo=Nn===eo.iso2;return jsxRuntimeExports.jsxs("div",{className:classNames$1("phone-number-field__dropdown__items__country",{"phone-number-field__dropdown__items__country--selected":fo}),onClick:()=>{Xr(Zn),Hr()},id:Nn,children:[jsxRuntimeExports.jsx(q$4,{iso2:Nn,size:"24px"}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"primary",children:wn}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:zn})]},Nn)})})}),!!(In||wr)&&jsxRuntimeExports.jsx(Typography,{variant:"body_mini",className:"phone-number-field__error-message",children:wr??In})]})},UserPhoneField=({onChange:fr,value:br,onBlur:wr,disabled:Er,label:kr,required:jr,error:Br,name:Wr,verify:qr})=>{const{selectedPhoneCountry:Gr}=useFieldsState(),{projectSettings:Vr}=useInternalDynamicContext(),Zr=({country:Qr,phone:_n})=>{Gr.current=Qr,_n!==br&&fr({target:{name:Wr,value:_n}})},Jr=reactExports.useMemo(()=>{const Qr=getSupportedCountriesForVerificationFromProjectSettings(Vr);return getCustomCountries(qr?getDefaultCountriesIfEmpty(Qr):void 0)},[qr,Vr]);return jsxRuntimeExports.jsx(PhoneNumberField,{countries:Jr,initialPhone:br,disabled:Er,onUpdate:Zr,onBlur:wr,label:kr,appendRight:!Er&&!jr?jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",className:"user-phone-field__optional-label",children:"Optional"}):void 0,error:Br})},getDisplayErrorMessage=(fr,br)=>{var wr;if(!br)return;const Er={required:kr=>`${kr} is required`};return((wr=Er[br])===null||wr===void 0?void 0:wr.call(Er,fr))||br},Checkbox=({ariaLabel:fr,checked:br,className:wr="",defaultChecked:Er,disabled:kr,id:jr,name:Br,onChange:Wr,value:qr})=>jsxRuntimeExports.jsxs("div",{className:classNames$1("checkbox__container",wr),children:[jsxRuntimeExports.jsx("input",{type:"checkbox",id:jr,"aria-label":fr,"aria-checked":br,className:"checkbox--hidden",value:qr,checked:br,name:Br,disabled:kr,defaultChecked:Er,onChange:Gr=>!!Wr&&(Wr==null?void 0:Wr(Gr,Gr.currentTarget.value)),"data-testid":"input-checkbox"}),jsxRuntimeExports.jsx("div",{className:"checkbox--visible",children:jsxRuntimeExports.jsx(SvgCheck,{className:"checkbox__icon"})})]});var _path$O,_excluded$X=["title","titleId"];function _extends$X(){return _extends$X=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$X(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgArrowDown=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$X(br,_excluded$X);return reactExports.createElement("svg",_extends$X({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$O||(_path$O=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.862 9.529c.26-.26.682-.26.943 0L12 13.724l4.195-4.195a.667.667 0 1 1 .943.942l-4.667 4.667a.667.667 0 0 1-.942 0l-4.667-4.667a.667.667 0 0 1 0-.942Z",fill:"currentColor"})))};const getDisplayValue=fr=>{if(!fr)return;const{selectedIndex:br}=fr;if(br===void 0)return;const wr=fr.options[br];if(wr.hasAttribute("value"))return wr.text},Select=fr=>{var{children:br,className:wr="",id:Er,label:kr,value:jr,error:Br=!1,selectDataTestId:Wr,message:qr}=fr,Gr=__rest$9(fr,["children","className","id","label","value","error","selectDataTestId","message"]);const Vr=reactExports.useRef(null),[Zr,Jr]=reactExports.useState();return reactExports.useLayoutEffect(()=>{if(!jr)return;const Qr=Vr.current;Jr(getDisplayValue(Qr))},[jr,Jr]),jsxRuntimeExports.jsxs("div",{className:"select__field",children:[jsxRuntimeExports.jsxs("div",{className:classNames$1(wr,"select__container"),children:[jsxRuntimeExports.jsxs("label",{className:classNames$1("select__body",{select__error:Br,select__has_value:!!Zr}),htmlFor:Er,children:[jsxRuntimeExports.jsx("span",{className:"select__value",children:Zr||jsxRuntimeExports.jsx("span",{children:" "})}),jsxRuntimeExports.jsx("span",{className:"select__label",children:kr}),jsxRuntimeExports.jsx("div",{className:"select__control_icon",children:jsxRuntimeExports.jsx(Icon,{size:"medium",children:jsxRuntimeExports.jsx(SvgArrowDown,{})})})]}),jsxRuntimeExports.jsx("select",Object.assign({},Gr,{"data-testid":Wr,ref:Vr,id:Er,value:jr,placeholder:kr,className:"select",children:br}))]}),qr&&jsxRuntimeExports.jsx(Typography,{className:classNames$1("select__message",{select__message__error:Br}),variant:"body_mini",children:qr})]})},renderSelectField=({key:fr,name:br,label:wr,type:Er,options:kr,disabled:jr,dataTestId:Br},{errors:Wr,touched:qr})=>jsxRuntimeExports.jsx(Field$2,{copykey:fr,as:Select,type:Er,id:br,name:br,label:wr,error:!!(Wr[br]&&qr[br]),selectDataTestId:Br,message:qr[br]&&getDisplayErrorMessage(wr,Wr[br]),disabled:jr,children:kr.map(Gr=>typeof Gr=="string"?jsxRuntimeExports.jsx("option",{value:Gr,children:Gr},Gr):jsxRuntimeExports.jsx("option",{value:Gr.value,children:Gr.label},Gr.value))},br),renderCheckboxGroup=(fr,br,wr,Er,kr,jr,Br)=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("div",{role:"group","aria-labelledby":"checkbox-group",className:`user-field__checkbox-container ${kr[br]&&jr[br]?"user-field__checkbox-container--error":""}`,children:(Er==null?void 0:Er.checkboxText)&&jsxRuntimeExports.jsxs("div",{className:"user-field__consent-checkbox",children:[jsxRuntimeExports.jsx(Field$2,{as:Checkbox,id:fr,name:br,type:"checkbox",value:"0",disabled:Br,selectDataTestId:"customFieldCheckbox"},fr),jsxRuntimeExports.jsx("label",{htmlFor:fr,className:"user-field__checkbox-label",children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:Er.checkboxText})})]},fr)},"customConsentGroup"),jr[br]&&getDisplayErrorMessage(wr,kr[br])&&jsxRuntimeExports.jsx(Typography,{variant:"body_mini",className:"user-field__error-message",children:`${br.charAt(0).toUpperCase()+br.slice(1)} is required`})]}),renderPoliciesConsentGroup=(fr,br,wr)=>jsxRuntimeExports.jsx("div",{role:"group","aria-labelledby":"checkbox-group",className:"user-field__checkbox-container",children:br==null?void 0:br.map((Er,kr)=>jsxRuntimeExports.jsxs("div",{className:"user-field__consent-checkbox",children:[jsxRuntimeExports.jsx(Field$2,{copykey:fr,as:Checkbox,id:`policiesConsent_${kr}`,name:"policiesConsentArray",type:"checkbox",value:`${kr}`,disabled:wr},`policiesConsent_${kr}`),jsxRuntimeExports.jsx("label",{htmlFor:`policiesConsent_${kr}`,className:"user-field__checkbox-label",children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:Er})})]},`policiesConsent_${kr}`))},"policiesConsentGroup"),UserField=({fieldData:{validationRules:fr,isCustom:br,key:wr,label:Er,type:kr,autoComplete:jr},fieldSettings:{enabled:Br,name:Wr,required:qr,verify:Gr,label:Vr=Er},errors:Zr,touched:Jr,disabled:Qr,policiesConsentInnerComponentArray:_n})=>{if(br){if(kr===CustomFieldType.Select&&(fr!=null&&fr.validOptions)){const En=fr.validOptions.map(Cn=>Cn.label);return renderSelectField({dataTestId:"customFieldSelect",disabled:Qr,key:wr,label:Vr,name:Wr,options:En,type:kr},{errors:Zr,touched:Jr})}else if(kr===CustomFieldType.Checkbox)return renderCheckboxGroup(wr,Wr,Vr,fr,Zr,Jr,Qr)}switch(Wr){case"tShirtSize":return renderSelectField({dataTestId:"tShirtSizeSelect",disabled:Qr,key:wr,label:Vr,name:Wr,options:tShirtSizes,type:kr},{errors:Zr,touched:Jr});case"team":return renderSelectField({dataTestId:"teamSelect",disabled:Qr,key:wr,label:Vr,name:Wr,options:teamNames,type:kr},{errors:Zr,touched:Jr});case"country":return renderSelectField({dataTestId:"countrySelect",disabled:Qr,key:wr,label:Vr,name:Wr,options:countryCodes.map(En=>({label:En.name,value:En.code})),type:kr},{errors:Zr,touched:Jr});case"policiesConsent":return renderPoliciesConsentGroup(wr,_n,Qr);case"phoneNumber":return jsxRuntimeExports.jsx(Field$2,{name:Wr,as:UserPhoneField,disabled:Qr,label:Vr,required:qr,error:Jr[Wr]&&Zr[Wr]?getDisplayErrorMessage(Vr,Zr[Wr]):void 0,verify:Gr,autoComplete:jr},Wr);default:return jsxRuntimeExports.jsx(Field$2,{copykey:wr,disabled:Qr,as:Input,type:kr,id:Wr,name:Wr,label:Vr,optional:Br&&!qr,error:Zr[Wr]&&Jr[Wr],message:Jr[Wr]&&getDisplayErrorMessage(Vr,Zr[Wr]),autoComplete:jr},Wr)}},getTooltipMessageKeyForField=({enabled:fr,name:br,lockForVerification:wr})=>{if(br==="email"&&!fr)return"dyn_collect_user_data.update_email_tooltip";if(br==="phoneNumber"&&!fr)return"dyn_collect_user_data.update_phone_number_tooltip";if(wr)return"dyn_collect_user_data.lock_editing_multiple_verified_fields"},UserDataFields=({errors:fr,policiesConsentInnerComponentArray:br,fields:wr,touched:Er,currentValues:kr,disableEditingMultipleFieldsWithVerification:jr,initialValues:Br})=>{const{fieldsConfig:Wr}=useFields(),{t:qr}=useTranslation(),Gr=reactExports.useMemo(()=>Br&&kr&&wr?wr.filter(Vr=>Vr.verify&&Br[Vr.name]!==kr[Vr.name]).map(Vr=>Vr.name):[],[kr,wr,Br]);return jsxRuntimeExports.jsx("div",{className:"user-data-fields__fields-column",children:wr==null?void 0:wr.map(Vr=>{const{enabled:Zr,name:Jr,verify:Qr}=Vr,_n=jr&&Qr&&Gr.length>0&&!Gr.includes(Jr),En=!Zr||_n,Cn=getTooltipMessageKeyForField({enabled:Zr,lockForVerification:_n,name:Jr});let In;Vr.type!==KycFieldType.Custom?In=Wr[Jr]:In={isCustom:!0,key:Vr.name,label:Vr.name,type:Vr.validationType,validation:customFieldValidationMap[Vr.validationType],validationRules:Vr.validationRules};const An=jsxRuntimeExports.jsx(UserField,{disabled:!!En,errors:fr,fieldData:In,fieldSettings:Vr,touched:Er,policiesConsentInnerComponentArray:br},In.key);return Cn?jsxRuntimeExports.jsx(Tooltip$2,{content:qr(Cn),className:"user-data-fields__tooltip",copykey:Cn,children:An},In.key+"__tooltip"):An})})},UserProfileForm=({filterFields:fr,formClassName:br,fieldsContainerStyle:wr,onEditProfileSubmit:Er,onEditProfileCancel:kr,options:jr={buttonsAsFooter:!0,cancelText:"Cancel",shouldEnforcePolicies:!1,submitText:"Save"}})=>{const{projectSettings:Br,user:Wr}=useInternalDynamicContext(),qr=reactExports.useMemo(()=>{const _n=getUserProfileFields({customFields:Br==null?void 0:Br.customFields,projectSettingsKyc:Br==null?void 0:Br.kyc,user:Wr});return fr?_n.filter(({name:En})=>fr.includes(En)):_n},[fr,Br==null?void 0:Br.customFields,Br==null?void 0:Br.kyc,Wr]),{fetch:Gr,formikInitialValues:Vr,formikValidationSchema:Zr,onFormSubmit:Jr}=useUserDataForm({fields:qr,onSubmit:Er,shouldEnforcePolicies:jr.shouldEnforcePolicies,userProfile:Wr}),Qr=(_n,En,Cn)=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!jr.hideCancelButton&&jsxRuntimeExports.jsx(TypographyButton,Object.assign({disabled:Gr,expanded:!0,buttonPadding:"medium",buttonVariant:"secondary",type:"button",typographyProps:{variant:"button_secondary"},onClick:kr,dataTestId:"cancel-button"},jr.cancelButtonProps,{children:jr.cancelText})),jsxRuntimeExports.jsx(TypographyButton,Object.assign({buttonClassName:"dynamic-widget-footer__button",disabled:Gr||!En||!Cn,expanded:!0,type:"submit",buttonPadding:"medium",typographyProps:{variant:"button_secondary"},loading:_n,startSlot:jsxRuntimeExports.jsx(SvgCheck,{}),dataTestId:"submit-button"},jr.submitButtonProps,{children:jr.submitText}))]});return jsxRuntimeExports.jsx(Formik,{onSubmit:Jr,initialValues:Vr,validationSchema:Zr,validateOnChange:!0,children:({errors:_n,touched:En,isSubmitting:Cn,isValid:In,dirty:An,values:jn})=>jsxRuntimeExports.jsxs(Form,{className:classNames$1("dynamic-widget-edit-profile-view",br),"data-testid":"editUserProfileForm",children:[jsxRuntimeExports.jsx("div",{className:"dynamic-widget-edit-profile-view__fields",style:wr,children:jsxRuntimeExports.jsx(UserDataFields,{errors:_n,fields:qr,touched:En,currentValues:jn,initialValues:Vr,disableEditingMultipleFieldsWithVerification:!0})}),jr.buttonsAsFooter?jsxRuntimeExports.jsx(DynamicWidgetFooter,{children:Qr(Cn,In,An)}):Qr(Cn,In,An)]})})},splitCamelCase=fr=>fr.replace(/([a-z])([A-Z])/g,"$1 $2"),useAssignDefaultValues=(fr,br)=>{const{appName:wr,user:Er}=useInternalDynamicContext(),kr=wr?`${wr} `:"";if(fr.submitText||(fr.submitText="Update"),br.length!==1)return fr.title||(fr.title="Update your info"),fr.subtitle||(fr.subtitle=`Fill out your info for your ${kr}account`),fr;const[jr]=br,Br=splitCamelCase(jr).toLowerCase(),Wr=Er!=null&&Er[jr]?"Update":"Enter";return fr.title||(fr.title=`${Wr} your ${Br}`),fr.subtitle||(fr.subtitle=`Add your ${Br} to your ${kr}account`),fr};var _path$N,_excluded$W=["title","titleId"];function _extends$W(){return _extends$W=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$W(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgAt=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$W(br,_excluded$W);return reactExports.createElement("svg",_extends$W({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$N||(_path$N=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 4a8 8 0 1 0 4 14.928 1 1 0 1 1 1 1.732A9.96 9.96 0 0 1 11.942 22C6.446 21.968 2 17.503 2 12 2 6.477 6.477 2 12 2s10 4.477 10 10v1.5a3.5 3.5 0 0 1-6.396 1.966A5 5 0 1 1 17 12v1.5a1.5 1.5 0 0 0 3 0V12a8 8 0 0 0-8-8Zm3 8a3 3 0 1 0-6 0 3 3 0 0 0 6 0Z",fill:"currentColor"})))},_path$M,_excluded$V=["title","titleId"];function _extends$V(){return _extends$V=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$V(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgJustifiedText=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$V(br,_excluded$V);return reactExports.createElement("svg",_extends$V({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$M||(_path$M=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M3 6a1 1 0 0 1 1-1h16a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1Zm0 6a1 1 0 0 1 1-1h16a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1Zm0 6a1 1 0 0 1 1-1h7a1 1 0 1 1 0 2H4a1 1 0 0 1-1-1Z",fill:"currentColor"})))},_path$L,_excluded$U=["title","titleId"];function _extends$U(){return _extends$U=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$U(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgLocation=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$U(br,_excluded$U);return reactExports.createElement("svg",_extends$U({width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$L||(_path$L=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M22.6 8.067a9.333 9.333 0 0 0-13.2 13.2l5.658 5.657c.52.52 1.363.52 1.884 0l5.658-5.658a9.333 9.333 0 0 0 0-13.199ZM7.515 6.181c4.686-4.686 12.284-4.686 16.97 0 4.687 4.687 4.687 12.285 0 16.97l-4.67 4.67c-.041.042.019-.018-.023.024l-.964.964a3.998 3.998 0 0 1-5.655 0l-5.658-5.657c-4.687-4.686-4.687-12.284 0-16.97ZM16 12a2.667 2.667 0 1 0 0 5.333A2.667 2.667 0 0 0 16 12Zm-5.333 2.667a5.333 5.333 0 1 1 10.666 0 5.333 5.333 0 0 1-10.666 0Z",fill:"currentColor"})))},_path$K,_excluded$T=["title","titleId"];function _extends$T(){return _extends$T=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$T(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgMail=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$T(br,_excluded$T);return reactExports.createElement("svg",_extends$T({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$K||(_path$K=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 7a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V7Zm2 2.869V17a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V9.869l-6.336 4.223a3 3 0 0 1-3.328 0L4 9.87Zm16-2.404-7.445 4.963a1 1 0 0 1-1.11 0L4 7.465V7a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v.465Z",fill:"currentColor"})))},_path$J,_excluded$S=["title","titleId"];function _extends$S(){return _extends$S=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$S(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgPhone=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$S(br,_excluded$S);return reactExports.createElement("svg",_extends$S({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$J||(_path$J=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5 5a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3v14a3 3 0 0 1-3 3H8a3 3 0 0 1-3-3V5Zm3-1a1 1 0 0 0-1 1v14a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V5a1 1 0 0 0-1-1H8Zm3 14a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1Z",fill:"currentColor"})))},_path$I,_excluded$R=["title","titleId"];function _extends$R(){return _extends$R=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$R(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgSizeLabels=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$R(br,_excluded$R);return reactExports.createElement("svg",_extends$R({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$I||(_path$I=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2 5a3 3 0 0 1 3-3h4a3 3 0 0 1 3 2.93 3 3 0 0 1 4.192.05l2.829 2.828A3 3 0 0 1 19.069 12 3 3 0 0 1 22 15v4a3 3 0 0 1-3 3H7a5 5 0 0 1-5-5V5Zm9.071 15H19a1 1 0 0 0 1-1v-4a1 1 0 0 0-1-1h-1.929l-6 6Zm4.878-7.707h.001l1.657-1.657a1 1 0 0 0 0-1.414l-2.829-2.829a1 1 0 0 0-1.414 0L12 7.757v8.486l3.95-3.95ZM9.123 19.12A2.99 2.99 0 0 0 10 17V5a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v12a3 3 0 0 0 5.123 2.12ZM6 17a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H7a1 1 0 0 1-1-1Z",fill:"currentColor"})))},_path$H,_excluded$Q=["title","titleId"];function _extends$Q(){return _extends$Q=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$Q(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgUserCard=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$Q(br,_excluded$Q);return reactExports.createElement("svg",_extends$Q({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$H||(_path$H=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 5a3 3 0 1 1 6 0h4a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V8a3 3 0 0 1 3-3h4Zm.17 2H5a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V8a1 1 0 0 0-1-1h-4.17a3.001 3.001 0 0 1-5.66 0ZM12 4a1 1 0 0 0-1 1v1a1 1 0 1 0 2 0V5a1 1 0 0 0-1-1Zm-3 7a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm2.4 2.8a3 3 0 1 0-4.8 0 4.01 4.01 0 0 0-1.372 1.867 1 1 0 1 0 1.885.666 2.001 2.001 0 0 1 3.773 0 1 1 0 1 0 1.886-.666A4.01 4.01 0 0 0 11.4 13.8ZM14 11a1 1 0 0 1 1-1h3a1 1 0 1 1 0 2h-3a1 1 0 0 1-1-1Zm0 4a1 1 0 0 1 1-1h2a1 1 0 1 1 0 2h-2a1 1 0 0 1-1-1Z",fill:"currentColor"})))},_path$G,_excluded$P=["title","titleId"];function _extends$P(){return _extends$P=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$P(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgUser=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$P(br,_excluded$P);return reactExports.createElement("svg",_extends$P({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$G||(_path$G=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 4a8 8 0 0 0-6.598 12.526A14.943 14.943 0 0 1 12 15c2.366 0 4.606.548 6.598 1.526A8 8 0 0 0 12 4Zm7.654 14.436A9.96 9.96 0 0 0 22 12c0-5.523-4.477-10-10-10S2 6.477 2 12a9.96 9.96 0 0 0 2.37 6.464A9.978 9.978 0 0 0 12 22a9.978 9.978 0 0 0 7.654-3.564ZM17.2 18.08A12.954 12.954 0 0 0 12 17c-1.85 0-3.607.386-5.199 1.08A7.968 7.968 0 0 0 12 20c1.985 0 3.8-.723 5.199-1.92ZM12 8a2 2 0 1 0 0 4 2 2 0 0 0 0-4Zm-4 2a4 4 0 1 1 8 0 4 4 0 0 1-8 0Z",fill:"currentColor"})))},_path$F,_excluded$O=["title","titleId"];function _extends$O(){return _extends$O=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$O(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgWorkSuitcase=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$O(br,_excluded$O);return reactExports.createElement("svg",_extends$O({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$F||(_path$F=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 4a3 3 0 0 1 3-3h4a3 3 0 0 1 3 3v1h2a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3H5a3 3 0 0 1-3-3V8a3 3 0 0 1 3-3h2V4ZM5 7a1 1 0 0 0-1 1v4.57A22.95 22.95 0 0 0 12 14c2.815 0 5.51-.505 8-1.43V8a1 1 0 0 0-1-1H5Zm10-2H9V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v1Zm5 9.692A24.971 24.971 0 0 1 12 16c-2.796 0-5.487-.46-8-1.308V18a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-3.308ZM11 12a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2H12a1 1 0 0 1-1-1Z",fill:"currentColor"})))};const mapFieldToIcon={alias:SvgUser,country:SvgLocation,email:SvgMail,firstName:SvgUserCard,jobTitle:SvgWorkSuitcase,lastName:SvgUserCard,phoneNumber:SvgPhone,tShirtSize:SvgSizeLabels,username:SvgAt},UserFieldsToIcon=({fields:fr,className:br})=>{const wr=fr.length===1?mapFieldToIcon[fr[0]]:void 0;return wr?jsxRuntimeExports.jsx(wr,{className:br}):jsxRuntimeExports.jsx(SvgJustifiedText,{className:br})},UserFieldEditorView=({onClickClose:fr,onSubmit:br,fields:wr,submitText:Er,subtitle:kr,title:jr})=>{({submitText:Er,subtitle:kr,title:jr}=useAssignDefaultValues({submitText:Er,subtitle:kr,title:jr},wr));const Br=fr&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:fr,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{alignContent:"bottom",trailing:Br,children:jsxRuntimeExports.jsxs("div",{className:"user-field-editor__header",children:[jsxRuntimeExports.jsx("div",{className:"user-field-editor__header__icon",children:jsxRuntimeExports.jsx(Icon,{color:"brand-primary",size:"large",children:jsxRuntimeExports.jsx(UserFieldsToIcon,{fields:wr})})}),jr&&jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",children:jr})]})}),jsxRuntimeExports.jsxs("div",{className:"user-field-editor__body",children:[kr&&jsxRuntimeExports.jsx(Typography,{className:"user-field-editor__body__subtitle",variant:"body_normal",color:"secondary",children:kr}),jsxRuntimeExports.jsx(UserProfileForm,{filterFields:wr,onEditProfileSubmit:br,formClassName:"user-field-editor__body__form",fieldsContainerStyle:{padding:0},options:{buttonsAsFooter:!1,hideCancelButton:!0,submitButtonProps:{buttonPadding:"large",startSlot:void 0,typographyProps:{variant:"button_primary"}},submitText:Er}})]}),jsxRuntimeExports.jsx(PoweredByDynamic,{asFooter:!0})]})},UserFieldEditorModal=fr=>{var{onCancel:br,onSubmit:wr,fields:Er}=fr,kr=__rest$9(fr,["onCancel","onSubmit","fields"]);const[jr,Br]=reactExports.useState(!0),Wr=reactExports.useRef(!1),qr=reactExports.useCallback(()=>{Wr.current||br("User cancelled"),Wr.current=!0},[br]),Gr=Zr=>__awaiter$e(void 0,void 0,void 0,function*(){return wr(Zr).then(()=>{Wr.current=!0,Br(!1)})}),Vr=()=>Br(!1);return jsxRuntimeExports.jsx(Portal$4,{handleClose:Vr,isShown:jr,zIndex:authModalZIndex,withBackdrop:!0,elementId:"dynamic-edit-user-field",transitionEvents:{onUnmount:qr},children:jsxRuntimeExports.jsx(Modal$1,{children:jsxRuntimeExports.jsx(ModalCard,{children:jsxRuntimeExports.jsx(UserFieldEditorView,Object.assign({onSubmit:Gr,onClickClose:Vr,fields:Er},kr))})})})},DynamicBaseWidget=({children:fr,shadowDOMProps:br})=>jsxRuntimeExports.jsx(ShadowDOM,Object.assign({},br,{children:jsxRuntimeExports.jsx(PopperProvider$1,{children:fr})})),UserFieldEditorContext=reactExports.createContext(void 0),UserFieldEditorContextProvider=({children:fr})=>{const{modal:br,open:wr}=useConfirmationModal({elementId:"dynamic-edit-user-field"}),Er=reactExports.useCallback((kr,jr)=>__awaiter$e(void 0,void 0,void 0,function*(){return wr((Br,Wr)=>{const qr=Gr=>jr(Gr).then(Vr=>Br({fields:Gr,updateUserResult:Vr}));return jsxRuntimeExports.jsx(DynamicBaseWidget,{children:jsxRuntimeExports.jsx(UserFieldEditorModal,{fields:kr.fields,submitText:kr.submitText,title:kr.title,subtitle:kr.subtitle,onCancel:Wr,onSubmit:qr})})})}),[wr]);return jsxRuntimeExports.jsxs(UserFieldEditorContext.Provider,{value:{open:Er},children:[br,fr]})},VerticalAccordion=({children:fr,className:br,style:wr})=>jsxRuntimeExports.jsx("div",{className:classNames$1(br,"vertical-accordion__container"),style:wr,children:fr}),isUserLinkingWallet=(fr,br,wr)=>(fr==null?void 0:fr.verifiedCredentials)!==void 0&&br==="multi-wallet-wallet-list"&&!wr,useDynamicLayoutData=({view:fr,authMode:br})=>{const{t:wr}=useTranslation(),{isTurnkeyWalletWithoutAuthenticator:Er}=useIsTurnkeyWallet(),{selectedWalletConnector:kr}=useInternalDynamicContext(),jr=reactExports.useMemo(()=>({"login-with-email-or-wallet-full-wallet-list":{copykey:"dyn_login.helper.all_wallet_list",heading:wr("dyn_login.helper.all_wallet_list")},"login-with-wallet-only":{copykey:"dyn_login.helper.wallet_only",heading:wr("dyn_login.helper.wallet_only")},"passkey-intro":{copykey:"dyn_passkey_intro.helper.title",heading:wr("dyn_passkey_intro.helper.title")},"pending-connect":{copykey:"dyn_login.helper.pending_connect.title",heading:wr("dyn_login.helper.pending_connect.title")},"pending-signature":{copykey:"dyn_login.helper.pending_signature.title",heading:wr("dyn_login.helper.pending_signature.title")},"pending-signature-without-back-button":{copykey:"dyn_login.helper.pending_signature_without_back_button.title",heading:wr("dyn_login.helper.pending_signature_without_back_button.title")},"qr-code":{copykey:"dyn_login.helper.qr_code.title",heading:wr("dyn_login.helper.qr_code.title")},"wallet-connect-mobile-wallets-list":{copykey:"dyn_wallet_conect.mobile.wallet_list.helper",heading:wr("dyn_wallet_conect.mobile.wallet_list.helper")},"wallet-list":{copykey:"dyn_wallet_list.helper",heading:wr("dyn_wallet_list.helper")}}),[wr]),Br=reactExports.useMemo(()=>{var Gr;return{"account-exists":{copykey:"dyn_account_exists.title",heading:wr("dyn_account_exists.title")},"chainalysis-blocked-wallet":{copykey:"dyn_chainalysis_blocked_wallet.title",heading:wr("dyn_chainalysis_blocked_wallet.title")},"farcaster-connect-view":{copykey:"dyn_login.qr_code.title",heading:wr("dyn_login.qr_code.title")},"login-with-email-or-wallet":{copykey:"dyn_login.title.all",heading:wr("dyn_login.title.all")},"login-with-email-or-wallet-full-wallet-list":{copykey:"dyn_login.title.all_wallet_list",heading:wr("dyn_login.title.all_wallet_list")},"login-with-email-verification":{copykey:"dyn_otp_verification.confirm_code",heading:wr("dyn_otp_verification.confirm_code")},"login-with-sms-verification":{copykey:"dyn_otp_verification.confirm_code",heading:wr("dyn_otp_verification.confirm_code")},"login-with-wallet-only":{copykey:"dyn_login.title.wallet_only",heading:wr("dyn_login.title.wallet_only")},"merge-user-accounts":{copykey:"dyn_merge_user_accounts.wallet.title",heading:wr("dyn_merge_user_accounts.wallet.title")},"merge-user-accounts-conflicts":{copykey:"dyn_merge_user_accounts_conflicts.title",heading:wr("dyn_merge_user_accounts_conflicts.title")},"mfa-choose-device":{copykey:"dyn_mfa.choose_device_view.title",heading:wr("dyn_mfa.choose_device_view.title")},"mfa-display-backup-codes":{copykey:"dyn_mfa.display_backup_codes_view.title",heading:wr("dyn_mfa.display_backup_codes_view.title")},"mfa-recovery":{copykey:"dyn_mfa.recovery_view.title",heading:wr("dyn_mfa.recovery_view.title")},"mfa-secure-device":{copykey:"dyn_mfa.secure_device_view.title",heading:wr("dyn_mfa.secure_device_view.title")},"mfa-secure-device-help":{copykey:"dyn_mfa.secure_device_view.helper.title",heading:wr("dyn_mfa.secure_device_view.helper.title")},"mfa-verification":{copykey:"dyn_mfa.otp_verification_view.title",heading:wr("dyn_mfa.otp_verification_view.title")},"mobile-wallet-redirect-view":{copykey:"dyn_login.mobile_wallet_redirect.backup_title",heading:(Gr=kr==null?void 0:kr.name)!==null&&Gr!==void 0?Gr:wr("dyn_login.mobile_wallet_redirect.backup_title")},"multi-wallet-wallet-list":{copykey:br==="connect-only"?"dyn_wallet_list.title.connect":"dyn_wallet_list.title.link",heading:wr(br==="connect-only"?"dyn_wallet_list.title.connect":"dyn_wallet_list.title.link")},"network-not-supported":{copykey:"dyn_network_not_supported.title",heading:wr("dyn_network_not_supported.title")},"passkey-recovery-complete":{copykey:Er?"dyn_passkey_secure_modal.complete.title":"dyn_passkey_recovery.complete.title",heading:wr(Er?"dyn_passkey_secure_modal.complete.title":"dyn_passkey_recovery.complete.title")},"passkey-recovery-start":{copykey:Er?"dyn_passkey_secure_modal.start.title":"dyn_passkey_recovery.start.title",heading:wr(Er?"dyn_passkey_secure_modal.start.title":"dyn_passkey_recovery.start.title")},"pending-connect":{copykey:"dyn_login.connect_wallet.title",heading:wr("dyn_login.connect_wallet.title")},"pending-signature":{copykey:"dyn_login.sign_wallet.title",heading:wr("dyn_login.sign_wallet.title")},"qr-code":{copykey:"dyn_login.qr_code.title",heading:wr("dyn_login.qr_code.title")},"select-hardware-wallet":{copykey:"dyn_select_hardware_wallet.title",heading:wr("dyn_select_hardware_wallet.title")},"select-wallet-in-wallet-group":{copykey:"dyn_login.select_wallet_in_wallet_group.title",heading:wr("dyn_login.select_wallet_in_wallet_group.title")},"verify-email":{copykey:"dyn_otp_verification.confirm_code",heading:wr("dyn_otp_verification.confirm_code")},"verify-sms":{copykey:"dyn_otp_verification.confirm_code",heading:wr("dyn_otp_verification.confirm_code")},"wallet-connect-mobile-wallets-list":{copykey:"dyn_wallet_conect.mobile.wallet_list.title",heading:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(WalletConnectIcon,{style:{height:"1.5rem",width:"1.5rem"}})," ",wr("dyn_wallet_conect.mobile.wallet_list.title")]})},"wallet-group":{copykey:"dyn_login.wallet_group.title",heading:wr("dyn_login.wallet_group.title")},"wallet-list":{copykey:"dyn_wallet_list.title.select",heading:wr("dyn_wallet_list.title.select")},"wallet-sign":{copykey:"dyn_wallet_transfer.sign.title",heading:wr("dyn_wallet_transfer.sign.title")},"wallet-used":{copykey:"dyn_wallet_link.title",heading:wr("dyn_wallet_link.title")}}},[br,Er,kr==null?void 0:kr.name,wr]);if(fr==="no-access")return{headerData:{copykey:"dyn_no_access.title",heading:wr("dyn_no_access.title")}};if(fr==="access-blocked")return{headerData:{copykey:"dyn_access_blocked.title",heading:wr("dyn_access_blocked.title")}};const Wr=jr[fr];return{headerData:Br[fr],helpHeaderData:Wr}},useAuthLayoutChecks=()=>{var fr;const{view:br}=useViewContext(),{user:wr,customPrivacyPolicy:Er,customTermsOfServices:kr,privacyPolicyUrl:jr,termsOfServiceUrl:Br,isBridgeFlow:Wr,authMode:qr,projectSettings:Gr}=useInternalDynamicContext(),{isFooterExpanded:Vr}=useFooterAnimationContext(),{mockedSDK:Zr}=useMockContext(),{helpHeaderData:Jr}=useDynamicLayoutData({authMode:qr,view:br.type}),Qr=br.type!=="wallet-list"&&br.type!=="login-with-email-or-wallet-full-wallet-list"&&br.type!=="multi-wallet-wallet-list"&&br.type!=="login-with-wallet-only"||Vr,_n=br.type==="wallet-connect-mobile-wallets-list"||br.type==="wallet-list"||br.type==="login-with-email-or-wallet-full-wallet-list"||br.type==="login-with-wallet-only",En=!!(Jr&&!(br.type==="qr-code"||br.type==="no-qr-not-installed"||br.type==="wallet-used"||br.type==="chainalysis-blocked-wallet"||br.type==="wallet-sign"||br.type==="collect-user-data"||br.type==="passkey-new-domain-detected"||isUserLinkingWallet(wr,br.type,Zr))),Cn=br.type!=="collect-user-data"&&br.type!=="no-access"&&br.type!=="chainalysis-blocked-wallet"&&br.type!=="wallet-locked-view"&&br.type!=="gate-blocked-wallet"&&br.type!=="email-wallet-otp-verification-view"&&br.type!=="bridge-welcome"&&br.type!=="bridge-summary"&&br.type!=="bridge-next-wallet-connection"&&br.type!=="passkey-intro"&&br.type!=="passkey-new-domain-detected"&&br.type!=="social-redirect-view"&&br.type!=="collect-user-data-login-no-wallet"&&br.type!=="passkey-recovery-bundle"&&br.type!=="passkey-recovery-start"&&br.type!=="embedded-reveal-view"&&br.type!=="embedded-reveal-account-view"&&br.type!=="rename-passkey"&&br.type!=="create-password-view"&&br.type!=="embedded-wallet-auth-choice"&&br.type!=="wallet-claim-intro"&&br.type!=="passkey-recovery-add-email"&&br.type!=="global-wallet-confirm"&&br.type!=="global-wallet-malicious"&&br.type!=="global-wallet-info"&&br.type!=="mfa-choose-device"&&br.type!=="mfa-verification",In=Wr&&(br.type==="wallet-list"||br.type==="qr-code"||br.type==="wallet-connect-mobile-wallets-list"||br.type==="pending-connect"||br.type==="pending-signature"||br.type==="pending-signature-without-back-button"||br.type==="bridge-next-wallet-connection"||br.type==="bridge-summary"),An=!!(!isUserLinkingWallet(wr,br.type,Zr)&&(br.type==="wallet-list"||br.type==="wallet-connect-mobile-wallets-list"||(br.type==="login-with-email-or-wallet"||br.type==="login-with-email-or-wallet-full-wallet-list"||br.type==="login-with-wallet-only"||br.type==="multi-wallet-wallet-list")&&(Br||jr||Er||kr))),jn=!!(!((fr=Gr==null?void 0:Gr.sdk)===null||fr===void 0)&&fr.displayDynamicMessaging)&&(br.type==="login-with-email-or-wallet"||br.type==="login-with-email-or-wallet-full-wallet-list"||br.type==="login-with-wallet-only"||br.type==="login-with-email-verification"||br.type==="login-with-sms-verification"||br.type==="verify-email"||br.type==="verify-sms"||br.type==="pending-connect"||br.type==="wallet-group"||br.type==="select-wallet-in-wallet-group"||br.type==="select-hardware-wallet"||br.type==="pending-signature"||br.type==="qr-code"||br.type==="wallet-used"||br.type==="email-wallet-otp-verification-view"||br.type==="farcaster-connect-view"||br.type==="merge-user-accounts"||br.type==="merge-user-accounts-conflicts"||br.type==="mfa-verification"||br.type==="mfa-display-backup-codes"||br.type==="mfa-recovery"),eo=br.type!=="login-with-email-or-wallet-full-wallet-list"&&br.type!=="login-with-email-verification"&&br.type!=="login-with-sms-verification"&&br.type!=="network-not-supported"&&br.type!=="passkey-recovery-complete"&&br.type!=="passkey-recovery-start"&&br.type!=="passkey-recovery-bundle"&&br.type!=="rename-passkey"&&br.type!=="mobile-wallet-redirect-view"&&br.type!=="qr-code"&&br.type!=="mfa-verification"&&br.type!=="mfa-display-backup-codes"&&br.type!=="mfa-recovery",ro=br.type==="pending-signature"||br.type==="no-qr-not-installed"||br.type==="wallet-connect-mobile-wallets-list"||br.type==="login-with-email-verification"||br.type==="login-with-sms-verification"||br.type==="login-with-email-or-wallet-full-wallet-list"||br.type==="wallet-group"||br.type==="select-wallet-in-wallet-group"||br.type==="select-hardware-wallet"||br.type==="pending-connect"||br.type==="mobile-wallet-redirect-view"||br.type==="account-exists"||br.type==="passkey-intro"||br.type==="qr-code"||br.type==="farcaster-connect-view"||br.type==="mfa-verification"||br.type==="mfa-secure-device-help"||br.type==="merge-user-accounts-conflicts"||br.type==="mfa-recovery"||br.type==="merge-user-accounts-with-same-email"&&!wr;return{displayBorderBelowHeader:Qr,isWalletListTypeView:_n,shouldHideDynamicFooterSeparator:jn&&An,showBackButton:ro,showCloseButton:eo,showConnectedWalletProgress:In,showDefaultFooter:!In&&!jn&&!An,showDynamicFooter:jn,showHeader:Cn,showHelpContent:En,showToSFooter:An}},DynamicFooter=()=>{const{shouldHideDynamicFooterSeparator:fr}=useAuthLayoutChecks();return jsxRuntimeExports.jsx("div",{"data-testid":"dynamic-footer",className:classNames$1("dynamic-footer",{"dynamic-footer__top-border":!fr}),children:jsxRuntimeExports.jsx(PoweredByDynamic,{})})};var _path$E,_excluded$N=["title","titleId"];function _extends$N(){return _extends$N=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$N(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgFooterInfoIcon=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$N(br,_excluded$N);return reactExports.createElement("svg",_extends$N({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$E||(_path$E=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.333a6.667 6.667 0 1 0 0 13.334 6.667 6.667 0 0 0 0-13.334ZM1.667 10a8.333 8.333 0 1 1 16.666 0 8.333 8.333 0 0 1-16.666 0Zm7.5-3.333c0-.46.373-.834.833-.834h.008a.833.833 0 1 1 0 1.667H10a.833.833 0 0 1-.833-.833ZM8.333 10c0-.46.374-.833.834-.833H10c.46 0 .833.373.833.833v2.5a.833.833 0 1 1 0 1.667H10a.833.833 0 0 1-.833-.834v-2.5A.833.833 0 0 1 8.333 10Z",fill:"currentcolor"})))},_path$D,_path2$5,_excluded$M=["title","titleId"];function _extends$M(){return _extends$M=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$M(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgQuestionMark=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$M(br,_excluded$M);return reactExports.createElement("svg",_extends$M({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$D||(_path$D=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 3.25a6.75 6.75 0 1 0 0 13.5 6.75 6.75 0 0 0 0-13.5ZM1.667 10a8.333 8.333 0 1 1 16.666 0 8.333 8.333 0 0 1-16.666 0Z",fill:"currentcolor"})),_path2$5||(_path2$5=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.31 7.044a1.784 1.784 0 0 0-1.133.192 1.513 1.513 0 0 0-.699.783.792.792 0 0 1-1.481-.559c.26-.689.768-1.257 1.42-1.613a3.368 3.368 0 0 1 2.144-.367 3.262 3.262 0 0 1 1.908 1.023c.496.55.775 1.254.774 1.99 0 1.201-.948 1.972-1.587 2.369a6.63 6.63 0 0 1-1.354.635l-.028.01-.008.002h-.003l-.002.001-.235-.756.235.756A.792.792 0 0 1 9.789 10h.001m0 0 .014-.005.06-.021a5.054 5.054 0 0 0 .956-.456c.575-.357.84-.717.84-1.024 0-.332-.125-.66-.367-.928a1.68 1.68 0 0 0-.982-.521M9.265 13.77c0-.438.355-.792.792-.792h.01a.792.792 0 1 1 0 1.584h-.01a.792.792 0 0 1-.792-.792Z",fill:"currentcolor"})))};const Header=({onClose:fr,heading:br,projectSettings:wr,copykey:Er})=>{const{setError:kr}=useErrorContext(),{isFooterExpanded:jr,setIsFooterExpanded:Br}=useFooterAnimationContext(),{selectedWalletConnector:Wr}=useInternalDynamicContext(),{goToInitialView:qr,view:Gr,setView:Vr}=useViewContext(),{showBackButton:Zr,showCloseButton:Jr,showHelpContent:Qr,isWalletListTypeView:_n,displayBorderBelowHeader:En}=useAuthLayoutChecks(),{setExistentAccountData:Cn}=useAccountExistsContext(),{setSocialProvider:In}=useSocialRedirectContext(),An=reactExports.useCallback(()=>{var to;if(!((to=Gr.events)===null||to===void 0)&&to.onBackClick){Gr.events.onBackClick();return}if(Gr.type==="farcaster-connect-view"&&(In(void 0),dynamicEvents.emit("farcasterConnectCancelled"),dynamicEvents.emit("authFailure",{option:ProviderEnum.Farcaster,provider:ProviderEnum.Farcaster,type:"social"},"user-cancelled")),Cn(void 0),kr(void 0),Gr.type==="no-qr-not-installed"&&(Wr!=null&&Wr.canConnectViaQrCode)){Vr("qr-code");return}qr()},[Gr.type,Gr.events,qr,Cn,kr,In,Vr,Wr]),jn=Jr&&fr&&jsxRuntimeExports.jsx(IconButton,{onClick:fr,type:"button",id:"close-button","data-testid":"close-button",className:"header__icon",children:jsxRuntimeExports.jsx(SvgClose,{})}),eo=Qr&&jsxRuntimeExports.jsx(Tooltip$2,{content:"Need some help?",className:"header__tooltip",children:jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>Br(!jr),"data-testid":"info-button",className:"header__icon",children:_n?jsxRuntimeExports.jsx(SvgQuestionMark,{}):jsxRuntimeExports.jsx(SvgFooterInfoIcon,{})})},"info-button"),ro=[];return Zr&&ro.push(jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:An,"data-testid":"back-button",className:"header__icon",children:jsxRuntimeExports.jsx(SvgArrowLeft,{})},"back-button")),jn&&eo&&ro.push(eo),jsxRuntimeExports.jsx(ModalHeader,{leading:ro,trailing:jn||eo,displayBorder:En,children:(!wr||!!br)&&jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:Er,children:wr?br:jsxRuntimeExports.jsx(Skeleton$1,{className:"header__skeleton"})})})},EmptyHelpContent=()=>jsxRuntimeExports.jsx("div",{"data-testid":"empty-help-content"});var _path$C,_excluded$L=["title","titleId"];function _extends$L(){return _extends$L=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$L(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgFooterEyeIcon=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$L(br,_excluded$L);return reactExports.createElement("svg",_extends$L({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$C||(_path$C=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.995 4.167c3.965 0 6.643 2.655 7.937 4.675a2.14 2.14 0 0 1 0 2.316c-1.294 2.02-3.972 4.675-7.937 4.675-3.965 0-6.643-2.655-7.937-4.675a2.14 2.14 0 0 1 0-2.316c1.294-2.02 3.972-4.675 7.937-4.675ZM14.16 10a4.167 4.167 0 1 1-8.333 0 4.167 4.167 0 0 1 8.333 0Zm-4.12 2.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z",fill:"currentColor"})))},_path$B,_excluded$K=["title","titleId"];function _extends$K(){return _extends$K=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$K(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgFooterGasIcon=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$K(br,_excluded$K);return reactExports.createElement("svg",_extends$K({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$B||(_path$B=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.667 18.333a2 2 0 0 0 2-2V3.667a2 2 0 0 0-2-2h-6a2 2 0 0 0-2 2v12.666a2 2 0 0 0 2 2h6ZM9 8.333a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1H4.333a1 1 0 0 0-1 1v3a1 1 0 0 0 1 1H9ZM17.5 5.833c.46 0 .833.373.833.834v7.5H17.5h.833V14.186a1.201 1.201 0 0 1-.005.113 2.881 2.881 0 0 1-.29 1.075c-.155.307-.398.64-.779.893-.386.258-.863.4-1.426.4-.562 0-1.04-.142-1.425-.4a2.295 2.295 0 0 1-.778-.893 2.878 2.878 0 0 1-.296-1.16v-.045l.833-.001h-.834V9.185l-.001-.011a.2.2 0 0 0-.015-.051v-.001s.005.008.016.02V7.5c.354 0 .675.091.944.27.264.176.43.404.53.607A1.856 1.856 0 0 1 15 9.13v.035c0 .001 0 .002-.832.002H15v4.992l.001.02a1.228 1.228 0 0 0 .12.448c.054.11.123.194.211.253.083.055.23.12.501.12s.419-.065.502-.12a.633.633 0 0 0 .211-.253 1.218 1.218 0 0 0 .12-.468V6.667c0-.46.374-.834.834-.834ZM13.378 9.17h.002-.002Z",fill:"currentColor"})))},_path$A,_excluded$J=["title","titleId"];function _extends$J(){return _extends$J=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$J(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgFooterKeyIcon=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$J(br,_excluded$J);return reactExports.createElement("svg",_extends$J({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$A||(_path$A=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.125 6.875a5 5 0 1 0-10 0 5 5 0 0 0 10 0Zm-2.5 0a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0Zm-7.809 3.243a6.258 6.258 0 0 0 1.671 1.865L7.13 14.34l1.752 1.753-1.768 1.767-1.752-1.752-1.718 1.718-1.768-1.767 5.941-5.942Z",fill:"currentColor"})))};const isHardwareWalletEnabled=fr=>fr!=null&&isHardwareWalletConnector(fr)&&fr.isHardwareWalletEnabled,EnterTileAnimation=({children:fr,className:br="",delay:wr=0,dataTestId:Er})=>{const kr=reactExports.useMemo(()=>({animationDelay:wr}),[wr]);return jsxRuntimeExports.jsx("div",{"data-testid":Er,className:classNames$1(br,"enter-list-tile-animation"),style:kr,children:fr})},InfoItem=({title:fr,content:br,Icon:wr,className:Er="",iconClassName:kr="",textClassName:jr=""})=>jsxRuntimeExports.jsxs("div",{className:classNames$1("info-item__container",Er),children:[jsxRuntimeExports.jsx("div",{className:classNames$1("info-item__icon-container",kr,{"icon-container--has-content":!!br}),children:jsxRuntimeExports.jsx(wr,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{as:"h2",className:jr,variant:"body_normal",color:"primary",weight:"medium",children:fr}),br&&jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"regular",className:"info-item__secondary-text",children:br})]})]}),WalletMoreInfoContent=({variant:fr,wallet:br})=>{const wr={info:[{content:"Signing proves you have access to your wallet. It’s a bit like verifying your email by clicking an email confirmation link in your inbox during signup. This does not approve a transaction.",icon:SvgFooterKeyIcon,title:"Confirms you own your wallet"},{icon:SvgFooterGasIcon,title:"There are no associated gas costs"}]},Er=isHardwareWalletEnabled(br)?{info:[{content:"By connecting a wallet to a website, you are allowing the site to read the contents of your wallet. This does not approve a transaction.",icon:SvgFooterEyeIcon,title:"Allows read access"},{content:jsxRuntimeExports.jsxs("div",{className:"footer-more-info-content__item--phantom-ledger",children:[jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_small",weight:"regular",children:"Ledger does not support message signing functionality, commonly used to log in to sites. Instead, we sign a transaction as a proxy to prove ownership of the wallet."}),jsxRuntimeExports.jsxs(Typography,{as:"p",variant:"body_small",weight:"regular",children:[jsxRuntimeExports.jsx("strong",{children:"Important"}),": we do not"," ",jsxRuntimeExports.jsx("strong",{children:"broadcast"})," this transaction, meaning Ledger based login will still be gasless."]}),jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_small",weight:"regular",children:"Phantom in turn shows that a fee may apply as part of the “transaction”."}),jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_small",weight:"regular",children:"As always, please be cautious of the extensions and websites you use to prevent unwanted transactions from being broadcasted to the network."})]}),icon:SvgFooterGasIcon,title:"Why do I see a fee when using ledger"}]}:wr,kr={connect:{info:[{content:"By connecting a wallet to a website, you are allowing the site to read the contents of your wallet. This does not approve a transaction.",icon:SvgFooterEyeIcon,title:"Allows read access"},{icon:SvgFooterGasIcon,title:"There are no associated gas costs"}]},sign:Er};return jsxRuntimeExports.jsx("div",{className:"footer-more-info-content__wrapper",children:kr[fr].info.map((jr,Br)=>jsxRuntimeExports.jsx("div",{className:"footer-more-info-content__item",children:jsxRuntimeExports.jsx(EnterTileAnimation,{delay:`${.3+Br*.2}s`,children:jsxRuntimeExports.jsx(InfoItem,{Icon:jr.icon,title:jr.title,content:jr.content})})},Br))})};var _path$z,_excluded$I=["title","titleId"];function _extends$I(){return _extends$I=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$I(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgPuzzle=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$I(br,_excluded$I);return reactExports.createElement("svg",_extends$I({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$z||(_path$z=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.044 20.998a.693.693 0 0 0 .7-.68V16.59c.239-2.01 1.121-1.413 2.16-.791 2.51 1.502 4.177-2.45 2.148-3.67-1.592-.956-2.281.689-3.448.52-.45-.067-.763-.54-.862-1.261V8.693a.692.692 0 0 0-.7-.68h-3.21c-2.65-.327-.297-1.755-.297-3.083.001-1.066-.99-1.93-2.214-1.93-1.222 0-2.344.864-2.344 1.93 0 1.253 2.435 2.756-.253 3.083H3.7a.692.692 0 0 0-.699.68v2.688c.205 1.146 1.001 1.411 2.021.655.344-.256.924-.554 1.344-.554 1.094 0 1.982.965 1.982 2.154 0 1.19-.887 2.416-1.982 2.416-.39 0-.755-.123-1.063-.338 0 .091-1.913-1.674-2.302.486v4.121c0 .375.315.68.699.68L10.16 21c.085-.393-.191-.844-.45-1.234-2.04-3.075 5.895-3.382 3.855.095-.1.172-.2.338-.277.5-.098.202-.162.45-.149.639l2.905-.002Z",fill:"currentColor"})))};const parseWalletLinks=fr=>{const br=isIPhone()||isIPad(),wr=detectBrowserName()||"chrome";let Er;switch(wr){case"edge":Er=fr.edge;break;case"firefox":Er=fr.firefox;break;case"chrome":default:Er=fr.chrome;break}const kr=!br&&!!fr.android,jr=(br||!isMobile())&&!!fr.ios;return{canShowAndroidAppButton:kr,canShowIosAppButton:jr,currentDesktopUrl:Er,hasMobileAppUrl:kr||jr,userBrowser:wr}},isWalletGroup=fr=>{var br;return!!(!((br=fr.groupedWallets)===null||br===void 0)&&br.length)},getLastUsedWalletKey=()=>StorageService.getItem(LAST_USED_WALLET),getWalletGroupLabel=(fr,br)=>{const wr=br==null?void 0:br.find(Br=>fr.groupedWallets.some(Wr=>Br.walletKey===Wr.walletConnector.key));if(wr)return{isRecommended:!0,label:wr.label||"Recommended"};const Er=getLastUsedWalletKey();if(fr.groupedWallets.some(Br=>Br.walletConnector.key===Er))return{label:"Last used"};if(fr.groupedWallets.some(Br=>Br.isInstalledOnBrowser))return{label:"Installed"};if(getWalletGroupType(fr)==="multi-chain")return{label:"Multichain"}},getWalletLabel=(fr,br)=>{const wr=getLastUsedWalletKey(),{key:Er}=fr.walletConnector,kr=br==null?void 0:br.find(Br=>Br.walletKey===Er);if(kr)return{isRecommended:!0,label:kr.label||"Recommended"};if(Er===wr)return{label:"Last used"};if(fr.isInstalledOnBrowser)return{label:"Installed"}},getWalletListItemLabel=({wallet:fr,recommendedWallets:br})=>isWalletGroup(fr)?getWalletGroupLabel(fr,br):getWalletLabel(fr,br),isProgrammableNetworkSwitchSupported=fr=>{const wr=new URLSearchParams(window.location.search).get("dev_isProgrammableNetworkSwitchSupported");return wr?wr==="true":fr.switchNetworkOnlyFromWallet!==!0},getWalletConnectorNetworks=fr=>{if(!fr)return[];const br=fr;return br.evmNetworks||br.starknetNetworks||[]},isSupportedNetwork=({walletConnector:fr,network:br})=>{const wr=getWalletConnectorNetworks(fr);return wr.length?wr.some(({chainId:kr})=>String(kr)===String(br)):!0},useHandleWalletsToConnect=()=>{const{bridgeChains:fr,bridgeChainsToConnect:br,setShowAuthFlow:wr,bridgeOnboardingCompleted:Er,setBridgeOnboardingCompleted:kr}=useInternalDynamicContext(),{setView:jr,goToInitialView:Br}=useViewContext();return{handleWalletsToConnect:({walletConnector:qr})=>{if(!fr){wr(!1);return}if(!br){kr(!0),wr(!1);return}if(br.length===0||!qr||!qr.connectedChain)return wr(!1),Br();if(br.filter(Zr=>Zr.chain!==(qr==null?void 0:qr.connectedChain)).length===0){Er?(wr(!1),Br()):(kr(!0),jr("bridge-summary"));return}jr("bridge-next-wallet-connection")}}},specialCareWallets=["bloctoevm","perawallet","metamaskstarknet"],showPendingConnectView=(fr,br)=>__awaiter$e(void 0,void 0,void 0,function*(){const wr=getWalletProvider(fr);if(wr==="walletConnect"||wr==="qrCode")return;specialCareWallets.forEach(kr=>{fr.key===kr&&br("pending-connect")}),(yield fr.getConnectedAccounts()).length===0&&br("pending-connect")}),isConnectOnly=(fr,br)=>br==="connect-only"&&!(fr!==void 0),useConnectAndSign=({shouldUpdateWallets:fr=!0,shouldCallCallback:br=!0}={})=>{const{setView:wr,goToInitialView:Er}=useViewContext(),{engageCaptcha:kr,getCaptchaToken:jr}=useCaptchaContext(),{setErrorMessage:Br}=useErrorContext(),{authMode:Wr,connectWallet:qr,consumeNonce:Gr,displaySiweStatement:Vr,environmentId:Zr,projectSettings:Jr,networkValidationMode:Qr,setIsSingleWalletAccount:_n,user:En,walletUiUtils:Cn}=useInternalDynamicContext(),{handleWalletsToConnect:In}=useHandleWalletsToConnect(),An=useVerifyWallet({consumeNonce:Gr,displaySiweStatement:Vr,environmentId:Zr,projectSettings:Jr,setIsSingleWalletAccount:_n}),jn=(ro,to,_i)=>__awaiter$e(void 0,void 0,void 0,function*(){!isEmailWalletConnector(ro)||isBloctoConnector(ro)?wr("pending-signature"):Cn.disabledConfirmationOnce(),yield An({captchaToken:_i,publicWalletAddress:to,walletConnector:ro})}),eo=ro=>{var to;(ro==null?void 0:ro.code)==="user-cancelled"||logger$6.debug(ro),Br((to=ro==null?void 0:ro.code)===null||to===void 0?void 0:to.toString()),Er()};return ro=>__awaiter$e(void 0,[ro],void 0,function*({walletConnector:to,getAddressOpts:_i=void 0}){var oo;try{yield showPendingConnectView(to,wr),isEmailWalletConnector(to)&&(isEmailOTPWalletConnector(to)?wr("email-wallet-otp-verification-view"):isBloctoConnector(to)||wr("wait-for-email-confirmation-view"));const io=yield qr(to,_i,{applyHandleConnectedWallet:br});if(!(io!=null&&io.address))return;const{address:co}=io,so=yield to.getNetwork();if(!isSupportedNetwork({network:so,walletConnector:to})&&(Qr==="always"||Qr==="sign-in"))return isProgrammableNetworkSwitchSupported(to)?wr("network-not-supported"):wr("network-not-supported-manual");if(isConnectOnly(En,Wr)){StorageService.setItem(LAST_USED_WALLET,to.key),fr&&In({walletConnector:to});return}if(!((oo=Jr==null?void 0:Jr.security.hCaptcha)===null||oo===void 0)&&oo.enabled){kr({authMethod:"wallet",onCaptchaSuccess:Hr=>__awaiter$e(void 0,void 0,void 0,function*(){try{yield jn(to,co,Hr)}catch(Xr){eo(Xr)}})});return}yield jn(to,co,jr())}catch(io){eo(io)}})},walletsRequiringTwoStepAuthentication=["dapper"],requiresTwoStepAuthentication=fr=>isMobile()&&!(fr!=null&&fr.canConnectViaCustodialService)||walletsRequiringTwoStepAuthentication.includes((fr==null?void 0:fr.key)||""),useConnectAndSignSplitSteps=()=>{const{setView:fr,goToInitialView:br}=useViewContext(),{setErrorMessage:wr}=useErrorContext(),{getCaptchaToken:Er,engageCaptcha:kr}=useCaptchaContext(),{connectWallet:jr,consumeNonce:Br,displaySiweStatement:Wr,projectSettings:qr,environmentId:Gr,networkValidationMode:Vr,setIsSingleWalletAccount:Zr,setShowAuthFlow:Jr,user:Qr,authMode:_n}=useInternalDynamicContext(),{handleWalletsToConnect:En}=useHandleWalletsToConnect(),Cn=useVerifyWallet({consumeNonce:Br,displaySiweStatement:Wr,environmentId:Gr,projectSettings:qr,setIsSingleWalletAccount:Zr}),In=eo=>{var ro;logger$6.debug(eo),!(eo instanceof MissingPublicAddressError&&isMobile())&&(br(),wr((ro=eo.code)!==null&&ro!==void 0?ro:eo.toString()))};return{onlyConnectUser:eo=>__awaiter$e(void 0,[eo],void 0,function*({walletConnector:ro,getAddressOpts:to=void 0,shouldShowPendingConnectView:_i=!0}){var oo;_i&&(yield showPendingConnectView(ro,fr));try{if(yield jr(ro,to),isConnectOnly(Qr,_n)){StorageService.setItem(LAST_USED_WALLET,ro.key),En({walletConnector:ro});return}if(!((oo=qr==null?void 0:qr.security.hCaptcha)===null||oo===void 0)&&oo.enabled){kr({authMethod:"wallet",onCaptchaSuccess:io=>__awaiter$e(void 0,void 0,void 0,function*(){Jr(!0),fr("pending-signature")})});return}Jr(!0),fr("pending-signature")}catch(io){In(io);return}}),signAlreadyConnectedUser:eo=>__awaiter$e(void 0,[eo],void 0,function*({walletConnector:ro,getAddressOpts:to=void 0}){try{const _i=yield jr(ro,to);if(!(_i!=null&&_i.address))return;const oo=yield ro.getNetwork();if(!isSupportedNetwork({network:oo,walletConnector:ro})&&(Vr==="always"||Vr==="sign-in"))return isProgrammableNetworkSwitchSupported(ro)?fr("network-not-supported"):fr("network-not-supported-manual");yield Cn({captchaToken:Er(),publicWalletAddress:_i.address,walletConnector:ro})}catch(_i){In(_i);return}})}},isSelectedWalletAlreadyConnected=(fr,br,wr)=>wr?fr.map(({connector:Er})=>Er.key).includes(br.key):!1,useWalletItemActions=()=>{const{setMultiWalletWidgetState:fr,setShowAuthFlow:br,setSelectedWalletConnectorKey:wr,walletConnectorOptions:Er,setQrcodeUri:kr,setDesktopUri:jr,user:Br,linkedWallets:Wr,setLegacyIsVerifying:qr,authMode:Gr}=useInternalDynamicContext(),{mockedSDK:Vr}=useMockContext(),{setError:Zr,setErrorMessage:Jr}=useErrorContext(),{setView:Qr,goToInitialView:_n}=useViewContext(),{onlyConnectUser:En}=useConnectAndSignSplitSteps(),Cn=useConnectAndSign(),In=oo=>__awaiter$e(void 0,void 0,void 0,function*(){logger$6.debug("handleCustodialWalletClick",oo);const io=requiresTwoStepAuthentication(oo);logger$6.logVerboseTroubleshootingMessage("[handleCustodialWalletClick]",{twoStepAuthentication:io}),io?(wr(oo.key),yield En({walletConnector:oo})):(wr(oo.key),fr("awaiting_signature",void 0,"linking_new_wallet")),Qr("pending-signature")}),An=oo=>__awaiter$e(void 0,void 0,void 0,function*(){var io;if(logger$6.debug("handleMobileWalletClick",oo),wr(oo.key),oo.key==="phantom"){const so=StorageService.getItem(PHANTOM_SIGNATURE_STATE);StorageService.setItem(PHANTOM_SIGNATURE_STATE,{loseOriginalAccountOnTransfer:(io=so==null?void 0:so.loseOriginalAccountOnTransfer)!==null&&io!==void 0?io:!1,submittedAtTimestamp:new Date().toString(),verificationType:"awaiting_verification"})}const co=()=>{En({shouldShowPendingConnectView:!1,walletConnector:oo})};Qr("mobile-wallet-redirect-view",{onRetry:co}),co()}),jn=oo=>__awaiter$e(void 0,void 0,void 0,function*(){logger$6.debug("handleInstalledExtensionClick",oo),wr(oo.key),Gr==="connect-only"?(Qr("pending-connect"),En({walletConnector:oo})):fr("awaiting_signature",void 0,"linking_new_wallet")}),eo=oo=>__awaiter$e(void 0,void 0,void 0,function*(){logger$6.debug("handleUninstalledClick",oo),wr(oo.key),oo.canConnectViaQrCode?(Cn({getAddressOpts:{onDesktopUri:io=>__awaiter$e(void 0,void 0,void 0,function*(){jr(io)}),onDisplayUri:io=>__awaiter$e(void 0,void 0,void 0,function*(){kr(io)})},walletConnector:oo}),Qr("qr-code")):Qr("no-qr-not-installed"),Zr(void 0)}),ro=oo=>__awaiter$e(void 0,void 0,void 0,function*(){logger$6.debug("handleAlreadyConnectedWallet",oo),br(!1);const io=yield oo.getConnectedAccounts(),co=Wr.find(so=>{var no;return so.address.toLowerCase()===((no=io[0])===null||no===void 0?void 0:no.toLowerCase())});logger$6.logVerboseTroubleshootingMessage("[handleAlreadyConnectedWallet]",{activeAccountAlreadyLinked:co,connectedAccounts:io,linkedWallets:Wr}),co?fr("awaiting_account_switch","linking_new_wallet"):fr("awaiting_signature",void 0,"linking_new_wallet"),wr(oo.key)});return{handleAlreadyConnectedWallet:ro,handleCustodialWalletClick:In,handleInstalledExtensionClick:jn,handleMobileWalletClick:An,handleUninstalledClick:eo,handleWalletItemClick:oo=>__awaiter$e(void 0,void 0,void 0,function*(){const{walletConnector:io,isInstalledOnBrowser:co}=oo,so=io.connectedChain==="FLOW"||isPhantomRedirectConnector(io);if(logger$6.logVerboseTroubleshootingMessage("[handleWalletItemClick]",{mockedSDK:Vr,shouldEndWalletConnectorSession:so,wallet:oo}),Vr)return;so&&(yield io.endSession()),qr(!1);const no=io.key==="metamask";if(Gr!=="connect-only"&&no)try{wr(io.key),Qr("pending-connect"),yield io.chooseAccountsToConnect()}catch(Tn){if(Tn instanceof UserRejectedRequestError$1){Jr("connection_rejected"),_n();return}}isSelectedWalletAlreadyConnected(Wr,io,Br)&&io.connectedChain!=="FLOW"?ro(io):io.canConnectViaCustodialService?In(io):isMobile()?io.key==="walletconnect"?Qr("wallet-connect-mobile-wallets-list"):An(io):co?jn(io):eo(io)}),openWallet:(oo,io)=>{var co;const{openMobileWallet:so=An,openCustodialWallet:no=In,openExtensionWallet:Tn=jn}=io||{},Hr=(co=Er.find(Xr=>Xr.key===oo))===null||co===void 0?void 0:co.walletConnector;Hr&&(isMobile()?so(Hr):Hr.canConnectViaCustodialService?no(Hr):Hr.isInstalledOnBrowser()&&Tn(Hr))}}},ListTileAnimatedTrailing=({hoverElement:fr,children:br})=>jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsxs("div",{className:"list-tile-animated-trailing",children:[jsxRuntimeExports.jsx("div",{className:"list-tile-animated-trailing__child",children:br}),jsxRuntimeExports.jsx("div",{className:"list-tile-animated-trailing__hover-element",children:fr})]})}),ListTile=({children:fr,onClick:br,leading:wr,disabled:Er=!1,trailing:kr,style:jr,className:Br="",dataTestId:Wr,copykey:qr})=>jsxRuntimeExports.jsxs("button",{"data-testid":Wr,type:"button",className:classNames$1(Br,"list-tile"),onClick:br,style:jr,disabled:Er,children:[wr,jsxRuntimeExports.jsx("div",{className:"list-tile__children",children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"body_normal",color:"primary",as:"span",copykey:qr,children:fr})}),kr]}),WalletListItem=({disabled:fr=!1,wallet:br,onResetSearchValue:wr,recommendedWallets:Er,tile:kr=({leading:jr,name:Br,onClick:Wr,trailing:qr})=>jsxRuntimeExports.jsx(ListTile,{leading:jr,trailing:qr,onClick:Wr,className:"wallet-list-item__tile",dataTestId:"ListTile",children:Br})})=>{const{navigateToWalletGroup:jr}=useWalletGroupContext(),{setView:Br}=useViewContext(),Wr=isWalletGroup(br),{walletBook:qr}=useWalletBookContext(),{handleWalletItemClick:Gr}=useWalletItemActions(),Vr=getWalletListItemLabel({recommendedWallets:Er,wallet:br}),Zr=kr,Jr=()=>__awaiter$e(void 0,void 0,void 0,function*(){if(!fr){if(wr==null||wr(""),Wr)return jr(br);if(isHardwareWalletConnector(br.walletConnector)&&br.walletConnector.canConnectWithHardwareWallet()){Br("select-hardware-wallet",{onSelectWallet:Gr,wallet:br});return}yield Gr(br)}}),Qr=Wr?getWalletGroup(qr,br.key).name:getWalletBookWallet(qr,br.key).name,_n=jsxRuntimeExports.jsx(WalletIcon,{className:"wallet-list-item__leading",walletKey:br.key,style:{height:pixelToRem(28),width:pixelToRem(28)}}),En=jsxRuntimeExports.jsx(ListTileAnimatedTrailing,{hoverElement:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",size:"mini",children:jsxRuntimeExports.jsx(SvgStroke,{})}),children:Vr&&jsxRuntimeExports.jsx(Badge,{dot:!Vr.isRecommended,variant:Vr.isRecommended?"primary":"secondary",text:jsxRuntimeExports.jsx(Typography,{variant:"body_small",children:Vr.label})})});return jsxRuntimeExports.jsx(Zr,{leading:_n,trailing:En,name:Qr,onClick:Jr})},NewToWeb3WalletItem=({children:fr,style:br,wallet:wr})=>jsxRuntimeExports.jsx(WalletListItem,{wallet:wr,tile:fr?({onClick:Er})=>jsxRuntimeExports.jsx("button",{className:"new-to-web3--button",style:br,onClick:Er,children:fr}):void 0}),Item$1=({heading:fr,StartIcon:br,EndIcon:wr,message:Er,url:kr})=>jsxRuntimeExports.jsxs("a",{className:"footer-buttons-item",href:kr,rel:"noopener noreferrer",target:"_blank",children:[jsxRuntimeExports.jsx("div",{className:"footer-buttons-item__icon--left",children:jsxRuntimeExports.jsx(br,{})}),jsxRuntimeExports.jsxs("div",{className:"footer-buttons-item__typography",children:[jsxRuntimeExports.jsx(Typography,{as:"h2",weight:"regular",color:"primary",variant:"body_normal",children:fr}),Er&&jsxRuntimeExports.jsx(Typography,{as:"p",weight:"regular",color:"secondary",children:Er})]}),wr&&jsxRuntimeExports.jsx(wr,{style:{height:"1.5rem",width:"1.5rem"}})]}),WalletExtensionOrAppContinueButton=({wallet:fr,selectedUrl:br})=>{const wr=!!br.length&&!(fr!=null&&fr.isInstalledOnBrowser),Er=()=>{fr!=null&&fr.key&&(StorageService.setItem(NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY,fr.key),window.location.reload())};return jsxRuntimeExports.jsxs("div",{className:"new-to-web3-buttons__container",children:[!isMobile()&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[(fr==null?void 0:fr.isInstalledOnBrowser)&&jsxRuntimeExports.jsx(NewToWeb3WalletItem,{wallet:fr,children:jsxRuntimeExports.jsx(Typography,{as:"p","data-testid":"desktop-interactive-wallet-item",variant:"body_normal",weight:"bold",children:"Continue"})}),wr&&jsxRuntimeExports.jsx("button",{onClick:Er,children:jsxRuntimeExports.jsx(Typography,{as:"p","data-testid":"refresh-once-installed-button",variant:"body_normal",weight:"bold",children:"Continue once installed"})})]}),fr&&isMobile()&&jsxRuntimeExports.jsx(NewToWeb3WalletItem,{wallet:fr,children:jsxRuntimeExports.jsx("p",{"data-testid":"mobile-interactive-wallet-item",children:"Continue once installed"})})]})},WalletListHelpContent=({chains:fr,newToWeb3WalletChainMap:br})=>{var wr,Er;const{walletConnectorOptions:kr}=useInternalDynamicContext(),{walletBook:jr}=useWalletBookContext(),[Br,Wr]=reactExports.useState(""),qr=((wr=fr==null?void 0:fr.filter(In=>!!In.enabled).find(In=>In.name===br.primary_chain))===null||wr===void 0?void 0:wr.name)||"evm",Gr=getValueByKey(br==null?void 0:br.wallets,qr),Vr=kr.find(In=>In.key===Gr),Zr=Vr==null?void 0:Vr.walletConnector.canConnectViaCustodialService,Jr=getWalletLinks(jr,Gr),{currentDesktopUrl:Qr,canShowAndroidAppButton:_n,canShowIosAppButton:En}=parseWalletLinks(Jr),Cn=[{content:"Install Desktop extension",icon:SvgPuzzle,isEnabled:!!(Qr!=null&&Qr.length)&&!isMobile(),url:Qr},{content:"Install iOS app",icon:AppleIcon,isEnabled:En,url:Jr.ios},{content:"Install Android app",icon:AndroidIcon,isEnabled:_n,url:Jr.android}];return Object.keys((Er=jr==null?void 0:jr.wallets)!==null&&Er!==void 0?Er:{}).length?jsxRuntimeExports.jsx("div",{className:"walletlist-help-content__container",children:jsxRuntimeExports.jsxs(EnterTileAnimation,{delay:"300ms",children:[jsxRuntimeExports.jsx("div",{className:"walletlist-help-content__icon",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:Gr,style:{height:pixelToRem(56),width:pixelToRem(56)}})}),jsxRuntimeExports.jsxs("div",{className:"walletlist-help-content__typography-wrapper",children:[jsxRuntimeExports.jsxs(Typography,{as:"p",variant:"title",weight:"medium",children:["We recommend installing"," ",getWalletBookWallet(jr,Gr).name]}),jsxRuntimeExports.jsx(Typography,{as:"label",variant:"body_normal",weight:"regular",color:"secondary",className:"walletlist-help-content__typography--label",children:"Select your preferred option below:"})]}),jsxRuntimeExports.jsx("div",{className:"walletlist-help-content__buttons-wrapper",children:Cn.map((In,An)=>In.isEnabled?jsxRuntimeExports.jsx("button",{onClick:()=>Wr(In.url),children:jsxRuntimeExports.jsx(Item$1,{StartIcon:In.icon,heading:In.content,url:In.url})},An):void 0)}),Zr&&jsxRuntimeExports.jsxs("div",{className:"walletlist-help-content__custodial-wallet-area",children:[jsxRuntimeExports.jsx(Typography,{className:"walletlist-help-content__custodial-wallet-area--title",as:"p",color:"secondary",variant:"body_normal",weight:"regular",children:"If you don't want to install a wallet, then use:"}),jsxRuntimeExports.jsx(NewToWeb3WalletItem,{wallet:Vr})]}),jsxRuntimeExports.jsx(WalletExtensionOrAppContinueButton,{selectedUrl:Br,wallet:Vr})]})}):jsxRuntimeExports.jsx(Skeleton$1,{className:"walletlist-footer-content__container"})};var _path$y,_excluded$H=["title","titleId"];function _extends$H(){return _extends$H=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$H(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgChevronLeft=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$H(br,_excluded$H);return reactExports.createElement("svg",_extends$H({width:20,height:20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$y||(_path$y=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.09 3.577a.833.833 0 0 1 0 1.179L7.844 10l5.244 5.244a.833.833 0 0 1-1.178 1.179l-5.834-5.834a.833.833 0 0 1 0-1.178l5.834-5.834a.833.833 0 0 1 1.178 0Z",fill:"currentcolor"})))};const HelpHeader=()=>{const{authMode:fr}=useInternalDynamicContext(),{setIsFooterExpanded:br}=useFooterAnimationContext(),{view:wr}=useViewContext(),{helpHeaderData:Er}=useDynamicLayoutData({authMode:fr,view:wr.type}),{displayBorderBelowHeader:kr}=useAuthLayoutChecks(),jr=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>br(!1),"data-testid":"back-button",className:"header__icon",children:jsxRuntimeExports.jsx(SvgChevronLeft,{className:"back-button "})});return jsxRuntimeExports.jsx("div",{className:"help-header",children:jsxRuntimeExports.jsx(ModalHeader,{trailing:jr,displayLeading:!1,displayBorder:kr,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-help-heading",className:"header__typography",copykey:Er==null?void 0:Er.copykey,children:Er==null?void 0:Er.heading})})})};var _path$x,_excluded$G=["title","titleId"];function _extends$G(){return _extends$G=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$G(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgUserAccount2=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$G(br,_excluded$G);return reactExports.createElement("svg",_extends$G({width:60,height:50,viewBox:"0 0 60 50",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$x||(_path$x=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M51.931 49.48A29.223 29.223 0 0 0 59.333 30C59.333 13.8 46.2.667 30 .667S.667 13.8.667 30A29.224 29.224 0 0 0 8.07 49.483c5.52-6.63 16.005-9.007 22.387-9.007 6.383 0 15.962 1.903 21.473 9.004ZM19 22.667c0-6.076 4.925-11 11-11s11 4.924 11 11c0 6.075-4.925 11-11 11s-11-4.925-11-11Z",fill:"#4779FF"})))};const PasskeyInfoHelper=()=>{const{t:fr}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"passkey-info-help-content__container",children:jsxRuntimeExports.jsx(EnterTileAnimation,{delay:"300ms",children:jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__typography-wrapper",children:[jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__details",children:[jsxRuntimeExports.jsx(Icon,{size:"medium",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgUserAccount2,{})}),jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__wrapper",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",weight:"medium",copykey:"dyn_passkey_intro.helper.section_1.title",children:fr("dyn_passkey_intro.helper.section_1.title")}),jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-info-help-content__typography--label",copykey:"dyn_passkey_intro.helper.section_1.description",children:fr("dyn_passkey_intro.helper.section_1.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__details",children:[jsxRuntimeExports.jsx(Icon,{size:"medium",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgFooterKeyIcon,{})}),jsxRuntimeExports.jsxs("div",{className:"passkey-info-help-content__wrapper",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",weight:"medium",copykey:"dyn_passkey_intro.helper.section_2.title",children:fr("dyn_passkey_intro.helper.section_2.title")}),jsxRuntimeExports.jsx(Typography,{as:"p",variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-info-help-content__typography--label",copykey:"dyn_passkey_intro.helper.section_2.description",children:fr("dyn_passkey_intro.helper.section_2.description")})]})]})]})})})},HelpContent=()=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(HelpHeader,{}),jsxRuntimeExports.jsx(HelpContentSwitch,{})]}),HelpContentSwitch=()=>{const{view:fr}=useViewContext(),{projectSettings:br,newToWeb3WalletChainMap:wr,selectedWalletConnector:Er}=useInternalDynamicContext(),kr=reactExports.useMemo(()=>fr.type==="wallet-connect-mobile-wallets-list"||fr.type==="wallet-list"||fr.type==="login-with-email-or-wallet-full-wallet-list"||fr.type==="login-with-wallet-only",[fr]),jr=reactExports.useMemo(()=>fr.type==="pending-signature-without-back-button"||fr.type==="pending-signature",[fr]),Br=reactExports.useMemo(()=>fr.type==="pending-connect"||fr.type==="qr-code",[fr]),Wr=reactExports.useMemo(()=>fr.type==="passkey-intro",[fr]);return kr?jsxRuntimeExports.jsx(WalletListHelpContent,{chains:br==null?void 0:br.chains,newToWeb3WalletChainMap:wr}):jr?jsxRuntimeExports.jsx(WalletMoreInfoContent,{variant:"sign",wallet:Er||void 0}):Br?jsxRuntimeExports.jsx(WalletMoreInfoContent,{variant:"connect"}):Wr?jsxRuntimeExports.jsx(PasskeyInfoHelper,{}):jsxRuntimeExports.jsx(EmptyHelpContent,{})},TosAndPp=()=>{const{user:fr,authMode:br,customPrivacyPolicy:wr,customTermsOfServices:Er,privacyPolicyUrl:kr,termsOfServiceUrl:jr}=useInternalDynamicContext(),Br=isConnectOnly(fr,br)?"connecting":"logging in",Wr=()=>{if(jr)return jsxRuntimeExports.jsx("a",{className:"tos-and-pp__link",href:jr,target:"_blank",rel:"noreferrer",children:"Terms of Service"})},qr=()=>{if(kr)return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jr&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:" & "}),jsxRuntimeExports.jsx("a",{className:"tos-and-pp__link",href:kr,target:"_blank",rel:"noreferrer",children:"Privacy Policy"})]})};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[(kr||jr)&&jsxRuntimeExports.jsxs(Typography,{variant:"body_small",weight:"regular",className:"tos-and-pp__text",children:["By ",Br,", you agree to",jsxRuntimeExports.jsx("br",{}),"our ",Wr(),qr(),"."]}),Er,wr]})},ToSFooter=()=>{const{showToSFooter:fr}=useAuthLayoutChecks();return jsxRuntimeExports.jsx("div",{className:"tos-and-pp__footer",children:fr&&jsxRuntimeExports.jsx(TosAndPp,{})})},getChainStepState=(fr,br)=>{const wr=fr===br[0],Er=!br.includes(fr);return wr?"current":Er?"done":"upcoming"},typographyOpacityMap={current:"1",default:"1",done:"0.4",upcoming:"0.15"},Step=({children:fr,className:br,icon:wr,state:Er="default"})=>{const kr=reactExports.useMemo(()=>({opacity:Er==="upcoming"?.5:1}),[Er]),jr=reactExports.useMemo(()=>Er==="done"?jsxRuntimeExports.jsx("div",{className:"step__icon step__icon--done",children:jsxRuntimeExports.jsx(Icon,{className:"step__icon__check-mark",children:jsxRuntimeExports.jsx(SvgCheck,{style:kr})})}):wr?jsxRuntimeExports.jsx(Icon,{className:"step__icon",children:jsxRuntimeExports.jsx("div",{style:kr,children:wr})}):jsxRuntimeExports.jsx("div",{className:"step__index",children:jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_small",style:kr,children:jsxRuntimeExports.jsx("span",{className:"step__index-label"})})}),[wr,Er,kr]);return jsxRuntimeExports.jsxs("div",{className:classNames$1("step",br),children:[jr,jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_small",style:{opacity:typographyOpacityMap[Er]},children:fr})]})},Stepper=({children:fr})=>jsxRuntimeExports.jsx("div",{className:"stepper",children:reactExports.Children.map(fr,(br,wr)=>{const Er=wr===0?void 0:jsxRuntimeExports.jsx(Divider,{className:"stepper__divider"});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Er,br]})})}),WalletProgressStepper=()=>{const{bridgeChainsToConnect:fr=[],bridgeChains:br=[]}=useInternalDynamicContext(),wr=br.map(({chain:kr})=>kr),Er=[...fr].map(({chain:kr})=>kr);return jsxRuntimeExports.jsx("div",{className:"wallet-progress-stepper","data-testid":"wallet-progress-stepper",children:jsxRuntimeExports.jsx(Stepper,{children:wr.map((kr,jr)=>{var Br;const Wr=getChainInfoWithOverrides(kr),qr=getChainIcon(kr);return jsxRuntimeExports.jsx(Step,{state:getChainStepState(kr,Er),icon:jsxRuntimeExports.jsx(qr,{}),children:(Br=Wr==null?void 0:Wr.blockchainName)!==null&&Br!==void 0?Br:Wr==null?void 0:Wr.displayName},kr)})})})},DynamicAuthLayout=({children:fr,className:br,style:wr,onClose:Er,projectSettings:kr,hideBridgeProgressSteppers:jr})=>{const{view:Br}=useViewContext(),{authMode:Wr}=useInternalDynamicContext(),{isFooterExpanded:qr}=useFooterAnimationContext(),{headerData:Gr,helpHeaderData:Vr}=useDynamicLayoutData({authMode:Wr,view:Br.type}),{showConnectedWalletProgress:Zr,showHeader:Jr,showHelpContent:Qr,showToSFooter:_n,showDynamicFooter:En}=useAuthLayoutChecks();return jsxRuntimeExports.jsx(OverlayCardTarget,{children:jsxRuntimeExports.jsxs(VerticalAccordion,{style:wr,className:br,children:[jsxRuntimeExports.jsxs(AccordionItem,{isOpen:!qr,dimOnHide:!0,children:[Zr&&!jr&&jsxRuntimeExports.jsx(WalletProgressStepper,{}),Jr&&jsxRuntimeExports.jsx(Header,{onClose:Er,heading:(Gr==null?void 0:Gr.heading)||"",projectSettings:kr,copykey:Gr==null?void 0:Gr.copykey}),fr,_n&&jsxRuntimeExports.jsx(ToSFooter,{}),En&&jsxRuntimeExports.jsx(DynamicFooter,{})]}),Vr&&Qr&&jsxRuntimeExports.jsx(AccordionItem,{isOpen:qr,children:jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(HelpContent,{})},qr.toString())})]})})},SandboxIndicatorWrapper=({children:fr})=>{const{projectSettings:br}=useInternalDynamicContext(),wr=reactExports.useRef(null),[Er,kr]=reactExports.useState(void 0),jr=(br==null?void 0:br.environmentName)===EnvironmentEnum.Sandbox;return reactExports.useEffect(()=>{var Br;const Wr=(Br=wr.current)===null||Br===void 0?void 0:Br.clientHeight;kr(Wr)},[wr,kr]),jr?jsxRuntimeExports.jsxs("div",{style:{position:"relative"},children:[jsxRuntimeExports.jsx("div",{ref:wr,style:{background:"var(--dynamic-alert-1)",borderTopLeftRadius:"4px",borderTopRightRadius:"4px",color:"white",left:"calc( var(--dynamic-border-radius) + 8px)",padding:"2px 8px 4px",position:"absolute",top:-(Er||0)},"data-testid":"sandbox-indicator",children:capitalize$1((br==null?void 0:br.environmentName)||"")}),fr]}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:fr})},DynamicAuthModal=({children:fr,onClose:br,transitionProps:wr,projectSettings:Er,className:kr})=>{const{showConnectedWalletProgress:jr}=useAuthLayoutChecks();return jsxRuntimeExports.jsxs(Modal$1,{isShown:!!(wr!=null&&wr.isShown),children:[jr&&jsxRuntimeExports.jsx(ModalCard,{borderRadius:"small",children:jsxRuntimeExports.jsx(WalletProgressStepper,{})}),jsxRuntimeExports.jsx(SandboxIndicatorWrapper,{children:jsxRuntimeExports.jsx(ModalCard,{dataTestId:"dynamic-auth-modal",children:jsxRuntimeExports.jsx(DynamicAuthLayout,{className:kr,projectSettings:Er,onClose:br,hideBridgeProgressSteppers:!0,children:fr})})})]})},MockContext=reactExports.createContext(void 0),useMockContext=()=>{const fr=reactExports.useContext(MockContext);return fr===void 0?{mockedSDK:!1}:fr},LoadingContext=reactExports.createContext(void 0),LoadingContextProvider=({children:fr})=>{const[br,wr]=reactExports.useState(!1);useInternalDynamicEvents("logout",()=>wr(!1)),useInternalDynamicEvents("embeddedWalletCreated",()=>wr(!1));const Er=reactExports.useMemo(()=>({loading:br,setLoading:wr}),[br]);return jsxRuntimeExports.jsx(LoadingContext.Provider,{value:Er,children:fr})},useLoadingContext=()=>{const fr=reactExports.useContext(LoadingContext);if(fr===void 0)throw new Error("usage of useLoadingContext not wrapped in `LoadingContextProvider`.");return fr},{getProjectSettings,setProjectSettings,useProjectSettings,resetProjectSettings}=createStoreState("projectSettings"),useFetchProjectSettings=({environmentId:fr,retries:br=2})=>{const wr=useProjectSettings(),Er=!!(wr!=null&&wr.settings),{retrigger:kr}=usePromise(()=>__awaiter$e(void 0,void 0,void 0,function*(){const jr=yield fetchProjectSettings(fr);if(!jr)throw new DynamicError("Settings are not defined");return jr}),{deps:[fr],enabled:!Er,onResolve:jr=>{const Br=new Date().getTime()+3e5;setProjectSettings({expiresAt:Br,settings:jr})},retries:br});useDynamicEvents("logout",kr)},AccordionItem=reactExports.forwardRef(({children:fr,className:br="",isOpen:wr,dataTestId:Er,dimOnHide:kr=!1,handleScroll:jr=()=>{}},Br)=>{const Wr=reactExports.useRef(null),qr=reactExports.useRef(),[Gr]=useResizeObserver(Wr),Vr=reactExports.useMemo(()=>wr?Gr?Gr.height:qr.current:0,[wr,Gr]);return reactExports.useEffect(()=>{const Zr=Gr==null?void 0:Gr.height;Zr&&(qr.current=Zr)},[Gr]),jsxRuntimeExports.jsxs("div",{"data-testid":Er,style:{maxHeight:Vr},className:classNames$1(br,"accordion-item",{"accordion-item--full-height":!!Vr}),onScroll:jr,ref:Br,children:[kr&&jsxRuntimeExports.jsx("div",{"data-testid":"accordion-item-curtain",className:classNames$1("accordion-item__curtain",{"accordion-item__curtain--dimmed":!wr})}),jsxRuntimeExports.jsx("div",{ref:Wr,children:fr})]})});AccordionItem.displayName="AccordionItem";var _g$a,_defs$a,_excluded$F=["title","titleId"];function _extends$F(){return _extends$F=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$F(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgAccessBlocked=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$F(br,_excluded$F);return reactExports.createElement("svg",_extends$F({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_g$a||(_g$a=reactExports.createElement("g",{clipPath:"url(#access-blocked_svg__a)"},reactExports.createElement("circle",{cx:164,cy:114,r:114,fill:"url(#access-blocked_svg__b)",fillOpacity:.12}),reactExports.createElement("circle",{cx:220.352,cy:29.265,r:15.729,transform:"rotate(15 220.352 29.265)",fill:"#4779FF"}),reactExports.createElement("path",{d:"M223.594 23.62a1.573 1.573 0 1 0-3.038-.815l-1.629 6.078a1.573 1.573 0 1 0 3.039.814l1.628-6.077ZM219.225 33.848a1.573 1.573 0 0 0-.814 3.039l.015.004a1.574 1.574 0 0 0 .814-3.039l-.015-.004Z",fill:"#F9F9FB"}),reactExports.createElement("g",{clipPath:"url(#access-blocked_svg__c)",fill:"#4779FF"},reactExports.createElement("path",{d:"M101.972 36.04a8 8 0 0 1 9.798 5.657l-2.897.777a5 5 0 0 0-9.66 2.588l-2.897.776a8 8 0 0 1 5.656-9.797ZM118.498 47.487a5.333 5.333 0 0 0-6.532-3.772l-14.81 3.969a5.333 5.333 0 0 0-3.772 6.532l1.898 7.084a5.333 5.333 0 0 0 6.532 3.77l14.811-3.968a5.334 5.334 0 0 0 3.771-6.532l-1.898-7.083Z"})),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.313.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.336 9.336 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm-3.344 46.703c-1.172-2.936-2.026-7.051-2.236-11.797h9.298c-.21 4.746-1.064 8.861-2.236 11.797-.683 1.709-1.393 2.816-1.971 3.428-.198.21-.346.328-.442.393a2.703 2.703 0 0 1-.442-.392c-.578-.613-1.288-1.72-1.971-3.429Zm0-28.13c-1.208 3.025-2.078 7.301-2.253 12.228h9.332c-.175-4.927-1.045-9.203-2.253-12.227-.683-1.709-1.393-2.816-1.971-3.429a2.703 2.703 0 0 0-.442-.392 2.703 2.703 0 0 0-.442.392c-.578.613-1.288 1.72-1.971 3.429Zm-15.106 12.228h8.746c.21-6.38 1.506-11.989 3.423-15.668-6.57 2.184-11.466 8.283-12.169 15.668Zm.046 4.105h8.716c.253 6.201 1.533 11.642 3.407 15.238-6.442-2.141-11.274-8.046-12.123-15.238Zm34.946 0h-8.716c-.253 6.201-1.533 11.642-3.407 15.238 6.442-2.141 11.275-8.046 12.123-15.238Zm.133-2.267v.065-.131.066Zm-8.833-1.838h8.746c-.703-7.385-5.599-13.484-12.169-15.668 1.917 3.68 3.213 9.289 3.423 15.668Zm-8.909 19.795c0-.001.007-.004.023-.008a.077.077 0 0 1-.023.008Zm.25-.008a.064.064 0 0 1 .022.008s-.007-.001-.022-.008Zm.022-35.907c0 .001-.007.004-.023.008a.077.077 0 0 1 .023-.008Zm-.249.008c-.016-.004-.023-.007-.023-.008 0 0 .007.001.023.008Z",fill:"#4779FF"}))),_defs$a||(_defs$a=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"access-blocked_svg__a"},reactExports.createElement("rect",{width:327,height:112,rx:12,fill:"#fff"})),reactExports.createElement("clipPath",{id:"access-blocked_svg__c"},reactExports.createElement("path",{fill:"#fff",transform:"rotate(-15 188.268 -307.493)",d:"M0 0h32v32H0z"})),reactExports.createElement("linearGradient",{id:"access-blocked_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))};const AccessBlockedView=()=>{const[fr,br]=reactExports.useState(),{t:wr}=useTranslation(),{getIpConfiguration:Er}=useIpConfigurationContext();return usePromise(Er,{deps:[Er,fr],onResolve:kr=>br(kr==null?void 0:kr.country),retries:2}),jsxRuntimeExports.jsxs("div",{className:"access-blocked__container",children:[jsxRuntimeExports.jsx("div",{className:"access-blocked__icon",children:jsxRuntimeExports.jsx(SvgAccessBlocked,{})}),jsxRuntimeExports.jsx("div",{className:"access-blocked__content",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",children:wr("dyn_access_blocked.content",{jurisdiction:fr})})})]})};var _path$w,_excluded$E=["title","titleId"];function _extends$E(){return _extends$E=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$E(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgWalletConnectLogo=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$E(br,_excluded$E);return reactExports.createElement("svg",_extends$E({width:17,height:12,viewBox:"0 0 17 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$w||(_path$w=reactExports.createElement("path",{d:"M3.84 2.345c2.573-3.127 6.747-3.127 9.32 0l.31.376a.463.463 0 0 1 0 .566l-1.06 1.287a.145.145 0 0 1-.232 0l-.427-.518c-1.795-2.18-4.707-2.18-6.502 0l-.457.555a.145.145 0 0 1-.233 0L3.5 3.324a.463.463 0 0 1 0-.566l.34-.413Zm11.512 2.661.943 1.146a.463.463 0 0 1 0 .566l-4.252 5.165a.29.29 0 0 1-.466 0L8.558 8.217a.073.073 0 0 0-.116 0l-3.018 3.666a.29.29 0 0 1-.466 0L.705 6.718a.463.463 0 0 1 0-.566l.943-1.146a.29.29 0 0 1 .466 0l3.018 3.666c.032.04.085.04.117 0l3.018-3.666a.29.29 0 0 1 .466 0l3.018 3.666c.033.04.085.04.117 0l3.018-3.666a.29.29 0 0 1 .466 0Z",fill:"currentColor"})))};const Indicator=({indicator:fr,iconSize:br})=>{const wr={container:br*4/15,icon:br*3/15},Er={container:br/6,icon:br/9};return fr==="walletConnect"?jsxRuntimeExports.jsx("div",{className:"indicator__wallet-connect",style:{height:pixelToRem(wr.container),width:pixelToRem(wr.container)},children:jsxRuntimeExports.jsx(SvgWalletConnectLogo,{style:{height:pixelToRem(wr.icon),width:pixelToRem(wr.icon)}})}):jsxRuntimeExports.jsx("div",{className:"indicator__container indicator__container--connected",style:{height:pixelToRem(Er.container),width:pixelToRem(Er.container)},"data-testid":"connected-indicator",children:jsxRuntimeExports.jsx("div",{className:"indicator__icon",style:{height:pixelToRem(Er.icon),width:pixelToRem(Er.icon)}})})},iconRatio=7/11,IconWithSpinner=({iconSize:fr=24,Icon:br,isSpinning:wr=!1,className:Er="",indicator:kr,customSpinnerColor:jr,treatAsFunctionComponent:Br})=>{const Wr=fr*iconRatio,qr=fr/2,Gr=classNames$1("icon-with-spinner__container",Er),Vr=br;return jsxRuntimeExports.jsxs("div",{className:Gr,style:{height:pixelToRem(fr),width:pixelToRem(fr)},children:[br&&jsxRuntimeExports.jsxs("div",{style:{height:pixelToRem(Wr),width:pixelToRem(Wr)},className:"icon-with-spinner__icon-container",children:[Br||typeof br=="function"?jsxRuntimeExports.jsx(Vr,{height:Wr,width:Wr}):br,kr&&jsxRuntimeExports.jsx(Indicator,{indicator:kr,iconSize:fr})]}),wr&&!isLegacySafari()&&jsxRuntimeExports.jsx("div",{className:"icon-with-spinner__spinner-container icon-with-spinner__animation","data-chromatic":"ignore",style:{height:pixelToRem(fr),width:pixelToRem(fr)},children:jsxRuntimeExports.jsx(Spinner$1,{className:"icon-with-spinner__spinner",customSpinnerColor:jr,size:qr})})]})},IconListTile=fr=>{var{children:br,className:wr}=fr,Er=__rest$9(fr,["children","className"]);return jsxRuntimeExports.jsx(ListTile,Object.assign({},Er,{className:classNames$1(wr,"icon-list-tile"),children:jsxRuntimeExports.jsx("div",{className:"icon-list-tile--children",children:br})}))},isEmailProviderEnabled=fr=>fr!==void 0&&(isProviderEnabled(fr,ProviderEnum.Dynamic)||isProviderEnabled(fr,ProviderEnum.Blocto)||isProviderEnabled(fr,ProviderEnum.MagicLink)),findEmailOtpWalletConnector=fr=>fr.map(({walletConnector:wr})=>wr).find(wr=>isEmailWalletConnector(wr)&&wr.requiresNonDynamicEmailOtp),getEmailProvider=fr=>__awaiter$e(void 0,[fr],void 0,function*({email:br,environmentId:wr}){try{return yield sdkApi$1().getEmailProvider({email:br,environmentId:wr})}catch(Er){const kr=yield Er.json();throw logger$6.error(kr.error),new EmailProviderError(kr.code)}}),createEmailVerification=fr=>__awaiter$e(void 0,[fr],void 0,function*({email:br,environmentId:wr,captchaToken:Er}){try{return yield sdkApi$1().createEmailVerification({emailVerificationCreateRequest:{captchaToken:Er,email:br},environmentId:wr})}catch(kr){const jr=yield kr.json();throw logger$6.error(jr.error),new EmailVerificationError(jr.code)}}),signInWithEmailVerification=fr=>__awaiter$e(void 0,[fr],void 0,function*({verificationToken:br,verificationUUID:wr,environmentId:Er,captchaToken:kr,sessionPublicKey:jr}){try{return yield sdkApi$1().signInWithEmailVerification({emailVerificationVerifyRequest:{captchaToken:kr,sessionPublicKey:jr,verificationToken:br,verificationUUID:wr},environmentId:Er})}catch(Br){const Wr=yield Br.json();throw logger$6.error(Wr.error),Wr.error.code==="missing_from_list"?new NoAccessError({email:Wr.payload.email}):Wr.code==="email_associated_with_different_provider"?new AccountExistsError(Wr.error,Wr.payload):Wr.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(Wr.error.message):new EmailVerificationError(Wr.code)}}),retryEmailVerification=fr=>__awaiter$e(void 0,[fr],void 0,function*({email:br,environmentId:wr,verificationUUID:Er}){try{return yield sdkApi$1().retryEmailVerification({emailVerificationRetryRequest:{email:br,verificationUUID:Er},environmentId:wr})}catch(kr){const jr=yield kr.json();throw logger$6.error(jr.error),new EmailVerificationError(jr.code)}}),verifyEmail=fr=>__awaiter$e(void 0,[fr],void 0,function*({verificationToken:br,verificationUUID:wr,environmentId:Er}){try{return yield sdkApi$1().verifyEmailVerification({emailVerificationVerifyRequest:{verificationToken:br,verificationUUID:wr},environmentId:Er})}catch(kr){const jr=yield kr.json();throw logger$6.error(jr.error),jr.code===UnprocessableEntityErrorCode.UserHasAlreadyAccountWithEmail?new UserHasAccountWithEmailError(jr.error):jr.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(jr.error.message):new EmailVerificationError(jr.code)}}),useConnectWithEmail=({emailWalletConnector:fr,handleConnect:br})=>{const{error:wr}=useErrorContext(),[Er,kr]=reactExports.useState(!1),jr=Br=>__awaiter$e(void 0,void 0,void 0,function*(){if(!(!Br||!fr||Er)){kr(!0),fr.setEmail(Br);try{yield br(fr)}catch(Wr){logger$6.error(Wr),kr(!1)}}});return reactExports.useEffect(()=>{wr&&Er&&kr(!1)},[wr,Er]),{connectWithEmail:jr,loading:Er}},useEmailProvider=({emailWalletConnector:fr})=>{const{projectSettings:br,environmentId:wr}=useInternalDynamicContext(),{setDisplayedDestination:Er,setVerificationUUID:kr}=useVerification(),{setView:jr}=useViewContext(),{handleInstalledExtensionClick:Br}=useWalletItemActions(),{connectWithEmail:Wr,loading:qr}=useConnectWithEmail({emailWalletConnector:fr,handleConnect:Br}),{providers:Gr}=br||{},Zr=fr!==void 0&&(isProviderEnabled(Gr||[],ProviderEnum.MagicLink)||isProviderEnabled(Gr||[],ProviderEnum.Blocto)),Jr=(Cn,In)=>__awaiter$e(void 0,void 0,void 0,function*(){const{email:An,verificationUUID:jn}=yield createEmailVerification({captchaToken:In,email:Cn,environmentId:wr});jr("login-with-email-verification"),Er(An),kr(jn)}),Qr=Cn=>__awaiter$e(void 0,void 0,void 0,function*(){yield Wr(Cn)}),_n=(Cn,In)=>__awaiter$e(void 0,void 0,void 0,function*(){if(Zr){yield Qr(Cn);return}yield Jr(Cn,In)});return{handleEmailSubmitWithOptionalCaptcha:(Cn,In)=>__awaiter$e(void 0,void 0,void 0,function*(){dynamicEvents.emit("authInit",{email:Cn,option:Cn,type:"email"});try{if((fr!==void 0||isTurnkeyEnabled(br))&&(br!=null&&br.sdk.confirmEmailProviderForVerify)){const{emailProvider:An}=yield getEmailProvider({email:Cn,environmentId:wr});if(An===ProviderEnum.Dynamic){yield Jr(Cn,In);return}}yield _n(Cn,In)}catch(An){throw dynamicEvents.emit("authFailure",{email:Cn,option:Cn,type:"email"},{error:An}),An}}),isEmailProviderLoading:qr}},EMAIL_REGEX=/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i,isEmailValid=fr=>EMAIL_REGEX.test(fr);var _rect$1,_path$v,_excluded$D=["title","titleId"];function _extends$D(){return _extends$D=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$D(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgArrowRightBackground=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$D(br,_excluded$D);return reactExports.createElement("svg",_extends$D({width:25,height:24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_rect$1||(_rect$1=reactExports.createElement("rect",{x:.5,width:24,height:24,rx:12,fill:"var(--icon-background, var(--dynamic-hover))"})),_path$v||(_path$v=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.22 7.47a.75.75 0 0 1 1.06 0l3.75 3.75a.75.75 0 0 1 0 1.06l-3.75 3.75a.75.75 0 1 1-1.06-1.06l2.47-2.47H7.5a.75.75 0 0 1 0-1.5h8.19l-2.47-2.47a.75.75 0 0 1 0-1.06Z",fill:"var(--icon-arrow, var(--dynamic-text-secondary))"})))};const InlineSubmitButton=({disabled:fr,highlighted:br,isFocused:wr,isHovered:Er,className:kr,style:jr,emailSubmitButtonInsideInput:Br=!1})=>Br?jsxRuntimeExports.jsx(IconButton,{"data-testid":"in_line_submit_button",type:"submit",className:classNames$1("inline-submit-button",kr,{"inline-submit-button--active":wr||Er,"inline-submit-button--ready":br}),disabled:fr,style:jr,children:jsxRuntimeExports.jsx(SvgArrowRightBackground,{})}):null,EmailForm=({isLoading:fr,onSubmit:br,isEmailInvalid:wr=!1,currentEmail:Er,emailSubmitButtonInsideInput:kr=!1,buttonCopyKey:jr="dyn_login.email_form.submit_button.label",isDisabled:Br=!1,className:Wr,style:qr})=>{const{t:Gr}=useTranslation(),[Vr,Zr]=reactExports.useState(Er??""),[Jr,Qr]=reactExports.useState(!1),[_n,En]=reactExports.useState(!1),Cn=An=>{const{value:jn}=An.currentTarget;Zr(jn)},In=An=>__awaiter$e(void 0,void 0,void 0,function*(){An.preventDefault(),isEmailValid(Vr)&&(br==null||br(Vr))});return jsxRuntimeExports.jsxs("form",{className:classNames$1("login-with-email-form",Wr),style:qr,"data-testid":"email-form",onSubmit:An=>In(An),children:[jsxRuntimeExports.jsx(Input,{id:"email_field",value:Vr,onChange:Cn,copykey:"dyn_login.email_form.email_field.label",label:Gr("dyn_login.email_form.email_field.label"),error:wr,message:wr&&Gr("dyn_login.helper.email_form.invalid_email"),suffix:jsxRuntimeExports.jsx(InlineSubmitButton,{disabled:fr||Br,highlighted:Vr.length>0,isFocused:_n,isHovered:Jr,emailSubmitButtonInsideInput:kr}),disabled:fr||Br,type:"email",onPointerEnter:()=>Qr(!0),onPointerLeave:()=>Qr(!1),onFocus:()=>En(!0),onBlur:()=>En(!1),autoComplete:"email"}),!kr&&jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"submit_button",buttonClassName:"login-with-email-form__button",type:"submit",loading:fr,disabled:fr||Vr.length<3||Br,buttonVariant:"brand-primary",buttonPadding:"login-screen-height",expanded:!0,copykey:jr,typographyProps:{color:"inherit"},children:Gr(jr)})]})},LoginEmailForm=({isLoading:fr,onSubmit:br,onSubmitError:wr,currentEmail:Er,className:kr,style:jr})=>{var Br,Wr;const{walletConnectorOptions:qr,projectSettings:Gr}=useInternalDynamicContext(),{view:Vr,setView:Zr}=useViewContext(),{setErrorMessage:Jr}=useErrorContext(),{engageCaptcha:Qr}=useCaptchaContext(),[_n,En]=reactExports.useState(!1),Cn=findEmailOtpWalletConnector(qr),{handleEmailSubmitWithOptionalCaptcha:In,isEmailProviderLoading:An}=useEmailProvider({emailWalletConnector:Cn}),jn=reactExports.useMemo(()=>An||fr,[An,fr]),eo=to=>{to.code==="invalid_email_address"?En(!0):Jr(to.code),logger$6.debug(to),wr==null||wr()},ro=to=>__awaiter$e(void 0,void 0,void 0,function*(){var _i;try{if(br==null||br(),!((_i=Gr==null?void 0:Gr.security.hCaptcha)===null||_i===void 0)&&_i.enabled&&(Cn==null?void 0:Cn.key)!=="magicemailotp"){Qr({authMethod:"email",onCaptchaSuccess:oo=>__awaiter$e(void 0,void 0,void 0,function*(){try{yield In(to,oo)}catch(io){Zr(Vr.type),eo(io)}})});return}yield In(to)}catch(oo){eo(oo)}});return isEmailProviderEnabled((Br=Gr==null?void 0:Gr.providers)!==null&&Br!==void 0?Br:[])?jsxRuntimeExports.jsx(EmailForm,{onSubmit:ro,isLoading:jn,currentEmail:Er,emailSubmitButtonInsideInput:(Wr=Gr==null?void 0:Gr.design.modal)===null||Wr===void 0?void 0:Wr.emailSubmitButtonInsideInput,isEmailInvalid:_n,className:kr,style:jr}):(logger$6.error("Failed to render EmailSignInSection - no sign in provider enabled"),null)},AccountExistsView=()=>{const{existentAccountData:fr}=useAccountExistsContext(),{t:br}=useTranslation(),{email:wr,embeddedSocialSigninProvider:Er}=fr||{},kr=getSocialSignInProviderForProviderEnum(Er),{socialProvider:jr,setSocialProvider:Br,socialWalletConnector:Wr}=useSocialRedirectContext(),qr=useFindSocialIcon(),{mutate:Gr}=useMutation(()=>__awaiter$e(void 0,void 0,void 0,function*(){return Br(kr),yield Wr==null?void 0:Wr.endSession(),Wr==null?void 0:Wr.connect(Er)})),Vr=()=>Er?br("dyn_account_exists.description_social"):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[br("dyn_account_exists.description_email")," ",jsxRuntimeExports.jsx("strong",{children:wr})," ",br("dyn_account_exists.trail_message_email")]});return jsxRuntimeExports.jsxs("div",{className:"account-exists__container",children:[jsxRuntimeExports.jsx(UserProfileIcon,{className:"account-exists__image"}),jsxRuntimeExports.jsxs("div",{className:"account-exists__main",children:[jsxRuntimeExports.jsx("div",{className:"account-exists__content",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"account-exists__content--secondary",copykey:"dyn_account_exists",children:Vr()})}),Er?jsxRuntimeExports.jsxs(IconListTile,{dataTestId:`inline-${Er}`,onClick:()=>Gr(),className:"social-sign-in--tile",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:qr(Er),isSpinning:jr===kr,iconSize:32}),jsxRuntimeExports.jsx(Typography,{variant:"button_primary",copykey:"dyn_account_exists.connect",children:br("dyn_account_exists.connect",{socialOauth:capitalize$1(Er==null?void 0:Er.toString())})})]},Er):jsxRuntimeExports.jsx(LoginEmailForm,{isLoading:!1,currentEmail:wr})]})]})},BridgeNextWalletToConnectLayout=({chainName:fr,chainIcon:br,onClickAction:wr,onClickClose:Er})=>{const kr=Er&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:Er,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs("div",{className:"bridge-next-wallet-to-connect-layout",children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:kr,alignContent:"bottom",children:br&&jsxRuntimeExports.jsx("div",{className:"bridge-next-wallet-to-connect-layout__chain-icon",children:br})}),jsxRuntimeExports.jsxs("div",{className:"bridge-next-wallet-to-connect-layout__body",children:[jsxRuntimeExports.jsxs(Typography,{color:"primary",variant:"title",children:["Nice! Now let’s connect your ",fr," wallet"]}),jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,buttonPadding:"large",onClick:wr,children:`Connect ${fr} wallet`})]})]})},BridgeNextWalletConnectionView=()=>{const{setShowAuthFlow:fr,bridgeChainsToConnect:br}=useInternalDynamicContext(),{setView:wr}=useViewContext();if(!(br!=null&&br.length))throw new DynamicError("No wallets to connect");const[Er]=br,{chain:kr}=Er,jr=getChainInfoWithOverrides(kr),Br=getChainIcon(kr);if(!jr)throw new DynamicError("No chain info found for chain",kr);return jsxRuntimeExports.jsx(BridgeNextWalletToConnectLayout,{chainName:jr.blockchainName,chainIcon:jsxRuntimeExports.jsx(Br,{}),onClickAction:()=>wr("wallet-list"),onClickClose:()=>fr(!1,{emitCancelAuth:!0})})},ConnectedWalletsListLayout=({title:fr,body:br,onClickBack:wr,onClickClose:Er,onClickAction:kr,actionButtonText:jr="Continue",children:Br,copykey:Wr})=>{const qr=Er&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:Er,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})}),Gr=wr&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:wr,"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgChevronLeft,{})});return jsxRuntimeExports.jsxs("div",{className:"connected-wallets-list-layout",children:[jsxRuntimeExports.jsx(ModalHeader,{leading:Gr,trailing:qr,children:jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",copykey:Wr,children:fr})}),jsxRuntimeExports.jsxs("div",{className:"connected-wallets-list-layout__body",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",className:"connected-wallets-list-layout__body__text",children:br}),Br,jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"primary",onClick:kr,children:jr})]})]})},BridgeSummaryView=()=>{const{primaryWallet:fr,setShowAuthFlow:br,appName:wr,bridgeChains:Er=[]}=useInternalDynamicContext(),{t:kr}=useTranslation(),jr=()=>br(!1,{emitCancelAuth:!0}),Br=reactExports.useMemo(()=>{const qr=Er.map(({chain:Zr})=>{var Jr;return(Jr=getChainInfoWithOverrides(Zr))===null||Jr===void 0?void 0:Jr.blockchainName}),[Gr,Vr]=qr;return kr("dyn_bridge.summary_view.connection_succeed",{firstBlockchainName:Gr,secondBlockchainName:Vr})},[Er,kr]),Wr=qr=>{const Gr=getChainIcon(qr.chain),Vr=getChainInfoWithOverrides(qr.chain);return jsxRuntimeExports.jsx(DynamicBridgeWalletCard,{networkIcon:jsxRuntimeExports.jsx(Gr,{}),networkName:Vr==null?void 0:Vr.displayName,children:jsxRuntimeExports.jsx(DynamicBridgeWalletCardBody,{walletKey:qr.connector.key,walletAddress:qr.address,walletBalance:jsxRuntimeExports.jsx(Balance,{wallet:qr,network:qr.chain})})})};return jsxRuntimeExports.jsxs(ConnectedWalletsListLayout,{onClickClose:jr,onClickAction:jr,copykey:"dyn_bridge.summary_view.title",title:kr("dyn_bridge.summary_view.title",{appName:wr}),body:Br,children:[fr&&Wr(fr),jsxRuntimeExports.jsx(MemoSecondaryWallets,{hideUnlinkAction:!0})]})},BridgeWelcomeLayout=({body:fr,chains:br=[],onClickAction:wr,onClickClose:Er,title:kr,actionButtonText:jr,copykey:Br})=>{const Wr=Er&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:Er,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs("div",{className:"bridge-welcome-layout",children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Wr,alignContent:"bottom",children:jsxRuntimeExports.jsx("div",{className:"bridge-welcome-layout__chain-icon-group",children:[...br].reverse().map((qr,Gr)=>jsxRuntimeExports.jsx("div",{className:"bridge-welcome-layout__chain-icon",style:{zIndex:Gr},children:qr.icon},qr.id))})}),jsxRuntimeExports.jsxs("div",{className:"bridge-welcome-layout__body",children:[jsxRuntimeExports.jsxs("div",{className:"bridge-welcome-layout__message-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",copykey:Br,children:kr}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",children:fr})]}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Stepper,{children:br.map(qr=>jsxRuntimeExports.jsx(Step,{children:qr.name},qr.id))})}),jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"primary",buttonPadding:"large",onClick:wr,children:jr})]})]})},isChainInfoDefined=fr=>fr!==void 0,BridgeWelcomeView=()=>{const{appName:fr,bridgeChains:br=[],setShowAuthFlow:wr}=useInternalDynamicContext(),{setView:Er}=useViewContext(),{t:kr}=useTranslation(),jr=reactExports.useMemo(()=>{const Wr=br.map(({chain:Vr})=>{var Zr;return(Zr=getChainInfoWithOverrides(Vr))===null||Zr===void 0?void 0:Zr.blockchainName}),[qr,Gr]=Wr;return kr("dyn_bridge.welcome_view.description",{firstBlockchainName:qr,secondBlockchainName:Gr})},[br,kr]),Br=reactExports.useMemo(()=>br.map(({chain:Wr},qr)=>{const Gr=getChainInfoWithOverrides(Wr),Vr=getChainIcon(Wr);if(Gr&&Vr)return{icon:jsxRuntimeExports.jsx(Vr,{}),id:qr,name:Gr.blockchainName}}).filter(isChainInfoDefined),[br]);return jsxRuntimeExports.jsx(BridgeWelcomeLayout,{onClickClose:()=>wr(!1,{emitCancelAuth:!0}),title:kr("dyn_bridge.welcome_view.title",{appName:fr}),copykey:"dyn_bridge.welcome_view.title",body:jr,chains:Br,actionButtonText:kr("dyn_bridge.welcome_view.button"),onClickAction:()=>Er("wallet-list")})},Captcha=({handleSuccess:fr})=>{var br;const{projectSettings:wr}=useInternalDynamicContext();return!((br=wr==null?void 0:wr.security.hCaptcha)===null||br===void 0)&&br.siteKey?jsxRuntimeExports.jsx("form",{"data-testid":"captcha-form",children:jsxRuntimeExports.jsx(HCaptcha,{sitekey:wr.security.hCaptcha.siteKey,onVerify:Er=>fr(Er),theme:document.body.dataset.dynamicTheme})}):null},CaptchaVerifyUser=()=>{const{t:fr}=useTranslation(),{captchaAuthState:br,setCaptchaToken:wr}=useCaptchaContext(),Er=kr=>__awaiter$e(void 0,void 0,void 0,function*(){var jr;wr(kr),yield(jr=br==null?void 0:br.onCaptchaSuccess)===null||jr===void 0?void 0:jr.call(br,kr)});return jsxRuntimeExports.jsxs("div",{className:"captcha-verify-user__container",children:[jsxRuntimeExports.jsx(CaptchaWaveIcon,{className:"captcha-verify-user__icon"}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",color:"primary",className:"captcha-verify-user__title",copykey:"dyn_captcha.verify_user_title",children:fr("dyn_captcha.verify_user_title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"captcha-verify-user__subtitle",copykey:"dyn_captcha.verify_user_subtitle",children:fr("dyn_captcha.verify_user_subtitle")}),jsxRuntimeExports.jsx(Captcha,{handleSuccess:Er}),jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"captcha-verify-user__dynamic-logo"})]})};var _path$u,_excluded$C=["title","titleId"];function _extends$C(){return _extends$C=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$C(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgAltKey=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$C(br,_excluded$C);return reactExports.createElement("svg",_extends$C({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$u||(_path$u=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 4a5 5 0 0 0-4.786 6.453 1 1 0 0 1-.25.997L4 17.414V20h2v-1a1 1 0 0 1 1-1h1v-1a1 1 0 0 1 1-1h1.586l1.964-1.964a1 1 0 0 1 .997-.25A5 5 0 1 0 15 4ZM8 20v1a1 1 0 0 1-1 1H4a2 2 0 0 1-2-2v-2.586A2 2 0 0 1 2.586 16l5.562-5.562a7 7 0 1 1 5.414 5.414l-1.855 1.855A1 1 0 0 1 11 18h-1v1a1 1 0 0 1-1 1H8Zm6-13a1 1 0 0 1 1-1 3 3 0 0 1 3 3 1 1 0 1 1-2 0 1 1 0 0 0-1-1 1 1 0 0 1-1-1Z",fill:"#383C48",fillOpacity:.4})))},_path$t,_excluded$B=["title","titleId"];function _extends$B(){return _extends$B=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$B(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgLock=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$B(br,_excluded$B);return reactExports.createElement("svg",_extends$B({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$t||(_path$t=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7 7a5 5 0 0 1 10 0v3h1a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3v-6a3 3 0 0 1 3-3h1V7Zm2 3h6V7a3 3 0 1 0-6 0v3Zm-3 2a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1H6Zm6 2a1 1 0 0 1 1 1v2a1 1 0 1 1-2 0v-2a1 1 0 0 1 1-1Z",fill:"#383C48",fillOpacity:.4})))},_path$s,_path2$4,_path3$3,_path4$2,_g$9,_path5$2,_defs$9,_excluded$A=["title","titleId"];function _extends$A(){return _extends$A=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$A(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgWalletClaimHero=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$A(br,_excluded$A);return reactExports.createElement("svg",_extends$A({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,reactExports.createElement("g",{clipPath:"url(#wallet-claim-hero_svg__a)"},reactExports.createElement("mask",{id:"wallet-claim-hero_svg__b",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:0,y:0,width:327,height:112},_path$s||(_path$s=reactExports.createElement("path",{d:"M315 0H12C5.373 0 0 5.373 0 12v88c0 6.627 5.373 12 12 12h303c6.627 0 12-5.373 12-12V12c0-6.627-5.373-12-12-12Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#wallet-claim-hero_svg__b)"},_path2$4||(_path2$4=reactExports.createElement("path",{d:"M164 228c62.96 0 114-51.04 114-114S226.96 0 164 0 50 51.04 50 114s51.04 114 114 114Z",fill:"url(#wallet-claim-hero_svg__c)",fillOpacity:.12})),reactExports.createElement("mask",{id:"wallet-claim-hero_svg__d",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:86,y:29,width:40,height:40},_path3$3||(_path3$3=reactExports.createElement("path",{d:"M116.91 29 86 37.282l8.282 30.91 30.91-8.282L116.91 29Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#wallet-claim-hero_svg__d)"},reactExports.createElement("mask",{id:"wallet-claim-hero_svg__e",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:90,y:33,width:31,height:31},_path4$2||(_path4$2=reactExports.createElement("path",{d:"M119.763 44.8c-2.097-7.824-10.139-12.467-17.963-10.371-7.824 2.096-12.468 10.139-10.371 17.963 2.096 7.824 10.139 12.467 17.963 10.37 7.824-2.096 12.467-10.138 10.371-17.962Z",fill:"#fff"}))),_g$9||(_g$9=reactExports.createElement("g",{mask:"url(#wallet-claim-hero_svg__e)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M118.709 55.166a14.617 14.617 0 0 0 1.054-10.366c-2.097-7.824-10.139-12.467-17.963-10.371-7.825 2.096-12.468 10.139-10.371 17.963a14.612 14.612 0 0 0 6.097 8.451c1.808-3.916 6.565-6.42 9.647-7.247 3.083-.826 7.955-1.146 11.536 1.57Zm-19.375-8.688a5.5 5.5 0 1 1 10.625-2.848 5.5 5.5 0 0 1-10.625 2.848Z",fill:"#4779FF"})))),_path5$2||(_path5$2=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.269 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.89 32.064a6.223 6.223 0 0 0-1.78 0c-.68.098-1.313.337-1.815.527l-.135.05-16.681 6.256-.406.152c-1.922.718-3.61 1.348-4.91 2.493a9.333 9.333 0 0 0-2.552 3.683c-.616 1.62-.614 3.421-.611 5.473l.001.434V66.01c0 8.793 4.782 16.125 9.952 21.51 5.205 5.422 11.159 9.252 14.308 11.089l.127.075c.575.337 1.321.775 2.307.987a6.624 6.624 0 0 0 2.61 0c.986-.212 1.732-.65 2.307-.987l.127-.075c3.149-1.837 9.103-5.667 14.308-11.088 5.17-5.386 9.952-12.718 9.952-21.511V51.13l.001-.433c.003-2.052.005-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.988-1.775-4.91-2.493-.134-.05-.27-.1-.406-.152l-16.681-6.255-.135-.05c-.502-.19-1.135-.43-1.815-.528Zm-6.946 16.362a9.282 9.282 0 1 1 13.127 13.128 9.282 9.282 0 0 1-13.127-13.128Zm3.282 3.282a4.64 4.64 0 1 1 6.563 6.563 4.64 4.64 0 0 1-6.563-6.563Zm3.515 14.885a11.63 11.63 0 0 1-2.945-.377v15.598h4.641v-4.51h4.601v-4.642h-4.601V66.47a11.69 11.69 0 0 1-1.696.123Z",fill:"#4779FF"})))),_defs$9||(_defs$9=reactExports.createElement("defs",null,reactExports.createElement("linearGradient",{id:"wallet-claim-hero_svg__c",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})),reactExports.createElement("clipPath",{id:"wallet-claim-hero_svg__a"},reactExports.createElement("path",{fill:"#fff",d:"M0 0h327v112H0z"})))))};const CoinbaseMPCClaimIntro=()=>{const{setShowAuthFlow:fr}=useInternalDynamicContext(),{setView:br}=useViewContext(),{t:wr}=useTranslation(),Er=jsxRuntimeExports.jsx(IconButton,{onClick:()=>fr(!1),type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Er,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_create_password.intro.title",children:wr("dyn_create_password.intro.title")})}),jsxRuntimeExports.jsx("div",{className:"mpc-claim-intro",children:jsxRuntimeExports.jsxs("div",{className:"mpc-claim-intro__body",children:[jsxRuntimeExports.jsx("div",{className:"mpc-claim-intro__body__description",children:jsxRuntimeExports.jsx(SvgWalletClaimHero,{})}),jsxRuntimeExports.jsx("div",{className:"confirm-password-description",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_create_password.intro.description",children:wr("dyn_create_password.intro.description.title")})}),jsxRuntimeExports.jsxs("div",{className:"mpc-claim-intro__body__card",children:[jsxRuntimeExports.jsxs("div",{className:"mpc-claim-intro__body__card__statement",children:[jsxRuntimeExports.jsx("div",{className:"mpc-claim-intro__body__card__icon",children:jsxRuntimeExports.jsx(SvgLock,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_create_password.intro.description.additional_protection.title",children:wr("dyn_create_password.intro.description.additional_protection.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",weight:"regular",copykey:"dyn_create_password.intro.description.additional_protection.description",children:wr("dyn_create_password.intro.description.additional_protection.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mpc-claim-intro__body__card__statement",children:[jsxRuntimeExports.jsx("div",{className:"mpc-claim-intro__body__card__icon",children:jsxRuntimeExports.jsx(SvgAltKey,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_create_password.intro.description.restore_access.title",children:wr("dyn_create_password.intro.description.restore_access.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",weight:"regular",copykey:"dyn_create_password.intro.description.restore_access.description",children:wr("dyn_create_password.intro.description.restore_access.description")})]})]})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},onClick:()=>{br("create-password-view",{notCalledFromWalletUtils:!0})},copykey:"dyn_create_password.intro.continue",children:wr("dyn_create_password.intro.continue")})]})})]})};var _path$r,_excluded$z=["title","titleId"];function _extends$z(){return _extends$z=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$z(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgCheckConnection=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$z(br,_excluded$z);return reactExports.createElement("svg",_extends$z({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$r||(_path$r=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm12.845-39.155a1.667 1.667 0 1 0-2.357-2.357L27.5 37.976l-5.488-5.488a1.667 1.667 0 1 0-2.357 2.357l6.666 6.667c.651.65 1.707.65 2.357 0l16.667-16.667Z",fill:"#4779FF"})))};const createSmsVerification=fr=>__awaiter$e(void 0,[fr],void 0,function*({isoCountryCode:br,phoneNumber:wr,phoneCountryCode:Er,environmentId:kr,captchaToken:jr}){try{return yield sdkApi$1().createSmsVerification({environmentId:kr,smsVerificationCreateRequest:{captchaToken:jr,isoCountryCode:br,phoneCountryCode:Er,phoneNumber:wr}})}catch(Br){const Wr=yield Br.json();throw logger$6.error(Wr.error),new SmsVerificationError(Wr.error,Wr.code)}}),signInWithSmsVerification=fr=>__awaiter$e(void 0,[fr],void 0,function*({verificationToken:br,verificationUUID:wr,environmentId:Er,captchaToken:kr,sessionPublicKey:jr}){var Br;try{return yield sdkApi$1().signInWithSmsVerification({environmentId:Er,smsVerificationVerifyRequest:{captchaToken:kr,sessionPublicKey:jr,verificationToken:br,verificationUUID:wr}})}catch(Wr){const qr=yield Wr.json();throw logger$6.error(qr.error),((Br=qr.error)===null||Br===void 0?void 0:Br.code)==="missing_from_list"?new NoAccessError({phoneNumber:qr.payload.phoneNumber}):qr.code==="wrong_sms_verification_token"?new SmsVerificationError(Locale.getInstance().t("dyn_login.helper.phone_number_form.invalid_sms_verification"),qr.code):qr.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(qr.error.message):new SmsVerificationError(qr.error,qr.code)}}),retrySmsVerification=fr=>__awaiter$e(void 0,[fr],void 0,function*({isoCountryCode:br,phoneCountryCode:wr,phoneNumber:Er,environmentId:kr,verificationUUID:jr}){try{return yield sdkApi$1().retrySmsVerification({environmentId:kr,smsVerificationRetryRequest:{isoCountryCode:br,phoneCountryCode:wr,phoneNumber:Er,verificationUUID:jr}})}catch(Br){const Wr=yield Br.json();throw logger$6.error(Wr.error),new SmsVerificationError(Wr.error,Wr.code)}}),verifySms=fr=>__awaiter$e(void 0,[fr],void 0,function*({verificationToken:br,verificationUUID:wr,environmentId:Er}){try{return yield sdkApi$1().verifySmsVerification({environmentId:Er,smsVerificationVerifyRequest:{verificationToken:br,verificationUUID:wr}})}catch(kr){const jr=yield kr.json();throw logger$6.error(jr.error),jr.error.code==="sandbox_maximum_threshold_reached"?new SandboxMaximumThresholdReachedError(jr.error.message):new SmsVerificationError(jr.error,jr.code)}}),useOtpVerificationRequestRaw=()=>{const{environmentId:fr,user:br,userWithMissingInfo:wr}=useInternalDynamicContext(),{verificationUUID:Er}=useVerification();return{verifyOtp:reactExports.useCallback((jr,Br,Wr,qr)=>__awaiter$e(void 0,void 0,void 0,function*(){var Gr;if(!br&&!wr)throw new DynamicError(USER_NOT_LOGGED_IN);if(!qr&&!Er)throw new DynamicError("No verification UUID is available");const Jr=yield(Wr==="email"?verifyEmail:verifySms)({environmentId:fr,verificationToken:Br,verificationUUID:qr??Er}),Qr=Jr.user,_n=(Gr=Qr==null?void 0:Qr.missingFields)!==null&&Gr!==void 0?Gr:[],En=getVerificationDestination(Jr.nextView);return storeAuthTokenAndUser(Jr),En?jr({destination:En,missingFields:_n,updateUserProfileResponse:Jr}):{isEmailVerificationRequired:!1,isSmsVerificationRequired:!1,missingFields:_n,updateUserProfileResponse:Jr}}),[Er,fr,br,wr])}},useOtpVerificationRequest=()=>{const fr=useHandleVerificationRequired(),{verifyOtp:br}=useOtpVerificationRequestRaw();return reactExports.useMemo(()=>({verifyOtp:(wr,Er,kr)=>br(fr,wr,Er,kr)}),[fr,br])},getResponseInfo=(fr,br)=>{var wr,Er,kr,jr,Br,Wr,qr;return br==="email"?{displayDestination:(wr=fr.emailVerification)===null||wr===void 0?void 0:wr.email,verificationUUID:(Er=fr.emailVerification)===null||Er===void 0?void 0:Er.verificationUUID}:{displayDestination:formatPhone("+"+((jr=(kr=fr.smsVerification)===null||kr===void 0?void 0:kr.phoneCountryCode)!==null&&jr!==void 0?jr:"")+((Wr=(Br=fr.smsVerification)===null||Br===void 0?void 0:Br.phoneNumber)!==null&&Wr!==void 0?Wr:"")),verificationUUID:(qr=fr.smsVerification)===null||qr===void 0?void 0:qr.verificationUUID}},getVerificationDestination=fr=>{if(fr===NextViewEnum.VerifyEmail)return"email";if(fr===NextViewEnum.VerifySms)return"sms"},useHandleVerificationRequired=()=>{const{setVerificationUUID:fr,setDisplayedDestination:br}=useVerification(),{environmentId:wr}=useInternalDynamicContext(),{verifyOtp:Er}=useOtpVerificationRequestRaw(),kr=reactExports.useCallback((Br,Wr)=>__awaiter$e(void 0,void 0,void 0,function*(){if(Br==="email"&&Wr.emailVerification||Br==="sms"&&Wr.smsVerification)return Wr;const qr=Br==="email"?"email":"phoneNumber";if(!Wr.user[qr])throw new VerificationDataCollectionError(`missing ${qr} field to perform update`);const Gr=yield userFieldsSchema.validate({[qr]:Wr.user[qr]}),{emailVerification:Vr,smsVerification:Zr}=yield updateUserProfileFields(wr,Gr);if(Br==="email"&&!Vr||Br==="sms"&&!Zr)throw new VerificationDataCollectionError(`could not get ${Br} verification data from api`);return Object.assign(Object.assign({},Wr),{emailVerification:Vr,smsVerification:Zr})}),[wr]),jr=reactExports.useCallback(Br=>__awaiter$e(void 0,[Br],void 0,function*({updateUserProfileResponse:Wr,missingFields:qr,destination:Gr}){const Vr=yield kr(Gr,Wr),{displayDestination:Zr,verificationUUID:Jr}=getResponseInfo(Vr,Gr);br(Zr),fr(Jr);const Qr=_n=>__awaiter$e(void 0,void 0,void 0,function*(){return Er(jr,_n,Gr,Jr)});return Gr==="email"?{isEmailVerificationRequired:!0,isSmsVerificationRequired:!1,missingFields:qr,updateUserProfileResponse:Vr,verifyOtp:Qr}:{isEmailVerificationRequired:!1,isSmsVerificationRequired:!0,missingFields:qr,updateUserProfileResponse:Vr,verifyOtp:Qr}}),[kr,br,fr,Er]);return jr},useUpdateUser=fr=>{const{environmentId:br,userWithMissingInfo:wr,setCallback:Er}=useInternalDynamicContext(),{setRetryData:kr}=useVerification(),{selectedPhoneCountry:jr}=useFieldsState(),Br=useHandleVerificationRequired();return reactExports.useCallback((qr,Gr)=>__awaiter$e(void 0,void 0,void 0,function*(){var Vr,Zr;let{metadata:Jr}=qr;Jr=Jr?Object.assign(Object.assign({},wr==null?void 0:wr.metadata),Jr):wr==null?void 0:wr.metadata;const Qr=yield userFieldsSchema.validate(qr,{stripUnknown:fr});Qr.phoneNumber&&Qr.phoneNumber.length>0&&jr.current&&kr({dialCode:jr.current.dialCode,iso2:jr.current.iso2,phone:Qr.phoneNumber});const _n=yield updateUserProfileFields((Vr=Gr==null?void 0:Gr.userEnvironmentId)!==null&&Vr!==void 0?Vr:br,Object.assign(Object.assign({},Qr),{metadata:Jr})),En=(Zr=_n.user.missingFields)!==null&&Zr!==void 0?Zr:[],Cn=getVerificationDestination(_n.nextView);return Cn?Br({destination:Cn,missingFields:En,updateUserProfileResponse:_n}):(Er("userProfileUpdate"),{isEmailVerificationRequired:!1,isSmsVerificationRequired:!1,missingFields:En,updateUserProfileResponse:_n})}),[wr==null?void 0:wr.metadata,fr,jr,kr,br,Br,Er])},validateUpdateRequest=(fr,br,wr)=>{if(!fr.length)return"At least one field must be provided for editing";if(!br)return"No signed-in user";const Er=getUserProfileFields({customFields:wr==null?void 0:wr.customFields,projectSettingsKyc:wr==null?void 0:wr.kyc,user:br});for(const kr of fr)if(!Er.find(({name:jr})=>jr===kr))return`Please ensure field "${kr}" is enabled under "Configurations > Onboarding > Information capture" in your app's dashboard before using it with updateUserWithModal`;return""},saveUserValues=(fr,br,wr,Er,kr)=>__awaiter$e(void 0,[fr,br,wr,Er,kr],void 0,function*({fields:jr,updateUserResult:{isEmailVerificationRequired:Br,isSmsVerificationRequired:Wr}},qr,Gr,Vr,Zr){if(!Br&&!Wr){Vr(jr);return}if(qr(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1}),Br){Gr("verify-email"),dynamicEvents.once("emailVerificationResult",(Jr,Qr)=>{jr.email=Qr,Jr?Vr(jr):Zr("Failed to verify email, no fields were updated")});return}Gr("verify-sms"),dynamicEvents.once("smsVerificationResult",(Jr,{phone:Qr})=>{jr.phoneNumber=Qr,Jr?Vr(jr):Zr("Failed to verify phone number, no fields were updated")})}),useUpdateUserWithModal=fr=>{const{user:br,projectSettings:wr,setShowAuthFlow:Er}=useInternalDynamicContext(),{setView:kr}=useViewContext(),jr=reactExports.useContext(UserFieldEditorContext);if(!jr)throw new DynamicError("useUserUpdateRequest can only be used inside the context of DynamicContextProvider");const{open:Br}=jr;return reactExports.useCallback((qr,Gr)=>new Promise((Vr,Zr)=>{const Jr=validateUpdateRequest(qr,br,wr);if(Jr){Zr(Jr);return}Br({fields:qr,submitText:Gr==null?void 0:Gr.submitText,subtitle:Gr==null?void 0:Gr.subtitle,title:Gr==null?void 0:Gr.title},fr).then(Qr=>saveUserValues(Qr,Er,kr,Vr,Zr)).catch(Qr=>{if(/email already exists/gi.test(Qr))throw Qr;Zr(Qr)})}),[br,wr,Br,fr,Er,kr])},useUserUpdateRequestInternal=({validationSchemaStripUnknown:fr})=>{const br=useUpdateUser(fr),wr=useUpdateUserWithModal(br);return{updateUser:br,updateUserWithModal:wr}},OnboardingUserDataForm=({children:fr,userProfile:br,disableSubmit:wr})=>{const{policiesConsentInnerComponent:Er,userWithMissingInfo:kr}=useInternalDynamicContext(),{error:jr}=useErrorContext(),{completeAuth:Br}=useUserAuth({}),{updateUser:Wr}=useUserUpdateRequestInternal({validationSchemaStripUnknown:!1}),qr=reactExports.useCallback(En=>__awaiter$e(void 0,void 0,void 0,function*(){yield Br({updateJwtFunction:()=>__awaiter$e(void 0,void 0,void 0,function*(){return Wr(En)})})}),[Br,Wr]),{fetch:Gr,formikInitialValues:Vr,formikValidationSchema:Zr,enforcePolicies:Jr,onFormSubmit:Qr}=useUserDataForm({fields:(kr==null?void 0:kr.missingFields)||[],onSubmit:qr,userProfile:br}),_n=[Er].flat();return jsxRuntimeExports.jsx(Formik,{onSubmit:Qr,initialValues:Vr,validationSchema:Zr,children:({errors:En,touched:Cn,values:In})=>{var An;const jn=wr||Jr&&(_n==null?void 0:_n.length)!==((An=In.policiesConsentArray)===null||An===void 0?void 0:An.length);return jsxRuntimeExports.jsx(Form,{className:"user-data-form__form",children:jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[fr,jr&&jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",className:"user-data-form__error",children:jr}),jsxRuntimeExports.jsx(UserDataFields,{fields:kr==null?void 0:kr.missingFields,errors:En,touched:Cn,policiesConsentInnerComponentArray:_n}),jsxRuntimeExports.jsx(TypographyButton,{type:"submit",loading:Gr,disabled:jn,buttonVariant:"primary",expanded:!0,buttonPadding:"login-screen-height",children:"Continue"})]})})}})},CollectUserDataView=()=>{var fr;const{appName:br,projectSettings:wr,network:Er,selectedWalletConnector:kr,handleLogOut:jr,onboardingImageUrl:Br,userWithMissingInfo:Wr}=useInternalDynamicContext(),[qr,Gr]=reactExports.useState(!1),Vr=useFetchNameService(),{t:Zr}=useTranslation();if(!Wr)return null;const Jr=(kr==null?void 0:kr.evmNetworks)||[],_n=!(!Er||isSupportedNetwork({network:Er,walletConnector:kr}))&&!!kr,En=(fr=Wr==null?void 0:Wr.verifiedCredentials.find(Cn=>Cn.id===Wr.lastVerifiedCredentialId))===null||fr===void 0?void 0:fr.address;return jsxRuntimeExports.jsxs("div",{className:"collect-user-data","data-testid":"collect-user-data-view",children:[jsxRuntimeExports.jsxs("div",{className:"collect-user-data__network-container",children:[jsxRuntimeExports.jsxs("div",{className:"collect-user-data__img-container",children:[Vr!=null&&Vr.avatar?jsxRuntimeExports.jsx("img",{src:Vr.avatar,alt:"",className:"collect-user-data__img collect-user-data__img--rounded"}):jsxRuntimeExports.jsx(AuthProviderIcon,{iconSize:28}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"medium",className:"collect-user-data__wallet-address",children:(Vr==null?void 0:Vr.name)||shortenWalletAddress(En,3,3)})]}),kr&&jsxRuntimeExports.jsx(NetworkPicker,{currentNetwork:Er,evmNetworks:Jr,connector:kr,showNetworkName:!0,isNetworkPickerOpen:qr,setIsNetworkPickerOpen:Gr,buttonClassName:"collect-user-data__network-picker-button",mainClassName:"collect-user-data__network-picker"})]}),Br&&jsxRuntimeExports.jsx("img",{className:"collect-user-data__main-img",src:Br,alt:"onboarding"}),_n&&jsxRuntimeExports.jsx(ErrorContainer,{withIcon:!1,className:"collect-user-data__error--not-supported",copykey:"dyn_collect_user_data.not_supported_network.error_message",children:Zr("dyn_collect_user_data.not_supported_network.error_message")}),jsxRuntimeExports.jsxs("div",{className:classNames$1("collect-user-data__form",{"collect-user-data__form--error":_n}),children:[jsxRuntimeExports.jsx("div",{className:"collect-user-data__success-icon",children:jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"large",children:jsxRuntimeExports.jsx(SvgCheckConnection,{})})}),jsxRuntimeExports.jsx(OnboardingUserDataForm,{disableSubmit:_n,userProfile:Wr,children:_n?jsxRuntimeExports.jsxs("div",{className:"collect-user-data__welcome-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"collect-user-data__welcome-title",copykey:"dyn_collect_user_data.not_supported_network.title",children:Zr("dyn_collect_user_data.not_supported_network.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_collect_user_data.not_supported_network.description",children:Zr("dyn_collect_user_data.not_supported_network.description")})]}):jsxRuntimeExports.jsxs("div",{className:"collect-user-data__welcome-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"collect-user-data__welcome-title",copykey:"dyn_collect_user_data.greeting",children:(wr==null?void 0:wr.general.collectUserDataWelcomeHeader)||Zr("dyn_collect_user_data.greeting",{appName:br})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_collect_user_data.description",children:(wr==null?void 0:wr.general.collectUserDataWelcomeMessage)||Zr("dyn_collect_user_data.description")})]})}),jsxRuntimeExports.jsx(TextButton,{className:"collect-user-data__log-out",onClick:jr,copykey:"dyn_collect_user_data.log_out_button",children:Zr("dyn_collect_user_data.log_out_button")})]})]})},CollectUserDataViewNoWallet=({userIdentification:fr,userIdentificationOverride:br})=>{var wr;const{appName:Er,handleLogOut:kr,projectSettings:jr,onboardingImageUrl:Br,userWithMissingInfo:Wr}=useInternalDynamicContext(),{t:qr}=useTranslation();return Wr?jsxRuntimeExports.jsxs("div",{className:"collect-user-data-login-no-wallet","data-testid":"collect-user-data-login-no-wallet",children:[Br&&jsxRuntimeExports.jsx("img",{className:"collect-user-data-login-no-wallet__main-img",src:Br,alt:"onboarding"}),jsxRuntimeExports.jsxs("div",{className:"collect-user-data-login-no-wallet__user-info-container",children:[jsxRuntimeExports.jsx("div",{className:"collect-user-data-login-no-wallet__icon-container",children:jsxRuntimeExports.jsx(UserAvatar,{user:Wr})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"medium",className:"collect-user-data-login-no-wallet__user-identification",children:(wr=br??Wr[fr])!==null&&wr!==void 0?wr:getUserIdentifier(Wr)})]}),jsxRuntimeExports.jsxs("div",{className:"collect-user-data-login-no-wallet__form",children:[jsxRuntimeExports.jsx("div",{className:"collect-user-data-login-no-wallet__success-icon",children:jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"large",children:jsxRuntimeExports.jsx(SvgCheckConnection,{})})}),jsxRuntimeExports.jsx(OnboardingUserDataForm,{userProfile:Wr,children:jsxRuntimeExports.jsxs("div",{className:"collect-user-data-login-no-wallet__welcome-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"collect-user-data-login-no-wallet__welcome-title",copykey:"dyn_collect_user_data.greeting",children:(jr==null?void 0:jr.general.collectUserDataWelcomeHeader)||qr("dyn_collect_user_data.greeting",{appName:Er})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_collect_user_data.description",children:(jr==null?void 0:jr.general.collectUserDataWelcomeMessage)||qr("dyn_collect_user_data.description")})]})}),jsxRuntimeExports.jsx(TextButton,{className:"collect-user-data-login-no-wallet__log-out",onClick:kr,copykey:"dyn_collect_user_data.log_out_button",children:qr("dyn_collect_user_data.log_out_button")})]})]}):null};var _path$q,_excluded$y=["title","titleId"];function _extends$y(){return _extends$y=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$y(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgPasswordHero=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$y(br,_excluded$y);return reactExports.createElement("svg",_extends$y({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$q||(_path$q=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm-7.618-38.89v-4.037a8.074 8.074 0 0 1 16.147 0v4.036a13.436 13.436 0 0 1 5.383 10.766c0 7.431-6.025 13.456-13.456 13.456-7.432 0-13.456-6.025-13.456-13.456 0-4.402 2.114-8.31 5.382-10.765Zm13.147-1.702v-2.335a5.074 5.074 0 0 0-10.147 0v2.336a13.416 13.416 0 0 1 5.074-.99c1.795 0 3.507.352 5.073.99ZM34.5 36.663a3.5 3.5 0 1 0-3 0V39.5a1.5 1.5 0 0 0 3 0v-2.837Z",fill:"#4779FF"})))};const validatePassword=fr=>{const br=fr.length>=6,wr=/[A-Z]/.test(fr),Er=/[a-z]/.test(fr),kr=/\d/.test(fr),jr=/\W/.test(fr);let Br=[Er,wr,kr,jr,br].filter(Boolean).length;return Br>=3&&fr.length>=12&&(Br=5),{hasLowerCase:Er,hasNonalphas:jr,hasNumbers:kr,hasProperLength:br,hasUpperCase:wr,securityCriteria:[{description:"Password is atleast 6 characters in length",key:"hasProperLength",value:br},{description:"Contains at least one uppercase letter",key:"hasUpperCase",value:wr},{description:"Contains at least one lowercase letter",key:"hasLowerCase",value:Er},{description:"Contains at least one number",key:"hasNumbers",value:kr},{description:"Contains at least one non-alphanumeric character",key:"hasNonalphas",value:jr}],strength:Br}};var _path$p,_excluded$x=["title","titleId"];function _extends$x(){return _extends$x=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$x(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgEyeOffIcon=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$x(br,_excluded$x);return reactExports.createElement("svg",_extends$x({xmlns:"http://www.w3.org/2000/svg",width:25,height:24,viewBox:"0 0 25 24",fill:"none","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$p||(_path$p=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.793 2.293a1 1 0 0 1 1.414 0l3.04 3.04A10.955 10.955 0 0 1 12.5 4c4.927 0 9.095 3.238 10.497 7.7a1 1 0 0 1 0 .6 11.014 11.014 0 0 1-3.552 5.231l2.762 2.762a1 1 0 0 1-1.414 1.414l-18-18a1 1 0 0 1 0-1.414Zm5.943 4.53 1.732 1.731a4 4 0 0 1 5.478 5.478l2.076 2.076A9.022 9.022 0 0 0 20.989 12 9.004 9.004 0 0 0 8.736 6.822Zm5.696 5.695a2 2 0 0 0-2.45-2.45l2.45 2.45ZM5.125 8.174a1 1 0 0 1 .194 1.4A8.975 8.975 0 0 0 4.012 12a9.004 9.004 0 0 0 10.177 5.842 1 1 0 0 1 .372 1.965c-.668.127-1.357.193-2.06.193-4.927 0-9.095-3.238-10.497-7.7a1 1 0 0 1 0-.6 10.97 10.97 0 0 1 1.72-3.332 1 1 0 0 1 1.4-.194Z",fill:"#ABACB2"})))};const ToggleVisibilityButton=({initialState:fr=!1,onClick:br,className:wr=""})=>{const[Er,kr]=reactExports.useState(fr),jr=Br=>{Br.preventDefault(),kr(Wr=>{const qr=!Wr;return br==null||br(qr),qr})};return jsxRuntimeExports.jsx(TextButton,{className:classNames$1("toggle-visibility-button__container",wr),onClick:Br=>jr(Br),children:jsxRuntimeExports.jsx(Tooltip$2,{className:"toggle-visibility-button__tooltip",content:Er?"Show":"Hide",children:jsxRuntimeExports.jsx(Icon,{size:"medium",color:"text-tertiary",children:Er?jsxRuntimeExports.jsx(SvgFooterEyeIcon,{}):jsxRuntimeExports.jsx(SvgEyeOffIcon,{})})})})},CreatePasswordStep=({password:fr,setPassword:br,currentPassword:wr,setCurrentPassword:Er,onContinue:kr,isChangingPassword:jr,onClose:Br,onLogout:Wr})=>{const{primaryWallet:qr}=useInternalDynamicContext(),[Gr,Vr]=reactExports.useState("password"),[Zr,Jr]=reactExports.useState("password"),Qr=validatePassword(fr).strength,[_n,En]=reactExports.useState(Qr),[Cn,In]=reactExports.useState(""),[An,jn]=reactExports.useState("password"),[eo,ro]=reactExports.useState(!1),[to,_i]=reactExports.useState(""),{t:oo}=useTranslation(),io=!!((fr==null?void 0:fr.length)>=6&&_n>=5&&Cn===fr&&(!jr||wr&&wr!==fr)),co=Br&&jsxRuntimeExports.jsx(IconButton,{onClick:()=>Br(),type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})}),so=(Xr,Sn,Rn=!0)=>jsxRuntimeExports.jsxs("div",{className:"create-password__password-input__suffix",children:[Rn&&jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(CopyButton,{textToCopy:fr,copykey:"dyn_qr_code.copy_button",className:"create-password__password-input__suffix__icon",children:jsxRuntimeExports.jsx(SvgCopy,{className:"create-password__password-input__suffix__icon",onClick:Pn=>{Pn.preventDefault()}})})}),jsxRuntimeExports.jsx(ToggleVisibilityButton,{initialState:Xr==="password",onClick:Pn=>Sn(Pn?"password":"text"),className:"create-password__password-input__suffix__icon"})]}),no=Xr=>__awaiter$e(void 0,void 0,void 0,function*(){Xr.preventDefault();const Sn=qr==null?void 0:qr.connector;if(jr&&isCoinbaseMpcWalletConnector(Sn)){ro(!0);try{if(!(yield Sn.validatePasscode(wr))){_i(oo("dyn_create_password.errors.invalid_current_password"));return}}catch{_i(oo("dyn_create_password.errors.error_changing_password"));return}finally{ro(!1)}}io&&kr()}),Tn=Xr=>{const Sn=Xr.target.value,{strength:Rn}=validatePassword(Sn);if(En(Rn),br(Sn),jr){_i(wr===Sn?oo("dyn_create_password.errors.new_password_same_as_old"):Sn&&Cn&&Sn!==Cn?oo("dyn_create_password.errors.password_mismatch"):"");return}Sn!=null&&Sn.length||_i("")},Hr=Xr=>{const Sn=Xr.target.value;_i(Sn!==fr?oo("dyn_create_password.errors.password_mismatch"):""),In(Sn)};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:co,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_create_password.title",children:oo(jr?"dyn_create_password.title.update":"dyn_create_password.title.create")})}),jsxRuntimeExports.jsx("div",{className:"create-password",children:jsxRuntimeExports.jsxs("form",{className:"create-password__body","data-testid":"create-password-form",onSubmit:no,children:[jsxRuntimeExports.jsxs("div",{className:"create-password__body__header",children:[jsxRuntimeExports.jsx(SvgPasswordHero,{}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",children:oo("dyn_create_password.description")})]}),to&&jsxRuntimeExports.jsx(ErrorContainer,{children:to}),jr&&jsxRuntimeExports.jsx(Input,{id:"current-password",placeholder:oo("dyn_create_password.current_password_input.placeholder"),type:Gr,suffix:so(Gr,Vr,!1),label:oo("dyn_create_password.current_password_input.label"),value:wr,onChange:Xr=>Er(Xr.target.value),autoFocus:!0,copykey:"dyn_create_password.current_password_input"}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Input,{id:"password",placeholder:oo(jr?"dyn_create_password.update_input.placeholder":"dyn_create_password.create_input.placeholder"),type:Zr,suffix:so(Zr,Jr),label:oo(jr?"dyn_create_password.update_input.label":"dyn_create_password.create_input.label"),value:fr,onChange:Tn,autoFocus:!jr,copykey:"dyn_create_password.create_input"})}),fr.length>=1&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"create-password__body__card",children:validatePassword(fr).securityCriteria.map(Xr=>jsxRuntimeExports.jsxs("div",{className:`create-password__password-criteria-list ${Xr.value?"create-password__password-criteria-list__success":"create-password__password-criteria-list__error"}`,children:[jsxRuntimeExports.jsx("div",{children:Xr.value?jsxRuntimeExports.jsx(SvgCheck,{className:"create-password__password-criteria-icon"}):jsxRuntimeExports.jsx(SvgClose,{className:"create-password__password-criteria-icon"})}),jsxRuntimeExports.jsx(Typography,{variant:"body_mini",children:Xr.description})]},Xr.key))}),jsxRuntimeExports.jsx(Input,{id:"confirm-password",placeholder:oo("dyn_create_password.confirm_input.placeholder"),type:An,suffix:so(An,jn,!1),label:oo("dyn_create_password.confirm_input.label"),value:Cn,onChange:Hr,copykey:"dyn_create_password.confirm_input"})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},disabled:!io,copykey:"dyn_create_password.continue",type:"submit",loading:eo,children:oo("dyn_create_password.continue")}),Wr&&jsxRuntimeExports.jsx(TextButton,{className:"create-password__log-out",onClick:Wr,copykey:"dyn_create_password.logout",children:oo("dyn_create_password.logout")})]})})]})};var _path$o,_excluded$w=["title","titleId"];function _extends$w(){return _extends$w=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$w(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgDownload=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$w(br,_excluded$w);return reactExports.createElement("svg",_extends$w({width:21,height:20,viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$o||(_path$o=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.417 14.167c0 .92.746 1.666 1.666 1.666h8.334c.92 0 1.666-.746 1.666-1.666v-.834a.833.833 0 0 1 1.667 0v.834a3.333 3.333 0 0 1-3.333 3.333H6.083a3.333 3.333 0 0 1-3.333-3.333v-.834a.833.833 0 0 1 1.667 0v.834Zm1.91-4.756a.833.833 0 0 1 1.179 0l1.91 1.91V3.333a.833.833 0 0 1 1.667 0v7.989l1.911-1.911a.833.833 0 1 1 1.179 1.178l-3.334 3.334a.833.833 0 0 1-1.178 0l-3.334-3.334a.833.833 0 0 1 0-1.178Z",fill:"#ABACB2"})))},_path$n,_path2$3,_path3$2,_path4$1,_g$8,_path5$1,_defs$8,_excluded$v=["title","titleId"];function _extends$v(){return _extends$v=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$v(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgSavePasswordHero=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$v(br,_excluded$v);return reactExports.createElement("svg",_extends$v({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,reactExports.createElement("g",{clipPath:"url(#save-password-hero_svg__a)"},reactExports.createElement("mask",{id:"save-password-hero_svg__b",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:0,y:0,width:327,height:112},_path$n||(_path$n=reactExports.createElement("path",{d:"M315 0H12C5.373 0 0 5.373 0 12v88c0 6.627 5.373 12 12 12h303c6.627 0 12-5.373 12-12V12c0-6.627-5.373-12-12-12Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#save-password-hero_svg__b)"},_path2$3||(_path2$3=reactExports.createElement("path",{d:"M164 228c62.96 0 114-51.04 114-114S226.96 0 164 0 50 51.04 50 114s51.04 114 114 114Z",fill:"url(#save-password-hero_svg__c)",fillOpacity:.12})),reactExports.createElement("mask",{id:"save-password-hero_svg__d",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:86,y:29,width:40,height:40},_path3$2||(_path3$2=reactExports.createElement("path",{d:"M116.91 29 86 37.282l8.282 30.91 30.91-8.282L116.91 29Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#save-password-hero_svg__d)"},reactExports.createElement("mask",{id:"save-password-hero_svg__e",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:90,y:33,width:31,height:31},_path4$1||(_path4$1=reactExports.createElement("path",{d:"M119.763 44.8c-2.097-7.824-10.139-12.467-17.963-10.37-7.824 2.096-12.468 10.138-10.371 17.962 2.096 7.824 10.139 12.467 17.963 10.37 7.824-2.096 12.467-10.138 10.371-17.962Z",fill:"#fff"}))),_g$8||(_g$8=reactExports.createElement("g",{mask:"url(#save-password-hero_svg__e)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M118.709 55.166a14.617 14.617 0 0 0 1.054-10.366c-2.097-7.824-10.139-12.467-17.963-10.37-7.824 2.096-12.467 10.138-10.37 17.962a14.612 14.612 0 0 0 6.096 8.451c1.808-3.916 6.565-6.42 9.647-7.247 3.083-.826 7.955-1.146 11.536 1.57Zm-19.374-8.688a5.5 5.5 0 1 1 10.624-2.848 5.5 5.5 0 0 1-10.624 2.848Z",fill:"#DD8500"})))),_path5$1||(_path5$1=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.268 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.944 32.064a6.223 6.223 0 0 0-1.78 0c-.68.098-1.313.337-1.816.527l-.134.05-16.681 6.255-.406.152c-1.922.718-3.61 1.347-4.91 2.493a9.331 9.331 0 0 0-2.552 3.682c-.616 1.619-.614 3.42-.611 5.472l.001.434v14.875c0 8.792 4.782 16.123 9.952 21.508 5.204 5.42 11.159 9.25 14.308 11.086l.127.075c.575.337 1.32.775 2.307.987a6.623 6.623 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.149-1.836 9.103-5.665 14.308-11.086 5.169-5.385 9.952-12.716 9.952-21.508V50.695c.003-2.052.006-3.853-.61-5.472a9.331 9.331 0 0 0-2.552-3.682c-1.3-1.145-2.988-1.775-4.91-2.493l-.407-.152-16.68-6.254-.135-.05c-.502-.19-1.135-.43-1.815-.528Zm-.36 18.497c1.726 0 3.126 1.4 3.126 3.126v12.504a3.126 3.126 0 0 1-6.253 0V53.687c0-1.726 1.4-3.126 3.127-3.126Zm-3.127 28.135c0-1.727 1.4-3.126 3.127-3.126h.031a3.127 3.127 0 1 1 0 6.252h-.031a3.127 3.127 0 0 1-3.127-3.126Z",fill:"#DD8500"})))),_defs$8||(_defs$8=reactExports.createElement("defs",null,reactExports.createElement("linearGradient",{id:"save-password-hero_svg__c",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#DD8500"}),reactExports.createElement("stop",{offset:.985,stopColor:"#DD8500",stopOpacity:0})),reactExports.createElement("clipPath",{id:"save-password-hero_svg__a"},reactExports.createElement("path",{fill:"#fff",d:"M0 0h327v112H0z"})))))};const downloadFile=(fr,br)=>{const wr=document.createElement("a"),Er=new Blob([br],{type:"text/plain"});wr.href=URL.createObjectURL(Er),wr.download=fr,document.body.appendChild(wr),wr.click()},SavePasswordStep=({password:fr,error:br,isLoading:wr,onSave:Er,onBack:kr,onClose:jr,onLogout:Br})=>{const{t:Wr}=useTranslation(),[qr,Gr]=reactExports.useState("password"),[Vr,Zr]=reactExports.useState(!1),[Jr,Qr]=reactExports.useState(!1),_n=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>kr(),"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgChevronLeft,{})}),En=jr&&jsxRuntimeExports.jsx(IconButton,{onClick:()=>jr(),type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})}),Cn=jsxRuntimeExports.jsx(ToggleVisibilityButton,{initialState:qr==="password",onClick:An=>Gr(An?"password":"text"),className:"save-password-suffix-icon"}),In=An=>__awaiter$e(void 0,void 0,void 0,function*(){An.preventDefault(),Er()});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{leading:_n,trailing:En,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_save_password.title",children:Wr("dyn_save_password.title")})}),jsxRuntimeExports.jsx("div",{className:"save-password-view",children:jsxRuntimeExports.jsxs("form",{className:"save-password-view__body","data-testid":"save-password-form",onSubmit:In,children:[jsxRuntimeExports.jsx("div",{className:"save-password-view__body__icon",children:jsxRuntimeExports.jsx(SvgSavePasswordHero,{})}),jsxRuntimeExports.jsx("div",{className:"save-password-view__body__icon",children:jsxRuntimeExports.jsx(Badge,{text:Wr("dyn_save_password.badge_text"),className:"save-password-view__body__badge",copykey:"dyn_save_password.badge_text"})}),jsxRuntimeExports.jsxs("div",{className:"save-password-view__body__description",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_save_password.description",children:Wr("dyn_save_password.description")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"secondary",copykey:"dyn_save_password.description",children:Wr("dyn_save_password.warning")})]}),br&&jsxRuntimeExports.jsx(ErrorContainer,{children:br}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Input,{id:"password",placeholder:Wr("dyn_save_password.password_input.placeholder"),type:qr,suffix:Cn,disabled:!0,label:Wr("dyn_save_password.password_input.label"),value:fr,autoFocus:!0,copykey:"dyn_save_password.password_input"})}),jsxRuntimeExports.jsxs("div",{className:"save-password-view__actions",children:[jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"save-password-copy",buttonPadding:"small",buttonVariant:"primary",onClick:An=>{An.preventDefault(),copyToClipboard(fr),Qr(!0)},startSlot:jsxRuntimeExports.jsx(SvgCopy,{}),expanded:!0,copykey:"dyn_save_password.copy_button",children:Wr(Jr?"dyn_save_password.copy_button.copied":"dyn_save_password.copy_button.copy")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"save-password-download",buttonPadding:"small",buttonVariant:"primary",onClick:An=>{An.preventDefault(),downloadFile("wallet-recovery.txt",fr)},startSlot:jsxRuntimeExports.jsx(SvgDownload,{}),expanded:!0,copykey:"dyn_save_password.download_button",children:Wr("dyn_save_password.download_button")})]}),jsxRuntimeExports.jsx("div",{className:"save-password-view__body__confirm-card",children:jsxRuntimeExports.jsxs("button",{className:"save-password-view__body__card__acknowledgement",onClick:An=>{An.stopPropagation(),Zr(!Vr)},type:"button",children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Checkbox,{checked:Vr,onChange:An=>{An.stopPropagation(),Zr(!Vr)},className:"save-password-view__body__card__statement__checkbox"})}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",style:{letterSpacing:"-0.15px"},color:"primary",copykey:"dyn_save_password.checkbox_label",children:Wr("dyn_save_password.checkbox_label")})})]})}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"save-password-submit",buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},disabled:!Vr,loading:wr,type:"submit",copykey:"dyn_save_password.continue",children:Wr("dyn_save_password.continue")}),Br&&jsxRuntimeExports.jsx(TextButton,{className:"create-password__log-out",onClick:Br,copykey:"dyn_save_password.logout",children:Wr("dyn_save_password.logout")})]})})]})},CreatePasswordView=({onSuccess:fr,onError:br,closeView:wr,notCalledFromWalletUtils:Er,isSignUp:kr})=>{var jr;const{setShowAuthFlow:Br,user:Wr,projectSettings:qr,primaryWallet:Gr,handleLogOut:Vr,walletConnectorOptions:Zr}=useInternalDynamicContext(),{t:Jr}=useTranslation(),{claimWallet:Qr}=useEmbeddedWalletPassword(),[_n,En]=reactExports.useState("create-password"),Cn=(jr=Wr==null?void 0:Wr.verifiedCredentials.find(Rn=>Rn.walletName==="coinbasempc"))===null||jr===void 0?void 0:jr.walletProperties,In=!!(Cn!=null&&Cn.claimed),An=wr??!0,[jn,eo]=reactExports.useState(""),[ro,to]=reactExports.useState(""),[_i,oo]=reactExports.useState(!1),[io,co]=reactExports.useState(""),so=requiresPasswordForEmbeddedWallet(qr),no=In||!so,Tn=()=>__awaiter$e(void 0,void 0,void 0,function*(){En("save-password")}),Hr=()=>__awaiter$e(void 0,void 0,void 0,function*(){var Rn,Pn,On;oo(!0);try{if(!kr){const Zn=(On=(Rn=Gr==null?void 0:Gr.connector)!==null&&Rn!==void 0?Rn:(Pn=findCoinbaseMPCWallet(Zr))===null||Pn===void 0?void 0:Pn.walletConnector)!==null&&On!==void 0?On:void 0;Er&&isCoinbaseMpcWalletConnector(Zn)&&(yield Zn.changePasscode(ro,jn)),In||(yield Qr())}fr==null||fr(ro),An&&Br(!1,{ignoreIfIsEmbeddedWidget:!1}),dynamicEvents.emit("embeddedWalletCreatePasswordCompleted",ro)}catch(Zn){logger$6.debug(`Error ${In?"updating":"creating"} password`,Zn),dynamicEvents.emit("embeddedWalletCreatePasswordFailed",Zn),Zn instanceof Error&&co(Zn.message),br==null||br(Zn)}finally{oo(!1)}}),Xr=()=>{if(so){const Rn=new Error(Jr("dyn_create_password.errors.user_closed_view"));br==null||br(Rn,!0),dynamicEvents.emit("embeddedWalletCreatePasswordFailed",Rn)}Br(!1)},Sn=Rn=>{Rn==null||Rn.preventDefault();const Pn=new Error(Jr("dyn_create_password.errors.user_closed_view"));br==null||br(Pn,!0),Vr()};return _n==="save-password"?jsxRuntimeExports.jsx(SavePasswordStep,{password:ro,onBack:()=>En("create-password"),error:io,isLoading:_i,onSave:()=>Hr(),onClose:no?()=>Xr():void 0,onLogout:no?void 0:Sn}):jsxRuntimeExports.jsx(CreatePasswordStep,{password:ro,setPassword:to,currentPassword:jn,setCurrentPassword:eo,onContinue:()=>Tn(),isChangingPassword:In,onClose:no?()=>Xr():void 0,onLogout:no?void 0:Sn})};var _path$m,_excluded$u=["title","titleId"];function _extends$u(){return _extends$u=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$u(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgPencilAltIcon=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$u(br,_excluded$u);return reactExports.createElement("svg",_extends$u({width:17,height:16,viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$m||(_path$m=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.638 2.862a.667.667 0 0 0-.943 0L7.167 8.391v.943h.942l5.53-5.53a.667.667 0 0 0 0-.942Zm-1.886-.943a2 2 0 1 1 2.829 2.829l-5.724 5.724a.667.667 0 0 1-.471.195H6.5A.667.667 0 0 1 5.833 10V8.115c0-.177.07-.347.196-.472l5.723-5.724ZM4.5 4a.667.667 0 0 0-.667.667V12c0 .368.299.667.667.667h7.333A.667.667 0 0 0 12.5 12V8.667a.667.667 0 0 1 1.333 0V12a2 2 0 0 1-2 2H4.5a2 2 0 0 1-2-2V4.667a2 2 0 0 1 2-2h3.333a.667.667 0 0 1 0 1.333H4.5Z",fill:"currentColor"})))};const EmailConfirmationWaitingView=()=>{const{setView:fr}=useViewContext(),{clearStatesOnBackClick:br,selectedWalletConnector:wr}=useInternalDynamicContext(),{t:Er}=useTranslation();if(wr&&!isEmailWalletConnector(wr))throw new Error("Wallet connector is not email provider");const kr=wr,jr=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){yield kr==null?void 0:kr.endSession(),fr("login-with-email-or-wallet"),br()}),[fr,kr,br]);return jsxRuntimeExports.jsxs("div",{className:"email-confirmation-waiting-view",children:[jsxRuntimeExports.jsx("div",{className:"email-confirmation-waiting-view__header-icon",children:jsxRuntimeExports.jsx(IconWithSpinner,{Icon:SignInWithEmailIcon,iconSize:80,isSpinning:!0})}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",color:"primary",className:"email-confirmation-waiting-view__title",copykey:"dyn_email_confirmation.title",children:Er("dyn_email_confirmation.title")}),jsxRuntimeExports.jsx(Typography,{weight:"regular",variant:"body_normal",color:"secondary",copykey:"dyn_email_confirmation.description",children:Er("dyn_email_confirmation.description")}),jsxRuntimeExports.jsxs("div",{className:"email-confirmation-waiting-view__email-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"medium",as:"span",children:kr==null?void 0:kr.email}),jsxRuntimeExports.jsx(IconButton,{onClick:jr,className:"email-confirmation-waiting-view__edit-icon-button","data-testid":"email-confirmation-waiting-view__edit-button",children:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgPencilAltIcon,{})})})]}),jsxRuntimeExports.jsx("div",{className:"email-confirmation-waiting-view__note",children:jsxRuntimeExports.jsx(Typography,{weight:"regular",variant:"body_small",color:"secondary",copykey:"dyn_email_confirmation.note",children:Er("dyn_email_confirmation.note")})}),jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"email-confirmation-waiting-view__powered_by_dynamic_footer"})]})};var _circle$4,_path$l,_path2$2,_excluded$t=["title","titleId"];function _extends$t(){return _extends$t=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$t(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgSignInWithEmail=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$t(br,_excluded$t);return reactExports.createElement("svg",_extends$t({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_circle$4||(_circle$4=reactExports.createElement("circle",{cx:32,cy:32,r:32,fill:"currentColor"})),_path$l||(_path$l=reactExports.createElement("path",{d:"M51 29.333a1.333 1.333 0 0 0-1.333 0l-17.334 9.8L15 29.333a1.333 1.333 0 0 0-2 1.16V42a4 4 0 0 0 4 4h30.667a4 4 0 0 0 4-4V30.5A1.333 1.333 0 0 0 51 29.333Z",fill:"#fff"})),_path2$2||(_path2$2=reactExports.createElement("path",{d:"M47.667 18H17a4 4 0 0 0-4 4v2.5a1.334 1.334 0 0 0 .667 1.16l18 10.167a1.333 1.333 0 0 0 1.333 0L51 25.66a1.334 1.334 0 0 0 .667-1.16V22a4 4 0 0 0-4-4Z",fill:"#fff"})))};const MIN_EVENT_TIME=10,useOnUnmount=fr=>{const br=reactExports.useRef(fr);br.current=fr,reactExports.useEffect(()=>{const wr=new Date;return()=>{new Date().getTime()-wr.getTime()!fr||br.length>2?br.split(""):br===""?[]:fr[0]===br[0]?[br[1]]:[br[0]],PinInput=({autoFocus:fr,disabled:br,inputIndex:wr,inputMode:Er,isValidated:kr,name:jr,onChange:Br,pattern:Wr,type:qr,value:Gr,values:Vr,hasError:Zr})=>{const Jr=reactExports.useRef(null),Qr=En=>{const Cn=Vr[wr],In=En.target.value.replace(/\s+/g,""),An=[...Vr],jn=normalizeNewValue(Cn,In).slice(0,An.length-wr),eo=(oo,io)=>An[wr+io]=oo,ro=qr==="number"?/(^$)|(\d+)/:/.*/,to=jn.every(oo=>ro.test(oo));let _i=Jr.current;if(to){jn.length?jn.forEach(eo):An[wr]="",Br(An);for(let oo=0;oo{var Cn;if(En==="Backspace"&&Vr[wr]===""&&wr>0){const In=(Cn=Jr.current)===null||Cn===void 0?void 0:Cn.previousElementSibling;In instanceof HTMLInputElement&&In.focus()}};return reactExports.useEffect(()=>{var En;fr&&wr===0&&((En=Jr==null?void 0:Jr.current)===null||En===void 0||En.focus())},[fr,wr]),jsxRuntimeExports.jsx("input",{ref:Jr,className:classNames$1("pin-input__input",{"pin-input__input--error":!!Zr,"pin-input__input--success":!!kr}),disabled:br,name:jr,value:Gr,onChange:Qr,onKeyDown:_n,"data-testid":wr,pattern:Wr,inputMode:Er})},isComplete=fr=>fr.every(br=>br),PinField=({handleComplete:fr,initialValue:br,inputMode:wr,isLoading:Er,isValidated:kr,pattern:jr,type:Br="number",hasError:Wr,onChange:qr,disabled:Gr})=>{const[Vr,Zr]=reactExports.useState(br),Jr=Qr=>{const _n=Qr.join("");Zr(Qr),qr==null||qr(_n),isComplete(Qr)&&fr(_n)};return jsxRuntimeExports.jsx("div",{className:"pin-field__container",children:Vr.map((Qr,_n)=>jsxRuntimeExports.jsx(PinInput,{values:Vr,inputIndex:_n,value:Qr,onChange:Jr,disabled:Er||Gr,inputMode:wr,isValidated:kr,pattern:jr,type:Br,autoFocus:!0,hasError:Wr},`pin_input_${_n}`))})};var _path$k,_excluded$s=["title","titleId"];function _extends$s(){return _extends$s=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$s(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgCheckCircle=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$s(br,_excluded$s);return reactExports.createElement("svg",_extends$s({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$k||(_path$k=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8 2.666a5.333 5.333 0 1 0 0 10.667A5.333 5.333 0 0 0 8 2.666ZM1.333 8a6.667 6.667 0 1 1 13.333 0A6.667 6.667 0 0 1 1.333 8Zm9.138-1.805c.26.26.26.682 0 .943L7.804 9.804a.667.667 0 0 1-.942 0L5.528 8.471a.667.667 0 1 1 .943-.943l.862.862 2.195-2.195c.26-.26.683-.26.943 0Z",fill:"currentColor"})))};const useCountdown=({callback:fr,seconds:br})=>{const[wr,Er]=reactExports.useState(br),kr=reactExports.useRef(),jr=()=>{if(kr.current)return Er(br);Wr()},Br=()=>{clearTimeout(kr.current),kr.current=void 0},Wr=()=>{kr.current=setTimeout(()=>{Er(qr=>qr-1)},1e3)};return reactExports.useEffect(()=>{if(kr.current){if(wr<=0){fr&&fr();return}return Wr(),()=>clearTimeout(kr.current)}},[wr,fr]),{remainingSeconds:wr,startCountdown:jr,stopCountdown:Br}},RetrySendVerificationCodeSection=({retryHandler:fr,secondsToRetry:br=15,disabled:wr=!1,className:Er})=>{const{t:kr}=useTranslation(),[jr,Br]=reactExports.useState(!1),{remainingSeconds:Wr,startCountdown:qr}=useCountdown({callback:()=>Br(!1),seconds:br}),{isLoading:Gr,mutate:Vr}=useMutation(fr,{onSuccess:()=>{Br(!0),qr()}}),Zr=classNames$1("retry-send-verification-code-section",Er);return jr?jsxRuntimeExports.jsxs("div",{className:Zr,children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",copykey:"dyn_otp_verification.resend_code_in",children:kr("dyn_otp_verification.resend_code_in",{remainingSeconds:Wr})}),jsxRuntimeExports.jsxs("span",{className:"retry-send-verification-code-section__confirmation",children:[jsxRuntimeExports.jsx(Icon,{color:"success-1",children:jsxRuntimeExports.jsx(SvgCheckCircle,{})}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"medium",color:"primary",copykey:"dyn_otp_verification.code_sent",children:kr("dyn_otp_verification.code_sent")})]})]}):jsxRuntimeExports.jsxs("div",{className:Zr,children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"medium",color:"secondary",copykey:"dyn_otp_verification.code_not_received",children:kr("dyn_otp_verification.code_not_received")}),jsxRuntimeExports.jsx(TextButton,{className:"email-verification__text-button",disabled:Gr||wr,onClick:()=>Vr(),copykey:"dyn_otp_verification.resend_code",children:kr("dyn_otp_verification.resend_code")})]})},SECONDS_TO_RETRY=15,EmailVerification=({isEmailRecoveryFlow:fr=!1,showRetryButton:br=!0,showTransferMessage:wr=!1})=>{var Er,kr,jr,Br;const{environmentId:Wr,handleLogOut:qr,setPrimaryWalletId:Gr,setShowAuthFlow:Vr,projectSettings:Zr,user:Jr,userWithMissingInfo:Qr,walletConnectorOptions:_n,primaryWallet:En}=useInternalDynamicContext(),{setView:Cn,goToInitialView:In}=useViewContext(),{error:An,setError:jn,setErrorMessage:eo}=useErrorContext(),{loading:ro,setLoading:to}=useLoadingContext(),[_i,oo]=reactExports.useState(br),[io,co]=reactExports.useState(wr),{getEOAWallet:so}=useSmartWallets(),[no,Tn]=reactExports.useState(!1),Hr=reactExports.useRef(no),Xr=na=>{Tn(na),Hr.current=na},{displayedDestination:Sn,verificationUUID:Rn,setVerificationUUID:Pn}=useVerification(),{t:On}=useTranslation(),{addRecoveryEmail:Zn}=usePasskeyRecovery(),{isTurnkeyWallet:Nn,hasTurnkeyVerifiedCredentialAuthenticator:wn,hasRecoveryEmail:zn}=useIsTurnkeyWallet(),fo=isTurnkeyEnabled(Zr),{initAuth:vo,completeAuth:go,cancelAuth:uo}=useUserAuth({authMethod:"email"}),{generateSessionKey:lo,shouldRegisterSessionKeysOnSignin:Eo}=useEmbeddedWalletSessionKeys(Wr),mo=reactExports.useRef(!0);useOnUnmount(()=>{if(!mo.current)return;const na=Sn??"";dynamicEvents.emit("emailVerificationResult",Hr.current,na),Hr.current||dynamicEvents.emit("authFailure",{email:na,option:na,type:"email"},"user-cancelled"),Sn||logger$6.warn("WARNING: emitted emailVerificationResult with incomplete params because useVerification's displayedDestination was undefined")});const{verifyOtp:yo}=useOtpVerificationRequest(),_o=reactExports.useCallback(na=>__awaiter$e(void 0,void 0,void 0,function*(){var qo,ga,wl,No,Uo,Nl;if(na.nextView==="verified-and-transferred"&&(co==null||co(!0)),fr)return Cn("passkey-recovery-add-email",{canSkipAddingEmail:!1,isFromEmailVerification:!0}),!0;if(!Nn)return!1;if(wn&&!zn&&(!((qo=na==null?void 0:na.user)===null||qo===void 0)&&qo.email))return storeAuthTokenAndUser(na),yield Zn(na.user.email),Vr(!1),!0;if(fo){const Vo=(wl=(ga=Zr==null?void 0:Zr.sdk)===null||ga===void 0?void 0:ga.embeddedWallets)===null||wl===void 0?void 0:wl.automaticEmbeddedWalletCreation,Fo=En&&so(En),Ol=En&&isSessionKeyCompatibleWallet(En)||Fo&&isSessionKeyCompatibleWallet(Fo),$a=!!(Vo&&(!(!((Uo=(No=Zr==null?void 0:Zr.sdk)===null||No===void 0?void 0:No.embeddedWallets)===null||Uo===void 0)&&Uo.forceAuthenticatorAtSignup)||Ol));if($a){const Jo=findPrimaryEmbeddedChain(Zr),Zl=findEmbeddedWalletFromVerifiedCredentials(createUserProfileFromSdkUser(na.user),[Jo]);if(!Zl)throw new Error("Could not find an embedded wallet");const Cl=_n==null?void 0:_n.find(wo=>wo.key===Zl.walletName);if(!(Cl!=null&&Cl.walletConnector))throw new Error("Could not find connector for embedded wallet");const ko=Cl.walletConnector.createWallet({address:Zl.address||"",chain:Cl.walletConnector.connectedChain,connector:Cl.walletConnector,id:Zl.id,isAuthenticated:!1,key:(Nl=Zl.walletName)!==null&&Nl!==void 0?Nl:""});Gr(Zl.id),dynamicEvents.emit("embeddedWalletCreated",ko,Zl,Jr)}if($a||!Vo)return Vr(!1),!0}return!1}),[fr,Nn,wn,zn,fo,Cn,Zn,Vr,(kr=(Er=Zr==null?void 0:Zr.sdk)===null||Er===void 0?void 0:Er.embeddedWallets)===null||kr===void 0?void 0:kr.automaticEmbeddedWalletCreation,(Br=(jr=Zr==null?void 0:Zr.sdk)===null||jr===void 0?void 0:jr.embeddedWallets)===null||Br===void 0?void 0:Br.forceAuthenticatorAtSignup,En,so,_n,Gr,Jr]),Bo=reactExports.useCallback(na=>__awaiter$e(void 0,void 0,void 0,function*(){return jn(void 0),to(!0),Rn?!Jr&&!Qr?vo({onVerifySuccess:()=>Xr(!0),options:{email:Sn},showSuccessMessage:!0,verifyFunction:()=>__awaiter$e(void 0,void 0,void 0,function*(){let qo;return Eo()&&(qo=(yield lo()).publicKey),signInWithEmailVerification({environmentId:Wr,sessionPublicKey:qo,verificationToken:na,verificationUUID:Rn})})}):go({completeSignInFlow:qo=>__awaiter$e(void 0,void 0,void 0,function*(){return _o(qo)}),onValidUpdatedJwt:()=>{Xr(!0)},options:{email:Sn,isEmailRecoveryFlow:fr},updateJwtFunction:()=>__awaiter$e(void 0,void 0,void 0,function*(){return yo(na,"email",Rn)})}):uo()}),[jn,to,Rn,Jr,Qr,go,Sn,fr,uo,vo,Wr,_o,yo]),Lo=()=>__awaiter$e(void 0,void 0,void 0,function*(){try{if(!Rn||!Sn)return;to(!0);const{verificationUUID:na}=yield retryEmailVerification({email:Sn,environmentId:Wr,verificationUUID:Rn});Pn(na),jn(void 0)}catch(na){logger$6.debug(na),eo(na.code),na.code==="too_many_email_verification_attempts"&&oo(!1),na.code==="invalid_email_verification"&&In()}finally{to(!1)}}),Wo=reactExports.useMemo(()=>qo=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignInWithEmail,Object.assign({},qo))}),[]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[An&&jsxRuntimeExports.jsx(ErrorContainer,{withIcon:!1,className:"email-verification__error-message",children:An}),jsxRuntimeExports.jsxs("div",{className:classNames$1("email-verification__container",{"email-verification__container--error":!!An}),children:[io&&jsxRuntimeExports.jsx("div",{className:"email-verification__transfer-message",copykey:"dyn_otp_verification.email.complete",children:On("dyn_otp_verification.email.complete")}),no?jsxRuntimeExports.jsx("div",{className:"email-verification__icon-container",children:jsxRuntimeExports.jsx(IconWithStatus,{containerClassName:"email-verification__icon--verified",Icon:Wo,iconSize:64,InnerIcon:SvgCheck})}):jsxRuntimeExports.jsx(IconWithSpinner,{Icon:Wo,iconSize:96,isSpinning:!0,className:"email-verification__icon-with-spinner"}),jsxRuntimeExports.jsxs("div",{className:"email-verification__copy-text-container",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_otp_verification.description",children:On("dyn_otp_verification.description")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"secondary",children:shortenEmail(Sn)})]}),jsxRuntimeExports.jsx(PinField,{initialValue:Array(6).join(".").split("."),isLoading:ro,handleComplete:Bo,isValidated:no,inputMode:"numeric",pattern:"[0-9]*",hasError:!!An,onChange:()=>jn(void 0)}),_i&&jsxRuntimeExports.jsx(RetrySendVerificationCodeSection,{className:"email-verification__retry-container",retryHandler:Lo,secondsToRetry:SECONDS_TO_RETRY}),(Jr||Qr)&&!fr&&jsxRuntimeExports.jsx(TextButton,{className:"email-verification__log-out",onClick:qr,copykey:"dyn_otp_verification.log_out_button",children:On("dyn_otp_verification.log_out_button")})]})]})},EmailIcon=fr=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignInWithEmail,Object.assign({},fr,{"data-testid":"sign-in-with-email-icon"}))}),typographyColor={error:"error-1",notice:"brand-primary",success:"green-1"},ModalHeaderBanner=({messageKey:fr,type:br="error",disableTruncate:wr=!1})=>{const{t:Er}=useTranslation();return jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{style:{width:"100%"}}),children:!!fr&&jsxRuntimeExports.jsx("div",{className:classNames$1("modal-header-banner",{"modal-header-banner__error":br==="error","modal-header-banner__notice":br==="notice","modal-header-banner__success":br==="success"}),children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:typographyColor[br],truncate:wr===!1,copykey:fr,children:Er(fr||"")})})})},OTPVerificationView=({onClickBack:fr,onClickEditDestination:br,isLoading:wr,disabled:Er,displayedDestination:kr,description:jr,onPinComplete:Br,isValid:Wr,error:qr,retryHandler:Gr,onPinChange:Vr,successBannerTextKey:Zr,MainIcon:Jr,hideHeader:Qr,appendAboveOTPInput:_n,appendToEnd:En})=>{const{t:Cn}=useTranslation(),In=fr&&jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:fr,"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgArrowLeft,{})}),An=reactExports.useMemo(()=>Wr?"dyn_otp_verification.verification_succeeded":"dyn_otp_verification.confirm_code",[Wr]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!Qr&&jsxRuntimeExports.jsx(ModalHeader,{alignContent:"bottom",leading:fr&&In,children:jsxRuntimeExports.jsx("div",{className:"otp-verification-view__status-header",children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",color:"primary",className:"otp-verification-view__title",copykey:An,children:Cn(An)})})}),Zr&&jsxRuntimeExports.jsx(ModalHeaderBanner,{type:"notice",messageKey:Zr,disableTruncate:!0}),jsxRuntimeExports.jsx(ModalHeaderBanner,{type:"error",messageKey:qr==null?void 0:qr.message}),jsxRuntimeExports.jsxs("div",{className:classNames$1("otp-verification-view",{"otp-verification-view--message":!!(Zr||qr)}),children:[Wr&&jsxRuntimeExports.jsx(IconWithStatus,{Icon:Jr,iconSize:64,InnerIcon:SvgCheck}),!Wr&&jsxRuntimeExports.jsx(IconWithSpinner,{Icon:Jr,iconSize:96,isSpinning:wr,className:"otp-verification-view__icon-with-spinner",treatAsFunctionComponent:!0}),jsxRuntimeExports.jsxs("div",{className:"otp-verification-view__body",children:[Wr&&jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_otp_verification.hang_tight",children:Cn("dyn_otp_verification.hang_tight")}),!Wr&&(jr?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_otp_verification.description",children:jr}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_otp_verification.description",children:Cn("dyn_otp_verification.description")}),jsxRuntimeExports.jsxs("div",{className:"otp-verification-view__destination-container",children:[kr&&jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",color:"secondary",children:kr}),br&&jsxRuntimeExports.jsx(IconButton,{onClick:br,"data-testid":"otp-verification-view__edit-button",children:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgPencilAltIcon,{})})})]})]}))]}),_n,jsxRuntimeExports.jsx(PinField,{initialValue:Array(6).join(".").split("."),isLoading:wr,handleComplete:Br,isValidated:Wr,inputMode:"numeric",pattern:"[0-9]*",hasError:!!qr,onChange:Vr,disabled:Er}),Gr&&jsxRuntimeExports.jsx(RetrySendVerificationCodeSection,{className:"otp-verification-view__retry-container",retryHandler:Gr}),En]})]})},EmailWalletOTPVerificationView=()=>{const{setView:fr}=useViewContext(),[br,wr]=reactExports.useState(),{selectedWalletConnector:Er,clearStatesOnBackClick:kr}=useInternalDynamicContext();if(!Er||!isEmailOTPWalletConnector(Er))throw new Error("Current wallet is not EmailWalletConnector");const{email:jr}=Er;if(!jr)throw new Error("EmailWalletOtpVerificationView requires a email");const Br=()=>{Er.clearEmail(),kr(),fr("login-with-email-or-wallet"),dynamicEvents.emit("authFailure",{email:jr,option:jr,type:"email"},"user-cancelled")},{data:Wr,isLoading:qr,mutate:Gr}=useMutation(Vr=>Er.verifyOneTimePassword(Vr),{onFailure:Vr=>{wr(Vr),dynamicEvents.emit("emailVerificationResult",!1,jr)},onSuccess:()=>{dynamicEvents.emit("emailVerificationResult",!0,jr)}});return jsxRuntimeExports.jsx(OTPVerificationView,{MainIcon:EmailIcon,displayedDestination:shortenEmail(jr),error:br,onClickBack:Br,isLoading:qr,onPinComplete:Gr,isValid:Wr===!0,retryHandler:Er.retryOneTimePassword.bind(Er),onPinChange:()=>wr(void 0),onClickEditDestination:Br,successBannerTextKey:"dyn_magic_verification.banner_text"})};var _g$7,_defs$7,_excluded$r=["title","titleId"];function _extends$r(){return _extends$r=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$r(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgExportEmbeddedHero=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$r(br,_excluded$r);return reactExports.createElement("svg",_extends$r({width:329,height:88,viewBox:"0 0 329 88",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_g$7||(_g$7=reactExports.createElement("g",{clipPath:"url(#export-embedded-hero_svg__a)"},reactExports.createElement("circle",{cx:164.5,cy:114,r:114,fill:"url(#export-embedded-hero_svg__b)",fillOpacity:.12}),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M195 23a4 4 0 0 1 4-4h40a4 4 0 0 1 4 4v8a4 4 0 0 1-4 4h-40a4 4 0 0 1-4-4v-8Zm13.585 4c0 1.473-1.217 2.667-2.717 2.667-1.501 0-2.717-1.194-2.717-2.667 0-1.473 1.216-2.667 2.717-2.667 1.5 0 2.717 1.194 2.717 2.667Zm6.34 2.667c1.5 0 2.717-1.194 2.717-2.667 0-1.473-1.217-2.667-2.717-2.667-1.501 0-2.717 1.194-2.717 2.667 0 1.473 1.216 2.667 2.717 2.667ZM226.698 27c0 1.473-1.216 2.667-2.717 2.667-1.5 0-2.717-1.194-2.717-2.667 0-1.473 1.217-2.667 2.717-2.667 1.501 0 2.717 1.194 2.717 2.667Zm8.057 0c0 .903-.751 1.667-1.717 1.667-.966 0-1.717-.764-1.717-1.667s.751-1.667 1.717-1.667c.966 0 1.717.764 1.717 1.667Zm1 0c0 1.473-1.217 2.667-2.717 2.667-1.501 0-2.717-1.194-2.717-2.667 0-1.473 1.216-2.667 2.717-2.667 1.5 0 2.717 1.194 2.717 2.667ZM110.237 57.018c8.535-2.287 13.601-11.06 11.314-19.596-2.287-8.535-11.061-13.6-19.596-11.313-8.536 2.287-13.601 11.06-11.314 19.596 2.287 8.535 11.061 13.6 19.596 11.313Zm-8.712-17.797-.522-1.949a4.037 4.037 0 0 1 7.798-2.09l.522 1.95a6.727 6.727 0 1 1-7.798 2.09Zm4.573-2.535-.195-.727a1.036 1.036 0 1 0-2.002.537l.194.726a6.81 6.81 0 0 1 2.003-.536Zm1.567 6.87a1.749 1.749 0 0 0-1.586-3.023 1.75 1.75 0 0 0 .137 3.412l.368 1.37a.75.75 0 1 0 1.448-.388l-.367-1.37Z",fill:"#4779FF"}),reactExports.createElement("path",{d:"M171.501 40.667a4.666 4.666 0 0 1 4.667 4.666h-28a9.306 9.306 0 0 0-6.85 2.995c.788-4.357 4.6-7.661 9.183-7.661h21ZM187.834 59.333A9.334 9.334 0 0 0 178.5 50h-28a9.333 9.333 0 0 0-9.333 9.333V78a9.333 9.333 0 0 0 9.333 9.333h28A9.334 9.334 0 0 0 187.834 78V59.333Z",fill:"#4779FF"}),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M174.25 65.25a6 6 0 1 0-12 0 6 6 0 0 0 12 0Zm-3 0a3 3 0 1 0-6 0 3 3 0 0 0 6 0Zm-9.37 3.892a7.497 7.497 0 0 0 2.005 2.237l-2.831 2.83 2.103 2.103-2.121 2.122-2.103-2.103-2.062 2.062-2.121-2.121 7.13-7.13Z",fill:"#fff"}))),_defs$7||(_defs$7=reactExports.createElement("defs",null,reactExports.createElement("linearGradient",{id:"export-embedded-hero_svg__b",x1:164.5,y1:0,x2:164.5,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})),reactExports.createElement("clipPath",{id:"export-embedded-hero_svg__a"},reactExports.createElement("rect",{x:.5,width:328,height:88,rx:12,fill:"#fff"})))))},_path$j,_excluded$q=["title","titleId"];function _extends$q(){return _extends$q=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$q(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgInfo=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$q(br,_excluded$q);return reactExports.createElement("svg",_extends$q({width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$j||(_path$j=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9 2.333a6.667 6.667 0 1 0 0 13.334A6.667 6.667 0 0 0 9 2.333ZM.667 9a8.333 8.333 0 1 1 16.666 0A8.333 8.333 0 0 1 .667 9Zm7.5-3.333c0-.46.373-.834.833-.834h.008a.833.833 0 0 1 0 1.667H9a.833.833 0 0 1-.833-.833ZM7.333 9c0-.46.373-.833.834-.833H9c.46 0 .833.373.833.833v2.5a.833.833 0 1 1 0 1.667H9a.833.833 0 0 1-.833-.834v-2.5A.833.833 0 0 1 7.333 9Z",fill:"#383C48"})))},_path$i,_excluded$p=["title","titleId"];function _extends$p(){return _extends$p=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$p(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgWalletV2=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$p(br,_excluded$p);return reactExports.createElement("svg",_extends$p({xmlns:"http://www.w3.org/2000/svg",width:25,height:24,viewBox:"0 0 25 24",fill:"none","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$i||(_path$i=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.5 4a1 1 0 0 0 0 2h14a3 3 0 0 1 3 3v10a3 3 0 0 1-3 3h-14a3 3 0 0 1-3-3V5a3 3 0 0 1 3-3h12a1 1 0 1 1 0 2h-12Zm-1 3.83V19a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1V9a1 1 0 0 0-1-1h-14c-.35 0-.687-.06-1-.17Zm11 6.17a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0Z",fill:"#ABACB2"})))};const TurnkeyErrorMap={0:"Operation was canceled.",16:"Invalid Passkey signature. Select the passkey for this account and device.",3:"You reached the limit of passkeys for this account.",5:"Invalid Passkey signature. Select the passkey for this account and device.",7:"The code is invalid or expired."},reactNativePasskeyErrors={RequestFailed:"Request failed. Please try again.",UserCancelled:TurnkeyErrorMap[0]},DOMExceptionErrorMap={NotAllowedError:"Request Cancelled. Select a device or password manager to set up a passkey."},getProperErrorMessage=fr=>{var br;if(typeof fr=="string")return fr;if("reason"in fr)return fr.reason;if(fr instanceof DOMException)return DOMExceptionErrorMap[fr.name]||"Something went wrong";if("cause"in fr){if(((br=fr==null?void 0:fr.cause)===null||br===void 0?void 0:br.code)!==void 0){if(fr.cause.code===ACCESS_BLOCKED_ERROR_CODE)throw new AccessBlockedError;return TurnkeyErrorMap[fr.cause.code]}if(fr.cause&&"error"in fr.cause&&typeof fr.cause.error=="string"&&reactNativePasskeyErrors[fr.cause.error])return reactNativePasskeyErrors[fr.cause.error]}if("code"in fr&&fr.code){if(fr.code===ACCESS_BLOCKED_ERROR_CODE)throw new AccessBlockedError;return TurnkeyErrorMap[fr.code]}return"error"in fr&&typeof fr.error=="string"&&reactNativePasskeyErrors[fr.error]?reactNativePasskeyErrors[fr.error]:"Something went wrong"},iframeContainerId="dyn-turnkey-export-container-id",iframeElementId="dyn-turnkey-export-element-id",EmbeddedRevealView=({exportPrivateKey:fr})=>{var br,wr,Er,kr;const{primaryWallet:jr,user:Br,setShowAuthFlow:Wr,environmentId:qr}=useInternalDynamicContext(),{isTurnkeyWallet:Gr}=useIsTurnkeyWallet(),{shadowRoot:Vr}=useShadowDOMContext(),{setDynamicWidgetView:Zr}=useWidgetContext(),{setView:Jr}=useViewContext(),{getEOAWallet:Qr,isSmartWallet:_n}=useSmartWallets(),[En,Cn]=reactExports.useState(!1),[In,An]=reactExports.useState(!1),jn=reactExports.useRef(null),eo=(wr=(br=Br==null?void 0:Br.verifiedCredentials)===null||br===void 0?void 0:br.find(({walletName:Nn})=>Nn==null?void 0:Nn.startsWith("turnkey")))===null||wr===void 0?void 0:wr.walletProperties,ro=eo==null?void 0:eo.turnkeyHDWalletId,to=(Er=jr&&Qr(jr))!==null&&Er!==void 0?Er:jr,_i=to&&isCoinbaseMpcWalletConnector(to.connector);reactExports.useEffect(()=>()=>{Gr&&cleanupExport({wallet:to})},[]);const{isLoading:oo}=usePromise(()=>__awaiter$e(void 0,void 0,void 0,function*(){var Nn,wn;const zn=jn.current;if(!(!zn||((Nn=zn==null?void 0:zn.children)===null||Nn===void 0?void 0:Nn.length)>0))return isSessionKeyCompatibleWalletConnector(to==null?void 0:to.connector)&&(yield(wn=to==null?void 0:to.connector)===null||wn===void 0?void 0:wn.createOrRestoreSession()),initExport({iframeContainer:zn,iframeElementId,wallet:to})})),{mutate:io,isLoading:co,error:so,data:no}=useMutation(()=>__awaiter$e(void 0,void 0,void 0,function*(){var Nn,wn,zn;if(_i)return(to==null?void 0:to.connector).exportWalletKeys();if(Gr)try{return yield exportCredential({address:fr?to==null?void 0:to.address:void 0,environmentId:qr,user:Br,wallet:to})}catch{return isSessionKeyCompatibleWalletConnector(to==null?void 0:to.connector)&&(!((Nn=to==null?void 0:to.connector)===null||Nn===void 0)&&Nn.removeSessionKeys)&&(yield(wn=to==null?void 0:to.connector)===null||wn===void 0?void 0:wn.removeSessionKeys(),yield(zn=to==null?void 0:to.connector)===null||zn===void 0?void 0:zn.createOrRestoreSession({ignoreRestore:!0})),exportCredential({address:fr?to==null?void 0:to.address:void 0,environmentId:qr,user:Br,wallet:to})}}),{onFailure:Nn=>{logger$6.error("Failed to export",Nn),dynamicEvents.emit("embeddedWalletRevealFailed",Nn)},onSuccess:Nn=>{var wn,zn;if(_i&&Nn&&(Nn!=null&&Nn.length)){const fo=Vr==null?void 0:Vr.getElementById("coinbase-waas-key-export");(wn=fo==null?void 0:fo.contentWindow)===null||wn===void 0||wn.postMessage({key:(zn=Nn[0])===null||zn===void 0?void 0:zn.ecKeyPrivate,type:"export_key"},"*"),An(!0)}}}),Tn=reactExports.useMemo(()=>{if(so){if(so instanceof DynamicError)return so.message;try{return getProperErrorMessage(so)}catch(Nn){Nn instanceof AccessBlockedError&&Jr("access-blocked");return}}},[so,Jr]),{t:Hr}=useTranslation(),Xr=jsxRuntimeExports.jsxs("div",{children:[jr&&_n(jr)&&!co&&no&&!so&&jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__zerodev-warning",children:[jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__zerodev-warning__title-row",children:[jsxRuntimeExports.jsx(SvgInfo,{className:"embedded-reveal-view__zerodev-warning__icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"bold",copykey:"dyn_embedded_reveal.aa_warning.title",children:Hr("dyn_embedded_reveal.aa_warning.title")})]}),jsxRuntimeExports.jsxs(Typography,{variant:"body_normal",weight:"regular",copykey:"dyn_embedded_reveal.aa_warning.subtitle",children:[Hr("dyn_embedded_reveal.aa_warning.subtitle"),jsxRuntimeExports.jsx("button",{onClick:()=>{Wr(!1),Zr("send-balance")},className:"embedded-reveal-view__zerodev-warning__link-button",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"primary",className:"underline",copykey:"dyn_embedded_reveal.aa_warning.button",children:Hr("dyn_embedded_reveal.aa_warning.button")})})]})]}),jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__body__description",children:!co&&no&&!so?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"regular",children:Hr("dyn_embedded_reveal.reveal_description")}):jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__header",children:jsxRuntimeExports.jsx(SvgExportEmbeddedHero,{})})})]});reactExports.useEffect(()=>{var Nn;if(!((Nn=jn==null?void 0:jn.current)===null||Nn===void 0)&&Nn.children&&no){const wn=jn.current.children[0];wn==null||wn.setAttribute("style",!ro||fr?"height: 60px":"height: 100px")}},[jn,no,ro,fr]);const Sn=jsxRuntimeExports.jsx(IconButton,{onClick:()=>Wr(!1),type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})}),Rn=!co&&no&&!so,Pn=Hr(!ro||fr?"dyn_embedded_reveal.private_key_title":"dyn_embedded_reveal.recovery_phrase_title"),On=Rn?Pn:Hr("dyn_embedded_reveal.agreement_title"),Zn=jsxRuntimeExports.jsx("iframe",{src:(kr=ApiEndpoint$1==null?void 0:ApiEndpoint$1.getBaseUrl())===null||kr===void 0?void 0:kr.replace("api/v0","coinbase-waas-key-export.html"),id:"coinbase-waas-key-export",title:"Coinbase WaaS key export",height:In?"100%":0,width:In?"100%":0,style:{borderRadius:"0.75rem"},allow:"clipboard-write"});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Sn,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",children:On})}),jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view",children:jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body",children:[Xr,_i&&Zn,Gr?jsxRuntimeExports.jsx("div",{id:iframeContainerId,style:{display:no?"block":"none"},ref:jn}):null,Rn?jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",onClick:()=>Wr(!1),loading:co,copykey:"dyn_embedded_reveal.done_button_label",typographyProps:{color:"inherit"},children:Hr("dyn_embedded_reveal.done_button_label")}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__body__description",children:jsxRuntimeExports.jsx(Badge,{text:Hr("dyn_embedded_reveal.badge_label"),className:"embedded-reveal-view__body__badge"})}),Tn&&jsxRuntimeExports.jsx(ErrorContainer,{children:Tn}),jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body__card",children:[jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body__card__statement",children:[jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__body__card__icon",children:jsxRuntimeExports.jsx(SvgWalletV2,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_embedded_reveal.statement_1.title",children:Hr("dyn_embedded_reveal.statement_1.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",weight:"regular",copykey:"dyn_embedded_reveal.statement_1.description",children:Hr("dyn_embedded_reveal.statement_1.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body__card__statement",children:[jsxRuntimeExports.jsx("div",{className:"embedded-reveal-view__body__card__icon",children:jsxRuntimeExports.jsx(SvgEyeOffIcon,{})}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_embedded_reveal.statement_2.title",children:Hr("dyn_embedded_reveal.statement_2.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",weight:"regular",copykey:"dyn_embedded_reveal.statement_2.description",children:Hr("dyn_embedded_reveal.statement_2.description",{credential_type:Pn==null?void 0:Pn.toLowerCase()})})]})]})]}),jsxRuntimeExports.jsxs("div",{className:"embedded-reveal-view__body__confirm_card",children:[jsxRuntimeExports.jsxs("button",{className:"embedded-reveal-view__body__card__acknowledgement",onClick:()=>Cn(!En),children:[jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Checkbox,{checked:En,onChange:()=>Cn(!En),className:"embedded-reveal-view__body__card__statement__checkbox",id:"embedded-reveal-checkbox-1"})}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",style:{letterSpacing:"-0.15px"},copykey:"dyn_embedded_reveal.checkbox_label",children:Hr("dyn_embedded_reveal.checkbox_label")})})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},onClick:()=>io(),disabled:!En||oo,loading:co,dataTestId:"embedded-reveal-button",copykey:"dyn_embedded_reveal.reveal_button_label",children:Hr("dyn_embedded_reveal.reveal_button_label")})]})]})]})})]})},useTimeout=(fr,br)=>{const wr=reactExports.useRef(fr);useIsomorphicLayoutEffect$2(()=>{wr.current=fr},[fr]),reactExports.useEffect(()=>{if(!br&&br!==0)return;const Er=setTimeout(()=>wr.current(),br);return()=>clearTimeout(Er)},[br])};var _path$h,_excluded$o=["title","titleId"];function _extends$o(){return _extends$o=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$o(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgExternalLink=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$o(br,_excluded$o);return reactExports.createElement("svg",_extends$o({width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$h||(_path$h=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.333 1.333a.667.667 0 1 1 0-1.333h4c.368 0 .667.298.667.667v4a.667.667 0 0 1-1.333 0v-2.39L5.138 7.804a.667.667 0 1 1-.943-.943l5.529-5.529h-2.39ZM2 2.667a.667.667 0 0 0-.667.666V10c0 .368.299.667.667.667h6.667A.667.667 0 0 0 9.333 10V7.333a.667.667 0 0 1 1.334 0V10a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3.333a2 2 0 0 1 2-2h2.667a.667.667 0 0 1 0 1.334H2Z",fill:"currentColor"})))};const browserIconMap={brave:BraveIcon,chrome:ChromeIcon,edge:EdgeIcon,firefox:FirefoxIcon,safari:SafariIcon},getBrowserIcon=fr=>browserIconMap[fr],useWalletDownloadLinks=fr=>{const{walletBook:br}=useWalletBookContext();if(!fr)return[];const wr=getWalletLinks(br,fr.key),{currentDesktopUrl:Er,userBrowser:kr}=parseWalletLinks(wr);return kr&&Er?[{Icon:getBrowserIcon(kr),key:kr,link:Er,name:kr}]:Object.entries(wr).filter(([,jr])=>jr!=="").filter(([jr])=>jr!=="ios"&&jr!=="android").map(([jr,Br])=>({Icon:getBrowserIcon(jr),key:jr,link:Br,name:jr}))},generateMatrix=(fr,br)=>{const wr=Array.prototype.slice.call(browser$h.create(fr,{errorCorrectionLevel:br}).modules.data,0),Er=Math.sqrt(wr.length);return wr.reduce((kr,jr,Br)=>(Br%Er===0?kr.push([jr]):kr[kr.length-1].push(jr))&&kr,[])},QRCode=({ecl:fr="M",Icon:br,logoMargin:wr=0,logoSize:Er=40,size:kr=250,value:jr,accentColor:Br="currentColor",walletKey:Wr=void 0,showQrCodeImage:qr})=>{const{data:Gr}=usePromise(()=>browser$h.toDataURL(jr)),Vr=reactExports.useMemo(()=>{const _n=[],En=generateMatrix(jr||"QR Code value",fr),Cn=kr/En.length;[{x:0,y:0},{x:1,y:0},{x:0,y:1}].forEach(({x:ro,y:to})=>{const _i=(En.length-7)*Cn*ro,oo=(En.length-7)*Cn*to;for(let io=0;io<3;io++)_n.push(jsxRuntimeExports.jsx("rect",{"data-key":`corner-square-${ro}-${to}-${io}`,fill:io%2!==0?"var(--background)":Br,height:Cn*(7-io*2),rx:io===0?10:io===1?7:20,ry:io===0?10:io===1?7:20,width:Cn*(7-io*2),x:_i+Cn*io,y:oo+Cn*io},`corner-square-${ro}-${to}-${io}`))});const An=Math.floor(Er*1.5/Cn),jn=En.length/2-An/2,eo=En.length/2+An/2-1;for(let ro=0;roEn.length-8&&to<7||ro<7&&to>En.length-8||ro>jn&&rojn&&to.9?Br:"currentColor",r:Cn/2.25},`dot-${ro}-${to}`)));return _n},[fr,Er,kr,jr,Br]),Zr=kr/2-Er/2-wr,Qr=!Wr||["coinbase","walletconnect"].includes(Wr)?void 0:"walletConnect";return jsxRuntimeExports.jsx("div",{className:"qrcode__container",children:jsxRuntimeExports.jsx("div",{className:"qrcode",children:qr?jsxRuntimeExports.jsx("img",{"data-testid":"qr-code-image",src:Gr,alt:""}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("svg",{height:"100%",width:"100%",viewBox:`0 0 ${kr} ${kr}`,"data-testid":"qr-code",children:[jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip-logo",children:jsxRuntimeExports.jsx("rect",{height:Er,width:Er,x:Zr,y:Zr,rx:7,ry:7})})}),jsxRuntimeExports.jsx("rect",{fill:"none",height:kr,width:kr}),Vr]}),jsxRuntimeExports.jsx(IconWithSpinner,{Icon:br,iconSize:Er,isSpinning:!0,className:"qrcode__icon",indicator:Qr})]})})})},LoadingQrCode=({Icon:fr,logoSize:br})=>jsxRuntimeExports.jsx("div",{className:"qrcode__container qrcode","data-testid":"loading-qrcode",children:jsxRuntimeExports.jsx(IconWithSpinner,{Icon:fr,iconSize:br,isSpinning:!0,className:"qrcode__icon"})}),QrCodeContainer=({accentColor:fr,walletConnector:br,qrcodeValue:wr,Icon:Er,showCopyToClipboardButton:kr=!1,desktopUri:jr,showQrCodeMessage:Br,showQrCodeImage:Wr})=>{const{t:qr}=useTranslation(),{setView:Gr}=useViewContext(),Vr=useWalletDownloadLinks(br),Zr=()=>jr?jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"get-extension-button",buttonPadding:"small",buttonVariant:"primary",buttonClassName:"qr-code-button",onClick:()=>window.open(jr),copykey:"dyn_qr_code.open_button",typographyProps:{variant:"button_secondary"},startSlot:jsxRuntimeExports.jsx(Icon,{size:"xsmall",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgExternalLink,{})}),children:qr("dyn_qr_code.open_button")}):Vr!=null&&Vr.length?jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,dataTestId:"get-extension-button",buttonPadding:"small",buttonVariant:"primary",buttonClassName:"qr-code-button",onClick:()=>Gr("no-qr-not-installed"),copykey:"dyn_qr_code.get_extension_button",typographyProps:{variant:"button_secondary"},startSlot:jsxRuntimeExports.jsx(Icon,{size:"xsmall",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgExternalLink,{})}),children:qr("dyn_qr_code.get_extension_button")}):null;return jsxRuntimeExports.jsxs("div",{className:classNames$1("qrcode-container__container",{"qrcode-container__container--message":Br}),children:[jsxRuntimeExports.jsxs("div",{className:"qrcode-container__top",children:[wr.length?jsxRuntimeExports.jsx(QRCode,{Icon:Er,accentColor:fr,value:wr,logoSize:50,walletKey:br==null?void 0:br.key,showQrCodeImage:Wr}):jsxRuntimeExports.jsx(LoadingQrCode,{Icon:Er,logoSize:50}),jsxRuntimeExports.jsxs("div",{className:"button-container",children:[kr&&jsxRuntimeExports.jsx(CopyButton,{variant:"button",textToCopy:wr,disabled:!wr.length,buttonClassName:"qr-code-button",copykey:"dyn_qr_code.copy_button",startSlot:jsxRuntimeExports.jsx(Icon,{size:"mini",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgLink,{})}),children:qr("dyn_qr_code.copy_button")}),Zr()]})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"regular",className:"qrcode-container__content",copykey:"dyn_qr_code.scan_title",children:qr("dyn_qr_code.scan_title",{app:br?"wallet":"app"})})]})},QrCodeWrapper=({uri:fr,desktopUri:br,icon:wr,accentColor:Er,showCopyToClipboardButton:kr,walletConnector:jr})=>{const[Br,Wr]=reactExports.useState(!1),[qr,Gr]=reactExports.useState(!1);return useTimeout(()=>Wr(!0),fr.length?5e3:null),jsxRuntimeExports.jsxs("div",{"data-testid":"qr-code-wrapper",className:"qr-code-wrapper",children:[jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{style:{width:"100%"}}),children:Br&&!qr&&jsxRuntimeExports.jsxs("div",{className:"qr-code-wrapper__scan-issue-message",children:[jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_small",children:"If you're having issues scanning, click "}),jsxRuntimeExports.jsx("button",{"data-testid":"qr-code-wrapper__scan-issue-button",className:"qr-code-wrapper__scan-issue-button",onClick:()=>Gr(!0),children:"here"})]})}),jsxRuntimeExports.jsx(QrCodeContainer,{showQrCodeMessage:Br,desktopUri:br,accentColor:Er,walletConnector:jr,qrcodeValue:fr,Icon:wr,showCopyToClipboardButton:kr,showQrCodeImage:qr})]})},FarcasterConnectView=({url:fr})=>{const{theme:{theme:br}}=useThemeContext(),wr=useIconThemeVariant(),Er=jsxRuntimeExports.jsx(SocialIcon,{name:"farcaster",variant:wr});return jsxRuntimeExports.jsx(QrCodeWrapper,{uri:fr,accentColor:wr==="dark"?br.colors.textPrimary:"#7b65c0",icon:Er,showCopyToClipboardButton:!0})},GlobalWalletConfirmView=({pairingInfo:fr,onConfirm:br,onCancel:wr})=>{const{t:Er}=useTranslation(),[kr,jr]=reactExports.useState(!1),Br=()=>{jr(!0)};return jsxRuntimeExports.jsx("div",{className:"global-wallet-confirm",children:jsxRuntimeExports.jsx("div",{className:"popup-content",children:jsxRuntimeExports.jsxs("div",{className:"wallet-connection-view",children:[!kr&&jsxRuntimeExports.jsx("img",{src:fr.icons[0],alt:`${fr.name} icon`,className:"dapp-icon",onError:Br}),jsxRuntimeExports.jsx(Typography,{className:"connection-title",variant:"title",font:"bold",children:Er("global_wallet.confirm.description",{name:fr.name})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"dapp-url",children:fr.url}),jsxRuntimeExports.jsxs("div",{className:"button-group",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"cancel-button",onClick:wr,type:"submit",buttonPadding:"large",children:Er("global_wallet.confirm.cancel_button")}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"connect-global-button",onClick:br,type:"submit",buttonPadding:"large",typographyProps:{color:"white"},children:Er("global_wallet.confirm.connect_button")})]})]})})})};var _g$6,_defs$6,_excluded$n=["title","titleId"];function _extends$n(){return _extends$n=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$n(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgBlueWalletconnect=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$n(br,_excluded$n);return reactExports.createElement("svg",_extends$n({width:12,height:12,viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_g$6||(_g$6=reactExports.createElement("g",{clipPath:"url(#blue-walletconnect_svg__a)"},reactExports.createElement("path",{d:"M6 12A6 6 0 1 0 6 0a6 6 0 0 0 0 12Z",fill:"#4084ED"}),reactExports.createElement("path",{d:"M3.343 4.286a3.761 3.761 0 0 1 5.314 0l.176.176a.186.186 0 0 1 0 .265l-.603.603a.096.096 0 0 1-.133 0l-.243-.244a2.624 2.624 0 0 0-3.708 0l-.26.26a.096.096 0 0 1-.132 0l-.606-.6a.186.186 0 0 1 0-.266l.195-.194Zm6.563 1.248.538.537a.185.185 0 0 1 0 .265L8.018 8.757a.187.187 0 0 1-.264 0L6.034 7.04a.047.047 0 0 0-.068 0l-1.72 1.718a.187.187 0 0 1-.264 0l-2.426-2.42a.186.186 0 0 1 0-.266l.538-.537a.187.187 0 0 1 .265 0l1.72 1.718a.047.047 0 0 0 .067 0l1.72-1.718a.187.187 0 0 1 .265 0l1.72 1.718a.047.047 0 0 0 .068 0l1.72-1.718a.19.19 0 0 1 .267 0Z",fill:"#fff"}))),_defs$6||(_defs$6=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"blue-walletconnect_svg__a"},reactExports.createElement("path",{fill:"#fff",d:"M0 0h12v12H0z"})))))};const InlineIconTypography=({children:fr})=>jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",children:jsxRuntimeExports.jsx("span",{className:"inline-icon-text",children:fr})}),GlobalWalletInfoView=()=>{const{t:fr}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"info-card",children:jsxRuntimeExports.jsxs("div",{className:"wrapper",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"bold",color:"primary",as:"h2",children:"How do I find the URI or QR code?"}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",children:fr("global_wallet.help.step.1")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",children:fr("global_wallet.help.step.2")}),jsxRuntimeExports.jsxs(InlineIconTypography,{children:["3. Open"," ",jsxRuntimeExports.jsxs("span",{className:"nowrap",children:["WalletConnect ",jsxRuntimeExports.jsx(SvgBlueWalletconnect,{})]}),"from the list, this should show a QR code to scan"]}),jsxRuntimeExports.jsxs(InlineIconTypography,{children:["4. If you are not using the QR code, locate and click",jsxRuntimeExports.jsxs("span",{className:"nowrap",children:[jsxRuntimeExports.jsx(SvgCopy,{})," to copy"]})," ","the URI code"]})]})})};var _path$g,_excluded$m=["title","titleId"];function _extends$m(){return _extends$m=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$m(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgExclamation=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$m(br,_excluded$m);return reactExports.createElement("svg",_extends$m({width:7,height:32,viewBox:"0 0 7 32",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$g||(_path$g=reactExports.createElement("path",{d:"M6.4 3.2a3.2 3.2 0 0 0-6.4 0V16a3.2 3.2 0 0 0 6.4 0V3.2ZM3.2 25.6a3.2 3.2 0 0 0 0 6.4h.032a3.2 3.2 0 0 0 0-6.4H3.2Z",fill:"#F9F9FB"})))},_path$f,_excluded$l=["title","titleId"];function _extends$l(){return _extends$l=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$l(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgExclamationCircle=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$l(br,_excluded$l);return reactExports.createElement("svg",_extends$l({width:17,height:18,viewBox:"0 0 17 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$f||(_path$f=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.5 2.333a6.667 6.667 0 1 0 0 13.334 6.667 6.667 0 0 0 0-13.334ZM.167 9a8.333 8.333 0 1 1 16.666 0A8.333 8.333 0 0 1 .167 9ZM8.5 4.833c.46 0 .833.373.833.834V9a.833.833 0 1 1-1.667 0V5.667c0-.46.374-.834.834-.834Zm-.833 7.5c0-.46.373-.833.833-.833h.008a.833.833 0 0 1 0 1.667H8.5a.833.833 0 0 1-.833-.834Z",fill:"#FF4646"})))},_path$e,_excluded$k=["title","titleId"];function _extends$k(){return _extends$k=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$k(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgCautionTriangle=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$k(br,_excluded$k);return reactExports.createElement("svg",_extends$k({width:17,height:16,viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$e||(_path$e=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.335 1.917c.962-1.667 3.368-1.667 4.33 0l5.774 10c.962 1.666-.241 3.75-2.166 3.75H2.726c-1.924 0-3.127-2.084-2.165-3.75l5.774-10Zm2.887.833a.833.833 0 0 0-1.444 0l-5.773 10A.833.833 0 0 0 2.726 14h11.547a.833.833 0 0 0 .722-1.25l-5.773-10ZM8.5 5.667c.46 0 .833.373.833.833v1.667a.833.833 0 0 1-1.666 0V6.5c0-.46.373-.833.833-.833ZM7.667 11.5c0-.46.373-.833.833-.833h.008a.833.833 0 1 1 0 1.666H8.5a.833.833 0 0 1-.833-.833Z",fill:"#DD8500"})))},_circle$3,_excluded$j=["title","titleId"];function _extends$j(){return _extends$j=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$j(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgWarningRed=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$j(br,_excluded$j);return reactExports.createElement("svg",_extends$j({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_circle$3||(_circle$3=reactExports.createElement("circle",{cx:32,cy:32,r:32,fill:"#FF4646"})))},_circle$2,_excluded$i=["title","titleId"];function _extends$i(){return _extends$i=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$i(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgWarningOrange=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$i(br,_excluded$i);return reactExports.createElement("svg",_extends$i({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_circle$2||(_circle$2=reactExports.createElement("circle",{cx:32,cy:32,r:32,fill:"#DD8500"})))};const GlobalWalletMaliciousView=({maliciousSiteInfo:fr})=>{const{t:br}=useTranslation(),{setDynamicWidgetView:wr}=useWidgetContext(),{setShowAuthFlow:Er}=useInternalDynamicContext(),kr=()=>{wr("global-wallet"),Er(!1,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1})},jr=()=>{var Br;(Br=fr.proceedFlow)===null||Br===void 0||Br.call(fr)};return jsxRuntimeExports.jsx("div",{className:"malicious-site-view",children:jsxRuntimeExports.jsx("div",{className:"popup-content",children:jsxRuntimeExports.jsxs("div",{className:"wallet-connection-view",children:[jsxRuntimeExports.jsxs("div",{className:"warning-icon-container",style:{position:"relative"},children:[fr.isDefinitelyMalicious?jsxRuntimeExports.jsx(SvgWarningRed,{className:"warning-icon"}):jsxRuntimeExports.jsx(SvgWarningOrange,{className:"warning-icon"}),jsxRuntimeExports.jsx(SvgExclamation,{className:"exclamation-icon",style:{left:"50%",position:"absolute",top:"50%",transform:"translate(-50%, -50%)"}})]}),jsxRuntimeExports.jsx(Typography,{className:"connection-title",variant:"title",font:"bold",color:"primary",children:fr.isDefinitelyMalicious?br("global_wallet.malicious_site.certain.title"):br("global_wallet.malicious_site.unknown.title")}),jsxRuntimeExports.jsxs("div",{className:`subtitle-container ${fr.isDefinitelyMalicious?"definitely-malicious":"unknown"}`,children:[jsxRuntimeExports.jsxs("div",{className:"subtitle-header-container",children:[fr.isDefinitelyMalicious?jsxRuntimeExports.jsx(SvgExclamationCircle,{className:"caution-icon"}):jsxRuntimeExports.jsx(SvgCautionTriangle,{className:"caution-icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"subtitle-header",color:"primary",children:fr.isDefinitelyMalicious?br("global_wallet.malicious_site.certain.subtitle_header"):br("global_wallet.malicious_site.unknown.subtitle_header")})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"subtitle",color:"secondary",children:fr.isDefinitelyMalicious?br("global_wallet.malicious_site.certain.subtitle_text"):br("global_wallet.malicious_site.unknown.subtitle_text")})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"site-info",color:"secondary",children:fr.url}),jsxRuntimeExports.jsxs("div",{className:"button-group",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"cancel-button",buttonVariant:"primary",type:"submit",buttonPadding:"large",onClick:kr,copykey:"global_wallet.malicious_site.go_back",children:fr.isDefinitelyMalicious?br("global_wallet.malicious_site.certain.go_back"):br("global_wallet.malicious_site.unknown.go_back")}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"proceed-button",buttonVariant:"secondary",type:"submit",buttonPadding:"large",onClick:jr,copykey:"global_wallet.malicious_site.proceed",typographyProps:{color:"error-1"},children:fr.isDefinitelyMalicious?br("global_wallet.malicious_site.certain.proceed"):br("global_wallet.malicious_site.unknown.proceed")})]})]})})})},DefaultFooter=({hideBorder:fr})=>jsxRuntimeExports.jsx("div",{className:classNames$1("default-footer__footer",{"default-footer__footer--hidden":fr}),"data-testid":"default-footer"});var _path$d,_excluded$h=["title","titleId"];function _extends$h(){return _extends$h=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$h(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgSearch=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$h(br,_excluded$h);return reactExports.createElement("svg",_extends$h({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$d||(_path$d=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.667 2.667a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm-5.333 4a5.333 5.333 0 1 1 9.546 3.27l3.592 3.592a.667.667 0 0 1-.943.942L9.937 10.88a5.333 5.333 0 0 1-8.604-4.213Z",fill:"currentColor"})))};const Search=({className:fr="",id:br,label:wr,type:Er,onChange:kr,onBlur:jr,name:Br,value:Wr,onClickClear:qr,copykey:Gr})=>jsxRuntimeExports.jsxs("label",{htmlFor:br,className:classNames$1("search__container",Wr?"search__container--active":void 0),children:[jsxRuntimeExports.jsx("div",{className:"search-icon__container",children:jsxRuntimeExports.jsx(SvgSearch,{})}),jsxRuntimeExports.jsx("input",{name:Br,value:Wr,onChange:kr,onBlur:jr,type:Er,id:br,placeholder:wr,className:classNames$1("search__input",fr),"data-testid":"Search",copykey:Gr}),Wr.length>0&&jsxRuntimeExports.jsx("button",{type:"button",onClick:qr,className:"search__button--clear",children:"Clear"})]}),findLastPriorityIndex=(fr,br)=>br.reduce((wr,Er)=>{const kr=fr.indexOf(Er.toLowerCase());return kr>wr?kr:wr},-1),getCalculatedOffset=({hasWalletFilter:fr,defaultOffset:br,list:wr,priorityList:Er})=>{const kr=findLastPriorityIndex(wr,Er);return br===DEFAULT_NUMBER_OF_WALLETS_TO_SHOW&&!fr&&wr.length>br&&kr!==-1?kr+1:br},findGroupIndex=(fr,br)=>br.findIndex(wr=>isWalletGroup(wr)&&wr.key===fr),groupWalletOptions=(fr,br)=>{const wr=[];return br.forEach(Er=>{var kr;if(!Er.group)return wr.push(Er);const jr=findGroupIndex(Er.group,wr);if(jr>-1)return(kr=wr[jr].groupedWallets)===null||kr===void 0?void 0:kr.push(Er);if(!br.some(Gr=>{var Vr;const Zr=Er.group===Gr.group,Jr=Er.key!==Gr.key,Qr=((Vr=Gr.injectedConfig)===null||Vr===void 0?void 0:Vr.length)&&Gr.injectedConfig.length>1;return Zr&&(Qr||Jr)}))return wr.push(Er);const Wr=getWalletGroup(fr,Er.group),qr={groupedWallets:[Er],key:Wr.key,name:Wr.name};return wr.push(qr)}),wr},filterConnectedWallets=({walletOptions:fr,userWallets:br})=>{const wr=new Set(br.map(Er=>Er.connector.key));return(wr.has("phantom")||wr.has("phantomledger"))&&(wr.add("phantom"),wr.add("phantomledger")),fr.filter(Er=>!wr.has(Er.walletConnector.key))},getPlatformForConnector=fr=>isMobile()||fr.isWalletConnect?"mobile":"browserExtension",staticWalletFilter=(fr,br,wr)=>br.filter(Er=>isWalletEventSupported(findWalletBookWallet(wr,Er.key),"accountChanged",getPlatformForConnector(Er.walletConnector))?!0:!fr.some(kr=>kr.connector.key===Er.key)),filterWalletConnectWallets=({walletOptions:fr,userWallets:br})=>br.some(Er=>Er.connector.isWalletConnect)?fr.filter(Er=>!Er.walletConnector.isWalletConnect):fr,applyMultiWalletFilters=({authMode:fr,userWallets:br,walletOptions:wr,walletBook:Er})=>{const kr=filterWalletConnectWallets({userWallets:br,walletOptions:wr});return fr==="connect-only"?filterConnectedWallets({userWallets:br,walletOptions:kr}):staticWalletFilter(br,kr,Er)},PRIORITY_WALLET_LIST=["metamask","coinbase","walletconnect","phantom","argentx","blocto","solflare","braavos","trust","rainbow","dapper","glow","lilico"],sortedInputList=(fr,br)=>{const wr=[],Er=[],kr=[];fr.forEach(Wr=>{const qr=br.includes(Wr.key);qr?wr.push(Wr):PRIORITY_WALLET_LIST.includes(Wr.key)&&!qr?Er.push(Wr):kr.push(Wr)});const jr=Er.slice().sort((Wr,qr)=>PRIORITY_WALLET_LIST.indexOf(Wr.key)-PRIORITY_WALLET_LIST.indexOf(qr.key));return[...wr.slice().sort((Wr,qr)=>br.indexOf(Wr.key)-br.indexOf(qr.key)),...jr,...kr]},walletListBuilder=({authMode:fr,userWallets:br,multiWallet:wr,numberOfWalletsToShow:Er,inputList:kr,isWalletConnectList:jr,lastUsedWalletKey:Br,searchFilter:Wr,walletsFilter:qr,loginWithEmail:Gr,groupWallets:Vr,walletBook:Zr,showMoreWalletsWithFilter:Jr,recommendedWallets:Qr})=>{let _n=kr;jr&&(_n=kr.filter(co=>co.walletConnector.isWalletConnect&&co.key!=="walletconnect")),wr&&(_n=applyMultiWalletFilters({authMode:fr,userWallets:br,walletBook:Zr,walletOptions:_n}));let En;const Cn=!!qr,In=[],An=[],jn=[],eo=Array.from(new Set((Qr||[]).map(co=>co.walletKey))),ro=orderAndFilterList(_n,qr,jr,eo);ro.forEach(co=>{const so=eo==null?void 0:eo.includes(co.key);if(!isEmbeddedConnector(co.walletConnector)){if(co.key==="unknown"||!co.walletConnector.isAvailable)return;so?In.push(co):Br===co.key?En=co:co.isInstalledOnBrowser?An.push(co):jn.push(co)}});const to=[...En?[En]:[]],_i=[...In,...to,...An,...jn],oo=Vr?groupWalletOptions(Zr,_i):_i,io=Jr&&Cn?calculateWalletOffsetBasedOnInstalledAndLastUsedWallets(ro,to.concat(An),Er):Er;return{numberOfWallets:_i.length,walletsList:listToDisplay(oo,Wr,jr,io,Cn,Gr)}},orderAndFilterList=(fr,br,wr,Er)=>{const kr=sortedInputList(fr,Er);return!wr&&br?br(kr):kr},KEEP_WALLETS_NAME_LIST=["walletconnect","bitcoin.com wallet"],applySearchFilterToWalletOptionList=(fr,br)=>{const wr=fr.trim().toLowerCase(),Er=kr=>{const jr=kr.trim().toLowerCase();return KEEP_WALLETS_NAME_LIST.includes(jr)?jr:jr.replace("wallet","").replace("evm","").replace("starknet","").replace("solana","").replace("flow","").replace("bitcoin","")};return br.filter(kr=>{var jr;return Er(kr.name).includes(wr)||((jr=kr.groupedWallets)===null||jr===void 0?void 0:jr.some(Br=>Er(Br.name).includes(wr)))})},listToDisplay=(fr,br,wr,Er,kr,jr)=>{if(br)return applySearchFilterToWalletOptionList(br,fr);if(wr)return fr;if(jr)return fr.slice(0,Er);{const Br=fr.map(qr=>qr.name.toLowerCase()),Wr=getCalculatedOffset({defaultOffset:Er,hasWalletFilter:kr,list:Br,priorityList:PRIORITY_WALLET_LIST});return fr.slice(0,Wr)}},calculateWalletOffsetBasedOnInstalledAndLastUsedWallets=(fr,br,wr)=>{const Er=fr.slice(0,wr),kr=br.filter(jr=>!Er.includes(jr)).length;return wr+kr};var _path$c,_rect,_rect2,_rect3,_excluded$g=["title","titleId"];function _extends$g(){return _extends$g=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$g(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgNoWalletFound=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$g(br,_excluded$g);return reactExports.createElement("svg",_extends$g({width:121,height:81,viewBox:"0 0 121 81",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$c||(_path$c=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M99.064 34.016c-6.654 0-12.048 5.394-12.048 12.048 0 6.653 5.394 12.047 12.048 12.047 6.653 0 12.047-5.394 12.047-12.047 0-6.654-5.394-12.048-12.047-12.048ZM83 46.064C83 37.192 90.192 30 99.064 30c8.871 0 16.063 7.192 16.063 16.064 0 3.712-1.259 7.13-3.373 9.85l8.658 8.658a2.008 2.008 0 0 1-2.84 2.84l-8.658-8.658a15.994 15.994 0 0 1-9.85 3.373C90.192 62.127 83 54.935 83 46.064Z",fill:"currentColor",fillOpacity:.35})),_rect||(_rect=reactExports.createElement("rect",{y:8,width:121,height:16,rx:4,fill:"currentColor",fillOpacity:.3})),_rect2||(_rect2=reactExports.createElement("rect",{y:30,width:75,height:16,rx:4,fill:"currentColor",fillOpacity:.3})),_rect3||(_rect3=reactExports.createElement("rect",{y:52,width:75,height:16,rx:4,fill:"currentColor",fillOpacity:.3})))};const FilterBridgeChainsName=fr=>br=>br.filter(wr=>wr.walletConnector.supportedChains.includes(fr)),SearchNotFoundMessage=({title:fr,subtitle:br,image:wr})=>{const{t:Er}=useTranslation();return jsxRuntimeExports.jsxs("div",{className:"search-instead__container",children:[wr&&jsxRuntimeExports.jsx(Icon,{className:"search-instead__container__image",color:"text-tertiary",children:wr}),jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",weight:"regular",copykey:"dyn_wallet_list.wallet_missing.title",children:fr||Er("dyn_wallet_list.wallet_missing.title")}),jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"button_primary",weight:"regular",copykey:"dyn_wallet_list.wallet_missing.description",children:br||Er("dyn_wallet_list.wallet_missing.description")})]})},WalletListGridTabs=({items:fr,onSelect:br,value:wr})=>jsxRuntimeExports.jsx("div",{className:"wallet-list-grid-tabs",children:fr.map((Er,kr)=>{const jr=wr===kr,{icon:Br,text:Wr}=Er.label,qr=`${Wr}-${Br}-${fr.indexOf(Er)}`,Gr=typeof Br=="string"?jsxRuntimeExports.jsx("img",{src:Br,alt:Wr}):Br;return jsxRuntimeExports.jsxs("button",{type:"button",className:classNames$1("wallet-list-grid-tabs__button",{"wallet-list-grid-tabs__button--selected":jr,"wallet-list-grid-tabs__button--text":!!Wr}),tabIndex:-1,"aria-label":Wr,onClick:()=>br(kr),children:[Gr&&jsxRuntimeExports.jsx(Icon,{size:"small",className:classNames$1({"wallet-list-grid-tabs__icon--selected":!jr}),children:Gr}),Wr&&jsxRuntimeExports.jsx(Typography,{as:"span",variant:"body_small",weight:jr?"bold":"medium",color:jr?"primary":"secondary",children:Wr})]},qr)})}),getEffectiveWalletFilter=(fr,br)=>fr&&(fr!=null&&fr.walletsFilter)?fr.walletsFilter:br,getEffectiveRecommendedWallets=(fr,br)=>fr&&(fr!=null&&fr.recommendedWallets)?fr.recommendedWallets:br,WalletList$1=({isWalletConnectList:fr=!1})=>{var br;useEffectOnce(()=>()=>StorageService==null?void 0:StorageService.setItem(WALLET_PICKER_SEARCH_KEY,""));const{walletsFilter:wr,walletConnectorOptions:Er,projectSettings:kr,defaultNumberOfWalletsToShow:jr,bridgeChainsToConnect:Br,authMode:Wr,multiWallet:qr,recommendedWallets:Gr,selectedTabIndex:Vr,setSelectedTabIndex:Zr,selectedTabSettings:Jr,tabsItems:Qr}=useInternalDynamicContext(),_n=useUserWallets(),{walletBook:En}=useWalletBookContext(),{error:Cn}=useErrorContext(),{showDefaultFooter:In}=useAuthLayoutChecks(),[An,jn]=reactExports.useState(!0),{t:eo}=useTranslation(),[ro,to]=reactExports.useState((br=StorageService.getItem(WALLET_PICKER_SEARCH_KEY))!==null&&br!==void 0?br:""),_i=(Br==null?void 0:Br.length)&&FilterBridgeChainsName(Br[0].chain),oo=_i&&_i(Er),io=getEffectiveRecommendedWallets(Jr,Gr),{numberOfWallets:co,walletsList:so}=walletListBuilder({authMode:Wr,groupWallets:!0,inputList:oo||Er,isWalletConnectList:fr,lastUsedWalletKey:StorageService.getItem(LAST_USED_WALLET),multiWallet:qr,numberOfWalletsToShow:jr,recommendedWallets:io,searchFilter:ro,showMoreWalletsWithFilter:!0,userWallets:_n,walletBook:En,walletsFilter:getEffectiveWalletFilter(Jr,wr)}),no=!!ro||co>jr&&so.length!==co,Tn=!!(Qr!=null&&Qr.length),Hr=reactExports.useRef(null),Xr=()=>{const Pn=Hr.current;Pn&&((Pn==null?void 0:Pn.scrollTop)>(Pn==null?void 0:Pn.clientHeight)*1.25?jn(!1):jn(!0))},Sn=Pn=>{StorageService.setItem(WALLET_PICKER_SEARCH_KEY,Pn),to(Pn)},Rn=kr?no&&jsxRuntimeExports.jsx("div",{className:classNames$1("wallet-list__search-container",{"wallet-list__search-container--scroll":!Cn}),children:jsxRuntimeExports.jsx(Search,{copykey:"dyn_wallet_list.search.label",label:eo("dyn_wallet_list.search.label",{numberOfWallets:co}),value:ro,onChange:({target:{value:Pn}})=>Sn(Pn),onClickClear:()=>Sn("")})}):jsxRuntimeExports.jsx(Skeleton$1,{className:"wallet-list__search-skeleton"});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Tn&&jsxRuntimeExports.jsx("div",{className:"wallet-list__tabs-container",children:jsxRuntimeExports.jsx(WalletListGridTabs,{items:Qr,value:Vr||0,onSelect:Zr})}),Rn,!!Cn&&jsxRuntimeExports.jsx(ErrorContainer,{className:"wallet-list__error-container",withIcon:!1,children:Cn}),jsxRuntimeExports.jsx("div",{className:"wallet-list__container",children:jsxRuntimeExports.jsxs("div",{className:classNames$1("wallet-list__scroll-container",{"wallet-list__scroll-container--error":!!Cn,"wallet-list__scroll-container--fixed-height":Tn}),"data-testid":"wallet-list-scroll-container",ref:Hr,onScroll:Xr,children:[kr?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Er.length===0&&jsxRuntimeExports.jsx(ErrorContainer,{copykey:"dyn_wallet_list.configuration_mismatch",children:eo("dyn_wallet_list.configuration_mismatch")}),Er.length&&so.length===0?jsxRuntimeExports.jsx(SearchNotFoundMessage,{title:eo("dyn_wallet_list.search.not_found.title"),subtitle:eo("dyn_wallet_list.search.not_found.description"),image:jsxRuntimeExports.jsx(SvgNoWalletFound,{})}):so.map((Pn,On)=>jsxRuntimeExports.jsx(WalletListItem,{wallet:Pn,onResetSearchValue:()=>Sn(""),recommendedWallets:io},`${Pn.key}_${On}`))]}):jsxRuntimeExports.jsx(Skeleton$1,{count:10,className:"wallet-list__tile-skeleton"}),no&&!ro&&kr&&jsxRuntimeExports.jsx(SearchNotFoundMessage,{})]})}),In&&jsxRuntimeExports.jsx(DefaultFooter,{hideBorder:!An})]})},FarcasterQrCodeView=()=>{const{setError:fr}=useErrorContext(),[br,wr]=reactExports.useState(void 0),{connectSocialAccount:Er}=useSocialAuth({onError:()=>fr("Something went wrong"),onFarcasterUrl:kr=>wr(kr),sessionTimeout:2e4});return useEffectOnce(()=>{Er({authMode:"signin",provider:ProviderEnum.Farcaster})}),jsxRuntimeExports.jsx(FarcasterConnectView,{url:br??""})},isPhoneNumberProviderEnabled=fr=>!!(fr&&isProviderEnabled(fr,ProviderEnum.Sms)),useSubmitPhoneNumber=({onSubmit:fr,onSubmitError:br,country:wr,phone:Er,setInvalidNumberMessage:kr})=>{const{engageCaptcha:jr}=useCaptchaContext(),{view:Br,setView:Wr}=useViewContext(),{environmentId:qr,projectSettings:Gr}=useInternalDynamicContext(),{setDisplayedDestination:Vr,setVerificationUUID:Zr,setRetryData:Jr}=useVerification(),{fieldsConfig:Qr}=useFields(),{t:_n}=useTranslation(),En=Cn=>__awaiter$e(void 0,void 0,void 0,function*(){if(wr)try{const In=de$3({dialCode:wr.dialCode,phone:Er}),{verificationUUID:An}=yield createSmsVerification({captchaToken:Cn,environmentId:qr,isoCountryCode:wr.iso2,phoneCountryCode:wr.dialCode,phoneNumber:In});Jr({dialCode:wr.dialCode,iso2:wr.iso2,phone:In}),Wr("login-with-sms-verification"),Vr(formatPhone(Er)),Zr(An);const jn={dialCode:wr.dialCode,iso2:wr.iso2,phone:In};dynamicEvents.emit("authInit",{option:jn,phone:jn,type:"sms"}),fr==null||fr()}catch(In){if(Wr(Br.type),In instanceof SmsVerificationError){let An=_n("dyn_login.helper.phone_number_form.invalid_phone");In.code==="too_many_sms_verification_attempts"&&(An=_n("dyn_login.helper.phone_number_form.too_many_sms_verification_attempts")),In.code&&In.code in translation.dyn_login.helper.phone_number_form&&(An=_n("dyn_login.helper.phone_number_form."+In.code)),kr(An)}else typeof In=="string"&&kr(In);br==null||br()}});return Cn=>__awaiter$e(void 0,void 0,void 0,function*(){var In;if(wr){Cn.preventDefault();try{Qr.phoneNumber.validation.validateSync(Er)}catch(An){const{message:jn}=An;kr(jn),br==null||br();return}if(!((In=Gr==null?void 0:Gr.security.hCaptcha)===null||In===void 0)&&In.enabled){jr({authMethod:"phone",onCaptchaSuccess:En});return}En()}})},PhoneNumberSignInSection=({isLoading:fr,onSubmit:br,onSubmitError:wr})=>{var Er,kr;const{projectSettings:jr}=useInternalDynamicContext(),Br=reactExports.useMemo(()=>{const eo=getSupportedCountriesForVerificationFromProjectSettings(jr);return getCustomCountries(getDefaultCountriesIfEmpty(eo))},[jr]),[Wr,qr]=reactExports.useState(void 0),[Gr,Vr]=reactExports.useState(!1),[Zr,Jr]=reactExports.useState({country:void 0,phone:""}),Qr=reactExports.useCallback(eo=>{Jr(eo),Vr(validatePhoneLength(eo.phone,eo.country))},[]),[_n,En]=reactExports.useState(!1),[Cn,In]=reactExports.useState(!1),An=useSubmitPhoneNumber({country:Zr.country,onSubmit:br,onSubmitError:wr,phone:Zr.phone,setInvalidNumberMessage:qr});if(!isPhoneNumberProviderEnabled((Er=jr==null?void 0:jr.providers)!==null&&Er!==void 0?Er:[]))return logger$6.error("Failed to render PhoneNumberSignInSection - no sign in provider enabled"),null;const jn=!(!((kr=jr==null?void 0:jr.design.modal)===null||kr===void 0)&&kr.emailSubmitButtonInsideInput);return jsxRuntimeExports.jsxs("form",{className:"login-with-phone-number-form",onSubmit:eo=>An(eo),children:[jsxRuntimeExports.jsx(PhoneNumberField,{countries:Br,onUpdate:Qr,error:Wr,setIsHovered:En,setIsFocused:In,appendRight:jsxRuntimeExports.jsx(InlineSubmitButton,{disabled:fr||!Gr,highlighted:Gr,isFocused:Cn,isHovered:_n,className:"login-with-phone-number-form__fields__inline-submit",emailSubmitButtonInsideInput:!jn})}),jn&&jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"big-submit-button",buttonClassName:"login-with-phone-number-form__button",type:"submit",loading:fr,disabled:fr||!Gr,buttonVariant:"brand-primary",buttonPadding:"login-screen-height",expanded:!0,typographyProps:{color:"inherit"},children:"Continue"})]})},getSocialSignInProviderFromString=fr=>{if(!fr)return;const br=Object.values(SocialSignInProviderEnum);for(const wr of br)if(wr===fr)return wr};var _path$b,_excluded$f=["title","titleId"];function _extends$f(){return _extends$f=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$f(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgDotsHorizontal=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$f(br,_excluded$f);return reactExports.createElement("svg",_extends$f({width:21,height:20,viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$b||(_path$b=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.7 10a1.667 1.667 0 1 1 3.333 0A1.667 1.667 0 0 1 2.7 10Zm5.833 0a1.667 1.667 0 1 1 3.334 0 1.667 1.667 0 0 1-3.334 0Zm5.834 0a1.667 1.667 0 1 1 3.333 0 1.667 1.667 0 0 1-3.333 0Z",fill:"currentColor",fillOpacity:.4})))};const providerLabel=fr=>{if(fr)return fr===SocialSignInProviderEnum.Coinbasesocial?"Coinbase":capitalize$1(fr)},INTERNAL_MAX_INLINE_ITEMS=5,SocialSignIn=({providers:fr,onSelectProvider:br,isLoading:wr,selectedProvider:Er,testId:kr,defaultProvider:jr,numOfItemsToDisplay:Br=5,collapsedLayout:Wr})=>{const{t:qr}=useTranslation(),Gr=useIconThemeVariant();jr&&!fr.includes(jr)&&([jr]=fr);const Vr=fr.filter(ro=>ro!==jr),Zr=Math.min(Br,INTERNAL_MAX_INLINE_ITEMS),Jr=Vr.length>Zr,Qr=Jr?Vr.slice(0,Zr-1):Vr.slice(0,Zr),[_n,En]=reactExports.useState(!1),Cn=()=>!wr&&En(!1),In=fr.length===1||!Wr&&fr.length<4,An=ro=>ro,jn=jsxRuntimeExports.jsx(IconButton,{onClick:Cn,type:"button",id:"close-button",disabled:wr,"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})}),eo=(ro,to=!1,_i=!1)=>jsxRuntimeExports.jsxs(IconListTile,{dataTestId:_i?`card-${ro}`:`inline-${ro}`,onClick:()=>br(ro),disabled:!!Er,className:classNames$1({"social-sign-in--card--tile":_i,"social-sign-in--tile":!_i,"social-sign-in--tile__full-width":to}),children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:jsxRuntimeExports.jsx(SocialIcon,{name:An(ro),variant:Gr}),isSpinning:Er===ro,iconSize:32}),!_i&&to&&jsxRuntimeExports.jsx(Typography,{variant:"button_primary",copykey:"dyn_login.social.button_label",children:qr("dyn_login.social.button_label",{provider:providerLabel(ro)})})]},An(ro));return fr.length?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"social-sign-in","data-testid":kr,children:[jr&&eo(jr,!0),Qr.map(ro=>eo(ro,In)),Jr&&jsxRuntimeExports.jsx(IconListTile,{dataTestId:"show-more-options",onClick:()=>En(!0),className:"social-sign-in--tile",children:jsxRuntimeExports.jsx(Icon,{color:"text-primary",children:jsxRuntimeExports.jsx(SvgDotsHorizontal,{})})},"show-more-options")]}),jsxRuntimeExports.jsx(OverlayCard,{isOpen:_n,onClickOverlay:Cn,children:jsxRuntimeExports.jsxs("div",{className:"social-sign-in--card",children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:jn,children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"body_normal",color:"primary",as:"span",children:"Choose a social account"})}),jsxRuntimeExports.jsx("div",{className:"social-sign-in--card--body",children:fr.map(ro=>eo(ro,!1,!0))})]})})]}):(logger$6.error("Failed to render SocialSignInSection - no social providers enabled"),null)},MagicSocialSignIn=({defaultProvider:fr,numOfItemsToDisplay:br,collapsedLayout:wr})=>{const{projectSettings:Er}=useInternalDynamicContext(),{socialProvider:kr,setSocialProvider:jr,socialWalletConnector:Br,enabledSocialProviders:Wr}=useSocialRedirectContext(),{engageCaptcha:qr}=useCaptchaContext(),{mutate:Gr,isLoading:Vr}=useMutation(Zr=>__awaiter$e(void 0,void 0,void 0,function*(){var Jr;if(!((Jr=Er==null?void 0:Er.security.hCaptcha)===null||Jr===void 0)&&Jr.enabled){qr({authMethod:"social",onCaptchaSuccess:Qr=>__awaiter$e(void 0,void 0,void 0,function*(){return jr(Zr),yield Br==null?void 0:Br.endSession(),Br==null?void 0:Br.connect(Zr)})});return}return jr(Zr),yield Br==null?void 0:Br.endSession(),Br==null?void 0:Br.connect(Zr)}));return jsxRuntimeExports.jsx(SocialSignIn,{onSelectProvider:Gr,providers:Wr,selectedProvider:kr,isLoading:Vr,testId:"magic-social-sign-in",defaultProvider:fr,numOfItemsToDisplay:br,collapsedLayout:wr})},getProviderEnumForSocialSignInProvider=fr=>{if(!fr)return null;const br=Object.values(ProviderEnum);for(const wr of br)if(wr===fr)return wr;return null},DynamicSocialSignIn=({defaultProvider:fr,numOfItemsToDisplay:br,collapsedLayout:wr})=>{const{setShowAuthFlow:Er,projectSettings:kr}=useInternalDynamicContext(),{setSocialProvider:jr,socialProvider:Br,enabledSocialProviders:Wr}=useSocialRedirectContext(),{setView:qr,goToInitialView:Gr}=useViewContext(),{engageCaptcha:Vr}=useCaptchaContext(),{isProcessing:Zr,connectSocialAccount:Jr}=useSocialAuth({onError:()=>{Gr()},onFarcasterUrl:_n=>qr("farcaster-connect-view",{url:_n}),onSettled:()=>{jr(void 0)},sessionTimeout:2e4}),Qr=_n=>{var En;const Cn=getProviderEnumForSocialSignInProvider(_n);if(jr(_n),!((En=kr==null?void 0:kr.security.hCaptcha)===null||En===void 0)&&En.enabled){Vr({authMethod:"social",onCaptchaSuccess:In=>__awaiter$e(void 0,void 0,void 0,function*(){qr("social-redirect-view"),Er(!0),Jr({authMode:"signin",captchaToken:In,provider:Cn})})});return}qr("social-redirect-view"),Er(!0),Jr({authMode:"signin",provider:Cn})};return jsxRuntimeExports.jsx(SocialSignIn,{onSelectProvider:Qr,providers:Wr,selectedProvider:Br,isLoading:Zr,testId:"dynamic-social-sign-in",defaultProvider:fr,numOfItemsToDisplay:br,collapsedLayout:wr})},SocialSignInSection=({sectionData:fr,collapsedLayout:br})=>{var wr,Er,kr;const{projectSettings:jr}=useInternalDynamicContext(),Br=(wr=jr==null?void 0:jr.providers)!==null&&wr!==void 0?wr:[],Wr={collapsedLayout:br,defaultProvider:getSocialSignInProviderFromString(fr.defaultItem),numOfItemsToDisplay:fr.numOfItemsToDisplay};return isProviderEnabled(Br,ProviderEnum.MagicLink)&&((Er=jr==null?void 0:jr.sdk.socialSignIn)===null||Er===void 0?void 0:Er.signInProvider)===SignInProviderEnum.MagicLink?jsxRuntimeExports.jsx(MagicSocialSignIn,Object.assign({},Wr)):((kr=jr==null?void 0:jr.sdk.socialSignIn)===null||kr===void 0?void 0:kr.signInProvider)===SignInProviderEnum.Dynamic?jsxRuntimeExports.jsx(DynamicSocialSignIn,Object.assign({},Wr)):(logger$6.error("Failed to render SocialSignInSection - no sign in provider enabled"),null)},ToggleableSection=({sections:fr})=>{const[br,wr]=reactExports.useState(!0),Er=br?fr[0]:fr[1];return jsxRuntimeExports.jsxs("div",{className:"toggleable-section",children:[Er.component,jsxRuntimeExports.jsxs("div",{className:"toggleable-section__toggle-prompt",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",copykey:Er.labelCopyKey,children:Er.label}),jsxRuntimeExports.jsx("button",{className:"toggleable-section__toggle-prompt__button",onClick:()=>wr(!br),children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"body_small",color:"brand-primary",className:"toggleable-section__toggle-prompt__button__text",copykey:Er.buttonCopyKey,children:Er.button})})]})]})},ListItemButton=({text:fr,onClick:br,numberOfWallets:wr,disabled:Er=!1,copykey:kr})=>{const jr=reactExports.useMemo(()=>wr<=10?wr:`${Math.floor(wr/10)*10}+`,[wr]),Br=jsxRuntimeExports.jsxs("div",{className:"list-item-button__trailing",children:[jsxRuntimeExports.jsx("div",{className:classNames$1("list-item-button__trailing-child","list-item-button__trailing-label"),children:jsxRuntimeExports.jsx(Badge,{text:`${jr} available`})}),jsxRuntimeExports.jsx("div",{className:classNames$1("list-item-button__trailing-child","list-item-button__trailing-icon"),children:jsxRuntimeExports.jsx(Icon,{color:"text-primary",size:"small",children:jsxRuntimeExports.jsx(SvgStroke,{})})})]});return jsxRuntimeExports.jsx(ListTile,{trailing:Br,onClick:br,className:"list-item-button",disabled:Er,copykey:kr,children:fr})},WalletSimpleSignIn=({previewWalletsNumber:fr,disabled:br=!1,onshowAllWallets:wr})=>{const{t:Er}=useTranslation(),{walletConnectorOptions:kr,projectSettings:jr,walletsFilter:Br,authMode:Wr,multiWallet:qr,recommendedWallets:Gr}=useInternalDynamicContext(),Vr=useUserWallets(),{walletBook:Zr}=useWalletBookContext(),{numberOfWallets:Jr,walletsList:Qr}=walletListBuilder({authMode:Wr,groupWallets:!0,inputList:kr,isWalletConnectList:!1,lastUsedWalletKey:StorageService.getItem(LAST_USED_WALLET),loginWithEmail:!0,multiWallet:qr,numberOfWalletsToShow:fr,recommendedWallets:Gr,searchFilter:void 0,userWallets:Vr,walletBook:Zr,walletsFilter:Br});return jr?jsxRuntimeExports.jsxs("div",{className:"login-with-email-wallet-list__container","data-testid":"top-wallets-list",children:[Qr.map((_n,En)=>jsxRuntimeExports.jsx(WalletListItem,{wallet:_n,disabled:br,recommendedWallets:Gr},`${_n.key}_${En}`)),jsxRuntimeExports.jsx(ListItemButton,{copykey:"dyn_wallet_list.view_all",text:Er("dyn_wallet_list.view_all"),onClick:wr,numberOfWallets:Jr,disabled:br})]}):jsxRuntimeExports.jsx(Skeleton$1,{count:fr+1,className:"login-with-email-wallet-list__skeleton"})},WalletSignInSection=({numberOfItensToShow:fr,isLoading:br,onSubmit:wr})=>{const{t:Er}=useTranslation();return fr>0?jsxRuntimeExports.jsx(WalletSimpleSignIn,{previewWalletsNumber:fr,onshowAllWallets:()=>wr==null?void 0:wr(),disabled:br}):jsxRuntimeExports.jsx(IconListTile,{onClick:()=>wr==null?void 0:wr(),disabled:br,className:"connect-with-wallet-button",children:jsxRuntimeExports.jsx(Typography,{variant:"button_primary",copykey:"dyn_login.wallet_list.button_only",children:Er("dyn_login.wallet_list.button_only")})})},LoginViewSection=({viewSection:fr,index:br,walletCount:wr,gotToWalletList:Er})=>{const{loading:kr}=useLoadingContext(),{t:jr}=useTranslation(),{setView:Br}=useViewContext(),[Wr,qr]=reactExports.useState(kr);switch(fr.type){case SdkViewSectionType.Separator:return jsxRuntimeExports.jsx(Divider,{text:fr.label});case SdkViewSectionType.Email:return jsxRuntimeExports.jsx(LoginEmailForm,{onSubmit:()=>qr(!0),onSubmitError:()=>qr(!1),isLoading:Wr});case SdkViewSectionType.Phone:return jsxRuntimeExports.jsx(PhoneNumberSignInSection,{onSubmit:()=>qr(!0),onSubmitError:()=>qr(!1),isLoading:Wr});case SdkViewSectionType.EmailAndPhone:const Gr=[{button:jr("dyn_login.email_or_phone.use_phone"),buttonCopyKey:"dyn_login.email_or_phone.use_phone",component:jsxRuntimeExports.jsx(LoginEmailForm,{onSubmit:()=>qr(!0),onSubmitError:()=>qr(!1),isLoading:Wr}),label:jr("dyn_login.email_or_phone.prefer_phone"),labelCopyKey:"dyn_login.email_or_phone.prefer_phone"},{button:jr("dyn_login.email_or_phone.use_email"),buttonCopyKey:"dyn_login.email_or_phone.use_email",component:jsxRuntimeExports.jsx(PhoneNumberSignInSection,{onSubmit:()=>qr(!0),onSubmitError:()=>qr(!1),isLoading:Wr}),label:jr("dyn_login.email_or_phone.prefer_email"),labelCopyKey:"dyn_login.email_or_phone.prefer_email"}];return fr.defaultItem==="phone"&&Gr.reverse(),jsxRuntimeExports.jsx(ToggleableSection,{sections:Gr});case SdkViewSectionType.Wallet:return jsxRuntimeExports.jsx(WalletSignInSection,{numberOfItensToShow:fr.numOfItemsToDisplay||0,onSubmit:()=>{Br("login-with-email-or-wallet-full-wallet-list"),Er()},isLoading:Wr});case SdkViewSectionType.Social:return jsxRuntimeExports.jsx(SocialSignInSection,{collapsedLayout:wr>1,sectionData:fr});case SdkViewSectionType.Text:return fr.label?jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",align:fr.alignment,className:"login-view__text","data-testid":"login-view-section__text",children:fr.label}):null}},getWalletsSection=fr=>({numOfItemsToDisplay:fr,type:SdkViewSectionType.Wallet}),getSocialsSection=(fr,br)=>({defaultItem:br,numOfItemsToDisplay:fr,type:SdkViewSectionType.Social}),getSimpleSection=fr=>({type:fr}),getLoginViewStructure=({socialAboveEmail:fr,showWallets:br,web3Layout:wr,numOfWalletsToDisplay:Er,showEmail:kr,showPhone:jr,showSocial:Br,splitEmailAndSocial:Wr,defaultSocialItem:qr})=>{const Gr=!Wr&&(kr||jr),Vr=Wr?qr:void 0;return[{condition:br&&wr,section:getWalletsSection(Er)},{condition:Br&&fr,hideSeparator:Gr?"below":void 0,section:getSocialsSection(5,Vr)},{condition:kr&&!jr,section:getSimpleSection(SdkViewSectionType.Email)},{condition:!kr&&jr,section:getSimpleSection(SdkViewSectionType.Phone)},{condition:kr&&jr,section:getSimpleSection(SdkViewSectionType.EmailAndPhone)},{condition:Br&&!fr,hideSeparator:Gr?"above":void 0,section:getSocialsSection(5,Vr)},{condition:br&&!wr,section:getWalletsSection(Er)}]},useViewSettings=fr=>{var br,wr,Er;const{projectSettings:kr,overrides:jr}=useInternalDynamicContext(),Br=(wr=(br=kr==null?void 0:kr.sdk)===null||br===void 0?void 0:br.views)===null||wr===void 0?void 0:wr.find(qr=>qr.type===fr);return((Er=jr==null?void 0:jr.views)===null||Er===void 0?void 0:Er.find(qr=>qr.type===fr))||Br},NUMBER_OF_WALLETS=3,useLoginView=()=>{const fr=useViewSettings(SdkViewType.Login),{projectSettings:br,authorizationViewDisplayOrder:wr,loginWithEmail:Er,walletConnectorOptions:kr,walletsFilter:jr}=useInternalDynamicContext(),{t:Br}=useTranslation(),{enabledSocialProviders:Wr}=useSocialRedirectContext(),qr=!!(Wr!=null&&Wr.length),Gr=isEmailProviderEnabled(br==null?void 0:br.providers),Vr=isPhoneNumberProviderEnabled(br==null?void 0:br.providers),Zr=(jr?jr(kr):kr).filter(({key:En})=>En!=="turnkey"),Jr=reactExports.useMemo(()=>{var En;return br?!Er&&!Vr&&!qr?!0:!((En=fr==null?void 0:fr.sections)===null||En===void 0)&&En.length?fr.sections.length===1&&fr.sections[0].type==="wallet":!Gr&&!Vr&&!qr:!1},[fr==null?void 0:fr.sections,br,Er,qr,Vr,Gr]),Qr=reactExports.useCallback(En=>{var Cn;const In=jn=>{var eo;return(eo=jn.networks)===null||eo===void 0?void 0:eo.some(ro=>ro.enabled)};return!((Cn=br==null?void 0:br.chains)===null||Cn===void 0?void 0:Cn.some(jn=>jn.enabled&&In(jn)))&&En.find(jn=>jn.type==="wallet")&&logger$6.error("Failed to render WalletSignInSection - no chains enabled"),Zr!=null&&Zr.length?En:En.filter(jn=>jn.type!=="wallet")},[Zr==null?void 0:Zr.length,br==null?void 0:br.chains]),_n=reactExports.useMemo(()=>{var En,Cn,In,An,jn,eo;if(!((En=fr==null?void 0:fr.sections)===null||En===void 0)&&En.length)return Qr(fr==null?void 0:fr.sections);const{splitEmailAndSocial:ro=!1,socialAboveEmail:to=!1}=(Cn=br==null?void 0:br.design.modal)!==null&&Cn!==void 0?Cn:{},_i=[],oo=getLoginViewStructure({defaultSocialItem:Wr[0],numOfWalletsToDisplay:!((An=(In=br==null?void 0:br.design)===null||In===void 0?void 0:In.modal)===null||An===void 0)&&An.showWalletsButton?0:NUMBER_OF_WALLETS,showEmail:Gr,showPhone:Vr,showSocial:!!(Wr!=null&&Wr.length),showWallets:!!(Zr!=null&&Zr.length)&&!(!((eo=(jn=br==null?void 0:br.design)===null||jn===void 0?void 0:jn.modal)===null||eo===void 0)&&eo.emailOnly),socialAboveEmail:to,splitEmailAndSocial:ro,web3Layout:wr==="web3"}),io={label:Br("dyn_login.separators.default"),type:SdkViewSectionType.Separator};let co=!1;for(const so of oo)so.condition&&(_i.length>0&&!co&&so.hideSeparator!=="above"&&_i.push(io),_i.push(so.section),co=so.hideSeparator==="below");return _i},[wr,Wr,Qr,Gr,Vr,fr==null?void 0:fr.sections,br==null?void 0:br.design.modal,Zr==null?void 0:Zr.length,Br]);return{isWalletOnly:Jr,loginViewSections:_n}},showFarcasterQrCodeView=(fr,br)=>fr.length===1&&fr[0].type===SdkViewSectionType.Social&&br.length===1&&br.includes(SocialSignInProviderEnum.Farcaster)&&!isMobile(),LoginView=()=>{var fr;const{error:br}=useErrorContext(),{setView:wr}=useViewContext(),{isWalletOnly:Er,loginViewSections:kr}=useLoginView(),{enabledSocialProviders:jr}=useSocialRedirectContext(),{showDefaultFooter:Br}=useAuthLayoutChecks(),Wr=((fr=kr.find(Zr=>Zr.type===SdkViewSectionType.Wallet))===null||fr===void 0?void 0:fr.numOfItemsToDisplay)||0,qr=reactExports.useMemo(()=>kr.map((Zr,Jr)=>jsxRuntimeExports.jsx("div",{className:classNames$1("login-view__scroll__section",`login-view__scroll__section--${Zr.type}`),children:jsxRuntimeExports.jsx(LoginViewSection,{gotToWalletList:()=>wr("login-with-email-or-wallet-full-wallet-list"),index:Jr,viewSection:Zr,walletCount:Wr})},`${Zr.type}__${Jr}`)),[kr,Wr]),Gr=br&&jsxRuntimeExports.jsx(ErrorContainer,{className:"login-view__error-container",withIcon:!1,children:br});if(showFarcasterQrCodeView(kr,jr))return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Gr,jsxRuntimeExports.jsx(FarcasterQrCodeView,{})]});if(Er)return jsxRuntimeExports.jsx(WalletList$1,{});const Vr=isMobile()&&Br;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[Gr,jsxRuntimeExports.jsx("div",{className:classNames$1("login-view__container",{"login-view__container--error":!!br}),children:jsxRuntimeExports.jsx("div",{className:"login-view__scroll","data-testid":"login-view-scroll",children:qr})}),Vr&&jsxRuntimeExports.jsx(DefaultFooter,{hideBorder:!0})]})},useMergeUserAccounts=()=>{const{environmentId:fr,setShowAuthFlow:br,selectedWalletConnector:wr}=useInternalDynamicContext(),{addedWalletsIds:Er}=useInternalUserWallets();return{mergeUserAccounts:jr=>__awaiter$e(void 0,void 0,void 0,function*(){const Wr=(yield verifyMergeUsers(fr,jr)).lastVerifiedCredentialId;Wr&&Er.current.push(Wr);const qr=yield wr==null?void 0:wr.getConnectedAccounts();qr!=null&&qr.length&&dynamicEvents.emit("triggerComputePrimaryWalletMultiWalletStateFromAccounts",{accounts:qr}),br(!1)})}},RadioButton=({children:fr,checked:br,value:wr,name:Er,disabled:kr=!1,className:jr="",onChange:Br})=>{const Wr=`${Er}_${wr}`;return jsxRuntimeExports.jsxs("div",{className:classNames$1("radio-button",jr),children:[jsxRuntimeExports.jsx("input",{type:"radio",id:Wr,name:Er,value:wr,disabled:kr,defaultChecked:br,onChange:Br}),jsxRuntimeExports.jsx("label",{htmlFor:Wr,children:fr})]})},MergeUserAccountsConflictsView=({mergeConflicts:fr})=>{const{mergeUserAccounts:br}=useMergeUserAccounts(),{t:wr}=useTranslation(),[Er,kr]=reactExports.useState(""),jr=reactExports.useRef(Object.fromEntries(fr.map(({field:qr,currentUser:Gr})=>[`${qr.name}_${qr.type}`,{fieldKey:qr.name,type:qr.type||KycFieldType.Standard,userId:Gr.userId}]))),Br=()=>__awaiter$e(void 0,void 0,void 0,function*(){const qr=Object.values(jr.current).map(({fieldKey:Gr,type:Vr,userId:Zr})=>({fieldKey:Gr,type:Vr,userId:Zr}));try{yield br(qr)}catch(Gr){logger$6.error("Error merging user accounts",Gr),kr(wr("dyn_merge_user_accounts_conflicts.errors.merge_error"))}});if(!(fr!=null&&fr.length))return null;const Wr=(qr,Gr,Vr,Zr)=>{kr(""),Zr&&(jr.current[`${qr}_${Gr}`]={fieldKey:qr,type:Gr||KycFieldType.Standard,userId:Vr})};return jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-conflicts__container",children:[Er&&jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",className:"merge-user-accounts-conflicts__error",children:Er}),jsxRuntimeExports.jsx("div",{className:"merge-user-accounts-conflicts__description",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_merge_user_accounts_conflicts.description",children:wr("dyn_merge_user_accounts_conflicts.description")})}),jsxRuntimeExports.jsx("div",{className:"merge-user-accounts-conflicts__fields",children:fr.map(({field:qr,currentUser:Gr,fromUser:Vr})=>{var Zr;return jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-conflicts__fields__item",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"merge-user-accounts-conflicts__fields__item__name",children:(Zr=qr.label)!==null&&Zr!==void 0?Zr:capitalize$1(qr.name)}),jsxRuntimeExports.jsx(RadioButton,{name:qr.name,value:Gr.value,checked:!0,className:"merge-user-accounts-conflicts__fields__item__button",onChange:Jr=>Wr(qr.name,qr.type,Gr.userId,Jr.target.checked),children:Gr.value}),jsxRuntimeExports.jsx(RadioButton,{name:qr.name,value:Vr.value,className:"merge-user-accounts-conflicts__fields__item__button",onChange:Jr=>Wr(qr.name,qr.type,Vr.userId,Jr.target.checked),children:Vr.value})]},qr.name)})}),jsxRuntimeExports.jsx("div",{className:"merge-user-accounts-conflicts__buttons",children:jsxRuntimeExports.jsx(TypographyButton,{className:"merge-user-accounts-conflicts__buttons__button",onClick:Br,buttonVariant:"primary",buttonPadding:"large",expanded:!0,copykey:"dyn_merge_user_accounts_conflicts.confirm_button",children:wr("dyn_merge_user_accounts_conflicts.confirm_button")})})]})},MergeUserAccountsView=fr=>{const{setView:br}=useViewContext(),{mergeUserAccounts:wr}=useMergeUserAccounts(),{t:Er}=useTranslation(),[kr,jr]=reactExports.useState(""),{mergeConflicts:Br}=fr,Wr=()=>{const Gr=()=>{br("merge-user-accounts",fr)};br("merge-user-accounts-conflicts",{mergeConflicts:(Br==null?void 0:Br.conflicts)||[]},{onBackClick:Gr})},qr=()=>__awaiter$e(void 0,void 0,void 0,function*(){if(Br!=null&&Br.conflicts.length){Wr();return}try{yield wr([])}catch(Gr){logger$6.error("Error merging user accounts",Gr),jr(Er("dyn_merge_user_accounts.errors.merge_error"))}});return jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts",children:[kr&&jsxRuntimeExports.jsx(Alert,{icon:"error",variant:"error",className:"merge-user-accounts__error",children:kr}),jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts__container",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"merge-user-accounts__title",copykey:"dyn_merge_user_accounts.wallet.content",children:Er("dyn_merge_user_accounts.wallet.content")}),jsxRuntimeExports.jsx(TypographyButton,{onClick:qr,buttonClassName:"merge-user-accounts__button",buttonVariant:"brand-primary",buttonPadding:"large",typographyProps:{color:"inherit"},expanded:!0,copykey:"dyn_merge_user_accounts.confirm_button",children:Er("dyn_merge_user_accounts.confirm_button")})]})]})};var _path$a,_excluded$e=["title","titleId"];function _extends$e(){return _extends$e=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$e(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgDoubleArrowRight=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$e(br,_excluded$e);return reactExports.createElement("svg",_extends$e({width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$a||(_path$a=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.862 2.862c.26-.26.682-.26.943 0L8.47 7.529a.667.667 0 0 1 0 .942l-4.666 4.667a.667.667 0 0 1-.943-.943L7.057 8 2.862 3.805a.667.667 0 0 1 0-.943Zm5.333 0c.26-.26.683-.26.943 0l4.667 4.667c.26.26.26.682 0 .942l-4.667 4.667a.667.667 0 0 1-.943-.943L12.39 8 8.195 3.805a.667.667 0 0 1 0-.943Z",fill:"currentColor"})))};const MergeUserAccountsWithSameEmailView=({returnToView:fr})=>{const{environmentId:br,setShowAuthFlow:wr,setCallback:Er,primaryWallet:kr,user:jr}=useInternalDynamicContext(),Br=useHandleAuthenticatedUser(),{t:Wr}=useTranslation(),{setError:qr}=useErrorContext(),{setView:Gr,goToInitialView:Vr}=useViewContext(),{displayedDestination:Zr}=useVerification(),Jr=()=>__awaiter$e(void 0,void 0,void 0,function*(){try{const _n=yield mergeUserAccounts(br);if(!_n)throw new DynamicError("Something went wrong, please try again.");yield Br(_n),wr(!1),Er("authSuccess")}catch{if(qr(Wr("dyn_merge_user_accounts_with_same_email.errors.merge_error")),jr){wr(!1,{emitCancelAuth:!0});return}Vr()}}),Qr=()=>{if(qr(void 0),fr){Gr(fr);return}if(jr){wr(!1);return}Gr("collect-user-data")};return jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__container",children:[jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__accounts",children:[jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__accounts__item",children:[jsxRuntimeExports.jsx(WalletIcon,{walletKey:kr==null?void 0:kr.connector.key,className:"merge-user-accounts-with-same-email__accounts__item__icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"medium",color:"secondary",className:"merge-user-accounts-with-same-email__accounts__item__text",children:shortenWalletAddress(kr==null?void 0:kr.address,3,3)})]}),jsxRuntimeExports.jsx("div",{className:"merge-user-accounts-with-same-email__accounts__divider",children:jsxRuntimeExports.jsx(Icon,{color:"text-secondary",size:"small",children:jsxRuntimeExports.jsx(SvgDoubleArrowRight,{})})}),jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__accounts__item",children:[jsxRuntimeExports.jsx(UserProfileIcon,{className:"merge-user-accounts-with-same-email__accounts__item__icon"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"medium",color:"secondary",className:"merge-user-accounts-with-same-email__accounts__item__text",children:shortenEmail(Zr,{breakpoint:4,cutEnd:1,cutStart:2})})]})]}),jsxRuntimeExports.jsx(Typography,{weight:"regular",variant:"title",className:"merge-user-accounts-with-same-email__text merge-user-accounts-with-same-email__text__header",copykey:"dyn_merge_user_accounts_with_same_email.title",children:Wr("dyn_merge_user_accounts_with_same_email.title")}),jsxRuntimeExports.jsxs(Typography,{weight:"medium",variant:"body_normal",className:"merge-user-accounts-with-same-email__text merge-user-accounts-with-same-email__text__body",copykey:"dyn_merge_user_accounts_with_same_email.existing_account",children:[Wr("dyn_merge_user_accounts_with_same_email.existing_account")," ",jsxRuntimeExports.jsx("span",{className:"merge-user-accounts-with-same-email__text--bold",children:shortenEmail(Zr,{breakpoint:14})})," ",Wr("dyn_merge_user_accounts_with_same_email.existing_account_trail")]}),jsxRuntimeExports.jsxs("div",{className:"merge-user-accounts-with-same-email__buttons",children:[jsxRuntimeExports.jsx(TypographyButton,{className:"merge-user-accounts-with-same-email__buttons__button",onClick:Jr,buttonVariant:"primary",buttonPadding:"large",copykey:"dyn_merge_user_accounts_with_same_email.confirm_button",children:Wr("dyn_merge_user_accounts_with_same_email.confirm_button")}),jsxRuntimeExports.jsx(TypographyButton,{className:"merge-user-accounts-with-same-email__buttons__button",onClick:Qr,buttonVariant:"secondary",buttonPadding:"large",copykey:"dyn_merge_user_accounts_with_same_email.cancel_button",children:Wr("dyn_merge_user_accounts_with_same_email.cancel_button")})]})]})};var _path$9,_path2$1,_path3$1,_path4,_g$5,_path5,_defs$5,_excluded$d=["title","titleId"];function _extends$d(){return _extends$d=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$d(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgSecureAccount=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$d(br,_excluded$d);return reactExports.createElement("svg",_extends$d({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,reactExports.createElement("mask",{id:"secure-account_svg__a",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:0,y:0,width:327,height:112},_path$9||(_path$9=reactExports.createElement("path",{d:"M315 0H12C5.373 0 0 5.373 0 12v88c0 6.627 5.373 12 12 12h303c6.627 0 12-5.373 12-12V12c0-6.627-5.373-12-12-12Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#secure-account_svg__a)"},_path2$1||(_path2$1=reactExports.createElement("path",{d:"M164 228c62.96 0 114-51.04 114-114S226.96 0 164 0 50 51.04 50 114s51.04 114 114 114Z",fill:"url(#secure-account_svg__b)",fillOpacity:.12})),reactExports.createElement("mask",{id:"secure-account_svg__c",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:86,y:29,width:40,height:40},_path3$1||(_path3$1=reactExports.createElement("path",{d:"M116.91 29 86 37.282l8.282 30.91 30.91-8.282L116.91 29Z",fill:"#fff"}))),reactExports.createElement("g",{mask:"url(#secure-account_svg__c)"},reactExports.createElement("mask",{id:"secure-account_svg__d",style:{maskType:"luminance"},maskUnits:"userSpaceOnUse",x:90,y:33,width:31,height:31},_path4||(_path4=reactExports.createElement("path",{d:"M119.763 44.8c-2.097-7.825-10.139-12.468-17.963-10.371-7.824 2.096-12.468 10.138-10.371 17.962 2.096 7.825 10.139 12.468 17.963 10.371 7.824-2.096 12.467-10.138 10.371-17.962Z",fill:"#fff"}))),_g$5||(_g$5=reactExports.createElement("g",{mask:"url(#secure-account_svg__d)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M118.709 55.166a14.617 14.617 0 0 0 1.054-10.366c-2.097-7.824-10.139-12.467-17.963-10.37-7.825 2.096-12.468 10.138-10.371 17.962a14.612 14.612 0 0 0 6.097 8.451c1.808-3.916 6.565-6.42 9.647-7.247 3.083-.826 7.955-1.146 11.536 1.57Zm-19.375-8.688a5.5 5.5 0 1 1 10.625-2.847 5.5 5.5 0 0 1-10.625 2.847Z",fill:"#4779FF"})))),_path5||(_path5=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.268 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.313.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.336 9.336 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm7.008 18.695c0-1.726-1.4-3.126-3.127-3.126h-14.069a6.253 6.253 0 0 0-6.153 5.133 6.234 6.234 0 0 1 4.589-2.007h18.76Zm1.562 3.127c3.454 0 6.253 2.8 6.253 6.253v12.506a6.253 6.253 0 0 1-6.253 6.254h-18.759a6.253 6.253 0 0 1-6.253-6.254V60.14a6.253 6.253 0 0 1 6.253-6.253h18.759Z",fill:"#4779FF"}))),_defs$5||(_defs$5=reactExports.createElement("defs",null,reactExports.createElement("linearGradient",{id:"secure-account_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))};const useIsLoggedIn=()=>{var fr,br,wr;const{user:Er,primaryWallet:kr,authMode:jr,projectSettings:Br}=useInternalDynamicContext(),{getEOAWallet:Wr}=useSmartWallets(),qr=kr&&Wr(kr),Gr=kr&&isSessionKeyCompatibleWallet(kr)||qr&&isSessionKeyCompatibleWallet(qr),Vr=isTurnkeyEnabled(Br),Zr=!!Er||jr==="connect-only"&&!!kr,Jr=(fr=Er==null?void 0:Er.verifiedCredentials)===null||fr===void 0?void 0:fr.filter(({walletProvider:Cn})=>Cn),Qr=!!(Jr!=null&&Jr.find(({walletProvider:Cn})=>Cn==="embeddedWallet")),En=Vr&&((wr=(br=Br==null?void 0:Br.sdk)===null||br===void 0?void 0:br.embeddedWallets)===null||wr===void 0?void 0:wr.automaticEmbeddedWalletCreation)&&(!(Br!=null&&Br.sdk.embeddedWallets.forceAuthenticatorAtSignup)||Gr)&&(!(Jr!=null&&Jr.length)||Qr);return logger$6.logVerboseTroubleshootingMessage("useIsLoggedIn",{authMode:jr,eoaWallet:qr,isSessionKeyCompatible:Gr,isTurnkeyProviderEnabled:Vr,primaryWallet:kr,projectSettings:Br,user:Er}),En?!!(kr&&Zr):Zr},useOverrides=fr=>{const br=reactExports.useRef(fr),wr=useIsLoggedIn();return br.current=fr,reactExports.useMemo(()=>({setAuthMode:Er=>{const{setAuthMode:kr}=br.current;if(wr){logger$6.error("Calling DynamicContext's setAuthMode method when the user already has a wallet is a noop");return}return kr(Er)}}),[wr])},useDynamicContext=()=>{const fr=reactExports.useContext(DynamicContext);if(fr===void 0)throw new Error("useDynamicContext must be used within a DynamicContextProvider");const{accountSwitchState:br,authMode:wr,authToken:Er,awaitingSignatureState:kr,getNameService:jr,handleLogOut:Br,handleUnlinkWallet:Wr,loadingNetwork:qr,locale:Gr,loginWithEmail:Vr,multiWalletWidgetState:Zr,network:Jr,networkConfigurations:Qr,qrcodeUri:_n,sdkHasLoaded:En,setLogInWithEmail:Cn,setMultiWalletWidgetState:In,setShowAuthFlow:An,setShowDynamicUserProfile:jn,setShowQrcodeModal:eo,shadowDOMEnabled:ro,showAuthFlow:to,showQrcodeModal:_i,user:oo,userWithMissingInfo:io,bridgeChains:co,bridgeChainsToConnect:so,primaryWallet:no,setShowBridgeWidget:Tn,sendWagmiSettings:Hr,showDynamicUserProfile:Xr,minAuthToken:Sn,selectedTabIndex:Rn,setSelectedTabIndex:Pn}=fr,{setAuthMode:On}=useOverrides(fr);return{accountSwitchState:br,authMode:wr,authToken:Er,awaitingSignatureState:kr,bridgeChains:co,bridgeChainsToConnect:so,getNameService:jr,handleLogOut:Br,handleUnlinkWallet:Wr,loadingNetwork:qr,locale:Gr,loginWithEmail:Vr,minAuthToken:Sn,multiWalletWidgetState:Zr,network:Jr,networkConfigurations:Qr,primaryWallet:no,qrcodeUri:_n,sdkHasLoaded:En,selectedTabIndex:Rn,sendWagmiSettings:Hr,setAuthMode:On,setLogInWithEmail:Cn,setMultiWalletWidgetState:In,setSelectedTabIndex:Pn,setShowAuthFlow:Zn=>An(Zn,{clearErrors:!0,emitCancelAuth:!0,ignoreIfIsEmbeddedWidget:!0,initializeWalletConnect:!0,performMultiWalletChecks:!0}),setShowBridgeWidget:Tn,setShowDynamicUserProfile:jn,setShowQrcodeModal:eo,shadowDOMEnabled:ro,showAuthFlow:to,showDynamicUserProfile:Xr,showQrcodeModal:_i,user:oo,userWithMissingInfo:io}},getMfaOptions=fr=>{const br=[{Icon:void 0,descriptionKey:"dyn_mfa.choose_device_view.authenticator_app_description",labelKey:"dyn_mfa.choose_device_view.authenticator_app",type:MFADeviceType.Totp}];if(!fr){const wr={Icon:void 0,descriptionKey:"dyn_mfa.choose_device_view.backup_code_description",labelKey:"dyn_mfa.choose_device_view.backup_code",type:"backupCode"};br.push(wr)}return br},MfaChooseDeviceView=({isInitialSetup:fr=!0})=>{const{handleLogOut:br}=useDynamicContext(),{t:wr}=useTranslation(),{setView:Er}=useViewContext(),kr=getMfaOptions(fr),jr=Br=>{if(Br.type==="backupCode"){Er("mfa-recovery",void 0,{onBackClick:()=>{Er("mfa-choose-device",{isInitialSetup:!1})}});return}if(fr){Er("mfa-secure-device",{type:Br.type});return}Er("mfa-verification",{isInitialSetup:fr,showBackButton:!0,type:Br.type})};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{alignContent:"bottom",children:jsxRuntimeExports.jsx("div",{className:"otp-verification-view__status-header",children:jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",color:"primary",className:"otp-verification-view__title",children:wr(fr?"dyn_mfa.choose_device_view.title":"dyn_mfa.choose_device_view.choose_another_method")})})}),jsxRuntimeExports.jsxs("div",{className:"mfa-choose-device-view__body","data-testid":"mfa-choose-device-view",children:[jsxRuntimeExports.jsx(SvgSecureAccount,{}),jsxRuntimeExports.jsx(Typography,{className:"mfa-choose-device-view__copy",variant:"body_normal",weight:"regular",color:"secondary",children:wr(fr?"dyn_mfa.choose_device_view.select_options":"dyn_mfa.choose_device_view.choose_another_method_description")}),kr.map(Br=>jsxRuntimeExports.jsxs(Button$1,{buttonClassName:"mfa-choose-device-view__button",expanded:!0,onClick:()=>jr(Br),children:[jsxRuntimeExports.jsxs("div",{className:"mfa-choose-device-view__button__header",children:[jsxRuntimeExports.jsx(Typography,{copykey:Br.labelKey,color:"primary",children:wr(Br.labelKey)}),jsxRuntimeExports.jsx(SvgChevronLeft,{className:"mfa-choose-device-view__icon--rotate"})]}),jsxRuntimeExports.jsx(Typography,{className:"mfa-choose-device-view__button__description",color:"secondary",copykey:Br.descriptionKey,children:wr(Br.descriptionKey)})]},Br.type)),jsxRuntimeExports.jsx(TextButton,{className:"mfa-choose-device-view__logout",onClick:br,copykey:"dyn_mfa.choose_device_view.logout",children:wr("dyn_mfa.choose_device_view.logout")})]})]})},getUserMfaDevices=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br}){try{const{devices:wr}=yield sdkApi$1().getUserMfaDevices({environmentId:br});return wr}catch(wr){const Er=yield wr.json();return logger$6.error(Er.error),[]}}),addMfaDevice=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,type:wr}){try{if(wr===MFADeviceType.Totp)return yield sdkApi$1().registerTotpMfaDevice({environmentId:br});throw new Error("Unsupported MFA device type")}catch(Er){const kr=Er instanceof Error?Er.message:(yield Er.json()).error;throw logger$6.error(kr),new Error(kr)}}),updateUserMfaDevice=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,mfaDeviceId:wr}){try{yield sdkApi$1().updateUserMfaDevice({environmentId:br,mfaDeviceId:wr})}catch(Er){const kr=yield Er.json();logger$6.error(kr.error)}}),deleteMfaDevice=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,mfaDeviceId:wr,mfaAuthToken:Er}){try{yield sdkApi$1().deleteMfaDevice({environmentId:br,mfaDeviceId:wr,xMfaAuthToken:Er})}catch(kr){const jr=yield kr.json();logger$6.error(jr.error)}}),verifyMfaDevice=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,type:wr,code:Er}){try{if(wr===MFADeviceType.Totp){const kr={code:Er,type:wr};return yield sdkApi$1().registerTotpMfaDeviceVerify({environmentId:br,mFARegisterTotpDevicePostRequest:kr})}throw new Error("Unsupported MFA device type")}catch(kr){const jr=kr instanceof Error?kr.message:(yield kr.json()).error;logger$6.error(jr);return}}),authMfaDevice=fr=>__awaiter$e(void 0,[fr],void 0,function*({deviceId:br,environmentId:wr,type:Er,code:kr,createMfaToken:jr}){try{if(Er===MFADeviceType.Totp){const Br={code:kr,createMfaToken:jr,id:br||void 0};return yield sdkApi$1().authMfaTotpDevice({environmentId:wr,mFAAuthTotpDevicePostRequest:Br})}throw new Error("Unsupported MFA device type")}catch(Br){if(logger$6.error(Br),Br instanceof Response){const Wr=yield Br.json();if(Wr.code==="mfa_invalid_code")throw new MfaInvalidOtpError;if(Wr.code==="mfa_rate_limited")throw new MfaRateLimitedError}throw Br}}),getRecoveryCodes=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br}){try{const{recoveryCodes:wr}=yield sdkApi$1().getRecoveryCodes({environmentId:br});return wr}catch(wr){const Er=yield wr.json();return logger$6.error(Er.error),[]}}),createNewRecoveryCodes=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br}){try{const{recoveryCodes:wr}=yield sdkApi$1().createNewRecoveryCodes({environmentId:br});return wr}catch(wr){const Er=yield wr.json();return logger$6.error(Er.error),[]}}),authMfaRecovery=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,code:wr}){try{const Er={code:wr};return yield sdkApi$1().authMfaRecovery({environmentId:br,mFAAuthRecoveryDevicePostRequest:Er})}catch(Er){throw logger$6.error(Er),Er instanceof Response&&(yield Er.json()).code==="mfa_invalid_code"?new MfaInvalidOtpError:Er}}),useMfa=()=>{const{completeAuth:fr}=useUserAuth({}),{user:br,userWithMissingInfo:wr,environmentId:Er}=useInternalDynamicContext(),kr=br||wr,jr=()=>__awaiter$e(void 0,void 0,void 0,function*(){if(!kr)throw new Error(USER_NOT_LOGGED_IN);return yield getUserMfaDevices({environmentId:Er})}),Br=En=>__awaiter$e(void 0,void 0,void 0,function*(){if(!kr)throw new Error(USER_NOT_LOGGED_IN);yield updateUserMfaDevice({environmentId:Er,mfaDeviceId:En})}),Wr=(En,Cn)=>__awaiter$e(void 0,void 0,void 0,function*(){if(!kr)throw new Error(USER_NOT_LOGGED_IN);yield deleteMfaDevice({environmentId:Er,mfaAuthToken:Cn,mfaDeviceId:En})}),qr=(...En)=>__awaiter$e(void 0,[...En],void 0,function*(Cn=MFADeviceType.Totp){if(!kr)throw new Error(USER_NOT_LOGGED_IN);const{id:In,secret:An,uri:jn}=yield addMfaDevice({environmentId:Er,type:Cn});return{id:In,secret:An,uri:jn}}),Gr=(En,...Cn)=>__awaiter$e(void 0,[En,...Cn],void 0,function*(In,An=MFADeviceType.Totp,jn){try{if(!kr)throw new Error(USER_NOT_LOGGED_IN);let eo=!1;return yield fr({onValidUpdatedJwt:()=>__awaiter$e(void 0,void 0,void 0,function*(){eo=!0}),updateJwtFunction:()=>__awaiter$e(void 0,void 0,void 0,function*(){const ro=yield authMfaDevice({code:In,createMfaToken:{singleUse:!0},deviceId:jn,environmentId:Er,type:An});return dynamicEvents.emit("mfaCompletionSuccess",{mfaToken:ro.mfaToken}),{isEmailVerificationRequired:!1,isSmsVerificationRequired:!1,missingFields:[],updateUserProfileResponse:ro}})}),eo}catch(eo){throw dynamicEvents.emit("mfaCompletionFailure",{error:eo}),eo}}),Vr=En=>__awaiter$e(void 0,void 0,void 0,function*(){if(!kr)throw new Error(USER_NOT_LOGGED_IN);let Cn=!1;return yield fr({onValidUpdatedJwt:()=>__awaiter$e(void 0,void 0,void 0,function*(){Cn=!0}),updateJwtFunction:()=>__awaiter$e(void 0,void 0,void 0,function*(){const In=yield authMfaRecovery({code:En,environmentId:Er});if(!In)throw new Error("Failed to authenticate recovey code");return{isEmailVerificationRequired:!1,isSmsVerificationRequired:!1,missingFields:[],updateUserProfileResponse:In}})}),Cn}),Zr=(En,...Cn)=>__awaiter$e(void 0,[En,...Cn],void 0,function*(In,An=MFADeviceType.Totp){if(!kr)throw new Error(USER_NOT_LOGGED_IN);const jn=yield verifyMfaDevice({code:In,environmentId:Er,type:An});if(!jn)throw new Error("Failed to verify device");return jn}),Jr=(...En)=>__awaiter$e(void 0,[...En],void 0,function*(Cn=!1){if(!kr)throw new Error(USER_NOT_LOGGED_IN);const An=yield(Cn?createNewRecoveryCodes:getRecoveryCodes)({environmentId:Er});if(!An)throw new Error("Recovery codes not found");return An}),{updateUser:Qr}=useUserUpdateRequestInternal({validationSchemaStripUnknown:!1});return{addDevice:qr,authDevice:Gr,authRecoveryCode:Vr,completeAcknowledgement:()=>__awaiter$e(void 0,void 0,void 0,function*(){yield Qr({mfaBackupCodeAcknowledgement:MfaBackupCodeAcknowledgement.Complete})}),deleteUserDevice:Wr,getRecoveryCodes:Jr,getUserDevices:jr,updateUserDevice:Br,verifyDevice:Zr}},MfaDisplayBackupCodesView=({regenerateCodes:fr=!1})=>{const{setShowAuthFlow:br}=useInternalDynamicContext(),[wr,Er]=reactExports.useState(!1),{t:kr}=useTranslation(),{getRecoveryCodes:jr,completeAcknowledgement:Br}=useMfa(),{data:Wr,isLoading:qr}=usePromise(()=>jr(fr)),Gr=(Wr||[]).join(` `),Vr=()=>__awaiter$e(void 0,void 0,void 0,function*(){br(!1),yield Br()});return jsxRuntimeExports.jsxs("div",{className:"mfa-display-backup-codes-view__body","data-testid":"mfa-display-backup-codes-view",children:[jsxRuntimeExports.jsx(Typography,{className:"mfa-display-backup-codes-view__copy",variant:"body_normal",weight:"regular",color:"secondary",children:kr("dyn_mfa.display_backup_codes_view.body")}),jsxRuntimeExports.jsx(Alert,{variant:"warning",copykey:"dyn_mfa.display_backup_codes_view.warning",className:"mfa-display-backup-codes-view__warning",children:kr("dyn_mfa.display_backup_codes_view.warning")}),qr?jsxRuntimeExports.jsx(Spinner$2,{className:"mfa-display-backup-codes-view__loading-spinner"}):jsxRuntimeExports.jsxs("div",{className:"mfa-display-backup-codes-view__codes",children:[Wr==null?void 0:Wr.map((Zr,Jr)=>jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"mfa-display-backup-codes-view__code",children:Zr},Jr)),jsxRuntimeExports.jsxs("div",{className:"mfa-display-backup-codes-view__actions",children:[jsxRuntimeExports.jsx(CopyButton,{variant:"button",textToCopy:Gr,copykey:"dyn_mfa.display_backup_codes_view.copy_all",startSlot:jsxRuntimeExports.jsx(Icon,{size:"mini",color:"text-tertiary",children:jsxRuntimeExports.jsx(SvgCopy,{})}),children:kr("dyn_mfa.display_backup_codes_view.copy_all")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"download-button",buttonPadding:"small",buttonVariant:"primary",onClick:Zr=>{Zr.preventDefault(),downloadFile("mfa-backup-codes.txt",Gr)},startSlot:jsxRuntimeExports.jsx(SvgDownload,{}),expanded:!0,copykey:"dyn_mfa.display_backup_codes_view.download",children:kr("dyn_mfa.display_backup_codes_view.download")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mfa-display-backup-codes-view__complete",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"mfa-display-backup-codes-view__acknowledgement",dataTestId:"ack-button",buttonPadding:"small",buttonVariant:"primary",onClick:()=>Er(!wr),startSlot:jsxRuntimeExports.jsx(Checkbox,{checked:wr,onChange:()=>{Er(!wr)},className:"mfa-display-backup-codes-view__acknowledgement__checkbox"}),expanded:!0,typographyProps:{color:"secondary"},copykey:"dyn_mfa.display_backup_codes_view.checkbox",children:kr("dyn_mfa.display_backup_codes_view.checkbox")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"complete-button",buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},disabled:!wr,expanded:!0,copykey:"dyn_mfa.display_backup_codes_view.complete",onClick:Vr,children:kr("dyn_mfa.display_backup_codes_view.complete")})]})]})},isValidMfaRecoveryCode=fr=>/^[a-zA-Z0-9]{10}$/.test(fr);var _path$8,_excluded$c=["title","titleId"];function _extends$c(){return _extends$c=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$c(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgMfaRecoveryIcon=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$c(br,_excluded$c);return reactExports.createElement("svg",_extends$c({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$8||(_path$8=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm-9.322-18.117a1.828 1.828 0 1 0 3.613.568l1.152-7.457h7.144l-1.1 6.89a1.828 1.828 0 1 0 3.612.567l1.153-7.457h3.504a1.691 1.691 0 0 0 0-3.383h-2.948l1.16-7.222h3.597a1.691 1.691 0 0 0 0-3.383h-3.087l1.1-6.89a1.829 1.829 0 1 0-3.612-.567l-1.153 7.457H30.17l1.1-6.89a1.828 1.828 0 1 0-3.613-.567l-1.152 7.457h-3.458a1.691 1.691 0 0 0 0 3.383h2.901l-1.16 7.222h-3.597a1.691 1.691 0 0 0 0 3.383h3.087l-1.1 6.89Zm12.42-10.272H28.5l1.16-7.222h7.097l-1.16 7.222Z",fill:"#4779FF"})))};const MfaRecoveryScreenIcon=fr=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgMfaRecoveryIcon,Object.assign({},fr,{"data-testid":"mfa-recovery-icon"}))}),MfaRecoveryView=()=>{var fr;const{t:br}=useTranslation(),{projectSettings:wr}=useInternalDynamicContext(),{authRecoveryCode:Er}=useMfa(),[kr,jr]=reactExports.useState(""),[Br,Wr]=reactExports.useState(!1),[qr,Gr]=reactExports.useState(""),Vr=(fr=wr==null?void 0:wr.general)===null||fr===void 0?void 0:fr.supportEmail,Zr=()=>__awaiter$e(void 0,void 0,void 0,function*(){if(kr)try{Wr(!0),yield Er(kr)}catch(Qr){Gr(Qr.message||"Something went wrong")}finally{Wr(!1)}}),Jr=Qr=>{const _n=Qr.target.value;jr(_n),Gr("")};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[qr&&jsxRuntimeExports.jsx(ErrorContainer,{children:qr}),jsxRuntimeExports.jsxs("div",{className:"mfa-recovery-view",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:MfaRecoveryScreenIcon,isSpinning:Br,iconSize:96}),jsxRuntimeExports.jsx("div",{className:"mfa-recovery-view__body",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",children:br("dyn_mfa.recovery_view.body")})}),jsxRuntimeExports.jsxs("div",{className:"mfa-recovery-view__actions",children:[jsxRuntimeExports.jsx(Input,{id:"mfa-recovery-input","data-testid":"mfa-recovery-input",label:br("dyn_mfa.recovery_view.input_label"),onChange:Jr,value:kr}),jsxRuntimeExports.jsx(Button$1,{expanded:!0,buttonVariant:"brand-primary",disabled:Br||!isValidMfaRecoveryCode(kr),onClick:Zr,dataTestId:"mfa-recovery-submit",children:jsxRuntimeExports.jsx(Typography,{children:br("dyn_mfa.recovery_view.button_label")})})]}),Vr&&jsxRuntimeExports.jsxs("div",{className:"mfa-recovery-view__get-help",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",children:br("dyn_mfa.recovery_view.get_help.description")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"link",children:jsxRuntimeExports.jsx("a",{href:`mailto:${Vr}`,children:br("dyn_mfa.recovery_view.get_help.button_label")})})]})]})]})},MfaSecureDeviceHelper=({uri:fr,secret:br})=>{const{t:wr}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"mfa-qrcode-help-content__container",children:jsxRuntimeExports.jsx(EnterTileAnimation,{delay:"300ms",children:jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__setup-container",children:[jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step",children:[jsxRuntimeExports.jsx("div",{className:"mfa-qrcode-help-content__step__number",children:"1"}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step__instructions",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",className:"mfa-qrcode-help-content__step__title",children:wr("dyn_mfa.secure_device_view.helper.step1.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",className:"mfa-qrcode-help-content__step__subtext",children:wr("dyn_mfa.secure_device_view.helper.step1.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__vertical-container",children:[jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step",children:[jsxRuntimeExports.jsx("div",{className:"mfa-qrcode-help-content__step__number",children:"2"}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step__instructions",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",className:"mfa-qrcode-help-content__step__title",children:wr("dyn_mfa.secure_device_view.helper.step2.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",className:"mfa-qrcode-help-content__step__subtext",children:wr("dyn_mfa.secure_device_view.helper.step2.description")})]})]}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step__nocopy-box",children:[jsxRuntimeExports.jsx(Typography,{className:"mfa-qrcode-help-content__step__nocopy-text",variant:"body_small",children:br}),jsxRuntimeExports.jsx(CopyButton,{textToCopy:br,children:jsxRuntimeExports.jsx(SvgCopy,{"data-testid":"copy-secret",onClick:Er=>{Er.preventDefault()}})})]})]}),jsxRuntimeExports.jsx(Divider,{text:"OR"}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__vertical-container",children:[jsxRuntimeExports.jsx("div",{className:"mfa-qrcode-help-content__step",children:jsxRuntimeExports.jsxs("div",{className:"uri-section",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",className:"mfa-qrcode-help-content__step__title",children:wr("dyn_mfa.secure_device_view.helper.uri.title")}),jsxRuntimeExports.jsx(Typography,{className:"uri-subtext",variant:"body_small",children:wr("dyn_mfa.secure_device_view.helper.uri.description")})]})}),jsxRuntimeExports.jsxs("div",{className:"mfa-qrcode-help-content__step__nocopy-box",children:[jsxRuntimeExports.jsx(Typography,{className:"mfa-qrcode-help-content__step__nocopy-text",variant:"body_small",children:fr}),jsxRuntimeExports.jsx(CopyButton,{textToCopy:fr,children:jsxRuntimeExports.jsx(SvgCopy,{"data-testid":"copy-uri",onClick:Er=>{Er.preventDefault()}})})]})]})]})})})},MfaSecureDeviceView=({type:fr,isInitialSetup:br=!1})=>{const{t:wr}=useTranslation(),{handleLogOut:Er}=useDynamicContext(),{setView:kr}=useViewContext(),{addDevice:jr}=useMfa(),{data:Br,isLoading:Wr}=usePromise(()=>jr(fr)),qr=()=>{const Vr=()=>{kr("mfa-secure-device",{type:fr})};kr("mfa-verification",{deviceId:Br==null?void 0:Br.id,isInitialSetup:br,showBackButton:!0,type:fr},{onBackClick:Vr})},Gr=({secret:Vr,uri:Zr})=>{kr("mfa-secure-device-help",{secret:Vr,uri:Zr},{onBackClick:()=>{kr("mfa-secure-device",{isInitialSetup:br,type:fr})}})};return jsxRuntimeExports.jsxs("div",{className:"mfa-secure-device-view__body","data-testid":"mfa-secure-device-view",children:[jsxRuntimeExports.jsx(Typography,{className:"mfa-secure-device-view__copy",variant:"body_normal",weight:"regular",color:"secondary",children:wr("dyn_mfa.secure_device_view.body")}),Wr&&jsxRuntimeExports.jsx(Spinner$2,{className:"mfa-secure-device-view__loading-spinner"}),Br&&jsxRuntimeExports.jsxs("div",{className:"mfa-secure-device-view__qrcode",children:[jsxRuntimeExports.jsx(QRCode,{Icon:jsxRuntimeExports.jsx(SvgPasswordHero,{}),value:Br.uri,logoSize:50}),jsxRuntimeExports.jsx("div",{className:"button-container",children:jsxRuntimeExports.jsx("button",{onClick:()=>Gr({secret:Br.secret,uri:Br.uri}),children:jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"medium",color:"secondary",children:wr("dyn_mfa.secure_device_view.helper.button")})})})]}),jsxRuntimeExports.jsx(TypographyButton,{className:"mfa-secure-device-view__button",expanded:!0,onClick:qr,children:wr("dyn_mfa.secure_device_view.continue")}),jsxRuntimeExports.jsx(TextButton,{className:"mfa-secure-device-view__logout-button",onClick:Er,copykey:"dyn_mfa.choose_device_view.logout",children:wr("dyn_mfa.secure_device_view.logout")})]})},MfaVerificationView=({type:fr,isInitialSetup:br=!1,showBackButton:wr=!1,deviceId:Er})=>{const{t:kr}=useTranslation(),{setView:jr}=useViewContext(),{authDevice:Br}=useMfa(),[Wr,qr]=reactExports.useState(""),[Gr,Vr]=reactExports.useState(),[Zr,Jr]=reactExports.useState(!1),{data:Qr,isLoading:_n}=usePromise(()=>Br(Wr,fr,Er),{deps:[Wr],enabled:(Wr==null?void 0:Wr.length)===6,initialData:!1,onReject:An=>{An instanceof MfaRateLimitedError?(Jr(!0),Vr(new DynamicError(kr("dyn_mfa.otp_verification_view.rate_limit_error")))):Vr(new DynamicError(kr("dyn_mfa.otp_verification_view.error")))},onResolve:()=>__awaiter$e(void 0,void 0,void 0,function*(){const An=getUser();(An==null?void 0:An.mfaBackupCodeAcknowledgement)!==MfaBackupCodeAcknowledgement.Complete&&jr("mfa-display-backup-codes")})}),En=An=>{Vr(void 0),qr(An)},Cn=An=>{qr(An)},In=()=>{if(!br){jr("mfa-choose-device",{isInitialSetup:br});return}jr("mfa-secure-device",{isInitialSetup:br,type:fr})};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(OTPVerificationView,{MainIcon:SvgPasswordHero,error:Gr,isLoading:_n,onPinComplete:Cn,isValid:!!Qr,onPinChange:En,description:kr("dyn_mfa.otp_verification_view.body"),onClickBack:wr?In:void 0,disabled:Zr}),!br&&jsxRuntimeExports.jsx("div",{className:"mfa-verification-view__choose-another-method",children:jsxRuntimeExports.jsx(TextButton,{className:"mfa-verification-view__choose-another-method-button",onClick:()=>jr("mfa-choose-device",{isInitialSetup:br}),copykey:"dyn_mfa.otp_verification_view.choose_another_method",children:kr("dyn_mfa.otp_verification_view.choose_another_method")})})]})},MobileWalletRedirectView=({onRetry:fr})=>{const{selectedWalletConnector:br}=useInternalDynamicContext(),{walletBook:wr}=useWalletBookContext(),{t:Er}=useTranslation(),{storeName:kr,walletLink:jr}=reactExports.useMemo(()=>{const qr=br&&getWalletLinks(wr,br.key);return qr&&isIOS()?{storeName:"App Store",walletLink:qr==null?void 0:qr.ios}:qr&&(isAndroid()||isSamsungBrowser())?{storeName:"Play Store",walletLink:qr==null?void 0:qr.android}:{storeName:void 0,walletLink:void 0}},[br,wr]),Br=()=>jr&&window.open(jr,"_blank","noopener,noreferrer"),Wr=qr=>jsxRuntimeExports.jsx(WalletIcon,{walletKey:br==null?void 0:br.key,style:{height:pixelToRem(qr),width:pixelToRem(qr)}});return jsxRuntimeExports.jsxs("div",{className:"mobile-wallet-redirect",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:Wr(94*iconRatio),iconSize:94,isSpinning:!0,className:"mobile-wallet-redirect__icon-with-spinner"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",className:"mobile-wallet-redirect__copy-text",copykey:"dyn_login.mobile_wallet_redirect.prompt",children:Er("dyn_login.mobile_wallet_redirect.prompt")}),jsxRuntimeExports.jsxs(TypographyButton,{buttonVariant:"brand-primary",typographyProps:{color:"white",variant:"button_secondary"},onClick:fr,buttonPadding:"small",children:[Er("dyn_login.mobile_wallet_redirect.open_prompt")," ",br==null?void 0:br.name]}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",className:"mobile-wallet-redirect__alert",children:Er("dyn_login.mobile_wallet_redirect.redirect_fail_message",{walletName:br==null?void 0:br.name})}),kr&&jsxRuntimeExports.jsxs("div",{className:"mobile-wallet-redirect__wallet-app",onClick:Br,children:[jsxRuntimeExports.jsxs("div",{className:"mobile-wallet-redirect__wallet-app__group",children:[Wr(26),jsxRuntimeExports.jsxs(Typography,{variant:"body_small",weight:"bold",children:[Er("dyn_login.mobile_wallet_redirect.get_app_prompt")," ",br==null?void 0:br.name]})]}),jsxRuntimeExports.jsxs("div",{className:"mobile-wallet-redirect__wallet-app__group",children:[jsxRuntimeExports.jsx(Typography,{className:"mobile-wallet-redirect__wallet-app__group__app-store",variant:"body_small",weight:"bold",color:"secondary",children:kr}),jsxRuntimeExports.jsx(Icon,{color:"text-secondary",size:"small",children:jsxRuntimeExports.jsx(SvgExternalLink,{})})]})]})]})},useWalletConnectorEvent=(fr,br,wr)=>{const Er=reactExports.useRef(wr);Er.current=wr,reactExports.useEffect(()=>{if(!fr)return;const kr=Array.isArray(fr)?fr:[fr];kr.forEach(Wr=>Wr.initEventListener());const Br=Array.from(new Set(kr)).map(Wr=>{const qr=(...Gr)=>{Er.current(...Gr,Wr)};return Wr.on(br,qr),()=>Wr.off(br,qr)});return()=>Br.forEach(Wr=>Wr())},[fr,br])},useWalletConnectorNetwork=(fr,{onChange:br}={onChange:()=>{}})=>{const[wr,Er]=reactExports.useState(),{isLoading:kr}=usePromise(()=>fr==null?void 0:fr.getNetwork(),{deps:[fr],onResolve:jr=>{Er(jr)}});return useWalletConnectorEvent(fr||void 0,"chainChange",({chain:jr})=>{const Br=(fr==null?void 0:fr.connectedChain)==="STARK"?jr:parseInt(jr);Er(Br),br==null||br(Br)}),useWalletConnectorEvent(fr||void 0,"disconnect",()=>__awaiter$e(void 0,void 0,void 0,function*(){if((fr==null?void 0:fr.key)!=="argentx")return;const jr=yield fr.getNetwork();Er(jr),br==null||br(jr)})),{isLoading:kr,network:wr}},useNetworkNotSupported=()=>{const{selectedWalletConnector:fr,setShowAuthFlow:br,bridgeChainsToConnect:wr,bridgeOnboardingCompleted:Er,isBridgeFlow:kr,user:jr,authMode:Br}=useInternalDynamicContext(),Wr=useConnectAndSign({shouldCallCallback:!1,shouldUpdateWallets:!!(wr!=null&&wr.length)}),{network:qr}=useWalletConnectorNetwork(fr,{onChange:Gr=>{!fr||!isSupportedNetwork({network:Gr,walletConnector:fr})||Wr({walletConnector:fr}).then(()=>{!jr&&Br==="connect-and-sign"||(!kr||Er||!(wr!=null&&wr.length))&&br(!1)})}});return{currentNetwork:qr}},UserAddress=({userProfile:fr,walletConnector:br})=>{var wr;const Er=(wr=fr==null?void 0:fr.verifiedCredentials.find(Br=>Br.id===fr.lastVerifiedCredentialId))===null||wr===void 0?void 0:wr.address,kr=useFetchNameService(Er),{data:jr}=usePromise(()=>br==null?void 0:br.getAddress(),{enabled:!fr&&!!br});return jsxRuntimeExports.jsxs("div",{className:"user-address__container",children:[jsxRuntimeExports.jsx(StatusDot,{variant:"green",containerClassName:"user-address__status-dot"}),kr!=null&&kr.name?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Typography,{variant:"numbers_big",color:"primary",className:"user-address",children:kr.name}),jsxRuntimeExports.jsx("div",{className:"dynamic-widget-wallet-header__seperator"}),jsxRuntimeExports.jsx(Typography,{variant:"numbers_medium",color:"secondary",className:"user-address",children:shortenWalletAddress(Er,3,3)})]}):jsxRuntimeExports.jsx(Typography,{variant:"numbers_big",color:"primary",className:"user-address",children:shortenWalletAddress(Er||jr,4,4)})]})},SelectNetworkButton=({networkId:fr,networkName:br,networkIconUrl:wr,onClick:Er})=>{const kr=jsxRuntimeExports.jsx("img",{alt:br,className:"select-network-button__icon",src:wr});return jsxRuntimeExports.jsxs(TypographyButton,{dataTestId:"SelectNetworkButton",onClick:()=>Er(fr),expanded:!0,className:"select-network-button",children:["Select",kr,br," network"]})},NetworkNotSupported=()=>{const{onboardingImageUrl:fr,selectedWalletConnector:br}=useInternalDynamicContext(),{t:wr}=useTranslation(),{currentNetwork:Er}=useNetworkNotSupported(),[kr,jr]=reactExports.useState(!1);if(!br)return null;const Br=Gr=>__awaiter$e(void 0,void 0,void 0,function*(){try{yield br.switchNetwork({networkChainId:Gr})}catch(Vr){logger$6.debug(Vr)}}),Wr=br.evmNetworks||[],qr=isSupportedNetwork({network:Er,walletConnector:br});return jsxRuntimeExports.jsxs("div",{className:"network-not-supported","data-testid":"network-not-supported",children:[fr&&jsxRuntimeExports.jsx("img",{className:"network-not-supported__main-img",src:fr,alt:"onboarding"}),!qr&&jsxRuntimeExports.jsx(ErrorContainer,{variant:"info",withIcon:!1,className:"network-not-supported__error--not-supported",copykey:"dyn_network_not_supported.warning_message",children:wr("dyn_network_not_supported.warning_message")}),jsxRuntimeExports.jsxs("div",{className:classNames$1("network-not-supported__content-container",{"network-not-supported__content-container--error":!qr}),children:[jsxRuntimeExports.jsx("div",{className:"network-not-supported__img-container",children:jsxRuntimeExports.jsx(WalletIcon,{style:{height:64,width:64},walletKey:br.key})}),jsxRuntimeExports.jsx(UserAddress,{walletConnector:br}),jsxRuntimeExports.jsx("div",{className:"network-not-supported__network-container",children:Wr.length>1&&jsxRuntimeExports.jsx(NetworkPicker,{currentNetwork:Er,evmNetworks:Wr,connector:br,isNetworkPickerOpen:kr,setIsNetworkPickerOpen:jr,showNetworkName:!0,buttonClassName:"network-not-supported__network-picker-button",mainClassName:"network-not-supported__network-picker"})}),jsxRuntimeExports.jsx("div",{className:"network-not-supported__welcome-container",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_network_not_supported.subtitle",children:wr("dyn_network_not_supported.subtitle")})}),Wr.length===1&&jsxRuntimeExports.jsx(SelectNetworkButton,{onClick:Br,networkId:Wr[0].networkId,networkName:Wr[0].vanityName||Wr[0].name,networkIconUrl:Wr[0].iconUrls[0]})]})]})},NetworkNotSupportedSwitchManual=()=>{const{selectedWalletConnector:fr}=useInternalDynamicContext();useNetworkNotSupported();const{t:br}=useTranslation(),wr=80,Er=jsxRuntimeExports.jsx(WalletIcon,{walletKey:fr==null?void 0:fr.key,style:{height:pixelToRem(wr*iconRatio),width:pixelToRem(wr*iconRatio)}}),kr=getWalletConnectorNetworks(fr),jr=()=>(fr==null?void 0:fr.key)==="metamaskstarknet"?"dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet":kr.length?"dyn_network_not_supported_manual_switch.subtitle_network_defined":"dyn_network_not_supported_manual_switch.subtitle_no_network_defined",Br=()=>(fr==null?void 0:fr.key)==="metamaskstarknet"?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[br("dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet",{network:kr[0].name}),jsxRuntimeExports.jsxs("a",{href:"https://snaps.consensys.io/starknet",target:"_blank",rel:"noreferrer",children:[" ",br("dyn_network_not_supported_manual_switch.subtitle_network_defined_metamaskstarknet_companion_app")," ",jsxRuntimeExports.jsx(SvgExternalLink,{style:{display:"inline-block"}})]})]}):kr.length?br("dyn_network_not_supported_manual_switch.subtitle_network_defined",{network:kr[0].name}):br("dyn_network_not_supported_manual_switch.subtitle_no_network_defined");return jsxRuntimeExports.jsxs("div",{"data-testid":"network-not-supported",className:"network-not-supported-switch-manual",children:[jsxRuntimeExports.jsx("div",{className:"network-not-supported-switch-manual__img-container",children:jsxRuntimeExports.jsx("div",{className:"network-not-supported-switch-manual__network-container",children:jsxRuntimeExports.jsx(IconWithSpinner,{Icon:Er,iconSize:wr,isSpinning:!0})})}),jsxRuntimeExports.jsxs("div",{className:"network-not-supported-switch-manual__content",children:[jsxRuntimeExports.jsx(Typography,{className:"network-not-supported-switch-manual__title",weight:"medium",variant:"title",color:"primary",copykey:"dyn_network_not_supported_manual_switch.title",children:br("dyn_network_not_supported_manual_switch.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",copykey:jr(),children:Br()})]})]})},socialNetworkIconMap={discord:DiscordIcon,helpdesk:HelpdeskIcon,slack:SlackIcon,twitter:TwitterIcon},getSocialNetworkIcon=fr=>socialNetworkIconMap[fr],useNoAccessText=()=>{const{socialMediaLinkText:fr,socialMediaUrl:br,accessDeniedMessagePrimary:wr,accessDeniedMessageSecondary:Er}=useInternalDynamicContext(),{view:kr}=useViewContext(),{t:jr}=useTranslation(),Br=kr.type==="chainalysis-blocked-wallet",Wr=kr.type==="gate-blocked-wallet",qr=kr.type==="no-access",Gr=()=>{if(Br)return jr(textData.chainalysis._socialMediaLinkText);if(!Wr)return fr},Vr=()=>{if(Br)return jr(textData.chainalysis._socialMediaUrl);if(!Wr)return br},Zr=()=>Br?jr(textData.chainalysis.title):Wr?jr(textData.gate.title):wr||jr(textData.default.title),Jr=()=>Br?jr(textData.chainalysis.subtitle):Wr?jr(textData.gate.subtitle):Er||jr(textData.default.subtitle),Qr=()=>jr(Br?textData.chainalysis.buttonTitle:Wr?textData.gate.buttonTitle:textData.default.buttonTitle);return{_socialMediaLinkText:Gr(),_socialMediaUrl:Vr(),buttonTitle:Qr(),isAccessListView:qr,isChainalysisView:Br,isGateBlockedView:Wr,subtitle:Jr(),title:Zr()}},textData={chainalysis:{_socialMediaLinkText:"dyn_no_access.chainalysis.social_media_link_text",_socialMediaUrl:"dyn_no_access.chainalysis.social_media_link_url",buttonTitle:"dyn_no_access.chainalysis.button_text",subtitle:"dyn_no_access.chainalysis.description",title:"dyn_no_access.chainalysis.title"},default:{buttonTitle:"dyn_no_access.default.button_text",subtitle:"dyn_no_access.default.description",title:"dyn_no_access.default.title"},gate:{_socialMediaLinkText:void 0,_socialMediaUrl:void 0,buttonTitle:"dyn_no_access.gate.button_text",subtitle:"dyn_no_access.gate.description",title:"dyn_no_access.gate.title"}},NoAccess=()=>{const{deniedAddress:fr,setDeniedAddress:br,setDeniedOauthProvider:wr,deniedOauthProvider:Er,deniedOauthUsername:kr}=useAccessDeniedContext(),{t:jr}=useTranslation(),Br=Er?findSocialIcon(Er):void 0,{selectedWalletConnector:Wr,socialMediaIconUrl:qr,notInTheListImageUrl:Gr,accessDeniedButton:Vr}=useInternalDynamicContext(),{displayedDestination:Zr}=useVerification(),{goToInitialView:Jr}=useViewContext(),{_socialMediaLinkText:Qr,_socialMediaUrl:_n,isAccessListView:En,isGateBlockedView:Cn,subtitle:In,title:An,buttonTitle:jn}=useNoAccessText(),eo=()=>{Jr(),br(""),wr(void 0),Wr==null||Wr.endSession()},ro=!qr||typeof qr=="string"?null:getSocialNetworkIcon(Object.keys(qr)[0]),to=reactExports.useMemo(()=>Wr?jsxRuntimeExports.jsx(AuthProviderIcon,{}):jsxRuntimeExports.jsx(IconWithStatus,{containerClassName:"wallet-no-access__icon--verified",Icon:Br??SignInWithEmailIcon,iconSize:50,InnerIcon:SvgError,variant:"red"}),[Br,Wr]),_i=shortenWalletAddress(fr,6,4),oo=(Vr==null?void 0:Vr.title)||jn,io=(Vr==null?void 0:Vr.action)||eo,so=Er===void 0?Zr??_i:kr,no=!!Gr&&(En||Cn),Tn=ro&&(En||Cn);return jsxRuntimeExports.jsxs("div",{className:"wallet-no-access__container",children:[no&&jsxRuntimeExports.jsx("img",{src:Gr,alt:jr("dyn_no_access.not_in_the_list_image_alt"),className:"wallet-no-access__image",copykey:"dyn_no_access.not_in_the_list_image_alt"}),jsxRuntimeExports.jsxs("div",{className:"wallet-no-access__main",children:[jsxRuntimeExports.jsxs("div",{className:"wallet-no-access__user-info-container",children:[to,jsxRuntimeExports.jsxs("div",{"data-testid":"walletAddress",className:"wallet-no-access__wallet-address-container",children:[Wr&&jsxRuntimeExports.jsx(StatusDot,{variant:"red",containerClassName:"user-info__status-dot"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"medium",className:"wallet-no-access__wallet-address",children:so})]})]}),jsxRuntimeExports.jsxs("div",{className:"wallet-no-access__content",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"wallet-no-access__content--primary",children:An}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"wallet-no-access__content--secondary",children:In})]}),jsxRuntimeExports.jsx(TypographyButton,{onClick:io,className:"wallet-no-access__button--primary",expanded:!0,buttonPadding:"large",children:oo}),_n&&Qr&&jsxRuntimeExports.jsxs("div",{className:"wallet-no-access__social-info-container",children:[jsxRuntimeExports.jsxs("a",{href:_n,className:"wallet-no-access__waitlist-link",children:[jsxRuntimeExports.jsx(Typography,{variant:"button_primary",color:"primary",children:Qr}),Tn&&jsxRuntimeExports.jsx(ro,{className:"wallet-no-access__social-icon",style:{height:pixelToRem(24),width:pixelToRem(24)}})]}),typeof qr=="string"&&jsxRuntimeExports.jsx("img",{alt:"social media",src:qr,style:{height:"1.5rem",width:"1.5rem"}})]})]})]})},capitalize=fr=>fr[0].toUpperCase()+fr.slice(1),WalletHelpLink=({name:fr,link:br,Icon:wr})=>{const{t:Er}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"wallet-help-link",children:jsxRuntimeExports.jsxs("a",{className:"wallet-help-link__anchor",href:br,target:"_blank",rel:"noreferrer",children:[jsxRuntimeExports.jsx(wr,{style:{height:"1.5rem",width:"1.5rem"}}),jsxRuntimeExports.jsx(Typography,{variant:"button_primary",weight:"medium",copykey:"dyn_qr_code.wallet_not_installed.browser_install",children:Er("dyn_qr_code.wallet_not_installed.browser_install",{browser:capitalize(fr)})})]})})},NoQrNotInstalledView=()=>{const{selectedWalletConnector:fr}=useInternalDynamicContext(),{walletBook:br}=useWalletBookContext(),{t:wr}=useTranslation();if(!fr)return null;const Er=Object.entries(getWalletLinks(br,fr.key)).filter(([,kr])=>kr!=="").filter(([kr])=>kr!=="ios"&&kr!=="android").map(([kr,jr])=>jsxRuntimeExports.jsx(WalletHelpLink,{name:kr,link:jr,Icon:getBrowserIcon(kr)},kr));return jsxRuntimeExports.jsxs("div",{className:"no-qr-code-installed__container","data-testid":"no-qr-code-installed",children:[jsxRuntimeExports.jsx("div",{className:"no-qr-code-installed__img",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:fr.key,style:{height:pixelToRem(64),width:pixelToRem(64)}})}),jsxRuntimeExports.jsx(Typography,{className:"no-qr-code-installed__typography--title",variant:"title",copykey:"dyn_qr_code.wallet_not_installed.install",children:wr("dyn_qr_code.wallet_not_installed.install",{wallet:getWalletBookWallet(br,fr.key).name})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",className:"no-qr-code-installed__typography",color:"secondary",copykey:"dyn_qr_code.wallet_not_installed.select",children:wr("dyn_qr_code.wallet_not_installed.select")}),jsxRuntimeExports.jsx("div",{className:"no-qr-code-installed__links-section",children:Er}),jsxRuntimeExports.jsx(Typography,{variant:"body_mini",className:"no-qr-code-installed__typography",weight:"medium",color:"secondary",copykey:"dyn_qr_code.wallet_not_installed.refresh",children:wr("dyn_qr_code.wallet_not_installed.refresh")})]})};var _g$4,_defs$4,_excluded$b=["title","titleId"];function _extends$b(){return _extends$b=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$b(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgPasskeyIntro2=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$b(br,_excluded$b);return reactExports.createElement("svg",_extends$b({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_g$4||(_g$4=reactExports.createElement("g",{clipPath:"url(#passkey-intro2_svg__a)"},reactExports.createElement("circle",{cx:164,cy:114,r:114,fill:"url(#passkey-intro2_svg__b)",fillOpacity:.12}),reactExports.createElement("g",{clipPath:"url(#passkey-intro2_svg__c)",fill:"#4779FF"},reactExports.createElement("path",{d:"M106.009 34.681a2.666 2.666 0 0 1 3.266 1.886l-15.454 4.141a5.319 5.319 0 0 0-3.339 2.666 5.335 5.335 0 0 1 3.936-5.587l11.591-3.106ZM117.785 42.57a5.333 5.333 0 0 0-6.532-3.772l-15.455 4.141a5.333 5.333 0 0 0-3.771 6.532l2.76 10.303a5.333 5.333 0 0 0 6.533 3.771l15.454-4.14a5.333 5.333 0 0 0 3.772-6.533l-2.761-10.303Z"})),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.269 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.314.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.325 9.325 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.732-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm-1.34 14.592a15.89 15.89 0 0 0-7.978 2.135 1.772 1.772 0 0 0 1.775 3.069 12.347 12.347 0 0 1 6.203-1.66c6.853 0 12.408 5.556 12.408 12.409a44.34 44.34 0 0 1-1.688 12.156 1.772 1.772 0 1 0 3.41.97 47.883 47.883 0 0 0 1.823-13.126c0-8.81-7.142-15.953-15.953-15.953Zm-10.749 9.75a1.772 1.772 0 1 0-3.069-1.775 15.891 15.891 0 0 0-2.135 7.978c0 2.499-.573 4.86-1.594 6.96a1.772 1.772 0 1 0 3.189 1.55 19.43 19.43 0 0 0 1.95-8.51c0-2.263.604-4.38 1.659-6.203Zm10.749-2.66a8.863 8.863 0 0 0-8.863 8.863c0 4.516-1.29 8.704-3.518 12.246l1.5.944-1.5-.944-.121.196a1.774 1.774 0 0 0 3.049 1.81 26.434 26.434 0 0 0 4.135-14.253 5.318 5.318 0 0 1 10.636 0c0 1.723-.118 3.418-.345 5.078a1.773 1.773 0 0 0 3.513.48 41.12 41.12 0 0 0 .377-5.557 8.863 8.863 0 0 0-8.863-8.863Zm1.772 8.863a1.772 1.772 0 1 0-3.545 0c0 5.89-1.688 11.381-4.607 16.021a1.773 1.773 0 0 0 3.001 1.888 33.528 33.528 0 0 0 5.151-17.91Zm5.554 11.117a1.773 1.773 0 0 0-3.411-.965 37.01 37.01 0 0 1-2.523 6.502 1.771 1.771 0 1 0 3.169 1.588 40.517 40.517 0 0 0 2.765-7.124Z",fill:"#4779FF"}))),_defs$4||(_defs$4=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"passkey-intro2_svg__a"},reactExports.createElement("rect",{width:327,height:112,rx:12,fill:"#fff"})),reactExports.createElement("clipPath",{id:"passkey-intro2_svg__c"},reactExports.createElement("path",{fill:"#fff",transform:"rotate(-15 184.593 -307.976)",d:"M0 0h32v32H0z"})),reactExports.createElement("linearGradient",{id:"passkey-intro2_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))},_path$7,_path2,_path3,_excluded$a=["title","titleId"];function _extends$a(){return _extends$a=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$a(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgAndroidFaceId=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$a(br,_excluded$a);return reactExports.createElement("svg",_extends$a({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$7||(_path$7=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32 57.887c14.297 0 25.887-11.59 25.887-25.887S46.297 6.113 32 6.113 6.113 17.703 6.113 32 17.703 57.887 32 57.887ZM32 60c15.464 0 28-12.536 28-28S47.464 4 32 4 4 16.536 4 32s12.536 28 28 28Z",fill:"#1A73E8"})),_path2||(_path2=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M36.752 46.831c.27.582.018 1.274-.565 1.544-2.69 1.25-5.356 1.479-7.54.476-2.215-1.017-3.66-3.173-4.134-6.099l2.295-.372c.383 2.364 1.466 3.742 2.809 4.359 1.374.63 3.299.592 5.591-.472a1.162 1.162 0 0 1 1.544.564ZM33.585 35.17v-4.755h2.113v6.868h-5.811V35.17h3.698Z",fill:"#1A73E8"})),_path3||(_path3=reactExports.createElement("path",{d:"M46.792 25.132a2.113 2.113 0 1 1-4.226 0 2.113 2.113 0 0 1 4.226 0ZM21.434 25.132a2.113 2.113 0 1 1-4.227 0 2.113 2.113 0 0 1 4.227 0Z",fill:"#1A73E8"})))},_path$6,_excluded$9=["title","titleId"];function _extends$9(){return _extends$9=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$9(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgAndroidTouchId=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$9(br,_excluded$9);return reactExports.createElement("svg",_extends$9({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$6||(_path$6=reactExports.createElement("path",{d:"M47.493 11.92c-.213 0-.426-.053-.613-.16C41.76 9.12 37.333 8 32.027 8c-5.28 0-10.294 1.253-14.854 3.76-.64.347-1.44.107-1.813-.533a1.35 1.35 0 0 1 .533-1.814c4.96-2.693 10.4-4.08 16.134-4.08 5.68 0 10.64 1.254 16.08 4.054.666.346.906 1.146.56 1.786-.24.48-.694.747-1.174.747Zm-38.16 14a1.33 1.33 0 0 1-1.093-2.107c2.64-3.733 6-6.666 10-8.72 8.373-4.32 19.093-4.346 27.493-.026 4 2.053 7.36 4.96 10 8.666.427.587.294 1.44-.32 1.867a1.33 1.33 0 0 1-1.866-.32c-2.4-3.36-5.44-6-9.04-7.84-7.654-3.92-17.44-3.92-25.067.027-3.627 1.866-6.667 4.533-9.067 7.893-.213.373-.613.56-1.04.56ZM26 58.107c-.347 0-.693-.134-.933-.4-2.32-2.32-3.574-3.814-5.36-7.04-1.84-3.28-2.8-7.28-2.8-11.574 0-7.92 6.773-14.373 15.093-14.373s15.093 6.453 15.093 14.373a1.32 1.32 0 0 1-1.333 1.334 1.32 1.32 0 0 1-1.333-1.334c0-6.453-5.574-11.706-12.427-11.706S19.573 32.64 19.573 39.093c0 3.84.854 7.387 2.48 10.267 1.707 3.067 2.88 4.373 4.934 6.453a1.37 1.37 0 0 1 0 1.894c-.294.266-.64.4-.987.4Zm19.12-4.934c-3.173 0-5.973-.8-8.267-2.373-3.973-2.693-6.346-7.067-6.346-11.707a1.32 1.32 0 0 1 1.333-1.333 1.32 1.32 0 0 1 1.333 1.333c0 3.76 1.92 7.307 5.174 9.494 1.893 1.28 4.106 1.893 6.773 1.893.64 0 1.707-.08 2.773-.267a1.33 1.33 0 0 1 1.547 1.094 1.33 1.33 0 0 1-1.093 1.546c-1.52.294-2.854.32-3.227.32Zm-5.36 5.494a1.56 1.56 0 0 1-.347-.054c-4.24-1.173-7.013-2.746-9.92-5.6-3.733-3.706-5.786-8.64-5.786-13.92 0-4.32 3.68-7.84 8.213-7.84 4.533 0 8.213 3.52 8.213 7.84 0 2.854 2.48 5.174 5.547 5.174 3.067 0 5.547-2.32 5.547-5.174 0-10.053-8.667-18.213-19.334-18.213-7.573 0-14.506 4.213-17.626 10.747-1.04 2.16-1.574 4.693-1.574 7.466 0 2.08.187 5.36 1.787 9.627a1.301 1.301 0 0 1-.773 1.707A1.323 1.323 0 0 1 12 49.653c-1.307-3.493-1.947-6.96-1.947-10.56 0-3.2.614-6.106 1.814-8.64 3.546-7.44 11.413-12.266 20.026-12.266 12.134 0 22 9.36 22 20.88 0 4.32-3.68 7.84-8.213 7.84-4.533 0-8.213-3.52-8.213-7.84 0-2.854-2.48-5.174-5.547-5.174-3.067 0-5.547 2.32-5.547 5.174 0 4.56 1.76 8.826 4.987 12.026 2.533 2.507 4.96 3.894 8.72 4.934.72.186 1.12.933.933 1.626a1.301 1.301 0 0 1-1.253 1.014Z",fill:"#1A73E8"})))},_path$5,_excluded$8=["title","titleId"];function _extends$8(){return _extends$8=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$8(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgFaceId=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$8(br,_excluded$8);return reactExports.createElement("svg",_extends$8({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$5||(_path$5=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M18.055 2.4A3.548 3.548 0 0 1 21.6 5.945v2.013a1.095 1.095 0 0 1-2.19 0V5.945c0-.747-.608-1.355-1.355-1.355h-2.012a1.095 1.095 0 1 1 0-2.19h2.012Zm-10.098 0a1.095 1.095 0 0 1 0 2.19H5.945c-.747 0-1.355.608-1.355 1.355v2.013a1.095 1.095 0 0 1-2.19 0V5.945A3.548 3.548 0 0 1 5.945 2.4h2.012Zm7.692 5.083c.6 0 1.086.486 1.086 1.086v1.347a1.086 1.086 0 1 1-2.172 0V8.57c0-.6.486-1.086 1.086-1.086Zm-4.121 0c.614 0 1.112.498 1.112 1.112v2.982h.008a1.113 1.113 0 0 1 0 2.226h-.386a1.849 1.849 0 0 1-1.847-1.848v-3.36c0-.614.498-1.112 1.113-1.112Zm-3.282 0c.6 0 1.086.486 1.086 1.086v1.347a1.086 1.086 0 0 1-2.172 0V8.57c0-.6.486-1.086 1.086-1.086Zm12.259 7.465c.605 0 1.095.49 1.095 1.095v2.012a3.548 3.548 0 0 1-3.545 3.545h-2.012a1.095 1.095 0 1 1 0-2.19h2.012c.747 0 1.355-.608 1.355-1.355v-2.012c0-.605.49-1.095 1.095-1.095Zm-17.01 0c.605 0 1.095.49 1.095 1.095v2.012c0 .747.608 1.355 1.355 1.355h2.012a1.095 1.095 0 0 1 0 2.19H5.945A3.548 3.548 0 0 1 2.4 18.055v-2.012c0-.605.49-1.095 1.095-1.095Zm5.365 1.337a.473.473 0 0 0 0 0l-.434.47a1.113 1.113 0 0 1 1.51-1.634c.563.52 1.296.806 2.064.806s1.5-.286 2.065-.807a1.113 1.113 0 0 1 1.51 1.634A5.255 5.255 0 0 1 12 18.153a5.255 5.255 0 0 1-3.574-1.397l.434-.47a4.615 4.615 0 0 1 0 0Zm5.947.28a4.694 4.694 0 0 1 0 0Z",fill:"#ABACB2"})))},_g$3,_defs$3,_excluded$7=["title","titleId"];function _extends$7(){return _extends$7=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$7(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgIphoneTouchId=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$7(br,_excluded$7);return reactExports.createElement("svg",_extends$7({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_g$3||(_g$3=reactExports.createElement("g",{clipPath:"url(#iphone-touch-id_svg__a)",fill:"#000"},reactExports.createElement("path",{d:"M38.635.943c-4.483-1.118-9.2-1.278-13.79-.287a.657.657 0 0 0 .277 1.285c4.396-.95 8.924-.793 13.232.287 10.3 2.582 18.875 10.327 22.14 20.444 1.264 3.912 1.8 8.078 1.908 12.445a.657.657 0 0 0 1.313-.033c-.108-4.426-.651-8.7-1.945-12.74C58.378 11.75 49.417 3.632 38.635.943ZM21.51 2.932a.657.657 0 1 0-.35-1.267c-4.801 1.324-11.554 5.9-15.728 12.014a.754.754 0 0 0-.004.007C1.763 19.208-.534 26.148.108 32.883l.001.019c.154 1.23.412 2.457.67 3.686.544 2.588 1.09 5.183.665 7.818a.657.657 0 1 0 1.297.21c.445-2.755-.107-5.443-.66-8.13-.254-1.244-.51-2.487-.666-3.737-.604-6.364 1.57-13.002 5.105-18.333 4.015-5.879 10.516-10.25 14.99-11.484Z"}),reactExports.createElement("path",{d:"M30.133 4.4c8.25-.504 16.499 2.863 22.039 9.314a.657.657 0 1 1-.997.856c-5.268-6.134-13.118-9.339-20.966-8.858H30.2c-9.925.48-19.22 7.214-22.638 16.648a.657.657 0 1 1-1.236-.447C9.928 11.973 19.688 4.907 30.133 4.4ZM54.174 16.585a.657.657 0 0 0-1.091.733c3.07 4.572 4.34 9.548 4.843 15.454a.657.657 0 0 0 1.31-.112c-.514-6.034-1.823-11.252-5.062-16.075ZM58.796 35.45a.657.657 0 0 1 .697.615c.247 3.963.25 8.446-.189 11.76a.657.657 0 1 1-1.303-.173c.423-3.193.425-7.582.18-11.505a.657.657 0 0 1 .615-.697ZM6.57 25.543a.657.657 0 1 0-1.278-.308 26.58 26.58 0 0 0-.743 6.104c-.01 2.117.385 4.184.78 6.25.323 1.692.646 3.384.747 5.104.134 2.26-.341 4.523-1.163 6.677a.657.657 0 1 0 1.228.469c.868-2.277 1.395-4.73 1.247-7.223-.1-1.709-.424-3.39-.747-5.072-.394-2.051-.788-4.102-.778-6.199.01-1.952.248-3.902.706-5.802Z"}),reactExports.createElement("path",{d:"M23.813 10.94a.657.657 0 0 1-.365.855c-6.813 2.736-11.93 8.91-12.973 16.19-.436 3.042.035 6.055.506 9.067.265 1.696.53 3.392.634 5.093.223 3.688-.197 7.739-2.597 11.425a.657.657 0 0 1-1.101-.718c2.186-3.358 2.6-7.088 2.386-10.627-.105-1.726-.368-3.442-.632-5.156-.472-3.077-.944-6.15-.497-9.27 1.115-7.774 6.563-14.324 13.784-17.224a.657.657 0 0 1 .855.365ZM46.882 14.681c-5.374-5.034-13.164-6.79-20.244-5.238a.657.657 0 1 0 .282 1.284c6.704-1.47 14.039.207 19.064 4.914 4.235 3.967 6.695 9.739 7.339 16.037a.657.657 0 0 0 1.307-.134c-.668-6.54-3.232-12.633-7.748-16.863ZM54.493 34.674a.657.657 0 0 1 .72.586c.625 6.077.356 12.64-.587 18.99a.657.657 0 0 1-1.3-.193c.93-6.261 1.191-12.713.58-18.662a.657.657 0 0 1 .587-.721Z"}),reactExports.createElement("path",{d:"M31.582 13.355c-10.07 0-18.252 8.034-18.252 17.967 0 1.06.094 2.1.274 3.111a.657.657 0 0 0 1.294-.23 16.469 16.469 0 0 1-.254-2.881c0-9.187 7.574-16.652 16.938-16.652 4.232 0 8.098 1.525 11.066 4.045a.657.657 0 0 0 .85-1.002 18.353 18.353 0 0 0-11.916-4.358ZM44.971 20.163a.657.657 0 0 1 .93.02c2.9 3.024 3.828 7.777 4.442 11.766.692 4.494.798 8.877.798 10.91a.657.657 0 0 1-1.315 0c0-2-.104-6.31-.782-10.71-.57-3.703-1.392-8.24-4.092-11.056a.657.657 0 0 1 .02-.93ZM50.974 46.622a.657.657 0 0 0-1.31-.105c-.323 4.048-.745 8.092-1.6 11.827a.657.657 0 1 0 1.28.293c.879-3.833 1.306-7.956 1.63-12.015ZM14.662 36.852a.657.657 0 0 1 .771.518c1.39 7.056.43 13.466-3.25 19.08a.657.657 0 0 1-1.099-.72c3.462-5.283 4.394-11.331 3.06-18.106a.657.657 0 0 1 .518-.772Z"}),reactExports.createElement("path",{d:"M31.582 17.631c-6.537 0-12.95 5.06-13.604 11.42-.287 2.784.116 5.526.519 8.27.351 2.395.703 4.791.596 7.217-.244 5.552-1.873 10.135-4.672 13.91a.657.657 0 1 0 1.056.782c2.968-4.003 4.674-8.844 4.93-14.634.106-2.415-.247-4.804-.6-7.19-.403-2.73-.806-5.459-.521-8.221.574-5.587 6.325-10.24 12.296-10.24 2.785 0 9.991 1.508 12.283 8.976 1.437 4.679 1.828 11.012 1.48 17.164-.347 6.151-1.43 12.035-2.885 15.808a.657.657 0 0 0 1.227.473c1.522-3.947 2.619-9.98 2.97-16.207.353-6.226-.034-12.734-1.535-17.624-2.545-8.289-10.52-9.904-13.54-9.904Z"}),reactExports.createElement("path",{d:"M21.47 56.451c.303.198.389.606.19.91-.407.624-.765 1.278-1.124 1.932-.359.654-.717 1.307-1.125 1.932a.657.657 0 1 1-1.1-.718c.407-.624.765-1.278 1.124-1.932.359-.654.717-1.308 1.125-1.932a.657.657 0 0 1 .91-.192ZM27.096 24.453a.657.657 0 1 0-.73-1.093c-2.603 1.74-4.2 4.134-4.2 7.64 0 2.088.37 3.795.75 5.545.567 2.62.953 5.233.883 7.923-.084 3.267-.723 6.252-1.952 9.096a.657.657 0 1 0 1.207.521c1.299-3.007 1.971-6.158 2.06-9.583.071-2.796-.325-5.513-.913-8.235-.38-1.758-.72-3.328-.72-5.267 0-3.004 1.321-5.013 3.615-6.547ZM29.66 22.144c2.728-.556 5.662.13 7.822 1.879 3.858 3.122 4.371 8.817 4.787 13.432l.021.235c.538 5.949-.077 11.726-1.316 17.529a.657.657 0 1 1-1.286-.275c1.22-5.715 1.815-11.355 1.293-17.136l-.052-.582v-.002c-.37-4.17-.832-9.394-4.274-12.18-1.846-1.494-4.379-2.092-6.732-1.613a.657.657 0 1 1-.262-1.287ZM40.045 58.489a.657.657 0 1 0-1.274-.325 15.88 15.88 0 0 1-1.785 4.266.657.657 0 1 0 1.127.675 17.188 17.188 0 0 0 1.932-4.616ZM36.831 48.952c.36.043.618.37.576.73-.62 5.245-2.022 9.922-4.27 13.98a.657.657 0 0 1-1.15-.638c2.152-3.882 3.51-8.39 4.115-13.496a.657.657 0 0 1 .73-.576Z"}),reactExports.createElement("path",{d:"M36.696 30.656c-.456-2.435-2.545-4.297-5.081-4.297-3.435 0-5.845 3.462-4.996 6.683 1.437 5.686 1.673 11.166.7 16.444v.003c-.845 4.739-2.465 9.002-4.677 12.614a.657.657 0 0 0 1.121.686c2.302-3.76 3.978-8.178 4.85-13.067 1.01-5.482.759-11.154-.72-17.005l-.002-.007c-.637-2.41 1.138-5.037 3.724-5.037 1.865 0 3.44 1.373 3.788 3.22.957 5.548 1.455 10.693 1.1 15.123a.657.657 0 1 0 1.31.105c.368-4.592-.151-9.863-1.115-15.456l-.002-.01ZM29.654 59.117c.323.166.45.562.284.885l-1.741 3.389a.657.657 0 1 1-1.17-.601L28.77 59.4a.657.657 0 0 1 .885-.284Z"}),reactExports.createElement("path",{d:"M32.103 31.29a.657.657 0 1 0-1.28.3c2.217 9.433 1.913 17.717-.787 24.773a.657.657 0 1 0 1.228.47c2.814-7.358 3.1-15.919.84-25.544Z"}))),_defs$3||(_defs$3=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"iphone-touch-id_svg__a"},reactExports.createElement("path",{fill:"#fff",d:"M0 0h64v64H0z"})))))};const PasskeyDeviceIcon=({defaultIcon:fr,className:br,size:wr="small"})=>{let Er=fr||null;if(isIPhone()&&(isIPhone8OrEarlier()?Er=jsxRuntimeExports.jsx(SvgIphoneTouchId,{"data-testid":"iphone-8-icon"}):Er=jsxRuntimeExports.jsx(SvgFaceId,{"data-testid":"iphone-icon"})),isAndroid()){const kr=getAndroidVersion();kr&&kr>=9?Er=jsxRuntimeExports.jsx(SvgAndroidTouchId,{"data-testid":"android-9-icon"}):Er=jsxRuntimeExports.jsx(SvgAndroidFaceId,{"data-testid":"android-icon"})}return Er?jsxRuntimeExports.jsx(Icon,{className:br,size:wr,children:Er}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{})},AuthChoiceInfo=({choice:fr,variant:br="default"})=>{const{t:wr}=useTranslation(),Er={passkey:{default:[{description:"dyn_embedded_authenticator.passkey.auth_info.convinience.description",title:"dyn_embedded_authenticator.passkey.auth_info.convinience.title"},{description:"dyn_embedded_authenticator.passkey.auth_info.security.description",title:"dyn_embedded_authenticator.passkey.auth_info.security.title"}],noEmailSignup:[{description:"dyn_embedded_authenticator.passkey.no_email_auth_info.convinience.description",title:"dyn_embedded_authenticator.passkey.no_email_auth_info.convinience.title"},{description:"dyn_embedded_authenticator.passkey.no_email_auth_info.security.description",title:"dyn_embedded_authenticator.passkey.no_email_auth_info.security.title"}]}};return jsxRuntimeExports.jsx("div",{className:"auth-choice-info",children:Er[fr][br].map((kr,jr)=>jsxRuntimeExports.jsxs("div",{className:"auth-choice-info__container-item",children:[jsxRuntimeExports.jsx("div",{className:"auth-choice-info__container-icon",children:jsxRuntimeExports.jsx(Icon,{size:"medium",className:"auth-choice-info__icon",children:jsxRuntimeExports.jsx(SvgAdd,{})})}),jsxRuntimeExports.jsxs("div",{className:"action-card__item-title",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",copykey:kr.title,children:wr(kr.title)}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",weight:"regular",color:"secondary",copykey:kr.description,children:wr(kr.description)})]})]},`authChoiceInfo_${jr}`))})},PasskeyIntroView=({chains:fr})=>{var br;const{walletConnectorOptions:wr,environmentId:Er,handleLogOut:kr,user:jr,userWithMissingInfo:Br}=useInternalDynamicContext(),Wr=((br=jr==null?void 0:jr.verifiedCredentials)===null||br===void 0?void 0:br.length)===1&&!getUserVerifiedCredentialType(jr,JwtVerifiedCredentialFormatEnum.Email),{t:qr}=useTranslation(),[Gr,Vr]=reactExports.useState(!1);reactExports.useEffect(()=>StorageService.removeItem(LAST_USED_WALLET),[]);const{createDynamicEmbeddedWalletMutation:Zr,isLoading:Jr,error:Qr}=useCreateDynamicEmbeddedWalletMutation(),_n=Cn=>__awaiter$e(void 0,void 0,void 0,function*(){if(!jr&&!Br)throw new Error("User is not logged in");Vr(Cn),yield Zr({chains:fr,environmentId:Er,walletConnectorOptions:wr,withAuthenticator:Cn})}),En=reactExports.useMemo(()=>{if(Qr)return Qr instanceof DynamicError?Qr.message:getProperErrorMessage(Qr)},[Qr]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_passkey_intro.title",children:qr("dyn_passkey_intro.title")})}),jsxRuntimeExports.jsxs("div",{className:"passkey-intro-view",children:[jsxRuntimeExports.jsx("div",{className:"passkey-intro-view__header",children:jsxRuntimeExports.jsx(SvgPasskeyIntro2,{})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-intro-view__subtitle",copykey:"dyn_passkey_intro.subtitle",children:qr("dyn_passkey_intro.subtitle")}),En&&jsxRuntimeExports.jsx(ErrorContainer,{children:En}),jsxRuntimeExports.jsx(AuthChoiceInfo,{choice:"passkey",variant:Wr?"noEmailSignup":"default"}),jsxRuntimeExports.jsxs("div",{className:"passkey-intro-view__actions",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"brand-primary",buttonPadding:"large",onClick:()=>_n(!0),dataTestId:"setup-passkey-button",loading:Jr&&Gr,disabled:Jr,typographyProps:{color:"inherit"},children:jsxRuntimeExports.jsxs("div",{className:"passkey-intro-view__inline-button",children:[jsxRuntimeExports.jsx(PasskeyDeviceIcon,{size:"small"}),jsxRuntimeExports.jsx(Typography,{copykey:"dyn_passkey_intro.button",children:qr("dyn_passkey_intro.button")})]})}),jsxRuntimeExports.jsx(TextButton,{"data-testid":"setup-passkey-logout-button",className:"passkey-intro-view__log-out",onClick:kr,copykey:"dyn_passkey_intro.button_logout",children:qr("dyn_passkey_intro.button_logout")})]})]})]})};var _circle$1,_path$4,_g$2,_defs$2,_excluded$6=["title","titleId"];function _extends$6(){return _extends$6=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$6(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgPasskeyIntroIcon=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$6(br,_excluded$6);return reactExports.createElement("svg",_extends$6({width:206,height:206,viewBox:"0 0 206 206",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_circle$1||(_circle$1=reactExports.createElement("circle",{cx:103,cy:103,r:103,fill:"url(#passkey-intro-icon_svg__a)",fillOpacity:.12})),_path$4||(_path$4=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M101.59 42.066a6.37 6.37 0 0 1 1.822 0c.696.1 1.343.345 1.858.54l.138.051 17.072 6.402.416.156c1.967.734 3.695 1.38 5.025 2.551a9.553 9.553 0 0 1 2.612 3.77c.631 1.657.628 3.501.625 5.6v15.672c0 9-4.895 16.504-10.187 22.016-5.326 5.55-11.421 9.469-14.643 11.349l-.131.077c-.588.345-1.351.793-2.361 1.01a6.78 6.78 0 0 1-2.67 0c-1.01-.217-1.774-.665-2.362-1.01l-.13-.077c-3.223-1.88-9.317-5.799-14.644-11.349-5.291-5.512-10.186-13.015-10.186-22.016V61.137c-.003-2.1-.006-3.944.625-5.601a9.553 9.553 0 0 1 2.612-3.77c1.33-1.172 3.058-1.817 5.025-2.551l.416-.156 17.072-6.402.138-.052c.514-.194 1.162-.439 1.858-.54ZM94.382 69.11v-4.037a8.073 8.073 0 1 1 16.147 0v4.036a13.434 13.434 0 0 1 5.383 10.766c0 7.431-6.024 13.456-13.456 13.456C95.025 93.33 89 87.306 89 79.875c0-4.402 2.114-8.31 5.382-10.765Zm13.147-1.702v-2.335a5.073 5.073 0 1 0-10.147 0v2.336a13.414 13.414 0 0 1 5.074-.99c1.795 0 3.508.352 5.073.99ZM106 77.5a3.5 3.5 0 0 1-2 3.163V83.5a1.5 1.5 0 1 1-3 0v-2.837a3.5 3.5 0 1 1 5-3.163ZM126 22a4 4 0 0 1 4-4h45a4 4 0 0 1 4 4v10a4 4 0 0 1-4 4h-45a4 4 0 0 1-4-4V22Zm15 5a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm7 3a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm13-3a3 3 0 1 1-6 0 3 3 0 0 1 6 0Zm9 0a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm1 0a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z",fill:"#4779FF"})),_g$2||(_g$2=reactExports.createElement("g",{clipPath:"url(#passkey-intro-icon_svg__b)"},reactExports.createElement("g",{clipPath:"url(#passkey-intro-icon_svg__c)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M59.731 54.983a15.068 15.068 0 0 0 1.087-10.69C58.656 36.226 50.362 31.438 42.294 33.6c-8.069 2.162-12.857 10.455-10.695 18.524a15.068 15.068 0 0 0 6.288 8.715c1.864-4.039 6.77-6.622 9.948-7.473 3.179-.852 8.204-1.183 11.896 1.618Zm-19.98-8.96a5.672 5.672 0 1 1 10.957-2.935 5.672 5.672 0 0 1-10.957 2.936Z",fill:"#4779FF"})))),_defs$2||(_defs$2=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"passkey-intro-icon_svg__b"},reactExports.createElement("path",{fill:"#fff",transform:"rotate(-15 151.778 -80.474)",d:"M0 0h33v33H0z"})),reactExports.createElement("clipPath",{id:"passkey-intro-icon_svg__c"},reactExports.createElement("rect",{x:27.684,y:37.513,width:30.25,height:30.25,rx:15.125,transform:"rotate(-15 27.684 37.513)",fill:"#fff"})),reactExports.createElement("linearGradient",{id:"passkey-intro-icon_svg__a",x1:103,y1:0,x2:103,y2:105.711,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))};const AddRecoveryEmail=({canSkipAddingEmail:fr=!0,shouldInitRecovery:br=!1,authenticatorType:wr,currentAction:Er,isFromEmailVerification:kr=!1})=>{const{user:jr,setShowAuthFlow:Br}=useInternalDynamicContext(),{t:Wr}=useTranslation(),{addRecoveryEmail:qr,initPasskeyRecoveryProcess:Gr}=usePasskeyRecovery(),[Vr,Zr]=reactExports.useState(!1),[Jr,Qr]=reactExports.useState(void 0);useEffectOnce(()=>{dynamicEvents.once("embeddedWalletRecoveryEmailCompleted",()=>__awaiter$e(void 0,void 0,void 0,function*(){if(Zr(!0),Qr(void 0),!br){setTimeout(()=>{Br(!1,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1})},5e3);return}return Gr(wr,Er)})),dynamicEvents.once("embeddedWalletRecoveryEmailFailed",jn=>__awaiter$e(void 0,void 0,void 0,function*(){Qr(jn)}))});const{mutate:_n,isLoading:En}=useMutation(jn=>__awaiter$e(void 0,void 0,void 0,function*(){yield qr(jn)})),Cn=()=>{Br(!1)},In=()=>{if(Jr)return Jr instanceof DynamicError?Jr.message:getProperErrorMessage(Jr)},An=fr&&jsxRuntimeExports.jsx(IconButton,{onClick:Cn,type:"button","data-testid":"add-recovery-email-close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:An,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"passkey-recovery-heading",className:"header__typography",copykey:"dyn_passkey_recovery.add_email.title",children:Wr("dyn_passkey_recovery.add_email.title")})}),jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view",children:[jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__header",children:jsxRuntimeExports.jsx(SvgPasskeyIntroIcon,{})}),Vr&&jsxRuntimeExports.jsx(ErrorContainer,{variant:"success",copykey:"dyn_passkey_recovery.add_email.success_message",children:Wr("dyn_passkey_recovery.add_email.success_message")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-recovery-view__subtitle",copykey:"dyn_passkey_recovery.add_email.description",children:Wr("dyn_passkey_recovery.add_email.description")}),Jr!==void 0&&jsxRuntimeExports.jsx(ErrorContainer,{children:In()}),jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__form",children:jsxRuntimeExports.jsx(EmailForm,{onSubmit:_n,currentEmail:jr==null?void 0:jr.email,isLoading:(En||kr)&&!Jr,buttonCopyKey:"dyn_passkey_recovery.add_email.confirm_button",isDisabled:kr&&!Jr&&!Vr})})]})]})},bundleRegex=new RegExp(/^([A-Za-z0-9\s_+@\.-]+)$/),PasskeyBundleRecovery=({authenticatorType:fr,currentAction:br})=>{const{primaryWallet:wr,environmentId:Er,user:kr,setShowAuthFlow:jr}=useInternalDynamicContext(),{isTurnkeyWalletWithoutAuthenticator:Br}=useIsTurnkeyWallet(),{getEOAWallet:Wr}=useSmartWallets(),[qr,Gr]=reactExports.useState(""),[Vr,Zr]=reactExports.useState(!1),[Jr,Qr]=reactExports.useState(!1),{t:_n}=useTranslation(),{setView:En}=useViewContext(),{mutate:Cn,isLoading:In,error:An}=useMutation(co=>__awaiter$e(void 0,void 0,void 0,function*(){var so;const no=(so=wr&&Wr(wr))!==null&&so!==void 0?so:wr;yield passkeyRecoveryBundleValidation({bundleInput:co,user:kr,wallet:no}),Qr(!0),fr==="email"&&dynamicEvents.emit("passkeyRecoveryCompleted",wr),setTimeout(()=>{if(fr==="passkey")return En("passkey-recovery-complete");br!=="reveal"&&jr(!1)},2e3)})),jn=co=>!(!(co!=null&&co.length)||co.length<100||co.length>=256||!bundleRegex.test(co)),eo=co=>{var so;const no=(so=co.target.value)===null||so===void 0?void 0:so.trim();Gr(no),jn(no)&&Cn(no)},ro=()=>__awaiter$e(void 0,void 0,void 0,function*(){try{Zr(!0),yield resentRecoveryEmail({authenticatorType:fr,environmentId:Er,user:kr,wallet:wr})}catch(co){logger$6.error("Failed to complete passkey recovery",co)}finally{Zr(!1)}}),to=reactExports.useMemo(()=>{if(An)return An instanceof DynamicError?An.message:getProperErrorMessage(An)},[An]),_i=jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SignInWithEmailIcon,{})}),oo=Br?"dyn_passkey_secure_modal":"dyn_passkey_recovery",io=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>{jr(!1,{emitCancelAuth:!0}),dynamicEvents.emit("passkeyRecoveryFailed",new DynamicError("Validation request cancelled"))},"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:io,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:`${oo}.code.title`,children:_n(`${oo}.code.title`)})}),jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view",children:[!An&&!Jr?jsxRuntimeExports.jsx(IconWithSpinner,{Icon:_i,isSpinning:!An&&!Jr,iconSize:96}):jsxRuntimeExports.jsx(IconWithStatus,{Icon:SignInWithEmailIcon,iconSize:64,variant:An?"red":"green",InnerIcon:An?SvgError:SvgCheck}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-recovery-view__subtitle",copykey:`${oo}.code.description`,children:_n(`${oo}.code.description`,{email:kr==null?void 0:kr.email})}),jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__actions",children:jsxRuntimeExports.jsx(Input,{id:"passkey-recovery-bundle","data-testid":"passkey-recovery-bundle-input",value:qr,onChange:eo,label:_n(`${oo}.code.input_label`),disabled:In||Vr,error:!!An,className:Jr?"passkey-recovery-view__input-valid":"",autoFocus:!0,message:to})}),jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view__resend-code",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",copykey:`${oo}.code.resend.text`,children:_n(`${oo}.code.resend.text`)}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"link",copykey:`${oo}.code.resend.button`,children:jsxRuntimeExports.jsx(TextButton,{"data-testid":"resend-email-button",onClick:ro,disabled:Vr||In||qr.length>0&&!An,children:_n(`${oo}.code.resend.button`)})})]})]})]})},NeedHelpSection=({isRecoveryFlow:fr=!1})=>{var br,wr,Er,kr,jr,Br;const{projectSettings:Wr,primaryWallet:qr}=useInternalDynamicContext(),{t:Gr}=useTranslation(),{initPasskeyRecoveryProcess:Vr}=usePasskeyRecovery(),Zr=(br=Wr==null?void 0:Wr.general)===null||br===void 0?void 0:br.supportEmail,Jr=((wr=Wr==null?void 0:Wr.general)===null||wr===void 0?void 0:wr.supportUrls)&&((Er=Object.values(Wr==null?void 0:Wr.general.supportUrls))===null||Er===void 0?void 0:Er[0]),Qr=!fr&&((kr=Wr==null?void 0:Wr.providers)===null||kr===void 0?void 0:kr.find(eo=>eo.provider===ProviderEnum.Turnkey&&eo.enabledAt))&&!!(!((Br=(jr=Wr==null?void 0:Wr.sdk)===null||jr===void 0?void 0:jr.embeddedWallets)===null||Br===void 0)&&Br.emailRecoveryEnabled),{getEOAWallet:_n}=useSmartWallets(),En=qr&&_n(qr),Cn=qr&&isSessionKeyCompatibleWallet(qr)||En&&isSessionKeyCompatibleWallet(En),In=!!(Zr||Jr),An=()=>In?jsxRuntimeExports.jsxs("div",{className:"need-help-section__links",children:[Jr&&jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"link",copykey:"dyn_need_help_section.contact_support",children:jsxRuntimeExports.jsx("a",{href:Jr,rel:"noreferrer",target:"_blank",children:Gr("dyn_need_help_section.contact_support")})}),Zr&&jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"link",children:jsxRuntimeExports.jsx("a",{href:`mailto:${Zr}`,children:Zr})})]}):null,jn=()=>{if(!Qr)return null;const eo=Gr("dyn_need_help_section.help_button"),ro=In?eo:eo.slice(0,1).toUpperCase()+eo.slice(1);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[In&&jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",copykey:"dyn_need_help_section.divider",children:Gr("dyn_need_help_section.divider")}),jsxRuntimeExports.jsx(TextButton,{copykey:"dyn_need_help_section.help_button",className:classNames$1("need-help-section__helper-link"),onClick:()=>Vr(void 0,"helpSession"),children:ro})]})};return!In&&(!Qr||Cn)?null:jsxRuntimeExports.jsxs("div",{className:"need-help-section",children:[jsxRuntimeExports.jsx(Typography,{color:"secondary",variant:"body_small",copykey:"dyn_need_help_section.info",children:Gr("dyn_need_help_section.info")}),An(),jn()]})},PasskeyCompleteRecovery=()=>{const{primaryWallet:fr,environmentId:br,user:wr,setShowAuthFlow:Er,setPasskeySuccessPopup:kr}=useInternalDynamicContext(),{isTurnkeyWalletWithoutAuthenticator:jr}=useIsTurnkeyWallet(),{getEOAWallet:Br}=useSmartWallets(),{t:Wr}=useTranslation(),{mutate:qr,isLoading:Gr,error:Vr}=useMutation(()=>__awaiter$e(void 0,void 0,void 0,function*(){var Qr;const _n=(Qr=fr&&Br(fr))!==null&&Qr!==void 0?Qr:fr;if(!(yield completePasskeyRecovery({environmentId:br,user:wr,wallet:_n})))throw new DynamicError("Error completing passkey recovery");dynamicEvents.emit("passkeyRecoveryCompleted",fr),Er(!1),kr(PasskeySuccessEnum.CREATED)}),{onFailure:Qr=>{logger$6.error("Failed to init passkey recovery",Qr),dynamicEvents.emit("passkeyRecoveryFailed",Qr)}}),Zr=reactExports.useMemo(()=>{if(Vr)return Vr instanceof DynamicError?Vr.message:getProperErrorMessage(Vr)},[Vr]),Jr=jr?"dyn_passkey_secure_modal":"dyn_passkey_recovery";return jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view",children:[jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__header",children:jsxRuntimeExports.jsx(SvgPasskeyIntroIcon,{})}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-recovery-view__subtitle",children:Wr(`${Jr}.complete.description`)}),Zr&&jsxRuntimeExports.jsx(ErrorContainer,{children:Zr}),jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__actions",children:jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"brand-primary",buttonPadding:"large",dataTestId:"passkey-recovery-complete-button",onClick:()=>qr(),disabled:Gr,showInternalLoading:!1,typographyProps:{color:"inherit"},children:jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view__inline-button",children:[jsxRuntimeExports.jsx(PasskeyDeviceIcon,{size:"small"}),jsxRuntimeExports.jsx(Typography,{children:Wr(`${Jr}.complete.complete_button`)})]})})}),jsxRuntimeExports.jsx(NeedHelpSection,{isRecoveryFlow:!0})]})},PasskeyInitRecovery=({authenticatorType:fr})=>{const{setShowAuthFlow:br}=useInternalDynamicContext(),{isTurnkeyWalletWithoutAuthenticator:wr}=useIsTurnkeyWallet(),{initAuthMethod:Er,isLoading:kr,error:jr}=useInitEmbeddedWalletAuthMethod(),{createRootElement:Br}=useElementById(),Wr=Br(iframeContainerId$1),{t:qr}=useTranslation(),Gr=reactExports.useMemo(()=>{if(jr)return jr instanceof DynamicError?jr.message:"Something went wrong."},[jr]),Vr=jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignInWithEmail,{})}),Zr=wr?"dyn_passkey_secure_modal":"dyn_passkey_recovery",Jr=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>br(!1,{emitCancelAuth:!0}),"data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:Jr,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",children:qr(`${Zr}.start.title`)})}),jsxRuntimeExports.jsxs("div",{className:"passkey-recovery-view",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:Vr,isSpinning:kr,iconSize:96}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"passkey-recovery-view__subtitle",children:qr(`${Zr}.start.description`)}),Gr&&jsxRuntimeExports.jsx(ErrorContainer,{children:Gr}),jsxRuntimeExports.jsx("div",{className:"passkey-recovery-view__actions",children:jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",dataTestId:"passkey-recovery-button",onClick:()=>Er({authenticatorType:fr,iframeContainer:Wr.current}),disabled:kr,showInternalLoading:!1,children:jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Typography,{children:qr(`${Zr}.start.start_button`)})})})}),jsxRuntimeExports.jsx(NeedHelpSection,{isRecoveryFlow:!0})]})]})},RenamePasskeyView=()=>{var fr;const{passkey:br,setPasskey:wr,passkeyIcon:Er,passkeyEdited:kr,setPasskeyEdited:jr}=usePasskeyContext(),{t:Br}=useTranslation(),{environmentId:Wr,setShowAuthFlow:qr,setPasskeySuccessPopup:Gr}=useInternalDynamicContext(),[Vr,Zr]=reactExports.useState(!1),Jr=En=>__awaiter$e(void 0,void 0,void 0,function*(){if(En&&(br!=null&&br.id)){const Cn=yield updateUserPasskey({alias:En.trim(),environmentId:Wr,id:br.id});Cn?(wr(Cn),jr(!kr),qr(!1),Gr(PasskeySuccessEnum.EDITED)):Zr(!0)}else Zr(!0)}),Qr=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:()=>{qr(!1)},"data-testid":"back-button",children:jsxRuntimeExports.jsx(SvgChevronLeft,{})}),_n=jsxRuntimeExports.jsx(IconButton,{onClick:()=>qr(!1),type:"button",id:"close-button","data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})});return br?jsxRuntimeExports.jsxs("div",{className:"edit-passkeys-widget-view",children:[jsxRuntimeExports.jsx(ModalHeader,{leading:Qr,trailing:_n}),jsxRuntimeExports.jsx("div",{className:"edit-passkeys-widget-view__icon",children:Er}),jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary",className:"edit-passkeys-widget-view__title",copykey:"dyn_rename_passkeys.title",children:Br("dyn_rename_passkeys.title")}),jsxRuntimeExports.jsx(Formik,{initialValues:{alias:(fr=br.alias)!==null&&fr!==void 0?fr:""},onSubmit:En=>{Jr(En.alias)},children:({values:En})=>jsxRuntimeExports.jsxs(Form,{className:"edit-passkeys-widget-view__body",children:[jsxRuntimeExports.jsx(Field$2,{"data-testid":"input-field",name:"alias",type:"text",label:Br("dyn_rename_passkeys.input_label"),copykey:"dyn_rename_passkeys.input_label",className:"edit-passkeys-widget-view__input",as:Input,error:Vr,maxLength:32}),jsxRuntimeExports.jsx(TypographyButton,{type:"submit",className:"edit-passkeys-widget-view__body",buttonPadding:"large",disabled:!En.alias,copykey:"dyn_rename_passkeys.save",children:Br("dyn_rename_passkeys.save")}),Vr&&jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"body_small",color:"error-1",copykey:"dyn_rename_passkeys.error",children:Br("dyn_rename_passkeys.error")})]})})]}):jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary",className:"edit-passkeys-widget-view__title",children:Br("dyn_rename_passkeys.not_found")})};var _g$1,_defs$1,_excluded$5=["title","titleId"];function _extends$5(){return _extends$5=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$5(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgMultipleAccountSecurity=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$5(br,_excluded$5);return reactExports.createElement("svg",_extends$5({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_g$1||(_g$1=reactExports.createElement("g",{clipPath:"url(#multiple-account-security_svg__a)"},reactExports.createElement("circle",{cx:164,cy:114,r:114,fill:"url(#multiple-account-security_svg__b)",fillOpacity:.12}),reactExports.createElement("g",{clipPath:"url(#multiple-account-security_svg__c)"},reactExports.createElement("g",{clipPath:"url(#multiple-account-security_svg__d)"},reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M118.709 55.166a14.617 14.617 0 0 0 1.054-10.366c-2.097-7.824-10.139-12.467-17.963-10.371-7.824 2.096-12.468 10.139-10.371 17.963a14.612 14.612 0 0 0 6.097 8.451c1.808-3.916 6.565-6.42 9.647-7.247 3.083-.826 7.955-1.146 11.536 1.57Zm-19.375-8.688a5.5 5.5 0 1 1 10.625-2.848 5.5 5.5 0 0 1-10.625 2.848Z",fill:"#4779FF"}))),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.269 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.844 9.844 0 0 0-3.409-1.665 9.847 9.847 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.313.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.336 9.336 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm7.008 18.695c0-1.726-1.4-3.126-3.127-3.126h-14.069a6.253 6.253 0 0 0-6.153 5.133 6.234 6.234 0 0 1 4.589-2.007h18.76Zm1.562 3.127c3.454 0 6.253 2.8 6.253 6.253v12.506a6.253 6.253 0 0 1-6.253 6.254h-18.759a6.253 6.253 0 0 1-6.253-6.254V60.14a6.253 6.253 0 0 1 6.253-6.253h18.759Z",fill:"#4779FF"}))),_defs$1||(_defs$1=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"multiple-account-security_svg__a"},reactExports.createElement("rect",{width:327,height:112,rx:12,fill:"#fff"})),reactExports.createElement("clipPath",{id:"multiple-account-security_svg__c"},reactExports.createElement("path",{fill:"#fff",transform:"rotate(-15 184.593 -307.976)",d:"M0 0h32v32H0z"})),reactExports.createElement("clipPath",{id:"multiple-account-security_svg__d"},reactExports.createElement("rect",{x:87.633,y:38.225,width:29.333,height:29.333,rx:14.667,transform:"rotate(-15 87.633 38.225)",fill:"#fff"})),reactExports.createElement("linearGradient",{id:"multiple-account-security_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))},_g,_defs,_excluded$4=["title","titleId"];function _extends$4(){return _extends$4=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$4(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgPasskeyAccountSecurity=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$4(br,_excluded$4);return reactExports.createElement("svg",_extends$4({width:327,height:112,viewBox:"0 0 327 112",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_g||(_g=reactExports.createElement("g",{clipPath:"url(#passkey-account-security_svg__a)"},reactExports.createElement("circle",{cx:164,cy:114,r:114,fill:"url(#passkey-account-security_svg__b)",fillOpacity:.12}),reactExports.createElement("g",{clipPath:"url(#passkey-account-security_svg__c)",fill:"#4779FF"},reactExports.createElement("path",{d:"M106.009 34.681a2.666 2.666 0 0 1 3.266 1.886l-15.454 4.141a5.319 5.319 0 0 0-3.339 2.666 5.335 5.335 0 0 1 3.936-5.587l11.591-3.105ZM117.785 42.57a5.333 5.333 0 0 0-6.532-3.772l-15.455 4.141a5.333 5.333 0 0 0-3.771 6.532l2.76 10.303a5.334 5.334 0 0 0 6.533 3.771l15.454-4.14a5.333 5.333 0 0 0 3.772-6.533l-2.761-10.303Z"})),reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"m207.67 19.875-.767 2.862a9.86 9.86 0 0 0-5.861 6.61c-1.412 5.268 1.715 10.684 6.984 12.096 5.268 1.412 10.684-1.715 12.096-6.984a9.862 9.862 0 0 0-1.771-8.655l.767-2.861a5.926 5.926 0 0 0-11.448-3.068Zm9.321 2.498-.444 1.655a9.846 9.846 0 0 0-3.409-1.665 9.849 9.849 0 0 0-3.785-.262l.444-1.656a3.723 3.723 0 1 1 7.194 1.928Zm-3.445 8.52a2.57 2.57 0 0 1-2.019 1.862l-.539 2.011a1.1 1.1 0 1 1-2.127-.57l.539-2.01a2.569 2.569 0 1 1 4.146-1.294ZM164.943 32.064a6.216 6.216 0 0 0-1.779 0c-.681.098-1.313.337-1.816.527l-.135.05-16.68 6.256-.407.152c-1.922.718-3.61 1.348-4.909 2.493a9.336 9.336 0 0 0-2.553 3.683c-.616 1.62-.613 3.421-.61 5.473V66.01c0 8.793 4.783 16.125 9.953 21.51 5.204 5.422 11.159 9.252 14.307 11.089l.128.075c.574.337 1.32.775 2.307.987a6.619 6.619 0 0 0 2.609 0c.987-.212 1.733-.65 2.307-.987l.128-.075c3.148-1.837 9.103-5.667 14.307-11.088 5.17-5.386 9.953-12.718 9.953-21.511V50.698c.003-2.052.006-3.854-.611-5.473a9.333 9.333 0 0 0-2.552-3.683c-1.3-1.145-2.987-1.775-4.909-2.493l-.407-.152-16.68-6.255-.135-.05c-.503-.19-1.136-.43-1.816-.528Zm-1.34 14.592a15.89 15.89 0 0 0-7.978 2.135 1.772 1.772 0 1 0 1.776 3.069 12.34 12.34 0 0 1 6.202-1.66c6.853 0 12.408 5.556 12.408 12.409a44.34 44.34 0 0 1-1.688 12.156 1.772 1.772 0 1 0 3.41.97 47.883 47.883 0 0 0 1.823-13.126c0-8.81-7.142-15.953-15.953-15.953Zm-10.749 9.75a1.772 1.772 0 1 0-3.068-1.775 15.882 15.882 0 0 0-2.136 7.978c0 2.499-.573 4.86-1.594 6.96a1.772 1.772 0 1 0 3.189 1.55 19.43 19.43 0 0 0 1.95-8.51c0-2.263.605-4.38 1.659-6.203Zm10.749-2.66a8.863 8.863 0 0 0-8.863 8.863c0 4.516-1.29 8.704-3.518 12.246l1.5.944-1.5-.944a8.75 8.75 0 0 0-.12.196 1.773 1.773 0 1 0 3.048 1.81c.023-.04.048-.079.072-.118a26.434 26.434 0 0 0 4.063-14.134 5.318 5.318 0 0 1 10.636 0c0 1.722-.118 3.417-.344 5.077a1.772 1.772 0 1 0 3.512.48 41.12 41.12 0 0 0 .377-5.557 8.863 8.863 0 0 0-8.863-8.863Zm1.772 8.863a1.772 1.772 0 1 0-3.545 0c0 5.89-1.688 11.381-4.607 16.021a1.773 1.773 0 0 0 3.001 1.888 33.528 33.528 0 0 0 5.151-17.91Zm5.554 11.117a1.773 1.773 0 0 0-3.411-.965 37.01 37.01 0 0 1-2.523 6.502 1.771 1.771 0 1 0 3.169 1.588 40.517 40.517 0 0 0 2.765-7.124Z",fill:"#4779FF"}))),_defs||(_defs=reactExports.createElement("defs",null,reactExports.createElement("clipPath",{id:"passkey-account-security_svg__a"},reactExports.createElement("rect",{width:327,height:112,rx:12,fill:"#fff"})),reactExports.createElement("clipPath",{id:"passkey-account-security_svg__c"},reactExports.createElement("path",{fill:"#fff",transform:"rotate(-15 184.593 -307.976)",d:"M0 0h32v32H0z"})),reactExports.createElement("linearGradient",{id:"passkey-account-security_svg__b",x1:164,y1:0,x2:164,y2:93.5,gradientUnits:"userSpaceOnUse"},reactExports.createElement("stop",{stopColor:"#4779FF"}),reactExports.createElement("stop",{offset:1,stopColor:"#4779FF",stopOpacity:0})))))};const ActionCard=({titleKey:fr,descriptionKey:br,description:wr,LeadingIcon:Er,action:kr,badgeVariant:jr,badgeKey:Br,isLoading:Wr,dataTestId:qr})=>{const{t:Gr}=useTranslation();return jsxRuntimeExports.jsxs("button",{className:"action-card",onClick:kr,"data-testid":qr,children:[jsxRuntimeExports.jsx(Icon,{className:"action-card__icon",children:Er}),jsxRuntimeExports.jsxs("div",{className:"action-card__content",children:[jsxRuntimeExports.jsxs("div",{className:"action-card__content__row",children:[jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"medium",copykey:fr,children:Gr(fr)}),jsxRuntimeExports.jsx(Badge,{text:Gr(Br),className:classNames$1("action-card__content__row__badge",{"action-card__content__row__badge--primary":jr==="primary"},{"action-card__content__row__badge--secondary":jr==="secondary"}),copykey:Br})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",copykey:br,children:wr})]}),jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",className:"action-card__action-icon",children:Wr?jsxRuntimeExports.jsx(Spinner$2,{}):jsxRuntimeExports.jsx(SvgChevronLeft,{})})]})},EmbeddedAuthChoiceCards=({currentAction:fr,supportedAuthenticators:br})=>{var wr,Er;const[kr,jr]=reactExports.useState(),{projectSettings:Br}=useInternalDynamicContext(),{t:Wr}=useTranslation(),{initAuthMethod:qr,isLoading:Gr}=useInitEmbeddedWalletAuthMethod(),{createRootElement:Vr}=useElementById(),Zr=Vr(iframeContainerId$1),Jr={email:{badgeKey:"dyn_embedded_authenticator.email.badge",description:Wr("dyn_embedded_authenticator.email.description",{expiration:(Er=(wr=Br==null?void 0:Br.sdk.embeddedWallets)===null||wr===void 0?void 0:wr.sessionKeyDuration)===null||Er===void 0?void 0:Er.amount}),descriptionKey:"dyn_embedded_authenticator.email.description",icon:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",size:"small",children:jsxRuntimeExports.jsx(SvgMail,{})},"one-time-code-icon"),titleKey:"dyn_embedded_authenticator.email.title"},passkey:{badgeKey:"dyn_embedded_authenticator.passkey.badge",description:Wr("dyn_embedded_authenticator.passkey.description"),descriptionKey:"dyn_embedded_authenticator.passkey.description",icon:jsxRuntimeExports.jsx(PasskeyDeviceIcon,{defaultIcon:jsxRuntimeExports.jsx(SvgAndroidTouchId,{"data-testid":"default-icon"})}),titleKey:fr==="reveal"?"dyn_embedded_authenticator.passkey.reveal_title":"dyn_embedded_authenticator.passkey.title"}},Qr=_n=>()=>__awaiter$e(void 0,void 0,void 0,function*(){jr(_n),yield qr({authenticatorType:_n,currentAction:fr,iframeContainer:Zr.current})});return jsxRuntimeExports.jsx("div",{className:"embedded-auth-choice-cards",children:br&&br.map(_n=>jsxRuntimeExports.jsx(ActionCard,{LeadingIcon:Jr[_n].icon,action:Qr(_n),badgeKey:Jr[_n].badgeKey,badgeVariant:_n==="passkey"?"primary":"secondary",descriptionKey:Jr[_n].descriptionKey,description:Jr[_n].description,titleKey:Jr[_n].titleKey,isLoading:Gr&&_n===kr,dataTestId:`embedded-auth-choice__item-${_n}`},_n))})},titleDescriptionMap={helpSession:{description:"dyn_embedded_authenticator.need_help_description",title:"dyn_embedded_authenticator.need_help_title"},reveal:{description:"dyn_embedded_authenticator.reveal_description",title:"dyn_embedded_authenticator.reveal_title"},sendTransaction:{description:"dyn_embedded_authenticator.description",title:"dyn_embedded_authenticator.title"},signMessage:{description:"dyn_embedded_authenticator.description",title:"dyn_embedded_authenticator.title"},signTransaction:{description:"dyn_embedded_authenticator.description",title:"dyn_embedded_authenticator.title"}},EmbeddedAuthChoice=({currentAction:fr})=>{var br;const{t:wr}=useTranslation(),{primaryWallet:Er,projectSettings:kr,setShowAuthFlow:jr}=useInternalDynamicContext(),{getEOAWallet:Br}=useSmartWallets(),Wr=(br=Er&&Br(Er))!==null&&br!==void 0?br:Er,{initPasskeyRecoveryProcess:qr}=usePasskeyRecovery(),{isTurnkeyWallet:Gr}=useIsTurnkeyWallet(),Vr=reactExports.useMemo(()=>{var Cn;const In=getEnabledEmbeddedWalletsAuthenticators((Cn=kr==null?void 0:kr.sdk.embeddedWallets)===null||Cn===void 0?void 0:Cn.supportedSecurityMethods),An=Object.keys(In);return!fr||!["helpSession","reveal"].includes(fr)?An.filter(jn=>jn!=="email"):An},[kr==null?void 0:kr.sdk.embeddedWallets]),Zr=()=>!Wr||!Gr?!1:Wr.connector.getAuthenticatorHandler().isSessionActive(),Jr=()=>Vr.length>1?jsxRuntimeExports.jsx(SvgMultipleAccountSecurity,{}):jsxRuntimeExports.jsx(SvgPasskeyAccountSecurity,{}),Qr=Zr()?"dyn_embedded_authenticator.passkey.auth_info.start_button":"dyn_embedded_authenticator.passkey.auth_info.add_button",{title:_n,description:En}=titleDescriptionMap[fr||"signMessage"];return Vr!=null&&Vr.length?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:_n,children:wr(_n)})}),jsxRuntimeExports.jsxs("div",{className:"embedded-auth-choice",children:[jsxRuntimeExports.jsx("div",{className:"embedded-auth-choice__header",children:Jr()}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"embedded-auth-choice__subtitle",copykey:En,children:wr(En)}),Vr.length>1?jsxRuntimeExports.jsx(EmbeddedAuthChoiceCards,{currentAction:fr,supportedAuthenticators:Vr}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(AuthChoiceInfo,{choice:"passkey"}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"passkey-only-choice-button",buttonVariant:"brand-primary",color:"brand-primary",expanded:!0,onClick:()=>qr("passkey"),copykey:Qr,typographyProps:{color:"inherit"},children:wr(Qr)})]}),fr!=="reveal"&&jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"primary",buttonClassName:"embedded-auth-choice__skip-button",expanded:!0,onClick:()=>jr(!1),copykey:"dyn_embedded_authenticator.skip",children:wr("dyn_embedded_authenticator.skip")})]})]}):null},PendingSignatureView=()=>{const[fr,br]=reactExports.useState(!1),{selectedWalletConnector:wr}=useInternalDynamicContext(),{signAlreadyConnectedUser:Er}=useConnectAndSignSplitSteps(),{t:kr}=useTranslation(),jr=96,Br=isHardwareWalletEnabled(wr);if(!wr)return null;const Wr=()=>__awaiter$e(void 0,void 0,void 0,function*(){try{br(!0),yield Er({walletConnector:wr})}catch(Vr){logger$6.error(Vr)}finally{br(!1)}}),qr=jsxRuntimeExports.jsx(WalletIcon,{walletKey:wr.key,style:{height:pixelToRem(jr*iconRatio),width:pixelToRem(jr*iconRatio)}}),Gr=kr(Br?"dyn_pending_signature.phantom_ledger_sign":"dyn_pending_signature.regular_sign_description");return jsxRuntimeExports.jsxs("div",{className:"pending-signature__container","data-testid":"pending-signature-view",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:qr,iconSize:jr,isSpinning:!0,indicator:"connected",className:"pending-signature__icon-with-spinner"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",className:classNames$1("pending-signature__copy"),copykey:Br?"dyn_pending_signature.phantom_ledger_sign":"dyn_pending_signature.regular_sign_description",children:Gr}),Br&&jsxRuntimeExports.jsxs(Typography,{variant:"body_small",weight:"regular",className:classNames$1("pending-signature__copy","pending-signature__copy--mini"),copykey:"dyn_pending_signature.phantom_ledger_warning",children:[jsxRuntimeExports.jsx("strong",{children:kr("dyn_pending_signature.note")}),kr("dyn_pending_signature.phantom_ledger_warning")]}),requiresTwoStepAuthentication(wr)&&jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"pending-signature__button",onClick:Wr,loading:fr,buttonVariant:"primary",buttonPadding:"large",expanded:!0,typographyProps:{variant:"button_primary",weight:"medium"},copykey:"dyn_pending_signature.click_to_sign",children:kr("dyn_pending_signature.click_to_sign")})]})},QrCodeView=()=>{var fr;const{theme:{theme:br}}=useThemeContext(),{name:wr}=br,{qrcodeUri:Er,desktopUri:kr,selectedWalletConnector:jr}=useInternalDynamicContext(),{walletBook:Br}=useWalletBookContext();if(!jr)return null;const Wr=jsxRuntimeExports.jsx(WalletIcon,{walletKey:jr.key,style:{height:pixelToRem(32),width:pixelToRem(32)}});return jsxRuntimeExports.jsx(QrCodeWrapper,{uri:Er,desktopUri:kr,accentColor:wr==="dark"?br.colors.textPrimary:(fr=getWalletPrimaryColor(Br,jr.key))!==null&&fr!==void 0?fr:"",icon:Wr,showCopyToClipboardButton:jr.isWalletConnect,walletConnector:jr})},PendingConnectView=()=>{const{selectedWalletConnector:fr}=useInternalDynamicContext(),{t:br}=useTranslation(),wr=94,Er=jsxRuntimeExports.jsx(WalletIcon,{walletKey:fr==null?void 0:fr.key,style:{height:pixelToRem(wr*iconRatio),width:pixelToRem(wr*iconRatio)}});return jsxRuntimeExports.jsxs("div",{className:"pending-connect__container",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:Er,iconSize:wr,isSpinning:!0,className:"pending-connect__icon-with-spinner"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",className:"pending-connect__copy-text",copykey:isMobile()?"dyn_pending_connection.mobile":"dyn_pending_connection.computer",children:isMobile()?br("dyn_pending_connection.mobile"):br("dyn_pending_connection.computer")})]})},SandboxMaximumThresholdReached=()=>{const{t:fr}=useTranslation(),{goToInitialView:br}=useViewContext(),wr=()=>{br()};return jsxRuntimeExports.jsxs("div",{className:"sandbox-threshold__main",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"sandbox-threshold__title",children:fr("dyn_sandbox_maximum_threshold.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",className:"sandbox-threshold__description",children:fr("dyn_sandbox_maximum_threshold.description")}),jsxRuntimeExports.jsx(TypographyButton,{onClick:wr,className:"sandbox-threshold__button",expanded:!0,buttonPadding:"large",children:fr("dyn_sandbox_maximum_threshold.button")})]})},Toggle=fr=>{var{icon:br,variant:wr="primary",className:Er}=fr,kr=__rest$9(fr,["icon","variant","className"]);return jsxRuntimeExports.jsxs("label",{className:classNames$1("toggle",Er),children:[jsxRuntimeExports.jsx("input",Object.assign({type:"checkbox",className:"toggle--input"},kr)),jsxRuntimeExports.jsx("div",{className:classNames$1("toggle--content",`toggle--content__variant-${wr}`),children:jsxRuntimeExports.jsx("div",{className:"toggle--knob",children:br})})]})},HardwareWalletToggle=({connectors:fr,label:br,copykey:wr})=>{const Er=jsxRuntimeExports.jsx(Toggle,{defaultChecked:fr.some(kr=>kr.isHardwareWalletEnabled),onChange:kr=>{fr.forEach(jr=>{jr.isHardwareWalletEnabled=kr.target.checked})},"data-testid":"hardware-wallet-toggle",icon:jsxRuntimeExports.jsx(Icon,{size:"small",children:jsxRuntimeExports.jsx(SvgCheck,{})})});return jsxRuntimeExports.jsx(ListTile,{trailing:Er,children:jsxRuntimeExports.jsx("span",{copykey:wr,children:br})})},SelectHardwareWalletView=({wallet:fr,onSelectWallet:br})=>{const{t:wr}=useTranslation();return jsxRuntimeExports.jsx("div",{className:"select-hardware-wallet-view",children:jsxRuntimeExports.jsxs("div",{className:"select-hardware-wallet-view__container",children:[jsxRuntimeExports.jsx(Icon,{className:"select-hardware-wallet-view__icon",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:fr.key})}),jsxRuntimeExports.jsx(Typography,{className:"select-hardware-wallet-view__text",as:"p",color:"secondary",variant:"body_normal",copykey:"dyn_select_hardware_wallet.description",children:wr("dyn_select_hardware_wallet.description")}),isHardwareWalletConnector(fr.walletConnector)&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(HardwareWalletToggle,{connectors:[fr.walletConnector],copykey:"dyn_select_chain.using_hardware_wallet_toggle_label",label:wr("dyn_select_chain.using_hardware_wallet_toggle_label")}),jsxRuntimeExports.jsx(Divider,{})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"primary",onClick:()=>br==null?void 0:br(fr),copykey:"dyn_select_hardware_wallet.button",dataTestId:"select-hardware-wallet-connect-button",children:wr("dyn_select_hardware_wallet.button")})]})})},WalletGroupViewLayout=({icon:fr,title:br,titleCopyKey:wr,children:Er})=>jsxRuntimeExports.jsxs("div",{className:"wallet-group-view-layout__container",children:[jsxRuntimeExports.jsx(IconWithSpinner,{className:"wallet-group-view-layout__icon",Icon:fr,iconSize:96}),jsxRuntimeExports.jsxs("div",{className:"wallet-group-view-layout__body",children:[jsxRuntimeExports.jsx(Typography,{className:"wallet-group-view-layout__title",as:"p",color:"secondary",variant:"body_normal",copykey:wr,children:br}),jsxRuntimeExports.jsx("div",{className:"wallet-group-view-layout__list",children:Er})]})]}),WalletGroupItem$1=({groupKey:fr,wallet:br,onClick:wr})=>{const{recommendedWallets:Er}=useInternalDynamicContext(),{walletBook:kr}=useWalletBookContext(),jr=findWalletGroupOverride(kr,fr,br.key),Br=findWalletBookWallet(kr,br.key),Wr=(jr==null?void 0:jr.brand)||(Br==null?void 0:Br.brand),qr=(jr==null?void 0:jr.name)||(Br==null?void 0:Br.name),Gr=Wr?jsxRuntimeExports.jsx(BrandIcon,{brand:Wr,walletKey:br.key,style:{height:pixelToRem(28),width:pixelToRem(28)}}):null,Vr=getWalletListItemLabel({recommendedWallets:Er,wallet:br}),Zr=jsxRuntimeExports.jsx(ListTileAnimatedTrailing,{hoverElement:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",size:"mini",children:jsxRuntimeExports.jsx(SvgStroke,{})}),children:Vr&&jsxRuntimeExports.jsx(Badge,{dot:!Vr.isRecommended,variant:Vr.isRecommended?"primary":"secondary",text:jsxRuntimeExports.jsx(Typography,{variant:"body_small",children:Vr.label})})});return jsxRuntimeExports.jsx(ListTile,{onClick:wr,leading:Gr,trailing:Zr,children:qr})},SelectWalletInWalletGroupView=()=>{const{selectedWalletGroup:fr}=useWalletGroupContext(),{walletBook:br}=useWalletBookContext(),{handleWalletItemClick:wr}=useWalletItemActions(),{t:Er}=useTranslation();if(!fr)throw new Error("Could not access WalletGroup view without selected group");const kr=getWalletGroup(br,fr==null?void 0:fr.key);return jsxRuntimeExports.jsx(WalletGroupViewLayout,{icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:kr.key}),title:Er("dyn_select_wallet.description",{walletName:kr.name}),titleCopyKey:"dyn_select_wallet.description",children:fr.groupedWallets.map((jr,Br)=>jsxRuntimeExports.jsx(WalletGroupItem$1,{groupKey:fr.key,wallet:jr,onClick:()=>wr(jr)},`${jr.key}_${Br}`))})};var _path$3,_excluded$3=["title","titleId"];function _extends$3(){return _extends$3=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$3(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgSignInWithPhone=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$3(br,_excluded$3);return reactExports.createElement("svg",_extends$3({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$3||(_path$3=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32 64c17.673 0 32-14.327 32-32C64 14.327 49.673 0 32 0 14.327 0 0 14.327 0 32c0 17.673 14.327 32 32 32Zm-7.91-50h14.892a4.092 4.092 0 0 1 4.09 4.09v27.82a4.092 4.092 0 0 1-4.09 4.09H24.09A4.092 4.092 0 0 1 20 45.91V18.09A4.092 4.092 0 0 1 24.09 14Zm4.992 31.91a2.451 2.451 0 0 0 2.454 2.454 2.451 2.451 0 0 0 2.455-2.455 2.451 2.451 0 0 0-2.455-2.454 2.451 2.451 0 0 0-2.454 2.454Zm-5.81-4.092H39.8V18.91H23.273v22.91Z",fill:"#4779FF"})))};const PhoneIcon=fr=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignInWithPhone,Object.assign({},fr,{"data-testid":"sign-in-with-sms-icon"}))}),useSmsVerification=fr=>{const{verificationUUID:br,displayedDestination:wr,retryData:Er}=useVerification(),{environmentId:kr,user:jr,userWithMissingInfo:Br}=useInternalDynamicContext(),[Wr,qr]=reactExports.useState(),{verifyOtp:Gr}=useOtpVerificationRequest(),{generateSessionKey:Vr,shouldRegisterSessionKeysOnSignin:Zr}=useEmbeddedWalletSessionKeys(kr),{initAuth:Jr,completeAuth:Qr,cancelAuth:_n}=useUserAuth({authMethod:"sms"}),En=reactExports.useRef(!1);useOnUnmount(()=>{const ro=Er??{dialCode:"",iso2:"",phone:""};Er||logger$6.warn("WARNING: emitted smsVerificationResult with incomplete params because retryData was undefined"),dynamicEvents.emit("smsVerificationResult",En.current,ro),En.current||dynamicEvents.emit("authFailure",{option:ro,phone:ro,type:"sms"},"user-cancelled")});const Cn=()=>__awaiter$e(void 0,void 0,void 0,function*(){if(qr(void 0),!br||!Er){yield _n();return}retrySmsVerification({environmentId:kr,isoCountryCode:Er.iso2,phoneCountryCode:Er.dialCode,phoneNumber:de$3({dialCode:Er.dialCode,phone:Er.phone}),verificationUUID:br})}),In=reactExports.useCallback(ro=>__awaiter$e(void 0,void 0,void 0,function*(){if(!br||!jr&&!Br){yield _n();return}yield Qr({onValidUpdatedJwt:()=>En.current=!0,updateJwtFunction:()=>__awaiter$e(void 0,void 0,void 0,function*(){return Gr(ro,"sms",br)})})}),[_n,Qr,jr,Br,br,Gr]),An=reactExports.useCallback(ro=>__awaiter$e(void 0,void 0,void 0,function*(){if(!br){yield _n();return}yield Jr({onError:to=>qr(to),onVerifySuccess:()=>{En.current=!0},options:{phone:Er},showSuccessMessage:!0,verifyFunction:()=>__awaiter$e(void 0,void 0,void 0,function*(){let to;return Zr()&&(to=(yield Vr()).publicKey),signInWithSmsVerification({environmentId:kr,sessionPublicKey:to,verificationToken:ro,verificationUUID:br})})})}),[br,Jr,Er,_n,kr]),{isLoading:jn,mutate:eo}=useMutation(fr==="login"?An:In,{onFailure:ro=>{qr(ro)}});return{error:Wr,formattedPhone:wr??"",isLoading:jn,isValid:En.current,onSubmit:eo,retryOneTimePassword:Cn,setError:qr}},SmsVerification=()=>{const{view:fr}=useViewContext(),{handleLogOut:br}=useInternalDynamicContext(),{t:wr}=useTranslation(),Er=fr.type==="login-with-sms-verification",{error:kr,formattedPhone:jr,isLoading:Br,isValid:Wr,onSubmit:qr,retryOneTimePassword:Gr,setError:Vr}=useSmsVerification(Er?"login":"verify-only"),Zr=Er?void 0:jsxRuntimeExports.jsx(TextButton,{className:"sms-verification__log-out",onClick:br,copykey:"dyn_otp_verification.log_out_button",children:wr("dyn_otp_verification.log_out_button")});return jsxRuntimeExports.jsx(OTPVerificationView,{MainIcon:PhoneIcon,displayedDestination:jr,error:kr,hideHeader:!0,isLoading:Br,onPinComplete:qr,isValid:Wr,retryHandler:Gr,onPinChange:()=>Vr(void 0),appendToEnd:Zr})},SocialRedirectView=()=>{const{socialProvider:fr,signInProvider:br}=useSocialRedirectContext(),wr=useFindSocialIcon(),{t:Er}=useTranslation();return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:classNames$1("social-redirect-view__container"),children:[fr&&jsxRuntimeExports.jsx(IconWithSpinner,{iconSize:64,Icon:wr(fr),isSpinning:!0}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",className:classNames$1("social-redirect-view__title"),copykey:"dyn_social_redirect.logging_in",children:Er("dyn_social_redirect.logging_in")})]}),br!==SignInProviderEnum.MagicLink&&jsxRuntimeExports.jsx(DynamicFooter,{})]})},SocialWrongAccountView=()=>{const[fr,br]=reactExports.useState(!1),{socialWalletConnector:wr,socialAccount:Er}=useSocialRedirectContext(),{t:kr}=useTranslation(),jr=useFindSocialIcon();return!Er||!wr?null:jsxRuntimeExports.jsxs("div",{className:classNames$1("social-wrong-account-view__container"),children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:jr(Er.oauthProvider),isSpinning:fr,iconSize:64}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",className:classNames$1("social-wrong-account-view__title"),copykey:"dyn_login.wrong_social_account.title",children:kr("dyn_login.wrong_social_account.title")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",className:classNames$1("social-wrong-account-view__copy"),copykey:"dyn_login.wrong_social_account.subtitle",children:kr("dyn_login.wrong_social_account.subtitle")}),jsxRuntimeExports.jsxs(Typography,{variant:"body_normal",weight:"regular",className:classNames$1("social-wrong-account-view__copy"),copykey:"dyn_login.wrong_social_account.retry_title",children:[kr("dyn_login.wrong_social_account.retry_title"),jsxRuntimeExports.jsx("b",{children:Er.oauthUsername})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"social-wrong-account-view__button",buttonVariant:"primary",buttonPadding:"large",expanded:!0,typographyProps:{variant:"button_primary",weight:"medium"},disabled:fr,onClick:()=>{br(!0),wr.connect(Er.oauthProvider)},copykey:"dyn_login.wrong_social_account.retry_button",children:kr("dyn_login.wrong_social_account.retry_button")})]})},WalletCannotBeTransferredView=()=>{const{goToInitialView:fr}=useViewContext(),{selectedWalletConnector:br}=useInternalDynamicContext(),{t:wr}=useTranslation(),{data:Er}=usePromise(()=>__awaiter$e(void 0,void 0,void 0,function*(){const kr=yield br==null?void 0:br.getConnectedAccounts();return shortenWalletAddress(kr==null?void 0:kr[0])}),{deps:[br]});return jsxRuntimeExports.jsxs("div",{className:"wallet-cannot-be-transferred-view__container",children:[jsxRuntimeExports.jsx(Typography,{className:"wallet-cannot-be-transferred-view__title",as:"h6",variant:"title",color:"primary",weight:"medium",copykey:"dyn_wallet_link.cannot_link.title",children:wr("dyn_wallet_link.cannot_link.title")}),jsxRuntimeExports.jsx("div",{className:"wallet-cannot-be-transferred-view__icon",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:br==null?void 0:br.key,width:64,height:64})}),jsxRuntimeExports.jsx(Typography,{className:"wallet-cannot-be-transferred-view__shorten-wallet-address",variant:"body_normal",weight:"regular",color:"primary",children:Er}),jsxRuntimeExports.jsx(Typography,{className:"wallet-cannot-be-transferred-view__copy",variant:"body_normal",color:"secondary",weight:"regular",copykey:"dyn_wallet_link.cannot_link.description",children:wr("dyn_wallet_link.cannot_link.description")}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"wallet-cannot-be-transferred-view__transfer-alt-wallet-button",buttonVariant:"primary",expanded:!0,buttonPadding:"large",onClick:fr,dataTestId:"wallet-cannot-be-transferred-view-transfer-alt-wallet",copykey:"dyn_wallet_link.cannot_link.link_other_button",children:wr("dyn_wallet_link.cannot_link.link_other_button")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"wallet-cannot-be-transferred-view-cancel",buttonPadding:"small",buttonClassName:"wallet-cannot-be-transferred-view__cancel",onClick:fr,copykey:"dyn_wallet_link.cannot_link.cancel_button",children:wr("dyn_wallet_link.cannot_link.cancel_button")})]})},WalletGroupItem=({wallet:fr,onClick:br})=>{const[wr]=fr.walletConnector.supportedChains,{walletBook:Er}=useWalletBookContext(),kr=getChainInfoWithOverrides(wr),jr=fr.group?findWalletGroupOverride(Er,fr.group,fr.key):void 0,Br=getWalletListItemLabel({wallet:fr}),Wr=jsxRuntimeExports.jsx(ListTileAnimatedTrailing,{hoverElement:jsxRuntimeExports.jsx(Icon,{color:"text-tertiary",size:"mini",children:jsxRuntimeExports.jsx(SvgStroke,{})}),children:Br&&jsxRuntimeExports.jsx(Badge,{dot:!Br.isRecommended,variant:Br.isRecommended?"primary":"secondary",text:jsxRuntimeExports.jsx(Typography,{variant:"body_small",children:Br.label})})}),qr=reactExports.useMemo(()=>{const Vr={height:pixelToRem(28),width:pixelToRem(28)};if(jr!=null&&jr.brand)return jsxRuntimeExports.jsx(BrandIcon,{brand:jr.brand,walletKey:fr.key,style:Vr});const Zr=getChainIcon(wr);return jsxRuntimeExports.jsx(Zr,{style:Vr})},[wr,fr.key,jr]),Gr=(jr==null?void 0:jr.name)||(kr==null?void 0:kr.displayName)||fr.name;return jsxRuntimeExports.jsx(ListTile,{className:"chain-card",onClick:br,leading:qr,trailing:Wr,children:Gr},fr.key)},WalletGroupView=()=>{const{selectedWalletGroup:fr}=useWalletGroupContext(),{walletBook:br}=useWalletBookContext(),{handleWalletItemClick:wr}=useWalletItemActions(),{t:Er}=useTranslation();if(!fr)throw new Error("Could not access WalletGroup view without selected group");const kr=getWalletGroup(br,fr==null?void 0:fr.key),jr=fr.groupedWallets.map(({walletConnector:Br})=>Br).filter(Br=>isHardwareWalletConnector(Br)&&Br.canConnectWithHardwareWallet());return jsxRuntimeExports.jsx(WalletGroupViewLayout,{icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:kr.key}),title:Er("dyn_select_chain.description"),titleCopyKey:"dyn_select_chain.description",children:jsxRuntimeExports.jsxs("div",{className:"wallet-group__list",children:[!!jr.length&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(HardwareWalletToggle,{connectors:jr,copykey:"dyn_select_chain.using_hardware_wallet_toggle_label",label:Er("dyn_select_chain.using_hardware_wallet_toggle_label")}),jsxRuntimeExports.jsx(Divider,{})]}),jsxRuntimeExports.jsx("div",{className:"wallet-group-view-layout__list",children:fr.groupedWallets.map((Br,Wr)=>jsxRuntimeExports.jsx(WalletGroupItem,{wallet:Br,onClick:()=>wr(Br)},`${Br.key}_${Wr}`))})]})})},iconSize=64,WalletLockedView=()=>{const{handleLogOut:fr,primaryWallet:br,setShowAuthFlow:wr,appName:Er}=useInternalDynamicContext(),{t:kr}=useTranslation();if(!br)return null;const jr=()=>__awaiter$e(void 0,void 0,void 0,function*(){try{yield br.connector.connect(),wr(!1)}catch{logger$6.info("could not connect wallet")}}),Br=jsxRuntimeExports.jsx(WalletIcon,{walletKey:br.connector.key,style:{height:pixelToRem(iconSize*iconRatio),width:pixelToRem(iconSize*iconRatio)}});return jsxRuntimeExports.jsxs("div",{"data-testid":"wallet-locked-view",children:[jsxRuntimeExports.jsx(ErrorContainer,{withIcon:!1,variant:"success",className:"wallet-locked-view__error-container",copykey:"dyn_wallet_locked.connect_continue",children:kr("dyn_wallet_locked.connect_continue")}),jsxRuntimeExports.jsxs("div",{className:"wallet-locked-view__content",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:Br,iconSize,className:"wallet-locked-view__icon",isSpinning:!0}),jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",weight:"medium",className:"wallet-locked-view__title",copykey:"dyn_wallet_locked.title",children:kr("dyn_wallet_locked.title")}),jsxRuntimeExports.jsxs(Typography,{variant:"body_normal",color:"secondary",weight:"regular",copykey:"dyn_wallet_locked.subtitle",children:[kr("dyn_wallet_locked.subtitle"),Er,"."]}),jsxRuntimeExports.jsx(TypographyButton,{onClick:()=>jr(),buttonClassName:"wallet-locked-view__button",copykey:"dyn_wallet_locked.connect",children:kr("dyn_wallet_locked.connect")}),jsxRuntimeExports.jsx(Divider,{text:"Or"}),jsxRuntimeExports.jsx(TextButton,{className:"wallet-locked-view__log-out",onClick:fr,copykey:"dyn_wallet_locked.logout",children:kr("dyn_wallet_locked.logout")})]})]})},WalletRedirectView=()=>{const{t:fr}=useTranslation(),{selectedWalletConnector:br}=useInternalDynamicContext();return jsxRuntimeExports.jsxs("div",{className:classNames$1("wallet-redirect-view__container"),children:[br&&jsxRuntimeExports.jsx(IconWithSpinner,{iconSize:64,Icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:br.key}),isSpinning:!0}),jsxRuntimeExports.jsx(Typography,{weight:"medium",variant:"title",className:classNames$1("wallet-redirect-view__title"),copykey:"dyn_wallet_redirect.loading",children:fr("dyn_wallet_redirect.loading")}),jsxRuntimeExports.jsx(PoweredByDynamic,{classNameRoot:"powered-by-dynamic"})]})},WalletSignSpinnerView=()=>{const{goToInitialView:fr}=useViewContext(),{t:br}=useTranslation(),{setMultiWalletWidgetState:wr,setSelectedWalletConnectorKey:Er,selectedWalletConnector:kr}=useInternalDynamicContext();if(!kr)return null;const{key:jr}=kr,Br=96,Wr=()=>__awaiter$e(void 0,void 0,void 0,function*(){fr(),wr("idle"),Er(null),yield kr==null?void 0:kr.endSession()}),qr=jsxRuntimeExports.jsx(WalletIcon,{walletKey:jr,style:{height:pixelToRem(Br*iconRatio),width:pixelToRem(Br*iconRatio)}});return jsxRuntimeExports.jsxs("div",{className:"wallet-sign-spinner__container","data-testid":"wallet-sign-spinner-view",children:[jsxRuntimeExports.jsx(IconWithSpinner,{Icon:qr,iconSize:Br,isSpinning:!0}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",className:classNames$1("wallet-sign-spinner__copy"),copykey:"dyn_wallet_transfer.sign.spinner.confirm_transfer",children:br("dyn_wallet_transfer.sign.spinner.confirm_transfer")}),jsxRuntimeExports.jsx(TypographyButton,{expanded:!0,buttonPadding:"large",buttonVariant:"primary",buttonClassName:"wallet-sign-spinner__button",onClick:()=>Wr(),typographyProps:{variant:"button_primary",weight:"medium"},copykey:"dyn_wallet_transfer.sign.spinner.cancel",children:br("dyn_wallet_transfer.sign.spinner.cancel")})]})},useTransferWallet=()=>{const{displaySiweStatement:fr,environmentId:br,user:wr,primaryWallet:Er,setPrimaryWalletId:kr}=useInternalDynamicContext(),{addedWalletsIds:jr}=useInternalUserWallets(),Br=reactExports.useCallback((Wr,qr)=>{const Gr=Wr.key;if(qr.lastVerifiedCredentialId){if(!Er){kr(qr.lastVerifiedCredentialId);return}const Vr=Er.connector.key;Gr===Vr&&kr(qr.lastVerifiedCredentialId),Er.connector.connectedChain==="FLOW"&&Wr.connectedChain==="FLOW"&&kr(qr.lastVerifiedCredentialId)}},[Er,kr]);return reactExports.useCallback(Wr=>__awaiter$e(void 0,void 0,void 0,function*(){if(!wr)throw new DynamicError(USER_NOT_LOGGED_IN);const{overrideSiweStatement:qr,walletConnector:Gr}=Wr,Vr="nonce"in Wr?Object.assign(Object.assign({},Wr),{displaySiweStatement:fr,environmentId:br,siweStatement:qr,walletProvider:getWalletProvider(Gr)}):Object.assign(Object.assign({},Wr),{displaySiweStatement:fr,environmentId:br,nonce:"",siweStatement:Wr.overrideSiweStatement,walletProvider:getWalletProvider(Gr)}),Zr=yield getVerifyArgs(Vr),Jr=yield transferWallet(br,Zr);if(!Jr)throw new DynamicError("Error transferring wallet.");Br(Gr,Jr);const Qr=Jr.lastVerifiedCredentialId;Qr&&jr.current.push(Qr)}),[jr,fr,br,Br,wr])},WalletUsedView=()=>{const[fr,br]=reactExports.useState(!1),{t:wr}=useTranslation(),{setErrorMessage:Er}=useErrorContext(),{loading:kr,setLoading:jr}=useLoadingContext(),{setView:Br,goToInitialView:Wr}=useViewContext(),{setShowAuthFlow:qr,appName:Gr,siweStatement:Vr,setMultiWalletWidgetState:Zr,connectWallet:Jr,selectedWalletConnector:Qr,isSingleWalletAccount:_n,consumeNonce:En,handleLogOut:Cn}=useInternalDynamicContext(),{data:In}=usePromise(()=>__awaiter$e(void 0,void 0,void 0,function*(){const ro=yield Qr==null?void 0:Qr.getConnectedAccounts();return ro==null?void 0:ro[0]}),{deps:[Qr]}),An=shortenWalletAddress(In),jn=useTransferWallet(),eo=()=>__awaiter$e(void 0,void 0,void 0,function*(){if(!Qr)return;const ro=En();if(!ro){Wr(),Er("missing-nonce");return}Zr("awaiting_signature",void 0,"transferring_wallet"),jr(!0),Br("wallet-sign");const to=getSiweStatement({appName:Gr,siweStatement:Vr});try{const _i=yield Jr(Qr);if(!(_i!=null&&_i.address))return;Qr.key==="phantom"&&isMobile()&&StorageService.setItem(PHANTOM_SIGNATURE_STATE,{loseOriginalAccountOnTransfer:fr,submittedAtTimestamp:new Date().toString(),verificationType:"awaiting_transfer"}),yield jn({nonce:ro,overrideSiweStatement:to,publicWalletAddress:_i.address,skipEmptyAccountCheck:fr,walletConnector:Qr}),qr(!1)}catch(_i){logger$6.error(_i),qr(!1,{emitCancelAuth:!0})}finally{jr(!1),Zr("idle")}});return jsxRuntimeExports.jsxs("div",{className:"wallet-used-view__container",children:[jsxRuntimeExports.jsx("div",{className:"wallet-used-view__icon",children:jsxRuntimeExports.jsx(WalletIcon,{walletKey:Qr==null?void 0:Qr.key,width:64,height:64})}),jsxRuntimeExports.jsx(Typography,{className:"wallet-used-view__shorten-wallet-address",variant:"body_normal",weight:"medium",color:"primary",children:An}),jsxRuntimeExports.jsx(Typography,{className:"wallet-used-view__copy",variant:"body_normal",color:"secondary",weight:"regular",copykey:"dyn_wallet_link.existent_account.warning",children:wr("dyn_wallet_link.existent_account.warning")}),_n&&jsxRuntimeExports.jsxs("label",{htmlFor:"skipEmptyAccountCheck",className:"wallet-used-view__checkbox-label",children:[jsxRuntimeExports.jsx(Checkbox,{id:"skipEmptyAccountCheck",className:"wallet-used-view__checkbox-container",defaultChecked:fr,onChange:()=>br(!fr),ariaLabel:"skip empty account check"}),jsxRuntimeExports.jsx(Typography,{variant:"body_small",color:"secondary",copykey:"dyn_wallet_link.existent_account.acceptance",children:wr("dyn_wallet_link.existent_account.acceptance")})]}),jsxRuntimeExports.jsx(TypographyButton,{buttonClassName:"wallet-used-view__accept-button",buttonVariant:"primary",expanded:!0,buttonPadding:"large",onClick:()=>eo(),disabled:!fr&&_n||kr,dataTestId:"wallet-used-view-transfer-wallet",copykey:"dyn_wallet_link.confirm_button",children:wr("dyn_wallet_link.confirm_button")}),jsxRuntimeExports.jsx(TypographyButton,{dataTestId:"wallet-used-view-log-out",buttonPadding:"small",buttonClassName:"wallet-used-view__logout",onClick:Cn,copykey:"dyn_wallet_link.log_out_button",children:wr("dyn_wallet_link.log_out_button")})]})};var _path$2,_excluded$2=["title","titleId"];function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$2(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgDomain=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$2(br,_excluded$2);return reactExports.createElement("svg",_extends$2({width:65,height:64,viewBox:"0 0 65 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path$2||(_path$2=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M32.5 64c17.673 0 32-14.327 32-32 0-17.673-14.327-32-32-32C14.827 0 .5 14.327.5 32c0 17.673 14.327 32 32 32Zm-4.928-29.305h9.717c-.207 4.908-1.087 9.168-2.3 12.206-.7 1.756-1.433 2.9-2.036 3.54-.245.26-.42.387-.523.448-.102-.06-.277-.189-.522-.449-.603-.638-1.336-1.783-2.037-3.539-1.213-3.038-2.092-7.298-2.3-12.206Zm2.3-16.655c-1.242 3.108-2.134 7.497-2.314 12.55h9.744c-.18-5.053-1.071-9.442-2.313-12.55-.7-1.756-1.433-2.9-2.036-3.54-.245-.26-.42-.388-.523-.449-.102.061-.277.19-.522.45-.603.638-1.336 1.783-2.037 3.539ZM14.5 30.59h8.951c.216-6.53 1.541-12.27 3.503-16.036C20.23 16.789 15.22 23.03 14.5 30.59Zm.036 4.105h8.928c.25 6.387 1.563 11.993 3.49 15.692-6.622-2.201-11.582-8.288-12.418-15.692Zm35.789 0h-8.928c-.25 6.387-1.563 11.993-3.49 15.692 6.621-2.201 11.581-8.288 12.418-15.692Zm.125-2.224v.066-.133.066Zm-9.04-1.88h8.95c-.719-7.56-5.73-13.802-12.454-16.037 1.962 3.766 3.288 9.507 3.503 16.036Zm-9.09 20.35c0-.001.008-.004.023-.007-.015.006-.023.008-.023.007Zm.198-.007a.072.072 0 0 1 .023.007s-.008-.001-.023-.007ZM32.541 14s-.008.004-.023.007c.015-.006.023-.008.023-.007Zm-.198.007A.068.068 0 0 1 32.32 14s.008.001.023.007Z",fill:"#4779FF"})))};const PasskeyNewDomainDetectedView=()=>{const{t:fr}=useTranslation(),{projectSettings:br}=useInternalDynamicContext(),wr=reactExports.useMemo(()=>{var Er;const kr=getEnabledEmbeddedWalletsAuthenticators((Er=br==null?void 0:br.sdk.embeddedWallets)===null||Er===void 0?void 0:Er.supportedSecurityMethods);return Object.keys(kr).filter(jr=>jr!=="email")},[br==null?void 0:br.sdk.embeddedWallets]);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary","data-testid":"dynamic-auth-modal-heading",className:"header__typography",copykey:"dyn_passkey_new_domain_detected.title",children:fr("dyn_passkey_new_domain_detected.title")})}),jsxRuntimeExports.jsxs("div",{className:"passkey-new-domain-detected",children:[jsxRuntimeExports.jsx(SvgDomain,{className:"passkey-new-domain-detected__header"}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",children:fr("dyn_passkey_new_domain_detected.description")}),jsxRuntimeExports.jsx(EmbeddedAuthChoiceCards,{supportedAuthenticators:wr}),jsxRuntimeExports.jsx(NeedHelpSection,{isRecoveryFlow:!0})]})]})},viewToComponentMap={"access-blocked":AccessBlockedView,"account-exists":AccountExistsView,"bridge-next-wallet-connection":BridgeNextWalletConnectionView,"bridge-summary":BridgeSummaryView,"bridge-welcome":BridgeWelcomeView,captcha:CaptchaVerifyUser,"chainalysis-blocked-wallet":NoAccess,"collect-user-data":CollectUserDataView,"collect-user-data-login-no-wallet":CollectUserDataViewNoWallet,"create-password-view":CreatePasswordView,"email-wallet-otp-verification-view":EmailWalletOTPVerificationView,"embedded-reveal-account-view":EmbeddedRevealView,"embedded-reveal-view":EmbeddedRevealView,"embedded-wallet-auth-choice":EmbeddedAuthChoice,"farcaster-connect-view":FarcasterConnectView,"gate-blocked-wallet":NoAccess,"global-wallet-confirm":GlobalWalletConfirmView,"global-wallet-info":GlobalWalletInfoView,"global-wallet-malicious":GlobalWalletMaliciousView,"login-with-email-or-wallet":LoginView,"login-with-email-or-wallet-full-wallet-list":WalletList$1,"login-with-email-verification":EmailVerification,"login-with-sms-verification":SmsVerification,"login-with-wallet-only":LoginView,"merge-user-accounts":MergeUserAccountsView,"merge-user-accounts-conflicts":MergeUserAccountsConflictsView,"merge-user-accounts-with-same-email":MergeUserAccountsWithSameEmailView,"mfa-choose-device":MfaChooseDeviceView,"mfa-display-backup-codes":MfaDisplayBackupCodesView,"mfa-recovery":MfaRecoveryView,"mfa-secure-device":MfaSecureDeviceView,"mfa-secure-device-help":MfaSecureDeviceHelper,"mfa-verification":MfaVerificationView,"mobile-wallet-redirect-view":MobileWalletRedirectView,"multi-wallet-wallet-list":WalletList$1,"network-not-supported":NetworkNotSupported,"network-not-supported-manual":NetworkNotSupportedSwitchManual,"no-access":NoAccess,"no-qr-not-installed":NoQrNotInstalledView,"passkey-intro":PasskeyIntroView,"passkey-new-domain-detected":PasskeyNewDomainDetectedView,"passkey-recovery-add-email":AddRecoveryEmail,"passkey-recovery-bundle":PasskeyBundleRecovery,"passkey-recovery-complete":PasskeyCompleteRecovery,"passkey-recovery-start":PasskeyInitRecovery,"pending-connect":PendingConnectView,"pending-signature":PendingSignatureView,"pending-signature-without-back-button":PendingSignatureView,"qr-code":QrCodeView,"rename-passkey":RenamePasskeyView,"sandbox-maximum-threshold-reached":SandboxMaximumThresholdReached,"select-hardware-wallet":SelectHardwareWalletView,"select-wallet-in-wallet-group":SelectWalletInWalletGroupView,"social-redirect-view":SocialRedirectView,"social-wrong-account":SocialWrongAccountView,"verify-email":EmailVerification,"verify-sms":SmsVerification,"wait-for-email-confirmation-view":EmailConfirmationWaitingView,"wallet-cannot-be-transferred":WalletCannotBeTransferredView,"wallet-claim-intro":CoinbaseMPCClaimIntro,"wallet-connect-mobile-wallets-list":()=>jsxRuntimeExports.jsx(WalletList$1,{isWalletConnectList:!0}),"wallet-group":WalletGroupView,"wallet-list":WalletList$1,"wallet-locked-view":WalletLockedView,"wallet-redirect-view":WalletRedirectView,"wallet-sign":WalletSignSpinnerView,"wallet-used":WalletUsedView},RenderView=()=>{const{view:fr}=useViewContext(),br=viewToComponentMap[fr.type];return jsxRuntimeExports.jsx(br,Object.assign({},fr.props||{}))};function styleInject(fr,br){br===void 0&&(br={});var wr=br.insertAt;if(!(typeof document>"u")){var Er=document.head||document.getElementsByTagName("head")[0],kr=document.createElement("style");kr.type="text/css",wr==="top"&&Er.firstChild?Er.insertBefore(kr,Er.firstChild):Er.appendChild(kr),kr.styleSheet?kr.styleSheet.cssText=fr:kr.appendChild(document.createTextNode(fr))}}var css_248z='@layer dynamic-sdk-styles{#argent-mobile-modal-overlay,iframe[src*="wallet-dev.blocto.app"],iframe[src*="wallet-staging.blocto.app"],iframe[src*="wallet-testnet.blocto.app"],iframe[src*="wallet.blocto.app"]{z-index:2147483647!important}iframe[id*=dyn-passkey-recovery-element-id],iframe[id*=dyn-secure-enclave-element-id]{display:none!important}#pera-wallet-connect-modal-wrapper{position:relative;z-index:2147483647!important}@font-face{font-display:swap;font-family:DM Sans;font-style:normal;font-weight:400;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-400-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-400-normal.woff) format("woff")}@font-face{font-display:swap;font-family:DM Sans;font-style:italic;font-weight:400;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-400-italic.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-400-italic.woff) format("woff")}@font-face{font-display:swap;font-family:DM Sans;font-style:normal;font-weight:500;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-500-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-500-normal.woff) format("woff")}@font-face{font-display:swap;font-family:DM Sans;font-style:italic;font-weight:500;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-500-italic.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-500-italic.woff) format("woff")}@font-face{font-display:swap;font-family:DM Sans;font-style:normal;font-weight:700;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-700-normal.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-700-normal.woff) format("woff")}@font-face{font-display:swap;font-family:DM Sans;font-style:italic;font-weight:700;src:url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-700-italic.woff2) format("woff2"),url(https://cdn.jsdelivr.net/npm/@fontsource/dm-sans/files/dm-sans-latin-700-italic.woff) format("woff")}@layer light-theme-default{:root{--dynamic-font-family-primary:"DM Sans",sans-serif;--dynamic-search-border-radius:1rem;--dynamic-font-family-numbers:"Roboto Mono",monospace,sans-serif;--dynamic-base-1:#f7f7f9;--dynamic-base-2:#fff;--dynamic-base-3:#eeeef1;--dynamic-base-4:#e7e8ed;--dynamic-brand-hover-color:linear-gradient(0deg,rgba(0,0,0,.08),rgba(0,0,0,.08)),#4779ff;--dynamic-brand-primary-color:#4779ff;--dynamic-brand-secondary-color:rgba(71,121,255,.15);--dynamic-success-1:#30a67b;--dynamic-success-2:#e3f7ef;--dynamic-border-radius:1.5rem;--dynamic-hover:rgba(22,37,77,.03);--dynamic-info-2:rgba(71,121,255,.1);--dynamic-error-1:#ff4646;--dynamic-error-2:rgba(255,70,70,.1);--dynamic-alert-1:#dd8500;--dynamic-alert-2:#faedd9;--dynamic-footer-background-color:#fff;--dynamic-footer-text-color:#383c48;--dynamic-footer-icon-color:#4779ff;--dynamic-loading-animation-gradient:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.2) 20%,hsla(0,0%,100%,.5) 60%,hsla(0,0%,100%,0));--dynamic-overlay:rgba(24,27,34,.15);--dynamic-shadow-down-1:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-shadow-down-2:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-shadow-down-3:0 1.5rem 2rem -1.5rem rgba(0,0,0,.24);--dynamic-shadow-up-1:0 -0.5rem 3rem -0.5rem rgba(109,121,165,.16);--dynamic-text-link:#0047ff;--dynamic-text-primary:#383c48;--dynamic-text-secondary:#7b7d86;--dynamic-text-size-body-mini:0.6875rem;--dynamic-text-size-body-normal:0.9375rem;--dynamic-text-size-body-small:0.75rem;--dynamic-text-size-button-primary:0.875rem;--dynamic-text-size-button-secondary:0.75rem;--dynamic-text-size-numbers-big:0.875rem;--dynamic-text-size-numbers-medium:0.75rem;--dynamic-text-size-title:1.125rem;--dynamic-text-tertiary:#abacb2;--dynamic-badge-background:#eeeef1;--dynamic-badge-color:#7b7d86;--dynamic-badge-primary-background:#e3f7ef;--dynamic-badge-primary-color:#30a67b;--dynamic-badge-dot-background:#4779ff;--dynamic-search-bar-background:#fff;--dynamic-search-bar-background-hover:#fff;--dynamic-search-bar-background-focus:#fff;--dynamic-search-bar-border:0.0625rem solid #eeeef1;--dynamic-search-bar-border-hover:0.0625rem solid #e7e8ed;--dynamic-search-bar-border-focus:0.0625rem solid #e7e8ed;--dynamic-modal-border: ;--dynamic-modal-width:22.5rem;--dynamic-modal-padding:1.5rem;--dynamic-modal-backdrop-background:rgba(0,0,0,.25);--dynamic-modal-backdrop-filter:blur(4px);--dynamic-wallet-list-tile-padding:0.75rem;--dynamic-wallet-list-tile-gap:0.375rem;--dynamic-wallet-list-max-height:16.25rem;--dynamic-wallet-list-tile-background:#fff;--dynamic-wallet-list-tile-border: ;--dynamic-wallet-list-tile-shadow:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-background-hover:#fff;--dynamic-wallet-list-tile-border-hover: ;--dynamic-wallet-list-tile-border-radius:0.75rem;--dynamic-wallet-list-tile-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-animation-duration:150ms;--dynamic-tooltip-color:#383c48;--dynamic-tooltip-text-color:#fff;--dynamic-button-border-radius:0.75rem;--dynamic-initial-view-content-padding:0rem 1.5rem 1.5rem;--dynamic-button-primary-hover:#fff;--dynamic-button-primary-background:#fff;--dynamic-button-primary-font-size:0.875rem;--dynamic-button-primary-padding:0;--dynamic-button-primary-border:0.0625rem solid #e7e8ed;--dynamic-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-button-secondary-hover:#f7f8fa;--dynamic-button-secondary-background:transparent;--dynamic-button-secondary-font-size:0.75rem;--dynamic-button-secondary-padding:0;--dynamic-button-secondary-border:0.0625rem solid transparent;--dynamic-connect-button-background:#fff;--dynamic-connect-button-background-hover:#fff;--dynamic-connect-button-color:#383c48;--dynamic-connect-button-border:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-connect-button-color-hover:#383c48;--dynamic-connect-button-border-hover:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-search-padding:0 1.5rem 0.5rem;--dynamic-layout-content-padding:0 1.5rem 1.5rem;--dynamic-layout-content-error-padding:1.5rem 1.5rem 1.5rem;--dynamic-footer-border-top:0.0625rem solid #e7e8ed;--dynamic-footer-padding:0.75rem 1.5rem 0.75rem;--dynamic-footer-background:transparent;--dynamic-header-border-bottom:1px solid transparent;--dynamic-header-padding:1.5rem 1.5rem 1.25rem;--dynamic-header-background:transparent}:root [data-dynamic-theme-brand=bold],:root[data-dynamic-theme-brand=bold]{--dynamic-footer-text-color:#fff;--dynamic-footer-icon-color:rgba(247,247,249,.75);--dynamic-footer-arrow-color:rgba(247,247,249,.75)}:root [data-dynamic-theme-brand=subtle],:root[data-dynamic-theme-brand=subtle]{--dynamic-footer-arrow-color:#abacb2}@media (prefers-color-scheme:light){:root [data-dynamic-theme=auto]{--dynamic-font-family-primary:"DM Sans",sans-serif;--dynamic-search-border-radius:1rem;--dynamic-font-family-numbers:"Roboto Mono",monospace,sans-serif;--dynamic-base-1:#f7f7f9;--dynamic-base-2:#fff;--dynamic-base-3:#eeeef1;--dynamic-base-4:#e7e8ed;--dynamic-brand-hover-color:linear-gradient(0deg,rgba(0,0,0,.08),rgba(0,0,0,.08)),#4779ff;--dynamic-brand-primary-color:#4779ff;--dynamic-brand-secondary-color:rgba(71,121,255,.15);--dynamic-success-1:#30a67b;--dynamic-success-2:#e3f7ef;--dynamic-border-radius:1.5rem;--dynamic-hover:rgba(22,37,77,.03);--dynamic-info-2:rgba(71,121,255,.1);--dynamic-error-1:#ff4646;--dynamic-error-2:rgba(255,70,70,.1);--dynamic-alert-1:#dd8500;--dynamic-alert-2:#faedd9;--dynamic-footer-background-color:#fff;--dynamic-footer-text-color:#383c48;--dynamic-footer-icon-color:#4779ff;--dynamic-loading-animation-gradient:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.2) 20%,hsla(0,0%,100%,.5) 60%,hsla(0,0%,100%,0));--dynamic-overlay:rgba(24,27,34,.15);--dynamic-shadow-down-1:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-shadow-down-2:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-shadow-down-3:0 1.5rem 2rem -1.5rem rgba(0,0,0,.24);--dynamic-shadow-up-1:0 -0.5rem 3rem -0.5rem rgba(109,121,165,.16);--dynamic-text-link:#0047ff;--dynamic-text-primary:#383c48;--dynamic-text-secondary:#7b7d86;--dynamic-text-size-body-mini:0.6875rem;--dynamic-text-size-body-normal:0.9375rem;--dynamic-text-size-body-small:0.75rem;--dynamic-text-size-button-primary:0.875rem;--dynamic-text-size-button-secondary:0.75rem;--dynamic-text-size-numbers-big:0.875rem;--dynamic-text-size-numbers-medium:0.75rem;--dynamic-text-size-title:1.125rem;--dynamic-text-tertiary:#abacb2;--dynamic-badge-background:#eeeef1;--dynamic-badge-color:#7b7d86;--dynamic-badge-primary-background:#e3f7ef;--dynamic-badge-primary-color:#30a67b;--dynamic-badge-dot-background:#4779ff;--dynamic-search-bar-background:#fff;--dynamic-search-bar-background-hover:#fff;--dynamic-search-bar-background-focus:#fff;--dynamic-search-bar-border:0.0625rem solid #eeeef1;--dynamic-search-bar-border-hover:0.0625rem solid #e7e8ed;--dynamic-search-bar-border-focus:0.0625rem solid #e7e8ed;--dynamic-modal-border: ;--dynamic-modal-width:22.5rem;--dynamic-modal-padding:1.5rem;--dynamic-modal-backdrop-background:rgba(0,0,0,.25);--dynamic-modal-backdrop-filter:blur(4px);--dynamic-wallet-list-tile-padding:0.75rem;--dynamic-wallet-list-tile-gap:0.375rem;--dynamic-wallet-list-max-height:16.25rem;--dynamic-wallet-list-tile-background:#fff;--dynamic-wallet-list-tile-border: ;--dynamic-wallet-list-tile-shadow:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-background-hover:#fff;--dynamic-wallet-list-tile-border-hover: ;--dynamic-wallet-list-tile-border-radius:0.75rem;--dynamic-wallet-list-tile-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-animation-duration:150ms;--dynamic-tooltip-color:#383c48;--dynamic-tooltip-text-color:#fff;--dynamic-button-border-radius:0.75rem;--dynamic-initial-view-content-padding:0rem 1.5rem 1.5rem;--dynamic-button-primary-hover:#fff;--dynamic-button-primary-background:#fff;--dynamic-button-primary-font-size:0.875rem;--dynamic-button-primary-padding:0;--dynamic-button-primary-border:0.0625rem solid #e7e8ed;--dynamic-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-button-secondary-hover:#f7f8fa;--dynamic-button-secondary-background:transparent;--dynamic-button-secondary-font-size:0.75rem;--dynamic-button-secondary-padding:0;--dynamic-button-secondary-border:0.0625rem solid transparent;--dynamic-connect-button-background:#fff;--dynamic-connect-button-background-hover:#fff;--dynamic-connect-button-color:#383c48;--dynamic-connect-button-border:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-connect-button-color-hover:#383c48;--dynamic-connect-button-border-hover:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-search-padding:0 1.5rem 0.5rem;--dynamic-layout-content-padding:0 1.5rem 1.5rem;--dynamic-layout-content-error-padding:1.5rem 1.5rem 1.5rem;--dynamic-footer-border-top:0.0625rem solid #e7e8ed;--dynamic-footer-padding:0.75rem 1.5rem 0.75rem;--dynamic-footer-background:transparent;--dynamic-header-border-bottom:1px solid transparent;--dynamic-header-padding:1.5rem 1.5rem 1.25rem;--dynamic-header-background:transparent}:root [data-dynamic-theme=auto] [data-dynamic-theme-brand=bold],:root [data-dynamic-theme=auto][data-dynamic-theme-brand=bold]{--dynamic-footer-text-color:#fff;--dynamic-footer-icon-color:rgba(247,247,249,.75);--dynamic-footer-arrow-color:rgba(247,247,249,.75)}:root [data-dynamic-theme=auto] [data-dynamic-theme-brand=subtle],:root [data-dynamic-theme=auto][data-dynamic-theme-brand=subtle]{--dynamic-footer-arrow-color:#abacb2}}:root [data-dynamic-theme=light]{--dynamic-font-family-primary:"DM Sans",sans-serif;--dynamic-search-border-radius:1rem;--dynamic-font-family-numbers:"Roboto Mono",monospace,sans-serif;--dynamic-base-1:#f7f7f9;--dynamic-base-2:#fff;--dynamic-base-3:#eeeef1;--dynamic-base-4:#e7e8ed;--dynamic-brand-hover-color:linear-gradient(0deg,rgba(0,0,0,.08),rgba(0,0,0,.08)),#4779ff;--dynamic-brand-primary-color:#4779ff;--dynamic-brand-secondary-color:rgba(71,121,255,.15);--dynamic-success-1:#30a67b;--dynamic-success-2:#e3f7ef;--dynamic-border-radius:1.5rem;--dynamic-hover:rgba(22,37,77,.03);--dynamic-info-2:rgba(71,121,255,.1);--dynamic-error-1:#ff4646;--dynamic-error-2:rgba(255,70,70,.1);--dynamic-alert-1:#dd8500;--dynamic-alert-2:#faedd9;--dynamic-footer-background-color:#fff;--dynamic-footer-text-color:#383c48;--dynamic-footer-icon-color:#4779ff;--dynamic-loading-animation-gradient:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.2) 20%,hsla(0,0%,100%,.5) 60%,hsla(0,0%,100%,0));--dynamic-overlay:rgba(24,27,34,.15);--dynamic-shadow-down-1:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-shadow-down-2:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-shadow-down-3:0 1.5rem 2rem -1.5rem rgba(0,0,0,.24);--dynamic-shadow-up-1:0 -0.5rem 3rem -0.5rem rgba(109,121,165,.16);--dynamic-text-link:#0047ff;--dynamic-text-primary:#383c48;--dynamic-text-secondary:#7b7d86;--dynamic-text-size-body-mini:0.6875rem;--dynamic-text-size-body-normal:0.9375rem;--dynamic-text-size-body-small:0.75rem;--dynamic-text-size-button-primary:0.875rem;--dynamic-text-size-button-secondary:0.75rem;--dynamic-text-size-numbers-big:0.875rem;--dynamic-text-size-numbers-medium:0.75rem;--dynamic-text-size-title:1.125rem;--dynamic-text-tertiary:#abacb2;--dynamic-badge-background:#eeeef1;--dynamic-badge-color:#7b7d86;--dynamic-badge-primary-background:#e3f7ef;--dynamic-badge-primary-color:#30a67b;--dynamic-badge-dot-background:#4779ff;--dynamic-search-bar-background:#fff;--dynamic-search-bar-background-hover:#fff;--dynamic-search-bar-background-focus:#fff;--dynamic-search-bar-border:0.0625rem solid #eeeef1;--dynamic-search-bar-border-hover:0.0625rem solid #e7e8ed;--dynamic-search-bar-border-focus:0.0625rem solid #e7e8ed;--dynamic-modal-border: ;--dynamic-modal-width:22.5rem;--dynamic-modal-padding:1.5rem;--dynamic-modal-backdrop-background:rgba(0,0,0,.25);--dynamic-modal-backdrop-filter:blur(4px);--dynamic-wallet-list-tile-padding:0.75rem;--dynamic-wallet-list-tile-gap:0.375rem;--dynamic-wallet-list-max-height:16.25rem;--dynamic-wallet-list-tile-background:#fff;--dynamic-wallet-list-tile-border: ;--dynamic-wallet-list-tile-shadow:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-background-hover:#fff;--dynamic-wallet-list-tile-border-hover: ;--dynamic-wallet-list-tile-border-radius:0.75rem;--dynamic-wallet-list-tile-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-animation-duration:150ms;--dynamic-tooltip-color:#383c48;--dynamic-tooltip-text-color:#fff;--dynamic-button-border-radius:0.75rem;--dynamic-initial-view-content-padding:0rem 1.5rem 1.5rem;--dynamic-button-primary-hover:#fff;--dynamic-button-primary-background:#fff;--dynamic-button-primary-font-size:0.875rem;--dynamic-button-primary-padding:0;--dynamic-button-primary-border:0.0625rem solid #e7e8ed;--dynamic-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-button-secondary-hover:#f7f8fa;--dynamic-button-secondary-background:transparent;--dynamic-button-secondary-font-size:0.75rem;--dynamic-button-secondary-padding:0;--dynamic-button-secondary-border:0.0625rem solid transparent;--dynamic-connect-button-background:#fff;--dynamic-connect-button-background-hover:#fff;--dynamic-connect-button-color:#383c48;--dynamic-connect-button-border:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-connect-button-color-hover:#383c48;--dynamic-connect-button-border-hover:0.0625rem solid #e7e8ed;--dynamic-connect-button-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-search-padding:0 1.5rem 0.5rem;--dynamic-layout-content-padding:0 1.5rem 1.5rem;--dynamic-layout-content-error-padding:1.5rem 1.5rem 1.5rem;--dynamic-footer-border-top:0.0625rem solid #e7e8ed;--dynamic-footer-padding:0.75rem 1.5rem 0.75rem;--dynamic-footer-background:transparent;--dynamic-header-border-bottom:1px solid transparent;--dynamic-header-padding:1.5rem 1.5rem 1.25rem;--dynamic-header-background:transparent}:root [data-dynamic-theme=light] [data-dynamic-theme-brand=bold],:root [data-dynamic-theme=light][data-dynamic-theme-brand=bold]{--dynamic-footer-text-color:#fff;--dynamic-footer-icon-color:rgba(247,247,249,.75);--dynamic-footer-arrow-color:rgba(247,247,249,.75)}:root [data-dynamic-theme=light] [data-dynamic-theme-brand=subtle],:root [data-dynamic-theme=light][data-dynamic-theme-brand=subtle]{--dynamic-footer-arrow-color:#abacb2}}@layer dark-theme-default{@media (prefers-color-scheme:dark){:root [data-dynamic-theme=auto]{--dynamic-font-family-primary:"DM Sans",sans-serif;--dynamic-search-border-radius:1rem;--dynamic-font-family-numbers:"Roboto Mono",monospace,sans-serif;--dynamic-base-1:#0c0e13;--dynamic-base-2:#1b1d22;--dynamic-base-3:#24272e;--dynamic-base-4:#282b33;--dynamic-brand-hover-color:linear-gradient(0deg,rgba(0,0,0,.08),rgba(0,0,0,.08)),#4779ff;--dynamic-brand-primary-color:#4779ff;--dynamic-brand-secondary-color:rgba(71,121,255,.15);--dynamic-success-1:#79ffcf;--dynamic-success-2:#192d2c;--dynamic-border-radius:1.5rem;--dynamic-hover:hsla(0,0%,100%,.1);--dynamic-error-1:#ff6a6a;--dynamic-error-2:hsla(0,100%,71%,.2);--dynamic-alert-1:#e2a140;--dynamic-alert-2:#2b2621;--dynamic-footer-background-color:#0c0e13;--dynamic-footer-text-color:#fbfcff;--dynamic-footer-icon-color:#4779ff;--dynamic-loading-animation-gradient:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.01) 20%,hsla(0,0%,100%,.05) 60%,hsla(0,0%,100%,0));--dynamic-overlay:rgba(0,0,0,.25);--dynamic-shadow-down-1:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-shadow-down-2:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-shadow-down-3:0 1.5rem 2rem -1.5rem rgba(0,0,0,.24);--dynamic-shadow-up-1:0 -0.5rem 3rem -0.5rem rgba(109,121,165,.16);--dynamic-text-link:#69a5ff;--dynamic-text-primary:#fbfcff;--dynamic-text-secondary:#a8aab0;--dynamic-text-size-body-mini:0.6875rem;--dynamic-text-size-body-normal:0.9375rem;--dynamic-text-size-body-small:0.75rem;--dynamic-text-size-button-primary:0.875rem;--dynamic-text-size-button-secondary:0.75rem;--dynamic-text-size-numbers-big:0.875rem;--dynamic-text-size-numbers-medium:0.75rem;--dynamic-text-size-title:1.125rem;--dynamic-text-tertiary:#6f7177;--dynamic-badge-background:#24272e;--dynamic-badge-color:#a8aab0;--dynamic-badge-dot-background:#4779ff;--dynamic-search-bar-background:#1b1d22;--dynamic-search-bar-background-hover:#1b1d22;--dynamic-search-bar-background-focus:#1b1d22;--dynamic-search-bar-border:0.0625rem solid #24272e;--dynamic-search-bar-border-hover:0.0625rem solid #282b33;--dynamic-search-bar-border-focus:0.0625rem solid #282b33;--dynamic-modal-border: ;--dynamic-modal-width:22.5rem;--dynamic-modal-padding:1.5rem;--dynamic-modal-backdrop-background:rgba(0,0,0,.25);--dynamic-modal-backdrop-filter:blur(4px);--dynamic-wallet-list-tile-padding:0.75rem;--dynamic-wallet-list-tile-gap:0.375rem;--dynamic-wallet-list-max-height:16.25rem;--dynamic-wallet-list-tile-background:#24272e;--dynamic-wallet-list-tile-border: ;--dynamic-wallet-list-tile-shadow:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-background-hover:#282b33;--dynamic-wallet-list-tile-border-hover: ;--dynamic-wallet-list-tile-border-radius:0.75rem;--dynamic-wallet-list-tile-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-animation-duration:150ms;--dynamic-tooltip-color:#fbfcff;--dynamic-tooltip-text-color:#0c0e13;--dynamic-initial-view-content-padding:0rem 1.5rem 1.5rem;--dynamic-button-primary-hover:#1b1d22;--dynamic-button-primary-background:#1b1d22;--dynamic-button-primary-font-size:0.875rem;--dynamic-button-primary-padding:0;--dynamic-button-primary-border:0.0625rem solid #282b33;--dynamic-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-button-secondary-hover:#1a1c21;--dynamic-button-secondary-background:transparent;--dynamic-button-secondary-font-size:0.75rem;--dynamic-button-secondary-padding:0;--dynamic-button-secondary-border:0.0625rem solid transparent;--dynamic-connect-button-background:#1b1d22;--dynamic-connect-button-background-hover:#1b1d22;--dynamic-connect-button-color:#fbfcff;--dynamic-connect-button-border:0.0625rem solid #282b33;--dynamic-connect-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-connect-button-color-hover:#fbfcff;--dynamic-connect-button-border-hover:0.0625rem solid #282b33;--dynamic-connect-button-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-search-padding:0 1.5rem 0.5rem;--dynamic-layout-content-padding:0 1.5rem 1.5rem;--dynamic-layout-content-error-padding:1.5rem 1.5rem 1.5rem;--dynamic-footer-border-top:0.0625rem solid #282b33;--dynamic-footer-padding:0.75rem 1.5rem 0.75rem;--dynamic-footer-background:transparent;--dynamic-header-border-bottom:1px solid transparent;--dynamic-header-padding:1.5rem 1.5rem 1.25rem;--dynamic-header-background:transparent}:root [data-dynamic-theme=auto] [data-dynamic-theme-brand=bold],:root [data-dynamic-theme=auto][data-dynamic-theme-brand=bold]{--dynamic-footer-text-color:#fbfcff;--dynamic-footer-icon-color:rgba(247,247,249,.75);--dynamic-footer-arrow-color:rgba(247,247,249,.75)}:root [data-dynamic-theme=auto] [data-dynamic-theme-brand=subtle],:root [data-dynamic-theme=auto][data-dynamic-theme-brand=subtle]{--dynamic-footer-arrow-color:#6f7177;--dynamic-footer-icon-color:#6f7177}}:root [data-dynamic-theme=dark]{--dynamic-font-family-primary:"DM Sans",sans-serif;--dynamic-search-border-radius:1rem;--dynamic-font-family-numbers:"Roboto Mono",monospace,sans-serif;--dynamic-base-1:#0c0e13;--dynamic-base-2:#1b1d22;--dynamic-base-3:#24272e;--dynamic-base-4:#282b33;--dynamic-brand-hover-color:linear-gradient(0deg,rgba(0,0,0,.08),rgba(0,0,0,.08)),#4779ff;--dynamic-brand-primary-color:#4779ff;--dynamic-brand-secondary-color:rgba(71,121,255,.15);--dynamic-success-1:#79ffcf;--dynamic-success-2:#192d2c;--dynamic-border-radius:1.5rem;--dynamic-hover:hsla(0,0%,100%,.1);--dynamic-error-1:#ff6a6a;--dynamic-error-2:hsla(0,100%,71%,.2);--dynamic-alert-1:#e2a140;--dynamic-alert-2:#2b2621;--dynamic-footer-background-color:#0c0e13;--dynamic-footer-text-color:#fbfcff;--dynamic-footer-icon-color:#4779ff;--dynamic-loading-animation-gradient:linear-gradient(90deg,hsla(0,0%,100%,0),hsla(0,0%,100%,.01) 20%,hsla(0,0%,100%,.05) 60%,hsla(0,0%,100%,0));--dynamic-overlay:rgba(0,0,0,.25);--dynamic-shadow-down-1:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-shadow-down-2:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-shadow-down-3:0 1.5rem 2rem -1.5rem rgba(0,0,0,.24);--dynamic-shadow-up-1:0 -0.5rem 3rem -0.5rem rgba(109,121,165,.16);--dynamic-text-link:#69a5ff;--dynamic-text-primary:#fbfcff;--dynamic-text-secondary:#a8aab0;--dynamic-text-size-body-mini:0.6875rem;--dynamic-text-size-body-normal:0.9375rem;--dynamic-text-size-body-small:0.75rem;--dynamic-text-size-button-primary:0.875rem;--dynamic-text-size-button-secondary:0.75rem;--dynamic-text-size-numbers-big:0.875rem;--dynamic-text-size-numbers-medium:0.75rem;--dynamic-text-size-title:1.125rem;--dynamic-text-tertiary:#6f7177;--dynamic-badge-background:#24272e;--dynamic-badge-color:#a8aab0;--dynamic-badge-dot-background:#4779ff;--dynamic-search-bar-background:#1b1d22;--dynamic-search-bar-background-hover:#1b1d22;--dynamic-search-bar-background-focus:#1b1d22;--dynamic-search-bar-border:0.0625rem solid #24272e;--dynamic-search-bar-border-hover:0.0625rem solid #282b33;--dynamic-search-bar-border-focus:0.0625rem solid #282b33;--dynamic-modal-border: ;--dynamic-modal-width:22.5rem;--dynamic-modal-padding:1.5rem;--dynamic-modal-backdrop-background:rgba(0,0,0,.25);--dynamic-modal-backdrop-filter:blur(4px);--dynamic-wallet-list-tile-padding:0.75rem;--dynamic-wallet-list-tile-gap:0.375rem;--dynamic-wallet-list-max-height:16.25rem;--dynamic-wallet-list-tile-background:#24272e;--dynamic-wallet-list-tile-border: ;--dynamic-wallet-list-tile-shadow:0 0.0625rem 0.125rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-background-hover:#282b33;--dynamic-wallet-list-tile-border-hover: ;--dynamic-wallet-list-tile-border-radius:0.75rem;--dynamic-wallet-list-tile-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-wallet-list-tile-animation-duration:150ms;--dynamic-tooltip-color:#fbfcff;--dynamic-tooltip-text-color:#0c0e13;--dynamic-initial-view-content-padding:0rem 1.5rem 1.5rem;--dynamic-button-primary-hover:#1b1d22;--dynamic-button-primary-background:#1b1d22;--dynamic-button-primary-font-size:0.875rem;--dynamic-button-primary-padding:0;--dynamic-button-primary-border:0.0625rem solid #282b33;--dynamic-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-button-secondary-hover:#1a1c21;--dynamic-button-secondary-background:transparent;--dynamic-button-secondary-font-size:0.75rem;--dynamic-button-secondary-padding:0;--dynamic-button-secondary-border:0.0625rem solid transparent;--dynamic-connect-button-background:#1b1d22;--dynamic-connect-button-background-hover:#1b1d22;--dynamic-connect-button-color:#fbfcff;--dynamic-connect-button-border:0.0625rem solid #282b33;--dynamic-connect-button-shadow:0px 2px 3px 0px rgba(24,39,75,.08);--dynamic-connect-button-color-hover:#fbfcff;--dynamic-connect-button-border-hover:0.0625rem solid #282b33;--dynamic-connect-button-shadow-hover:0 0.75rem 1.25rem -0.375rem rgba(24,39,75,.02),0 1rem 1.625rem -0.25rem rgba(24,39,75,.04);--dynamic-search-padding:0 1.5rem 0.5rem;--dynamic-layout-content-padding:0 1.5rem 1.5rem;--dynamic-layout-content-error-padding:1.5rem 1.5rem 1.5rem;--dynamic-footer-border-top:0.0625rem solid #282b33;--dynamic-footer-padding:0.75rem 1.5rem 0.75rem;--dynamic-footer-background:transparent;--dynamic-header-border-bottom:1px solid transparent;--dynamic-header-padding:1.5rem 1.5rem 1.25rem;--dynamic-header-background:transparent}:root [data-dynamic-theme=dark] [data-dynamic-theme-brand=bold],:root [data-dynamic-theme=dark][data-dynamic-theme-brand=bold]{--dynamic-footer-text-color:#fbfcff;--dynamic-footer-icon-color:rgba(247,247,249,.75);--dynamic-footer-arrow-color:rgba(247,247,249,.75)}:root [data-dynamic-theme=dark] [data-dynamic-theme-brand=subtle],:root [data-dynamic-theme=dark][data-dynamic-theme-brand=subtle]{--dynamic-footer-arrow-color:#6f7177;--dynamic-footer-icon-color:#6f7177}}.dynamic-shadow-dom{position:relative}#dynamic-tooltips{left:0;position:absolute;top:0}@supports (overflow:clip){.dynamic-no-scroll{overflow:clip}}@supports not (overflow:clip){.dynamic-no-scroll{overflow:hidden}}}';styleInject(css_248z);const useVerifyOnAwaitingSignature=()=>{const{awaitingSignatureState:fr,multiWalletWidgetState:br,setMultiWalletWidgetState:wr,legacyIsVerifying:Er,setLegacyIsVerifying:kr,selectedWalletConnector:jr}=useInternalDynamicContext(),Br=useConnectAndSign(),Wr=reactExports.useRef(!1),qr=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){if(logger$6.debug("runConnectAndSign",{selectedWalletConnector:jr}),!!jr){Wr.current=!0,kr(!0);try{yield Br({walletConnector:jr})}catch(Gr){logger$6.error(Gr)}wr("idle"),kr(!1),Wr.current=!1}}),[jr==null?void 0:jr.key,kr,wr,Br]);reactExports.useEffect(()=>{!Er&&!Wr.current&&br==="awaiting_signature"&&jr&&fr==="linking_new_wallet"&&!requiresTwoStepAuthentication(jr)&&qr()},[qr,fr,Er,br,jr==null?void 0:jr.key,kr,wr]),useInternalDynamicEvents("triggerConnectAndSign",qr)},viewsToDisableCloseOnOverlayClick=["email-wallet-otp-verification-view","social-redirect-view","passkey-intro"],Main=()=>{const{selectedWalletConnector:fr,linkedWallets:br,projectSettings:wr,setShowAuthFlow:Er,showAuthFlow:kr,walletConnectorOptions:jr,clearStatesOnBackClick:Br,user:Wr,disconnectWallet:qr,authMode:Gr,connectedWallets:Vr,handleLogOut:Zr}=useInternalDynamicContext(),{view:Jr,goToInitialView:Qr}=useViewContext(),{setDeniedAddress:_n,setDeniedOauthProvider:En}=useAccessDeniedContext(),{setExistentAccountData:Cn}=useAccountExistsContext(),{setSocialProvider:In}=useSocialRedirectContext();usePreventPageScroll(kr);const An=useUserWallets(),jn=()=>__awaiter$e(void 0,void 0,void 0,function*(){var Tn;if(!viewsToDisableCloseOnOverlayClick.includes(Jr.type)){if(!((Tn=Jr.events)===null||Tn===void 0)&&Tn.onClose){Jr.events.onClose();return}(Jr.type==="network-not-supported"||Jr.type==="network-not-supported-manual")&&An.length===1&&(yield Zr()),Jr.type==="farcaster-connect-view"&&(In(void 0),dynamicEvents.emit("farcasterConnectCancelled")),Er(!1,{emitCancelAuth:!0}),_n(""),En(void 0),Cn(void 0),Br()}}),eo=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){const Tn=["network-not-supported","network-not-supported-manual"];if(!isConnectOnly(Wr,Gr)||!Tn.includes(Jr.type)||!fr)return;const Hr=Vr.find(Xr=>Xr.connector.key===fr.key);Hr&&(isSupportedNetwork({network:yield Hr.connector.getNetwork(),walletConnector:Hr.connector})||qr(Hr.id))}),[fr,Gr,Vr,qr,Wr,Jr]),ro=reactExports.useCallback(()=>{Qr()},[Qr]);useVerifyOnAwaitingSignature();const{handleAlreadyConnectedWallet:to,handleCustodialWalletClick:_i,handleInstalledExtensionClick:oo,handleMobileWalletClick:io,handleUninstalledClick:co}=useWalletItemActions(),so=Tn=>__awaiter$e(void 0,void 0,void 0,function*(){Er(!0),isSelectedWalletAlreadyConnected(br,Tn,Wr)?to(Tn):Tn.canConnectViaCustodialService?_i(Tn):isMobile()?io(Tn):Tn.isInstalledOnBrowser()?oo(Tn):co(Tn)});reactExports.useEffect(()=>{const Tn=StorageService.getItem(NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY);if(jr!=null&&jr.length&&Tn){const Hr=jr.find(Xr=>Xr.key===Tn);Hr!=null&&Hr.walletConnector&&so(Hr.walletConnector),StorageService.removeItem(NEWTOWEB3_WALLET_EXTENSION_FLAG_KEY)}},[jr]);const no=kr&&!!wr;return jsxRuntimeExports.jsx(FooterAnimationContextProvider,{children:jsxRuntimeExports.jsx(Portal$4,{zIndex:authModalZIndex,isShown:no,handleClose:jn,withBackdrop:!0,transitionEvents:{onExiting:eo,onUnmount:ro},children:jsxRuntimeExports.jsx(PopperProvider$1,{children:jsxRuntimeExports.jsx(DynamicAuthModal,{transitionProps:{isShown:no},onClose:jn,projectSettings:wr,children:jsxRuntimeExports.jsx(RenderView,{})})})})})},DynamicAuthFlow=()=>jsxRuntimeExports.jsx(IsBrowser,{children:jsxRuntimeExports.jsx(Main,{})}),lastAuthenticatedAccount=fr=>fr.verifiedCredentials.find(br=>br.id===fr.lastVerifiedCredentialId),useGlobalLoading=({authMode:fr,connectedInfo:br,connectedWallets:wr,projectSettings:Er,primaryWalletId:kr,primaryWallet:jr,user:Br,isLoadingUserFromCookie:Wr,walletBook:qr,enableInstrumentation:Gr,appName:Vr,environmentId:Zr})=>{var Jr,Qr;const _n=reactExports.useRef(!1),En=reactExports.useRef(new Date().getTime()),{sessionValidation:Cn}=useLoadingAndLifecycle(),In=()=>{if(!_n.current&&(_n.current=!0,logger$6.debug("[useGlobalLoading] SDK finished loading",{authMode:fr,enableInstrumentation:Gr,primaryWallet:jr,user:Br}),Gr)){const io=new Date().getTime()-En.current;logger$6.instrument(`SDK loaded in (ms) ${io}`,{appName:Vr,environmentId:Zr,key:"sdkHasLoaded",primaryWalletId:kr,time:io,userId:Br==null?void 0:Br.userId})}};if(_n.current)return!0;const An=!Object.keys((Jr=qr==null?void 0:qr.wallets)!==null&&Jr!==void 0?Jr:{}).length,jn=!Er,eo=Wr,to=!!((kr||Br&&((Qr=lastAuthenticatedAccount(Br))===null||Qr===void 0?void 0:Qr.format)==="blockchain")&&!jr),_i=fr==="connect-only"&&br&&wr.length===0,oo=!Cn;return logger$6.logVerboseTroubleshootingMessage("[useGlobalLoading] SDK loading",{isConnectOnlyWalletsLoading:_i,isPrimaryWalletLoading:to,isProjectSettingsLoading:jn,isUserLoading:eo,isValidatingSession:oo,isWalletBookLoading:An}),!An&&!jn&&!eo&&!to&&!_i&&!oo&&In(),_n.current},usePrefetch=({as:fr,href:br,id:wr,type:Er})=>{if(isSSR()||document.head.querySelector(`#${wr}`))return;const jr=document.createElement("link");jr.setAttribute("id",wr),jr.setAttribute("rel","prefetch"),jr.setAttribute("href",br),jr.setAttribute("as",fr),jr.setAttribute("type",Er),document.head.insertAdjacentElement("beforeend",jr)},fetchNonce=fr=>__awaiter$e(void 0,void 0,void 0,function*(){try{return(yield sdkApi$1().getNonce({environmentId:fr})).nonce}catch{return}}),validateLocalStorageExpiry=fr=>!(!fr||new Date().getTime()>fr.expiry),useFetchNonce=(fr,br=2)=>{const[wr,Er,kr]=useLocalStorage$1(NONCE_STORAGE_KEY,void 0,validateLocalStorageExpiry),jr=(wr==null?void 0:wr.value)!==""&&(wr==null?void 0:wr.value)!==void 0;wr&&wr.environmentId&&wr.environmentId!==fr&&kr(),usePromise(()=>__awaiter$e(void 0,void 0,void 0,function*(){return fetchNonce(fr).then(Wr=>{if(!Wr)throw new DynamicError("Nonce is not defined");const qr=new Date().getTime()+6e4*60*24;return{environmentId:fr,expiry:qr,value:Wr}})}),{deps:[fr,jr],enabled:!jr,initialData:void 0,onResolve:Er,retries:br});const Br=reactExports.useCallback(()=>{const Wr=wr==null?void 0:wr.value;return kr(),Wr},[kr,wr==null?void 0:wr.value]);return{consumeNonce:()=>Br()}},useSetWalletConnectorVerifiedCredentials=(fr,br)=>{!fr||!(br!=null&&br.length)||br.forEach(wr=>{wr.walletConnector.setVerifiedCredentials(fr.verifiedCredentials)})},handleStoreAndEnvironmentMismatch=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,logout:wr}){const Er=getEnvironmentId();return!Er||br===Er?!0:(yield wr("store and environment are out of sync",{currentEnvId:br,storedEnvId:Er}),setEnvironmentId(br),!1)}),handleUserDataOutOfSync=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,logout:wr}){const Er=isCookieEnabled$1(),kr=getAuthToken(),jr=getUser();if(kr||!jr)return!0;if(jr&&!kr&&Er){try{yield getAuthenticatedUser({environmentId:br})}catch(Br){if(Br instanceof CookieInvalidError)return yield wr("user auth cookie invalid",{authToken:kr,user:jr}),!1}return!0}return yield wr("user data out of sync",{authToken:kr,user:jr}),!1}),useValidateSession=({environmentId:fr,handleLogOut:br})=>{const wr=reactExports.useCallback((kr,jr)=>__awaiter$e(void 0,void 0,void 0,function*(){return logger$6.debug(`Logging out due to invalid session - Reason: ${kr}`,Object.assign({},jr)),br()}),[br]),Er=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){const kr={environmentId:fr,logout:wr};yield Promise.all([handleStoreAndEnvironmentMismatch(kr),handleUserDataOutOfSync(kr)]),setLoadingAndLifecycle({sessionValidation:!0})}),[fr,wr]);useEffectOnce(()=>{Er()}),useInternalDynamicEvents("triggerSessionValidation",Er)},serializeWalletConnectors=fr=>{try{return fr?fr.map(br=>br.name):void 0}catch(br){logger$6.error("error serializing walletConnectors",br);return}};class ConnectorSetupError extends DynamicError{constructor(br,wr){super(`${br} is enabled but ${wr} is not in your walletConnectors list. See https://docs.dynamic.xyz/react-sdk/wallet-connectors for more information.`)}}const magicEmailOtpWalletConnectorKey="magicemailotp",magicSocialWalletConnectorKey="magicsocial",verifyMagicIsSetup=(fr,br)=>{var wr;const Er=isProviderEnabled((wr=fr.providers)!==null&&wr!==void 0?wr:[],ProviderEnum.MagicLink),kr=br.some(({key:jr})=>[magicEmailOtpWalletConnectorKey,magicSocialWalletConnectorKey].includes(jr));if(Er&&!kr)throw new ConnectorSetupError("Magic","MagicWalletConnectors")},zeroDevWalletConnectorKey="zerodev",verifyZeroDevIsSetup=(fr,br)=>{var wr;const Er=isProviderEnabled((wr=fr.providers)!==null&&wr!==void 0?wr:[],ProviderEnum.Zerodev),kr=br.some(({key:jr})=>jr===zeroDevWalletConnectorKey);if(Er&&!kr)throw new ConnectorSetupError("ZeroDev","ZeroDevSmartWalletConnectors")},verifyRequiredConnectorsAreSetup=(fr,br)=>{verifyMagicIsSetup(fr,br),verifyZeroDevIsSetup(fr,br)},useCreateWalletConnectorOptions=({projectSettings:fr,appLogoUrl:br,appName:wr,coinbaseWalletPreference:Er,deepLinkPreference:kr,flowNetwork:jr,mobileExperience:Br,networkConfigurations:Wr,walletBook:qr,walletUiUtils:Gr,walletConnectorsProp:Vr,walletConnectPreferredChains:Zr,walletConnectorExtensions:Jr})=>{const Qr=reactExports.useMemo(()=>{var Cn;return(Cn=serializeWalletConnectors(Vr))===null||Cn===void 0?void 0:Cn.join(",")},[Vr]),_n=reactExports.useMemo(()=>Object.keys(qr??{}).length,[qr]),En=reactExports.useMemo(()=>!fr||!Object.keys(qr??{}).length||!Wr?[]:getWallets$1({getSupportedWalletOpts:{appLogoUrl:br,appName:wr,coinbaseWalletPreference:Er,deepLinkPreference:kr,flowNetwork:jr,mobileExperience:Br,networkConfigurations:Wr,settings:fr,skipMemo:!0,walletBook:qr,walletConnectPreferredChains:Zr,walletConnectorsProp:Vr??[],walletUiUtils:Gr},walletConnectorExtensions:Jr}),[br,wr,fr,Qr,Zr,jr,_n,Wr]);return reactExports.useEffect(()=>{!fr||En.length===0||(verifyRequiredConnectorsAreSetup(fr,En.map(({walletConnector:Cn})=>Cn)),setWalletConnectorOptions(En))},[En,fr]),{walletConnectorOptions:En}},shouldManuallyReconnectOnRefresh=fr=>fr.connectedChain==="STARK"||fr.connectedChain==="FLOW",convertLegacyPhantomLedgerConnector=fr=>Object.assign(Object.assign({},fr),{walletName:"phantom",walletProperties:{hardwareWallet:HardwareWalletEnum.Ledger}}),createLinkedWalletsFromWalletOptions=({user:fr,walletConnectorOptions:br,primaryWalletId:wr,separateSmartWalletAndSigner:Er})=>!br||!fr?[]:fr.verifiedCredentials.map(convertLegacyPhantomLedger).map(kr=>{var jr,Br;const Wr=findWalletOptionFor(kr,br);return!Wr||(kr.id===wr&&shouldManuallyReconnectOnRefresh(Wr.walletConnector)&&Wr.walletConnector.connect(),((jr=kr.walletProperties)===null||jr===void 0?void 0:jr.hardwareWallet)===HardwareWalletEnum.Ledger&&isHardwareWalletConnector(Wr.walletConnector)&&(Wr.walletConnector.isHardwareWalletEnabled=!0),!Er&&isOwnerOfASmartWallet(kr,fr.verifiedCredentials))?null:kr.address&&kr.chain?(kr.walletProvider===WalletProviderEnum.SmartContractWallet&&initializeSmartWallet({account:kr,primaryWalletId:wr,verifiedCredentials:fr.verifiedCredentials,walletConnectorOptions:br}),Wr.walletConnector.createWallet({additionalAddresses:kr.walletAdditionalAddresses,address:kr.address,chain:Wr.walletConnector.connectedChain,connector:Wr.walletConnector,id:kr.id,isAuthenticated:!0,key:(Br=kr.walletName)!==null&&Br!==void 0?Br:Wr.walletConnector.key})):null}).filter(kr=>kr!==null),convertLegacyPhantomLedger=fr=>fr.walletName==="phantomledger"?convertLegacyPhantomLedgerConnector(fr):fr,updateUserWalletsFromLinkedWallets=(fr,br)=>{const wr=[...fr],Er=new Set;for(const kr of br){Er.add(kr.address);const jr=wr.findIndex(Br=>Br.address===kr.address);if(jr===-1){wr.push(kr);continue}wr[jr]=kr}return wr.filter(kr=>Er.has(kr.address))},useWalletConnectors=({authMode:fr,connectedWallets:br,walletConnectorOptions:wr,setMultiWalletWidgetState:Er,primaryWalletId:kr,setPrimaryWalletId:jr,user:Br,canHaveMultipleWalletsConnected:Wr,separateSmartWalletAndSigner:qr=!1})=>{const[Gr,Vr]=reactExports.useState(!1),Zr=reactExports.useRef(kr),Jr=reactExports.useMemo(()=>Br?createLinkedWalletsFromWalletOptions({primaryWalletId:kr,separateSmartWalletAndSigner:qr,user:Br,walletConnectorOptions:wr}):[],[Br,kr,wr,qr]);logger$6.logVerboseTroubleshootingMessage("linkedWallets",Jr);const Qr=reactExports.useMemo(()=>fr==="connect-and-sign"&&Br||fr==="connect-only"&&Jr.find(jn=>isEmbeddedConnector(jn.connector))?Jr:br??[],[fr,br,Jr,Br]);logger$6.logVerboseTroubleshootingMessage("wallets",Qr),reactExports.useEffect(()=>Qr.forEach(jn=>{jn.connector.initEventListener()}),[Qr]);const{setUserWallets:_n}=useInternalUserWallets();reactExports.useEffect(()=>{logger$6.logVerboseTroubleshootingMessage("[useWalletConnectors] will call setUserWallets",Qr),_n(jn=>updateUserWalletsFromLinkedWallets(jn,Qr))},[_n,Qr]);const En=reactExports.useMemo(()=>{var jn;return(jn=Qr.find(eo=>eo.id===kr))!==null&&jn!==void 0?jn:null},[kr,Qr]);reactExports.useEffect(()=>{En&&En.id!==Zr.current&&(Zr.current=En.id,dynamicEvents.emit("primaryWalletChanged",En))},[En]);const Cn=reactExports.useMemo(()=>Wr?Qr.filter(jn=>jn.id!==kr):[],[kr,Qr,Wr]),In=reactExports.useCallback(jn=>__awaiter$e(void 0,void 0,void 0,function*(){const eo=Qr.find(({id:ro})=>ro===jn);if(!eo)throw new DynamicError(`Wallet with id: ${jn} not found`);return eo}),[Qr]),An=reactExports.useCallback(jn=>__awaiter$e(void 0,void 0,void 0,function*(){const eo=yield In(jn);if(!kr){yield eo.connector.connect(),jr(jn);return}if(kr!==jn){if(isEmailWalletConnector(eo.connector)){const ro=eo.connector,to=localStorage.getItem("magic-link-email");to&&ro.setEmail(to)}jr(jn),Er("idle")}}),[In,kr,Er,jr]);return{primaryWallet:En,secondaryWallets:Cn,setPrimaryWallet:An,setShowQrcodeModal:Vr,showQrcodeModal:Gr,wallets:Qr}},ConfirmationModal=({modalId:fr,closeModal:br,show:wr,zIndex:Er,handleOnModalUnmount:kr,children:jr})=>jsxRuntimeExports.jsx(Portal$4,{elementId:fr,handleClose:br,isShown:wr,zIndex:Er??authModalZIndex+1,withBackdrop:!0,transitionEvents:{onUnmount:kr},children:jsxRuntimeExports.jsx(Modal$1,{children:jsxRuntimeExports.jsx(ModalCard,{children:jr})})}),useConfirmationPortal=({onResolve:fr,onReject:br,defaultErrorMessage:wr})=>{usePreventPageScroll(!0);const[Er,kr]=reactExports.useState(!0),jr=reactExports.useRef(null),Br=reactExports.useRef(null),Wr=reactExports.useCallback(()=>{kr(!1)},[kr]),qr=reactExports.useCallback(()=>{if(Br.current)return fr(Br.current);const Zr=jr.current||new DynamicError(wr||"Something went wrong");return br(Zr)},[fr,br,wr]);return{closeModal:Wr,handleOnModalUnmount:qr,onError:(Zr,Jr=!1)=>{Br.current=null,jr.current=Zr,Jr&&Wr()},onSuccess:(Zr,Jr=!0)=>{jr.current=null,Br.current=Zr,Jr&&Wr()},show:Er}},CreatePasswordModal=({onResolve:fr,onReject:br,closeView:wr})=>{const{onSuccess:Er,onError:kr,show:jr,handleOnModalUnmount:Br,closeModal:Wr}=useConfirmationPortal({defaultErrorMessage:"User canceled",onReject:br,onResolve:fr});return jsxRuntimeExports.jsx(ConfirmationModal,{modalId:"create-password-modal",show:jr,closeModal:Wr,handleOnModalUnmount:Br,children:jsxRuntimeExports.jsx(CreatePasswordView,{closeView:wr,onSuccess:Er,onError:kr})})},EnterPasswordView=({mutation:fr,onSuccess:br,onError:wr,closeView:Er=!0})=>{const{setShowAuthFlow:kr}=useInternalDynamicContext(),[jr,Br]=reactExports.useState(""),[Wr,qr]=reactExports.useState("password"),{t:Gr}=useTranslation(),{mutate:Vr,isLoading:Zr,hasError:Jr}=useMutation(()=>fr(jr),{onFailure:wr,onSuccess:()=>{Er&&kr(!1),br==null||br(jr)}}),Qr=()=>{if(wr){wr==null||wr(Gr("dyn_enter_password.error.invalid_password"));return}kr(!1)},_n=Jr?Gr("dyn_enter_password.error.invalid_password"):void 0,En=jsxRuntimeExports.jsx(IconButton,{onClick:Qr,type:"button",children:jsxRuntimeExports.jsx(SvgClose,{})}),Cn=jsxRuntimeExports.jsx(ToggleVisibilityButton,{initialState:Wr==="password",onClick:An=>qr(An?"password":"text"),className:"enter-password-view__password-input__suffix-icon"}),In=An=>{const jn=An.target.value;Br(jn)};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:En,children:jsxRuntimeExports.jsx(Typography,{as:"h1",variant:"title",color:"primary",className:"header__typography",copykey:"dyn_enter_password.title",children:Gr("dyn_enter_password.title")})}),jsxRuntimeExports.jsx("div",{className:"enter-password-view",children:jsxRuntimeExports.jsxs("form",{className:"enter-password-view__body",onSubmit:An=>{An.preventDefault(),Vr()},children:[jsxRuntimeExports.jsx("div",{className:"enter-password-view__body__icon",children:jsxRuntimeExports.jsx(SvgPasswordHero,{})}),jsxRuntimeExports.jsx("div",{className:"enter-password-view__body__description",children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",weight:"regular",color:"secondary",copykey:"dyn_enter_password.description",children:Gr("dyn_enter_password.description")})}),!!_n&&jsxRuntimeExports.jsx(ErrorContainer,{copykey:"dyn_enter_password.error",children:_n}),jsxRuntimeExports.jsx("div",{children:jsxRuntimeExports.jsx(Input,{id:"password",placeholder:Gr("dyn_enter_password.input.placeholder"),type:Wr,suffix:Cn,label:Gr("dyn_enter_password.input.label"),value:jr,onChange:In,copykey:"dyn_enter_password.input"})}),jsxRuntimeExports.jsx(TypographyButton,{buttonPadding:"large",buttonVariant:"brand-primary",typographyProps:{color:"inherit"},disabled:!jr&&!_n,loading:Zr,copykey:"dyn_enter_password.continue_button_label",type:"submit",children:Gr("dyn_enter_password.continue_button_label")})]})})]})},EnterPasswordModal=({handler:fr,onResolve:br,onReject:wr,closeView:Er})=>{const{onSuccess:kr,onError:jr,show:Br,handleOnModalUnmount:Wr,closeModal:qr}=useConfirmationPortal({defaultErrorMessage:"User canceled",onReject:wr,onResolve:br});return jsxRuntimeExports.jsx(ConfirmationModal,{modalId:"enter-password-modal",show:Br,closeModal:qr,handleOnModalUnmount:Wr,children:jsxRuntimeExports.jsx(EnterPasswordView,{mutation:fr,closeView:Er,onSuccess:kr,onError:jr})})},AppOriginTile=({appLogoUrl:fr,appName:br,appOrigin:wr})=>{const Er=reactExports.useRef(null),[kr,jr]=reactExports.useState(!1);return reactExports.useLayoutEffect(()=>{if(Er.current){const{width:Br,height:Wr}=Er.current.getBoundingClientRect();Br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose$1(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgSignCircle=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties$1(br,_excluded$1);return reactExports.createElement("svg",_extends$1({width:64,height:64,viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_circle||(_circle=reactExports.createElement("circle",{cx:32,cy:32,r:32,fill:"currentColor"})),_path$1||(_path$1=reactExports.createElement("path",{d:"M34.048 17.611a5.5 5.5 0 1 1 7.779 7.779l-.611.61.193.193a4.5 4.5 0 0 1 0 6.364l-3.238 3.239a1.125 1.125 0 0 1-1.592-1.591l3.239-3.239a2.25 2.25 0 0 0 0-3.182l-.193-.193-12.704 12.705a1.123 1.123 0 0 1-.523.296l-9 2.25a1.125 1.125 0 0 1-1.34-1.447l2.812-8.438c.055-.166.148-.316.272-.44l14.906-14.906Zm6.188 1.591a3.25 3.25 0 0 0-4.597 0L20.921 33.92l-2.08 6.242 6.709-1.678 14.686-14.686a3.25 3.25 0 0 0 0-4.596ZM24.925 47.375c-2.779 0-4.967-1.275-6.424-2.49l2.89-.723c1.003.562 2.19.963 3.534.963.912 0 1.853-.369 2.856-1.028 1.005-.66 1.976-1.546 2.956-2.465l.255-.24c.865-.812 1.764-1.658 2.624-2.242.918-.624 2.135-1.191 3.413-.7.844.325 1.393.925 1.78 1.658.362.687.612 1.548.855 2.485.111.427.3.841.515 1.12.105.137.196.214.26.253.055.034.08.034.086.034.274 0 .745-.185 1.417-.643.417-.284.774-.568 1.13-.852.221-.177.443-.354.679-.53.628-.47 1.171-.785 1.57-.986a6.86 6.86 0 0 1 .625-.28l.045-.016.016-.006.006-.002h.003s.002-.002.359 1.065l-.357-1.067a1.125 1.125 0 0 1 .721 2.132l-.008.003a4.59 4.59 0 0 0-.394.178 8.472 8.472 0 0 0-1.238.78c-.132.098-.304.235-.5.391-.409.324-.921.73-1.39 1.05-.7.476-1.67 1.033-2.684 1.033-.98 0-1.69-.595-2.127-1.162-.447-.578-.746-1.29-.912-1.93-.247-.95-.442-1.573-.667-2-.201-.38-.383-.525-.598-.608-.184-.07-.552-.075-1.34.46-.704.48-1.472 1.2-2.38 2.053l-.225.211c-.97.91-2.071 1.922-3.26 2.703-1.19.783-2.566 1.398-4.091 1.398Z",fill:"#fff"})))};const isSignTypedData=fr=>{if(typeof fr!="object"||fr===null)return!1;const{types:br,message:wr,primaryType:Er}=fr;return typeof br=="object"&&br!==null&&typeof wr=="object"&&wr!==null&&typeof Er=="string"},isRawMessage=fr=>typeof fr!="object"||fr===null?!1:typeof fr.raw=="string",SignTypedDataPreview=({currentType:fr,types:br,showTypeName:wr=!1,data:Er})=>{const kr=br[fr].map(jr=>{var Br;const Wr=jr.type.replace("[]",""),qr=jr.type.endsWith("[]"),Gr=Wr in br;if(qr&&Gr)return jsxRuntimeExports.jsx(TypeSection,{title:capitalize$1(jr.name),children:(Br=Er==null?void 0:Er[jr.name])===null||Br===void 0?void 0:Br.map((Jr,Qr)=>jsxRuntimeExports.jsx(TypeSection,{title:Qr.toString(),children:jsxRuntimeExports.jsx(SignTypedDataPreview,{currentType:Wr,types:br,data:Jr})},Qr))},jr.name);if(Gr)return jsxRuntimeExports.jsx(TypeSection,{title:capitalize$1(jr.name),children:jsxRuntimeExports.jsx(SignTypedDataPreview,{currentType:Wr,types:br,data:Er==null?void 0:Er[jr.name]})},jr.name);const Vr=Er==null?void 0:Er[jr.name],Zr=jr.type;return jsxRuntimeExports.jsx(FieldRow,{name:capitalize$1(jr.name),data:Vr,displayValue:Zr==="address"?shortenWalletAddress(Vr,4,4):Vr},jr.name)});return wr?jsxRuntimeExports.jsx(TypeSection,{title:fr,children:kr}):jsxRuntimeExports.jsx("div",{className:"sign-typed-data-preview--fields-list",children:kr})},TypeTitle=({children:fr})=>jsxRuntimeExports.jsx(Typography,{color:"secondary",weight:"medium",children:fr}),AttributeName=TypeTitle,AttributeValue=({children:fr,title:br})=>jsxRuntimeExports.jsx(Typography,{as:"span",weight:"regular",color:"primary",title:br,children:fr}),PaddedContent=({children:fr})=>jsxRuntimeExports.jsx("div",{className:"sign-typed-data-preview--type-container",children:fr}),TypeSection=({title:fr,children:br})=>jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx(TypeTitle,{children:fr}),jsxRuntimeExports.jsx(PaddedContent,{children:br})]}),FieldRow=({name:fr,displayValue:br,data:wr})=>jsxRuntimeExports.jsxs("div",{className:"sign-typed-data-preview--attribute-row",children:[jsxRuntimeExports.jsxs(AttributeName,{children:[capitalize$1(fr),": "]}),jsxRuntimeExports.jsx(AttributeValue,{title:wr,children:br})]}),containsSpecialCharacters=fr=>/[^ -~\s]/.test(fr),SignMessagePreview=({message:fr})=>{const br=reactExports.useMemo(()=>{try{return JSON.parse(fr)}catch{return}},[fr]),wr=reactExports.useMemo(()=>{const Er=isRawMessage(br)?br.raw:fr,kr=isHex$2(Er)?hexToString$1(Er):Er;return containsSpecialCharacters(kr)?Er:kr},[br,fr]);return isSignTypedData(br)?jsxRuntimeExports.jsx(SignTypedDataPreview,{currentType:br.primaryType,types:br.types,showTypeName:!0,data:br.message}):jsxRuntimeExports.jsx(Typography,{color:"primary",variant:"body_normal",children:jsxRuntimeExports.jsx("span",{style:{whiteSpace:"pre-line"},children:wr})})},SignMessageConfirmationModal=({appLogoUrl:fr,appName:br,message:wr,handler:Er,onReject:kr,onSignMessage:jr,hideModal:Br})=>{usePreventPageScroll(!0);const Wr=reactExports.useRef(!1),[qr,Gr]=reactExports.useState(!0),{initPasskeyRecoveryProcess:Vr,shouldInitRecovery:Zr}=usePasskeyRecovery(),{isTurnkeyWallet:Jr}=useIsTurnkeyWallet(),{setShowAuthFlow:Qr,primaryWallet:_n}=useInternalDynamicContext(),{setView:En}=useViewContext(),{userNeedsCrossDomainPasskey:Cn}=usePasskeyContext(),{t:In}=useTranslation(),{getEOAWallet:An}=useSmartWallets(),jn=_n&&An(_n),eo=reactExports.useCallback(()=>{Wr.current=!1,Gr(!1)},[Gr]),{isLoading:ro,mutate:to,data:_i,error:oo}=useMutation(()=>Er(wr),{onSuccess:()=>{Wr.current=!0,Gr(!1)}}),io=reactExports.useMemo(()=>{if(oo){if(oo instanceof DynamicError)return oo.message;try{return getProperErrorMessage(oo)}catch(Tn){Tn instanceof AccessBlockedError&&En("access-blocked");return}}},[oo,En]),co=reactExports.useCallback(()=>{if(_i)return jr(_i);kr(oo||new UserRejectedRequestError$1)},[_i,jr,kr,oo]),so=Tn=>__awaiter$e(void 0,void 0,void 0,function*(){const Hr=_n&&isSessionKeyCompatibleWallet(_n)||jn&&isSessionKeyCompatibleWallet(jn);if((yield Zr())&&!Hr&&(yield Vr("email","signMessage")),Tn===!0){jr("callHandlerOutsideModal");return}if(Hr){to();return}if(Jr&&Cn){En("passkey-new-domain-detected"),Qr(!0,{ignoreIfIsEmbeddedWidget:!1,performMultiWalletChecks:!1}),dynamicEvents.once("passkeyRecoveryCompleted",()=>{to()});return}to()});useEffectOnce(()=>{Br&&so(!0)});const no=jsxRuntimeExports.jsx(IconButton,{type:"button",onClick:eo,"data-testid":"close",disabled:ro,children:jsxRuntimeExports.jsx(SvgClose,{})});return Br?null:jsxRuntimeExports.jsx(Portal$4,{handleClose:eo,isShown:qr,zIndex:authModalZIndex,withBackdrop:!0,elementId:"dynamic-sign-message",transitionEvents:{onUnmount:co},children:jsxRuntimeExports.jsx(Modal$1,{children:jsxRuntimeExports.jsxs(ModalCard,{children:[jsxRuntimeExports.jsx(ModalHeader,{trailing:no,alignContent:"bottom",children:jsxRuntimeExports.jsx(IconWithSpinner,{Icon:Tn=>jsxRuntimeExports.jsx(Icon,{color:"brand-primary",children:jsxRuntimeExports.jsx(SvgSignCircle,Object.assign({},Tn))}),iconSize:64,isSpinning:!0})}),jsxRuntimeExports.jsx(PasskeyCreatedSuccessBanner,{}),jsxRuntimeExports.jsxs("div",{className:"sign-message-confirmation__body",children:[jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary",className:"sign-message-confirmation__title",copykey:"dyn_sign_message.title",children:In("dyn_sign_message.title")}),jsxRuntimeExports.jsx(AnimatePresence,{animationComponent:jsxRuntimeExports.jsx(VerticalDrawerTransition,{}),children:oo&&jsxRuntimeExports.jsx("div",{className:"sign-message-confirmation__error",children:jsxRuntimeExports.jsx(ErrorContainer,{children:io})})}),jsxRuntimeExports.jsxs("div",{className:"sign-message-confirmation__message-container",children:[jsxRuntimeExports.jsx(AppOriginTile,{appLogoUrl:fr,appName:br,appOrigin:PlatformService.getDisplayOrigin()}),jsxRuntimeExports.jsx("div",{className:"sign-message-confirmation__message",children:jsxRuntimeExports.jsx(SignMessagePreview,{message:wr.toString().replace(/^"(.*)"$/,"$1").replace(/\\n/g,` `)})})]}),jsxRuntimeExports.jsxs("div",{className:"sign-message-confirmation__actions",children:[jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"secondary",onClick:eo,expanded:!0,buttonPadding:"large",disabled:ro,copykey:"dyn_sign_message.cancel_button",children:In("dyn_sign_message.cancel_button")}),jsxRuntimeExports.jsx(TypographyButton,{buttonVariant:"primary",buttonPadding:"large",onClick:so,expanded:!0,loading:ro,copykey:"dyn_sign_message.sign_button",dataTestId:"sign-button",children:In("dyn_sign_message.sign_button")})]}),jsxRuntimeExports.jsx(NeedHelpSection,{}),jsxRuntimeExports.jsx(PoweredByDynamic,{})]})]})})})},WidgetPortal=({children:fr,onClose:br,disablePadding:wr,portalClassName:Er,portalContainerClassName:kr})=>jsxRuntimeExports.jsx("div",{className:classNames$1(Er,"widget-portal"),onClick:br,"data-testid":"backdrop",children:jsxRuntimeExports.jsxs("div",{className:classNames$1(kr,"widget-portal__container",{"widget-portal__container--no-padding":wr}),onClick:jr=>jr.stopPropagation(),children:[br&&jsxRuntimeExports.jsx("div",{className:"widget-portal__container__header",children:jsxRuntimeExports.jsx(IconButton,{className:"widget-portal__container__close-button",onClick:jr=>br(jr),type:"button","data-testid":"close-button",children:jsxRuntimeExports.jsx(SvgClose,{})})}),fr]})}),DefaultPromptLayout=({children:fr,className:br="",dataTestId:wr="",icon:Er,showSpinnerInIcon:kr=!0,title:jr})=>jsxRuntimeExports.jsxs("div",{className:classNames$1("default-prompt-modal",br),"data-testid":wr,children:[Er&&jsxRuntimeExports.jsx(IconWithSpinner,{Icon:Er,iconSize:96,isSpinning:kr,className:"default-prompt-modal__icon-with-spinner"}),jsxRuntimeExports.jsxs("div",{className:"default-prompt-modal__content",children:[jr&&jsxRuntimeExports.jsx(Typography,{variant:"title",color:"primary","data-testid":"title",children:jr}),fr]})]}),DefaultPromptModal=fr=>jsxRuntimeExports.jsx(WidgetPortal,{onClose:fr.onClose,portalClassName:"prompt-modal-portal",portalContainerClassName:"prompt-modal-portal__container",children:jsxRuntimeExports.jsx(DefaultPromptLayout,Object.assign({},fr))});var _path,_excluded=["title","titleId"];function _extends(){return _extends=Object.assign?Object.assign.bind():function(fr){for(var br=1;br=0)&&Object.prototype.propertyIsEnumerable.call(fr,Er)&&(wr[Er]=fr[Er])}return wr}function _objectWithoutPropertiesLoose(fr,br){if(fr==null)return{};var wr={},Er=Object.keys(fr),kr,jr;for(jr=0;jr=0)&&(wr[kr]=fr[kr]);return wr}var SvgArrowCircleRight=function(br){var wr=br.title,Er=br.titleId,kr=_objectWithoutProperties(br,_excluded);return reactExports.createElement("svg",_extends({width:24,height:24,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-labelledby":Er},kr),wr?reactExports.createElement("title",{id:Er},wr):null,_path||(_path=reactExports.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16ZM2 12C2 6.477 6.477 2 12 2s10 4.477 10 10-4.477 10-10 10S2 17.523 2 12Zm10.293-3.707a1 1 0 0 1 1.414 0l3 3a1 1 0 0 1 0 1.414l-3 3a1 1 0 0 1-1.414-1.414L13.586 13H8a1 1 0 1 1 0-2h5.586l-1.293-1.293a1 1 0 0 1 0-1.414Z",fill:"#ABACB2"})))};const SwitchWalletView=({onCancel:fr,connector:br,expectedAddress:wr,activeAddress:Er})=>{const{t:kr}=useTranslation();return jsxRuntimeExports.jsx(DefaultPromptModal,{dataTestId:"switch-wallet",className:"switch-wallet",icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:br.key}),title:kr("dyn_sync_wallet.switch_wallet.title"),onClose:fr,children:jsxRuntimeExports.jsxs("div",{className:"switch-wallet__body",children:[Er&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Typography,{variant:"body_mini",color:"secondary",weight:"regular",copykey:"dyn_sync_wallet.switch_wallet.active_address.heading",children:kr("dyn_sync_wallet.switch_wallet.active_address.heading")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"regular",children:shortenWalletAddress(Er,3,3)}),jsxRuntimeExports.jsx(Divider,{className:"switch-wallet__body__divider",children:jsxRuntimeExports.jsx(SvgArrowCircleRight,{})})]}),jsxRuntimeExports.jsx(Typography,{variant:"body_mini",color:"secondary",weight:"regular",copykey:"dyn_sync_wallet.switch_wallet.expected_address.heading",children:kr("dyn_sync_wallet.switch_wallet.expected_address.heading")}),jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"primary",weight:"regular",copykey:"dyn_sync_wallet.switch_wallet.expected_address.prompt",className:"switch-wallet__body__expected-address__prompt",children:kr("dyn_sync_wallet.switch_wallet.expected_address.prompt")}),jsxRuntimeExports.jsx(Typography,{color:"green-1",weight:"bold",className:"switch-wallet__body__expected-address__address",children:shortenWalletAddress(wr,3,3)})]})})},ReconnectWithQrCodeView=({onCancel:fr,onSuccess:br,connector:wr,expectedAddress:Er})=>{var kr;const{t:jr}=useTranslation(),{walletBook:Br}=useWalletBookContext(),{theme:{theme:Wr}}=useThemeContext(),{name:qr}=Wr,[Gr,Vr]=reactExports.useState(),[Zr,Jr]=reactExports.useState();return usePromise(()=>__awaiter$e(void 0,void 0,void 0,function*(){const Qr=yield wr.getAddress({onDesktopUri:_n=>__awaiter$e(void 0,void 0,void 0,function*(){Jr(_n)}),onDisplayUri:_n=>__awaiter$e(void 0,void 0,void 0,function*(){Vr(_n)})});if(Qr&&isSameAddress$1(Qr,Er,wr.connectedChain)){br();return}wr.endSession(),fr()}),{deps:[wr],retries:3}),jsxRuntimeExports.jsx(DefaultPromptModal,{dataTestId:"reconnect-qr-code",title:jr("dyn_sync_wallet.reconnect_with_qr_code.title"),onClose:fr,children:Gr&&jsxRuntimeExports.jsx(QrCodeWrapper,{uri:Gr,desktopUri:Zr,accentColor:qr==="dark"?Wr.colors.textPrimary:(kr=getWalletPrimaryColor(Br,wr.key))!==null&&kr!==void 0?kr:"",icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:wr==null?void 0:wr.key}),showCopyToClipboardButton:!0,walletConnector:wr})})},reconnectSocialWallet=(fr,br,wr,Er)=>__awaiter$e(void 0,void 0,void 0,function*(){if(!isSocialWalletConnector(br))return;const kr=fr==null?void 0:fr.verifiedCredentials.find(jr=>jr.format===JwtVerifiedCredentialFormatEnum.Oauth&&jr.address&&isSameAddress$1(jr.address,wr,Er));!kr||!kr.oauthProvider||(yield br.connect(kr.oauthProvider))}),AutoReconnectingView=({onCancel:fr,onSuccess:br,connector:wr,expectedAddress:Er})=>{const{t:kr}=useTranslation(),{user:jr}=useInternalDynamicContext();return usePromise(()=>__awaiter$e(void 0,void 0,void 0,function*(){isSocialWalletConnector(wr)&&(yield reconnectSocialWallet(jr,wr,Er,wr.connectedChain),br())}),{deps:[wr]}),jsxRuntimeExports.jsx(DefaultPromptModal,{dataTestId:"auto-reconnecting",icon:jsxRuntimeExports.jsx(WalletIcon,{walletKey:wr==null?void 0:wr.key}),title:kr("dyn_sync_wallet.reconnecting.title"),onClose:fr,children:jsxRuntimeExports.jsx(Typography,{variant:"body_normal",color:"secondary",weight:"regular",children:kr("dyn_sync_wallet.reconnecting.description",{walletAddress:shortenWalletAddress(Er,3,3)})})})},SyncWalletView=({onSuccess:fr,onError:br,expectedAddress:wr,activeAddress:Er,connector:kr})=>{const jr=kr.canConnectViaQrCode&&!kr.isInstalledOnBrowser()&&!kr.canConnectViaCustodialService;logger$6.logVerboseTroubleshootingMessage("[SyncWallet]",{canConnectViaCustodialService:kr.canConnectViaCustodialService,canConnectViaQrCode:kr.canConnectViaQrCode,isEmbeddedWallet:kr.isEmbeddedWallet,isInstalledOnBrowser:kr.isInstalledOnBrowser()}),useWalletConnectorEvent(kr,"accountChange",({accounts:qr})=>{logger$6.logVerboseTroubleshootingMessage("[SyncWallet] accountChange",{accounts:qr,expectedAddress:wr});const[Gr]=qr;isSameAddress$1(Gr,wr,kr.connectedChain)&&fr(!0)}),useInternalDynamicEvents("logout",()=>br(new Error("user logged out"),!0));const Br=()=>__awaiter$e(void 0,void 0,void 0,function*(){const qr=yield kr.getAddress();qr&&isSameAddress$1(qr,wr,kr.connectedChain)&&fr(!0)}),Wr=()=>{logger$6.logVerboseTroubleshootingMessage("[SyncWallet] handleCancel called"),br(new DynamicError("User cancelled","0"),!0)};return kr.isEmbeddedWallet?jsxRuntimeExports.jsx("div",{className:"sync-wallet-view","data-testid":"sync-wallet",children:jsxRuntimeExports.jsx(AutoReconnectingView,{connector:kr,expectedAddress:wr,onCancel:Wr,onSuccess:()=>fr(!0)})}):jr?jsxRuntimeExports.jsx("div",{className:"sync-wallet-view","data-testid":"sync-wallet",children:jsxRuntimeExports.jsx(ReconnectWithQrCodeView,{connector:kr,expectedAddress:wr,onCancel:Wr,onSuccess:()=>fr(!0)})}):jsxRuntimeExports.jsx("div",{className:"sync-wallet-view","data-testid":"sync-wallet",children:jsxRuntimeExports.jsx(SwitchWalletView,{connector:kr,expectedAddress:wr,activeAddress:Er,onCancel:Wr,onTryToReconnect:Br})})},SyncWalletPromptModal=({expectedAddress:fr,connector:br,onResolve:wr,onReject:Er,activeAddress:kr})=>{const{onSuccess:jr,onError:Br,show:Wr,handleOnModalUnmount:qr}=useConfirmationPortal({defaultErrorMessage:"User canceled",onReject:Er,onResolve:wr});return jsxRuntimeExports.jsx(ConfirmationModal,{modalId:"sync-wallet-modal",show:Wr,closeModal:()=>{},handleOnModalUnmount:qr,children:jsxRuntimeExports.jsx(SyncWalletView,{onSuccess:jr,onError:Br,expectedAddress:fr,connector:br,activeAddress:kr})})},TransactionConfirmationModal=({title:fr,onReject:br,onTransactionResponseSuccess:wr,transaction:Er,copykey:kr,walletConnector:jr,hideModal:Br,isNativeToken:Wr,currentToken:qr})=>{usePreventPageScroll(!0);const[Gr,Vr]=reactExports.useState(!0),Zr=reactExports.useRef(null),Jr=reactExports.useRef(null),Qr=reactExports.useCallback(()=>{Vr(!1)},[Vr]),_n=reactExports.useCallback(()=>Jr.current?wr(Jr.current):br(Zr.current||new UserRejectedTransactionError),[wr,br]);return jsxRuntimeExports.jsx(Portal$4,{handleClose:Qr,isShown:Gr,zIndex:authModalZIndex,withBackdrop:!0,elementId:"dynamic-send-transaction",transitionEvents:{onUnmount:_n},children:jsxRuntimeExports.jsx(Modal$1,{children:jsxRuntimeExports.jsx(ModalCard,{children:jsxRuntimeExports.jsx(TransactionConfirmationView,{transaction:Er,title:fr,copykey:kr,hideModal:Br,mutation:()=>Er.submit(),onClickClose:Qr,onError:En=>Zr.current=En,displayPoweredByDynamicFooter:!0,walletConnector:jr,onSuccess:En=>{Zr.current=null,Jr.current=En,Qr()},isNativeToken:Wr,currentToken:qr,isModal:!0})})})})},useWalletUiUtils=({appLogoUrl:fr,appName:br,hideEmbeddedWalletTransactionUIs:wr=!1})=>{const Er=reactExports.useRef("enabled"),{t:kr}=useTranslation(),{modal:jr,open:Br}=useConfirmationModal({elementId:"dynamic-send-transaction"}),{modal:Wr,open:qr}=useConfirmationModal({elementId:"dynamic-sign-message"}),{modal:Gr,open:Vr}=useConfirmationModal({elementId:"dynamic-enter-password"}),{modal:Zr,open:Jr}=useConfirmationModal({elementId:"dynamic-create-password"}),{modal:Qr,open:_n}=useConfirmationModal({elementId:"dynamic-sync-wallet"}),En=reactExports.useCallback(()=>Er.current==="disabled"?(Er.current="enabled",!1):!0,[Er]),Cn=reactExports.useCallback(oo=>__awaiter$e(void 0,[oo],void 0,function*({walletConnector:io,message:co,handler:so}){return En()?qr((no,Tn)=>jsxRuntimeExports.jsx(SignMessageConfirmationModal,{appLogoUrl:fr,appName:br,message:co,handler:so,onSignMessage:no,onReject:Tn,hideModal:wr&&!(io!=null&&io.isGlobalTransaction)})).then(no=>__awaiter$e(void 0,void 0,void 0,function*(){return no==="callHandlerOutsideModal"?so():no})):so()}),[fr,br,wr,qr,En]),In=reactExports.useCallback((oo,io)=>__awaiter$e(void 0,void 0,void 0,function*(){return En()?Br((co,so)=>jsxRuntimeExports.jsx(TransactionConfirmationModal,{copykey:"dyn_send_transaction.confirmation.title",title:kr("dyn_send_transaction.confirmation.title"),transaction:io,onTransactionResponseSuccess:co,onReject:so,walletConnector:oo,hideModal:wr&&!(oo!=null&&oo.isGlobalTransaction)})).then(co=>__awaiter$e(void 0,void 0,void 0,function*(){return co==="callHandlerOutsideModal"?io.submit():co})):io.submit()}),[wr,Br,En,kr]),An=reactExports.useCallback((oo,io)=>__awaiter$e(void 0,void 0,void 0,function*(){return En()?Br((co,so)=>jsxRuntimeExports.jsx(TransactionConfirmationModal,{copykey:"dyn_send_transaction.confirmation.title",title:kr("dyn_send_transaction.confirmation.title"),transaction:io,onTransactionResponseSuccess:co,onReject:so,walletConnector:oo,hideModal:wr&&!(oo!=null&&oo.isGlobalTransaction)})).then(co=>__awaiter$e(void 0,void 0,void 0,function*(){return co==="callHandlerOutsideModal"?io.submit():co})):io.submit()}),[wr,Br,En,kr]),jn=reactExports.useCallback(oo=>__awaiter$e(void 0,[oo],void 0,function*({handler:io,closeView:co=!0}){return Vr((so,no)=>jsxRuntimeExports.jsx(EnterPasswordModal,{handler:io,onResolve:so,onReject:no,closeView:co}))}),[Vr]),eo=reactExports.useCallback(oo=>__awaiter$e(void 0,[oo],void 0,function*({closeView:io=!0}){return Jr((co,so)=>jsxRuntimeExports.jsx(CreatePasswordModal,{onResolve:co,onReject:so,closeView:io}))}),[Jr]),ro=reactExports.useCallback(oo=>__awaiter$e(void 0,[oo],void 0,function*({walletConnector:io,activeAddress:co,expectedAddress:so}){yield _n((no,Tn)=>jsxRuntimeExports.jsx(SyncWalletPromptModal,{onResolve:no,onReject:Tn,connector:io,expectedAddress:so,activeAddress:co}))}),[_n]),to=reactExports.useCallback(()=>{Er.current="disabled"},[]),_i=reactExports.useMemo(()=>({createPassword:eo,disabledConfirmationOnce:to,enterPassword:jn,sendTransaction:In,signMessage:Cn,signTransaction:An,syncWallet:ro}),[Cn,An,to,In,jn,eo,ro]);return reactExports.useMemo(()=>[Wr||jr||Gr||Zr||Qr,_i],[Wr,jr,Gr,Zr,Qr,_i])},useSetWalletConnectorFetchers=(fr,br)=>{const{registerEmbeddedWalletSessionKey:wr,removeSessionKey:Er}=useEmbeddedWalletSessionKeys(br);if(!(fr!=null&&fr.length))return;const{fetchAuthToken:kr,fetchBackupCode:jr,fetchPasscode:Br}=getCoinbaseMPCConnectorFetchers({environmentId:br});fr.forEach(Wr=>{var qr,Gr;isCoinbaseMpcWalletConnector(Wr.walletConnector)&&(Wr.walletConnector.setAuthTokenFetcher(kr),Wr.walletConnector.setBackupCodeFetcher(jr),Wr.walletConnector.setPasscodeFetcher(Br)),isSessionKeyCompatibleWalletConnector(Wr.walletConnector)&&((qr=Wr.walletConnector)===null||qr===void 0||qr.setSessionKeyFetcher(wr),(Gr=Wr.walletConnector)===null||Gr===void 0||Gr.setSessionKeyRemoveFunction(()=>Er()))})},useSendDynamicProps=({settings:fr,environmentId:br})=>{useEffectOnce(()=>{const wr={settings:Object.assign(Object.assign({},fr),{customPrivacyPolicy:!!fr.customPrivacyPolicy,customTermsOfServices:!!fr.customTermsOfServices,policiesConsentInnerComponent:!!fr.policiesConsentInnerComponent})},Er=serializeEventsCallbacks(fr.events),kr=serializeWalletConnectors(fr.walletConnectors),jr=Object.assign(Object.assign({},wr),{settings:Object.assign(Object.assign({},wr.settings),{events:Er,walletConnectors:kr})});sendDynamicProps(br,{dynamicContextProps:jr,frameworkSettings:getFrameworkSettings()})})},serializeEventsCallbacks=fr=>{try{if(!fr)return;const br=Object.values(fr);return Object.keys(fr).filter((Er,kr)=>br[kr]===void 0?!1:Er)}catch(br){logger$6.error("error serializing events",br);return}},getFrameworkSettings=()=>{var fr;return{nextJs:{version:(fr=window.next)===null||fr===void 0?void 0:fr.version},react:{version:reactExports.version}}},useResetCookieLocalStorage=({environmentId:fr,projectSettings:br,setPrimaryWalletId:wr})=>{const Er=reactExports.useRef(!0),kr=reactExports.useRef(!1),jr=getUser(),Br=reactExports.useRef(!1);return useInternalDynamicEvents("logout",()=>Br.current=!0),reactExports.useEffect(()=>{const Wr=()=>__awaiter$e(void 0,void 0,void 0,function*(){if(!jr&&isCookieEnabled$1()&&!Br.current){kr.current=!0;try{const qr=yield refreshUserJwt({environmentId:fr}),Gr=qr==null?void 0:qr.verifiedCredentials.find(Vr=>Vr.format===JwtVerifiedCredentialFormatEnum.Blockchain&&Vr.id===qr.lastVerifiedCredentialId);Gr&&wr(Gr.id)}catch{logger$6.debug("Ignore failed refreshUserJwt in useResetCookieLocalStorage")}}br&&(Er.current=!1)});kr.current||Wr()},[jr,br,fr,wr]),{isLoading:Er.current}},useSyncEmbeddedWalletFlow=()=>{const{projectSettings:fr,user:br,primaryWalletId:wr,walletConnectorOptions:Er,setShowAuthFlow:kr}=useInternalDynamicContext(),{isLoadingEmbeddedWallet:jr}=useWalletContext(),{loading:Br}=useLoadingContext(),{createEmbeddedWallet:Wr,shouldAutoCreateEmbeddedWallet:qr}=useEmbeddedWallet(),Gr=reactExports.useRef(!1);useInternalDynamicEvents("logout",()=>{Gr.current=!1}),reactExports.useEffect(()=>{const Vr=()=>__awaiter$e(void 0,void 0,void 0,function*(){Gr.current=!0;try{yield Wr()}catch(Jr){Jr instanceof EmbeddedWalletException?logger$6.debug("Error creating embedded wallet",Jr):logger$6.error("Error creating embedded wallet",Jr),kr(!1)}});!qr()||!br||!fr||!Er.length||jr||Br||Gr.current||Vr()},[br,fr,wr,Wr,jr,Er,Br,qr,kr])},useSyncOnboardingFlow=({handler:fr}={})=>{const{setShowAuthFlow:br,userWithMissingInfo:wr,sdkHasLoaded:Er,setSelectedWalletConnectorKey:kr}=useInternalDynamicContext(),{setView:jr}=useViewContext(),{updateUser:Br}=useUserUpdateRequestInternal({validationSchemaStripUnknown:!1}),{completeAuth:Wr,handleAuthError:qr}=useUserAuth({}),{displayedDestination:Gr}=useVerification(),Vr=reactExports.useRef(!1);useInternalDynamicEvents("logout",()=>{Vr.current=!1}),reactExports.useEffect(()=>{var Zr;const Jr=()=>__awaiter$e(void 0,void 0,void 0,function*(){var _n;if(!(!fr||!(!((_n=wr==null?void 0:wr.missingFields)===null||_n===void 0)&&_n.length))){Vr.current=!0;try{const En=wr.missingFields.map(jn=>({isCustom:jn.type==="custom",key:jn.name,label:jn.label,required:jn.required})),Cn=yield fr(En),In={},An=Object.assign({},wr==null?void 0:wr.metadata);Cn.forEach(jn=>{jn.isCustom?An[jn.key]=jn.value:In[jn.key]=jn.value}),yield Wr({updateJwtFunction:()=>__awaiter$e(void 0,void 0,void 0,function*(){return Br(Object.assign(Object.assign({},In),{metadata:An}))})})}catch(En){logger$6.error("Error handling user onboarding",En),qr(En,{})}}}),Qr=()=>__awaiter$e(void 0,void 0,void 0,function*(){Vr.current=!0,br(!0);const _n=wr==null?void 0:wr.verifiedCredentials.find(En=>En.id===(wr==null?void 0:wr.lastVerifiedCredentialId));switch(_n!=null&&_n.walletName&&kr(_n==null?void 0:_n.walletName),_n==null?void 0:_n.format){case JwtVerifiedCredentialFormatEnum.Email:case JwtVerifiedCredentialFormatEnum.Oauth:jr("collect-user-data-login-no-wallet",{userIdentification:"email"});break;case JwtVerifiedCredentialFormatEnum.PhoneNumber:jr("collect-user-data-login-no-wallet",{userIdentification:"phoneNumber",userIdentificationOverride:Gr});break;default:jr("collect-user-data")}});if(!(!Er||Vr.current||!(!((Zr=wr==null?void 0:wr.missingFields)===null||Zr===void 0)&&Zr.length)||hasPendingMfaAction(wr))){if(fr){Jr();return}Qr()}},[Er,wr,fr,Wr,Br,br,jr,Gr,qr,kr])},useSyncMfaFlow=({handler:fr}={})=>{const{setShowAuthFlow:br,userWithMissingInfo:wr,sdkHasLoaded:Er}=useInternalDynamicContext(),{setView:kr}=useViewContext(),{getUserDevices:jr}=useMfa(),Br=reactExports.useRef(!1);useInternalDynamicEvents("logout",()=>{Br.current=!1}),reactExports.useEffect(()=>{var Wr;if(!(!Er||Br.current)&&!(!wr||!hasPendingMfaAction(wr))){if(Br.current=!0,fr){br(!1),fr();return}br(!0),!((Wr=wr.scope)===null||Wr===void 0)&&Wr.includes("requiresAdditionalAuth")?jr().then(qr=>{qr.length===0?kr("mfa-choose-device"):kr("mfa-verification")}):kr("mfa-display-backup-codes")}},[jr,Er,br,kr,wr,fr])},SyncAuthFlow=()=>(useSyncOnboardingFlow(),useSyncEmbeddedWalletFlow(),useSyncMfaFlow(),null),Switch$1=({disabled:fr=!1,firstButton:br,secondButton:wr,thirdButton:Er})=>jsxRuntimeExports.jsxs("div",{className:classNames$1("switch__container",{disabled:fr}),children:[jsxRuntimeExports.jsx("button",{disabled:fr,className:classNames$1("button",{active:br.active}),onClick:br.handleButtonClick,children:br.name}),jsxRuntimeExports.jsx("button",{disabled:fr,className:classNames$1("button",{active:wr.active}),onClick:wr.handleButtonClick,children:wr.name}),Er&&jsxRuntimeExports.jsx("button",{disabled:fr,className:classNames$1("button",{active:Er.active}),onClick:Er.handleButtonClick,children:Er.name})]}),ThemeSwitch=()=>{const{changeTheme:fr,theme:br}=useThemeContext();return jsxRuntimeExports.jsx(Switch$1,{firstButton:{active:br.theme.name==="light",handleButtonClick:()=>fr("light"),name:"Light"},secondButton:{active:br.theme.name==="dark",handleButtonClick:()=>fr("dark"),name:"Dark"},thirdButton:{active:br.theme.name==="auto",handleButtonClick:()=>fr("auto"),name:"Auto"}})},PrimaryColorInput=()=>{const{changePrimaryColor:fr,theme:br}=useThemeContext(),[wr,Er]=reactExports.useState(br.customColor);return jsxRuntimeExports.jsx(Input,{id:"primary-color",label:"Primary color",value:wr,onChange:kr=>Er(kr.target.value),onBlur:kr=>{const jr=wr||br.customColor;Er(jr),fr(jr)}})},AuthModeSwitch=({authMode:fr,setAuthMode:br})=>jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"auth-mode-switch__container",children:[jsxRuntimeExports.jsx(Checkbox,{checked:fr==="connect-and-sign",onChange:()=>br("connect-and-sign"),id:"connect-and-sign"}),jsxRuntimeExports.jsx("label",{htmlFor:"connect-and-sign",children:jsxRuntimeExports.jsx(Typography,{color:"primary",weight:"regular",children:"Connect and sign"})})]}),jsxRuntimeExports.jsxs("div",{className:"auth-mode-switch__container",children:[jsxRuntimeExports.jsx(Checkbox,{checked:fr==="connect-only",onChange:()=>br("connect-only"),id:"connect-only"}),jsxRuntimeExports.jsx("label",{htmlFor:"connect-only",children:jsxRuntimeExports.jsx(Typography,{color:"primary",weight:"regular",children:"Connect only"})})]})]}),LoginWithEmailSwitch=()=>{const{loginWithEmail:fr,setLogInWithEmail:br}=useInternalDynamicContext();return jsxRuntimeExports.jsx(Switch$1,{firstButton:{active:fr,handleButtonClick:()=>br(!0),name:"True"},secondButton:{active:!fr,handleButtonClick:()=>br(!1),name:"False"}})},LoginWithEmailViewDisplayPriorityOrderSwitch=()=>{const{authorizationViewDisplayOrder:fr,setAuthorizationViewDisplayOrder:br,loginWithEmail:wr}=useInternalDynamicContext();return jsxRuntimeExports.jsx(Switch$1,{disabled:!wr,firstButton:{active:fr==="web2",handleButtonClick:()=>br("web2"),name:"Email"},secondButton:{active:fr==="web3",handleButtonClick:()=>br("web3"),name:"Wallet"}})},TemplateSelect=()=>{const{theme:fr,changeTemplate:br}=useThemeContext(),wr=Er=>{br(Er.target.value)};return jsxRuntimeExports.jsxs(Select,{label:"template",value:fr.template,onChange:wr,selectDataTestId:"template-select",children:[jsxRuntimeExports.jsx("option",{value:"default",children:"Default"}),jsxRuntimeExports.jsx("option",{value:"matrix",children:"Matrix"}),jsxRuntimeExports.jsx("option",{value:"minimal",children:"Minimal"}),jsxRuntimeExports.jsx("option",{value:"rounded",children:"Rounded"}),jsxRuntimeExports.jsx("option",{value:"trinity",children:"Trinity"})]})},Toolkit=()=>{const{projectSettings:fr,user:br,showAuthFlow:wr,showDynamicUserProfile:Er,toolkitEnabled:kr,authMode:jr,setAuthMode:Br}=useInternalDynamicContext();return reactExports.useMemo(()=>kr?Er||wr:!1,[wr,Er,kr])?jsxRuntimeExports.jsx(ShadowDOM,{dataTestId:"toolkit-shadowdom",className:"toolkit-shadowdom",zIndex:toolkitZIndex,children:jsxRuntimeExports.jsxs("div",{className:"toolkit__container",children:[jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Theme"}),jsxRuntimeExports.jsx(ThemeSwitch,{})]}),jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Template"}),jsxRuntimeExports.jsx(TemplateSelect,{})]}),jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Primary Color"}),jsxRuntimeExports.jsx(PrimaryColorInput,{})]}),!br&&jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Auth mode"}),jsxRuntimeExports.jsx(AuthModeSwitch,{authMode:jr,setAuthMode:Br})]}),isEmailProviderEnabled((fr==null?void 0:fr.providers)||[])&&!br&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Log in with Email"}),jsxRuntimeExports.jsx(LoginWithEmailSwitch,{})]}),jsxRuntimeExports.jsxs("div",{className:"toolkit__switcher",children:[jsxRuntimeExports.jsx(Typography,{className:"switcher__copy",as:"h2",variant:"body_normal",children:"Email vs Wallet priority"}),jsxRuntimeExports.jsx(LoginWithEmailViewDisplayPriorityOrderSwitch,{})]})]})]})}):null},useTelegramLogin=()=>{const{sdkHasLoaded:fr,user:br,projectSettings:wr,environmentId:Er}=useInternalDynamicContext(),kr=(wr==null?void 0:wr.providers)||[],{completeConnection:jr}=useSocialAuth({sessionTimeout:2e4}),Br=()=>{var Vr,Zr;const Jr=(Zr=(Vr=getInitialUrl())===null||Vr===void 0?void 0:Vr.searchParams.get("telegramAuthToken"))!==null&&Zr!==void 0?Zr:void 0;return Jr||logger$6.error(`telegramAuthToken was not found - please make sure to use the bot code implementation provided https://github.com/dynamic-labs/telegram-miniapp-dynamic/blob/main/scripts/bot.ts. And ensure that the Telegram Mini Web App is launched directly from the chatbot`),Jr},Wr=Vr=>{let Zr;return isProviderEnabled(kr,ProviderEnum.Telegram)?fr?br?Zr="User is already logged in":Vr||(Zr="Telegram auth token is missing"):Zr="SDK has not loaded":Zr="Telegram provider is not enabled",Zr&&logger$6.error(`Failed to check user Telegram authentication status due to reason: ${Zr}`),!Zr};return{isAuthWithTelegram:Vr=>__awaiter$e(void 0,void 0,void 0,function*(){const Zr=Vr||Br();return Wr(Zr)?!!isUserLinkedWithTelegram(Er,{telegramAuthToken:Zr}):!1}),telegramSignIn:(...Vr)=>__awaiter$e(void 0,[...Vr],void 0,function*({forceCreateUser:Zr=!1,authToken:Jr}={}){Jr||(Jr=Br()),Wr(Jr)&&(yield jr({authMode:"signin",forceCreateUser:Zr,provider:ProviderEnum.Telegram,state:"",telegramAuthToken:Jr}))})}},TelegramAutoLogin=()=>(useTelegramLogin(),null),WalletConnectorEvents=()=>{const{walletConnectorOptions:fr,primaryWallet:br}=useInternalDynamicContext(),{handleWalletItemClick:wr}=useWalletItemActions();return reactExports.useEffect(()=>{const Er=({connector:kr})=>{logger$6.debug("[WalletConnectorEvents] handleProviderReady",{connector:kr});const jr=fr.map(Br=>Br.key===kr.key?Object.assign(Object.assign({},Br),{isInstalledOnBrowser:kr.isInstalledOnBrowser(),walletConnector:kr}):Br);setWalletConnectorOptions(jr)};return walletConnectorEvents.on("providerReady",Er),()=>{walletConnectorEvents.off("providerReady",Er)}},[fr]),reactExports.useEffect(()=>{const Er=({connector:kr})=>{logger$6.debug("[WalletConnectorEvents] handleAutoConnect",{connector:kr});const jr=fr.find(Br=>Br.walletConnector.key===kr.key);jr&&wr(jr)};if(!br)return walletConnectorEvents.on("autoConnect",Er),()=>{walletConnectorEvents.off("autoConnect",Er)}},[wr,fr,br]),null},getMissingChains=(fr,br)=>{if(!fr||!br)return;const wr=new Set(br.map(kr=>kr.walletChain));return fr.filter(kr=>!wr.has(kr.chain))},themeModes=["light","dark","auto"],isThemeSetting=fr=>themeModes.includes(fr),parseTheme=(fr,br)=>isThemeSetting(fr)?getThemeConfig(br,fr):fr,validTransitions$2={idle:["linking_new_wallet","primary_not_connected","switching_primary"],linking_new_wallet:["idle"],primary_not_connected:["idle"],switching_primary:["idle"]},validateStateTransition$2=({from:fr,to:br})=>{if(fr!==br&&!validTransitions$2[fr].includes(br))throw new Error(`Invalid AccountSwitch state transition from ${fr} to ${br}`);return!0},validateMultiWalletWidgetState$1=fr=>{if(fr!=="awaiting_account_switch")throw new Error(`Invalid MultiWalletWidget state while trying to set AccountSwitch state: ${fr} Expected: awaiting_account_switch`)},useAwaitingAccountSwitch=()=>{const[fr,br]=reactExports.useState("idle"),wr=reactExports.useCallback(()=>{br("idle")},[br]),Er=reactExports.useCallback((kr,jr)=>{validateMultiWalletWidgetState$1(jr),validateStateTransition$2({from:fr,to:kr}),br(kr)},[fr]);return[fr,Er,wr]},validTransitions$1={idle:["linking_new_wallet","transferring_wallet"],linking_new_wallet:["idle"],transferring_wallet:["idle"]},validateStateTransition$1=({from:fr,to:br})=>{if(fr!==br&&!validTransitions$1[fr].includes(br))throw new Error(`Invalid AwaitingSignature state transition from ${fr} to ${br}`);return!0},validateMultiWalletWidgetState=fr=>{if(fr!=="awaiting_signature")throw new Error(`Invalid MultiWalletWidget state while trying to set AwaitingSignature state: ${fr} -Expected: awaiting_signature`)},useAwaitingSignature=()=>{const[fr,br]=reactExports.useState("idle"),wr=reactExports.useCallback(()=>{br("idle")},[br]),Er=reactExports.useCallback((kr,jr)=>{validateMultiWalletWidgetState(jr),validateStateTransition$1({from:fr,to:kr}),br(kr)},[fr]);return[fr,Er,wr]},validTransitions={awaiting_account_switch:["awaiting_signature","idle"],awaiting_connection:["idle"],awaiting_signature:["idle"],detected_new_wallet:["awaiting_signature","idle"],idle:["awaiting_account_switch","awaiting_connection","awaiting_signature","detected_new_wallet"]},validateStateTransition=({from:fr,to:br})=>{if(fr!==br&&!validTransitions[fr].includes(br))throw new Error(`Invalid MultiWalletWidget state transition from ${fr} to ${br}`);return!0},useMultiWalletWidgetState=()=>{const[fr,br]=reactExports.useState("idle"),[wr,Er,kr]=useAwaitingAccountSwitch(),[jr,Br,Wr]=useAwaitingSignature(),qr=reactExports.useCallback(()=>{kr(),Wr()},[kr,Wr]),Gr=reactExports.useCallback((Vr,Zr,Jr)=>{validateStateTransition({from:fr,to:Vr}),br(Vr),qr(),Zr&&Er(Zr,Vr),Jr&&Br(Jr,Vr)},[fr,qr,Er,Br]);return[fr,Gr,{awaiting_account_switch:[wr,Er],awaiting_signature:[jr,Br]}]},useClearWalletConnectSessions=({connectors:fr})=>{const br=()=>{if(!(typeof window>"u")){for(const wr of StorageService.getKeys())(wr.startsWith("walletconnect")||wr.startsWith("walletlink")||wr.startsWith("wc@2"))&&localStorage.removeItem(wr);fr==null||fr.forEach(wr=>{var Er,kr,jr;!((kr=(Er=wr==null?void 0:wr.name)===null||Er===void 0?void 0:Er.toLowerCase())===null||kr===void 0)&&kr.startsWith("turnkey")&&((jr=wr.getAuthenticatorHandler())===null||jr===void 0||jr.clear(),StorageService.removeItem(EMBEDDED_WALLET_SESSION_SETTINGS),StorageService.removeItem(EMBEDDED_WALLET_SECURE_BANNER))})}};return reactExports.useEffect(()=>{if(typeof window>"u"||fr.length===0)return;const wr=new Set(fr.map(Er=>Er.key));for(const Er of StorageService.getKeys())Er.startsWith("walletconnect")&&!wr.has(Er.replace("walletconnect-",""))&&localStorage.removeItem(Er)},[fr]),{clearAllWalletConnectSessions:br}},revokeSession=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,sessionId:wr}){try{yield sdkApi$1().revokeSession({environmentId:br})}catch(Er){const kr=yield Er.json();logger$6.error(Error(kr.error.message))}}),mapChainToChainEnum=fr=>{const br=Object.values(ChainEnum).find(wr=>wr===fr);if(!br)throw new DynamicError(`Invalid chain ${fr}`);return br},mapProviderToProviderEnum=fr=>{const br=Object.values(WalletProviderEnum).find(wr=>wr===fr);if(!br)throw new DynamicError(`Invalid provider ${fr}`);return br},mapAuthModeTypeToEnum=fr=>{const br=Object.values(AuthModeEnum).find(wr=>wr===fr);if(!br)throw new DynamicError(`Invalid authMode ${fr}`);return br},createVisit=fr=>__awaiter$e(void 0,[fr],void 0,function*({authMode:br,chain:wr,environmentId:Er,walletProvider:kr,publicWalletAddress:jr,walletName:Br}){try{const Wr={address:jr,authMode:mapAuthModeTypeToEnum(br),chain:mapChainToChainEnum(wr),provider:mapProviderToProviderEnum(kr),walletName:Br};yield sdkApi$1().createVisit({connectRequest:Wr,environmentId:Er})}catch(Wr){logger$6.error(Wr)}}),getWalletConnectorForWallet=fr=>{var br,wr;if(!fr)return;const Er=getWalletConnectorOptions(),{key:kr,chain:jr}=fr,Br=(br=Er.find(qr=>kr===qr.key&&qr.walletConnector.connectedChain===jr))===null||br===void 0?void 0:br.walletConnector;return Br||((wr=Er.find(qr=>qr.key==="fallbackconnector"))===null||wr===void 0?void 0:wr.walletConnector)},useDebounce=(fr,br)=>{const wr=reactExports.useRef(null),Er=reactExports.useRef(fr);return Er.current=fr,reactExports.useCallback((...kr)=>{wr.current&&clearTimeout(wr.current),wr.current=window.setTimeout(()=>{Er.current(...kr)},br)},[br])},updateUserWalletsFromConnectedWallets=(fr,br)=>{const wr=[...fr],Er=new Set;for(const kr of br)Er.add(kr.address),wr.find(Br=>Br.address===kr.address)||wr.push(kr);return wr.filter(kr=>Er.has(kr.address)||kr.isAuthenticated)},useConnectWallet=({authMode:fr,clearPrimaryWalletId:br,enableVisitTrackingOnConnectOnly:wr,environmentId:Er,primaryWalletId:kr,setPrimaryWalletId:jr,walletConnectorOptions:Br,handleConnectedWallet:Wr,setShowAuthFlow:qr,isBridgeFlow:Gr,user:Vr})=>{const[Zr,Jr,Qr]=useLocalStorage$1(CONNECTED_WALLETS_INFO,[]),[_n,En]=reactExports.useState([]),{setUserWallets:Cn,addedWalletsIds:In,removedWalletsIds:An}=useInternalUserWallets(),jn=reactExports.useCallback(no=>{En(no),Cn(Tn=>updateUserWalletsFromConnectedWallets(Tn,no))},[Cn]),eo=reactExports.useCallback(no=>__awaiter$e(void 0,void 0,void 0,function*(){const Tn=_n.find(Sn=>Sn.id===no);yield Tn==null?void 0:Tn.connector.endSession();const Hr=Zr.filter(Sn=>Sn.id!==no);if(Jr(Hr),An.current.push(no),no!==kr)return;const Xr=Hr.length>0;Gr||!Xr?br():jr(Hr[0].id)}),[br,_n,Zr,Gr,kr,An,Jr,jr]),ro=useDebounce(()=>__awaiter$e(void 0,void 0,void 0,function*(){const no=Br.map(Hr=>Hr.walletConnector);if(!no.length)return;const Tn=(yield Promise.all(Zr.map(Hr=>__awaiter$e(void 0,void 0,void 0,function*(){const Xr=getWalletConnectorByKey(no,Hr.walletConnectorKey);if(!Xr)return logger$7.error("Could not find walletConnector: "+Hr.walletConnectorKey),yield eo(Hr.id),null;isHardwareWalletConnector(Xr)&&Hr.hardwareWallet===HardwareWalletEnum.Ledger&&(Xr.isHardwareWalletEnabled=!0);const[Sn]=yield Xr.getConnectedAccounts();if(!Sn)return yield eo(Hr.id),null;const Rn=yield Xr.getAdditionalAddresses(Sn),Pn=Xr.connectedChain;return Xr.createWallet({additionalAddresses:Rn,address:Sn,chain:Pn,connector:Xr,id:Hr.id,isAuthenticated:!1,key:Xr.key})})))).filter(Hr=>!!Hr);jn(Tn)}),300);reactExports.useEffect(()=>{ro()},[Zr,Br]);const to=reactExports.useCallback(no=>{const Hr=no.map(({id:Xr})=>Xr).map(Xr=>Number(Xr.replace("connect-wallet-",""))).sort((Xr,Sn)=>Xr-Sn);for(let Xr=0;Xr{var Hr;const Xr=[..._n],Sn=Xr.findIndex(Rn=>Rn.id===no);Sn<0||(Xr[Sn]=Xr[Sn].connector.createWallet(Object.assign(Object.assign({},Xr[Sn]),{address:(Hr=Tn.address)!==null&&Hr!==void 0?Hr:Xr[Sn].address,connector:getWalletConnectorForWallet(Xr[Sn])})),jn(Xr))},[_n,jn]),oo=({walletId:no,walletConnectorKey:Tn,walletChain:Hr,provider:Xr})=>{const Sn=[...Zr],Rn=Br.map(Zn=>Zn.walletConnector),Pn=getWalletConnectorByKey(Rn,Tn),On=Pn&&isHardwareWalletConnector(Pn)&&Pn.isHardwareWalletEnabled?HardwareWalletEnum.Ledger:void 0;Sn.push({hardwareWallet:On,id:no,provider:Xr,walletChain:Hr,walletConnectorKey:Tn}),Jr(Sn)},io=(no,Tn)=>__awaiter$e(void 0,void 0,void 0,function*(){shouldManuallyReconnectOnRefresh(Tn)&&(yield Tn.connect());const Hr=yield Tn.getAddress();if(Hr&&Wr&&!(yield Wr({address:Hr,chain:Tn.connectedChain,connector:Tn}))){logger$7.info("Connection was not established because handleConnectedWallet returned false"),eo(no),qr(!1,{emitCancelAuth:!0});return}_i(no,{address:Hr})}),co=(no,Tn,Hr)=>__awaiter$e(void 0,void 0,void 0,function*(){const{applyHandleConnectedWallet:Xr=!0}=Hr??{},Sn=yield no.getAddress(Tn);if(!Sn)throw new MissingPublicAddressError;if(Wr&&Xr&&!(yield Wr({address:Sn,chain:no.connectedChain,connector:no}))){logger$7.info("Connection was not established because handleConnectedWallet returned false"),qr(!1);return}const Rn=Zr.some(({walletConnectorKey:Nn})=>Nn===no.key),Pn=no.connectedChain;if(!Rn&&(fr!=="connect-only"||wr)&&createVisit({authMode:fr,chain:Pn||"",environmentId:Er,publicWalletAddress:Sn,walletName:no.key,walletProvider:getWalletProvider(no)}),!isConnectOnly(Vr,fr))return{address:Sn,id:""};const Zn=`connect-wallet-${to(Zr)}`;return kr||jr(Zn),In.current.push(Zn),Rn?yield ro():oo({provider:getWalletProvider(no),walletAddress:Sn,walletChain:Pn,walletConnectorKey:no.key,walletId:Zn}),{address:Sn,id:Zn}}),so=reactExports.useCallback(no=>_n.find(Tn=>Tn.id===no),[_n]);return{connectWallet:co,connectedWallets:_n,connectedWalletsInfo:Zr,disconnectWallet:eo,getConnectedWalletById:so,refreshConnectedWallet:io,removeConnectedWalletsInfo:Qr}},useFetchWalletsForChainsMap=fr=>({walletsForChainsMap:reactExports.useMemo(()=>fr?Object.assign(Object.assign({},defaultWalletsForChains),{primary_chain:fr.primary_chain,wallets:Object.assign(Object.assign({},defaultWalletsForChains.wallets),!!fr.wallets&&fr.wallets)}):defaultWalletsForChains,[fr])}),useHandleUnlinkWallet=({verifiedCredentials:fr,environmentId:br,primaryWalletId:wr,secondaryWallets:Er})=>{const{removedWalletsIds:kr}=useInternalUserWallets();return reactExports.useCallback(Br=>__awaiter$e(void 0,void 0,void 0,function*(){var Wr;const qr=(Wr=StorageService.getItem(PRIMARY_WALLET_ID))!==null&&Wr!==void 0?Wr:wr;if(Br===qr)return;yield unlinkWallet({environmentId:br,onSuccess:()=>{kr.current.push(Br)},primaryWalletId:qr,walletId:Br});const Gr=Er.find(Zr=>Zr.id===Br);fr.filter(Zr=>Zr.walletName===((Gr==null?void 0:Gr.connector.key)||"")).length===1&&(yield Gr==null?void 0:Gr.connector.endSession())}),[wr,br,Er,fr,kr])},primaryWalletIdValidator=fr=>typeof fr=="string"||typeof fr>"u",usePrimaryWalletId=({environmentId:fr,user:br})=>{const[wr,Er,kr]=useLocalStorage$1(PRIMARY_WALLET_ID,void 0,primaryWalletIdValidator),jr=reactExports.useCallback(Br=>__awaiter$e(void 0,void 0,void 0,function*(){Er(Br),br&&(yield storeSelectedWallet({environmentId:fr,walletId:Br}))}),[fr,Er,br]);return{clearPrimaryWalletId:kr,primaryWalletId:wr,setPrimaryWalletId:jr}},useWalletEventListeners=({disconnectWallet:fr,handleLogOut:br,multiWallet:wr,multiWalletWidgetState:Er,primaryWallet:kr,secondaryWallets:jr,selectedWalletConnector:Br,selectedWalletWithAction:Wr,setSelectedWalletConnectorKey:qr,setSelectedWalletWithAction:Gr,setMultiWalletWidgetState:Vr,user:Zr,setPrimaryWalletId:Jr,authMode:Qr,refreshConnectedWallet:_n,detectNewWalletsForLinking:En})=>{const Cn=reactExports.useCallback((jn,eo)=>{logger$6.debug("handleAccountChangeWhenAwaitingAccountSwitch",{isPrimaryWallet:jn,newAddress:eo});const ro=jr.find(_i=>isSameAddress$1(_i.address,eo,_i.chain));if(logger$6.logVerboseTroubleshootingMessage("[handleAccountChangeWhenAwaitingAccountSwitch]",{linkedSecondaryWallet:ro}),!ro){Vr("awaiting_signature",void 0,"linking_new_wallet"),jn&&kr&&qr(kr.connector.key);return}if(ro.connector.key==="unknown"){dynamicEvents.emit("triggerConnectAndSign");return}Gr(null),Jr(ro.id),Vr("idle")},[Vr,kr,jr,qr,Gr,Jr]),In=reactExports.useCallback(({accounts:jn})=>{if(logger$6.debug("calculatePrimaryWalletMultiWalletStateFromAccounts",{accounts:jn,authMode:Qr,multiWallet:wr,multiWalletWidgetState:Er,primaryWallet:kr}),!kr)return;const[eo]=jn;if(!!isSameAddress$1(eo,kr.address,kr.chain)){Vr("idle");return}if(Qr==="connect-only"){_n(kr.id,kr.connector);return}if(!wr)return;if(Er==="awaiting_account_switch"){Cn(!0,eo);return}Er!=="idle"&&(logger$6.error(`Unexpected multiWalletWidgetState (${Er}) and onAccountChange combination. Resetting state to idle.`),Vr("idle"));const to=jr.find(_i=>isSameAddress$1(_i.address,eo,_i.chain));if(to){Jr(to.id);return}Zr&&En&&(Vr("detected_new_wallet"),qr(kr.connector.key))},[Qr,En,Cn,wr,Er,kr,_n,jr,Vr,Jr,qr,Zr]);useInternalDynamicEvents("triggerComputePrimaryWalletMultiWalletStateFromAccounts",In),useWalletConnectorEvent(kr==null?void 0:kr.connector,"accountChange",({accounts:jn})=>{logger$6.debug("primary wallet account change",{accounts:jn}),In({accounts:jn})});const An=reactExports.useMemo(()=>{const jn=kr==null?void 0:kr.connector,eo=jr.map(({connector:to})=>to),ro=new Set([...eo,jn,Br].filter(to=>!!to));return jn&&ro.delete(jn),Array.from(ro)},[jr,Br,kr==null?void 0:kr.connector]);useWalletConnectorEvent(An,"accountChange",(jn,eo)=>__awaiter$e(void 0,void 0,void 0,function*(){if(logger$6.debug("secondary wallet account change"),Qr==="connect-only"&&jr.length){const ro=jr.filter(({connector:to})=>to.key===eo.key);for(const to of ro)_n(to.id,to.connector);return}Er==="awaiting_account_switch"&&Cn(!1,(Wr==null?void 0:Wr.wallet.address)||"")})),useWalletConnectorEvent(kr==null?void 0:kr.connector,"disconnect",()=>{logger$6.debug("primary wallet disconnect"),Qr==="connect-only"&&br()}),useWalletConnectorEvent(An,"disconnect",jn=>{if(logger$6.debug("secondary wallet disconnect"),Qr==="connect-only"){const eo=jr.filter(({connector:ro})=>ro.key===jn.key);for(const ro of eo)fr(ro.id)}})},useTabState=({settingsOverrides:fr})=>{var br,wr,Er;const kr=(br=fr==null?void 0:fr.views)===null||br===void 0?void 0:br.find(qr=>qr.type==="wallet-list"),[jr,Br]=reactExports.useState(0),Wr=jr===null||(wr=kr==null?void 0:kr.tabs)===null||wr===void 0?void 0:wr.items[jr];return{selectedTabIndex:jr,selectedTabSettings:Wr,setSelectedTabIndex:Br,tabsItems:(Er=kr==null?void 0:kr.tabs)===null||Er===void 0?void 0:Er.items}},DynamicBridgeWidgetContext=t$7.createContext(void 0),initialView="wallets",DynamicBridgeWidgetContextProvider=({children:fr})=>{const br=reactExports.useRef(null),wr=reactExports.useRef(null),[Er,kr]=reactExports.useState(initialView),jr=reactExports.useCallback(()=>{kr(initialView)},[]),Br=reactExports.useCallback(()=>{kr("profile")},[]),Wr={bridgeWidgetView:Er,events:{onDynamicBridgeWidgetClose:jr},goToProfileView:Br,inlineControlsRef:wr,setBridgeWidgetView:kr,widgetRef:br};return jsxRuntimeExports.jsx(DynamicBridgeWidgetContext.Provider,{value:Wr,children:fr})},DynamicWidgetCard=reactExports.forwardRef(({children:fr},br)=>jsxRuntimeExports.jsx("div",{ref:br,className:"dynamic-widget-card",children:fr}));DynamicWidgetCard.displayName="DynamicWidgetCard";const widgetRegistryContext=reactExports.createContext(null),WidgetRegistryContextProvider=({children:fr})=>{const[br,wr]=reactExports.useState({}),Er=reactExports.useCallback((Br,Wr)=>{wr(qr=>Object.assign(Object.assign({},qr),{[Br]:{type:Wr}}))},[wr]),kr=reactExports.useCallback(Br=>{wr(Wr=>{const qr=Object.assign({},Wr);return delete qr[Br],qr})},[wr]),jr=reactExports.useCallback(Br=>Object.values(br).some(Wr=>Wr.type===Br),[br]);return jsxRuntimeExports.jsx(widgetRegistryContext.Provider,{value:{checkWidgetPresence:jr,registerId:Er,removeId:kr},children:fr})},Modal=({onrampUrl:fr})=>{const{fundingRef:br,setShowFunding:wr}=useFundingContext();return useOnClickOutside(br,()=>{wr(!1)}),jsxRuntimeExports.jsx("div",{className:"fund-wallet__modal","data-testid":"fund-wallet-modal",children:jsxRuntimeExports.jsx("div",{className:"fund-wallet__modal-content",ref:br,children:jsxRuntimeExports.jsx("iframe",{id:"onramp-iframe",src:fr,allow:"camera *;geolocation *",title:"Crypto Onramp"})})})},FundWalletView=()=>{const{primaryWallet:fr}=useInternalDynamicContext(),{showFunding:br,fundingUrl:wr,fundingEnabled:Er}=useFundingContext();return!Er||!br||!wr||!(fr!=null&&fr.address)?null:jsxRuntimeExports.jsx(ShadowDOM,{children:jsxRuntimeExports.jsxs(OpacityTransition,{isShown:br,children:[jsxRuntimeExports.jsx("div",{className:"fund-wallet__backdrop","aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:"fund-wallet__modal-container",children:jsxRuntimeExports.jsx(Modal,{onrampUrl:wr})})]})})},FundingWidget=()=>jsxRuntimeExports.jsx(FundWalletView,{}),ConnectWithOtpContext=reactExports.createContext(void 0),createEmailHandler=(fr,{shouldRegisterSessionKeysOnSignin:br,generateSessionKey:wr})=>Er=>__awaiter$e(void 0,void 0,void 0,function*(){const kr=yield createEmailVerification({email:Er,environmentId:fr});let{verificationUUID:jr}=kr;return{retry:()=>__awaiter$e(void 0,void 0,void 0,function*(){jr=(yield retryEmailVerification({email:Er,environmentId:fr,verificationUUID:jr})).verificationUUID}),type:"email",verify:Br=>__awaiter$e(void 0,void 0,void 0,function*(){let Wr;br()&&(Wr=(yield wr()).publicKey);const qr=yield signInWithEmailVerification({environmentId:fr,sessionPublicKey:Wr,verificationToken:Br,verificationUUID:jr});return storeAuthTokenAndUser(qr),{destination:Er,verified:!!qr.jwt}})}}),createMagicHandler=(fr,br)=>wr=>__awaiter$e(void 0,void 0,void 0,function*(){if(!fr)throw new Error("OTP wallet connector was not found");return fr.setEmail(wr),br(fr),{retry:()=>fr.retryOneTimePassword(),type:"email",verify:Er=>__awaiter$e(void 0,void 0,void 0,function*(){return{destination:wr,verified:yield fr.verifyOneTimePassword(Er)}})}}),createSmsHandler=fr=>br=>__awaiter$e(void 0,void 0,void 0,function*(){const{generateSessionKey:wr,shouldRegisterSessionKeysOnSignin:Er}=useEmbeddedWalletSessionKeys(fr),{verificationUUID:kr}=yield createSmsVerification({environmentId:fr,isoCountryCode:br.iso2,phoneCountryCode:br.dialCode,phoneNumber:br.phone});return{type:"sms",verify:jr=>__awaiter$e(void 0,void 0,void 0,function*(){let Br;Er()&&(Br=(yield wr()).publicKey);const Wr=yield signInWithSmsVerification({environmentId:fr,sessionPublicKey:Br,verificationToken:jr,verificationUUID:kr});return storeAuthTokenAndUser(Wr),{destination:br,verified:!!Wr.jwt}})}}),mapEmailProviderToProviderEnum={dynamic:ProviderEnum.Dynamic,magicLink:ProviderEnum.MagicLink},allSupportedProviders=Object.values(mapEmailProviderToProviderEnum),findEmailProvider=(fr,br)=>__awaiter$e(void 0,void 0,void 0,function*(){const{emailProvider:wr}=yield getEmailProvider({email:br,environmentId:fr});if(!allSupportedProviders.includes(wr))throw new Error("Email provider is not supported");return wr}),{Provider:Provider$1}=ConnectWithOtpContext,ConnectWithOtpProvider=({children:fr})=>{const{walletConnectorOptions:br,environmentId:wr,projectSettings:Er,setCallback:kr}=useInternalDynamicContext(),jr=useEmbeddedWalletSessionKeys(wr),{handleInstalledExtensionClick:Br}=useWalletItemActions(),Wr=reactExports.useRef(null),qr=(Er==null?void 0:Er.providers)||[],Gr=br.map(({walletConnector:En})=>En).find(isEmailOTPWalletConnector),Vr={[ProviderEnum.Dynamic]:{enabled:isProviderEnabled(qr,ProviderEnum.Dynamic),handler:createEmailHandler(wr,jr)},[ProviderEnum.MagicLink]:{enabled:isProviderEnabled(qr,ProviderEnum.MagicLink),handler:createMagicHandler(Gr,Br)}},Zr=(En,...Cn)=>__awaiter$e(void 0,[En,...Cn],void 0,function*(In,{provider:An}={}){if(!isEmailValid(In))throw new Error("Email is not valid");const jn=An||(yield findEmailProvider(wr,In));if(!Vr[jn].enabled)throw new Error("Email provider is not enabled");const eo=yield Vr[jn].handler(In);Wr.current=eo}),Jr=En=>__awaiter$e(void 0,void 0,void 0,function*(){if(!isProviderEnabled(qr,ProviderEnum.Sms))throw new Error("SMS provider is not enabled");const In=yield createSmsHandler(wr)(En);Wr.current=In}),Qr=En=>__awaiter$e(void 0,void 0,void 0,function*(){if(!Wr.current)throw new Error("Verification has not started, use connectWithEmail or connectWithSms before verifying");const{type:Cn,verify:In}=Wr.current,{destination:An,verified:jn}=yield In(En);if(Cn==="sms"?dynamicEvents.emit("smsVerificationResult",jn,An):dynamicEvents.emit("emailVerificationResult",jn,An),jn)kr("authSuccess");else throw new Error(`${Cn==="sms"?"SMS":"Email"} verification failed`)}),_n=()=>__awaiter$e(void 0,void 0,void 0,function*(){if(!Wr.current)throw new Error("Verification has not started, use connectWithEmail or connectWithSms before verifying");if(!Wr.current.retry)throw new Error("Re-send is not supported");return Wr.current.retry()});return jsxRuntimeExports.jsx(Provider$1,{value:{connectWithEmail:Zr,connectWithSms:Jr,retryOneTimePassword:_n,verifyOneTimePassword:Qr},children:fr})},ERROR_BOUNDARY_CONTEXT_NOT_FOUND="ERROR_BOUNDARY_CONTEXT_NOT_FOUND",ErrorBoundaryContext=reactExports.createContext(null);function assertErrorBoundaryContext(fr){if(fr===null||typeof fr.hasError!="boolean"||typeof fr.error!="object"||typeof fr.isDynamicSdkError!="boolean"){const br=new Error("ErrorBoundaryContext not found");throw br.cause=ERROR_BOUNDARY_CONTEXT_NOT_FOUND,br}}class ErrorBoundaryBase extends reactExports.Component{static getDerivedStateFromError(br){return{error:br,hasError:!0}}renderOrError(br,{isDynamicSdkError:wr}){try{assertErrorBoundaryContext(this.context),this.context.isDynamicSdkError=wr}catch(Er){return logger$6.error(Er),reactExports.createElement(ErrorContainer,null,"ErrorBoundary must be used within ErrorBoundaryContext")}return br}}ErrorBoundaryBase.contextType=ErrorBoundaryContext;class ErrorBoundaryReporter extends ErrorBoundaryBase{constructor(br){super(br),this.state={error:null,hasError:!1}}componentDidCatch(br,wr){var Er;const{onError:kr}=this.props;throw!((Er=this.context)===null||Er===void 0)&&Er.isDynamicSdkError&&(kr==null||kr(br,wr),logger$6.error(br,{error:{bundleStack:br.stack,message:br,stack:wr.componentStack}})),br}render(){const{children:br}=this.props,{hasError:wr,error:Er}=this.state;return wr?(assertErrorBoundaryContext(this.context),this.context.error=Er,this.context.hasError=wr,null):br}}const ErrorBoundary=fr=>{var{children:br}=fr,wr=__rest$9(fr,["children"]);return jsxRuntimeExports.jsx(ErrorBoundaryContext.Provider,{value:{error:null,hasError:!1,isDynamicSdkError:!0},children:jsxRuntimeExports.jsx(ErrorBoundaryReporter,Object.assign({},wr,{children:br}))})};class ErrorBoundaryExclude extends ErrorBoundaryBase{render(){const{children:br}=this.props;return this.renderOrError(br,{isDynamicSdkError:!1})}}const useResponseHandlers=()=>{const{walletConnectorOptions:fr,consumeNonce:br,displaySiweStatement:wr,environmentId:Er,projectSettings:kr,setIsSingleWalletAccount:jr,connectWallet:Br,setShowAuthFlow:Wr,setSelectedWalletConnectorKey:qr,siweStatement:Gr,appName:Vr,user:Zr}=useInternalDynamicContext(),{setView:Jr}=useViewContext(),{setErrorMessage:Qr}=useErrorContext(),{getCaptchaToken:_n}=useCaptchaContext(),En=useVerifyWallet({consumeNonce:br,displaySiweStatement:wr,environmentId:Er,projectSettings:kr,setIsSingleWalletAccount:jr}),Cn=fr.map(({walletConnector:ro})=>ro).find(isPhantomRedirectConnector),In=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){Cn&&(yield Cn.getSession(),yield Br(Cn),Wr(!0,{ignoreIfIsEmbeddedWidget:!0}),Jr("pending-signature"),qr("phantom"))}),[Br,Cn,qr,Wr,Jr]),An=useTransferWallet(),jn=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){if(!Cn)return;qr("phantom");const[ro]=yield Cn.getConnectedAccounts();switch(Cn.consumeMethod()){case"signAndSendTransaction":{const{signature:_i}=Cn.extractSignature();Cn.emit("signAndSendTransaction",{signature:_i});break}case"signAllTransactions":Cn.emit("signAllTransactions",{transactions:Cn.extractTransactions()});break;case"signTransaction":Cn.emit("signTransaction",{transaction:Cn.extractTransaction()});break;case"signMessage":{const{signature:_i,message:oo}=Cn.extractSignature(),io=StorageService.getItem(PHANTOM_SIGNATURE_STATE);if(StorageService.removeItem(PHANTOM_SIGNATURE_STATE),(io==null?void 0:io.verificationType)==="awaiting_transfer"){const co=getSiweStatement({appName:Vr,siweStatement:Gr});yield An({messageToSignOverride:oo,overrideSiweStatement:co,publicWalletAddress:ro,signedMessageOverride:_i,skipEmptyAccountCheck:io.loseOriginalAccountOnTransfer,walletConnector:Cn})}else(io==null?void 0:io.verificationType)==="awaiting_verification"||!Zr?(Jr("wallet-redirect-view"),yield En({captchaToken:_n(),messageToSignOverride:oo,publicWalletAddress:ro,signedMessageOverride:_i,walletConnector:Cn})):Cn.emit("signMessage",{signature:_i});break}}}),[Cn,qr,Zr,Vr,Gr,An,Jr,En,_n]),eo=reactExports.useCallback(ro=>{var to;if(!Cn)return;const _i=ro.get("errorCode"),oo=(to=ro.get("errorMessage"))!==null&&to!==void 0?to:void 0;if(!_i)return;switch(Qr(_i),ro.delete("errorCode"),ro.delete("errorMessage"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${ro.toString()}`),Cn.consumeMethod()){case"signAndSendTransaction":Cn.emit("signAndSendTransaction",{errorCode:_i,errorMessage:oo});break;case"signAllTransactions":Cn.emit("signAllTransactions",{errorCode:_i,errorMessage:oo});break;case"signTransaction":Cn.emit("signTransaction",{errorCode:_i,errorMessage:oo});break;case"signMessage":Cn.emit("signMessage",{errorCode:_i,errorMessage:oo});break}},[Cn,Qr]);return{handleConnectResponse:In,handleErrorResponse:eo,handleUserResponse:jn,phantomRedirectConnector:Cn}},PhantomRedirectContext=reactExports.createContext(void 0),PhantomRedirectContextProvider=({children:fr})=>{const{sdkHasLoaded:br}=useInternalDynamicContext(),{phantomRedirectConnector:wr,handleConnectResponse:Er,handleUserResponse:kr,handleErrorResponse:jr}=useResponseHandlers();return reactExports.useEffect(()=>{if(!wr||!isMobile()||!br)return;const Br=new URLSearchParams(window.location.search);if(Br.has("errorCode")){jr(Br);return}if(Br.has("phantom_encryption_public_key")){Er();return}if(Br.has("data")){kr();return}},[Er,kr,jr,wr,br]),jsxRuntimeExports.jsx(PhantomRedirectContext.Provider,{value:{phantomRedirectConnector:wr},children:fr})},reinitializeContext=reactExports.createContext(void 0),ReinitializeContextProvider=({children:fr,onReinitialize:br})=>{const[wr,Er]=reactExports.useState(),kr=reactExports.useRef(br);kr.current=br;const jr=reactExports.useCallback(()=>{var Br;const Wr=randomString(8);(Br=kr.current)===null||Br===void 0||Br.call(kr,Wr),Er(Wr)},[]);return jsxRuntimeExports.jsx(reinitializeContext.Provider,{value:{key:wr,reinitialize:jr},children:reactExports.cloneElement(fr,{key:wr})})},useConnectedWalletsNetworkValidation=()=>{const{connectedWallets:fr,selectedWalletConnector:br,setSelectedWalletConnectorKey:wr,setShowAuthFlow:Er,bridgeChainsToConnect:kr,sdkHasLoaded:jr}=useInternalDynamicContext(),{setView:Br}=useViewContext(),Wr=useIsLoggedIn(),qr=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){const Zr=[];for(const Jr of fr){const Qr=kr==null?void 0:kr.some(Cn=>Cn.chain===Jr.chain),_n=yield Jr.connector.getNetwork(),En=isSupportedNetwork({network:_n,walletConnector:Jr.connector});!Qr&&!En&&Zr.push(Jr)}return Zr}),[kr,fr]),Gr=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){const Zr=yield qr();if(!Zr.length)return;const[Jr]=Zr;Jr.connector.key!==(br==null?void 0:br.key)&&wr(Jr.connector.key);const Qr=isProgrammableNetworkSwitchSupported(Jr.connector)?"network-not-supported":"network-not-supported-manual";Er(!0),Br(Qr)}),[qr,br==null?void 0:br.key,wr,Er,Br]),Vr=reactExports.useMemo(()=>{const Zr=fr.map(({connector:Qr})=>Qr),Jr=new Set([...Zr].filter(Qr=>!!Qr));return Array.from(Jr)},[fr]);useWalletConnectorEvent(Vr,"chainChange",({chain:Zr})=>{Gr()}),reactExports.useEffect(()=>{!jr||!Wr||Gr()},[jr,Wr,Gr])},UseNetworkValidation=()=>(useConnectedWalletsNetworkValidation(),null),isDisplayOrderPriorityForWeb3=fr=>{if(fr.length!==2)return!1;const[br,wr]=fr;return br==="wallet"&&wr==="email"},useDisplayOrderState=fr=>{const[br,wr]=reactExports.useState(null),Er=reactExports.useMemo(()=>{var kr;const jr=(kr=fr==null?void 0:fr.design.modal)===null||kr===void 0?void 0:kr.displayOrder;return jr?isDisplayOrderPriorityForWeb3(jr)?"web3":"web2":"web3"},[fr]);return[br||Er,wr]},useEmailLoginState=(fr,br)=>{const[wr,Er]=reactExports.useState(null),kr=()=>{Er(null)},jr=Wr=>{Er(Wr)},Br=reactExports.useMemo(()=>br?!1:isEmailProviderEnabled(fr),[fr,br]);return[wr??Br,jr,kr]},useHandleLogout=fr=>{const br=reactExports.useRef(fr);br.current=fr;const wr=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){const Er=br.current;Er.setSelectedWalletConnectorKey(null),Er.clearAllWalletConnectSessions(),Er.setShowDynamicUserProfile(!1),Er.setShowBridgeWidget(!1),Er.resetLoginWithEmail(),Er.user&&(document.cookie=`${DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax`,revokeSession({environmentId:Er.environmentId,sessionId:Er.user.sessionId})),Er.setLegacyIsVerifying(!1),StorageService.removeItem(AUTH_TOKEN,{priority:["secureStorage","localStorage"]}),StorageService.removeItem(AUTH_MIN_TOKEN$1,{priority:["secureStorage","localStorage"]}),StorageService.removeItem(WALLET_PICKER_SEARCH_KEY),StorageService.removeItem(PHANTOM_SIGNATURE_STATE),StorageService.removeItem(AUTH_EXPIRES_AT),Er.setAuthMode(Er.initialAuthenticationMode),Er.setShowAuthFlow(!1,{emitCancelAuth:!1,ignoreIfIsEmbeddedWidget:!1,initializeWalletConnect:!1,performMultiWalletChecks:!1}),Er.setMultiWalletWidgetState("idle"),Er.removeConnectedWalletsInfo(),Er.removeBridgeOnboardingCompleted(),Er.clearPrimaryWalletId(),Er.removeConnectedNameService(),Er.removeSessionStorageSessionKeys(),dynamicEvents.removeListener("embeddedWalletCreatePasswordCompleted"),dynamicEvents.removeListener("embeddedWalletCreatePasswordFailed"),dynamicEvents.removeListener("embeddedWalletUpdatePasswordCompleted"),dynamicEvents.removeListener("embeddedWalletUpdatePasswordFailed"),dynamicEvents.emit("logout"),setUser(void 0),yield Promise.all(Er.walletConnectors.map(kr=>kr.endSession())),yield Promise.all(Er.connectedWallets.map(kr=>kr.connector.endSession()))}),[]);return reactExports.useEffect(()=>(StorageService.events.on("parseFailure",wr),()=>{StorageService.events.off("parseFailure",wr)}),[wr]),wr},getWalletVerifiedCredential=(fr,br,wr)=>br==null?void 0:br.find(({address:Er})=>isSameAddress$1(Er||"",fr||"",wr)),useNameService=({currentWallet:fr,user:br})=>{const[wr,Er,kr]=useLocalStorage$1(CONNECTED_WALLET_NAME_SERVICE,null),jr=reactExports.useRef(),Br=reactExports.useRef(),Wr=reactExports.useCallback(Gr=>__awaiter$e(void 0,void 0,void 0,function*(){const{address:Vr,connector:Zr}=Gr,Jr=yield Zr.getNetwork();if(Vr===jr.current&&Jr===Br.current)return;Er(null),jr.current=Vr,Br.current=Jr;let Qr;try{Qr=yield Gr.getNameService()}catch{}if(jr.current===Vr&&Br.current===Jr)return Er({address:Vr,avatar:Qr==null?void 0:Qr.avatar,name:Qr==null?void 0:Qr.name,network:Jr}),Qr}),[Er]);return{getNameService:Gr=>__awaiter$e(void 0,void 0,void 0,function*(){var Vr;if(!fr)return;const Zr=yield fr.connector.getNetwork(),Jr=br==null?void 0:br.verifiedCredentials;if(Jr){const Qr=getWalletVerifiedCredential(fr==null?void 0:fr.address,Jr,fr.chain);if(Qr&&(!((Vr=Qr.nameService)===null||Vr===void 0)&&Vr.name))return Qr.nameService}if(!(Gr&&(fr==null?void 0:fr.address)!==Gr))return wr&&wr.address===(fr==null?void 0:fr.address)&&wr.network===Zr?{avatar:wr.avatar,name:wr.name}:Wr(fr)}),removeConnectedNameService:kr}},useSelectedWalletConnector=({walletConnectorOptions:fr})=>{const[br,wr]=reactExports.useState(null);return{selectedWalletConnector:reactExports.useMemo(()=>{var kr,jr;return br&&(jr=(kr=fr.find(({walletConnector:Br})=>Br.key===br))===null||kr===void 0?void 0:kr.walletConnector)!==null&&jr!==void 0?jr:null},[br,fr]),setSelectedWalletConnectorKey:wr}},useShowAuthFlow=({isAuthenticated:fr,isRenderingEmbeddedAuthFlow:br,isMultiWalletEnabled:wr,setShowDynamicUserProfile:Er})=>{const[kr,jr]=reactExports.useState(!1),{setError:Br}=useErrorContext(),Wr=reactExports.useCallback((qr,Gr={})=>{const{emitCancelAuth:Vr,ignoreIfIsEmbeddedWidget:Zr,initializeWalletConnect:Jr,performMultiWalletChecks:Qr,clearErrors:_n}=Object.assign({clearErrors:!0,emitCancelAuth:!1,ignoreIfIsEmbeddedWidget:!0,initializeWalletConnect:!0,performMultiWalletChecks:!1},Gr);if(logger$6.logVerboseTroubleshootingMessage("setShowAuthFlow",{clearErrors:_n,emitCancelAuth:Vr,ignoreIfIsEmbeddedWidget:Zr,initializeWalletConnect:Jr,performMultiWalletChecks:Qr}),!kr&&qr?dynamicEvents.emit("authFlowOpen"):kr&&!qr&&dynamicEvents.emit("authFlowClose"),qr){if(Zr&&br.current)return;if(Qr&&fr){if(!wr)return Er(!0);logger$6.warn("Use setShowLinkNewWalletModal to render the wallet list instead. For more information, see: https://docs.dynamic.xyz/react-sdk/hooks/usedynamiccontext");return}}else Vr&&kr&&dynamicEvents.emit("authFlowCancelled");_n&&Br(void 0),jr(qr)},[fr,wr,br,Br,Er,kr]);return[kr,Wr]},usePasskeySuccessPopup=()=>{const[fr,br]=reactExports.useState(void 0);return{passkeySuccessPopup:fr,setPasskeySuccessPopup:Er=>{br(Er),setTimeout(()=>{br(void 0)},2e3)}}},useTieCallbacksToEvents=({clientCallbacks:fr,user:br})=>{useInternalDynamicEvents("emailVerificationResult",(wr,Er)=>{var kr;return(kr=fr==null?void 0:fr.onOtpVerificationResult)===null||kr===void 0?void 0:kr.call(fr,wr,{type:"email",value:Er})}),useInternalDynamicEvents("smsVerificationResult",(wr,Er)=>{var kr;return(kr=fr==null?void 0:fr.onOtpVerificationResult)===null||kr===void 0?void 0:kr.call(fr,wr,{type:"sms",value:Er})}),useInternalDynamicEvents("authFlowCancelled",()=>{var wr;return(wr=fr==null?void 0:fr.onAuthFlowCancel)===null||wr===void 0?void 0:wr.call(fr)}),useInternalDynamicEvents("authFlowOpen",()=>{var wr;(wr=fr==null?void 0:fr.onAuthFlowOpen)===null||wr===void 0||wr.call(fr)}),useInternalDynamicEvents("authFlowClose",()=>{var wr;(wr=fr==null?void 0:fr.onAuthFlowClose)===null||wr===void 0||wr.call(fr)}),useInternalDynamicEvents("walletAdded",(wr,Er)=>{var kr;dynamicEvents.emit("triggerSessionValidation"),logger$6.debug("[walletAdded]",{userWallets:Er,wallet:wr}),(kr=fr==null?void 0:fr.onWalletAdded)===null||kr===void 0||kr.call(fr,{userWallets:Er,wallet:wr})}),useInternalDynamicEvents("walletRemoved",(wr,Er)=>{var kr;logger$6.debug("[walletRemoved]",{userWallets:Er,wallet:wr}),(kr=fr==null?void 0:fr.onWalletRemoved)===null||kr===void 0||kr.call(fr,{userWallets:Er,wallet:wr})}),useInternalDynamicEvents("embeddedWalletCreated",(wr,Er,kr)=>{var jr;logger$6.debug("[embeddedWalletCreated]",{_wallet:wr,jwtVerifiedCredential:Er,user:kr}),(jr=fr==null?void 0:fr.onEmbeddedWalletCreated)===null||jr===void 0||jr.call(fr,Er,kr)}),useInternalDynamicEvents("logout",()=>{var wr;(wr=fr==null?void 0:fr.onLogout)===null||wr===void 0||wr.call(fr,br)}),useInternalDynamicEvents("authFailure",(wr,Er)=>{var kr;logger$6.debug("[authFailure]",{data:wr,reason:Er}),(kr=fr==null?void 0:fr.onAuthFailure)===null||kr===void 0||kr.call(fr,wr,Er)}),useInternalDynamicEvents("authInit",wr=>{var Er;logger$6.debug("[authInit]",{data:wr}),(Er=fr==null?void 0:fr.onAuthInit)===null||Er===void 0||Er.call(fr,wr)})},useMultiWallet=({isBridgeFlow:fr,multiWalletOverride:br,multiWalletSettings:wr})=>{var Er;return br!==void 0?br:(Er=wr||fr)!==null&&Er!==void 0?Er:!1},useMultiAsset=({multiAssetOverride:fr,multiAssetSettings:br})=>fr!==void 0?fr:br??!0,useParentDynamicContextGuard=()=>{if(reactExports.useContext(DynamicContext))throw new Error("DynamicContextProvider should not be nested. Please wrap your application in a single DynamicContextProvider.")},useShowFiat=({showFiatOverride:fr,showFiatSettings:br})=>fr!==void 0?fr:br??!0,isAuthenticatedWithAWallet=fr=>{const br=fr.verifiedCredentials.find(wr=>wr.id===fr.lastVerifiedCredentialId);return(br==null?void 0:br.format)===JwtVerifiedCredentialFormatEnum.Blockchain},useCustomerCallbacks=({callbacks:{onAuthSuccess:fr,onUserProfileUpdate:br},handleLogOut:wr,primaryWallet:Er,user:kr,isAuthenticated:jr})=>{const[Br,Wr]=reactExports.useState([]),qr=reactExports.useCallback((Vr,Zr)=>{switch(Vr==null?void 0:Vr.callback){case"authSuccess":{try{fr==null||fr({handleLogOut:wr,isAuthenticated:jr,primaryWallet:Er,user:Zr}),dynamicEvents.emit("triggerSessionValidation")}catch(Jr){logger$6.error("Error calling onAuthSuccess: ",Jr)}break}case"userProfileUpdate":{try{br==null||br(Zr)}catch(Jr){logger$6.error("Error calling userProfileUpdate: ",Jr)}break}}},[wr,jr,fr,br,Er]);return reactExports.useEffect(()=>{!Br.length||!kr||isAuthenticatedWithAWallet(kr)&&!Er||(qr(Br[0],kr),Wr(Vr=>{const[Zr,...Jr]=Vr;return Zr&&(logger$6.debug("Resolved callback: ",Zr.callback),logger$6.debug("Callbacks in queue: ",Jr.map(Qr=>Qr.callback))),Jr}))},[Br,qr,Er,kr]),{setCallback:reactExports.useCallback((Vr,Zr)=>{Wr(Jr=>[...Jr,{callback:Vr,params:Zr}])},[])}},useRegisterStorageService=({storagePostfix:fr})=>{const br={clear:()=>{},getItem:()=>null,key:()=>null,length:0,removeItem:()=>{},setItem:()=>null},wr=isSSR()?br:window.localStorage,Er=isSSR()?br:window.sessionStorage;StorageService.getSourceStorage("localStorage")||StorageService.registerSourceStorage("localStorage",createStorageService({postfix:fr,storage:wr})),StorageService.getSourceStorage("sessionStorage")||StorageService.registerSourceStorage("sessionStorage",createStorageService({postfix:fr,storage:Er}))};var define_process_env_default$4={};const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID="2762a57b-faa4-41ce-9f16-abff9300e2c9",DynamicContext=reactExports.createContext(void 0),InnerDynamicContextProvider=({children:fr,theme:br,settings:wr,locale:Er,enableInstrumentation:kr=!1})=>{var jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En,Cn,In,An,jn,eo;const{accessDeniedMessagePrimary:ro,accessDeniedMessageSecondary:to,accessDeniedButton:_i,defaultPhoneInputIso2:oo,apiBaseUrl:io,coinbaseWalletPreference:co,detectNewWalletsForLinking:so=!1,enableConnectOnlyFallback:no=!1,deepLinkPreference:Tn="native",bridgeChains:Hr,cssOverrides:Xr,defaultNumberOfWalletsToShow:Sn=DEFAULT_NUMBER_OF_WALLETS_TO_SHOW,flowNetwork:Rn,initialAuthenticationMode:Pn="connect-and-sign",debugError:On=!1,displaySiweStatement:Zn=!0,newToWeb3WalletChainMap:Nn,enableVisitTrackingOnConnectOnly:wn=!0,environmentId:zn,walletsFilter:fo,logLevel:vo="WARN",mobileExperience:go,notInTheListImageUrl:uo,onboardingImageUrl:lo,policiesConsentInnerComponent:Eo,customPrivacyPolicy:mo,privacyPolicyUrl:yo,socialMediaLinkText:_o,socialMediaIconUrl:Bo,socialMediaUrl:Lo,customTermsOfServices:Wo,termsOfServiceUrl:na,toolkitEnabled:qo,siweStatement:ga,shadowDOMEnabled:wl=!0,walletConnectors:No,socialProvidersFilter:Fo,showLockedWalletView:Nl=!1,walletConnectPreferredChains:Vo,walletConnectorExtensions:Uo,recommendedWallets:Ml,handlers:$a}=wr;useRegisterStorageService({storagePostfix:wr.localStorageSuffix}),initializeStore({environmentId:zn,storageSuffix:wr.localStorageSuffix}),setChainInfoOverrides((jr=wr.overrides)===null||jr===void 0?void 0:jr.chainDisplayValues);const Jo=(Br=wr.events)!==null&&Br!==void 0?Br:wr.eventsCallbacks,Zl=resolveNetworkValidationMode({bridgeChains:wr.bridgeChains,networkValidationMode:wr.networkValidationMode});let{appLogoUrl:Cl="https://demo.dynamic.xyz/assets/dynamic-logo.svg",appName:ko="Dynamic Example"}=wr;if(!zn)throw new MissingEnvironmentIdError;logger$6.setLogLevel(vo),logger$7.setLogLevel(vo),zn===PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID&&logger$6.warn(`WARNING: DYNAMIC is using a test environment ID ${zn}. Please sign up on https://app.dynamic.xyz/ to get your production environment ID.`),ApiEndpoint$1.setBaseUrl((Wr=define_process_env_default$4.DYNAMIC_API_BASE_URL)!==null&&Wr!==void 0?Wr:io);const wo=Locale.setup(Er),bo=!!Hr,Io=getDeepLinkPreference(Tn,bo),{selectedTabIndex:Ho,setSelectedTabIndex:Do,selectedTabSettings:zo,tabsItems:nu}=useTabState({settingsOverrides:wr.overrides}),[Ll,_l,bu]=useLocalStorage$1(BRIDGE_ONBOARDING_COMPLETED,!1),[xl,Tl]=reactExports.useState(!1),[du,Bl]=reactExports.useState(!1),[Il,Eu]=reactExports.useState(!1),{user:Al,userWithMissingInfo:Ol}=useUser(),Tu=!!Al;Al?logger$6.setMetaData("user",Al):logger$6.setMetaData("user",void 0);const{consumeNonce:Ul}=useFetchNonce(zn),[Sl,_u]=reactExports.useState(""),[So,Co]=reactExports.useState(""),[Ao,po,{awaiting_account_switch:[Ro],awaiting_signature:[Xo]}]=useMultiWalletWidgetState(),{settings:jo}=useProjectSettings(),Ko=useNetworkConfigurationsFromProjectSettings({cosmosNetworkOverrides:(qr=wr.overrides)===null||qr===void 0?void 0:qr.cosmosNetworks,evmNetworksOverrides:(Gr=wr.overrides)===null||Gr===void 0?void 0:Gr.evmNetworks,projectSettings:jo});useSendDynamicProps({environmentId:zn,settings:wr});const Wl=useMultiWallet({isBridgeFlow:bo,multiWalletOverride:(Vr=wr.overrides)===null||Vr===void 0?void 0:Vr.multiWallet,multiWalletSettings:(Zr=jo==null?void 0:jo.sdk)===null||Zr===void 0?void 0:Zr.multiWallet}),$l=useMultiAsset({multiAssetOverride:(Jr=wr.overrides)===null||Jr===void 0?void 0:Jr.multiAsset,multiAssetSettings:(Qr=jo==null?void 0:jo.sdk)===null||Qr===void 0?void 0:Qr.enableMultiAsset}),El=useShowFiat({showFiatOverride:(_n=wr.overrides)===null||_n===void 0?void 0:_n.showFiat,showFiatSettings:(En=jo==null?void 0:jo.sdk)===null||En===void 0?void 0:En.showFiat}),[Cu,iu]=reactExports.useState(!1),pu=useWalletBookCdn(),{imageUserInAccessList:yu,imageUserNotInAccessList:hu,displayName:mu,appLogo:vu}=(jo==null?void 0:jo.general)||{};Cl=vu||Cl,ko=mu||ko;const[fu,gu,ou]=useEmailLoginState((jo==null?void 0:jo.providers)||[],Al),[su,tu]=useDisplayOrderState(jo),[zl,Gl]=useWalletUiUtils({appLogoUrl:Cl,appName:ko,hideEmbeddedWalletTransactionUIs:!(!((In=(Cn=jo==null?void 0:jo.sdk)===null||Cn===void 0?void 0:Cn.embeddedWallets)===null||In===void 0)&&In.showEmbeddedWalletActionsUI)});useCreateWalletConnectorOptions({appLogoUrl:Cl,appName:ko,coinbaseWalletPreference:co,deepLinkPreference:Io,flowNetwork:Rn,mobileExperience:go,networkConfigurations:Ko,projectSettings:jo,walletBook:pu,walletConnectPreferredChains:Vo,walletConnectorExtensions:Uo,walletConnectorsProp:No,walletUiUtils:Gl});const Jl=useWalletConnectorOptions(),[Pl,Fl]=reactExports.useState(Pn),{clearPrimaryWalletId:Yl,primaryWalletId:Vl,setPrimaryWalletId:Ql}=usePrimaryWalletId({environmentId:zn,user:Al}),[au,Nu]=reactExports.useState(!1),Wu=!!(Pl==="connect-and-sign"?Al:au),zu=reactExports.useRef(!1),[Bu,Qo]=useShowAuthFlow({isAuthenticated:Wu,isMultiWalletEnabled:Wl,isRenderingEmbeddedAuthFlow:zu,setShowDynamicUserProfile:Tl}),{connectWallet:Zu,removeConnectedWalletsInfo:Qu,connectedWalletsInfo:_h,getConnectedWalletById:qu,connectedWallets:Ju,disconnectWallet:_d,refreshConnectedWallet:dp}=useConnectWallet({authMode:Pl,clearPrimaryWalletId:Yl,enableVisitTrackingOnConnectOnly:wn,environmentId:zn,handleConnectedWallet:$a==null?void 0:$a.handleConnectedWallet,isBridgeFlow:bo,primaryWalletId:Vl,setPrimaryWalletId:Ql,setShowAuthFlow:Qo,user:Al,walletConnectorOptions:Jl}),Ku=reactExports.useMemo(()=>getMissingChains(Hr,_h),[Hr,_h]),{selectedWalletConnector:Vu,setSelectedWalletConnectorKey:cp}=useSelectedWalletConnector({walletConnectorOptions:Jl}),[fp,lp]=reactExports.useState(null);useSetWalletConnectorVerifiedCredentials(Al??Ol,Jl),useSetWalletConnectorFetchers(Jl,zn);const{primaryWallet:np,showQrcodeModal:Rp,secondaryWallets:wp,setPrimaryWallet:a0,setShowQrcodeModal:ey,wallets:ym}=useWalletConnectors({authMode:Pl,canHaveMultipleWalletsConnected:Wl,connectedWallets:Ju,primaryWalletId:Vl,separateSmartWalletAndSigner:(jn=(An=jo==null?void 0:jo.sdk)===null||An===void 0?void 0:An.accountAbstraction)===null||jn===void 0?void 0:jn.separateSmartWalletAndSigner,setMultiWalletWidgetState:po,setPrimaryWalletId:Ql,user:Al||Ol,walletConnectorOptions:Jl});reactExports.useEffect(()=>{Nu(!(Ku!=null&&Ku.length)&&!!np)},[Ku,np]);const s0=ym.map(Yu=>Yu.connector);useFetchProjectSettings({environmentId:zn});const{getNameService:c0,removeConnectedNameService:l0}=useNameService({currentWallet:np??Ju[0],user:Al}),{clearAllWalletConnectSessions:d0}=useClearWalletConnectSessions({connectors:s0}),Rm=useHandleLogout({bridgeChains:Hr,clearAllWalletConnectSessions:d0,clearPrimaryWalletId:Yl,connectedWallets:Ju,environmentId:zn,events:Jo,initialAuthenticationMode:Pn,removeBridgeOnboardingCompleted:bu,removeConnectedNameService:l0,removeConnectedWalletsInfo:Qu,removeSessionStorageSessionKeys:()=>{StorageService.removeItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS,SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS),s0.forEach(Yu=>{isSessionKeyCompatibleWalletConnector(Yu)&&typeof(Yu==null?void 0:Yu.removeSessionKeys)=="function"&&(Yu==null||Yu.removeSessionKeys())})},resetLoginWithEmail:ou,setAuthMode:Fl,setLegacyIsVerifying:iu,setMultiWalletWidgetState:po,setSelectedWalletConnectorKey:cp,setShowAuthFlow:Qo,setShowBridgeWidget:Bl,setShowDynamicUserProfile:Tl,user:Al,walletConnectors:s0});useValidateSession({environmentId:zn,handleLogOut:Rm});const{isLoading:qm}=useResetCookieLocalStorage({environmentId:zn,projectSettings:jo,setPrimaryWalletId:Ql}),f0=useGlobalLoading({appName:ko,authMode:Pl,connectedInfo:_h[0],connectedWallets:Ju,enableInstrumentation:kr,environmentId:zn,isLoadingUserFromCookie:qm,primaryWallet:np,primaryWalletId:Vl,projectSettings:jo,user:Al??Ol,walletBook:pu});useTieCallbacksToEvents({clientCallbacks:Jo,user:Al});const h0=useHandleUnlinkWallet({environmentId:zn,primaryWalletId:Vl,secondaryWallets:wp,verifiedCredentials:(Al==null?void 0:Al.verifiedCredentials)||[]}),{isLoading:zm,network:p0}=useWalletConnectorNetwork(np==null?void 0:np.connector,{onChange:Yu=>{Yu&&dynamicEvents.emit("primaryWalletNetworkChanged",Yu)}});useWalletEventListeners({authMode:Pl,detectNewWalletsForLinking:so,disconnectWallet:_d,handleLogOut:Rm,multiWallet:Wl,multiWalletWidgetState:Ao,primaryWallet:np,refreshConnectedWallet:dp,secondaryWallets:wp,selectedWalletConnector:Vu,selectedWalletWithAction:fp,setMultiWalletWidgetState:po,setPrimaryWalletId:Ql,setSelectedWalletConnectorKey:cp,setSelectedWalletWithAction:lp,user:Al});const{walletsForChainsMap:ry}=useFetchWalletsForChainsMap(Nn);reactExports.useEffect(()=>{initExpirationTime(Rm)},[Rm,Tu]);const{setCallback:Lu}=useCustomerCallbacks({callbacks:{onAuthSuccess:Jo==null?void 0:Jo.onAuthSuccess,onUserProfileUpdate:Jo==null?void 0:Jo.onUserProfileUpdate},handleLogOut:Rm,isAuthenticated:Tu,primaryWallet:np,user:Al}),Du=reactExports.useCallback(()=>Yu=>{const{dynamicWagmiSettings:Xu}=Yu;Xu&&sendDynamicProps(zn,{dynamicWagmiSettings:{dynamicWagmiSettings:Xu}})},[zn]),Zo=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){Co(""),iu(!1),Al||d0(),po("idle"),Pl!=="connect-only"&&Qu(),StorageService.getItem(WALLET_PICKER_SEARCH_KEY)&&StorageService.removeItem(WALLET_PICKER_SEARCH_KEY),StorageService.removeItem(PHANTOM_SIGNATURE_STATE),Vu&&(!np||np.connector.key!==Vu.key)&&(yield Vu==null?void 0:Vu.endSession())}),[Al,po,Pl,Vu,np,d0,Qu]),{passkeySuccessPopup:Dl,setPasskeySuccessPopup:ru}=usePasskeySuccessPopup(),Au=reactExports.useMemo(()=>{var Yu;return{accessDeniedButton:_i,accessDeniedMessagePrimary:ro,accessDeniedMessageSecondary:to,accountSwitchState:Ro,appLogoUrl:Cl,appName:ko,authMode:Pl,authToken:getAuthToken(),authorizationViewDisplayOrder:su,awaitingSignatureState:Xo,bridgeChains:Hr,bridgeChainsToConnect:Ku,bridgeOnboardingCompleted:Ll,clearStatesOnBackClick:Zo,connectWallet:Zu,connectedWallets:Ju,consumeNonce:Ul,cssOverrides:Xr,customPrivacyPolicy:mo,customTermsOfServices:Wo,debugError:On,defaultNumberOfWalletsToShow:Sn,defaultPhoneInputIso2:oo,desktopUri:So,detectNewWalletsForLinking:so,disconnectWallet:_d,displaySiweStatement:Zn,enableConnectOnlyFallback:no,environmentId:zn,events:Jo,getConnectedWalletById:qu,getNameService:c0,handleLogOut:Rm,handleUnlinkWallet:Pl==="connect-only"?_d:h0,handlers:$a,i18nSDKInstance:wo,isBridgeFlow:bo,isRenderingEmbeddedAuthFlow:zu,isSingleWalletAccount:Il,legacyIsVerifying:Cu,linkedWallets:Pl==="connect-only"||!Al?[]:ym,loadingNetwork:zm,locale:{changeLanguage:Locale.getInstance().changeLanguage},loginWithEmail:fu,minAuthToken:getMinAuthToken$1(),multiAsset:$l,multiWallet:Wl,multiWalletWidgetState:Ao,network:p0,networkConfigurations:Ko,networkValidationMode:Zl,newToWeb3WalletChainMap:ry,notInTheListImageUrl:hu||uo,onboardingImageUrl:yu||lo,overrides:wr.overrides,passkeySuccessPopup:Dl,policiesConsentInnerComponent:Eo,primaryWallet:np,primaryWalletId:Vl,privacyPolicyUrl:yo,projectSettings:jo,qrcodeUri:Sl,recommendedWallets:Ml,redirectUrl:wr.redirectUrl,removeBridgeOnboardingCompleted:bu,removeConnectedWalletsInfo:Qu,sdkHasLoaded:f0,secondaryWallets:wp,selectedTabIndex:Ho,selectedTabSettings:zo,selectedWalletConnector:Vu,selectedWalletWithAction:fp,sendWagmiSettings:Du,setAuthMode:Fl,setAuthorizationViewDisplayOrder:tu,setBridgeOnboardingCompleted:_l,setCallback:Lu,setDesktopUri:Co,setIsSingleWalletAccount:Eu,setLegacyIsVerifying:iu,setLogInWithEmail:gu,setMultiWalletWidgetState:po,setPasskeySuccessPopup:ru,setPrimaryWallet:a0,setPrimaryWalletId:Ql,setQrcodeUri:_u,setSelectedTabIndex:Do,setSelectedWalletConnectorKey:cp,setSelectedWalletWithAction:lp,setShowAuthFlow:Qo,setShowBridgeWidget:Bl,setShowDynamicUserProfile:Tl,setShowQrcodeModal:ey,shadowDOMEnabled:wl,showAuthFlow:Bu,showBridgeWidget:du,showDynamicUserProfile:xl,showFiat:El,showLockedWalletView:Nl,showQrcodeModal:Rp,siweStatement:ga,socialMediaIconUrl:((Yu=jo==null?void 0:jo.general)===null||Yu===void 0?void 0:Yu.supportUrls)||Bo,socialMediaLinkText:_o,socialMediaUrl:Lo,socialProvidersFilter:Fo,socialSettings:wr.social,tabsItems:nu,termsOfServiceUrl:na,theme:br,toolkitEnabled:qo,user:Al,userWithMissingInfo:Ol,walletConnectorOptions:Jl,walletUiUtils:Gl,walletsFilter:fo}},[_i,ro,to,Ro,Cl,ko,Pl,su,Xo,Hr,Ku,Ll,Zo,Zu,Ju,Ul,Xr,mo,Wo,On,Sn,oo,So,so,_d,Zn,no,zn,Jo,qu,c0,Rm,h0,$a,wo,bo,Il,Cu,Al,ym,zm,fu,$l,Wl,Ao,p0,Ko,Zl,ry,hu,uo,yu,lo,wr.overrides,wr.redirectUrl,wr.social,Dl,Eo,np,Vl,yo,jo,Sl,Ml,bu,Qu,f0,wp,Ho,zo,Vu,fp,Du,Fl,tu,_l,Lu,gu,po,ru,a0,Ql,Do,cp,Qo,ey,wl,Bu,du,xl,El,Nl,Rp,ga,Bo,_o,Lo,Fo,nu,na,br,qo,Ol,Jl,Gl,fo]);return usePrefetch({as:"image",href:getIconicSpriteUrl$1(),id:"sprite",type:"image/svg+xml"}),usePrefetch({as:"fetch",href:getWalletBookCdnUrl(),id:"wallet-book",type:"application/json"}),usePrefetch({as:"fetch",href:`${ApiEndpoint$1.getBaseUrl()}/sdk/${zn}/settings?sdkVersion=${encodeURIComponent(`WalletKit/${VERSION$2}`)}`,id:`project-settings-${zn}`,type:"application/json"}),reactExports.useEffect(()=>{!Wl&&Ao!=="awaiting_account_switch"||Al&&Ao!=="idle"&&!xl&&Tl(!0)},[Wl,Ao,xl]),jsxRuntimeExports.jsx(I18nextProvider,{i18n:wo,children:jsxRuntimeExports.jsx(DynamicContext.Provider,{value:Au,children:jsxRuntimeExports.jsx(WalletBookContextProvider,{walletBook:pu,children:jsxRuntimeExports.jsx(ThemeContextProvider,{customerTheme:parseTheme(br,((eo=jo==null?void 0:jo.design)===null||eo===void 0?void 0:eo.modal)||void 0),designSettings:jo==null?void 0:jo.design,children:jsxRuntimeExports.jsx(LoadingContextProvider,{children:jsxRuntimeExports.jsxs(ViewContextProvider,{initialView:getInitialView({bridgeOnboardingCompleted:Ll,connectedWallets:Ju,isAuthenticated:Tu||!!np,isBridgeFlow:bo,isMultiWalletEnabled:Wl}),children:[Zl==="always"&&jsxRuntimeExports.jsx(UseNetworkValidation,{}),jsxRuntimeExports.jsx(CaptchaContextProvider,{children:jsxRuntimeExports.jsx(AccountExistsContextProvider,{children:jsxRuntimeExports.jsx(WalletContextProvider,{children:jsxRuntimeExports.jsx(VerificationProvider,{children:jsxRuntimeExports.jsx(PasskeyContextProvider,{children:jsxRuntimeExports.jsx(DynamicWidgetContextProvider,{children:jsxRuntimeExports.jsx(DynamicBridgeWidgetContextProvider,{children:jsxRuntimeExports.jsx(FundingContextProvider,{children:jsxRuntimeExports.jsx(AccessDeniedContextProvider,{children:jsxRuntimeExports.jsx(SendBalanceContextProvider,{children:jsxRuntimeExports.jsx(WalletGroupContextProvider,{children:jsxRuntimeExports.jsx(UserFieldEditorContextProvider,{children:jsxRuntimeExports.jsx(ConnectWithOtpProvider,{children:jsxRuntimeExports.jsx(PhantomRedirectContextProvider,{children:jsxRuntimeExports.jsxs(SocialRedirectContextProvider,{children:[jsxRuntimeExports.jsx(DynamicAuthFlow,{}),jsxRuntimeExports.jsx(Toolkit,{}),jsxRuntimeExports.jsx(FundingWidget,{}),jsxRuntimeExports.jsx(SyncAuthFlow,{}),jsxRuntimeExports.jsx(TelegramAutoLogin,{}),jsxRuntimeExports.jsx(WalletConnectorEvents,{}),zl,jsxRuntimeExports.jsx(ErrorBoundaryExclude,{children:fr})]})})})})})})})})})})})})})})})]})})})})})})},DynamicContextProvider=fr=>(Logger$1.setEnvironmentId(fr.settings.environmentId),Logger$1.setEmitErrors(fr.emitErrors),useParentDynamicContextGuard(),jsxRuntimeExports.jsx(ReinitializeContextProvider,{onReinitialize:removeStoreInstance,children:jsxRuntimeExports.jsx(ErrorBoundary,{children:jsxRuntimeExports.jsx(ErrorContextProvider,{children:jsxRuntimeExports.jsx(UserWalletsProvider,{children:jsxRuntimeExports.jsx(FieldsStateProvider,{children:jsxRuntimeExports.jsx(IpConfigurationContextProvider,{children:jsxRuntimeExports.jsx(WidgetRegistryContextProvider,{children:jsxRuntimeExports.jsx(InnerDynamicContextProvider,Object.assign({},fr))})})})})})})})),embeddedWalletsKeys=["magicemailotp","magiclink","magicsocial","turnkey","turnkeyhd","coinbasempc","zerodev"],useWalletOptions=()=>{const{walletConnectorOptions:fr,setShowAuthFlow:br}=useInternalDynamicContext(),{walletBook:wr}=useWalletBookContext(),{setView:Er}=useViewContext(),{navigateToWalletGroup:kr}=useWalletGroupContext(),{handleWalletItemClick:jr}=useWalletItemActions(),Br=reactExports.useMemo(()=>{var qr;return(qr=fr==null?void 0:fr.filter(Gr=>!embeddedWalletsKeys.includes(Gr.walletConnector.key)).map(Gr=>{const Vr=Gr.group&&Object.keys(wr).length?getWalletGroup(wr,Gr.group).name:void 0;return{group:Gr.group,groupName:Vr,isInstalledOnBrowser:Gr.isInstalledOnBrowser,key:Gr.walletConnector.key,name:Gr.name}}))!==null&&qr!==void 0?qr:[]},[wr,fr]);return{selectWalletOption:qr=>__awaiter$e(void 0,void 0,void 0,function*(){const Vr=groupWalletOptions(wr,fr).find(Zr=>Zr.key===qr);if(logger$6.logVerboseTroubleshootingMessage("[useWalletOptions] selectWalletOption",{walletKey:qr,walletOption:Vr==null?void 0:Vr.key}),!Vr)throw new DynamicError("Invalid wallet option key provided.");isWalletGroup(Vr)?kr(Vr):isHardwareWalletConnector(Vr.walletConnector)&&Vr.walletConnector.canConnectWithHardwareWallet()?Er("select-hardware-wallet",{onSelectWallet:jr,wallet:Vr}):jr(Vr),br(!0)}),walletOptions:Br}};assertPackageVersion("@dynamic-labs/sdk-react-core",version$s);const initialState={wallet:null,dynamicWallet:null,theme:"light",user:null,isAuthenticated:!1,jwt:null,walletLoadState:"idle"};function globalReducer(fr,br){switch(br.type){case"INITIALIZE_WALLET":return{...fr,wallet:br.payload};case"SET_DYNAMIC_WALLET":return{...fr,dynamicWallet:br.payload};case"RESET_WALLET":return{...fr,wallet:null,walletLoadState:"idle",dynamicWallet:null};case"SET_THEME":return{...fr,theme:br.payload};case"SET_USER":return{...fr,user:br.payload};case"SET_AUTHENTICATED":return{...fr,isAuthenticated:br.payload};case"SET_JWT":return{...fr,jwt:br.payload};case"SET_WALLET_LOAD_STATE":return{...fr,walletLoadState:br.payload};case"RESET_AUTHENTICATED":return{...fr,isAuthenticated:!1,walletLoadState:"idle",dynamicWallet:null,jwt:null};case"RESET_USER":return{...fr,user:null,walletLoadState:"idle",dynamicWallet:null,jwt:null};default:return fr}}const GlobalContext=reactExports.createContext({state:initialState,dispatch:()=>null});function useGlobalState(){const fr=reactExports.useContext(GlobalContext);if(!fr)throw new Error("useGlobalState must be used within a GlobalProvider");return fr}const GlobalProvider=({children:fr})=>{const[br,wr]=reactExports.useReducer(globalReducer,initialState),{primaryWallet:Er,sdkHasLoaded:kr}=useDynamicContext(),jr=extractStateFromUrl(),Br=sessionStorage.getItem("jwt");return reactExports.useEffect(()=>{br.wallet?new PostMessageHandler(br.wallet,()=>wr({type:"INITIALIZE_WALLET",payload:br.wallet})):new PostMessageHandler(void 0,()=>{})},[br.wallet]),reactExports.useEffect(()=>{(async()=>{try{if(wr({type:"SET_WALLET_LOAD_STATE",payload:"loading"}),jr){const qr=await fetchJwtUsingState({stateParam:jr});sessionStorage.setItem("jwt",qr),wr({type:"SET_JWT",payload:qr});const Gr=new URL(window.location.href);Gr.searchParams.delete("state"),window.history.replaceState({},document.title,Gr.pathname),wr({type:"SET_WALLET_LOAD_STATE",payload:"success"})}Br&&(wr({type:"SET_JWT",payload:Br}),wr({type:"SET_WALLET_LOAD_STATE",payload:"success"})),Er&&(wr({type:"SET_WALLET_LOAD_STATE",payload:"success"}),wr({type:"SET_DYNAMIC_WALLET",payload:Er})),!jr&&!Br&&!Er&&kr&&wr({type:"SET_WALLET_LOAD_STATE",payload:"rejected"})}catch(qr){throw wr({type:"SET_WALLET_LOAD_STATE",payload:"rejected"}),console.error("Error creating wallet:",qr),qr}})()},[jr,Br,Er,kr]),jsxRuntimeExports.jsx(GlobalContext.Provider,{value:{state:br,dispatch:wr},children:fr})},StyledIconWrapper=qe$2.span` +Expected: awaiting_signature`)},useAwaitingSignature=()=>{const[fr,br]=reactExports.useState("idle"),wr=reactExports.useCallback(()=>{br("idle")},[br]),Er=reactExports.useCallback((kr,jr)=>{validateMultiWalletWidgetState(jr),validateStateTransition$1({from:fr,to:kr}),br(kr)},[fr]);return[fr,Er,wr]},validTransitions={awaiting_account_switch:["awaiting_signature","idle"],awaiting_connection:["idle"],awaiting_signature:["idle"],detected_new_wallet:["awaiting_signature","idle"],idle:["awaiting_account_switch","awaiting_connection","awaiting_signature","detected_new_wallet"]},validateStateTransition=({from:fr,to:br})=>{if(fr!==br&&!validTransitions[fr].includes(br))throw new Error(`Invalid MultiWalletWidget state transition from ${fr} to ${br}`);return!0},useMultiWalletWidgetState=()=>{const[fr,br]=reactExports.useState("idle"),[wr,Er,kr]=useAwaitingAccountSwitch(),[jr,Br,Wr]=useAwaitingSignature(),qr=reactExports.useCallback(()=>{kr(),Wr()},[kr,Wr]),Gr=reactExports.useCallback((Vr,Zr,Jr)=>{validateStateTransition({from:fr,to:Vr}),br(Vr),qr(),Zr&&Er(Zr,Vr),Jr&&Br(Jr,Vr)},[fr,qr,Er,Br]);return[fr,Gr,{awaiting_account_switch:[wr,Er],awaiting_signature:[jr,Br]}]},useClearWalletConnectSessions=({connectors:fr})=>{const br=()=>{if(!(typeof window>"u")){for(const wr of StorageService.getKeys())(wr.startsWith("walletconnect")||wr.startsWith("walletlink")||wr.startsWith("wc@2"))&&localStorage.removeItem(wr);fr==null||fr.forEach(wr=>{var Er,kr,jr;!((kr=(Er=wr==null?void 0:wr.name)===null||Er===void 0?void 0:Er.toLowerCase())===null||kr===void 0)&&kr.startsWith("turnkey")&&((jr=wr.getAuthenticatorHandler())===null||jr===void 0||jr.clear(),StorageService.removeItem(EMBEDDED_WALLET_SESSION_SETTINGS),StorageService.removeItem(EMBEDDED_WALLET_SECURE_BANNER))})}};return reactExports.useEffect(()=>{if(typeof window>"u"||fr.length===0)return;const wr=new Set(fr.map(Er=>Er.key));for(const Er of StorageService.getKeys())Er.startsWith("walletconnect")&&!wr.has(Er.replace("walletconnect-",""))&&localStorage.removeItem(Er)},[fr]),{clearAllWalletConnectSessions:br}},revokeSession=fr=>__awaiter$e(void 0,[fr],void 0,function*({environmentId:br,sessionId:wr}){try{yield sdkApi$1().revokeSession({environmentId:br})}catch(Er){const kr=yield Er.json();logger$6.error(Error(kr.error.message))}}),mapChainToChainEnum=fr=>{const br=Object.values(ChainEnum).find(wr=>wr===fr);if(!br)throw new DynamicError(`Invalid chain ${fr}`);return br},mapProviderToProviderEnum=fr=>{const br=Object.values(WalletProviderEnum).find(wr=>wr===fr);if(!br)throw new DynamicError(`Invalid provider ${fr}`);return br},mapAuthModeTypeToEnum=fr=>{const br=Object.values(AuthModeEnum).find(wr=>wr===fr);if(!br)throw new DynamicError(`Invalid authMode ${fr}`);return br},createVisit=fr=>__awaiter$e(void 0,[fr],void 0,function*({authMode:br,chain:wr,environmentId:Er,walletProvider:kr,publicWalletAddress:jr,walletName:Br}){try{const Wr={address:jr,authMode:mapAuthModeTypeToEnum(br),chain:mapChainToChainEnum(wr),provider:mapProviderToProviderEnum(kr),walletName:Br};yield sdkApi$1().createVisit({connectRequest:Wr,environmentId:Er})}catch(Wr){logger$6.error(Wr)}}),getWalletConnectorForWallet=fr=>{var br,wr;if(!fr)return;const Er=getWalletConnectorOptions(),{key:kr,chain:jr}=fr,Br=(br=Er.find(qr=>kr===qr.key&&qr.walletConnector.connectedChain===jr))===null||br===void 0?void 0:br.walletConnector;return Br||((wr=Er.find(qr=>qr.key==="fallbackconnector"))===null||wr===void 0?void 0:wr.walletConnector)},useDebounce=(fr,br)=>{const wr=reactExports.useRef(null),Er=reactExports.useRef(fr);return Er.current=fr,reactExports.useCallback((...kr)=>{wr.current&&clearTimeout(wr.current),wr.current=window.setTimeout(()=>{Er.current(...kr)},br)},[br])},updateUserWalletsFromConnectedWallets=(fr,br)=>{const wr=[...fr],Er=new Set;for(const kr of br)Er.add(kr.address),wr.find(Br=>Br.address===kr.address)||wr.push(kr);return wr.filter(kr=>Er.has(kr.address)||kr.isAuthenticated)},useConnectWallet=({authMode:fr,clearPrimaryWalletId:br,enableVisitTrackingOnConnectOnly:wr,environmentId:Er,primaryWalletId:kr,setPrimaryWalletId:jr,walletConnectorOptions:Br,handleConnectedWallet:Wr,setShowAuthFlow:qr,isBridgeFlow:Gr,user:Vr})=>{const[Zr,Jr,Qr]=useLocalStorage$1(CONNECTED_WALLETS_INFO,[]),[_n,En]=reactExports.useState([]),{setUserWallets:Cn,addedWalletsIds:In,removedWalletsIds:An}=useInternalUserWallets(),jn=reactExports.useCallback(no=>{En(no),Cn(Tn=>updateUserWalletsFromConnectedWallets(Tn,no))},[Cn]),eo=reactExports.useCallback(no=>__awaiter$e(void 0,void 0,void 0,function*(){const Tn=_n.find(Sn=>Sn.id===no);yield Tn==null?void 0:Tn.connector.endSession();const Hr=Zr.filter(Sn=>Sn.id!==no);if(Jr(Hr),An.current.push(no),no!==kr)return;const Xr=Hr.length>0;Gr||!Xr?br():jr(Hr[0].id)}),[br,_n,Zr,Gr,kr,An,Jr,jr]),ro=useDebounce(()=>__awaiter$e(void 0,void 0,void 0,function*(){const no=Br.map(Hr=>Hr.walletConnector);if(!no.length)return;const Tn=(yield Promise.all(Zr.map(Hr=>__awaiter$e(void 0,void 0,void 0,function*(){const Xr=getWalletConnectorByKey(no,Hr.walletConnectorKey);if(!Xr)return logger$7.error("Could not find walletConnector: "+Hr.walletConnectorKey),yield eo(Hr.id),null;isHardwareWalletConnector(Xr)&&Hr.hardwareWallet===HardwareWalletEnum.Ledger&&(Xr.isHardwareWalletEnabled=!0);const[Sn]=yield Xr.getConnectedAccounts();if(!Sn)return yield eo(Hr.id),null;const Rn=yield Xr.getAdditionalAddresses(Sn),Pn=Xr.connectedChain;return Xr.createWallet({additionalAddresses:Rn,address:Sn,chain:Pn,connector:Xr,id:Hr.id,isAuthenticated:!1,key:Xr.key})})))).filter(Hr=>!!Hr);jn(Tn)}),300);reactExports.useEffect(()=>{ro()},[Zr,Br]);const to=reactExports.useCallback(no=>{const Hr=no.map(({id:Xr})=>Xr).map(Xr=>Number(Xr.replace("connect-wallet-",""))).sort((Xr,Sn)=>Xr-Sn);for(let Xr=0;Xr{var Hr;const Xr=[..._n],Sn=Xr.findIndex(Rn=>Rn.id===no);Sn<0||(Xr[Sn]=Xr[Sn].connector.createWallet(Object.assign(Object.assign({},Xr[Sn]),{address:(Hr=Tn.address)!==null&&Hr!==void 0?Hr:Xr[Sn].address,connector:getWalletConnectorForWallet(Xr[Sn])})),jn(Xr))},[_n,jn]),oo=({walletId:no,walletConnectorKey:Tn,walletChain:Hr,provider:Xr})=>{const Sn=[...Zr],Rn=Br.map(Zn=>Zn.walletConnector),Pn=getWalletConnectorByKey(Rn,Tn),On=Pn&&isHardwareWalletConnector(Pn)&&Pn.isHardwareWalletEnabled?HardwareWalletEnum.Ledger:void 0;Sn.push({hardwareWallet:On,id:no,provider:Xr,walletChain:Hr,walletConnectorKey:Tn}),Jr(Sn)},io=(no,Tn)=>__awaiter$e(void 0,void 0,void 0,function*(){shouldManuallyReconnectOnRefresh(Tn)&&(yield Tn.connect());const Hr=yield Tn.getAddress();if(Hr&&Wr&&!(yield Wr({address:Hr,chain:Tn.connectedChain,connector:Tn}))){logger$7.info("Connection was not established because handleConnectedWallet returned false"),eo(no),qr(!1,{emitCancelAuth:!0});return}_i(no,{address:Hr})}),co=(no,Tn,Hr)=>__awaiter$e(void 0,void 0,void 0,function*(){const{applyHandleConnectedWallet:Xr=!0}=Hr??{},Sn=yield no.getAddress(Tn);if(!Sn)throw new MissingPublicAddressError;if(Wr&&Xr&&!(yield Wr({address:Sn,chain:no.connectedChain,connector:no}))){logger$7.info("Connection was not established because handleConnectedWallet returned false"),qr(!1);return}const Rn=Zr.some(({walletConnectorKey:Nn})=>Nn===no.key),Pn=no.connectedChain;if(!Rn&&(fr!=="connect-only"||wr)&&createVisit({authMode:fr,chain:Pn||"",environmentId:Er,publicWalletAddress:Sn,walletName:no.key,walletProvider:getWalletProvider(no)}),!isConnectOnly(Vr,fr))return{address:Sn,id:""};const Zn=`connect-wallet-${to(Zr)}`;return kr||jr(Zn),In.current.push(Zn),Rn?yield ro():oo({provider:getWalletProvider(no),walletAddress:Sn,walletChain:Pn,walletConnectorKey:no.key,walletId:Zn}),{address:Sn,id:Zn}}),so=reactExports.useCallback(no=>_n.find(Tn=>Tn.id===no),[_n]);return{connectWallet:co,connectedWallets:_n,connectedWalletsInfo:Zr,disconnectWallet:eo,getConnectedWalletById:so,refreshConnectedWallet:io,removeConnectedWalletsInfo:Qr}},useFetchWalletsForChainsMap=fr=>({walletsForChainsMap:reactExports.useMemo(()=>fr?Object.assign(Object.assign({},defaultWalletsForChains),{primary_chain:fr.primary_chain,wallets:Object.assign(Object.assign({},defaultWalletsForChains.wallets),!!fr.wallets&&fr.wallets)}):defaultWalletsForChains,[fr])}),useHandleUnlinkWallet=({verifiedCredentials:fr,environmentId:br,primaryWalletId:wr,secondaryWallets:Er})=>{const{removedWalletsIds:kr}=useInternalUserWallets();return reactExports.useCallback(Br=>__awaiter$e(void 0,void 0,void 0,function*(){var Wr;const qr=(Wr=StorageService.getItem(PRIMARY_WALLET_ID))!==null&&Wr!==void 0?Wr:wr;if(Br===qr)return;yield unlinkWallet({environmentId:br,onSuccess:()=>{kr.current.push(Br)},primaryWalletId:qr,walletId:Br});const Gr=Er.find(Zr=>Zr.id===Br);fr.filter(Zr=>Zr.walletName===((Gr==null?void 0:Gr.connector.key)||"")).length===1&&(yield Gr==null?void 0:Gr.connector.endSession())}),[wr,br,Er,fr,kr])},primaryWalletIdValidator=fr=>typeof fr=="string"||typeof fr>"u",usePrimaryWalletId=({environmentId:fr,user:br})=>{const[wr,Er,kr]=useLocalStorage$1(PRIMARY_WALLET_ID,void 0,primaryWalletIdValidator),jr=reactExports.useCallback(Br=>__awaiter$e(void 0,void 0,void 0,function*(){Er(Br),br&&(yield storeSelectedWallet({environmentId:fr,walletId:Br}))}),[fr,Er,br]);return{clearPrimaryWalletId:kr,primaryWalletId:wr,setPrimaryWalletId:jr}},useWalletEventListeners=({disconnectWallet:fr,handleLogOut:br,multiWallet:wr,multiWalletWidgetState:Er,primaryWallet:kr,secondaryWallets:jr,selectedWalletConnector:Br,selectedWalletWithAction:Wr,setSelectedWalletConnectorKey:qr,setSelectedWalletWithAction:Gr,setMultiWalletWidgetState:Vr,user:Zr,setPrimaryWalletId:Jr,authMode:Qr,refreshConnectedWallet:_n,detectNewWalletsForLinking:En})=>{const Cn=reactExports.useCallback((jn,eo)=>{logger$6.debug("handleAccountChangeWhenAwaitingAccountSwitch",{isPrimaryWallet:jn,newAddress:eo});const ro=jr.find(_i=>isSameAddress$1(_i.address,eo,_i.chain));if(logger$6.logVerboseTroubleshootingMessage("[handleAccountChangeWhenAwaitingAccountSwitch]",{linkedSecondaryWallet:ro}),!ro){Vr("awaiting_signature",void 0,"linking_new_wallet"),jn&&kr&&qr(kr.connector.key);return}if(ro.connector.key==="unknown"){dynamicEvents.emit("triggerConnectAndSign");return}Gr(null),Jr(ro.id),Vr("idle")},[Vr,kr,jr,qr,Gr,Jr]),In=reactExports.useCallback(({accounts:jn})=>{if(logger$6.debug("calculatePrimaryWalletMultiWalletStateFromAccounts",{accounts:jn,authMode:Qr,multiWallet:wr,multiWalletWidgetState:Er,primaryWallet:kr}),!kr)return;const[eo]=jn;if(!!isSameAddress$1(eo,kr.address,kr.chain)){Vr("idle");return}if(Qr==="connect-only"){_n(kr.id,kr.connector);return}if(!wr)return;if(Er==="awaiting_account_switch"){Cn(!0,eo);return}Er!=="idle"&&(logger$6.error(`Unexpected multiWalletWidgetState (${Er}) and onAccountChange combination. Resetting state to idle.`),Vr("idle"));const to=jr.find(_i=>isSameAddress$1(_i.address,eo,_i.chain));if(to){Jr(to.id);return}Zr&&En&&(Vr("detected_new_wallet"),qr(kr.connector.key))},[Qr,En,Cn,wr,Er,kr,_n,jr,Vr,Jr,qr,Zr]);useInternalDynamicEvents("triggerComputePrimaryWalletMultiWalletStateFromAccounts",In),useWalletConnectorEvent(kr==null?void 0:kr.connector,"accountChange",({accounts:jn})=>{logger$6.debug("primary wallet account change",{accounts:jn}),In({accounts:jn})});const An=reactExports.useMemo(()=>{const jn=kr==null?void 0:kr.connector,eo=jr.map(({connector:to})=>to),ro=new Set([...eo,jn,Br].filter(to=>!!to));return jn&&ro.delete(jn),Array.from(ro)},[jr,Br,kr==null?void 0:kr.connector]);useWalletConnectorEvent(An,"accountChange",(jn,eo)=>__awaiter$e(void 0,void 0,void 0,function*(){if(logger$6.debug("secondary wallet account change"),Qr==="connect-only"&&jr.length){const ro=jr.filter(({connector:to})=>to.key===eo.key);for(const to of ro)_n(to.id,to.connector);return}Er==="awaiting_account_switch"&&Cn(!1,(Wr==null?void 0:Wr.wallet.address)||"")})),useWalletConnectorEvent(kr==null?void 0:kr.connector,"disconnect",()=>{logger$6.debug("primary wallet disconnect"),Qr==="connect-only"&&br()}),useWalletConnectorEvent(An,"disconnect",jn=>{if(logger$6.debug("secondary wallet disconnect"),Qr==="connect-only"){const eo=jr.filter(({connector:ro})=>ro.key===jn.key);for(const ro of eo)fr(ro.id)}})},useTabState=({settingsOverrides:fr})=>{var br,wr,Er;const kr=(br=fr==null?void 0:fr.views)===null||br===void 0?void 0:br.find(qr=>qr.type==="wallet-list"),[jr,Br]=reactExports.useState(0),Wr=jr===null||(wr=kr==null?void 0:kr.tabs)===null||wr===void 0?void 0:wr.items[jr];return{selectedTabIndex:jr,selectedTabSettings:Wr,setSelectedTabIndex:Br,tabsItems:(Er=kr==null?void 0:kr.tabs)===null||Er===void 0?void 0:Er.items}},DynamicBridgeWidgetContext=t$7.createContext(void 0),initialView="wallets",DynamicBridgeWidgetContextProvider=({children:fr})=>{const br=reactExports.useRef(null),wr=reactExports.useRef(null),[Er,kr]=reactExports.useState(initialView),jr=reactExports.useCallback(()=>{kr(initialView)},[]),Br=reactExports.useCallback(()=>{kr("profile")},[]),Wr={bridgeWidgetView:Er,events:{onDynamicBridgeWidgetClose:jr},goToProfileView:Br,inlineControlsRef:wr,setBridgeWidgetView:kr,widgetRef:br};return jsxRuntimeExports.jsx(DynamicBridgeWidgetContext.Provider,{value:Wr,children:fr})},DynamicWidgetCard=reactExports.forwardRef(({children:fr},br)=>jsxRuntimeExports.jsx("div",{ref:br,className:"dynamic-widget-card",children:fr}));DynamicWidgetCard.displayName="DynamicWidgetCard";const widgetRegistryContext=reactExports.createContext(null),WidgetRegistryContextProvider=({children:fr})=>{const[br,wr]=reactExports.useState({}),Er=reactExports.useCallback((Br,Wr)=>{wr(qr=>Object.assign(Object.assign({},qr),{[Br]:{type:Wr}}))},[wr]),kr=reactExports.useCallback(Br=>{wr(Wr=>{const qr=Object.assign({},Wr);return delete qr[Br],qr})},[wr]),jr=reactExports.useCallback(Br=>Object.values(br).some(Wr=>Wr.type===Br),[br]);return jsxRuntimeExports.jsx(widgetRegistryContext.Provider,{value:{checkWidgetPresence:jr,registerId:Er,removeId:kr},children:fr})},Modal=({onrampUrl:fr})=>{const{fundingRef:br,setShowFunding:wr}=useFundingContext();return useOnClickOutside(br,()=>{wr(!1)}),jsxRuntimeExports.jsx("div",{className:"fund-wallet__modal","data-testid":"fund-wallet-modal",children:jsxRuntimeExports.jsx("div",{className:"fund-wallet__modal-content",ref:br,children:jsxRuntimeExports.jsx("iframe",{id:"onramp-iframe",src:fr,allow:"camera *;geolocation *",title:"Crypto Onramp"})})})},FundWalletView=()=>{const{primaryWallet:fr}=useInternalDynamicContext(),{showFunding:br,fundingUrl:wr,fundingEnabled:Er}=useFundingContext();return!Er||!br||!wr||!(fr!=null&&fr.address)?null:jsxRuntimeExports.jsx(ShadowDOM,{children:jsxRuntimeExports.jsxs(OpacityTransition,{isShown:br,children:[jsxRuntimeExports.jsx("div",{className:"fund-wallet__backdrop","aria-hidden":"true"}),jsxRuntimeExports.jsx("div",{className:"fund-wallet__modal-container",children:jsxRuntimeExports.jsx(Modal,{onrampUrl:wr})})]})})},FundingWidget=()=>jsxRuntimeExports.jsx(FundWalletView,{}),ConnectWithOtpContext=reactExports.createContext(void 0),createEmailHandler=(fr,{shouldRegisterSessionKeysOnSignin:br,generateSessionKey:wr})=>Er=>__awaiter$e(void 0,void 0,void 0,function*(){const kr=yield createEmailVerification({email:Er,environmentId:fr});let{verificationUUID:jr}=kr;return{retry:()=>__awaiter$e(void 0,void 0,void 0,function*(){jr=(yield retryEmailVerification({email:Er,environmentId:fr,verificationUUID:jr})).verificationUUID}),type:"email",verify:Br=>__awaiter$e(void 0,void 0,void 0,function*(){let Wr;br()&&(Wr=(yield wr()).publicKey);const qr=yield signInWithEmailVerification({environmentId:fr,sessionPublicKey:Wr,verificationToken:Br,verificationUUID:jr});return storeAuthTokenAndUser(qr),{destination:Er,verified:!!qr.jwt}})}}),createMagicHandler=(fr,br)=>wr=>__awaiter$e(void 0,void 0,void 0,function*(){if(!fr)throw new Error("OTP wallet connector was not found");return fr.setEmail(wr),br(fr),{retry:()=>fr.retryOneTimePassword(),type:"email",verify:Er=>__awaiter$e(void 0,void 0,void 0,function*(){return{destination:wr,verified:yield fr.verifyOneTimePassword(Er)}})}}),createSmsHandler=fr=>br=>__awaiter$e(void 0,void 0,void 0,function*(){const{generateSessionKey:wr,shouldRegisterSessionKeysOnSignin:Er}=useEmbeddedWalletSessionKeys(fr),{verificationUUID:kr}=yield createSmsVerification({environmentId:fr,isoCountryCode:br.iso2,phoneCountryCode:br.dialCode,phoneNumber:br.phone});return{type:"sms",verify:jr=>__awaiter$e(void 0,void 0,void 0,function*(){let Br;Er()&&(Br=(yield wr()).publicKey);const Wr=yield signInWithSmsVerification({environmentId:fr,sessionPublicKey:Br,verificationToken:jr,verificationUUID:kr});return storeAuthTokenAndUser(Wr),{destination:br,verified:!!Wr.jwt}})}}),mapEmailProviderToProviderEnum={dynamic:ProviderEnum.Dynamic,magicLink:ProviderEnum.MagicLink},allSupportedProviders=Object.values(mapEmailProviderToProviderEnum),findEmailProvider=(fr,br)=>__awaiter$e(void 0,void 0,void 0,function*(){const{emailProvider:wr}=yield getEmailProvider({email:br,environmentId:fr});if(!allSupportedProviders.includes(wr))throw new Error("Email provider is not supported");return wr}),{Provider:Provider$1}=ConnectWithOtpContext,ConnectWithOtpProvider=({children:fr})=>{const{walletConnectorOptions:br,environmentId:wr,projectSettings:Er,setCallback:kr}=useInternalDynamicContext(),jr=useEmbeddedWalletSessionKeys(wr),{handleInstalledExtensionClick:Br}=useWalletItemActions(),Wr=reactExports.useRef(null),qr=(Er==null?void 0:Er.providers)||[],Gr=br.map(({walletConnector:En})=>En).find(isEmailOTPWalletConnector),Vr={[ProviderEnum.Dynamic]:{enabled:isProviderEnabled(qr,ProviderEnum.Dynamic),handler:createEmailHandler(wr,jr)},[ProviderEnum.MagicLink]:{enabled:isProviderEnabled(qr,ProviderEnum.MagicLink),handler:createMagicHandler(Gr,Br)}},Zr=(En,...Cn)=>__awaiter$e(void 0,[En,...Cn],void 0,function*(In,{provider:An}={}){if(!isEmailValid(In))throw new Error("Email is not valid");const jn=An||(yield findEmailProvider(wr,In));if(!Vr[jn].enabled)throw new Error("Email provider is not enabled");const eo=yield Vr[jn].handler(In);Wr.current=eo}),Jr=En=>__awaiter$e(void 0,void 0,void 0,function*(){if(!isProviderEnabled(qr,ProviderEnum.Sms))throw new Error("SMS provider is not enabled");const In=yield createSmsHandler(wr)(En);Wr.current=In}),Qr=En=>__awaiter$e(void 0,void 0,void 0,function*(){if(!Wr.current)throw new Error("Verification has not started, use connectWithEmail or connectWithSms before verifying");const{type:Cn,verify:In}=Wr.current,{destination:An,verified:jn}=yield In(En);if(Cn==="sms"?dynamicEvents.emit("smsVerificationResult",jn,An):dynamicEvents.emit("emailVerificationResult",jn,An),jn)kr("authSuccess");else throw new Error(`${Cn==="sms"?"SMS":"Email"} verification failed`)}),_n=()=>__awaiter$e(void 0,void 0,void 0,function*(){if(!Wr.current)throw new Error("Verification has not started, use connectWithEmail or connectWithSms before verifying");if(!Wr.current.retry)throw new Error("Re-send is not supported");return Wr.current.retry()});return jsxRuntimeExports.jsx(Provider$1,{value:{connectWithEmail:Zr,connectWithSms:Jr,retryOneTimePassword:_n,verifyOneTimePassword:Qr},children:fr})},ERROR_BOUNDARY_CONTEXT_NOT_FOUND="ERROR_BOUNDARY_CONTEXT_NOT_FOUND",ErrorBoundaryContext=reactExports.createContext(null);function assertErrorBoundaryContext(fr){if(fr===null||typeof fr.hasError!="boolean"||typeof fr.error!="object"||typeof fr.isDynamicSdkError!="boolean"){const br=new Error("ErrorBoundaryContext not found");throw br.cause=ERROR_BOUNDARY_CONTEXT_NOT_FOUND,br}}class ErrorBoundaryBase extends reactExports.Component{static getDerivedStateFromError(br){return{error:br,hasError:!0}}renderOrError(br,{isDynamicSdkError:wr}){try{assertErrorBoundaryContext(this.context),this.context.isDynamicSdkError=wr}catch(Er){return logger$6.error(Er),reactExports.createElement(ErrorContainer,null,"ErrorBoundary must be used within ErrorBoundaryContext")}return br}}ErrorBoundaryBase.contextType=ErrorBoundaryContext;class ErrorBoundaryReporter extends ErrorBoundaryBase{constructor(br){super(br),this.state={error:null,hasError:!1}}componentDidCatch(br,wr){var Er;const{onError:kr}=this.props;throw!((Er=this.context)===null||Er===void 0)&&Er.isDynamicSdkError&&(kr==null||kr(br,wr),logger$6.error(br,{error:{bundleStack:br.stack,message:br,stack:wr.componentStack}})),br}render(){const{children:br}=this.props,{hasError:wr,error:Er}=this.state;return wr?(assertErrorBoundaryContext(this.context),this.context.error=Er,this.context.hasError=wr,null):br}}const ErrorBoundary=fr=>{var{children:br}=fr,wr=__rest$9(fr,["children"]);return jsxRuntimeExports.jsx(ErrorBoundaryContext.Provider,{value:{error:null,hasError:!1,isDynamicSdkError:!0},children:jsxRuntimeExports.jsx(ErrorBoundaryReporter,Object.assign({},wr,{children:br}))})};class ErrorBoundaryExclude extends ErrorBoundaryBase{render(){const{children:br}=this.props;return this.renderOrError(br,{isDynamicSdkError:!1})}}const useResponseHandlers=()=>{const{walletConnectorOptions:fr,consumeNonce:br,displaySiweStatement:wr,environmentId:Er,projectSettings:kr,setIsSingleWalletAccount:jr,connectWallet:Br,setShowAuthFlow:Wr,setSelectedWalletConnectorKey:qr,siweStatement:Gr,appName:Vr,user:Zr}=useInternalDynamicContext(),{setView:Jr}=useViewContext(),{setErrorMessage:Qr}=useErrorContext(),{getCaptchaToken:_n}=useCaptchaContext(),En=useVerifyWallet({consumeNonce:br,displaySiweStatement:wr,environmentId:Er,projectSettings:kr,setIsSingleWalletAccount:jr}),Cn=fr.map(({walletConnector:ro})=>ro).find(isPhantomRedirectConnector),In=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){Cn&&(yield Cn.getSession(),yield Br(Cn),Wr(!0,{ignoreIfIsEmbeddedWidget:!0}),Jr("pending-signature"),qr("phantom"))}),[Br,Cn,qr,Wr,Jr]),An=useTransferWallet(),jn=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){if(!Cn)return;qr("phantom");const[ro]=yield Cn.getConnectedAccounts();switch(Cn.consumeMethod()){case"signAndSendTransaction":{const{signature:_i}=Cn.extractSignature();Cn.emit("signAndSendTransaction",{signature:_i});break}case"signAllTransactions":Cn.emit("signAllTransactions",{transactions:Cn.extractTransactions()});break;case"signTransaction":Cn.emit("signTransaction",{transaction:Cn.extractTransaction()});break;case"signMessage":{const{signature:_i,message:oo}=Cn.extractSignature(),io=StorageService.getItem(PHANTOM_SIGNATURE_STATE);if(StorageService.removeItem(PHANTOM_SIGNATURE_STATE),(io==null?void 0:io.verificationType)==="awaiting_transfer"){const co=getSiweStatement({appName:Vr,siweStatement:Gr});yield An({messageToSignOverride:oo,overrideSiweStatement:co,publicWalletAddress:ro,signedMessageOverride:_i,skipEmptyAccountCheck:io.loseOriginalAccountOnTransfer,walletConnector:Cn})}else(io==null?void 0:io.verificationType)==="awaiting_verification"||!Zr?(Jr("wallet-redirect-view"),yield En({captchaToken:_n(),messageToSignOverride:oo,publicWalletAddress:ro,signedMessageOverride:_i,walletConnector:Cn})):Cn.emit("signMessage",{signature:_i});break}}}),[Cn,qr,Zr,Vr,Gr,An,Jr,En,_n]),eo=reactExports.useCallback(ro=>{var to;if(!Cn)return;const _i=ro.get("errorCode"),oo=(to=ro.get("errorMessage"))!==null&&to!==void 0?to:void 0;if(!_i)return;switch(Qr(_i),ro.delete("errorCode"),ro.delete("errorMessage"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${ro.toString()}`),Cn.consumeMethod()){case"signAndSendTransaction":Cn.emit("signAndSendTransaction",{errorCode:_i,errorMessage:oo});break;case"signAllTransactions":Cn.emit("signAllTransactions",{errorCode:_i,errorMessage:oo});break;case"signTransaction":Cn.emit("signTransaction",{errorCode:_i,errorMessage:oo});break;case"signMessage":Cn.emit("signMessage",{errorCode:_i,errorMessage:oo});break}},[Cn,Qr]);return{handleConnectResponse:In,handleErrorResponse:eo,handleUserResponse:jn,phantomRedirectConnector:Cn}},PhantomRedirectContext=reactExports.createContext(void 0),PhantomRedirectContextProvider=({children:fr})=>{const{sdkHasLoaded:br}=useInternalDynamicContext(),{phantomRedirectConnector:wr,handleConnectResponse:Er,handleUserResponse:kr,handleErrorResponse:jr}=useResponseHandlers();return reactExports.useEffect(()=>{if(!wr||!isMobile()||!br)return;const Br=new URLSearchParams(window.location.search);if(Br.has("errorCode")){jr(Br);return}if(Br.has("phantom_encryption_public_key")){Er();return}if(Br.has("data")){kr();return}},[Er,kr,jr,wr,br]),jsxRuntimeExports.jsx(PhantomRedirectContext.Provider,{value:{phantomRedirectConnector:wr},children:fr})},reinitializeContext=reactExports.createContext(void 0),ReinitializeContextProvider=({children:fr,onReinitialize:br})=>{const[wr,Er]=reactExports.useState(),kr=reactExports.useRef(br);kr.current=br;const jr=reactExports.useCallback(()=>{var Br;const Wr=randomString(8);(Br=kr.current)===null||Br===void 0||Br.call(kr,Wr),Er(Wr)},[]);return jsxRuntimeExports.jsx(reinitializeContext.Provider,{value:{key:wr,reinitialize:jr},children:reactExports.cloneElement(fr,{key:wr})})},useConnectedWalletsNetworkValidation=()=>{const{connectedWallets:fr,selectedWalletConnector:br,setSelectedWalletConnectorKey:wr,setShowAuthFlow:Er,bridgeChainsToConnect:kr,sdkHasLoaded:jr}=useInternalDynamicContext(),{setView:Br}=useViewContext(),Wr=useIsLoggedIn(),qr=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){const Zr=[];for(const Jr of fr){const Qr=kr==null?void 0:kr.some(Cn=>Cn.chain===Jr.chain),_n=yield Jr.connector.getNetwork(),En=isSupportedNetwork({network:_n,walletConnector:Jr.connector});!Qr&&!En&&Zr.push(Jr)}return Zr}),[kr,fr]),Gr=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){const Zr=yield qr();if(!Zr.length)return;const[Jr]=Zr;Jr.connector.key!==(br==null?void 0:br.key)&&wr(Jr.connector.key);const Qr=isProgrammableNetworkSwitchSupported(Jr.connector)?"network-not-supported":"network-not-supported-manual";Er(!0),Br(Qr)}),[qr,br==null?void 0:br.key,wr,Er,Br]),Vr=reactExports.useMemo(()=>{const Zr=fr.map(({connector:Qr})=>Qr),Jr=new Set([...Zr].filter(Qr=>!!Qr));return Array.from(Jr)},[fr]);useWalletConnectorEvent(Vr,"chainChange",({chain:Zr})=>{Gr()}),reactExports.useEffect(()=>{!jr||!Wr||Gr()},[jr,Wr,Gr])},UseNetworkValidation=()=>(useConnectedWalletsNetworkValidation(),null),isDisplayOrderPriorityForWeb3=fr=>{if(fr.length!==2)return!1;const[br,wr]=fr;return br==="wallet"&&wr==="email"},useDisplayOrderState=fr=>{const[br,wr]=reactExports.useState(null),Er=reactExports.useMemo(()=>{var kr;const jr=(kr=fr==null?void 0:fr.design.modal)===null||kr===void 0?void 0:kr.displayOrder;return jr?isDisplayOrderPriorityForWeb3(jr)?"web3":"web2":"web3"},[fr]);return[br||Er,wr]},useEmailLoginState=(fr,br)=>{const[wr,Er]=reactExports.useState(null),kr=()=>{Er(null)},jr=Wr=>{Er(Wr)},Br=reactExports.useMemo(()=>br?!1:isEmailProviderEnabled(fr),[fr,br]);return[wr??Br,jr,kr]},useHandleLogout=fr=>{const br=reactExports.useRef(fr);br.current=fr;const wr=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){const Er=br.current;Er.setSelectedWalletConnectorKey(null),Er.clearAllWalletConnectSessions(),Er.setShowDynamicUserProfile(!1),Er.setShowBridgeWidget(!1),Er.resetLoginWithEmail(),Er.user&&(document.cookie=`${DYNAMIC_AUTH_COOKIE_NAME}=; Max-Age=-99999999; path=/; SameSite=Lax`,revokeSession({environmentId:Er.environmentId,sessionId:Er.user.sessionId})),Er.setLegacyIsVerifying(!1),StorageService.removeItem(AUTH_TOKEN,{priority:["secureStorage","localStorage"]}),StorageService.removeItem(AUTH_MIN_TOKEN$1,{priority:["secureStorage","localStorage"]}),StorageService.removeItem(WALLET_PICKER_SEARCH_KEY),StorageService.removeItem(PHANTOM_SIGNATURE_STATE),StorageService.removeItem(AUTH_EXPIRES_AT),Er.setAuthMode(Er.initialAuthenticationMode),Er.setShowAuthFlow(!1,{emitCancelAuth:!1,ignoreIfIsEmbeddedWidget:!1,initializeWalletConnect:!1,performMultiWalletChecks:!1}),Er.setMultiWalletWidgetState("idle"),Er.removeConnectedWalletsInfo(),Er.removeBridgeOnboardingCompleted(),Er.clearPrimaryWalletId(),Er.removeConnectedNameService(),Er.removeSessionStorageSessionKeys(),dynamicEvents.removeListener("embeddedWalletCreatePasswordCompleted"),dynamicEvents.removeListener("embeddedWalletCreatePasswordFailed"),dynamicEvents.removeListener("embeddedWalletUpdatePasswordCompleted"),dynamicEvents.removeListener("embeddedWalletUpdatePasswordFailed"),dynamicEvents.emit("logout"),setUser(void 0),yield Promise.all(Er.walletConnectors.map(kr=>kr.endSession())),yield Promise.all(Er.connectedWallets.map(kr=>kr.connector.endSession()))}),[]);return reactExports.useEffect(()=>(StorageService.events.on("parseFailure",wr),()=>{StorageService.events.off("parseFailure",wr)}),[wr]),wr},getWalletVerifiedCredential=(fr,br,wr)=>br==null?void 0:br.find(({address:Er})=>isSameAddress$1(Er||"",fr||"",wr)),useNameService=({currentWallet:fr,user:br})=>{const[wr,Er,kr]=useLocalStorage$1(CONNECTED_WALLET_NAME_SERVICE,null),jr=reactExports.useRef(),Br=reactExports.useRef(),Wr=reactExports.useCallback(Gr=>__awaiter$e(void 0,void 0,void 0,function*(){const{address:Vr,connector:Zr}=Gr,Jr=yield Zr.getNetwork();if(Vr===jr.current&&Jr===Br.current)return;Er(null),jr.current=Vr,Br.current=Jr;let Qr;try{Qr=yield Gr.getNameService()}catch{}if(jr.current===Vr&&Br.current===Jr)return Er({address:Vr,avatar:Qr==null?void 0:Qr.avatar,name:Qr==null?void 0:Qr.name,network:Jr}),Qr}),[Er]);return{getNameService:Gr=>__awaiter$e(void 0,void 0,void 0,function*(){var Vr;if(!fr)return;const Zr=yield fr.connector.getNetwork(),Jr=br==null?void 0:br.verifiedCredentials;if(Jr){const Qr=getWalletVerifiedCredential(fr==null?void 0:fr.address,Jr,fr.chain);if(Qr&&(!((Vr=Qr.nameService)===null||Vr===void 0)&&Vr.name))return Qr.nameService}if(!(Gr&&(fr==null?void 0:fr.address)!==Gr))return wr&&wr.address===(fr==null?void 0:fr.address)&&wr.network===Zr?{avatar:wr.avatar,name:wr.name}:Wr(fr)}),removeConnectedNameService:kr}},useSelectedWalletConnector=({walletConnectorOptions:fr})=>{const[br,wr]=reactExports.useState(null);return{selectedWalletConnector:reactExports.useMemo(()=>{var kr,jr;return br&&(jr=(kr=fr.find(({walletConnector:Br})=>Br.key===br))===null||kr===void 0?void 0:kr.walletConnector)!==null&&jr!==void 0?jr:null},[br,fr]),setSelectedWalletConnectorKey:wr}},useShowAuthFlow=({isAuthenticated:fr,isRenderingEmbeddedAuthFlow:br,isMultiWalletEnabled:wr,setShowDynamicUserProfile:Er})=>{const[kr,jr]=reactExports.useState(!1),{setError:Br}=useErrorContext(),Wr=reactExports.useCallback((qr,Gr={})=>{const{emitCancelAuth:Vr,ignoreIfIsEmbeddedWidget:Zr,initializeWalletConnect:Jr,performMultiWalletChecks:Qr,clearErrors:_n}=Object.assign({clearErrors:!0,emitCancelAuth:!1,ignoreIfIsEmbeddedWidget:!0,initializeWalletConnect:!0,performMultiWalletChecks:!1},Gr);if(logger$6.logVerboseTroubleshootingMessage("setShowAuthFlow",{clearErrors:_n,emitCancelAuth:Vr,ignoreIfIsEmbeddedWidget:Zr,initializeWalletConnect:Jr,performMultiWalletChecks:Qr}),!kr&&qr?dynamicEvents.emit("authFlowOpen"):kr&&!qr&&dynamicEvents.emit("authFlowClose"),qr){if(Zr&&br.current)return;if(Qr&&fr){if(!wr)return Er(!0);logger$6.warn("Use setShowLinkNewWalletModal to render the wallet list instead. For more information, see: https://docs.dynamic.xyz/react-sdk/hooks/usedynamiccontext");return}}else Vr&&kr&&dynamicEvents.emit("authFlowCancelled");_n&&Br(void 0),jr(qr)},[fr,wr,br,Br,Er,kr]);return[kr,Wr]},usePasskeySuccessPopup=()=>{const[fr,br]=reactExports.useState(void 0);return{passkeySuccessPopup:fr,setPasskeySuccessPopup:Er=>{br(Er),setTimeout(()=>{br(void 0)},2e3)}}},useTieCallbacksToEvents=({clientCallbacks:fr,user:br})=>{useInternalDynamicEvents("emailVerificationResult",(wr,Er)=>{var kr;return(kr=fr==null?void 0:fr.onOtpVerificationResult)===null||kr===void 0?void 0:kr.call(fr,wr,{type:"email",value:Er})}),useInternalDynamicEvents("smsVerificationResult",(wr,Er)=>{var kr;return(kr=fr==null?void 0:fr.onOtpVerificationResult)===null||kr===void 0?void 0:kr.call(fr,wr,{type:"sms",value:Er})}),useInternalDynamicEvents("authFlowCancelled",()=>{var wr;return(wr=fr==null?void 0:fr.onAuthFlowCancel)===null||wr===void 0?void 0:wr.call(fr)}),useInternalDynamicEvents("authFlowOpen",()=>{var wr;(wr=fr==null?void 0:fr.onAuthFlowOpen)===null||wr===void 0||wr.call(fr)}),useInternalDynamicEvents("authFlowClose",()=>{var wr;(wr=fr==null?void 0:fr.onAuthFlowClose)===null||wr===void 0||wr.call(fr)}),useInternalDynamicEvents("walletAdded",(wr,Er)=>{var kr;dynamicEvents.emit("triggerSessionValidation"),logger$6.debug("[walletAdded]",{userWallets:Er,wallet:wr}),(kr=fr==null?void 0:fr.onWalletAdded)===null||kr===void 0||kr.call(fr,{userWallets:Er,wallet:wr})}),useInternalDynamicEvents("walletRemoved",(wr,Er)=>{var kr;logger$6.debug("[walletRemoved]",{userWallets:Er,wallet:wr}),(kr=fr==null?void 0:fr.onWalletRemoved)===null||kr===void 0||kr.call(fr,{userWallets:Er,wallet:wr})}),useInternalDynamicEvents("embeddedWalletCreated",(wr,Er,kr)=>{var jr;logger$6.debug("[embeddedWalletCreated]",{_wallet:wr,jwtVerifiedCredential:Er,user:kr}),(jr=fr==null?void 0:fr.onEmbeddedWalletCreated)===null||jr===void 0||jr.call(fr,Er,kr)}),useInternalDynamicEvents("logout",()=>{var wr;(wr=fr==null?void 0:fr.onLogout)===null||wr===void 0||wr.call(fr,br)}),useInternalDynamicEvents("authFailure",(wr,Er)=>{var kr;logger$6.debug("[authFailure]",{data:wr,reason:Er}),(kr=fr==null?void 0:fr.onAuthFailure)===null||kr===void 0||kr.call(fr,wr,Er)}),useInternalDynamicEvents("authInit",wr=>{var Er;logger$6.debug("[authInit]",{data:wr}),(Er=fr==null?void 0:fr.onAuthInit)===null||Er===void 0||Er.call(fr,wr)})},useMultiWallet=({isBridgeFlow:fr,multiWalletOverride:br,multiWalletSettings:wr})=>{var Er;return br!==void 0?br:(Er=wr||fr)!==null&&Er!==void 0?Er:!1},useMultiAsset=({multiAssetOverride:fr,multiAssetSettings:br})=>fr!==void 0?fr:br??!0,useParentDynamicContextGuard=()=>{if(reactExports.useContext(DynamicContext))throw new Error("DynamicContextProvider should not be nested. Please wrap your application in a single DynamicContextProvider.")},useShowFiat=({showFiatOverride:fr,showFiatSettings:br})=>fr!==void 0?fr:br??!0,isAuthenticatedWithAWallet=fr=>{const br=fr.verifiedCredentials.find(wr=>wr.id===fr.lastVerifiedCredentialId);return(br==null?void 0:br.format)===JwtVerifiedCredentialFormatEnum.Blockchain},useCustomerCallbacks=({callbacks:{onAuthSuccess:fr,onUserProfileUpdate:br},handleLogOut:wr,primaryWallet:Er,user:kr,isAuthenticated:jr})=>{const[Br,Wr]=reactExports.useState([]),qr=reactExports.useCallback((Vr,Zr)=>{switch(Vr==null?void 0:Vr.callback){case"authSuccess":{try{fr==null||fr({handleLogOut:wr,isAuthenticated:jr,primaryWallet:Er,user:Zr}),dynamicEvents.emit("triggerSessionValidation")}catch(Jr){logger$6.error("Error calling onAuthSuccess: ",Jr)}break}case"userProfileUpdate":{try{br==null||br(Zr)}catch(Jr){logger$6.error("Error calling userProfileUpdate: ",Jr)}break}}},[wr,jr,fr,br,Er]);return reactExports.useEffect(()=>{!Br.length||!kr||isAuthenticatedWithAWallet(kr)&&!Er||(qr(Br[0],kr),Wr(Vr=>{const[Zr,...Jr]=Vr;return Zr&&(logger$6.debug("Resolved callback: ",Zr.callback),logger$6.debug("Callbacks in queue: ",Jr.map(Qr=>Qr.callback))),Jr}))},[Br,qr,Er,kr]),{setCallback:reactExports.useCallback((Vr,Zr)=>{Wr(Jr=>[...Jr,{callback:Vr,params:Zr}])},[])}},useRegisterStorageService=({storagePostfix:fr})=>{const br={clear:()=>{},getItem:()=>null,key:()=>null,length:0,removeItem:()=>{},setItem:()=>null},wr=isSSR()?br:window.localStorage,Er=isSSR()?br:window.sessionStorage;StorageService.getSourceStorage("localStorage")||StorageService.registerSourceStorage("localStorage",createStorageService({postfix:fr,storage:wr})),StorageService.getSourceStorage("sessionStorage")||StorageService.registerSourceStorage("sessionStorage",createStorageService({postfix:fr,storage:Er}))};var define_process_env_default$4={};const PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID="2762a57b-faa4-41ce-9f16-abff9300e2c9",DynamicContext=reactExports.createContext(void 0),InnerDynamicContextProvider=({children:fr,theme:br,settings:wr,locale:Er,enableInstrumentation:kr=!1})=>{var jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En,Cn,In,An,jn,eo;const{accessDeniedMessagePrimary:ro,accessDeniedMessageSecondary:to,accessDeniedButton:_i,defaultPhoneInputIso2:oo,apiBaseUrl:io,coinbaseWalletPreference:co,detectNewWalletsForLinking:so=!1,enableConnectOnlyFallback:no=!1,deepLinkPreference:Tn="native",bridgeChains:Hr,cssOverrides:Xr,defaultNumberOfWalletsToShow:Sn=DEFAULT_NUMBER_OF_WALLETS_TO_SHOW,flowNetwork:Rn,initialAuthenticationMode:Pn="connect-and-sign",debugError:On=!1,displaySiweStatement:Zn=!0,newToWeb3WalletChainMap:Nn,enableVisitTrackingOnConnectOnly:wn=!0,environmentId:zn,walletsFilter:fo,logLevel:vo="WARN",mobileExperience:go,notInTheListImageUrl:uo,onboardingImageUrl:lo,policiesConsentInnerComponent:Eo,customPrivacyPolicy:mo,privacyPolicyUrl:yo,socialMediaLinkText:_o,socialMediaIconUrl:Bo,socialMediaUrl:Lo,customTermsOfServices:Wo,termsOfServiceUrl:na,toolkitEnabled:qo,siweStatement:ga,shadowDOMEnabled:wl=!0,walletConnectors:No,socialProvidersFilter:Uo,showLockedWalletView:Nl=!1,walletConnectPreferredChains:Vo,walletConnectorExtensions:Fo,recommendedWallets:Ol,handlers:$a}=wr;useRegisterStorageService({storagePostfix:wr.localStorageSuffix}),initializeStore({environmentId:zn,storageSuffix:wr.localStorageSuffix}),setChainInfoOverrides((jr=wr.overrides)===null||jr===void 0?void 0:jr.chainDisplayValues);const Jo=(Br=wr.events)!==null&&Br!==void 0?Br:wr.eventsCallbacks,Zl=resolveNetworkValidationMode({bridgeChains:wr.bridgeChains,networkValidationMode:wr.networkValidationMode});let{appLogoUrl:Cl="https://demo.dynamic.xyz/assets/dynamic-logo.svg",appName:ko="Dynamic Example"}=wr;if(!zn)throw new MissingEnvironmentIdError;logger$6.setLogLevel(vo),logger$7.setLogLevel(vo),zn===PUBLIC_PROJECT_LIVE_ENVIRONMENT_ID&&logger$6.warn(`WARNING: DYNAMIC is using a test environment ID ${zn}. Please sign up on https://app.dynamic.xyz/ to get your production environment ID.`),ApiEndpoint$1.setBaseUrl((Wr=define_process_env_default$4.DYNAMIC_API_BASE_URL)!==null&&Wr!==void 0?Wr:io);const wo=Locale.setup(Er),bo=!!Hr,Io=getDeepLinkPreference(Tn,bo),{selectedTabIndex:Ho,setSelectedTabIndex:Do,selectedTabSettings:zo,tabsItems:nu}=useTabState({settingsOverrides:wr.overrides}),[Ll,_l,bu]=useLocalStorage$1(BRIDGE_ONBOARDING_COMPLETED,!1),[xl,Tl]=reactExports.useState(!1),[du,Bl]=reactExports.useState(!1),[Il,Eu]=reactExports.useState(!1),{user:Al,userWithMissingInfo:Ml}=useUser(),Tu=!!Al;Al?logger$6.setMetaData("user",Al):logger$6.setMetaData("user",void 0);const{consumeNonce:Fl}=useFetchNonce(zn),[Sl,_u]=reactExports.useState(""),[So,Co]=reactExports.useState(""),[Ao,po,{awaiting_account_switch:[Ro],awaiting_signature:[Xo]}]=useMultiWalletWidgetState(),{settings:jo}=useProjectSettings(),Ko=useNetworkConfigurationsFromProjectSettings({cosmosNetworkOverrides:(qr=wr.overrides)===null||qr===void 0?void 0:qr.cosmosNetworks,evmNetworksOverrides:(Gr=wr.overrides)===null||Gr===void 0?void 0:Gr.evmNetworks,projectSettings:jo});useSendDynamicProps({environmentId:zn,settings:wr});const Wl=useMultiWallet({isBridgeFlow:bo,multiWalletOverride:(Vr=wr.overrides)===null||Vr===void 0?void 0:Vr.multiWallet,multiWalletSettings:(Zr=jo==null?void 0:jo.sdk)===null||Zr===void 0?void 0:Zr.multiWallet}),$l=useMultiAsset({multiAssetOverride:(Jr=wr.overrides)===null||Jr===void 0?void 0:Jr.multiAsset,multiAssetSettings:(Qr=jo==null?void 0:jo.sdk)===null||Qr===void 0?void 0:Qr.enableMultiAsset}),El=useShowFiat({showFiatOverride:(_n=wr.overrides)===null||_n===void 0?void 0:_n.showFiat,showFiatSettings:(En=jo==null?void 0:jo.sdk)===null||En===void 0?void 0:En.showFiat}),[Cu,iu]=reactExports.useState(!1),pu=useWalletBookCdn(),{imageUserInAccessList:yu,imageUserNotInAccessList:hu,displayName:mu,appLogo:vu}=(jo==null?void 0:jo.general)||{};Cl=vu||Cl,ko=mu||ko;const[fu,gu,ou]=useEmailLoginState((jo==null?void 0:jo.providers)||[],Al),[su,tu]=useDisplayOrderState(jo),[zl,Gl]=useWalletUiUtils({appLogoUrl:Cl,appName:ko,hideEmbeddedWalletTransactionUIs:!(!((In=(Cn=jo==null?void 0:jo.sdk)===null||Cn===void 0?void 0:Cn.embeddedWallets)===null||In===void 0)&&In.showEmbeddedWalletActionsUI)});useCreateWalletConnectorOptions({appLogoUrl:Cl,appName:ko,coinbaseWalletPreference:co,deepLinkPreference:Io,flowNetwork:Rn,mobileExperience:go,networkConfigurations:Ko,projectSettings:jo,walletBook:pu,walletConnectPreferredChains:Vo,walletConnectorExtensions:Fo,walletConnectorsProp:No,walletUiUtils:Gl});const Jl=useWalletConnectorOptions(),[Pl,Ul]=reactExports.useState(Pn),{clearPrimaryWalletId:Yl,primaryWalletId:Vl,setPrimaryWalletId:Ql}=usePrimaryWalletId({environmentId:zn,user:Al}),[au,Nu]=reactExports.useState(!1),Wu=!!(Pl==="connect-and-sign"?Al:au),zu=reactExports.useRef(!1),[Bu,Qo]=useShowAuthFlow({isAuthenticated:Wu,isMultiWalletEnabled:Wl,isRenderingEmbeddedAuthFlow:zu,setShowDynamicUserProfile:Tl}),{connectWallet:Zu,removeConnectedWalletsInfo:Qu,connectedWalletsInfo:_h,getConnectedWalletById:qu,connectedWallets:Ju,disconnectWallet:_d,refreshConnectedWallet:dp}=useConnectWallet({authMode:Pl,clearPrimaryWalletId:Yl,enableVisitTrackingOnConnectOnly:wn,environmentId:zn,handleConnectedWallet:$a==null?void 0:$a.handleConnectedWallet,isBridgeFlow:bo,primaryWalletId:Vl,setPrimaryWalletId:Ql,setShowAuthFlow:Qo,user:Al,walletConnectorOptions:Jl}),Ku=reactExports.useMemo(()=>getMissingChains(Hr,_h),[Hr,_h]),{selectedWalletConnector:Vu,setSelectedWalletConnectorKey:cp}=useSelectedWalletConnector({walletConnectorOptions:Jl}),[fp,lp]=reactExports.useState(null);useSetWalletConnectorVerifiedCredentials(Al??Ml,Jl),useSetWalletConnectorFetchers(Jl,zn);const{primaryWallet:np,showQrcodeModal:Rp,secondaryWallets:wp,setPrimaryWallet:a0,setShowQrcodeModal:e1,wallets:ym}=useWalletConnectors({authMode:Pl,canHaveMultipleWalletsConnected:Wl,connectedWallets:Ju,primaryWalletId:Vl,separateSmartWalletAndSigner:(jn=(An=jo==null?void 0:jo.sdk)===null||An===void 0?void 0:An.accountAbstraction)===null||jn===void 0?void 0:jn.separateSmartWalletAndSigner,setMultiWalletWidgetState:po,setPrimaryWalletId:Ql,user:Al||Ml,walletConnectorOptions:Jl});reactExports.useEffect(()=>{Nu(!(Ku!=null&&Ku.length)&&!!np)},[Ku,np]);const s0=ym.map(Yu=>Yu.connector);useFetchProjectSettings({environmentId:zn});const{getNameService:c0,removeConnectedNameService:l0}=useNameService({currentWallet:np??Ju[0],user:Al}),{clearAllWalletConnectSessions:d0}=useClearWalletConnectSessions({connectors:s0}),Rm=useHandleLogout({bridgeChains:Hr,clearAllWalletConnectSessions:d0,clearPrimaryWalletId:Yl,connectedWallets:Ju,environmentId:zn,events:Jo,initialAuthenticationMode:Pn,removeBridgeOnboardingCompleted:bu,removeConnectedNameService:l0,removeConnectedWalletsInfo:Qu,removeSessionStorageSessionKeys:()=>{StorageService.removeItem(SECURE_ENCLAVE_WALLET_SESSION_KEYS,SECURE_ENCLAVE_WALLET_SESSION_KEYS_STORAGE_OPTIONS),s0.forEach(Yu=>{isSessionKeyCompatibleWalletConnector(Yu)&&typeof(Yu==null?void 0:Yu.removeSessionKeys)=="function"&&(Yu==null||Yu.removeSessionKeys())})},resetLoginWithEmail:ou,setAuthMode:Ul,setLegacyIsVerifying:iu,setMultiWalletWidgetState:po,setSelectedWalletConnectorKey:cp,setShowAuthFlow:Qo,setShowBridgeWidget:Bl,setShowDynamicUserProfile:Tl,user:Al,walletConnectors:s0});useValidateSession({environmentId:zn,handleLogOut:Rm});const{isLoading:qm}=useResetCookieLocalStorage({environmentId:zn,projectSettings:jo,setPrimaryWalletId:Ql}),f0=useGlobalLoading({appName:ko,authMode:Pl,connectedInfo:_h[0],connectedWallets:Ju,enableInstrumentation:kr,environmentId:zn,isLoadingUserFromCookie:qm,primaryWallet:np,primaryWalletId:Vl,projectSettings:jo,user:Al??Ml,walletBook:pu});useTieCallbacksToEvents({clientCallbacks:Jo,user:Al});const h0=useHandleUnlinkWallet({environmentId:zn,primaryWalletId:Vl,secondaryWallets:wp,verifiedCredentials:(Al==null?void 0:Al.verifiedCredentials)||[]}),{isLoading:zm,network:p0}=useWalletConnectorNetwork(np==null?void 0:np.connector,{onChange:Yu=>{Yu&&dynamicEvents.emit("primaryWalletNetworkChanged",Yu)}});useWalletEventListeners({authMode:Pl,detectNewWalletsForLinking:so,disconnectWallet:_d,handleLogOut:Rm,multiWallet:Wl,multiWalletWidgetState:Ao,primaryWallet:np,refreshConnectedWallet:dp,secondaryWallets:wp,selectedWalletConnector:Vu,selectedWalletWithAction:fp,setMultiWalletWidgetState:po,setPrimaryWalletId:Ql,setSelectedWalletConnectorKey:cp,setSelectedWalletWithAction:lp,user:Al});const{walletsForChainsMap:r1}=useFetchWalletsForChainsMap(Nn);reactExports.useEffect(()=>{initExpirationTime(Rm)},[Rm,Tu]);const{setCallback:Lu}=useCustomerCallbacks({callbacks:{onAuthSuccess:Jo==null?void 0:Jo.onAuthSuccess,onUserProfileUpdate:Jo==null?void 0:Jo.onUserProfileUpdate},handleLogOut:Rm,isAuthenticated:Tu,primaryWallet:np,user:Al}),Du=reactExports.useCallback(()=>Yu=>{const{dynamicWagmiSettings:Xu}=Yu;Xu&&sendDynamicProps(zn,{dynamicWagmiSettings:{dynamicWagmiSettings:Xu}})},[zn]),Zo=reactExports.useCallback(()=>__awaiter$e(void 0,void 0,void 0,function*(){Co(""),iu(!1),Al||d0(),po("idle"),Pl!=="connect-only"&&Qu(),StorageService.getItem(WALLET_PICKER_SEARCH_KEY)&&StorageService.removeItem(WALLET_PICKER_SEARCH_KEY),StorageService.removeItem(PHANTOM_SIGNATURE_STATE),Vu&&(!np||np.connector.key!==Vu.key)&&(yield Vu==null?void 0:Vu.endSession())}),[Al,po,Pl,Vu,np,d0,Qu]),{passkeySuccessPopup:Dl,setPasskeySuccessPopup:ru}=usePasskeySuccessPopup(),Au=reactExports.useMemo(()=>{var Yu;return{accessDeniedButton:_i,accessDeniedMessagePrimary:ro,accessDeniedMessageSecondary:to,accountSwitchState:Ro,appLogoUrl:Cl,appName:ko,authMode:Pl,authToken:getAuthToken(),authorizationViewDisplayOrder:su,awaitingSignatureState:Xo,bridgeChains:Hr,bridgeChainsToConnect:Ku,bridgeOnboardingCompleted:Ll,clearStatesOnBackClick:Zo,connectWallet:Zu,connectedWallets:Ju,consumeNonce:Fl,cssOverrides:Xr,customPrivacyPolicy:mo,customTermsOfServices:Wo,debugError:On,defaultNumberOfWalletsToShow:Sn,defaultPhoneInputIso2:oo,desktopUri:So,detectNewWalletsForLinking:so,disconnectWallet:_d,displaySiweStatement:Zn,enableConnectOnlyFallback:no,environmentId:zn,events:Jo,getConnectedWalletById:qu,getNameService:c0,handleLogOut:Rm,handleUnlinkWallet:Pl==="connect-only"?_d:h0,handlers:$a,i18nSDKInstance:wo,isBridgeFlow:bo,isRenderingEmbeddedAuthFlow:zu,isSingleWalletAccount:Il,legacyIsVerifying:Cu,linkedWallets:Pl==="connect-only"||!Al?[]:ym,loadingNetwork:zm,locale:{changeLanguage:Locale.getInstance().changeLanguage},loginWithEmail:fu,minAuthToken:getMinAuthToken$1(),multiAsset:$l,multiWallet:Wl,multiWalletWidgetState:Ao,network:p0,networkConfigurations:Ko,networkValidationMode:Zl,newToWeb3WalletChainMap:r1,notInTheListImageUrl:hu||uo,onboardingImageUrl:yu||lo,overrides:wr.overrides,passkeySuccessPopup:Dl,policiesConsentInnerComponent:Eo,primaryWallet:np,primaryWalletId:Vl,privacyPolicyUrl:yo,projectSettings:jo,qrcodeUri:Sl,recommendedWallets:Ol,redirectUrl:wr.redirectUrl,removeBridgeOnboardingCompleted:bu,removeConnectedWalletsInfo:Qu,sdkHasLoaded:f0,secondaryWallets:wp,selectedTabIndex:Ho,selectedTabSettings:zo,selectedWalletConnector:Vu,selectedWalletWithAction:fp,sendWagmiSettings:Du,setAuthMode:Ul,setAuthorizationViewDisplayOrder:tu,setBridgeOnboardingCompleted:_l,setCallback:Lu,setDesktopUri:Co,setIsSingleWalletAccount:Eu,setLegacyIsVerifying:iu,setLogInWithEmail:gu,setMultiWalletWidgetState:po,setPasskeySuccessPopup:ru,setPrimaryWallet:a0,setPrimaryWalletId:Ql,setQrcodeUri:_u,setSelectedTabIndex:Do,setSelectedWalletConnectorKey:cp,setSelectedWalletWithAction:lp,setShowAuthFlow:Qo,setShowBridgeWidget:Bl,setShowDynamicUserProfile:Tl,setShowQrcodeModal:e1,shadowDOMEnabled:wl,showAuthFlow:Bu,showBridgeWidget:du,showDynamicUserProfile:xl,showFiat:El,showLockedWalletView:Nl,showQrcodeModal:Rp,siweStatement:ga,socialMediaIconUrl:((Yu=jo==null?void 0:jo.general)===null||Yu===void 0?void 0:Yu.supportUrls)||Bo,socialMediaLinkText:_o,socialMediaUrl:Lo,socialProvidersFilter:Uo,socialSettings:wr.social,tabsItems:nu,termsOfServiceUrl:na,theme:br,toolkitEnabled:qo,user:Al,userWithMissingInfo:Ml,walletConnectorOptions:Jl,walletUiUtils:Gl,walletsFilter:fo}},[_i,ro,to,Ro,Cl,ko,Pl,su,Xo,Hr,Ku,Ll,Zo,Zu,Ju,Fl,Xr,mo,Wo,On,Sn,oo,So,so,_d,Zn,no,zn,Jo,qu,c0,Rm,h0,$a,wo,bo,Il,Cu,Al,ym,zm,fu,$l,Wl,Ao,p0,Ko,Zl,r1,hu,uo,yu,lo,wr.overrides,wr.redirectUrl,wr.social,Dl,Eo,np,Vl,yo,jo,Sl,Ol,bu,Qu,f0,wp,Ho,zo,Vu,fp,Du,Ul,tu,_l,Lu,gu,po,ru,a0,Ql,Do,cp,Qo,e1,wl,Bu,du,xl,El,Nl,Rp,ga,Bo,_o,Lo,Uo,nu,na,br,qo,Ml,Jl,Gl,fo]);return usePrefetch({as:"image",href:getIconicSpriteUrl$1(),id:"sprite",type:"image/svg+xml"}),usePrefetch({as:"fetch",href:getWalletBookCdnUrl(),id:"wallet-book",type:"application/json"}),usePrefetch({as:"fetch",href:`${ApiEndpoint$1.getBaseUrl()}/sdk/${zn}/settings?sdkVersion=${encodeURIComponent(`WalletKit/${VERSION$2}`)}`,id:`project-settings-${zn}`,type:"application/json"}),reactExports.useEffect(()=>{!Wl&&Ao!=="awaiting_account_switch"||Al&&Ao!=="idle"&&!xl&&Tl(!0)},[Wl,Ao,xl]),jsxRuntimeExports.jsx(I18nextProvider,{i18n:wo,children:jsxRuntimeExports.jsx(DynamicContext.Provider,{value:Au,children:jsxRuntimeExports.jsx(WalletBookContextProvider,{walletBook:pu,children:jsxRuntimeExports.jsx(ThemeContextProvider,{customerTheme:parseTheme(br,((eo=jo==null?void 0:jo.design)===null||eo===void 0?void 0:eo.modal)||void 0),designSettings:jo==null?void 0:jo.design,children:jsxRuntimeExports.jsx(LoadingContextProvider,{children:jsxRuntimeExports.jsxs(ViewContextProvider,{initialView:getInitialView({bridgeOnboardingCompleted:Ll,connectedWallets:Ju,isAuthenticated:Tu||!!np,isBridgeFlow:bo,isMultiWalletEnabled:Wl}),children:[Zl==="always"&&jsxRuntimeExports.jsx(UseNetworkValidation,{}),jsxRuntimeExports.jsx(CaptchaContextProvider,{children:jsxRuntimeExports.jsx(AccountExistsContextProvider,{children:jsxRuntimeExports.jsx(WalletContextProvider,{children:jsxRuntimeExports.jsx(VerificationProvider,{children:jsxRuntimeExports.jsx(PasskeyContextProvider,{children:jsxRuntimeExports.jsx(DynamicWidgetContextProvider,{children:jsxRuntimeExports.jsx(DynamicBridgeWidgetContextProvider,{children:jsxRuntimeExports.jsx(FundingContextProvider,{children:jsxRuntimeExports.jsx(AccessDeniedContextProvider,{children:jsxRuntimeExports.jsx(SendBalanceContextProvider,{children:jsxRuntimeExports.jsx(WalletGroupContextProvider,{children:jsxRuntimeExports.jsx(UserFieldEditorContextProvider,{children:jsxRuntimeExports.jsx(ConnectWithOtpProvider,{children:jsxRuntimeExports.jsx(PhantomRedirectContextProvider,{children:jsxRuntimeExports.jsxs(SocialRedirectContextProvider,{children:[jsxRuntimeExports.jsx(DynamicAuthFlow,{}),jsxRuntimeExports.jsx(Toolkit,{}),jsxRuntimeExports.jsx(FundingWidget,{}),jsxRuntimeExports.jsx(SyncAuthFlow,{}),jsxRuntimeExports.jsx(TelegramAutoLogin,{}),jsxRuntimeExports.jsx(WalletConnectorEvents,{}),zl,jsxRuntimeExports.jsx(ErrorBoundaryExclude,{children:fr})]})})})})})})})})})})})})})})})]})})})})})})},DynamicContextProvider=fr=>(Logger$1.setEnvironmentId(fr.settings.environmentId),Logger$1.setEmitErrors(fr.emitErrors),useParentDynamicContextGuard(),jsxRuntimeExports.jsx(ReinitializeContextProvider,{onReinitialize:removeStoreInstance,children:jsxRuntimeExports.jsx(ErrorBoundary,{children:jsxRuntimeExports.jsx(ErrorContextProvider,{children:jsxRuntimeExports.jsx(UserWalletsProvider,{children:jsxRuntimeExports.jsx(FieldsStateProvider,{children:jsxRuntimeExports.jsx(IpConfigurationContextProvider,{children:jsxRuntimeExports.jsx(WidgetRegistryContextProvider,{children:jsxRuntimeExports.jsx(InnerDynamicContextProvider,Object.assign({},fr))})})})})})})})),embeddedWalletsKeys=["magicemailotp","magiclink","magicsocial","turnkey","turnkeyhd","coinbasempc","zerodev"],useWalletOptions=()=>{const{walletConnectorOptions:fr,setShowAuthFlow:br}=useInternalDynamicContext(),{walletBook:wr}=useWalletBookContext(),{setView:Er}=useViewContext(),{navigateToWalletGroup:kr}=useWalletGroupContext(),{handleWalletItemClick:jr}=useWalletItemActions(),Br=reactExports.useMemo(()=>{var qr;return(qr=fr==null?void 0:fr.filter(Gr=>!embeddedWalletsKeys.includes(Gr.walletConnector.key)).map(Gr=>{const Vr=Gr.group&&Object.keys(wr).length?getWalletGroup(wr,Gr.group).name:void 0;return{group:Gr.group,groupName:Vr,isInstalledOnBrowser:Gr.isInstalledOnBrowser,key:Gr.walletConnector.key,name:Gr.name}}))!==null&&qr!==void 0?qr:[]},[wr,fr]);return{selectWalletOption:qr=>__awaiter$e(void 0,void 0,void 0,function*(){const Vr=groupWalletOptions(wr,fr).find(Zr=>Zr.key===qr);if(logger$6.logVerboseTroubleshootingMessage("[useWalletOptions] selectWalletOption",{walletKey:qr,walletOption:Vr==null?void 0:Vr.key}),!Vr)throw new DynamicError("Invalid wallet option key provided.");isWalletGroup(Vr)?kr(Vr):isHardwareWalletConnector(Vr.walletConnector)&&Vr.walletConnector.canConnectWithHardwareWallet()?Er("select-hardware-wallet",{onSelectWallet:jr,wallet:Vr}):jr(Vr),br(!0)}),walletOptions:Br}};assertPackageVersion("@dynamic-labs/sdk-react-core",version$s);const initialState={wallet:null,dynamicWallet:null,theme:"light",user:null,isAuthenticated:!1,jwt:null,walletLoadState:"idle"};function globalReducer(fr,br){switch(br.type){case"INITIALIZE_WALLET":return{...fr,wallet:br.payload};case"SET_DYNAMIC_WALLET":return{...fr,dynamicWallet:br.payload};case"RESET_WALLET":return{...fr,wallet:null,walletLoadState:"idle",dynamicWallet:null};case"SET_THEME":return{...fr,theme:br.payload};case"SET_USER":return{...fr,user:br.payload};case"SET_AUTHENTICATED":return{...fr,isAuthenticated:br.payload};case"SET_JWT":return{...fr,jwt:br.payload};case"SET_WALLET_LOAD_STATE":return{...fr,walletLoadState:br.payload};case"RESET_AUTHENTICATED":return{...fr,isAuthenticated:!1,walletLoadState:"idle",dynamicWallet:null,jwt:null};case"RESET_USER":return{...fr,user:null,walletLoadState:"idle",dynamicWallet:null,jwt:null};default:return fr}}const GlobalContext=reactExports.createContext({state:initialState,dispatch:()=>null});function useGlobalState(){const fr=reactExports.useContext(GlobalContext);if(!fr)throw new Error("useGlobalState must be used within a GlobalProvider");return fr}const GlobalProvider=({children:fr})=>{const[br,wr]=reactExports.useReducer(globalReducer,initialState),{primaryWallet:Er,sdkHasLoaded:kr}=useDynamicContext(),jr=extractStateFromUrl();console.log("State Param",jr);const Br=sessionStorage.getItem("jwt");return reactExports.useEffect(()=>{br.wallet?new PostMessageHandler(br.wallet,()=>wr({type:"INITIALIZE_WALLET",payload:br.wallet})):new PostMessageHandler(void 0,()=>{})},[br.wallet]),reactExports.useEffect(()=>{(async()=>{try{if(wr({type:"SET_WALLET_LOAD_STATE",payload:"loading"}),jr){const qr=await fetchJwtUsingState({stateParam:jr});sessionStorage.setItem("jwt",qr),wr({type:"SET_JWT",payload:qr}),new URL(window.location.href).searchParams.delete("state"),wr({type:"SET_WALLET_LOAD_STATE",payload:"success"})}Br&&(wr({type:"SET_JWT",payload:Br}),wr({type:"SET_WALLET_LOAD_STATE",payload:"success"})),Er&&(wr({type:"SET_WALLET_LOAD_STATE",payload:"success"}),wr({type:"SET_DYNAMIC_WALLET",payload:Er})),!jr&&!Br&&!Er&&kr&&wr({type:"SET_WALLET_LOAD_STATE",payload:"rejected"})}catch(qr){throw wr({type:"SET_WALLET_LOAD_STATE",payload:"rejected"}),console.error("Error creating wallet:",qr),qr}})()},[jr,Br,Er,kr]),jsxRuntimeExports.jsx(GlobalContext.Provider,{value:{state:br,dispatch:wr},children:fr})},StyledIconWrapper=qe$2.span` /* Common Wrapper CSS */ color: ${({color:fr})=>fr}; width: ${({size:fr})=>fr}; @@ -147,7 +147,7 @@ Expected: awaiting_signature`)},useAwaitingSignature=()=>{const[fr,br]=reactExpo /* Custom CSS applied via styled component css prop */ ${fr=>fr.css||""} -`,IconWrapper=({autoSize:fr,color:br,componentName:wr,icon:Er,size:kr,...jr})=>{const Br=br?`var(--${br})`:"currentColor",Wr=kr?`${kr}px`:fr?"1em":"16px";return jsxRuntimeExports.jsx(StyledIconWrapper,{"aria-hidden":"true","aria-label":wr,color:Br,role:"img",size:Wr,...jr,children:Er})},ArbitrumMonotone=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"ArbitrumMonotone",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_8547_11033)",children:[jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"var(--surface-tertiary)"}),jsxRuntimeExports.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5.02206 6.4834L9.44362 3.92956C9.61165 3.83254 9.80225 3.78223 9.99629 3.78223C10.1903 3.78223 10.381 3.8333 10.549 3.93032L14.9757 6.48939C15.1435 6.58639 15.2828 6.7258 15.3797 6.89359C15.4766 7.06144 15.5277 7.25176 15.5278 7.44557L15.5306 12.5588C15.5307 12.753 15.4796 12.9437 15.3826 13.1118C15.2856 13.2799 15.146 13.4195 14.9779 13.5165L10.5564 16.0696C10.3883 16.1666 10.1977 16.2177 10.0036 16.2177C9.80959 16.2177 9.61899 16.1666 9.45096 16.0696L5.02425 13.5106C4.85647 13.4136 4.71714 13.2742 4.62023 13.1064C4.52333 12.9385 4.47225 12.7482 4.47213 12.5544L4.46936 7.44107C4.46929 7.24698 4.52033 7.05628 4.61735 6.88816C4.71437 6.72004 4.85396 6.58044 5.02206 6.4834ZM7.99995 14.168C7.97838 14.194 7.96364 14.2249 7.95686 14.2579C7.9817 14.2923 8.01585 14.3188 8.05526 14.3345C8.62735 14.6613 9.19839 14.9896 9.76841 15.3193C9.8304 15.3593 9.90262 15.3806 9.97641 15.3806C10.0502 15.3806 10.1224 15.3593 10.1844 15.3193C10.5714 15.095 10.9582 14.8704 11.3448 14.6454C11.4687 14.5854 11.586 14.5125 11.6946 14.428C11.7122 14.386 11.691 14.3537 11.6706 14.3225C11.6678 14.3182 11.665 14.3138 11.6623 14.3095C11.5758 14.1708 11.4876 14.0332 11.3995 13.8956C11.372 13.8528 11.3446 13.81 11.3172 13.7671C11.1769 13.5475 11.0371 13.3275 10.8974 13.1075C10.625 12.6788 10.3527 12.2501 10.0762 11.824C10.0581 11.8012 10.0477 11.7733 10.0463 11.7442C10.0449 11.7151 10.0527 11.6863 10.0686 11.6619C10.2379 11.3781 10.4057 11.0934 10.5735 10.8087C10.7135 10.5711 10.8536 10.3335 10.9945 10.0964C11.0375 10.0245 11.0447 10.025 11.0904 10.0964C11.309 10.4385 11.5264 10.7816 11.7438 11.1245C11.8805 11.3403 12.0171 11.5559 12.1541 11.7713C12.2684 11.9513 12.3826 12.1315 12.4967 12.3116C12.7266 12.6746 12.9566 13.0376 13.1885 13.3994C13.193 13.4063 13.1972 13.4135 13.2015 13.4208C13.2219 13.4554 13.2428 13.4908 13.2877 13.502C13.3883 13.4667 13.4833 13.4172 13.5697 13.3548C13.5806 13.349 13.5921 13.3438 13.6035 13.3385C13.6473 13.3184 13.6919 13.2979 13.716 13.2501C13.7151 13.2069 13.6993 13.1653 13.6711 13.1325C13.5194 12.8879 13.3679 12.6431 13.2166 12.398L12.0956 10.5847C11.877 10.2301 11.6579 9.87582 11.4385 9.52172C11.4192 9.5001 11.4072 9.47287 11.4043 9.44402C11.4013 9.41512 11.4076 9.38608 11.4222 9.36101C11.6884 8.90994 11.9547 8.45892 12.2212 8.00804C12.2624 7.93799 12.2699 7.93895 12.3111 8.00417C12.4266 8.18709 12.544 8.36903 12.6613 8.55095C12.7232 8.64707 12.7852 8.74318 12.8469 8.83943C13.3781 9.66321 13.9076 10.4881 14.4352 11.314C14.4513 11.3392 14.4672 11.3644 14.4831 11.3897C14.5326 11.4681 14.582 11.5466 14.6357 11.622C14.6383 11.6258 14.641 11.6302 14.6438 11.6348C14.6589 11.6599 14.6773 11.6905 14.7172 11.6519C14.7271 11.6197 14.7308 11.5858 14.728 11.5521C14.7291 10.1853 14.7291 8.81832 14.728 7.45139C14.7324 7.37267 14.7141 7.29432 14.6754 7.22564C14.6366 7.15693 14.5791 7.10079 14.5094 7.06378C14.4862 7.0508 14.4634 7.03721 14.4405 7.02361C14.4212 7.01215 14.402 7.00069 14.3825 6.98958C13.787 6.6482 13.1918 6.30627 12.5969 5.9637C12.3723 5.83444 12.1475 5.70551 11.9226 5.57658C11.3579 5.2527 10.793 4.92878 10.2318 4.5994C10.1515 4.54554 10.057 4.51678 9.96032 4.51678C9.86367 4.51678 9.76919 4.54554 9.68891 4.5994C9.36314 4.79296 9.03477 4.98212 8.70638 5.17129C8.6046 5.22992 8.50281 5.28855 8.40111 5.34731C8.07769 5.53416 7.75463 5.72166 7.43158 5.90915C6.7925 6.28006 6.15342 6.65097 5.51155 7.01686C5.41343 7.06304 5.33134 7.13762 5.27603 7.2309C5.22071 7.32423 5.19469 7.43198 5.20129 7.54024C5.2074 8.47384 5.20657 9.40749 5.20574 10.3411C5.20546 10.6641 5.20517 10.9871 5.20517 11.31C5.2032 11.3468 5.20407 11.3836 5.2078 11.4202C5.20848 11.4245 5.20885 11.4291 5.20923 11.4338C5.21098 11.4557 5.21288 11.4793 5.24762 11.4793C5.25164 11.4733 5.25571 11.4673 5.25978 11.4613C5.26775 11.4496 5.27571 11.4379 5.28335 11.426C6.01958 10.2898 6.75299 9.15195 7.48367 8.01228C7.62991 7.77986 7.84878 7.60214 8.10632 7.50678C8.38908 7.40382 8.68888 7.35552 8.9897 7.36442C9.14399 7.36578 9.29843 7.37097 9.45289 7.37616C9.51279 7.37817 9.57269 7.38019 9.63259 7.38198C9.63497 7.38207 9.63748 7.38194 9.64005 7.38181C9.65211 7.38119 9.66538 7.38051 9.67245 7.40202L5.67341 13.8158C5.71601 13.8403 5.75801 13.8644 5.79955 13.8882C5.90249 13.9471 6.00261 14.0044 6.10194 14.0631C6.1342 14.0818 6.15227 14.077 6.16812 14.0463C6.17336 14.0364 6.17927 14.0267 6.18519 14.0171C6.1873 14.0137 6.18941 14.0103 6.19149 14.0068C7.09012 12.5246 7.98866 11.0423 8.88711 9.55993C9.31121 8.86072 9.73481 8.16128 10.1579 7.46171C10.1666 7.43936 10.1819 7.42023 10.2019 7.40686C10.2218 7.3935 10.2453 7.38658 10.2693 7.387C10.6803 7.38751 11.0912 7.38571 11.5019 7.38392C11.652 7.38327 11.8021 7.38261 11.9521 7.38207C11.9537 7.38207 11.9554 7.38198 11.957 7.3819C11.967 7.38138 11.9781 7.3808 11.9879 7.39806C11.9831 7.40662 11.9782 7.41557 11.9732 7.42476C11.9619 7.44531 11.9499 7.46707 11.9373 7.48844C10.6246 9.71488 9.31218 11.9414 7.99995 14.168Z",fill:"var(--icon-primary)"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_8547_11033",children:jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"white"})})})]}),...wr})},Asterisk=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Asterisk",icon:jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",...br,children:[jsxRuntimeExports.jsx("path",{d:"M16 5V27",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M6 10L26 22",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M6 22L26 10",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]}),...wr})},Back=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Back",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M14.6882 6.18182L4.87 16L14.6882 25.8182",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M28.87 16H5.41541",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]}),...wr})},BellRingFilled=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"BellRingFilled",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M15.9984 27.9999C17.3969 27.9999 18.5993 27.176 19.1341 25.9923C19.2637 25.7046 19.0478 25.3809 18.7289 25.3809H13.2746C12.9557 25.3809 12.7365 25.7046 12.8693 25.9923C13.4041 27.176 14.6033 27.9999 16.0051 27.9999",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M24.369 22.1275C23.4821 22.1275 22.7613 21.4212 22.7613 20.5449V14.8C22.7613 11.6871 20.5889 9.07134 17.6591 8.34219C17.5529 7.52148 16.842 6.88715 15.9783 6.88715C15.1147 6.88715 14.3972 7.52802 14.2942 8.352C11.6634 9.02557 9.65376 11.2163 9.29169 13.9204C9.28505 13.9596 9.28172 13.9989 9.27508 14.0381C9.26844 14.0904 9.2618 14.146 9.25847 14.1983C9.25515 14.2506 9.24851 14.3062 9.24518 14.3585C9.24518 14.4043 9.23854 14.4468 9.23522 14.4926C9.2319 14.5841 9.22858 14.6757 9.22858 14.7673V20.5384C9.22858 21.4081 8.51772 22.1144 7.63414 22.1209C7.21228 22.1209 6.86682 22.4446 6.86682 22.8599V22.8664C6.86682 23.2784 7.20564 23.6119 7.62418 23.6119H24.3657C24.7843 23.6119 25.1231 23.2784 25.1231 22.8664C25.1231 22.4577 24.7876 22.1242 24.369 22.1242V22.1275Z",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M20.8481 7.21115C22.7315 7.60679 24.1698 9.20243 24.3458 11.0923C24.3658 11.3016 24.5518 11.4586 24.7677 11.4389C24.8707 11.4291 24.9637 11.3801 25.0301 11.3016C25.0966 11.2231 25.1264 11.125 25.1165 11.0237C25.0135 9.92178 24.5618 8.90161 23.811 8.07436C23.067 7.25366 22.097 6.6978 21.0075 6.46892C20.9809 6.46238 20.9544 6.45911 20.9278 6.45911C20.7484 6.45911 20.5856 6.58336 20.5491 6.75992C20.5026 6.96592 20.6388 7.16864 20.8481 7.21442V7.21115Z",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M21.2832 4.75565C24.213 5.37363 26.4518 7.85864 26.7275 10.7949C26.7475 11.0041 26.9335 11.1611 27.1494 11.1415C27.2524 11.1317 27.3454 11.0826 27.4118 11.0041C27.4782 10.9257 27.5081 10.8276 27.4982 10.7262C27.3454 9.10115 26.681 7.60033 25.5716 6.38071C24.4721 5.1709 23.0471 4.3502 21.4427 4.01341C21.4161 4.00687 21.3895 4.0036 21.3629 4.0036C21.1836 4.0036 21.0208 4.12785 20.9843 4.30442C20.9378 4.51041 21.0706 4.71314 21.2799 4.75891L21.2832 4.75565Z",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M11.152 7.21119C11.3612 7.16541 11.4941 6.96268 11.4509 6.75669C11.411 6.57685 11.2516 6.45587 11.0722 6.45587C11.0457 6.45587 11.0191 6.45587 10.9925 6.46568C9.90298 6.69456 8.93635 7.25042 8.18896 8.07113C7.43825 8.89838 6.98649 9.91854 6.88352 11.0205C6.87356 11.1218 6.90677 11.2199 6.96988 11.2984C7.03299 11.3769 7.12933 11.4259 7.2323 11.4357C7.45153 11.4553 7.63424 11.2984 7.65417 11.0891C7.83022 9.20247 9.27185 7.60683 11.152 7.21119Z",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M10.7167 4.75544C10.926 4.70966 11.0589 4.50693 11.0157 4.30094C10.9758 4.1211 10.8164 4.00012 10.637 4.00012C10.6104 4.00012 10.5838 4.00012 10.5573 4.00993C8.95287 4.34999 7.52785 5.16742 6.42836 6.37723C5.32222 7.59685 4.65787 9.10094 4.50175 10.7227C4.49178 10.8241 4.525 10.9222 4.58811 11.0007C4.65455 11.0791 4.74756 11.1282 4.85053 11.138C5.06645 11.1576 5.25246 11.0007 5.27239 10.7914C5.54809 7.85516 7.78695 5.37342 10.7167 4.75544Z",fill:"currentColor"})]}),...wr})},BnbMonotone=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"BnbMonotone",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_8547_11030)",children:[jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"var(--surface-tertiary)"}),jsxRuntimeExports.jsx("path",{d:"M7.56919 9.00324L9.99996 6.57247L12.4319 9.00427L13.8462 7.58992L9.99996 3.74377L6.15498 7.5888L7.56919 9.00324ZM3.74182 10.0019L5.15621 8.58734L6.57052 10.0016L5.15611 11.416L3.74182 10.0019ZM7.56919 11.0008L9.99996 13.4314L12.4319 10.9996L13.8469 12.4132L13.8462 12.414L9.99996 16.2601L6.15498 12.4151L6.15297 12.4131L7.56919 11.0008ZM13.4294 10.0025L14.8438 8.58814L16.2581 10.0024L14.8438 11.4168L13.4294 10.0025Z",fill:"var(--icon-primary)"}),jsxRuntimeExports.jsx("path",{d:"M11.6051 10.0017H11.6058L10.0006 8.39648L8.81418 9.58258L8.67788 9.71894L8.39673 10.0001L8.39453 10.0023L8.39673 10.0046L10.0006 11.6087L11.6059 10.0034L11.6067 10.0025L11.6051 10.0017Z",fill:"var(--icon-primary)"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_8547_11030",children:jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"white"})})})]}),...wr})},CaretRight=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"CaretRight",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("g",{"clip-path":"url(#clip0_4239_16009)",children:jsxRuntimeExports.jsx("path",{d:"M9.25146 6.41254L14.8389 12L9.25146 17.5875",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_4239_16009",children:jsxRuntimeExports.jsx("rect",{width:"15.9553",height:"8.72765",fill:"white",transform:"translate(16.4089 4.02235) rotate(90)"})})})]}),...wr})},Copy=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Copy",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_3114_35098)",children:[jsxRuntimeExports.jsx("path",{d:"M21 21H24C25.6569 21 27 19.6569 27 18V8C27 6.34315 25.6569 5 24 5H14C12.3431 5 11 6.34315 11 8V11",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M18 11H8C6.34315 11 5 12.3431 5 14V24C5 25.6569 6.34315 27 8 27H18C19.6569 27 21 25.6569 21 24V14C21 12.3431 19.6569 11 18 11Z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_3114_35098",children:jsxRuntimeExports.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(4 4)"})})})]}),...wr})},Cross=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Cross",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M25.3552 7.51471L8.38466 24.4853",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M25.3552 24.4853L8.38466 7.51473",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]}),...wr})},DefaultChainMonotone=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"DefaultChainMonotone",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_12416_24620)",children:[jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"var(--surface-tertiary)"}),jsxRuntimeExports.jsx("path",{d:"M7.41675 10.5H12.5833",stroke:"var(--icon-primary)","stroke-width":"1.5809","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M8.70836 13.0833H6.55563C5.8705 13.0833 5.21343 12.8111 4.72898 12.3267C4.24452 11.8422 3.97235 11.1852 3.97235 10.5C3.97235 9.8149 4.24452 9.15783 4.72898 8.67337C5.21343 8.18891 5.8705 7.91675 6.55563 7.91675H8.70836",stroke:"var(--icon-primary)","stroke-width":"1.5809","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M11.2916 7.91675H13.4444C14.1295 7.91675 14.7866 8.18891 15.271 8.67337C15.7555 9.15783 16.0276 9.8149 16.0276 10.5C16.0276 11.1852 15.7555 11.8422 15.271 12.3267C14.7866 12.8111 14.1295 13.0833 13.4444 13.0833H11.2916",stroke:"var(--icon-primary)","stroke-width":"1.5809","stroke-linecap":"round","stroke-linejoin":"round"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_12416_24620",children:jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"var(--surface-tertiary)"})})})]}),...wr})},EthereumMonotone=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"EthereumMonotone",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"var(--surface-tertiary)"}),jsxRuntimeExports.jsx("path",{d:"M5.76962 9.82823L9.99885 3.39282V12.12L5.76962 9.82823Z",fill:"var(--icon-primary)"}),jsxRuntimeExports.jsx("path",{d:"M9.99885 3.39282L14.2287 9.82823L9.99885 12.12V3.39282Z",fill:"var(--icon-primary)"}),jsxRuntimeExports.jsx("path",{d:"M9.99842 13.4332V16.6072L5.76917 11.1414L9.99842 13.4332Z",fill:"var(--icon-primary)"}),jsxRuntimeExports.jsx("path",{d:"M9.99842 16.6072V13.4332L14.2308 11.1414L9.99842 16.6072Z",fill:"var(--icon-primary)"})]}),...wr})},Ellipse=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Ellipse",icon:jsxRuntimeExports.jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"inherit",height:"inherit",fill:"currentColor",...br,children:jsxRuntimeExports.jsx("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})}),...wr})},ExternalLinkIcon=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"ExternalLinkIcon",icon:jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"inherit",height:"inherit",viewBox:"0 0 16 16",fill:"none",...br,children:[jsxRuntimeExports.jsx("path",{d:"M3.86646 11.8616L12.134 4.13842",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M5.6377 3.91724L12.1339 4.13841L11.9128 10.6346",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"})]}),...wr})},Front=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Front",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M19.0518 25.8182L28.87 16L19.0518 6.18181",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M4.87004 16L28.3246 16",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]}),...wr})},InfoFilled=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"InfoFilled",icon:jsxRuntimeExports.jsx("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:jsxRuntimeExports.jsx("path",{d:"M16 4C13.6266 4 11.3066 4.70379 9.33316 6.02236C7.35977 7.34094 5.8217 9.21508 4.91345 11.4078C4.0052 13.6005 3.76756 16.0133 4.23058 18.3411C4.6936 20.6689 5.83649 22.807 7.51472 24.4853C9.19295 26.1635 11.3311 27.3064 13.6589 27.7694C15.9867 28.2324 18.3995 27.9948 20.5922 27.0865C22.7849 26.1783 24.6591 24.6402 25.9776 22.6668C27.2962 20.6934 28 18.3734 28 16C27.9966 12.8184 26.7313 9.76814 24.4816 7.51843C22.2319 5.26872 19.1816 4.00336 16 4ZM15.5385 9.53846C15.8123 9.53846 16.08 9.61967 16.3077 9.77181C16.5354 9.92395 16.7129 10.1402 16.8177 10.3932C16.9225 10.6462 16.9499 10.9246 16.8965 11.1932C16.843 11.4618 16.7112 11.7085 16.5175 11.9021C16.3239 12.0958 16.0772 12.2277 15.8086 12.2811C15.54 12.3345 15.2616 12.3071 15.0086 12.2023C14.7556 12.0975 14.5393 11.92 14.3872 11.6923C14.2351 11.4646 14.1538 11.1969 14.1538 10.9231C14.1538 10.5559 14.2997 10.2037 14.5594 9.944C14.8191 9.68434 15.1712 9.53846 15.5385 9.53846ZM16.9231 22.4615C16.4334 22.4615 15.9639 22.267 15.6177 21.9208C15.2714 21.5746 15.0769 21.105 15.0769 20.6154V16C14.8321 16 14.5973 15.9027 14.4242 15.7296C14.2511 15.5565 14.1538 15.3217 14.1538 15.0769C14.1538 14.8321 14.2511 14.5973 14.4242 14.4242C14.5973 14.2511 14.8321 14.1538 15.0769 14.1538C15.5666 14.1538 16.0361 14.3483 16.3824 14.6946C16.7286 15.0408 16.9231 15.5104 16.9231 16V20.6154C17.1679 20.6154 17.4027 20.7126 17.5758 20.8857C17.7489 21.0589 17.8462 21.2936 17.8462 21.5385C17.8462 21.7833 17.7489 22.0181 17.5758 22.1912C17.4027 22.3643 17.1679 22.4615 16.9231 22.4615Z",fill:"currentColor"})}),...wr})},InternalLink=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"InternalLink",icon:jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"inherit",height:"inherit",viewBox:"0 0 16 16",fill:"none",...br,children:[jsxRuntimeExports.jsx("path",{d:"M12.134 4.13842L3.86645 11.8616",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M10.3623 12.0828L3.86607 11.8616L4.08724 5.36535",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"})]}),...wr})},KebabMenuVertical=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"KebabMenuVertical",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_372_37265)",children:[jsxRuntimeExports.jsx("path",{d:"M16 9.00001C17.3807 9.00001 18.5 7.88072 18.5 6.5C18.5 5.11929 17.3807 4 16 4C14.6193 4 13.5 5.11929 13.5 6.5C13.5 7.88072 14.6193 9.00001 16 9.00001Z",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M16 18.5C17.3807 18.5 18.5 17.3807 18.5 16C18.5 14.6193 17.3807 13.5 16 13.5C14.6193 13.5 13.5 14.6193 13.5 16C13.5 17.3807 14.6193 18.5 16 18.5Z",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M16 28C17.3807 28 18.5 26.8807 18.5 25.5C18.5 24.1193 17.3807 23 16 23C14.6193 23 13.5 24.1193 13.5 25.5C13.5 26.8807 14.6193 28 16 28Z",fill:"currentColor"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_372_37265",children:jsxRuntimeExports.jsx("rect",{width:"32",height:"32",fill:"white"})})})]}),...wr})},Logout=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Logout",icon:jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",...br,children:[jsxRuntimeExports.jsx("path",{d:"M14.0962 5H7.63464C6.53008 5 5.63464 5.89543 5.63464 7V25C5.63464 26.1046 6.53007 27 7.63464 27H14.0962",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"}),jsxRuntimeExports.jsx("path",{d:"M12.8269 15.5769H26.3654",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"}),jsxRuntimeExports.jsx("path",{d:"M21.7115 10.0769L26.3654 15.5769L21.7115 21.5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})]}),...wr})},OptimismMonotone=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"OptimismMonotone",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_8547_11031)",children:[jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"var(--surface-tertiary)"}),jsxRuntimeExports.jsx("path",{d:"M6.20647 13.2977C5.4798 13.2977 4.88446 13.1267 4.42038 12.7847C3.96239 12.4366 3.7334 11.942 3.7334 11.3008C3.7334 11.1664 3.74868 11.0015 3.77919 10.8061C3.85861 10.3664 3.97157 9.83814 4.11811 9.22134C4.53333 7.54198 5.60504 6.70227 7.33315 6.70227C7.8033 6.70227 8.22466 6.78165 8.59714 6.94041C8.96967 7.09309 9.26272 7.32515 9.47645 7.63663C9.69017 7.94194 9.79707 8.30839 9.79707 8.73583C9.79707 8.86409 9.7818 9.02591 9.75126 9.22134C9.65967 9.76484 9.54974 10.2931 9.42148 10.8061C9.20776 11.6427 8.83834 12.2687 8.31319 12.6839C7.78803 13.0931 7.08582 13.2977 6.20647 13.2977ZM6.33473 11.9786C6.67671 11.9786 6.9667 11.8778 7.20489 11.6763C7.44915 11.4748 7.62319 11.1664 7.72698 10.7511C7.86741 10.1771 7.97431 9.67627 8.04757 9.24883C8.07198 9.12056 8.08419 8.98929 8.08419 8.8549C8.08419 8.29919 7.79415 8.02132 7.21408 8.02132C6.87205 8.02132 6.579 8.1221 6.33473 8.32361C6.09659 8.52517 5.92558 8.83359 5.82183 9.24883C5.71185 9.65798 5.60193 10.1588 5.49205 10.7511C5.46759 10.8732 5.45538 11.0015 5.45538 11.1358C5.45538 11.6977 5.74853 11.9786 6.33473 11.9786Z",fill:"var(--icon-primary)"}),jsxRuntimeExports.jsx("path",{d:"M10.2212 13.2052C10.1541 13.2052 10.1022 13.1838 10.0656 13.141C10.035 13.0921 10.0259 13.0372 10.0381 12.9762L11.3021 7.02195C11.3143 6.95478 11.3479 6.89977 11.4028 6.85701C11.4578 6.81431 11.5158 6.79291 11.5769 6.79291H14.0133C14.6911 6.79291 15.2346 6.93338 15.6437 7.21427C16.059 7.49525 16.2666 7.9013 16.2666 8.43263C16.2666 8.58526 16.2483 8.74407 16.2116 8.90895C16.059 9.61126 15.7506 10.1303 15.2866 10.4662C14.8286 10.8021 14.1996 10.97 13.3996 10.97H12.1631L11.7418 12.9762C11.7295 13.0433 11.6959 13.0983 11.641 13.141C11.5861 13.1838 11.528 13.2052 11.467 13.2052H10.2212ZM13.4638 9.70591C13.7202 9.70591 13.9431 9.63567 14.1324 9.4952C14.3278 9.35473 14.456 9.15322 14.5171 8.89062C14.5354 8.78678 14.5446 8.69519 14.5446 8.61581C14.5446 8.43871 14.4927 8.30437 14.3889 8.21278C14.285 8.11502 14.108 8.06623 13.8576 8.06623H12.7584L12.4104 9.70591H13.4638Z",fill:"var(--icon-primary)"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_8547_11031",children:jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"white"})})})]}),...wr})},PolygonMonotone=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"PolygonMonotone",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_8547_11032)",children:[jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"var(--surface-tertiary)"}),jsxRuntimeExports.jsx("path",{d:"M12.9228 8.05636C12.7151 7.93768 12.4481 7.93768 12.2107 8.05636L10.549 9.03563L9.42137 9.65875L7.78934 10.638C7.5816 10.7567 7.31455 10.7567 7.07717 10.638L5.80121 9.86649C5.59347 9.7478 5.4451 9.51038 5.4451 9.24332V7.75967C5.4451 7.52225 5.56379 7.28487 5.80121 7.1365L7.07717 6.39465C7.28486 6.27597 7.55192 6.27597 7.78934 6.39465L9.06531 7.16619C9.273 7.28487 9.42137 7.52225 9.42137 7.78931V8.76853L10.549 8.11573V7.10682C10.549 6.86945 10.4303 6.63207 10.1929 6.4837L7.81898 5.08902C7.61129 4.97033 7.34423 4.97033 7.10681 5.08902L4.67359 6.51334C4.4362 6.63207 4.3175 6.86945 4.3175 7.10682V9.89617C4.3175 10.1335 4.4362 10.3709 4.67359 10.5193L7.07717 11.9139C7.28486 12.0326 7.55192 12.0326 7.78934 11.9139L9.42137 10.9644L10.549 10.3116L12.181 9.36201C12.3887 9.24332 12.6558 9.24332 12.8932 9.36201L14.1692 10.1039C14.3769 10.2225 14.5252 10.46 14.5252 10.727V12.2107C14.5252 12.4481 14.4065 12.6855 14.1692 12.8338L12.9228 13.5757C12.7151 13.6944 12.4481 13.6944 12.2107 13.5757L10.9347 12.8338C10.727 12.7152 10.5786 12.4777 10.5786 12.2107V11.2611L9.45105 11.9139V12.8932C9.45105 13.1306 9.56974 13.368 9.80711 13.5163L12.2107 14.911C12.4184 15.0297 12.6855 15.0297 12.9228 14.911L15.3264 13.5163C15.5341 13.3976 15.6825 13.1603 15.6825 12.8932V10.0742C15.6825 9.83681 15.5638 9.59943 15.3264 9.45106L12.9228 8.05636Z",fill:"var(--icon-primary)"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_8547_11032",children:jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"white"})})})]}),...wr})},PushMonotone=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"PushMonotone",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_8547_11034)",children:[jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"var(--surface-tertiary)"}),jsxRuntimeExports.jsx("path",{d:"M10.0018 15.9276C10.7755 15.9276 11.4394 15.4641 11.7345 14.8001C11.8061 14.6384 11.6866 14.4564 11.5099 14.4564H8.49415C8.31742 14.4564 8.19721 14.6381 8.26956 14.8001C8.56462 15.4641 9.22859 15.9276 10.0022 15.9276",fill:"var(--icon-primary)"}),jsxRuntimeExports.jsx("path",{d:"M14.629 12.6307C14.1383 12.6307 13.7408 12.2331 13.7408 11.7425V8.51607C13.7408 6.76759 12.5406 5.29984 10.9195 4.89023C10.8599 4.42937 10.4669 4.07251 9.98945 4.07251C9.51201 4.07251 9.11596 4.43238 9.05906 4.89588C7.60412 5.27346 6.49399 6.50494 6.29427 8.02356C6.29125 8.04579 6.28824 8.06765 6.2856 8.09026C6.28183 8.1204 6.27882 8.15017 6.27656 8.1807C6.27429 8.21122 6.27166 8.24137 6.26977 8.27151C6.26789 8.29714 6.266 8.32163 6.26487 8.34725C6.26261 8.39813 6.26111 8.44975 6.26111 8.50175V11.7421C6.26111 12.2305 5.86732 12.6265 5.3797 12.6303C5.1472 12.6322 4.95502 12.8115 4.95502 13.0448V13.0486C4.95502 13.2792 5.1423 13.4665 5.37292 13.4665H14.6271C14.8577 13.4665 15.045 13.2792 15.045 13.0486C15.0461 12.8183 14.8588 12.631 14.6282 12.631L14.629 12.6307Z",fill:"var(--icon-primary)"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_8547_11034",children:jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"white"})})})]}),...wr})},SolanaMonotone=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"SolanaMonotone",icon:jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"inherit",height:"inherit",viewBox:"0 0 21 20",fill:"none",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_10481_13051)",children:[jsxRuntimeExports.jsx("path",{d:"M0.5 8C0.5 3.58172 4.08172 0 8.5 0H12.5C16.9183 0 20.5 3.58172 20.5 8V12C20.5 16.4183 16.9183 20 12.5 20H8.5C4.08172 20 0.5 16.4183 0.5 12V8Z",fill:"var(--surface-tertiary)"}),jsxRuntimeExports.jsx("path",{d:"M15.7312 12.6567L13.986 14.4801C13.9481 14.5197 13.9022 14.5513 13.8512 14.5729C13.8002 14.5944 13.7451 14.6056 13.6895 14.6055H5.41647C5.377 14.6055 5.33838 14.5943 5.30537 14.5732C5.27236 14.5521 5.24639 14.5221 5.23066 14.4868C5.21492 14.4516 5.21011 14.4126 5.2168 14.3747C5.2235 14.3368 5.24141 14.3016 5.26834 14.2735L7.01485 12.4501C7.05269 12.4106 7.09844 12.3791 7.14928 12.3575C7.20013 12.336 7.25497 12.3248 7.31044 12.3247H15.583C15.6225 12.3247 15.6611 12.3359 15.6942 12.357C15.7271 12.3781 15.7531 12.4081 15.7689 12.4434C15.7846 12.4787 15.7894 12.5176 15.7827 12.5555C15.776 12.5934 15.7581 12.6286 15.7312 12.6567ZM13.986 8.98502C13.9481 8.94542 13.9022 8.91384 13.8512 8.89225C13.8002 8.87068 13.7451 8.85956 13.6895 8.85959H5.41647C5.377 8.85959 5.33838 8.87082 5.30537 8.89191C5.27236 8.913 5.24639 8.94302 5.23066 8.97828C5.21492 9.01356 5.21011 9.05254 5.2168 9.09044C5.2235 9.12833 5.24141 9.1635 5.26834 9.19162L7.01485 11.015C7.05269 11.0545 7.09844 11.086 7.14928 11.1076C7.20013 11.1291 7.25497 11.1403 7.31044 11.1404H15.583C15.6225 11.1404 15.6611 11.1292 15.6942 11.1081C15.7271 11.087 15.7531 11.057 15.7689 11.0217C15.7846 10.9864 15.7894 10.9475 15.7827 10.9096C15.776 10.8717 15.7581 10.8365 15.7312 10.8084L13.986 8.98502ZM5.41647 7.67531H13.6895C13.7451 7.67533 13.8002 7.66421 13.8512 7.64263C13.9022 7.62104 13.9481 7.58947 13.986 7.54986L15.7312 5.72651C15.7581 5.69839 15.776 5.66322 15.7827 5.62532C15.7894 5.58742 15.7846 5.54844 15.7689 5.51318C15.7531 5.47791 15.7271 5.44788 15.6942 5.4268C15.6611 5.40571 15.6225 5.39447 15.583 5.39447H7.31044C7.25497 5.39456 7.20013 5.40574 7.14928 5.42732C7.09844 5.4489 7.05269 5.48041 7.01485 5.51992L5.26879 7.34327C5.24189 7.37135 5.22398 7.40649 5.21727 7.44434C5.21056 7.4822 5.21534 7.52115 5.23102 7.5564C5.2467 7.59165 5.2726 7.62167 5.30554 7.6428C5.33848 7.66392 5.37703 7.67521 5.41647 7.67531Z",fill:"var(--icon-primary)"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_10481_13051",children:jsxRuntimeExports.jsx("path",{d:"M0.5 8C0.5 3.58172 4.08172 0 8.5 0H12.5C16.9183 0 20.5 3.58172 20.5 8V12C20.5 16.4183 16.9183 20 12.5 20H8.5C4.08172 20 0.5 16.4183 0.5 12V8Z",fill:"var(--icon-primary)"})})})]}),...wr})},Settings=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Settings",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M26.6931 16.5931C26.7164 16.198 26.7164 15.802 26.6931 15.407H26.689C26.671 15.1342 26.7559 14.8646 26.9268 14.6513L28.8659 12.2271C28.6436 11.5199 28.3587 10.8339 28.0146 10.1773L24.929 9.83433C24.66 9.80448 24.4117 9.67594 24.2321 9.47357C23.969 9.17774 23.6889 8.89758 23.393 8.63454C23.1907 8.45489 23.0621 8.20657 23.0323 7.93762L22.6824 4.85341C22.0258 4.50947 21.3398 4.22457 20.6327 4.00207L18.2044 5.94115C17.9929 6.11047 17.726 6.1952 17.4555 6.17892C17.0605 6.15569 16.6645 6.15569 16.2694 6.17892C15.999 6.1952 15.7321 6.11047 15.5206 5.94115L13.0964 4.00207C12.3892 4.2244 11.7032 4.50931 11.0466 4.85341L10.7036 7.93762C10.6737 8.20725 10.5447 8.45614 10.3415 8.6359C10.0457 8.89894 9.7655 9.1791 9.50246 9.47494C9.32281 9.6773 9.07449 9.80584 8.80554 9.8357L5.72133 10.1855C5.3774 10.8422 5.0925 11.5282 4.87 12.2353L6.80907 14.6636C6.97839 14.8751 7.06313 15.142 7.04685 15.4124C7.02362 15.8075 7.02362 16.2035 7.04685 16.5986C7.06313 16.869 6.97839 17.1359 6.80907 17.3474L4.87 19.7716C5.09233 20.4788 5.37723 21.1647 5.72133 21.8214L8.80691 22.1657C9.07586 22.1956 9.32418 22.3241 9.50383 22.5265C9.76687 22.8223 10.047 23.1025 10.3429 23.3655C10.5452 23.5452 10.6738 23.7935 10.7036 24.0624L11.0534 27.1466C11.7101 27.4906 12.3961 27.7755 13.1032 27.998L15.5329 26.0575C15.7444 25.8882 16.0113 25.8035 16.2817 25.8198C16.6767 25.843 17.0728 25.843 17.4678 25.8198H17.5334C17.7817 25.8196 18.0227 25.9039 18.2167 26.0589L20.6409 27.998C21.3481 27.7756 22.034 27.4907 22.6906 27.1466L23.0336 24.0611C23.0635 23.7921 23.192 23.5438 23.3944 23.3641C23.6902 23.1011 23.9704 22.8209 24.2334 22.5251C24.4131 22.3227 24.6614 22.1942 24.9303 22.1643L28.0187 21.8145C28.3626 21.1578 28.6475 20.4719 28.87 19.7648L26.9309 17.3419C26.7616 17.1304 26.6769 16.8635 26.6931 16.5931Z",stroke:"currentColor","stroke-width":"2","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M14.4385 19.6359C15.1576 20.1164 16.0031 20.3729 16.8679 20.3729C18.0277 20.3729 19.1399 19.9121 19.96 19.0921C20.7801 18.272 21.2408 17.1598 21.2408 16C21.2408 15.1352 20.9843 14.2897 20.5038 13.5706C20.0233 12.8515 19.3404 12.291 18.5414 11.9601C17.7423 11.6291 16.8631 11.5425 16.0149 11.7112C15.1666 11.8799 14.3874 12.2964 13.7759 12.908C13.1643 13.5195 12.7479 14.2987 12.5791 15.1469C12.4104 15.9952 12.497 16.8744 12.828 17.6734C13.159 18.4725 13.7194 19.1554 14.4385 19.6359Z",stroke:"currentColor","stroke-width":"2","stroke-linejoin":"round"})]}),...wr})},TickCircleFilled=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"TickCircleFilled",icon:jsxRuntimeExports.jsx("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:jsxRuntimeExports.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4 16C4 12.8174 5.26428 9.76516 7.51472 7.51472C9.76516 5.26428 12.8174 4 16 4C19.1826 4 22.2348 5.26428 24.4853 7.51472C26.7357 9.76516 28 12.8174 28 16C28 19.1826 26.7357 22.2348 24.4853 24.4853C22.2348 26.7357 19.1826 28 16 28C12.8174 28 9.76516 26.7357 7.51472 24.4853C5.26428 22.2348 4 19.1826 4 16ZM15.3152 21.136L22.224 12.4992L20.976 11.5008L15.0848 18.8624L10.912 15.3856L9.888 16.6144L15.3152 21.1376V21.136Z",fill:"currentColor"})}),...wr})},WarningCircleFilled=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"WarningCircleFilled",icon:jsxRuntimeExports.jsx("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:jsxRuntimeExports.jsx("path",{d:"M16 4C13.6266 4 11.3066 4.70379 9.33316 6.02236C7.35977 7.34094 5.8217 9.21508 4.91345 11.4078C4.0052 13.6005 3.76756 16.0133 4.23058 18.3411C4.6936 20.6689 5.83649 22.807 7.51472 24.4853C9.19295 26.1635 11.3311 27.3064 13.6589 27.7694C15.9867 28.2324 18.3995 27.9948 20.5922 27.0865C22.7849 26.1783 24.6591 24.6402 25.9776 22.6668C27.2962 20.6934 28 18.3734 28 16C27.9966 12.8184 26.7313 9.76814 24.4816 7.51843C22.2319 5.26872 19.1816 4.00336 16 4ZM15.0769 10.4615C15.0769 10.2167 15.1742 9.98193 15.3473 9.80882C15.5204 9.63571 15.7552 9.53846 16 9.53846C16.2448 9.53846 16.4796 9.63571 16.6527 9.80882C16.8258 9.98193 16.9231 10.2167 16.9231 10.4615V16.9231C16.9231 17.1679 16.8258 17.4027 16.6527 17.5758C16.4796 17.7489 16.2448 17.8462 16 17.8462C15.7552 17.8462 15.5204 17.7489 15.3473 17.5758C15.1742 17.4027 15.0769 17.1679 15.0769 16.9231V10.4615ZM16 22.4615C15.7262 22.4615 15.4585 22.3803 15.2308 22.2282C15.0031 22.076 14.8256 21.8598 14.7208 21.6068C14.616 21.3538 14.5886 21.0754 14.642 20.8068C14.6954 20.5382 14.8273 20.2915 15.0209 20.0978C15.2146 19.9042 15.4613 19.7723 15.7299 19.7189C15.9985 19.6655 16.2769 19.6929 16.5299 19.7977C16.7829 19.9025 16.9991 20.08 17.1513 20.3077C17.3034 20.5354 17.3846 20.8031 17.3846 21.0769C17.3846 21.4441 17.2387 21.7963 16.9791 22.056C16.7194 22.3157 16.3672 22.4615 16 22.4615Z",fill:"currentColor"})}),...wr})},StyledIllustrationWrapper=qe$2.span` +`,IconWrapper=({autoSize:fr,color:br,componentName:wr,icon:Er,size:kr,...jr})=>{const Br=br?`var(--${br})`:"currentColor",Wr=kr?`${kr}px`:fr?"1em":"16px";return jsxRuntimeExports.jsx(StyledIconWrapper,{"aria-hidden":"true","aria-label":wr,color:Br,role:"img",size:Wr,...jr,children:Er})},Apple=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Apple",icon:jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"inherit",height:"inherit",viewBox:"0 0 25 25",fill:"none",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_11450_3938)",children:[jsxRuntimeExports.jsx("path",{d:"M17.1192 0.147949C17.1751 0.147949 17.2309 0.147949 17.2899 0.147949C17.4269 1.84048 16.7809 3.10514 15.9958 4.02096C15.2254 4.93045 14.1704 5.81255 12.4642 5.67871C12.3504 4.01042 12.9975 2.83956 13.7816 1.92584C14.5087 1.07431 15.8419 0.31657 17.1192 0.147949Z",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M22.2841 17.7646C22.2841 17.7814 22.2841 17.7962 22.2841 17.812C21.8046 19.2642 21.1206 20.5089 20.2859 21.6639C19.524 22.7125 18.5903 24.1237 16.923 24.1237C15.4824 24.1237 14.5254 23.1973 13.049 23.172C11.4871 23.1467 10.6282 23.9466 9.20019 24.1479C9.03684 24.1479 8.87348 24.1479 8.71329 24.1479C7.66468 23.9962 6.81842 23.1657 6.2019 22.4175C4.38396 20.2064 2.97914 17.3504 2.71777 13.6955C2.71777 13.3372 2.71777 12.98 2.71777 12.6216C2.82843 10.0059 4.09941 7.87919 5.78878 6.84849C6.68036 6.30047 7.90602 5.83361 9.2708 6.04227C9.8557 6.13291 10.4532 6.33314 10.977 6.53127C11.4734 6.72203 12.0941 7.06032 12.6822 7.04241C13.0806 7.03081 13.4768 6.8232 13.8784 6.67671C15.0545 6.252 16.2074 5.7651 17.7271 5.9938C19.5535 6.26991 20.8498 7.0814 21.6507 8.33341C20.1057 9.31668 18.8843 10.7984 19.093 13.3288C19.2784 15.6273 20.6148 16.9721 22.2841 17.7646Z",fill:"currentColor"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_11450_3938",children:jsxRuntimeExports.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(0.5 0.147949)"})})})]}),...wr})},ArbitrumMonotone=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"ArbitrumMonotone",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_8547_11033)",children:[jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"var(--surface-tertiary)"}),jsxRuntimeExports.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5.02206 6.4834L9.44362 3.92956C9.61165 3.83254 9.80225 3.78223 9.99629 3.78223C10.1903 3.78223 10.381 3.8333 10.549 3.93032L14.9757 6.48939C15.1435 6.58639 15.2828 6.7258 15.3797 6.89359C15.4766 7.06144 15.5277 7.25176 15.5278 7.44557L15.5306 12.5588C15.5307 12.753 15.4796 12.9437 15.3826 13.1118C15.2856 13.2799 15.146 13.4195 14.9779 13.5165L10.5564 16.0696C10.3883 16.1666 10.1977 16.2177 10.0036 16.2177C9.80959 16.2177 9.61899 16.1666 9.45096 16.0696L5.02425 13.5106C4.85647 13.4136 4.71714 13.2742 4.62023 13.1064C4.52333 12.9385 4.47225 12.7482 4.47213 12.5544L4.46936 7.44107C4.46929 7.24698 4.52033 7.05628 4.61735 6.88816C4.71437 6.72004 4.85396 6.58044 5.02206 6.4834ZM7.99995 14.168C7.97838 14.194 7.96364 14.2249 7.95686 14.2579C7.9817 14.2923 8.01585 14.3188 8.05526 14.3345C8.62735 14.6613 9.19839 14.9896 9.76841 15.3193C9.8304 15.3593 9.90262 15.3806 9.97641 15.3806C10.0502 15.3806 10.1224 15.3593 10.1844 15.3193C10.5714 15.095 10.9582 14.8704 11.3448 14.6454C11.4687 14.5854 11.586 14.5125 11.6946 14.428C11.7122 14.386 11.691 14.3537 11.6706 14.3225C11.6678 14.3182 11.665 14.3138 11.6623 14.3095C11.5758 14.1708 11.4876 14.0332 11.3995 13.8956C11.372 13.8528 11.3446 13.81 11.3172 13.7671C11.1769 13.5475 11.0371 13.3275 10.8974 13.1075C10.625 12.6788 10.3527 12.2501 10.0762 11.824C10.0581 11.8012 10.0477 11.7733 10.0463 11.7442C10.0449 11.7151 10.0527 11.6863 10.0686 11.6619C10.2379 11.3781 10.4057 11.0934 10.5735 10.8087C10.7135 10.5711 10.8536 10.3335 10.9945 10.0964C11.0375 10.0245 11.0447 10.025 11.0904 10.0964C11.309 10.4385 11.5264 10.7816 11.7438 11.1245C11.8805 11.3403 12.0171 11.5559 12.1541 11.7713C12.2684 11.9513 12.3826 12.1315 12.4967 12.3116C12.7266 12.6746 12.9566 13.0376 13.1885 13.3994C13.193 13.4063 13.1972 13.4135 13.2015 13.4208C13.2219 13.4554 13.2428 13.4908 13.2877 13.502C13.3883 13.4667 13.4833 13.4172 13.5697 13.3548C13.5806 13.349 13.5921 13.3438 13.6035 13.3385C13.6473 13.3184 13.6919 13.2979 13.716 13.2501C13.7151 13.2069 13.6993 13.1653 13.6711 13.1325C13.5194 12.8879 13.3679 12.6431 13.2166 12.398L12.0956 10.5847C11.877 10.2301 11.6579 9.87582 11.4385 9.52172C11.4192 9.5001 11.4072 9.47287 11.4043 9.44402C11.4013 9.41512 11.4076 9.38608 11.4222 9.36101C11.6884 8.90994 11.9547 8.45892 12.2212 8.00804C12.2624 7.93799 12.2699 7.93895 12.3111 8.00417C12.4266 8.18709 12.544 8.36903 12.6613 8.55095C12.7232 8.64707 12.7852 8.74318 12.8469 8.83943C13.3781 9.66321 13.9076 10.4881 14.4352 11.314C14.4513 11.3392 14.4672 11.3644 14.4831 11.3897C14.5326 11.4681 14.582 11.5466 14.6357 11.622C14.6383 11.6258 14.641 11.6302 14.6438 11.6348C14.6589 11.6599 14.6773 11.6905 14.7172 11.6519C14.7271 11.6197 14.7308 11.5858 14.728 11.5521C14.7291 10.1853 14.7291 8.81832 14.728 7.45139C14.7324 7.37267 14.7141 7.29432 14.6754 7.22564C14.6366 7.15693 14.5791 7.10079 14.5094 7.06378C14.4862 7.0508 14.4634 7.03721 14.4405 7.02361C14.4212 7.01215 14.402 7.00069 14.3825 6.98958C13.787 6.6482 13.1918 6.30627 12.5969 5.9637C12.3723 5.83444 12.1475 5.70551 11.9226 5.57658C11.3579 5.2527 10.793 4.92878 10.2318 4.5994C10.1515 4.54554 10.057 4.51678 9.96032 4.51678C9.86367 4.51678 9.76919 4.54554 9.68891 4.5994C9.36314 4.79296 9.03477 4.98212 8.70638 5.17129C8.6046 5.22992 8.50281 5.28855 8.40111 5.34731C8.07769 5.53416 7.75463 5.72166 7.43158 5.90915C6.7925 6.28006 6.15342 6.65097 5.51155 7.01686C5.41343 7.06304 5.33134 7.13762 5.27603 7.2309C5.22071 7.32423 5.19469 7.43198 5.20129 7.54024C5.2074 8.47384 5.20657 9.40749 5.20574 10.3411C5.20546 10.6641 5.20517 10.9871 5.20517 11.31C5.2032 11.3468 5.20407 11.3836 5.2078 11.4202C5.20848 11.4245 5.20885 11.4291 5.20923 11.4338C5.21098 11.4557 5.21288 11.4793 5.24762 11.4793C5.25164 11.4733 5.25571 11.4673 5.25978 11.4613C5.26775 11.4496 5.27571 11.4379 5.28335 11.426C6.01958 10.2898 6.75299 9.15195 7.48367 8.01228C7.62991 7.77986 7.84878 7.60214 8.10632 7.50678C8.38908 7.40382 8.68888 7.35552 8.9897 7.36442C9.14399 7.36578 9.29843 7.37097 9.45289 7.37616C9.51279 7.37817 9.57269 7.38019 9.63259 7.38198C9.63497 7.38207 9.63748 7.38194 9.64005 7.38181C9.65211 7.38119 9.66538 7.38051 9.67245 7.40202L5.67341 13.8158C5.71601 13.8403 5.75801 13.8644 5.79955 13.8882C5.90249 13.9471 6.00261 14.0044 6.10194 14.0631C6.1342 14.0818 6.15227 14.077 6.16812 14.0463C6.17336 14.0364 6.17927 14.0267 6.18519 14.0171C6.1873 14.0137 6.18941 14.0103 6.19149 14.0068C7.09012 12.5246 7.98866 11.0423 8.88711 9.55993C9.31121 8.86072 9.73481 8.16128 10.1579 7.46171C10.1666 7.43936 10.1819 7.42023 10.2019 7.40686C10.2218 7.3935 10.2453 7.38658 10.2693 7.387C10.6803 7.38751 11.0912 7.38571 11.5019 7.38392C11.652 7.38327 11.8021 7.38261 11.9521 7.38207C11.9537 7.38207 11.9554 7.38198 11.957 7.3819C11.967 7.38138 11.9781 7.3808 11.9879 7.39806C11.9831 7.40662 11.9782 7.41557 11.9732 7.42476C11.9619 7.44531 11.9499 7.46707 11.9373 7.48844C10.6246 9.71488 9.31218 11.9414 7.99995 14.168Z",fill:"var(--icon-primary)"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_8547_11033",children:jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"white"})})})]}),...wr})},Asterisk=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Asterisk",icon:jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",...br,children:[jsxRuntimeExports.jsx("path",{d:"M16 5V27",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M6 10L26 22",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M6 22L26 10",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]}),...wr})},Back=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Back",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M14.6882 6.18182L4.87 16L14.6882 25.8182",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M28.87 16H5.41541",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]}),...wr})},BellRingFilled=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"BellRingFilled",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M15.9984 27.9999C17.3969 27.9999 18.5993 27.176 19.1341 25.9923C19.2637 25.7046 19.0478 25.3809 18.7289 25.3809H13.2746C12.9557 25.3809 12.7365 25.7046 12.8693 25.9923C13.4041 27.176 14.6033 27.9999 16.0051 27.9999",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M24.369 22.1275C23.4821 22.1275 22.7613 21.4212 22.7613 20.5449V14.8C22.7613 11.6871 20.5889 9.07134 17.6591 8.34219C17.5529 7.52148 16.842 6.88715 15.9783 6.88715C15.1147 6.88715 14.3972 7.52802 14.2942 8.352C11.6634 9.02557 9.65376 11.2163 9.29169 13.9204C9.28505 13.9596 9.28172 13.9989 9.27508 14.0381C9.26844 14.0904 9.2618 14.146 9.25847 14.1983C9.25515 14.2506 9.24851 14.3062 9.24518 14.3585C9.24518 14.4043 9.23854 14.4468 9.23522 14.4926C9.2319 14.5841 9.22858 14.6757 9.22858 14.7673V20.5384C9.22858 21.4081 8.51772 22.1144 7.63414 22.1209C7.21228 22.1209 6.86682 22.4446 6.86682 22.8599V22.8664C6.86682 23.2784 7.20564 23.6119 7.62418 23.6119H24.3657C24.7843 23.6119 25.1231 23.2784 25.1231 22.8664C25.1231 22.4577 24.7876 22.1242 24.369 22.1242V22.1275Z",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M20.8481 7.21115C22.7315 7.60679 24.1698 9.20243 24.3458 11.0923C24.3658 11.3016 24.5518 11.4586 24.7677 11.4389C24.8707 11.4291 24.9637 11.3801 25.0301 11.3016C25.0966 11.2231 25.1264 11.125 25.1165 11.0237C25.0135 9.92178 24.5618 8.90161 23.811 8.07436C23.067 7.25366 22.097 6.6978 21.0075 6.46892C20.9809 6.46238 20.9544 6.45911 20.9278 6.45911C20.7484 6.45911 20.5856 6.58336 20.5491 6.75992C20.5026 6.96592 20.6388 7.16864 20.8481 7.21442V7.21115Z",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M21.2832 4.75565C24.213 5.37363 26.4518 7.85864 26.7275 10.7949C26.7475 11.0041 26.9335 11.1611 27.1494 11.1415C27.2524 11.1317 27.3454 11.0826 27.4118 11.0041C27.4782 10.9257 27.5081 10.8276 27.4982 10.7262C27.3454 9.10115 26.681 7.60033 25.5716 6.38071C24.4721 5.1709 23.0471 4.3502 21.4427 4.01341C21.4161 4.00687 21.3895 4.0036 21.3629 4.0036C21.1836 4.0036 21.0208 4.12785 20.9843 4.30442C20.9378 4.51041 21.0706 4.71314 21.2799 4.75891L21.2832 4.75565Z",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M11.152 7.21119C11.3612 7.16541 11.4941 6.96268 11.4509 6.75669C11.411 6.57685 11.2516 6.45587 11.0722 6.45587C11.0457 6.45587 11.0191 6.45587 10.9925 6.46568C9.90298 6.69456 8.93635 7.25042 8.18896 8.07113C7.43825 8.89838 6.98649 9.91854 6.88352 11.0205C6.87356 11.1218 6.90677 11.2199 6.96988 11.2984C7.03299 11.3769 7.12933 11.4259 7.2323 11.4357C7.45153 11.4553 7.63424 11.2984 7.65417 11.0891C7.83022 9.20247 9.27185 7.60683 11.152 7.21119Z",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M10.7167 4.75544C10.926 4.70966 11.0589 4.50693 11.0157 4.30094C10.9758 4.1211 10.8164 4.00012 10.637 4.00012C10.6104 4.00012 10.5838 4.00012 10.5573 4.00993C8.95287 4.34999 7.52785 5.16742 6.42836 6.37723C5.32222 7.59685 4.65787 9.10094 4.50175 10.7227C4.49178 10.8241 4.525 10.9222 4.58811 11.0007C4.65455 11.0791 4.74756 11.1282 4.85053 11.138C5.06645 11.1576 5.25246 11.0007 5.27239 10.7914C5.54809 7.85516 7.78695 5.37342 10.7167 4.75544Z",fill:"currentColor"})]}),...wr})},BnbMonotone=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"BnbMonotone",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_8547_11030)",children:[jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"var(--surface-tertiary)"}),jsxRuntimeExports.jsx("path",{d:"M7.56919 9.00324L9.99996 6.57247L12.4319 9.00427L13.8462 7.58992L9.99996 3.74377L6.15498 7.5888L7.56919 9.00324ZM3.74182 10.0019L5.15621 8.58734L6.57052 10.0016L5.15611 11.416L3.74182 10.0019ZM7.56919 11.0008L9.99996 13.4314L12.4319 10.9996L13.8469 12.4132L13.8462 12.414L9.99996 16.2601L6.15498 12.4151L6.15297 12.4131L7.56919 11.0008ZM13.4294 10.0025L14.8438 8.58814L16.2581 10.0024L14.8438 11.4168L13.4294 10.0025Z",fill:"var(--icon-primary)"}),jsxRuntimeExports.jsx("path",{d:"M11.6051 10.0017H11.6058L10.0006 8.39648L8.81418 9.58258L8.67788 9.71894L8.39673 10.0001L8.39453 10.0023L8.39673 10.0046L10.0006 11.6087L11.6059 10.0034L11.6067 10.0025L11.6051 10.0017Z",fill:"var(--icon-primary)"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_8547_11030",children:jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"white"})})})]}),...wr})},CaretRight=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"CaretRight",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("g",{"clip-path":"url(#clip0_4239_16009)",children:jsxRuntimeExports.jsx("path",{d:"M9.25146 6.41254L14.8389 12L9.25146 17.5875",stroke:"currentColor","stroke-width":"1.5","stroke-linecap":"round","stroke-linejoin":"round"})}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_4239_16009",children:jsxRuntimeExports.jsx("rect",{width:"15.9553",height:"8.72765",fill:"white",transform:"translate(16.4089 4.02235) rotate(90)"})})})]}),...wr})},Copy=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Copy",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_3114_35098)",children:[jsxRuntimeExports.jsx("path",{d:"M21 21H24C25.6569 21 27 19.6569 27 18V8C27 6.34315 25.6569 5 24 5H14C12.3431 5 11 6.34315 11 8V11",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M18 11H8C6.34315 11 5 12.3431 5 14V24C5 25.6569 6.34315 27 8 27H18C19.6569 27 21 25.6569 21 24V14C21 12.3431 19.6569 11 18 11Z",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_3114_35098",children:jsxRuntimeExports.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(4 4)"})})})]}),...wr})},Cross=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Cross",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M25.3552 7.51471L8.38466 24.4853",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M25.3552 24.4853L8.38466 7.51473",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]}),...wr})},DefaultChainMonotone=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"DefaultChainMonotone",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_12416_24620)",children:[jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"var(--surface-tertiary)"}),jsxRuntimeExports.jsx("path",{d:"M7.41675 10.5H12.5833",stroke:"var(--icon-primary)","stroke-width":"1.5809","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M8.70836 13.0833H6.55563C5.8705 13.0833 5.21343 12.8111 4.72898 12.3267C4.24452 11.8422 3.97235 11.1852 3.97235 10.5C3.97235 9.8149 4.24452 9.15783 4.72898 8.67337C5.21343 8.18891 5.8705 7.91675 6.55563 7.91675H8.70836",stroke:"var(--icon-primary)","stroke-width":"1.5809","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M11.2916 7.91675H13.4444C14.1295 7.91675 14.7866 8.18891 15.271 8.67337C15.7555 9.15783 16.0276 9.8149 16.0276 10.5C16.0276 11.1852 15.7555 11.8422 15.271 12.3267C14.7866 12.8111 14.1295 13.0833 13.4444 13.0833H11.2916",stroke:"var(--icon-primary)","stroke-width":"1.5809","stroke-linecap":"round","stroke-linejoin":"round"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_12416_24620",children:jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"var(--surface-tertiary)"})})})]}),...wr})},EthereumMonotone=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"EthereumMonotone",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"var(--surface-tertiary)"}),jsxRuntimeExports.jsx("path",{d:"M5.76962 9.82823L9.99885 3.39282V12.12L5.76962 9.82823Z",fill:"var(--icon-primary)"}),jsxRuntimeExports.jsx("path",{d:"M9.99885 3.39282L14.2287 9.82823L9.99885 12.12V3.39282Z",fill:"var(--icon-primary)"}),jsxRuntimeExports.jsx("path",{d:"M9.99842 13.4332V16.6072L5.76917 11.1414L9.99842 13.4332Z",fill:"var(--icon-primary)"}),jsxRuntimeExports.jsx("path",{d:"M9.99842 16.6072V13.4332L14.2308 11.1414L9.99842 16.6072Z",fill:"var(--icon-primary)"})]}),...wr})},Ellipse=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Ellipse",icon:jsxRuntimeExports.jsx("svg",{viewBox:"0 0 1024 1024",xmlns:"http://www.w3.org/2000/svg",width:"inherit",height:"inherit",fill:"currentColor",...br,children:jsxRuntimeExports.jsx("path",{d:"M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"})}),...wr})},ExternalLinkIcon=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"ExternalLinkIcon",icon:jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"inherit",height:"inherit",viewBox:"0 0 16 16",fill:"none",...br,children:[jsxRuntimeExports.jsx("path",{d:"M3.86646 11.8616L12.134 4.13842",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M5.6377 3.91724L12.1339 4.13841L11.9128 10.6346",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"})]}),...wr})},Front=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Front",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M19.0518 25.8182L28.87 16L19.0518 6.18181",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M4.87004 16L28.3246 16",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})]}),...wr})},Github=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Github",icon:jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"inherit",height:"inherit",viewBox:"0 0 24 24",fill:"none",...br,children:[jsxRuntimeExports.jsx("g",{"clip-path":"url(#clip0_11020_25835)",children:jsxRuntimeExports.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M11.9642 0.197327C5.34833 0.197327 0 5.58508 0 12.2505C0 17.5785 3.42686 22.0885 8.18082 23.6848C8.77518 23.8048 8.9929 23.4254 8.9929 23.1063C8.9929 22.8269 8.97331 21.8691 8.97331 20.8711C5.64514 21.5897 4.95208 19.4343 4.95208 19.4343C4.41722 18.0374 3.62473 17.6784 3.62473 17.6784C2.53543 16.94 3.70408 16.94 3.70408 16.94C4.91241 17.0199 5.54645 18.1772 5.54645 18.1772C6.61592 20.013 8.33926 19.4943 9.03257 19.175C9.13151 18.3967 9.44865 17.8579 9.78539 17.5586C7.13094 17.2792 4.33812 16.2416 4.33812 11.6118C4.33812 10.2947 4.81322 9.21716 5.56604 8.37912C5.44727 8.07986 5.03118 6.84239 5.68506 5.18614C5.68506 5.18614 6.69527 4.8668 8.97306 6.42337C9.94827 6.15953 10.954 6.02531 11.9642 6.02418C12.9744 6.02418 14.0042 6.16402 14.9552 6.42337C17.2332 4.8668 18.2434 5.18614 18.2434 5.18614C18.8973 6.84239 18.481 8.07986 18.3622 8.37912C19.1349 9.21716 19.5904 10.2947 19.5904 11.6118C19.5904 16.2416 16.7976 17.2591 14.1233 17.5586C14.5592 17.9377 14.9353 18.656 14.9353 19.7936C14.9353 21.4099 14.9158 22.7071 14.9158 23.1061C14.9158 23.4254 15.1337 23.8048 15.7278 23.685C20.4818 22.0883 23.9087 17.5785 23.9087 12.2505C23.9282 5.58508 18.5603 0.197327 11.9642 0.197327Z",fill:"currentColor"})}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_11020_25835",children:jsxRuntimeExports.jsx("rect",{width:"24",height:"23.5102",fill:"white",transform:"translate(0 0.197327)"})})})]}),...wr})},InfoFilled=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"InfoFilled",icon:jsxRuntimeExports.jsx("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:jsxRuntimeExports.jsx("path",{d:"M16 4C13.6266 4 11.3066 4.70379 9.33316 6.02236C7.35977 7.34094 5.8217 9.21508 4.91345 11.4078C4.0052 13.6005 3.76756 16.0133 4.23058 18.3411C4.6936 20.6689 5.83649 22.807 7.51472 24.4853C9.19295 26.1635 11.3311 27.3064 13.6589 27.7694C15.9867 28.2324 18.3995 27.9948 20.5922 27.0865C22.7849 26.1783 24.6591 24.6402 25.9776 22.6668C27.2962 20.6934 28 18.3734 28 16C27.9966 12.8184 26.7313 9.76814 24.4816 7.51843C22.2319 5.26872 19.1816 4.00336 16 4ZM15.5385 9.53846C15.8123 9.53846 16.08 9.61967 16.3077 9.77181C16.5354 9.92395 16.7129 10.1402 16.8177 10.3932C16.9225 10.6462 16.9499 10.9246 16.8965 11.1932C16.843 11.4618 16.7112 11.7085 16.5175 11.9021C16.3239 12.0958 16.0772 12.2277 15.8086 12.2811C15.54 12.3345 15.2616 12.3071 15.0086 12.2023C14.7556 12.0975 14.5393 11.92 14.3872 11.6923C14.2351 11.4646 14.1538 11.1969 14.1538 10.9231C14.1538 10.5559 14.2997 10.2037 14.5594 9.944C14.8191 9.68434 15.1712 9.53846 15.5385 9.53846ZM16.9231 22.4615C16.4334 22.4615 15.9639 22.267 15.6177 21.9208C15.2714 21.5746 15.0769 21.105 15.0769 20.6154V16C14.8321 16 14.5973 15.9027 14.4242 15.7296C14.2511 15.5565 14.1538 15.3217 14.1538 15.0769C14.1538 14.8321 14.2511 14.5973 14.4242 14.4242C14.5973 14.2511 14.8321 14.1538 15.0769 14.1538C15.5666 14.1538 16.0361 14.3483 16.3824 14.6946C16.7286 15.0408 16.9231 15.5104 16.9231 16V20.6154C17.1679 20.6154 17.4027 20.7126 17.5758 20.8857C17.7489 21.0589 17.8462 21.2936 17.8462 21.5385C17.8462 21.7833 17.7489 22.0181 17.5758 22.1912C17.4027 22.3643 17.1679 22.4615 16.9231 22.4615Z",fill:"currentColor"})}),...wr})},InternalLink=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"InternalLink",icon:jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"inherit",height:"inherit",viewBox:"0 0 16 16",fill:"none",...br,children:[jsxRuntimeExports.jsx("path",{d:"M12.134 4.13842L3.86645 11.8616",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M10.3623 12.0828L3.86607 11.8616L4.08724 5.36535",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round"})]}),...wr})},KebabMenuVertical=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"KebabMenuVertical",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_372_37265)",children:[jsxRuntimeExports.jsx("path",{d:"M16 9.00001C17.3807 9.00001 18.5 7.88072 18.5 6.5C18.5 5.11929 17.3807 4 16 4C14.6193 4 13.5 5.11929 13.5 6.5C13.5 7.88072 14.6193 9.00001 16 9.00001Z",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M16 18.5C17.3807 18.5 18.5 17.3807 18.5 16C18.5 14.6193 17.3807 13.5 16 13.5C14.6193 13.5 13.5 14.6193 13.5 16C13.5 17.3807 14.6193 18.5 16 18.5Z",fill:"currentColor"}),jsxRuntimeExports.jsx("path",{d:"M16 28C17.3807 28 18.5 26.8807 18.5 25.5C18.5 24.1193 17.3807 23 16 23C14.6193 23 13.5 24.1193 13.5 25.5C13.5 26.8807 14.6193 28 16 28Z",fill:"currentColor"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_372_37265",children:jsxRuntimeExports.jsx("rect",{width:"32",height:"32",fill:"white"})})})]}),...wr})},Logout=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Logout",icon:jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",...br,children:[jsxRuntimeExports.jsx("path",{d:"M14.0962 5H7.63464C6.53008 5 5.63464 5.89543 5.63464 7V25C5.63464 26.1046 6.53007 27 7.63464 27H14.0962",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"}),jsxRuntimeExports.jsx("path",{d:"M12.8269 15.5769H26.3654",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"}),jsxRuntimeExports.jsx("path",{d:"M21.7115 10.0769L26.3654 15.5769L21.7115 21.5",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round"})]}),...wr})},OptimismMonotone=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"OptimismMonotone",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_8547_11031)",children:[jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"var(--surface-tertiary)"}),jsxRuntimeExports.jsx("path",{d:"M6.20647 13.2977C5.4798 13.2977 4.88446 13.1267 4.42038 12.7847C3.96239 12.4366 3.7334 11.942 3.7334 11.3008C3.7334 11.1664 3.74868 11.0015 3.77919 10.8061C3.85861 10.3664 3.97157 9.83814 4.11811 9.22134C4.53333 7.54198 5.60504 6.70227 7.33315 6.70227C7.8033 6.70227 8.22466 6.78165 8.59714 6.94041C8.96967 7.09309 9.26272 7.32515 9.47645 7.63663C9.69017 7.94194 9.79707 8.30839 9.79707 8.73583C9.79707 8.86409 9.7818 9.02591 9.75126 9.22134C9.65967 9.76484 9.54974 10.2931 9.42148 10.8061C9.20776 11.6427 8.83834 12.2687 8.31319 12.6839C7.78803 13.0931 7.08582 13.2977 6.20647 13.2977ZM6.33473 11.9786C6.67671 11.9786 6.9667 11.8778 7.20489 11.6763C7.44915 11.4748 7.62319 11.1664 7.72698 10.7511C7.86741 10.1771 7.97431 9.67627 8.04757 9.24883C8.07198 9.12056 8.08419 8.98929 8.08419 8.8549C8.08419 8.29919 7.79415 8.02132 7.21408 8.02132C6.87205 8.02132 6.579 8.1221 6.33473 8.32361C6.09659 8.52517 5.92558 8.83359 5.82183 9.24883C5.71185 9.65798 5.60193 10.1588 5.49205 10.7511C5.46759 10.8732 5.45538 11.0015 5.45538 11.1358C5.45538 11.6977 5.74853 11.9786 6.33473 11.9786Z",fill:"var(--icon-primary)"}),jsxRuntimeExports.jsx("path",{d:"M10.2212 13.2052C10.1541 13.2052 10.1022 13.1838 10.0656 13.141C10.035 13.0921 10.0259 13.0372 10.0381 12.9762L11.3021 7.02195C11.3143 6.95478 11.3479 6.89977 11.4028 6.85701C11.4578 6.81431 11.5158 6.79291 11.5769 6.79291H14.0133C14.6911 6.79291 15.2346 6.93338 15.6437 7.21427C16.059 7.49525 16.2666 7.9013 16.2666 8.43263C16.2666 8.58526 16.2483 8.74407 16.2116 8.90895C16.059 9.61126 15.7506 10.1303 15.2866 10.4662C14.8286 10.8021 14.1996 10.97 13.3996 10.97H12.1631L11.7418 12.9762C11.7295 13.0433 11.6959 13.0983 11.641 13.141C11.5861 13.1838 11.528 13.2052 11.467 13.2052H10.2212ZM13.4638 9.70591C13.7202 9.70591 13.9431 9.63567 14.1324 9.4952C14.3278 9.35473 14.456 9.15322 14.5171 8.89062C14.5354 8.78678 14.5446 8.69519 14.5446 8.61581C14.5446 8.43871 14.4927 8.30437 14.3889 8.21278C14.285 8.11502 14.108 8.06623 13.8576 8.06623H12.7584L12.4104 9.70591H13.4638Z",fill:"var(--icon-primary)"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_8547_11031",children:jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"white"})})})]}),...wr})},PolygonMonotone=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"PolygonMonotone",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_8547_11032)",children:[jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"var(--surface-tertiary)"}),jsxRuntimeExports.jsx("path",{d:"M12.9228 8.05636C12.7151 7.93768 12.4481 7.93768 12.2107 8.05636L10.549 9.03563L9.42137 9.65875L7.78934 10.638C7.5816 10.7567 7.31455 10.7567 7.07717 10.638L5.80121 9.86649C5.59347 9.7478 5.4451 9.51038 5.4451 9.24332V7.75967C5.4451 7.52225 5.56379 7.28487 5.80121 7.1365L7.07717 6.39465C7.28486 6.27597 7.55192 6.27597 7.78934 6.39465L9.06531 7.16619C9.273 7.28487 9.42137 7.52225 9.42137 7.78931V8.76853L10.549 8.11573V7.10682C10.549 6.86945 10.4303 6.63207 10.1929 6.4837L7.81898 5.08902C7.61129 4.97033 7.34423 4.97033 7.10681 5.08902L4.67359 6.51334C4.4362 6.63207 4.3175 6.86945 4.3175 7.10682V9.89617C4.3175 10.1335 4.4362 10.3709 4.67359 10.5193L7.07717 11.9139C7.28486 12.0326 7.55192 12.0326 7.78934 11.9139L9.42137 10.9644L10.549 10.3116L12.181 9.36201C12.3887 9.24332 12.6558 9.24332 12.8932 9.36201L14.1692 10.1039C14.3769 10.2225 14.5252 10.46 14.5252 10.727V12.2107C14.5252 12.4481 14.4065 12.6855 14.1692 12.8338L12.9228 13.5757C12.7151 13.6944 12.4481 13.6944 12.2107 13.5757L10.9347 12.8338C10.727 12.7152 10.5786 12.4777 10.5786 12.2107V11.2611L9.45105 11.9139V12.8932C9.45105 13.1306 9.56974 13.368 9.80711 13.5163L12.2107 14.911C12.4184 15.0297 12.6855 15.0297 12.9228 14.911L15.3264 13.5163C15.5341 13.3976 15.6825 13.1603 15.6825 12.8932V10.0742C15.6825 9.83681 15.5638 9.59943 15.3264 9.45106L12.9228 8.05636Z",fill:"var(--icon-primary)"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_8547_11032",children:jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"white"})})})]}),...wr})},PushMonotone=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"PushMonotone",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_8547_11034)",children:[jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"var(--surface-tertiary)"}),jsxRuntimeExports.jsx("path",{d:"M10.0018 15.9276C10.7755 15.9276 11.4394 15.4641 11.7345 14.8001C11.8061 14.6384 11.6866 14.4564 11.5099 14.4564H8.49415C8.31742 14.4564 8.19721 14.6381 8.26956 14.8001C8.56462 15.4641 9.22859 15.9276 10.0022 15.9276",fill:"var(--icon-primary)"}),jsxRuntimeExports.jsx("path",{d:"M14.629 12.6307C14.1383 12.6307 13.7408 12.2331 13.7408 11.7425V8.51607C13.7408 6.76759 12.5406 5.29984 10.9195 4.89023C10.8599 4.42937 10.4669 4.07251 9.98945 4.07251C9.51201 4.07251 9.11596 4.43238 9.05906 4.89588C7.60412 5.27346 6.49399 6.50494 6.29427 8.02356C6.29125 8.04579 6.28824 8.06765 6.2856 8.09026C6.28183 8.1204 6.27882 8.15017 6.27656 8.1807C6.27429 8.21122 6.27166 8.24137 6.26977 8.27151C6.26789 8.29714 6.266 8.32163 6.26487 8.34725C6.26261 8.39813 6.26111 8.44975 6.26111 8.50175V11.7421C6.26111 12.2305 5.86732 12.6265 5.3797 12.6303C5.1472 12.6322 4.95502 12.8115 4.95502 13.0448V13.0486C4.95502 13.2792 5.1423 13.4665 5.37292 13.4665H14.6271C14.8577 13.4665 15.045 13.2792 15.045 13.0486C15.0461 12.8183 14.8588 12.631 14.6282 12.631L14.629 12.6307Z",fill:"var(--icon-primary)"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_8547_11034",children:jsxRuntimeExports.jsx("path",{d:"M0 8C0 3.58172 3.58172 0 8 0H12C16.4183 0 20 3.58172 20 8V12C20 16.4183 16.4183 20 12 20H8C3.58172 20 0 16.4183 0 12V8Z",fill:"white"})})})]}),...wr})},SolanaMonotone=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"SolanaMonotone",icon:jsxRuntimeExports.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"inherit",height:"inherit",viewBox:"0 0 21 20",fill:"none",...br,children:[jsxRuntimeExports.jsxs("g",{"clip-path":"url(#clip0_10481_13051)",children:[jsxRuntimeExports.jsx("path",{d:"M0.5 8C0.5 3.58172 4.08172 0 8.5 0H12.5C16.9183 0 20.5 3.58172 20.5 8V12C20.5 16.4183 16.9183 20 12.5 20H8.5C4.08172 20 0.5 16.4183 0.5 12V8Z",fill:"var(--surface-tertiary)"}),jsxRuntimeExports.jsx("path",{d:"M15.7312 12.6567L13.986 14.4801C13.9481 14.5197 13.9022 14.5513 13.8512 14.5729C13.8002 14.5944 13.7451 14.6056 13.6895 14.6055H5.41647C5.377 14.6055 5.33838 14.5943 5.30537 14.5732C5.27236 14.5521 5.24639 14.5221 5.23066 14.4868C5.21492 14.4516 5.21011 14.4126 5.2168 14.3747C5.2235 14.3368 5.24141 14.3016 5.26834 14.2735L7.01485 12.4501C7.05269 12.4106 7.09844 12.3791 7.14928 12.3575C7.20013 12.336 7.25497 12.3248 7.31044 12.3247H15.583C15.6225 12.3247 15.6611 12.3359 15.6942 12.357C15.7271 12.3781 15.7531 12.4081 15.7689 12.4434C15.7846 12.4787 15.7894 12.5176 15.7827 12.5555C15.776 12.5934 15.7581 12.6286 15.7312 12.6567ZM13.986 8.98502C13.9481 8.94542 13.9022 8.91384 13.8512 8.89225C13.8002 8.87068 13.7451 8.85956 13.6895 8.85959H5.41647C5.377 8.85959 5.33838 8.87082 5.30537 8.89191C5.27236 8.913 5.24639 8.94302 5.23066 8.97828C5.21492 9.01356 5.21011 9.05254 5.2168 9.09044C5.2235 9.12833 5.24141 9.1635 5.26834 9.19162L7.01485 11.015C7.05269 11.0545 7.09844 11.086 7.14928 11.1076C7.20013 11.1291 7.25497 11.1403 7.31044 11.1404H15.583C15.6225 11.1404 15.6611 11.1292 15.6942 11.1081C15.7271 11.087 15.7531 11.057 15.7689 11.0217C15.7846 10.9864 15.7894 10.9475 15.7827 10.9096C15.776 10.8717 15.7581 10.8365 15.7312 10.8084L13.986 8.98502ZM5.41647 7.67531H13.6895C13.7451 7.67533 13.8002 7.66421 13.8512 7.64263C13.9022 7.62104 13.9481 7.58947 13.986 7.54986L15.7312 5.72651C15.7581 5.69839 15.776 5.66322 15.7827 5.62532C15.7894 5.58742 15.7846 5.54844 15.7689 5.51318C15.7531 5.47791 15.7271 5.44788 15.6942 5.4268C15.6611 5.40571 15.6225 5.39447 15.583 5.39447H7.31044C7.25497 5.39456 7.20013 5.40574 7.14928 5.42732C7.09844 5.4489 7.05269 5.48041 7.01485 5.51992L5.26879 7.34327C5.24189 7.37135 5.22398 7.40649 5.21727 7.44434C5.21056 7.4822 5.21534 7.52115 5.23102 7.5564C5.2467 7.59165 5.2726 7.62167 5.30554 7.6428C5.33848 7.66392 5.37703 7.67521 5.41647 7.67531Z",fill:"var(--icon-primary)"})]}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsx("clipPath",{id:"clip0_10481_13051",children:jsxRuntimeExports.jsx("path",{d:"M0.5 8C0.5 3.58172 4.08172 0 8.5 0H12.5C16.9183 0 20.5 3.58172 20.5 8V12C20.5 16.4183 16.9183 20 12.5 20H8.5C4.08172 20 0.5 16.4183 0.5 12V8Z",fill:"var(--icon-primary)"})})})]}),...wr})},Settings=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"Settings",icon:jsxRuntimeExports.jsxs("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M26.6931 16.5931C26.7164 16.198 26.7164 15.802 26.6931 15.407H26.689C26.671 15.1342 26.7559 14.8646 26.9268 14.6513L28.8659 12.2271C28.6436 11.5199 28.3587 10.8339 28.0146 10.1773L24.929 9.83433C24.66 9.80448 24.4117 9.67594 24.2321 9.47357C23.969 9.17774 23.6889 8.89758 23.393 8.63454C23.1907 8.45489 23.0621 8.20657 23.0323 7.93762L22.6824 4.85341C22.0258 4.50947 21.3398 4.22457 20.6327 4.00207L18.2044 5.94115C17.9929 6.11047 17.726 6.1952 17.4555 6.17892C17.0605 6.15569 16.6645 6.15569 16.2694 6.17892C15.999 6.1952 15.7321 6.11047 15.5206 5.94115L13.0964 4.00207C12.3892 4.2244 11.7032 4.50931 11.0466 4.85341L10.7036 7.93762C10.6737 8.20725 10.5447 8.45614 10.3415 8.6359C10.0457 8.89894 9.7655 9.1791 9.50246 9.47494C9.32281 9.6773 9.07449 9.80584 8.80554 9.8357L5.72133 10.1855C5.3774 10.8422 5.0925 11.5282 4.87 12.2353L6.80907 14.6636C6.97839 14.8751 7.06313 15.142 7.04685 15.4124C7.02362 15.8075 7.02362 16.2035 7.04685 16.5986C7.06313 16.869 6.97839 17.1359 6.80907 17.3474L4.87 19.7716C5.09233 20.4788 5.37723 21.1647 5.72133 21.8214L8.80691 22.1657C9.07586 22.1956 9.32418 22.3241 9.50383 22.5265C9.76687 22.8223 10.047 23.1025 10.3429 23.3655C10.5452 23.5452 10.6738 23.7935 10.7036 24.0624L11.0534 27.1466C11.7101 27.4906 12.3961 27.7755 13.1032 27.998L15.5329 26.0575C15.7444 25.8882 16.0113 25.8035 16.2817 25.8198C16.6767 25.843 17.0728 25.843 17.4678 25.8198H17.5334C17.7817 25.8196 18.0227 25.9039 18.2167 26.0589L20.6409 27.998C21.3481 27.7756 22.034 27.4907 22.6906 27.1466L23.0336 24.0611C23.0635 23.7921 23.192 23.5438 23.3944 23.3641C23.6902 23.1011 23.9704 22.8209 24.2334 22.5251C24.4131 22.3227 24.6614 22.1942 24.9303 22.1643L28.0187 21.8145C28.3626 21.1578 28.6475 20.4719 28.87 19.7648L26.9309 17.3419C26.7616 17.1304 26.6769 16.8635 26.6931 16.5931Z",stroke:"currentColor","stroke-width":"2","stroke-linejoin":"round"}),jsxRuntimeExports.jsx("path",{d:"M14.4385 19.6359C15.1576 20.1164 16.0031 20.3729 16.8679 20.3729C18.0277 20.3729 19.1399 19.9121 19.96 19.0921C20.7801 18.272 21.2408 17.1598 21.2408 16C21.2408 15.1352 20.9843 14.2897 20.5038 13.5706C20.0233 12.8515 19.3404 12.291 18.5414 11.9601C17.7423 11.6291 16.8631 11.5425 16.0149 11.7112C15.1666 11.8799 14.3874 12.2964 13.7759 12.908C13.1643 13.5195 12.7479 14.2987 12.5791 15.1469C12.4104 15.9952 12.497 16.8744 12.828 17.6734C13.159 18.4725 13.7194 19.1554 14.4385 19.6359Z",stroke:"currentColor","stroke-width":"2","stroke-linejoin":"round"})]}),...wr})},TickCircleFilled=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"TickCircleFilled",icon:jsxRuntimeExports.jsx("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:jsxRuntimeExports.jsx("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M4 16C4 12.8174 5.26428 9.76516 7.51472 7.51472C9.76516 5.26428 12.8174 4 16 4C19.1826 4 22.2348 5.26428 24.4853 7.51472C26.7357 9.76516 28 12.8174 28 16C28 19.1826 26.7357 22.2348 24.4853 24.4853C22.2348 26.7357 19.1826 28 16 28C12.8174 28 9.76516 26.7357 7.51472 24.4853C5.26428 22.2348 4 19.1826 4 16ZM15.3152 21.136L22.224 12.4992L20.976 11.5008L15.0848 18.8624L10.912 15.3856L9.888 16.6144L15.3152 21.1376V21.136Z",fill:"currentColor"})}),...wr})},TwitterSimple=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"TwitterSimple",icon:jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",style:{width:"inherit",height:"inherit"},viewBox:"0 0 22 22",fill:"none",...br,children:jsxRuntimeExports.jsx("path",{d:"M13.0955 9.31648L21.2864 0H19.3456L12.2303 8.08768L6.55141 0H0L8.58949 12.2311L0 22H1.94072L9.45009 13.4571L15.4486 22H22L13.0955 9.31648ZM10.4365 12.3385L9.5649 11.1198L2.64059 1.43161H5.62193L11.2117 9.25316L12.0797 10.4719L19.3447 20.6381H16.3634L10.4365 12.3385Z",fill:"currentColor"})}),...wr})},WarningCircleFilled=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IconWrapper,{componentName:"WarningCircleFilled",icon:jsxRuntimeExports.jsx("svg",{width:"inherit",height:"inherit",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:jsxRuntimeExports.jsx("path",{d:"M16 4C13.6266 4 11.3066 4.70379 9.33316 6.02236C7.35977 7.34094 5.8217 9.21508 4.91345 11.4078C4.0052 13.6005 3.76756 16.0133 4.23058 18.3411C4.6936 20.6689 5.83649 22.807 7.51472 24.4853C9.19295 26.1635 11.3311 27.3064 13.6589 27.7694C15.9867 28.2324 18.3995 27.9948 20.5922 27.0865C22.7849 26.1783 24.6591 24.6402 25.9776 22.6668C27.2962 20.6934 28 18.3734 28 16C27.9966 12.8184 26.7313 9.76814 24.4816 7.51843C22.2319 5.26872 19.1816 4.00336 16 4ZM15.0769 10.4615C15.0769 10.2167 15.1742 9.98193 15.3473 9.80882C15.5204 9.63571 15.7552 9.53846 16 9.53846C16.2448 9.53846 16.4796 9.63571 16.6527 9.80882C16.8258 9.98193 16.9231 10.2167 16.9231 10.4615V16.9231C16.9231 17.1679 16.8258 17.4027 16.6527 17.5758C16.4796 17.7489 16.2448 17.8462 16 17.8462C15.7552 17.8462 15.5204 17.7489 15.3473 17.5758C15.1742 17.4027 15.0769 17.1679 15.0769 16.9231V10.4615ZM16 22.4615C15.7262 22.4615 15.4585 22.3803 15.2308 22.2282C15.0031 22.076 14.8256 21.8598 14.7208 21.6068C14.616 21.3538 14.5886 21.0754 14.642 20.8068C14.6954 20.5382 14.8273 20.2915 15.0209 20.0978C15.2146 19.9042 15.4613 19.7723 15.7299 19.7189C15.9985 19.6655 16.2769 19.6929 16.5299 19.7977C16.7829 19.9025 16.9991 20.08 17.1513 20.3077C17.3034 20.5354 17.3846 20.8031 17.3846 21.0769C17.3846 21.4441 17.2387 21.7963 16.9791 22.056C16.7194 22.3157 16.3672 22.4615 16 22.4615Z",fill:"currentColor"})}),...wr})},StyledIllustrationWrapper=qe$2.span` /* Common Wrapper CSS */ width: ${({width:fr})=>fr?`${fr}px`:"auto"}; height: ${({height:fr})=>fr?`${fr}px`:"auto"}; @@ -156,7 +156,7 @@ Expected: awaiting_signature`)},useAwaitingSignature=()=>{const[fr,br]=reactExpo /* Custom CSS applied via styled component css prop */ ${fr=>fr.css||""} -`,IllustrationWrapper=({componentName:fr,illustration:br,height:wr,width:Er,...kr})=>jsxRuntimeExports.jsx(StyledIllustrationWrapper,{"aria-hidden":"true","aria-label":fr,height:wr,role:"img",width:Er,...kr,children:br}),Ethereum=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IllustrationWrapper,{componentName:"Ethereum",illustration:jsxRuntimeExports.jsxs("svg",{width:(wr==null?void 0:wr.width)??"24",height:(wr==null?void 0:wr.height)??"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24Z",fill:"#627EEA"}),jsxRuntimeExports.jsx("path",{d:"M12.3735 3V9.6525L17.9963 12.165L12.3735 3Z",fill:"white","fill-opacity":"0.602"}),jsxRuntimeExports.jsx("path",{d:"M12.3735 3L6.75 12.165L12.3735 9.6525V3Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M12.3735 16.476V20.9963L18 13.212L12.3735 16.476Z",fill:"white","fill-opacity":"0.602"}),jsxRuntimeExports.jsx("path",{d:"M12.3735 20.9963V16.4753L6.75 13.212L12.3735 20.9963Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M12.3735 15.4298L17.9963 12.1651L12.3735 9.65405V15.4298Z",fill:"white","fill-opacity":"0.2"}),jsxRuntimeExports.jsx("path",{d:"M6.75 12.1651L12.3735 15.4298V9.65405L6.75 12.1651Z",fill:"white","fill-opacity":"0.602"})]}),...wr})},Google=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IllustrationWrapper,{componentName:"Google",illustration:jsxRuntimeExports.jsxs("svg",{width:wr.width||24,height:wr.height||24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M21.14 12.2044C21.14 11.5663 21.0827 10.9526 20.9764 10.3635H12.5V13.849H17.3436C17.1309 14.9699 16.4927 15.919 15.5355 16.5572V18.8235H18.4564C20.1582 17.2526 21.14 14.9453 21.14 12.2044Z",fill:"#4285F4"}),jsxRuntimeExports.jsx("path",{d:"M12.5004 20.9998C14.9304 20.9998 16.9676 20.198 18.4567 18.8235L15.5358 16.5571C14.734 17.0971 13.7113 17.4244 12.5004 17.4244C10.1604 17.4244 8.17218 15.8453 7.46037 13.718H4.46582V16.0417C5.94673 18.9789 8.98218 20.9998 12.5004 20.9998Z",fill:"#34A853"}),jsxRuntimeExports.jsx("path",{d:"M7.46 13.7099C7.28 13.1699 7.17364 12.5972 7.17364 11.9999C7.17364 11.4027 7.28 10.8299 7.46 10.2899V7.96631H4.46545C3.85182 9.17722 3.5 10.5436 3.5 11.9999C3.5 13.4563 3.85182 14.8227 4.46545 16.0336L6.79727 14.2172L7.46 13.7099Z",fill:"#FBBC05"}),jsxRuntimeExports.jsx("path",{d:"M12.5004 6.58364C13.8258 6.58364 15.004 7.04182 15.9449 7.92545L18.5222 5.34818C16.9595 3.89182 14.9304 3 12.5004 3C8.98218 3 5.94673 5.02091 4.46582 7.96636L7.46037 10.29C8.17218 8.16273 10.1604 6.58364 12.5004 6.58364Z",fill:"#EA4335"})]}),...wr})},Solana=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IllustrationWrapper,{componentName:"Solana",illustration:jsxRuntimeExports.jsxs("svg",{width:wr.width||"24",height:wr.height||"24",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M0 12.3452C0 5.7178 5.37258 0.345215 12 0.345215C18.6274 0.345215 24 5.7178 24 12.3452C24 18.9726 18.6274 24.3452 12 24.3452C5.37258 24.3452 0 18.9726 0 12.3452Z",fill:"black"}),jsxRuntimeExports.jsx("path",{d:"M20.2049 16.4444L17.4677 19.2577C17.4082 19.3188 17.3362 19.3675 17.2562 19.4008C17.1762 19.4341 17.0899 19.4513 17.0027 19.4513H4.02724C3.96532 19.4513 3.90476 19.4339 3.85299 19.4014C3.80121 19.3688 3.76049 19.3225 3.73581 19.2681C3.71113 19.2137 3.70358 19.1535 3.71408 19.0951C3.72458 19.0366 3.75267 18.9823 3.79491 18.9389L6.53414 16.1256C6.59348 16.0647 6.66524 16.016 6.74497 15.9828C6.82473 15.9495 6.91075 15.9322 6.99774 15.9321H19.9725C20.0344 15.9321 20.095 15.9494 20.1468 15.9819C20.1985 16.0145 20.2392 16.0608 20.264 16.1152C20.2886 16.1696 20.2962 16.2298 20.2857 16.2883C20.2752 16.3467 20.2471 16.401 20.2049 16.4444ZM17.4677 10.7791C17.4082 10.718 17.3362 10.6693 17.2562 10.636C17.1762 10.6027 17.0899 10.5856 17.0027 10.5856H4.02724C3.96532 10.5856 3.90476 10.6029 3.85299 10.6355C3.80121 10.668 3.76049 10.7143 3.73581 10.7687C3.71113 10.8232 3.70358 10.8833 3.71408 10.9418C3.72458 11.0003 3.75267 11.0545 3.79491 11.0979L6.53414 13.9112C6.59348 13.9722 6.66524 14.0208 6.74497 14.0541C6.82473 14.0874 6.91075 14.1047 6.99774 14.1048H19.9725C20.0344 14.1048 20.095 14.0875 20.1468 14.0549C20.1985 14.0224 20.2392 13.9761 20.264 13.9216C20.2886 13.8672 20.2962 13.8071 20.2857 13.7486C20.2752 13.6901 20.2471 13.6359 20.2049 13.5925L17.4677 10.7791ZM4.02724 8.75833H17.0027C17.0899 8.75836 17.1762 8.74121 17.2562 8.70791C17.3362 8.67461 17.4082 8.62588 17.4677 8.56477L20.2049 5.75145C20.2471 5.70807 20.2752 5.6538 20.2857 5.59533C20.2962 5.53685 20.2886 5.47671 20.264 5.42229C20.2392 5.36787 20.1985 5.32155 20.1468 5.28901C20.095 5.25647 20.0344 5.23914 19.9725 5.23914H6.99774C6.91075 5.23928 6.82473 5.25653 6.74497 5.28982C6.66524 5.32312 6.59348 5.37174 6.53414 5.43269L3.79561 8.24602C3.75342 8.28935 3.72533 8.34356 3.71481 8.40196C3.70429 8.46038 3.71178 8.52047 3.73637 8.57487C3.76096 8.62926 3.80158 8.67558 3.85325 8.70817C3.90492 8.74076 3.96539 8.75819 4.02724 8.75833Z",fill:"url(#paint0_linear_12519_7226)"}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_12519_7226",x1:"5.10909",y1:"19.79",x2:"18.0722",y2:"4.54208",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{offset:"0.08","stop-color":"#9945FF"}),jsxRuntimeExports.jsx("stop",{offset:"0.3","stop-color":"#8752F3"}),jsxRuntimeExports.jsx("stop",{offset:"0.5","stop-color":"#5497D5"}),jsxRuntimeExports.jsx("stop",{offset:"0.6","stop-color":"#43B4CA"}),jsxRuntimeExports.jsx("stop",{offset:"0.72","stop-color":"#28E0B9"}),jsxRuntimeExports.jsx("stop",{offset:"0.97","stop-color":"#19FB9B"})]})})]}),...wr})},PushLogo=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IllustrationWrapper,{componentName:"PushDev",illustration:jsxRuntimeExports.jsxs("svg",{width:wr.width??"48",height:wr.height??"48",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M9.00053 18C10.034 18 10.9206 17.3814 11.314 16.4948C11.4097 16.2787 11.2505 16.0362 11.0138 16.0362H6.98642C6.75053 16.0362 6.5897 16.2787 6.6862 16.4948C7.08044 17.3814 7.96708 18 8.9997 18",fill:"url(#paint0_linear_2966_8287)"}),jsxRuntimeExports.jsx("path",{d:"M15.1797 13.5973C14.5248 13.5973 13.9937 13.067 13.9937 12.4113V8.10264C13.9937 5.76768 12.3911 3.808 10.2261 3.26118C10.1469 2.64589 9.62151 2.16917 8.98395 2.16917C8.3464 2.16917 7.81772 2.65001 7.74101 3.2686C5.79783 3.77254 4.3157 5.41715 4.04847 7.44529C4.04435 7.47498 4.04022 7.50467 4.03692 7.53436C4.03197 7.57478 4.02785 7.61437 4.02455 7.65478C4.02125 7.69519 4.01795 7.73561 4.01548 7.77602C4.013 7.80984 4.01053 7.84283 4.00888 7.87747C4.00558 7.9451 4.00393 8.01438 4.00393 8.08367V12.4113C4.00393 13.0637 3.47772 13.5924 2.82697 13.5973C2.51603 13.5998 2.25952 13.839 2.25952 14.1507V14.1557C2.25952 14.4642 2.50943 14.7141 2.8179 14.7141H15.1764C15.4849 14.7141 15.7348 14.4642 15.7348 14.1557C15.7364 13.8481 15.4865 13.5981 15.1781 13.5981L15.1797 13.5973Z",fill:"url(#paint1_linear_2966_8287)"}),jsxRuntimeExports.jsx("path",{d:"M12.5784 2.41001C13.9682 2.70775 15.0296 3.90451 15.1608 5.31983C15.1756 5.47654 15.3117 5.59448 15.4726 5.57881C15.5484 5.57139 15.6177 5.5351 15.6664 5.47654C15.715 5.41716 15.7381 5.34293 15.7307 5.26705C15.654 4.44062 15.3208 3.67605 14.7665 3.05416C14.2164 2.43888 13.5013 2.02154 12.698 1.84916C12.6774 1.84503 12.6576 1.84256 12.6378 1.84256C12.5058 1.84256 12.3862 1.93494 12.3582 2.06937C12.3252 2.22361 12.4233 2.37619 12.5784 2.40918V2.41001Z",fill:"url(#paint2_linear_2966_8287)"}),jsxRuntimeExports.jsx("path",{d:"M12.8992 0.567448C15.0617 1.03097 16.7146 2.89333 16.9183 5.09549C16.9332 5.2522 17.0692 5.36932 17.2301 5.35447C17.306 5.34705 17.3752 5.31076 17.4239 5.2522C17.4726 5.19281 17.4957 5.11858 17.4882 5.0427C17.3761 3.82533 16.8837 2.69703 16.0671 1.78317C15.2564 0.875091 14.2023 0.261454 13.0196 0.00742221C12.999 0.00329831 12.9792 0.000823975 12.9594 0.000823975C12.8274 0.000823975 12.7078 0.0931994 12.6798 0.227639C12.6459 0.381872 12.7441 0.534457 12.8992 0.567448Z",fill:"url(#paint3_linear_2966_8287)"}),jsxRuntimeExports.jsx("path",{d:"M5.42097 2.41001C5.57521 2.37702 5.67418 2.22361 5.64119 2.06937C5.61232 1.93494 5.49355 1.84256 5.36159 1.84256C5.3418 1.84256 5.322 1.84503 5.30138 1.84916C4.49805 2.02154 3.78296 2.43805 3.23283 3.05416C2.67858 3.6744 2.34454 4.43979 2.26867 5.26705C2.26124 5.34293 2.28516 5.41716 2.333 5.47654C2.38084 5.53592 2.45094 5.57222 2.52682 5.57881C2.68765 5.59366 2.82374 5.47654 2.83859 5.31983C2.96973 3.90533 4.03204 2.7094 5.42097 2.41083V2.41001Z",fill:"url(#paint4_linear_2966_8287)"}),jsxRuntimeExports.jsx("path",{d:"M5.10008 0.567449C5.25431 0.534458 5.35329 0.381048 5.3203 0.226815C5.29143 0.0923754 5.17266 0 5.0407 0C5.02008 0 5.00111 0.00247433 4.98049 0.00659824C3.79693 0.260631 2.74368 0.874267 1.93293 1.78235C1.11557 2.69703 0.624824 3.82451 0.511829 5.04188C0.504406 5.11776 0.528325 5.19199 0.576162 5.25138C0.624824 5.31076 0.694106 5.34705 0.769985 5.35365C0.929993 5.36849 1.06691 5.25138 1.08175 5.09467C1.28547 2.89333 2.93833 1.0318 5.10008 0.567449Z",fill:"url(#paint5_linear_2966_8287)"}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_2966_8287",x1:"11.7075",y1:"11.7746",x2:"8.41081",y2:"17.3781",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{"stop-color":"#FF94A6"}),jsxRuntimeExports.jsx("stop",{offset:"0.17","stop-color":"#EA6AC0"}),jsxRuntimeExports.jsx("stop",{offset:"0.33","stop-color":"#DA4AD5"}),jsxRuntimeExports.jsx("stop",{offset:"0.42","stop-color":"#D53EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.53","stop-color":"#CB3EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.72","stop-color":"#B341E0"}),jsxRuntimeExports.jsx("stop",{offset:"0.95","stop-color":"#8B45E4"}),jsxRuntimeExports.jsx("stop",{offset:"1","stop-color":"#8247E5"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint1_linear_2966_8287",x1:"15.2721",y1:"3.58366",x2:"5.37636",y2:"15.9842",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{"stop-color":"#FF94A6"}),jsxRuntimeExports.jsx("stop",{offset:"0.17","stop-color":"#EA6AC0"}),jsxRuntimeExports.jsx("stop",{offset:"0.33","stop-color":"#DA4AD5"}),jsxRuntimeExports.jsx("stop",{offset:"0.42","stop-color":"#D53EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.53","stop-color":"#CB3EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.72","stop-color":"#B341E0"}),jsxRuntimeExports.jsx("stop",{offset:"0.95","stop-color":"#8B45E4"}),jsxRuntimeExports.jsx("stop",{offset:"1","stop-color":"#8247E5"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint2_linear_2966_8287",x1:"18.8871",y1:"0.496518",x2:"2.00142",y2:"11.7045",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{"stop-color":"#FF94A6"}),jsxRuntimeExports.jsx("stop",{offset:"0.17","stop-color":"#EA6AC0"}),jsxRuntimeExports.jsx("stop",{offset:"0.33","stop-color":"#DA4AD5"}),jsxRuntimeExports.jsx("stop",{offset:"0.42","stop-color":"#D53EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.53","stop-color":"#CB3EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.72","stop-color":"#B341E0"}),jsxRuntimeExports.jsx("stop",{offset:"0.95","stop-color":"#8B45E4"}),jsxRuntimeExports.jsx("stop",{offset:"1","stop-color":"#8247E5"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint3_linear_2966_8287",x1:"18.7287",y1:"0.258155",x2:"1.84297",y2:"11.4661",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{"stop-color":"#FF94A6"}),jsxRuntimeExports.jsx("stop",{offset:"0.17","stop-color":"#EA6AC0"}),jsxRuntimeExports.jsx("stop",{offset:"0.33","stop-color":"#DA4AD5"}),jsxRuntimeExports.jsx("stop",{offset:"0.42","stop-color":"#D53EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.53","stop-color":"#CB3EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.72","stop-color":"#B341E0"}),jsxRuntimeExports.jsx("stop",{offset:"0.95","stop-color":"#8B45E4"}),jsxRuntimeExports.jsx("stop",{offset:"1","stop-color":"#8247E5"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint4_linear_2966_8287",x1:"15.734",y1:"-4.25421",x2:"-1.1517",y2:"6.95455",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{"stop-color":"#FF94A6"}),jsxRuntimeExports.jsx("stop",{offset:"0.17","stop-color":"#EA6AC0"}),jsxRuntimeExports.jsx("stop",{offset:"0.33","stop-color":"#DA4AD5"}),jsxRuntimeExports.jsx("stop",{offset:"0.42","stop-color":"#D53EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.53","stop-color":"#CB3EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.72","stop-color":"#B341E0"}),jsxRuntimeExports.jsx("stop",{offset:"0.95","stop-color":"#8B45E4"}),jsxRuntimeExports.jsx("stop",{offset:"1","stop-color":"#8247E5"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint5_linear_2966_8287",x1:"14.9042",y1:"-5.50293",x2:"-1.97323",y2:"5.70088",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{"stop-color":"#FF94A6"}),jsxRuntimeExports.jsx("stop",{offset:"0.17","stop-color":"#EA6AC0"}),jsxRuntimeExports.jsx("stop",{offset:"0.33","stop-color":"#DA4AD5"}),jsxRuntimeExports.jsx("stop",{offset:"0.42","stop-color":"#D53EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.53","stop-color":"#CB3EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.72","stop-color":"#B341E0"}),jsxRuntimeExports.jsx("stop",{offset:"0.95","stop-color":"#8B45E4"}),jsxRuntimeExports.jsx("stop",{offset:"1","stop-color":"#8247E5"})]})]})]}),...wr})},alertVariants={success:{icon:TickCircleFilled,iconColor:"components-alert-icon-success",borderColor:"components-alert-stroke-success",bgColor:"components-alert-background-success",ctaColor:"components-alert-text-cta-success"},warning:{icon:WarningCircleFilled,iconColor:"components-alert-icon-warning",borderColor:"components-alert-stroke-warning",bgColor:"components-alert-background-warning",ctaColor:"components-alert-text-cta-warning"},info:{icon:InfoFilled,iconColor:"components-alert-icon-info",borderColor:"components-alert-stroke-info",bgColor:"components-alert-background-info",ctaColor:"components-alert-text-cta-info"},error:{icon:WarningCircleFilled,iconColor:"components-alert-icon-error",borderColor:"components-alert-stroke-error",bgColor:"components-alert-background-error",ctaColor:"components-alert-text-cta-error"}},deviceSizes={mobileS:"320px",mobileM:"375px",mobileL:"425px",tablet:"768px",laptop:"1024px",laptopL:"1440px",desktop:"2560px",ultrawide:"3440px"},deviceMediaQ={mobileS:`(max-width: ${deviceSizes.mobileS})`,mobileM:`(max-width: ${deviceSizes.mobileM})`,mobileL:`(max-width: ${deviceSizes.mobileL})`,tablet:`(max-width: ${deviceSizes.tablet})`,laptop:`(max-width: ${deviceSizes.laptop})`,laptopL:`(max-width: ${deviceSizes.laptopL})`,desktop:`(max-width: ${deviceSizes.desktop})`,ultrawide:`(max-width: ${deviceSizes.ultrawide})`},breakpointMap={initial:"",ms:"mobileS",mm:"mobileM",ml:"mobileL",tb:"tablet",lp:"laptop",ll:"laptopL",dp:"desktop",uw:"ultrawide"},colorPrimitives={"gray-100":"#F5F6F8","gray-200":"#EAEBF2","gray-300":"#C4CBD5","gray-400":"#B0B3B9","gray-500":"#8C93A0","gray-600":"#757D8D","gray-700":"#484D58","gray-800":"#313338","gray-900":"#202124","gray-1000":"#17181B","pink-100":"#FCEBFF","pink-200":"#FBE8FF","pink-300":"#F3AEFF","pink-400":"#CF59E2","pink-500":"#D548EC","pink-600":"#C742DD","pink-700":"#AA30BE","pink-800":"#7B0090","pink-900":"#570066","pink-1000":"#35003F","blue-100":"#E8F2FF","blue-200":"#D1E4FF","blue-300":"#A2C9FF","blue-400":"#73ADFF","blue-500":"#4090FF","blue-600":"#076EFF","blue-700":"#0056D0","blue-800":"#00419D","blue-900":"#002D6D","blue-1000":"#001A40","green-100":"#D8F7F0","green-200":"#AFEFE1","green-300":"#51DCBD","green-400":"#00C296","green-500":"#00A47F","green-600":"#008769","green-700":"#006B53","green-800":"#00513F","green-900":"#00382B","green-1000":"#002019","red-100":"#FFECEC","red-200":"#FFD9D9","red-300":"#FFB1B1","red-400":"#FF8585","red-500":"#FF4E4E","red-600":"#F11F1F","red-700":"#D43B3B","red-800":"#A40A0A","red-900":"#670000","red-1000":"#400000","yellow-100":"#FFF0CB","yellow-200":"#FFDF93","yellow-300":"#FFBB16","yellow-400":"#E99B00","yellow-500":"#C77100","yellow-600":"#A85A00","yellow-700":"#8A4900","yellow-800":"#663600","yellow-900":"#472600","yellow-1000":"#291500","white-10":"rgba(255,255,255,0.1)","white-20":"rgba(255,255,255,0.2)","white-30":"rgba(255,255,255,0.3)","white-40":"rgba(255,255,255,0.4)","white-50":"rgba(255,255,255,0.5)","white-60":"rgba(255,255,255,0.6)","white-70":"rgba(255,255,255,0.7)","white-80":"rgba(255,255,255,0.8)","white-90":"rgba(255,255,255,0.9)","white-100":"rgba(255,255,255,1)","black-10":"rgba(0,0,0,0.1)","black-20":"rgba(0,0,0,0.2)","black-30":"rgba(0,0,0,0.3)","black-40":"rgba(0,0,0,0.4)","black-50":"rgba(0,0,0,0.5)","black-60":"rgba(0,0,0,0.6)","black-70":"rgba(0,0,0,0.7)","black-80":"rgba(0,0,0,0.8)","black-90":"rgba(0,0,0,0.9)","black-100":"rgba(0,0,0,1)",transparent:"transparent"},colorBrands={"primary-100":colorPrimitives["pink-100"],"primary-200":colorPrimitives["pink-200"],"primary-300":colorPrimitives["pink-300"],"primary-400":colorPrimitives["pink-400"],"primary-500":colorPrimitives["pink-500"],"primary-600":colorPrimitives["pink-600"],"primary-700":colorPrimitives["pink-700"],"primary-800":colorPrimitives["pink-800"],"primary-900":colorPrimitives["pink-900"],"primary-1000":colorPrimitives["pink-1000"],"neutral-100":colorPrimitives["gray-100"],"neutral-200":colorPrimitives["gray-200"],"neutral-300":colorPrimitives["gray-300"],"neutral-400":colorPrimitives["gray-400"],"neutral-500":colorPrimitives["gray-500"],"neutral-600":colorPrimitives["gray-600"],"neutral-700":colorPrimitives["gray-700"],"neutral-800":colorPrimitives["gray-800"],"neutral-900":colorPrimitives["gray-900"],"neutral-1000":colorPrimitives["gray-1000"],"info-100":colorPrimitives["blue-100"],"info-200":colorPrimitives["blue-200"],"info-300":colorPrimitives["blue-300"],"info-400":colorPrimitives["blue-400"],"info-500":colorPrimitives["blue-500"],"info-600":colorPrimitives["blue-600"],"info-700":colorPrimitives["blue-700"],"info-800":colorPrimitives["blue-800"],"info-900":colorPrimitives["blue-900"],"info-1000":colorPrimitives["blue-1000"],"success-100":colorPrimitives["green-100"],"success-200":colorPrimitives["green-200"],"success-300":colorPrimitives["green-300"],"success-400":colorPrimitives["green-400"],"success-500":colorPrimitives["green-500"],"success-600":colorPrimitives["green-600"],"success-700":colorPrimitives["green-700"],"success-800":colorPrimitives["green-800"],"success-900":colorPrimitives["green-900"],"success-1000":colorPrimitives["green-1000"],"warning-100":colorPrimitives["yellow-100"],"warning-200":colorPrimitives["yellow-200"],"warning-300":colorPrimitives["yellow-300"],"warning-400":colorPrimitives["yellow-400"],"warning-500":colorPrimitives["yellow-500"],"warning-600":colorPrimitives["yellow-600"],"warning-700":colorPrimitives["yellow-700"],"warning-800":colorPrimitives["yellow-800"],"warning-900":colorPrimitives["yellow-900"],"warning-1000":colorPrimitives["yellow-1000"],"danger-100":colorPrimitives["red-100"],"danger-200":colorPrimitives["red-200"],"danger-300":colorPrimitives["red-300"],"danger-400":colorPrimitives["red-400"],"danger-500":colorPrimitives["red-500"],"danger-600":colorPrimitives["red-600"],"danger-700":colorPrimitives["red-700"],"danger-800":colorPrimitives["red-800"],"danger-900":colorPrimitives["red-900"],"danger-1000":colorPrimitives["red-1000"]},textSemantics={primary:{light:colorBrands["neutral-1000"],dark:colorBrands["neutral-100"]},secondary:{light:colorBrands["neutral-800"],dark:colorBrands["neutral-300"]},tertiary:{light:colorBrands["neutral-500"],dark:colorBrands["neutral-600"]},"primary-inverse":{light:colorPrimitives["white-100"],dark:colorPrimitives["black-100"]},"secondary-inverse":{light:colorBrands["neutral-400"],dark:colorBrands["neutral-700"]},"tertiary-inverse":{light:colorBrands["neutral-600"],dark:colorBrands["neutral-500"]},"brand-subtle":{light:colorBrands["primary-200"],dark:colorBrands["primary-200"]},"brand-medium":{light:colorBrands["primary-600"],dark:colorBrands["primary-400"]},"brand-bold":{light:colorBrands["primary-700"],dark:colorBrands["primary-800"]},"on-light-bg":{light:colorPrimitives["black-100"],dark:colorPrimitives["black-100"]},"on-dark-bg":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"state-success-subtle":{light:colorBrands["success-100"],dark:colorBrands["success-700"]},"state-success-bold":{light:colorBrands["success-500"],dark:colorBrands["success-300"]},"state-info-subtle":{light:colorBrands["info-100"],dark:colorBrands["info-700"]},"state-info-bold":{light:colorBrands["info-700"],dark:colorBrands["info-100"]},"state-warning-subtle":{light:colorBrands["warning-100"],dark:colorBrands["warning-700"]},"state-warning-bold":{light:colorBrands["warning-700"],dark:colorBrands["warning-100"]},"state-danger-subtle":{light:colorBrands["danger-100"],dark:colorBrands["danger-700"]},"state-danger-bold":{light:colorBrands["danger-700"],dark:colorBrands["danger-300"]},"state-disabled":{light:colorBrands["neutral-400"],dark:colorBrands["neutral-700"]}},alertSemantics={"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-body":{light:textSemantics.tertiary.light,dark:textSemantics.tertiary.dark},"icon-success":{light:colorBrands["success-500"],dark:colorBrands["success-300"]},"icon-warning":{light:colorBrands["warning-700"],dark:colorBrands["warning-100"]},"icon-error":{light:colorBrands["danger-600"],dark:colorBrands["danger-500"]},"icon-info":{light:colorPrimitives["blue-700"],dark:colorPrimitives["blue-100"]},"text-cta-success":{light:colorBrands["success-500"],dark:colorBrands["success-300"]},"text-cta-warning":{light:colorBrands["warning-700"],dark:colorBrands["warning-100"]},"text-cta-error":{light:colorBrands["danger-600"],dark:colorBrands["danger-500"]},"text-cta-info":{light:colorPrimitives["blue-700"],dark:colorPrimitives["blue-100"]},"background-success":{light:colorBrands["success-100"],dark:colorBrands["success-900"]},"background-warning":{light:colorBrands["warning-100"],dark:colorBrands["warning-900"]},"background-error":{light:colorBrands["danger-100"],dark:colorBrands["danger-900"]},"background-info":{light:colorPrimitives["blue-100"],dark:colorPrimitives["blue-900"]},"stroke-success":{light:colorBrands["success-300"],dark:colorBrands["success-700"]},"stroke-warning":{light:colorBrands["warning-300"],dark:colorBrands["warning-700"]},"stroke-error":{light:colorBrands["danger-300"],dark:colorBrands["danger-700"]},"stroke-info":{light:colorPrimitives["blue-300"],dark:colorPrimitives["blue-700"]}},iconSemantics={primary:{light:colorBrands["neutral-900"],dark:colorBrands["neutral-400"]},secondary:{light:colorBrands["neutral-200"],dark:colorBrands["neutral-100"]},tertiary:{light:colorBrands["neutral-300"],dark:colorBrands["neutral-700"]},"hero-icons":{light:colorBrands["neutral-1000"],dark:colorBrands["neutral-100"]},"brand-subtle":{light:colorBrands["primary-300"],dark:colorBrands["primary-400"]},"brand-medium":{light:colorBrands["primary-500"],dark:colorBrands["primary-400"]},"brand-bold":{light:colorBrands["primary-800"],dark:colorBrands["primary-300"]},"state-success-subtle":{light:colorBrands["success-200"],dark:colorBrands["success-600"]},"state-success-bold":{light:colorBrands["success-600"],dark:colorBrands["success-300"]},"state-info-subtle":{light:colorBrands["info-200"],dark:colorBrands["info-600"]},"state-info-bold":{light:colorBrands["info-600"],dark:colorBrands["info-200"]},"state-warning-subtle":{light:colorBrands["warning-200"],dark:colorBrands["warning-600"]},"state-warning-bold":{light:colorBrands["warning-600"],dark:colorBrands["warning-200"]},"state-danger-subtle":{light:colorBrands["danger-200"],dark:colorBrands["danger-600"]},"state-danger-bold":{light:colorBrands["danger-600"],dark:colorBrands["danger-300"]},"state-disabled":{light:colorBrands["neutral-400"],dark:colorBrands["neutral-700"]}},strokeSemantics={primary:{light:colorBrands["neutral-100"],dark:colorBrands["neutral-900"]},secondary:{light:colorBrands["neutral-200"],dark:colorBrands["neutral-800"]},tertiary:{light:colorBrands["neutral-300"],dark:colorBrands["neutral-700"]},"brand-subtle":{light:colorBrands["primary-300"],dark:colorBrands["primary-500"]},"brand-medium":{light:colorBrands["primary-500"],dark:colorBrands["primary-400"]},"brand-bold":{light:colorBrands["primary-800"],dark:colorBrands["primary-300"]},"state-success-subtle":{light:colorBrands["success-300"],dark:colorBrands["success-500"]},"state-success-bold":{light:colorBrands["success-700"],dark:colorBrands["success-300"]},"state-info-subtle":{light:colorBrands["info-300"],dark:colorBrands["info-500"]},"state-info-bold":{light:colorBrands["info-700"],dark:colorBrands["info-300"]},"state-warning-subtle":{light:colorBrands["warning-300"],dark:colorBrands["warning-500"]},"state-warning-bold":{light:colorBrands["warning-700"],dark:colorBrands["warning-300"]},"state-danger-subtle":{light:colorBrands["danger-300"],dark:colorBrands["danger-500"]},"state-danger-bold":{light:colorBrands["danger-500"],dark:colorBrands["danger-300"]},"state-hover":{light:colorBrands["success-300"],dark:colorBrands["success-800"]},"state-focus":{light:colorBrands["success-300"],dark:colorBrands["success-300"]},"state-pressed":{light:colorBrands["info-800"],dark:colorBrands["info-300"]},"state-disabled":{light:colorBrands["info-300"],dark:colorBrands["info-800"]}},surfaceSemantics={primary:{light:colorPrimitives["white-100"],dark:colorBrands["neutral-900"]},secondary:{light:colorBrands["neutral-100"],dark:colorBrands["neutral-1000"]},tertiary:{light:colorBrands["neutral-200"],dark:colorBrands["neutral-800"]},"primary-inverse":{light:colorPrimitives["black-100"],dark:colorPrimitives["white-100"]},"brand-subtle":{light:colorBrands["primary-200"],dark:colorBrands["primary-300"]},"brand-medium":{light:colorBrands["primary-600"],dark:colorBrands["primary-500"]},"brand-bold":{light:colorBrands["primary-700"],dark:colorBrands["primary-200"]},"glass-subtle":{light:colorPrimitives["white-80"],dark:colorPrimitives["black-80"]},"glass-bold":{light:colorPrimitives["white-50"],dark:colorPrimitives["black-50"]},transparent:{light:colorPrimitives.transparent,dark:colorPrimitives.transparent},"state-success-subtle":{light:colorBrands["success-100"],dark:colorBrands["success-900"]},"state-success-bold":{light:colorBrands["success-500"],dark:colorBrands["success-200"]},"state-info-subtle":{light:colorBrands["info-100"],dark:colorBrands["info-900"]},"state-info-bold":{light:colorBrands["info-500"],dark:colorBrands["info-200"]},"state-warning-subtle":{light:colorBrands["warning-100"],dark:colorBrands["warning-900"]},"state-warning-bold":{light:colorBrands["warning-500"],dark:colorBrands["warning-200"]},"state-danger-subtle":{light:colorBrands["danger-100"],dark:colorBrands["danger-900"]},"state-danger-bold":{light:colorBrands["danger-500"],dark:colorBrands["danger-200"]},"state-disabled":{light:colorBrands["neutral-200"],dark:colorBrands["neutral-800"]}},primaryButtonSemantics={"background-default":{light:colorBrands["primary-500"],dark:colorBrands["primary-500"]},"background-hover":{light:colorBrands["primary-400"],dark:colorBrands["primary-400"]},"background-pressed":{light:colorBrands["primary-800"],dark:colorBrands["primary-600"]},"background-focus":{light:colorBrands["primary-500"],dark:colorBrands["primary-400"]},"background-loading":{light:colorBrands["primary-400"],dark:colorBrands["primary-400"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["primary-700"],dark:colorBrands["primary-200"]}},secondaryButtonSemantics={"background-default":{light:colorBrands["neutral-100"],dark:colorBrands["neutral-800"]},"background-hover":{light:colorBrands["neutral-200"],dark:colorBrands["neutral-700"]},"background-pressed":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-1000"]},"background-focus":{light:colorBrands["neutral-100"],dark:colorBrands["neutral-800"]},"background-loading":{light:colorBrands["neutral-100"],dark:colorBrands["neutral-800"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:colorBrands["neutral-1000"],dark:colorPrimitives["white-100"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorBrands["neutral-800"],dark:colorPrimitives["white-60"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["primary-300"],dark:colorBrands["primary-400"]}},tertiaryButtonSemantics={"background-default":{light:colorBrands["neutral-1000"],dark:colorBrands["neutral-700"]},"background-inverse":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-hover":{light:colorBrands["neutral-900"],dark:colorBrands["neutral-300"]},"background-pressed":{light:colorBrands["neutral-100"],dark:colorPrimitives["gray-1000"]},"background-focus":{light:colorBrands["neutral-1000"],dark:colorBrands["neutral-700"]},"background-loading":{light:colorBrands["neutral-900"],dark:colorBrands["neutral-700"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["gray-200"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorBrands["neutral-300"],dark:colorPrimitives["white-50"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["primary-400"],dark:colorBrands["primary-400"]}},outlineButtonSemantics={"background-default":{light:colorPrimitives.transparent,dark:colorPrimitives.transparent},"background-hover":{light:colorPrimitives.transparent,dark:colorPrimitives.transparent},"background-pressed":{light:colorPrimitives.transparent,dark:colorPrimitives.transparent},"background-focus":{light:colorPrimitives.transparent,dark:colorPrimitives.transparent},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.secondary.dark},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-default":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"stroke-focus":{light:colorBrands["primary-300"],dark:colorBrands["primary-400"]},"stroke-loading":{light:colorBrands["neutral-200"],dark:colorBrands["primary-400"]},"stroke-hover":{light:strokeSemantics["brand-subtle"].light,dark:strokeSemantics.secondary.dark},"stroke-pressed":{light:colorBrands["neutral-600"],dark:colorBrands["neutral-300"]}},dangerButtonSemantics={"background-default":{light:colorBrands["danger-600"],dark:colorBrands["danger-500"]},"background-hover":{light:colorBrands["danger-500"],dark:colorBrands["danger-400"]},"background-pressed":{light:colorBrands["danger-800"],dark:colorBrands["danger-700"]},"background-focus":{light:colorBrands["danger-500"],dark:colorBrands["danger-400"]},"background-loading":{light:colorBrands["danger-500"],dark:colorBrands["danger-400"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorPrimitives["white-70"],dark:colorPrimitives["white-70"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["danger-800"],dark:colorBrands["danger-600"]}},dangerSecondaryButtonSemantics={"background-default":{light:colorBrands["danger-200"],dark:colorBrands["danger-800"]},"background-hover":{light:colorBrands["danger-100"],dark:colorBrands["danger-700"]},"background-pressed":{light:colorBrands["danger-500"],dark:colorBrands["danger-1000"]},"background-focus":{light:colorBrands["danger-100"],dark:colorBrands["danger-700"]},"background-loading":{light:colorBrands["danger-100"],dark:colorBrands["danger-700"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:colorBrands["danger-700"],dark:colorPrimitives["white-100"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorBrands["danger-400"],dark:colorPrimitives["white-70"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["danger-800"],dark:colorBrands["danger-400"]}},checkboxSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"background-selected":{light:surfaceSemantics["brand-medium"].light,dark:surfaceSemantics["brand-medium"].dark},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-secondary":{light:textSemantics.secondary.light,dark:textSemantics.secondary.dark},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"stroke-default":{light:textSemantics["brand-medium"].light,dark:textSemantics["brand-medium"].dark},"stroke-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]}},inputSemantics={"background-default":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-hover":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-pressed":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-focus":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"background-success":{light:colorBrands["success-100"],dark:colorBrands["success-200"]},"background-danger":{light:colorBrands["danger-100"],dark:colorBrands["danger-200"]},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-placeholder":{light:colorBrands["neutral-400"],dark:colorBrands["neutral-600"]},"text-secondary":{light:colorBrands["neutral-600"],dark:colorBrands["neutral-500"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"text-success":{light:textSemantics["state-success-bold"].light,dark:textSemantics["state-success-subtle"].dark},"text-danger":{light:textSemantics["state-danger-bold"].light,dark:textSemantics["state-danger-subtle"].dark},"icon-default":{light:iconSemantics.tertiary.light,dark:iconSemantics.secondary.dark},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"icon-success":{light:iconSemantics["state-success-bold"].light,dark:iconSemantics["state-success-subtle"].dark},"icon-danger":{light:iconSemantics["state-danger-bold"].light,dark:iconSemantics["state-danger-subtle"].dark},"stroke-default":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"stroke-hover":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"stroke-focus":{light:colorBrands["primary-300"],dark:colorBrands["primary-300"]},"stroke-pressed":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"stroke-disabled":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-900"]},"stroke-success":{light:colorBrands["success-500"],dark:colorBrands["success-400"]},"stroke-danger":{light:colorBrands["danger-400"],dark:colorBrands["danger-400"]}},listItemSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"background-hover":{light:surfaceSemantics.secondary.light,dark:surfaceSemantics.secondary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-success":{light:textSemantics["state-success-bold"].light,dark:textSemantics["state-success-subtle"].dark},"text-error":{light:textSemantics["state-danger-bold"].light,dark:textSemantics["state-danger-bold"].dark},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark},"icon-success":{light:iconSemantics["state-success-bold"].light,dark:iconSemantics["state-success-bold"].dark},"icon-error":{light:iconSemantics["state-danger-bold"].light,dark:iconSemantics["state-danger-bold"].dark},"stroke-default":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark}},modalSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"stroke-bg":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-secondary":{light:textSemantics.tertiary.light,dark:textSemantics.tertiary.dark},"text-link":{light:colorPrimitives["pink-700"],dark:colorPrimitives["pink-400"]},"icon-success":{light:colorPrimitives["green-400"],dark:colorPrimitives["green-300"]},"icon-error":{light:colorPrimitives["red-700"],dark:colorPrimitives["red-600"]},"icon-warning":{light:colorPrimitives["yellow-400"],dark:colorPrimitives["yellow-300"]},"icon-info":{light:colorPrimitives["blue-600"],dark:colorPrimitives["blue-500"]},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark},"icon-secondary":{light:iconSemantics.secondary.light,dark:iconSemantics.secondary.dark}},notificationsSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"stroke-bg":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-secondary":{light:textSemantics.tertiary.light,dark:textSemantics.tertiary.dark},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark}},paginationSemantics={"background-default":{light:surfaceSemantics.tertiary.light,dark:surfaceSemantics.tertiary.dark},"background-hover":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-300"]},"text-selected":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-default":{light:textSemantics.tertiary.light,dark:textSemantics.tertiary.dark},"text-disabled":{light:textSemantics["secondary-inverse"].light,dark:textSemantics["secondary-inverse"].dark}},progressBarSemantics={"background-default":{light:surfaceSemantics.secondary.light,dark:surfaceSemantics.secondary.dark},"background-progress":{light:surfaceSemantics["brand-medium"].light,dark:surfaceSemantics["brand-medium"].dark}},radioSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"background-selected":{light:surfaceSemantics["brand-medium"].light,dark:surfaceSemantics["brand-medium"].dark},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-secondary":{light:textSemantics.secondary.light,dark:textSemantics.secondary.dark},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"stroke-default":{light:strokeSemantics["brand-medium"].light,dark:strokeSemantics["brand-medium"].dark},"stroke-disabled":{light:strokeSemantics["state-disabled"].light,dark:strokeSemantics["state-disabled"].dark}},skeletonSemantics={"gradient-light":{light:colorBrands["neutral-200"],dark:colorBrands["neutral-800"]},"gradient-dark":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-700"]}},switchSemantics={"background-selected":{light:colorBrands["primary-600"],dark:colorBrands["primary-600"]},"background-unselected":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-800"]},"background-hover":{light:colorBrands["primary-500"],dark:colorBrands["primary-500"]},"background-focus":{light:colorBrands["primary-500"],dark:colorBrands["primary-600"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"icon-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["primary-300"],dark:colorBrands["primary-500"]},"stroke-default":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark}},tagSemantics={"background-default":{light:surfaceSemantics.tertiary.light,dark:surfaceSemantics.tertiary.dark},"background-success":{light:surfaceSemantics["state-success-subtle"].light,dark:surfaceSemantics["state-success-subtle"].dark},"background-danger":{light:surfaceSemantics["state-danger-subtle"].light,dark:surfaceSemantics["state-danger-subtle"].dark},"background-warning":{light:surfaceSemantics["state-warning-subtle"].light,dark:surfaceSemantics["state-warning-subtle"].dark},"background-info":{light:surfaceSemantics["state-info-subtle"].light,dark:surfaceSemantics["state-info-subtle"].dark},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"stroke-bg":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-success":{light:textSemantics["state-success-bold"].light,dark:textSemantics["state-success-bold"].dark},"text-warning":{light:textSemantics["state-warning-bold"].light,dark:textSemantics["state-warning-bold"].dark},"text-danger":{light:textSemantics["state-danger-bold"].light,dark:textSemantics["state-danger-bold"].dark},"text-info":{light:textSemantics["state-info-bold"].light,dark:textSemantics["state-info-bold"].dark},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark},"icon-success":{light:iconSemantics["state-success-bold"].light,dark:iconSemantics["state-success-bold"].dark},"icon-warning":{light:iconSemantics["state-warning-bold"].light,dark:iconSemantics["state-warning-bold"].dark},"icon-danger":{light:iconSemantics["state-danger-bold"].light,dark:iconSemantics["state-danger-bold"].dark},"icon-info":{light:iconSemantics["state-info-bold"].light,dark:iconSemantics["state-info-bold"].dark},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark}},textAreaSemantics={"background-default":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-hover":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-pressed":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-focus":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"background-success":{light:colorBrands["success-100"],dark:colorBrands["success-200"]},"background-danger":{light:colorBrands["danger-100"],dark:colorBrands["danger-200"]},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-placeholder":{light:colorBrands["neutral-400"],dark:colorBrands["neutral-600"]},"text-secondary":{light:colorBrands["neutral-600"],dark:colorBrands["neutral-500"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"text-success":{light:textSemantics["state-success-bold"].light,dark:textSemantics["state-success-subtle"].dark},"text-danger":{light:textSemantics["state-danger-bold"].light,dark:textSemantics["state-danger-subtle"].dark},"icon-default":{light:iconSemantics.tertiary.light,dark:iconSemantics.secondary.dark},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"icon-success":{light:iconSemantics["state-success-bold"].light,dark:iconSemantics["state-success-subtle"].dark},"icon-danger":{light:iconSemantics["state-danger-bold"].light,dark:iconSemantics["state-danger-subtle"].dark},"stroke-default":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"stroke-hover":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"stroke-focus":{light:colorBrands["primary-300"],dark:colorBrands["primary-300"]},"stroke-pressed":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"stroke-disabled":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-900"]},"stroke-success":{light:colorBrands["success-500"],dark:colorBrands["success-400"]},"stroke-danger":{light:colorBrands["danger-400"],dark:colorBrands["danger-400"]}},toastSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"background-success":{light:colorPrimitives["white-100"],dark:surfaceSemantics["state-success-bold"].dark},"background-warning":{light:surfaceSemantics["state-danger-bold"].light,dark:surfaceSemantics["state-danger-bold"].dark},"background-error":{light:surfaceSemantics["state-warning-bold"].light,dark:surfaceSemantics["state-warning-bold"].dark},"background-info":{light:surfaceSemantics["state-info-bold"].light,dark:surfaceSemantics["state-info-bold"].dark},"stroke-bg":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-secondary":{light:textSemantics.secondary.light,dark:textSemantics.secondary.dark},"text-link":{light:colorPrimitives["pink-700"],dark:colorPrimitives["pink-400"]},"icon-success":{light:colorPrimitives["green-400"],dark:colorBrands["success-300"]},"icon-warning":{light:colorPrimitives["red-700"],dark:colorBrands["danger-600"]},"icon-error":{light:colorPrimitives["yellow-400"],dark:colorBrands["warning-300"]},"icon-info":{light:colorPrimitives["blue-600"],dark:colorBrands["info-500"]},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark}},tooltipSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-primary":{light:textSemantics.secondary.light,dark:textSemantics.secondary.dark}},sliderSemantics={"stroke-default":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"icon-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"background-default":{light:surfaceSemantics.secondary.light,dark:surfaceSemantics.secondary.dark},"background-progress":{light:surfaceSemantics["brand-medium"].light,dark:surfaceSemantics["brand-medium"].dark}},spinnerSemantics={"icon-primary":{light:colorBrands["primary-500"],dark:colorBrands["primary-500"]},"icon-secondary":{light:colorBrands["neutral-1000"],dark:colorBrands["neutral-100"]}},tableSemantics={"stroke-default":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-heading":{light:textSemantics.tertiary.light,dark:textSemantics.tertiary.dark},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark}},pillSemantics={"background-default":{light:colorBrands["neutral-100"],dark:colorBrands["neutral-700"]},"background-selected":{light:surfaceSemantics["primary-inverse"].light,dark:surfaceSemantics["primary-inverse"].dark},"background-hover":{light:colorBrands["neutral-200"],dark:colorBrands["neutral-800"]},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-selected":{light:textSemantics["primary-inverse"].light,dark:textSemantics["primary-inverse"].dark}},semanticKeys={alert:"components-alert",buttonPrimary:"components-button-primary",buttonSecondary:"components-button-secondary",buttonTertiary:"components-button-tertiary",buttonOutline:"components-button-outline",buttonDanger:"components-button-danger",buttonDangerSecondary:"components-button-danger-secondary",checkbox:"components-checkbox",icon:"icon",input:"components-inputs",listItem:"components-list-item",modal:"components-modal",notifications:"components-in-app-notification",pagination:"components-pagination",pill:"components-pill",progressBar:"components-progress-bar",radio:"components-radio-button",surface:"surface",stroke:"stroke",skeleton:"components-skeleton-loader",table:"components-table",tag:"components-tag",text:"text",textArea:"components-textarea",toast:"components-toast",toggle:"components-toggle-switch",tooltip:"components-tooltip",slider:"components-slider",spinner:"components-spinner"},colorSemantics={[semanticKeys.alert]:alertSemantics,[semanticKeys.buttonPrimary]:primaryButtonSemantics,[semanticKeys.buttonSecondary]:secondaryButtonSemantics,[semanticKeys.buttonTertiary]:tertiaryButtonSemantics,[semanticKeys.buttonOutline]:outlineButtonSemantics,[semanticKeys.buttonDanger]:dangerButtonSemantics,[semanticKeys.buttonDangerSecondary]:dangerSecondaryButtonSemantics,[semanticKeys.checkbox]:checkboxSemantics,[semanticKeys.icon]:iconSemantics,[semanticKeys.input]:inputSemantics,[semanticKeys.listItem]:listItemSemantics,[semanticKeys.modal]:modalSemantics,[semanticKeys.notifications]:notificationsSemantics,[semanticKeys.pagination]:paginationSemantics,[semanticKeys.pill]:pillSemantics,[semanticKeys.progressBar]:progressBarSemantics,[semanticKeys.radio]:radioSemantics,[semanticKeys.surface]:surfaceSemantics,[semanticKeys.stroke]:strokeSemantics,[semanticKeys.skeleton]:skeletonSemantics,[semanticKeys.table]:tableSemantics,[semanticKeys.tag]:tagSemantics,[semanticKeys.text]:textSemantics,[semanticKeys.textArea]:textAreaSemantics,[semanticKeys.toast]:toastSemantics,[semanticKeys.toggle]:switchSemantics,[semanticKeys.tooltip]:tooltipSemantics,[semanticKeys.slider]:sliderSemantics,[semanticKeys.spinner]:spinnerSemantics},blurVariables={"blur-xs":"8px","blur-sm":"16px","blur-md":"24px","blur-lg":"40px","blur-xl":"72px","blur-xxl":"128px"},borderRadiusVariables={"radius-none":"0px","radius-xxxs":"4px","radius-xxs":"8px","radius-xs":"12px","radius-sm":"16px","radius-md":"24px","radius-lg":"32px","radius-xl":"40px","radius-xxl":"48px","radius-xxxl":"64px","radius-round":"1000px"},borderSizeVariables={"border-none":"0px","border-xs":"0.5px","border-sm":"1px","border-xmd":"1.5px","border-md":"2px","border-lg":"3px","border-xl":"4px"},opacityVariables={"opacity-0":"0","opacity-10":"0.1","opacity-20":"0.2","opacity-30":"0.3","opacity-40":"0.4","opacity-50":"0.5","opacity-60":"0.6","opacity-70":"0.7","opacity-80":"0.8","opacity-90":"0.9","opacity-100":"1"},spacingVariables={"spacing-none":"0px","spacing-xxxs":"4px","spacing-xxs":"8px","spacing-xs":"12px","spacing-sm":"16px","spacing-md":"24px","spacing-lg":"32px","spacing-xl":"40px","spacing-xxl":"48px","spacing-xxxl":"64px"},getThemeColors=fr=>Object.entries(colorSemantics).reduce((br,[wr,Er])=>(Object.entries(Er).forEach(([kr,jr])=>{br[`${wr}-${kr}`]=jr[fr]}),br),{}),createTheme=fr=>({colors:getThemeColors(fr),blur:blurVariables,borderRadius:borderRadiusVariables,borderSize:borderSizeVariables,opacity:opacityVariables,spacing:spacingVariables}),getBlocksCSSVariables=fr=>Object.values(fr).map(br=>Object.entries(br).map(([wr,Er])=>`--${wr}: ${Er};`).join("")).join(""),blocksTheme={light:createTheme("light"),dark:createTheme("dark")},radiusRegex=/\bradius-[a-z]+\b/g,spacingRegex=/\bspacing-[a-z]+\b/g,textVariants={"dl-bold":{fontSize:"72px",fontStyle:null,fontWeight:"700",lineHeight:"92.16px",letterSpacing:"-1.5px",textTransform:null},"dl-semibold":{fontSize:"72px",fontStyle:null,fontWeight:"500",lineHeight:"92.16px",letterSpacing:"-1.5px",textTransform:null},"dl-regular":{fontSize:"72px",fontStyle:null,fontWeight:"400",lineHeight:"92.16px",letterSpacing:"-1.5px",textTransform:null},"ds-bold":{fontSize:"58px",fontStyle:null,fontWeight:"700",lineHeight:"74.24px",letterSpacing:"-0.5px",textTransform:null},"ds-semibold":{fontSize:"58px",fontStyle:null,fontWeight:"500",lineHeight:"74.24px",letterSpacing:"-0.5px",textTransform:null},"ds-regular":{fontSize:"58px",fontStyle:null,fontWeight:"400",lineHeight:"74.24px",letterSpacing:"-0.5px",textTransform:null},"h1-bold":{fontSize:"48px",fontStyle:null,fontWeight:"700",lineHeight:"62px",letterSpacing:null,textTransform:null},"h2-bold":{fontSize:"34px",fontStyle:null,fontWeight:"700",lineHeight:"48px",letterSpacing:null,textTransform:null},"h3-bold":{fontSize:"26px",fontStyle:null,fontWeight:"700",lineHeight:"36px",letterSpacing:null,textTransform:null},"h4-bold":{fontSize:"20px",fontStyle:null,fontWeight:"700",lineHeight:"30px",letterSpacing:null,textTransform:null},"h5-bold":{fontSize:"16px",fontStyle:null,fontWeight:"700",lineHeight:"23px",letterSpacing:null,textTransform:null},"h6-bold":{fontSize:"14px",fontStyle:null,fontWeight:"700",lineHeight:"21px",letterSpacing:null,textTransform:null},"h1-semibold":{fontSize:"48px",fontStyle:null,fontWeight:"500",lineHeight:"62px",letterSpacing:null,textTransform:null},"h2-semibold":{fontSize:"34px",fontStyle:null,fontWeight:"500",lineHeight:"48px",letterSpacing:null,textTransform:null},"h3-semibold":{fontSize:"26px",fontStyle:null,fontWeight:"500",lineHeight:"36px",letterSpacing:null,textTransform:null},"h4-semibold":{fontSize:"20px",fontStyle:null,fontWeight:"500",lineHeight:"30px",letterSpacing:null,textTransform:null},"h5-semibold":{fontSize:"16px",fontStyle:null,fontWeight:"500",lineHeight:"23px",letterSpacing:null,textTransform:null},"h6-semibold":{fontSize:"14px",fontStyle:null,fontWeight:"500",lineHeight:"21px",letterSpacing:null,textTransform:null},"h1-regular":{fontSize:"48px",fontStyle:null,fontWeight:"400",lineHeight:"62px",letterSpacing:null,textTransform:null},"h2-regular":{fontSize:"34px",fontStyle:null,fontWeight:"400",lineHeight:"48px",letterSpacing:null,textTransform:null},"h3-regular":{fontSize:"26px",fontStyle:null,fontWeight:"400",lineHeight:"36px",letterSpacing:null,textTransform:null},"h4-regular":{fontSize:"20px",fontStyle:null,fontWeight:"400",lineHeight:"30px",letterSpacing:null,textTransform:null},"h5-regular":{fontSize:"16px",fontStyle:null,fontWeight:"400",lineHeight:"23px",letterSpacing:null,textTransform:null},"h6-regular":{fontSize:"14px",fontStyle:null,fontWeight:"400",lineHeight:"21px",letterSpacing:null,textTransform:null},"bl-bold":{fontSize:"18px",fontStyle:null,fontWeight:"700",lineHeight:"27px",letterSpacing:"0.5px",textTransform:null},"bl-semibold":{fontSize:"18px",fontStyle:null,fontWeight:"500",lineHeight:"27px",letterSpacing:null,textTransform:null},"bl-regular":{fontSize:"18px",fontStyle:null,fontWeight:"400",lineHeight:"27px",letterSpacing:null,textTransform:null},"bl-bold-italic":{fontSize:"18px",fontStyle:"italic",fontWeight:"400",lineHeight:"27px",letterSpacing:null,textTransform:null},"bm-bold":{fontSize:"16px",fontStyle:null,fontWeight:"700",lineHeight:"22px",letterSpacing:null,textTransform:null},"bm-semibold":{fontSize:"16px",fontStyle:null,fontWeight:"500",lineHeight:"22px",letterSpacing:null,textTransform:null},"bm-regular":{fontSize:"16px",fontStyle:null,fontWeight:"400",lineHeight:"22px",letterSpacing:null,textTransform:null},"bm-regular-italic":{fontSize:"16px",fontStyle:"italic",fontWeight:"400",lineHeight:"22px",letterSpacing:null,textTransform:null},"bs-bold":{fontSize:"14px",fontStyle:null,fontWeight:"700",lineHeight:"20px",letterSpacing:null,textTransform:null},"bs-semibold":{fontSize:"14px",fontStyle:null,fontWeight:"500",lineHeight:"20px",letterSpacing:null,textTransform:null},"bs-regular":{fontSize:"14px",fontStyle:null,fontWeight:"400",lineHeight:"20px",letterSpacing:null,textTransform:null},"bs-regular-italic":{fontSize:"14px",fontStyle:"italic",fontWeight:"400",lineHeight:"20px",letterSpacing:null,textTransform:null},"bes-bold":{fontSize:"12px",fontStyle:null,fontWeight:"700",lineHeight:"18px",letterSpacing:null,textTransform:null},"bes-semibold":{fontSize:"12px",fontStyle:null,fontWeight:"500",lineHeight:"18px",letterSpacing:null,textTransform:null},"bes-regular":{fontSize:"12px",fontStyle:null,fontWeight:"400",lineHeight:"18px",letterSpacing:null,textTransform:null},"bes-regular-italic":{fontSize:"12px",fontStyle:"italic",fontWeight:"400",lineHeight:"18px",letterSpacing:null,textTransform:null},"ol-bold":{fontSize:"12px",fontStyle:null,fontWeight:"700",lineHeight:"16px",letterSpacing:null,textTransform:"uppercase"},"ol-regular":{fontSize:"12px",fontStyle:null,fontWeight:"500",lineHeight:"16px",letterSpacing:null,textTransform:"uppercase"},"os-bold":{fontSize:"10px",fontStyle:null,fontWeight:"700",lineHeight:"14px",letterSpacing:null,textTransform:"uppercase"},"os-regular":{fontSize:"10px",fontStyle:null,fontWeight:"500",lineHeight:"14px",letterSpacing:null,textTransform:"uppercase"},"c-regular":{fontSize:"12px",fontStyle:null,fontWeight:"400",lineHeight:"16px",letterSpacing:null,textTransform:null},"c-semibold":{fontSize:"12px",fontStyle:null,fontWeight:500,lineHeight:"16px",letterSpacing:null,textTransform:null},"c-bold":{fontSize:"12px",fontStyle:null,fontWeight:"700",lineHeight:"16px",letterSpacing:null,textTransform:null},"cs-regular":{fontSize:"10px",fontStyle:null,fontWeight:"400",lineHeight:"14px",letterSpacing:null,textTransform:null},"cs-semibold":{fontSize:"10px",fontStyle:null,fontWeight:500,lineHeight:"14px",letterSpacing:null,textTransform:null},"cs-bold":{fontSize:"12px",fontStyle:null,fontWeight:"700",lineHeight:"14px",letterSpacing:null,textTransform:null}},getVariantStyles=fr=>{if(fr){const br=textVariants[fr];return Ae$2` +`,IllustrationWrapper=({componentName:fr,illustration:br,height:wr,width:Er,...kr})=>jsxRuntimeExports.jsx(StyledIllustrationWrapper,{"aria-hidden":"true","aria-label":fr,height:wr,role:"img",width:Er,...kr,children:br}),DiscordSimple=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IllustrationWrapper,{componentName:"DiscordSimple",illustration:jsxRuntimeExports.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:(wr==null?void 0:wr.width)??"28",height:(wr==null?void 0:wr.height)??"20",viewBox:"0 0 28 20",fill:"none",...br,children:jsxRuntimeExports.jsx("path",{d:"M23.2559 1.67497C21.5039 0.881212 19.6543 0.318094 17.7544 0C17.4944 0.459917 17.2592 0.933111 17.0496 1.4176C15.0259 1.11582 12.9678 1.11582 10.944 1.4176C10.7344 0.933161 10.4992 0.459973 10.2393 0C8.33817 0.32078 6.48735 0.885235 4.73356 1.67912C1.25183 6.77667 0.307992 11.7476 0.779913 16.648C2.8189 18.1388 5.10111 19.2725 7.52733 20C8.07364 19.2729 8.55706 18.5015 8.97246 17.6941C8.18348 17.4025 7.42197 17.0427 6.69675 16.6189C6.88762 16.4819 7.07429 16.3408 7.25467 16.2038C9.36488 17.1859 11.6681 17.695 14 17.695C16.3319 17.695 18.6351 17.1859 20.7453 16.2038C20.9278 16.3512 21.1145 16.4923 21.3032 16.6189C20.5766 17.0434 19.8137 17.4038 19.0233 17.6961C19.4382 18.5032 19.9217 19.2739 20.4684 20C22.8967 19.2755 25.1807 18.1422 27.2201 16.6501C27.7738 10.9672 26.2741 6.04193 23.2559 1.67497ZM9.57022 13.6343C8.25514 13.6343 7.16867 12.4533 7.16867 11.0004C7.16867 9.54753 8.21738 8.35616 9.56603 8.35616C10.9147 8.35616 11.9928 9.54753 11.9697 11.0004C11.9466 12.4533 10.9105 13.6343 9.57022 13.6343ZM18.4297 13.6343C17.1126 13.6343 16.0303 12.4533 16.0303 11.0004C16.0303 9.54753 17.079 8.35616 18.4297 8.35616C19.7805 8.35616 20.8502 9.54753 20.8271 11.0004C20.804 12.4533 19.77 13.6343 18.4297 13.6343Z",fill:"#5F6CFD"})}),...wr})},Ethereum=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IllustrationWrapper,{componentName:"Ethereum",illustration:jsxRuntimeExports.jsxs("svg",{width:(wr==null?void 0:wr.width)??"24",height:(wr==null?void 0:wr.height)??"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24Z",fill:"#627EEA"}),jsxRuntimeExports.jsx("path",{d:"M12.3735 3V9.6525L17.9963 12.165L12.3735 3Z",fill:"white","fill-opacity":"0.602"}),jsxRuntimeExports.jsx("path",{d:"M12.3735 3L6.75 12.165L12.3735 9.6525V3Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M12.3735 16.476V20.9963L18 13.212L12.3735 16.476Z",fill:"white","fill-opacity":"0.602"}),jsxRuntimeExports.jsx("path",{d:"M12.3735 20.9963V16.4753L6.75 13.212L12.3735 20.9963Z",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M12.3735 15.4298L17.9963 12.1651L12.3735 9.65405V15.4298Z",fill:"white","fill-opacity":"0.2"}),jsxRuntimeExports.jsx("path",{d:"M6.75 12.1651L12.3735 15.4298V9.65405L6.75 12.1651Z",fill:"white","fill-opacity":"0.602"})]}),...wr})},Google=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IllustrationWrapper,{componentName:"Google",illustration:jsxRuntimeExports.jsxs("svg",{width:wr.width||24,height:wr.height||24,viewBox:"0 0 25 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M21.14 12.2044C21.14 11.5663 21.0827 10.9526 20.9764 10.3635H12.5V13.849H17.3436C17.1309 14.9699 16.4927 15.919 15.5355 16.5572V18.8235H18.4564C20.1582 17.2526 21.14 14.9453 21.14 12.2044Z",fill:"#4285F4"}),jsxRuntimeExports.jsx("path",{d:"M12.5004 20.9998C14.9304 20.9998 16.9676 20.198 18.4567 18.8235L15.5358 16.5571C14.734 17.0971 13.7113 17.4244 12.5004 17.4244C10.1604 17.4244 8.17218 15.8453 7.46037 13.718H4.46582V16.0417C5.94673 18.9789 8.98218 20.9998 12.5004 20.9998Z",fill:"#34A853"}),jsxRuntimeExports.jsx("path",{d:"M7.46 13.7099C7.28 13.1699 7.17364 12.5972 7.17364 11.9999C7.17364 11.4027 7.28 10.8299 7.46 10.2899V7.96631H4.46545C3.85182 9.17722 3.5 10.5436 3.5 11.9999C3.5 13.4563 3.85182 14.8227 4.46545 16.0336L6.79727 14.2172L7.46 13.7099Z",fill:"#FBBC05"}),jsxRuntimeExports.jsx("path",{d:"M12.5004 6.58364C13.8258 6.58364 15.004 7.04182 15.9449 7.92545L18.5222 5.34818C16.9595 3.89182 14.9304 3 12.5004 3C8.98218 3 5.94673 5.02091 4.46582 7.96636L7.46037 10.29C8.17218 8.16273 10.1604 6.58364 12.5004 6.58364Z",fill:"#EA4335"})]}),...wr})},Solana=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IllustrationWrapper,{componentName:"Solana",illustration:jsxRuntimeExports.jsxs("svg",{width:wr.width||"24",height:wr.height||"24",viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M0 12.3452C0 5.7178 5.37258 0.345215 12 0.345215C18.6274 0.345215 24 5.7178 24 12.3452C24 18.9726 18.6274 24.3452 12 24.3452C5.37258 24.3452 0 18.9726 0 12.3452Z",fill:"black"}),jsxRuntimeExports.jsx("path",{d:"M20.2049 16.4444L17.4677 19.2577C17.4082 19.3188 17.3362 19.3675 17.2562 19.4008C17.1762 19.4341 17.0899 19.4513 17.0027 19.4513H4.02724C3.96532 19.4513 3.90476 19.4339 3.85299 19.4014C3.80121 19.3688 3.76049 19.3225 3.73581 19.2681C3.71113 19.2137 3.70358 19.1535 3.71408 19.0951C3.72458 19.0366 3.75267 18.9823 3.79491 18.9389L6.53414 16.1256C6.59348 16.0647 6.66524 16.016 6.74497 15.9828C6.82473 15.9495 6.91075 15.9322 6.99774 15.9321H19.9725C20.0344 15.9321 20.095 15.9494 20.1468 15.9819C20.1985 16.0145 20.2392 16.0608 20.264 16.1152C20.2886 16.1696 20.2962 16.2298 20.2857 16.2883C20.2752 16.3467 20.2471 16.401 20.2049 16.4444ZM17.4677 10.7791C17.4082 10.718 17.3362 10.6693 17.2562 10.636C17.1762 10.6027 17.0899 10.5856 17.0027 10.5856H4.02724C3.96532 10.5856 3.90476 10.6029 3.85299 10.6355C3.80121 10.668 3.76049 10.7143 3.73581 10.7687C3.71113 10.8232 3.70358 10.8833 3.71408 10.9418C3.72458 11.0003 3.75267 11.0545 3.79491 11.0979L6.53414 13.9112C6.59348 13.9722 6.66524 14.0208 6.74497 14.0541C6.82473 14.0874 6.91075 14.1047 6.99774 14.1048H19.9725C20.0344 14.1048 20.095 14.0875 20.1468 14.0549C20.1985 14.0224 20.2392 13.9761 20.264 13.9216C20.2886 13.8672 20.2962 13.8071 20.2857 13.7486C20.2752 13.6901 20.2471 13.6359 20.2049 13.5925L17.4677 10.7791ZM4.02724 8.75833H17.0027C17.0899 8.75836 17.1762 8.74121 17.2562 8.70791C17.3362 8.67461 17.4082 8.62588 17.4677 8.56477L20.2049 5.75145C20.2471 5.70807 20.2752 5.6538 20.2857 5.59533C20.2962 5.53685 20.2886 5.47671 20.264 5.42229C20.2392 5.36787 20.1985 5.32155 20.1468 5.28901C20.095 5.25647 20.0344 5.23914 19.9725 5.23914H6.99774C6.91075 5.23928 6.82473 5.25653 6.74497 5.28982C6.66524 5.32312 6.59348 5.37174 6.53414 5.43269L3.79561 8.24602C3.75342 8.28935 3.72533 8.34356 3.71481 8.40196C3.70429 8.46038 3.71178 8.52047 3.73637 8.57487C3.76096 8.62926 3.80158 8.67558 3.85325 8.70817C3.90492 8.74076 3.96539 8.75819 4.02724 8.75833Z",fill:"url(#paint0_linear_12519_7226)"}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_12519_7226",x1:"5.10909",y1:"19.79",x2:"18.0722",y2:"4.54208",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{offset:"0.08","stop-color":"#9945FF"}),jsxRuntimeExports.jsx("stop",{offset:"0.3","stop-color":"#8752F3"}),jsxRuntimeExports.jsx("stop",{offset:"0.5","stop-color":"#5497D5"}),jsxRuntimeExports.jsx("stop",{offset:"0.6","stop-color":"#43B4CA"}),jsxRuntimeExports.jsx("stop",{offset:"0.72","stop-color":"#28E0B9"}),jsxRuntimeExports.jsx("stop",{offset:"0.97","stop-color":"#19FB9B"})]})})]}),...wr})},PushLogo=fr=>{const{svgProps:br,...wr}=fr;return jsxRuntimeExports.jsx(IllustrationWrapper,{componentName:"PushDev",illustration:jsxRuntimeExports.jsxs("svg",{width:wr.width??"48",height:wr.height??"48",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...br,children:[jsxRuntimeExports.jsx("path",{d:"M9.00053 18C10.034 18 10.9206 17.3814 11.314 16.4948C11.4097 16.2787 11.2505 16.0362 11.0138 16.0362H6.98642C6.75053 16.0362 6.5897 16.2787 6.6862 16.4948C7.08044 17.3814 7.96708 18 8.9997 18",fill:"url(#paint0_linear_2966_8287)"}),jsxRuntimeExports.jsx("path",{d:"M15.1797 13.5973C14.5248 13.5973 13.9937 13.067 13.9937 12.4113V8.10264C13.9937 5.76768 12.3911 3.808 10.2261 3.26118C10.1469 2.64589 9.62151 2.16917 8.98395 2.16917C8.3464 2.16917 7.81772 2.65001 7.74101 3.2686C5.79783 3.77254 4.3157 5.41715 4.04847 7.44529C4.04435 7.47498 4.04022 7.50467 4.03692 7.53436C4.03197 7.57478 4.02785 7.61437 4.02455 7.65478C4.02125 7.69519 4.01795 7.73561 4.01548 7.77602C4.013 7.80984 4.01053 7.84283 4.00888 7.87747C4.00558 7.9451 4.00393 8.01438 4.00393 8.08367V12.4113C4.00393 13.0637 3.47772 13.5924 2.82697 13.5973C2.51603 13.5998 2.25952 13.839 2.25952 14.1507V14.1557C2.25952 14.4642 2.50943 14.7141 2.8179 14.7141H15.1764C15.4849 14.7141 15.7348 14.4642 15.7348 14.1557C15.7364 13.8481 15.4865 13.5981 15.1781 13.5981L15.1797 13.5973Z",fill:"url(#paint1_linear_2966_8287)"}),jsxRuntimeExports.jsx("path",{d:"M12.5784 2.41001C13.9682 2.70775 15.0296 3.90451 15.1608 5.31983C15.1756 5.47654 15.3117 5.59448 15.4726 5.57881C15.5484 5.57139 15.6177 5.5351 15.6664 5.47654C15.715 5.41716 15.7381 5.34293 15.7307 5.26705C15.654 4.44062 15.3208 3.67605 14.7665 3.05416C14.2164 2.43888 13.5013 2.02154 12.698 1.84916C12.6774 1.84503 12.6576 1.84256 12.6378 1.84256C12.5058 1.84256 12.3862 1.93494 12.3582 2.06937C12.3252 2.22361 12.4233 2.37619 12.5784 2.40918V2.41001Z",fill:"url(#paint2_linear_2966_8287)"}),jsxRuntimeExports.jsx("path",{d:"M12.8992 0.567448C15.0617 1.03097 16.7146 2.89333 16.9183 5.09549C16.9332 5.2522 17.0692 5.36932 17.2301 5.35447C17.306 5.34705 17.3752 5.31076 17.4239 5.2522C17.4726 5.19281 17.4957 5.11858 17.4882 5.0427C17.3761 3.82533 16.8837 2.69703 16.0671 1.78317C15.2564 0.875091 14.2023 0.261454 13.0196 0.00742221C12.999 0.00329831 12.9792 0.000823975 12.9594 0.000823975C12.8274 0.000823975 12.7078 0.0931994 12.6798 0.227639C12.6459 0.381872 12.7441 0.534457 12.8992 0.567448Z",fill:"url(#paint3_linear_2966_8287)"}),jsxRuntimeExports.jsx("path",{d:"M5.42097 2.41001C5.57521 2.37702 5.67418 2.22361 5.64119 2.06937C5.61232 1.93494 5.49355 1.84256 5.36159 1.84256C5.3418 1.84256 5.322 1.84503 5.30138 1.84916C4.49805 2.02154 3.78296 2.43805 3.23283 3.05416C2.67858 3.6744 2.34454 4.43979 2.26867 5.26705C2.26124 5.34293 2.28516 5.41716 2.333 5.47654C2.38084 5.53592 2.45094 5.57222 2.52682 5.57881C2.68765 5.59366 2.82374 5.47654 2.83859 5.31983C2.96973 3.90533 4.03204 2.7094 5.42097 2.41083V2.41001Z",fill:"url(#paint4_linear_2966_8287)"}),jsxRuntimeExports.jsx("path",{d:"M5.10008 0.567449C5.25431 0.534458 5.35329 0.381048 5.3203 0.226815C5.29143 0.0923754 5.17266 0 5.0407 0C5.02008 0 5.00111 0.00247433 4.98049 0.00659824C3.79693 0.260631 2.74368 0.874267 1.93293 1.78235C1.11557 2.69703 0.624824 3.82451 0.511829 5.04188C0.504406 5.11776 0.528325 5.19199 0.576162 5.25138C0.624824 5.31076 0.694106 5.34705 0.769985 5.35365C0.929993 5.36849 1.06691 5.25138 1.08175 5.09467C1.28547 2.89333 2.93833 1.0318 5.10008 0.567449Z",fill:"url(#paint5_linear_2966_8287)"}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_2966_8287",x1:"11.7075",y1:"11.7746",x2:"8.41081",y2:"17.3781",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{"stop-color":"#FF94A6"}),jsxRuntimeExports.jsx("stop",{offset:"0.17","stop-color":"#EA6AC0"}),jsxRuntimeExports.jsx("stop",{offset:"0.33","stop-color":"#DA4AD5"}),jsxRuntimeExports.jsx("stop",{offset:"0.42","stop-color":"#D53EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.53","stop-color":"#CB3EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.72","stop-color":"#B341E0"}),jsxRuntimeExports.jsx("stop",{offset:"0.95","stop-color":"#8B45E4"}),jsxRuntimeExports.jsx("stop",{offset:"1","stop-color":"#8247E5"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint1_linear_2966_8287",x1:"15.2721",y1:"3.58366",x2:"5.37636",y2:"15.9842",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{"stop-color":"#FF94A6"}),jsxRuntimeExports.jsx("stop",{offset:"0.17","stop-color":"#EA6AC0"}),jsxRuntimeExports.jsx("stop",{offset:"0.33","stop-color":"#DA4AD5"}),jsxRuntimeExports.jsx("stop",{offset:"0.42","stop-color":"#D53EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.53","stop-color":"#CB3EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.72","stop-color":"#B341E0"}),jsxRuntimeExports.jsx("stop",{offset:"0.95","stop-color":"#8B45E4"}),jsxRuntimeExports.jsx("stop",{offset:"1","stop-color":"#8247E5"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint2_linear_2966_8287",x1:"18.8871",y1:"0.496518",x2:"2.00142",y2:"11.7045",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{"stop-color":"#FF94A6"}),jsxRuntimeExports.jsx("stop",{offset:"0.17","stop-color":"#EA6AC0"}),jsxRuntimeExports.jsx("stop",{offset:"0.33","stop-color":"#DA4AD5"}),jsxRuntimeExports.jsx("stop",{offset:"0.42","stop-color":"#D53EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.53","stop-color":"#CB3EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.72","stop-color":"#B341E0"}),jsxRuntimeExports.jsx("stop",{offset:"0.95","stop-color":"#8B45E4"}),jsxRuntimeExports.jsx("stop",{offset:"1","stop-color":"#8247E5"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint3_linear_2966_8287",x1:"18.7287",y1:"0.258155",x2:"1.84297",y2:"11.4661",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{"stop-color":"#FF94A6"}),jsxRuntimeExports.jsx("stop",{offset:"0.17","stop-color":"#EA6AC0"}),jsxRuntimeExports.jsx("stop",{offset:"0.33","stop-color":"#DA4AD5"}),jsxRuntimeExports.jsx("stop",{offset:"0.42","stop-color":"#D53EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.53","stop-color":"#CB3EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.72","stop-color":"#B341E0"}),jsxRuntimeExports.jsx("stop",{offset:"0.95","stop-color":"#8B45E4"}),jsxRuntimeExports.jsx("stop",{offset:"1","stop-color":"#8247E5"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint4_linear_2966_8287",x1:"15.734",y1:"-4.25421",x2:"-1.1517",y2:"6.95455",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{"stop-color":"#FF94A6"}),jsxRuntimeExports.jsx("stop",{offset:"0.17","stop-color":"#EA6AC0"}),jsxRuntimeExports.jsx("stop",{offset:"0.33","stop-color":"#DA4AD5"}),jsxRuntimeExports.jsx("stop",{offset:"0.42","stop-color":"#D53EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.53","stop-color":"#CB3EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.72","stop-color":"#B341E0"}),jsxRuntimeExports.jsx("stop",{offset:"0.95","stop-color":"#8B45E4"}),jsxRuntimeExports.jsx("stop",{offset:"1","stop-color":"#8247E5"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint5_linear_2966_8287",x1:"14.9042",y1:"-5.50293",x2:"-1.97323",y2:"5.70088",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{"stop-color":"#FF94A6"}),jsxRuntimeExports.jsx("stop",{offset:"0.17","stop-color":"#EA6AC0"}),jsxRuntimeExports.jsx("stop",{offset:"0.33","stop-color":"#DA4AD5"}),jsxRuntimeExports.jsx("stop",{offset:"0.42","stop-color":"#D53EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.53","stop-color":"#CB3EDD"}),jsxRuntimeExports.jsx("stop",{offset:"0.72","stop-color":"#B341E0"}),jsxRuntimeExports.jsx("stop",{offset:"0.95","stop-color":"#8B45E4"}),jsxRuntimeExports.jsx("stop",{offset:"1","stop-color":"#8247E5"})]})]})]}),...wr})},alertVariants={success:{icon:TickCircleFilled,iconColor:"components-alert-icon-success",borderColor:"components-alert-stroke-success",bgColor:"components-alert-background-success",ctaColor:"components-alert-text-cta-success"},warning:{icon:WarningCircleFilled,iconColor:"components-alert-icon-warning",borderColor:"components-alert-stroke-warning",bgColor:"components-alert-background-warning",ctaColor:"components-alert-text-cta-warning"},info:{icon:InfoFilled,iconColor:"components-alert-icon-info",borderColor:"components-alert-stroke-info",bgColor:"components-alert-background-info",ctaColor:"components-alert-text-cta-info"},error:{icon:WarningCircleFilled,iconColor:"components-alert-icon-error",borderColor:"components-alert-stroke-error",bgColor:"components-alert-background-error",ctaColor:"components-alert-text-cta-error"}},deviceSizes={mobileS:"320px",mobileM:"375px",mobileL:"425px",tablet:"768px",laptop:"1024px",laptopL:"1440px",desktop:"2560px",ultrawide:"3440px"},deviceMediaQ={mobileS:`(max-width: ${deviceSizes.mobileS})`,mobileM:`(max-width: ${deviceSizes.mobileM})`,mobileL:`(max-width: ${deviceSizes.mobileL})`,tablet:`(max-width: ${deviceSizes.tablet})`,laptop:`(max-width: ${deviceSizes.laptop})`,laptopL:`(max-width: ${deviceSizes.laptopL})`,desktop:`(max-width: ${deviceSizes.desktop})`,ultrawide:`(max-width: ${deviceSizes.ultrawide})`},breakpointMap={initial:"",ms:"mobileS",mm:"mobileM",ml:"mobileL",tb:"tablet",lp:"laptop",ll:"laptopL",dp:"desktop",uw:"ultrawide"},colorPrimitives={"gray-100":"#F5F6F8","gray-200":"#EAEBF2","gray-300":"#C4CBD5","gray-400":"#B0B3B9","gray-500":"#8C93A0","gray-600":"#757D8D","gray-700":"#484D58","gray-800":"#313338","gray-900":"#202124","gray-1000":"#17181B","pink-100":"#FCEBFF","pink-200":"#FBE8FF","pink-300":"#F3AEFF","pink-400":"#CF59E2","pink-500":"#D548EC","pink-600":"#C742DD","pink-700":"#AA30BE","pink-800":"#7B0090","pink-900":"#570066","pink-1000":"#35003F","blue-100":"#E8F2FF","blue-200":"#D1E4FF","blue-300":"#A2C9FF","blue-400":"#73ADFF","blue-500":"#4090FF","blue-600":"#076EFF","blue-700":"#0056D0","blue-800":"#00419D","blue-900":"#002D6D","blue-1000":"#001A40","green-100":"#D8F7F0","green-200":"#AFEFE1","green-300":"#51DCBD","green-400":"#00C296","green-500":"#00A47F","green-600":"#008769","green-700":"#006B53","green-800":"#00513F","green-900":"#00382B","green-1000":"#002019","red-100":"#FFECEC","red-200":"#FFD9D9","red-300":"#FFB1B1","red-400":"#FF8585","red-500":"#FF4E4E","red-600":"#F11F1F","red-700":"#D43B3B","red-800":"#A40A0A","red-900":"#670000","red-1000":"#400000","yellow-100":"#FFF0CB","yellow-200":"#FFDF93","yellow-300":"#FFBB16","yellow-400":"#E99B00","yellow-500":"#C77100","yellow-600":"#A85A00","yellow-700":"#8A4900","yellow-800":"#663600","yellow-900":"#472600","yellow-1000":"#291500","white-10":"rgba(255,255,255,0.1)","white-20":"rgba(255,255,255,0.2)","white-30":"rgba(255,255,255,0.3)","white-40":"rgba(255,255,255,0.4)","white-50":"rgba(255,255,255,0.5)","white-60":"rgba(255,255,255,0.6)","white-70":"rgba(255,255,255,0.7)","white-80":"rgba(255,255,255,0.8)","white-90":"rgba(255,255,255,0.9)","white-100":"rgba(255,255,255,1)","black-10":"rgba(0,0,0,0.1)","black-20":"rgba(0,0,0,0.2)","black-30":"rgba(0,0,0,0.3)","black-40":"rgba(0,0,0,0.4)","black-50":"rgba(0,0,0,0.5)","black-60":"rgba(0,0,0,0.6)","black-70":"rgba(0,0,0,0.7)","black-80":"rgba(0,0,0,0.8)","black-90":"rgba(0,0,0,0.9)","black-100":"rgba(0,0,0,1)",transparent:"transparent"},colorBrands={"primary-100":colorPrimitives["pink-100"],"primary-200":colorPrimitives["pink-200"],"primary-300":colorPrimitives["pink-300"],"primary-400":colorPrimitives["pink-400"],"primary-500":colorPrimitives["pink-500"],"primary-600":colorPrimitives["pink-600"],"primary-700":colorPrimitives["pink-700"],"primary-800":colorPrimitives["pink-800"],"primary-900":colorPrimitives["pink-900"],"primary-1000":colorPrimitives["pink-1000"],"neutral-100":colorPrimitives["gray-100"],"neutral-200":colorPrimitives["gray-200"],"neutral-300":colorPrimitives["gray-300"],"neutral-400":colorPrimitives["gray-400"],"neutral-500":colorPrimitives["gray-500"],"neutral-600":colorPrimitives["gray-600"],"neutral-700":colorPrimitives["gray-700"],"neutral-800":colorPrimitives["gray-800"],"neutral-900":colorPrimitives["gray-900"],"neutral-1000":colorPrimitives["gray-1000"],"info-100":colorPrimitives["blue-100"],"info-200":colorPrimitives["blue-200"],"info-300":colorPrimitives["blue-300"],"info-400":colorPrimitives["blue-400"],"info-500":colorPrimitives["blue-500"],"info-600":colorPrimitives["blue-600"],"info-700":colorPrimitives["blue-700"],"info-800":colorPrimitives["blue-800"],"info-900":colorPrimitives["blue-900"],"info-1000":colorPrimitives["blue-1000"],"success-100":colorPrimitives["green-100"],"success-200":colorPrimitives["green-200"],"success-300":colorPrimitives["green-300"],"success-400":colorPrimitives["green-400"],"success-500":colorPrimitives["green-500"],"success-600":colorPrimitives["green-600"],"success-700":colorPrimitives["green-700"],"success-800":colorPrimitives["green-800"],"success-900":colorPrimitives["green-900"],"success-1000":colorPrimitives["green-1000"],"warning-100":colorPrimitives["yellow-100"],"warning-200":colorPrimitives["yellow-200"],"warning-300":colorPrimitives["yellow-300"],"warning-400":colorPrimitives["yellow-400"],"warning-500":colorPrimitives["yellow-500"],"warning-600":colorPrimitives["yellow-600"],"warning-700":colorPrimitives["yellow-700"],"warning-800":colorPrimitives["yellow-800"],"warning-900":colorPrimitives["yellow-900"],"warning-1000":colorPrimitives["yellow-1000"],"danger-100":colorPrimitives["red-100"],"danger-200":colorPrimitives["red-200"],"danger-300":colorPrimitives["red-300"],"danger-400":colorPrimitives["red-400"],"danger-500":colorPrimitives["red-500"],"danger-600":colorPrimitives["red-600"],"danger-700":colorPrimitives["red-700"],"danger-800":colorPrimitives["red-800"],"danger-900":colorPrimitives["red-900"],"danger-1000":colorPrimitives["red-1000"]},textSemantics={primary:{light:colorBrands["neutral-1000"],dark:colorBrands["neutral-100"]},secondary:{light:colorBrands["neutral-800"],dark:colorBrands["neutral-300"]},tertiary:{light:colorBrands["neutral-500"],dark:colorBrands["neutral-600"]},"primary-inverse":{light:colorPrimitives["white-100"],dark:colorPrimitives["black-100"]},"secondary-inverse":{light:colorBrands["neutral-400"],dark:colorBrands["neutral-700"]},"tertiary-inverse":{light:colorBrands["neutral-600"],dark:colorBrands["neutral-500"]},"brand-subtle":{light:colorBrands["primary-200"],dark:colorBrands["primary-200"]},"brand-medium":{light:colorBrands["primary-600"],dark:colorBrands["primary-400"]},"brand-bold":{light:colorBrands["primary-700"],dark:colorBrands["primary-800"]},"on-light-bg":{light:colorPrimitives["black-100"],dark:colorPrimitives["black-100"]},"on-dark-bg":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"state-success-subtle":{light:colorBrands["success-100"],dark:colorBrands["success-700"]},"state-success-bold":{light:colorBrands["success-500"],dark:colorBrands["success-300"]},"state-info-subtle":{light:colorBrands["info-100"],dark:colorBrands["info-700"]},"state-info-bold":{light:colorBrands["info-700"],dark:colorBrands["info-100"]},"state-warning-subtle":{light:colorBrands["warning-100"],dark:colorBrands["warning-700"]},"state-warning-bold":{light:colorBrands["warning-700"],dark:colorBrands["warning-100"]},"state-danger-subtle":{light:colorBrands["danger-100"],dark:colorBrands["danger-700"]},"state-danger-bold":{light:colorBrands["danger-700"],dark:colorBrands["danger-300"]},"state-disabled":{light:colorBrands["neutral-400"],dark:colorBrands["neutral-700"]}},alertSemantics={"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-body":{light:textSemantics.tertiary.light,dark:textSemantics.tertiary.dark},"icon-success":{light:colorBrands["success-500"],dark:colorBrands["success-300"]},"icon-warning":{light:colorBrands["warning-700"],dark:colorBrands["warning-100"]},"icon-error":{light:colorBrands["danger-600"],dark:colorBrands["danger-500"]},"icon-info":{light:colorPrimitives["blue-700"],dark:colorPrimitives["blue-100"]},"text-cta-success":{light:colorBrands["success-500"],dark:colorBrands["success-300"]},"text-cta-warning":{light:colorBrands["warning-700"],dark:colorBrands["warning-100"]},"text-cta-error":{light:colorBrands["danger-600"],dark:colorBrands["danger-500"]},"text-cta-info":{light:colorPrimitives["blue-700"],dark:colorPrimitives["blue-100"]},"background-success":{light:colorBrands["success-100"],dark:colorBrands["success-900"]},"background-warning":{light:colorBrands["warning-100"],dark:colorBrands["warning-900"]},"background-error":{light:colorBrands["danger-100"],dark:colorBrands["danger-900"]},"background-info":{light:colorPrimitives["blue-100"],dark:colorPrimitives["blue-900"]},"stroke-success":{light:colorBrands["success-300"],dark:colorBrands["success-700"]},"stroke-warning":{light:colorBrands["warning-300"],dark:colorBrands["warning-700"]},"stroke-error":{light:colorBrands["danger-300"],dark:colorBrands["danger-700"]},"stroke-info":{light:colorPrimitives["blue-300"],dark:colorPrimitives["blue-700"]}},iconSemantics={primary:{light:colorBrands["neutral-900"],dark:colorBrands["neutral-400"]},secondary:{light:colorBrands["neutral-200"],dark:colorBrands["neutral-100"]},tertiary:{light:colorBrands["neutral-300"],dark:colorBrands["neutral-700"]},"hero-icons":{light:colorBrands["neutral-1000"],dark:colorBrands["neutral-100"]},"brand-subtle":{light:colorBrands["primary-300"],dark:colorBrands["primary-400"]},"brand-medium":{light:colorBrands["primary-500"],dark:colorBrands["primary-400"]},"brand-bold":{light:colorBrands["primary-800"],dark:colorBrands["primary-300"]},"state-success-subtle":{light:colorBrands["success-200"],dark:colorBrands["success-600"]},"state-success-bold":{light:colorBrands["success-600"],dark:colorBrands["success-300"]},"state-info-subtle":{light:colorBrands["info-200"],dark:colorBrands["info-600"]},"state-info-bold":{light:colorBrands["info-600"],dark:colorBrands["info-200"]},"state-warning-subtle":{light:colorBrands["warning-200"],dark:colorBrands["warning-600"]},"state-warning-bold":{light:colorBrands["warning-600"],dark:colorBrands["warning-200"]},"state-danger-subtle":{light:colorBrands["danger-200"],dark:colorBrands["danger-600"]},"state-danger-bold":{light:colorBrands["danger-600"],dark:colorBrands["danger-300"]},"state-disabled":{light:colorBrands["neutral-400"],dark:colorBrands["neutral-700"]}},strokeSemantics={primary:{light:colorBrands["neutral-100"],dark:colorBrands["neutral-900"]},secondary:{light:colorBrands["neutral-200"],dark:colorBrands["neutral-800"]},tertiary:{light:colorBrands["neutral-300"],dark:colorBrands["neutral-700"]},"brand-subtle":{light:colorBrands["primary-300"],dark:colorBrands["primary-500"]},"brand-medium":{light:colorBrands["primary-500"],dark:colorBrands["primary-400"]},"brand-bold":{light:colorBrands["primary-800"],dark:colorBrands["primary-300"]},"state-success-subtle":{light:colorBrands["success-300"],dark:colorBrands["success-500"]},"state-success-bold":{light:colorBrands["success-700"],dark:colorBrands["success-300"]},"state-info-subtle":{light:colorBrands["info-300"],dark:colorBrands["info-500"]},"state-info-bold":{light:colorBrands["info-700"],dark:colorBrands["info-300"]},"state-warning-subtle":{light:colorBrands["warning-300"],dark:colorBrands["warning-500"]},"state-warning-bold":{light:colorBrands["warning-700"],dark:colorBrands["warning-300"]},"state-danger-subtle":{light:colorBrands["danger-300"],dark:colorBrands["danger-500"]},"state-danger-bold":{light:colorBrands["danger-500"],dark:colorBrands["danger-300"]},"state-hover":{light:colorBrands["success-300"],dark:colorBrands["success-800"]},"state-focus":{light:colorBrands["success-300"],dark:colorBrands["success-300"]},"state-pressed":{light:colorBrands["info-800"],dark:colorBrands["info-300"]},"state-disabled":{light:colorBrands["info-300"],dark:colorBrands["info-800"]}},surfaceSemantics={primary:{light:colorPrimitives["white-100"],dark:colorBrands["neutral-900"]},secondary:{light:colorBrands["neutral-100"],dark:colorBrands["neutral-1000"]},tertiary:{light:colorBrands["neutral-200"],dark:colorBrands["neutral-800"]},"primary-inverse":{light:colorPrimitives["black-100"],dark:colorPrimitives["white-100"]},"brand-subtle":{light:colorBrands["primary-200"],dark:colorBrands["primary-300"]},"brand-medium":{light:colorBrands["primary-600"],dark:colorBrands["primary-500"]},"brand-bold":{light:colorBrands["primary-700"],dark:colorBrands["primary-200"]},"glass-subtle":{light:colorPrimitives["white-80"],dark:colorPrimitives["black-80"]},"glass-bold":{light:colorPrimitives["white-50"],dark:colorPrimitives["black-50"]},transparent:{light:colorPrimitives.transparent,dark:colorPrimitives.transparent},"state-success-subtle":{light:colorBrands["success-100"],dark:colorBrands["success-900"]},"state-success-bold":{light:colorBrands["success-500"],dark:colorBrands["success-200"]},"state-info-subtle":{light:colorBrands["info-100"],dark:colorBrands["info-900"]},"state-info-bold":{light:colorBrands["info-500"],dark:colorBrands["info-200"]},"state-warning-subtle":{light:colorBrands["warning-100"],dark:colorBrands["warning-900"]},"state-warning-bold":{light:colorBrands["warning-500"],dark:colorBrands["warning-200"]},"state-danger-subtle":{light:colorBrands["danger-100"],dark:colorBrands["danger-900"]},"state-danger-bold":{light:colorBrands["danger-500"],dark:colorBrands["danger-200"]},"state-disabled":{light:colorBrands["neutral-200"],dark:colorBrands["neutral-800"]}},primaryButtonSemantics={"background-default":{light:colorBrands["primary-500"],dark:colorBrands["primary-500"]},"background-hover":{light:colorBrands["primary-400"],dark:colorBrands["primary-400"]},"background-pressed":{light:colorBrands["primary-800"],dark:colorBrands["primary-600"]},"background-focus":{light:colorBrands["primary-500"],dark:colorBrands["primary-400"]},"background-loading":{light:colorBrands["primary-400"],dark:colorBrands["primary-400"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["primary-700"],dark:colorBrands["primary-200"]}},secondaryButtonSemantics={"background-default":{light:colorBrands["neutral-100"],dark:colorBrands["neutral-800"]},"background-hover":{light:colorBrands["neutral-200"],dark:colorBrands["neutral-700"]},"background-pressed":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-1000"]},"background-focus":{light:colorBrands["neutral-100"],dark:colorBrands["neutral-800"]},"background-loading":{light:colorBrands["neutral-100"],dark:colorBrands["neutral-800"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:colorBrands["neutral-1000"],dark:colorPrimitives["white-100"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorBrands["neutral-800"],dark:colorPrimitives["white-60"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["primary-300"],dark:colorBrands["primary-400"]}},tertiaryButtonSemantics={"background-default":{light:colorBrands["neutral-1000"],dark:colorBrands["neutral-700"]},"background-inverse":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-hover":{light:colorBrands["neutral-900"],dark:colorBrands["neutral-300"]},"background-pressed":{light:colorBrands["neutral-100"],dark:colorPrimitives["gray-1000"]},"background-focus":{light:colorBrands["neutral-1000"],dark:colorBrands["neutral-700"]},"background-loading":{light:colorBrands["neutral-900"],dark:colorBrands["neutral-700"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["gray-200"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorBrands["neutral-300"],dark:colorPrimitives["white-50"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["primary-400"],dark:colorBrands["primary-400"]}},outlineButtonSemantics={"background-default":{light:colorPrimitives.transparent,dark:colorPrimitives.transparent},"background-hover":{light:colorPrimitives.transparent,dark:colorPrimitives.transparent},"background-pressed":{light:colorPrimitives.transparent,dark:colorPrimitives.transparent},"background-focus":{light:colorPrimitives.transparent,dark:colorPrimitives.transparent},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.secondary.dark},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-default":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"stroke-focus":{light:colorBrands["primary-300"],dark:colorBrands["primary-400"]},"stroke-loading":{light:colorBrands["neutral-200"],dark:colorBrands["primary-400"]},"stroke-hover":{light:strokeSemantics["brand-subtle"].light,dark:strokeSemantics.secondary.dark},"stroke-pressed":{light:colorBrands["neutral-600"],dark:colorBrands["neutral-300"]}},dangerButtonSemantics={"background-default":{light:colorBrands["danger-600"],dark:colorBrands["danger-500"]},"background-hover":{light:colorBrands["danger-500"],dark:colorBrands["danger-400"]},"background-pressed":{light:colorBrands["danger-800"],dark:colorBrands["danger-700"]},"background-focus":{light:colorBrands["danger-500"],dark:colorBrands["danger-400"]},"background-loading":{light:colorBrands["danger-500"],dark:colorBrands["danger-400"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorPrimitives["white-70"],dark:colorPrimitives["white-70"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["danger-800"],dark:colorBrands["danger-600"]}},dangerSecondaryButtonSemantics={"background-default":{light:colorBrands["danger-200"],dark:colorBrands["danger-800"]},"background-hover":{light:colorBrands["danger-100"],dark:colorBrands["danger-700"]},"background-pressed":{light:colorBrands["danger-500"],dark:colorBrands["danger-1000"]},"background-focus":{light:colorBrands["danger-100"],dark:colorBrands["danger-700"]},"background-loading":{light:colorBrands["danger-100"],dark:colorBrands["danger-700"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:colorBrands["danger-700"],dark:colorPrimitives["white-100"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorBrands["danger-400"],dark:colorPrimitives["white-70"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["danger-800"],dark:colorBrands["danger-400"]}},checkboxSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"background-selected":{light:surfaceSemantics["brand-medium"].light,dark:surfaceSemantics["brand-medium"].dark},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-secondary":{light:textSemantics.secondary.light,dark:textSemantics.secondary.dark},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"stroke-default":{light:textSemantics["brand-medium"].light,dark:textSemantics["brand-medium"].dark},"stroke-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]}},inputSemantics={"background-default":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-hover":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-pressed":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-focus":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"background-success":{light:colorBrands["success-100"],dark:colorBrands["success-200"]},"background-danger":{light:colorBrands["danger-100"],dark:colorBrands["danger-200"]},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-placeholder":{light:colorBrands["neutral-400"],dark:colorBrands["neutral-600"]},"text-secondary":{light:colorBrands["neutral-600"],dark:colorBrands["neutral-500"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"text-success":{light:textSemantics["state-success-bold"].light,dark:textSemantics["state-success-subtle"].dark},"text-danger":{light:textSemantics["state-danger-bold"].light,dark:textSemantics["state-danger-subtle"].dark},"icon-default":{light:iconSemantics.tertiary.light,dark:iconSemantics.secondary.dark},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"icon-success":{light:iconSemantics["state-success-bold"].light,dark:iconSemantics["state-success-subtle"].dark},"icon-danger":{light:iconSemantics["state-danger-bold"].light,dark:iconSemantics["state-danger-subtle"].dark},"stroke-default":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"stroke-hover":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"stroke-focus":{light:colorBrands["primary-300"],dark:colorBrands["primary-300"]},"stroke-pressed":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"stroke-disabled":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-900"]},"stroke-success":{light:colorBrands["success-500"],dark:colorBrands["success-400"]},"stroke-danger":{light:colorBrands["danger-400"],dark:colorBrands["danger-400"]}},listItemSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"background-hover":{light:surfaceSemantics.secondary.light,dark:surfaceSemantics.secondary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-success":{light:textSemantics["state-success-bold"].light,dark:textSemantics["state-success-subtle"].dark},"text-error":{light:textSemantics["state-danger-bold"].light,dark:textSemantics["state-danger-bold"].dark},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark},"icon-success":{light:iconSemantics["state-success-bold"].light,dark:iconSemantics["state-success-bold"].dark},"icon-error":{light:iconSemantics["state-danger-bold"].light,dark:iconSemantics["state-danger-bold"].dark},"stroke-default":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark}},modalSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"stroke-bg":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-secondary":{light:textSemantics.tertiary.light,dark:textSemantics.tertiary.dark},"text-link":{light:colorPrimitives["pink-700"],dark:colorPrimitives["pink-400"]},"icon-success":{light:colorPrimitives["green-400"],dark:colorPrimitives["green-300"]},"icon-error":{light:colorPrimitives["red-700"],dark:colorPrimitives["red-600"]},"icon-warning":{light:colorPrimitives["yellow-400"],dark:colorPrimitives["yellow-300"]},"icon-info":{light:colorPrimitives["blue-600"],dark:colorPrimitives["blue-500"]},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark},"icon-secondary":{light:iconSemantics.secondary.light,dark:iconSemantics.secondary.dark}},notificationsSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"stroke-bg":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-secondary":{light:textSemantics.tertiary.light,dark:textSemantics.tertiary.dark},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark}},paginationSemantics={"background-default":{light:surfaceSemantics.tertiary.light,dark:surfaceSemantics.tertiary.dark},"background-hover":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-300"]},"text-selected":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-default":{light:textSemantics.tertiary.light,dark:textSemantics.tertiary.dark},"text-disabled":{light:textSemantics["secondary-inverse"].light,dark:textSemantics["secondary-inverse"].dark}},progressBarSemantics={"background-default":{light:surfaceSemantics.secondary.light,dark:surfaceSemantics.secondary.dark},"background-progress":{light:surfaceSemantics["brand-medium"].light,dark:surfaceSemantics["brand-medium"].dark}},radioSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"background-selected":{light:surfaceSemantics["brand-medium"].light,dark:surfaceSemantics["brand-medium"].dark},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-secondary":{light:textSemantics.secondary.light,dark:textSemantics.secondary.dark},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"stroke-default":{light:strokeSemantics["brand-medium"].light,dark:strokeSemantics["brand-medium"].dark},"stroke-disabled":{light:strokeSemantics["state-disabled"].light,dark:strokeSemantics["state-disabled"].dark}},skeletonSemantics={"gradient-light":{light:colorBrands["neutral-200"],dark:colorBrands["neutral-800"]},"gradient-dark":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-700"]}},switchSemantics={"background-selected":{light:colorBrands["primary-600"],dark:colorBrands["primary-600"]},"background-unselected":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-800"]},"background-hover":{light:colorBrands["primary-500"],dark:colorBrands["primary-500"]},"background-focus":{light:colorBrands["primary-500"],dark:colorBrands["primary-600"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"icon-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"stroke-focus":{light:colorBrands["primary-300"],dark:colorBrands["primary-500"]},"stroke-default":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark}},tagSemantics={"background-default":{light:surfaceSemantics.tertiary.light,dark:surfaceSemantics.tertiary.dark},"background-success":{light:surfaceSemantics["state-success-subtle"].light,dark:surfaceSemantics["state-success-subtle"].dark},"background-danger":{light:surfaceSemantics["state-danger-subtle"].light,dark:surfaceSemantics["state-danger-subtle"].dark},"background-warning":{light:surfaceSemantics["state-warning-subtle"].light,dark:surfaceSemantics["state-warning-subtle"].dark},"background-info":{light:surfaceSemantics["state-info-subtle"].light,dark:surfaceSemantics["state-info-subtle"].dark},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"stroke-bg":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-success":{light:textSemantics["state-success-bold"].light,dark:textSemantics["state-success-bold"].dark},"text-warning":{light:textSemantics["state-warning-bold"].light,dark:textSemantics["state-warning-bold"].dark},"text-danger":{light:textSemantics["state-danger-bold"].light,dark:textSemantics["state-danger-bold"].dark},"text-info":{light:textSemantics["state-info-bold"].light,dark:textSemantics["state-info-bold"].dark},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark},"icon-success":{light:iconSemantics["state-success-bold"].light,dark:iconSemantics["state-success-bold"].dark},"icon-warning":{light:iconSemantics["state-warning-bold"].light,dark:iconSemantics["state-warning-bold"].dark},"icon-danger":{light:iconSemantics["state-danger-bold"].light,dark:iconSemantics["state-danger-bold"].dark},"icon-info":{light:iconSemantics["state-info-bold"].light,dark:iconSemantics["state-info-bold"].dark},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark}},textAreaSemantics={"background-default":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-hover":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-pressed":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-focus":{light:colorPrimitives["white-100"],dark:colorBrands["neutral-800"]},"background-disabled":{light:surfaceSemantics["state-disabled"].light,dark:surfaceSemantics["state-disabled"].dark},"background-success":{light:colorBrands["success-100"],dark:colorBrands["success-200"]},"background-danger":{light:colorBrands["danger-100"],dark:colorBrands["danger-200"]},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-placeholder":{light:colorBrands["neutral-400"],dark:colorBrands["neutral-600"]},"text-secondary":{light:colorBrands["neutral-600"],dark:colorBrands["neutral-500"]},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"text-success":{light:textSemantics["state-success-bold"].light,dark:textSemantics["state-success-subtle"].dark},"text-danger":{light:textSemantics["state-danger-bold"].light,dark:textSemantics["state-danger-subtle"].dark},"icon-default":{light:iconSemantics.tertiary.light,dark:iconSemantics.secondary.dark},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark},"icon-success":{light:iconSemantics["state-success-bold"].light,dark:iconSemantics["state-success-subtle"].dark},"icon-danger":{light:iconSemantics["state-danger-bold"].light,dark:iconSemantics["state-danger-subtle"].dark},"stroke-default":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"stroke-hover":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"stroke-focus":{light:colorBrands["primary-300"],dark:colorBrands["primary-300"]},"stroke-pressed":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"stroke-disabled":{light:colorBrands["neutral-300"],dark:colorBrands["neutral-900"]},"stroke-success":{light:colorBrands["success-500"],dark:colorBrands["success-400"]},"stroke-danger":{light:colorBrands["danger-400"],dark:colorBrands["danger-400"]}},toastSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"background-success":{light:colorPrimitives["white-100"],dark:surfaceSemantics["state-success-bold"].dark},"background-warning":{light:surfaceSemantics["state-danger-bold"].light,dark:surfaceSemantics["state-danger-bold"].dark},"background-error":{light:surfaceSemantics["state-warning-bold"].light,dark:surfaceSemantics["state-warning-bold"].dark},"background-info":{light:surfaceSemantics["state-info-bold"].light,dark:surfaceSemantics["state-info-bold"].dark},"stroke-bg":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-secondary":{light:textSemantics.secondary.light,dark:textSemantics.secondary.dark},"text-link":{light:colorPrimitives["pink-700"],dark:colorPrimitives["pink-400"]},"icon-success":{light:colorPrimitives["green-400"],dark:colorBrands["success-300"]},"icon-warning":{light:colorPrimitives["red-700"],dark:colorBrands["danger-600"]},"icon-error":{light:colorPrimitives["yellow-400"],dark:colorBrands["warning-300"]},"icon-info":{light:colorPrimitives["blue-600"],dark:colorBrands["info-500"]},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark}},tooltipSemantics={"background-default":{light:surfaceSemantics.primary.light,dark:surfaceSemantics.primary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-primary":{light:textSemantics.secondary.light,dark:textSemantics.secondary.dark}},sliderSemantics={"stroke-default":{light:strokeSemantics.secondary.light,dark:strokeSemantics.secondary.dark},"icon-default":{light:colorPrimitives["white-100"],dark:colorPrimitives["white-100"]},"background-default":{light:surfaceSemantics.secondary.light,dark:surfaceSemantics.secondary.dark},"background-progress":{light:surfaceSemantics["brand-medium"].light,dark:surfaceSemantics["brand-medium"].dark}},spinnerSemantics={"icon-primary":{light:colorBrands["primary-500"],dark:colorBrands["primary-500"]},"icon-secondary":{light:colorBrands["neutral-1000"],dark:colorBrands["neutral-100"]}},tableSemantics={"stroke-default":{light:strokeSemantics.tertiary.light,dark:strokeSemantics.tertiary.dark},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-heading":{light:textSemantics.tertiary.light,dark:textSemantics.tertiary.dark},"text-disabled":{light:textSemantics["state-disabled"].light,dark:textSemantics["state-disabled"].dark},"icon-default":{light:iconSemantics.primary.light,dark:iconSemantics.primary.dark},"icon-disabled":{light:iconSemantics["state-disabled"].light,dark:iconSemantics["state-disabled"].dark}},pillSemantics={"background-default":{light:colorBrands["neutral-100"],dark:colorBrands["neutral-700"]},"background-selected":{light:surfaceSemantics["primary-inverse"].light,dark:surfaceSemantics["primary-inverse"].dark},"background-hover":{light:colorBrands["neutral-200"],dark:colorBrands["neutral-800"]},"text-default":{light:textSemantics.primary.light,dark:textSemantics.primary.dark},"text-selected":{light:textSemantics["primary-inverse"].light,dark:textSemantics["primary-inverse"].dark}},semanticKeys={alert:"components-alert",buttonPrimary:"components-button-primary",buttonSecondary:"components-button-secondary",buttonTertiary:"components-button-tertiary",buttonOutline:"components-button-outline",buttonDanger:"components-button-danger",buttonDangerSecondary:"components-button-danger-secondary",checkbox:"components-checkbox",icon:"icon",input:"components-inputs",listItem:"components-list-item",modal:"components-modal",notifications:"components-in-app-notification",pagination:"components-pagination",pill:"components-pill",progressBar:"components-progress-bar",radio:"components-radio-button",surface:"surface",stroke:"stroke",skeleton:"components-skeleton-loader",table:"components-table",tag:"components-tag",text:"text",textArea:"components-textarea",toast:"components-toast",toggle:"components-toggle-switch",tooltip:"components-tooltip",slider:"components-slider",spinner:"components-spinner"},colorSemantics={[semanticKeys.alert]:alertSemantics,[semanticKeys.buttonPrimary]:primaryButtonSemantics,[semanticKeys.buttonSecondary]:secondaryButtonSemantics,[semanticKeys.buttonTertiary]:tertiaryButtonSemantics,[semanticKeys.buttonOutline]:outlineButtonSemantics,[semanticKeys.buttonDanger]:dangerButtonSemantics,[semanticKeys.buttonDangerSecondary]:dangerSecondaryButtonSemantics,[semanticKeys.checkbox]:checkboxSemantics,[semanticKeys.icon]:iconSemantics,[semanticKeys.input]:inputSemantics,[semanticKeys.listItem]:listItemSemantics,[semanticKeys.modal]:modalSemantics,[semanticKeys.notifications]:notificationsSemantics,[semanticKeys.pagination]:paginationSemantics,[semanticKeys.pill]:pillSemantics,[semanticKeys.progressBar]:progressBarSemantics,[semanticKeys.radio]:radioSemantics,[semanticKeys.surface]:surfaceSemantics,[semanticKeys.stroke]:strokeSemantics,[semanticKeys.skeleton]:skeletonSemantics,[semanticKeys.table]:tableSemantics,[semanticKeys.tag]:tagSemantics,[semanticKeys.text]:textSemantics,[semanticKeys.textArea]:textAreaSemantics,[semanticKeys.toast]:toastSemantics,[semanticKeys.toggle]:switchSemantics,[semanticKeys.tooltip]:tooltipSemantics,[semanticKeys.slider]:sliderSemantics,[semanticKeys.spinner]:spinnerSemantics},blurVariables={"blur-xs":"8px","blur-sm":"16px","blur-md":"24px","blur-lg":"40px","blur-xl":"72px","blur-xxl":"128px"},borderRadiusVariables={"radius-none":"0px","radius-xxxs":"4px","radius-xxs":"8px","radius-xs":"12px","radius-sm":"16px","radius-md":"24px","radius-lg":"32px","radius-xl":"40px","radius-xxl":"48px","radius-xxxl":"64px","radius-round":"1000px"},borderSizeVariables={"border-none":"0px","border-xs":"0.5px","border-sm":"1px","border-xmd":"1.5px","border-md":"2px","border-lg":"3px","border-xl":"4px"},opacityVariables={"opacity-0":"0","opacity-10":"0.1","opacity-20":"0.2","opacity-30":"0.3","opacity-40":"0.4","opacity-50":"0.5","opacity-60":"0.6","opacity-70":"0.7","opacity-80":"0.8","opacity-90":"0.9","opacity-100":"1"},spacingVariables={"spacing-none":"0px","spacing-xxxs":"4px","spacing-xxs":"8px","spacing-xs":"12px","spacing-sm":"16px","spacing-md":"24px","spacing-lg":"32px","spacing-xl":"40px","spacing-xxl":"48px","spacing-xxxl":"64px"},getThemeColors=fr=>Object.entries(colorSemantics).reduce((br,[wr,Er])=>(Object.entries(Er).forEach(([kr,jr])=>{br[`${wr}-${kr}`]=jr[fr]}),br),{}),createTheme=fr=>({colors:getThemeColors(fr),blur:blurVariables,borderRadius:borderRadiusVariables,borderSize:borderSizeVariables,opacity:opacityVariables,spacing:spacingVariables}),getBlocksCSSVariables=fr=>Object.values(fr).map(br=>Object.entries(br).map(([wr,Er])=>`--${wr}: ${Er};`).join("")).join(""),blocksTheme={light:createTheme("light"),dark:createTheme("dark")},radiusRegex=/\bradius-[a-z]+\b/g,spacingRegex=/\bspacing-[a-z]+\b/g,textVariants={"dl-bold":{fontSize:"72px",fontStyle:null,fontWeight:"700",lineHeight:"92.16px",letterSpacing:"-1.5px",textTransform:null},"dl-semibold":{fontSize:"72px",fontStyle:null,fontWeight:"500",lineHeight:"92.16px",letterSpacing:"-1.5px",textTransform:null},"dl-regular":{fontSize:"72px",fontStyle:null,fontWeight:"400",lineHeight:"92.16px",letterSpacing:"-1.5px",textTransform:null},"ds-bold":{fontSize:"58px",fontStyle:null,fontWeight:"700",lineHeight:"74.24px",letterSpacing:"-0.5px",textTransform:null},"ds-semibold":{fontSize:"58px",fontStyle:null,fontWeight:"500",lineHeight:"74.24px",letterSpacing:"-0.5px",textTransform:null},"ds-regular":{fontSize:"58px",fontStyle:null,fontWeight:"400",lineHeight:"74.24px",letterSpacing:"-0.5px",textTransform:null},"h1-bold":{fontSize:"48px",fontStyle:null,fontWeight:"700",lineHeight:"62px",letterSpacing:null,textTransform:null},"h2-bold":{fontSize:"34px",fontStyle:null,fontWeight:"700",lineHeight:"48px",letterSpacing:null,textTransform:null},"h3-bold":{fontSize:"26px",fontStyle:null,fontWeight:"700",lineHeight:"36px",letterSpacing:null,textTransform:null},"h4-bold":{fontSize:"20px",fontStyle:null,fontWeight:"700",lineHeight:"30px",letterSpacing:null,textTransform:null},"h5-bold":{fontSize:"16px",fontStyle:null,fontWeight:"700",lineHeight:"23px",letterSpacing:null,textTransform:null},"h6-bold":{fontSize:"14px",fontStyle:null,fontWeight:"700",lineHeight:"21px",letterSpacing:null,textTransform:null},"h1-semibold":{fontSize:"48px",fontStyle:null,fontWeight:"500",lineHeight:"62px",letterSpacing:null,textTransform:null},"h2-semibold":{fontSize:"34px",fontStyle:null,fontWeight:"500",lineHeight:"48px",letterSpacing:null,textTransform:null},"h3-semibold":{fontSize:"26px",fontStyle:null,fontWeight:"500",lineHeight:"36px",letterSpacing:null,textTransform:null},"h4-semibold":{fontSize:"20px",fontStyle:null,fontWeight:"500",lineHeight:"30px",letterSpacing:null,textTransform:null},"h5-semibold":{fontSize:"16px",fontStyle:null,fontWeight:"500",lineHeight:"23px",letterSpacing:null,textTransform:null},"h6-semibold":{fontSize:"14px",fontStyle:null,fontWeight:"500",lineHeight:"21px",letterSpacing:null,textTransform:null},"h1-regular":{fontSize:"48px",fontStyle:null,fontWeight:"400",lineHeight:"62px",letterSpacing:null,textTransform:null},"h2-regular":{fontSize:"34px",fontStyle:null,fontWeight:"400",lineHeight:"48px",letterSpacing:null,textTransform:null},"h3-regular":{fontSize:"26px",fontStyle:null,fontWeight:"400",lineHeight:"36px",letterSpacing:null,textTransform:null},"h4-regular":{fontSize:"20px",fontStyle:null,fontWeight:"400",lineHeight:"30px",letterSpacing:null,textTransform:null},"h5-regular":{fontSize:"16px",fontStyle:null,fontWeight:"400",lineHeight:"23px",letterSpacing:null,textTransform:null},"h6-regular":{fontSize:"14px",fontStyle:null,fontWeight:"400",lineHeight:"21px",letterSpacing:null,textTransform:null},"bl-bold":{fontSize:"18px",fontStyle:null,fontWeight:"700",lineHeight:"27px",letterSpacing:"0.5px",textTransform:null},"bl-semibold":{fontSize:"18px",fontStyle:null,fontWeight:"500",lineHeight:"27px",letterSpacing:null,textTransform:null},"bl-regular":{fontSize:"18px",fontStyle:null,fontWeight:"400",lineHeight:"27px",letterSpacing:null,textTransform:null},"bl-bold-italic":{fontSize:"18px",fontStyle:"italic",fontWeight:"400",lineHeight:"27px",letterSpacing:null,textTransform:null},"bm-bold":{fontSize:"16px",fontStyle:null,fontWeight:"700",lineHeight:"22px",letterSpacing:null,textTransform:null},"bm-semibold":{fontSize:"16px",fontStyle:null,fontWeight:"500",lineHeight:"22px",letterSpacing:null,textTransform:null},"bm-regular":{fontSize:"16px",fontStyle:null,fontWeight:"400",lineHeight:"22px",letterSpacing:null,textTransform:null},"bm-regular-italic":{fontSize:"16px",fontStyle:"italic",fontWeight:"400",lineHeight:"22px",letterSpacing:null,textTransform:null},"bs-bold":{fontSize:"14px",fontStyle:null,fontWeight:"700",lineHeight:"20px",letterSpacing:null,textTransform:null},"bs-semibold":{fontSize:"14px",fontStyle:null,fontWeight:"500",lineHeight:"20px",letterSpacing:null,textTransform:null},"bs-regular":{fontSize:"14px",fontStyle:null,fontWeight:"400",lineHeight:"20px",letterSpacing:null,textTransform:null},"bs-regular-italic":{fontSize:"14px",fontStyle:"italic",fontWeight:"400",lineHeight:"20px",letterSpacing:null,textTransform:null},"bes-bold":{fontSize:"12px",fontStyle:null,fontWeight:"700",lineHeight:"18px",letterSpacing:null,textTransform:null},"bes-semibold":{fontSize:"12px",fontStyle:null,fontWeight:"500",lineHeight:"18px",letterSpacing:null,textTransform:null},"bes-regular":{fontSize:"12px",fontStyle:null,fontWeight:"400",lineHeight:"18px",letterSpacing:null,textTransform:null},"bes-regular-italic":{fontSize:"12px",fontStyle:"italic",fontWeight:"400",lineHeight:"18px",letterSpacing:null,textTransform:null},"ol-bold":{fontSize:"12px",fontStyle:null,fontWeight:"700",lineHeight:"16px",letterSpacing:null,textTransform:"uppercase"},"ol-regular":{fontSize:"12px",fontStyle:null,fontWeight:"500",lineHeight:"16px",letterSpacing:null,textTransform:"uppercase"},"os-bold":{fontSize:"10px",fontStyle:null,fontWeight:"700",lineHeight:"14px",letterSpacing:null,textTransform:"uppercase"},"os-regular":{fontSize:"10px",fontStyle:null,fontWeight:"500",lineHeight:"14px",letterSpacing:null,textTransform:"uppercase"},"c-regular":{fontSize:"12px",fontStyle:null,fontWeight:"400",lineHeight:"16px",letterSpacing:null,textTransform:null},"c-semibold":{fontSize:"12px",fontStyle:null,fontWeight:500,lineHeight:"16px",letterSpacing:null,textTransform:null},"c-bold":{fontSize:"12px",fontStyle:null,fontWeight:"700",lineHeight:"16px",letterSpacing:null,textTransform:null},"cs-regular":{fontSize:"10px",fontStyle:null,fontWeight:"400",lineHeight:"14px",letterSpacing:null,textTransform:null},"cs-semibold":{fontSize:"10px",fontStyle:null,fontWeight:500,lineHeight:"14px",letterSpacing:null,textTransform:null},"cs-bold":{fontSize:"12px",fontStyle:null,fontWeight:"700",lineHeight:"14px",letterSpacing:null,textTransform:null}},getVariantStyles=fr=>{if(fr){const br=textVariants[fr];return Ae$2` font-size: ${br.fontSize}; ${br.fontStyle?`font-style: ${br.fontStyle};`:""} font-weight: ${br.fontWeight}; @@ -969,7 +969,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${br.d `;qe$2.div` ${({size:fr})=>getTextVariantStyles(fr==="small"?"bes-regular":fr==="medium"?"bs-regular":"bm-regular","components-modal-text-secondary")} `;var It$2=fr=>{switch(fr){case"success":return Ut$1;case"info":return Kt$2;case"warning":return Ot$2;case"error":return Jt$2;default:return null}},_t$1=Array(12).fill(0),kt$1=({visible:fr,className:br})=>t$7.createElement("div",{className:["sonner-loading-wrapper",br].filter(Boolean).join(" "),"data-visible":fr},t$7.createElement("div",{className:"sonner-spinner"},_t$1.map((wr,Er)=>t$7.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${Er}`})))),Ut$1=t$7.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},t$7.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Ot$2=t$7.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},t$7.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Kt$2=t$7.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},t$7.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Jt$2=t$7.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},t$7.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Dt$1=t$7.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},t$7.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t$7.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Mt$2=()=>{let[fr,br]=t$7.useState(document.hidden);return t$7.useEffect(()=>{let wr=()=>{br(document.hidden)};return document.addEventListener("visibilitychange",wr),()=>window.removeEventListener("visibilitychange",wr)},[]),fr},mt$2=1,pt$2=class{constructor(){this.subscribe=br=>(this.subscribers.push(br),()=>{let wr=this.subscribers.indexOf(br);this.subscribers.splice(wr,1)}),this.publish=br=>{this.subscribers.forEach(wr=>wr(br))},this.addToast=br=>{this.publish(br),this.toasts=[...this.toasts,br]},this.create=br=>{var wr;let{message:Er,...kr}=br,jr=typeof(br==null?void 0:br.id)=="number"||((wr=br.id)==null?void 0:wr.length)>0?br.id:mt$2++,Br=this.toasts.find(qr=>qr.id===jr),Wr=br.dismissible===void 0?!0:br.dismissible;return Br?this.toasts=this.toasts.map(qr=>qr.id===jr?(this.publish({...qr,...br,id:jr,title:Er}),{...qr,...br,id:jr,dismissible:Wr,title:Er}):qr):this.addToast({title:Er,...kr,dismissible:Wr,id:jr}),jr},this.dismiss=br=>(br||this.toasts.forEach(wr=>{this.subscribers.forEach(Er=>Er({id:wr.id,dismiss:!0}))}),this.subscribers.forEach(wr=>wr({id:br,dismiss:!0})),br),this.message=(br,wr)=>this.create({...wr,message:br}),this.error=(br,wr)=>this.create({...wr,message:br,type:"error"}),this.success=(br,wr)=>this.create({...wr,type:"success",message:br}),this.info=(br,wr)=>this.create({...wr,type:"info",message:br}),this.warning=(br,wr)=>this.create({...wr,type:"warning",message:br}),this.loading=(br,wr)=>this.create({...wr,type:"loading",message:br}),this.promise=(br,wr)=>{if(!wr)return;let Er;wr.loading!==void 0&&(Er=this.create({...wr,promise:br,type:"loading",message:wr.loading,description:typeof wr.description!="function"?wr.description:void 0}));let kr=br instanceof Promise?br:br(),jr=Er!==void 0,Br,Wr=kr.then(async Gr=>{if(Br=["resolve",Gr],t$7.isValidElement(Gr))jr=!1,this.create({id:Er,type:"default",message:Gr});else if(Qt$1(Gr)&&!Gr.ok){jr=!1;let Vr=typeof wr.error=="function"?await wr.error(`HTTP error! status: ${Gr.status}`):wr.error,Zr=typeof wr.description=="function"?await wr.description(`HTTP error! status: ${Gr.status}`):wr.description;this.create({id:Er,type:"error",message:Vr,description:Zr})}else if(wr.success!==void 0){jr=!1;let Vr=typeof wr.success=="function"?await wr.success(Gr):wr.success,Zr=typeof wr.description=="function"?await wr.description(Gr):wr.description;this.create({id:Er,type:"success",message:Vr,description:Zr})}}).catch(async Gr=>{if(Br=["reject",Gr],wr.error!==void 0){jr=!1;let Vr=typeof wr.error=="function"?await wr.error(Gr):wr.error,Zr=typeof wr.description=="function"?await wr.description(Gr):wr.description;this.create({id:Er,type:"error",message:Vr,description:Zr})}}).finally(()=>{var Gr;jr&&(this.dismiss(Er),Er=void 0),(Gr=wr.finally)==null||Gr.call(wr)}),qr=()=>new Promise((Gr,Vr)=>Wr.then(()=>Br[0]==="reject"?Vr(Br[1]):Gr(Br[1])).catch(Vr));return typeof Er!="string"&&typeof Er!="number"?{unwrap:qr}:Object.assign(Er,{unwrap:qr})},this.custom=(br,wr)=>{let Er=(wr==null?void 0:wr.id)||mt$2++;return this.create({jsx:br(Er),id:Er,...wr}),Er},this.subscribers=[],this.toasts=[]}},v$9=new pt$2,Gt$2=(fr,br)=>{let wr=(br==null?void 0:br.id)||mt$2++;return v$9.addToast({title:fr,...br,id:wr}),wr},Qt$1=fr=>fr&&typeof fr=="object"&&"ok"in fr&&typeof fr.ok=="boolean"&&"status"in fr&&typeof fr.status=="number",qt$2=Gt$2,Zt$1=()=>v$9.toasts;Object.assign(qt$2,{success:v$9.success,info:v$9.info,warning:v$9.warning,error:v$9.error,custom:v$9.custom,message:v$9.message,promise:v$9.promise,dismiss:v$9.dismiss,loading:v$9.loading},{getHistory:Zt$1});function gt$2(fr,{insertAt:br}={}){if(typeof document>"u")return;let wr=document.head||document.getElementsByTagName("head")[0],Er=document.createElement("style");Er.type="text/css",br==="top"&&wr.firstChild?wr.insertBefore(Er,wr.firstChild):wr.appendChild(Er),Er.styleSheet?Er.styleSheet.cssText=fr:Er.appendChild(document.createTextNode(fr))}gt$2(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:max(var(--offset),env(safe-area-inset-right))}:where([data-sonner-toaster][data-x-position="left"]){left:max(var(--offset),env(safe-area-inset-left))}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:max(var(--offset),env(safe-area-inset-top))}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:max(var(--offset),env(safe-area-inset-bottom))}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:0;right:0;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} -`);function O$6(fr){return fr.label!==void 0}var ae$2=3,ne="32px",At$1=4e3,re$1=356,se=14,ie$1=20,le$2=200;function de$2(...fr){return fr.filter(Boolean).join(" ")}var ce$3=fr=>{var br,wr,Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr;let{invert:Jr,toast:Qr,unstyled:_n,interacting:En,setHeights:Cn,visibleToasts:In,heights:An,index:jn,toasts:eo,expanded:ro,removeToast:to,defaultRichColors:_i,closeButton:oo,style:io,cancelButtonStyle:co,actionButtonStyle:so,className:no="",descriptionClassName:Tn="",duration:Hr,position:Xr,gap:Sn,loadingIcon:Rn,expandByDefault:Pn,classNames:On,icons:Zn,closeButtonAriaLabel:Nn="Close toast",pauseWhenPageIsHidden:wn,cn:zn}=fr,[fo,vo]=t$7.useState(!1),[go,uo]=t$7.useState(!1),[lo,Eo]=t$7.useState(!1),[mo,yo]=t$7.useState(!1),[_o,Bo]=t$7.useState(!1),[Lo,Wo]=t$7.useState(0),[na,qo]=t$7.useState(0),ga=t$7.useRef(Qr.duration||Hr||At$1),wl=t$7.useRef(null),No=t$7.useRef(null),Fo=jn===0,Nl=jn+1<=In,Vo=Qr.type,Uo=Qr.dismissible!==!1,Ml=Qr.className||"",$a=Qr.descriptionClassName||"",Jo=t$7.useMemo(()=>An.findIndex(xl=>xl.toastId===Qr.id)||0,[An,Qr.id]),Zl=t$7.useMemo(()=>{var xl;return(xl=Qr.closeButton)!=null?xl:oo},[Qr.closeButton,oo]);t$7.useMemo(()=>Qr.duration||Hr||At$1,[Qr.duration,Hr]);let Cl=t$7.useRef(0),ko=t$7.useRef(0),wo=t$7.useRef(0),bo=t$7.useRef(null),[Io,Ho]=Xr.split("-"),Do=t$7.useMemo(()=>An.reduce((xl,Tl,du)=>du>=Jo?xl:xl+Tl.height,0),[An,Jo]),zo=Mt$2(),nu=Qr.invert||Jr,Ll=Vo==="loading";ko.current=t$7.useMemo(()=>Jo*Sn+Do,[Jo,Do]),t$7.useEffect(()=>{vo(!0)},[]),t$7.useEffect(()=>{let xl=No.current;if(xl){let Tl=xl.getBoundingClientRect().height;return qo(Tl),Cn(du=>[{toastId:Qr.id,height:Tl,position:Qr.position},...du]),()=>Cn(du=>du.filter(Bl=>Bl.toastId!==Qr.id))}},[Cn,Qr.id]),t$7.useLayoutEffect(()=>{if(!fo)return;let xl=No.current,Tl=xl.style.height;xl.style.height="auto";let du=xl.getBoundingClientRect().height;xl.style.height=Tl,qo(du),Cn(Bl=>Bl.find(Il=>Il.toastId===Qr.id)?Bl.map(Il=>Il.toastId===Qr.id?{...Il,height:du}:Il):[{toastId:Qr.id,height:du,position:Qr.position},...Bl])},[fo,Qr.title,Qr.description,Cn,Qr.id]);let _l=t$7.useCallback(()=>{uo(!0),Wo(ko.current),Cn(xl=>xl.filter(Tl=>Tl.toastId!==Qr.id)),setTimeout(()=>{to(Qr)},le$2)},[Qr,to,Cn,ko]);t$7.useEffect(()=>{if(Qr.promise&&Vo==="loading"||Qr.duration===1/0||Qr.type==="loading")return;let xl;return ro||En||wn&&zo?(()=>{if(wo.current{var Tl;(Tl=Qr.onAutoClose)==null||Tl.call(Qr,Qr),_l()},ga.current)),()=>clearTimeout(xl)},[ro,En,Qr,Vo,wn,zo,_l]),t$7.useEffect(()=>{Qr.delete&&_l()},[_l,Qr.delete]);function bu(){var xl,Tl,du;return Zn!=null&&Zn.loading?t$7.createElement("div",{className:zn(On==null?void 0:On.loader,(xl=Qr==null?void 0:Qr.classNames)==null?void 0:xl.loader,"sonner-loader"),"data-visible":Vo==="loading"},Zn.loading):Rn?t$7.createElement("div",{className:zn(On==null?void 0:On.loader,(Tl=Qr==null?void 0:Qr.classNames)==null?void 0:Tl.loader,"sonner-loader"),"data-visible":Vo==="loading"},Rn):t$7.createElement(kt$1,{className:zn(On==null?void 0:On.loader,(du=Qr==null?void 0:Qr.classNames)==null?void 0:du.loader),visible:Vo==="loading"})}return t$7.createElement("li",{tabIndex:0,ref:No,className:zn(no,Ml,On==null?void 0:On.toast,(br=Qr==null?void 0:Qr.classNames)==null?void 0:br.toast,On==null?void 0:On.default,On==null?void 0:On[Vo],(wr=Qr==null?void 0:Qr.classNames)==null?void 0:wr[Vo]),"data-sonner-toast":"","data-rich-colors":(Er=Qr.richColors)!=null?Er:_i,"data-styled":!(Qr.jsx||Qr.unstyled||_n),"data-mounted":fo,"data-promise":!!Qr.promise,"data-swiped":_o,"data-removed":go,"data-visible":Nl,"data-y-position":Io,"data-x-position":Ho,"data-index":jn,"data-front":Fo,"data-swiping":lo,"data-dismissible":Uo,"data-type":Vo,"data-invert":nu,"data-swipe-out":mo,"data-expanded":!!(ro||Pn&&fo),style:{"--index":jn,"--toasts-before":jn,"--z-index":eo.length-jn,"--offset":`${go?Lo:ko.current}px`,"--initial-height":Pn?"auto":`${na}px`,...io,...Qr.style},onPointerDown:xl=>{Ll||!Uo||(wl.current=new Date,Wo(ko.current),xl.target.setPointerCapture(xl.pointerId),xl.target.tagName!=="BUTTON"&&(Eo(!0),bo.current={x:xl.clientX,y:xl.clientY}))},onPointerUp:()=>{var xl,Tl,du,Bl;if(mo||!Uo)return;bo.current=null;let Il=Number(((xl=No.current)==null?void 0:xl.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Eu=new Date().getTime()-((Tl=wl.current)==null?void 0:Tl.getTime()),Al=Math.abs(Il)/Eu;if(Math.abs(Il)>=ie$1||Al>.11){Wo(ko.current),(du=Qr.onDismiss)==null||du.call(Qr,Qr),_l(),yo(!0),Bo(!1);return}(Bl=No.current)==null||Bl.style.setProperty("--swipe-amount","0px"),Eo(!1)},onPointerMove:xl=>{var Tl,du,Bl;if(!bo.current||!Uo)return;let Il=xl.clientY-bo.current.y,Eu=((Tl=window.getSelection())==null?void 0:Tl.toString().length)>0;Number(((du=No.current)==null?void 0:du.style.getPropertyValue("--swipe-amount").replace("px",""))||0)>0&&Bo(!0),!Eu&&((Bl=No.current)==null||Bl.style.setProperty("--swipe-amount",`${Math.max(0,Il)}px`))}},Zl&&!Qr.jsx?t$7.createElement("button",{"aria-label":Nn,"data-disabled":Ll,"data-close-button":!0,onClick:Ll||!Uo?()=>{}:()=>{var xl;_l(),(xl=Qr.onDismiss)==null||xl.call(Qr,Qr)},className:zn(On==null?void 0:On.closeButton,(kr=Qr==null?void 0:Qr.classNames)==null?void 0:kr.closeButton)},(jr=Zn==null?void 0:Zn.close)!=null?jr:Dt$1):null,Qr.jsx||t$7.isValidElement(Qr.title)?Qr.jsx?Qr.jsx:typeof Qr.title=="function"?Qr.title():Qr.title:t$7.createElement(t$7.Fragment,null,Vo||Qr.icon||Qr.promise?t$7.createElement("div",{"data-icon":"",className:zn(On==null?void 0:On.icon,(Br=Qr==null?void 0:Qr.classNames)==null?void 0:Br.icon)},Qr.promise||Qr.type==="loading"&&!Qr.icon?Qr.icon||bu():null,Qr.type!=="loading"?Qr.icon||(Zn==null?void 0:Zn[Vo])||It$2(Vo):null):null,t$7.createElement("div",{"data-content":"",className:zn(On==null?void 0:On.content,(Wr=Qr==null?void 0:Qr.classNames)==null?void 0:Wr.content)},t$7.createElement("div",{"data-title":"",className:zn(On==null?void 0:On.title,(qr=Qr==null?void 0:Qr.classNames)==null?void 0:qr.title)},typeof Qr.title=="function"?Qr.title():Qr.title),Qr.description?t$7.createElement("div",{"data-description":"",className:zn(Tn,$a,On==null?void 0:On.description,(Gr=Qr==null?void 0:Qr.classNames)==null?void 0:Gr.description)},typeof Qr.description=="function"?Qr.description():Qr.description):null),t$7.isValidElement(Qr.cancel)?Qr.cancel:Qr.cancel&&O$6(Qr.cancel)?t$7.createElement("button",{"data-button":!0,"data-cancel":!0,style:Qr.cancelButtonStyle||co,onClick:xl=>{var Tl,du;O$6(Qr.cancel)&&Uo&&((du=(Tl=Qr.cancel).onClick)==null||du.call(Tl,xl),_l())},className:zn(On==null?void 0:On.cancelButton,(Vr=Qr==null?void 0:Qr.classNames)==null?void 0:Vr.cancelButton)},Qr.cancel.label):null,t$7.isValidElement(Qr.action)?Qr.action:Qr.action&&O$6(Qr.action)?t$7.createElement("button",{"data-button":!0,"data-action":!0,style:Qr.actionButtonStyle||so,onClick:xl=>{var Tl,du;O$6(Qr.action)&&((du=(Tl=Qr.action).onClick)==null||du.call(Tl,xl),!xl.defaultPrevented&&_l())},className:zn(On==null?void 0:On.actionButton,(Zr=Qr==null?void 0:Qr.classNames)==null?void 0:Zr.actionButton)},Qr.action.label):null))};function Lt$2(){if(typeof window>"u"||typeof document>"u")return"ltr";let fr=document.documentElement.getAttribute("dir");return fr==="auto"||!fr?window.getComputedStyle(document.documentElement).direction:fr}var Be$2=reactExports.forwardRef(function(fr,br){let{invert:wr,position:Er="bottom-right",hotkey:kr=["altKey","KeyT"],expand:jr,closeButton:Br,className:Wr,offset:qr,theme:Gr="light",richColors:Vr,duration:Zr,style:Jr,visibleToasts:Qr=ae$2,toastOptions:_n,dir:En=Lt$2(),gap:Cn=se,loadingIcon:In,icons:An,containerAriaLabel:jn="Notifications",pauseWhenPageIsHidden:eo,cn:ro=de$2}=fr,[to,_i]=t$7.useState([]),oo=t$7.useMemo(()=>Array.from(new Set([Er].concat(to.filter(wn=>wn.position).map(wn=>wn.position)))),[to,Er]),[io,co]=t$7.useState([]),[so,no]=t$7.useState(!1),[Tn,Hr]=t$7.useState(!1),[Xr,Sn]=t$7.useState(Gr!=="system"?Gr:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Rn=t$7.useRef(null),Pn=kr.join("+").replace(/Key/g,"").replace(/Digit/g,""),On=t$7.useRef(null),Zn=t$7.useRef(!1),Nn=t$7.useCallback(wn=>{_i(zn=>{var fo;return(fo=zn.find(vo=>vo.id===wn.id))!=null&&fo.delete||v$9.dismiss(wn.id),zn.filter(({id:vo})=>vo!==wn.id)})},[]);return t$7.useEffect(()=>v$9.subscribe(wn=>{if(wn.dismiss){_i(zn=>zn.map(fo=>fo.id===wn.id?{...fo,delete:!0}:fo));return}setTimeout(()=>{oe$3.flushSync(()=>{_i(zn=>{let fo=zn.findIndex(vo=>vo.id===wn.id);return fo!==-1?[...zn.slice(0,fo),{...zn[fo],...wn},...zn.slice(fo+1)]:[wn,...zn]})})})}),[]),t$7.useEffect(()=>{if(Gr!=="system"){Sn(Gr);return}if(Gr==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Sn("dark"):Sn("light")),typeof window>"u")return;let wn=window.matchMedia("(prefers-color-scheme: dark)");try{wn.addEventListener("change",({matches:zn})=>{Sn(zn?"dark":"light")})}catch{wn.addListener(({matches:fo})=>{try{Sn(fo?"dark":"light")}catch(vo){console.error(vo)}})}},[Gr]),t$7.useEffect(()=>{to.length<=1&&no(!1)},[to]),t$7.useEffect(()=>{let wn=zn=>{var fo,vo;kr.every(go=>zn[go]||zn.code===go)&&(no(!0),(fo=Rn.current)==null||fo.focus()),zn.code==="Escape"&&(document.activeElement===Rn.current||(vo=Rn.current)!=null&&vo.contains(document.activeElement))&&no(!1)};return document.addEventListener("keydown",wn),()=>document.removeEventListener("keydown",wn)},[kr]),t$7.useEffect(()=>{if(Rn.current)return()=>{On.current&&(On.current.focus({preventScroll:!0}),On.current=null,Zn.current=!1)}},[Rn.current]),t$7.createElement("section",{"aria-label":`${jn} ${Pn}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false"},oo.map((wn,zn)=>{var fo;let[vo,go]=wn.split("-");return to.length?t$7.createElement("ol",{key:wn,dir:En==="auto"?Lt$2():En,tabIndex:-1,ref:Rn,className:Wr,"data-sonner-toaster":!0,"data-theme":Xr,"data-y-position":vo,"data-lifted":so&&to.length>1&&!jr,"data-x-position":go,style:{"--front-toast-height":`${((fo=io[0])==null?void 0:fo.height)||0}px`,"--offset":typeof qr=="number"?`${qr}px`:qr||ne,"--width":`${re$1}px`,"--gap":`${Cn}px`,...Jr},onBlur:uo=>{Zn.current&&!uo.currentTarget.contains(uo.relatedTarget)&&(Zn.current=!1,On.current&&(On.current.focus({preventScroll:!0}),On.current=null))},onFocus:uo=>{uo.target instanceof HTMLElement&&uo.target.dataset.dismissible==="false"||Zn.current||(Zn.current=!0,On.current=uo.relatedTarget)},onMouseEnter:()=>no(!0),onMouseMove:()=>no(!0),onMouseLeave:()=>{Tn||no(!1)},onPointerDown:uo=>{uo.target instanceof HTMLElement&&uo.target.dataset.dismissible==="false"||Hr(!0)},onPointerUp:()=>Hr(!1)},to.filter(uo=>!uo.position&&zn===0||uo.position===wn).map((uo,lo)=>{var Eo,mo;return t$7.createElement(ce$3,{key:uo.id,icons:An,index:lo,toast:uo,defaultRichColors:Vr,duration:(Eo=_n==null?void 0:_n.duration)!=null?Eo:Zr,className:_n==null?void 0:_n.className,descriptionClassName:_n==null?void 0:_n.descriptionClassName,invert:wr,visibleToasts:Qr,closeButton:(mo=_n==null?void 0:_n.closeButton)!=null?mo:Br,interacting:Tn,position:wn,style:_n==null?void 0:_n.style,unstyled:_n==null?void 0:_n.unstyled,classNames:_n==null?void 0:_n.classNames,cancelButtonStyle:_n==null?void 0:_n.cancelButtonStyle,actionButtonStyle:_n==null?void 0:_n.actionButtonStyle,removeToast:Nn,toasts:to.filter(yo=>yo.position==uo.position),heights:io.filter(yo=>yo.position==uo.position),setHeights:co,expandByDefault:jr,gap:Cn,loadingIcon:In,expanded:so,pauseWhenPageIsHidden:eo,cn:ro})})):null}))});qe$2.div` +`);function O$6(fr){return fr.label!==void 0}var ae$2=3,ne="32px",At$1=4e3,re$1=356,se=14,ie$1=20,le$2=200;function de$2(...fr){return fr.filter(Boolean).join(" ")}var ce$3=fr=>{var br,wr,Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr;let{invert:Jr,toast:Qr,unstyled:_n,interacting:En,setHeights:Cn,visibleToasts:In,heights:An,index:jn,toasts:eo,expanded:ro,removeToast:to,defaultRichColors:_i,closeButton:oo,style:io,cancelButtonStyle:co,actionButtonStyle:so,className:no="",descriptionClassName:Tn="",duration:Hr,position:Xr,gap:Sn,loadingIcon:Rn,expandByDefault:Pn,classNames:On,icons:Zn,closeButtonAriaLabel:Nn="Close toast",pauseWhenPageIsHidden:wn,cn:zn}=fr,[fo,vo]=t$7.useState(!1),[go,uo]=t$7.useState(!1),[lo,Eo]=t$7.useState(!1),[mo,yo]=t$7.useState(!1),[_o,Bo]=t$7.useState(!1),[Lo,Wo]=t$7.useState(0),[na,qo]=t$7.useState(0),ga=t$7.useRef(Qr.duration||Hr||At$1),wl=t$7.useRef(null),No=t$7.useRef(null),Uo=jn===0,Nl=jn+1<=In,Vo=Qr.type,Fo=Qr.dismissible!==!1,Ol=Qr.className||"",$a=Qr.descriptionClassName||"",Jo=t$7.useMemo(()=>An.findIndex(xl=>xl.toastId===Qr.id)||0,[An,Qr.id]),Zl=t$7.useMemo(()=>{var xl;return(xl=Qr.closeButton)!=null?xl:oo},[Qr.closeButton,oo]);t$7.useMemo(()=>Qr.duration||Hr||At$1,[Qr.duration,Hr]);let Cl=t$7.useRef(0),ko=t$7.useRef(0),wo=t$7.useRef(0),bo=t$7.useRef(null),[Io,Ho]=Xr.split("-"),Do=t$7.useMemo(()=>An.reduce((xl,Tl,du)=>du>=Jo?xl:xl+Tl.height,0),[An,Jo]),zo=Mt$2(),nu=Qr.invert||Jr,Ll=Vo==="loading";ko.current=t$7.useMemo(()=>Jo*Sn+Do,[Jo,Do]),t$7.useEffect(()=>{vo(!0)},[]),t$7.useEffect(()=>{let xl=No.current;if(xl){let Tl=xl.getBoundingClientRect().height;return qo(Tl),Cn(du=>[{toastId:Qr.id,height:Tl,position:Qr.position},...du]),()=>Cn(du=>du.filter(Bl=>Bl.toastId!==Qr.id))}},[Cn,Qr.id]),t$7.useLayoutEffect(()=>{if(!fo)return;let xl=No.current,Tl=xl.style.height;xl.style.height="auto";let du=xl.getBoundingClientRect().height;xl.style.height=Tl,qo(du),Cn(Bl=>Bl.find(Il=>Il.toastId===Qr.id)?Bl.map(Il=>Il.toastId===Qr.id?{...Il,height:du}:Il):[{toastId:Qr.id,height:du,position:Qr.position},...Bl])},[fo,Qr.title,Qr.description,Cn,Qr.id]);let _l=t$7.useCallback(()=>{uo(!0),Wo(ko.current),Cn(xl=>xl.filter(Tl=>Tl.toastId!==Qr.id)),setTimeout(()=>{to(Qr)},le$2)},[Qr,to,Cn,ko]);t$7.useEffect(()=>{if(Qr.promise&&Vo==="loading"||Qr.duration===1/0||Qr.type==="loading")return;let xl;return ro||En||wn&&zo?(()=>{if(wo.current{var Tl;(Tl=Qr.onAutoClose)==null||Tl.call(Qr,Qr),_l()},ga.current)),()=>clearTimeout(xl)},[ro,En,Qr,Vo,wn,zo,_l]),t$7.useEffect(()=>{Qr.delete&&_l()},[_l,Qr.delete]);function bu(){var xl,Tl,du;return Zn!=null&&Zn.loading?t$7.createElement("div",{className:zn(On==null?void 0:On.loader,(xl=Qr==null?void 0:Qr.classNames)==null?void 0:xl.loader,"sonner-loader"),"data-visible":Vo==="loading"},Zn.loading):Rn?t$7.createElement("div",{className:zn(On==null?void 0:On.loader,(Tl=Qr==null?void 0:Qr.classNames)==null?void 0:Tl.loader,"sonner-loader"),"data-visible":Vo==="loading"},Rn):t$7.createElement(kt$1,{className:zn(On==null?void 0:On.loader,(du=Qr==null?void 0:Qr.classNames)==null?void 0:du.loader),visible:Vo==="loading"})}return t$7.createElement("li",{tabIndex:0,ref:No,className:zn(no,Ol,On==null?void 0:On.toast,(br=Qr==null?void 0:Qr.classNames)==null?void 0:br.toast,On==null?void 0:On.default,On==null?void 0:On[Vo],(wr=Qr==null?void 0:Qr.classNames)==null?void 0:wr[Vo]),"data-sonner-toast":"","data-rich-colors":(Er=Qr.richColors)!=null?Er:_i,"data-styled":!(Qr.jsx||Qr.unstyled||_n),"data-mounted":fo,"data-promise":!!Qr.promise,"data-swiped":_o,"data-removed":go,"data-visible":Nl,"data-y-position":Io,"data-x-position":Ho,"data-index":jn,"data-front":Uo,"data-swiping":lo,"data-dismissible":Fo,"data-type":Vo,"data-invert":nu,"data-swipe-out":mo,"data-expanded":!!(ro||Pn&&fo),style:{"--index":jn,"--toasts-before":jn,"--z-index":eo.length-jn,"--offset":`${go?Lo:ko.current}px`,"--initial-height":Pn?"auto":`${na}px`,...io,...Qr.style},onPointerDown:xl=>{Ll||!Fo||(wl.current=new Date,Wo(ko.current),xl.target.setPointerCapture(xl.pointerId),xl.target.tagName!=="BUTTON"&&(Eo(!0),bo.current={x:xl.clientX,y:xl.clientY}))},onPointerUp:()=>{var xl,Tl,du,Bl;if(mo||!Fo)return;bo.current=null;let Il=Number(((xl=No.current)==null?void 0:xl.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Eu=new Date().getTime()-((Tl=wl.current)==null?void 0:Tl.getTime()),Al=Math.abs(Il)/Eu;if(Math.abs(Il)>=ie$1||Al>.11){Wo(ko.current),(du=Qr.onDismiss)==null||du.call(Qr,Qr),_l(),yo(!0),Bo(!1);return}(Bl=No.current)==null||Bl.style.setProperty("--swipe-amount","0px"),Eo(!1)},onPointerMove:xl=>{var Tl,du,Bl;if(!bo.current||!Fo)return;let Il=xl.clientY-bo.current.y,Eu=((Tl=window.getSelection())==null?void 0:Tl.toString().length)>0;Number(((du=No.current)==null?void 0:du.style.getPropertyValue("--swipe-amount").replace("px",""))||0)>0&&Bo(!0),!Eu&&((Bl=No.current)==null||Bl.style.setProperty("--swipe-amount",`${Math.max(0,Il)}px`))}},Zl&&!Qr.jsx?t$7.createElement("button",{"aria-label":Nn,"data-disabled":Ll,"data-close-button":!0,onClick:Ll||!Fo?()=>{}:()=>{var xl;_l(),(xl=Qr.onDismiss)==null||xl.call(Qr,Qr)},className:zn(On==null?void 0:On.closeButton,(kr=Qr==null?void 0:Qr.classNames)==null?void 0:kr.closeButton)},(jr=Zn==null?void 0:Zn.close)!=null?jr:Dt$1):null,Qr.jsx||t$7.isValidElement(Qr.title)?Qr.jsx?Qr.jsx:typeof Qr.title=="function"?Qr.title():Qr.title:t$7.createElement(t$7.Fragment,null,Vo||Qr.icon||Qr.promise?t$7.createElement("div",{"data-icon":"",className:zn(On==null?void 0:On.icon,(Br=Qr==null?void 0:Qr.classNames)==null?void 0:Br.icon)},Qr.promise||Qr.type==="loading"&&!Qr.icon?Qr.icon||bu():null,Qr.type!=="loading"?Qr.icon||(Zn==null?void 0:Zn[Vo])||It$2(Vo):null):null,t$7.createElement("div",{"data-content":"",className:zn(On==null?void 0:On.content,(Wr=Qr==null?void 0:Qr.classNames)==null?void 0:Wr.content)},t$7.createElement("div",{"data-title":"",className:zn(On==null?void 0:On.title,(qr=Qr==null?void 0:Qr.classNames)==null?void 0:qr.title)},typeof Qr.title=="function"?Qr.title():Qr.title),Qr.description?t$7.createElement("div",{"data-description":"",className:zn(Tn,$a,On==null?void 0:On.description,(Gr=Qr==null?void 0:Qr.classNames)==null?void 0:Gr.description)},typeof Qr.description=="function"?Qr.description():Qr.description):null),t$7.isValidElement(Qr.cancel)?Qr.cancel:Qr.cancel&&O$6(Qr.cancel)?t$7.createElement("button",{"data-button":!0,"data-cancel":!0,style:Qr.cancelButtonStyle||co,onClick:xl=>{var Tl,du;O$6(Qr.cancel)&&Fo&&((du=(Tl=Qr.cancel).onClick)==null||du.call(Tl,xl),_l())},className:zn(On==null?void 0:On.cancelButton,(Vr=Qr==null?void 0:Qr.classNames)==null?void 0:Vr.cancelButton)},Qr.cancel.label):null,t$7.isValidElement(Qr.action)?Qr.action:Qr.action&&O$6(Qr.action)?t$7.createElement("button",{"data-button":!0,"data-action":!0,style:Qr.actionButtonStyle||so,onClick:xl=>{var Tl,du;O$6(Qr.action)&&((du=(Tl=Qr.action).onClick)==null||du.call(Tl,xl),!xl.defaultPrevented&&_l())},className:zn(On==null?void 0:On.actionButton,(Zr=Qr==null?void 0:Qr.classNames)==null?void 0:Zr.actionButton)},Qr.action.label):null))};function Lt$2(){if(typeof window>"u"||typeof document>"u")return"ltr";let fr=document.documentElement.getAttribute("dir");return fr==="auto"||!fr?window.getComputedStyle(document.documentElement).direction:fr}var Be$2=reactExports.forwardRef(function(fr,br){let{invert:wr,position:Er="bottom-right",hotkey:kr=["altKey","KeyT"],expand:jr,closeButton:Br,className:Wr,offset:qr,theme:Gr="light",richColors:Vr,duration:Zr,style:Jr,visibleToasts:Qr=ae$2,toastOptions:_n,dir:En=Lt$2(),gap:Cn=se,loadingIcon:In,icons:An,containerAriaLabel:jn="Notifications",pauseWhenPageIsHidden:eo,cn:ro=de$2}=fr,[to,_i]=t$7.useState([]),oo=t$7.useMemo(()=>Array.from(new Set([Er].concat(to.filter(wn=>wn.position).map(wn=>wn.position)))),[to,Er]),[io,co]=t$7.useState([]),[so,no]=t$7.useState(!1),[Tn,Hr]=t$7.useState(!1),[Xr,Sn]=t$7.useState(Gr!=="system"?Gr:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),Rn=t$7.useRef(null),Pn=kr.join("+").replace(/Key/g,"").replace(/Digit/g,""),On=t$7.useRef(null),Zn=t$7.useRef(!1),Nn=t$7.useCallback(wn=>{_i(zn=>{var fo;return(fo=zn.find(vo=>vo.id===wn.id))!=null&&fo.delete||v$9.dismiss(wn.id),zn.filter(({id:vo})=>vo!==wn.id)})},[]);return t$7.useEffect(()=>v$9.subscribe(wn=>{if(wn.dismiss){_i(zn=>zn.map(fo=>fo.id===wn.id?{...fo,delete:!0}:fo));return}setTimeout(()=>{oe$3.flushSync(()=>{_i(zn=>{let fo=zn.findIndex(vo=>vo.id===wn.id);return fo!==-1?[...zn.slice(0,fo),{...zn[fo],...wn},...zn.slice(fo+1)]:[wn,...zn]})})})}),[]),t$7.useEffect(()=>{if(Gr!=="system"){Sn(Gr);return}if(Gr==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Sn("dark"):Sn("light")),typeof window>"u")return;let wn=window.matchMedia("(prefers-color-scheme: dark)");try{wn.addEventListener("change",({matches:zn})=>{Sn(zn?"dark":"light")})}catch{wn.addListener(({matches:fo})=>{try{Sn(fo?"dark":"light")}catch(vo){console.error(vo)}})}},[Gr]),t$7.useEffect(()=>{to.length<=1&&no(!1)},[to]),t$7.useEffect(()=>{let wn=zn=>{var fo,vo;kr.every(go=>zn[go]||zn.code===go)&&(no(!0),(fo=Rn.current)==null||fo.focus()),zn.code==="Escape"&&(document.activeElement===Rn.current||(vo=Rn.current)!=null&&vo.contains(document.activeElement))&&no(!1)};return document.addEventListener("keydown",wn),()=>document.removeEventListener("keydown",wn)},[kr]),t$7.useEffect(()=>{if(Rn.current)return()=>{On.current&&(On.current.focus({preventScroll:!0}),On.current=null,Zn.current=!1)}},[Rn.current]),t$7.createElement("section",{"aria-label":`${jn} ${Pn}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false"},oo.map((wn,zn)=>{var fo;let[vo,go]=wn.split("-");return to.length?t$7.createElement("ol",{key:wn,dir:En==="auto"?Lt$2():En,tabIndex:-1,ref:Rn,className:Wr,"data-sonner-toaster":!0,"data-theme":Xr,"data-y-position":vo,"data-lifted":so&&to.length>1&&!jr,"data-x-position":go,style:{"--front-toast-height":`${((fo=io[0])==null?void 0:fo.height)||0}px`,"--offset":typeof qr=="number"?`${qr}px`:qr||ne,"--width":`${re$1}px`,"--gap":`${Cn}px`,...Jr},onBlur:uo=>{Zn.current&&!uo.currentTarget.contains(uo.relatedTarget)&&(Zn.current=!1,On.current&&(On.current.focus({preventScroll:!0}),On.current=null))},onFocus:uo=>{uo.target instanceof HTMLElement&&uo.target.dataset.dismissible==="false"||Zn.current||(Zn.current=!0,On.current=uo.relatedTarget)},onMouseEnter:()=>no(!0),onMouseMove:()=>no(!0),onMouseLeave:()=>{Tn||no(!1)},onPointerDown:uo=>{uo.target instanceof HTMLElement&&uo.target.dataset.dismissible==="false"||Hr(!0)},onPointerUp:()=>Hr(!1)},to.filter(uo=>!uo.position&&zn===0||uo.position===wn).map((uo,lo)=>{var Eo,mo;return t$7.createElement(ce$3,{key:uo.id,icons:An,index:lo,toast:uo,defaultRichColors:Vr,duration:(Eo=_n==null?void 0:_n.duration)!=null?Eo:Zr,className:_n==null?void 0:_n.className,descriptionClassName:_n==null?void 0:_n.descriptionClassName,invert:wr,visibleToasts:Qr,closeButton:(mo=_n==null?void 0:_n.closeButton)!=null?mo:Br,interacting:Tn,position:wn,style:_n==null?void 0:_n.style,unstyled:_n==null?void 0:_n.unstyled,classNames:_n==null?void 0:_n.classNames,cancelButtonStyle:_n==null?void 0:_n.cancelButtonStyle,actionButtonStyle:_n==null?void 0:_n.actionButtonStyle,removeToast:Nn,toasts:to.filter(yo=>yo.position==uo.position),heights:io.filter(yo=>yo.position==uo.position),setHeights:co,expandByDefault:jr,gap:Cn,loadingIcon:In,expanded:so,pauseWhenPageIsHidden:eo,cn:ro})})):null}))});qe$2.div` position: relative; background-color: var(--components-in-app-notification-background-default); border-radius: var(--radius-xxs); @@ -1048,7 +1048,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onSelect onTouchCancel onTouchEnd onTouchMove onTouchStart onScroll onWheel onAbort onCanPlay onCanPlayThrough onDurationChange onEmptied onEncrypted onEnded onError onLoadedData onLoadedMetadata - onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,propList="".concat(attributes," ").concat(eventsName).split(/[\s\n]+/),ariaPrefix="aria-",dataPrefix="data-";function match$1(fr,br){return fr.indexOf(br)===0}function pickAttrs(fr){var br=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,wr;br===!1?wr={aria:!0,data:!0,attr:!0}:br===!0?wr={aria:!0}:wr=_objectSpread2({},br);var Er={};return Object.keys(fr).forEach(function(kr){(wr.aria&&(kr==="role"||match$1(kr,ariaPrefix))||wr.data&&match$1(kr,dataPrefix)||wr.attr&&propList.includes(kr))&&(Er[kr]=fr[kr])}),Er}var locale$1={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"},defaultPageSizeOptions=["10","20","50","100"],Options=function(br){var wr=br.pageSizeOptions,Er=wr===void 0?defaultPageSizeOptions:wr,kr=br.locale,jr=br.changeSize,Br=br.pageSize,Wr=br.goButton,qr=br.quickGo,Gr=br.rootPrefixCls,Vr=br.selectComponentClass,Zr=br.selectPrefixCls,Jr=br.disabled,Qr=br.buildOptionText,_n=br.showSizeChanger,En=t$7.useState(""),Cn=_slicedToArray(En,2),In=Cn[0],An=Cn[1],jn=function(){return!In||Number.isNaN(In)?void 0:Number(In)},eo=typeof Qr=="function"?Qr:function(Pn){return"".concat(Pn," ").concat(kr.items_per_page)},ro=function(On,Zn){if(jr==null||jr(Number(On)),_typeof(_n)==="object"){var Nn;(Nn=_n.onChange)===null||Nn===void 0||Nn.call(_n,On,Zn)}},to=function(On){An(On.target.value)},_i=function(On){Wr||In===""||(An(""),!(On.relatedTarget&&(On.relatedTarget.className.indexOf("".concat(Gr,"-item-link"))>=0||On.relatedTarget.className.indexOf("".concat(Gr,"-item"))>=0))&&(qr==null||qr(jn())))},oo=function(On){In!==""&&(On.keyCode===KeyCode.ENTER||On.type==="click")&&(An(""),qr==null||qr(jn()))},io=function(){return Er.some(function(On){return On.toString()===Br.toString()})?Er:Er.concat([Br.toString()]).sort(function(On,Zn){var Nn=Number.isNaN(Number(On))?0:Number(On),wn=Number.isNaN(Number(Zn))?0:Number(Zn);return Nn-wn})},co="".concat(Gr,"-options");if(!_n&&!qr)return null;var so=null,no=null,Tn=null;if(_n&&Vr){var Hr=_typeof(_n)==="object"?_n:{},Xr=Hr.options,Sn=Hr.className,Rn=Xr?void 0:io().map(function(Pn,On){return t$7.createElement(Vr.Option,{key:On,value:Pn.toString()},eo(Pn))});so=t$7.createElement(Vr,_extends$1l({disabled:Jr,prefixCls:Zr,showSearch:!1,optionLabelProp:Xr?"label":"children",popupMatchSelectWidth:!1,value:(Br||Er[0]).toString(),getPopupContainer:function(On){return On.parentNode},"aria-label":kr.page_size,defaultOpen:!1},_typeof(_n)==="object"?_n:null,{className:classNames("".concat(co,"-size-changer"),Sn),options:Xr,onChange:ro}),Rn)}return qr&&(Wr&&(Tn=typeof Wr=="boolean"?t$7.createElement("button",{type:"button",onClick:oo,onKeyUp:oo,disabled:Jr,className:"".concat(co,"-quick-jumper-button")},kr.jump_to_confirm):t$7.createElement("span",{onClick:oo,onKeyUp:oo},Wr)),no=t$7.createElement("div",{className:"".concat(co,"-quick-jumper")},kr.jump_to,t$7.createElement("input",{disabled:Jr,type:"text",value:In,onChange:to,onKeyUp:oo,onBlur:_i,"aria-label":kr.page}),kr.page,Tn)),t$7.createElement("li",{className:co},so,no)},Pager=function(br){var wr=br.rootPrefixCls,Er=br.page,kr=br.active,jr=br.className,Br=br.showTitle,Wr=br.onClick,qr=br.onKeyPress,Gr=br.itemRender,Vr="".concat(wr,"-item"),Zr=classNames(Vr,"".concat(Vr,"-").concat(Er),_defineProperty(_defineProperty({},"".concat(Vr,"-active"),kr),"".concat(Vr,"-disabled"),!Er),jr),Jr=function(){Wr(Er)},Qr=function(Cn){qr(Cn,Wr,Er)},_n=Gr(Er,"page",t$7.createElement("a",{rel:"nofollow"},Er));return _n?t$7.createElement("li",{title:Br?String(Er):null,className:Zr,onClick:Jr,onKeyDown:Qr,tabIndex:0},_n):null},defaultItemRender=function(br,wr,Er){return Er};function noop$2(){}function isInteger(fr){var br=Number(fr);return typeof br=="number"&&!Number.isNaN(br)&&isFinite(br)&&Math.floor(br)===br}function calculatePage(fr,br,wr){var Er=typeof fr>"u"?br:fr;return Math.floor((wr-1)/Er)+1}var Pagination=function(br){var wr=br.prefixCls,Er=wr===void 0?"rc-pagination":wr,kr=br.selectPrefixCls,jr=kr===void 0?"rc-select":kr,Br=br.className,Wr=br.selectComponentClass,qr=br.current,Gr=br.defaultCurrent,Vr=Gr===void 0?1:Gr,Zr=br.total,Jr=Zr===void 0?0:Zr,Qr=br.pageSize,_n=br.defaultPageSize,En=_n===void 0?10:_n,Cn=br.onChange,In=Cn===void 0?noop$2:Cn,An=br.hideOnSinglePage,jn=br.align,eo=br.showPrevNextJumpers,ro=eo===void 0?!0:eo,to=br.showQuickJumper,_i=br.showLessItems,oo=br.showTitle,io=oo===void 0?!0:oo,co=br.onShowSizeChange,so=co===void 0?noop$2:co,no=br.locale,Tn=no===void 0?locale$1:no,Hr=br.style,Xr=br.totalBoundaryShowSizeChanger,Sn=Xr===void 0?50:Xr,Rn=br.disabled,Pn=br.simple,On=br.showTotal,Zn=br.showSizeChanger,Nn=Zn===void 0?Jr>Sn:Zn,wn=br.pageSizeOptions,zn=br.itemRender,fo=zn===void 0?defaultItemRender:zn,vo=br.jumpPrevIcon,go=br.jumpNextIcon,uo=br.prevIcon,lo=br.nextIcon,Eo=t$7.useRef(null),mo=useMergedState(10,{value:Qr,defaultValue:En}),yo=_slicedToArray(mo,2),_o=yo[0],Bo=yo[1],Lo=useMergedState(1,{value:qr,defaultValue:Vr,postState:function(Gl){return Math.max(1,Math.min(Gl,calculatePage(void 0,_o,Jr)))}}),Wo=_slicedToArray(Lo,2),na=Wo[0],qo=Wo[1],ga=t$7.useState(na),wl=_slicedToArray(ga,2),No=wl[0],Fo=wl[1];reactExports.useEffect(function(){Fo(na)},[na]);var Nl=Math.max(1,na-(_i?3:5)),Vo=Math.min(calculatePage(void 0,_o,Jr),na+(_i?3:5));function Uo(zl,Gl){var Jl=zl||t$7.createElement("button",{type:"button","aria-label":Gl,className:"".concat(Er,"-item-link")});return typeof zl=="function"&&(Jl=t$7.createElement(zl,_objectSpread2({},br))),Jl}function Ml(zl){var Gl=zl.target.value,Jl=calculatePage(void 0,_o,Jr),Pl;return Gl===""?Pl=Gl:Number.isNaN(Number(Gl))?Pl=No:Gl>=Jl?Pl=Jl:Pl=Number(Gl),Pl}function $a(zl){return isInteger(zl)&&zl!==na&&isInteger(Jr)&&Jr>0}var Jo=Jr>_o?to:!1;function Zl(zl){(zl.keyCode===KeyCode.UP||zl.keyCode===KeyCode.DOWN)&&zl.preventDefault()}function Cl(zl){var Gl=Ml(zl);switch(Gl!==No&&Fo(Gl),zl.keyCode){case KeyCode.ENTER:bo(Gl);break;case KeyCode.UP:bo(Gl-1);break;case KeyCode.DOWN:bo(Gl+1);break}}function ko(zl){bo(Ml(zl))}function wo(zl){var Gl=calculatePage(zl,_o,Jr),Jl=na>Gl&&Gl!==0?Gl:na;Bo(zl),Fo(Jl),so==null||so(na,zl),qo(Jl),In==null||In(Jl,zl)}function bo(zl){if($a(zl)&&!Rn){var Gl=calculatePage(void 0,_o,Jr),Jl=zl;return zl>Gl?Jl=Gl:zl<1&&(Jl=1),Jl!==No&&Fo(Jl),qo(Jl),In==null||In(Jl,_o),Jl}return na}var Io=na>1,Ho=na2?Jl-2:0),Fl=2;FlJr?Jr:na*_o])),Ul=null,Sl=calculatePage(void 0,_o,Jr);if(An&&Jr<=_o)return null;var _u=[],So={rootPrefixCls:Er,onClick:bo,onKeyPress:_l,showTitle:io,itemRender:fo,page:-1},Co=na-1>0?na-1:0,Ao=na+1=Ko*2&&na!==3&&(_u[0]=t$7.cloneElement(_u[0],{className:classNames("".concat(Er,"-item-after-jump-prev"),_u[0].props.className)}),_u.unshift(Al)),Sl-na>=Ko*2&&na!==Sl-2){var mu=_u[_u.length-1];_u[_u.length-1]=t$7.cloneElement(mu,{className:classNames("".concat(Er,"-item-before-jump-next"),mu.props.className)}),_u.push(Ul)}pu!==1&&_u.unshift(t$7.createElement(Pager,_extends$1l({},So,{key:1,page:1}))),yu!==Sl&&_u.push(t$7.createElement(Pager,_extends$1l({},So,{key:Sl,page:Sl})))}var vu=Bl(Co);if(vu){var fu=!Io||!Sl;vu=t$7.createElement("li",{title:io?Tn.prev_page:null,onClick:Do,tabIndex:fu?null:0,onKeyDown:bu,className:classNames("".concat(Er,"-prev"),_defineProperty({},"".concat(Er,"-disabled"),fu)),"aria-disabled":fu},vu)}var gu=Il(Ao);if(gu){var ou,su;Pn?(ou=!Ho,su=Io?0:null):(ou=!Ho||!Sl,su=ou?null:0),gu=t$7.createElement("li",{title:io?Tn.next_page:null,onClick:zo,tabIndex:su,onKeyDown:xl,className:classNames("".concat(Er,"-next"),_defineProperty({},"".concat(Er,"-disabled"),ou)),"aria-disabled":ou},gu)}var tu=classNames(Er,Br,_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},"".concat(Er,"-start"),jn==="start"),"".concat(Er,"-center"),jn==="center"),"".concat(Er,"-end"),jn==="end"),"".concat(Er,"-simple"),Pn),"".concat(Er,"-disabled"),Rn));return t$7.createElement("ul",_extends$1l({className:tu,style:Hr,ref:Eo},Ol),Tu,vu,Pn?jo:_u,gu,t$7.createElement(Options,{locale:Tn,rootPrefixCls:Er,disabled:Rn,selectComponentClass:Wr,selectPrefixCls:jr,changeSize:wo,pageSize:_o,pageSizeOptions:wn,quickGo:Jo?bo:null,goButton:Xo,showSizeChanger:Nn}))},en_US={};Object.defineProperty(en_US,"__esModule",{value:!0});en_US.default=void 0;var locale={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"Page",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages",page_size:"Page Size"};en_US.default=locale;qe$2(Pagination)` + onLoadStart onPause onPlay onPlaying onProgress onRateChange onSeeked onSeeking onStalled onSuspend onTimeUpdate onVolumeChange onWaiting onLoad onError`,propList="".concat(attributes," ").concat(eventsName).split(/[\s\n]+/),ariaPrefix="aria-",dataPrefix="data-";function match$1(fr,br){return fr.indexOf(br)===0}function pickAttrs(fr){var br=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,wr;br===!1?wr={aria:!0,data:!0,attr:!0}:br===!0?wr={aria:!0}:wr=_objectSpread2({},br);var Er={};return Object.keys(fr).forEach(function(kr){(wr.aria&&(kr==="role"||match$1(kr,ariaPrefix))||wr.data&&match$1(kr,dataPrefix)||wr.attr&&propList.includes(kr))&&(Er[kr]=fr[kr])}),Er}var locale$1={items_per_page:"条/页",jump_to:"跳至",jump_to_confirm:"确定",page:"页",prev_page:"上一页",next_page:"下一页",prev_5:"向前 5 页",next_5:"向后 5 页",prev_3:"向前 3 页",next_3:"向后 3 页",page_size:"页码"},defaultPageSizeOptions=["10","20","50","100"],Options=function(br){var wr=br.pageSizeOptions,Er=wr===void 0?defaultPageSizeOptions:wr,kr=br.locale,jr=br.changeSize,Br=br.pageSize,Wr=br.goButton,qr=br.quickGo,Gr=br.rootPrefixCls,Vr=br.selectComponentClass,Zr=br.selectPrefixCls,Jr=br.disabled,Qr=br.buildOptionText,_n=br.showSizeChanger,En=t$7.useState(""),Cn=_slicedToArray(En,2),In=Cn[0],An=Cn[1],jn=function(){return!In||Number.isNaN(In)?void 0:Number(In)},eo=typeof Qr=="function"?Qr:function(Pn){return"".concat(Pn," ").concat(kr.items_per_page)},ro=function(On,Zn){if(jr==null||jr(Number(On)),_typeof(_n)==="object"){var Nn;(Nn=_n.onChange)===null||Nn===void 0||Nn.call(_n,On,Zn)}},to=function(On){An(On.target.value)},_i=function(On){Wr||In===""||(An(""),!(On.relatedTarget&&(On.relatedTarget.className.indexOf("".concat(Gr,"-item-link"))>=0||On.relatedTarget.className.indexOf("".concat(Gr,"-item"))>=0))&&(qr==null||qr(jn())))},oo=function(On){In!==""&&(On.keyCode===KeyCode.ENTER||On.type==="click")&&(An(""),qr==null||qr(jn()))},io=function(){return Er.some(function(On){return On.toString()===Br.toString()})?Er:Er.concat([Br.toString()]).sort(function(On,Zn){var Nn=Number.isNaN(Number(On))?0:Number(On),wn=Number.isNaN(Number(Zn))?0:Number(Zn);return Nn-wn})},co="".concat(Gr,"-options");if(!_n&&!qr)return null;var so=null,no=null,Tn=null;if(_n&&Vr){var Hr=_typeof(_n)==="object"?_n:{},Xr=Hr.options,Sn=Hr.className,Rn=Xr?void 0:io().map(function(Pn,On){return t$7.createElement(Vr.Option,{key:On,value:Pn.toString()},eo(Pn))});so=t$7.createElement(Vr,_extends$1l({disabled:Jr,prefixCls:Zr,showSearch:!1,optionLabelProp:Xr?"label":"children",popupMatchSelectWidth:!1,value:(Br||Er[0]).toString(),getPopupContainer:function(On){return On.parentNode},"aria-label":kr.page_size,defaultOpen:!1},_typeof(_n)==="object"?_n:null,{className:classNames("".concat(co,"-size-changer"),Sn),options:Xr,onChange:ro}),Rn)}return qr&&(Wr&&(Tn=typeof Wr=="boolean"?t$7.createElement("button",{type:"button",onClick:oo,onKeyUp:oo,disabled:Jr,className:"".concat(co,"-quick-jumper-button")},kr.jump_to_confirm):t$7.createElement("span",{onClick:oo,onKeyUp:oo},Wr)),no=t$7.createElement("div",{className:"".concat(co,"-quick-jumper")},kr.jump_to,t$7.createElement("input",{disabled:Jr,type:"text",value:In,onChange:to,onKeyUp:oo,onBlur:_i,"aria-label":kr.page}),kr.page,Tn)),t$7.createElement("li",{className:co},so,no)},Pager=function(br){var wr=br.rootPrefixCls,Er=br.page,kr=br.active,jr=br.className,Br=br.showTitle,Wr=br.onClick,qr=br.onKeyPress,Gr=br.itemRender,Vr="".concat(wr,"-item"),Zr=classNames(Vr,"".concat(Vr,"-").concat(Er),_defineProperty(_defineProperty({},"".concat(Vr,"-active"),kr),"".concat(Vr,"-disabled"),!Er),jr),Jr=function(){Wr(Er)},Qr=function(Cn){qr(Cn,Wr,Er)},_n=Gr(Er,"page",t$7.createElement("a",{rel:"nofollow"},Er));return _n?t$7.createElement("li",{title:Br?String(Er):null,className:Zr,onClick:Jr,onKeyDown:Qr,tabIndex:0},_n):null},defaultItemRender=function(br,wr,Er){return Er};function noop$2(){}function isInteger(fr){var br=Number(fr);return typeof br=="number"&&!Number.isNaN(br)&&isFinite(br)&&Math.floor(br)===br}function calculatePage(fr,br,wr){var Er=typeof fr>"u"?br:fr;return Math.floor((wr-1)/Er)+1}var Pagination=function(br){var wr=br.prefixCls,Er=wr===void 0?"rc-pagination":wr,kr=br.selectPrefixCls,jr=kr===void 0?"rc-select":kr,Br=br.className,Wr=br.selectComponentClass,qr=br.current,Gr=br.defaultCurrent,Vr=Gr===void 0?1:Gr,Zr=br.total,Jr=Zr===void 0?0:Zr,Qr=br.pageSize,_n=br.defaultPageSize,En=_n===void 0?10:_n,Cn=br.onChange,In=Cn===void 0?noop$2:Cn,An=br.hideOnSinglePage,jn=br.align,eo=br.showPrevNextJumpers,ro=eo===void 0?!0:eo,to=br.showQuickJumper,_i=br.showLessItems,oo=br.showTitle,io=oo===void 0?!0:oo,co=br.onShowSizeChange,so=co===void 0?noop$2:co,no=br.locale,Tn=no===void 0?locale$1:no,Hr=br.style,Xr=br.totalBoundaryShowSizeChanger,Sn=Xr===void 0?50:Xr,Rn=br.disabled,Pn=br.simple,On=br.showTotal,Zn=br.showSizeChanger,Nn=Zn===void 0?Jr>Sn:Zn,wn=br.pageSizeOptions,zn=br.itemRender,fo=zn===void 0?defaultItemRender:zn,vo=br.jumpPrevIcon,go=br.jumpNextIcon,uo=br.prevIcon,lo=br.nextIcon,Eo=t$7.useRef(null),mo=useMergedState(10,{value:Qr,defaultValue:En}),yo=_slicedToArray(mo,2),_o=yo[0],Bo=yo[1],Lo=useMergedState(1,{value:qr,defaultValue:Vr,postState:function(Gl){return Math.max(1,Math.min(Gl,calculatePage(void 0,_o,Jr)))}}),Wo=_slicedToArray(Lo,2),na=Wo[0],qo=Wo[1],ga=t$7.useState(na),wl=_slicedToArray(ga,2),No=wl[0],Uo=wl[1];reactExports.useEffect(function(){Uo(na)},[na]);var Nl=Math.max(1,na-(_i?3:5)),Vo=Math.min(calculatePage(void 0,_o,Jr),na+(_i?3:5));function Fo(zl,Gl){var Jl=zl||t$7.createElement("button",{type:"button","aria-label":Gl,className:"".concat(Er,"-item-link")});return typeof zl=="function"&&(Jl=t$7.createElement(zl,_objectSpread2({},br))),Jl}function Ol(zl){var Gl=zl.target.value,Jl=calculatePage(void 0,_o,Jr),Pl;return Gl===""?Pl=Gl:Number.isNaN(Number(Gl))?Pl=No:Gl>=Jl?Pl=Jl:Pl=Number(Gl),Pl}function $a(zl){return isInteger(zl)&&zl!==na&&isInteger(Jr)&&Jr>0}var Jo=Jr>_o?to:!1;function Zl(zl){(zl.keyCode===KeyCode.UP||zl.keyCode===KeyCode.DOWN)&&zl.preventDefault()}function Cl(zl){var Gl=Ol(zl);switch(Gl!==No&&Uo(Gl),zl.keyCode){case KeyCode.ENTER:bo(Gl);break;case KeyCode.UP:bo(Gl-1);break;case KeyCode.DOWN:bo(Gl+1);break}}function ko(zl){bo(Ol(zl))}function wo(zl){var Gl=calculatePage(zl,_o,Jr),Jl=na>Gl&&Gl!==0?Gl:na;Bo(zl),Uo(Jl),so==null||so(na,zl),qo(Jl),In==null||In(Jl,zl)}function bo(zl){if($a(zl)&&!Rn){var Gl=calculatePage(void 0,_o,Jr),Jl=zl;return zl>Gl?Jl=Gl:zl<1&&(Jl=1),Jl!==No&&Uo(Jl),qo(Jl),In==null||In(Jl,_o),Jl}return na}var Io=na>1,Ho=na2?Jl-2:0),Ul=2;UlJr?Jr:na*_o])),Fl=null,Sl=calculatePage(void 0,_o,Jr);if(An&&Jr<=_o)return null;var _u=[],So={rootPrefixCls:Er,onClick:bo,onKeyPress:_l,showTitle:io,itemRender:fo,page:-1},Co=na-1>0?na-1:0,Ao=na+1=Ko*2&&na!==3&&(_u[0]=t$7.cloneElement(_u[0],{className:classNames("".concat(Er,"-item-after-jump-prev"),_u[0].props.className)}),_u.unshift(Al)),Sl-na>=Ko*2&&na!==Sl-2){var mu=_u[_u.length-1];_u[_u.length-1]=t$7.cloneElement(mu,{className:classNames("".concat(Er,"-item-before-jump-next"),mu.props.className)}),_u.push(Fl)}pu!==1&&_u.unshift(t$7.createElement(Pager,_extends$1l({},So,{key:1,page:1}))),yu!==Sl&&_u.push(t$7.createElement(Pager,_extends$1l({},So,{key:Sl,page:Sl})))}var vu=Bl(Co);if(vu){var fu=!Io||!Sl;vu=t$7.createElement("li",{title:io?Tn.prev_page:null,onClick:Do,tabIndex:fu?null:0,onKeyDown:bu,className:classNames("".concat(Er,"-prev"),_defineProperty({},"".concat(Er,"-disabled"),fu)),"aria-disabled":fu},vu)}var gu=Il(Ao);if(gu){var ou,su;Pn?(ou=!Ho,su=Io?0:null):(ou=!Ho||!Sl,su=ou?null:0),gu=t$7.createElement("li",{title:io?Tn.next_page:null,onClick:zo,tabIndex:su,onKeyDown:xl,className:classNames("".concat(Er,"-next"),_defineProperty({},"".concat(Er,"-disabled"),ou)),"aria-disabled":ou},gu)}var tu=classNames(Er,Br,_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},"".concat(Er,"-start"),jn==="start"),"".concat(Er,"-center"),jn==="center"),"".concat(Er,"-end"),jn==="end"),"".concat(Er,"-simple"),Pn),"".concat(Er,"-disabled"),Rn));return t$7.createElement("ul",_extends$1l({className:tu,style:Hr,ref:Eo},Ml),Tu,vu,Pn?jo:_u,gu,t$7.createElement(Options,{locale:Tn,rootPrefixCls:Er,disabled:Rn,selectComponentClass:Wr,selectPrefixCls:jr,changeSize:wo,pageSize:_o,pageSizeOptions:wn,quickGo:Jo?bo:null,goButton:Xo,showSizeChanger:Nn}))},en_US={};Object.defineProperty(en_US,"__esModule",{value:!0});en_US.default=void 0;var locale={items_per_page:"/ page",jump_to:"Go to",jump_to_confirm:"confirm",page:"Page",prev_page:"Previous Page",next_page:"Next Page",prev_5:"Previous 5 Pages",next_5:"Next 5 Pages",prev_3:"Previous 3 Pages",next_3:"Next 3 Pages",page_size:"Page Size"};en_US.default=locale;qe$2(Pagination)` display: flex; justify-content: center; align-items: center; @@ -1655,14 +1655,16 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho :hover { border: var(--border-sm, 1px) solid var(--stroke-brand-medium); } - `,display:"flex",padding:"spacing-xs",borderRadius:"radius-xs",border:"border-sm solid stroke-tertiary",backgroundColor:"surface-transparent",alignItems:"center",justifyContent:"space-between",onClick:()=>fr==null?void 0:fr(br.value),children:[jsxRuntimeExports.jsxs(Box,{alignItems:"center",display:"flex",gap:"spacing-xxs",children:[br.icon,jsxRuntimeExports.jsx(Text,{variant:"bs-semibold",color:"text-primary",children:br.label})]}),jsxRuntimeExports.jsx(CaretRight,{size:24,color:"icon-tertiary"})]},br.value))}),Footer=()=>jsxRuntimeExports.jsxs(Box,{textAlign:"center",width:"280px",children:[jsxRuntimeExports.jsxs(Text,{as:"span",variant:"bes-semibold",color:"text-secondary",children:["By using Push Wallet, you agree to our"," "]}),jsxRuntimeExports.jsxs(Link,{to:"https://push.org/tos/",target:"_blank",textProps:{as:"span",variant:"bes-semibold",color:"text-brand-medium"},children:["Terms of Service"," "]}),jsxRuntimeExports.jsxs(Text,{as:"span",variant:"bes-semibold",color:"text-secondary",children:["and"," "]}),jsxRuntimeExports.jsx(Link,{to:"https://push.org/privacy/",target:"_blank",textProps:{as:"span",variant:"bes-semibold",color:"text-brand-medium"},children:"Privacy Policy"})]}),validationSchema=create$5().shape({email:create$6().email("Invalid email address").required("Required")}),envRouteAlias="/push-wallet",Login=({email:fr,setEmail:br,setConnectMethod:wr})=>{var jr,Br,Wr,qr;const Er=useFormik({initialValues:{email:fr},validationSchema,onSubmit:Gr=>{br(Gr.email),Gr.email&&(window.location.href=`https://push-auth.push.org/auth/authorize-email?email=${encodeURIComponent(Gr.email)}&redirectUri=${encodeURIComponent(window.location.origin+envRouteAlias+"/wallet")}`)}}),kr=Gr=>{window.location.href=`https://push-auth.push.org/auth/authorize-social?provider=${Gr}&redirectUri=${encodeURIComponent(window.location.origin+envRouteAlias+"/wallet")}`};return jsxRuntimeExports.jsxs(Box,{alignItems:"center",flexDirection:"column",display:"flex",justifyContent:"space-between",width:"100%",gap:"spacing-xl",margin:"spacing-md spacing-none spacing-none spacing-none",children:[jsxRuntimeExports.jsxs(Text,{variant:"h3-semibold",color:"text-primary",children:[" ","Welcome to",jsxRuntimeExports.jsx("br",{})," Push Wallet"]}),jsxRuntimeExports.jsx(Box,{flexDirection:"column",display:"flex",gap:"spacing-lg",width:"100%",alignItems:"center",children:jsxRuntimeExports.jsxs(Box,{flexDirection:"column",display:"flex",gap:"spacing-xs",width:"100%",alignItems:"center",children:[jsxRuntimeExports.jsx(Box,{width:"100%",children:jsxRuntimeExports.jsx("form",{onSubmit:Er.handleSubmit,children:jsxRuntimeExports.jsx(TextInput,{value:Er.values.email,onChange:Er.handleChange("email"),placeholder:"Enter your email",error:((jr=Er.touched)==null?void 0:jr.email)&&!!((Br=Er.errors)!=null&&Br.email),errorMessage:(Wr=Er.touched)!=null&&Wr.email?(qr=Er.errors)==null?void 0:qr.email:"",trailingIcon:jsxRuntimeExports.jsx(Front,{size:24,onClick:()=>{Er.handleSubmit(),wr("social")}})})})}),jsxRuntimeExports.jsx(Text,{variant:"os-regular",color:"text-tertiary",children:"OR"}),jsxRuntimeExports.jsx(Button,{variant:"outline",block:!0,leadingIcon:jsxRuntimeExports.jsx(Google,{width:24,height:24}),onClick:()=>kr("google"),children:"Continue with Google"}),jsxRuntimeExports.jsx(Text,{variant:"os-regular",color:"text-tertiary",children:"OR"}),jsxRuntimeExports.jsx(Button,{variant:"outline",block:!0,onClick:()=>wr("connectWallet"),children:"Continue with a Wallet"})]})}),jsxRuntimeExports.jsx(PoweredByPush,{})]})},solanaWallets={coinbase:"Coinbase",backpack:"Backpack",bitgetwallet:"Bitget",brave:"Brave",coin98:"Coin98",exodus:"Exodus Wallet",fallbackconnector:"Fallback Connector",glow:"Glow",magiceden:"Magic Eden",mathwallet:"Math Wallet",nightlysol:"Nightly",okxwallet:"OKX Wallet",onekey:"OneKey",phantom:"Phantom",solflare:"Solflare"},allowedEvmWallets=["metamask","trust","safepal","binance","uniswap","coinbase","walletconnect","rainbow","backpack","zerion","rabby","flowwallet","sequence","unstoppable","frontier","1inch","mewwallet","obvious","enkrypt","krakenwallet"],getGroupedWallets=fr=>fr.reduce((br,wr)=>{const Er=wr.group||wr.key,kr=wr.groupName||wr.name;return br[Er]||(br[Er]=kr),br},{}),filterEthereumWallets=fr=>Object.fromEntries(allowedEvmWallets.filter(wr=>wr in fr).map(wr=>[wr,fr[wr]])),getInstalledWallets=(fr,br)=>Object.fromEntries(Object.entries(fr).filter(([Er])=>br.some(kr=>kr.isInstalledOnBrowser===!0&&kr.key===Er)));var ENV=(fr=>(fr.PROD="prod",fr.STAGING="staging",fr.DEV="dev",fr.LOCAL="local",fr))(ENV||{});const chainToNamespace={EVM:"eip155",SOL:"solana"},networkToSolChainId={mainnet:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",devnet:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1",testnet:"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"},APP_ROUTES={AUTH:"/auth",WALLET:"/wallet"},WalletSelection=({setConnectMethod:fr})=>{const[br,wr]=reactExports.useState(""),{primaryWallet:Er}=useDynamicContext(),{walletOptions:kr,selectWalletOption:jr}=useWalletOptions(),Br=useNavigate();reactExports.useEffect(()=>{(async()=>Er&&Br(APP_ROUTES.WALLET))()},[Er]);const Wr=getInstalledWallets(filterEthereumWallets(getGroupedWallets(kr)),kr),qr=getInstalledWallets(solanaWallets,kr),Gr=br==="ethereum"?Wr:qr,Vr=()=>{br?wr(""):fr("authentication")},Zr=Qr=>{jr(Qr)},Jr=({walletKey:Qr})=>jsxRuntimeExports.jsx(Text,{color:"text-tertiary",variant:"bes-bold",textAlign:"center",children:Qr.slice(0,2).toUpperCase()});return jsxRuntimeExports.jsxs(Box,{flexDirection:"column",display:"flex",gap:"spacing-lg",width:"100%",children:[jsxRuntimeExports.jsx(Box,{cursor:"pointer",onClick:()=>Vr(),children:jsxRuntimeExports.jsx(Back,{color:"icon-tertiary",size:24})}),jsxRuntimeExports.jsx(Box,{flexDirection:"column",display:"flex",gap:"spacing-md",children:jsxRuntimeExports.jsxs(Box,{flexDirection:"column",display:"flex",gap:"spacing-md",children:[jsxRuntimeExports.jsxs(Box,{flexDirection:"column",display:"flex",textAlign:"center",children:[jsxRuntimeExports.jsx(Text,{color:"text-primary",variant:"h4-semibold",children:"Link External Wallet to Connect"}),jsxRuntimeExports.jsx(Text,{color:"text-primary",variant:"bs-regular",children:"Choose what kind of wallet you would like to link with Push"})]}),jsxRuntimeExports.jsx(Box,{flexDirection:"column",display:"flex",gap:"spacing-xxs",height:"299px",overflow:"hidden auto",customScrollbar:!0,children:!Er&&(br?Object.entries(Gr).map(([Qr,_n])=>jsxRuntimeExports.jsxs(Box,{cursor:"pointer",css:Ae$2` + `,display:"flex",padding:"spacing-xs",borderRadius:"radius-xs",border:"border-sm solid stroke-tertiary",backgroundColor:"surface-transparent",alignItems:"center",justifyContent:"space-between",onClick:()=>fr==null?void 0:fr(br.value),children:[jsxRuntimeExports.jsxs(Box,{alignItems:"center",display:"flex",gap:"spacing-xxs",children:[br.icon,jsxRuntimeExports.jsx(Text,{variant:"bs-semibold",color:"text-primary",children:br.label})]}),jsxRuntimeExports.jsx(CaretRight,{size:24,color:"icon-tertiary"})]},br.value))}),Footer=()=>jsxRuntimeExports.jsxs(Box,{textAlign:"center",width:"280px",children:[jsxRuntimeExports.jsxs(Text,{as:"span",variant:"bes-semibold",color:"text-secondary",children:["By using Push Wallet, you agree to our"," "]}),jsxRuntimeExports.jsxs(Link,{to:"https://push.org/tos/",target:"_blank",textProps:{as:"span",variant:"bes-semibold",color:"text-brand-medium"},children:["Terms of Service"," "]}),jsxRuntimeExports.jsxs(Text,{as:"span",variant:"bes-semibold",color:"text-secondary",children:["and"," "]}),jsxRuntimeExports.jsx(Link,{to:"https://push.org/privacy/",target:"_blank",textProps:{as:"span",variant:"bes-semibold",color:"text-brand-medium"},children:"Privacy Policy"})]}),socialLoginConfig=[{name:"apple",icon:jsxRuntimeExports.jsx(Apple,{color:"icon-hero-icons",size:24})},{name:"github",icon:jsxRuntimeExports.jsx(Github,{color:"icon-hero-icons",size:24})},{name:"twitter",icon:jsxRuntimeExports.jsx(TwitterSimple,{color:"icon-hero-icons",size:24})},{name:"discord",icon:jsxRuntimeExports.jsx(DiscordSimple,{width:24,height:24})}],solanaWallets={coinbase:"Coinbase",backpack:"Backpack",bitgetwallet:"Bitget",brave:"Brave",coin98:"Coin98",exodus:"Exodus Wallet",fallbackconnector:"Fallback Connector",glow:"Glow",magiceden:"Magic Eden",mathwallet:"Math Wallet",nightlysol:"Nightly",okxwallet:"OKX Wallet",onekey:"OneKey",phantom:"Phantom",solflare:"Solflare"},allowedEvmWallets=["metamask","trust","safepal","binance","uniswap","coinbase","walletconnect","rainbow","backpack","zerion","rabby","flowwallet","sequence","unstoppable","frontier","1inch","mewwallet","obvious","enkrypt","krakenwallet"];var ENV=(fr=>(fr.PROD="prod",fr.STAGING="staging",fr.DEV="dev",fr.LOCAL="local",fr))(ENV||{});const chainToNamespace={EVM:"eip155",SOL:"solana"},networkToSolChainId={mainnet:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",devnet:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1",testnet:"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"},APP_ROUTES={AUTH:"/auth",WALLET:"/wallet"},usePersistedQuery=()=>{const[fr]=useSearchParams();return wr=>{const Er=fr.get("app");return`${wr}${Er?`?app=${Er}`:""}`}},validationSchema=create$5().shape({email:create$6().email("Invalid email address").required("Required")}),envRouteAlias="/push-wallet",Login=({email:fr,setEmail:br,setConnectMethod:wr})=>{var Br,Wr,qr,Gr;const Er=usePersistedQuery(),kr=useFormik({initialValues:{email:fr},validationSchema,onSubmit:Vr=>{br(Vr.email),Vr.email&&(window.location.href=`https://push-auth.push.org/auth/authorize-email?email=${encodeURIComponent(Vr.email)}&redirectUri=${encodeURIComponent(window.location.origin+envRouteAlias+Er(APP_ROUTES.WALLET))}`)}}),jr=Vr=>{window.location.href=`https://push-auth.push.org/auth/authorize-social?provider=${Vr}&redirectUri=${encodeURIComponent(window.location.origin+envRouteAlias+Er(APP_ROUTES.WALLET))}`};return jsxRuntimeExports.jsxs(Box,{alignItems:"center",flexDirection:"column",display:"flex",justifyContent:"space-between",width:"100%",gap:"spacing-xl",margin:"spacing-md spacing-none spacing-none spacing-none",children:[jsxRuntimeExports.jsxs(Text,{variant:"h3-semibold",color:"text-primary",children:[" ","Welcome to",jsxRuntimeExports.jsx("br",{})," Push Wallet"]}),jsxRuntimeExports.jsx(Box,{flexDirection:"column",display:"flex",gap:"spacing-lg",width:"100%",alignItems:"center",children:jsxRuntimeExports.jsxs(Box,{flexDirection:"column",display:"flex",gap:"spacing-xs",width:"100%",alignItems:"center",children:[jsxRuntimeExports.jsx(Box,{width:"100%",children:jsxRuntimeExports.jsx("form",{onSubmit:kr.handleSubmit,children:jsxRuntimeExports.jsx(TextInput,{value:kr.values.email,onChange:kr.handleChange("email"),placeholder:"Enter your email",error:((Br=kr.touched)==null?void 0:Br.email)&&!!((Wr=kr.errors)!=null&&Wr.email),errorMessage:(qr=kr.touched)!=null&&qr.email?(Gr=kr.errors)==null?void 0:Gr.email:"",trailingIcon:jsxRuntimeExports.jsx(Front,{size:24,onClick:()=>{kr.handleSubmit(),wr("social")}})})})}),jsxRuntimeExports.jsx(Text,{variant:"os-regular",color:"text-tertiary",children:"OR"}),jsxRuntimeExports.jsx(Button,{variant:"outline",block:!0,leadingIcon:jsxRuntimeExports.jsx(Google,{width:24,height:24}),onClick:()=>jr("google"),children:"Continue with Google"}),jsxRuntimeExports.jsx(Box,{display:"flex",gap:"spacing-xs",alignItems:"center",justifyContent:"center",children:socialLoginConfig.map(Vr=>jsxRuntimeExports.jsx(Button,{variant:"outline",iconOnly:Vr.icon,css:Ae$2` + width: 73px; + `,onClick:()=>jr(Vr.name)},Vr.name))}),jsxRuntimeExports.jsx(Text,{variant:"os-regular",color:"text-tertiary",children:"OR"}),jsxRuntimeExports.jsx(Button,{variant:"outline",block:!0,onClick:()=>wr("connectWallet"),children:"Continue with a Wallet"})]})}),jsxRuntimeExports.jsx(PoweredByPush,{})]})},getGroupedWallets=fr=>fr.reduce((br,wr)=>{const Er=wr.group||wr.key,kr=wr.groupName||wr.name;return br[Er]||(br[Er]=kr),br},{}),filterEthereumWallets=fr=>Object.fromEntries(allowedEvmWallets.filter(wr=>wr in fr).map(wr=>[wr,fr[wr]])),WalletSelection=({setConnectMethod:fr})=>{const[br,wr]=reactExports.useState(""),{primaryWallet:Er}=useDynamicContext(),{walletOptions:kr,selectWalletOption:jr}=useWalletOptions(),Br=useNavigate(),Wr=usePersistedQuery();reactExports.useEffect(()=>{(async()=>{if(Er){const Qr=Wr(APP_ROUTES.WALLET);Br(Qr)}})()},[Er]);const qr=filterEthereumWallets(getGroupedWallets(kr)),Gr=br==="ethereum"?qr:solanaWallets,Vr=()=>{br?wr(""):fr("authentication")},Zr=Qr=>{jr(Qr)},Jr=({walletKey:Qr})=>jsxRuntimeExports.jsx(Text,{color:"text-tertiary",variant:"bes-bold",textAlign:"center",children:Qr.slice(0,2).toUpperCase()});return jsxRuntimeExports.jsxs(Box,{flexDirection:"column",display:"flex",gap:"spacing-lg",width:"100%",children:[jsxRuntimeExports.jsx(Box,{cursor:"pointer",onClick:()=>Vr(),children:jsxRuntimeExports.jsx(Back,{color:"icon-tertiary",size:24})}),jsxRuntimeExports.jsx(Box,{flexDirection:"column",display:"flex",gap:"spacing-md",children:jsxRuntimeExports.jsxs(Box,{flexDirection:"column",display:"flex",gap:"spacing-md",children:[jsxRuntimeExports.jsxs(Box,{flexDirection:"column",display:"flex",textAlign:"center",children:[jsxRuntimeExports.jsx(Text,{color:"text-primary",variant:"h4-semibold",children:"Continue with Wallet"}),jsxRuntimeExports.jsx(Text,{color:"text-primary",variant:"bs-regular",children:"Choose what kind of wallet you would like to link with Push"})]}),jsxRuntimeExports.jsx(Box,{flexDirection:"column",display:"flex",gap:"spacing-xxs",height:"299px",overflow:"hidden auto",customScrollbar:!0,children:!Er&&(br?Object.entries(Gr).map(([Qr,_n])=>jsxRuntimeExports.jsxs(Box,{cursor:"pointer",css:Ae$2` :hover { border: var(--border-sm, 1px) solid var(--stroke-brand-medium); } `,display:"flex",padding:"spacing-xs",borderRadius:"radius-xs",border:"border-sm solid stroke-tertiary",backgroundColor:"surface-transparent",alignItems:"center",gap:"spacing-xxs",onClick:()=>Zr(Qr),children:[jsxRuntimeExports.jsx(Box,{width:"24px",height:"24px",overflow:"hidden",display:"flex",alignItems:"center",justifyContent:"center",css:Ae$2` flex-shrink: 0; - `,children:WALLETS_LOGO[Qr]||jsxRuntimeExports.jsx(Jr,{walletKey:Qr})}),jsxRuntimeExports.jsx(Text,{variant:"bs-semibold",color:"text-primary",children:_n})]},Qr)):jsxRuntimeExports.jsx(WalletCategories,{setSelectedWalletCategory:wr}))})]})}),jsxRuntimeExports.jsx(PoweredByPush,{})]})},Authentication=()=>{const[fr,br]=reactExports.useState(""),[wr,Er]=reactExports.useState("authentication");return jsxRuntimeExports.jsx(ContentLayout,{footer:jsxRuntimeExports.jsx(Footer,{}),children:jsxRuntimeExports.jsx(BoxLayout,{children:jsxRuntimeExports.jsxs(Box,{alignItems:"center",flexDirection:"column",display:"flex",width:"376px",padding:"spacing-md",children:[(wr==="authentication"||wr==="social")&&jsxRuntimeExports.jsx(Login,{email:fr,setEmail:br,setConnectMethod:Er}),wr==="connectWallet"&&jsxRuntimeExports.jsx(WalletSelection,{setConnectMethod:Er})]})})})};function __rest$7(fr,br){var wr={};for(var Er in fr)Object.prototype.hasOwnProperty.call(fr,Er)&&br.indexOf(Er)<0&&(wr[Er]=fr[Er]);if(fr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var kr=0,Er=Object.getOwnPropertySymbols(fr);kr>19^fr^fr>>8,(randseed[3]>>>0)/(1<<31>>>0)}function createColor(){const fr=Math.floor(rand()*360),br=(rand()*60+40).toFixed(1)+"%",wr=((rand()+rand()+rand()+rand())*25).toFixed(1)+"%";return"hsl("+fr+","+br+","+wr+")"}function createImageData(fr){const br=fr,wr=fr,Er=Math.ceil(br/2),kr=br-Er,jr=[];for(let Br=0;Br{if(br)if(store[br]&&store[br].opts.size===wr)Gr(store[br].opts),Zr(store[br].imageData);else{const Jr=buildOpts({seed:br,size:wr,scale:Er}),Qr=createImageData(Jr.size);Gr(Jr),Zr(Qr),store[br]={opts:Jr,imageData:Qr}}},[br]),br?qr&&Vr?jsxRuntimeExports.jsxs("svg",Object.assign({},Br,{width:Wr,height:Wr,viewBox:`0 0 ${Wr} ${Wr}`,xmlns:"http://www.w3.org/2000/svg"},{children:[jsxRuntimeExports.jsx("rect",{width:Wr,height:Wr,fill:qr.bgcolor}),jsxRuntimeExports.jsx("g",Object.assign({fill:qr.color},{children:Vr==null?void 0:Vr.map((Jr,Qr)=>{if(Jr===1){const _n=Qr%wr*Er,En=Math.floor(Qr/wr)*Er;return jsxRuntimeExports.jsx("rect",{width:Er,height:Er,x:_n,y:En},`${br}-${Qr}`)}})})),jsxRuntimeExports.jsx("g",Object.assign({fill:qr.spotcolor},{children:Vr==null?void 0:Vr.map((Jr,Qr)=>{if(Jr===2){const _n=Qr%wr*Er,En=Math.floor(Qr/wr)*Er;return jsxRuntimeExports.jsx("rect",{width:Er,height:Er,x:_n,y:En},`${br}-${Qr}`)}})}))]})):jsxRuntimeExports.jsx("svg",Object.assign({},Br,{width:Wr,height:Wr,viewBox:`0 0 ${Wr} ${Wr}`,xmlns:"http://www.w3.org/2000/svg"},{children:jsxRuntimeExports.jsx("rect",{width:Wr,height:Wr,fill:"black"})})):jsxRuntimeExports.jsx("svg",Object.assign({},Br,{width:Wr,height:Wr,viewBox:`0 0 ${Wr} ${Wr}`,xmlns:"http://www.w3.org/2000/svg"},{children:jsxRuntimeExports.jsx("rect",{width:Wr,height:Wr,fill:jr})}))}const WalletProfile=({selectedWallet:fr})=>{const{primaryWallet:br,handleLogOut:wr}=useDynamicContext(),Er=(fr==null?void 0:fr.address)||(br==null?void 0:br.address),kr=(fr==null?void 0:fr.name)??"External Wallet",[jr,Br]=reactExports.useState(!1),{dispatch:Wr}=useGlobalState(),qr=useNavigate();return jsxRuntimeExports.jsxs(Box,{display:"flex",flexDirection:"column",gap:"spacing-sm",width:"-webkit-fill-available",children:[jsxRuntimeExports.jsxs(Box,{display:"flex",justifyContent:"space-between",width:"-webkit-fill-available",children:[jsxRuntimeExports.jsx(PushLogo,{height:48,width:48}),jsxRuntimeExports.jsx(Box,{display:"flex",gap:"spacing-xxs",children:jsxRuntimeExports.jsx(Dropdown,{overlay:jsxRuntimeExports.jsx(Menu,{children:jsxRuntimeExports.jsx(MenuItem,{label:"Log Out",icon:jsxRuntimeExports.jsx(Logout,{}),onClick:()=>{sessionStorage.removeItem("jwt"),Wr({type:"RESET_AUTHENTICATED"}),Wr({type:"RESET_USER"}),localStorage.clear(),wr(),qr(APP_ROUTES.AUTH),localStorage.clear()}})}),children:jsxRuntimeExports.jsx(Box,{cursor:"pointer",children:jsxRuntimeExports.jsx(Settings,{size:24,color:"icon-primary"})})})})]}),jsxRuntimeExports.jsx(Box,{width:"56px",height:"56px",borderRadius:"radius-xl",overflow:"hidden",alignSelf:"center",children:jsxRuntimeExports.jsx(BlockiesSvg,{address:Er})}),jsxRuntimeExports.jsxs(Box,{display:"flex",flexDirection:"column",alignItems:"center",gap:"spacing-xxxs",children:[jsxRuntimeExports.jsx(Text,{variant:"bl-semibold",children:kr}),jsxRuntimeExports.jsxs(Box,{display:"flex",gap:"spacing-xxxs",children:[jsxRuntimeExports.jsx(Text,{variant:"bes-semibold",color:"text-tertiary",children:centerMaskWalletAddress(Er)}),jsxRuntimeExports.jsx(Box,{cursor:"pointer",children:jsxRuntimeExports.jsx(Tooltip,{title:jr?"Copy":"Copied",children:jr?jsxRuntimeExports.jsx(TickCircleFilled,{autoSize:!0,size:16,color:"icon-state-success-bold"}):jsxRuntimeExports.jsx(Copy,{color:"icon-tertiary",onClick:()=>handleCopy(Er,Br)})})})]})]})]})};var src$5={};const require$$0$b=getAugmentedNamespace(tslib_es6$4);var lib$1={},pushNetwork={},block$1={},validator$1={},utils$9={},hasRequiredUtils$5;function requireUtils$5(){if(hasRequiredUtils$5)return utils$9;hasRequiredUtils$5=1,Object.defineProperty(utils$9,"__esModule",{value:!0}),utils$9.getRandomElement=void 0;const fr=br=>{if(br.length===0)throw new Error("Array cannot be empty");const wr=Math.floor(Math.random()*br.length);return br[wr]};return utils$9.getRandomElement=fr,utils$9}const require$$2$3=getAugmentedNamespace(axios),version$h="1.0.6";let BaseError$1=class sS extends Error{constructor(br,wr={}){var Br;const Er=wr.cause instanceof sS?wr.cause.details:(Br=wr.cause)!=null&&Br.message?wr.cause.message:wr.details,kr=wr.cause instanceof sS&&wr.cause.docsPath||wr.docsPath,jr=[br||"An error occurred.","",...wr.metaMessages?[...wr.metaMessages,""]:[],...kr?[`Docs: https://abitype.dev${kr}`]:[],...Er?[`Details: ${Er}`]:[],`Version: abitype@${version$h}`].join(` + `,children:WALLETS_LOGO[Qr]||jsxRuntimeExports.jsx(Jr,{walletKey:Qr})}),jsxRuntimeExports.jsx(Text,{variant:"bs-semibold",color:"text-primary",children:_n})]},Qr)):jsxRuntimeExports.jsx(WalletCategories,{setSelectedWalletCategory:wr}))})]})}),jsxRuntimeExports.jsx(PoweredByPush,{})]})},Authentication=()=>{const[fr,br]=reactExports.useState(""),[wr,Er]=reactExports.useState("authentication");return jsxRuntimeExports.jsx(ContentLayout,{footer:jsxRuntimeExports.jsx(Footer,{}),children:jsxRuntimeExports.jsx(BoxLayout,{children:jsxRuntimeExports.jsxs(Box,{alignItems:"center",flexDirection:"column",display:"flex",width:"376px",padding:"spacing-md",children:[(wr==="authentication"||wr==="social")&&jsxRuntimeExports.jsx(Login,{email:fr,setEmail:br,setConnectMethod:Er}),wr==="connectWallet"&&jsxRuntimeExports.jsx(WalletSelection,{setConnectMethod:Er})]})})})};function __rest$7(fr,br){var wr={};for(var Er in fr)Object.prototype.hasOwnProperty.call(fr,Er)&&br.indexOf(Er)<0&&(wr[Er]=fr[Er]);if(fr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var kr=0,Er=Object.getOwnPropertySymbols(fr);kr>19^fr^fr>>8,(randseed[3]>>>0)/(1<<31>>>0)}function createColor(){const fr=Math.floor(rand()*360),br=(rand()*60+40).toFixed(1)+"%",wr=((rand()+rand()+rand()+rand())*25).toFixed(1)+"%";return"hsl("+fr+","+br+","+wr+")"}function createImageData(fr){const br=fr,wr=fr,Er=Math.ceil(br/2),kr=br-Er,jr=[];for(let Br=0;Br{if(br)if(store[br]&&store[br].opts.size===wr)Gr(store[br].opts),Zr(store[br].imageData);else{const Jr=buildOpts({seed:br,size:wr,scale:Er}),Qr=createImageData(Jr.size);Gr(Jr),Zr(Qr),store[br]={opts:Jr,imageData:Qr}}},[br]),br?qr&&Vr?jsxRuntimeExports.jsxs("svg",Object.assign({},Br,{width:Wr,height:Wr,viewBox:`0 0 ${Wr} ${Wr}`,xmlns:"http://www.w3.org/2000/svg"},{children:[jsxRuntimeExports.jsx("rect",{width:Wr,height:Wr,fill:qr.bgcolor}),jsxRuntimeExports.jsx("g",Object.assign({fill:qr.color},{children:Vr==null?void 0:Vr.map((Jr,Qr)=>{if(Jr===1){const _n=Qr%wr*Er,En=Math.floor(Qr/wr)*Er;return jsxRuntimeExports.jsx("rect",{width:Er,height:Er,x:_n,y:En},`${br}-${Qr}`)}})})),jsxRuntimeExports.jsx("g",Object.assign({fill:qr.spotcolor},{children:Vr==null?void 0:Vr.map((Jr,Qr)=>{if(Jr===2){const _n=Qr%wr*Er,En=Math.floor(Qr/wr)*Er;return jsxRuntimeExports.jsx("rect",{width:Er,height:Er,x:_n,y:En},`${br}-${Qr}`)}})}))]})):jsxRuntimeExports.jsx("svg",Object.assign({},Br,{width:Wr,height:Wr,viewBox:`0 0 ${Wr} ${Wr}`,xmlns:"http://www.w3.org/2000/svg"},{children:jsxRuntimeExports.jsx("rect",{width:Wr,height:Wr,fill:"black"})})):jsxRuntimeExports.jsx("svg",Object.assign({},Br,{width:Wr,height:Wr,viewBox:`0 0 ${Wr} ${Wr}`,xmlns:"http://www.w3.org/2000/svg"},{children:jsxRuntimeExports.jsx("rect",{width:Wr,height:Wr,fill:jr})}))}const WalletProfile=({selectedWallet:fr})=>{const{primaryWallet:br,handleLogOut:wr}=useDynamicContext(),Er=(fr==null?void 0:fr.address)||(br==null?void 0:br.address),kr=(fr==null?void 0:fr.name)??"Guest Wallet",[jr,Br]=reactExports.useState(!1),{dispatch:Wr}=useGlobalState(),qr=useNavigate();return jsxRuntimeExports.jsxs(Box,{display:"flex",flexDirection:"column",gap:"spacing-sm",width:"-webkit-fill-available",children:[jsxRuntimeExports.jsxs(Box,{display:"flex",justifyContent:"space-between",width:"-webkit-fill-available",children:[jsxRuntimeExports.jsx(PushLogo,{height:48,width:48}),jsxRuntimeExports.jsx(Box,{display:"flex",gap:"spacing-xxs",children:jsxRuntimeExports.jsx(Dropdown,{overlay:jsxRuntimeExports.jsx(Menu,{children:jsxRuntimeExports.jsx(MenuItem,{label:"Log Out",icon:jsxRuntimeExports.jsx(Logout,{}),onClick:()=>{sessionStorage.removeItem("jwt"),Wr({type:"RESET_AUTHENTICATED"}),Wr({type:"RESET_USER"}),localStorage.clear(),wr(),qr(APP_ROUTES.AUTH),localStorage.clear()}})}),children:jsxRuntimeExports.jsx(Box,{cursor:"pointer",children:jsxRuntimeExports.jsx(Settings,{size:24,color:"icon-primary"})})})})]}),jsxRuntimeExports.jsx(Box,{width:"56px",height:"56px",borderRadius:"radius-xl",overflow:"hidden",alignSelf:"center",children:jsxRuntimeExports.jsx(BlockiesSvg,{address:Er})}),jsxRuntimeExports.jsxs(Box,{display:"flex",flexDirection:"column",alignItems:"center",gap:"spacing-xxxs",children:[jsxRuntimeExports.jsx(Text,{variant:"bl-semibold",children:kr}),jsxRuntimeExports.jsxs(Box,{display:"flex",gap:"spacing-xxxs",children:[jsxRuntimeExports.jsx(Text,{variant:"bes-semibold",color:"text-tertiary",children:centerMaskWalletAddress(Er)}),jsxRuntimeExports.jsx(Box,{cursor:"pointer",children:jsxRuntimeExports.jsx(Tooltip,{title:jr?"Copy":"Copied",children:jr?jsxRuntimeExports.jsx(TickCircleFilled,{autoSize:!0,size:16,color:"icon-state-success-bold"}):jsxRuntimeExports.jsx(Copy,{color:"icon-tertiary",onClick:()=>handleCopy(Er,Br)})})})]})]})]})};var src$5={};const require$$0$b=getAugmentedNamespace(tslib_es6$4);var lib$1={},pushNetwork={},block$1={},validator$1={},utils$9={},hasRequiredUtils$5;function requireUtils$5(){if(hasRequiredUtils$5)return utils$9;hasRequiredUtils$5=1,Object.defineProperty(utils$9,"__esModule",{value:!0}),utils$9.getRandomElement=void 0;const fr=br=>{if(br.length===0)throw new Error("Array cannot be empty");const wr=Math.floor(Math.random()*br.length);return br[wr]};return utils$9.getRandomElement=fr,utils$9}const require$$2$3=getAugmentedNamespace(axios),version$h="1.0.6";let BaseError$1=class sS extends Error{constructor(br,wr={}){var Br;const Er=wr.cause instanceof sS?wr.cause.details:(Br=wr.cause)!=null&&Br.message?wr.cause.message:wr.details,kr=wr.cause instanceof sS&&wr.cause.docsPath||wr.docsPath,jr=[br||"An error occurred.","",...wr.metaMessages?[...wr.metaMessages,""]:[],...kr?[`Docs: https://abitype.dev${kr}`]:[],...Er?[`Details: ${Er}`]:[],`Version: abitype@${version$h}`].join(` `);super(jr),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),wr.cause&&(this.cause=wr.cause),this.details=Er,this.docsPath=kr,this.metaMessages=wr.metaMessages,this.shortMessage=br}};function execTyped(fr,br){const wr=fr.exec(br);return wr==null?void 0:wr.groups}const bytesRegex$1=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,integerRegex$1=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,isTupleRegex=/^\(.+?\).*?$/,tupleRegex=/^tuple(?(\[(\d*)\])*)$/;function formatAbiParameter(fr){let br=fr.type;if(tupleRegex.test(fr.type)&&"components"in fr){br="(";const wr=fr.components.length;for(let kr=0;kr[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function isErrorSignature(fr){return errorSignatureRegex.test(fr)}function execErrorSignature(fr){return execTyped(errorSignatureRegex,fr)}const eventSignatureRegex=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function isEventSignature(fr){return eventSignatureRegex.test(fr)}function execEventSignature(fr){return execTyped(eventSignatureRegex,fr)}const functionSignatureRegex=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;function isFunctionSignature(fr){return functionSignatureRegex.test(fr)}function execFunctionSignature(fr){return execTyped(functionSignatureRegex,fr)}const structSignatureRegex=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function isStructSignature(fr){return structSignatureRegex.test(fr)}function execStructSignature(fr){return execTyped(structSignatureRegex,fr)}const constructorSignatureRegex=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;function isConstructorSignature(fr){return constructorSignatureRegex.test(fr)}function execConstructorSignature(fr){return execTyped(constructorSignatureRegex,fr)}const fallbackSignatureRegex=/^fallback\(\) external(?:\s(?payable{1}))?$/;function isFallbackSignature(fr){return fallbackSignatureRegex.test(fr)}const receiveSignatureRegex=/^receive\(\) external payable$/;function isReceiveSignature(fr){return receiveSignatureRegex.test(fr)}const modifiers=new Set(["memory","indexed","storage","calldata"]),eventModifiers=new Set(["indexed"]),functionModifiers=new Set(["calldata","memory","storage"]);class InvalidAbiItemError extends BaseError$1{constructor({signature:br}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(br,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class UnknownTypeError extends BaseError$1{constructor({type:br}){super("Unknown type.",{metaMessages:[`Type "${br}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class UnknownSolidityTypeError extends BaseError$1{constructor({type:br}){super("Unknown type.",{metaMessages:[`Type "${br}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class InvalidAbiParameterError extends BaseError$1{constructor({param:br}){super("Failed to parse ABI parameter.",{details:`parseAbiParameter(${JSON.stringify(br,null,2)})`,docsPath:"/api/human#parseabiparameter-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParameterError"})}}class InvalidAbiParametersError extends BaseError$1{constructor({params:br}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(br,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class InvalidParameterError extends BaseError$1{constructor({param:br}){super("Invalid ABI parameter.",{details:br}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class SolidityProtectedKeywordError extends BaseError$1{constructor({param:br,name:wr}){super("Invalid ABI parameter.",{details:br,metaMessages:[`"${wr}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class InvalidModifierError extends BaseError$1{constructor({param:br,type:wr,modifier:Er}){super("Invalid ABI parameter.",{details:br,metaMessages:[`Modifier "${Er}" not allowed${wr?` in "${wr}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class InvalidFunctionModifierError extends BaseError$1{constructor({param:br,type:wr,modifier:Er}){super("Invalid ABI parameter.",{details:br,metaMessages:[`Modifier "${Er}" not allowed${wr?` in "${wr}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${Er}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class InvalidAbiTypeParameterError extends BaseError$1{constructor({abiParameter:br}){super("Invalid ABI parameter.",{details:JSON.stringify(br,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class InvalidSignatureError extends BaseError$1{constructor({signature:br,type:wr}){super(`Invalid ${wr} signature.`,{details:br}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class UnknownSignatureError extends BaseError$1{constructor({signature:br}){super("Unknown signature.",{details:br}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class InvalidStructSignatureError extends BaseError$1{constructor({signature:br}){super("Invalid struct signature.",{details:br,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class CircularReferenceError extends BaseError$1{constructor({type:br}){super("Circular reference detected.",{metaMessages:[`Struct "${br}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class InvalidParenthesisError extends BaseError$1{constructor({current:br,depth:wr}){super("Unbalanced parentheses.",{metaMessages:[`"${br.trim()}" has too many ${wr>0?"opening":"closing"} parentheses.`],details:`Depth "${wr}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function getParameterCacheKey(fr,br){return br?`${br}:${fr}`:fr}const parameterCache=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function parseSignature$1(fr,br={}){if(isFunctionSignature(fr)){const wr=execFunctionSignature(fr);if(!wr)throw new InvalidSignatureError({signature:fr,type:"function"});const Er=splitParameters(wr.parameters),kr=[],jr=Er.length;for(let Wr=0;Wr[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,abiParameterWithTupleRegex=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,dynamicIntegerRegex=/^u?int$/;function parseAbiParameter$1(fr,br){var Zr,Jr;const wr=getParameterCacheKey(fr,br==null?void 0:br.type);if(parameterCache.has(wr))return parameterCache.get(wr);const Er=isTupleRegex.test(fr),kr=execTyped(Er?abiParameterWithTupleRegex:abiParameterWithoutTupleRegex,fr);if(!kr)throw new InvalidParameterError({param:fr});if(kr.name&&isSolidityKeyword(kr.name))throw new SolidityProtectedKeywordError({param:fr,name:kr.name});const jr=kr.name?{name:kr.name}:{},Br=kr.modifier==="indexed"?{indexed:!0}:{},Wr=(br==null?void 0:br.structs)??{};let qr,Gr={};if(Er){qr="tuple";const Qr=splitParameters(kr.type),_n=[],En=Qr.length;for(let Cn=0;Cn[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function resolveStructs(fr,br,wr=new Set){const Er=[],kr=fr.length;for(let jr=0;jrbr(fr,jr)}function formatAbiItem(fr,{includeName:br=!1}={}){if(fr.type!=="function"&&fr.type!=="event"&&fr.type!=="error")throw new InvalidDefinitionTypeError(fr.type);return`${fr.name}(${formatAbiParams(fr.inputs,{includeName:br})})`}function formatAbiParams(fr,{includeName:br=!1}={}){return fr?fr.map(wr=>formatAbiParam(wr,{includeName:br})).join(br?", ":","):""}function formatAbiParam(fr,{includeName:br}){return fr.type.startsWith("tuple")?`(${formatAbiParams(fr.components,{includeName:br})})${fr.type.slice(5)}`:fr.type+(br&&fr.name?` ${fr.name}`:"")}function isHex(fr,{strict:br=!0}={}){return!fr||typeof fr!="string"?!1:br?/^0x[0-9a-fA-F]*$/.test(fr):fr.startsWith("0x")}function size$1(fr){return isHex(fr,{strict:!1})?Math.ceil((fr.length-2)/2):fr.length}const version$g="2.21.51";let errorConfig={getDocsUrl:({docsBaseUrl:fr,docsPath:br="",docsSlug:wr})=>br?`${fr??"https://viem.sh"}${br}${wr?`#${wr}`:""}`:void 0,version:`viem@${version$g}`};function setErrorConfig(fr){errorConfig=fr}class BaseError extends Error{constructor(br,wr={}){var Wr;const Er=(()=>{var qr;return wr.cause instanceof BaseError?wr.cause.details:(qr=wr.cause)!=null&&qr.message?wr.cause.message:wr.details})(),kr=wr.cause instanceof BaseError&&wr.cause.docsPath||wr.docsPath,jr=(Wr=errorConfig.getDocsUrl)==null?void 0:Wr.call(errorConfig,{...wr,docsPath:kr}),Br=[br||"An error occurred.","",...wr.metaMessages?[...wr.metaMessages,""]:[],...jr?[`Docs: ${jr}`]:[],...Er?[`Details: ${Er}`]:[],...errorConfig.version?[`Version: ${errorConfig.version}`]:[]].join(` `);super(Br,wr.cause?{cause:wr.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=Er,this.docsPath=kr,this.metaMessages=wr.metaMessages,this.name=wr.name??this.name,this.shortMessage=br,this.version=version$g}walk(br){return walk(this,br)}}function walk(fr,br){return br!=null&&br(fr)?fr:fr&&typeof fr=="object"&&"cause"in fr&&fr.cause!==void 0?walk(fr.cause,br):br?null:fr}class AbiConstructorNotFoundError extends BaseError{constructor({docsPath:br}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(` `),{docsPath:br,name:"AbiConstructorNotFoundError"})}}class AbiConstructorParamsNotFoundError extends BaseError{constructor({docsPath:br}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(` @@ -1703,11 +1705,11 @@ ${prettyStateOverride(Qr)}`),super(br.shortMessage,{cause:br,docsPath:Er,metaMes `),{cause:br,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(InsufficientFundsError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class IntrinsicGasTooHighError extends BaseError{constructor({cause:br,gas:wr}={}){super(`The amount of gas ${wr?`(${wr}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:br,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(IntrinsicGasTooHighError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class IntrinsicGasTooLowError extends BaseError{constructor({cause:br,gas:wr}={}){super(`The amount of gas ${wr?`(${wr}) `:""}provided for the transaction is too low.`,{cause:br,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(IntrinsicGasTooLowError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class TransactionTypeNotSupportedError extends BaseError{constructor({cause:br}){super("The transaction type is not supported for this chain.",{cause:br,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(TransactionTypeNotSupportedError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class TipAboveFeeCapError extends BaseError{constructor({cause:br,maxPriorityFeePerGas:wr,maxFeePerGas:Er}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${wr?` = ${formatGwei(wr)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${Er?` = ${formatGwei(Er)} gwei`:""}).`].join(` `),{cause:br,name:"TipAboveFeeCapError"})}}Object.defineProperty(TipAboveFeeCapError,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class UnknownNodeError extends BaseError{constructor({cause:br}){super(`An error occurred while executing: ${br==null?void 0:br.shortMessage}`,{cause:br,name:"UnknownNodeError"})}}function getNodeError(fr,br){const wr=(fr.details||"").toLowerCase(),Er=fr instanceof BaseError?fr.walk(kr=>(kr==null?void 0:kr.code)===ExecutionRevertedError.code):fr;return Er instanceof BaseError?new ExecutionRevertedError({cause:fr,message:Er.details}):ExecutionRevertedError.nodeMessage.test(wr)?new ExecutionRevertedError({cause:fr,message:fr.details}):FeeCapTooHighError.nodeMessage.test(wr)?new FeeCapTooHighError({cause:fr,maxFeePerGas:br==null?void 0:br.maxFeePerGas}):FeeCapTooLowError.nodeMessage.test(wr)?new FeeCapTooLowError({cause:fr,maxFeePerGas:br==null?void 0:br.maxFeePerGas}):NonceTooHighError.nodeMessage.test(wr)?new NonceTooHighError({cause:fr,nonce:br==null?void 0:br.nonce}):NonceTooLowError.nodeMessage.test(wr)?new NonceTooLowError({cause:fr,nonce:br==null?void 0:br.nonce}):NonceMaxValueError.nodeMessage.test(wr)?new NonceMaxValueError({cause:fr,nonce:br==null?void 0:br.nonce}):InsufficientFundsError.nodeMessage.test(wr)?new InsufficientFundsError({cause:fr}):IntrinsicGasTooHighError.nodeMessage.test(wr)?new IntrinsicGasTooHighError({cause:fr,gas:br==null?void 0:br.gas}):IntrinsicGasTooLowError.nodeMessage.test(wr)?new IntrinsicGasTooLowError({cause:fr,gas:br==null?void 0:br.gas}):TransactionTypeNotSupportedError.nodeMessage.test(wr)?new TransactionTypeNotSupportedError({cause:fr}):TipAboveFeeCapError.nodeMessage.test(wr)?new TipAboveFeeCapError({cause:fr,maxFeePerGas:br==null?void 0:br.maxFeePerGas,maxPriorityFeePerGas:br==null?void 0:br.maxPriorityFeePerGas}):new UnknownNodeError({cause:fr})}function getEstimateGasError(fr,{docsPath:br,...wr}){const Er=(()=>{const kr=getNodeError(fr,wr);return kr instanceof UnknownNodeError?fr:kr})();return new EstimateGasExecutionError(Er,{docsPath:br,...wr})}function extract(fr,{format:br}){if(!br)return{};const wr={};function Er(jr){const Br=Object.keys(jr);for(const Wr of Br)Wr in fr&&(wr[Wr]=fr[Wr]),jr[Wr]&&typeof jr[Wr]=="object"&&!Array.isArray(jr[Wr])&&Er(jr[Wr])}const kr=br(fr||{});return Er(kr),wr}function defineFormatter(fr,br){return({exclude:wr,format:Er})=>({exclude:wr,format:kr=>{const jr=br(kr);if(wr)for(const Br of wr)delete jr[Br];return{...jr,...Er(kr)}},type:fr})}const rpcTransactionType={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function formatTransactionRequest(fr){const br={};return typeof fr.authorizationList<"u"&&(br.authorizationList=formatAuthorizationList$1(fr.authorizationList)),typeof fr.accessList<"u"&&(br.accessList=fr.accessList),typeof fr.blobVersionedHashes<"u"&&(br.blobVersionedHashes=fr.blobVersionedHashes),typeof fr.blobs<"u"&&(typeof fr.blobs[0]!="string"?br.blobs=fr.blobs.map(wr=>bytesToHex$4(wr)):br.blobs=fr.blobs),typeof fr.data<"u"&&(br.data=fr.data),typeof fr.from<"u"&&(br.from=fr.from),typeof fr.gas<"u"&&(br.gas=numberToHex(fr.gas)),typeof fr.gasPrice<"u"&&(br.gasPrice=numberToHex(fr.gasPrice)),typeof fr.maxFeePerBlobGas<"u"&&(br.maxFeePerBlobGas=numberToHex(fr.maxFeePerBlobGas)),typeof fr.maxFeePerGas<"u"&&(br.maxFeePerGas=numberToHex(fr.maxFeePerGas)),typeof fr.maxPriorityFeePerGas<"u"&&(br.maxPriorityFeePerGas=numberToHex(fr.maxPriorityFeePerGas)),typeof fr.nonce<"u"&&(br.nonce=numberToHex(fr.nonce)),typeof fr.to<"u"&&(br.to=fr.to),typeof fr.type<"u"&&(br.type=rpcTransactionType[fr.type]),typeof fr.value<"u"&&(br.value=numberToHex(fr.value)),br}const defineTransactionRequest=defineFormatter("transactionRequest",formatTransactionRequest);function formatAuthorizationList$1(fr){return fr.map(br=>({address:br.contractAddress,r:br.r,s:br.s,chainId:numberToHex(br.chainId),nonce:numberToHex(br.nonce),...typeof br.yParity<"u"?{yParity:numberToHex(br.yParity)}:{},...typeof br.v<"u"&&typeof br.yParity>"u"?{v:numberToHex(br.v)}:{}}))}function serializeStateMapping(fr){if(!(!fr||fr.length===0))return fr.reduce((br,{slot:wr,value:Er})=>{if(wr.length!==66)throw new InvalidBytesLengthError({size:wr.length,targetSize:66,type:"hex"});if(Er.length!==66)throw new InvalidBytesLengthError({size:Er.length,targetSize:66,type:"hex"});return br[wr]=Er,br},{})}function serializeAccountStateOverride(fr){const{balance:br,nonce:wr,state:Er,stateDiff:kr,code:jr}=fr,Br={};if(jr!==void 0&&(Br.code=jr),br!==void 0&&(Br.balance=numberToHex(br)),wr!==void 0&&(Br.nonce=numberToHex(wr)),Er!==void 0&&(Br.state=serializeStateMapping(Er)),kr!==void 0){if(Br.state)throw new StateAssignmentConflictError;Br.stateDiff=serializeStateMapping(kr)}return Br}function serializeStateOverride(fr){if(!fr)return;const br={};for(const{address:wr,...Er}of fr){if(!isAddress(wr,{strict:!1}))throw new InvalidAddressError({address:wr});if(br[wr])throw new AccountStateConflictError({address:wr});br[wr]=serializeAccountStateOverride(Er)}return br}const maxInt8=2n**(8n-1n)-1n,maxInt16=2n**(16n-1n)-1n,maxInt24=2n**(24n-1n)-1n,maxInt32=2n**(32n-1n)-1n,maxInt40=2n**(40n-1n)-1n,maxInt48=2n**(48n-1n)-1n,maxInt56=2n**(56n-1n)-1n,maxInt64=2n**(64n-1n)-1n,maxInt72=2n**(72n-1n)-1n,maxInt80=2n**(80n-1n)-1n,maxInt88=2n**(88n-1n)-1n,maxInt96=2n**(96n-1n)-1n,maxInt104=2n**(104n-1n)-1n,maxInt112=2n**(112n-1n)-1n,maxInt120=2n**(120n-1n)-1n,maxInt128=2n**(128n-1n)-1n,maxInt136=2n**(136n-1n)-1n,maxInt144=2n**(144n-1n)-1n,maxInt152=2n**(152n-1n)-1n,maxInt160=2n**(160n-1n)-1n,maxInt168=2n**(168n-1n)-1n,maxInt176=2n**(176n-1n)-1n,maxInt184=2n**(184n-1n)-1n,maxInt192=2n**(192n-1n)-1n,maxInt200=2n**(200n-1n)-1n,maxInt208=2n**(208n-1n)-1n,maxInt216=2n**(216n-1n)-1n,maxInt224=2n**(224n-1n)-1n,maxInt232=2n**(232n-1n)-1n,maxInt240=2n**(240n-1n)-1n,maxInt248=2n**(248n-1n)-1n,maxInt256=2n**(256n-1n)-1n,minInt8=-(2n**(8n-1n)),minInt16=-(2n**(16n-1n)),minInt24=-(2n**(24n-1n)),minInt32=-(2n**(32n-1n)),minInt40=-(2n**(40n-1n)),minInt48=-(2n**(48n-1n)),minInt56=-(2n**(56n-1n)),minInt64=-(2n**(64n-1n)),minInt72=-(2n**(72n-1n)),minInt80=-(2n**(80n-1n)),minInt88=-(2n**(88n-1n)),minInt96=-(2n**(96n-1n)),minInt104=-(2n**(104n-1n)),minInt112=-(2n**(112n-1n)),minInt120=-(2n**(120n-1n)),minInt128=-(2n**(128n-1n)),minInt136=-(2n**(136n-1n)),minInt144=-(2n**(144n-1n)),minInt152=-(2n**(152n-1n)),minInt160=-(2n**(160n-1n)),minInt168=-(2n**(168n-1n)),minInt176=-(2n**(176n-1n)),minInt184=-(2n**(184n-1n)),minInt192=-(2n**(192n-1n)),minInt200=-(2n**(200n-1n)),minInt208=-(2n**(208n-1n)),minInt216=-(2n**(216n-1n)),minInt224=-(2n**(224n-1n)),minInt232=-(2n**(232n-1n)),minInt240=-(2n**(240n-1n)),minInt248=-(2n**(248n-1n)),minInt256=-(2n**(256n-1n)),maxUint8=2n**8n-1n,maxUint16=2n**16n-1n,maxUint24=2n**24n-1n,maxUint32=2n**32n-1n,maxUint40=2n**40n-1n,maxUint48=2n**48n-1n,maxUint56=2n**56n-1n,maxUint64=2n**64n-1n,maxUint72=2n**72n-1n,maxUint80=2n**80n-1n,maxUint88=2n**88n-1n,maxUint96=2n**96n-1n,maxUint104=2n**104n-1n,maxUint112=2n**112n-1n,maxUint120=2n**120n-1n,maxUint128=2n**128n-1n,maxUint136=2n**136n-1n,maxUint144=2n**144n-1n,maxUint152=2n**152n-1n,maxUint160=2n**160n-1n,maxUint168=2n**168n-1n,maxUint176=2n**176n-1n,maxUint184=2n**184n-1n,maxUint192=2n**192n-1n,maxUint200=2n**200n-1n,maxUint208=2n**208n-1n,maxUint216=2n**216n-1n,maxUint224=2n**224n-1n,maxUint232=2n**232n-1n,maxUint240=2n**240n-1n,maxUint248=2n**248n-1n,maxUint256=2n**256n-1n;function assertRequest(fr){const{account:br,gasPrice:wr,maxFeePerGas:Er,maxPriorityFeePerGas:kr,to:jr}=fr,Br=br?parseAccount(br):void 0;if(Br&&!isAddress(Br.address))throw new InvalidAddressError({address:Br.address});if(jr&&!isAddress(jr))throw new InvalidAddressError({address:jr});if(typeof wr<"u"&&(typeof Er<"u"||typeof kr<"u"))throw new FeeConflictError;if(Er&&Er>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:Er});if(kr&&Er&&kr>Er)throw new TipAboveFeeCapError({maxFeePerGas:Er,maxPriorityFeePerGas:kr})}class BaseFeeScalarError extends BaseError{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class Eip1559FeesNotSupportedError extends BaseError{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class MaxFeePerGasTooLowError extends BaseError{constructor({maxPriorityFeePerGas:br}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${formatGwei(br)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class BlockNotFoundError extends BaseError{constructor({blockHash:br,blockNumber:wr}){let Er="Block";br&&(Er=`Block at hash "${br}"`),wr&&(Er=`Block at number "${wr}"`),super(`${Er} could not be found.`,{name:"BlockNotFoundError"})}}const transactionType={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function formatTransaction(fr){const br={...fr,blockHash:fr.blockHash?fr.blockHash:null,blockNumber:fr.blockNumber?BigInt(fr.blockNumber):null,chainId:fr.chainId?hexToNumber$2(fr.chainId):void 0,gas:fr.gas?BigInt(fr.gas):void 0,gasPrice:fr.gasPrice?BigInt(fr.gasPrice):void 0,maxFeePerBlobGas:fr.maxFeePerBlobGas?BigInt(fr.maxFeePerBlobGas):void 0,maxFeePerGas:fr.maxFeePerGas?BigInt(fr.maxFeePerGas):void 0,maxPriorityFeePerGas:fr.maxPriorityFeePerGas?BigInt(fr.maxPriorityFeePerGas):void 0,nonce:fr.nonce?hexToNumber$2(fr.nonce):void 0,to:fr.to?fr.to:null,transactionIndex:fr.transactionIndex?Number(fr.transactionIndex):null,type:fr.type?transactionType[fr.type]:void 0,typeHex:fr.type?fr.type:void 0,value:fr.value?BigInt(fr.value):void 0,v:fr.v?BigInt(fr.v):void 0};return fr.authorizationList&&(br.authorizationList=formatAuthorizationList(fr.authorizationList)),br.yParity=(()=>{if(fr.yParity)return Number(fr.yParity);if(typeof br.v=="bigint"){if(br.v===0n||br.v===27n)return 0;if(br.v===1n||br.v===28n)return 1;if(br.v>=35n)return br.v%2n===0n?1:0}})(),br.type==="legacy"&&(delete br.accessList,delete br.maxFeePerBlobGas,delete br.maxFeePerGas,delete br.maxPriorityFeePerGas,delete br.yParity),br.type==="eip2930"&&(delete br.maxFeePerBlobGas,delete br.maxFeePerGas,delete br.maxPriorityFeePerGas),br.type==="eip1559"&&delete br.maxFeePerBlobGas,br}const defineTransaction=defineFormatter("transaction",formatTransaction);function formatAuthorizationList(fr){return fr.map(br=>({contractAddress:br.address,chainId:Number(br.chainId),nonce:Number(br.nonce),r:br.r,s:br.s,yParity:Number(br.yParity)}))}function formatBlock(fr){const br=(fr.transactions??[]).map(wr=>typeof wr=="string"?wr:formatTransaction(wr));return{...fr,baseFeePerGas:fr.baseFeePerGas?BigInt(fr.baseFeePerGas):null,blobGasUsed:fr.blobGasUsed?BigInt(fr.blobGasUsed):void 0,difficulty:fr.difficulty?BigInt(fr.difficulty):void 0,excessBlobGas:fr.excessBlobGas?BigInt(fr.excessBlobGas):void 0,gasLimit:fr.gasLimit?BigInt(fr.gasLimit):void 0,gasUsed:fr.gasUsed?BigInt(fr.gasUsed):void 0,hash:fr.hash?fr.hash:null,logsBloom:fr.logsBloom?fr.logsBloom:null,nonce:fr.nonce?fr.nonce:null,number:fr.number?BigInt(fr.number):null,size:fr.size?BigInt(fr.size):void 0,timestamp:fr.timestamp?BigInt(fr.timestamp):void 0,transactions:br,totalDifficulty:fr.totalDifficulty?BigInt(fr.totalDifficulty):null}}const defineBlock=defineFormatter("block",formatBlock);async function getBlock(fr,{blockHash:br,blockNumber:wr,blockTag:Er,includeTransactions:kr}={}){var Vr,Zr,Jr;const jr=Er??"latest",Br=kr??!1,Wr=wr!==void 0?numberToHex(wr):void 0;let qr=null;if(br?qr=await fr.request({method:"eth_getBlockByHash",params:[br,Br]},{dedupe:!0}):qr=await fr.request({method:"eth_getBlockByNumber",params:[Wr||jr,Br]},{dedupe:!!Wr}),!qr)throw new BlockNotFoundError({blockHash:br,blockNumber:wr});return(((Jr=(Zr=(Vr=fr.chain)==null?void 0:Vr.formatters)==null?void 0:Zr.block)==null?void 0:Jr.format)||formatBlock)(qr)}async function getGasPrice(fr){const br=await fr.request({method:"eth_gasPrice"});return BigInt(br)}async function estimateMaxPriorityFeePerGas(fr,br){return internal_estimateMaxPriorityFeePerGas(fr,br)}async function internal_estimateMaxPriorityFeePerGas(fr,br){var jr,Br;const{block:wr,chain:Er=fr.chain,request:kr}=br||{};try{const Wr=((jr=Er==null?void 0:Er.fees)==null?void 0:jr.maxPriorityFeePerGas)??((Br=Er==null?void 0:Er.fees)==null?void 0:Br.defaultPriorityFee);if(typeof Wr=="function"){const Gr=wr||await getAction(fr,getBlock,"getBlock")({}),Vr=await Wr({block:Gr,client:fr,request:kr});if(Vr===null)throw new Error;return Vr}if(typeof Wr<"u")return Wr;const qr=await fr.request({method:"eth_maxPriorityFeePerGas"});return hexToBigInt(qr)}catch{const[Wr,qr]=await Promise.all([wr?Promise.resolve(wr):getAction(fr,getBlock,"getBlock")({}),getAction(fr,getGasPrice,"getGasPrice")({})]);if(typeof Wr.baseFeePerGas!="bigint")throw new Eip1559FeesNotSupportedError;const Gr=qr-Wr.baseFeePerGas;return Gr<0n?0n:Gr}}async function estimateFeesPerGas$1(fr,br){return internal_estimateFeesPerGas(fr,br)}async function internal_estimateFeesPerGas(fr,br){var Jr,Qr;const{block:wr,chain:Er=fr.chain,request:kr,type:jr="eip1559"}=br||{},Br=await(async()=>{var _n,En;return typeof((_n=Er==null?void 0:Er.fees)==null?void 0:_n.baseFeeMultiplier)=="function"?Er.fees.baseFeeMultiplier({block:wr,client:fr,request:kr}):((En=Er==null?void 0:Er.fees)==null?void 0:En.baseFeeMultiplier)??1.2})();if(Br<1)throw new BaseFeeScalarError;const qr=10**(((Jr=Br.toString().split(".")[1])==null?void 0:Jr.length)??0),Gr=_n=>_n*BigInt(Math.ceil(Br*qr))/BigInt(qr),Vr=wr||await getAction(fr,getBlock,"getBlock")({});if(typeof((Qr=Er==null?void 0:Er.fees)==null?void 0:Qr.estimateFeesPerGas)=="function"){const _n=await Er.fees.estimateFeesPerGas({block:wr,client:fr,multiply:Gr,request:kr,type:jr});if(_n!==null)return _n}if(jr==="eip1559"){if(typeof Vr.baseFeePerGas!="bigint")throw new Eip1559FeesNotSupportedError;const _n=typeof(kr==null?void 0:kr.maxPriorityFeePerGas)=="bigint"?kr.maxPriorityFeePerGas:await internal_estimateMaxPriorityFeePerGas(fr,{block:Vr,chain:Er,request:kr}),En=Gr(Vr.baseFeePerGas);return{maxFeePerGas:(kr==null?void 0:kr.maxFeePerGas)??En+_n,maxPriorityFeePerGas:_n}}return{gasPrice:(kr==null?void 0:kr.gasPrice)??Gr(await getAction(fr,getGasPrice,"getGasPrice")({}))}}async function getTransactionCount(fr,{address:br,blockTag:wr="latest",blockNumber:Er}){const kr=await fr.request({method:"eth_getTransactionCount",params:[br,Er?numberToHex(Er):wr]},{dedupe:!!Er});return hexToNumber$2(kr)}function blobsToCommitments(fr){const{kzg:br}=fr,wr=fr.to??(typeof fr.blobs[0]=="string"?"hex":"bytes"),Er=typeof fr.blobs[0]=="string"?fr.blobs.map(jr=>hexToBytes$4(jr)):fr.blobs,kr=[];for(const jr of Er)kr.push(Uint8Array.from(br.blobToKzgCommitment(jr)));return wr==="bytes"?kr:kr.map(jr=>bytesToHex$4(jr))}function blobsToProofs(fr){const{kzg:br}=fr,wr=fr.to??(typeof fr.blobs[0]=="string"?"hex":"bytes"),Er=typeof fr.blobs[0]=="string"?fr.blobs.map(Br=>hexToBytes$4(Br)):fr.blobs,kr=typeof fr.commitments[0]=="string"?fr.commitments.map(Br=>hexToBytes$4(Br)):fr.commitments,jr=[];for(let Br=0;BrbytesToHex$4(Br))}function setBigUint64$2(fr,br,wr,Er){if(typeof fr.setBigUint64=="function")return fr.setBigUint64(br,wr,Er);const kr=BigInt(32),jr=BigInt(4294967295),Br=Number(wr>>kr&jr),Wr=Number(wr&jr),qr=Er?4:0,Gr=Er?0:4;fr.setUint32(br+qr,Br,Er),fr.setUint32(br+Gr,Wr,Er)}const Chi$2=(fr,br,wr)=>fr&br^~fr&wr,Maj$2=(fr,br,wr)=>fr&br^fr&wr^br≀let HashMD$2=class extends Hash$3{constructor(br,wr,Er,kr){super(),this.blockLen=br,this.outputLen=wr,this.padOffset=Er,this.isLE=kr,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(br),this.view=createView$2(this.buffer)}update(br){exists(this);const{view:wr,buffer:Er,blockLen:kr}=this;br=toBytes$2(br);const jr=br.length;for(let Br=0;Brkr-Br&&(this.process(Er,0),Br=0);for(let Zr=Br;ZrVr.length)throw new Error("_sha2: outputLen bigger than state");for(let Zr=0;Zr>>3,En=rotr$2(Qr,17)^rotr$2(Qr,19)^Qr>>>10;SHA256_W$2[Zr]=En+SHA256_W$2[Zr-7]+_n+SHA256_W$2[Zr-16]|0}let{A:Er,B:kr,C:jr,D:Br,E:Wr,F:qr,G:Gr,H:Vr}=this;for(let Zr=0;Zr<64;Zr++){const Jr=rotr$2(Wr,6)^rotr$2(Wr,11)^rotr$2(Wr,25),Qr=Vr+Jr+Chi$2(Wr,qr,Gr)+SHA256_K$2[Zr]+SHA256_W$2[Zr]|0,En=(rotr$2(Er,2)^rotr$2(Er,13)^rotr$2(Er,22))+Maj$2(Er,kr,jr)|0;Vr=Gr,Gr=qr,qr=Wr,Wr=Br+Qr|0,Br=jr,jr=kr,kr=Er,Er=Qr+En|0}Er=Er+this.A|0,kr=kr+this.B|0,jr=jr+this.C|0,Br=Br+this.D|0,Wr=Wr+this.E|0,qr=qr+this.F|0,Gr=Gr+this.G|0,Vr=Vr+this.H|0,this.set(Er,kr,jr,Br,Wr,qr,Gr,Vr)}roundClean(){SHA256_W$2.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const sha256$7=wrapConstructor$2(()=>new SHA256$2);function sha256$6(fr,br){const wr=br||"hex",Er=sha256$7(isHex(fr,{strict:!1})?toBytes$3(fr):fr);return wr==="bytes"?Er:toHex(Er)}function commitmentToVersionedHash(fr){const{commitment:br,version:wr=1}=fr,Er=fr.to??(typeof br=="string"?"hex":"bytes"),kr=sha256$6(br,"bytes");return kr.set([wr],0),Er==="bytes"?kr:bytesToHex$4(kr)}function commitmentsToVersionedHashes(fr){const{commitments:br,version:wr}=fr,Er=fr.to??(typeof br[0]=="string"?"hex":"bytes"),kr=[];for(const jr of br)kr.push(commitmentToVersionedHash({commitment:jr,to:Er,version:wr}));return kr}const blobsPerTransaction=6,bytesPerFieldElement=32,fieldElementsPerBlob=4096,bytesPerBlob=bytesPerFieldElement*fieldElementsPerBlob,maxBytesPerTransaction=bytesPerBlob*blobsPerTransaction-1-1*fieldElementsPerBlob*blobsPerTransaction,versionedHashVersionKzg=1;class BlobSizeTooLargeError extends BaseError{constructor({maxSize:br,size:wr}){super("Blob size is too large.",{metaMessages:[`Max: ${br} bytes`,`Given: ${wr} bytes`],name:"BlobSizeTooLargeError"})}}class EmptyBlobError extends BaseError{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class InvalidVersionedHashSizeError extends BaseError{constructor({hash:br,size:wr}){super(`Versioned hash "${br}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${wr}`],name:"InvalidVersionedHashSizeError"})}}class InvalidVersionedHashVersionError extends BaseError{constructor({hash:br,version:wr}){super(`Versioned hash "${br}" version is invalid.`,{metaMessages:[`Expected: ${versionedHashVersionKzg}`,`Received: ${wr}`],name:"InvalidVersionedHashVersionError"})}}function toBlobs(fr){const br=fr.to??(typeof fr.data=="string"?"hex":"bytes"),wr=typeof fr.data=="string"?hexToBytes$4(fr.data):fr.data,Er=size$1(wr);if(!Er)throw new EmptyBlobError;if(Er>maxBytesPerTransaction)throw new BlobSizeTooLargeError({maxSize:maxBytesPerTransaction,size:Er});const kr=[];let jr=!0,Br=0;for(;jr;){const Wr=createCursor(new Uint8Array(bytesPerBlob));let qr=0;for(;qrWr.bytes):kr.map(Wr=>bytesToHex$4(Wr.bytes))}function toBlobSidecars(fr){const{data:br,kzg:wr,to:Er}=fr,kr=fr.blobs??toBlobs({data:br,to:Er}),jr=fr.commitments??blobsToCommitments({blobs:kr,kzg:wr,to:Er}),Br=fr.proofs??blobsToProofs({blobs:kr,commitments:jr,kzg:wr,to:Er}),Wr=[];for(let qr=0;qr"u"&&Zr)if(qr){const In=await Cn();Jr.nonce=await qr.consume({address:Zr.address,chainId:In,client:fr})}else Jr.nonce=await getAction(fr,getTransactionCount,"getTransactionCount")({address:Zr.address,blockTag:"pending"});if((Gr.includes("fees")||Gr.includes("type"))&&typeof Vr>"u")try{Jr.type=getTransactionType(Jr)}catch{const In=await _n();Jr.type=typeof(In==null?void 0:In.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(Gr.includes("fees"))if(Jr.type!=="legacy"&&Jr.type!=="eip2930"){if(typeof Jr.maxFeePerGas>"u"||typeof Jr.maxPriorityFeePerGas>"u"){const In=await _n(),{maxFeePerGas:An,maxPriorityFeePerGas:jn}=await internal_estimateFeesPerGas(fr,{block:In,chain:kr,request:Jr});if(typeof br.maxPriorityFeePerGas>"u"&&br.maxFeePerGas&&br.maxFeePerGas"u"&&(Jr.gas=await getAction(fr,estimateGas$1,"estimateGas")({...Jr,account:Zr&&{address:Zr.address,type:"json-rpc"}})),assertRequest(Jr),delete Jr.parameters,Jr}async function getBalance(fr,{address:br,blockNumber:wr,blockTag:Er="latest"}){const kr=wr?numberToHex(wr):void 0,jr=await fr.request({method:"eth_getBalance",params:[br,kr||Er]});return BigInt(jr)}async function estimateGas$1(fr,br){var kr,jr,Br;const{account:wr=fr.account}=br,Er=wr?parseAccount(wr):void 0;try{let Hr=function(Sn){const{block:Rn,request:Pn,rpcStateOverride:On}=Sn;return fr.request({method:"eth_estimateGas",params:On?[Pn,Rn??"latest",On]:Rn?[Pn,Rn]:[Pn]})};const{accessList:Wr,authorizationList:qr,blobs:Gr,blobVersionedHashes:Vr,blockNumber:Zr,blockTag:Jr,data:Qr,gas:_n,gasPrice:En,maxFeePerBlobGas:Cn,maxFeePerGas:In,maxPriorityFeePerGas:An,nonce:jn,value:eo,stateOverride:ro,...to}=await prepareTransactionRequest(fr,{...br,parameters:(Er==null?void 0:Er.type)==="local"?void 0:["blobVersionedHashes"]}),oo=(Zr?numberToHex(Zr):void 0)||Jr,io=serializeStateOverride(ro),co=await(async()=>{if(to.to)return to.to;if(qr&&qr.length>0)return await recoverAuthorizationAddress({authorization:qr[0]}).catch(()=>{throw new BaseError("`to` is required. Could not infer from `authorizationList`")})})();assertRequest(br);const so=(Br=(jr=(kr=fr.chain)==null?void 0:kr.formatters)==null?void 0:jr.transactionRequest)==null?void 0:Br.format,Tn=(so||formatTransactionRequest)({...extract(to,{format:so}),from:Er==null?void 0:Er.address,accessList:Wr,authorizationList:qr,blobs:Gr,blobVersionedHashes:Vr,data:Qr,gas:_n,gasPrice:En,maxFeePerBlobGas:Cn,maxFeePerGas:In,maxPriorityFeePerGas:An,nonce:jn,to:co,value:eo});let Xr=BigInt(await Hr({block:oo,request:Tn,rpcStateOverride:io}));if(qr){const Sn=await getBalance(fr,{address:Tn.from}),Rn=await Promise.all(qr.map(async Pn=>{const{contractAddress:On}=Pn,Zn=await Hr({block:oo,request:{authorizationList:void 0,data:Qr,from:Er==null?void 0:Er.address,to:On,value:numberToHex(Sn)},rpcStateOverride:io}).catch(()=>100000n);return 2n*BigInt(Zn)}));Xr+=Rn.reduce((Pn,On)=>Pn+On,0n)}return Xr}catch(Wr){throw getEstimateGasError(Wr,{...br,account:Er,chain:fr.chain})}}async function estimateContractGas(fr,br){const{abi:wr,address:Er,args:kr,functionName:jr,...Br}=br,Wr=encodeFunctionData({abi:wr,args:kr,functionName:jr});try{return await getAction(fr,estimateGas$1,"estimateGas")({data:Wr,to:Er,...Br})}catch(qr){const Gr=Br.account?parseAccount(Br.account):void 0;throw getContractError(qr,{abi:wr,address:Er,args:kr,docsPath:"/docs/contract/estimateContractGas",functionName:jr,sender:Gr==null?void 0:Gr.address})}}function isAddressEqual(fr,br){if(!isAddress(fr,{strict:!1}))throw new InvalidAddressError({address:fr});if(!isAddress(br,{strict:!1}))throw new InvalidAddressError({address:br});return fr.toLowerCase()===br.toLowerCase()}const docsPath$5="/docs/contract/decodeEventLog";function decodeEventLog(fr){const{abi:br,data:wr,strict:Er,topics:kr}=fr,jr=Er??!0,[Br,...Wr]=kr;if(!Br)throw new AbiEventSignatureEmptyTopicsError({docsPath:docsPath$5});const qr=br.length===1?br[0]:br.find(En=>En.type==="event"&&Br===toEventSelector(formatAbiItem(En)));if(!(qr&&"name"in qr)||qr.type!=="event")throw new AbiEventSignatureNotFoundError(Br,{docsPath:docsPath$5});const{name:Gr,inputs:Vr}=qr,Zr=Vr==null?void 0:Vr.some(En=>!("name"in En&&En.name));let Jr=Zr?[]:{};const Qr=Vr.filter(En=>"indexed"in En&&En.indexed);for(let En=0;En!("indexed"in En&&En.indexed));if(_n.length>0){if(wr&&wr!=="0x")try{const En=decodeAbiParameters(_n,wr);if(En)if(Zr)Jr=[...Jr,...En];else for(let Cn=0;Cn<_n.length;Cn++)Jr[_n[Cn].name]=En[Cn]}catch(En){if(jr)throw En instanceof AbiDecodingDataSizeTooSmallError||En instanceof PositionOutOfBoundsError?new DecodeLogDataMismatch({abiItem:qr,data:wr,params:_n,size:size$1(wr)}):En}else if(jr)throw new DecodeLogDataMismatch({abiItem:qr,data:"0x",params:_n,size:0})}return{eventName:Gr,args:Object.values(Jr).length>0?Jr:void 0}}function decodeTopic({param:fr,value:br}){return fr.type==="string"||fr.type==="bytes"||fr.type==="tuple"||fr.type.match(/^(.*)\[(\d+)?\]$/)?br:(decodeAbiParameters([fr],br)||[])[0]}function parseEventLogs(fr){const{abi:br,args:wr,logs:Er,strict:kr=!0}=fr,jr=(()=>{if(fr.eventName)return Array.isArray(fr.eventName)?fr.eventName:[fr.eventName]})();return Er.map(Br=>{var Wr;try{const qr=br.find(Vr=>Vr.type==="event"&&Br.topics[0]===toEventSelector(Vr));if(!qr)return null;const Gr=decodeEventLog({...Br,abi:[qr],strict:kr});return jr&&!jr.includes(Gr.eventName)||!includesArgs({args:Gr.args,inputs:qr.inputs,matchArgs:wr})?null:{...Gr,...Br}}catch(qr){let Gr,Vr;if(qr instanceof AbiEventSignatureNotFoundError)return null;if(qr instanceof DecodeLogDataMismatch||qr instanceof DecodeLogTopicsMismatch){if(kr)return null;Gr=qr.abiItem.name,Vr=(Wr=qr.abiItem.inputs)==null?void 0:Wr.some(Zr=>!("name"in Zr&&Zr.name))}return{...Br,args:Vr?[]:{},eventName:Gr}}}).filter(Boolean)}function includesArgs(fr){const{args:br,inputs:wr,matchArgs:Er}=fr;if(!Er)return!0;if(!br)return!1;function kr(jr,Br,Wr){try{return jr.type==="address"?isAddressEqual(Br,Wr):jr.type==="string"||jr.type==="bytes"?keccak256(toBytes$3(Br))===Wr:Br===Wr}catch{return!1}}return Array.isArray(br)&&Array.isArray(Er)?Er.every((jr,Br)=>{if(jr==null)return!0;const Wr=wr[Br];return Wr?(Array.isArray(jr)?jr:[jr]).some(Gr=>kr(Wr,Gr,br[Br])):!1}):typeof br=="object"&&!Array.isArray(br)&&typeof Er=="object"&&!Array.isArray(Er)?Object.entries(Er).every(([jr,Br])=>{if(Br==null)return!0;const Wr=wr.find(Gr=>Gr.name===jr);return Wr?(Array.isArray(Br)?Br:[Br]).some(Gr=>kr(Wr,Gr,br[jr])):!1}):!1}function formatLog(fr,{args:br,eventName:wr}={}){return{...fr,blockHash:fr.blockHash?fr.blockHash:null,blockNumber:fr.blockNumber?BigInt(fr.blockNumber):null,logIndex:fr.logIndex?Number(fr.logIndex):null,transactionHash:fr.transactionHash?fr.transactionHash:null,transactionIndex:fr.transactionIndex?Number(fr.transactionIndex):null,...wr?{args:br,eventName:wr}:{}}}async function getLogs(fr,{address:br,blockHash:wr,fromBlock:Er,toBlock:kr,event:jr,events:Br,args:Wr,strict:qr}={}){const Gr=qr??!1,Vr=Br??(jr?[jr]:void 0);let Zr=[];Vr&&(Zr=[Vr.flatMap(En=>encodeEventTopics({abi:[En],eventName:En.name,args:Br?void 0:Wr}))],jr&&(Zr=Zr[0]));let Jr;wr?Jr=await fr.request({method:"eth_getLogs",params:[{address:br,topics:Zr,blockHash:wr}]}):Jr=await fr.request({method:"eth_getLogs",params:[{address:br,topics:Zr,fromBlock:typeof Er=="bigint"?numberToHex(Er):Er,toBlock:typeof kr=="bigint"?numberToHex(kr):kr}]});const Qr=Jr.map(_n=>formatLog(_n));return Vr?parseEventLogs({abi:Vr,args:Wr,logs:Qr,strict:Gr}):Qr}async function getContractEvents(fr,br){const{abi:wr,address:Er,args:kr,blockHash:jr,eventName:Br,fromBlock:Wr,toBlock:qr,strict:Gr}=br,Vr=Br?getAbiItem({abi:wr,name:Br}):void 0,Zr=Vr?void 0:wr.filter(Jr=>Jr.type==="event");return getAction(fr,getLogs,"getLogs")({address:Er,args:kr,blockHash:jr,event:Vr,events:Zr,fromBlock:Wr,toBlock:qr,strict:Gr})}const docsPath$4="/docs/contract/decodeFunctionResult";function decodeFunctionResult(fr){const{abi:br,args:wr,functionName:Er,data:kr}=fr;let jr=br[0];if(Er){const Wr=getAbiItem({abi:br,args:wr,name:Er});if(!Wr)throw new AbiFunctionNotFoundError(Er,{docsPath:docsPath$4});jr=Wr}if(jr.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath:docsPath$4});if(!jr.outputs)throw new AbiFunctionOutputsNotFoundError(jr.name,{docsPath:docsPath$4});const Br=decodeAbiParameters(jr.outputs,kr);if(Br&&Br.length>1)return Br;if(Br&&Br.length===1)return Br[0]}const multicall3Abi=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],universalResolverErrors=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],universalResolverResolveAbi=[...universalResolverErrors,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],universalResolverReverseAbi=[...universalResolverErrors,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],textResolverAbi=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],addressResolverAbi=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],universalSignatureValidatorAbi=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],erc20Abi$1=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],erc20Abi_bytes32=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"bytes32"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],erc721Abi=[{type:"event",name:"Approval",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!0,name:"tokenId",type:"uint256"}]},{type:"event",name:"ApprovalForAll",inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"operator",type:"address"},{indexed:!1,name:"approved",type:"bool"}]},{type:"event",name:"Transfer",inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!0,name:"tokenId",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"payable",inputs:[{name:"spender",type:"address"},{name:"tokenId",type:"uint256"}],outputs:[]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"getApproved",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{type:"address"}]},{type:"function",name:"isApprovedForAll",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"operator",type:"address"}],outputs:[{type:"bool"}]},{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"ownerOf",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"owner",type:"address"}]},{type:"function",name:"safeTransferFrom",stateMutability:"payable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"tokenId",type:"uint256"}],outputs:[]},{type:"function",name:"safeTransferFrom",stateMutability:"nonpayable",inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"id",type:"uint256"},{name:"data",type:"bytes"}],outputs:[]},{type:"function",name:"setApprovalForAll",stateMutability:"nonpayable",inputs:[{name:"operator",type:"address"},{name:"approved",type:"bool"}],outputs:[]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:"string"}]},{type:"function",name:"tokenByIndex",stateMutability:"view",inputs:[{name:"index",type:"uint256"}],outputs:[{type:"uint256"}]},{type:"function",name:"tokenByIndex",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"index",type:"uint256"}],outputs:[{name:"tokenId",type:"uint256"}]},{type:"function",name:"tokenURI",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{type:"string"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{type:"uint256"}]},{type:"function",name:"transferFrom",stateMutability:"payable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"tokeId",type:"uint256"}],outputs:[]}],erc4626Abi=[{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"receiver",type:"address"},{indexed:!1,name:"assets",type:"uint256"},{indexed:!1,name:"shares",type:"uint256"}],name:"Deposit",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"receiver",type:"address"},{indexed:!0,name:"owner",type:"address"},{indexed:!1,name:"assets",type:"uint256"},{indexed:!1,name:"shares",type:"uint256"}],name:"Withdraw",type:"event"},{inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],name:"allowance",outputs:[{type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],name:"approve",outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"asset",outputs:[{name:"assetTokenAddress",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"balanceOf",outputs:[{type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"}],name:"convertToAssets",outputs:[{name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"assets",type:"uint256"}],name:"convertToShares",outputs:[{name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"assets",type:"uint256"},{name:"receiver",type:"address"}],name:"deposit",outputs:[{name:"shares",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"caller",type:"address"}],name:"maxDeposit",outputs:[{name:"maxAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"caller",type:"address"}],name:"maxMint",outputs:[{name:"maxShares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"address"}],name:"maxRedeem",outputs:[{name:"maxShares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"owner",type:"address"}],name:"maxWithdraw",outputs:[{name:"maxAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"},{name:"receiver",type:"address"}],name:"mint",outputs:[{name:"assets",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"assets",type:"uint256"}],name:"previewDeposit",outputs:[{name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"}],name:"previewMint",outputs:[{name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"}],name:"previewRedeem",outputs:[{name:"assets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"assets",type:"uint256"}],name:"previewWithdraw",outputs:[{name:"shares",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"shares",type:"uint256"},{name:"receiver",type:"address"},{name:"owner",type:"address"}],name:"redeem",outputs:[{name:"assets",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalAssets",outputs:[{name:"totalManagedAssets",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"to",type:"address"},{name:"amount",type:"uint256"}],name:"transfer",outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"from",type:"address"},{name:"to",type:"address"},{name:"amount",type:"uint256"}],name:"transferFrom",outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"assets",type:"uint256"},{name:"receiver",type:"address"},{name:"owner",type:"address"}],name:"withdraw",outputs:[{name:"shares",type:"uint256"}],stateMutability:"nonpayable",type:"function"}],aggregate3Signature="0x82ad56cb",deploylessCallViaBytecodeBytecode="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",deploylessCallViaFactoryBytecode="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",universalSignatureValidatorByteCode="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class ChainDoesNotSupportContract extends BaseError{constructor({blockNumber:br,chain:wr,contract:Er}){super(`Chain "${wr.name}" does not support contract "${Er.name}".`,{metaMessages:["This could be due to any of the following:",...br&&Er.blockCreated&&Er.blockCreated>br?[`- The contract "${Er.name}" was not deployed until block ${Er.blockCreated} (current block ${br}).`]:[`- The chain does not have the contract "${Er.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class ChainMismatchError extends BaseError{constructor({chain:br,currentChainId:wr}){super(`The current chain of the wallet (id: ${wr}) does not match the target chain for the transaction (id: ${br.id} – ${br.name}).`,{metaMessages:[`Current Chain ID: ${wr}`,`Expected Chain ID: ${br.id} – ${br.name}`],name:"ChainMismatchError"})}}class ChainNotFoundError extends BaseError{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(` `),{name:"ChainNotFoundError"})}}class ClientChainNotConfiguredError extends BaseError{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}class InvalidChainIdError extends BaseError{constructor({chainId:br}){super(typeof br=="number"?`Chain ID "${br}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}const docsPath$3="/docs/contract/encodeDeployData";function encodeDeployData(fr){const{abi:br,args:wr,bytecode:Er}=fr;if(!wr||wr.length===0)return Er;const kr=br.find(Br=>"type"in Br&&Br.type==="constructor");if(!kr)throw new AbiConstructorNotFoundError({docsPath:docsPath$3});if(!("inputs"in kr))throw new AbiConstructorParamsNotFoundError({docsPath:docsPath$3});if(!kr.inputs||kr.inputs.length===0)throw new AbiConstructorParamsNotFoundError({docsPath:docsPath$3});const jr=encodeAbiParameters(kr.inputs,wr);return concatHex([Er,jr])}function getChainContractAddress({blockNumber:fr,chain:br,contract:wr}){var kr;const Er=(kr=br==null?void 0:br.contracts)==null?void 0:kr[wr];if(!Er)throw new ChainDoesNotSupportContract({chain:br,contract:{name:wr}});if(fr&&Er.blockCreated&&Er.blockCreated>fr)throw new ChainDoesNotSupportContract({blockNumber:fr,chain:br,contract:{name:wr,blockCreated:Er.blockCreated}});return Er.address}function getCallError(fr,{docsPath:br,...wr}){const Er=(()=>{const kr=getNodeError(fr,wr);return kr instanceof UnknownNodeError?fr:kr})();return new CallExecutionError(Er,{docsPath:br,...wr})}function withResolvers(){let fr=()=>{},br=()=>{};return{promise:new Promise((Er,kr)=>{fr=Er,br=kr}),resolve:fr,reject:br}}const schedulerCache=new Map;function createBatchScheduler({fn:fr,id:br,shouldSplitBatch:wr,wait:Er=0,sort:kr}){const jr=async()=>{const Vr=qr();Br();const Zr=Vr.map(({args:Jr})=>Jr);Zr.length!==0&&fr(Zr).then(Jr=>{kr&&Array.isArray(Jr)&&Jr.sort(kr);for(let Qr=0;Qr{for(let Qr=0;QrschedulerCache.delete(br),Wr=()=>qr().map(({args:Vr})=>Vr),qr=()=>schedulerCache.get(br)||[],Gr=Vr=>schedulerCache.set(br,[...qr(),Vr]);return{flush:Br,async schedule(Vr){const{promise:Zr,resolve:Jr,reject:Qr}=withResolvers();return(wr==null?void 0:wr([...Wr(),Vr]))&&jr(),qr().length>0?(Gr({args:Vr,resolve:Jr,reject:Qr}),Zr):(Gr({args:Vr,resolve:Jr,reject:Qr}),setTimeout(jr,Er),Zr)}}}async function call(fr,br){var so,no,Tn,Hr;const{account:wr=fr.account,batch:Er=!!((so=fr.batch)!=null&&so.multicall),blockNumber:kr,blockTag:jr="latest",accessList:Br,blobs:Wr,code:qr,data:Gr,factory:Vr,factoryData:Zr,gas:Jr,gasPrice:Qr,maxFeePerBlobGas:_n,maxFeePerGas:En,maxPriorityFeePerGas:Cn,nonce:In,to:An,value:jn,stateOverride:eo,...ro}=br,to=wr?parseAccount(wr):void 0;if(qr&&(Vr||Zr))throw new BaseError("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(qr&&An)throw new BaseError("Cannot provide both `code` & `to` as parameters.");const _i=qr&&Gr,oo=Vr&&Zr&&An&&Gr,io=_i||oo,co=_i?toDeploylessCallViaBytecodeData({code:qr,data:Gr}):oo?toDeploylessCallViaFactoryData({data:Gr,factory:Vr,factoryData:Zr,to:An}):Gr;try{assertRequest(br);const Sn=(kr?numberToHex(kr):void 0)||jr,Rn=serializeStateOverride(eo),Pn=(Hr=(Tn=(no=fr.chain)==null?void 0:no.formatters)==null?void 0:Tn.transactionRequest)==null?void 0:Hr.format,Zn=(Pn||formatTransactionRequest)({...extract(ro,{format:Pn}),from:to==null?void 0:to.address,accessList:Br,blobs:Wr,data:co,gas:Jr,gasPrice:Qr,maxFeePerBlobGas:_n,maxFeePerGas:En,maxPriorityFeePerGas:Cn,nonce:In,to:io?void 0:An,value:jn});if(Er&&shouldPerformMulticall({request:Zn})&&!Rn)try{return await scheduleMulticall(fr,{...Zn,blockNumber:kr,blockTag:jr})}catch(wn){if(!(wn instanceof ClientChainNotConfiguredError)&&!(wn instanceof ChainDoesNotSupportContract))throw wn}const Nn=await fr.request({method:"eth_call",params:Rn?[Zn,Sn,Rn]:[Zn,Sn]});return Nn==="0x"?{data:void 0}:{data:Nn}}catch(Xr){const Sn=getRevertErrorData(Xr),{offchainLookup:Rn,offchainLookupSignature:Pn}=await __vitePreload(async()=>{const{offchainLookup:On,offchainLookupSignature:Zn}=await Promise.resolve().then(()=>ccip);return{offchainLookup:On,offchainLookupSignature:Zn}},void 0);if(fr.ccipRead!==!1&&(Sn==null?void 0:Sn.slice(0,10))===Pn&&An)return{data:await Rn(fr,{data:Sn,to:An})};throw io&&(Sn==null?void 0:Sn.slice(0,10))==="0x101bb98d"?new CounterfactualDeploymentFailedError({factory:Vr}):getCallError(Xr,{...br,account:to,chain:fr.chain})}}function shouldPerformMulticall({request:fr}){const{data:br,to:wr,...Er}=fr;return!(!br||br.startsWith(aggregate3Signature)||!wr||Object.values(Er).filter(kr=>typeof kr<"u").length>0)}async function scheduleMulticall(fr,br){var En;const{batchSize:wr=1024,wait:Er=0}=typeof((En=fr.batch)==null?void 0:En.multicall)=="object"?fr.batch.multicall:{},{blockNumber:kr,blockTag:jr="latest",data:Br,multicallAddress:Wr,to:qr}=br;let Gr=Wr;if(!Gr){if(!fr.chain)throw new ClientChainNotConfiguredError;Gr=getChainContractAddress({blockNumber:kr,chain:fr.chain,contract:"multicall3"})}const Zr=(kr?numberToHex(kr):void 0)||jr,{schedule:Jr}=createBatchScheduler({id:`${fr.uid}.${Zr}`,wait:Er,shouldSplitBatch(Cn){return Cn.reduce((An,{data:jn})=>An+(jn.length-2),0)>wr*2},fn:async Cn=>{const In=Cn.map(eo=>({allowFailure:!0,callData:eo.data,target:eo.to})),An=encodeFunctionData({abi:multicall3Abi,args:[In],functionName:"aggregate3"}),jn=await fr.request({method:"eth_call",params:[{data:An,to:Gr},Zr]});return decodeFunctionResult({abi:multicall3Abi,args:[In],functionName:"aggregate3",data:jn||"0x"})}}),[{returnData:Qr,success:_n}]=await Jr({data:Br,to:qr});if(!_n)throw new RawContractError({data:Qr});return Qr==="0x"?{data:void 0}:{data:Qr}}function toDeploylessCallViaBytecodeData(fr){const{code:br,data:wr}=fr;return encodeDeployData({abi:parseAbi(["constructor(bytes, bytes)"]),bytecode:deploylessCallViaBytecodeBytecode,args:[br,wr]})}function toDeploylessCallViaFactoryData(fr){const{data:br,factory:wr,factoryData:Er,to:kr}=fr;return encodeDeployData({abi:parseAbi(["constructor(address, bytes, address, bytes)"]),bytecode:deploylessCallViaFactoryBytecode,args:[kr,br,wr,Er]})}function getRevertErrorData(fr){var wr;if(!(fr instanceof BaseError))return;const br=fr.walk();return typeof(br==null?void 0:br.data)=="object"?(wr=br.data)==null?void 0:wr.data:br.data}async function readContract(fr,br){const{abi:wr,address:Er,args:kr,functionName:jr,...Br}=br,Wr=encodeFunctionData({abi:wr,args:kr,functionName:jr});try{const{data:qr}=await getAction(fr,call,"call")({...Br,data:Wr,to:Er});return decodeFunctionResult({abi:wr,args:kr,functionName:jr,data:qr||"0x"})}catch(qr){throw getContractError(qr,{abi:wr,address:Er,args:kr,docsPath:"/docs/contract/readContract",functionName:jr})}}async function simulateContract(fr,br){const{abi:wr,address:Er,args:kr,dataSuffix:jr,functionName:Br,...Wr}=br,qr=Wr.account?parseAccount(Wr.account):fr.account,Gr=encodeFunctionData({abi:wr,args:kr,functionName:Br});try{const{data:Vr}=await getAction(fr,call,"call")({batch:!1,data:`${Gr}${jr?jr.replace("0x",""):""}`,to:Er,...Wr,account:qr}),Zr=decodeFunctionResult({abi:wr,args:kr,functionName:Br,data:Vr||"0x"}),Jr=wr.filter(Qr=>"name"in Qr&&Qr.name===br.functionName);return{result:Zr,request:{abi:Jr,address:Er,args:kr,dataSuffix:jr,functionName:Br,...Wr,account:qr}}}catch(Vr){throw getContractError(Vr,{abi:wr,address:Er,args:kr,docsPath:"/docs/contract/simulateContract",functionName:Br,sender:qr==null?void 0:qr.address})}}const listenersCache=new Map,cleanupCache=new Map;let callbackCount=0;function observe(fr,br,wr){const Er=++callbackCount,kr=()=>listenersCache.get(fr)||[],jr=()=>{const Vr=kr();listenersCache.set(fr,Vr.filter(Zr=>Zr.id!==Er))},Br=()=>{const Vr=cleanupCache.get(fr);kr().length===1&&Vr&&Vr(),jr()},Wr=kr();if(listenersCache.set(fr,[...Wr,{id:Er,fns:br}]),Wr&&Wr.length>0)return Br;const qr={};for(const Vr in br)qr[Vr]=(...Zr)=>{var Qr,_n;const Jr=kr();if(Jr.length!==0)for(const En of Jr)(_n=(Qr=En.fns)[Vr])==null||_n.call(Qr,...Zr)};const Gr=wr(qr);return typeof Gr=="function"&&cleanupCache.set(fr,Gr),Br}async function wait(fr){return new Promise(br=>setTimeout(br,fr))}function poll(fr,{emitOnBegin:br,initialWaitTime:wr,interval:Er}){let kr=!0;const jr=()=>kr=!1;return(async()=>{let Wr;br&&(Wr=await fr({unpoll:jr}));const qr=await(wr==null?void 0:wr(Wr))??Er;await wait(qr);const Gr=async()=>{kr&&(await fr({unpoll:jr}),await wait(Er),Gr())};Gr()})(),jr}const promiseCache$1=new Map,responseCache=new Map;function getCache(fr){const br=(kr,jr)=>({clear:()=>jr.delete(kr),get:()=>jr.get(kr),set:Br=>jr.set(kr,Br)}),wr=br(fr,promiseCache$1),Er=br(fr,responseCache);return{clear:()=>{wr.clear(),Er.clear()},promise:wr,response:Er}}async function withCache(fr,{cacheKey:br,cacheTime:wr=Number.POSITIVE_INFINITY}){const Er=getCache(br),kr=Er.response.get();if(kr&&wr>0&&new Date().getTime()-kr.created.getTime()`blockNumber.${fr}`;async function getBlockNumber(fr,{cacheTime:br=fr.cacheTime}={}){const wr=await withCache(()=>fr.request({method:"eth_blockNumber"}),{cacheKey:cacheKey(fr.uid),cacheTime:br});return BigInt(wr)}async function getFilterChanges(fr,{filter:br}){const wr="strict"in br&&br.strict,Er=await br.request({method:"eth_getFilterChanges",params:[br.id]});if(typeof Er[0]=="string")return Er;const kr=Er.map(jr=>formatLog(jr));return!("abi"in br)||!br.abi?kr:parseEventLogs({abi:br.abi,logs:kr,strict:wr})}async function uninstallFilter(fr,{filter:br}){return br.request({method:"eth_uninstallFilter",params:[br.id]})}function watchContractEvent(fr,br){const{abi:wr,address:Er,args:kr,batch:jr=!0,eventName:Br,fromBlock:Wr,onError:qr,onLogs:Gr,poll:Vr,pollingInterval:Zr=fr.pollingInterval,strict:Jr}=br;return(typeof Vr<"u"?Vr:typeof Wr=="bigint"?!0:!(fr.transport.type==="webSocket"||fr.transport.type==="fallback"&&fr.transport.transports[0].config.type==="webSocket"))?(()=>{const Cn=Jr??!1,In=stringify$4(["watchContractEvent",Er,kr,jr,fr.uid,Br,Zr,Cn,Wr]);return observe(In,{onLogs:Gr,onError:qr},An=>{let jn;Wr!==void 0&&(jn=Wr-1n);let eo,ro=!1;const to=poll(async()=>{var _i;if(!ro){try{eo=await getAction(fr,createContractEventFilter,"createContractEventFilter")({abi:wr,address:Er,args:kr,eventName:Br,strict:Cn,fromBlock:Wr})}catch{}ro=!0;return}try{let oo;if(eo)oo=await getAction(fr,getFilterChanges,"getFilterChanges")({filter:eo});else{const io=await getAction(fr,getBlockNumber,"getBlockNumber")({});jn&&jn{eo&&await getAction(fr,uninstallFilter,"uninstallFilter")({filter:eo}),to()}})})():(()=>{const Cn=Jr??!1,In=stringify$4(["watchContractEvent",Er,kr,jr,fr.uid,Br,Zr,Cn]);let An=!0,jn=()=>An=!1;return observe(In,{onLogs:Gr,onError:qr},eo=>((async()=>{try{const ro=(()=>{if(fr.transport.type==="fallback"){const oo=fr.transport.transports.find(io=>io.config.type==="webSocket");return oo?oo.value:fr.transport}return fr.transport})(),to=Br?encodeEventTopics({abi:wr,eventName:Br,args:kr}):[],{unsubscribe:_i}=await ro.subscribe({params:["logs",{address:Er,topics:to}],onData(oo){var co;if(!An)return;const io=oo.result;try{const{eventName:so,args:no}=decodeEventLog({abi:wr,data:io.data,topics:io.topics,strict:Jr}),Tn=formatLog(io,{args:no,eventName:so});eo.onLogs([Tn])}catch(so){let no,Tn;if(so instanceof DecodeLogDataMismatch||so instanceof DecodeLogTopicsMismatch){if(Jr)return;no=so.abiItem.name,Tn=(co=so.abiItem.inputs)==null?void 0:co.some(Xr=>!("name"in Xr&&Xr.name))}const Hr=formatLog(io,{args:Tn?[]:{},eventName:no});eo.onLogs([Hr])}},onError(oo){var io;(io=eo.onError)==null||io.call(eo,oo)}});jn=_i,An||jn()}catch(ro){qr==null||qr(ro)}})(),()=>jn()))})()}class AccountNotFoundError extends BaseError{constructor({docsPath:br}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."].join(` -`),{docsPath:br,docsSlug:"account",name:"AccountNotFoundError"})}}class AccountTypeNotSupportedError extends BaseError{constructor({docsPath:br,metaMessages:wr,type:Er}){super(`Account type "${Er}" is not supported.`,{docsPath:br,metaMessages:wr,name:"AccountTypeNotSupportedError"})}}function assertCurrentChain({chain:fr,currentChainId:br}){if(!fr)throw new ChainNotFoundError;if(br!==fr.id)throw new ChainMismatchError({chain:fr,currentChainId:br})}function getTransactionError(fr,{docsPath:br,...wr}){const Er=(()=>{const kr=getNodeError(fr,wr);return kr instanceof UnknownNodeError?fr:kr})();return new TransactionExecutionError(Er,{docsPath:br,...wr})}async function sendRawTransaction(fr,{serializedTransaction:br}){return fr.request({method:"eth_sendRawTransaction",params:[br]},{retryCount:0})}const supportsWalletNamespace=new LruMap(128);async function sendTransaction(fr,br){var In,An,jn,eo;const{account:wr=fr.account,chain:Er=fr.chain,accessList:kr,authorizationList:jr,blobs:Br,data:Wr,gas:qr,gasPrice:Gr,maxFeePerBlobGas:Vr,maxFeePerGas:Zr,maxPriorityFeePerGas:Jr,nonce:Qr,value:_n,...En}=br;if(typeof wr>"u")throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/sendTransaction"});const Cn=wr?parseAccount(wr):null;try{assertRequest(br);const ro=await(async()=>{if(br.to)return br.to;if(jr&&jr.length>0)return await recoverAuthorizationAddress({authorization:jr[0]}).catch(()=>{throw new BaseError("`to` is required. Could not infer from `authorizationList`.")})})();if((Cn==null?void 0:Cn.type)==="json-rpc"||Cn===null){let to;Er!==null&&(to=await getAction(fr,getChainId,"getChainId")({}),assertCurrentChain({currentChainId:to,chain:Er}));const _i=(jn=(An=(In=fr.chain)==null?void 0:In.formatters)==null?void 0:An.transactionRequest)==null?void 0:jn.format,io=(_i||formatTransactionRequest)({...extract(En,{format:_i}),accessList:kr,authorizationList:jr,blobs:Br,chainId:to,data:Wr,from:Cn==null?void 0:Cn.address,gas:qr,gasPrice:Gr,maxFeePerBlobGas:Vr,maxFeePerGas:Zr,maxPriorityFeePerGas:Jr,nonce:Qr,to:ro,value:_n}),co=supportsWalletNamespace.get(fr.uid),so=co?"wallet_sendTransaction":"eth_sendTransaction";try{return await fr.request({method:so,params:[io]},{retryCount:0})}catch(no){if(co===!1)throw no;const Tn=no;if(Tn.name==="InvalidInputRpcError"||Tn.name==="InvalidParamsRpcError"||Tn.name==="MethodNotFoundRpcError"||Tn.name==="MethodNotSupportedRpcError")return await fr.request({method:"wallet_sendTransaction",params:[io]},{retryCount:0}).then(Hr=>(supportsWalletNamespace.set(fr.uid,!0),Hr)).catch(Hr=>{const Xr=Hr;throw Xr.name==="MethodNotFoundRpcError"||Xr.name==="MethodNotSupportedRpcError"?(supportsWalletNamespace.set(fr.uid,!1),Tn):Xr});throw Tn}}if((Cn==null?void 0:Cn.type)==="local"){const to=await getAction(fr,prepareTransactionRequest,"prepareTransactionRequest")({account:Cn,accessList:kr,authorizationList:jr,blobs:Br,chain:Er,data:Wr,gas:qr,gasPrice:Gr,maxFeePerBlobGas:Vr,maxFeePerGas:Zr,maxPriorityFeePerGas:Jr,nonce:Qr,nonceManager:Cn.nonceManager,parameters:[...defaultParameters,"sidecars"],value:_n,...En,to:ro}),_i=(eo=Er==null?void 0:Er.serializers)==null?void 0:eo.transaction,oo=await Cn.signTransaction(to,{serializer:_i});return await getAction(fr,sendRawTransaction,"sendRawTransaction")({serializedTransaction:oo})}throw(Cn==null?void 0:Cn.type)==="smart"?new AccountTypeNotSupportedError({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new AccountTypeNotSupportedError({docsPath:"/docs/actions/wallet/sendTransaction",type:Cn==null?void 0:Cn.type})}catch(ro){throw ro instanceof AccountTypeNotSupportedError?ro:getTransactionError(ro,{...br,account:Cn,chain:br.chain||void 0})}}async function writeContract(fr,br){const{abi:wr,account:Er=fr.account,address:kr,args:jr,dataSuffix:Br,functionName:Wr,...qr}=br;if(typeof Er>"u")throw new AccountNotFoundError({docsPath:"/docs/contract/writeContract"});const Gr=Er?parseAccount(Er):null,Vr=encodeFunctionData({abi:wr,args:jr,functionName:Wr});try{return await getAction(fr,sendTransaction,"sendTransaction")({data:`${Vr}${Br?Br.replace("0x",""):""}`,to:kr,account:Gr,...qr})}catch(Zr){throw getContractError(Zr,{abi:wr,address:kr,args:jr,docsPath:"/docs/contract/writeContract",functionName:Wr,sender:Gr==null?void 0:Gr.address})}}function getContract({abi:fr,address:br,client:wr}){const Er=wr,[kr,jr]=Er?"public"in Er&&"wallet"in Er?[Er.public,Er.wallet]:"public"in Er?[Er.public,void 0]:"wallet"in Er?[void 0,Er.wallet]:[Er,Er]:[void 0,void 0],Br=kr!=null,Wr=jr!=null,qr={};let Gr=!1,Vr=!1,Zr=!1;for(const Jr of fr)if(Jr.type==="function"?Jr.stateMutability==="view"||Jr.stateMutability==="pure"?Gr=!0:Vr=!0:Jr.type==="event"&&(Zr=!0),Gr&&Vr&&Zr)break;return Br&&(Gr&&(qr.read=new Proxy({},{get(Jr,Qr){return(..._n)=>{const{args:En,options:Cn}=getFunctionParameters(_n);return getAction(kr,readContract,"readContract")({abi:fr,address:br,functionName:Qr,args:En,...Cn})}}})),Vr&&(qr.simulate=new Proxy({},{get(Jr,Qr){return(..._n)=>{const{args:En,options:Cn}=getFunctionParameters(_n);return getAction(kr,simulateContract,"simulateContract")({abi:fr,address:br,functionName:Qr,args:En,...Cn})}}})),Zr&&(qr.createEventFilter=new Proxy({},{get(Jr,Qr){return(..._n)=>{const En=fr.find(An=>An.type==="event"&&An.name===Qr),{args:Cn,options:In}=getEventParameters(_n,En);return getAction(kr,createContractEventFilter,"createContractEventFilter")({abi:fr,address:br,eventName:Qr,args:Cn,...In})}}}),qr.getEvents=new Proxy({},{get(Jr,Qr){return(..._n)=>{const En=fr.find(An=>An.type==="event"&&An.name===Qr),{args:Cn,options:In}=getEventParameters(_n,En);return getAction(kr,getContractEvents,"getContractEvents")({abi:fr,address:br,eventName:Qr,args:Cn,...In})}}}),qr.watchEvent=new Proxy({},{get(Jr,Qr){return(..._n)=>{const En=fr.find(An=>An.type==="event"&&An.name===Qr),{args:Cn,options:In}=getEventParameters(_n,En);return getAction(kr,watchContractEvent,"watchContractEvent")({abi:fr,address:br,eventName:Qr,args:Cn,...In})}}}))),Wr&&Vr&&(qr.write=new Proxy({},{get(Jr,Qr){return(..._n)=>{const{args:En,options:Cn}=getFunctionParameters(_n);return getAction(jr,writeContract,"writeContract")({abi:fr,address:br,functionName:Qr,args:En,...Cn})}}})),(Br||Wr)&&Vr&&(qr.estimateGas=new Proxy({},{get(Jr,Qr){return(..._n)=>{const{args:En,options:Cn}=getFunctionParameters(_n);return getAction(kr??jr,estimateContractGas,"estimateContractGas")({abi:fr,address:br,functionName:Qr,args:En,...Cn,account:Cn.account??jr.account})}}})),qr.address=br,qr.abi=fr,qr}function getFunctionParameters(fr){const br=fr.length&&Array.isArray(fr[0]),wr=br?fr[0]:[],Er=(br?fr[1]:fr[0])??{};return{args:wr,options:Er}}function getEventParameters(fr,br){let wr=!1;Array.isArray(fr[0])?wr=!0:fr.length===1?wr=br.inputs.some(jr=>jr.indexed):fr.length===2&&(wr=!0);const Er=wr?fr[0]:void 0,kr=(wr?fr[1]:fr[0])??{};return{args:Er,options:kr}}class Eip712DomainNotFoundError extends BaseError{constructor({address:br}){super(`No EIP-712 domain found on contract "${br}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${br}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function getEip712Domain$1(fr,br){const{address:wr,factory:Er,factoryData:kr}=br;try{const[jr,Br,Wr,qr,Gr,Vr,Zr]=await getAction(fr,readContract,"readContract")({abi:abi$2,address:wr,functionName:"eip712Domain",factory:Er,factoryData:kr});return{domain:{name:Br,version:Wr,chainId:Number(qr),verifyingContract:Gr,salt:Vr},extensions:Zr,fields:jr}}catch(jr){const Br=jr;throw Br.name==="ContractFunctionExecutionError"&&Br.cause.name==="ContractFunctionZeroDataError"?new Eip712DomainNotFoundError({address:wr}):Br}}const abi$2=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];async function addChain(fr,{chain:br}){const{id:wr,name:Er,nativeCurrency:kr,rpcUrls:jr,blockExplorers:Br}=br;await fr.request({method:"wallet_addEthereumChain",params:[{chainId:numberToHex(wr),chainName:Er,nativeCurrency:kr,rpcUrls:jr.default.http,blockExplorerUrls:Br?Object.values(Br).map(({url:Wr})=>Wr):void 0}]},{dedupe:!0,retryCount:0})}const size=256;let index=size,buffer$1;function uid(fr=11){if(!buffer$1||index+fr>size*2){buffer$1="",index=0;for(let br=0;br{const An=In(Cn);for(const eo in _n)delete An[eo];const jn={...Cn,...An};return Object.assign(jn,{extend:En(jn)})}}return Object.assign(_n,{extend:En(_n)})}function rpcSchema(){return null}const promiseCache=new LruMap(8192);function withDedupe(fr,{enabled:br=!0,id:wr}){if(!br||!wr)return fr();if(promiseCache.get(wr))return promiseCache.get(wr);const Er=fr().finally(()=>promiseCache.delete(wr));return promiseCache.set(wr,Er),Er}function withRetry(fr,{delay:br=100,retryCount:wr=2,shouldRetry:Er=()=>!0}={}){return new Promise((kr,jr)=>{const Br=async({count:Wr=0}={})=>{const qr=async({error:Gr})=>{const Vr=typeof br=="function"?br({count:Wr,error:Gr}):br;Vr&&await wait(Vr),Br({count:Wr+1})};try{const Gr=await fr();kr(Gr)}catch(Gr){if(Wr{const{dedupe:kr=!1,retryDelay:jr=150,retryCount:Br=3,uid:Wr}={...br,...Er},qr=kr?keccak256(stringToHex(`${Wr}.${stringify$4(wr)}`)):void 0;return withDedupe(()=>withRetry(async()=>{try{return await fr(wr)}catch(Gr){const Vr=Gr;switch(Vr.code){case ParseRpcError.code:throw new ParseRpcError(Vr);case InvalidRequestRpcError.code:throw new InvalidRequestRpcError(Vr);case MethodNotFoundRpcError.code:throw new MethodNotFoundRpcError(Vr,{method:wr.method});case InvalidParamsRpcError.code:throw new InvalidParamsRpcError(Vr);case InternalRpcError.code:throw new InternalRpcError(Vr);case InvalidInputRpcError.code:throw new InvalidInputRpcError(Vr);case ResourceNotFoundRpcError.code:throw new ResourceNotFoundRpcError(Vr);case ResourceUnavailableRpcError.code:throw new ResourceUnavailableRpcError(Vr);case TransactionRejectedRpcError.code:throw new TransactionRejectedRpcError(Vr);case MethodNotSupportedRpcError.code:throw new MethodNotSupportedRpcError(Vr,{method:wr.method});case LimitExceededRpcError.code:throw new LimitExceededRpcError(Vr);case JsonRpcVersionUnsupportedError.code:throw new JsonRpcVersionUnsupportedError(Vr);case UserRejectedRequestError.code:throw new UserRejectedRequestError(Vr);case UnauthorizedProviderError.code:throw new UnauthorizedProviderError(Vr);case UnsupportedProviderMethodError.code:throw new UnsupportedProviderMethodError(Vr);case ProviderDisconnectedError.code:throw new ProviderDisconnectedError(Vr);case ChainDisconnectedError.code:throw new ChainDisconnectedError(Vr);case SwitchChainError.code:throw new SwitchChainError(Vr);case 5e3:throw new UserRejectedRequestError(Vr);default:throw Gr instanceof BaseError?Gr:new UnknownRpcError(Vr)}}},{delay:({count:Gr,error:Vr})=>{var Zr;if(Vr&&Vr instanceof HttpRequestError){const Jr=(Zr=Vr==null?void 0:Vr.headers)==null?void 0:Zr.get("Retry-After");if(Jr!=null&&Jr.match(/\d/))return Number.parseInt(Jr)*1e3}return~~(1<shouldRetry(Gr)}),{enabled:kr,id:qr})}}function shouldRetry(fr){return"code"in fr&&typeof fr.code=="number"?fr.code===-1||fr.code===LimitExceededRpcError.code||fr.code===InternalRpcError.code:fr instanceof HttpRequestError&&fr.status?fr.status===403||fr.status===408||fr.status===413||fr.status===429||fr.status===500||fr.status===502||fr.status===503||fr.status===504:!0}function createTransport({key:fr,name:br,request:wr,retryCount:Er=3,retryDelay:kr=150,timeout:jr,type:Br},Wr){const qr=uid();return{config:{key:fr,name:br,request:wr,retryCount:Er,retryDelay:kr,timeout:jr,type:Br},request:buildRequest(wr,{retryCount:Er,retryDelay:kr,uid:qr}),value:Wr}}function custom(fr,br={}){const{key:wr="custom",name:Er="Custom Provider",retryDelay:kr}=br;return({retryCount:jr})=>createTransport({key:wr,name:Er,request:fr.request.bind(fr),retryCount:br.retryCount??jr,retryDelay:kr,type:"custom"})}function fallback(fr,br={}){const{key:wr="fallback",name:Er="Fallback",rank:kr=!1,retryCount:jr,retryDelay:Br}=br;return({chain:Wr,pollingInterval:qr=4e3,timeout:Gr,...Vr})=>{let Zr=fr,Jr=()=>{};const Qr=createTransport({key:wr,name:Er,async request({method:_n,params:En}){const Cn=async(In=0)=>{const An=Zr[In]({...Vr,chain:Wr,retryCount:0,timeout:Gr});try{const jn=await An.request({method:_n,params:En});return Jr({method:_n,params:En,response:jn,transport:An,status:"success"}),jn}catch(jn){if(Jr({error:jn,method:_n,params:En,transport:An,status:"error"}),shouldThrow(jn)||In===Zr.length-1)throw jn;return Cn(In+1)}};return Cn()},retryCount:jr,retryDelay:Br,type:"fallback"},{onResponse:_n=>Jr=_n,transports:Zr.map(_n=>_n({chain:Wr,retryCount:0}))});if(kr){const _n=typeof kr=="object"?kr:{};rankTransports({chain:Wr,interval:_n.interval??qr,onTransports:En=>Zr=En,sampleCount:_n.sampleCount,timeout:_n.timeout,transports:Zr,weights:_n.weights})}return Qr}}function shouldThrow(fr){return"code"in fr&&typeof fr.code=="number"&&(fr.code===TransactionRejectedRpcError.code||fr.code===UserRejectedRequestError.code||fr.code===5e3)}function rankTransports({chain:fr,interval:br=4e3,onTransports:wr,sampleCount:Er=10,timeout:kr=1e3,transports:jr,weights:Br={}}){const{stability:Wr=.7,latency:qr=.3}=Br,Gr=[],Vr=async()=>{const Zr=await Promise.all(jr.map(async _n=>{const En=_n({chain:fr,retryCount:0,timeout:kr}),Cn=Date.now();let In,An;try{await En.request({method:"net_listening"}),An=1}catch{An=0}finally{In=Date.now()}return{latency:In-Cn,success:An}}));Gr.push(Zr),Gr.length>Er&&Gr.shift();const Jr=Math.max(...Gr.map(_n=>Math.max(..._n.map(({latency:En})=>En)))),Qr=jr.map((_n,En)=>{const Cn=Gr.map(ro=>ro[En].latency),An=1-Cn.reduce((ro,to)=>ro+to,0)/Cn.length/Jr,jn=Gr.map(ro=>ro[En].success),eo=jn.reduce((ro,to)=>ro+to,0)/jn.length;return eo===0?[0,En]:[qr*An+Wr*eo,En]}).sort((_n,En)=>En[0]-_n[0]);wr(Qr.map(([,_n])=>jr[_n])),await wait(br),Vr()};Vr()}class UrlRequiredError extends BaseError{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function withTimeout(fr,{errorInstance:br=new Error("timed out"),timeout:wr,signal:Er}){return new Promise((kr,jr)=>{(async()=>{let Br;try{const Wr=new AbortController;wr>0&&(Br=setTimeout(()=>{Er?Wr.abort():jr(br)},wr)),kr(await fr({signal:(Wr==null?void 0:Wr.signal)||null}))}catch(Wr){(Wr==null?void 0:Wr.name)==="AbortError"&&jr(br),jr(Wr)}finally{clearTimeout(Br)}})()})}function createIdStore(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const idCache=createIdStore();function getHttpRpcClient(fr,br={}){return{async request(wr){var Zr;const{body:Er,onRequest:kr=br.onRequest,onResponse:jr=br.onResponse,timeout:Br=br.timeout??1e4}=wr,Wr={...br.fetchOptions??{},...wr.fetchOptions??{}},{headers:qr,method:Gr,signal:Vr}=Wr;try{const Jr=await withTimeout(async({signal:_n})=>{const En={...Wr,body:Array.isArray(Er)?stringify$4(Er.map(jn=>({jsonrpc:"2.0",id:jn.id??idCache.take(),...jn}))):stringify$4({jsonrpc:"2.0",id:Er.id??idCache.take(),...Er}),headers:{"Content-Type":"application/json",...qr},method:Gr||"POST",signal:Vr||(Br>0?_n:null)},Cn=new Request(fr,En),In=await(kr==null?void 0:kr(Cn,En))??{...En,url:fr};return await fetch(In.url??fr,In)},{errorInstance:new TimeoutError({body:Er,url:fr}),timeout:Br,signal:!0});jr&&await jr(Jr);let Qr;if((Zr=Jr.headers.get("Content-Type"))!=null&&Zr.startsWith("application/json"))Qr=await Jr.json();else{Qr=await Jr.text();try{Qr=JSON.parse(Qr||"{}")}catch(_n){if(Jr.ok)throw _n;Qr={error:Qr}}}if(!Jr.ok)throw new HttpRequestError({body:Er,details:stringify$4(Qr.error)||Jr.statusText,headers:Jr.headers,status:Jr.status,url:fr});return Qr}catch(Jr){throw Jr instanceof HttpRequestError||Jr instanceof TimeoutError?Jr:new HttpRequestError({body:Er,cause:Jr,url:fr})}}}}function http(fr,br={}){const{batch:wr,fetchOptions:Er,key:kr="http",name:jr="HTTP JSON-RPC",onFetchRequest:Br,onFetchResponse:Wr,retryDelay:qr}=br;return({chain:Gr,retryCount:Vr,timeout:Zr})=>{const{batchSize:Jr=1e3,wait:Qr=0}=typeof wr=="object"?wr:{},_n=br.retryCount??Vr,En=Zr??br.timeout??1e4,Cn=fr||(Gr==null?void 0:Gr.rpcUrls.default.http[0]);if(!Cn)throw new UrlRequiredError;const In=getHttpRpcClient(Cn,{fetchOptions:Er,onRequest:Br,onResponse:Wr,timeout:En});return createTransport({key:kr,name:jr,async request({method:An,params:jn}){const eo={method:An,params:jn},{schedule:ro}=createBatchScheduler({id:Cn,wait:Qr,shouldSplitBatch(io){return io.length>Jr},fn:io=>In.request({body:io}),sort:(io,co)=>io.id-co.id}),to=async io=>wr?ro(io):[await In.request({body:io})],[{error:_i,result:oo}]=await to(eo);if(_i)throw new RpcRequestError({body:eo,error:_i,url:Cn});return oo},retryCount:_n,retryDelay:qr,timeout:En,type:"http"},{fetchOptions:Er,url:Cn})}}function isNullUniversalResolverError(fr,br){var Er,kr,jr,Br,Wr,qr;if(!(fr instanceof BaseError))return!1;const wr=fr.walk(Gr=>Gr instanceof ContractFunctionRevertedError);return wr instanceof ContractFunctionRevertedError?!!(((Er=wr.data)==null?void 0:Er.errorName)==="ResolverNotFound"||((kr=wr.data)==null?void 0:kr.errorName)==="ResolverWildcardNotSupported"||((jr=wr.data)==null?void 0:jr.errorName)==="ResolverNotContract"||((Br=wr.data)==null?void 0:Br.errorName)==="ResolverError"||((Wr=wr.data)==null?void 0:Wr.errorName)==="HttpError"||(qr=wr.reason)!=null&&qr.includes("Wildcard on non-extended resolvers is not supported")||br==="reverse"&&wr.reason===panicReasons[50]):!1}function encodedLabelToLabelhash(fr){if(fr.length!==66||fr.indexOf("[")!==0||fr.indexOf("]")!==65)return null;const br=`0x${fr.slice(1,65)}`;return isHex(br)?br:null}function namehash(fr){let br=new Uint8Array(32).fill(0);if(!fr)return bytesToHex$4(br);const wr=fr.split(".");for(let Er=wr.length-1;Er>=0;Er-=1){const kr=encodedLabelToLabelhash(wr[Er]),jr=kr?toBytes$3(kr):keccak256(stringToBytes$1(wr[Er]),"bytes");br=keccak256(concat$1([br,jr]),"bytes")}return bytesToHex$4(br)}function encodeLabelhash(fr){return`[${fr.slice(2)}]`}function labelhash(fr){const br=new Uint8Array(32).fill(0);return fr?encodedLabelToLabelhash(fr)||keccak256(stringToBytes$1(fr)):bytesToHex$4(br)}function packetToBytes(fr){const br=fr.replace(/^\.|\.$/gm,"");if(br.length===0)return new Uint8Array(1);const wr=new Uint8Array(stringToBytes$1(br).byteLength+2);let Er=0;const kr=br.split(".");for(let jr=0;jr255&&(Br=stringToBytes$1(encodeLabelhash(labelhash(kr[jr])))),wr[Er]=Br.length,wr.set(Br,Er+1),Er+=Br.length+1}return wr.byteLength!==Er+1?wr.slice(0,Er+1):wr}async function getEnsAddress(fr,{blockNumber:br,blockTag:wr,coinType:Er,name:kr,gatewayUrls:jr,strict:Br,universalResolverAddress:Wr}){let qr=Wr;if(!qr){if(!fr.chain)throw new Error("client chain not configured. universalResolverAddress is required.");qr=getChainContractAddress({blockNumber:br,chain:fr.chain,contract:"ensUniversalResolver"})}try{const Gr=encodeFunctionData({abi:addressResolverAbi,functionName:"addr",...Er!=null?{args:[namehash(kr),BigInt(Er)]}:{args:[namehash(kr)]}}),Vr={address:qr,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(kr)),Gr],blockNumber:br,blockTag:wr},Zr=getAction(fr,readContract,"readContract"),Jr=jr?await Zr({...Vr,args:[...Vr.args,jr]}):await Zr(Vr);if(Jr[0]==="0x")return null;const Qr=decodeFunctionResult({abi:addressResolverAbi,args:Er!=null?[namehash(kr),BigInt(Er)]:void 0,functionName:"addr",data:Jr[0]});return Qr==="0x"||trim(Qr)==="0x00"?null:Qr}catch(Gr){if(Br)throw Gr;if(isNullUniversalResolverError(Gr,"resolve"))return null;throw Gr}}class EnsAvatarInvalidMetadataError extends BaseError{constructor({data:br}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(br)}`],name:"EnsAvatarInvalidMetadataError"})}}class EnsAvatarInvalidNftUriError extends BaseError{constructor({reason:br}){super(`ENS NFT avatar URI is invalid. ${br}`,{name:"EnsAvatarInvalidNftUriError"})}}class EnsAvatarUriResolutionError extends BaseError{constructor({uri:br}){super(`Unable to resolve ENS avatar URI "${br}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class EnsAvatarUnsupportedNamespaceError extends BaseError{constructor({namespace:br}){super(`ENS NFT avatar namespace "${br}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const networkRegex=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,ipfsHashRegex=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,base64Regex=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,dataURIRegex=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function isImageUri(fr){try{const br=await fetch(fr,{method:"HEAD"});if(br.status===200){const wr=br.headers.get("content-type");return wr==null?void 0:wr.startsWith("image/")}return!1}catch(br){return typeof br=="object"&&typeof br.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(wr=>{const Er=new Image;Er.onload=()=>{wr(!0)},Er.onerror=()=>{wr(!1)},Er.src=fr})}}function getGateway(fr,br){return fr?fr.endsWith("/")?fr.slice(0,-1):fr:br}function resolveAvatarUri({uri:fr,gatewayUrls:br}){const wr=base64Regex.test(fr);if(wr)return{uri:fr,isOnChain:!0,isEncoded:wr};const Er=getGateway(br==null?void 0:br.ipfs,"https://ipfs.io"),kr=getGateway(br==null?void 0:br.arweave,"https://arweave.net"),jr=fr.match(networkRegex),{protocol:Br,subpath:Wr,target:qr,subtarget:Gr=""}=(jr==null?void 0:jr.groups)||{},Vr=Br==="ipns:/"||Wr==="ipns/",Zr=Br==="ipfs:/"||Wr==="ipfs/"||ipfsHashRegex.test(fr);if(fr.startsWith("http")&&!Vr&&!Zr){let Qr=fr;return br!=null&&br.arweave&&(Qr=fr.replace(/https:\/\/arweave.net/g,br==null?void 0:br.arweave)),{uri:Qr,isOnChain:!1,isEncoded:!1}}if((Vr||Zr)&&qr)return{uri:`${Er}/${Vr?"ipns":"ipfs"}/${qr}${Gr}`,isOnChain:!1,isEncoded:!1};if(Br==="ar:/"&&qr)return{uri:`${kr}/${qr}${Gr||""}`,isOnChain:!1,isEncoded:!1};let Jr=fr.replace(dataURIRegex,"");if(Jr.startsWith("kr.json());return await parseAvatarUri({gatewayUrls:fr,uri:getJsonImage(wr)})}catch{throw new EnsAvatarUriResolutionError({uri:br})}}async function parseAvatarUri({gatewayUrls:fr,uri:br}){const{uri:wr,isOnChain:Er}=resolveAvatarUri({uri:br,gatewayUrls:fr});if(Er||await isImageUri(wr))return wr;throw new EnsAvatarUriResolutionError({uri:br})}function parseNftUri(fr){let br=fr;br.startsWith("did:nft:")&&(br=br.replace("did:nft:","").replace(/_/g,"/"));const[wr,Er,kr]=br.split("/"),[jr,Br]=wr.split(":"),[Wr,qr]=Er.split(":");if(!jr||jr.toLowerCase()!=="eip155")throw new EnsAvatarInvalidNftUriError({reason:"Only EIP-155 supported"});if(!Br)throw new EnsAvatarInvalidNftUriError({reason:"Chain ID not found"});if(!qr)throw new EnsAvatarInvalidNftUriError({reason:"Contract address not found"});if(!kr)throw new EnsAvatarInvalidNftUriError({reason:"Token ID not found"});if(!Wr)throw new EnsAvatarInvalidNftUriError({reason:"ERC namespace not found"});return{chainID:Number.parseInt(Br),namespace:Wr.toLowerCase(),contractAddress:qr,tokenID:kr}}async function getNftTokenUri(fr,{nft:br}){if(br.namespace==="erc721")return readContract(fr,{address:br.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(br.tokenID)]});if(br.namespace==="erc1155")return readContract(fr,{address:br.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(br.tokenID)]});throw new EnsAvatarUnsupportedNamespaceError({namespace:br.namespace})}async function parseAvatarRecord(fr,{gatewayUrls:br,record:wr}){return/eip155:/i.test(wr)?parseNftAvatarUri(fr,{gatewayUrls:br,record:wr}):parseAvatarUri({uri:wr,gatewayUrls:br})}async function parseNftAvatarUri(fr,{gatewayUrls:br,record:wr}){const Er=parseNftUri(wr),kr=await getNftTokenUri(fr,{nft:Er}),{uri:jr,isOnChain:Br,isEncoded:Wr}=resolveAvatarUri({uri:kr,gatewayUrls:br});if(Br&&(jr.includes("data:application/json;base64,")||jr.startsWith("{"))){const Gr=Wr?atob(jr.replace("data:application/json;base64,","")):jr,Vr=JSON.parse(Gr);return parseAvatarUri({uri:getJsonImage(Vr),gatewayUrls:br})}let qr=Er.tokenID;return Er.namespace==="erc1155"&&(qr=qr.replace("0x","").padStart(64,"0")),getMetadataAvatarUri({gatewayUrls:br,uri:jr.replace(/(?:0x)?{id}/,qr)})}async function getEnsText(fr,{blockNumber:br,blockTag:wr,name:Er,key:kr,gatewayUrls:jr,strict:Br,universalResolverAddress:Wr}){let qr=Wr;if(!qr){if(!fr.chain)throw new Error("client chain not configured. universalResolverAddress is required.");qr=getChainContractAddress({blockNumber:br,chain:fr.chain,contract:"ensUniversalResolver"})}try{const Gr={address:qr,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(Er)),encodeFunctionData({abi:textResolverAbi,functionName:"text",args:[namehash(Er),kr]})],blockNumber:br,blockTag:wr},Vr=getAction(fr,readContract,"readContract"),Zr=jr?await Vr({...Gr,args:[...Gr.args,jr]}):await Vr(Gr);if(Zr[0]==="0x")return null;const Jr=decodeFunctionResult({abi:textResolverAbi,functionName:"text",data:Zr[0]});return Jr===""?null:Jr}catch(Gr){if(Br)throw Gr;if(isNullUniversalResolverError(Gr,"resolve"))return null;throw Gr}}async function getEnsAvatar(fr,{blockNumber:br,blockTag:wr,assetGatewayUrls:Er,name:kr,gatewayUrls:jr,strict:Br,universalResolverAddress:Wr}){const qr=await getAction(fr,getEnsText,"getEnsText")({blockNumber:br,blockTag:wr,key:"avatar",name:kr,universalResolverAddress:Wr,gatewayUrls:jr,strict:Br});if(!qr)return null;try{return await parseAvatarRecord(fr,{record:qr,gatewayUrls:Er})}catch{return null}}async function getEnsName(fr,{address:br,blockNumber:wr,blockTag:Er,gatewayUrls:kr,strict:jr,universalResolverAddress:Br}){let Wr=Br;if(!Wr){if(!fr.chain)throw new Error("client chain not configured. universalResolverAddress is required.");Wr=getChainContractAddress({blockNumber:wr,chain:fr.chain,contract:"ensUniversalResolver"})}const qr=`${br.toLowerCase().substring(2)}.addr.reverse`;try{const Gr={address:Wr,abi:universalResolverReverseAbi,functionName:"reverse",args:[toHex(packetToBytes(qr))],blockNumber:wr,blockTag:Er},Vr=getAction(fr,readContract,"readContract"),[Zr,Jr]=kr?await Vr({...Gr,args:[...Gr.args,kr]}):await Vr(Gr);return br.toLowerCase()!==Jr.toLowerCase()?null:Zr}catch(Gr){if(jr)throw Gr;if(isNullUniversalResolverError(Gr,"reverse"))return null;throw Gr}}async function getEnsResolver(fr,{blockNumber:br,blockTag:wr,name:Er,universalResolverAddress:kr}){let jr=kr;if(!jr){if(!fr.chain)throw new Error("client chain not configured. universalResolverAddress is required.");jr=getChainContractAddress({blockNumber:br,chain:fr.chain,contract:"ensUniversalResolver"})}const[Br]=await getAction(fr,readContract,"readContract")({address:jr,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[toHex(packetToBytes(Er))],blockNumber:br,blockTag:wr});return Br}async function createBlockFilter(fr){const br=createFilterRequestScope(fr,{method:"eth_newBlockFilter"}),wr=await fr.request({method:"eth_newBlockFilter"});return{id:wr,request:br(wr),type:"block"}}async function createEventFilter(fr,{address:br,args:wr,event:Er,events:kr,fromBlock:jr,strict:Br,toBlock:Wr}={}){const qr=kr??(Er?[Er]:void 0),Gr=createFilterRequestScope(fr,{method:"eth_newFilter"});let Vr=[];qr&&(Vr=[qr.flatMap(Qr=>encodeEventTopics({abi:[Qr],eventName:Qr.name,args:wr}))],Er&&(Vr=Vr[0]));const Zr=await fr.request({method:"eth_newFilter",params:[{address:br,fromBlock:typeof jr=="bigint"?numberToHex(jr):jr,toBlock:typeof Wr=="bigint"?numberToHex(Wr):Wr,...Vr.length?{topics:Vr}:{}}]});return{abi:qr,args:wr,eventName:Er?Er.name:void 0,fromBlock:jr,id:Zr,request:Gr(Zr),strict:!!Br,toBlock:Wr,type:"event"}}async function createPendingTransactionFilter(fr){const br=createFilterRequestScope(fr,{method:"eth_newPendingTransactionFilter"}),wr=await fr.request({method:"eth_newPendingTransactionFilter"});return{id:wr,request:br(wr),type:"transaction"}}async function getBlobBaseFee(fr){const br=await fr.request({method:"eth_blobBaseFee"});return BigInt(br)}async function getBlockTransactionCount(fr,{blockHash:br,blockNumber:wr,blockTag:Er="latest"}={}){const kr=wr!==void 0?numberToHex(wr):void 0;let jr;return br?jr=await fr.request({method:"eth_getBlockTransactionCountByHash",params:[br]},{dedupe:!0}):jr=await fr.request({method:"eth_getBlockTransactionCountByNumber",params:[kr||Er]},{dedupe:!!kr}),hexToNumber$2(jr)}async function getCode(fr,{address:br,blockNumber:wr,blockTag:Er="latest"}){const kr=wr!==void 0?numberToHex(wr):void 0,jr=await fr.request({method:"eth_getCode",params:[br,kr||Er]},{dedupe:!!kr});if(jr!=="0x")return jr}function formatFeeHistory(fr){var br;return{baseFeePerGas:fr.baseFeePerGas.map(wr=>BigInt(wr)),gasUsedRatio:fr.gasUsedRatio,oldestBlock:BigInt(fr.oldestBlock),reward:(br=fr.reward)==null?void 0:br.map(wr=>wr.map(Er=>BigInt(Er)))}}async function getFeeHistory(fr,{blockCount:br,blockNumber:wr,blockTag:Er="latest",rewardPercentiles:kr}){const jr=wr?numberToHex(wr):void 0,Br=await fr.request({method:"eth_feeHistory",params:[numberToHex(br),jr||Er,kr]},{dedupe:!!jr});return formatFeeHistory(Br)}async function getFilterLogs(fr,{filter:br}){const wr=br.strict??!1,kr=(await br.request({method:"eth_getFilterLogs",params:[br.id]})).map(jr=>formatLog(jr));return br.abi?parseEventLogs({abi:br.abi,logs:kr,strict:wr}):kr}class OffchainLookupError extends BaseError{constructor({callbackSelector:br,cause:wr,data:Er,extraData:kr,sender:jr,urls:Br}){var Wr;super(wr.shortMessage||"An error occurred while fetching for an offchain result.",{cause:wr,metaMessages:[...wr.metaMessages||[],(Wr=wr.metaMessages)!=null&&Wr.length?"":[],"Offchain Gateway Call:",Br&&[" Gateway URL(s):",...Br.map(qr=>` ${getUrl(qr)}`)],` Sender: ${jr}`,` Data: ${Er}`,` Callback selector: ${br}`,` Extra data: ${kr}`].flat(),name:"OffchainLookupError"})}}class OffchainLookupResponseMalformedError extends BaseError{constructor({result:br,url:wr}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${getUrl(wr)}`,`Response: ${stringify$4(br)}`],name:"OffchainLookupResponseMalformedError"})}}class OffchainLookupSenderMismatchError extends BaseError{constructor({sender:br,to:wr}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${wr}`,`OffchainLookup sender address: ${br}`],name:"OffchainLookupSenderMismatchError"})}}const offchainLookupSignature="0x556f1830",offchainLookupAbiItem={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function offchainLookup(fr,{blockNumber:br,blockTag:wr,data:Er,to:kr}){const{args:jr}=decodeErrorResult({data:Er,abi:[offchainLookupAbiItem]}),[Br,Wr,qr,Gr,Vr]=jr,{ccipRead:Zr}=fr,Jr=Zr&&typeof(Zr==null?void 0:Zr.request)=="function"?Zr.request:ccipRequest;try{if(!isAddressEqual(kr,Br))throw new OffchainLookupSenderMismatchError({sender:Br,to:kr});const Qr=await Jr({data:qr,sender:Br,urls:Wr}),{data:_n}=await call(fr,{blockNumber:br,blockTag:wr,data:concat$1([Gr,encodeAbiParameters([{type:"bytes"},{type:"bytes"}],[Qr,Vr])]),to:kr});return _n}catch(Qr){throw new OffchainLookupError({callbackSelector:Gr,cause:Qr,data:Er,extraData:Vr,sender:Br,urls:Wr})}}async function ccipRequest({data:fr,sender:br,urls:wr}){var kr;let Er=new Error("An unknown error occurred.");for(let jr=0;jrwr.id===br)}const arrayRegex=/^(.*)\[([0-9]*)\]$/,bytesRegex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,integerRegex=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,socketClientCache=new Map;async function getSocketRpcClient(fr){const{getSocket:br,keepAlive:wr=!0,key:Er="socket",reconnect:kr=!0,url:jr}=fr,{interval:Br=3e4}=typeof wr=="object"?wr:{},{attempts:Wr=5,delay:qr=2e3}=typeof kr=="object"?kr:{};let Gr=socketClientCache.get(`${Er}:${jr}`);if(Gr)return Gr;let Vr=0;const{schedule:Zr}=createBatchScheduler({id:`${Er}:${jr}`,fn:async()=>{const _n=new Map,En=new Map;let Cn,In,An;async function jn(){const eo=await br({onClose(){var ro,to;for(const _i of _n.values())(ro=_i.onError)==null||ro.call(_i,new SocketClosedError({url:jr}));for(const _i of En.values())(to=_i.onError)==null||to.call(_i,new SocketClosedError({url:jr}));_n.clear(),En.clear(),kr&&Vr{Vr++,await jn().catch(console.error)},qr)},onError(ro){var to,_i;Cn=ro;for(const oo of _n.values())(to=oo.onError)==null||to.call(oo,Cn);for(const oo of En.values())(_i=oo.onError)==null||_i.call(oo,Cn);_n.clear(),En.clear(),kr&&Vr{Vr++,await jn().catch(console.error)},qr)},onOpen(){Cn=void 0,Vr=0},onResponse(ro){const to=ro.method==="eth_subscription",_i=to?ro.params.subscription:ro.id,oo=to?En:_n,io=oo.get(_i);io&&io.onResponse(ro),to||oo.delete(_i)}});return In=eo,wr&&(An&&clearInterval(An),An=setInterval(()=>{var ro;return(ro=In.ping)==null?void 0:ro.call(In)},Br)),eo}return await jn(),Cn=void 0,Gr={close(){An&&clearInterval(An),In.close(),socketClientCache.delete(`${Er}:${jr}`)},get socket(){return In},request({body:eo,onError:ro,onResponse:to}){Cn&&ro&&ro(Cn);const _i=eo.id??idCache.take(),oo=io=>{var co;typeof io.id=="number"&&_i!==io.id||(eo.method==="eth_subscribe"&&typeof io.result=="string"&&En.set(io.result,{onResponse:oo,onError:ro}),eo.method==="eth_unsubscribe"&&En.delete((co=eo.params)==null?void 0:co[0]),to(io))};_n.set(_i,{onResponse:oo,onError:ro});try{In.request({body:{jsonrpc:"2.0",id:_i,...eo}})}catch(io){ro==null||ro(io)}},requestAsync({body:eo,timeout:ro=1e4}){return withTimeout(()=>new Promise((to,_i)=>this.request({body:eo,onError:_i,onResponse:to})),{errorInstance:new TimeoutError({body:eo,url:jr}),timeout:ro})},requests:_n,subscriptions:En,url:jr},socketClientCache.set(`${Er}:${jr}`,Gr),[Gr]}}),[Jr,[Qr]]=await Zr();return Qr}async function getWebSocketRpcClient(fr,br={}){const{keepAlive:wr,reconnect:Er}=br;return getSocketRpcClient({async getSocket({onClose:kr,onError:jr,onOpen:Br,onResponse:Wr}){const qr=await __vitePreload(()=>import("./native-CSxBbLxR.js"),[]).then(Qr=>Qr.WebSocket),Gr=new qr(fr);function Vr(){kr(),Gr.removeEventListener("close",Vr),Gr.removeEventListener("message",Zr),Gr.removeEventListener("error",jr),Gr.removeEventListener("open",Br)}function Zr({data:Qr}){Wr(JSON.parse(Qr))}Gr.addEventListener("close",Vr),Gr.addEventListener("message",Zr),Gr.addEventListener("error",jr),Gr.addEventListener("open",Br),Gr.readyState===qr.CONNECTING&&await new Promise((Qr,_n)=>{Gr&&(Gr.onopen=Qr,Gr.onerror=_n)});const{close:Jr}=Gr;return Object.assign(Gr,{close(){Jr.bind(Gr)(),kr()},ping(){try{if(Gr.readyState===Gr.CLOSED||Gr.readyState===Gr.CLOSING)throw new WebSocketRequestError({url:Gr.url,cause:new SocketClosedError({url:Gr.url})});const Qr={jsonrpc:"2.0",method:"net_version",params:[]};Gr.send(JSON.stringify(Qr))}catch(Qr){jr(Qr)}},request({body:Qr}){if(Gr.readyState===Gr.CLOSED||Gr.readyState===Gr.CLOSING)throw new WebSocketRequestError({body:Qr,url:Gr.url,cause:new SocketClosedError({url:Gr.url})});return Gr.send(JSON.stringify(Qr))}})},keepAlive:wr,reconnect:Er,url:fr})}async function getSocket(fr){const br=await getWebSocketRpcClient(fr);return Object.assign(br.socket,{requests:br.requests,subscriptions:br.subscriptions})}class InvalidDomainError extends BaseError{constructor({domain:br}){super(`Invalid domain "${stringify$4(br)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class InvalidPrimaryTypeError extends BaseError{constructor({primaryType:br,types:wr}){super(`Invalid primary type \`${br}\` must be one of \`${JSON.stringify(Object.keys(wr))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class InvalidStructTypeError extends BaseError{constructor({type:br}){super(`Struct type "${br}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function hashTypedData(fr){const{domain:br={},message:wr,primaryType:Er}=fr,kr={EIP712Domain:getTypesForEIP712Domain({domain:br}),...fr.types};validateTypedData({domain:br,message:wr,primaryType:Er,types:kr});const jr=["0x1901"];return br&&jr.push(hashDomain({domain:br,types:kr})),Er!=="EIP712Domain"&&jr.push(hashStruct({data:wr,primaryType:Er,types:kr})),keccak256(concat$1(jr))}function hashDomain({domain:fr,types:br}){return hashStruct({data:fr,primaryType:"EIP712Domain",types:br})}function hashStruct({data:fr,primaryType:br,types:wr}){const Er=encodeData$2({data:fr,primaryType:br,types:wr});return keccak256(Er)}function encodeData$2({data:fr,primaryType:br,types:wr}){const Er=[{type:"bytes32"}],kr=[hashType({primaryType:br,types:wr})];for(const jr of wr[br]){const[Br,Wr]=encodeField({types:wr,name:jr.name,type:jr.type,value:fr[jr.name]});Er.push(Br),kr.push(Wr)}return encodeAbiParameters(Er,kr)}function hashType({primaryType:fr,types:br}){const wr=toHex(encodeType({primaryType:fr,types:br}));return keccak256(wr)}function encodeType({primaryType:fr,types:br}){let wr="";const Er=findTypeDependencies({primaryType:fr,types:br});Er.delete(fr);const kr=[fr,...Array.from(Er).sort()];for(const jr of kr)wr+=`${jr}(${br[jr].map(({name:Br,type:Wr})=>`${Wr} ${Br}`).join(",")})`;return wr}function findTypeDependencies({primaryType:fr,types:br},wr=new Set){const Er=fr.match(/^\w*/u),kr=Er==null?void 0:Er[0];if(wr.has(kr)||br[kr]===void 0)return wr;wr.add(kr);for(const jr of br[kr])findTypeDependencies({primaryType:jr.type,types:br},wr);return wr}function encodeField({types:fr,name:br,type:wr,value:Er}){if(fr[wr]!==void 0)return[{type:"bytes32"},keccak256(encodeData$2({data:Er,primaryType:wr,types:fr}))];if(wr==="bytes")return Er=`0x${(Er.length%2?"0":"")+Er.slice(2)}`,[{type:"bytes32"},keccak256(Er)];if(wr==="string")return[{type:"bytes32"},keccak256(toHex(Er))];if(wr.lastIndexOf("]")===wr.length-1){const kr=wr.slice(0,wr.lastIndexOf("[")),jr=Er.map(Br=>encodeField({name:br,type:kr,types:fr,value:Br}));return[{type:"bytes32"},keccak256(encodeAbiParameters(jr.map(([Br])=>Br),jr.map(([,Br])=>Br)))]}return[{type:wr},Er]}function serializeTypedData(fr){const{domain:br,message:wr,primaryType:Er,types:kr}=fr,jr=(qr,Gr)=>{const Vr={...Gr};for(const Zr of qr){const{name:Jr,type:Qr}=Zr;Qr==="address"&&(Vr[Jr]=Vr[Jr].toLowerCase())}return Vr},Br=kr.EIP712Domain?br?jr(kr.EIP712Domain,br):{}:{},Wr=(()=>{if(Er!=="EIP712Domain")return jr(kr[Er],wr)})();return stringify$4({domain:Br,message:Wr,primaryType:Er,types:kr})}function validateTypedData(fr){const{domain:br,message:wr,primaryType:Er,types:kr}=fr,jr=(Br,Wr)=>{for(const qr of Br){const{name:Gr,type:Vr}=qr,Zr=Wr[Gr],Jr=Vr.match(integerRegex);if(Jr&&(typeof Zr=="number"||typeof Zr=="bigint")){const[En,Cn,In]=Jr;numberToHex(Zr,{signed:Cn==="int",size:Number.parseInt(In)/8})}if(Vr==="address"&&typeof Zr=="string"&&!isAddress(Zr))throw new InvalidAddressError({address:Zr});const Qr=Vr.match(bytesRegex);if(Qr){const[En,Cn]=Qr;if(Cn&&size$1(Zr)!==Number.parseInt(Cn))throw new BytesSizeMismatchError({expectedSize:Number.parseInt(Cn),givenSize:size$1(Zr)})}const _n=kr[Vr];_n&&(validateReference(Vr),jr(_n,Zr))}};if(kr.EIP712Domain&&br){if(typeof br!="object")throw new InvalidDomainError({domain:br});jr(kr.EIP712Domain,br)}if(Er!=="EIP712Domain")if(kr[Er])jr(kr[Er],wr);else throw new InvalidPrimaryTypeError({primaryType:Er,types:kr})}function getTypesForEIP712Domain({domain:fr}){return[typeof(fr==null?void 0:fr.name)=="string"&&{name:"name",type:"string"},(fr==null?void 0:fr.version)&&{name:"version",type:"string"},typeof(fr==null?void 0:fr.chainId)=="number"&&{name:"chainId",type:"uint256"},(fr==null?void 0:fr.verifyingContract)&&{name:"verifyingContract",type:"address"},(fr==null?void 0:fr.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function domainSeparator({domain:fr}){return hashDomain({domain:fr,types:{EIP712Domain:getTypesForEIP712Domain({domain:fr})}})}function validateReference(fr){if(fr==="address"||fr==="bool"||fr==="string"||fr.startsWith("bytes")||fr.startsWith("uint")||fr.startsWith("int"))throw new InvalidStructTypeError({type:fr})}function decodeFunctionData(fr){const{abi:br,data:wr}=fr,Er=slice(wr,0,4),kr=br.find(jr=>jr.type==="function"&&Er===toFunctionSelector(formatAbiItem(jr)));if(!kr)throw new AbiFunctionSignatureNotFoundError(Er,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:kr.name,args:"inputs"in kr&&kr.inputs&&kr.inputs.length>0?decodeAbiParameters(kr.inputs,slice(wr,4)):void 0}}const docsPath$2="/docs/contract/encodeErrorResult";function encodeErrorResult(fr){const{abi:br,errorName:wr,args:Er}=fr;let kr=br[0];if(wr){const qr=getAbiItem({abi:br,args:Er,name:wr});if(!qr)throw new AbiErrorNotFoundError(wr,{docsPath:docsPath$2});kr=qr}if(kr.type!=="error")throw new AbiErrorNotFoundError(void 0,{docsPath:docsPath$2});const jr=formatAbiItem(kr),Br=toFunctionSelector(jr);let Wr="0x";if(Er&&Er.length>0){if(!kr.inputs)throw new AbiErrorInputsNotFoundError(kr.name,{docsPath:docsPath$2});Wr=encodeAbiParameters(kr.inputs,Er)}return concatHex([Br,Wr])}const docsPath$1="/docs/contract/encodeFunctionResult";function encodeFunctionResult(fr){const{abi:br,functionName:wr,result:Er}=fr;let kr=br[0];if(wr){const Br=getAbiItem({abi:br,name:wr});if(!Br)throw new AbiFunctionNotFoundError(wr,{docsPath:docsPath$1});kr=Br}if(kr.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath:docsPath$1});if(!kr.outputs)throw new AbiFunctionOutputsNotFoundError(kr.name,{docsPath:docsPath$1});let jr=Array.isArray(Er)?Er:[Er];return kr.outputs.length===0&&!jr[0]&&(jr=[]),encodeAbiParameters(kr.outputs,jr)}function encodePacked(fr,br){if(fr.length!==br.length)throw new AbiEncodingLengthMismatchError({expectedLength:fr.length,givenLength:br.length});const wr=[];for(let Er=0;ErformatLog(wr)):null,to:fr.to?fr.to:null,transactionIndex:fr.transactionIndex?hexToNumber$2(fr.transactionIndex):null,status:fr.status?receiptStatuses[fr.status]:null,type:fr.type?transactionType[fr.type]||fr.type:null};return fr.blobGasPrice&&(br.blobGasPrice=BigInt(fr.blobGasPrice)),fr.blobGasUsed&&(br.blobGasUsed=BigInt(fr.blobGasUsed)),br}const defineTransactionReceipt=defineFormatter("transactionReceipt",formatTransactionReceipt);function fromRlp(fr,br="hex"){const wr=(()=>{if(typeof fr=="string"){if(fr.length>3&&fr.length%2!==0)throw new InvalidHexValueError(fr);return hexToBytes$4(fr)}return fr})(),Er=createCursor(wr,{recursiveReadLimit:Number.POSITIVE_INFINITY});return fromRlpCursor(Er,br)}function fromRlpCursor(fr,br="hex"){if(fr.bytes.length===0)return br==="hex"?bytesToHex$4(fr.bytes):fr.bytes;const wr=fr.readByte();if(wr<128&&fr.decrementPosition(1),wr<192){const kr=readLength(fr,wr,128),jr=fr.readBytes(kr);return br==="hex"?bytesToHex$4(jr):jr}const Er=readLength(fr,wr,192);return readList(fr,Er,br)}function readLength(fr,br,wr){if(wr===128&&br<128)return 1;if(br<=wr+55)return br-wr;if(br===wr+55+1)return fr.readUint8();if(br===wr+55+2)return fr.readUint16();if(br===wr+55+3)return fr.readUint24();if(br===wr+55+4)return fr.readUint32();throw new BaseError("Invalid RLP prefix")}function readList(fr,br,wr){const Er=fr.position,kr=[];for(;fr.position-Erbr)),Pi$1=Id$1.map(fr=>(9*fr+5)%16);let idxL$1=[Id$1],idxR$1=[Pi$1];for(let fr=0;fr<4;fr++)for(let br of[idxL$1,idxR$1])br.push(br[fr].map(wr=>Rho$1[wr]));const shifts$1=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(fr=>new Uint8Array(fr)),shiftsL$1=idxL$1.map((fr,br)=>fr.map(wr=>shifts$1[br][wr])),shiftsR$1=idxR$1.map((fr,br)=>fr.map(wr=>shifts$1[br][wr])),Kl$1=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Kr$1=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);function f$8(fr,br,wr,Er){return fr===0?br^wr^Er:fr===1?br&wr|~br&Er:fr===2?(br|~wr)^Er:fr===3?br&Er|wr&~Er:br^(wr|~Er)}const R_BUF$1=new Uint32Array(16);let RIPEMD160$1=class extends HashMD$2{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:br,h1:wr,h2:Er,h3:kr,h4:jr}=this;return[br,wr,Er,kr,jr]}set(br,wr,Er,kr,jr){this.h0=br|0,this.h1=wr|0,this.h2=Er|0,this.h3=kr|0,this.h4=jr|0}process(br,wr){for(let Qr=0;Qr<16;Qr++,wr+=4)R_BUF$1[Qr]=br.getUint32(wr,!0);let Er=this.h0|0,kr=Er,jr=this.h1|0,Br=jr,Wr=this.h2|0,qr=Wr,Gr=this.h3|0,Vr=Gr,Zr=this.h4|0,Jr=Zr;for(let Qr=0;Qr<5;Qr++){const _n=4-Qr,En=Kl$1[Qr],Cn=Kr$1[Qr],In=idxL$1[Qr],An=idxR$1[Qr],jn=shiftsL$1[Qr],eo=shiftsR$1[Qr];for(let ro=0;ro<16;ro++){const to=rotl$1(Er+f$8(Qr,jr,Wr,Gr)+R_BUF$1[In[ro]]+En,jn[ro])+Zr|0;Er=Zr,Zr=Gr,Gr=rotl$1(Wr,10)|0,Wr=jr,jr=to}for(let ro=0;ro<16;ro++){const to=rotl$1(kr+f$8(_n,Br,qr,Vr)+R_BUF$1[An[ro]]+Cn,eo[ro])+Jr|0;kr=Jr,Jr=Vr,Vr=rotl$1(qr,10)|0,qr=Br,Br=to}}this.set(this.h1+Wr+Vr|0,this.h2+Gr+Jr|0,this.h3+Zr+kr|0,this.h4+Er+Br|0,this.h0+jr+qr|0)}roundClean(){R_BUF$1.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}};const ripemd160$3=wrapConstructor$2(()=>new RIPEMD160$1);function ripemd160$2(fr,br){const wr=br||"hex",Er=ripemd160$3(isHex(fr,{strict:!1})?toBytes$3(fr):fr);return wr==="bytes"?Er:toHex(Er)}const presignMessagePrefix=`Ethereum Signed Message: +`),{docsPath:br,docsSlug:"account",name:"AccountNotFoundError"})}}class AccountTypeNotSupportedError extends BaseError{constructor({docsPath:br,metaMessages:wr,type:Er}){super(`Account type "${Er}" is not supported.`,{docsPath:br,metaMessages:wr,name:"AccountTypeNotSupportedError"})}}function assertCurrentChain({chain:fr,currentChainId:br}){if(!fr)throw new ChainNotFoundError;if(br!==fr.id)throw new ChainMismatchError({chain:fr,currentChainId:br})}function getTransactionError(fr,{docsPath:br,...wr}){const Er=(()=>{const kr=getNodeError(fr,wr);return kr instanceof UnknownNodeError?fr:kr})();return new TransactionExecutionError(Er,{docsPath:br,...wr})}async function sendRawTransaction(fr,{serializedTransaction:br}){return fr.request({method:"eth_sendRawTransaction",params:[br]},{retryCount:0})}const supportsWalletNamespace=new LruMap(128);async function sendTransaction(fr,br){var In,An,jn,eo;const{account:wr=fr.account,chain:Er=fr.chain,accessList:kr,authorizationList:jr,blobs:Br,data:Wr,gas:qr,gasPrice:Gr,maxFeePerBlobGas:Vr,maxFeePerGas:Zr,maxPriorityFeePerGas:Jr,nonce:Qr,value:_n,...En}=br;if(typeof wr>"u")throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/sendTransaction"});const Cn=wr?parseAccount(wr):null;try{assertRequest(br);const ro=await(async()=>{if(br.to)return br.to;if(jr&&jr.length>0)return await recoverAuthorizationAddress({authorization:jr[0]}).catch(()=>{throw new BaseError("`to` is required. Could not infer from `authorizationList`.")})})();if((Cn==null?void 0:Cn.type)==="json-rpc"||Cn===null){let to;Er!==null&&(to=await getAction(fr,getChainId,"getChainId")({}),assertCurrentChain({currentChainId:to,chain:Er}));const _i=(jn=(An=(In=fr.chain)==null?void 0:In.formatters)==null?void 0:An.transactionRequest)==null?void 0:jn.format,io=(_i||formatTransactionRequest)({...extract(En,{format:_i}),accessList:kr,authorizationList:jr,blobs:Br,chainId:to,data:Wr,from:Cn==null?void 0:Cn.address,gas:qr,gasPrice:Gr,maxFeePerBlobGas:Vr,maxFeePerGas:Zr,maxPriorityFeePerGas:Jr,nonce:Qr,to:ro,value:_n}),co=supportsWalletNamespace.get(fr.uid),so=co?"wallet_sendTransaction":"eth_sendTransaction";try{return await fr.request({method:so,params:[io]},{retryCount:0})}catch(no){if(co===!1)throw no;const Tn=no;if(Tn.name==="InvalidInputRpcError"||Tn.name==="InvalidParamsRpcError"||Tn.name==="MethodNotFoundRpcError"||Tn.name==="MethodNotSupportedRpcError")return await fr.request({method:"wallet_sendTransaction",params:[io]},{retryCount:0}).then(Hr=>(supportsWalletNamespace.set(fr.uid,!0),Hr)).catch(Hr=>{const Xr=Hr;throw Xr.name==="MethodNotFoundRpcError"||Xr.name==="MethodNotSupportedRpcError"?(supportsWalletNamespace.set(fr.uid,!1),Tn):Xr});throw Tn}}if((Cn==null?void 0:Cn.type)==="local"){const to=await getAction(fr,prepareTransactionRequest,"prepareTransactionRequest")({account:Cn,accessList:kr,authorizationList:jr,blobs:Br,chain:Er,data:Wr,gas:qr,gasPrice:Gr,maxFeePerBlobGas:Vr,maxFeePerGas:Zr,maxPriorityFeePerGas:Jr,nonce:Qr,nonceManager:Cn.nonceManager,parameters:[...defaultParameters,"sidecars"],value:_n,...En,to:ro}),_i=(eo=Er==null?void 0:Er.serializers)==null?void 0:eo.transaction,oo=await Cn.signTransaction(to,{serializer:_i});return await getAction(fr,sendRawTransaction,"sendRawTransaction")({serializedTransaction:oo})}throw(Cn==null?void 0:Cn.type)==="smart"?new AccountTypeNotSupportedError({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new AccountTypeNotSupportedError({docsPath:"/docs/actions/wallet/sendTransaction",type:Cn==null?void 0:Cn.type})}catch(ro){throw ro instanceof AccountTypeNotSupportedError?ro:getTransactionError(ro,{...br,account:Cn,chain:br.chain||void 0})}}async function writeContract(fr,br){const{abi:wr,account:Er=fr.account,address:kr,args:jr,dataSuffix:Br,functionName:Wr,...qr}=br;if(typeof Er>"u")throw new AccountNotFoundError({docsPath:"/docs/contract/writeContract"});const Gr=Er?parseAccount(Er):null,Vr=encodeFunctionData({abi:wr,args:jr,functionName:Wr});try{return await getAction(fr,sendTransaction,"sendTransaction")({data:`${Vr}${Br?Br.replace("0x",""):""}`,to:kr,account:Gr,...qr})}catch(Zr){throw getContractError(Zr,{abi:wr,address:kr,args:jr,docsPath:"/docs/contract/writeContract",functionName:Wr,sender:Gr==null?void 0:Gr.address})}}function getContract({abi:fr,address:br,client:wr}){const Er=wr,[kr,jr]=Er?"public"in Er&&"wallet"in Er?[Er.public,Er.wallet]:"public"in Er?[Er.public,void 0]:"wallet"in Er?[void 0,Er.wallet]:[Er,Er]:[void 0,void 0],Br=kr!=null,Wr=jr!=null,qr={};let Gr=!1,Vr=!1,Zr=!1;for(const Jr of fr)if(Jr.type==="function"?Jr.stateMutability==="view"||Jr.stateMutability==="pure"?Gr=!0:Vr=!0:Jr.type==="event"&&(Zr=!0),Gr&&Vr&&Zr)break;return Br&&(Gr&&(qr.read=new Proxy({},{get(Jr,Qr){return(..._n)=>{const{args:En,options:Cn}=getFunctionParameters(_n);return getAction(kr,readContract,"readContract")({abi:fr,address:br,functionName:Qr,args:En,...Cn})}}})),Vr&&(qr.simulate=new Proxy({},{get(Jr,Qr){return(..._n)=>{const{args:En,options:Cn}=getFunctionParameters(_n);return getAction(kr,simulateContract,"simulateContract")({abi:fr,address:br,functionName:Qr,args:En,...Cn})}}})),Zr&&(qr.createEventFilter=new Proxy({},{get(Jr,Qr){return(..._n)=>{const En=fr.find(An=>An.type==="event"&&An.name===Qr),{args:Cn,options:In}=getEventParameters(_n,En);return getAction(kr,createContractEventFilter,"createContractEventFilter")({abi:fr,address:br,eventName:Qr,args:Cn,...In})}}}),qr.getEvents=new Proxy({},{get(Jr,Qr){return(..._n)=>{const En=fr.find(An=>An.type==="event"&&An.name===Qr),{args:Cn,options:In}=getEventParameters(_n,En);return getAction(kr,getContractEvents,"getContractEvents")({abi:fr,address:br,eventName:Qr,args:Cn,...In})}}}),qr.watchEvent=new Proxy({},{get(Jr,Qr){return(..._n)=>{const En=fr.find(An=>An.type==="event"&&An.name===Qr),{args:Cn,options:In}=getEventParameters(_n,En);return getAction(kr,watchContractEvent,"watchContractEvent")({abi:fr,address:br,eventName:Qr,args:Cn,...In})}}}))),Wr&&Vr&&(qr.write=new Proxy({},{get(Jr,Qr){return(..._n)=>{const{args:En,options:Cn}=getFunctionParameters(_n);return getAction(jr,writeContract,"writeContract")({abi:fr,address:br,functionName:Qr,args:En,...Cn})}}})),(Br||Wr)&&Vr&&(qr.estimateGas=new Proxy({},{get(Jr,Qr){return(..._n)=>{const{args:En,options:Cn}=getFunctionParameters(_n);return getAction(kr??jr,estimateContractGas,"estimateContractGas")({abi:fr,address:br,functionName:Qr,args:En,...Cn,account:Cn.account??jr.account})}}})),qr.address=br,qr.abi=fr,qr}function getFunctionParameters(fr){const br=fr.length&&Array.isArray(fr[0]),wr=br?fr[0]:[],Er=(br?fr[1]:fr[0])??{};return{args:wr,options:Er}}function getEventParameters(fr,br){let wr=!1;Array.isArray(fr[0])?wr=!0:fr.length===1?wr=br.inputs.some(jr=>jr.indexed):fr.length===2&&(wr=!0);const Er=wr?fr[0]:void 0,kr=(wr?fr[1]:fr[0])??{};return{args:Er,options:kr}}class Eip712DomainNotFoundError extends BaseError{constructor({address:br}){super(`No EIP-712 domain found on contract "${br}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${br}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function getEip712Domain$1(fr,br){const{address:wr,factory:Er,factoryData:kr}=br;try{const[jr,Br,Wr,qr,Gr,Vr,Zr]=await getAction(fr,readContract,"readContract")({abi:abi$2,address:wr,functionName:"eip712Domain",factory:Er,factoryData:kr});return{domain:{name:Br,version:Wr,chainId:Number(qr),verifyingContract:Gr,salt:Vr},extensions:Zr,fields:jr}}catch(jr){const Br=jr;throw Br.name==="ContractFunctionExecutionError"&&Br.cause.name==="ContractFunctionZeroDataError"?new Eip712DomainNotFoundError({address:wr}):Br}}const abi$2=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];async function addChain(fr,{chain:br}){const{id:wr,name:Er,nativeCurrency:kr,rpcUrls:jr,blockExplorers:Br}=br;await fr.request({method:"wallet_addEthereumChain",params:[{chainId:numberToHex(wr),chainName:Er,nativeCurrency:kr,rpcUrls:jr.default.http,blockExplorerUrls:Br?Object.values(Br).map(({url:Wr})=>Wr):void 0}]},{dedupe:!0,retryCount:0})}const size=256;let index=size,buffer$1;function uid(fr=11){if(!buffer$1||index+fr>size*2){buffer$1="",index=0;for(let br=0;br{const An=In(Cn);for(const eo in _n)delete An[eo];const jn={...Cn,...An};return Object.assign(jn,{extend:En(jn)})}}return Object.assign(_n,{extend:En(_n)})}function rpcSchema(){return null}const promiseCache=new LruMap(8192);function withDedupe(fr,{enabled:br=!0,id:wr}){if(!br||!wr)return fr();if(promiseCache.get(wr))return promiseCache.get(wr);const Er=fr().finally(()=>promiseCache.delete(wr));return promiseCache.set(wr,Er),Er}function withRetry(fr,{delay:br=100,retryCount:wr=2,shouldRetry:Er=()=>!0}={}){return new Promise((kr,jr)=>{const Br=async({count:Wr=0}={})=>{const qr=async({error:Gr})=>{const Vr=typeof br=="function"?br({count:Wr,error:Gr}):br;Vr&&await wait(Vr),Br({count:Wr+1})};try{const Gr=await fr();kr(Gr)}catch(Gr){if(Wr{const{dedupe:kr=!1,retryDelay:jr=150,retryCount:Br=3,uid:Wr}={...br,...Er},qr=kr?keccak256(stringToHex(`${Wr}.${stringify$4(wr)}`)):void 0;return withDedupe(()=>withRetry(async()=>{try{return await fr(wr)}catch(Gr){const Vr=Gr;switch(Vr.code){case ParseRpcError.code:throw new ParseRpcError(Vr);case InvalidRequestRpcError.code:throw new InvalidRequestRpcError(Vr);case MethodNotFoundRpcError.code:throw new MethodNotFoundRpcError(Vr,{method:wr.method});case InvalidParamsRpcError.code:throw new InvalidParamsRpcError(Vr);case InternalRpcError.code:throw new InternalRpcError(Vr);case InvalidInputRpcError.code:throw new InvalidInputRpcError(Vr);case ResourceNotFoundRpcError.code:throw new ResourceNotFoundRpcError(Vr);case ResourceUnavailableRpcError.code:throw new ResourceUnavailableRpcError(Vr);case TransactionRejectedRpcError.code:throw new TransactionRejectedRpcError(Vr);case MethodNotSupportedRpcError.code:throw new MethodNotSupportedRpcError(Vr,{method:wr.method});case LimitExceededRpcError.code:throw new LimitExceededRpcError(Vr);case JsonRpcVersionUnsupportedError.code:throw new JsonRpcVersionUnsupportedError(Vr);case UserRejectedRequestError.code:throw new UserRejectedRequestError(Vr);case UnauthorizedProviderError.code:throw new UnauthorizedProviderError(Vr);case UnsupportedProviderMethodError.code:throw new UnsupportedProviderMethodError(Vr);case ProviderDisconnectedError.code:throw new ProviderDisconnectedError(Vr);case ChainDisconnectedError.code:throw new ChainDisconnectedError(Vr);case SwitchChainError.code:throw new SwitchChainError(Vr);case 5e3:throw new UserRejectedRequestError(Vr);default:throw Gr instanceof BaseError?Gr:new UnknownRpcError(Vr)}}},{delay:({count:Gr,error:Vr})=>{var Zr;if(Vr&&Vr instanceof HttpRequestError){const Jr=(Zr=Vr==null?void 0:Vr.headers)==null?void 0:Zr.get("Retry-After");if(Jr!=null&&Jr.match(/\d/))return Number.parseInt(Jr)*1e3}return~~(1<shouldRetry(Gr)}),{enabled:kr,id:qr})}}function shouldRetry(fr){return"code"in fr&&typeof fr.code=="number"?fr.code===-1||fr.code===LimitExceededRpcError.code||fr.code===InternalRpcError.code:fr instanceof HttpRequestError&&fr.status?fr.status===403||fr.status===408||fr.status===413||fr.status===429||fr.status===500||fr.status===502||fr.status===503||fr.status===504:!0}function createTransport({key:fr,name:br,request:wr,retryCount:Er=3,retryDelay:kr=150,timeout:jr,type:Br},Wr){const qr=uid();return{config:{key:fr,name:br,request:wr,retryCount:Er,retryDelay:kr,timeout:jr,type:Br},request:buildRequest(wr,{retryCount:Er,retryDelay:kr,uid:qr}),value:Wr}}function custom(fr,br={}){const{key:wr="custom",name:Er="Custom Provider",retryDelay:kr}=br;return({retryCount:jr})=>createTransport({key:wr,name:Er,request:fr.request.bind(fr),retryCount:br.retryCount??jr,retryDelay:kr,type:"custom"})}function fallback(fr,br={}){const{key:wr="fallback",name:Er="Fallback",rank:kr=!1,retryCount:jr,retryDelay:Br}=br;return({chain:Wr,pollingInterval:qr=4e3,timeout:Gr,...Vr})=>{let Zr=fr,Jr=()=>{};const Qr=createTransport({key:wr,name:Er,async request({method:_n,params:En}){const Cn=async(In=0)=>{const An=Zr[In]({...Vr,chain:Wr,retryCount:0,timeout:Gr});try{const jn=await An.request({method:_n,params:En});return Jr({method:_n,params:En,response:jn,transport:An,status:"success"}),jn}catch(jn){if(Jr({error:jn,method:_n,params:En,transport:An,status:"error"}),shouldThrow(jn)||In===Zr.length-1)throw jn;return Cn(In+1)}};return Cn()},retryCount:jr,retryDelay:Br,type:"fallback"},{onResponse:_n=>Jr=_n,transports:Zr.map(_n=>_n({chain:Wr,retryCount:0}))});if(kr){const _n=typeof kr=="object"?kr:{};rankTransports({chain:Wr,interval:_n.interval??qr,onTransports:En=>Zr=En,sampleCount:_n.sampleCount,timeout:_n.timeout,transports:Zr,weights:_n.weights})}return Qr}}function shouldThrow(fr){return"code"in fr&&typeof fr.code=="number"&&(fr.code===TransactionRejectedRpcError.code||fr.code===UserRejectedRequestError.code||fr.code===5e3)}function rankTransports({chain:fr,interval:br=4e3,onTransports:wr,sampleCount:Er=10,timeout:kr=1e3,transports:jr,weights:Br={}}){const{stability:Wr=.7,latency:qr=.3}=Br,Gr=[],Vr=async()=>{const Zr=await Promise.all(jr.map(async _n=>{const En=_n({chain:fr,retryCount:0,timeout:kr}),Cn=Date.now();let In,An;try{await En.request({method:"net_listening"}),An=1}catch{An=0}finally{In=Date.now()}return{latency:In-Cn,success:An}}));Gr.push(Zr),Gr.length>Er&&Gr.shift();const Jr=Math.max(...Gr.map(_n=>Math.max(..._n.map(({latency:En})=>En)))),Qr=jr.map((_n,En)=>{const Cn=Gr.map(ro=>ro[En].latency),An=1-Cn.reduce((ro,to)=>ro+to,0)/Cn.length/Jr,jn=Gr.map(ro=>ro[En].success),eo=jn.reduce((ro,to)=>ro+to,0)/jn.length;return eo===0?[0,En]:[qr*An+Wr*eo,En]}).sort((_n,En)=>En[0]-_n[0]);wr(Qr.map(([,_n])=>jr[_n])),await wait(br),Vr()};Vr()}class UrlRequiredError extends BaseError{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}function withTimeout(fr,{errorInstance:br=new Error("timed out"),timeout:wr,signal:Er}){return new Promise((kr,jr)=>{(async()=>{let Br;try{const Wr=new AbortController;wr>0&&(Br=setTimeout(()=>{Er?Wr.abort():jr(br)},wr)),kr(await fr({signal:(Wr==null?void 0:Wr.signal)||null}))}catch(Wr){(Wr==null?void 0:Wr.name)==="AbortError"&&jr(br),jr(Wr)}finally{clearTimeout(Br)}})()})}function createIdStore(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const idCache=createIdStore();function getHttpRpcClient(fr,br={}){return{async request(wr){var Zr;const{body:Er,onRequest:kr=br.onRequest,onResponse:jr=br.onResponse,timeout:Br=br.timeout??1e4}=wr,Wr={...br.fetchOptions??{},...wr.fetchOptions??{}},{headers:qr,method:Gr,signal:Vr}=Wr;try{const Jr=await withTimeout(async({signal:_n})=>{const En={...Wr,body:Array.isArray(Er)?stringify$4(Er.map(jn=>({jsonrpc:"2.0",id:jn.id??idCache.take(),...jn}))):stringify$4({jsonrpc:"2.0",id:Er.id??idCache.take(),...Er}),headers:{"Content-Type":"application/json",...qr},method:Gr||"POST",signal:Vr||(Br>0?_n:null)},Cn=new Request(fr,En),In=await(kr==null?void 0:kr(Cn,En))??{...En,url:fr};return await fetch(In.url??fr,In)},{errorInstance:new TimeoutError({body:Er,url:fr}),timeout:Br,signal:!0});jr&&await jr(Jr);let Qr;if((Zr=Jr.headers.get("Content-Type"))!=null&&Zr.startsWith("application/json"))Qr=await Jr.json();else{Qr=await Jr.text();try{Qr=JSON.parse(Qr||"{}")}catch(_n){if(Jr.ok)throw _n;Qr={error:Qr}}}if(!Jr.ok)throw new HttpRequestError({body:Er,details:stringify$4(Qr.error)||Jr.statusText,headers:Jr.headers,status:Jr.status,url:fr});return Qr}catch(Jr){throw Jr instanceof HttpRequestError||Jr instanceof TimeoutError?Jr:new HttpRequestError({body:Er,cause:Jr,url:fr})}}}}function http(fr,br={}){const{batch:wr,fetchOptions:Er,key:kr="http",name:jr="HTTP JSON-RPC",onFetchRequest:Br,onFetchResponse:Wr,retryDelay:qr}=br;return({chain:Gr,retryCount:Vr,timeout:Zr})=>{const{batchSize:Jr=1e3,wait:Qr=0}=typeof wr=="object"?wr:{},_n=br.retryCount??Vr,En=Zr??br.timeout??1e4,Cn=fr||(Gr==null?void 0:Gr.rpcUrls.default.http[0]);if(!Cn)throw new UrlRequiredError;const In=getHttpRpcClient(Cn,{fetchOptions:Er,onRequest:Br,onResponse:Wr,timeout:En});return createTransport({key:kr,name:jr,async request({method:An,params:jn}){const eo={method:An,params:jn},{schedule:ro}=createBatchScheduler({id:Cn,wait:Qr,shouldSplitBatch(io){return io.length>Jr},fn:io=>In.request({body:io}),sort:(io,co)=>io.id-co.id}),to=async io=>wr?ro(io):[await In.request({body:io})],[{error:_i,result:oo}]=await to(eo);if(_i)throw new RpcRequestError({body:eo,error:_i,url:Cn});return oo},retryCount:_n,retryDelay:qr,timeout:En,type:"http"},{fetchOptions:Er,url:Cn})}}function isNullUniversalResolverError(fr,br){var Er,kr,jr,Br,Wr,qr;if(!(fr instanceof BaseError))return!1;const wr=fr.walk(Gr=>Gr instanceof ContractFunctionRevertedError);return wr instanceof ContractFunctionRevertedError?!!(((Er=wr.data)==null?void 0:Er.errorName)==="ResolverNotFound"||((kr=wr.data)==null?void 0:kr.errorName)==="ResolverWildcardNotSupported"||((jr=wr.data)==null?void 0:jr.errorName)==="ResolverNotContract"||((Br=wr.data)==null?void 0:Br.errorName)==="ResolverError"||((Wr=wr.data)==null?void 0:Wr.errorName)==="HttpError"||(qr=wr.reason)!=null&&qr.includes("Wildcard on non-extended resolvers is not supported")||br==="reverse"&&wr.reason===panicReasons[50]):!1}function encodedLabelToLabelhash(fr){if(fr.length!==66||fr.indexOf("[")!==0||fr.indexOf("]")!==65)return null;const br=`0x${fr.slice(1,65)}`;return isHex(br)?br:null}function namehash(fr){let br=new Uint8Array(32).fill(0);if(!fr)return bytesToHex$4(br);const wr=fr.split(".");for(let Er=wr.length-1;Er>=0;Er-=1){const kr=encodedLabelToLabelhash(wr[Er]),jr=kr?toBytes$3(kr):keccak256(stringToBytes$1(wr[Er]),"bytes");br=keccak256(concat$1([br,jr]),"bytes")}return bytesToHex$4(br)}function encodeLabelhash(fr){return`[${fr.slice(2)}]`}function labelhash(fr){const br=new Uint8Array(32).fill(0);return fr?encodedLabelToLabelhash(fr)||keccak256(stringToBytes$1(fr)):bytesToHex$4(br)}function packetToBytes(fr){const br=fr.replace(/^\.|\.$/gm,"");if(br.length===0)return new Uint8Array(1);const wr=new Uint8Array(stringToBytes$1(br).byteLength+2);let Er=0;const kr=br.split(".");for(let jr=0;jr255&&(Br=stringToBytes$1(encodeLabelhash(labelhash(kr[jr])))),wr[Er]=Br.length,wr.set(Br,Er+1),Er+=Br.length+1}return wr.byteLength!==Er+1?wr.slice(0,Er+1):wr}async function getEnsAddress(fr,{blockNumber:br,blockTag:wr,coinType:Er,name:kr,gatewayUrls:jr,strict:Br,universalResolverAddress:Wr}){let qr=Wr;if(!qr){if(!fr.chain)throw new Error("client chain not configured. universalResolverAddress is required.");qr=getChainContractAddress({blockNumber:br,chain:fr.chain,contract:"ensUniversalResolver"})}try{const Gr=encodeFunctionData({abi:addressResolverAbi,functionName:"addr",...Er!=null?{args:[namehash(kr),BigInt(Er)]}:{args:[namehash(kr)]}}),Vr={address:qr,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(kr)),Gr],blockNumber:br,blockTag:wr},Zr=getAction(fr,readContract,"readContract"),Jr=jr?await Zr({...Vr,args:[...Vr.args,jr]}):await Zr(Vr);if(Jr[0]==="0x")return null;const Qr=decodeFunctionResult({abi:addressResolverAbi,args:Er!=null?[namehash(kr),BigInt(Er)]:void 0,functionName:"addr",data:Jr[0]});return Qr==="0x"||trim(Qr)==="0x00"?null:Qr}catch(Gr){if(Br)throw Gr;if(isNullUniversalResolverError(Gr,"resolve"))return null;throw Gr}}class EnsAvatarInvalidMetadataError extends BaseError{constructor({data:br}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(br)}`],name:"EnsAvatarInvalidMetadataError"})}}class EnsAvatarInvalidNftUriError extends BaseError{constructor({reason:br}){super(`ENS NFT avatar URI is invalid. ${br}`,{name:"EnsAvatarInvalidNftUriError"})}}class EnsAvatarUriResolutionError extends BaseError{constructor({uri:br}){super(`Unable to resolve ENS avatar URI "${br}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class EnsAvatarUnsupportedNamespaceError extends BaseError{constructor({namespace:br}){super(`ENS NFT avatar namespace "${br}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const networkRegex=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,ipfsHashRegex=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?[\w\-.]+))?(?\/.*)?$/,base64Regex=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,dataURIRegex=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function isImageUri(fr){try{const br=await fetch(fr,{method:"HEAD"});if(br.status===200){const wr=br.headers.get("content-type");return wr==null?void 0:wr.startsWith("image/")}return!1}catch(br){return typeof br=="object"&&typeof br.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(wr=>{const Er=new Image;Er.onload=()=>{wr(!0)},Er.onerror=()=>{wr(!1)},Er.src=fr})}}function getGateway(fr,br){return fr?fr.endsWith("/")?fr.slice(0,-1):fr:br}function resolveAvatarUri({uri:fr,gatewayUrls:br}){const wr=base64Regex.test(fr);if(wr)return{uri:fr,isOnChain:!0,isEncoded:wr};const Er=getGateway(br==null?void 0:br.ipfs,"https://ipfs.io"),kr=getGateway(br==null?void 0:br.arweave,"https://arweave.net"),jr=fr.match(networkRegex),{protocol:Br,subpath:Wr,target:qr,subtarget:Gr=""}=(jr==null?void 0:jr.groups)||{},Vr=Br==="ipns:/"||Wr==="ipns/",Zr=Br==="ipfs:/"||Wr==="ipfs/"||ipfsHashRegex.test(fr);if(fr.startsWith("http")&&!Vr&&!Zr){let Qr=fr;return br!=null&&br.arweave&&(Qr=fr.replace(/https:\/\/arweave.net/g,br==null?void 0:br.arweave)),{uri:Qr,isOnChain:!1,isEncoded:!1}}if((Vr||Zr)&&qr)return{uri:`${Er}/${Vr?"ipns":"ipfs"}/${qr}${Gr}`,isOnChain:!1,isEncoded:!1};if(Br==="ar:/"&&qr)return{uri:`${kr}/${qr}${Gr||""}`,isOnChain:!1,isEncoded:!1};let Jr=fr.replace(dataURIRegex,"");if(Jr.startsWith("kr.json());return await parseAvatarUri({gatewayUrls:fr,uri:getJsonImage(wr)})}catch{throw new EnsAvatarUriResolutionError({uri:br})}}async function parseAvatarUri({gatewayUrls:fr,uri:br}){const{uri:wr,isOnChain:Er}=resolveAvatarUri({uri:br,gatewayUrls:fr});if(Er||await isImageUri(wr))return wr;throw new EnsAvatarUriResolutionError({uri:br})}function parseNftUri(fr){let br=fr;br.startsWith("did:nft:")&&(br=br.replace("did:nft:","").replace(/_/g,"/"));const[wr,Er,kr]=br.split("/"),[jr,Br]=wr.split(":"),[Wr,qr]=Er.split(":");if(!jr||jr.toLowerCase()!=="eip155")throw new EnsAvatarInvalidNftUriError({reason:"Only EIP-155 supported"});if(!Br)throw new EnsAvatarInvalidNftUriError({reason:"Chain ID not found"});if(!qr)throw new EnsAvatarInvalidNftUriError({reason:"Contract address not found"});if(!kr)throw new EnsAvatarInvalidNftUriError({reason:"Token ID not found"});if(!Wr)throw new EnsAvatarInvalidNftUriError({reason:"ERC namespace not found"});return{chainID:Number.parseInt(Br),namespace:Wr.toLowerCase(),contractAddress:qr,tokenID:kr}}async function getNftTokenUri(fr,{nft:br}){if(br.namespace==="erc721")return readContract(fr,{address:br.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(br.tokenID)]});if(br.namespace==="erc1155")return readContract(fr,{address:br.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(br.tokenID)]});throw new EnsAvatarUnsupportedNamespaceError({namespace:br.namespace})}async function parseAvatarRecord(fr,{gatewayUrls:br,record:wr}){return/eip155:/i.test(wr)?parseNftAvatarUri(fr,{gatewayUrls:br,record:wr}):parseAvatarUri({uri:wr,gatewayUrls:br})}async function parseNftAvatarUri(fr,{gatewayUrls:br,record:wr}){const Er=parseNftUri(wr),kr=await getNftTokenUri(fr,{nft:Er}),{uri:jr,isOnChain:Br,isEncoded:Wr}=resolveAvatarUri({uri:kr,gatewayUrls:br});if(Br&&(jr.includes("data:application/json;base64,")||jr.startsWith("{"))){const Gr=Wr?atob(jr.replace("data:application/json;base64,","")):jr,Vr=JSON.parse(Gr);return parseAvatarUri({uri:getJsonImage(Vr),gatewayUrls:br})}let qr=Er.tokenID;return Er.namespace==="erc1155"&&(qr=qr.replace("0x","").padStart(64,"0")),getMetadataAvatarUri({gatewayUrls:br,uri:jr.replace(/(?:0x)?{id}/,qr)})}async function getEnsText(fr,{blockNumber:br,blockTag:wr,name:Er,key:kr,gatewayUrls:jr,strict:Br,universalResolverAddress:Wr}){let qr=Wr;if(!qr){if(!fr.chain)throw new Error("client chain not configured. universalResolverAddress is required.");qr=getChainContractAddress({blockNumber:br,chain:fr.chain,contract:"ensUniversalResolver"})}try{const Gr={address:qr,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(Er)),encodeFunctionData({abi:textResolverAbi,functionName:"text",args:[namehash(Er),kr]})],blockNumber:br,blockTag:wr},Vr=getAction(fr,readContract,"readContract"),Zr=jr?await Vr({...Gr,args:[...Gr.args,jr]}):await Vr(Gr);if(Zr[0]==="0x")return null;const Jr=decodeFunctionResult({abi:textResolverAbi,functionName:"text",data:Zr[0]});return Jr===""?null:Jr}catch(Gr){if(Br)throw Gr;if(isNullUniversalResolverError(Gr,"resolve"))return null;throw Gr}}async function getEnsAvatar(fr,{blockNumber:br,blockTag:wr,assetGatewayUrls:Er,name:kr,gatewayUrls:jr,strict:Br,universalResolverAddress:Wr}){const qr=await getAction(fr,getEnsText,"getEnsText")({blockNumber:br,blockTag:wr,key:"avatar",name:kr,universalResolverAddress:Wr,gatewayUrls:jr,strict:Br});if(!qr)return null;try{return await parseAvatarRecord(fr,{record:qr,gatewayUrls:Er})}catch{return null}}async function getEnsName(fr,{address:br,blockNumber:wr,blockTag:Er,gatewayUrls:kr,strict:jr,universalResolverAddress:Br}){let Wr=Br;if(!Wr){if(!fr.chain)throw new Error("client chain not configured. universalResolverAddress is required.");Wr=getChainContractAddress({blockNumber:wr,chain:fr.chain,contract:"ensUniversalResolver"})}const qr=`${br.toLowerCase().substring(2)}.addr.reverse`;try{const Gr={address:Wr,abi:universalResolverReverseAbi,functionName:"reverse",args:[toHex(packetToBytes(qr))],blockNumber:wr,blockTag:Er},Vr=getAction(fr,readContract,"readContract"),[Zr,Jr]=kr?await Vr({...Gr,args:[...Gr.args,kr]}):await Vr(Gr);return br.toLowerCase()!==Jr.toLowerCase()?null:Zr}catch(Gr){if(jr)throw Gr;if(isNullUniversalResolverError(Gr,"reverse"))return null;throw Gr}}async function getEnsResolver(fr,{blockNumber:br,blockTag:wr,name:Er,universalResolverAddress:kr}){let jr=kr;if(!jr){if(!fr.chain)throw new Error("client chain not configured. universalResolverAddress is required.");jr=getChainContractAddress({blockNumber:br,chain:fr.chain,contract:"ensUniversalResolver"})}const[Br]=await getAction(fr,readContract,"readContract")({address:jr,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[toHex(packetToBytes(Er))],blockNumber:br,blockTag:wr});return Br}async function createBlockFilter(fr){const br=createFilterRequestScope(fr,{method:"eth_newBlockFilter"}),wr=await fr.request({method:"eth_newBlockFilter"});return{id:wr,request:br(wr),type:"block"}}async function createEventFilter(fr,{address:br,args:wr,event:Er,events:kr,fromBlock:jr,strict:Br,toBlock:Wr}={}){const qr=kr??(Er?[Er]:void 0),Gr=createFilterRequestScope(fr,{method:"eth_newFilter"});let Vr=[];qr&&(Vr=[qr.flatMap(Qr=>encodeEventTopics({abi:[Qr],eventName:Qr.name,args:wr}))],Er&&(Vr=Vr[0]));const Zr=await fr.request({method:"eth_newFilter",params:[{address:br,fromBlock:typeof jr=="bigint"?numberToHex(jr):jr,toBlock:typeof Wr=="bigint"?numberToHex(Wr):Wr,...Vr.length?{topics:Vr}:{}}]});return{abi:qr,args:wr,eventName:Er?Er.name:void 0,fromBlock:jr,id:Zr,request:Gr(Zr),strict:!!Br,toBlock:Wr,type:"event"}}async function createPendingTransactionFilter(fr){const br=createFilterRequestScope(fr,{method:"eth_newPendingTransactionFilter"}),wr=await fr.request({method:"eth_newPendingTransactionFilter"});return{id:wr,request:br(wr),type:"transaction"}}async function getBlobBaseFee(fr){const br=await fr.request({method:"eth_blobBaseFee"});return BigInt(br)}async function getBlockTransactionCount(fr,{blockHash:br,blockNumber:wr,blockTag:Er="latest"}={}){const kr=wr!==void 0?numberToHex(wr):void 0;let jr;return br?jr=await fr.request({method:"eth_getBlockTransactionCountByHash",params:[br]},{dedupe:!0}):jr=await fr.request({method:"eth_getBlockTransactionCountByNumber",params:[kr||Er]},{dedupe:!!kr}),hexToNumber$2(jr)}async function getCode(fr,{address:br,blockNumber:wr,blockTag:Er="latest"}){const kr=wr!==void 0?numberToHex(wr):void 0,jr=await fr.request({method:"eth_getCode",params:[br,kr||Er]},{dedupe:!!kr});if(jr!=="0x")return jr}function formatFeeHistory(fr){var br;return{baseFeePerGas:fr.baseFeePerGas.map(wr=>BigInt(wr)),gasUsedRatio:fr.gasUsedRatio,oldestBlock:BigInt(fr.oldestBlock),reward:(br=fr.reward)==null?void 0:br.map(wr=>wr.map(Er=>BigInt(Er)))}}async function getFeeHistory(fr,{blockCount:br,blockNumber:wr,blockTag:Er="latest",rewardPercentiles:kr}){const jr=wr?numberToHex(wr):void 0,Br=await fr.request({method:"eth_feeHistory",params:[numberToHex(br),jr||Er,kr]},{dedupe:!!jr});return formatFeeHistory(Br)}async function getFilterLogs(fr,{filter:br}){const wr=br.strict??!1,kr=(await br.request({method:"eth_getFilterLogs",params:[br.id]})).map(jr=>formatLog(jr));return br.abi?parseEventLogs({abi:br.abi,logs:kr,strict:wr}):kr}class OffchainLookupError extends BaseError{constructor({callbackSelector:br,cause:wr,data:Er,extraData:kr,sender:jr,urls:Br}){var Wr;super(wr.shortMessage||"An error occurred while fetching for an offchain result.",{cause:wr,metaMessages:[...wr.metaMessages||[],(Wr=wr.metaMessages)!=null&&Wr.length?"":[],"Offchain Gateway Call:",Br&&[" Gateway URL(s):",...Br.map(qr=>` ${getUrl(qr)}`)],` Sender: ${jr}`,` Data: ${Er}`,` Callback selector: ${br}`,` Extra data: ${kr}`].flat(),name:"OffchainLookupError"})}}class OffchainLookupResponseMalformedError extends BaseError{constructor({result:br,url:wr}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${getUrl(wr)}`,`Response: ${stringify$4(br)}`],name:"OffchainLookupResponseMalformedError"})}}class OffchainLookupSenderMismatchError extends BaseError{constructor({sender:br,to:wr}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${wr}`,`OffchainLookup sender address: ${br}`],name:"OffchainLookupSenderMismatchError"})}}const offchainLookupSignature="0x556f1830",offchainLookupAbiItem={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function offchainLookup(fr,{blockNumber:br,blockTag:wr,data:Er,to:kr}){const{args:jr}=decodeErrorResult({data:Er,abi:[offchainLookupAbiItem]}),[Br,Wr,qr,Gr,Vr]=jr,{ccipRead:Zr}=fr,Jr=Zr&&typeof(Zr==null?void 0:Zr.request)=="function"?Zr.request:ccipRequest;try{if(!isAddressEqual(kr,Br))throw new OffchainLookupSenderMismatchError({sender:Br,to:kr});const Qr=await Jr({data:qr,sender:Br,urls:Wr}),{data:_n}=await call(fr,{blockNumber:br,blockTag:wr,data:concat$1([Gr,encodeAbiParameters([{type:"bytes"},{type:"bytes"}],[Qr,Vr])]),to:kr});return _n}catch(Qr){throw new OffchainLookupError({callbackSelector:Gr,cause:Qr,data:Er,extraData:Vr,sender:Br,urls:Wr})}}async function ccipRequest({data:fr,sender:br,urls:wr}){var kr;let Er=new Error("An unknown error occurred.");for(let jr=0;jrwr.id===br)}const arrayRegex=/^(.*)\[([0-9]*)\]$/,bytesRegex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,integerRegex=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,socketClientCache=new Map;async function getSocketRpcClient(fr){const{getSocket:br,keepAlive:wr=!0,key:Er="socket",reconnect:kr=!0,url:jr}=fr,{interval:Br=3e4}=typeof wr=="object"?wr:{},{attempts:Wr=5,delay:qr=2e3}=typeof kr=="object"?kr:{};let Gr=socketClientCache.get(`${Er}:${jr}`);if(Gr)return Gr;let Vr=0;const{schedule:Zr}=createBatchScheduler({id:`${Er}:${jr}`,fn:async()=>{const _n=new Map,En=new Map;let Cn,In,An;async function jn(){const eo=await br({onClose(){var ro,to;for(const _i of _n.values())(ro=_i.onError)==null||ro.call(_i,new SocketClosedError({url:jr}));for(const _i of En.values())(to=_i.onError)==null||to.call(_i,new SocketClosedError({url:jr}));_n.clear(),En.clear(),kr&&Vr{Vr++,await jn().catch(console.error)},qr)},onError(ro){var to,_i;Cn=ro;for(const oo of _n.values())(to=oo.onError)==null||to.call(oo,Cn);for(const oo of En.values())(_i=oo.onError)==null||_i.call(oo,Cn);_n.clear(),En.clear(),kr&&Vr{Vr++,await jn().catch(console.error)},qr)},onOpen(){Cn=void 0,Vr=0},onResponse(ro){const to=ro.method==="eth_subscription",_i=to?ro.params.subscription:ro.id,oo=to?En:_n,io=oo.get(_i);io&&io.onResponse(ro),to||oo.delete(_i)}});return In=eo,wr&&(An&&clearInterval(An),An=setInterval(()=>{var ro;return(ro=In.ping)==null?void 0:ro.call(In)},Br)),eo}return await jn(),Cn=void 0,Gr={close(){An&&clearInterval(An),In.close(),socketClientCache.delete(`${Er}:${jr}`)},get socket(){return In},request({body:eo,onError:ro,onResponse:to}){Cn&&ro&&ro(Cn);const _i=eo.id??idCache.take(),oo=io=>{var co;typeof io.id=="number"&&_i!==io.id||(eo.method==="eth_subscribe"&&typeof io.result=="string"&&En.set(io.result,{onResponse:oo,onError:ro}),eo.method==="eth_unsubscribe"&&En.delete((co=eo.params)==null?void 0:co[0]),to(io))};_n.set(_i,{onResponse:oo,onError:ro});try{In.request({body:{jsonrpc:"2.0",id:_i,...eo}})}catch(io){ro==null||ro(io)}},requestAsync({body:eo,timeout:ro=1e4}){return withTimeout(()=>new Promise((to,_i)=>this.request({body:eo,onError:_i,onResponse:to})),{errorInstance:new TimeoutError({body:eo,url:jr}),timeout:ro})},requests:_n,subscriptions:En,url:jr},socketClientCache.set(`${Er}:${jr}`,Gr),[Gr]}}),[Jr,[Qr]]=await Zr();return Qr}async function getWebSocketRpcClient(fr,br={}){const{keepAlive:wr,reconnect:Er}=br;return getSocketRpcClient({async getSocket({onClose:kr,onError:jr,onOpen:Br,onResponse:Wr}){const qr=await __vitePreload(()=>import("./native-BCwCyULO.js"),[]).then(Qr=>Qr.WebSocket),Gr=new qr(fr);function Vr(){kr(),Gr.removeEventListener("close",Vr),Gr.removeEventListener("message",Zr),Gr.removeEventListener("error",jr),Gr.removeEventListener("open",Br)}function Zr({data:Qr}){Wr(JSON.parse(Qr))}Gr.addEventListener("close",Vr),Gr.addEventListener("message",Zr),Gr.addEventListener("error",jr),Gr.addEventListener("open",Br),Gr.readyState===qr.CONNECTING&&await new Promise((Qr,_n)=>{Gr&&(Gr.onopen=Qr,Gr.onerror=_n)});const{close:Jr}=Gr;return Object.assign(Gr,{close(){Jr.bind(Gr)(),kr()},ping(){try{if(Gr.readyState===Gr.CLOSED||Gr.readyState===Gr.CLOSING)throw new WebSocketRequestError({url:Gr.url,cause:new SocketClosedError({url:Gr.url})});const Qr={jsonrpc:"2.0",method:"net_version",params:[]};Gr.send(JSON.stringify(Qr))}catch(Qr){jr(Qr)}},request({body:Qr}){if(Gr.readyState===Gr.CLOSED||Gr.readyState===Gr.CLOSING)throw new WebSocketRequestError({body:Qr,url:Gr.url,cause:new SocketClosedError({url:Gr.url})});return Gr.send(JSON.stringify(Qr))}})},keepAlive:wr,reconnect:Er,url:fr})}async function getSocket(fr){const br=await getWebSocketRpcClient(fr);return Object.assign(br.socket,{requests:br.requests,subscriptions:br.subscriptions})}class InvalidDomainError extends BaseError{constructor({domain:br}){super(`Invalid domain "${stringify$4(br)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class InvalidPrimaryTypeError extends BaseError{constructor({primaryType:br,types:wr}){super(`Invalid primary type \`${br}\` must be one of \`${JSON.stringify(Object.keys(wr))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class InvalidStructTypeError extends BaseError{constructor({type:br}){super(`Struct type "${br}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function hashTypedData(fr){const{domain:br={},message:wr,primaryType:Er}=fr,kr={EIP712Domain:getTypesForEIP712Domain({domain:br}),...fr.types};validateTypedData({domain:br,message:wr,primaryType:Er,types:kr});const jr=["0x1901"];return br&&jr.push(hashDomain({domain:br,types:kr})),Er!=="EIP712Domain"&&jr.push(hashStruct({data:wr,primaryType:Er,types:kr})),keccak256(concat$1(jr))}function hashDomain({domain:fr,types:br}){return hashStruct({data:fr,primaryType:"EIP712Domain",types:br})}function hashStruct({data:fr,primaryType:br,types:wr}){const Er=encodeData$2({data:fr,primaryType:br,types:wr});return keccak256(Er)}function encodeData$2({data:fr,primaryType:br,types:wr}){const Er=[{type:"bytes32"}],kr=[hashType({primaryType:br,types:wr})];for(const jr of wr[br]){const[Br,Wr]=encodeField({types:wr,name:jr.name,type:jr.type,value:fr[jr.name]});Er.push(Br),kr.push(Wr)}return encodeAbiParameters(Er,kr)}function hashType({primaryType:fr,types:br}){const wr=toHex(encodeType({primaryType:fr,types:br}));return keccak256(wr)}function encodeType({primaryType:fr,types:br}){let wr="";const Er=findTypeDependencies({primaryType:fr,types:br});Er.delete(fr);const kr=[fr,...Array.from(Er).sort()];for(const jr of kr)wr+=`${jr}(${br[jr].map(({name:Br,type:Wr})=>`${Wr} ${Br}`).join(",")})`;return wr}function findTypeDependencies({primaryType:fr,types:br},wr=new Set){const Er=fr.match(/^\w*/u),kr=Er==null?void 0:Er[0];if(wr.has(kr)||br[kr]===void 0)return wr;wr.add(kr);for(const jr of br[kr])findTypeDependencies({primaryType:jr.type,types:br},wr);return wr}function encodeField({types:fr,name:br,type:wr,value:Er}){if(fr[wr]!==void 0)return[{type:"bytes32"},keccak256(encodeData$2({data:Er,primaryType:wr,types:fr}))];if(wr==="bytes")return Er=`0x${(Er.length%2?"0":"")+Er.slice(2)}`,[{type:"bytes32"},keccak256(Er)];if(wr==="string")return[{type:"bytes32"},keccak256(toHex(Er))];if(wr.lastIndexOf("]")===wr.length-1){const kr=wr.slice(0,wr.lastIndexOf("[")),jr=Er.map(Br=>encodeField({name:br,type:kr,types:fr,value:Br}));return[{type:"bytes32"},keccak256(encodeAbiParameters(jr.map(([Br])=>Br),jr.map(([,Br])=>Br)))]}return[{type:wr},Er]}function serializeTypedData(fr){const{domain:br,message:wr,primaryType:Er,types:kr}=fr,jr=(qr,Gr)=>{const Vr={...Gr};for(const Zr of qr){const{name:Jr,type:Qr}=Zr;Qr==="address"&&(Vr[Jr]=Vr[Jr].toLowerCase())}return Vr},Br=kr.EIP712Domain?br?jr(kr.EIP712Domain,br):{}:{},Wr=(()=>{if(Er!=="EIP712Domain")return jr(kr[Er],wr)})();return stringify$4({domain:Br,message:Wr,primaryType:Er,types:kr})}function validateTypedData(fr){const{domain:br,message:wr,primaryType:Er,types:kr}=fr,jr=(Br,Wr)=>{for(const qr of Br){const{name:Gr,type:Vr}=qr,Zr=Wr[Gr],Jr=Vr.match(integerRegex);if(Jr&&(typeof Zr=="number"||typeof Zr=="bigint")){const[En,Cn,In]=Jr;numberToHex(Zr,{signed:Cn==="int",size:Number.parseInt(In)/8})}if(Vr==="address"&&typeof Zr=="string"&&!isAddress(Zr))throw new InvalidAddressError({address:Zr});const Qr=Vr.match(bytesRegex);if(Qr){const[En,Cn]=Qr;if(Cn&&size$1(Zr)!==Number.parseInt(Cn))throw new BytesSizeMismatchError({expectedSize:Number.parseInt(Cn),givenSize:size$1(Zr)})}const _n=kr[Vr];_n&&(validateReference(Vr),jr(_n,Zr))}};if(kr.EIP712Domain&&br){if(typeof br!="object")throw new InvalidDomainError({domain:br});jr(kr.EIP712Domain,br)}if(Er!=="EIP712Domain")if(kr[Er])jr(kr[Er],wr);else throw new InvalidPrimaryTypeError({primaryType:Er,types:kr})}function getTypesForEIP712Domain({domain:fr}){return[typeof(fr==null?void 0:fr.name)=="string"&&{name:"name",type:"string"},(fr==null?void 0:fr.version)&&{name:"version",type:"string"},typeof(fr==null?void 0:fr.chainId)=="number"&&{name:"chainId",type:"uint256"},(fr==null?void 0:fr.verifyingContract)&&{name:"verifyingContract",type:"address"},(fr==null?void 0:fr.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function domainSeparator({domain:fr}){return hashDomain({domain:fr,types:{EIP712Domain:getTypesForEIP712Domain({domain:fr})}})}function validateReference(fr){if(fr==="address"||fr==="bool"||fr==="string"||fr.startsWith("bytes")||fr.startsWith("uint")||fr.startsWith("int"))throw new InvalidStructTypeError({type:fr})}function decodeFunctionData(fr){const{abi:br,data:wr}=fr,Er=slice(wr,0,4),kr=br.find(jr=>jr.type==="function"&&Er===toFunctionSelector(formatAbiItem(jr)));if(!kr)throw new AbiFunctionSignatureNotFoundError(Er,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:kr.name,args:"inputs"in kr&&kr.inputs&&kr.inputs.length>0?decodeAbiParameters(kr.inputs,slice(wr,4)):void 0}}const docsPath$2="/docs/contract/encodeErrorResult";function encodeErrorResult(fr){const{abi:br,errorName:wr,args:Er}=fr;let kr=br[0];if(wr){const qr=getAbiItem({abi:br,args:Er,name:wr});if(!qr)throw new AbiErrorNotFoundError(wr,{docsPath:docsPath$2});kr=qr}if(kr.type!=="error")throw new AbiErrorNotFoundError(void 0,{docsPath:docsPath$2});const jr=formatAbiItem(kr),Br=toFunctionSelector(jr);let Wr="0x";if(Er&&Er.length>0){if(!kr.inputs)throw new AbiErrorInputsNotFoundError(kr.name,{docsPath:docsPath$2});Wr=encodeAbiParameters(kr.inputs,Er)}return concatHex([Br,Wr])}const docsPath$1="/docs/contract/encodeFunctionResult";function encodeFunctionResult(fr){const{abi:br,functionName:wr,result:Er}=fr;let kr=br[0];if(wr){const Br=getAbiItem({abi:br,name:wr});if(!Br)throw new AbiFunctionNotFoundError(wr,{docsPath:docsPath$1});kr=Br}if(kr.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath:docsPath$1});if(!kr.outputs)throw new AbiFunctionOutputsNotFoundError(kr.name,{docsPath:docsPath$1});let jr=Array.isArray(Er)?Er:[Er];return kr.outputs.length===0&&!jr[0]&&(jr=[]),encodeAbiParameters(kr.outputs,jr)}function encodePacked(fr,br){if(fr.length!==br.length)throw new AbiEncodingLengthMismatchError({expectedLength:fr.length,givenLength:br.length});const wr=[];for(let Er=0;ErformatLog(wr)):null,to:fr.to?fr.to:null,transactionIndex:fr.transactionIndex?hexToNumber$2(fr.transactionIndex):null,status:fr.status?receiptStatuses[fr.status]:null,type:fr.type?transactionType[fr.type]||fr.type:null};return fr.blobGasPrice&&(br.blobGasPrice=BigInt(fr.blobGasPrice)),fr.blobGasUsed&&(br.blobGasUsed=BigInt(fr.blobGasUsed)),br}const defineTransactionReceipt=defineFormatter("transactionReceipt",formatTransactionReceipt);function fromRlp(fr,br="hex"){const wr=(()=>{if(typeof fr=="string"){if(fr.length>3&&fr.length%2!==0)throw new InvalidHexValueError(fr);return hexToBytes$4(fr)}return fr})(),Er=createCursor(wr,{recursiveReadLimit:Number.POSITIVE_INFINITY});return fromRlpCursor(Er,br)}function fromRlpCursor(fr,br="hex"){if(fr.bytes.length===0)return br==="hex"?bytesToHex$4(fr.bytes):fr.bytes;const wr=fr.readByte();if(wr<128&&fr.decrementPosition(1),wr<192){const kr=readLength(fr,wr,128),jr=fr.readBytes(kr);return br==="hex"?bytesToHex$4(jr):jr}const Er=readLength(fr,wr,192);return readList(fr,Er,br)}function readLength(fr,br,wr){if(wr===128&&br<128)return 1;if(br<=wr+55)return br-wr;if(br===wr+55+1)return fr.readUint8();if(br===wr+55+2)return fr.readUint16();if(br===wr+55+3)return fr.readUint24();if(br===wr+55+4)return fr.readUint32();throw new BaseError("Invalid RLP prefix")}function readList(fr,br,wr){const Er=fr.position,kr=[];for(;fr.position-Erbr)),Pi$1=Id$1.map(fr=>(9*fr+5)%16);let idxL$1=[Id$1],idxR$1=[Pi$1];for(let fr=0;fr<4;fr++)for(let br of[idxL$1,idxR$1])br.push(br[fr].map(wr=>Rho$1[wr]));const shifts$1=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(fr=>new Uint8Array(fr)),shiftsL$1=idxL$1.map((fr,br)=>fr.map(wr=>shifts$1[br][wr])),shiftsR$1=idxR$1.map((fr,br)=>fr.map(wr=>shifts$1[br][wr])),Kl$1=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Kr$1=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);function f$8(fr,br,wr,Er){return fr===0?br^wr^Er:fr===1?br&wr|~br&Er:fr===2?(br|~wr)^Er:fr===3?br&Er|wr&~Er:br^(wr|~Er)}const R_BUF$1=new Uint32Array(16);let RIPEMD160$1=class extends HashMD$2{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:br,h1:wr,h2:Er,h3:kr,h4:jr}=this;return[br,wr,Er,kr,jr]}set(br,wr,Er,kr,jr){this.h0=br|0,this.h1=wr|0,this.h2=Er|0,this.h3=kr|0,this.h4=jr|0}process(br,wr){for(let Qr=0;Qr<16;Qr++,wr+=4)R_BUF$1[Qr]=br.getUint32(wr,!0);let Er=this.h0|0,kr=Er,jr=this.h1|0,Br=jr,Wr=this.h2|0,qr=Wr,Gr=this.h3|0,Vr=Gr,Zr=this.h4|0,Jr=Zr;for(let Qr=0;Qr<5;Qr++){const _n=4-Qr,En=Kl$1[Qr],Cn=Kr$1[Qr],In=idxL$1[Qr],An=idxR$1[Qr],jn=shiftsL$1[Qr],eo=shiftsR$1[Qr];for(let ro=0;ro<16;ro++){const to=rotl$1(Er+f$8(Qr,jr,Wr,Gr)+R_BUF$1[In[ro]]+En,jn[ro])+Zr|0;Er=Zr,Zr=Gr,Gr=rotl$1(Wr,10)|0,Wr=jr,jr=to}for(let ro=0;ro<16;ro++){const to=rotl$1(kr+f$8(_n,Br,qr,Vr)+R_BUF$1[An[ro]]+Cn,eo[ro])+Jr|0;kr=Jr,Jr=Vr,Vr=rotl$1(qr,10)|0,qr=Br,Br=to}}this.set(this.h1+Wr+Vr|0,this.h2+Gr+Jr|0,this.h3+Zr+kr|0,this.h4+Er+Br|0,this.h0+jr+qr|0)}roundClean(){R_BUF$1.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}};const ripemd160$3=wrapConstructor$2(()=>new RIPEMD160$1);function ripemd160$2(fr,br){const wr=br||"hex",Er=ripemd160$3(isHex(fr,{strict:!1})?toBytes$3(fr):fr);return wr==="bytes"?Er:toHex(Er)}const presignMessagePrefix=`Ethereum Signed Message: `;function toPrefixedMessage(fr){const br=typeof fr=="string"?stringToHex(fr):typeof fr.raw=="string"?fr.raw:bytesToHex$4(fr.raw),wr=stringToHex(`${presignMessagePrefix}${size$1(br)}`);return concat$1([wr,br])}function hashMessage(fr,br){return keccak256(toPrefixedMessage(fr),br)}async function recoverMessageAddress({message:fr,signature:br}){return recoverAddress({hash:hashMessage(fr),signature:br})}async function recoverTypedDataAddress(fr){const{domain:br,message:wr,primaryType:Er,signature:kr,types:jr}=fr;return recoverAddress({hash:hashTypedData({domain:br,message:wr,primaryType:Er,types:jr}),signature:kr})}async function verifyHash$1({address:fr,hash:br,signature:wr}){return isAddressEqual(getAddress(fr),await recoverAddress({hash:br,signature:wr}))}async function verifyMessage$1({address:fr,message:br,signature:wr}){return isAddressEqual(getAddress(fr),await recoverMessageAddress({message:br,signature:wr}))}async function verifyTypedData$1(fr){const{address:br,domain:wr,message:Er,primaryType:kr,signature:jr,types:Br}=fr;return isAddressEqual(getAddress(br),await recoverTypedDataAddress({domain:wr,message:Er,primaryType:kr,signature:jr,types:Br}))}const erc6492MagicBytes="0x6492649264926492649264926492649264926492649264926492649264926492",zeroHash="0x0000000000000000000000000000000000000000000000000000000000000000";function isErc6492Signature(fr){return sliceHex(fr,-32)===erc6492MagicBytes}function parseErc6492Signature(fr){if(!isErc6492Signature(fr))return{signature:fr};const[br,wr,Er]=decodeAbiParameters([{type:"address"},{type:"bytes"},{type:"bytes"}],fr);return{address:br,data:wr,signature:Er}}function serializeErc6492Signature(fr){const{address:br,data:wr,signature:Er,to:kr="hex"}=fr,jr=concatHex([encodeAbiParameters([{type:"address"},{type:"bytes"},{type:"bytes"}],[br,wr,Er]),erc6492MagicBytes]);return kr==="hex"?jr:hexToBytes$4(jr)}function getSerializedTransactionType(fr){const br=sliceHex(fr,0,1);if(br==="0x04")return"eip7702";if(br==="0x03")return"eip4844";if(br==="0x02")return"eip1559";if(br==="0x01")return"eip2930";if(br!=="0x"&&hexToNumber$2(br)>=192)return"legacy";throw new InvalidSerializedTransactionTypeError({serializedType:br})}function assertTransactionEIP7702(fr){const{authorizationList:br}=fr;if(br)for(const wr of br){const{contractAddress:Er,chainId:kr}=wr;if(!isAddress(Er))throw new InvalidAddressError({address:Er});if(kr<0)throw new InvalidChainIdError({chainId:kr})}assertTransactionEIP1559(fr)}function assertTransactionEIP4844(fr){const{blobVersionedHashes:br}=fr;if(br){if(br.length===0)throw new EmptyBlobError;for(const wr of br){const Er=size$1(wr),kr=hexToNumber$2(slice(wr,0,1));if(Er!==32)throw new InvalidVersionedHashSizeError({hash:wr,size:Er});if(kr!==versionedHashVersionKzg)throw new InvalidVersionedHashVersionError({hash:wr,version:kr})}}assertTransactionEIP1559(fr)}function assertTransactionEIP1559(fr){const{chainId:br,maxPriorityFeePerGas:wr,maxFeePerGas:Er,to:kr}=fr;if(br<=0)throw new InvalidChainIdError({chainId:br});if(kr&&!isAddress(kr))throw new InvalidAddressError({address:kr});if(Er&&Er>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:Er});if(wr&&Er&&wr>Er)throw new TipAboveFeeCapError({maxFeePerGas:Er,maxPriorityFeePerGas:wr})}function assertTransactionEIP2930(fr){const{chainId:br,maxPriorityFeePerGas:wr,gasPrice:Er,maxFeePerGas:kr,to:jr}=fr;if(br<=0)throw new InvalidChainIdError({chainId:br});if(jr&&!isAddress(jr))throw new InvalidAddressError({address:jr});if(wr||kr)throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(Er&&Er>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:Er})}function assertTransactionLegacy(fr){const{chainId:br,maxPriorityFeePerGas:wr,gasPrice:Er,maxFeePerGas:kr,to:jr}=fr;if(jr&&!isAddress(jr))throw new InvalidAddressError({address:jr});if(typeof br<"u"&&br<=0)throw new InvalidChainIdError({chainId:br});if(wr||kr)throw new BaseError("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(Er&&Er>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:Er})}function parseTransaction(fr){const br=getSerializedTransactionType(fr);return br==="eip1559"?parseTransactionEIP1559(fr):br==="eip2930"?parseTransactionEIP2930(fr):br==="eip4844"?parseTransactionEIP4844(fr):br==="eip7702"?parseTransactionEIP7702(fr):parseTransactionLegacy(fr)}function parseTransactionEIP7702(fr){const br=toTransactionArray(fr),[wr,Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n]=br;if(br.length!==10&&br.length!==13)throw new InvalidSerializedTransactionError({attributes:{chainId:wr,nonce:Er,maxPriorityFeePerGas:kr,maxFeePerGas:jr,gas:Br,to:Wr,value:qr,data:Gr,accessList:Vr,authorizationList:Zr,...br.length>9?{v:Jr,r:Qr,s:_n}:{}},serializedTransaction:fr,type:"eip7702"});const En={chainId:hexToNumber$2(wr),type:"eip7702"};return isHex(Wr)&&Wr!=="0x"&&(En.to=Wr),isHex(Br)&&Br!=="0x"&&(En.gas=hexToBigInt(Br)),isHex(Gr)&&Gr!=="0x"&&(En.data=Gr),isHex(Er)&&Er!=="0x"&&(En.nonce=hexToNumber$2(Er)),isHex(qr)&&qr!=="0x"&&(En.value=hexToBigInt(qr)),isHex(jr)&&jr!=="0x"&&(En.maxFeePerGas=hexToBigInt(jr)),isHex(kr)&&kr!=="0x"&&(En.maxPriorityFeePerGas=hexToBigInt(kr)),Vr.length!==0&&Vr!=="0x"&&(En.accessList=parseAccessList(Vr)),Zr.length!==0&&Zr!=="0x"&&(En.authorizationList=parseAuthorizationList(Zr)),assertTransactionEIP7702(En),{...br.length===13?parseEIP155Signature(br):void 0,...En}}function parseTransactionEIP4844(fr){const br=toTransactionArray(fr),wr=br.length===4,Er=wr?br[0]:br,kr=wr?br.slice(1):[],[jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En,Cn,In,An]=Er,[jn,eo,ro]=kr;if(!(Er.length===11||Er.length===14))throw new InvalidSerializedTransactionError({attributes:{chainId:jr,nonce:Br,maxPriorityFeePerGas:Wr,maxFeePerGas:qr,gas:Gr,to:Vr,value:Zr,data:Jr,accessList:Qr,...Er.length>9?{v:Cn,r:In,s:An}:{}},serializedTransaction:fr,type:"eip4844"});const to={blobVersionedHashes:En,chainId:hexToNumber$2(jr),type:"eip4844"};return isHex(Vr)&&Vr!=="0x"&&(to.to=Vr),isHex(Gr)&&Gr!=="0x"&&(to.gas=hexToBigInt(Gr)),isHex(Jr)&&Jr!=="0x"&&(to.data=Jr),isHex(Br)&&Br!=="0x"&&(to.nonce=hexToNumber$2(Br)),isHex(Zr)&&Zr!=="0x"&&(to.value=hexToBigInt(Zr)),isHex(_n)&&_n!=="0x"&&(to.maxFeePerBlobGas=hexToBigInt(_n)),isHex(qr)&&qr!=="0x"&&(to.maxFeePerGas=hexToBigInt(qr)),isHex(Wr)&&Wr!=="0x"&&(to.maxPriorityFeePerGas=hexToBigInt(Wr)),Qr.length!==0&&Qr!=="0x"&&(to.accessList=parseAccessList(Qr)),jn&&eo&&ro&&(to.sidecars=toBlobSidecars({blobs:jn,commitments:eo,proofs:ro})),assertTransactionEIP4844(to),{...Er.length===14?parseEIP155Signature(Er):void 0,...to}}function parseTransactionEIP1559(fr){const br=toTransactionArray(fr),[wr,Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr]=br;if(!(br.length===9||br.length===12))throw new InvalidSerializedTransactionError({attributes:{chainId:wr,nonce:Er,maxPriorityFeePerGas:kr,maxFeePerGas:jr,gas:Br,to:Wr,value:qr,data:Gr,accessList:Vr,...br.length>9?{v:Zr,r:Jr,s:Qr}:{}},serializedTransaction:fr,type:"eip1559"});const _n={chainId:hexToNumber$2(wr),type:"eip1559"};return isHex(Wr)&&Wr!=="0x"&&(_n.to=Wr),isHex(Br)&&Br!=="0x"&&(_n.gas=hexToBigInt(Br)),isHex(Gr)&&Gr!=="0x"&&(_n.data=Gr),isHex(Er)&&Er!=="0x"&&(_n.nonce=hexToNumber$2(Er)),isHex(qr)&&qr!=="0x"&&(_n.value=hexToBigInt(qr)),isHex(jr)&&jr!=="0x"&&(_n.maxFeePerGas=hexToBigInt(jr)),isHex(kr)&&kr!=="0x"&&(_n.maxPriorityFeePerGas=hexToBigInt(kr)),Vr.length!==0&&Vr!=="0x"&&(_n.accessList=parseAccessList(Vr)),assertTransactionEIP1559(_n),{...br.length===12?parseEIP155Signature(br):void 0,..._n}}function parseTransactionEIP2930(fr){const br=toTransactionArray(fr),[wr,Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr,Jr]=br;if(!(br.length===8||br.length===11))throw new InvalidSerializedTransactionError({attributes:{chainId:wr,nonce:Er,gasPrice:kr,gas:jr,to:Br,value:Wr,data:qr,accessList:Gr,...br.length>8?{v:Vr,r:Zr,s:Jr}:{}},serializedTransaction:fr,type:"eip2930"});const Qr={chainId:hexToNumber$2(wr),type:"eip2930"};return isHex(Br)&&Br!=="0x"&&(Qr.to=Br),isHex(jr)&&jr!=="0x"&&(Qr.gas=hexToBigInt(jr)),isHex(qr)&&qr!=="0x"&&(Qr.data=qr),isHex(Er)&&Er!=="0x"&&(Qr.nonce=hexToNumber$2(Er)),isHex(Wr)&&Wr!=="0x"&&(Qr.value=hexToBigInt(Wr)),isHex(kr)&&kr!=="0x"&&(Qr.gasPrice=hexToBigInt(kr)),Gr.length!==0&&Gr!=="0x"&&(Qr.accessList=parseAccessList(Gr)),assertTransactionEIP2930(Qr),{...br.length===11?parseEIP155Signature(br):void 0,...Qr}}function parseTransactionLegacy(fr){const br=fromRlp(fr,"hex"),[wr,Er,kr,jr,Br,Wr,qr,Gr,Vr]=br;if(!(br.length===6||br.length===9))throw new InvalidSerializedTransactionError({attributes:{nonce:wr,gasPrice:Er,gas:kr,to:jr,value:Br,data:Wr,...br.length>6?{v:qr,r:Gr,s:Vr}:{}},serializedTransaction:fr,type:"legacy"});const Zr={type:"legacy"};if(isHex(jr)&&jr!=="0x"&&(Zr.to=jr),isHex(kr)&&kr!=="0x"&&(Zr.gas=hexToBigInt(kr)),isHex(Wr)&&Wr!=="0x"&&(Zr.data=Wr),isHex(wr)&&wr!=="0x"&&(Zr.nonce=hexToNumber$2(wr)),isHex(Br)&&Br!=="0x"&&(Zr.value=hexToBigInt(Br)),isHex(Er)&&Er!=="0x"&&(Zr.gasPrice=hexToBigInt(Er)),assertTransactionLegacy(Zr),br.length===6)return Zr;const Jr=isHex(qr)&&qr!=="0x"?hexToBigInt(qr):0n;if(Vr==="0x"&&Gr==="0x")return Jr>0&&(Zr.chainId=Number(Jr)),Zr;const Qr=Jr,_n=Number((Qr-35n)/2n);if(_n>0)Zr.chainId=_n;else if(Qr!==27n&&Qr!==28n)throw new InvalidLegacyVError({v:Qr});return Zr.v=Qr,Zr.s=Vr,Zr.r=Gr,Zr.yParity=Qr%2n===0n?1:0,Zr}function toTransactionArray(fr){return fromRlp(`0x${fr.slice(4)}`,"hex")}function parseAccessList(fr){const br=[];for(let wr=0;wrisHash(jr)?jr:trim(jr))})}return br}function parseAuthorizationList(fr){const br=[];for(let wr=0;wr"u"||typeof Qr>"u")){const jn=typeof fr.blobs[0]=="string"?fr.blobs:fr.blobs.map(to=>bytesToHex$4(to)),eo=fr.kzg,ro=blobsToCommitments({blobs:jn,kzg:eo});if(typeof Jr>"u"&&(Jr=commitmentsToVersionedHashes({commitments:ro})),typeof Qr>"u"){const to=blobsToProofs({blobs:jn,commitments:ro,kzg:eo});Qr=toBlobSidecars({blobs:jn,commitments:ro,proofs:to})}}const _n=serializeAccessList(Vr),En=[toHex(wr),kr?toHex(kr):"0x",Gr?toHex(Gr):"0x",qr?toHex(qr):"0x",Er?toHex(Er):"0x",jr??"0x",Br?toHex(Br):"0x",Zr??"0x",_n,Wr?toHex(Wr):"0x",Jr??[],...toYParitySignatureArray(fr,br)],Cn=[],In=[],An=[];if(Qr)for(let jn=0;jn{if(br.v>=35n)return(br.v-35n)/2n>0?br.v:27n+(br.v===35n?0n:1n);if(wr>0)return BigInt(wr*2)+BigInt(35n+br.v-27n);const Qr=27n+(br.v===27n?0n:1n);if(br.v!==Qr)throw new InvalidLegacyVError({v:br.v});return Qr})(),Zr=trim(br.r),Jr=trim(br.s);Gr=[...Gr,toHex(Vr),Zr==="0x00"?"0x":Zr,Jr==="0x00"?"0x":Jr]}else wr>0&&(Gr=[...Gr,toHex(wr),"0x","0x"]);return toRlp(Gr)}function toYParitySignatureArray(fr,br){const wr=br??fr,{v:Er,yParity:kr}=wr;if(typeof wr.r>"u")return[];if(typeof wr.s>"u")return[];if(typeof Er>"u"&&typeof kr>"u")return[];const jr=trim(wr.r),Br=trim(wr.s);return[typeof kr=="number"?kr?toHex(1):"0x":Er===0n?"0x":Er===1n?toHex(1):Er===27n?"0x":toHex(1),jr==="0x00"?"0x":jr,Br==="0x00"?"0x":Br]}class InvalidDecimalNumberError extends BaseError{constructor({value:br}){super(`Number \`${br}\` is not a valid decimal number.`,{name:"InvalidDecimalNumberError"})}}function parseUnits(fr,br){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(fr))throw new InvalidDecimalNumberError({value:fr});let[wr,Er="0"]=fr.split(".");const kr=wr.startsWith("-");if(kr&&(wr=wr.slice(1)),Er=Er.replace(/(0+)$/,""),br===0)Math.round(+`.${Er}`)===1&&(wr=`${BigInt(wr)+1n}`),Er="";else if(Er.length>br){const[jr,Br,Wr]=[Er.slice(0,br-1),Er.slice(br-1,br),Er.slice(br)],qr=Math.round(+`${Br}.${Wr}`);qr>9?Er=`${BigInt(jr)+BigInt(1)}0`.padStart(jr.length+1,"0"):Er=`${jr}${qr}`,Er.length>br&&(Er=Er.slice(1),wr=`${BigInt(wr)+1n}`),Er=Er.slice(0,br)}else Er=Er.padEnd(br,"0");return BigInt(`${kr?"-":""}${wr}${Er}`)}function parseEther$1(fr,br="wei"){return parseUnits(fr,etherUnits[br])}function parseGwei(fr,br="wei"){return parseUnits(fr,gweiUnits[br])}function createNonceManager(fr){const{source:br}=fr,wr=new Map,Er=new LruMap(8192),kr=new Map,jr=({address:Br,chainId:Wr})=>`${Br}.${Wr}`;return{async consume({address:Br,chainId:Wr,client:qr}){const Gr=jr({address:Br,chainId:Wr}),Vr=this.get({address:Br,chainId:Wr,client:qr});this.increment({address:Br,chainId:Wr});const Zr=await Vr;return await br.set({address:Br,chainId:Wr},Zr),Er.set(Gr,Zr),Zr},async increment({address:Br,chainId:Wr}){const qr=jr({address:Br,chainId:Wr}),Gr=wr.get(qr)??0;wr.set(qr,Gr+1)},async get({address:Br,chainId:Wr,client:qr}){const Gr=jr({address:Br,chainId:Wr});let Vr=kr.get(Gr);return Vr||(Vr=(async()=>{try{const Jr=await br.get({address:Br,chainId:Wr,client:qr}),Qr=Er.get(Gr)??0;return Qr>0&&Jr<=Qr?Qr+1:(Er.delete(Gr),Jr)}finally{this.reset({address:Br,chainId:Wr})}})(),kr.set(Gr,Vr)),(wr.get(Gr)??0)+await Vr},reset({address:Br,chainId:Wr}){const qr=jr({address:Br,chainId:Wr});wr.delete(qr),kr.delete(qr)}}}function jsonRpc(){return{async get(fr){const{address:br,client:wr}=fr;return getTransactionCount(wr,{address:br,blockTag:"pending"})},set(){}}}const nonceManager=createNonceManager({source:jsonRpc()});function formatStorageProof(fr){return fr.map(br=>({...br,value:BigInt(br.value)}))}function formatProof(fr){return{...fr,balance:fr.balance?BigInt(fr.balance):void 0,nonce:fr.nonce?hexToNumber$2(fr.nonce):void 0,storageProof:fr.storageProof?formatStorageProof(fr.storageProof):void 0}}async function getProof(fr,{address:br,blockNumber:wr,blockTag:Er,storageKeys:kr}){const jr=Er??"latest",Br=wr!==void 0?numberToHex(wr):void 0,Wr=await fr.request({method:"eth_getProof",params:[br,kr,Br||jr]});return formatProof(Wr)}async function getStorageAt(fr,{address:br,blockNumber:wr,blockTag:Er="latest",slot:kr}){const jr=wr!==void 0?numberToHex(wr):void 0;return await fr.request({method:"eth_getStorageAt",params:[br,kr,jr||Er]})}async function getTransaction(fr,{blockHash:br,blockNumber:wr,blockTag:Er,hash:kr,index:jr}){var Vr,Zr,Jr;const Br=Er||"latest",Wr=wr!==void 0?numberToHex(wr):void 0;let qr=null;if(kr?qr=await fr.request({method:"eth_getTransactionByHash",params:[kr]},{dedupe:!0}):br?qr=await fr.request({method:"eth_getTransactionByBlockHashAndIndex",params:[br,numberToHex(jr)]},{dedupe:!0}):(Wr||Br)&&(qr=await fr.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[Wr||Br,numberToHex(jr)]},{dedupe:!!Wr})),!qr)throw new TransactionNotFoundError({blockHash:br,blockNumber:wr,blockTag:Br,hash:kr,index:jr});return(((Jr=(Zr=(Vr=fr.chain)==null?void 0:Vr.formatters)==null?void 0:Zr.transaction)==null?void 0:Jr.format)||formatTransaction)(qr)}async function getTransactionConfirmations(fr,{hash:br,transactionReceipt:wr}){const[Er,kr]=await Promise.all([getAction(fr,getBlockNumber,"getBlockNumber")({}),br?getAction(fr,getTransaction,"getTransaction")({hash:br}):void 0]),jr=(wr==null?void 0:wr.blockNumber)||(kr==null?void 0:kr.blockNumber);return jr?Er-jr+1n:0n}async function getTransactionReceipt(fr,{hash:br}){var kr,jr,Br;const wr=await fr.request({method:"eth_getTransactionReceipt",params:[br]},{dedupe:!0});if(!wr)throw new TransactionReceiptNotFoundError({hash:br});return(((Br=(jr=(kr=fr.chain)==null?void 0:kr.formatters)==null?void 0:jr.transactionReceipt)==null?void 0:Br.format)||formatTransactionReceipt)(wr)}async function multicall(fr,br){var Cn;const{allowFailure:wr=!0,batchSize:Er,blockNumber:kr,blockTag:jr,multicallAddress:Br,stateOverride:Wr}=br,qr=br.contracts,Gr=Er??(typeof((Cn=fr.batch)==null?void 0:Cn.multicall)=="object"&&fr.batch.multicall.batchSize||1024);let Vr=Br;if(!Vr){if(!fr.chain)throw new Error("client chain not configured. multicallAddress is required.");Vr=getChainContractAddress({blockNumber:kr,chain:fr.chain,contract:"multicall3"})}const Zr=[[]];let Jr=0,Qr=0;for(let In=0;In0&&Qr>Gr&&Zr[Jr].length>0&&(Jr++,Qr=(to.length-2)/2,Zr[Jr]=[]),Zr[Jr]=[...Zr[Jr],{allowFailure:!0,callData:to,target:jn}]}catch(to){const _i=getContractError(to,{abi:An,address:jn,args:eo,docsPath:"/docs/contract/multicall",functionName:ro});if(!wr)throw _i;Zr[Jr]=[...Zr[Jr],{allowFailure:!0,callData:"0x",target:jn}]}}const _n=await Promise.allSettled(Zr.map(In=>getAction(fr,readContract,"readContract")({abi:multicall3Abi,address:Vr,args:[In],blockNumber:kr,blockTag:jr,functionName:"aggregate3",stateOverride:Wr}))),En=[];for(let In=0;In<_n.length;In++){const An=_n[In];if(An.status==="rejected"){if(!wr)throw An.reason;for(let eo=0;eokr?br.create().update(Er).digest():Er);for(let Br=0;Brnew HMAC$3(fr,br).update(wr).digest();hmac$5.create=(fr,br)=>new HMAC$3(fr,br);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$8=BigInt(0),_1n$b=BigInt(1),_2n$7=BigInt(2);function isBytes$7(fr){return fr instanceof Uint8Array||fr!=null&&typeof fr=="object"&&fr.constructor.name==="Uint8Array"}function abytes$3(fr){if(!isBytes$7(fr))throw new Error("Uint8Array expected")}function abool$1(fr,br){if(typeof br!="boolean")throw new Error(`${fr} must be valid boolean, got "${br}".`)}const hexes$2=Array.from({length:256},(fr,br)=>br.toString(16).padStart(2,"0"));function bytesToHex$2(fr){abytes$3(fr);let br="";for(let wr=0;wr=asciis$2._0&&fr<=asciis$2._9)return fr-asciis$2._0;if(fr>=asciis$2._A&&fr<=asciis$2._F)return fr-(asciis$2._A-10);if(fr>=asciis$2._a&&fr<=asciis$2._f)return fr-(asciis$2._a-10)}function hexToBytes$2(fr){if(typeof fr!="string")throw new Error("hex string expected, got "+typeof fr);const br=fr.length,wr=br/2;if(br%2)throw new Error("padded hex string expected, got unpadded hex of length "+br);const Er=new Uint8Array(wr);for(let kr=0,jr=0;krtypeof fr=="bigint"&&_0n$8<=fr;function inRange$2(fr,br,wr){return isPosBig$1(fr)&&isPosBig$1(br)&&isPosBig$1(wr)&&br<=fr&&fr_0n$8;fr>>=_1n$b,br+=1);return br}function bitGet$1(fr,br){return fr>>BigInt(br)&_1n$b}function bitSet$1(fr,br,wr){return fr|(wr?_1n$b:_0n$8)<(_2n$7<new Uint8Array(fr),u8fr$1=fr=>Uint8Array.from(fr);function createHmacDrbg$1(fr,br,wr){if(typeof fr!="number"||fr<2)throw new Error("hashLen must be a number");if(typeof br!="number"||br<2)throw new Error("qByteLen must be a number");if(typeof wr!="function")throw new Error("hmacFn must be a function");let Er=u8n$1(fr),kr=u8n$1(fr),jr=0;const Br=()=>{Er.fill(1),kr.fill(0),jr=0},Wr=(...Zr)=>wr(kr,Er,...Zr),qr=(Zr=u8n$1())=>{kr=Wr(u8fr$1([0]),Zr),Er=Wr(),Zr.length!==0&&(kr=Wr(u8fr$1([1]),Zr),Er=Wr())},Gr=()=>{if(jr++>=1e3)throw new Error("drbg: tried 1000 values");let Zr=0;const Jr=[];for(;Zr{Br(),qr(Zr);let Qr;for(;!(Qr=Jr(Gr()));)qr();return Br(),Qr}}const validatorFns$1={bigint:fr=>typeof fr=="bigint",function:fr=>typeof fr=="function",boolean:fr=>typeof fr=="boolean",string:fr=>typeof fr=="string",stringOrUint8Array:fr=>typeof fr=="string"||isBytes$7(fr),isSafeInteger:fr=>Number.isSafeInteger(fr),array:fr=>Array.isArray(fr),field:(fr,br)=>br.Fp.isValid(fr),hash:fr=>typeof fr=="function"&&Number.isSafeInteger(fr.outputLen)};function validateObject$1(fr,br,wr={}){const Er=(kr,jr,Br)=>{const Wr=validatorFns$1[jr];if(typeof Wr!="function")throw new Error(`Invalid validator "${jr}", expected function`);const qr=fr[kr];if(!(Br&&qr===void 0)&&!Wr(qr,fr))throw new Error(`Invalid param ${String(kr)}=${qr} (${typeof qr}), expected ${jr}`)};for(const[kr,jr]of Object.entries(br))Er(kr,jr,!1);for(const[kr,jr]of Object.entries(wr))Er(kr,jr,!0);return fr}const notImplemented$1=()=>{throw new Error("not implemented")};function memoized$1(fr){const br=new WeakMap;return(wr,...Er)=>{const kr=br.get(wr);if(kr!==void 0)return kr;const jr=fr(wr,...Er);return br.set(wr,jr),jr}}const ut$3=Object.freeze(Object.defineProperty({__proto__:null,aInRange:aInRange$1,abool:abool$1,abytes:abytes$3,bitGet:bitGet$1,bitLen:bitLen$1,bitMask:bitMask$1,bitSet:bitSet$1,bytesToHex:bytesToHex$2,bytesToNumberBE:bytesToNumberBE$1,bytesToNumberLE:bytesToNumberLE$1,concatBytes:concatBytes$3,createHmacDrbg:createHmacDrbg$1,ensureBytes:ensureBytes$1,equalBytes:equalBytes$1,hexToBytes:hexToBytes$2,hexToNumber:hexToNumber$1,inRange:inRange$2,isBytes:isBytes$7,memoized:memoized$1,notImplemented:notImplemented$1,numberToBytesBE:numberToBytesBE$1,numberToBytesLE:numberToBytesLE$1,numberToHexUnpadded:numberToHexUnpadded$1,numberToVarBytesBE:numberToVarBytesBE$1,utf8ToBytes:utf8ToBytes$3,validateObject:validateObject$1},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$7=BigInt(0),_1n$a=BigInt(1),_2n$6=BigInt(2),_3n$3=BigInt(3),_4n$1=BigInt(4),_5n$2=BigInt(5),_8n$3=BigInt(8);BigInt(9);BigInt(16);function mod$1(fr,br){const wr=fr%br;return wr>=_0n$7?wr:br+wr}function pow$1(fr,br,wr){if(wr<=_0n$7||br<_0n$7)throw new Error("Expected power/modulo > 0");if(wr===_1n$a)return _0n$7;let Er=_1n$a;for(;br>_0n$7;)br&_1n$a&&(Er=Er*fr%wr),fr=fr*fr%wr,br>>=_1n$a;return Er}function pow2$1(fr,br,wr){let Er=fr;for(;br-- >_0n$7;)Er*=Er,Er%=wr;return Er}function invert$1(fr,br){if(fr===_0n$7||br<=_0n$7)throw new Error(`invert: expected positive integers, got n=${fr} mod=${br}`);let wr=mod$1(fr,br),Er=br,kr=_0n$7,jr=_1n$a;for(;wr!==_0n$7;){const Wr=Er/wr,qr=Er%wr,Gr=kr-jr*Wr;Er=wr,wr=qr,kr=jr,jr=Gr}if(Er!==_1n$a)throw new Error("invert: does not exist");return mod$1(kr,br)}function tonelliShanks$1(fr){const br=(fr-_1n$a)/_2n$6;let wr,Er,kr;for(wr=fr-_1n$a,Er=0;wr%_2n$6===_0n$7;wr/=_2n$6,Er++);for(kr=_2n$6;kr(Er[kr]="function",Er),br);return validateObject$1(fr,wr)}function FpPow$1(fr,br,wr){if(wr<_0n$7)throw new Error("Expected power > 0");if(wr===_0n$7)return fr.ONE;if(wr===_1n$a)return br;let Er=fr.ONE,kr=br;for(;wr>_0n$7;)wr&_1n$a&&(Er=fr.mul(Er,kr)),kr=fr.sqr(kr),wr>>=_1n$a;return Er}function FpInvertBatch$1(fr,br){const wr=new Array(br.length),Er=br.reduce((jr,Br,Wr)=>fr.is0(Br)?jr:(wr[Wr]=jr,fr.mul(jr,Br)),fr.ONE),kr=fr.inv(Er);return br.reduceRight((jr,Br,Wr)=>fr.is0(Br)?jr:(wr[Wr]=fr.mul(jr,wr[Wr]),fr.mul(jr,Br)),kr),wr}function nLength$1(fr,br){const wr=br!==void 0?br:fr.toString(2).length,Er=Math.ceil(wr/8);return{nBitLength:wr,nByteLength:Er}}function Field$1(fr,br,wr=!1,Er={}){if(fr<=_0n$7)throw new Error(`Expected Field ORDER > 0, got ${fr}`);const{nBitLength:kr,nByteLength:jr}=nLength$1(fr,br);if(jr>2048)throw new Error("Field lengths over 2048 bytes are not supported");const Br=FpSqrt$1(fr),Wr=Object.freeze({ORDER:fr,BITS:kr,BYTES:jr,MASK:bitMask$1(kr),ZERO:_0n$7,ONE:_1n$a,create:qr=>mod$1(qr,fr),isValid:qr=>{if(typeof qr!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof qr}`);return _0n$7<=qr&&qrqr===_0n$7,isOdd:qr=>(qr&_1n$a)===_1n$a,neg:qr=>mod$1(-qr,fr),eql:(qr,Gr)=>qr===Gr,sqr:qr=>mod$1(qr*qr,fr),add:(qr,Gr)=>mod$1(qr+Gr,fr),sub:(qr,Gr)=>mod$1(qr-Gr,fr),mul:(qr,Gr)=>mod$1(qr*Gr,fr),pow:(qr,Gr)=>FpPow$1(Wr,qr,Gr),div:(qr,Gr)=>mod$1(qr*invert$1(Gr,fr),fr),sqrN:qr=>qr*qr,addN:(qr,Gr)=>qr+Gr,subN:(qr,Gr)=>qr-Gr,mulN:(qr,Gr)=>qr*Gr,inv:qr=>invert$1(qr,fr),sqrt:Er.sqrt||(qr=>Br(Wr,qr)),invertBatch:qr=>FpInvertBatch$1(Wr,qr),cmov:(qr,Gr,Vr)=>Vr?Gr:qr,toBytes:qr=>wr?numberToBytesLE$1(qr,jr):numberToBytesBE$1(qr,jr),fromBytes:qr=>{if(qr.length!==jr)throw new Error(`Fp.fromBytes: expected ${jr}, got ${qr.length}`);return wr?bytesToNumberLE$1(qr):bytesToNumberBE$1(qr)}});return Object.freeze(Wr)}function getFieldBytesLength$1(fr){if(typeof fr!="bigint")throw new Error("field order must be bigint");const br=fr.toString(2).length;return Math.ceil(br/8)}function getMinHashLength$1(fr){const br=getFieldBytesLength$1(fr);return br+Math.ceil(br/2)}function mapHashToField$1(fr,br,wr=!1){const Er=fr.length,kr=getFieldBytesLength$1(br),jr=getMinHashLength$1(br);if(Er<16||Er1024)throw new Error(`expected ${jr}-1024 bytes of input, got ${Er}`);const Br=wr?bytesToNumberBE$1(fr):bytesToNumberLE$1(fr),Wr=mod$1(Br,br-_1n$a)+_1n$a;return wr?numberToBytesLE$1(Wr,kr):numberToBytesBE$1(Wr,kr)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$6=BigInt(0),_1n$9=BigInt(1),pointPrecomputes$1=new WeakMap,pointWindowSizes$1=new WeakMap;function wNAF$1(fr,br){const wr=(jr,Br)=>{const Wr=Br.negate();return jr?Wr:Br},Er=jr=>{if(!Number.isSafeInteger(jr)||jr<=0||jr>br)throw new Error(`Wrong window size=${jr}, should be [1..${br}]`)},kr=jr=>{Er(jr);const Br=Math.ceil(br/jr)+1,Wr=2**(jr-1);return{windows:Br,windowSize:Wr}};return{constTimeNegate:wr,unsafeLadder(jr,Br){let Wr=fr.ZERO,qr=jr;for(;Br>_0n$6;)Br&_1n$9&&(Wr=Wr.add(qr)),qr=qr.double(),Br>>=_1n$9;return Wr},precomputeWindow(jr,Br){const{windows:Wr,windowSize:qr}=kr(Br),Gr=[];let Vr=jr,Zr=Vr;for(let Jr=0;Jr>=_n,In>Gr&&(In-=Qr,Wr+=_1n$9);const An=Cn,jn=Cn+Math.abs(In)-1,eo=En%2!==0,ro=In<0;In===0?Zr=Zr.add(wr(eo,Br[An])):Vr=Vr.add(wr(ro,Br[jn]))}return{p:Vr,f:Zr}},wNAFCached(jr,Br,Wr){const qr=pointWindowSizes$1.get(jr)||1;let Gr=pointPrecomputes$1.get(jr);return Gr||(Gr=this.precomputeWindow(jr,qr),qr!==1&&pointPrecomputes$1.set(jr,Wr(Gr))),this.wNAF(qr,Gr,Br)},setWindowSize(jr,Br){Er(Br),pointWindowSizes$1.set(jr,Br),pointPrecomputes$1.delete(jr)}}}function pippenger$1(fr,br,wr,Er){if(!Array.isArray(wr)||!Array.isArray(Er)||Er.length!==wr.length)throw new Error("arrays of points and scalars must have equal length");Er.forEach((Vr,Zr)=>{if(!br.isValid(Vr))throw new Error(`wrong scalar at index ${Zr}`)}),wr.forEach((Vr,Zr)=>{if(!(Vr instanceof fr))throw new Error(`wrong point at index ${Zr}`)});const kr=bitLen$1(BigInt(wr.length)),jr=kr>12?kr-3:kr>4?kr-2:kr?2:1,Br=(1<=0;Vr-=jr){Wr.fill(fr.ZERO);for(let Jr=0;Jr>BigInt(Vr)&BigInt(Br));Wr[_n]=Wr[_n].add(wr[Jr])}let Zr=fr.ZERO;for(let Jr=Wr.length-1,Qr=fr.ZERO;Jr>0;Jr--)Qr=Qr.add(Wr[Jr]),Zr=Zr.add(Qr);if(Gr=Gr.add(Zr),Vr!==0)for(let Jr=0;Jr{const{Err:wr}=DER$1;if(fr<0||fr>256)throw new wr("tlv.encode: wrong tag");if(br.length&1)throw new wr("tlv.encode: unpadded data");const Er=br.length/2,kr=numberToHexUnpadded$1(Er);if(kr.length/2&128)throw new wr("tlv.encode: long form length too big");const jr=Er>127?numberToHexUnpadded$1(kr.length/2|128):"";return`${numberToHexUnpadded$1(fr)}${jr}${kr}${br}`},decode(fr,br){const{Err:wr}=DER$1;let Er=0;if(fr<0||fr>256)throw new wr("tlv.encode: wrong tag");if(br.length<2||br[Er++]!==fr)throw new wr("tlv.decode: wrong tlv");const kr=br[Er++],jr=!!(kr&128);let Br=0;if(!jr)Br=kr;else{const qr=kr&127;if(!qr)throw new wr("tlv.decode(long): indefinite length not supported");if(qr>4)throw new wr("tlv.decode(long): byte length is too big");const Gr=br.subarray(Er,Er+qr);if(Gr.length!==qr)throw new wr("tlv.decode: length bytes not complete");if(Gr[0]===0)throw new wr("tlv.decode(long): zero leftmost byte");for(const Vr of Gr)Br=Br<<8|Vr;if(Er+=qr,Br<128)throw new wr("tlv.decode(long): not minimal encoding")}const Wr=br.subarray(Er,Er+Br);if(Wr.length!==Br)throw new wr("tlv.decode: wrong value length");return{v:Wr,l:br.subarray(Er+Br)}}},_int:{encode(fr){const{Err:br}=DER$1;if(fr<_0n$5)throw new br("integer: negative integers are not allowed");let wr=numberToHexUnpadded$1(fr);if(Number.parseInt(wr[0],16)&8&&(wr="00"+wr),wr.length&1)throw new br("unexpected assertion");return wr},decode(fr){const{Err:br}=DER$1;if(fr[0]&128)throw new br("Invalid signature integer: negative");if(fr[0]===0&&!(fr[1]&128))throw new br("Invalid signature integer: unnecessary leading zero");return b2n$1(fr)}},toSig(fr){const{Err:br,_int:wr,_tlv:Er}=DER$1,kr=typeof fr=="string"?h2b$1(fr):fr;abytes$3(kr);const{v:jr,l:Br}=Er.decode(48,kr);if(Br.length)throw new br("Invalid signature: left bytes after parsing");const{v:Wr,l:qr}=Er.decode(2,jr),{v:Gr,l:Vr}=Er.decode(2,qr);if(Vr.length)throw new br("Invalid signature: left bytes after parsing");return{r:wr.decode(Wr),s:wr.decode(Gr)}},hexFromSig(fr){const{_tlv:br,_int:wr}=DER$1,Er=`${br.encode(2,wr.encode(fr.r))}${br.encode(2,wr.encode(fr.s))}`;return br.encode(48,Er)}},_0n$5=BigInt(0),_1n$8=BigInt(1);BigInt(2);const _3n$2=BigInt(3);BigInt(4);function weierstrassPoints$1(fr){const br=validatePointOpts$1(fr),{Fp:wr}=br,Er=Field$1(br.n,br.nBitLength),kr=br.toBytes||((En,Cn,In)=>{const An=Cn.toAffine();return concatBytes$3(Uint8Array.from([4]),wr.toBytes(An.x),wr.toBytes(An.y))}),jr=br.fromBytes||(En=>{const Cn=En.subarray(1),In=wr.fromBytes(Cn.subarray(0,wr.BYTES)),An=wr.fromBytes(Cn.subarray(wr.BYTES,2*wr.BYTES));return{x:In,y:An}});function Br(En){const{a:Cn,b:In}=br,An=wr.sqr(En),jn=wr.mul(An,En);return wr.add(wr.add(jn,wr.mul(En,Cn)),In)}if(!wr.eql(wr.sqr(br.Gy),Br(br.Gx)))throw new Error("bad generator point: equation left != right");function Wr(En){return inRange$2(En,_1n$8,br.n)}function qr(En){const{allowedPrivateKeyLengths:Cn,nByteLength:In,wrapPrivateKey:An,n:jn}=br;if(Cn&&typeof En!="bigint"){if(isBytes$7(En)&&(En=bytesToHex$2(En)),typeof En!="string"||!Cn.includes(En.length))throw new Error("Invalid key");En=En.padStart(In*2,"0")}let eo;try{eo=typeof En=="bigint"?En:bytesToNumberBE$1(ensureBytes$1("private key",En,In))}catch{throw new Error(`private key must be ${In} bytes, hex or bigint, not ${typeof En}`)}return An&&(eo=mod$1(eo,jn)),aInRange$1("private key",eo,_1n$8,jn),eo}function Gr(En){if(!(En instanceof Jr))throw new Error("ProjectivePoint expected")}const Vr=memoized$1((En,Cn)=>{const{px:In,py:An,pz:jn}=En;if(wr.eql(jn,wr.ONE))return{x:In,y:An};const eo=En.is0();Cn==null&&(Cn=eo?wr.ONE:wr.inv(jn));const ro=wr.mul(In,Cn),to=wr.mul(An,Cn),_i=wr.mul(jn,Cn);if(eo)return{x:wr.ZERO,y:wr.ZERO};if(!wr.eql(_i,wr.ONE))throw new Error("invZ was invalid");return{x:ro,y:to}}),Zr=memoized$1(En=>{if(En.is0()){if(br.allowInfinityPoint&&!wr.is0(En.py))return;throw new Error("bad point: ZERO")}const{x:Cn,y:In}=En.toAffine();if(!wr.isValid(Cn)||!wr.isValid(In))throw new Error("bad point: x or y not FE");const An=wr.sqr(In),jn=Br(Cn);if(!wr.eql(An,jn))throw new Error("bad point: equation left != right");if(!En.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class Jr{constructor(Cn,In,An){if(this.px=Cn,this.py=In,this.pz=An,Cn==null||!wr.isValid(Cn))throw new Error("x required");if(In==null||!wr.isValid(In))throw new Error("y required");if(An==null||!wr.isValid(An))throw new Error("z required");Object.freeze(this)}static fromAffine(Cn){const{x:In,y:An}=Cn||{};if(!Cn||!wr.isValid(In)||!wr.isValid(An))throw new Error("invalid affine point");if(Cn instanceof Jr)throw new Error("projective point not allowed");const jn=eo=>wr.eql(eo,wr.ZERO);return jn(In)&&jn(An)?Jr.ZERO:new Jr(In,An,wr.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(Cn){const In=wr.invertBatch(Cn.map(An=>An.pz));return Cn.map((An,jn)=>An.toAffine(In[jn])).map(Jr.fromAffine)}static fromHex(Cn){const In=Jr.fromAffine(jr(ensureBytes$1("pointHex",Cn)));return In.assertValidity(),In}static fromPrivateKey(Cn){return Jr.BASE.multiply(qr(Cn))}static msm(Cn,In){return pippenger$1(Jr,Er,Cn,In)}_setWindowSize(Cn){_n.setWindowSize(this,Cn)}assertValidity(){Zr(this)}hasEvenY(){const{y:Cn}=this.toAffine();if(wr.isOdd)return!wr.isOdd(Cn);throw new Error("Field doesn't support isOdd")}equals(Cn){Gr(Cn);const{px:In,py:An,pz:jn}=this,{px:eo,py:ro,pz:to}=Cn,_i=wr.eql(wr.mul(In,to),wr.mul(eo,jn)),oo=wr.eql(wr.mul(An,to),wr.mul(ro,jn));return _i&&oo}negate(){return new Jr(this.px,wr.neg(this.py),this.pz)}double(){const{a:Cn,b:In}=br,An=wr.mul(In,_3n$2),{px:jn,py:eo,pz:ro}=this;let to=wr.ZERO,_i=wr.ZERO,oo=wr.ZERO,io=wr.mul(jn,jn),co=wr.mul(eo,eo),so=wr.mul(ro,ro),no=wr.mul(jn,eo);return no=wr.add(no,no),oo=wr.mul(jn,ro),oo=wr.add(oo,oo),to=wr.mul(Cn,oo),_i=wr.mul(An,so),_i=wr.add(to,_i),to=wr.sub(co,_i),_i=wr.add(co,_i),_i=wr.mul(to,_i),to=wr.mul(no,to),oo=wr.mul(An,oo),so=wr.mul(Cn,so),no=wr.sub(io,so),no=wr.mul(Cn,no),no=wr.add(no,oo),oo=wr.add(io,io),io=wr.add(oo,io),io=wr.add(io,so),io=wr.mul(io,no),_i=wr.add(_i,io),so=wr.mul(eo,ro),so=wr.add(so,so),io=wr.mul(so,no),to=wr.sub(to,io),oo=wr.mul(so,co),oo=wr.add(oo,oo),oo=wr.add(oo,oo),new Jr(to,_i,oo)}add(Cn){Gr(Cn);const{px:In,py:An,pz:jn}=this,{px:eo,py:ro,pz:to}=Cn;let _i=wr.ZERO,oo=wr.ZERO,io=wr.ZERO;const co=br.a,so=wr.mul(br.b,_3n$2);let no=wr.mul(In,eo),Tn=wr.mul(An,ro),Hr=wr.mul(jn,to),Xr=wr.add(In,An),Sn=wr.add(eo,ro);Xr=wr.mul(Xr,Sn),Sn=wr.add(no,Tn),Xr=wr.sub(Xr,Sn),Sn=wr.add(In,jn);let Rn=wr.add(eo,to);return Sn=wr.mul(Sn,Rn),Rn=wr.add(no,Hr),Sn=wr.sub(Sn,Rn),Rn=wr.add(An,jn),_i=wr.add(ro,to),Rn=wr.mul(Rn,_i),_i=wr.add(Tn,Hr),Rn=wr.sub(Rn,_i),io=wr.mul(co,Sn),_i=wr.mul(so,Hr),io=wr.add(_i,io),_i=wr.sub(Tn,io),io=wr.add(Tn,io),oo=wr.mul(_i,io),Tn=wr.add(no,no),Tn=wr.add(Tn,no),Hr=wr.mul(co,Hr),Sn=wr.mul(so,Sn),Tn=wr.add(Tn,Hr),Hr=wr.sub(no,Hr),Hr=wr.mul(co,Hr),Sn=wr.add(Sn,Hr),no=wr.mul(Tn,Sn),oo=wr.add(oo,no),no=wr.mul(Rn,Sn),_i=wr.mul(Xr,_i),_i=wr.sub(_i,no),no=wr.mul(Xr,Tn),io=wr.mul(Rn,io),io=wr.add(io,no),new Jr(_i,oo,io)}subtract(Cn){return this.add(Cn.negate())}is0(){return this.equals(Jr.ZERO)}wNAF(Cn){return _n.wNAFCached(this,Cn,Jr.normalizeZ)}multiplyUnsafe(Cn){aInRange$1("scalar",Cn,_0n$5,br.n);const In=Jr.ZERO;if(Cn===_0n$5)return In;if(Cn===_1n$8)return this;const{endo:An}=br;if(!An)return _n.unsafeLadder(this,Cn);let{k1neg:jn,k1:eo,k2neg:ro,k2:to}=An.splitScalar(Cn),_i=In,oo=In,io=this;for(;eo>_0n$5||to>_0n$5;)eo&_1n$8&&(_i=_i.add(io)),to&_1n$8&&(oo=oo.add(io)),io=io.double(),eo>>=_1n$8,to>>=_1n$8;return jn&&(_i=_i.negate()),ro&&(oo=oo.negate()),oo=new Jr(wr.mul(oo.px,An.beta),oo.py,oo.pz),_i.add(oo)}multiply(Cn){const{endo:In,n:An}=br;aInRange$1("scalar",Cn,_1n$8,An);let jn,eo;if(In){const{k1neg:ro,k1:to,k2neg:_i,k2:oo}=In.splitScalar(Cn);let{p:io,f:co}=this.wNAF(to),{p:so,f:no}=this.wNAF(oo);io=_n.constTimeNegate(ro,io),so=_n.constTimeNegate(_i,so),so=new Jr(wr.mul(so.px,In.beta),so.py,so.pz),jn=io.add(so),eo=co.add(no)}else{const{p:ro,f:to}=this.wNAF(Cn);jn=ro,eo=to}return Jr.normalizeZ([jn,eo])[0]}multiplyAndAddUnsafe(Cn,In,An){const jn=Jr.BASE,eo=(to,_i)=>_i===_0n$5||_i===_1n$8||!to.equals(jn)?to.multiplyUnsafe(_i):to.multiply(_i),ro=eo(this,In).add(eo(Cn,An));return ro.is0()?void 0:ro}toAffine(Cn){return Vr(this,Cn)}isTorsionFree(){const{h:Cn,isTorsionFree:In}=br;if(Cn===_1n$8)return!0;if(In)return In(Jr,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:Cn,clearCofactor:In}=br;return Cn===_1n$8?this:In?In(Jr,this):this.multiplyUnsafe(br.h)}toRawBytes(Cn=!0){return abool$1("isCompressed",Cn),this.assertValidity(),kr(Jr,this,Cn)}toHex(Cn=!0){return abool$1("isCompressed",Cn),bytesToHex$2(this.toRawBytes(Cn))}}Jr.BASE=new Jr(br.Gx,br.Gy,wr.ONE),Jr.ZERO=new Jr(wr.ZERO,wr.ONE,wr.ZERO);const Qr=br.nBitLength,_n=wNAF$1(Jr,br.endo?Math.ceil(Qr/2):Qr);return{CURVE:br,ProjectivePoint:Jr,normPrivateKeyToScalar:qr,weierstrassEquation:Br,isWithinCurveOrder:Wr}}function validateOpts$2(fr){const br=validateBasic$1(fr);return validateObject$1(br,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...br})}function weierstrass$1(fr){const br=validateOpts$2(fr),{Fp:wr,n:Er}=br,kr=wr.BYTES+1,jr=2*wr.BYTES+1;function Br(Hr){return mod$1(Hr,Er)}function Wr(Hr){return invert$1(Hr,Er)}const{ProjectivePoint:qr,normPrivateKeyToScalar:Gr,weierstrassEquation:Vr,isWithinCurveOrder:Zr}=weierstrassPoints$1({...br,toBytes(Hr,Xr,Sn){const Rn=Xr.toAffine(),Pn=wr.toBytes(Rn.x),On=concatBytes$3;return abool$1("isCompressed",Sn),Sn?On(Uint8Array.from([Xr.hasEvenY()?2:3]),Pn):On(Uint8Array.from([4]),Pn,wr.toBytes(Rn.y))},fromBytes(Hr){const Xr=Hr.length,Sn=Hr[0],Rn=Hr.subarray(1);if(Xr===kr&&(Sn===2||Sn===3)){const Pn=bytesToNumberBE$1(Rn);if(!inRange$2(Pn,_1n$8,wr.ORDER))throw new Error("Point is not on curve");const On=Vr(Pn);let Zn;try{Zn=wr.sqrt(On)}catch(zn){const fo=zn instanceof Error?": "+zn.message:"";throw new Error("Point is not on curve"+fo)}const Nn=(Zn&_1n$8)===_1n$8;return(Sn&1)===1!==Nn&&(Zn=wr.neg(Zn)),{x:Pn,y:Zn}}else if(Xr===jr&&Sn===4){const Pn=wr.fromBytes(Rn.subarray(0,wr.BYTES)),On=wr.fromBytes(Rn.subarray(wr.BYTES,2*wr.BYTES));return{x:Pn,y:On}}else throw new Error(`Point of length ${Xr} was invalid. Expected ${kr} compressed bytes or ${jr} uncompressed bytes`)}}),Jr=Hr=>bytesToHex$2(numberToBytesBE$1(Hr,br.nByteLength));function Qr(Hr){const Xr=Er>>_1n$8;return Hr>Xr}function _n(Hr){return Qr(Hr)?Br(-Hr):Hr}const En=(Hr,Xr,Sn)=>bytesToNumberBE$1(Hr.slice(Xr,Sn));class Cn{constructor(Xr,Sn,Rn){this.r=Xr,this.s=Sn,this.recovery=Rn,this.assertValidity()}static fromCompact(Xr){const Sn=br.nByteLength;return Xr=ensureBytes$1("compactSignature",Xr,Sn*2),new Cn(En(Xr,0,Sn),En(Xr,Sn,2*Sn))}static fromDER(Xr){const{r:Sn,s:Rn}=DER$1.toSig(ensureBytes$1("DER",Xr));return new Cn(Sn,Rn)}assertValidity(){aInRange$1("r",this.r,_1n$8,Er),aInRange$1("s",this.s,_1n$8,Er)}addRecoveryBit(Xr){return new Cn(this.r,this.s,Xr)}recoverPublicKey(Xr){const{r:Sn,s:Rn,recovery:Pn}=this,On=to(ensureBytes$1("msgHash",Xr));if(Pn==null||![0,1,2,3].includes(Pn))throw new Error("recovery id invalid");const Zn=Pn===2||Pn===3?Sn+br.n:Sn;if(Zn>=wr.ORDER)throw new Error("recovery id 2 or 3 invalid");const Nn=Pn&1?"03":"02",wn=qr.fromHex(Nn+Jr(Zn)),zn=Wr(Zn),fo=Br(-On*zn),vo=Br(Rn*zn),go=qr.BASE.multiplyAndAddUnsafe(wn,fo,vo);if(!go)throw new Error("point at infinify");return go.assertValidity(),go}hasHighS(){return Qr(this.s)}normalizeS(){return this.hasHighS()?new Cn(this.r,Br(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$2(this.toDERHex())}toDERHex(){return DER$1.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$2(this.toCompactHex())}toCompactHex(){return Jr(this.r)+Jr(this.s)}}const In={isValidPrivateKey(Hr){try{return Gr(Hr),!0}catch{return!1}},normPrivateKeyToScalar:Gr,randomPrivateKey:()=>{const Hr=getMinHashLength$1(br.n);return mapHashToField$1(br.randomBytes(Hr),br.n)},precompute(Hr=8,Xr=qr.BASE){return Xr._setWindowSize(Hr),Xr.multiply(BigInt(3)),Xr}};function An(Hr,Xr=!0){return qr.fromPrivateKey(Hr).toRawBytes(Xr)}function jn(Hr){const Xr=isBytes$7(Hr),Sn=typeof Hr=="string",Rn=(Xr||Sn)&&Hr.length;return Xr?Rn===kr||Rn===jr:Sn?Rn===2*kr||Rn===2*jr:Hr instanceof qr}function eo(Hr,Xr,Sn=!0){if(jn(Hr))throw new Error("first arg must be private key");if(!jn(Xr))throw new Error("second arg must be public key");return qr.fromHex(Xr).multiply(Gr(Hr)).toRawBytes(Sn)}const ro=br.bits2int||function(Hr){const Xr=bytesToNumberBE$1(Hr),Sn=Hr.length*8-br.nBitLength;return Sn>0?Xr>>BigInt(Sn):Xr},to=br.bits2int_modN||function(Hr){return Br(ro(Hr))},_i=bitMask$1(br.nBitLength);function oo(Hr){return aInRange$1(`num < 2^${br.nBitLength}`,Hr,_0n$5,_i),numberToBytesBE$1(Hr,br.nByteLength)}function io(Hr,Xr,Sn=co){if(["recovered","canonical"].some(lo=>lo in Sn))throw new Error("sign() legacy options not supported");const{hash:Rn,randomBytes:Pn}=br;let{lowS:On,prehash:Zn,extraEntropy:Nn}=Sn;On==null&&(On=!0),Hr=ensureBytes$1("msgHash",Hr),validateSigVerOpts$1(Sn),Zn&&(Hr=ensureBytes$1("prehashed msgHash",Rn(Hr)));const wn=to(Hr),zn=Gr(Xr),fo=[oo(zn),oo(wn)];if(Nn!=null&&Nn!==!1){const lo=Nn===!0?Pn(wr.BYTES):Nn;fo.push(ensureBytes$1("extraEntropy",lo))}const vo=concatBytes$3(...fo),go=wn;function uo(lo){const Eo=ro(lo);if(!Zr(Eo))return;const mo=Wr(Eo),yo=qr.BASE.multiply(Eo).toAffine(),_o=Br(yo.x);if(_o===_0n$5)return;const Bo=Br(mo*Br(go+_o*zn));if(Bo===_0n$5)return;let Lo=(yo.x===_o?0:2)|Number(yo.y&_1n$8),Wo=Bo;return On&&Qr(Bo)&&(Wo=_n(Bo),Lo^=1),new Cn(_o,Wo,Lo)}return{seed:vo,k2sig:uo}}const co={lowS:br.lowS,prehash:!1},so={lowS:br.lowS,prehash:!1};function no(Hr,Xr,Sn=co){const{seed:Rn,k2sig:Pn}=io(Hr,Xr,Sn),On=br;return createHmacDrbg$1(On.hash.outputLen,On.nByteLength,On.hmac)(Rn,Pn)}qr.BASE._setWindowSize(8);function Tn(Hr,Xr,Sn,Rn=so){var yo;const Pn=Hr;if(Xr=ensureBytes$1("msgHash",Xr),Sn=ensureBytes$1("publicKey",Sn),"strict"in Rn)throw new Error("options.strict was renamed to lowS");validateSigVerOpts$1(Rn);const{lowS:On,prehash:Zn}=Rn;let Nn,wn;try{if(typeof Pn=="string"||isBytes$7(Pn))try{Nn=Cn.fromDER(Pn)}catch(_o){if(!(_o instanceof DER$1.Err))throw _o;Nn=Cn.fromCompact(Pn)}else if(typeof Pn=="object"&&typeof Pn.r=="bigint"&&typeof Pn.s=="bigint"){const{r:_o,s:Bo}=Pn;Nn=new Cn(_o,Bo)}else throw new Error("PARSE");wn=qr.fromHex(Sn)}catch(_o){if(_o.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(On&&Nn.hasHighS())return!1;Zn&&(Xr=br.hash(Xr));const{r:zn,s:fo}=Nn,vo=to(Xr),go=Wr(fo),uo=Br(vo*go),lo=Br(zn*go),Eo=(yo=qr.BASE.multiplyAndAddUnsafe(wn,uo,lo))==null?void 0:yo.toAffine();return Eo?Br(Eo.x)===zn:!1}return{CURVE:br,getPublicKey:An,getSharedSecret:eo,sign:no,verify:Tn,ProjectivePoint:qr,Signature:Cn,utils:In}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash$1(fr){return{hash:fr,hmac:(br,...wr)=>hmac$5(fr,br,concatBytes$5(...wr)),randomBytes:randomBytes$2}}function createCurve$1(fr,br){const wr=Er=>weierstrass$1({...fr,...getHash$1(Er)});return Object.freeze({...wr(br),create:wr})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1P$1=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N$1=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n$7=BigInt(1),_2n$5=BigInt(2),divNearest$1=(fr,br)=>(fr+br/_2n$5)/br;function sqrtMod$1(fr){const br=secp256k1P$1,wr=BigInt(3),Er=BigInt(6),kr=BigInt(11),jr=BigInt(22),Br=BigInt(23),Wr=BigInt(44),qr=BigInt(88),Gr=fr*fr*fr%br,Vr=Gr*Gr*fr%br,Zr=pow2$1(Vr,wr,br)*Vr%br,Jr=pow2$1(Zr,wr,br)*Vr%br,Qr=pow2$1(Jr,_2n$5,br)*Gr%br,_n=pow2$1(Qr,kr,br)*Qr%br,En=pow2$1(_n,jr,br)*_n%br,Cn=pow2$1(En,Wr,br)*En%br,In=pow2$1(Cn,qr,br)*Cn%br,An=pow2$1(In,Wr,br)*En%br,jn=pow2$1(An,wr,br)*Vr%br,eo=pow2$1(jn,Br,br)*_n%br,ro=pow2$1(eo,Er,br)*Gr%br,to=pow2$1(ro,_2n$5,br);if(!Fp$1.eql(Fp$1.sqr(to),fr))throw new Error("Cannot find square root");return to}const Fp$1=Field$1(secp256k1P$1,void 0,void 0,{sqrt:sqrtMod$1}),secp256k1$2=createCurve$1({a:BigInt(0),b:BigInt(7),Fp:Fp$1,n:secp256k1N$1,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:fr=>{const br=secp256k1N$1,wr=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),Er=-_1n$7*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),kr=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),jr=wr,Br=BigInt("0x100000000000000000000000000000000"),Wr=divNearest$1(jr*fr,br),qr=divNearest$1(-Er*fr,br);let Gr=mod$1(fr-Wr*wr-qr*kr,br),Vr=mod$1(-Wr*Er-qr*jr,br);const Zr=Gr>Br,Jr=Vr>Br;if(Zr&&(Gr=br-Gr),Jr&&(Vr=br-Vr),Gr>Br||Vr>Br)throw new Error("splitScalar: Endomorphism failed, k="+fr);return{k1neg:Zr,k1:Gr,k2neg:Jr,k2:Vr}}}},sha256$7);BigInt(0);secp256k1$2.ProjectivePoint;const secp256k1$3=Object.freeze(Object.defineProperty({__proto__:null,secp256k1:secp256k1$2},Symbol.toStringTag,{value:"Module"}));function serializeSignature({r:fr,s:br,to:wr="hex",v:Er,yParity:kr}){const jr=(()=>{if(kr===0||kr===1)return kr;if(Er&&(Er===27n||Er===28n||Er>=35n))return Er%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),Br=`0x${new secp256k1$2.Signature(hexToBigInt(fr),hexToBigInt(br)).toCompactHex()}${jr===0?"1b":"1c"}`;return wr==="hex"?Br:hexToBytes$4(Br)}async function verifyHash(fr,br){var Zr,Jr,Qr;const{address:wr,factory:Er,factoryData:kr,hash:jr,signature:Br,universalSignatureVerifierAddress:Wr=(Qr=(Jr=(Zr=fr.chain)==null?void 0:Zr.contracts)==null?void 0:Jr.universalSignatureVerifier)==null?void 0:Qr.address,...qr}=br,Gr=isHex(Br)?Br:typeof Br=="object"&&"r"in Br&&"s"in Br?serializeSignature(Br):bytesToHex$4(Br),Vr=await(async()=>!Er&&!kr||isErc6492Signature(Gr)?Gr:serializeErc6492Signature({address:Er,data:kr,signature:Gr}))();try{const _n=Wr?{to:Wr,data:encodeFunctionData({abi:universalSignatureValidatorAbi,functionName:"isValidSig",args:[wr,jr,Vr]}),...qr}:{data:encodeDeployData({abi:universalSignatureValidatorAbi,args:[wr,jr,Vr],bytecode:universalSignatureValidatorByteCode}),...qr},{data:En}=await getAction(fr,call,"call")(_n);return hexToBool(En??"0x0")}catch(_n){try{if(isAddressEqual(getAddress(wr),await recoverAddress({hash:jr,signature:Br})))return!0}catch{}if(_n instanceof CallExecutionError)return!1;throw _n}}async function verifyMessage(fr,{address:br,message:wr,factory:Er,factoryData:kr,signature:jr,...Br}){const Wr=hashMessage(wr);return verifyHash(fr,{address:br,factory:Er,factoryData:kr,hash:Wr,signature:jr,...Br})}async function verifyTypedData(fr,br){const{address:wr,factory:Er,factoryData:kr,signature:jr,message:Br,primaryType:Wr,types:qr,domain:Gr,...Vr}=br,Zr=hashTypedData({message:Br,primaryType:Wr,types:qr,domain:Gr});return verifyHash(fr,{address:wr,factory:Er,factoryData:kr,hash:Zr,signature:jr,...Vr})}function watchBlockNumber(fr,{emitOnBegin:br=!1,emitMissed:wr=!1,onBlockNumber:Er,onError:kr,poll:jr,pollingInterval:Br=fr.pollingInterval}){const Wr=typeof jr<"u"?jr:!(fr.transport.type==="webSocket"||fr.transport.type==="fallback"&&fr.transport.transports[0].config.type==="webSocket");let qr;return Wr?(()=>{const Zr=stringify$4(["watchBlockNumber",fr.uid,br,wr,Br]);return observe(Zr,{onBlockNumber:Er,onError:kr},Jr=>poll(async()=>{var Qr;try{const _n=await getAction(fr,getBlockNumber,"getBlockNumber")({cacheTime:0});if(qr){if(_n===qr)return;if(_n-qr>1&&wr)for(let En=qr+1n;En<_n;En++)Jr.onBlockNumber(En,qr),qr=En}(!qr||_n>qr)&&(Jr.onBlockNumber(_n,qr),qr=_n)}catch(_n){(Qr=Jr.onError)==null||Qr.call(Jr,_n)}},{emitOnBegin:br,interval:Br}))})():(()=>{const Zr=stringify$4(["watchBlockNumber",fr.uid,br,wr]);return observe(Zr,{onBlockNumber:Er,onError:kr},Jr=>{let Qr=!0,_n=()=>Qr=!1;return(async()=>{try{const En=(()=>{if(fr.transport.type==="fallback"){const In=fr.transport.transports.find(An=>An.config.type==="webSocket");return In?In.value:fr.transport}return fr.transport})(),{unsubscribe:Cn}=await En.subscribe({params:["newHeads"],onData(In){var jn;if(!Qr)return;const An=hexToBigInt((jn=In.result)==null?void 0:jn.number);Jr.onBlockNumber(An,qr),qr=An},onError(In){var An;(An=Jr.onError)==null||An.call(Jr,In)}});_n=Cn,Qr||_n()}catch(En){kr==null||kr(En)}})(),()=>_n()})})()}async function waitForTransactionReceipt(fr,{confirmations:br=1,hash:wr,onReplaced:Er,pollingInterval:kr=fr.pollingInterval,retryCount:jr=6,retryDelay:Br=({count:qr})=>~~(1<En(new WaitForTransactionReceiptTimeoutError({hash:wr})),Wr):void 0,In=observe(qr,{onReplaced:Er,resolve:_n,reject:En},An=>{const jn=getAction(fr,watchBlockNumber,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:kr,async onBlockNumber(eo){const ro=_i=>{clearTimeout(Cn),jn(),_i(),In()};let to=eo;if(!Jr)try{if(Zr){if(br>1&&(!Zr.blockNumber||to-Zr.blockNumber+1nAn.resolve(Zr));return}if(Gr||(Jr=!0,await withRetry(async()=>{Gr=await getAction(fr,getTransaction,"getTransaction")({hash:wr}),Gr.blockNumber&&(to=Gr.blockNumber)},{delay:Br,retryCount:jr}),Jr=!1),Zr=await getAction(fr,getTransactionReceipt,"getTransactionReceipt")({hash:wr}),br>1&&(!Zr.blockNumber||to-Zr.blockNumber+1nAn.resolve(Zr))}catch(_i){if(_i instanceof TransactionNotFoundError||_i instanceof TransactionReceiptNotFoundError){if(!Gr){Jr=!1;return}try{Vr=Gr,Jr=!0;const oo=await withRetry(()=>getAction(fr,getBlock,"getBlock")({blockNumber:to,includeTransactions:!0}),{delay:Br,retryCount:jr,shouldRetry:({error:so})=>so instanceof BlockNotFoundError});Jr=!1;const io=oo.transactions.find(({from:so,nonce:no})=>so===Vr.from&&no===Vr.nonce);if(!io||(Zr=await getAction(fr,getTransactionReceipt,"getTransactionReceipt")({hash:io.hash}),br>1&&(!Zr.blockNumber||to-Zr.blockNumber+1n{var so;(so=An.onReplaced)==null||so.call(An,{reason:co,replacedTransaction:Vr,transaction:io,transactionReceipt:Zr}),An.resolve(Zr)})}catch(oo){ro(()=>An.reject(oo))}}else ro(()=>An.reject(_i))}}})});return Qr}function watchBlocks(fr,{blockTag:br="latest",emitMissed:wr=!1,emitOnBegin:Er=!1,onBlock:kr,onError:jr,includeTransactions:Br,poll:Wr,pollingInterval:qr=fr.pollingInterval}){const Gr=typeof Wr<"u"?Wr:!(fr.transport.type==="webSocket"||fr.transport.type==="fallback"&&fr.transport.transports[0].config.type==="webSocket"),Vr=Br??!1;let Zr;return Gr?(()=>{const _n=stringify$4(["watchBlocks",fr.uid,br,wr,Er,Vr,qr]);return observe(_n,{onBlock:kr,onError:jr},En=>poll(async()=>{var Cn;try{const In=await getAction(fr,getBlock,"getBlock")({blockTag:br,includeTransactions:Vr});if(In.number&&(Zr!=null&&Zr.number)){if(In.number===Zr.number)return;if(In.number-Zr.number>1&&wr)for(let An=(Zr==null?void 0:Zr.number)+1n;AnZr.number)&&(En.onBlock(In,Zr),Zr=In)}catch(In){(Cn=En.onError)==null||Cn.call(En,In)}},{emitOnBegin:Er,interval:qr}))})():(()=>{let _n=!0,En=!0,Cn=()=>_n=!1;return(async()=>{try{Er&&getAction(fr,getBlock,"getBlock")({blockTag:br,includeTransactions:Vr}).then(jn=>{_n&&En&&(kr(jn,void 0),En=!1)});const In=(()=>{if(fr.transport.type==="fallback"){const jn=fr.transport.transports.find(eo=>eo.config.type==="webSocket");return jn?jn.value:fr.transport}return fr.transport})(),{unsubscribe:An}=await In.subscribe({params:["newHeads"],async onData(jn){if(!_n)return;const eo=await getAction(fr,getBlock,"getBlock")({blockNumber:jn.blockNumber,includeTransactions:Vr}).catch(()=>{});_n&&(kr(eo,Zr),En=!1,Zr=eo)},onError(jn){jr==null||jr(jn)}});Cn=An,_n||Cn()}catch(In){jr==null||jr(In)}})(),()=>Cn()})()}function watchEvent(fr,{address:br,args:wr,batch:Er=!0,event:kr,events:jr,fromBlock:Br,onError:Wr,onLogs:qr,poll:Gr,pollingInterval:Vr=fr.pollingInterval,strict:Zr}){const Jr=typeof Gr<"u"?Gr:typeof Br=="bigint"?!0:!(fr.transport.type==="webSocket"||fr.transport.type==="fallback"&&fr.transport.transports[0].config.type==="webSocket"),Qr=Zr??!1;return Jr?(()=>{const Cn=stringify$4(["watchEvent",br,wr,Er,fr.uid,kr,Vr,Br]);return observe(Cn,{onLogs:qr,onError:Wr},In=>{let An;Br!==void 0&&(An=Br-1n);let jn,eo=!1;const ro=poll(async()=>{var to;if(!eo){try{jn=await getAction(fr,createEventFilter,"createEventFilter")({address:br,args:wr,event:kr,events:jr,strict:Qr,fromBlock:Br})}catch{}eo=!0;return}try{let _i;if(jn)_i=await getAction(fr,getFilterChanges,"getFilterChanges")({filter:jn});else{const oo=await getAction(fr,getBlockNumber,"getBlockNumber")({});An&&An!==oo?_i=await getAction(fr,getLogs,"getLogs")({address:br,args:wr,event:kr,events:jr,fromBlock:An+1n,toBlock:oo}):_i=[],An=oo}if(_i.length===0)return;if(Er)In.onLogs(_i);else for(const oo of _i)In.onLogs([oo])}catch(_i){jn&&_i instanceof InvalidInputRpcError&&(eo=!1),(to=In.onError)==null||to.call(In,_i)}},{emitOnBegin:!0,interval:Vr});return async()=>{jn&&await getAction(fr,uninstallFilter,"uninstallFilter")({filter:jn}),ro()}})})():(()=>{let Cn=!0,In=()=>Cn=!1;return(async()=>{try{const An=(()=>{if(fr.transport.type==="fallback"){const to=fr.transport.transports.find(_i=>_i.config.type==="webSocket");return to?to.value:fr.transport}return fr.transport})(),jn=jr??(kr?[kr]:void 0);let eo=[];jn&&(eo=[jn.flatMap(_i=>encodeEventTopics({abi:[_i],eventName:_i.name,args:wr}))],kr&&(eo=eo[0]));const{unsubscribe:ro}=await An.subscribe({params:["logs",{address:br,topics:eo}],onData(to){var oo;if(!Cn)return;const _i=to.result;try{const{eventName:io,args:co}=decodeEventLog({abi:jn??[],data:_i.data,topics:_i.topics,strict:Qr}),so=formatLog(_i,{args:co,eventName:io});qr([so])}catch(io){let co,so;if(io instanceof DecodeLogDataMismatch||io instanceof DecodeLogTopicsMismatch){if(Zr)return;co=io.abiItem.name,so=(oo=io.abiItem.inputs)==null?void 0:oo.some(Tn=>!("name"in Tn&&Tn.name))}const no=formatLog(_i,{args:so?[]:{},eventName:co});qr([no])}},onError(to){Wr==null||Wr(to)}});In=ro,Cn||In()}catch(An){Wr==null||Wr(An)}})(),()=>In()})()}function watchPendingTransactions(fr,{batch:br=!0,onError:wr,onTransactions:Er,poll:kr,pollingInterval:jr=fr.pollingInterval}){return(typeof kr<"u"?kr:fr.transport.type!=="webSocket")?(()=>{const Gr=stringify$4(["watchPendingTransactions",fr.uid,br,jr]);return observe(Gr,{onTransactions:Er,onError:wr},Vr=>{let Zr;const Jr=poll(async()=>{var Qr;try{if(!Zr)try{Zr=await getAction(fr,createPendingTransactionFilter,"createPendingTransactionFilter")({});return}catch(En){throw Jr(),En}const _n=await getAction(fr,getFilterChanges,"getFilterChanges")({filter:Zr});if(_n.length===0)return;if(br)Vr.onTransactions(_n);else for(const En of _n)Vr.onTransactions([En])}catch(_n){(Qr=Vr.onError)==null||Qr.call(Vr,_n)}},{emitOnBegin:!0,interval:jr});return async()=>{Zr&&await getAction(fr,uninstallFilter,"uninstallFilter")({filter:Zr}),Jr()}})})():(()=>{let Gr=!0,Vr=()=>Gr=!1;return(async()=>{try{const{unsubscribe:Zr}=await fr.transport.subscribe({params:["newPendingTransactions"],onData(Jr){if(!Gr)return;const Qr=Jr.result;Er([Qr])},onError(Jr){wr==null||wr(Jr)}});Vr=Zr,Gr||Vr()}catch(Zr){wr==null||wr(Zr)}})(),()=>Vr()})()}function parseSiweMessage(fr){var Zr,Jr,Qr;const{scheme:br,statement:wr,...Er}=((Zr=fr.match(prefixRegex))==null?void 0:Zr.groups)??{},{chainId:kr,expirationTime:jr,issuedAt:Br,notBefore:Wr,requestId:qr,...Gr}=((Jr=fr.match(suffixRegex))==null?void 0:Jr.groups)??{},Vr=(Qr=fr.split("Resources:")[1])==null?void 0:Qr.split(` - `).slice(1);return{...Er,...Gr,...kr?{chainId:Number(kr)}:{},...jr?{expirationTime:new Date(jr)}:{},...Br?{issuedAt:new Date(Br)}:{},...Wr?{notBefore:new Date(Wr)}:{},...qr?{requestId:qr}:{},...Vr?{resources:Vr}:{},...br?{scheme:br}:{},...wr?{statement:wr}:{}}}const prefixRegex=/^(?:(?[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?
0x[a-fA-F0-9]{40})\n\n(?:(?.*)\n\n)?/,suffixRegex=/(?:URI: (?.+))\n(?:Version: (?.+))\n(?:Chain ID: (?\d+))\n(?:Nonce: (?[a-zA-Z0-9]+))\n(?:Issued At: (?.+))(?:\nExpiration Time: (?.+))?(?:\nNot Before: (?.+))?(?:\nRequest ID: (?.+))?/;function validateSiweMessage(fr){const{address:br,domain:wr,message:Er,nonce:kr,scheme:jr,time:Br=new Date}=fr;if(wr&&Er.domain!==wr||kr&&Er.nonce!==kr||jr&&Er.scheme!==jr||Er.expirationTime&&Br>=Er.expirationTime||Er.notBefore&&Brcall(fr,br),createBlockFilter:()=>createBlockFilter(fr),createContractEventFilter:br=>createContractEventFilter(fr,br),createEventFilter:br=>createEventFilter(fr,br),createPendingTransactionFilter:()=>createPendingTransactionFilter(fr),estimateContractGas:br=>estimateContractGas(fr,br),estimateGas:br=>estimateGas$1(fr,br),getBalance:br=>getBalance(fr,br),getBlobBaseFee:()=>getBlobBaseFee(fr),getBlock:br=>getBlock(fr,br),getBlockNumber:br=>getBlockNumber(fr,br),getBlockTransactionCount:br=>getBlockTransactionCount(fr,br),getBytecode:br=>getCode(fr,br),getChainId:()=>getChainId(fr),getCode:br=>getCode(fr,br),getContractEvents:br=>getContractEvents(fr,br),getEip712Domain:br=>getEip712Domain$1(fr,br),getEnsAddress:br=>getEnsAddress(fr,br),getEnsAvatar:br=>getEnsAvatar(fr,br),getEnsName:br=>getEnsName(fr,br),getEnsResolver:br=>getEnsResolver(fr,br),getEnsText:br=>getEnsText(fr,br),getFeeHistory:br=>getFeeHistory(fr,br),estimateFeesPerGas:br=>estimateFeesPerGas$1(fr,br),getFilterChanges:br=>getFilterChanges(fr,br),getFilterLogs:br=>getFilterLogs(fr,br),getGasPrice:()=>getGasPrice(fr),getLogs:br=>getLogs(fr,br),getProof:br=>getProof(fr,br),estimateMaxPriorityFeePerGas:br=>estimateMaxPriorityFeePerGas(fr,br),getStorageAt:br=>getStorageAt(fr,br),getTransaction:br=>getTransaction(fr,br),getTransactionConfirmations:br=>getTransactionConfirmations(fr,br),getTransactionCount:br=>getTransactionCount(fr,br),getTransactionReceipt:br=>getTransactionReceipt(fr,br),multicall:br=>multicall(fr,br),prepareTransactionRequest:br=>prepareTransactionRequest(fr,br),readContract:br=>readContract(fr,br),sendRawTransaction:br=>sendRawTransaction(fr,br),simulateContract:br=>simulateContract(fr,br),verifyMessage:br=>verifyMessage(fr,br),verifySiweMessage:br=>verifySiweMessage(fr,br),verifyTypedData:br=>verifyTypedData(fr,br),uninstallFilter:br=>uninstallFilter(fr,br),waitForTransactionReceipt:br=>waitForTransactionReceipt(fr,br),watchBlocks:br=>watchBlocks(fr,br),watchBlockNumber:br=>watchBlockNumber(fr,br),watchContractEvent:br=>watchContractEvent(fr,br),watchEvent:br=>watchEvent(fr,br),watchPendingTransactions:br=>watchPendingTransactions(fr,br)}}function createPublicClient(fr){const{key:br="public",name:wr="Public Client"}=fr;return createClient({...fr,key:br,name:wr,type:"publicClient"}).extend(publicActions)}async function dropTransaction(fr,{hash:br}){await fr.request({method:`${fr.mode}_dropTransaction`,params:[br]})}async function dumpState(fr){return fr.request({method:`${fr.mode}_dumpState`})}async function getAutomine(fr){return fr.mode==="ganache"?await fr.request({method:"eth_mining"}):await fr.request({method:`${fr.mode}_getAutomine`})}async function getTxpoolContent(fr){return await fr.request({method:"txpool_content"})}async function getTxpoolStatus(fr){const{pending:br,queued:wr}=await fr.request({method:"txpool_status"});return{pending:hexToNumber$2(br),queued:hexToNumber$2(wr)}}async function impersonateAccount(fr,{address:br}){await fr.request({method:`${fr.mode}_impersonateAccount`,params:[br]})}async function increaseTime(fr,{seconds:br}){return await fr.request({method:"evm_increaseTime",params:[numberToHex(br)]})}async function inspectTxpool(fr){return await fr.request({method:"txpool_inspect"})}async function loadState(fr,{state:br}){await fr.request({method:`${fr.mode}_loadState`,params:[br]})}async function mine(fr,{blocks:br,interval:wr}){fr.mode==="ganache"?await fr.request({method:"evm_mine",params:[{blocks:numberToHex(br)}]}):await fr.request({method:`${fr.mode}_mine`,params:[numberToHex(br),numberToHex(wr||0)]})}async function removeBlockTimestampInterval(fr){await fr.request({method:`${fr.mode}_removeBlockTimestampInterval`})}async function reset(fr,{blockNumber:br,jsonRpcUrl:wr}={}){await fr.request({method:`${fr.mode}_reset`,params:[{forking:{blockNumber:Number(br),jsonRpcUrl:wr}}]})}async function revert(fr,{id:br}){await fr.request({method:"evm_revert",params:[br]})}async function sendUnsignedTransaction(fr,br){var In,An,jn;const{accessList:wr,data:Er,from:kr,gas:jr,gasPrice:Br,maxFeePerGas:Wr,maxPriorityFeePerGas:qr,nonce:Gr,to:Vr,value:Zr,...Jr}=br,Qr=(jn=(An=(In=fr.chain)==null?void 0:In.formatters)==null?void 0:An.transactionRequest)==null?void 0:jn.format,En=(Qr||formatTransactionRequest)({...extract(Jr,{format:Qr}),accessList:wr,data:Er,from:kr,gas:jr,gasPrice:Br,maxFeePerGas:Wr,maxPriorityFeePerGas:qr,nonce:Gr,to:Vr,value:Zr});return await fr.request({method:"eth_sendUnsignedTransaction",params:[En]})}async function setAutomine(fr,br){fr.mode==="ganache"?br?await fr.request({method:"miner_start"}):await fr.request({method:"miner_stop"}):await fr.request({method:"evm_setAutomine",params:[br]})}async function setBalance(fr,{address:br,value:wr}){fr.mode==="ganache"?await fr.request({method:"evm_setAccountBalance",params:[br,numberToHex(wr)]}):await fr.request({method:`${fr.mode}_setBalance`,params:[br,numberToHex(wr)]})}async function setBlockGasLimit(fr,{gasLimit:br}){await fr.request({method:"evm_setBlockGasLimit",params:[numberToHex(br)]})}async function setBlockTimestampInterval(fr,{interval:br}){const wr=fr.mode==="hardhat"?br*1e3:br;await fr.request({method:`${fr.mode}_setBlockTimestampInterval`,params:[wr]})}async function setCode(fr,{address:br,bytecode:wr}){fr.mode==="ganache"?await fr.request({method:"evm_setAccountCode",params:[br,wr]}):await fr.request({method:`${fr.mode}_setCode`,params:[br,wr]})}async function setCoinbase(fr,{address:br}){await fr.request({method:`${fr.mode}_setCoinbase`,params:[br]})}async function setIntervalMining(fr,{interval:br}){const wr=fr.mode==="hardhat"?br*1e3:br;await fr.request({method:"evm_setIntervalMining",params:[wr]})}async function setLoggingEnabled(fr,br){await fr.request({method:`${fr.mode}_setLoggingEnabled`,params:[br]})}async function setMinGasPrice(fr,{gasPrice:br}){await fr.request({method:`${fr.mode}_setMinGasPrice`,params:[numberToHex(br)]})}async function setNextBlockBaseFeePerGas(fr,{baseFeePerGas:br}){await fr.request({method:`${fr.mode}_setNextBlockBaseFeePerGas`,params:[numberToHex(br)]})}async function setNextBlockTimestamp(fr,{timestamp:br}){await fr.request({method:"evm_setNextBlockTimestamp",params:[numberToHex(br)]})}async function setNonce(fr,{address:br,nonce:wr}){await fr.request({method:`${fr.mode}_setNonce`,params:[br,numberToHex(wr)]})}async function setRpcUrl(fr,br){await fr.request({method:`${fr.mode}_setRpcUrl`,params:[br]})}async function setStorageAt(fr,{address:br,index:wr,value:Er}){await fr.request({method:`${fr.mode}_setStorageAt`,params:[br,typeof wr=="number"?numberToHex(wr):wr,Er]})}async function snapshot(fr){return await fr.request({method:"evm_snapshot"})}async function stopImpersonatingAccount(fr,{address:br}){await fr.request({method:`${fr.mode}_stopImpersonatingAccount`,params:[br]})}function testActions({mode:fr}){return br=>{const wr=br.extend(()=>({mode:fr}));return{dropTransaction:Er=>dropTransaction(wr,Er),dumpState:()=>dumpState(wr),getAutomine:()=>getAutomine(wr),getTxpoolContent:()=>getTxpoolContent(wr),getTxpoolStatus:()=>getTxpoolStatus(wr),impersonateAccount:Er=>impersonateAccount(wr,Er),increaseTime:Er=>increaseTime(wr,Er),inspectTxpool:()=>inspectTxpool(wr),loadState:Er=>loadState(wr,Er),mine:Er=>mine(wr,Er),removeBlockTimestampInterval:()=>removeBlockTimestampInterval(wr),reset:Er=>reset(wr,Er),revert:Er=>revert(wr,Er),sendUnsignedTransaction:Er=>sendUnsignedTransaction(wr,Er),setAutomine:Er=>setAutomine(wr,Er),setBalance:Er=>setBalance(wr,Er),setBlockGasLimit:Er=>setBlockGasLimit(wr,Er),setBlockTimestampInterval:Er=>setBlockTimestampInterval(wr,Er),setCode:Er=>setCode(wr,Er),setCoinbase:Er=>setCoinbase(wr,Er),setIntervalMining:Er=>setIntervalMining(wr,Er),setLoggingEnabled:Er=>setLoggingEnabled(wr,Er),setMinGasPrice:Er=>setMinGasPrice(wr,Er),setNextBlockBaseFeePerGas:Er=>setNextBlockBaseFeePerGas(wr,Er),setNextBlockTimestamp:Er=>setNextBlockTimestamp(wr,Er),setNonce:Er=>setNonce(wr,Er),setRpcUrl:Er=>setRpcUrl(wr,Er),setStorageAt:Er=>setStorageAt(wr,Er),snapshot:()=>snapshot(wr),stopImpersonatingAccount:Er=>stopImpersonatingAccount(wr,Er)}}}function createTestClient(fr){const{key:br="test",name:wr="Test Client",mode:Er}=fr;return createClient({...fr,key:br,name:wr,type:"testClient"}).extend(jr=>({mode:Er,...testActions({mode:Er})(jr)}))}function deployContract(fr,br){const{abi:wr,args:Er,bytecode:kr,...jr}=br,Br=encodeDeployData({abi:wr,args:Er,bytecode:kr});return sendTransaction(fr,{...jr,data:Br})}async function getAddresses(fr){var wr;return((wr=fr.account)==null?void 0:wr.type)==="local"?[fr.account.address]:(await fr.request({method:"eth_accounts"},{dedupe:!0})).map(Er=>checksumAddress(Er))}async function getPermissions(fr){return await fr.request({method:"wallet_getPermissions"},{dedupe:!0})}async function requestAddresses(fr){return(await fr.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(wr=>getAddress(wr))}async function requestPermissions(fr,br){return fr.request({method:"wallet_requestPermissions",params:[br]},{retryCount:0})}async function signMessage$2(fr,{account:br=fr.account,message:wr}){if(!br)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const Er=parseAccount(br);if(Er.signMessage)return Er.signMessage({message:wr});const kr=typeof wr=="string"?stringToHex(wr):wr.raw instanceof Uint8Array?toHex(wr.raw):wr.raw;return fr.request({method:"personal_sign",params:[kr,Er.address]},{retryCount:0})}async function signTransaction$2(fr,br){var Gr,Vr,Zr,Jr;const{account:wr=fr.account,chain:Er=fr.chain,...kr}=br;if(!wr)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signTransaction"});const jr=parseAccount(wr);assertRequest({account:jr,...br});const Br=await getAction(fr,getChainId,"getChainId")({});Er!==null&&assertCurrentChain({currentChainId:Br,chain:Er});const Wr=(Er==null?void 0:Er.formatters)||((Gr=fr.chain)==null?void 0:Gr.formatters),qr=((Vr=Wr==null?void 0:Wr.transactionRequest)==null?void 0:Vr.format)||formatTransactionRequest;return jr.signTransaction?jr.signTransaction({...kr,chainId:Br},{serializer:(Jr=(Zr=fr.chain)==null?void 0:Zr.serializers)==null?void 0:Jr.transaction}):await fr.request({method:"eth_signTransaction",params:[{...qr(kr),chainId:numberToHex(Br),from:jr.address}]},{retryCount:0})}async function signTypedData$2(fr,br){const{account:wr=fr.account,domain:Er,message:kr,primaryType:jr}=br;if(!wr)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signTypedData"});const Br=parseAccount(wr),Wr={EIP712Domain:getTypesForEIP712Domain({domain:Er}),...br.types};if(validateTypedData({domain:Er,message:kr,primaryType:jr,types:Wr}),Br.signTypedData)return Br.signTypedData({domain:Er,message:kr,primaryType:jr,types:Wr});const qr=serializeTypedData({domain:Er,message:kr,primaryType:jr,types:Wr});return fr.request({method:"eth_signTypedData_v4",params:[Br.address,qr]},{retryCount:0})}async function switchChain(fr,{id:br}){await fr.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(br)}]},{retryCount:0})}async function watchAsset(fr,br){return await fr.request({method:"wallet_watchAsset",params:br},{retryCount:0})}function walletActions(fr){return{addChain:br=>addChain(fr,br),deployContract:br=>deployContract(fr,br),getAddresses:()=>getAddresses(fr),getChainId:()=>getChainId(fr),getPermissions:()=>getPermissions(fr),prepareTransactionRequest:br=>prepareTransactionRequest(fr,br),requestAddresses:()=>requestAddresses(fr),requestPermissions:br=>requestPermissions(fr,br),sendRawTransaction:br=>sendRawTransaction(fr,br),sendTransaction:br=>sendTransaction(fr,br),signMessage:br=>signMessage$2(fr,br),signTransaction:br=>signTransaction$2(fr,br),signTypedData:br=>signTypedData$2(fr,br),switchChain:br=>switchChain(fr,br),watchAsset:br=>watchAsset(fr,br),writeContract:br=>writeContract(fr,br)}}function createWalletClient(fr){const{key:br="wallet",name:wr="Wallet Client",transport:Er}=fr;return createClient({...fr,key:br,name:wr,transport:Er,type:"walletClient"}).extend(walletActions)}function webSocket(fr,br={}){const{keepAlive:wr,key:Er="webSocket",name:kr="WebSocket JSON-RPC",reconnect:jr,retryDelay:Br}=br;return({chain:Wr,retryCount:qr,timeout:Gr})=>{var Qr;const Vr=br.retryCount??qr,Zr=Gr??br.timeout??1e4,Jr=fr||((Qr=Wr==null?void 0:Wr.rpcUrls.default.webSocket)==null?void 0:Qr[0]);if(!Jr)throw new UrlRequiredError;return createTransport({key:Er,name:kr,async request({method:_n,params:En}){const Cn={method:_n,params:En},In=await getWebSocketRpcClient(Jr,{keepAlive:wr,reconnect:jr}),{error:An,result:jn}=await In.requestAsync({body:Cn,timeout:Zr});if(An)throw new RpcRequestError({body:Cn,error:An,url:Jr});return jn},retryCount:Vr,retryDelay:Br,timeout:Zr,type:"webSocket"},{getSocket(){return getSocket(Jr)},getRpcClient(){return getWebSocketRpcClient(Jr)},async subscribe({params:_n,onData:En,onError:Cn}){const In=await getWebSocketRpcClient(Jr),{result:An}=await new Promise((jn,eo)=>In.request({body:{method:"eth_subscribe",params:_n},onError(ro){eo(ro),Cn==null||Cn(ro)},onResponse(ro){if(ro.error){eo(ro.error),Cn==null||Cn(ro.error);return}if(typeof ro.id=="number"){jn(ro);return}ro.method==="eth_subscription"&&En(ro.params)}}));return{subscriptionId:An,async unsubscribe(){return new Promise(jn=>In.request({body:{method:"eth_unsubscribe",params:[An]},onResponse:jn}))}}}})}}const zeroAddress="0x0000000000000000000000000000000000000000";class ProviderRpcError extends Error{constructor(br,wr){super(wr),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=br,this.details=wr}}const docsPath="/docs/contract/decodeDeployData";function decodeDeployData(fr){const{abi:br,bytecode:wr,data:Er}=fr;if(Er===wr)return{bytecode:wr};const kr=br.find(Br=>"type"in Br&&Br.type==="constructor");if(!kr)throw new AbiConstructorNotFoundError({docsPath});if(!("inputs"in kr))throw new AbiConstructorParamsNotFoundError({docsPath});if(!kr.inputs||kr.inputs.length===0)throw new AbiConstructorParamsNotFoundError({docsPath});return{args:decodeAbiParameters(kr.inputs,`0x${Er.replace(wr,"")}`),bytecode:wr}}function compactSignatureToSignature({r:fr,yParityAndS:br}){const wr=hexToBytes$4(br),Er=wr[0]&128?1:0,kr=wr;return Er===1&&(kr[0]&=127),{r:fr,s:bytesToHex$4(kr),yParity:Er}}function parseCompactSignature(fr){const{r:br,s:wr}=secp256k1$2.Signature.fromCompact(fr.slice(2,130));return{r:numberToHex(br,{size:32}),yParityAndS:numberToHex(wr,{size:32})}}function parseSignature(fr){const{r:br,s:wr}=secp256k1$2.Signature.fromCompact(fr.slice(2,130)),Er=+`0x${fr.slice(130)}`,[kr,jr]=(()=>{if(Er===0||Er===1)return[void 0,Er];if(Er===27)return[BigInt(Er),0];if(Er===28)return[BigInt(Er),1];throw new Error("Invalid yParityOrV value")})();return typeof kr<"u"?{r:numberToHex(br,{size:32}),s:numberToHex(wr,{size:32}),v:kr,yParity:jr}:{r:numberToHex(br,{size:32}),s:numberToHex(wr,{size:32}),yParity:jr}}async function recoverTransactionAddress(fr){const{serializedTransaction:br,signature:wr}=fr,Er=parseTransaction(br),kr=wr??{r:Er.r,s:Er.s,v:Er.v,yParity:Er.yParity},jr=serializeTransaction$4({...Er,r:void 0,s:void 0,v:void 0,yParity:void 0,sidecars:void 0});return await recoverAddress({hash:keccak256(jr),signature:kr})}function signatureToCompactSignature(fr){const{r:br,s:wr,v:Er,yParity:kr}=fr,jr=Number(kr??Er-27n);let Br=wr;if(jr===1){const Wr=hexToBytes$4(wr);Wr[0]|=128,Br=bytesToHex$4(Wr)}return{r:br,yParityAndS:Br}}function serializeCompactSignature({r:fr,yParityAndS:br}){return`0x${new secp256k1$2.Signature(hexToBigInt(fr),hexToBigInt(br)).toCompactHex()}`}function sidecarsToVersionedHashes(fr){const{sidecars:br,version:wr}=fr,Er=fr.to??(typeof br[0].blob=="string"?"hex":"bytes"),kr=[];for(const{commitment:jr}of br)kr.push(commitmentToVersionedHash({commitment:jr,to:Er,version:wr}));return kr}function fromBlobs(fr){const br=fr.to??(typeof fr.blobs[0]=="string"?"hex":"bytes"),wr=typeof fr.blobs[0]=="string"?fr.blobs.map(Wr=>hexToBytes$4(Wr)):fr.blobs,Er=wr.reduce((Wr,qr)=>Wr+qr.length,0),kr=createCursor(new Uint8Array(Er));let jr=!0;for(const Wr of wr){const qr=createCursor(Wr);for(;jr&&qr.position{var jr;if(typeof Er=="string")return Er;const kr=(jr=formatters$2.transaction)==null?void 0:jr.format(Er);return kr.typeHex==="0x71"?kr.type="eip712":kr.typeHex==="0xff"&&(kr.type="priority"),kr});return{l1BatchNumber:fr.l1BatchNumber?hexToBigInt(fr.l1BatchNumber):null,l1BatchTimestamp:fr.l1BatchTimestamp?hexToBigInt(fr.l1BatchTimestamp):null,transactions:br}}}),transaction:defineTransaction({format(fr){const br={};return fr.type==="0x71"?br.type="eip712":fr.type==="0xff"&&(br.type="priority"),{...br,l1BatchNumber:fr.l1BatchNumber?hexToBigInt(fr.l1BatchNumber):null,l1BatchTxIndex:fr.l1BatchTxIndex?hexToBigInt(fr.l1BatchTxIndex):null}}}),transactionReceipt:defineTransactionReceipt({format(fr){return{l1BatchNumber:fr.l1BatchNumber?hexToBigInt(fr.l1BatchNumber):null,l1BatchTxIndex:fr.l1BatchTxIndex?hexToBigInt(fr.l1BatchTxIndex):null,logs:fr.logs.map(br=>({...formatLog(br),l1BatchNumber:br.l1BatchNumber?hexToBigInt(br.l1BatchNumber):null,transactionLogIndex:hexToNumber$2(br.transactionLogIndex),logType:br.logType})),l2ToL1Logs:fr.l2ToL1Logs.map(br=>({blockNumber:hexToBigInt(br.blockHash),blockHash:br.blockHash,l1BatchNumber:br.l1BatchNumber?hexToBigInt(br.l1BatchNumber):null,transactionIndex:hexToBigInt(br.transactionIndex),shardId:hexToBigInt(br.shardId),isService:br.isService,sender:br.sender,key:br.key,value:br.value,transactionHash:br.transactionHash,logIndex:hexToBigInt(br.logIndex)}))}}}),transactionRequest:defineTransactionRequest({exclude:["customSignature","factoryDeps","gasPerPubdata","paymaster","paymasterInput"],format(fr){return fr.gasPerPubdata||fr.paymaster&&fr.paymasterInput||fr.factoryDeps||fr.customSignature?{eip712Meta:{...fr.gasPerPubdata?{gasPerPubdata:toHex(fr.gasPerPubdata)}:{gasPerPubdata:toHex(gasPerPubdataDefault)},...fr.paymaster&&fr.paymasterInput?{paymasterParams:{paymaster:fr.paymaster,paymasterInput:Array.from(hexToBytes$4(fr.paymasterInput))}}:{},...fr.factoryDeps?{factoryDeps:fr.factoryDeps.map(br=>Array.from(hexToBytes$4(br)))}:{},...fr.customSignature?{customSignature:Array.from(hexToBytes$4(fr.customSignature))}:{}},type:"0x71"}:{}}})};class InvalidEip712TransactionError extends BaseError{constructor(){super(["Transaction is not an EIP712 transaction.","","Transaction must:",' - include `type: "eip712"`'," - include one of the following: `customSignature`, `paymaster`, `paymasterInput`, `gasPerPubdata`, `factoryDeps`"].join(` `),{name:"InvalidEip712TransactionError"})}}function isEIP712Transaction(fr){return!!(fr.type==="eip712"||"customSignature"in fr&&fr.customSignature||"paymaster"in fr&&fr.paymaster||"paymasterInput"in fr&&fr.paymasterInput||"gasPerPubdata"in fr&&typeof fr.gasPerPubdata=="bigint"||"factoryDeps"in fr&&fr.factoryDeps)}function assertEip712Transaction(fr){const{chainId:br,to:wr,from:Er,paymaster:kr,paymasterInput:jr}=fr;if(!isEIP712Transaction(fr))throw new InvalidEip712TransactionError;if(!br||br<=0)throw new InvalidChainIdError({chainId:br});if(wr&&!isAddress(wr))throw new InvalidAddressError({address:wr});if(Er&&!isAddress(Er))throw new InvalidAddressError({address:Er});if(kr&&!isAddress(kr))throw new InvalidAddressError({address:kr});if(kr&&!jr)throw new BaseError("`paymasterInput` must be provided when `paymaster` is defined");if(!kr&&jr)throw new BaseError("`paymaster` must be provided when `paymasterInput` is defined")}function serializeTransaction$3(fr,br){return isEIP712Transaction(fr)?serializeTransactionEIP712(fr):serializeTransaction$4(fr,br)}const serializers$2={transaction:serializeTransaction$3};function serializeTransactionEIP712(fr){const{chainId:br,gas:wr,nonce:Er,to:kr,from:jr,value:Br,maxFeePerGas:Wr,maxPriorityFeePerGas:qr,customSignature:Gr,factoryDeps:Vr,paymaster:Zr,paymasterInput:Jr,gasPerPubdata:Qr,data:_n}=fr;assertEip712Transaction(fr);const En=[Er?toHex(Er):"0x",qr?toHex(qr):"0x",Wr?toHex(Wr):"0x",wr?toHex(wr):"0x",kr??"0x",Br?toHex(Br):"0x",_n??"0x0",toHex(br),toHex(""),toHex(""),toHex(br),jr??"0x",toHex(Qr||gasPerPubdataDefault),Vr??[],Gr??"0x",Zr&&Jr?[Zr,Jr]:[]];return concatHex(["0x71",toRlp(En)])}class BytecodeLengthExceedsMaxSizeError extends BaseError{constructor({givenLength:br,maxBytecodeSize:wr}){super(`Bytecode cannot be longer than ${wr} bytes. Given length: ${br}`,{name:"BytecodeLengthExceedsMaxSizeError"})}}class BytecodeLengthInWordsMustBeOddError extends BaseError{constructor({givenLengthInWords:br}){super(`Bytecode length in 32-byte words must be odd. Given length in words: ${br}`,{name:"BytecodeLengthInWordsMustBeOddError"})}}class BytecodeLengthMustBeDivisibleBy32Error extends BaseError{constructor({givenLength:br}){super(`The bytecode length in bytes must be divisible by 32. Given length: ${br}`,{name:"BytecodeLengthMustBeDivisibleBy32Error"})}}function hashBytecode(fr){const br=toBytes$3(fr);if(br.length%32!==0)throw new BytecodeLengthMustBeDivisibleBy32Error({givenLength:br.length});if(br.length>maxBytecodeSize)throw new BytecodeLengthExceedsMaxSizeError({givenLength:br.length,maxBytecodeSize});const wr=sha256$6(br),Er=toBytes$3(wr),kr=br.length/32;if(kr%2===0)throw new BytecodeLengthInWordsMustBeOddError({givenLengthInWords:kr});const jr=toBytes$3(kr),Br=pad(jr,{size:2}),Wr=new Uint8Array([1,0]);return Er.set(Wr,0),Er.set(Br,2),Er}const getEip712Domain=fr=>{assertEip712Transaction(fr);const br=transactionToMessage(fr);return{domain:{name:"zkSync",version:"2",chainId:fr.chainId},types:{Transaction:[{name:"txType",type:"uint256"},{name:"from",type:"uint256"},{name:"to",type:"uint256"},{name:"gasLimit",type:"uint256"},{name:"gasPerPubdataByteLimit",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymaster",type:"uint256"},{name:"nonce",type:"uint256"},{name:"value",type:"uint256"},{name:"data",type:"bytes"},{name:"factoryDeps",type:"bytes32[]"},{name:"paymasterInput",type:"bytes"}]},primaryType:"Transaction",message:br}};function transactionToMessage(fr){const{gas:br,nonce:wr,to:Er,from:kr,value:jr,maxFeePerGas:Br,maxPriorityFeePerGas:Wr,factoryDeps:qr,paymaster:Gr,paymasterInput:Vr,gasPerPubdata:Zr,data:Jr}=fr;return{txType:113n,from:BigInt(kr),to:Er?BigInt(Er):0n,gasLimit:br??0n,gasPerPubdataByteLimit:Zr??gasPerPubdataDefault,maxFeePerGas:Br??0n,maxPriorityFeePerGas:Wr??0n,paymaster:Gr?BigInt(Gr):0n,nonce:wr?BigInt(wr):0n,value:jr??0n,data:Jr||"0x0",factoryDeps:(qr==null?void 0:qr.map(Qr=>toHex(hashBytecode(Qr))))??[],paymasterInput:Vr||"0x"}}const chainConfig$3={formatters:formatters$2,serializers:serializers$2,custom:{getEip712Domain}},abstractTestnet=defineChain({...chainConfig$3,id:11124,name:"Abstract Testnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://api.testnet.abs.xyz"]}},blockExplorers:{default:{name:"Abstract Block Explorer",url:"https://explorer.testnet.abs.xyz"}},testnet:!0,contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963",blockCreated:358349},universalSignatureVerifier:{address:"0xfB688330379976DA81eB64Fe4BF50d7401763B9C",blockCreated:431682}}}),acala=defineChain({id:787,name:"Acala",network:"acala",nativeCurrency:{name:"Acala",symbol:"ACA",decimals:18},rpcUrls:{default:{http:["https://eth-rpc-acala.aca-api.network"],webSocket:["wss://eth-rpc-acala.aca-api.network"]}},blockExplorers:{default:{name:"Acala Blockscout",url:"https://blockscout.acala.network",apiUrl:"https://blockscout.acala.network/api"}},testnet:!1}),acria=defineChain({id:47,name:"Acria IntelliChain",nativeCurrency:{decimals:18,name:"ACRIA",symbol:"ACRIA"},rpcUrls:{default:{http:["https://aic.acria.ai"]}},blockExplorers:{default:{name:"Acria Explorer",url:"https://explorer.acria.ai"}},testnet:!1}),aioz=defineChain({id:168,name:"AIOZ Network",nativeCurrency:{decimals:18,name:"AIOZ",symbol:"AIOZ"},rpcUrls:{default:{http:["https://eth-dataseed.aioz.network"]}},blockExplorers:{default:{name:"AIOZ Explorer",url:"https://explorer.aioz.network"}},testnet:!1}),alienx=defineChain({id:10241024,name:"AlienX Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.alienxchain.io/http"]}},blockExplorers:{default:{name:"AlienX Explorer",url:"https://explorer.alienxchain.io"}},testnet:!1}),alienxHalTestnet=defineChain({id:10241025,name:"ALIENX Hal Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://hal-rpc.alienxchain.io/http"]}},blockExplorers:{default:{name:"AlienX Explorer",url:"https://hal-explorer.alienxchain.io"}},testnet:!0}),contracts={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},formatters$1={block:defineBlock({format(fr){var wr;return{transactions:(wr=fr.transactions)==null?void 0:wr.map(Er=>{if(typeof Er=="string")return Er;const kr=formatTransaction(Er);return kr.typeHex==="0x7e"&&(kr.isSystemTx=Er.isSystemTx,kr.mint=Er.mint?hexToBigInt(Er.mint):void 0,kr.sourceHash=Er.sourceHash,kr.type="deposit"),kr}),stateRoot:fr.stateRoot}}}),transaction:defineTransaction({format(fr){const br={};return fr.type==="0x7e"&&(br.isSystemTx=fr.isSystemTx,br.mint=fr.mint?hexToBigInt(fr.mint):void 0,br.sourceHash=fr.sourceHash,br.type="deposit"),br}}),transactionReceipt:defineTransactionReceipt({format(fr){return{l1GasPrice:fr.l1GasPrice?hexToBigInt(fr.l1GasPrice):null,l1GasUsed:fr.l1GasUsed?hexToBigInt(fr.l1GasUsed):null,l1Fee:fr.l1Fee?hexToBigInt(fr.l1Fee):null,l1FeeScalar:fr.l1FeeScalar?Number(fr.l1FeeScalar):null}}})};function serializeTransaction$2(fr,br){return isDeposit(fr)?serializeTransactionDeposit(fr):serializeTransaction$4(fr,br)}const serializers$1={transaction:serializeTransaction$2};function serializeTransactionDeposit(fr){assertTransactionDeposit(fr);const{sourceHash:br,data:wr,from:Er,gas:kr,isSystemTx:jr,mint:Br,to:Wr,value:qr}=fr,Gr=[br,Er,Wr??"0x",Br?toHex(Br):"0x",qr?toHex(qr):"0x",kr?toHex(kr):"0x",jr?"0x1":"0x",wr??"0x"];return concatHex(["0x7e",toRlp(Gr)])}function isDeposit(fr){return fr.type==="deposit"||typeof fr.sourceHash<"u"}function assertTransactionDeposit(fr){const{from:br,to:wr}=fr;if(br&&!isAddress(br))throw new InvalidAddressError({address:br});if(wr&&!isAddress(wr))throw new InvalidAddressError({address:wr})}const chainConfig$2={contracts,formatters:formatters$1,serializers:serializers$1},sourceId$J=1,ancient8=defineChain({...chainConfig$2,id:888888888,name:"Ancient8",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.ancient8.gg"]}},blockExplorers:{default:{name:"Ancient8 explorer",url:"https://scan.ancient8.gg",apiUrl:"https://scan.ancient8.gg/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$J]:{address:"0xB09DC08428C8b4EFB4ff9C0827386CDF34277996"}},portal:{[sourceId$J]:{address:"0x639F2AECE398Aa76b07e59eF6abe2cFe32bacb68",blockCreated:19070571}},l1StandardBridge:{[sourceId$J]:{address:"0xd5e3eDf5b68135D559D572E26bF863FBC1950033",blockCreated:19070571}}},sourceId:sourceId$J}),sourceId$I=11155111,ancient8Sepolia=defineChain({...chainConfig$2,id:28122024,name:"Ancient8 Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpcv2-testnet.ancient8.gg"]}},blockExplorers:{default:{name:"Ancient8 Celestia Testnet explorer",url:"https://scanv2-testnet.ancient8.gg",apiUrl:"https://scanv2-testnet.ancient8.gg/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$I]:{address:"0x942fD5017c0F60575930D8574Eaca13BEcD6e1bB"}},portal:{[sourceId$I]:{address:"0xfa1d9E26A6aCD7b22115D27572c1221B9803c960",blockCreated:4972908}},l1StandardBridge:{[sourceId$I]:{address:"0xF6Bc0146d3c74D48306e79Ae134A260E418C9335",blockCreated:4972908}}},sourceId:sourceId$I}),anvil=defineChain({id:31337,name:"Anvil",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"],webSocket:["ws://127.0.0.1:8545"]}}}),sourceId$H=42161,apeChain=defineChain({id:33139,name:"Ape Chain",nativeCurrency:{name:"ApeCoin",symbol:"APE",decimals:18},rpcUrls:{default:{http:["https://rpc.apechain.com/http"],webSocket:["wss://rpc.apechain.com/ws"]}},blockExplorers:{default:{name:"Apescan",url:"https://apescan.io",apiUrl:"https://api.apescan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:20889}},sourceId:sourceId$H}),apexTestnet=defineChain({id:3993,name:"APEX Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.apexlayer.xyz"]}},blockExplorers:{default:{name:"Blockscout",url:"https://exp-testnet.apexlayer.xyz",apiUrl:"https://exp-testnet.apexlayer.xyz/api"}},contracts:{multicall3:{address:"0xf7642be33a6b18D16a995657adb5a68CD0438aE2",blockCreated:283775}},testnet:!0}),arbitrum=defineChain({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),arbitrumGoerli=defineChain({id:421613,name:"Arbitrum Goerli",nativeCurrency:{name:"Arbitrum Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://goerli.arbiscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:88114}},testnet:!0}),arbitrumNova=defineChain({id:42170,name:"Arbitrum Nova",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://nova.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://nova.arbiscan.io",apiUrl:"https://api-nova.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1746963}}}),arbitrumSepolia=defineChain({id:421614,name:"Arbitrum Sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://sepolia.arbiscan.io",apiUrl:"https://api-sepolia.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:81930}},testnet:!0}),areonNetwork=defineChain({id:463,name:"Areon Network",nativeCurrency:{decimals:18,name:"AREA",symbol:"AREA"},rpcUrls:{default:{http:["https://mainnet-rpc.areon.network"],webSocket:["wss://mainnet-ws.areon.network"]}},blockExplorers:{default:{name:"Areonscan",url:"https://areonscan.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:353286}},testnet:!1}),areonNetworkTestnet=defineChain({id:462,name:"Areon Network Testnet",nativeCurrency:{decimals:18,name:"TAREA",symbol:"TAREA"},rpcUrls:{default:{http:["https://testnet-rpc.areon.network"],webSocket:["wss://testnet-ws.areon.network"]}},blockExplorers:{default:{name:"Areonscan",url:"https://areonscan.com"}},testnet:!0}),artelaTestnet=defineChain({id:11822,name:"Artela Testnet",nativeCurrency:{name:"ART",symbol:"ART",decimals:18},rpcUrls:{default:{http:["https://betanet-rpc1.artela.network"]}},blockExplorers:{default:{name:"Artela",url:"https://betanet-scan.artela.network",apiUrl:"https://betanet-scan.artela.network/api"}},contracts:{multicall3:{address:"0xd07c8635f76e8745Ee7092fbb6e8fbc5FeF09DD7",blockCreated:7001871}},testnet:!0}),assetChain=defineChain({id:42420,name:"AssetChain Mainnet",nativeCurrency:{decimals:18,name:"Real World Asset",symbol:"RWA"},rpcUrls:{default:{http:["https://mainnet-rpc.assetchain.org"]}},blockExplorers:{default:{name:"Asset Chain Explorer",url:"https://scan.assetchain.org",apiUrl:"https://scan.assetchain.org/api"}},testnet:!1,contracts:{}}),assetChainTestnet=defineChain({id:42421,name:"AssetChain Testnet",nativeCurrency:{decimals:18,name:"Real World Asset",symbol:"RWA"},rpcUrls:{default:{http:["https://enugu-rpc.assetchain.org"]}},blockExplorers:{default:{name:"Asset Chain Testnet Explorer",url:"https://scan-testnet.assetchain.org",apiUrl:"https://scan-testnet.assetchain.org/api"}},testnet:!0,contracts:{multicall3:{address:"0x989F832D35988cb5e3eB001Fa2Fe789469EC31Ea",blockCreated:17177}}}),astar=defineChain({id:592,name:"Astar",network:"astar-mainnet",nativeCurrency:{name:"Astar",symbol:"ASTR",decimals:18},rpcUrls:{default:{http:["https://astar.api.onfinality.io/public"]}},blockExplorers:{default:{name:"Astar Subscan",url:"https://astar.subscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:761794}},testnet:!1}),astarZkEVM=defineChain({id:3776,name:"Astar zkEVM",network:"AstarZkEVM",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-zkevm.astar.network"]}},blockExplorers:{default:{name:"Astar zkEVM Explorer",url:"https://astar-zkevm.explorer.startale.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:93528}},testnet:!1}),astarZkyoto=defineChain({id:6038361,name:"Astar zkEVM Testnet zKyoto",network:"zKyoto",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.startale.com/zkyoto"]}},blockExplorers:{default:{name:"zKyoto Explorer",url:"https://zkyoto.explorer.startale.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:196153}},testnet:!0}),atletaOlympia=defineChain({id:2340,name:"Atleta Olympia",nativeCurrency:{decimals:18,name:"Atla",symbol:"ATLA"},rpcUrls:{default:{http:["https://testnet-rpc.atleta.network:9944","https://testnet-rpc.atleta.network"],ws:["wss://testnet-rpc.atleta.network:9944"]}},blockExplorers:{default:{name:"Atleta Olympia Explorer",url:"https://blockscout.atleta.network",apiUrl:"https://blockscout.atleta.network/api"}},contracts:{multicall3:{address:"0x1472ec6392180fb84F345d2455bCC75B26577115",blockCreated:1076473}},testnet:!0}),aurora=defineChain({id:1313161554,name:"Aurora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://mainnet.aurora.dev"]}},blockExplorers:{default:{name:"Aurorascan",url:"https://aurorascan.dev",apiUrl:"https://aurorascan.dev/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:62907816}}}),auroraTestnet=defineChain({id:1313161555,name:"Aurora Testnet",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.aurora.dev"]}},blockExplorers:{default:{name:"Aurorascan",url:"https://testnet.aurorascan.dev",apiUrl:"https://testnet.aurorascan.dev/api"}},testnet:!0}),auroria=defineChain({id:205205,name:"Auroria Testnet",network:"auroria",nativeCurrency:{name:"Auroria Stratis",symbol:"tSTRAX",decimals:18},rpcUrls:{default:{http:["https://auroria.rpc.stratisevm.com"]}},blockExplorers:{default:{name:"Auroria Testnet Explorer",url:"https://auroria.explorer.stratisevm.com"}},testnet:!0}),avalanche=defineChain({id:43114,name:"Avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{default:{name:"SnowTrace",url:"https://snowtrace.io",apiUrl:"https://api.snowtrace.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:11907934}}}),avalancheFuji=defineChain({id:43113,name:"Avalanche Fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{default:{name:"SnowTrace",url:"https://testnet.snowtrace.io",apiUrl:"https://api-testnet.snowtrace.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7096959}},testnet:!0}),sourceId$G=8453,b3=defineChain({id:8333,name:"B3",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet-rpc.b3.fun/http"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.b3.fun"}},sourceId:sourceId$G}),sourceId$F=168587773,b3Sepolia=defineChain({id:1993,name:"B3 Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.b3.fun/http"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia.explorer.b3.fun"}},testnet:!0,sourceId:sourceId$F}),bahamut=defineChain({id:5165,network:"bahamut",name:"Bahamut",nativeCurrency:{name:"Fasttoken",symbol:"FTN",decimals:18},rpcUrls:{default:{http:["https://rpc1.bahamut.io","https://bahamut-rpc.publicnode.com","https://rpc2.bahamut.io"],webSocket:["wss://ws1.sahara.bahamutchain.com","wss://bahamut-rpc.publicnode.com","wss://ws2.sahara.bahamutchain.com"]}},blockExplorers:{default:{name:"Ftnscan",url:"https://www.ftnscan.com",apiUrl:"https://www.ftnscan.com/api"}}}),sourceId$E=1,base$7=defineChain({...chainConfig$2,id:8453,name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://basescan.org",apiUrl:"https://api.basescan.org/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$E]:{address:"0x43edB88C4B80fDD2AdFF2412A7BebF9dF42cB40e"}},l2OutputOracle:{[sourceId$E]:{address:"0x56315b90c40730925ec5485cf004d835058518A0"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:5022},portal:{[sourceId$E]:{address:"0x49048044D57e1C92A77f79988d21Fa8fAF74E97e",blockCreated:17482143}},l1StandardBridge:{[sourceId$E]:{address:"0x3154Cf16ccdb4C6d922629664174b904d80F2C35",blockCreated:17482143}}},sourceId:sourceId$E}),sourceId$D=5,baseGoerli=defineChain({...chainConfig$2,id:84531,name:"Base Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://goerli.basescan.org",apiUrl:"https://goerli.basescan.org/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$D]:{address:"0x2A35891ff30313CcFa6CE88dcf3858bb075A2298"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1376988},portal:{[sourceId$D]:{address:"0xe93c8cD0D409341205A592f8c4Ac1A5fe5585cfA"}},l1StandardBridge:{[sourceId$D]:{address:"0xfA6D8Ee5BE770F84FC001D098C4bD604Fe01284a"}}},testnet:!0,sourceId:sourceId$D}),sourceId$C=11155111,baseSepolia$1=defineChain({...chainConfig$2,id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://sepolia.basescan.org",apiUrl:"https://api-sepolia.basescan.org/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$C]:{address:"0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1"}},l2OutputOracle:{[sourceId$C]:{address:"0x84457ca9D0163FbC4bbfe4Dfbb20ba46e48DF254"}},portal:{[sourceId$C]:{address:"0x49f53e41452c74589e85ca1677426ba426459e85",blockCreated:4446677}},l1StandardBridge:{[sourceId$C]:{address:"0xfd0Bf71F60660E2f608ed56e1659C450eB113120",blockCreated:4446677}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1059647}},testnet:!0,sourceId:sourceId$C}),beam=defineChain({id:4337,name:"Beam",network:"beam",nativeCurrency:{decimals:18,name:"Beam",symbol:"BEAM"},rpcUrls:{default:{http:["https://build.onbeam.com/rpc"],webSocket:["wss://build.onbeam.com/ws"]}},blockExplorers:{default:{name:"Beam Explorer",url:"https://subnets.avax.network/beam"}},contracts:{multicall3:{address:"0x4956f15efdc3dc16645e90cc356eafa65ffc65ec",blockCreated:1}}}),beamTestnet=defineChain({id:13337,name:"Beam Testnet",network:"beam",nativeCurrency:{decimals:18,name:"Beam",symbol:"BEAM"},rpcUrls:{default:{http:["https://build.onbeam.com/rpc/testnet"],webSocket:["wss://build.onbeam.com/ws/testnet"]}},blockExplorers:{default:{name:"Beam Explorer",url:"https://subnets-test.avax.network/beam"}},contracts:{multicall3:{address:"0x9bf49b704ee2a095b95c1f2d4eb9010510c41c9e",blockCreated:3}},testnet:!0}),bearNetworkChainMainnet=defineChain({id:641230,name:"Bear Network Chain Mainnet",nativeCurrency:{decimals:18,name:"BearNetworkChain",symbol:"BRNKC"},rpcUrls:{default:{http:["https://brnkc-mainnet.bearnetwork.net"]}},blockExplorers:{default:{name:"BrnkScan",url:"https://brnkscan.bearnetwork.net",apiUrl:"https://brnkscan.bearnetwork.net/api"}}}),bearNetworkChainTestnet=defineChain({id:751230,name:"Bear Network Chain Testnet",nativeCurrency:{decimals:18,name:"tBRNKC",symbol:"tBRNKC"},rpcUrls:{default:{http:["https://brnkc-test.bearnetwork.net"]}},blockExplorers:{default:{name:"BrnkTestScan",url:"https://brnktest-scan.bearnetwork.net",apiUrl:"https://brnktest-scan.bearnetwork.net/api"}},testnet:!0}),berachainTestnet=defineChain({id:80085,name:"Berachain Artio",nativeCurrency:{decimals:18,name:"BERA Token",symbol:"BERA"},rpcUrls:{default:{http:["https://artio.rpc.berachain.com"]}},blockExplorers:{default:{name:"Berachain",url:"https://artio.beratrail.io"}},testnet:!0}),berachainTestnetbArtio=defineChain({id:80084,name:"Berachain bArtio",nativeCurrency:{decimals:18,name:"BERA Token",symbol:"BERA"},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:109269}},rpcUrls:{default:{http:["https://bartio.rpc.berachain.com"]}},blockExplorers:{default:{name:"Berachain bArtio Beratrail",url:"https://bartio.beratrail.io"}},testnet:!0}),bevmMainnet=defineChain({id:11501,name:"BEVM Mainnet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://rpc-mainnet-1.bevm.io"]}},blockExplorers:{default:{name:"Bevmscan",url:"https://scan-mainnet.bevm.io",apiUrl:"https://scan-mainnet-api.bevm.io/api"}}}),bifrost=defineChain({id:3068,name:"Bifrost Mainnet",nativeCurrency:{name:"BFC",symbol:"BFC",decimals:18},rpcUrls:{default:{http:["https://public-01.mainnet.bifrostnetwork.com/rpc"]}},blockExplorers:{default:{name:"Bifrost Blockscout",url:"https://explorer.mainnet.bifrostnetwork.com"}},testnet:!1}),bitgert=defineChain({id:32520,name:"Bitgert Mainnet",nativeCurrency:{decimals:18,name:"Brise",symbol:"Brise"},rpcUrls:{default:{http:["https://rpc-bitgert.icecreamswap.com"]}},blockExplorers:{default:{name:"Bitgert Scan",url:"https://brisescan.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2118034}},testnet:!1}),bitkub=defineChain({id:96,name:"Bitkub",nativeCurrency:{name:"Bitkub",symbol:"KUB",decimals:18},rpcUrls:{default:{http:["https://rpc.bitkubchain.io"]}},blockExplorers:{default:{name:"Bitkub Chain Mainnet Explorer",url:"https://www.bkcscan.com",apiUrl:"https://www.bkcscan.com/api"}}}),bitkubTestnet=defineChain({id:25925,name:"Bitkub Testnet",network:"Bitkub Testnet",nativeCurrency:{name:"Bitkub Test",symbol:"tKUB",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.bitkubchain.io"]}},blockExplorers:{default:{name:"Bitkub Chain Testnet Explorer",url:"https://testnet.bkcscan.com",apiUrl:"https://testnet.bkcscan.com/api"}},testnet:!0}),bitlayer=defineChain({id:200901,name:"Bitlayer Mainnet",nativeCurrency:{name:"BTC",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://rpc.bitlayer.org"],webSocket:["wss://ws.bitlayer.org"]}},blockExplorers:{default:{name:"bitlayer mainnet scan",url:"https://www.btrscan.com"}}}),bitlayerTestnet=defineChain({id:200810,name:"Bitlayer Testnet",nativeCurrency:{name:"BTC",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.bitlayer.org"],webSocket:["wss://testnet-ws.bitlayer.org"]}},blockExplorers:{default:{name:"bitlayer testnet scan",url:"https://testnet.btrscan.com"}},testnet:!0}),bitrock=defineChain({id:7171,name:"Bitrock Mainnet",nativeCurrency:{name:"BROCK",symbol:"BROCK",decimals:18},rpcUrls:{default:{http:["https://brockrpc.io"]}},blockExplorers:{default:{name:"Bitrock Explorer",url:"https://explorer.bit-rock.io"}},testnet:!1}),bitTorrent=defineChain({id:199,name:"BitTorrent",network:"bittorrent-chain-mainnet",nativeCurrency:{name:"BitTorrent",symbol:"BTT",decimals:18},rpcUrls:{default:{http:["https://rpc.bittorrentchain.io"]}},blockExplorers:{default:{name:"Bttcscan",url:"https://bttcscan.com",apiUrl:"https://api.bttcscan.com/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:31078552}}}),bitTorrentTestnet=defineChain({id:1028,name:"BitTorrent Chain Testnet",network:"bittorrent-chain-testnet",nativeCurrency:{name:"BitTorrent",symbol:"BTT",decimals:18},rpcUrls:{default:{http:["https://testrpc.bittorrentchain.io"]}},blockExplorers:{default:{name:"Bttcscan",url:"https://testnet.bttcscan.com",apiUrl:"https://testnet.bttcscan.com/api"}},testnet:!0}),sourceId$B=1,blast=defineChain({id:81457,name:"Blast",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.blast.io"]}},blockExplorers:{default:{name:"Blastscan",url:"https://blastscan.io",apiUrl:"https://api.blastscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:212929}},sourceId:sourceId$B}),sourceId$A=11155111,blastSepolia=defineChain({id:168587773,name:"Blast Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.blast.io"]}},blockExplorers:{default:{name:"Blastscan",url:"https://sepolia.blastscan.io",apiUrl:"https://api-sepolia.blastscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:756690}},testnet:!0,sourceId:sourceId$A}),sourceId$z=1,bob=defineChain({...chainConfig$2,id:60808,name:"BOB",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.gobob.xyz"],webSocket:["wss://rpc.gobob.xyz"]}},blockExplorers:{default:{name:"BOB Explorer",url:"https://explorer.gobob.xyz"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:23131},l2OutputOracle:{[sourceId$z]:{address:"0xdDa53E23f8a32640b04D7256e651C1db98dB11C1",blockCreated:4462615}},portal:{[sourceId$z]:{address:"0x8AdeE124447435fE03e3CD24dF3f4cAE32E65a3E",blockCreated:4462615}}},sourceId:sourceId$z}),boba=defineChain({id:288,name:"Boba Network",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://mainnet.boba.network"]}},blockExplorers:{default:{name:"BOBAScan",url:"https://bobascan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:446859}}}),bobaSepolia=defineChain({id:28882,name:"Boba Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.boba.network"]}},blockExplorers:{default:{name:"BOBAScan",url:"https://testnet.bobascan.com"}},testnet:!0}),sourceId$y=11155111,bobSepolia=defineChain({...chainConfig$2,id:808813,name:"BOB Sepolia",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://bob-sepolia.rpc.gobob.xyz"],webSocket:["wss://bob-sepolia.rpc.gobob.xyz"]}},blockExplorers:{default:{name:"BOB Sepolia Explorer",url:"https://bob-sepolia.explorer.gobob.xyz"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:35677},l2OutputOracle:{[sourceId$y]:{address:"0x14D0069452b4AE2b250B395b8adAb771E4267d2f",blockCreated:4462615}},portal:{[sourceId$y]:{address:"0x867B1Aa872b9C8cB5E9F7755feDC45BB24Ad0ae4",blockCreated:4462615}}},testnet:!0,sourceId:sourceId$y}),boolBetaMainnet=defineChain({id:11100,name:"Bool Beta Mainnet",nativeCurrency:{decimals:18,name:"BOL",symbol:"BOL"},rpcUrls:{default:{http:["https://beta-rpc-node-http.bool.network"]}},blockExplorers:{default:{name:"BoolScan",url:"https://beta-mainnet.boolscan.com/"}},testnet:!1}),botanixTestnet=defineChain({id:3636,name:"Botanix Testnet",nativeCurrency:{name:"Botanix",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://poa-node.botanixlabs.dev"]}},blockExplorers:{default:{name:"blockscout",url:"https://blockscout.botanixlabs.dev",apiUrl:"https://blockscout.botanixlabs.dev"}},testnet:!0}),bounceBit=defineChain({id:6001,name:"BounceBit Mainnet",nativeCurrency:{name:"BounceBit",symbol:"BB",decimals:18},rpcUrls:{default:{http:["https://fullnode-mainnet.bouncebitapi.com"]}},blockExplorers:{default:{name:"BB Scan",url:"https://bbscan.io"}},testnet:!1}),bounceBitTestnet=defineChain({id:6e3,name:"BounceBit Testnet",nativeCurrency:{name:"BounceBit",symbol:"BB",decimals:18},rpcUrls:{default:{http:["https://fullnode-testnet.bouncebitapi.com"]}},blockExplorers:{default:{name:"BB Scan",url:"https://testnet.bbscan.io"}},testnet:!0}),bronos=defineChain({id:1039,name:"Bronos",nativeCurrency:{decimals:18,name:"BRO",symbol:"BRO"},rpcUrls:{default:{http:["https://evm.bronos.org"]}},blockExplorers:{default:{name:"BronoScan",url:"https://broscan.bronos.org"}}}),bronosTestnet=defineChain({id:1038,name:"Bronos Testnet",nativeCurrency:{decimals:18,name:"Bronos Coin",symbol:"tBRO"},rpcUrls:{default:{http:["https://evm-testnet.bronos.org"]}},blockExplorers:{default:{name:"BronoScan",url:"https://tbroscan.bronos.org"}},testnet:!0}),bsc=defineChain({id:56,name:"BNB Smart Chain",nativeCurrency:{decimals:18,name:"BNB",symbol:"BNB"},rpcUrls:{default:{http:["https://rpc.ankr.com/bsc"]}},blockExplorers:{default:{name:"BscScan",url:"https://bscscan.com",apiUrl:"https://api.bscscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15921452}}}),bscGreenfield=defineChain({id:1017,name:"BNB Greenfield Chain",nativeCurrency:{decimals:18,name:"BNB",symbol:"BNB"},rpcUrls:{default:{http:["https://greenfield-chain.bnbchain.org"]}},blockExplorers:{default:{name:"BNB Greenfield Mainnet Scan",url:"https://greenfieldscan.com"}},testnet:!1}),bscTestnet=defineChain({id:97,name:"Binance Smart Chain Testnet",nativeCurrency:{decimals:18,name:"BNB",symbol:"tBNB"},rpcUrls:{default:{http:["https://data-seed-prebsc-1-s1.bnbchain.org:8545"]}},blockExplorers:{default:{name:"BscScan",url:"https://testnet.bscscan.com",apiUrl:"https://api-testnet.bscscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:17422483}},testnet:!0}),bsquared=defineChain({id:223,name:"B2",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://rpc.bsquared.network"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer.bsquared.network"}}}),bsquaredTestnet=defineChain({id:1123,name:"B2 Testnet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.bsquared.network"]}},blockExplorers:{default:{name:"blockscout",url:"https://testnet-explorer.bsquared.network"}},testnet:!0}),btr=defineChain({id:200901,name:"Bitlayer",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://rpc.bitlayer.org","https://rpc.bitlayer-rpc.com","https://rpc.ankr.com/bitlayer"],webSocket:["wss://ws.bitlayer.org","wss://ws.bitlayer-rpc.com"]}},blockExplorers:{default:{name:"Bitlayer(BTR) Scan",url:"https://www.btrscan.com"}}}),btrTestnet=defineChain({id:200810,name:"Bitlayer Testnet",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.bitlayer.org"],webSocket:["wss://testnet-ws.bitlayer.org","wss://testnet-ws.bitlayer-rpc.com"]}},blockExplorers:{default:{name:"Bitlayer(BTR) Scan",url:"https://testnet.btrscan.com"}},testnet:!0}),bxn=defineChain({id:4999,name:"BlackFort Exchange Network",nativeCurrency:{name:"BlackFort Token",symbol:"BXN",decimals:18},rpcUrls:{default:{http:["https://mainnet.blackfort.network/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.blackfort.network",apiUrl:"https://explorer.blackfort.network/api"}}}),bxnTestnet=defineChain({id:4777,name:"BlackFort Exchange Network Testnet",nativeCurrency:{name:"BlackFort Testnet Token",symbol:"TBXN",decimals:18},rpcUrls:{default:{http:["https://testnet.blackfort.network/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet-explorer.blackfort.network",apiUrl:"https://testnet-explorer.blackfort.network/api"}},testnet:!0}),cannon=defineChain({id:13370,name:"Cannon",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"]}}}),canto=defineChain({id:7700,name:"Canto",nativeCurrency:{decimals:18,name:"Canto",symbol:"CANTO"},rpcUrls:{default:{http:["https://canto.gravitychain.io"]}},blockExplorers:{default:{name:"Tuber.Build (Blockscout)",url:"https://tuber.build"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:2905789}}}),fees={estimateFeesPerGas:async fr=>{var kr;if(!((kr=fr.request)!=null&&kr.feeCurrency))return null;const[br,wr]=await Promise.all([estimateFeePerGasInFeeCurrency(fr.client,fr.request.feeCurrency),estimateMaxPriorityFeePerGasInFeeCurrency(fr.client,fr.request.feeCurrency)]);return{maxFeePerGas:fr.multiply(br)+wr,maxPriorityFeePerGas:wr}}};async function estimateFeePerGasInFeeCurrency(fr,br){const wr=await fr.request({method:"eth_gasPrice",params:[br]});return BigInt(wr)}async function estimateMaxPriorityFeePerGasInFeeCurrency(fr,br){const wr=await fr.request({method:"eth_maxPriorityFeePerGas",params:[br]});return BigInt(wr)}function isEmpty(fr){return fr===0||fr===0n||fr===void 0||fr===null||fr==="0"||fr===""||typeof fr=="string"&&(trim(fr).toLowerCase()==="0x"||trim(fr).toLowerCase()==="0x00")}function isPresent(fr){return!isEmpty(fr)}function isEIP1559(fr){return typeof fr.maxFeePerGas<"u"&&typeof fr.maxPriorityFeePerGas<"u"}function isCIP64(fr){return fr.type==="cip64"?!0:isEIP1559(fr)&&isPresent(fr.feeCurrency)}const formatters={block:defineBlock({format(fr){var wr;return{transactions:(wr=fr.transactions)==null?void 0:wr.map(Er=>typeof Er=="string"?Er:{...formatTransaction(Er),...Er.gatewayFee?{gatewayFee:hexToBigInt(Er.gatewayFee),gatewayFeeRecipient:Er.gatewayFeeRecipient}:{},feeCurrency:Er.feeCurrency}),...fr.randomness?{randomness:fr.randomness}:{}}}}),transaction:defineTransaction({format(fr){if(fr.type==="0x7e")return{isSystemTx:fr.isSystemTx,mint:fr.mint?hexToBigInt(fr.mint):void 0,sourceHash:fr.sourceHash,type:"deposit"};const br={feeCurrency:fr.feeCurrency};return fr.type==="0x7b"?br.type="cip64":(fr.type==="0x7c"&&(br.type="cip42"),br.gatewayFee=fr.gatewayFee?hexToBigInt(fr.gatewayFee):null,br.gatewayFeeRecipient=fr.gatewayFeeRecipient),br}}),transactionRequest:defineTransactionRequest({format(fr){const br={};return fr.feeCurrency&&(br.feeCurrency=fr.feeCurrency),isCIP64(fr)&&(br.type="0x7b"),br}})};function serializeTransaction$1(fr,br){return isCIP64(fr)?serializeTransactionCIP64(fr,br):serializeTransaction$2(fr,br)}const serializers={transaction:serializeTransaction$1};function serializeTransactionCIP64(fr,br){assertTransactionCIP64(fr);const{chainId:wr,gas:Er,nonce:kr,to:jr,value:Br,maxFeePerGas:Wr,maxPriorityFeePerGas:qr,accessList:Gr,feeCurrency:Vr,data:Zr}=fr,Jr=[toHex(wr),kr?toHex(kr):"0x",qr?toHex(qr):"0x",Wr?toHex(Wr):"0x",Er?toHex(Er):"0x",jr??"0x",Br?toHex(Br):"0x",Zr??"0x",serializeAccessList(Gr),Vr,...toYParitySignatureArray(fr,br)];return concatHex(["0x7b",toRlp(Jr)])}const MAX_MAX_FEE_PER_GAS=maxUint256;function assertTransactionCIP64(fr){const{chainId:br,maxPriorityFeePerGas:wr,gasPrice:Er,maxFeePerGas:kr,to:jr,feeCurrency:Br}=fr;if(br<=0)throw new InvalidChainIdError({chainId:br});if(jr&&!isAddress(jr))throw new InvalidAddressError({address:jr});if(Er)throw new BaseError("`gasPrice` is not a valid CIP-64 Transaction attribute.");if(isPresent(kr)&&kr>MAX_MAX_FEE_PER_GAS)throw new FeeCapTooHighError({maxFeePerGas:kr});if(isPresent(wr)&&isPresent(kr)&&wr>kr)throw new TipAboveFeeCapError({maxFeePerGas:kr,maxPriorityFeePerGas:wr});if(isPresent(Br)&&!isAddress(Br))throw new BaseError("`feeCurrency` MUST be a token address for CIP-64 transactions.");if(isEmpty(Br))throw new BaseError("`feeCurrency` must be provided for CIP-64 transactions.")}const chainConfig$1={contracts,formatters,serializers,fees},celo=defineChain({...chainConfig$1,id:42220,name:"Celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://celoscan.io",apiUrl:"https://api.celoscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:13112599}},testnet:!1}),sourceId$x=17e3,celoAlfajores=defineChain({...chainConfig$1,id:44787,name:"Alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"A-CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Alfajores Explorer",url:"https://celo-alfajores.blockscout.com",apiUrl:"https://celo-alfajores.blockscout.com/api"}},contracts:{...chainConfig$1.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:14569001},portal:{[sourceId$x]:{address:"0x82527353927d8D069b3B452904c942dA149BA381",blockCreated:2411324}},disputeGameFactory:{[sourceId$x]:{address:"0xE28AAdcd9883746c0e5068F58f9ea06027b214cb",blockCreated:2411324}},l2OutputOracle:{[sourceId$x]:{address:"0x4a2635e9e4f6e45817b1D402ac4904c1d1752438",blockCreated:2411324}},l1StandardBridge:{[sourceId$x]:{address:"0xD1B0E0581973c9eB7f886967A606b9441A897037",blockCreated:2411324}}},testnet:!0}),chang=defineChain({id:5858,name:"Chang Chain Foundation Mainnet",nativeCurrency:{decimals:18,name:"CTH",symbol:"CTH"},rpcUrls:{default:{http:["https://rpc.cthscan.com"]}},blockExplorers:{default:{name:"Chang Chain explorer",url:"https://cthscan.com"}}}),chiliz=defineChain({id:88888,name:"Chiliz Chain",network:"chiliz-chain",nativeCurrency:{decimals:18,name:"CHZ",symbol:"CHZ"},rpcUrls:{default:{http:["https://rpc.ankr.com/chiliz","https://chiliz-rpc.publicnode.com"]}},blockExplorers:{default:{name:"Chiliz Explorer",url:"https://scan.chiliz.com",apiUrl:"https://scan.chiliz.com/api"}}}),chips=defineChain({id:2882,name:"Chips Network",network:"CHIPS",nativeCurrency:{decimals:18,name:"IOTA",symbol:"IOTA"},rpcUrls:{default:{http:["https://node.chips.ooo/wasp/api/v1/chains/iota1pp3d3mnap3ufmgqnjsnw344sqmf5svjh26y2khnmc89sv6788y3r207a8fn/evm"]}}}),classic=defineChain({id:61,name:"Ethereum Classic",nativeCurrency:{decimals:18,name:"ETC",symbol:"ETC"},rpcUrls:{default:{http:["https://etc.rivet.link"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.com/etc/mainnet"}}}),coinbit=defineChain({id:112,name:"Coinbit Mainnet",nativeCurrency:{name:"GIDR",symbol:"GIDR",decimals:18},rpcUrls:{default:{http:["https://coinbit-rpc-mainnet.chain.sbcrypto.app"]}},blockExplorers:{default:{name:"Coinbit Explorer",url:"https://coinbit-explorer.chain.sbcrypto.app"}},testnet:!1}),coinex=defineChain({id:52,name:"CoinEx Mainnet",nativeCurrency:{name:"cet",symbol:"cet",decimals:18},rpcUrls:{default:{http:["https://rpc.coinex.net"]}},blockExplorers:{default:{name:"CoinEx Explorer",url:"https://www.coinex.net"}},testnet:!1}),confluxESpace=defineChain({id:1030,name:"Conflux eSpace",nativeCurrency:{name:"Conflux",symbol:"CFX",decimals:18},rpcUrls:{default:{http:["https://evm.confluxrpc.com"],webSocket:["wss://evm.confluxrpc.com/ws"]}},blockExplorers:{default:{name:"ConfluxScan",url:"https://evm.confluxscan.io"}},contracts:{multicall3:{address:"0xEFf0078910f638cd81996cc117bccD3eDf2B072F",blockCreated:68602935}}}),confluxESpaceTestnet=defineChain({id:71,name:"Conflux eSpace Testnet",network:"cfx-espace-testnet",testnet:!0,nativeCurrency:{name:"Conflux",symbol:"CFX",decimals:18},rpcUrls:{default:{http:["https://evmtestnet.confluxrpc.com"],webSocket:["wss://evmtestnet.confluxrpc.com/ws"]}},blockExplorers:{default:{name:"ConfluxScan",url:"https://evmtestnet.confluxscan.io"}},contracts:{multicall3:{address:"0xEFf0078910f638cd81996cc117bccD3eDf2B072F",blockCreated:117499050}}}),coreDao=defineChain({id:1116,name:"Core Dao",nativeCurrency:{decimals:18,name:"Core",symbol:"CORE"},rpcUrls:{default:{http:["https://rpc.coredao.org"]}},blockExplorers:{default:{name:"CoreDao",url:"https://scan.coredao.org"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:11907934}},testnet:!1}),crab=defineChain({id:44,name:"Crab Network",nativeCurrency:{decimals:18,name:"Crab Network Native Token",symbol:"CRAB"},rpcUrls:{default:{http:["https://crab-rpc.darwinia.network"],webSocket:["wss://crab-rpc.darwinia.network"]}},blockExplorers:{default:{name:"Blockscout",url:"https://crab-scan.darwinia.network"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:3032593}}}),cronos=defineChain({id:25,name:"Cronos Mainnet",nativeCurrency:{decimals:18,name:"Cronos",symbol:"CRO"},rpcUrls:{default:{http:["https://evm.cronos.org"]}},blockExplorers:{default:{name:"Cronos Explorer",url:"https://explorer.cronos.org",apiUrl:"https://explorer-api.cronos.org/mainnet/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1963112}}}),cronosTestnet=defineChain({id:338,name:"Cronos Testnet",nativeCurrency:{decimals:18,name:"CRO",symbol:"tCRO"},rpcUrls:{default:{http:["https://evm-t3.cronos.org"]}},blockExplorers:{default:{name:"Cronos Explorer",url:"https://cronos.org/explorer/testnet3"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:10191251}},testnet:!0}),cronoszkEVM=defineChain({id:388,name:"Cronos zkEVM Mainnet",nativeCurrency:{decimals:18,name:"Cronos zkEVM CRO",symbol:"zkCRO"},rpcUrls:{default:{http:["https://mainnet.zkevm.cronos.org"]}},blockExplorers:{default:{name:"Cronos zkEVM (Mainnet) Chain Explorer",url:"https://explorer.zkevm.cronos.org"}}}),cronoszkEVMTestnet=defineChain({id:282,name:"Cronos zkEVM Testnet",nativeCurrency:{decimals:18,name:"Cronos zkEVM Test Coin",symbol:"zkTCRO"},rpcUrls:{default:{http:["https://testnet.zkevm.cronos.org"]}},blockExplorers:{default:{name:"Cronos zkEVM Testnet Explorer",url:"https://explorer.zkevm.cronos.org/testnet"}},testnet:!0}),crossbell=defineChain({id:3737,name:"Crossbell",nativeCurrency:{decimals:18,name:"CSB",symbol:"CSB"},rpcUrls:{default:{http:["https://rpc.crossbell.io"]}},blockExplorers:{default:{name:"CrossScan",url:"https://scan.crossbell.io",apiUrl:"https://scan.crossbell.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:38246031}}}),curtis=defineChain({id:33111,name:"Curtis",nativeCurrency:{name:"ApeCoin",symbol:"APE",decimals:18},rpcUrls:{default:{http:["https://rpc.curtis.apechain.com"]}},blockExplorers:{default:{name:"Curtis Explorer",url:"https://explorer.curtis.apechain.com"}},testnet:!0}),cyber=defineChain({id:7560,name:"Cyber",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cyber.alt.technology"]}},blockExplorers:{default:{name:"Blockscout",url:"https://cyberscan.co",apiUrl:"https://cyberscan.co/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:0}}}),cyberTestnet=defineChain({id:111557560,name:"Cyber Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cyber-testnet.alt.technology"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet.cyberscan.co",apiUrl:"https://testnet.cyberscan.co/api"}},contracts:{multicall3:{address:"0xffc391F0018269d4758AEA1a144772E8FB99545E",blockCreated:304545}},testnet:!0}),darwinia=defineChain({id:46,name:"Darwinia Network",nativeCurrency:{decimals:18,name:"RING",symbol:"RING"},rpcUrls:{default:{http:["https://rpc.darwinia.network"],webSocket:["wss://rpc.darwinia.network"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.darwinia.network"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:69420}}}),dchain=defineChain({...chainConfig$2,id:2716446429837e3,name:"Dchain",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://dchain-2716446429837000-1.jsonrpc.sagarpc.io"]}},blockExplorers:{default:{name:"Dchain Explorer",url:"https://dchain-2716446429837000-1.sagaexplorer.io",apiUrl:"https://api-dchain-2716446429837000-1.sagaexplorer.io/api"}},contracts:{...chainConfig$2.contracts}}),dchainTestnet=defineChain({...chainConfig$2,id:2713017997578e3,name:"Dchain Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://dchaintestnet-2713017997578000-1.jsonrpc.testnet.sagarpc.io"]}},blockExplorers:{default:{name:"Dchain Explorer",url:"https://dchaintestnet-2713017997578000-1.testnet.sagaexplorer.io",apiUrl:"https://api-dchaintestnet-2713017997578000-1.testnet.sagaexplorer.io/api"}},contracts:{...chainConfig$2.contracts}}),defichainEvm=defineChain({id:1130,network:"defichain-evm",name:"DeFiChain EVM Mainnet",nativeCurrency:{name:"DeFiChain",symbol:"DFI",decimals:18},rpcUrls:{default:{http:["https://eth.mainnet.ocean.jellyfishsdk.com"]}},blockExplorers:{default:{name:"DeFiScan",url:"https://meta.defiscan.live"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:137852}}}),defichainEvmTestnet=defineChain({id:1131,network:"defichain-evm-testnet",name:"DeFiChain EVM Testnet",nativeCurrency:{name:"DeFiChain",symbol:"DFI",decimals:18},rpcUrls:{default:{http:["https://eth.testnet.ocean.jellyfishsdk.com"]}},blockExplorers:{default:{name:"DeFiScan",url:"https://meta.defiscan.live/?network=TestNet"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:156462}},testnet:!0}),degen=defineChain({id:666666666,name:"Degen",nativeCurrency:{decimals:18,name:"Degen",symbol:"DEGEN"},rpcUrls:{default:{http:["https://rpc.degen.tips"],webSocket:["wss://rpc.degen.tips"]}},blockExplorers:{default:{name:"Degen Chain Explorer",url:"https://explorer.degen.tips",apiUrl:"https://explorer.degen.tips/api/v2"}}}),dfk=defineChain({id:53935,name:"DFK Chain",nativeCurrency:{decimals:18,name:"Jewel",symbol:"JEWEL"},rpcUrls:{default:{http:["https://subnets.avax.network/defi-kingdoms/dfk-chain/rpc"]}},blockExplorers:{default:{name:"DFKSubnetScan",url:"https://subnets.avax.network/defi-kingdoms"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14790551}}}),diode=defineChain({id:15,name:"Diode Prenet",nativeCurrency:{decimals:18,name:"DIODE",symbol:"DIODE"},rpcUrls:{default:{http:["https://prenet.diode.io:8443"],webSocket:["wss://prenet.diode.io:8443/ws"]}},blockExplorers:{default:{name:"Diode Explorer",url:"https://diode.io/prenet"}},testnet:!1}),disChain=defineChain({id:513100,name:"DisChain",nativeCurrency:{decimals:18,name:"DIS",symbol:"DIS"},rpcUrls:{default:{http:["https://rpc.dischain.xyz"]}},blockExplorers:{default:{name:"DisChain Explorer",url:"https://www.oklink.com/dis"}}}),dodochainTestnet=defineChain({id:53457,name:"DODOchain Testnet",nativeCurrency:{decimals:18,name:"DODO",symbol:"DODO"},rpcUrls:{default:{http:["https://dodochain-testnet.alt.technology"],webSocket:["wss://dodochain-testnet.alt.technology/ws"]}},blockExplorers:{default:{name:"DODOchain Testnet (Sepolia) Explorer",url:"https://testnet-scan.dodochain.com"}},testnet:!0}),dogechain=defineChain({id:2e3,name:"Dogechain",nativeCurrency:{decimals:18,name:"Wrapped Dogecoin",symbol:"WDOGE"},rpcUrls:{default:{http:["https://rpc.dogechain.dog"]}},blockExplorers:{default:{name:"DogeChainExplorer",url:"https://explorer.dogechain.dog",apiUrl:"https://explorer.dogechain.dog/api"}},contracts:{multicall3:{address:"0x68a8609a60a008EFA633dfdec592c03B030cC508",blockCreated:25384031}}}),dosChain=defineChain({id:7979,name:"DOS Chain",nativeCurrency:{decimals:18,name:"DOS Chain",symbol:"DOS"},rpcUrls:{default:{http:["https://main.doschain.com"]}},blockExplorers:{default:{name:"DOS Chain Explorer",url:"https://doscan.io",apiUrl:"https://api.doscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:161908}}}),dosChainTestnet=defineChain({id:3939,name:"DOS Chain Testnet",nativeCurrency:{decimals:18,name:"DOS Chain Testnet",symbol:"DOS"},rpcUrls:{default:{http:["https://test.doschain.com"]}},blockExplorers:{default:{name:"DOS Chain Testnet Explorer",url:"https://test.doscan.io",apiUrl:"https://api-test.doscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:69623}},testnet:!0}),dreyerxMainnet=defineChain({id:23451,name:"DreyerX Mainnet",nativeCurrency:{name:"DreyerX",symbol:"DRX",decimals:18},rpcUrls:{default:{http:["https://rpc.dreyerx.com"]}},blockExplorers:{default:{name:"DreyerX Scan",url:"https://scan.dreyerx.com"}}}),dreyerxTestnet=defineChain({id:23452,name:"DreyerX Testnet",nativeCurrency:{name:"DreyerX",symbol:"DRX",decimals:18},rpcUrls:{default:{http:["http://testnet-rpc.dreyerx.com"]}},blockExplorers:{default:{name:"DreyerX Testnet Scan",url:"https://testnet-scan.dreyerx.com"}},testnet:!0}),dustboyIoT=defineChain({id:555888,name:"DustBoy IoT",nativeCurrency:{name:"Ether",symbol:"DST",decimals:18},rpcUrls:{default:{http:["https://dustboy-rpc.jibl2.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://dustboy.jibl2.com",apiUrl:"https://dustboy.jibl2.com/api"}},contracts:{multicall3:{address:"0xFFD34aa2C62B2D52E00A361e466C229788f4eD6a",blockCreated:526569}},testnet:!1}),dymension=defineChain({id:1100,name:"Dymension",nativeCurrency:{name:"DYM",symbol:"DYM",decimals:18},rpcUrls:{default:{http:["https://dymension-evm-rpc.publicnode.com"],webSocket:["wss://dymension-evm-rpc.publicnode.com"]}},blockExplorers:{default:{name:"Dym FYI",url:"https://dym.fyi"}},testnet:!1}),edgeless=defineChain({id:2026,name:"Edgeless Network",nativeCurrency:{name:"Edgeless Wrapped ETH",symbol:"EwETH",decimals:18},rpcUrls:{default:{http:["https://rpc.edgeless.network/http"],webSocket:["wss://rpc.edgeless.network/ws"]}},blockExplorers:{default:{name:"Edgeless Explorer",url:"https://explorer.edgeless.network"}}}),edgelessTestnet=defineChain({id:202,name:"Edgeless Testnet",nativeCurrency:{name:"Edgeless Wrapped ETH",symbol:"EwETH",decimals:18},rpcUrls:{default:{http:["https://edgeless-testnet.rpc.caldera.xyz/http"],webSocket:["wss://edgeless-testnet.rpc.caldera.xyz/ws"]}},blockExplorers:{default:{name:"Edgeless Testnet Explorer",url:"https://testnet.explorer.edgeless.network"}}}),edgeware=defineChain({id:2021,name:"Edgeware EdgeEVM Mainnet",nativeCurrency:{decimals:18,name:"Edgeware",symbol:"EDG"},rpcUrls:{default:{http:["https://edgeware-evm.jelliedowl.net"]}},blockExplorers:{default:{name:"Edgscan by Bharathcoorg",url:"https://edgscan.live",apiUrl:"https://edgscan.live/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:18117872}}}),edgewareTestnet=defineChain({id:2022,name:"Beresheet BereEVM Testnet",nativeCurrency:{decimals:18,name:"Testnet EDG",symbol:"tEDG"},rpcUrls:{default:{http:["https://beresheet-evm.jelliedowl.net"]}},blockExplorers:{default:{name:"Edgscan by Bharathcoorg",url:"https://testnet.edgscan.live",apiUrl:"https://testnet.edgscan.live/api"}}}),ekta=defineChain({id:1994,name:"Ekta",nativeCurrency:{decimals:18,name:"EKTA",symbol:"EKTA"},rpcUrls:{default:{http:["https://main.ekta.io"]}},blockExplorers:{default:{name:"Ektascan",url:"https://ektascan.io",apiUrl:"https://ektascan.io/api"}}}),ektaTestnet=defineChain({id:1004,name:"Ekta Testnet",nativeCurrency:{decimals:18,name:"EKTA",symbol:"EKTA"},rpcUrls:{default:{http:["https://test.ekta.io:8545"]}},blockExplorers:{default:{name:"Test Ektascan",url:"https://test.ektascan.io",apiUrl:"https://test.ektascan.io/api"}},testnet:!0}),elastos=defineChain({id:20,name:"Elastos Smart Chain",nativeCurrency:{name:"ELA",symbol:"ELA",decimals:18},rpcUrls:{default:{http:["https://api2.elastos.io/eth"]}},blockExplorers:{default:{name:"Elastos Explorer",url:"https://esc.elastos.io"}},testnet:!1}),elastosTestnet=defineChain({id:21,name:"Elastos Smart Chain Testnet",nativeCurrency:{name:"tELA",symbol:"tELA",decimals:18},rpcUrls:{default:{http:["https://api-testnet.elastos.io/eth"]}},blockExplorers:{default:{name:"Elastos Explorer",url:"https://esc-testnet.elastos.io"}},testnet:!0}),electroneum=defineChain({id:52014,name:"Electroneum Mainnet",nativeCurrency:{name:"ETN",symbol:"ETN",decimals:18},rpcUrls:{default:{http:["https://rpc.electroneum.com"]}},blockExplorers:{default:{name:"Electroneum Block Explorer",url:"https://blockexplorer.electroneum.com"}},testnet:!1}),electroneumTestnet=defineChain({id:5201420,name:"Electroneum Testnet",nativeCurrency:{name:"ETN",symbol:"ETN",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.electroneum.com"]}},blockExplorers:{default:{name:"Electroneum Block Explorer",url:"https://blockexplorer.thesecurityteam.rocks"}},testnet:!0}),elysiumTestnet=defineChain({...chainConfig$2,id:1338,name:"Elysium Testnet",nativeCurrency:{decimals:18,name:"LAVA",symbol:"LAVA"},rpcUrls:{default:{http:["https://elysium-test-rpc.vulcanforged.com"]}},blockExplorers:{default:{name:"Elysium testnet explorer",url:"https://elysium-explorer.vulcanforged.com"}},testnet:!0}),energy=defineChain({id:246,name:"Energy Mainnet",nativeCurrency:{name:"EWT",symbol:"EWT",decimals:18},rpcUrls:{default:{http:["https://rpc.energyweb.org"]}},blockExplorers:{default:{name:"EnergyWeb Explorer",url:"https://explorer.energyweb.org"}},testnet:!1}),enuls=defineChain({id:119,name:"ENULS Mainnet",nativeCurrency:{decimals:18,name:"NULS",symbol:"NULS"},rpcUrls:{default:{http:["https://evmapi2.nuls.io"]}},blockExplorers:{default:{name:"ENULS Explorer",url:"https://evmscan.nuls.io"}},testnet:!1}),eon=defineChain({id:7332,name:"Horizen EON",nativeCurrency:{decimals:18,name:"ZEN",symbol:"ZEN"},rpcUrls:{default:{http:["https://eon-rpc.horizenlabs.io/ethv1"]}},blockExplorers:{default:{name:"EON Explorer",url:"https://eon-explorer.horizenlabs.io"}},contracts:{}}),eos=defineChain({id:17777,name:"EOS EVM",nativeCurrency:{decimals:18,name:"EOS",symbol:"EOS"},rpcUrls:{default:{http:["https://api.evm.eosnetwork.com"]}},blockExplorers:{default:{name:"EOS EVM Explorer",url:"https://explorer.evm.eosnetwork.com",apiUrl:"https://explorer.evm.eosnetwork.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7943933}}}),eosTestnet=defineChain({id:15557,name:"EOS EVM Testnet",nativeCurrency:{decimals:18,name:"EOS",symbol:"EOS"},rpcUrls:{default:{http:["https://api.testnet.evm.eosnetwork.com"]}},blockExplorers:{default:{name:"EOS EVM Testnet Explorer",url:"https://explorer.testnet.evm.eosnetwork.com",apiUrl:"https://explorer.testnet.evm.eosnetwork.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:9067940}},testnet:!0}),etherlink=defineChain({id:42793,name:"Etherlink",nativeCurrency:{decimals:18,name:"Tez",symbol:"XTZ"},rpcUrls:{default:{http:["https://node.mainnet.etherlink.com"]}},blockExplorers:{default:{name:"Etherlink",url:"https://explorer.etherlink.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:33899}}}),etherlinkTestnet=defineChain({id:128123,name:"Etherlink Testnet",nativeCurrency:{decimals:18,name:"Tez",symbol:"XTZ"},rpcUrls:{default:{http:["https://node.ghostnet.etherlink.com"]}},blockExplorers:{default:{name:"Etherlink Testnet",url:"https://testnet-explorer.etherlink.com"}},testnet:!0}),evmos=defineChain({id:9001,name:"Evmos",nativeCurrency:{decimals:18,name:"Evmos",symbol:"EVMOS"},rpcUrls:{default:{http:["https://eth.bd.evmos.org:8545"]}},blockExplorers:{default:{name:"Evmos Block Explorer",url:"https://escan.live"}}}),evmosTestnet=defineChain({id:9e3,name:"Evmos Testnet",nativeCurrency:{decimals:18,name:"Evmos",symbol:"EVMOS"},rpcUrls:{default:{http:["https://eth.bd.evmos.dev:8545"]}},blockExplorers:{default:{name:"Evmos Testnet Block Explorer",url:"https://evm.evmos.dev/"}}}),excelonMainnet=defineChain({id:22052002,name:"Excelon Mainnet",network:"XLON",nativeCurrency:{decimals:18,name:"Excelon",symbol:"xlon"},rpcUrls:{default:{http:["https://edgewallet1.xlon.org"]}},blockExplorers:{default:{name:"Excelon explorer",url:"https://explorer.excelon.io"}}}),expanse=defineChain({id:2,name:"Expanse Network",nativeCurrency:{decimals:18,name:"EXP",symbol:"EXP"},rpcUrls:{default:{http:["https://node.expanse.tech"]}},blockExplorers:{default:{name:"Expanse Explorer",url:"https://explorer.expanse.tech"}},testnet:!1}),fantom=defineChain({id:250,name:"Fantom",nativeCurrency:{decimals:18,name:"Fantom",symbol:"FTM"},rpcUrls:{default:{http:["https://rpc.ankr.com/fantom"]}},blockExplorers:{default:{name:"FTMScan",url:"https://ftmscan.com",apiUrl:"https://api.ftmscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:33001987}}}),fantomSonicTestnet=defineChain({id:64240,name:"Fantom Sonic Open Testnet",network:"fantom-sonic-testnet",nativeCurrency:{decimals:18,name:"Fantom",symbol:"FTM"},rpcUrls:{default:{http:["https://rpcapi.sonic.fantom.network"]}},blockExplorers:{default:{name:"Fantom Sonic Open Testnet Explorer",url:"https://public-sonic.fantom.network"}},testnet:!0}),fantomTestnet=defineChain({id:4002,name:"Fantom Testnet",nativeCurrency:{decimals:18,name:"Fantom",symbol:"FTM"},rpcUrls:{default:{http:["https://rpc.testnet.fantom.network"]}},blockExplorers:{default:{name:"FTMScan",url:"https://testnet.ftmscan.com",apiUrl:"https://testnet.ftmscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:8328688}},testnet:!0}),fibo=defineChain({id:12306,name:"Fibo Chain",nativeCurrency:{decimals:18,name:"fibo",symbol:"FIBO"},rpcUrls:{default:{http:["https://network.hzroc.art"]}},blockExplorers:{default:{name:"FiboScan",url:"https://scan.fibochain.org"}}}),filecoin=defineChain({id:314,name:"Filecoin Mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3328594}}}),filecoinCalibration=defineChain({id:314159,name:"Filecoin Calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}},testnet:!0}),filecoinHyperspace=defineChain({id:3141,name:"Filecoin Hyperspace",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.hyperspace.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://hyperspace.filfox.info/en"}},testnet:!0}),fireChain=defineChain({id:995,name:"5ireChain",nativeCurrency:{name:"5ire Token",symbol:"5IRE",decimals:18},rpcUrls:{default:{http:["https://rpc.5ire.network"]}},blockExplorers:{default:{name:"5ireChain Mainnet Explorer",url:"https://5irescan.io/"}},testnet:!1}),flare=defineChain({id:14,name:"Flare Mainnet",nativeCurrency:{decimals:18,name:"Flare",symbol:"FLR"},rpcUrls:{default:{http:["https://flare-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Flare Explorer",url:"https://flare-explorer.flare.network",apiUrl:"https://flare-explorer.flare.network/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3002461}}}),flareTestnet=defineChain({id:114,name:"Flare Testnet Coston2",nativeCurrency:{decimals:18,name:"Coston2 Flare",symbol:"C2FLR"},rpcUrls:{default:{http:["https://coston2-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Coston2 Explorer",url:"https://coston2-explorer.flare.network",apiUrl:"https://coston2-explorer.flare.network/api"}},testnet:!0}),flowMainnet=defineChain({id:747,name:"FlowEVM Mainnet",nativeCurrency:{decimals:18,name:"Flow",symbol:"FLOW"},rpcUrls:{default:{http:["https://mainnet.evm.nodes.onflow.org"]}},blockExplorers:{default:{name:"Mainnet Explorer",url:"https://flowdiver.io"}}}),flowPreviewnet=defineChain({id:646,name:"FlowEVM Previewnet",nativeCurrency:{decimals:18,name:"Flow",symbol:"FLOW"},rpcUrls:{default:{http:["https://previewnet.evm.nodes.onflow.org"]}},blockExplorers:{default:{name:"Previewnet Explorer",url:"https://previewnet.flowdiver.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:6205}}}),flowTestnet=defineChain({id:545,name:"FlowEVM Testnet",nativeCurrency:{decimals:18,name:"Flow",symbol:"FLOW"},rpcUrls:{default:{http:["https://testnet.evm.nodes.onflow.org"]}},blockExplorers:{default:{name:"Flow Diver",url:"https://testnet.flowdiver.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:137518}}}),fluence=defineChain({id:9999999,name:"Fluence",nativeCurrency:{name:"FLT",symbol:"FLT",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.fluence.dev"],webSocket:["wss://ws.mainnet.fluence.dev"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.mainnet.fluence.dev",apiUrl:"https://blockscout.mainnet.fluence.dev/api"}}}),fluenceStage=defineChain({id:123420000220,name:"Fluence Stage",nativeCurrency:{name:"tFLT",symbol:"tFLT",decimals:18},rpcUrls:{default:{http:["https://rpc.stage.fluence.dev"],webSocket:["wss://ws.stage.fluence.dev"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.stage.fluence.dev",apiUrl:"https://blockscout.stage.fluence.dev/api"}},testnet:!0}),fluenceTestnet=defineChain({id:52164803,name:"Fluence Testnet",nativeCurrency:{name:"tFLT",symbol:"tFLT",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.fluence.dev"],webSocket:["wss://ws.testnet.fluence.dev"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.testnet.fluence.dev",apiUrl:"https://blockscout.testnet.fluence.dev/api"}},testnet:!0}),forma=defineChain({id:984122,name:"Forma",network:"forma",nativeCurrency:{symbol:"TIA",name:"TIA",decimals:18},rpcUrls:{default:{http:["https://rpc.forma.art"],webSocket:["wss://ws.forma.art"]}},blockExplorers:{default:{name:"Forma Explorer",url:"https://explorer.forma.art"}},contracts:{multicall3:{address:"0xd53C6FFB123F7349A32980F87faeD8FfDc9ef079",blockCreated:252705}}}),foundry=defineChain({id:31337,name:"Foundry",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"],webSocket:["ws://127.0.0.1:8545"]}}}),sourceId$w=1,fraxtal=defineChain({...chainConfig$2,id:252,name:"Fraxtal",nativeCurrency:{name:"Frax Ether",symbol:"frxETH",decimals:18},rpcUrls:{default:{http:["https://rpc.frax.com"]}},blockExplorers:{default:{name:"fraxscan",url:"https://fraxscan.com",apiUrl:"https://api.fraxscan.com/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$w]:{address:"0x66CC916Ed5C6C2FA97014f7D1cD141528Ae171e4"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$w]:{address:"0x36cb65c1967A0Fb0EEE11569C51C2f2aA1Ca6f6D",blockCreated:19135323}},l1StandardBridge:{[sourceId$w]:{address:"0x34C0bD5877A5Ee7099D0f5688D65F4bB9158BDE2",blockCreated:19135323}}},sourceId:sourceId$w}),sourceId$v=17e3,fraxtalTestnet=defineChain({...chainConfig$2,id:2522,name:"Fraxtal Testnet",nativeCurrency:{name:"Frax Ether",symbol:"frxETH",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.frax.com"]}},blockExplorers:{default:{name:"fraxscan testnet",url:"https://holesky.fraxscan.com",apiUrl:"https://api-holesky.fraxscan.com/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$v]:{address:"0x715EA64DA13F4d0831ece4Ad3E8c1aa013167F32"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$v]:{address:"0xB9c64BfA498d5b9a8398Ed6f46eb76d90dE5505d",blockCreated:318416}},l1StandardBridge:{[sourceId$v]:{address:"0x0BaafC217162f64930909aD9f2B27125121d6332",blockCreated:318416}}},sourceId:sourceId$v}),sourceId$u=1,funkiMainnet=defineChain({...chainConfig$2,id:33979,name:"Funki",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-mainnet.funkichain.com"]}},blockExplorers:{default:{name:"Funki Mainnet Explorer",url:"https://funkiscan.io"}},contracts:{...chainConfig$2.contracts},sourceId:sourceId$u}),sourceId$t=11155111,funkiSepolia=defineChain({...chainConfig$2,id:3397901,network:"funkiSepolia",name:"Funki Sepolia Sandbox",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://funki-testnet.alt.technology"]}},blockExplorers:{default:{name:"Funki Sepolia Sandbox Explorer",url:"https://sepolia-sandbox.funkichain.com/"}},testnet:!0,contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1620204}},sourceId:sourceId$t}),fuse=defineChain({id:122,name:"Fuse",nativeCurrency:{name:"Fuse",symbol:"FUSE",decimals:18},rpcUrls:{default:{http:["https://rpc.fuse.io"]}},blockExplorers:{default:{name:"Fuse Explorer",url:"https://explorer.fuse.io",apiUrl:"https://explorer.fuse.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:16146628}}}),fuseSparknet=defineChain({id:123,name:"Fuse Sparknet",nativeCurrency:{name:"Spark",symbol:"SPARK",decimals:18},rpcUrls:{default:{http:["https://rpc.fusespark.io"]}},blockExplorers:{default:{name:"Sparkent Explorer",url:"https://explorer.fusespark.io",apiUrl:"https://explorer.fusespark.io/api"}}}),fusion=defineChain({id:32659,name:"Fusion Mainnet",nativeCurrency:{name:"Fusion",symbol:"FSN",decimals:18},rpcUrls:{default:{http:["https://mainnet.fusionnetwork.io"],webSocket:["wss://mainnet.fusionnetwork.io"]}},blockExplorers:{default:{name:"FSNscan",url:"https://fsnscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:10441605}},testnet:!1}),fusionTestnet=defineChain({id:46688,name:"Fusion Testnet",nativeCurrency:{name:"Fusion",symbol:"FSN",decimals:18},rpcUrls:{default:{http:["https://testnet.fusionnetwork.io"],webSocket:["wss://testnet.fusionnetwork.io"]}},blockExplorers:{default:{name:"FSNscan",url:"https://testnet.fsnscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:10428309}},testnet:!0}),sourceId$s=17e3,garnet=defineChain({...chainConfig$2,name:"Garnet Testnet",testnet:!0,id:17069,sourceId:sourceId$s,nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"],webSocket:["wss://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$s]:{address:"0x57ee40586fbE286AfC75E67cb69511A6D9aF5909",blockCreated:1274684}},l2OutputOracle:{[sourceId$s]:{address:"0xCb8E7AC561b8EF04F2a15865e9fbc0766FEF569B",blockCreated:1274684}},l1StandardBridge:{[sourceId$s]:{address:"0x09bcDd311FE398F80a78BE37E489f5D440DB95DE",blockCreated:1274684}}}}),geist=defineChain({id:63157,name:"Geist Mainnet",nativeCurrency:{decimals:18,name:"Aavegotchi GHST Token",symbol:"GHST"},rpcUrls:{default:{http:["https://geist-mainnet.g.alchemy.com/public"]}},blockExplorers:{default:{name:"Blockscout",url:"https://geist-mainnet.explorer.alchemy.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:660735}}}),genesys=defineChain({id:16507,name:"Genesys Mainnet",nativeCurrency:{decimals:18,name:"GSYS",symbol:"GSYS"},rpcUrls:{default:{http:["https://rpc.genesys.network"]}},blockExplorers:{default:{name:"Genesys Explorer",url:"https://gchainexplorer.genesys.network"}},testnet:!1}),glideL1Protocol=defineChain({id:251,name:"Glide L1 Protocol XP",nativeCurrency:{name:"GLXP",symbol:"GLXP",decimals:18},rpcUrls:{default:{http:["https://rpc-api.glideprotocol.xyz/l1-rpc"],webSocket:["wss://rpc-api.glideprotocol.xyz/l1-rpc"]}},blockExplorers:{default:{name:"Glide Protocol Explore",url:"https://blockchain-explorer.glideprotocol.xyz"}},testnet:!1}),glideL2Protocol=defineChain({id:253,name:"Glide L2 Protocol XP",nativeCurrency:{name:"GLXP",symbol:"GLXP",decimals:18},rpcUrls:{default:{http:["https://rpc-api.glideprotocol.xyz/l2-rpc"],webSocket:["wss://rpc-api.glideprotocol.xyz/l2-rpc"]}},blockExplorers:{default:{name:"Glide Protocol Explore",url:"https://blockchain-explorer.glideprotocol.xyz"}},testnet:!1}),gnosis=defineChain({id:100,name:"Gnosis",nativeCurrency:{decimals:18,name:"xDAI",symbol:"XDAI"},rpcUrls:{default:{http:["https://rpc.gnosischain.com"],webSocket:["wss://rpc.gnosischain.com/wss"]}},blockExplorers:{default:{name:"Gnosisscan",url:"https://gnosisscan.io",apiUrl:"https://api.gnosisscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:21022491}}}),gnosisChiado=defineChain({id:10200,name:"Gnosis Chiado",nativeCurrency:{decimals:18,name:"Gnosis",symbol:"xDAI"},rpcUrls:{default:{http:["https://rpc.chiadochain.net"],webSocket:["wss://rpc.chiadochain.net/wss"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.chiadochain.net",apiUrl:"https://blockscout.chiadochain.net/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:4967313}},testnet:!0}),gobi=defineChain({id:1663,name:"Horizen Gobi Testnet",nativeCurrency:{decimals:18,name:"Test ZEN",symbol:"tZEN"},rpcUrls:{default:{http:["https://gobi-testnet.horizenlabs.io/ethv1"]}},blockExplorers:{default:{name:"Gobi Explorer",url:"https://gobi-explorer.horizen.io"}},contracts:{},testnet:!0}),goChain=defineChain({id:60,name:"GoChain",nativeCurrency:{decimals:18,name:"GO",symbol:"GO"},rpcUrls:{default:{http:["https://rpc.gochain.io"]}},blockExplorers:{default:{name:"GoChain Explorer",url:"https://explorer.gochain.io"}},testnet:!1}),godwoken=defineChain({id:71402,name:"Godwoken Mainnet",nativeCurrency:{decimals:18,name:"pCKB",symbol:"pCKB"},rpcUrls:{default:{http:["https://v1.mainnet.godwoken.io/rpc"]}},blockExplorers:{default:{name:"GW Scan",url:"https://v1.gwscan.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:15034}},testnet:!1}),goerli=defineChain({id:5,name:"Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.ankr.com/eth_goerli"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.etherscan.io",apiUrl:"https://api-goerli.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xfc4AC75C46C914aF5892d6d3eFFcebD7917293F1",blockCreated:10339206},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:6507670}},testnet:!0}),gravity=defineChain({id:1625,name:"Gravity Alpha Mainnet",nativeCurrency:{name:"G",symbol:"G",decimals:18},rpcUrls:{default:{http:["https://rpc.gravity.xyz"]}},blockExplorers:{default:{name:"Gravity Explorer",url:"https://explorer.gravity.xyz",apiUrl:"https://explorer.gravity.xyz/api"}},contracts:{multicall3:{address:"0xf8ac4BEB2F75d2cFFb588c63251347fdD629B92c",blockCreated:16851}}}),guruNetwork=defineChain({id:260,name:"Guru Network Mainnet",nativeCurrency:{name:"GURU Token",symbol:"GURU",decimals:18},rpcUrls:{default:{http:["https://rpc.gurunetwork.ai/archive/260"]}},blockExplorers:{default:{name:"Guruscan",url:"https://scan.gurunetwork.ai"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:271691}},testnet:!1}),guruTestnet=defineChain({id:261,name:"Guru Network Testnet",nativeCurrency:{name:"tGURU Token",symbol:"tGURU",decimals:18},rpcUrls:{default:{http:["https://rpc.gurunetwork.ai/archive/261"]}},blockExplorers:{default:{name:"Guruscan",url:"https://sepolia.gurunetwork.ai"}},testnet:!0}),ham=defineChain({id:5112,name:"Ham",nativeCurrency:{decimals:18,name:"Ham",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.ham.fun"],webSocket:["wss://rpc.ham.fun"]}},blockExplorers:{default:{name:"Ham Chain Explorer",url:"https://explorer.ham.fun",apiUrl:"https://explorer.ham.fun/api/v2"}}}),haqqMainnet=defineChain({id:11235,name:"HAQQ Mainnet",nativeCurrency:{decimals:18,name:"Islamic Coin",symbol:"ISLM"},rpcUrls:{default:{http:["https://rpc.eth.haqq.network"]}},blockExplorers:{default:{name:"HAQQ Explorer",url:"https://explorer.haqq.network",apiUrl:"https://explorer.haqq.network/api"}}}),haqqTestedge2=defineChain({id:54211,name:"HAQQ Testedge 2",nativeCurrency:{decimals:18,name:"Islamic Coin",symbol:"ISLMT"},rpcUrls:{default:{http:["https://rpc.eth.testedge2.haqq.network"]}},blockExplorers:{default:{name:"HAQQ Explorer",url:"https://explorer.testedge2.haqq.network",apiUrl:"https://explorer.testedge2.haqq.network/api"}}}),hardhat=defineChain({id:31337,name:"Hardhat",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"]}}}),harmonyOne=defineChain({id:16666e5,name:"Harmony One",nativeCurrency:{name:"Harmony",symbol:"ONE",decimals:18},rpcUrls:{default:{http:["https://rpc.ankr.com/harmony"]}},blockExplorers:{default:{name:"Harmony Explorer",url:"https://explorer.harmony.one"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:24185753}}}),hashkeyTestnet=defineChain({id:133,name:"HashKey Chain Testnet",nativeCurrency:{decimals:18,name:"HashKey EcoPoints",symbol:"HSK"},rpcUrls:{default:{http:["https://hashkeychain-testnet.alt.technology"]}},blockExplorers:{default:{name:"HashKey Chain Explorer",url:"https://hashkeychain-testnet-explorer.alt.technology"}}}),hedera=defineChain({id:295,name:"Hedera Mainnet",network:"hedera-mainnet",nativeCurrency:{symbol:"HBAR",name:"HBAR",decimals:18},rpcUrls:{default:{http:["https://mainnet.hashio.io/api"]}},blockExplorers:{default:{name:"Hashscan",url:"https://hashscan.io/mainnet"}},testnet:!1}),hederaPreviewnet=defineChain({id:297,name:"Hedera Previewnet",network:"hedera-previewnet",nativeCurrency:{symbol:"HBAR",name:"HBAR",decimals:18},rpcUrls:{default:{http:["https://previewnet.hashio.io/api"]}},blockExplorers:{default:{name:"Hashscan",url:"https://hashscan.io/previewnet"}},testnet:!0}),hederaTestnet=defineChain({id:296,name:"Hedera Testnet",network:"hedera-testnet",nativeCurrency:{symbol:"HBAR",name:"HBAR",decimals:18},rpcUrls:{default:{http:["https://testnet.hashio.io/api"]}},blockExplorers:{default:{name:"Hashscan",url:"https://hashscan.io/testnet"}},testnet:!0}),hela=defineChain({id:8668,name:"Hela Mainnet",nativeCurrency:{name:"HLUSD",symbol:"HLUSD",decimals:18},rpcUrls:{default:{http:["https://mainnet-rpc.helachain.com"]}},blockExplorers:{default:{name:"Hela explorer",url:"https://mainnet-blockexplorer.helachain.com"}},testnet:!1}),hemiSepolia=defineChain({id:743111,name:"Hemi Sepolia",network:"Hemi Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://testnet.rpc.hemi.network/rpc"]}},blockExplorers:{default:{name:"Hemi Sepolia explorer",url:"https://testnet.explorer.hemi.xyz"}},testnet:!0}),holesky=defineChain({id:17e3,name:"Holesky",nativeCurrency:{name:"Holesky Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky-rpc.publicnode.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://holesky.etherscan.io",apiUrl:"https://api-holesky.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:77},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",blockCreated:801613},ensUniversalResolver:{address:"0xa6AC935D4971E3CD133b950aE053bECD16fE7f3b",blockCreated:973484}},testnet:!0}),hpb=defineChain({id:269,name:"High Performance Blockchain",nativeCurrency:{name:"HPB",symbol:"HPB",decimals:18},rpcUrls:{default:{http:["https://hpbnode.com"]}},blockExplorers:{default:{name:"hpbScan",url:"https://hscan.org"}},testnet:!1}),hychain=defineChain({id:2911,name:"HYCHAIN",nativeCurrency:{name:"HYTOPIA",symbol:"TOPIA",decimals:18},rpcUrls:{default:{http:["https://rpc.hychain.com/http"]}},blockExplorers:{default:{name:"HYCHAIN Explorer",url:"https://explorer.hychain.com"}},testnet:!1}),hychainTestnet=defineChain({id:29112,name:"HYCHAIN Testnet",nativeCurrency:{name:"HYTOPIA",symbol:"TOPIA",decimals:18},rpcUrls:{default:{http:["https://rpc.hychain.com/http"]}},blockExplorers:{default:{name:"HYCHAIN Explorer",url:"https://testnet-rpc.hychain.com/http"}},testnet:!0}),idchain=defineChain({id:74,name:"IDChain Mainnet",nativeCurrency:{decimals:18,name:"EIDI",symbol:"EIDI"},rpcUrls:{default:{http:["https://idchain.one/rpc"],webSocket:["wss://idchain.one/ws"]}},blockExplorers:{default:{name:"IDChain Explorer",url:"https://explorer.idchain.one"}},testnet:!1}),immutableZkEvm=defineChain({id:13371,name:"Immutable zkEVM",nativeCurrency:{decimals:18,name:"Immutable Coin",symbol:"IMX"},rpcUrls:{default:{http:["https://rpc.immutable.com"]}},blockExplorers:{default:{name:"Immutable Explorer",url:"https://explorer.immutable.com",apiUrl:"https://explorer.immutable.com/api"}},contracts:{multicall3:{address:"0x236bdA4589e44e6850f5aC6a74BfCa398a86c6c0",blockCreated:4335972}}}),immutableZkEvmTestnet=defineChain({id:13473,name:"Immutable zkEVM Testnet",nativeCurrency:{decimals:18,name:"Immutable Coin",symbol:"IMX"},rpcUrls:{default:{http:["https://rpc.testnet.immutable.com"]}},blockExplorers:{default:{name:"Immutable Testnet Explorer",url:"https://explorer.testnet.immutable.com/"}},contracts:{multicall3:{address:"0x2CC787Ed364600B0222361C4188308Fa8E68bA60",blockCreated:5977391}},testnet:!0}),inEVM=defineChain({id:2525,name:"inEVM Mainnet",nativeCurrency:{decimals:18,name:"Injective",symbol:"INJ"},rpcUrls:{default:{http:["https://mainnet.rpc.inevm.com/http"]}},blockExplorers:{default:{name:"inEVM Explorer",url:"https://inevm.calderaexplorer.xyz",apiUrl:"https://inevm.calderaexplorer.xyz/api/v2"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:118606}}}),sourceId$r=11155111,inkSepolia=defineChain({...chainConfig$2,id:763373,name:"Ink Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-gel-sepolia.inkonchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer-sepolia.inkonchain.com/",apiUrl:"https://explorer-sepolia.inkonchain.com/api/v2"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$r]:{address:"0x860e626c700af381133d9f4af31412a2d1db3d5d"}},portal:{[sourceId$r]:{address:"0x5c1d29c6c9c8b0800692acc95d700bcb4966a1d7"}},l1StandardBridge:{[sourceId$r]:{address:"0x33f60714bbd74d62b66d79213c348614de51901c"}}},testnet:!0,sourceId:sourceId$r}),iota=defineChain({id:8822,name:"IOTA EVM",network:"iotaevm",nativeCurrency:{decimals:18,name:"IOTA",symbol:"IOTA"},rpcUrls:{default:{http:["https://json-rpc.evm.iotaledger.net"],webSocket:["wss://ws.json-rpc.evm.iotaledger.net"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.evm.iota.org",apiUrl:"https://explorer.evm.iota.org/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:25022}}}),iotaTestnet=defineChain({id:1075,name:"IOTA EVM Testnet",network:"iotaevm-testnet",nativeCurrency:{decimals:18,name:"IOTA",symbol:"IOTA"},rpcUrls:{default:{http:["https://json-rpc.evm.testnet.iotaledger.net"],webSocket:["wss://ws.json-rpc.evm.testnet.iotaledger.net"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.evm.testnet.iotaledger.net",apiUrl:"https://explorer.evm.testnet.iotaledger.net/api"}},testnet:!0}),iotex=defineChain({id:4689,name:"IoTeX",nativeCurrency:{decimals:18,name:"IoTeX",symbol:"IOTX"},rpcUrls:{default:{http:["https://babel-api.mainnet.iotex.io"],webSocket:["wss://babel-api.mainnet.iotex.io"]}},blockExplorers:{default:{name:"IoTeXScan",url:"https://iotexscan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:22163670}}}),iotexTestnet=defineChain({id:4690,name:"IoTeX Testnet",nativeCurrency:{decimals:18,name:"IoTeX",symbol:"IOTX"},rpcUrls:{default:{http:["https://babel-api.testnet.iotex.io"],webSocket:["wss://babel-api.testnet.iotex.io"]}},blockExplorers:{default:{name:"IoTeXScan",url:"https://testnet.iotexscan.io"}},contracts:{multicall3:{address:"0xb5cecD6894c6f473Ec726A176f1512399A2e355d",blockCreated:24347592}},testnet:!0}),iSunCoin=defineChain({id:8017,name:"iSunCoin Mainnet",nativeCurrency:{decimals:18,name:"ISC",symbol:"ISC"},rpcUrls:{default:{http:["https://mainnet.isuncoin.com"]}},blockExplorers:{default:{name:"iSunCoin Explorer",url:"https://baifa.io/app/chains/8017"}}}),jbc=defineChain({id:8899,name:"JIBCHAIN L1",network:"jbc",nativeCurrency:{name:"JBC",symbol:"JBC",decimals:18},rpcUrls:{default:{http:["https://rpc-l1.jibchain.net"]}},blockExplorers:{default:{name:"Blockscout",url:"https://exp-l1.jibchain.net",apiUrl:"https://exp-l1.jibchain.net/api"}},contracts:{multicall3:{address:"0xc0C8C486D1466C57Efe13C2bf000d4c56F47CBdC",blockCreated:2299048}},testnet:!1}),jbcTestnet=defineChain({id:88991,name:"Jibchain Testnet",nativeCurrency:{name:"tJBC",symbol:"tJBC",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.jibchain.net"]}},blockExplorers:{default:{name:"Blockscout",url:"https://exp.testnet.jibchain.net",apiUrl:"https://exp.testnet.jibchain.net/api"}},contracts:{multicall3:{address:"0xa1a858ad9041B4741e620355a3F96B3c78e70ecE",blockCreated:32848}},testnet:!0}),karura=defineChain({id:686,name:"Karura",network:"karura",nativeCurrency:{name:"Karura",symbol:"KAR",decimals:18},rpcUrls:{default:{http:["https://eth-rpc-karura.aca-api.network"],webSocket:["wss://eth-rpc-karura.aca-api.network"]}},blockExplorers:{default:{name:"Karura Blockscout",url:"https://blockscout.karura.network",apiUrl:"https://blockscout.karura.network/api"}},testnet:!1}),kakarotSepolia=defineChain({id:1802203764,name:"Kakarot Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rpc.kakarot.org"]}},blockExplorers:{default:{name:"Kakarot Scan",url:"https://sepolia.kakarotscan.org"}},testnet:!0}),kakarotStarknetSepolia=defineChain({id:920637907288165,name:"Kakarot Starknet Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rpc.kakarot.org"]}},blockExplorers:{default:{name:"Kakarot Scan",url:"https://sepolia.kakarotscan.org"}},testnet:!0}),kardiaChain=defineChain({id:24,name:"KardiaChain Mainnet",nativeCurrency:{name:"KAI",symbol:"KAI",decimals:18},rpcUrls:{default:{http:["https://rpc.kardiachain.io"]}},blockExplorers:{default:{name:"KardiaChain Explorer",url:"https://explorer.kardiachain.io"}},testnet:!1}),kava=defineChain({id:2222,name:"Kava EVM",network:"kava-mainnet",nativeCurrency:{name:"Kava",symbol:"KAVA",decimals:18},rpcUrls:{default:{http:["https://evm.kava.io"]}},blockExplorers:{default:{name:"Kava EVM Explorer",url:"https://kavascan.com",apiUrl:"https://kavascan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:3661165}},testnet:!1}),kavaTestnet=defineChain({id:2221,name:"Kava EVM Testnet",network:"kava-testnet",nativeCurrency:{name:"Kava",symbol:"KAVA",decimals:18},rpcUrls:{default:{http:["https://evm.testnet.kava.io"]}},blockExplorers:{default:{name:"Kava EVM Testnet Explorer",url:"https://testnet.kavascan.com/",apiUrl:"https://testnet.kavascan.com/api"}},contracts:{multicall3:{address:"0xDf1D724A7166261eEB015418fe8c7679BBEa7fd6",blockCreated:7242179}},testnet:!0}),kcc=defineChain({id:321,name:"KCC Mainnet",network:"KCC Mainnet",nativeCurrency:{decimals:18,name:"KCS",symbol:"KCS"},rpcUrls:{default:{http:["https://kcc-rpc.com"]}},blockExplorers:{default:{name:"KCC Explorer",url:"https://explorer.kcc.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:11760430}},testnet:!1}),kinto=defineChain({id:7887,name:"Kinto Mainnet",network:"Kinto Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.kinto.xyz/http"]}},blockExplorers:{default:{name:"Kinto Explorer",url:"https://explorer.kinto.xyz"}},testnet:!1}),klaytn=defineChain({id:8217,name:"Klaytn",nativeCurrency:{decimals:18,name:"Klaytn",symbol:"KLAY"},rpcUrls:{default:{http:["https://public-en-cypress.klaytn.net"]}},blockExplorers:{default:{name:"KlaytnScope",url:"https://scope.klaytn.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:96002415}}}),kaia=defineChain({id:8217,name:"Kaia",nativeCurrency:{decimals:18,name:"Kaia",symbol:"KAIA"},rpcUrls:{default:{http:["https://public-en.node.kaia.io"]}},blockExplorers:{default:{name:"KaiaScan",url:"https://kaiascan.io",apiUrl:"https://api-cypress.klaytnscope.com/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:96002415}}}),kairos=defineChain({id:1001,name:"Kairos Testnet",network:"kairos",nativeCurrency:{decimals:18,name:"Kairos KAIA",symbol:"KAIA"},rpcUrls:{default:{http:["https://public-en-kairos.node.kaia.io"]}},blockExplorers:{default:{name:"KaiaScan",url:"https://kairos.kaiascan.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:123390593}},testnet:!0}),klaytnBaobab=defineChain({id:1001,name:"Klaytn Baobab Testnet",network:"klaytn-baobab",nativeCurrency:{decimals:18,name:"Baobab Klaytn",symbol:"KLAY"},rpcUrls:{default:{http:["https://public-en-baobab.klaytn.net"]}},blockExplorers:{default:{name:"KlaytnScope",url:"https://baobab.klaytnscope.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:123390593}},testnet:!0}),koi=defineChain({id:701,name:"Koi Network",nativeCurrency:{decimals:18,name:"Koi Network Native Token",symbol:"KRING"},rpcUrls:{default:{http:["https://koi-rpc.darwinia.network"],webSocket:["wss://koi-rpc.darwinia.network"]}},blockExplorers:{default:{name:"Blockscout",url:"https://koi-scan.darwinia.network"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:180001}},testnet:!0}),kroma=defineChain({id:255,name:"Kroma",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://api.kroma.network"]}},blockExplorers:{default:{name:"Kroma Explorer",url:"https://blockscout.kroma.network",apiUrl:"https://blockscout.kroma.network/api"}},testnet:!1}),kromaSepolia=defineChain({id:2358,name:"Kroma Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://api.sepolia.kroma.network"]}},blockExplorers:{default:{name:"Kroma Sepolia Explorer",url:"https://blockscout.sepolia.kroma.network",apiUrl:"https://blockscout.sepolia.kroma.network/api"}},testnet:!0}),l3x=defineChain({id:12324,name:"L3X Protocol",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-mainnet.l3x.com"],webSocket:["wss://rpc-mainnet.l3x.com"]}},blockExplorers:{default:{name:"L3X Mainnet Explorer",url:"https://explorer.l3x.com",apiUrl:"https://explorer.l3x.com/api/v2"}},testnet:!1}),l3xTestnet=defineChain({id:12325,name:"L3X Protocol Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.l3x.com"],webSocket:["wss://rpc-testnet.l3x.com"]}},blockExplorers:{default:{name:"L3X Testnet Explorer",url:"https://explorer-testnet.l3x.com",apiUrl:"https://explorer-testnet.l3x.com/api/v2"}},testnet:!0}),lavita=defineChain({id:360890,name:"LAVITA Mainnet",nativeCurrency:{name:"vTFUEL",symbol:"vTFUEL",decimals:18},rpcUrls:{default:{http:["https://tsub360890-eth-rpc.thetatoken.org/rpc"]}},blockExplorers:{default:{name:"LAVITA Explorer",url:"https://tsub360890-explorer.thetatoken.org"}},testnet:!1}),lightlinkPegasus=defineChain({id:1891,name:"LightLink Pegasus Testnet",network:"lightlink-pegasus",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://replicator.pegasus.lightlink.io/rpc/v1"]}},blockExplorers:{default:{name:"LightLink Pegasus Explorer",url:"https://pegasus.lightlink.io"}},testnet:!0}),lightlinkPhoenix=defineChain({id:1890,name:"LightLink Phoenix Mainnet",network:"lightlink-phoenix",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://replicator.phoenix.lightlink.io/rpc/v1"]}},blockExplorers:{default:{name:"LightLink Phoenix Explorer",url:"https://phoenix.lightlink.io"}},testnet:!1});async function estimateGas(fr,br){var kr,jr,Br;const{account:wr=fr.account}=br;if(!wr)throw new AccountNotFoundError;const Er=parseAccount(wr);try{const{accessList:Wr,blockNumber:qr,blockTag:Gr,data:Vr,gas:Zr,gasPrice:Jr,maxFeePerGas:Qr,maxPriorityFeePerGas:_n,nonce:En,to:Cn,value:In,...An}=br,eo=(qr?numberToHex(qr):void 0)||Gr;assertRequest(br);const ro=(Br=(jr=(kr=fr.chain)==null?void 0:kr.formatters)==null?void 0:jr.transactionRequest)==null?void 0:Br.format,_i=(ro||formatTransactionRequest)({...extract(An,{format:ro}),from:Er==null?void 0:Er.address,accessList:Wr,data:Vr,gas:Zr,gasPrice:Jr,maxFeePerGas:Qr,maxPriorityFeePerGas:_n,nonce:En,to:Cn,value:In}),{baseFeePerGas:oo,gasLimit:io,priorityFeePerGas:co}=await fr.request({method:"linea_estimateGas",params:eo?[_i,eo]:[_i]});return{baseFeePerGas:BigInt(oo),gasLimit:BigInt(io),priorityFeePerGas:BigInt(co)}}catch(Wr){throw getCallError(Wr,{...br,account:Er,chain:fr.chain})}}const chainConfig={fees:{estimateFeesPerGas,async maxPriorityFeePerGas({block:fr,client:br,request:wr}){const Er=await estimateFeesPerGas({block:fr,client:br,multiply:kr=>kr,request:wr,type:"eip1559"});return Er!=null&&Er.maxPriorityFeePerGas?Er.maxPriorityFeePerGas:null}}};async function estimateFeesPerGas({client:fr,multiply:br,request:wr,type:Er}){try{const kr=await estimateGas(fr,{...wr,account:wr==null?void 0:wr.account}),{priorityFeePerGas:jr}=kr,Wr=br(BigInt(kr.baseFeePerGas))+jr;return Er==="legacy"?{gasPrice:Wr}:{maxFeePerGas:Wr,maxPriorityFeePerGas:jr}}catch{return null}}const linea=defineChain({...chainConfig,id:59144,name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build",apiUrl:"https://api.lineascan.build/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:42}},testnet:!1}),lineaGoerli=defineChain({id:59140,name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build",apiUrl:"https://api-goerli.lineascan.build/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:498623}},testnet:!0}),lineaSepolia=defineChain({...chainConfig,id:59141,name:"Linea Sepolia Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.sepolia.linea.build"],webSocket:["wss://rpc.sepolia.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.lineascan.build",apiUrl:"https://api-sepolia.lineascan.build/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:227427}},testnet:!0}),lineaTestnet=defineChain({id:59140,name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build",apiUrl:"https://goerli.lineascan.build/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:498623}},testnet:!0}),sourceId$q=1,lisk=defineChain({...chainConfig$2,id:1135,name:"Lisk",network:"lisk",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.api.lisk.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://blockscout.lisk.com",apiUrl:"https://blockscout.lisk.com/api"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xA9d71E1dd7ca26F26e656E66d6AA81ed7f745bf0"},l2OutputOracle:{[sourceId$q]:{address:"0x113cB99283AF242Da0A0C54347667edF531Aa7d6"}},portal:{[sourceId$q]:{address:"0x26dB93F8b8b4f7016240af62F7730979d353f9A7"}},l1StandardBridge:{[sourceId$q]:{address:"0x2658723Bf70c7667De6B25F99fcce13A16D25d08"}}},sourceId:sourceId$q}),sourceId$p=11155111,liskSepolia=defineChain({...chainConfig$2,id:4202,network:"lisk-sepolia",name:"Lisk Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.sepolia-api.lisk.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-blockscout.lisk.com",apiUrl:"https://sepolia-blockscout.lisk.com/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$p]:{address:"0xA0E35F56C318DE1bD5D9ca6A94Fe7e37C5663348"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$p]:{address:"0xe3d90F21490686Ec7eF37BE788E02dfC12787264"}},l1StandardBridge:{[sourceId$p]:{address:"0x1Fb30e446eA791cd1f011675E5F3f5311b70faF5"}}},testnet:!0,sourceId:sourceId$p}),localhost=defineChain({id:1337,name:"Localhost",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["http://127.0.0.1:8545"]}}}),loop=defineChain({id:15551,name:"LoopNetwork Mainnet",nativeCurrency:{name:"LOOP",symbol:"LOOP",decimals:18},rpcUrls:{default:{http:["https://api.mainnetloop.com"]}},blockExplorers:{default:{name:"LoopNetwork Blockchain Explorer",url:"https://explorer.mainnetloop.com/"}},testnet:!1}),lukso=defineChain({id:42,network:"lukso",name:"LUKSO",nativeCurrency:{name:"LUKSO",symbol:"LYX",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.lukso.network"],webSocket:["wss://ws-rpc.mainnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Mainnet Explorer",url:"https://explorer.execution.mainnet.lukso.network",apiUrl:"https://api.explorer.execution.mainnet.lukso.network/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:468183}}}),luksoTestnet=defineChain({id:4201,name:"LUKSO Testnet",nativeCurrency:{decimals:18,name:"LUKSO Testnet",symbol:"LYXt"},rpcUrls:{default:{http:["https://rpc.testnet.lukso.network"],webSocket:["wss://ws-rpc.testnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Testnet Explorer",url:"https://explorer.execution.testnet.lukso.network",apiUrl:"https://api.explorer.execution.testnet.lukso.network/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:605348}},testnet:!0}),lycan=defineChain({id:721,name:"Lycan",nativeCurrency:{decimals:18,name:"Lycan",symbol:"LYC"},rpcUrls:{default:{http:["https://rpc.lycanchain.com","https://us-east.lycanchain.com","https://us-west.lycanchain.com","https://eu-north.lycanchain.com","https://eu-west.lycanchain.com","https://asia-southeast.lycanchain.com"],webSocket:["wss://rpc.lycanchain.com","wss://us-east.lycanchain.com","wss://us-west.lycanchain.com","wss://eu-north.lycanchain.com","wss://eu-west.lycanchain.com","wss://asia-southeast.lycanchain.com"]}},blockExplorers:{default:{name:"Lycan Explorer",url:"https://explorer.lycanchain.com"}}}),lyra=defineChain({id:957,name:"Lyra Chain",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.lyra.finance"]}},blockExplorers:{default:{name:"Lyra Explorer",url:"https://explorer.lyra.finance",apiUrl:"https://explorer.lyra.finance/api/v2"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1935198}}}),mainnet=defineChain({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),mandala=defineChain({id:595,name:"Mandala TC9",network:"mandala",nativeCurrency:{name:"Mandala",symbol:"mACA",decimals:18},rpcUrls:{default:{http:["https://eth-rpc-tc9.aca-staging.network"],webSocket:["wss://eth-rpc-tc9.aca-staging.network"]}},blockExplorers:{default:{name:"Mandala Blockscout",url:"https://blockscout.mandala.aca-staging.network",apiUrl:"https://blockscout.mandala.aca-staging.network/api"}},testnet:!0}),manta=defineChain({id:169,name:"Manta Pacific Mainnet",network:"manta",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://pacific-rpc.manta.network/http"]}},blockExplorers:{default:{name:"Manta Explorer",url:"https://pacific-explorer.manta.network",apiUrl:"https://pacific-explorer.manta.network/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:332890}}}),mantaSepoliaTestnet=defineChain({id:3441006,name:"Manta Pacific Sepolia Testnet",network:"manta-sepolia",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://pacific-rpc.sepolia-testnet.manta.network/http"]}},blockExplorers:{default:{name:"Manta Sepolia Testnet Explorer",url:"https://pacific-explorer.sepolia-testnet.manta.network",apiUrl:"https://pacific-explorer.sepolia-testnet.manta.network/api"}},contracts:{multicall3:{address:"0xca54918f7B525C8df894668846506767412b53E3",blockCreated:479584}},testnet:!0}),mantaTestnet=defineChain({id:3441005,name:"Manta Pacific Testnet",network:"manta-testnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://manta-testnet.calderachain.xyz/http"]}},blockExplorers:{default:{name:"Manta Testnet Explorer",url:"https://pacific-explorer.testnet.manta.network",apiUrl:"https://pacific-explorer.testnet.manta.network/api"}},contracts:{multicall3:{address:"0x211B1643b95Fe76f11eD8880EE810ABD9A4cf56C",blockCreated:419915}},testnet:!0}),mantle=defineChain({id:5e3,name:"Mantle",nativeCurrency:{decimals:18,name:"MNT",symbol:"MNT"},rpcUrls:{default:{http:["https://rpc.mantle.xyz"]}},blockExplorers:{default:{name:"Mantle Explorer",url:"https://mantlescan.xyz/",apiUrl:"https://api.mantlescan.xyz/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:304717}}}),mantleSepoliaTestnet=defineChain({id:5003,name:"Mantle Sepolia Testnet",nativeCurrency:{decimals:18,name:"MNT",symbol:"MNT"},rpcUrls:{default:{http:["https://rpc.sepolia.mantle.xyz"]}},blockExplorers:{default:{name:"Mantle Testnet Explorer",url:"https://explorer.sepolia.mantle.xyz/",apiUrl:"https://explorer.sepolia.mantle.xyz/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:4584012}},testnet:!0}),mantleTestnet=defineChain({id:5001,name:"Mantle Testnet",nativeCurrency:{decimals:18,name:"MNT",symbol:"MNT"},rpcUrls:{default:{http:["https://rpc.testnet.mantle.xyz"]}},blockExplorers:{default:{name:"Mantle Testnet Explorer",url:"https://explorer.testnet.mantle.xyz",apiUrl:"https://explorer.testnet.mantle.xyz/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:561333}},testnet:!0}),mapProtocol=defineChain({id:22776,name:"MAP Protocol",nativeCurrency:{decimals:18,name:"MAPO",symbol:"MAPO"},rpcUrls:{default:{http:["https://rpc.maplabs.io"]}},blockExplorers:{default:{name:"MAPO Scan",url:"https://maposcan.io"}},testnet:!1}),matchain=defineChain({id:698,name:"Matchain",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrls:{default:{http:["https://rpc.matchain.io"]}},blockExplorers:{default:{name:"Matchain Scan",url:"https://matchscan.io"}}}),matchainTestnet=defineChain({id:699,name:"Matchain Testnet",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.matchain.io"]}},blockExplorers:{default:{name:"Matchain Scan",url:"https://testnet.matchscan.io"}},testnet:!0}),mchVerse=defineChain({id:29548,name:"MCH Verse",nativeCurrency:{name:"Oasys",symbol:"OAS",decimals:18},rpcUrls:{default:{http:["https://rpc.oasys.mycryptoheroes.net"]}},blockExplorers:{default:{name:"MCH Verse Explorer",url:"https://explorer.oasys.mycryptoheroes.net",apiUrl:"https://explorer.oasys.mycryptoheroes.net/api"}},testnet:!1}),mekong=defineChain({id:7078815900,name:"Mekong Pectra Devnet",nativeCurrency:{name:"eth",symbol:"eth",decimals:18},rpcUrls:{default:{http:["https://rpc.mekong.ethpandaops.io"]}},blockExplorers:{default:{name:"Block Explorer",url:"https://explorer.mekong.ethpandaops.io"}},testnet:!0}),meld=defineChain({id:333000333,name:"Meld",nativeCurrency:{decimals:18,name:"Meld",symbol:"MELD"},rpcUrls:{default:{http:["https://rpc-1.meld.com"]}},blockExplorers:{default:{name:"MELDscan",url:"https://meldscan.io"}},contracts:{multicall3:{address:"0x769ee5a8e82c15c1b6e358f62ac8eb6e3abe8dc5",blockCreated:360069}}}),merlin=defineChain({id:4200,name:"Merlin",nativeCurrency:{name:"BTC",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://rpc.merlinchain.io"]}},blockExplorers:{default:{name:"blockscout",url:"https://scan.merlinchain.io",apiUrl:"https://scan.merlinchain.io/api"}}}),metachain=defineChain({id:571,name:"MetaChain Mainnet",nativeCurrency:{name:"Metatime Coin",symbol:"MTC",decimals:18},rpcUrls:{default:{http:["https://rpc.metatime.com"]}},blockExplorers:{default:{name:"MetaExplorer",url:"https://explorer.metatime.com"}},contracts:{multicall3:{address:"0x0000000000000000000000000000000000003001",blockCreated:0}}}),metachainIstanbul=defineChain({id:1453,name:"MetaChain Istanbul",nativeCurrency:{name:"Metatime Coin",symbol:"MTC",decimals:18},rpcUrls:{default:{http:["https://istanbul-rpc.metachain.dev"]}},blockExplorers:{default:{name:"MetaExplorer",url:"https://istanbul-explorer.metachain.dev"}},contracts:{multicall3:{address:"0x0000000000000000000000000000000000003001",blockCreated:0}},testnet:!0}),metadium=defineChain({id:11,name:"Metadium Network",nativeCurrency:{decimals:18,name:"META",symbol:"META"},rpcUrls:{default:{http:["https://api.metadium.com/prod"]}},blockExplorers:{default:{name:"Metadium Explorer",url:"https://explorer.metadium.com"}},testnet:!1}),sourceId$o=1,metalL2=defineChain({...chainConfig$2,id:1750,name:"Metal L2",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.metall2.com"],webSocket:["wss://rpc.metall2.com"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.metall2.com",apiUrl:"https://explorer.metall2.com/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$o]:{address:"0x3B1F7aDa0Fcc26B13515af752Dd07fB1CAc11426"}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:0},portal:{[sourceId$o]:{address:"0x3F37aBdE2C6b5B2ed6F8045787Df1ED1E3753956"}},l1StandardBridge:{[sourceId$o]:{address:"0x6d0f65D59b55B0FEC5d2d15365154DcADC140BF3"}}},sourceId:sourceId$o}),meter=defineChain({id:82,name:"Meter",nativeCurrency:{decimals:18,name:"MTR",symbol:"MTR"},rpcUrls:{default:{http:["https://rpc.meter.io"]}},blockExplorers:{default:{name:"MeterScan",url:"https://scan.meter.io"}}}),meterTestnet=defineChain({id:83,name:"Meter Testnet",nativeCurrency:{decimals:18,name:"MTR",symbol:"MTR"},rpcUrls:{default:{http:["https://rpctest.meter.io"]}},blockExplorers:{default:{name:"MeterTestnetScan",url:"https://scan-warringstakes.meter.io"}}}),metis=defineChain({id:1088,name:"Metis",nativeCurrency:{decimals:18,name:"Metis",symbol:"METIS"},rpcUrls:{default:{http:["https://andromeda.metis.io/?owner=1088"]}},blockExplorers:{default:{name:"Metis Explorer",url:"https://explorer.metis.io",apiUrl:"https://api.routescan.io/v2/network/mainnet/evm/1088/etherscan/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:2338552}}}),metisGoerli=defineChain({id:599,name:"Metis Goerli",nativeCurrency:{decimals:18,name:"Metis Goerli",symbol:"METIS"},rpcUrls:{default:{http:["https://goerli.gateway.metisdevops.link"]}},blockExplorers:{default:{name:"Metis Goerli Explorer",url:"https://goerli.explorer.metisdevops.link",apiUrl:"https://goerli.explorer.metisdevops.link/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1006207}}}),mev=defineChain({id:7518,name:"MEVerse Chain Mainnet",nativeCurrency:{decimals:18,name:"MEVerse",symbol:"MEV"},rpcUrls:{default:{http:["https://rpc.meversemainnet.io"]}},blockExplorers:{default:{name:"Explorer",url:"https://www.meversescan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:86881340}}}),mevTestnet=defineChain({id:4759,name:"MEVerse Chain Testnet",nativeCurrency:{decimals:18,name:"MEVerse",symbol:"MEV"},rpcUrls:{default:{http:["https://rpc.meversetestnet.io"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.meversescan.io/"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:64371115}},testnet:!0}),mint=defineChain({id:185,name:"Mint Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.mintchain.io"]}},blockExplorers:{default:{name:"Mintchain explorer",url:"https://explorer.mintchain.io"}},testnet:!1}),mintSepoliaTestnet=defineChain({id:1686,name:"Mint Sepolia Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.mintchain.io"]}},blockExplorers:{default:{name:"Mintchain Testnet explorer",url:"https://testnet-explorer.mintchain.io"}},testnet:!0}),sourceId$n=1,mode=defineChain({...chainConfig$2,id:34443,name:"Mode Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.mode.network"]}},blockExplorers:{default:{name:"Modescan",url:"https://modescan.io"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:2465882},l2OutputOracle:{[sourceId$n]:{address:"0x4317ba146D4933D889518a3e5E11Fe7a53199b04"}},portal:{[sourceId$n]:{address:"0x8B34b14c7c7123459Cf3076b8Cb929BE097d0C07"}},l1StandardBridge:{[sourceId$n]:{address:"0x735aDBbE72226BD52e818E7181953f42E3b0FF21"}}},sourceId:sourceId$n}),sourceId$m=11155111,modeTestnet=defineChain({...chainConfig$2,id:919,name:"Mode Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.mode.network"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia.explorer.mode.network",apiUrl:"https://sepolia.explorer.mode.network/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$m]:{address:"0x2634BD65ba27AB63811c74A63118ACb312701Bfa",blockCreated:3778393}},portal:{[sourceId$m]:{address:"0x320e1580effF37E008F1C92700d1eBa47c1B23fD",blockCreated:3778395}},l1StandardBridge:{[sourceId$m]:{address:"0xbC5C679879B2965296756CD959C3C739769995E2",blockCreated:3778392}},multicall3:{address:"0xBAba8373113Fb7a68f195deF18732e01aF8eDfCF",blockCreated:3019007}},testnet:!0,sourceId:sourceId$m}),moonbaseAlpha=defineChain({id:1287,name:"Moonbase Alpha",nativeCurrency:{decimals:18,name:"DEV",symbol:"DEV"},rpcUrls:{default:{http:["https://rpc.api.moonbase.moonbeam.network"],webSocket:["wss://wss.api.moonbase.moonbeam.network"]}},blockExplorers:{default:{name:"Moonscan",url:"https://moonbase.moonscan.io",apiUrl:"https://moonbase.moonscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1850686}},testnet:!0}),moonbeam=defineChain({id:1284,name:"Moonbeam",nativeCurrency:{decimals:18,name:"GLMR",symbol:"GLMR"},rpcUrls:{default:{http:["https://moonbeam.public.blastapi.io"],webSocket:["wss://moonbeam.public.blastapi.io"]}},blockExplorers:{default:{name:"Moonscan",url:"https://moonscan.io",apiUrl:"https://api-moonbeam.moonscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:609002}},testnet:!1}),moonbeamDev=defineChain({id:1281,name:"Moonbeam Development Node",nativeCurrency:{decimals:18,name:"DEV",symbol:"DEV"},rpcUrls:{default:{http:["http://127.0.0.1:9944"],webSocket:["wss://127.0.0.1:9944"]}}}),moonriver=defineChain({id:1285,name:"Moonriver",nativeCurrency:{decimals:18,name:"MOVR",symbol:"MOVR"},rpcUrls:{default:{http:["https://moonriver.public.blastapi.io"],webSocket:["wss://moonriver.public.blastapi.io"]}},blockExplorers:{default:{name:"Moonscan",url:"https://moonriver.moonscan.io",apiUrl:"https://api-moonriver.moonscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1597904}},testnet:!1}),morph=defineChain({id:2818,name:"Morph",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.morphl2.io"],webSocket:["wss://rpc.morphl2.io:8443"]}},blockExplorers:{default:{name:"Morph Explorer",url:"https://explorer.morphl2.io"}},testnet:!1}),morphHolesky=defineChain({id:2810,name:"Morph Holesky",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-quicknode-holesky.morphl2.io"],webSocket:["wss://rpc-quicknode-holesky.morphl2.io"]}},blockExplorers:{default:{name:"Morph Holesky Explorer",url:"https://explorer-holesky.morphl2.io",apiUrl:"https://explorer-api-holesky.morphl2.io/api?"}},testnet:!0}),morphSepolia=defineChain({id:2710,name:"Morph Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.morphl2.io"]}},blockExplorers:{default:{name:"Morph Testnet Explorer",url:"https://explorer-testnet.morphl2.io",apiUrl:"https://explorer-api-testnet.morphl2.io/api"}},testnet:!0}),nahmii=defineChain({id:5551,name:"Nahmii 2 Mainnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://l2.nahmii.io"]}},blockExplorers:{default:{name:"Nahmii 2 Explorer",url:"https://explorer.n2.nahmii.io"}},testnet:!1}),nautilus=defineChain({id:22222,name:"Nautilus Mainnet",nativeCurrency:{name:"ZBC",symbol:"ZBC",decimals:9},rpcUrls:{default:{http:["https://api.nautilus.nautchain.xyz"]}},blockExplorers:{default:{name:"NautScan",url:"https://nautscan.com"}}}),neonDevnet=defineChain({id:245022926,name:"Neon EVM DevNet",nativeCurrency:{name:"NEON",symbol:"NEON",decimals:18},rpcUrls:{default:{http:["https://devnet.neonevm.org"]}},blockExplorers:{default:{name:"Neonscan",url:"https://devnet.neonscan.org"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:205206112}},testnet:!0}),neonMainnet=defineChain({id:245022934,network:"neonMainnet",name:"Neon EVM MainNet",nativeCurrency:{name:"NEON",symbol:"NEON",decimals:18},rpcUrls:{default:{http:["https://neon-proxy-mainnet.solana.p2p.org"]}},blockExplorers:{default:{name:"Neonscan",url:"https://neonscan.org"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:206545524}},testnet:!1}),nexi=defineChain({id:4242,name:"Nexi",nativeCurrency:{name:"Nexi",symbol:"NEXI",decimals:18},rpcUrls:{default:{http:["https://rpc.chain.nexi.technology"]}},blockExplorers:{default:{name:"NexiScan",url:"https://www.nexiscan.com",apiUrl:"https://www.nexiscan.com/api"}},contracts:{multicall3:{address:"0x0277A46Cc69A57eE3A6C8c158bA874832F718B8E",blockCreated:25770160}}}),nexilix=defineChain({id:240,name:"Nexilix Smart Chain",nativeCurrency:{decimals:18,name:"Nexilix",symbol:"NEXILIX"},rpcUrls:{default:{http:["https://rpcurl.pos.nexilix.com"]}},blockExplorers:{default:{name:"NexilixScan",url:"https://scan.nexilix.com"}},contracts:{multicall3:{address:"0x58381c8e2BF9d0C2C4259cA14BdA9Afe02831244",blockCreated:74448}}}),oasisTestnet=defineChain({id:4090,network:"oasis-testnet",name:"Oasis Testnet",nativeCurrency:{name:"Fasttoken",symbol:"FTN",decimals:18},rpcUrls:{default:{http:["https://rpc1.oasis.bahamutchain.com"]}},blockExplorers:{default:{name:"Ftnscan",url:"https://oasis.ftnscan.com",apiUrl:"https://oasis.ftnscan.com/api"}},testnet:!0}),oasys=defineChain({id:248,name:"Oasys",nativeCurrency:{name:"Oasys",symbol:"OAS",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.oasys.games"]}},blockExplorers:{default:{name:"OasysScan",url:"https://scan.oasys.games",apiUrl:"https://scan.oasys.games/api"}}}),odysseyTestnet=defineChain({id:911867,name:"Odyssey Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://odyssey.ithaca.xyz"]}},blockExplorers:{default:{name:"Odyssey Explorer",url:"https://odyssey-explorer.ithaca.xyz",apiUrl:"https://odyssey-explorer.ithaca.xyz/api"}},testnet:!0}),okc=defineChain({id:66,name:"OKC",nativeCurrency:{decimals:18,name:"OKT",symbol:"OKT"},rpcUrls:{default:{http:["https://exchainrpc.okex.org"]}},blockExplorers:{default:{name:"oklink",url:"https://www.oklink.com/okc"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:10364792}}}),omax=defineChain({id:311,name:"Omax Mainnet",nativeCurrency:{decimals:18,name:"OMAX",symbol:"OMAX"},rpcUrls:{default:{http:["https://mainapi.omaxray.com"]}},blockExplorers:{default:{name:"Omax Explorer",url:"https://omaxscan.com"}},testnet:!1}),oneWorld=defineChain({id:309075,name:"One World Chain Mainnet",nativeCurrency:{decimals:18,name:"OWCT",symbol:"OWCT"},rpcUrls:{default:{http:["https://mainnet-rpc.oneworldchain.org"]}},blockExplorers:{default:{name:"One World Explorer",url:"https://mainnet.oneworldchain.org"}},testnet:!1}),oortMainnetDev=defineChain({id:9700,name:"OORT MainnetDev",nativeCurrency:{decimals:18,name:"OORT",symbol:"OORT"},rpcUrls:{default:{http:["https://dev-rpc.oortech.com"]}},blockExplorers:{default:{name:"OORT MainnetDev Explorer",url:"https://dev-scan.oortech.com"}}}),sourceId$l=56,opBNB=defineChain({id:204,name:"opBNB",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrls:{default:{http:["https://opbnb-mainnet-rpc.bnbchain.org"]}},blockExplorers:{default:{name:"opBNB (BSCScan)",url:"https://opbnb.bscscan.com",apiUrl:"https://api-opbnb.bscscan.com/api"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:512881},l2OutputOracle:{[sourceId$l]:{address:"0x153CAB79f4767E2ff862C94aa49573294B13D169"}},portal:{[sourceId$l]:{address:"0x1876EA7702C0ad0C6A2ae6036DE7733edfBca519"}},l1StandardBridge:{[sourceId$l]:{address:"0xF05F0e4362859c3331Cb9395CBC201E3Fa6757Ea"}}},sourceId:sourceId$l}),sourceId$k=97,opBNBTestnet=defineChain({id:5611,name:"opBNB Testnet",nativeCurrency:{decimals:18,name:"tBNB",symbol:"tBNB"},rpcUrls:{default:{http:["https://opbnb-testnet-rpc.bnbchain.org"]}},blockExplorers:{default:{name:"opbnbscan",url:"https://testnet.opbnbscan.com"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3705108},l2OutputOracle:{[sourceId$k]:{address:"0xFf2394Bb843012562f4349C6632a0EcB92fC8810"}},portal:{[sourceId$k]:{address:"0x4386C8ABf2009aC0c263462Da568DD9d46e52a31"}},l1StandardBridge:{[sourceId$k]:{address:"0x677311Fd2cCc511Bbc0f581E8d9a07B033D5E840"}}},testnet:!0,sourceId:sourceId$k}),sourceId$j=1,optimism=defineChain({...chainConfig$2,id:10,name:"OP Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.optimism.io"]}},blockExplorers:{default:{name:"Optimism Explorer",url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$j]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[sourceId$j]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[sourceId$j]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[sourceId$j]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId:sourceId$j}),sourceId$i=5,optimismGoerli=defineChain({...chainConfig$2,id:420,name:"Optimism Goerli",nativeCurrency:{name:"Goerli Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://goerli.optimism.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli-optimism.etherscan.io",apiUrl:"https://goerli-optimism.etherscan.io/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$i]:{address:"0xE6Dfba0953616Bacab0c9A8ecb3a9BBa77FC15c0"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:49461},portal:{[sourceId$i]:{address:"0x5b47E1A08Ea6d985D6649300584e6722Ec4B1383"}},l1StandardBridge:{[sourceId$i]:{address:"0x636Af16bf2f682dD3109e60102b8E1A089FedAa8"}}},testnet:!0,sourceId:sourceId$i}),sourceId$h=11155111,optimismSepolia=defineChain({...chainConfig$2,id:11155420,name:"OP Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.optimism.io"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com",apiUrl:"https://optimism-sepolia.blockscout.com/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$h]:{address:"0x05F9613aDB30026FFd634f38e5C4dFd30a197Fa1"}},l2OutputOracle:{[sourceId$h]:{address:"0x90E9c4f8a994a250F6aEfd61CAFb4F2e895D458F"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1620204},portal:{[sourceId$h]:{address:"0x16Fc5058F25648194471939df75CF27A2fdC48BC"}},l1StandardBridge:{[sourceId$h]:{address:"0xFBb0621E0B23b5478B630BD55a5f21f67730B0F1"}}},testnet:!0,sourceId:sourceId$h}),optopia=defineChain({id:62050,name:"Optopia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-mainnet.optopia.ai"]}},blockExplorers:{default:{name:"Optopia Explorer",url:"https://scan.optopia.ai"}},testnet:!1}),optopiaTestnet=defineChain({id:62049,name:"Optopia Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.optopia.ai"]}},blockExplorers:{default:{name:"Optopia Explorer",url:"https://scan-testnet.optopia.ai"}},testnet:!0}),orderly=defineChain({id:291,name:"Orderly",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.orderly.network"]}},blockExplorers:{default:{name:"Orderly Explorer",url:"https://explorer.orderly.network"}},testnet:!1}),orderlySepolia=defineChain({id:4460,name:"Orderly Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://l2-orderly-l2-4460-sepolia-8tc3sd7dvy.t.conduit.xyz"]}},blockExplorers:{default:{name:"Orderly Explorer",url:"https://explorerl2new-orderly-l2-4460-sepolia-8tc3sd7dvy.t.conduit.xyz"}},testnet:!0}),otimDevnet=defineChain({id:41144114,name:"Otim Devnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["http://devnet.otim.xyz"]}},contracts:{batchInvoker:{address:"0x5FbDB2315678afecb367f032d93F642f64180aa3"}}}),palm=defineChain({id:11297108109,name:"Palm",nativeCurrency:{decimals:18,name:"PALM",symbol:"PALM"},rpcUrls:{default:{http:["https://palm-mainnet.public.blastapi.io"],webSocket:["wss://palm-mainnet.public.blastapi.io"]}},blockExplorers:{default:{name:"Chainlens",url:"https://palm.chainlens.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15429248}}}),palmTestnet=defineChain({id:11297108099,name:"Palm Testnet",nativeCurrency:{decimals:18,name:"PALM",symbol:"PALM"},rpcUrls:{default:{http:["https://palm-mainnet.public.blastapi.io"],webSocket:["wss://palm-mainnet.public.blastapi.io"]}},blockExplorers:{default:{name:"Chainlens",url:"https://palm.chainlens.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:15429248}},testnet:!0}),sourceId$g=1,pgn=defineChain({id:424,network:"pgn",name:"PGN",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.publicgoods.network"]}},blockExplorers:{default:{name:"PGN Explorer",url:"https://explorer.publicgoods.network",apiUrl:"https://explorer.publicgoods.network/api"}},contracts:{l2OutputOracle:{[sourceId$g]:{address:"0x9E6204F750cD866b299594e2aC9eA824E2e5f95c"}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3380209},portal:{[sourceId$g]:{address:"0xb26Fd985c5959bBB382BAFdD0b879E149e48116c"}},l1StandardBridge:{[sourceId$g]:{address:"0xD0204B9527C1bA7bD765Fa5CCD9355d38338272b"}}},formatters:formatters$1,sourceId:sourceId$g}),sourceId$f=11155111,pgnTestnet=defineChain({id:58008,network:"pgn-testnet",name:"PGN ",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.publicgoods.network"]}},blockExplorers:{default:{name:"PGN Testnet Explorer",url:"https://explorer.sepolia.publicgoods.network",apiUrl:"https://explorer.sepolia.publicgoods.network/api"}},contracts:{l2OutputOracle:{[sourceId$f]:{address:"0xD5bAc3152ffC25318F848B3DD5dA6C85171BaEEe"}},portal:{[sourceId$f]:{address:"0xF04BdD5353Bb0EFF6CA60CfcC78594278eBfE179"}},l1StandardBridge:{[sourceId$f]:{address:"0xFaE6abCAF30D23e233AC7faF747F2fC3a5a6Bfa3"}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3754925}},formatters:formatters$1,sourceId:sourceId$f,testnet:!0}),phoenix=defineChain({id:13381,name:"Phoenix Blockchain",nativeCurrency:{name:"Phoenix",symbol:"PHX",decimals:18},rpcUrls:{default:{http:["https://rpc.phoenixplorer.com"]}},blockExplorers:{default:{name:"Phoenixplorer",url:"https://phoenixplorer.com",apiUrl:"https://phoenixplorer.com/api"}},contracts:{multicall3:{address:"0x498cF757a575cFF2c2Ed9f532f56Efa797f86442",blockCreated:5620192}}}),planq=defineChain({id:7070,name:"Planq Mainnet",nativeCurrency:{decimals:18,name:"PLQ",symbol:"PLQ"},rpcUrls:{default:{http:["https://evm-rpc.planq.network"]}},blockExplorers:{default:{name:"Planq Explorer",url:"https://evm.planq.network"}},testnet:!1}),playfiAlbireo=defineChain({...chainConfig$3,id:1612127,name:"PlayFi Albireo Testnet",network:"albireo",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://albireo-rpc.playfi.ai"],webSocket:["wss://albireo-rpc-ws.playfi.ai/ws"]}},blockExplorers:{default:{name:"PlayFi Albireo Explorer",url:"https://albireo-explorer.playfi.ai"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"}},testnet:!0}),plinga=defineChain({id:242,name:"Plinga",nativeCurrency:{name:"Plinga",symbol:"PLINGA",decimals:18},rpcUrls:{default:{http:["https://rpcurl.mainnet.plgchain.com"]}},blockExplorers:{default:{name:"Plgscan",url:"https://www.plgscan.com"}},contracts:{multicall3:{address:"0x0989576160f2e7092908BB9479631b901060b6e4",blockCreated:204489}}}),sourceId$e=11155111,plumeTestnet=defineChain({id:161221135,name:"Plume Testnet",nativeCurrency:{name:"Plume Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.plumenetwork.xyz/http"],webSocket:["wss://testnet-rpc.plumenetwork.xyz/ws"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet-explorer.plumenetwork.xyz",apiUrl:"https://testnet-explorer.plumenetwork.xyz/api"}},testnet:!0,sourceId:sourceId$e}),polterTestnet=defineChain({id:631571,name:"Polter Testnet",nativeCurrency:{decimals:18,name:"Polter GHST",symbol:"GHST"},rpcUrls:{default:{http:["https://geist-polter.g.alchemy.com/public"]}},blockExplorers:{default:{name:"Blockscout",url:"https://polter-testnet.explorer.alchemy.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:11245}},testnet:!0}),polygon=defineChain({id:137,name:"Polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}}),polygonAmoy=defineChain({id:80002,name:"Polygon Amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://amoy.polygonscan.com",apiUrl:"https://api-amoy.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:3127388}},testnet:!0}),polygonMumbai=defineChain({id:80001,name:"Polygon Mumbai",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{default:{http:["https://rpc.ankr.com/polygon_mumbai"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://mumbai.polygonscan.com",apiUrl:"https://api-testnet.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}},testnet:!0}),polygonZkEvm=defineChain({id:1101,name:"Polygon zkEVM",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://zkevm-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://zkevm.polygonscan.com",apiUrl:"https://api-zkevm.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:57746}}}),polygonZkEvmCardona=defineChain({id:2442,name:"Polygon zkEVM Cardona",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.cardona.zkevm-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://cardona-zkevm.polygonscan.com",apiUrl:"https://cardona-zkevm.polygonscan.com/api"}},testnet:!0,contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:114091}}}),polygonZkEvmTestnet=defineChain({id:1442,name:"Polygon zkEVM Testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.public.zkevm-test.net"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://testnet-zkevm.polygonscan.com",apiUrl:"https://testnet-zkevm.polygonscan.com/api"}},testnet:!0,contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:525686}}}),pulsechain=defineChain({id:369,name:"PulseChain",nativeCurrency:{name:"Pulse",symbol:"PLS",decimals:18},testnet:!1,rpcUrls:{default:{http:["https://rpc.pulsechain.com"],webSocket:["wss://ws.pulsechain.com"]}},blockExplorers:{default:{name:"PulseScan",url:"https://scan.pulsechain.com",apiUrl:"https://api.scan.pulsechain.com/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),pulsechainV4=defineChain({id:943,name:"PulseChain V4",testnet:!0,nativeCurrency:{name:"V4 Pulse",symbol:"v4PLS",decimals:18},rpcUrls:{default:{http:["https://rpc.v4.testnet.pulsechain.com"],webSocket:["wss://ws.v4.testnet.pulsechain.com"]}},blockExplorers:{default:{name:"PulseScan",url:"https://scan.v4.testnet.pulsechain.com",apiUrl:"https://scan.v4.testnet.pulsechain.com/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),ql1=defineChain({id:766,name:"QL1",nativeCurrency:{decimals:18,name:"QOM",symbol:"QOM"},rpcUrls:{default:{http:["https://rpc.qom.one"]}},blockExplorers:{default:{name:"Ql1 Explorer",url:"https://scan.qom.one"}},contracts:{multicall3:{address:"0x7A52370716ea730585884F5BDB0f6E60C39b8C64"}},testnet:!1}),qMainnet=defineChain({id:35441,name:"Q Mainnet",nativeCurrency:{decimals:18,name:"Q",symbol:"Q"},rpcUrls:{default:{http:["https://rpc.q.org"]}},blockExplorers:{default:{name:"Q Mainnet Explorer",url:"https://explorer.q.org",apiUrl:"https://explorer.q.org/api"}}}),qTestnet=defineChain({id:35443,name:"Q Testnet",nativeCurrency:{decimals:18,name:"Q",symbol:"Q"},rpcUrls:{default:{http:["https://rpc.qtestnet.org"]}},blockExplorers:{default:{name:"Q Testnet Explorer",url:"https://explorer.qtestnet.org",apiUrl:"https://explorer.qtestnet.org/api"}},testnet:!0}),real=defineChain({id:111188,name:"re.al",nativeCurrency:{name:"reETH",decimals:18,symbol:"reETH"},rpcUrls:{default:{http:["https://real.drpc.org"]}},blockExplorers:{default:{name:"re.al Explorer",url:"https://explorer.re.al",apiUrl:"https://explorer.re.al/api/v2"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:695}}}),redbellyTestnet=defineChain({id:153,name:"Redbelly Network Testnet",nativeCurrency:{name:"Redbelly Native Coin",symbol:"RBNT",decimals:18},rpcUrls:{default:{http:["https://governors.testnet.redbelly.network"]}},blockExplorers:{default:{name:"Ethernal",url:"https://explorer.testnet.redbelly.network",apiUrl:"https://ethernal.fly.dev/api"}},testnet:!0}),sourceId$d=1,redstone=defineChain({...chainConfig$2,name:"Redstone",id:690,sourceId:sourceId$d,nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.redstonechain.com"],webSocket:["wss://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$d]:{address:"0xC7bCb0e8839a28A1cFadd1CF716de9016CdA51ae",blockCreated:19578329}},l2OutputOracle:{[sourceId$d]:{address:"0xa426A052f657AEEefc298b3B5c35a470e4739d69",blockCreated:19578337}},l1StandardBridge:{[sourceId$d]:{address:"0xc473ca7E02af24c129c2eEf51F2aDf0411c1Df69",blockCreated:19578331}}}}),rei=defineChain({id:47805,name:"REI Mainnet",nativeCurrency:{decimals:18,name:"REI",symbol:"REI"},rpcUrls:{default:{http:["https://rpc.rei.network"],webSocket:["wss://rpc.rei.network"]}},blockExplorers:{default:{name:"REI Scan",url:"https://scan.rei.network"}},testnet:!1}),reyaNetwork=defineChain({id:1729,name:"Reya Network",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.reya.network"],webSocket:["wss://ws.reya.network"]}},blockExplorers:{default:{name:"Reya Network Explorer",url:"https://explorer.reya.network"}},testnet:!1}),rollux=defineChain({id:570,name:"Rollux Mainnet",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc.rollux.com"],webSocket:["wss://rpc.rollux.com/wss"]}},blockExplorers:{default:{name:"RolluxExplorer",url:"https://explorer.rollux.com",apiUrl:"https://explorer.rollux.com/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:119222}}}),rolluxTestnet=defineChain({id:57e3,name:"Rollux Testnet",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc-tanenbaum.rollux.com/"],webSocket:["wss://rpc-tanenbaum.rollux.com/wss"]}},blockExplorers:{default:{name:"RolluxTestnetExplorer",url:"https://rollux.tanenbaum.io",apiUrl:"https://rollux.tanenbaum.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1813675}}}),ronin=defineChain({id:2020,name:"Ronin",nativeCurrency:{name:"RON",symbol:"RON",decimals:18},rpcUrls:{default:{http:["https://api.roninchain.com/rpc"]}},blockExplorers:{default:{name:"Ronin Explorer",url:"https://app.roninchain.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:26023535}}}),root=defineChain({id:7668,name:"The Root Network",nativeCurrency:{decimals:18,name:"XRP",symbol:"XRP"},rpcUrls:{default:{http:["https://root.rootnet.live/archive"],webSocket:["wss://root.rootnet.live/archive/ws"]}},blockExplorers:{default:{name:"Rootscan",url:"https://rootscan.io"}},contracts:{multicall3:{address:"0xc9C2E2429AeC354916c476B30d729deDdC94988d",blockCreated:9218338}}}),rootPorcini=defineChain({id:7672,name:"The Root Network - Porcini",nativeCurrency:{decimals:18,name:"XRP",symbol:"XRP"},rpcUrls:{default:{http:["https://porcini.rootnet.app/archive"],webSocket:["wss://porcini.rootnet.app/archive/ws"]}},blockExplorers:{default:{name:"Rootscan",url:"https://porcini.rootscan.io"}},contracts:{multicall3:{address:"0xc9C2E2429AeC354916c476B30d729deDdC94988d",blockCreated:10555692}},testnet:!0}),rootstock=defineChain({id:30,name:"Rootstock Mainnet",network:"rootstock",nativeCurrency:{decimals:18,name:"Rootstock Bitcoin",symbol:"RBTC"},rpcUrls:{default:{http:["https://public-node.rsk.co"]}},blockExplorers:{default:{name:"RSK Explorer",url:"https://explorer.rsk.co"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:4249540}}}),rootstockTestnet=defineChain({id:31,name:"Rootstock Testnet",network:"rootstock",nativeCurrency:{decimals:18,name:"Rootstock Bitcoin",symbol:"tRBTC"},rpcUrls:{default:{http:["https://public-node.testnet.rsk.co"]}},blockExplorers:{default:{name:"RSK Explorer",url:"https://explorer.testnet.rootstock.io"}},testnet:!0}),sourceId$c=1,rss3=defineChain({...chainConfig$2,id:12553,name:"RSS3 VSL Mainnet",nativeCurrency:{name:"RSS3",symbol:"RSS3",decimals:18},rpcUrls:{default:{http:["https://rpc.rss3.io"]}},blockExplorers:{default:{name:"RSS3 VSL Mainnet Scan",url:"https://scan.rss3.io",apiUrl:"https://scan.rss3.io/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$c]:{address:"0xE6f24d2C32B3109B18ed33cF08eFb490b1e09C10"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14193},portal:{[sourceId$c]:{address:"0x6A12432491bbbE8d3babf75F759766774C778Db4",blockCreated:19387057}},l1StandardBridge:{[sourceId$c]:{address:"0x4cbab69108Aa72151EDa5A3c164eA86845f18438"}}},sourceId:sourceId$c}),sourceId$b=11155111,rss3Sepolia=defineChain({...chainConfig$2,id:2331,name:"RSS3 VSL Sepolia Testnet",nativeCurrency:{name:"RSS3",symbol:"RSS3",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.rss3.io"]}},blockExplorers:{default:{name:"RSS3 VSL Sepolia Testnet Scan",url:"https://scan.testnet.rss3.io",apiUrl:"https://scan.testnet.rss3.io/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$b]:{address:"0xDb5c46C3Eaa6Ed6aE8b2379785DF7dd029C0dC81"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:55697},portal:{[sourceId$b]:{address:"0xcBD77E8E1E7F06B25baDe67142cdE82652Da7b57",blockCreated:5345035}},l1StandardBridge:{[sourceId$b]:{address:"0xdDD29bb63B0839FB1cE0eE439Ff027738595D07B"}}},testnet:!0,sourceId:sourceId$b}),saakuru=defineChain({id:7225878,name:"Saakuru Mainnet",nativeCurrency:{name:"OAS",symbol:"OAS",decimals:18},rpcUrls:{default:{http:["https://rpc.saakuru.network"]}},blockExplorers:{default:{name:"Saakuru Explorer",url:"https://explorer.saakuru.network"}},testnet:!1}),saigon=defineChain({id:2021,name:"Saigon Testnet",nativeCurrency:{name:"RON",symbol:"RON",decimals:18},rpcUrls:{default:{http:["https://saigon-testnet.roninchain.com/rpc"]}},blockExplorers:{default:{name:"Saigon Explorer",url:"https://saigon-app.roninchain.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:18736871}},testnet:!0}),sanko=defineChain({id:1996,name:"Sanko",nativeCurrency:{name:"DMT",symbol:"DMT",decimals:18},rpcUrls:{default:{http:["https://mainnet.sanko.xyz"]}},blockExplorers:{default:{name:"Sanko Explorer",url:"https://explorer.sanko.xyz"}},testnet:!1}),sapphire=defineChain({id:23294,name:"Oasis Sapphire",network:"sapphire",nativeCurrency:{name:"Sapphire Rose",symbol:"ROSE",decimals:18},rpcUrls:{default:{http:["https://sapphire.oasis.io"],webSocket:["wss://sapphire.oasis.io/ws"]}},blockExplorers:{default:{name:"Oasis Explorer",url:"https://explorer.oasis.io/mainnet/sapphire"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:734531}}}),sapphireTestnet=defineChain({id:23295,name:"Oasis Sapphire Testnet",network:"sapphire-testnet",nativeCurrency:{name:"Sapphire Test Rose",symbol:"TEST",decimals:18},rpcUrls:{default:{http:["https://testnet.sapphire.oasis.dev"],webSocket:["wss://testnet.sapphire.oasis.dev/ws"]}},blockExplorers:{default:{name:"Oasis Explorer",url:"https://explorer.oasis.io/testnet/sapphire"}},testnet:!0}),satoshiVM=defineChain({id:3109,name:"SatoshiVM Alpha Mainnet",nativeCurrency:{name:"BTC",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://alpha-rpc-node-http.svmscan.io"]}},blockExplorers:{default:{name:"blockscout",url:"https://svmscan.io",apiUrl:"https://svmscan.io/api"}}}),satoshiVMTestnet=defineChain({id:3110,name:"SatoshiVM Testnet",nativeCurrency:{name:"BTC",symbol:"BTC",decimals:18},rpcUrls:{default:{http:["https://test-rpc-node-http.svmscan.io"]}},blockExplorers:{default:{name:"blockscout",url:"https://testnet.svmscan.io",apiUrl:"https://testnet.svmscan.io/api"}},testnet:!0}),scroll=defineChain({id:534352,name:"Scroll",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.scroll.io"],webSocket:["wss://wss-rpc.scroll.io/ws"]}},blockExplorers:{default:{name:"Scrollscan",url:"https://scrollscan.com",apiUrl:"https://api.scrollscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14}},testnet:!1}),scrollSepolia=defineChain({id:534351,name:"Scroll Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rpc.scroll.io"]}},blockExplorers:{default:{name:"Scrollscan",url:"https://sepolia.scrollscan.com",apiUrl:"https://api-sepolia.scrollscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:9473}},testnet:!0}),sei=defineChain({id:1329,name:"Sei Network",nativeCurrency:{name:"Sei",symbol:"SEI",decimals:18},rpcUrls:{default:{http:["https://evm-rpc.sei-apis.com/"],webSocket:["wss://evm-ws.sei-apis.com/"]}},blockExplorers:{default:{name:"Seitrace",url:"https://seitrace.com",apiUrl:"https://seitrace.com/pacific-1/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11"}}}),seiDevnet=defineChain({id:713715,name:"Sei Devnet",nativeCurrency:{name:"Sei",symbol:"SEI",decimals:18},rpcUrls:{default:{http:["https://evm-rpc-arctic-1.sei-apis.com"]}},blockExplorers:{default:{name:"Seitrace",url:"https://seitrace.com"}},testnet:!0}),seiTestnet=defineChain({id:1328,name:"Sei Testnet",nativeCurrency:{name:"Sei",symbol:"SEI",decimals:18},rpcUrls:{default:{http:["https://evm-rpc-testnet.sei-apis.com"],webSocket:["wss://evm-ws-testnet.sei-apis.com"]}},blockExplorers:{default:{name:"Seitrace",url:"https://seitrace.com"}},testnet:!0}),sepolia=defineChain({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.drpc.org"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",blockCreated:5317080}},testnet:!0}),sourceId$a=1,shape=defineChain({...chainConfig$2,id:360,name:"Shape",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.shape.network"]}},blockExplorers:{default:{name:"shapescan",url:"https://shapescan.xyz",apiUrl:"https://shapescan.xyz/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$a]:{address:"0x6Ef8c69CfE4635d866e3E02732068022c06e724D",blockCreated:20369940}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1},portal:{[sourceId$a]:{address:"0xEB06fFa16011B5628BaB98E29776361c83741dd3",blockCreated:20369933}},l1StandardBridge:{[sourceId$a]:{address:"0x62Edd5f4930Ea92dCa3fB81689bDD9b9d076b57B",blockCreated:20369935}}},sourceId:sourceId$a}),sourceId$9=11155111,shapeSepolia=defineChain({...chainConfig$2,id:11011,name:"Shape Sepolia Testnet",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.shape.network"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer-sepolia.shape.network/",apiUrl:"https://explorer-sepolia.shape.network/api/v2"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1}},testnet:!0,sourceId:sourceId$9}),shardeumSphinx=defineChain({id:8082,name:"Shardeum Sphinx",nativeCurrency:{name:"SHARDEUM",symbol:"SHM",decimals:18},rpcUrls:{default:{http:["https://sphinx.shardeum.org"]}},blockExplorers:{default:{name:"Shardeum Explorer",url:"https://explorer-sphinx.shardeum.org"}},testnet:!0}),shibarium=defineChain({id:109,name:"Shibarium",network:"shibarium",nativeCurrency:{name:"Bone",symbol:"BONE",decimals:18},rpcUrls:{default:{http:["https://rpc.shibrpc.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://shibariumscan.io"}},contracts:{multicall3:{address:"0x864Bf681ADD6052395188A89101A1B37d3B4C961",blockCreated:265900}}}),shibariumTestnet=defineChain({id:157,name:"Puppynet Shibarium",nativeCurrency:{decimals:18,name:"Bone",symbol:"BONE"},rpcUrls:{default:{http:["https://puppynet.shibrpc.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://puppyscan.shib.io",apiUrl:"https://puppyscan.shib.io/api"}},contracts:{multicall3:{address:"0xA4029b74FBA366c926eDFA7Dd10B21C621170a4c",blockCreated:3035769}},testnet:!0}),shiden=defineChain({id:336,name:"Shiden",nativeCurrency:{decimals:18,name:"SDN",symbol:"SDN"},rpcUrls:{default:{http:["https://shiden.public.blastapi.io"],webSocket:["wss://shiden-rpc.dwellir.com"]}},blockExplorers:{default:{name:"Shiden Scan",url:"https://shiden.subscan.io"}},testnet:!1}),shimmer=defineChain({id:148,name:"Shimmer",network:"shimmer",nativeCurrency:{decimals:18,name:"Shimmer",symbol:"SMR"},rpcUrls:{default:{http:["https://json-rpc.evm.shimmer.network"]}},blockExplorers:{default:{name:"Shimmer Network Explorer",url:"https://explorer.evm.shimmer.network",apiUrl:"https://explorer.evm.shimmer.network/api"}}}),shimmerTestnet=defineChain({id:1073,name:"Shimmer Testnet",network:"shimmer-testnet",nativeCurrency:{decimals:18,name:"Shimmer",symbol:"SMR"},rpcUrls:{default:{http:["https://json-rpc.evm.testnet.shimmer.network"]}},blockExplorers:{default:{name:"Shimmer Network Explorer",url:"https://explorer.evm.testnet.shimmer.network",apiUrl:"https://explorer.evm.testnet.shimmer.network/api"}},testnet:!0}),silicon=defineChain({id:2355,name:"Silicon zkEVM",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.silicon.network","https://silicon-mainnet.nodeinfra.com"]}},blockExplorers:{default:{name:"SiliconScope",url:"https://scope.silicon.network"}}}),siliconSepolia=defineChain({id:1722641160,name:"Silicon Sepolia zkEVM",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc-sepolia.silicon.network","https://silicon-testnet.nodeinfra.com"]}},blockExplorers:{default:{name:"SiliconSepoliaScope",url:"https://scope-sepolia.silicon.network"}},testnet:!0}),sixProtocol=defineChain({id:98,name:"Six Protocol",nativeCurrency:{decimals:18,name:"SIX",symbol:"SIX"},rpcUrls:{default:{http:["https://sixnet-rpc-evm.sixprotocol.net"]}},blockExplorers:{default:{name:"Six Protocol Scan",url:"https://sixscan.io/sixnet"}},testnet:!1}),skaleBlockBrawlers=defineChain({id:391845894,name:"SKALE | Block Brawlers",nativeCurrency:{name:"BRAWL",symbol:"BRAWL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/frayed-decent-antares"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/frayed-decent-antares"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://frayed-decent-antares.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleCalypso=defineChain({id:1564830818,name:"SKALE | Calypso NFT Hub",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/honorable-steel-rasalhague"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/honorable-steel-rasalhague"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://honorable-steel-rasalhague.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3107626}}}),skaleCalypsoTestnet=defineChain({id:974399131,name:"SKALE Calypso Testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://testnet.skalenodes.com/v1/giant-half-dual-testnet"],webSocket:["wss://testnet.skalenodes.com/v1/ws/giant-half-dual-testnet"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://giant-half-dual-testnet.explorer.testnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:103220}},testnet:!0}),skaleCryptoBlades=defineChain({id:1026062157,name:"SKALE | CryptoBlades",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/affectionate-immediate-pollux"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/affectionate-immediate-pollux"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://affectionate-immediate-pollux.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleCryptoColosseum=defineChain({id:1032942172,name:"SKALE | Crypto Colosseum",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/haunting-devoted-deneb"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/haunting-devoted-deneb"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://haunting-devoted-deneb.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleEuropa=defineChain({id:2046399126,name:"SKALE | Europa Liquidity Hub",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/elated-tan-skat"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/elated-tan-skat"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://elated-tan-skat.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:3113495}}}),skaleEuropaTestnet=defineChain({id:1444673419,name:"SKALE Europa Testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://testnet.skalenodes.com/v1/juicy-low-small-testnet"],webSocket:["wss://testnet.skalenodes.com/v1/ws/juicy-low-small-testnet"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://juicy-low-small-testnet.explorer.testnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:110858}},testnet:!0}),skaleExorde=defineChain({id:2139927552,name:"SKALE | Exorde",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/light-vast-diphda"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/light-vast-diphda"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://light-vast-diphda.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleHumanProtocol=defineChain({id:1273227453,name:"SKALE | Human Protocol",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/wan-red-ain"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/wan-red-ain"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://wan-red-ain.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleNebula=defineChain({id:1482601649,name:"SKALE | Nebula Gaming Hub",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/green-giddy-denebola"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/green-giddy-denebola"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://green-giddy-denebola.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2372986}}}),skaleNebulaTestnet=defineChain({id:37084624,name:"SKALE Nebula Testnet",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://testnet.skalenodes.com/v1/lanky-ill-funny-testnet"],webSocket:["wss://testnet.skalenodes.com/v1/ws/lanky-ill-funny-testnet"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://lanky-ill-funny-testnet.explorer.testnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:105141}},testnet:!0}),skaleRazor=defineChain({id:278611351,name:"SKALE | Razor Network",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/turbulent-unique-scheat"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/turbulent-unique-scheat"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://turbulent-unique-scheat.explorer.mainnet.skalenodes.com"}},contracts:{}}),skaleTitan=defineChain({id:1350216234,name:"SKALE | Titan Community Hub",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://mainnet.skalenodes.com/v1/parallel-stormy-spica"],webSocket:["wss://mainnet.skalenodes.com/v1/ws/parallel-stormy-spica"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://parallel-stormy-spica.explorer.mainnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2076458}}}),skaleTitanTestnet=defineChain({id:1020352220,name:"SKALE Titan Hub",nativeCurrency:{name:"sFUEL",symbol:"sFUEL",decimals:18},rpcUrls:{default:{http:["https://testnet.skalenodes.com/v1/aware-fake-trim-testnet"],webSocket:["wss://testnet.skalenodes.com/v1/ws/aware-fake-trim-testnet"]}},blockExplorers:{default:{name:"SKALE Explorer",url:"https://aware-fake-trim-testnet.explorer.testnet.skalenodes.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:104072}},testnet:!0}),sketchpad=defineChain({id:984123,name:"Forma Sketchpad",network:"sketchpad",nativeCurrency:{symbol:"TIA",name:"TIA",decimals:18},rpcUrls:{default:{http:["https://rpc.sketchpad-1.forma.art"],webSocket:["wss://ws.sketchpad-1.forma.art"]}},blockExplorers:{default:{name:"Sketchpad Explorer",url:"https://explorer.sketchpad-1.forma.art"}},testnet:!0}),sourceId$8=1,snax=defineChain({...chainConfig$2,id:2192,network:"snaxchain-mainnet",name:"SnaxChain",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.snaxchain.io"]}},blockExplorers:{default:{name:"Snax Explorer",url:"https://explorer.snaxchain.io",apiUrl:"https://explorer.snaxchain.io/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$8]:{address:"0x472562Fcf26D6b2793f8E0b0fB660ba0E5e08A46"}},l2OutputOracle:{[sourceId$8]:{address:"0x2172e492Fc807F5d5645D0E3543f139ECF539294"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$8]:{address:"0x79f446D024d74D0Bb6E699C131c703463c5D65E9"}},l1StandardBridge:{[sourceId$8]:{address:"0x6534Bdb6b5c060d3e6aa833433333135eFE8E0aA"}}},sourceId:sourceId$8}),sourceId$7=11155111,snaxTestnet=defineChain({...chainConfig$2,id:13001,network:"snaxchain-testnet",name:"SnaxChain Testnet",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://testnet.snaxchain.io"]}},blockExplorers:{default:{name:"Snax Explorer",url:"https://testnet-explorer.snaxchain.io",apiUrl:"https://testnet-explorer.snaxchain.io/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$7]:{address:"0x206a75d89d45F146C54020F132FF93bEDD09f55E"}},l2OutputOracle:{[sourceId$7]:{address:"0x60e3A368a4cdCEf85ffB964e372726F56A46221e"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11"},portal:{[sourceId$7]:{address:"0xb5afdd0E8dDF081Ef90e8A3e0c7b5798e66E954E"}},l1StandardBridge:{[sourceId$7]:{address:"0xbd37E1a59D4C00C9A46F75018dffd84061bC5f74"}}},testnet:!0,sourceId:sourceId$7}),sourceId$6=11155111,soneiumMinato=defineChain({...chainConfig$2,id:1946,name:"Soneium Minato Testnet",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.minato.soneium.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://soneium-minato.blockscout.com",apiUrl:"https://soneium-minato.blockscout.com/api"}},contracts:{...chainConfig$2.contracts,disputeGameFactory:{[sourceId$6]:{address:"0xB3Ad2c38E6e0640d7ce6aA952AB3A60E81bf7a01"}},l2OutputOracle:{[sourceId$6]:{address:"0x710e5286C746eC38beeB7538d0146f60D27be343"}},portal:{[sourceId$6]:{address:"0x65ea1489741A5D72fFdD8e6485B216bBdcC15Af3",blockCreated:6466136}},l1StandardBridge:{[sourceId$6]:{address:"0x5f5a404A5edabcDD80DB05E8e54A78c9EBF000C2",blockCreated:6466136}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1}},testnet:!0,sourceId:sourceId$6}),sonicTestnet=defineChain({id:64165,name:"Sonic Testnet",nativeCurrency:{decimals:18,name:"Sonic",symbol:"S"},rpcUrls:{default:{http:["https://rpc.testnet.soniclabs.com"]}},blockExplorers:{default:{name:"Sonic Testnet Explorer",url:"https://testnet.soniclabs.com/"}},testnet:!0}),songbird=defineChain({id:19,name:"Songbird Canary-Network",nativeCurrency:{decimals:18,name:"Songbird",symbol:"SGB"},rpcUrls:{default:{http:["https://songbird-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Songbird Explorer",url:"https://songbird-explorer.flare.network",apiUrl:"https://songbird-explorer.flare.network/api"}}}),songbirdTestnet=defineChain({id:16,name:"Songbird Testnet Coston",nativeCurrency:{decimals:18,name:"Coston Flare",symbol:"CFLR"},rpcUrls:{default:{http:["https://coston-api.flare.network/ext/C/rpc"]}},blockExplorers:{default:{name:"Coston Explorer",url:"https://coston-explorer.flare.network",apiUrl:"https://coston-explorer.flare.network/api"}},testnet:!0}),sophon=defineChain({...chainConfig$3,id:50104,name:"Sophon",nativeCurrency:{decimals:18,name:"Sophon",symbol:"SOPH"},rpcUrls:{default:{http:["https://rpc.sophon.xyz"],webSocket:["wss://rpc.sophon.xyz/ws"]}},blockExplorers:{default:{name:"Sophon Block Explorer",url:"https://explorer.sophon.xyz"}},contracts:{multicall3:{address:"0x5f4867441d2416cA88B1b3fd38f21811680CD2C8",blockCreated:116}},testnet:!1}),sophonTestnet=defineChain({...chainConfig$3,id:531050104,name:"Sophon Testnet",nativeCurrency:{decimals:18,name:"Sophon",symbol:"SOPH"},rpcUrls:{default:{http:["https://rpc.testnet.sophon.xyz"],webSocket:["wss://rpc.testnet.sophon.xyz/ws"]}},blockExplorers:{default:{name:"Sophon Block Explorer",url:"https://explorer.testnet.sophon.xyz"}},contracts:{multicall3:{address:"0x83c04d112adedA2C6D9037bb6ecb42E7f0b108Af",blockCreated:15642}},testnet:!0}),spicy=defineChain({id:88882,name:"Chiliz Spicy Testnet",network:"chiliz-spicy-Testnet",nativeCurrency:{decimals:18,name:"CHZ",symbol:"CHZ"},rpcUrls:{default:{http:["https://spicy-rpc.chiliz.com","https://chiliz-spicy-rpc.publicnode.com"],webSocket:["wss://spicy-rpc-ws.chiliz.com","wss://chiliz-spicy-rpc.publicnode.com"]}},blockExplorers:{default:{name:"Chiliz Explorer",url:"http://spicy-explorer.chiliz.com",apiUrl:"http://spicy-explorer.chiliz.com/api"}},testnet:!0}),step=defineChain({id:1234,name:"Step Network",nativeCurrency:{name:"FITFI",symbol:"FITFI",decimals:18},rpcUrls:{default:{http:["https://rpc.step.network"]}},blockExplorers:{default:{name:"Step Scan",url:"https://stepscan.io"}},testnet:!1}),storyTestnet=defineChain({id:1513,name:"Story Testnet",nativeCurrency:{decimals:18,name:"IP",symbol:"IP"},rpcUrls:{default:{http:["https://testnet.storyrpc.io"]}},blockExplorers:{default:{name:"Story Testnet Explorer",url:"https://testnet.storyscan.xyz"}},testnet:!0}),stratis=defineChain({id:105105,name:"Stratis Mainnet",network:"stratis",nativeCurrency:{name:"Stratis",symbol:"STRAX",decimals:18},rpcUrls:{default:{http:["https://rpc.stratisevm.com"]}},blockExplorers:{default:{name:"Stratis Explorer",url:"https://explorer.stratisevm.com"}}}),superlumio=defineChain({id:8866,name:"SuperLumio",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.lumio.io"]}},blockExplorers:{default:{name:"Lumio explorer",url:"https://explorer.lumio.io"}},testnet:!1}),superposition=defineChain({id:55244,name:"Superposition",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.superposition.so"]}},blockExplorers:{default:{name:"Superposition Explorer",url:"https://explorer.superposition.so"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:39}},testnet:!1}),swan=defineChain({id:254,name:"Swan Chain Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet-rpc.swanchain.org"]}},blockExplorers:{default:{name:"Swan Explorer",url:"https://swanscan.io"}},testnet:!1}),swanProximaTestnet=defineChain({id:20241133,name:"Swan Proxima Testnet",nativeCurrency:{name:"Swan Ether",symbol:"sETH",decimals:18},rpcUrls:{default:{http:["https://rpc-proxima.swanchain.io "]}},blockExplorers:{default:{name:"Swan Explorer",url:"https://proxima-explorer.swanchain.io"}},testnet:!0}),swanSaturnTestnet=defineChain({id:2024,name:"Swan Saturn Testnet",nativeCurrency:{name:"Swan Ether",symbol:"sETH",decimals:18},rpcUrls:{default:{http:["https://saturn-rpc.swanchain.io"]}},blockExplorers:{default:{name:"Swan Explorer",url:"https://saturn-explorer.swanchain.io"}},testnet:!0}),swissdlt=defineChain({id:94,name:"SwissDLT Mainnet",nativeCurrency:{decimals:18,name:"BCTS",symbol:"BCTS"},rpcUrls:{default:{http:["https://rpc.swissdlt.ch"]}},blockExplorers:{default:{name:"SwissDLT Explorer",url:"https://explorer.swissdlt.ch"}},testnet:!1}),syscoin=defineChain({id:57,name:"Syscoin Mainnet",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc.syscoin.org"],webSocket:["wss://rpc.syscoin.org/wss"]}},blockExplorers:{default:{name:"SyscoinExplorer",url:"https://explorer.syscoin.org",apiUrl:"https://explorer.syscoin.org/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:287139}}}),syscoinTestnet=defineChain({id:5700,name:"Syscoin Tanenbaum Testnet",nativeCurrency:{decimals:18,name:"Syscoin",symbol:"SYS"},rpcUrls:{default:{http:["https://rpc.tanenbaum.io"],webSocket:["wss://rpc.tanenbaum.io/wss"]}},blockExplorers:{default:{name:"SyscoinTestnetExplorer",url:"https://tanenbaum.io"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:271288}}}),taiko=defineChain({id:167e3,name:"Taiko Mainnet",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.mainnet.taiko.xyz"],webSocket:["wss://ws.mainnet.taiko.xyz"]}},blockExplorers:{default:{name:"Taikoscan",url:"https://taikoscan.io",apiUrl:"https://api.taikoscan.io/api"}},contracts:{multicall3:{address:"0xcb2436774C3e191c85056d248EF4260ce5f27A9D"}}}),taikoHekla=defineChain({id:167009,name:"Taiko Hekla L2",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.hekla.taiko.xyz"]}},blockExplorers:{default:{name:"Taikoscan",url:"https://hekla.taikoscan.network"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:59757}},testnet:!0}),taikoJolnir=defineChain({id:167007,name:"Taiko Jolnir (Alpha-5 Testnet)",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.jolnir.taiko.xyz"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer.jolnir.taiko.xyz"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:732706}},testnet:!0}),taikoKatla=defineChain({id:167008,name:"Taiko Katla (Alpha-6 Testnet)",network:"tko-katla",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.katla.taiko.xyz"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer.katla.taiko.xyz"}}}),taikoTestnetSepolia=defineChain({id:167005,name:"Taiko (Alpha-3 Testnet)",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.test.taiko.xyz"]}},blockExplorers:{default:{name:"blockscout",url:"https://explorer.test.taiko.xyz"}}}),taraxa=defineChain({id:841,name:"Taraxa Mainnet",nativeCurrency:{name:"Tara",symbol:"TARA",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.taraxa.io"]}},blockExplorers:{default:{name:"Taraxa Explorer",url:"https://explorer.mainnet.taraxa.io"}}}),taraxaTestnet=defineChain({id:842,name:"Taraxa Testnet",nativeCurrency:{name:"Tara",symbol:"TARA",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.taraxa.io"]}},blockExplorers:{default:{name:"Taraxa Explorer",url:"https://explorer.testnet.taraxa.io"}},testnet:!0}),telcoinTestnet=defineChain({id:2017,name:"Telcoin Adiri Testnet",nativeCurrency:{name:"Telcoin",symbol:"TEL",decimals:18},rpcUrls:{default:{http:["https://rpc.telcoin.network"]}},blockExplorers:{default:{name:"telscan",url:"https://telscan.io"}},testnet:!0}),telos=defineChain({id:40,name:"Telos",nativeCurrency:{decimals:18,name:"Telos",symbol:"TLOS"},rpcUrls:{default:{http:["https://mainnet.telos.net/evm"]}},blockExplorers:{default:{name:"Teloscan",url:"https://www.teloscan.io/"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:246530709}}}),telosTestnet=defineChain({id:41,name:"Telos",nativeCurrency:{decimals:18,name:"Telos",symbol:"TLOS"},rpcUrls:{default:{http:["https://testnet.telos.net/evm"]}},blockExplorers:{default:{name:"Teloscan (testnet)",url:"https://testnet.teloscan.io/"}},testnet:!0}),tenet=defineChain({id:1559,name:"Tenet",network:"tenet-mainnet",nativeCurrency:{name:"TENET",symbol:"TENET",decimals:18},rpcUrls:{default:{http:["https://rpc.tenet.org"]}},blockExplorers:{default:{name:"TenetScan Mainnet",url:"https://tenetscan.io",apiUrl:"https://tenetscan.io/api"}},testnet:!1}),thaiChain=defineChain({id:7,name:"ThaiChain",nativeCurrency:{name:"TCH",symbol:"TCH",decimals:18},rpcUrls:{default:{http:["https://rpc.thaichain.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://exp.thaichain.org",apiUrl:"https://exp.thaichain.org/api"}},contracts:{multicall3:{address:"0x0DaD6130e832c21719C5CE3bae93454E16A84826",blockCreated:4806386}},testnet:!1}),that=defineChain({id:8428,name:"THAT Mainnet",nativeCurrency:{name:"THAT",symbol:"THAT",decimals:18},rpcUrls:{default:{http:["https://api.thatchain.io/mainnet"]}},blockExplorers:{default:{name:"Blockscout",url:"https://that.blockscout.com"}},testnet:!1}),theta=defineChain({id:361,name:"Theta Mainnet",nativeCurrency:{name:"TFUEL",symbol:"TFUEL",decimals:18},rpcUrls:{default:{http:["https://eth-rpc-api.thetatoken.org/rpc"]}},blockExplorers:{default:{name:"Theta Explorer",url:"https://explorer.thetatoken.org"}},testnet:!1}),thetaTestnet=defineChain({id:365,name:"Theta Testnet",nativeCurrency:{name:"TFUEL",symbol:"TFUEL",decimals:18},rpcUrls:{default:{http:["https://eth-rpc-api-testnet.thetatoken.org/rpc"]}},blockExplorers:{default:{name:"Theta Explorer",url:"https://testnet-explorer.thetatoken.org"}},testnet:!0}),thunderCore=defineChain({id:108,name:"ThunderCore Mainnet",nativeCurrency:{name:"TT",symbol:"TT",decimals:18},rpcUrls:{default:{http:["https://mainnet-rpc.thundercore.com"]}},blockExplorers:{default:{name:"ThunderCore Explorer",url:"https://viewblock.io/thundercore"}},testnet:!1}),thunderTestnet=defineChain({id:997,name:"5ireChain Thunder Testnet",nativeCurrency:{name:"5ire Token",symbol:"5IRE",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.5ire.network"]}},blockExplorers:{default:{name:"5ireChain Thunder Explorer",url:"https://testnet.5irescan.io/"}},testnet:!0}),tiktrixTestnet=defineChain({id:62092,name:"TikTrix Testnet",nativeCurrency:{name:"tTTX",symbol:"tTTX",decimals:18},rpcUrls:{default:{http:["https://tiktrix-rpc.xyz"]}},blockExplorers:{default:{name:"TikTrix Testnet Explorer",url:"https://tiktrix.xyz"}},testnet:!0}),tomb=defineChain({id:6969,name:"Tomb Mainnet",nativeCurrency:{name:"TOMB",symbol:"TOMB",decimals:18},rpcUrls:{default:{http:["https://rpc.tombchain.com"]}},blockExplorers:{default:{name:"Tomb Explorer",url:"https://tombscout.com"}},testnet:!1}),tron=defineChain({id:728126428,name:"Tron",nativeCurrency:{name:"TRON",symbol:"TRX",decimals:6},rpcUrls:{default:{http:["https://api.trongrid.io/jsonrpc"]}},blockExplorers:{default:{name:"Tronscan",url:"https://tronscan.org",apiUrl:"https://apilist.tronscanapi.com/api"}}}),ubiq=defineChain({id:8,name:"Ubiq Mainnet",nativeCurrency:{name:"UBQ",symbol:"UBQ",decimals:18},rpcUrls:{default:{http:["https://pyrus2.ubiqscan.io"]}},blockExplorers:{default:{name:"Ubiq Scan",url:"https://ubiqscan.io"}},testnet:!1}),ultron=defineChain({id:1231,name:"Ultron Mainnet",nativeCurrency:{name:"ULX",symbol:"ULX",decimals:18},rpcUrls:{default:{http:["https://ultron-rpc.net"]}},blockExplorers:{default:{name:"Ultron Scan",url:"https://ulxscan.com"}},testnet:!1}),ultronTestnet=defineChain({id:1230,name:"Ultron Testnet",nativeCurrency:{name:"ULX",symbol:"ULX",decimals:18},rpcUrls:{default:{http:["https://ultron-dev.io"]}},blockExplorers:{default:{name:"Ultron Scan",url:"https://explorer.ultron-dev.io"}},testnet:!0}),sourceId$5=11155111,unichainSepolia=defineChain({...chainConfig$2,id:1301,name:"Unichain Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.unichain.org"]}},blockExplorers:{default:{name:"Uniscan",url:"https://sepolia.uniscan.xyz",apiUrl:"https://api-sepolia.uniscan.xyz/api"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:0},portal:{[sourceId$5]:{address:"0x0d83dab629f0e0F9d36c0Cbc89B69a489f0751bD"}},l1StandardBridge:{[sourceId$5]:{address:"0xea58fcA6849d79EAd1f26608855c2D6407d54Ce2"}},disputeGameFactory:{[sourceId$5]:{address:"0xeff73e5aa3B9AEC32c659Aa3E00444d20a84394b"}}},testnet:!0,sourceId:sourceId$5}),unique=defineChain({id:8880,name:"Unique Mainnet",nativeCurrency:{decimals:18,name:"UNQ",symbol:"UNQ"},rpcUrls:{default:{http:["https://rpc.unique.network"]}},blockExplorers:{default:{name:"Unique Subscan",url:"https://unique.subscan.io/"}}}),uniqueOpal=defineChain({id:8882,name:"Opal Testnet",nativeCurrency:{decimals:18,name:"OPL",symbol:"OPL"},rpcUrls:{default:{http:["https://rpc-opal.unique.network"]}},blockExplorers:{default:{name:"Opal Subscan",url:"https://opal.subscan.io/"}},testnet:!0}),uniqueQuartz=defineChain({id:8881,name:"Quartz Mainnet",nativeCurrency:{decimals:18,name:"QTZ",symbol:"QTZ"},rpcUrls:{default:{http:["https://rpc-quartz.unique.network"]}},blockExplorers:{default:{name:"Quartz Subscan",url:"https://quartz.subscan.io/"}}}),unreal=defineChain({id:18233,name:"Unreal",nativeCurrency:{name:"reETH",decimals:18,symbol:"reETH"},rpcUrls:{default:{http:["https://rpc.unreal-orbit.gelato.digital"]}},blockExplorers:{default:{name:"Unreal Explorer",url:"https://unreal.blockscout.com",apiUrl:"https://unreal.blockscout.com/api/v2"}},testnet:!0,contracts:{multicall3:{address:"0x8b6B0e60D8CD84898Ea8b981065A12F876eA5677",blockCreated:1745}}}),vanar=defineChain({id:2040,name:"Vanar Mainnet",nativeCurrency:{name:"VANRY",symbol:"VANRY",decimals:18},rpcUrls:{default:{http:["https://rpc.vanarchain.com"]}},blockExplorers:{default:{name:"Vanar Mainnet Explorer",url:"https://explorer.vanarchain.com/"}},testnet:!1}),vechain=defineChain({id:100009,name:"Vechain",nativeCurrency:{name:"VeChain",symbol:"VET",decimals:18},rpcUrls:{default:{http:["https://mainnet.vechain.org"]}},blockExplorers:{default:{name:"Vechain Explorer",url:"https://explore.vechain.org"},vechainStats:{name:"Vechain Stats",url:"https://vechainstats.com"}}}),velas=defineChain({id:106,name:"Velas EVM Mainnet",nativeCurrency:{name:"VLX",symbol:"VLX",decimals:18},rpcUrls:{default:{http:["https://evmexplorer.velas.com/rpc"]}},blockExplorers:{default:{name:"Velas Explorer",url:"https://evmexplorer.velas.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:55883577}},testnet:!1}),viction=defineChain({id:88,name:"Viction",nativeCurrency:{name:"Viction",symbol:"VIC",decimals:18},rpcUrls:{default:{http:["https://rpc.viction.xyz"]}},blockExplorers:{default:{name:"VIC Scan",url:"https://vicscan.xyz"}},testnet:!1}),victionTestnet=defineChain({id:89,name:"Viction Testnet",nativeCurrency:{name:"Viction",symbol:"VIC",decimals:18},rpcUrls:{default:{http:["https://rpc-testnet.viction.xyz"]}},blockExplorers:{default:{name:"VIC Scan",url:"https://testnet.vicscan.xyz"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:12170179}},testnet:!0}),vision=defineChain({id:888888,name:"Vision",nativeCurrency:{name:"VISION",symbol:"VS",decimals:18},rpcUrls:{default:{http:["https://infragrid.v.network/ethereum/compatible"]}},blockExplorers:{default:{name:"Vision Scan",url:"https://visionscan.org"}},testnet:!1}),visionTestnet=defineChain({id:666666,name:"Vision Testnet",nativeCurrency:{name:"VISION",symbol:"VS",decimals:18},rpcUrls:{default:{http:["https://vpioneer.infragrid.v.network/ethereum/compatible"]}},blockExplorers:{default:{name:"Vision Scan",url:"https://visionscan.org/?chain=vpioneer"}},testnet:!0}),wanchain=defineChain({id:888,name:"Wanchain",nativeCurrency:{name:"WANCHAIN",symbol:"WAN",decimals:18},rpcUrls:{default:{http:["https://gwan-ssl.wandevs.org:56891","https://gwan2-ssl.wandevs.org"]}},blockExplorers:{default:{name:"WanScan",url:"https://wanscan.org"}},contracts:{multicall3:{address:"0xcDF6A1566e78EB4594c86Fe73Fcdc82429e97fbB",blockCreated:25312390}}}),wanchainTestnet=defineChain({id:999,name:"Wanchain Testnet",nativeCurrency:{name:"WANCHAIN",symbol:"WANt",decimals:18},rpcUrls:{default:{http:["https://gwan-ssl.wandevs.org:46891"]}},blockExplorers:{default:{name:"WanScanTest",url:"https://wanscan.org"}},contracts:{multicall3:{address:"0x11c89bF4496c39FB80535Ffb4c92715839CC5324",blockCreated:24743448}},testnet:!0}),weaveVMAlphanet=defineChain({id:9496,name:"WeaveVM Alphanet",nativeCurrency:{name:"Testnet WeaveVM",symbol:"tWVM",decimals:18},rpcUrls:{default:{http:["https://testnet-rpc.wvm.dev"]}},blockExplorers:{default:{name:"WeaveVM Alphanet Explorer",url:"https://explorer.wvm.dev"}},testnet:!0}),wemix=defineChain({id:1111,name:"WEMIX",network:"wemix-mainnet",nativeCurrency:{name:"WEMIX",symbol:"WEMIX",decimals:18},rpcUrls:{default:{http:["https://api.wemix.com"]}},blockExplorers:{default:{name:"wemixExplorer",url:"https://explorer.wemix.com"}}}),wemixTestnet=defineChain({id:1112,name:"WEMIX Testnet",network:"wemix-testnet",nativeCurrency:{name:"WEMIX",symbol:"tWEMIX",decimals:18},rpcUrls:{default:{http:["https://api.test.wemix.com"]}},blockExplorers:{default:{name:"wemixExplorer",url:"https://testnet.wemixscan.com",apiUrl:"https://testnet.wemixscan.com/api"}},testnet:!0}),sourceId$4=1,worldchain=defineChain({...chainConfig$2,id:480,name:"World Chain",network:"worldchain",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://worldchain-mainnet.g.alchemy.com/public"]}},blockExplorers:{default:{name:"Worldscan",url:"https://worldscan.org",apiUrl:"https://api.worldscan.org/api"},blockscout:{name:"Blockscout",url:"https://worldchain-mainnet.explorer.alchemy.com",apiUrl:"https://worldchain-mainnet.explorer.alchemy.com/api"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:0},disputeGameFactory:{[sourceId$4]:{address:"0x0E90dCAFBC242D2C861A20Bb20EC8E7182965a52"}},l2OutputOracle:{[sourceId$4]:{address:"0x19A6d1E9034596196295CF148509796978343c5D"}},portal:{[sourceId$4]:{address:"0xd5ec14a83B7d95BE1E2Ac12523e2dEE12Cbeea6C"}},l1StandardBridge:{[sourceId$4]:{address:"0x470458C91978D2d929704489Ad730DC3E3001113"}}},testnet:!1,sourceId:sourceId$4}),sourceId$3=11155111,worldchainSepolia=defineChain({...chainConfig$2,id:4801,name:"World Chain Sepolia",network:"worldchain-sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://worldchain-sepolia.g.alchemy.com/public"]},public:{http:["https://worldchain-sepolia.g.alchemy.com/public"]}},blockExplorers:{default:{name:"Worldscan Sepolia",url:"https://sepolia.worldscan.org"},blockscout:{name:"Blockscout",url:"https://worldchain-sepolia.explorer.alchemy.com",apiUrl:"https://worldchain-sepolia.explorer.alchemy.com/api"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:0},disputeGameFactory:{[sourceId$3]:{address:"0x8cF97Ee616C986a070F5020d973b456D0120C253"}},l2OutputOracle:{[sourceId$3]:{address:"0xc8886f8BAb6Eaeb215aDB5f1c686BF699248300e"}},portal:{[sourceId$3]:{address:"0xFf6EBa109271fe6d4237EeeD4bAb1dD9A77dD1A4"}},l1StandardBridge:{[sourceId$3]:{address:"0xd7DF54b3989855eb66497301a4aAEc33Dbb3F8DE"}}},testnet:!0,sourceId:sourceId$3}),worldLand=defineChain({id:103,name:"WorldLand Mainnet",nativeCurrency:{decimals:18,name:"WLC",symbol:"WLC"},rpcUrls:{default:{http:["https://seoul.worldland.foundation"]}},blockExplorers:{default:{name:"WorldLand Scan",url:"https://scan.worldland.foundation"}},testnet:!1}),xai=defineChain({id:660279,name:"Xai Mainnet",nativeCurrency:{name:"Xai",symbol:"XAI",decimals:18},rpcUrls:{default:{http:["https://xai-chain.net/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.xai-chain.net"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:222549}},testnet:!1}),xaiTestnet=defineChain({id:37714555429,name:"Xai Testnet",nativeCurrency:{name:"sXai",symbol:"sXAI",decimals:18},rpcUrls:{default:{http:["https://testnet-v2.xai-chain.net/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://testnet-explorer-v2.xai-chain.net"}},testnet:!0}),xdc=defineChain({id:50,name:"XinFin Network",nativeCurrency:{decimals:18,name:"XDC",symbol:"XDC"},rpcUrls:{default:{http:["https://rpc.xdcrpc.com"]}},blockExplorers:{default:{name:"XDCScan",url:"https://xdcscan.com"}},contracts:{multicall3:{address:"0x0B1795ccA8E4eC4df02346a082df54D437F8D9aF",blockCreated:75884020}}}),xdcTestnet=defineChain({id:51,name:"Apothem Network",nativeCurrency:{decimals:18,name:"TXDC",symbol:"TXDC"},rpcUrls:{default:{http:["https://erpc.apothem.network"]}},blockExplorers:{default:{name:"XDCScan",url:"https://testnet.xdcscan.com"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:59765389}}}),xLayer=defineChain({id:196,name:"X Layer Mainnet",nativeCurrency:{decimals:18,name:"OKB",symbol:"OKB"},rpcUrls:{default:{http:["https://rpc.xlayer.tech"]}},blockExplorers:{default:{name:"OKLink",url:"https://www.oklink.com/xlayer",apiUrl:"https://www.oklink.com/api/v5/explorer/xlayer/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:47416}}}),xLayerTestnet=defineChain({id:195,name:"X1 Testnet",nativeCurrency:{decimals:18,name:"OKB",symbol:"OKB"},rpcUrls:{default:{http:["https://xlayertestrpc.okx.com"]}},blockExplorers:{default:{name:"OKLink",url:"https://www.oklink.com/xlayer-test"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:624344}},testnet:!0}),xrSepolia=defineChain({id:2730,name:"XR Sepolia",nativeCurrency:{decimals:18,name:"tXR",symbol:"tXR"},rpcUrls:{default:{http:["https://xr-sepolia-testnet.rpc.caldera.xyz/http"]}},blockExplorers:{default:{name:"Blockscout",url:"https://xr-sepolia-testnet.explorer.caldera.xyz"}},testnet:!0}),yooldoVerse=defineChain({id:50005,name:"Yooldo Verse",nativeCurrency:{name:"OAS",symbol:"OAS",decimals:18},rpcUrls:{default:{http:["https://rpc.yooldo-verse.xyz"]}},blockExplorers:{default:{name:"Yooldo Verse Explorer",url:"https://explorer.yooldo-verse.xyz"}}}),yooldoVerseTestnet=defineChain({id:50006,name:"Yooldo Verse Testnet",nativeCurrency:{name:"OAS",symbol:"OAS",decimals:18},rpcUrls:{default:{http:["https://rpc.testnet.yooldo-verse.xyz"]}},blockExplorers:{default:{name:"Yooldo Verse Testnet Explorer",url:"https://explorer.testnet.yooldo-verse.xyz"}},testnet:!0}),zenchainTestnet=defineChain({id:8408,name:"Zenchain Testnet",nativeCurrency:{decimals:18,name:"ZCX",symbol:"ZCX"},rpcUrls:{default:{http:["https://zenchain-testnet.api.onfinality.io/public"],webSocket:["wss://zenchain-testnet.api.onfinality.io/public-ws"]}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:230019}},blockExplorers:{default:{name:"Zentrace",url:"https://zentrace.io"}},testnet:!0}),zeniq=defineChain({id:383414847825,name:"Zeniq Mainnet",nativeCurrency:{name:"ZENIQ",symbol:"ZENIQ",decimals:18},rpcUrls:{default:{http:["https://api.zeniq.network"]}},blockExplorers:{default:{name:"Zeniq Explorer",url:"https://zeniqscan.com"}},testnet:!1}),zetachain=defineChain({id:7e3,name:"ZetaChain",nativeCurrency:{decimals:18,name:"Zeta",symbol:"ZETA"},rpcUrls:{default:{http:["https://zetachain-evm.blockpi.network/v1/rpc/public"]}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:1632781}},blockExplorers:{default:{name:"ZetaScan",url:"https://explorer.zetachain.com"}},testnet:!1}),zetachainAthensTestnet=defineChain({id:7001,name:"ZetaChain Athens Testnet",nativeCurrency:{decimals:18,name:"Zeta",symbol:"aZETA"},rpcUrls:{default:{http:["https://zetachain-athens-evm.blockpi.network/v1/rpc/public"]}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:2715217}},blockExplorers:{default:{name:"ZetaScan",url:"https://athens.explorer.zetachain.com"}},testnet:!0}),zhejiang=defineChain({id:1337803,name:"Zhejiang",nativeCurrency:{name:"Zhejiang Ether",symbol:"ZhejETH",decimals:18},rpcUrls:{default:{http:["https://rpc.zhejiang.ethpandaops.io"]}},blockExplorers:{default:{name:"Beaconchain",url:"https://zhejiang.beaconcha.in"}},testnet:!0}),zilliqa=defineChain({id:32769,name:"Zilliqa",network:"zilliqa",nativeCurrency:{name:"Zilliqa",symbol:"ZIL",decimals:18},rpcUrls:{default:{http:["https://api.zilliqa.com"]}},blockExplorers:{default:{name:"Ethernal",url:"https://evmx.zilliqa.com"}},testnet:!1}),zilliqaTestnet=defineChain({id:33101,name:"Zilliqa Testnet",network:"zilliqa-testnet",nativeCurrency:{name:"Zilliqa",symbol:"ZIL",decimals:18},rpcUrls:{default:{http:["https://dev-api.zilliqa.com"]}},blockExplorers:{default:{name:"Ethernal",url:"https://evmx.testnet.zilliqa.com"}},testnet:!0}),zircuit=defineChain({id:48900,name:"Zircuit Mainnet",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://zircuit1-mainnet.p2pify.com","https://zircuit1-mainnet.liquify.com","https://zircuit-mainnet.drpc.org"]}},blockExplorers:{default:{name:"Zircuit Explorer",url:"https://explorer.zircuit.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11"}},testnet:!1}),zircuitTestnet=defineChain({id:48899,name:"Zircuit Testnet",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://zircuit1-testnet.p2pify.com","https://zircuit1-testnet.liquify.com"]}},blockExplorers:{default:{name:"Zircuit Testnet Explorer",url:"https://explorer.testnet.zircuit.com"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:6040287}},testnet:!0}),zkFair=defineChain({id:42766,name:"ZKFair Mainnet",network:"zkfair-mainnet",nativeCurrency:{decimals:18,name:"USD Coin",symbol:"USDC"},rpcUrls:{default:{http:["https://rpc.zkfair.io"]}},blockExplorers:{default:{name:"zkFair Explorer",url:"https://scan.zkfair.io",apiUrl:"https://scan.zkfair.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:6090959}},testnet:!1}),zkFairTestnet=defineChain({id:43851,name:"ZKFair Testnet",network:"zkfair-testnet",nativeCurrency:{decimals:18,name:"USD Coin",symbol:"USDC"},rpcUrls:{default:{http:["https://testnet-rpc.zkfair.io"]}},blockExplorers:{default:{name:"zkFair Explorer",url:"https://testnet-scan.zkfair.io"}},testnet:!0}),zkLinkNova=defineChain({id:810180,name:"zkLink Nova",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zklink.io"]}},blockExplorers:{default:{name:"zkLink Nova Block Explorer",url:"https://explorer.zklink.io"}}}),zkLinkNovaSepoliaTestnet=defineChain({id:810181,name:"zkLink Nova Sepolia Testnet",nativeCurrency:{decimals:18,name:"ETH",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zklink.io"]}},blockExplorers:{default:{name:"zkLink Nova Block Explorer",url:"https://sepolia.explorer.zklink.io"}}}),zksync=defineChain({...chainConfig$3,id:324,name:"ZKsync Era",network:"zksync-era",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://mainnet.era.zksync.io"],webSocket:["wss://mainnet.era.zksync.io/ws"]}},blockExplorers:{default:{name:"Etherscan",url:"https://era.zksync.network/",apiUrl:"https://api-era.zksync.network/api"},native:{name:"ZKsync Explorer",url:"https://explorer.zksync.io/",apiUrl:"https://block-explorer-api.mainnet.zksync.io/api"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"},universalSignatureVerifier:{address:"0xfB688330379976DA81eB64Fe4BF50d7401763B9C",blockCreated:45659388}}}),zksyncInMemoryNode=defineChain({...chainConfig$3,id:260,name:"ZKsync InMemory Node",network:"zksync-in-memory-node",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:8011"]}},testnet:!0}),zksyncLocalNode=defineChain({...chainConfig$3,id:270,name:"ZKsync CLI Local Node",network:"zksync-cli-local-node",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["http://localhost:3050"]}},testnet:!0}),zksyncSepoliaTestnet=defineChain({...chainConfig$3,id:300,name:"ZKsync Sepolia Testnet",network:"zksync-sepolia-testnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.era.zksync.dev"],webSocket:["wss://sepolia.era.zksync.dev/ws"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia-era.zksync.network/",apiUrl:"https://api-sepolia-era.zksync.network/api"},native:{name:"ZKsync Explorer",url:"https://sepolia.explorer.zksync.io/",blockExplorerApi:"https://block-explorer-api.sepolia.zksync.dev/api"}},contracts:{multicall3:{address:"0xF9cda624FBC7e059355ce98a31693d299FACd963"},universalSignatureVerifier:{address:"0xfB688330379976DA81eB64Fe4BF50d7401763B9C",blockCreated:3855712}},testnet:!0}),sourceId$2=1,zora=defineChain({...chainConfig$2,id:7777777,name:"Zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy",apiUrl:"https://explorer.zora.energy/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$2]:{address:"0x9E6204F750cD866b299594e2aC9eA824E2e5f95c"}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:5882},portal:{[sourceId$2]:{address:"0x1a0ad011913A150f69f6A19DF447A0CfD9551054"}},l1StandardBridge:{[sourceId$2]:{address:"0x3e2Ea9B92B7E48A52296fD261dc26fd995284631"}}},sourceId:sourceId$2}),sourceId$1=11155111,zoraSepolia=defineChain({...chainConfig$2,id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/",apiUrl:"https://sepolia.explorer.zora.energy/api"}},contracts:{...chainConfig$2.contracts,l2OutputOracle:{[sourceId$1]:{address:"0x2615B481Bd3E5A1C0C7Ca3Da1bdc663E8615Ade9"}},multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:83160},portal:{[sourceId$1]:{address:"0xeffE2C6cA9Ab797D418f0D91eA60807713f3536f"}},l1StandardBridge:{[sourceId$1]:{address:"0x5376f1D543dcbB5BD416c56C189e4cB7399fCcCB"}}},sourceId:sourceId$1,testnet:!0}),sourceId=5,zoraTestnet=defineChain({...chainConfig$2,id:999,name:"Zora Goerli Testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy",apiUrl:"https://testnet.explorer.zora.energy/api"}},contracts:{...chainConfig$2.contracts,multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:189123},portal:{[sourceId]:{address:"0xDb9F51790365e7dc196e7D072728df39Be958ACe"}}},sourceId,testnet:!0}),viemChains=Object.freeze(Object.defineProperty({__proto__:null,abey,abstractTestnet,acala,acria,aioz,alienx,alienxHalTestnet,ancient8,ancient8Sepolia,anvil,apeChain,apexTestnet,arbitrum,arbitrumGoerli,arbitrumNova,arbitrumSepolia,areonNetwork,areonNetworkTestnet,artelaTestnet,assetChain,assetChainTestnet,astar,astarZkEVM,astarZkyoto,atletaOlympia,aurora,auroraTestnet,auroria,avalanche,avalancheFuji,b3,b3Sepolia,bahamut,base:base$7,baseGoerli,baseSepolia:baseSepolia$1,beam,beamTestnet,bearNetworkChainMainnet,bearNetworkChainTestnet,berachainTestnet,berachainTestnetbArtio,bevmMainnet,bifrost,bitTorrent,bitTorrentTestnet,bitgert,bitkub,bitkubTestnet,bitlayer,bitlayerTestnet,bitrock,blast,blastSepolia,bob,bobSepolia,boba,bobaSepolia,boolBetaMainnet,botanixTestnet,bounceBit,bounceBitTestnet,bronos,bronosTestnet,bsc,bscGreenfield,bscTestnet,bsquared,bsquaredTestnet,btr,btrTestnet,bxn,bxnTestnet,cannon,canto,celo,celoAlfajores,chang,chiliz,chips,classic,coinbit,coinex,confluxESpace,confluxESpaceTestnet,coreDao,crab,cronos,cronosTestnet,cronoszkEVM,cronoszkEVMTestnet,crossbell,curtis,cyber,cyberTestnet,darwinia,dchain,dchainTestnet,defichainEvm,defichainEvmTestnet,degen,dfk,diode,disChain,dodochainTestnet,dogechain,dosChain,dosChainTestnet,dreyerxMainnet,dreyerxTestnet,dustboyIoT,dymension,edgeless,edgelessTestnet,edgeware,edgewareTestnet,ekta,ektaTestnet,elastos,elastosTestnet,electroneum,electroneumTestnet,elysiumTestnet,energy,enuls,eon,eos,eosTestnet,etherlink,etherlinkTestnet,evmos,evmosTestnet,excelonMainnet,expanse,fantom,fantomSonicTestnet,fantomTestnet,fibo,filecoin,filecoinCalibration,filecoinHyperspace,fireChain,flare,flareTestnet,flowMainnet,flowPreviewnet,flowTestnet,fluence,fluenceStage,fluenceTestnet,forma,foundry,fraxtal,fraxtalTestnet,funkiMainnet,funkiSepolia,fuse,fuseSparknet,fusion,fusionTestnet,garnet,geist,genesys,glideL1Protocol,glideL2Protocol,gnosis,gnosisChiado,goChain,gobi,godwoken,goerli,gravity,guruNetwork,guruTestnet,ham,haqqMainnet,haqqTestedge2,hardhat,harmonyOne,hashkeyTestnet,hedera,hederaPreviewnet,hederaTestnet,hela,hemiSepolia,holesky,hpb,hychain,hychainTestnet,iSunCoin,idchain,immutableZkEvm,immutableZkEvmTestnet,inEVM,inkSepolia,iota,iotaTestnet,iotex,iotexTestnet,jbc,jbcTestnet,kaia,kairos,kakarotSepolia,kakarotStarknetSepolia,kardiaChain,karura,kava,kavaTestnet,kcc,kinto,klaytn,klaytnBaobab,koi,kroma,kromaSepolia,l3x,l3xTestnet,lavita,lightlinkPegasus,lightlinkPhoenix,linea,lineaGoerli,lineaSepolia,lineaTestnet,lisk,liskSepolia,localhost,loop,lukso,luksoTestnet,lycan,lyra,mainnet,mandala,manta,mantaSepoliaTestnet,mantaTestnet,mantle,mantleSepoliaTestnet,mantleTestnet,mapProtocol,matchain,matchainTestnet,mchVerse,mekong,meld,merlin,metachain,metachainIstanbul,metadium,metalL2,meter,meterTestnet,metis,metisGoerli,mev,mevTestnet,mint,mintSepoliaTestnet,mode,modeTestnet,moonbaseAlpha,moonbeam,moonbeamDev,moonriver,morph,morphHolesky,morphSepolia,nahmii,nautilus,neonDevnet,neonMainnet,nexi,nexilix,oasisTestnet,oasys,odysseyTestnet,okc,omax,oneWorld,oortMainnetDev,opBNB,opBNBTestnet,optimism,optimismGoerli,optimismSepolia,optopia,optopiaTestnet,orderly,orderlySepolia,otimDevnet,palm,palmTestnet,pgn,pgnTestnet,phoenix,planq,playfiAlbireo,plinga,plumeTestnet,polterTestnet,polygon,polygonAmoy,polygonMumbai,polygonZkEvm,polygonZkEvmCardona,polygonZkEvmTestnet,pulsechain,pulsechainV4,qMainnet,qTestnet,ql1,real,redbellyTestnet,redstone,rei,reyaNetwork,rollux,rolluxTestnet,ronin,root,rootPorcini,rootstock,rootstockTestnet,rss3,rss3Sepolia,saakuru,saigon,sanko,sapphire,sapphireTestnet,satoshiVM,satoshiVMTestnet,scroll,scrollSepolia,sei,seiDevnet,seiTestnet,sepolia,shape,shapeSepolia,shardeumSphinx,shibarium,shibariumTestnet,shiden,shimmer,shimmerTestnet,silicon,siliconSepolia,sixProtocol,skaleBlockBrawlers,skaleCalypso,skaleCalypsoTestnet,skaleCryptoBlades,skaleCryptoColosseum,skaleEuropa,skaleEuropaTestnet,skaleExorde,skaleHumanProtocol,skaleNebula,skaleNebulaTestnet,skaleRazor,skaleTitan,skaleTitanTestnet,sketchpad,snax,snaxTestnet,soneiumMinato,songbird,songbirdTestnet,sonicTestnet,sophon,sophonTestnet,spicy,step,storyTestnet,stratis,superlumio,superposition,swan,swanProximaTestnet,swanSaturnTestnet,swissdlt,syscoin,syscoinTestnet,taiko,taikoHekla,taikoJolnir,taikoKatla,taikoTestnetSepolia,taraxa,taraxaTestnet,telcoinTestnet,telos,telosTestnet,tenet,thaiChain,that,theta,thetaTestnet,thunderCore,thunderTestnet,tiktrixTestnet,tomb,tron,ubiq,ultron,ultronTestnet,unichainSepolia,unique,uniqueOpal,uniqueQuartz,unreal,vanar,vechain,velas,viction,victionTestnet,vision,visionTestnet,wanchain,wanchainTestnet,weaveVMAlphanet,wemix,wemixTestnet,worldLand,worldchain,worldchainSepolia,x1Testnet:xLayerTestnet,xLayer,xLayerTestnet,xai,xaiTestnet,xdc,xdcTestnet,xrSepolia,yooldoVerse,yooldoVerseTestnet,zenchainTestnet,zeniq,zetachain,zetachainAthensTestnet,zhejiang,zilliqa,zilliqaTestnet,zircuit,zircuitTestnet,zkFair,zkFairTestnet,zkLinkNova,zkLinkNovaSepoliaTestnet,zkSync:zksync,zkSyncInMemoryNode:zksyncInMemoryNode,zkSyncLocalNode:zksyncLocalNode,zkSyncSepoliaTestnet:zksyncSepoliaTestnet,zksync,zksyncInMemoryNode,zksyncLocalNode,zksyncSepoliaTestnet,zora,zoraSepolia,zoraTestnet},Symbol.toStringTag,{value:"Module"})),require$$1$3=getAugmentedNamespace(viemChains);var validator={},hasRequiredValidator$1;function requireValidator$1(){return hasRequiredValidator$1||(hasRequiredValidator$1=1,Object.defineProperty(validator,"__esModule",{value:!0}),validator.validatorABI=void 0,validator.validatorABI=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"previousAdmin",type:"address"},{indexed:!1,internalType:"address",name:"newAdmin",type:"address"}],name:"AdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"beacon",type:"address"}],name:"BeaconUpgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"valPerBlock",type:"uint16"},{indexed:!1,internalType:"uint16",name:"valPerBlockTarget",type:"uint16"}],name:"BlockParamsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint8",name:"version",type:"uint8"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"ownerWallet",type:"address"},{indexed:!0,internalType:"address",name:"nodeWallet",type:"address"},{indexed:!1,internalType:"enum ValidatorV1.NodeType",name:"nodeType",type:"uint8"},{indexed:!1,internalType:"uint256",name:"nodeTokens",type:"uint256"},{indexed:!1,internalType:"string",name:"nodeApiBaseUrl",type:"string"}],name:"NodeAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"nodeWallet",type:"address"},{indexed:!1,internalType:"address",name:"reporterWallet",type:"address"},{indexed:!1,internalType:"address[]",name:"voters",type:"address[]"},{indexed:!1,internalType:"enum ValidatorV1.VoteAction",name:"voteAction",type:"uint8"}],name:"NodeReported",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"nodeWallet",type:"address"},{indexed:!1,internalType:"enum ValidatorV1.NodeStatus",name:"nodeStatus",type:"uint8"},{indexed:!1,internalType:"uint256",name:"nodeTokens",type:"uint256"}],name:"NodeStatusChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferStarted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"nodeRandomMinCount",type:"uint16"},{indexed:!1,internalType:"uint16",name:"nodeRandomPingCount",type:"uint16"}],name:"RandomParamsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{inputs:[],name:"BAN_PERCENT",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"REPORTS_BEFORE_SLASH_S",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"REPORTS_BEFORE_SLASH_V",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"REPORT_THRESHOLD_PER_BLOCK",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"SLASHES_BEFORE_BAN_S",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"SLASHES_BEFORE_BAN_V",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"SLASH_PERCENT",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"acceptOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"dnodes",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getActiveVNodes",outputs:[{components:[{internalType:"address",name:"nodeWallet",type:"address"},{internalType:"string",name:"nodeApiBaseUrl",type:"string"}],internalType:"struct ValidatorV1.ActiveValidator[]",name:"",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getDNodes",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getDNodesLength",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"_nodeWallet",type:"address"}],name:"getNodeInfo",outputs:[{components:[{internalType:"address",name:"ownerWallet",type:"address"},{internalType:"address",name:"nodeWallet",type:"address"},{internalType:"enum ValidatorV1.NodeType",name:"nodeType",type:"uint8"},{internalType:"uint256",name:"nodeTokens",type:"uint256"},{internalType:"string",name:"nodeApiBaseUrl",type:"string"},{components:[{internalType:"uint16",name:"reportCounter",type:"uint16"},{internalType:"uint16",name:"slashCounter",type:"uint16"},{internalType:"uint128[]",name:"reportedInBlocks",type:"uint128[]"},{internalType:"address[]",name:"reportedBy",type:"address[]"},{internalType:"uint128[]",name:"reportedKeys",type:"uint128[]"}],internalType:"struct ValidatorV1.NodeCounters",name:"counters",type:"tuple"},{internalType:"enum ValidatorV1.NodeStatus",name:"status",type:"uint8"}],internalType:"struct ValidatorV1.NodeInfo",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"getSNodes",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getSNodesLength",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getVNodes",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getVNodesLength",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint16",name:"protocolVersion_",type:"uint16"},{internalType:"address",name:"pushToken_",type:"address"},{internalType:"uint16",name:"valPerBlockTarget_",type:"uint16"},{internalType:"uint16",name:"nodeRandomMinCount_",type:"uint16"},{internalType:"uint16",name:"nodeRandomPingCount_",type:"uint16"},{internalType:"uint16",name:"REPORTS_BEFORE_SLASH_V_",type:"uint16"},{internalType:"uint16",name:"REPORTS_BEFORE_SLASH_S_",type:"uint16"},{internalType:"uint16",name:"SLASHES_BEFORE_BAN_V_",type:"uint16"},{internalType:"uint16",name:"SLASHES_BEFORE_BAN_S_",type:"uint16"},{internalType:"uint16",name:"SLASH_PERCENT_",type:"uint16"},{internalType:"uint16",name:"BAN_PERCENT_",type:"uint16"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"minStakeD",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minStakeS",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minStakeV",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"nodeMap",outputs:[{internalType:"address",name:"ownerWallet",type:"address"},{internalType:"address",name:"nodeWallet",type:"address"},{internalType:"enum ValidatorV1.NodeType",name:"nodeType",type:"uint8"},{internalType:"uint256",name:"nodeTokens",type:"uint256"},{internalType:"string",name:"nodeApiBaseUrl",type:"string"},{components:[{internalType:"uint16",name:"reportCounter",type:"uint16"},{internalType:"uint16",name:"slashCounter",type:"uint16"},{internalType:"uint128[]",name:"reportedInBlocks",type:"uint128[]"},{internalType:"address[]",name:"reportedBy",type:"address[]"},{internalType:"uint128[]",name:"reportedKeys",type:"uint128[]"}],internalType:"struct ValidatorV1.NodeCounters",name:"counters",type:"tuple"},{internalType:"enum ValidatorV1.NodeStatus",name:"status",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"nodeRandomMinCount",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"nodeRandomPingCount",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pendingOwner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolVersion",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from_",type:"address"},{internalType:"address",name:"to_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"redistributeStaked",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"nodeTokens_",type:"uint256"},{internalType:"enum ValidatorV1.NodeType",name:"nodeType_",type:"uint8"},{internalType:"string",name:"nodeApiBaseUrl_",type:"string"},{internalType:"address",name:"nodeWallet_",type:"address"}],name:"registerNodeAndStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"enum ValidatorV1.NodeType",name:"targetNodeType_",type:"uint8"},{internalType:"bytes",name:"voteBlob_",type:"bytes"},{internalType:"bytes[]",name:"signatures_",type:"bytes[]"}],name:"reportNode",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"addr_",type:"address"}],name:"setStorageContract",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"snodes",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"storageContract",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalFees",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalStaked",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"to_",type:"address"},{internalType:"uint256",name:"amount_",type:"uint256"}],name:"unstakeFees",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"nodeWallet_",type:"address"}],name:"unstakeNode",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"valPerBlockTarget_",type:"uint16"}],name:"updateBlockParams",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"nodeRandomMinCount_",type:"uint16"},{internalType:"uint16",name:"nodeRandomPingCount_",type:"uint16"}],name:"updateRandomParams",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"valPerBlock",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"valPerBlockTarget",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"vnodes",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"vnodesActive",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"}]),validator}var hasRequiredConfig;function requireConfig(){if(hasRequiredConfig)return config$6;hasRequiredConfig=1,Object.defineProperty(config$6,"__esModule",{value:!0});const fr=requireConstants$3(),br=require$$1$3,Er={ABIS:{VALIDATOR:requireValidator$1().validatorABI},VALIDATOR:{[fr.ENV.PROD]:{NETWORK:br.mainnet,VALIDATOR_CONTRACT:"TODO"},[fr.ENV.STAGING]:{NETWORK:br.sepolia,VALIDATOR_CONTRACT:"TODO"},[fr.ENV.DEV]:{NETWORK:br.sepolia,VALIDATOR_CONTRACT:"0x98dBfb001cB2623cF7BfE2A17755592E151f0779"},[fr.ENV.LOCAL]:{NETWORK:br.localhost,VALIDATOR_CONTRACT:"0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9"}},WALLET_URL:{[fr.ENV.PROD]:"TODO",[fr.ENV.STAGING]:"TODO",[fr.ENV.DEV]:"https://push-protocol.github.io/push-wallet/",[fr.ENV.LOCAL]:"http://localhost:5174/"}};return config$6.default=Er,config$6}var hasRequiredValidator;function requireValidator(){if(hasRequiredValidator)return validator$1;hasRequiredValidator=1;var fr;Object.defineProperty(validator$1,"__esModule",{value:!0}),validator$1.Validator=void 0;const br=require$$0$b,wr=requireUtils$5(),Er=require$$2$3,kr=require$$1$4,jr=requireConfig(),Br=requireConstants$3();class Wr{constructor(Gr,Vr,Zr){this.activeValidatorURL=Gr,this.env=Vr,this.validatorContractClient=Zr,this.ReqModifier=(Jr,Qr)=>{let _n=fr.vNodeUrlModifier(Jr),En=Qr;return(Qr==="push_getBlocks"||Qr==="push_getBlockByHash"||Qr==="push_getTransactions"||Qr==="push_getTransactionByHash"||Qr==="push_getTransactionsByUser"||Qr==="push_getTransactionsBySender"||Qr==="push_getTransactionsByRecipient")&&(this.env===Br.ENV.LOCAL&&(_n="http://localhost:5001/rpc"),this.env===Br.ENV.DEV&&(_n="https://aa1.dev.push.org/rpc"),En=`RpcService.${Qr.replace("push_","")}`,Qr==="push_getTransactions"&&(En="RpcService.getTxs"),Qr==="push_getTransactionsByUser"&&(En="RpcService.getTransactionsByUser"),Qr==="push_getTransactionsBySender"&&(En="RpcService.getTxsBySender"),Qr==="push_getTransactionsByRecipient"&&(En="RpcService.getTxsByRecipient"),Qr==="push_getTransactionByHash"&&(En="RpcService.getTxByHash")),{url:_n,fnName:En}},this.call=(Jr,...Qr)=>br.__awaiter(this,[Jr,...Qr],void 0,function*(_n,En=[],Cn=this.activeValidatorURL){return yield fr.sendJsonRpcRequest(this.ReqModifier(Cn,_n).url,this.ReqModifier(Cn,_n).fnName,En)}),(this.env===Br.ENV.DEV||this.env===Br.ENV.LOCAL)&&(fr.printTraces=!0)}callVNode(Gr){return br.__awaiter(this,arguments,void 0,function*(Vr,Zr=[],Jr=this.activeValidatorURL){const Qr=fr.fixVNodeUrl(Jr);return yield fr.sendJsonRpcRequest(Qr,Vr,Zr)})}static fixVNodeUrl(Gr){if(Gr==null||Gr.length==0)return Gr;const Vr=new URL(Gr);return Vr.hostname.endsWith(".local")?(Vr.hostname="localhost",Vr.protocol="http:"):Vr.protocol="https:",(Vr.pathname.trim().length==0||Vr.pathname.trim()==="/")&&(Vr.pathname="/api/v1/rpc"),Vr.pathname.endsWith("/")&&(Vr.pathname=Vr.pathname.slice(0,-1)),Vr.toString()}}return validator$1.Validator=Wr,fr=Wr,Wr.idCounter=0,Wr.printTraces=!1,Wr.initalize=qr=>br.__awaiter(void 0,void 0,void 0,function*(){const Gr={env:(qr==null?void 0:qr.env)||Br.ENV.STAGING};if(!fr.instance||fr.instance.env!==Gr.env){const Vr=fr.createValidatorContractClient(Gr.env),Zr=yield fr.getActiveValidator(Vr);fr.instance=new fr(Zr.nodeApiBaseUrl,Gr.env,Vr)}return fr.instance}),Wr.createValidatorContractClient=qr=>{const Gr=(0,kr.createPublicClient)({chain:jr.default.VALIDATOR[qr].NETWORK,transport:(0,kr.http)("https://proportionate-multi-sanctuary.ethereum-sepolia.quiknode.pro/fe3638bd884a34c0aa6c85ce2cd62ef54b0d8442/")});return(0,kr.getContract)({abi:jr.default.ABIS.VALIDATOR,address:jr.default.VALIDATOR[qr].VALIDATOR_CONTRACT,client:{public:Gr}})},Wr.sendJsonRpcRequest=(qr,Gr,...Vr)=>br.__awaiter(void 0,[qr,Gr,...Vr],void 0,function*(Zr,Jr,Qr=[]){const _n={jsonrpc:"2.0",method:Jr,params:Qr,id:fr.idCounter++};try{fr.printTraces&&console.log(`>> Calling RPC POST ${Zr} (req${_n.id}) with body %o`,_n);const En=yield Er.default.post(Zr,_n,{headers:{"Content-Type":"application/json"}});if(En.data.error)throw console.error("JSON-RPC Error:",En.data.error),Error(En.data.error.message);return fr.printTraces&&console.log(`<< RPC Reply POST ${Zr} (req${_n.id}) code: ${En.status} with body: %o`,En==null?void 0:En.data),En.data.result}catch(En){throw console.error("Error sending JSON-RPC request:",En),En}}),Wr.ping=qr=>br.__awaiter(void 0,void 0,void 0,function*(){return yield fr.sendJsonRpcRequest(fr.vNodeUrlModifier(qr),"push_listening")}),Wr.getActiveValidator=qr=>br.__awaiter(void 0,void 0,void 0,function*(){const Gr=yield qr.read.getActiveVNodes(),Vr=(0,wr.getRandomElement)(Gr);return(yield fr.ping(Vr.nodeApiBaseUrl))?Vr:yield fr.getActiveValidator(qr)}),Wr.vNodeUrlModifier=qr=>{let Gr=qr;return qr.includes(".local")&&(Gr=qr.replace(".local",".localh")),`${Gr}/api/v1/rpc`},validator$1}var block={},wire={},binaryEncoding={},varint={},hasRequiredVarint;function requireVarint(){if(hasRequiredVarint)return varint;hasRequiredVarint=1,Object.defineProperty(varint,"__esModule",{value:!0}),varint.varint64read=fr,varint.varint64write=br,varint.int64FromString=Er,varint.int64ToString=kr,varint.uInt64ToString=jr,varint.varint32write=Vr,varint.varint32read=Zr;function fr(){let Jr=0,Qr=0;for(let En=0;En<28;En+=7){let Cn=this.buf[this.pos++];if(Jr|=(Cn&127)<>4,!(_n&128))return this.assertBounds(),[Jr,Qr];for(let En=3;En<=31;En+=7){let Cn=this.buf[this.pos++];if(Qr|=(Cn&127)<>>In,jn=!(!(An>>>7)&&Qr==0),eo=(jn?An|128:An)&255;if(_n.push(eo),!jn)return}const En=Jr>>>28&15|(Qr&7)<<4,Cn=!!(Qr>>3);if(_n.push((Cn?En|128:En)&255),!!Cn){for(let In=3;In<31;In=In+7){const An=Qr>>>In,jn=!!(An>>>7),eo=(jn?An|128:An)&255;if(_n.push(eo),!jn)return}_n.push(Qr>>>31&1)}}const wr=4294967296;function Er(Jr){const Qr=Jr[0]==="-";Qr&&(Jr=Jr.slice(1));const _n=1e6;let En=0,Cn=0;function In(An,jn){const eo=Number(Jr.slice(An,jn));Cn*=_n,En=En*_n+eo,En>=wr&&(Cn=Cn+(En/wr|0),En=En%wr)}return In(-24,-18),In(-18,-12),In(-12,-6),In(-6),Qr?qr(En,Cn):Wr(En,Cn)}function kr(Jr,Qr){let _n=Wr(Jr,Qr);const En=_n.hi&2147483648;En&&(_n=qr(_n.lo,_n.hi));const Cn=jr(_n.lo,_n.hi);return En?"-"+Cn:Cn}function jr(Jr,Qr){if({lo:Jr,hi:Qr}=Br(Jr,Qr),Qr<=2097151)return String(wr*Qr+Jr);const _n=Jr&16777215,En=(Jr>>>24|Qr<<8)&16777215,Cn=Qr>>16&65535;let In=_n+En*6777216+Cn*6710656,An=En+Cn*8147497,jn=Cn*2;const eo=1e7;return In>=eo&&(An+=Math.floor(In/eo),In%=eo),An>=eo&&(jn+=Math.floor(An/eo),An%=eo),jn.toString()+Gr(An)+Gr(In)}function Br(Jr,Qr){return{lo:Jr>>>0,hi:Qr>>>0}}function Wr(Jr,Qr){return{lo:Jr|0,hi:Qr|0}}function qr(Jr,Qr){return Qr=~Qr,Jr?Jr=~Jr+1:Qr+=1,Wr(Jr,Qr)}const Gr=Jr=>{const Qr=String(Jr);return"0000000".slice(Qr.length)+Qr};function Vr(Jr,Qr){if(Jr>=0){for(;Jr>127;)Qr.push(Jr&127|128),Jr=Jr>>>7;Qr.push(Jr)}else{for(let _n=0;_n<9;_n++)Qr.push(Jr&127|128),Jr=Jr>>7;Qr.push(1)}}function Zr(){let Jr=this.buf[this.pos++],Qr=Jr&127;if(!(Jr&128))return this.assertBounds(),Qr;if(Jr=this.buf[this.pos++],Qr|=(Jr&127)<<7,!(Jr&128))return this.assertBounds(),Qr;if(Jr=this.buf[this.pos++],Qr|=(Jr&127)<<14,!(Jr&128))return this.assertBounds(),Qr;if(Jr=this.buf[this.pos++],Qr|=(Jr&127)<<21,!(Jr&128))return this.assertBounds(),Qr;Jr=this.buf[this.pos++],Qr|=(Jr&15)<<28;for(let _n=5;Jr&128&&_n<10;_n++)Jr=this.buf[this.pos++];if(Jr&128)throw new Error("invalid varint");return this.assertBounds(),Qr>>>0}return varint}var protoInt64={},hasRequiredProtoInt64;function requireProtoInt64(){if(hasRequiredProtoInt64)return protoInt64;hasRequiredProtoInt64=1;var fr={};Object.defineProperty(protoInt64,"__esModule",{value:!0}),protoInt64.protoInt64=void 0;const br=requireVarint();protoInt64.protoInt64=wr();function wr(){const jr=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof jr.getBigInt64=="function"&&typeof jr.getBigUint64=="function"&&typeof jr.setBigInt64=="function"&&typeof jr.setBigUint64=="function"&&(typeof process$1$1!="object"||typeof fr!="object"||fr.BUF_BIGINT_DISABLE!=="1")){const Wr=BigInt("-9223372036854775808"),qr=BigInt("9223372036854775807"),Gr=BigInt("0"),Vr=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(Zr){const Jr=typeof Zr=="bigint"?Zr:BigInt(Zr);if(Jr>qr||JrVr||Jr>>0)}raw(Zr){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(Zr),this}uint32(Zr){for(qr(Zr);Zr>127;)this.buf.push(Zr&127|128),Zr=Zr>>>7;return this.buf.push(Zr),this}int32(Zr){return Wr(Zr),(0,br.varint32write)(Zr,this.buf),this}bool(Zr){return this.buf.push(Zr?1:0),this}bytes(Zr){return this.uint32(Zr.byteLength),this.raw(Zr)}string(Zr){let Jr=this.encodeUtf8(Zr);return this.uint32(Jr.byteLength),this.raw(Jr)}float(Zr){Gr(Zr);let Jr=new Uint8Array(4);return new DataView(Jr.buffer).setFloat32(0,Zr,!0),this.raw(Jr)}double(Zr){let Jr=new Uint8Array(8);return new DataView(Jr.buffer).setFloat64(0,Zr,!0),this.raw(Jr)}fixed32(Zr){qr(Zr);let Jr=new Uint8Array(4);return new DataView(Jr.buffer).setUint32(0,Zr,!0),this.raw(Jr)}sfixed32(Zr){Wr(Zr);let Jr=new Uint8Array(4);return new DataView(Jr.buffer).setInt32(0,Zr,!0),this.raw(Jr)}sint32(Zr){return Wr(Zr),Zr=(Zr<<1^Zr>>31)>>>0,(0,br.varint32write)(Zr,this.buf),this}sfixed64(Zr){let Jr=new Uint8Array(8),Qr=new DataView(Jr.buffer),_n=wr.protoInt64.enc(Zr);return Qr.setInt32(0,_n.lo,!0),Qr.setInt32(4,_n.hi,!0),this.raw(Jr)}fixed64(Zr){let Jr=new Uint8Array(8),Qr=new DataView(Jr.buffer),_n=wr.protoInt64.uEnc(Zr);return Qr.setInt32(0,_n.lo,!0),Qr.setInt32(4,_n.hi,!0),this.raw(Jr)}int64(Zr){let Jr=wr.protoInt64.enc(Zr);return(0,br.varint64write)(Jr.lo,Jr.hi,this.buf),this}sint64(Zr){let Jr=wr.protoInt64.enc(Zr),Qr=Jr.hi>>31,_n=Jr.lo<<1^Qr,En=(Jr.hi<<1|Jr.lo>>>31)^Qr;return(0,br.varint64write)(_n,En,this.buf),this}uint64(Zr){let Jr=wr.protoInt64.uEnc(Zr);return(0,br.varint64write)(Jr.lo,Jr.hi,this.buf),this}}fr.BinaryWriter=jr;class Br{constructor(Zr,Jr=(0,Er.getTextEncoding)().decodeUtf8){this.decodeUtf8=Jr,this.varint64=br.varint64read,this.uint32=br.varint32read,this.buf=Zr,this.len=Zr.length,this.pos=0,this.view=new DataView(Zr.buffer,Zr.byteOffset,Zr.byteLength)}tag(){let Zr=this.uint32(),Jr=Zr>>>3,Qr=Zr&7;if(Jr<=0||Qr<0||Qr>5)throw new Error("illegal tag: field no "+Jr+" wire type "+Qr);return[Jr,Qr]}skip(Zr,Jr){let Qr=this.pos;switch(Zr){case kr.Varint:for(;this.buf[this.pos++]&128;);break;case kr.Bit64:this.pos+=4;case kr.Bit32:this.pos+=4;break;case kr.LengthDelimited:let _n=this.uint32();this.pos+=_n;break;case kr.StartGroup:for(;;){const[En,Cn]=this.tag();if(Cn===kr.EndGroup){if(Jr!==void 0&&En!==Jr)throw new Error("invalid end group tag");break}this.skip(Cn,En)}break;default:throw new Error("cant skip wire type "+Zr)}return this.assertBounds(),this.buf.subarray(Qr,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let Zr=this.uint32();return Zr>>>1^-(Zr&1)}int64(){return wr.protoInt64.dec(...this.varint64())}uint64(){return wr.protoInt64.uDec(...this.varint64())}sint64(){let[Zr,Jr]=this.varint64(),Qr=-(Zr&1);return Zr=(Zr>>>1|(Jr&1)<<31)^Qr,Jr=Jr>>>1^Qr,wr.protoInt64.dec(Zr,Jr)}bool(){let[Zr,Jr]=this.varint64();return Zr!==0||Jr!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return wr.protoInt64.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return wr.protoInt64.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let Zr=this.uint32(),Jr=this.pos;return this.pos+=Zr,this.assertBounds(),this.buf.subarray(Jr,Jr+Zr)}string(){return this.decodeUtf8(this.bytes())}}fr.BinaryReader=Br;function Wr(Vr){if(typeof Vr=="string")Vr=Number(Vr);else if(typeof Vr!="number")throw new Error("invalid int32: "+typeof Vr);if(!Number.isInteger(Vr)||Vr>fr.INT32_MAX||Vrfr.UINT32_MAX||Vr<0)throw new Error("invalid uint32: "+Vr)}function Gr(Vr){if(typeof Vr=="string"){const Zr=Vr;if(Vr=Number(Vr),isNaN(Vr)&&Zr!=="NaN")throw new Error("invalid float32: "+Zr)}else if(typeof Vr!="number")throw new Error("invalid float32: "+typeof Vr);if(Number.isFinite(Vr)&&(Vr>fr.FLOAT32_MAX||Vr>4,_n=Qr,Jr=2;break;case 2:Vr[Zr++]=(_n&15)<<4|(Qr&60)>>2,_n=Qr,Jr=3;break;case 3:Vr[Zr++]=(_n&3)<<6|Qr,Jr=0;break}}if(Jr==1)throw Error("invalid base64 string");return Vr.subarray(0,Zr)}function br(Wr,qr="std"){const Gr=jr(qr),Vr=qr=="std";let Zr="",Jr=0,Qr,_n=0;for(let En=0;En>2],_n=(Qr&3)<<4,Jr=1;break;case 1:Zr+=Gr[_n|Qr>>4],_n=(Qr&15)<<2,Jr=2;break;case 2:Zr+=Gr[_n|Qr>>6],Zr+=Gr[Qr&63],Jr=0;break}return Jr&&(Zr+=Gr[_n],Vr&&(Zr+="=",Jr==1&&(Zr+="="))),Zr}let wr,Er,kr;function jr(Wr){return wr||(wr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Er=wr.slice(0,-2).concat("-","_")),Wr=="url"?Er:wr}function Br(){if(!kr){kr=[];const Wr=jr("std");for(let qr=0;qrqr.name===Br);if(!Wr)throw new Error(`cannot parse ${jr} default value: ${Br}`);return Wr.number}function Er(jr,Br){switch(jr){case fr.ScalarType.STRING:return Br;case fr.ScalarType.BYTES:{const Wr=kr(Br);if(Wr===!1)throw new Error(`cannot parse ${fr.ScalarType[jr]} default value: ${Br}`);return Wr}case fr.ScalarType.INT64:case fr.ScalarType.SFIXED64:case fr.ScalarType.SINT64:return br.protoInt64.parse(Br);case fr.ScalarType.UINT64:case fr.ScalarType.FIXED64:return br.protoInt64.uParse(Br);case fr.ScalarType.DOUBLE:case fr.ScalarType.FLOAT:switch(Br){case"inf":return Number.POSITIVE_INFINITY;case"-inf":return Number.NEGATIVE_INFINITY;case"nan":return Number.NaN;default:return parseFloat(Br)}case fr.ScalarType.BOOL:return Br==="true";case fr.ScalarType.INT32:case fr.ScalarType.UINT32:case fr.ScalarType.SINT32:case fr.ScalarType.FIXED32:case fr.ScalarType.SFIXED32:return parseInt(Br,10)}}function kr(jr){const Br=[],Wr={tail:jr,c:"",next(){return this.tail.length==0?!1:(this.c=this.tail[0],this.tail=this.tail.substring(1),!0)},take(qr){if(this.tail.length>=qr){const Gr=this.tail.substring(0,qr);return this.tail=this.tail.substring(qr),Gr}return!1}};for(;Wr.next();)switch(Wr.c){case"\\":if(Wr.next())switch(Wr.c){case"\\":Br.push(Wr.c.charCodeAt(0));break;case"b":Br.push(8);break;case"f":Br.push(12);break;case"n":Br.push(10);break;case"r":Br.push(13);break;case"t":Br.push(9);break;case"v":Br.push(11);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{const qr=Wr.c,Gr=Wr.take(2);if(Gr===!1)return!1;const Vr=parseInt(qr+Gr,8);if(isNaN(Vr))return!1;Br.push(Vr);break}case"x":{const qr=Wr.c,Gr=Wr.take(2);if(Gr===!1)return!1;const Vr=parseInt(qr+Gr,16);if(isNaN(Vr))return!1;Br.push(Vr);break}case"u":{const qr=Wr.c,Gr=Wr.take(4);if(Gr===!1)return!1;const Vr=parseInt(qr+Gr,16);if(isNaN(Vr))return!1;const Zr=new Uint8Array(4);new DataView(Zr.buffer).setInt32(0,Vr,!0),Br.push(Zr[0],Zr[1],Zr[2],Zr[3]);break}case"U":{const qr=Wr.c,Gr=Wr.take(8);if(Gr===!1)return!1;const Vr=br.protoInt64.uEnc(qr+Gr),Zr=new Uint8Array(8),Jr=new DataView(Zr.buffer);Jr.setInt32(0,Vr.lo,!0),Jr.setInt32(4,Vr.hi,!0),Br.push(Zr[0],Zr[1],Zr[2],Zr[3],Zr[4],Zr[5],Zr[6],Zr[7]);break}}break;default:Br.push(Wr.c.charCodeAt(0))}return new Uint8Array(Br)}return textFormat}var sizeDelimited={},toBinary={},reflect={},reflectCheck={},isMessage={},hasRequiredIsMessage;function requireIsMessage(){if(hasRequiredIsMessage)return isMessage;hasRequiredIsMessage=1,Object.defineProperty(isMessage,"__esModule",{value:!0}),isMessage.isMessage=fr;function fr(br,wr){return br!==null&&typeof br=="object"&&"$typeName"in br&&typeof br.$typeName=="string"?wr===void 0?!0:wr.typeName===br.$typeName:!1}return isMessage}var error$1={},hasRequiredError;function requireError(){if(hasRequiredError)return error$1;hasRequiredError=1,Object.defineProperty(error$1,"__esModule",{value:!0}),error$1.FieldError=void 0,error$1.isFieldError=wr;const fr=["FieldValueInvalidError","FieldListRangeError","ForeignFieldError"];class br extends Error{constructor(kr,jr,Br="FieldValueInvalidError"){super(jr),this.name=Br,this.field=()=>kr}}error$1.FieldError=br;function wr(Er){return Er instanceof Error&&fr.includes(Er.name)&&"field"in Er&&typeof Er.field=="function"}return error$1}var guard$1={},unsafe={},scalar={},hasRequiredScalar;function requireScalar(){if(hasRequiredScalar)return scalar;hasRequiredScalar=1,Object.defineProperty(scalar,"__esModule",{value:!0}),scalar.scalarEquals=wr,scalar.scalarZeroValue=Er,scalar.isScalarZeroValue=kr;const fr=requireProtoInt64(),br=requireDescriptors();function wr(jr,Br,Wr){if(Br===Wr)return!0;if(jr==br.ScalarType.BYTES){if(!(Br instanceof Uint8Array)||!(Wr instanceof Uint8Array)||Br.length!==Wr.length)return!1;for(let qr=0;qrZr.localName===Vr)}function Er(qr,Gr){const Vr=Gr.localName;if(Gr.oneof)return qr[Gr.oneof.localName].case===Vr;if(Gr.presence!=br)return qr[Vr]!==void 0&&Object.prototype.hasOwnProperty.call(qr,Vr);switch(Gr.fieldKind){case"list":return qr[Vr].length>0;case"map":return Object.keys(qr[Vr]).length>0;case"scalar":return!(0,fr.isScalarZeroValue)(Gr.scalar,qr[Vr]);case"enum":return qr[Vr]!==Gr.enum.values[0].number}throw new Error("message field with implicit presence")}function kr(qr,Gr){return Object.prototype.hasOwnProperty.call(qr,Gr)&&qr[Gr]!==void 0}function jr(qr,Gr){if(Gr.oneof){const Vr=qr[Gr.oneof.localName];return Vr.case===Gr.localName?Vr.value:void 0}return qr[Gr.localName]}function Br(qr,Gr,Vr){Gr.oneof?qr[Gr.oneof.localName]={case:Gr.localName,value:Vr}:qr[Gr.localName]=Vr}function Wr(qr,Gr){const Vr=Gr.localName;if(Gr.oneof){const Zr=Gr.oneof.localName;qr[Zr].case===Vr&&(qr[Zr]={case:void 0})}else if(Gr.presence!=br)delete qr[Vr];else switch(Gr.fieldKind){case"map":qr[Vr]={};break;case"list":qr[Vr]=[];break;case"enum":qr[Vr]=Gr.enum.values[0].number;break;case"scalar":qr[Vr]=(0,fr.scalarZeroValue)(Gr.scalar,Gr.longAsString);break}}return unsafe}var hasRequiredGuard;function requireGuard(){if(hasRequiredGuard)return guard$1;hasRequiredGuard=1,Object.defineProperty(guard$1,"__esModule",{value:!0}),guard$1.isObject=br,guard$1.isOneofADT=wr,guard$1.isReflectList=Er,guard$1.isReflectMap=kr,guard$1.isReflectMessage=jr;const fr=requireUnsafe();function br(Br){return Br!==null&&typeof Br=="object"&&!Array.isArray(Br)}function wr(Br){return Br!==null&&typeof Br=="object"&&"case"in Br&&(typeof Br.case=="string"&&"value"in Br&&Br.value!=null||Br.case===void 0&&(!("value"in Br)||Br.value===void 0))}function Er(Br,Wr){var qr,Gr,Vr,Zr;if(br(Br)&&fr.unsafeLocal in Br&&"add"in Br&&"field"in Br&&typeof Br.field=="function"){if(Wr!==void 0){const Jr=Wr,Qr=Br.field();return Jr.listKind==Qr.listKind&&Jr.scalar===Qr.scalar&&((qr=Jr.message)===null||qr===void 0?void 0:qr.typeName)===((Gr=Qr.message)===null||Gr===void 0?void 0:Gr.typeName)&&((Vr=Jr.enum)===null||Vr===void 0?void 0:Vr.typeName)===((Zr=Qr.enum)===null||Zr===void 0?void 0:Zr.typeName)}return!0}return!1}function kr(Br,Wr){var qr,Gr,Vr,Zr;if(br(Br)&&fr.unsafeLocal in Br&&"has"in Br&&"field"in Br&&typeof Br.field=="function"){if(Wr!==void 0){const Jr=Wr,Qr=Br.field();return Jr.mapKey===Qr.mapKey&&Jr.mapKind==Qr.mapKind&&Jr.scalar===Qr.scalar&&((qr=Jr.message)===null||qr===void 0?void 0:qr.typeName)===((Gr=Qr.message)===null||Gr===void 0?void 0:Gr.typeName)&&((Vr=Jr.enum)===null||Vr===void 0?void 0:Vr.typeName)===((Zr=Qr.enum)===null||Zr===void 0?void 0:Zr.typeName)}return!0}return!1}function jr(Br,Wr){return br(Br)&&fr.unsafeLocal in Br&&"desc"in Br&&br(Br.desc)&&Br.desc.kind==="message"&&(Wr===void 0||Br.desc.typeName==Wr.typeName)}return guard$1}var hasRequiredReflectCheck;function requireReflectCheck(){if(hasRequiredReflectCheck)return reflectCheck;hasRequiredReflectCheck=1,Object.defineProperty(reflectCheck,"__esModule",{value:!0}),reflectCheck.checkField=Wr,reflectCheck.checkListItem=qr,reflectCheck.checkMapEntry=Gr,reflectCheck.formatVal=Qr;const fr=requireDescriptors(),br=requireIsMessage(),wr=requireError(),Er=requireGuard(),kr=requireBinaryEncoding(),jr=requireTextEncoding(),Br=requireProtoInt64();function Wr(An,jn){const eo=An.fieldKind=="list"?(0,Er.isReflectList)(jn,An):An.fieldKind=="map"?(0,Er.isReflectMap)(jn,An):Vr(An,jn);if(eo===!0)return;let ro;switch(An.fieldKind){case"list":ro=`expected ${En(An)}, got ${Qr(jn)}`;break;case"map":ro=`expected ${Cn(An)}, got ${Qr(jn)}`;break;default:ro=Jr(An,jn,eo)}return new wr.FieldError(An,ro)}function qr(An,jn,eo){const ro=Vr(An,eo);if(ro!==!0)return new wr.FieldError(An,`list item #${jn+1}: ${Jr(An,eo,ro)}`)}function Gr(An,jn,eo){const ro=Zr(jn,An.mapKey);if(ro!==!0)return new wr.FieldError(An,`invalid map key: ${Jr({scalar:An.mapKey},jn,ro)}`);const to=Vr(An,eo);if(to!==!0)return new wr.FieldError(An,`map entry ${Qr(jn)}: ${Jr(An,eo,to)}`)}function Vr(An,jn){return An.scalar!==void 0?Zr(jn,An.scalar):An.enum!==void 0?An.enum.open?Number.isInteger(jn):An.enum.values.some(eo=>eo.number===jn):(0,Er.isReflectMessage)(jn,An.message)}function Zr(An,jn){switch(jn){case fr.ScalarType.DOUBLE:return typeof An=="number";case fr.ScalarType.FLOAT:return typeof An!="number"?!1:Number.isNaN(An)||!Number.isFinite(An)?!0:An>kr.FLOAT32_MAX||Ankr.INT32_MAX||Ankr.UINT32_MAX||An<0?`${An.toFixed()} out of range`:!0;case fr.ScalarType.BOOL:return typeof An=="boolean";case fr.ScalarType.STRING:return typeof An!="string"?!1:(0,jr.getTextEncoding)().checkUtf8(An)||"invalid UTF8";case fr.ScalarType.BYTES:return An instanceof Uint8Array;case fr.ScalarType.INT64:case fr.ScalarType.SFIXED64:case fr.ScalarType.SINT64:if(typeof An!="string"&&typeof An!="bigint"&&typeof An!="number")return!1;try{Br.protoInt64.parse(An)}catch{return`${An} out of range`}return!0;case fr.ScalarType.FIXED64:case fr.ScalarType.UINT64:if(typeof An!="string"&&typeof An!="bigint"&&typeof An!="number")return!1;try{Br.protoInt64.uParse(An)}catch{return`${An} out of range`}return!0}}function Jr(An,jn,eo){return eo=typeof eo=="string"?`: ${eo}`:`, got ${Qr(jn)}`,An.scalar!==void 0?`expected ${In(An.scalar)}`+eo:An.enum!==void 0?`expected ${An.enum.toString()}`+eo:`expected ${_n(An.message)}`+eo}function Qr(An){switch(typeof An){case"object":return An===null?"null":An instanceof Uint8Array?`Uint8Array(${An.length})`:Array.isArray(An)?`Array(${An.length})`:(0,Er.isReflectList)(An)?En(An.field()):(0,Er.isReflectMap)(An)?Cn(An.field()):(0,Er.isReflectMessage)(An)?_n(An.desc):(0,br.isMessage)(An)?`message ${An.$typeName}`:"object";case"string":return An.length>30?"string":`"${An.split('"').join('\\"')}"`;case"boolean":return String(An);case"number":return String(An);case"bigint":return String(An)+"n";default:return typeof An}}function _n(An){return`ReflectMessage (${An.typeName})`}function En(An){switch(An.listKind){case"message":return`ReflectList (${An.message.toString()})`;case"enum":return`ReflectList (${An.enum.toString()})`;case"scalar":return`ReflectList (${fr.ScalarType[An.scalar]})`}}function Cn(An){switch(An.mapKind){case"message":return`ReflectMap (${fr.ScalarType[An.mapKey]}, ${An.message.toString()})`;case"enum":return`ReflectMap (${fr.ScalarType[An.mapKey]}, ${An.enum.toString()})`;case"scalar":return`ReflectMap (${fr.ScalarType[An.mapKey]}, ${fr.ScalarType[An.scalar]})`}}function In(An){switch(An){case fr.ScalarType.STRING:return"string";case fr.ScalarType.BOOL:return"boolean";case fr.ScalarType.INT64:case fr.ScalarType.SINT64:case fr.ScalarType.SFIXED64:return"bigint (int64)";case fr.ScalarType.UINT64:case fr.ScalarType.FIXED64:return"bigint (uint64)";case fr.ScalarType.BYTES:return"Uint8Array";case fr.ScalarType.DOUBLE:return"number (float64)";case fr.ScalarType.FLOAT:return"number (float32)";case fr.ScalarType.FIXED32:case fr.ScalarType.UINT32:return"number (uint32)";case fr.ScalarType.INT32:case fr.ScalarType.SFIXED32:case fr.ScalarType.SINT32:return"number (int32)"}}return reflectCheck}var create$3={},wrappers={},hasRequiredWrappers;function requireWrappers(){if(hasRequiredWrappers)return wrappers;hasRequiredWrappers=1,Object.defineProperty(wrappers,"__esModule",{value:!0}),wrappers.isWrapper=fr,wrappers.isWrapperDesc=br;function fr(Er){return wr(Er.$typeName)}function br(Er){const kr=Er.fields[0];return wr(Er.typeName)&&kr!==void 0&&kr.fieldKind=="scalar"&&kr.name=="value"&&kr.number==1}function wr(Er){return Er.startsWith("google.protobuf.")&&["DoubleValue","FloatValue","Int64Value","UInt64Value","Int32Value","UInt32Value","BoolValue","StringValue","BytesValue"].includes(Er.substring(16))}return wrappers}var hasRequiredCreate;function requireCreate(){if(hasRequiredCreate)return create$3;hasRequiredCreate=1,Object.defineProperty(create$3,"__esModule",{value:!0}),create$3.create=Gr;const fr=requireIsMessage(),br=requireDescriptors(),wr=requireScalar(),Er=requireGuard(),kr=requireUnsafe(),jr=requireWrappers(),Br=999,Wr=998,qr=2;function Gr(to,_i){if((0,fr.isMessage)(_i,to))return _i;const oo=jn(to);return _i!==void 0&&Vr(to,oo,_i),oo}function Vr(to,_i,oo){for(const io of to.members){let co=oo[io.localName];if(co==null)continue;let so;if(io.kind=="oneof"){const no=(0,kr.unsafeOneofCase)(oo,io);if(!no)continue;so=no,co=(0,kr.unsafeGet)(oo,no)}else so=io;switch(so.fieldKind){case"message":co=_n(so,co);break;case"scalar":co=Zr(so,co);break;case"list":co=Qr(so,co);break;case"map":co=Jr(so,co);break}(0,kr.unsafeSet)(_i,so,co)}return _i}function Zr(to,_i){return to.scalar==br.ScalarType.BYTES?En(_i):_i}function Jr(to,_i){if((0,Er.isObject)(_i)){if(to.scalar==br.ScalarType.BYTES)return Cn(_i,En);if(to.mapKind=="message")return Cn(_i,oo=>_n(to,oo))}return _i}function Qr(to,_i){if(Array.isArray(_i)){if(to.scalar==br.ScalarType.BYTES)return _i.map(En);if(to.listKind=="message")return _i.map(oo=>_n(to,oo))}return _i}function _n(to,_i){if(to.fieldKind=="message"&&!to.oneof&&(0,jr.isWrapperDesc)(to.message))return Zr(to.message.fields[0],_i);if((0,Er.isObject)(_i)){if(to.message.typeName=="google.protobuf.Struct"&&to.parent.typeName!=="google.protobuf.Value")return _i;if(!(0,fr.isMessage)(_i,to.message))return Gr(to.message,_i)}return _i}function En(to){return Array.isArray(to)?new Uint8Array(to):to}function Cn(to,_i){const oo={};for(const io of Object.entries(to))oo[io[0]]=_i(io[1]);return oo}const In=Symbol(),An=new WeakMap;function jn(to){let _i;if(eo(to)){const oo=An.get(to);let io,co;if(oo)({prototype:io,members:co}=oo);else{io={},co=new Set;for(const so of to.members)so.kind!="oneof"&&(so.fieldKind!="scalar"&&so.fieldKind!="enum"||so.presence!=qr&&(co.add(so),io[so.localName]=ro(so)));An.set(to,{prototype:io,members:co})}_i=Object.create(io),_i.$typeName=to.typeName;for(const so of to.members)co.has(so)||so.kind=="field"&&(so.fieldKind=="message"||(so.fieldKind=="scalar"||so.fieldKind=="enum")&&so.presence!=qr)||(_i[so.localName]=ro(so))}else{_i={$typeName:to.typeName};for(const oo of to.members)(oo.kind=="oneof"||oo.presence==qr)&&(_i[oo.localName]=ro(oo))}return _i}function eo(to){switch(to.file.edition){case Br:return!1;case Wr:return!0;default:return to.fields.some(_i=>_i.presence!=qr&&_i.fieldKind!="message"&&!_i.oneof)}}function ro(to){if(to.kind=="oneof")return{case:void 0};if(to.fieldKind=="list")return[];if(to.fieldKind=="map")return{};if(to.fieldKind=="message")return In;const _i=to.getDefaultValue();return _i!==void 0?to.fieldKind=="scalar"&&to.longAsString?_i.toString():_i:to.fieldKind=="scalar"?(0,wr.scalarZeroValue)(to.scalar,to.longAsString):to.enum.values[0].number}return create$3}var hasRequiredReflect;function requireReflect(){if(hasRequiredReflect)return reflect;hasRequiredReflect=1,Object.defineProperty(reflect,"__esModule",{value:!0}),reflect.reflect=Gr,reflect.reflectList=Jr,reflect.reflectMap=_n;const fr=requireDescriptors(),br=requireReflectCheck(),wr=requireError(),Er=requireUnsafe(),kr=requireCreate(),jr=requireWrappers(),Br=requireScalar(),Wr=requireProtoInt64(),qr=requireGuard();function Gr(Hr,Xr,Sn=!0){return new Vr(Hr,Xr,Sn)}class Vr{get sortedFields(){var Xr;return(Xr=this._sortedFields)!==null&&Xr!==void 0?Xr:this._sortedFields=this.desc.fields.concat().sort((Sn,Rn)=>Sn.number-Rn.number)}constructor(Xr,Sn,Rn=!0){this.lists=new Map,this.maps=new Map,this.check=Rn,this.desc=Xr,this.message=this[Er.unsafeLocal]=Sn??(0,kr.create)(Xr),this.fields=Xr.fields,this.oneofs=Xr.oneofs,this.members=Xr.members}findNumber(Xr){return this._fieldsByNumber||(this._fieldsByNumber=new Map(this.desc.fields.map(Sn=>[Sn.number,Sn]))),this._fieldsByNumber.get(Xr)}oneofCase(Xr){return Zr(this.message,Xr),(0,Er.unsafeOneofCase)(this.message,Xr)}isSet(Xr){return Zr(this.message,Xr),(0,Er.unsafeIsSet)(this.message,Xr)}clear(Xr){Zr(this.message,Xr),(0,Er.unsafeClear)(this.message,Xr)}get(Xr){Zr(this.message,Xr);const Sn=(0,Er.unsafeGet)(this.message,Xr);switch(Xr.fieldKind){case"list":let Rn=this.lists.get(Xr);return(!Rn||Rn[Er.unsafeLocal]!==Sn)&&this.lists.set(Xr,Rn=new Qr(Xr,Sn,this.check)),Rn;case"map":let Pn=this.maps.get(Xr);return(!Pn||Pn[Er.unsafeLocal]!==Sn)&&this.maps.set(Xr,Pn=new En(Xr,Sn,this.check)),Pn;case"message":return In(Xr,Sn,this.check);case"scalar":return Sn===void 0?(0,Br.scalarZeroValue)(Xr.scalar,!1):oo(Xr,Sn);case"enum":return Sn??Xr.enum.values[0].number}}set(Xr,Sn){if(Zr(this.message,Xr),this.check){const Pn=(0,br.checkField)(Xr,Sn);if(Pn)throw Pn}let Rn;Xr.fieldKind=="message"?Rn=Cn(Xr,Sn):(0,qr.isReflectMap)(Sn)||(0,qr.isReflectList)(Sn)?Rn=Sn[Er.unsafeLocal]:Rn=io(Xr,Sn),(0,Er.unsafeSet)(this.message,Xr,Rn)}getUnknown(){return this.message.$unknown}setUnknown(Xr){this.message.$unknown=Xr}}function Zr(Hr,Xr){if(Xr.parent.typeName!==Hr.$typeName)throw new wr.FieldError(Xr,`cannot use ${Xr.toString()} with message ${Hr.$typeName}`,"ForeignFieldError")}function Jr(Hr,Xr,Sn=!0){return new Qr(Hr,Xr??[],Sn)}class Qr{field(){return this._field}get size(){return this._arr.length}constructor(Xr,Sn,Rn){this._field=Xr,this._arr=this[Er.unsafeLocal]=Sn,this.check=Rn}get(Xr){const Sn=this._arr[Xr];return Sn===void 0?void 0:jn(this._field,Sn,this.check)}set(Xr,Sn){if(Xr<0||Xr>=this._arr.length)throw new wr.FieldError(this._field,`list item #${Xr+1}: out of range`);if(this.check){const Rn=(0,br.checkListItem)(this._field,Xr,Sn);if(Rn)throw Rn}this._arr[Xr]=An(this._field,Sn)}add(Xr){if(this.check){const Sn=(0,br.checkListItem)(this._field,this._arr.length,Xr);if(Sn)throw Sn}this._arr.push(An(this._field,Xr))}clear(){this._arr.splice(0,this._arr.length)}[Symbol.iterator](){return this.values()}keys(){return this._arr.keys()}*values(){for(const Xr of this._arr)yield jn(this._field,Xr,this.check)}*entries(){for(let Xr=0;Xr0&&_n.setUnknown(_i)}function Gr(_n,En,Cn,In,An){switch(Cn.fieldKind){case"scalar":_n.set(Cn,Qr(En,Cn.scalar));break;case"enum":_n.set(Cn,Qr(En,fr.ScalarType.INT32));break;case"message":_n.set(Cn,Jr(En,An,Cn,_n.get(Cn)));break;case"list":Zr(En,In,_n.get(Cn),An);break;case"map":Vr(En,_n.get(Cn),An);break}}function Vr(_n,En,Cn){const In=En.field();let An,jn;const eo=_n.pos+_n.uint32();for(;_n.pos1||In(to,oo)})},_i&&(Qr[to]=_i(Qr[to])))}function In(to,_i){try{An(Jr[to](_i))}catch(oo){ro(_n[0][3],oo)}}function An(to){to.value instanceof br?Promise.resolve(to.value.v).then(jn,eo):ro(_n[0][2],to)}function jn(to){In("next",to)}function eo(to){In("throw",to)}function ro(to,_i){to(_i),_n.shift(),_n.length&&In(_n[0][0],_n[0][1])}};Object.defineProperty(sizeDelimited,"__esModule",{value:!0}),sizeDelimited.sizeDelimitedEncode=Br,sizeDelimited.sizeDelimitedDecodeStream=Wr,sizeDelimited.sizeDelimitedPeek=qr;const Er=requireToBinary(),kr=requireBinaryEncoding(),jr=requireFromBinary();function Br(Gr,Vr,Zr){const Jr=new kr.BinaryWriter;return Jr.bytes((0,Er.toBinary)(Gr,Vr,Zr)),Jr.finish()}function Wr(Gr,Vr,Zr){return wr(this,arguments,function*(){var Qr,_n,En,Cn;function In(to,_i){const oo=new Uint8Array(to.byteLength+_i.byteLength);return oo.set(to),oo.set(_i,to.length),oo}let An=new Uint8Array(0);try{for(var jn=!0,eo=fr(Vr),ro;ro=yield br(eo.next()),Qr=ro.done,!Qr;jn=!0)for(Cn=ro.value,jn=!1,An=In(An,Cn);;){const _i=qr(An);if(_i.eof||_i.offset+_i.size>An.byteLength)break;yield yield br((0,jr.fromBinary)(Gr,An.subarray(_i.offset,_i.offset+_i.size),Zr)),An=An.subarray(_i.offset+_i.size)}}catch(to){_n={error:to}}finally{try{!jn&&!Qr&&(En=eo.return)&&(yield br(En.call(eo)))}finally{if(_n)throw _n.error}}if(An.byteLength>0)throw new Error("incomplete data")})}function qr(Gr){const Vr={eof:!0,size:null,offset:null};for(let Zr=0;Zr<10;Zr++){if(Zr>Gr.byteLength)return Vr;if(!(Gr[Zr]&128)){const Jr=new kr.BinaryReader(Gr);let Qr;try{Qr=Jr.uint32()}catch(_n){if(_n instanceof RangeError)return Vr;throw _n}return{eof:!1,size:Qr,offset:Jr.pos}}}throw new Error("invalid varint")}return sizeDelimited}var hasRequiredWire;function requireWire(){return hasRequiredWire||(hasRequiredWire=1,function(fr){var br=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(Er,kr,jr,Br){Br===void 0&&(Br=jr);var Wr=Object.getOwnPropertyDescriptor(kr,jr);(!Wr||("get"in Wr?!kr.__esModule:Wr.writable||Wr.configurable))&&(Wr={enumerable:!0,get:function(){return kr[jr]}}),Object.defineProperty(Er,Br,Wr)}:function(Er,kr,jr,Br){Br===void 0&&(Br=jr),Er[Br]=kr[jr]}),wr=commonjsGlobal&&commonjsGlobal.__exportStar||function(Er,kr){for(var jr in Er)jr!=="default"&&!Object.prototype.hasOwnProperty.call(kr,jr)&&br(kr,Er,jr)};Object.defineProperty(fr,"__esModule",{value:!0}),wr(requireBinaryEncoding(),fr),wr(requireBase64Encoding(),fr),wr(requireTextEncoding(),fr),wr(requireTextFormat(),fr),wr(requireSizeDelimited(),fr)}(wire)),wire}var tx$1={},hasRequiredTx$1;function requireTx$1(){return hasRequiredTx$1||(hasRequiredTx$1=1,function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.Transaction=fr.protobufPackage=void 0;const br=requireWire();fr.protobufPackage="push";function wr(){return{type:0,category:"",sender:"",recipients:[],data:new Uint8Array(0),salt:new Uint8Array(0),apiToken:new Uint8Array(0),signature:new Uint8Array(0),fee:""}}fr.Transaction={encode(Br,Wr=new br.BinaryWriter){Br.type!==0&&Wr.uint32(8).uint32(Br.type),Br.category!==""&&Wr.uint32(18).string(Br.category),Br.sender!==""&&Wr.uint32(26).string(Br.sender);for(const qr of Br.recipients)Wr.uint32(34).string(qr);return Br.data.length!==0&&Wr.uint32(42).bytes(Br.data),Br.salt.length!==0&&Wr.uint32(50).bytes(Br.salt),Br.apiToken.length!==0&&Wr.uint32(58).bytes(Br.apiToken),Br.signature.length!==0&&Wr.uint32(66).bytes(Br.signature),Br.fee!==""&&Wr.uint32(74).string(Br.fee),Wr},decode(Br,Wr){const qr=Br instanceof br.BinaryReader?Br:new br.BinaryReader(Br);let Gr=Wr===void 0?qr.len:qr.pos+Wr;const Vr=wr();for(;qr.pos>>3){case 1:{if(Zr!==8)break;Vr.type=qr.uint32();continue}case 2:{if(Zr!==18)break;Vr.category=qr.string();continue}case 3:{if(Zr!==26)break;Vr.sender=qr.string();continue}case 4:{if(Zr!==34)break;Vr.recipients.push(qr.string());continue}case 5:{if(Zr!==42)break;Vr.data=qr.bytes();continue}case 6:{if(Zr!==50)break;Vr.salt=qr.bytes();continue}case 7:{if(Zr!==58)break;Vr.apiToken=qr.bytes();continue}case 8:{if(Zr!==66)break;Vr.signature=qr.bytes();continue}case 9:{if(Zr!==74)break;Vr.fee=qr.string();continue}}if((Zr&7)===4||Zr===0)break;qr.skip(Zr&7)}return Vr},fromJSON(Br){return{type:jr(Br.type)?globalThis.Number(Br.type):0,category:jr(Br.category)?globalThis.String(Br.category):"",sender:jr(Br.sender)?globalThis.String(Br.sender):"",recipients:globalThis.Array.isArray(Br==null?void 0:Br.recipients)?Br.recipients.map(Wr=>globalThis.String(Wr)):[],data:jr(Br.data)?Er(Br.data):new Uint8Array(0),salt:jr(Br.salt)?Er(Br.salt):new Uint8Array(0),apiToken:jr(Br.apiToken)?Er(Br.apiToken):new Uint8Array(0),signature:jr(Br.signature)?Er(Br.signature):new Uint8Array(0),fee:jr(Br.fee)?globalThis.String(Br.fee):""}},toJSON(Br){var Wr;const qr={};return Br.type!==0&&(qr.type=Math.round(Br.type)),Br.category!==""&&(qr.category=Br.category),Br.sender!==""&&(qr.sender=Br.sender),!((Wr=Br.recipients)===null||Wr===void 0)&&Wr.length&&(qr.recipients=Br.recipients),Br.data.length!==0&&(qr.data=kr(Br.data)),Br.salt.length!==0&&(qr.salt=kr(Br.salt)),Br.apiToken.length!==0&&(qr.apiToken=kr(Br.apiToken)),Br.signature.length!==0&&(qr.signature=kr(Br.signature)),Br.fee!==""&&(qr.fee=Br.fee),qr},create(Br){return fr.Transaction.fromPartial(Br??{})},fromPartial(Br){var Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En;const Cn=wr();return Cn.type=(Wr=Br.type)!==null&&Wr!==void 0?Wr:0,Cn.category=(qr=Br.category)!==null&&qr!==void 0?qr:"",Cn.sender=(Gr=Br.sender)!==null&&Gr!==void 0?Gr:"",Cn.recipients=((Vr=Br.recipients)===null||Vr===void 0?void 0:Vr.map(In=>In))||[],Cn.data=(Zr=Br.data)!==null&&Zr!==void 0?Zr:new Uint8Array(0),Cn.salt=(Jr=Br.salt)!==null&&Jr!==void 0?Jr:new Uint8Array(0),Cn.apiToken=(Qr=Br.apiToken)!==null&&Qr!==void 0?Qr:new Uint8Array(0),Cn.signature=(_n=Br.signature)!==null&&_n!==void 0?_n:new Uint8Array(0),Cn.fee=(En=Br.fee)!==null&&En!==void 0?En:"",Cn}};function Er(Br){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(Br,"base64"));{const Wr=globalThis.atob(Br),qr=new Uint8Array(Wr.length);for(let Gr=0;Gr{Wr.push(globalThis.String.fromCharCode(qr))}),globalThis.btoa(Wr.join(""))}}function jr(Br){return Br!=null}}(tx$1)),tx$1}var hasRequiredBlock$1;function requireBlock$1(){return hasRequiredBlock$1||(hasRequiredBlock$1=1,function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.AttestorReport=fr.AttestSignaturesResponse=fr.AttestSignaturesRequest=fr.AttestBlockResult=fr.Block=fr.Signer=fr.TransactionObj=fr.TxAttestorData=fr.TxValidatorData=fr.DidMapping_DidMappingEntry=fr.DidMapping=fr.Vote=fr.Role=fr.protobufPackage=void 0,fr.roleFromJSON=kr,fr.roleToJSON=jr,fr.voteFromJSON=Wr,fr.voteToJSON=qr;const br=requireWire(),wr=requireTx$1();fr.protobufPackage="push";var Er;(function(io){io[io.ROLE_UNSPECIFIED=0]="ROLE_UNSPECIFIED",io[io.VALIDATOR=1]="VALIDATOR",io[io.ATTESTER=2]="ATTESTER",io[io.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Er||(fr.Role=Er={}));function kr(io){switch(io){case 0:case"ROLE_UNSPECIFIED":return Er.ROLE_UNSPECIFIED;case 1:case"VALIDATOR":return Er.VALIDATOR;case 2:case"ATTESTER":return Er.ATTESTER;case-1:case"UNRECOGNIZED":default:return Er.UNRECOGNIZED}}function jr(io){switch(io){case Er.ROLE_UNSPECIFIED:return"ROLE_UNSPECIFIED";case Er.VALIDATOR:return"VALIDATOR";case Er.ATTESTER:return"ATTESTER";case Er.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var Br;(function(io){io[io.VOTE_UNSPECIFIED=0]="VOTE_UNSPECIFIED",io[io.ACCEPTED=1]="ACCEPTED",io[io.REJECTED=2]="REJECTED",io[io.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Br||(fr.Vote=Br={}));function Wr(io){switch(io){case 0:case"VOTE_UNSPECIFIED":return Br.VOTE_UNSPECIFIED;case 1:case"ACCEPTED":return Br.ACCEPTED;case 2:case"REJECTED":return Br.REJECTED;case-1:case"UNRECOGNIZED":default:return Br.UNRECOGNIZED}}function qr(io){switch(io){case Br.VOTE_UNSPECIFIED:return"VOTE_UNSPECIFIED";case Br.ACCEPTED:return"ACCEPTED";case Br.REJECTED:return"REJECTED";case Br.UNRECOGNIZED:default:return"UNRECOGNIZED"}}function Gr(){return{didMapping:{}}}fr.DidMapping={encode(io,co=new br.BinaryWriter){return Object.entries(io.didMapping).forEach(([so,no])=>{fr.DidMapping_DidMappingEntry.encode({key:so,value:no},co.uint32(10).fork()).join()}),co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=Gr();for(;so.pos>>3){case 1:{if(Hr!==10)break;const Xr=fr.DidMapping_DidMappingEntry.decode(so,so.uint32());Xr.value!==void 0&&(Tn.didMapping[Xr.key]=Xr.value);continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{didMapping:_i(io.didMapping)?Object.entries(io.didMapping).reduce((co,[so,no])=>(co[so]=String(no),co),{}):{}}},toJSON(io){const co={};if(io.didMapping){const so=Object.entries(io.didMapping);so.length>0&&(co.didMapping={},so.forEach(([no,Tn])=>{co.didMapping[no]=Tn}))}return co},create(io){return fr.DidMapping.fromPartial(io??{})},fromPartial(io){var co;const so=Gr();return so.didMapping=Object.entries((co=io.didMapping)!==null&&co!==void 0?co:{}).reduce((no,[Tn,Hr])=>(Hr!==void 0&&(no[Tn]=globalThis.String(Hr)),no),{}),so}};function Vr(){return{key:"",value:""}}fr.DidMapping_DidMappingEntry={encode(io,co=new br.BinaryWriter){return io.key!==""&&co.uint32(10).string(io.key),io.value!==""&&co.uint32(18).string(io.value),co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=Vr();for(;so.pos>>3){case 1:{if(Hr!==10)break;Tn.key=so.string();continue}case 2:{if(Hr!==18)break;Tn.value=so.string();continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{key:oo(io.key)?globalThis.String(io.key):"",value:oo(io.value)?globalThis.String(io.value):""}},toJSON(io){const co={};return io.key!==""&&(co.key=io.key),io.value!==""&&(co.value=io.value),co},create(io){return fr.DidMapping_DidMappingEntry.fromPartial(io??{})},fromPartial(io){var co,so;const no=Vr();return no.key=(co=io.key)!==null&&co!==void 0?co:"",no.value=(so=io.value)!==null&&so!==void 0?so:"",no}};function Zr(){return{vote:0,didMapping:void 0}}fr.TxValidatorData={encode(io,co=new br.BinaryWriter){return io.vote!==0&&co.uint32(8).int32(io.vote),io.didMapping!==void 0&&fr.DidMapping.encode(io.didMapping,co.uint32(18).fork()).join(),co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=Zr();for(;so.pos>>3){case 1:{if(Hr!==8)break;Tn.vote=so.int32();continue}case 2:{if(Hr!==18)break;Tn.didMapping=fr.DidMapping.decode(so,so.uint32());continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{vote:oo(io.vote)?Wr(io.vote):0,didMapping:oo(io.didMapping)?fr.DidMapping.fromJSON(io.didMapping):void 0}},toJSON(io){const co={};return io.vote!==0&&(co.vote=qr(io.vote)),io.didMapping!==void 0&&(co.didMapping=fr.DidMapping.toJSON(io.didMapping)),co},create(io){return fr.TxValidatorData.fromPartial(io??{})},fromPartial(io){var co;const so=Zr();return so.vote=(co=io.vote)!==null&&co!==void 0?co:0,so.didMapping=io.didMapping!==void 0&&io.didMapping!==null?fr.DidMapping.fromPartial(io.didMapping):void 0,so}};function Jr(){return{vote:0}}fr.TxAttestorData={encode(io,co=new br.BinaryWriter){return io.vote!==0&&co.uint32(8).int32(io.vote),co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=Jr();for(;so.pos>>3){case 1:{if(Hr!==8)break;Tn.vote=so.int32();continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{vote:oo(io.vote)?Wr(io.vote):0}},toJSON(io){const co={};return io.vote!==0&&(co.vote=qr(io.vote)),co},create(io){return fr.TxAttestorData.fromPartial(io??{})},fromPartial(io){var co;const so=Jr();return so.vote=(co=io.vote)!==null&&co!==void 0?co:0,so}};function Qr(){return{tx:void 0,validatorData:void 0,attestorData:[]}}fr.TransactionObj={encode(io,co=new br.BinaryWriter){io.tx!==void 0&&wr.Transaction.encode(io.tx,co.uint32(10).fork()).join(),io.validatorData!==void 0&&fr.TxValidatorData.encode(io.validatorData,co.uint32(18).fork()).join();for(const so of io.attestorData)fr.TxAttestorData.encode(so,co.uint32(26).fork()).join();return co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=Qr();for(;so.pos>>3){case 1:{if(Hr!==10)break;Tn.tx=wr.Transaction.decode(so,so.uint32());continue}case 2:{if(Hr!==18)break;Tn.validatorData=fr.TxValidatorData.decode(so,so.uint32());continue}case 3:{if(Hr!==26)break;Tn.attestorData.push(fr.TxAttestorData.decode(so,so.uint32()));continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{tx:oo(io.tx)?wr.Transaction.fromJSON(io.tx):void 0,validatorData:oo(io.validatorData)?fr.TxValidatorData.fromJSON(io.validatorData):void 0,attestorData:globalThis.Array.isArray(io==null?void 0:io.attestorData)?io.attestorData.map(co=>fr.TxAttestorData.fromJSON(co)):[]}},toJSON(io){var co;const so={};return io.tx!==void 0&&(so.tx=wr.Transaction.toJSON(io.tx)),io.validatorData!==void 0&&(so.validatorData=fr.TxValidatorData.toJSON(io.validatorData)),!((co=io.attestorData)===null||co===void 0)&&co.length&&(so.attestorData=io.attestorData.map(no=>fr.TxAttestorData.toJSON(no))),so},create(io){return fr.TransactionObj.fromPartial(io??{})},fromPartial(io){var co;const so=Qr();return so.tx=io.tx!==void 0&&io.tx!==null?wr.Transaction.fromPartial(io.tx):void 0,so.validatorData=io.validatorData!==void 0&&io.validatorData!==null?fr.TxValidatorData.fromPartial(io.validatorData):void 0,so.attestorData=((co=io.attestorData)===null||co===void 0?void 0:co.map(no=>fr.TxAttestorData.fromPartial(no)))||[],so}};function _n(){return{sig:new Uint8Array(0)}}fr.Signer={encode(io,co=new br.BinaryWriter){return io.sig.length!==0&&co.uint32(10).bytes(io.sig),co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=_n();for(;so.pos>>3){case 1:{if(Hr!==10)break;Tn.sig=so.bytes();continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{sig:oo(io.sig)?eo(io.sig):new Uint8Array(0)}},toJSON(io){const co={};return io.sig.length!==0&&(co.sig=ro(io.sig)),co},create(io){return fr.Signer.fromPartial(io??{})},fromPartial(io){var co;const so=_n();return so.sig=(co=io.sig)!==null&&co!==void 0?co:new Uint8Array(0),so}};function En(){return{ts:0,attestToken:new Uint8Array(0),txObj:[],signers:[]}}fr.Block={encode(io,co=new br.BinaryWriter){io.ts!==0&&co.uint32(8).uint64(io.ts),io.attestToken.length!==0&&co.uint32(34).bytes(io.attestToken);for(const so of io.txObj)fr.TransactionObj.encode(so,co.uint32(18).fork()).join();for(const so of io.signers)fr.Signer.encode(so,co.uint32(26).fork()).join();return co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=En();for(;so.pos>>3){case 1:{if(Hr!==8)break;Tn.ts=to(so.uint64());continue}case 4:{if(Hr!==34)break;Tn.attestToken=so.bytes();continue}case 2:{if(Hr!==18)break;Tn.txObj.push(fr.TransactionObj.decode(so,so.uint32()));continue}case 3:{if(Hr!==26)break;Tn.signers.push(fr.Signer.decode(so,so.uint32()));continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{ts:oo(io.ts)?globalThis.Number(io.ts):0,attestToken:oo(io.attestToken)?eo(io.attestToken):new Uint8Array(0),txObj:globalThis.Array.isArray(io==null?void 0:io.txObj)?io.txObj.map(co=>fr.TransactionObj.fromJSON(co)):[],signers:globalThis.Array.isArray(io==null?void 0:io.signers)?io.signers.map(co=>fr.Signer.fromJSON(co)):[]}},toJSON(io){var co,so;const no={};return io.ts!==0&&(no.ts=Math.round(io.ts)),io.attestToken.length!==0&&(no.attestToken=ro(io.attestToken)),!((co=io.txObj)===null||co===void 0)&&co.length&&(no.txObj=io.txObj.map(Tn=>fr.TransactionObj.toJSON(Tn))),!((so=io.signers)===null||so===void 0)&&so.length&&(no.signers=io.signers.map(Tn=>fr.Signer.toJSON(Tn))),no},create(io){return fr.Block.fromPartial(io??{})},fromPartial(io){var co,so,no,Tn;const Hr=En();return Hr.ts=(co=io.ts)!==null&&co!==void 0?co:0,Hr.attestToken=(so=io.attestToken)!==null&&so!==void 0?so:new Uint8Array(0),Hr.txObj=((no=io.txObj)===null||no===void 0?void 0:no.map(Xr=>fr.TransactionObj.fromPartial(Xr)))||[],Hr.signers=((Tn=io.signers)===null||Tn===void 0?void 0:Tn.map(Xr=>fr.Signer.fromPartial(Xr)))||[],Hr}};function Cn(){return{attestorData:[],signer:void 0}}fr.AttestBlockResult={encode(io,co=new br.BinaryWriter){for(const so of io.attestorData)fr.TxAttestorData.encode(so,co.uint32(10).fork()).join();return io.signer!==void 0&&fr.Signer.encode(io.signer,co.uint32(18).fork()).join(),co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=Cn();for(;so.pos>>3){case 1:{if(Hr!==10)break;Tn.attestorData.push(fr.TxAttestorData.decode(so,so.uint32()));continue}case 2:{if(Hr!==18)break;Tn.signer=fr.Signer.decode(so,so.uint32());continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{attestorData:globalThis.Array.isArray(io==null?void 0:io.attestorData)?io.attestorData.map(co=>fr.TxAttestorData.fromJSON(co)):[],signer:oo(io.signer)?fr.Signer.fromJSON(io.signer):void 0}},toJSON(io){var co;const so={};return!((co=io.attestorData)===null||co===void 0)&&co.length&&(so.attestorData=io.attestorData.map(no=>fr.TxAttestorData.toJSON(no))),io.signer!==void 0&&(so.signer=fr.Signer.toJSON(io.signer)),so},create(io){return fr.AttestBlockResult.fromPartial(io??{})},fromPartial(io){var co;const so=Cn();return so.attestorData=((co=io.attestorData)===null||co===void 0?void 0:co.map(no=>fr.TxAttestorData.fromPartial(no)))||[],so.signer=io.signer!==void 0&&io.signer!==null?fr.Signer.fromPartial(io.signer):void 0,so}};function In(){return{attestations:[],initialBlockHash:new Uint8Array(0),finalBlockHash:new Uint8Array(0)}}fr.AttestSignaturesRequest={encode(io,co=new br.BinaryWriter){for(const so of io.attestations)fr.AttestBlockResult.encode(so,co.uint32(10).fork()).join();return io.initialBlockHash.length!==0&&co.uint32(18).bytes(io.initialBlockHash),io.finalBlockHash.length!==0&&co.uint32(26).bytes(io.finalBlockHash),co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=In();for(;so.pos>>3){case 1:{if(Hr!==10)break;Tn.attestations.push(fr.AttestBlockResult.decode(so,so.uint32()));continue}case 2:{if(Hr!==18)break;Tn.initialBlockHash=so.bytes();continue}case 3:{if(Hr!==26)break;Tn.finalBlockHash=so.bytes();continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{attestations:globalThis.Array.isArray(io==null?void 0:io.attestations)?io.attestations.map(co=>fr.AttestBlockResult.fromJSON(co)):[],initialBlockHash:oo(io.initialBlockHash)?eo(io.initialBlockHash):new Uint8Array(0),finalBlockHash:oo(io.finalBlockHash)?eo(io.finalBlockHash):new Uint8Array(0)}},toJSON(io){var co;const so={};return!((co=io.attestations)===null||co===void 0)&&co.length&&(so.attestations=io.attestations.map(no=>fr.AttestBlockResult.toJSON(no))),io.initialBlockHash.length!==0&&(so.initialBlockHash=ro(io.initialBlockHash)),io.finalBlockHash.length!==0&&(so.finalBlockHash=ro(io.finalBlockHash)),so},create(io){return fr.AttestSignaturesRequest.fromPartial(io??{})},fromPartial(io){var co,so,no;const Tn=In();return Tn.attestations=((co=io.attestations)===null||co===void 0?void 0:co.map(Hr=>fr.AttestBlockResult.fromPartial(Hr)))||[],Tn.initialBlockHash=(so=io.initialBlockHash)!==null&&so!==void 0?so:new Uint8Array(0),Tn.finalBlockHash=(no=io.finalBlockHash)!==null&&no!==void 0?no:new Uint8Array(0),Tn}};function An(){return{attestations:[]}}fr.AttestSignaturesResponse={encode(io,co=new br.BinaryWriter){for(const so of io.attestations)fr.AttestorReport.encode(so,co.uint32(10).fork()).join();return co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=An();for(;so.pos>>3){case 1:{if(Hr!==10)break;Tn.attestations.push(fr.AttestorReport.decode(so,so.uint32()));continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{attestations:globalThis.Array.isArray(io==null?void 0:io.attestations)?io.attestations.map(co=>fr.AttestorReport.fromJSON(co)):[]}},toJSON(io){var co;const so={};return!((co=io.attestations)===null||co===void 0)&&co.length&&(so.attestations=io.attestations.map(no=>fr.AttestorReport.toJSON(no))),so},create(io){return fr.AttestSignaturesResponse.fromPartial(io??{})},fromPartial(io){var co;const so=An();return so.attestations=((co=io.attestations)===null||co===void 0?void 0:co.map(no=>fr.AttestorReport.fromPartial(no)))||[],so}};function jn(){return{nodeId:"",transactionHash:"",vote:0,dataForSc:new Uint8Array(0),dataSigForSc:new Uint8Array(0)}}fr.AttestorReport={encode(io,co=new br.BinaryWriter){return io.nodeId!==""&&co.uint32(10).string(io.nodeId),io.transactionHash!==""&&co.uint32(18).string(io.transactionHash),io.vote!==0&&co.uint32(24).int32(io.vote),io.dataForSc.length!==0&&co.uint32(34).bytes(io.dataForSc),io.dataSigForSc.length!==0&&co.uint32(42).bytes(io.dataSigForSc),co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=jn();for(;so.pos>>3){case 1:{if(Hr!==10)break;Tn.nodeId=so.string();continue}case 2:{if(Hr!==18)break;Tn.transactionHash=so.string();continue}case 3:{if(Hr!==24)break;Tn.vote=so.int32();continue}case 4:{if(Hr!==34)break;Tn.dataForSc=so.bytes();continue}case 5:{if(Hr!==42)break;Tn.dataSigForSc=so.bytes();continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{nodeId:oo(io.nodeId)?globalThis.String(io.nodeId):"",transactionHash:oo(io.transactionHash)?globalThis.String(io.transactionHash):"",vote:oo(io.vote)?globalThis.Number(io.vote):0,dataForSc:oo(io.dataForSc)?eo(io.dataForSc):new Uint8Array(0),dataSigForSc:oo(io.dataSigForSc)?eo(io.dataSigForSc):new Uint8Array(0)}},toJSON(io){const co={};return io.nodeId!==""&&(co.nodeId=io.nodeId),io.transactionHash!==""&&(co.transactionHash=io.transactionHash),io.vote!==0&&(co.vote=Math.round(io.vote)),io.dataForSc.length!==0&&(co.dataForSc=ro(io.dataForSc)),io.dataSigForSc.length!==0&&(co.dataSigForSc=ro(io.dataSigForSc)),co},create(io){return fr.AttestorReport.fromPartial(io??{})},fromPartial(io){var co,so,no,Tn,Hr;const Xr=jn();return Xr.nodeId=(co=io.nodeId)!==null&&co!==void 0?co:"",Xr.transactionHash=(so=io.transactionHash)!==null&&so!==void 0?so:"",Xr.vote=(no=io.vote)!==null&&no!==void 0?no:0,Xr.dataForSc=(Tn=io.dataForSc)!==null&&Tn!==void 0?Tn:new Uint8Array(0),Xr.dataSigForSc=(Hr=io.dataSigForSc)!==null&&Hr!==void 0?Hr:new Uint8Array(0),Xr}};function eo(io){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(io,"base64"));{const co=globalThis.atob(io),so=new Uint8Array(co.length);for(let no=0;no{co.push(globalThis.String.fromCharCode(so))}),globalThis.btoa(co.join(""))}}function to(io){const co=globalThis.Number(io.toString());if(co>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(cobr.__awaiter(this,[...Wr],void 0,function*(qr=Math.floor(Date.now()/1e3),Gr="ASC",Vr=!1,Zr=30,Jr=1){return yield this.validator.call("push_getBlocks",[qr,Gr,Vr,Zr,Jr])}),this.search=Wr=>br.__awaiter(this,void 0,void 0,function*(){return yield this.validator.call("push_getBlockByHash",[Wr])})}}return block$1.Block=kr,fr=kr,kr.initialize=jr=>br.__awaiter(void 0,void 0,void 0,function*(){const Br=yield wr.Validator.initalize({env:jr});return new fr(Br)}),kr.serialize=jr=>{const Br=Er.Block.create(jr);return Er.Block.encode(Br).finish()},kr.deserialize=jr=>Er.Block.decode(jr),block$1}var tx={},commonjsBrowser={},max={},hasRequiredMax;function requireMax(){return hasRequiredMax||(hasRequiredMax=1,Object.defineProperty(max,"__esModule",{value:!0}),max.default=void 0,max.default="ffffffff-ffff-ffff-ffff-ffffffffffff"),max}var nil$1={},hasRequiredNil;function requireNil(){return hasRequiredNil||(hasRequiredNil=1,Object.defineProperty(nil$1,"__esModule",{value:!0}),nil$1.default=void 0,nil$1.default="00000000-0000-0000-0000-000000000000"),nil$1}var parse$1={},validate$4={},regex={},hasRequiredRegex;function requireRegex(){return hasRequiredRegex||(hasRequiredRegex=1,Object.defineProperty(regex,"__esModule",{value:!0}),regex.default=void 0,regex.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i),regex}var hasRequiredValidate;function requireValidate(){if(hasRequiredValidate)return validate$4;hasRequiredValidate=1,Object.defineProperty(validate$4,"__esModule",{value:!0}),validate$4.default=void 0;var fr=br(requireRegex());function br(Er){return Er&&Er.__esModule?Er:{default:Er}}function wr(Er){return typeof Er=="string"&&fr.default.test(Er)}return validate$4.default=wr,validate$4}var hasRequiredParse;function requireParse(){if(hasRequiredParse)return parse$1;hasRequiredParse=1,Object.defineProperty(parse$1,"__esModule",{value:!0}),parse$1.default=void 0;var fr=br(requireValidate());function br(Er){return Er&&Er.__esModule?Er:{default:Er}}function wr(Er){if(!(0,fr.default)(Er))throw TypeError("Invalid UUID");var kr,jr=new Uint8Array(16);return jr[0]=(kr=parseInt(Er.slice(0,8),16))>>>24,jr[1]=kr>>>16&255,jr[2]=kr>>>8&255,jr[3]=kr&255,jr[4]=(kr=parseInt(Er.slice(9,13),16))>>>8,jr[5]=kr&255,jr[6]=(kr=parseInt(Er.slice(14,18),16))>>>8,jr[7]=kr&255,jr[8]=(kr=parseInt(Er.slice(19,23),16))>>>8,jr[9]=kr&255,jr[10]=(kr=parseInt(Er.slice(24,36),16))/1099511627776&255,jr[11]=kr/4294967296&255,jr[12]=kr>>>24&255,jr[13]=kr>>>16&255,jr[14]=kr>>>8&255,jr[15]=kr&255,jr}return parse$1.default=wr,parse$1}var stringify$3={},hasRequiredStringify;function requireStringify(){if(hasRequiredStringify)return stringify$3;hasRequiredStringify=1,Object.defineProperty(stringify$3,"__esModule",{value:!0}),stringify$3.default=void 0,stringify$3.unsafeStringify=kr;var fr=br(requireValidate());function br(Br){return Br&&Br.__esModule?Br:{default:Br}}for(var wr=[],Er=0;Er<256;++Er)wr.push((Er+256).toString(16).slice(1));function kr(Br,Wr=0){return(wr[Br[Wr+0]]+wr[Br[Wr+1]]+wr[Br[Wr+2]]+wr[Br[Wr+3]]+"-"+wr[Br[Wr+4]]+wr[Br[Wr+5]]+"-"+wr[Br[Wr+6]]+wr[Br[Wr+7]]+"-"+wr[Br[Wr+8]]+wr[Br[Wr+9]]+"-"+wr[Br[Wr+10]]+wr[Br[Wr+11]]+wr[Br[Wr+12]]+wr[Br[Wr+13]]+wr[Br[Wr+14]]+wr[Br[Wr+15]]).toLowerCase()}function jr(Br,Wr=0){var qr=kr(Br,Wr);if(!(0,fr.default)(qr))throw TypeError("Stringified UUID is invalid");return qr}return stringify$3.default=jr,stringify$3}var v1$1={},rng$1={},hasRequiredRng;function requireRng(){if(hasRequiredRng)return rng$1;hasRequiredRng=1,Object.defineProperty(rng$1,"__esModule",{value:!0}),rng$1.default=wr;var fr,br=new Uint8Array(16);function wr(){if(!fr&&(fr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!fr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return fr(br)}return rng$1}var hasRequiredV1;function requireV1(){if(hasRequiredV1)return v1$1;hasRequiredV1=1,Object.defineProperty(v1$1,"__esModule",{value:!0}),v1$1.default=void 0;var fr=wr(requireRng()),br=requireStringify();function wr(qr){return qr&&qr.__esModule?qr:{default:qr}}var Er,kr,jr=0,Br=0;function Wr(qr,Gr,Vr){var Zr=Gr&&Vr||0,Jr=Gr||new Array(16);qr=qr||{};var Qr=qr.node,_n=qr.clockseq;if(qr._v6||(Qr||(Qr=Er),_n==null&&(_n=kr)),Qr==null||_n==null){var En=qr.random||(qr.rng||fr.default)();Qr==null&&(Qr=[En[0],En[1],En[2],En[3],En[4],En[5]],!Er&&!qr._v6&&(Qr[0]|=1,Er=Qr)),_n==null&&(_n=(En[6]<<8|En[7])&16383,kr===void 0&&!qr._v6&&(kr=_n))}var Cn=qr.msecs!==void 0?qr.msecs:Date.now(),In=qr.nsecs!==void 0?qr.nsecs:Br+1,An=Cn-jr+(In-Br)/1e4;if(An<0&&qr.clockseq===void 0&&(_n=_n+1&16383),(An<0||Cn>jr)&&qr.nsecs===void 0&&(In=0),In>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");jr=Cn,Br=In,kr=_n,Cn+=122192928e5;var jn=((Cn&268435455)*1e4+In)%4294967296;Jr[Zr++]=jn>>>24&255,Jr[Zr++]=jn>>>16&255,Jr[Zr++]=jn>>>8&255,Jr[Zr++]=jn&255;var eo=Cn/4294967296*1e4&268435455;Jr[Zr++]=eo>>>8&255,Jr[Zr++]=eo&255,Jr[Zr++]=eo>>>24&15|16,Jr[Zr++]=eo>>>16&255,Jr[Zr++]=_n>>>8|128,Jr[Zr++]=_n&255;for(var ro=0;ro<6;++ro)Jr[Zr+ro]=Qr[ro];return Gr||(0,br.unsafeStringify)(Jr)}return v1$1.default=Wr,v1$1}var v1ToV6={},hasRequiredV1ToV6;function requireV1ToV6(){if(hasRequiredV1ToV6)return v1ToV6;hasRequiredV1ToV6=1,Object.defineProperty(v1ToV6,"__esModule",{value:!0}),v1ToV6.default=Er;var fr=wr(requireParse()),br=requireStringify();function wr(jr){return jr&&jr.__esModule?jr:{default:jr}}function Er(jr){var Br=typeof jr=="string"?(0,fr.default)(jr):jr,Wr=kr(Br);return typeof jr=="string"?(0,br.unsafeStringify)(Wr):Wr}function kr(jr,Br=!1){return Uint8Array.of((jr[6]&15)<<4|jr[7]>>4&15,(jr[7]&15)<<4|(jr[4]&240)>>4,(jr[4]&15)<<4|(jr[5]&240)>>4,(jr[5]&15)<<4|(jr[0]&240)>>4,(jr[0]&15)<<4|(jr[1]&240)>>4,(jr[1]&15)<<4|(jr[2]&240)>>4,96|jr[2]&15,jr[3],jr[8],jr[9],jr[10],jr[11],jr[12],jr[13],jr[14],jr[15])}return v1ToV6}var v3$1={},v35$1={},hasRequiredV35;function requireV35(){if(hasRequiredV35)return v35$1;hasRequiredV35=1,Object.defineProperty(v35$1,"__esModule",{value:!0}),v35$1.URL=v35$1.DNS=void 0,v35$1.default=Br;var fr=requireStringify(),br=wr(requireParse());function wr(Wr){return Wr&&Wr.__esModule?Wr:{default:Wr}}function Er(Wr){Wr=unescape(encodeURIComponent(Wr));for(var qr=[],Gr=0;Gr>5]>>>Cn%32&255,An=parseInt(En.charAt(In>>>4&15)+En.charAt(In&15),16);Qr.push(An)}return Qr}function wr(Jr){return(Jr+64>>>9<<4)+14+1}function Er(Jr,Qr){Jr[Qr>>5]|=128<>5]|=(Jr[En/8]&255)<>16)+(Qr>>16)+(_n>>16);return En<<16|_n&65535}function Br(Jr,Qr){return Jr<>>32-Qr}function Wr(Jr,Qr,_n,En,Cn,In){return jr(Br(jr(jr(Qr,Jr),jr(En,In)),Cn),_n)}function qr(Jr,Qr,_n,En,Cn,In,An){return Wr(Qr&_n|~Qr&En,Jr,Qr,Cn,In,An)}function Gr(Jr,Qr,_n,En,Cn,In,An){return Wr(Qr&En|_n&~En,Jr,Qr,Cn,In,An)}function Vr(Jr,Qr,_n,En,Cn,In,An){return Wr(Qr^_n^En,Jr,Qr,Cn,In,An)}function Zr(Jr,Qr,_n,En,Cn,In,An){return Wr(_n^(Qr|~En),Jr,Qr,Cn,In,An)}return md5$2.default=fr,md5$2}var hasRequiredV3;function requireV3(){if(hasRequiredV3)return v3$1;hasRequiredV3=1,Object.defineProperty(v3$1,"__esModule",{value:!0}),v3$1.default=void 0;var fr=wr(requireV35()),br=wr(requireMd5$1());function wr(kr){return kr&&kr.__esModule?kr:{default:kr}}var Er=(0,fr.default)("v3",48,br.default);return v3$1.default=Er,v3$1}var v4$1={},native={},hasRequiredNative;function requireNative(){if(hasRequiredNative)return native;hasRequiredNative=1,Object.defineProperty(native,"__esModule",{value:!0}),native.default=void 0;var fr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);return native.default={randomUUID:fr},native}var hasRequiredV4;function requireV4(){if(hasRequiredV4)return v4$1;hasRequiredV4=1,Object.defineProperty(v4$1,"__esModule",{value:!0}),v4$1.default=void 0;var fr=Er(requireNative()),br=Er(requireRng()),wr=requireStringify();function Er(jr){return jr&&jr.__esModule?jr:{default:jr}}function kr(jr,Br,Wr){if(fr.default.randomUUID&&!Br&&!jr)return fr.default.randomUUID();jr=jr||{};var qr=jr.random||(jr.rng||br.default)();if(qr[6]=qr[6]&15|64,qr[8]=qr[8]&63|128,Br){Wr=Wr||0;for(var Gr=0;Gr<16;++Gr)Br[Wr+Gr]=qr[Gr];return Br}return(0,wr.unsafeStringify)(qr)}return v4$1.default=kr,v4$1}var v5$1={},sha1$2={},hasRequiredSha1$1;function requireSha1$1(){if(hasRequiredSha1$1)return sha1$2;hasRequiredSha1$1=1,Object.defineProperty(sha1$2,"__esModule",{value:!0}),sha1$2.default=void 0;function fr(Er,kr,jr,Br){switch(Er){case 0:return kr&jr^~kr&Br;case 1:return kr^jr^Br;case 2:return kr&jr^kr&Br^jr&Br;case 3:return kr^jr^Br}}function br(Er,kr){return Er<>>32-kr}function wr(Er){var kr=[1518500249,1859775393,2400959708,3395469782],jr=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof Er=="string"){var Br=unescape(encodeURIComponent(Er));Er=[];for(var Wr=0;Wr>>0;to=ro,ro=eo,eo=br(jn,30)>>>0,jn=An,An=io}jr[0]=jr[0]+An>>>0,jr[1]=jr[1]+jn>>>0,jr[2]=jr[2]+eo>>>0,jr[3]=jr[3]+ro>>>0,jr[4]=jr[4]+to>>>0}return[jr[0]>>24&255,jr[0]>>16&255,jr[0]>>8&255,jr[0]&255,jr[1]>>24&255,jr[1]>>16&255,jr[1]>>8&255,jr[1]&255,jr[2]>>24&255,jr[2]>>16&255,jr[2]>>8&255,jr[2]&255,jr[3]>>24&255,jr[3]>>16&255,jr[3]>>8&255,jr[3]&255,jr[4]>>24&255,jr[4]>>16&255,jr[4]>>8&255,jr[4]&255]}return sha1$2.default=wr,sha1$2}var hasRequiredV5;function requireV5(){if(hasRequiredV5)return v5$1;hasRequiredV5=1,Object.defineProperty(v5$1,"__esModule",{value:!0}),v5$1.default=void 0;var fr=wr(requireV35()),br=wr(requireSha1$1());function wr(kr){return kr&&kr.__esModule?kr:{default:kr}}var Er=(0,fr.default)("v5",80,br.default);return v5$1.default=Er,v5$1}var v6={},hasRequiredV6;function requireV6(){if(hasRequiredV6)return v6;hasRequiredV6=1,Object.defineProperty(v6,"__esModule",{value:!0}),v6.default=Gr;var fr=requireStringify(),br=Er(requireV1()),wr=Er(requireV1ToV6());function Er(Vr){return Vr&&Vr.__esModule?Vr:{default:Vr}}function kr(Vr,Zr){var Jr=Object.keys(Vr);if(Object.getOwnPropertySymbols){var Qr=Object.getOwnPropertySymbols(Vr);Zr&&(Qr=Qr.filter(function(_n){return Object.getOwnPropertyDescriptor(Vr,_n).enumerable})),Jr.push.apply(Jr,Qr)}return Jr}function jr(Vr){for(var Zr=1;Zr>4&15,(jr[4]&15)<<4|(jr[5]&240)>>4,(jr[5]&15)<<4|jr[6]&15,jr[7],(jr[1]&15)<<4|(jr[2]&240)>>4,(jr[2]&15)<<4|(jr[3]&240)>>4,16|(jr[0]&240)>>4,(jr[0]&15)<<4|(jr[1]&240)>>4,jr[8],jr[9],jr[10],jr[11],jr[12],jr[13],jr[14],jr[15])}return v6ToV1}var v7={},hasRequiredV7;function requireV7(){if(hasRequiredV7)return v7;hasRequiredV7=1,Object.defineProperty(v7,"__esModule",{value:!0}),v7.default=void 0;var fr=wr(requireRng()),br=requireStringify();function wr(Wr){return Wr&&Wr.__esModule?Wr:{default:Wr}}var Er=null,kr=null,jr=0;function Br(Wr,qr,Gr){Wr=Wr||{};var Vr=qr&&Gr||0,Zr=qr||new Uint8Array(16),Jr=Wr.random||(Wr.rng||fr.default)(),Qr=Wr.msecs!==void 0?Wr.msecs:Date.now(),_n=Wr.seq!==void 0?Wr.seq:null,En=kr,Cn=Er;return Qr>jr&&Wr.msecs===void 0&&(jr=Qr,_n!==null&&(En=null,Cn=null)),_n!==null&&(_n>2147483647&&(_n=2147483647),En=_n>>>19&4095,Cn=_n&524287),(En===null||Cn===null)&&(En=Jr[6]&127,En=En<<8|Jr[7],Cn=Jr[8]&63,Cn=Cn<<8|Jr[9],Cn=Cn<<5|Jr[10]>>>3),Qr+1e4>jr&&_n===null?++Cn>524287&&(Cn=0,++En>4095&&(En=0,jr++)):jr=Qr,kr=En,Er=Cn,Zr[Vr++]=jr/1099511627776&255,Zr[Vr++]=jr/4294967296&255,Zr[Vr++]=jr/16777216&255,Zr[Vr++]=jr/65536&255,Zr[Vr++]=jr/256&255,Zr[Vr++]=jr&255,Zr[Vr++]=En>>>4&15|112,Zr[Vr++]=En&255,Zr[Vr++]=Cn>>>13&63|128,Zr[Vr++]=Cn>>>5&255,Zr[Vr++]=Cn<<3&255|Jr[10]&7,Zr[Vr++]=Jr[11],Zr[Vr++]=Jr[12],Zr[Vr++]=Jr[13],Zr[Vr++]=Jr[14],Zr[Vr++]=Jr[15],qr||(0,br.unsafeStringify)(Zr)}return v7.default=Br,v7}var version$f={},hasRequiredVersion;function requireVersion(){if(hasRequiredVersion)return version$f;hasRequiredVersion=1,Object.defineProperty(version$f,"__esModule",{value:!0}),version$f.default=void 0;var fr=br(requireValidate());function br(Er){return Er&&Er.__esModule?Er:{default:Er}}function wr(Er){if(!(0,fr.default)(Er))throw TypeError("Invalid UUID");return parseInt(Er.slice(14,15),16)}return version$f.default=wr,version$f}var hasRequiredCommonjsBrowser;function requireCommonjsBrowser(){return hasRequiredCommonjsBrowser||(hasRequiredCommonjsBrowser=1,function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),Object.defineProperty(fr,"MAX",{enumerable:!0,get:function(){return br.default}}),Object.defineProperty(fr,"NIL",{enumerable:!0,get:function(){return wr.default}}),Object.defineProperty(fr,"parse",{enumerable:!0,get:function(){return Er.default}}),Object.defineProperty(fr,"stringify",{enumerable:!0,get:function(){return kr.default}}),Object.defineProperty(fr,"v1",{enumerable:!0,get:function(){return jr.default}}),Object.defineProperty(fr,"v1ToV6",{enumerable:!0,get:function(){return Br.default}}),Object.defineProperty(fr,"v3",{enumerable:!0,get:function(){return Wr.default}}),Object.defineProperty(fr,"v4",{enumerable:!0,get:function(){return qr.default}}),Object.defineProperty(fr,"v5",{enumerable:!0,get:function(){return Gr.default}}),Object.defineProperty(fr,"v6",{enumerable:!0,get:function(){return Vr.default}}),Object.defineProperty(fr,"v6ToV1",{enumerable:!0,get:function(){return Zr.default}}),Object.defineProperty(fr,"v7",{enumerable:!0,get:function(){return Jr.default}}),Object.defineProperty(fr,"validate",{enumerable:!0,get:function(){return Qr.default}}),Object.defineProperty(fr,"version",{enumerable:!0,get:function(){return _n.default}});var br=En(requireMax()),wr=En(requireNil()),Er=En(requireParse()),kr=En(requireStringify()),jr=En(requireV1()),Br=En(requireV1ToV6()),Wr=En(requireV3()),qr=En(requireV4()),Gr=En(requireV5()),Vr=En(requireV6()),Zr=En(requireV6ToV1()),Jr=En(requireV7()),Qr=En(requireValidate()),_n=En(requireVersion());function En(Cn){return Cn&&Cn.__esModule?Cn:{default:Cn}}}(commonjsBrowser)),commonjsBrowser}const crypto$3=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function anumber$3(fr){if(!Number.isSafeInteger(fr)||fr<0)throw new Error("positive integer expected, got "+fr)}function isBytes$6(fr){return fr instanceof Uint8Array||ArrayBuffer.isView(fr)&&fr.constructor.name==="Uint8Array"}function abytes$2(fr,...br){if(!isBytes$6(fr))throw new Error("Uint8Array expected");if(br.length>0&&!br.includes(fr.length))throw new Error("Uint8Array expected of length "+br+", got length="+fr.length)}function ahash$1(fr){if(typeof fr!="function"||typeof fr.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");anumber$3(fr.outputLen),anumber$3(fr.blockLen)}function aexists$1(fr,br=!0){if(fr.destroyed)throw new Error("Hash instance has been destroyed");if(br&&fr.finished)throw new Error("Hash#digest() has already been called")}function aoutput$1(fr,br){abytes$2(fr);const wr=br.outputLen;if(fr.lengthnew Uint8Array(fr.buffer,fr.byteOffset,fr.byteLength),u32$1=fr=>new Uint32Array(fr.buffer,fr.byteOffset,Math.floor(fr.byteLength/4)),createView$1=fr=>new DataView(fr.buffer,fr.byteOffset,fr.byteLength),rotr$1=(fr,br)=>fr<<32-br|fr>>>br,rotl=(fr,br)=>fr<>>32-br>>>0,isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,byteSwap=fr=>fr<<24&4278190080|fr<<8&16711680|fr>>>8&65280|fr>>>24&255,byteSwapIfBE=isLE?fr=>fr:fr=>byteSwap(fr);function byteSwap32(fr){for(let br=0;brbr.toString(16).padStart(2,"0"));function bytesToHex$1(fr){abytes$2(fr);let br="";for(let wr=0;wr=asciis$1._0&&fr<=asciis$1._9)return fr-asciis$1._0;if(fr>=asciis$1.A&&fr<=asciis$1.F)return fr-(asciis$1.A-10);if(fr>=asciis$1.a&&fr<=asciis$1.f)return fr-(asciis$1.a-10)}function hexToBytes$1(fr){if(typeof fr!="string")throw new Error("hex string expected, got "+typeof fr);const br=fr.length,wr=br/2;if(br%2)throw new Error("hex string expected, got unpadded hex of length "+br);const Er=new Uint8Array(wr);for(let kr=0,jr=0;kr{};async function asyncLoop(fr,br,wr){let Er=Date.now();for(let kr=0;kr=0&&jrfr().update(toBytes$1(Er)).digest(),wr=fr();return br.outputLen=wr.outputLen,br.blockLen=wr.blockLen,br.create=()=>fr(),br}function wrapConstructorWithOpts(fr){const br=(Er,kr)=>fr(kr).update(toBytes$1(Er)).digest(),wr=fr({});return br.outputLen=wr.outputLen,br.blockLen=wr.blockLen,br.create=Er=>fr(Er),br}function wrapXOFConstructorWithOpts(fr){const br=(Er,kr)=>fr(kr).update(toBytes$1(Er)).digest(),wr=fr({});return br.outputLen=wr.outputLen,br.blockLen=wr.blockLen,br.create=Er=>fr(Er),br}function randomBytes$1(fr=32){if(crypto$3&&typeof crypto$3.getRandomValues=="function")return crypto$3.getRandomValues(new Uint8Array(fr));if(crypto$3&&typeof crypto$3.randomBytes=="function")return crypto$3.randomBytes(fr);throw new Error("crypto.getRandomValues must be defined")}const utils$8=Object.freeze(Object.defineProperty({__proto__:null,Hash:Hash$2,asyncLoop,byteSwap,byteSwap32,byteSwapIfBE,bytesToHex:bytesToHex$1,checkOpts,concatBytes:concatBytes$2,createView:createView$1,hexToBytes:hexToBytes$1,isBytes:isBytes$5,isLE,nextTick,randomBytes:randomBytes$1,rotl,rotr:rotr$1,toBytes:toBytes$1,u32:u32$1,u8:u8$1,utf8ToBytes:utf8ToBytes$2,wrapConstructor:wrapConstructor$1,wrapConstructorWithOpts,wrapXOFConstructorWithOpts},Symbol.toStringTag,{value:"Module"})),require$$0$a=getAugmentedNamespace(utils$8);var tx_types={},hasRequiredTx_types;function requireTx_types(){if(hasRequiredTx_types)return tx_types;hasRequiredTx_types=1,Object.defineProperty(tx_types,"__esModule",{value:!0}),tx_types.QuorumResult=tx_types.ResultMeta=tx_types.ReplyGrouped=tx_types.TxCategory=void 0;var fr;(function(kr){kr.INIT_DID="INIT_DID",kr.INIT_SESSION_KEY="INIT_SESSION_KEY"})(fr||(tx_types.TxCategory=fr={}));class br{constructor(){this.items=[],this.summary=new wr}}tx_types.ReplyGrouped=br;class wr{}tx_types.ResultMeta=wr;var Er;return function(kr){kr.QUORUM_OK="QUORUM_OK",kr.QUORUM_OK_PARTIAL="QUORUM_OK_PARTIAL",kr.QUORUM_FAILED_NODE_REPLIES="QUORUM_FAILED_NODE_REPLIES",kr.QUORUM_FAILED_BY_MIN_ITEMS="QUORUM_FAILED_BY_MIN_ITEMS"}(Er||(tx_types.QuorumResult=Er={})),tx_types}var init_did={},hasRequiredInit_did;function requireInit_did(){return hasRequiredInit_did||(hasRequiredInit_did=1,function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.InitDid_WalletToEncDerivedKeyEntry=fr.InitDid=fr.WalletToEncDerivedKey=fr.EncryptedText=fr.protobufPackage=void 0;const br=requireWire();fr.protobufPackage="push";function wr(){return{ciphertext:"",salt:"",nonce:"",version:"",preKey:""}}fr.EncryptedText={encode(Vr,Zr=new br.BinaryWriter){return Vr.ciphertext!==""&&Zr.uint32(10).string(Vr.ciphertext),Vr.salt!==""&&Zr.uint32(18).string(Vr.salt),Vr.nonce!==""&&Zr.uint32(26).string(Vr.nonce),Vr.version!==""&&Zr.uint32(34).string(Vr.version),Vr.preKey!==""&&Zr.uint32(42).string(Vr.preKey),Zr},decode(Vr,Zr){const Jr=Vr instanceof br.BinaryReader?Vr:new br.BinaryReader(Vr);let Qr=Zr===void 0?Jr.len:Jr.pos+Zr;const _n=wr();for(;Jr.pos>>3){case 1:{if(En!==10)break;_n.ciphertext=Jr.string();continue}case 2:{if(En!==18)break;_n.salt=Jr.string();continue}case 3:{if(En!==26)break;_n.nonce=Jr.string();continue}case 4:{if(En!==34)break;_n.version=Jr.string();continue}case 5:{if(En!==42)break;_n.preKey=Jr.string();continue}}if((En&7)===4||En===0)break;Jr.skip(En&7)}return _n},fromJSON(Vr){return{ciphertext:Gr(Vr.ciphertext)?globalThis.String(Vr.ciphertext):"",salt:Gr(Vr.salt)?globalThis.String(Vr.salt):"",nonce:Gr(Vr.nonce)?globalThis.String(Vr.nonce):"",version:Gr(Vr.version)?globalThis.String(Vr.version):"",preKey:Gr(Vr.preKey)?globalThis.String(Vr.preKey):""}},toJSON(Vr){const Zr={};return Vr.ciphertext!==""&&(Zr.ciphertext=Vr.ciphertext),Vr.salt!==""&&(Zr.salt=Vr.salt),Vr.nonce!==""&&(Zr.nonce=Vr.nonce),Vr.version!==""&&(Zr.version=Vr.version),Vr.preKey!==""&&(Zr.preKey=Vr.preKey),Zr},create(Vr){return fr.EncryptedText.fromPartial(Vr??{})},fromPartial(Vr){var Zr,Jr,Qr,_n,En;const Cn=wr();return Cn.ciphertext=(Zr=Vr.ciphertext)!==null&&Zr!==void 0?Zr:"",Cn.salt=(Jr=Vr.salt)!==null&&Jr!==void 0?Jr:"",Cn.nonce=(Qr=Vr.nonce)!==null&&Qr!==void 0?Qr:"",Cn.version=(_n=Vr.version)!==null&&_n!==void 0?_n:"",Cn.preKey=(En=Vr.preKey)!==null&&En!==void 0?En:"",Cn}};function Er(){return{encDerivedPrivKey:void 0,signature:new Uint8Array(0)}}fr.WalletToEncDerivedKey={encode(Vr,Zr=new br.BinaryWriter){return Vr.encDerivedPrivKey!==void 0&&fr.EncryptedText.encode(Vr.encDerivedPrivKey,Zr.uint32(10).fork()).join(),Vr.signature.length!==0&&Zr.uint32(18).bytes(Vr.signature),Zr},decode(Vr,Zr){const Jr=Vr instanceof br.BinaryReader?Vr:new br.BinaryReader(Vr);let Qr=Zr===void 0?Jr.len:Jr.pos+Zr;const _n=Er();for(;Jr.pos>>3){case 1:{if(En!==10)break;_n.encDerivedPrivKey=fr.EncryptedText.decode(Jr,Jr.uint32());continue}case 2:{if(En!==18)break;_n.signature=Jr.bytes();continue}}if((En&7)===4||En===0)break;Jr.skip(En&7)}return _n},fromJSON(Vr){return{encDerivedPrivKey:Gr(Vr.encDerivedPrivKey)?fr.EncryptedText.fromJSON(Vr.encDerivedPrivKey):void 0,signature:Gr(Vr.signature)?Br(Vr.signature):new Uint8Array(0)}},toJSON(Vr){const Zr={};return Vr.encDerivedPrivKey!==void 0&&(Zr.encDerivedPrivKey=fr.EncryptedText.toJSON(Vr.encDerivedPrivKey)),Vr.signature.length!==0&&(Zr.signature=Wr(Vr.signature)),Zr},create(Vr){return fr.WalletToEncDerivedKey.fromPartial(Vr??{})},fromPartial(Vr){var Zr;const Jr=Er();return Jr.encDerivedPrivKey=Vr.encDerivedPrivKey!==void 0&&Vr.encDerivedPrivKey!==null?fr.EncryptedText.fromPartial(Vr.encDerivedPrivKey):void 0,Jr.signature=(Zr=Vr.signature)!==null&&Zr!==void 0?Zr:new Uint8Array(0),Jr}};function kr(){return{masterPubKey:"",derivedKeyIndex:0,derivedPubKey:"",walletToEncDerivedKey:{}}}fr.InitDid={encode(Vr,Zr=new br.BinaryWriter){return Vr.masterPubKey!==""&&Zr.uint32(10).string(Vr.masterPubKey),Vr.derivedKeyIndex!==0&&Zr.uint32(16).uint32(Vr.derivedKeyIndex),Vr.derivedPubKey!==""&&Zr.uint32(26).string(Vr.derivedPubKey),Object.entries(Vr.walletToEncDerivedKey).forEach(([Jr,Qr])=>{fr.InitDid_WalletToEncDerivedKeyEntry.encode({key:Jr,value:Qr},Zr.uint32(34).fork()).join()}),Zr},decode(Vr,Zr){const Jr=Vr instanceof br.BinaryReader?Vr:new br.BinaryReader(Vr);let Qr=Zr===void 0?Jr.len:Jr.pos+Zr;const _n=kr();for(;Jr.pos>>3){case 1:{if(En!==10)break;_n.masterPubKey=Jr.string();continue}case 2:{if(En!==16)break;_n.derivedKeyIndex=Jr.uint32();continue}case 3:{if(En!==26)break;_n.derivedPubKey=Jr.string();continue}case 4:{if(En!==34)break;const Cn=fr.InitDid_WalletToEncDerivedKeyEntry.decode(Jr,Jr.uint32());Cn.value!==void 0&&(_n.walletToEncDerivedKey[Cn.key]=Cn.value);continue}}if((En&7)===4||En===0)break;Jr.skip(En&7)}return _n},fromJSON(Vr){return{masterPubKey:Gr(Vr.masterPubKey)?globalThis.String(Vr.masterPubKey):"",derivedKeyIndex:Gr(Vr.derivedKeyIndex)?globalThis.Number(Vr.derivedKeyIndex):0,derivedPubKey:Gr(Vr.derivedPubKey)?globalThis.String(Vr.derivedPubKey):"",walletToEncDerivedKey:qr(Vr.walletToEncDerivedKey)?Object.entries(Vr.walletToEncDerivedKey).reduce((Zr,[Jr,Qr])=>(Zr[Jr]=fr.WalletToEncDerivedKey.fromJSON(Qr),Zr),{}):{}}},toJSON(Vr){const Zr={};if(Vr.masterPubKey!==""&&(Zr.masterPubKey=Vr.masterPubKey),Vr.derivedKeyIndex!==0&&(Zr.derivedKeyIndex=Math.round(Vr.derivedKeyIndex)),Vr.derivedPubKey!==""&&(Zr.derivedPubKey=Vr.derivedPubKey),Vr.walletToEncDerivedKey){const Jr=Object.entries(Vr.walletToEncDerivedKey);Jr.length>0&&(Zr.walletToEncDerivedKey={},Jr.forEach(([Qr,_n])=>{Zr.walletToEncDerivedKey[Qr]=fr.WalletToEncDerivedKey.toJSON(_n)}))}return Zr},create(Vr){return fr.InitDid.fromPartial(Vr??{})},fromPartial(Vr){var Zr,Jr,Qr,_n;const En=kr();return En.masterPubKey=(Zr=Vr.masterPubKey)!==null&&Zr!==void 0?Zr:"",En.derivedKeyIndex=(Jr=Vr.derivedKeyIndex)!==null&&Jr!==void 0?Jr:0,En.derivedPubKey=(Qr=Vr.derivedPubKey)!==null&&Qr!==void 0?Qr:"",En.walletToEncDerivedKey=Object.entries((_n=Vr.walletToEncDerivedKey)!==null&&_n!==void 0?_n:{}).reduce((Cn,[In,An])=>(An!==void 0&&(Cn[In]=fr.WalletToEncDerivedKey.fromPartial(An)),Cn),{}),En}};function jr(){return{key:"",value:void 0}}fr.InitDid_WalletToEncDerivedKeyEntry={encode(Vr,Zr=new br.BinaryWriter){return Vr.key!==""&&Zr.uint32(10).string(Vr.key),Vr.value!==void 0&&fr.WalletToEncDerivedKey.encode(Vr.value,Zr.uint32(18).fork()).join(),Zr},decode(Vr,Zr){const Jr=Vr instanceof br.BinaryReader?Vr:new br.BinaryReader(Vr);let Qr=Zr===void 0?Jr.len:Jr.pos+Zr;const _n=jr();for(;Jr.pos>>3){case 1:{if(En!==10)break;_n.key=Jr.string();continue}case 2:{if(En!==18)break;_n.value=fr.WalletToEncDerivedKey.decode(Jr,Jr.uint32());continue}}if((En&7)===4||En===0)break;Jr.skip(En&7)}return _n},fromJSON(Vr){return{key:Gr(Vr.key)?globalThis.String(Vr.key):"",value:Gr(Vr.value)?fr.WalletToEncDerivedKey.fromJSON(Vr.value):void 0}},toJSON(Vr){const Zr={};return Vr.key!==""&&(Zr.key=Vr.key),Vr.value!==void 0&&(Zr.value=fr.WalletToEncDerivedKey.toJSON(Vr.value)),Zr},create(Vr){return fr.InitDid_WalletToEncDerivedKeyEntry.fromPartial(Vr??{})},fromPartial(Vr){var Zr;const Jr=jr();return Jr.key=(Zr=Vr.key)!==null&&Zr!==void 0?Zr:"",Jr.value=Vr.value!==void 0&&Vr.value!==null?fr.WalletToEncDerivedKey.fromPartial(Vr.value):void 0,Jr}};function Br(Vr){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(Vr,"base64"));{const Zr=globalThis.atob(Vr),Jr=new Uint8Array(Zr.length);for(let Qr=0;Qr{Zr.push(globalThis.String.fromCharCode(Jr))}),globalThis.btoa(Zr.join(""))}}function qr(Vr){return typeof Vr=="object"&&Vr!==null}function Gr(Vr){return Vr!=null}}(init_did)),init_did}var init_session_key={},hasRequiredInit_session_key;function requireInit_session_key(){return hasRequiredInit_session_key||(hasRequiredInit_session_key=1,function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.InitSessionKey=fr.KeyAction=fr.protobufPackage=void 0,fr.keyActionFromJSON=Er,fr.keyActionToJSON=kr;const br=requireWire();fr.protobufPackage="push";var wr;(function(Wr){Wr[Wr.PUBLISH_KEY=0]="PUBLISH_KEY",Wr[Wr.REVOKE_KEY=1]="REVOKE_KEY",Wr[Wr.UNRECOGNIZED=-1]="UNRECOGNIZED"})(wr||(fr.KeyAction=wr={}));function Er(Wr){switch(Wr){case 0:case"PUBLISH_KEY":return wr.PUBLISH_KEY;case 1:case"REVOKE_KEY":return wr.REVOKE_KEY;case-1:case"UNRECOGNIZED":default:return wr.UNRECOGNIZED}}function kr(Wr){switch(Wr){case wr.PUBLISH_KEY:return"PUBLISH_KEY";case wr.REVOKE_KEY:return"REVOKE_KEY";case wr.UNRECOGNIZED:default:return"UNRECOGNIZED"}}function jr(){return{keyIndex:0,keyAddress:"",action:0}}fr.InitSessionKey={encode(Wr,qr=new br.BinaryWriter){return Wr.keyIndex!==0&&qr.uint32(8).int32(Wr.keyIndex),Wr.keyAddress!==""&&qr.uint32(18).string(Wr.keyAddress),Wr.action!==0&&qr.uint32(24).int32(Wr.action),qr},decode(Wr,qr){const Gr=Wr instanceof br.BinaryReader?Wr:new br.BinaryReader(Wr);let Vr=qr===void 0?Gr.len:Gr.pos+qr;const Zr=jr();for(;Gr.pos>>3){case 1:{if(Jr!==8)break;Zr.keyIndex=Gr.int32();continue}case 2:{if(Jr!==18)break;Zr.keyAddress=Gr.string();continue}case 3:{if(Jr!==24)break;Zr.action=Gr.int32();continue}}if((Jr&7)===4||Jr===0)break;Gr.skip(Jr&7)}return Zr},fromJSON(Wr){return{keyIndex:Br(Wr.keyIndex)?globalThis.Number(Wr.keyIndex):0,keyAddress:Br(Wr.keyAddress)?globalThis.String(Wr.keyAddress):"",action:Br(Wr.action)?Er(Wr.action):0}},toJSON(Wr){const qr={};return Wr.keyIndex!==0&&(qr.keyIndex=Math.round(Wr.keyIndex)),Wr.keyAddress!==""&&(qr.keyAddress=Wr.keyAddress),Wr.action!==0&&(qr.action=kr(Wr.action)),qr},create(Wr){return fr.InitSessionKey.fromPartial(Wr??{})},fromPartial(Wr){var qr,Gr,Vr;const Zr=jr();return Zr.keyIndex=(qr=Wr.keyIndex)!==null&&qr!==void 0?qr:0,Zr.keyAddress=(Gr=Wr.keyAddress)!==null&&Gr!==void 0?Gr:"",Zr.action=(Vr=Wr.action)!==null&&Vr!==void 0?Vr:0,Zr}};function Br(Wr){return Wr!=null}}(init_session_key)),init_session_key}function setBigUint64$1(fr,br,wr,Er){if(typeof fr.setBigUint64=="function")return fr.setBigUint64(br,wr,Er);const kr=BigInt(32),jr=BigInt(4294967295),Br=Number(wr>>kr&jr),Wr=Number(wr&jr),qr=Er?4:0,Gr=Er?0:4;fr.setUint32(br+qr,Br,Er),fr.setUint32(br+Gr,Wr,Er)}const Chi$1=(fr,br,wr)=>fr&br^~fr&wr,Maj$1=(fr,br,wr)=>fr&br^fr&wr^br≀let HashMD$1=class extends Hash$2{constructor(br,wr,Er,kr){super(),this.blockLen=br,this.outputLen=wr,this.padOffset=Er,this.isLE=kr,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(br),this.view=createView$1(this.buffer)}update(br){aexists$1(this);const{view:wr,buffer:Er,blockLen:kr}=this;br=toBytes$1(br);const jr=br.length;for(let Br=0;Brkr-Br&&(this.process(Er,0),Br=0);for(let Zr=Br;ZrVr.length)throw new Error("_sha2: outputLen bigger than state");for(let Zr=0;Zr>>3,En=rotr$1(Qr,17)^rotr$1(Qr,19)^Qr>>>10;SHA256_W$1[Zr]=En+SHA256_W$1[Zr-7]+_n+SHA256_W$1[Zr-16]|0}let{A:Er,B:kr,C:jr,D:Br,E:Wr,F:qr,G:Gr,H:Vr}=this;for(let Zr=0;Zr<64;Zr++){const Jr=rotr$1(Wr,6)^rotr$1(Wr,11)^rotr$1(Wr,25),Qr=Vr+Jr+Chi$1(Wr,qr,Gr)+SHA256_K$1[Zr]+SHA256_W$1[Zr]|0,En=(rotr$1(Er,2)^rotr$1(Er,13)^rotr$1(Er,22))+Maj$1(Er,kr,jr)|0;Vr=Gr,Gr=qr,qr=Wr,Wr=Br+Qr|0,Br=jr,jr=kr,kr=Er,Er=Qr+En|0}Er=Er+this.A|0,kr=kr+this.B|0,jr=jr+this.C|0,Br=Br+this.D|0,Wr=Wr+this.E|0,qr=qr+this.F|0,Gr=Gr+this.G|0,Vr=Vr+this.H|0,this.set(Er,kr,jr,Br,Wr,qr,Gr,Vr)}roundClean(){SHA256_W$1.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};class SHA224 extends SHA256$1{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const sha256$4=wrapConstructor$1(()=>new SHA256$1),sha224$2=wrapConstructor$1(()=>new SHA224),sha256$5=Object.freeze(Object.defineProperty({__proto__:null,SHA256:SHA256$1,sha224:sha224$2,sha256:sha256$4},Symbol.toStringTag,{value:"Module"})),require$$8=getAugmentedNamespace(sha256$5);var hasRequiredTx;function requireTx(){if(hasRequiredTx)return tx;hasRequiredTx=1;var fr;Object.defineProperty(tx,"__esModule",{value:!0}),tx.Tx=void 0;const br=require$$0$b,wr=requireCommonjsBrowser(),Er=require$$0$a,kr=requireTx_types(),jr=requireTx$1(),Br=requireInit_did(),Wr=requireInit_session_key(),qr=requireValidator(),Gr=require$$8,Vr=require$$1$4;class Zr{constructor(Qr,_n){this.validator=Qr,this.env=_n,this.createUnsigned=(En,Cn,In)=>jr.Transaction.create({type:0,category:En,recipients:Cn,data:In,salt:(0,wr.parse)((0,wr.v4)()),fee:"0"}),this.get=(...En)=>br.__awaiter(this,[...En],void 0,function*(Cn=Math.floor(Date.now()),In="DESC",An=30,jn=1,eo,ro){return eo===void 0?yield this.validator.call("push_getTransactions",[Cn,In,An,jn,ro]):yield this.validator.call("push_getTransactionsByUser",[eo,Cn,In,An,jn,ro])}),this.getBySender=(En,...Cn)=>br.__awaiter(this,[En,...Cn],void 0,function*(In,An=Math.floor(Date.now()/1e3),jn="ASC",eo=30,ro=1,to){return yield this.validator.call("push_getTransactionsBySender",[In,An,jn,eo,ro,to])}),this.getByRecipient=(En,...Cn)=>br.__awaiter(this,[En,...Cn],void 0,function*(In,An=Math.floor(Date.now()/1e3),jn="ASC",eo=30,ro=1,to){return yield this.validator.call("push_getTransactionsByRecipient",[In,An,jn,eo,ro,to])}),this.search=En=>br.__awaiter(this,void 0,void 0,function*(){return yield this.validator.call("push_getTransactionByHash",[En])}),this.send=(En,Cn)=>br.__awaiter(this,void 0,void 0,function*(){const In=yield this.validator.call("push_getApiToken"),An=fr.serialize(Object.assign(Object.assign({},En),{sender:Cn.account,signature:new Uint8Array(0),apiToken:(0,Er.utf8ToBytes)(In.apiToken)})),jn=new TextEncoder().encode((0,Vr.toHex)((0,Gr.sha256)(An))),eo=yield Cn.signMessage(jn),ro=fr.serialize(Object.assign(Object.assign({},fr.deserialize(An)),{signature:eo}));return yield this.validator.call("push_sendTransaction",[(0,Er.bytesToHex)(ro)],In.apiUrl)})}getTransactionsFromVNode(Qr,_n){return br.__awaiter(this,arguments,void 0,function*(En,Cn,In=""+Math.floor(Date.now()/1e3),An="DESC"){return yield this.validator.callVNode("push_getTransactions",[En,Cn,In,An])})}}return tx.Tx=Zr,fr=Zr,Zr.initialize=Jr=>br.__awaiter(void 0,void 0,void 0,function*(){const Qr=yield qr.Validator.initalize({env:Jr});return new fr(Qr,Jr)}),Zr.serialize=Jr=>{const Qr=jr.Transaction.create(Jr);return jr.Transaction.encode(Qr).finish()},Zr.deserialize=Jr=>jr.Transaction.decode(Jr),Zr.serializeData=(Jr,Qr)=>{switch(Qr){case kr.TxCategory.INIT_DID:{const _n=Jr,En=Br.InitDid.create(_n);return Br.InitDid.encode(En).finish()}case kr.TxCategory.INIT_SESSION_KEY:{const _n=Jr,En=Wr.InitSessionKey.create(_n);return Wr.InitSessionKey.encode(En).finish()}default:throw new Error("Serialization Not Supported for given TxCateory")}},Zr.deserializeData=(Jr,Qr)=>{switch(Qr){case kr.TxCategory.INIT_DID:return Br.InitDid.decode(Jr);case kr.TxCategory.INIT_SESSION_KEY:return Wr.InitSessionKey.decode(Jr);default:throw new Error("Deserialization Not Supported for given TxCateory")}},tx}var wallet={},wallet_types={},hasRequiredWallet_types;function requireWallet_types(){if(hasRequiredWallet_types)return wallet_types;hasRequiredWallet_types=1,Object.defineProperty(wallet_types,"__esModule",{value:!0}),wallet_types.ACTION=void 0;var fr;return function(br){br.IS_CONNECTED="isConnected",br.REQ_TO_CONNECT="reqToConnect",br.REQ_TO_SIGN="reqToSign",br.REQ_WALLET_DETAILS="reqWalletDetails",br.ERROR="error",br.CONNECTION_STATUS="connectionStatus",br.WALLET_DETAILS="walletDetails",br.SIGNATURE="signature"}(fr||(wallet_types.ACTION=fr={})),wallet_types}var hasRequiredWallet;function requireWallet(){if(hasRequiredWallet)return wallet;hasRequiredWallet=1,Object.defineProperty(wallet,"__esModule",{value:!0}),wallet.Wallet=void 0;const fr=require$$0$b,br=requireConfig(),wr=requireWallet_types();class Er{constructor(jr){this.env=jr,this.walletWindow=null,this.connect=()=>fr.__awaiter(this,void 0,void 0,function*(){return yield this.openWalletWindow(),yield this.requestWalletAddress()}),this.sign=Br=>fr.__awaiter(this,void 0,void 0,function*(){yield this.openWalletWindow();const{isPending:Wr,isConnected:qr}=yield this.appConnectionStatus();if(!qr)throw Wr?Error("App Connection Request is Pending. Accept App Connection Request in Push Wallet to enable signing !!!"):(yield this.requestAppConnection(),Error("App not Connected. Accept App Connection Request in Push Wallet to enable signing !!!"));return new Promise((Gr,Vr)=>{window.addEventListener("message",function Zr(Jr){Jr.data.action===wr.ACTION.SIGNATURE?(window.removeEventListener("message",Zr),Gr(Jr.data.signature)):Jr.data.action===wr.ACTION.ERROR&&(window.removeEventListener("message",Zr),Vr(Jr.data.error))}),this.walletWindow.postMessage({action:wr.ACTION.REQ_TO_SIGN,data:Br},br.default.WALLET_URL[this.env])})}),this.appConnectionStatus=()=>new Promise((Br,Wr)=>{var qr;window.addEventListener("message",function Gr(Vr){Vr.data.action===wr.ACTION.CONNECTION_STATUS?(window.removeEventListener("message",Gr),Br(Vr.data)):Vr.data.action===wr.ACTION.ERROR&&(window.removeEventListener("message",Gr),Wr(Vr.data.error))}),(qr=this.walletWindow)===null||qr===void 0||qr.postMessage({action:wr.ACTION.IS_CONNECTED},br.default.WALLET_URL[this.env])}),this.requestAppConnection=()=>new Promise((Br,Wr)=>{var qr;window.addEventListener("message",function Gr(Vr){Vr.data.action===wr.ACTION.CONNECTION_STATUS?(window.removeEventListener("message",Gr),Br(Vr.data)):Vr.data.action===wr.ACTION.ERROR&&(window.removeEventListener("message",Gr),Wr(Vr.data.error))}),(qr=this.walletWindow)===null||qr===void 0||qr.postMessage({action:wr.ACTION.REQ_TO_CONNECT},br.default.WALLET_URL[this.env])}),this.openWalletWindow=()=>fr.__awaiter(this,void 0,void 0,function*(){if(!this.walletWindow||this.walletWindow.closed){if(this.walletWindow=window.open(br.default.WALLET_URL[this.env],"_blank"),!this.walletWindow)throw new Error("Failed to open wallet window");yield new Promise(Br=>setTimeout(Br,2e3))}}),this.requestWalletAddress=()=>new Promise((Br,Wr)=>{var qr;window.addEventListener("message",function Gr(Vr){Vr.data.action===wr.ACTION.WALLET_DETAILS?(window.removeEventListener("message",Gr),Br(Vr.data.address)):Vr.data.action===wr.ACTION.ERROR&&(window.removeEventListener("message",Gr),Wr(Vr.data.error))}),(qr=this.walletWindow)===null||qr===void 0||qr.postMessage({action:wr.ACTION.REQ_WALLET_DETAILS},br.default.WALLET_URL[this.env])})}}return wallet.Wallet=Er,wallet}var hasRequiredPushNetwork;function requirePushNetwork(){if(hasRequiredPushNetwork)return pushNetwork;hasRequiredPushNetwork=1;var fr;Object.defineProperty(pushNetwork,"__esModule",{value:!0}),pushNetwork.PushNetwork=void 0;const br=require$$0$b,wr=requireBlock(),Er=requireConstants$3(),kr=requireTx(),jr=requireWallet();class Br{constructor(qr,Gr,Vr){this.block=qr,this.tx=Gr,this.wallet=Vr}}return pushNetwork.PushNetwork=Br,fr=Br,Br.initialize=(...Wr)=>br.__awaiter(void 0,[...Wr],void 0,function*(qr=Er.ENV.STAGING){const Gr=yield wr.Block.initialize(qr),Vr=yield kr.Tx.initialize(qr),Zr=new jr.Wallet(qr);return new fr(Gr,Vr,Zr)}),pushNetwork}var address={},dist$1={},hasRequiredDist;function requireDist(){if(hasRequiredDist)return dist$1;hasRequiredDist=1,Object.defineProperty(dist$1,"__esModule",{value:!0}),dist$1.bech32m=dist$1.bech32=void 0;const fr="qpzry9x8gf2tvdw0s3jn54khce6mua7l",br={};for(let Gr=0;Gr>25;return(Gr&33554431)<<5^-(Vr>>0&1)&996825010^-(Vr>>1&1)&642813549^-(Vr>>2&1)&513874426^-(Vr>>3&1)&1027748829^-(Vr>>4&1)&705979059}function Er(Gr){let Vr=1;for(let Zr=0;Zr126)return"Invalid prefix ("+Gr+")";Vr=wr(Vr)^Jr>>5}Vr=wr(Vr);for(let Zr=0;Zr=Zr;)_n-=Zr,Cn.push(Qr>>_n&En);if(Jr)_n>0&&Cn.push(Qr<=Vr)return"Excess padding";if(Qr<In)throw new TypeError("Exceeds length limit");En=En.toLowerCase();let An=Er(En);if(typeof An=="string")throw new Error(An);let jn=En+"1";for(let eo=0;eo>5)throw new Error("Non 5-bit word");An=wr(An)^ro,jn+=fr.charAt(ro)}for(let eo=0;eo<6;++eo)An=wr(An);An^=Vr;for(let eo=0;eo<6;++eo){const ro=An>>(5-eo)*5&31;jn+=fr.charAt(ro)}return jn}function Jr(En,Cn){if(Cn=Cn||90,En.length<8)return En+" too short";if(En.length>Cn)return"Exceeds length limit";const In=En.toLowerCase(),An=En.toUpperCase();if(En!==In&&En!==An)return"Mixed-case string "+En;En=In;const jn=En.lastIndexOf("1");if(jn===-1)return"No separator character for "+En;if(jn===0)return"Missing prefix for "+En;const eo=En.slice(0,jn),ro=En.slice(jn+1);if(ro.length<6)return"Data too short";let to=Er(eo);if(typeof to=="string")return to;const _i=[];for(let oo=0;oo=ro.length)&&_i.push(co)}return to!==Vr?"Invalid checksum for "+En:{prefix:eo,words:_i}}function Qr(En,Cn){const In=Jr(En,Cn);if(typeof In=="object")return In}function _n(En,Cn){const In=Jr(En,Cn);if(typeof In=="object")return In;throw new Error(In)}return{decodeUnsafe:Qr,decode:_n,encode:Zr,toWords:jr,fromWordsUnsafe:Br,fromWords:Wr}}return dist$1.bech32=qr("bech32"),dist$1.bech32m=qr("bech32m"),dist$1}var address_types={},hasRequiredAddress_types;function requireAddress_types(){if(hasRequiredAddress_types)return address_types;hasRequiredAddress_types=1,Object.defineProperty(address_types,"__esModule",{value:!0}),address_types.PUSH_NETWORK=void 0;var fr;return function(br){br.DEVNET="devnet",br.TESTNET="testnet",br.MAINNET="mainnet"}(fr||(address_types.PUSH_NETWORK=fr={})),address_types}var hasRequiredAddress;function requireAddress(){if(hasRequiredAddress)return address;hasRequiredAddress=1,Object.defineProperty(address,"__esModule",{value:!0}),address.Address=void 0;const fr=require$$0$a,br=require$$1$4,wr=requireDist(),Er=requireConstants$3(),kr=requireAddress_types(),jr="push";class Br{}return address.Address=Br,Br.evmToPush=(Wr,qr=jr)=>{try{const Gr=wr.bech32m.toWords((0,fr.hexToBytes)((0,br.getAddress)(Wr).slice(2)));return wr.bech32m.encode(qr,Gr)}catch{throw new Error("Invalid EVM address")}},Br.pushToEvm=Wr=>{try{const qr=wr.bech32m.decode(Wr),Gr=new Uint8Array(wr.bech32m.fromWords(qr.words));return(0,br.getAddress)(`0x${(0,fr.bytesToHex)(Gr)}`)}catch{throw new Error("Invalid Push address")}},Br.toPushCAIP=(Wr,qr=Er.ENV.STAGING)=>{let Gr;switch(qr){case Er.ENV.LOCAL:case Er.ENV.DEV:{Gr=kr.PUSH_NETWORK.DEVNET;break}case Er.ENV.STAGING:{Gr=kr.PUSH_NETWORK.TESTNET;break}case Er.ENV.PROD:{Gr=kr.PUSH_NETWORK.MAINNET;break}default:throw Error("Invalid ENV")}const Vr=Wr.startsWith(jr)?Wr:Br.evmToPush(Wr);return`push:${Gr}:${Vr}`},Br.toCAIP=(Wr,qr)=>{const Gr=Wr.startsWith(jr)?"push":Wr.startsWith("0x")?"eip155":"solana";if(Gr==="eip155"&&typeof qr!="number")throw new Error("Invalid network for EIP155 address");if((Gr==="push"||Gr==="solana")&&typeof qr=="number")throw new Error(`Invalid network for ${Gr} address`);const Zr={mainnet:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",devnet:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1",testnet:"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"}[qr];return Gr==="solana"?`${Gr}:${Zr}:${Wr}`:`${Gr}:${qr}:${Wr}`},address}var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.PushNetwork=fr.Address=fr.Validator=fr.Tx=fr.Block=fr.CONSTANTS=void 0;const br=requirePushNetwork();Object.defineProperty(fr,"PushNetwork",{enumerable:!0,get:function(){return br.PushNetwork}});const wr=requireBlock();Object.defineProperty(fr,"Block",{enumerable:!0,get:function(){return wr.Block}});const Er=requireTx();Object.defineProperty(fr,"Tx",{enumerable:!0,get:function(){return Er.Tx}});const kr=requireValidator();Object.defineProperty(fr,"Validator",{enumerable:!0,get:function(){return kr.Validator}});const jr=requireAddress();Object.defineProperty(fr,"Address",{enumerable:!0,get:function(){return jr.Address}});const Br=requireConstants$3();Object.defineProperty(fr,"CONSTANTS",{enumerable:!0,get:function(){return Br.CONSTANTS}})}(lib$1)),lib$1}(function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),require$$0$b.__exportStar(requireLib(),fr)})(src$5);const config$5={},config$4={APP_NAME:"Push Local Wallet",NODE_ENV:"local",APP_ENV:"local",ALLOWED_NETWORKS:[11155111,80002,97,11155420,2442,421614,123,111557560],DEFAULT_CHAIN:11155111},config$3={APP_NAME:"Push Devnet Wallet",NODE_ENV:"dev",APP_ENV:"dev",ALLOWED_NETWORKS:[11155111,80002,97,11155420,2442,421614,123,111557560],DEFAULT_CHAIN:11155111},config$2={APP_NAME:"Push Testnet Wallet",NODE_ENV:"staging",APP_ENV:"staging",ALLOWED_NETWORKS:[11155111,80002,97,11155420,2442,421614,123,111557560],DEFAULT_CHAIN:11155111},config$1={APP_NAME:"Push Wallet",NODE_ENV:"prod",APP_ENV:"prod",ALLOWED_NETWORKS:[1,137,56,10,42161,1101,122,7560],DEFAULT_CHAIN:1},env$1="dev";let dynamicConfig;switch(env$1){case ENV.LOCAL:{dynamicConfig=config$4;break}case ENV.DEV:{dynamicConfig=config$3;break}case ENV.STAGING:{dynamicConfig=config$2;break}case ENV.PROD:{dynamicConfig=config$1;break}default:dynamicConfig=config$2}const config={...dynamicConfig,...config$5},getWalletlist=(fr,br)=>{const wr=[];return fr!=null&&fr.length&&(fr==null||fr.forEach((Er,kr)=>{let jr={};Er.includes("push")?jr={name:"Push Account",address:Er,fullAddress:Er,isSelected:!1,type:"push"}:jr={name:`Account ${kr+1}`,address:Er.split(":")[2],fullAddress:Er,isSelected:!1,type:"metamask"},wr.push(jr)})),wr.reverse(),wr};function formatWalletCategory(fr){const br=fr.match(/^CUSTOM:(.+)$/);if(br&&br[1]){let Er=br[1].toLowerCase().replace(/_/g," ").replace(/\b\w/g,kr=>kr.toUpperCase());return Er.length>15&&(Er=Er.slice(0,15).trim()+"..."),Er}}const getFixedTime=fr=>{const br=Date.now(),wr=Math.floor((br-fr)/1e3);if(wr<60)return`${wr}s ago`;const Er=Math.floor(wr/60);if(Er<60)return`${Er}m ago`;const kr=Math.floor(Er/60);if(kr<24)return`${kr}h ago`;const jr=Math.floor(kr/24);if(jr<7)return`${jr}d ago`;const Br=Math.floor(jr/7);if(Br<4)return`${Br}w ago`;const Wr=Math.floor(Br/4);return Wr<12?`${Wr}m ago`:`${Math.floor(Wr/12)}y ago`},convertCaipToObject=fr=>{if(!fr||typeof fr!="string")return{result:{chain:null,chainId:null,address:null}};const br=fr.split(":");return br.length===3?{result:{chain:br[0],chainId:br[1],address:br[2]}}:br.length===2?{result:{chain:br[0],chainId:null,address:br[1]}}:{result:{chain:null,chainId:null,address:fr}}},WalletActivityListItem=({transaction:fr,address:br})=>{function wr(kr){if(kr==="devnet")return jsxRuntimeExports.jsx(PushMonotone,{size:20});const jr=CHAIN_LOGO[1];return jr?jsxRuntimeExports.jsx(jr,{size:20,color:"icon-tertiary"}):jsxRuntimeExports.jsx(DefaultChainMonotone,{size:20})}function Er(kr){let jr="",Br=0;if(br===kr.sender){const qr=kr.recipients.recipients;jr=qr[0].address,Br=qr.length-1}else kr.recipients.recipients.some(qr=>qr.address===br)&&(jr=kr.sender);const{result:Wr}=convertCaipToObject(jr);return jsxRuntimeExports.jsxs(Box,{display:"flex",gap:"spacing-xxs",alignItems:"center",children:[jsxRuntimeExports.jsx(Box,{height:"16px",width:"16px",backgroundColor:"surface-tertiary",borderRadius:"radius-xxxs",display:"flex",alignItems:"center",justifyContent:"center",children:jsxRuntimeExports.jsx(Text,{color:"text-tertiary",variant:"os-bold",css:Ae$2` +`:case"\r":case" ":case" ":continue;default:throw Error("invalid base64 string")}switch(Jr){case 0:_n=Qr,Jr=1;break;case 1:Vr[Zr++]=_n<<2|(Qr&48)>>4,_n=Qr,Jr=2;break;case 2:Vr[Zr++]=(_n&15)<<4|(Qr&60)>>2,_n=Qr,Jr=3;break;case 3:Vr[Zr++]=(_n&3)<<6|Qr,Jr=0;break}}if(Jr==1)throw Error("invalid base64 string");return Vr.subarray(0,Zr)}function br(Wr,qr="std"){const Gr=jr(qr),Vr=qr=="std";let Zr="",Jr=0,Qr,_n=0;for(let En=0;En>2],_n=(Qr&3)<<4,Jr=1;break;case 1:Zr+=Gr[_n|Qr>>4],_n=(Qr&15)<<2,Jr=2;break;case 2:Zr+=Gr[_n|Qr>>6],Zr+=Gr[Qr&63],Jr=0;break}return Jr&&(Zr+=Gr[_n],Vr&&(Zr+="=",Jr==1&&(Zr+="="))),Zr}let wr,Er,kr;function jr(Wr){return wr||(wr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Er=wr.slice(0,-2).concat("-","_")),Wr=="url"?Er:wr}function Br(){if(!kr){kr=[];const Wr=jr("std");for(let qr=0;qrqr.name===Br);if(!Wr)throw new Error(`cannot parse ${jr} default value: ${Br}`);return Wr.number}function Er(jr,Br){switch(jr){case fr.ScalarType.STRING:return Br;case fr.ScalarType.BYTES:{const Wr=kr(Br);if(Wr===!1)throw new Error(`cannot parse ${fr.ScalarType[jr]} default value: ${Br}`);return Wr}case fr.ScalarType.INT64:case fr.ScalarType.SFIXED64:case fr.ScalarType.SINT64:return br.protoInt64.parse(Br);case fr.ScalarType.UINT64:case fr.ScalarType.FIXED64:return br.protoInt64.uParse(Br);case fr.ScalarType.DOUBLE:case fr.ScalarType.FLOAT:switch(Br){case"inf":return Number.POSITIVE_INFINITY;case"-inf":return Number.NEGATIVE_INFINITY;case"nan":return Number.NaN;default:return parseFloat(Br)}case fr.ScalarType.BOOL:return Br==="true";case fr.ScalarType.INT32:case fr.ScalarType.UINT32:case fr.ScalarType.SINT32:case fr.ScalarType.FIXED32:case fr.ScalarType.SFIXED32:return parseInt(Br,10)}}function kr(jr){const Br=[],Wr={tail:jr,c:"",next(){return this.tail.length==0?!1:(this.c=this.tail[0],this.tail=this.tail.substring(1),!0)},take(qr){if(this.tail.length>=qr){const Gr=this.tail.substring(0,qr);return this.tail=this.tail.substring(qr),Gr}return!1}};for(;Wr.next();)switch(Wr.c){case"\\":if(Wr.next())switch(Wr.c){case"\\":Br.push(Wr.c.charCodeAt(0));break;case"b":Br.push(8);break;case"f":Br.push(12);break;case"n":Br.push(10);break;case"r":Br.push(13);break;case"t":Br.push(9);break;case"v":Br.push(11);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":{const qr=Wr.c,Gr=Wr.take(2);if(Gr===!1)return!1;const Vr=parseInt(qr+Gr,8);if(isNaN(Vr))return!1;Br.push(Vr);break}case"x":{const qr=Wr.c,Gr=Wr.take(2);if(Gr===!1)return!1;const Vr=parseInt(qr+Gr,16);if(isNaN(Vr))return!1;Br.push(Vr);break}case"u":{const qr=Wr.c,Gr=Wr.take(4);if(Gr===!1)return!1;const Vr=parseInt(qr+Gr,16);if(isNaN(Vr))return!1;const Zr=new Uint8Array(4);new DataView(Zr.buffer).setInt32(0,Vr,!0),Br.push(Zr[0],Zr[1],Zr[2],Zr[3]);break}case"U":{const qr=Wr.c,Gr=Wr.take(8);if(Gr===!1)return!1;const Vr=br.protoInt64.uEnc(qr+Gr),Zr=new Uint8Array(8),Jr=new DataView(Zr.buffer);Jr.setInt32(0,Vr.lo,!0),Jr.setInt32(4,Vr.hi,!0),Br.push(Zr[0],Zr[1],Zr[2],Zr[3],Zr[4],Zr[5],Zr[6],Zr[7]);break}}break;default:Br.push(Wr.c.charCodeAt(0))}return new Uint8Array(Br)}return textFormat}var sizeDelimited={},toBinary={},reflect={},reflectCheck={},isMessage={},hasRequiredIsMessage;function requireIsMessage(){if(hasRequiredIsMessage)return isMessage;hasRequiredIsMessage=1,Object.defineProperty(isMessage,"__esModule",{value:!0}),isMessage.isMessage=fr;function fr(br,wr){return br!==null&&typeof br=="object"&&"$typeName"in br&&typeof br.$typeName=="string"?wr===void 0?!0:wr.typeName===br.$typeName:!1}return isMessage}var error$1={},hasRequiredError;function requireError(){if(hasRequiredError)return error$1;hasRequiredError=1,Object.defineProperty(error$1,"__esModule",{value:!0}),error$1.FieldError=void 0,error$1.isFieldError=wr;const fr=["FieldValueInvalidError","FieldListRangeError","ForeignFieldError"];class br extends Error{constructor(kr,jr,Br="FieldValueInvalidError"){super(jr),this.name=Br,this.field=()=>kr}}error$1.FieldError=br;function wr(Er){return Er instanceof Error&&fr.includes(Er.name)&&"field"in Er&&typeof Er.field=="function"}return error$1}var guard$1={},unsafe={},scalar={},hasRequiredScalar;function requireScalar(){if(hasRequiredScalar)return scalar;hasRequiredScalar=1,Object.defineProperty(scalar,"__esModule",{value:!0}),scalar.scalarEquals=wr,scalar.scalarZeroValue=Er,scalar.isScalarZeroValue=kr;const fr=requireProtoInt64(),br=requireDescriptors();function wr(jr,Br,Wr){if(Br===Wr)return!0;if(jr==br.ScalarType.BYTES){if(!(Br instanceof Uint8Array)||!(Wr instanceof Uint8Array)||Br.length!==Wr.length)return!1;for(let qr=0;qrZr.localName===Vr)}function Er(qr,Gr){const Vr=Gr.localName;if(Gr.oneof)return qr[Gr.oneof.localName].case===Vr;if(Gr.presence!=br)return qr[Vr]!==void 0&&Object.prototype.hasOwnProperty.call(qr,Vr);switch(Gr.fieldKind){case"list":return qr[Vr].length>0;case"map":return Object.keys(qr[Vr]).length>0;case"scalar":return!(0,fr.isScalarZeroValue)(Gr.scalar,qr[Vr]);case"enum":return qr[Vr]!==Gr.enum.values[0].number}throw new Error("message field with implicit presence")}function kr(qr,Gr){return Object.prototype.hasOwnProperty.call(qr,Gr)&&qr[Gr]!==void 0}function jr(qr,Gr){if(Gr.oneof){const Vr=qr[Gr.oneof.localName];return Vr.case===Gr.localName?Vr.value:void 0}return qr[Gr.localName]}function Br(qr,Gr,Vr){Gr.oneof?qr[Gr.oneof.localName]={case:Gr.localName,value:Vr}:qr[Gr.localName]=Vr}function Wr(qr,Gr){const Vr=Gr.localName;if(Gr.oneof){const Zr=Gr.oneof.localName;qr[Zr].case===Vr&&(qr[Zr]={case:void 0})}else if(Gr.presence!=br)delete qr[Vr];else switch(Gr.fieldKind){case"map":qr[Vr]={};break;case"list":qr[Vr]=[];break;case"enum":qr[Vr]=Gr.enum.values[0].number;break;case"scalar":qr[Vr]=(0,fr.scalarZeroValue)(Gr.scalar,Gr.longAsString);break}}return unsafe}var hasRequiredGuard;function requireGuard(){if(hasRequiredGuard)return guard$1;hasRequiredGuard=1,Object.defineProperty(guard$1,"__esModule",{value:!0}),guard$1.isObject=br,guard$1.isOneofADT=wr,guard$1.isReflectList=Er,guard$1.isReflectMap=kr,guard$1.isReflectMessage=jr;const fr=requireUnsafe();function br(Br){return Br!==null&&typeof Br=="object"&&!Array.isArray(Br)}function wr(Br){return Br!==null&&typeof Br=="object"&&"case"in Br&&(typeof Br.case=="string"&&"value"in Br&&Br.value!=null||Br.case===void 0&&(!("value"in Br)||Br.value===void 0))}function Er(Br,Wr){var qr,Gr,Vr,Zr;if(br(Br)&&fr.unsafeLocal in Br&&"add"in Br&&"field"in Br&&typeof Br.field=="function"){if(Wr!==void 0){const Jr=Wr,Qr=Br.field();return Jr.listKind==Qr.listKind&&Jr.scalar===Qr.scalar&&((qr=Jr.message)===null||qr===void 0?void 0:qr.typeName)===((Gr=Qr.message)===null||Gr===void 0?void 0:Gr.typeName)&&((Vr=Jr.enum)===null||Vr===void 0?void 0:Vr.typeName)===((Zr=Qr.enum)===null||Zr===void 0?void 0:Zr.typeName)}return!0}return!1}function kr(Br,Wr){var qr,Gr,Vr,Zr;if(br(Br)&&fr.unsafeLocal in Br&&"has"in Br&&"field"in Br&&typeof Br.field=="function"){if(Wr!==void 0){const Jr=Wr,Qr=Br.field();return Jr.mapKey===Qr.mapKey&&Jr.mapKind==Qr.mapKind&&Jr.scalar===Qr.scalar&&((qr=Jr.message)===null||qr===void 0?void 0:qr.typeName)===((Gr=Qr.message)===null||Gr===void 0?void 0:Gr.typeName)&&((Vr=Jr.enum)===null||Vr===void 0?void 0:Vr.typeName)===((Zr=Qr.enum)===null||Zr===void 0?void 0:Zr.typeName)}return!0}return!1}function jr(Br,Wr){return br(Br)&&fr.unsafeLocal in Br&&"desc"in Br&&br(Br.desc)&&Br.desc.kind==="message"&&(Wr===void 0||Br.desc.typeName==Wr.typeName)}return guard$1}var hasRequiredReflectCheck;function requireReflectCheck(){if(hasRequiredReflectCheck)return reflectCheck;hasRequiredReflectCheck=1,Object.defineProperty(reflectCheck,"__esModule",{value:!0}),reflectCheck.checkField=Wr,reflectCheck.checkListItem=qr,reflectCheck.checkMapEntry=Gr,reflectCheck.formatVal=Qr;const fr=requireDescriptors(),br=requireIsMessage(),wr=requireError(),Er=requireGuard(),kr=requireBinaryEncoding(),jr=requireTextEncoding(),Br=requireProtoInt64();function Wr(An,jn){const eo=An.fieldKind=="list"?(0,Er.isReflectList)(jn,An):An.fieldKind=="map"?(0,Er.isReflectMap)(jn,An):Vr(An,jn);if(eo===!0)return;let ro;switch(An.fieldKind){case"list":ro=`expected ${En(An)}, got ${Qr(jn)}`;break;case"map":ro=`expected ${Cn(An)}, got ${Qr(jn)}`;break;default:ro=Jr(An,jn,eo)}return new wr.FieldError(An,ro)}function qr(An,jn,eo){const ro=Vr(An,eo);if(ro!==!0)return new wr.FieldError(An,`list item #${jn+1}: ${Jr(An,eo,ro)}`)}function Gr(An,jn,eo){const ro=Zr(jn,An.mapKey);if(ro!==!0)return new wr.FieldError(An,`invalid map key: ${Jr({scalar:An.mapKey},jn,ro)}`);const to=Vr(An,eo);if(to!==!0)return new wr.FieldError(An,`map entry ${Qr(jn)}: ${Jr(An,eo,to)}`)}function Vr(An,jn){return An.scalar!==void 0?Zr(jn,An.scalar):An.enum!==void 0?An.enum.open?Number.isInteger(jn):An.enum.values.some(eo=>eo.number===jn):(0,Er.isReflectMessage)(jn,An.message)}function Zr(An,jn){switch(jn){case fr.ScalarType.DOUBLE:return typeof An=="number";case fr.ScalarType.FLOAT:return typeof An!="number"?!1:Number.isNaN(An)||!Number.isFinite(An)?!0:An>kr.FLOAT32_MAX||Ankr.INT32_MAX||Ankr.UINT32_MAX||An<0?`${An.toFixed()} out of range`:!0;case fr.ScalarType.BOOL:return typeof An=="boolean";case fr.ScalarType.STRING:return typeof An!="string"?!1:(0,jr.getTextEncoding)().checkUtf8(An)||"invalid UTF8";case fr.ScalarType.BYTES:return An instanceof Uint8Array;case fr.ScalarType.INT64:case fr.ScalarType.SFIXED64:case fr.ScalarType.SINT64:if(typeof An!="string"&&typeof An!="bigint"&&typeof An!="number")return!1;try{Br.protoInt64.parse(An)}catch{return`${An} out of range`}return!0;case fr.ScalarType.FIXED64:case fr.ScalarType.UINT64:if(typeof An!="string"&&typeof An!="bigint"&&typeof An!="number")return!1;try{Br.protoInt64.uParse(An)}catch{return`${An} out of range`}return!0}}function Jr(An,jn,eo){return eo=typeof eo=="string"?`: ${eo}`:`, got ${Qr(jn)}`,An.scalar!==void 0?`expected ${In(An.scalar)}`+eo:An.enum!==void 0?`expected ${An.enum.toString()}`+eo:`expected ${_n(An.message)}`+eo}function Qr(An){switch(typeof An){case"object":return An===null?"null":An instanceof Uint8Array?`Uint8Array(${An.length})`:Array.isArray(An)?`Array(${An.length})`:(0,Er.isReflectList)(An)?En(An.field()):(0,Er.isReflectMap)(An)?Cn(An.field()):(0,Er.isReflectMessage)(An)?_n(An.desc):(0,br.isMessage)(An)?`message ${An.$typeName}`:"object";case"string":return An.length>30?"string":`"${An.split('"').join('\\"')}"`;case"boolean":return String(An);case"number":return String(An);case"bigint":return String(An)+"n";default:return typeof An}}function _n(An){return`ReflectMessage (${An.typeName})`}function En(An){switch(An.listKind){case"message":return`ReflectList (${An.message.toString()})`;case"enum":return`ReflectList (${An.enum.toString()})`;case"scalar":return`ReflectList (${fr.ScalarType[An.scalar]})`}}function Cn(An){switch(An.mapKind){case"message":return`ReflectMap (${fr.ScalarType[An.mapKey]}, ${An.message.toString()})`;case"enum":return`ReflectMap (${fr.ScalarType[An.mapKey]}, ${An.enum.toString()})`;case"scalar":return`ReflectMap (${fr.ScalarType[An.mapKey]}, ${fr.ScalarType[An.scalar]})`}}function In(An){switch(An){case fr.ScalarType.STRING:return"string";case fr.ScalarType.BOOL:return"boolean";case fr.ScalarType.INT64:case fr.ScalarType.SINT64:case fr.ScalarType.SFIXED64:return"bigint (int64)";case fr.ScalarType.UINT64:case fr.ScalarType.FIXED64:return"bigint (uint64)";case fr.ScalarType.BYTES:return"Uint8Array";case fr.ScalarType.DOUBLE:return"number (float64)";case fr.ScalarType.FLOAT:return"number (float32)";case fr.ScalarType.FIXED32:case fr.ScalarType.UINT32:return"number (uint32)";case fr.ScalarType.INT32:case fr.ScalarType.SFIXED32:case fr.ScalarType.SINT32:return"number (int32)"}}return reflectCheck}var create$3={},wrappers={},hasRequiredWrappers;function requireWrappers(){if(hasRequiredWrappers)return wrappers;hasRequiredWrappers=1,Object.defineProperty(wrappers,"__esModule",{value:!0}),wrappers.isWrapper=fr,wrappers.isWrapperDesc=br;function fr(Er){return wr(Er.$typeName)}function br(Er){const kr=Er.fields[0];return wr(Er.typeName)&&kr!==void 0&&kr.fieldKind=="scalar"&&kr.name=="value"&&kr.number==1}function wr(Er){return Er.startsWith("google.protobuf.")&&["DoubleValue","FloatValue","Int64Value","UInt64Value","Int32Value","UInt32Value","BoolValue","StringValue","BytesValue"].includes(Er.substring(16))}return wrappers}var hasRequiredCreate;function requireCreate(){if(hasRequiredCreate)return create$3;hasRequiredCreate=1,Object.defineProperty(create$3,"__esModule",{value:!0}),create$3.create=Gr;const fr=requireIsMessage(),br=requireDescriptors(),wr=requireScalar(),Er=requireGuard(),kr=requireUnsafe(),jr=requireWrappers(),Br=999,Wr=998,qr=2;function Gr(to,_i){if((0,fr.isMessage)(_i,to))return _i;const oo=jn(to);return _i!==void 0&&Vr(to,oo,_i),oo}function Vr(to,_i,oo){for(const io of to.members){let co=oo[io.localName];if(co==null)continue;let so;if(io.kind=="oneof"){const no=(0,kr.unsafeOneofCase)(oo,io);if(!no)continue;so=no,co=(0,kr.unsafeGet)(oo,no)}else so=io;switch(so.fieldKind){case"message":co=_n(so,co);break;case"scalar":co=Zr(so,co);break;case"list":co=Qr(so,co);break;case"map":co=Jr(so,co);break}(0,kr.unsafeSet)(_i,so,co)}return _i}function Zr(to,_i){return to.scalar==br.ScalarType.BYTES?En(_i):_i}function Jr(to,_i){if((0,Er.isObject)(_i)){if(to.scalar==br.ScalarType.BYTES)return Cn(_i,En);if(to.mapKind=="message")return Cn(_i,oo=>_n(to,oo))}return _i}function Qr(to,_i){if(Array.isArray(_i)){if(to.scalar==br.ScalarType.BYTES)return _i.map(En);if(to.listKind=="message")return _i.map(oo=>_n(to,oo))}return _i}function _n(to,_i){if(to.fieldKind=="message"&&!to.oneof&&(0,jr.isWrapperDesc)(to.message))return Zr(to.message.fields[0],_i);if((0,Er.isObject)(_i)){if(to.message.typeName=="google.protobuf.Struct"&&to.parent.typeName!=="google.protobuf.Value")return _i;if(!(0,fr.isMessage)(_i,to.message))return Gr(to.message,_i)}return _i}function En(to){return Array.isArray(to)?new Uint8Array(to):to}function Cn(to,_i){const oo={};for(const io of Object.entries(to))oo[io[0]]=_i(io[1]);return oo}const In=Symbol(),An=new WeakMap;function jn(to){let _i;if(eo(to)){const oo=An.get(to);let io,co;if(oo)({prototype:io,members:co}=oo);else{io={},co=new Set;for(const so of to.members)so.kind!="oneof"&&(so.fieldKind!="scalar"&&so.fieldKind!="enum"||so.presence!=qr&&(co.add(so),io[so.localName]=ro(so)));An.set(to,{prototype:io,members:co})}_i=Object.create(io),_i.$typeName=to.typeName;for(const so of to.members)co.has(so)||so.kind=="field"&&(so.fieldKind=="message"||(so.fieldKind=="scalar"||so.fieldKind=="enum")&&so.presence!=qr)||(_i[so.localName]=ro(so))}else{_i={$typeName:to.typeName};for(const oo of to.members)(oo.kind=="oneof"||oo.presence==qr)&&(_i[oo.localName]=ro(oo))}return _i}function eo(to){switch(to.file.edition){case Br:return!1;case Wr:return!0;default:return to.fields.some(_i=>_i.presence!=qr&&_i.fieldKind!="message"&&!_i.oneof)}}function ro(to){if(to.kind=="oneof")return{case:void 0};if(to.fieldKind=="list")return[];if(to.fieldKind=="map")return{};if(to.fieldKind=="message")return In;const _i=to.getDefaultValue();return _i!==void 0?to.fieldKind=="scalar"&&to.longAsString?_i.toString():_i:to.fieldKind=="scalar"?(0,wr.scalarZeroValue)(to.scalar,to.longAsString):to.enum.values[0].number}return create$3}var hasRequiredReflect;function requireReflect(){if(hasRequiredReflect)return reflect;hasRequiredReflect=1,Object.defineProperty(reflect,"__esModule",{value:!0}),reflect.reflect=Gr,reflect.reflectList=Jr,reflect.reflectMap=_n;const fr=requireDescriptors(),br=requireReflectCheck(),wr=requireError(),Er=requireUnsafe(),kr=requireCreate(),jr=requireWrappers(),Br=requireScalar(),Wr=requireProtoInt64(),qr=requireGuard();function Gr(Hr,Xr,Sn=!0){return new Vr(Hr,Xr,Sn)}class Vr{get sortedFields(){var Xr;return(Xr=this._sortedFields)!==null&&Xr!==void 0?Xr:this._sortedFields=this.desc.fields.concat().sort((Sn,Rn)=>Sn.number-Rn.number)}constructor(Xr,Sn,Rn=!0){this.lists=new Map,this.maps=new Map,this.check=Rn,this.desc=Xr,this.message=this[Er.unsafeLocal]=Sn??(0,kr.create)(Xr),this.fields=Xr.fields,this.oneofs=Xr.oneofs,this.members=Xr.members}findNumber(Xr){return this._fieldsByNumber||(this._fieldsByNumber=new Map(this.desc.fields.map(Sn=>[Sn.number,Sn]))),this._fieldsByNumber.get(Xr)}oneofCase(Xr){return Zr(this.message,Xr),(0,Er.unsafeOneofCase)(this.message,Xr)}isSet(Xr){return Zr(this.message,Xr),(0,Er.unsafeIsSet)(this.message,Xr)}clear(Xr){Zr(this.message,Xr),(0,Er.unsafeClear)(this.message,Xr)}get(Xr){Zr(this.message,Xr);const Sn=(0,Er.unsafeGet)(this.message,Xr);switch(Xr.fieldKind){case"list":let Rn=this.lists.get(Xr);return(!Rn||Rn[Er.unsafeLocal]!==Sn)&&this.lists.set(Xr,Rn=new Qr(Xr,Sn,this.check)),Rn;case"map":let Pn=this.maps.get(Xr);return(!Pn||Pn[Er.unsafeLocal]!==Sn)&&this.maps.set(Xr,Pn=new En(Xr,Sn,this.check)),Pn;case"message":return In(Xr,Sn,this.check);case"scalar":return Sn===void 0?(0,Br.scalarZeroValue)(Xr.scalar,!1):oo(Xr,Sn);case"enum":return Sn??Xr.enum.values[0].number}}set(Xr,Sn){if(Zr(this.message,Xr),this.check){const Pn=(0,br.checkField)(Xr,Sn);if(Pn)throw Pn}let Rn;Xr.fieldKind=="message"?Rn=Cn(Xr,Sn):(0,qr.isReflectMap)(Sn)||(0,qr.isReflectList)(Sn)?Rn=Sn[Er.unsafeLocal]:Rn=io(Xr,Sn),(0,Er.unsafeSet)(this.message,Xr,Rn)}getUnknown(){return this.message.$unknown}setUnknown(Xr){this.message.$unknown=Xr}}function Zr(Hr,Xr){if(Xr.parent.typeName!==Hr.$typeName)throw new wr.FieldError(Xr,`cannot use ${Xr.toString()} with message ${Hr.$typeName}`,"ForeignFieldError")}function Jr(Hr,Xr,Sn=!0){return new Qr(Hr,Xr??[],Sn)}class Qr{field(){return this._field}get size(){return this._arr.length}constructor(Xr,Sn,Rn){this._field=Xr,this._arr=this[Er.unsafeLocal]=Sn,this.check=Rn}get(Xr){const Sn=this._arr[Xr];return Sn===void 0?void 0:jn(this._field,Sn,this.check)}set(Xr,Sn){if(Xr<0||Xr>=this._arr.length)throw new wr.FieldError(this._field,`list item #${Xr+1}: out of range`);if(this.check){const Rn=(0,br.checkListItem)(this._field,Xr,Sn);if(Rn)throw Rn}this._arr[Xr]=An(this._field,Sn)}add(Xr){if(this.check){const Sn=(0,br.checkListItem)(this._field,this._arr.length,Xr);if(Sn)throw Sn}this._arr.push(An(this._field,Xr))}clear(){this._arr.splice(0,this._arr.length)}[Symbol.iterator](){return this.values()}keys(){return this._arr.keys()}*values(){for(const Xr of this._arr)yield jn(this._field,Xr,this.check)}*entries(){for(let Xr=0;Xr0&&_n.setUnknown(_i)}function Gr(_n,En,Cn,In,An){switch(Cn.fieldKind){case"scalar":_n.set(Cn,Qr(En,Cn.scalar));break;case"enum":_n.set(Cn,Qr(En,fr.ScalarType.INT32));break;case"message":_n.set(Cn,Jr(En,An,Cn,_n.get(Cn)));break;case"list":Zr(En,In,_n.get(Cn),An);break;case"map":Vr(En,_n.get(Cn),An);break}}function Vr(_n,En,Cn){const In=En.field();let An,jn;const eo=_n.pos+_n.uint32();for(;_n.pos1||In(to,oo)})},_i&&(Qr[to]=_i(Qr[to])))}function In(to,_i){try{An(Jr[to](_i))}catch(oo){ro(_n[0][3],oo)}}function An(to){to.value instanceof br?Promise.resolve(to.value.v).then(jn,eo):ro(_n[0][2],to)}function jn(to){In("next",to)}function eo(to){In("throw",to)}function ro(to,_i){to(_i),_n.shift(),_n.length&&In(_n[0][0],_n[0][1])}};Object.defineProperty(sizeDelimited,"__esModule",{value:!0}),sizeDelimited.sizeDelimitedEncode=Br,sizeDelimited.sizeDelimitedDecodeStream=Wr,sizeDelimited.sizeDelimitedPeek=qr;const Er=requireToBinary(),kr=requireBinaryEncoding(),jr=requireFromBinary();function Br(Gr,Vr,Zr){const Jr=new kr.BinaryWriter;return Jr.bytes((0,Er.toBinary)(Gr,Vr,Zr)),Jr.finish()}function Wr(Gr,Vr,Zr){return wr(this,arguments,function*(){var Qr,_n,En,Cn;function In(to,_i){const oo=new Uint8Array(to.byteLength+_i.byteLength);return oo.set(to),oo.set(_i,to.length),oo}let An=new Uint8Array(0);try{for(var jn=!0,eo=fr(Vr),ro;ro=yield br(eo.next()),Qr=ro.done,!Qr;jn=!0)for(Cn=ro.value,jn=!1,An=In(An,Cn);;){const _i=qr(An);if(_i.eof||_i.offset+_i.size>An.byteLength)break;yield yield br((0,jr.fromBinary)(Gr,An.subarray(_i.offset,_i.offset+_i.size),Zr)),An=An.subarray(_i.offset+_i.size)}}catch(to){_n={error:to}}finally{try{!jn&&!Qr&&(En=eo.return)&&(yield br(En.call(eo)))}finally{if(_n)throw _n.error}}if(An.byteLength>0)throw new Error("incomplete data")})}function qr(Gr){const Vr={eof:!0,size:null,offset:null};for(let Zr=0;Zr<10;Zr++){if(Zr>Gr.byteLength)return Vr;if(!(Gr[Zr]&128)){const Jr=new kr.BinaryReader(Gr);let Qr;try{Qr=Jr.uint32()}catch(_n){if(_n instanceof RangeError)return Vr;throw _n}return{eof:!1,size:Qr,offset:Jr.pos}}}throw new Error("invalid varint")}return sizeDelimited}var hasRequiredWire;function requireWire(){return hasRequiredWire||(hasRequiredWire=1,function(fr){var br=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(Er,kr,jr,Br){Br===void 0&&(Br=jr);var Wr=Object.getOwnPropertyDescriptor(kr,jr);(!Wr||("get"in Wr?!kr.__esModule:Wr.writable||Wr.configurable))&&(Wr={enumerable:!0,get:function(){return kr[jr]}}),Object.defineProperty(Er,Br,Wr)}:function(Er,kr,jr,Br){Br===void 0&&(Br=jr),Er[Br]=kr[jr]}),wr=commonjsGlobal&&commonjsGlobal.__exportStar||function(Er,kr){for(var jr in Er)jr!=="default"&&!Object.prototype.hasOwnProperty.call(kr,jr)&&br(kr,Er,jr)};Object.defineProperty(fr,"__esModule",{value:!0}),wr(requireBinaryEncoding(),fr),wr(requireBase64Encoding(),fr),wr(requireTextEncoding(),fr),wr(requireTextFormat(),fr),wr(requireSizeDelimited(),fr)}(wire)),wire}var tx$1={},hasRequiredTx$1;function requireTx$1(){return hasRequiredTx$1||(hasRequiredTx$1=1,function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.Transaction=fr.protobufPackage=void 0;const br=requireWire();fr.protobufPackage="push";function wr(){return{type:0,category:"",sender:"",recipients:[],data:new Uint8Array(0),salt:new Uint8Array(0),apiToken:new Uint8Array(0),signature:new Uint8Array(0),fee:""}}fr.Transaction={encode(Br,Wr=new br.BinaryWriter){Br.type!==0&&Wr.uint32(8).uint32(Br.type),Br.category!==""&&Wr.uint32(18).string(Br.category),Br.sender!==""&&Wr.uint32(26).string(Br.sender);for(const qr of Br.recipients)Wr.uint32(34).string(qr);return Br.data.length!==0&&Wr.uint32(42).bytes(Br.data),Br.salt.length!==0&&Wr.uint32(50).bytes(Br.salt),Br.apiToken.length!==0&&Wr.uint32(58).bytes(Br.apiToken),Br.signature.length!==0&&Wr.uint32(66).bytes(Br.signature),Br.fee!==""&&Wr.uint32(74).string(Br.fee),Wr},decode(Br,Wr){const qr=Br instanceof br.BinaryReader?Br:new br.BinaryReader(Br);let Gr=Wr===void 0?qr.len:qr.pos+Wr;const Vr=wr();for(;qr.pos>>3){case 1:{if(Zr!==8)break;Vr.type=qr.uint32();continue}case 2:{if(Zr!==18)break;Vr.category=qr.string();continue}case 3:{if(Zr!==26)break;Vr.sender=qr.string();continue}case 4:{if(Zr!==34)break;Vr.recipients.push(qr.string());continue}case 5:{if(Zr!==42)break;Vr.data=qr.bytes();continue}case 6:{if(Zr!==50)break;Vr.salt=qr.bytes();continue}case 7:{if(Zr!==58)break;Vr.apiToken=qr.bytes();continue}case 8:{if(Zr!==66)break;Vr.signature=qr.bytes();continue}case 9:{if(Zr!==74)break;Vr.fee=qr.string();continue}}if((Zr&7)===4||Zr===0)break;qr.skip(Zr&7)}return Vr},fromJSON(Br){return{type:jr(Br.type)?globalThis.Number(Br.type):0,category:jr(Br.category)?globalThis.String(Br.category):"",sender:jr(Br.sender)?globalThis.String(Br.sender):"",recipients:globalThis.Array.isArray(Br==null?void 0:Br.recipients)?Br.recipients.map(Wr=>globalThis.String(Wr)):[],data:jr(Br.data)?Er(Br.data):new Uint8Array(0),salt:jr(Br.salt)?Er(Br.salt):new Uint8Array(0),apiToken:jr(Br.apiToken)?Er(Br.apiToken):new Uint8Array(0),signature:jr(Br.signature)?Er(Br.signature):new Uint8Array(0),fee:jr(Br.fee)?globalThis.String(Br.fee):""}},toJSON(Br){var Wr;const qr={};return Br.type!==0&&(qr.type=Math.round(Br.type)),Br.category!==""&&(qr.category=Br.category),Br.sender!==""&&(qr.sender=Br.sender),!((Wr=Br.recipients)===null||Wr===void 0)&&Wr.length&&(qr.recipients=Br.recipients),Br.data.length!==0&&(qr.data=kr(Br.data)),Br.salt.length!==0&&(qr.salt=kr(Br.salt)),Br.apiToken.length!==0&&(qr.apiToken=kr(Br.apiToken)),Br.signature.length!==0&&(qr.signature=kr(Br.signature)),Br.fee!==""&&(qr.fee=Br.fee),qr},create(Br){return fr.Transaction.fromPartial(Br??{})},fromPartial(Br){var Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En;const Cn=wr();return Cn.type=(Wr=Br.type)!==null&&Wr!==void 0?Wr:0,Cn.category=(qr=Br.category)!==null&&qr!==void 0?qr:"",Cn.sender=(Gr=Br.sender)!==null&&Gr!==void 0?Gr:"",Cn.recipients=((Vr=Br.recipients)===null||Vr===void 0?void 0:Vr.map(In=>In))||[],Cn.data=(Zr=Br.data)!==null&&Zr!==void 0?Zr:new Uint8Array(0),Cn.salt=(Jr=Br.salt)!==null&&Jr!==void 0?Jr:new Uint8Array(0),Cn.apiToken=(Qr=Br.apiToken)!==null&&Qr!==void 0?Qr:new Uint8Array(0),Cn.signature=(_n=Br.signature)!==null&&_n!==void 0?_n:new Uint8Array(0),Cn.fee=(En=Br.fee)!==null&&En!==void 0?En:"",Cn}};function Er(Br){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(Br,"base64"));{const Wr=globalThis.atob(Br),qr=new Uint8Array(Wr.length);for(let Gr=0;Gr{Wr.push(globalThis.String.fromCharCode(qr))}),globalThis.btoa(Wr.join(""))}}function jr(Br){return Br!=null}}(tx$1)),tx$1}var hasRequiredBlock$1;function requireBlock$1(){return hasRequiredBlock$1||(hasRequiredBlock$1=1,function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.AttestorReport=fr.AttestSignaturesResponse=fr.AttestSignaturesRequest=fr.AttestBlockResult=fr.Block=fr.Signer=fr.TransactionObj=fr.TxAttestorData=fr.TxValidatorData=fr.DidMapping_DidMappingEntry=fr.DidMapping=fr.Vote=fr.Role=fr.protobufPackage=void 0,fr.roleFromJSON=kr,fr.roleToJSON=jr,fr.voteFromJSON=Wr,fr.voteToJSON=qr;const br=requireWire(),wr=requireTx$1();fr.protobufPackage="push";var Er;(function(io){io[io.ROLE_UNSPECIFIED=0]="ROLE_UNSPECIFIED",io[io.VALIDATOR=1]="VALIDATOR",io[io.ATTESTER=2]="ATTESTER",io[io.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Er||(fr.Role=Er={}));function kr(io){switch(io){case 0:case"ROLE_UNSPECIFIED":return Er.ROLE_UNSPECIFIED;case 1:case"VALIDATOR":return Er.VALIDATOR;case 2:case"ATTESTER":return Er.ATTESTER;case-1:case"UNRECOGNIZED":default:return Er.UNRECOGNIZED}}function jr(io){switch(io){case Er.ROLE_UNSPECIFIED:return"ROLE_UNSPECIFIED";case Er.VALIDATOR:return"VALIDATOR";case Er.ATTESTER:return"ATTESTER";case Er.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var Br;(function(io){io[io.VOTE_UNSPECIFIED=0]="VOTE_UNSPECIFIED",io[io.ACCEPTED=1]="ACCEPTED",io[io.REJECTED=2]="REJECTED",io[io.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Br||(fr.Vote=Br={}));function Wr(io){switch(io){case 0:case"VOTE_UNSPECIFIED":return Br.VOTE_UNSPECIFIED;case 1:case"ACCEPTED":return Br.ACCEPTED;case 2:case"REJECTED":return Br.REJECTED;case-1:case"UNRECOGNIZED":default:return Br.UNRECOGNIZED}}function qr(io){switch(io){case Br.VOTE_UNSPECIFIED:return"VOTE_UNSPECIFIED";case Br.ACCEPTED:return"ACCEPTED";case Br.REJECTED:return"REJECTED";case Br.UNRECOGNIZED:default:return"UNRECOGNIZED"}}function Gr(){return{didMapping:{}}}fr.DidMapping={encode(io,co=new br.BinaryWriter){return Object.entries(io.didMapping).forEach(([so,no])=>{fr.DidMapping_DidMappingEntry.encode({key:so,value:no},co.uint32(10).fork()).join()}),co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=Gr();for(;so.pos>>3){case 1:{if(Hr!==10)break;const Xr=fr.DidMapping_DidMappingEntry.decode(so,so.uint32());Xr.value!==void 0&&(Tn.didMapping[Xr.key]=Xr.value);continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{didMapping:_i(io.didMapping)?Object.entries(io.didMapping).reduce((co,[so,no])=>(co[so]=String(no),co),{}):{}}},toJSON(io){const co={};if(io.didMapping){const so=Object.entries(io.didMapping);so.length>0&&(co.didMapping={},so.forEach(([no,Tn])=>{co.didMapping[no]=Tn}))}return co},create(io){return fr.DidMapping.fromPartial(io??{})},fromPartial(io){var co;const so=Gr();return so.didMapping=Object.entries((co=io.didMapping)!==null&&co!==void 0?co:{}).reduce((no,[Tn,Hr])=>(Hr!==void 0&&(no[Tn]=globalThis.String(Hr)),no),{}),so}};function Vr(){return{key:"",value:""}}fr.DidMapping_DidMappingEntry={encode(io,co=new br.BinaryWriter){return io.key!==""&&co.uint32(10).string(io.key),io.value!==""&&co.uint32(18).string(io.value),co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=Vr();for(;so.pos>>3){case 1:{if(Hr!==10)break;Tn.key=so.string();continue}case 2:{if(Hr!==18)break;Tn.value=so.string();continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{key:oo(io.key)?globalThis.String(io.key):"",value:oo(io.value)?globalThis.String(io.value):""}},toJSON(io){const co={};return io.key!==""&&(co.key=io.key),io.value!==""&&(co.value=io.value),co},create(io){return fr.DidMapping_DidMappingEntry.fromPartial(io??{})},fromPartial(io){var co,so;const no=Vr();return no.key=(co=io.key)!==null&&co!==void 0?co:"",no.value=(so=io.value)!==null&&so!==void 0?so:"",no}};function Zr(){return{vote:0,didMapping:void 0}}fr.TxValidatorData={encode(io,co=new br.BinaryWriter){return io.vote!==0&&co.uint32(8).int32(io.vote),io.didMapping!==void 0&&fr.DidMapping.encode(io.didMapping,co.uint32(18).fork()).join(),co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=Zr();for(;so.pos>>3){case 1:{if(Hr!==8)break;Tn.vote=so.int32();continue}case 2:{if(Hr!==18)break;Tn.didMapping=fr.DidMapping.decode(so,so.uint32());continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{vote:oo(io.vote)?Wr(io.vote):0,didMapping:oo(io.didMapping)?fr.DidMapping.fromJSON(io.didMapping):void 0}},toJSON(io){const co={};return io.vote!==0&&(co.vote=qr(io.vote)),io.didMapping!==void 0&&(co.didMapping=fr.DidMapping.toJSON(io.didMapping)),co},create(io){return fr.TxValidatorData.fromPartial(io??{})},fromPartial(io){var co;const so=Zr();return so.vote=(co=io.vote)!==null&&co!==void 0?co:0,so.didMapping=io.didMapping!==void 0&&io.didMapping!==null?fr.DidMapping.fromPartial(io.didMapping):void 0,so}};function Jr(){return{vote:0}}fr.TxAttestorData={encode(io,co=new br.BinaryWriter){return io.vote!==0&&co.uint32(8).int32(io.vote),co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=Jr();for(;so.pos>>3){case 1:{if(Hr!==8)break;Tn.vote=so.int32();continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{vote:oo(io.vote)?Wr(io.vote):0}},toJSON(io){const co={};return io.vote!==0&&(co.vote=qr(io.vote)),co},create(io){return fr.TxAttestorData.fromPartial(io??{})},fromPartial(io){var co;const so=Jr();return so.vote=(co=io.vote)!==null&&co!==void 0?co:0,so}};function Qr(){return{tx:void 0,validatorData:void 0,attestorData:[]}}fr.TransactionObj={encode(io,co=new br.BinaryWriter){io.tx!==void 0&&wr.Transaction.encode(io.tx,co.uint32(10).fork()).join(),io.validatorData!==void 0&&fr.TxValidatorData.encode(io.validatorData,co.uint32(18).fork()).join();for(const so of io.attestorData)fr.TxAttestorData.encode(so,co.uint32(26).fork()).join();return co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=Qr();for(;so.pos>>3){case 1:{if(Hr!==10)break;Tn.tx=wr.Transaction.decode(so,so.uint32());continue}case 2:{if(Hr!==18)break;Tn.validatorData=fr.TxValidatorData.decode(so,so.uint32());continue}case 3:{if(Hr!==26)break;Tn.attestorData.push(fr.TxAttestorData.decode(so,so.uint32()));continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{tx:oo(io.tx)?wr.Transaction.fromJSON(io.tx):void 0,validatorData:oo(io.validatorData)?fr.TxValidatorData.fromJSON(io.validatorData):void 0,attestorData:globalThis.Array.isArray(io==null?void 0:io.attestorData)?io.attestorData.map(co=>fr.TxAttestorData.fromJSON(co)):[]}},toJSON(io){var co;const so={};return io.tx!==void 0&&(so.tx=wr.Transaction.toJSON(io.tx)),io.validatorData!==void 0&&(so.validatorData=fr.TxValidatorData.toJSON(io.validatorData)),!((co=io.attestorData)===null||co===void 0)&&co.length&&(so.attestorData=io.attestorData.map(no=>fr.TxAttestorData.toJSON(no))),so},create(io){return fr.TransactionObj.fromPartial(io??{})},fromPartial(io){var co;const so=Qr();return so.tx=io.tx!==void 0&&io.tx!==null?wr.Transaction.fromPartial(io.tx):void 0,so.validatorData=io.validatorData!==void 0&&io.validatorData!==null?fr.TxValidatorData.fromPartial(io.validatorData):void 0,so.attestorData=((co=io.attestorData)===null||co===void 0?void 0:co.map(no=>fr.TxAttestorData.fromPartial(no)))||[],so}};function _n(){return{sig:new Uint8Array(0)}}fr.Signer={encode(io,co=new br.BinaryWriter){return io.sig.length!==0&&co.uint32(10).bytes(io.sig),co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=_n();for(;so.pos>>3){case 1:{if(Hr!==10)break;Tn.sig=so.bytes();continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{sig:oo(io.sig)?eo(io.sig):new Uint8Array(0)}},toJSON(io){const co={};return io.sig.length!==0&&(co.sig=ro(io.sig)),co},create(io){return fr.Signer.fromPartial(io??{})},fromPartial(io){var co;const so=_n();return so.sig=(co=io.sig)!==null&&co!==void 0?co:new Uint8Array(0),so}};function En(){return{ts:0,attestToken:new Uint8Array(0),txObj:[],signers:[]}}fr.Block={encode(io,co=new br.BinaryWriter){io.ts!==0&&co.uint32(8).uint64(io.ts),io.attestToken.length!==0&&co.uint32(34).bytes(io.attestToken);for(const so of io.txObj)fr.TransactionObj.encode(so,co.uint32(18).fork()).join();for(const so of io.signers)fr.Signer.encode(so,co.uint32(26).fork()).join();return co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=En();for(;so.pos>>3){case 1:{if(Hr!==8)break;Tn.ts=to(so.uint64());continue}case 4:{if(Hr!==34)break;Tn.attestToken=so.bytes();continue}case 2:{if(Hr!==18)break;Tn.txObj.push(fr.TransactionObj.decode(so,so.uint32()));continue}case 3:{if(Hr!==26)break;Tn.signers.push(fr.Signer.decode(so,so.uint32()));continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{ts:oo(io.ts)?globalThis.Number(io.ts):0,attestToken:oo(io.attestToken)?eo(io.attestToken):new Uint8Array(0),txObj:globalThis.Array.isArray(io==null?void 0:io.txObj)?io.txObj.map(co=>fr.TransactionObj.fromJSON(co)):[],signers:globalThis.Array.isArray(io==null?void 0:io.signers)?io.signers.map(co=>fr.Signer.fromJSON(co)):[]}},toJSON(io){var co,so;const no={};return io.ts!==0&&(no.ts=Math.round(io.ts)),io.attestToken.length!==0&&(no.attestToken=ro(io.attestToken)),!((co=io.txObj)===null||co===void 0)&&co.length&&(no.txObj=io.txObj.map(Tn=>fr.TransactionObj.toJSON(Tn))),!((so=io.signers)===null||so===void 0)&&so.length&&(no.signers=io.signers.map(Tn=>fr.Signer.toJSON(Tn))),no},create(io){return fr.Block.fromPartial(io??{})},fromPartial(io){var co,so,no,Tn;const Hr=En();return Hr.ts=(co=io.ts)!==null&&co!==void 0?co:0,Hr.attestToken=(so=io.attestToken)!==null&&so!==void 0?so:new Uint8Array(0),Hr.txObj=((no=io.txObj)===null||no===void 0?void 0:no.map(Xr=>fr.TransactionObj.fromPartial(Xr)))||[],Hr.signers=((Tn=io.signers)===null||Tn===void 0?void 0:Tn.map(Xr=>fr.Signer.fromPartial(Xr)))||[],Hr}};function Cn(){return{attestorData:[],signer:void 0}}fr.AttestBlockResult={encode(io,co=new br.BinaryWriter){for(const so of io.attestorData)fr.TxAttestorData.encode(so,co.uint32(10).fork()).join();return io.signer!==void 0&&fr.Signer.encode(io.signer,co.uint32(18).fork()).join(),co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=Cn();for(;so.pos>>3){case 1:{if(Hr!==10)break;Tn.attestorData.push(fr.TxAttestorData.decode(so,so.uint32()));continue}case 2:{if(Hr!==18)break;Tn.signer=fr.Signer.decode(so,so.uint32());continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{attestorData:globalThis.Array.isArray(io==null?void 0:io.attestorData)?io.attestorData.map(co=>fr.TxAttestorData.fromJSON(co)):[],signer:oo(io.signer)?fr.Signer.fromJSON(io.signer):void 0}},toJSON(io){var co;const so={};return!((co=io.attestorData)===null||co===void 0)&&co.length&&(so.attestorData=io.attestorData.map(no=>fr.TxAttestorData.toJSON(no))),io.signer!==void 0&&(so.signer=fr.Signer.toJSON(io.signer)),so},create(io){return fr.AttestBlockResult.fromPartial(io??{})},fromPartial(io){var co;const so=Cn();return so.attestorData=((co=io.attestorData)===null||co===void 0?void 0:co.map(no=>fr.TxAttestorData.fromPartial(no)))||[],so.signer=io.signer!==void 0&&io.signer!==null?fr.Signer.fromPartial(io.signer):void 0,so}};function In(){return{attestations:[],initialBlockHash:new Uint8Array(0),finalBlockHash:new Uint8Array(0)}}fr.AttestSignaturesRequest={encode(io,co=new br.BinaryWriter){for(const so of io.attestations)fr.AttestBlockResult.encode(so,co.uint32(10).fork()).join();return io.initialBlockHash.length!==0&&co.uint32(18).bytes(io.initialBlockHash),io.finalBlockHash.length!==0&&co.uint32(26).bytes(io.finalBlockHash),co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=In();for(;so.pos>>3){case 1:{if(Hr!==10)break;Tn.attestations.push(fr.AttestBlockResult.decode(so,so.uint32()));continue}case 2:{if(Hr!==18)break;Tn.initialBlockHash=so.bytes();continue}case 3:{if(Hr!==26)break;Tn.finalBlockHash=so.bytes();continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{attestations:globalThis.Array.isArray(io==null?void 0:io.attestations)?io.attestations.map(co=>fr.AttestBlockResult.fromJSON(co)):[],initialBlockHash:oo(io.initialBlockHash)?eo(io.initialBlockHash):new Uint8Array(0),finalBlockHash:oo(io.finalBlockHash)?eo(io.finalBlockHash):new Uint8Array(0)}},toJSON(io){var co;const so={};return!((co=io.attestations)===null||co===void 0)&&co.length&&(so.attestations=io.attestations.map(no=>fr.AttestBlockResult.toJSON(no))),io.initialBlockHash.length!==0&&(so.initialBlockHash=ro(io.initialBlockHash)),io.finalBlockHash.length!==0&&(so.finalBlockHash=ro(io.finalBlockHash)),so},create(io){return fr.AttestSignaturesRequest.fromPartial(io??{})},fromPartial(io){var co,so,no;const Tn=In();return Tn.attestations=((co=io.attestations)===null||co===void 0?void 0:co.map(Hr=>fr.AttestBlockResult.fromPartial(Hr)))||[],Tn.initialBlockHash=(so=io.initialBlockHash)!==null&&so!==void 0?so:new Uint8Array(0),Tn.finalBlockHash=(no=io.finalBlockHash)!==null&&no!==void 0?no:new Uint8Array(0),Tn}};function An(){return{attestations:[]}}fr.AttestSignaturesResponse={encode(io,co=new br.BinaryWriter){for(const so of io.attestations)fr.AttestorReport.encode(so,co.uint32(10).fork()).join();return co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=An();for(;so.pos>>3){case 1:{if(Hr!==10)break;Tn.attestations.push(fr.AttestorReport.decode(so,so.uint32()));continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{attestations:globalThis.Array.isArray(io==null?void 0:io.attestations)?io.attestations.map(co=>fr.AttestorReport.fromJSON(co)):[]}},toJSON(io){var co;const so={};return!((co=io.attestations)===null||co===void 0)&&co.length&&(so.attestations=io.attestations.map(no=>fr.AttestorReport.toJSON(no))),so},create(io){return fr.AttestSignaturesResponse.fromPartial(io??{})},fromPartial(io){var co;const so=An();return so.attestations=((co=io.attestations)===null||co===void 0?void 0:co.map(no=>fr.AttestorReport.fromPartial(no)))||[],so}};function jn(){return{nodeId:"",transactionHash:"",vote:0,dataForSc:new Uint8Array(0),dataSigForSc:new Uint8Array(0)}}fr.AttestorReport={encode(io,co=new br.BinaryWriter){return io.nodeId!==""&&co.uint32(10).string(io.nodeId),io.transactionHash!==""&&co.uint32(18).string(io.transactionHash),io.vote!==0&&co.uint32(24).int32(io.vote),io.dataForSc.length!==0&&co.uint32(34).bytes(io.dataForSc),io.dataSigForSc.length!==0&&co.uint32(42).bytes(io.dataSigForSc),co},decode(io,co){const so=io instanceof br.BinaryReader?io:new br.BinaryReader(io);let no=co===void 0?so.len:so.pos+co;const Tn=jn();for(;so.pos>>3){case 1:{if(Hr!==10)break;Tn.nodeId=so.string();continue}case 2:{if(Hr!==18)break;Tn.transactionHash=so.string();continue}case 3:{if(Hr!==24)break;Tn.vote=so.int32();continue}case 4:{if(Hr!==34)break;Tn.dataForSc=so.bytes();continue}case 5:{if(Hr!==42)break;Tn.dataSigForSc=so.bytes();continue}}if((Hr&7)===4||Hr===0)break;so.skip(Hr&7)}return Tn},fromJSON(io){return{nodeId:oo(io.nodeId)?globalThis.String(io.nodeId):"",transactionHash:oo(io.transactionHash)?globalThis.String(io.transactionHash):"",vote:oo(io.vote)?globalThis.Number(io.vote):0,dataForSc:oo(io.dataForSc)?eo(io.dataForSc):new Uint8Array(0),dataSigForSc:oo(io.dataSigForSc)?eo(io.dataSigForSc):new Uint8Array(0)}},toJSON(io){const co={};return io.nodeId!==""&&(co.nodeId=io.nodeId),io.transactionHash!==""&&(co.transactionHash=io.transactionHash),io.vote!==0&&(co.vote=Math.round(io.vote)),io.dataForSc.length!==0&&(co.dataForSc=ro(io.dataForSc)),io.dataSigForSc.length!==0&&(co.dataSigForSc=ro(io.dataSigForSc)),co},create(io){return fr.AttestorReport.fromPartial(io??{})},fromPartial(io){var co,so,no,Tn,Hr;const Xr=jn();return Xr.nodeId=(co=io.nodeId)!==null&&co!==void 0?co:"",Xr.transactionHash=(so=io.transactionHash)!==null&&so!==void 0?so:"",Xr.vote=(no=io.vote)!==null&&no!==void 0?no:0,Xr.dataForSc=(Tn=io.dataForSc)!==null&&Tn!==void 0?Tn:new Uint8Array(0),Xr.dataSigForSc=(Hr=io.dataSigForSc)!==null&&Hr!==void 0?Hr:new Uint8Array(0),Xr}};function eo(io){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(io,"base64"));{const co=globalThis.atob(io),so=new Uint8Array(co.length);for(let no=0;no{co.push(globalThis.String.fromCharCode(so))}),globalThis.btoa(co.join(""))}}function to(io){const co=globalThis.Number(io.toString());if(co>globalThis.Number.MAX_SAFE_INTEGER)throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");if(cobr.__awaiter(this,[...Wr],void 0,function*(qr=Math.floor(Date.now()/1e3),Gr="ASC",Vr=!1,Zr=30,Jr=1){return yield this.validator.call("push_getBlocks",[qr,Gr,Vr,Zr,Jr])}),this.search=Wr=>br.__awaiter(this,void 0,void 0,function*(){return yield this.validator.call("push_getBlockByHash",[Wr])})}}return block$1.Block=kr,fr=kr,kr.initialize=jr=>br.__awaiter(void 0,void 0,void 0,function*(){const Br=yield wr.Validator.initalize({env:jr});return new fr(Br)}),kr.serialize=jr=>{const Br=Er.Block.create(jr);return Er.Block.encode(Br).finish()},kr.deserialize=jr=>Er.Block.decode(jr),block$1}var tx={},commonjsBrowser={},max={},hasRequiredMax;function requireMax(){return hasRequiredMax||(hasRequiredMax=1,Object.defineProperty(max,"__esModule",{value:!0}),max.default=void 0,max.default="ffffffff-ffff-ffff-ffff-ffffffffffff"),max}var nil$1={},hasRequiredNil;function requireNil(){return hasRequiredNil||(hasRequiredNil=1,Object.defineProperty(nil$1,"__esModule",{value:!0}),nil$1.default=void 0,nil$1.default="00000000-0000-0000-0000-000000000000"),nil$1}var parse$1={},validate$4={},regex={},hasRequiredRegex;function requireRegex(){return hasRequiredRegex||(hasRequiredRegex=1,Object.defineProperty(regex,"__esModule",{value:!0}),regex.default=void 0,regex.default=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i),regex}var hasRequiredValidate;function requireValidate(){if(hasRequiredValidate)return validate$4;hasRequiredValidate=1,Object.defineProperty(validate$4,"__esModule",{value:!0}),validate$4.default=void 0;var fr=br(requireRegex());function br(Er){return Er&&Er.__esModule?Er:{default:Er}}function wr(Er){return typeof Er=="string"&&fr.default.test(Er)}return validate$4.default=wr,validate$4}var hasRequiredParse;function requireParse(){if(hasRequiredParse)return parse$1;hasRequiredParse=1,Object.defineProperty(parse$1,"__esModule",{value:!0}),parse$1.default=void 0;var fr=br(requireValidate());function br(Er){return Er&&Er.__esModule?Er:{default:Er}}function wr(Er){if(!(0,fr.default)(Er))throw TypeError("Invalid UUID");var kr,jr=new Uint8Array(16);return jr[0]=(kr=parseInt(Er.slice(0,8),16))>>>24,jr[1]=kr>>>16&255,jr[2]=kr>>>8&255,jr[3]=kr&255,jr[4]=(kr=parseInt(Er.slice(9,13),16))>>>8,jr[5]=kr&255,jr[6]=(kr=parseInt(Er.slice(14,18),16))>>>8,jr[7]=kr&255,jr[8]=(kr=parseInt(Er.slice(19,23),16))>>>8,jr[9]=kr&255,jr[10]=(kr=parseInt(Er.slice(24,36),16))/1099511627776&255,jr[11]=kr/4294967296&255,jr[12]=kr>>>24&255,jr[13]=kr>>>16&255,jr[14]=kr>>>8&255,jr[15]=kr&255,jr}return parse$1.default=wr,parse$1}var stringify$3={},hasRequiredStringify;function requireStringify(){if(hasRequiredStringify)return stringify$3;hasRequiredStringify=1,Object.defineProperty(stringify$3,"__esModule",{value:!0}),stringify$3.default=void 0,stringify$3.unsafeStringify=kr;var fr=br(requireValidate());function br(Br){return Br&&Br.__esModule?Br:{default:Br}}for(var wr=[],Er=0;Er<256;++Er)wr.push((Er+256).toString(16).slice(1));function kr(Br,Wr=0){return(wr[Br[Wr+0]]+wr[Br[Wr+1]]+wr[Br[Wr+2]]+wr[Br[Wr+3]]+"-"+wr[Br[Wr+4]]+wr[Br[Wr+5]]+"-"+wr[Br[Wr+6]]+wr[Br[Wr+7]]+"-"+wr[Br[Wr+8]]+wr[Br[Wr+9]]+"-"+wr[Br[Wr+10]]+wr[Br[Wr+11]]+wr[Br[Wr+12]]+wr[Br[Wr+13]]+wr[Br[Wr+14]]+wr[Br[Wr+15]]).toLowerCase()}function jr(Br,Wr=0){var qr=kr(Br,Wr);if(!(0,fr.default)(qr))throw TypeError("Stringified UUID is invalid");return qr}return stringify$3.default=jr,stringify$3}var v1$1={},rng$1={},hasRequiredRng;function requireRng(){if(hasRequiredRng)return rng$1;hasRequiredRng=1,Object.defineProperty(rng$1,"__esModule",{value:!0}),rng$1.default=wr;var fr,br=new Uint8Array(16);function wr(){if(!fr&&(fr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!fr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return fr(br)}return rng$1}var hasRequiredV1;function requireV1(){if(hasRequiredV1)return v1$1;hasRequiredV1=1,Object.defineProperty(v1$1,"__esModule",{value:!0}),v1$1.default=void 0;var fr=wr(requireRng()),br=requireStringify();function wr(qr){return qr&&qr.__esModule?qr:{default:qr}}var Er,kr,jr=0,Br=0;function Wr(qr,Gr,Vr){var Zr=Gr&&Vr||0,Jr=Gr||new Array(16);qr=qr||{};var Qr=qr.node,_n=qr.clockseq;if(qr._v6||(Qr||(Qr=Er),_n==null&&(_n=kr)),Qr==null||_n==null){var En=qr.random||(qr.rng||fr.default)();Qr==null&&(Qr=[En[0],En[1],En[2],En[3],En[4],En[5]],!Er&&!qr._v6&&(Qr[0]|=1,Er=Qr)),_n==null&&(_n=(En[6]<<8|En[7])&16383,kr===void 0&&!qr._v6&&(kr=_n))}var Cn=qr.msecs!==void 0?qr.msecs:Date.now(),In=qr.nsecs!==void 0?qr.nsecs:Br+1,An=Cn-jr+(In-Br)/1e4;if(An<0&&qr.clockseq===void 0&&(_n=_n+1&16383),(An<0||Cn>jr)&&qr.nsecs===void 0&&(In=0),In>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");jr=Cn,Br=In,kr=_n,Cn+=122192928e5;var jn=((Cn&268435455)*1e4+In)%4294967296;Jr[Zr++]=jn>>>24&255,Jr[Zr++]=jn>>>16&255,Jr[Zr++]=jn>>>8&255,Jr[Zr++]=jn&255;var eo=Cn/4294967296*1e4&268435455;Jr[Zr++]=eo>>>8&255,Jr[Zr++]=eo&255,Jr[Zr++]=eo>>>24&15|16,Jr[Zr++]=eo>>>16&255,Jr[Zr++]=_n>>>8|128,Jr[Zr++]=_n&255;for(var ro=0;ro<6;++ro)Jr[Zr+ro]=Qr[ro];return Gr||(0,br.unsafeStringify)(Jr)}return v1$1.default=Wr,v1$1}var v1ToV6={},hasRequiredV1ToV6;function requireV1ToV6(){if(hasRequiredV1ToV6)return v1ToV6;hasRequiredV1ToV6=1,Object.defineProperty(v1ToV6,"__esModule",{value:!0}),v1ToV6.default=Er;var fr=wr(requireParse()),br=requireStringify();function wr(jr){return jr&&jr.__esModule?jr:{default:jr}}function Er(jr){var Br=typeof jr=="string"?(0,fr.default)(jr):jr,Wr=kr(Br);return typeof jr=="string"?(0,br.unsafeStringify)(Wr):Wr}function kr(jr,Br=!1){return Uint8Array.of((jr[6]&15)<<4|jr[7]>>4&15,(jr[7]&15)<<4|(jr[4]&240)>>4,(jr[4]&15)<<4|(jr[5]&240)>>4,(jr[5]&15)<<4|(jr[0]&240)>>4,(jr[0]&15)<<4|(jr[1]&240)>>4,(jr[1]&15)<<4|(jr[2]&240)>>4,96|jr[2]&15,jr[3],jr[8],jr[9],jr[10],jr[11],jr[12],jr[13],jr[14],jr[15])}return v1ToV6}var v3$1={},v35$1={},hasRequiredV35;function requireV35(){if(hasRequiredV35)return v35$1;hasRequiredV35=1,Object.defineProperty(v35$1,"__esModule",{value:!0}),v35$1.URL=v35$1.DNS=void 0,v35$1.default=Br;var fr=requireStringify(),br=wr(requireParse());function wr(Wr){return Wr&&Wr.__esModule?Wr:{default:Wr}}function Er(Wr){Wr=unescape(encodeURIComponent(Wr));for(var qr=[],Gr=0;Gr>5]>>>Cn%32&255,An=parseInt(En.charAt(In>>>4&15)+En.charAt(In&15),16);Qr.push(An)}return Qr}function wr(Jr){return(Jr+64>>>9<<4)+14+1}function Er(Jr,Qr){Jr[Qr>>5]|=128<>5]|=(Jr[En/8]&255)<>16)+(Qr>>16)+(_n>>16);return En<<16|_n&65535}function Br(Jr,Qr){return Jr<>>32-Qr}function Wr(Jr,Qr,_n,En,Cn,In){return jr(Br(jr(jr(Qr,Jr),jr(En,In)),Cn),_n)}function qr(Jr,Qr,_n,En,Cn,In,An){return Wr(Qr&_n|~Qr&En,Jr,Qr,Cn,In,An)}function Gr(Jr,Qr,_n,En,Cn,In,An){return Wr(Qr&En|_n&~En,Jr,Qr,Cn,In,An)}function Vr(Jr,Qr,_n,En,Cn,In,An){return Wr(Qr^_n^En,Jr,Qr,Cn,In,An)}function Zr(Jr,Qr,_n,En,Cn,In,An){return Wr(_n^(Qr|~En),Jr,Qr,Cn,In,An)}return md5$2.default=fr,md5$2}var hasRequiredV3;function requireV3(){if(hasRequiredV3)return v3$1;hasRequiredV3=1,Object.defineProperty(v3$1,"__esModule",{value:!0}),v3$1.default=void 0;var fr=wr(requireV35()),br=wr(requireMd5$1());function wr(kr){return kr&&kr.__esModule?kr:{default:kr}}var Er=(0,fr.default)("v3",48,br.default);return v3$1.default=Er,v3$1}var v4$1={},native={},hasRequiredNative;function requireNative(){if(hasRequiredNative)return native;hasRequiredNative=1,Object.defineProperty(native,"__esModule",{value:!0}),native.default=void 0;var fr=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);return native.default={randomUUID:fr},native}var hasRequiredV4;function requireV4(){if(hasRequiredV4)return v4$1;hasRequiredV4=1,Object.defineProperty(v4$1,"__esModule",{value:!0}),v4$1.default=void 0;var fr=Er(requireNative()),br=Er(requireRng()),wr=requireStringify();function Er(jr){return jr&&jr.__esModule?jr:{default:jr}}function kr(jr,Br,Wr){if(fr.default.randomUUID&&!Br&&!jr)return fr.default.randomUUID();jr=jr||{};var qr=jr.random||(jr.rng||br.default)();if(qr[6]=qr[6]&15|64,qr[8]=qr[8]&63|128,Br){Wr=Wr||0;for(var Gr=0;Gr<16;++Gr)Br[Wr+Gr]=qr[Gr];return Br}return(0,wr.unsafeStringify)(qr)}return v4$1.default=kr,v4$1}var v5$1={},sha1$2={},hasRequiredSha1$1;function requireSha1$1(){if(hasRequiredSha1$1)return sha1$2;hasRequiredSha1$1=1,Object.defineProperty(sha1$2,"__esModule",{value:!0}),sha1$2.default=void 0;function fr(Er,kr,jr,Br){switch(Er){case 0:return kr&jr^~kr&Br;case 1:return kr^jr^Br;case 2:return kr&jr^kr&Br^jr&Br;case 3:return kr^jr^Br}}function br(Er,kr){return Er<>>32-kr}function wr(Er){var kr=[1518500249,1859775393,2400959708,3395469782],jr=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof Er=="string"){var Br=unescape(encodeURIComponent(Er));Er=[];for(var Wr=0;Wr>>0;to=ro,ro=eo,eo=br(jn,30)>>>0,jn=An,An=io}jr[0]=jr[0]+An>>>0,jr[1]=jr[1]+jn>>>0,jr[2]=jr[2]+eo>>>0,jr[3]=jr[3]+ro>>>0,jr[4]=jr[4]+to>>>0}return[jr[0]>>24&255,jr[0]>>16&255,jr[0]>>8&255,jr[0]&255,jr[1]>>24&255,jr[1]>>16&255,jr[1]>>8&255,jr[1]&255,jr[2]>>24&255,jr[2]>>16&255,jr[2]>>8&255,jr[2]&255,jr[3]>>24&255,jr[3]>>16&255,jr[3]>>8&255,jr[3]&255,jr[4]>>24&255,jr[4]>>16&255,jr[4]>>8&255,jr[4]&255]}return sha1$2.default=wr,sha1$2}var hasRequiredV5;function requireV5(){if(hasRequiredV5)return v5$1;hasRequiredV5=1,Object.defineProperty(v5$1,"__esModule",{value:!0}),v5$1.default=void 0;var fr=wr(requireV35()),br=wr(requireSha1$1());function wr(kr){return kr&&kr.__esModule?kr:{default:kr}}var Er=(0,fr.default)("v5",80,br.default);return v5$1.default=Er,v5$1}var v6={},hasRequiredV6;function requireV6(){if(hasRequiredV6)return v6;hasRequiredV6=1,Object.defineProperty(v6,"__esModule",{value:!0}),v6.default=Gr;var fr=requireStringify(),br=Er(requireV1()),wr=Er(requireV1ToV6());function Er(Vr){return Vr&&Vr.__esModule?Vr:{default:Vr}}function kr(Vr,Zr){var Jr=Object.keys(Vr);if(Object.getOwnPropertySymbols){var Qr=Object.getOwnPropertySymbols(Vr);Zr&&(Qr=Qr.filter(function(_n){return Object.getOwnPropertyDescriptor(Vr,_n).enumerable})),Jr.push.apply(Jr,Qr)}return Jr}function jr(Vr){for(var Zr=1;Zr>4&15,(jr[4]&15)<<4|(jr[5]&240)>>4,(jr[5]&15)<<4|jr[6]&15,jr[7],(jr[1]&15)<<4|(jr[2]&240)>>4,(jr[2]&15)<<4|(jr[3]&240)>>4,16|(jr[0]&240)>>4,(jr[0]&15)<<4|(jr[1]&240)>>4,jr[8],jr[9],jr[10],jr[11],jr[12],jr[13],jr[14],jr[15])}return v6ToV1}var v7={},hasRequiredV7;function requireV7(){if(hasRequiredV7)return v7;hasRequiredV7=1,Object.defineProperty(v7,"__esModule",{value:!0}),v7.default=void 0;var fr=wr(requireRng()),br=requireStringify();function wr(Wr){return Wr&&Wr.__esModule?Wr:{default:Wr}}var Er=null,kr=null,jr=0;function Br(Wr,qr,Gr){Wr=Wr||{};var Vr=qr&&Gr||0,Zr=qr||new Uint8Array(16),Jr=Wr.random||(Wr.rng||fr.default)(),Qr=Wr.msecs!==void 0?Wr.msecs:Date.now(),_n=Wr.seq!==void 0?Wr.seq:null,En=kr,Cn=Er;return Qr>jr&&Wr.msecs===void 0&&(jr=Qr,_n!==null&&(En=null,Cn=null)),_n!==null&&(_n>2147483647&&(_n=2147483647),En=_n>>>19&4095,Cn=_n&524287),(En===null||Cn===null)&&(En=Jr[6]&127,En=En<<8|Jr[7],Cn=Jr[8]&63,Cn=Cn<<8|Jr[9],Cn=Cn<<5|Jr[10]>>>3),Qr+1e4>jr&&_n===null?++Cn>524287&&(Cn=0,++En>4095&&(En=0,jr++)):jr=Qr,kr=En,Er=Cn,Zr[Vr++]=jr/1099511627776&255,Zr[Vr++]=jr/4294967296&255,Zr[Vr++]=jr/16777216&255,Zr[Vr++]=jr/65536&255,Zr[Vr++]=jr/256&255,Zr[Vr++]=jr&255,Zr[Vr++]=En>>>4&15|112,Zr[Vr++]=En&255,Zr[Vr++]=Cn>>>13&63|128,Zr[Vr++]=Cn>>>5&255,Zr[Vr++]=Cn<<3&255|Jr[10]&7,Zr[Vr++]=Jr[11],Zr[Vr++]=Jr[12],Zr[Vr++]=Jr[13],Zr[Vr++]=Jr[14],Zr[Vr++]=Jr[15],qr||(0,br.unsafeStringify)(Zr)}return v7.default=Br,v7}var version$f={},hasRequiredVersion;function requireVersion(){if(hasRequiredVersion)return version$f;hasRequiredVersion=1,Object.defineProperty(version$f,"__esModule",{value:!0}),version$f.default=void 0;var fr=br(requireValidate());function br(Er){return Er&&Er.__esModule?Er:{default:Er}}function wr(Er){if(!(0,fr.default)(Er))throw TypeError("Invalid UUID");return parseInt(Er.slice(14,15),16)}return version$f.default=wr,version$f}var hasRequiredCommonjsBrowser;function requireCommonjsBrowser(){return hasRequiredCommonjsBrowser||(hasRequiredCommonjsBrowser=1,function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),Object.defineProperty(fr,"MAX",{enumerable:!0,get:function(){return br.default}}),Object.defineProperty(fr,"NIL",{enumerable:!0,get:function(){return wr.default}}),Object.defineProperty(fr,"parse",{enumerable:!0,get:function(){return Er.default}}),Object.defineProperty(fr,"stringify",{enumerable:!0,get:function(){return kr.default}}),Object.defineProperty(fr,"v1",{enumerable:!0,get:function(){return jr.default}}),Object.defineProperty(fr,"v1ToV6",{enumerable:!0,get:function(){return Br.default}}),Object.defineProperty(fr,"v3",{enumerable:!0,get:function(){return Wr.default}}),Object.defineProperty(fr,"v4",{enumerable:!0,get:function(){return qr.default}}),Object.defineProperty(fr,"v5",{enumerable:!0,get:function(){return Gr.default}}),Object.defineProperty(fr,"v6",{enumerable:!0,get:function(){return Vr.default}}),Object.defineProperty(fr,"v6ToV1",{enumerable:!0,get:function(){return Zr.default}}),Object.defineProperty(fr,"v7",{enumerable:!0,get:function(){return Jr.default}}),Object.defineProperty(fr,"validate",{enumerable:!0,get:function(){return Qr.default}}),Object.defineProperty(fr,"version",{enumerable:!0,get:function(){return _n.default}});var br=En(requireMax()),wr=En(requireNil()),Er=En(requireParse()),kr=En(requireStringify()),jr=En(requireV1()),Br=En(requireV1ToV6()),Wr=En(requireV3()),qr=En(requireV4()),Gr=En(requireV5()),Vr=En(requireV6()),Zr=En(requireV6ToV1()),Jr=En(requireV7()),Qr=En(requireValidate()),_n=En(requireVersion());function En(Cn){return Cn&&Cn.__esModule?Cn:{default:Cn}}}(commonjsBrowser)),commonjsBrowser}const crypto$3=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function anumber$3(fr){if(!Number.isSafeInteger(fr)||fr<0)throw new Error("positive integer expected, got "+fr)}function isBytes$6(fr){return fr instanceof Uint8Array||ArrayBuffer.isView(fr)&&fr.constructor.name==="Uint8Array"}function abytes$2(fr,...br){if(!isBytes$6(fr))throw new Error("Uint8Array expected");if(br.length>0&&!br.includes(fr.length))throw new Error("Uint8Array expected of length "+br+", got length="+fr.length)}function ahash$1(fr){if(typeof fr!="function"||typeof fr.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");anumber$3(fr.outputLen),anumber$3(fr.blockLen)}function aexists$1(fr,br=!0){if(fr.destroyed)throw new Error("Hash instance has been destroyed");if(br&&fr.finished)throw new Error("Hash#digest() has already been called")}function aoutput$1(fr,br){abytes$2(fr);const wr=br.outputLen;if(fr.lengthnew Uint8Array(fr.buffer,fr.byteOffset,fr.byteLength),u32$1=fr=>new Uint32Array(fr.buffer,fr.byteOffset,Math.floor(fr.byteLength/4)),createView$1=fr=>new DataView(fr.buffer,fr.byteOffset,fr.byteLength),rotr$1=(fr,br)=>fr<<32-br|fr>>>br,rotl=(fr,br)=>fr<>>32-br>>>0,isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,byteSwap=fr=>fr<<24&4278190080|fr<<8&16711680|fr>>>8&65280|fr>>>24&255,byteSwapIfBE=isLE?fr=>fr:fr=>byteSwap(fr);function byteSwap32(fr){for(let br=0;brbr.toString(16).padStart(2,"0"));function bytesToHex$1(fr){abytes$2(fr);let br="";for(let wr=0;wr=asciis$1._0&&fr<=asciis$1._9)return fr-asciis$1._0;if(fr>=asciis$1.A&&fr<=asciis$1.F)return fr-(asciis$1.A-10);if(fr>=asciis$1.a&&fr<=asciis$1.f)return fr-(asciis$1.a-10)}function hexToBytes$1(fr){if(typeof fr!="string")throw new Error("hex string expected, got "+typeof fr);const br=fr.length,wr=br/2;if(br%2)throw new Error("hex string expected, got unpadded hex of length "+br);const Er=new Uint8Array(wr);for(let kr=0,jr=0;kr{};async function asyncLoop(fr,br,wr){let Er=Date.now();for(let kr=0;kr=0&&jrfr().update(toBytes$1(Er)).digest(),wr=fr();return br.outputLen=wr.outputLen,br.blockLen=wr.blockLen,br.create=()=>fr(),br}function wrapConstructorWithOpts(fr){const br=(Er,kr)=>fr(kr).update(toBytes$1(Er)).digest(),wr=fr({});return br.outputLen=wr.outputLen,br.blockLen=wr.blockLen,br.create=Er=>fr(Er),br}function wrapXOFConstructorWithOpts(fr){const br=(Er,kr)=>fr(kr).update(toBytes$1(Er)).digest(),wr=fr({});return br.outputLen=wr.outputLen,br.blockLen=wr.blockLen,br.create=Er=>fr(Er),br}function randomBytes$1(fr=32){if(crypto$3&&typeof crypto$3.getRandomValues=="function")return crypto$3.getRandomValues(new Uint8Array(fr));if(crypto$3&&typeof crypto$3.randomBytes=="function")return crypto$3.randomBytes(fr);throw new Error("crypto.getRandomValues must be defined")}const utils$8=Object.freeze(Object.defineProperty({__proto__:null,Hash:Hash$2,asyncLoop,byteSwap,byteSwap32,byteSwapIfBE,bytesToHex:bytesToHex$1,checkOpts,concatBytes:concatBytes$2,createView:createView$1,hexToBytes:hexToBytes$1,isBytes:isBytes$5,isLE,nextTick,randomBytes:randomBytes$1,rotl,rotr:rotr$1,toBytes:toBytes$1,u32:u32$1,u8:u8$1,utf8ToBytes:utf8ToBytes$2,wrapConstructor:wrapConstructor$1,wrapConstructorWithOpts,wrapXOFConstructorWithOpts},Symbol.toStringTag,{value:"Module"})),require$$0$a=getAugmentedNamespace(utils$8);var tx_types={},hasRequiredTx_types;function requireTx_types(){if(hasRequiredTx_types)return tx_types;hasRequiredTx_types=1,Object.defineProperty(tx_types,"__esModule",{value:!0}),tx_types.QuorumResult=tx_types.ResultMeta=tx_types.ReplyGrouped=tx_types.TxCategory=void 0;var fr;(function(kr){kr.INIT_DID="INIT_DID",kr.INIT_SESSION_KEY="INIT_SESSION_KEY"})(fr||(tx_types.TxCategory=fr={}));class br{constructor(){this.items=[],this.summary=new wr}}tx_types.ReplyGrouped=br;class wr{}tx_types.ResultMeta=wr;var Er;return function(kr){kr.QUORUM_OK="QUORUM_OK",kr.QUORUM_OK_PARTIAL="QUORUM_OK_PARTIAL",kr.QUORUM_FAILED_NODE_REPLIES="QUORUM_FAILED_NODE_REPLIES",kr.QUORUM_FAILED_BY_MIN_ITEMS="QUORUM_FAILED_BY_MIN_ITEMS"}(Er||(tx_types.QuorumResult=Er={})),tx_types}var init_did={},hasRequiredInit_did;function requireInit_did(){return hasRequiredInit_did||(hasRequiredInit_did=1,function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.InitDid_WalletToEncDerivedKeyEntry=fr.InitDid=fr.WalletToEncDerivedKey=fr.EncryptedText=fr.protobufPackage=void 0;const br=requireWire();fr.protobufPackage="push";function wr(){return{ciphertext:"",salt:"",nonce:"",version:"",preKey:""}}fr.EncryptedText={encode(Vr,Zr=new br.BinaryWriter){return Vr.ciphertext!==""&&Zr.uint32(10).string(Vr.ciphertext),Vr.salt!==""&&Zr.uint32(18).string(Vr.salt),Vr.nonce!==""&&Zr.uint32(26).string(Vr.nonce),Vr.version!==""&&Zr.uint32(34).string(Vr.version),Vr.preKey!==""&&Zr.uint32(42).string(Vr.preKey),Zr},decode(Vr,Zr){const Jr=Vr instanceof br.BinaryReader?Vr:new br.BinaryReader(Vr);let Qr=Zr===void 0?Jr.len:Jr.pos+Zr;const _n=wr();for(;Jr.pos>>3){case 1:{if(En!==10)break;_n.ciphertext=Jr.string();continue}case 2:{if(En!==18)break;_n.salt=Jr.string();continue}case 3:{if(En!==26)break;_n.nonce=Jr.string();continue}case 4:{if(En!==34)break;_n.version=Jr.string();continue}case 5:{if(En!==42)break;_n.preKey=Jr.string();continue}}if((En&7)===4||En===0)break;Jr.skip(En&7)}return _n},fromJSON(Vr){return{ciphertext:Gr(Vr.ciphertext)?globalThis.String(Vr.ciphertext):"",salt:Gr(Vr.salt)?globalThis.String(Vr.salt):"",nonce:Gr(Vr.nonce)?globalThis.String(Vr.nonce):"",version:Gr(Vr.version)?globalThis.String(Vr.version):"",preKey:Gr(Vr.preKey)?globalThis.String(Vr.preKey):""}},toJSON(Vr){const Zr={};return Vr.ciphertext!==""&&(Zr.ciphertext=Vr.ciphertext),Vr.salt!==""&&(Zr.salt=Vr.salt),Vr.nonce!==""&&(Zr.nonce=Vr.nonce),Vr.version!==""&&(Zr.version=Vr.version),Vr.preKey!==""&&(Zr.preKey=Vr.preKey),Zr},create(Vr){return fr.EncryptedText.fromPartial(Vr??{})},fromPartial(Vr){var Zr,Jr,Qr,_n,En;const Cn=wr();return Cn.ciphertext=(Zr=Vr.ciphertext)!==null&&Zr!==void 0?Zr:"",Cn.salt=(Jr=Vr.salt)!==null&&Jr!==void 0?Jr:"",Cn.nonce=(Qr=Vr.nonce)!==null&&Qr!==void 0?Qr:"",Cn.version=(_n=Vr.version)!==null&&_n!==void 0?_n:"",Cn.preKey=(En=Vr.preKey)!==null&&En!==void 0?En:"",Cn}};function Er(){return{encDerivedPrivKey:void 0,signature:new Uint8Array(0)}}fr.WalletToEncDerivedKey={encode(Vr,Zr=new br.BinaryWriter){return Vr.encDerivedPrivKey!==void 0&&fr.EncryptedText.encode(Vr.encDerivedPrivKey,Zr.uint32(10).fork()).join(),Vr.signature.length!==0&&Zr.uint32(18).bytes(Vr.signature),Zr},decode(Vr,Zr){const Jr=Vr instanceof br.BinaryReader?Vr:new br.BinaryReader(Vr);let Qr=Zr===void 0?Jr.len:Jr.pos+Zr;const _n=Er();for(;Jr.pos>>3){case 1:{if(En!==10)break;_n.encDerivedPrivKey=fr.EncryptedText.decode(Jr,Jr.uint32());continue}case 2:{if(En!==18)break;_n.signature=Jr.bytes();continue}}if((En&7)===4||En===0)break;Jr.skip(En&7)}return _n},fromJSON(Vr){return{encDerivedPrivKey:Gr(Vr.encDerivedPrivKey)?fr.EncryptedText.fromJSON(Vr.encDerivedPrivKey):void 0,signature:Gr(Vr.signature)?Br(Vr.signature):new Uint8Array(0)}},toJSON(Vr){const Zr={};return Vr.encDerivedPrivKey!==void 0&&(Zr.encDerivedPrivKey=fr.EncryptedText.toJSON(Vr.encDerivedPrivKey)),Vr.signature.length!==0&&(Zr.signature=Wr(Vr.signature)),Zr},create(Vr){return fr.WalletToEncDerivedKey.fromPartial(Vr??{})},fromPartial(Vr){var Zr;const Jr=Er();return Jr.encDerivedPrivKey=Vr.encDerivedPrivKey!==void 0&&Vr.encDerivedPrivKey!==null?fr.EncryptedText.fromPartial(Vr.encDerivedPrivKey):void 0,Jr.signature=(Zr=Vr.signature)!==null&&Zr!==void 0?Zr:new Uint8Array(0),Jr}};function kr(){return{masterPubKey:"",derivedKeyIndex:0,derivedPubKey:"",walletToEncDerivedKey:{}}}fr.InitDid={encode(Vr,Zr=new br.BinaryWriter){return Vr.masterPubKey!==""&&Zr.uint32(10).string(Vr.masterPubKey),Vr.derivedKeyIndex!==0&&Zr.uint32(16).uint32(Vr.derivedKeyIndex),Vr.derivedPubKey!==""&&Zr.uint32(26).string(Vr.derivedPubKey),Object.entries(Vr.walletToEncDerivedKey).forEach(([Jr,Qr])=>{fr.InitDid_WalletToEncDerivedKeyEntry.encode({key:Jr,value:Qr},Zr.uint32(34).fork()).join()}),Zr},decode(Vr,Zr){const Jr=Vr instanceof br.BinaryReader?Vr:new br.BinaryReader(Vr);let Qr=Zr===void 0?Jr.len:Jr.pos+Zr;const _n=kr();for(;Jr.pos>>3){case 1:{if(En!==10)break;_n.masterPubKey=Jr.string();continue}case 2:{if(En!==16)break;_n.derivedKeyIndex=Jr.uint32();continue}case 3:{if(En!==26)break;_n.derivedPubKey=Jr.string();continue}case 4:{if(En!==34)break;const Cn=fr.InitDid_WalletToEncDerivedKeyEntry.decode(Jr,Jr.uint32());Cn.value!==void 0&&(_n.walletToEncDerivedKey[Cn.key]=Cn.value);continue}}if((En&7)===4||En===0)break;Jr.skip(En&7)}return _n},fromJSON(Vr){return{masterPubKey:Gr(Vr.masterPubKey)?globalThis.String(Vr.masterPubKey):"",derivedKeyIndex:Gr(Vr.derivedKeyIndex)?globalThis.Number(Vr.derivedKeyIndex):0,derivedPubKey:Gr(Vr.derivedPubKey)?globalThis.String(Vr.derivedPubKey):"",walletToEncDerivedKey:qr(Vr.walletToEncDerivedKey)?Object.entries(Vr.walletToEncDerivedKey).reduce((Zr,[Jr,Qr])=>(Zr[Jr]=fr.WalletToEncDerivedKey.fromJSON(Qr),Zr),{}):{}}},toJSON(Vr){const Zr={};if(Vr.masterPubKey!==""&&(Zr.masterPubKey=Vr.masterPubKey),Vr.derivedKeyIndex!==0&&(Zr.derivedKeyIndex=Math.round(Vr.derivedKeyIndex)),Vr.derivedPubKey!==""&&(Zr.derivedPubKey=Vr.derivedPubKey),Vr.walletToEncDerivedKey){const Jr=Object.entries(Vr.walletToEncDerivedKey);Jr.length>0&&(Zr.walletToEncDerivedKey={},Jr.forEach(([Qr,_n])=>{Zr.walletToEncDerivedKey[Qr]=fr.WalletToEncDerivedKey.toJSON(_n)}))}return Zr},create(Vr){return fr.InitDid.fromPartial(Vr??{})},fromPartial(Vr){var Zr,Jr,Qr,_n;const En=kr();return En.masterPubKey=(Zr=Vr.masterPubKey)!==null&&Zr!==void 0?Zr:"",En.derivedKeyIndex=(Jr=Vr.derivedKeyIndex)!==null&&Jr!==void 0?Jr:0,En.derivedPubKey=(Qr=Vr.derivedPubKey)!==null&&Qr!==void 0?Qr:"",En.walletToEncDerivedKey=Object.entries((_n=Vr.walletToEncDerivedKey)!==null&&_n!==void 0?_n:{}).reduce((Cn,[In,An])=>(An!==void 0&&(Cn[In]=fr.WalletToEncDerivedKey.fromPartial(An)),Cn),{}),En}};function jr(){return{key:"",value:void 0}}fr.InitDid_WalletToEncDerivedKeyEntry={encode(Vr,Zr=new br.BinaryWriter){return Vr.key!==""&&Zr.uint32(10).string(Vr.key),Vr.value!==void 0&&fr.WalletToEncDerivedKey.encode(Vr.value,Zr.uint32(18).fork()).join(),Zr},decode(Vr,Zr){const Jr=Vr instanceof br.BinaryReader?Vr:new br.BinaryReader(Vr);let Qr=Zr===void 0?Jr.len:Jr.pos+Zr;const _n=jr();for(;Jr.pos>>3){case 1:{if(En!==10)break;_n.key=Jr.string();continue}case 2:{if(En!==18)break;_n.value=fr.WalletToEncDerivedKey.decode(Jr,Jr.uint32());continue}}if((En&7)===4||En===0)break;Jr.skip(En&7)}return _n},fromJSON(Vr){return{key:Gr(Vr.key)?globalThis.String(Vr.key):"",value:Gr(Vr.value)?fr.WalletToEncDerivedKey.fromJSON(Vr.value):void 0}},toJSON(Vr){const Zr={};return Vr.key!==""&&(Zr.key=Vr.key),Vr.value!==void 0&&(Zr.value=fr.WalletToEncDerivedKey.toJSON(Vr.value)),Zr},create(Vr){return fr.InitDid_WalletToEncDerivedKeyEntry.fromPartial(Vr??{})},fromPartial(Vr){var Zr;const Jr=jr();return Jr.key=(Zr=Vr.key)!==null&&Zr!==void 0?Zr:"",Jr.value=Vr.value!==void 0&&Vr.value!==null?fr.WalletToEncDerivedKey.fromPartial(Vr.value):void 0,Jr}};function Br(Vr){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(Vr,"base64"));{const Zr=globalThis.atob(Vr),Jr=new Uint8Array(Zr.length);for(let Qr=0;Qr{Zr.push(globalThis.String.fromCharCode(Jr))}),globalThis.btoa(Zr.join(""))}}function qr(Vr){return typeof Vr=="object"&&Vr!==null}function Gr(Vr){return Vr!=null}}(init_did)),init_did}var init_session_key={},hasRequiredInit_session_key;function requireInit_session_key(){return hasRequiredInit_session_key||(hasRequiredInit_session_key=1,function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.InitSessionKey=fr.KeyAction=fr.protobufPackage=void 0,fr.keyActionFromJSON=Er,fr.keyActionToJSON=kr;const br=requireWire();fr.protobufPackage="push";var wr;(function(Wr){Wr[Wr.PUBLISH_KEY=0]="PUBLISH_KEY",Wr[Wr.REVOKE_KEY=1]="REVOKE_KEY",Wr[Wr.UNRECOGNIZED=-1]="UNRECOGNIZED"})(wr||(fr.KeyAction=wr={}));function Er(Wr){switch(Wr){case 0:case"PUBLISH_KEY":return wr.PUBLISH_KEY;case 1:case"REVOKE_KEY":return wr.REVOKE_KEY;case-1:case"UNRECOGNIZED":default:return wr.UNRECOGNIZED}}function kr(Wr){switch(Wr){case wr.PUBLISH_KEY:return"PUBLISH_KEY";case wr.REVOKE_KEY:return"REVOKE_KEY";case wr.UNRECOGNIZED:default:return"UNRECOGNIZED"}}function jr(){return{keyIndex:0,keyAddress:"",action:0}}fr.InitSessionKey={encode(Wr,qr=new br.BinaryWriter){return Wr.keyIndex!==0&&qr.uint32(8).int32(Wr.keyIndex),Wr.keyAddress!==""&&qr.uint32(18).string(Wr.keyAddress),Wr.action!==0&&qr.uint32(24).int32(Wr.action),qr},decode(Wr,qr){const Gr=Wr instanceof br.BinaryReader?Wr:new br.BinaryReader(Wr);let Vr=qr===void 0?Gr.len:Gr.pos+qr;const Zr=jr();for(;Gr.pos>>3){case 1:{if(Jr!==8)break;Zr.keyIndex=Gr.int32();continue}case 2:{if(Jr!==18)break;Zr.keyAddress=Gr.string();continue}case 3:{if(Jr!==24)break;Zr.action=Gr.int32();continue}}if((Jr&7)===4||Jr===0)break;Gr.skip(Jr&7)}return Zr},fromJSON(Wr){return{keyIndex:Br(Wr.keyIndex)?globalThis.Number(Wr.keyIndex):0,keyAddress:Br(Wr.keyAddress)?globalThis.String(Wr.keyAddress):"",action:Br(Wr.action)?Er(Wr.action):0}},toJSON(Wr){const qr={};return Wr.keyIndex!==0&&(qr.keyIndex=Math.round(Wr.keyIndex)),Wr.keyAddress!==""&&(qr.keyAddress=Wr.keyAddress),Wr.action!==0&&(qr.action=kr(Wr.action)),qr},create(Wr){return fr.InitSessionKey.fromPartial(Wr??{})},fromPartial(Wr){var qr,Gr,Vr;const Zr=jr();return Zr.keyIndex=(qr=Wr.keyIndex)!==null&&qr!==void 0?qr:0,Zr.keyAddress=(Gr=Wr.keyAddress)!==null&&Gr!==void 0?Gr:"",Zr.action=(Vr=Wr.action)!==null&&Vr!==void 0?Vr:0,Zr}};function Br(Wr){return Wr!=null}}(init_session_key)),init_session_key}function setBigUint64$1(fr,br,wr,Er){if(typeof fr.setBigUint64=="function")return fr.setBigUint64(br,wr,Er);const kr=BigInt(32),jr=BigInt(4294967295),Br=Number(wr>>kr&jr),Wr=Number(wr&jr),qr=Er?4:0,Gr=Er?0:4;fr.setUint32(br+qr,Br,Er),fr.setUint32(br+Gr,Wr,Er)}const Chi$1=(fr,br,wr)=>fr&br^~fr&wr,Maj$1=(fr,br,wr)=>fr&br^fr&wr^br≀let HashMD$1=class extends Hash$2{constructor(br,wr,Er,kr){super(),this.blockLen=br,this.outputLen=wr,this.padOffset=Er,this.isLE=kr,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(br),this.view=createView$1(this.buffer)}update(br){aexists$1(this);const{view:wr,buffer:Er,blockLen:kr}=this;br=toBytes$1(br);const jr=br.length;for(let Br=0;Brkr-Br&&(this.process(Er,0),Br=0);for(let Zr=Br;ZrVr.length)throw new Error("_sha2: outputLen bigger than state");for(let Zr=0;Zr>>3,En=rotr$1(Qr,17)^rotr$1(Qr,19)^Qr>>>10;SHA256_W$1[Zr]=En+SHA256_W$1[Zr-7]+_n+SHA256_W$1[Zr-16]|0}let{A:Er,B:kr,C:jr,D:Br,E:Wr,F:qr,G:Gr,H:Vr}=this;for(let Zr=0;Zr<64;Zr++){const Jr=rotr$1(Wr,6)^rotr$1(Wr,11)^rotr$1(Wr,25),Qr=Vr+Jr+Chi$1(Wr,qr,Gr)+SHA256_K$1[Zr]+SHA256_W$1[Zr]|0,En=(rotr$1(Er,2)^rotr$1(Er,13)^rotr$1(Er,22))+Maj$1(Er,kr,jr)|0;Vr=Gr,Gr=qr,qr=Wr,Wr=Br+Qr|0,Br=jr,jr=kr,kr=Er,Er=Qr+En|0}Er=Er+this.A|0,kr=kr+this.B|0,jr=jr+this.C|0,Br=Br+this.D|0,Wr=Wr+this.E|0,qr=qr+this.F|0,Gr=Gr+this.G|0,Vr=Vr+this.H|0,this.set(Er,kr,jr,Br,Wr,qr,Gr,Vr)}roundClean(){SHA256_W$1.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};class SHA224 extends SHA256$1{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}const sha256$4=wrapConstructor$1(()=>new SHA256$1),sha224$2=wrapConstructor$1(()=>new SHA224),sha256$5=Object.freeze(Object.defineProperty({__proto__:null,SHA256:SHA256$1,sha224:sha224$2,sha256:sha256$4},Symbol.toStringTag,{value:"Module"})),require$$8=getAugmentedNamespace(sha256$5);var hasRequiredTx;function requireTx(){if(hasRequiredTx)return tx;hasRequiredTx=1;var fr;Object.defineProperty(tx,"__esModule",{value:!0}),tx.Tx=void 0;const br=require$$0$b,wr=requireCommonjsBrowser(),Er=require$$0$a,kr=requireTx_types(),jr=requireTx$1(),Br=requireInit_did(),Wr=requireInit_session_key(),qr=requireValidator(),Gr=require$$8,Vr=require$$1$4;class Zr{constructor(Qr,_n){this.validator=Qr,this.env=_n,this.createUnsigned=(En,Cn,In)=>jr.Transaction.create({type:0,category:En,recipients:Cn,data:In,salt:(0,wr.parse)((0,wr.v4)()),fee:"0"}),this.get=(...En)=>br.__awaiter(this,[...En],void 0,function*(Cn=Math.floor(Date.now()),In="DESC",An=30,jn=1,eo,ro){return eo===void 0?yield this.validator.call("push_getTransactions",[Cn,In,An,jn,ro]):yield this.validator.call("push_getTransactionsByUser",[eo,Cn,In,An,jn,ro])}),this.getBySender=(En,...Cn)=>br.__awaiter(this,[En,...Cn],void 0,function*(In,An=Math.floor(Date.now()/1e3),jn="ASC",eo=30,ro=1,to){return yield this.validator.call("push_getTransactionsBySender",[In,An,jn,eo,ro,to])}),this.getByRecipient=(En,...Cn)=>br.__awaiter(this,[En,...Cn],void 0,function*(In,An=Math.floor(Date.now()/1e3),jn="ASC",eo=30,ro=1,to){return yield this.validator.call("push_getTransactionsByRecipient",[In,An,jn,eo,ro,to])}),this.search=En=>br.__awaiter(this,void 0,void 0,function*(){return yield this.validator.call("push_getTransactionByHash",[En])}),this.send=(En,Cn)=>br.__awaiter(this,void 0,void 0,function*(){const In=yield this.validator.call("push_getApiToken"),An=fr.serialize(Object.assign(Object.assign({},En),{sender:Cn.account,signature:new Uint8Array(0),apiToken:(0,Er.utf8ToBytes)(In.apiToken)})),jn=new TextEncoder().encode((0,Vr.toHex)((0,Gr.sha256)(An))),eo=yield Cn.signMessage(jn),ro=fr.serialize(Object.assign(Object.assign({},fr.deserialize(An)),{signature:eo}));return yield this.validator.call("push_sendTransaction",[(0,Er.bytesToHex)(ro)],In.apiUrl)})}getTransactionsFromVNode(Qr,_n){return br.__awaiter(this,arguments,void 0,function*(En,Cn,In=""+Math.floor(Date.now()/1e3),An="DESC"){return yield this.validator.callVNode("push_getTransactions",[En,Cn,In,An])})}}return tx.Tx=Zr,fr=Zr,Zr.initialize=Jr=>br.__awaiter(void 0,void 0,void 0,function*(){const Qr=yield qr.Validator.initalize({env:Jr});return new fr(Qr,Jr)}),Zr.serialize=Jr=>{const Qr=jr.Transaction.create(Jr);return jr.Transaction.encode(Qr).finish()},Zr.deserialize=Jr=>jr.Transaction.decode(Jr),Zr.serializeData=(Jr,Qr)=>{switch(Qr){case kr.TxCategory.INIT_DID:{const _n=Jr,En=Br.InitDid.create(_n);return Br.InitDid.encode(En).finish()}case kr.TxCategory.INIT_SESSION_KEY:{const _n=Jr,En=Wr.InitSessionKey.create(_n);return Wr.InitSessionKey.encode(En).finish()}default:throw new Error("Serialization Not Supported for given TxCateory")}},Zr.deserializeData=(Jr,Qr)=>{switch(Qr){case kr.TxCategory.INIT_DID:return Br.InitDid.decode(Jr);case kr.TxCategory.INIT_SESSION_KEY:return Wr.InitSessionKey.decode(Jr);default:throw new Error("Deserialization Not Supported for given TxCateory")}},tx}var wallet={},wallet_types={},hasRequiredWallet_types;function requireWallet_types(){if(hasRequiredWallet_types)return wallet_types;hasRequiredWallet_types=1,Object.defineProperty(wallet_types,"__esModule",{value:!0}),wallet_types.ACTION=void 0;var fr;return function(br){br.IS_CONNECTED="isConnected",br.REQ_TO_CONNECT="reqToConnect",br.REQ_TO_SIGN="reqToSign",br.REQ_WALLET_DETAILS="reqWalletDetails",br.ERROR="error",br.CONNECTION_STATUS="connectionStatus",br.WALLET_DETAILS="walletDetails",br.SIGNATURE="signature"}(fr||(wallet_types.ACTION=fr={})),wallet_types}var hasRequiredWallet;function requireWallet(){if(hasRequiredWallet)return wallet;hasRequiredWallet=1,Object.defineProperty(wallet,"__esModule",{value:!0}),wallet.Wallet=void 0;const fr=require$$0$b,br=requireConfig(),wr=requireWallet_types();class Er{constructor(jr){this.env=jr,this.walletWindow=null,this.connect=()=>fr.__awaiter(this,void 0,void 0,function*(){return yield this.openWalletWindow(),yield this.requestWalletAddress()}),this.sign=Br=>fr.__awaiter(this,void 0,void 0,function*(){yield this.openWalletWindow();const{isPending:Wr,isConnected:qr}=yield this.appConnectionStatus();if(!qr)throw Wr?Error("App Connection Request is Pending. Accept App Connection Request in Push Wallet to enable signing !!!"):(yield this.requestAppConnection(),Error("App not Connected. Accept App Connection Request in Push Wallet to enable signing !!!"));return new Promise((Gr,Vr)=>{window.addEventListener("message",function Zr(Jr){Jr.data.action===wr.ACTION.SIGNATURE?(window.removeEventListener("message",Zr),Gr(Jr.data.signature)):Jr.data.action===wr.ACTION.ERROR&&(window.removeEventListener("message",Zr),Vr(Jr.data.error))}),this.walletWindow.postMessage({action:wr.ACTION.REQ_TO_SIGN,data:Br},br.default.WALLET_URL[this.env])})}),this.appConnectionStatus=()=>new Promise((Br,Wr)=>{var qr;window.addEventListener("message",function Gr(Vr){Vr.data.action===wr.ACTION.CONNECTION_STATUS?(window.removeEventListener("message",Gr),Br(Vr.data)):Vr.data.action===wr.ACTION.ERROR&&(window.removeEventListener("message",Gr),Wr(Vr.data.error))}),(qr=this.walletWindow)===null||qr===void 0||qr.postMessage({action:wr.ACTION.IS_CONNECTED},br.default.WALLET_URL[this.env])}),this.requestAppConnection=()=>new Promise((Br,Wr)=>{var qr;window.addEventListener("message",function Gr(Vr){Vr.data.action===wr.ACTION.CONNECTION_STATUS?(window.removeEventListener("message",Gr),Br(Vr.data)):Vr.data.action===wr.ACTION.ERROR&&(window.removeEventListener("message",Gr),Wr(Vr.data.error))}),(qr=this.walletWindow)===null||qr===void 0||qr.postMessage({action:wr.ACTION.REQ_TO_CONNECT},br.default.WALLET_URL[this.env])}),this.openWalletWindow=()=>fr.__awaiter(this,void 0,void 0,function*(){if(!this.walletWindow||this.walletWindow.closed){if(this.walletWindow=window.open(br.default.WALLET_URL[this.env],"_blank"),!this.walletWindow)throw new Error("Failed to open wallet window");yield new Promise(Br=>setTimeout(Br,2e3))}}),this.requestWalletAddress=()=>new Promise((Br,Wr)=>{var qr;window.addEventListener("message",function Gr(Vr){Vr.data.action===wr.ACTION.WALLET_DETAILS?(window.removeEventListener("message",Gr),Br(Vr.data.address)):Vr.data.action===wr.ACTION.ERROR&&(window.removeEventListener("message",Gr),Wr(Vr.data.error))}),(qr=this.walletWindow)===null||qr===void 0||qr.postMessage({action:wr.ACTION.REQ_WALLET_DETAILS},br.default.WALLET_URL[this.env])})}}return wallet.Wallet=Er,wallet}var hasRequiredPushNetwork;function requirePushNetwork(){if(hasRequiredPushNetwork)return pushNetwork;hasRequiredPushNetwork=1;var fr;Object.defineProperty(pushNetwork,"__esModule",{value:!0}),pushNetwork.PushNetwork=void 0;const br=require$$0$b,wr=requireBlock(),Er=requireConstants$3(),kr=requireTx(),jr=requireWallet();class Br{constructor(qr,Gr,Vr){this.block=qr,this.tx=Gr,this.wallet=Vr}}return pushNetwork.PushNetwork=Br,fr=Br,Br.initialize=(...Wr)=>br.__awaiter(void 0,[...Wr],void 0,function*(qr=Er.ENV.STAGING){const Gr=yield wr.Block.initialize(qr),Vr=yield kr.Tx.initialize(qr),Zr=new jr.Wallet(qr);return new fr(Gr,Vr,Zr)}),pushNetwork}var address={},dist$1={},hasRequiredDist;function requireDist(){if(hasRequiredDist)return dist$1;hasRequiredDist=1,Object.defineProperty(dist$1,"__esModule",{value:!0}),dist$1.bech32m=dist$1.bech32=void 0;const fr="qpzry9x8gf2tvdw0s3jn54khce6mua7l",br={};for(let Gr=0;Gr>25;return(Gr&33554431)<<5^-(Vr>>0&1)&996825010^-(Vr>>1&1)&642813549^-(Vr>>2&1)&513874426^-(Vr>>3&1)&1027748829^-(Vr>>4&1)&705979059}function Er(Gr){let Vr=1;for(let Zr=0;Zr126)return"Invalid prefix ("+Gr+")";Vr=wr(Vr)^Jr>>5}Vr=wr(Vr);for(let Zr=0;Zr=Zr;)_n-=Zr,Cn.push(Qr>>_n&En);if(Jr)_n>0&&Cn.push(Qr<=Vr)return"Excess padding";if(Qr<In)throw new TypeError("Exceeds length limit");En=En.toLowerCase();let An=Er(En);if(typeof An=="string")throw new Error(An);let jn=En+"1";for(let eo=0;eo>5)throw new Error("Non 5-bit word");An=wr(An)^ro,jn+=fr.charAt(ro)}for(let eo=0;eo<6;++eo)An=wr(An);An^=Vr;for(let eo=0;eo<6;++eo){const ro=An>>(5-eo)*5&31;jn+=fr.charAt(ro)}return jn}function Jr(En,Cn){if(Cn=Cn||90,En.length<8)return En+" too short";if(En.length>Cn)return"Exceeds length limit";const In=En.toLowerCase(),An=En.toUpperCase();if(En!==In&&En!==An)return"Mixed-case string "+En;En=In;const jn=En.lastIndexOf("1");if(jn===-1)return"No separator character for "+En;if(jn===0)return"Missing prefix for "+En;const eo=En.slice(0,jn),ro=En.slice(jn+1);if(ro.length<6)return"Data too short";let to=Er(eo);if(typeof to=="string")return to;const _i=[];for(let oo=0;oo=ro.length)&&_i.push(co)}return to!==Vr?"Invalid checksum for "+En:{prefix:eo,words:_i}}function Qr(En,Cn){const In=Jr(En,Cn);if(typeof In=="object")return In}function _n(En,Cn){const In=Jr(En,Cn);if(typeof In=="object")return In;throw new Error(In)}return{decodeUnsafe:Qr,decode:_n,encode:Zr,toWords:jr,fromWordsUnsafe:Br,fromWords:Wr}}return dist$1.bech32=qr("bech32"),dist$1.bech32m=qr("bech32m"),dist$1}var address_types={},hasRequiredAddress_types;function requireAddress_types(){if(hasRequiredAddress_types)return address_types;hasRequiredAddress_types=1,Object.defineProperty(address_types,"__esModule",{value:!0}),address_types.PUSH_NETWORK=void 0;var fr;return function(br){br.DEVNET="devnet",br.TESTNET="testnet",br.MAINNET="mainnet"}(fr||(address_types.PUSH_NETWORK=fr={})),address_types}var hasRequiredAddress;function requireAddress(){if(hasRequiredAddress)return address;hasRequiredAddress=1,Object.defineProperty(address,"__esModule",{value:!0}),address.Address=void 0;const fr=require$$0$a,br=require$$1$4,wr=requireDist(),Er=requireConstants$3(),kr=requireAddress_types(),jr="push";class Br{}return address.Address=Br,Br.evmToPush=(Wr,qr=jr)=>{try{const Gr=wr.bech32m.toWords((0,fr.hexToBytes)((0,br.getAddress)(Wr).slice(2)));return wr.bech32m.encode(qr,Gr)}catch{throw new Error("Invalid EVM address")}},Br.pushToEvm=Wr=>{try{const qr=wr.bech32m.decode(Wr),Gr=new Uint8Array(wr.bech32m.fromWords(qr.words));return(0,br.getAddress)(`0x${(0,fr.bytesToHex)(Gr)}`)}catch{throw new Error("Invalid Push address")}},Br.toPushCAIP=(Wr,qr=Er.ENV.STAGING)=>{let Gr;switch(qr){case Er.ENV.LOCAL:case Er.ENV.DEV:{Gr=kr.PUSH_NETWORK.DEVNET;break}case Er.ENV.STAGING:{Gr=kr.PUSH_NETWORK.TESTNET;break}case Er.ENV.PROD:{Gr=kr.PUSH_NETWORK.MAINNET;break}default:throw Error("Invalid ENV")}const Vr=Wr.startsWith(jr)?Wr:Br.evmToPush(Wr);return`push:${Gr}:${Vr}`},Br.toCAIP=(Wr,qr)=>{const Gr=Wr.startsWith(jr)?"push":Wr.startsWith("0x")?"eip155":"solana";if(Gr==="eip155"&&typeof qr!="number")throw new Error("Invalid network for EIP155 address");if((Gr==="push"||Gr==="solana")&&typeof qr=="number")throw new Error(`Invalid network for ${Gr} address`);const Zr={mainnet:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",devnet:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1",testnet:"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"}[qr];return Gr==="solana"?`${Gr}:${Zr}:${Wr}`:`${Gr}:${qr}:${Wr}`},address}var hasRequiredLib;function requireLib(){return hasRequiredLib||(hasRequiredLib=1,function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.PushNetwork=fr.Address=fr.Validator=fr.Tx=fr.Block=fr.CONSTANTS=void 0;const br=requirePushNetwork();Object.defineProperty(fr,"PushNetwork",{enumerable:!0,get:function(){return br.PushNetwork}});const wr=requireBlock();Object.defineProperty(fr,"Block",{enumerable:!0,get:function(){return wr.Block}});const Er=requireTx();Object.defineProperty(fr,"Tx",{enumerable:!0,get:function(){return Er.Tx}});const kr=requireValidator();Object.defineProperty(fr,"Validator",{enumerable:!0,get:function(){return kr.Validator}});const jr=requireAddress();Object.defineProperty(fr,"Address",{enumerable:!0,get:function(){return jr.Address}});const Br=requireConstants$3();Object.defineProperty(fr,"CONSTANTS",{enumerable:!0,get:function(){return Br.CONSTANTS}})}(lib$1)),lib$1}(function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),require$$0$b.__exportStar(requireLib(),fr)})(src$5);const config$5={},config$4={APP_NAME:"Push Local Wallet",NODE_ENV:"local",APP_ENV:"local",ALLOWED_NETWORKS:[11155111,80002,97,11155420,2442,421614,123,111557560],DEFAULT_CHAIN:11155111},config$3={APP_NAME:"Push Devnet Wallet",NODE_ENV:"dev",APP_ENV:"dev",ALLOWED_NETWORKS:[11155111,80002,97,11155420,2442,421614,123,111557560],DEFAULT_CHAIN:11155111},config$2={APP_NAME:"Push Testnet Wallet",NODE_ENV:"staging",APP_ENV:"staging",ALLOWED_NETWORKS:[11155111,80002,97,11155420,2442,421614,123,111557560],DEFAULT_CHAIN:11155111},config$1={APP_NAME:"Push Wallet",NODE_ENV:"prod",APP_ENV:"prod",ALLOWED_NETWORKS:[1,137,56,10,42161,1101,122,7560],DEFAULT_CHAIN:1},env$1="dev";let dynamicConfig;switch(env$1){case ENV.LOCAL:{dynamicConfig=config$4;break}case ENV.DEV:{dynamicConfig=config$3;break}case ENV.STAGING:{dynamicConfig=config$2;break}case ENV.PROD:{dynamicConfig=config$1;break}default:dynamicConfig=config$2}const config={...dynamicConfig,...config$5},getWalletlist=fr=>{const br=[];return fr!=null&&fr.length&&(fr==null||fr.forEach((wr,Er)=>{let kr={};wr.includes("push")?kr={name:"Push Account",address:wr,fullAddress:wr,isSelected:!1,type:"push"}:kr={name:`Account ${Er+1}`,address:wr.split(":")[2],fullAddress:wr,isSelected:!1,type:"metamask"},br.push(kr)})),br.reverse(),br};function formatWalletCategory(fr){const br=fr.match(/^CUSTOM:(.+)$/);if(br&&br[1]){let Er=br[1].toLowerCase().replace(/_/g," ").replace(/\b\w/g,kr=>kr.toUpperCase());return Er.length>15&&(Er=Er.slice(0,15).trim()+"..."),Er}}const getFixedTime=fr=>{const br=Date.now(),wr=Math.floor((br-fr)/1e3);if(wr<60)return`${wr}s ago`;const Er=Math.floor(wr/60);if(Er<60)return`${Er}m ago`;const kr=Math.floor(Er/60);if(kr<24)return`${kr}h ago`;const jr=Math.floor(kr/24);if(jr<7)return`${jr}d ago`;const Br=Math.floor(jr/7);if(Br<4)return`${Br}w ago`;const Wr=Math.floor(Br/4);return Wr<12?`${Wr}m ago`:`${Math.floor(Wr/12)}y ago`},convertCaipToObject=fr=>{if(!fr||typeof fr!="string")return{result:{chain:null,chainId:null,address:null}};const br=fr.split(":");return br.length===3?{result:{chain:br[0],chainId:br[1],address:br[2]}}:br.length===2?{result:{chain:br[0],chainId:null,address:br[1]}}:{result:{chain:null,chainId:null,address:fr}}},WalletActivityListItem=({transaction:fr,address:br})=>{function wr(kr){if(kr==="devnet")return jsxRuntimeExports.jsx(PushMonotone,{size:20});const jr=CHAIN_LOGO[1];return jr?jsxRuntimeExports.jsx(jr,{size:20,color:"icon-tertiary"}):jsxRuntimeExports.jsx(DefaultChainMonotone,{size:20})}function Er(kr){let jr="",Br=0;if(br===kr.sender){const qr=kr.recipients.recipients;jr=qr[0].address,Br=qr.length-1}else kr.recipients.recipients.some(qr=>qr.address===br)&&(jr=kr.sender);const{result:Wr}=convertCaipToObject(jr);return jsxRuntimeExports.jsxs(Box,{display:"flex",gap:"spacing-xxs",alignItems:"center",children:[jsxRuntimeExports.jsx(Box,{height:"16px",width:"16px",backgroundColor:"surface-tertiary",borderRadius:"radius-xxxs",display:"flex",alignItems:"center",justifyContent:"center",children:jsxRuntimeExports.jsx(Text,{color:"text-tertiary",variant:"os-bold",css:Ae$2` font-size: 8px; padding-top: 1px; `,children:Wr.chainId&&wr(Wr.chainId)})}),jsxRuntimeExports.jsx(Text,{color:"text-secondary",variant:"bes-semibold",children:centerMaskWalletAddress(jr)}),jsxRuntimeExports.jsx(Text,{color:"text-tertiary",variant:"bes-semibold",children:Br==0&&` +${Br} more`})]})}return jsxRuntimeExports.jsxs(Box,{display:"flex",justifyContent:"space-between",padding:"spacing-sm spacing-xxxs",css:Ae$2` @@ -3760,9 +3762,9 @@ zebra zero zone zoo`.split(` -`),Rho=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Id=new Uint8Array(new Array(16).fill(0).map((fr,br)=>br)),Pi=Id.map(fr=>(9*fr+5)%16);let idxL=[Id],idxR=[Pi];for(let fr=0;fr<4;fr++)for(let br of[idxL,idxR])br.push(br[fr].map(wr=>Rho[wr]));const shifts=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(fr=>new Uint8Array(fr)),shiftsL=idxL.map((fr,br)=>fr.map(wr=>shifts[br][wr])),shiftsR=idxR.map((fr,br)=>fr.map(wr=>shifts[br][wr])),Kl=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Kr=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);function f$7(fr,br,wr,Er){return fr===0?br^wr^Er:fr===1?br&wr|~br&Er:fr===2?(br|~wr)^Er:fr===3?br&Er|wr&~Er:br^(wr|~Er)}const R_BUF=new Uint32Array(16);class RIPEMD160 extends HashMD$1{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:br,h1:wr,h2:Er,h3:kr,h4:jr}=this;return[br,wr,Er,kr,jr]}set(br,wr,Er,kr,jr){this.h0=br|0,this.h1=wr|0,this.h2=Er|0,this.h3=kr|0,this.h4=jr|0}process(br,wr){for(let Qr=0;Qr<16;Qr++,wr+=4)R_BUF[Qr]=br.getUint32(wr,!0);let Er=this.h0|0,kr=Er,jr=this.h1|0,Br=jr,Wr=this.h2|0,qr=Wr,Gr=this.h3|0,Vr=Gr,Zr=this.h4|0,Jr=Zr;for(let Qr=0;Qr<5;Qr++){const _n=4-Qr,En=Kl[Qr],Cn=Kr[Qr],In=idxL[Qr],An=idxR[Qr],jn=shiftsL[Qr],eo=shiftsR[Qr];for(let ro=0;ro<16;ro++){const to=rotl(Er+f$7(Qr,jr,Wr,Gr)+R_BUF[In[ro]]+En,jn[ro])+Zr|0;Er=Zr,Zr=Gr,Gr=rotl(Wr,10)|0,Wr=jr,jr=to}for(let ro=0;ro<16;ro++){const to=rotl(kr+f$7(_n,Br,qr,Vr)+R_BUF[An[ro]]+Cn,eo[ro])+Jr|0;kr=Jr,Jr=Vr,Vr=rotl(qr,10)|0,qr=Br,Br=to}}this.set(this.h1+Wr+Vr|0,this.h2+Gr+Jr|0,this.h3+Zr+kr|0,this.h4+Er+Br|0,this.h0+jr+qr|0)}roundClean(){R_BUF.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const ripemd160$1=wrapConstructor$1(()=>new RIPEMD160);function anumber$1(fr){if(!Number.isSafeInteger(fr)||fr<0)throw new Error("positive integer expected, got "+fr)}function isBytes$3(fr){return fr instanceof Uint8Array||ArrayBuffer.isView(fr)&&fr.constructor.name==="Uint8Array"}function abytes$1(fr,...br){if(!isBytes$3(fr))throw new Error("Uint8Array expected");if(br.length>0&&!br.includes(fr.length))throw new Error("Uint8Array expected of length "+br+", got length="+fr.length)}function ahash(fr){if(typeof fr!="function"||typeof fr.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");anumber$1(fr.outputLen),anumber$1(fr.blockLen)}function aexists(fr,br=!0){if(fr.destroyed)throw new Error("Hash instance has been destroyed");if(br&&fr.finished)throw new Error("Hash#digest() has already been called")}function aoutput(fr,br){abytes$1(fr);const wr=br.outputLen;if(fr.lengthnew DataView(fr.buffer,fr.byteOffset,fr.byteLength),rotr=(fr,br)=>fr<<32-br|fr>>>br;function utf8ToBytes$1(fr){if(typeof fr!="string")throw new Error("utf8ToBytes expected string, got "+typeof fr);return new Uint8Array(new TextEncoder().encode(fr))}function toBytes(fr){return typeof fr=="string"&&(fr=utf8ToBytes$1(fr)),abytes$1(fr),fr}function concatBytes$1(...fr){let br=0;for(let Er=0;Erfr().update(toBytes(Er)).digest(),wr=fr();return br.outputLen=wr.outputLen,br.blockLen=wr.blockLen,br.create=()=>fr(),br}function randomBytes(fr=32){if(crypto$2&&typeof crypto$2.getRandomValues=="function")return crypto$2.getRandomValues(new Uint8Array(fr));if(crypto$2&&typeof crypto$2.randomBytes=="function")return crypto$2.randomBytes(fr);throw new Error("crypto.getRandomValues must be defined")}function setBigUint64(fr,br,wr,Er){if(typeof fr.setBigUint64=="function")return fr.setBigUint64(br,wr,Er);const kr=BigInt(32),jr=BigInt(4294967295),Br=Number(wr>>kr&jr),Wr=Number(wr&jr),qr=Er?4:0,Gr=Er?0:4;fr.setUint32(br+qr,Br,Er),fr.setUint32(br+Gr,Wr,Er)}const Chi=(fr,br,wr)=>fr&br^~fr&wr,Maj=(fr,br,wr)=>fr&br^fr&wr^br≀class HashMD extends Hash$1{constructor(br,wr,Er,kr){super(),this.blockLen=br,this.outputLen=wr,this.padOffset=Er,this.isLE=kr,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(br),this.view=createView(this.buffer)}update(br){aexists(this);const{view:wr,buffer:Er,blockLen:kr}=this;br=toBytes(br);const jr=br.length;for(let Br=0;Brkr-Br&&(this.process(Er,0),Br=0);for(let Zr=Br;ZrVr.length)throw new Error("_sha2: outputLen bigger than state");for(let Zr=0;Zr>>3,En=rotr(Qr,17)^rotr(Qr,19)^Qr>>>10;SHA256_W[Zr]=En+SHA256_W[Zr-7]+_n+SHA256_W[Zr-16]|0}let{A:Er,B:kr,C:jr,D:Br,E:Wr,F:qr,G:Gr,H:Vr}=this;for(let Zr=0;Zr<64;Zr++){const Jr=rotr(Wr,6)^rotr(Wr,11)^rotr(Wr,25),Qr=Vr+Jr+Chi(Wr,qr,Gr)+SHA256_K[Zr]+SHA256_W[Zr]|0,En=(rotr(Er,2)^rotr(Er,13)^rotr(Er,22))+Maj(Er,kr,jr)|0;Vr=Gr,Gr=qr,qr=Wr,Wr=Br+Qr|0,Br=jr,jr=kr,kr=Er,Er=Qr+En|0}Er=Er+this.A|0,kr=kr+this.B|0,jr=jr+this.C|0,Br=Br+this.D|0,Wr=Wr+this.E|0,qr=qr+this.F|0,Gr=Gr+this.G|0,Vr=Vr+this.H|0,this.set(Er,kr,jr,Br,Wr,qr,Gr,Vr)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const sha256$3=wrapConstructor(()=>new SHA256);let HMAC$1=class extends Hash$1{constructor(br,wr){super(),this.finished=!1,this.destroyed=!1,ahash(br);const Er=toBytes(wr);if(this.iHash=br.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const kr=this.blockLen,jr=new Uint8Array(kr);jr.set(Er.length>kr?br.create().update(Er).digest():Er);for(let Br=0;Brnew HMAC$1(fr,br).update(wr).digest();hmac$3.create=(fr,br)=>new HMAC$1(fr,br);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$4=BigInt(0),_1n$6=BigInt(1),_2n$4=BigInt(2);function isBytes$2(fr){return fr instanceof Uint8Array||ArrayBuffer.isView(fr)&&fr.constructor.name==="Uint8Array"}function abytes(fr){if(!isBytes$2(fr))throw new Error("Uint8Array expected")}function abool(fr,br){if(typeof br!="boolean")throw new Error(fr+" boolean expected, got "+br)}const hexes=Array.from({length:256},(fr,br)=>br.toString(16).padStart(2,"0"));function bytesToHex(fr){abytes(fr);let br="";for(let wr=0;wr=asciis._0&&fr<=asciis._9)return fr-asciis._0;if(fr>=asciis.A&&fr<=asciis.F)return fr-(asciis.A-10);if(fr>=asciis.a&&fr<=asciis.f)return fr-(asciis.a-10)}function hexToBytes(fr){if(typeof fr!="string")throw new Error("hex string expected, got "+typeof fr);const br=fr.length,wr=br/2;if(br%2)throw new Error("hex string expected, got unpadded hex of length "+br);const Er=new Uint8Array(wr);for(let kr=0,jr=0;krtypeof fr=="bigint"&&_0n$4<=fr;function inRange$1(fr,br,wr){return isPosBig(fr)&&isPosBig(br)&&isPosBig(wr)&&br<=fr&&fr_0n$4;fr>>=_1n$6,br+=1);return br}function bitGet(fr,br){return fr>>BigInt(br)&_1n$6}function bitSet(fr,br,wr){return fr|(wr?_1n$6:_0n$4)<(_2n$4<new Uint8Array(fr),u8fr=fr=>Uint8Array.from(fr);function createHmacDrbg(fr,br,wr){if(typeof fr!="number"||fr<2)throw new Error("hashLen must be a number");if(typeof br!="number"||br<2)throw new Error("qByteLen must be a number");if(typeof wr!="function")throw new Error("hmacFn must be a function");let Er=u8n(fr),kr=u8n(fr),jr=0;const Br=()=>{Er.fill(1),kr.fill(0),jr=0},Wr=(...Zr)=>wr(kr,Er,...Zr),qr=(Zr=u8n())=>{kr=Wr(u8fr([0]),Zr),Er=Wr(),Zr.length!==0&&(kr=Wr(u8fr([1]),Zr),Er=Wr())},Gr=()=>{if(jr++>=1e3)throw new Error("drbg: tried 1000 values");let Zr=0;const Jr=[];for(;Zr{Br(),qr(Zr);let Qr;for(;!(Qr=Jr(Gr()));)qr();return Br(),Qr}}const validatorFns={bigint:fr=>typeof fr=="bigint",function:fr=>typeof fr=="function",boolean:fr=>typeof fr=="boolean",string:fr=>typeof fr=="string",stringOrUint8Array:fr=>typeof fr=="string"||isBytes$2(fr),isSafeInteger:fr=>Number.isSafeInteger(fr),array:fr=>Array.isArray(fr),field:(fr,br)=>br.Fp.isValid(fr),hash:fr=>typeof fr=="function"&&Number.isSafeInteger(fr.outputLen)};function validateObject(fr,br,wr={}){const Er=(kr,jr,Br)=>{const Wr=validatorFns[jr];if(typeof Wr!="function")throw new Error("invalid validator function");const qr=fr[kr];if(!(Br&&qr===void 0)&&!Wr(qr,fr))throw new Error("param "+String(kr)+" is invalid. Expected "+jr+", got "+qr)};for(const[kr,jr]of Object.entries(br))Er(kr,jr,!1);for(const[kr,jr]of Object.entries(wr))Er(kr,jr,!0);return fr}const notImplemented=()=>{throw new Error("not implemented")};function memoized(fr){const br=new WeakMap;return(wr,...Er)=>{const kr=br.get(wr);if(kr!==void 0)return kr;const jr=fr(wr,...Er);return br.set(wr,jr),jr}}const ut$2=Object.freeze(Object.defineProperty({__proto__:null,aInRange,abool,abytes,bitGet,bitLen,bitMask,bitSet,bytesToHex,bytesToNumberBE,bytesToNumberLE,concatBytes,createHmacDrbg,ensureBytes,equalBytes,hexToBytes,hexToNumber,inRange:inRange$1,isBytes:isBytes$2,memoized,notImplemented,numberToBytesBE,numberToBytesLE,numberToHexUnpadded,numberToVarBytesBE,utf8ToBytes,validateObject},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$3=BigInt(0),_1n$5=BigInt(1),_2n$3=BigInt(2),_3n$1=BigInt(3),_4n=BigInt(4),_5n$1=BigInt(5),_8n$2=BigInt(8);function mod(fr,br){const wr=fr%br;return wr>=_0n$3?wr:br+wr}function pow(fr,br,wr){if(br<_0n$3)throw new Error("invalid exponent, negatives unsupported");if(wr<=_0n$3)throw new Error("invalid modulus");if(wr===_1n$5)return _0n$3;let Er=_1n$5;for(;br>_0n$3;)br&_1n$5&&(Er=Er*fr%wr),fr=fr*fr%wr,br>>=_1n$5;return Er}function pow2(fr,br,wr){let Er=fr;for(;br-- >_0n$3;)Er*=Er,Er%=wr;return Er}function invert(fr,br){if(fr===_0n$3)throw new Error("invert: expected non-zero number");if(br<=_0n$3)throw new Error("invert: expected positive modulus, got "+br);let wr=mod(fr,br),Er=br,kr=_0n$3,jr=_1n$5;for(;wr!==_0n$3;){const Wr=Er/wr,qr=Er%wr,Gr=kr-jr*Wr;Er=wr,wr=qr,kr=jr,jr=Gr}if(Er!==_1n$5)throw new Error("invert: does not exist");return mod(kr,br)}function tonelliShanks(fr){const br=(fr-_1n$5)/_2n$3;let wr,Er,kr;for(wr=fr-_1n$5,Er=0;wr%_2n$3===_0n$3;wr/=_2n$3,Er++);for(kr=_2n$3;kr1e3)throw new Error("Cannot find square root: likely non-prime P");if(Er===1){const Br=(fr+_1n$5)/_4n;return function(qr,Gr){const Vr=qr.pow(Gr,Br);if(!qr.eql(qr.sqr(Vr),Gr))throw new Error("Cannot find square root");return Vr}}const jr=(wr+_1n$5)/_2n$3;return function(Wr,qr){if(Wr.pow(qr,br)===Wr.neg(Wr.ONE))throw new Error("Cannot find square root");let Gr=Er,Vr=Wr.pow(Wr.mul(Wr.ONE,kr),wr),Zr=Wr.pow(qr,jr),Jr=Wr.pow(qr,wr);for(;!Wr.eql(Jr,Wr.ONE);){if(Wr.eql(Jr,Wr.ZERO))return Wr.ZERO;let Qr=1;for(let En=Wr.sqr(Jr);Qr(mod(fr,br)&_1n$5)===_1n$5,FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(fr){const br={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},wr=FIELD_FIELDS.reduce((Er,kr)=>(Er[kr]="function",Er),br);return validateObject(fr,wr)}function FpPow(fr,br,wr){if(wr<_0n$3)throw new Error("invalid exponent, negatives unsupported");if(wr===_0n$3)return fr.ONE;if(wr===_1n$5)return br;let Er=fr.ONE,kr=br;for(;wr>_0n$3;)wr&_1n$5&&(Er=fr.mul(Er,kr)),kr=fr.sqr(kr),wr>>=_1n$5;return Er}function FpInvertBatch(fr,br){const wr=new Array(br.length),Er=br.reduce((jr,Br,Wr)=>fr.is0(Br)?jr:(wr[Wr]=jr,fr.mul(jr,Br)),fr.ONE),kr=fr.inv(Er);return br.reduceRight((jr,Br,Wr)=>fr.is0(Br)?jr:(wr[Wr]=fr.mul(jr,wr[Wr]),fr.mul(jr,Br)),kr),wr}function nLength(fr,br){const wr=br!==void 0?br:fr.toString(2).length,Er=Math.ceil(wr/8);return{nBitLength:wr,nByteLength:Er}}function Field(fr,br,wr=!1,Er={}){if(fr<=_0n$3)throw new Error("invalid field: expected ORDER > 0, got "+fr);const{nBitLength:kr,nByteLength:jr}=nLength(fr,br);if(jr>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let Br;const Wr=Object.freeze({ORDER:fr,BITS:kr,BYTES:jr,MASK:bitMask(kr),ZERO:_0n$3,ONE:_1n$5,create:qr=>mod(qr,fr),isValid:qr=>{if(typeof qr!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof qr);return _0n$3<=qr&&qrqr===_0n$3,isOdd:qr=>(qr&_1n$5)===_1n$5,neg:qr=>mod(-qr,fr),eql:(qr,Gr)=>qr===Gr,sqr:qr=>mod(qr*qr,fr),add:(qr,Gr)=>mod(qr+Gr,fr),sub:(qr,Gr)=>mod(qr-Gr,fr),mul:(qr,Gr)=>mod(qr*Gr,fr),pow:(qr,Gr)=>FpPow(Wr,qr,Gr),div:(qr,Gr)=>mod(qr*invert(Gr,fr),fr),sqrN:qr=>qr*qr,addN:(qr,Gr)=>qr+Gr,subN:(qr,Gr)=>qr-Gr,mulN:(qr,Gr)=>qr*Gr,inv:qr=>invert(qr,fr),sqrt:Er.sqrt||(qr=>(Br||(Br=FpSqrt(fr)),Br(Wr,qr))),invertBatch:qr=>FpInvertBatch(Wr,qr),cmov:(qr,Gr,Vr)=>Vr?Gr:qr,toBytes:qr=>wr?numberToBytesLE(qr,jr):numberToBytesBE(qr,jr),fromBytes:qr=>{if(qr.length!==jr)throw new Error("Field.fromBytes: expected "+jr+" bytes, got "+qr.length);return wr?bytesToNumberLE(qr):bytesToNumberBE(qr)}});return Object.freeze(Wr)}function getFieldBytesLength(fr){if(typeof fr!="bigint")throw new Error("field order must be bigint");const br=fr.toString(2).length;return Math.ceil(br/8)}function getMinHashLength(fr){const br=getFieldBytesLength(fr);return br+Math.ceil(br/2)}function mapHashToField(fr,br,wr=!1){const Er=fr.length,kr=getFieldBytesLength(br),jr=getMinHashLength(br);if(Er<16||Er1024)throw new Error("expected "+jr+"-1024 bytes of input, got "+Er);const Br=wr?bytesToNumberBE(fr):bytesToNumberLE(fr),Wr=mod(Br,br-_1n$5)+_1n$5;return wr?numberToBytesLE(Wr,kr):numberToBytesBE(Wr,kr)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$2=BigInt(0),_1n$4=BigInt(1);function constTimeNegate(fr,br){const wr=br.negate();return fr?wr:br}function validateW(fr,br){if(!Number.isSafeInteger(fr)||fr<=0||fr>br)throw new Error("invalid window size, expected [1.."+br+"], got W="+fr)}function calcWOpts(fr,br){validateW(fr,br);const wr=Math.ceil(br/fr)+1,Er=2**(fr-1);return{windows:wr,windowSize:Er}}function validateMSMPoints(fr,br){if(!Array.isArray(fr))throw new Error("array expected");fr.forEach((wr,Er)=>{if(!(wr instanceof br))throw new Error("invalid point at index "+Er)})}function validateMSMScalars(fr,br){if(!Array.isArray(fr))throw new Error("array of scalars expected");fr.forEach((wr,Er)=>{if(!br.isValid(wr))throw new Error("invalid scalar at index "+Er)})}const pointPrecomputes=new WeakMap,pointWindowSizes=new WeakMap;function getW(fr){return pointWindowSizes.get(fr)||1}function wNAF(fr,br){return{constTimeNegate,hasPrecomputes(wr){return getW(wr)!==1},unsafeLadder(wr,Er,kr=fr.ZERO){let jr=wr;for(;Er>_0n$2;)Er&_1n$4&&(kr=kr.add(jr)),jr=jr.double(),Er>>=_1n$4;return kr},precomputeWindow(wr,Er){const{windows:kr,windowSize:jr}=calcWOpts(Er,br),Br=[];let Wr=wr,qr=Wr;for(let Gr=0;Gr>=Zr,_n>Br&&(_n-=Vr,kr+=_1n$4);const En=Qr,Cn=Qr+Math.abs(_n)-1,In=Jr%2!==0,An=_n<0;_n===0?qr=qr.add(constTimeNegate(In,Er[En])):Wr=Wr.add(constTimeNegate(An,Er[Cn]))}return{p:Wr,f:qr}},wNAFUnsafe(wr,Er,kr,jr=fr.ZERO){const{windows:Br,windowSize:Wr}=calcWOpts(wr,br),qr=BigInt(2**wr-1),Gr=2**wr,Vr=BigInt(wr);for(let Zr=0;Zr>=Vr,Qr>Wr&&(Qr-=Gr,kr+=_1n$4),Qr===0)continue;let _n=Er[Jr+Math.abs(Qr)-1];Qr<0&&(_n=_n.negate()),jr=jr.add(_n)}return jr},getPrecomputes(wr,Er,kr){let jr=pointPrecomputes.get(Er);return jr||(jr=this.precomputeWindow(Er,wr),wr!==1&&pointPrecomputes.set(Er,kr(jr))),jr},wNAFCached(wr,Er,kr){const jr=getW(wr);return this.wNAF(jr,this.getPrecomputes(jr,wr,kr),Er)},wNAFCachedUnsafe(wr,Er,kr,jr){const Br=getW(wr);return Br===1?this.unsafeLadder(wr,Er,jr):this.wNAFUnsafe(Br,this.getPrecomputes(Br,wr,kr),Er,jr)},setWindowSize(wr,Er){validateW(Er,br),pointWindowSizes.set(wr,Er),pointPrecomputes.delete(wr)}}}function pippenger(fr,br,wr,Er){if(validateMSMPoints(wr,fr),validateMSMScalars(Er,br),wr.length!==Er.length)throw new Error("arrays of points and scalars must have equal length");const kr=fr.ZERO,jr=bitLen(BigInt(wr.length)),Br=jr>12?jr-3:jr>4?jr-2:jr?2:1,Wr=(1<=0;Zr-=Br){qr.fill(kr);for(let Qr=0;Qr>BigInt(Zr)&BigInt(Wr));qr[En]=qr[En].add(wr[Qr])}let Jr=kr;for(let Qr=qr.length-1,_n=kr;Qr>0;Qr--)_n=_n.add(qr[Qr]),Jr=Jr.add(_n);if(Vr=Vr.add(Jr),Zr!==0)for(let Qr=0;Qr{const{Err:wr}=DER;if(fr<0||fr>256)throw new wr("tlv.encode: wrong tag");if(br.length&1)throw new wr("tlv.encode: unpadded data");const Er=br.length/2,kr=numberToHexUnpadded(Er);if(kr.length/2&128)throw new wr("tlv.encode: long form length too big");const jr=Er>127?numberToHexUnpadded(kr.length/2|128):"";return numberToHexUnpadded(fr)+jr+kr+br},decode(fr,br){const{Err:wr}=DER;let Er=0;if(fr<0||fr>256)throw new wr("tlv.encode: wrong tag");if(br.length<2||br[Er++]!==fr)throw new wr("tlv.decode: wrong tlv");const kr=br[Er++],jr=!!(kr&128);let Br=0;if(!jr)Br=kr;else{const qr=kr&127;if(!qr)throw new wr("tlv.decode(long): indefinite length not supported");if(qr>4)throw new wr("tlv.decode(long): byte length is too big");const Gr=br.subarray(Er,Er+qr);if(Gr.length!==qr)throw new wr("tlv.decode: length bytes not complete");if(Gr[0]===0)throw new wr("tlv.decode(long): zero leftmost byte");for(const Vr of Gr)Br=Br<<8|Vr;if(Er+=qr,Br<128)throw new wr("tlv.decode(long): not minimal encoding")}const Wr=br.subarray(Er,Er+Br);if(Wr.length!==Br)throw new wr("tlv.decode: wrong value length");return{v:Wr,l:br.subarray(Er+Br)}}},_int:{encode(fr){const{Err:br}=DER;if(fr<_0n$1)throw new br("integer: negative integers are not allowed");let wr=numberToHexUnpadded(fr);if(Number.parseInt(wr[0],16)&8&&(wr="00"+wr),wr.length&1)throw new br("unexpected DER parsing assertion: unpadded hex");return wr},decode(fr){const{Err:br}=DER;if(fr[0]&128)throw new br("invalid signature integer: negative");if(fr[0]===0&&!(fr[1]&128))throw new br("invalid signature integer: unnecessary leading zero");return b2n(fr)}},toSig(fr){const{Err:br,_int:wr,_tlv:Er}=DER,kr=typeof fr=="string"?h2b(fr):fr;abytes(kr);const{v:jr,l:Br}=Er.decode(48,kr);if(Br.length)throw new br("invalid signature: left bytes after parsing");const{v:Wr,l:qr}=Er.decode(2,jr),{v:Gr,l:Vr}=Er.decode(2,qr);if(Vr.length)throw new br("invalid signature: left bytes after parsing");return{r:wr.decode(Wr),s:wr.decode(Gr)}},hexFromSig(fr){const{_tlv:br,_int:wr}=DER,Er=br.encode(2,wr.encode(fr.r)),kr=br.encode(2,wr.encode(fr.s)),jr=Er+kr;return br.encode(48,jr)}},_0n$1=BigInt(0),_1n$3=BigInt(1);BigInt(2);const _3n=BigInt(3);BigInt(4);function weierstrassPoints(fr){const br=validatePointOpts(fr),{Fp:wr}=br,Er=Field(br.n,br.nBitLength),kr=br.toBytes||((En,Cn,In)=>{const An=Cn.toAffine();return concatBytes(Uint8Array.from([4]),wr.toBytes(An.x),wr.toBytes(An.y))}),jr=br.fromBytes||(En=>{const Cn=En.subarray(1),In=wr.fromBytes(Cn.subarray(0,wr.BYTES)),An=wr.fromBytes(Cn.subarray(wr.BYTES,2*wr.BYTES));return{x:In,y:An}});function Br(En){const{a:Cn,b:In}=br,An=wr.sqr(En),jn=wr.mul(An,En);return wr.add(wr.add(jn,wr.mul(En,Cn)),In)}if(!wr.eql(wr.sqr(br.Gy),Br(br.Gx)))throw new Error("bad generator point: equation left != right");function Wr(En){return inRange$1(En,_1n$3,br.n)}function qr(En){const{allowedPrivateKeyLengths:Cn,nByteLength:In,wrapPrivateKey:An,n:jn}=br;if(Cn&&typeof En!="bigint"){if(isBytes$2(En)&&(En=bytesToHex(En)),typeof En!="string"||!Cn.includes(En.length))throw new Error("invalid private key");En=En.padStart(In*2,"0")}let eo;try{eo=typeof En=="bigint"?En:bytesToNumberBE(ensureBytes("private key",En,In))}catch{throw new Error("invalid private key, expected hex or "+In+" bytes, got "+typeof En)}return An&&(eo=mod(eo,jn)),aInRange("private key",eo,_1n$3,jn),eo}function Gr(En){if(!(En instanceof Jr))throw new Error("ProjectivePoint expected")}const Vr=memoized((En,Cn)=>{const{px:In,py:An,pz:jn}=En;if(wr.eql(jn,wr.ONE))return{x:In,y:An};const eo=En.is0();Cn==null&&(Cn=eo?wr.ONE:wr.inv(jn));const ro=wr.mul(In,Cn),to=wr.mul(An,Cn),_i=wr.mul(jn,Cn);if(eo)return{x:wr.ZERO,y:wr.ZERO};if(!wr.eql(_i,wr.ONE))throw new Error("invZ was invalid");return{x:ro,y:to}}),Zr=memoized(En=>{if(En.is0()){if(br.allowInfinityPoint&&!wr.is0(En.py))return;throw new Error("bad point: ZERO")}const{x:Cn,y:In}=En.toAffine();if(!wr.isValid(Cn)||!wr.isValid(In))throw new Error("bad point: x or y not FE");const An=wr.sqr(In),jn=Br(Cn);if(!wr.eql(An,jn))throw new Error("bad point: equation left != right");if(!En.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class Jr{constructor(Cn,In,An){if(this.px=Cn,this.py=In,this.pz=An,Cn==null||!wr.isValid(Cn))throw new Error("x required");if(In==null||!wr.isValid(In))throw new Error("y required");if(An==null||!wr.isValid(An))throw new Error("z required");Object.freeze(this)}static fromAffine(Cn){const{x:In,y:An}=Cn||{};if(!Cn||!wr.isValid(In)||!wr.isValid(An))throw new Error("invalid affine point");if(Cn instanceof Jr)throw new Error("projective point not allowed");const jn=eo=>wr.eql(eo,wr.ZERO);return jn(In)&&jn(An)?Jr.ZERO:new Jr(In,An,wr.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(Cn){const In=wr.invertBatch(Cn.map(An=>An.pz));return Cn.map((An,jn)=>An.toAffine(In[jn])).map(Jr.fromAffine)}static fromHex(Cn){const In=Jr.fromAffine(jr(ensureBytes("pointHex",Cn)));return In.assertValidity(),In}static fromPrivateKey(Cn){return Jr.BASE.multiply(qr(Cn))}static msm(Cn,In){return pippenger(Jr,Er,Cn,In)}_setWindowSize(Cn){_n.setWindowSize(this,Cn)}assertValidity(){Zr(this)}hasEvenY(){const{y:Cn}=this.toAffine();if(wr.isOdd)return!wr.isOdd(Cn);throw new Error("Field doesn't support isOdd")}equals(Cn){Gr(Cn);const{px:In,py:An,pz:jn}=this,{px:eo,py:ro,pz:to}=Cn,_i=wr.eql(wr.mul(In,to),wr.mul(eo,jn)),oo=wr.eql(wr.mul(An,to),wr.mul(ro,jn));return _i&&oo}negate(){return new Jr(this.px,wr.neg(this.py),this.pz)}double(){const{a:Cn,b:In}=br,An=wr.mul(In,_3n),{px:jn,py:eo,pz:ro}=this;let to=wr.ZERO,_i=wr.ZERO,oo=wr.ZERO,io=wr.mul(jn,jn),co=wr.mul(eo,eo),so=wr.mul(ro,ro),no=wr.mul(jn,eo);return no=wr.add(no,no),oo=wr.mul(jn,ro),oo=wr.add(oo,oo),to=wr.mul(Cn,oo),_i=wr.mul(An,so),_i=wr.add(to,_i),to=wr.sub(co,_i),_i=wr.add(co,_i),_i=wr.mul(to,_i),to=wr.mul(no,to),oo=wr.mul(An,oo),so=wr.mul(Cn,so),no=wr.sub(io,so),no=wr.mul(Cn,no),no=wr.add(no,oo),oo=wr.add(io,io),io=wr.add(oo,io),io=wr.add(io,so),io=wr.mul(io,no),_i=wr.add(_i,io),so=wr.mul(eo,ro),so=wr.add(so,so),io=wr.mul(so,no),to=wr.sub(to,io),oo=wr.mul(so,co),oo=wr.add(oo,oo),oo=wr.add(oo,oo),new Jr(to,_i,oo)}add(Cn){Gr(Cn);const{px:In,py:An,pz:jn}=this,{px:eo,py:ro,pz:to}=Cn;let _i=wr.ZERO,oo=wr.ZERO,io=wr.ZERO;const co=br.a,so=wr.mul(br.b,_3n);let no=wr.mul(In,eo),Tn=wr.mul(An,ro),Hr=wr.mul(jn,to),Xr=wr.add(In,An),Sn=wr.add(eo,ro);Xr=wr.mul(Xr,Sn),Sn=wr.add(no,Tn),Xr=wr.sub(Xr,Sn),Sn=wr.add(In,jn);let Rn=wr.add(eo,to);return Sn=wr.mul(Sn,Rn),Rn=wr.add(no,Hr),Sn=wr.sub(Sn,Rn),Rn=wr.add(An,jn),_i=wr.add(ro,to),Rn=wr.mul(Rn,_i),_i=wr.add(Tn,Hr),Rn=wr.sub(Rn,_i),io=wr.mul(co,Sn),_i=wr.mul(so,Hr),io=wr.add(_i,io),_i=wr.sub(Tn,io),io=wr.add(Tn,io),oo=wr.mul(_i,io),Tn=wr.add(no,no),Tn=wr.add(Tn,no),Hr=wr.mul(co,Hr),Sn=wr.mul(so,Sn),Tn=wr.add(Tn,Hr),Hr=wr.sub(no,Hr),Hr=wr.mul(co,Hr),Sn=wr.add(Sn,Hr),no=wr.mul(Tn,Sn),oo=wr.add(oo,no),no=wr.mul(Rn,Sn),_i=wr.mul(Xr,_i),_i=wr.sub(_i,no),no=wr.mul(Xr,Tn),io=wr.mul(Rn,io),io=wr.add(io,no),new Jr(_i,oo,io)}subtract(Cn){return this.add(Cn.negate())}is0(){return this.equals(Jr.ZERO)}wNAF(Cn){return _n.wNAFCached(this,Cn,Jr.normalizeZ)}multiplyUnsafe(Cn){const{endo:In,n:An}=br;aInRange("scalar",Cn,_0n$1,An);const jn=Jr.ZERO;if(Cn===_0n$1)return jn;if(this.is0()||Cn===_1n$3)return this;if(!In||_n.hasPrecomputes(this))return _n.wNAFCachedUnsafe(this,Cn,Jr.normalizeZ);let{k1neg:eo,k1:ro,k2neg:to,k2:_i}=In.splitScalar(Cn),oo=jn,io=jn,co=this;for(;ro>_0n$1||_i>_0n$1;)ro&_1n$3&&(oo=oo.add(co)),_i&_1n$3&&(io=io.add(co)),co=co.double(),ro>>=_1n$3,_i>>=_1n$3;return eo&&(oo=oo.negate()),to&&(io=io.negate()),io=new Jr(wr.mul(io.px,In.beta),io.py,io.pz),oo.add(io)}multiply(Cn){const{endo:In,n:An}=br;aInRange("scalar",Cn,_1n$3,An);let jn,eo;if(In){const{k1neg:ro,k1:to,k2neg:_i,k2:oo}=In.splitScalar(Cn);let{p:io,f:co}=this.wNAF(to),{p:so,f:no}=this.wNAF(oo);io=_n.constTimeNegate(ro,io),so=_n.constTimeNegate(_i,so),so=new Jr(wr.mul(so.px,In.beta),so.py,so.pz),jn=io.add(so),eo=co.add(no)}else{const{p:ro,f:to}=this.wNAF(Cn);jn=ro,eo=to}return Jr.normalizeZ([jn,eo])[0]}multiplyAndAddUnsafe(Cn,In,An){const jn=Jr.BASE,eo=(to,_i)=>_i===_0n$1||_i===_1n$3||!to.equals(jn)?to.multiplyUnsafe(_i):to.multiply(_i),ro=eo(this,In).add(eo(Cn,An));return ro.is0()?void 0:ro}toAffine(Cn){return Vr(this,Cn)}isTorsionFree(){const{h:Cn,isTorsionFree:In}=br;if(Cn===_1n$3)return!0;if(In)return In(Jr,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:Cn,clearCofactor:In}=br;return Cn===_1n$3?this:In?In(Jr,this):this.multiplyUnsafe(br.h)}toRawBytes(Cn=!0){return abool("isCompressed",Cn),this.assertValidity(),kr(Jr,this,Cn)}toHex(Cn=!0){return abool("isCompressed",Cn),bytesToHex(this.toRawBytes(Cn))}}Jr.BASE=new Jr(br.Gx,br.Gy,wr.ONE),Jr.ZERO=new Jr(wr.ZERO,wr.ONE,wr.ZERO);const Qr=br.nBitLength,_n=wNAF(Jr,br.endo?Math.ceil(Qr/2):Qr);return{CURVE:br,ProjectivePoint:Jr,normPrivateKeyToScalar:qr,weierstrassEquation:Br,isWithinCurveOrder:Wr}}function validateOpts$1(fr){const br=validateBasic(fr);return validateObject(br,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...br})}function weierstrass(fr){const br=validateOpts$1(fr),{Fp:wr,n:Er}=br,kr=wr.BYTES+1,jr=2*wr.BYTES+1;function Br(Hr){return mod(Hr,Er)}function Wr(Hr){return invert(Hr,Er)}const{ProjectivePoint:qr,normPrivateKeyToScalar:Gr,weierstrassEquation:Vr,isWithinCurveOrder:Zr}=weierstrassPoints({...br,toBytes(Hr,Xr,Sn){const Rn=Xr.toAffine(),Pn=wr.toBytes(Rn.x),On=concatBytes;return abool("isCompressed",Sn),Sn?On(Uint8Array.from([Xr.hasEvenY()?2:3]),Pn):On(Uint8Array.from([4]),Pn,wr.toBytes(Rn.y))},fromBytes(Hr){const Xr=Hr.length,Sn=Hr[0],Rn=Hr.subarray(1);if(Xr===kr&&(Sn===2||Sn===3)){const Pn=bytesToNumberBE(Rn);if(!inRange$1(Pn,_1n$3,wr.ORDER))throw new Error("Point is not on curve");const On=Vr(Pn);let Zn;try{Zn=wr.sqrt(On)}catch(zn){const fo=zn instanceof Error?": "+zn.message:"";throw new Error("Point is not on curve"+fo)}const Nn=(Zn&_1n$3)===_1n$3;return(Sn&1)===1!==Nn&&(Zn=wr.neg(Zn)),{x:Pn,y:Zn}}else if(Xr===jr&&Sn===4){const Pn=wr.fromBytes(Rn.subarray(0,wr.BYTES)),On=wr.fromBytes(Rn.subarray(wr.BYTES,2*wr.BYTES));return{x:Pn,y:On}}else{const Pn=kr,On=jr;throw new Error("invalid Point, expected length of "+Pn+", or uncompressed "+On+", got "+Xr)}}}),Jr=Hr=>bytesToHex(numberToBytesBE(Hr,br.nByteLength));function Qr(Hr){const Xr=Er>>_1n$3;return Hr>Xr}function _n(Hr){return Qr(Hr)?Br(-Hr):Hr}const En=(Hr,Xr,Sn)=>bytesToNumberBE(Hr.slice(Xr,Sn));class Cn{constructor(Xr,Sn,Rn){this.r=Xr,this.s=Sn,this.recovery=Rn,this.assertValidity()}static fromCompact(Xr){const Sn=br.nByteLength;return Xr=ensureBytes("compactSignature",Xr,Sn*2),new Cn(En(Xr,0,Sn),En(Xr,Sn,2*Sn))}static fromDER(Xr){const{r:Sn,s:Rn}=DER.toSig(ensureBytes("DER",Xr));return new Cn(Sn,Rn)}assertValidity(){aInRange("r",this.r,_1n$3,Er),aInRange("s",this.s,_1n$3,Er)}addRecoveryBit(Xr){return new Cn(this.r,this.s,Xr)}recoverPublicKey(Xr){const{r:Sn,s:Rn,recovery:Pn}=this,On=to(ensureBytes("msgHash",Xr));if(Pn==null||![0,1,2,3].includes(Pn))throw new Error("recovery id invalid");const Zn=Pn===2||Pn===3?Sn+br.n:Sn;if(Zn>=wr.ORDER)throw new Error("recovery id 2 or 3 invalid");const Nn=Pn&1?"03":"02",wn=qr.fromHex(Nn+Jr(Zn)),zn=Wr(Zn),fo=Br(-On*zn),vo=Br(Rn*zn),go=qr.BASE.multiplyAndAddUnsafe(wn,fo,vo);if(!go)throw new Error("point at infinify");return go.assertValidity(),go}hasHighS(){return Qr(this.s)}normalizeS(){return this.hasHighS()?new Cn(this.r,Br(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes(this.toCompactHex())}toCompactHex(){return Jr(this.r)+Jr(this.s)}}const In={isValidPrivateKey(Hr){try{return Gr(Hr),!0}catch{return!1}},normPrivateKeyToScalar:Gr,randomPrivateKey:()=>{const Hr=getMinHashLength(br.n);return mapHashToField(br.randomBytes(Hr),br.n)},precompute(Hr=8,Xr=qr.BASE){return Xr._setWindowSize(Hr),Xr.multiply(BigInt(3)),Xr}};function An(Hr,Xr=!0){return qr.fromPrivateKey(Hr).toRawBytes(Xr)}function jn(Hr){const Xr=isBytes$2(Hr),Sn=typeof Hr=="string",Rn=(Xr||Sn)&&Hr.length;return Xr?Rn===kr||Rn===jr:Sn?Rn===2*kr||Rn===2*jr:Hr instanceof qr}function eo(Hr,Xr,Sn=!0){if(jn(Hr))throw new Error("first arg must be private key");if(!jn(Xr))throw new Error("second arg must be public key");return qr.fromHex(Xr).multiply(Gr(Hr)).toRawBytes(Sn)}const ro=br.bits2int||function(Hr){if(Hr.length>8192)throw new Error("input is too large");const Xr=bytesToNumberBE(Hr),Sn=Hr.length*8-br.nBitLength;return Sn>0?Xr>>BigInt(Sn):Xr},to=br.bits2int_modN||function(Hr){return Br(ro(Hr))},_i=bitMask(br.nBitLength);function oo(Hr){return aInRange("num < 2^"+br.nBitLength,Hr,_0n$1,_i),numberToBytesBE(Hr,br.nByteLength)}function io(Hr,Xr,Sn=co){if(["recovered","canonical"].some(lo=>lo in Sn))throw new Error("sign() legacy options not supported");const{hash:Rn,randomBytes:Pn}=br;let{lowS:On,prehash:Zn,extraEntropy:Nn}=Sn;On==null&&(On=!0),Hr=ensureBytes("msgHash",Hr),validateSigVerOpts(Sn),Zn&&(Hr=ensureBytes("prehashed msgHash",Rn(Hr)));const wn=to(Hr),zn=Gr(Xr),fo=[oo(zn),oo(wn)];if(Nn!=null&&Nn!==!1){const lo=Nn===!0?Pn(wr.BYTES):Nn;fo.push(ensureBytes("extraEntropy",lo))}const vo=concatBytes(...fo),go=wn;function uo(lo){const Eo=ro(lo);if(!Zr(Eo))return;const mo=Wr(Eo),yo=qr.BASE.multiply(Eo).toAffine(),_o=Br(yo.x);if(_o===_0n$1)return;const Bo=Br(mo*Br(go+_o*zn));if(Bo===_0n$1)return;let Lo=(yo.x===_o?0:2)|Number(yo.y&_1n$3),Wo=Bo;return On&&Qr(Bo)&&(Wo=_n(Bo),Lo^=1),new Cn(_o,Wo,Lo)}return{seed:vo,k2sig:uo}}const co={lowS:br.lowS,prehash:!1},so={lowS:br.lowS,prehash:!1};function no(Hr,Xr,Sn=co){const{seed:Rn,k2sig:Pn}=io(Hr,Xr,Sn),On=br;return createHmacDrbg(On.hash.outputLen,On.nByteLength,On.hmac)(Rn,Pn)}qr.BASE._setWindowSize(8);function Tn(Hr,Xr,Sn,Rn=so){var Lo;const Pn=Hr;Xr=ensureBytes("msgHash",Xr),Sn=ensureBytes("publicKey",Sn);const{lowS:On,prehash:Zn,format:Nn}=Rn;if(validateSigVerOpts(Rn),"strict"in Rn)throw new Error("options.strict was renamed to lowS");if(Nn!==void 0&&Nn!=="compact"&&Nn!=="der")throw new Error("format must be compact or der");const wn=typeof Pn=="string"||isBytes$2(Pn),zn=!wn&&!Nn&&typeof Pn=="object"&&Pn!==null&&typeof Pn.r=="bigint"&&typeof Pn.s=="bigint";if(!wn&&!zn)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let fo,vo;try{if(zn&&(fo=new Cn(Pn.r,Pn.s)),wn){try{Nn!=="compact"&&(fo=Cn.fromDER(Pn))}catch(Wo){if(!(Wo instanceof DER.Err))throw Wo}!fo&&Nn!=="der"&&(fo=Cn.fromCompact(Pn))}vo=qr.fromHex(Sn)}catch{return!1}if(!fo||On&&fo.hasHighS())return!1;Zn&&(Xr=br.hash(Xr));const{r:go,s:uo}=fo,lo=to(Xr),Eo=Wr(uo),mo=Br(lo*Eo),yo=Br(go*Eo),_o=(Lo=qr.BASE.multiplyAndAddUnsafe(vo,mo,yo))==null?void 0:Lo.toAffine();return _o?Br(_o.x)===go:!1}return{CURVE:br,getPublicKey:An,getSharedSecret:eo,sign:no,verify:Tn,ProjectivePoint:qr,Signature:Cn,utils:In}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash(fr){return{hash:fr,hmac:(br,...wr)=>hmac$3(fr,br,concatBytes$1(...wr)),randomBytes}}function createCurve(fr,br){const wr=Er=>weierstrass({...fr,...getHash(Er)});return Object.freeze({...wr(br),create:wr})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n$2=BigInt(1),_2n$2=BigInt(2),divNearest=(fr,br)=>(fr+br/_2n$2)/br;function sqrtMod(fr){const br=secp256k1P,wr=BigInt(3),Er=BigInt(6),kr=BigInt(11),jr=BigInt(22),Br=BigInt(23),Wr=BigInt(44),qr=BigInt(88),Gr=fr*fr*fr%br,Vr=Gr*Gr*fr%br,Zr=pow2(Vr,wr,br)*Vr%br,Jr=pow2(Zr,wr,br)*Vr%br,Qr=pow2(Jr,_2n$2,br)*Gr%br,_n=pow2(Qr,kr,br)*Qr%br,En=pow2(_n,jr,br)*_n%br,Cn=pow2(En,Wr,br)*En%br,In=pow2(Cn,qr,br)*Cn%br,An=pow2(In,Wr,br)*En%br,jn=pow2(An,wr,br)*Vr%br,eo=pow2(jn,Br,br)*_n%br,ro=pow2(eo,Er,br)*Gr%br,to=pow2(ro,_2n$2,br);if(!Fpk1.eql(Fpk1.sqr(to),fr))throw new Error("Cannot find square root");return to}const Fpk1=Field(secp256k1P,void 0,void 0,{sqrt:sqrtMod}),secp256k1$1=createCurve({a:BigInt(0),b:BigInt(7),Fp:Fpk1,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:fr=>{const br=secp256k1N,wr=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),Er=-_1n$2*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),kr=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),jr=wr,Br=BigInt("0x100000000000000000000000000000000"),Wr=divNearest(jr*fr,br),qr=divNearest(-Er*fr,br);let Gr=mod(fr-Wr*wr-qr*kr,br),Vr=mod(-Wr*Er-qr*jr,br);const Zr=Gr>Br,Jr=Vr>Br;if(Zr&&(Gr=br-Gr),Jr&&(Vr=br-Vr),Gr>Br||Vr>Br)throw new Error("splitScalar: Endomorphism failed, k="+fr);return{k1neg:Zr,k1:Gr,k2neg:Jr,k2:Vr}}}},sha256$3);BigInt(0);secp256k1$1.ProjectivePoint;/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function isBytes$1(fr){return fr instanceof Uint8Array||ArrayBuffer.isView(fr)&&fr.constructor.name==="Uint8Array"}function isArrayOf(fr,br){return Array.isArray(br)?br.length===0?!0:fr?br.every(wr=>typeof wr=="string"):br.every(wr=>Number.isSafeInteger(wr)):!1}function afn(fr){if(typeof fr!="function")throw new Error("function expected");return!0}function astr(fr,br){if(typeof br!="string")throw new Error(`${fr}: string expected`);return!0}function anumber(fr){if(!Number.isSafeInteger(fr))throw new Error(`invalid integer: ${fr}`)}function aArr(fr){if(!Array.isArray(fr))throw new Error("array expected")}function astrArr(fr,br){if(!isArrayOf(!0,br))throw new Error(`${fr}: array of strings expected`)}function anumArr(fr,br){if(!isArrayOf(!1,br))throw new Error(`${fr}: array of numbers expected`)}function chain$1(...fr){const br=jr=>jr,wr=(jr,Br)=>Wr=>jr(Br(Wr)),Er=fr.map(jr=>jr.encode).reduceRight(wr,br),kr=fr.map(jr=>jr.decode).reduce(wr,br);return{encode:Er,decode:kr}}function alphabet$2(fr){const br=typeof fr=="string"?fr.split(""):fr,wr=br.length;astrArr("alphabet",br);const Er=new Map(br.map((kr,jr)=>[kr,jr]));return{encode:kr=>(aArr(kr),kr.map(jr=>{if(!Number.isSafeInteger(jr)||jr<0||jr>=wr)throw new Error(`alphabet.encode: digit index outside alphabet "${jr}". Allowed: ${fr}`);return br[jr]})),decode:kr=>(aArr(kr),kr.map(jr=>{astr("alphabet.decode",jr);const Br=Er.get(jr);if(Br===void 0)throw new Error(`Unknown letter: "${jr}". Allowed: ${fr}`);return Br}))}}function join$1(fr=""){return astr("join",fr),{encode:br=>(astrArr("join.decode",br),br.join(fr)),decode:br=>(astr("join.decode",br),br.split(fr))}}function convertRadix$1(fr,br,wr){if(br<2)throw new Error(`convertRadix: invalid from=${br}, base cannot be less than 2`);if(wr<2)throw new Error(`convertRadix: invalid to=${wr}, base cannot be less than 2`);if(aArr(fr),!fr.length)return[];let Er=0;const kr=[],jr=Array.from(fr,Wr=>{if(anumber(Wr),Wr<0||Wr>=br)throw new Error(`invalid integer: ${Wr}`);return Wr}),Br=jr.length;for(;;){let Wr=0,qr=!0;for(let Gr=Er;Gr{if(!isBytes$1(wr))throw new Error("radix.encode input should be Uint8Array");return convertRadix$1(Array.from(wr),br,fr)},decode:wr=>(anumArr("radix.decode",wr),Uint8Array.from(convertRadix$1(wr,fr,br)))}}function checksum$1(fr,br){return anumber(fr),afn(br),{encode(wr){if(!isBytes$1(wr))throw new Error("checksum.encode: input should be Uint8Array");const Er=br(wr).slice(0,fr),kr=new Uint8Array(wr.length+fr);return kr.set(wr),kr.set(Er,wr.length),kr},decode(wr){if(!isBytes$1(wr))throw new Error("checksum.decode: input should be Uint8Array");const Er=wr.slice(0,-fr),kr=wr.slice(-fr),jr=br(Er).slice(0,fr);for(let Br=0;Brchain$1(radix$1(58),alphabet$2(fr),join$1("")),base58$2=genBase58$1("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),createBase58check$1=fr=>chain$1(checksum$1(4,br=>fr(fr(br))),base58$2);/*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */const Point$1=secp256k1$1.ProjectivePoint,base58check$1=createBase58check$1(sha256$4);function bytesToNumber$1(fr){abytes$2(fr);const br=fr.length===0?"0":bytesToHex$1(fr);return BigInt("0x"+br)}function numberToBytes$1(fr){if(typeof fr!="bigint")throw new Error("bigint expected");return hexToBytes$1(fr.toString(16).padStart(64,"0"))}const MASTER_SECRET$1=utf8ToBytes$2("Bitcoin seed"),BITCOIN_VERSIONS$1={private:76066276,public:76067358},HARDENED_OFFSET$1=2147483648,hash160$1=fr=>ripemd160$1(sha256$4(fr)),fromU32$1=fr=>createView$1(fr).getUint32(0,!1),toU32$1=fr=>{if(!Number.isSafeInteger(fr)||fr<0||fr>2**32-1)throw new Error("invalid number, should be from 0 to 2**32-1, got "+fr);const br=new Uint8Array(4);return createView$1(br).setUint32(0,fr,!1),br};let HDKey$1=class u1{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return fromU32$1(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){const br=this.privateKey;if(!br)throw new Error("No private key");return base58check$1.encode(this.serialize(this.versions.private,concatBytes$2(new Uint8Array([0]),br)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return base58check$1.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(br,wr=BITCOIN_VERSIONS$1){if(abytes$2(br),8*br.length<128||8*br.length>512)throw new Error("HDKey: seed length must be between 128 and 512 bits; 256 bits is advised, got "+br.length);const Er=hmac$4(sha512$5,MASTER_SECRET$1,br);return new u1({versions:wr,chainCode:Er.slice(32),privateKey:Er.slice(0,32)})}static fromExtendedKey(br,wr=BITCOIN_VERSIONS$1){const Er=base58check$1.decode(br),kr=createView$1(Er),jr=kr.getUint32(0,!1),Br={versions:wr,depth:Er[4],parentFingerprint:kr.getUint32(5,!1),index:kr.getUint32(9,!1),chainCode:Er.slice(13,45)},Wr=Er.slice(45),qr=Wr[0]===0;if(jr!==wr[qr?"private":"public"])throw new Error("Version mismatch");return qr?new u1({...Br,privateKey:Wr.slice(1)}):new u1({...Br,publicKey:Wr})}static fromJSON(br){return u1.fromExtendedKey(br.xpriv)}constructor(br){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!br||typeof br!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=br.versions||BITCOIN_VERSIONS$1,this.depth=br.depth||0,this.chainCode=br.chainCode||null,this.index=br.index||0,this.parentFingerprint=br.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(br.publicKey&&br.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(br.privateKey){if(!secp256k1$1.utils.isValidPrivateKey(br.privateKey))throw new Error("Invalid private key");this.privKey=typeof br.privateKey=="bigint"?br.privateKey:bytesToNumber$1(br.privateKey),this.privKeyBytes=numberToBytes$1(this.privKey),this.pubKey=secp256k1$1.getPublicKey(br.privateKey,!0)}else if(br.publicKey)this.pubKey=Point$1.fromHex(br.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=hash160$1(this.pubKey)}derive(br){if(!/^[mM]'?/.test(br))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(br))return this;const wr=br.replace(/^[mM]'?\//,"").split("/");let Er=this;for(const kr of wr){const jr=/^(\d+)('?)$/.exec(kr),Br=jr&&jr[1];if(!jr||jr.length!==3||typeof Br!="string")throw new Error("invalid child index: "+kr);let Wr=+Br;if(!Number.isSafeInteger(Wr)||Wr>=HARDENED_OFFSET$1)throw new Error("Invalid index");jr[2]==="'"&&(Wr+=HARDENED_OFFSET$1),Er=Er.deriveChild(Wr)}return Er}deriveChild(br){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let wr=toU32$1(br);if(br>=HARDENED_OFFSET$1){const Wr=this.privateKey;if(!Wr)throw new Error("Could not derive hardened child key");wr=concatBytes$2(new Uint8Array([0]),Wr,wr)}else wr=concatBytes$2(this.pubKey,wr);const Er=hmac$4(sha512$5,this.chainCode,wr),kr=bytesToNumber$1(Er.slice(0,32)),jr=Er.slice(32);if(!secp256k1$1.utils.isValidPrivateKey(kr))throw new Error("Tweak bigger than curve order");const Br={versions:this.versions,chainCode:jr,depth:this.depth+1,parentFingerprint:this.fingerprint,index:br};try{if(this.privateKey){const Wr=mod(this.privKey+kr,secp256k1$1.CURVE.n);if(!secp256k1$1.utils.isValidPrivateKey(Wr))throw new Error("The tweak was out of range or the resulted private key is invalid");Br.privateKey=Wr}else{const Wr=Point$1.fromHex(this.pubKey).add(Point$1.fromPrivateKey(kr));if(Wr.equals(Point$1.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");Br.publicKey=Wr.toRawBytes(!0)}return new u1(Br)}catch{return this.deriveChild(br+1)}}sign(br){if(!this.privateKey)throw new Error("No privateKey set!");return abytes$2(br,32),secp256k1$1.sign(br,this.privKey).toCompactRawBytes()}verify(br,wr){if(abytes$2(br,32),abytes$2(wr,64),!this.publicKey)throw new Error("No publicKey set!");let Er;try{Er=secp256k1$1.Signature.fromCompact(wr)}catch{return!1}return secp256k1$1.verify(Er,br,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(br,wr){if(!this.chainCode)throw new Error("No chainCode set");return abytes$2(wr,33),concatBytes$2(toU32$1(br),new Uint8Array([this.depth]),toU32$1(this.parentFingerprint),toU32$1(this.index),this.chainCode,wr)}};const l1=class l1{};Uu(l1,"initialize",async(br,wr="WALLETCLIENT")=>wr==="DYNAMIC"?l1.convertDynamicProvider(br):l1.convertViemWalletClient(br)),Uu(l1,"convertViemWalletClient",async br=>{try{const wr=br.account;if(!wr)throw new Error("WalletClient Account Undefined");const Er=await br.getChainId(),kr=async jr=>{const Br=await br.signMessage({message:jr,account:wr});return hexToBytes$1(Br.replace("0x",""))};return{account:`eip155:${Er}:${getAddress(wr.address)}`,signMessage:kr}}catch{throw new Error("Invalid WalletClient")}}),Uu(l1,"convertDynamicProvider",async br=>{try{let wr=br.address;isAddress(wr,{strict:!1})&&(wr=getAddress(wr));const Er=chainToNamespace[br.chain];if(Er===void 0)throw new Error("Unsupported Namespace");let kr=await br.getNetwork();Er==="solana"&&(kr=networkToSolChainId[kr]);const jr=async Br=>{const Wr=await br.signMessage(Br);return isHex(Wr)?hexToBytes$1(Wr.replace("0x","")):Buffer$2.from(Wr,"base64")};return{account:`${Er}:${kr}:${wr}`,signMessage:jr}}catch{throw new Error("Invalid Dynamic Provider")}});let PushSigner=l1;var ENCRYPTION_TYPE=(fr=>(fr.V1="x25519-xsalsa20-poly1305",fr.V2="aes256GcmHkdfSha256",fr.V3="eip191-aes256-gcm-hkdf-sha256",fr.V4="pgpv1:nft",fr.V5="push:v5",fr))(ENCRYPTION_TYPE||{});const h1=class h1{constructor(br){Uu(this,"hkdf",async(br,wr)=>{const Er=await crypto.subtle.importKey("raw",br,"HKDF",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:wr,info:new ArrayBuffer(0)},Er,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"])});Uu(this,"aesGcmEncryption",async(br,wr,Er)=>{const Br=crypto.getRandomValues(new Uint8Array(32)),Wr=crypto.getRandomValues(new Uint8Array(12)),qr=await this.hkdf(wr,Br),Gr={name:"AES-GCM",iv:Wr};Er&&(Gr.additionalData=Er);const Vr=await crypto.subtle.encrypt(Gr,qr,br);return{ciphertext:bytesToHex$1(new Uint8Array(Vr)),salt:bytesToHex$1(Br),nonce:bytesToHex$1(Wr)}});Uu(this,"aesGcmDecryption",async(br,wr,Er)=>{const kr=await this.hkdf(wr,hexToBytes$1(br.salt)),jr={name:"AES-GCM",iv:hexToBytes$1(br.nonce)};Er&&(jr.additionalData=Er);const Br=await crypto.subtle.decrypt(jr,kr,hexToBytes$1(br.ciphertext));return new Uint8Array(Br)});Uu(this,"encryptV5",async br=>{const wr=bytesToHex$1(await crypto.getRandomValues(new Uint8Array(32))),Er=`Enable Push Network Profile -`+wr,kr=await this.signer.signMessage(Er),Br=new TextEncoder().encode(br);return{...await this.aesGcmEncryption(Br,kr),version:ENCRYPTION_TYPE.V5,preKey:wr}});Uu(this,"decryptV5",async br=>{const wr=`Enable Push Network Profile -`+br.preKey,Er=await this.signer.signMessage(wr),kr=await this.aesGcmDecryption(br,Er);return new TextDecoder().decode(kr)});this.signer=br}};Uu(h1,"encrypt",async(br,wr,Er=ENCRYPTION_TYPE.V5)=>{const kr=new h1(wr);switch(Er){case ENCRYPTION_TYPE.V5:return await kr.encryptV5(br);default:throw new Error("Invalid Key Encryption")}}),Uu(h1,"decrypt",async(br,wr)=>{const Er=new h1(wr);switch(br.version){case ENCRYPTION_TYPE.V5:return Er.decryptV5(br);default:throw new Error("Invalid Key Encryption")}});let PushEncryption=h1;const[SHA512_Kh$1,SHA512_Kl$1]=u64$6.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(fr=>BigInt(fr))),SHA512_W_H$1=new Uint32Array(80),SHA512_W_L$1=new Uint32Array(80);let SHA512$1=class extends HashMD$2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:br,Al:wr,Bh:Er,Bl:kr,Ch:jr,Cl:Br,Dh:Wr,Dl:qr,Eh:Gr,El:Vr,Fh:Zr,Fl:Jr,Gh:Qr,Gl:_n,Hh:En,Hl:Cn}=this;return[br,wr,Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En,Cn]}set(br,wr,Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En,Cn){this.Ah=br|0,this.Al=wr|0,this.Bh=Er|0,this.Bl=kr|0,this.Ch=jr|0,this.Cl=Br|0,this.Dh=Wr|0,this.Dl=qr|0,this.Eh=Gr|0,this.El=Vr|0,this.Fh=Zr|0,this.Fl=Jr|0,this.Gh=Qr|0,this.Gl=_n|0,this.Hh=En|0,this.Hl=Cn|0}process(br,wr){for(let jn=0;jn<16;jn++,wr+=4)SHA512_W_H$1[jn]=br.getUint32(wr),SHA512_W_L$1[jn]=br.getUint32(wr+=4);for(let jn=16;jn<80;jn++){const eo=SHA512_W_H$1[jn-15]|0,ro=SHA512_W_L$1[jn-15]|0,to=u64$6.rotrSH(eo,ro,1)^u64$6.rotrSH(eo,ro,8)^u64$6.shrSH(eo,ro,7),_i=u64$6.rotrSL(eo,ro,1)^u64$6.rotrSL(eo,ro,8)^u64$6.shrSL(eo,ro,7),oo=SHA512_W_H$1[jn-2]|0,io=SHA512_W_L$1[jn-2]|0,co=u64$6.rotrSH(oo,io,19)^u64$6.rotrBH(oo,io,61)^u64$6.shrSH(oo,io,6),so=u64$6.rotrSL(oo,io,19)^u64$6.rotrBL(oo,io,61)^u64$6.shrSL(oo,io,6),no=u64$6.add4L(_i,so,SHA512_W_L$1[jn-7],SHA512_W_L$1[jn-16]),Tn=u64$6.add4H(no,to,co,SHA512_W_H$1[jn-7],SHA512_W_H$1[jn-16]);SHA512_W_H$1[jn]=Tn|0,SHA512_W_L$1[jn]=no|0}let{Ah:Er,Al:kr,Bh:jr,Bl:Br,Ch:Wr,Cl:qr,Dh:Gr,Dl:Vr,Eh:Zr,El:Jr,Fh:Qr,Fl:_n,Gh:En,Gl:Cn,Hh:In,Hl:An}=this;for(let jn=0;jn<80;jn++){const eo=u64$6.rotrSH(Zr,Jr,14)^u64$6.rotrSH(Zr,Jr,18)^u64$6.rotrBH(Zr,Jr,41),ro=u64$6.rotrSL(Zr,Jr,14)^u64$6.rotrSL(Zr,Jr,18)^u64$6.rotrBL(Zr,Jr,41),to=Zr&Qr^~Zr&En,_i=Jr&_n^~Jr&Cn,oo=u64$6.add5L(An,ro,_i,SHA512_Kl$1[jn],SHA512_W_L$1[jn]),io=u64$6.add5H(oo,In,eo,to,SHA512_Kh$1[jn],SHA512_W_H$1[jn]),co=oo|0,so=u64$6.rotrSH(Er,kr,28)^u64$6.rotrBH(Er,kr,34)^u64$6.rotrBH(Er,kr,39),no=u64$6.rotrSL(Er,kr,28)^u64$6.rotrBL(Er,kr,34)^u64$6.rotrBL(Er,kr,39),Tn=Er&jr^Er&Wr^jr&Wr,Hr=kr&Br^kr&qr^Br&qr;In=En|0,An=Cn|0,En=Qr|0,Cn=_n|0,Qr=Zr|0,_n=Jr|0,{h:Zr,l:Jr}=u64$6.add(Gr|0,Vr|0,io|0,co|0),Gr=Wr|0,Vr=qr|0,Wr=jr|0,qr=Br|0,jr=Er|0,Br=kr|0;const Xr=u64$6.add3L(co,no,Hr);Er=u64$6.add3H(Xr,io,so,Tn),kr=Xr|0}({h:Er,l:kr}=u64$6.add(this.Ah|0,this.Al|0,Er|0,kr|0)),{h:jr,l:Br}=u64$6.add(this.Bh|0,this.Bl|0,jr|0,Br|0),{h:Wr,l:qr}=u64$6.add(this.Ch|0,this.Cl|0,Wr|0,qr|0),{h:Gr,l:Vr}=u64$6.add(this.Dh|0,this.Dl|0,Gr|0,Vr|0),{h:Zr,l:Jr}=u64$6.add(this.Eh|0,this.El|0,Zr|0,Jr|0),{h:Qr,l:_n}=u64$6.add(this.Fh|0,this.Fl|0,Qr|0,_n|0),{h:En,l:Cn}=u64$6.add(this.Gh|0,this.Gl|0,En|0,Cn|0),{h:In,l:An}=u64$6.add(this.Hh|0,this.Hl|0,In|0,An|0),this.set(Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En,Cn,In,An)}roundClean(){SHA512_W_H$1.fill(0),SHA512_W_L$1.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const sha512$4=wrapConstructor$2(()=>new SHA512$1);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function isBytes(fr){return fr instanceof Uint8Array||fr!=null&&typeof fr=="object"&&fr.constructor.name==="Uint8Array"}function chain(...fr){const br=jr=>jr,wr=(jr,Br)=>Wr=>jr(Br(Wr)),Er=fr.map(jr=>jr.encode).reduceRight(wr,br),kr=fr.map(jr=>jr.decode).reduce(wr,br);return{encode:Er,decode:kr}}function alphabet$1(fr){return{encode:br=>{if(!Array.isArray(br)||br.length&&typeof br[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return br.map(wr=>{if(wr<0||wr>=fr.length)throw new Error(`Digit index outside alphabet: ${wr} (alphabet: ${fr.length})`);return fr[wr]})},decode:br=>{if(!Array.isArray(br)||br.length&&typeof br[0]!="string")throw new Error("alphabet.decode input should be array of strings");return br.map(wr=>{if(typeof wr!="string")throw new Error(`alphabet.decode: not string element=${wr}`);const Er=fr.indexOf(wr);if(Er===-1)throw new Error(`Unknown letter: "${wr}". Allowed: ${fr}`);return Er})}}}function join(fr=""){if(typeof fr!="string")throw new Error("join separator should be string");return{encode:br=>{if(!Array.isArray(br)||br.length&&typeof br[0]!="string")throw new Error("join.encode input should be array of strings");for(let wr of br)if(typeof wr!="string")throw new Error(`join.encode: non-string input=${wr}`);return br.join(fr)},decode:br=>{if(typeof br!="string")throw new Error("join.decode input should be string");return br.split(fr)}}}function convertRadix(fr,br,wr){if(br<2)throw new Error(`convertRadix: wrong from=${br}, base cannot be less than 2`);if(wr<2)throw new Error(`convertRadix: wrong to=${wr}, base cannot be less than 2`);if(!Array.isArray(fr))throw new Error("convertRadix: data should be array");if(!fr.length)return[];let Er=0;const kr=[],jr=Array.from(fr);for(jr.forEach(Br=>{if(Br<0||Br>=br)throw new Error(`Wrong integer: ${Br}`)});;){let Br=0,Wr=!0;for(let qr=Er;qr{if(!isBytes(br))throw new Error("radix.encode input should be Uint8Array");return convertRadix(Array.from(br),2**8,fr)},decode:br=>{if(!Array.isArray(br)||br.length&&typeof br[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(convertRadix(br,fr,2**8))}}}function checksum(fr,br){if(typeof br!="function")throw new Error("checksum fn should be function");return{encode(wr){if(!isBytes(wr))throw new Error("checksum.encode: input should be Uint8Array");const Er=br(wr).slice(0,fr),kr=new Uint8Array(wr.length+fr);return kr.set(wr),kr.set(Er,wr.length),kr},decode(wr){if(!isBytes(wr))throw new Error("checksum.decode: input should be Uint8Array");const Er=wr.slice(0,-fr),kr=br(Er).slice(0,fr),jr=wr.slice(-fr);for(let Br=0;Brchain(radix(58),alphabet$1(fr),join("")),base58$1=genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),createBase58check=fr=>chain(checksum(4,br=>fr(fr(br))),base58$1);/*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */const Point=secp256k1$2.ProjectivePoint,base58check=createBase58check(sha256$7);function bytesToNumber(fr){return BigInt(`0x${bytesToHex$3(fr)}`)}function numberToBytes(fr){return hexToBytes$3(fr.toString(16).padStart(64,"0"))}const MASTER_SECRET=utf8ToBytes$4("Bitcoin seed"),BITCOIN_VERSIONS={private:76066276,public:76067358},HARDENED_OFFSET=2147483648,hash160=fr=>ripemd160$3(sha256$7(fr)),fromU32=fr=>createView$2(fr).getUint32(0,!1),toU32=fr=>{if(!Number.isSafeInteger(fr)||fr<0||fr>2**32-1)throw new Error(`Invalid number=${fr}. Should be from 0 to 2 ** 32 - 1`);const br=new Uint8Array(4);return createView$2(br).setUint32(0,fr,!1),br};class HDKey{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return fromU32(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){const br=this.privateKey;if(!br)throw new Error("No private key");return base58check.encode(this.serialize(this.versions.private,concatBytes$5(new Uint8Array([0]),br)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return base58check.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(br,wr=BITCOIN_VERSIONS){if(bytes(br),8*br.length<128||8*br.length>512)throw new Error(`HDKey: wrong seed length=${br.length}. Should be between 128 and 512 bits; 256 bits is advised)`);const Er=hmac$5(sha512$4,MASTER_SECRET,br);return new HDKey({versions:wr,chainCode:Er.slice(32),privateKey:Er.slice(0,32)})}static fromExtendedKey(br,wr=BITCOIN_VERSIONS){const Er=base58check.decode(br),kr=createView$2(Er),jr=kr.getUint32(0,!1),Br={versions:wr,depth:Er[4],parentFingerprint:kr.getUint32(5,!1),index:kr.getUint32(9,!1),chainCode:Er.slice(13,45)},Wr=Er.slice(45),qr=Wr[0]===0;if(jr!==wr[qr?"private":"public"])throw new Error("Version mismatch");return qr?new HDKey({...Br,privateKey:Wr.slice(1)}):new HDKey({...Br,publicKey:Wr})}static fromJSON(br){return HDKey.fromExtendedKey(br.xpriv)}constructor(br){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!br||typeof br!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=br.versions||BITCOIN_VERSIONS,this.depth=br.depth||0,this.chainCode=br.chainCode||null,this.index=br.index||0,this.parentFingerprint=br.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(br.publicKey&&br.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(br.privateKey){if(!secp256k1$2.utils.isValidPrivateKey(br.privateKey))throw new Error("Invalid private key");this.privKey=typeof br.privateKey=="bigint"?br.privateKey:bytesToNumber(br.privateKey),this.privKeyBytes=numberToBytes(this.privKey),this.pubKey=secp256k1$2.getPublicKey(br.privateKey,!0)}else if(br.publicKey)this.pubKey=Point.fromHex(br.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=hash160(this.pubKey)}derive(br){if(!/^[mM]'?/.test(br))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(br))return this;const wr=br.replace(/^[mM]'?\//,"").split("/");let Er=this;for(const kr of wr){const jr=/^(\d+)('?)$/.exec(kr),Br=jr&&jr[1];if(!jr||jr.length!==3||typeof Br!="string")throw new Error(`Invalid child index: ${kr}`);let Wr=+Br;if(!Number.isSafeInteger(Wr)||Wr>=HARDENED_OFFSET)throw new Error("Invalid index");jr[2]==="'"&&(Wr+=HARDENED_OFFSET),Er=Er.deriveChild(Wr)}return Er}deriveChild(br){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let wr=toU32(br);if(br>=HARDENED_OFFSET){const Wr=this.privateKey;if(!Wr)throw new Error("Could not derive hardened child key");wr=concatBytes$5(new Uint8Array([0]),Wr,wr)}else wr=concatBytes$5(this.pubKey,wr);const Er=hmac$5(sha512$4,this.chainCode,wr),kr=bytesToNumber(Er.slice(0,32)),jr=Er.slice(32);if(!secp256k1$2.utils.isValidPrivateKey(kr))throw new Error("Tweak bigger than curve order");const Br={versions:this.versions,chainCode:jr,depth:this.depth+1,parentFingerprint:this.fingerprint,index:br};try{if(this.privateKey){const Wr=mod$1(this.privKey+kr,secp256k1$2.CURVE.n);if(!secp256k1$2.utils.isValidPrivateKey(Wr))throw new Error("The tweak was out of range or the resulted private key is invalid");Br.privateKey=Wr}else{const Wr=Point.fromHex(this.pubKey).add(Point.fromPrivateKey(kr));if(Wr.equals(Point.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");Br.publicKey=Wr.toRawBytes(!0)}return new HDKey(Br)}catch{return this.deriveChild(br+1)}}sign(br){if(!this.privateKey)throw new Error("No privateKey set!");return bytes(br,32),secp256k1$2.sign(br,this.privKey).toCompactRawBytes()}verify(br,wr){if(bytes(br,32),bytes(wr,64),!this.publicKey)throw new Error("No publicKey set!");let Er;try{Er=secp256k1$2.Signature.fromCompact(wr)}catch{return!1}return secp256k1$2.verify(Er,br,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(br,wr){if(!this.chainCode)throw new Error("No chainCode set");return bytes(wr,33),concatBytes$5(toU32(br),new Uint8Array([this.depth]),toU32(this.parentFingerprint),toU32(this.index),this.chainCode,wr)}}function pbkdf2Init(fr,br,wr,Er){hash$4(fr);const kr=checkOpts$1({dkLen:32,asyncTick:10},Er),{c:jr,dkLen:Br,asyncTick:Wr}=kr;if(number$3(jr),number$3(Br),number$3(Wr),jr<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const qr=toBytes$2(br),Gr=toBytes$2(wr),Vr=new Uint8Array(Br),Zr=hmac$5.create(fr,qr),Jr=Zr._cloneInto().update(Gr);return{c:jr,dkLen:Br,asyncTick:Wr,DK:Vr,PRF:Zr,PRFSalt:Jr}}function pbkdf2Output(fr,br,wr,Er,kr){return fr.destroy(),br.destroy(),Er&&Er.destroy(),kr.fill(0),wr}function pbkdf2(fr,br,wr,Er){const{c:kr,dkLen:jr,DK:Br,PRF:Wr,PRFSalt:qr}=pbkdf2Init(fr,br,wr,Er);let Gr;const Vr=new Uint8Array(4),Zr=createView$2(Vr),Jr=new Uint8Array(Wr.outputLen);for(let Qr=1,_n=0;_nnfkd(`mnemonic${fr}`);function mnemonicToSeedSync(fr,br=""){return pbkdf2(sha512$4,normalize(fr).nfkd,salt(br),{c:2048,dkLen:64})}function toAccount(fr){if(typeof fr=="string"){if(!isAddress(fr,{strict:!1}))throw new InvalidAddressError({address:fr});return{address:fr,type:"json-rpc"}}if(!isAddress(fr.address,{strict:!1}))throw new InvalidAddressError({address:fr.address});return{address:fr.address,nonceManager:fr.nonceManager,sign:fr.sign,experimental_signAuthorization:fr.experimental_signAuthorization,signMessage:fr.signMessage,signTransaction:fr.signTransaction,signTypedData:fr.signTypedData,source:"custom",type:"local"}}let extraEntropy=!1;async function sign$2({hash:fr,privateKey:br,to:wr="object"}){const{r:Er,s:kr,recovery:jr}=secp256k1$2.sign(fr.slice(2),br.slice(2),{lowS:!0,extraEntropy}),Br={r:numberToHex(Er,{size:32}),s:numberToHex(kr,{size:32}),v:jr?28n:27n,yParity:jr};return wr==="bytes"||wr==="hex"?serializeSignature({...Br,to:wr}):Br}async function experimental_signAuthorization(fr){const{contractAddress:br,chainId:wr,nonce:Er,privateKey:kr,to:jr="object"}=fr,Br=await sign$2({hash:hashAuthorization({contractAddress:br,chainId:wr,nonce:Er}),privateKey:kr,to:jr});return jr==="object"?{contractAddress:br,chainId:wr,nonce:Er,...Br}:Br}async function signMessage$1({message:fr,privateKey:br}){return await sign$2({hash:hashMessage(fr),privateKey:br,to:"hex"})}async function signTransaction$1(fr){const{privateKey:br,transaction:wr,serializer:Er=serializeTransaction$4}=fr,kr=wr.type==="eip4844"?{...wr,sidecars:!1}:wr,jr=await sign$2({hash:keccak256(Er(kr)),privateKey:br});return Er(wr,jr)}async function signTypedData$1(fr){const{privateKey:br,...wr}=fr;return await sign$2({hash:hashTypedData(wr),privateKey:br,to:"hex"})}function privateKeyToAccount(fr,br={}){const{nonceManager:wr}=br,Er=toHex(secp256k1$2.getPublicKey(fr.slice(2),!1)),kr=publicKeyToAddress(Er);return{...toAccount({address:kr,nonceManager:wr,async sign({hash:Br}){return sign$2({hash:Br,privateKey:fr,to:"hex"})},async experimental_signAuthorization(Br){return experimental_signAuthorization({...Br,privateKey:fr})},async signMessage({message:Br}){return signMessage$1({message:Br,privateKey:fr})},async signTransaction(Br,{serializer:Wr}={}){return signTransaction$1({privateKey:fr,transaction:Br,serializer:Wr})},async signTypedData(Br){return signTypedData$1({...Br,privateKey:fr})}}),publicKey:Er,source:"privateKey"}}function hdKeyToAccount(fr,{accountIndex:br=0,addressIndex:wr=0,changeIndex:Er=0,path:kr,...jr}={}){const Br=fr.derive(kr||`m/44'/60'/${br}'/${Er}/${wr}`);return{...privateKeyToAccount(toHex(Br.privateKey),jr),getHdKey:()=>Br,source:"hd"}}function mnemonicToAccount(fr,br={}){const wr=mnemonicToSeedSync(fr);return hdKeyToAccount(HDKey.fromMasterSeed(wr),br)}const xp=class xp{constructor(br,wr,Er,kr=void 0,jr){Uu(this,"signerAccount");Uu(this,"appConnections");Uu(this,"attachedAccounts",[]);Uu(this,"walletToEncDerivedKey",{});Uu(this,"connectWalletWithAccount",async br=>{if(!xp.unRegisteredProfile)throw Error("Only Allowed for Unregistered Profile");const wr=await PushEncryption.encrypt(this.derivedHDNode.privateExtendedKey,br),Er=await mnemonicToSeed(this.mnemonic),kr=HDKey$1.fromMasterSeed(Er),jr=`PUSH_DID:${bytesToHex$1(sha256$4(kr.publicKey))}`,Br=await br.signMessage(`Connect Account To ${jr}`);this.walletToEncDerivedKey[br.account]={encDerivedPrivKey:wr,signature:Br},this.attachedAccounts.push(br.account)});Uu(this,"registerPushAccount",async()=>{if(!xp.unRegisteredProfile)throw Error("Only Allowed for Unregistered Profile");const br=await mnemonicToSeed(this.mnemonic),wr=HDKey$1.fromMasterSeed(br),Er={masterPubKey:bytesToHex$1(wr.publicKey),derivedKeyIndex:this.derivedHDNode.index,derivedPubKey:bytesToHex$1(this.derivedHDNode.publicKey),walletToEncDerivedKey:this.walletToEncDerivedKey},kr=await src$5.Tx.initialize(this.env),jr=kr.createUnsigned("INIT_DID",[],src$5.Tx.serializeData(Er,"INIT_DID"));console.log("InitDIDTx:",jr),console.log(`0x${bytesToHex$1(wr.privateKey)}`);const Br=privateKeyToAccount(`0x${bytesToHex$1(wr.privateKey)}`),Wr={account:src$5.Address.toPushCAIP(Br.address,this.env),signMessage:async qr=>{const Gr=await Br.signMessage({message:{raw:qr}});return hexToBytes$4(Gr)}};await kr.send(jr,Wr),xp.unRegisteredProfile=!1});Uu(this,"storeMnemonicShareAsEncryptedTx",async(br,wr,Er)=>{var kr,jr;try{const Wr=(await api$2.post("/auth/passkey/register-credential",{userId:br})).data;typeof Wr.publicKey.challenge=="string"&&(Wr.publicKey.challenge=xp.base64URLToBuffer(Wr.publicKey.challenge)),typeof Wr.publicKey.user.id=="string"&&(Wr.publicKey.user.id=xp.base64URLToBuffer(Wr.publicKey.user.id));const qr=await navigator.credentials.create(Wr);if(!qr)throw new Error("Failed to create PassKey credential");await api$2.post("/auth/passkey/verify-registration",{userId:br,credential:{id:qr.id,rawId:xp.bufferToBase64URL(qr.rawId),response:{attestationObject:xp.bufferToBase64URL(qr.response.attestationObject),clientDataJSON:xp.bufferToBase64URL(qr.response.clientDataJSON),transports:((jr=(kr=qr.response).getTransports)==null?void 0:jr.call(kr))||[]},type:qr.type,clientExtensionResults:qr.getClientExtensionResults()}});const Gr=window.crypto.subtle,Zr=new TextEncoder().encode(wr),Jr=new Uint8Array(16);window.crypto.getRandomValues(Jr);const Qr=await Gr.importKey("raw",qr.rawId,"PBKDF2",!1,["deriveBits","deriveKey"]),_n=await Gr.deriveKey({name:"PBKDF2",salt:Jr.buffer,iterations:1e5,hash:{name:"SHA-256"}},Qr,{name:"AES-GCM",length:256},!1,["encrypt"]),En=window.crypto.getRandomValues(new Uint8Array(12)),Cn=await Gr.encrypt({name:"AES-GCM",iv:En},_n,Zr),In=new Uint8Array([...Jr,...new Uint8Array(Cn)]),An=await src$5.Tx.initialize(this.env),jn=[],eo=An.createUnsigned("CUSTOM:MNEMONIC_SHARE_REGISTRATION",jn,In),ro=await mnemonicToSeed(Er),to=HDKey$1.fromMasterSeed(ro),_i=privateKeyToAccount(`0x${bytesToHex$1(to.privateKey)}`),oo={account:src$5.Address.toPushCAIP(_i.address,this.env),signMessage:async co=>{const so=await _i.signMessage({message:{raw:co}});return hexToBytes$4(so)}},io=await An.send(eo,oo);console.log("::::::::::::::::Tx Response::::::::::",io),await api$2.put(`/auth/passkey/transaction/${br}`,{transactionHash:io,iv:xp.bufferToBase64URL(En)})}catch(Br){throw console.error("Error in sendMenomicShare:",Br),Br}});Uu(this,"sign",async(br,wr)=>{if(!this.appConnections.find(Wr=>Wr.origin===wr))throw Error("App not Connected");const kr=hdKeyToAccount(this.derivedHDNode),jr=createWalletClient({account:kr,chain:mainnet,transport:http()});return await(await PushSigner.initialize(jr)).signMessage(typeof br=="string"?br:bytesToString(br))});Uu(this,"ConnectionStatus",br=>{const wr=this.appConnections.find(Er=>Er.origin===br);return wr?{isConnected:!wr.isPending,isPending:wr.isPending}:{isConnected:!1,isPending:!1}});Uu(this,"requestToConnect",(br,wr)=>{this.appConnections.find(kr=>kr.origin===br)||(this.appConnections.push({origin:br,isPending:!0}),wr(),localStorage.setItem("appConnections",JSON.stringify(this.appConnections)))});Uu(this,"acceptConnectionReq",br=>{const wr=this.appConnections.find(Er=>Er.origin===br);wr&&(wr.isPending=!1,localStorage.setItem("appConnections",JSON.stringify(this.appConnections)))});Uu(this,"rejectConnectionReq",br=>{this.appConnections=this.appConnections.filter(wr=>wr.origin!==br),localStorage.setItem("appConnections",JSON.stringify(this.appConnections))});Uu(this,"rejectAllConnectionReqs",()=>{this.appConnections=this.appConnections.filter(br=>br.isPending===!1),localStorage.setItem("appConnections",JSON.stringify(this.appConnections))});Uu(this,"generateRandomSessionKey",()=>{var Er,kr;let br=this.derivedHDNode;const wr=9;for(let jr=0;jr{const wr=this.generateRandomSessionKey();console.log(br,wr)});Uu(this,"revokeSessionKey",br=>{console.log(br)});this.did=br,this.account=wr,this.derivedHDNode=Er,this.mnemonic=kr,this.env=jr,this.signerAccount=src$5.Address.toPushCAIP(src$5.Address.evmToPush(hdKeyToAccount(Er).address,"pushconsumer"),jr),this.appConnections=localStorage.getItem("appConnections")?JSON.parse(localStorage.getItem("appConnections")):[]}static async retrieveMnemonicShareFromTx(br,wr){var Er,kr,jr;try{const Br=await api$2.get(`/auth/passkey/transaction/${wr}`);if(!((Er=Br==null?void 0:Br.data)!=null&&Er.transactionHash))throw new Error("No transaction hash found");const Gr=(jr=(kr=(await(await src$5.Tx.initialize(br)).search(Br.data.transactionHash)).blocks[0])==null?void 0:kr.blockDataAsJson.txobjList[0])==null?void 0:jr.tx.data;if(!Gr)throw new Error("Transaction data not found");const Vr=new Uint8Array(atob(Gr).split("").map(io=>io.charCodeAt(0))),Zr=await api$2.get(`/auth/passkey/challenge/${wr}`),Jr={challenge:this.base64URLToBuffer(Zr.data.challenge),rpId:window.location.hostname,timeout:6e4,userVerification:"required",allowCredentials:[]},Qr=await navigator.credentials.get({publicKey:Jr});if(!Qr)throw new Error("Failed to get PassKey credential");const _n=Vr.slice(0,16),En=this.base64URLToBuffer(Br.data.iv),Cn=Vr.slice(16,-16),In=Vr.slice(-16),An=new Uint8Array([...Cn,...In]),jn=window.crypto.subtle,eo=await jn.importKey("raw",Qr.rawId,"PBKDF2",!1,["deriveBits","deriveKey"]),ro=await jn.deriveKey({name:"PBKDF2",salt:_n,iterations:1e5,hash:{name:"SHA-256"}},eo,{name:"AES-GCM",length:256},!1,["decrypt"]),to=await jn.decrypt({name:"AES-GCM",iv:En},ro,An.buffer),oo=new TextDecoder().decode(to);return await api$2.post(`/auth/passkey/verify/${wr}`,{id:Qr.id,rawId:this.bufferToBase64URL(Qr.rawId),authenticatorData:this.bufferToBase64URL(Qr.response.authenticatorData),clientDataJSON:this.bufferToBase64URL(Qr.response.clientDataJSON),signature:this.bufferToBase64URL(Qr.response.signature),transactionHash:Br.data.transactionHash}),oo}catch(Br){throw console.error("Error retrieving mnemonic share from transaction:",Br),Br}}static bufferToBase64URL(br){return btoa(String.fromCharCode(...new Uint8Array(br))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static base64URLToBuffer(br){const wr=br.replace(/-/g,"+").replace(/_/g,"/"),Er=wr.padEnd(wr.length+(4-wr.length%4)%4,"="),kr=atob(Er),jr=new ArrayBuffer(kr.length),Br=new Uint8Array(jr);for(let Wr=0;Wr{xp.unRegisteredProfile=!0;const wr=await xp.generatePushWallet(),Er=src$5.Address.toPushCAIP(mnemonicToAccount(wr.mnemonic).address,br);localStorage.removeItem("appConnections");const kr=new xp(wr.did,Er,wr.derivedNode,wr.mnemonic,br),jr=createWalletClient({account:mnemonicToAccount(wr.mnemonic),chain:mainnet,transport:http()}),Br=await PushSigner.initialize(jr);return Br.account=Er,await kr.connectWalletWithAccount(Br),kr}),Uu(xp,"logInWithMnemonic",async(br,wr=ENV.STAGING)=>{const Er=src$5.Address.toPushCAIP(mnemonicToAccount(br).address,wr),kr=createWalletClient({account:mnemonicToAccount(br),chain:mainnet,transport:http()}),jr=await PushSigner.initialize(kr);return jr.account=Er,await xp.loginWithWallet(jr,wr)}),Uu(xp,"loginWithWallet",async(br,wr=ENV.STAGING)=>{xp.pushValidator=await src$5.Validator.initalize({env:wr});const Er=await xp.getPushWallet(br.account);if(console.log(Er),Er==null)return null;{const kr=await xp.decryptDerivedNode(Er.encDerivedPrivKey,br),jr=new xp(Er.did,br.account,kr,void 0,wr);return jr.attachedAccounts=Er.attachedaccounts,jr}}),Uu(xp,"loginWithSocial",async()=>{}),Uu(xp,"getPushWallet",async br=>{var Er,kr;const wr=await xp.pushValidator.call("push_accountInfo",[br]);return wr.items.length>0?{did:wr.items[0].did,derivedKeyIndex:parseInt(wr.items[0].derivedkeyindex),encDerivedPrivKey:{...JSON.parse(wr.items[0].encryptedderivedprivatekey),preKey:JSON.parse(wr.items[0].encryptedderivedprivatekey).prekey},attachedaccounts:(kr=(Er=wr==null?void 0:wr.items[0])==null?void 0:Er.attachedaccounts)==null?void 0:kr.map(jr=>jr.address)}:null}),Uu(xp,"generateDerivedNode",async(br,wr=0,Er=0)=>{const jr=`m/44'/60'/0'/0/${Er}/0'/${wr}'`;return br.derive(jr)}),Uu(xp,"generatePushWallet",async()=>{const br=generateMnemonic(wordlist),wr=await mnemonicToSeed(br),Er=HDKey$1.fromMasterSeed(wr),kr=`PUSH_DID:${bytesToHex$1(sha256$4(Er.publicKey))}`,jr=await xp.generateDerivedNode(Er);return{mnemonic:br,masterNode:Er,did:kr,derivedNode:jr}}),Uu(xp,"decryptDerivedNode",async(br,wr)=>{const Er=await PushEncryption.decrypt(br,wr);return HDKey$1.fromExtendedKey(Er)});let PushWallet=xp;var secrets$1={exports:{}},cryptoBrowserify={},browser$g={exports:{}},safeBuffer$1={exports:{}};const require$$0$9=getAugmentedNamespace(dist$2);/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(fr,br){var wr=require$$0$9,Er=wr.Buffer;function kr(Br,Wr){for(var qr in Br)Wr[qr]=Br[qr]}Er.from&&Er.alloc&&Er.allocUnsafe&&Er.allocUnsafeSlow?fr.exports=wr:(kr(wr,br),br.Buffer=jr);function jr(Br,Wr,qr){return Er(Br,Wr,qr)}jr.prototype=Object.create(Er.prototype),kr(Er,jr),jr.from=function(Br,Wr,qr){if(typeof Br=="number")throw new TypeError("Argument must not be a number");return Er(Br,Wr,qr)},jr.alloc=function(Br,Wr,qr){if(typeof Br!="number")throw new TypeError("Argument must be a number");var Gr=Er(Br);return Wr!==void 0?typeof qr=="string"?Gr.fill(Wr,qr):Gr.fill(Wr):Gr.fill(0),Gr},jr.allocUnsafe=function(Br){if(typeof Br!="number")throw new TypeError("Argument must be a number");return Er(Br)},jr.allocUnsafeSlow=function(Br){if(typeof Br!="number")throw new TypeError("Argument must be a number");return wr.SlowBuffer(Br)}})(safeBuffer$1,safeBuffer$1.exports);var safeBufferExports=safeBuffer$1.exports,hasRequiredBrowser$b;function requireBrowser$b(){if(hasRequiredBrowser$b)return browser$g.exports;hasRequiredBrowser$b=1;var fr=65536,br=4294967295;function wr(){throw new Error(`Secure random number generation is not supported by this browser. +`),Rho=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Id=new Uint8Array(new Array(16).fill(0).map((fr,br)=>br)),Pi=Id.map(fr=>(9*fr+5)%16);let idxL=[Id],idxR=[Pi];for(let fr=0;fr<4;fr++)for(let br of[idxL,idxR])br.push(br[fr].map(wr=>Rho[wr]));const shifts=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(fr=>new Uint8Array(fr)),shiftsL=idxL.map((fr,br)=>fr.map(wr=>shifts[br][wr])),shiftsR=idxR.map((fr,br)=>fr.map(wr=>shifts[br][wr])),Kl=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Kr=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);function f$7(fr,br,wr,Er){return fr===0?br^wr^Er:fr===1?br&wr|~br&Er:fr===2?(br|~wr)^Er:fr===3?br&Er|wr&~Er:br^(wr|~Er)}const R_BUF=new Uint32Array(16);class RIPEMD160 extends HashMD$1{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:br,h1:wr,h2:Er,h3:kr,h4:jr}=this;return[br,wr,Er,kr,jr]}set(br,wr,Er,kr,jr){this.h0=br|0,this.h1=wr|0,this.h2=Er|0,this.h3=kr|0,this.h4=jr|0}process(br,wr){for(let Qr=0;Qr<16;Qr++,wr+=4)R_BUF[Qr]=br.getUint32(wr,!0);let Er=this.h0|0,kr=Er,jr=this.h1|0,Br=jr,Wr=this.h2|0,qr=Wr,Gr=this.h3|0,Vr=Gr,Zr=this.h4|0,Jr=Zr;for(let Qr=0;Qr<5;Qr++){const _n=4-Qr,En=Kl[Qr],Cn=Kr[Qr],In=idxL[Qr],An=idxR[Qr],jn=shiftsL[Qr],eo=shiftsR[Qr];for(let ro=0;ro<16;ro++){const to=rotl(Er+f$7(Qr,jr,Wr,Gr)+R_BUF[In[ro]]+En,jn[ro])+Zr|0;Er=Zr,Zr=Gr,Gr=rotl(Wr,10)|0,Wr=jr,jr=to}for(let ro=0;ro<16;ro++){const to=rotl(kr+f$7(_n,Br,qr,Vr)+R_BUF[An[ro]]+Cn,eo[ro])+Jr|0;kr=Jr,Jr=Vr,Vr=rotl(qr,10)|0,qr=Br,Br=to}}this.set(this.h1+Wr+Vr|0,this.h2+Gr+Jr|0,this.h3+Zr+kr|0,this.h4+Er+Br|0,this.h0+jr+qr|0)}roundClean(){R_BUF.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const ripemd160$1=wrapConstructor$1(()=>new RIPEMD160);function anumber$1(fr){if(!Number.isSafeInteger(fr)||fr<0)throw new Error("positive integer expected, got "+fr)}function isBytes$3(fr){return fr instanceof Uint8Array||ArrayBuffer.isView(fr)&&fr.constructor.name==="Uint8Array"}function abytes$1(fr,...br){if(!isBytes$3(fr))throw new Error("Uint8Array expected");if(br.length>0&&!br.includes(fr.length))throw new Error("Uint8Array expected of length "+br+", got length="+fr.length)}function ahash(fr){if(typeof fr!="function"||typeof fr.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");anumber$1(fr.outputLen),anumber$1(fr.blockLen)}function aexists(fr,br=!0){if(fr.destroyed)throw new Error("Hash instance has been destroyed");if(br&&fr.finished)throw new Error("Hash#digest() has already been called")}function aoutput(fr,br){abytes$1(fr);const wr=br.outputLen;if(fr.lengthnew DataView(fr.buffer,fr.byteOffset,fr.byteLength),rotr=(fr,br)=>fr<<32-br|fr>>>br;function utf8ToBytes$1(fr){if(typeof fr!="string")throw new Error("utf8ToBytes expected string, got "+typeof fr);return new Uint8Array(new TextEncoder().encode(fr))}function toBytes(fr){return typeof fr=="string"&&(fr=utf8ToBytes$1(fr)),abytes$1(fr),fr}function concatBytes$1(...fr){let br=0;for(let Er=0;Erfr().update(toBytes(Er)).digest(),wr=fr();return br.outputLen=wr.outputLen,br.blockLen=wr.blockLen,br.create=()=>fr(),br}function randomBytes(fr=32){if(crypto$2&&typeof crypto$2.getRandomValues=="function")return crypto$2.getRandomValues(new Uint8Array(fr));if(crypto$2&&typeof crypto$2.randomBytes=="function")return crypto$2.randomBytes(fr);throw new Error("crypto.getRandomValues must be defined")}function setBigUint64(fr,br,wr,Er){if(typeof fr.setBigUint64=="function")return fr.setBigUint64(br,wr,Er);const kr=BigInt(32),jr=BigInt(4294967295),Br=Number(wr>>kr&jr),Wr=Number(wr&jr),qr=Er?4:0,Gr=Er?0:4;fr.setUint32(br+qr,Br,Er),fr.setUint32(br+Gr,Wr,Er)}const Chi=(fr,br,wr)=>fr&br^~fr&wr,Maj=(fr,br,wr)=>fr&br^fr&wr^br≀class HashMD extends Hash$1{constructor(br,wr,Er,kr){super(),this.blockLen=br,this.outputLen=wr,this.padOffset=Er,this.isLE=kr,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(br),this.view=createView(this.buffer)}update(br){aexists(this);const{view:wr,buffer:Er,blockLen:kr}=this;br=toBytes(br);const jr=br.length;for(let Br=0;Brkr-Br&&(this.process(Er,0),Br=0);for(let Zr=Br;ZrVr.length)throw new Error("_sha2: outputLen bigger than state");for(let Zr=0;Zr>>3,En=rotr(Qr,17)^rotr(Qr,19)^Qr>>>10;SHA256_W[Zr]=En+SHA256_W[Zr-7]+_n+SHA256_W[Zr-16]|0}let{A:Er,B:kr,C:jr,D:Br,E:Wr,F:qr,G:Gr,H:Vr}=this;for(let Zr=0;Zr<64;Zr++){const Jr=rotr(Wr,6)^rotr(Wr,11)^rotr(Wr,25),Qr=Vr+Jr+Chi(Wr,qr,Gr)+SHA256_K[Zr]+SHA256_W[Zr]|0,En=(rotr(Er,2)^rotr(Er,13)^rotr(Er,22))+Maj(Er,kr,jr)|0;Vr=Gr,Gr=qr,qr=Wr,Wr=Br+Qr|0,Br=jr,jr=kr,kr=Er,Er=Qr+En|0}Er=Er+this.A|0,kr=kr+this.B|0,jr=jr+this.C|0,Br=Br+this.D|0,Wr=Wr+this.E|0,qr=qr+this.F|0,Gr=Gr+this.G|0,Vr=Vr+this.H|0,this.set(Er,kr,jr,Br,Wr,qr,Gr,Vr)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const sha256$3=wrapConstructor(()=>new SHA256);let HMAC$1=class extends Hash$1{constructor(br,wr){super(),this.finished=!1,this.destroyed=!1,ahash(br);const Er=toBytes(wr);if(this.iHash=br.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const kr=this.blockLen,jr=new Uint8Array(kr);jr.set(Er.length>kr?br.create().update(Er).digest():Er);for(let Br=0;Brnew HMAC$1(fr,br).update(wr).digest();hmac$3.create=(fr,br)=>new HMAC$1(fr,br);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$4=BigInt(0),_1n$6=BigInt(1),_2n$4=BigInt(2);function isBytes$2(fr){return fr instanceof Uint8Array||ArrayBuffer.isView(fr)&&fr.constructor.name==="Uint8Array"}function abytes(fr){if(!isBytes$2(fr))throw new Error("Uint8Array expected")}function abool(fr,br){if(typeof br!="boolean")throw new Error(fr+" boolean expected, got "+br)}const hexes=Array.from({length:256},(fr,br)=>br.toString(16).padStart(2,"0"));function bytesToHex(fr){abytes(fr);let br="";for(let wr=0;wr=asciis._0&&fr<=asciis._9)return fr-asciis._0;if(fr>=asciis.A&&fr<=asciis.F)return fr-(asciis.A-10);if(fr>=asciis.a&&fr<=asciis.f)return fr-(asciis.a-10)}function hexToBytes(fr){if(typeof fr!="string")throw new Error("hex string expected, got "+typeof fr);const br=fr.length,wr=br/2;if(br%2)throw new Error("hex string expected, got unpadded hex of length "+br);const Er=new Uint8Array(wr);for(let kr=0,jr=0;krtypeof fr=="bigint"&&_0n$4<=fr;function inRange$1(fr,br,wr){return isPosBig(fr)&&isPosBig(br)&&isPosBig(wr)&&br<=fr&&fr_0n$4;fr>>=_1n$6,br+=1);return br}function bitGet(fr,br){return fr>>BigInt(br)&_1n$6}function bitSet(fr,br,wr){return fr|(wr?_1n$6:_0n$4)<(_2n$4<new Uint8Array(fr),u8fr=fr=>Uint8Array.from(fr);function createHmacDrbg(fr,br,wr){if(typeof fr!="number"||fr<2)throw new Error("hashLen must be a number");if(typeof br!="number"||br<2)throw new Error("qByteLen must be a number");if(typeof wr!="function")throw new Error("hmacFn must be a function");let Er=u8n(fr),kr=u8n(fr),jr=0;const Br=()=>{Er.fill(1),kr.fill(0),jr=0},Wr=(...Zr)=>wr(kr,Er,...Zr),qr=(Zr=u8n())=>{kr=Wr(u8fr([0]),Zr),Er=Wr(),Zr.length!==0&&(kr=Wr(u8fr([1]),Zr),Er=Wr())},Gr=()=>{if(jr++>=1e3)throw new Error("drbg: tried 1000 values");let Zr=0;const Jr=[];for(;Zr{Br(),qr(Zr);let Qr;for(;!(Qr=Jr(Gr()));)qr();return Br(),Qr}}const validatorFns={bigint:fr=>typeof fr=="bigint",function:fr=>typeof fr=="function",boolean:fr=>typeof fr=="boolean",string:fr=>typeof fr=="string",stringOrUint8Array:fr=>typeof fr=="string"||isBytes$2(fr),isSafeInteger:fr=>Number.isSafeInteger(fr),array:fr=>Array.isArray(fr),field:(fr,br)=>br.Fp.isValid(fr),hash:fr=>typeof fr=="function"&&Number.isSafeInteger(fr.outputLen)};function validateObject(fr,br,wr={}){const Er=(kr,jr,Br)=>{const Wr=validatorFns[jr];if(typeof Wr!="function")throw new Error("invalid validator function");const qr=fr[kr];if(!(Br&&qr===void 0)&&!Wr(qr,fr))throw new Error("param "+String(kr)+" is invalid. Expected "+jr+", got "+qr)};for(const[kr,jr]of Object.entries(br))Er(kr,jr,!1);for(const[kr,jr]of Object.entries(wr))Er(kr,jr,!0);return fr}const notImplemented=()=>{throw new Error("not implemented")};function memoized(fr){const br=new WeakMap;return(wr,...Er)=>{const kr=br.get(wr);if(kr!==void 0)return kr;const jr=fr(wr,...Er);return br.set(wr,jr),jr}}const ut$2=Object.freeze(Object.defineProperty({__proto__:null,aInRange,abool,abytes,bitGet,bitLen,bitMask,bitSet,bytesToHex,bytesToNumberBE,bytesToNumberLE,concatBytes,createHmacDrbg,ensureBytes,equalBytes,hexToBytes,hexToNumber,inRange:inRange$1,isBytes:isBytes$2,memoized,notImplemented,numberToBytesBE,numberToBytesLE,numberToHexUnpadded,numberToVarBytesBE,utf8ToBytes,validateObject},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$3=BigInt(0),_1n$5=BigInt(1),_2n$3=BigInt(2),_3n$1=BigInt(3),_4n=BigInt(4),_5n$1=BigInt(5),_8n$2=BigInt(8);function mod(fr,br){const wr=fr%br;return wr>=_0n$3?wr:br+wr}function pow(fr,br,wr){if(br<_0n$3)throw new Error("invalid exponent, negatives unsupported");if(wr<=_0n$3)throw new Error("invalid modulus");if(wr===_1n$5)return _0n$3;let Er=_1n$5;for(;br>_0n$3;)br&_1n$5&&(Er=Er*fr%wr),fr=fr*fr%wr,br>>=_1n$5;return Er}function pow2(fr,br,wr){let Er=fr;for(;br-- >_0n$3;)Er*=Er,Er%=wr;return Er}function invert(fr,br){if(fr===_0n$3)throw new Error("invert: expected non-zero number");if(br<=_0n$3)throw new Error("invert: expected positive modulus, got "+br);let wr=mod(fr,br),Er=br,kr=_0n$3,jr=_1n$5;for(;wr!==_0n$3;){const Wr=Er/wr,qr=Er%wr,Gr=kr-jr*Wr;Er=wr,wr=qr,kr=jr,jr=Gr}if(Er!==_1n$5)throw new Error("invert: does not exist");return mod(kr,br)}function tonelliShanks(fr){const br=(fr-_1n$5)/_2n$3;let wr,Er,kr;for(wr=fr-_1n$5,Er=0;wr%_2n$3===_0n$3;wr/=_2n$3,Er++);for(kr=_2n$3;kr1e3)throw new Error("Cannot find square root: likely non-prime P");if(Er===1){const Br=(fr+_1n$5)/_4n;return function(qr,Gr){const Vr=qr.pow(Gr,Br);if(!qr.eql(qr.sqr(Vr),Gr))throw new Error("Cannot find square root");return Vr}}const jr=(wr+_1n$5)/_2n$3;return function(Wr,qr){if(Wr.pow(qr,br)===Wr.neg(Wr.ONE))throw new Error("Cannot find square root");let Gr=Er,Vr=Wr.pow(Wr.mul(Wr.ONE,kr),wr),Zr=Wr.pow(qr,jr),Jr=Wr.pow(qr,wr);for(;!Wr.eql(Jr,Wr.ONE);){if(Wr.eql(Jr,Wr.ZERO))return Wr.ZERO;let Qr=1;for(let En=Wr.sqr(Jr);Qr(mod(fr,br)&_1n$5)===_1n$5,FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(fr){const br={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},wr=FIELD_FIELDS.reduce((Er,kr)=>(Er[kr]="function",Er),br);return validateObject(fr,wr)}function FpPow(fr,br,wr){if(wr<_0n$3)throw new Error("invalid exponent, negatives unsupported");if(wr===_0n$3)return fr.ONE;if(wr===_1n$5)return br;let Er=fr.ONE,kr=br;for(;wr>_0n$3;)wr&_1n$5&&(Er=fr.mul(Er,kr)),kr=fr.sqr(kr),wr>>=_1n$5;return Er}function FpInvertBatch(fr,br){const wr=new Array(br.length),Er=br.reduce((jr,Br,Wr)=>fr.is0(Br)?jr:(wr[Wr]=jr,fr.mul(jr,Br)),fr.ONE),kr=fr.inv(Er);return br.reduceRight((jr,Br,Wr)=>fr.is0(Br)?jr:(wr[Wr]=fr.mul(jr,wr[Wr]),fr.mul(jr,Br)),kr),wr}function nLength(fr,br){const wr=br!==void 0?br:fr.toString(2).length,Er=Math.ceil(wr/8);return{nBitLength:wr,nByteLength:Er}}function Field(fr,br,wr=!1,Er={}){if(fr<=_0n$3)throw new Error("invalid field: expected ORDER > 0, got "+fr);const{nBitLength:kr,nByteLength:jr}=nLength(fr,br);if(jr>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let Br;const Wr=Object.freeze({ORDER:fr,BITS:kr,BYTES:jr,MASK:bitMask(kr),ZERO:_0n$3,ONE:_1n$5,create:qr=>mod(qr,fr),isValid:qr=>{if(typeof qr!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof qr);return _0n$3<=qr&&qrqr===_0n$3,isOdd:qr=>(qr&_1n$5)===_1n$5,neg:qr=>mod(-qr,fr),eql:(qr,Gr)=>qr===Gr,sqr:qr=>mod(qr*qr,fr),add:(qr,Gr)=>mod(qr+Gr,fr),sub:(qr,Gr)=>mod(qr-Gr,fr),mul:(qr,Gr)=>mod(qr*Gr,fr),pow:(qr,Gr)=>FpPow(Wr,qr,Gr),div:(qr,Gr)=>mod(qr*invert(Gr,fr),fr),sqrN:qr=>qr*qr,addN:(qr,Gr)=>qr+Gr,subN:(qr,Gr)=>qr-Gr,mulN:(qr,Gr)=>qr*Gr,inv:qr=>invert(qr,fr),sqrt:Er.sqrt||(qr=>(Br||(Br=FpSqrt(fr)),Br(Wr,qr))),invertBatch:qr=>FpInvertBatch(Wr,qr),cmov:(qr,Gr,Vr)=>Vr?Gr:qr,toBytes:qr=>wr?numberToBytesLE(qr,jr):numberToBytesBE(qr,jr),fromBytes:qr=>{if(qr.length!==jr)throw new Error("Field.fromBytes: expected "+jr+" bytes, got "+qr.length);return wr?bytesToNumberLE(qr):bytesToNumberBE(qr)}});return Object.freeze(Wr)}function getFieldBytesLength(fr){if(typeof fr!="bigint")throw new Error("field order must be bigint");const br=fr.toString(2).length;return Math.ceil(br/8)}function getMinHashLength(fr){const br=getFieldBytesLength(fr);return br+Math.ceil(br/2)}function mapHashToField(fr,br,wr=!1){const Er=fr.length,kr=getFieldBytesLength(br),jr=getMinHashLength(br);if(Er<16||Er1024)throw new Error("expected "+jr+"-1024 bytes of input, got "+Er);const Br=wr?bytesToNumberBE(fr):bytesToNumberLE(fr),Wr=mod(Br,br-_1n$5)+_1n$5;return wr?numberToBytesLE(Wr,kr):numberToBytesBE(Wr,kr)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$2=BigInt(0),_1n$4=BigInt(1);function constTimeNegate(fr,br){const wr=br.negate();return fr?wr:br}function validateW(fr,br){if(!Number.isSafeInteger(fr)||fr<=0||fr>br)throw new Error("invalid window size, expected [1.."+br+"], got W="+fr)}function calcWOpts(fr,br){validateW(fr,br);const wr=Math.ceil(br/fr)+1,Er=2**(fr-1);return{windows:wr,windowSize:Er}}function validateMSMPoints(fr,br){if(!Array.isArray(fr))throw new Error("array expected");fr.forEach((wr,Er)=>{if(!(wr instanceof br))throw new Error("invalid point at index "+Er)})}function validateMSMScalars(fr,br){if(!Array.isArray(fr))throw new Error("array of scalars expected");fr.forEach((wr,Er)=>{if(!br.isValid(wr))throw new Error("invalid scalar at index "+Er)})}const pointPrecomputes=new WeakMap,pointWindowSizes=new WeakMap;function getW(fr){return pointWindowSizes.get(fr)||1}function wNAF(fr,br){return{constTimeNegate,hasPrecomputes(wr){return getW(wr)!==1},unsafeLadder(wr,Er,kr=fr.ZERO){let jr=wr;for(;Er>_0n$2;)Er&_1n$4&&(kr=kr.add(jr)),jr=jr.double(),Er>>=_1n$4;return kr},precomputeWindow(wr,Er){const{windows:kr,windowSize:jr}=calcWOpts(Er,br),Br=[];let Wr=wr,qr=Wr;for(let Gr=0;Gr>=Zr,_n>Br&&(_n-=Vr,kr+=_1n$4);const En=Qr,Cn=Qr+Math.abs(_n)-1,In=Jr%2!==0,An=_n<0;_n===0?qr=qr.add(constTimeNegate(In,Er[En])):Wr=Wr.add(constTimeNegate(An,Er[Cn]))}return{p:Wr,f:qr}},wNAFUnsafe(wr,Er,kr,jr=fr.ZERO){const{windows:Br,windowSize:Wr}=calcWOpts(wr,br),qr=BigInt(2**wr-1),Gr=2**wr,Vr=BigInt(wr);for(let Zr=0;Zr>=Vr,Qr>Wr&&(Qr-=Gr,kr+=_1n$4),Qr===0)continue;let _n=Er[Jr+Math.abs(Qr)-1];Qr<0&&(_n=_n.negate()),jr=jr.add(_n)}return jr},getPrecomputes(wr,Er,kr){let jr=pointPrecomputes.get(Er);return jr||(jr=this.precomputeWindow(Er,wr),wr!==1&&pointPrecomputes.set(Er,kr(jr))),jr},wNAFCached(wr,Er,kr){const jr=getW(wr);return this.wNAF(jr,this.getPrecomputes(jr,wr,kr),Er)},wNAFCachedUnsafe(wr,Er,kr,jr){const Br=getW(wr);return Br===1?this.unsafeLadder(wr,Er,jr):this.wNAFUnsafe(Br,this.getPrecomputes(Br,wr,kr),Er,jr)},setWindowSize(wr,Er){validateW(Er,br),pointWindowSizes.set(wr,Er),pointPrecomputes.delete(wr)}}}function pippenger(fr,br,wr,Er){if(validateMSMPoints(wr,fr),validateMSMScalars(Er,br),wr.length!==Er.length)throw new Error("arrays of points and scalars must have equal length");const kr=fr.ZERO,jr=bitLen(BigInt(wr.length)),Br=jr>12?jr-3:jr>4?jr-2:jr?2:1,Wr=(1<=0;Zr-=Br){qr.fill(kr);for(let Qr=0;Qr>BigInt(Zr)&BigInt(Wr));qr[En]=qr[En].add(wr[Qr])}let Jr=kr;for(let Qr=qr.length-1,_n=kr;Qr>0;Qr--)_n=_n.add(qr[Qr]),Jr=Jr.add(_n);if(Vr=Vr.add(Jr),Zr!==0)for(let Qr=0;Qr{const{Err:wr}=DER;if(fr<0||fr>256)throw new wr("tlv.encode: wrong tag");if(br.length&1)throw new wr("tlv.encode: unpadded data");const Er=br.length/2,kr=numberToHexUnpadded(Er);if(kr.length/2&128)throw new wr("tlv.encode: long form length too big");const jr=Er>127?numberToHexUnpadded(kr.length/2|128):"";return numberToHexUnpadded(fr)+jr+kr+br},decode(fr,br){const{Err:wr}=DER;let Er=0;if(fr<0||fr>256)throw new wr("tlv.encode: wrong tag");if(br.length<2||br[Er++]!==fr)throw new wr("tlv.decode: wrong tlv");const kr=br[Er++],jr=!!(kr&128);let Br=0;if(!jr)Br=kr;else{const qr=kr&127;if(!qr)throw new wr("tlv.decode(long): indefinite length not supported");if(qr>4)throw new wr("tlv.decode(long): byte length is too big");const Gr=br.subarray(Er,Er+qr);if(Gr.length!==qr)throw new wr("tlv.decode: length bytes not complete");if(Gr[0]===0)throw new wr("tlv.decode(long): zero leftmost byte");for(const Vr of Gr)Br=Br<<8|Vr;if(Er+=qr,Br<128)throw new wr("tlv.decode(long): not minimal encoding")}const Wr=br.subarray(Er,Er+Br);if(Wr.length!==Br)throw new wr("tlv.decode: wrong value length");return{v:Wr,l:br.subarray(Er+Br)}}},_int:{encode(fr){const{Err:br}=DER;if(fr<_0n$1)throw new br("integer: negative integers are not allowed");let wr=numberToHexUnpadded(fr);if(Number.parseInt(wr[0],16)&8&&(wr="00"+wr),wr.length&1)throw new br("unexpected DER parsing assertion: unpadded hex");return wr},decode(fr){const{Err:br}=DER;if(fr[0]&128)throw new br("invalid signature integer: negative");if(fr[0]===0&&!(fr[1]&128))throw new br("invalid signature integer: unnecessary leading zero");return b2n(fr)}},toSig(fr){const{Err:br,_int:wr,_tlv:Er}=DER,kr=typeof fr=="string"?h2b(fr):fr;abytes(kr);const{v:jr,l:Br}=Er.decode(48,kr);if(Br.length)throw new br("invalid signature: left bytes after parsing");const{v:Wr,l:qr}=Er.decode(2,jr),{v:Gr,l:Vr}=Er.decode(2,qr);if(Vr.length)throw new br("invalid signature: left bytes after parsing");return{r:wr.decode(Wr),s:wr.decode(Gr)}},hexFromSig(fr){const{_tlv:br,_int:wr}=DER,Er=br.encode(2,wr.encode(fr.r)),kr=br.encode(2,wr.encode(fr.s)),jr=Er+kr;return br.encode(48,jr)}},_0n$1=BigInt(0),_1n$3=BigInt(1);BigInt(2);const _3n=BigInt(3);BigInt(4);function weierstrassPoints(fr){const br=validatePointOpts(fr),{Fp:wr}=br,Er=Field(br.n,br.nBitLength),kr=br.toBytes||((En,Cn,In)=>{const An=Cn.toAffine();return concatBytes(Uint8Array.from([4]),wr.toBytes(An.x),wr.toBytes(An.y))}),jr=br.fromBytes||(En=>{const Cn=En.subarray(1),In=wr.fromBytes(Cn.subarray(0,wr.BYTES)),An=wr.fromBytes(Cn.subarray(wr.BYTES,2*wr.BYTES));return{x:In,y:An}});function Br(En){const{a:Cn,b:In}=br,An=wr.sqr(En),jn=wr.mul(An,En);return wr.add(wr.add(jn,wr.mul(En,Cn)),In)}if(!wr.eql(wr.sqr(br.Gy),Br(br.Gx)))throw new Error("bad generator point: equation left != right");function Wr(En){return inRange$1(En,_1n$3,br.n)}function qr(En){const{allowedPrivateKeyLengths:Cn,nByteLength:In,wrapPrivateKey:An,n:jn}=br;if(Cn&&typeof En!="bigint"){if(isBytes$2(En)&&(En=bytesToHex(En)),typeof En!="string"||!Cn.includes(En.length))throw new Error("invalid private key");En=En.padStart(In*2,"0")}let eo;try{eo=typeof En=="bigint"?En:bytesToNumberBE(ensureBytes("private key",En,In))}catch{throw new Error("invalid private key, expected hex or "+In+" bytes, got "+typeof En)}return An&&(eo=mod(eo,jn)),aInRange("private key",eo,_1n$3,jn),eo}function Gr(En){if(!(En instanceof Jr))throw new Error("ProjectivePoint expected")}const Vr=memoized((En,Cn)=>{const{px:In,py:An,pz:jn}=En;if(wr.eql(jn,wr.ONE))return{x:In,y:An};const eo=En.is0();Cn==null&&(Cn=eo?wr.ONE:wr.inv(jn));const ro=wr.mul(In,Cn),to=wr.mul(An,Cn),_i=wr.mul(jn,Cn);if(eo)return{x:wr.ZERO,y:wr.ZERO};if(!wr.eql(_i,wr.ONE))throw new Error("invZ was invalid");return{x:ro,y:to}}),Zr=memoized(En=>{if(En.is0()){if(br.allowInfinityPoint&&!wr.is0(En.py))return;throw new Error("bad point: ZERO")}const{x:Cn,y:In}=En.toAffine();if(!wr.isValid(Cn)||!wr.isValid(In))throw new Error("bad point: x or y not FE");const An=wr.sqr(In),jn=Br(Cn);if(!wr.eql(An,jn))throw new Error("bad point: equation left != right");if(!En.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class Jr{constructor(Cn,In,An){if(this.px=Cn,this.py=In,this.pz=An,Cn==null||!wr.isValid(Cn))throw new Error("x required");if(In==null||!wr.isValid(In))throw new Error("y required");if(An==null||!wr.isValid(An))throw new Error("z required");Object.freeze(this)}static fromAffine(Cn){const{x:In,y:An}=Cn||{};if(!Cn||!wr.isValid(In)||!wr.isValid(An))throw new Error("invalid affine point");if(Cn instanceof Jr)throw new Error("projective point not allowed");const jn=eo=>wr.eql(eo,wr.ZERO);return jn(In)&&jn(An)?Jr.ZERO:new Jr(In,An,wr.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(Cn){const In=wr.invertBatch(Cn.map(An=>An.pz));return Cn.map((An,jn)=>An.toAffine(In[jn])).map(Jr.fromAffine)}static fromHex(Cn){const In=Jr.fromAffine(jr(ensureBytes("pointHex",Cn)));return In.assertValidity(),In}static fromPrivateKey(Cn){return Jr.BASE.multiply(qr(Cn))}static msm(Cn,In){return pippenger(Jr,Er,Cn,In)}_setWindowSize(Cn){_n.setWindowSize(this,Cn)}assertValidity(){Zr(this)}hasEvenY(){const{y:Cn}=this.toAffine();if(wr.isOdd)return!wr.isOdd(Cn);throw new Error("Field doesn't support isOdd")}equals(Cn){Gr(Cn);const{px:In,py:An,pz:jn}=this,{px:eo,py:ro,pz:to}=Cn,_i=wr.eql(wr.mul(In,to),wr.mul(eo,jn)),oo=wr.eql(wr.mul(An,to),wr.mul(ro,jn));return _i&&oo}negate(){return new Jr(this.px,wr.neg(this.py),this.pz)}double(){const{a:Cn,b:In}=br,An=wr.mul(In,_3n),{px:jn,py:eo,pz:ro}=this;let to=wr.ZERO,_i=wr.ZERO,oo=wr.ZERO,io=wr.mul(jn,jn),co=wr.mul(eo,eo),so=wr.mul(ro,ro),no=wr.mul(jn,eo);return no=wr.add(no,no),oo=wr.mul(jn,ro),oo=wr.add(oo,oo),to=wr.mul(Cn,oo),_i=wr.mul(An,so),_i=wr.add(to,_i),to=wr.sub(co,_i),_i=wr.add(co,_i),_i=wr.mul(to,_i),to=wr.mul(no,to),oo=wr.mul(An,oo),so=wr.mul(Cn,so),no=wr.sub(io,so),no=wr.mul(Cn,no),no=wr.add(no,oo),oo=wr.add(io,io),io=wr.add(oo,io),io=wr.add(io,so),io=wr.mul(io,no),_i=wr.add(_i,io),so=wr.mul(eo,ro),so=wr.add(so,so),io=wr.mul(so,no),to=wr.sub(to,io),oo=wr.mul(so,co),oo=wr.add(oo,oo),oo=wr.add(oo,oo),new Jr(to,_i,oo)}add(Cn){Gr(Cn);const{px:In,py:An,pz:jn}=this,{px:eo,py:ro,pz:to}=Cn;let _i=wr.ZERO,oo=wr.ZERO,io=wr.ZERO;const co=br.a,so=wr.mul(br.b,_3n);let no=wr.mul(In,eo),Tn=wr.mul(An,ro),Hr=wr.mul(jn,to),Xr=wr.add(In,An),Sn=wr.add(eo,ro);Xr=wr.mul(Xr,Sn),Sn=wr.add(no,Tn),Xr=wr.sub(Xr,Sn),Sn=wr.add(In,jn);let Rn=wr.add(eo,to);return Sn=wr.mul(Sn,Rn),Rn=wr.add(no,Hr),Sn=wr.sub(Sn,Rn),Rn=wr.add(An,jn),_i=wr.add(ro,to),Rn=wr.mul(Rn,_i),_i=wr.add(Tn,Hr),Rn=wr.sub(Rn,_i),io=wr.mul(co,Sn),_i=wr.mul(so,Hr),io=wr.add(_i,io),_i=wr.sub(Tn,io),io=wr.add(Tn,io),oo=wr.mul(_i,io),Tn=wr.add(no,no),Tn=wr.add(Tn,no),Hr=wr.mul(co,Hr),Sn=wr.mul(so,Sn),Tn=wr.add(Tn,Hr),Hr=wr.sub(no,Hr),Hr=wr.mul(co,Hr),Sn=wr.add(Sn,Hr),no=wr.mul(Tn,Sn),oo=wr.add(oo,no),no=wr.mul(Rn,Sn),_i=wr.mul(Xr,_i),_i=wr.sub(_i,no),no=wr.mul(Xr,Tn),io=wr.mul(Rn,io),io=wr.add(io,no),new Jr(_i,oo,io)}subtract(Cn){return this.add(Cn.negate())}is0(){return this.equals(Jr.ZERO)}wNAF(Cn){return _n.wNAFCached(this,Cn,Jr.normalizeZ)}multiplyUnsafe(Cn){const{endo:In,n:An}=br;aInRange("scalar",Cn,_0n$1,An);const jn=Jr.ZERO;if(Cn===_0n$1)return jn;if(this.is0()||Cn===_1n$3)return this;if(!In||_n.hasPrecomputes(this))return _n.wNAFCachedUnsafe(this,Cn,Jr.normalizeZ);let{k1neg:eo,k1:ro,k2neg:to,k2:_i}=In.splitScalar(Cn),oo=jn,io=jn,co=this;for(;ro>_0n$1||_i>_0n$1;)ro&_1n$3&&(oo=oo.add(co)),_i&_1n$3&&(io=io.add(co)),co=co.double(),ro>>=_1n$3,_i>>=_1n$3;return eo&&(oo=oo.negate()),to&&(io=io.negate()),io=new Jr(wr.mul(io.px,In.beta),io.py,io.pz),oo.add(io)}multiply(Cn){const{endo:In,n:An}=br;aInRange("scalar",Cn,_1n$3,An);let jn,eo;if(In){const{k1neg:ro,k1:to,k2neg:_i,k2:oo}=In.splitScalar(Cn);let{p:io,f:co}=this.wNAF(to),{p:so,f:no}=this.wNAF(oo);io=_n.constTimeNegate(ro,io),so=_n.constTimeNegate(_i,so),so=new Jr(wr.mul(so.px,In.beta),so.py,so.pz),jn=io.add(so),eo=co.add(no)}else{const{p:ro,f:to}=this.wNAF(Cn);jn=ro,eo=to}return Jr.normalizeZ([jn,eo])[0]}multiplyAndAddUnsafe(Cn,In,An){const jn=Jr.BASE,eo=(to,_i)=>_i===_0n$1||_i===_1n$3||!to.equals(jn)?to.multiplyUnsafe(_i):to.multiply(_i),ro=eo(this,In).add(eo(Cn,An));return ro.is0()?void 0:ro}toAffine(Cn){return Vr(this,Cn)}isTorsionFree(){const{h:Cn,isTorsionFree:In}=br;if(Cn===_1n$3)return!0;if(In)return In(Jr,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:Cn,clearCofactor:In}=br;return Cn===_1n$3?this:In?In(Jr,this):this.multiplyUnsafe(br.h)}toRawBytes(Cn=!0){return abool("isCompressed",Cn),this.assertValidity(),kr(Jr,this,Cn)}toHex(Cn=!0){return abool("isCompressed",Cn),bytesToHex(this.toRawBytes(Cn))}}Jr.BASE=new Jr(br.Gx,br.Gy,wr.ONE),Jr.ZERO=new Jr(wr.ZERO,wr.ONE,wr.ZERO);const Qr=br.nBitLength,_n=wNAF(Jr,br.endo?Math.ceil(Qr/2):Qr);return{CURVE:br,ProjectivePoint:Jr,normPrivateKeyToScalar:qr,weierstrassEquation:Br,isWithinCurveOrder:Wr}}function validateOpts$1(fr){const br=validateBasic(fr);return validateObject(br,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...br})}function weierstrass(fr){const br=validateOpts$1(fr),{Fp:wr,n:Er}=br,kr=wr.BYTES+1,jr=2*wr.BYTES+1;function Br(Hr){return mod(Hr,Er)}function Wr(Hr){return invert(Hr,Er)}const{ProjectivePoint:qr,normPrivateKeyToScalar:Gr,weierstrassEquation:Vr,isWithinCurveOrder:Zr}=weierstrassPoints({...br,toBytes(Hr,Xr,Sn){const Rn=Xr.toAffine(),Pn=wr.toBytes(Rn.x),On=concatBytes;return abool("isCompressed",Sn),Sn?On(Uint8Array.from([Xr.hasEvenY()?2:3]),Pn):On(Uint8Array.from([4]),Pn,wr.toBytes(Rn.y))},fromBytes(Hr){const Xr=Hr.length,Sn=Hr[0],Rn=Hr.subarray(1);if(Xr===kr&&(Sn===2||Sn===3)){const Pn=bytesToNumberBE(Rn);if(!inRange$1(Pn,_1n$3,wr.ORDER))throw new Error("Point is not on curve");const On=Vr(Pn);let Zn;try{Zn=wr.sqrt(On)}catch(zn){const fo=zn instanceof Error?": "+zn.message:"";throw new Error("Point is not on curve"+fo)}const Nn=(Zn&_1n$3)===_1n$3;return(Sn&1)===1!==Nn&&(Zn=wr.neg(Zn)),{x:Pn,y:Zn}}else if(Xr===jr&&Sn===4){const Pn=wr.fromBytes(Rn.subarray(0,wr.BYTES)),On=wr.fromBytes(Rn.subarray(wr.BYTES,2*wr.BYTES));return{x:Pn,y:On}}else{const Pn=kr,On=jr;throw new Error("invalid Point, expected length of "+Pn+", or uncompressed "+On+", got "+Xr)}}}),Jr=Hr=>bytesToHex(numberToBytesBE(Hr,br.nByteLength));function Qr(Hr){const Xr=Er>>_1n$3;return Hr>Xr}function _n(Hr){return Qr(Hr)?Br(-Hr):Hr}const En=(Hr,Xr,Sn)=>bytesToNumberBE(Hr.slice(Xr,Sn));class Cn{constructor(Xr,Sn,Rn){this.r=Xr,this.s=Sn,this.recovery=Rn,this.assertValidity()}static fromCompact(Xr){const Sn=br.nByteLength;return Xr=ensureBytes("compactSignature",Xr,Sn*2),new Cn(En(Xr,0,Sn),En(Xr,Sn,2*Sn))}static fromDER(Xr){const{r:Sn,s:Rn}=DER.toSig(ensureBytes("DER",Xr));return new Cn(Sn,Rn)}assertValidity(){aInRange("r",this.r,_1n$3,Er),aInRange("s",this.s,_1n$3,Er)}addRecoveryBit(Xr){return new Cn(this.r,this.s,Xr)}recoverPublicKey(Xr){const{r:Sn,s:Rn,recovery:Pn}=this,On=to(ensureBytes("msgHash",Xr));if(Pn==null||![0,1,2,3].includes(Pn))throw new Error("recovery id invalid");const Zn=Pn===2||Pn===3?Sn+br.n:Sn;if(Zn>=wr.ORDER)throw new Error("recovery id 2 or 3 invalid");const Nn=Pn&1?"03":"02",wn=qr.fromHex(Nn+Jr(Zn)),zn=Wr(Zn),fo=Br(-On*zn),vo=Br(Rn*zn),go=qr.BASE.multiplyAndAddUnsafe(wn,fo,vo);if(!go)throw new Error("point at infinify");return go.assertValidity(),go}hasHighS(){return Qr(this.s)}normalizeS(){return this.hasHighS()?new Cn(this.r,Br(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes(this.toCompactHex())}toCompactHex(){return Jr(this.r)+Jr(this.s)}}const In={isValidPrivateKey(Hr){try{return Gr(Hr),!0}catch{return!1}},normPrivateKeyToScalar:Gr,randomPrivateKey:()=>{const Hr=getMinHashLength(br.n);return mapHashToField(br.randomBytes(Hr),br.n)},precompute(Hr=8,Xr=qr.BASE){return Xr._setWindowSize(Hr),Xr.multiply(BigInt(3)),Xr}};function An(Hr,Xr=!0){return qr.fromPrivateKey(Hr).toRawBytes(Xr)}function jn(Hr){const Xr=isBytes$2(Hr),Sn=typeof Hr=="string",Rn=(Xr||Sn)&&Hr.length;return Xr?Rn===kr||Rn===jr:Sn?Rn===2*kr||Rn===2*jr:Hr instanceof qr}function eo(Hr,Xr,Sn=!0){if(jn(Hr))throw new Error("first arg must be private key");if(!jn(Xr))throw new Error("second arg must be public key");return qr.fromHex(Xr).multiply(Gr(Hr)).toRawBytes(Sn)}const ro=br.bits2int||function(Hr){if(Hr.length>8192)throw new Error("input is too large");const Xr=bytesToNumberBE(Hr),Sn=Hr.length*8-br.nBitLength;return Sn>0?Xr>>BigInt(Sn):Xr},to=br.bits2int_modN||function(Hr){return Br(ro(Hr))},_i=bitMask(br.nBitLength);function oo(Hr){return aInRange("num < 2^"+br.nBitLength,Hr,_0n$1,_i),numberToBytesBE(Hr,br.nByteLength)}function io(Hr,Xr,Sn=co){if(["recovered","canonical"].some(lo=>lo in Sn))throw new Error("sign() legacy options not supported");const{hash:Rn,randomBytes:Pn}=br;let{lowS:On,prehash:Zn,extraEntropy:Nn}=Sn;On==null&&(On=!0),Hr=ensureBytes("msgHash",Hr),validateSigVerOpts(Sn),Zn&&(Hr=ensureBytes("prehashed msgHash",Rn(Hr)));const wn=to(Hr),zn=Gr(Xr),fo=[oo(zn),oo(wn)];if(Nn!=null&&Nn!==!1){const lo=Nn===!0?Pn(wr.BYTES):Nn;fo.push(ensureBytes("extraEntropy",lo))}const vo=concatBytes(...fo),go=wn;function uo(lo){const Eo=ro(lo);if(!Zr(Eo))return;const mo=Wr(Eo),yo=qr.BASE.multiply(Eo).toAffine(),_o=Br(yo.x);if(_o===_0n$1)return;const Bo=Br(mo*Br(go+_o*zn));if(Bo===_0n$1)return;let Lo=(yo.x===_o?0:2)|Number(yo.y&_1n$3),Wo=Bo;return On&&Qr(Bo)&&(Wo=_n(Bo),Lo^=1),new Cn(_o,Wo,Lo)}return{seed:vo,k2sig:uo}}const co={lowS:br.lowS,prehash:!1},so={lowS:br.lowS,prehash:!1};function no(Hr,Xr,Sn=co){const{seed:Rn,k2sig:Pn}=io(Hr,Xr,Sn),On=br;return createHmacDrbg(On.hash.outputLen,On.nByteLength,On.hmac)(Rn,Pn)}qr.BASE._setWindowSize(8);function Tn(Hr,Xr,Sn,Rn=so){var Lo;const Pn=Hr;Xr=ensureBytes("msgHash",Xr),Sn=ensureBytes("publicKey",Sn);const{lowS:On,prehash:Zn,format:Nn}=Rn;if(validateSigVerOpts(Rn),"strict"in Rn)throw new Error("options.strict was renamed to lowS");if(Nn!==void 0&&Nn!=="compact"&&Nn!=="der")throw new Error("format must be compact or der");const wn=typeof Pn=="string"||isBytes$2(Pn),zn=!wn&&!Nn&&typeof Pn=="object"&&Pn!==null&&typeof Pn.r=="bigint"&&typeof Pn.s=="bigint";if(!wn&&!zn)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let fo,vo;try{if(zn&&(fo=new Cn(Pn.r,Pn.s)),wn){try{Nn!=="compact"&&(fo=Cn.fromDER(Pn))}catch(Wo){if(!(Wo instanceof DER.Err))throw Wo}!fo&&Nn!=="der"&&(fo=Cn.fromCompact(Pn))}vo=qr.fromHex(Sn)}catch{return!1}if(!fo||On&&fo.hasHighS())return!1;Zn&&(Xr=br.hash(Xr));const{r:go,s:uo}=fo,lo=to(Xr),Eo=Wr(uo),mo=Br(lo*Eo),yo=Br(go*Eo),_o=(Lo=qr.BASE.multiplyAndAddUnsafe(vo,mo,yo))==null?void 0:Lo.toAffine();return _o?Br(_o.x)===go:!1}return{CURVE:br,getPublicKey:An,getSharedSecret:eo,sign:no,verify:Tn,ProjectivePoint:qr,Signature:Cn,utils:In}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash(fr){return{hash:fr,hmac:(br,...wr)=>hmac$3(fr,br,concatBytes$1(...wr)),randomBytes}}function createCurve(fr,br){const wr=Er=>weierstrass({...fr,...getHash(Er)});return Object.freeze({...wr(br),create:wr})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n$2=BigInt(1),_2n$2=BigInt(2),divNearest=(fr,br)=>(fr+br/_2n$2)/br;function sqrtMod(fr){const br=secp256k1P,wr=BigInt(3),Er=BigInt(6),kr=BigInt(11),jr=BigInt(22),Br=BigInt(23),Wr=BigInt(44),qr=BigInt(88),Gr=fr*fr*fr%br,Vr=Gr*Gr*fr%br,Zr=pow2(Vr,wr,br)*Vr%br,Jr=pow2(Zr,wr,br)*Vr%br,Qr=pow2(Jr,_2n$2,br)*Gr%br,_n=pow2(Qr,kr,br)*Qr%br,En=pow2(_n,jr,br)*_n%br,Cn=pow2(En,Wr,br)*En%br,In=pow2(Cn,qr,br)*Cn%br,An=pow2(In,Wr,br)*En%br,jn=pow2(An,wr,br)*Vr%br,eo=pow2(jn,Br,br)*_n%br,ro=pow2(eo,Er,br)*Gr%br,to=pow2(ro,_2n$2,br);if(!Fpk1.eql(Fpk1.sqr(to),fr))throw new Error("Cannot find square root");return to}const Fpk1=Field(secp256k1P,void 0,void 0,{sqrt:sqrtMod}),secp256k1$1=createCurve({a:BigInt(0),b:BigInt(7),Fp:Fpk1,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:fr=>{const br=secp256k1N,wr=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),Er=-_1n$2*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),kr=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),jr=wr,Br=BigInt("0x100000000000000000000000000000000"),Wr=divNearest(jr*fr,br),qr=divNearest(-Er*fr,br);let Gr=mod(fr-Wr*wr-qr*kr,br),Vr=mod(-Wr*Er-qr*jr,br);const Zr=Gr>Br,Jr=Vr>Br;if(Zr&&(Gr=br-Gr),Jr&&(Vr=br-Vr),Gr>Br||Vr>Br)throw new Error("splitScalar: Endomorphism failed, k="+fr);return{k1neg:Zr,k1:Gr,k2neg:Jr,k2:Vr}}}},sha256$3);BigInt(0);secp256k1$1.ProjectivePoint;/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function isBytes$1(fr){return fr instanceof Uint8Array||ArrayBuffer.isView(fr)&&fr.constructor.name==="Uint8Array"}function isArrayOf(fr,br){return Array.isArray(br)?br.length===0?!0:fr?br.every(wr=>typeof wr=="string"):br.every(wr=>Number.isSafeInteger(wr)):!1}function afn(fr){if(typeof fr!="function")throw new Error("function expected");return!0}function astr(fr,br){if(typeof br!="string")throw new Error(`${fr}: string expected`);return!0}function anumber(fr){if(!Number.isSafeInteger(fr))throw new Error(`invalid integer: ${fr}`)}function aArr(fr){if(!Array.isArray(fr))throw new Error("array expected")}function astrArr(fr,br){if(!isArrayOf(!0,br))throw new Error(`${fr}: array of strings expected`)}function anumArr(fr,br){if(!isArrayOf(!1,br))throw new Error(`${fr}: array of numbers expected`)}function chain$1(...fr){const br=jr=>jr,wr=(jr,Br)=>Wr=>jr(Br(Wr)),Er=fr.map(jr=>jr.encode).reduceRight(wr,br),kr=fr.map(jr=>jr.decode).reduce(wr,br);return{encode:Er,decode:kr}}function alphabet$2(fr){const br=typeof fr=="string"?fr.split(""):fr,wr=br.length;astrArr("alphabet",br);const Er=new Map(br.map((kr,jr)=>[kr,jr]));return{encode:kr=>(aArr(kr),kr.map(jr=>{if(!Number.isSafeInteger(jr)||jr<0||jr>=wr)throw new Error(`alphabet.encode: digit index outside alphabet "${jr}". Allowed: ${fr}`);return br[jr]})),decode:kr=>(aArr(kr),kr.map(jr=>{astr("alphabet.decode",jr);const Br=Er.get(jr);if(Br===void 0)throw new Error(`Unknown letter: "${jr}". Allowed: ${fr}`);return Br}))}}function join$1(fr=""){return astr("join",fr),{encode:br=>(astrArr("join.decode",br),br.join(fr)),decode:br=>(astr("join.decode",br),br.split(fr))}}function convertRadix$1(fr,br,wr){if(br<2)throw new Error(`convertRadix: invalid from=${br}, base cannot be less than 2`);if(wr<2)throw new Error(`convertRadix: invalid to=${wr}, base cannot be less than 2`);if(aArr(fr),!fr.length)return[];let Er=0;const kr=[],jr=Array.from(fr,Wr=>{if(anumber(Wr),Wr<0||Wr>=br)throw new Error(`invalid integer: ${Wr}`);return Wr}),Br=jr.length;for(;;){let Wr=0,qr=!0;for(let Gr=Er;Gr{if(!isBytes$1(wr))throw new Error("radix.encode input should be Uint8Array");return convertRadix$1(Array.from(wr),br,fr)},decode:wr=>(anumArr("radix.decode",wr),Uint8Array.from(convertRadix$1(wr,fr,br)))}}function checksum$1(fr,br){return anumber(fr),afn(br),{encode(wr){if(!isBytes$1(wr))throw new Error("checksum.encode: input should be Uint8Array");const Er=br(wr).slice(0,fr),kr=new Uint8Array(wr.length+fr);return kr.set(wr),kr.set(Er,wr.length),kr},decode(wr){if(!isBytes$1(wr))throw new Error("checksum.decode: input should be Uint8Array");const Er=wr.slice(0,-fr),kr=wr.slice(-fr),jr=br(Er).slice(0,fr);for(let Br=0;Brchain$1(radix$1(58),alphabet$2(fr),join$1("")),base58$2=genBase58$1("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),createBase58check$1=fr=>chain$1(checksum$1(4,br=>fr(fr(br))),base58$2);/*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */const Point$1=secp256k1$1.ProjectivePoint,base58check$1=createBase58check$1(sha256$4);function bytesToNumber$1(fr){abytes$2(fr);const br=fr.length===0?"0":bytesToHex$1(fr);return BigInt("0x"+br)}function numberToBytes$1(fr){if(typeof fr!="bigint")throw new Error("bigint expected");return hexToBytes$1(fr.toString(16).padStart(64,"0"))}const MASTER_SECRET$1=utf8ToBytes$2("Bitcoin seed"),BITCOIN_VERSIONS$1={private:76066276,public:76067358},HARDENED_OFFSET$1=2147483648,hash160$1=fr=>ripemd160$1(sha256$4(fr)),fromU32$1=fr=>createView$1(fr).getUint32(0,!1),toU32$1=fr=>{if(!Number.isSafeInteger(fr)||fr<0||fr>2**32-1)throw new Error("invalid number, should be from 0 to 2**32-1, got "+fr);const br=new Uint8Array(4);return createView$1(br).setUint32(0,fr,!1),br};let HDKey$1=class fy{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return fromU32$1(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){const br=this.privateKey;if(!br)throw new Error("No private key");return base58check$1.encode(this.serialize(this.versions.private,concatBytes$2(new Uint8Array([0]),br)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return base58check$1.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(br,wr=BITCOIN_VERSIONS$1){if(abytes$2(br),8*br.length<128||8*br.length>512)throw new Error("HDKey: seed length must be between 128 and 512 bits; 256 bits is advised, got "+br.length);const Er=hmac$4(sha512$5,MASTER_SECRET$1,br);return new fy({versions:wr,chainCode:Er.slice(32),privateKey:Er.slice(0,32)})}static fromExtendedKey(br,wr=BITCOIN_VERSIONS$1){const Er=base58check$1.decode(br),kr=createView$1(Er),jr=kr.getUint32(0,!1),Br={versions:wr,depth:Er[4],parentFingerprint:kr.getUint32(5,!1),index:kr.getUint32(9,!1),chainCode:Er.slice(13,45)},Wr=Er.slice(45),qr=Wr[0]===0;if(jr!==wr[qr?"private":"public"])throw new Error("Version mismatch");return qr?new fy({...Br,privateKey:Wr.slice(1)}):new fy({...Br,publicKey:Wr})}static fromJSON(br){return fy.fromExtendedKey(br.xpriv)}constructor(br){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!br||typeof br!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=br.versions||BITCOIN_VERSIONS$1,this.depth=br.depth||0,this.chainCode=br.chainCode||null,this.index=br.index||0,this.parentFingerprint=br.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(br.publicKey&&br.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(br.privateKey){if(!secp256k1$1.utils.isValidPrivateKey(br.privateKey))throw new Error("Invalid private key");this.privKey=typeof br.privateKey=="bigint"?br.privateKey:bytesToNumber$1(br.privateKey),this.privKeyBytes=numberToBytes$1(this.privKey),this.pubKey=secp256k1$1.getPublicKey(br.privateKey,!0)}else if(br.publicKey)this.pubKey=Point$1.fromHex(br.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=hash160$1(this.pubKey)}derive(br){if(!/^[mM]'?/.test(br))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(br))return this;const wr=br.replace(/^[mM]'?\//,"").split("/");let Er=this;for(const kr of wr){const jr=/^(\d+)('?)$/.exec(kr),Br=jr&&jr[1];if(!jr||jr.length!==3||typeof Br!="string")throw new Error("invalid child index: "+kr);let Wr=+Br;if(!Number.isSafeInteger(Wr)||Wr>=HARDENED_OFFSET$1)throw new Error("Invalid index");jr[2]==="'"&&(Wr+=HARDENED_OFFSET$1),Er=Er.deriveChild(Wr)}return Er}deriveChild(br){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let wr=toU32$1(br);if(br>=HARDENED_OFFSET$1){const Wr=this.privateKey;if(!Wr)throw new Error("Could not derive hardened child key");wr=concatBytes$2(new Uint8Array([0]),Wr,wr)}else wr=concatBytes$2(this.pubKey,wr);const Er=hmac$4(sha512$5,this.chainCode,wr),kr=bytesToNumber$1(Er.slice(0,32)),jr=Er.slice(32);if(!secp256k1$1.utils.isValidPrivateKey(kr))throw new Error("Tweak bigger than curve order");const Br={versions:this.versions,chainCode:jr,depth:this.depth+1,parentFingerprint:this.fingerprint,index:br};try{if(this.privateKey){const Wr=mod(this.privKey+kr,secp256k1$1.CURVE.n);if(!secp256k1$1.utils.isValidPrivateKey(Wr))throw new Error("The tweak was out of range or the resulted private key is invalid");Br.privateKey=Wr}else{const Wr=Point$1.fromHex(this.pubKey).add(Point$1.fromPrivateKey(kr));if(Wr.equals(Point$1.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");Br.publicKey=Wr.toRawBytes(!0)}return new fy(Br)}catch{return this.deriveChild(br+1)}}sign(br){if(!this.privateKey)throw new Error("No privateKey set!");return abytes$2(br,32),secp256k1$1.sign(br,this.privKey).toCompactRawBytes()}verify(br,wr){if(abytes$2(br,32),abytes$2(wr,64),!this.publicKey)throw new Error("No publicKey set!");let Er;try{Er=secp256k1$1.Signature.fromCompact(wr)}catch{return!1}return secp256k1$1.verify(Er,br,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(br,wr){if(!this.chainCode)throw new Error("No chainCode set");return abytes$2(wr,33),concatBytes$2(toU32$1(br),new Uint8Array([this.depth]),toU32$1(this.parentFingerprint),toU32$1(this.index),this.chainCode,wr)}};const dy=class dy{};Fu(dy,"initialize",async(br,wr="WALLETCLIENT")=>wr==="DYNAMIC"?dy.convertDynamicProvider(br):dy.convertViemWalletClient(br)),Fu(dy,"convertViemWalletClient",async br=>{try{const wr=br.account;if(!wr)throw new Error("WalletClient Account Undefined");const Er=await br.getChainId(),kr=async jr=>{const Br=await br.signMessage({message:jr,account:wr});return hexToBytes$1(Br.replace("0x",""))};return{account:`eip155:${Er}:${getAddress(wr.address)}`,signMessage:kr}}catch{throw new Error("Invalid WalletClient")}}),Fu(dy,"convertDynamicProvider",async br=>{try{let wr=br.address;isAddress(wr,{strict:!1})&&(wr=getAddress(wr));const Er=chainToNamespace[br.chain];if(Er===void 0)throw new Error("Unsupported Namespace");let kr=await br.getNetwork();Er==="solana"&&(kr=networkToSolChainId[kr]);const jr=async Br=>{const Wr=await br.signMessage(Br);return isHex(Wr)?hexToBytes$1(Wr.replace("0x","")):Buffer$2.from(Wr,"base64")};return{account:`${Er}:${kr}:${wr}`,signMessage:jr}}catch{throw new Error("Invalid Dynamic Provider")}});let PushSigner=dy;var ENCRYPTION_TYPE=(fr=>(fr.V1="x25519-xsalsa20-poly1305",fr.V2="aes256GcmHkdfSha256",fr.V3="eip191-aes256-gcm-hkdf-sha256",fr.V4="pgpv1:nft",fr.V5="push:v5",fr))(ENCRYPTION_TYPE||{});const my=class my{constructor(br){Fu(this,"hkdf",async(br,wr)=>{const Er=await crypto.subtle.importKey("raw",br,"HKDF",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:wr,info:new ArrayBuffer(0)},Er,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"])});Fu(this,"aesGcmEncryption",async(br,wr,Er)=>{const Br=crypto.getRandomValues(new Uint8Array(32)),Wr=crypto.getRandomValues(new Uint8Array(12)),qr=await this.hkdf(wr,Br),Gr={name:"AES-GCM",iv:Wr};Er&&(Gr.additionalData=Er);const Vr=await crypto.subtle.encrypt(Gr,qr,br);return{ciphertext:bytesToHex$1(new Uint8Array(Vr)),salt:bytesToHex$1(Br),nonce:bytesToHex$1(Wr)}});Fu(this,"aesGcmDecryption",async(br,wr,Er)=>{const kr=await this.hkdf(wr,hexToBytes$1(br.salt)),jr={name:"AES-GCM",iv:hexToBytes$1(br.nonce)};Er&&(jr.additionalData=Er);const Br=await crypto.subtle.decrypt(jr,kr,hexToBytes$1(br.ciphertext));return new Uint8Array(Br)});Fu(this,"encryptV5",async br=>{const wr=bytesToHex$1(await crypto.getRandomValues(new Uint8Array(32))),Er=`Enable Push Network Profile +`+wr,kr=await this.signer.signMessage(Er),Br=new TextEncoder().encode(br);return{...await this.aesGcmEncryption(Br,kr),version:ENCRYPTION_TYPE.V5,preKey:wr}});Fu(this,"decryptV5",async br=>{const wr=`Enable Push Network Profile +`+br.preKey,Er=await this.signer.signMessage(wr),kr=await this.aesGcmDecryption(br,Er);return new TextDecoder().decode(kr)});this.signer=br}};Fu(my,"encrypt",async(br,wr,Er=ENCRYPTION_TYPE.V5)=>{const kr=new my(wr);switch(Er){case ENCRYPTION_TYPE.V5:return await kr.encryptV5(br);default:throw new Error("Invalid Key Encryption")}}),Fu(my,"decrypt",async(br,wr)=>{const Er=new my(wr);switch(br.version){case ENCRYPTION_TYPE.V5:return Er.decryptV5(br);default:throw new Error("Invalid Key Encryption")}});let PushEncryption=my;const[SHA512_Kh$1,SHA512_Kl$1]=u64$6.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(fr=>BigInt(fr))),SHA512_W_H$1=new Uint32Array(80),SHA512_W_L$1=new Uint32Array(80);let SHA512$1=class extends HashMD$2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:br,Al:wr,Bh:Er,Bl:kr,Ch:jr,Cl:Br,Dh:Wr,Dl:qr,Eh:Gr,El:Vr,Fh:Zr,Fl:Jr,Gh:Qr,Gl:_n,Hh:En,Hl:Cn}=this;return[br,wr,Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En,Cn]}set(br,wr,Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En,Cn){this.Ah=br|0,this.Al=wr|0,this.Bh=Er|0,this.Bl=kr|0,this.Ch=jr|0,this.Cl=Br|0,this.Dh=Wr|0,this.Dl=qr|0,this.Eh=Gr|0,this.El=Vr|0,this.Fh=Zr|0,this.Fl=Jr|0,this.Gh=Qr|0,this.Gl=_n|0,this.Hh=En|0,this.Hl=Cn|0}process(br,wr){for(let jn=0;jn<16;jn++,wr+=4)SHA512_W_H$1[jn]=br.getUint32(wr),SHA512_W_L$1[jn]=br.getUint32(wr+=4);for(let jn=16;jn<80;jn++){const eo=SHA512_W_H$1[jn-15]|0,ro=SHA512_W_L$1[jn-15]|0,to=u64$6.rotrSH(eo,ro,1)^u64$6.rotrSH(eo,ro,8)^u64$6.shrSH(eo,ro,7),_i=u64$6.rotrSL(eo,ro,1)^u64$6.rotrSL(eo,ro,8)^u64$6.shrSL(eo,ro,7),oo=SHA512_W_H$1[jn-2]|0,io=SHA512_W_L$1[jn-2]|0,co=u64$6.rotrSH(oo,io,19)^u64$6.rotrBH(oo,io,61)^u64$6.shrSH(oo,io,6),so=u64$6.rotrSL(oo,io,19)^u64$6.rotrBL(oo,io,61)^u64$6.shrSL(oo,io,6),no=u64$6.add4L(_i,so,SHA512_W_L$1[jn-7],SHA512_W_L$1[jn-16]),Tn=u64$6.add4H(no,to,co,SHA512_W_H$1[jn-7],SHA512_W_H$1[jn-16]);SHA512_W_H$1[jn]=Tn|0,SHA512_W_L$1[jn]=no|0}let{Ah:Er,Al:kr,Bh:jr,Bl:Br,Ch:Wr,Cl:qr,Dh:Gr,Dl:Vr,Eh:Zr,El:Jr,Fh:Qr,Fl:_n,Gh:En,Gl:Cn,Hh:In,Hl:An}=this;for(let jn=0;jn<80;jn++){const eo=u64$6.rotrSH(Zr,Jr,14)^u64$6.rotrSH(Zr,Jr,18)^u64$6.rotrBH(Zr,Jr,41),ro=u64$6.rotrSL(Zr,Jr,14)^u64$6.rotrSL(Zr,Jr,18)^u64$6.rotrBL(Zr,Jr,41),to=Zr&Qr^~Zr&En,_i=Jr&_n^~Jr&Cn,oo=u64$6.add5L(An,ro,_i,SHA512_Kl$1[jn],SHA512_W_L$1[jn]),io=u64$6.add5H(oo,In,eo,to,SHA512_Kh$1[jn],SHA512_W_H$1[jn]),co=oo|0,so=u64$6.rotrSH(Er,kr,28)^u64$6.rotrBH(Er,kr,34)^u64$6.rotrBH(Er,kr,39),no=u64$6.rotrSL(Er,kr,28)^u64$6.rotrBL(Er,kr,34)^u64$6.rotrBL(Er,kr,39),Tn=Er&jr^Er&Wr^jr&Wr,Hr=kr&Br^kr&qr^Br&qr;In=En|0,An=Cn|0,En=Qr|0,Cn=_n|0,Qr=Zr|0,_n=Jr|0,{h:Zr,l:Jr}=u64$6.add(Gr|0,Vr|0,io|0,co|0),Gr=Wr|0,Vr=qr|0,Wr=jr|0,qr=Br|0,jr=Er|0,Br=kr|0;const Xr=u64$6.add3L(co,no,Hr);Er=u64$6.add3H(Xr,io,so,Tn),kr=Xr|0}({h:Er,l:kr}=u64$6.add(this.Ah|0,this.Al|0,Er|0,kr|0)),{h:jr,l:Br}=u64$6.add(this.Bh|0,this.Bl|0,jr|0,Br|0),{h:Wr,l:qr}=u64$6.add(this.Ch|0,this.Cl|0,Wr|0,qr|0),{h:Gr,l:Vr}=u64$6.add(this.Dh|0,this.Dl|0,Gr|0,Vr|0),{h:Zr,l:Jr}=u64$6.add(this.Eh|0,this.El|0,Zr|0,Jr|0),{h:Qr,l:_n}=u64$6.add(this.Fh|0,this.Fl|0,Qr|0,_n|0),{h:En,l:Cn}=u64$6.add(this.Gh|0,this.Gl|0,En|0,Cn|0),{h:In,l:An}=u64$6.add(this.Hh|0,this.Hl|0,In|0,An|0),this.set(Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En,Cn,In,An)}roundClean(){SHA512_W_H$1.fill(0),SHA512_W_L$1.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const sha512$4=wrapConstructor$2(()=>new SHA512$1);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function isBytes(fr){return fr instanceof Uint8Array||fr!=null&&typeof fr=="object"&&fr.constructor.name==="Uint8Array"}function chain(...fr){const br=jr=>jr,wr=(jr,Br)=>Wr=>jr(Br(Wr)),Er=fr.map(jr=>jr.encode).reduceRight(wr,br),kr=fr.map(jr=>jr.decode).reduce(wr,br);return{encode:Er,decode:kr}}function alphabet$1(fr){return{encode:br=>{if(!Array.isArray(br)||br.length&&typeof br[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return br.map(wr=>{if(wr<0||wr>=fr.length)throw new Error(`Digit index outside alphabet: ${wr} (alphabet: ${fr.length})`);return fr[wr]})},decode:br=>{if(!Array.isArray(br)||br.length&&typeof br[0]!="string")throw new Error("alphabet.decode input should be array of strings");return br.map(wr=>{if(typeof wr!="string")throw new Error(`alphabet.decode: not string element=${wr}`);const Er=fr.indexOf(wr);if(Er===-1)throw new Error(`Unknown letter: "${wr}". Allowed: ${fr}`);return Er})}}}function join(fr=""){if(typeof fr!="string")throw new Error("join separator should be string");return{encode:br=>{if(!Array.isArray(br)||br.length&&typeof br[0]!="string")throw new Error("join.encode input should be array of strings");for(let wr of br)if(typeof wr!="string")throw new Error(`join.encode: non-string input=${wr}`);return br.join(fr)},decode:br=>{if(typeof br!="string")throw new Error("join.decode input should be string");return br.split(fr)}}}function convertRadix(fr,br,wr){if(br<2)throw new Error(`convertRadix: wrong from=${br}, base cannot be less than 2`);if(wr<2)throw new Error(`convertRadix: wrong to=${wr}, base cannot be less than 2`);if(!Array.isArray(fr))throw new Error("convertRadix: data should be array");if(!fr.length)return[];let Er=0;const kr=[],jr=Array.from(fr);for(jr.forEach(Br=>{if(Br<0||Br>=br)throw new Error(`Wrong integer: ${Br}`)});;){let Br=0,Wr=!0;for(let qr=Er;qr{if(!isBytes(br))throw new Error("radix.encode input should be Uint8Array");return convertRadix(Array.from(br),2**8,fr)},decode:br=>{if(!Array.isArray(br)||br.length&&typeof br[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(convertRadix(br,fr,2**8))}}}function checksum(fr,br){if(typeof br!="function")throw new Error("checksum fn should be function");return{encode(wr){if(!isBytes(wr))throw new Error("checksum.encode: input should be Uint8Array");const Er=br(wr).slice(0,fr),kr=new Uint8Array(wr.length+fr);return kr.set(wr),kr.set(Er,wr.length),kr},decode(wr){if(!isBytes(wr))throw new Error("checksum.decode: input should be Uint8Array");const Er=wr.slice(0,-fr),kr=br(Er).slice(0,fr),jr=wr.slice(-fr);for(let Br=0;Brchain(radix(58),alphabet$1(fr),join("")),base58$1=genBase58("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),createBase58check=fr=>chain(checksum(4,br=>fr(fr(br))),base58$1);/*! scure-bip32 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */const Point=secp256k1$2.ProjectivePoint,base58check=createBase58check(sha256$7);function bytesToNumber(fr){return BigInt(`0x${bytesToHex$3(fr)}`)}function numberToBytes(fr){return hexToBytes$3(fr.toString(16).padStart(64,"0"))}const MASTER_SECRET=utf8ToBytes$4("Bitcoin seed"),BITCOIN_VERSIONS={private:76066276,public:76067358},HARDENED_OFFSET=2147483648,hash160=fr=>ripemd160$3(sha256$7(fr)),fromU32=fr=>createView$2(fr).getUint32(0,!1),toU32=fr=>{if(!Number.isSafeInteger(fr)||fr<0||fr>2**32-1)throw new Error(`Invalid number=${fr}. Should be from 0 to 2 ** 32 - 1`);const br=new Uint8Array(4);return createView$2(br).setUint32(0,fr,!1),br};class HDKey{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return fromU32(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){const br=this.privateKey;if(!br)throw new Error("No private key");return base58check.encode(this.serialize(this.versions.private,concatBytes$5(new Uint8Array([0]),br)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return base58check.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(br,wr=BITCOIN_VERSIONS){if(bytes(br),8*br.length<128||8*br.length>512)throw new Error(`HDKey: wrong seed length=${br.length}. Should be between 128 and 512 bits; 256 bits is advised)`);const Er=hmac$5(sha512$4,MASTER_SECRET,br);return new HDKey({versions:wr,chainCode:Er.slice(32),privateKey:Er.slice(0,32)})}static fromExtendedKey(br,wr=BITCOIN_VERSIONS){const Er=base58check.decode(br),kr=createView$2(Er),jr=kr.getUint32(0,!1),Br={versions:wr,depth:Er[4],parentFingerprint:kr.getUint32(5,!1),index:kr.getUint32(9,!1),chainCode:Er.slice(13,45)},Wr=Er.slice(45),qr=Wr[0]===0;if(jr!==wr[qr?"private":"public"])throw new Error("Version mismatch");return qr?new HDKey({...Br,privateKey:Wr.slice(1)}):new HDKey({...Br,publicKey:Wr})}static fromJSON(br){return HDKey.fromExtendedKey(br.xpriv)}constructor(br){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!br||typeof br!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=br.versions||BITCOIN_VERSIONS,this.depth=br.depth||0,this.chainCode=br.chainCode||null,this.index=br.index||0,this.parentFingerprint=br.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(br.publicKey&&br.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(br.privateKey){if(!secp256k1$2.utils.isValidPrivateKey(br.privateKey))throw new Error("Invalid private key");this.privKey=typeof br.privateKey=="bigint"?br.privateKey:bytesToNumber(br.privateKey),this.privKeyBytes=numberToBytes(this.privKey),this.pubKey=secp256k1$2.getPublicKey(br.privateKey,!0)}else if(br.publicKey)this.pubKey=Point.fromHex(br.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=hash160(this.pubKey)}derive(br){if(!/^[mM]'?/.test(br))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(br))return this;const wr=br.replace(/^[mM]'?\//,"").split("/");let Er=this;for(const kr of wr){const jr=/^(\d+)('?)$/.exec(kr),Br=jr&&jr[1];if(!jr||jr.length!==3||typeof Br!="string")throw new Error(`Invalid child index: ${kr}`);let Wr=+Br;if(!Number.isSafeInteger(Wr)||Wr>=HARDENED_OFFSET)throw new Error("Invalid index");jr[2]==="'"&&(Wr+=HARDENED_OFFSET),Er=Er.deriveChild(Wr)}return Er}deriveChild(br){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let wr=toU32(br);if(br>=HARDENED_OFFSET){const Wr=this.privateKey;if(!Wr)throw new Error("Could not derive hardened child key");wr=concatBytes$5(new Uint8Array([0]),Wr,wr)}else wr=concatBytes$5(this.pubKey,wr);const Er=hmac$5(sha512$4,this.chainCode,wr),kr=bytesToNumber(Er.slice(0,32)),jr=Er.slice(32);if(!secp256k1$2.utils.isValidPrivateKey(kr))throw new Error("Tweak bigger than curve order");const Br={versions:this.versions,chainCode:jr,depth:this.depth+1,parentFingerprint:this.fingerprint,index:br};try{if(this.privateKey){const Wr=mod$1(this.privKey+kr,secp256k1$2.CURVE.n);if(!secp256k1$2.utils.isValidPrivateKey(Wr))throw new Error("The tweak was out of range or the resulted private key is invalid");Br.privateKey=Wr}else{const Wr=Point.fromHex(this.pubKey).add(Point.fromPrivateKey(kr));if(Wr.equals(Point.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");Br.publicKey=Wr.toRawBytes(!0)}return new HDKey(Br)}catch{return this.deriveChild(br+1)}}sign(br){if(!this.privateKey)throw new Error("No privateKey set!");return bytes(br,32),secp256k1$2.sign(br,this.privKey).toCompactRawBytes()}verify(br,wr){if(bytes(br,32),bytes(wr,64),!this.publicKey)throw new Error("No publicKey set!");let Er;try{Er=secp256k1$2.Signature.fromCompact(wr)}catch{return!1}return secp256k1$2.verify(Er,br,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(br,wr){if(!this.chainCode)throw new Error("No chainCode set");return bytes(wr,33),concatBytes$5(toU32(br),new Uint8Array([this.depth]),toU32(this.parentFingerprint),toU32(this.index),this.chainCode,wr)}}function pbkdf2Init(fr,br,wr,Er){hash$4(fr);const kr=checkOpts$1({dkLen:32,asyncTick:10},Er),{c:jr,dkLen:Br,asyncTick:Wr}=kr;if(number$3(jr),number$3(Br),number$3(Wr),jr<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const qr=toBytes$2(br),Gr=toBytes$2(wr),Vr=new Uint8Array(Br),Zr=hmac$5.create(fr,qr),Jr=Zr._cloneInto().update(Gr);return{c:jr,dkLen:Br,asyncTick:Wr,DK:Vr,PRF:Zr,PRFSalt:Jr}}function pbkdf2Output(fr,br,wr,Er,kr){return fr.destroy(),br.destroy(),Er&&Er.destroy(),kr.fill(0),wr}function pbkdf2(fr,br,wr,Er){const{c:kr,dkLen:jr,DK:Br,PRF:Wr,PRFSalt:qr}=pbkdf2Init(fr,br,wr,Er);let Gr;const Vr=new Uint8Array(4),Zr=createView$2(Vr),Jr=new Uint8Array(Wr.outputLen);for(let Qr=1,_n=0;_nnfkd(`mnemonic${fr}`);function mnemonicToSeedSync(fr,br=""){return pbkdf2(sha512$4,normalize(fr).nfkd,salt(br),{c:2048,dkLen:64})}function toAccount(fr){if(typeof fr=="string"){if(!isAddress(fr,{strict:!1}))throw new InvalidAddressError({address:fr});return{address:fr,type:"json-rpc"}}if(!isAddress(fr.address,{strict:!1}))throw new InvalidAddressError({address:fr.address});return{address:fr.address,nonceManager:fr.nonceManager,sign:fr.sign,experimental_signAuthorization:fr.experimental_signAuthorization,signMessage:fr.signMessage,signTransaction:fr.signTransaction,signTypedData:fr.signTypedData,source:"custom",type:"local"}}let extraEntropy=!1;async function sign$2({hash:fr,privateKey:br,to:wr="object"}){const{r:Er,s:kr,recovery:jr}=secp256k1$2.sign(fr.slice(2),br.slice(2),{lowS:!0,extraEntropy}),Br={r:numberToHex(Er,{size:32}),s:numberToHex(kr,{size:32}),v:jr?28n:27n,yParity:jr};return wr==="bytes"||wr==="hex"?serializeSignature({...Br,to:wr}):Br}async function experimental_signAuthorization(fr){const{contractAddress:br,chainId:wr,nonce:Er,privateKey:kr,to:jr="object"}=fr,Br=await sign$2({hash:hashAuthorization({contractAddress:br,chainId:wr,nonce:Er}),privateKey:kr,to:jr});return jr==="object"?{contractAddress:br,chainId:wr,nonce:Er,...Br}:Br}async function signMessage$1({message:fr,privateKey:br}){return await sign$2({hash:hashMessage(fr),privateKey:br,to:"hex"})}async function signTransaction$1(fr){const{privateKey:br,transaction:wr,serializer:Er=serializeTransaction$4}=fr,kr=wr.type==="eip4844"?{...wr,sidecars:!1}:wr,jr=await sign$2({hash:keccak256(Er(kr)),privateKey:br});return Er(wr,jr)}async function signTypedData$1(fr){const{privateKey:br,...wr}=fr;return await sign$2({hash:hashTypedData(wr),privateKey:br,to:"hex"})}function privateKeyToAccount(fr,br={}){const{nonceManager:wr}=br,Er=toHex(secp256k1$2.getPublicKey(fr.slice(2),!1)),kr=publicKeyToAddress(Er);return{...toAccount({address:kr,nonceManager:wr,async sign({hash:Br}){return sign$2({hash:Br,privateKey:fr,to:"hex"})},async experimental_signAuthorization(Br){return experimental_signAuthorization({...Br,privateKey:fr})},async signMessage({message:Br}){return signMessage$1({message:Br,privateKey:fr})},async signTransaction(Br,{serializer:Wr}={}){return signTransaction$1({privateKey:fr,transaction:Br,serializer:Wr})},async signTypedData(Br){return signTypedData$1({...Br,privateKey:fr})}}),publicKey:Er,source:"privateKey"}}function hdKeyToAccount(fr,{accountIndex:br=0,addressIndex:wr=0,changeIndex:Er=0,path:kr,...jr}={}){const Br=fr.derive(kr||`m/44'/60'/${br}'/${Er}/${wr}`);return{...privateKeyToAccount(toHex(Br.privateKey),jr),getHdKey:()=>Br,source:"hd"}}function mnemonicToAccount(fr,br={}){const wr=mnemonicToSeedSync(fr);return hdKeyToAccount(HDKey.fromMasterSeed(wr),br)}const xp=class xp{constructor(br,wr,Er,kr=void 0,jr){Fu(this,"signerAccount");Fu(this,"appConnections");Fu(this,"attachedAccounts",[]);Fu(this,"walletToEncDerivedKey",{});Fu(this,"connectWalletWithAccount",async br=>{if(!xp.unRegisteredProfile)throw Error("Only Allowed for Unregistered Profile");const wr=await PushEncryption.encrypt(this.derivedHDNode.privateExtendedKey,br),Er=await mnemonicToSeed(this.mnemonic),kr=HDKey$1.fromMasterSeed(Er),jr=`PUSH_DID:${bytesToHex$1(sha256$4(kr.publicKey))}`,Br=await br.signMessage(`Connect Account To ${jr}`);this.walletToEncDerivedKey[br.account]={encDerivedPrivKey:wr,signature:Br},this.attachedAccounts.push(br.account)});Fu(this,"registerPushAccount",async()=>{if(!xp.unRegisteredProfile)throw Error("Only Allowed for Unregistered Profile");const br=await mnemonicToSeed(this.mnemonic),wr=HDKey$1.fromMasterSeed(br),Er={masterPubKey:bytesToHex$1(wr.publicKey),derivedKeyIndex:this.derivedHDNode.index,derivedPubKey:bytesToHex$1(this.derivedHDNode.publicKey),walletToEncDerivedKey:this.walletToEncDerivedKey},kr=await src$5.Tx.initialize(this.env),jr=kr.createUnsigned("INIT_DID",[],src$5.Tx.serializeData(Er,"INIT_DID"));console.log("InitDIDTx:",jr),console.log(`0x${bytesToHex$1(wr.privateKey)}`);const Br=privateKeyToAccount(`0x${bytesToHex$1(wr.privateKey)}`),Wr={account:src$5.Address.toPushCAIP(Br.address,this.env),signMessage:async qr=>{const Gr=await Br.signMessage({message:{raw:qr}});return hexToBytes$4(Gr)}};await kr.send(jr,Wr),xp.unRegisteredProfile=!1});Fu(this,"storeMnemonicShareAsEncryptedTx",async(br,wr,Er)=>{var kr,jr;try{const Wr=(await api$2.post("/auth/passkey/register-credential",{userId:br})).data;typeof Wr.publicKey.challenge=="string"&&(Wr.publicKey.challenge=xp.base64URLToBuffer(Wr.publicKey.challenge)),typeof Wr.publicKey.user.id=="string"&&(Wr.publicKey.user.id=xp.base64URLToBuffer(Wr.publicKey.user.id));const qr=await navigator.credentials.create(Wr);if(!qr)throw new Error("Failed to create PassKey credential");await api$2.post("/auth/passkey/verify-registration",{userId:br,credential:{id:qr.id,rawId:xp.bufferToBase64URL(qr.rawId),response:{attestationObject:xp.bufferToBase64URL(qr.response.attestationObject),clientDataJSON:xp.bufferToBase64URL(qr.response.clientDataJSON),transports:((jr=(kr=qr.response).getTransports)==null?void 0:jr.call(kr))||[]},type:qr.type,clientExtensionResults:qr.getClientExtensionResults()}});const Gr=window.crypto.subtle,Zr=new TextEncoder().encode(wr),Jr=new Uint8Array(16);window.crypto.getRandomValues(Jr);const Qr=await Gr.importKey("raw",qr.rawId,"PBKDF2",!1,["deriveBits","deriveKey"]),_n=await Gr.deriveKey({name:"PBKDF2",salt:Jr.buffer,iterations:1e5,hash:{name:"SHA-256"}},Qr,{name:"AES-GCM",length:256},!1,["encrypt"]),En=window.crypto.getRandomValues(new Uint8Array(12)),Cn=await Gr.encrypt({name:"AES-GCM",iv:En},_n,Zr),In=new Uint8Array([...Jr,...new Uint8Array(Cn)]),An=await src$5.Tx.initialize(this.env),jn=[],eo=An.createUnsigned("CUSTOM:MNEMONIC_SHARE_REGISTRATION",jn,In),ro=await mnemonicToSeed(Er),to=HDKey$1.fromMasterSeed(ro),_i=privateKeyToAccount(`0x${bytesToHex$1(to.privateKey)}`),oo={account:src$5.Address.toPushCAIP(_i.address,this.env),signMessage:async co=>{const so=await _i.signMessage({message:{raw:co}});return hexToBytes$4(so)}},io=await An.send(eo,oo);console.log("::::::::::::::::Tx Response::::::::::",io),await api$2.put(`/auth/passkey/transaction/${br}`,{transactionHash:io,iv:xp.bufferToBase64URL(En)})}catch(Br){throw console.error("Error in sendMenomicShare:",Br),Br}});Fu(this,"sign",async(br,wr)=>{if(!this.appConnections.find(Wr=>Wr.origin===wr))throw Error("App not Connected");const kr=hdKeyToAccount(this.derivedHDNode),jr=createWalletClient({account:kr,chain:mainnet,transport:http()});return await(await PushSigner.initialize(jr)).signMessage(typeof br=="string"?br:bytesToString(br))});Fu(this,"ConnectionStatus",br=>{const wr=this.appConnections.find(Er=>Er.origin===br);return wr?{isConnected:!wr.isPending,isPending:wr.isPending}:{isConnected:!1,isPending:!1}});Fu(this,"requestToConnect",(br,wr)=>{this.appConnections.find(kr=>kr.origin===br)||(this.appConnections.push({origin:br,isPending:!0}),wr(),localStorage.setItem("appConnections",JSON.stringify(this.appConnections)))});Fu(this,"acceptConnectionReq",br=>{const wr=this.appConnections.find(Er=>Er.origin===br);wr&&(wr.isPending=!1,localStorage.setItem("appConnections",JSON.stringify(this.appConnections)))});Fu(this,"rejectConnectionReq",br=>{this.appConnections=this.appConnections.filter(wr=>wr.origin!==br),localStorage.setItem("appConnections",JSON.stringify(this.appConnections))});Fu(this,"rejectAllConnectionReqs",()=>{this.appConnections=this.appConnections.filter(br=>br.isPending===!1),localStorage.setItem("appConnections",JSON.stringify(this.appConnections))});Fu(this,"generateRandomSessionKey",()=>{var Er,kr;let br=this.derivedHDNode;const wr=9;for(let jr=0;jr{const wr=this.generateRandomSessionKey();console.log(br,wr)});Fu(this,"revokeSessionKey",br=>{console.log(br)});this.did=br,this.account=wr,this.derivedHDNode=Er,this.mnemonic=kr,this.env=jr,this.signerAccount=src$5.Address.toPushCAIP(src$5.Address.evmToPush(hdKeyToAccount(Er).address,"pushconsumer"),jr),this.appConnections=localStorage.getItem("appConnections")?JSON.parse(localStorage.getItem("appConnections")):[]}static async retrieveMnemonicShareFromTx(br,wr){var Er,kr,jr;try{const Br=await api$2.get(`/auth/passkey/transaction/${wr}`);if(!((Er=Br==null?void 0:Br.data)!=null&&Er.transactionHash))throw new Error("No transaction hash found");const Gr=(jr=(kr=(await(await src$5.Tx.initialize(br)).search(Br.data.transactionHash)).blocks[0])==null?void 0:kr.blockDataAsJson.txobjList[0])==null?void 0:jr.tx.data;if(!Gr)throw new Error("Transaction data not found");const Vr=new Uint8Array(atob(Gr).split("").map(io=>io.charCodeAt(0))),Zr=await api$2.get(`/auth/passkey/challenge/${wr}`),Jr={challenge:this.base64URLToBuffer(Zr.data.challenge),rpId:window.location.hostname,timeout:6e4,userVerification:"required",allowCredentials:[]},Qr=await navigator.credentials.get({publicKey:Jr});if(!Qr)throw new Error("Failed to get PassKey credential");const _n=Vr.slice(0,16),En=this.base64URLToBuffer(Br.data.iv),Cn=Vr.slice(16,-16),In=Vr.slice(-16),An=new Uint8Array([...Cn,...In]),jn=window.crypto.subtle,eo=await jn.importKey("raw",Qr.rawId,"PBKDF2",!1,["deriveBits","deriveKey"]),ro=await jn.deriveKey({name:"PBKDF2",salt:_n,iterations:1e5,hash:{name:"SHA-256"}},eo,{name:"AES-GCM",length:256},!1,["decrypt"]),to=await jn.decrypt({name:"AES-GCM",iv:En},ro,An.buffer),oo=new TextDecoder().decode(to);return await api$2.post(`/auth/passkey/verify/${wr}`,{id:Qr.id,rawId:this.bufferToBase64URL(Qr.rawId),authenticatorData:this.bufferToBase64URL(Qr.response.authenticatorData),clientDataJSON:this.bufferToBase64URL(Qr.response.clientDataJSON),signature:this.bufferToBase64URL(Qr.response.signature),transactionHash:Br.data.transactionHash}),oo}catch(Br){throw console.error("Error retrieving mnemonic share from transaction:",Br),Br}}static bufferToBase64URL(br){return btoa(String.fromCharCode(...new Uint8Array(br))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}static base64URLToBuffer(br){const wr=br.replace(/-/g,"+").replace(/_/g,"/"),Er=wr.padEnd(wr.length+(4-wr.length%4)%4,"="),kr=atob(Er),jr=new ArrayBuffer(kr.length),Br=new Uint8Array(jr);for(let Wr=0;Wr{xp.unRegisteredProfile=!0;const wr=await xp.generatePushWallet(),Er=src$5.Address.toPushCAIP(mnemonicToAccount(wr.mnemonic).address,br);localStorage.removeItem("appConnections");const kr=new xp(wr.did,Er,wr.derivedNode,wr.mnemonic,br),jr=createWalletClient({account:mnemonicToAccount(wr.mnemonic),chain:mainnet,transport:http()}),Br=await PushSigner.initialize(jr);return Br.account=Er,await kr.connectWalletWithAccount(Br),kr}),Fu(xp,"logInWithMnemonic",async(br,wr=ENV.STAGING)=>{const Er=src$5.Address.toPushCAIP(mnemonicToAccount(br).address,wr),kr=createWalletClient({account:mnemonicToAccount(br),chain:mainnet,transport:http()}),jr=await PushSigner.initialize(kr);return jr.account=Er,await xp.loginWithWallet(jr,wr)}),Fu(xp,"loginWithWallet",async(br,wr=ENV.STAGING)=>{xp.pushValidator=await src$5.Validator.initalize({env:wr});const Er=await xp.getPushWallet(br.account);if(console.log(Er),Er==null)return null;{const kr=await xp.decryptDerivedNode(Er.encDerivedPrivKey,br),jr=new xp(Er.did,br.account,kr,void 0,wr);return jr.attachedAccounts=Er.attachedaccounts,jr}}),Fu(xp,"loginWithSocial",async()=>{}),Fu(xp,"getPushWallet",async br=>{var Er,kr;const wr=await xp.pushValidator.call("push_accountInfo",[br]);return wr.items.length>0?{did:wr.items[0].did,derivedKeyIndex:parseInt(wr.items[0].derivedkeyindex),encDerivedPrivKey:{...JSON.parse(wr.items[0].encryptedderivedprivatekey),preKey:JSON.parse(wr.items[0].encryptedderivedprivatekey).prekey},attachedaccounts:(kr=(Er=wr==null?void 0:wr.items[0])==null?void 0:Er.attachedaccounts)==null?void 0:kr.map(jr=>jr.address)}:null}),Fu(xp,"generateDerivedNode",async(br,wr=0,Er=0)=>{const jr=`m/44'/60'/0'/0/${Er}/0'/${wr}'`;return br.derive(jr)}),Fu(xp,"generatePushWallet",async()=>{const br=generateMnemonic(wordlist),wr=await mnemonicToSeed(br),Er=HDKey$1.fromMasterSeed(wr),kr=`PUSH_DID:${bytesToHex$1(sha256$4(Er.publicKey))}`,jr=await xp.generateDerivedNode(Er);return{mnemonic:br,masterNode:Er,did:kr,derivedNode:jr}}),Fu(xp,"decryptDerivedNode",async(br,wr)=>{const Er=await PushEncryption.decrypt(br,wr);return HDKey$1.fromExtendedKey(Er)});let PushWallet=xp;var secrets$1={exports:{}},cryptoBrowserify={},browser$g={exports:{}},safeBuffer$1={exports:{}};const require$$0$9=getAugmentedNamespace(dist$2);/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(fr,br){var wr=require$$0$9,Er=wr.Buffer;function kr(Br,Wr){for(var qr in Br)Wr[qr]=Br[qr]}Er.from&&Er.alloc&&Er.allocUnsafe&&Er.allocUnsafeSlow?fr.exports=wr:(kr(wr,br),br.Buffer=jr);function jr(Br,Wr,qr){return Er(Br,Wr,qr)}jr.prototype=Object.create(Er.prototype),kr(Er,jr),jr.from=function(Br,Wr,qr){if(typeof Br=="number")throw new TypeError("Argument must not be a number");return Er(Br,Wr,qr)},jr.alloc=function(Br,Wr,qr){if(typeof Br!="number")throw new TypeError("Argument must be a number");var Gr=Er(Br);return Wr!==void 0?typeof qr=="string"?Gr.fill(Wr,qr):Gr.fill(Wr):Gr.fill(0),Gr},jr.allocUnsafe=function(Br){if(typeof Br!="number")throw new TypeError("Argument must be a number");return Er(Br)},jr.allocUnsafeSlow=function(Br){if(typeof Br!="number")throw new TypeError("Argument must be a number");return wr.SlowBuffer(Br)}})(safeBuffer$1,safeBuffer$1.exports);var safeBufferExports=safeBuffer$1.exports,hasRequiredBrowser$b;function requireBrowser$b(){if(hasRequiredBrowser$b)return browser$g.exports;hasRequiredBrowser$b=1;var fr=65536,br=4294967295;function wr(){throw new Error(`Secure random number generation is not supported by this browser. Use Chrome, Firefox or Internet Explorer 11`)}var Er=safeBufferExports.Buffer,kr=commonjsGlobal.crypto||commonjsGlobal.msCrypto;kr&&kr.getRandomValues?browser$g.exports=jr:browser$g.exports=wr;function jr(Br,Wr){if(Br>br)throw new RangeError("requested too many random bytes");var qr=Er.allocUnsafe(Br);if(Br>0)if(Br>fr)for(var Gr=0;Gr0&&(Br=wr[0]),Br instanceof Error)throw Br;var Wr=new Error("Unhandled error."+(Br?" ("+Br.message+")":""));throw Wr.context=Br,Wr}var qr=jr[br];if(qr===void 0)return!1;if(typeof qr=="function")ReflectApply(qr,this,wr);else for(var Gr=qr.length,Vr=arrayClone(qr,Gr),Er=0;Er0&&Br.length>kr&&!Br.warned){Br.warned=!0;var Wr=new Error("Possible EventEmitter memory leak detected. "+Br.length+" "+String(br)+" listeners added. Use emitter.setMaxListeners() to increase limit");Wr.name="MaxListenersExceededWarning",Wr.emitter=fr,Wr.type=br,Wr.count=Br.length,ProcessEmitWarning(Wr)}return fr}EventEmitter.prototype.addListener=function(br,wr){return _addListener(this,br,wr,!1)};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function(br,wr){return _addListener(this,br,wr,!0)};function onceWrapper(){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 _onceWrap(fr,br,wr){var Er={fired:!1,wrapFn:void 0,target:fr,type:br,listener:wr},kr=onceWrapper.bind(Er);return kr.listener=wr,Er.wrapFn=kr,kr}EventEmitter.prototype.once=function(br,wr){return checkListener(wr),this.on(br,_onceWrap(this,br,wr)),this};EventEmitter.prototype.prependOnceListener=function(br,wr){return checkListener(wr),this.prependListener(br,_onceWrap(this,br,wr)),this};EventEmitter.prototype.removeListener=function(br,wr){var Er,kr,jr,Br,Wr;if(checkListener(wr),kr=this._events,kr===void 0)return this;if(Er=kr[br],Er===void 0)return this;if(Er===wr||Er.listener===wr)--this._eventsCount===0?this._events=Object.create(null):(delete kr[br],kr.removeListener&&this.emit("removeListener",br,Er.listener||wr));else if(typeof Er!="function"){for(jr=-1,Br=Er.length-1;Br>=0;Br--)if(Er[Br]===wr||Er[Br].listener===wr){Wr=Er[Br].listener,jr=Br;break}if(jr<0)return this;jr===0?Er.shift():spliceOne(Er,jr),Er.length===1&&(kr[br]=Er[0]),kr.removeListener!==void 0&&this.emit("removeListener",br,Wr||wr)}return this};EventEmitter.prototype.off=EventEmitter.prototype.removeListener;EventEmitter.prototype.removeAllListeners=function(br){var wr,Er,kr;if(Er=this._events,Er===void 0)return this;if(Er.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):Er[br]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete Er[br]),this;if(arguments.length===0){var jr=Object.keys(Er),Br;for(kr=0;kr=0;kr--)this.removeListener(br,wr[kr]);return this};function _listeners(fr,br,wr){var Er=fr._events;if(Er===void 0)return[];var kr=Er[br];return kr===void 0?[]:typeof kr=="function"?wr?[kr.listener||kr]:[kr]:wr?unwrapListeners(kr):arrayClone(kr,kr.length)}EventEmitter.prototype.listeners=function(br){return _listeners(this,br,!0)};EventEmitter.prototype.rawListeners=function(br){return _listeners(this,br,!1)};EventEmitter.listenerCount=function(fr,br){return typeof fr.listenerCount=="function"?fr.listenerCount(br):listenerCount.call(fr,br)};EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(fr){var br=this._events;if(br!==void 0){var wr=br[fr];if(typeof wr=="function")return 1;if(wr!==void 0)return wr.length}return 0}EventEmitter.prototype.eventNames=function(){return this._eventsCount>0?ReflectOwnKeys(this._events):[]};function arrayClone(fr,br){for(var wr=new Array(br),Er=0;Er"u"||!En?fr:En(Uint8Array),An={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?fr:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?fr:ArrayBuffer,"%ArrayIteratorPrototype%":Qr&&En?En([][Symbol.iterator]()):fr,"%AsyncFromSyncIteratorPrototype%":fr,"%AsyncFunction%":Cn,"%AsyncGenerator%":Cn,"%AsyncGeneratorFunction%":Cn,"%AsyncIteratorPrototype%":Cn,"%Atomics%":typeof Atomics>"u"?fr:Atomics,"%BigInt%":typeof BigInt>"u"?fr:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?fr:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?fr:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?fr:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":br,"%eval%":eval,"%EvalError%":wr,"%Float32Array%":typeof Float32Array>"u"?fr:Float32Array,"%Float64Array%":typeof Float64Array>"u"?fr:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?fr:FinalizationRegistry,"%Function%":qr,"%GeneratorFunction%":Cn,"%Int8Array%":typeof Int8Array>"u"?fr:Int8Array,"%Int16Array%":typeof Int16Array>"u"?fr:Int16Array,"%Int32Array%":typeof Int32Array>"u"?fr:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Qr&&En?En(En([][Symbol.iterator]())):fr,"%JSON%":typeof JSON=="object"?JSON:fr,"%Map%":typeof Map>"u"?fr:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Qr||!En?fr:En(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?fr:Promise,"%Proxy%":typeof Proxy>"u"?fr:Proxy,"%RangeError%":Er,"%ReferenceError%":kr,"%Reflect%":typeof Reflect>"u"?fr:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?fr:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Qr||!En?fr:En(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?fr:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Qr&&En?En(""[Symbol.iterator]()):fr,"%Symbol%":Qr?Symbol:fr,"%SyntaxError%":jr,"%ThrowTypeError%":Jr,"%TypedArray%":In,"%TypeError%":Br,"%Uint8Array%":typeof Uint8Array>"u"?fr:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?fr:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?fr:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?fr:Uint32Array,"%URIError%":Wr,"%WeakMap%":typeof WeakMap>"u"?fr:WeakMap,"%WeakRef%":typeof WeakRef>"u"?fr:WeakRef,"%WeakSet%":typeof WeakSet>"u"?fr:WeakSet};if(En)try{null.error}catch(Rn){var jn=En(En(Rn));An["%Error.prototype%"]=jn}var eo=function Rn(Pn){var On;if(Pn==="%AsyncFunction%")On=Gr("async function () {}");else if(Pn==="%GeneratorFunction%")On=Gr("function* () {}");else if(Pn==="%AsyncGeneratorFunction%")On=Gr("async function* () {}");else if(Pn==="%AsyncGenerator%"){var Zn=Rn("%AsyncGeneratorFunction%");Zn&&(On=Zn.prototype)}else if(Pn==="%AsyncIteratorPrototype%"){var Nn=Rn("%AsyncGenerator%");Nn&&En&&(On=En(Nn.prototype))}return An[Pn]=On,On},ro={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},to=requireFunctionBind(),_i=requireHasown(),oo=to.call(Function.call,Array.prototype.concat),io=to.call(Function.apply,Array.prototype.splice),co=to.call(Function.call,String.prototype.replace),so=to.call(Function.call,String.prototype.slice),no=to.call(Function.call,RegExp.prototype.exec),Tn=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Hr=/\\(\\)?/g,Xr=function(Pn){var On=so(Pn,0,1),Zn=so(Pn,-1);if(On==="%"&&Zn!=="%")throw new jr("invalid intrinsic syntax, expected closing `%`");if(Zn==="%"&&On!=="%")throw new jr("invalid intrinsic syntax, expected opening `%`");var Nn=[];return co(Pn,Tn,function(wn,zn,fo,vo){Nn[Nn.length]=fo?co(vo,Hr,"$1"):zn||wn}),Nn},Sn=function(Pn,On){var Zn=Pn,Nn;if(_i(ro,Zn)&&(Nn=ro[Zn],Zn="%"+Nn[0]+"%"),_i(An,Zn)){var wn=An[Zn];if(wn===Cn&&(wn=eo(Zn)),typeof wn>"u"&&!On)throw new Br("intrinsic "+Pn+" exists, but is not available. Please file an issue!");return{alias:Nn,name:Zn,value:wn}}throw new jr("intrinsic "+Pn+" does not exist!")};return getIntrinsic=function(Pn,On){if(typeof Pn!="string"||Pn.length===0)throw new Br("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof On!="boolean")throw new Br('"allowMissing" argument must be a boolean');if(no(/^%?[^%]*%?$/,Pn)===null)throw new jr("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var Zn=Xr(Pn),Nn=Zn.length>0?Zn[0]:"",wn=Sn("%"+Nn+"%",On),zn=wn.name,fo=wn.value,vo=!1,go=wn.alias;go&&(Nn=go[0],io(Zn,oo([0,1],go)));for(var uo=1,lo=!0;uo=Zn.length){var _o=Vr(fo,Eo);lo=!!_o,lo&&"get"in _o&&!("originalValue"in _o.get)?fo=_o.get:fo=fo[Eo]}else lo=_i(fo,Eo),fo=fo[Eo];lo&&!vo&&(An[zn]=fo)}}return fo},getIntrinsic}var callBind={exports:{}},esDefineProperty,hasRequiredEsDefineProperty;function requireEsDefineProperty(){if(hasRequiredEsDefineProperty)return esDefineProperty;hasRequiredEsDefineProperty=1;var fr=requireGetIntrinsic(),br=fr("%Object.defineProperty%",!0)||!1;if(br)try{br({},"a",{value:1})}catch{br=!1}return esDefineProperty=br,esDefineProperty}var gopd,hasRequiredGopd;function requireGopd(){if(hasRequiredGopd)return gopd;hasRequiredGopd=1;var fr=requireGetIntrinsic(),br=fr("%Object.getOwnPropertyDescriptor%",!0);if(br)try{br([],"length")}catch{br=null}return gopd=br,gopd}var defineDataProperty,hasRequiredDefineDataProperty;function requireDefineDataProperty(){if(hasRequiredDefineDataProperty)return defineDataProperty;hasRequiredDefineDataProperty=1;var fr=requireEsDefineProperty(),br=requireSyntax(),wr=requireType(),Er=requireGopd();return defineDataProperty=function(jr,Br,Wr){if(!jr||typeof jr!="object"&&typeof jr!="function")throw new wr("`obj` must be an object or a function`");if(typeof Br!="string"&&typeof Br!="symbol")throw new wr("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new wr("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new wr("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new wr("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new wr("`loose`, if provided, must be a boolean");var qr=arguments.length>3?arguments[3]:null,Gr=arguments.length>4?arguments[4]:null,Vr=arguments.length>5?arguments[5]:null,Zr=arguments.length>6?arguments[6]:!1,Jr=!!Er&&Er(jr,Br);if(fr)fr(jr,Br,{configurable:Vr===null&&Jr?Jr.configurable:!Vr,enumerable:qr===null&&Jr?Jr.enumerable:!qr,value:Wr,writable:Gr===null&&Jr?Jr.writable:!Gr});else if(Zr||!qr&&!Gr&&!Vr)jr[Br]=Wr;else throw new br("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},defineDataProperty}var hasPropertyDescriptors_1,hasRequiredHasPropertyDescriptors;function requireHasPropertyDescriptors(){if(hasRequiredHasPropertyDescriptors)return hasPropertyDescriptors_1;hasRequiredHasPropertyDescriptors=1;var fr=requireEsDefineProperty(),br=function(){return!!fr};return br.hasArrayLengthDefineBug=function(){if(!fr)return null;try{return fr([],"length",{value:1}).length!==1}catch{return!0}},hasPropertyDescriptors_1=br,hasPropertyDescriptors_1}var setFunctionLength,hasRequiredSetFunctionLength;function requireSetFunctionLength(){if(hasRequiredSetFunctionLength)return setFunctionLength;hasRequiredSetFunctionLength=1;var fr=requireGetIntrinsic(),br=requireDefineDataProperty(),wr=requireHasPropertyDescriptors()(),Er=requireGopd(),kr=requireType(),jr=fr("%Math.floor%");return setFunctionLength=function(Wr,qr){if(typeof Wr!="function")throw new kr("`fn` is not a function");if(typeof qr!="number"||qr<0||qr>4294967295||jr(qr)!==qr)throw new kr("`length` must be a positive 32-bit integer");var Gr=arguments.length>2&&!!arguments[2],Vr=!0,Zr=!0;if("length"in Wr&&Er){var Jr=Er(Wr,"length");Jr&&!Jr.configurable&&(Vr=!1),Jr&&!Jr.writable&&(Zr=!1)}return(Vr||Zr||!Gr)&&(wr?br(Wr,"length",qr,!0,!0):br(Wr,"length",qr)),Wr},setFunctionLength}var hasRequiredCallBind;function requireCallBind(){return hasRequiredCallBind||(hasRequiredCallBind=1,function(fr){var br=requireFunctionBind(),wr=requireGetIntrinsic(),Er=requireSetFunctionLength(),kr=requireType(),jr=wr("%Function.prototype.apply%"),Br=wr("%Function.prototype.call%"),Wr=wr("%Reflect.apply%",!0)||br.call(Br,jr),qr=requireEsDefineProperty(),Gr=wr("%Math.max%");fr.exports=function(Jr){if(typeof Jr!="function")throw new kr("a function is required");var Qr=Wr(br,Br,arguments);return Er(Qr,1+Gr(0,Jr.length-(arguments.length-1)),!0)};var Vr=function(){return Wr(br,jr,arguments)};qr?qr(fr.exports,"apply",{value:Vr}):fr.exports.apply=Vr}(callBind)),callBind.exports}var callBound,hasRequiredCallBound;function requireCallBound(){if(hasRequiredCallBound)return callBound;hasRequiredCallBound=1;var fr=requireGetIntrinsic(),br=requireCallBind(),wr=br(fr("String.prototype.indexOf"));return callBound=function(kr,jr){var Br=fr(kr,!!jr);return typeof Br=="function"&&wr(kr,".prototype.")>-1?br(Br):Br},callBound}var isArguments,hasRequiredIsArguments;function requireIsArguments(){if(hasRequiredIsArguments)return isArguments;hasRequiredIsArguments=1;var fr=requireShams()(),br=requireCallBound(),wr=br("Object.prototype.toString"),Er=function(Wr){return fr&&Wr&&typeof Wr=="object"&&Symbol.toStringTag in Wr?!1:wr(Wr)==="[object Arguments]"},kr=function(Wr){return Er(Wr)?!0:Wr!==null&&typeof Wr=="object"&&typeof Wr.length=="number"&&Wr.length>=0&&wr(Wr)!=="[object Array]"&&wr(Wr.callee)==="[object Function]"},jr=function(){return Er(arguments)}();return Er.isLegacyArguments=kr,isArguments=jr?Er:kr,isArguments}var isGeneratorFunction,hasRequiredIsGeneratorFunction;function requireIsGeneratorFunction(){if(hasRequiredIsGeneratorFunction)return isGeneratorFunction;hasRequiredIsGeneratorFunction=1;var fr=Object.prototype.toString,br=Function.prototype.toString,wr=/^\s*(?:function)?\*/,Er=requireShams()(),kr=Object.getPrototypeOf,jr=function(){if(!Er)return!1;try{return Function("return function*() {}")()}catch{}},Br;return isGeneratorFunction=function(qr){if(typeof qr!="function")return!1;if(wr.test(br.call(qr)))return!0;if(!Er){var Gr=fr.call(qr);return Gr==="[object GeneratorFunction]"}if(!kr)return!1;if(typeof Br>"u"){var Vr=jr();Br=Vr?kr(Vr):!1}return kr(qr)===Br},isGeneratorFunction}var isCallable,hasRequiredIsCallable;function requireIsCallable(){if(hasRequiredIsCallable)return isCallable;hasRequiredIsCallable=1;var fr=Function.prototype.toString,br=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,wr,Er;if(typeof br=="function"&&typeof Object.defineProperty=="function")try{wr=Object.defineProperty({},"length",{get:function(){throw Er}}),Er={},br(function(){throw 42},null,wr)}catch(An){An!==Er&&(br=null)}else br=null;var kr=/^\s*class\b/,jr=function(jn){try{var eo=fr.call(jn);return kr.test(eo)}catch{return!1}},Br=function(jn){try{return jr(jn)?!1:(fr.call(jn),!0)}catch{return!1}},Wr=Object.prototype.toString,qr="[object Object]",Gr="[object Function]",Vr="[object GeneratorFunction]",Zr="[object HTMLAllCollection]",Jr="[object HTML document.all class]",Qr="[object HTMLCollection]",_n=typeof Symbol=="function"&&!!Symbol.toStringTag,En=!(0 in[,]),Cn=function(){return!1};if(typeof document=="object"){var In=document.all;Wr.call(In)===Wr.call(document.all)&&(Cn=function(jn){if((En||!jn)&&(typeof jn>"u"||typeof jn=="object"))try{var eo=Wr.call(jn);return(eo===Zr||eo===Jr||eo===Qr||eo===qr)&&jn("")==null}catch{}return!1})}return isCallable=br?function(jn){if(Cn(jn))return!0;if(!jn||typeof jn!="function"&&typeof jn!="object")return!1;try{br(jn,null,wr)}catch(eo){if(eo!==Er)return!1}return!jr(jn)&&Br(jn)}:function(jn){if(Cn(jn))return!0;if(!jn||typeof jn!="function"&&typeof jn!="object")return!1;if(_n)return Br(jn);if(jr(jn))return!1;var eo=Wr.call(jn);return eo!==Gr&&eo!==Vr&&!/^\[object HTML/.test(eo)?!1:Br(jn)},isCallable}var forEach_1,hasRequiredForEach;function requireForEach(){if(hasRequiredForEach)return forEach_1;hasRequiredForEach=1;var fr=requireIsCallable(),br=Object.prototype.toString,wr=Object.prototype.hasOwnProperty,Er=function(qr,Gr,Vr){for(var Zr=0,Jr=qr.length;Zr=3&&(Zr=Vr),br.call(qr)==="[object Array]"?Er(qr,Gr,Zr):typeof qr=="string"?kr(qr,Gr,Zr):jr(qr,Gr,Zr)};return forEach_1=Br,forEach_1}var possibleTypedArrayNames,hasRequiredPossibleTypedArrayNames;function requirePossibleTypedArrayNames(){return hasRequiredPossibleTypedArrayNames||(hasRequiredPossibleTypedArrayNames=1,possibleTypedArrayNames=["Float32Array","Float64Array","Int8Array","Int16Array","Int32Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array"]),possibleTypedArrayNames}var availableTypedArrays,hasRequiredAvailableTypedArrays;function requireAvailableTypedArrays(){if(hasRequiredAvailableTypedArrays)return availableTypedArrays;hasRequiredAvailableTypedArrays=1;var fr=requirePossibleTypedArrayNames(),br=typeof globalThis>"u"?commonjsGlobal:globalThis;return availableTypedArrays=function(){for(var Er=[],kr=0;kr"u"?commonjsGlobal:globalThis,qr=br(),Gr=Er("String.prototype.slice"),Vr=Object.getPrototypeOf,Zr=Er("Array.prototype.indexOf",!0)||function(Cn,In){for(var An=0;An-1?In:In!=="Object"?!1:_n(Cn)}return kr?Qr(Cn):null},whichTypedArray}var isTypedArray,hasRequiredIsTypedArray;function requireIsTypedArray(){if(hasRequiredIsTypedArray)return isTypedArray;hasRequiredIsTypedArray=1;var fr=requireWhichTypedArray();return isTypedArray=function(wr){return!!fr(wr)},isTypedArray}var hasRequiredTypes$2;function requireTypes$2(){return hasRequiredTypes$2||(hasRequiredTypes$2=1,function(fr){var br=requireIsArguments(),wr=requireIsGeneratorFunction(),Er=requireWhichTypedArray(),kr=requireIsTypedArray();function jr(wl){return wl.call.bind(wl)}var Br=typeof BigInt<"u",Wr=typeof Symbol<"u",qr=jr(Object.prototype.toString),Gr=jr(Number.prototype.valueOf),Vr=jr(String.prototype.valueOf),Zr=jr(Boolean.prototype.valueOf);if(Br)var Jr=jr(BigInt.prototype.valueOf);if(Wr)var Qr=jr(Symbol.prototype.valueOf);function _n(wl,No){if(typeof wl!="object")return!1;try{return No(wl),!0}catch{return!1}}fr.isArgumentsObject=br,fr.isGeneratorFunction=wr,fr.isTypedArray=kr;function En(wl){return typeof Promise<"u"&&wl instanceof Promise||wl!==null&&typeof wl=="object"&&typeof wl.then=="function"&&typeof wl.catch=="function"}fr.isPromise=En;function Cn(wl){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(wl):kr(wl)||zn(wl)}fr.isArrayBufferView=Cn;function In(wl){return Er(wl)==="Uint8Array"}fr.isUint8Array=In;function An(wl){return Er(wl)==="Uint8ClampedArray"}fr.isUint8ClampedArray=An;function jn(wl){return Er(wl)==="Uint16Array"}fr.isUint16Array=jn;function eo(wl){return Er(wl)==="Uint32Array"}fr.isUint32Array=eo;function ro(wl){return Er(wl)==="Int8Array"}fr.isInt8Array=ro;function to(wl){return Er(wl)==="Int16Array"}fr.isInt16Array=to;function _i(wl){return Er(wl)==="Int32Array"}fr.isInt32Array=_i;function oo(wl){return Er(wl)==="Float32Array"}fr.isFloat32Array=oo;function io(wl){return Er(wl)==="Float64Array"}fr.isFloat64Array=io;function co(wl){return Er(wl)==="BigInt64Array"}fr.isBigInt64Array=co;function so(wl){return Er(wl)==="BigUint64Array"}fr.isBigUint64Array=so;function no(wl){return qr(wl)==="[object Map]"}no.working=typeof Map<"u"&&no(new Map);function Tn(wl){return typeof Map>"u"?!1:no.working?no(wl):wl instanceof Map}fr.isMap=Tn;function Hr(wl){return qr(wl)==="[object Set]"}Hr.working=typeof Set<"u"&&Hr(new Set);function Xr(wl){return typeof Set>"u"?!1:Hr.working?Hr(wl):wl instanceof Set}fr.isSet=Xr;function Sn(wl){return qr(wl)==="[object WeakMap]"}Sn.working=typeof WeakMap<"u"&&Sn(new WeakMap);function Rn(wl){return typeof WeakMap>"u"?!1:Sn.working?Sn(wl):wl instanceof WeakMap}fr.isWeakMap=Rn;function Pn(wl){return qr(wl)==="[object WeakSet]"}Pn.working=typeof WeakSet<"u"&&Pn(new WeakSet);function On(wl){return Pn(wl)}fr.isWeakSet=On;function Zn(wl){return qr(wl)==="[object ArrayBuffer]"}Zn.working=typeof ArrayBuffer<"u"&&Zn(new ArrayBuffer);function Nn(wl){return typeof ArrayBuffer>"u"?!1:Zn.working?Zn(wl):wl instanceof ArrayBuffer}fr.isArrayBuffer=Nn;function wn(wl){return qr(wl)==="[object DataView]"}wn.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&wn(new DataView(new ArrayBuffer(1),0,1));function zn(wl){return typeof DataView>"u"?!1:wn.working?wn(wl):wl instanceof DataView}fr.isDataView=zn;var fo=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function vo(wl){return qr(wl)==="[object SharedArrayBuffer]"}function go(wl){return typeof fo>"u"?!1:(typeof vo.working>"u"&&(vo.working=vo(new fo)),vo.working?vo(wl):wl instanceof fo)}fr.isSharedArrayBuffer=go;function uo(wl){return qr(wl)==="[object AsyncFunction]"}fr.isAsyncFunction=uo;function lo(wl){return qr(wl)==="[object Map Iterator]"}fr.isMapIterator=lo;function Eo(wl){return qr(wl)==="[object Set Iterator]"}fr.isSetIterator=Eo;function mo(wl){return qr(wl)==="[object Generator]"}fr.isGeneratorObject=mo;function yo(wl){return qr(wl)==="[object WebAssembly.Module]"}fr.isWebAssemblyCompiledModule=yo;function _o(wl){return _n(wl,Gr)}fr.isNumberObject=_o;function Bo(wl){return _n(wl,Vr)}fr.isStringObject=Bo;function Lo(wl){return _n(wl,Zr)}fr.isBooleanObject=Lo;function Wo(wl){return Br&&_n(wl,Jr)}fr.isBigIntObject=Wo;function na(wl){return Wr&&_n(wl,Qr)}fr.isSymbolObject=na;function qo(wl){return _o(wl)||Bo(wl)||Lo(wl)||Wo(wl)||na(wl)}fr.isBoxedPrimitive=qo;function ga(wl){return typeof Uint8Array<"u"&&(Nn(wl)||go(wl))}fr.isAnyArrayBuffer=ga,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(wl){Object.defineProperty(fr,wl,{enumerable:!1,value:function(){throw new Error(wl+" is not supported in userland")}})})}(types$2)),types$2}var isBufferBrowser,hasRequiredIsBufferBrowser;function requireIsBufferBrowser(){return hasRequiredIsBufferBrowser||(hasRequiredIsBufferBrowser=1,isBufferBrowser=function(br){return br&&typeof br=="object"&&typeof br.copy=="function"&&typeof br.fill=="function"&&typeof br.readUInt8=="function"}),isBufferBrowser}var hasRequiredUtil$1;function requireUtil$1(){return hasRequiredUtil$1||(hasRequiredUtil$1=1,function(fr){var br={},wr=Object.getOwnPropertyDescriptors||function(fo){for(var vo=Object.keys(fo),go={},uo=0;uo=uo)return mo;switch(mo){case"%s":return String(go[vo++]);case"%d":return Number(go[vo++]);case"%j":try{return JSON.stringify(go[vo++])}catch{return"[Circular]"}default:return mo}}),Eo=go[vo];vo"u")return function(){return fr.deprecate(zn,fo).apply(this,arguments)};var vo=!1;function go(){if(!vo){if(process$1$1.throwDeprecation)throw new Error(fo);process$1$1.traceDeprecation?console.trace(fo):console.error(fo),vo=!0}return zn.apply(this,arguments)}return go};var kr={},jr=/^$/;if(br.NODE_DEBUG){var Br=br.NODE_DEBUG;Br=Br.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),jr=new RegExp("^"+Br+"$","i")}fr.debuglog=function(zn){if(zn=zn.toUpperCase(),!kr[zn])if(jr.test(zn)){var fo=process$1$1.pid;kr[zn]=function(){var vo=fr.format.apply(fr,arguments);console.error("%s %d: %s",zn,fo,vo)}}else kr[zn]=function(){};return kr[zn]};function Wr(zn,fo){var vo={seen:[],stylize:Gr};return arguments.length>=3&&(vo.depth=arguments[2]),arguments.length>=4&&(vo.colors=arguments[3]),An(fo)?vo.showHidden=fo:fo&&fr._extend(vo,fo),oo(vo.showHidden)&&(vo.showHidden=!1),oo(vo.depth)&&(vo.depth=2),oo(vo.colors)&&(vo.colors=!1),oo(vo.customInspect)&&(vo.customInspect=!0),vo.colors&&(vo.stylize=qr),Zr(vo,zn,vo.depth)}fr.inspect=Wr,Wr.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},Wr.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function qr(zn,fo){var vo=Wr.styles[fo];return vo?"\x1B["+Wr.colors[vo][0]+"m"+zn+"\x1B["+Wr.colors[vo][1]+"m":zn}function Gr(zn,fo){return zn}function Vr(zn){var fo={};return zn.forEach(function(vo,go){fo[vo]=!0}),fo}function Zr(zn,fo,vo){if(zn.customInspect&&fo&&Tn(fo.inspect)&&fo.inspect!==fr.inspect&&!(fo.constructor&&fo.constructor.prototype===fo)){var go=fo.inspect(vo,zn);return to(go)||(go=Zr(zn,go,vo)),go}var uo=Jr(zn,fo);if(uo)return uo;var lo=Object.keys(fo),Eo=Vr(lo);if(zn.showHidden&&(lo=Object.getOwnPropertyNames(fo)),no(fo)&&(lo.indexOf("message")>=0||lo.indexOf("description")>=0))return Qr(fo);if(lo.length===0){if(Tn(fo)){var mo=fo.name?": "+fo.name:"";return zn.stylize("[Function"+mo+"]","special")}if(io(fo))return zn.stylize(RegExp.prototype.toString.call(fo),"regexp");if(so(fo))return zn.stylize(Date.prototype.toString.call(fo),"date");if(no(fo))return Qr(fo)}var yo="",_o=!1,Bo=["{","}"];if(In(fo)&&(_o=!0,Bo=["[","]"]),Tn(fo)){var Lo=fo.name?": "+fo.name:"";yo=" [Function"+Lo+"]"}if(io(fo)&&(yo=" "+RegExp.prototype.toString.call(fo)),so(fo)&&(yo=" "+Date.prototype.toUTCString.call(fo)),no(fo)&&(yo=" "+Qr(fo)),lo.length===0&&(!_o||fo.length==0))return Bo[0]+yo+Bo[1];if(vo<0)return io(fo)?zn.stylize(RegExp.prototype.toString.call(fo),"regexp"):zn.stylize("[Object]","special");zn.seen.push(fo);var Wo;return _o?Wo=_n(zn,fo,vo,Eo,lo):Wo=lo.map(function(na){return En(zn,fo,vo,Eo,na,_o)}),zn.seen.pop(),Cn(Wo,yo,Bo)}function Jr(zn,fo){if(oo(fo))return zn.stylize("undefined","undefined");if(to(fo)){var vo="'"+JSON.stringify(fo).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return zn.stylize(vo,"string")}if(ro(fo))return zn.stylize(""+fo,"number");if(An(fo))return zn.stylize(""+fo,"boolean");if(jn(fo))return zn.stylize("null","null")}function Qr(zn){return"["+Error.prototype.toString.call(zn)+"]"}function _n(zn,fo,vo,go,uo){for(var lo=[],Eo=0,mo=fo.length;Eo-1&&(lo?mo=mo.split(` `).map(function(_o){return" "+_o}).join(` @@ -3772,13 +3774,15 @@ Use Chrome, Firefox or Internet Explorer 11`)}var Er=safeBufferExports.Buffer,kr `))):mo=zn.stylize("[Circular]","special")),oo(Eo)){if(lo&&uo.match(/^\d+$/))return mo;Eo=JSON.stringify(""+uo),Eo.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(Eo=Eo.slice(1,-1),Eo=zn.stylize(Eo,"name")):(Eo=Eo.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),Eo=zn.stylize(Eo,"string"))}return Eo+": "+mo}function Cn(zn,fo,vo){var go=zn.reduce(function(uo,lo){return lo.indexOf(` `)>=0,uo+lo.replace(/\u001b\[\d\d?m/g,"").length+1},0);return go>60?vo[0]+(fo===""?"":fo+` `)+" "+zn.join(`, - `)+" "+vo[1]:vo[0]+fo+" "+zn.join(", ")+" "+vo[1]}fr.types=requireTypes$2();function In(zn){return Array.isArray(zn)}fr.isArray=In;function An(zn){return typeof zn=="boolean"}fr.isBoolean=An;function jn(zn){return zn===null}fr.isNull=jn;function eo(zn){return zn==null}fr.isNullOrUndefined=eo;function ro(zn){return typeof zn=="number"}fr.isNumber=ro;function to(zn){return typeof zn=="string"}fr.isString=to;function _i(zn){return typeof zn=="symbol"}fr.isSymbol=_i;function oo(zn){return zn===void 0}fr.isUndefined=oo;function io(zn){return co(zn)&&Xr(zn)==="[object RegExp]"}fr.isRegExp=io,fr.types.isRegExp=io;function co(zn){return typeof zn=="object"&&zn!==null}fr.isObject=co;function so(zn){return co(zn)&&Xr(zn)==="[object Date]"}fr.isDate=so,fr.types.isDate=so;function no(zn){return co(zn)&&(Xr(zn)==="[object Error]"||zn instanceof Error)}fr.isError=no,fr.types.isNativeError=no;function Tn(zn){return typeof zn=="function"}fr.isFunction=Tn;function Hr(zn){return zn===null||typeof zn=="boolean"||typeof zn=="number"||typeof zn=="string"||typeof zn=="symbol"||typeof zn>"u"}fr.isPrimitive=Hr,fr.isBuffer=requireIsBufferBrowser();function Xr(zn){return Object.prototype.toString.call(zn)}function Sn(zn){return zn<10?"0"+zn.toString(10):zn.toString(10)}var Rn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Pn(){var zn=new Date,fo=[Sn(zn.getHours()),Sn(zn.getMinutes()),Sn(zn.getSeconds())].join(":");return[zn.getDate(),Rn[zn.getMonth()],fo].join(" ")}fr.log=function(){console.log("%s - %s",Pn(),fr.format.apply(fr,arguments))},fr.inherits=requireInherits_browser(),fr._extend=function(zn,fo){if(!fo||!co(fo))return zn;for(var vo=Object.keys(fo),go=vo.length;go--;)zn[vo[go]]=fo[vo[go]];return zn};function On(zn,fo){return Object.prototype.hasOwnProperty.call(zn,fo)}var Zn=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;fr.promisify=function(fo){if(typeof fo!="function")throw new TypeError('The "original" argument must be of type Function');if(Zn&&fo[Zn]){var vo=fo[Zn];if(typeof vo!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(vo,Zn,{value:vo,enumerable:!1,writable:!1,configurable:!0}),vo}function vo(){for(var go,uo,lo=new Promise(function(yo,_o){go=yo,uo=_o}),Eo=[],mo=0;mo0?this.tail.next=In:this.head=In,this.tail=In,++this.length}},{key:"unshift",value:function(Cn){var In={data:Cn,next:this.head};this.length===0&&(this.tail=In),this.head=In,++this.length}},{key:"shift",value:function(){if(this.length!==0){var Cn=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,Cn}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(Cn){if(this.length===0)return"";for(var In=this.head,An=""+In.data;In=In.next;)An+=Cn+In.data;return An}},{key:"concat",value:function(Cn){if(this.length===0)return Gr.alloc(0);for(var In=Gr.allocUnsafe(Cn>>>0),An=this.head,jn=0;An;)Qr(An.data,In,jn),jn+=An.data.length,An=An.next;return In}},{key:"consume",value:function(Cn,In){var An;return Cneo.length?eo.length:Cn;if(ro===eo.length?jn+=eo:jn+=eo.slice(0,Cn),Cn-=ro,Cn===0){ro===eo.length?(++An,In.next?this.head=In.next:this.head=this.tail=null):(this.head=In,In.data=eo.slice(ro));break}++An}return this.length-=An,jn}},{key:"_getBuffer",value:function(Cn){var In=Gr.allocUnsafe(Cn),An=this.head,jn=1;for(An.data.copy(In),Cn-=An.data.length;An=An.next;){var eo=An.data,ro=Cn>eo.length?eo.length:Cn;if(eo.copy(In,In.length-Cn,0,ro),Cn-=ro,Cn===0){ro===eo.length?(++jn,An.next?this.head=An.next:this.head=this.tail=null):(this.head=An,An.data=eo.slice(ro));break}++jn}return this.length-=jn,In}},{key:Jr,value:function(Cn,In){return Zr(this,br(br({},In),{},{depth:0,customInspect:!1}))}}]),_n}(),buffer_list}var destroy_1$1,hasRequiredDestroy$1;function requireDestroy$1(){if(hasRequiredDestroy$1)return destroy_1$1;hasRequiredDestroy$1=1;function fr(Br,Wr){var qr=this,Gr=this._readableState&&this._readableState.destroyed,Vr=this._writableState&&this._writableState.destroyed;return Gr||Vr?(Wr?Wr(Br):Br&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process$1$1.nextTick(kr,this,Br)):process$1$1.nextTick(kr,this,Br)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(Br||null,function(Zr){!Wr&&Zr?qr._writableState?qr._writableState.errorEmitted?process$1$1.nextTick(wr,qr):(qr._writableState.errorEmitted=!0,process$1$1.nextTick(br,qr,Zr)):process$1$1.nextTick(br,qr,Zr):Wr?(process$1$1.nextTick(wr,qr),Wr(Zr)):process$1$1.nextTick(wr,qr)}),this)}function br(Br,Wr){kr(Br,Wr),wr(Br)}function wr(Br){Br._writableState&&!Br._writableState.emitClose||Br._readableState&&!Br._readableState.emitClose||Br.emit("close")}function Er(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function kr(Br,Wr){Br.emit("error",Wr)}function jr(Br,Wr){var qr=Br._readableState,Gr=Br._writableState;qr&&qr.autoDestroy||Gr&&Gr.autoDestroy?Br.destroy(Wr):Br.emit("error",Wr)}return destroy_1$1={destroy:fr,undestroy:Er,errorOrDestroy:jr},destroy_1$1}var errorsBrowser={},hasRequiredErrorsBrowser;function requireErrorsBrowser(){if(hasRequiredErrorsBrowser)return errorsBrowser;hasRequiredErrorsBrowser=1;function fr(Wr,qr){Wr.prototype=Object.create(qr.prototype),Wr.prototype.constructor=Wr,Wr.__proto__=qr}var br={};function wr(Wr,qr,Gr){Gr||(Gr=Error);function Vr(Jr,Qr,_n){return typeof qr=="string"?qr:qr(Jr,Qr,_n)}var Zr=function(Jr){fr(Qr,Jr);function Qr(_n,En,Cn){return Jr.call(this,Vr(_n,En,Cn))||this}return Qr}(Gr);Zr.prototype.name=Gr.name,Zr.prototype.code=Wr,br[Wr]=Zr}function Er(Wr,qr){if(Array.isArray(Wr)){var Gr=Wr.length;return Wr=Wr.map(function(Vr){return String(Vr)}),Gr>2?"one of ".concat(qr," ").concat(Wr.slice(0,Gr-1).join(", "),", or ")+Wr[Gr-1]:Gr===2?"one of ".concat(qr," ").concat(Wr[0]," or ").concat(Wr[1]):"of ".concat(qr," ").concat(Wr[0])}else return"of ".concat(qr," ").concat(String(Wr))}function kr(Wr,qr,Gr){return Wr.substr(0,qr.length)===qr}function jr(Wr,qr,Gr){return(Gr===void 0||Gr>Wr.length)&&(Gr=Wr.length),Wr.substring(Gr-qr.length,Gr)===qr}function Br(Wr,qr,Gr){return typeof Gr!="number"&&(Gr=0),Gr+qr.length>Wr.length?!1:Wr.indexOf(qr,Gr)!==-1}return wr("ERR_INVALID_OPT_VALUE",function(Wr,qr){return'The value "'+qr+'" is invalid for option "'+Wr+'"'},TypeError),wr("ERR_INVALID_ARG_TYPE",function(Wr,qr,Gr){var Vr;typeof qr=="string"&&kr(qr,"not ")?(Vr="must not be",qr=qr.replace(/^not /,"")):Vr="must be";var Zr;if(jr(Wr," argument"))Zr="The ".concat(Wr," ").concat(Vr," ").concat(Er(qr,"type"));else{var Jr=Br(Wr,".")?"property":"argument";Zr='The "'.concat(Wr,'" ').concat(Jr," ").concat(Vr," ").concat(Er(qr,"type"))}return Zr+=". Received type ".concat(typeof Gr),Zr},TypeError),wr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),wr("ERR_METHOD_NOT_IMPLEMENTED",function(Wr){return"The "+Wr+" method is not implemented"}),wr("ERR_STREAM_PREMATURE_CLOSE","Premature close"),wr("ERR_STREAM_DESTROYED",function(Wr){return"Cannot call "+Wr+" after a stream was destroyed"}),wr("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),wr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),wr("ERR_STREAM_WRITE_AFTER_END","write after end"),wr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),wr("ERR_UNKNOWN_ENCODING",function(Wr){return"Unknown encoding: "+Wr},TypeError),wr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),errorsBrowser.codes=br,errorsBrowser}var state,hasRequiredState;function requireState(){if(hasRequiredState)return state;hasRequiredState=1;var fr=requireErrorsBrowser().codes.ERR_INVALID_OPT_VALUE;function br(Er,kr,jr){return Er.highWaterMark!=null?Er.highWaterMark:kr?Er[jr]:null}function wr(Er,kr,jr,Br){var Wr=br(kr,Br,jr);if(Wr!=null){if(!(isFinite(Wr)&&Math.floor(Wr)===Wr)||Wr<0){var qr=Br?jr:"highWaterMark";throw new fr(qr,Wr)}return Math.floor(Wr)}return Er.objectMode?16:16*1024}return state={getHighWaterMark:wr},state}var browser$f,hasRequiredBrowser$a;function requireBrowser$a(){if(hasRequiredBrowser$a)return browser$f;hasRequiredBrowser$a=1,browser$f=fr;function fr(wr,Er){if(br("noDeprecation"))return wr;var kr=!1;function jr(){if(!kr){if(br("throwDeprecation"))throw new Error(Er);br("traceDeprecation")?console.trace(Er):console.warn(Er),kr=!0}return wr.apply(this,arguments)}return jr}function br(wr){try{if(!commonjsGlobal.localStorage)return!1}catch{return!1}var Er=commonjsGlobal.localStorage[wr];return Er==null?!1:String(Er).toLowerCase()==="true"}return browser$f}var _stream_writable$1,hasRequired_stream_writable$1;function require_stream_writable$1(){if(hasRequired_stream_writable$1)return _stream_writable$1;hasRequired_stream_writable$1=1,_stream_writable$1=oo;function fr(go){var uo=this;this.next=null,this.entry=null,this.finish=function(){vo(uo,go)}}var br;oo.WritableState=to;var wr={deprecate:requireBrowser$a()},Er=requireStreamBrowser$1(),kr=require$$0$9.Buffer,jr=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Br(go){return kr.from(go)}function Wr(go){return kr.isBuffer(go)||go instanceof jr}var qr=requireDestroy$1(),Gr=requireState(),Vr=Gr.getHighWaterMark,Zr=requireErrorsBrowser().codes,Jr=Zr.ERR_INVALID_ARG_TYPE,Qr=Zr.ERR_METHOD_NOT_IMPLEMENTED,_n=Zr.ERR_MULTIPLE_CALLBACK,En=Zr.ERR_STREAM_CANNOT_PIPE,Cn=Zr.ERR_STREAM_DESTROYED,In=Zr.ERR_STREAM_NULL_VALUES,An=Zr.ERR_STREAM_WRITE_AFTER_END,jn=Zr.ERR_UNKNOWN_ENCODING,eo=qr.errorOrDestroy;requireInherits_browser()(oo,Er);function ro(){}function to(go,uo,lo){br=br||require_stream_duplex$1(),go=go||{},typeof lo!="boolean"&&(lo=uo instanceof br),this.objectMode=!!go.objectMode,lo&&(this.objectMode=this.objectMode||!!go.writableObjectMode),this.highWaterMark=Vr(this,go,"writableHighWaterMark",lo),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Eo=go.decodeStrings===!1;this.decodeStrings=!Eo,this.defaultEncoding=go.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(mo){Sn(uo,mo)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=go.emitClose!==!1,this.autoDestroy=!!go.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new fr(this)}to.prototype.getBuffer=function(){for(var uo=this.bufferedRequest,lo=[];uo;)lo.push(uo),uo=uo.next;return lo},function(){try{Object.defineProperty(to.prototype,"buffer",{get:wr.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var _i;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(_i=Function.prototype[Symbol.hasInstance],Object.defineProperty(oo,Symbol.hasInstance,{value:function(uo){return _i.call(this,uo)?!0:this!==oo?!1:uo&&uo._writableState instanceof to}})):_i=function(uo){return uo instanceof this};function oo(go){br=br||require_stream_duplex$1();var uo=this instanceof br;if(!uo&&!_i.call(oo,this))return new oo(go);this._writableState=new to(go,this,uo),this.writable=!0,go&&(typeof go.write=="function"&&(this._write=go.write),typeof go.writev=="function"&&(this._writev=go.writev),typeof go.destroy=="function"&&(this._destroy=go.destroy),typeof go.final=="function"&&(this._final=go.final)),Er.call(this)}oo.prototype.pipe=function(){eo(this,new En)};function io(go,uo){var lo=new An;eo(go,lo),process$1$1.nextTick(uo,lo)}function co(go,uo,lo,Eo){var mo;return lo===null?mo=new In:typeof lo!="string"&&!uo.objectMode&&(mo=new Jr("chunk",["string","Buffer"],lo)),mo?(eo(go,mo),process$1$1.nextTick(Eo,mo),!1):!0}oo.prototype.write=function(go,uo,lo){var Eo=this._writableState,mo=!1,yo=!Eo.objectMode&&Wr(go);return yo&&!kr.isBuffer(go)&&(go=Br(go)),typeof uo=="function"&&(lo=uo,uo=null),yo?uo="buffer":uo||(uo=Eo.defaultEncoding),typeof lo!="function"&&(lo=ro),Eo.ending?io(this,lo):(yo||co(this,Eo,go,lo))&&(Eo.pendingcb++,mo=no(this,Eo,yo,go,uo,lo)),mo},oo.prototype.cork=function(){this._writableState.corked++},oo.prototype.uncork=function(){var go=this._writableState;go.corked&&(go.corked--,!go.writing&&!go.corked&&!go.bufferProcessing&&go.bufferedRequest&&On(this,go))},oo.prototype.setDefaultEncoding=function(uo){if(typeof uo=="string"&&(uo=uo.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((uo+"").toLowerCase())>-1))throw new jn(uo);return this._writableState.defaultEncoding=uo,this},Object.defineProperty(oo.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function so(go,uo,lo){return!go.objectMode&&go.decodeStrings!==!1&&typeof uo=="string"&&(uo=kr.from(uo,lo)),uo}Object.defineProperty(oo.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function no(go,uo,lo,Eo,mo,yo){if(!lo){var _o=so(uo,Eo,mo);Eo!==_o&&(lo=!0,mo="buffer",Eo=_o)}var Bo=uo.objectMode?1:Eo.length;uo.length+=Bo;var Lo=uo.length>5===6?2:In>>4===14?3:In>>3===30?4:In>>6===2?-1:-2}function Br(In,An,jn){var eo=An.length-1;if(eo=0?(ro>0&&(In.lastNeed=ro-1),ro):--eo=0?(ro>0&&(In.lastNeed=ro-2),ro):--eo=0?(ro>0&&(ro===2?ro=0:In.lastNeed=ro-3),ro):0))}function Wr(In,An,jn){if((An[0]&192)!==128)return In.lastNeed=0,"�";if(In.lastNeed>1&&An.length>1){if((An[1]&192)!==128)return In.lastNeed=1,"�";if(In.lastNeed>2&&An.length>2&&(An[2]&192)!==128)return In.lastNeed=2,"�"}}function qr(In){var An=this.lastTotal-this.lastNeed,jn=Wr(this,In);if(jn!==void 0)return jn;if(this.lastNeed<=In.length)return In.copy(this.lastChar,An,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);In.copy(this.lastChar,An,0,In.length),this.lastNeed-=In.length}function Gr(In,An){var jn=Br(this,In,An);if(!this.lastNeed)return In.toString("utf8",An);this.lastTotal=jn;var eo=In.length-(jn-this.lastNeed);return In.copy(this.lastChar,0,eo),In.toString("utf8",An,eo)}function Vr(In){var An=In&&In.length?this.write(In):"";return this.lastNeed?An+"�":An}function Zr(In,An){if((In.length-An)%2===0){var jn=In.toString("utf16le",An);if(jn){var eo=jn.charCodeAt(jn.length-1);if(eo>=55296&&eo<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=In[In.length-2],this.lastChar[1]=In[In.length-1],jn.slice(0,-1)}return jn}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=In[In.length-1],In.toString("utf16le",An,In.length-1)}function Jr(In){var An=In&&In.length?this.write(In):"";if(this.lastNeed){var jn=this.lastTotal-this.lastNeed;return An+this.lastChar.toString("utf16le",0,jn)}return An}function Qr(In,An){var jn=(In.length-An)%3;return jn===0?In.toString("base64",An):(this.lastNeed=3-jn,this.lastTotal=3,jn===1?this.lastChar[0]=In[In.length-1]:(this.lastChar[0]=In[In.length-2],this.lastChar[1]=In[In.length-1]),In.toString("base64",An,In.length-jn))}function _n(In){var An=In&&In.length?this.write(In):"";return this.lastNeed?An+this.lastChar.toString("base64",0,3-this.lastNeed):An}function En(In){return In.toString(this.encoding)}function Cn(In){return In&&In.length?this.write(In):""}return string_decoder}var endOfStream,hasRequiredEndOfStream;function requireEndOfStream(){if(hasRequiredEndOfStream)return endOfStream;hasRequiredEndOfStream=1;var fr=requireErrorsBrowser().codes.ERR_STREAM_PREMATURE_CLOSE;function br(jr){var Br=!1;return function(){if(!Br){Br=!0;for(var Wr=arguments.length,qr=new Array(Wr),Gr=0;Gr0)if(typeof _o!="string"&&!na.objectMode&&Object.getPrototypeOf(_o)!==Er.prototype&&(_o=jr(_o)),Lo)na.endEmitted?ro(yo,new In):so(yo,na,_o,!0);else if(na.ended)ro(yo,new En);else{if(na.destroyed)return!1;na.reading=!1,na.decoder&&!Bo?(_o=na.decoder.write(_o),na.objectMode||_o.length!==0?so(yo,na,_o,!1):On(yo,na)):so(yo,na,_o,!1)}else Lo||(na.reading=!1,On(yo,na))}return!na.ended&&(na.length=Tn?yo=Tn:(yo--,yo|=yo>>>1,yo|=yo>>>2,yo|=yo>>>4,yo|=yo>>>8,yo|=yo>>>16,yo++),yo}function Xr(yo,_o){return yo<=0||_o.length===0&&_o.ended?0:_o.objectMode?1:yo!==yo?_o.flowing&&_o.length?_o.buffer.head.data.length:_o.length:(yo>_o.highWaterMark&&(_o.highWaterMark=Hr(yo)),yo<=_o.length?yo:_o.ended?_o.length:(_o.needReadable=!0,0))}io.prototype.read=function(yo){qr("read",yo),yo=parseInt(yo,10);var _o=this._readableState,Bo=yo;if(yo!==0&&(_o.emittedReadable=!1),yo===0&&_o.needReadable&&((_o.highWaterMark!==0?_o.length>=_o.highWaterMark:_o.length>0)||_o.ended))return qr("read: emitReadable",_o.length,_o.ended),_o.length===0&&_o.ended?lo(this):Rn(this),null;if(yo=Xr(yo,_o),yo===0&&_o.ended)return _o.length===0&&lo(this),null;var Lo=_o.needReadable;qr("need readable",Lo),(_o.length===0||_o.length-yo<_o.highWaterMark)&&(Lo=!0,qr("length less than watermark",Lo)),_o.ended||_o.reading?(Lo=!1,qr("reading or ended",Lo)):Lo&&(qr("do read"),_o.reading=!0,_o.sync=!0,_o.length===0&&(_o.needReadable=!0),this._read(_o.highWaterMark),_o.sync=!1,_o.reading||(yo=Xr(Bo,_o)));var Wo;return yo>0?Wo=uo(yo,_o):Wo=null,Wo===null?(_o.needReadable=_o.length<=_o.highWaterMark,yo=0):(_o.length-=yo,_o.awaitDrain=0),_o.length===0&&(_o.ended||(_o.needReadable=!0),Bo!==yo&&_o.ended&&lo(this)),Wo!==null&&this.emit("data",Wo),Wo};function Sn(yo,_o){if(qr("onEofChunk"),!_o.ended){if(_o.decoder){var Bo=_o.decoder.end();Bo&&Bo.length&&(_o.buffer.push(Bo),_o.length+=_o.objectMode?1:Bo.length)}_o.ended=!0,_o.sync?Rn(yo):(_o.needReadable=!1,_o.emittedReadable||(_o.emittedReadable=!0,Pn(yo)))}}function Rn(yo){var _o=yo._readableState;qr("emitReadable",_o.needReadable,_o.emittedReadable),_o.needReadable=!1,_o.emittedReadable||(qr("emitReadable",_o.flowing),_o.emittedReadable=!0,process$1$1.nextTick(Pn,yo))}function Pn(yo){var _o=yo._readableState;qr("emitReadable_",_o.destroyed,_o.length,_o.ended),!_o.destroyed&&(_o.length||_o.ended)&&(yo.emit("readable"),_o.emittedReadable=!1),_o.needReadable=!_o.flowing&&!_o.ended&&_o.length<=_o.highWaterMark,go(yo)}function On(yo,_o){_o.readingMore||(_o.readingMore=!0,process$1$1.nextTick(Zn,yo,_o))}function Zn(yo,_o){for(;!_o.reading&&!_o.ended&&(_o.length<_o.highWaterMark||_o.flowing&&_o.length===0);){var Bo=_o.length;if(qr("maybeReadMore read 0"),yo.read(0),Bo===_o.length)break}_o.readingMore=!1}io.prototype._read=function(yo){ro(this,new Cn("_read()"))},io.prototype.pipe=function(yo,_o){var Bo=this,Lo=this._readableState;switch(Lo.pipesCount){case 0:Lo.pipes=yo;break;case 1:Lo.pipes=[Lo.pipes,yo];break;default:Lo.pipes.push(yo);break}Lo.pipesCount+=1,qr("pipe count=%d opts=%j",Lo.pipesCount,_o);var Wo=(!_o||_o.end!==!1)&&yo!==process$1$1.stdout&&yo!==process$1$1.stderr,na=Wo?ga:$a;Lo.endEmitted?process$1$1.nextTick(na):Bo.once("end",na),yo.on("unpipe",qo);function qo(Jo,Zl){qr("onunpipe"),Jo===Bo&&Zl&&Zl.hasUnpiped===!1&&(Zl.hasUnpiped=!0,Fo())}function ga(){qr("onend"),yo.end()}var wl=Nn(Bo);yo.on("drain",wl);var No=!1;function Fo(){qr("cleanup"),yo.removeListener("close",Uo),yo.removeListener("finish",Ml),yo.removeListener("drain",wl),yo.removeListener("error",Vo),yo.removeListener("unpipe",qo),Bo.removeListener("end",ga),Bo.removeListener("end",$a),Bo.removeListener("data",Nl),No=!0,Lo.awaitDrain&&(!yo._writableState||yo._writableState.needDrain)&&wl()}Bo.on("data",Nl);function Nl(Jo){qr("ondata");var Zl=yo.write(Jo);qr("dest.write",Zl),Zl===!1&&((Lo.pipesCount===1&&Lo.pipes===yo||Lo.pipesCount>1&&mo(Lo.pipes,yo)!==-1)&&!No&&(qr("false write response, pause",Lo.awaitDrain),Lo.awaitDrain++),Bo.pause())}function Vo(Jo){qr("onerror",Jo),$a(),yo.removeListener("error",Vo),br(yo,"error")===0&&ro(yo,Jo)}_i(yo,"error",Vo);function Uo(){yo.removeListener("finish",Ml),$a()}yo.once("close",Uo);function Ml(){qr("onfinish"),yo.removeListener("close",Uo),$a()}yo.once("finish",Ml);function $a(){qr("unpipe"),Bo.unpipe(yo)}return yo.emit("pipe",Bo),Lo.flowing||(qr("pipe resume"),Bo.resume()),yo};function Nn(yo){return function(){var Bo=yo._readableState;qr("pipeOnDrain",Bo.awaitDrain),Bo.awaitDrain&&Bo.awaitDrain--,Bo.awaitDrain===0&&br(yo,"data")&&(Bo.flowing=!0,go(yo))}}io.prototype.unpipe=function(yo){var _o=this._readableState,Bo={hasUnpiped:!1};if(_o.pipesCount===0)return this;if(_o.pipesCount===1)return yo&&yo!==_o.pipes?this:(yo||(yo=_o.pipes),_o.pipes=null,_o.pipesCount=0,_o.flowing=!1,yo&&yo.emit("unpipe",this,Bo),this);if(!yo){var Lo=_o.pipes,Wo=_o.pipesCount;_o.pipes=null,_o.pipesCount=0,_o.flowing=!1;for(var na=0;na0,Lo.flowing!==!1&&this.resume()):yo==="readable"&&!Lo.endEmitted&&!Lo.readableListening&&(Lo.readableListening=Lo.needReadable=!0,Lo.flowing=!1,Lo.emittedReadable=!1,qr("on readable",Lo.length,Lo.reading),Lo.length?Rn(this):Lo.reading||process$1$1.nextTick(zn,this)),Bo},io.prototype.addListener=io.prototype.on,io.prototype.removeListener=function(yo,_o){var Bo=wr.prototype.removeListener.call(this,yo,_o);return yo==="readable"&&process$1$1.nextTick(wn,this),Bo},io.prototype.removeAllListeners=function(yo){var _o=wr.prototype.removeAllListeners.apply(this,arguments);return(yo==="readable"||yo===void 0)&&process$1$1.nextTick(wn,this),_o};function wn(yo){var _o=yo._readableState;_o.readableListening=yo.listenerCount("readable")>0,_o.resumeScheduled&&!_o.paused?_o.flowing=!0:yo.listenerCount("data")>0&&yo.resume()}function zn(yo){qr("readable nexttick read 0"),yo.read(0)}io.prototype.resume=function(){var yo=this._readableState;return yo.flowing||(qr("resume"),yo.flowing=!yo.readableListening,fo(this,yo)),yo.paused=!1,this};function fo(yo,_o){_o.resumeScheduled||(_o.resumeScheduled=!0,process$1$1.nextTick(vo,yo,_o))}function vo(yo,_o){qr("resume",_o.reading),_o.reading||yo.read(0),_o.resumeScheduled=!1,yo.emit("resume"),go(yo),_o.flowing&&!_o.reading&&yo.read(0)}io.prototype.pause=function(){return qr("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(qr("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function go(yo){var _o=yo._readableState;for(qr("flow",_o.flowing);_o.flowing&&yo.read()!==null;);}io.prototype.wrap=function(yo){var _o=this,Bo=this._readableState,Lo=!1;yo.on("end",function(){if(qr("wrapped end"),Bo.decoder&&!Bo.ended){var qo=Bo.decoder.end();qo&&qo.length&&_o.push(qo)}_o.push(null)}),yo.on("data",function(qo){if(qr("wrapped data"),Bo.decoder&&(qo=Bo.decoder.write(qo)),!(Bo.objectMode&&qo==null)&&!(!Bo.objectMode&&(!qo||!qo.length))){var ga=_o.push(qo);ga||(Lo=!0,yo.pause())}});for(var Wo in yo)this[Wo]===void 0&&typeof yo[Wo]=="function"&&(this[Wo]=function(ga){return function(){return yo[ga].apply(yo,arguments)}}(Wo));for(var na=0;na=_o.length?(_o.decoder?Bo=_o.buffer.join(""):_o.buffer.length===1?Bo=_o.buffer.first():Bo=_o.buffer.concat(_o.length),_o.buffer.clear()):Bo=_o.buffer.consume(yo,_o.decoder),Bo}function lo(yo){var _o=yo._readableState;qr("endReadable",_o.endEmitted),_o.endEmitted||(_o.ended=!0,process$1$1.nextTick(Eo,_o,yo))}function Eo(yo,_o){if(qr("endReadableNT",yo.endEmitted,yo.length),!yo.endEmitted&&yo.length===0&&(yo.endEmitted=!0,_o.readable=!1,_o.emit("end"),yo.autoDestroy)){var Bo=_o._writableState;(!Bo||Bo.autoDestroy&&Bo.finished)&&_o.destroy()}}typeof Symbol=="function"&&(io.from=function(yo,_o){return eo===void 0&&(eo=requireFromBrowser()),eo(io,yo,_o)});function mo(yo,_o){for(var Bo=0,Lo=yo.length;Bo0;return Wr(An,eo,ro,function(to){Cn||(Cn=to),to&&In.forEach(qr),!eo&&(In.forEach(qr),En(Cn))})});return Qr.reduce(Gr)}return pipeline_1=Zr,pipeline_1}var hasRequiredReadableBrowser$1;function requireReadableBrowser$1(){return hasRequiredReadableBrowser$1||(hasRequiredReadableBrowser$1=1,function(fr,br){br=fr.exports=require_stream_readable$1(),br.Stream=br,br.Readable=br,br.Writable=require_stream_writable$1(),br.Duplex=require_stream_duplex$1(),br.Transform=require_stream_transform$1(),br.PassThrough=require_stream_passthrough$1(),br.finished=requireEndOfStream(),br.pipeline=requirePipeline()}(readableBrowser$1,readableBrowser$1.exports)),readableBrowser$1.exports}var hashBase$1,hasRequiredHashBase$1;function requireHashBase$1(){if(hasRequiredHashBase$1)return hashBase$1;hasRequiredHashBase$1=1;var fr=safeBufferExports.Buffer,br=requireReadableBrowser$1().Transform,wr=requireInherits_browser();function Er(jr,Br){if(!fr.isBuffer(jr)&&typeof jr!="string")throw new TypeError(Br+" must be a string or a buffer")}function kr(jr){br.call(this),this._block=fr.allocUnsafe(jr),this._blockSize=jr,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}return wr(kr,br),kr.prototype._transform=function(jr,Br,Wr){var qr=null;try{this.update(jr,Br)}catch(Gr){qr=Gr}Wr(qr)},kr.prototype._flush=function(jr){var Br=null;try{this.push(this.digest())}catch(Wr){Br=Wr}jr(Br)},kr.prototype.update=function(jr,Br){if(Er(jr,"Data"),this._finalized)throw new Error("Digest already called");fr.isBuffer(jr)||(jr=fr.from(jr,Br));for(var Wr=this._block,qr=0;this._blockOffset+jr.length-qr>=this._blockSize;){for(var Gr=this._blockOffset;Gr0;++Vr)this._length[Vr]+=Zr,Zr=this._length[Vr]/4294967296|0,Zr>0&&(this._length[Vr]-=4294967296*Zr);return this},kr.prototype._update=function(){throw new Error("_update is not implemented")},kr.prototype.digest=function(jr){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var Br=this._digest();jr!==void 0&&(Br=Br.toString(jr)),this._block.fill(0),this._blockOffset=0;for(var Wr=0;Wr<4;++Wr)this._length[Wr]=0;return Br},kr.prototype._digest=function(){throw new Error("_digest is not implemented")},hashBase$1=kr,hashBase$1}var md5_js,hasRequiredMd5_js;function requireMd5_js(){if(hasRequiredMd5_js)return md5_js;hasRequiredMd5_js=1;var fr=requireInherits_browser(),br=requireHashBase$1(),wr=safeBufferExports.Buffer,Er=new Array(16);function kr(){br.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}fr(kr,br),kr.prototype._update=function(){for(var Vr=Er,Zr=0;Zr<16;++Zr)Vr[Zr]=this._block.readInt32LE(Zr*4);var Jr=this._a,Qr=this._b,_n=this._c,En=this._d;Jr=Br(Jr,Qr,_n,En,Vr[0],3614090360,7),En=Br(En,Jr,Qr,_n,Vr[1],3905402710,12),_n=Br(_n,En,Jr,Qr,Vr[2],606105819,17),Qr=Br(Qr,_n,En,Jr,Vr[3],3250441966,22),Jr=Br(Jr,Qr,_n,En,Vr[4],4118548399,7),En=Br(En,Jr,Qr,_n,Vr[5],1200080426,12),_n=Br(_n,En,Jr,Qr,Vr[6],2821735955,17),Qr=Br(Qr,_n,En,Jr,Vr[7],4249261313,22),Jr=Br(Jr,Qr,_n,En,Vr[8],1770035416,7),En=Br(En,Jr,Qr,_n,Vr[9],2336552879,12),_n=Br(_n,En,Jr,Qr,Vr[10],4294925233,17),Qr=Br(Qr,_n,En,Jr,Vr[11],2304563134,22),Jr=Br(Jr,Qr,_n,En,Vr[12],1804603682,7),En=Br(En,Jr,Qr,_n,Vr[13],4254626195,12),_n=Br(_n,En,Jr,Qr,Vr[14],2792965006,17),Qr=Br(Qr,_n,En,Jr,Vr[15],1236535329,22),Jr=Wr(Jr,Qr,_n,En,Vr[1],4129170786,5),En=Wr(En,Jr,Qr,_n,Vr[6],3225465664,9),_n=Wr(_n,En,Jr,Qr,Vr[11],643717713,14),Qr=Wr(Qr,_n,En,Jr,Vr[0],3921069994,20),Jr=Wr(Jr,Qr,_n,En,Vr[5],3593408605,5),En=Wr(En,Jr,Qr,_n,Vr[10],38016083,9),_n=Wr(_n,En,Jr,Qr,Vr[15],3634488961,14),Qr=Wr(Qr,_n,En,Jr,Vr[4],3889429448,20),Jr=Wr(Jr,Qr,_n,En,Vr[9],568446438,5),En=Wr(En,Jr,Qr,_n,Vr[14],3275163606,9),_n=Wr(_n,En,Jr,Qr,Vr[3],4107603335,14),Qr=Wr(Qr,_n,En,Jr,Vr[8],1163531501,20),Jr=Wr(Jr,Qr,_n,En,Vr[13],2850285829,5),En=Wr(En,Jr,Qr,_n,Vr[2],4243563512,9),_n=Wr(_n,En,Jr,Qr,Vr[7],1735328473,14),Qr=Wr(Qr,_n,En,Jr,Vr[12],2368359562,20),Jr=qr(Jr,Qr,_n,En,Vr[5],4294588738,4),En=qr(En,Jr,Qr,_n,Vr[8],2272392833,11),_n=qr(_n,En,Jr,Qr,Vr[11],1839030562,16),Qr=qr(Qr,_n,En,Jr,Vr[14],4259657740,23),Jr=qr(Jr,Qr,_n,En,Vr[1],2763975236,4),En=qr(En,Jr,Qr,_n,Vr[4],1272893353,11),_n=qr(_n,En,Jr,Qr,Vr[7],4139469664,16),Qr=qr(Qr,_n,En,Jr,Vr[10],3200236656,23),Jr=qr(Jr,Qr,_n,En,Vr[13],681279174,4),En=qr(En,Jr,Qr,_n,Vr[0],3936430074,11),_n=qr(_n,En,Jr,Qr,Vr[3],3572445317,16),Qr=qr(Qr,_n,En,Jr,Vr[6],76029189,23),Jr=qr(Jr,Qr,_n,En,Vr[9],3654602809,4),En=qr(En,Jr,Qr,_n,Vr[12],3873151461,11),_n=qr(_n,En,Jr,Qr,Vr[15],530742520,16),Qr=qr(Qr,_n,En,Jr,Vr[2],3299628645,23),Jr=Gr(Jr,Qr,_n,En,Vr[0],4096336452,6),En=Gr(En,Jr,Qr,_n,Vr[7],1126891415,10),_n=Gr(_n,En,Jr,Qr,Vr[14],2878612391,15),Qr=Gr(Qr,_n,En,Jr,Vr[5],4237533241,21),Jr=Gr(Jr,Qr,_n,En,Vr[12],1700485571,6),En=Gr(En,Jr,Qr,_n,Vr[3],2399980690,10),_n=Gr(_n,En,Jr,Qr,Vr[10],4293915773,15),Qr=Gr(Qr,_n,En,Jr,Vr[1],2240044497,21),Jr=Gr(Jr,Qr,_n,En,Vr[8],1873313359,6),En=Gr(En,Jr,Qr,_n,Vr[15],4264355552,10),_n=Gr(_n,En,Jr,Qr,Vr[6],2734768916,15),Qr=Gr(Qr,_n,En,Jr,Vr[13],1309151649,21),Jr=Gr(Jr,Qr,_n,En,Vr[4],4149444226,6),En=Gr(En,Jr,Qr,_n,Vr[11],3174756917,10),_n=Gr(_n,En,Jr,Qr,Vr[2],718787259,15),Qr=Gr(Qr,_n,En,Jr,Vr[9],3951481745,21),this._a=this._a+Jr|0,this._b=this._b+Qr|0,this._c=this._c+_n|0,this._d=this._d+En|0},kr.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var Vr=wr.allocUnsafe(16);return Vr.writeInt32LE(this._a,0),Vr.writeInt32LE(this._b,4),Vr.writeInt32LE(this._c,8),Vr.writeInt32LE(this._d,12),Vr};function jr(Vr,Zr){return Vr<>>32-Zr}function Br(Vr,Zr,Jr,Qr,_n,En,Cn){return jr(Vr+(Zr&Jr|~Zr&Qr)+_n+En|0,Cn)+Zr|0}function Wr(Vr,Zr,Jr,Qr,_n,En,Cn){return jr(Vr+(Zr&Qr|Jr&~Qr)+_n+En|0,Cn)+Zr|0}function qr(Vr,Zr,Jr,Qr,_n,En,Cn){return jr(Vr+(Zr^Jr^Qr)+_n+En|0,Cn)+Zr|0}function Gr(Vr,Zr,Jr,Qr,_n,En,Cn){return jr(Vr+(Jr^(Zr|~Qr))+_n+En|0,Cn)+Zr|0}return md5_js=kr,md5_js}var hashBase,hasRequiredHashBase;function requireHashBase(){if(hasRequiredHashBase)return hashBase;hasRequiredHashBase=1;var fr=safeBufferExports.Buffer,br=requireReadableBrowser$1().Transform,wr=requireInherits_browser();function Er(jr,Br){if(!fr.isBuffer(jr)&&typeof jr!="string")throw new TypeError(Br+" must be a string or a buffer")}function kr(jr){br.call(this),this._block=fr.allocUnsafe(jr),this._blockSize=jr,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}return wr(kr,br),kr.prototype._transform=function(jr,Br,Wr){var qr=null;try{this.update(jr,Br)}catch(Gr){qr=Gr}Wr(qr)},kr.prototype._flush=function(jr){var Br=null;try{this.push(this.digest())}catch(Wr){Br=Wr}jr(Br)},kr.prototype.update=function(jr,Br){if(Er(jr,"Data"),this._finalized)throw new Error("Digest already called");fr.isBuffer(jr)||(jr=fr.from(jr,Br));for(var Wr=this._block,qr=0;this._blockOffset+jr.length-qr>=this._blockSize;){for(var Gr=this._blockOffset;Gr0;++Vr)this._length[Vr]+=Zr,Zr=this._length[Vr]/4294967296|0,Zr>0&&(this._length[Vr]-=4294967296*Zr);return this},kr.prototype._update=function(){throw new Error("_update is not implemented")},kr.prototype.digest=function(jr){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var Br=this._digest();jr!==void 0&&(Br=Br.toString(jr)),this._block.fill(0),this._blockOffset=0;for(var Wr=0;Wr<4;++Wr)this._length[Wr]=0;return Br},kr.prototype._digest=function(){throw new Error("_digest is not implemented")},hashBase=kr,hashBase}var ripemd160,hasRequiredRipemd160;function requireRipemd160(){if(hasRequiredRipemd160)return ripemd160;hasRequiredRipemd160=1;var fr=require$$0$9.Buffer,br=requireInherits_browser(),wr=requireHashBase(),Er=new Array(16),kr=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],jr=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Br=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Wr=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],qr=[0,1518500249,1859775393,2400959708,2840853838],Gr=[1352829926,1548603684,1836072691,2053994217,0];function Vr(){wr.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}br(Vr,wr),Vr.prototype._update=function(){for(var In=Er,An=0;An<16;++An)In[An]=this._block.readInt32LE(An*4);for(var jn=this._a|0,eo=this._b|0,ro=this._c|0,to=this._d|0,_i=this._e|0,oo=this._a|0,io=this._b|0,co=this._c|0,so=this._d|0,no=this._e|0,Tn=0;Tn<80;Tn+=1){var Hr,Xr;Tn<16?(Hr=Jr(jn,eo,ro,to,_i,In[kr[Tn]],qr[0],Br[Tn]),Xr=Cn(oo,io,co,so,no,In[jr[Tn]],Gr[0],Wr[Tn])):Tn<32?(Hr=Qr(jn,eo,ro,to,_i,In[kr[Tn]],qr[1],Br[Tn]),Xr=En(oo,io,co,so,no,In[jr[Tn]],Gr[1],Wr[Tn])):Tn<48?(Hr=_n(jn,eo,ro,to,_i,In[kr[Tn]],qr[2],Br[Tn]),Xr=_n(oo,io,co,so,no,In[jr[Tn]],Gr[2],Wr[Tn])):Tn<64?(Hr=En(jn,eo,ro,to,_i,In[kr[Tn]],qr[3],Br[Tn]),Xr=Qr(oo,io,co,so,no,In[jr[Tn]],Gr[3],Wr[Tn])):(Hr=Cn(jn,eo,ro,to,_i,In[kr[Tn]],qr[4],Br[Tn]),Xr=Jr(oo,io,co,so,no,In[jr[Tn]],Gr[4],Wr[Tn])),jn=_i,_i=to,to=Zr(ro,10),ro=eo,eo=Hr,oo=no,no=so,so=Zr(co,10),co=io,io=Xr}var Sn=this._b+ro+so|0;this._b=this._c+to+no|0,this._c=this._d+_i+oo|0,this._d=this._e+jn+io|0,this._e=this._a+eo+co|0,this._a=Sn},Vr.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var In=fr.alloc?fr.alloc(20):new fr(20);return In.writeInt32LE(this._a,0),In.writeInt32LE(this._b,4),In.writeInt32LE(this._c,8),In.writeInt32LE(this._d,12),In.writeInt32LE(this._e,16),In};function Zr(In,An){return In<>>32-An}function Jr(In,An,jn,eo,ro,to,_i,oo){return Zr(In+(An^jn^eo)+to+_i|0,oo)+ro|0}function Qr(In,An,jn,eo,ro,to,_i,oo){return Zr(In+(An&jn|~An&eo)+to+_i|0,oo)+ro|0}function _n(In,An,jn,eo,ro,to,_i,oo){return Zr(In+((An|~jn)^eo)+to+_i|0,oo)+ro|0}function En(In,An,jn,eo,ro,to,_i,oo){return Zr(In+(An&eo|jn&~eo)+to+_i|0,oo)+ro|0}function Cn(In,An,jn,eo,ro,to,_i,oo){return Zr(In+(An^(jn|~eo))+to+_i|0,oo)+ro|0}return ripemd160=Vr,ripemd160}var sha_js={exports:{}},hash$2,hasRequiredHash$1;function requireHash$1(){if(hasRequiredHash$1)return hash$2;hasRequiredHash$1=1;var fr=safeBufferExports.Buffer;function br(wr,Er){this._block=fr.alloc(wr),this._finalSize=Er,this._blockSize=wr,this._len=0}return br.prototype.update=function(wr,Er){typeof wr=="string"&&(Er=Er||"utf8",wr=fr.from(wr,Er));for(var kr=this._block,jr=this._blockSize,Br=wr.length,Wr=this._len,qr=0;qr=this._finalSize&&(this._update(this._block),this._block.fill(0));var kr=this._len*8;if(kr<=4294967295)this._block.writeUInt32BE(kr,this._blockSize-4);else{var jr=(kr&4294967295)>>>0,Br=(kr-jr)/4294967296;this._block.writeUInt32BE(Br,this._blockSize-8),this._block.writeUInt32BE(jr,this._blockSize-4)}this._update(this._block);var Wr=this._hash();return wr?Wr.toString(wr):Wr},br.prototype._update=function(){throw new Error("_update must be implemented by subclass")},hash$2=br,hash$2}var sha$1,hasRequiredSha$1;function requireSha$1(){if(hasRequiredSha$1)return sha$1;hasRequiredSha$1=1;var fr=requireInherits_browser(),br=requireHash$1(),wr=safeBufferExports.Buffer,Er=[1518500249,1859775393,-1894007588,-899497514],kr=new Array(80);function jr(){this.init(),this._w=kr,br.call(this,64,56)}fr(jr,br),jr.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Br(Gr){return Gr<<5|Gr>>>27}function Wr(Gr){return Gr<<30|Gr>>>2}function qr(Gr,Vr,Zr,Jr){return Gr===0?Vr&Zr|~Vr&Jr:Gr===2?Vr&Zr|Vr&Jr|Zr&Jr:Vr^Zr^Jr}return jr.prototype._update=function(Gr){for(var Vr=this._w,Zr=this._a|0,Jr=this._b|0,Qr=this._c|0,_n=this._d|0,En=this._e|0,Cn=0;Cn<16;++Cn)Vr[Cn]=Gr.readInt32BE(Cn*4);for(;Cn<80;++Cn)Vr[Cn]=Vr[Cn-3]^Vr[Cn-8]^Vr[Cn-14]^Vr[Cn-16];for(var In=0;In<80;++In){var An=~~(In/20),jn=Br(Zr)+qr(An,Jr,Qr,_n)+En+Vr[In]+Er[An]|0;En=_n,_n=Qr,Qr=Wr(Jr),Jr=Zr,Zr=jn}this._a=Zr+this._a|0,this._b=Jr+this._b|0,this._c=Qr+this._c|0,this._d=_n+this._d|0,this._e=En+this._e|0},jr.prototype._hash=function(){var Gr=wr.allocUnsafe(20);return Gr.writeInt32BE(this._a|0,0),Gr.writeInt32BE(this._b|0,4),Gr.writeInt32BE(this._c|0,8),Gr.writeInt32BE(this._d|0,12),Gr.writeInt32BE(this._e|0,16),Gr},sha$1=jr,sha$1}var sha1$1,hasRequiredSha1;function requireSha1(){if(hasRequiredSha1)return sha1$1;hasRequiredSha1=1;var fr=requireInherits_browser(),br=requireHash$1(),wr=safeBufferExports.Buffer,Er=[1518500249,1859775393,-1894007588,-899497514],kr=new Array(80);function jr(){this.init(),this._w=kr,br.call(this,64,56)}fr(jr,br),jr.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Br(Vr){return Vr<<1|Vr>>>31}function Wr(Vr){return Vr<<5|Vr>>>27}function qr(Vr){return Vr<<30|Vr>>>2}function Gr(Vr,Zr,Jr,Qr){return Vr===0?Zr&Jr|~Zr&Qr:Vr===2?Zr&Jr|Zr&Qr|Jr&Qr:Zr^Jr^Qr}return jr.prototype._update=function(Vr){for(var Zr=this._w,Jr=this._a|0,Qr=this._b|0,_n=this._c|0,En=this._d|0,Cn=this._e|0,In=0;In<16;++In)Zr[In]=Vr.readInt32BE(In*4);for(;In<80;++In)Zr[In]=Br(Zr[In-3]^Zr[In-8]^Zr[In-14]^Zr[In-16]);for(var An=0;An<80;++An){var jn=~~(An/20),eo=Wr(Jr)+Gr(jn,Qr,_n,En)+Cn+Zr[An]+Er[jn]|0;Cn=En,En=_n,_n=qr(Qr),Qr=Jr,Jr=eo}this._a=Jr+this._a|0,this._b=Qr+this._b|0,this._c=_n+this._c|0,this._d=En+this._d|0,this._e=Cn+this._e|0},jr.prototype._hash=function(){var Vr=wr.allocUnsafe(20);return Vr.writeInt32BE(this._a|0,0),Vr.writeInt32BE(this._b|0,4),Vr.writeInt32BE(this._c|0,8),Vr.writeInt32BE(this._d|0,12),Vr.writeInt32BE(this._e|0,16),Vr},sha1$1=jr,sha1$1}var sha256$2,hasRequiredSha256;function requireSha256(){if(hasRequiredSha256)return sha256$2;hasRequiredSha256=1;var fr=requireInherits_browser(),br=requireHash$1(),wr=safeBufferExports.Buffer,Er=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],kr=new Array(64);function jr(){this.init(),this._w=kr,br.call(this,64,56)}fr(jr,br),jr.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function Br(Jr,Qr,_n){return _n^Jr&(Qr^_n)}function Wr(Jr,Qr,_n){return Jr&Qr|_n&(Jr|Qr)}function qr(Jr){return(Jr>>>2|Jr<<30)^(Jr>>>13|Jr<<19)^(Jr>>>22|Jr<<10)}function Gr(Jr){return(Jr>>>6|Jr<<26)^(Jr>>>11|Jr<<21)^(Jr>>>25|Jr<<7)}function Vr(Jr){return(Jr>>>7|Jr<<25)^(Jr>>>18|Jr<<14)^Jr>>>3}function Zr(Jr){return(Jr>>>17|Jr<<15)^(Jr>>>19|Jr<<13)^Jr>>>10}return jr.prototype._update=function(Jr){for(var Qr=this._w,_n=this._a|0,En=this._b|0,Cn=this._c|0,In=this._d|0,An=this._e|0,jn=this._f|0,eo=this._g|0,ro=this._h|0,to=0;to<16;++to)Qr[to]=Jr.readInt32BE(to*4);for(;to<64;++to)Qr[to]=Zr(Qr[to-2])+Qr[to-7]+Vr(Qr[to-15])+Qr[to-16]|0;for(var _i=0;_i<64;++_i){var oo=ro+Gr(An)+Br(An,jn,eo)+Er[_i]+Qr[_i]|0,io=qr(_n)+Wr(_n,En,Cn)|0;ro=eo,eo=jn,jn=An,An=In+oo|0,In=Cn,Cn=En,En=_n,_n=oo+io|0}this._a=_n+this._a|0,this._b=En+this._b|0,this._c=Cn+this._c|0,this._d=In+this._d|0,this._e=An+this._e|0,this._f=jn+this._f|0,this._g=eo+this._g|0,this._h=ro+this._h|0},jr.prototype._hash=function(){var Jr=wr.allocUnsafe(32);return Jr.writeInt32BE(this._a,0),Jr.writeInt32BE(this._b,4),Jr.writeInt32BE(this._c,8),Jr.writeInt32BE(this._d,12),Jr.writeInt32BE(this._e,16),Jr.writeInt32BE(this._f,20),Jr.writeInt32BE(this._g,24),Jr.writeInt32BE(this._h,28),Jr},sha256$2=jr,sha256$2}var sha224$1,hasRequiredSha224;function requireSha224(){if(hasRequiredSha224)return sha224$1;hasRequiredSha224=1;var fr=requireInherits_browser(),br=requireSha256(),wr=requireHash$1(),Er=safeBufferExports.Buffer,kr=new Array(64);function jr(){this.init(),this._w=kr,wr.call(this,64,56)}return fr(jr,br),jr.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},jr.prototype._hash=function(){var Br=Er.allocUnsafe(28);return Br.writeInt32BE(this._a,0),Br.writeInt32BE(this._b,4),Br.writeInt32BE(this._c,8),Br.writeInt32BE(this._d,12),Br.writeInt32BE(this._e,16),Br.writeInt32BE(this._f,20),Br.writeInt32BE(this._g,24),Br},sha224$1=jr,sha224$1}var sha512$3,hasRequiredSha512;function requireSha512(){if(hasRequiredSha512)return sha512$3;hasRequiredSha512=1;var fr=requireInherits_browser(),br=requireHash$1(),wr=safeBufferExports.Buffer,Er=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],kr=new Array(160);function jr(){this.init(),this._w=kr,br.call(this,128,112)}fr(jr,br),jr.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Br(En,Cn,In){return In^En&(Cn^In)}function Wr(En,Cn,In){return En&Cn|In&(En|Cn)}function qr(En,Cn){return(En>>>28|Cn<<4)^(Cn>>>2|En<<30)^(Cn>>>7|En<<25)}function Gr(En,Cn){return(En>>>14|Cn<<18)^(En>>>18|Cn<<14)^(Cn>>>9|En<<23)}function Vr(En,Cn){return(En>>>1|Cn<<31)^(En>>>8|Cn<<24)^En>>>7}function Zr(En,Cn){return(En>>>1|Cn<<31)^(En>>>8|Cn<<24)^(En>>>7|Cn<<25)}function Jr(En,Cn){return(En>>>19|Cn<<13)^(Cn>>>29|En<<3)^En>>>6}function Qr(En,Cn){return(En>>>19|Cn<<13)^(Cn>>>29|En<<3)^(En>>>6|Cn<<26)}function _n(En,Cn){return En>>>0>>0?1:0}return jr.prototype._update=function(En){for(var Cn=this._w,In=this._ah|0,An=this._bh|0,jn=this._ch|0,eo=this._dh|0,ro=this._eh|0,to=this._fh|0,_i=this._gh|0,oo=this._hh|0,io=this._al|0,co=this._bl|0,so=this._cl|0,no=this._dl|0,Tn=this._el|0,Hr=this._fl|0,Xr=this._gl|0,Sn=this._hl|0,Rn=0;Rn<32;Rn+=2)Cn[Rn]=En.readInt32BE(Rn*4),Cn[Rn+1]=En.readInt32BE(Rn*4+4);for(;Rn<160;Rn+=2){var Pn=Cn[Rn-30],On=Cn[Rn-15*2+1],Zn=Vr(Pn,On),Nn=Zr(On,Pn);Pn=Cn[Rn-2*2],On=Cn[Rn-2*2+1];var wn=Jr(Pn,On),zn=Qr(On,Pn),fo=Cn[Rn-7*2],vo=Cn[Rn-7*2+1],go=Cn[Rn-16*2],uo=Cn[Rn-16*2+1],lo=Nn+vo|0,Eo=Zn+fo+_n(lo,Nn)|0;lo=lo+zn|0,Eo=Eo+wn+_n(lo,zn)|0,lo=lo+uo|0,Eo=Eo+go+_n(lo,uo)|0,Cn[Rn]=Eo,Cn[Rn+1]=lo}for(var mo=0;mo<160;mo+=2){Eo=Cn[mo],lo=Cn[mo+1];var yo=Wr(In,An,jn),_o=Wr(io,co,so),Bo=qr(In,io),Lo=qr(io,In),Wo=Gr(ro,Tn),na=Gr(Tn,ro),qo=Er[mo],ga=Er[mo+1],wl=Br(ro,to,_i),No=Br(Tn,Hr,Xr),Fo=Sn+na|0,Nl=oo+Wo+_n(Fo,Sn)|0;Fo=Fo+No|0,Nl=Nl+wl+_n(Fo,No)|0,Fo=Fo+ga|0,Nl=Nl+qo+_n(Fo,ga)|0,Fo=Fo+lo|0,Nl=Nl+Eo+_n(Fo,lo)|0;var Vo=Lo+_o|0,Uo=Bo+yo+_n(Vo,Lo)|0;oo=_i,Sn=Xr,_i=to,Xr=Hr,to=ro,Hr=Tn,Tn=no+Fo|0,ro=eo+Nl+_n(Tn,no)|0,eo=jn,no=so,jn=An,so=co,An=In,co=io,io=Fo+Vo|0,In=Nl+Uo+_n(io,Fo)|0}this._al=this._al+io|0,this._bl=this._bl+co|0,this._cl=this._cl+so|0,this._dl=this._dl+no|0,this._el=this._el+Tn|0,this._fl=this._fl+Hr|0,this._gl=this._gl+Xr|0,this._hl=this._hl+Sn|0,this._ah=this._ah+In+_n(this._al,io)|0,this._bh=this._bh+An+_n(this._bl,co)|0,this._ch=this._ch+jn+_n(this._cl,so)|0,this._dh=this._dh+eo+_n(this._dl,no)|0,this._eh=this._eh+ro+_n(this._el,Tn)|0,this._fh=this._fh+to+_n(this._fl,Hr)|0,this._gh=this._gh+_i+_n(this._gl,Xr)|0,this._hh=this._hh+oo+_n(this._hl,Sn)|0},jr.prototype._hash=function(){var En=wr.allocUnsafe(64);function Cn(In,An,jn){En.writeInt32BE(In,jn),En.writeInt32BE(An,jn+4)}return Cn(this._ah,this._al,0),Cn(this._bh,this._bl,8),Cn(this._ch,this._cl,16),Cn(this._dh,this._dl,24),Cn(this._eh,this._el,32),Cn(this._fh,this._fl,40),Cn(this._gh,this._gl,48),Cn(this._hh,this._hl,56),En},sha512$3=jr,sha512$3}var sha384$1,hasRequiredSha384;function requireSha384(){if(hasRequiredSha384)return sha384$1;hasRequiredSha384=1;var fr=requireInherits_browser(),br=requireSha512(),wr=requireHash$1(),Er=safeBufferExports.Buffer,kr=new Array(160);function jr(){this.init(),this._w=kr,wr.call(this,128,112)}return fr(jr,br),jr.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},jr.prototype._hash=function(){var Br=Er.allocUnsafe(48);function Wr(qr,Gr,Vr){Br.writeInt32BE(qr,Vr),Br.writeInt32BE(Gr,Vr+4)}return Wr(this._ah,this._al,0),Wr(this._bh,this._bl,8),Wr(this._ch,this._cl,16),Wr(this._dh,this._dl,24),Wr(this._eh,this._el,32),Wr(this._fh,this._fl,40),Br},sha384$1=jr,sha384$1}var hasRequiredSha_js;function requireSha_js(){if(hasRequiredSha_js)return sha_js.exports;hasRequiredSha_js=1;var fr=sha_js.exports=function(wr){wr=wr.toLowerCase();var Er=fr[wr];if(!Er)throw new Error(wr+" is not supported (we accept pull requests)");return new Er};return fr.sha=requireSha$1(),fr.sha1=requireSha1(),fr.sha224=requireSha224(),fr.sha256=requireSha256(),fr.sha384=requireSha384(),fr.sha512=requireSha512(),sha_js.exports}var streamBrowserify,hasRequiredStreamBrowserify;function requireStreamBrowserify(){if(hasRequiredStreamBrowserify)return streamBrowserify;hasRequiredStreamBrowserify=1,streamBrowserify=wr;var fr=eventsExports.EventEmitter,br=requireInherits_browser();br(wr,fr),wr.Readable=require_stream_readable$1(),wr.Writable=require_stream_writable$1(),wr.Duplex=require_stream_duplex$1(),wr.Transform=require_stream_transform$1(),wr.PassThrough=require_stream_passthrough$1(),wr.finished=requireEndOfStream(),wr.pipeline=requirePipeline(),wr.Stream=wr;function wr(){fr.call(this)}return wr.prototype.pipe=function(Er,kr){var jr=this;function Br(Qr){Er.writable&&Er.write(Qr)===!1&&jr.pause&&jr.pause()}jr.on("data",Br);function Wr(){jr.readable&&jr.resume&&jr.resume()}Er.on("drain",Wr),!Er._isStdio&&(!kr||kr.end!==!1)&&(jr.on("end",Gr),jr.on("close",Vr));var qr=!1;function Gr(){qr||(qr=!0,Er.end())}function Vr(){qr||(qr=!0,typeof Er.destroy=="function"&&Er.destroy())}function Zr(Qr){if(Jr(),fr.listenerCount(this,"error")===0)throw Qr}jr.on("error",Zr),Er.on("error",Zr);function Jr(){jr.removeListener("data",Br),Er.removeListener("drain",Wr),jr.removeListener("end",Gr),jr.removeListener("close",Vr),jr.removeListener("error",Zr),Er.removeListener("error",Zr),jr.removeListener("end",Jr),jr.removeListener("close",Jr),Er.removeListener("close",Jr)}return jr.on("end",Jr),jr.on("close",Jr),Er.on("close",Jr),Er.emit("pipe",jr),Er},streamBrowserify}var cipherBase,hasRequiredCipherBase;function requireCipherBase(){if(hasRequiredCipherBase)return cipherBase;hasRequiredCipherBase=1;var fr=safeBufferExports.Buffer,br=requireStreamBrowserify().Transform,wr=requireString_decoder().StringDecoder,Er=requireInherits_browser();function kr(Wr){br.call(this),this.hashMode=typeof Wr=="string",this.hashMode?this[Wr]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}Er(kr,br);var jr=typeof Uint8Array<"u",Br=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(fr.prototype instanceof Uint8Array||fr.TYPED_ARRAY_SUPPORT);return kr.prototype.update=function(Wr,qr,Gr){var Vr;if(Wr instanceof fr)Vr=Wr;else if(typeof Wr=="string")Vr=fr.from(Wr,qr);else if(Br&&ArrayBuffer.isView(Wr))Vr=fr.from(Wr.buffer,Wr.byteOffset,Wr.byteLength);else if(jr&&Wr instanceof Uint8Array)Vr=fr.from(Wr);else if(fr.isBuffer(Wr)&&Wr.constructor&&Wr.constructor.isBuffer&&Wr.constructor.isBuffer(Wr))Vr=fr.from(Wr);else throw new Error('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.');var Zr=this._update(Vr);return this.hashMode?this:(Gr&&(Zr=this._toString(Zr,Gr)),Zr)},kr.prototype.setAutoPadding=function(){},kr.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},kr.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},kr.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},kr.prototype._transform=function(Wr,qr,Gr){var Vr;try{this.hashMode?this._update(Wr):this.push(this._update(Wr))}catch(Zr){Vr=Zr}finally{Gr(Vr)}},kr.prototype._flush=function(Wr){var qr;try{this.push(this.__final())}catch(Gr){qr=Gr}Wr(qr)},kr.prototype._finalOrDigest=function(Wr){var qr=this.__final()||fr.alloc(0);return Wr&&(qr=this._toString(qr,Wr,!0)),qr},kr.prototype._toString=function(Wr,qr,Gr){if(this._decoder||(this._decoder=new wr(qr),this._encoding=qr),this._encoding!==qr)throw new Error("can’t switch encodings");var Vr=this._decoder.write(Wr);return Gr&&(Vr+=this._decoder.end()),Vr},cipherBase=kr,cipherBase}var browser$e,hasRequiredBrowser$9;function requireBrowser$9(){if(hasRequiredBrowser$9)return browser$e;hasRequiredBrowser$9=1;var fr=requireInherits_browser(),br=requireMd5_js(),wr=requireRipemd160(),Er=requireSha_js(),kr=requireCipherBase();function jr(Br){kr.call(this,"digest"),this._hash=Br}return fr(jr,kr),jr.prototype._update=function(Br){this._hash.update(Br)},jr.prototype._final=function(){return this._hash.digest()},browser$e=function(Wr){return Wr=Wr.toLowerCase(),Wr==="md5"?new br:Wr==="rmd160"||Wr==="ripemd160"?new wr:new jr(Er(Wr))},browser$e}var legacy,hasRequiredLegacy;function requireLegacy(){if(hasRequiredLegacy)return legacy;hasRequiredLegacy=1;var fr=requireInherits_browser(),br=safeBufferExports.Buffer,wr=requireCipherBase(),Er=br.alloc(128),kr=64;function jr(Br,Wr){wr.call(this,"digest"),typeof Wr=="string"&&(Wr=br.from(Wr)),this._alg=Br,this._key=Wr,Wr.length>kr?Wr=Br(Wr):Wr.lengthZr){var Jr=Gr==="rmd160"?new jr:Br(Gr);Vr=Jr.update(Vr).digest()}else Vr.lengthfr||wr!==wr)throw new TypeError("Bad key length")},precondition}var defaultEncoding_1,hasRequiredDefaultEncoding;function requireDefaultEncoding(){if(hasRequiredDefaultEncoding)return defaultEncoding_1;hasRequiredDefaultEncoding=1;var fr;if(commonjsGlobal.process&&commonjsGlobal.process.browser)fr="utf-8";else if(commonjsGlobal.process&&commonjsGlobal.process.version){var br=parseInt(process$1$1.version.split(".")[0].slice(1),10);fr=br>=6?"utf-8":"binary"}else fr="utf-8";return defaultEncoding_1=fr,defaultEncoding_1}var toBuffer$4,hasRequiredToBuffer;function requireToBuffer(){if(hasRequiredToBuffer)return toBuffer$4;hasRequiredToBuffer=1;var fr=safeBufferExports.Buffer;return toBuffer$4=function(br,wr,Er){if(fr.isBuffer(br))return br;if(typeof br=="string")return fr.from(br,wr);if(ArrayBuffer.isView(br))return fr.from(br.buffer);throw new TypeError(Er+" must be a string, a Buffer, a typed array or a DataView")},toBuffer$4}var syncBrowser,hasRequiredSyncBrowser;function requireSyncBrowser(){if(hasRequiredSyncBrowser)return syncBrowser;hasRequiredSyncBrowser=1;var fr=requireMd5(),br=requireRipemd160(),wr=requireSha_js(),Er=safeBufferExports.Buffer,kr=requirePrecondition(),jr=requireDefaultEncoding(),Br=requireToBuffer(),Wr=Er.alloc(128),qr={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Gr(Jr,Qr,_n){var En=Vr(Jr),Cn=Jr==="sha512"||Jr==="sha384"?128:64;Qr.length>Cn?Qr=En(Qr):Qr.length>>0},utils$6.writeUInt32BE=function(kr,jr,Br){kr[0+Br]=jr>>>24,kr[1+Br]=jr>>>16&255,kr[2+Br]=jr>>>8&255,kr[3+Br]=jr&255},utils$6.ip=function(kr,jr,Br,Wr){for(var qr=0,Gr=0,Vr=6;Vr>=0;Vr-=2){for(var Zr=0;Zr<=24;Zr+=8)qr<<=1,qr|=jr>>>Zr+Vr&1;for(var Zr=0;Zr<=24;Zr+=8)qr<<=1,qr|=kr>>>Zr+Vr&1}for(var Vr=6;Vr>=0;Vr-=2){for(var Zr=1;Zr<=25;Zr+=8)Gr<<=1,Gr|=jr>>>Zr+Vr&1;for(var Zr=1;Zr<=25;Zr+=8)Gr<<=1,Gr|=kr>>>Zr+Vr&1}Br[Wr+0]=qr>>>0,Br[Wr+1]=Gr>>>0},utils$6.rip=function(kr,jr,Br,Wr){for(var qr=0,Gr=0,Vr=0;Vr<4;Vr++)for(var Zr=24;Zr>=0;Zr-=8)qr<<=1,qr|=jr>>>Zr+Vr&1,qr<<=1,qr|=kr>>>Zr+Vr&1;for(var Vr=4;Vr<8;Vr++)for(var Zr=24;Zr>=0;Zr-=8)Gr<<=1,Gr|=jr>>>Zr+Vr&1,Gr<<=1,Gr|=kr>>>Zr+Vr&1;Br[Wr+0]=qr>>>0,Br[Wr+1]=Gr>>>0},utils$6.pc1=function(kr,jr,Br,Wr){for(var qr=0,Gr=0,Vr=7;Vr>=5;Vr--){for(var Zr=0;Zr<=24;Zr+=8)qr<<=1,qr|=jr>>Zr+Vr&1;for(var Zr=0;Zr<=24;Zr+=8)qr<<=1,qr|=kr>>Zr+Vr&1}for(var Zr=0;Zr<=24;Zr+=8)qr<<=1,qr|=jr>>Zr+Vr&1;for(var Vr=1;Vr<=3;Vr++){for(var Zr=0;Zr<=24;Zr+=8)Gr<<=1,Gr|=jr>>Zr+Vr&1;for(var Zr=0;Zr<=24;Zr+=8)Gr<<=1,Gr|=kr>>Zr+Vr&1}for(var Zr=0;Zr<=24;Zr+=8)Gr<<=1,Gr|=kr>>Zr+Vr&1;Br[Wr+0]=qr>>>0,Br[Wr+1]=Gr>>>0},utils$6.r28shl=function(kr,jr){return kr<>>28-jr};var fr=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];utils$6.pc2=function(kr,jr,Br,Wr){for(var qr=0,Gr=0,Vr=fr.length>>>1,Zr=0;Zr>>fr[Zr]&1;for(var Zr=Vr;Zr>>fr[Zr]&1;Br[Wr+0]=qr>>>0,Br[Wr+1]=Gr>>>0},utils$6.expand=function(kr,jr,Br){var Wr=0,qr=0;Wr=(kr&1)<<5|kr>>>27;for(var Gr=23;Gr>=15;Gr-=4)Wr<<=6,Wr|=kr>>>Gr&63;for(var Gr=11;Gr>=3;Gr-=4)qr|=kr>>>Gr&63,qr<<=6;qr|=(kr&31)<<1|kr>>>31,jr[Br+0]=Wr>>>0,jr[Br+1]=qr>>>0};var br=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];utils$6.substitute=function(kr,jr){for(var Br=0,Wr=0;Wr<4;Wr++){var qr=kr>>>18-Wr*6&63,Gr=br[Wr*64+qr];Br<<=4,Br|=Gr}for(var Wr=0;Wr<4;Wr++){var qr=jr>>>18-Wr*6&63,Gr=br[4*64+Wr*64+qr];Br<<=4,Br|=Gr}return Br>>>0};var wr=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];return utils$6.permute=function(kr){for(var jr=0,Br=0;Br>>wr[Br]&1;return jr>>>0},utils$6.padSplit=function(kr,jr,Br){for(var Wr=kr.toString(2);Wr.length0;Br--)kr+=this._buffer(Er,kr),jr+=this._flushBuffer(Wr,jr);return kr+=this._buffer(Er,kr),Wr},br.prototype.final=function(Er){var kr;Er&&(kr=this.update(Er));var jr;return this.type==="encrypt"?jr=this._finalEncrypt():jr=this._finalDecrypt(),kr?kr.concat(jr):jr},br.prototype._pad=function(Er,kr){if(kr===0)return!1;for(;kr>>1];Vr=wr.r28shl(Vr,Qr),Zr=wr.r28shl(Zr,Qr),wr.pc2(Vr,Zr,qr.keys,Jr)}},jr.prototype._update=function(qr,Gr,Vr,Zr){var Jr=this._desState,Qr=wr.readUInt32BE(qr,Gr),_n=wr.readUInt32BE(qr,Gr+4);wr.ip(Qr,_n,Jr.tmp,0),Qr=Jr.tmp[0],_n=Jr.tmp[1],this.type==="encrypt"?this._encrypt(Jr,Qr,_n,Jr.tmp,0):this._decrypt(Jr,Qr,_n,Jr.tmp,0),Qr=Jr.tmp[0],_n=Jr.tmp[1],wr.writeUInt32BE(Vr,Qr,Zr),wr.writeUInt32BE(Vr,_n,Zr+4)},jr.prototype._pad=function(qr,Gr){if(this.padding===!1)return!1;for(var Vr=qr.length-Gr,Zr=Gr;Zr>>0,Qr=eo}wr.rip(_n,Qr,Zr,Jr)},jr.prototype._decrypt=function(qr,Gr,Vr,Zr,Jr){for(var Qr=Vr,_n=Gr,En=qr.keys.length-2;En>=0;En-=2){var Cn=qr.keys[En],In=qr.keys[En+1];wr.expand(Qr,qr.tmp,0),Cn^=qr.tmp[0],In^=qr.tmp[1];var An=wr.substitute(Cn,In),jn=wr.permute(An),eo=Qr;Qr=(_n^jn)>>>0,_n=eo}wr.rip(Qr,_n,Zr,Jr)},des}var cbc$1={},hasRequiredCbc$1;function requireCbc$1(){if(hasRequiredCbc$1)return cbc$1;hasRequiredCbc$1=1;var fr=requireMinimalisticAssert(),br=requireInherits_browser(),wr={};function Er(jr){fr.equal(jr.length,8,"Invalid IV length"),this.iv=new Array(8);for(var Br=0;Br>Wr%8,Er._prev=wr(Er._prev,jr?Vr:Zr);return Gr}function wr(Er,kr){var jr=Er.length,Br=-1,Wr=fr.allocUnsafe(Er.length);for(Er=fr.concat([Er,fr.from([kr])]);++Br>7;return Wr}return cfb1.encrypt=function(Er,kr,jr){for(var Br=kr.length,Wr=fr.allocUnsafe(Br),qr=-1;++qr>>24]^Qr[In>>>16&255]^_n[An>>>8&255]^En[jn&255]^qr[oo++],ro=Jr[In>>>24]^Qr[An>>>16&255]^_n[jn>>>8&255]^En[Cn&255]^qr[oo++],to=Jr[An>>>24]^Qr[jn>>>16&255]^_n[Cn>>>8&255]^En[In&255]^qr[oo++],_i=Jr[jn>>>24]^Qr[Cn>>>16&255]^_n[In>>>8&255]^En[An&255]^qr[oo++],Cn=eo,In=ro,An=to,jn=_i;return eo=(Vr[Cn>>>24]<<24|Vr[In>>>16&255]<<16|Vr[An>>>8&255]<<8|Vr[jn&255])^qr[oo++],ro=(Vr[In>>>24]<<24|Vr[An>>>16&255]<<16|Vr[jn>>>8&255]<<8|Vr[Cn&255])^qr[oo++],to=(Vr[An>>>24]<<24|Vr[jn>>>16&255]<<16|Vr[Cn>>>8&255]<<8|Vr[In&255])^qr[oo++],_i=(Vr[jn>>>24]<<24|Vr[Cn>>>16&255]<<16|Vr[In>>>8&255]<<8|Vr[An&255])^qr[oo++],eo=eo>>>0,ro=ro>>>0,to=to>>>0,_i=_i>>>0,[eo,ro,to,_i]}var kr=[0,1,2,4,8,16,32,64,128,27,54],jr=function(){for(var Wr=new Array(256),qr=0;qr<256;qr++)qr<128?Wr[qr]=qr<<1:Wr[qr]=qr<<1^283;for(var Gr=[],Vr=[],Zr=[[],[],[],[]],Jr=[[],[],[],[]],Qr=0,_n=0,En=0;En<256;++En){var Cn=_n^_n<<1^_n<<2^_n<<3^_n<<4;Cn=Cn>>>8^Cn&255^99,Gr[Qr]=Cn,Vr[Cn]=Qr;var In=Wr[Qr],An=Wr[In],jn=Wr[An],eo=Wr[Cn]*257^Cn*16843008;Zr[0][Qr]=eo<<24|eo>>>8,Zr[1][Qr]=eo<<16|eo>>>16,Zr[2][Qr]=eo<<8|eo>>>24,Zr[3][Qr]=eo,eo=jn*16843009^An*65537^In*257^Qr*16843008,Jr[0][Cn]=eo<<24|eo>>>8,Jr[1][Cn]=eo<<16|eo>>>16,Jr[2][Cn]=eo<<8|eo>>>24,Jr[3][Cn]=eo,Qr===0?Qr=_n=1:(Qr=In^Wr[Wr[Wr[jn^In]]],_n^=Wr[Wr[_n]])}return{SBOX:Gr,INV_SBOX:Vr,SUB_MIX:Zr,INV_SUB_MIX:Jr}}();function Br(Wr){this._key=br(Wr),this._reset()}return Br.blockSize=4*4,Br.keySize=256/8,Br.prototype.blockSize=Br.blockSize,Br.prototype.keySize=Br.keySize,Br.prototype._reset=function(){for(var Wr=this._key,qr=Wr.length,Gr=qr+6,Vr=(Gr+1)*4,Zr=[],Jr=0;Jr>>24,Qr=jr.SBOX[Qr>>>24]<<24|jr.SBOX[Qr>>>16&255]<<16|jr.SBOX[Qr>>>8&255]<<8|jr.SBOX[Qr&255],Qr^=kr[Jr/qr|0]<<24):qr>6&&Jr%qr===4&&(Qr=jr.SBOX[Qr>>>24]<<24|jr.SBOX[Qr>>>16&255]<<16|jr.SBOX[Qr>>>8&255]<<8|jr.SBOX[Qr&255]),Zr[Jr]=Zr[Jr-qr]^Qr}for(var _n=[],En=0;En>>24]]^jr.INV_SUB_MIX[1][jr.SBOX[In>>>16&255]]^jr.INV_SUB_MIX[2][jr.SBOX[In>>>8&255]]^jr.INV_SUB_MIX[3][jr.SBOX[In&255]]}this._nRounds=Gr,this._keySchedule=Zr,this._invKeySchedule=_n},Br.prototype.encryptBlockRaw=function(Wr){return Wr=br(Wr),Er(Wr,this._keySchedule,jr.SUB_MIX,jr.SBOX,this._nRounds)},Br.prototype.encryptBlock=function(Wr){var qr=this.encryptBlockRaw(Wr),Gr=fr.allocUnsafe(16);return Gr.writeUInt32BE(qr[0],0),Gr.writeUInt32BE(qr[1],4),Gr.writeUInt32BE(qr[2],8),Gr.writeUInt32BE(qr[3],12),Gr},Br.prototype.decryptBlock=function(Wr){Wr=br(Wr);var qr=Wr[1];Wr[1]=Wr[3],Wr[3]=qr;var Gr=Er(Wr,this._invKeySchedule,jr.INV_SUB_MIX,jr.INV_SBOX,this._nRounds),Vr=fr.allocUnsafe(16);return Vr.writeUInt32BE(Gr[0],0),Vr.writeUInt32BE(Gr[3],4),Vr.writeUInt32BE(Gr[2],8),Vr.writeUInt32BE(Gr[1],12),Vr},Br.prototype.scrub=function(){wr(this._keySchedule),wr(this._invKeySchedule),wr(this._key)},aes.AES=Br,aes}var ghash,hasRequiredGhash;function requireGhash(){if(hasRequiredGhash)return ghash;hasRequiredGhash=1;var fr=safeBufferExports.Buffer,br=fr.alloc(16,0);function wr(jr){return[jr.readUInt32BE(0),jr.readUInt32BE(4),jr.readUInt32BE(8),jr.readUInt32BE(12)]}function Er(jr){var Br=fr.allocUnsafe(16);return Br.writeUInt32BE(jr[0]>>>0,0),Br.writeUInt32BE(jr[1]>>>0,4),Br.writeUInt32BE(jr[2]>>>0,8),Br.writeUInt32BE(jr[3]>>>0,12),Br}function kr(jr){this.h=jr,this.state=fr.alloc(16,0),this.cache=fr.allocUnsafe(0)}return kr.prototype.ghash=function(jr){for(var Br=-1;++Br0;Wr--)jr[Wr]=jr[Wr]>>>1|(jr[Wr-1]&1)<<31;jr[0]=jr[0]>>>1,Gr&&(jr[0]=jr[0]^225<<24)}this.state=Er(Br)},kr.prototype.update=function(jr){this.cache=fr.concat([this.cache,jr]);for(var Br;this.cache.length>=16;)Br=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(Br)},kr.prototype.final=function(jr,Br){return this.cache.length&&this.ghash(fr.concat([this.cache,br],16)),this.ghash(Er([0,jr,0,Br])),this.state},ghash=kr,ghash}var authCipher,hasRequiredAuthCipher;function requireAuthCipher(){if(hasRequiredAuthCipher)return authCipher;hasRequiredAuthCipher=1;var fr=requireAes(),br=safeBufferExports.Buffer,wr=requireCipherBase(),Er=requireInherits_browser(),kr=requireGhash(),jr=requireBufferXor(),Br=requireIncr32();function Wr(Vr,Zr){var Jr=0;Vr.length!==Zr.length&&Jr++;for(var Qr=Math.min(Vr.length,Zr.length),_n=0;_n0||Br>0;){var Zr=new br;Zr.update(Vr),Zr.update(Er),kr&&Zr.update(kr),Vr=Zr.digest();var Jr=0;if(Wr>0){var Qr=qr.length-Wr;Jr=Math.min(Wr,Vr.length),Vr.copy(qr,Qr,0,Jr),Wr-=Jr}if(Jr0){var _n=Gr.length-Br,En=Math.min(Br,Vr.length-Jr);Vr.copy(Gr,_n,Jr,Jr+En),Br-=En}}return Vr.fill(0),{key:qr,iv:Gr}}return evp_bytestokey=wr,evp_bytestokey}var hasRequiredEncrypter;function requireEncrypter(){if(hasRequiredEncrypter)return encrypter;hasRequiredEncrypter=1;var fr=requireModes$1(),br=requireAuthCipher(),wr=safeBufferExports.Buffer,Er=requireStreamCipher(),kr=requireCipherBase(),jr=requireAes(),Br=requireEvp_bytestokey(),Wr=requireInherits_browser();function qr(Qr,_n,En){kr.call(this),this._cache=new Vr,this._cipher=new jr.AES(_n),this._prev=wr.from(En),this._mode=Qr,this._autopadding=!0}Wr(qr,kr),qr.prototype._update=function(Qr){this._cache.add(Qr);for(var _n,En,Cn=[];_n=this._cache.get();)En=this._mode.encrypt(this,_n),Cn.push(En);return wr.concat(Cn)};var Gr=wr.alloc(16,16);qr.prototype._final=function(){var Qr=this._cache.flush();if(this._autopadding)return Qr=this._mode.encrypt(this,Qr),this._cipher.scrub(),Qr;if(!Qr.equals(Gr))throw this._cipher.scrub(),new Error("data not multiple of block length")},qr.prototype.setAutoPadding=function(Qr){return this._autopadding=!!Qr,this};function Vr(){this.cache=wr.allocUnsafe(0)}Vr.prototype.add=function(Qr){this.cache=wr.concat([this.cache,Qr])},Vr.prototype.get=function(){if(this.cache.length>15){var Qr=this.cache.slice(0,16);return this.cache=this.cache.slice(16),Qr}return null},Vr.prototype.flush=function(){for(var Qr=16-this.cache.length,_n=wr.allocUnsafe(Qr),En=-1;++En16)return _n=this.cache.slice(0,16),this.cache=this.cache.slice(16),_n}else if(this.cache.length>=16)return _n=this.cache.slice(0,16),this.cache=this.cache.slice(16),_n;return null},Gr.prototype.flush=function(){if(this.cache.length)return this.cache};function Vr(Qr){var _n=Qr[15];if(_n<1||_n>16)throw new Error("unable to decrypt data");for(var En=-1;++En<_n;)if(Qr[En+(16-_n)]!==_n)throw new Error("unable to decrypt data");if(_n!==16)return Qr.slice(0,16-_n)}function Zr(Qr,_n,En){var Cn=wr[Qr.toLowerCase()];if(!Cn)throw new TypeError("invalid suite type");if(typeof En=="string"&&(En=br.from(En)),Cn.mode!=="GCM"&&En.length!==Cn.iv)throw new TypeError("invalid iv length "+En.length);if(typeof _n=="string"&&(_n=br.from(_n)),_n.length!==Cn.key/8)throw new TypeError("invalid key length "+_n.length);return Cn.type==="stream"?new Er(Cn.module,_n,En,!0):Cn.type==="auth"?new fr(Cn.module,_n,En,!0):new qr(Cn.module,_n,En)}function Jr(Qr,_n){var En=wr[Qr.toLowerCase()];if(!En)throw new TypeError("invalid suite type");var Cn=Br(_n,!1,En.key,En.iv);return Zr(Qr,Cn.key,Cn.iv)}return decrypter.createDecipher=Jr,decrypter.createDecipheriv=Zr,decrypter}var hasRequiredBrowser$6;function requireBrowser$6(){if(hasRequiredBrowser$6)return browser$a;hasRequiredBrowser$6=1;var fr=requireEncrypter(),br=requireDecrypter(),wr=require$$2$2;function Er(){return Object.keys(wr)}return browser$a.createCipher=browser$a.Cipher=fr.createCipher,browser$a.createCipheriv=browser$a.Cipheriv=fr.createCipheriv,browser$a.createDecipher=browser$a.Decipher=br.createDecipher,browser$a.createDecipheriv=browser$a.Decipheriv=br.createDecipheriv,browser$a.listCiphers=browser$a.getCiphers=Er,browser$a}var modes={},hasRequiredModes;function requireModes(){return hasRequiredModes||(hasRequiredModes=1,function(fr){fr["des-ecb"]={key:8,iv:0},fr["des-cbc"]=fr.des={key:8,iv:8},fr["des-ede3-cbc"]=fr.des3={key:24,iv:8},fr["des-ede3"]={key:24,iv:0},fr["des-ede-cbc"]={key:16,iv:8},fr["des-ede"]={key:16,iv:0}}(modes)),modes}var hasRequiredBrowser$5;function requireBrowser$5(){if(hasRequiredBrowser$5)return browser$b;hasRequiredBrowser$5=1;var fr=requireBrowserifyDes(),br=requireBrowser$6(),wr=requireModes$1(),Er=requireModes(),kr=requireEvp_bytestokey();function jr(Vr,Zr){Vr=Vr.toLowerCase();var Jr,Qr;if(wr[Vr])Jr=wr[Vr].key,Qr=wr[Vr].iv;else if(Er[Vr])Jr=Er[Vr].key*8,Qr=Er[Vr].iv;else throw new TypeError("invalid suite type");var _n=kr(Zr,!1,Jr,Qr);return Wr(Vr,_n.key,_n.iv)}function Br(Vr,Zr){Vr=Vr.toLowerCase();var Jr,Qr;if(wr[Vr])Jr=wr[Vr].key,Qr=wr[Vr].iv;else if(Er[Vr])Jr=Er[Vr].key*8,Qr=Er[Vr].iv;else throw new TypeError("invalid suite type");var _n=kr(Zr,!1,Jr,Qr);return qr(Vr,_n.key,_n.iv)}function Wr(Vr,Zr,Jr){if(Vr=Vr.toLowerCase(),wr[Vr])return br.createCipheriv(Vr,Zr,Jr);if(Er[Vr])return new fr({key:Zr,iv:Jr,mode:Vr});throw new TypeError("invalid suite type")}function qr(Vr,Zr,Jr){if(Vr=Vr.toLowerCase(),wr[Vr])return br.createDecipheriv(Vr,Zr,Jr);if(Er[Vr])return new fr({key:Zr,iv:Jr,mode:Vr,decrypt:!0});throw new TypeError("invalid suite type")}function Gr(){return Object.keys(Er).concat(br.getCiphers())}return browser$b.createCipher=browser$b.Cipher=jr,browser$b.createCipheriv=browser$b.Cipheriv=Wr,browser$b.createDecipher=browser$b.Decipher=Br,browser$b.createDecipheriv=browser$b.Decipheriv=qr,browser$b.listCiphers=browser$b.getCiphers=Gr,browser$b}var browser$9={},bn$6={exports:{}};bn$6.exports;var hasRequiredBn$2;function requireBn$2(){return hasRequiredBn$2||(hasRequiredBn$2=1,function(fr){(function(br,wr){function Er(so,no){if(!so)throw new Error(no||"Assertion failed")}function kr(so,no){so.super_=no;var Tn=function(){};Tn.prototype=no.prototype,so.prototype=new Tn,so.prototype.constructor=so}function jr(so,no,Tn){if(jr.isBN(so))return so;this.negative=0,this.words=null,this.length=0,this.red=null,so!==null&&((no==="le"||no==="be")&&(Tn=no,no=10),this._init(so||0,no||10,Tn||"be"))}typeof br=="object"?br.exports=jr:wr.BN=jr,jr.BN=jr,jr.wordSize=26;var Br;try{typeof window<"u"&&typeof window.Buffer<"u"?Br=window.Buffer:Br=require$$0$9.Buffer}catch{}jr.isBN=function(no){return no instanceof jr?!0:no!==null&&typeof no=="object"&&no.constructor.wordSize===jr.wordSize&&Array.isArray(no.words)},jr.max=function(no,Tn){return no.cmp(Tn)>0?no:Tn},jr.min=function(no,Tn){return no.cmp(Tn)<0?no:Tn},jr.prototype._init=function(no,Tn,Hr){if(typeof no=="number")return this._initNumber(no,Tn,Hr);if(typeof no=="object")return this._initArray(no,Tn,Hr);Tn==="hex"&&(Tn=16),Er(Tn===(Tn|0)&&Tn>=2&&Tn<=36),no=no.toString().replace(/\s+/g,"");var Xr=0;no[0]==="-"&&(Xr++,this.negative=1),Xr=0;Xr-=3)Rn=no[Xr]|no[Xr-1]<<8|no[Xr-2]<<16,this.words[Sn]|=Rn<>>26-Pn&67108863,Pn+=24,Pn>=26&&(Pn-=26,Sn++);else if(Hr==="le")for(Xr=0,Sn=0;Xr>>26-Pn&67108863,Pn+=24,Pn>=26&&(Pn-=26,Sn++);return this.strip()};function Wr(so,no){var Tn=so.charCodeAt(no);return Tn>=65&&Tn<=70?Tn-55:Tn>=97&&Tn<=102?Tn-87:Tn-48&15}function qr(so,no,Tn){var Hr=Wr(so,Tn);return Tn-1>=no&&(Hr|=Wr(so,Tn-1)<<4),Hr}jr.prototype._parseHex=function(no,Tn,Hr){this.length=Math.ceil((no.length-Tn)/6),this.words=new Array(this.length);for(var Xr=0;Xr=Tn;Xr-=2)Pn=qr(no,Tn,Xr)<=18?(Sn-=18,Rn+=1,this.words[Rn]|=Pn>>>26):Sn+=8;else{var On=no.length-Tn;for(Xr=On%2===0?Tn+1:Tn;Xr=18?(Sn-=18,Rn+=1,this.words[Rn]|=Pn>>>26):Sn+=8}this.strip()};function Gr(so,no,Tn,Hr){for(var Xr=0,Sn=Math.min(so.length,Tn),Rn=no;Rn=49?Xr+=Pn-49+10:Pn>=17?Xr+=Pn-17+10:Xr+=Pn}return Xr}jr.prototype._parseBase=function(no,Tn,Hr){this.words=[0],this.length=1;for(var Xr=0,Sn=1;Sn<=67108863;Sn*=Tn)Xr++;Xr--,Sn=Sn/Tn|0;for(var Rn=no.length-Hr,Pn=Rn%Xr,On=Math.min(Rn,Rn-Pn)+Hr,Zn=0,Nn=Hr;Nn1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},jr.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},jr.prototype.inspect=function(){return(this.red?""};var Vr=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Zr=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],Jr=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];jr.prototype.toString=function(no,Tn){no=no||10,Tn=Tn|0||1;var Hr;if(no===16||no==="hex"){Hr="";for(var Xr=0,Sn=0,Rn=0;Rn>>24-Xr&16777215,Xr+=2,Xr>=26&&(Xr-=26,Rn--),Sn!==0||Rn!==this.length-1?Hr=Vr[6-On.length]+On+Hr:Hr=On+Hr}for(Sn!==0&&(Hr=Sn.toString(16)+Hr);Hr.length%Tn!==0;)Hr="0"+Hr;return this.negative!==0&&(Hr="-"+Hr),Hr}if(no===(no|0)&&no>=2&&no<=36){var Zn=Zr[no],Nn=Jr[no];Hr="";var wn=this.clone();for(wn.negative=0;!wn.isZero();){var zn=wn.modn(Nn).toString(no);wn=wn.idivn(Nn),wn.isZero()?Hr=zn+Hr:Hr=Vr[Zn-zn.length]+zn+Hr}for(this.isZero()&&(Hr="0"+Hr);Hr.length%Tn!==0;)Hr="0"+Hr;return this.negative!==0&&(Hr="-"+Hr),Hr}Er(!1,"Base should be between 2 and 36")},jr.prototype.toNumber=function(){var no=this.words[0];return this.length===2?no+=this.words[1]*67108864:this.length===3&&this.words[2]===1?no+=4503599627370496+this.words[1]*67108864:this.length>2&&Er(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-no:no},jr.prototype.toJSON=function(){return this.toString(16)},jr.prototype.toBuffer=function(no,Tn){return Er(typeof Br<"u"),this.toArrayLike(Br,no,Tn)},jr.prototype.toArray=function(no,Tn){return this.toArrayLike(Array,no,Tn)},jr.prototype.toArrayLike=function(no,Tn,Hr){var Xr=this.byteLength(),Sn=Hr||Math.max(1,Xr);Er(Xr<=Sn,"byte array longer than desired length"),Er(Sn>0,"Requested array length <= 0"),this.strip();var Rn=Tn==="le",Pn=new no(Sn),On,Zn,Nn=this.clone();if(Rn){for(Zn=0;!Nn.isZero();Zn++)On=Nn.andln(255),Nn.iushrn(8),Pn[Zn]=On;for(;Zn=4096&&(Hr+=13,Tn>>>=13),Tn>=64&&(Hr+=7,Tn>>>=7),Tn>=8&&(Hr+=4,Tn>>>=4),Tn>=2&&(Hr+=2,Tn>>>=2),Hr+Tn},jr.prototype._zeroBits=function(no){if(no===0)return 26;var Tn=no,Hr=0;return Tn&8191||(Hr+=13,Tn>>>=13),Tn&127||(Hr+=7,Tn>>>=7),Tn&15||(Hr+=4,Tn>>>=4),Tn&3||(Hr+=2,Tn>>>=2),Tn&1||Hr++,Hr},jr.prototype.bitLength=function(){var no=this.words[this.length-1],Tn=this._countBits(no);return(this.length-1)*26+Tn};function Qr(so){for(var no=new Array(so.bitLength()),Tn=0;Tn>>Xr}return no}jr.prototype.zeroBits=function(){if(this.isZero())return 0;for(var no=0,Tn=0;Tnno.length?this.clone().ior(no):no.clone().ior(this)},jr.prototype.uor=function(no){return this.length>no.length?this.clone().iuor(no):no.clone().iuor(this)},jr.prototype.iuand=function(no){var Tn;this.length>no.length?Tn=no:Tn=this;for(var Hr=0;Hrno.length?this.clone().iand(no):no.clone().iand(this)},jr.prototype.uand=function(no){return this.length>no.length?this.clone().iuand(no):no.clone().iuand(this)},jr.prototype.iuxor=function(no){var Tn,Hr;this.length>no.length?(Tn=this,Hr=no):(Tn=no,Hr=this);for(var Xr=0;Xrno.length?this.clone().ixor(no):no.clone().ixor(this)},jr.prototype.uxor=function(no){return this.length>no.length?this.clone().iuxor(no):no.clone().iuxor(this)},jr.prototype.inotn=function(no){Er(typeof no=="number"&&no>=0);var Tn=Math.ceil(no/26)|0,Hr=no%26;this._expand(Tn),Hr>0&&Tn--;for(var Xr=0;Xr0&&(this.words[Xr]=~this.words[Xr]&67108863>>26-Hr),this.strip()},jr.prototype.notn=function(no){return this.clone().inotn(no)},jr.prototype.setn=function(no,Tn){Er(typeof no=="number"&&no>=0);var Hr=no/26|0,Xr=no%26;return this._expand(Hr+1),Tn?this.words[Hr]=this.words[Hr]|1<no.length?(Hr=this,Xr=no):(Hr=no,Xr=this);for(var Sn=0,Rn=0;Rn>>26;for(;Sn!==0&&Rn>>26;if(this.length=Hr.length,Sn!==0)this.words[this.length]=Sn,this.length++;else if(Hr!==this)for(;Rnno.length?this.clone().iadd(no):no.clone().iadd(this)},jr.prototype.isub=function(no){if(no.negative!==0){no.negative=0;var Tn=this.iadd(no);return no.negative=1,Tn._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(no),this.negative=1,this._normSign();var Hr=this.cmp(no);if(Hr===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Xr,Sn;Hr>0?(Xr=this,Sn=no):(Xr=no,Sn=this);for(var Rn=0,Pn=0;Pn>26,this.words[Pn]=Tn&67108863;for(;Rn!==0&&Pn>26,this.words[Pn]=Tn&67108863;if(Rn===0&&Pn>>26,wn=On&67108863,zn=Math.min(Zn,no.length-1),fo=Math.max(0,Zn-so.length+1);fo<=zn;fo++){var vo=Zn-fo|0;Xr=so.words[vo]|0,Sn=no.words[fo]|0,Rn=Xr*Sn+wn,Nn+=Rn/67108864|0,wn=Rn&67108863}Tn.words[Zn]=wn|0,On=Nn|0}return On!==0?Tn.words[Zn]=On|0:Tn.length--,Tn.strip()}var En=function(no,Tn,Hr){var Xr=no.words,Sn=Tn.words,Rn=Hr.words,Pn=0,On,Zn,Nn,wn=Xr[0]|0,zn=wn&8191,fo=wn>>>13,vo=Xr[1]|0,go=vo&8191,uo=vo>>>13,lo=Xr[2]|0,Eo=lo&8191,mo=lo>>>13,yo=Xr[3]|0,_o=yo&8191,Bo=yo>>>13,Lo=Xr[4]|0,Wo=Lo&8191,na=Lo>>>13,qo=Xr[5]|0,ga=qo&8191,wl=qo>>>13,No=Xr[6]|0,Fo=No&8191,Nl=No>>>13,Vo=Xr[7]|0,Uo=Vo&8191,Ml=Vo>>>13,$a=Xr[8]|0,Jo=$a&8191,Zl=$a>>>13,Cl=Xr[9]|0,ko=Cl&8191,wo=Cl>>>13,bo=Sn[0]|0,Io=bo&8191,Ho=bo>>>13,Do=Sn[1]|0,zo=Do&8191,nu=Do>>>13,Ll=Sn[2]|0,_l=Ll&8191,bu=Ll>>>13,xl=Sn[3]|0,Tl=xl&8191,du=xl>>>13,Bl=Sn[4]|0,Il=Bl&8191,Eu=Bl>>>13,Al=Sn[5]|0,Ol=Al&8191,Tu=Al>>>13,Ul=Sn[6]|0,Sl=Ul&8191,_u=Ul>>>13,So=Sn[7]|0,Co=So&8191,Ao=So>>>13,po=Sn[8]|0,Ro=po&8191,Xo=po>>>13,jo=Sn[9]|0,Ko=jo&8191,Wl=jo>>>13;Hr.negative=no.negative^Tn.negative,Hr.length=19,On=Math.imul(zn,Io),Zn=Math.imul(zn,Ho),Zn=Zn+Math.imul(fo,Io)|0,Nn=Math.imul(fo,Ho);var $l=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+($l>>>26)|0,$l&=67108863,On=Math.imul(go,Io),Zn=Math.imul(go,Ho),Zn=Zn+Math.imul(uo,Io)|0,Nn=Math.imul(uo,Ho),On=On+Math.imul(zn,zo)|0,Zn=Zn+Math.imul(zn,nu)|0,Zn=Zn+Math.imul(fo,zo)|0,Nn=Nn+Math.imul(fo,nu)|0;var El=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(El>>>26)|0,El&=67108863,On=Math.imul(Eo,Io),Zn=Math.imul(Eo,Ho),Zn=Zn+Math.imul(mo,Io)|0,Nn=Math.imul(mo,Ho),On=On+Math.imul(go,zo)|0,Zn=Zn+Math.imul(go,nu)|0,Zn=Zn+Math.imul(uo,zo)|0,Nn=Nn+Math.imul(uo,nu)|0,On=On+Math.imul(zn,_l)|0,Zn=Zn+Math.imul(zn,bu)|0,Zn=Zn+Math.imul(fo,_l)|0,Nn=Nn+Math.imul(fo,bu)|0;var Cu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,On=Math.imul(_o,Io),Zn=Math.imul(_o,Ho),Zn=Zn+Math.imul(Bo,Io)|0,Nn=Math.imul(Bo,Ho),On=On+Math.imul(Eo,zo)|0,Zn=Zn+Math.imul(Eo,nu)|0,Zn=Zn+Math.imul(mo,zo)|0,Nn=Nn+Math.imul(mo,nu)|0,On=On+Math.imul(go,_l)|0,Zn=Zn+Math.imul(go,bu)|0,Zn=Zn+Math.imul(uo,_l)|0,Nn=Nn+Math.imul(uo,bu)|0,On=On+Math.imul(zn,Tl)|0,Zn=Zn+Math.imul(zn,du)|0,Zn=Zn+Math.imul(fo,Tl)|0,Nn=Nn+Math.imul(fo,du)|0;var iu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(iu>>>26)|0,iu&=67108863,On=Math.imul(Wo,Io),Zn=Math.imul(Wo,Ho),Zn=Zn+Math.imul(na,Io)|0,Nn=Math.imul(na,Ho),On=On+Math.imul(_o,zo)|0,Zn=Zn+Math.imul(_o,nu)|0,Zn=Zn+Math.imul(Bo,zo)|0,Nn=Nn+Math.imul(Bo,nu)|0,On=On+Math.imul(Eo,_l)|0,Zn=Zn+Math.imul(Eo,bu)|0,Zn=Zn+Math.imul(mo,_l)|0,Nn=Nn+Math.imul(mo,bu)|0,On=On+Math.imul(go,Tl)|0,Zn=Zn+Math.imul(go,du)|0,Zn=Zn+Math.imul(uo,Tl)|0,Nn=Nn+Math.imul(uo,du)|0,On=On+Math.imul(zn,Il)|0,Zn=Zn+Math.imul(zn,Eu)|0,Zn=Zn+Math.imul(fo,Il)|0,Nn=Nn+Math.imul(fo,Eu)|0;var pu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(pu>>>26)|0,pu&=67108863,On=Math.imul(ga,Io),Zn=Math.imul(ga,Ho),Zn=Zn+Math.imul(wl,Io)|0,Nn=Math.imul(wl,Ho),On=On+Math.imul(Wo,zo)|0,Zn=Zn+Math.imul(Wo,nu)|0,Zn=Zn+Math.imul(na,zo)|0,Nn=Nn+Math.imul(na,nu)|0,On=On+Math.imul(_o,_l)|0,Zn=Zn+Math.imul(_o,bu)|0,Zn=Zn+Math.imul(Bo,_l)|0,Nn=Nn+Math.imul(Bo,bu)|0,On=On+Math.imul(Eo,Tl)|0,Zn=Zn+Math.imul(Eo,du)|0,Zn=Zn+Math.imul(mo,Tl)|0,Nn=Nn+Math.imul(mo,du)|0,On=On+Math.imul(go,Il)|0,Zn=Zn+Math.imul(go,Eu)|0,Zn=Zn+Math.imul(uo,Il)|0,Nn=Nn+Math.imul(uo,Eu)|0,On=On+Math.imul(zn,Ol)|0,Zn=Zn+Math.imul(zn,Tu)|0,Zn=Zn+Math.imul(fo,Ol)|0,Nn=Nn+Math.imul(fo,Tu)|0;var yu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(yu>>>26)|0,yu&=67108863,On=Math.imul(Fo,Io),Zn=Math.imul(Fo,Ho),Zn=Zn+Math.imul(Nl,Io)|0,Nn=Math.imul(Nl,Ho),On=On+Math.imul(ga,zo)|0,Zn=Zn+Math.imul(ga,nu)|0,Zn=Zn+Math.imul(wl,zo)|0,Nn=Nn+Math.imul(wl,nu)|0,On=On+Math.imul(Wo,_l)|0,Zn=Zn+Math.imul(Wo,bu)|0,Zn=Zn+Math.imul(na,_l)|0,Nn=Nn+Math.imul(na,bu)|0,On=On+Math.imul(_o,Tl)|0,Zn=Zn+Math.imul(_o,du)|0,Zn=Zn+Math.imul(Bo,Tl)|0,Nn=Nn+Math.imul(Bo,du)|0,On=On+Math.imul(Eo,Il)|0,Zn=Zn+Math.imul(Eo,Eu)|0,Zn=Zn+Math.imul(mo,Il)|0,Nn=Nn+Math.imul(mo,Eu)|0,On=On+Math.imul(go,Ol)|0,Zn=Zn+Math.imul(go,Tu)|0,Zn=Zn+Math.imul(uo,Ol)|0,Nn=Nn+Math.imul(uo,Tu)|0,On=On+Math.imul(zn,Sl)|0,Zn=Zn+Math.imul(zn,_u)|0,Zn=Zn+Math.imul(fo,Sl)|0,Nn=Nn+Math.imul(fo,_u)|0;var hu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(hu>>>26)|0,hu&=67108863,On=Math.imul(Uo,Io),Zn=Math.imul(Uo,Ho),Zn=Zn+Math.imul(Ml,Io)|0,Nn=Math.imul(Ml,Ho),On=On+Math.imul(Fo,zo)|0,Zn=Zn+Math.imul(Fo,nu)|0,Zn=Zn+Math.imul(Nl,zo)|0,Nn=Nn+Math.imul(Nl,nu)|0,On=On+Math.imul(ga,_l)|0,Zn=Zn+Math.imul(ga,bu)|0,Zn=Zn+Math.imul(wl,_l)|0,Nn=Nn+Math.imul(wl,bu)|0,On=On+Math.imul(Wo,Tl)|0,Zn=Zn+Math.imul(Wo,du)|0,Zn=Zn+Math.imul(na,Tl)|0,Nn=Nn+Math.imul(na,du)|0,On=On+Math.imul(_o,Il)|0,Zn=Zn+Math.imul(_o,Eu)|0,Zn=Zn+Math.imul(Bo,Il)|0,Nn=Nn+Math.imul(Bo,Eu)|0,On=On+Math.imul(Eo,Ol)|0,Zn=Zn+Math.imul(Eo,Tu)|0,Zn=Zn+Math.imul(mo,Ol)|0,Nn=Nn+Math.imul(mo,Tu)|0,On=On+Math.imul(go,Sl)|0,Zn=Zn+Math.imul(go,_u)|0,Zn=Zn+Math.imul(uo,Sl)|0,Nn=Nn+Math.imul(uo,_u)|0,On=On+Math.imul(zn,Co)|0,Zn=Zn+Math.imul(zn,Ao)|0,Zn=Zn+Math.imul(fo,Co)|0,Nn=Nn+Math.imul(fo,Ao)|0;var mu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(mu>>>26)|0,mu&=67108863,On=Math.imul(Jo,Io),Zn=Math.imul(Jo,Ho),Zn=Zn+Math.imul(Zl,Io)|0,Nn=Math.imul(Zl,Ho),On=On+Math.imul(Uo,zo)|0,Zn=Zn+Math.imul(Uo,nu)|0,Zn=Zn+Math.imul(Ml,zo)|0,Nn=Nn+Math.imul(Ml,nu)|0,On=On+Math.imul(Fo,_l)|0,Zn=Zn+Math.imul(Fo,bu)|0,Zn=Zn+Math.imul(Nl,_l)|0,Nn=Nn+Math.imul(Nl,bu)|0,On=On+Math.imul(ga,Tl)|0,Zn=Zn+Math.imul(ga,du)|0,Zn=Zn+Math.imul(wl,Tl)|0,Nn=Nn+Math.imul(wl,du)|0,On=On+Math.imul(Wo,Il)|0,Zn=Zn+Math.imul(Wo,Eu)|0,Zn=Zn+Math.imul(na,Il)|0,Nn=Nn+Math.imul(na,Eu)|0,On=On+Math.imul(_o,Ol)|0,Zn=Zn+Math.imul(_o,Tu)|0,Zn=Zn+Math.imul(Bo,Ol)|0,Nn=Nn+Math.imul(Bo,Tu)|0,On=On+Math.imul(Eo,Sl)|0,Zn=Zn+Math.imul(Eo,_u)|0,Zn=Zn+Math.imul(mo,Sl)|0,Nn=Nn+Math.imul(mo,_u)|0,On=On+Math.imul(go,Co)|0,Zn=Zn+Math.imul(go,Ao)|0,Zn=Zn+Math.imul(uo,Co)|0,Nn=Nn+Math.imul(uo,Ao)|0,On=On+Math.imul(zn,Ro)|0,Zn=Zn+Math.imul(zn,Xo)|0,Zn=Zn+Math.imul(fo,Ro)|0,Nn=Nn+Math.imul(fo,Xo)|0;var vu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(vu>>>26)|0,vu&=67108863,On=Math.imul(ko,Io),Zn=Math.imul(ko,Ho),Zn=Zn+Math.imul(wo,Io)|0,Nn=Math.imul(wo,Ho),On=On+Math.imul(Jo,zo)|0,Zn=Zn+Math.imul(Jo,nu)|0,Zn=Zn+Math.imul(Zl,zo)|0,Nn=Nn+Math.imul(Zl,nu)|0,On=On+Math.imul(Uo,_l)|0,Zn=Zn+Math.imul(Uo,bu)|0,Zn=Zn+Math.imul(Ml,_l)|0,Nn=Nn+Math.imul(Ml,bu)|0,On=On+Math.imul(Fo,Tl)|0,Zn=Zn+Math.imul(Fo,du)|0,Zn=Zn+Math.imul(Nl,Tl)|0,Nn=Nn+Math.imul(Nl,du)|0,On=On+Math.imul(ga,Il)|0,Zn=Zn+Math.imul(ga,Eu)|0,Zn=Zn+Math.imul(wl,Il)|0,Nn=Nn+Math.imul(wl,Eu)|0,On=On+Math.imul(Wo,Ol)|0,Zn=Zn+Math.imul(Wo,Tu)|0,Zn=Zn+Math.imul(na,Ol)|0,Nn=Nn+Math.imul(na,Tu)|0,On=On+Math.imul(_o,Sl)|0,Zn=Zn+Math.imul(_o,_u)|0,Zn=Zn+Math.imul(Bo,Sl)|0,Nn=Nn+Math.imul(Bo,_u)|0,On=On+Math.imul(Eo,Co)|0,Zn=Zn+Math.imul(Eo,Ao)|0,Zn=Zn+Math.imul(mo,Co)|0,Nn=Nn+Math.imul(mo,Ao)|0,On=On+Math.imul(go,Ro)|0,Zn=Zn+Math.imul(go,Xo)|0,Zn=Zn+Math.imul(uo,Ro)|0,Nn=Nn+Math.imul(uo,Xo)|0,On=On+Math.imul(zn,Ko)|0,Zn=Zn+Math.imul(zn,Wl)|0,Zn=Zn+Math.imul(fo,Ko)|0,Nn=Nn+Math.imul(fo,Wl)|0;var fu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(fu>>>26)|0,fu&=67108863,On=Math.imul(ko,zo),Zn=Math.imul(ko,nu),Zn=Zn+Math.imul(wo,zo)|0,Nn=Math.imul(wo,nu),On=On+Math.imul(Jo,_l)|0,Zn=Zn+Math.imul(Jo,bu)|0,Zn=Zn+Math.imul(Zl,_l)|0,Nn=Nn+Math.imul(Zl,bu)|0,On=On+Math.imul(Uo,Tl)|0,Zn=Zn+Math.imul(Uo,du)|0,Zn=Zn+Math.imul(Ml,Tl)|0,Nn=Nn+Math.imul(Ml,du)|0,On=On+Math.imul(Fo,Il)|0,Zn=Zn+Math.imul(Fo,Eu)|0,Zn=Zn+Math.imul(Nl,Il)|0,Nn=Nn+Math.imul(Nl,Eu)|0,On=On+Math.imul(ga,Ol)|0,Zn=Zn+Math.imul(ga,Tu)|0,Zn=Zn+Math.imul(wl,Ol)|0,Nn=Nn+Math.imul(wl,Tu)|0,On=On+Math.imul(Wo,Sl)|0,Zn=Zn+Math.imul(Wo,_u)|0,Zn=Zn+Math.imul(na,Sl)|0,Nn=Nn+Math.imul(na,_u)|0,On=On+Math.imul(_o,Co)|0,Zn=Zn+Math.imul(_o,Ao)|0,Zn=Zn+Math.imul(Bo,Co)|0,Nn=Nn+Math.imul(Bo,Ao)|0,On=On+Math.imul(Eo,Ro)|0,Zn=Zn+Math.imul(Eo,Xo)|0,Zn=Zn+Math.imul(mo,Ro)|0,Nn=Nn+Math.imul(mo,Xo)|0,On=On+Math.imul(go,Ko)|0,Zn=Zn+Math.imul(go,Wl)|0,Zn=Zn+Math.imul(uo,Ko)|0,Nn=Nn+Math.imul(uo,Wl)|0;var gu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(gu>>>26)|0,gu&=67108863,On=Math.imul(ko,_l),Zn=Math.imul(ko,bu),Zn=Zn+Math.imul(wo,_l)|0,Nn=Math.imul(wo,bu),On=On+Math.imul(Jo,Tl)|0,Zn=Zn+Math.imul(Jo,du)|0,Zn=Zn+Math.imul(Zl,Tl)|0,Nn=Nn+Math.imul(Zl,du)|0,On=On+Math.imul(Uo,Il)|0,Zn=Zn+Math.imul(Uo,Eu)|0,Zn=Zn+Math.imul(Ml,Il)|0,Nn=Nn+Math.imul(Ml,Eu)|0,On=On+Math.imul(Fo,Ol)|0,Zn=Zn+Math.imul(Fo,Tu)|0,Zn=Zn+Math.imul(Nl,Ol)|0,Nn=Nn+Math.imul(Nl,Tu)|0,On=On+Math.imul(ga,Sl)|0,Zn=Zn+Math.imul(ga,_u)|0,Zn=Zn+Math.imul(wl,Sl)|0,Nn=Nn+Math.imul(wl,_u)|0,On=On+Math.imul(Wo,Co)|0,Zn=Zn+Math.imul(Wo,Ao)|0,Zn=Zn+Math.imul(na,Co)|0,Nn=Nn+Math.imul(na,Ao)|0,On=On+Math.imul(_o,Ro)|0,Zn=Zn+Math.imul(_o,Xo)|0,Zn=Zn+Math.imul(Bo,Ro)|0,Nn=Nn+Math.imul(Bo,Xo)|0,On=On+Math.imul(Eo,Ko)|0,Zn=Zn+Math.imul(Eo,Wl)|0,Zn=Zn+Math.imul(mo,Ko)|0,Nn=Nn+Math.imul(mo,Wl)|0;var ou=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(ou>>>26)|0,ou&=67108863,On=Math.imul(ko,Tl),Zn=Math.imul(ko,du),Zn=Zn+Math.imul(wo,Tl)|0,Nn=Math.imul(wo,du),On=On+Math.imul(Jo,Il)|0,Zn=Zn+Math.imul(Jo,Eu)|0,Zn=Zn+Math.imul(Zl,Il)|0,Nn=Nn+Math.imul(Zl,Eu)|0,On=On+Math.imul(Uo,Ol)|0,Zn=Zn+Math.imul(Uo,Tu)|0,Zn=Zn+Math.imul(Ml,Ol)|0,Nn=Nn+Math.imul(Ml,Tu)|0,On=On+Math.imul(Fo,Sl)|0,Zn=Zn+Math.imul(Fo,_u)|0,Zn=Zn+Math.imul(Nl,Sl)|0,Nn=Nn+Math.imul(Nl,_u)|0,On=On+Math.imul(ga,Co)|0,Zn=Zn+Math.imul(ga,Ao)|0,Zn=Zn+Math.imul(wl,Co)|0,Nn=Nn+Math.imul(wl,Ao)|0,On=On+Math.imul(Wo,Ro)|0,Zn=Zn+Math.imul(Wo,Xo)|0,Zn=Zn+Math.imul(na,Ro)|0,Nn=Nn+Math.imul(na,Xo)|0,On=On+Math.imul(_o,Ko)|0,Zn=Zn+Math.imul(_o,Wl)|0,Zn=Zn+Math.imul(Bo,Ko)|0,Nn=Nn+Math.imul(Bo,Wl)|0;var su=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(su>>>26)|0,su&=67108863,On=Math.imul(ko,Il),Zn=Math.imul(ko,Eu),Zn=Zn+Math.imul(wo,Il)|0,Nn=Math.imul(wo,Eu),On=On+Math.imul(Jo,Ol)|0,Zn=Zn+Math.imul(Jo,Tu)|0,Zn=Zn+Math.imul(Zl,Ol)|0,Nn=Nn+Math.imul(Zl,Tu)|0,On=On+Math.imul(Uo,Sl)|0,Zn=Zn+Math.imul(Uo,_u)|0,Zn=Zn+Math.imul(Ml,Sl)|0,Nn=Nn+Math.imul(Ml,_u)|0,On=On+Math.imul(Fo,Co)|0,Zn=Zn+Math.imul(Fo,Ao)|0,Zn=Zn+Math.imul(Nl,Co)|0,Nn=Nn+Math.imul(Nl,Ao)|0,On=On+Math.imul(ga,Ro)|0,Zn=Zn+Math.imul(ga,Xo)|0,Zn=Zn+Math.imul(wl,Ro)|0,Nn=Nn+Math.imul(wl,Xo)|0,On=On+Math.imul(Wo,Ko)|0,Zn=Zn+Math.imul(Wo,Wl)|0,Zn=Zn+Math.imul(na,Ko)|0,Nn=Nn+Math.imul(na,Wl)|0;var tu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(tu>>>26)|0,tu&=67108863,On=Math.imul(ko,Ol),Zn=Math.imul(ko,Tu),Zn=Zn+Math.imul(wo,Ol)|0,Nn=Math.imul(wo,Tu),On=On+Math.imul(Jo,Sl)|0,Zn=Zn+Math.imul(Jo,_u)|0,Zn=Zn+Math.imul(Zl,Sl)|0,Nn=Nn+Math.imul(Zl,_u)|0,On=On+Math.imul(Uo,Co)|0,Zn=Zn+Math.imul(Uo,Ao)|0,Zn=Zn+Math.imul(Ml,Co)|0,Nn=Nn+Math.imul(Ml,Ao)|0,On=On+Math.imul(Fo,Ro)|0,Zn=Zn+Math.imul(Fo,Xo)|0,Zn=Zn+Math.imul(Nl,Ro)|0,Nn=Nn+Math.imul(Nl,Xo)|0,On=On+Math.imul(ga,Ko)|0,Zn=Zn+Math.imul(ga,Wl)|0,Zn=Zn+Math.imul(wl,Ko)|0,Nn=Nn+Math.imul(wl,Wl)|0;var zl=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(zl>>>26)|0,zl&=67108863,On=Math.imul(ko,Sl),Zn=Math.imul(ko,_u),Zn=Zn+Math.imul(wo,Sl)|0,Nn=Math.imul(wo,_u),On=On+Math.imul(Jo,Co)|0,Zn=Zn+Math.imul(Jo,Ao)|0,Zn=Zn+Math.imul(Zl,Co)|0,Nn=Nn+Math.imul(Zl,Ao)|0,On=On+Math.imul(Uo,Ro)|0,Zn=Zn+Math.imul(Uo,Xo)|0,Zn=Zn+Math.imul(Ml,Ro)|0,Nn=Nn+Math.imul(Ml,Xo)|0,On=On+Math.imul(Fo,Ko)|0,Zn=Zn+Math.imul(Fo,Wl)|0,Zn=Zn+Math.imul(Nl,Ko)|0,Nn=Nn+Math.imul(Nl,Wl)|0;var Gl=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(Gl>>>26)|0,Gl&=67108863,On=Math.imul(ko,Co),Zn=Math.imul(ko,Ao),Zn=Zn+Math.imul(wo,Co)|0,Nn=Math.imul(wo,Ao),On=On+Math.imul(Jo,Ro)|0,Zn=Zn+Math.imul(Jo,Xo)|0,Zn=Zn+Math.imul(Zl,Ro)|0,Nn=Nn+Math.imul(Zl,Xo)|0,On=On+Math.imul(Uo,Ko)|0,Zn=Zn+Math.imul(Uo,Wl)|0,Zn=Zn+Math.imul(Ml,Ko)|0,Nn=Nn+Math.imul(Ml,Wl)|0;var Jl=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(Jl>>>26)|0,Jl&=67108863,On=Math.imul(ko,Ro),Zn=Math.imul(ko,Xo),Zn=Zn+Math.imul(wo,Ro)|0,Nn=Math.imul(wo,Xo),On=On+Math.imul(Jo,Ko)|0,Zn=Zn+Math.imul(Jo,Wl)|0,Zn=Zn+Math.imul(Zl,Ko)|0,Nn=Nn+Math.imul(Zl,Wl)|0;var Pl=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(Pl>>>26)|0,Pl&=67108863,On=Math.imul(ko,Ko),Zn=Math.imul(ko,Wl),Zn=Zn+Math.imul(wo,Ko)|0,Nn=Math.imul(wo,Wl);var Fl=(Pn+On|0)+((Zn&8191)<<13)|0;return Pn=(Nn+(Zn>>>13)|0)+(Fl>>>26)|0,Fl&=67108863,Rn[0]=$l,Rn[1]=El,Rn[2]=Cu,Rn[3]=iu,Rn[4]=pu,Rn[5]=yu,Rn[6]=hu,Rn[7]=mu,Rn[8]=vu,Rn[9]=fu,Rn[10]=gu,Rn[11]=ou,Rn[12]=su,Rn[13]=tu,Rn[14]=zl,Rn[15]=Gl,Rn[16]=Jl,Rn[17]=Pl,Rn[18]=Fl,Pn!==0&&(Rn[19]=Pn,Hr.length++),Hr};Math.imul||(En=_n);function Cn(so,no,Tn){Tn.negative=no.negative^so.negative,Tn.length=so.length+no.length;for(var Hr=0,Xr=0,Sn=0;Sn>>26)|0,Xr+=Rn>>>26,Rn&=67108863}Tn.words[Sn]=Pn,Hr=Rn,Rn=Xr}return Hr!==0?Tn.words[Sn]=Hr:Tn.length--,Tn.strip()}function In(so,no,Tn){var Hr=new An;return Hr.mulp(so,no,Tn)}jr.prototype.mulTo=function(no,Tn){var Hr,Xr=this.length+no.length;return this.length===10&&no.length===10?Hr=En(this,no,Tn):Xr<63?Hr=_n(this,no,Tn):Xr<1024?Hr=Cn(this,no,Tn):Hr=In(this,no,Tn),Hr};function An(so,no){this.x=so,this.y=no}An.prototype.makeRBT=function(no){for(var Tn=new Array(no),Hr=jr.prototype._countBits(no)-1,Xr=0;Xr>=1;return Xr},An.prototype.permute=function(no,Tn,Hr,Xr,Sn,Rn){for(var Pn=0;Pn>>1)Sn++;return 1<>>13,Hr[2*Rn+1]=Sn&8191,Sn=Sn>>>13;for(Rn=2*Tn;Rn>=26,Tn+=Xr/67108864|0,Tn+=Sn>>>26,this.words[Hr]=Sn&67108863}return Tn!==0&&(this.words[Hr]=Tn,this.length++),this},jr.prototype.muln=function(no){return this.clone().imuln(no)},jr.prototype.sqr=function(){return this.mul(this)},jr.prototype.isqr=function(){return this.imul(this.clone())},jr.prototype.pow=function(no){var Tn=Qr(no);if(Tn.length===0)return new jr(1);for(var Hr=this,Xr=0;Xr=0);var Tn=no%26,Hr=(no-Tn)/26,Xr=67108863>>>26-Tn<<26-Tn,Sn;if(Tn!==0){var Rn=0;for(Sn=0;Sn>>26-Tn}Rn&&(this.words[Sn]=Rn,this.length++)}if(Hr!==0){for(Sn=this.length-1;Sn>=0;Sn--)this.words[Sn+Hr]=this.words[Sn];for(Sn=0;Sn=0);var Xr;Tn?Xr=(Tn-Tn%26)/26:Xr=0;var Sn=no%26,Rn=Math.min((no-Sn)/26,this.length),Pn=67108863^67108863>>>Sn<Rn)for(this.length-=Rn,Zn=0;Zn=0&&(Nn!==0||Zn>=Xr);Zn--){var wn=this.words[Zn]|0;this.words[Zn]=Nn<<26-Sn|wn>>>Sn,Nn=wn&Pn}return On&&Nn!==0&&(On.words[On.length++]=Nn),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},jr.prototype.ishrn=function(no,Tn,Hr){return Er(this.negative===0),this.iushrn(no,Tn,Hr)},jr.prototype.shln=function(no){return this.clone().ishln(no)},jr.prototype.ushln=function(no){return this.clone().iushln(no)},jr.prototype.shrn=function(no){return this.clone().ishrn(no)},jr.prototype.ushrn=function(no){return this.clone().iushrn(no)},jr.prototype.testn=function(no){Er(typeof no=="number"&&no>=0);var Tn=no%26,Hr=(no-Tn)/26,Xr=1<=0);var Tn=no%26,Hr=(no-Tn)/26;if(Er(this.negative===0,"imaskn works only with positive numbers"),this.length<=Hr)return this;if(Tn!==0&&Hr++,this.length=Math.min(Hr,this.length),Tn!==0){var Xr=67108863^67108863>>>Tn<=67108864;Tn++)this.words[Tn]-=67108864,Tn===this.length-1?this.words[Tn+1]=1:this.words[Tn+1]++;return this.length=Math.max(this.length,Tn+1),this},jr.prototype.isubn=function(no){if(Er(typeof no=="number"),Er(no<67108864),no<0)return this.iaddn(-no);if(this.negative!==0)return this.negative=0,this.iaddn(no),this.negative=1,this;if(this.words[0]-=no,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Tn=0;Tn>26)-(On/67108864|0),this.words[Sn+Hr]=Rn&67108863}for(;Sn>26,this.words[Sn+Hr]=Rn&67108863;if(Pn===0)return this.strip();for(Er(Pn===-1),Pn=0,Sn=0;Sn>26,this.words[Sn]=Rn&67108863;return this.negative=1,this.strip()},jr.prototype._wordDiv=function(no,Tn){var Hr=this.length-no.length,Xr=this.clone(),Sn=no,Rn=Sn.words[Sn.length-1]|0,Pn=this._countBits(Rn);Hr=26-Pn,Hr!==0&&(Sn=Sn.ushln(Hr),Xr.iushln(Hr),Rn=Sn.words[Sn.length-1]|0);var On=Xr.length-Sn.length,Zn;if(Tn!=="mod"){Zn=new jr(null),Zn.length=On+1,Zn.words=new Array(Zn.length);for(var Nn=0;Nn=0;zn--){var fo=(Xr.words[Sn.length+zn]|0)*67108864+(Xr.words[Sn.length+zn-1]|0);for(fo=Math.min(fo/Rn|0,67108863),Xr._ishlnsubmul(Sn,fo,zn);Xr.negative!==0;)fo--,Xr.negative=0,Xr._ishlnsubmul(Sn,1,zn),Xr.isZero()||(Xr.negative^=1);Zn&&(Zn.words[zn]=fo)}return Zn&&Zn.strip(),Xr.strip(),Tn!=="div"&&Hr!==0&&Xr.iushrn(Hr),{div:Zn||null,mod:Xr}},jr.prototype.divmod=function(no,Tn,Hr){if(Er(!no.isZero()),this.isZero())return{div:new jr(0),mod:new jr(0)};var Xr,Sn,Rn;return this.negative!==0&&no.negative===0?(Rn=this.neg().divmod(no,Tn),Tn!=="mod"&&(Xr=Rn.div.neg()),Tn!=="div"&&(Sn=Rn.mod.neg(),Hr&&Sn.negative!==0&&Sn.iadd(no)),{div:Xr,mod:Sn}):this.negative===0&&no.negative!==0?(Rn=this.divmod(no.neg(),Tn),Tn!=="mod"&&(Xr=Rn.div.neg()),{div:Xr,mod:Rn.mod}):this.negative&no.negative?(Rn=this.neg().divmod(no.neg(),Tn),Tn!=="div"&&(Sn=Rn.mod.neg(),Hr&&Sn.negative!==0&&Sn.isub(no)),{div:Rn.div,mod:Sn}):no.length>this.length||this.cmp(no)<0?{div:new jr(0),mod:this}:no.length===1?Tn==="div"?{div:this.divn(no.words[0]),mod:null}:Tn==="mod"?{div:null,mod:new jr(this.modn(no.words[0]))}:{div:this.divn(no.words[0]),mod:new jr(this.modn(no.words[0]))}:this._wordDiv(no,Tn)},jr.prototype.div=function(no){return this.divmod(no,"div",!1).div},jr.prototype.mod=function(no){return this.divmod(no,"mod",!1).mod},jr.prototype.umod=function(no){return this.divmod(no,"mod",!0).mod},jr.prototype.divRound=function(no){var Tn=this.divmod(no);if(Tn.mod.isZero())return Tn.div;var Hr=Tn.div.negative!==0?Tn.mod.isub(no):Tn.mod,Xr=no.ushrn(1),Sn=no.andln(1),Rn=Hr.cmp(Xr);return Rn<0||Sn===1&&Rn===0?Tn.div:Tn.div.negative!==0?Tn.div.isubn(1):Tn.div.iaddn(1)},jr.prototype.modn=function(no){Er(no<=67108863);for(var Tn=(1<<26)%no,Hr=0,Xr=this.length-1;Xr>=0;Xr--)Hr=(Tn*Hr+(this.words[Xr]|0))%no;return Hr},jr.prototype.idivn=function(no){Er(no<=67108863);for(var Tn=0,Hr=this.length-1;Hr>=0;Hr--){var Xr=(this.words[Hr]|0)+Tn*67108864;this.words[Hr]=Xr/no|0,Tn=Xr%no}return this.strip()},jr.prototype.divn=function(no){return this.clone().idivn(no)},jr.prototype.egcd=function(no){Er(no.negative===0),Er(!no.isZero());var Tn=this,Hr=no.clone();Tn.negative!==0?Tn=Tn.umod(no):Tn=Tn.clone();for(var Xr=new jr(1),Sn=new jr(0),Rn=new jr(0),Pn=new jr(1),On=0;Tn.isEven()&&Hr.isEven();)Tn.iushrn(1),Hr.iushrn(1),++On;for(var Zn=Hr.clone(),Nn=Tn.clone();!Tn.isZero();){for(var wn=0,zn=1;!(Tn.words[0]&zn)&&wn<26;++wn,zn<<=1);if(wn>0)for(Tn.iushrn(wn);wn-- >0;)(Xr.isOdd()||Sn.isOdd())&&(Xr.iadd(Zn),Sn.isub(Nn)),Xr.iushrn(1),Sn.iushrn(1);for(var fo=0,vo=1;!(Hr.words[0]&vo)&&fo<26;++fo,vo<<=1);if(fo>0)for(Hr.iushrn(fo);fo-- >0;)(Rn.isOdd()||Pn.isOdd())&&(Rn.iadd(Zn),Pn.isub(Nn)),Rn.iushrn(1),Pn.iushrn(1);Tn.cmp(Hr)>=0?(Tn.isub(Hr),Xr.isub(Rn),Sn.isub(Pn)):(Hr.isub(Tn),Rn.isub(Xr),Pn.isub(Sn))}return{a:Rn,b:Pn,gcd:Hr.iushln(On)}},jr.prototype._invmp=function(no){Er(no.negative===0),Er(!no.isZero());var Tn=this,Hr=no.clone();Tn.negative!==0?Tn=Tn.umod(no):Tn=Tn.clone();for(var Xr=new jr(1),Sn=new jr(0),Rn=Hr.clone();Tn.cmpn(1)>0&&Hr.cmpn(1)>0;){for(var Pn=0,On=1;!(Tn.words[0]&On)&&Pn<26;++Pn,On<<=1);if(Pn>0)for(Tn.iushrn(Pn);Pn-- >0;)Xr.isOdd()&&Xr.iadd(Rn),Xr.iushrn(1);for(var Zn=0,Nn=1;!(Hr.words[0]&Nn)&&Zn<26;++Zn,Nn<<=1);if(Zn>0)for(Hr.iushrn(Zn);Zn-- >0;)Sn.isOdd()&&Sn.iadd(Rn),Sn.iushrn(1);Tn.cmp(Hr)>=0?(Tn.isub(Hr),Xr.isub(Sn)):(Hr.isub(Tn),Sn.isub(Xr))}var wn;return Tn.cmpn(1)===0?wn=Xr:wn=Sn,wn.cmpn(0)<0&&wn.iadd(no),wn},jr.prototype.gcd=function(no){if(this.isZero())return no.abs();if(no.isZero())return this.abs();var Tn=this.clone(),Hr=no.clone();Tn.negative=0,Hr.negative=0;for(var Xr=0;Tn.isEven()&&Hr.isEven();Xr++)Tn.iushrn(1),Hr.iushrn(1);do{for(;Tn.isEven();)Tn.iushrn(1);for(;Hr.isEven();)Hr.iushrn(1);var Sn=Tn.cmp(Hr);if(Sn<0){var Rn=Tn;Tn=Hr,Hr=Rn}else if(Sn===0||Hr.cmpn(1)===0)break;Tn.isub(Hr)}while(!0);return Hr.iushln(Xr)},jr.prototype.invm=function(no){return this.egcd(no).a.umod(no)},jr.prototype.isEven=function(){return(this.words[0]&1)===0},jr.prototype.isOdd=function(){return(this.words[0]&1)===1},jr.prototype.andln=function(no){return this.words[0]&no},jr.prototype.bincn=function(no){Er(typeof no=="number");var Tn=no%26,Hr=(no-Tn)/26,Xr=1<>>26,Pn&=67108863,this.words[Rn]=Pn}return Sn!==0&&(this.words[Rn]=Sn,this.length++),this},jr.prototype.isZero=function(){return this.length===1&&this.words[0]===0},jr.prototype.cmpn=function(no){var Tn=no<0;if(this.negative!==0&&!Tn)return-1;if(this.negative===0&&Tn)return 1;this.strip();var Hr;if(this.length>1)Hr=1;else{Tn&&(no=-no),Er(no<=67108863,"Number is too big");var Xr=this.words[0]|0;Hr=Xr===no?0:Xrno.length)return 1;if(this.length=0;Hr--){var Xr=this.words[Hr]|0,Sn=no.words[Hr]|0;if(Xr!==Sn){XrSn&&(Tn=1);break}}return Tn},jr.prototype.gtn=function(no){return this.cmpn(no)===1},jr.prototype.gt=function(no){return this.cmp(no)===1},jr.prototype.gten=function(no){return this.cmpn(no)>=0},jr.prototype.gte=function(no){return this.cmp(no)>=0},jr.prototype.ltn=function(no){return this.cmpn(no)===-1},jr.prototype.lt=function(no){return this.cmp(no)===-1},jr.prototype.lten=function(no){return this.cmpn(no)<=0},jr.prototype.lte=function(no){return this.cmp(no)<=0},jr.prototype.eqn=function(no){return this.cmpn(no)===0},jr.prototype.eq=function(no){return this.cmp(no)===0},jr.red=function(no){return new io(no)},jr.prototype.toRed=function(no){return Er(!this.red,"Already a number in reduction context"),Er(this.negative===0,"red works only with positives"),no.convertTo(this)._forceRed(no)},jr.prototype.fromRed=function(){return Er(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},jr.prototype._forceRed=function(no){return this.red=no,this},jr.prototype.forceRed=function(no){return Er(!this.red,"Already a number in reduction context"),this._forceRed(no)},jr.prototype.redAdd=function(no){return Er(this.red,"redAdd works only with red numbers"),this.red.add(this,no)},jr.prototype.redIAdd=function(no){return Er(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,no)},jr.prototype.redSub=function(no){return Er(this.red,"redSub works only with red numbers"),this.red.sub(this,no)},jr.prototype.redISub=function(no){return Er(this.red,"redISub works only with red numbers"),this.red.isub(this,no)},jr.prototype.redShl=function(no){return Er(this.red,"redShl works only with red numbers"),this.red.shl(this,no)},jr.prototype.redMul=function(no){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,no),this.red.mul(this,no)},jr.prototype.redIMul=function(no){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,no),this.red.imul(this,no)},jr.prototype.redSqr=function(){return Er(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},jr.prototype.redISqr=function(){return Er(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},jr.prototype.redSqrt=function(){return Er(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},jr.prototype.redInvm=function(){return Er(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},jr.prototype.redNeg=function(){return Er(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},jr.prototype.redPow=function(no){return Er(this.red&&!no.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,no)};var jn={k256:null,p224:null,p192:null,p25519:null};function eo(so,no){this.name=so,this.p=new jr(no,16),this.n=this.p.bitLength(),this.k=new jr(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}eo.prototype._tmp=function(){var no=new jr(null);return no.words=new Array(Math.ceil(this.n/13)),no},eo.prototype.ireduce=function(no){var Tn=no,Hr;do this.split(Tn,this.tmp),Tn=this.imulK(Tn),Tn=Tn.iadd(this.tmp),Hr=Tn.bitLength();while(Hr>this.n);var Xr=Hr0?Tn.isub(this.p):Tn.strip!==void 0?Tn.strip():Tn._strip(),Tn},eo.prototype.split=function(no,Tn){no.iushrn(this.n,0,Tn)},eo.prototype.imulK=function(no){return no.imul(this.k)};function ro(){eo.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}kr(ro,eo),ro.prototype.split=function(no,Tn){for(var Hr=4194303,Xr=Math.min(no.length,9),Sn=0;Sn>>22,Rn=Pn}Rn>>>=22,no.words[Sn-10]=Rn,Rn===0&&no.length>10?no.length-=10:no.length-=9},ro.prototype.imulK=function(no){no.words[no.length]=0,no.words[no.length+1]=0,no.length+=2;for(var Tn=0,Hr=0;Hr>>=26,no.words[Hr]=Sn,Tn=Xr}return Tn!==0&&(no.words[no.length++]=Tn),no},jr._prime=function(no){if(jn[no])return jn[no];var Tn;if(no==="k256")Tn=new ro;else if(no==="p224")Tn=new to;else if(no==="p192")Tn=new _i;else if(no==="p25519")Tn=new oo;else throw new Error("Unknown prime "+no);return jn[no]=Tn,Tn};function io(so){if(typeof so=="string"){var no=jr._prime(so);this.m=no.p,this.prime=no}else Er(so.gtn(1),"modulus must be greater than 1"),this.m=so,this.prime=null}io.prototype._verify1=function(no){Er(no.negative===0,"red works only with positives"),Er(no.red,"red works only with red numbers")},io.prototype._verify2=function(no,Tn){Er((no.negative|Tn.negative)===0,"red works only with positives"),Er(no.red&&no.red===Tn.red,"red works only with red numbers")},io.prototype.imod=function(no){return this.prime?this.prime.ireduce(no)._forceRed(this):no.umod(this.m)._forceRed(this)},io.prototype.neg=function(no){return no.isZero()?no.clone():this.m.sub(no)._forceRed(this)},io.prototype.add=function(no,Tn){this._verify2(no,Tn);var Hr=no.add(Tn);return Hr.cmp(this.m)>=0&&Hr.isub(this.m),Hr._forceRed(this)},io.prototype.iadd=function(no,Tn){this._verify2(no,Tn);var Hr=no.iadd(Tn);return Hr.cmp(this.m)>=0&&Hr.isub(this.m),Hr},io.prototype.sub=function(no,Tn){this._verify2(no,Tn);var Hr=no.sub(Tn);return Hr.cmpn(0)<0&&Hr.iadd(this.m),Hr._forceRed(this)},io.prototype.isub=function(no,Tn){this._verify2(no,Tn);var Hr=no.isub(Tn);return Hr.cmpn(0)<0&&Hr.iadd(this.m),Hr},io.prototype.shl=function(no,Tn){return this._verify1(no),this.imod(no.ushln(Tn))},io.prototype.imul=function(no,Tn){return this._verify2(no,Tn),this.imod(no.imul(Tn))},io.prototype.mul=function(no,Tn){return this._verify2(no,Tn),this.imod(no.mul(Tn))},io.prototype.isqr=function(no){return this.imul(no,no.clone())},io.prototype.sqr=function(no){return this.mul(no,no)},io.prototype.sqrt=function(no){if(no.isZero())return no.clone();var Tn=this.m.andln(3);if(Er(Tn%2===1),Tn===3){var Hr=this.m.add(new jr(1)).iushrn(2);return this.pow(no,Hr)}for(var Xr=this.m.subn(1),Sn=0;!Xr.isZero()&&Xr.andln(1)===0;)Sn++,Xr.iushrn(1);Er(!Xr.isZero());var Rn=new jr(1).toRed(this),Pn=Rn.redNeg(),On=this.m.subn(1).iushrn(1),Zn=this.m.bitLength();for(Zn=new jr(2*Zn*Zn).toRed(this);this.pow(Zn,On).cmp(Pn)!==0;)Zn.redIAdd(Pn);for(var Nn=this.pow(Zn,Xr),wn=this.pow(no,Xr.addn(1).iushrn(1)),zn=this.pow(no,Xr),fo=Sn;zn.cmp(Rn)!==0;){for(var vo=zn,go=0;vo.cmp(Rn)!==0;go++)vo=vo.redSqr();Er(go=0;Sn--){for(var Nn=Tn.words[Sn],wn=Zn-1;wn>=0;wn--){var zn=Nn>>wn&1;if(Rn!==Xr[0]&&(Rn=this.sqr(Rn)),zn===0&&Pn===0){On=0;continue}Pn<<=1,Pn|=zn,On++,!(On!==Hr&&(Sn!==0||wn!==0))&&(Rn=this.mul(Rn,Xr[Pn]),On=0,Pn=0)}Zn=26}return Rn},io.prototype.convertTo=function(no){var Tn=no.umod(this.m);return Tn===no?Tn.clone():Tn},io.prototype.convertFrom=function(no){var Tn=no.clone();return Tn.red=null,Tn},jr.mont=function(no){return new co(no)};function co(so){io.call(this,so),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new jr(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}kr(co,io),co.prototype.convertTo=function(no){return this.imod(no.ushln(this.shift))},co.prototype.convertFrom=function(no){var Tn=this.imod(no.mul(this.rinv));return Tn.red=null,Tn},co.prototype.imul=function(no,Tn){if(no.isZero()||Tn.isZero())return no.words[0]=0,no.length=1,no;var Hr=no.imul(Tn),Xr=Hr.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Sn=Hr.isub(Xr).iushrn(this.shift),Rn=Sn;return Sn.cmp(this.m)>=0?Rn=Sn.isub(this.m):Sn.cmpn(0)<0&&(Rn=Sn.iadd(this.m)),Rn._forceRed(this)},co.prototype.mul=function(no,Tn){if(no.isZero()||Tn.isZero())return new jr(0)._forceRed(this);var Hr=no.mul(Tn),Xr=Hr.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Sn=Hr.isub(Xr).iushrn(this.shift),Rn=Sn;return Sn.cmp(this.m)>=0?Rn=Sn.isub(this.m):Sn.cmpn(0)<0&&(Rn=Sn.iadd(this.m)),Rn._forceRed(this)},co.prototype.invm=function(no){var Tn=this.imod(no._invmp(this.m).mul(this.r2));return Tn._forceRed(this)}})(fr,commonjsGlobal)}(bn$6)),bn$6.exports}var brorand={exports:{}},hasRequiredBrorand;function requireBrorand(){if(hasRequiredBrorand)return brorand.exports;hasRequiredBrorand=1;var fr;brorand.exports=function(kr){return fr||(fr=new br(null)),fr.generate(kr)};function br(Er){this.rand=Er}if(brorand.exports.Rand=br,br.prototype.generate=function(kr){return this._rand(kr)},br.prototype._rand=function(kr){if(this.rand.getBytes)return this.rand.getBytes(kr);for(var jr=new Uint8Array(kr),Br=0;Br=0);return Wr},wr.prototype._randrange=function(kr,jr){var Br=jr.sub(kr);return kr.add(this._randbelow(Br))},wr.prototype.test=function(kr,jr,Br){var Wr=kr.bitLength(),qr=fr.mont(kr),Gr=new fr(1).toRed(qr);jr||(jr=Math.max(1,Wr/48|0));for(var Vr=kr.subn(1),Zr=0;!Vr.testn(Zr);Zr++);for(var Jr=kr.shrn(Zr),Qr=Vr.toRed(qr),_n=!0;jr>0;jr--){var En=this._randrange(new fr(2),Vr);Br&&Br(En);var Cn=En.toRed(qr).redPow(Jr);if(!(Cn.cmp(Gr)===0||Cn.cmp(Qr)===0)){for(var In=1;In0;jr--){var Qr=this._randrange(new fr(2),Gr),_n=kr.gcd(Qr);if(_n.cmpn(1)!==0)return _n;var En=Qr.toRed(Wr).redPow(Zr);if(!(En.cmp(qr)===0||En.cmp(Jr)===0)){for(var Cn=1;CnIn;)jn.ishrn(1);if(jn.isEven()&&jn.iadd(jr),jn.testn(1)||jn.iadd(Br),An.cmp(Br)){if(!An.cmp(Wr))for(;jn.mod(qr).cmp(Gr);)jn.iadd(Zr)}else for(;jn.mod(wr).cmp(Vr);)jn.iadd(Zr);if(eo=jn.shrn(1),_n(eo)&&_n(jn)&&En(eo)&&En(jn)&&kr.test(eo)&&kr.test(jn))return jn}}return generatePrime}const modp1={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},require$$1$2={modp1,modp2,modp5,modp14,modp15,modp16,modp17,modp18};var dh,hasRequiredDh;function requireDh(){if(hasRequiredDh)return dh;hasRequiredDh=1;var fr=requireBn$2(),br=requireMr(),wr=new br,Er=new fr(24),kr=new fr(11),jr=new fr(10),Br=new fr(3),Wr=new fr(7),qr=requireGeneratePrime(),Gr=requireBrowser$b();dh=_n;function Vr(Cn,In){return In=In||"utf8",Buffer$2.isBuffer(Cn)||(Cn=new Buffer$2(Cn,In)),this._pub=new fr(Cn),this}function Zr(Cn,In){return In=In||"utf8",Buffer$2.isBuffer(Cn)||(Cn=new Buffer$2(Cn,In)),this._priv=new fr(Cn),this}var Jr={};function Qr(Cn,In){var An=In.toString("hex"),jn=[An,Cn.toString(16)].join("_");if(jn in Jr)return Jr[jn];var eo=0;if(Cn.isEven()||!qr.simpleSieve||!qr.fermatTest(Cn)||!wr.test(Cn))return eo+=1,An==="02"||An==="05"?eo+=8:eo+=4,Jr[jn]=eo,eo;wr.test(Cn.shrn(1))||(eo+=2);var ro;switch(An){case"02":Cn.mod(Er).cmp(kr)&&(eo+=8);break;case"05":ro=Cn.mod(jr),ro.cmp(Br)&&ro.cmp(Wr)&&(eo+=8);break;default:eo+=4}return Jr[jn]=eo,eo}function _n(Cn,In,An){this.setGenerator(In),this.__prime=new fr(Cn),this._prime=fr.mont(this.__prime),this._primeLen=Cn.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,An?(this.setPublicKey=Vr,this.setPrivateKey=Zr):this._primeCode=8}Object.defineProperty(_n.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=Qr(this.__prime,this.__gen)),this._primeCode}}),_n.prototype.generateKeys=function(){return this._priv||(this._priv=new fr(Gr(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},_n.prototype.computeSecret=function(Cn){Cn=new fr(Cn),Cn=Cn.toRed(this._prime);var In=Cn.redPow(this._priv).fromRed(),An=new Buffer$2(In.toArray()),jn=this.getPrime();if(An.length"u"||!process$1$1.version||process$1$1.version.indexOf("v0.")===0||process$1$1.version.indexOf("v1.")===0&&process$1$1.version.indexOf("v1.8.")!==0?processNextickArgs.exports={nextTick:fr}:processNextickArgs.exports=process$1$1;function fr(br,wr,Er,kr){if(typeof br!="function")throw new TypeError('"callback" argument must be a function');var jr=arguments.length,Br,Wr;switch(jr){case 0:case 1:return process$1$1.nextTick(br);case 2:return process$1$1.nextTick(function(){br.call(null,wr)});case 3:return process$1$1.nextTick(function(){br.call(null,wr,Er)});case 4:return process$1$1.nextTick(function(){br.call(null,wr,Er,kr)});default:for(Br=new Array(jr-1),Wr=0;Wr"u"}util$7.isPrimitive=Qr,util$7.isBuffer=require$$0$9.Buffer.isBuffer;function _n(En){return Object.prototype.toString.call(En)}return util$7}var BufferList={exports:{}},hasRequiredBufferList;function requireBufferList(){return hasRequiredBufferList||(hasRequiredBufferList=1,function(fr){function br(jr,Br){if(!(jr instanceof Br))throw new TypeError("Cannot call a class as a function")}var wr=requireSafeBuffer().Buffer,Er=requireUtil$1();function kr(jr,Br,Wr){jr.copy(Br,Wr)}fr.exports=function(){function jr(){br(this,jr),this.head=null,this.tail=null,this.length=0}return jr.prototype.push=function(Wr){var qr={data:Wr,next:null};this.length>0?this.tail.next=qr:this.head=qr,this.tail=qr,++this.length},jr.prototype.unshift=function(Wr){var qr={data:Wr,next:this.head};this.length===0&&(this.tail=qr),this.head=qr,++this.length},jr.prototype.shift=function(){if(this.length!==0){var Wr=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,Wr}},jr.prototype.clear=function(){this.head=this.tail=null,this.length=0},jr.prototype.join=function(Wr){if(this.length===0)return"";for(var qr=this.head,Gr=""+qr.data;qr=qr.next;)Gr+=Wr+qr.data;return Gr},jr.prototype.concat=function(Wr){if(this.length===0)return wr.alloc(0);for(var qr=wr.allocUnsafe(Wr>>>0),Gr=this.head,Vr=0;Gr;)kr(Gr.data,qr,Vr),Vr+=Gr.data.length,Gr=Gr.next;return qr},jr}(),Er&&Er.inspect&&Er.inspect.custom&&(fr.exports.prototype[Er.inspect.custom]=function(){var jr=Er.inspect({length:this.length});return this.constructor.name+" "+jr})}(BufferList)),BufferList.exports}var destroy_1,hasRequiredDestroy;function requireDestroy(){if(hasRequiredDestroy)return destroy_1;hasRequiredDestroy=1;var fr=requireProcessNextickArgs();function br(kr,jr){var Br=this,Wr=this._readableState&&this._readableState.destroyed,qr=this._writableState&&this._writableState.destroyed;return Wr||qr?(jr?jr(kr):kr&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,fr.nextTick(Er,this,kr)):fr.nextTick(Er,this,kr)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(kr||null,function(Gr){!jr&&Gr?Br._writableState?Br._writableState.errorEmitted||(Br._writableState.errorEmitted=!0,fr.nextTick(Er,Br,Gr)):fr.nextTick(Er,Br,Gr):jr&&jr(Gr)}),this)}function wr(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Er(kr,jr){kr.emit("error",jr)}return destroy_1={destroy:br,undestroy:wr},destroy_1}var _stream_writable,hasRequired_stream_writable;function require_stream_writable(){if(hasRequired_stream_writable)return _stream_writable;hasRequired_stream_writable=1;var fr=requireProcessNextickArgs();_stream_writable=En;function br(Rn){var Pn=this;this.next=null,this.entry=null,this.finish=function(){Sn(Pn,Rn)}}var wr=!process$1$1.browser&&["v0.10","v0.9."].indexOf(process$1$1.version.slice(0,5))>-1?setImmediate:fr.nextTick,Er;En.WritableState=Qr;var kr=Object.create(requireUtil());kr.inherits=requireInherits_browser();var jr={deprecate:requireBrowser$a()},Br=requireStreamBrowser(),Wr=requireSafeBuffer().Buffer,qr=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Gr(Rn){return Wr.from(Rn)}function Vr(Rn){return Wr.isBuffer(Rn)||Rn instanceof qr}var Zr=requireDestroy();kr.inherits(En,Br);function Jr(){}function Qr(Rn,Pn){Er=Er||require_stream_duplex(),Rn=Rn||{};var On=Pn instanceof Er;this.objectMode=!!Rn.objectMode,On&&(this.objectMode=this.objectMode||!!Rn.writableObjectMode);var Zn=Rn.highWaterMark,Nn=Rn.writableHighWaterMark,wn=this.objectMode?16:16*1024;Zn||Zn===0?this.highWaterMark=Zn:On&&(Nn||Nn===0)?this.highWaterMark=Nn:this.highWaterMark=wn,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var zn=Rn.decodeStrings===!1;this.decodeStrings=!zn,this.defaultEncoding=Rn.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(fo){_i(Pn,fo)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new br(this)}Qr.prototype.getBuffer=function(){for(var Pn=this.bufferedRequest,On=[];Pn;)On.push(Pn),Pn=Pn.next;return On},function(){try{Object.defineProperty(Qr.prototype,"buffer",{get:jr.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var _n;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(_n=Function.prototype[Symbol.hasInstance],Object.defineProperty(En,Symbol.hasInstance,{value:function(Rn){return _n.call(this,Rn)?!0:this!==En?!1:Rn&&Rn._writableState instanceof Qr}})):_n=function(Rn){return Rn instanceof this};function En(Rn){if(Er=Er||require_stream_duplex(),!_n.call(En,this)&&!(this instanceof Er))return new En(Rn);this._writableState=new Qr(Rn,this),this.writable=!0,Rn&&(typeof Rn.write=="function"&&(this._write=Rn.write),typeof Rn.writev=="function"&&(this._writev=Rn.writev),typeof Rn.destroy=="function"&&(this._destroy=Rn.destroy),typeof Rn.final=="function"&&(this._final=Rn.final)),Br.call(this)}En.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function Cn(Rn,Pn){var On=new Error("write after end");Rn.emit("error",On),fr.nextTick(Pn,On)}function In(Rn,Pn,On,Zn){var Nn=!0,wn=!1;return On===null?wn=new TypeError("May not write null values to stream"):typeof On!="string"&&On!==void 0&&!Pn.objectMode&&(wn=new TypeError("Invalid non-string/buffer chunk")),wn&&(Rn.emit("error",wn),fr.nextTick(Zn,wn),Nn=!1),Nn}En.prototype.write=function(Rn,Pn,On){var Zn=this._writableState,Nn=!1,wn=!Zn.objectMode&&Vr(Rn);return wn&&!Wr.isBuffer(Rn)&&(Rn=Gr(Rn)),typeof Pn=="function"&&(On=Pn,Pn=null),wn?Pn="buffer":Pn||(Pn=Zn.defaultEncoding),typeof On!="function"&&(On=Jr),Zn.ended?Cn(this,On):(wn||In(this,Zn,Rn,On))&&(Zn.pendingcb++,Nn=jn(this,Zn,wn,Rn,Pn,On)),Nn},En.prototype.cork=function(){var Rn=this._writableState;Rn.corked++},En.prototype.uncork=function(){var Rn=this._writableState;Rn.corked&&(Rn.corked--,!Rn.writing&&!Rn.corked&&!Rn.bufferProcessing&&Rn.bufferedRequest&&co(this,Rn))},En.prototype.setDefaultEncoding=function(Pn){if(typeof Pn=="string"&&(Pn=Pn.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Pn+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+Pn);return this._writableState.defaultEncoding=Pn,this};function An(Rn,Pn,On){return!Rn.objectMode&&Rn.decodeStrings!==!1&&typeof Pn=="string"&&(Pn=Wr.from(Pn,On)),Pn}Object.defineProperty(En.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function jn(Rn,Pn,On,Zn,Nn,wn){if(!On){var zn=An(Pn,Zn,Nn);Zn!==zn&&(On=!0,Nn="buffer",Zn=zn)}var fo=Pn.objectMode?1:Zn.length;Pn.length+=fo;var vo=Pn.length0?(typeof lo!="string"&&!_o.objectMode&&Object.getPrototypeOf(lo)!==jr.prototype&&(lo=Wr(lo)),mo?_o.endEmitted?uo.emit("error",new Error("stream.unshift() after end event")):eo(uo,_o,lo,!0):_o.ended?uo.emit("error",new Error("stream.push() after EOF")):(_o.reading=!1,_o.decoder&&!Eo?(lo=_o.decoder.write(lo),_o.objectMode||lo.length!==0?eo(uo,_o,lo,!1):Tn(uo,_o)):eo(uo,_o,lo,!1))):mo||(_o.reading=!1)}return to(_o)}function eo(uo,lo,Eo,mo){lo.flowing&&lo.length===0&&!lo.sync?(uo.emit("data",Eo),uo.read(0)):(lo.length+=lo.objectMode?1:Eo.length,mo?lo.buffer.unshift(Eo):lo.buffer.push(Eo),lo.needReadable&&so(uo)),Tn(uo,lo)}function ro(uo,lo){var Eo;return!qr(lo)&&typeof lo!="string"&&lo!==void 0&&!uo.objectMode&&(Eo=new TypeError("Invalid non-string/buffer chunk")),Eo}function to(uo){return!uo.ended&&(uo.needReadable||uo.length=_i?uo=_i:(uo--,uo|=uo>>>1,uo|=uo>>>2,uo|=uo>>>4,uo|=uo>>>8,uo|=uo>>>16,uo++),uo}function io(uo,lo){return uo<=0||lo.length===0&&lo.ended?0:lo.objectMode?1:uo!==uo?lo.flowing&&lo.length?lo.buffer.head.data.length:lo.length:(uo>lo.highWaterMark&&(lo.highWaterMark=oo(uo)),uo<=lo.length?uo:lo.ended?lo.length:(lo.needReadable=!0,0))}An.prototype.read=function(uo){Zr("read",uo),uo=parseInt(uo,10);var lo=this._readableState,Eo=uo;if(uo!==0&&(lo.emittedReadable=!1),uo===0&&lo.needReadable&&(lo.length>=lo.highWaterMark||lo.ended))return Zr("read: emitReadable",lo.length,lo.ended),lo.length===0&&lo.ended?fo(this):so(this),null;if(uo=io(uo,lo),uo===0&&lo.ended)return lo.length===0&&fo(this),null;var mo=lo.needReadable;Zr("need readable",mo),(lo.length===0||lo.length-uo0?yo=Zn(uo,lo):yo=null,yo===null?(lo.needReadable=!0,uo=0):lo.length-=uo,lo.length===0&&(lo.ended||(lo.needReadable=!0),Eo!==uo&&lo.ended&&fo(this)),yo!==null&&this.emit("data",yo),yo};function co(uo,lo){if(!lo.ended){if(lo.decoder){var Eo=lo.decoder.end();Eo&&Eo.length&&(lo.buffer.push(Eo),lo.length+=lo.objectMode?1:Eo.length)}lo.ended=!0,so(uo)}}function so(uo){var lo=uo._readableState;lo.needReadable=!1,lo.emittedReadable||(Zr("emitReadable",lo.flowing),lo.emittedReadable=!0,lo.sync?fr.nextTick(no,uo):no(uo))}function no(uo){Zr("emit readable"),uo.emit("readable"),On(uo)}function Tn(uo,lo){lo.readingMore||(lo.readingMore=!0,fr.nextTick(Hr,uo,lo))}function Hr(uo,lo){for(var Eo=lo.length;!lo.reading&&!lo.flowing&&!lo.ended&&lo.length1&&go(mo.pipes,uo)!==-1)&&!na&&(Zr("false write response, pause",mo.awaitDrain),mo.awaitDrain++,ga=!0),Eo.pause())}function No(Uo){Zr("onerror",Uo),Vo(),uo.removeListener("error",No),Er(uo,"error")===0&&uo.emit("error",Uo)}Cn(uo,"error",No);function Fo(){uo.removeListener("finish",Nl),Vo()}uo.once("close",Fo);function Nl(){Zr("onfinish"),uo.removeListener("close",Fo),Vo()}uo.once("finish",Nl);function Vo(){Zr("unpipe"),Eo.unpipe(uo)}return uo.emit("pipe",Eo),mo.flowing||(Zr("pipe resume"),Eo.resume()),uo};function Xr(uo){return function(){var lo=uo._readableState;Zr("pipeOnDrain",lo.awaitDrain),lo.awaitDrain&&lo.awaitDrain--,lo.awaitDrain===0&&Er(uo,"data")&&(lo.flowing=!0,On(uo))}}An.prototype.unpipe=function(uo){var lo=this._readableState,Eo={hasUnpiped:!1};if(lo.pipesCount===0)return this;if(lo.pipesCount===1)return uo&&uo!==lo.pipes?this:(uo||(uo=lo.pipes),lo.pipes=null,lo.pipesCount=0,lo.flowing=!1,uo&&uo.emit("unpipe",this,Eo),this);if(!uo){var mo=lo.pipes,yo=lo.pipesCount;lo.pipes=null,lo.pipesCount=0,lo.flowing=!1;for(var _o=0;_o=lo.length?(lo.decoder?Eo=lo.buffer.join(""):lo.buffer.length===1?Eo=lo.buffer.head.data:Eo=lo.buffer.concat(lo.length),lo.buffer.clear()):Eo=Nn(uo,lo.buffer,lo.decoder),Eo}function Nn(uo,lo,Eo){var mo;return uo_o.length?_o.length:uo;if(Bo===_o.length?yo+=_o:yo+=_o.slice(0,uo),uo-=Bo,uo===0){Bo===_o.length?(++mo,Eo.next?lo.head=Eo.next:lo.head=lo.tail=null):(lo.head=Eo,Eo.data=_o.slice(Bo));break}++mo}return lo.length-=mo,yo}function zn(uo,lo){var Eo=jr.allocUnsafe(uo),mo=lo.head,yo=1;for(mo.data.copy(Eo),uo-=mo.data.length;mo=mo.next;){var _o=mo.data,Bo=uo>_o.length?_o.length:uo;if(_o.copy(Eo,Eo.length-uo,0,Bo),uo-=Bo,uo===0){Bo===_o.length?(++yo,mo.next?lo.head=mo.next:lo.head=lo.tail=null):(lo.head=mo,mo.data=_o.slice(Bo));break}++yo}return lo.length-=yo,Eo}function fo(uo){var lo=uo._readableState;if(lo.length>0)throw new Error('"endReadable()" called on non-empty stream');lo.endEmitted||(lo.ended=!0,fr.nextTick(vo,lo,uo))}function vo(uo,lo){!uo.endEmitted&&uo.length===0&&(uo.endEmitted=!0,lo.readable=!1,lo.emit("end"))}function go(uo,lo){for(var Eo=0,mo=uo.length;Eo0?Hr:Xr},jr.min=function(Hr,Xr){return Hr.cmp(Xr)<0?Hr:Xr},jr.prototype._init=function(Hr,Xr,Sn){if(typeof Hr=="number")return this._initNumber(Hr,Xr,Sn);if(typeof Hr=="object")return this._initArray(Hr,Xr,Sn);Xr==="hex"&&(Xr=16),Er(Xr===(Xr|0)&&Xr>=2&&Xr<=36),Hr=Hr.toString().replace(/\s+/g,"");var Rn=0;Hr[0]==="-"&&(Rn++,this.negative=1),Rn=0;Rn-=3)On=Hr[Rn]|Hr[Rn-1]<<8|Hr[Rn-2]<<16,this.words[Pn]|=On<>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);else if(Sn==="le")for(Rn=0,Pn=0;Rn>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);return this._strip()};function Wr(Tn,Hr){var Xr=Tn.charCodeAt(Hr);if(Xr>=48&&Xr<=57)return Xr-48;if(Xr>=65&&Xr<=70)return Xr-55;if(Xr>=97&&Xr<=102)return Xr-87;Er(!1,"Invalid character in "+Tn)}function qr(Tn,Hr,Xr){var Sn=Wr(Tn,Xr);return Xr-1>=Hr&&(Sn|=Wr(Tn,Xr-1)<<4),Sn}jr.prototype._parseHex=function(Hr,Xr,Sn){this.length=Math.ceil((Hr.length-Xr)/6),this.words=new Array(this.length);for(var Rn=0;Rn=Xr;Rn-=2)Zn=qr(Hr,Xr,Rn)<=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8;else{var Nn=Hr.length-Xr;for(Rn=Nn%2===0?Xr+1:Xr;Rn=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8}this._strip()};function Gr(Tn,Hr,Xr,Sn){for(var Rn=0,Pn=0,On=Math.min(Tn.length,Xr),Zn=Hr;Zn=49?Pn=Nn-49+10:Nn>=17?Pn=Nn-17+10:Pn=Nn,Er(Nn>=0&&Pn1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},jr.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{jr.prototype[Symbol.for("nodejs.util.inspect.custom")]=Zr}catch{jr.prototype.inspect=Zr}else jr.prototype.inspect=Zr;function Zr(){return(this.red?""}var Jr=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Qr=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_n=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];jr.prototype.toString=function(Hr,Xr){Hr=Hr||10,Xr=Xr|0||1;var Sn;if(Hr===16||Hr==="hex"){Sn="";for(var Rn=0,Pn=0,On=0;On>>24-Rn&16777215,Rn+=2,Rn>=26&&(Rn-=26,On--),Pn!==0||On!==this.length-1?Sn=Jr[6-Nn.length]+Nn+Sn:Sn=Nn+Sn}for(Pn!==0&&(Sn=Pn.toString(16)+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}if(Hr===(Hr|0)&&Hr>=2&&Hr<=36){var wn=Qr[Hr],zn=_n[Hr];Sn="";var fo=this.clone();for(fo.negative=0;!fo.isZero();){var vo=fo.modrn(zn).toString(Hr);fo=fo.idivn(zn),fo.isZero()?Sn=vo+Sn:Sn=Jr[wn-vo.length]+vo+Sn}for(this.isZero()&&(Sn="0"+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}Er(!1,"Base should be between 2 and 36")},jr.prototype.toNumber=function(){var Hr=this.words[0];return this.length===2?Hr+=this.words[1]*67108864:this.length===3&&this.words[2]===1?Hr+=4503599627370496+this.words[1]*67108864:this.length>2&&Er(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-Hr:Hr},jr.prototype.toJSON=function(){return this.toString(16,2)},Br&&(jr.prototype.toBuffer=function(Hr,Xr){return this.toArrayLike(Br,Hr,Xr)}),jr.prototype.toArray=function(Hr,Xr){return this.toArrayLike(Array,Hr,Xr)};var En=function(Hr,Xr){return Hr.allocUnsafe?Hr.allocUnsafe(Xr):new Hr(Xr)};jr.prototype.toArrayLike=function(Hr,Xr,Sn){this._strip();var Rn=this.byteLength(),Pn=Sn||Math.max(1,Rn);Er(Rn<=Pn,"byte array longer than desired length"),Er(Pn>0,"Requested array length <= 0");var On=En(Hr,Pn),Zn=Xr==="le"?"LE":"BE";return this["_toArrayLike"+Zn](On,Rn),On},jr.prototype._toArrayLikeLE=function(Hr,Xr){for(var Sn=0,Rn=0,Pn=0,On=0;Pn>8&255),Sn>16&255),On===6?(Sn>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn=0&&(Hr[Sn--]=Zn>>8&255),Sn>=0&&(Hr[Sn--]=Zn>>16&255),On===6?(Sn>=0&&(Hr[Sn--]=Zn>>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn>=0)for(Hr[Sn--]=Rn;Sn>=0;)Hr[Sn--]=0},Math.clz32?jr.prototype._countBits=function(Hr){return 32-Math.clz32(Hr)}:jr.prototype._countBits=function(Hr){var Xr=Hr,Sn=0;return Xr>=4096&&(Sn+=13,Xr>>>=13),Xr>=64&&(Sn+=7,Xr>>>=7),Xr>=8&&(Sn+=4,Xr>>>=4),Xr>=2&&(Sn+=2,Xr>>>=2),Sn+Xr},jr.prototype._zeroBits=function(Hr){if(Hr===0)return 26;var Xr=Hr,Sn=0;return Xr&8191||(Sn+=13,Xr>>>=13),Xr&127||(Sn+=7,Xr>>>=7),Xr&15||(Sn+=4,Xr>>>=4),Xr&3||(Sn+=2,Xr>>>=2),Xr&1||Sn++,Sn},jr.prototype.bitLength=function(){var Hr=this.words[this.length-1],Xr=this._countBits(Hr);return(this.length-1)*26+Xr};function Cn(Tn){for(var Hr=new Array(Tn.bitLength()),Xr=0;Xr>>Rn&1}return Hr}jr.prototype.zeroBits=function(){if(this.isZero())return 0;for(var Hr=0,Xr=0;XrHr.length?this.clone().ior(Hr):Hr.clone().ior(this)},jr.prototype.uor=function(Hr){return this.length>Hr.length?this.clone().iuor(Hr):Hr.clone().iuor(this)},jr.prototype.iuand=function(Hr){var Xr;this.length>Hr.length?Xr=Hr:Xr=this;for(var Sn=0;SnHr.length?this.clone().iand(Hr):Hr.clone().iand(this)},jr.prototype.uand=function(Hr){return this.length>Hr.length?this.clone().iuand(Hr):Hr.clone().iuand(this)},jr.prototype.iuxor=function(Hr){var Xr,Sn;this.length>Hr.length?(Xr=this,Sn=Hr):(Xr=Hr,Sn=this);for(var Rn=0;RnHr.length?this.clone().ixor(Hr):Hr.clone().ixor(this)},jr.prototype.uxor=function(Hr){return this.length>Hr.length?this.clone().iuxor(Hr):Hr.clone().iuxor(this)},jr.prototype.inotn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Math.ceil(Hr/26)|0,Sn=Hr%26;this._expand(Xr),Sn>0&&Xr--;for(var Rn=0;Rn0&&(this.words[Rn]=~this.words[Rn]&67108863>>26-Sn),this._strip()},jr.prototype.notn=function(Hr){return this.clone().inotn(Hr)},jr.prototype.setn=function(Hr,Xr){Er(typeof Hr=="number"&&Hr>=0);var Sn=Hr/26|0,Rn=Hr%26;return this._expand(Sn+1),Xr?this.words[Sn]=this.words[Sn]|1<Hr.length?(Sn=this,Rn=Hr):(Sn=Hr,Rn=this);for(var Pn=0,On=0;On>>26;for(;Pn!==0&&On>>26;if(this.length=Sn.length,Pn!==0)this.words[this.length]=Pn,this.length++;else if(Sn!==this)for(;OnHr.length?this.clone().iadd(Hr):Hr.clone().iadd(this)},jr.prototype.isub=function(Hr){if(Hr.negative!==0){Hr.negative=0;var Xr=this.iadd(Hr);return Hr.negative=1,Xr._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Hr),this.negative=1,this._normSign();var Sn=this.cmp(Hr);if(Sn===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Rn,Pn;Sn>0?(Rn=this,Pn=Hr):(Rn=Hr,Pn=this);for(var On=0,Zn=0;Zn>26,this.words[Zn]=Xr&67108863;for(;On!==0&&Zn>26,this.words[Zn]=Xr&67108863;if(On===0&&Zn>>26,fo=Nn&67108863,vo=Math.min(wn,Hr.length-1),go=Math.max(0,wn-Tn.length+1);go<=vo;go++){var uo=wn-go|0;Rn=Tn.words[uo]|0,Pn=Hr.words[go]|0,On=Rn*Pn+fo,zn+=On/67108864|0,fo=On&67108863}Xr.words[wn]=fo|0,Nn=zn|0}return Nn!==0?Xr.words[wn]=Nn|0:Xr.length--,Xr._strip()}var An=function(Hr,Xr,Sn){var Rn=Hr.words,Pn=Xr.words,On=Sn.words,Zn=0,Nn,wn,zn,fo=Rn[0]|0,vo=fo&8191,go=fo>>>13,uo=Rn[1]|0,lo=uo&8191,Eo=uo>>>13,mo=Rn[2]|0,yo=mo&8191,_o=mo>>>13,Bo=Rn[3]|0,Lo=Bo&8191,Wo=Bo>>>13,na=Rn[4]|0,qo=na&8191,ga=na>>>13,wl=Rn[5]|0,No=wl&8191,Fo=wl>>>13,Nl=Rn[6]|0,Vo=Nl&8191,Uo=Nl>>>13,Ml=Rn[7]|0,$a=Ml&8191,Jo=Ml>>>13,Zl=Rn[8]|0,Cl=Zl&8191,ko=Zl>>>13,wo=Rn[9]|0,bo=wo&8191,Io=wo>>>13,Ho=Pn[0]|0,Do=Ho&8191,zo=Ho>>>13,nu=Pn[1]|0,Ll=nu&8191,_l=nu>>>13,bu=Pn[2]|0,xl=bu&8191,Tl=bu>>>13,du=Pn[3]|0,Bl=du&8191,Il=du>>>13,Eu=Pn[4]|0,Al=Eu&8191,Ol=Eu>>>13,Tu=Pn[5]|0,Ul=Tu&8191,Sl=Tu>>>13,_u=Pn[6]|0,So=_u&8191,Co=_u>>>13,Ao=Pn[7]|0,po=Ao&8191,Ro=Ao>>>13,Xo=Pn[8]|0,jo=Xo&8191,Ko=Xo>>>13,Wl=Pn[9]|0,$l=Wl&8191,El=Wl>>>13;Sn.negative=Hr.negative^Xr.negative,Sn.length=19,Nn=Math.imul(vo,Do),wn=Math.imul(vo,zo),wn=wn+Math.imul(go,Do)|0,zn=Math.imul(go,zo);var Cu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,Nn=Math.imul(lo,Do),wn=Math.imul(lo,zo),wn=wn+Math.imul(Eo,Do)|0,zn=Math.imul(Eo,zo),Nn=Nn+Math.imul(vo,Ll)|0,wn=wn+Math.imul(vo,_l)|0,wn=wn+Math.imul(go,Ll)|0,zn=zn+Math.imul(go,_l)|0;var iu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(iu>>>26)|0,iu&=67108863,Nn=Math.imul(yo,Do),wn=Math.imul(yo,zo),wn=wn+Math.imul(_o,Do)|0,zn=Math.imul(_o,zo),Nn=Nn+Math.imul(lo,Ll)|0,wn=wn+Math.imul(lo,_l)|0,wn=wn+Math.imul(Eo,Ll)|0,zn=zn+Math.imul(Eo,_l)|0,Nn=Nn+Math.imul(vo,xl)|0,wn=wn+Math.imul(vo,Tl)|0,wn=wn+Math.imul(go,xl)|0,zn=zn+Math.imul(go,Tl)|0;var pu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(pu>>>26)|0,pu&=67108863,Nn=Math.imul(Lo,Do),wn=Math.imul(Lo,zo),wn=wn+Math.imul(Wo,Do)|0,zn=Math.imul(Wo,zo),Nn=Nn+Math.imul(yo,Ll)|0,wn=wn+Math.imul(yo,_l)|0,wn=wn+Math.imul(_o,Ll)|0,zn=zn+Math.imul(_o,_l)|0,Nn=Nn+Math.imul(lo,xl)|0,wn=wn+Math.imul(lo,Tl)|0,wn=wn+Math.imul(Eo,xl)|0,zn=zn+Math.imul(Eo,Tl)|0,Nn=Nn+Math.imul(vo,Bl)|0,wn=wn+Math.imul(vo,Il)|0,wn=wn+Math.imul(go,Bl)|0,zn=zn+Math.imul(go,Il)|0;var yu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(yu>>>26)|0,yu&=67108863,Nn=Math.imul(qo,Do),wn=Math.imul(qo,zo),wn=wn+Math.imul(ga,Do)|0,zn=Math.imul(ga,zo),Nn=Nn+Math.imul(Lo,Ll)|0,wn=wn+Math.imul(Lo,_l)|0,wn=wn+Math.imul(Wo,Ll)|0,zn=zn+Math.imul(Wo,_l)|0,Nn=Nn+Math.imul(yo,xl)|0,wn=wn+Math.imul(yo,Tl)|0,wn=wn+Math.imul(_o,xl)|0,zn=zn+Math.imul(_o,Tl)|0,Nn=Nn+Math.imul(lo,Bl)|0,wn=wn+Math.imul(lo,Il)|0,wn=wn+Math.imul(Eo,Bl)|0,zn=zn+Math.imul(Eo,Il)|0,Nn=Nn+Math.imul(vo,Al)|0,wn=wn+Math.imul(vo,Ol)|0,wn=wn+Math.imul(go,Al)|0,zn=zn+Math.imul(go,Ol)|0;var hu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(hu>>>26)|0,hu&=67108863,Nn=Math.imul(No,Do),wn=Math.imul(No,zo),wn=wn+Math.imul(Fo,Do)|0,zn=Math.imul(Fo,zo),Nn=Nn+Math.imul(qo,Ll)|0,wn=wn+Math.imul(qo,_l)|0,wn=wn+Math.imul(ga,Ll)|0,zn=zn+Math.imul(ga,_l)|0,Nn=Nn+Math.imul(Lo,xl)|0,wn=wn+Math.imul(Lo,Tl)|0,wn=wn+Math.imul(Wo,xl)|0,zn=zn+Math.imul(Wo,Tl)|0,Nn=Nn+Math.imul(yo,Bl)|0,wn=wn+Math.imul(yo,Il)|0,wn=wn+Math.imul(_o,Bl)|0,zn=zn+Math.imul(_o,Il)|0,Nn=Nn+Math.imul(lo,Al)|0,wn=wn+Math.imul(lo,Ol)|0,wn=wn+Math.imul(Eo,Al)|0,zn=zn+Math.imul(Eo,Ol)|0,Nn=Nn+Math.imul(vo,Ul)|0,wn=wn+Math.imul(vo,Sl)|0,wn=wn+Math.imul(go,Ul)|0,zn=zn+Math.imul(go,Sl)|0;var mu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(mu>>>26)|0,mu&=67108863,Nn=Math.imul(Vo,Do),wn=Math.imul(Vo,zo),wn=wn+Math.imul(Uo,Do)|0,zn=Math.imul(Uo,zo),Nn=Nn+Math.imul(No,Ll)|0,wn=wn+Math.imul(No,_l)|0,wn=wn+Math.imul(Fo,Ll)|0,zn=zn+Math.imul(Fo,_l)|0,Nn=Nn+Math.imul(qo,xl)|0,wn=wn+Math.imul(qo,Tl)|0,wn=wn+Math.imul(ga,xl)|0,zn=zn+Math.imul(ga,Tl)|0,Nn=Nn+Math.imul(Lo,Bl)|0,wn=wn+Math.imul(Lo,Il)|0,wn=wn+Math.imul(Wo,Bl)|0,zn=zn+Math.imul(Wo,Il)|0,Nn=Nn+Math.imul(yo,Al)|0,wn=wn+Math.imul(yo,Ol)|0,wn=wn+Math.imul(_o,Al)|0,zn=zn+Math.imul(_o,Ol)|0,Nn=Nn+Math.imul(lo,Ul)|0,wn=wn+Math.imul(lo,Sl)|0,wn=wn+Math.imul(Eo,Ul)|0,zn=zn+Math.imul(Eo,Sl)|0,Nn=Nn+Math.imul(vo,So)|0,wn=wn+Math.imul(vo,Co)|0,wn=wn+Math.imul(go,So)|0,zn=zn+Math.imul(go,Co)|0;var vu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(vu>>>26)|0,vu&=67108863,Nn=Math.imul($a,Do),wn=Math.imul($a,zo),wn=wn+Math.imul(Jo,Do)|0,zn=Math.imul(Jo,zo),Nn=Nn+Math.imul(Vo,Ll)|0,wn=wn+Math.imul(Vo,_l)|0,wn=wn+Math.imul(Uo,Ll)|0,zn=zn+Math.imul(Uo,_l)|0,Nn=Nn+Math.imul(No,xl)|0,wn=wn+Math.imul(No,Tl)|0,wn=wn+Math.imul(Fo,xl)|0,zn=zn+Math.imul(Fo,Tl)|0,Nn=Nn+Math.imul(qo,Bl)|0,wn=wn+Math.imul(qo,Il)|0,wn=wn+Math.imul(ga,Bl)|0,zn=zn+Math.imul(ga,Il)|0,Nn=Nn+Math.imul(Lo,Al)|0,wn=wn+Math.imul(Lo,Ol)|0,wn=wn+Math.imul(Wo,Al)|0,zn=zn+Math.imul(Wo,Ol)|0,Nn=Nn+Math.imul(yo,Ul)|0,wn=wn+Math.imul(yo,Sl)|0,wn=wn+Math.imul(_o,Ul)|0,zn=zn+Math.imul(_o,Sl)|0,Nn=Nn+Math.imul(lo,So)|0,wn=wn+Math.imul(lo,Co)|0,wn=wn+Math.imul(Eo,So)|0,zn=zn+Math.imul(Eo,Co)|0,Nn=Nn+Math.imul(vo,po)|0,wn=wn+Math.imul(vo,Ro)|0,wn=wn+Math.imul(go,po)|0,zn=zn+Math.imul(go,Ro)|0;var fu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(fu>>>26)|0,fu&=67108863,Nn=Math.imul(Cl,Do),wn=Math.imul(Cl,zo),wn=wn+Math.imul(ko,Do)|0,zn=Math.imul(ko,zo),Nn=Nn+Math.imul($a,Ll)|0,wn=wn+Math.imul($a,_l)|0,wn=wn+Math.imul(Jo,Ll)|0,zn=zn+Math.imul(Jo,_l)|0,Nn=Nn+Math.imul(Vo,xl)|0,wn=wn+Math.imul(Vo,Tl)|0,wn=wn+Math.imul(Uo,xl)|0,zn=zn+Math.imul(Uo,Tl)|0,Nn=Nn+Math.imul(No,Bl)|0,wn=wn+Math.imul(No,Il)|0,wn=wn+Math.imul(Fo,Bl)|0,zn=zn+Math.imul(Fo,Il)|0,Nn=Nn+Math.imul(qo,Al)|0,wn=wn+Math.imul(qo,Ol)|0,wn=wn+Math.imul(ga,Al)|0,zn=zn+Math.imul(ga,Ol)|0,Nn=Nn+Math.imul(Lo,Ul)|0,wn=wn+Math.imul(Lo,Sl)|0,wn=wn+Math.imul(Wo,Ul)|0,zn=zn+Math.imul(Wo,Sl)|0,Nn=Nn+Math.imul(yo,So)|0,wn=wn+Math.imul(yo,Co)|0,wn=wn+Math.imul(_o,So)|0,zn=zn+Math.imul(_o,Co)|0,Nn=Nn+Math.imul(lo,po)|0,wn=wn+Math.imul(lo,Ro)|0,wn=wn+Math.imul(Eo,po)|0,zn=zn+Math.imul(Eo,Ro)|0,Nn=Nn+Math.imul(vo,jo)|0,wn=wn+Math.imul(vo,Ko)|0,wn=wn+Math.imul(go,jo)|0,zn=zn+Math.imul(go,Ko)|0;var gu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(gu>>>26)|0,gu&=67108863,Nn=Math.imul(bo,Do),wn=Math.imul(bo,zo),wn=wn+Math.imul(Io,Do)|0,zn=Math.imul(Io,zo),Nn=Nn+Math.imul(Cl,Ll)|0,wn=wn+Math.imul(Cl,_l)|0,wn=wn+Math.imul(ko,Ll)|0,zn=zn+Math.imul(ko,_l)|0,Nn=Nn+Math.imul($a,xl)|0,wn=wn+Math.imul($a,Tl)|0,wn=wn+Math.imul(Jo,xl)|0,zn=zn+Math.imul(Jo,Tl)|0,Nn=Nn+Math.imul(Vo,Bl)|0,wn=wn+Math.imul(Vo,Il)|0,wn=wn+Math.imul(Uo,Bl)|0,zn=zn+Math.imul(Uo,Il)|0,Nn=Nn+Math.imul(No,Al)|0,wn=wn+Math.imul(No,Ol)|0,wn=wn+Math.imul(Fo,Al)|0,zn=zn+Math.imul(Fo,Ol)|0,Nn=Nn+Math.imul(qo,Ul)|0,wn=wn+Math.imul(qo,Sl)|0,wn=wn+Math.imul(ga,Ul)|0,zn=zn+Math.imul(ga,Sl)|0,Nn=Nn+Math.imul(Lo,So)|0,wn=wn+Math.imul(Lo,Co)|0,wn=wn+Math.imul(Wo,So)|0,zn=zn+Math.imul(Wo,Co)|0,Nn=Nn+Math.imul(yo,po)|0,wn=wn+Math.imul(yo,Ro)|0,wn=wn+Math.imul(_o,po)|0,zn=zn+Math.imul(_o,Ro)|0,Nn=Nn+Math.imul(lo,jo)|0,wn=wn+Math.imul(lo,Ko)|0,wn=wn+Math.imul(Eo,jo)|0,zn=zn+Math.imul(Eo,Ko)|0,Nn=Nn+Math.imul(vo,$l)|0,wn=wn+Math.imul(vo,El)|0,wn=wn+Math.imul(go,$l)|0,zn=zn+Math.imul(go,El)|0;var ou=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(ou>>>26)|0,ou&=67108863,Nn=Math.imul(bo,Ll),wn=Math.imul(bo,_l),wn=wn+Math.imul(Io,Ll)|0,zn=Math.imul(Io,_l),Nn=Nn+Math.imul(Cl,xl)|0,wn=wn+Math.imul(Cl,Tl)|0,wn=wn+Math.imul(ko,xl)|0,zn=zn+Math.imul(ko,Tl)|0,Nn=Nn+Math.imul($a,Bl)|0,wn=wn+Math.imul($a,Il)|0,wn=wn+Math.imul(Jo,Bl)|0,zn=zn+Math.imul(Jo,Il)|0,Nn=Nn+Math.imul(Vo,Al)|0,wn=wn+Math.imul(Vo,Ol)|0,wn=wn+Math.imul(Uo,Al)|0,zn=zn+Math.imul(Uo,Ol)|0,Nn=Nn+Math.imul(No,Ul)|0,wn=wn+Math.imul(No,Sl)|0,wn=wn+Math.imul(Fo,Ul)|0,zn=zn+Math.imul(Fo,Sl)|0,Nn=Nn+Math.imul(qo,So)|0,wn=wn+Math.imul(qo,Co)|0,wn=wn+Math.imul(ga,So)|0,zn=zn+Math.imul(ga,Co)|0,Nn=Nn+Math.imul(Lo,po)|0,wn=wn+Math.imul(Lo,Ro)|0,wn=wn+Math.imul(Wo,po)|0,zn=zn+Math.imul(Wo,Ro)|0,Nn=Nn+Math.imul(yo,jo)|0,wn=wn+Math.imul(yo,Ko)|0,wn=wn+Math.imul(_o,jo)|0,zn=zn+Math.imul(_o,Ko)|0,Nn=Nn+Math.imul(lo,$l)|0,wn=wn+Math.imul(lo,El)|0,wn=wn+Math.imul(Eo,$l)|0,zn=zn+Math.imul(Eo,El)|0;var su=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(su>>>26)|0,su&=67108863,Nn=Math.imul(bo,xl),wn=Math.imul(bo,Tl),wn=wn+Math.imul(Io,xl)|0,zn=Math.imul(Io,Tl),Nn=Nn+Math.imul(Cl,Bl)|0,wn=wn+Math.imul(Cl,Il)|0,wn=wn+Math.imul(ko,Bl)|0,zn=zn+Math.imul(ko,Il)|0,Nn=Nn+Math.imul($a,Al)|0,wn=wn+Math.imul($a,Ol)|0,wn=wn+Math.imul(Jo,Al)|0,zn=zn+Math.imul(Jo,Ol)|0,Nn=Nn+Math.imul(Vo,Ul)|0,wn=wn+Math.imul(Vo,Sl)|0,wn=wn+Math.imul(Uo,Ul)|0,zn=zn+Math.imul(Uo,Sl)|0,Nn=Nn+Math.imul(No,So)|0,wn=wn+Math.imul(No,Co)|0,wn=wn+Math.imul(Fo,So)|0,zn=zn+Math.imul(Fo,Co)|0,Nn=Nn+Math.imul(qo,po)|0,wn=wn+Math.imul(qo,Ro)|0,wn=wn+Math.imul(ga,po)|0,zn=zn+Math.imul(ga,Ro)|0,Nn=Nn+Math.imul(Lo,jo)|0,wn=wn+Math.imul(Lo,Ko)|0,wn=wn+Math.imul(Wo,jo)|0,zn=zn+Math.imul(Wo,Ko)|0,Nn=Nn+Math.imul(yo,$l)|0,wn=wn+Math.imul(yo,El)|0,wn=wn+Math.imul(_o,$l)|0,zn=zn+Math.imul(_o,El)|0;var tu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(tu>>>26)|0,tu&=67108863,Nn=Math.imul(bo,Bl),wn=Math.imul(bo,Il),wn=wn+Math.imul(Io,Bl)|0,zn=Math.imul(Io,Il),Nn=Nn+Math.imul(Cl,Al)|0,wn=wn+Math.imul(Cl,Ol)|0,wn=wn+Math.imul(ko,Al)|0,zn=zn+Math.imul(ko,Ol)|0,Nn=Nn+Math.imul($a,Ul)|0,wn=wn+Math.imul($a,Sl)|0,wn=wn+Math.imul(Jo,Ul)|0,zn=zn+Math.imul(Jo,Sl)|0,Nn=Nn+Math.imul(Vo,So)|0,wn=wn+Math.imul(Vo,Co)|0,wn=wn+Math.imul(Uo,So)|0,zn=zn+Math.imul(Uo,Co)|0,Nn=Nn+Math.imul(No,po)|0,wn=wn+Math.imul(No,Ro)|0,wn=wn+Math.imul(Fo,po)|0,zn=zn+Math.imul(Fo,Ro)|0,Nn=Nn+Math.imul(qo,jo)|0,wn=wn+Math.imul(qo,Ko)|0,wn=wn+Math.imul(ga,jo)|0,zn=zn+Math.imul(ga,Ko)|0,Nn=Nn+Math.imul(Lo,$l)|0,wn=wn+Math.imul(Lo,El)|0,wn=wn+Math.imul(Wo,$l)|0,zn=zn+Math.imul(Wo,El)|0;var zl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(zl>>>26)|0,zl&=67108863,Nn=Math.imul(bo,Al),wn=Math.imul(bo,Ol),wn=wn+Math.imul(Io,Al)|0,zn=Math.imul(Io,Ol),Nn=Nn+Math.imul(Cl,Ul)|0,wn=wn+Math.imul(Cl,Sl)|0,wn=wn+Math.imul(ko,Ul)|0,zn=zn+Math.imul(ko,Sl)|0,Nn=Nn+Math.imul($a,So)|0,wn=wn+Math.imul($a,Co)|0,wn=wn+Math.imul(Jo,So)|0,zn=zn+Math.imul(Jo,Co)|0,Nn=Nn+Math.imul(Vo,po)|0,wn=wn+Math.imul(Vo,Ro)|0,wn=wn+Math.imul(Uo,po)|0,zn=zn+Math.imul(Uo,Ro)|0,Nn=Nn+Math.imul(No,jo)|0,wn=wn+Math.imul(No,Ko)|0,wn=wn+Math.imul(Fo,jo)|0,zn=zn+Math.imul(Fo,Ko)|0,Nn=Nn+Math.imul(qo,$l)|0,wn=wn+Math.imul(qo,El)|0,wn=wn+Math.imul(ga,$l)|0,zn=zn+Math.imul(ga,El)|0;var Gl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Gl>>>26)|0,Gl&=67108863,Nn=Math.imul(bo,Ul),wn=Math.imul(bo,Sl),wn=wn+Math.imul(Io,Ul)|0,zn=Math.imul(Io,Sl),Nn=Nn+Math.imul(Cl,So)|0,wn=wn+Math.imul(Cl,Co)|0,wn=wn+Math.imul(ko,So)|0,zn=zn+Math.imul(ko,Co)|0,Nn=Nn+Math.imul($a,po)|0,wn=wn+Math.imul($a,Ro)|0,wn=wn+Math.imul(Jo,po)|0,zn=zn+Math.imul(Jo,Ro)|0,Nn=Nn+Math.imul(Vo,jo)|0,wn=wn+Math.imul(Vo,Ko)|0,wn=wn+Math.imul(Uo,jo)|0,zn=zn+Math.imul(Uo,Ko)|0,Nn=Nn+Math.imul(No,$l)|0,wn=wn+Math.imul(No,El)|0,wn=wn+Math.imul(Fo,$l)|0,zn=zn+Math.imul(Fo,El)|0;var Jl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Jl>>>26)|0,Jl&=67108863,Nn=Math.imul(bo,So),wn=Math.imul(bo,Co),wn=wn+Math.imul(Io,So)|0,zn=Math.imul(Io,Co),Nn=Nn+Math.imul(Cl,po)|0,wn=wn+Math.imul(Cl,Ro)|0,wn=wn+Math.imul(ko,po)|0,zn=zn+Math.imul(ko,Ro)|0,Nn=Nn+Math.imul($a,jo)|0,wn=wn+Math.imul($a,Ko)|0,wn=wn+Math.imul(Jo,jo)|0,zn=zn+Math.imul(Jo,Ko)|0,Nn=Nn+Math.imul(Vo,$l)|0,wn=wn+Math.imul(Vo,El)|0,wn=wn+Math.imul(Uo,$l)|0,zn=zn+Math.imul(Uo,El)|0;var Pl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Pl>>>26)|0,Pl&=67108863,Nn=Math.imul(bo,po),wn=Math.imul(bo,Ro),wn=wn+Math.imul(Io,po)|0,zn=Math.imul(Io,Ro),Nn=Nn+Math.imul(Cl,jo)|0,wn=wn+Math.imul(Cl,Ko)|0,wn=wn+Math.imul(ko,jo)|0,zn=zn+Math.imul(ko,Ko)|0,Nn=Nn+Math.imul($a,$l)|0,wn=wn+Math.imul($a,El)|0,wn=wn+Math.imul(Jo,$l)|0,zn=zn+Math.imul(Jo,El)|0;var Fl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Fl>>>26)|0,Fl&=67108863,Nn=Math.imul(bo,jo),wn=Math.imul(bo,Ko),wn=wn+Math.imul(Io,jo)|0,zn=Math.imul(Io,Ko),Nn=Nn+Math.imul(Cl,$l)|0,wn=wn+Math.imul(Cl,El)|0,wn=wn+Math.imul(ko,$l)|0,zn=zn+Math.imul(ko,El)|0;var Yl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Yl>>>26)|0,Yl&=67108863,Nn=Math.imul(bo,$l),wn=Math.imul(bo,El),wn=wn+Math.imul(Io,$l)|0,zn=Math.imul(Io,El);var Vl=(Zn+Nn|0)+((wn&8191)<<13)|0;return Zn=(zn+(wn>>>13)|0)+(Vl>>>26)|0,Vl&=67108863,On[0]=Cu,On[1]=iu,On[2]=pu,On[3]=yu,On[4]=hu,On[5]=mu,On[6]=vu,On[7]=fu,On[8]=gu,On[9]=ou,On[10]=su,On[11]=tu,On[12]=zl,On[13]=Gl,On[14]=Jl,On[15]=Pl,On[16]=Fl,On[17]=Yl,On[18]=Vl,Zn!==0&&(On[19]=Zn,Sn.length++),Sn};Math.imul||(An=In);function jn(Tn,Hr,Xr){Xr.negative=Hr.negative^Tn.negative,Xr.length=Tn.length+Hr.length;for(var Sn=0,Rn=0,Pn=0;Pn>>26)|0,Rn+=On>>>26,On&=67108863}Xr.words[Pn]=Zn,Sn=On,On=Rn}return Sn!==0?Xr.words[Pn]=Sn:Xr.length--,Xr._strip()}function eo(Tn,Hr,Xr){return jn(Tn,Hr,Xr)}jr.prototype.mulTo=function(Hr,Xr){var Sn,Rn=this.length+Hr.length;return this.length===10&&Hr.length===10?Sn=An(this,Hr,Xr):Rn<63?Sn=In(this,Hr,Xr):Rn<1024?Sn=jn(this,Hr,Xr):Sn=eo(this,Hr,Xr),Sn},jr.prototype.mul=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),this.mulTo(Hr,Xr)},jr.prototype.mulf=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),eo(this,Hr,Xr)},jr.prototype.imul=function(Hr){return this.clone().mulTo(Hr,this)},jr.prototype.imuln=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(typeof Hr=="number"),Er(Hr<67108864);for(var Sn=0,Rn=0;Rn>=26,Sn+=Pn/67108864|0,Sn+=On>>>26,this.words[Rn]=On&67108863}return Sn!==0&&(this.words[Rn]=Sn,this.length++),Xr?this.ineg():this},jr.prototype.muln=function(Hr){return this.clone().imuln(Hr)},jr.prototype.sqr=function(){return this.mul(this)},jr.prototype.isqr=function(){return this.imul(this.clone())},jr.prototype.pow=function(Hr){var Xr=Cn(Hr);if(Xr.length===0)return new jr(1);for(var Sn=this,Rn=0;Rn=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=67108863>>>26-Xr<<26-Xr,Pn;if(Xr!==0){var On=0;for(Pn=0;Pn>>26-Xr}On&&(this.words[Pn]=On,this.length++)}if(Sn!==0){for(Pn=this.length-1;Pn>=0;Pn--)this.words[Pn+Sn]=this.words[Pn];for(Pn=0;Pn=0);var Rn;Xr?Rn=(Xr-Xr%26)/26:Rn=0;var Pn=Hr%26,On=Math.min((Hr-Pn)/26,this.length),Zn=67108863^67108863>>>Pn<On)for(this.length-=On,wn=0;wn=0&&(zn!==0||wn>=Rn);wn--){var fo=this.words[wn]|0;this.words[wn]=zn<<26-Pn|fo>>>Pn,zn=fo&Zn}return Nn&&zn!==0&&(Nn.words[Nn.length++]=zn),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},jr.prototype.ishrn=function(Hr,Xr,Sn){return Er(this.negative===0),this.iushrn(Hr,Xr,Sn)},jr.prototype.shln=function(Hr){return this.clone().ishln(Hr)},jr.prototype.ushln=function(Hr){return this.clone().iushln(Hr)},jr.prototype.shrn=function(Hr){return this.clone().ishrn(Hr)},jr.prototype.ushrn=function(Hr){return this.clone().iushrn(Hr)},jr.prototype.testn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<=0);var Xr=Hr%26,Sn=(Hr-Xr)/26;if(Er(this.negative===0,"imaskn works only with positive numbers"),this.length<=Sn)return this;if(Xr!==0&&Sn++,this.length=Math.min(Sn,this.length),Xr!==0){var Rn=67108863^67108863>>>Xr<=67108864;Xr++)this.words[Xr]-=67108864,Xr===this.length-1?this.words[Xr+1]=1:this.words[Xr+1]++;return this.length=Math.max(this.length,Xr+1),this},jr.prototype.isubn=function(Hr){if(Er(typeof Hr=="number"),Er(Hr<67108864),Hr<0)return this.iaddn(-Hr);if(this.negative!==0)return this.negative=0,this.iaddn(Hr),this.negative=1,this;if(this.words[0]-=Hr,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Xr=0;Xr>26)-(Nn/67108864|0),this.words[Pn+Sn]=On&67108863}for(;Pn>26,this.words[Pn+Sn]=On&67108863;if(Zn===0)return this._strip();for(Er(Zn===-1),Zn=0,Pn=0;Pn>26,this.words[Pn]=On&67108863;return this.negative=1,this._strip()},jr.prototype._wordDiv=function(Hr,Xr){var Sn=this.length-Hr.length,Rn=this.clone(),Pn=Hr,On=Pn.words[Pn.length-1]|0,Zn=this._countBits(On);Sn=26-Zn,Sn!==0&&(Pn=Pn.ushln(Sn),Rn.iushln(Sn),On=Pn.words[Pn.length-1]|0);var Nn=Rn.length-Pn.length,wn;if(Xr!=="mod"){wn=new jr(null),wn.length=Nn+1,wn.words=new Array(wn.length);for(var zn=0;zn=0;vo--){var go=(Rn.words[Pn.length+vo]|0)*67108864+(Rn.words[Pn.length+vo-1]|0);for(go=Math.min(go/On|0,67108863),Rn._ishlnsubmul(Pn,go,vo);Rn.negative!==0;)go--,Rn.negative=0,Rn._ishlnsubmul(Pn,1,vo),Rn.isZero()||(Rn.negative^=1);wn&&(wn.words[vo]=go)}return wn&&wn._strip(),Rn._strip(),Xr!=="div"&&Sn!==0&&Rn.iushrn(Sn),{div:wn||null,mod:Rn}},jr.prototype.divmod=function(Hr,Xr,Sn){if(Er(!Hr.isZero()),this.isZero())return{div:new jr(0),mod:new jr(0)};var Rn,Pn,On;return this.negative!==0&&Hr.negative===0?(On=this.neg().divmod(Hr,Xr),Xr!=="mod"&&(Rn=On.div.neg()),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.iadd(Hr)),{div:Rn,mod:Pn}):this.negative===0&&Hr.negative!==0?(On=this.divmod(Hr.neg(),Xr),Xr!=="mod"&&(Rn=On.div.neg()),{div:Rn,mod:On.mod}):this.negative&Hr.negative?(On=this.neg().divmod(Hr.neg(),Xr),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.isub(Hr)),{div:On.div,mod:Pn}):Hr.length>this.length||this.cmp(Hr)<0?{div:new jr(0),mod:this}:Hr.length===1?Xr==="div"?{div:this.divn(Hr.words[0]),mod:null}:Xr==="mod"?{div:null,mod:new jr(this.modrn(Hr.words[0]))}:{div:this.divn(Hr.words[0]),mod:new jr(this.modrn(Hr.words[0]))}:this._wordDiv(Hr,Xr)},jr.prototype.div=function(Hr){return this.divmod(Hr,"div",!1).div},jr.prototype.mod=function(Hr){return this.divmod(Hr,"mod",!1).mod},jr.prototype.umod=function(Hr){return this.divmod(Hr,"mod",!0).mod},jr.prototype.divRound=function(Hr){var Xr=this.divmod(Hr);if(Xr.mod.isZero())return Xr.div;var Sn=Xr.div.negative!==0?Xr.mod.isub(Hr):Xr.mod,Rn=Hr.ushrn(1),Pn=Hr.andln(1),On=Sn.cmp(Rn);return On<0||Pn===1&&On===0?Xr.div:Xr.div.negative!==0?Xr.div.isubn(1):Xr.div.iaddn(1)},jr.prototype.modrn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=(1<<26)%Hr,Rn=0,Pn=this.length-1;Pn>=0;Pn--)Rn=(Sn*Rn+(this.words[Pn]|0))%Hr;return Xr?-Rn:Rn},jr.prototype.modn=function(Hr){return this.modrn(Hr)},jr.prototype.idivn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=0,Rn=this.length-1;Rn>=0;Rn--){var Pn=(this.words[Rn]|0)+Sn*67108864;this.words[Rn]=Pn/Hr|0,Sn=Pn%Hr}return this._strip(),Xr?this.ineg():this},jr.prototype.divn=function(Hr){return this.clone().idivn(Hr)},jr.prototype.egcd=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=new jr(0),Zn=new jr(1),Nn=0;Xr.isEven()&&Sn.isEven();)Xr.iushrn(1),Sn.iushrn(1),++Nn;for(var wn=Sn.clone(),zn=Xr.clone();!Xr.isZero();){for(var fo=0,vo=1;!(Xr.words[0]&vo)&&fo<26;++fo,vo<<=1);if(fo>0)for(Xr.iushrn(fo);fo-- >0;)(Rn.isOdd()||Pn.isOdd())&&(Rn.iadd(wn),Pn.isub(zn)),Rn.iushrn(1),Pn.iushrn(1);for(var go=0,uo=1;!(Sn.words[0]&uo)&&go<26;++go,uo<<=1);if(go>0)for(Sn.iushrn(go);go-- >0;)(On.isOdd()||Zn.isOdd())&&(On.iadd(wn),Zn.isub(zn)),On.iushrn(1),Zn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(On),Pn.isub(Zn)):(Sn.isub(Xr),On.isub(Rn),Zn.isub(Pn))}return{a:On,b:Zn,gcd:Sn.iushln(Nn)}},jr.prototype._invmp=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=Sn.clone();Xr.cmpn(1)>0&&Sn.cmpn(1)>0;){for(var Zn=0,Nn=1;!(Xr.words[0]&Nn)&&Zn<26;++Zn,Nn<<=1);if(Zn>0)for(Xr.iushrn(Zn);Zn-- >0;)Rn.isOdd()&&Rn.iadd(On),Rn.iushrn(1);for(var wn=0,zn=1;!(Sn.words[0]&zn)&&wn<26;++wn,zn<<=1);if(wn>0)for(Sn.iushrn(wn);wn-- >0;)Pn.isOdd()&&Pn.iadd(On),Pn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(Pn)):(Sn.isub(Xr),Pn.isub(Rn))}var fo;return Xr.cmpn(1)===0?fo=Rn:fo=Pn,fo.cmpn(0)<0&&fo.iadd(Hr),fo},jr.prototype.gcd=function(Hr){if(this.isZero())return Hr.abs();if(Hr.isZero())return this.abs();var Xr=this.clone(),Sn=Hr.clone();Xr.negative=0,Sn.negative=0;for(var Rn=0;Xr.isEven()&&Sn.isEven();Rn++)Xr.iushrn(1),Sn.iushrn(1);do{for(;Xr.isEven();)Xr.iushrn(1);for(;Sn.isEven();)Sn.iushrn(1);var Pn=Xr.cmp(Sn);if(Pn<0){var On=Xr;Xr=Sn,Sn=On}else if(Pn===0||Sn.cmpn(1)===0)break;Xr.isub(Sn)}while(!0);return Sn.iushln(Rn)},jr.prototype.invm=function(Hr){return this.egcd(Hr).a.umod(Hr)},jr.prototype.isEven=function(){return(this.words[0]&1)===0},jr.prototype.isOdd=function(){return(this.words[0]&1)===1},jr.prototype.andln=function(Hr){return this.words[0]&Hr},jr.prototype.bincn=function(Hr){Er(typeof Hr=="number");var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<>>26,Zn&=67108863,this.words[On]=Zn}return Pn!==0&&(this.words[On]=Pn,this.length++),this},jr.prototype.isZero=function(){return this.length===1&&this.words[0]===0},jr.prototype.cmpn=function(Hr){var Xr=Hr<0;if(this.negative!==0&&!Xr)return-1;if(this.negative===0&&Xr)return 1;this._strip();var Sn;if(this.length>1)Sn=1;else{Xr&&(Hr=-Hr),Er(Hr<=67108863,"Number is too big");var Rn=this.words[0]|0;Sn=Rn===Hr?0:RnHr.length)return 1;if(this.length=0;Sn--){var Rn=this.words[Sn]|0,Pn=Hr.words[Sn]|0;if(Rn!==Pn){RnPn&&(Xr=1);break}}return Xr},jr.prototype.gtn=function(Hr){return this.cmpn(Hr)===1},jr.prototype.gt=function(Hr){return this.cmp(Hr)===1},jr.prototype.gten=function(Hr){return this.cmpn(Hr)>=0},jr.prototype.gte=function(Hr){return this.cmp(Hr)>=0},jr.prototype.ltn=function(Hr){return this.cmpn(Hr)===-1},jr.prototype.lt=function(Hr){return this.cmp(Hr)===-1},jr.prototype.lten=function(Hr){return this.cmpn(Hr)<=0},jr.prototype.lte=function(Hr){return this.cmp(Hr)<=0},jr.prototype.eqn=function(Hr){return this.cmpn(Hr)===0},jr.prototype.eq=function(Hr){return this.cmp(Hr)===0},jr.red=function(Hr){return new so(Hr)},jr.prototype.toRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),Er(this.negative===0,"red works only with positives"),Hr.convertTo(this)._forceRed(Hr)},jr.prototype.fromRed=function(){return Er(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},jr.prototype._forceRed=function(Hr){return this.red=Hr,this},jr.prototype.forceRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),this._forceRed(Hr)},jr.prototype.redAdd=function(Hr){return Er(this.red,"redAdd works only with red numbers"),this.red.add(this,Hr)},jr.prototype.redIAdd=function(Hr){return Er(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Hr)},jr.prototype.redSub=function(Hr){return Er(this.red,"redSub works only with red numbers"),this.red.sub(this,Hr)},jr.prototype.redISub=function(Hr){return Er(this.red,"redISub works only with red numbers"),this.red.isub(this,Hr)},jr.prototype.redShl=function(Hr){return Er(this.red,"redShl works only with red numbers"),this.red.shl(this,Hr)},jr.prototype.redMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.mul(this,Hr)},jr.prototype.redIMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.imul(this,Hr)},jr.prototype.redSqr=function(){return Er(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},jr.prototype.redISqr=function(){return Er(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},jr.prototype.redSqrt=function(){return Er(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},jr.prototype.redInvm=function(){return Er(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},jr.prototype.redNeg=function(){return Er(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},jr.prototype.redPow=function(Hr){return Er(this.red&&!Hr.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Hr)};var ro={k256:null,p224:null,p192:null,p25519:null};function to(Tn,Hr){this.name=Tn,this.p=new jr(Hr,16),this.n=this.p.bitLength(),this.k=new jr(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}to.prototype._tmp=function(){var Hr=new jr(null);return Hr.words=new Array(Math.ceil(this.n/13)),Hr},to.prototype.ireduce=function(Hr){var Xr=Hr,Sn;do this.split(Xr,this.tmp),Xr=this.imulK(Xr),Xr=Xr.iadd(this.tmp),Sn=Xr.bitLength();while(Sn>this.n);var Rn=Sn0?Xr.isub(this.p):Xr.strip!==void 0?Xr.strip():Xr._strip(),Xr},to.prototype.split=function(Hr,Xr){Hr.iushrn(this.n,0,Xr)},to.prototype.imulK=function(Hr){return Hr.imul(this.k)};function _i(){to.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}kr(_i,to),_i.prototype.split=function(Hr,Xr){for(var Sn=4194303,Rn=Math.min(Hr.length,9),Pn=0;Pn>>22,On=Zn}On>>>=22,Hr.words[Pn-10]=On,On===0&&Hr.length>10?Hr.length-=10:Hr.length-=9},_i.prototype.imulK=function(Hr){Hr.words[Hr.length]=0,Hr.words[Hr.length+1]=0,Hr.length+=2;for(var Xr=0,Sn=0;Sn>>=26,Hr.words[Sn]=Pn,Xr=Rn}return Xr!==0&&(Hr.words[Hr.length++]=Xr),Hr},jr._prime=function(Hr){if(ro[Hr])return ro[Hr];var Xr;if(Hr==="k256")Xr=new _i;else if(Hr==="p224")Xr=new oo;else if(Hr==="p192")Xr=new io;else if(Hr==="p25519")Xr=new co;else throw new Error("Unknown prime "+Hr);return ro[Hr]=Xr,Xr};function so(Tn){if(typeof Tn=="string"){var Hr=jr._prime(Tn);this.m=Hr.p,this.prime=Hr}else Er(Tn.gtn(1),"modulus must be greater than 1"),this.m=Tn,this.prime=null}so.prototype._verify1=function(Hr){Er(Hr.negative===0,"red works only with positives"),Er(Hr.red,"red works only with red numbers")},so.prototype._verify2=function(Hr,Xr){Er((Hr.negative|Xr.negative)===0,"red works only with positives"),Er(Hr.red&&Hr.red===Xr.red,"red works only with red numbers")},so.prototype.imod=function(Hr){return this.prime?this.prime.ireduce(Hr)._forceRed(this):(Vr(Hr,Hr.umod(this.m)._forceRed(this)),Hr)},so.prototype.neg=function(Hr){return Hr.isZero()?Hr.clone():this.m.sub(Hr)._forceRed(this)},so.prototype.add=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.add(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn._forceRed(this)},so.prototype.iadd=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.iadd(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn},so.prototype.sub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.sub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn._forceRed(this)},so.prototype.isub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.isub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn},so.prototype.shl=function(Hr,Xr){return this._verify1(Hr),this.imod(Hr.ushln(Xr))},so.prototype.imul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.imul(Xr))},so.prototype.mul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.mul(Xr))},so.prototype.isqr=function(Hr){return this.imul(Hr,Hr.clone())},so.prototype.sqr=function(Hr){return this.mul(Hr,Hr)},so.prototype.sqrt=function(Hr){if(Hr.isZero())return Hr.clone();var Xr=this.m.andln(3);if(Er(Xr%2===1),Xr===3){var Sn=this.m.add(new jr(1)).iushrn(2);return this.pow(Hr,Sn)}for(var Rn=this.m.subn(1),Pn=0;!Rn.isZero()&&Rn.andln(1)===0;)Pn++,Rn.iushrn(1);Er(!Rn.isZero());var On=new jr(1).toRed(this),Zn=On.redNeg(),Nn=this.m.subn(1).iushrn(1),wn=this.m.bitLength();for(wn=new jr(2*wn*wn).toRed(this);this.pow(wn,Nn).cmp(Zn)!==0;)wn.redIAdd(Zn);for(var zn=this.pow(wn,Rn),fo=this.pow(Hr,Rn.addn(1).iushrn(1)),vo=this.pow(Hr,Rn),go=Pn;vo.cmp(On)!==0;){for(var uo=vo,lo=0;uo.cmp(On)!==0;lo++)uo=uo.redSqr();Er(lo=0;Pn--){for(var zn=Xr.words[Pn],fo=wn-1;fo>=0;fo--){var vo=zn>>fo&1;if(On!==Rn[0]&&(On=this.sqr(On)),vo===0&&Zn===0){Nn=0;continue}Zn<<=1,Zn|=vo,Nn++,!(Nn!==Sn&&(Pn!==0||fo!==0))&&(On=this.mul(On,Rn[Zn]),Nn=0,Zn=0)}wn=26}return On},so.prototype.convertTo=function(Hr){var Xr=Hr.umod(this.m);return Xr===Hr?Xr.clone():Xr},so.prototype.convertFrom=function(Hr){var Xr=Hr.clone();return Xr.red=null,Xr},jr.mont=function(Hr){return new no(Hr)};function no(Tn){so.call(this,Tn),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new jr(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}kr(no,so),no.prototype.convertTo=function(Hr){return this.imod(Hr.ushln(this.shift))},no.prototype.convertFrom=function(Hr){var Xr=this.imod(Hr.mul(this.rinv));return Xr.red=null,Xr},no.prototype.imul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return Hr.words[0]=0,Hr.length=1,Hr;var Sn=Hr.imul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.mul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return new jr(0)._forceRed(this);var Sn=Hr.mul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.invm=function(Hr){var Xr=this.imod(Hr._invmp(this.m).mul(this.r2));return Xr._forceRed(this)}})(fr,commonjsGlobal)}(bn$5)),bn$5.exports}var browserifyRsa,hasRequiredBrowserifyRsa;function requireBrowserifyRsa(){if(hasRequiredBrowserifyRsa)return browserifyRsa;hasRequiredBrowserifyRsa=1;var fr=requireBn$1(),br=requireBrowser$b(),wr=safeBufferExports.Buffer;function Er(Br){var Wr=Br.modulus.byteLength(),qr;do qr=new fr(br(Wr));while(qr.cmp(Br.modulus)>=0||!qr.umod(Br.prime1)||!qr.umod(Br.prime2));return qr}function kr(Br){var Wr=Er(Br),qr=Wr.toRed(fr.mont(Br.modulus)).redPow(new fr(Br.publicExponent)).fromRed();return{blinder:qr,unblinder:Wr.invm(Br.modulus)}}function jr(Br,Wr){var qr=kr(Wr),Gr=Wr.modulus.byteLength(),Vr=new fr(Br).mul(qr.blinder).umod(Wr.modulus),Zr=Vr.toRed(fr.mont(Wr.prime1)),Jr=Vr.toRed(fr.mont(Wr.prime2)),Qr=Wr.coefficient,_n=Wr.prime1,En=Wr.prime2,Cn=Zr.redPow(Wr.exponent1).fromRed(),In=Jr.redPow(Wr.exponent2).fromRed(),An=Cn.isub(In).imul(Qr).umod(_n).imul(En);return In.iadd(An).imul(qr.unblinder).umod(Wr.modulus).toArrayLike(wr,"be",Gr)}return jr.getr=Er,browserifyRsa=jr,browserifyRsa}var elliptic={};const name="elliptic",version$e="6.6.1",description="EC cryptography",main="lib/elliptic.js",files=["lib"],scripts={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository={type:"git",url:"git@github.com:indutny/elliptic"},keywords=["EC","Elliptic","curve","Cryptography"],author="Fedor Indutny ",license="MIT",bugs={url:"https://github.com/indutny/elliptic/issues"},homepage="https://github.com/indutny/elliptic",devDependencies={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies$1={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0$8={name,version:version$e,description,main,files,scripts,repository,keywords,author,license,bugs,homepage,devDependencies,dependencies:dependencies$1};var utils$5={},utils$4={},hasRequiredUtils$3;function requireUtils$3(){return hasRequiredUtils$3||(hasRequiredUtils$3=1,function(fr){var br=fr;function wr(jr,Br){if(Array.isArray(jr))return jr.slice();if(!jr)return[];var Wr=[];if(typeof jr!="string"){for(var qr=0;qr>8,Zr=Gr&255;Vr?Wr.push(Vr,Zr):Wr.push(Zr)}return Wr}br.toArray=wr;function Er(jr){return jr.length===1?"0"+jr:jr}br.zero2=Er;function kr(jr){for(var Br="",Wr=0;Wr(En>>1)-1?In=(En>>1)-An:In=An,Cn.isubn(In)):In=0,Qr[_n]=In,Cn.iushrn(1)}return Qr}br.getNAF=jr;function Br(Vr,Zr){var Jr=[[],[]];Vr=Vr.clone(),Zr=Zr.clone();for(var Qr=0,_n=0,En;Vr.cmpn(-Qr)>0||Zr.cmpn(-_n)>0;){var Cn=Vr.andln(3)+Qr&3,In=Zr.andln(3)+_n&3;Cn===3&&(Cn=-1),In===3&&(In=-1);var An;Cn&1?(En=Vr.andln(7)+Qr&7,(En===3||En===5)&&In===2?An=-Cn:An=Cn):An=0,Jr[0].push(An);var jn;In&1?(En=Zr.andln(7)+_n&7,(En===3||En===5)&&Cn===2?jn=-In:jn=In):jn=0,Jr[1].push(jn),2*Qr===An+1&&(Qr=1-Qr),2*_n===jn+1&&(_n=1-_n),Vr.iushrn(1),Zr.iushrn(1)}return Jr}br.getJSF=Br;function Wr(Vr,Zr,Jr){var Qr="_"+Zr;Vr.prototype[Zr]=function(){return this[Qr]!==void 0?this[Qr]:this[Qr]=Jr.call(this)}}br.cachedProperty=Wr;function qr(Vr){return typeof Vr=="string"?br.toArray(Vr,"hex"):Vr}br.parseBytes=qr;function Gr(Vr){return new wr(Vr,"hex","le")}br.intFromLE=Gr}(utils$5)),utils$5}var curve={},base$6,hasRequiredBase$1;function requireBase$1(){if(hasRequiredBase$1)return base$6;hasRequiredBase$1=1;var fr=requireBn$2(),br=requireUtils$2(),wr=br.getNAF,Er=br.getJSF,kr=br.assert;function jr(Wr,qr){this.type=Wr,this.p=new fr(qr.p,16),this.red=qr.prime?fr.red(qr.prime):fr.mont(this.p),this.zero=new fr(0).toRed(this.red),this.one=new fr(1).toRed(this.red),this.two=new fr(2).toRed(this.red),this.n=qr.n&&new fr(qr.n,16),this.g=qr.g&&this.pointFromJSON(qr.g,qr.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var Gr=this.n&&this.p.div(this.n);!Gr||Gr.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}base$6=jr,jr.prototype.point=function(){throw new Error("Not implemented")},jr.prototype.validate=function(){throw new Error("Not implemented")},jr.prototype._fixedNafMul=function(qr,Gr){kr(qr.precomputed);var Vr=qr._getDoubles(),Zr=wr(Gr,1,this._bitLength),Jr=(1<=_n;Cn--)En=(En<<1)+Zr[Cn];Qr.push(En)}for(var In=this.jpoint(null,null,null),An=this.jpoint(null,null,null),jn=Jr;jn>0;jn--){for(_n=0;_n=0;En--){for(var Cn=0;En>=0&&Qr[En]===0;En--)Cn++;if(En>=0&&Cn++,_n=_n.dblp(Cn),En<0)break;var In=Qr[En];kr(In!==0),qr.type==="affine"?In>0?_n=_n.mixedAdd(Jr[In-1>>1]):_n=_n.mixedAdd(Jr[-In-1>>1].neg()):In>0?_n=_n.add(Jr[In-1>>1]):_n=_n.add(Jr[-In-1>>1].neg())}return qr.type==="affine"?_n.toP():_n},jr.prototype._wnafMulAdd=function(qr,Gr,Vr,Zr,Jr){var Qr=this._wnafT1,_n=this._wnafT2,En=this._wnafT3,Cn=0,In,An,jn;for(In=0;In=1;In-=2){var ro=In-1,to=In;if(Qr[ro]!==1||Qr[to]!==1){En[ro]=wr(Vr[ro],Qr[ro],this._bitLength),En[to]=wr(Vr[to],Qr[to],this._bitLength),Cn=Math.max(En[ro].length,Cn),Cn=Math.max(En[to].length,Cn);continue}var _i=[Gr[ro],null,null,Gr[to]];Gr[ro].y.cmp(Gr[to].y)===0?(_i[1]=Gr[ro].add(Gr[to]),_i[2]=Gr[ro].toJ().mixedAdd(Gr[to].neg())):Gr[ro].y.cmp(Gr[to].y.redNeg())===0?(_i[1]=Gr[ro].toJ().mixedAdd(Gr[to]),_i[2]=Gr[ro].add(Gr[to].neg())):(_i[1]=Gr[ro].toJ().mixedAdd(Gr[to]),_i[2]=Gr[ro].toJ().mixedAdd(Gr[to].neg()));var oo=[-3,-1,-5,-7,0,7,5,1,3],io=Er(Vr[ro],Vr[to]);for(Cn=Math.max(io[0].length,Cn),En[ro]=new Array(Cn),En[to]=new Array(Cn),An=0;An=0;In--){for(var Hr=0;In>=0;){var Xr=!0;for(An=0;An=0&&Hr++,no=no.dblp(Hr),In<0)break;for(An=0;An0?jn=_n[An][Sn-1>>1]:Sn<0&&(jn=_n[An][-Sn-1>>1].neg()),jn.type==="affine"?no=no.mixedAdd(jn):no=no.add(jn))}}for(In=0;In=Math.ceil((qr.bitLength()+1)/Gr.step):!1},Br.prototype._getDoubles=function(qr,Gr){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var Vr=[this],Zr=this,Jr=0;Jr=0&&(ro=In,to=An),jn.negative&&(jn=jn.neg(),eo=eo.neg()),ro.negative&&(ro=ro.neg(),to=to.neg()),[{a:jn,b:eo},{a:ro,b:to}]},jr.prototype._endoSplit=function(Gr){var Vr=this.endo.basis,Zr=Vr[0],Jr=Vr[1],Qr=Jr.b.mul(Gr).divRound(this.n),_n=Zr.b.neg().mul(Gr).divRound(this.n),En=Qr.mul(Zr.a),Cn=_n.mul(Jr.a),In=Qr.mul(Zr.b),An=_n.mul(Jr.b),jn=Gr.sub(En).sub(Cn),eo=In.add(An).neg();return{k1:jn,k2:eo}},jr.prototype.pointFromX=function(Gr,Vr){Gr=new br(Gr,16),Gr.red||(Gr=Gr.toRed(this.red));var Zr=Gr.redSqr().redMul(Gr).redIAdd(Gr.redMul(this.a)).redIAdd(this.b),Jr=Zr.redSqrt();if(Jr.redSqr().redSub(Zr).cmp(this.zero)!==0)throw new Error("invalid point");var Qr=Jr.fromRed().isOdd();return(Vr&&!Qr||!Vr&&Qr)&&(Jr=Jr.redNeg()),this.point(Gr,Jr)},jr.prototype.validate=function(Gr){if(Gr.inf)return!0;var Vr=Gr.x,Zr=Gr.y,Jr=this.a.redMul(Vr),Qr=Vr.redSqr().redMul(Vr).redIAdd(Jr).redIAdd(this.b);return Zr.redSqr().redISub(Qr).cmpn(0)===0},jr.prototype._endoWnafMulAdd=function(Gr,Vr,Zr){for(var Jr=this._endoWnafT1,Qr=this._endoWnafT2,_n=0;_n":""},Br.prototype.isInfinity=function(){return this.inf},Br.prototype.add=function(Gr){if(this.inf)return Gr;if(Gr.inf)return this;if(this.eq(Gr))return this.dbl();if(this.neg().eq(Gr))return this.curve.point(null,null);if(this.x.cmp(Gr.x)===0)return this.curve.point(null,null);var Vr=this.y.redSub(Gr.y);Vr.cmpn(0)!==0&&(Vr=Vr.redMul(this.x.redSub(Gr.x).redInvm()));var Zr=Vr.redSqr().redISub(this.x).redISub(Gr.x),Jr=Vr.redMul(this.x.redSub(Zr)).redISub(this.y);return this.curve.point(Zr,Jr)},Br.prototype.dbl=function(){if(this.inf)return this;var Gr=this.y.redAdd(this.y);if(Gr.cmpn(0)===0)return this.curve.point(null,null);var Vr=this.curve.a,Zr=this.x.redSqr(),Jr=Gr.redInvm(),Qr=Zr.redAdd(Zr).redIAdd(Zr).redIAdd(Vr).redMul(Jr),_n=Qr.redSqr().redISub(this.x.redAdd(this.x)),En=Qr.redMul(this.x.redSub(_n)).redISub(this.y);return this.curve.point(_n,En)},Br.prototype.getX=function(){return this.x.fromRed()},Br.prototype.getY=function(){return this.y.fromRed()},Br.prototype.mul=function(Gr){return Gr=new br(Gr,16),this.isInfinity()?this:this._hasDoubles(Gr)?this.curve._fixedNafMul(this,Gr):this.curve.endo?this.curve._endoWnafMulAdd([this],[Gr]):this.curve._wnafMul(this,Gr)},Br.prototype.mulAdd=function(Gr,Vr,Zr){var Jr=[this,Vr],Qr=[Gr,Zr];return this.curve.endo?this.curve._endoWnafMulAdd(Jr,Qr):this.curve._wnafMulAdd(1,Jr,Qr,2)},Br.prototype.jmulAdd=function(Gr,Vr,Zr){var Jr=[this,Vr],Qr=[Gr,Zr];return this.curve.endo?this.curve._endoWnafMulAdd(Jr,Qr,!0):this.curve._wnafMulAdd(1,Jr,Qr,2,!0)},Br.prototype.eq=function(Gr){return this===Gr||this.inf===Gr.inf&&(this.inf||this.x.cmp(Gr.x)===0&&this.y.cmp(Gr.y)===0)},Br.prototype.neg=function(Gr){if(this.inf)return this;var Vr=this.curve.point(this.x,this.y.redNeg());if(Gr&&this.precomputed){var Zr=this.precomputed,Jr=function(Qr){return Qr.neg()};Vr.precomputed={naf:Zr.naf&&{wnd:Zr.naf.wnd,points:Zr.naf.points.map(Jr)},doubles:Zr.doubles&&{step:Zr.doubles.step,points:Zr.doubles.points.map(Jr)}}}return Vr},Br.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var Gr=this.curve.jpoint(this.x,this.y,this.curve.one);return Gr};function Wr(qr,Gr,Vr,Zr){Er.BasePoint.call(this,qr,"jacobian"),Gr===null&&Vr===null&&Zr===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new br(0)):(this.x=new br(Gr,16),this.y=new br(Vr,16),this.z=new br(Zr,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}return wr(Wr,Er.BasePoint),jr.prototype.jpoint=function(Gr,Vr,Zr){return new Wr(this,Gr,Vr,Zr)},Wr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var Gr=this.z.redInvm(),Vr=Gr.redSqr(),Zr=this.x.redMul(Vr),Jr=this.y.redMul(Vr).redMul(Gr);return this.curve.point(Zr,Jr)},Wr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Wr.prototype.add=function(Gr){if(this.isInfinity())return Gr;if(Gr.isInfinity())return this;var Vr=Gr.z.redSqr(),Zr=this.z.redSqr(),Jr=this.x.redMul(Vr),Qr=Gr.x.redMul(Zr),_n=this.y.redMul(Vr.redMul(Gr.z)),En=Gr.y.redMul(Zr.redMul(this.z)),Cn=Jr.redSub(Qr),In=_n.redSub(En);if(Cn.cmpn(0)===0)return In.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var An=Cn.redSqr(),jn=An.redMul(Cn),eo=Jr.redMul(An),ro=In.redSqr().redIAdd(jn).redISub(eo).redISub(eo),to=In.redMul(eo.redISub(ro)).redISub(_n.redMul(jn)),_i=this.z.redMul(Gr.z).redMul(Cn);return this.curve.jpoint(ro,to,_i)},Wr.prototype.mixedAdd=function(Gr){if(this.isInfinity())return Gr.toJ();if(Gr.isInfinity())return this;var Vr=this.z.redSqr(),Zr=this.x,Jr=Gr.x.redMul(Vr),Qr=this.y,_n=Gr.y.redMul(Vr).redMul(this.z),En=Zr.redSub(Jr),Cn=Qr.redSub(_n);if(En.cmpn(0)===0)return Cn.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var In=En.redSqr(),An=In.redMul(En),jn=Zr.redMul(In),eo=Cn.redSqr().redIAdd(An).redISub(jn).redISub(jn),ro=Cn.redMul(jn.redISub(eo)).redISub(Qr.redMul(An)),to=this.z.redMul(En);return this.curve.jpoint(eo,ro,to)},Wr.prototype.dblp=function(Gr){if(Gr===0)return this;if(this.isInfinity())return this;if(!Gr)return this.dbl();var Vr;if(this.curve.zeroA||this.curve.threeA){var Zr=this;for(Vr=0;Vr=0)return!1;if(Zr.redIAdd(Qr),this.x.cmp(Zr)===0)return!0}},Wr.prototype.inspect=function(){return this.isInfinity()?"":""},Wr.prototype.isInfinity=function(){return this.z.cmpn(0)===0},short}var mont,hasRequiredMont;function requireMont(){if(hasRequiredMont)return mont;hasRequiredMont=1;var fr=requireBn$2(),br=requireInherits_browser(),wr=requireBase$1(),Er=requireUtils$2();function kr(Br){wr.call(this,"mont",Br),this.a=new fr(Br.a,16).toRed(this.red),this.b=new fr(Br.b,16).toRed(this.red),this.i4=new fr(4).toRed(this.red).redInvm(),this.two=new fr(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}br(kr,wr),mont=kr,kr.prototype.validate=function(Wr){var qr=Wr.normalize().x,Gr=qr.redSqr(),Vr=Gr.redMul(qr).redAdd(Gr.redMul(this.a)).redAdd(qr),Zr=Vr.redSqrt();return Zr.redSqr().cmp(Vr)===0};function jr(Br,Wr,qr){wr.BasePoint.call(this,Br,"projective"),Wr===null&&qr===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new fr(Wr,16),this.z=new fr(qr,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return br(jr,wr.BasePoint),kr.prototype.decodePoint=function(Wr,qr){return this.point(Er.toArray(Wr,qr),1)},kr.prototype.point=function(Wr,qr){return new jr(this,Wr,qr)},kr.prototype.pointFromJSON=function(Wr){return jr.fromJSON(this,Wr)},jr.prototype.precompute=function(){},jr.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},jr.fromJSON=function(Wr,qr){return new jr(Wr,qr[0],qr[1]||Wr.one)},jr.prototype.inspect=function(){return this.isInfinity()?"":""},jr.prototype.isInfinity=function(){return this.z.cmpn(0)===0},jr.prototype.dbl=function(){var Wr=this.x.redAdd(this.z),qr=Wr.redSqr(),Gr=this.x.redSub(this.z),Vr=Gr.redSqr(),Zr=qr.redSub(Vr),Jr=qr.redMul(Vr),Qr=Zr.redMul(Vr.redAdd(this.curve.a24.redMul(Zr)));return this.curve.point(Jr,Qr)},jr.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},jr.prototype.diffAdd=function(Wr,qr){var Gr=this.x.redAdd(this.z),Vr=this.x.redSub(this.z),Zr=Wr.x.redAdd(Wr.z),Jr=Wr.x.redSub(Wr.z),Qr=Jr.redMul(Gr),_n=Zr.redMul(Vr),En=qr.z.redMul(Qr.redAdd(_n).redSqr()),Cn=qr.x.redMul(Qr.redISub(_n).redSqr());return this.curve.point(En,Cn)},jr.prototype.mul=function(Wr){for(var qr=Wr.clone(),Gr=this,Vr=this.curve.point(null,null),Zr=this,Jr=[];qr.cmpn(0)!==0;qr.iushrn(1))Jr.push(qr.andln(1));for(var Qr=Jr.length-1;Qr>=0;Qr--)Jr[Qr]===0?(Gr=Gr.diffAdd(Vr,Zr),Vr=Vr.dbl()):(Vr=Gr.diffAdd(Vr,Zr),Gr=Gr.dbl());return Vr},jr.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},jr.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},jr.prototype.eq=function(Wr){return this.getX().cmp(Wr.getX())===0},jr.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},jr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},mont}var edwards,hasRequiredEdwards;function requireEdwards(){if(hasRequiredEdwards)return edwards;hasRequiredEdwards=1;var fr=requireUtils$2(),br=requireBn$2(),wr=requireInherits_browser(),Er=requireBase$1(),kr=fr.assert;function jr(Wr){this.twisted=(Wr.a|0)!==1,this.mOneA=this.twisted&&(Wr.a|0)===-1,this.extended=this.mOneA,Er.call(this,"edwards",Wr),this.a=new br(Wr.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new br(Wr.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new br(Wr.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),kr(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(Wr.c|0)===1}wr(jr,Er),edwards=jr,jr.prototype._mulA=function(qr){return this.mOneA?qr.redNeg():this.a.redMul(qr)},jr.prototype._mulC=function(qr){return this.oneC?qr:this.c.redMul(qr)},jr.prototype.jpoint=function(qr,Gr,Vr,Zr){return this.point(qr,Gr,Vr,Zr)},jr.prototype.pointFromX=function(qr,Gr){qr=new br(qr,16),qr.red||(qr=qr.toRed(this.red));var Vr=qr.redSqr(),Zr=this.c2.redSub(this.a.redMul(Vr)),Jr=this.one.redSub(this.c2.redMul(this.d).redMul(Vr)),Qr=Zr.redMul(Jr.redInvm()),_n=Qr.redSqrt();if(_n.redSqr().redSub(Qr).cmp(this.zero)!==0)throw new Error("invalid point");var En=_n.fromRed().isOdd();return(Gr&&!En||!Gr&&En)&&(_n=_n.redNeg()),this.point(qr,_n)},jr.prototype.pointFromY=function(qr,Gr){qr=new br(qr,16),qr.red||(qr=qr.toRed(this.red));var Vr=qr.redSqr(),Zr=Vr.redSub(this.c2),Jr=Vr.redMul(this.d).redMul(this.c2).redSub(this.a),Qr=Zr.redMul(Jr.redInvm());if(Qr.cmp(this.zero)===0){if(Gr)throw new Error("invalid point");return this.point(this.zero,qr)}var _n=Qr.redSqrt();if(_n.redSqr().redSub(Qr).cmp(this.zero)!==0)throw new Error("invalid point");return _n.fromRed().isOdd()!==Gr&&(_n=_n.redNeg()),this.point(_n,qr)},jr.prototype.validate=function(qr){if(qr.isInfinity())return!0;qr.normalize();var Gr=qr.x.redSqr(),Vr=qr.y.redSqr(),Zr=Gr.redMul(this.a).redAdd(Vr),Jr=this.c2.redMul(this.one.redAdd(this.d.redMul(Gr).redMul(Vr)));return Zr.cmp(Jr)===0};function Br(Wr,qr,Gr,Vr,Zr){Er.BasePoint.call(this,Wr,"projective"),qr===null&&Gr===null&&Vr===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new br(qr,16),this.y=new br(Gr,16),this.z=Vr?new br(Vr,16):this.curve.one,this.t=Zr&&new br(Zr,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}return wr(Br,Er.BasePoint),jr.prototype.pointFromJSON=function(qr){return Br.fromJSON(this,qr)},jr.prototype.point=function(qr,Gr,Vr,Zr){return new Br(this,qr,Gr,Vr,Zr)},Br.fromJSON=function(qr,Gr){return new Br(qr,Gr[0],Gr[1],Gr[2])},Br.prototype.inspect=function(){return this.isInfinity()?"":""},Br.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Br.prototype._extDbl=function(){var qr=this.x.redSqr(),Gr=this.y.redSqr(),Vr=this.z.redSqr();Vr=Vr.redIAdd(Vr);var Zr=this.curve._mulA(qr),Jr=this.x.redAdd(this.y).redSqr().redISub(qr).redISub(Gr),Qr=Zr.redAdd(Gr),_n=Qr.redSub(Vr),En=Zr.redSub(Gr),Cn=Jr.redMul(_n),In=Qr.redMul(En),An=Jr.redMul(En),jn=_n.redMul(Qr);return this.curve.point(Cn,In,jn,An)},Br.prototype._projDbl=function(){var qr=this.x.redAdd(this.y).redSqr(),Gr=this.x.redSqr(),Vr=this.y.redSqr(),Zr,Jr,Qr,_n,En,Cn;if(this.curve.twisted){_n=this.curve._mulA(Gr);var In=_n.redAdd(Vr);this.zOne?(Zr=qr.redSub(Gr).redSub(Vr).redMul(In.redSub(this.curve.two)),Jr=In.redMul(_n.redSub(Vr)),Qr=In.redSqr().redSub(In).redSub(In)):(En=this.z.redSqr(),Cn=In.redSub(En).redISub(En),Zr=qr.redSub(Gr).redISub(Vr).redMul(Cn),Jr=In.redMul(_n.redSub(Vr)),Qr=In.redMul(Cn))}else _n=Gr.redAdd(Vr),En=this.curve._mulC(this.z).redSqr(),Cn=_n.redSub(En).redSub(En),Zr=this.curve._mulC(qr.redISub(_n)).redMul(Cn),Jr=this.curve._mulC(_n).redMul(Gr.redISub(Vr)),Qr=_n.redMul(Cn);return this.curve.point(Zr,Jr,Qr)},Br.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Br.prototype._extAdd=function(qr){var Gr=this.y.redSub(this.x).redMul(qr.y.redSub(qr.x)),Vr=this.y.redAdd(this.x).redMul(qr.y.redAdd(qr.x)),Zr=this.t.redMul(this.curve.dd).redMul(qr.t),Jr=this.z.redMul(qr.z.redAdd(qr.z)),Qr=Vr.redSub(Gr),_n=Jr.redSub(Zr),En=Jr.redAdd(Zr),Cn=Vr.redAdd(Gr),In=Qr.redMul(_n),An=En.redMul(Cn),jn=Qr.redMul(Cn),eo=_n.redMul(En);return this.curve.point(In,An,eo,jn)},Br.prototype._projAdd=function(qr){var Gr=this.z.redMul(qr.z),Vr=Gr.redSqr(),Zr=this.x.redMul(qr.x),Jr=this.y.redMul(qr.y),Qr=this.curve.d.redMul(Zr).redMul(Jr),_n=Vr.redSub(Qr),En=Vr.redAdd(Qr),Cn=this.x.redAdd(this.y).redMul(qr.x.redAdd(qr.y)).redISub(Zr).redISub(Jr),In=Gr.redMul(_n).redMul(Cn),An,jn;return this.curve.twisted?(An=Gr.redMul(En).redMul(Jr.redSub(this.curve._mulA(Zr))),jn=_n.redMul(En)):(An=Gr.redMul(En).redMul(Jr.redSub(Zr)),jn=this.curve._mulC(_n).redMul(En)),this.curve.point(In,An,jn)},Br.prototype.add=function(qr){return this.isInfinity()?qr:qr.isInfinity()?this:this.curve.extended?this._extAdd(qr):this._projAdd(qr)},Br.prototype.mul=function(qr){return this._hasDoubles(qr)?this.curve._fixedNafMul(this,qr):this.curve._wnafMul(this,qr)},Br.prototype.mulAdd=function(qr,Gr,Vr){return this.curve._wnafMulAdd(1,[this,Gr],[qr,Vr],2,!1)},Br.prototype.jmulAdd=function(qr,Gr,Vr){return this.curve._wnafMulAdd(1,[this,Gr],[qr,Vr],2,!0)},Br.prototype.normalize=function(){if(this.zOne)return this;var qr=this.z.redInvm();return this.x=this.x.redMul(qr),this.y=this.y.redMul(qr),this.t&&(this.t=this.t.redMul(qr)),this.z=this.curve.one,this.zOne=!0,this},Br.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Br.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Br.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Br.prototype.eq=function(qr){return this===qr||this.getX().cmp(qr.getX())===0&&this.getY().cmp(qr.getY())===0},Br.prototype.eqXToP=function(qr){var Gr=qr.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(Gr)===0)return!0;for(var Vr=qr.clone(),Zr=this.curve.redN.redMul(this.z);;){if(Vr.iadd(this.curve.n),Vr.cmp(this.curve.p)>=0)return!1;if(Gr.redIAdd(Zr),this.x.cmp(Gr)===0)return!0}},Br.prototype.toP=Br.prototype.normalize,Br.prototype.mixedAdd=Br.prototype.add,edwards}var hasRequiredCurve;function requireCurve(){return hasRequiredCurve||(hasRequiredCurve=1,function(fr){var br=fr;br.base=requireBase$1(),br.short=requireShort(),br.mont=requireMont(),br.edwards=requireEdwards()}(curve)),curve}var curves={},hash$1={},utils$3={},hasRequiredUtils$1;function requireUtils$1(){if(hasRequiredUtils$1)return utils$3;hasRequiredUtils$1=1;var fr=requireMinimalisticAssert(),br=requireInherits_browser();utils$3.inherits=br;function wr(no,Tn){return(no.charCodeAt(Tn)&64512)!==55296||Tn<0||Tn+1>=no.length?!1:(no.charCodeAt(Tn+1)&64512)===56320}function Er(no,Tn){if(Array.isArray(no))return no.slice();if(!no)return[];var Hr=[];if(typeof no=="string")if(Tn){if(Tn==="hex")for(no=no.replace(/[^a-z0-9]+/ig,""),no.length%2!==0&&(no="0"+no),Sn=0;Sn>6|192,Hr[Xr++]=Rn&63|128):wr(no,Sn)?(Rn=65536+((Rn&1023)<<10)+(no.charCodeAt(++Sn)&1023),Hr[Xr++]=Rn>>18|240,Hr[Xr++]=Rn>>12&63|128,Hr[Xr++]=Rn>>6&63|128,Hr[Xr++]=Rn&63|128):(Hr[Xr++]=Rn>>12|224,Hr[Xr++]=Rn>>6&63|128,Hr[Xr++]=Rn&63|128)}else for(Sn=0;Sn>>24|no>>>8&65280|no<<8&16711680|(no&255)<<24;return Tn>>>0}utils$3.htonl=jr;function Br(no,Tn){for(var Hr="",Xr=0;Xr>>0}return Rn}utils$3.join32=Gr;function Vr(no,Tn){for(var Hr=new Array(no.length*4),Xr=0,Sn=0;Xr>>24,Hr[Sn+1]=Rn>>>16&255,Hr[Sn+2]=Rn>>>8&255,Hr[Sn+3]=Rn&255):(Hr[Sn+3]=Rn>>>24,Hr[Sn+2]=Rn>>>16&255,Hr[Sn+1]=Rn>>>8&255,Hr[Sn]=Rn&255)}return Hr}utils$3.split32=Vr;function Zr(no,Tn){return no>>>Tn|no<<32-Tn}utils$3.rotr32=Zr;function Jr(no,Tn){return no<>>32-Tn}utils$3.rotl32=Jr;function Qr(no,Tn){return no+Tn>>>0}utils$3.sum32=Qr;function _n(no,Tn,Hr){return no+Tn+Hr>>>0}utils$3.sum32_3=_n;function En(no,Tn,Hr,Xr){return no+Tn+Hr+Xr>>>0}utils$3.sum32_4=En;function Cn(no,Tn,Hr,Xr,Sn){return no+Tn+Hr+Xr+Sn>>>0}utils$3.sum32_5=Cn;function In(no,Tn,Hr,Xr){var Sn=no[Tn],Rn=no[Tn+1],Pn=Xr+Rn>>>0,On=(Pn>>0,no[Tn+1]=Pn}utils$3.sum64=In;function An(no,Tn,Hr,Xr){var Sn=Tn+Xr>>>0,Rn=(Sn>>0}utils$3.sum64_hi=An;function jn(no,Tn,Hr,Xr){var Sn=Tn+Xr;return Sn>>>0}utils$3.sum64_lo=jn;function eo(no,Tn,Hr,Xr,Sn,Rn,Pn,On){var Zn=0,Nn=Tn;Nn=Nn+Xr>>>0,Zn+=Nn>>0,Zn+=Nn>>0,Zn+=Nn>>0}utils$3.sum64_4_hi=eo;function ro(no,Tn,Hr,Xr,Sn,Rn,Pn,On){var Zn=Tn+Xr+Rn+On;return Zn>>>0}utils$3.sum64_4_lo=ro;function to(no,Tn,Hr,Xr,Sn,Rn,Pn,On,Zn,Nn){var wn=0,zn=Tn;zn=zn+Xr>>>0,wn+=zn>>0,wn+=zn>>0,wn+=zn>>0,wn+=zn>>0}utils$3.sum64_5_hi=to;function _i(no,Tn,Hr,Xr,Sn,Rn,Pn,On,Zn,Nn){var wn=Tn+Xr+Rn+On+Nn;return wn>>>0}utils$3.sum64_5_lo=_i;function oo(no,Tn,Hr){var Xr=Tn<<32-Hr|no>>>Hr;return Xr>>>0}utils$3.rotr64_hi=oo;function io(no,Tn,Hr){var Xr=no<<32-Hr|Tn>>>Hr;return Xr>>>0}utils$3.rotr64_lo=io;function co(no,Tn,Hr){return no>>>Hr}utils$3.shr64_hi=co;function so(no,Tn,Hr){var Xr=no<<32-Hr|Tn>>>Hr;return Xr>>>0}return utils$3.shr64_lo=so,utils$3}var common$1={},hasRequiredCommon$1;function requireCommon$1(){if(hasRequiredCommon$1)return common$1;hasRequiredCommon$1=1;var fr=requireUtils$1(),br=requireMinimalisticAssert();function wr(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}return common$1.BlockHash=wr,wr.prototype.update=function(kr,jr){if(kr=fr.toArray(kr,jr),this.pending?this.pending=this.pending.concat(kr):this.pending=kr,this.pendingTotal+=kr.length,this.pending.length>=this._delta8){kr=this.pending;var Br=kr.length%this._delta8;this.pending=kr.slice(kr.length-Br,kr.length),this.pending.length===0&&(this.pending=null),kr=fr.join32(kr,0,kr.length-Br,this.endian);for(var Wr=0;Wr>>24&255,Wr[qr++]=kr>>>16&255,Wr[qr++]=kr>>>8&255,Wr[qr++]=kr&255}else for(Wr[qr++]=kr&255,Wr[qr++]=kr>>>8&255,Wr[qr++]=kr>>>16&255,Wr[qr++]=kr>>>24&255,Wr[qr++]=0,Wr[qr++]=0,Wr[qr++]=0,Wr[qr++]=0,Gr=8;Gr>>3}common.g0_256=qr;function Gr(Vr){return br(Vr,17)^br(Vr,19)^Vr>>>10}return common.g1_256=Gr,common}var _1$1,hasRequired_1;function require_1(){if(hasRequired_1)return _1$1;hasRequired_1=1;var fr=requireUtils$1(),br=requireCommon$1(),wr=requireCommon(),Er=fr.rotl32,kr=fr.sum32,jr=fr.sum32_5,Br=wr.ft_1,Wr=br.BlockHash,qr=[1518500249,1859775393,2400959708,3395469782];function Gr(){if(!(this instanceof Gr))return new Gr;Wr.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}return fr.inherits(Gr,Wr),_1$1=Gr,Gr.blockSize=512,Gr.outSize=160,Gr.hmacStrength=80,Gr.padLength=64,Gr.prototype._update=function(Zr,Jr){for(var Qr=this.W,_n=0;_n<16;_n++)Qr[_n]=Zr[Jr+_n];for(;_nthis.blockSize&&(kr=new this.Hash().update(kr).digest()),br(kr.length<=this.blockSize);for(var jr=kr.length;jr=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(jr,Br,Wr)}return hmacDrbg=Er,Er.prototype._init=function(jr,Br,Wr){var qr=jr.concat(Br).concat(Wr);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var Gr=0;Gr=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(jr.concat(Wr||[])),this._reseed=1},Er.prototype.generate=function(jr,Br,Wr,qr){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof Br!="string"&&(qr=Wr,Wr=Br,Br=null),Wr&&(Wr=br.toArray(Wr,qr||"hex"),this._update(Wr));for(var Gr=[];Gr.length"},key$1}var signature$2,hasRequiredSignature$1;function requireSignature$1(){if(hasRequiredSignature$1)return signature$2;hasRequiredSignature$1=1;var fr=requireBn$2(),br=requireUtils$2(),wr=br.assert;function Er(qr,Gr){if(qr instanceof Er)return qr;this._importDER(qr,Gr)||(wr(qr.r&&qr.s,"Signature without r or s"),this.r=new fr(qr.r,16),this.s=new fr(qr.s,16),qr.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=qr.recoveryParam)}signature$2=Er;function kr(){this.place=0}function jr(qr,Gr){var Vr=qr[Gr.place++];if(!(Vr&128))return Vr;var Zr=Vr&15;if(Zr===0||Zr>4||qr[Gr.place]===0)return!1;for(var Jr=0,Qr=0,_n=Gr.place;Qr>>=0;return Jr<=127?!1:(Gr.place=_n,Jr)}function Br(qr){for(var Gr=0,Vr=qr.length-1;!qr[Gr]&&!(qr[Gr+1]&128)&&Gr>>3);for(qr.push(Vr|128);--Vr;)qr.push(Gr>>>(Vr<<3)&255);qr.push(Gr)}return Er.prototype.toDER=function(Gr){var Vr=this.r.toArray(),Zr=this.s.toArray();for(Vr[0]&128&&(Vr=[0].concat(Vr)),Zr[0]&128&&(Zr=[0].concat(Zr)),Vr=Br(Vr),Zr=Br(Zr);!Zr[0]&&!(Zr[1]&128);)Zr=Zr.slice(1);var Jr=[2];Wr(Jr,Vr.length),Jr=Jr.concat(Vr),Jr.push(2),Wr(Jr,Zr.length);var Qr=Jr.concat(Zr),_n=[48];return Wr(_n,Qr.length),_n=_n.concat(Qr),br.encode(_n,Gr)},signature$2}var ec,hasRequiredEc;function requireEc(){if(hasRequiredEc)return ec;hasRequiredEc=1;var fr=requireBn$2(),br=requireHmacDrbg(),wr=requireUtils$2(),Er=requireCurves(),kr=requireBrorand(),jr=wr.assert,Br=requireKey$1(),Wr=requireSignature$1();function qr(Gr){if(!(this instanceof qr))return new qr(Gr);typeof Gr=="string"&&(jr(Object.prototype.hasOwnProperty.call(Er,Gr),"Unknown curve "+Gr),Gr=Er[Gr]),Gr instanceof Er.PresetCurve&&(Gr={curve:Gr}),this.curve=Gr.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=Gr.curve.g,this.g.precompute(Gr.curve.n.bitLength()+1),this.hash=Gr.hash||Gr.curve.hash}return ec=qr,qr.prototype.keyPair=function(Vr){return new Br(this,Vr)},qr.prototype.keyFromPrivate=function(Vr,Zr){return Br.fromPrivate(this,Vr,Zr)},qr.prototype.keyFromPublic=function(Vr,Zr){return Br.fromPublic(this,Vr,Zr)},qr.prototype.genKeyPair=function(Vr){Vr||(Vr={});for(var Zr=new br({hash:this.hash,pers:Vr.pers,persEnc:Vr.persEnc||"utf8",entropy:Vr.entropy||kr(this.hash.hmacStrength),entropyEnc:Vr.entropy&&Vr.entropyEnc||"utf8",nonce:this.n.toArray()}),Jr=this.n.byteLength(),Qr=this.n.sub(new fr(2));;){var _n=new fr(Zr.generate(Jr));if(!(_n.cmp(Qr)>0))return _n.iaddn(1),this.keyFromPrivate(_n)}},qr.prototype._truncateToN=function(Vr,Zr,Jr){var Qr;if(fr.isBN(Vr)||typeof Vr=="number")Vr=new fr(Vr,16),Qr=Vr.byteLength();else if(typeof Vr=="object")Qr=Vr.length,Vr=new fr(Vr,16);else{var _n=Vr.toString();Qr=_n.length+1>>>1,Vr=new fr(_n,16)}typeof Jr!="number"&&(Jr=Qr*8);var En=Jr-this.n.bitLength();return En>0&&(Vr=Vr.ushrn(En)),!Zr&&Vr.cmp(this.n)>=0?Vr.sub(this.n):Vr},qr.prototype.sign=function(Vr,Zr,Jr,Qr){if(typeof Jr=="object"&&(Qr=Jr,Jr=null),Qr||(Qr={}),typeof Vr!="string"&&typeof Vr!="number"&&!fr.isBN(Vr)){jr(typeof Vr=="object"&&Vr&&typeof Vr.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),jr(Vr.length>>>0===Vr.length);for(var _n=0;_n=0)){var to=this.g.mul(ro);if(!to.isInfinity()){var _i=to.getX(),oo=_i.umod(this.n);if(oo.cmpn(0)!==0){var io=ro.invm(this.n).mul(oo.mul(Zr.getPrivate()).iadd(Vr));if(io=io.umod(this.n),io.cmpn(0)!==0){var co=(to.getY().isOdd()?1:0)|(_i.cmp(oo)!==0?2:0);return Qr.canonical&&io.cmp(this.nh)>0&&(io=this.n.sub(io),co^=1),new Wr({r:oo,s:io,recoveryParam:co})}}}}}},qr.prototype.verify=function(Vr,Zr,Jr,Qr,_n){_n||(_n={}),Vr=this._truncateToN(Vr,!1,_n.msgBitLength),Jr=this.keyFromPublic(Jr,Qr),Zr=new Wr(Zr,"hex");var En=Zr.r,Cn=Zr.s;if(En.cmpn(1)<0||En.cmp(this.n)>=0||Cn.cmpn(1)<0||Cn.cmp(this.n)>=0)return!1;var In=Cn.invm(this.n),An=In.mul(Vr).umod(this.n),jn=In.mul(En).umod(this.n),eo;return this.curve._maxwellTrick?(eo=this.g.jmulAdd(An,Jr.getPublic(),jn),eo.isInfinity()?!1:eo.eqXToP(En)):(eo=this.g.mulAdd(An,Jr.getPublic(),jn),eo.isInfinity()?!1:eo.getX().umod(this.n).cmp(En)===0)},qr.prototype.recoverPubKey=function(Gr,Vr,Zr,Jr){jr((3&Zr)===Zr,"The recovery param is more than two bits"),Vr=new Wr(Vr,Jr);var Qr=this.n,_n=new fr(Gr),En=Vr.r,Cn=Vr.s,In=Zr&1,An=Zr>>1;if(En.cmp(this.curve.p.umod(this.curve.n))>=0&&An)throw new Error("Unable to find sencond key candinate");An?En=this.curve.pointFromX(En.add(this.curve.n),In):En=this.curve.pointFromX(En,In);var jn=Vr.r.invm(Qr),eo=Qr.sub(_n).mul(jn).umod(Qr),ro=Cn.mul(jn).umod(Qr);return this.g.mulAdd(eo,En,ro)},qr.prototype.getKeyRecoveryParam=function(Gr,Vr,Zr,Jr){if(Vr=new Wr(Vr,Jr),Vr.recoveryParam!==null)return Vr.recoveryParam;for(var Qr=0;Qr<4;Qr++){var _n;try{_n=this.recoverPubKey(Gr,Vr,Qr)}catch{continue}if(_n.eq(Zr))return Qr}throw new Error("Unable to find valid recovery factor")},ec}var key,hasRequiredKey;function requireKey(){if(hasRequiredKey)return key;hasRequiredKey=1;var fr=requireUtils$2(),br=fr.assert,wr=fr.parseBytes,Er=fr.cachedProperty;function kr(jr,Br){this.eddsa=jr,this._secret=wr(Br.secret),jr.isPoint(Br.pub)?this._pub=Br.pub:this._pubBytes=wr(Br.pub)}return kr.fromPublic=function(Br,Wr){return Wr instanceof kr?Wr:new kr(Br,{pub:Wr})},kr.fromSecret=function(Br,Wr){return Wr instanceof kr?Wr:new kr(Br,{secret:Wr})},kr.prototype.secret=function(){return this._secret},Er(kr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),Er(kr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),Er(kr,"privBytes",function(){var Br=this.eddsa,Wr=this.hash(),qr=Br.encodingLength-1,Gr=Wr.slice(0,Br.encodingLength);return Gr[0]&=248,Gr[qr]&=127,Gr[qr]|=64,Gr}),Er(kr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),Er(kr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),Er(kr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),kr.prototype.sign=function(Br){return br(this._secret,"KeyPair can only verify"),this.eddsa.sign(Br,this)},kr.prototype.verify=function(Br,Wr){return this.eddsa.verify(Br,Wr,this)},kr.prototype.getSecret=function(Br){return br(this._secret,"KeyPair is public only"),fr.encode(this.secret(),Br)},kr.prototype.getPublic=function(Br){return fr.encode(this.pubBytes(),Br)},key=kr,key}var signature$1,hasRequiredSignature;function requireSignature(){if(hasRequiredSignature)return signature$1;hasRequiredSignature=1;var fr=requireBn$2(),br=requireUtils$2(),wr=br.assert,Er=br.cachedProperty,kr=br.parseBytes;function jr(Br,Wr){this.eddsa=Br,typeof Wr!="object"&&(Wr=kr(Wr)),Array.isArray(Wr)&&(wr(Wr.length===Br.encodingLength*2,"Signature has invalid size"),Wr={R:Wr.slice(0,Br.encodingLength),S:Wr.slice(Br.encodingLength)}),wr(Wr.R&&Wr.S,"Signature without R or S"),Br.isPoint(Wr.R)&&(this._R=Wr.R),Wr.S instanceof fr&&(this._S=Wr.S),this._Rencoded=Array.isArray(Wr.R)?Wr.R:Wr.Rencoded,this._Sencoded=Array.isArray(Wr.S)?Wr.S:Wr.Sencoded}return Er(jr,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Er(jr,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Er(jr,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Er(jr,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),jr.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},jr.prototype.toHex=function(){return br.encode(this.toBytes(),"hex").toUpperCase()},signature$1=jr,signature$1}var eddsa,hasRequiredEddsa;function requireEddsa(){if(hasRequiredEddsa)return eddsa;hasRequiredEddsa=1;var fr=requireHash(),br=requireCurves(),wr=requireUtils$2(),Er=wr.assert,kr=wr.parseBytes,jr=requireKey(),Br=requireSignature();function Wr(qr){if(Er(qr==="ed25519","only tested with ed25519 so far"),!(this instanceof Wr))return new Wr(qr);qr=br[qr].curve,this.curve=qr,this.g=qr.g,this.g.precompute(qr.n.bitLength()+1),this.pointClass=qr.point().constructor,this.encodingLength=Math.ceil(qr.n.bitLength()/8),this.hash=fr.sha512}return eddsa=Wr,Wr.prototype.sign=function(Gr,Vr){Gr=kr(Gr);var Zr=this.keyFromSecret(Vr),Jr=this.hashInt(Zr.messagePrefix(),Gr),Qr=this.g.mul(Jr),_n=this.encodePoint(Qr),En=this.hashInt(_n,Zr.pubBytes(),Gr).mul(Zr.priv()),Cn=Jr.add(En).umod(this.curve.n);return this.makeSignature({R:Qr,S:Cn,Rencoded:_n})},Wr.prototype.verify=function(Gr,Vr,Zr){if(Gr=kr(Gr),Vr=this.makeSignature(Vr),Vr.S().gte(Vr.eddsa.curve.n)||Vr.S().isNeg())return!1;var Jr=this.keyFromPublic(Zr),Qr=this.hashInt(Vr.Rencoded(),Jr.pubBytes(),Gr),_n=this.g.mul(Vr.S()),En=Vr.R().add(Jr.pub().mul(Qr));return En.eq(_n)},Wr.prototype.hashInt=function(){for(var Gr=this.hash(),Vr=0;Vr0?Hr:Xr},jr.min=function(Hr,Xr){return Hr.cmp(Xr)<0?Hr:Xr},jr.prototype._init=function(Hr,Xr,Sn){if(typeof Hr=="number")return this._initNumber(Hr,Xr,Sn);if(typeof Hr=="object")return this._initArray(Hr,Xr,Sn);Xr==="hex"&&(Xr=16),Er(Xr===(Xr|0)&&Xr>=2&&Xr<=36),Hr=Hr.toString().replace(/\s+/g,"");var Rn=0;Hr[0]==="-"&&(Rn++,this.negative=1),Rn=0;Rn-=3)On=Hr[Rn]|Hr[Rn-1]<<8|Hr[Rn-2]<<16,this.words[Pn]|=On<>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);else if(Sn==="le")for(Rn=0,Pn=0;Rn>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);return this._strip()};function Wr(Tn,Hr){var Xr=Tn.charCodeAt(Hr);if(Xr>=48&&Xr<=57)return Xr-48;if(Xr>=65&&Xr<=70)return Xr-55;if(Xr>=97&&Xr<=102)return Xr-87;Er(!1,"Invalid character in "+Tn)}function qr(Tn,Hr,Xr){var Sn=Wr(Tn,Xr);return Xr-1>=Hr&&(Sn|=Wr(Tn,Xr-1)<<4),Sn}jr.prototype._parseHex=function(Hr,Xr,Sn){this.length=Math.ceil((Hr.length-Xr)/6),this.words=new Array(this.length);for(var Rn=0;Rn=Xr;Rn-=2)Zn=qr(Hr,Xr,Rn)<=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8;else{var Nn=Hr.length-Xr;for(Rn=Nn%2===0?Xr+1:Xr;Rn=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8}this._strip()};function Gr(Tn,Hr,Xr,Sn){for(var Rn=0,Pn=0,On=Math.min(Tn.length,Xr),Zn=Hr;Zn=49?Pn=Nn-49+10:Nn>=17?Pn=Nn-17+10:Pn=Nn,Er(Nn>=0&&Pn1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},jr.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{jr.prototype[Symbol.for("nodejs.util.inspect.custom")]=Zr}catch{jr.prototype.inspect=Zr}else jr.prototype.inspect=Zr;function Zr(){return(this.red?""}var Jr=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Qr=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_n=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];jr.prototype.toString=function(Hr,Xr){Hr=Hr||10,Xr=Xr|0||1;var Sn;if(Hr===16||Hr==="hex"){Sn="";for(var Rn=0,Pn=0,On=0;On>>24-Rn&16777215,Rn+=2,Rn>=26&&(Rn-=26,On--),Pn!==0||On!==this.length-1?Sn=Jr[6-Nn.length]+Nn+Sn:Sn=Nn+Sn}for(Pn!==0&&(Sn=Pn.toString(16)+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}if(Hr===(Hr|0)&&Hr>=2&&Hr<=36){var wn=Qr[Hr],zn=_n[Hr];Sn="";var fo=this.clone();for(fo.negative=0;!fo.isZero();){var vo=fo.modrn(zn).toString(Hr);fo=fo.idivn(zn),fo.isZero()?Sn=vo+Sn:Sn=Jr[wn-vo.length]+vo+Sn}for(this.isZero()&&(Sn="0"+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}Er(!1,"Base should be between 2 and 36")},jr.prototype.toNumber=function(){var Hr=this.words[0];return this.length===2?Hr+=this.words[1]*67108864:this.length===3&&this.words[2]===1?Hr+=4503599627370496+this.words[1]*67108864:this.length>2&&Er(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-Hr:Hr},jr.prototype.toJSON=function(){return this.toString(16,2)},Br&&(jr.prototype.toBuffer=function(Hr,Xr){return this.toArrayLike(Br,Hr,Xr)}),jr.prototype.toArray=function(Hr,Xr){return this.toArrayLike(Array,Hr,Xr)};var En=function(Hr,Xr){return Hr.allocUnsafe?Hr.allocUnsafe(Xr):new Hr(Xr)};jr.prototype.toArrayLike=function(Hr,Xr,Sn){this._strip();var Rn=this.byteLength(),Pn=Sn||Math.max(1,Rn);Er(Rn<=Pn,"byte array longer than desired length"),Er(Pn>0,"Requested array length <= 0");var On=En(Hr,Pn),Zn=Xr==="le"?"LE":"BE";return this["_toArrayLike"+Zn](On,Rn),On},jr.prototype._toArrayLikeLE=function(Hr,Xr){for(var Sn=0,Rn=0,Pn=0,On=0;Pn>8&255),Sn>16&255),On===6?(Sn>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn=0&&(Hr[Sn--]=Zn>>8&255),Sn>=0&&(Hr[Sn--]=Zn>>16&255),On===6?(Sn>=0&&(Hr[Sn--]=Zn>>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn>=0)for(Hr[Sn--]=Rn;Sn>=0;)Hr[Sn--]=0},Math.clz32?jr.prototype._countBits=function(Hr){return 32-Math.clz32(Hr)}:jr.prototype._countBits=function(Hr){var Xr=Hr,Sn=0;return Xr>=4096&&(Sn+=13,Xr>>>=13),Xr>=64&&(Sn+=7,Xr>>>=7),Xr>=8&&(Sn+=4,Xr>>>=4),Xr>=2&&(Sn+=2,Xr>>>=2),Sn+Xr},jr.prototype._zeroBits=function(Hr){if(Hr===0)return 26;var Xr=Hr,Sn=0;return Xr&8191||(Sn+=13,Xr>>>=13),Xr&127||(Sn+=7,Xr>>>=7),Xr&15||(Sn+=4,Xr>>>=4),Xr&3||(Sn+=2,Xr>>>=2),Xr&1||Sn++,Sn},jr.prototype.bitLength=function(){var Hr=this.words[this.length-1],Xr=this._countBits(Hr);return(this.length-1)*26+Xr};function Cn(Tn){for(var Hr=new Array(Tn.bitLength()),Xr=0;Xr>>Rn&1}return Hr}jr.prototype.zeroBits=function(){if(this.isZero())return 0;for(var Hr=0,Xr=0;XrHr.length?this.clone().ior(Hr):Hr.clone().ior(this)},jr.prototype.uor=function(Hr){return this.length>Hr.length?this.clone().iuor(Hr):Hr.clone().iuor(this)},jr.prototype.iuand=function(Hr){var Xr;this.length>Hr.length?Xr=Hr:Xr=this;for(var Sn=0;SnHr.length?this.clone().iand(Hr):Hr.clone().iand(this)},jr.prototype.uand=function(Hr){return this.length>Hr.length?this.clone().iuand(Hr):Hr.clone().iuand(this)},jr.prototype.iuxor=function(Hr){var Xr,Sn;this.length>Hr.length?(Xr=this,Sn=Hr):(Xr=Hr,Sn=this);for(var Rn=0;RnHr.length?this.clone().ixor(Hr):Hr.clone().ixor(this)},jr.prototype.uxor=function(Hr){return this.length>Hr.length?this.clone().iuxor(Hr):Hr.clone().iuxor(this)},jr.prototype.inotn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Math.ceil(Hr/26)|0,Sn=Hr%26;this._expand(Xr),Sn>0&&Xr--;for(var Rn=0;Rn0&&(this.words[Rn]=~this.words[Rn]&67108863>>26-Sn),this._strip()},jr.prototype.notn=function(Hr){return this.clone().inotn(Hr)},jr.prototype.setn=function(Hr,Xr){Er(typeof Hr=="number"&&Hr>=0);var Sn=Hr/26|0,Rn=Hr%26;return this._expand(Sn+1),Xr?this.words[Sn]=this.words[Sn]|1<Hr.length?(Sn=this,Rn=Hr):(Sn=Hr,Rn=this);for(var Pn=0,On=0;On>>26;for(;Pn!==0&&On>>26;if(this.length=Sn.length,Pn!==0)this.words[this.length]=Pn,this.length++;else if(Sn!==this)for(;OnHr.length?this.clone().iadd(Hr):Hr.clone().iadd(this)},jr.prototype.isub=function(Hr){if(Hr.negative!==0){Hr.negative=0;var Xr=this.iadd(Hr);return Hr.negative=1,Xr._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Hr),this.negative=1,this._normSign();var Sn=this.cmp(Hr);if(Sn===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Rn,Pn;Sn>0?(Rn=this,Pn=Hr):(Rn=Hr,Pn=this);for(var On=0,Zn=0;Zn>26,this.words[Zn]=Xr&67108863;for(;On!==0&&Zn>26,this.words[Zn]=Xr&67108863;if(On===0&&Zn>>26,fo=Nn&67108863,vo=Math.min(wn,Hr.length-1),go=Math.max(0,wn-Tn.length+1);go<=vo;go++){var uo=wn-go|0;Rn=Tn.words[uo]|0,Pn=Hr.words[go]|0,On=Rn*Pn+fo,zn+=On/67108864|0,fo=On&67108863}Xr.words[wn]=fo|0,Nn=zn|0}return Nn!==0?Xr.words[wn]=Nn|0:Xr.length--,Xr._strip()}var An=function(Hr,Xr,Sn){var Rn=Hr.words,Pn=Xr.words,On=Sn.words,Zn=0,Nn,wn,zn,fo=Rn[0]|0,vo=fo&8191,go=fo>>>13,uo=Rn[1]|0,lo=uo&8191,Eo=uo>>>13,mo=Rn[2]|0,yo=mo&8191,_o=mo>>>13,Bo=Rn[3]|0,Lo=Bo&8191,Wo=Bo>>>13,na=Rn[4]|0,qo=na&8191,ga=na>>>13,wl=Rn[5]|0,No=wl&8191,Fo=wl>>>13,Nl=Rn[6]|0,Vo=Nl&8191,Uo=Nl>>>13,Ml=Rn[7]|0,$a=Ml&8191,Jo=Ml>>>13,Zl=Rn[8]|0,Cl=Zl&8191,ko=Zl>>>13,wo=Rn[9]|0,bo=wo&8191,Io=wo>>>13,Ho=Pn[0]|0,Do=Ho&8191,zo=Ho>>>13,nu=Pn[1]|0,Ll=nu&8191,_l=nu>>>13,bu=Pn[2]|0,xl=bu&8191,Tl=bu>>>13,du=Pn[3]|0,Bl=du&8191,Il=du>>>13,Eu=Pn[4]|0,Al=Eu&8191,Ol=Eu>>>13,Tu=Pn[5]|0,Ul=Tu&8191,Sl=Tu>>>13,_u=Pn[6]|0,So=_u&8191,Co=_u>>>13,Ao=Pn[7]|0,po=Ao&8191,Ro=Ao>>>13,Xo=Pn[8]|0,jo=Xo&8191,Ko=Xo>>>13,Wl=Pn[9]|0,$l=Wl&8191,El=Wl>>>13;Sn.negative=Hr.negative^Xr.negative,Sn.length=19,Nn=Math.imul(vo,Do),wn=Math.imul(vo,zo),wn=wn+Math.imul(go,Do)|0,zn=Math.imul(go,zo);var Cu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,Nn=Math.imul(lo,Do),wn=Math.imul(lo,zo),wn=wn+Math.imul(Eo,Do)|0,zn=Math.imul(Eo,zo),Nn=Nn+Math.imul(vo,Ll)|0,wn=wn+Math.imul(vo,_l)|0,wn=wn+Math.imul(go,Ll)|0,zn=zn+Math.imul(go,_l)|0;var iu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(iu>>>26)|0,iu&=67108863,Nn=Math.imul(yo,Do),wn=Math.imul(yo,zo),wn=wn+Math.imul(_o,Do)|0,zn=Math.imul(_o,zo),Nn=Nn+Math.imul(lo,Ll)|0,wn=wn+Math.imul(lo,_l)|0,wn=wn+Math.imul(Eo,Ll)|0,zn=zn+Math.imul(Eo,_l)|0,Nn=Nn+Math.imul(vo,xl)|0,wn=wn+Math.imul(vo,Tl)|0,wn=wn+Math.imul(go,xl)|0,zn=zn+Math.imul(go,Tl)|0;var pu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(pu>>>26)|0,pu&=67108863,Nn=Math.imul(Lo,Do),wn=Math.imul(Lo,zo),wn=wn+Math.imul(Wo,Do)|0,zn=Math.imul(Wo,zo),Nn=Nn+Math.imul(yo,Ll)|0,wn=wn+Math.imul(yo,_l)|0,wn=wn+Math.imul(_o,Ll)|0,zn=zn+Math.imul(_o,_l)|0,Nn=Nn+Math.imul(lo,xl)|0,wn=wn+Math.imul(lo,Tl)|0,wn=wn+Math.imul(Eo,xl)|0,zn=zn+Math.imul(Eo,Tl)|0,Nn=Nn+Math.imul(vo,Bl)|0,wn=wn+Math.imul(vo,Il)|0,wn=wn+Math.imul(go,Bl)|0,zn=zn+Math.imul(go,Il)|0;var yu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(yu>>>26)|0,yu&=67108863,Nn=Math.imul(qo,Do),wn=Math.imul(qo,zo),wn=wn+Math.imul(ga,Do)|0,zn=Math.imul(ga,zo),Nn=Nn+Math.imul(Lo,Ll)|0,wn=wn+Math.imul(Lo,_l)|0,wn=wn+Math.imul(Wo,Ll)|0,zn=zn+Math.imul(Wo,_l)|0,Nn=Nn+Math.imul(yo,xl)|0,wn=wn+Math.imul(yo,Tl)|0,wn=wn+Math.imul(_o,xl)|0,zn=zn+Math.imul(_o,Tl)|0,Nn=Nn+Math.imul(lo,Bl)|0,wn=wn+Math.imul(lo,Il)|0,wn=wn+Math.imul(Eo,Bl)|0,zn=zn+Math.imul(Eo,Il)|0,Nn=Nn+Math.imul(vo,Al)|0,wn=wn+Math.imul(vo,Ol)|0,wn=wn+Math.imul(go,Al)|0,zn=zn+Math.imul(go,Ol)|0;var hu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(hu>>>26)|0,hu&=67108863,Nn=Math.imul(No,Do),wn=Math.imul(No,zo),wn=wn+Math.imul(Fo,Do)|0,zn=Math.imul(Fo,zo),Nn=Nn+Math.imul(qo,Ll)|0,wn=wn+Math.imul(qo,_l)|0,wn=wn+Math.imul(ga,Ll)|0,zn=zn+Math.imul(ga,_l)|0,Nn=Nn+Math.imul(Lo,xl)|0,wn=wn+Math.imul(Lo,Tl)|0,wn=wn+Math.imul(Wo,xl)|0,zn=zn+Math.imul(Wo,Tl)|0,Nn=Nn+Math.imul(yo,Bl)|0,wn=wn+Math.imul(yo,Il)|0,wn=wn+Math.imul(_o,Bl)|0,zn=zn+Math.imul(_o,Il)|0,Nn=Nn+Math.imul(lo,Al)|0,wn=wn+Math.imul(lo,Ol)|0,wn=wn+Math.imul(Eo,Al)|0,zn=zn+Math.imul(Eo,Ol)|0,Nn=Nn+Math.imul(vo,Ul)|0,wn=wn+Math.imul(vo,Sl)|0,wn=wn+Math.imul(go,Ul)|0,zn=zn+Math.imul(go,Sl)|0;var mu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(mu>>>26)|0,mu&=67108863,Nn=Math.imul(Vo,Do),wn=Math.imul(Vo,zo),wn=wn+Math.imul(Uo,Do)|0,zn=Math.imul(Uo,zo),Nn=Nn+Math.imul(No,Ll)|0,wn=wn+Math.imul(No,_l)|0,wn=wn+Math.imul(Fo,Ll)|0,zn=zn+Math.imul(Fo,_l)|0,Nn=Nn+Math.imul(qo,xl)|0,wn=wn+Math.imul(qo,Tl)|0,wn=wn+Math.imul(ga,xl)|0,zn=zn+Math.imul(ga,Tl)|0,Nn=Nn+Math.imul(Lo,Bl)|0,wn=wn+Math.imul(Lo,Il)|0,wn=wn+Math.imul(Wo,Bl)|0,zn=zn+Math.imul(Wo,Il)|0,Nn=Nn+Math.imul(yo,Al)|0,wn=wn+Math.imul(yo,Ol)|0,wn=wn+Math.imul(_o,Al)|0,zn=zn+Math.imul(_o,Ol)|0,Nn=Nn+Math.imul(lo,Ul)|0,wn=wn+Math.imul(lo,Sl)|0,wn=wn+Math.imul(Eo,Ul)|0,zn=zn+Math.imul(Eo,Sl)|0,Nn=Nn+Math.imul(vo,So)|0,wn=wn+Math.imul(vo,Co)|0,wn=wn+Math.imul(go,So)|0,zn=zn+Math.imul(go,Co)|0;var vu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(vu>>>26)|0,vu&=67108863,Nn=Math.imul($a,Do),wn=Math.imul($a,zo),wn=wn+Math.imul(Jo,Do)|0,zn=Math.imul(Jo,zo),Nn=Nn+Math.imul(Vo,Ll)|0,wn=wn+Math.imul(Vo,_l)|0,wn=wn+Math.imul(Uo,Ll)|0,zn=zn+Math.imul(Uo,_l)|0,Nn=Nn+Math.imul(No,xl)|0,wn=wn+Math.imul(No,Tl)|0,wn=wn+Math.imul(Fo,xl)|0,zn=zn+Math.imul(Fo,Tl)|0,Nn=Nn+Math.imul(qo,Bl)|0,wn=wn+Math.imul(qo,Il)|0,wn=wn+Math.imul(ga,Bl)|0,zn=zn+Math.imul(ga,Il)|0,Nn=Nn+Math.imul(Lo,Al)|0,wn=wn+Math.imul(Lo,Ol)|0,wn=wn+Math.imul(Wo,Al)|0,zn=zn+Math.imul(Wo,Ol)|0,Nn=Nn+Math.imul(yo,Ul)|0,wn=wn+Math.imul(yo,Sl)|0,wn=wn+Math.imul(_o,Ul)|0,zn=zn+Math.imul(_o,Sl)|0,Nn=Nn+Math.imul(lo,So)|0,wn=wn+Math.imul(lo,Co)|0,wn=wn+Math.imul(Eo,So)|0,zn=zn+Math.imul(Eo,Co)|0,Nn=Nn+Math.imul(vo,po)|0,wn=wn+Math.imul(vo,Ro)|0,wn=wn+Math.imul(go,po)|0,zn=zn+Math.imul(go,Ro)|0;var fu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(fu>>>26)|0,fu&=67108863,Nn=Math.imul(Cl,Do),wn=Math.imul(Cl,zo),wn=wn+Math.imul(ko,Do)|0,zn=Math.imul(ko,zo),Nn=Nn+Math.imul($a,Ll)|0,wn=wn+Math.imul($a,_l)|0,wn=wn+Math.imul(Jo,Ll)|0,zn=zn+Math.imul(Jo,_l)|0,Nn=Nn+Math.imul(Vo,xl)|0,wn=wn+Math.imul(Vo,Tl)|0,wn=wn+Math.imul(Uo,xl)|0,zn=zn+Math.imul(Uo,Tl)|0,Nn=Nn+Math.imul(No,Bl)|0,wn=wn+Math.imul(No,Il)|0,wn=wn+Math.imul(Fo,Bl)|0,zn=zn+Math.imul(Fo,Il)|0,Nn=Nn+Math.imul(qo,Al)|0,wn=wn+Math.imul(qo,Ol)|0,wn=wn+Math.imul(ga,Al)|0,zn=zn+Math.imul(ga,Ol)|0,Nn=Nn+Math.imul(Lo,Ul)|0,wn=wn+Math.imul(Lo,Sl)|0,wn=wn+Math.imul(Wo,Ul)|0,zn=zn+Math.imul(Wo,Sl)|0,Nn=Nn+Math.imul(yo,So)|0,wn=wn+Math.imul(yo,Co)|0,wn=wn+Math.imul(_o,So)|0,zn=zn+Math.imul(_o,Co)|0,Nn=Nn+Math.imul(lo,po)|0,wn=wn+Math.imul(lo,Ro)|0,wn=wn+Math.imul(Eo,po)|0,zn=zn+Math.imul(Eo,Ro)|0,Nn=Nn+Math.imul(vo,jo)|0,wn=wn+Math.imul(vo,Ko)|0,wn=wn+Math.imul(go,jo)|0,zn=zn+Math.imul(go,Ko)|0;var gu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(gu>>>26)|0,gu&=67108863,Nn=Math.imul(bo,Do),wn=Math.imul(bo,zo),wn=wn+Math.imul(Io,Do)|0,zn=Math.imul(Io,zo),Nn=Nn+Math.imul(Cl,Ll)|0,wn=wn+Math.imul(Cl,_l)|0,wn=wn+Math.imul(ko,Ll)|0,zn=zn+Math.imul(ko,_l)|0,Nn=Nn+Math.imul($a,xl)|0,wn=wn+Math.imul($a,Tl)|0,wn=wn+Math.imul(Jo,xl)|0,zn=zn+Math.imul(Jo,Tl)|0,Nn=Nn+Math.imul(Vo,Bl)|0,wn=wn+Math.imul(Vo,Il)|0,wn=wn+Math.imul(Uo,Bl)|0,zn=zn+Math.imul(Uo,Il)|0,Nn=Nn+Math.imul(No,Al)|0,wn=wn+Math.imul(No,Ol)|0,wn=wn+Math.imul(Fo,Al)|0,zn=zn+Math.imul(Fo,Ol)|0,Nn=Nn+Math.imul(qo,Ul)|0,wn=wn+Math.imul(qo,Sl)|0,wn=wn+Math.imul(ga,Ul)|0,zn=zn+Math.imul(ga,Sl)|0,Nn=Nn+Math.imul(Lo,So)|0,wn=wn+Math.imul(Lo,Co)|0,wn=wn+Math.imul(Wo,So)|0,zn=zn+Math.imul(Wo,Co)|0,Nn=Nn+Math.imul(yo,po)|0,wn=wn+Math.imul(yo,Ro)|0,wn=wn+Math.imul(_o,po)|0,zn=zn+Math.imul(_o,Ro)|0,Nn=Nn+Math.imul(lo,jo)|0,wn=wn+Math.imul(lo,Ko)|0,wn=wn+Math.imul(Eo,jo)|0,zn=zn+Math.imul(Eo,Ko)|0,Nn=Nn+Math.imul(vo,$l)|0,wn=wn+Math.imul(vo,El)|0,wn=wn+Math.imul(go,$l)|0,zn=zn+Math.imul(go,El)|0;var ou=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(ou>>>26)|0,ou&=67108863,Nn=Math.imul(bo,Ll),wn=Math.imul(bo,_l),wn=wn+Math.imul(Io,Ll)|0,zn=Math.imul(Io,_l),Nn=Nn+Math.imul(Cl,xl)|0,wn=wn+Math.imul(Cl,Tl)|0,wn=wn+Math.imul(ko,xl)|0,zn=zn+Math.imul(ko,Tl)|0,Nn=Nn+Math.imul($a,Bl)|0,wn=wn+Math.imul($a,Il)|0,wn=wn+Math.imul(Jo,Bl)|0,zn=zn+Math.imul(Jo,Il)|0,Nn=Nn+Math.imul(Vo,Al)|0,wn=wn+Math.imul(Vo,Ol)|0,wn=wn+Math.imul(Uo,Al)|0,zn=zn+Math.imul(Uo,Ol)|0,Nn=Nn+Math.imul(No,Ul)|0,wn=wn+Math.imul(No,Sl)|0,wn=wn+Math.imul(Fo,Ul)|0,zn=zn+Math.imul(Fo,Sl)|0,Nn=Nn+Math.imul(qo,So)|0,wn=wn+Math.imul(qo,Co)|0,wn=wn+Math.imul(ga,So)|0,zn=zn+Math.imul(ga,Co)|0,Nn=Nn+Math.imul(Lo,po)|0,wn=wn+Math.imul(Lo,Ro)|0,wn=wn+Math.imul(Wo,po)|0,zn=zn+Math.imul(Wo,Ro)|0,Nn=Nn+Math.imul(yo,jo)|0,wn=wn+Math.imul(yo,Ko)|0,wn=wn+Math.imul(_o,jo)|0,zn=zn+Math.imul(_o,Ko)|0,Nn=Nn+Math.imul(lo,$l)|0,wn=wn+Math.imul(lo,El)|0,wn=wn+Math.imul(Eo,$l)|0,zn=zn+Math.imul(Eo,El)|0;var su=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(su>>>26)|0,su&=67108863,Nn=Math.imul(bo,xl),wn=Math.imul(bo,Tl),wn=wn+Math.imul(Io,xl)|0,zn=Math.imul(Io,Tl),Nn=Nn+Math.imul(Cl,Bl)|0,wn=wn+Math.imul(Cl,Il)|0,wn=wn+Math.imul(ko,Bl)|0,zn=zn+Math.imul(ko,Il)|0,Nn=Nn+Math.imul($a,Al)|0,wn=wn+Math.imul($a,Ol)|0,wn=wn+Math.imul(Jo,Al)|0,zn=zn+Math.imul(Jo,Ol)|0,Nn=Nn+Math.imul(Vo,Ul)|0,wn=wn+Math.imul(Vo,Sl)|0,wn=wn+Math.imul(Uo,Ul)|0,zn=zn+Math.imul(Uo,Sl)|0,Nn=Nn+Math.imul(No,So)|0,wn=wn+Math.imul(No,Co)|0,wn=wn+Math.imul(Fo,So)|0,zn=zn+Math.imul(Fo,Co)|0,Nn=Nn+Math.imul(qo,po)|0,wn=wn+Math.imul(qo,Ro)|0,wn=wn+Math.imul(ga,po)|0,zn=zn+Math.imul(ga,Ro)|0,Nn=Nn+Math.imul(Lo,jo)|0,wn=wn+Math.imul(Lo,Ko)|0,wn=wn+Math.imul(Wo,jo)|0,zn=zn+Math.imul(Wo,Ko)|0,Nn=Nn+Math.imul(yo,$l)|0,wn=wn+Math.imul(yo,El)|0,wn=wn+Math.imul(_o,$l)|0,zn=zn+Math.imul(_o,El)|0;var tu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(tu>>>26)|0,tu&=67108863,Nn=Math.imul(bo,Bl),wn=Math.imul(bo,Il),wn=wn+Math.imul(Io,Bl)|0,zn=Math.imul(Io,Il),Nn=Nn+Math.imul(Cl,Al)|0,wn=wn+Math.imul(Cl,Ol)|0,wn=wn+Math.imul(ko,Al)|0,zn=zn+Math.imul(ko,Ol)|0,Nn=Nn+Math.imul($a,Ul)|0,wn=wn+Math.imul($a,Sl)|0,wn=wn+Math.imul(Jo,Ul)|0,zn=zn+Math.imul(Jo,Sl)|0,Nn=Nn+Math.imul(Vo,So)|0,wn=wn+Math.imul(Vo,Co)|0,wn=wn+Math.imul(Uo,So)|0,zn=zn+Math.imul(Uo,Co)|0,Nn=Nn+Math.imul(No,po)|0,wn=wn+Math.imul(No,Ro)|0,wn=wn+Math.imul(Fo,po)|0,zn=zn+Math.imul(Fo,Ro)|0,Nn=Nn+Math.imul(qo,jo)|0,wn=wn+Math.imul(qo,Ko)|0,wn=wn+Math.imul(ga,jo)|0,zn=zn+Math.imul(ga,Ko)|0,Nn=Nn+Math.imul(Lo,$l)|0,wn=wn+Math.imul(Lo,El)|0,wn=wn+Math.imul(Wo,$l)|0,zn=zn+Math.imul(Wo,El)|0;var zl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(zl>>>26)|0,zl&=67108863,Nn=Math.imul(bo,Al),wn=Math.imul(bo,Ol),wn=wn+Math.imul(Io,Al)|0,zn=Math.imul(Io,Ol),Nn=Nn+Math.imul(Cl,Ul)|0,wn=wn+Math.imul(Cl,Sl)|0,wn=wn+Math.imul(ko,Ul)|0,zn=zn+Math.imul(ko,Sl)|0,Nn=Nn+Math.imul($a,So)|0,wn=wn+Math.imul($a,Co)|0,wn=wn+Math.imul(Jo,So)|0,zn=zn+Math.imul(Jo,Co)|0,Nn=Nn+Math.imul(Vo,po)|0,wn=wn+Math.imul(Vo,Ro)|0,wn=wn+Math.imul(Uo,po)|0,zn=zn+Math.imul(Uo,Ro)|0,Nn=Nn+Math.imul(No,jo)|0,wn=wn+Math.imul(No,Ko)|0,wn=wn+Math.imul(Fo,jo)|0,zn=zn+Math.imul(Fo,Ko)|0,Nn=Nn+Math.imul(qo,$l)|0,wn=wn+Math.imul(qo,El)|0,wn=wn+Math.imul(ga,$l)|0,zn=zn+Math.imul(ga,El)|0;var Gl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Gl>>>26)|0,Gl&=67108863,Nn=Math.imul(bo,Ul),wn=Math.imul(bo,Sl),wn=wn+Math.imul(Io,Ul)|0,zn=Math.imul(Io,Sl),Nn=Nn+Math.imul(Cl,So)|0,wn=wn+Math.imul(Cl,Co)|0,wn=wn+Math.imul(ko,So)|0,zn=zn+Math.imul(ko,Co)|0,Nn=Nn+Math.imul($a,po)|0,wn=wn+Math.imul($a,Ro)|0,wn=wn+Math.imul(Jo,po)|0,zn=zn+Math.imul(Jo,Ro)|0,Nn=Nn+Math.imul(Vo,jo)|0,wn=wn+Math.imul(Vo,Ko)|0,wn=wn+Math.imul(Uo,jo)|0,zn=zn+Math.imul(Uo,Ko)|0,Nn=Nn+Math.imul(No,$l)|0,wn=wn+Math.imul(No,El)|0,wn=wn+Math.imul(Fo,$l)|0,zn=zn+Math.imul(Fo,El)|0;var Jl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Jl>>>26)|0,Jl&=67108863,Nn=Math.imul(bo,So),wn=Math.imul(bo,Co),wn=wn+Math.imul(Io,So)|0,zn=Math.imul(Io,Co),Nn=Nn+Math.imul(Cl,po)|0,wn=wn+Math.imul(Cl,Ro)|0,wn=wn+Math.imul(ko,po)|0,zn=zn+Math.imul(ko,Ro)|0,Nn=Nn+Math.imul($a,jo)|0,wn=wn+Math.imul($a,Ko)|0,wn=wn+Math.imul(Jo,jo)|0,zn=zn+Math.imul(Jo,Ko)|0,Nn=Nn+Math.imul(Vo,$l)|0,wn=wn+Math.imul(Vo,El)|0,wn=wn+Math.imul(Uo,$l)|0,zn=zn+Math.imul(Uo,El)|0;var Pl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Pl>>>26)|0,Pl&=67108863,Nn=Math.imul(bo,po),wn=Math.imul(bo,Ro),wn=wn+Math.imul(Io,po)|0,zn=Math.imul(Io,Ro),Nn=Nn+Math.imul(Cl,jo)|0,wn=wn+Math.imul(Cl,Ko)|0,wn=wn+Math.imul(ko,jo)|0,zn=zn+Math.imul(ko,Ko)|0,Nn=Nn+Math.imul($a,$l)|0,wn=wn+Math.imul($a,El)|0,wn=wn+Math.imul(Jo,$l)|0,zn=zn+Math.imul(Jo,El)|0;var Fl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Fl>>>26)|0,Fl&=67108863,Nn=Math.imul(bo,jo),wn=Math.imul(bo,Ko),wn=wn+Math.imul(Io,jo)|0,zn=Math.imul(Io,Ko),Nn=Nn+Math.imul(Cl,$l)|0,wn=wn+Math.imul(Cl,El)|0,wn=wn+Math.imul(ko,$l)|0,zn=zn+Math.imul(ko,El)|0;var Yl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Yl>>>26)|0,Yl&=67108863,Nn=Math.imul(bo,$l),wn=Math.imul(bo,El),wn=wn+Math.imul(Io,$l)|0,zn=Math.imul(Io,El);var Vl=(Zn+Nn|0)+((wn&8191)<<13)|0;return Zn=(zn+(wn>>>13)|0)+(Vl>>>26)|0,Vl&=67108863,On[0]=Cu,On[1]=iu,On[2]=pu,On[3]=yu,On[4]=hu,On[5]=mu,On[6]=vu,On[7]=fu,On[8]=gu,On[9]=ou,On[10]=su,On[11]=tu,On[12]=zl,On[13]=Gl,On[14]=Jl,On[15]=Pl,On[16]=Fl,On[17]=Yl,On[18]=Vl,Zn!==0&&(On[19]=Zn,Sn.length++),Sn};Math.imul||(An=In);function jn(Tn,Hr,Xr){Xr.negative=Hr.negative^Tn.negative,Xr.length=Tn.length+Hr.length;for(var Sn=0,Rn=0,Pn=0;Pn>>26)|0,Rn+=On>>>26,On&=67108863}Xr.words[Pn]=Zn,Sn=On,On=Rn}return Sn!==0?Xr.words[Pn]=Sn:Xr.length--,Xr._strip()}function eo(Tn,Hr,Xr){return jn(Tn,Hr,Xr)}jr.prototype.mulTo=function(Hr,Xr){var Sn,Rn=this.length+Hr.length;return this.length===10&&Hr.length===10?Sn=An(this,Hr,Xr):Rn<63?Sn=In(this,Hr,Xr):Rn<1024?Sn=jn(this,Hr,Xr):Sn=eo(this,Hr,Xr),Sn},jr.prototype.mul=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),this.mulTo(Hr,Xr)},jr.prototype.mulf=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),eo(this,Hr,Xr)},jr.prototype.imul=function(Hr){return this.clone().mulTo(Hr,this)},jr.prototype.imuln=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(typeof Hr=="number"),Er(Hr<67108864);for(var Sn=0,Rn=0;Rn>=26,Sn+=Pn/67108864|0,Sn+=On>>>26,this.words[Rn]=On&67108863}return Sn!==0&&(this.words[Rn]=Sn,this.length++),Xr?this.ineg():this},jr.prototype.muln=function(Hr){return this.clone().imuln(Hr)},jr.prototype.sqr=function(){return this.mul(this)},jr.prototype.isqr=function(){return this.imul(this.clone())},jr.prototype.pow=function(Hr){var Xr=Cn(Hr);if(Xr.length===0)return new jr(1);for(var Sn=this,Rn=0;Rn=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=67108863>>>26-Xr<<26-Xr,Pn;if(Xr!==0){var On=0;for(Pn=0;Pn>>26-Xr}On&&(this.words[Pn]=On,this.length++)}if(Sn!==0){for(Pn=this.length-1;Pn>=0;Pn--)this.words[Pn+Sn]=this.words[Pn];for(Pn=0;Pn=0);var Rn;Xr?Rn=(Xr-Xr%26)/26:Rn=0;var Pn=Hr%26,On=Math.min((Hr-Pn)/26,this.length),Zn=67108863^67108863>>>Pn<On)for(this.length-=On,wn=0;wn=0&&(zn!==0||wn>=Rn);wn--){var fo=this.words[wn]|0;this.words[wn]=zn<<26-Pn|fo>>>Pn,zn=fo&Zn}return Nn&&zn!==0&&(Nn.words[Nn.length++]=zn),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},jr.prototype.ishrn=function(Hr,Xr,Sn){return Er(this.negative===0),this.iushrn(Hr,Xr,Sn)},jr.prototype.shln=function(Hr){return this.clone().ishln(Hr)},jr.prototype.ushln=function(Hr){return this.clone().iushln(Hr)},jr.prototype.shrn=function(Hr){return this.clone().ishrn(Hr)},jr.prototype.ushrn=function(Hr){return this.clone().iushrn(Hr)},jr.prototype.testn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<=0);var Xr=Hr%26,Sn=(Hr-Xr)/26;if(Er(this.negative===0,"imaskn works only with positive numbers"),this.length<=Sn)return this;if(Xr!==0&&Sn++,this.length=Math.min(Sn,this.length),Xr!==0){var Rn=67108863^67108863>>>Xr<=67108864;Xr++)this.words[Xr]-=67108864,Xr===this.length-1?this.words[Xr+1]=1:this.words[Xr+1]++;return this.length=Math.max(this.length,Xr+1),this},jr.prototype.isubn=function(Hr){if(Er(typeof Hr=="number"),Er(Hr<67108864),Hr<0)return this.iaddn(-Hr);if(this.negative!==0)return this.negative=0,this.iaddn(Hr),this.negative=1,this;if(this.words[0]-=Hr,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Xr=0;Xr>26)-(Nn/67108864|0),this.words[Pn+Sn]=On&67108863}for(;Pn>26,this.words[Pn+Sn]=On&67108863;if(Zn===0)return this._strip();for(Er(Zn===-1),Zn=0,Pn=0;Pn>26,this.words[Pn]=On&67108863;return this.negative=1,this._strip()},jr.prototype._wordDiv=function(Hr,Xr){var Sn=this.length-Hr.length,Rn=this.clone(),Pn=Hr,On=Pn.words[Pn.length-1]|0,Zn=this._countBits(On);Sn=26-Zn,Sn!==0&&(Pn=Pn.ushln(Sn),Rn.iushln(Sn),On=Pn.words[Pn.length-1]|0);var Nn=Rn.length-Pn.length,wn;if(Xr!=="mod"){wn=new jr(null),wn.length=Nn+1,wn.words=new Array(wn.length);for(var zn=0;zn=0;vo--){var go=(Rn.words[Pn.length+vo]|0)*67108864+(Rn.words[Pn.length+vo-1]|0);for(go=Math.min(go/On|0,67108863),Rn._ishlnsubmul(Pn,go,vo);Rn.negative!==0;)go--,Rn.negative=0,Rn._ishlnsubmul(Pn,1,vo),Rn.isZero()||(Rn.negative^=1);wn&&(wn.words[vo]=go)}return wn&&wn._strip(),Rn._strip(),Xr!=="div"&&Sn!==0&&Rn.iushrn(Sn),{div:wn||null,mod:Rn}},jr.prototype.divmod=function(Hr,Xr,Sn){if(Er(!Hr.isZero()),this.isZero())return{div:new jr(0),mod:new jr(0)};var Rn,Pn,On;return this.negative!==0&&Hr.negative===0?(On=this.neg().divmod(Hr,Xr),Xr!=="mod"&&(Rn=On.div.neg()),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.iadd(Hr)),{div:Rn,mod:Pn}):this.negative===0&&Hr.negative!==0?(On=this.divmod(Hr.neg(),Xr),Xr!=="mod"&&(Rn=On.div.neg()),{div:Rn,mod:On.mod}):this.negative&Hr.negative?(On=this.neg().divmod(Hr.neg(),Xr),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.isub(Hr)),{div:On.div,mod:Pn}):Hr.length>this.length||this.cmp(Hr)<0?{div:new jr(0),mod:this}:Hr.length===1?Xr==="div"?{div:this.divn(Hr.words[0]),mod:null}:Xr==="mod"?{div:null,mod:new jr(this.modrn(Hr.words[0]))}:{div:this.divn(Hr.words[0]),mod:new jr(this.modrn(Hr.words[0]))}:this._wordDiv(Hr,Xr)},jr.prototype.div=function(Hr){return this.divmod(Hr,"div",!1).div},jr.prototype.mod=function(Hr){return this.divmod(Hr,"mod",!1).mod},jr.prototype.umod=function(Hr){return this.divmod(Hr,"mod",!0).mod},jr.prototype.divRound=function(Hr){var Xr=this.divmod(Hr);if(Xr.mod.isZero())return Xr.div;var Sn=Xr.div.negative!==0?Xr.mod.isub(Hr):Xr.mod,Rn=Hr.ushrn(1),Pn=Hr.andln(1),On=Sn.cmp(Rn);return On<0||Pn===1&&On===0?Xr.div:Xr.div.negative!==0?Xr.div.isubn(1):Xr.div.iaddn(1)},jr.prototype.modrn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=(1<<26)%Hr,Rn=0,Pn=this.length-1;Pn>=0;Pn--)Rn=(Sn*Rn+(this.words[Pn]|0))%Hr;return Xr?-Rn:Rn},jr.prototype.modn=function(Hr){return this.modrn(Hr)},jr.prototype.idivn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=0,Rn=this.length-1;Rn>=0;Rn--){var Pn=(this.words[Rn]|0)+Sn*67108864;this.words[Rn]=Pn/Hr|0,Sn=Pn%Hr}return this._strip(),Xr?this.ineg():this},jr.prototype.divn=function(Hr){return this.clone().idivn(Hr)},jr.prototype.egcd=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=new jr(0),Zn=new jr(1),Nn=0;Xr.isEven()&&Sn.isEven();)Xr.iushrn(1),Sn.iushrn(1),++Nn;for(var wn=Sn.clone(),zn=Xr.clone();!Xr.isZero();){for(var fo=0,vo=1;!(Xr.words[0]&vo)&&fo<26;++fo,vo<<=1);if(fo>0)for(Xr.iushrn(fo);fo-- >0;)(Rn.isOdd()||Pn.isOdd())&&(Rn.iadd(wn),Pn.isub(zn)),Rn.iushrn(1),Pn.iushrn(1);for(var go=0,uo=1;!(Sn.words[0]&uo)&&go<26;++go,uo<<=1);if(go>0)for(Sn.iushrn(go);go-- >0;)(On.isOdd()||Zn.isOdd())&&(On.iadd(wn),Zn.isub(zn)),On.iushrn(1),Zn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(On),Pn.isub(Zn)):(Sn.isub(Xr),On.isub(Rn),Zn.isub(Pn))}return{a:On,b:Zn,gcd:Sn.iushln(Nn)}},jr.prototype._invmp=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=Sn.clone();Xr.cmpn(1)>0&&Sn.cmpn(1)>0;){for(var Zn=0,Nn=1;!(Xr.words[0]&Nn)&&Zn<26;++Zn,Nn<<=1);if(Zn>0)for(Xr.iushrn(Zn);Zn-- >0;)Rn.isOdd()&&Rn.iadd(On),Rn.iushrn(1);for(var wn=0,zn=1;!(Sn.words[0]&zn)&&wn<26;++wn,zn<<=1);if(wn>0)for(Sn.iushrn(wn);wn-- >0;)Pn.isOdd()&&Pn.iadd(On),Pn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(Pn)):(Sn.isub(Xr),Pn.isub(Rn))}var fo;return Xr.cmpn(1)===0?fo=Rn:fo=Pn,fo.cmpn(0)<0&&fo.iadd(Hr),fo},jr.prototype.gcd=function(Hr){if(this.isZero())return Hr.abs();if(Hr.isZero())return this.abs();var Xr=this.clone(),Sn=Hr.clone();Xr.negative=0,Sn.negative=0;for(var Rn=0;Xr.isEven()&&Sn.isEven();Rn++)Xr.iushrn(1),Sn.iushrn(1);do{for(;Xr.isEven();)Xr.iushrn(1);for(;Sn.isEven();)Sn.iushrn(1);var Pn=Xr.cmp(Sn);if(Pn<0){var On=Xr;Xr=Sn,Sn=On}else if(Pn===0||Sn.cmpn(1)===0)break;Xr.isub(Sn)}while(!0);return Sn.iushln(Rn)},jr.prototype.invm=function(Hr){return this.egcd(Hr).a.umod(Hr)},jr.prototype.isEven=function(){return(this.words[0]&1)===0},jr.prototype.isOdd=function(){return(this.words[0]&1)===1},jr.prototype.andln=function(Hr){return this.words[0]&Hr},jr.prototype.bincn=function(Hr){Er(typeof Hr=="number");var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<>>26,Zn&=67108863,this.words[On]=Zn}return Pn!==0&&(this.words[On]=Pn,this.length++),this},jr.prototype.isZero=function(){return this.length===1&&this.words[0]===0},jr.prototype.cmpn=function(Hr){var Xr=Hr<0;if(this.negative!==0&&!Xr)return-1;if(this.negative===0&&Xr)return 1;this._strip();var Sn;if(this.length>1)Sn=1;else{Xr&&(Hr=-Hr),Er(Hr<=67108863,"Number is too big");var Rn=this.words[0]|0;Sn=Rn===Hr?0:RnHr.length)return 1;if(this.length=0;Sn--){var Rn=this.words[Sn]|0,Pn=Hr.words[Sn]|0;if(Rn!==Pn){RnPn&&(Xr=1);break}}return Xr},jr.prototype.gtn=function(Hr){return this.cmpn(Hr)===1},jr.prototype.gt=function(Hr){return this.cmp(Hr)===1},jr.prototype.gten=function(Hr){return this.cmpn(Hr)>=0},jr.prototype.gte=function(Hr){return this.cmp(Hr)>=0},jr.prototype.ltn=function(Hr){return this.cmpn(Hr)===-1},jr.prototype.lt=function(Hr){return this.cmp(Hr)===-1},jr.prototype.lten=function(Hr){return this.cmpn(Hr)<=0},jr.prototype.lte=function(Hr){return this.cmp(Hr)<=0},jr.prototype.eqn=function(Hr){return this.cmpn(Hr)===0},jr.prototype.eq=function(Hr){return this.cmp(Hr)===0},jr.red=function(Hr){return new so(Hr)},jr.prototype.toRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),Er(this.negative===0,"red works only with positives"),Hr.convertTo(this)._forceRed(Hr)},jr.prototype.fromRed=function(){return Er(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},jr.prototype._forceRed=function(Hr){return this.red=Hr,this},jr.prototype.forceRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),this._forceRed(Hr)},jr.prototype.redAdd=function(Hr){return Er(this.red,"redAdd works only with red numbers"),this.red.add(this,Hr)},jr.prototype.redIAdd=function(Hr){return Er(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Hr)},jr.prototype.redSub=function(Hr){return Er(this.red,"redSub works only with red numbers"),this.red.sub(this,Hr)},jr.prototype.redISub=function(Hr){return Er(this.red,"redISub works only with red numbers"),this.red.isub(this,Hr)},jr.prototype.redShl=function(Hr){return Er(this.red,"redShl works only with red numbers"),this.red.shl(this,Hr)},jr.prototype.redMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.mul(this,Hr)},jr.prototype.redIMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.imul(this,Hr)},jr.prototype.redSqr=function(){return Er(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},jr.prototype.redISqr=function(){return Er(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},jr.prototype.redSqrt=function(){return Er(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},jr.prototype.redInvm=function(){return Er(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},jr.prototype.redNeg=function(){return Er(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},jr.prototype.redPow=function(Hr){return Er(this.red&&!Hr.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Hr)};var ro={k256:null,p224:null,p192:null,p25519:null};function to(Tn,Hr){this.name=Tn,this.p=new jr(Hr,16),this.n=this.p.bitLength(),this.k=new jr(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}to.prototype._tmp=function(){var Hr=new jr(null);return Hr.words=new Array(Math.ceil(this.n/13)),Hr},to.prototype.ireduce=function(Hr){var Xr=Hr,Sn;do this.split(Xr,this.tmp),Xr=this.imulK(Xr),Xr=Xr.iadd(this.tmp),Sn=Xr.bitLength();while(Sn>this.n);var Rn=Sn0?Xr.isub(this.p):Xr.strip!==void 0?Xr.strip():Xr._strip(),Xr},to.prototype.split=function(Hr,Xr){Hr.iushrn(this.n,0,Xr)},to.prototype.imulK=function(Hr){return Hr.imul(this.k)};function _i(){to.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}kr(_i,to),_i.prototype.split=function(Hr,Xr){for(var Sn=4194303,Rn=Math.min(Hr.length,9),Pn=0;Pn>>22,On=Zn}On>>>=22,Hr.words[Pn-10]=On,On===0&&Hr.length>10?Hr.length-=10:Hr.length-=9},_i.prototype.imulK=function(Hr){Hr.words[Hr.length]=0,Hr.words[Hr.length+1]=0,Hr.length+=2;for(var Xr=0,Sn=0;Sn>>=26,Hr.words[Sn]=Pn,Xr=Rn}return Xr!==0&&(Hr.words[Hr.length++]=Xr),Hr},jr._prime=function(Hr){if(ro[Hr])return ro[Hr];var Xr;if(Hr==="k256")Xr=new _i;else if(Hr==="p224")Xr=new oo;else if(Hr==="p192")Xr=new io;else if(Hr==="p25519")Xr=new co;else throw new Error("Unknown prime "+Hr);return ro[Hr]=Xr,Xr};function so(Tn){if(typeof Tn=="string"){var Hr=jr._prime(Tn);this.m=Hr.p,this.prime=Hr}else Er(Tn.gtn(1),"modulus must be greater than 1"),this.m=Tn,this.prime=null}so.prototype._verify1=function(Hr){Er(Hr.negative===0,"red works only with positives"),Er(Hr.red,"red works only with red numbers")},so.prototype._verify2=function(Hr,Xr){Er((Hr.negative|Xr.negative)===0,"red works only with positives"),Er(Hr.red&&Hr.red===Xr.red,"red works only with red numbers")},so.prototype.imod=function(Hr){return this.prime?this.prime.ireduce(Hr)._forceRed(this):(Vr(Hr,Hr.umod(this.m)._forceRed(this)),Hr)},so.prototype.neg=function(Hr){return Hr.isZero()?Hr.clone():this.m.sub(Hr)._forceRed(this)},so.prototype.add=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.add(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn._forceRed(this)},so.prototype.iadd=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.iadd(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn},so.prototype.sub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.sub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn._forceRed(this)},so.prototype.isub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.isub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn},so.prototype.shl=function(Hr,Xr){return this._verify1(Hr),this.imod(Hr.ushln(Xr))},so.prototype.imul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.imul(Xr))},so.prototype.mul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.mul(Xr))},so.prototype.isqr=function(Hr){return this.imul(Hr,Hr.clone())},so.prototype.sqr=function(Hr){return this.mul(Hr,Hr)},so.prototype.sqrt=function(Hr){if(Hr.isZero())return Hr.clone();var Xr=this.m.andln(3);if(Er(Xr%2===1),Xr===3){var Sn=this.m.add(new jr(1)).iushrn(2);return this.pow(Hr,Sn)}for(var Rn=this.m.subn(1),Pn=0;!Rn.isZero()&&Rn.andln(1)===0;)Pn++,Rn.iushrn(1);Er(!Rn.isZero());var On=new jr(1).toRed(this),Zn=On.redNeg(),Nn=this.m.subn(1).iushrn(1),wn=this.m.bitLength();for(wn=new jr(2*wn*wn).toRed(this);this.pow(wn,Nn).cmp(Zn)!==0;)wn.redIAdd(Zn);for(var zn=this.pow(wn,Rn),fo=this.pow(Hr,Rn.addn(1).iushrn(1)),vo=this.pow(Hr,Rn),go=Pn;vo.cmp(On)!==0;){for(var uo=vo,lo=0;uo.cmp(On)!==0;lo++)uo=uo.redSqr();Er(lo=0;Pn--){for(var zn=Xr.words[Pn],fo=wn-1;fo>=0;fo--){var vo=zn>>fo&1;if(On!==Rn[0]&&(On=this.sqr(On)),vo===0&&Zn===0){Nn=0;continue}Zn<<=1,Zn|=vo,Nn++,!(Nn!==Sn&&(Pn!==0||fo!==0))&&(On=this.mul(On,Rn[Zn]),Nn=0,Zn=0)}wn=26}return On},so.prototype.convertTo=function(Hr){var Xr=Hr.umod(this.m);return Xr===Hr?Xr.clone():Xr},so.prototype.convertFrom=function(Hr){var Xr=Hr.clone();return Xr.red=null,Xr},jr.mont=function(Hr){return new no(Hr)};function no(Tn){so.call(this,Tn),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new jr(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}kr(no,so),no.prototype.convertTo=function(Hr){return this.imod(Hr.ushln(this.shift))},no.prototype.convertFrom=function(Hr){var Xr=this.imod(Hr.mul(this.rinv));return Xr.red=null,Xr},no.prototype.imul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return Hr.words[0]=0,Hr.length=1,Hr;var Sn=Hr.imul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.mul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return new jr(0)._forceRed(this);var Sn=Hr.mul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.invm=function(Hr){var Xr=this.imod(Hr._invmp(this.m).mul(this.r2));return Xr._forceRed(this)}})(fr,commonjsGlobal)}(bn$4)),bn$4.exports}var asn1$1={},asn1={},api$1={},vmBrowserify={},hasRequiredVmBrowserify;function requireVmBrowserify(){return hasRequiredVmBrowserify||(hasRequiredVmBrowserify=1,function(exports){var indexOf=function(fr,br){if(fr.indexOf)return fr.indexOf(br);for(var wr=0;wr"u"}fr.isPrimitive=Hr,fr.isBuffer=requireIsBufferBrowser();function Xr(zn){return Object.prototype.toString.call(zn)}function Sn(zn){return zn<10?"0"+zn.toString(10):zn.toString(10)}var Rn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Pn(){var zn=new Date,fo=[Sn(zn.getHours()),Sn(zn.getMinutes()),Sn(zn.getSeconds())].join(":");return[zn.getDate(),Rn[zn.getMonth()],fo].join(" ")}fr.log=function(){console.log("%s - %s",Pn(),fr.format.apply(fr,arguments))},fr.inherits=requireInherits_browser(),fr._extend=function(zn,fo){if(!fo||!co(fo))return zn;for(var vo=Object.keys(fo),go=vo.length;go--;)zn[vo[go]]=fo[vo[go]];return zn};function On(zn,fo){return Object.prototype.hasOwnProperty.call(zn,fo)}var Zn=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;fr.promisify=function(fo){if(typeof fo!="function")throw new TypeError('The "original" argument must be of type Function');if(Zn&&fo[Zn]){var vo=fo[Zn];if(typeof vo!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(vo,Zn,{value:vo,enumerable:!1,writable:!1,configurable:!0}),vo}function vo(){for(var go,uo,lo=new Promise(function(yo,_o){go=yo,uo=_o}),Eo=[],mo=0;mo0?this.tail.next=In:this.head=In,this.tail=In,++this.length}},{key:"unshift",value:function(Cn){var In={data:Cn,next:this.head};this.length===0&&(this.tail=In),this.head=In,++this.length}},{key:"shift",value:function(){if(this.length!==0){var Cn=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,Cn}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(Cn){if(this.length===0)return"";for(var In=this.head,An=""+In.data;In=In.next;)An+=Cn+In.data;return An}},{key:"concat",value:function(Cn){if(this.length===0)return Gr.alloc(0);for(var In=Gr.allocUnsafe(Cn>>>0),An=this.head,jn=0;An;)Qr(An.data,In,jn),jn+=An.data.length,An=An.next;return In}},{key:"consume",value:function(Cn,In){var An;return Cneo.length?eo.length:Cn;if(ro===eo.length?jn+=eo:jn+=eo.slice(0,Cn),Cn-=ro,Cn===0){ro===eo.length?(++An,In.next?this.head=In.next:this.head=this.tail=null):(this.head=In,In.data=eo.slice(ro));break}++An}return this.length-=An,jn}},{key:"_getBuffer",value:function(Cn){var In=Gr.allocUnsafe(Cn),An=this.head,jn=1;for(An.data.copy(In),Cn-=An.data.length;An=An.next;){var eo=An.data,ro=Cn>eo.length?eo.length:Cn;if(eo.copy(In,In.length-Cn,0,ro),Cn-=ro,Cn===0){ro===eo.length?(++jn,An.next?this.head=An.next:this.head=this.tail=null):(this.head=An,An.data=eo.slice(ro));break}++jn}return this.length-=jn,In}},{key:Jr,value:function(Cn,In){return Zr(this,br(br({},In),{},{depth:0,customInspect:!1}))}}]),_n}(),buffer_list}var destroy_1$1,hasRequiredDestroy$1;function requireDestroy$1(){if(hasRequiredDestroy$1)return destroy_1$1;hasRequiredDestroy$1=1;function fr(Br,Wr){var qr=this,Gr=this._readableState&&this._readableState.destroyed,Vr=this._writableState&&this._writableState.destroyed;return Gr||Vr?(Wr?Wr(Br):Br&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,process$1$1.nextTick(kr,this,Br)):process$1$1.nextTick(kr,this,Br)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(Br||null,function(Zr){!Wr&&Zr?qr._writableState?qr._writableState.errorEmitted?process$1$1.nextTick(wr,qr):(qr._writableState.errorEmitted=!0,process$1$1.nextTick(br,qr,Zr)):process$1$1.nextTick(br,qr,Zr):Wr?(process$1$1.nextTick(wr,qr),Wr(Zr)):process$1$1.nextTick(wr,qr)}),this)}function br(Br,Wr){kr(Br,Wr),wr(Br)}function wr(Br){Br._writableState&&!Br._writableState.emitClose||Br._readableState&&!Br._readableState.emitClose||Br.emit("close")}function Er(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function kr(Br,Wr){Br.emit("error",Wr)}function jr(Br,Wr){var qr=Br._readableState,Gr=Br._writableState;qr&&qr.autoDestroy||Gr&&Gr.autoDestroy?Br.destroy(Wr):Br.emit("error",Wr)}return destroy_1$1={destroy:fr,undestroy:Er,errorOrDestroy:jr},destroy_1$1}var errorsBrowser={},hasRequiredErrorsBrowser;function requireErrorsBrowser(){if(hasRequiredErrorsBrowser)return errorsBrowser;hasRequiredErrorsBrowser=1;function fr(Wr,qr){Wr.prototype=Object.create(qr.prototype),Wr.prototype.constructor=Wr,Wr.__proto__=qr}var br={};function wr(Wr,qr,Gr){Gr||(Gr=Error);function Vr(Jr,Qr,_n){return typeof qr=="string"?qr:qr(Jr,Qr,_n)}var Zr=function(Jr){fr(Qr,Jr);function Qr(_n,En,Cn){return Jr.call(this,Vr(_n,En,Cn))||this}return Qr}(Gr);Zr.prototype.name=Gr.name,Zr.prototype.code=Wr,br[Wr]=Zr}function Er(Wr,qr){if(Array.isArray(Wr)){var Gr=Wr.length;return Wr=Wr.map(function(Vr){return String(Vr)}),Gr>2?"one of ".concat(qr," ").concat(Wr.slice(0,Gr-1).join(", "),", or ")+Wr[Gr-1]:Gr===2?"one of ".concat(qr," ").concat(Wr[0]," or ").concat(Wr[1]):"of ".concat(qr," ").concat(Wr[0])}else return"of ".concat(qr," ").concat(String(Wr))}function kr(Wr,qr,Gr){return Wr.substr(0,qr.length)===qr}function jr(Wr,qr,Gr){return(Gr===void 0||Gr>Wr.length)&&(Gr=Wr.length),Wr.substring(Gr-qr.length,Gr)===qr}function Br(Wr,qr,Gr){return typeof Gr!="number"&&(Gr=0),Gr+qr.length>Wr.length?!1:Wr.indexOf(qr,Gr)!==-1}return wr("ERR_INVALID_OPT_VALUE",function(Wr,qr){return'The value "'+qr+'" is invalid for option "'+Wr+'"'},TypeError),wr("ERR_INVALID_ARG_TYPE",function(Wr,qr,Gr){var Vr;typeof qr=="string"&&kr(qr,"not ")?(Vr="must not be",qr=qr.replace(/^not /,"")):Vr="must be";var Zr;if(jr(Wr," argument"))Zr="The ".concat(Wr," ").concat(Vr," ").concat(Er(qr,"type"));else{var Jr=Br(Wr,".")?"property":"argument";Zr='The "'.concat(Wr,'" ').concat(Jr," ").concat(Vr," ").concat(Er(qr,"type"))}return Zr+=". Received type ".concat(typeof Gr),Zr},TypeError),wr("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),wr("ERR_METHOD_NOT_IMPLEMENTED",function(Wr){return"The "+Wr+" method is not implemented"}),wr("ERR_STREAM_PREMATURE_CLOSE","Premature close"),wr("ERR_STREAM_DESTROYED",function(Wr){return"Cannot call "+Wr+" after a stream was destroyed"}),wr("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),wr("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),wr("ERR_STREAM_WRITE_AFTER_END","write after end"),wr("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),wr("ERR_UNKNOWN_ENCODING",function(Wr){return"Unknown encoding: "+Wr},TypeError),wr("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),errorsBrowser.codes=br,errorsBrowser}var state,hasRequiredState;function requireState(){if(hasRequiredState)return state;hasRequiredState=1;var fr=requireErrorsBrowser().codes.ERR_INVALID_OPT_VALUE;function br(Er,kr,jr){return Er.highWaterMark!=null?Er.highWaterMark:kr?Er[jr]:null}function wr(Er,kr,jr,Br){var Wr=br(kr,Br,jr);if(Wr!=null){if(!(isFinite(Wr)&&Math.floor(Wr)===Wr)||Wr<0){var qr=Br?jr:"highWaterMark";throw new fr(qr,Wr)}return Math.floor(Wr)}return Er.objectMode?16:16*1024}return state={getHighWaterMark:wr},state}var browser$f,hasRequiredBrowser$a;function requireBrowser$a(){if(hasRequiredBrowser$a)return browser$f;hasRequiredBrowser$a=1,browser$f=fr;function fr(wr,Er){if(br("noDeprecation"))return wr;var kr=!1;function jr(){if(!kr){if(br("throwDeprecation"))throw new Error(Er);br("traceDeprecation")?console.trace(Er):console.warn(Er),kr=!0}return wr.apply(this,arguments)}return jr}function br(wr){try{if(!commonjsGlobal.localStorage)return!1}catch{return!1}var Er=commonjsGlobal.localStorage[wr];return Er==null?!1:String(Er).toLowerCase()==="true"}return browser$f}var _stream_writable$1,hasRequired_stream_writable$1;function require_stream_writable$1(){if(hasRequired_stream_writable$1)return _stream_writable$1;hasRequired_stream_writable$1=1,_stream_writable$1=oo;function fr(go){var uo=this;this.next=null,this.entry=null,this.finish=function(){vo(uo,go)}}var br;oo.WritableState=to;var wr={deprecate:requireBrowser$a()},Er=requireStreamBrowser$1(),kr=require$$0$9.Buffer,jr=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Br(go){return kr.from(go)}function Wr(go){return kr.isBuffer(go)||go instanceof jr}var qr=requireDestroy$1(),Gr=requireState(),Vr=Gr.getHighWaterMark,Zr=requireErrorsBrowser().codes,Jr=Zr.ERR_INVALID_ARG_TYPE,Qr=Zr.ERR_METHOD_NOT_IMPLEMENTED,_n=Zr.ERR_MULTIPLE_CALLBACK,En=Zr.ERR_STREAM_CANNOT_PIPE,Cn=Zr.ERR_STREAM_DESTROYED,In=Zr.ERR_STREAM_NULL_VALUES,An=Zr.ERR_STREAM_WRITE_AFTER_END,jn=Zr.ERR_UNKNOWN_ENCODING,eo=qr.errorOrDestroy;requireInherits_browser()(oo,Er);function ro(){}function to(go,uo,lo){br=br||require_stream_duplex$1(),go=go||{},typeof lo!="boolean"&&(lo=uo instanceof br),this.objectMode=!!go.objectMode,lo&&(this.objectMode=this.objectMode||!!go.writableObjectMode),this.highWaterMark=Vr(this,go,"writableHighWaterMark",lo),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var Eo=go.decodeStrings===!1;this.decodeStrings=!Eo,this.defaultEncoding=go.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(mo){Sn(uo,mo)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=go.emitClose!==!1,this.autoDestroy=!!go.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new fr(this)}to.prototype.getBuffer=function(){for(var uo=this.bufferedRequest,lo=[];uo;)lo.push(uo),uo=uo.next;return lo},function(){try{Object.defineProperty(to.prototype,"buffer",{get:wr.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var _i;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(_i=Function.prototype[Symbol.hasInstance],Object.defineProperty(oo,Symbol.hasInstance,{value:function(uo){return _i.call(this,uo)?!0:this!==oo?!1:uo&&uo._writableState instanceof to}})):_i=function(uo){return uo instanceof this};function oo(go){br=br||require_stream_duplex$1();var uo=this instanceof br;if(!uo&&!_i.call(oo,this))return new oo(go);this._writableState=new to(go,this,uo),this.writable=!0,go&&(typeof go.write=="function"&&(this._write=go.write),typeof go.writev=="function"&&(this._writev=go.writev),typeof go.destroy=="function"&&(this._destroy=go.destroy),typeof go.final=="function"&&(this._final=go.final)),Er.call(this)}oo.prototype.pipe=function(){eo(this,new En)};function io(go,uo){var lo=new An;eo(go,lo),process$1$1.nextTick(uo,lo)}function co(go,uo,lo,Eo){var mo;return lo===null?mo=new In:typeof lo!="string"&&!uo.objectMode&&(mo=new Jr("chunk",["string","Buffer"],lo)),mo?(eo(go,mo),process$1$1.nextTick(Eo,mo),!1):!0}oo.prototype.write=function(go,uo,lo){var Eo=this._writableState,mo=!1,yo=!Eo.objectMode&&Wr(go);return yo&&!kr.isBuffer(go)&&(go=Br(go)),typeof uo=="function"&&(lo=uo,uo=null),yo?uo="buffer":uo||(uo=Eo.defaultEncoding),typeof lo!="function"&&(lo=ro),Eo.ending?io(this,lo):(yo||co(this,Eo,go,lo))&&(Eo.pendingcb++,mo=no(this,Eo,yo,go,uo,lo)),mo},oo.prototype.cork=function(){this._writableState.corked++},oo.prototype.uncork=function(){var go=this._writableState;go.corked&&(go.corked--,!go.writing&&!go.corked&&!go.bufferProcessing&&go.bufferedRequest&&On(this,go))},oo.prototype.setDefaultEncoding=function(uo){if(typeof uo=="string"&&(uo=uo.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((uo+"").toLowerCase())>-1))throw new jn(uo);return this._writableState.defaultEncoding=uo,this},Object.defineProperty(oo.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function so(go,uo,lo){return!go.objectMode&&go.decodeStrings!==!1&&typeof uo=="string"&&(uo=kr.from(uo,lo)),uo}Object.defineProperty(oo.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function no(go,uo,lo,Eo,mo,yo){if(!lo){var _o=so(uo,Eo,mo);Eo!==_o&&(lo=!0,mo="buffer",Eo=_o)}var Bo=uo.objectMode?1:Eo.length;uo.length+=Bo;var Lo=uo.length>5===6?2:In>>4===14?3:In>>3===30?4:In>>6===2?-1:-2}function Br(In,An,jn){var eo=An.length-1;if(eo=0?(ro>0&&(In.lastNeed=ro-1),ro):--eo=0?(ro>0&&(In.lastNeed=ro-2),ro):--eo=0?(ro>0&&(ro===2?ro=0:In.lastNeed=ro-3),ro):0))}function Wr(In,An,jn){if((An[0]&192)!==128)return In.lastNeed=0,"�";if(In.lastNeed>1&&An.length>1){if((An[1]&192)!==128)return In.lastNeed=1,"�";if(In.lastNeed>2&&An.length>2&&(An[2]&192)!==128)return In.lastNeed=2,"�"}}function qr(In){var An=this.lastTotal-this.lastNeed,jn=Wr(this,In);if(jn!==void 0)return jn;if(this.lastNeed<=In.length)return In.copy(this.lastChar,An,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);In.copy(this.lastChar,An,0,In.length),this.lastNeed-=In.length}function Gr(In,An){var jn=Br(this,In,An);if(!this.lastNeed)return In.toString("utf8",An);this.lastTotal=jn;var eo=In.length-(jn-this.lastNeed);return In.copy(this.lastChar,0,eo),In.toString("utf8",An,eo)}function Vr(In){var An=In&&In.length?this.write(In):"";return this.lastNeed?An+"�":An}function Zr(In,An){if((In.length-An)%2===0){var jn=In.toString("utf16le",An);if(jn){var eo=jn.charCodeAt(jn.length-1);if(eo>=55296&&eo<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=In[In.length-2],this.lastChar[1]=In[In.length-1],jn.slice(0,-1)}return jn}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=In[In.length-1],In.toString("utf16le",An,In.length-1)}function Jr(In){var An=In&&In.length?this.write(In):"";if(this.lastNeed){var jn=this.lastTotal-this.lastNeed;return An+this.lastChar.toString("utf16le",0,jn)}return An}function Qr(In,An){var jn=(In.length-An)%3;return jn===0?In.toString("base64",An):(this.lastNeed=3-jn,this.lastTotal=3,jn===1?this.lastChar[0]=In[In.length-1]:(this.lastChar[0]=In[In.length-2],this.lastChar[1]=In[In.length-1]),In.toString("base64",An,In.length-jn))}function _n(In){var An=In&&In.length?this.write(In):"";return this.lastNeed?An+this.lastChar.toString("base64",0,3-this.lastNeed):An}function En(In){return In.toString(this.encoding)}function Cn(In){return In&&In.length?this.write(In):""}return string_decoder}var endOfStream,hasRequiredEndOfStream;function requireEndOfStream(){if(hasRequiredEndOfStream)return endOfStream;hasRequiredEndOfStream=1;var fr=requireErrorsBrowser().codes.ERR_STREAM_PREMATURE_CLOSE;function br(jr){var Br=!1;return function(){if(!Br){Br=!0;for(var Wr=arguments.length,qr=new Array(Wr),Gr=0;Gr0)if(typeof _o!="string"&&!na.objectMode&&Object.getPrototypeOf(_o)!==Er.prototype&&(_o=jr(_o)),Lo)na.endEmitted?ro(yo,new In):so(yo,na,_o,!0);else if(na.ended)ro(yo,new En);else{if(na.destroyed)return!1;na.reading=!1,na.decoder&&!Bo?(_o=na.decoder.write(_o),na.objectMode||_o.length!==0?so(yo,na,_o,!1):On(yo,na)):so(yo,na,_o,!1)}else Lo||(na.reading=!1,On(yo,na))}return!na.ended&&(na.length=Tn?yo=Tn:(yo--,yo|=yo>>>1,yo|=yo>>>2,yo|=yo>>>4,yo|=yo>>>8,yo|=yo>>>16,yo++),yo}function Xr(yo,_o){return yo<=0||_o.length===0&&_o.ended?0:_o.objectMode?1:yo!==yo?_o.flowing&&_o.length?_o.buffer.head.data.length:_o.length:(yo>_o.highWaterMark&&(_o.highWaterMark=Hr(yo)),yo<=_o.length?yo:_o.ended?_o.length:(_o.needReadable=!0,0))}io.prototype.read=function(yo){qr("read",yo),yo=parseInt(yo,10);var _o=this._readableState,Bo=yo;if(yo!==0&&(_o.emittedReadable=!1),yo===0&&_o.needReadable&&((_o.highWaterMark!==0?_o.length>=_o.highWaterMark:_o.length>0)||_o.ended))return qr("read: emitReadable",_o.length,_o.ended),_o.length===0&&_o.ended?lo(this):Rn(this),null;if(yo=Xr(yo,_o),yo===0&&_o.ended)return _o.length===0&&lo(this),null;var Lo=_o.needReadable;qr("need readable",Lo),(_o.length===0||_o.length-yo<_o.highWaterMark)&&(Lo=!0,qr("length less than watermark",Lo)),_o.ended||_o.reading?(Lo=!1,qr("reading or ended",Lo)):Lo&&(qr("do read"),_o.reading=!0,_o.sync=!0,_o.length===0&&(_o.needReadable=!0),this._read(_o.highWaterMark),_o.sync=!1,_o.reading||(yo=Xr(Bo,_o)));var Wo;return yo>0?Wo=uo(yo,_o):Wo=null,Wo===null?(_o.needReadable=_o.length<=_o.highWaterMark,yo=0):(_o.length-=yo,_o.awaitDrain=0),_o.length===0&&(_o.ended||(_o.needReadable=!0),Bo!==yo&&_o.ended&&lo(this)),Wo!==null&&this.emit("data",Wo),Wo};function Sn(yo,_o){if(qr("onEofChunk"),!_o.ended){if(_o.decoder){var Bo=_o.decoder.end();Bo&&Bo.length&&(_o.buffer.push(Bo),_o.length+=_o.objectMode?1:Bo.length)}_o.ended=!0,_o.sync?Rn(yo):(_o.needReadable=!1,_o.emittedReadable||(_o.emittedReadable=!0,Pn(yo)))}}function Rn(yo){var _o=yo._readableState;qr("emitReadable",_o.needReadable,_o.emittedReadable),_o.needReadable=!1,_o.emittedReadable||(qr("emitReadable",_o.flowing),_o.emittedReadable=!0,process$1$1.nextTick(Pn,yo))}function Pn(yo){var _o=yo._readableState;qr("emitReadable_",_o.destroyed,_o.length,_o.ended),!_o.destroyed&&(_o.length||_o.ended)&&(yo.emit("readable"),_o.emittedReadable=!1),_o.needReadable=!_o.flowing&&!_o.ended&&_o.length<=_o.highWaterMark,go(yo)}function On(yo,_o){_o.readingMore||(_o.readingMore=!0,process$1$1.nextTick(Zn,yo,_o))}function Zn(yo,_o){for(;!_o.reading&&!_o.ended&&(_o.length<_o.highWaterMark||_o.flowing&&_o.length===0);){var Bo=_o.length;if(qr("maybeReadMore read 0"),yo.read(0),Bo===_o.length)break}_o.readingMore=!1}io.prototype._read=function(yo){ro(this,new Cn("_read()"))},io.prototype.pipe=function(yo,_o){var Bo=this,Lo=this._readableState;switch(Lo.pipesCount){case 0:Lo.pipes=yo;break;case 1:Lo.pipes=[Lo.pipes,yo];break;default:Lo.pipes.push(yo);break}Lo.pipesCount+=1,qr("pipe count=%d opts=%j",Lo.pipesCount,_o);var Wo=(!_o||_o.end!==!1)&&yo!==process$1$1.stdout&&yo!==process$1$1.stderr,na=Wo?ga:$a;Lo.endEmitted?process$1$1.nextTick(na):Bo.once("end",na),yo.on("unpipe",qo);function qo(Jo,Zl){qr("onunpipe"),Jo===Bo&&Zl&&Zl.hasUnpiped===!1&&(Zl.hasUnpiped=!0,Uo())}function ga(){qr("onend"),yo.end()}var wl=Nn(Bo);yo.on("drain",wl);var No=!1;function Uo(){qr("cleanup"),yo.removeListener("close",Fo),yo.removeListener("finish",Ol),yo.removeListener("drain",wl),yo.removeListener("error",Vo),yo.removeListener("unpipe",qo),Bo.removeListener("end",ga),Bo.removeListener("end",$a),Bo.removeListener("data",Nl),No=!0,Lo.awaitDrain&&(!yo._writableState||yo._writableState.needDrain)&&wl()}Bo.on("data",Nl);function Nl(Jo){qr("ondata");var Zl=yo.write(Jo);qr("dest.write",Zl),Zl===!1&&((Lo.pipesCount===1&&Lo.pipes===yo||Lo.pipesCount>1&&mo(Lo.pipes,yo)!==-1)&&!No&&(qr("false write response, pause",Lo.awaitDrain),Lo.awaitDrain++),Bo.pause())}function Vo(Jo){qr("onerror",Jo),$a(),yo.removeListener("error",Vo),br(yo,"error")===0&&ro(yo,Jo)}_i(yo,"error",Vo);function Fo(){yo.removeListener("finish",Ol),$a()}yo.once("close",Fo);function Ol(){qr("onfinish"),yo.removeListener("close",Fo),$a()}yo.once("finish",Ol);function $a(){qr("unpipe"),Bo.unpipe(yo)}return yo.emit("pipe",Bo),Lo.flowing||(qr("pipe resume"),Bo.resume()),yo};function Nn(yo){return function(){var Bo=yo._readableState;qr("pipeOnDrain",Bo.awaitDrain),Bo.awaitDrain&&Bo.awaitDrain--,Bo.awaitDrain===0&&br(yo,"data")&&(Bo.flowing=!0,go(yo))}}io.prototype.unpipe=function(yo){var _o=this._readableState,Bo={hasUnpiped:!1};if(_o.pipesCount===0)return this;if(_o.pipesCount===1)return yo&&yo!==_o.pipes?this:(yo||(yo=_o.pipes),_o.pipes=null,_o.pipesCount=0,_o.flowing=!1,yo&&yo.emit("unpipe",this,Bo),this);if(!yo){var Lo=_o.pipes,Wo=_o.pipesCount;_o.pipes=null,_o.pipesCount=0,_o.flowing=!1;for(var na=0;na0,Lo.flowing!==!1&&this.resume()):yo==="readable"&&!Lo.endEmitted&&!Lo.readableListening&&(Lo.readableListening=Lo.needReadable=!0,Lo.flowing=!1,Lo.emittedReadable=!1,qr("on readable",Lo.length,Lo.reading),Lo.length?Rn(this):Lo.reading||process$1$1.nextTick(zn,this)),Bo},io.prototype.addListener=io.prototype.on,io.prototype.removeListener=function(yo,_o){var Bo=wr.prototype.removeListener.call(this,yo,_o);return yo==="readable"&&process$1$1.nextTick(wn,this),Bo},io.prototype.removeAllListeners=function(yo){var _o=wr.prototype.removeAllListeners.apply(this,arguments);return(yo==="readable"||yo===void 0)&&process$1$1.nextTick(wn,this),_o};function wn(yo){var _o=yo._readableState;_o.readableListening=yo.listenerCount("readable")>0,_o.resumeScheduled&&!_o.paused?_o.flowing=!0:yo.listenerCount("data")>0&&yo.resume()}function zn(yo){qr("readable nexttick read 0"),yo.read(0)}io.prototype.resume=function(){var yo=this._readableState;return yo.flowing||(qr("resume"),yo.flowing=!yo.readableListening,fo(this,yo)),yo.paused=!1,this};function fo(yo,_o){_o.resumeScheduled||(_o.resumeScheduled=!0,process$1$1.nextTick(vo,yo,_o))}function vo(yo,_o){qr("resume",_o.reading),_o.reading||yo.read(0),_o.resumeScheduled=!1,yo.emit("resume"),go(yo),_o.flowing&&!_o.reading&&yo.read(0)}io.prototype.pause=function(){return qr("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(qr("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function go(yo){var _o=yo._readableState;for(qr("flow",_o.flowing);_o.flowing&&yo.read()!==null;);}io.prototype.wrap=function(yo){var _o=this,Bo=this._readableState,Lo=!1;yo.on("end",function(){if(qr("wrapped end"),Bo.decoder&&!Bo.ended){var qo=Bo.decoder.end();qo&&qo.length&&_o.push(qo)}_o.push(null)}),yo.on("data",function(qo){if(qr("wrapped data"),Bo.decoder&&(qo=Bo.decoder.write(qo)),!(Bo.objectMode&&qo==null)&&!(!Bo.objectMode&&(!qo||!qo.length))){var ga=_o.push(qo);ga||(Lo=!0,yo.pause())}});for(var Wo in yo)this[Wo]===void 0&&typeof yo[Wo]=="function"&&(this[Wo]=function(ga){return function(){return yo[ga].apply(yo,arguments)}}(Wo));for(var na=0;na=_o.length?(_o.decoder?Bo=_o.buffer.join(""):_o.buffer.length===1?Bo=_o.buffer.first():Bo=_o.buffer.concat(_o.length),_o.buffer.clear()):Bo=_o.buffer.consume(yo,_o.decoder),Bo}function lo(yo){var _o=yo._readableState;qr("endReadable",_o.endEmitted),_o.endEmitted||(_o.ended=!0,process$1$1.nextTick(Eo,_o,yo))}function Eo(yo,_o){if(qr("endReadableNT",yo.endEmitted,yo.length),!yo.endEmitted&&yo.length===0&&(yo.endEmitted=!0,_o.readable=!1,_o.emit("end"),yo.autoDestroy)){var Bo=_o._writableState;(!Bo||Bo.autoDestroy&&Bo.finished)&&_o.destroy()}}typeof Symbol=="function"&&(io.from=function(yo,_o){return eo===void 0&&(eo=requireFromBrowser()),eo(io,yo,_o)});function mo(yo,_o){for(var Bo=0,Lo=yo.length;Bo0;return Wr(An,eo,ro,function(to){Cn||(Cn=to),to&&In.forEach(qr),!eo&&(In.forEach(qr),En(Cn))})});return Qr.reduce(Gr)}return pipeline_1=Zr,pipeline_1}var hasRequiredReadableBrowser$1;function requireReadableBrowser$1(){return hasRequiredReadableBrowser$1||(hasRequiredReadableBrowser$1=1,function(fr,br){br=fr.exports=require_stream_readable$1(),br.Stream=br,br.Readable=br,br.Writable=require_stream_writable$1(),br.Duplex=require_stream_duplex$1(),br.Transform=require_stream_transform$1(),br.PassThrough=require_stream_passthrough$1(),br.finished=requireEndOfStream(),br.pipeline=requirePipeline()}(readableBrowser$1,readableBrowser$1.exports)),readableBrowser$1.exports}var hashBase$1,hasRequiredHashBase$1;function requireHashBase$1(){if(hasRequiredHashBase$1)return hashBase$1;hasRequiredHashBase$1=1;var fr=safeBufferExports.Buffer,br=requireReadableBrowser$1().Transform,wr=requireInherits_browser();function Er(jr,Br){if(!fr.isBuffer(jr)&&typeof jr!="string")throw new TypeError(Br+" must be a string or a buffer")}function kr(jr){br.call(this),this._block=fr.allocUnsafe(jr),this._blockSize=jr,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}return wr(kr,br),kr.prototype._transform=function(jr,Br,Wr){var qr=null;try{this.update(jr,Br)}catch(Gr){qr=Gr}Wr(qr)},kr.prototype._flush=function(jr){var Br=null;try{this.push(this.digest())}catch(Wr){Br=Wr}jr(Br)},kr.prototype.update=function(jr,Br){if(Er(jr,"Data"),this._finalized)throw new Error("Digest already called");fr.isBuffer(jr)||(jr=fr.from(jr,Br));for(var Wr=this._block,qr=0;this._blockOffset+jr.length-qr>=this._blockSize;){for(var Gr=this._blockOffset;Gr0;++Vr)this._length[Vr]+=Zr,Zr=this._length[Vr]/4294967296|0,Zr>0&&(this._length[Vr]-=4294967296*Zr);return this},kr.prototype._update=function(){throw new Error("_update is not implemented")},kr.prototype.digest=function(jr){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var Br=this._digest();jr!==void 0&&(Br=Br.toString(jr)),this._block.fill(0),this._blockOffset=0;for(var Wr=0;Wr<4;++Wr)this._length[Wr]=0;return Br},kr.prototype._digest=function(){throw new Error("_digest is not implemented")},hashBase$1=kr,hashBase$1}var md5_js,hasRequiredMd5_js;function requireMd5_js(){if(hasRequiredMd5_js)return md5_js;hasRequiredMd5_js=1;var fr=requireInherits_browser(),br=requireHashBase$1(),wr=safeBufferExports.Buffer,Er=new Array(16);function kr(){br.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}fr(kr,br),kr.prototype._update=function(){for(var Vr=Er,Zr=0;Zr<16;++Zr)Vr[Zr]=this._block.readInt32LE(Zr*4);var Jr=this._a,Qr=this._b,_n=this._c,En=this._d;Jr=Br(Jr,Qr,_n,En,Vr[0],3614090360,7),En=Br(En,Jr,Qr,_n,Vr[1],3905402710,12),_n=Br(_n,En,Jr,Qr,Vr[2],606105819,17),Qr=Br(Qr,_n,En,Jr,Vr[3],3250441966,22),Jr=Br(Jr,Qr,_n,En,Vr[4],4118548399,7),En=Br(En,Jr,Qr,_n,Vr[5],1200080426,12),_n=Br(_n,En,Jr,Qr,Vr[6],2821735955,17),Qr=Br(Qr,_n,En,Jr,Vr[7],4249261313,22),Jr=Br(Jr,Qr,_n,En,Vr[8],1770035416,7),En=Br(En,Jr,Qr,_n,Vr[9],2336552879,12),_n=Br(_n,En,Jr,Qr,Vr[10],4294925233,17),Qr=Br(Qr,_n,En,Jr,Vr[11],2304563134,22),Jr=Br(Jr,Qr,_n,En,Vr[12],1804603682,7),En=Br(En,Jr,Qr,_n,Vr[13],4254626195,12),_n=Br(_n,En,Jr,Qr,Vr[14],2792965006,17),Qr=Br(Qr,_n,En,Jr,Vr[15],1236535329,22),Jr=Wr(Jr,Qr,_n,En,Vr[1],4129170786,5),En=Wr(En,Jr,Qr,_n,Vr[6],3225465664,9),_n=Wr(_n,En,Jr,Qr,Vr[11],643717713,14),Qr=Wr(Qr,_n,En,Jr,Vr[0],3921069994,20),Jr=Wr(Jr,Qr,_n,En,Vr[5],3593408605,5),En=Wr(En,Jr,Qr,_n,Vr[10],38016083,9),_n=Wr(_n,En,Jr,Qr,Vr[15],3634488961,14),Qr=Wr(Qr,_n,En,Jr,Vr[4],3889429448,20),Jr=Wr(Jr,Qr,_n,En,Vr[9],568446438,5),En=Wr(En,Jr,Qr,_n,Vr[14],3275163606,9),_n=Wr(_n,En,Jr,Qr,Vr[3],4107603335,14),Qr=Wr(Qr,_n,En,Jr,Vr[8],1163531501,20),Jr=Wr(Jr,Qr,_n,En,Vr[13],2850285829,5),En=Wr(En,Jr,Qr,_n,Vr[2],4243563512,9),_n=Wr(_n,En,Jr,Qr,Vr[7],1735328473,14),Qr=Wr(Qr,_n,En,Jr,Vr[12],2368359562,20),Jr=qr(Jr,Qr,_n,En,Vr[5],4294588738,4),En=qr(En,Jr,Qr,_n,Vr[8],2272392833,11),_n=qr(_n,En,Jr,Qr,Vr[11],1839030562,16),Qr=qr(Qr,_n,En,Jr,Vr[14],4259657740,23),Jr=qr(Jr,Qr,_n,En,Vr[1],2763975236,4),En=qr(En,Jr,Qr,_n,Vr[4],1272893353,11),_n=qr(_n,En,Jr,Qr,Vr[7],4139469664,16),Qr=qr(Qr,_n,En,Jr,Vr[10],3200236656,23),Jr=qr(Jr,Qr,_n,En,Vr[13],681279174,4),En=qr(En,Jr,Qr,_n,Vr[0],3936430074,11),_n=qr(_n,En,Jr,Qr,Vr[3],3572445317,16),Qr=qr(Qr,_n,En,Jr,Vr[6],76029189,23),Jr=qr(Jr,Qr,_n,En,Vr[9],3654602809,4),En=qr(En,Jr,Qr,_n,Vr[12],3873151461,11),_n=qr(_n,En,Jr,Qr,Vr[15],530742520,16),Qr=qr(Qr,_n,En,Jr,Vr[2],3299628645,23),Jr=Gr(Jr,Qr,_n,En,Vr[0],4096336452,6),En=Gr(En,Jr,Qr,_n,Vr[7],1126891415,10),_n=Gr(_n,En,Jr,Qr,Vr[14],2878612391,15),Qr=Gr(Qr,_n,En,Jr,Vr[5],4237533241,21),Jr=Gr(Jr,Qr,_n,En,Vr[12],1700485571,6),En=Gr(En,Jr,Qr,_n,Vr[3],2399980690,10),_n=Gr(_n,En,Jr,Qr,Vr[10],4293915773,15),Qr=Gr(Qr,_n,En,Jr,Vr[1],2240044497,21),Jr=Gr(Jr,Qr,_n,En,Vr[8],1873313359,6),En=Gr(En,Jr,Qr,_n,Vr[15],4264355552,10),_n=Gr(_n,En,Jr,Qr,Vr[6],2734768916,15),Qr=Gr(Qr,_n,En,Jr,Vr[13],1309151649,21),Jr=Gr(Jr,Qr,_n,En,Vr[4],4149444226,6),En=Gr(En,Jr,Qr,_n,Vr[11],3174756917,10),_n=Gr(_n,En,Jr,Qr,Vr[2],718787259,15),Qr=Gr(Qr,_n,En,Jr,Vr[9],3951481745,21),this._a=this._a+Jr|0,this._b=this._b+Qr|0,this._c=this._c+_n|0,this._d=this._d+En|0},kr.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var Vr=wr.allocUnsafe(16);return Vr.writeInt32LE(this._a,0),Vr.writeInt32LE(this._b,4),Vr.writeInt32LE(this._c,8),Vr.writeInt32LE(this._d,12),Vr};function jr(Vr,Zr){return Vr<>>32-Zr}function Br(Vr,Zr,Jr,Qr,_n,En,Cn){return jr(Vr+(Zr&Jr|~Zr&Qr)+_n+En|0,Cn)+Zr|0}function Wr(Vr,Zr,Jr,Qr,_n,En,Cn){return jr(Vr+(Zr&Qr|Jr&~Qr)+_n+En|0,Cn)+Zr|0}function qr(Vr,Zr,Jr,Qr,_n,En,Cn){return jr(Vr+(Zr^Jr^Qr)+_n+En|0,Cn)+Zr|0}function Gr(Vr,Zr,Jr,Qr,_n,En,Cn){return jr(Vr+(Jr^(Zr|~Qr))+_n+En|0,Cn)+Zr|0}return md5_js=kr,md5_js}var hashBase,hasRequiredHashBase;function requireHashBase(){if(hasRequiredHashBase)return hashBase;hasRequiredHashBase=1;var fr=safeBufferExports.Buffer,br=requireReadableBrowser$1().Transform,wr=requireInherits_browser();function Er(jr,Br){if(!fr.isBuffer(jr)&&typeof jr!="string")throw new TypeError(Br+" must be a string or a buffer")}function kr(jr){br.call(this),this._block=fr.allocUnsafe(jr),this._blockSize=jr,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}return wr(kr,br),kr.prototype._transform=function(jr,Br,Wr){var qr=null;try{this.update(jr,Br)}catch(Gr){qr=Gr}Wr(qr)},kr.prototype._flush=function(jr){var Br=null;try{this.push(this.digest())}catch(Wr){Br=Wr}jr(Br)},kr.prototype.update=function(jr,Br){if(Er(jr,"Data"),this._finalized)throw new Error("Digest already called");fr.isBuffer(jr)||(jr=fr.from(jr,Br));for(var Wr=this._block,qr=0;this._blockOffset+jr.length-qr>=this._blockSize;){for(var Gr=this._blockOffset;Gr0;++Vr)this._length[Vr]+=Zr,Zr=this._length[Vr]/4294967296|0,Zr>0&&(this._length[Vr]-=4294967296*Zr);return this},kr.prototype._update=function(){throw new Error("_update is not implemented")},kr.prototype.digest=function(jr){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var Br=this._digest();jr!==void 0&&(Br=Br.toString(jr)),this._block.fill(0),this._blockOffset=0;for(var Wr=0;Wr<4;++Wr)this._length[Wr]=0;return Br},kr.prototype._digest=function(){throw new Error("_digest is not implemented")},hashBase=kr,hashBase}var ripemd160,hasRequiredRipemd160;function requireRipemd160(){if(hasRequiredRipemd160)return ripemd160;hasRequiredRipemd160=1;var fr=require$$0$9.Buffer,br=requireInherits_browser(),wr=requireHashBase(),Er=new Array(16),kr=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],jr=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],Br=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],Wr=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],qr=[0,1518500249,1859775393,2400959708,2840853838],Gr=[1352829926,1548603684,1836072691,2053994217,0];function Vr(){wr.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}br(Vr,wr),Vr.prototype._update=function(){for(var In=Er,An=0;An<16;++An)In[An]=this._block.readInt32LE(An*4);for(var jn=this._a|0,eo=this._b|0,ro=this._c|0,to=this._d|0,_i=this._e|0,oo=this._a|0,io=this._b|0,co=this._c|0,so=this._d|0,no=this._e|0,Tn=0;Tn<80;Tn+=1){var Hr,Xr;Tn<16?(Hr=Jr(jn,eo,ro,to,_i,In[kr[Tn]],qr[0],Br[Tn]),Xr=Cn(oo,io,co,so,no,In[jr[Tn]],Gr[0],Wr[Tn])):Tn<32?(Hr=Qr(jn,eo,ro,to,_i,In[kr[Tn]],qr[1],Br[Tn]),Xr=En(oo,io,co,so,no,In[jr[Tn]],Gr[1],Wr[Tn])):Tn<48?(Hr=_n(jn,eo,ro,to,_i,In[kr[Tn]],qr[2],Br[Tn]),Xr=_n(oo,io,co,so,no,In[jr[Tn]],Gr[2],Wr[Tn])):Tn<64?(Hr=En(jn,eo,ro,to,_i,In[kr[Tn]],qr[3],Br[Tn]),Xr=Qr(oo,io,co,so,no,In[jr[Tn]],Gr[3],Wr[Tn])):(Hr=Cn(jn,eo,ro,to,_i,In[kr[Tn]],qr[4],Br[Tn]),Xr=Jr(oo,io,co,so,no,In[jr[Tn]],Gr[4],Wr[Tn])),jn=_i,_i=to,to=Zr(ro,10),ro=eo,eo=Hr,oo=no,no=so,so=Zr(co,10),co=io,io=Xr}var Sn=this._b+ro+so|0;this._b=this._c+to+no|0,this._c=this._d+_i+oo|0,this._d=this._e+jn+io|0,this._e=this._a+eo+co|0,this._a=Sn},Vr.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var In=fr.alloc?fr.alloc(20):new fr(20);return In.writeInt32LE(this._a,0),In.writeInt32LE(this._b,4),In.writeInt32LE(this._c,8),In.writeInt32LE(this._d,12),In.writeInt32LE(this._e,16),In};function Zr(In,An){return In<>>32-An}function Jr(In,An,jn,eo,ro,to,_i,oo){return Zr(In+(An^jn^eo)+to+_i|0,oo)+ro|0}function Qr(In,An,jn,eo,ro,to,_i,oo){return Zr(In+(An&jn|~An&eo)+to+_i|0,oo)+ro|0}function _n(In,An,jn,eo,ro,to,_i,oo){return Zr(In+((An|~jn)^eo)+to+_i|0,oo)+ro|0}function En(In,An,jn,eo,ro,to,_i,oo){return Zr(In+(An&eo|jn&~eo)+to+_i|0,oo)+ro|0}function Cn(In,An,jn,eo,ro,to,_i,oo){return Zr(In+(An^(jn|~eo))+to+_i|0,oo)+ro|0}return ripemd160=Vr,ripemd160}var sha_js={exports:{}},hash$2,hasRequiredHash$1;function requireHash$1(){if(hasRequiredHash$1)return hash$2;hasRequiredHash$1=1;var fr=safeBufferExports.Buffer;function br(wr,Er){this._block=fr.alloc(wr),this._finalSize=Er,this._blockSize=wr,this._len=0}return br.prototype.update=function(wr,Er){typeof wr=="string"&&(Er=Er||"utf8",wr=fr.from(wr,Er));for(var kr=this._block,jr=this._blockSize,Br=wr.length,Wr=this._len,qr=0;qr=this._finalSize&&(this._update(this._block),this._block.fill(0));var kr=this._len*8;if(kr<=4294967295)this._block.writeUInt32BE(kr,this._blockSize-4);else{var jr=(kr&4294967295)>>>0,Br=(kr-jr)/4294967296;this._block.writeUInt32BE(Br,this._blockSize-8),this._block.writeUInt32BE(jr,this._blockSize-4)}this._update(this._block);var Wr=this._hash();return wr?Wr.toString(wr):Wr},br.prototype._update=function(){throw new Error("_update must be implemented by subclass")},hash$2=br,hash$2}var sha$1,hasRequiredSha$1;function requireSha$1(){if(hasRequiredSha$1)return sha$1;hasRequiredSha$1=1;var fr=requireInherits_browser(),br=requireHash$1(),wr=safeBufferExports.Buffer,Er=[1518500249,1859775393,-1894007588,-899497514],kr=new Array(80);function jr(){this.init(),this._w=kr,br.call(this,64,56)}fr(jr,br),jr.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Br(Gr){return Gr<<5|Gr>>>27}function Wr(Gr){return Gr<<30|Gr>>>2}function qr(Gr,Vr,Zr,Jr){return Gr===0?Vr&Zr|~Vr&Jr:Gr===2?Vr&Zr|Vr&Jr|Zr&Jr:Vr^Zr^Jr}return jr.prototype._update=function(Gr){for(var Vr=this._w,Zr=this._a|0,Jr=this._b|0,Qr=this._c|0,_n=this._d|0,En=this._e|0,Cn=0;Cn<16;++Cn)Vr[Cn]=Gr.readInt32BE(Cn*4);for(;Cn<80;++Cn)Vr[Cn]=Vr[Cn-3]^Vr[Cn-8]^Vr[Cn-14]^Vr[Cn-16];for(var In=0;In<80;++In){var An=~~(In/20),jn=Br(Zr)+qr(An,Jr,Qr,_n)+En+Vr[In]+Er[An]|0;En=_n,_n=Qr,Qr=Wr(Jr),Jr=Zr,Zr=jn}this._a=Zr+this._a|0,this._b=Jr+this._b|0,this._c=Qr+this._c|0,this._d=_n+this._d|0,this._e=En+this._e|0},jr.prototype._hash=function(){var Gr=wr.allocUnsafe(20);return Gr.writeInt32BE(this._a|0,0),Gr.writeInt32BE(this._b|0,4),Gr.writeInt32BE(this._c|0,8),Gr.writeInt32BE(this._d|0,12),Gr.writeInt32BE(this._e|0,16),Gr},sha$1=jr,sha$1}var sha1$1,hasRequiredSha1;function requireSha1(){if(hasRequiredSha1)return sha1$1;hasRequiredSha1=1;var fr=requireInherits_browser(),br=requireHash$1(),wr=safeBufferExports.Buffer,Er=[1518500249,1859775393,-1894007588,-899497514],kr=new Array(80);function jr(){this.init(),this._w=kr,br.call(this,64,56)}fr(jr,br),jr.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Br(Vr){return Vr<<1|Vr>>>31}function Wr(Vr){return Vr<<5|Vr>>>27}function qr(Vr){return Vr<<30|Vr>>>2}function Gr(Vr,Zr,Jr,Qr){return Vr===0?Zr&Jr|~Zr&Qr:Vr===2?Zr&Jr|Zr&Qr|Jr&Qr:Zr^Jr^Qr}return jr.prototype._update=function(Vr){for(var Zr=this._w,Jr=this._a|0,Qr=this._b|0,_n=this._c|0,En=this._d|0,Cn=this._e|0,In=0;In<16;++In)Zr[In]=Vr.readInt32BE(In*4);for(;In<80;++In)Zr[In]=Br(Zr[In-3]^Zr[In-8]^Zr[In-14]^Zr[In-16]);for(var An=0;An<80;++An){var jn=~~(An/20),eo=Wr(Jr)+Gr(jn,Qr,_n,En)+Cn+Zr[An]+Er[jn]|0;Cn=En,En=_n,_n=qr(Qr),Qr=Jr,Jr=eo}this._a=Jr+this._a|0,this._b=Qr+this._b|0,this._c=_n+this._c|0,this._d=En+this._d|0,this._e=Cn+this._e|0},jr.prototype._hash=function(){var Vr=wr.allocUnsafe(20);return Vr.writeInt32BE(this._a|0,0),Vr.writeInt32BE(this._b|0,4),Vr.writeInt32BE(this._c|0,8),Vr.writeInt32BE(this._d|0,12),Vr.writeInt32BE(this._e|0,16),Vr},sha1$1=jr,sha1$1}var sha256$2,hasRequiredSha256;function requireSha256(){if(hasRequiredSha256)return sha256$2;hasRequiredSha256=1;var fr=requireInherits_browser(),br=requireHash$1(),wr=safeBufferExports.Buffer,Er=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],kr=new Array(64);function jr(){this.init(),this._w=kr,br.call(this,64,56)}fr(jr,br),jr.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function Br(Jr,Qr,_n){return _n^Jr&(Qr^_n)}function Wr(Jr,Qr,_n){return Jr&Qr|_n&(Jr|Qr)}function qr(Jr){return(Jr>>>2|Jr<<30)^(Jr>>>13|Jr<<19)^(Jr>>>22|Jr<<10)}function Gr(Jr){return(Jr>>>6|Jr<<26)^(Jr>>>11|Jr<<21)^(Jr>>>25|Jr<<7)}function Vr(Jr){return(Jr>>>7|Jr<<25)^(Jr>>>18|Jr<<14)^Jr>>>3}function Zr(Jr){return(Jr>>>17|Jr<<15)^(Jr>>>19|Jr<<13)^Jr>>>10}return jr.prototype._update=function(Jr){for(var Qr=this._w,_n=this._a|0,En=this._b|0,Cn=this._c|0,In=this._d|0,An=this._e|0,jn=this._f|0,eo=this._g|0,ro=this._h|0,to=0;to<16;++to)Qr[to]=Jr.readInt32BE(to*4);for(;to<64;++to)Qr[to]=Zr(Qr[to-2])+Qr[to-7]+Vr(Qr[to-15])+Qr[to-16]|0;for(var _i=0;_i<64;++_i){var oo=ro+Gr(An)+Br(An,jn,eo)+Er[_i]+Qr[_i]|0,io=qr(_n)+Wr(_n,En,Cn)|0;ro=eo,eo=jn,jn=An,An=In+oo|0,In=Cn,Cn=En,En=_n,_n=oo+io|0}this._a=_n+this._a|0,this._b=En+this._b|0,this._c=Cn+this._c|0,this._d=In+this._d|0,this._e=An+this._e|0,this._f=jn+this._f|0,this._g=eo+this._g|0,this._h=ro+this._h|0},jr.prototype._hash=function(){var Jr=wr.allocUnsafe(32);return Jr.writeInt32BE(this._a,0),Jr.writeInt32BE(this._b,4),Jr.writeInt32BE(this._c,8),Jr.writeInt32BE(this._d,12),Jr.writeInt32BE(this._e,16),Jr.writeInt32BE(this._f,20),Jr.writeInt32BE(this._g,24),Jr.writeInt32BE(this._h,28),Jr},sha256$2=jr,sha256$2}var sha224$1,hasRequiredSha224;function requireSha224(){if(hasRequiredSha224)return sha224$1;hasRequiredSha224=1;var fr=requireInherits_browser(),br=requireSha256(),wr=requireHash$1(),Er=safeBufferExports.Buffer,kr=new Array(64);function jr(){this.init(),this._w=kr,wr.call(this,64,56)}return fr(jr,br),jr.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},jr.prototype._hash=function(){var Br=Er.allocUnsafe(28);return Br.writeInt32BE(this._a,0),Br.writeInt32BE(this._b,4),Br.writeInt32BE(this._c,8),Br.writeInt32BE(this._d,12),Br.writeInt32BE(this._e,16),Br.writeInt32BE(this._f,20),Br.writeInt32BE(this._g,24),Br},sha224$1=jr,sha224$1}var sha512$3,hasRequiredSha512;function requireSha512(){if(hasRequiredSha512)return sha512$3;hasRequiredSha512=1;var fr=requireInherits_browser(),br=requireHash$1(),wr=safeBufferExports.Buffer,Er=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],kr=new Array(160);function jr(){this.init(),this._w=kr,br.call(this,128,112)}fr(jr,br),jr.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Br(En,Cn,In){return In^En&(Cn^In)}function Wr(En,Cn,In){return En&Cn|In&(En|Cn)}function qr(En,Cn){return(En>>>28|Cn<<4)^(Cn>>>2|En<<30)^(Cn>>>7|En<<25)}function Gr(En,Cn){return(En>>>14|Cn<<18)^(En>>>18|Cn<<14)^(Cn>>>9|En<<23)}function Vr(En,Cn){return(En>>>1|Cn<<31)^(En>>>8|Cn<<24)^En>>>7}function Zr(En,Cn){return(En>>>1|Cn<<31)^(En>>>8|Cn<<24)^(En>>>7|Cn<<25)}function Jr(En,Cn){return(En>>>19|Cn<<13)^(Cn>>>29|En<<3)^En>>>6}function Qr(En,Cn){return(En>>>19|Cn<<13)^(Cn>>>29|En<<3)^(En>>>6|Cn<<26)}function _n(En,Cn){return En>>>0>>0?1:0}return jr.prototype._update=function(En){for(var Cn=this._w,In=this._ah|0,An=this._bh|0,jn=this._ch|0,eo=this._dh|0,ro=this._eh|0,to=this._fh|0,_i=this._gh|0,oo=this._hh|0,io=this._al|0,co=this._bl|0,so=this._cl|0,no=this._dl|0,Tn=this._el|0,Hr=this._fl|0,Xr=this._gl|0,Sn=this._hl|0,Rn=0;Rn<32;Rn+=2)Cn[Rn]=En.readInt32BE(Rn*4),Cn[Rn+1]=En.readInt32BE(Rn*4+4);for(;Rn<160;Rn+=2){var Pn=Cn[Rn-30],On=Cn[Rn-15*2+1],Zn=Vr(Pn,On),Nn=Zr(On,Pn);Pn=Cn[Rn-2*2],On=Cn[Rn-2*2+1];var wn=Jr(Pn,On),zn=Qr(On,Pn),fo=Cn[Rn-7*2],vo=Cn[Rn-7*2+1],go=Cn[Rn-16*2],uo=Cn[Rn-16*2+1],lo=Nn+vo|0,Eo=Zn+fo+_n(lo,Nn)|0;lo=lo+zn|0,Eo=Eo+wn+_n(lo,zn)|0,lo=lo+uo|0,Eo=Eo+go+_n(lo,uo)|0,Cn[Rn]=Eo,Cn[Rn+1]=lo}for(var mo=0;mo<160;mo+=2){Eo=Cn[mo],lo=Cn[mo+1];var yo=Wr(In,An,jn),_o=Wr(io,co,so),Bo=qr(In,io),Lo=qr(io,In),Wo=Gr(ro,Tn),na=Gr(Tn,ro),qo=Er[mo],ga=Er[mo+1],wl=Br(ro,to,_i),No=Br(Tn,Hr,Xr),Uo=Sn+na|0,Nl=oo+Wo+_n(Uo,Sn)|0;Uo=Uo+No|0,Nl=Nl+wl+_n(Uo,No)|0,Uo=Uo+ga|0,Nl=Nl+qo+_n(Uo,ga)|0,Uo=Uo+lo|0,Nl=Nl+Eo+_n(Uo,lo)|0;var Vo=Lo+_o|0,Fo=Bo+yo+_n(Vo,Lo)|0;oo=_i,Sn=Xr,_i=to,Xr=Hr,to=ro,Hr=Tn,Tn=no+Uo|0,ro=eo+Nl+_n(Tn,no)|0,eo=jn,no=so,jn=An,so=co,An=In,co=io,io=Uo+Vo|0,In=Nl+Fo+_n(io,Uo)|0}this._al=this._al+io|0,this._bl=this._bl+co|0,this._cl=this._cl+so|0,this._dl=this._dl+no|0,this._el=this._el+Tn|0,this._fl=this._fl+Hr|0,this._gl=this._gl+Xr|0,this._hl=this._hl+Sn|0,this._ah=this._ah+In+_n(this._al,io)|0,this._bh=this._bh+An+_n(this._bl,co)|0,this._ch=this._ch+jn+_n(this._cl,so)|0,this._dh=this._dh+eo+_n(this._dl,no)|0,this._eh=this._eh+ro+_n(this._el,Tn)|0,this._fh=this._fh+to+_n(this._fl,Hr)|0,this._gh=this._gh+_i+_n(this._gl,Xr)|0,this._hh=this._hh+oo+_n(this._hl,Sn)|0},jr.prototype._hash=function(){var En=wr.allocUnsafe(64);function Cn(In,An,jn){En.writeInt32BE(In,jn),En.writeInt32BE(An,jn+4)}return Cn(this._ah,this._al,0),Cn(this._bh,this._bl,8),Cn(this._ch,this._cl,16),Cn(this._dh,this._dl,24),Cn(this._eh,this._el,32),Cn(this._fh,this._fl,40),Cn(this._gh,this._gl,48),Cn(this._hh,this._hl,56),En},sha512$3=jr,sha512$3}var sha384$1,hasRequiredSha384;function requireSha384(){if(hasRequiredSha384)return sha384$1;hasRequiredSha384=1;var fr=requireInherits_browser(),br=requireSha512(),wr=requireHash$1(),Er=safeBufferExports.Buffer,kr=new Array(160);function jr(){this.init(),this._w=kr,wr.call(this,128,112)}return fr(jr,br),jr.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},jr.prototype._hash=function(){var Br=Er.allocUnsafe(48);function Wr(qr,Gr,Vr){Br.writeInt32BE(qr,Vr),Br.writeInt32BE(Gr,Vr+4)}return Wr(this._ah,this._al,0),Wr(this._bh,this._bl,8),Wr(this._ch,this._cl,16),Wr(this._dh,this._dl,24),Wr(this._eh,this._el,32),Wr(this._fh,this._fl,40),Br},sha384$1=jr,sha384$1}var hasRequiredSha_js;function requireSha_js(){if(hasRequiredSha_js)return sha_js.exports;hasRequiredSha_js=1;var fr=sha_js.exports=function(wr){wr=wr.toLowerCase();var Er=fr[wr];if(!Er)throw new Error(wr+" is not supported (we accept pull requests)");return new Er};return fr.sha=requireSha$1(),fr.sha1=requireSha1(),fr.sha224=requireSha224(),fr.sha256=requireSha256(),fr.sha384=requireSha384(),fr.sha512=requireSha512(),sha_js.exports}var streamBrowserify,hasRequiredStreamBrowserify;function requireStreamBrowserify(){if(hasRequiredStreamBrowserify)return streamBrowserify;hasRequiredStreamBrowserify=1,streamBrowserify=wr;var fr=eventsExports.EventEmitter,br=requireInherits_browser();br(wr,fr),wr.Readable=require_stream_readable$1(),wr.Writable=require_stream_writable$1(),wr.Duplex=require_stream_duplex$1(),wr.Transform=require_stream_transform$1(),wr.PassThrough=require_stream_passthrough$1(),wr.finished=requireEndOfStream(),wr.pipeline=requirePipeline(),wr.Stream=wr;function wr(){fr.call(this)}return wr.prototype.pipe=function(Er,kr){var jr=this;function Br(Qr){Er.writable&&Er.write(Qr)===!1&&jr.pause&&jr.pause()}jr.on("data",Br);function Wr(){jr.readable&&jr.resume&&jr.resume()}Er.on("drain",Wr),!Er._isStdio&&(!kr||kr.end!==!1)&&(jr.on("end",Gr),jr.on("close",Vr));var qr=!1;function Gr(){qr||(qr=!0,Er.end())}function Vr(){qr||(qr=!0,typeof Er.destroy=="function"&&Er.destroy())}function Zr(Qr){if(Jr(),fr.listenerCount(this,"error")===0)throw Qr}jr.on("error",Zr),Er.on("error",Zr);function Jr(){jr.removeListener("data",Br),Er.removeListener("drain",Wr),jr.removeListener("end",Gr),jr.removeListener("close",Vr),jr.removeListener("error",Zr),Er.removeListener("error",Zr),jr.removeListener("end",Jr),jr.removeListener("close",Jr),Er.removeListener("close",Jr)}return jr.on("end",Jr),jr.on("close",Jr),Er.on("close",Jr),Er.emit("pipe",jr),Er},streamBrowserify}var cipherBase,hasRequiredCipherBase;function requireCipherBase(){if(hasRequiredCipherBase)return cipherBase;hasRequiredCipherBase=1;var fr=safeBufferExports.Buffer,br=requireStreamBrowserify().Transform,wr=requireString_decoder().StringDecoder,Er=requireInherits_browser();function kr(Wr){br.call(this),this.hashMode=typeof Wr=="string",this.hashMode?this[Wr]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}Er(kr,br);var jr=typeof Uint8Array<"u",Br=typeof ArrayBuffer<"u"&&typeof Uint8Array<"u"&&ArrayBuffer.isView&&(fr.prototype instanceof Uint8Array||fr.TYPED_ARRAY_SUPPORT);return kr.prototype.update=function(Wr,qr,Gr){var Vr;if(Wr instanceof fr)Vr=Wr;else if(typeof Wr=="string")Vr=fr.from(Wr,qr);else if(Br&&ArrayBuffer.isView(Wr))Vr=fr.from(Wr.buffer,Wr.byteOffset,Wr.byteLength);else if(jr&&Wr instanceof Uint8Array)Vr=fr.from(Wr);else if(fr.isBuffer(Wr)&&Wr.constructor&&Wr.constructor.isBuffer&&Wr.constructor.isBuffer(Wr))Vr=fr.from(Wr);else throw new Error('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.');var Zr=this._update(Vr);return this.hashMode?this:(Gr&&(Zr=this._toString(Zr,Gr)),Zr)},kr.prototype.setAutoPadding=function(){},kr.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},kr.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},kr.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},kr.prototype._transform=function(Wr,qr,Gr){var Vr;try{this.hashMode?this._update(Wr):this.push(this._update(Wr))}catch(Zr){Vr=Zr}finally{Gr(Vr)}},kr.prototype._flush=function(Wr){var qr;try{this.push(this.__final())}catch(Gr){qr=Gr}Wr(qr)},kr.prototype._finalOrDigest=function(Wr){var qr=this.__final()||fr.alloc(0);return Wr&&(qr=this._toString(qr,Wr,!0)),qr},kr.prototype._toString=function(Wr,qr,Gr){if(this._decoder||(this._decoder=new wr(qr),this._encoding=qr),this._encoding!==qr)throw new Error("can’t switch encodings");var Vr=this._decoder.write(Wr);return Gr&&(Vr+=this._decoder.end()),Vr},cipherBase=kr,cipherBase}var browser$e,hasRequiredBrowser$9;function requireBrowser$9(){if(hasRequiredBrowser$9)return browser$e;hasRequiredBrowser$9=1;var fr=requireInherits_browser(),br=requireMd5_js(),wr=requireRipemd160(),Er=requireSha_js(),kr=requireCipherBase();function jr(Br){kr.call(this,"digest"),this._hash=Br}return fr(jr,kr),jr.prototype._update=function(Br){this._hash.update(Br)},jr.prototype._final=function(){return this._hash.digest()},browser$e=function(Wr){return Wr=Wr.toLowerCase(),Wr==="md5"?new br:Wr==="rmd160"||Wr==="ripemd160"?new wr:new jr(Er(Wr))},browser$e}var legacy,hasRequiredLegacy;function requireLegacy(){if(hasRequiredLegacy)return legacy;hasRequiredLegacy=1;var fr=requireInherits_browser(),br=safeBufferExports.Buffer,wr=requireCipherBase(),Er=br.alloc(128),kr=64;function jr(Br,Wr){wr.call(this,"digest"),typeof Wr=="string"&&(Wr=br.from(Wr)),this._alg=Br,this._key=Wr,Wr.length>kr?Wr=Br(Wr):Wr.lengthZr){var Jr=Gr==="rmd160"?new jr:Br(Gr);Vr=Jr.update(Vr).digest()}else Vr.lengthfr||wr!==wr)throw new TypeError("Bad key length")},precondition}var defaultEncoding_1,hasRequiredDefaultEncoding;function requireDefaultEncoding(){if(hasRequiredDefaultEncoding)return defaultEncoding_1;hasRequiredDefaultEncoding=1;var fr;if(commonjsGlobal.process&&commonjsGlobal.process.browser)fr="utf-8";else if(commonjsGlobal.process&&commonjsGlobal.process.version){var br=parseInt(process$1$1.version.split(".")[0].slice(1),10);fr=br>=6?"utf-8":"binary"}else fr="utf-8";return defaultEncoding_1=fr,defaultEncoding_1}var toBuffer$4,hasRequiredToBuffer;function requireToBuffer(){if(hasRequiredToBuffer)return toBuffer$4;hasRequiredToBuffer=1;var fr=safeBufferExports.Buffer;return toBuffer$4=function(br,wr,Er){if(fr.isBuffer(br))return br;if(typeof br=="string")return fr.from(br,wr);if(ArrayBuffer.isView(br))return fr.from(br.buffer);throw new TypeError(Er+" must be a string, a Buffer, a typed array or a DataView")},toBuffer$4}var syncBrowser,hasRequiredSyncBrowser;function requireSyncBrowser(){if(hasRequiredSyncBrowser)return syncBrowser;hasRequiredSyncBrowser=1;var fr=requireMd5(),br=requireRipemd160(),wr=requireSha_js(),Er=safeBufferExports.Buffer,kr=requirePrecondition(),jr=requireDefaultEncoding(),Br=requireToBuffer(),Wr=Er.alloc(128),qr={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function Gr(Jr,Qr,_n){var En=Vr(Jr),Cn=Jr==="sha512"||Jr==="sha384"?128:64;Qr.length>Cn?Qr=En(Qr):Qr.length>>0},utils$6.writeUInt32BE=function(kr,jr,Br){kr[0+Br]=jr>>>24,kr[1+Br]=jr>>>16&255,kr[2+Br]=jr>>>8&255,kr[3+Br]=jr&255},utils$6.ip=function(kr,jr,Br,Wr){for(var qr=0,Gr=0,Vr=6;Vr>=0;Vr-=2){for(var Zr=0;Zr<=24;Zr+=8)qr<<=1,qr|=jr>>>Zr+Vr&1;for(var Zr=0;Zr<=24;Zr+=8)qr<<=1,qr|=kr>>>Zr+Vr&1}for(var Vr=6;Vr>=0;Vr-=2){for(var Zr=1;Zr<=25;Zr+=8)Gr<<=1,Gr|=jr>>>Zr+Vr&1;for(var Zr=1;Zr<=25;Zr+=8)Gr<<=1,Gr|=kr>>>Zr+Vr&1}Br[Wr+0]=qr>>>0,Br[Wr+1]=Gr>>>0},utils$6.rip=function(kr,jr,Br,Wr){for(var qr=0,Gr=0,Vr=0;Vr<4;Vr++)for(var Zr=24;Zr>=0;Zr-=8)qr<<=1,qr|=jr>>>Zr+Vr&1,qr<<=1,qr|=kr>>>Zr+Vr&1;for(var Vr=4;Vr<8;Vr++)for(var Zr=24;Zr>=0;Zr-=8)Gr<<=1,Gr|=jr>>>Zr+Vr&1,Gr<<=1,Gr|=kr>>>Zr+Vr&1;Br[Wr+0]=qr>>>0,Br[Wr+1]=Gr>>>0},utils$6.pc1=function(kr,jr,Br,Wr){for(var qr=0,Gr=0,Vr=7;Vr>=5;Vr--){for(var Zr=0;Zr<=24;Zr+=8)qr<<=1,qr|=jr>>Zr+Vr&1;for(var Zr=0;Zr<=24;Zr+=8)qr<<=1,qr|=kr>>Zr+Vr&1}for(var Zr=0;Zr<=24;Zr+=8)qr<<=1,qr|=jr>>Zr+Vr&1;for(var Vr=1;Vr<=3;Vr++){for(var Zr=0;Zr<=24;Zr+=8)Gr<<=1,Gr|=jr>>Zr+Vr&1;for(var Zr=0;Zr<=24;Zr+=8)Gr<<=1,Gr|=kr>>Zr+Vr&1}for(var Zr=0;Zr<=24;Zr+=8)Gr<<=1,Gr|=kr>>Zr+Vr&1;Br[Wr+0]=qr>>>0,Br[Wr+1]=Gr>>>0},utils$6.r28shl=function(kr,jr){return kr<>>28-jr};var fr=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];utils$6.pc2=function(kr,jr,Br,Wr){for(var qr=0,Gr=0,Vr=fr.length>>>1,Zr=0;Zr>>fr[Zr]&1;for(var Zr=Vr;Zr>>fr[Zr]&1;Br[Wr+0]=qr>>>0,Br[Wr+1]=Gr>>>0},utils$6.expand=function(kr,jr,Br){var Wr=0,qr=0;Wr=(kr&1)<<5|kr>>>27;for(var Gr=23;Gr>=15;Gr-=4)Wr<<=6,Wr|=kr>>>Gr&63;for(var Gr=11;Gr>=3;Gr-=4)qr|=kr>>>Gr&63,qr<<=6;qr|=(kr&31)<<1|kr>>>31,jr[Br+0]=Wr>>>0,jr[Br+1]=qr>>>0};var br=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];utils$6.substitute=function(kr,jr){for(var Br=0,Wr=0;Wr<4;Wr++){var qr=kr>>>18-Wr*6&63,Gr=br[Wr*64+qr];Br<<=4,Br|=Gr}for(var Wr=0;Wr<4;Wr++){var qr=jr>>>18-Wr*6&63,Gr=br[4*64+Wr*64+qr];Br<<=4,Br|=Gr}return Br>>>0};var wr=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];return utils$6.permute=function(kr){for(var jr=0,Br=0;Br>>wr[Br]&1;return jr>>>0},utils$6.padSplit=function(kr,jr,Br){for(var Wr=kr.toString(2);Wr.length0;Br--)kr+=this._buffer(Er,kr),jr+=this._flushBuffer(Wr,jr);return kr+=this._buffer(Er,kr),Wr},br.prototype.final=function(Er){var kr;Er&&(kr=this.update(Er));var jr;return this.type==="encrypt"?jr=this._finalEncrypt():jr=this._finalDecrypt(),kr?kr.concat(jr):jr},br.prototype._pad=function(Er,kr){if(kr===0)return!1;for(;kr>>1];Vr=wr.r28shl(Vr,Qr),Zr=wr.r28shl(Zr,Qr),wr.pc2(Vr,Zr,qr.keys,Jr)}},jr.prototype._update=function(qr,Gr,Vr,Zr){var Jr=this._desState,Qr=wr.readUInt32BE(qr,Gr),_n=wr.readUInt32BE(qr,Gr+4);wr.ip(Qr,_n,Jr.tmp,0),Qr=Jr.tmp[0],_n=Jr.tmp[1],this.type==="encrypt"?this._encrypt(Jr,Qr,_n,Jr.tmp,0):this._decrypt(Jr,Qr,_n,Jr.tmp,0),Qr=Jr.tmp[0],_n=Jr.tmp[1],wr.writeUInt32BE(Vr,Qr,Zr),wr.writeUInt32BE(Vr,_n,Zr+4)},jr.prototype._pad=function(qr,Gr){if(this.padding===!1)return!1;for(var Vr=qr.length-Gr,Zr=Gr;Zr>>0,Qr=eo}wr.rip(_n,Qr,Zr,Jr)},jr.prototype._decrypt=function(qr,Gr,Vr,Zr,Jr){for(var Qr=Vr,_n=Gr,En=qr.keys.length-2;En>=0;En-=2){var Cn=qr.keys[En],In=qr.keys[En+1];wr.expand(Qr,qr.tmp,0),Cn^=qr.tmp[0],In^=qr.tmp[1];var An=wr.substitute(Cn,In),jn=wr.permute(An),eo=Qr;Qr=(_n^jn)>>>0,_n=eo}wr.rip(Qr,_n,Zr,Jr)},des}var cbc$1={},hasRequiredCbc$1;function requireCbc$1(){if(hasRequiredCbc$1)return cbc$1;hasRequiredCbc$1=1;var fr=requireMinimalisticAssert(),br=requireInherits_browser(),wr={};function Er(jr){fr.equal(jr.length,8,"Invalid IV length"),this.iv=new Array(8);for(var Br=0;Br>Wr%8,Er._prev=wr(Er._prev,jr?Vr:Zr);return Gr}function wr(Er,kr){var jr=Er.length,Br=-1,Wr=fr.allocUnsafe(Er.length);for(Er=fr.concat([Er,fr.from([kr])]);++Br>7;return Wr}return cfb1.encrypt=function(Er,kr,jr){for(var Br=kr.length,Wr=fr.allocUnsafe(Br),qr=-1;++qr>>24]^Qr[In>>>16&255]^_n[An>>>8&255]^En[jn&255]^qr[oo++],ro=Jr[In>>>24]^Qr[An>>>16&255]^_n[jn>>>8&255]^En[Cn&255]^qr[oo++],to=Jr[An>>>24]^Qr[jn>>>16&255]^_n[Cn>>>8&255]^En[In&255]^qr[oo++],_i=Jr[jn>>>24]^Qr[Cn>>>16&255]^_n[In>>>8&255]^En[An&255]^qr[oo++],Cn=eo,In=ro,An=to,jn=_i;return eo=(Vr[Cn>>>24]<<24|Vr[In>>>16&255]<<16|Vr[An>>>8&255]<<8|Vr[jn&255])^qr[oo++],ro=(Vr[In>>>24]<<24|Vr[An>>>16&255]<<16|Vr[jn>>>8&255]<<8|Vr[Cn&255])^qr[oo++],to=(Vr[An>>>24]<<24|Vr[jn>>>16&255]<<16|Vr[Cn>>>8&255]<<8|Vr[In&255])^qr[oo++],_i=(Vr[jn>>>24]<<24|Vr[Cn>>>16&255]<<16|Vr[In>>>8&255]<<8|Vr[An&255])^qr[oo++],eo=eo>>>0,ro=ro>>>0,to=to>>>0,_i=_i>>>0,[eo,ro,to,_i]}var kr=[0,1,2,4,8,16,32,64,128,27,54],jr=function(){for(var Wr=new Array(256),qr=0;qr<256;qr++)qr<128?Wr[qr]=qr<<1:Wr[qr]=qr<<1^283;for(var Gr=[],Vr=[],Zr=[[],[],[],[]],Jr=[[],[],[],[]],Qr=0,_n=0,En=0;En<256;++En){var Cn=_n^_n<<1^_n<<2^_n<<3^_n<<4;Cn=Cn>>>8^Cn&255^99,Gr[Qr]=Cn,Vr[Cn]=Qr;var In=Wr[Qr],An=Wr[In],jn=Wr[An],eo=Wr[Cn]*257^Cn*16843008;Zr[0][Qr]=eo<<24|eo>>>8,Zr[1][Qr]=eo<<16|eo>>>16,Zr[2][Qr]=eo<<8|eo>>>24,Zr[3][Qr]=eo,eo=jn*16843009^An*65537^In*257^Qr*16843008,Jr[0][Cn]=eo<<24|eo>>>8,Jr[1][Cn]=eo<<16|eo>>>16,Jr[2][Cn]=eo<<8|eo>>>24,Jr[3][Cn]=eo,Qr===0?Qr=_n=1:(Qr=In^Wr[Wr[Wr[jn^In]]],_n^=Wr[Wr[_n]])}return{SBOX:Gr,INV_SBOX:Vr,SUB_MIX:Zr,INV_SUB_MIX:Jr}}();function Br(Wr){this._key=br(Wr),this._reset()}return Br.blockSize=4*4,Br.keySize=256/8,Br.prototype.blockSize=Br.blockSize,Br.prototype.keySize=Br.keySize,Br.prototype._reset=function(){for(var Wr=this._key,qr=Wr.length,Gr=qr+6,Vr=(Gr+1)*4,Zr=[],Jr=0;Jr>>24,Qr=jr.SBOX[Qr>>>24]<<24|jr.SBOX[Qr>>>16&255]<<16|jr.SBOX[Qr>>>8&255]<<8|jr.SBOX[Qr&255],Qr^=kr[Jr/qr|0]<<24):qr>6&&Jr%qr===4&&(Qr=jr.SBOX[Qr>>>24]<<24|jr.SBOX[Qr>>>16&255]<<16|jr.SBOX[Qr>>>8&255]<<8|jr.SBOX[Qr&255]),Zr[Jr]=Zr[Jr-qr]^Qr}for(var _n=[],En=0;En>>24]]^jr.INV_SUB_MIX[1][jr.SBOX[In>>>16&255]]^jr.INV_SUB_MIX[2][jr.SBOX[In>>>8&255]]^jr.INV_SUB_MIX[3][jr.SBOX[In&255]]}this._nRounds=Gr,this._keySchedule=Zr,this._invKeySchedule=_n},Br.prototype.encryptBlockRaw=function(Wr){return Wr=br(Wr),Er(Wr,this._keySchedule,jr.SUB_MIX,jr.SBOX,this._nRounds)},Br.prototype.encryptBlock=function(Wr){var qr=this.encryptBlockRaw(Wr),Gr=fr.allocUnsafe(16);return Gr.writeUInt32BE(qr[0],0),Gr.writeUInt32BE(qr[1],4),Gr.writeUInt32BE(qr[2],8),Gr.writeUInt32BE(qr[3],12),Gr},Br.prototype.decryptBlock=function(Wr){Wr=br(Wr);var qr=Wr[1];Wr[1]=Wr[3],Wr[3]=qr;var Gr=Er(Wr,this._invKeySchedule,jr.INV_SUB_MIX,jr.INV_SBOX,this._nRounds),Vr=fr.allocUnsafe(16);return Vr.writeUInt32BE(Gr[0],0),Vr.writeUInt32BE(Gr[3],4),Vr.writeUInt32BE(Gr[2],8),Vr.writeUInt32BE(Gr[1],12),Vr},Br.prototype.scrub=function(){wr(this._keySchedule),wr(this._invKeySchedule),wr(this._key)},aes.AES=Br,aes}var ghash,hasRequiredGhash;function requireGhash(){if(hasRequiredGhash)return ghash;hasRequiredGhash=1;var fr=safeBufferExports.Buffer,br=fr.alloc(16,0);function wr(jr){return[jr.readUInt32BE(0),jr.readUInt32BE(4),jr.readUInt32BE(8),jr.readUInt32BE(12)]}function Er(jr){var Br=fr.allocUnsafe(16);return Br.writeUInt32BE(jr[0]>>>0,0),Br.writeUInt32BE(jr[1]>>>0,4),Br.writeUInt32BE(jr[2]>>>0,8),Br.writeUInt32BE(jr[3]>>>0,12),Br}function kr(jr){this.h=jr,this.state=fr.alloc(16,0),this.cache=fr.allocUnsafe(0)}return kr.prototype.ghash=function(jr){for(var Br=-1;++Br0;Wr--)jr[Wr]=jr[Wr]>>>1|(jr[Wr-1]&1)<<31;jr[0]=jr[0]>>>1,Gr&&(jr[0]=jr[0]^225<<24)}this.state=Er(Br)},kr.prototype.update=function(jr){this.cache=fr.concat([this.cache,jr]);for(var Br;this.cache.length>=16;)Br=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(Br)},kr.prototype.final=function(jr,Br){return this.cache.length&&this.ghash(fr.concat([this.cache,br],16)),this.ghash(Er([0,jr,0,Br])),this.state},ghash=kr,ghash}var authCipher,hasRequiredAuthCipher;function requireAuthCipher(){if(hasRequiredAuthCipher)return authCipher;hasRequiredAuthCipher=1;var fr=requireAes(),br=safeBufferExports.Buffer,wr=requireCipherBase(),Er=requireInherits_browser(),kr=requireGhash(),jr=requireBufferXor(),Br=requireIncr32();function Wr(Vr,Zr){var Jr=0;Vr.length!==Zr.length&&Jr++;for(var Qr=Math.min(Vr.length,Zr.length),_n=0;_n0||Br>0;){var Zr=new br;Zr.update(Vr),Zr.update(Er),kr&&Zr.update(kr),Vr=Zr.digest();var Jr=0;if(Wr>0){var Qr=qr.length-Wr;Jr=Math.min(Wr,Vr.length),Vr.copy(qr,Qr,0,Jr),Wr-=Jr}if(Jr0){var _n=Gr.length-Br,En=Math.min(Br,Vr.length-Jr);Vr.copy(Gr,_n,Jr,Jr+En),Br-=En}}return Vr.fill(0),{key:qr,iv:Gr}}return evp_bytestokey=wr,evp_bytestokey}var hasRequiredEncrypter;function requireEncrypter(){if(hasRequiredEncrypter)return encrypter;hasRequiredEncrypter=1;var fr=requireModes$1(),br=requireAuthCipher(),wr=safeBufferExports.Buffer,Er=requireStreamCipher(),kr=requireCipherBase(),jr=requireAes(),Br=requireEvp_bytestokey(),Wr=requireInherits_browser();function qr(Qr,_n,En){kr.call(this),this._cache=new Vr,this._cipher=new jr.AES(_n),this._prev=wr.from(En),this._mode=Qr,this._autopadding=!0}Wr(qr,kr),qr.prototype._update=function(Qr){this._cache.add(Qr);for(var _n,En,Cn=[];_n=this._cache.get();)En=this._mode.encrypt(this,_n),Cn.push(En);return wr.concat(Cn)};var Gr=wr.alloc(16,16);qr.prototype._final=function(){var Qr=this._cache.flush();if(this._autopadding)return Qr=this._mode.encrypt(this,Qr),this._cipher.scrub(),Qr;if(!Qr.equals(Gr))throw this._cipher.scrub(),new Error("data not multiple of block length")},qr.prototype.setAutoPadding=function(Qr){return this._autopadding=!!Qr,this};function Vr(){this.cache=wr.allocUnsafe(0)}Vr.prototype.add=function(Qr){this.cache=wr.concat([this.cache,Qr])},Vr.prototype.get=function(){if(this.cache.length>15){var Qr=this.cache.slice(0,16);return this.cache=this.cache.slice(16),Qr}return null},Vr.prototype.flush=function(){for(var Qr=16-this.cache.length,_n=wr.allocUnsafe(Qr),En=-1;++En16)return _n=this.cache.slice(0,16),this.cache=this.cache.slice(16),_n}else if(this.cache.length>=16)return _n=this.cache.slice(0,16),this.cache=this.cache.slice(16),_n;return null},Gr.prototype.flush=function(){if(this.cache.length)return this.cache};function Vr(Qr){var _n=Qr[15];if(_n<1||_n>16)throw new Error("unable to decrypt data");for(var En=-1;++En<_n;)if(Qr[En+(16-_n)]!==_n)throw new Error("unable to decrypt data");if(_n!==16)return Qr.slice(0,16-_n)}function Zr(Qr,_n,En){var Cn=wr[Qr.toLowerCase()];if(!Cn)throw new TypeError("invalid suite type");if(typeof En=="string"&&(En=br.from(En)),Cn.mode!=="GCM"&&En.length!==Cn.iv)throw new TypeError("invalid iv length "+En.length);if(typeof _n=="string"&&(_n=br.from(_n)),_n.length!==Cn.key/8)throw new TypeError("invalid key length "+_n.length);return Cn.type==="stream"?new Er(Cn.module,_n,En,!0):Cn.type==="auth"?new fr(Cn.module,_n,En,!0):new qr(Cn.module,_n,En)}function Jr(Qr,_n){var En=wr[Qr.toLowerCase()];if(!En)throw new TypeError("invalid suite type");var Cn=Br(_n,!1,En.key,En.iv);return Zr(Qr,Cn.key,Cn.iv)}return decrypter.createDecipher=Jr,decrypter.createDecipheriv=Zr,decrypter}var hasRequiredBrowser$6;function requireBrowser$6(){if(hasRequiredBrowser$6)return browser$a;hasRequiredBrowser$6=1;var fr=requireEncrypter(),br=requireDecrypter(),wr=require$$2$2;function Er(){return Object.keys(wr)}return browser$a.createCipher=browser$a.Cipher=fr.createCipher,browser$a.createCipheriv=browser$a.Cipheriv=fr.createCipheriv,browser$a.createDecipher=browser$a.Decipher=br.createDecipher,browser$a.createDecipheriv=browser$a.Decipheriv=br.createDecipheriv,browser$a.listCiphers=browser$a.getCiphers=Er,browser$a}var modes={},hasRequiredModes;function requireModes(){return hasRequiredModes||(hasRequiredModes=1,function(fr){fr["des-ecb"]={key:8,iv:0},fr["des-cbc"]=fr.des={key:8,iv:8},fr["des-ede3-cbc"]=fr.des3={key:24,iv:8},fr["des-ede3"]={key:24,iv:0},fr["des-ede-cbc"]={key:16,iv:8},fr["des-ede"]={key:16,iv:0}}(modes)),modes}var hasRequiredBrowser$5;function requireBrowser$5(){if(hasRequiredBrowser$5)return browser$b;hasRequiredBrowser$5=1;var fr=requireBrowserifyDes(),br=requireBrowser$6(),wr=requireModes$1(),Er=requireModes(),kr=requireEvp_bytestokey();function jr(Vr,Zr){Vr=Vr.toLowerCase();var Jr,Qr;if(wr[Vr])Jr=wr[Vr].key,Qr=wr[Vr].iv;else if(Er[Vr])Jr=Er[Vr].key*8,Qr=Er[Vr].iv;else throw new TypeError("invalid suite type");var _n=kr(Zr,!1,Jr,Qr);return Wr(Vr,_n.key,_n.iv)}function Br(Vr,Zr){Vr=Vr.toLowerCase();var Jr,Qr;if(wr[Vr])Jr=wr[Vr].key,Qr=wr[Vr].iv;else if(Er[Vr])Jr=Er[Vr].key*8,Qr=Er[Vr].iv;else throw new TypeError("invalid suite type");var _n=kr(Zr,!1,Jr,Qr);return qr(Vr,_n.key,_n.iv)}function Wr(Vr,Zr,Jr){if(Vr=Vr.toLowerCase(),wr[Vr])return br.createCipheriv(Vr,Zr,Jr);if(Er[Vr])return new fr({key:Zr,iv:Jr,mode:Vr});throw new TypeError("invalid suite type")}function qr(Vr,Zr,Jr){if(Vr=Vr.toLowerCase(),wr[Vr])return br.createDecipheriv(Vr,Zr,Jr);if(Er[Vr])return new fr({key:Zr,iv:Jr,mode:Vr,decrypt:!0});throw new TypeError("invalid suite type")}function Gr(){return Object.keys(Er).concat(br.getCiphers())}return browser$b.createCipher=browser$b.Cipher=jr,browser$b.createCipheriv=browser$b.Cipheriv=Wr,browser$b.createDecipher=browser$b.Decipher=Br,browser$b.createDecipheriv=browser$b.Decipheriv=qr,browser$b.listCiphers=browser$b.getCiphers=Gr,browser$b}var browser$9={},bn$6={exports:{}};bn$6.exports;var hasRequiredBn$2;function requireBn$2(){return hasRequiredBn$2||(hasRequiredBn$2=1,function(fr){(function(br,wr){function Er(so,no){if(!so)throw new Error(no||"Assertion failed")}function kr(so,no){so.super_=no;var Tn=function(){};Tn.prototype=no.prototype,so.prototype=new Tn,so.prototype.constructor=so}function jr(so,no,Tn){if(jr.isBN(so))return so;this.negative=0,this.words=null,this.length=0,this.red=null,so!==null&&((no==="le"||no==="be")&&(Tn=no,no=10),this._init(so||0,no||10,Tn||"be"))}typeof br=="object"?br.exports=jr:wr.BN=jr,jr.BN=jr,jr.wordSize=26;var Br;try{typeof window<"u"&&typeof window.Buffer<"u"?Br=window.Buffer:Br=require$$0$9.Buffer}catch{}jr.isBN=function(no){return no instanceof jr?!0:no!==null&&typeof no=="object"&&no.constructor.wordSize===jr.wordSize&&Array.isArray(no.words)},jr.max=function(no,Tn){return no.cmp(Tn)>0?no:Tn},jr.min=function(no,Tn){return no.cmp(Tn)<0?no:Tn},jr.prototype._init=function(no,Tn,Hr){if(typeof no=="number")return this._initNumber(no,Tn,Hr);if(typeof no=="object")return this._initArray(no,Tn,Hr);Tn==="hex"&&(Tn=16),Er(Tn===(Tn|0)&&Tn>=2&&Tn<=36),no=no.toString().replace(/\s+/g,"");var Xr=0;no[0]==="-"&&(Xr++,this.negative=1),Xr=0;Xr-=3)Rn=no[Xr]|no[Xr-1]<<8|no[Xr-2]<<16,this.words[Sn]|=Rn<>>26-Pn&67108863,Pn+=24,Pn>=26&&(Pn-=26,Sn++);else if(Hr==="le")for(Xr=0,Sn=0;Xr>>26-Pn&67108863,Pn+=24,Pn>=26&&(Pn-=26,Sn++);return this.strip()};function Wr(so,no){var Tn=so.charCodeAt(no);return Tn>=65&&Tn<=70?Tn-55:Tn>=97&&Tn<=102?Tn-87:Tn-48&15}function qr(so,no,Tn){var Hr=Wr(so,Tn);return Tn-1>=no&&(Hr|=Wr(so,Tn-1)<<4),Hr}jr.prototype._parseHex=function(no,Tn,Hr){this.length=Math.ceil((no.length-Tn)/6),this.words=new Array(this.length);for(var Xr=0;Xr=Tn;Xr-=2)Pn=qr(no,Tn,Xr)<=18?(Sn-=18,Rn+=1,this.words[Rn]|=Pn>>>26):Sn+=8;else{var On=no.length-Tn;for(Xr=On%2===0?Tn+1:Tn;Xr=18?(Sn-=18,Rn+=1,this.words[Rn]|=Pn>>>26):Sn+=8}this.strip()};function Gr(so,no,Tn,Hr){for(var Xr=0,Sn=Math.min(so.length,Tn),Rn=no;Rn=49?Xr+=Pn-49+10:Pn>=17?Xr+=Pn-17+10:Xr+=Pn}return Xr}jr.prototype._parseBase=function(no,Tn,Hr){this.words=[0],this.length=1;for(var Xr=0,Sn=1;Sn<=67108863;Sn*=Tn)Xr++;Xr--,Sn=Sn/Tn|0;for(var Rn=no.length-Hr,Pn=Rn%Xr,On=Math.min(Rn,Rn-Pn)+Hr,Zn=0,Nn=Hr;Nn1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},jr.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},jr.prototype.inspect=function(){return(this.red?""};var Vr=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Zr=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],Jr=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];jr.prototype.toString=function(no,Tn){no=no||10,Tn=Tn|0||1;var Hr;if(no===16||no==="hex"){Hr="";for(var Xr=0,Sn=0,Rn=0;Rn>>24-Xr&16777215,Xr+=2,Xr>=26&&(Xr-=26,Rn--),Sn!==0||Rn!==this.length-1?Hr=Vr[6-On.length]+On+Hr:Hr=On+Hr}for(Sn!==0&&(Hr=Sn.toString(16)+Hr);Hr.length%Tn!==0;)Hr="0"+Hr;return this.negative!==0&&(Hr="-"+Hr),Hr}if(no===(no|0)&&no>=2&&no<=36){var Zn=Zr[no],Nn=Jr[no];Hr="";var wn=this.clone();for(wn.negative=0;!wn.isZero();){var zn=wn.modn(Nn).toString(no);wn=wn.idivn(Nn),wn.isZero()?Hr=zn+Hr:Hr=Vr[Zn-zn.length]+zn+Hr}for(this.isZero()&&(Hr="0"+Hr);Hr.length%Tn!==0;)Hr="0"+Hr;return this.negative!==0&&(Hr="-"+Hr),Hr}Er(!1,"Base should be between 2 and 36")},jr.prototype.toNumber=function(){var no=this.words[0];return this.length===2?no+=this.words[1]*67108864:this.length===3&&this.words[2]===1?no+=4503599627370496+this.words[1]*67108864:this.length>2&&Er(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-no:no},jr.prototype.toJSON=function(){return this.toString(16)},jr.prototype.toBuffer=function(no,Tn){return Er(typeof Br<"u"),this.toArrayLike(Br,no,Tn)},jr.prototype.toArray=function(no,Tn){return this.toArrayLike(Array,no,Tn)},jr.prototype.toArrayLike=function(no,Tn,Hr){var Xr=this.byteLength(),Sn=Hr||Math.max(1,Xr);Er(Xr<=Sn,"byte array longer than desired length"),Er(Sn>0,"Requested array length <= 0"),this.strip();var Rn=Tn==="le",Pn=new no(Sn),On,Zn,Nn=this.clone();if(Rn){for(Zn=0;!Nn.isZero();Zn++)On=Nn.andln(255),Nn.iushrn(8),Pn[Zn]=On;for(;Zn=4096&&(Hr+=13,Tn>>>=13),Tn>=64&&(Hr+=7,Tn>>>=7),Tn>=8&&(Hr+=4,Tn>>>=4),Tn>=2&&(Hr+=2,Tn>>>=2),Hr+Tn},jr.prototype._zeroBits=function(no){if(no===0)return 26;var Tn=no,Hr=0;return Tn&8191||(Hr+=13,Tn>>>=13),Tn&127||(Hr+=7,Tn>>>=7),Tn&15||(Hr+=4,Tn>>>=4),Tn&3||(Hr+=2,Tn>>>=2),Tn&1||Hr++,Hr},jr.prototype.bitLength=function(){var no=this.words[this.length-1],Tn=this._countBits(no);return(this.length-1)*26+Tn};function Qr(so){for(var no=new Array(so.bitLength()),Tn=0;Tn>>Xr}return no}jr.prototype.zeroBits=function(){if(this.isZero())return 0;for(var no=0,Tn=0;Tnno.length?this.clone().ior(no):no.clone().ior(this)},jr.prototype.uor=function(no){return this.length>no.length?this.clone().iuor(no):no.clone().iuor(this)},jr.prototype.iuand=function(no){var Tn;this.length>no.length?Tn=no:Tn=this;for(var Hr=0;Hrno.length?this.clone().iand(no):no.clone().iand(this)},jr.prototype.uand=function(no){return this.length>no.length?this.clone().iuand(no):no.clone().iuand(this)},jr.prototype.iuxor=function(no){var Tn,Hr;this.length>no.length?(Tn=this,Hr=no):(Tn=no,Hr=this);for(var Xr=0;Xrno.length?this.clone().ixor(no):no.clone().ixor(this)},jr.prototype.uxor=function(no){return this.length>no.length?this.clone().iuxor(no):no.clone().iuxor(this)},jr.prototype.inotn=function(no){Er(typeof no=="number"&&no>=0);var Tn=Math.ceil(no/26)|0,Hr=no%26;this._expand(Tn),Hr>0&&Tn--;for(var Xr=0;Xr0&&(this.words[Xr]=~this.words[Xr]&67108863>>26-Hr),this.strip()},jr.prototype.notn=function(no){return this.clone().inotn(no)},jr.prototype.setn=function(no,Tn){Er(typeof no=="number"&&no>=0);var Hr=no/26|0,Xr=no%26;return this._expand(Hr+1),Tn?this.words[Hr]=this.words[Hr]|1<no.length?(Hr=this,Xr=no):(Hr=no,Xr=this);for(var Sn=0,Rn=0;Rn>>26;for(;Sn!==0&&Rn>>26;if(this.length=Hr.length,Sn!==0)this.words[this.length]=Sn,this.length++;else if(Hr!==this)for(;Rnno.length?this.clone().iadd(no):no.clone().iadd(this)},jr.prototype.isub=function(no){if(no.negative!==0){no.negative=0;var Tn=this.iadd(no);return no.negative=1,Tn._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(no),this.negative=1,this._normSign();var Hr=this.cmp(no);if(Hr===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Xr,Sn;Hr>0?(Xr=this,Sn=no):(Xr=no,Sn=this);for(var Rn=0,Pn=0;Pn>26,this.words[Pn]=Tn&67108863;for(;Rn!==0&&Pn>26,this.words[Pn]=Tn&67108863;if(Rn===0&&Pn>>26,wn=On&67108863,zn=Math.min(Zn,no.length-1),fo=Math.max(0,Zn-so.length+1);fo<=zn;fo++){var vo=Zn-fo|0;Xr=so.words[vo]|0,Sn=no.words[fo]|0,Rn=Xr*Sn+wn,Nn+=Rn/67108864|0,wn=Rn&67108863}Tn.words[Zn]=wn|0,On=Nn|0}return On!==0?Tn.words[Zn]=On|0:Tn.length--,Tn.strip()}var En=function(no,Tn,Hr){var Xr=no.words,Sn=Tn.words,Rn=Hr.words,Pn=0,On,Zn,Nn,wn=Xr[0]|0,zn=wn&8191,fo=wn>>>13,vo=Xr[1]|0,go=vo&8191,uo=vo>>>13,lo=Xr[2]|0,Eo=lo&8191,mo=lo>>>13,yo=Xr[3]|0,_o=yo&8191,Bo=yo>>>13,Lo=Xr[4]|0,Wo=Lo&8191,na=Lo>>>13,qo=Xr[5]|0,ga=qo&8191,wl=qo>>>13,No=Xr[6]|0,Uo=No&8191,Nl=No>>>13,Vo=Xr[7]|0,Fo=Vo&8191,Ol=Vo>>>13,$a=Xr[8]|0,Jo=$a&8191,Zl=$a>>>13,Cl=Xr[9]|0,ko=Cl&8191,wo=Cl>>>13,bo=Sn[0]|0,Io=bo&8191,Ho=bo>>>13,Do=Sn[1]|0,zo=Do&8191,nu=Do>>>13,Ll=Sn[2]|0,_l=Ll&8191,bu=Ll>>>13,xl=Sn[3]|0,Tl=xl&8191,du=xl>>>13,Bl=Sn[4]|0,Il=Bl&8191,Eu=Bl>>>13,Al=Sn[5]|0,Ml=Al&8191,Tu=Al>>>13,Fl=Sn[6]|0,Sl=Fl&8191,_u=Fl>>>13,So=Sn[7]|0,Co=So&8191,Ao=So>>>13,po=Sn[8]|0,Ro=po&8191,Xo=po>>>13,jo=Sn[9]|0,Ko=jo&8191,Wl=jo>>>13;Hr.negative=no.negative^Tn.negative,Hr.length=19,On=Math.imul(zn,Io),Zn=Math.imul(zn,Ho),Zn=Zn+Math.imul(fo,Io)|0,Nn=Math.imul(fo,Ho);var $l=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+($l>>>26)|0,$l&=67108863,On=Math.imul(go,Io),Zn=Math.imul(go,Ho),Zn=Zn+Math.imul(uo,Io)|0,Nn=Math.imul(uo,Ho),On=On+Math.imul(zn,zo)|0,Zn=Zn+Math.imul(zn,nu)|0,Zn=Zn+Math.imul(fo,zo)|0,Nn=Nn+Math.imul(fo,nu)|0;var El=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(El>>>26)|0,El&=67108863,On=Math.imul(Eo,Io),Zn=Math.imul(Eo,Ho),Zn=Zn+Math.imul(mo,Io)|0,Nn=Math.imul(mo,Ho),On=On+Math.imul(go,zo)|0,Zn=Zn+Math.imul(go,nu)|0,Zn=Zn+Math.imul(uo,zo)|0,Nn=Nn+Math.imul(uo,nu)|0,On=On+Math.imul(zn,_l)|0,Zn=Zn+Math.imul(zn,bu)|0,Zn=Zn+Math.imul(fo,_l)|0,Nn=Nn+Math.imul(fo,bu)|0;var Cu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,On=Math.imul(_o,Io),Zn=Math.imul(_o,Ho),Zn=Zn+Math.imul(Bo,Io)|0,Nn=Math.imul(Bo,Ho),On=On+Math.imul(Eo,zo)|0,Zn=Zn+Math.imul(Eo,nu)|0,Zn=Zn+Math.imul(mo,zo)|0,Nn=Nn+Math.imul(mo,nu)|0,On=On+Math.imul(go,_l)|0,Zn=Zn+Math.imul(go,bu)|0,Zn=Zn+Math.imul(uo,_l)|0,Nn=Nn+Math.imul(uo,bu)|0,On=On+Math.imul(zn,Tl)|0,Zn=Zn+Math.imul(zn,du)|0,Zn=Zn+Math.imul(fo,Tl)|0,Nn=Nn+Math.imul(fo,du)|0;var iu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(iu>>>26)|0,iu&=67108863,On=Math.imul(Wo,Io),Zn=Math.imul(Wo,Ho),Zn=Zn+Math.imul(na,Io)|0,Nn=Math.imul(na,Ho),On=On+Math.imul(_o,zo)|0,Zn=Zn+Math.imul(_o,nu)|0,Zn=Zn+Math.imul(Bo,zo)|0,Nn=Nn+Math.imul(Bo,nu)|0,On=On+Math.imul(Eo,_l)|0,Zn=Zn+Math.imul(Eo,bu)|0,Zn=Zn+Math.imul(mo,_l)|0,Nn=Nn+Math.imul(mo,bu)|0,On=On+Math.imul(go,Tl)|0,Zn=Zn+Math.imul(go,du)|0,Zn=Zn+Math.imul(uo,Tl)|0,Nn=Nn+Math.imul(uo,du)|0,On=On+Math.imul(zn,Il)|0,Zn=Zn+Math.imul(zn,Eu)|0,Zn=Zn+Math.imul(fo,Il)|0,Nn=Nn+Math.imul(fo,Eu)|0;var pu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(pu>>>26)|0,pu&=67108863,On=Math.imul(ga,Io),Zn=Math.imul(ga,Ho),Zn=Zn+Math.imul(wl,Io)|0,Nn=Math.imul(wl,Ho),On=On+Math.imul(Wo,zo)|0,Zn=Zn+Math.imul(Wo,nu)|0,Zn=Zn+Math.imul(na,zo)|0,Nn=Nn+Math.imul(na,nu)|0,On=On+Math.imul(_o,_l)|0,Zn=Zn+Math.imul(_o,bu)|0,Zn=Zn+Math.imul(Bo,_l)|0,Nn=Nn+Math.imul(Bo,bu)|0,On=On+Math.imul(Eo,Tl)|0,Zn=Zn+Math.imul(Eo,du)|0,Zn=Zn+Math.imul(mo,Tl)|0,Nn=Nn+Math.imul(mo,du)|0,On=On+Math.imul(go,Il)|0,Zn=Zn+Math.imul(go,Eu)|0,Zn=Zn+Math.imul(uo,Il)|0,Nn=Nn+Math.imul(uo,Eu)|0,On=On+Math.imul(zn,Ml)|0,Zn=Zn+Math.imul(zn,Tu)|0,Zn=Zn+Math.imul(fo,Ml)|0,Nn=Nn+Math.imul(fo,Tu)|0;var yu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(yu>>>26)|0,yu&=67108863,On=Math.imul(Uo,Io),Zn=Math.imul(Uo,Ho),Zn=Zn+Math.imul(Nl,Io)|0,Nn=Math.imul(Nl,Ho),On=On+Math.imul(ga,zo)|0,Zn=Zn+Math.imul(ga,nu)|0,Zn=Zn+Math.imul(wl,zo)|0,Nn=Nn+Math.imul(wl,nu)|0,On=On+Math.imul(Wo,_l)|0,Zn=Zn+Math.imul(Wo,bu)|0,Zn=Zn+Math.imul(na,_l)|0,Nn=Nn+Math.imul(na,bu)|0,On=On+Math.imul(_o,Tl)|0,Zn=Zn+Math.imul(_o,du)|0,Zn=Zn+Math.imul(Bo,Tl)|0,Nn=Nn+Math.imul(Bo,du)|0,On=On+Math.imul(Eo,Il)|0,Zn=Zn+Math.imul(Eo,Eu)|0,Zn=Zn+Math.imul(mo,Il)|0,Nn=Nn+Math.imul(mo,Eu)|0,On=On+Math.imul(go,Ml)|0,Zn=Zn+Math.imul(go,Tu)|0,Zn=Zn+Math.imul(uo,Ml)|0,Nn=Nn+Math.imul(uo,Tu)|0,On=On+Math.imul(zn,Sl)|0,Zn=Zn+Math.imul(zn,_u)|0,Zn=Zn+Math.imul(fo,Sl)|0,Nn=Nn+Math.imul(fo,_u)|0;var hu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(hu>>>26)|0,hu&=67108863,On=Math.imul(Fo,Io),Zn=Math.imul(Fo,Ho),Zn=Zn+Math.imul(Ol,Io)|0,Nn=Math.imul(Ol,Ho),On=On+Math.imul(Uo,zo)|0,Zn=Zn+Math.imul(Uo,nu)|0,Zn=Zn+Math.imul(Nl,zo)|0,Nn=Nn+Math.imul(Nl,nu)|0,On=On+Math.imul(ga,_l)|0,Zn=Zn+Math.imul(ga,bu)|0,Zn=Zn+Math.imul(wl,_l)|0,Nn=Nn+Math.imul(wl,bu)|0,On=On+Math.imul(Wo,Tl)|0,Zn=Zn+Math.imul(Wo,du)|0,Zn=Zn+Math.imul(na,Tl)|0,Nn=Nn+Math.imul(na,du)|0,On=On+Math.imul(_o,Il)|0,Zn=Zn+Math.imul(_o,Eu)|0,Zn=Zn+Math.imul(Bo,Il)|0,Nn=Nn+Math.imul(Bo,Eu)|0,On=On+Math.imul(Eo,Ml)|0,Zn=Zn+Math.imul(Eo,Tu)|0,Zn=Zn+Math.imul(mo,Ml)|0,Nn=Nn+Math.imul(mo,Tu)|0,On=On+Math.imul(go,Sl)|0,Zn=Zn+Math.imul(go,_u)|0,Zn=Zn+Math.imul(uo,Sl)|0,Nn=Nn+Math.imul(uo,_u)|0,On=On+Math.imul(zn,Co)|0,Zn=Zn+Math.imul(zn,Ao)|0,Zn=Zn+Math.imul(fo,Co)|0,Nn=Nn+Math.imul(fo,Ao)|0;var mu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(mu>>>26)|0,mu&=67108863,On=Math.imul(Jo,Io),Zn=Math.imul(Jo,Ho),Zn=Zn+Math.imul(Zl,Io)|0,Nn=Math.imul(Zl,Ho),On=On+Math.imul(Fo,zo)|0,Zn=Zn+Math.imul(Fo,nu)|0,Zn=Zn+Math.imul(Ol,zo)|0,Nn=Nn+Math.imul(Ol,nu)|0,On=On+Math.imul(Uo,_l)|0,Zn=Zn+Math.imul(Uo,bu)|0,Zn=Zn+Math.imul(Nl,_l)|0,Nn=Nn+Math.imul(Nl,bu)|0,On=On+Math.imul(ga,Tl)|0,Zn=Zn+Math.imul(ga,du)|0,Zn=Zn+Math.imul(wl,Tl)|0,Nn=Nn+Math.imul(wl,du)|0,On=On+Math.imul(Wo,Il)|0,Zn=Zn+Math.imul(Wo,Eu)|0,Zn=Zn+Math.imul(na,Il)|0,Nn=Nn+Math.imul(na,Eu)|0,On=On+Math.imul(_o,Ml)|0,Zn=Zn+Math.imul(_o,Tu)|0,Zn=Zn+Math.imul(Bo,Ml)|0,Nn=Nn+Math.imul(Bo,Tu)|0,On=On+Math.imul(Eo,Sl)|0,Zn=Zn+Math.imul(Eo,_u)|0,Zn=Zn+Math.imul(mo,Sl)|0,Nn=Nn+Math.imul(mo,_u)|0,On=On+Math.imul(go,Co)|0,Zn=Zn+Math.imul(go,Ao)|0,Zn=Zn+Math.imul(uo,Co)|0,Nn=Nn+Math.imul(uo,Ao)|0,On=On+Math.imul(zn,Ro)|0,Zn=Zn+Math.imul(zn,Xo)|0,Zn=Zn+Math.imul(fo,Ro)|0,Nn=Nn+Math.imul(fo,Xo)|0;var vu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(vu>>>26)|0,vu&=67108863,On=Math.imul(ko,Io),Zn=Math.imul(ko,Ho),Zn=Zn+Math.imul(wo,Io)|0,Nn=Math.imul(wo,Ho),On=On+Math.imul(Jo,zo)|0,Zn=Zn+Math.imul(Jo,nu)|0,Zn=Zn+Math.imul(Zl,zo)|0,Nn=Nn+Math.imul(Zl,nu)|0,On=On+Math.imul(Fo,_l)|0,Zn=Zn+Math.imul(Fo,bu)|0,Zn=Zn+Math.imul(Ol,_l)|0,Nn=Nn+Math.imul(Ol,bu)|0,On=On+Math.imul(Uo,Tl)|0,Zn=Zn+Math.imul(Uo,du)|0,Zn=Zn+Math.imul(Nl,Tl)|0,Nn=Nn+Math.imul(Nl,du)|0,On=On+Math.imul(ga,Il)|0,Zn=Zn+Math.imul(ga,Eu)|0,Zn=Zn+Math.imul(wl,Il)|0,Nn=Nn+Math.imul(wl,Eu)|0,On=On+Math.imul(Wo,Ml)|0,Zn=Zn+Math.imul(Wo,Tu)|0,Zn=Zn+Math.imul(na,Ml)|0,Nn=Nn+Math.imul(na,Tu)|0,On=On+Math.imul(_o,Sl)|0,Zn=Zn+Math.imul(_o,_u)|0,Zn=Zn+Math.imul(Bo,Sl)|0,Nn=Nn+Math.imul(Bo,_u)|0,On=On+Math.imul(Eo,Co)|0,Zn=Zn+Math.imul(Eo,Ao)|0,Zn=Zn+Math.imul(mo,Co)|0,Nn=Nn+Math.imul(mo,Ao)|0,On=On+Math.imul(go,Ro)|0,Zn=Zn+Math.imul(go,Xo)|0,Zn=Zn+Math.imul(uo,Ro)|0,Nn=Nn+Math.imul(uo,Xo)|0,On=On+Math.imul(zn,Ko)|0,Zn=Zn+Math.imul(zn,Wl)|0,Zn=Zn+Math.imul(fo,Ko)|0,Nn=Nn+Math.imul(fo,Wl)|0;var fu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(fu>>>26)|0,fu&=67108863,On=Math.imul(ko,zo),Zn=Math.imul(ko,nu),Zn=Zn+Math.imul(wo,zo)|0,Nn=Math.imul(wo,nu),On=On+Math.imul(Jo,_l)|0,Zn=Zn+Math.imul(Jo,bu)|0,Zn=Zn+Math.imul(Zl,_l)|0,Nn=Nn+Math.imul(Zl,bu)|0,On=On+Math.imul(Fo,Tl)|0,Zn=Zn+Math.imul(Fo,du)|0,Zn=Zn+Math.imul(Ol,Tl)|0,Nn=Nn+Math.imul(Ol,du)|0,On=On+Math.imul(Uo,Il)|0,Zn=Zn+Math.imul(Uo,Eu)|0,Zn=Zn+Math.imul(Nl,Il)|0,Nn=Nn+Math.imul(Nl,Eu)|0,On=On+Math.imul(ga,Ml)|0,Zn=Zn+Math.imul(ga,Tu)|0,Zn=Zn+Math.imul(wl,Ml)|0,Nn=Nn+Math.imul(wl,Tu)|0,On=On+Math.imul(Wo,Sl)|0,Zn=Zn+Math.imul(Wo,_u)|0,Zn=Zn+Math.imul(na,Sl)|0,Nn=Nn+Math.imul(na,_u)|0,On=On+Math.imul(_o,Co)|0,Zn=Zn+Math.imul(_o,Ao)|0,Zn=Zn+Math.imul(Bo,Co)|0,Nn=Nn+Math.imul(Bo,Ao)|0,On=On+Math.imul(Eo,Ro)|0,Zn=Zn+Math.imul(Eo,Xo)|0,Zn=Zn+Math.imul(mo,Ro)|0,Nn=Nn+Math.imul(mo,Xo)|0,On=On+Math.imul(go,Ko)|0,Zn=Zn+Math.imul(go,Wl)|0,Zn=Zn+Math.imul(uo,Ko)|0,Nn=Nn+Math.imul(uo,Wl)|0;var gu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(gu>>>26)|0,gu&=67108863,On=Math.imul(ko,_l),Zn=Math.imul(ko,bu),Zn=Zn+Math.imul(wo,_l)|0,Nn=Math.imul(wo,bu),On=On+Math.imul(Jo,Tl)|0,Zn=Zn+Math.imul(Jo,du)|0,Zn=Zn+Math.imul(Zl,Tl)|0,Nn=Nn+Math.imul(Zl,du)|0,On=On+Math.imul(Fo,Il)|0,Zn=Zn+Math.imul(Fo,Eu)|0,Zn=Zn+Math.imul(Ol,Il)|0,Nn=Nn+Math.imul(Ol,Eu)|0,On=On+Math.imul(Uo,Ml)|0,Zn=Zn+Math.imul(Uo,Tu)|0,Zn=Zn+Math.imul(Nl,Ml)|0,Nn=Nn+Math.imul(Nl,Tu)|0,On=On+Math.imul(ga,Sl)|0,Zn=Zn+Math.imul(ga,_u)|0,Zn=Zn+Math.imul(wl,Sl)|0,Nn=Nn+Math.imul(wl,_u)|0,On=On+Math.imul(Wo,Co)|0,Zn=Zn+Math.imul(Wo,Ao)|0,Zn=Zn+Math.imul(na,Co)|0,Nn=Nn+Math.imul(na,Ao)|0,On=On+Math.imul(_o,Ro)|0,Zn=Zn+Math.imul(_o,Xo)|0,Zn=Zn+Math.imul(Bo,Ro)|0,Nn=Nn+Math.imul(Bo,Xo)|0,On=On+Math.imul(Eo,Ko)|0,Zn=Zn+Math.imul(Eo,Wl)|0,Zn=Zn+Math.imul(mo,Ko)|0,Nn=Nn+Math.imul(mo,Wl)|0;var ou=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(ou>>>26)|0,ou&=67108863,On=Math.imul(ko,Tl),Zn=Math.imul(ko,du),Zn=Zn+Math.imul(wo,Tl)|0,Nn=Math.imul(wo,du),On=On+Math.imul(Jo,Il)|0,Zn=Zn+Math.imul(Jo,Eu)|0,Zn=Zn+Math.imul(Zl,Il)|0,Nn=Nn+Math.imul(Zl,Eu)|0,On=On+Math.imul(Fo,Ml)|0,Zn=Zn+Math.imul(Fo,Tu)|0,Zn=Zn+Math.imul(Ol,Ml)|0,Nn=Nn+Math.imul(Ol,Tu)|0,On=On+Math.imul(Uo,Sl)|0,Zn=Zn+Math.imul(Uo,_u)|0,Zn=Zn+Math.imul(Nl,Sl)|0,Nn=Nn+Math.imul(Nl,_u)|0,On=On+Math.imul(ga,Co)|0,Zn=Zn+Math.imul(ga,Ao)|0,Zn=Zn+Math.imul(wl,Co)|0,Nn=Nn+Math.imul(wl,Ao)|0,On=On+Math.imul(Wo,Ro)|0,Zn=Zn+Math.imul(Wo,Xo)|0,Zn=Zn+Math.imul(na,Ro)|0,Nn=Nn+Math.imul(na,Xo)|0,On=On+Math.imul(_o,Ko)|0,Zn=Zn+Math.imul(_o,Wl)|0,Zn=Zn+Math.imul(Bo,Ko)|0,Nn=Nn+Math.imul(Bo,Wl)|0;var su=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(su>>>26)|0,su&=67108863,On=Math.imul(ko,Il),Zn=Math.imul(ko,Eu),Zn=Zn+Math.imul(wo,Il)|0,Nn=Math.imul(wo,Eu),On=On+Math.imul(Jo,Ml)|0,Zn=Zn+Math.imul(Jo,Tu)|0,Zn=Zn+Math.imul(Zl,Ml)|0,Nn=Nn+Math.imul(Zl,Tu)|0,On=On+Math.imul(Fo,Sl)|0,Zn=Zn+Math.imul(Fo,_u)|0,Zn=Zn+Math.imul(Ol,Sl)|0,Nn=Nn+Math.imul(Ol,_u)|0,On=On+Math.imul(Uo,Co)|0,Zn=Zn+Math.imul(Uo,Ao)|0,Zn=Zn+Math.imul(Nl,Co)|0,Nn=Nn+Math.imul(Nl,Ao)|0,On=On+Math.imul(ga,Ro)|0,Zn=Zn+Math.imul(ga,Xo)|0,Zn=Zn+Math.imul(wl,Ro)|0,Nn=Nn+Math.imul(wl,Xo)|0,On=On+Math.imul(Wo,Ko)|0,Zn=Zn+Math.imul(Wo,Wl)|0,Zn=Zn+Math.imul(na,Ko)|0,Nn=Nn+Math.imul(na,Wl)|0;var tu=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(tu>>>26)|0,tu&=67108863,On=Math.imul(ko,Ml),Zn=Math.imul(ko,Tu),Zn=Zn+Math.imul(wo,Ml)|0,Nn=Math.imul(wo,Tu),On=On+Math.imul(Jo,Sl)|0,Zn=Zn+Math.imul(Jo,_u)|0,Zn=Zn+Math.imul(Zl,Sl)|0,Nn=Nn+Math.imul(Zl,_u)|0,On=On+Math.imul(Fo,Co)|0,Zn=Zn+Math.imul(Fo,Ao)|0,Zn=Zn+Math.imul(Ol,Co)|0,Nn=Nn+Math.imul(Ol,Ao)|0,On=On+Math.imul(Uo,Ro)|0,Zn=Zn+Math.imul(Uo,Xo)|0,Zn=Zn+Math.imul(Nl,Ro)|0,Nn=Nn+Math.imul(Nl,Xo)|0,On=On+Math.imul(ga,Ko)|0,Zn=Zn+Math.imul(ga,Wl)|0,Zn=Zn+Math.imul(wl,Ko)|0,Nn=Nn+Math.imul(wl,Wl)|0;var zl=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(zl>>>26)|0,zl&=67108863,On=Math.imul(ko,Sl),Zn=Math.imul(ko,_u),Zn=Zn+Math.imul(wo,Sl)|0,Nn=Math.imul(wo,_u),On=On+Math.imul(Jo,Co)|0,Zn=Zn+Math.imul(Jo,Ao)|0,Zn=Zn+Math.imul(Zl,Co)|0,Nn=Nn+Math.imul(Zl,Ao)|0,On=On+Math.imul(Fo,Ro)|0,Zn=Zn+Math.imul(Fo,Xo)|0,Zn=Zn+Math.imul(Ol,Ro)|0,Nn=Nn+Math.imul(Ol,Xo)|0,On=On+Math.imul(Uo,Ko)|0,Zn=Zn+Math.imul(Uo,Wl)|0,Zn=Zn+Math.imul(Nl,Ko)|0,Nn=Nn+Math.imul(Nl,Wl)|0;var Gl=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(Gl>>>26)|0,Gl&=67108863,On=Math.imul(ko,Co),Zn=Math.imul(ko,Ao),Zn=Zn+Math.imul(wo,Co)|0,Nn=Math.imul(wo,Ao),On=On+Math.imul(Jo,Ro)|0,Zn=Zn+Math.imul(Jo,Xo)|0,Zn=Zn+Math.imul(Zl,Ro)|0,Nn=Nn+Math.imul(Zl,Xo)|0,On=On+Math.imul(Fo,Ko)|0,Zn=Zn+Math.imul(Fo,Wl)|0,Zn=Zn+Math.imul(Ol,Ko)|0,Nn=Nn+Math.imul(Ol,Wl)|0;var Jl=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(Jl>>>26)|0,Jl&=67108863,On=Math.imul(ko,Ro),Zn=Math.imul(ko,Xo),Zn=Zn+Math.imul(wo,Ro)|0,Nn=Math.imul(wo,Xo),On=On+Math.imul(Jo,Ko)|0,Zn=Zn+Math.imul(Jo,Wl)|0,Zn=Zn+Math.imul(Zl,Ko)|0,Nn=Nn+Math.imul(Zl,Wl)|0;var Pl=(Pn+On|0)+((Zn&8191)<<13)|0;Pn=(Nn+(Zn>>>13)|0)+(Pl>>>26)|0,Pl&=67108863,On=Math.imul(ko,Ko),Zn=Math.imul(ko,Wl),Zn=Zn+Math.imul(wo,Ko)|0,Nn=Math.imul(wo,Wl);var Ul=(Pn+On|0)+((Zn&8191)<<13)|0;return Pn=(Nn+(Zn>>>13)|0)+(Ul>>>26)|0,Ul&=67108863,Rn[0]=$l,Rn[1]=El,Rn[2]=Cu,Rn[3]=iu,Rn[4]=pu,Rn[5]=yu,Rn[6]=hu,Rn[7]=mu,Rn[8]=vu,Rn[9]=fu,Rn[10]=gu,Rn[11]=ou,Rn[12]=su,Rn[13]=tu,Rn[14]=zl,Rn[15]=Gl,Rn[16]=Jl,Rn[17]=Pl,Rn[18]=Ul,Pn!==0&&(Rn[19]=Pn,Hr.length++),Hr};Math.imul||(En=_n);function Cn(so,no,Tn){Tn.negative=no.negative^so.negative,Tn.length=so.length+no.length;for(var Hr=0,Xr=0,Sn=0;Sn>>26)|0,Xr+=Rn>>>26,Rn&=67108863}Tn.words[Sn]=Pn,Hr=Rn,Rn=Xr}return Hr!==0?Tn.words[Sn]=Hr:Tn.length--,Tn.strip()}function In(so,no,Tn){var Hr=new An;return Hr.mulp(so,no,Tn)}jr.prototype.mulTo=function(no,Tn){var Hr,Xr=this.length+no.length;return this.length===10&&no.length===10?Hr=En(this,no,Tn):Xr<63?Hr=_n(this,no,Tn):Xr<1024?Hr=Cn(this,no,Tn):Hr=In(this,no,Tn),Hr};function An(so,no){this.x=so,this.y=no}An.prototype.makeRBT=function(no){for(var Tn=new Array(no),Hr=jr.prototype._countBits(no)-1,Xr=0;Xr>=1;return Xr},An.prototype.permute=function(no,Tn,Hr,Xr,Sn,Rn){for(var Pn=0;Pn>>1)Sn++;return 1<>>13,Hr[2*Rn+1]=Sn&8191,Sn=Sn>>>13;for(Rn=2*Tn;Rn>=26,Tn+=Xr/67108864|0,Tn+=Sn>>>26,this.words[Hr]=Sn&67108863}return Tn!==0&&(this.words[Hr]=Tn,this.length++),this},jr.prototype.muln=function(no){return this.clone().imuln(no)},jr.prototype.sqr=function(){return this.mul(this)},jr.prototype.isqr=function(){return this.imul(this.clone())},jr.prototype.pow=function(no){var Tn=Qr(no);if(Tn.length===0)return new jr(1);for(var Hr=this,Xr=0;Xr=0);var Tn=no%26,Hr=(no-Tn)/26,Xr=67108863>>>26-Tn<<26-Tn,Sn;if(Tn!==0){var Rn=0;for(Sn=0;Sn>>26-Tn}Rn&&(this.words[Sn]=Rn,this.length++)}if(Hr!==0){for(Sn=this.length-1;Sn>=0;Sn--)this.words[Sn+Hr]=this.words[Sn];for(Sn=0;Sn=0);var Xr;Tn?Xr=(Tn-Tn%26)/26:Xr=0;var Sn=no%26,Rn=Math.min((no-Sn)/26,this.length),Pn=67108863^67108863>>>Sn<Rn)for(this.length-=Rn,Zn=0;Zn=0&&(Nn!==0||Zn>=Xr);Zn--){var wn=this.words[Zn]|0;this.words[Zn]=Nn<<26-Sn|wn>>>Sn,Nn=wn&Pn}return On&&Nn!==0&&(On.words[On.length++]=Nn),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},jr.prototype.ishrn=function(no,Tn,Hr){return Er(this.negative===0),this.iushrn(no,Tn,Hr)},jr.prototype.shln=function(no){return this.clone().ishln(no)},jr.prototype.ushln=function(no){return this.clone().iushln(no)},jr.prototype.shrn=function(no){return this.clone().ishrn(no)},jr.prototype.ushrn=function(no){return this.clone().iushrn(no)},jr.prototype.testn=function(no){Er(typeof no=="number"&&no>=0);var Tn=no%26,Hr=(no-Tn)/26,Xr=1<=0);var Tn=no%26,Hr=(no-Tn)/26;if(Er(this.negative===0,"imaskn works only with positive numbers"),this.length<=Hr)return this;if(Tn!==0&&Hr++,this.length=Math.min(Hr,this.length),Tn!==0){var Xr=67108863^67108863>>>Tn<=67108864;Tn++)this.words[Tn]-=67108864,Tn===this.length-1?this.words[Tn+1]=1:this.words[Tn+1]++;return this.length=Math.max(this.length,Tn+1),this},jr.prototype.isubn=function(no){if(Er(typeof no=="number"),Er(no<67108864),no<0)return this.iaddn(-no);if(this.negative!==0)return this.negative=0,this.iaddn(no),this.negative=1,this;if(this.words[0]-=no,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Tn=0;Tn>26)-(On/67108864|0),this.words[Sn+Hr]=Rn&67108863}for(;Sn>26,this.words[Sn+Hr]=Rn&67108863;if(Pn===0)return this.strip();for(Er(Pn===-1),Pn=0,Sn=0;Sn>26,this.words[Sn]=Rn&67108863;return this.negative=1,this.strip()},jr.prototype._wordDiv=function(no,Tn){var Hr=this.length-no.length,Xr=this.clone(),Sn=no,Rn=Sn.words[Sn.length-1]|0,Pn=this._countBits(Rn);Hr=26-Pn,Hr!==0&&(Sn=Sn.ushln(Hr),Xr.iushln(Hr),Rn=Sn.words[Sn.length-1]|0);var On=Xr.length-Sn.length,Zn;if(Tn!=="mod"){Zn=new jr(null),Zn.length=On+1,Zn.words=new Array(Zn.length);for(var Nn=0;Nn=0;zn--){var fo=(Xr.words[Sn.length+zn]|0)*67108864+(Xr.words[Sn.length+zn-1]|0);for(fo=Math.min(fo/Rn|0,67108863),Xr._ishlnsubmul(Sn,fo,zn);Xr.negative!==0;)fo--,Xr.negative=0,Xr._ishlnsubmul(Sn,1,zn),Xr.isZero()||(Xr.negative^=1);Zn&&(Zn.words[zn]=fo)}return Zn&&Zn.strip(),Xr.strip(),Tn!=="div"&&Hr!==0&&Xr.iushrn(Hr),{div:Zn||null,mod:Xr}},jr.prototype.divmod=function(no,Tn,Hr){if(Er(!no.isZero()),this.isZero())return{div:new jr(0),mod:new jr(0)};var Xr,Sn,Rn;return this.negative!==0&&no.negative===0?(Rn=this.neg().divmod(no,Tn),Tn!=="mod"&&(Xr=Rn.div.neg()),Tn!=="div"&&(Sn=Rn.mod.neg(),Hr&&Sn.negative!==0&&Sn.iadd(no)),{div:Xr,mod:Sn}):this.negative===0&&no.negative!==0?(Rn=this.divmod(no.neg(),Tn),Tn!=="mod"&&(Xr=Rn.div.neg()),{div:Xr,mod:Rn.mod}):this.negative&no.negative?(Rn=this.neg().divmod(no.neg(),Tn),Tn!=="div"&&(Sn=Rn.mod.neg(),Hr&&Sn.negative!==0&&Sn.isub(no)),{div:Rn.div,mod:Sn}):no.length>this.length||this.cmp(no)<0?{div:new jr(0),mod:this}:no.length===1?Tn==="div"?{div:this.divn(no.words[0]),mod:null}:Tn==="mod"?{div:null,mod:new jr(this.modn(no.words[0]))}:{div:this.divn(no.words[0]),mod:new jr(this.modn(no.words[0]))}:this._wordDiv(no,Tn)},jr.prototype.div=function(no){return this.divmod(no,"div",!1).div},jr.prototype.mod=function(no){return this.divmod(no,"mod",!1).mod},jr.prototype.umod=function(no){return this.divmod(no,"mod",!0).mod},jr.prototype.divRound=function(no){var Tn=this.divmod(no);if(Tn.mod.isZero())return Tn.div;var Hr=Tn.div.negative!==0?Tn.mod.isub(no):Tn.mod,Xr=no.ushrn(1),Sn=no.andln(1),Rn=Hr.cmp(Xr);return Rn<0||Sn===1&&Rn===0?Tn.div:Tn.div.negative!==0?Tn.div.isubn(1):Tn.div.iaddn(1)},jr.prototype.modn=function(no){Er(no<=67108863);for(var Tn=(1<<26)%no,Hr=0,Xr=this.length-1;Xr>=0;Xr--)Hr=(Tn*Hr+(this.words[Xr]|0))%no;return Hr},jr.prototype.idivn=function(no){Er(no<=67108863);for(var Tn=0,Hr=this.length-1;Hr>=0;Hr--){var Xr=(this.words[Hr]|0)+Tn*67108864;this.words[Hr]=Xr/no|0,Tn=Xr%no}return this.strip()},jr.prototype.divn=function(no){return this.clone().idivn(no)},jr.prototype.egcd=function(no){Er(no.negative===0),Er(!no.isZero());var Tn=this,Hr=no.clone();Tn.negative!==0?Tn=Tn.umod(no):Tn=Tn.clone();for(var Xr=new jr(1),Sn=new jr(0),Rn=new jr(0),Pn=new jr(1),On=0;Tn.isEven()&&Hr.isEven();)Tn.iushrn(1),Hr.iushrn(1),++On;for(var Zn=Hr.clone(),Nn=Tn.clone();!Tn.isZero();){for(var wn=0,zn=1;!(Tn.words[0]&zn)&&wn<26;++wn,zn<<=1);if(wn>0)for(Tn.iushrn(wn);wn-- >0;)(Xr.isOdd()||Sn.isOdd())&&(Xr.iadd(Zn),Sn.isub(Nn)),Xr.iushrn(1),Sn.iushrn(1);for(var fo=0,vo=1;!(Hr.words[0]&vo)&&fo<26;++fo,vo<<=1);if(fo>0)for(Hr.iushrn(fo);fo-- >0;)(Rn.isOdd()||Pn.isOdd())&&(Rn.iadd(Zn),Pn.isub(Nn)),Rn.iushrn(1),Pn.iushrn(1);Tn.cmp(Hr)>=0?(Tn.isub(Hr),Xr.isub(Rn),Sn.isub(Pn)):(Hr.isub(Tn),Rn.isub(Xr),Pn.isub(Sn))}return{a:Rn,b:Pn,gcd:Hr.iushln(On)}},jr.prototype._invmp=function(no){Er(no.negative===0),Er(!no.isZero());var Tn=this,Hr=no.clone();Tn.negative!==0?Tn=Tn.umod(no):Tn=Tn.clone();for(var Xr=new jr(1),Sn=new jr(0),Rn=Hr.clone();Tn.cmpn(1)>0&&Hr.cmpn(1)>0;){for(var Pn=0,On=1;!(Tn.words[0]&On)&&Pn<26;++Pn,On<<=1);if(Pn>0)for(Tn.iushrn(Pn);Pn-- >0;)Xr.isOdd()&&Xr.iadd(Rn),Xr.iushrn(1);for(var Zn=0,Nn=1;!(Hr.words[0]&Nn)&&Zn<26;++Zn,Nn<<=1);if(Zn>0)for(Hr.iushrn(Zn);Zn-- >0;)Sn.isOdd()&&Sn.iadd(Rn),Sn.iushrn(1);Tn.cmp(Hr)>=0?(Tn.isub(Hr),Xr.isub(Sn)):(Hr.isub(Tn),Sn.isub(Xr))}var wn;return Tn.cmpn(1)===0?wn=Xr:wn=Sn,wn.cmpn(0)<0&&wn.iadd(no),wn},jr.prototype.gcd=function(no){if(this.isZero())return no.abs();if(no.isZero())return this.abs();var Tn=this.clone(),Hr=no.clone();Tn.negative=0,Hr.negative=0;for(var Xr=0;Tn.isEven()&&Hr.isEven();Xr++)Tn.iushrn(1),Hr.iushrn(1);do{for(;Tn.isEven();)Tn.iushrn(1);for(;Hr.isEven();)Hr.iushrn(1);var Sn=Tn.cmp(Hr);if(Sn<0){var Rn=Tn;Tn=Hr,Hr=Rn}else if(Sn===0||Hr.cmpn(1)===0)break;Tn.isub(Hr)}while(!0);return Hr.iushln(Xr)},jr.prototype.invm=function(no){return this.egcd(no).a.umod(no)},jr.prototype.isEven=function(){return(this.words[0]&1)===0},jr.prototype.isOdd=function(){return(this.words[0]&1)===1},jr.prototype.andln=function(no){return this.words[0]&no},jr.prototype.bincn=function(no){Er(typeof no=="number");var Tn=no%26,Hr=(no-Tn)/26,Xr=1<>>26,Pn&=67108863,this.words[Rn]=Pn}return Sn!==0&&(this.words[Rn]=Sn,this.length++),this},jr.prototype.isZero=function(){return this.length===1&&this.words[0]===0},jr.prototype.cmpn=function(no){var Tn=no<0;if(this.negative!==0&&!Tn)return-1;if(this.negative===0&&Tn)return 1;this.strip();var Hr;if(this.length>1)Hr=1;else{Tn&&(no=-no),Er(no<=67108863,"Number is too big");var Xr=this.words[0]|0;Hr=Xr===no?0:Xrno.length)return 1;if(this.length=0;Hr--){var Xr=this.words[Hr]|0,Sn=no.words[Hr]|0;if(Xr!==Sn){XrSn&&(Tn=1);break}}return Tn},jr.prototype.gtn=function(no){return this.cmpn(no)===1},jr.prototype.gt=function(no){return this.cmp(no)===1},jr.prototype.gten=function(no){return this.cmpn(no)>=0},jr.prototype.gte=function(no){return this.cmp(no)>=0},jr.prototype.ltn=function(no){return this.cmpn(no)===-1},jr.prototype.lt=function(no){return this.cmp(no)===-1},jr.prototype.lten=function(no){return this.cmpn(no)<=0},jr.prototype.lte=function(no){return this.cmp(no)<=0},jr.prototype.eqn=function(no){return this.cmpn(no)===0},jr.prototype.eq=function(no){return this.cmp(no)===0},jr.red=function(no){return new io(no)},jr.prototype.toRed=function(no){return Er(!this.red,"Already a number in reduction context"),Er(this.negative===0,"red works only with positives"),no.convertTo(this)._forceRed(no)},jr.prototype.fromRed=function(){return Er(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},jr.prototype._forceRed=function(no){return this.red=no,this},jr.prototype.forceRed=function(no){return Er(!this.red,"Already a number in reduction context"),this._forceRed(no)},jr.prototype.redAdd=function(no){return Er(this.red,"redAdd works only with red numbers"),this.red.add(this,no)},jr.prototype.redIAdd=function(no){return Er(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,no)},jr.prototype.redSub=function(no){return Er(this.red,"redSub works only with red numbers"),this.red.sub(this,no)},jr.prototype.redISub=function(no){return Er(this.red,"redISub works only with red numbers"),this.red.isub(this,no)},jr.prototype.redShl=function(no){return Er(this.red,"redShl works only with red numbers"),this.red.shl(this,no)},jr.prototype.redMul=function(no){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,no),this.red.mul(this,no)},jr.prototype.redIMul=function(no){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,no),this.red.imul(this,no)},jr.prototype.redSqr=function(){return Er(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},jr.prototype.redISqr=function(){return Er(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},jr.prototype.redSqrt=function(){return Er(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},jr.prototype.redInvm=function(){return Er(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},jr.prototype.redNeg=function(){return Er(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},jr.prototype.redPow=function(no){return Er(this.red&&!no.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,no)};var jn={k256:null,p224:null,p192:null,p25519:null};function eo(so,no){this.name=so,this.p=new jr(no,16),this.n=this.p.bitLength(),this.k=new jr(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}eo.prototype._tmp=function(){var no=new jr(null);return no.words=new Array(Math.ceil(this.n/13)),no},eo.prototype.ireduce=function(no){var Tn=no,Hr;do this.split(Tn,this.tmp),Tn=this.imulK(Tn),Tn=Tn.iadd(this.tmp),Hr=Tn.bitLength();while(Hr>this.n);var Xr=Hr0?Tn.isub(this.p):Tn.strip!==void 0?Tn.strip():Tn._strip(),Tn},eo.prototype.split=function(no,Tn){no.iushrn(this.n,0,Tn)},eo.prototype.imulK=function(no){return no.imul(this.k)};function ro(){eo.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}kr(ro,eo),ro.prototype.split=function(no,Tn){for(var Hr=4194303,Xr=Math.min(no.length,9),Sn=0;Sn>>22,Rn=Pn}Rn>>>=22,no.words[Sn-10]=Rn,Rn===0&&no.length>10?no.length-=10:no.length-=9},ro.prototype.imulK=function(no){no.words[no.length]=0,no.words[no.length+1]=0,no.length+=2;for(var Tn=0,Hr=0;Hr>>=26,no.words[Hr]=Sn,Tn=Xr}return Tn!==0&&(no.words[no.length++]=Tn),no},jr._prime=function(no){if(jn[no])return jn[no];var Tn;if(no==="k256")Tn=new ro;else if(no==="p224")Tn=new to;else if(no==="p192")Tn=new _i;else if(no==="p25519")Tn=new oo;else throw new Error("Unknown prime "+no);return jn[no]=Tn,Tn};function io(so){if(typeof so=="string"){var no=jr._prime(so);this.m=no.p,this.prime=no}else Er(so.gtn(1),"modulus must be greater than 1"),this.m=so,this.prime=null}io.prototype._verify1=function(no){Er(no.negative===0,"red works only with positives"),Er(no.red,"red works only with red numbers")},io.prototype._verify2=function(no,Tn){Er((no.negative|Tn.negative)===0,"red works only with positives"),Er(no.red&&no.red===Tn.red,"red works only with red numbers")},io.prototype.imod=function(no){return this.prime?this.prime.ireduce(no)._forceRed(this):no.umod(this.m)._forceRed(this)},io.prototype.neg=function(no){return no.isZero()?no.clone():this.m.sub(no)._forceRed(this)},io.prototype.add=function(no,Tn){this._verify2(no,Tn);var Hr=no.add(Tn);return Hr.cmp(this.m)>=0&&Hr.isub(this.m),Hr._forceRed(this)},io.prototype.iadd=function(no,Tn){this._verify2(no,Tn);var Hr=no.iadd(Tn);return Hr.cmp(this.m)>=0&&Hr.isub(this.m),Hr},io.prototype.sub=function(no,Tn){this._verify2(no,Tn);var Hr=no.sub(Tn);return Hr.cmpn(0)<0&&Hr.iadd(this.m),Hr._forceRed(this)},io.prototype.isub=function(no,Tn){this._verify2(no,Tn);var Hr=no.isub(Tn);return Hr.cmpn(0)<0&&Hr.iadd(this.m),Hr},io.prototype.shl=function(no,Tn){return this._verify1(no),this.imod(no.ushln(Tn))},io.prototype.imul=function(no,Tn){return this._verify2(no,Tn),this.imod(no.imul(Tn))},io.prototype.mul=function(no,Tn){return this._verify2(no,Tn),this.imod(no.mul(Tn))},io.prototype.isqr=function(no){return this.imul(no,no.clone())},io.prototype.sqr=function(no){return this.mul(no,no)},io.prototype.sqrt=function(no){if(no.isZero())return no.clone();var Tn=this.m.andln(3);if(Er(Tn%2===1),Tn===3){var Hr=this.m.add(new jr(1)).iushrn(2);return this.pow(no,Hr)}for(var Xr=this.m.subn(1),Sn=0;!Xr.isZero()&&Xr.andln(1)===0;)Sn++,Xr.iushrn(1);Er(!Xr.isZero());var Rn=new jr(1).toRed(this),Pn=Rn.redNeg(),On=this.m.subn(1).iushrn(1),Zn=this.m.bitLength();for(Zn=new jr(2*Zn*Zn).toRed(this);this.pow(Zn,On).cmp(Pn)!==0;)Zn.redIAdd(Pn);for(var Nn=this.pow(Zn,Xr),wn=this.pow(no,Xr.addn(1).iushrn(1)),zn=this.pow(no,Xr),fo=Sn;zn.cmp(Rn)!==0;){for(var vo=zn,go=0;vo.cmp(Rn)!==0;go++)vo=vo.redSqr();Er(go=0;Sn--){for(var Nn=Tn.words[Sn],wn=Zn-1;wn>=0;wn--){var zn=Nn>>wn&1;if(Rn!==Xr[0]&&(Rn=this.sqr(Rn)),zn===0&&Pn===0){On=0;continue}Pn<<=1,Pn|=zn,On++,!(On!==Hr&&(Sn!==0||wn!==0))&&(Rn=this.mul(Rn,Xr[Pn]),On=0,Pn=0)}Zn=26}return Rn},io.prototype.convertTo=function(no){var Tn=no.umod(this.m);return Tn===no?Tn.clone():Tn},io.prototype.convertFrom=function(no){var Tn=no.clone();return Tn.red=null,Tn},jr.mont=function(no){return new co(no)};function co(so){io.call(this,so),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new jr(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}kr(co,io),co.prototype.convertTo=function(no){return this.imod(no.ushln(this.shift))},co.prototype.convertFrom=function(no){var Tn=this.imod(no.mul(this.rinv));return Tn.red=null,Tn},co.prototype.imul=function(no,Tn){if(no.isZero()||Tn.isZero())return no.words[0]=0,no.length=1,no;var Hr=no.imul(Tn),Xr=Hr.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Sn=Hr.isub(Xr).iushrn(this.shift),Rn=Sn;return Sn.cmp(this.m)>=0?Rn=Sn.isub(this.m):Sn.cmpn(0)<0&&(Rn=Sn.iadd(this.m)),Rn._forceRed(this)},co.prototype.mul=function(no,Tn){if(no.isZero()||Tn.isZero())return new jr(0)._forceRed(this);var Hr=no.mul(Tn),Xr=Hr.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Sn=Hr.isub(Xr).iushrn(this.shift),Rn=Sn;return Sn.cmp(this.m)>=0?Rn=Sn.isub(this.m):Sn.cmpn(0)<0&&(Rn=Sn.iadd(this.m)),Rn._forceRed(this)},co.prototype.invm=function(no){var Tn=this.imod(no._invmp(this.m).mul(this.r2));return Tn._forceRed(this)}})(fr,commonjsGlobal)}(bn$6)),bn$6.exports}var brorand={exports:{}},hasRequiredBrorand;function requireBrorand(){if(hasRequiredBrorand)return brorand.exports;hasRequiredBrorand=1;var fr;brorand.exports=function(kr){return fr||(fr=new br(null)),fr.generate(kr)};function br(Er){this.rand=Er}if(brorand.exports.Rand=br,br.prototype.generate=function(kr){return this._rand(kr)},br.prototype._rand=function(kr){if(this.rand.getBytes)return this.rand.getBytes(kr);for(var jr=new Uint8Array(kr),Br=0;Br=0);return Wr},wr.prototype._randrange=function(kr,jr){var Br=jr.sub(kr);return kr.add(this._randbelow(Br))},wr.prototype.test=function(kr,jr,Br){var Wr=kr.bitLength(),qr=fr.mont(kr),Gr=new fr(1).toRed(qr);jr||(jr=Math.max(1,Wr/48|0));for(var Vr=kr.subn(1),Zr=0;!Vr.testn(Zr);Zr++);for(var Jr=kr.shrn(Zr),Qr=Vr.toRed(qr),_n=!0;jr>0;jr--){var En=this._randrange(new fr(2),Vr);Br&&Br(En);var Cn=En.toRed(qr).redPow(Jr);if(!(Cn.cmp(Gr)===0||Cn.cmp(Qr)===0)){for(var In=1;In0;jr--){var Qr=this._randrange(new fr(2),Gr),_n=kr.gcd(Qr);if(_n.cmpn(1)!==0)return _n;var En=Qr.toRed(Wr).redPow(Zr);if(!(En.cmp(qr)===0||En.cmp(Jr)===0)){for(var Cn=1;CnIn;)jn.ishrn(1);if(jn.isEven()&&jn.iadd(jr),jn.testn(1)||jn.iadd(Br),An.cmp(Br)){if(!An.cmp(Wr))for(;jn.mod(qr).cmp(Gr);)jn.iadd(Zr)}else for(;jn.mod(wr).cmp(Vr);)jn.iadd(Zr);if(eo=jn.shrn(1),_n(eo)&&_n(jn)&&En(eo)&&En(jn)&&kr.test(eo)&&kr.test(jn))return jn}}return generatePrime}const modp1={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},require$$1$2={modp1,modp2,modp5,modp14,modp15,modp16,modp17,modp18};var dh,hasRequiredDh;function requireDh(){if(hasRequiredDh)return dh;hasRequiredDh=1;var fr=requireBn$2(),br=requireMr(),wr=new br,Er=new fr(24),kr=new fr(11),jr=new fr(10),Br=new fr(3),Wr=new fr(7),qr=requireGeneratePrime(),Gr=requireBrowser$b();dh=_n;function Vr(Cn,In){return In=In||"utf8",Buffer$2.isBuffer(Cn)||(Cn=new Buffer$2(Cn,In)),this._pub=new fr(Cn),this}function Zr(Cn,In){return In=In||"utf8",Buffer$2.isBuffer(Cn)||(Cn=new Buffer$2(Cn,In)),this._priv=new fr(Cn),this}var Jr={};function Qr(Cn,In){var An=In.toString("hex"),jn=[An,Cn.toString(16)].join("_");if(jn in Jr)return Jr[jn];var eo=0;if(Cn.isEven()||!qr.simpleSieve||!qr.fermatTest(Cn)||!wr.test(Cn))return eo+=1,An==="02"||An==="05"?eo+=8:eo+=4,Jr[jn]=eo,eo;wr.test(Cn.shrn(1))||(eo+=2);var ro;switch(An){case"02":Cn.mod(Er).cmp(kr)&&(eo+=8);break;case"05":ro=Cn.mod(jr),ro.cmp(Br)&&ro.cmp(Wr)&&(eo+=8);break;default:eo+=4}return Jr[jn]=eo,eo}function _n(Cn,In,An){this.setGenerator(In),this.__prime=new fr(Cn),this._prime=fr.mont(this.__prime),this._primeLen=Cn.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,An?(this.setPublicKey=Vr,this.setPrivateKey=Zr):this._primeCode=8}Object.defineProperty(_n.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=Qr(this.__prime,this.__gen)),this._primeCode}}),_n.prototype.generateKeys=function(){return this._priv||(this._priv=new fr(Gr(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},_n.prototype.computeSecret=function(Cn){Cn=new fr(Cn),Cn=Cn.toRed(this._prime);var In=Cn.redPow(this._priv).fromRed(),An=new Buffer$2(In.toArray()),jn=this.getPrime();if(An.length"u"||!process$1$1.version||process$1$1.version.indexOf("v0.")===0||process$1$1.version.indexOf("v1.")===0&&process$1$1.version.indexOf("v1.8.")!==0?processNextickArgs.exports={nextTick:fr}:processNextickArgs.exports=process$1$1;function fr(br,wr,Er,kr){if(typeof br!="function")throw new TypeError('"callback" argument must be a function');var jr=arguments.length,Br,Wr;switch(jr){case 0:case 1:return process$1$1.nextTick(br);case 2:return process$1$1.nextTick(function(){br.call(null,wr)});case 3:return process$1$1.nextTick(function(){br.call(null,wr,Er)});case 4:return process$1$1.nextTick(function(){br.call(null,wr,Er,kr)});default:for(Br=new Array(jr-1),Wr=0;Wr"u"}util$7.isPrimitive=Qr,util$7.isBuffer=require$$0$9.Buffer.isBuffer;function _n(En){return Object.prototype.toString.call(En)}return util$7}var BufferList={exports:{}},hasRequiredBufferList;function requireBufferList(){return hasRequiredBufferList||(hasRequiredBufferList=1,function(fr){function br(jr,Br){if(!(jr instanceof Br))throw new TypeError("Cannot call a class as a function")}var wr=requireSafeBuffer().Buffer,Er=requireUtil$1();function kr(jr,Br,Wr){jr.copy(Br,Wr)}fr.exports=function(){function jr(){br(this,jr),this.head=null,this.tail=null,this.length=0}return jr.prototype.push=function(Wr){var qr={data:Wr,next:null};this.length>0?this.tail.next=qr:this.head=qr,this.tail=qr,++this.length},jr.prototype.unshift=function(Wr){var qr={data:Wr,next:this.head};this.length===0&&(this.tail=qr),this.head=qr,++this.length},jr.prototype.shift=function(){if(this.length!==0){var Wr=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,Wr}},jr.prototype.clear=function(){this.head=this.tail=null,this.length=0},jr.prototype.join=function(Wr){if(this.length===0)return"";for(var qr=this.head,Gr=""+qr.data;qr=qr.next;)Gr+=Wr+qr.data;return Gr},jr.prototype.concat=function(Wr){if(this.length===0)return wr.alloc(0);for(var qr=wr.allocUnsafe(Wr>>>0),Gr=this.head,Vr=0;Gr;)kr(Gr.data,qr,Vr),Vr+=Gr.data.length,Gr=Gr.next;return qr},jr}(),Er&&Er.inspect&&Er.inspect.custom&&(fr.exports.prototype[Er.inspect.custom]=function(){var jr=Er.inspect({length:this.length});return this.constructor.name+" "+jr})}(BufferList)),BufferList.exports}var destroy_1,hasRequiredDestroy;function requireDestroy(){if(hasRequiredDestroy)return destroy_1;hasRequiredDestroy=1;var fr=requireProcessNextickArgs();function br(kr,jr){var Br=this,Wr=this._readableState&&this._readableState.destroyed,qr=this._writableState&&this._writableState.destroyed;return Wr||qr?(jr?jr(kr):kr&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,fr.nextTick(Er,this,kr)):fr.nextTick(Er,this,kr)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(kr||null,function(Gr){!jr&&Gr?Br._writableState?Br._writableState.errorEmitted||(Br._writableState.errorEmitted=!0,fr.nextTick(Er,Br,Gr)):fr.nextTick(Er,Br,Gr):jr&&jr(Gr)}),this)}function wr(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Er(kr,jr){kr.emit("error",jr)}return destroy_1={destroy:br,undestroy:wr},destroy_1}var _stream_writable,hasRequired_stream_writable;function require_stream_writable(){if(hasRequired_stream_writable)return _stream_writable;hasRequired_stream_writable=1;var fr=requireProcessNextickArgs();_stream_writable=En;function br(Rn){var Pn=this;this.next=null,this.entry=null,this.finish=function(){Sn(Pn,Rn)}}var wr=!process$1$1.browser&&["v0.10","v0.9."].indexOf(process$1$1.version.slice(0,5))>-1?setImmediate:fr.nextTick,Er;En.WritableState=Qr;var kr=Object.create(requireUtil());kr.inherits=requireInherits_browser();var jr={deprecate:requireBrowser$a()},Br=requireStreamBrowser(),Wr=requireSafeBuffer().Buffer,qr=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function Gr(Rn){return Wr.from(Rn)}function Vr(Rn){return Wr.isBuffer(Rn)||Rn instanceof qr}var Zr=requireDestroy();kr.inherits(En,Br);function Jr(){}function Qr(Rn,Pn){Er=Er||require_stream_duplex(),Rn=Rn||{};var On=Pn instanceof Er;this.objectMode=!!Rn.objectMode,On&&(this.objectMode=this.objectMode||!!Rn.writableObjectMode);var Zn=Rn.highWaterMark,Nn=Rn.writableHighWaterMark,wn=this.objectMode?16:16*1024;Zn||Zn===0?this.highWaterMark=Zn:On&&(Nn||Nn===0)?this.highWaterMark=Nn:this.highWaterMark=wn,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var zn=Rn.decodeStrings===!1;this.decodeStrings=!zn,this.defaultEncoding=Rn.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(fo){_i(Pn,fo)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new br(this)}Qr.prototype.getBuffer=function(){for(var Pn=this.bufferedRequest,On=[];Pn;)On.push(Pn),Pn=Pn.next;return On},function(){try{Object.defineProperty(Qr.prototype,"buffer",{get:jr.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var _n;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(_n=Function.prototype[Symbol.hasInstance],Object.defineProperty(En,Symbol.hasInstance,{value:function(Rn){return _n.call(this,Rn)?!0:this!==En?!1:Rn&&Rn._writableState instanceof Qr}})):_n=function(Rn){return Rn instanceof this};function En(Rn){if(Er=Er||require_stream_duplex(),!_n.call(En,this)&&!(this instanceof Er))return new En(Rn);this._writableState=new Qr(Rn,this),this.writable=!0,Rn&&(typeof Rn.write=="function"&&(this._write=Rn.write),typeof Rn.writev=="function"&&(this._writev=Rn.writev),typeof Rn.destroy=="function"&&(this._destroy=Rn.destroy),typeof Rn.final=="function"&&(this._final=Rn.final)),Br.call(this)}En.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function Cn(Rn,Pn){var On=new Error("write after end");Rn.emit("error",On),fr.nextTick(Pn,On)}function In(Rn,Pn,On,Zn){var Nn=!0,wn=!1;return On===null?wn=new TypeError("May not write null values to stream"):typeof On!="string"&&On!==void 0&&!Pn.objectMode&&(wn=new TypeError("Invalid non-string/buffer chunk")),wn&&(Rn.emit("error",wn),fr.nextTick(Zn,wn),Nn=!1),Nn}En.prototype.write=function(Rn,Pn,On){var Zn=this._writableState,Nn=!1,wn=!Zn.objectMode&&Vr(Rn);return wn&&!Wr.isBuffer(Rn)&&(Rn=Gr(Rn)),typeof Pn=="function"&&(On=Pn,Pn=null),wn?Pn="buffer":Pn||(Pn=Zn.defaultEncoding),typeof On!="function"&&(On=Jr),Zn.ended?Cn(this,On):(wn||In(this,Zn,Rn,On))&&(Zn.pendingcb++,Nn=jn(this,Zn,wn,Rn,Pn,On)),Nn},En.prototype.cork=function(){var Rn=this._writableState;Rn.corked++},En.prototype.uncork=function(){var Rn=this._writableState;Rn.corked&&(Rn.corked--,!Rn.writing&&!Rn.corked&&!Rn.bufferProcessing&&Rn.bufferedRequest&&co(this,Rn))},En.prototype.setDefaultEncoding=function(Pn){if(typeof Pn=="string"&&(Pn=Pn.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((Pn+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+Pn);return this._writableState.defaultEncoding=Pn,this};function An(Rn,Pn,On){return!Rn.objectMode&&Rn.decodeStrings!==!1&&typeof Pn=="string"&&(Pn=Wr.from(Pn,On)),Pn}Object.defineProperty(En.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function jn(Rn,Pn,On,Zn,Nn,wn){if(!On){var zn=An(Pn,Zn,Nn);Zn!==zn&&(On=!0,Nn="buffer",Zn=zn)}var fo=Pn.objectMode?1:Zn.length;Pn.length+=fo;var vo=Pn.length0?(typeof lo!="string"&&!_o.objectMode&&Object.getPrototypeOf(lo)!==jr.prototype&&(lo=Wr(lo)),mo?_o.endEmitted?uo.emit("error",new Error("stream.unshift() after end event")):eo(uo,_o,lo,!0):_o.ended?uo.emit("error",new Error("stream.push() after EOF")):(_o.reading=!1,_o.decoder&&!Eo?(lo=_o.decoder.write(lo),_o.objectMode||lo.length!==0?eo(uo,_o,lo,!1):Tn(uo,_o)):eo(uo,_o,lo,!1))):mo||(_o.reading=!1)}return to(_o)}function eo(uo,lo,Eo,mo){lo.flowing&&lo.length===0&&!lo.sync?(uo.emit("data",Eo),uo.read(0)):(lo.length+=lo.objectMode?1:Eo.length,mo?lo.buffer.unshift(Eo):lo.buffer.push(Eo),lo.needReadable&&so(uo)),Tn(uo,lo)}function ro(uo,lo){var Eo;return!qr(lo)&&typeof lo!="string"&&lo!==void 0&&!uo.objectMode&&(Eo=new TypeError("Invalid non-string/buffer chunk")),Eo}function to(uo){return!uo.ended&&(uo.needReadable||uo.length=_i?uo=_i:(uo--,uo|=uo>>>1,uo|=uo>>>2,uo|=uo>>>4,uo|=uo>>>8,uo|=uo>>>16,uo++),uo}function io(uo,lo){return uo<=0||lo.length===0&&lo.ended?0:lo.objectMode?1:uo!==uo?lo.flowing&&lo.length?lo.buffer.head.data.length:lo.length:(uo>lo.highWaterMark&&(lo.highWaterMark=oo(uo)),uo<=lo.length?uo:lo.ended?lo.length:(lo.needReadable=!0,0))}An.prototype.read=function(uo){Zr("read",uo),uo=parseInt(uo,10);var lo=this._readableState,Eo=uo;if(uo!==0&&(lo.emittedReadable=!1),uo===0&&lo.needReadable&&(lo.length>=lo.highWaterMark||lo.ended))return Zr("read: emitReadable",lo.length,lo.ended),lo.length===0&&lo.ended?fo(this):so(this),null;if(uo=io(uo,lo),uo===0&&lo.ended)return lo.length===0&&fo(this),null;var mo=lo.needReadable;Zr("need readable",mo),(lo.length===0||lo.length-uo0?yo=Zn(uo,lo):yo=null,yo===null?(lo.needReadable=!0,uo=0):lo.length-=uo,lo.length===0&&(lo.ended||(lo.needReadable=!0),Eo!==uo&&lo.ended&&fo(this)),yo!==null&&this.emit("data",yo),yo};function co(uo,lo){if(!lo.ended){if(lo.decoder){var Eo=lo.decoder.end();Eo&&Eo.length&&(lo.buffer.push(Eo),lo.length+=lo.objectMode?1:Eo.length)}lo.ended=!0,so(uo)}}function so(uo){var lo=uo._readableState;lo.needReadable=!1,lo.emittedReadable||(Zr("emitReadable",lo.flowing),lo.emittedReadable=!0,lo.sync?fr.nextTick(no,uo):no(uo))}function no(uo){Zr("emit readable"),uo.emit("readable"),On(uo)}function Tn(uo,lo){lo.readingMore||(lo.readingMore=!0,fr.nextTick(Hr,uo,lo))}function Hr(uo,lo){for(var Eo=lo.length;!lo.reading&&!lo.flowing&&!lo.ended&&lo.length1&&go(mo.pipes,uo)!==-1)&&!na&&(Zr("false write response, pause",mo.awaitDrain),mo.awaitDrain++,ga=!0),Eo.pause())}function No(Fo){Zr("onerror",Fo),Vo(),uo.removeListener("error",No),Er(uo,"error")===0&&uo.emit("error",Fo)}Cn(uo,"error",No);function Uo(){uo.removeListener("finish",Nl),Vo()}uo.once("close",Uo);function Nl(){Zr("onfinish"),uo.removeListener("close",Uo),Vo()}uo.once("finish",Nl);function Vo(){Zr("unpipe"),Eo.unpipe(uo)}return uo.emit("pipe",Eo),mo.flowing||(Zr("pipe resume"),Eo.resume()),uo};function Xr(uo){return function(){var lo=uo._readableState;Zr("pipeOnDrain",lo.awaitDrain),lo.awaitDrain&&lo.awaitDrain--,lo.awaitDrain===0&&Er(uo,"data")&&(lo.flowing=!0,On(uo))}}An.prototype.unpipe=function(uo){var lo=this._readableState,Eo={hasUnpiped:!1};if(lo.pipesCount===0)return this;if(lo.pipesCount===1)return uo&&uo!==lo.pipes?this:(uo||(uo=lo.pipes),lo.pipes=null,lo.pipesCount=0,lo.flowing=!1,uo&&uo.emit("unpipe",this,Eo),this);if(!uo){var mo=lo.pipes,yo=lo.pipesCount;lo.pipes=null,lo.pipesCount=0,lo.flowing=!1;for(var _o=0;_o=lo.length?(lo.decoder?Eo=lo.buffer.join(""):lo.buffer.length===1?Eo=lo.buffer.head.data:Eo=lo.buffer.concat(lo.length),lo.buffer.clear()):Eo=Nn(uo,lo.buffer,lo.decoder),Eo}function Nn(uo,lo,Eo){var mo;return uo_o.length?_o.length:uo;if(Bo===_o.length?yo+=_o:yo+=_o.slice(0,uo),uo-=Bo,uo===0){Bo===_o.length?(++mo,Eo.next?lo.head=Eo.next:lo.head=lo.tail=null):(lo.head=Eo,Eo.data=_o.slice(Bo));break}++mo}return lo.length-=mo,yo}function zn(uo,lo){var Eo=jr.allocUnsafe(uo),mo=lo.head,yo=1;for(mo.data.copy(Eo),uo-=mo.data.length;mo=mo.next;){var _o=mo.data,Bo=uo>_o.length?_o.length:uo;if(_o.copy(Eo,Eo.length-uo,0,Bo),uo-=Bo,uo===0){Bo===_o.length?(++yo,mo.next?lo.head=mo.next:lo.head=lo.tail=null):(lo.head=mo,mo.data=_o.slice(Bo));break}++yo}return lo.length-=yo,Eo}function fo(uo){var lo=uo._readableState;if(lo.length>0)throw new Error('"endReadable()" called on non-empty stream');lo.endEmitted||(lo.ended=!0,fr.nextTick(vo,lo,uo))}function vo(uo,lo){!uo.endEmitted&&uo.length===0&&(uo.endEmitted=!0,lo.readable=!1,lo.emit("end"))}function go(uo,lo){for(var Eo=0,mo=uo.length;Eo0?Hr:Xr},jr.min=function(Hr,Xr){return Hr.cmp(Xr)<0?Hr:Xr},jr.prototype._init=function(Hr,Xr,Sn){if(typeof Hr=="number")return this._initNumber(Hr,Xr,Sn);if(typeof Hr=="object")return this._initArray(Hr,Xr,Sn);Xr==="hex"&&(Xr=16),Er(Xr===(Xr|0)&&Xr>=2&&Xr<=36),Hr=Hr.toString().replace(/\s+/g,"");var Rn=0;Hr[0]==="-"&&(Rn++,this.negative=1),Rn=0;Rn-=3)On=Hr[Rn]|Hr[Rn-1]<<8|Hr[Rn-2]<<16,this.words[Pn]|=On<>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);else if(Sn==="le")for(Rn=0,Pn=0;Rn>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);return this._strip()};function Wr(Tn,Hr){var Xr=Tn.charCodeAt(Hr);if(Xr>=48&&Xr<=57)return Xr-48;if(Xr>=65&&Xr<=70)return Xr-55;if(Xr>=97&&Xr<=102)return Xr-87;Er(!1,"Invalid character in "+Tn)}function qr(Tn,Hr,Xr){var Sn=Wr(Tn,Xr);return Xr-1>=Hr&&(Sn|=Wr(Tn,Xr-1)<<4),Sn}jr.prototype._parseHex=function(Hr,Xr,Sn){this.length=Math.ceil((Hr.length-Xr)/6),this.words=new Array(this.length);for(var Rn=0;Rn=Xr;Rn-=2)Zn=qr(Hr,Xr,Rn)<=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8;else{var Nn=Hr.length-Xr;for(Rn=Nn%2===0?Xr+1:Xr;Rn=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8}this._strip()};function Gr(Tn,Hr,Xr,Sn){for(var Rn=0,Pn=0,On=Math.min(Tn.length,Xr),Zn=Hr;Zn=49?Pn=Nn-49+10:Nn>=17?Pn=Nn-17+10:Pn=Nn,Er(Nn>=0&&Pn1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},jr.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{jr.prototype[Symbol.for("nodejs.util.inspect.custom")]=Zr}catch{jr.prototype.inspect=Zr}else jr.prototype.inspect=Zr;function Zr(){return(this.red?""}var Jr=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Qr=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_n=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];jr.prototype.toString=function(Hr,Xr){Hr=Hr||10,Xr=Xr|0||1;var Sn;if(Hr===16||Hr==="hex"){Sn="";for(var Rn=0,Pn=0,On=0;On>>24-Rn&16777215,Rn+=2,Rn>=26&&(Rn-=26,On--),Pn!==0||On!==this.length-1?Sn=Jr[6-Nn.length]+Nn+Sn:Sn=Nn+Sn}for(Pn!==0&&(Sn=Pn.toString(16)+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}if(Hr===(Hr|0)&&Hr>=2&&Hr<=36){var wn=Qr[Hr],zn=_n[Hr];Sn="";var fo=this.clone();for(fo.negative=0;!fo.isZero();){var vo=fo.modrn(zn).toString(Hr);fo=fo.idivn(zn),fo.isZero()?Sn=vo+Sn:Sn=Jr[wn-vo.length]+vo+Sn}for(this.isZero()&&(Sn="0"+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}Er(!1,"Base should be between 2 and 36")},jr.prototype.toNumber=function(){var Hr=this.words[0];return this.length===2?Hr+=this.words[1]*67108864:this.length===3&&this.words[2]===1?Hr+=4503599627370496+this.words[1]*67108864:this.length>2&&Er(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-Hr:Hr},jr.prototype.toJSON=function(){return this.toString(16,2)},Br&&(jr.prototype.toBuffer=function(Hr,Xr){return this.toArrayLike(Br,Hr,Xr)}),jr.prototype.toArray=function(Hr,Xr){return this.toArrayLike(Array,Hr,Xr)};var En=function(Hr,Xr){return Hr.allocUnsafe?Hr.allocUnsafe(Xr):new Hr(Xr)};jr.prototype.toArrayLike=function(Hr,Xr,Sn){this._strip();var Rn=this.byteLength(),Pn=Sn||Math.max(1,Rn);Er(Rn<=Pn,"byte array longer than desired length"),Er(Pn>0,"Requested array length <= 0");var On=En(Hr,Pn),Zn=Xr==="le"?"LE":"BE";return this["_toArrayLike"+Zn](On,Rn),On},jr.prototype._toArrayLikeLE=function(Hr,Xr){for(var Sn=0,Rn=0,Pn=0,On=0;Pn>8&255),Sn>16&255),On===6?(Sn>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn=0&&(Hr[Sn--]=Zn>>8&255),Sn>=0&&(Hr[Sn--]=Zn>>16&255),On===6?(Sn>=0&&(Hr[Sn--]=Zn>>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn>=0)for(Hr[Sn--]=Rn;Sn>=0;)Hr[Sn--]=0},Math.clz32?jr.prototype._countBits=function(Hr){return 32-Math.clz32(Hr)}:jr.prototype._countBits=function(Hr){var Xr=Hr,Sn=0;return Xr>=4096&&(Sn+=13,Xr>>>=13),Xr>=64&&(Sn+=7,Xr>>>=7),Xr>=8&&(Sn+=4,Xr>>>=4),Xr>=2&&(Sn+=2,Xr>>>=2),Sn+Xr},jr.prototype._zeroBits=function(Hr){if(Hr===0)return 26;var Xr=Hr,Sn=0;return Xr&8191||(Sn+=13,Xr>>>=13),Xr&127||(Sn+=7,Xr>>>=7),Xr&15||(Sn+=4,Xr>>>=4),Xr&3||(Sn+=2,Xr>>>=2),Xr&1||Sn++,Sn},jr.prototype.bitLength=function(){var Hr=this.words[this.length-1],Xr=this._countBits(Hr);return(this.length-1)*26+Xr};function Cn(Tn){for(var Hr=new Array(Tn.bitLength()),Xr=0;Xr>>Rn&1}return Hr}jr.prototype.zeroBits=function(){if(this.isZero())return 0;for(var Hr=0,Xr=0;XrHr.length?this.clone().ior(Hr):Hr.clone().ior(this)},jr.prototype.uor=function(Hr){return this.length>Hr.length?this.clone().iuor(Hr):Hr.clone().iuor(this)},jr.prototype.iuand=function(Hr){var Xr;this.length>Hr.length?Xr=Hr:Xr=this;for(var Sn=0;SnHr.length?this.clone().iand(Hr):Hr.clone().iand(this)},jr.prototype.uand=function(Hr){return this.length>Hr.length?this.clone().iuand(Hr):Hr.clone().iuand(this)},jr.prototype.iuxor=function(Hr){var Xr,Sn;this.length>Hr.length?(Xr=this,Sn=Hr):(Xr=Hr,Sn=this);for(var Rn=0;RnHr.length?this.clone().ixor(Hr):Hr.clone().ixor(this)},jr.prototype.uxor=function(Hr){return this.length>Hr.length?this.clone().iuxor(Hr):Hr.clone().iuxor(this)},jr.prototype.inotn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Math.ceil(Hr/26)|0,Sn=Hr%26;this._expand(Xr),Sn>0&&Xr--;for(var Rn=0;Rn0&&(this.words[Rn]=~this.words[Rn]&67108863>>26-Sn),this._strip()},jr.prototype.notn=function(Hr){return this.clone().inotn(Hr)},jr.prototype.setn=function(Hr,Xr){Er(typeof Hr=="number"&&Hr>=0);var Sn=Hr/26|0,Rn=Hr%26;return this._expand(Sn+1),Xr?this.words[Sn]=this.words[Sn]|1<Hr.length?(Sn=this,Rn=Hr):(Sn=Hr,Rn=this);for(var Pn=0,On=0;On>>26;for(;Pn!==0&&On>>26;if(this.length=Sn.length,Pn!==0)this.words[this.length]=Pn,this.length++;else if(Sn!==this)for(;OnHr.length?this.clone().iadd(Hr):Hr.clone().iadd(this)},jr.prototype.isub=function(Hr){if(Hr.negative!==0){Hr.negative=0;var Xr=this.iadd(Hr);return Hr.negative=1,Xr._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Hr),this.negative=1,this._normSign();var Sn=this.cmp(Hr);if(Sn===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Rn,Pn;Sn>0?(Rn=this,Pn=Hr):(Rn=Hr,Pn=this);for(var On=0,Zn=0;Zn>26,this.words[Zn]=Xr&67108863;for(;On!==0&&Zn>26,this.words[Zn]=Xr&67108863;if(On===0&&Zn>>26,fo=Nn&67108863,vo=Math.min(wn,Hr.length-1),go=Math.max(0,wn-Tn.length+1);go<=vo;go++){var uo=wn-go|0;Rn=Tn.words[uo]|0,Pn=Hr.words[go]|0,On=Rn*Pn+fo,zn+=On/67108864|0,fo=On&67108863}Xr.words[wn]=fo|0,Nn=zn|0}return Nn!==0?Xr.words[wn]=Nn|0:Xr.length--,Xr._strip()}var An=function(Hr,Xr,Sn){var Rn=Hr.words,Pn=Xr.words,On=Sn.words,Zn=0,Nn,wn,zn,fo=Rn[0]|0,vo=fo&8191,go=fo>>>13,uo=Rn[1]|0,lo=uo&8191,Eo=uo>>>13,mo=Rn[2]|0,yo=mo&8191,_o=mo>>>13,Bo=Rn[3]|0,Lo=Bo&8191,Wo=Bo>>>13,na=Rn[4]|0,qo=na&8191,ga=na>>>13,wl=Rn[5]|0,No=wl&8191,Uo=wl>>>13,Nl=Rn[6]|0,Vo=Nl&8191,Fo=Nl>>>13,Ol=Rn[7]|0,$a=Ol&8191,Jo=Ol>>>13,Zl=Rn[8]|0,Cl=Zl&8191,ko=Zl>>>13,wo=Rn[9]|0,bo=wo&8191,Io=wo>>>13,Ho=Pn[0]|0,Do=Ho&8191,zo=Ho>>>13,nu=Pn[1]|0,Ll=nu&8191,_l=nu>>>13,bu=Pn[2]|0,xl=bu&8191,Tl=bu>>>13,du=Pn[3]|0,Bl=du&8191,Il=du>>>13,Eu=Pn[4]|0,Al=Eu&8191,Ml=Eu>>>13,Tu=Pn[5]|0,Fl=Tu&8191,Sl=Tu>>>13,_u=Pn[6]|0,So=_u&8191,Co=_u>>>13,Ao=Pn[7]|0,po=Ao&8191,Ro=Ao>>>13,Xo=Pn[8]|0,jo=Xo&8191,Ko=Xo>>>13,Wl=Pn[9]|0,$l=Wl&8191,El=Wl>>>13;Sn.negative=Hr.negative^Xr.negative,Sn.length=19,Nn=Math.imul(vo,Do),wn=Math.imul(vo,zo),wn=wn+Math.imul(go,Do)|0,zn=Math.imul(go,zo);var Cu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,Nn=Math.imul(lo,Do),wn=Math.imul(lo,zo),wn=wn+Math.imul(Eo,Do)|0,zn=Math.imul(Eo,zo),Nn=Nn+Math.imul(vo,Ll)|0,wn=wn+Math.imul(vo,_l)|0,wn=wn+Math.imul(go,Ll)|0,zn=zn+Math.imul(go,_l)|0;var iu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(iu>>>26)|0,iu&=67108863,Nn=Math.imul(yo,Do),wn=Math.imul(yo,zo),wn=wn+Math.imul(_o,Do)|0,zn=Math.imul(_o,zo),Nn=Nn+Math.imul(lo,Ll)|0,wn=wn+Math.imul(lo,_l)|0,wn=wn+Math.imul(Eo,Ll)|0,zn=zn+Math.imul(Eo,_l)|0,Nn=Nn+Math.imul(vo,xl)|0,wn=wn+Math.imul(vo,Tl)|0,wn=wn+Math.imul(go,xl)|0,zn=zn+Math.imul(go,Tl)|0;var pu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(pu>>>26)|0,pu&=67108863,Nn=Math.imul(Lo,Do),wn=Math.imul(Lo,zo),wn=wn+Math.imul(Wo,Do)|0,zn=Math.imul(Wo,zo),Nn=Nn+Math.imul(yo,Ll)|0,wn=wn+Math.imul(yo,_l)|0,wn=wn+Math.imul(_o,Ll)|0,zn=zn+Math.imul(_o,_l)|0,Nn=Nn+Math.imul(lo,xl)|0,wn=wn+Math.imul(lo,Tl)|0,wn=wn+Math.imul(Eo,xl)|0,zn=zn+Math.imul(Eo,Tl)|0,Nn=Nn+Math.imul(vo,Bl)|0,wn=wn+Math.imul(vo,Il)|0,wn=wn+Math.imul(go,Bl)|0,zn=zn+Math.imul(go,Il)|0;var yu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(yu>>>26)|0,yu&=67108863,Nn=Math.imul(qo,Do),wn=Math.imul(qo,zo),wn=wn+Math.imul(ga,Do)|0,zn=Math.imul(ga,zo),Nn=Nn+Math.imul(Lo,Ll)|0,wn=wn+Math.imul(Lo,_l)|0,wn=wn+Math.imul(Wo,Ll)|0,zn=zn+Math.imul(Wo,_l)|0,Nn=Nn+Math.imul(yo,xl)|0,wn=wn+Math.imul(yo,Tl)|0,wn=wn+Math.imul(_o,xl)|0,zn=zn+Math.imul(_o,Tl)|0,Nn=Nn+Math.imul(lo,Bl)|0,wn=wn+Math.imul(lo,Il)|0,wn=wn+Math.imul(Eo,Bl)|0,zn=zn+Math.imul(Eo,Il)|0,Nn=Nn+Math.imul(vo,Al)|0,wn=wn+Math.imul(vo,Ml)|0,wn=wn+Math.imul(go,Al)|0,zn=zn+Math.imul(go,Ml)|0;var hu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(hu>>>26)|0,hu&=67108863,Nn=Math.imul(No,Do),wn=Math.imul(No,zo),wn=wn+Math.imul(Uo,Do)|0,zn=Math.imul(Uo,zo),Nn=Nn+Math.imul(qo,Ll)|0,wn=wn+Math.imul(qo,_l)|0,wn=wn+Math.imul(ga,Ll)|0,zn=zn+Math.imul(ga,_l)|0,Nn=Nn+Math.imul(Lo,xl)|0,wn=wn+Math.imul(Lo,Tl)|0,wn=wn+Math.imul(Wo,xl)|0,zn=zn+Math.imul(Wo,Tl)|0,Nn=Nn+Math.imul(yo,Bl)|0,wn=wn+Math.imul(yo,Il)|0,wn=wn+Math.imul(_o,Bl)|0,zn=zn+Math.imul(_o,Il)|0,Nn=Nn+Math.imul(lo,Al)|0,wn=wn+Math.imul(lo,Ml)|0,wn=wn+Math.imul(Eo,Al)|0,zn=zn+Math.imul(Eo,Ml)|0,Nn=Nn+Math.imul(vo,Fl)|0,wn=wn+Math.imul(vo,Sl)|0,wn=wn+Math.imul(go,Fl)|0,zn=zn+Math.imul(go,Sl)|0;var mu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(mu>>>26)|0,mu&=67108863,Nn=Math.imul(Vo,Do),wn=Math.imul(Vo,zo),wn=wn+Math.imul(Fo,Do)|0,zn=Math.imul(Fo,zo),Nn=Nn+Math.imul(No,Ll)|0,wn=wn+Math.imul(No,_l)|0,wn=wn+Math.imul(Uo,Ll)|0,zn=zn+Math.imul(Uo,_l)|0,Nn=Nn+Math.imul(qo,xl)|0,wn=wn+Math.imul(qo,Tl)|0,wn=wn+Math.imul(ga,xl)|0,zn=zn+Math.imul(ga,Tl)|0,Nn=Nn+Math.imul(Lo,Bl)|0,wn=wn+Math.imul(Lo,Il)|0,wn=wn+Math.imul(Wo,Bl)|0,zn=zn+Math.imul(Wo,Il)|0,Nn=Nn+Math.imul(yo,Al)|0,wn=wn+Math.imul(yo,Ml)|0,wn=wn+Math.imul(_o,Al)|0,zn=zn+Math.imul(_o,Ml)|0,Nn=Nn+Math.imul(lo,Fl)|0,wn=wn+Math.imul(lo,Sl)|0,wn=wn+Math.imul(Eo,Fl)|0,zn=zn+Math.imul(Eo,Sl)|0,Nn=Nn+Math.imul(vo,So)|0,wn=wn+Math.imul(vo,Co)|0,wn=wn+Math.imul(go,So)|0,zn=zn+Math.imul(go,Co)|0;var vu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(vu>>>26)|0,vu&=67108863,Nn=Math.imul($a,Do),wn=Math.imul($a,zo),wn=wn+Math.imul(Jo,Do)|0,zn=Math.imul(Jo,zo),Nn=Nn+Math.imul(Vo,Ll)|0,wn=wn+Math.imul(Vo,_l)|0,wn=wn+Math.imul(Fo,Ll)|0,zn=zn+Math.imul(Fo,_l)|0,Nn=Nn+Math.imul(No,xl)|0,wn=wn+Math.imul(No,Tl)|0,wn=wn+Math.imul(Uo,xl)|0,zn=zn+Math.imul(Uo,Tl)|0,Nn=Nn+Math.imul(qo,Bl)|0,wn=wn+Math.imul(qo,Il)|0,wn=wn+Math.imul(ga,Bl)|0,zn=zn+Math.imul(ga,Il)|0,Nn=Nn+Math.imul(Lo,Al)|0,wn=wn+Math.imul(Lo,Ml)|0,wn=wn+Math.imul(Wo,Al)|0,zn=zn+Math.imul(Wo,Ml)|0,Nn=Nn+Math.imul(yo,Fl)|0,wn=wn+Math.imul(yo,Sl)|0,wn=wn+Math.imul(_o,Fl)|0,zn=zn+Math.imul(_o,Sl)|0,Nn=Nn+Math.imul(lo,So)|0,wn=wn+Math.imul(lo,Co)|0,wn=wn+Math.imul(Eo,So)|0,zn=zn+Math.imul(Eo,Co)|0,Nn=Nn+Math.imul(vo,po)|0,wn=wn+Math.imul(vo,Ro)|0,wn=wn+Math.imul(go,po)|0,zn=zn+Math.imul(go,Ro)|0;var fu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(fu>>>26)|0,fu&=67108863,Nn=Math.imul(Cl,Do),wn=Math.imul(Cl,zo),wn=wn+Math.imul(ko,Do)|0,zn=Math.imul(ko,zo),Nn=Nn+Math.imul($a,Ll)|0,wn=wn+Math.imul($a,_l)|0,wn=wn+Math.imul(Jo,Ll)|0,zn=zn+Math.imul(Jo,_l)|0,Nn=Nn+Math.imul(Vo,xl)|0,wn=wn+Math.imul(Vo,Tl)|0,wn=wn+Math.imul(Fo,xl)|0,zn=zn+Math.imul(Fo,Tl)|0,Nn=Nn+Math.imul(No,Bl)|0,wn=wn+Math.imul(No,Il)|0,wn=wn+Math.imul(Uo,Bl)|0,zn=zn+Math.imul(Uo,Il)|0,Nn=Nn+Math.imul(qo,Al)|0,wn=wn+Math.imul(qo,Ml)|0,wn=wn+Math.imul(ga,Al)|0,zn=zn+Math.imul(ga,Ml)|0,Nn=Nn+Math.imul(Lo,Fl)|0,wn=wn+Math.imul(Lo,Sl)|0,wn=wn+Math.imul(Wo,Fl)|0,zn=zn+Math.imul(Wo,Sl)|0,Nn=Nn+Math.imul(yo,So)|0,wn=wn+Math.imul(yo,Co)|0,wn=wn+Math.imul(_o,So)|0,zn=zn+Math.imul(_o,Co)|0,Nn=Nn+Math.imul(lo,po)|0,wn=wn+Math.imul(lo,Ro)|0,wn=wn+Math.imul(Eo,po)|0,zn=zn+Math.imul(Eo,Ro)|0,Nn=Nn+Math.imul(vo,jo)|0,wn=wn+Math.imul(vo,Ko)|0,wn=wn+Math.imul(go,jo)|0,zn=zn+Math.imul(go,Ko)|0;var gu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(gu>>>26)|0,gu&=67108863,Nn=Math.imul(bo,Do),wn=Math.imul(bo,zo),wn=wn+Math.imul(Io,Do)|0,zn=Math.imul(Io,zo),Nn=Nn+Math.imul(Cl,Ll)|0,wn=wn+Math.imul(Cl,_l)|0,wn=wn+Math.imul(ko,Ll)|0,zn=zn+Math.imul(ko,_l)|0,Nn=Nn+Math.imul($a,xl)|0,wn=wn+Math.imul($a,Tl)|0,wn=wn+Math.imul(Jo,xl)|0,zn=zn+Math.imul(Jo,Tl)|0,Nn=Nn+Math.imul(Vo,Bl)|0,wn=wn+Math.imul(Vo,Il)|0,wn=wn+Math.imul(Fo,Bl)|0,zn=zn+Math.imul(Fo,Il)|0,Nn=Nn+Math.imul(No,Al)|0,wn=wn+Math.imul(No,Ml)|0,wn=wn+Math.imul(Uo,Al)|0,zn=zn+Math.imul(Uo,Ml)|0,Nn=Nn+Math.imul(qo,Fl)|0,wn=wn+Math.imul(qo,Sl)|0,wn=wn+Math.imul(ga,Fl)|0,zn=zn+Math.imul(ga,Sl)|0,Nn=Nn+Math.imul(Lo,So)|0,wn=wn+Math.imul(Lo,Co)|0,wn=wn+Math.imul(Wo,So)|0,zn=zn+Math.imul(Wo,Co)|0,Nn=Nn+Math.imul(yo,po)|0,wn=wn+Math.imul(yo,Ro)|0,wn=wn+Math.imul(_o,po)|0,zn=zn+Math.imul(_o,Ro)|0,Nn=Nn+Math.imul(lo,jo)|0,wn=wn+Math.imul(lo,Ko)|0,wn=wn+Math.imul(Eo,jo)|0,zn=zn+Math.imul(Eo,Ko)|0,Nn=Nn+Math.imul(vo,$l)|0,wn=wn+Math.imul(vo,El)|0,wn=wn+Math.imul(go,$l)|0,zn=zn+Math.imul(go,El)|0;var ou=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(ou>>>26)|0,ou&=67108863,Nn=Math.imul(bo,Ll),wn=Math.imul(bo,_l),wn=wn+Math.imul(Io,Ll)|0,zn=Math.imul(Io,_l),Nn=Nn+Math.imul(Cl,xl)|0,wn=wn+Math.imul(Cl,Tl)|0,wn=wn+Math.imul(ko,xl)|0,zn=zn+Math.imul(ko,Tl)|0,Nn=Nn+Math.imul($a,Bl)|0,wn=wn+Math.imul($a,Il)|0,wn=wn+Math.imul(Jo,Bl)|0,zn=zn+Math.imul(Jo,Il)|0,Nn=Nn+Math.imul(Vo,Al)|0,wn=wn+Math.imul(Vo,Ml)|0,wn=wn+Math.imul(Fo,Al)|0,zn=zn+Math.imul(Fo,Ml)|0,Nn=Nn+Math.imul(No,Fl)|0,wn=wn+Math.imul(No,Sl)|0,wn=wn+Math.imul(Uo,Fl)|0,zn=zn+Math.imul(Uo,Sl)|0,Nn=Nn+Math.imul(qo,So)|0,wn=wn+Math.imul(qo,Co)|0,wn=wn+Math.imul(ga,So)|0,zn=zn+Math.imul(ga,Co)|0,Nn=Nn+Math.imul(Lo,po)|0,wn=wn+Math.imul(Lo,Ro)|0,wn=wn+Math.imul(Wo,po)|0,zn=zn+Math.imul(Wo,Ro)|0,Nn=Nn+Math.imul(yo,jo)|0,wn=wn+Math.imul(yo,Ko)|0,wn=wn+Math.imul(_o,jo)|0,zn=zn+Math.imul(_o,Ko)|0,Nn=Nn+Math.imul(lo,$l)|0,wn=wn+Math.imul(lo,El)|0,wn=wn+Math.imul(Eo,$l)|0,zn=zn+Math.imul(Eo,El)|0;var su=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(su>>>26)|0,su&=67108863,Nn=Math.imul(bo,xl),wn=Math.imul(bo,Tl),wn=wn+Math.imul(Io,xl)|0,zn=Math.imul(Io,Tl),Nn=Nn+Math.imul(Cl,Bl)|0,wn=wn+Math.imul(Cl,Il)|0,wn=wn+Math.imul(ko,Bl)|0,zn=zn+Math.imul(ko,Il)|0,Nn=Nn+Math.imul($a,Al)|0,wn=wn+Math.imul($a,Ml)|0,wn=wn+Math.imul(Jo,Al)|0,zn=zn+Math.imul(Jo,Ml)|0,Nn=Nn+Math.imul(Vo,Fl)|0,wn=wn+Math.imul(Vo,Sl)|0,wn=wn+Math.imul(Fo,Fl)|0,zn=zn+Math.imul(Fo,Sl)|0,Nn=Nn+Math.imul(No,So)|0,wn=wn+Math.imul(No,Co)|0,wn=wn+Math.imul(Uo,So)|0,zn=zn+Math.imul(Uo,Co)|0,Nn=Nn+Math.imul(qo,po)|0,wn=wn+Math.imul(qo,Ro)|0,wn=wn+Math.imul(ga,po)|0,zn=zn+Math.imul(ga,Ro)|0,Nn=Nn+Math.imul(Lo,jo)|0,wn=wn+Math.imul(Lo,Ko)|0,wn=wn+Math.imul(Wo,jo)|0,zn=zn+Math.imul(Wo,Ko)|0,Nn=Nn+Math.imul(yo,$l)|0,wn=wn+Math.imul(yo,El)|0,wn=wn+Math.imul(_o,$l)|0,zn=zn+Math.imul(_o,El)|0;var tu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(tu>>>26)|0,tu&=67108863,Nn=Math.imul(bo,Bl),wn=Math.imul(bo,Il),wn=wn+Math.imul(Io,Bl)|0,zn=Math.imul(Io,Il),Nn=Nn+Math.imul(Cl,Al)|0,wn=wn+Math.imul(Cl,Ml)|0,wn=wn+Math.imul(ko,Al)|0,zn=zn+Math.imul(ko,Ml)|0,Nn=Nn+Math.imul($a,Fl)|0,wn=wn+Math.imul($a,Sl)|0,wn=wn+Math.imul(Jo,Fl)|0,zn=zn+Math.imul(Jo,Sl)|0,Nn=Nn+Math.imul(Vo,So)|0,wn=wn+Math.imul(Vo,Co)|0,wn=wn+Math.imul(Fo,So)|0,zn=zn+Math.imul(Fo,Co)|0,Nn=Nn+Math.imul(No,po)|0,wn=wn+Math.imul(No,Ro)|0,wn=wn+Math.imul(Uo,po)|0,zn=zn+Math.imul(Uo,Ro)|0,Nn=Nn+Math.imul(qo,jo)|0,wn=wn+Math.imul(qo,Ko)|0,wn=wn+Math.imul(ga,jo)|0,zn=zn+Math.imul(ga,Ko)|0,Nn=Nn+Math.imul(Lo,$l)|0,wn=wn+Math.imul(Lo,El)|0,wn=wn+Math.imul(Wo,$l)|0,zn=zn+Math.imul(Wo,El)|0;var zl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(zl>>>26)|0,zl&=67108863,Nn=Math.imul(bo,Al),wn=Math.imul(bo,Ml),wn=wn+Math.imul(Io,Al)|0,zn=Math.imul(Io,Ml),Nn=Nn+Math.imul(Cl,Fl)|0,wn=wn+Math.imul(Cl,Sl)|0,wn=wn+Math.imul(ko,Fl)|0,zn=zn+Math.imul(ko,Sl)|0,Nn=Nn+Math.imul($a,So)|0,wn=wn+Math.imul($a,Co)|0,wn=wn+Math.imul(Jo,So)|0,zn=zn+Math.imul(Jo,Co)|0,Nn=Nn+Math.imul(Vo,po)|0,wn=wn+Math.imul(Vo,Ro)|0,wn=wn+Math.imul(Fo,po)|0,zn=zn+Math.imul(Fo,Ro)|0,Nn=Nn+Math.imul(No,jo)|0,wn=wn+Math.imul(No,Ko)|0,wn=wn+Math.imul(Uo,jo)|0,zn=zn+Math.imul(Uo,Ko)|0,Nn=Nn+Math.imul(qo,$l)|0,wn=wn+Math.imul(qo,El)|0,wn=wn+Math.imul(ga,$l)|0,zn=zn+Math.imul(ga,El)|0;var Gl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Gl>>>26)|0,Gl&=67108863,Nn=Math.imul(bo,Fl),wn=Math.imul(bo,Sl),wn=wn+Math.imul(Io,Fl)|0,zn=Math.imul(Io,Sl),Nn=Nn+Math.imul(Cl,So)|0,wn=wn+Math.imul(Cl,Co)|0,wn=wn+Math.imul(ko,So)|0,zn=zn+Math.imul(ko,Co)|0,Nn=Nn+Math.imul($a,po)|0,wn=wn+Math.imul($a,Ro)|0,wn=wn+Math.imul(Jo,po)|0,zn=zn+Math.imul(Jo,Ro)|0,Nn=Nn+Math.imul(Vo,jo)|0,wn=wn+Math.imul(Vo,Ko)|0,wn=wn+Math.imul(Fo,jo)|0,zn=zn+Math.imul(Fo,Ko)|0,Nn=Nn+Math.imul(No,$l)|0,wn=wn+Math.imul(No,El)|0,wn=wn+Math.imul(Uo,$l)|0,zn=zn+Math.imul(Uo,El)|0;var Jl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Jl>>>26)|0,Jl&=67108863,Nn=Math.imul(bo,So),wn=Math.imul(bo,Co),wn=wn+Math.imul(Io,So)|0,zn=Math.imul(Io,Co),Nn=Nn+Math.imul(Cl,po)|0,wn=wn+Math.imul(Cl,Ro)|0,wn=wn+Math.imul(ko,po)|0,zn=zn+Math.imul(ko,Ro)|0,Nn=Nn+Math.imul($a,jo)|0,wn=wn+Math.imul($a,Ko)|0,wn=wn+Math.imul(Jo,jo)|0,zn=zn+Math.imul(Jo,Ko)|0,Nn=Nn+Math.imul(Vo,$l)|0,wn=wn+Math.imul(Vo,El)|0,wn=wn+Math.imul(Fo,$l)|0,zn=zn+Math.imul(Fo,El)|0;var Pl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Pl>>>26)|0,Pl&=67108863,Nn=Math.imul(bo,po),wn=Math.imul(bo,Ro),wn=wn+Math.imul(Io,po)|0,zn=Math.imul(Io,Ro),Nn=Nn+Math.imul(Cl,jo)|0,wn=wn+Math.imul(Cl,Ko)|0,wn=wn+Math.imul(ko,jo)|0,zn=zn+Math.imul(ko,Ko)|0,Nn=Nn+Math.imul($a,$l)|0,wn=wn+Math.imul($a,El)|0,wn=wn+Math.imul(Jo,$l)|0,zn=zn+Math.imul(Jo,El)|0;var Ul=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Ul>>>26)|0,Ul&=67108863,Nn=Math.imul(bo,jo),wn=Math.imul(bo,Ko),wn=wn+Math.imul(Io,jo)|0,zn=Math.imul(Io,Ko),Nn=Nn+Math.imul(Cl,$l)|0,wn=wn+Math.imul(Cl,El)|0,wn=wn+Math.imul(ko,$l)|0,zn=zn+Math.imul(ko,El)|0;var Yl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Yl>>>26)|0,Yl&=67108863,Nn=Math.imul(bo,$l),wn=Math.imul(bo,El),wn=wn+Math.imul(Io,$l)|0,zn=Math.imul(Io,El);var Vl=(Zn+Nn|0)+((wn&8191)<<13)|0;return Zn=(zn+(wn>>>13)|0)+(Vl>>>26)|0,Vl&=67108863,On[0]=Cu,On[1]=iu,On[2]=pu,On[3]=yu,On[4]=hu,On[5]=mu,On[6]=vu,On[7]=fu,On[8]=gu,On[9]=ou,On[10]=su,On[11]=tu,On[12]=zl,On[13]=Gl,On[14]=Jl,On[15]=Pl,On[16]=Ul,On[17]=Yl,On[18]=Vl,Zn!==0&&(On[19]=Zn,Sn.length++),Sn};Math.imul||(An=In);function jn(Tn,Hr,Xr){Xr.negative=Hr.negative^Tn.negative,Xr.length=Tn.length+Hr.length;for(var Sn=0,Rn=0,Pn=0;Pn>>26)|0,Rn+=On>>>26,On&=67108863}Xr.words[Pn]=Zn,Sn=On,On=Rn}return Sn!==0?Xr.words[Pn]=Sn:Xr.length--,Xr._strip()}function eo(Tn,Hr,Xr){return jn(Tn,Hr,Xr)}jr.prototype.mulTo=function(Hr,Xr){var Sn,Rn=this.length+Hr.length;return this.length===10&&Hr.length===10?Sn=An(this,Hr,Xr):Rn<63?Sn=In(this,Hr,Xr):Rn<1024?Sn=jn(this,Hr,Xr):Sn=eo(this,Hr,Xr),Sn},jr.prototype.mul=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),this.mulTo(Hr,Xr)},jr.prototype.mulf=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),eo(this,Hr,Xr)},jr.prototype.imul=function(Hr){return this.clone().mulTo(Hr,this)},jr.prototype.imuln=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(typeof Hr=="number"),Er(Hr<67108864);for(var Sn=0,Rn=0;Rn>=26,Sn+=Pn/67108864|0,Sn+=On>>>26,this.words[Rn]=On&67108863}return Sn!==0&&(this.words[Rn]=Sn,this.length++),Xr?this.ineg():this},jr.prototype.muln=function(Hr){return this.clone().imuln(Hr)},jr.prototype.sqr=function(){return this.mul(this)},jr.prototype.isqr=function(){return this.imul(this.clone())},jr.prototype.pow=function(Hr){var Xr=Cn(Hr);if(Xr.length===0)return new jr(1);for(var Sn=this,Rn=0;Rn=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=67108863>>>26-Xr<<26-Xr,Pn;if(Xr!==0){var On=0;for(Pn=0;Pn>>26-Xr}On&&(this.words[Pn]=On,this.length++)}if(Sn!==0){for(Pn=this.length-1;Pn>=0;Pn--)this.words[Pn+Sn]=this.words[Pn];for(Pn=0;Pn=0);var Rn;Xr?Rn=(Xr-Xr%26)/26:Rn=0;var Pn=Hr%26,On=Math.min((Hr-Pn)/26,this.length),Zn=67108863^67108863>>>Pn<On)for(this.length-=On,wn=0;wn=0&&(zn!==0||wn>=Rn);wn--){var fo=this.words[wn]|0;this.words[wn]=zn<<26-Pn|fo>>>Pn,zn=fo&Zn}return Nn&&zn!==0&&(Nn.words[Nn.length++]=zn),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},jr.prototype.ishrn=function(Hr,Xr,Sn){return Er(this.negative===0),this.iushrn(Hr,Xr,Sn)},jr.prototype.shln=function(Hr){return this.clone().ishln(Hr)},jr.prototype.ushln=function(Hr){return this.clone().iushln(Hr)},jr.prototype.shrn=function(Hr){return this.clone().ishrn(Hr)},jr.prototype.ushrn=function(Hr){return this.clone().iushrn(Hr)},jr.prototype.testn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<=0);var Xr=Hr%26,Sn=(Hr-Xr)/26;if(Er(this.negative===0,"imaskn works only with positive numbers"),this.length<=Sn)return this;if(Xr!==0&&Sn++,this.length=Math.min(Sn,this.length),Xr!==0){var Rn=67108863^67108863>>>Xr<=67108864;Xr++)this.words[Xr]-=67108864,Xr===this.length-1?this.words[Xr+1]=1:this.words[Xr+1]++;return this.length=Math.max(this.length,Xr+1),this},jr.prototype.isubn=function(Hr){if(Er(typeof Hr=="number"),Er(Hr<67108864),Hr<0)return this.iaddn(-Hr);if(this.negative!==0)return this.negative=0,this.iaddn(Hr),this.negative=1,this;if(this.words[0]-=Hr,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Xr=0;Xr>26)-(Nn/67108864|0),this.words[Pn+Sn]=On&67108863}for(;Pn>26,this.words[Pn+Sn]=On&67108863;if(Zn===0)return this._strip();for(Er(Zn===-1),Zn=0,Pn=0;Pn>26,this.words[Pn]=On&67108863;return this.negative=1,this._strip()},jr.prototype._wordDiv=function(Hr,Xr){var Sn=this.length-Hr.length,Rn=this.clone(),Pn=Hr,On=Pn.words[Pn.length-1]|0,Zn=this._countBits(On);Sn=26-Zn,Sn!==0&&(Pn=Pn.ushln(Sn),Rn.iushln(Sn),On=Pn.words[Pn.length-1]|0);var Nn=Rn.length-Pn.length,wn;if(Xr!=="mod"){wn=new jr(null),wn.length=Nn+1,wn.words=new Array(wn.length);for(var zn=0;zn=0;vo--){var go=(Rn.words[Pn.length+vo]|0)*67108864+(Rn.words[Pn.length+vo-1]|0);for(go=Math.min(go/On|0,67108863),Rn._ishlnsubmul(Pn,go,vo);Rn.negative!==0;)go--,Rn.negative=0,Rn._ishlnsubmul(Pn,1,vo),Rn.isZero()||(Rn.negative^=1);wn&&(wn.words[vo]=go)}return wn&&wn._strip(),Rn._strip(),Xr!=="div"&&Sn!==0&&Rn.iushrn(Sn),{div:wn||null,mod:Rn}},jr.prototype.divmod=function(Hr,Xr,Sn){if(Er(!Hr.isZero()),this.isZero())return{div:new jr(0),mod:new jr(0)};var Rn,Pn,On;return this.negative!==0&&Hr.negative===0?(On=this.neg().divmod(Hr,Xr),Xr!=="mod"&&(Rn=On.div.neg()),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.iadd(Hr)),{div:Rn,mod:Pn}):this.negative===0&&Hr.negative!==0?(On=this.divmod(Hr.neg(),Xr),Xr!=="mod"&&(Rn=On.div.neg()),{div:Rn,mod:On.mod}):this.negative&Hr.negative?(On=this.neg().divmod(Hr.neg(),Xr),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.isub(Hr)),{div:On.div,mod:Pn}):Hr.length>this.length||this.cmp(Hr)<0?{div:new jr(0),mod:this}:Hr.length===1?Xr==="div"?{div:this.divn(Hr.words[0]),mod:null}:Xr==="mod"?{div:null,mod:new jr(this.modrn(Hr.words[0]))}:{div:this.divn(Hr.words[0]),mod:new jr(this.modrn(Hr.words[0]))}:this._wordDiv(Hr,Xr)},jr.prototype.div=function(Hr){return this.divmod(Hr,"div",!1).div},jr.prototype.mod=function(Hr){return this.divmod(Hr,"mod",!1).mod},jr.prototype.umod=function(Hr){return this.divmod(Hr,"mod",!0).mod},jr.prototype.divRound=function(Hr){var Xr=this.divmod(Hr);if(Xr.mod.isZero())return Xr.div;var Sn=Xr.div.negative!==0?Xr.mod.isub(Hr):Xr.mod,Rn=Hr.ushrn(1),Pn=Hr.andln(1),On=Sn.cmp(Rn);return On<0||Pn===1&&On===0?Xr.div:Xr.div.negative!==0?Xr.div.isubn(1):Xr.div.iaddn(1)},jr.prototype.modrn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=(1<<26)%Hr,Rn=0,Pn=this.length-1;Pn>=0;Pn--)Rn=(Sn*Rn+(this.words[Pn]|0))%Hr;return Xr?-Rn:Rn},jr.prototype.modn=function(Hr){return this.modrn(Hr)},jr.prototype.idivn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=0,Rn=this.length-1;Rn>=0;Rn--){var Pn=(this.words[Rn]|0)+Sn*67108864;this.words[Rn]=Pn/Hr|0,Sn=Pn%Hr}return this._strip(),Xr?this.ineg():this},jr.prototype.divn=function(Hr){return this.clone().idivn(Hr)},jr.prototype.egcd=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=new jr(0),Zn=new jr(1),Nn=0;Xr.isEven()&&Sn.isEven();)Xr.iushrn(1),Sn.iushrn(1),++Nn;for(var wn=Sn.clone(),zn=Xr.clone();!Xr.isZero();){for(var fo=0,vo=1;!(Xr.words[0]&vo)&&fo<26;++fo,vo<<=1);if(fo>0)for(Xr.iushrn(fo);fo-- >0;)(Rn.isOdd()||Pn.isOdd())&&(Rn.iadd(wn),Pn.isub(zn)),Rn.iushrn(1),Pn.iushrn(1);for(var go=0,uo=1;!(Sn.words[0]&uo)&&go<26;++go,uo<<=1);if(go>0)for(Sn.iushrn(go);go-- >0;)(On.isOdd()||Zn.isOdd())&&(On.iadd(wn),Zn.isub(zn)),On.iushrn(1),Zn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(On),Pn.isub(Zn)):(Sn.isub(Xr),On.isub(Rn),Zn.isub(Pn))}return{a:On,b:Zn,gcd:Sn.iushln(Nn)}},jr.prototype._invmp=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=Sn.clone();Xr.cmpn(1)>0&&Sn.cmpn(1)>0;){for(var Zn=0,Nn=1;!(Xr.words[0]&Nn)&&Zn<26;++Zn,Nn<<=1);if(Zn>0)for(Xr.iushrn(Zn);Zn-- >0;)Rn.isOdd()&&Rn.iadd(On),Rn.iushrn(1);for(var wn=0,zn=1;!(Sn.words[0]&zn)&&wn<26;++wn,zn<<=1);if(wn>0)for(Sn.iushrn(wn);wn-- >0;)Pn.isOdd()&&Pn.iadd(On),Pn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(Pn)):(Sn.isub(Xr),Pn.isub(Rn))}var fo;return Xr.cmpn(1)===0?fo=Rn:fo=Pn,fo.cmpn(0)<0&&fo.iadd(Hr),fo},jr.prototype.gcd=function(Hr){if(this.isZero())return Hr.abs();if(Hr.isZero())return this.abs();var Xr=this.clone(),Sn=Hr.clone();Xr.negative=0,Sn.negative=0;for(var Rn=0;Xr.isEven()&&Sn.isEven();Rn++)Xr.iushrn(1),Sn.iushrn(1);do{for(;Xr.isEven();)Xr.iushrn(1);for(;Sn.isEven();)Sn.iushrn(1);var Pn=Xr.cmp(Sn);if(Pn<0){var On=Xr;Xr=Sn,Sn=On}else if(Pn===0||Sn.cmpn(1)===0)break;Xr.isub(Sn)}while(!0);return Sn.iushln(Rn)},jr.prototype.invm=function(Hr){return this.egcd(Hr).a.umod(Hr)},jr.prototype.isEven=function(){return(this.words[0]&1)===0},jr.prototype.isOdd=function(){return(this.words[0]&1)===1},jr.prototype.andln=function(Hr){return this.words[0]&Hr},jr.prototype.bincn=function(Hr){Er(typeof Hr=="number");var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<>>26,Zn&=67108863,this.words[On]=Zn}return Pn!==0&&(this.words[On]=Pn,this.length++),this},jr.prototype.isZero=function(){return this.length===1&&this.words[0]===0},jr.prototype.cmpn=function(Hr){var Xr=Hr<0;if(this.negative!==0&&!Xr)return-1;if(this.negative===0&&Xr)return 1;this._strip();var Sn;if(this.length>1)Sn=1;else{Xr&&(Hr=-Hr),Er(Hr<=67108863,"Number is too big");var Rn=this.words[0]|0;Sn=Rn===Hr?0:RnHr.length)return 1;if(this.length=0;Sn--){var Rn=this.words[Sn]|0,Pn=Hr.words[Sn]|0;if(Rn!==Pn){RnPn&&(Xr=1);break}}return Xr},jr.prototype.gtn=function(Hr){return this.cmpn(Hr)===1},jr.prototype.gt=function(Hr){return this.cmp(Hr)===1},jr.prototype.gten=function(Hr){return this.cmpn(Hr)>=0},jr.prototype.gte=function(Hr){return this.cmp(Hr)>=0},jr.prototype.ltn=function(Hr){return this.cmpn(Hr)===-1},jr.prototype.lt=function(Hr){return this.cmp(Hr)===-1},jr.prototype.lten=function(Hr){return this.cmpn(Hr)<=0},jr.prototype.lte=function(Hr){return this.cmp(Hr)<=0},jr.prototype.eqn=function(Hr){return this.cmpn(Hr)===0},jr.prototype.eq=function(Hr){return this.cmp(Hr)===0},jr.red=function(Hr){return new so(Hr)},jr.prototype.toRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),Er(this.negative===0,"red works only with positives"),Hr.convertTo(this)._forceRed(Hr)},jr.prototype.fromRed=function(){return Er(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},jr.prototype._forceRed=function(Hr){return this.red=Hr,this},jr.prototype.forceRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),this._forceRed(Hr)},jr.prototype.redAdd=function(Hr){return Er(this.red,"redAdd works only with red numbers"),this.red.add(this,Hr)},jr.prototype.redIAdd=function(Hr){return Er(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Hr)},jr.prototype.redSub=function(Hr){return Er(this.red,"redSub works only with red numbers"),this.red.sub(this,Hr)},jr.prototype.redISub=function(Hr){return Er(this.red,"redISub works only with red numbers"),this.red.isub(this,Hr)},jr.prototype.redShl=function(Hr){return Er(this.red,"redShl works only with red numbers"),this.red.shl(this,Hr)},jr.prototype.redMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.mul(this,Hr)},jr.prototype.redIMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.imul(this,Hr)},jr.prototype.redSqr=function(){return Er(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},jr.prototype.redISqr=function(){return Er(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},jr.prototype.redSqrt=function(){return Er(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},jr.prototype.redInvm=function(){return Er(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},jr.prototype.redNeg=function(){return Er(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},jr.prototype.redPow=function(Hr){return Er(this.red&&!Hr.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Hr)};var ro={k256:null,p224:null,p192:null,p25519:null};function to(Tn,Hr){this.name=Tn,this.p=new jr(Hr,16),this.n=this.p.bitLength(),this.k=new jr(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}to.prototype._tmp=function(){var Hr=new jr(null);return Hr.words=new Array(Math.ceil(this.n/13)),Hr},to.prototype.ireduce=function(Hr){var Xr=Hr,Sn;do this.split(Xr,this.tmp),Xr=this.imulK(Xr),Xr=Xr.iadd(this.tmp),Sn=Xr.bitLength();while(Sn>this.n);var Rn=Sn0?Xr.isub(this.p):Xr.strip!==void 0?Xr.strip():Xr._strip(),Xr},to.prototype.split=function(Hr,Xr){Hr.iushrn(this.n,0,Xr)},to.prototype.imulK=function(Hr){return Hr.imul(this.k)};function _i(){to.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}kr(_i,to),_i.prototype.split=function(Hr,Xr){for(var Sn=4194303,Rn=Math.min(Hr.length,9),Pn=0;Pn>>22,On=Zn}On>>>=22,Hr.words[Pn-10]=On,On===0&&Hr.length>10?Hr.length-=10:Hr.length-=9},_i.prototype.imulK=function(Hr){Hr.words[Hr.length]=0,Hr.words[Hr.length+1]=0,Hr.length+=2;for(var Xr=0,Sn=0;Sn>>=26,Hr.words[Sn]=Pn,Xr=Rn}return Xr!==0&&(Hr.words[Hr.length++]=Xr),Hr},jr._prime=function(Hr){if(ro[Hr])return ro[Hr];var Xr;if(Hr==="k256")Xr=new _i;else if(Hr==="p224")Xr=new oo;else if(Hr==="p192")Xr=new io;else if(Hr==="p25519")Xr=new co;else throw new Error("Unknown prime "+Hr);return ro[Hr]=Xr,Xr};function so(Tn){if(typeof Tn=="string"){var Hr=jr._prime(Tn);this.m=Hr.p,this.prime=Hr}else Er(Tn.gtn(1),"modulus must be greater than 1"),this.m=Tn,this.prime=null}so.prototype._verify1=function(Hr){Er(Hr.negative===0,"red works only with positives"),Er(Hr.red,"red works only with red numbers")},so.prototype._verify2=function(Hr,Xr){Er((Hr.negative|Xr.negative)===0,"red works only with positives"),Er(Hr.red&&Hr.red===Xr.red,"red works only with red numbers")},so.prototype.imod=function(Hr){return this.prime?this.prime.ireduce(Hr)._forceRed(this):(Vr(Hr,Hr.umod(this.m)._forceRed(this)),Hr)},so.prototype.neg=function(Hr){return Hr.isZero()?Hr.clone():this.m.sub(Hr)._forceRed(this)},so.prototype.add=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.add(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn._forceRed(this)},so.prototype.iadd=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.iadd(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn},so.prototype.sub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.sub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn._forceRed(this)},so.prototype.isub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.isub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn},so.prototype.shl=function(Hr,Xr){return this._verify1(Hr),this.imod(Hr.ushln(Xr))},so.prototype.imul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.imul(Xr))},so.prototype.mul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.mul(Xr))},so.prototype.isqr=function(Hr){return this.imul(Hr,Hr.clone())},so.prototype.sqr=function(Hr){return this.mul(Hr,Hr)},so.prototype.sqrt=function(Hr){if(Hr.isZero())return Hr.clone();var Xr=this.m.andln(3);if(Er(Xr%2===1),Xr===3){var Sn=this.m.add(new jr(1)).iushrn(2);return this.pow(Hr,Sn)}for(var Rn=this.m.subn(1),Pn=0;!Rn.isZero()&&Rn.andln(1)===0;)Pn++,Rn.iushrn(1);Er(!Rn.isZero());var On=new jr(1).toRed(this),Zn=On.redNeg(),Nn=this.m.subn(1).iushrn(1),wn=this.m.bitLength();for(wn=new jr(2*wn*wn).toRed(this);this.pow(wn,Nn).cmp(Zn)!==0;)wn.redIAdd(Zn);for(var zn=this.pow(wn,Rn),fo=this.pow(Hr,Rn.addn(1).iushrn(1)),vo=this.pow(Hr,Rn),go=Pn;vo.cmp(On)!==0;){for(var uo=vo,lo=0;uo.cmp(On)!==0;lo++)uo=uo.redSqr();Er(lo=0;Pn--){for(var zn=Xr.words[Pn],fo=wn-1;fo>=0;fo--){var vo=zn>>fo&1;if(On!==Rn[0]&&(On=this.sqr(On)),vo===0&&Zn===0){Nn=0;continue}Zn<<=1,Zn|=vo,Nn++,!(Nn!==Sn&&(Pn!==0||fo!==0))&&(On=this.mul(On,Rn[Zn]),Nn=0,Zn=0)}wn=26}return On},so.prototype.convertTo=function(Hr){var Xr=Hr.umod(this.m);return Xr===Hr?Xr.clone():Xr},so.prototype.convertFrom=function(Hr){var Xr=Hr.clone();return Xr.red=null,Xr},jr.mont=function(Hr){return new no(Hr)};function no(Tn){so.call(this,Tn),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new jr(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}kr(no,so),no.prototype.convertTo=function(Hr){return this.imod(Hr.ushln(this.shift))},no.prototype.convertFrom=function(Hr){var Xr=this.imod(Hr.mul(this.rinv));return Xr.red=null,Xr},no.prototype.imul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return Hr.words[0]=0,Hr.length=1,Hr;var Sn=Hr.imul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.mul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return new jr(0)._forceRed(this);var Sn=Hr.mul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.invm=function(Hr){var Xr=this.imod(Hr._invmp(this.m).mul(this.r2));return Xr._forceRed(this)}})(fr,commonjsGlobal)}(bn$5)),bn$5.exports}var browserifyRsa,hasRequiredBrowserifyRsa;function requireBrowserifyRsa(){if(hasRequiredBrowserifyRsa)return browserifyRsa;hasRequiredBrowserifyRsa=1;var fr=requireBn$1(),br=requireBrowser$b(),wr=safeBufferExports.Buffer;function Er(Br){var Wr=Br.modulus.byteLength(),qr;do qr=new fr(br(Wr));while(qr.cmp(Br.modulus)>=0||!qr.umod(Br.prime1)||!qr.umod(Br.prime2));return qr}function kr(Br){var Wr=Er(Br),qr=Wr.toRed(fr.mont(Br.modulus)).redPow(new fr(Br.publicExponent)).fromRed();return{blinder:qr,unblinder:Wr.invm(Br.modulus)}}function jr(Br,Wr){var qr=kr(Wr),Gr=Wr.modulus.byteLength(),Vr=new fr(Br).mul(qr.blinder).umod(Wr.modulus),Zr=Vr.toRed(fr.mont(Wr.prime1)),Jr=Vr.toRed(fr.mont(Wr.prime2)),Qr=Wr.coefficient,_n=Wr.prime1,En=Wr.prime2,Cn=Zr.redPow(Wr.exponent1).fromRed(),In=Jr.redPow(Wr.exponent2).fromRed(),An=Cn.isub(In).imul(Qr).umod(_n).imul(En);return In.iadd(An).imul(qr.unblinder).umod(Wr.modulus).toArrayLike(wr,"be",Gr)}return jr.getr=Er,browserifyRsa=jr,browserifyRsa}var elliptic={};const name="elliptic",version$e="6.6.1",description="EC cryptography",main="lib/elliptic.js",files=["lib"],scripts={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository={type:"git",url:"git@github.com:indutny/elliptic"},keywords=["EC","Elliptic","curve","Cryptography"],author="Fedor Indutny ",license="MIT",bugs={url:"https://github.com/indutny/elliptic/issues"},homepage="https://github.com/indutny/elliptic",devDependencies={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies$1={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0$8={name,version:version$e,description,main,files,scripts,repository,keywords,author,license,bugs,homepage,devDependencies,dependencies:dependencies$1};var utils$5={},utils$4={},hasRequiredUtils$3;function requireUtils$3(){return hasRequiredUtils$3||(hasRequiredUtils$3=1,function(fr){var br=fr;function wr(jr,Br){if(Array.isArray(jr))return jr.slice();if(!jr)return[];var Wr=[];if(typeof jr!="string"){for(var qr=0;qr>8,Zr=Gr&255;Vr?Wr.push(Vr,Zr):Wr.push(Zr)}return Wr}br.toArray=wr;function Er(jr){return jr.length===1?"0"+jr:jr}br.zero2=Er;function kr(jr){for(var Br="",Wr=0;Wr(En>>1)-1?In=(En>>1)-An:In=An,Cn.isubn(In)):In=0,Qr[_n]=In,Cn.iushrn(1)}return Qr}br.getNAF=jr;function Br(Vr,Zr){var Jr=[[],[]];Vr=Vr.clone(),Zr=Zr.clone();for(var Qr=0,_n=0,En;Vr.cmpn(-Qr)>0||Zr.cmpn(-_n)>0;){var Cn=Vr.andln(3)+Qr&3,In=Zr.andln(3)+_n&3;Cn===3&&(Cn=-1),In===3&&(In=-1);var An;Cn&1?(En=Vr.andln(7)+Qr&7,(En===3||En===5)&&In===2?An=-Cn:An=Cn):An=0,Jr[0].push(An);var jn;In&1?(En=Zr.andln(7)+_n&7,(En===3||En===5)&&Cn===2?jn=-In:jn=In):jn=0,Jr[1].push(jn),2*Qr===An+1&&(Qr=1-Qr),2*_n===jn+1&&(_n=1-_n),Vr.iushrn(1),Zr.iushrn(1)}return Jr}br.getJSF=Br;function Wr(Vr,Zr,Jr){var Qr="_"+Zr;Vr.prototype[Zr]=function(){return this[Qr]!==void 0?this[Qr]:this[Qr]=Jr.call(this)}}br.cachedProperty=Wr;function qr(Vr){return typeof Vr=="string"?br.toArray(Vr,"hex"):Vr}br.parseBytes=qr;function Gr(Vr){return new wr(Vr,"hex","le")}br.intFromLE=Gr}(utils$5)),utils$5}var curve={},base$6,hasRequiredBase$1;function requireBase$1(){if(hasRequiredBase$1)return base$6;hasRequiredBase$1=1;var fr=requireBn$2(),br=requireUtils$2(),wr=br.getNAF,Er=br.getJSF,kr=br.assert;function jr(Wr,qr){this.type=Wr,this.p=new fr(qr.p,16),this.red=qr.prime?fr.red(qr.prime):fr.mont(this.p),this.zero=new fr(0).toRed(this.red),this.one=new fr(1).toRed(this.red),this.two=new fr(2).toRed(this.red),this.n=qr.n&&new fr(qr.n,16),this.g=qr.g&&this.pointFromJSON(qr.g,qr.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var Gr=this.n&&this.p.div(this.n);!Gr||Gr.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}base$6=jr,jr.prototype.point=function(){throw new Error("Not implemented")},jr.prototype.validate=function(){throw new Error("Not implemented")},jr.prototype._fixedNafMul=function(qr,Gr){kr(qr.precomputed);var Vr=qr._getDoubles(),Zr=wr(Gr,1,this._bitLength),Jr=(1<=_n;Cn--)En=(En<<1)+Zr[Cn];Qr.push(En)}for(var In=this.jpoint(null,null,null),An=this.jpoint(null,null,null),jn=Jr;jn>0;jn--){for(_n=0;_n=0;En--){for(var Cn=0;En>=0&&Qr[En]===0;En--)Cn++;if(En>=0&&Cn++,_n=_n.dblp(Cn),En<0)break;var In=Qr[En];kr(In!==0),qr.type==="affine"?In>0?_n=_n.mixedAdd(Jr[In-1>>1]):_n=_n.mixedAdd(Jr[-In-1>>1].neg()):In>0?_n=_n.add(Jr[In-1>>1]):_n=_n.add(Jr[-In-1>>1].neg())}return qr.type==="affine"?_n.toP():_n},jr.prototype._wnafMulAdd=function(qr,Gr,Vr,Zr,Jr){var Qr=this._wnafT1,_n=this._wnafT2,En=this._wnafT3,Cn=0,In,An,jn;for(In=0;In=1;In-=2){var ro=In-1,to=In;if(Qr[ro]!==1||Qr[to]!==1){En[ro]=wr(Vr[ro],Qr[ro],this._bitLength),En[to]=wr(Vr[to],Qr[to],this._bitLength),Cn=Math.max(En[ro].length,Cn),Cn=Math.max(En[to].length,Cn);continue}var _i=[Gr[ro],null,null,Gr[to]];Gr[ro].y.cmp(Gr[to].y)===0?(_i[1]=Gr[ro].add(Gr[to]),_i[2]=Gr[ro].toJ().mixedAdd(Gr[to].neg())):Gr[ro].y.cmp(Gr[to].y.redNeg())===0?(_i[1]=Gr[ro].toJ().mixedAdd(Gr[to]),_i[2]=Gr[ro].add(Gr[to].neg())):(_i[1]=Gr[ro].toJ().mixedAdd(Gr[to]),_i[2]=Gr[ro].toJ().mixedAdd(Gr[to].neg()));var oo=[-3,-1,-5,-7,0,7,5,1,3],io=Er(Vr[ro],Vr[to]);for(Cn=Math.max(io[0].length,Cn),En[ro]=new Array(Cn),En[to]=new Array(Cn),An=0;An=0;In--){for(var Hr=0;In>=0;){var Xr=!0;for(An=0;An=0&&Hr++,no=no.dblp(Hr),In<0)break;for(An=0;An0?jn=_n[An][Sn-1>>1]:Sn<0&&(jn=_n[An][-Sn-1>>1].neg()),jn.type==="affine"?no=no.mixedAdd(jn):no=no.add(jn))}}for(In=0;In=Math.ceil((qr.bitLength()+1)/Gr.step):!1},Br.prototype._getDoubles=function(qr,Gr){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var Vr=[this],Zr=this,Jr=0;Jr=0&&(ro=In,to=An),jn.negative&&(jn=jn.neg(),eo=eo.neg()),ro.negative&&(ro=ro.neg(),to=to.neg()),[{a:jn,b:eo},{a:ro,b:to}]},jr.prototype._endoSplit=function(Gr){var Vr=this.endo.basis,Zr=Vr[0],Jr=Vr[1],Qr=Jr.b.mul(Gr).divRound(this.n),_n=Zr.b.neg().mul(Gr).divRound(this.n),En=Qr.mul(Zr.a),Cn=_n.mul(Jr.a),In=Qr.mul(Zr.b),An=_n.mul(Jr.b),jn=Gr.sub(En).sub(Cn),eo=In.add(An).neg();return{k1:jn,k2:eo}},jr.prototype.pointFromX=function(Gr,Vr){Gr=new br(Gr,16),Gr.red||(Gr=Gr.toRed(this.red));var Zr=Gr.redSqr().redMul(Gr).redIAdd(Gr.redMul(this.a)).redIAdd(this.b),Jr=Zr.redSqrt();if(Jr.redSqr().redSub(Zr).cmp(this.zero)!==0)throw new Error("invalid point");var Qr=Jr.fromRed().isOdd();return(Vr&&!Qr||!Vr&&Qr)&&(Jr=Jr.redNeg()),this.point(Gr,Jr)},jr.prototype.validate=function(Gr){if(Gr.inf)return!0;var Vr=Gr.x,Zr=Gr.y,Jr=this.a.redMul(Vr),Qr=Vr.redSqr().redMul(Vr).redIAdd(Jr).redIAdd(this.b);return Zr.redSqr().redISub(Qr).cmpn(0)===0},jr.prototype._endoWnafMulAdd=function(Gr,Vr,Zr){for(var Jr=this._endoWnafT1,Qr=this._endoWnafT2,_n=0;_n":""},Br.prototype.isInfinity=function(){return this.inf},Br.prototype.add=function(Gr){if(this.inf)return Gr;if(Gr.inf)return this;if(this.eq(Gr))return this.dbl();if(this.neg().eq(Gr))return this.curve.point(null,null);if(this.x.cmp(Gr.x)===0)return this.curve.point(null,null);var Vr=this.y.redSub(Gr.y);Vr.cmpn(0)!==0&&(Vr=Vr.redMul(this.x.redSub(Gr.x).redInvm()));var Zr=Vr.redSqr().redISub(this.x).redISub(Gr.x),Jr=Vr.redMul(this.x.redSub(Zr)).redISub(this.y);return this.curve.point(Zr,Jr)},Br.prototype.dbl=function(){if(this.inf)return this;var Gr=this.y.redAdd(this.y);if(Gr.cmpn(0)===0)return this.curve.point(null,null);var Vr=this.curve.a,Zr=this.x.redSqr(),Jr=Gr.redInvm(),Qr=Zr.redAdd(Zr).redIAdd(Zr).redIAdd(Vr).redMul(Jr),_n=Qr.redSqr().redISub(this.x.redAdd(this.x)),En=Qr.redMul(this.x.redSub(_n)).redISub(this.y);return this.curve.point(_n,En)},Br.prototype.getX=function(){return this.x.fromRed()},Br.prototype.getY=function(){return this.y.fromRed()},Br.prototype.mul=function(Gr){return Gr=new br(Gr,16),this.isInfinity()?this:this._hasDoubles(Gr)?this.curve._fixedNafMul(this,Gr):this.curve.endo?this.curve._endoWnafMulAdd([this],[Gr]):this.curve._wnafMul(this,Gr)},Br.prototype.mulAdd=function(Gr,Vr,Zr){var Jr=[this,Vr],Qr=[Gr,Zr];return this.curve.endo?this.curve._endoWnafMulAdd(Jr,Qr):this.curve._wnafMulAdd(1,Jr,Qr,2)},Br.prototype.jmulAdd=function(Gr,Vr,Zr){var Jr=[this,Vr],Qr=[Gr,Zr];return this.curve.endo?this.curve._endoWnafMulAdd(Jr,Qr,!0):this.curve._wnafMulAdd(1,Jr,Qr,2,!0)},Br.prototype.eq=function(Gr){return this===Gr||this.inf===Gr.inf&&(this.inf||this.x.cmp(Gr.x)===0&&this.y.cmp(Gr.y)===0)},Br.prototype.neg=function(Gr){if(this.inf)return this;var Vr=this.curve.point(this.x,this.y.redNeg());if(Gr&&this.precomputed){var Zr=this.precomputed,Jr=function(Qr){return Qr.neg()};Vr.precomputed={naf:Zr.naf&&{wnd:Zr.naf.wnd,points:Zr.naf.points.map(Jr)},doubles:Zr.doubles&&{step:Zr.doubles.step,points:Zr.doubles.points.map(Jr)}}}return Vr},Br.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var Gr=this.curve.jpoint(this.x,this.y,this.curve.one);return Gr};function Wr(qr,Gr,Vr,Zr){Er.BasePoint.call(this,qr,"jacobian"),Gr===null&&Vr===null&&Zr===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new br(0)):(this.x=new br(Gr,16),this.y=new br(Vr,16),this.z=new br(Zr,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}return wr(Wr,Er.BasePoint),jr.prototype.jpoint=function(Gr,Vr,Zr){return new Wr(this,Gr,Vr,Zr)},Wr.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var Gr=this.z.redInvm(),Vr=Gr.redSqr(),Zr=this.x.redMul(Vr),Jr=this.y.redMul(Vr).redMul(Gr);return this.curve.point(Zr,Jr)},Wr.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Wr.prototype.add=function(Gr){if(this.isInfinity())return Gr;if(Gr.isInfinity())return this;var Vr=Gr.z.redSqr(),Zr=this.z.redSqr(),Jr=this.x.redMul(Vr),Qr=Gr.x.redMul(Zr),_n=this.y.redMul(Vr.redMul(Gr.z)),En=Gr.y.redMul(Zr.redMul(this.z)),Cn=Jr.redSub(Qr),In=_n.redSub(En);if(Cn.cmpn(0)===0)return In.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var An=Cn.redSqr(),jn=An.redMul(Cn),eo=Jr.redMul(An),ro=In.redSqr().redIAdd(jn).redISub(eo).redISub(eo),to=In.redMul(eo.redISub(ro)).redISub(_n.redMul(jn)),_i=this.z.redMul(Gr.z).redMul(Cn);return this.curve.jpoint(ro,to,_i)},Wr.prototype.mixedAdd=function(Gr){if(this.isInfinity())return Gr.toJ();if(Gr.isInfinity())return this;var Vr=this.z.redSqr(),Zr=this.x,Jr=Gr.x.redMul(Vr),Qr=this.y,_n=Gr.y.redMul(Vr).redMul(this.z),En=Zr.redSub(Jr),Cn=Qr.redSub(_n);if(En.cmpn(0)===0)return Cn.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var In=En.redSqr(),An=In.redMul(En),jn=Zr.redMul(In),eo=Cn.redSqr().redIAdd(An).redISub(jn).redISub(jn),ro=Cn.redMul(jn.redISub(eo)).redISub(Qr.redMul(An)),to=this.z.redMul(En);return this.curve.jpoint(eo,ro,to)},Wr.prototype.dblp=function(Gr){if(Gr===0)return this;if(this.isInfinity())return this;if(!Gr)return this.dbl();var Vr;if(this.curve.zeroA||this.curve.threeA){var Zr=this;for(Vr=0;Vr=0)return!1;if(Zr.redIAdd(Qr),this.x.cmp(Zr)===0)return!0}},Wr.prototype.inspect=function(){return this.isInfinity()?"":""},Wr.prototype.isInfinity=function(){return this.z.cmpn(0)===0},short}var mont,hasRequiredMont;function requireMont(){if(hasRequiredMont)return mont;hasRequiredMont=1;var fr=requireBn$2(),br=requireInherits_browser(),wr=requireBase$1(),Er=requireUtils$2();function kr(Br){wr.call(this,"mont",Br),this.a=new fr(Br.a,16).toRed(this.red),this.b=new fr(Br.b,16).toRed(this.red),this.i4=new fr(4).toRed(this.red).redInvm(),this.two=new fr(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}br(kr,wr),mont=kr,kr.prototype.validate=function(Wr){var qr=Wr.normalize().x,Gr=qr.redSqr(),Vr=Gr.redMul(qr).redAdd(Gr.redMul(this.a)).redAdd(qr),Zr=Vr.redSqrt();return Zr.redSqr().cmp(Vr)===0};function jr(Br,Wr,qr){wr.BasePoint.call(this,Br,"projective"),Wr===null&&qr===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new fr(Wr,16),this.z=new fr(qr,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return br(jr,wr.BasePoint),kr.prototype.decodePoint=function(Wr,qr){return this.point(Er.toArray(Wr,qr),1)},kr.prototype.point=function(Wr,qr){return new jr(this,Wr,qr)},kr.prototype.pointFromJSON=function(Wr){return jr.fromJSON(this,Wr)},jr.prototype.precompute=function(){},jr.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},jr.fromJSON=function(Wr,qr){return new jr(Wr,qr[0],qr[1]||Wr.one)},jr.prototype.inspect=function(){return this.isInfinity()?"":""},jr.prototype.isInfinity=function(){return this.z.cmpn(0)===0},jr.prototype.dbl=function(){var Wr=this.x.redAdd(this.z),qr=Wr.redSqr(),Gr=this.x.redSub(this.z),Vr=Gr.redSqr(),Zr=qr.redSub(Vr),Jr=qr.redMul(Vr),Qr=Zr.redMul(Vr.redAdd(this.curve.a24.redMul(Zr)));return this.curve.point(Jr,Qr)},jr.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},jr.prototype.diffAdd=function(Wr,qr){var Gr=this.x.redAdd(this.z),Vr=this.x.redSub(this.z),Zr=Wr.x.redAdd(Wr.z),Jr=Wr.x.redSub(Wr.z),Qr=Jr.redMul(Gr),_n=Zr.redMul(Vr),En=qr.z.redMul(Qr.redAdd(_n).redSqr()),Cn=qr.x.redMul(Qr.redISub(_n).redSqr());return this.curve.point(En,Cn)},jr.prototype.mul=function(Wr){for(var qr=Wr.clone(),Gr=this,Vr=this.curve.point(null,null),Zr=this,Jr=[];qr.cmpn(0)!==0;qr.iushrn(1))Jr.push(qr.andln(1));for(var Qr=Jr.length-1;Qr>=0;Qr--)Jr[Qr]===0?(Gr=Gr.diffAdd(Vr,Zr),Vr=Vr.dbl()):(Vr=Gr.diffAdd(Vr,Zr),Gr=Gr.dbl());return Vr},jr.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},jr.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},jr.prototype.eq=function(Wr){return this.getX().cmp(Wr.getX())===0},jr.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},jr.prototype.getX=function(){return this.normalize(),this.x.fromRed()},mont}var edwards,hasRequiredEdwards;function requireEdwards(){if(hasRequiredEdwards)return edwards;hasRequiredEdwards=1;var fr=requireUtils$2(),br=requireBn$2(),wr=requireInherits_browser(),Er=requireBase$1(),kr=fr.assert;function jr(Wr){this.twisted=(Wr.a|0)!==1,this.mOneA=this.twisted&&(Wr.a|0)===-1,this.extended=this.mOneA,Er.call(this,"edwards",Wr),this.a=new br(Wr.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new br(Wr.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new br(Wr.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),kr(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(Wr.c|0)===1}wr(jr,Er),edwards=jr,jr.prototype._mulA=function(qr){return this.mOneA?qr.redNeg():this.a.redMul(qr)},jr.prototype._mulC=function(qr){return this.oneC?qr:this.c.redMul(qr)},jr.prototype.jpoint=function(qr,Gr,Vr,Zr){return this.point(qr,Gr,Vr,Zr)},jr.prototype.pointFromX=function(qr,Gr){qr=new br(qr,16),qr.red||(qr=qr.toRed(this.red));var Vr=qr.redSqr(),Zr=this.c2.redSub(this.a.redMul(Vr)),Jr=this.one.redSub(this.c2.redMul(this.d).redMul(Vr)),Qr=Zr.redMul(Jr.redInvm()),_n=Qr.redSqrt();if(_n.redSqr().redSub(Qr).cmp(this.zero)!==0)throw new Error("invalid point");var En=_n.fromRed().isOdd();return(Gr&&!En||!Gr&&En)&&(_n=_n.redNeg()),this.point(qr,_n)},jr.prototype.pointFromY=function(qr,Gr){qr=new br(qr,16),qr.red||(qr=qr.toRed(this.red));var Vr=qr.redSqr(),Zr=Vr.redSub(this.c2),Jr=Vr.redMul(this.d).redMul(this.c2).redSub(this.a),Qr=Zr.redMul(Jr.redInvm());if(Qr.cmp(this.zero)===0){if(Gr)throw new Error("invalid point");return this.point(this.zero,qr)}var _n=Qr.redSqrt();if(_n.redSqr().redSub(Qr).cmp(this.zero)!==0)throw new Error("invalid point");return _n.fromRed().isOdd()!==Gr&&(_n=_n.redNeg()),this.point(_n,qr)},jr.prototype.validate=function(qr){if(qr.isInfinity())return!0;qr.normalize();var Gr=qr.x.redSqr(),Vr=qr.y.redSqr(),Zr=Gr.redMul(this.a).redAdd(Vr),Jr=this.c2.redMul(this.one.redAdd(this.d.redMul(Gr).redMul(Vr)));return Zr.cmp(Jr)===0};function Br(Wr,qr,Gr,Vr,Zr){Er.BasePoint.call(this,Wr,"projective"),qr===null&&Gr===null&&Vr===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new br(qr,16),this.y=new br(Gr,16),this.z=Vr?new br(Vr,16):this.curve.one,this.t=Zr&&new br(Zr,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}return wr(Br,Er.BasePoint),jr.prototype.pointFromJSON=function(qr){return Br.fromJSON(this,qr)},jr.prototype.point=function(qr,Gr,Vr,Zr){return new Br(this,qr,Gr,Vr,Zr)},Br.fromJSON=function(qr,Gr){return new Br(qr,Gr[0],Gr[1],Gr[2])},Br.prototype.inspect=function(){return this.isInfinity()?"":""},Br.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},Br.prototype._extDbl=function(){var qr=this.x.redSqr(),Gr=this.y.redSqr(),Vr=this.z.redSqr();Vr=Vr.redIAdd(Vr);var Zr=this.curve._mulA(qr),Jr=this.x.redAdd(this.y).redSqr().redISub(qr).redISub(Gr),Qr=Zr.redAdd(Gr),_n=Qr.redSub(Vr),En=Zr.redSub(Gr),Cn=Jr.redMul(_n),In=Qr.redMul(En),An=Jr.redMul(En),jn=_n.redMul(Qr);return this.curve.point(Cn,In,jn,An)},Br.prototype._projDbl=function(){var qr=this.x.redAdd(this.y).redSqr(),Gr=this.x.redSqr(),Vr=this.y.redSqr(),Zr,Jr,Qr,_n,En,Cn;if(this.curve.twisted){_n=this.curve._mulA(Gr);var In=_n.redAdd(Vr);this.zOne?(Zr=qr.redSub(Gr).redSub(Vr).redMul(In.redSub(this.curve.two)),Jr=In.redMul(_n.redSub(Vr)),Qr=In.redSqr().redSub(In).redSub(In)):(En=this.z.redSqr(),Cn=In.redSub(En).redISub(En),Zr=qr.redSub(Gr).redISub(Vr).redMul(Cn),Jr=In.redMul(_n.redSub(Vr)),Qr=In.redMul(Cn))}else _n=Gr.redAdd(Vr),En=this.curve._mulC(this.z).redSqr(),Cn=_n.redSub(En).redSub(En),Zr=this.curve._mulC(qr.redISub(_n)).redMul(Cn),Jr=this.curve._mulC(_n).redMul(Gr.redISub(Vr)),Qr=_n.redMul(Cn);return this.curve.point(Zr,Jr,Qr)},Br.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},Br.prototype._extAdd=function(qr){var Gr=this.y.redSub(this.x).redMul(qr.y.redSub(qr.x)),Vr=this.y.redAdd(this.x).redMul(qr.y.redAdd(qr.x)),Zr=this.t.redMul(this.curve.dd).redMul(qr.t),Jr=this.z.redMul(qr.z.redAdd(qr.z)),Qr=Vr.redSub(Gr),_n=Jr.redSub(Zr),En=Jr.redAdd(Zr),Cn=Vr.redAdd(Gr),In=Qr.redMul(_n),An=En.redMul(Cn),jn=Qr.redMul(Cn),eo=_n.redMul(En);return this.curve.point(In,An,eo,jn)},Br.prototype._projAdd=function(qr){var Gr=this.z.redMul(qr.z),Vr=Gr.redSqr(),Zr=this.x.redMul(qr.x),Jr=this.y.redMul(qr.y),Qr=this.curve.d.redMul(Zr).redMul(Jr),_n=Vr.redSub(Qr),En=Vr.redAdd(Qr),Cn=this.x.redAdd(this.y).redMul(qr.x.redAdd(qr.y)).redISub(Zr).redISub(Jr),In=Gr.redMul(_n).redMul(Cn),An,jn;return this.curve.twisted?(An=Gr.redMul(En).redMul(Jr.redSub(this.curve._mulA(Zr))),jn=_n.redMul(En)):(An=Gr.redMul(En).redMul(Jr.redSub(Zr)),jn=this.curve._mulC(_n).redMul(En)),this.curve.point(In,An,jn)},Br.prototype.add=function(qr){return this.isInfinity()?qr:qr.isInfinity()?this:this.curve.extended?this._extAdd(qr):this._projAdd(qr)},Br.prototype.mul=function(qr){return this._hasDoubles(qr)?this.curve._fixedNafMul(this,qr):this.curve._wnafMul(this,qr)},Br.prototype.mulAdd=function(qr,Gr,Vr){return this.curve._wnafMulAdd(1,[this,Gr],[qr,Vr],2,!1)},Br.prototype.jmulAdd=function(qr,Gr,Vr){return this.curve._wnafMulAdd(1,[this,Gr],[qr,Vr],2,!0)},Br.prototype.normalize=function(){if(this.zOne)return this;var qr=this.z.redInvm();return this.x=this.x.redMul(qr),this.y=this.y.redMul(qr),this.t&&(this.t=this.t.redMul(qr)),this.z=this.curve.one,this.zOne=!0,this},Br.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},Br.prototype.getX=function(){return this.normalize(),this.x.fromRed()},Br.prototype.getY=function(){return this.normalize(),this.y.fromRed()},Br.prototype.eq=function(qr){return this===qr||this.getX().cmp(qr.getX())===0&&this.getY().cmp(qr.getY())===0},Br.prototype.eqXToP=function(qr){var Gr=qr.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(Gr)===0)return!0;for(var Vr=qr.clone(),Zr=this.curve.redN.redMul(this.z);;){if(Vr.iadd(this.curve.n),Vr.cmp(this.curve.p)>=0)return!1;if(Gr.redIAdd(Zr),this.x.cmp(Gr)===0)return!0}},Br.prototype.toP=Br.prototype.normalize,Br.prototype.mixedAdd=Br.prototype.add,edwards}var hasRequiredCurve;function requireCurve(){return hasRequiredCurve||(hasRequiredCurve=1,function(fr){var br=fr;br.base=requireBase$1(),br.short=requireShort(),br.mont=requireMont(),br.edwards=requireEdwards()}(curve)),curve}var curves={},hash$1={},utils$3={},hasRequiredUtils$1;function requireUtils$1(){if(hasRequiredUtils$1)return utils$3;hasRequiredUtils$1=1;var fr=requireMinimalisticAssert(),br=requireInherits_browser();utils$3.inherits=br;function wr(no,Tn){return(no.charCodeAt(Tn)&64512)!==55296||Tn<0||Tn+1>=no.length?!1:(no.charCodeAt(Tn+1)&64512)===56320}function Er(no,Tn){if(Array.isArray(no))return no.slice();if(!no)return[];var Hr=[];if(typeof no=="string")if(Tn){if(Tn==="hex")for(no=no.replace(/[^a-z0-9]+/ig,""),no.length%2!==0&&(no="0"+no),Sn=0;Sn>6|192,Hr[Xr++]=Rn&63|128):wr(no,Sn)?(Rn=65536+((Rn&1023)<<10)+(no.charCodeAt(++Sn)&1023),Hr[Xr++]=Rn>>18|240,Hr[Xr++]=Rn>>12&63|128,Hr[Xr++]=Rn>>6&63|128,Hr[Xr++]=Rn&63|128):(Hr[Xr++]=Rn>>12|224,Hr[Xr++]=Rn>>6&63|128,Hr[Xr++]=Rn&63|128)}else for(Sn=0;Sn>>24|no>>>8&65280|no<<8&16711680|(no&255)<<24;return Tn>>>0}utils$3.htonl=jr;function Br(no,Tn){for(var Hr="",Xr=0;Xr>>0}return Rn}utils$3.join32=Gr;function Vr(no,Tn){for(var Hr=new Array(no.length*4),Xr=0,Sn=0;Xr>>24,Hr[Sn+1]=Rn>>>16&255,Hr[Sn+2]=Rn>>>8&255,Hr[Sn+3]=Rn&255):(Hr[Sn+3]=Rn>>>24,Hr[Sn+2]=Rn>>>16&255,Hr[Sn+1]=Rn>>>8&255,Hr[Sn]=Rn&255)}return Hr}utils$3.split32=Vr;function Zr(no,Tn){return no>>>Tn|no<<32-Tn}utils$3.rotr32=Zr;function Jr(no,Tn){return no<>>32-Tn}utils$3.rotl32=Jr;function Qr(no,Tn){return no+Tn>>>0}utils$3.sum32=Qr;function _n(no,Tn,Hr){return no+Tn+Hr>>>0}utils$3.sum32_3=_n;function En(no,Tn,Hr,Xr){return no+Tn+Hr+Xr>>>0}utils$3.sum32_4=En;function Cn(no,Tn,Hr,Xr,Sn){return no+Tn+Hr+Xr+Sn>>>0}utils$3.sum32_5=Cn;function In(no,Tn,Hr,Xr){var Sn=no[Tn],Rn=no[Tn+1],Pn=Xr+Rn>>>0,On=(Pn>>0,no[Tn+1]=Pn}utils$3.sum64=In;function An(no,Tn,Hr,Xr){var Sn=Tn+Xr>>>0,Rn=(Sn>>0}utils$3.sum64_hi=An;function jn(no,Tn,Hr,Xr){var Sn=Tn+Xr;return Sn>>>0}utils$3.sum64_lo=jn;function eo(no,Tn,Hr,Xr,Sn,Rn,Pn,On){var Zn=0,Nn=Tn;Nn=Nn+Xr>>>0,Zn+=Nn>>0,Zn+=Nn>>0,Zn+=Nn>>0}utils$3.sum64_4_hi=eo;function ro(no,Tn,Hr,Xr,Sn,Rn,Pn,On){var Zn=Tn+Xr+Rn+On;return Zn>>>0}utils$3.sum64_4_lo=ro;function to(no,Tn,Hr,Xr,Sn,Rn,Pn,On,Zn,Nn){var wn=0,zn=Tn;zn=zn+Xr>>>0,wn+=zn>>0,wn+=zn>>0,wn+=zn>>0,wn+=zn>>0}utils$3.sum64_5_hi=to;function _i(no,Tn,Hr,Xr,Sn,Rn,Pn,On,Zn,Nn){var wn=Tn+Xr+Rn+On+Nn;return wn>>>0}utils$3.sum64_5_lo=_i;function oo(no,Tn,Hr){var Xr=Tn<<32-Hr|no>>>Hr;return Xr>>>0}utils$3.rotr64_hi=oo;function io(no,Tn,Hr){var Xr=no<<32-Hr|Tn>>>Hr;return Xr>>>0}utils$3.rotr64_lo=io;function co(no,Tn,Hr){return no>>>Hr}utils$3.shr64_hi=co;function so(no,Tn,Hr){var Xr=no<<32-Hr|Tn>>>Hr;return Xr>>>0}return utils$3.shr64_lo=so,utils$3}var common$1={},hasRequiredCommon$1;function requireCommon$1(){if(hasRequiredCommon$1)return common$1;hasRequiredCommon$1=1;var fr=requireUtils$1(),br=requireMinimalisticAssert();function wr(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}return common$1.BlockHash=wr,wr.prototype.update=function(kr,jr){if(kr=fr.toArray(kr,jr),this.pending?this.pending=this.pending.concat(kr):this.pending=kr,this.pendingTotal+=kr.length,this.pending.length>=this._delta8){kr=this.pending;var Br=kr.length%this._delta8;this.pending=kr.slice(kr.length-Br,kr.length),this.pending.length===0&&(this.pending=null),kr=fr.join32(kr,0,kr.length-Br,this.endian);for(var Wr=0;Wr>>24&255,Wr[qr++]=kr>>>16&255,Wr[qr++]=kr>>>8&255,Wr[qr++]=kr&255}else for(Wr[qr++]=kr&255,Wr[qr++]=kr>>>8&255,Wr[qr++]=kr>>>16&255,Wr[qr++]=kr>>>24&255,Wr[qr++]=0,Wr[qr++]=0,Wr[qr++]=0,Wr[qr++]=0,Gr=8;Gr>>3}common.g0_256=qr;function Gr(Vr){return br(Vr,17)^br(Vr,19)^Vr>>>10}return common.g1_256=Gr,common}var _1$1,hasRequired_1;function require_1(){if(hasRequired_1)return _1$1;hasRequired_1=1;var fr=requireUtils$1(),br=requireCommon$1(),wr=requireCommon(),Er=fr.rotl32,kr=fr.sum32,jr=fr.sum32_5,Br=wr.ft_1,Wr=br.BlockHash,qr=[1518500249,1859775393,2400959708,3395469782];function Gr(){if(!(this instanceof Gr))return new Gr;Wr.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}return fr.inherits(Gr,Wr),_1$1=Gr,Gr.blockSize=512,Gr.outSize=160,Gr.hmacStrength=80,Gr.padLength=64,Gr.prototype._update=function(Zr,Jr){for(var Qr=this.W,_n=0;_n<16;_n++)Qr[_n]=Zr[Jr+_n];for(;_nthis.blockSize&&(kr=new this.Hash().update(kr).digest()),br(kr.length<=this.blockSize);for(var jr=kr.length;jr=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(jr,Br,Wr)}return hmacDrbg=Er,Er.prototype._init=function(jr,Br,Wr){var qr=jr.concat(Br).concat(Wr);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var Gr=0;Gr=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(jr.concat(Wr||[])),this._reseed=1},Er.prototype.generate=function(jr,Br,Wr,qr){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof Br!="string"&&(qr=Wr,Wr=Br,Br=null),Wr&&(Wr=br.toArray(Wr,qr||"hex"),this._update(Wr));for(var Gr=[];Gr.length"},key$1}var signature$2,hasRequiredSignature$1;function requireSignature$1(){if(hasRequiredSignature$1)return signature$2;hasRequiredSignature$1=1;var fr=requireBn$2(),br=requireUtils$2(),wr=br.assert;function Er(qr,Gr){if(qr instanceof Er)return qr;this._importDER(qr,Gr)||(wr(qr.r&&qr.s,"Signature without r or s"),this.r=new fr(qr.r,16),this.s=new fr(qr.s,16),qr.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=qr.recoveryParam)}signature$2=Er;function kr(){this.place=0}function jr(qr,Gr){var Vr=qr[Gr.place++];if(!(Vr&128))return Vr;var Zr=Vr&15;if(Zr===0||Zr>4||qr[Gr.place]===0)return!1;for(var Jr=0,Qr=0,_n=Gr.place;Qr>>=0;return Jr<=127?!1:(Gr.place=_n,Jr)}function Br(qr){for(var Gr=0,Vr=qr.length-1;!qr[Gr]&&!(qr[Gr+1]&128)&&Gr>>3);for(qr.push(Vr|128);--Vr;)qr.push(Gr>>>(Vr<<3)&255);qr.push(Gr)}return Er.prototype.toDER=function(Gr){var Vr=this.r.toArray(),Zr=this.s.toArray();for(Vr[0]&128&&(Vr=[0].concat(Vr)),Zr[0]&128&&(Zr=[0].concat(Zr)),Vr=Br(Vr),Zr=Br(Zr);!Zr[0]&&!(Zr[1]&128);)Zr=Zr.slice(1);var Jr=[2];Wr(Jr,Vr.length),Jr=Jr.concat(Vr),Jr.push(2),Wr(Jr,Zr.length);var Qr=Jr.concat(Zr),_n=[48];return Wr(_n,Qr.length),_n=_n.concat(Qr),br.encode(_n,Gr)},signature$2}var ec,hasRequiredEc;function requireEc(){if(hasRequiredEc)return ec;hasRequiredEc=1;var fr=requireBn$2(),br=requireHmacDrbg(),wr=requireUtils$2(),Er=requireCurves(),kr=requireBrorand(),jr=wr.assert,Br=requireKey$1(),Wr=requireSignature$1();function qr(Gr){if(!(this instanceof qr))return new qr(Gr);typeof Gr=="string"&&(jr(Object.prototype.hasOwnProperty.call(Er,Gr),"Unknown curve "+Gr),Gr=Er[Gr]),Gr instanceof Er.PresetCurve&&(Gr={curve:Gr}),this.curve=Gr.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=Gr.curve.g,this.g.precompute(Gr.curve.n.bitLength()+1),this.hash=Gr.hash||Gr.curve.hash}return ec=qr,qr.prototype.keyPair=function(Vr){return new Br(this,Vr)},qr.prototype.keyFromPrivate=function(Vr,Zr){return Br.fromPrivate(this,Vr,Zr)},qr.prototype.keyFromPublic=function(Vr,Zr){return Br.fromPublic(this,Vr,Zr)},qr.prototype.genKeyPair=function(Vr){Vr||(Vr={});for(var Zr=new br({hash:this.hash,pers:Vr.pers,persEnc:Vr.persEnc||"utf8",entropy:Vr.entropy||kr(this.hash.hmacStrength),entropyEnc:Vr.entropy&&Vr.entropyEnc||"utf8",nonce:this.n.toArray()}),Jr=this.n.byteLength(),Qr=this.n.sub(new fr(2));;){var _n=new fr(Zr.generate(Jr));if(!(_n.cmp(Qr)>0))return _n.iaddn(1),this.keyFromPrivate(_n)}},qr.prototype._truncateToN=function(Vr,Zr,Jr){var Qr;if(fr.isBN(Vr)||typeof Vr=="number")Vr=new fr(Vr,16),Qr=Vr.byteLength();else if(typeof Vr=="object")Qr=Vr.length,Vr=new fr(Vr,16);else{var _n=Vr.toString();Qr=_n.length+1>>>1,Vr=new fr(_n,16)}typeof Jr!="number"&&(Jr=Qr*8);var En=Jr-this.n.bitLength();return En>0&&(Vr=Vr.ushrn(En)),!Zr&&Vr.cmp(this.n)>=0?Vr.sub(this.n):Vr},qr.prototype.sign=function(Vr,Zr,Jr,Qr){if(typeof Jr=="object"&&(Qr=Jr,Jr=null),Qr||(Qr={}),typeof Vr!="string"&&typeof Vr!="number"&&!fr.isBN(Vr)){jr(typeof Vr=="object"&&Vr&&typeof Vr.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),jr(Vr.length>>>0===Vr.length);for(var _n=0;_n=0)){var to=this.g.mul(ro);if(!to.isInfinity()){var _i=to.getX(),oo=_i.umod(this.n);if(oo.cmpn(0)!==0){var io=ro.invm(this.n).mul(oo.mul(Zr.getPrivate()).iadd(Vr));if(io=io.umod(this.n),io.cmpn(0)!==0){var co=(to.getY().isOdd()?1:0)|(_i.cmp(oo)!==0?2:0);return Qr.canonical&&io.cmp(this.nh)>0&&(io=this.n.sub(io),co^=1),new Wr({r:oo,s:io,recoveryParam:co})}}}}}},qr.prototype.verify=function(Vr,Zr,Jr,Qr,_n){_n||(_n={}),Vr=this._truncateToN(Vr,!1,_n.msgBitLength),Jr=this.keyFromPublic(Jr,Qr),Zr=new Wr(Zr,"hex");var En=Zr.r,Cn=Zr.s;if(En.cmpn(1)<0||En.cmp(this.n)>=0||Cn.cmpn(1)<0||Cn.cmp(this.n)>=0)return!1;var In=Cn.invm(this.n),An=In.mul(Vr).umod(this.n),jn=In.mul(En).umod(this.n),eo;return this.curve._maxwellTrick?(eo=this.g.jmulAdd(An,Jr.getPublic(),jn),eo.isInfinity()?!1:eo.eqXToP(En)):(eo=this.g.mulAdd(An,Jr.getPublic(),jn),eo.isInfinity()?!1:eo.getX().umod(this.n).cmp(En)===0)},qr.prototype.recoverPubKey=function(Gr,Vr,Zr,Jr){jr((3&Zr)===Zr,"The recovery param is more than two bits"),Vr=new Wr(Vr,Jr);var Qr=this.n,_n=new fr(Gr),En=Vr.r,Cn=Vr.s,In=Zr&1,An=Zr>>1;if(En.cmp(this.curve.p.umod(this.curve.n))>=0&&An)throw new Error("Unable to find sencond key candinate");An?En=this.curve.pointFromX(En.add(this.curve.n),In):En=this.curve.pointFromX(En,In);var jn=Vr.r.invm(Qr),eo=Qr.sub(_n).mul(jn).umod(Qr),ro=Cn.mul(jn).umod(Qr);return this.g.mulAdd(eo,En,ro)},qr.prototype.getKeyRecoveryParam=function(Gr,Vr,Zr,Jr){if(Vr=new Wr(Vr,Jr),Vr.recoveryParam!==null)return Vr.recoveryParam;for(var Qr=0;Qr<4;Qr++){var _n;try{_n=this.recoverPubKey(Gr,Vr,Qr)}catch{continue}if(_n.eq(Zr))return Qr}throw new Error("Unable to find valid recovery factor")},ec}var key,hasRequiredKey;function requireKey(){if(hasRequiredKey)return key;hasRequiredKey=1;var fr=requireUtils$2(),br=fr.assert,wr=fr.parseBytes,Er=fr.cachedProperty;function kr(jr,Br){this.eddsa=jr,this._secret=wr(Br.secret),jr.isPoint(Br.pub)?this._pub=Br.pub:this._pubBytes=wr(Br.pub)}return kr.fromPublic=function(Br,Wr){return Wr instanceof kr?Wr:new kr(Br,{pub:Wr})},kr.fromSecret=function(Br,Wr){return Wr instanceof kr?Wr:new kr(Br,{secret:Wr})},kr.prototype.secret=function(){return this._secret},Er(kr,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),Er(kr,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),Er(kr,"privBytes",function(){var Br=this.eddsa,Wr=this.hash(),qr=Br.encodingLength-1,Gr=Wr.slice(0,Br.encodingLength);return Gr[0]&=248,Gr[qr]&=127,Gr[qr]|=64,Gr}),Er(kr,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),Er(kr,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),Er(kr,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),kr.prototype.sign=function(Br){return br(this._secret,"KeyPair can only verify"),this.eddsa.sign(Br,this)},kr.prototype.verify=function(Br,Wr){return this.eddsa.verify(Br,Wr,this)},kr.prototype.getSecret=function(Br){return br(this._secret,"KeyPair is public only"),fr.encode(this.secret(),Br)},kr.prototype.getPublic=function(Br){return fr.encode(this.pubBytes(),Br)},key=kr,key}var signature$1,hasRequiredSignature;function requireSignature(){if(hasRequiredSignature)return signature$1;hasRequiredSignature=1;var fr=requireBn$2(),br=requireUtils$2(),wr=br.assert,Er=br.cachedProperty,kr=br.parseBytes;function jr(Br,Wr){this.eddsa=Br,typeof Wr!="object"&&(Wr=kr(Wr)),Array.isArray(Wr)&&(wr(Wr.length===Br.encodingLength*2,"Signature has invalid size"),Wr={R:Wr.slice(0,Br.encodingLength),S:Wr.slice(Br.encodingLength)}),wr(Wr.R&&Wr.S,"Signature without R or S"),Br.isPoint(Wr.R)&&(this._R=Wr.R),Wr.S instanceof fr&&(this._S=Wr.S),this._Rencoded=Array.isArray(Wr.R)?Wr.R:Wr.Rencoded,this._Sencoded=Array.isArray(Wr.S)?Wr.S:Wr.Sencoded}return Er(jr,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Er(jr,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Er(jr,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Er(jr,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),jr.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},jr.prototype.toHex=function(){return br.encode(this.toBytes(),"hex").toUpperCase()},signature$1=jr,signature$1}var eddsa,hasRequiredEddsa;function requireEddsa(){if(hasRequiredEddsa)return eddsa;hasRequiredEddsa=1;var fr=requireHash(),br=requireCurves(),wr=requireUtils$2(),Er=wr.assert,kr=wr.parseBytes,jr=requireKey(),Br=requireSignature();function Wr(qr){if(Er(qr==="ed25519","only tested with ed25519 so far"),!(this instanceof Wr))return new Wr(qr);qr=br[qr].curve,this.curve=qr,this.g=qr.g,this.g.precompute(qr.n.bitLength()+1),this.pointClass=qr.point().constructor,this.encodingLength=Math.ceil(qr.n.bitLength()/8),this.hash=fr.sha512}return eddsa=Wr,Wr.prototype.sign=function(Gr,Vr){Gr=kr(Gr);var Zr=this.keyFromSecret(Vr),Jr=this.hashInt(Zr.messagePrefix(),Gr),Qr=this.g.mul(Jr),_n=this.encodePoint(Qr),En=this.hashInt(_n,Zr.pubBytes(),Gr).mul(Zr.priv()),Cn=Jr.add(En).umod(this.curve.n);return this.makeSignature({R:Qr,S:Cn,Rencoded:_n})},Wr.prototype.verify=function(Gr,Vr,Zr){if(Gr=kr(Gr),Vr=this.makeSignature(Vr),Vr.S().gte(Vr.eddsa.curve.n)||Vr.S().isNeg())return!1;var Jr=this.keyFromPublic(Zr),Qr=this.hashInt(Vr.Rencoded(),Jr.pubBytes(),Gr),_n=this.g.mul(Vr.S()),En=Vr.R().add(Jr.pub().mul(Qr));return En.eq(_n)},Wr.prototype.hashInt=function(){for(var Gr=this.hash(),Vr=0;Vr0?Hr:Xr},jr.min=function(Hr,Xr){return Hr.cmp(Xr)<0?Hr:Xr},jr.prototype._init=function(Hr,Xr,Sn){if(typeof Hr=="number")return this._initNumber(Hr,Xr,Sn);if(typeof Hr=="object")return this._initArray(Hr,Xr,Sn);Xr==="hex"&&(Xr=16),Er(Xr===(Xr|0)&&Xr>=2&&Xr<=36),Hr=Hr.toString().replace(/\s+/g,"");var Rn=0;Hr[0]==="-"&&(Rn++,this.negative=1),Rn=0;Rn-=3)On=Hr[Rn]|Hr[Rn-1]<<8|Hr[Rn-2]<<16,this.words[Pn]|=On<>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);else if(Sn==="le")for(Rn=0,Pn=0;Rn>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);return this._strip()};function Wr(Tn,Hr){var Xr=Tn.charCodeAt(Hr);if(Xr>=48&&Xr<=57)return Xr-48;if(Xr>=65&&Xr<=70)return Xr-55;if(Xr>=97&&Xr<=102)return Xr-87;Er(!1,"Invalid character in "+Tn)}function qr(Tn,Hr,Xr){var Sn=Wr(Tn,Xr);return Xr-1>=Hr&&(Sn|=Wr(Tn,Xr-1)<<4),Sn}jr.prototype._parseHex=function(Hr,Xr,Sn){this.length=Math.ceil((Hr.length-Xr)/6),this.words=new Array(this.length);for(var Rn=0;Rn=Xr;Rn-=2)Zn=qr(Hr,Xr,Rn)<=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8;else{var Nn=Hr.length-Xr;for(Rn=Nn%2===0?Xr+1:Xr;Rn=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8}this._strip()};function Gr(Tn,Hr,Xr,Sn){for(var Rn=0,Pn=0,On=Math.min(Tn.length,Xr),Zn=Hr;Zn=49?Pn=Nn-49+10:Nn>=17?Pn=Nn-17+10:Pn=Nn,Er(Nn>=0&&Pn1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},jr.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{jr.prototype[Symbol.for("nodejs.util.inspect.custom")]=Zr}catch{jr.prototype.inspect=Zr}else jr.prototype.inspect=Zr;function Zr(){return(this.red?""}var Jr=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Qr=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_n=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];jr.prototype.toString=function(Hr,Xr){Hr=Hr||10,Xr=Xr|0||1;var Sn;if(Hr===16||Hr==="hex"){Sn="";for(var Rn=0,Pn=0,On=0;On>>24-Rn&16777215,Rn+=2,Rn>=26&&(Rn-=26,On--),Pn!==0||On!==this.length-1?Sn=Jr[6-Nn.length]+Nn+Sn:Sn=Nn+Sn}for(Pn!==0&&(Sn=Pn.toString(16)+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}if(Hr===(Hr|0)&&Hr>=2&&Hr<=36){var wn=Qr[Hr],zn=_n[Hr];Sn="";var fo=this.clone();for(fo.negative=0;!fo.isZero();){var vo=fo.modrn(zn).toString(Hr);fo=fo.idivn(zn),fo.isZero()?Sn=vo+Sn:Sn=Jr[wn-vo.length]+vo+Sn}for(this.isZero()&&(Sn="0"+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}Er(!1,"Base should be between 2 and 36")},jr.prototype.toNumber=function(){var Hr=this.words[0];return this.length===2?Hr+=this.words[1]*67108864:this.length===3&&this.words[2]===1?Hr+=4503599627370496+this.words[1]*67108864:this.length>2&&Er(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-Hr:Hr},jr.prototype.toJSON=function(){return this.toString(16,2)},Br&&(jr.prototype.toBuffer=function(Hr,Xr){return this.toArrayLike(Br,Hr,Xr)}),jr.prototype.toArray=function(Hr,Xr){return this.toArrayLike(Array,Hr,Xr)};var En=function(Hr,Xr){return Hr.allocUnsafe?Hr.allocUnsafe(Xr):new Hr(Xr)};jr.prototype.toArrayLike=function(Hr,Xr,Sn){this._strip();var Rn=this.byteLength(),Pn=Sn||Math.max(1,Rn);Er(Rn<=Pn,"byte array longer than desired length"),Er(Pn>0,"Requested array length <= 0");var On=En(Hr,Pn),Zn=Xr==="le"?"LE":"BE";return this["_toArrayLike"+Zn](On,Rn),On},jr.prototype._toArrayLikeLE=function(Hr,Xr){for(var Sn=0,Rn=0,Pn=0,On=0;Pn>8&255),Sn>16&255),On===6?(Sn>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn=0&&(Hr[Sn--]=Zn>>8&255),Sn>=0&&(Hr[Sn--]=Zn>>16&255),On===6?(Sn>=0&&(Hr[Sn--]=Zn>>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn>=0)for(Hr[Sn--]=Rn;Sn>=0;)Hr[Sn--]=0},Math.clz32?jr.prototype._countBits=function(Hr){return 32-Math.clz32(Hr)}:jr.prototype._countBits=function(Hr){var Xr=Hr,Sn=0;return Xr>=4096&&(Sn+=13,Xr>>>=13),Xr>=64&&(Sn+=7,Xr>>>=7),Xr>=8&&(Sn+=4,Xr>>>=4),Xr>=2&&(Sn+=2,Xr>>>=2),Sn+Xr},jr.prototype._zeroBits=function(Hr){if(Hr===0)return 26;var Xr=Hr,Sn=0;return Xr&8191||(Sn+=13,Xr>>>=13),Xr&127||(Sn+=7,Xr>>>=7),Xr&15||(Sn+=4,Xr>>>=4),Xr&3||(Sn+=2,Xr>>>=2),Xr&1||Sn++,Sn},jr.prototype.bitLength=function(){var Hr=this.words[this.length-1],Xr=this._countBits(Hr);return(this.length-1)*26+Xr};function Cn(Tn){for(var Hr=new Array(Tn.bitLength()),Xr=0;Xr>>Rn&1}return Hr}jr.prototype.zeroBits=function(){if(this.isZero())return 0;for(var Hr=0,Xr=0;XrHr.length?this.clone().ior(Hr):Hr.clone().ior(this)},jr.prototype.uor=function(Hr){return this.length>Hr.length?this.clone().iuor(Hr):Hr.clone().iuor(this)},jr.prototype.iuand=function(Hr){var Xr;this.length>Hr.length?Xr=Hr:Xr=this;for(var Sn=0;SnHr.length?this.clone().iand(Hr):Hr.clone().iand(this)},jr.prototype.uand=function(Hr){return this.length>Hr.length?this.clone().iuand(Hr):Hr.clone().iuand(this)},jr.prototype.iuxor=function(Hr){var Xr,Sn;this.length>Hr.length?(Xr=this,Sn=Hr):(Xr=Hr,Sn=this);for(var Rn=0;RnHr.length?this.clone().ixor(Hr):Hr.clone().ixor(this)},jr.prototype.uxor=function(Hr){return this.length>Hr.length?this.clone().iuxor(Hr):Hr.clone().iuxor(this)},jr.prototype.inotn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Math.ceil(Hr/26)|0,Sn=Hr%26;this._expand(Xr),Sn>0&&Xr--;for(var Rn=0;Rn0&&(this.words[Rn]=~this.words[Rn]&67108863>>26-Sn),this._strip()},jr.prototype.notn=function(Hr){return this.clone().inotn(Hr)},jr.prototype.setn=function(Hr,Xr){Er(typeof Hr=="number"&&Hr>=0);var Sn=Hr/26|0,Rn=Hr%26;return this._expand(Sn+1),Xr?this.words[Sn]=this.words[Sn]|1<Hr.length?(Sn=this,Rn=Hr):(Sn=Hr,Rn=this);for(var Pn=0,On=0;On>>26;for(;Pn!==0&&On>>26;if(this.length=Sn.length,Pn!==0)this.words[this.length]=Pn,this.length++;else if(Sn!==this)for(;OnHr.length?this.clone().iadd(Hr):Hr.clone().iadd(this)},jr.prototype.isub=function(Hr){if(Hr.negative!==0){Hr.negative=0;var Xr=this.iadd(Hr);return Hr.negative=1,Xr._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Hr),this.negative=1,this._normSign();var Sn=this.cmp(Hr);if(Sn===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Rn,Pn;Sn>0?(Rn=this,Pn=Hr):(Rn=Hr,Pn=this);for(var On=0,Zn=0;Zn>26,this.words[Zn]=Xr&67108863;for(;On!==0&&Zn>26,this.words[Zn]=Xr&67108863;if(On===0&&Zn>>26,fo=Nn&67108863,vo=Math.min(wn,Hr.length-1),go=Math.max(0,wn-Tn.length+1);go<=vo;go++){var uo=wn-go|0;Rn=Tn.words[uo]|0,Pn=Hr.words[go]|0,On=Rn*Pn+fo,zn+=On/67108864|0,fo=On&67108863}Xr.words[wn]=fo|0,Nn=zn|0}return Nn!==0?Xr.words[wn]=Nn|0:Xr.length--,Xr._strip()}var An=function(Hr,Xr,Sn){var Rn=Hr.words,Pn=Xr.words,On=Sn.words,Zn=0,Nn,wn,zn,fo=Rn[0]|0,vo=fo&8191,go=fo>>>13,uo=Rn[1]|0,lo=uo&8191,Eo=uo>>>13,mo=Rn[2]|0,yo=mo&8191,_o=mo>>>13,Bo=Rn[3]|0,Lo=Bo&8191,Wo=Bo>>>13,na=Rn[4]|0,qo=na&8191,ga=na>>>13,wl=Rn[5]|0,No=wl&8191,Uo=wl>>>13,Nl=Rn[6]|0,Vo=Nl&8191,Fo=Nl>>>13,Ol=Rn[7]|0,$a=Ol&8191,Jo=Ol>>>13,Zl=Rn[8]|0,Cl=Zl&8191,ko=Zl>>>13,wo=Rn[9]|0,bo=wo&8191,Io=wo>>>13,Ho=Pn[0]|0,Do=Ho&8191,zo=Ho>>>13,nu=Pn[1]|0,Ll=nu&8191,_l=nu>>>13,bu=Pn[2]|0,xl=bu&8191,Tl=bu>>>13,du=Pn[3]|0,Bl=du&8191,Il=du>>>13,Eu=Pn[4]|0,Al=Eu&8191,Ml=Eu>>>13,Tu=Pn[5]|0,Fl=Tu&8191,Sl=Tu>>>13,_u=Pn[6]|0,So=_u&8191,Co=_u>>>13,Ao=Pn[7]|0,po=Ao&8191,Ro=Ao>>>13,Xo=Pn[8]|0,jo=Xo&8191,Ko=Xo>>>13,Wl=Pn[9]|0,$l=Wl&8191,El=Wl>>>13;Sn.negative=Hr.negative^Xr.negative,Sn.length=19,Nn=Math.imul(vo,Do),wn=Math.imul(vo,zo),wn=wn+Math.imul(go,Do)|0,zn=Math.imul(go,zo);var Cu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,Nn=Math.imul(lo,Do),wn=Math.imul(lo,zo),wn=wn+Math.imul(Eo,Do)|0,zn=Math.imul(Eo,zo),Nn=Nn+Math.imul(vo,Ll)|0,wn=wn+Math.imul(vo,_l)|0,wn=wn+Math.imul(go,Ll)|0,zn=zn+Math.imul(go,_l)|0;var iu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(iu>>>26)|0,iu&=67108863,Nn=Math.imul(yo,Do),wn=Math.imul(yo,zo),wn=wn+Math.imul(_o,Do)|0,zn=Math.imul(_o,zo),Nn=Nn+Math.imul(lo,Ll)|0,wn=wn+Math.imul(lo,_l)|0,wn=wn+Math.imul(Eo,Ll)|0,zn=zn+Math.imul(Eo,_l)|0,Nn=Nn+Math.imul(vo,xl)|0,wn=wn+Math.imul(vo,Tl)|0,wn=wn+Math.imul(go,xl)|0,zn=zn+Math.imul(go,Tl)|0;var pu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(pu>>>26)|0,pu&=67108863,Nn=Math.imul(Lo,Do),wn=Math.imul(Lo,zo),wn=wn+Math.imul(Wo,Do)|0,zn=Math.imul(Wo,zo),Nn=Nn+Math.imul(yo,Ll)|0,wn=wn+Math.imul(yo,_l)|0,wn=wn+Math.imul(_o,Ll)|0,zn=zn+Math.imul(_o,_l)|0,Nn=Nn+Math.imul(lo,xl)|0,wn=wn+Math.imul(lo,Tl)|0,wn=wn+Math.imul(Eo,xl)|0,zn=zn+Math.imul(Eo,Tl)|0,Nn=Nn+Math.imul(vo,Bl)|0,wn=wn+Math.imul(vo,Il)|0,wn=wn+Math.imul(go,Bl)|0,zn=zn+Math.imul(go,Il)|0;var yu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(yu>>>26)|0,yu&=67108863,Nn=Math.imul(qo,Do),wn=Math.imul(qo,zo),wn=wn+Math.imul(ga,Do)|0,zn=Math.imul(ga,zo),Nn=Nn+Math.imul(Lo,Ll)|0,wn=wn+Math.imul(Lo,_l)|0,wn=wn+Math.imul(Wo,Ll)|0,zn=zn+Math.imul(Wo,_l)|0,Nn=Nn+Math.imul(yo,xl)|0,wn=wn+Math.imul(yo,Tl)|0,wn=wn+Math.imul(_o,xl)|0,zn=zn+Math.imul(_o,Tl)|0,Nn=Nn+Math.imul(lo,Bl)|0,wn=wn+Math.imul(lo,Il)|0,wn=wn+Math.imul(Eo,Bl)|0,zn=zn+Math.imul(Eo,Il)|0,Nn=Nn+Math.imul(vo,Al)|0,wn=wn+Math.imul(vo,Ml)|0,wn=wn+Math.imul(go,Al)|0,zn=zn+Math.imul(go,Ml)|0;var hu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(hu>>>26)|0,hu&=67108863,Nn=Math.imul(No,Do),wn=Math.imul(No,zo),wn=wn+Math.imul(Uo,Do)|0,zn=Math.imul(Uo,zo),Nn=Nn+Math.imul(qo,Ll)|0,wn=wn+Math.imul(qo,_l)|0,wn=wn+Math.imul(ga,Ll)|0,zn=zn+Math.imul(ga,_l)|0,Nn=Nn+Math.imul(Lo,xl)|0,wn=wn+Math.imul(Lo,Tl)|0,wn=wn+Math.imul(Wo,xl)|0,zn=zn+Math.imul(Wo,Tl)|0,Nn=Nn+Math.imul(yo,Bl)|0,wn=wn+Math.imul(yo,Il)|0,wn=wn+Math.imul(_o,Bl)|0,zn=zn+Math.imul(_o,Il)|0,Nn=Nn+Math.imul(lo,Al)|0,wn=wn+Math.imul(lo,Ml)|0,wn=wn+Math.imul(Eo,Al)|0,zn=zn+Math.imul(Eo,Ml)|0,Nn=Nn+Math.imul(vo,Fl)|0,wn=wn+Math.imul(vo,Sl)|0,wn=wn+Math.imul(go,Fl)|0,zn=zn+Math.imul(go,Sl)|0;var mu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(mu>>>26)|0,mu&=67108863,Nn=Math.imul(Vo,Do),wn=Math.imul(Vo,zo),wn=wn+Math.imul(Fo,Do)|0,zn=Math.imul(Fo,zo),Nn=Nn+Math.imul(No,Ll)|0,wn=wn+Math.imul(No,_l)|0,wn=wn+Math.imul(Uo,Ll)|0,zn=zn+Math.imul(Uo,_l)|0,Nn=Nn+Math.imul(qo,xl)|0,wn=wn+Math.imul(qo,Tl)|0,wn=wn+Math.imul(ga,xl)|0,zn=zn+Math.imul(ga,Tl)|0,Nn=Nn+Math.imul(Lo,Bl)|0,wn=wn+Math.imul(Lo,Il)|0,wn=wn+Math.imul(Wo,Bl)|0,zn=zn+Math.imul(Wo,Il)|0,Nn=Nn+Math.imul(yo,Al)|0,wn=wn+Math.imul(yo,Ml)|0,wn=wn+Math.imul(_o,Al)|0,zn=zn+Math.imul(_o,Ml)|0,Nn=Nn+Math.imul(lo,Fl)|0,wn=wn+Math.imul(lo,Sl)|0,wn=wn+Math.imul(Eo,Fl)|0,zn=zn+Math.imul(Eo,Sl)|0,Nn=Nn+Math.imul(vo,So)|0,wn=wn+Math.imul(vo,Co)|0,wn=wn+Math.imul(go,So)|0,zn=zn+Math.imul(go,Co)|0;var vu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(vu>>>26)|0,vu&=67108863,Nn=Math.imul($a,Do),wn=Math.imul($a,zo),wn=wn+Math.imul(Jo,Do)|0,zn=Math.imul(Jo,zo),Nn=Nn+Math.imul(Vo,Ll)|0,wn=wn+Math.imul(Vo,_l)|0,wn=wn+Math.imul(Fo,Ll)|0,zn=zn+Math.imul(Fo,_l)|0,Nn=Nn+Math.imul(No,xl)|0,wn=wn+Math.imul(No,Tl)|0,wn=wn+Math.imul(Uo,xl)|0,zn=zn+Math.imul(Uo,Tl)|0,Nn=Nn+Math.imul(qo,Bl)|0,wn=wn+Math.imul(qo,Il)|0,wn=wn+Math.imul(ga,Bl)|0,zn=zn+Math.imul(ga,Il)|0,Nn=Nn+Math.imul(Lo,Al)|0,wn=wn+Math.imul(Lo,Ml)|0,wn=wn+Math.imul(Wo,Al)|0,zn=zn+Math.imul(Wo,Ml)|0,Nn=Nn+Math.imul(yo,Fl)|0,wn=wn+Math.imul(yo,Sl)|0,wn=wn+Math.imul(_o,Fl)|0,zn=zn+Math.imul(_o,Sl)|0,Nn=Nn+Math.imul(lo,So)|0,wn=wn+Math.imul(lo,Co)|0,wn=wn+Math.imul(Eo,So)|0,zn=zn+Math.imul(Eo,Co)|0,Nn=Nn+Math.imul(vo,po)|0,wn=wn+Math.imul(vo,Ro)|0,wn=wn+Math.imul(go,po)|0,zn=zn+Math.imul(go,Ro)|0;var fu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(fu>>>26)|0,fu&=67108863,Nn=Math.imul(Cl,Do),wn=Math.imul(Cl,zo),wn=wn+Math.imul(ko,Do)|0,zn=Math.imul(ko,zo),Nn=Nn+Math.imul($a,Ll)|0,wn=wn+Math.imul($a,_l)|0,wn=wn+Math.imul(Jo,Ll)|0,zn=zn+Math.imul(Jo,_l)|0,Nn=Nn+Math.imul(Vo,xl)|0,wn=wn+Math.imul(Vo,Tl)|0,wn=wn+Math.imul(Fo,xl)|0,zn=zn+Math.imul(Fo,Tl)|0,Nn=Nn+Math.imul(No,Bl)|0,wn=wn+Math.imul(No,Il)|0,wn=wn+Math.imul(Uo,Bl)|0,zn=zn+Math.imul(Uo,Il)|0,Nn=Nn+Math.imul(qo,Al)|0,wn=wn+Math.imul(qo,Ml)|0,wn=wn+Math.imul(ga,Al)|0,zn=zn+Math.imul(ga,Ml)|0,Nn=Nn+Math.imul(Lo,Fl)|0,wn=wn+Math.imul(Lo,Sl)|0,wn=wn+Math.imul(Wo,Fl)|0,zn=zn+Math.imul(Wo,Sl)|0,Nn=Nn+Math.imul(yo,So)|0,wn=wn+Math.imul(yo,Co)|0,wn=wn+Math.imul(_o,So)|0,zn=zn+Math.imul(_o,Co)|0,Nn=Nn+Math.imul(lo,po)|0,wn=wn+Math.imul(lo,Ro)|0,wn=wn+Math.imul(Eo,po)|0,zn=zn+Math.imul(Eo,Ro)|0,Nn=Nn+Math.imul(vo,jo)|0,wn=wn+Math.imul(vo,Ko)|0,wn=wn+Math.imul(go,jo)|0,zn=zn+Math.imul(go,Ko)|0;var gu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(gu>>>26)|0,gu&=67108863,Nn=Math.imul(bo,Do),wn=Math.imul(bo,zo),wn=wn+Math.imul(Io,Do)|0,zn=Math.imul(Io,zo),Nn=Nn+Math.imul(Cl,Ll)|0,wn=wn+Math.imul(Cl,_l)|0,wn=wn+Math.imul(ko,Ll)|0,zn=zn+Math.imul(ko,_l)|0,Nn=Nn+Math.imul($a,xl)|0,wn=wn+Math.imul($a,Tl)|0,wn=wn+Math.imul(Jo,xl)|0,zn=zn+Math.imul(Jo,Tl)|0,Nn=Nn+Math.imul(Vo,Bl)|0,wn=wn+Math.imul(Vo,Il)|0,wn=wn+Math.imul(Fo,Bl)|0,zn=zn+Math.imul(Fo,Il)|0,Nn=Nn+Math.imul(No,Al)|0,wn=wn+Math.imul(No,Ml)|0,wn=wn+Math.imul(Uo,Al)|0,zn=zn+Math.imul(Uo,Ml)|0,Nn=Nn+Math.imul(qo,Fl)|0,wn=wn+Math.imul(qo,Sl)|0,wn=wn+Math.imul(ga,Fl)|0,zn=zn+Math.imul(ga,Sl)|0,Nn=Nn+Math.imul(Lo,So)|0,wn=wn+Math.imul(Lo,Co)|0,wn=wn+Math.imul(Wo,So)|0,zn=zn+Math.imul(Wo,Co)|0,Nn=Nn+Math.imul(yo,po)|0,wn=wn+Math.imul(yo,Ro)|0,wn=wn+Math.imul(_o,po)|0,zn=zn+Math.imul(_o,Ro)|0,Nn=Nn+Math.imul(lo,jo)|0,wn=wn+Math.imul(lo,Ko)|0,wn=wn+Math.imul(Eo,jo)|0,zn=zn+Math.imul(Eo,Ko)|0,Nn=Nn+Math.imul(vo,$l)|0,wn=wn+Math.imul(vo,El)|0,wn=wn+Math.imul(go,$l)|0,zn=zn+Math.imul(go,El)|0;var ou=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(ou>>>26)|0,ou&=67108863,Nn=Math.imul(bo,Ll),wn=Math.imul(bo,_l),wn=wn+Math.imul(Io,Ll)|0,zn=Math.imul(Io,_l),Nn=Nn+Math.imul(Cl,xl)|0,wn=wn+Math.imul(Cl,Tl)|0,wn=wn+Math.imul(ko,xl)|0,zn=zn+Math.imul(ko,Tl)|0,Nn=Nn+Math.imul($a,Bl)|0,wn=wn+Math.imul($a,Il)|0,wn=wn+Math.imul(Jo,Bl)|0,zn=zn+Math.imul(Jo,Il)|0,Nn=Nn+Math.imul(Vo,Al)|0,wn=wn+Math.imul(Vo,Ml)|0,wn=wn+Math.imul(Fo,Al)|0,zn=zn+Math.imul(Fo,Ml)|0,Nn=Nn+Math.imul(No,Fl)|0,wn=wn+Math.imul(No,Sl)|0,wn=wn+Math.imul(Uo,Fl)|0,zn=zn+Math.imul(Uo,Sl)|0,Nn=Nn+Math.imul(qo,So)|0,wn=wn+Math.imul(qo,Co)|0,wn=wn+Math.imul(ga,So)|0,zn=zn+Math.imul(ga,Co)|0,Nn=Nn+Math.imul(Lo,po)|0,wn=wn+Math.imul(Lo,Ro)|0,wn=wn+Math.imul(Wo,po)|0,zn=zn+Math.imul(Wo,Ro)|0,Nn=Nn+Math.imul(yo,jo)|0,wn=wn+Math.imul(yo,Ko)|0,wn=wn+Math.imul(_o,jo)|0,zn=zn+Math.imul(_o,Ko)|0,Nn=Nn+Math.imul(lo,$l)|0,wn=wn+Math.imul(lo,El)|0,wn=wn+Math.imul(Eo,$l)|0,zn=zn+Math.imul(Eo,El)|0;var su=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(su>>>26)|0,su&=67108863,Nn=Math.imul(bo,xl),wn=Math.imul(bo,Tl),wn=wn+Math.imul(Io,xl)|0,zn=Math.imul(Io,Tl),Nn=Nn+Math.imul(Cl,Bl)|0,wn=wn+Math.imul(Cl,Il)|0,wn=wn+Math.imul(ko,Bl)|0,zn=zn+Math.imul(ko,Il)|0,Nn=Nn+Math.imul($a,Al)|0,wn=wn+Math.imul($a,Ml)|0,wn=wn+Math.imul(Jo,Al)|0,zn=zn+Math.imul(Jo,Ml)|0,Nn=Nn+Math.imul(Vo,Fl)|0,wn=wn+Math.imul(Vo,Sl)|0,wn=wn+Math.imul(Fo,Fl)|0,zn=zn+Math.imul(Fo,Sl)|0,Nn=Nn+Math.imul(No,So)|0,wn=wn+Math.imul(No,Co)|0,wn=wn+Math.imul(Uo,So)|0,zn=zn+Math.imul(Uo,Co)|0,Nn=Nn+Math.imul(qo,po)|0,wn=wn+Math.imul(qo,Ro)|0,wn=wn+Math.imul(ga,po)|0,zn=zn+Math.imul(ga,Ro)|0,Nn=Nn+Math.imul(Lo,jo)|0,wn=wn+Math.imul(Lo,Ko)|0,wn=wn+Math.imul(Wo,jo)|0,zn=zn+Math.imul(Wo,Ko)|0,Nn=Nn+Math.imul(yo,$l)|0,wn=wn+Math.imul(yo,El)|0,wn=wn+Math.imul(_o,$l)|0,zn=zn+Math.imul(_o,El)|0;var tu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(tu>>>26)|0,tu&=67108863,Nn=Math.imul(bo,Bl),wn=Math.imul(bo,Il),wn=wn+Math.imul(Io,Bl)|0,zn=Math.imul(Io,Il),Nn=Nn+Math.imul(Cl,Al)|0,wn=wn+Math.imul(Cl,Ml)|0,wn=wn+Math.imul(ko,Al)|0,zn=zn+Math.imul(ko,Ml)|0,Nn=Nn+Math.imul($a,Fl)|0,wn=wn+Math.imul($a,Sl)|0,wn=wn+Math.imul(Jo,Fl)|0,zn=zn+Math.imul(Jo,Sl)|0,Nn=Nn+Math.imul(Vo,So)|0,wn=wn+Math.imul(Vo,Co)|0,wn=wn+Math.imul(Fo,So)|0,zn=zn+Math.imul(Fo,Co)|0,Nn=Nn+Math.imul(No,po)|0,wn=wn+Math.imul(No,Ro)|0,wn=wn+Math.imul(Uo,po)|0,zn=zn+Math.imul(Uo,Ro)|0,Nn=Nn+Math.imul(qo,jo)|0,wn=wn+Math.imul(qo,Ko)|0,wn=wn+Math.imul(ga,jo)|0,zn=zn+Math.imul(ga,Ko)|0,Nn=Nn+Math.imul(Lo,$l)|0,wn=wn+Math.imul(Lo,El)|0,wn=wn+Math.imul(Wo,$l)|0,zn=zn+Math.imul(Wo,El)|0;var zl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(zl>>>26)|0,zl&=67108863,Nn=Math.imul(bo,Al),wn=Math.imul(bo,Ml),wn=wn+Math.imul(Io,Al)|0,zn=Math.imul(Io,Ml),Nn=Nn+Math.imul(Cl,Fl)|0,wn=wn+Math.imul(Cl,Sl)|0,wn=wn+Math.imul(ko,Fl)|0,zn=zn+Math.imul(ko,Sl)|0,Nn=Nn+Math.imul($a,So)|0,wn=wn+Math.imul($a,Co)|0,wn=wn+Math.imul(Jo,So)|0,zn=zn+Math.imul(Jo,Co)|0,Nn=Nn+Math.imul(Vo,po)|0,wn=wn+Math.imul(Vo,Ro)|0,wn=wn+Math.imul(Fo,po)|0,zn=zn+Math.imul(Fo,Ro)|0,Nn=Nn+Math.imul(No,jo)|0,wn=wn+Math.imul(No,Ko)|0,wn=wn+Math.imul(Uo,jo)|0,zn=zn+Math.imul(Uo,Ko)|0,Nn=Nn+Math.imul(qo,$l)|0,wn=wn+Math.imul(qo,El)|0,wn=wn+Math.imul(ga,$l)|0,zn=zn+Math.imul(ga,El)|0;var Gl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Gl>>>26)|0,Gl&=67108863,Nn=Math.imul(bo,Fl),wn=Math.imul(bo,Sl),wn=wn+Math.imul(Io,Fl)|0,zn=Math.imul(Io,Sl),Nn=Nn+Math.imul(Cl,So)|0,wn=wn+Math.imul(Cl,Co)|0,wn=wn+Math.imul(ko,So)|0,zn=zn+Math.imul(ko,Co)|0,Nn=Nn+Math.imul($a,po)|0,wn=wn+Math.imul($a,Ro)|0,wn=wn+Math.imul(Jo,po)|0,zn=zn+Math.imul(Jo,Ro)|0,Nn=Nn+Math.imul(Vo,jo)|0,wn=wn+Math.imul(Vo,Ko)|0,wn=wn+Math.imul(Fo,jo)|0,zn=zn+Math.imul(Fo,Ko)|0,Nn=Nn+Math.imul(No,$l)|0,wn=wn+Math.imul(No,El)|0,wn=wn+Math.imul(Uo,$l)|0,zn=zn+Math.imul(Uo,El)|0;var Jl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Jl>>>26)|0,Jl&=67108863,Nn=Math.imul(bo,So),wn=Math.imul(bo,Co),wn=wn+Math.imul(Io,So)|0,zn=Math.imul(Io,Co),Nn=Nn+Math.imul(Cl,po)|0,wn=wn+Math.imul(Cl,Ro)|0,wn=wn+Math.imul(ko,po)|0,zn=zn+Math.imul(ko,Ro)|0,Nn=Nn+Math.imul($a,jo)|0,wn=wn+Math.imul($a,Ko)|0,wn=wn+Math.imul(Jo,jo)|0,zn=zn+Math.imul(Jo,Ko)|0,Nn=Nn+Math.imul(Vo,$l)|0,wn=wn+Math.imul(Vo,El)|0,wn=wn+Math.imul(Fo,$l)|0,zn=zn+Math.imul(Fo,El)|0;var Pl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Pl>>>26)|0,Pl&=67108863,Nn=Math.imul(bo,po),wn=Math.imul(bo,Ro),wn=wn+Math.imul(Io,po)|0,zn=Math.imul(Io,Ro),Nn=Nn+Math.imul(Cl,jo)|0,wn=wn+Math.imul(Cl,Ko)|0,wn=wn+Math.imul(ko,jo)|0,zn=zn+Math.imul(ko,Ko)|0,Nn=Nn+Math.imul($a,$l)|0,wn=wn+Math.imul($a,El)|0,wn=wn+Math.imul(Jo,$l)|0,zn=zn+Math.imul(Jo,El)|0;var Ul=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Ul>>>26)|0,Ul&=67108863,Nn=Math.imul(bo,jo),wn=Math.imul(bo,Ko),wn=wn+Math.imul(Io,jo)|0,zn=Math.imul(Io,Ko),Nn=Nn+Math.imul(Cl,$l)|0,wn=wn+Math.imul(Cl,El)|0,wn=wn+Math.imul(ko,$l)|0,zn=zn+Math.imul(ko,El)|0;var Yl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Yl>>>26)|0,Yl&=67108863,Nn=Math.imul(bo,$l),wn=Math.imul(bo,El),wn=wn+Math.imul(Io,$l)|0,zn=Math.imul(Io,El);var Vl=(Zn+Nn|0)+((wn&8191)<<13)|0;return Zn=(zn+(wn>>>13)|0)+(Vl>>>26)|0,Vl&=67108863,On[0]=Cu,On[1]=iu,On[2]=pu,On[3]=yu,On[4]=hu,On[5]=mu,On[6]=vu,On[7]=fu,On[8]=gu,On[9]=ou,On[10]=su,On[11]=tu,On[12]=zl,On[13]=Gl,On[14]=Jl,On[15]=Pl,On[16]=Ul,On[17]=Yl,On[18]=Vl,Zn!==0&&(On[19]=Zn,Sn.length++),Sn};Math.imul||(An=In);function jn(Tn,Hr,Xr){Xr.negative=Hr.negative^Tn.negative,Xr.length=Tn.length+Hr.length;for(var Sn=0,Rn=0,Pn=0;Pn>>26)|0,Rn+=On>>>26,On&=67108863}Xr.words[Pn]=Zn,Sn=On,On=Rn}return Sn!==0?Xr.words[Pn]=Sn:Xr.length--,Xr._strip()}function eo(Tn,Hr,Xr){return jn(Tn,Hr,Xr)}jr.prototype.mulTo=function(Hr,Xr){var Sn,Rn=this.length+Hr.length;return this.length===10&&Hr.length===10?Sn=An(this,Hr,Xr):Rn<63?Sn=In(this,Hr,Xr):Rn<1024?Sn=jn(this,Hr,Xr):Sn=eo(this,Hr,Xr),Sn},jr.prototype.mul=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),this.mulTo(Hr,Xr)},jr.prototype.mulf=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),eo(this,Hr,Xr)},jr.prototype.imul=function(Hr){return this.clone().mulTo(Hr,this)},jr.prototype.imuln=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(typeof Hr=="number"),Er(Hr<67108864);for(var Sn=0,Rn=0;Rn>=26,Sn+=Pn/67108864|0,Sn+=On>>>26,this.words[Rn]=On&67108863}return Sn!==0&&(this.words[Rn]=Sn,this.length++),Xr?this.ineg():this},jr.prototype.muln=function(Hr){return this.clone().imuln(Hr)},jr.prototype.sqr=function(){return this.mul(this)},jr.prototype.isqr=function(){return this.imul(this.clone())},jr.prototype.pow=function(Hr){var Xr=Cn(Hr);if(Xr.length===0)return new jr(1);for(var Sn=this,Rn=0;Rn=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=67108863>>>26-Xr<<26-Xr,Pn;if(Xr!==0){var On=0;for(Pn=0;Pn>>26-Xr}On&&(this.words[Pn]=On,this.length++)}if(Sn!==0){for(Pn=this.length-1;Pn>=0;Pn--)this.words[Pn+Sn]=this.words[Pn];for(Pn=0;Pn=0);var Rn;Xr?Rn=(Xr-Xr%26)/26:Rn=0;var Pn=Hr%26,On=Math.min((Hr-Pn)/26,this.length),Zn=67108863^67108863>>>Pn<On)for(this.length-=On,wn=0;wn=0&&(zn!==0||wn>=Rn);wn--){var fo=this.words[wn]|0;this.words[wn]=zn<<26-Pn|fo>>>Pn,zn=fo&Zn}return Nn&&zn!==0&&(Nn.words[Nn.length++]=zn),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},jr.prototype.ishrn=function(Hr,Xr,Sn){return Er(this.negative===0),this.iushrn(Hr,Xr,Sn)},jr.prototype.shln=function(Hr){return this.clone().ishln(Hr)},jr.prototype.ushln=function(Hr){return this.clone().iushln(Hr)},jr.prototype.shrn=function(Hr){return this.clone().ishrn(Hr)},jr.prototype.ushrn=function(Hr){return this.clone().iushrn(Hr)},jr.prototype.testn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<=0);var Xr=Hr%26,Sn=(Hr-Xr)/26;if(Er(this.negative===0,"imaskn works only with positive numbers"),this.length<=Sn)return this;if(Xr!==0&&Sn++,this.length=Math.min(Sn,this.length),Xr!==0){var Rn=67108863^67108863>>>Xr<=67108864;Xr++)this.words[Xr]-=67108864,Xr===this.length-1?this.words[Xr+1]=1:this.words[Xr+1]++;return this.length=Math.max(this.length,Xr+1),this},jr.prototype.isubn=function(Hr){if(Er(typeof Hr=="number"),Er(Hr<67108864),Hr<0)return this.iaddn(-Hr);if(this.negative!==0)return this.negative=0,this.iaddn(Hr),this.negative=1,this;if(this.words[0]-=Hr,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Xr=0;Xr>26)-(Nn/67108864|0),this.words[Pn+Sn]=On&67108863}for(;Pn>26,this.words[Pn+Sn]=On&67108863;if(Zn===0)return this._strip();for(Er(Zn===-1),Zn=0,Pn=0;Pn>26,this.words[Pn]=On&67108863;return this.negative=1,this._strip()},jr.prototype._wordDiv=function(Hr,Xr){var Sn=this.length-Hr.length,Rn=this.clone(),Pn=Hr,On=Pn.words[Pn.length-1]|0,Zn=this._countBits(On);Sn=26-Zn,Sn!==0&&(Pn=Pn.ushln(Sn),Rn.iushln(Sn),On=Pn.words[Pn.length-1]|0);var Nn=Rn.length-Pn.length,wn;if(Xr!=="mod"){wn=new jr(null),wn.length=Nn+1,wn.words=new Array(wn.length);for(var zn=0;zn=0;vo--){var go=(Rn.words[Pn.length+vo]|0)*67108864+(Rn.words[Pn.length+vo-1]|0);for(go=Math.min(go/On|0,67108863),Rn._ishlnsubmul(Pn,go,vo);Rn.negative!==0;)go--,Rn.negative=0,Rn._ishlnsubmul(Pn,1,vo),Rn.isZero()||(Rn.negative^=1);wn&&(wn.words[vo]=go)}return wn&&wn._strip(),Rn._strip(),Xr!=="div"&&Sn!==0&&Rn.iushrn(Sn),{div:wn||null,mod:Rn}},jr.prototype.divmod=function(Hr,Xr,Sn){if(Er(!Hr.isZero()),this.isZero())return{div:new jr(0),mod:new jr(0)};var Rn,Pn,On;return this.negative!==0&&Hr.negative===0?(On=this.neg().divmod(Hr,Xr),Xr!=="mod"&&(Rn=On.div.neg()),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.iadd(Hr)),{div:Rn,mod:Pn}):this.negative===0&&Hr.negative!==0?(On=this.divmod(Hr.neg(),Xr),Xr!=="mod"&&(Rn=On.div.neg()),{div:Rn,mod:On.mod}):this.negative&Hr.negative?(On=this.neg().divmod(Hr.neg(),Xr),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.isub(Hr)),{div:On.div,mod:Pn}):Hr.length>this.length||this.cmp(Hr)<0?{div:new jr(0),mod:this}:Hr.length===1?Xr==="div"?{div:this.divn(Hr.words[0]),mod:null}:Xr==="mod"?{div:null,mod:new jr(this.modrn(Hr.words[0]))}:{div:this.divn(Hr.words[0]),mod:new jr(this.modrn(Hr.words[0]))}:this._wordDiv(Hr,Xr)},jr.prototype.div=function(Hr){return this.divmod(Hr,"div",!1).div},jr.prototype.mod=function(Hr){return this.divmod(Hr,"mod",!1).mod},jr.prototype.umod=function(Hr){return this.divmod(Hr,"mod",!0).mod},jr.prototype.divRound=function(Hr){var Xr=this.divmod(Hr);if(Xr.mod.isZero())return Xr.div;var Sn=Xr.div.negative!==0?Xr.mod.isub(Hr):Xr.mod,Rn=Hr.ushrn(1),Pn=Hr.andln(1),On=Sn.cmp(Rn);return On<0||Pn===1&&On===0?Xr.div:Xr.div.negative!==0?Xr.div.isubn(1):Xr.div.iaddn(1)},jr.prototype.modrn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=(1<<26)%Hr,Rn=0,Pn=this.length-1;Pn>=0;Pn--)Rn=(Sn*Rn+(this.words[Pn]|0))%Hr;return Xr?-Rn:Rn},jr.prototype.modn=function(Hr){return this.modrn(Hr)},jr.prototype.idivn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=0,Rn=this.length-1;Rn>=0;Rn--){var Pn=(this.words[Rn]|0)+Sn*67108864;this.words[Rn]=Pn/Hr|0,Sn=Pn%Hr}return this._strip(),Xr?this.ineg():this},jr.prototype.divn=function(Hr){return this.clone().idivn(Hr)},jr.prototype.egcd=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=new jr(0),Zn=new jr(1),Nn=0;Xr.isEven()&&Sn.isEven();)Xr.iushrn(1),Sn.iushrn(1),++Nn;for(var wn=Sn.clone(),zn=Xr.clone();!Xr.isZero();){for(var fo=0,vo=1;!(Xr.words[0]&vo)&&fo<26;++fo,vo<<=1);if(fo>0)for(Xr.iushrn(fo);fo-- >0;)(Rn.isOdd()||Pn.isOdd())&&(Rn.iadd(wn),Pn.isub(zn)),Rn.iushrn(1),Pn.iushrn(1);for(var go=0,uo=1;!(Sn.words[0]&uo)&&go<26;++go,uo<<=1);if(go>0)for(Sn.iushrn(go);go-- >0;)(On.isOdd()||Zn.isOdd())&&(On.iadd(wn),Zn.isub(zn)),On.iushrn(1),Zn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(On),Pn.isub(Zn)):(Sn.isub(Xr),On.isub(Rn),Zn.isub(Pn))}return{a:On,b:Zn,gcd:Sn.iushln(Nn)}},jr.prototype._invmp=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=Sn.clone();Xr.cmpn(1)>0&&Sn.cmpn(1)>0;){for(var Zn=0,Nn=1;!(Xr.words[0]&Nn)&&Zn<26;++Zn,Nn<<=1);if(Zn>0)for(Xr.iushrn(Zn);Zn-- >0;)Rn.isOdd()&&Rn.iadd(On),Rn.iushrn(1);for(var wn=0,zn=1;!(Sn.words[0]&zn)&&wn<26;++wn,zn<<=1);if(wn>0)for(Sn.iushrn(wn);wn-- >0;)Pn.isOdd()&&Pn.iadd(On),Pn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(Pn)):(Sn.isub(Xr),Pn.isub(Rn))}var fo;return Xr.cmpn(1)===0?fo=Rn:fo=Pn,fo.cmpn(0)<0&&fo.iadd(Hr),fo},jr.prototype.gcd=function(Hr){if(this.isZero())return Hr.abs();if(Hr.isZero())return this.abs();var Xr=this.clone(),Sn=Hr.clone();Xr.negative=0,Sn.negative=0;for(var Rn=0;Xr.isEven()&&Sn.isEven();Rn++)Xr.iushrn(1),Sn.iushrn(1);do{for(;Xr.isEven();)Xr.iushrn(1);for(;Sn.isEven();)Sn.iushrn(1);var Pn=Xr.cmp(Sn);if(Pn<0){var On=Xr;Xr=Sn,Sn=On}else if(Pn===0||Sn.cmpn(1)===0)break;Xr.isub(Sn)}while(!0);return Sn.iushln(Rn)},jr.prototype.invm=function(Hr){return this.egcd(Hr).a.umod(Hr)},jr.prototype.isEven=function(){return(this.words[0]&1)===0},jr.prototype.isOdd=function(){return(this.words[0]&1)===1},jr.prototype.andln=function(Hr){return this.words[0]&Hr},jr.prototype.bincn=function(Hr){Er(typeof Hr=="number");var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<>>26,Zn&=67108863,this.words[On]=Zn}return Pn!==0&&(this.words[On]=Pn,this.length++),this},jr.prototype.isZero=function(){return this.length===1&&this.words[0]===0},jr.prototype.cmpn=function(Hr){var Xr=Hr<0;if(this.negative!==0&&!Xr)return-1;if(this.negative===0&&Xr)return 1;this._strip();var Sn;if(this.length>1)Sn=1;else{Xr&&(Hr=-Hr),Er(Hr<=67108863,"Number is too big");var Rn=this.words[0]|0;Sn=Rn===Hr?0:RnHr.length)return 1;if(this.length=0;Sn--){var Rn=this.words[Sn]|0,Pn=Hr.words[Sn]|0;if(Rn!==Pn){RnPn&&(Xr=1);break}}return Xr},jr.prototype.gtn=function(Hr){return this.cmpn(Hr)===1},jr.prototype.gt=function(Hr){return this.cmp(Hr)===1},jr.prototype.gten=function(Hr){return this.cmpn(Hr)>=0},jr.prototype.gte=function(Hr){return this.cmp(Hr)>=0},jr.prototype.ltn=function(Hr){return this.cmpn(Hr)===-1},jr.prototype.lt=function(Hr){return this.cmp(Hr)===-1},jr.prototype.lten=function(Hr){return this.cmpn(Hr)<=0},jr.prototype.lte=function(Hr){return this.cmp(Hr)<=0},jr.prototype.eqn=function(Hr){return this.cmpn(Hr)===0},jr.prototype.eq=function(Hr){return this.cmp(Hr)===0},jr.red=function(Hr){return new so(Hr)},jr.prototype.toRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),Er(this.negative===0,"red works only with positives"),Hr.convertTo(this)._forceRed(Hr)},jr.prototype.fromRed=function(){return Er(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},jr.prototype._forceRed=function(Hr){return this.red=Hr,this},jr.prototype.forceRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),this._forceRed(Hr)},jr.prototype.redAdd=function(Hr){return Er(this.red,"redAdd works only with red numbers"),this.red.add(this,Hr)},jr.prototype.redIAdd=function(Hr){return Er(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Hr)},jr.prototype.redSub=function(Hr){return Er(this.red,"redSub works only with red numbers"),this.red.sub(this,Hr)},jr.prototype.redISub=function(Hr){return Er(this.red,"redISub works only with red numbers"),this.red.isub(this,Hr)},jr.prototype.redShl=function(Hr){return Er(this.red,"redShl works only with red numbers"),this.red.shl(this,Hr)},jr.prototype.redMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.mul(this,Hr)},jr.prototype.redIMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.imul(this,Hr)},jr.prototype.redSqr=function(){return Er(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},jr.prototype.redISqr=function(){return Er(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},jr.prototype.redSqrt=function(){return Er(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},jr.prototype.redInvm=function(){return Er(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},jr.prototype.redNeg=function(){return Er(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},jr.prototype.redPow=function(Hr){return Er(this.red&&!Hr.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Hr)};var ro={k256:null,p224:null,p192:null,p25519:null};function to(Tn,Hr){this.name=Tn,this.p=new jr(Hr,16),this.n=this.p.bitLength(),this.k=new jr(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}to.prototype._tmp=function(){var Hr=new jr(null);return Hr.words=new Array(Math.ceil(this.n/13)),Hr},to.prototype.ireduce=function(Hr){var Xr=Hr,Sn;do this.split(Xr,this.tmp),Xr=this.imulK(Xr),Xr=Xr.iadd(this.tmp),Sn=Xr.bitLength();while(Sn>this.n);var Rn=Sn0?Xr.isub(this.p):Xr.strip!==void 0?Xr.strip():Xr._strip(),Xr},to.prototype.split=function(Hr,Xr){Hr.iushrn(this.n,0,Xr)},to.prototype.imulK=function(Hr){return Hr.imul(this.k)};function _i(){to.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}kr(_i,to),_i.prototype.split=function(Hr,Xr){for(var Sn=4194303,Rn=Math.min(Hr.length,9),Pn=0;Pn>>22,On=Zn}On>>>=22,Hr.words[Pn-10]=On,On===0&&Hr.length>10?Hr.length-=10:Hr.length-=9},_i.prototype.imulK=function(Hr){Hr.words[Hr.length]=0,Hr.words[Hr.length+1]=0,Hr.length+=2;for(var Xr=0,Sn=0;Sn>>=26,Hr.words[Sn]=Pn,Xr=Rn}return Xr!==0&&(Hr.words[Hr.length++]=Xr),Hr},jr._prime=function(Hr){if(ro[Hr])return ro[Hr];var Xr;if(Hr==="k256")Xr=new _i;else if(Hr==="p224")Xr=new oo;else if(Hr==="p192")Xr=new io;else if(Hr==="p25519")Xr=new co;else throw new Error("Unknown prime "+Hr);return ro[Hr]=Xr,Xr};function so(Tn){if(typeof Tn=="string"){var Hr=jr._prime(Tn);this.m=Hr.p,this.prime=Hr}else Er(Tn.gtn(1),"modulus must be greater than 1"),this.m=Tn,this.prime=null}so.prototype._verify1=function(Hr){Er(Hr.negative===0,"red works only with positives"),Er(Hr.red,"red works only with red numbers")},so.prototype._verify2=function(Hr,Xr){Er((Hr.negative|Xr.negative)===0,"red works only with positives"),Er(Hr.red&&Hr.red===Xr.red,"red works only with red numbers")},so.prototype.imod=function(Hr){return this.prime?this.prime.ireduce(Hr)._forceRed(this):(Vr(Hr,Hr.umod(this.m)._forceRed(this)),Hr)},so.prototype.neg=function(Hr){return Hr.isZero()?Hr.clone():this.m.sub(Hr)._forceRed(this)},so.prototype.add=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.add(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn._forceRed(this)},so.prototype.iadd=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.iadd(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn},so.prototype.sub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.sub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn._forceRed(this)},so.prototype.isub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.isub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn},so.prototype.shl=function(Hr,Xr){return this._verify1(Hr),this.imod(Hr.ushln(Xr))},so.prototype.imul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.imul(Xr))},so.prototype.mul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.mul(Xr))},so.prototype.isqr=function(Hr){return this.imul(Hr,Hr.clone())},so.prototype.sqr=function(Hr){return this.mul(Hr,Hr)},so.prototype.sqrt=function(Hr){if(Hr.isZero())return Hr.clone();var Xr=this.m.andln(3);if(Er(Xr%2===1),Xr===3){var Sn=this.m.add(new jr(1)).iushrn(2);return this.pow(Hr,Sn)}for(var Rn=this.m.subn(1),Pn=0;!Rn.isZero()&&Rn.andln(1)===0;)Pn++,Rn.iushrn(1);Er(!Rn.isZero());var On=new jr(1).toRed(this),Zn=On.redNeg(),Nn=this.m.subn(1).iushrn(1),wn=this.m.bitLength();for(wn=new jr(2*wn*wn).toRed(this);this.pow(wn,Nn).cmp(Zn)!==0;)wn.redIAdd(Zn);for(var zn=this.pow(wn,Rn),fo=this.pow(Hr,Rn.addn(1).iushrn(1)),vo=this.pow(Hr,Rn),go=Pn;vo.cmp(On)!==0;){for(var uo=vo,lo=0;uo.cmp(On)!==0;lo++)uo=uo.redSqr();Er(lo=0;Pn--){for(var zn=Xr.words[Pn],fo=wn-1;fo>=0;fo--){var vo=zn>>fo&1;if(On!==Rn[0]&&(On=this.sqr(On)),vo===0&&Zn===0){Nn=0;continue}Zn<<=1,Zn|=vo,Nn++,!(Nn!==Sn&&(Pn!==0||fo!==0))&&(On=this.mul(On,Rn[Zn]),Nn=0,Zn=0)}wn=26}return On},so.prototype.convertTo=function(Hr){var Xr=Hr.umod(this.m);return Xr===Hr?Xr.clone():Xr},so.prototype.convertFrom=function(Hr){var Xr=Hr.clone();return Xr.red=null,Xr},jr.mont=function(Hr){return new no(Hr)};function no(Tn){so.call(this,Tn),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new jr(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}kr(no,so),no.prototype.convertTo=function(Hr){return this.imod(Hr.ushln(this.shift))},no.prototype.convertFrom=function(Hr){var Xr=this.imod(Hr.mul(this.rinv));return Xr.red=null,Xr},no.prototype.imul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return Hr.words[0]=0,Hr.length=1,Hr;var Sn=Hr.imul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.mul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return new jr(0)._forceRed(this);var Sn=Hr.mul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.invm=function(Hr){var Xr=this.imod(Hr._invmp(this.m).mul(this.r2));return Xr._forceRed(this)}})(fr,commonjsGlobal)}(bn$4)),bn$4.exports}var asn1$1={},asn1={},api$1={},vmBrowserify={},hasRequiredVmBrowserify;function requireVmBrowserify(){return hasRequiredVmBrowserify||(hasRequiredVmBrowserify=1,function(exports){var indexOf=function(fr,br){if(fr.indexOf)return fr.indexOf(br);for(var wr=0;wr>6],Qr=(Zr&32)===0;if((Zr&31)===31){var _n=Zr;for(Zr=0;(_n&128)===128;){if(_n=Gr.readUInt8(Vr),Gr.isError(_n))return _n;Zr<<=7,Zr|=_n&127}}else Zr&=31;var En=kr.tag[Zr];return{cls:Jr,primitive:Qr,tag:Zr,tagStr:En}}function qr(Gr,Vr,Zr){var Jr=Gr.readUInt8(Zr);if(Gr.isError(Jr))return Jr;if(!Vr&&Jr===128)return null;if(!(Jr&128))return Jr;var Qr=Jr&127;if(Qr>4)return Gr.error("length octect is too long");Jr=0;for(var _n=0;_n=256;Cn>>=8)En++;var In=new br(2+En);In[0]=_n,In[1]=128|En;for(var Cn=1+En,An=Qr.length;An>0;Cn--,An>>=8)In[Cn]=An&255;return this._createEncoderBuffer([In,Qr])},Br.prototype._encodeStr=function(Vr,Zr){if(Zr==="bitstr")return this._createEncoderBuffer([Vr.unused|0,Vr.data]);if(Zr==="bmpstr"){for(var Jr=new br(Vr.length*2),Qr=0;Qr=40)return this.reporter.error("Second objid identifier OOB");Vr.splice(0,2,Vr[0]*40+Vr[1])}for(var _n=0,Qr=0;Qr=128;En>>=7)_n++}for(var Cn=new br(_n),In=Cn.length-1,Qr=Vr.length-1;Qr>=0;Qr--){var En=Vr[Qr];for(Cn[In--]=En&127;(En>>=7)>0;)Cn[In--]=128|En&127}return this._createEncoderBuffer(Cn)};function Wr(Gr){return Gr<10?"0"+Gr:Gr}Br.prototype._encodeTime=function(Vr,Zr){var Jr,Qr=new Date(Vr);return Zr==="gentime"?Jr=[Wr(Qr.getFullYear()),Wr(Qr.getUTCMonth()+1),Wr(Qr.getUTCDate()),Wr(Qr.getUTCHours()),Wr(Qr.getUTCMinutes()),Wr(Qr.getUTCSeconds()),"Z"].join(""):Zr==="utctime"?Jr=[Wr(Qr.getFullYear()%100),Wr(Qr.getUTCMonth()+1),Wr(Qr.getUTCDate()),Wr(Qr.getUTCHours()),Wr(Qr.getUTCMinutes()),Wr(Qr.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+Zr+" time is not supported yet"),this._encodeStr(Jr,"octstr")},Br.prototype._encodeNull=function(){return this._createEncoderBuffer("")},Br.prototype._encodeInt=function(Vr,Zr){if(typeof Vr=="string"){if(!Zr)return this.reporter.error("String int or enum given, but no values map");if(!Zr.hasOwnProperty(Vr))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(Vr));Vr=Zr[Vr]}if(typeof Vr!="number"&&!br.isBuffer(Vr)){var Jr=Vr.toArray();!Vr.sign&&Jr[0]&128&&Jr.unshift(0),Vr=new br(Jr)}if(br.isBuffer(Vr)){var Qr=Vr.length;Vr.length===0&&Qr++;var En=new br(Qr);return Vr.copy(En),Vr.length===0&&(En[0]=0),this._createEncoderBuffer(En)}if(Vr<128)return this._createEncoderBuffer(Vr);if(Vr<256)return this._createEncoderBuffer([0,Vr]);for(var Qr=1,_n=Vr;_n>=256;_n>>=8)Qr++;for(var En=new Array(Qr),_n=En.length-1;_n>=0;_n--)En[_n]=Vr&255,Vr>>=8;return En[0]&128&&En.unshift(0),this._createEncoderBuffer(new br(En))},Br.prototype._encodeBool=function(Vr){return this._createEncoderBuffer(Vr?255:0)},Br.prototype._use=function(Vr,Zr){return typeof Vr=="function"&&(Vr=Vr(Zr)),Vr._getEncoder("der").tree},Br.prototype._skipDefault=function(Vr,Zr,Jr){var Qr=this._baseState,_n;if(Qr.default===null)return!1;var En=Vr.join();if(Qr.defaultBuffer===void 0&&(Qr.defaultBuffer=this._encodeValue(Qr.default,Zr,Jr).join()),En.length!==Qr.defaultBuffer.length)return!1;for(_n=0;_n=31?Jr.error("Multi-octet tag encoding unsupported"):(Vr||(Qr|=32),Qr|=kr.tagClassByName[Zr||"universal"]<<6,Qr)}return der_1}var pem,hasRequiredPem;function requirePem(){if(hasRequiredPem)return pem;hasRequiredPem=1;var fr=requireInherits_browser(),br=requireDer();function wr(Er){br.call(this,Er),this.enc="pem"}return fr(wr,br),pem=wr,wr.prototype.encode=function(kr,jr){for(var Br=br.prototype.encode.call(this,kr),Wr=Br.toString("base64"),qr=["-----BEGIN "+jr.label+"-----"],Gr=0;Gr0&&jn.ishrn(eo),jn}function _n(In,An){In=Qr(In,An),In=In.mod(An);var jn=fr.from(In.toArray());if(jn.length=0)throw new Error("invalid sig")}return verify_1=jr,verify_1}var browser$8,hasRequiredBrowser$3;function requireBrowser$3(){if(hasRequiredBrowser$3)return browser$8;hasRequiredBrowser$3=1;var fr=safeBufferExports.Buffer,br=requireBrowser$9(),wr=requireReadableBrowser(),Er=requireInherits_browser(),kr=requireSign(),jr=requireVerify(),Br=require$$6;Object.keys(Br).forEach(function(Zr){Br[Zr].id=fr.from(Br[Zr].id,"hex"),Br[Zr.toLowerCase()]=Br[Zr]});function Wr(Zr){wr.Writable.call(this);var Jr=Br[Zr];if(!Jr)throw new Error("Unknown message digest");this._hashType=Jr.hash,this._hash=br(Jr.hash),this._tag=Jr.id,this._signType=Jr.sign}Er(Wr,wr.Writable),Wr.prototype._write=function(Jr,Qr,_n){this._hash.update(Jr),_n()},Wr.prototype.update=function(Jr,Qr){return this._hash.update(typeof Jr=="string"?fr.from(Jr,Qr):Jr),this},Wr.prototype.sign=function(Jr,Qr){this.end();var _n=this._hash.digest(),En=kr(_n,Jr,this._hashType,this._signType,this._tag);return Qr?En.toString(Qr):En};function qr(Zr){wr.Writable.call(this);var Jr=Br[Zr];if(!Jr)throw new Error("Unknown message digest");this._hash=br(Jr.hash),this._tag=Jr.id,this._signType=Jr.sign}Er(qr,wr.Writable),qr.prototype._write=function(Jr,Qr,_n){this._hash.update(Jr),_n()},qr.prototype.update=function(Jr,Qr){return this._hash.update(typeof Jr=="string"?fr.from(Jr,Qr):Jr),this},qr.prototype.verify=function(Jr,Qr,_n){var En=typeof Qr=="string"?fr.from(Qr,_n):Qr;this.end();var Cn=this._hash.digest();return jr(En,Cn,Jr,this._signType,this._tag)};function Gr(Zr){return new Wr(Zr)}function Vr(Zr){return new qr(Zr)}return browser$8={Sign:Gr,Verify:Vr,createSign:Gr,createVerify:Vr},browser$8}var browser$7,hasRequiredBrowser$2;function requireBrowser$2(){if(hasRequiredBrowser$2)return browser$7;hasRequiredBrowser$2=1;var fr=requireElliptic(),br=requireBn$2();browser$7=function(Br){return new Er(Br)};var wr={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};wr.p224=wr.secp224r1,wr.p256=wr.secp256r1=wr.prime256v1,wr.p192=wr.secp192r1=wr.prime192v1,wr.p384=wr.secp384r1,wr.p521=wr.secp521r1;function Er(jr){this.curveType=wr[jr],this.curveType||(this.curveType={name:jr}),this.curve=new fr.ec(this.curveType.name),this.keys=void 0}Er.prototype.generateKeys=function(jr,Br){return this.keys=this.curve.genKeyPair(),this.getPublicKey(jr,Br)},Er.prototype.computeSecret=function(jr,Br,Wr){Br=Br||"utf8",Buffer$2.isBuffer(jr)||(jr=new Buffer$2(jr,Br));var qr=this.curve.keyFromPublic(jr).getPublic(),Gr=qr.mul(this.keys.getPrivate()).getX();return kr(Gr,Wr,this.curveType.byteLength)},Er.prototype.getPublicKey=function(jr,Br){var Wr=this.keys.getPublic(Br==="compressed",!0);return Br==="hybrid"&&(Wr[Wr.length-1]%2?Wr[0]=7:Wr[0]=6),kr(Wr,jr)},Er.prototype.getPrivateKey=function(jr){return kr(this.keys.getPrivate(),jr)},Er.prototype.setPublicKey=function(jr,Br){return Br=Br||"utf8",Buffer$2.isBuffer(jr)||(jr=new Buffer$2(jr,Br)),this.keys._importPublic(jr),this},Er.prototype.setPrivateKey=function(jr,Br){Br=Br||"utf8",Buffer$2.isBuffer(jr)||(jr=new Buffer$2(jr,Br));var Wr=new br(jr);return Wr=Wr.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(Wr),this};function kr(jr,Br,Wr){Array.isArray(jr)||(jr=jr.toArray());var qr=new Buffer$2(jr);if(Wr&&qr.length=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return En?Wr(An,In):Br(An,In)};function Gr(Jr,Qr){var _n=Jr.modulus.byteLength(),En=Qr.length,Cn=wr("sha1").update(qr.alloc(0)).digest(),In=Cn.length,An=2*In;if(En>_n-An-2)throw new Error("message too long");var jn=qr.alloc(_n-En-An-2),eo=_n-In-1,ro=br(In),to=kr(qr.concat([Cn,jn,qr.alloc(1,1),Qr],eo),Er(ro,eo)),_i=kr(ro,Er(to,In));return new jr(qr.concat([qr.alloc(1),_i,to],_n))}function Vr(Jr,Qr,_n){var En=Qr.length,Cn=Jr.modulus.byteLength();if(En>Cn-11)throw new Error("message too long");var In;return _n?In=qr.alloc(Cn-En-3,255):In=Zr(Cn-En-3),new jr(qr.concat([qr.from([0,_n?1:2]),In,qr.alloc(1),Qr],Cn))}function Zr(Jr){for(var Qr=qr.allocUnsafe(Jr),_n=0,En=br(Jr*2),Cn=0,In;_nIn||new Er(Qr).cmp(Cn.modulus)>=0)throw new Error("decryption error");var An;_n?An=Br(new Er(Qr),Cn):An=kr(Qr,Cn);var jn=Wr.alloc(In-An.length);if(An=Wr.concat([jn,An],In),En===4)return qr(Cn,An);if(En===1)return Gr(Cn,An,_n);if(En===3)return An;throw new Error("unknown padding")};function qr(Zr,Jr){var Qr=Zr.modulus.byteLength(),_n=jr("sha1").update(Wr.alloc(0)).digest(),En=_n.length;if(Jr[0]!==0)throw new Error("decryption error");var Cn=Jr.slice(1,En+1),In=Jr.slice(En+1),An=wr(Cn,br(In,En)),jn=wr(In,br(An,Qr-En-1));if(Vr(_n,jn.slice(0,En)))throw new Error("decryption error");for(var eo=En;jn[eo]===0;)eo++;if(jn[eo++]!==1)throw new Error("decryption error");return jn.slice(eo)}function Gr(Zr,Jr,Qr){for(var _n=Jr.slice(0,2),En=2,Cn=0;Jr[En++]!==0;)if(En>=Jr.length){Cn++;break}var In=Jr.slice(2,En-1);if((_n.toString("hex")!=="0002"&&!Qr||_n.toString("hex")!=="0001"&&Qr)&&Cn++,In.length<8&&Cn++,Cn)throw new Error("decryption error");return Jr.slice(En)}function Vr(Zr,Jr){Zr=Wr.from(Zr),Jr=Wr.from(Jr);var Qr=0,_n=Zr.length;Zr.length!==Jr.length&&(Qr++,_n=Math.min(Zr.length,Jr.length));for(var En=-1;++En<_n;)Qr+=Zr[En]^Jr[En];return Qr}return privateDecrypt}var hasRequiredBrowser$1;function requireBrowser$1(){return hasRequiredBrowser$1||(hasRequiredBrowser$1=1,function(fr){fr.publicEncrypt=requirePublicEncrypt(),fr.privateDecrypt=requirePrivateDecrypt(),fr.privateEncrypt=function(wr,Er){return fr.publicEncrypt(wr,Er,!0)},fr.publicDecrypt=function(wr,Er){return fr.privateDecrypt(wr,Er,!0)}}(browser$6)),browser$6}var browser$5={},hasRequiredBrowser;function requireBrowser(){if(hasRequiredBrowser)return browser$5;hasRequiredBrowser=1;function fr(){throw new Error(`secure random number generation not supported by this browser use chrome, FireFox or Internet Explorer 11`)}var br=safeBufferExports,wr=requireBrowser$b(),Er=br.Buffer,kr=br.kMaxLength,jr=commonjsGlobal.crypto||commonjsGlobal.msCrypto,Br=Math.pow(2,32)-1;function Wr(Jr,Qr){if(typeof Jr!="number"||Jr!==Jr)throw new TypeError("offset must be a number");if(Jr>Br||Jr<0)throw new TypeError("offset must be a uint32");if(Jr>kr||Jr>Qr)throw new RangeError("offset out of range")}function qr(Jr,Qr,_n){if(typeof Jr!="number"||Jr!==Jr)throw new TypeError("size must be a number");if(Jr>Br||Jr<0)throw new TypeError("size must be a uint32");if(Jr+Qr>_n||Jr>kr)throw new RangeError("buffer too small")}jr&&jr.getRandomValues||!process$1$1.browser?(browser$5.randomFill=Gr,browser$5.randomFillSync=Zr):(browser$5.randomFill=fr,browser$5.randomFillSync=fr);function Gr(Jr,Qr,_n,En){if(!Er.isBuffer(Jr)&&!(Jr instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof Qr=="function")En=Qr,Qr=0,_n=Jr.length;else if(typeof _n=="function")En=_n,_n=Jr.length-Qr;else if(typeof En!="function")throw new TypeError('"cb" argument must be a function');return Wr(Qr,Jr.length),qr(_n,Qr,Jr.length),Vr(Jr,Qr,_n,En)}function Vr(Jr,Qr,_n,En){if(process$1$1.browser){var Cn=Jr.buffer,In=new Uint8Array(Cn,Qr,_n);if(jr.getRandomValues(In),En){process$1$1.nextTick(function(){En(null,Jr)});return}return Jr}if(En){wr(_n,function(jn,eo){if(jn)return En(jn);eo.copy(Jr,Qr),En(null,Jr)});return}var An=wr(_n);return An.copy(Jr,Qr),Jr}function Zr(Jr,Qr,_n){if(typeof Qr>"u"&&(Qr=0),!Er.isBuffer(Jr)&&!(Jr instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return Wr(Qr,Jr.length),_n===void 0&&(_n=Jr.length-Qr),qr(_n,Qr,Jr.length),Vr(Jr,Qr,_n)}return browser$5}var hasRequiredCryptoBrowserify;function requireCryptoBrowserify(){if(hasRequiredCryptoBrowserify)return cryptoBrowserify;hasRequiredCryptoBrowserify=1,cryptoBrowserify.randomBytes=cryptoBrowserify.rng=cryptoBrowserify.pseudoRandomBytes=cryptoBrowserify.prng=requireBrowser$b(),cryptoBrowserify.createHash=cryptoBrowserify.Hash=requireBrowser$9(),cryptoBrowserify.createHmac=cryptoBrowserify.Hmac=requireBrowser$8();var fr=requireAlgos(),br=Object.keys(fr),wr=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(br);cryptoBrowserify.getHashes=function(){return wr};var Er=requireBrowser$7();cryptoBrowserify.pbkdf2=Er.pbkdf2,cryptoBrowserify.pbkdf2Sync=Er.pbkdf2Sync;var kr=requireBrowser$5();cryptoBrowserify.Cipher=kr.Cipher,cryptoBrowserify.createCipher=kr.createCipher,cryptoBrowserify.Cipheriv=kr.Cipheriv,cryptoBrowserify.createCipheriv=kr.createCipheriv,cryptoBrowserify.Decipher=kr.Decipher,cryptoBrowserify.createDecipher=kr.createDecipher,cryptoBrowserify.Decipheriv=kr.Decipheriv,cryptoBrowserify.createDecipheriv=kr.createDecipheriv,cryptoBrowserify.getCiphers=kr.getCiphers,cryptoBrowserify.listCiphers=kr.listCiphers;var jr=requireBrowser$4();cryptoBrowserify.DiffieHellmanGroup=jr.DiffieHellmanGroup,cryptoBrowserify.createDiffieHellmanGroup=jr.createDiffieHellmanGroup,cryptoBrowserify.getDiffieHellman=jr.getDiffieHellman,cryptoBrowserify.createDiffieHellman=jr.createDiffieHellman,cryptoBrowserify.DiffieHellman=jr.DiffieHellman;var Br=requireBrowser$3();cryptoBrowserify.createSign=Br.createSign,cryptoBrowserify.Sign=Br.Sign,cryptoBrowserify.createVerify=Br.createVerify,cryptoBrowserify.Verify=Br.Verify,cryptoBrowserify.createECDH=requireBrowser$2();var Wr=requireBrowser$1();cryptoBrowserify.publicEncrypt=Wr.publicEncrypt,cryptoBrowserify.privateEncrypt=Wr.privateEncrypt,cryptoBrowserify.publicDecrypt=Wr.publicDecrypt,cryptoBrowserify.privateDecrypt=Wr.privateDecrypt;var qr=requireBrowser();return cryptoBrowserify.randomFill=qr.randomFill,cryptoBrowserify.randomFillSync=qr.randomFillSync,cryptoBrowserify.createCredentials=function(){throw new Error(`sorry, createCredentials is not implemented yet we accept pull requests -https://github.com/browserify/crypto-browserify`)},cryptoBrowserify.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},cryptoBrowserify}(function(fr,br){(function(wr,Er){fr.exports=Er(requireCryptoBrowserify())})(commonjsGlobal,function(wr){var Er,kr,jr,Br,Wr;function qr(){Er={bits:8,radix:16,minBits:3,maxBits:20,bytesPerChar:2,maxBytesPerChar:6,primitivePolynomials:[null,null,1,3,3,5,3,3,29,17,9,5,83,27,43,3,45,9,39,39,9,5,3,33,27,9,71,39,9,5,83]},kr={},jr=new Array(1024).join("0"),Br=!0,Wr=["nodeCryptoRandomBytes","browserCryptoGetRandomValues","testRandom"]}function Gr(){return!!(kr&&kr.rng&&typeof kr.rng=="function")}function Vr(to,_i){var oo;if(_i===0||_i===1)return to;if(_i&&_i>1024)throw new Error("Padding must be multiples of no larger than 1024 bits.");return _i=_i||kr.bits,to&&(oo=to.length%_i),oo?(jr+to).slice(-(_i-oo+to.length)):to}function Zr(to){var _i="",oo,io;for(io=to.length-1;io>=0;io--){if(oo=parseInt(to[io],16),isNaN(oo))throw new Error("Invalid hex character.");_i=Vr(oo.toString(2),4)+_i}return _i}function Jr(to){var _i="",oo,io;for(to=Vr(to,4),io=to.length;io>=4;io-=4){if(oo=parseInt(to.slice(io-4,io),2),isNaN(oo))throw new Error("Invalid binary character.");_i=oo.toString(16)+_i}return _i}function Qr(){return!!(wr&&typeof wr=="object"&&(typeof wr.getRandomValues=="function"||typeof wr.getRandomValues=="object")&&(typeof Uint32Array=="function"||typeof Uint32Array=="object"))}function _n(){return typeof wr=="object"&&typeof wr.randomBytes=="function"}function En(to){function _i(so,no,Tn,Hr){var Xr=0,Sn,Rn="",Pn;for(no&&(Sn=no.length-1);Xrkr.bits;io-=kr.bits)oo.push(parseInt(to.slice(io-kr.bits,io),2));return oo.push(parseInt(to.slice(0,io),2)),oo}function In(to,_i){var oo=kr.logs[to],io=0,co;for(co=_i.length-1;co>=0;co--)io!==0?io=kr.exps[(oo+kr.logs[io])%kr.maxShares]^_i[co]:io=_i[co];return io}function An(to,_i,oo){var io=0,co,so,no,Tn;for(no=0,co=_i.length;noso)throw new Error("Share id must be an integer between 1 and "+so+", inclusive.");return Tn=io+co+oo,Tn}var ro={init:function(to,_i){var oo=[],io=[],co=1,so,no;if(qr(),to&&(typeof to!="number"||to%1!==0||toEr.maxBits))throw new Error("Number of bits must be an integer between "+Er.minBits+" and "+Er.maxBits+", inclusive.");if(_i&&Wr.indexOf(_i)===-1)throw new Error("Invalid RNG type argument : '"+_i+"'");for(kr.radix=Er.radix,kr.bits=to||Er.bits,kr.size=Math.pow(2,kr.bits),kr.maxShares=kr.size-1,so=Er.primitivePolynomials[kr.bits],no=0;no=kr.size&&(co=co^so,co=co&kr.maxShares);if(kr.logs=oo,kr.exps=io,_i&&this.setRNG(_i),Gr()||this.setRNG(),!Gr()||!kr.bits||!kr.size||!kr.maxShares||!kr.logs||!kr.exps||kr.logs.length!==kr.size||kr.exps.length!==kr.size)throw new Error("Initialization failed.")},combine:function(to,_i){var oo,io,co,so,no="",Tn,Hr,Xr,Sn=[],Rn=[];for(_i=_i||0,oo=0,co=to.length;oo=1?no:no.slice(no.indexOf("1")+1))},getConfig:function(){var to={};return to.radix=kr.radix,to.bits=kr.bits,to.maxShares=kr.maxShares,to.hasCSPRNG=Gr(),to.typeCSPRNG=kr.typeCSPRNG,to},extractShareComponents:function(to){var _i,oo,io,co,so={},no,Tn;if(_i=parseInt(to.substr(0,1),36),_i&&(typeof _i!="number"||_i%1!==0||_iEr.maxBits))throw new Error("Invalid share : Number of bits must be an integer between "+Er.minBits+" and "+Er.maxBits+", inclusive.");if(co=Math.pow(2,_i)-1,io=(Math.pow(2,_i)-1).toString(kr.radix).length,no="^([a-kA-K3-9]{1})([a-fA-F0-9]{"+io+"})([a-fA-F0-9]+)$",Tn=new RegExp(no).exec(to),Tn&&(oo=parseInt(Tn[2],kr.radix)),typeof oo!="number"||oo%1!==0||oo<1||oo>co)throw new Error("Invalid share : Share id must be an integer between 1 and "+kr.maxShares+", inclusive.");if(Tn&&Tn[3])return so.bits=_i,so.id=oo,so.data=Tn[3],so;throw new Error("The share data provided is invalid : "+to)},setRNG:function(to){var _i="Random number generator is invalid ",oo=" Supply an CSPRNG of the form function(bits){} that returns a string containing 'bits' number of random 1's and 0's.";if(to&&typeof to=="string"&&Wr.indexOf(to)===-1)throw new Error("Invalid RNG type argument : '"+to+"'");if(to||(to=En()),to&&typeof to=="string"&&(to=En(to)),Br){if(to&&typeof to!="function")throw new Error(_i+"(Not a function)."+oo);if(to&&typeof to(kr.bits)!="string")throw new Error(_i+"(Output is not a string)."+oo);if(to&&!parseInt(to(kr.bits),2))throw new Error(_i+"(Binary string output not parseable to an Integer)."+oo);if(to&&to(kr.bits).length>kr.bits)throw new Error(_i+"(Output length is greater than config.bits)."+oo);if(to&&to(kr.bits).lengthEr.maxBytesPerChar||_i%1!==0)throw new Error("Bytes per character must be an integer between 1 and "+Er.maxBytesPerChar+", inclusive.");for(oo=2*_i,io=Math.pow(16,oo)-1,Tn=0,Hr=to.length;Tnio)throw so=Math.ceil(Math.log(no+1)/Math.log(256)),new Error("Invalid character code ("+no+"). Maximum allowable is 256^bytes-1 ("+io+"). To convert this character, use at least "+so+" bytes.");co=Vr(no.toString(16),oo)+co}return co},hex2str:function(to,_i){var oo,io="",co,so;if(typeof to!="string")throw new Error("Input must be a hexadecimal string.");if(_i=_i||Er.bytesPerChar,typeof _i!="number"||_i%1!==0||_i<1||_i>Er.maxBytesPerChar)throw new Error("Bytes per character must be an integer between 1 and "+Er.maxBytesPerChar+", inclusive.");for(oo=2*_i,to=Vr(to,oo),co=0,so=to.length;co65536)throw new Error("Number of bits must be an Integer between 1 and 65536.");return Jr(kr.rng(to))},share:function(to,_i,oo,io){var co,so,no=new Array(_i),Tn=new Array(_i),Hr,Xr,Sn;if(io=io||128,typeof to!="string")throw new Error("Secret must be a string.");if(typeof _i!="number"||_i%1!==0||_i<2)throw new Error("Number of shares must be an integer between 2 and 2^bits-1 ("+kr.maxShares+"), inclusive.");if(_i>kr.maxShares)throw co=Math.ceil(Math.log(_i+1)/Math.LN2),new Error("Number of shares must be an integer between 2 and 2^bits-1 ("+kr.maxShares+"), inclusive. To create "+_i+" shares, use at least "+co+" bits.");if(typeof oo!="number"||oo%1!==0||oo<2)throw new Error("Threshold number of shares must be an integer between 2 and 2^bits-1 ("+kr.maxShares+"), inclusive.");if(oo>kr.maxShares)throw co=Math.ceil(Math.log(oo+1)/Math.LN2),new Error("Threshold number of shares must be an integer between 2 and 2^bits-1 ("+kr.maxShares+"), inclusive. To use a threshold of "+oo+", use at least "+co+" bits.");if(oo>_i)throw new Error("Threshold number of shares was "+oo+" but must be less than or equal to the "+_i+" shares specified as the total to generate.");if(typeof io!="number"||io%1!==0||io<0||io>1024)throw new Error("Zero-pad length must be an integer between 0 and 1024 inclusive.");for(to="1"+Zr(to),to=Cn(to,io),Hr=0,Sn=to.length;Hr{if(fr){const br=fr.substring(0,7),wr=fr.substring(fr.length-7);return br+"..."+wr}return""},handleCopy=async(fr,br)=>{try{await navigator.clipboard.writeText(fr),br==null||br(!0),setTimeout(()=>br==null?void 0:br(!1),2e3)}catch(wr){console.error("Failed to copy text: ",wr)}},AppConnections=({selectedWallet:fr,appConnection:br})=>{const wr=fr==null?void 0:fr.fullAddress,{state:Er,dispatch:kr}=useGlobalState(),jr=qr=>{var Gr;Er.wallet&&((Gr=Er==null?void 0:Er.wallet)==null||Gr.acceptConnectionReq(qr),kr({type:"INITIALIZE_WALLET",payload:Er.wallet}))},Br=qr=>{var Gr;Er.wallet&&((Gr=Er==null?void 0:Er.wallet)==null||Gr.rejectConnectionReq(qr),kr({type:"INITIALIZE_WALLET",payload:Er.wallet}))},Wr=async()=>{var qr;Er.wallet&&((qr=Er==null?void 0:Er.wallet)==null||qr.rejectAllConnectionReqs(),kr({type:"INITIALIZE_WALLET",payload:Er.wallet}))};return jsxRuntimeExports.jsx(Box,{position:"absolute",height:"100%",width:"100%",alignItems:"flex-end",display:"flex",borderRadius:"radius-md",css:Ae$2` +https://github.com/browserify/crypto-browserify`)},cryptoBrowserify.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},cryptoBrowserify}(function(fr,br){(function(wr,Er){fr.exports=Er(requireCryptoBrowserify())})(commonjsGlobal,function(wr){var Er,kr,jr,Br,Wr;function qr(){Er={bits:8,radix:16,minBits:3,maxBits:20,bytesPerChar:2,maxBytesPerChar:6,primitivePolynomials:[null,null,1,3,3,5,3,3,29,17,9,5,83,27,43,3,45,9,39,39,9,5,3,33,27,9,71,39,9,5,83]},kr={},jr=new Array(1024).join("0"),Br=!0,Wr=["nodeCryptoRandomBytes","browserCryptoGetRandomValues","testRandom"]}function Gr(){return!!(kr&&kr.rng&&typeof kr.rng=="function")}function Vr(to,_i){var oo;if(_i===0||_i===1)return to;if(_i&&_i>1024)throw new Error("Padding must be multiples of no larger than 1024 bits.");return _i=_i||kr.bits,to&&(oo=to.length%_i),oo?(jr+to).slice(-(_i-oo+to.length)):to}function Zr(to){var _i="",oo,io;for(io=to.length-1;io>=0;io--){if(oo=parseInt(to[io],16),isNaN(oo))throw new Error("Invalid hex character.");_i=Vr(oo.toString(2),4)+_i}return _i}function Jr(to){var _i="",oo,io;for(to=Vr(to,4),io=to.length;io>=4;io-=4){if(oo=parseInt(to.slice(io-4,io),2),isNaN(oo))throw new Error("Invalid binary character.");_i=oo.toString(16)+_i}return _i}function Qr(){return!!(wr&&typeof wr=="object"&&(typeof wr.getRandomValues=="function"||typeof wr.getRandomValues=="object")&&(typeof Uint32Array=="function"||typeof Uint32Array=="object"))}function _n(){return typeof wr=="object"&&typeof wr.randomBytes=="function"}function En(to){function _i(so,no,Tn,Hr){var Xr=0,Sn,Rn="",Pn;for(no&&(Sn=no.length-1);Xrkr.bits;io-=kr.bits)oo.push(parseInt(to.slice(io-kr.bits,io),2));return oo.push(parseInt(to.slice(0,io),2)),oo}function In(to,_i){var oo=kr.logs[to],io=0,co;for(co=_i.length-1;co>=0;co--)io!==0?io=kr.exps[(oo+kr.logs[io])%kr.maxShares]^_i[co]:io=_i[co];return io}function An(to,_i,oo){var io=0,co,so,no,Tn;for(no=0,co=_i.length;noso)throw new Error("Share id must be an integer between 1 and "+so+", inclusive.");return Tn=io+co+oo,Tn}var ro={init:function(to,_i){var oo=[],io=[],co=1,so,no;if(qr(),to&&(typeof to!="number"||to%1!==0||toEr.maxBits))throw new Error("Number of bits must be an integer between "+Er.minBits+" and "+Er.maxBits+", inclusive.");if(_i&&Wr.indexOf(_i)===-1)throw new Error("Invalid RNG type argument : '"+_i+"'");for(kr.radix=Er.radix,kr.bits=to||Er.bits,kr.size=Math.pow(2,kr.bits),kr.maxShares=kr.size-1,so=Er.primitivePolynomials[kr.bits],no=0;no=kr.size&&(co=co^so,co=co&kr.maxShares);if(kr.logs=oo,kr.exps=io,_i&&this.setRNG(_i),Gr()||this.setRNG(),!Gr()||!kr.bits||!kr.size||!kr.maxShares||!kr.logs||!kr.exps||kr.logs.length!==kr.size||kr.exps.length!==kr.size)throw new Error("Initialization failed.")},combine:function(to,_i){var oo,io,co,so,no="",Tn,Hr,Xr,Sn=[],Rn=[];for(_i=_i||0,oo=0,co=to.length;oo=1?no:no.slice(no.indexOf("1")+1))},getConfig:function(){var to={};return to.radix=kr.radix,to.bits=kr.bits,to.maxShares=kr.maxShares,to.hasCSPRNG=Gr(),to.typeCSPRNG=kr.typeCSPRNG,to},extractShareComponents:function(to){var _i,oo,io,co,so={},no,Tn;if(_i=parseInt(to.substr(0,1),36),_i&&(typeof _i!="number"||_i%1!==0||_iEr.maxBits))throw new Error("Invalid share : Number of bits must be an integer between "+Er.minBits+" and "+Er.maxBits+", inclusive.");if(co=Math.pow(2,_i)-1,io=(Math.pow(2,_i)-1).toString(kr.radix).length,no="^([a-kA-K3-9]{1})([a-fA-F0-9]{"+io+"})([a-fA-F0-9]+)$",Tn=new RegExp(no).exec(to),Tn&&(oo=parseInt(Tn[2],kr.radix)),typeof oo!="number"||oo%1!==0||oo<1||oo>co)throw new Error("Invalid share : Share id must be an integer between 1 and "+kr.maxShares+", inclusive.");if(Tn&&Tn[3])return so.bits=_i,so.id=oo,so.data=Tn[3],so;throw new Error("The share data provided is invalid : "+to)},setRNG:function(to){var _i="Random number generator is invalid ",oo=" Supply an CSPRNG of the form function(bits){} that returns a string containing 'bits' number of random 1's and 0's.";if(to&&typeof to=="string"&&Wr.indexOf(to)===-1)throw new Error("Invalid RNG type argument : '"+to+"'");if(to||(to=En()),to&&typeof to=="string"&&(to=En(to)),Br){if(to&&typeof to!="function")throw new Error(_i+"(Not a function)."+oo);if(to&&typeof to(kr.bits)!="string")throw new Error(_i+"(Output is not a string)."+oo);if(to&&!parseInt(to(kr.bits),2))throw new Error(_i+"(Binary string output not parseable to an Integer)."+oo);if(to&&to(kr.bits).length>kr.bits)throw new Error(_i+"(Output length is greater than config.bits)."+oo);if(to&&to(kr.bits).lengthEr.maxBytesPerChar||_i%1!==0)throw new Error("Bytes per character must be an integer between 1 and "+Er.maxBytesPerChar+", inclusive.");for(oo=2*_i,io=Math.pow(16,oo)-1,Tn=0,Hr=to.length;Tnio)throw so=Math.ceil(Math.log(no+1)/Math.log(256)),new Error("Invalid character code ("+no+"). Maximum allowable is 256^bytes-1 ("+io+"). To convert this character, use at least "+so+" bytes.");co=Vr(no.toString(16),oo)+co}return co},hex2str:function(to,_i){var oo,io="",co,so;if(typeof to!="string")throw new Error("Input must be a hexadecimal string.");if(_i=_i||Er.bytesPerChar,typeof _i!="number"||_i%1!==0||_i<1||_i>Er.maxBytesPerChar)throw new Error("Bytes per character must be an integer between 1 and "+Er.maxBytesPerChar+", inclusive.");for(oo=2*_i,to=Vr(to,oo),co=0,so=to.length;co65536)throw new Error("Number of bits must be an Integer between 1 and 65536.");return Jr(kr.rng(to))},share:function(to,_i,oo,io){var co,so,no=new Array(_i),Tn=new Array(_i),Hr,Xr,Sn;if(io=io||128,typeof to!="string")throw new Error("Secret must be a string.");if(typeof _i!="number"||_i%1!==0||_i<2)throw new Error("Number of shares must be an integer between 2 and 2^bits-1 ("+kr.maxShares+"), inclusive.");if(_i>kr.maxShares)throw co=Math.ceil(Math.log(_i+1)/Math.LN2),new Error("Number of shares must be an integer between 2 and 2^bits-1 ("+kr.maxShares+"), inclusive. To create "+_i+" shares, use at least "+co+" bits.");if(typeof oo!="number"||oo%1!==0||oo<2)throw new Error("Threshold number of shares must be an integer between 2 and 2^bits-1 ("+kr.maxShares+"), inclusive.");if(oo>kr.maxShares)throw co=Math.ceil(Math.log(oo+1)/Math.LN2),new Error("Threshold number of shares must be an integer between 2 and 2^bits-1 ("+kr.maxShares+"), inclusive. To use a threshold of "+oo+", use at least "+co+" bits.");if(oo>_i)throw new Error("Threshold number of shares was "+oo+" but must be less than or equal to the "+_i+" shares specified as the total to generate.");if(typeof io!="number"||io%1!==0||io<0||io>1024)throw new Error("Zero-pad length must be an integer between 0 and 1024 inclusive.");for(to="1"+Zr(to),to=Cn(to,io),Hr=0,Sn=to.length;Hr{const{primaryWallet:wr}=useDynamicContext(),{dispatch:Er}=useGlobalState(),kr=async()=>{try{br(!0);const qr=await PushWallet.signUp(config.APP_ENV);await jr(qr)}catch(qr){alert(qr)}},jr=async qr=>{const Gr=await PushSigner.initialize(wr,"DYNAMIC");await(qr==null?void 0:qr.connectWalletWithAccount(Gr)),await Br(qr)},Br=async qr=>{if(qr){try{await qr.registerPushAccount(),Er({type:"INITIALIZE_WALLET",payload:qr})}catch(Gr){alert(Gr)}br(!1)}},Wr=async()=>{await kr()};return jsxRuntimeExports.jsxs(Box,{padding:"spacing-xs",display:"flex",flexDirection:"column",justifyContent:"center",borderRadius:"radius-sm",backgroundColor:"surface-secondary",gap:"spacing-xs",position:"absolute",css:Ae$2` + bottom: 24px; + `,width:"328px",children:[jsxRuntimeExports.jsxs(Text,{color:"text-secondary",variant:"bes-semibold",children:["You are browsing using an external wallet.",jsxRuntimeExports.jsx("br",{})," Create an account & link wallet to unlock all features."]}),jsxRuntimeExports.jsx(Button,{size:"extraSmall",block:!0,onClick:()=>Wr(),children:"Create Account"})]})},centerMaskWalletAddress=fr=>{if(fr){const br=fr.substring(0,7),wr=fr.substring(fr.length-7);return br+"..."+wr}return""},handleCopy=async(fr,br)=>{try{await navigator.clipboard.writeText(fr),br==null||br(!0),setTimeout(()=>br==null?void 0:br(!1),2e3)}catch(wr){console.error("Failed to copy text: ",wr)}},AppConnections=({selectedWallet:fr,appConnection:br})=>{const wr=fr==null?void 0:fr.fullAddress,{state:Er,dispatch:kr}=useGlobalState(),jr=qr=>{var Gr;Er.wallet&&((Gr=Er==null?void 0:Er.wallet)==null||Gr.acceptConnectionReq(qr),kr({type:"INITIALIZE_WALLET",payload:Er.wallet}))},Br=qr=>{var Gr;Er.wallet&&((Gr=Er==null?void 0:Er.wallet)==null||Gr.rejectConnectionReq(qr),kr({type:"INITIALIZE_WALLET",payload:Er.wallet}))},Wr=async()=>{var qr;Er.wallet&&((qr=Er==null?void 0:Er.wallet)==null||qr.rejectAllConnectionReqs(),kr({type:"INITIALIZE_WALLET",payload:Er.wallet}))};return jsxRuntimeExports.jsx(Box,{position:"absolute",height:"100%",width:"100%",alignItems:"flex-end",display:"flex",borderRadius:"radius-md",css:Ae$2` background: rgba(0, 0, 0, 0.5); bottom: 0; left: 0; @@ -3789,7 +3793,7 @@ https://github.com/browserify/crypto-browserify`)},cryptoBrowserify.constants={D background: #fff; `,height:"52px",width:"52px",justifyContent:"center",alignItems:"center",borderRadius:"radius-xl",children:jsxRuntimeExports.jsx(PushLogo,{height:32,width:32})}),jsxRuntimeExports.jsx(Text,{variant:"h6-regular",textAlign:"center",children:br==null?void 0:br.origin})]}),jsxRuntimeExports.jsxs(Box,{display:"flex",flexDirection:"column",gap:"spacing-xxxs",children:[jsxRuntimeExports.jsx(Text,{variant:"h4-semibold",textAlign:"center",children:"Connect to this site"}),jsxRuntimeExports.jsxs(Text,{variant:"bs-regular",textAlign:"center",color:"text-tertiary",children:["Allow the site to see account balance,",jsxRuntimeExports.jsx("br",{})," activity and suggest transactions to approve"]})]}),jsxRuntimeExports.jsxs(Box,{display:"flex",padding:"spacing-xs",gap:"spacing-sm",borderRadius:"radius-sm",backgroundColor:"surface-secondary",flexDirection:"column",width:"100%",children:[jsxRuntimeExports.jsxs(Box,{display:"flex",gap:"spacing-xs",children:[jsxRuntimeExports.jsx(Box,{width:"40px",height:"40px",borderRadius:"radius-xl",overflow:"hidden",alignSelf:"center",children:jsxRuntimeExports.jsx(BlockiesSvg,{address:"321ed12e"})}),jsxRuntimeExports.jsxs(Box,{display:"flex",flexDirection:"column",children:[jsxRuntimeExports.jsx(Text,{variant:"bm-semibold",children:"Push Wallet"}),jsxRuntimeExports.jsx(Text,{variant:"bes-semibold",color:"text-tertiary",children:centerMaskWalletAddress(wr)})]})]}),jsxRuntimeExports.jsxs(Box,{display:"flex",gap:"spacing-xs",children:[jsxRuntimeExports.jsx(Button,{size:"small",variant:"outline",onClick:()=>Br(br==null?void 0:br.origin),children:"Reject"}),jsxRuntimeExports.jsx(Button,{size:"small",variant:"primary",css:Ae$2` width: 66%; - `,onClick:()=>jr(br==null?void 0:br.origin),children:"Connect"})]})]})]})})},Wallet$1=()=>{var An,jn,eo;const{state:fr,dispatch:br}=useGlobalState(),[wr,Er]=reactExports.useState(!0),[kr,jr]=reactExports.useState(""),{primaryWallet:Br}=useDynamicContext(),[Wr,qr]=reactExports.useState(!1);console.debug(fr,"wallets address");const[Gr,Vr]=reactExports.useState(),Zr=useNavigate(),Jr=async ro=>{try{Er(!0);const to=await PushWallet.signUp("dev"),_i=Buffer$2.from(to.mnemonic).toString("hex"),oo=secrets.share(_i,3,2);await api$2.post(`/mnemonic-share/${ro}`,{share:oo[0]}),localStorage.setItem(`mnemonicShare2:${ro}`,oo[1]),await to.storeMnemonicShareAsEncryptedTx(ro,oo[2],to.mnemonic),await to.registerPushAccount(),console.debug(to,"wallets address"),br({type:"INITIALIZE_WALLET",payload:to}),console.info("Wallet created and mnemonic split into shares",{userId:ro})}catch(to){throw console.error("Error creating wallet:",to),to}finally{Er(!1)}},Qr=async(ro,to)=>{try{Er(!0);const _i=secrets.combine([ro,to]),oo=Buffer$2.from(_i,"hex").toString(),io=await PushWallet.logInWithMnemonic(oo,"dev");br({type:"INITIALIZE_WALLET",payload:io}),console.info("Wallet reconstructed successfully")}catch(_i){throw console.log("Error in reconstructing wallet",_i),console.error("Error reconstructing wallet:",_i),jr("Failed to reconstruct wallet. Please try again."),_i}finally{Er(!1)}},_n=async ro=>{try{Er(!0);const to=await api$2.get("/auth/user",{headers:{Authorization:`Bearer ${ro}`}}),_i=to.data.id;if(br({type:"SET_USER",payload:to.data}),br({type:"SET_AUTHENTICATED",payload:!0}),!fr.wallet){let oo,io,co;try{if(oo=(await api$2.get(`/mnemonic-share/${_i}`)).data.share,io=localStorage.getItem(`mnemonicShare2:${_i}`),oo&&io){console.info("Reconstructing wallet with share1 and share2",{userId:_i}),await Qr(oo,io);return}}catch(no){console.debug("Share1 not available",{userId:_i,error:no.message})}if(!oo||!io)try{if(co=await PushWallet.retrieveMnemonicShareFromTx("dev",_i),oo&&co){console.info("Reconstructing wallet with share1 and share3",{userId:_i}),await Qr(oo,co);return}if(io&&co){console.info("Reconstructing wallet with share2 and share3",{userId:_i}),await Qr(io,co);return}}catch(no){console.debug("Share3 not available",{userId:_i,error:no.message})}const so=oo||io||co;if(console.log("Only single share is present",so),so){qr(!0);return}console.info("Creating new wallet",{userId:_i,availableShares:{share1:!!oo,share2:!!io,share3:!!co}}),await Jr(_i)}}catch(to){throw console.error("Error fetching user profile:",to),jr("Failed to fetch user profile. Please try again."),Cn(),to}finally{Er(!1)}};reactExports.useEffect(()=>{(async()=>{try{fr.jwt?(Er(!0),await _n(fr.jwt)):Br&&Zr(APP_ROUTES.AUTH)}catch(to){console.error("Error initializing profile:",to),jr("Failed to initialize profile"),Cn()}finally{Er(!1)}})()},[Br]);const En=async()=>{try{await Jr(fr.user.id)}catch(ro){console.log("Error in creating new Wallet",ro),Cn()}finally{qr(!1)}},Cn=()=>{sessionStorage.removeItem("jwt"),br({type:"RESET_AUTHENTICATED"}),br({type:"RESET_USER"}),localStorage.clear(),Zr(APP_ROUTES.AUTH)};reactExports.useEffect(()=>{var ro,to;(ro=fr==null?void 0:fr.wallet)!=null&&ro.attachedAccounts.length&&Vr(getWalletlist((to=fr==null?void 0:fr.wallet)==null?void 0:to.attachedAccounts,fr.wallet)[0])},[(An=fr==null?void 0:fr.wallet)==null?void 0:An.attachedAccounts]);const In=(jn=fr==null?void 0:fr.wallet)==null?void 0:jn.appConnections.some(ro=>ro.isPending===!0);return wr?jsxRuntimeExports.jsx(WalletSkeletonScreen,{content:jsxRuntimeExports.jsx(PushWalletLoadingContent,{})}):Wr?jsxRuntimeExports.jsx(WalletSkeletonScreen,{content:jsxRuntimeExports.jsx(WalletReconstructionErrorContent,{onSuccess:En,onError:Cn})}):jsxRuntimeExports.jsx(ContentLayout,{children:jsxRuntimeExports.jsx(BoxLayout,{children:jsxRuntimeExports.jsxs(Box,{flexDirection:"column",display:"flex",width:"376px",padding:"spacing-md",gap:"spacing-sm",position:"relative",children:[In&&jsxRuntimeExports.jsx(AppConnections,{selectedWallet:Gr,appConnection:fr.wallet.appConnections[fr.wallet.appConnections.length-1]}),jsxRuntimeExports.jsx(WalletProfile,{selectedWallet:Gr}),jsxRuntimeExports.jsx(WalletTabs,{walletList:getWalletlist((eo=fr==null?void 0:fr.wallet)==null?void 0:eo.attachedAccounts,fr.wallet),selectedWallet:Gr,setSelectedWallet:Vr})]})})})},PrivateRoute=({children:fr})=>{const{state:{walletLoadState:br,jwt:wr,dynamicWallet:Er}}=useGlobalState();return br==="idle"||br==="loading"?jsxRuntimeExports.jsx(WalletSkeletonScreen,{content:jsxRuntimeExports.jsx(PushWalletLoadingContent,{})}):br==="success"&&wr?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:fr}):br==="success"&&Er?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:fr}):jsxRuntimeExports.jsx(Navigate,{to:APP_ROUTES.AUTH})},RouterContainer=()=>jsxRuntimeExports.jsxs(Routes,{children:[jsxRuntimeExports.jsx(Route,{path:"/",element:jsxRuntimeExports.jsx(Navigate,{to:APP_ROUTES.WALLET})}),jsxRuntimeExports.jsx(Route,{path:APP_ROUTES.WALLET,element:jsxRuntimeExports.jsx(PrivateRoute,{children:jsxRuntimeExports.jsx(Wallet$1,{})})}),jsxRuntimeExports.jsx(Route,{path:APP_ROUTES.AUTH,element:jsxRuntimeExports.jsx(Authentication,{})})]}),ROWS=10,WalletSkeletonScreen=({content:fr})=>jsxRuntimeExports.jsx(ContentLayout,{children:jsxRuntimeExports.jsx(BoxLayout,{children:jsxRuntimeExports.jsxs(Box,{alignItems:"start",flexDirection:"column",display:"flex",height:"570px",justifyContent:"start",width:"376px",padding:"spacing-md",gap:"spacing-xs",margin:"spacing-sm spacing-none spacing-none spacing-none",children:[jsxRuntimeExports.jsx(Box,{width:"100%",display:"flex",alignItems:"start",children:jsxRuntimeExports.jsx(PushLogo,{height:48,width:48})}),jsxRuntimeExports.jsxs(Box,{alignItems:"center",flexDirection:"column",display:"flex",width:"100%",gap:"spacing-xxs",children:[jsxRuntimeExports.jsxs(Box,{alignItems:"center",flexDirection:"column",display:"flex",gap:"spacing-sm",width:"100%",children:[jsxRuntimeExports.jsx(Skeleton,{isLoading:!0,borderRadius:"radius-round",children:jsxRuntimeExports.jsx(Box,{width:"50px",height:"50px",borderRadius:"radius-round"})}),jsxRuntimeExports.jsxs(Box,{alignItems:"center",flexDirection:"column",display:"flex",gap:"spacing-xxxs",children:[jsxRuntimeExports.jsx(Skeleton,{isLoading:!0,children:jsxRuntimeExports.jsx(Box,{height:"12px",width:"104px"})}),jsxRuntimeExports.jsx(Skeleton,{isLoading:!0,children:jsxRuntimeExports.jsx(Box,{height:"12px",width:"104px"})})]})]}),jsxRuntimeExports.jsx(Box,{display:"flex",flexDirection:"column",width:"100%",alignItems:"start",padding:"spacing-sm",css:Ae$2` + `,onClick:()=>jr(br==null?void 0:br.origin),children:"Connect"})]})]})]})})},Wallet$1=()=>{var jn,eo,ro;const{state:fr,dispatch:br}=useGlobalState(),[wr,Er]=reactExports.useState(!0),[kr,jr]=reactExports.useState(""),{primaryWallet:Br}=useDynamicContext(),[Wr,qr]=reactExports.useState(!1),[Gr,Vr]=reactExports.useState(),Zr=useNavigate(),Jr=usePersistedQuery(),Qr=async to=>{try{Er(!0);const _i=await PushWallet.signUp("dev"),oo=Buffer$2.from(_i.mnemonic).toString("hex"),io=secrets.share(oo,3,2);await api$2.post(`/mnemonic-share/${to}`,{share:io[0]}),localStorage.setItem(`mnemonicShare2:${to}`,io[1]),await _i.storeMnemonicShareAsEncryptedTx(to,io[2],_i.mnemonic),await _i.registerPushAccount(),br({type:"INITIALIZE_WALLET",payload:_i}),console.info("Wallet created and mnemonic split into shares",{userId:to})}catch(_i){throw console.error("Error creating wallet:",_i),_i}finally{Er(!1)}},_n=async(to,_i)=>{try{Er(!0);const oo=secrets.combine([to,_i]),io=Buffer$2.from(oo,"hex").toString(),co=await PushWallet.logInWithMnemonic(io,"dev");br({type:"INITIALIZE_WALLET",payload:co}),console.info("Wallet reconstructed successfully")}catch(oo){throw console.log("Error in reconstructing wallet",oo),console.error("Error reconstructing wallet:",oo),jr("Failed to reconstruct wallet. Please try again."),oo}finally{Er(!1)}},En=async to=>{try{Er(!0);const _i=await api$2.get("/auth/user",{headers:{Authorization:`Bearer ${to}`}}),oo=_i.data.id;if(br({type:"SET_USER",payload:_i.data}),br({type:"SET_AUTHENTICATED",payload:!0}),!fr.wallet){let io,co,so;try{if(io=(await api$2.get(`/mnemonic-share/${oo}`)).data.share,co=localStorage.getItem(`mnemonicShare2:${oo}`),io&&co){console.info("Reconstructing wallet with share1 and share2",{userId:oo}),await _n(io,co);return}}catch(Tn){console.debug("Share1 not available",{userId:oo,error:Tn.message})}if(!io||!co)try{if(so=await PushWallet.retrieveMnemonicShareFromTx("dev",oo),io&&so){console.info("Reconstructing wallet with share1 and share3",{userId:oo}),await _n(io,so);return}if(co&&so){console.info("Reconstructing wallet with share2 and share3",{userId:oo}),await _n(co,so);return}}catch(Tn){console.debug("Share3 not available",{userId:oo,error:Tn.message})}const no=io||co||so;if(console.log("Only single share is present",no),no){qr(!0);return}console.info("Creating new wallet",{userId:oo,availableShares:{share1:!!io,share2:!!co,share3:!!so}}),await Qr(oo)}}catch(_i){throw console.error("Error fetching user profile:",_i),jr("Failed to fetch user profile. Please try again."),In(),_i}finally{Er(!1)}};reactExports.useEffect(()=>{(async()=>{try{if(fr.jwt)Er(!0),await En(fr.jwt);else if(Br){let _i;const oo=await PushSigner.initialize(Br,"DYNAMIC");_i=await PushWallet.loginWithWallet(oo,config.APP_ENV),_i?br({type:"INITIALIZE_WALLET",payload:_i}):console.log("Could not find user in wallet.tsx file after push wallet")}else{const _i=Jr(APP_ROUTES.AUTH);console.log("URL",_i),Zr(_i)}}catch(_i){console.error("Error initializing profile:",_i),jr("Failed to initialize profile"),In()}finally{Er(!1)}})()},[Br]);const Cn=async()=>{try{await Qr(fr.user.id)}catch(to){console.log("Error in creating new Wallet",to),In()}finally{qr(!1)}},In=()=>{sessionStorage.removeItem("jwt"),br({type:"RESET_AUTHENTICATED"}),br({type:"RESET_USER"}),localStorage.clear();const to=Jr(APP_ROUTES.AUTH);Zr(to)};reactExports.useEffect(()=>{var to,_i;(to=fr==null?void 0:fr.wallet)!=null&&to.attachedAccounts.length&&Vr(getWalletlist((_i=fr==null?void 0:fr.wallet)==null?void 0:_i.attachedAccounts)[0])},[(jn=fr==null?void 0:fr.wallet)==null?void 0:jn.attachedAccounts]);const An=(eo=fr==null?void 0:fr.wallet)==null?void 0:eo.appConnections.some(to=>to.isPending===!0);return wr?jsxRuntimeExports.jsx(WalletSkeletonScreen,{content:jsxRuntimeExports.jsx(PushWalletLoadingContent,{})}):Wr?jsxRuntimeExports.jsx(WalletSkeletonScreen,{content:jsxRuntimeExports.jsx(WalletReconstructionErrorContent,{onSuccess:Cn,onError:In})}):jsxRuntimeExports.jsx(ContentLayout,{children:jsxRuntimeExports.jsx(BoxLayout,{children:jsxRuntimeExports.jsxs(Box,{flexDirection:"column",display:"flex",width:"376px",padding:"spacing-md",gap:"spacing-sm",position:"relative",children:[An&&jsxRuntimeExports.jsx(AppConnections,{selectedWallet:Gr,appConnection:fr.wallet.appConnections[fr.wallet.appConnections.length-1]}),jsxRuntimeExports.jsx(WalletProfile,{selectedWallet:Gr}),jsxRuntimeExports.jsx(WalletTabs,{walletList:getWalletlist((ro=fr==null?void 0:fr.wallet)==null?void 0:ro.attachedAccounts),selectedWallet:Gr,setSelectedWallet:Vr}),!(fr!=null&&fr.wallet)&&Br&&jsxRuntimeExports.jsx(CreateAccount,{isLoading:wr,setIsLoading:Er})]})})})},PrivateRoute=({children:fr})=>{const{state:{walletLoadState:br,jwt:wr,dynamicWallet:Er}}=useGlobalState(),kr=usePersistedQuery();return br==="idle"||br==="loading"?jsxRuntimeExports.jsx(WalletSkeletonScreen,{content:jsxRuntimeExports.jsx(PushWalletLoadingContent,{})}):br==="success"&&wr?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:fr}):br==="success"&&Er?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:fr}):jsxRuntimeExports.jsx(Navigate,{to:kr(APP_ROUTES.AUTH)})},RouterContainer=()=>{const fr=usePersistedQuery();return jsxRuntimeExports.jsxs(Routes,{children:[jsxRuntimeExports.jsx(Route,{path:"/",element:jsxRuntimeExports.jsx(Navigate,{to:fr(APP_ROUTES.WALLET),state:{from:location}})}),jsxRuntimeExports.jsx(Route,{path:APP_ROUTES.WALLET,element:jsxRuntimeExports.jsx(PrivateRoute,{children:jsxRuntimeExports.jsx(Wallet$1,{})})}),jsxRuntimeExports.jsx(Route,{path:APP_ROUTES.AUTH,element:jsxRuntimeExports.jsx(Authentication,{})})]})},ROWS=10,WalletSkeletonScreen=({content:fr})=>jsxRuntimeExports.jsx(ContentLayout,{children:jsxRuntimeExports.jsx(BoxLayout,{children:jsxRuntimeExports.jsxs(Box,{alignItems:"start",flexDirection:"column",display:"flex",height:"570px",justifyContent:"start",width:"376px",padding:"spacing-md",gap:"spacing-xs",margin:"spacing-sm spacing-none spacing-none spacing-none",children:[jsxRuntimeExports.jsx(Box,{width:"100%",display:"flex",alignItems:"start",children:jsxRuntimeExports.jsx(PushLogo,{height:48,width:48})}),jsxRuntimeExports.jsxs(Box,{alignItems:"center",flexDirection:"column",display:"flex",width:"100%",gap:"spacing-xxs",children:[jsxRuntimeExports.jsxs(Box,{alignItems:"center",flexDirection:"column",display:"flex",gap:"spacing-sm",width:"100%",children:[jsxRuntimeExports.jsx(Skeleton,{isLoading:!0,borderRadius:"radius-round",children:jsxRuntimeExports.jsx(Box,{width:"50px",height:"50px",borderRadius:"radius-round"})}),jsxRuntimeExports.jsxs(Box,{alignItems:"center",flexDirection:"column",display:"flex",gap:"spacing-xxxs",children:[jsxRuntimeExports.jsx(Skeleton,{isLoading:!0,children:jsxRuntimeExports.jsx(Box,{height:"12px",width:"104px"})}),jsxRuntimeExports.jsx(Skeleton,{isLoading:!0,children:jsxRuntimeExports.jsx(Box,{height:"12px",width:"104px"})})]})]}),jsxRuntimeExports.jsx(Box,{display:"flex",flexDirection:"column",width:"100%",alignItems:"start",padding:"spacing-sm",css:Ae$2` border-bottom: var(--border-sm) solid var(--stroke-secondary); `,children:jsxRuntimeExports.jsx(Skeleton,{isLoading:!0,children:jsxRuntimeExports.jsx(Box,{height:"12px",width:"104px"})})}),jsxRuntimeExports.jsx(Box,{display:"flex",width:"100%",flexDirection:"column",overflow:"hidden scroll",customScrollbar:!0,height:"200px",children:Array.from({length:ROWS}).map((br,wr)=>jsxRuntimeExports.jsxs(Box,{display:"flex",width:"100%",padding:"spacing-sm spacing-xs",alignItems:"center",justifyContent:"space-between",css:Ae$2` border-bottom: var(--border-sm) solid @@ -4059,12 +4063,12 @@ https://github.com/browserify/crypto-browserify`)},cryptoBrowserify.constants={D * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */lodash.exports;(function(fr,br){(function(){var wr,Er="4.17.21",kr=200,jr="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",Br="Expected a function",Wr="Invalid `variable` option passed into `_.template`",qr="__lodash_hash_undefined__",Gr=500,Vr="__lodash_placeholder__",Zr=1,Jr=2,Qr=4,_n=1,En=2,Cn=1,In=2,An=4,jn=8,eo=16,ro=32,to=64,_i=128,oo=256,io=512,co=30,so="...",no=800,Tn=16,Hr=1,Xr=2,Sn=3,Rn=1/0,Pn=9007199254740991,On=17976931348623157e292,Zn=NaN,Nn=4294967295,wn=Nn-1,zn=Nn>>>1,fo=[["ary",_i],["bind",Cn],["bindKey",In],["curry",jn],["curryRight",eo],["flip",io],["partial",ro],["partialRight",to],["rearg",oo]],vo="[object Arguments]",go="[object Array]",uo="[object AsyncFunction]",lo="[object Boolean]",Eo="[object Date]",mo="[object DOMException]",yo="[object Error]",_o="[object Function]",Bo="[object GeneratorFunction]",Lo="[object Map]",Wo="[object Number]",na="[object Null]",qo="[object Object]",ga="[object Promise]",wl="[object Proxy]",No="[object RegExp]",Fo="[object Set]",Nl="[object String]",Vo="[object Symbol]",Uo="[object Undefined]",Ml="[object WeakMap]",$a="[object WeakSet]",Jo="[object ArrayBuffer]",Zl="[object DataView]",Cl="[object Float32Array]",ko="[object Float64Array]",wo="[object Int8Array]",bo="[object Int16Array]",Io="[object Int32Array]",Ho="[object Uint8Array]",Do="[object Uint8ClampedArray]",zo="[object Uint16Array]",nu="[object Uint32Array]",Ll=/\b__p \+= '';/g,_l=/\b(__p \+=) '' \+/g,bu=/(__e\(.*?\)|\b__t\)) \+\n'';/g,xl=/&(?:amp|lt|gt|quot|#39);/g,Tl=/[&<>"']/g,du=RegExp(xl.source),Bl=RegExp(Tl.source),Il=/<%-([\s\S]+?)%>/g,Eu=/<%([\s\S]+?)%>/g,Al=/<%=([\s\S]+?)%>/g,Ol=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Tu=/^\w*$/,Ul=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Sl=/[\\^$.*+?()[\]{}|]/g,_u=RegExp(Sl.source),So=/^\s+/,Co=/\s/,Ao=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,po=/\{\n\/\* \[wrapped with (.+)\] \*/,Ro=/,? & /,Xo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,jo=/[()=,{}\[\]\/\s]/,Ko=/\\(\\)?/g,Wl=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,$l=/\w*$/,El=/^[-+]0x[0-9a-f]+$/i,Cu=/^0b[01]+$/i,iu=/^\[object .+?Constructor\]$/,pu=/^0o[0-7]+$/i,yu=/^(?:0|[1-9]\d*)$/,hu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,mu=/($^)/,vu=/['\n\r\u2028\u2029\\]/g,fu="\\ud800-\\udfff",gu="\\u0300-\\u036f",ou="\\ufe20-\\ufe2f",su="\\u20d0-\\u20ff",tu=gu+ou+su,zl="\\u2700-\\u27bf",Gl="a-z\\xdf-\\xf6\\xf8-\\xff",Jl="\\xac\\xb1\\xd7\\xf7",Pl="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Fl="\\u2000-\\u206f",Yl=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Vl="A-Z\\xc0-\\xd6\\xd8-\\xde",Ql="\\ufe0e\\ufe0f",au=Jl+Pl+Fl+Yl,Nu="['’]",Wu="["+fu+"]",zu="["+au+"]",Bu="["+tu+"]",Qo="\\d+",Zu="["+zl+"]",Qu="["+Gl+"]",_h="[^"+fu+au+Qo+zl+Gl+Vl+"]",qu="\\ud83c[\\udffb-\\udfff]",Ju="(?:"+Bu+"|"+qu+")",_d="[^"+fu+"]",dp="(?:\\ud83c[\\udde6-\\uddff]){2}",Ku="[\\ud800-\\udbff][\\udc00-\\udfff]",Vu="["+Vl+"]",cp="\\u200d",fp="(?:"+Qu+"|"+_h+")",lp="(?:"+Vu+"|"+_h+")",np="(?:"+Nu+"(?:d|ll|m|re|s|t|ve))?",Rp="(?:"+Nu+"(?:D|LL|M|RE|S|T|VE))?",wp=Ju+"?",a0="["+Ql+"]?",ey="(?:"+cp+"(?:"+[_d,dp,Ku].join("|")+")"+a0+wp+")*",ym="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",s0="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",c0=a0+wp+ey,l0="(?:"+[Zu,dp,Ku].join("|")+")"+c0,d0="(?:"+[_d+Bu+"?",Bu,dp,Ku,Wu].join("|")+")",ty=RegExp(Nu,"g"),Rm=RegExp(Bu,"g"),qm=RegExp(qu+"(?="+qu+")|"+d0+c0,"g"),f0=RegExp([Vu+"?"+Qu+"+"+np+"(?="+[zu,Vu,"$"].join("|")+")",lp+"+"+Rp+"(?="+[zu,Vu+fp,"$"].join("|")+")",Vu+"?"+fp+"+"+np,Vu+"+"+Rp,s0,ym,Qo,l0].join("|"),"g"),h0=RegExp("["+cp+fu+tu+Ql+"]"),zm=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,p0=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ry=-1,Lu={};Lu[Cl]=Lu[ko]=Lu[wo]=Lu[bo]=Lu[Io]=Lu[Ho]=Lu[Do]=Lu[zo]=Lu[nu]=!0,Lu[vo]=Lu[go]=Lu[Jo]=Lu[lo]=Lu[Zl]=Lu[Eo]=Lu[yo]=Lu[_o]=Lu[Lo]=Lu[Wo]=Lu[qo]=Lu[No]=Lu[Fo]=Lu[Nl]=Lu[Ml]=!1;var Du={};Du[vo]=Du[go]=Du[Jo]=Du[Zl]=Du[lo]=Du[Eo]=Du[Cl]=Du[ko]=Du[wo]=Du[bo]=Du[Io]=Du[Lo]=Du[Wo]=Du[qo]=Du[No]=Du[Fo]=Du[Nl]=Du[Vo]=Du[Ho]=Du[Do]=Du[zo]=Du[nu]=!0,Du[yo]=Du[_o]=Du[Ml]=!1;var Zo={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Dl={"&":"&","<":"<",">":">",'"':""","'":"'"},ru={"&":"&","<":"<",">":">",""":'"',"'":"'"},Au={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Yu=parseFloat,Xu=parseInt,Cp=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,Kp=typeof self=="object"&&self&&self.Object===Object&&self,Hu=Cp||Kp||Function("return this")(),gp=br&&!br.nodeType&&br,_p=gp&&!0&&fr&&!fr.nodeType&&fr,sm=_p&&_p.exports===gp,Wp=sm&&Cp.process,ap=function(){try{var Oo=_p&&_p.require&&_p.require("util").types;return Oo||Wp&&Wp.binding&&Wp.binding("util")}catch{}}(),am=ap&&ap.isArrayBuffer,Cm=ap&&ap.isDate,vm=ap&&ap.isMap,Tm=ap&&ap.isRegExp,ny=ap&&ap.isSet,u0=ap&&ap.isTypedArray;function mp(Oo,Yo,Go){switch(Go.length){case 0:return Oo.call(Yo);case 1:return Oo.call(Yo,Go[0]);case 2:return Oo.call(Yo,Go[0],Go[1]);case 3:return Oo.call(Yo,Go[0],Go[1],Go[2])}return Oo.apply(Yo,Go)}function Cx(Oo,Yo,Go,Xl){for(var xu=-1,Ou=Oo==null?0:Oo.length;++xu-1}function oy(Oo,Yo,Go){for(var Xl=-1,xu=Oo==null?0:Oo.length;++Xl-1;);return Go}function E1(Oo,Yo){for(var Go=Oo.length;Go--&&Im(Yo,Oo[Go],0)>-1;);return Go}function jx(Oo,Yo){for(var Go=Oo.length,Xl=0;Go--;)Oo[Go]===Yo&&++Xl;return Xl}var Bx=ly(Zo),Dx=ly(Dl);function Lx(Oo){return"\\"+Au[Oo]}function Fx(Oo,Yo){return Oo==null?wr:Oo[Yo]}function Am(Oo){return h0.test(Oo)}function Ux(Oo){return zm.test(Oo)}function Wx(Oo){for(var Yo,Go=[];!(Yo=Oo.next()).done;)Go.push(Yo.value);return Go}function hy(Oo){var Yo=-1,Go=Array(Oo.size);return Oo.forEach(function(Xl,xu){Go[++Yo]=[xu,Xl]}),Go}function $1(Oo,Yo){return function(Go){return Oo(Yo(Go))}}function um(Oo,Yo){for(var Go=-1,Xl=Oo.length,xu=0,Ou=[];++Go-1}function Tw(Yr,$n){var Yn=this.__data__,ao=P0(Yn,Yr);return ao<0?(++this.size,Yn.push([Yr,$n])):Yn[ao][1]=$n,this}Yp.prototype.clear=Sw,Yp.prototype.delete=kw,Yp.prototype.get=Cw,Yp.prototype.has=Rw,Yp.prototype.set=Tw;function Xp(Yr){var $n=-1,Yn=Yr==null?0:Yr.length;for(this.clear();++$n=$n?Yr:$n)),Yr}function Bp(Yr,$n,Yn,ao,ho,$o){var To,Po=$n&Zr,Mo=$n&Jr,_c=$n&Qr;if(Yn&&(To=ho?Yn(Yr,ao,ho,$o):Yn(Yr)),To!==wr)return To;if(!_f(Yr))return Yr;var yl=wu(Yr);if(yl){if(To=N_(Yr),!Po)return Ep(Yr,To)}else{var Rl=pp(Yr),Hl=Rl==_o||Rl==Bo;if(gm(Yr))return vv(Yr,Po);if(Rl==qo||Rl==vo||Hl&&!ho){if(To=Mo||Hl?{}:Bv(Yr),!Po)return Mo?__(Yr,Vw(To,Yr)):w_(Yr,j1(To,Yr))}else{if(!Du[Rl])return ho?Yr:{};To=O_(Yr,Rl,Po)}}$o||($o=new zp);var eu=$o.get(Yr);if(eu)return eu;$o.set(Yr,To),fx(Yr)?Yr.forEach(function(uu){To.add(Bp(uu,$n,Yn,uu,Yr,$o))}):ux(Yr)&&Yr.forEach(function(uu,Ru){To.set(Ru,Bp(uu,$n,Yn,Ru,Yr,$o))});var lu=_c?Mo?Ly:Dy:Mo?Sp:sp,Su=yl?wr:lu(Yr);return Op(Su||Yr,function(uu,Ru){Su&&(Ru=uu,uu=Yr[Ru]),Ym(To,Ru,Bp(uu,$n,Yn,Ru,Yr,$o))}),To}function Hw(Yr){var $n=sp(Yr);return function(Yn){return B1(Yn,Yr,$n)}}function B1(Yr,$n,Yn){var ao=Yn.length;if(Yr==null)return!ao;for(Yr=Fu(Yr);ao--;){var ho=Yn[ao],$o=$n[ho],To=Yr[ho];if(To===wr&&!(ho in Yr)||!$o(To))return!1}return!0}function D1(Yr,$n,Yn){if(typeof Yr!="function")throw new Mp(Br);return i0(function(){Yr.apply(wr,Yn)},$n)}function Xm(Yr,$n,Yn,ao){var ho=-1,$o=m0,To=!0,Po=Yr.length,Mo=[],_c=$n.length;if(!Po)return Mo;Yn&&($n=Gu($n,Tp(Yn))),ao?($o=oy,To=!1):$n.length>=kr&&($o=Vm,To=!1,$n=new wm($n));e:for(;++hoho?0:ho+Yn),ao=ao===wr||ao>ho?ho:$u(ao),ao<0&&(ao+=ho),ao=Yn>ao?0:px(ao);Yn0&&Yn(Po)?$n>1?up(Po,$n-1,Yn,ao,ho):lm(ho,Po):ao||(ho[ho.length]=Po)}return ho}var xy=$v(),U1=$v(!0);function Gp(Yr,$n){return Yr&&xy(Yr,$n,sp)}function wy(Yr,$n){return Yr&&U1(Yr,$n,sp)}function O0(Yr,$n){return cm($n,function(Yn){return nm(Yr[Yn])})}function Em(Yr,$n){$n=pm($n,Yr);for(var Yn=0,ao=$n.length;Yr!=null&&Yn$n}function Zw(Yr,$n){return Yr!=null&&ju.call(Yr,$n)}function Jw(Yr,$n){return Yr!=null&&$n in Fu(Yr)}function Yw(Yr,$n,Yn){return Yr>=hp($n,Yn)&&Yr=120&&yl.length>=120)?new wm(To&&yl):wr}yl=Yr[0];var Rl=-1,Hl=Po[0];e:for(;++Rl-1;)Po!==Yr&&S0.call(Po,Mo,1),S0.call(Yr,Mo,1);return Yr}function X1(Yr,$n){for(var Yn=Yr?$n.length:0,ao=Yn-1;Yn--;){var ho=$n[Yn];if(Yn==ao||ho!==$o){var $o=ho;rm(ho)?S0.call(Yr,ho,1):Ay(Yr,ho)}}return Yr}function Ry(Yr,$n){return Yr+R0(P1()*($n-Yr+1))}function u_(Yr,$n,Yn,ao){for(var ho=-1,$o=op(C0(($n-Yr)/(Yn||1)),0),To=Go($o);$o--;)To[ao?$o:++ho]=Yr,Yr+=Yn;return To}function Ty(Yr,$n){var Yn="";if(!Yr||$n<1||$n>Pn)return Yn;do $n%2&&(Yn+=Yr),$n=R0($n/2),$n&&(Yr+=Yr);while($n);return Yn}function ku(Yr,$n){return Hy(Fv(Yr,$n,kp),Yr+"")}function d_(Yr){return M1(Wm(Yr))}function f_(Yr,$n){var Yn=Wm(Yr);return V0(Yn,_m($n,0,Yn.length))}function t0(Yr,$n,Yn,ao){if(!_f(Yr))return Yr;$n=pm($n,Yr);for(var ho=-1,$o=$n.length,To=$o-1,Po=Yr;Po!=null&&++ho<$o;){var Mo=Jp($n[ho]),_c=Yn;if(Mo==="__proto__"||Mo==="constructor"||Mo==="prototype")return Yr;if(ho!=To){var yl=Po[Mo];_c=ao?ao(yl,Mo,Po):wr,_c===wr&&(_c=_f(yl)?yl:rm($n[ho+1])?[]:{})}Ym(Po,Mo,_c),Po=Po[Mo]}return Yr}var Q1=T0?function(Yr,$n){return T0.set(Yr,$n),Yr}:kp,h_=k0?function(Yr,$n){return k0(Yr,"toString",{configurable:!0,enumerable:!1,value:r1($n),writable:!0})}:kp;function p_(Yr){return V0(Wm(Yr))}function Dp(Yr,$n,Yn){var ao=-1,ho=Yr.length;$n<0&&($n=-$n>ho?0:ho+$n),Yn=Yn>ho?ho:Yn,Yn<0&&(Yn+=ho),ho=$n>Yn?0:Yn-$n>>>0,$n>>>=0;for(var $o=Go(ho);++ao>>1,To=Yr[$o];To!==null&&!Ap(To)&&(Yn?To<=$n:To<$n)?ao=$o+1:ho=$o}return ho}return Iy(Yr,$n,kp,Yn)}function Iy(Yr,$n,Yn,ao){var ho=0,$o=Yr==null?0:Yr.length;if($o===0)return 0;$n=Yn($n);for(var To=$n!==$n,Po=$n===null,Mo=Ap($n),_c=$n===wr;ho<$o;){var yl=R0((ho+$o)/2),Rl=Yn(Yr[yl]),Hl=Rl!==wr,eu=Rl===null,lu=Rl===Rl,Su=Ap(Rl);if(To)var uu=ao||lu;else _c?uu=lu&&(ao||Hl):Po?uu=lu&&Hl&&(ao||!eu):Mo?uu=lu&&Hl&&!eu&&(ao||!Su):eu||Su?uu=!1:uu=ao?Rl<=$n:Rl<$n;uu?ho=yl+1:$o=yl}return hp($o,wn)}function lv(Yr,$n){for(var Yn=-1,ao=Yr.length,ho=0,$o=[];++Yn=kr){var _c=$n?null:k_(Yr);if(_c)return y0(_c);To=!1,ho=Vm,Mo=new wm}else Mo=$n?[]:Po;e:for(;++ao<$o;){var yl=Yr[ao],Rl=$n?$n(yl):yl;if(yl=Yn||yl!==0?yl:0,To&&Rl===Rl){for(var Hl=Mo.length;Hl--;)if(Mo[Hl]===Rl)continue e;$n&&Mo.push(Rl),Po.push(yl)}else ho(Mo,Rl,Yn)||(Mo!==Po&&Mo.push(Rl),Po.push(yl))}return Po}function Ay(Yr,$n){return $n=pm($n,Yr),Yr=Uv(Yr,$n),Yr==null||delete Yr[Jp(Lp($n))]}function pv(Yr,$n,Yn,ao){return t0(Yr,$n,Yn(Em(Yr,$n)),ao)}function B0(Yr,$n,Yn,ao){for(var ho=Yr.length,$o=ao?ho:-1;(ao?$o--:++$o=ao?Yr:Dp(Yr,$n,Yn)}var yv=nw||function(Yr){return Hu.clearTimeout(Yr)};function vv(Yr,$n){if($n)return Yr.slice();var Yn=Yr.length,ao=C1?C1(Yn):new Yr.constructor(Yn);return Yr.copy(ao),ao}function My(Yr){var $n=new Yr.constructor(Yr.byteLength);return new E0($n).set(new E0(Yr)),$n}function y_(Yr,$n){var Yn=$n?My(Yr.buffer):Yr.buffer;return new Yr.constructor(Yn,Yr.byteOffset,Yr.byteLength)}function v_(Yr){var $n=new Yr.constructor(Yr.source,$l.exec(Yr));return $n.lastIndex=Yr.lastIndex,$n}function b_(Yr){return Jm?Fu(Jm.call(Yr)):{}}function bv(Yr,$n){var Yn=$n?My(Yr.buffer):Yr.buffer;return new Yr.constructor(Yn,Yr.byteOffset,Yr.length)}function xv(Yr,$n){if(Yr!==$n){var Yn=Yr!==wr,ao=Yr===null,ho=Yr===Yr,$o=Ap(Yr),To=$n!==wr,Po=$n===null,Mo=$n===$n,_c=Ap($n);if(!Po&&!_c&&!$o&&Yr>$n||$o&&To&&Mo&&!Po&&!_c||ao&&To&&Mo||!Yn&&Mo||!ho)return 1;if(!ao&&!$o&&!_c&&Yr<$n||_c&&Yn&&ho&&!ao&&!$o||Po&&Yn&&ho||!To&&ho||!Mo)return-1}return 0}function x_(Yr,$n,Yn){for(var ao=-1,ho=Yr.criteria,$o=$n.criteria,To=ho.length,Po=Yn.length;++ao=Po)return Mo;var _c=Yn[ao];return Mo*(_c=="desc"?-1:1)}}return Yr.index-$n.index}function wv(Yr,$n,Yn,ao){for(var ho=-1,$o=Yr.length,To=Yn.length,Po=-1,Mo=$n.length,_c=op($o-To,0),yl=Go(Mo+_c),Rl=!ao;++Po1?Yn[ho-1]:wr,To=ho>2?Yn[2]:wr;for($o=Yr.length>3&&typeof $o=="function"?(ho--,$o):wr,To&&vp(Yn[0],Yn[1],To)&&($o=ho<3?wr:$o,ho=1),$n=Fu($n);++ao-1?ho[$o?$n[To]:To]:wr}}function Cv(Yr){return tm(function($n){var Yn=$n.length,ao=Yn,ho=jp.prototype.thru;for(Yr&&$n.reverse();ao--;){var $o=$n[ao];if(typeof $o!="function")throw new Mp(Br);if(ho&&!To&&q0($o)=="wrapper")var To=new jp([],!0)}for(ao=To?ao:Yn;++ao1&&Pu.reverse(),yl&&MoPo))return!1;var _c=$o.get(Yr),yl=$o.get($n);if(_c&&yl)return _c==$n&&yl==Yr;var Rl=-1,Hl=!0,eu=Yn&En?new wm:wr;for($o.set(Yr,$n),$o.set($n,Yr);++Rl1?"& ":"")+$n[ao],$n=$n.join(Yn>2?", ":" "),Yr.replace(Ao,`{ + */lodash.exports;(function(fr,br){(function(){var wr,Er="4.17.21",kr=200,jr="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",Br="Expected a function",Wr="Invalid `variable` option passed into `_.template`",qr="__lodash_hash_undefined__",Gr=500,Vr="__lodash_placeholder__",Zr=1,Jr=2,Qr=4,_n=1,En=2,Cn=1,In=2,An=4,jn=8,eo=16,ro=32,to=64,_i=128,oo=256,io=512,co=30,so="...",no=800,Tn=16,Hr=1,Xr=2,Sn=3,Rn=1/0,Pn=9007199254740991,On=17976931348623157e292,Zn=NaN,Nn=4294967295,wn=Nn-1,zn=Nn>>>1,fo=[["ary",_i],["bind",Cn],["bindKey",In],["curry",jn],["curryRight",eo],["flip",io],["partial",ro],["partialRight",to],["rearg",oo]],vo="[object Arguments]",go="[object Array]",uo="[object AsyncFunction]",lo="[object Boolean]",Eo="[object Date]",mo="[object DOMException]",yo="[object Error]",_o="[object Function]",Bo="[object GeneratorFunction]",Lo="[object Map]",Wo="[object Number]",na="[object Null]",qo="[object Object]",ga="[object Promise]",wl="[object Proxy]",No="[object RegExp]",Uo="[object Set]",Nl="[object String]",Vo="[object Symbol]",Fo="[object Undefined]",Ol="[object WeakMap]",$a="[object WeakSet]",Jo="[object ArrayBuffer]",Zl="[object DataView]",Cl="[object Float32Array]",ko="[object Float64Array]",wo="[object Int8Array]",bo="[object Int16Array]",Io="[object Int32Array]",Ho="[object Uint8Array]",Do="[object Uint8ClampedArray]",zo="[object Uint16Array]",nu="[object Uint32Array]",Ll=/\b__p \+= '';/g,_l=/\b(__p \+=) '' \+/g,bu=/(__e\(.*?\)|\b__t\)) \+\n'';/g,xl=/&(?:amp|lt|gt|quot|#39);/g,Tl=/[&<>"']/g,du=RegExp(xl.source),Bl=RegExp(Tl.source),Il=/<%-([\s\S]+?)%>/g,Eu=/<%([\s\S]+?)%>/g,Al=/<%=([\s\S]+?)%>/g,Ml=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Tu=/^\w*$/,Fl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Sl=/[\\^$.*+?()[\]{}|]/g,_u=RegExp(Sl.source),So=/^\s+/,Co=/\s/,Ao=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,po=/\{\n\/\* \[wrapped with (.+)\] \*/,Ro=/,? & /,Xo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,jo=/[()=,{}\[\]\/\s]/,Ko=/\\(\\)?/g,Wl=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,$l=/\w*$/,El=/^[-+]0x[0-9a-f]+$/i,Cu=/^0b[01]+$/i,iu=/^\[object .+?Constructor\]$/,pu=/^0o[0-7]+$/i,yu=/^(?:0|[1-9]\d*)$/,hu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,mu=/($^)/,vu=/['\n\r\u2028\u2029\\]/g,fu="\\ud800-\\udfff",gu="\\u0300-\\u036f",ou="\\ufe20-\\ufe2f",su="\\u20d0-\\u20ff",tu=gu+ou+su,zl="\\u2700-\\u27bf",Gl="a-z\\xdf-\\xf6\\xf8-\\xff",Jl="\\xac\\xb1\\xd7\\xf7",Pl="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ul="\\u2000-\\u206f",Yl=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Vl="A-Z\\xc0-\\xd6\\xd8-\\xde",Ql="\\ufe0e\\ufe0f",au=Jl+Pl+Ul+Yl,Nu="['’]",Wu="["+fu+"]",zu="["+au+"]",Bu="["+tu+"]",Qo="\\d+",Zu="["+zl+"]",Qu="["+Gl+"]",_h="[^"+fu+au+Qo+zl+Gl+Vl+"]",qu="\\ud83c[\\udffb-\\udfff]",Ju="(?:"+Bu+"|"+qu+")",_d="[^"+fu+"]",dp="(?:\\ud83c[\\udde6-\\uddff]){2}",Ku="[\\ud800-\\udbff][\\udc00-\\udfff]",Vu="["+Vl+"]",cp="\\u200d",fp="(?:"+Qu+"|"+_h+")",lp="(?:"+Vu+"|"+_h+")",np="(?:"+Nu+"(?:d|ll|m|re|s|t|ve))?",Rp="(?:"+Nu+"(?:D|LL|M|RE|S|T|VE))?",wp=Ju+"?",a0="["+Ql+"]?",e1="(?:"+cp+"(?:"+[_d,dp,Ku].join("|")+")"+a0+wp+")*",ym="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",s0="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",c0=a0+wp+e1,l0="(?:"+[Zu,dp,Ku].join("|")+")"+c0,d0="(?:"+[_d+Bu+"?",Bu,dp,Ku,Wu].join("|")+")",t1=RegExp(Nu,"g"),Rm=RegExp(Bu,"g"),qm=RegExp(qu+"(?="+qu+")|"+d0+c0,"g"),f0=RegExp([Vu+"?"+Qu+"+"+np+"(?="+[zu,Vu,"$"].join("|")+")",lp+"+"+Rp+"(?="+[zu,Vu+fp,"$"].join("|")+")",Vu+"?"+fp+"+"+np,Vu+"+"+Rp,s0,ym,Qo,l0].join("|"),"g"),h0=RegExp("["+cp+fu+tu+Ql+"]"),zm=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,p0=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],r1=-1,Lu={};Lu[Cl]=Lu[ko]=Lu[wo]=Lu[bo]=Lu[Io]=Lu[Ho]=Lu[Do]=Lu[zo]=Lu[nu]=!0,Lu[vo]=Lu[go]=Lu[Jo]=Lu[lo]=Lu[Zl]=Lu[Eo]=Lu[yo]=Lu[_o]=Lu[Lo]=Lu[Wo]=Lu[qo]=Lu[No]=Lu[Uo]=Lu[Nl]=Lu[Ol]=!1;var Du={};Du[vo]=Du[go]=Du[Jo]=Du[Zl]=Du[lo]=Du[Eo]=Du[Cl]=Du[ko]=Du[wo]=Du[bo]=Du[Io]=Du[Lo]=Du[Wo]=Du[qo]=Du[No]=Du[Uo]=Du[Nl]=Du[Vo]=Du[Ho]=Du[Do]=Du[zo]=Du[nu]=!0,Du[yo]=Du[_o]=Du[Ol]=!1;var Zo={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Dl={"&":"&","<":"<",">":">",'"':""","'":"'"},ru={"&":"&","<":"<",">":">",""":'"',"'":"'"},Au={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Yu=parseFloat,Xu=parseInt,Cp=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,Kp=typeof self=="object"&&self&&self.Object===Object&&self,Hu=Cp||Kp||Function("return this")(),gp=br&&!br.nodeType&&br,_p=gp&&!0&&fr&&!fr.nodeType&&fr,sm=_p&&_p.exports===gp,Wp=sm&&Cp.process,ap=function(){try{var Mo=_p&&_p.require&&_p.require("util").types;return Mo||Wp&&Wp.binding&&Wp.binding("util")}catch{}}(),am=ap&&ap.isArrayBuffer,Cm=ap&&ap.isDate,vm=ap&&ap.isMap,Tm=ap&&ap.isRegExp,n1=ap&&ap.isSet,u0=ap&&ap.isTypedArray;function mp(Mo,Yo,Go){switch(Go.length){case 0:return Mo.call(Yo);case 1:return Mo.call(Yo,Go[0]);case 2:return Mo.call(Yo,Go[0],Go[1]);case 3:return Mo.call(Yo,Go[0],Go[1],Go[2])}return Mo.apply(Yo,Go)}function Cx(Mo,Yo,Go,Xl){for(var xu=-1,Mu=Mo==null?0:Mo.length;++xu-1}function o1(Mo,Yo,Go){for(var Xl=-1,xu=Mo==null?0:Mo.length;++Xl-1;);return Go}function Ey(Mo,Yo){for(var Go=Mo.length;Go--&&Im(Yo,Mo[Go],0)>-1;);return Go}function jx(Mo,Yo){for(var Go=Mo.length,Xl=0;Go--;)Mo[Go]===Yo&&++Xl;return Xl}var Bx=l1(Zo),Dx=l1(Dl);function Lx(Mo){return"\\"+Au[Mo]}function Ux(Mo,Yo){return Mo==null?wr:Mo[Yo]}function Am(Mo){return h0.test(Mo)}function Fx(Mo){return zm.test(Mo)}function Wx(Mo){for(var Yo,Go=[];!(Yo=Mo.next()).done;)Go.push(Yo.value);return Go}function h1(Mo){var Yo=-1,Go=Array(Mo.size);return Mo.forEach(function(Xl,xu){Go[++Yo]=[xu,Xl]}),Go}function $y(Mo,Yo){return function(Go){return Mo(Yo(Go))}}function um(Mo,Yo){for(var Go=-1,Xl=Mo.length,xu=0,Mu=[];++Go-1}function Tw(Yr,$n){var Yn=this.__data__,ao=P0(Yn,Yr);return ao<0?(++this.size,Yn.push([Yr,$n])):Yn[ao][1]=$n,this}Yp.prototype.clear=Sw,Yp.prototype.delete=kw,Yp.prototype.get=Cw,Yp.prototype.has=Rw,Yp.prototype.set=Tw;function Xp(Yr){var $n=-1,Yn=Yr==null?0:Yr.length;for(this.clear();++$n=$n?Yr:$n)),Yr}function Bp(Yr,$n,Yn,ao,ho,$o){var To,Po=$n&Zr,Oo=$n&Jr,_c=$n&Qr;if(Yn&&(To=ho?Yn(Yr,ao,ho,$o):Yn(Yr)),To!==wr)return To;if(!_f(Yr))return Yr;var yl=wu(Yr);if(yl){if(To=N_(Yr),!Po)return Ep(Yr,To)}else{var Rl=pp(Yr),Hl=Rl==_o||Rl==Bo;if(gm(Yr))return vv(Yr,Po);if(Rl==qo||Rl==vo||Hl&&!ho){if(To=Oo||Hl?{}:Bv(Yr),!Po)return Oo?__(Yr,Vw(To,Yr)):w_(Yr,jy(To,Yr))}else{if(!Du[Rl])return ho?Yr:{};To=M_(Yr,Rl,Po)}}$o||($o=new zp);var eu=$o.get(Yr);if(eu)return eu;$o.set(Yr,To),fx(Yr)?Yr.forEach(function(uu){To.add(Bp(uu,$n,Yn,uu,Yr,$o))}):ux(Yr)&&Yr.forEach(function(uu,Ru){To.set(Ru,Bp(uu,$n,Yn,Ru,Yr,$o))});var lu=_c?Oo?F1:U1:Oo?Sp:sp,Su=yl?wr:lu(Yr);return Mp(Su||Yr,function(uu,Ru){Su&&(Ru=uu,uu=Yr[Ru]),Ym(To,Ru,Bp(uu,$n,Yn,Ru,Yr,$o))}),To}function Hw(Yr){var $n=sp(Yr);return function(Yn){return By(Yn,Yr,$n)}}function By(Yr,$n,Yn){var ao=Yn.length;if(Yr==null)return!ao;for(Yr=Uu(Yr);ao--;){var ho=Yn[ao],$o=$n[ho],To=Yr[ho];if(To===wr&&!(ho in Yr)||!$o(To))return!1}return!0}function Dy(Yr,$n,Yn){if(typeof Yr!="function")throw new Op(Br);return i0(function(){Yr.apply(wr,Yn)},$n)}function Xm(Yr,$n,Yn,ao){var ho=-1,$o=m0,To=!0,Po=Yr.length,Oo=[],_c=$n.length;if(!Po)return Oo;Yn&&($n=Gu($n,Tp(Yn))),ao?($o=o1,To=!1):$n.length>=kr&&($o=Vm,To=!1,$n=new wm($n));e:for(;++hoho?0:ho+Yn),ao=ao===wr||ao>ho?ho:$u(ao),ao<0&&(ao+=ho),ao=Yn>ao?0:px(ao);Yn0&&Yn(Po)?$n>1?up(Po,$n-1,Yn,ao,ho):lm(ho,Po):ao||(ho[ho.length]=Po)}return ho}var w1=$v(),Fy=$v(!0);function Gp(Yr,$n){return Yr&&w1(Yr,$n,sp)}function E1(Yr,$n){return Yr&&Fy(Yr,$n,sp)}function M0(Yr,$n){return cm($n,function(Yn){return nm(Yr[Yn])})}function Em(Yr,$n){$n=pm($n,Yr);for(var Yn=0,ao=$n.length;Yr!=null&&Yn$n}function Zw(Yr,$n){return Yr!=null&&ju.call(Yr,$n)}function Jw(Yr,$n){return Yr!=null&&$n in Uu(Yr)}function Yw(Yr,$n,Yn){return Yr>=hp($n,Yn)&&Yr=120&&yl.length>=120)?new wm(To&&yl):wr}yl=Yr[0];var Rl=-1,Hl=Po[0];e:for(;++Rl-1;)Po!==Yr&&S0.call(Po,Oo,1),S0.call(Yr,Oo,1);return Yr}function Xy(Yr,$n){for(var Yn=Yr?$n.length:0,ao=Yn-1;Yn--;){var ho=$n[Yn];if(Yn==ao||ho!==$o){var $o=ho;rm(ho)?S0.call(Yr,ho,1):N1(Yr,ho)}}return Yr}function I1(Yr,$n){return Yr+R0(Py()*($n-Yr+1))}function u_(Yr,$n,Yn,ao){for(var ho=-1,$o=op(C0(($n-Yr)/(Yn||1)),0),To=Go($o);$o--;)To[ao?$o:++ho]=Yr,Yr+=Yn;return To}function A1(Yr,$n){var Yn="";if(!Yr||$n<1||$n>Pn)return Yn;do $n%2&&(Yn+=Yr),$n=R0($n/2),$n&&(Yr+=Yr);while($n);return Yn}function ku(Yr,$n){return G1(Uv(Yr,$n,kp),Yr+"")}function d_(Yr){return Oy(Wm(Yr))}function f_(Yr,$n){var Yn=Wm(Yr);return V0(Yn,_m($n,0,Yn.length))}function t0(Yr,$n,Yn,ao){if(!_f(Yr))return Yr;$n=pm($n,Yr);for(var ho=-1,$o=$n.length,To=$o-1,Po=Yr;Po!=null&&++ho<$o;){var Oo=Jp($n[ho]),_c=Yn;if(Oo==="__proto__"||Oo==="constructor"||Oo==="prototype")return Yr;if(ho!=To){var yl=Po[Oo];_c=ao?ao(yl,Oo,Po):wr,_c===wr&&(_c=_f(yl)?yl:rm($n[ho+1])?[]:{})}Ym(Po,Oo,_c),Po=Po[Oo]}return Yr}var Qy=T0?function(Yr,$n){return T0.set(Yr,$n),Yr}:kp,h_=k0?function(Yr,$n){return k0(Yr,"toString",{configurable:!0,enumerable:!1,value:iy($n),writable:!0})}:kp;function p_(Yr){return V0(Wm(Yr))}function Dp(Yr,$n,Yn){var ao=-1,ho=Yr.length;$n<0&&($n=-$n>ho?0:ho+$n),Yn=Yn>ho?ho:Yn,Yn<0&&(Yn+=ho),ho=$n>Yn?0:Yn-$n>>>0,$n>>>=0;for(var $o=Go(ho);++ao>>1,To=Yr[$o];To!==null&&!Ap(To)&&(Yn?To<=$n:To<$n)?ao=$o+1:ho=$o}return ho}return P1(Yr,$n,kp,Yn)}function P1(Yr,$n,Yn,ao){var ho=0,$o=Yr==null?0:Yr.length;if($o===0)return 0;$n=Yn($n);for(var To=$n!==$n,Po=$n===null,Oo=Ap($n),_c=$n===wr;ho<$o;){var yl=R0((ho+$o)/2),Rl=Yn(Yr[yl]),Hl=Rl!==wr,eu=Rl===null,lu=Rl===Rl,Su=Ap(Rl);if(To)var uu=ao||lu;else _c?uu=lu&&(ao||Hl):Po?uu=lu&&Hl&&(ao||!eu):Oo?uu=lu&&Hl&&!eu&&(ao||!Su):eu||Su?uu=!1:uu=ao?Rl<=$n:Rl<$n;uu?ho=yl+1:$o=yl}return hp($o,wn)}function lv(Yr,$n){for(var Yn=-1,ao=Yr.length,ho=0,$o=[];++Yn=kr){var _c=$n?null:k_(Yr);if(_c)return y0(_c);To=!1,ho=Vm,Oo=new wm}else Oo=$n?[]:Po;e:for(;++ao<$o;){var yl=Yr[ao],Rl=$n?$n(yl):yl;if(yl=Yn||yl!==0?yl:0,To&&Rl===Rl){for(var Hl=Oo.length;Hl--;)if(Oo[Hl]===Rl)continue e;$n&&Oo.push(Rl),Po.push(yl)}else ho(Oo,Rl,Yn)||(Oo!==Po&&Oo.push(Rl),Po.push(yl))}return Po}function N1(Yr,$n){return $n=pm($n,Yr),Yr=Fv(Yr,$n),Yr==null||delete Yr[Jp(Lp($n))]}function pv(Yr,$n,Yn,ao){return t0(Yr,$n,Yn(Em(Yr,$n)),ao)}function B0(Yr,$n,Yn,ao){for(var ho=Yr.length,$o=ao?ho:-1;(ao?$o--:++$o=ao?Yr:Dp(Yr,$n,Yn)}var yv=nw||function(Yr){return Hu.clearTimeout(Yr)};function vv(Yr,$n){if($n)return Yr.slice();var Yn=Yr.length,ao=Cy?Cy(Yn):new Yr.constructor(Yn);return Yr.copy(ao),ao}function B1(Yr){var $n=new Yr.constructor(Yr.byteLength);return new E0($n).set(new E0(Yr)),$n}function y_(Yr,$n){var Yn=$n?B1(Yr.buffer):Yr.buffer;return new Yr.constructor(Yn,Yr.byteOffset,Yr.byteLength)}function v_(Yr){var $n=new Yr.constructor(Yr.source,$l.exec(Yr));return $n.lastIndex=Yr.lastIndex,$n}function b_(Yr){return Jm?Uu(Jm.call(Yr)):{}}function bv(Yr,$n){var Yn=$n?B1(Yr.buffer):Yr.buffer;return new Yr.constructor(Yn,Yr.byteOffset,Yr.length)}function xv(Yr,$n){if(Yr!==$n){var Yn=Yr!==wr,ao=Yr===null,ho=Yr===Yr,$o=Ap(Yr),To=$n!==wr,Po=$n===null,Oo=$n===$n,_c=Ap($n);if(!Po&&!_c&&!$o&&Yr>$n||$o&&To&&Oo&&!Po&&!_c||ao&&To&&Oo||!Yn&&Oo||!ho)return 1;if(!ao&&!$o&&!_c&&Yr<$n||_c&&Yn&&ho&&!ao&&!$o||Po&&Yn&&ho||!To&&ho||!Oo)return-1}return 0}function x_(Yr,$n,Yn){for(var ao=-1,ho=Yr.criteria,$o=$n.criteria,To=ho.length,Po=Yn.length;++ao=Po)return Oo;var _c=Yn[ao];return Oo*(_c=="desc"?-1:1)}}return Yr.index-$n.index}function wv(Yr,$n,Yn,ao){for(var ho=-1,$o=Yr.length,To=Yn.length,Po=-1,Oo=$n.length,_c=op($o-To,0),yl=Go(Oo+_c),Rl=!ao;++Po1?Yn[ho-1]:wr,To=ho>2?Yn[2]:wr;for($o=Yr.length>3&&typeof $o=="function"?(ho--,$o):wr,To&&vp(Yn[0],Yn[1],To)&&($o=ho<3?wr:$o,ho=1),$n=Uu($n);++ao-1?ho[$o?$n[To]:To]:wr}}function Cv(Yr){return tm(function($n){var Yn=$n.length,ao=Yn,ho=jp.prototype.thru;for(Yr&&$n.reverse();ao--;){var $o=$n[ao];if(typeof $o!="function")throw new Op(Br);if(ho&&!To&&q0($o)=="wrapper")var To=new jp([],!0)}for(ao=To?ao:Yn;++ao1&&Pu.reverse(),yl&&OoPo))return!1;var _c=$o.get(Yr),yl=$o.get($n);if(_c&&yl)return _c==$n&&yl==Yr;var Rl=-1,Hl=!0,eu=Yn&En?new wm:wr;for($o.set(Yr,$n),$o.set($n,Yr);++Rl1?"& ":"")+$n[ao],$n=$n.join(Yn>2?", ":" "),Yr.replace(Ao,`{ /* [wrapped with `+$n+`] */ -`)}function j_(Yr){return wu(Yr)||km(Yr)||!!(I1&&Yr&&Yr[I1])}function rm(Yr,$n){var Yn=typeof Yr;return $n=$n??Pn,!!$n&&(Yn=="number"||Yn!="symbol"&&yu.test(Yr))&&Yr>-1&&Yr%1==0&&Yr<$n}function vp(Yr,$n,Yn){if(!_f(Yn))return!1;var ao=typeof $n;return(ao=="number"?$p(Yn)&&rm($n,Yn.length):ao=="string"&&$n in Yn)?Vp(Yn[$n],Yr):!1}function qy(Yr,$n){if(wu(Yr))return!1;var Yn=typeof Yr;return Yn=="number"||Yn=="symbol"||Yn=="boolean"||Yr==null||Ap(Yr)?!0:Tu.test(Yr)||!Ol.test(Yr)||$n!=null&&Yr in Fu($n)}function B_(Yr){var $n=typeof Yr;return $n=="string"||$n=="number"||$n=="symbol"||$n=="boolean"?Yr!=="__proto__":Yr===null}function zy(Yr){var $n=q0(Yr),Yn=xo[$n];if(typeof Yn!="function"||!($n in Iu.prototype))return!1;if(Yr===Yn)return!0;var ao=Fy(Yn);return!!ao&&Yr===ao[0]}function D_(Yr){return!!k1&&k1 in Yr}var L_=b0?nm:s1;function n0(Yr){var $n=Yr&&Yr.constructor,Yn=typeof $n=="function"&&$n.prototype||Om;return Yr===Yn}function Dv(Yr){return Yr===Yr&&!_f(Yr)}function Lv(Yr,$n){return function(Yn){return Yn==null?!1:Yn[Yr]===$n&&($n!==wr||Yr in Fu(Yn))}}function F_(Yr){var $n=Z0(Yr,function(ao){return Yn.size===Gr&&Yn.clear(),ao}),Yn=$n.cache;return $n}function U_(Yr,$n){var Yn=Yr[1],ao=$n[1],ho=Yn|ao,$o=ho<(Cn|In|_i),To=ao==_i&&Yn==jn||ao==_i&&Yn==oo&&Yr[7].length<=$n[8]||ao==(_i|oo)&&$n[7].length<=$n[8]&&Yn==jn;if(!($o||To))return Yr;ao&Cn&&(Yr[2]=$n[2],ho|=Yn&Cn?0:An);var Po=$n[3];if(Po){var Mo=Yr[3];Yr[3]=Mo?wv(Mo,Po,$n[4]):Po,Yr[4]=Mo?um(Yr[3],Vr):$n[4]}return Po=$n[5],Po&&(Mo=Yr[5],Yr[5]=Mo?_v(Mo,Po,$n[6]):Po,Yr[6]=Mo?um(Yr[5],Vr):$n[6]),Po=$n[7],Po&&(Yr[7]=Po),ao&_i&&(Yr[8]=Yr[8]==null?$n[8]:hp(Yr[8],$n[8])),Yr[9]==null&&(Yr[9]=$n[9]),Yr[0]=$n[0],Yr[1]=ho,Yr}function W_(Yr){var $n=[];if(Yr!=null)for(var Yn in Fu(Yr))$n.push(Yn);return $n}function q_(Yr){return w0.call(Yr)}function Fv(Yr,$n,Yn){return $n=op($n===wr?Yr.length-1:$n,0),function(){for(var ao=arguments,ho=-1,$o=op(ao.length-$n,0),To=Go($o);++ho<$o;)To[ho]=ao[$n+ho];ho=-1;for(var Po=Go($n+1);++ho<$n;)Po[ho]=ao[ho];return Po[$n]=Yn(To),mp(Yr,this,Po)}}function Uv(Yr,$n){return $n.length<2?Yr:Em(Yr,Dp($n,0,-1))}function z_(Yr,$n){for(var Yn=Yr.length,ao=hp($n.length,Yn),ho=Ep(Yr);ao--;){var $o=$n[ao];Yr[ao]=rm($o,Yn)?ho[$o]:wr}return Yr}function Vy(Yr,$n){if(!($n==="constructor"&&typeof Yr[$n]=="function")&&$n!="__proto__")return Yr[$n]}var Wv=zv(Q1),i0=ow||function(Yr,$n){return Hu.setTimeout(Yr,$n)},Hy=zv(h_);function qv(Yr,$n,Yn){var ao=$n+"";return Hy(Yr,M_(ao,V_(P_(ao),Yn)))}function zv(Yr){var $n=0,Yn=0;return function(){var ao=lw(),ho=Tn-(ao-Yn);if(Yn=ao,ho>0){if(++$n>=no)return arguments[0]}else $n=0;return Yr.apply(wr,arguments)}}function V0(Yr,$n){var Yn=-1,ao=Yr.length,ho=ao-1;for($n=$n===wr?ao:$n;++Yn<$n;){var $o=Ry(Yn,ho),To=Yr[$o];Yr[$o]=Yr[Yn],Yr[Yn]=To}return Yr.length=$n,Yr}var Vv=F_(function(Yr){var $n=[];return Yr.charCodeAt(0)===46&&$n.push(""),Yr.replace(Ul,function(Yn,ao,ho,$o){$n.push(ho?$o.replace(Ko,"$1"):ao||Yn)}),$n});function Jp(Yr){if(typeof Yr=="string"||Ap(Yr))return Yr;var $n=Yr+"";return $n=="0"&&1/Yr==-Rn?"-0":$n}function Sm(Yr){if(Yr!=null){try{return x0.call(Yr)}catch{}try{return Yr+""}catch{}}return""}function V_(Yr,$n){return Op(fo,function(Yn){var ao="_."+Yn[0];$n&Yn[1]&&!m0(Yr,ao)&&Yr.push(ao)}),Yr.sort()}function Hv(Yr){if(Yr instanceof Iu)return Yr.clone();var $n=new jp(Yr.__wrapped__,Yr.__chain__);return $n.__actions__=Ep(Yr.__actions__),$n.__index__=Yr.__index__,$n.__values__=Yr.__values__,$n}function H_(Yr,$n,Yn){(Yn?vp(Yr,$n,Yn):$n===wr)?$n=1:$n=op($u($n),0);var ao=Yr==null?0:Yr.length;if(!ao||$n<1)return[];for(var ho=0,$o=0,To=Go(C0(ao/$n));ho1?Yr[$n-1]:wr;return Yn=typeof Yn=="function"?(Yr.pop(),Yn):wr,Xv(Yr,Yn)});function Qv(Yr){var $n=xo(Yr);return $n.__chain__=!0,$n}function K2(Yr,$n){return $n(Yr),Yr}function H0(Yr,$n){return $n(Yr)}var G2=tm(function(Yr){var $n=Yr.length,Yn=$n?Yr[0]:0,ao=this.__wrapped__,ho=function($o){return by($o,Yr)};return $n>1||this.__actions__.length||!(ao instanceof Iu)||!rm(Yn)?this.thru(ho):(ao=ao.slice(Yn,+Yn+($n?1:0)),ao.__actions__.push({func:H0,args:[ho],thisArg:wr}),new jp(ao,this.__chain__).thru(function($o){return $n&&!$o.length&&$o.push(wr),$o}))});function Z2(){return Qv(this)}function J2(){return new jp(this.value(),this.__chain__)}function Y2(){this.__values__===wr&&(this.__values__=hx(this.value()));var Yr=this.__index__>=this.__values__.length,$n=Yr?wr:this.__values__[this.__index__++];return{done:Yr,value:$n}}function X2(){return this}function Q2(Yr){for(var $n,Yn=this;Yn instanceof A0;){var ao=Hv(Yn);ao.__index__=0,ao.__values__=wr,$n?ho.__wrapped__=ao:$n=ao;var ho=ao;Yn=Yn.__wrapped__}return ho.__wrapped__=Yr,$n}function eE(){var Yr=this.__wrapped__;if(Yr instanceof Iu){var $n=Yr;return this.__actions__.length&&($n=new Iu(this)),$n=$n.reverse(),$n.__actions__.push({func:H0,args:[Ky],thisArg:wr}),new jp($n,this.__chain__)}return this.thru(Ky)}function tE(){return mv(this.__wrapped__,this.__actions__)}var rE=D0(function(Yr,$n,Yn){ju.call(Yr,Yn)?++Yr[Yn]:Qp(Yr,Yn,1)});function nE(Yr,$n,Yn){var ao=wu(Yr)?p1:Kw;return Yn&&vp(Yr,$n,Yn)&&($n=wr),ao(Yr,cu($n,3))}function iE(Yr,$n){var Yn=wu(Yr)?cm:F1;return Yn(Yr,cu($n,3))}var oE=kv(Kv),aE=kv(Gv);function sE(Yr,$n){return up(K0(Yr,$n),1)}function cE(Yr,$n){return up(K0(Yr,$n),Rn)}function lE(Yr,$n,Yn){return Yn=Yn===wr?1:$u(Yn),up(K0(Yr,$n),Yn)}function _b(Yr,$n){var Yn=wu(Yr)?Op:fm;return Yn(Yr,cu($n,3))}function ex(Yr,$n){var Yn=wu(Yr)?Rx:L1;return Yn(Yr,cu($n,3))}var uE=D0(function(Yr,$n,Yn){ju.call(Yr,Yn)?Yr[Yn].push($n):Qp(Yr,Yn,[$n])});function dE(Yr,$n,Yn,ao){Yr=$p(Yr)?Yr:Wm(Yr),Yn=Yn&&!ao?$u(Yn):0;var ho=Yr.length;return Yn<0&&(Yn=op(ho+Yn,0)),X0(Yr)?Yn<=ho&&Yr.indexOf($n,Yn)>-1:!!ho&&Im(Yr,$n,Yn)>-1}var fE=ku(function(Yr,$n,Yn){var ao=-1,ho=typeof $n=="function",$o=$p(Yr)?Go(Yr.length):[];return fm(Yr,function(To){$o[++ao]=ho?mp($n,To,Yn):Qm(To,$n,Yn)}),$o}),hE=D0(function(Yr,$n,Yn){Qp(Yr,Yn,$n)});function K0(Yr,$n){var Yn=wu(Yr)?Gu:H1;return Yn(Yr,cu($n,3))}function pE(Yr,$n,Yn,ao){return Yr==null?[]:(wu($n)||($n=$n==null?[]:[$n]),Yn=ao?wr:Yn,wu(Yn)||(Yn=Yn==null?[]:[Yn]),J1(Yr,$n,Yn))}var mE=D0(function(Yr,$n,Yn){Yr[Yn?0:1].push($n)},function(){return[[],[]]});function gE(Yr,$n,Yn){var ao=wu(Yr)?ay:b1,ho=arguments.length<3;return ao(Yr,cu($n,4),Yn,ho,fm)}function yE(Yr,$n,Yn){var ao=wu(Yr)?Tx:b1,ho=arguments.length<3;return ao(Yr,cu($n,4),Yn,ho,L1)}function vE(Yr,$n){var Yn=wu(Yr)?cm:F1;return Yn(Yr,J0(cu($n,3)))}function bE(Yr){var $n=wu(Yr)?M1:d_;return $n(Yr)}function xE(Yr,$n,Yn){(Yn?vp(Yr,$n,Yn):$n===wr)?$n=1:$n=$u($n);var ao=wu(Yr)?Ww:f_;return ao(Yr,$n)}function wE(Yr){var $n=wu(Yr)?qw:p_;return $n(Yr)}function _E(Yr){if(Yr==null)return 0;if($p(Yr))return X0(Yr)?Pm(Yr):Yr.length;var $n=pp(Yr);return $n==Lo||$n==Fo?Yr.size:Sy(Yr).length}function EE(Yr,$n,Yn){var ao=wu(Yr)?sy:m_;return Yn&&vp(Yr,$n,Yn)&&($n=wr),ao(Yr,cu($n,3))}var $E=ku(function(Yr,$n){if(Yr==null)return[];var Yn=$n.length;return Yn>1&&vp(Yr,$n[0],$n[1])?$n=[]:Yn>2&&vp($n[0],$n[1],$n[2])&&($n=[$n[0]]),J1(Yr,up($n,1),[])}),G0=iw||function(){return Hu.Date.now()};function SE(Yr,$n){if(typeof $n!="function")throw new Mp(Br);return Yr=$u(Yr),function(){if(--Yr<1)return $n.apply(this,arguments)}}function rx(Yr,$n,Yn){return $n=Yn?wr:$n,$n=Yr&&$n==null?Yr.length:$n,em(Yr,_i,wr,wr,wr,wr,$n)}function nx(Yr,$n){var Yn;if(typeof $n!="function")throw new Mp(Br);return Yr=$u(Yr),function(){return--Yr>0&&(Yn=$n.apply(this,arguments)),Yr<=1&&($n=wr),Yn}}var Zy=ku(function(Yr,$n,Yn){var ao=Cn;if(Yn.length){var ho=um(Yn,Fm(Zy));ao|=ro}return em(Yr,ao,$n,Yn,ho)}),ix=ku(function(Yr,$n,Yn){var ao=Cn|In;if(Yn.length){var ho=um(Yn,Fm(ix));ao|=ro}return em($n,ao,Yr,Yn,ho)});function ox(Yr,$n,Yn){$n=Yn?wr:$n;var ao=em(Yr,jn,wr,wr,wr,wr,wr,$n);return ao.placeholder=ox.placeholder,ao}function ax(Yr,$n,Yn){$n=Yn?wr:$n;var ao=em(Yr,eo,wr,wr,wr,wr,wr,$n);return ao.placeholder=ax.placeholder,ao}function sx(Yr,$n,Yn){var ao,ho,$o,To,Po,Mo,_c=0,yl=!1,Rl=!1,Hl=!0;if(typeof Yr!="function")throw new Mp(Br);$n=Up($n)||0,_f(Yn)&&(yl=!!Yn.leading,Rl="maxWait"in Yn,$o=Rl?op(Up(Yn.maxWait)||0,$n):$o,Hl="trailing"in Yn?!!Yn.trailing:Hl);function eu(rp){var Hp=ao,om=ho;return ao=ho=wr,_c=rp,To=Yr.apply(om,Hp),To}function lu(rp){return _c=rp,Po=i0(Ru,$n),yl?eu(rp):To}function Su(rp){var Hp=rp-Mo,om=rp-_c,kx=$n-Hp;return Rl?hp(kx,$o-om):kx}function uu(rp){var Hp=rp-Mo,om=rp-_c;return Mo===wr||Hp>=$n||Hp<0||Rl&&om>=$o}function Ru(){var rp=G0();if(uu(rp))return Pu(rp);Po=i0(Ru,Su(rp))}function Pu(rp){return Po=wr,Hl&&ao?eu(rp):(ao=ho=wr,To)}function Pp(){Po!==wr&&yv(Po),_c=0,ao=Mo=ho=Po=wr}function bp(){return Po===wr?To:Pu(G0())}function Np(){var rp=G0(),Hp=uu(rp);if(ao=arguments,ho=this,Mo=rp,Hp){if(Po===wr)return lu(Mo);if(Rl)return yv(Po),Po=i0(Ru,$n),eu(Mo)}return Po===wr&&(Po=i0(Ru,$n)),To}return Np.cancel=Pp,Np.flush=bp,Np}var kE=ku(function(Yr,$n){return D1(Yr,1,$n)}),CE=ku(function(Yr,$n,Yn){return D1(Yr,Up($n)||0,Yn)});function RE(Yr){return em(Yr,io)}function Z0(Yr,$n){if(typeof Yr!="function"||$n!=null&&typeof $n!="function")throw new Mp(Br);var Yn=function(){var ao=arguments,ho=$n?$n.apply(this,ao):ao[0],$o=Yn.cache;if($o.has(ho))return $o.get(ho);var To=Yr.apply(this,ao);return Yn.cache=$o.set(ho,To)||$o,To};return Yn.cache=new(Z0.Cache||Xp),Yn}Z0.Cache=Xp;function J0(Yr){if(typeof Yr!="function")throw new Mp(Br);return function(){var $n=arguments;switch($n.length){case 0:return!Yr.call(this);case 1:return!Yr.call(this,$n[0]);case 2:return!Yr.call(this,$n[0],$n[1]);case 3:return!Yr.call(this,$n[0],$n[1],$n[2])}return!Yr.apply(this,$n)}}function TE(Yr){return nx(2,Yr)}var IE=g_(function(Yr,$n){$n=$n.length==1&&wu($n[0])?Gu($n[0],Tp(cu())):Gu(up($n,1),Tp(cu()));var Yn=$n.length;return ku(function(ao){for(var ho=-1,$o=hp(ao.length,Yn);++ho<$o;)ao[ho]=$n[ho].call(this,ao[ho]);return mp(Yr,this,ao)})}),Jy=ku(function(Yr,$n){var Yn=um($n,Fm(Jy));return em(Yr,ro,wr,$n,Yn)}),cx=ku(function(Yr,$n){var Yn=um($n,Fm(cx));return em(Yr,to,wr,$n,Yn)}),AE=tm(function(Yr,$n){return em(Yr,oo,wr,wr,wr,$n)});function PE(Yr,$n){if(typeof Yr!="function")throw new Mp(Br);return $n=$n===wr?$n:$u($n),ku(Yr,$n)}function NE(Yr,$n){if(typeof Yr!="function")throw new Mp(Br);return $n=$n==null?0:op($u($n),0),ku(function(Yn){var ao=Yn[$n],ho=mm(Yn,0,$n);return ao&&lm(ho,ao),mp(Yr,this,ho)})}function OE(Yr,$n,Yn){var ao=!0,ho=!0;if(typeof Yr!="function")throw new Mp(Br);return _f(Yn)&&(ao="leading"in Yn?!!Yn.leading:ao,ho="trailing"in Yn?!!Yn.trailing:ho),sx(Yr,$n,{leading:ao,maxWait:$n,trailing:ho})}function ME(Yr){return rx(Yr,1)}function jE(Yr,$n){return Jy(Oy($n),Yr)}function BE(){if(!arguments.length)return[];var Yr=arguments[0];return wu(Yr)?Yr:[Yr]}function DE(Yr){return Bp(Yr,Qr)}function LE(Yr,$n){return $n=typeof $n=="function"?$n:wr,Bp(Yr,Qr,$n)}function FE(Yr){return Bp(Yr,Zr|Qr)}function UE(Yr,$n){return $n=typeof $n=="function"?$n:wr,Bp(Yr,Zr|Qr,$n)}function WE(Yr,$n){return $n==null||B1(Yr,$n,sp($n))}function Vp(Yr,$n){return Yr===$n||Yr!==Yr&&$n!==$n}var qE=W0(_y),zE=W0(function(Yr,$n){return Yr>=$n}),km=q1(function(){return arguments}())?q1:function(Yr){return ep(Yr)&&ju.call(Yr,"callee")&&!T1.call(Yr,"callee")},wu=Go.isArray,VE=am?Tp(am):Qw;function $p(Yr){return Yr!=null&&Y0(Yr.length)&&!nm(Yr)}function tp(Yr){return ep(Yr)&&$p(Yr)}function HE(Yr){return Yr===!0||Yr===!1||ep(Yr)&&yp(Yr)==lo}var gm=aw||s1,KE=Cm?Tp(Cm):e_;function GE(Yr){return ep(Yr)&&Yr.nodeType===1&&!o0(Yr)}function ZE(Yr){if(Yr==null)return!0;if($p(Yr)&&(wu(Yr)||typeof Yr=="string"||typeof Yr.splice=="function"||gm(Yr)||Um(Yr)||km(Yr)))return!Yr.length;var $n=pp(Yr);if($n==Lo||$n==Fo)return!Yr.size;if(n0(Yr))return!Sy(Yr).length;for(var Yn in Yr)if(ju.call(Yr,Yn))return!1;return!0}function JE(Yr,$n){return e0(Yr,$n)}function YE(Yr,$n,Yn){Yn=typeof Yn=="function"?Yn:wr;var ao=Yn?Yn(Yr,$n):wr;return ao===wr?e0(Yr,$n,wr,Yn):!!ao}function Yy(Yr){if(!ep(Yr))return!1;var $n=yp(Yr);return $n==yo||$n==mo||typeof Yr.message=="string"&&typeof Yr.name=="string"&&!o0(Yr)}function XE(Yr){return typeof Yr=="number"&&A1(Yr)}function nm(Yr){if(!_f(Yr))return!1;var $n=yp(Yr);return $n==_o||$n==Bo||$n==uo||$n==wl}function lx(Yr){return typeof Yr=="number"&&Yr==$u(Yr)}function Y0(Yr){return typeof Yr=="number"&&Yr>-1&&Yr%1==0&&Yr<=Pn}function _f(Yr){var $n=typeof Yr;return Yr!=null&&($n=="object"||$n=="function")}function ep(Yr){return Yr!=null&&typeof Yr=="object"}var ux=vm?Tp(vm):r_;function QE(Yr,$n){return Yr===$n||$y(Yr,$n,Uy($n))}function e3(Yr,$n,Yn){return Yn=typeof Yn=="function"?Yn:wr,$y(Yr,$n,Uy($n),Yn)}function t3(Yr){return dx(Yr)&&Yr!=+Yr}function r3(Yr){if(L_(Yr))throw new xu(jr);return z1(Yr)}function n3(Yr){return Yr===null}function i3(Yr){return Yr==null}function dx(Yr){return typeof Yr=="number"||ep(Yr)&&yp(Yr)==Wo}function o0(Yr){if(!ep(Yr)||yp(Yr)!=qo)return!1;var $n=$0(Yr);if($n===null)return!0;var Yn=ju.call($n,"constructor")&&$n.constructor;return typeof Yn=="function"&&Yn instanceof Yn&&x0.call(Yn)==ew}var Xy=Tm?Tp(Tm):n_;function o3(Yr){return lx(Yr)&&Yr>=-Pn&&Yr<=Pn}var fx=ny?Tp(ny):i_;function X0(Yr){return typeof Yr=="string"||!wu(Yr)&&ep(Yr)&&yp(Yr)==Nl}function Ap(Yr){return typeof Yr=="symbol"||ep(Yr)&&yp(Yr)==Vo}var Um=u0?Tp(u0):o_;function a3(Yr){return Yr===wr}function s3(Yr){return ep(Yr)&&pp(Yr)==Ml}function c3(Yr){return ep(Yr)&&yp(Yr)==$a}var l3=W0(ky),u3=W0(function(Yr,$n){return Yr<=$n});function hx(Yr){if(!Yr)return[];if($p(Yr))return X0(Yr)?qp(Yr):Ep(Yr);if(Hm&&Yr[Hm])return Wx(Yr[Hm]());var $n=pp(Yr),Yn=$n==Lo?hy:$n==Fo?y0:Wm;return Yn(Yr)}function im(Yr){if(!Yr)return Yr===0?Yr:0;if(Yr=Up(Yr),Yr===Rn||Yr===-Rn){var $n=Yr<0?-1:1;return $n*On}return Yr===Yr?Yr:0}function $u(Yr){var $n=im(Yr),Yn=$n%1;return $n===$n?Yn?$n-Yn:$n:0}function px(Yr){return Yr?_m($u(Yr),0,Nn):0}function Up(Yr){if(typeof Yr=="number")return Yr;if(Ap(Yr))return Zn;if(_f(Yr)){var $n=typeof Yr.valueOf=="function"?Yr.valueOf():Yr;Yr=_f($n)?$n+"":$n}if(typeof Yr!="string")return Yr===0?Yr:+Yr;Yr=x1(Yr);var Yn=Cu.test(Yr);return Yn||pu.test(Yr)?Xu(Yr.slice(2),Yn?2:8):El.test(Yr)?Zn:+Yr}function mx(Yr){return Zp(Yr,Sp(Yr))}function d3(Yr){return Yr?_m($u(Yr),-Pn,Pn):Yr===0?Yr:0}function Mu(Yr){return Yr==null?"":Ip(Yr)}var f3=Dm(function(Yr,$n){if(n0($n)||$p($n)){Zp($n,sp($n),Yr);return}for(var Yn in $n)ju.call($n,Yn)&&Ym(Yr,Yn,$n[Yn])}),gx=Dm(function(Yr,$n){Zp($n,Sp($n),Yr)}),Q0=Dm(function(Yr,$n,Yn,ao){Zp($n,Sp($n),Yr,ao)}),h3=Dm(function(Yr,$n,Yn,ao){Zp($n,sp($n),Yr,ao)}),p3=tm(by);function m3(Yr,$n){var Yn=Bm(Yr);return $n==null?Yn:j1(Yn,$n)}var g3=ku(function(Yr,$n){Yr=Fu(Yr);var Yn=-1,ao=$n.length,ho=ao>2?$n[2]:wr;for(ho&&vp($n[0],$n[1],ho)&&(ao=1);++Yn1),$o}),Zp(Yr,Ly(Yr),Yn),ao&&(Yn=Bp(Yn,Zr|Jr|Qr,C_));for(var ho=$n.length;ho--;)Ay(Yn,$n[ho]);return Yn});function j3(Yr,$n){return vx(Yr,J0(cu($n)))}var B3=tm(function(Yr,$n){return Yr==null?{}:c_(Yr,$n)});function vx(Yr,$n){if(Yr==null)return{};var Yn=Gu(Ly(Yr),function(ao){return[ao]});return $n=cu($n),Y1(Yr,Yn,function(ao,ho){return $n(ao,ho[0])})}function D3(Yr,$n,Yn){$n=pm($n,Yr);var ao=-1,ho=$n.length;for(ho||(ho=1,Yr=wr);++ao$n){var ao=Yr;Yr=$n,$n=ao}if(Yn||Yr%1||$n%1){var ho=P1();return hp(Yr+ho*($n-Yr+Yu("1e-"+((ho+"").length-1))),$n)}return Ry(Yr,$n)}var Z3=Lm(function(Yr,$n,Yn){return $n=$n.toLowerCase(),Yr+(Yn?wx($n):$n)});function wx(Yr){return t1(Mu(Yr).toLowerCase())}function _x(Yr){return Yr=Mu(Yr),Yr&&Yr.replace(hu,Bx).replace(Rm,"")}function J3(Yr,$n,Yn){Yr=Mu(Yr),$n=Ip($n);var ao=Yr.length;Yn=Yn===wr?ao:_m($u(Yn),0,ao);var ho=Yn;return Yn-=$n.length,Yn>=0&&Yr.slice(Yn,ho)==$n}function Y3(Yr){return Yr=Mu(Yr),Yr&&Bl.test(Yr)?Yr.replace(Tl,Dx):Yr}function X3(Yr){return Yr=Mu(Yr),Yr&&_u.test(Yr)?Yr.replace(Sl,"\\$&"):Yr}var Q3=Lm(function(Yr,$n,Yn){return Yr+(Yn?"-":"")+$n.toLowerCase()}),e$=Lm(function(Yr,$n,Yn){return Yr+(Yn?" ":"")+$n.toLowerCase()}),t$=Sv("toLowerCase");function r$(Yr,$n,Yn){Yr=Mu(Yr),$n=$u($n);var ao=$n?Pm(Yr):0;if(!$n||ao>=$n)return Yr;var ho=($n-ao)/2;return U0(R0(ho),Yn)+Yr+U0(C0(ho),Yn)}function n$(Yr,$n,Yn){Yr=Mu(Yr),$n=$u($n);var ao=$n?Pm(Yr):0;return $n&&ao<$n?Yr+U0($n-ao,Yn):Yr}function i$(Yr,$n,Yn){Yr=Mu(Yr),$n=$u($n);var ao=$n?Pm(Yr):0;return $n&&ao<$n?U0($n-ao,Yn)+Yr:Yr}function o$(Yr,$n,Yn){return Yn||$n==null?$n=0:$n&&($n=+$n),uw(Mu(Yr).replace(So,""),$n||0)}function a$(Yr,$n,Yn){return(Yn?vp(Yr,$n,Yn):$n===wr)?$n=1:$n=$u($n),Ty(Mu(Yr),$n)}function s$(){var Yr=arguments,$n=Mu(Yr[0]);return Yr.length<3?$n:$n.replace(Yr[1],Yr[2])}var c$=Lm(function(Yr,$n,Yn){return Yr+(Yn?"_":"")+$n.toLowerCase()});function l$(Yr,$n,Yn){return Yn&&typeof Yn!="number"&&vp(Yr,$n,Yn)&&($n=Yn=wr),Yn=Yn===wr?Nn:Yn>>>0,Yn?(Yr=Mu(Yr),Yr&&(typeof $n=="string"||$n!=null&&!Xy($n))&&($n=Ip($n),!$n&&Am(Yr))?mm(qp(Yr),0,Yn):Yr.split($n,Yn)):[]}var u$=Lm(function(Yr,$n,Yn){return Yr+(Yn?" ":"")+t1($n)});function d$(Yr,$n,Yn){return Yr=Mu(Yr),Yn=Yn==null?0:_m($u(Yn),0,Yr.length),$n=Ip($n),Yr.slice(Yn,Yn+$n.length)==$n}function f$(Yr,$n,Yn){var ao=xo.templateSettings;Yn&&vp(Yr,$n,Yn)&&($n=wr),Yr=Mu(Yr),$n=Q0({},$n,ao,Pv);var ho=Q0({},$n.imports,ao.imports,Pv),$o=sp(ho),To=fy(ho,$o),Po,Mo,_c=0,yl=$n.interpolate||mu,Rl="__p += '",Hl=py(($n.escape||mu).source+"|"+yl.source+"|"+(yl===Al?Wl:mu).source+"|"+($n.evaluate||mu).source+"|$","g"),eu="//# sourceURL="+(ju.call($n,"sourceURL")?($n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ry+"]")+` +`)}function j_(Yr){return wu(Yr)||km(Yr)||!!(Iy&&Yr&&Yr[Iy])}function rm(Yr,$n){var Yn=typeof Yr;return $n=$n??Pn,!!$n&&(Yn=="number"||Yn!="symbol"&&yu.test(Yr))&&Yr>-1&&Yr%1==0&&Yr<$n}function vp(Yr,$n,Yn){if(!_f(Yn))return!1;var ao=typeof $n;return(ao=="number"?$p(Yn)&&rm($n,Yn.length):ao=="string"&&$n in Yn)?Vp(Yn[$n],Yr):!1}function V1(Yr,$n){if(wu(Yr))return!1;var Yn=typeof Yr;return Yn=="number"||Yn=="symbol"||Yn=="boolean"||Yr==null||Ap(Yr)?!0:Tu.test(Yr)||!Ml.test(Yr)||$n!=null&&Yr in Uu($n)}function B_(Yr){var $n=typeof Yr;return $n=="string"||$n=="number"||$n=="symbol"||$n=="boolean"?Yr!=="__proto__":Yr===null}function H1(Yr){var $n=q0(Yr),Yn=xo[$n];if(typeof Yn!="function"||!($n in Iu.prototype))return!1;if(Yr===Yn)return!0;var ao=W1(Yn);return!!ao&&Yr===ao[0]}function D_(Yr){return!!ky&&ky in Yr}var L_=b0?nm:ly;function n0(Yr){var $n=Yr&&Yr.constructor,Yn=typeof $n=="function"&&$n.prototype||Mm;return Yr===Yn}function Dv(Yr){return Yr===Yr&&!_f(Yr)}function Lv(Yr,$n){return function(Yn){return Yn==null?!1:Yn[Yr]===$n&&($n!==wr||Yr in Uu(Yn))}}function U_(Yr){var $n=Z0(Yr,function(ao){return Yn.size===Gr&&Yn.clear(),ao}),Yn=$n.cache;return $n}function F_(Yr,$n){var Yn=Yr[1],ao=$n[1],ho=Yn|ao,$o=ho<(Cn|In|_i),To=ao==_i&&Yn==jn||ao==_i&&Yn==oo&&Yr[7].length<=$n[8]||ao==(_i|oo)&&$n[7].length<=$n[8]&&Yn==jn;if(!($o||To))return Yr;ao&Cn&&(Yr[2]=$n[2],ho|=Yn&Cn?0:An);var Po=$n[3];if(Po){var Oo=Yr[3];Yr[3]=Oo?wv(Oo,Po,$n[4]):Po,Yr[4]=Oo?um(Yr[3],Vr):$n[4]}return Po=$n[5],Po&&(Oo=Yr[5],Yr[5]=Oo?_v(Oo,Po,$n[6]):Po,Yr[6]=Oo?um(Yr[5],Vr):$n[6]),Po=$n[7],Po&&(Yr[7]=Po),ao&_i&&(Yr[8]=Yr[8]==null?$n[8]:hp(Yr[8],$n[8])),Yr[9]==null&&(Yr[9]=$n[9]),Yr[0]=$n[0],Yr[1]=ho,Yr}function W_(Yr){var $n=[];if(Yr!=null)for(var Yn in Uu(Yr))$n.push(Yn);return $n}function q_(Yr){return w0.call(Yr)}function Uv(Yr,$n,Yn){return $n=op($n===wr?Yr.length-1:$n,0),function(){for(var ao=arguments,ho=-1,$o=op(ao.length-$n,0),To=Go($o);++ho<$o;)To[ho]=ao[$n+ho];ho=-1;for(var Po=Go($n+1);++ho<$n;)Po[ho]=ao[ho];return Po[$n]=Yn(To),mp(Yr,this,Po)}}function Fv(Yr,$n){return $n.length<2?Yr:Em(Yr,Dp($n,0,-1))}function z_(Yr,$n){for(var Yn=Yr.length,ao=hp($n.length,Yn),ho=Ep(Yr);ao--;){var $o=$n[ao];Yr[ao]=rm($o,Yn)?ho[$o]:wr}return Yr}function K1(Yr,$n){if(!($n==="constructor"&&typeof Yr[$n]=="function")&&$n!="__proto__")return Yr[$n]}var Wv=zv(Qy),i0=ow||function(Yr,$n){return Hu.setTimeout(Yr,$n)},G1=zv(h_);function qv(Yr,$n,Yn){var ao=$n+"";return G1(Yr,O_(ao,V_(P_(ao),Yn)))}function zv(Yr){var $n=0,Yn=0;return function(){var ao=lw(),ho=Tn-(ao-Yn);if(Yn=ao,ho>0){if(++$n>=no)return arguments[0]}else $n=0;return Yr.apply(wr,arguments)}}function V0(Yr,$n){var Yn=-1,ao=Yr.length,ho=ao-1;for($n=$n===wr?ao:$n;++Yn<$n;){var $o=I1(Yn,ho),To=Yr[$o];Yr[$o]=Yr[Yn],Yr[Yn]=To}return Yr.length=$n,Yr}var Vv=U_(function(Yr){var $n=[];return Yr.charCodeAt(0)===46&&$n.push(""),Yr.replace(Fl,function(Yn,ao,ho,$o){$n.push(ho?$o.replace(Ko,"$1"):ao||Yn)}),$n});function Jp(Yr){if(typeof Yr=="string"||Ap(Yr))return Yr;var $n=Yr+"";return $n=="0"&&1/Yr==-Rn?"-0":$n}function Sm(Yr){if(Yr!=null){try{return x0.call(Yr)}catch{}try{return Yr+""}catch{}}return""}function V_(Yr,$n){return Mp(fo,function(Yn){var ao="_."+Yn[0];$n&Yn[1]&&!m0(Yr,ao)&&Yr.push(ao)}),Yr.sort()}function Hv(Yr){if(Yr instanceof Iu)return Yr.clone();var $n=new jp(Yr.__wrapped__,Yr.__chain__);return $n.__actions__=Ep(Yr.__actions__),$n.__index__=Yr.__index__,$n.__values__=Yr.__values__,$n}function H_(Yr,$n,Yn){(Yn?vp(Yr,$n,Yn):$n===wr)?$n=1:$n=op($u($n),0);var ao=Yr==null?0:Yr.length;if(!ao||$n<1)return[];for(var ho=0,$o=0,To=Go(C0(ao/$n));ho1?Yr[$n-1]:wr;return Yn=typeof Yn=="function"?(Yr.pop(),Yn):wr,Xv(Yr,Yn)});function Qv(Yr){var $n=xo(Yr);return $n.__chain__=!0,$n}function K2(Yr,$n){return $n(Yr),Yr}function H0(Yr,$n){return $n(Yr)}var G2=tm(function(Yr){var $n=Yr.length,Yn=$n?Yr[0]:0,ao=this.__wrapped__,ho=function($o){return x1($o,Yr)};return $n>1||this.__actions__.length||!(ao instanceof Iu)||!rm(Yn)?this.thru(ho):(ao=ao.slice(Yn,+Yn+($n?1:0)),ao.__actions__.push({func:H0,args:[ho],thisArg:wr}),new jp(ao,this.__chain__).thru(function($o){return $n&&!$o.length&&$o.push(wr),$o}))});function Z2(){return Qv(this)}function J2(){return new jp(this.value(),this.__chain__)}function Y2(){this.__values__===wr&&(this.__values__=hx(this.value()));var Yr=this.__index__>=this.__values__.length,$n=Yr?wr:this.__values__[this.__index__++];return{done:Yr,value:$n}}function X2(){return this}function Q2(Yr){for(var $n,Yn=this;Yn instanceof A0;){var ao=Hv(Yn);ao.__index__=0,ao.__values__=wr,$n?ho.__wrapped__=ao:$n=ao;var ho=ao;Yn=Yn.__wrapped__}return ho.__wrapped__=Yr,$n}function eE(){var Yr=this.__wrapped__;if(Yr instanceof Iu){var $n=Yr;return this.__actions__.length&&($n=new Iu(this)),$n=$n.reverse(),$n.__actions__.push({func:H0,args:[Z1],thisArg:wr}),new jp($n,this.__chain__)}return this.thru(Z1)}function tE(){return mv(this.__wrapped__,this.__actions__)}var rE=D0(function(Yr,$n,Yn){ju.call(Yr,Yn)?++Yr[Yn]:Qp(Yr,Yn,1)});function nE(Yr,$n,Yn){var ao=wu(Yr)?gy:Kw;return Yn&&vp(Yr,$n,Yn)&&($n=wr),ao(Yr,cu($n,3))}function iE(Yr,$n){var Yn=wu(Yr)?cm:Uy;return Yn(Yr,cu($n,3))}var oE=kv(Kv),aE=kv(Gv);function sE(Yr,$n){return up(K0(Yr,$n),1)}function cE(Yr,$n){return up(K0(Yr,$n),Rn)}function lE(Yr,$n,Yn){return Yn=Yn===wr?1:$u(Yn),up(K0(Yr,$n),Yn)}function _b(Yr,$n){var Yn=wu(Yr)?Mp:fm;return Yn(Yr,cu($n,3))}function ex(Yr,$n){var Yn=wu(Yr)?Rx:Ly;return Yn(Yr,cu($n,3))}var uE=D0(function(Yr,$n,Yn){ju.call(Yr,Yn)?Yr[Yn].push($n):Qp(Yr,Yn,[$n])});function dE(Yr,$n,Yn,ao){Yr=$p(Yr)?Yr:Wm(Yr),Yn=Yn&&!ao?$u(Yn):0;var ho=Yr.length;return Yn<0&&(Yn=op(ho+Yn,0)),X0(Yr)?Yn<=ho&&Yr.indexOf($n,Yn)>-1:!!ho&&Im(Yr,$n,Yn)>-1}var fE=ku(function(Yr,$n,Yn){var ao=-1,ho=typeof $n=="function",$o=$p(Yr)?Go(Yr.length):[];return fm(Yr,function(To){$o[++ao]=ho?mp($n,To,Yn):Qm(To,$n,Yn)}),$o}),hE=D0(function(Yr,$n,Yn){Qp(Yr,Yn,$n)});function K0(Yr,$n){var Yn=wu(Yr)?Gu:Hy;return Yn(Yr,cu($n,3))}function pE(Yr,$n,Yn,ao){return Yr==null?[]:(wu($n)||($n=$n==null?[]:[$n]),Yn=ao?wr:Yn,wu(Yn)||(Yn=Yn==null?[]:[Yn]),Jy(Yr,$n,Yn))}var mE=D0(function(Yr,$n,Yn){Yr[Yn?0:1].push($n)},function(){return[[],[]]});function gE(Yr,$n,Yn){var ao=wu(Yr)?a1:xy,ho=arguments.length<3;return ao(Yr,cu($n,4),Yn,ho,fm)}function yE(Yr,$n,Yn){var ao=wu(Yr)?Tx:xy,ho=arguments.length<3;return ao(Yr,cu($n,4),Yn,ho,Ly)}function vE(Yr,$n){var Yn=wu(Yr)?cm:Uy;return Yn(Yr,J0(cu($n,3)))}function bE(Yr){var $n=wu(Yr)?Oy:d_;return $n(Yr)}function xE(Yr,$n,Yn){(Yn?vp(Yr,$n,Yn):$n===wr)?$n=1:$n=$u($n);var ao=wu(Yr)?Ww:f_;return ao(Yr,$n)}function wE(Yr){var $n=wu(Yr)?qw:p_;return $n(Yr)}function _E(Yr){if(Yr==null)return 0;if($p(Yr))return X0(Yr)?Pm(Yr):Yr.length;var $n=pp(Yr);return $n==Lo||$n==Uo?Yr.size:C1(Yr).length}function EE(Yr,$n,Yn){var ao=wu(Yr)?s1:m_;return Yn&&vp(Yr,$n,Yn)&&($n=wr),ao(Yr,cu($n,3))}var $E=ku(function(Yr,$n){if(Yr==null)return[];var Yn=$n.length;return Yn>1&&vp(Yr,$n[0],$n[1])?$n=[]:Yn>2&&vp($n[0],$n[1],$n[2])&&($n=[$n[0]]),Jy(Yr,up($n,1),[])}),G0=iw||function(){return Hu.Date.now()};function SE(Yr,$n){if(typeof $n!="function")throw new Op(Br);return Yr=$u(Yr),function(){if(--Yr<1)return $n.apply(this,arguments)}}function rx(Yr,$n,Yn){return $n=Yn?wr:$n,$n=Yr&&$n==null?Yr.length:$n,em(Yr,_i,wr,wr,wr,wr,$n)}function nx(Yr,$n){var Yn;if(typeof $n!="function")throw new Op(Br);return Yr=$u(Yr),function(){return--Yr>0&&(Yn=$n.apply(this,arguments)),Yr<=1&&($n=wr),Yn}}var Y1=ku(function(Yr,$n,Yn){var ao=Cn;if(Yn.length){var ho=um(Yn,Um(Y1));ao|=ro}return em(Yr,ao,$n,Yn,ho)}),ix=ku(function(Yr,$n,Yn){var ao=Cn|In;if(Yn.length){var ho=um(Yn,Um(ix));ao|=ro}return em($n,ao,Yr,Yn,ho)});function ox(Yr,$n,Yn){$n=Yn?wr:$n;var ao=em(Yr,jn,wr,wr,wr,wr,wr,$n);return ao.placeholder=ox.placeholder,ao}function ax(Yr,$n,Yn){$n=Yn?wr:$n;var ao=em(Yr,eo,wr,wr,wr,wr,wr,$n);return ao.placeholder=ax.placeholder,ao}function sx(Yr,$n,Yn){var ao,ho,$o,To,Po,Oo,_c=0,yl=!1,Rl=!1,Hl=!0;if(typeof Yr!="function")throw new Op(Br);$n=Up($n)||0,_f(Yn)&&(yl=!!Yn.leading,Rl="maxWait"in Yn,$o=Rl?op(Up(Yn.maxWait)||0,$n):$o,Hl="trailing"in Yn?!!Yn.trailing:Hl);function eu(rp){var Hp=ao,om=ho;return ao=ho=wr,_c=rp,To=Yr.apply(om,Hp),To}function lu(rp){return _c=rp,Po=i0(Ru,$n),yl?eu(rp):To}function Su(rp){var Hp=rp-Oo,om=rp-_c,kx=$n-Hp;return Rl?hp(kx,$o-om):kx}function uu(rp){var Hp=rp-Oo,om=rp-_c;return Oo===wr||Hp>=$n||Hp<0||Rl&&om>=$o}function Ru(){var rp=G0();if(uu(rp))return Pu(rp);Po=i0(Ru,Su(rp))}function Pu(rp){return Po=wr,Hl&&ao?eu(rp):(ao=ho=wr,To)}function Pp(){Po!==wr&&yv(Po),_c=0,ao=Oo=ho=Po=wr}function bp(){return Po===wr?To:Pu(G0())}function Np(){var rp=G0(),Hp=uu(rp);if(ao=arguments,ho=this,Oo=rp,Hp){if(Po===wr)return lu(Oo);if(Rl)return yv(Po),Po=i0(Ru,$n),eu(Oo)}return Po===wr&&(Po=i0(Ru,$n)),To}return Np.cancel=Pp,Np.flush=bp,Np}var kE=ku(function(Yr,$n){return Dy(Yr,1,$n)}),CE=ku(function(Yr,$n,Yn){return Dy(Yr,Up($n)||0,Yn)});function RE(Yr){return em(Yr,io)}function Z0(Yr,$n){if(typeof Yr!="function"||$n!=null&&typeof $n!="function")throw new Op(Br);var Yn=function(){var ao=arguments,ho=$n?$n.apply(this,ao):ao[0],$o=Yn.cache;if($o.has(ho))return $o.get(ho);var To=Yr.apply(this,ao);return Yn.cache=$o.set(ho,To)||$o,To};return Yn.cache=new(Z0.Cache||Xp),Yn}Z0.Cache=Xp;function J0(Yr){if(typeof Yr!="function")throw new Op(Br);return function(){var $n=arguments;switch($n.length){case 0:return!Yr.call(this);case 1:return!Yr.call(this,$n[0]);case 2:return!Yr.call(this,$n[0],$n[1]);case 3:return!Yr.call(this,$n[0],$n[1],$n[2])}return!Yr.apply(this,$n)}}function TE(Yr){return nx(2,Yr)}var IE=g_(function(Yr,$n){$n=$n.length==1&&wu($n[0])?Gu($n[0],Tp(cu())):Gu(up($n,1),Tp(cu()));var Yn=$n.length;return ku(function(ao){for(var ho=-1,$o=hp(ao.length,Yn);++ho<$o;)ao[ho]=$n[ho].call(this,ao[ho]);return mp(Yr,this,ao)})}),X1=ku(function(Yr,$n){var Yn=um($n,Um(X1));return em(Yr,ro,wr,$n,Yn)}),cx=ku(function(Yr,$n){var Yn=um($n,Um(cx));return em(Yr,to,wr,$n,Yn)}),AE=tm(function(Yr,$n){return em(Yr,oo,wr,wr,wr,$n)});function PE(Yr,$n){if(typeof Yr!="function")throw new Op(Br);return $n=$n===wr?$n:$u($n),ku(Yr,$n)}function NE(Yr,$n){if(typeof Yr!="function")throw new Op(Br);return $n=$n==null?0:op($u($n),0),ku(function(Yn){var ao=Yn[$n],ho=mm(Yn,0,$n);return ao&&lm(ho,ao),mp(Yr,this,ho)})}function ME(Yr,$n,Yn){var ao=!0,ho=!0;if(typeof Yr!="function")throw new Op(Br);return _f(Yn)&&(ao="leading"in Yn?!!Yn.leading:ao,ho="trailing"in Yn?!!Yn.trailing:ho),sx(Yr,$n,{leading:ao,maxWait:$n,trailing:ho})}function OE(Yr){return rx(Yr,1)}function jE(Yr,$n){return X1(j1($n),Yr)}function BE(){if(!arguments.length)return[];var Yr=arguments[0];return wu(Yr)?Yr:[Yr]}function DE(Yr){return Bp(Yr,Qr)}function LE(Yr,$n){return $n=typeof $n=="function"?$n:wr,Bp(Yr,Qr,$n)}function UE(Yr){return Bp(Yr,Zr|Qr)}function FE(Yr,$n){return $n=typeof $n=="function"?$n:wr,Bp(Yr,Zr|Qr,$n)}function WE(Yr,$n){return $n==null||By(Yr,$n,sp($n))}function Vp(Yr,$n){return Yr===$n||Yr!==Yr&&$n!==$n}var qE=W0($1),zE=W0(function(Yr,$n){return Yr>=$n}),km=qy(function(){return arguments}())?qy:function(Yr){return ep(Yr)&&ju.call(Yr,"callee")&&!Ty.call(Yr,"callee")},wu=Go.isArray,VE=am?Tp(am):Qw;function $p(Yr){return Yr!=null&&Y0(Yr.length)&&!nm(Yr)}function tp(Yr){return ep(Yr)&&$p(Yr)}function HE(Yr){return Yr===!0||Yr===!1||ep(Yr)&&yp(Yr)==lo}var gm=aw||ly,KE=Cm?Tp(Cm):e_;function GE(Yr){return ep(Yr)&&Yr.nodeType===1&&!o0(Yr)}function ZE(Yr){if(Yr==null)return!0;if($p(Yr)&&(wu(Yr)||typeof Yr=="string"||typeof Yr.splice=="function"||gm(Yr)||Fm(Yr)||km(Yr)))return!Yr.length;var $n=pp(Yr);if($n==Lo||$n==Uo)return!Yr.size;if(n0(Yr))return!C1(Yr).length;for(var Yn in Yr)if(ju.call(Yr,Yn))return!1;return!0}function JE(Yr,$n){return e0(Yr,$n)}function YE(Yr,$n,Yn){Yn=typeof Yn=="function"?Yn:wr;var ao=Yn?Yn(Yr,$n):wr;return ao===wr?e0(Yr,$n,wr,Yn):!!ao}function Q1(Yr){if(!ep(Yr))return!1;var $n=yp(Yr);return $n==yo||$n==mo||typeof Yr.message=="string"&&typeof Yr.name=="string"&&!o0(Yr)}function XE(Yr){return typeof Yr=="number"&&Ay(Yr)}function nm(Yr){if(!_f(Yr))return!1;var $n=yp(Yr);return $n==_o||$n==Bo||$n==uo||$n==wl}function lx(Yr){return typeof Yr=="number"&&Yr==$u(Yr)}function Y0(Yr){return typeof Yr=="number"&&Yr>-1&&Yr%1==0&&Yr<=Pn}function _f(Yr){var $n=typeof Yr;return Yr!=null&&($n=="object"||$n=="function")}function ep(Yr){return Yr!=null&&typeof Yr=="object"}var ux=vm?Tp(vm):r_;function QE(Yr,$n){return Yr===$n||k1(Yr,$n,q1($n))}function e3(Yr,$n,Yn){return Yn=typeof Yn=="function"?Yn:wr,k1(Yr,$n,q1($n),Yn)}function t3(Yr){return dx(Yr)&&Yr!=+Yr}function r3(Yr){if(L_(Yr))throw new xu(jr);return zy(Yr)}function n3(Yr){return Yr===null}function i3(Yr){return Yr==null}function dx(Yr){return typeof Yr=="number"||ep(Yr)&&yp(Yr)==Wo}function o0(Yr){if(!ep(Yr)||yp(Yr)!=qo)return!1;var $n=$0(Yr);if($n===null)return!0;var Yn=ju.call($n,"constructor")&&$n.constructor;return typeof Yn=="function"&&Yn instanceof Yn&&x0.call(Yn)==ew}var ey=Tm?Tp(Tm):n_;function o3(Yr){return lx(Yr)&&Yr>=-Pn&&Yr<=Pn}var fx=n1?Tp(n1):i_;function X0(Yr){return typeof Yr=="string"||!wu(Yr)&&ep(Yr)&&yp(Yr)==Nl}function Ap(Yr){return typeof Yr=="symbol"||ep(Yr)&&yp(Yr)==Vo}var Fm=u0?Tp(u0):o_;function a3(Yr){return Yr===wr}function s3(Yr){return ep(Yr)&&pp(Yr)==Ol}function c3(Yr){return ep(Yr)&&yp(Yr)==$a}var l3=W0(R1),u3=W0(function(Yr,$n){return Yr<=$n});function hx(Yr){if(!Yr)return[];if($p(Yr))return X0(Yr)?qp(Yr):Ep(Yr);if(Hm&&Yr[Hm])return Wx(Yr[Hm]());var $n=pp(Yr),Yn=$n==Lo?h1:$n==Uo?y0:Wm;return Yn(Yr)}function im(Yr){if(!Yr)return Yr===0?Yr:0;if(Yr=Up(Yr),Yr===Rn||Yr===-Rn){var $n=Yr<0?-1:1;return $n*On}return Yr===Yr?Yr:0}function $u(Yr){var $n=im(Yr),Yn=$n%1;return $n===$n?Yn?$n-Yn:$n:0}function px(Yr){return Yr?_m($u(Yr),0,Nn):0}function Up(Yr){if(typeof Yr=="number")return Yr;if(Ap(Yr))return Zn;if(_f(Yr)){var $n=typeof Yr.valueOf=="function"?Yr.valueOf():Yr;Yr=_f($n)?$n+"":$n}if(typeof Yr!="string")return Yr===0?Yr:+Yr;Yr=wy(Yr);var Yn=Cu.test(Yr);return Yn||pu.test(Yr)?Xu(Yr.slice(2),Yn?2:8):El.test(Yr)?Zn:+Yr}function mx(Yr){return Zp(Yr,Sp(Yr))}function d3(Yr){return Yr?_m($u(Yr),-Pn,Pn):Yr===0?Yr:0}function Ou(Yr){return Yr==null?"":Ip(Yr)}var f3=Dm(function(Yr,$n){if(n0($n)||$p($n)){Zp($n,sp($n),Yr);return}for(var Yn in $n)ju.call($n,Yn)&&Ym(Yr,Yn,$n[Yn])}),gx=Dm(function(Yr,$n){Zp($n,Sp($n),Yr)}),Q0=Dm(function(Yr,$n,Yn,ao){Zp($n,Sp($n),Yr,ao)}),h3=Dm(function(Yr,$n,Yn,ao){Zp($n,sp($n),Yr,ao)}),p3=tm(x1);function m3(Yr,$n){var Yn=Bm(Yr);return $n==null?Yn:jy(Yn,$n)}var g3=ku(function(Yr,$n){Yr=Uu(Yr);var Yn=-1,ao=$n.length,ho=ao>2?$n[2]:wr;for(ho&&vp($n[0],$n[1],ho)&&(ao=1);++Yn1),$o}),Zp(Yr,F1(Yr),Yn),ao&&(Yn=Bp(Yn,Zr|Jr|Qr,C_));for(var ho=$n.length;ho--;)N1(Yn,$n[ho]);return Yn});function j3(Yr,$n){return vx(Yr,J0(cu($n)))}var B3=tm(function(Yr,$n){return Yr==null?{}:c_(Yr,$n)});function vx(Yr,$n){if(Yr==null)return{};var Yn=Gu(F1(Yr),function(ao){return[ao]});return $n=cu($n),Yy(Yr,Yn,function(ao,ho){return $n(ao,ho[0])})}function D3(Yr,$n,Yn){$n=pm($n,Yr);var ao=-1,ho=$n.length;for(ho||(ho=1,Yr=wr);++ao$n){var ao=Yr;Yr=$n,$n=ao}if(Yn||Yr%1||$n%1){var ho=Py();return hp(Yr+ho*($n-Yr+Yu("1e-"+((ho+"").length-1))),$n)}return I1(Yr,$n)}var Z3=Lm(function(Yr,$n,Yn){return $n=$n.toLowerCase(),Yr+(Yn?wx($n):$n)});function wx(Yr){return ny(Ou(Yr).toLowerCase())}function _x(Yr){return Yr=Ou(Yr),Yr&&Yr.replace(hu,Bx).replace(Rm,"")}function J3(Yr,$n,Yn){Yr=Ou(Yr),$n=Ip($n);var ao=Yr.length;Yn=Yn===wr?ao:_m($u(Yn),0,ao);var ho=Yn;return Yn-=$n.length,Yn>=0&&Yr.slice(Yn,ho)==$n}function Y3(Yr){return Yr=Ou(Yr),Yr&&Bl.test(Yr)?Yr.replace(Tl,Dx):Yr}function X3(Yr){return Yr=Ou(Yr),Yr&&_u.test(Yr)?Yr.replace(Sl,"\\$&"):Yr}var Q3=Lm(function(Yr,$n,Yn){return Yr+(Yn?"-":"")+$n.toLowerCase()}),e$=Lm(function(Yr,$n,Yn){return Yr+(Yn?" ":"")+$n.toLowerCase()}),t$=Sv("toLowerCase");function r$(Yr,$n,Yn){Yr=Ou(Yr),$n=$u($n);var ao=$n?Pm(Yr):0;if(!$n||ao>=$n)return Yr;var ho=($n-ao)/2;return F0(R0(ho),Yn)+Yr+F0(C0(ho),Yn)}function n$(Yr,$n,Yn){Yr=Ou(Yr),$n=$u($n);var ao=$n?Pm(Yr):0;return $n&&ao<$n?Yr+F0($n-ao,Yn):Yr}function i$(Yr,$n,Yn){Yr=Ou(Yr),$n=$u($n);var ao=$n?Pm(Yr):0;return $n&&ao<$n?F0($n-ao,Yn)+Yr:Yr}function o$(Yr,$n,Yn){return Yn||$n==null?$n=0:$n&&($n=+$n),uw(Ou(Yr).replace(So,""),$n||0)}function a$(Yr,$n,Yn){return(Yn?vp(Yr,$n,Yn):$n===wr)?$n=1:$n=$u($n),A1(Ou(Yr),$n)}function s$(){var Yr=arguments,$n=Ou(Yr[0]);return Yr.length<3?$n:$n.replace(Yr[1],Yr[2])}var c$=Lm(function(Yr,$n,Yn){return Yr+(Yn?"_":"")+$n.toLowerCase()});function l$(Yr,$n,Yn){return Yn&&typeof Yn!="number"&&vp(Yr,$n,Yn)&&($n=Yn=wr),Yn=Yn===wr?Nn:Yn>>>0,Yn?(Yr=Ou(Yr),Yr&&(typeof $n=="string"||$n!=null&&!ey($n))&&($n=Ip($n),!$n&&Am(Yr))?mm(qp(Yr),0,Yn):Yr.split($n,Yn)):[]}var u$=Lm(function(Yr,$n,Yn){return Yr+(Yn?" ":"")+ny($n)});function d$(Yr,$n,Yn){return Yr=Ou(Yr),Yn=Yn==null?0:_m($u(Yn),0,Yr.length),$n=Ip($n),Yr.slice(Yn,Yn+$n.length)==$n}function f$(Yr,$n,Yn){var ao=xo.templateSettings;Yn&&vp(Yr,$n,Yn)&&($n=wr),Yr=Ou(Yr),$n=Q0({},$n,ao,Pv);var ho=Q0({},$n.imports,ao.imports,Pv),$o=sp(ho),To=f1(ho,$o),Po,Oo,_c=0,yl=$n.interpolate||mu,Rl="__p += '",Hl=p1(($n.escape||mu).source+"|"+yl.source+"|"+(yl===Al?Wl:mu).source+"|"+($n.evaluate||mu).source+"|$","g"),eu="//# sourceURL="+(ju.call($n,"sourceURL")?($n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++r1+"]")+` `;Yr.replace(Hl,function(uu,Ru,Pu,Pp,bp,Np){return Pu||(Pu=Pp),Rl+=Yr.slice(_c,Np).replace(vu,Lx),Ru&&(Po=!0,Rl+=`' + __e(`+Ru+`) + -'`),bp&&(Mo=!0,Rl+=`'; +'`),bp&&(Oo=!0,Rl+=`'; `+bp+`; __p += '`),Pu&&(Rl+=`' + ((__t = (`+Pu+`)) == null ? '' : __t) + @@ -4072,13 +4076,13 @@ __p += '`),Pu&&(Rl+=`' + `;var lu=ju.call($n,"variable")&&$n.variable;if(!lu)Rl=`with (obj) { `+Rl+` } -`;else if(jo.test(lu))throw new xu(Wr);Rl=(Mo?Rl.replace(Ll,""):Rl).replace(_l,"$1").replace(bu,"$1;"),Rl="function("+(lu||"obj")+`) { +`;else if(jo.test(lu))throw new xu(Wr);Rl=(Oo?Rl.replace(Ll,""):Rl).replace(_l,"$1").replace(bu,"$1;"),Rl="function("+(lu||"obj")+`) { `+(lu?"":`obj || (obj = {}); -`)+"var __t, __p = ''"+(Po?", __e = _.escape":"")+(Mo?`, __j = Array.prototype.join; +`)+"var __t, __p = ''"+(Po?", __e = _.escape":"")+(Oo?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+Rl+`return __p -}`;var Su=$x(function(){return Ou($o,eu+"return "+Rl).apply(wr,To)});if(Su.source=Rl,Yy(Su))throw Su;return Su}function h$(Yr){return Mu(Yr).toLowerCase()}function p$(Yr){return Mu(Yr).toUpperCase()}function m$(Yr,$n,Yn){if(Yr=Mu(Yr),Yr&&(Yn||$n===wr))return x1(Yr);if(!Yr||!($n=Ip($n)))return Yr;var ao=qp(Yr),ho=qp($n),$o=w1(ao,ho),To=E1(ao,ho)+1;return mm(ao,$o,To).join("")}function g$(Yr,$n,Yn){if(Yr=Mu(Yr),Yr&&(Yn||$n===wr))return Yr.slice(0,S1(Yr)+1);if(!Yr||!($n=Ip($n)))return Yr;var ao=qp(Yr),ho=E1(ao,qp($n))+1;return mm(ao,0,ho).join("")}function y$(Yr,$n,Yn){if(Yr=Mu(Yr),Yr&&(Yn||$n===wr))return Yr.replace(So,"");if(!Yr||!($n=Ip($n)))return Yr;var ao=qp(Yr),ho=w1(ao,qp($n));return mm(ao,ho).join("")}function v$(Yr,$n){var Yn=co,ao=so;if(_f($n)){var ho="separator"in $n?$n.separator:ho;Yn="length"in $n?$u($n.length):Yn,ao="omission"in $n?Ip($n.omission):ao}Yr=Mu(Yr);var $o=Yr.length;if(Am(Yr)){var To=qp(Yr);$o=To.length}if(Yn>=$o)return Yr;var Po=Yn-Pm(ao);if(Po<1)return ao;var Mo=To?mm(To,0,Po).join(""):Yr.slice(0,Po);if(ho===wr)return Mo+ao;if(To&&(Po+=Mo.length-Po),Xy(ho)){if(Yr.slice(Po).search(ho)){var _c,yl=Mo;for(ho.global||(ho=py(ho.source,Mu($l.exec(ho))+"g")),ho.lastIndex=0;_c=ho.exec(yl);)var Rl=_c.index;Mo=Mo.slice(0,Rl===wr?Po:Rl)}}else if(Yr.indexOf(Ip(ho),Po)!=Po){var Hl=Mo.lastIndexOf(ho);Hl>-1&&(Mo=Mo.slice(0,Hl))}return Mo+ao}function b$(Yr){return Yr=Mu(Yr),Yr&&du.test(Yr)?Yr.replace(xl,Hx):Yr}var x$=Lm(function(Yr,$n,Yn){return Yr+(Yn?" ":"")+$n.toUpperCase()}),t1=Sv("toUpperCase");function Ex(Yr,$n,Yn){return Yr=Mu(Yr),$n=Yn?wr:$n,$n===wr?Ux(Yr)?Zx(Yr):Px(Yr):Yr.match($n)||[]}var $x=ku(function(Yr,$n){try{return mp(Yr,wr,$n)}catch(Yn){return Yy(Yn)?Yn:new xu(Yn)}}),w$=tm(function(Yr,$n){return Op($n,function(Yn){Yn=Jp(Yn),Qp(Yr,Yn,Zy(Yr[Yn],Yr))}),Yr});function _$(Yr){var $n=Yr==null?0:Yr.length,Yn=cu();return Yr=$n?Gu(Yr,function(ao){if(typeof ao[1]!="function")throw new Mp(Br);return[Yn(ao[0]),ao[1]]}):[],ku(function(ao){for(var ho=-1;++ho<$n;){var $o=Yr[ho];if(mp($o[0],this,ao))return mp($o[1],this,ao)}})}function E$(Yr){return Hw(Bp(Yr,Zr))}function r1(Yr){return function(){return Yr}}function $$(Yr,$n){return Yr==null||Yr!==Yr?$n:Yr}var S$=Cv(),k$=Cv(!0);function kp(Yr){return Yr}function n1(Yr){return V1(typeof Yr=="function"?Yr:Bp(Yr,Zr))}function C$(Yr){return K1(Bp(Yr,Zr))}function R$(Yr,$n){return G1(Yr,Bp($n,Zr))}var T$=ku(function(Yr,$n){return function(Yn){return Qm(Yn,Yr,$n)}}),I$=ku(function(Yr,$n){return function(Yn){return Qm(Yr,Yn,$n)}});function i1(Yr,$n,Yn){var ao=sp($n),ho=O0($n,ao);Yn==null&&!(_f($n)&&(ho.length||!ao.length))&&(Yn=$n,$n=Yr,Yr=this,ho=O0($n,sp($n)));var $o=!(_f(Yn)&&"chain"in Yn)||!!Yn.chain,To=nm(Yr);return Op(ho,function(Po){var Mo=$n[Po];Yr[Po]=Mo,To&&(Yr.prototype[Po]=function(){var _c=this.__chain__;if($o||_c){var yl=Yr(this.__wrapped__),Rl=yl.__actions__=Ep(this.__actions__);return Rl.push({func:Mo,args:arguments,thisArg:Yr}),yl.__chain__=_c,yl}return Mo.apply(Yr,lm([this.value()],arguments))})}),Yr}function A$(){return Hu._===this&&(Hu._=tw),this}function o1(){}function P$(Yr){return Yr=$u(Yr),ku(function($n){return Z1($n,Yr)})}var N$=jy(Gu),O$=jy(p1),M$=jy(sy);function Sx(Yr){return qy(Yr)?cy(Jp(Yr)):l_(Yr)}function j$(Yr){return function($n){return Yr==null?wr:Em(Yr,$n)}}var B$=Tv(),D$=Tv(!0);function a1(){return[]}function s1(){return!1}function L$(){return{}}function F$(){return""}function U$(){return!0}function W$(Yr,$n){if(Yr=$u(Yr),Yr<1||Yr>Pn)return[];var Yn=Nn,ao=hp(Yr,Nn);$n=cu($n),Yr-=Nn;for(var ho=dy(ao,$n);++Yn0||$n<0)?new Iu(Yn):(Yr<0?Yn=Yn.takeRight(-Yr):Yr&&(Yn=Yn.drop(Yr)),$n!==wr&&($n=$u($n),Yn=$n<0?Yn.dropRight(-$n):Yn.take($n-Yr)),Yn)},Iu.prototype.takeRightWhile=function(Yr){return this.reverse().takeWhile(Yr).reverse()},Iu.prototype.toArray=function(){return this.take(Nn)},Gp(Iu.prototype,function(Yr,$n){var Yn=/^(?:filter|find|map|reject)|While$/.test($n),ao=/^(?:head|last)$/.test($n),ho=xo[ao?"take"+($n=="last"?"Right":""):$n],$o=ao||/^find/.test($n);ho&&(xo.prototype[$n]=function(){var To=this.__wrapped__,Po=ao?[1]:arguments,Mo=To instanceof Iu,_c=Po[0],yl=Mo||wu(To),Rl=function(Ru){var Pu=ho.apply(xo,lm([Ru],Po));return ao&&Hl?Pu[0]:Pu};yl&&Yn&&typeof _c=="function"&&_c.length!=1&&(Mo=yl=!1);var Hl=this.__chain__,eu=!!this.__actions__.length,lu=$o&&!Hl,Su=Mo&&!eu;if(!$o&&yl){To=Su?To:new Iu(this);var uu=Yr.apply(To,Po);return uu.__actions__.push({func:H0,args:[Rl],thisArg:wr}),new jp(uu,Hl)}return lu&&Su?Yr.apply(this,Po):(uu=this.thru(Rl),lu?ao?uu.value()[0]:uu.value():uu)})}),Op(["pop","push","shift","sort","splice","unshift"],function(Yr){var $n=v0[Yr],Yn=/^(?:push|sort|unshift)$/.test(Yr)?"tap":"thru",ao=/^(?:pop|shift)$/.test(Yr);xo.prototype[Yr]=function(){var ho=arguments;if(ao&&!this.__chain__){var $o=this.value();return $n.apply(wu($o)?$o:[],ho)}return this[Yn](function(To){return $n.apply(wu(To)?To:[],ho)})}}),Gp(Iu.prototype,function(Yr,$n){var Yn=xo[$n];if(Yn){var ao=Yn.name+"";ju.call(jm,ao)||(jm[ao]=[]),jm[ao].push({name:$n,func:Yn})}}),jm[L0(wr,In).name]=[{name:"wrapper",func:wr}],Iu.prototype.clone=yw,Iu.prototype.reverse=vw,Iu.prototype.value=bw,xo.prototype.at=G2,xo.prototype.chain=Z2,xo.prototype.commit=J2,xo.prototype.next=Y2,xo.prototype.plant=Q2,xo.prototype.reverse=eE,xo.prototype.toJSON=xo.prototype.valueOf=xo.prototype.value=tE,xo.prototype.first=xo.prototype.head,Hm&&(xo.prototype[Hm]=X2),xo},Nm=Jx();_p?((_p.exports=Nm)._=Nm,gp._=Nm):Hu._=Nm}).call(commonjsGlobal)})(lodash,lodash.exports);lodash.exports;qe$2(u$4)` +}`;var Su=$x(function(){return Mu($o,eu+"return "+Rl).apply(wr,To)});if(Su.source=Rl,Q1(Su))throw Su;return Su}function h$(Yr){return Ou(Yr).toLowerCase()}function p$(Yr){return Ou(Yr).toUpperCase()}function m$(Yr,$n,Yn){if(Yr=Ou(Yr),Yr&&(Yn||$n===wr))return wy(Yr);if(!Yr||!($n=Ip($n)))return Yr;var ao=qp(Yr),ho=qp($n),$o=_y(ao,ho),To=Ey(ao,ho)+1;return mm(ao,$o,To).join("")}function g$(Yr,$n,Yn){if(Yr=Ou(Yr),Yr&&(Yn||$n===wr))return Yr.slice(0,Sy(Yr)+1);if(!Yr||!($n=Ip($n)))return Yr;var ao=qp(Yr),ho=Ey(ao,qp($n))+1;return mm(ao,0,ho).join("")}function y$(Yr,$n,Yn){if(Yr=Ou(Yr),Yr&&(Yn||$n===wr))return Yr.replace(So,"");if(!Yr||!($n=Ip($n)))return Yr;var ao=qp(Yr),ho=_y(ao,qp($n));return mm(ao,ho).join("")}function v$(Yr,$n){var Yn=co,ao=so;if(_f($n)){var ho="separator"in $n?$n.separator:ho;Yn="length"in $n?$u($n.length):Yn,ao="omission"in $n?Ip($n.omission):ao}Yr=Ou(Yr);var $o=Yr.length;if(Am(Yr)){var To=qp(Yr);$o=To.length}if(Yn>=$o)return Yr;var Po=Yn-Pm(ao);if(Po<1)return ao;var Oo=To?mm(To,0,Po).join(""):Yr.slice(0,Po);if(ho===wr)return Oo+ao;if(To&&(Po+=Oo.length-Po),ey(ho)){if(Yr.slice(Po).search(ho)){var _c,yl=Oo;for(ho.global||(ho=p1(ho.source,Ou($l.exec(ho))+"g")),ho.lastIndex=0;_c=ho.exec(yl);)var Rl=_c.index;Oo=Oo.slice(0,Rl===wr?Po:Rl)}}else if(Yr.indexOf(Ip(ho),Po)!=Po){var Hl=Oo.lastIndexOf(ho);Hl>-1&&(Oo=Oo.slice(0,Hl))}return Oo+ao}function b$(Yr){return Yr=Ou(Yr),Yr&&du.test(Yr)?Yr.replace(xl,Hx):Yr}var x$=Lm(function(Yr,$n,Yn){return Yr+(Yn?" ":"")+$n.toUpperCase()}),ny=Sv("toUpperCase");function Ex(Yr,$n,Yn){return Yr=Ou(Yr),$n=Yn?wr:$n,$n===wr?Fx(Yr)?Zx(Yr):Px(Yr):Yr.match($n)||[]}var $x=ku(function(Yr,$n){try{return mp(Yr,wr,$n)}catch(Yn){return Q1(Yn)?Yn:new xu(Yn)}}),w$=tm(function(Yr,$n){return Mp($n,function(Yn){Yn=Jp(Yn),Qp(Yr,Yn,Y1(Yr[Yn],Yr))}),Yr});function _$(Yr){var $n=Yr==null?0:Yr.length,Yn=cu();return Yr=$n?Gu(Yr,function(ao){if(typeof ao[1]!="function")throw new Op(Br);return[Yn(ao[0]),ao[1]]}):[],ku(function(ao){for(var ho=-1;++ho<$n;){var $o=Yr[ho];if(mp($o[0],this,ao))return mp($o[1],this,ao)}})}function E$(Yr){return Hw(Bp(Yr,Zr))}function iy(Yr){return function(){return Yr}}function $$(Yr,$n){return Yr==null||Yr!==Yr?$n:Yr}var S$=Cv(),k$=Cv(!0);function kp(Yr){return Yr}function oy(Yr){return Vy(typeof Yr=="function"?Yr:Bp(Yr,Zr))}function C$(Yr){return Ky(Bp(Yr,Zr))}function R$(Yr,$n){return Gy(Yr,Bp($n,Zr))}var T$=ku(function(Yr,$n){return function(Yn){return Qm(Yn,Yr,$n)}}),I$=ku(function(Yr,$n){return function(Yn){return Qm(Yr,Yn,$n)}});function ay(Yr,$n,Yn){var ao=sp($n),ho=M0($n,ao);Yn==null&&!(_f($n)&&(ho.length||!ao.length))&&(Yn=$n,$n=Yr,Yr=this,ho=M0($n,sp($n)));var $o=!(_f(Yn)&&"chain"in Yn)||!!Yn.chain,To=nm(Yr);return Mp(ho,function(Po){var Oo=$n[Po];Yr[Po]=Oo,To&&(Yr.prototype[Po]=function(){var _c=this.__chain__;if($o||_c){var yl=Yr(this.__wrapped__),Rl=yl.__actions__=Ep(this.__actions__);return Rl.push({func:Oo,args:arguments,thisArg:Yr}),yl.__chain__=_c,yl}return Oo.apply(Yr,lm([this.value()],arguments))})}),Yr}function A$(){return Hu._===this&&(Hu._=tw),this}function sy(){}function P$(Yr){return Yr=$u(Yr),ku(function($n){return Zy($n,Yr)})}var N$=D1(Gu),M$=D1(gy),O$=D1(s1);function Sx(Yr){return V1(Yr)?c1(Jp(Yr)):l_(Yr)}function j$(Yr){return function($n){return Yr==null?wr:Em(Yr,$n)}}var B$=Tv(),D$=Tv(!0);function cy(){return[]}function ly(){return!1}function L$(){return{}}function U$(){return""}function F$(){return!0}function W$(Yr,$n){if(Yr=$u(Yr),Yr<1||Yr>Pn)return[];var Yn=Nn,ao=hp(Yr,Nn);$n=cu($n),Yr-=Nn;for(var ho=d1(ao,$n);++Yn0||$n<0)?new Iu(Yn):(Yr<0?Yn=Yn.takeRight(-Yr):Yr&&(Yn=Yn.drop(Yr)),$n!==wr&&($n=$u($n),Yn=$n<0?Yn.dropRight(-$n):Yn.take($n-Yr)),Yn)},Iu.prototype.takeRightWhile=function(Yr){return this.reverse().takeWhile(Yr).reverse()},Iu.prototype.toArray=function(){return this.take(Nn)},Gp(Iu.prototype,function(Yr,$n){var Yn=/^(?:filter|find|map|reject)|While$/.test($n),ao=/^(?:head|last)$/.test($n),ho=xo[ao?"take"+($n=="last"?"Right":""):$n],$o=ao||/^find/.test($n);ho&&(xo.prototype[$n]=function(){var To=this.__wrapped__,Po=ao?[1]:arguments,Oo=To instanceof Iu,_c=Po[0],yl=Oo||wu(To),Rl=function(Ru){var Pu=ho.apply(xo,lm([Ru],Po));return ao&&Hl?Pu[0]:Pu};yl&&Yn&&typeof _c=="function"&&_c.length!=1&&(Oo=yl=!1);var Hl=this.__chain__,eu=!!this.__actions__.length,lu=$o&&!Hl,Su=Oo&&!eu;if(!$o&&yl){To=Su?To:new Iu(this);var uu=Yr.apply(To,Po);return uu.__actions__.push({func:H0,args:[Rl],thisArg:wr}),new jp(uu,Hl)}return lu&&Su?Yr.apply(this,Po):(uu=this.thru(Rl),lu?ao?uu.value()[0]:uu.value():uu)})}),Mp(["pop","push","shift","sort","splice","unshift"],function(Yr){var $n=v0[Yr],Yn=/^(?:push|sort|unshift)$/.test(Yr)?"tap":"thru",ao=/^(?:pop|shift)$/.test(Yr);xo.prototype[Yr]=function(){var ho=arguments;if(ao&&!this.__chain__){var $o=this.value();return $n.apply(wu($o)?$o:[],ho)}return this[Yn](function(To){return $n.apply(wu(To)?To:[],ho)})}}),Gp(Iu.prototype,function(Yr,$n){var Yn=xo[$n];if(Yn){var ao=Yn.name+"";ju.call(jm,ao)||(jm[ao]=[]),jm[ao].push({name:$n,func:Yn})}}),jm[L0(wr,In).name]=[{name:"wrapper",func:wr}],Iu.prototype.clone=yw,Iu.prototype.reverse=vw,Iu.prototype.value=bw,xo.prototype.at=G2,xo.prototype.chain=Z2,xo.prototype.commit=J2,xo.prototype.next=Y2,xo.prototype.plant=Q2,xo.prototype.reverse=eE,xo.prototype.toJSON=xo.prototype.valueOf=xo.prototype.value=tE,xo.prototype.first=xo.prototype.head,Hm&&(xo.prototype[Hm]=X2),xo},Nm=Jx();_p?((_p.exports=Nm)._=Nm,gp._=Nm):Hu._=Nm}).call(commonjsGlobal)})(lodash,lodash.exports);lodash.exports;qe$2(u$4)` .horizontal-slider-track { height: var(--spacing-xxxs); background-color: var(--components-slider-background-default); @@ -4108,7 +4112,7 @@ function print() { __p += __j.call(arguments, '') } background-color: var(--components-slider-background-progress); } `} -`;const brandColors={"GRAY-100":"#F5F6F8","GRAY-200":"#EAEBF2","GRAY-300":"#C4CBD5","GRAY-400":"#B0B3B9","GRAY-500":"#8C93A0","GRAY-600":"#757D8D","GRAY-700":"#484D58","GRAY-800":"#313338","GRAY-900":"#202124","GRAY-1000":"#17181B","PINK-100":"#FCEBFF","PINK-200":"#FBE8FF","PINK-300":"#F3AEFF","PINK-400":"#CF59E2","PINK-500":"#D548EC","PINK-600":"#C742DD","PINK-700":"#AA30BE","PINK-800":"#7B0090","PINK-900":"#570066","PINK-1000":"#35003F","RED-100":"#FFECEC","RED-200":"#FFD9D9","RED-300":"#FFB1B1","RED-400":"#FF8585","RED-500":"#FF4E4E","RED-600":"#F11F1F","RED-700":"#D43B3B","RED-800":"#A40A0A","RED-900":"#670000","RED-1000":"#400000","GREEN-100":"#D8F7F0","GREEN-200":"#AFEFE1","GREEN-300":"#51DCBD","GREEN-400":"#00C296","GREEN-500":"#00A47F","GREEN-600":"#008769","GREEN-700":"#006B53","GREEN-800":"#A40A0A","GREEN-900":"#00382B","GREEN-1000":"#002019"},blocksColorsLegacy={PRIMARY:"rgba(27.0, 150.0, 227.0, 1.0)",PRIMARY_PINK:"#CF1C84",PLACEHOLDER_DARK_GRAY:"#D9D9D9",LINKS:"rgba(20.0, 126.0, 251.0, 1.0)",GRADIENT_PRIMARY:"rgba(226.0, 8.0, 128.0, 1.0)",GRADIENT_SECONDARY:"rgba(53.0, 197.0, 243.0, 1.0)",GRADIENT_THIRD:"rgba(103.0, 76.0, 159.0, 1.0)",TRANSPARENT:"transparent",WHITE:"rgba(255.0, 255.0, 255.0, 1.0)",DARK_WHITE:"rgba(255.0, 255.0, 255.0, 0.75)",MID_WHITE:"rgba(255.0, 255.0, 255.0, 0.5)",LIGHT_WHITE:"rgba(255.0, 255.0, 255.0, 0.25)",SLIGHTER_GRAY:"rgba(250.0, 250.0, 250.0, 1)",SLIGHT_GRAY:"rgba(231.0, 231.0, 231.0, 1)",LIGHT_GRAY:"rgba(225.0, 225.0, 225.0, 1)",MID_GRAY:"rgba(200.0, 200.0, 200.0, 1)",DARK_GRAY:"rgba(160.0, 160.0, 160.0, 1)",DARKER_GRAY:"rgba(100.0, 100.0, 100.0, 1)",LIGHT_BLACK_TRANS:"rgba(0.0, 0.0, 0.0, 0.1)",SEMI_MID_BLACK_TRANS:"rgba(0.0, 0.0, 0.0, 0.25)",MID_BLACK_TRANS:"rgba(0.0, 0.0, 0.0, 0.5)",DARK_BLACK_TRANS:"rgba(0.0, 0.0, 0.0, 0.75)",BLACK:"rgba(0.0, 0.0, 0.0, 1.0)",CONFIRM_GREEN:"rgba(50.0, 205.0, 50.0, 1.0)",CONFIRM:"rgba(34.0, 139.0, 34.0, 1.0)",WARNING:"rgba(255.0, 153.0, 0.0, 1.0)",SUBLIME_RED:"rgba(237.0, 59.0, 72.0, 1.0)",BADGE_RED:"rgba(208.0, 44.0, 30.0, 1.0)",LIGHT_MAROON:"rgba(159.0, 0.0, 0.0, 1.0)",LIGHTER_MAROON:"rgba(129.0, 0.0, 0.0, 1.0)",...brandColors},createBlocksColors=()=>{const fr=blocksColorsLegacy;return Object.keys(fr).reduce((wr,Er)=>{const kr=Er.toLowerCase().replace(/_([a-z])/g,(jr,Br)=>Br.toUpperCase());return wr[kr]=fr[Er],wr},{})};createBlocksColors();const __vite_import_meta_env__={BASE_URL:"/push-wallet/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_BACKEND_URL:"https://push-auth.push.org",VITE_APP_DYNAMIC_ENV_ID:"7a6006b6-fa19-4e7a-abcf-34add623dff5",VITE_APP_ENV:"dev",VITE_DEV_MODE:"testing"};var define_process_env_default$3={};function getAppBasePath(){if(typeof import.meta<"u"&&__vite_import_meta_env__)return"/push-wallet/";if(typeof process$1$1<"u"&&define_process_env_default$3){if(define_process_env_default$3.VITE_DEV_MODE==="preview")return"/push-wallet/pr-preview/";if(define_process_env_default$3.VITE_DEV_MODE==="testing")return"/push-wallet/"}return"/"}const GlobalStyle=$e$2` +`;const brandColors={"GRAY-100":"#F5F6F8","GRAY-200":"#EAEBF2","GRAY-300":"#C4CBD5","GRAY-400":"#B0B3B9","GRAY-500":"#8C93A0","GRAY-600":"#757D8D","GRAY-700":"#484D58","GRAY-800":"#313338","GRAY-900":"#202124","GRAY-1000":"#17181B","PINK-100":"#FCEBFF","PINK-200":"#FBE8FF","PINK-300":"#F3AEFF","PINK-400":"#CF59E2","PINK-500":"#D548EC","PINK-600":"#C742DD","PINK-700":"#AA30BE","PINK-800":"#7B0090","PINK-900":"#570066","PINK-1000":"#35003F","RED-100":"#FFECEC","RED-200":"#FFD9D9","RED-300":"#FFB1B1","RED-400":"#FF8585","RED-500":"#FF4E4E","RED-600":"#F11F1F","RED-700":"#D43B3B","RED-800":"#A40A0A","RED-900":"#670000","RED-1000":"#400000","GREEN-100":"#D8F7F0","GREEN-200":"#AFEFE1","GREEN-300":"#51DCBD","GREEN-400":"#00C296","GREEN-500":"#00A47F","GREEN-600":"#008769","GREEN-700":"#006B53","GREEN-800":"#A40A0A","GREEN-900":"#00382B","GREEN-1000":"#002019"},blocksColorsLegacy={PRIMARY:"rgba(27.0, 150.0, 227.0, 1.0)",PRIMARY_PINK:"#CF1C84",PLACEHOLDER_DARK_GRAY:"#D9D9D9",LINKS:"rgba(20.0, 126.0, 251.0, 1.0)",GRADIENT_PRIMARY:"rgba(226.0, 8.0, 128.0, 1.0)",GRADIENT_SECONDARY:"rgba(53.0, 197.0, 243.0, 1.0)",GRADIENT_THIRD:"rgba(103.0, 76.0, 159.0, 1.0)",TRANSPARENT:"transparent",WHITE:"rgba(255.0, 255.0, 255.0, 1.0)",DARK_WHITE:"rgba(255.0, 255.0, 255.0, 0.75)",MID_WHITE:"rgba(255.0, 255.0, 255.0, 0.5)",LIGHT_WHITE:"rgba(255.0, 255.0, 255.0, 0.25)",SLIGHTER_GRAY:"rgba(250.0, 250.0, 250.0, 1)",SLIGHT_GRAY:"rgba(231.0, 231.0, 231.0, 1)",LIGHT_GRAY:"rgba(225.0, 225.0, 225.0, 1)",MID_GRAY:"rgba(200.0, 200.0, 200.0, 1)",DARK_GRAY:"rgba(160.0, 160.0, 160.0, 1)",DARKER_GRAY:"rgba(100.0, 100.0, 100.0, 1)",LIGHT_BLACK_TRANS:"rgba(0.0, 0.0, 0.0, 0.1)",SEMI_MID_BLACK_TRANS:"rgba(0.0, 0.0, 0.0, 0.25)",MID_BLACK_TRANS:"rgba(0.0, 0.0, 0.0, 0.5)",DARK_BLACK_TRANS:"rgba(0.0, 0.0, 0.0, 0.75)",BLACK:"rgba(0.0, 0.0, 0.0, 1.0)",CONFIRM_GREEN:"rgba(50.0, 205.0, 50.0, 1.0)",CONFIRM:"rgba(34.0, 139.0, 34.0, 1.0)",WARNING:"rgba(255.0, 153.0, 0.0, 1.0)",SUBLIME_RED:"rgba(237.0, 59.0, 72.0, 1.0)",BADGE_RED:"rgba(208.0, 44.0, 30.0, 1.0)",LIGHT_MAROON:"rgba(159.0, 0.0, 0.0, 1.0)",LIGHTER_MAROON:"rgba(129.0, 0.0, 0.0, 1.0)",...brandColors},createBlocksColors=()=>{const fr=blocksColorsLegacy;return Object.keys(fr).reduce((wr,Er)=>{const kr=Er.toLowerCase().replace(/_([a-z])/g,(jr,Br)=>Br.toUpperCase());return wr[kr]=fr[Er],wr},{})};createBlocksColors();const __vite_import_meta_env__={BASE_URL:"/push-wallet/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_BACKEND_URL:"https://push-auth.push.org",VITE_APP_DYNAMIC_ENV_ID:"82e8732d-11b8-428d-a553-7087d0c44171",VITE_APP_ENV:"dev",VITE_DEV_MODE:"testing"};var define_process_env_default$3={};function getAppBasePath(){if(typeof import.meta<"u"&&__vite_import_meta_env__)return"/push-wallet/";if(typeof process$1$1<"u"&&define_process_env_default$3){if(define_process_env_default$3.VITE_DEV_MODE==="preview")return"/push-wallet/pr-preview/";if(define_process_env_default$3.VITE_DEV_MODE==="testing")return"/push-wallet/"}return"/"}const GlobalStyle=$e$2` :root{ /* Font Family */ --font-family: 'FK Grotesk Neu'; @@ -4117,8 +4121,8 @@ function print() { __p += __j.call(arguments, '') } ${fr=>getBlocksCSSVariables(fr.theme.blocksTheme)} } -`,themeConfig={dark:{blocksTheme:blocksTheme.dark,scheme:"dark"},light:{blocksTheme:blocksTheme.light,scheme:"light"}};function App(){const{isDarkMode:fr}=useDarkMode();return jsxRuntimeExports.jsxs(Le$2,{theme:fr?themeConfig.dark:themeConfig.light,children:[jsxRuntimeExports.jsx(GlobalStyle,{}),jsxRuntimeExports.jsx(GlobalProvider,{children:jsxRuntimeExports.jsx(BrowserRouter,{basename:getAppBasePath(),children:jsxRuntimeExports.jsx(RouterContainer,{})})})]})}typeof window<"u"&&(window.global=globalThis,Object.assign(window,{Buffer:Buffer$1$1}));var version$d="3.8.2",version$c="3.8.2";function __awaiter$c(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,br||[])).next())})}function __classPrivateFieldGet$4(fr,br,wr,Er){if(wr==="a"&&!Er)throw new TypeError("Private accessor was defined without a getter");if(typeof br=="function"?fr!==br||!Er:!br.has(fr))throw new TypeError("Cannot read private member from an object whose class did not declare it");return wr==="m"?Er:wr==="a"?Er.call(fr):Er?Er.value:br.get(fr)}function __classPrivateFieldSet$4(fr,br,wr,Er,kr){if(typeof br=="function"?fr!==br||!kr:!br.has(fr))throw new TypeError("Cannot write private member to an object whose class did not declare it");return kr?kr.value=wr:br.set(fr,wr),wr}typeof SuppressedError=="function"&&SuppressedError;const DEFAULT_JWK_MEMBER_BYTE_LENGTH=32;function stringToBase64urlString(fr){const br=btoa$1(fr);return base64StringToBase64UrlEncodedString(br)}function hexStringToBase64url(fr,br){const wr=fr.padStart(Math.ceil(fr.length/2)*2,"0"),Er=uint8ArrayFromHexString(wr,br);return stringToBase64urlString(Er.reduce((kr,jr)=>kr+String.fromCharCode(jr),""))}function base64StringToBase64UrlEncodedString(fr){return fr.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function uint8ArrayToHexString(fr){return fr.reduce((br,wr)=>br+wr.toString(16).padStart(2,"0"),"")}const uint8ArrayFromHexString=(fr,br)=>{const wr=/^[0-9A-Fa-f]+$/;if(!fr||fr.length%2!=0||!wr.test(fr))throw new Error(`cannot create uint8array from invalid hex string: "${fr}"`);const Er=new Uint8Array(fr.match(/../g).map(jr=>parseInt(jr,16)));if(!br)return Er;if(fr.length/2>br)throw new Error("hex value cannot fit in a buffer of "+br+" byte(s)");let kr=new Uint8Array(br);return kr.set(Er,br-Er.length),kr};function btoa$1(fr){if(arguments.length===0)throw new TypeError("1 argument required, but only 0 present.");let br;for(fr=`${fr}`,br=0;br255)throw new Error(`InvalidCharacterError: found code point greater than 255:${fr.charCodeAt(br)} at position ${br}`);let wr="";for(br=0;br>2,Er[1]=(fr.charCodeAt(br)&3)<<4,fr.length>br+1&&(Er[1]|=fr.charCodeAt(br+1)>>4,Er[2]=(fr.charCodeAt(br+1)&15)<<2),fr.length>br+2&&(Er[2]|=fr.charCodeAt(br+2)>>6,Er[3]=fr.charCodeAt(br+2)&63);for(let kr=0;kr"u"?wr+="=":wr+=btoaLookup(Er[kr])}return wr}function btoaLookup(fr){const br="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";if(fr>=0&&fr<64)return br[fr]}const stampHeaderName$2="X-Stamp",isCryptoEnabledBrowser=typeof window<"u"&&typeof window.document<"u"&&typeof crypto<"u"&&typeof crypto.subtle<"u",isNode=typeof process$1$1<"u"&&process$1$1.versions!=null&&process$1$1.versions.node!=null,signWithApiKey=async fr=>isCryptoEnabledBrowser?(await __vitePreload(()=>import("./webcrypto-BwsVVJaH.js"),__vite__mapDeps([0,1])).then(wr=>wr.signWithApiKey))(fr):isNode?(await __vitePreload(()=>import("./nodecrypto-D2ugBmJb.js"),__vite__mapDeps([2,1])).then(wr=>wr.signWithApiKey))(fr):(await __vitePreload(()=>import("./purejs-CAiGQDMH.js"),[]).then(wr=>wr.signWithApiKey))(fr);class ApiKeyStamper{constructor(br){this.apiPublicKey=br.apiPublicKey,this.apiPrivateKey=br.apiPrivateKey}async stamp(br){const wr=await signWithApiKey({publicKey:this.apiPublicKey,privateKey:this.apiPrivateKey,content:br}),Er={publicKey:this.apiPublicKey,scheme:"SIGNATURE_SCHEME_TK_API_P256",signature:wr};return{stampHeaderName:stampHeaderName$2,stampHeaderValue:stringToBase64urlString(JSON.stringify(Er))}}}const base64UrlEncode=fr=>Buffer$2.from(fr).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),generateRandomBuffer=()=>{const fr=new Uint8Array(32);return crypto.getRandomValues(fr),fr.buffer},transportMap={AUTHENTICATOR_TRANSPORT_BLE:AuthenticatorTransportProtocol.Ble,AUTHENTICATOR_TRANSPORT_HYBRID:AuthenticatorTransportProtocol.Hybrid,AUTHENTICATOR_TRANSPORT_INTERNAL:AuthenticatorTransportProtocol.Internal,AUTHENTICATOR_TRANSPORT_NFC:AuthenticatorTransportProtocol.Nfc,AUTHENTICATOR_TRANSPORT_USB:AuthenticatorTransportProtocol.Usb},convertAttestationTransports=fr=>fr.map(br=>transportMap[br]),TURNKEY_API_BASE_URL="https://api.turnkey.com",TURNKEY_API_KEY_EXPIRY_MESSAGE="Turnkey error 16: expired api key",TURNKEY_API_KEY_NOT_FOUND_MESSAGE="Turnkey error 16: could not find public key",WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE="The operation either timed out or was not allowed",WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE="The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.",INVALID_PASSKEY_SELECTED_ERROR_MESSAGE="Turnkey error 5: webauthn authenticator not found in organization or parent organization",USER_CANCELLED_REQUEST_ERROR_MESSAGE="The user cancelled the request",TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS=[TURNKEY_API_KEY_EXPIRY_MESSAGE,TURNKEY_API_KEY_NOT_FOUND_MESSAGE],TURNKEY_SDK_BENIGN_ERRORS=[WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE,WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE,INVALID_PASSKEY_SELECTED_ERROR_MESSAGE,USER_CANCELLED_REQUEST_ERROR_MESSAGE];class DynamicEmbeddedWalletsLogger extends Logger$1{constructor(br,wr){super(br,wr)}error(br,...wr){const[Er]=wr;!(Er!=null&&Er.message)||!TURNKEY_SDK_BENIGN_ERRORS.some(kr=>Er.message.includes(kr))?(Logger$1.events.emit("error",br),this.log(LogLevel.ERROR,br,...wr)):this.warn(br,...wr)}}const logger$4=new DynamicEmbeddedWalletsLogger("Dynamic embedded wallets",LogLevel.INFO),stampHeaderName$1="X-Stamp";var IframeEventType;(function(fr){fr.PublicKeyReady="PUBLIC_KEY_READY",fr.InjectCredentialBundle="INJECT_CREDENTIAL_BUNDLE",fr.InjectKeyExportBundle="INJECT_KEY_EXPORT_BUNDLE",fr.InjectWalletExportBundle="INJECT_WALLET_EXPORT_BUNDLE",fr.InjectImportBundle="INJECT_IMPORT_BUNDLE",fr.ExtractWalletEncryptedBundle="EXTRACT_WALLET_ENCRYPTED_BUNDLE",fr.ExtractKeyEncryptedBundle="EXTRACT_KEY_ENCRYPTED_BUNDLE",fr.ApplySettings="APPLY_SETTINGS",fr.BundleInjected="BUNDLE_INJECTED",fr.EncryptedBundleExtracted="ENCRYPTED_BUNDLE_EXTRACTED",fr.SettingsApplied="SETTINGS_APPLIED",fr.StampRequest="STAMP_REQUEST",fr.Stamp="STAMP",fr.Error="ERROR"})(IframeEventType||(IframeEventType={}));var KeyFormat;(function(fr){fr.Hexadecimal="HEXADECIMAL",fr.Solana="SOLANA"})(KeyFormat||(KeyFormat={}));class IframeStamper{constructor(br){if(typeof window>"u")throw new Error("Cannot initialize iframe in non-browser environment");if(!br.iframeContainer)throw new Error("Iframe container cannot be found");if(this.container=br.iframeContainer,this.container.querySelector(`#${br.iframeElementId}`))throw new Error(`Iframe element with ID ${br.iframeElementId} already exists`);let wr=window.document.createElement("iframe");wr.setAttribute("sandbox","allow-scripts allow-same-origin"),wr.id=br.iframeElementId,wr.src=br.iframeUrl,this.iframe=wr;const Er=new URL(br.iframeUrl);this.iframeOrigin=Er.origin,this.iframePublicKey=null}async init(){return this.container.appendChild(this.iframe),new Promise((br,wr)=>{window.addEventListener("message",Er=>{var kr;Er.origin===this.iframeOrigin&&((kr=Er.data)==null?void 0:kr.type)===IframeEventType.PublicKeyReady&&(this.iframePublicKey=Er.data.value,br(Er.data.value))},!1)})}clear(){this.iframe.remove()}publicKey(){return this.iframePublicKey}async injectCredentialBundle(br){return new Promise((wr,Er)=>{var kr;(kr=this.iframe.contentWindow)==null||kr.postMessage({type:IframeEventType.InjectCredentialBundle,value:br},"*"),window.addEventListener("message",jr=>{var Br,Wr;jr.origin===this.iframeOrigin&&(((Br=jr.data)==null?void 0:Br.type)===IframeEventType.BundleInjected&&wr(jr.data.value),((Wr=jr.data)==null?void 0:Wr.type)===IframeEventType.Error&&Er(jr.data.value))},!1)})}async injectKeyExportBundle(br,wr,Er){var kr;return(kr=this.iframe.contentWindow)==null||kr.postMessage({type:IframeEventType.InjectKeyExportBundle,value:br,keyFormat:Er,organizationId:wr},"*"),new Promise((jr,Br)=>{window.addEventListener("message",Wr=>{var qr,Gr;Wr.origin===this.iframeOrigin&&(((qr=Wr.data)==null?void 0:qr.type)===IframeEventType.BundleInjected&&jr(Wr.data.value),((Gr=Wr.data)==null?void 0:Gr.type)===IframeEventType.Error&&Br(Wr.data.value))},!1)})}async injectWalletExportBundle(br,wr){var Er;return(Er=this.iframe.contentWindow)==null||Er.postMessage({type:IframeEventType.InjectWalletExportBundle,value:br,organizationId:wr},"*"),new Promise((kr,jr)=>{window.addEventListener("message",Br=>{var Wr,qr;Br.origin===this.iframeOrigin&&(((Wr=Br.data)==null?void 0:Wr.type)===IframeEventType.BundleInjected&&kr(Br.data.value),((qr=Br.data)==null?void 0:qr.type)===IframeEventType.Error&&jr(Br.data.value))},!1)})}async injectImportBundle(br,wr,Er){var kr;return(kr=this.iframe.contentWindow)==null||kr.postMessage({type:IframeEventType.InjectImportBundle,value:br,organizationId:wr,userId:Er},"*"),new Promise((jr,Br)=>{window.addEventListener("message",Wr=>{var qr,Gr;Wr.origin===this.iframeOrigin&&(((qr=Wr.data)==null?void 0:qr.type)===IframeEventType.BundleInjected&&jr(Wr.data.value),((Gr=Wr.data)==null?void 0:Gr.type)===IframeEventType.Error&&Br(Wr.data.value))},!1)})}async extractWalletEncryptedBundle(){var br;return(br=this.iframe.contentWindow)==null||br.postMessage({type:IframeEventType.ExtractWalletEncryptedBundle},"*"),new Promise((wr,Er)=>{window.addEventListener("message",kr=>{var jr,Br;kr.origin===this.iframeOrigin&&(((jr=kr.data)==null?void 0:jr.type)===IframeEventType.EncryptedBundleExtracted&&wr(kr.data.value),((Br=kr.data)==null?void 0:Br.type)===IframeEventType.Error&&Er(kr.data.value))},!1)})}async extractKeyEncryptedBundle(br){var wr;return(wr=this.iframe.contentWindow)==null||wr.postMessage({type:IframeEventType.ExtractKeyEncryptedBundle,keyFormat:br},"*"),new Promise((Er,kr)=>{window.addEventListener("message",jr=>{var Br,Wr;jr.origin===this.iframeOrigin&&(((Br=jr.data)==null?void 0:Br.type)===IframeEventType.EncryptedBundleExtracted&&Er(jr.data.value),((Wr=jr.data)==null?void 0:Wr.type)===IframeEventType.Error&&kr(jr.data.value))},!1)})}async applySettings(br){var Er;const wr=JSON.stringify(br);return(Er=this.iframe.contentWindow)==null||Er.postMessage({type:IframeEventType.ApplySettings,value:wr},"*"),new Promise((kr,jr)=>{window.addEventListener("message",Br=>{var Wr,qr;Br.origin===this.iframeOrigin&&(((Wr=Br.data)==null?void 0:Wr.type)===IframeEventType.SettingsApplied&&kr(Br.data.value),((qr=Br.data)==null?void 0:qr.type)===IframeEventType.Error&&jr(Br.data.value))},!1)})}async stamp(br){var Er;if(this.iframePublicKey===null)throw new Error("null iframe public key. Have you called/awaited .init()?");const wr=this.iframeOrigin;return(Er=this.iframe.contentWindow)==null||Er.postMessage({type:IframeEventType.StampRequest,value:br},"*"),new Promise(function(kr,jr){window.addEventListener("message",Br=>{var Wr,qr;Br.origin===wr&&(((Wr=Br.data)==null?void 0:Wr.type)===IframeEventType.Stamp&&kr({stampHeaderName:stampHeaderName$1,stampHeaderValue:Br.data.value}),((qr=Br.data)==null?void 0:qr.type)===IframeEventType.Error&&jr(Br.data.value))},!1)})}}var browserPonyfill={exports:{}};(function(fr,br){var wr=typeof self<"u"?self:commonjsGlobal,Er=function(){function jr(){this.fetch=!1,this.DOMException=wr.DOMException}return jr.prototype=wr,new jr}();(function(jr){(function(Br){var Wr={searchParams:"URLSearchParams"in jr,iterable:"Symbol"in jr&&"iterator"in Symbol,blob:"FileReader"in jr&&"Blob"in jr&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in jr,arrayBuffer:"ArrayBuffer"in jr};function qr(Hr){return Hr&&DataView.prototype.isPrototypeOf(Hr)}if(Wr.arrayBuffer)var Gr=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Vr=ArrayBuffer.isView||function(Hr){return Hr&&Gr.indexOf(Object.prototype.toString.call(Hr))>-1};function Zr(Hr){if(typeof Hr!="string"&&(Hr=String(Hr)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(Hr))throw new TypeError("Invalid character in header field name");return Hr.toLowerCase()}function Jr(Hr){return typeof Hr!="string"&&(Hr=String(Hr)),Hr}function Qr(Hr){var Xr={next:function(){var Sn=Hr.shift();return{done:Sn===void 0,value:Sn}}};return Wr.iterable&&(Xr[Symbol.iterator]=function(){return Xr}),Xr}function _n(Hr){this.map={},Hr instanceof _n?Hr.forEach(function(Xr,Sn){this.append(Sn,Xr)},this):Array.isArray(Hr)?Hr.forEach(function(Xr){this.append(Xr[0],Xr[1])},this):Hr&&Object.getOwnPropertyNames(Hr).forEach(function(Xr){this.append(Xr,Hr[Xr])},this)}_n.prototype.append=function(Hr,Xr){Hr=Zr(Hr),Xr=Jr(Xr);var Sn=this.map[Hr];this.map[Hr]=Sn?Sn+", "+Xr:Xr},_n.prototype.delete=function(Hr){delete this.map[Zr(Hr)]},_n.prototype.get=function(Hr){return Hr=Zr(Hr),this.has(Hr)?this.map[Hr]:null},_n.prototype.has=function(Hr){return this.map.hasOwnProperty(Zr(Hr))},_n.prototype.set=function(Hr,Xr){this.map[Zr(Hr)]=Jr(Xr)},_n.prototype.forEach=function(Hr,Xr){for(var Sn in this.map)this.map.hasOwnProperty(Sn)&&Hr.call(Xr,this.map[Sn],Sn,this)},_n.prototype.keys=function(){var Hr=[];return this.forEach(function(Xr,Sn){Hr.push(Sn)}),Qr(Hr)},_n.prototype.values=function(){var Hr=[];return this.forEach(function(Xr){Hr.push(Xr)}),Qr(Hr)},_n.prototype.entries=function(){var Hr=[];return this.forEach(function(Xr,Sn){Hr.push([Sn,Xr])}),Qr(Hr)},Wr.iterable&&(_n.prototype[Symbol.iterator]=_n.prototype.entries);function En(Hr){if(Hr.bodyUsed)return Promise.reject(new TypeError("Already read"));Hr.bodyUsed=!0}function Cn(Hr){return new Promise(function(Xr,Sn){Hr.onload=function(){Xr(Hr.result)},Hr.onerror=function(){Sn(Hr.error)}})}function In(Hr){var Xr=new FileReader,Sn=Cn(Xr);return Xr.readAsArrayBuffer(Hr),Sn}function An(Hr){var Xr=new FileReader,Sn=Cn(Xr);return Xr.readAsText(Hr),Sn}function jn(Hr){for(var Xr=new Uint8Array(Hr),Sn=new Array(Xr.length),Rn=0;Rn-1?Xr:Hr}function oo(Hr,Xr){Xr=Xr||{};var Sn=Xr.body;if(Hr instanceof oo){if(Hr.bodyUsed)throw new TypeError("Already read");this.url=Hr.url,this.credentials=Hr.credentials,Xr.headers||(this.headers=new _n(Hr.headers)),this.method=Hr.method,this.mode=Hr.mode,this.signal=Hr.signal,!Sn&&Hr._bodyInit!=null&&(Sn=Hr._bodyInit,Hr.bodyUsed=!0)}else this.url=String(Hr);if(this.credentials=Xr.credentials||this.credentials||"same-origin",(Xr.headers||!this.headers)&&(this.headers=new _n(Xr.headers)),this.method=_i(Xr.method||this.method||"GET"),this.mode=Xr.mode||this.mode||null,this.signal=Xr.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&Sn)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(Sn)}oo.prototype.clone=function(){return new oo(this,{body:this._bodyInit})};function io(Hr){var Xr=new FormData;return Hr.trim().split("&").forEach(function(Sn){if(Sn){var Rn=Sn.split("="),Pn=Rn.shift().replace(/\+/g," "),On=Rn.join("=").replace(/\+/g," ");Xr.append(decodeURIComponent(Pn),decodeURIComponent(On))}}),Xr}function co(Hr){var Xr=new _n,Sn=Hr.replace(/\r?\n[\t ]+/g," ");return Sn.split(/\r?\n/).forEach(function(Rn){var Pn=Rn.split(":"),On=Pn.shift().trim();if(On){var Zn=Pn.join(":").trim();Xr.append(On,Zn)}}),Xr}ro.call(oo.prototype);function so(Hr,Xr){Xr||(Xr={}),this.type="default",this.status=Xr.status===void 0?200:Xr.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in Xr?Xr.statusText:"OK",this.headers=new _n(Xr.headers),this.url=Xr.url||"",this._initBody(Hr)}ro.call(so.prototype),so.prototype.clone=function(){return new so(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new _n(this.headers),url:this.url})},so.error=function(){var Hr=new so(null,{status:0,statusText:""});return Hr.type="error",Hr};var no=[301,302,303,307,308];so.redirect=function(Hr,Xr){if(no.indexOf(Xr)===-1)throw new RangeError("Invalid status code");return new so(null,{status:Xr,headers:{location:Hr}})},Br.DOMException=jr.DOMException;try{new Br.DOMException}catch{Br.DOMException=function(Xr,Sn){this.message=Xr,this.name=Sn;var Rn=Error(Xr);this.stack=Rn.stack},Br.DOMException.prototype=Object.create(Error.prototype),Br.DOMException.prototype.constructor=Br.DOMException}function Tn(Hr,Xr){return new Promise(function(Sn,Rn){var Pn=new oo(Hr,Xr);if(Pn.signal&&Pn.signal.aborted)return Rn(new Br.DOMException("Aborted","AbortError"));var On=new XMLHttpRequest;function Zn(){On.abort()}On.onload=function(){var Nn={status:On.status,statusText:On.statusText,headers:co(On.getAllResponseHeaders()||"")};Nn.url="responseURL"in On?On.responseURL:Nn.headers.get("X-Request-URL");var wn="response"in On?On.response:On.responseText;Sn(new so(wn,Nn))},On.onerror=function(){Rn(new TypeError("Network request failed"))},On.ontimeout=function(){Rn(new TypeError("Network request failed"))},On.onabort=function(){Rn(new Br.DOMException("Aborted","AbortError"))},On.open(Pn.method,Pn.url,!0),Pn.credentials==="include"?On.withCredentials=!0:Pn.credentials==="omit"&&(On.withCredentials=!1),"responseType"in On&&Wr.blob&&(On.responseType="blob"),Pn.headers.forEach(function(Nn,wn){On.setRequestHeader(wn,Nn)}),Pn.signal&&(Pn.signal.addEventListener("abort",Zn),On.onreadystatechange=function(){On.readyState===4&&Pn.signal.removeEventListener("abort",Zn)}),On.send(typeof Pn._bodyInit>"u"?null:Pn._bodyInit)})}return Tn.polyfill=!0,jr.fetch||(jr.fetch=Tn,jr.Headers=_n,jr.Request=oo,jr.Response=so),Br.Headers=_n,Br.Request=oo,Br.Response=so,Br.fetch=Tn,Object.defineProperty(Br,"__esModule",{value:!0}),Br})({})})(Er),Er.fetch.ponyfill=!0,delete Er.fetch.polyfill;var kr=Er;br=kr.fetch,br.default=kr.fetch,br.fetch=kr.fetch,br.Headers=kr.Headers,br.Request=kr.Request,br.Response=kr.Response,fr.exports=br})(browserPonyfill,browserPonyfill.exports);var browserPonyfillExports=browserPonyfill.exports;const o$2=getDefaultExportFromCjs$2(browserPonyfillExports),fetch$1=browserPonyfillExports.fetch;class TurnkeyRequestError extends Error{constructor(br){let wr=`Turnkey error ${br.code}: ${br.message}`;br.details!=null&&(wr+=` (Details: ${JSON.stringify(br.details)})`),super(wr),this.name="TurnkeyRequestError",this.details=br.details??null,this.code=br.code}}const VERSION$1="@turnkey/http@2.12.2";class TurnkeyClient{constructor(br,wr){if(this.getActivity=async Er=>this.request("/public/v1/query/get_activity",Er),this.stampGetActivity=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_activity",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getApiKey=async Er=>this.request("/public/v1/query/get_api_key",Er),this.stampGetApiKey=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_api_key",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getApiKeys=async Er=>this.request("/public/v1/query/get_api_keys",Er),this.stampGetApiKeys=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_api_keys",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getAttestationDocument=async Er=>this.request("/public/v1/query/get_attestation",Er),this.stampGetAttestationDocument=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_attestation",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getAuthenticator=async Er=>this.request("/public/v1/query/get_authenticator",Er),this.stampGetAuthenticator=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_authenticator",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getAuthenticators=async Er=>this.request("/public/v1/query/get_authenticators",Er),this.stampGetAuthenticators=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_authenticators",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getOauthProviders=async Er=>this.request("/public/v1/query/get_oauth_providers",Er),this.stampGetOauthProviders=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_oauth_providers",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getOrganization=async Er=>this.request("/public/v1/query/get_organization",Er),this.stampGetOrganization=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_organization",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getOrganizationConfigs=async Er=>this.request("/public/v1/query/get_organization_configs",Er),this.stampGetOrganizationConfigs=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_organization_configs",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getPolicy=async Er=>this.request("/public/v1/query/get_policy",Er),this.stampGetPolicy=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_policy",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getPrivateKey=async Er=>this.request("/public/v1/query/get_private_key",Er),this.stampGetPrivateKey=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_private_key",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getUser=async Er=>this.request("/public/v1/query/get_user",Er),this.stampGetUser=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_user",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getWallet=async Er=>this.request("/public/v1/query/get_wallet",Er),this.stampGetWallet=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_wallet",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getActivities=async Er=>this.request("/public/v1/query/list_activities",Er),this.stampGetActivities=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_activities",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getPolicies=async Er=>this.request("/public/v1/query/list_policies",Er),this.stampGetPolicies=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_policies",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.listPrivateKeyTags=async Er=>this.request("/public/v1/query/list_private_key_tags",Er),this.stampListPrivateKeyTags=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_private_key_tags",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getPrivateKeys=async Er=>this.request("/public/v1/query/list_private_keys",Er),this.stampGetPrivateKeys=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_private_keys",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getSubOrgIds=async Er=>this.request("/public/v1/query/list_suborgs",Er),this.stampGetSubOrgIds=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_suborgs",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.listUserTags=async Er=>this.request("/public/v1/query/list_user_tags",Er),this.stampListUserTags=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_user_tags",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getUsers=async Er=>this.request("/public/v1/query/list_users",Er),this.stampGetUsers=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_users",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getWalletAccounts=async Er=>this.request("/public/v1/query/list_wallet_accounts",Er),this.stampGetWalletAccounts=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_wallet_accounts",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getWallets=async Er=>this.request("/public/v1/query/list_wallets",Er),this.stampGetWallets=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_wallets",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getWhoami=async Er=>this.request("/public/v1/query/whoami",Er),this.stampGetWhoami=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/whoami",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.approveActivity=async Er=>this.request("/public/v1/submit/approve_activity",Er),this.stampApproveActivity=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/approve_activity",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createApiKeys=async Er=>this.request("/public/v1/submit/create_api_keys",Er),this.stampCreateApiKeys=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_api_keys",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createApiOnlyUsers=async Er=>this.request("/public/v1/submit/create_api_only_users",Er),this.stampCreateApiOnlyUsers=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_api_only_users",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createAuthenticators=async Er=>this.request("/public/v1/submit/create_authenticators",Er),this.stampCreateAuthenticators=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_authenticators",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createInvitations=async Er=>this.request("/public/v1/submit/create_invitations",Er),this.stampCreateInvitations=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_invitations",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createOauthProviders=async Er=>this.request("/public/v1/submit/create_oauth_providers",Er),this.stampCreateOauthProviders=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_oauth_providers",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createPolicies=async Er=>this.request("/public/v1/submit/create_policies",Er),this.stampCreatePolicies=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_policies",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createPolicy=async Er=>this.request("/public/v1/submit/create_policy",Er),this.stampCreatePolicy=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_policy",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createPrivateKeyTag=async Er=>this.request("/public/v1/submit/create_private_key_tag",Er),this.stampCreatePrivateKeyTag=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_private_key_tag",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createPrivateKeys=async Er=>this.request("/public/v1/submit/create_private_keys",Er),this.stampCreatePrivateKeys=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_private_keys",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createReadOnlySession=async Er=>this.request("/public/v1/submit/create_read_only_session",Er),this.stampCreateReadOnlySession=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_read_only_session",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createReadWriteSession=async Er=>this.request("/public/v1/submit/create_read_write_session",Er),this.stampCreateReadWriteSession=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_read_write_session",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createSubOrganization=async Er=>this.request("/public/v1/submit/create_sub_organization",Er),this.stampCreateSubOrganization=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_sub_organization",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createUserTag=async Er=>this.request("/public/v1/submit/create_user_tag",Er),this.stampCreateUserTag=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_user_tag",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createUsers=async Er=>this.request("/public/v1/submit/create_users",Er),this.stampCreateUsers=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_users",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createWallet=async Er=>this.request("/public/v1/submit/create_wallet",Er),this.stampCreateWallet=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_wallet",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createWalletAccounts=async Er=>this.request("/public/v1/submit/create_wallet_accounts",Er),this.stampCreateWalletAccounts=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_wallet_accounts",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.deleteApiKeys=async Er=>this.request("/public/v1/submit/delete_api_keys",Er),this.stampDeleteApiKeys=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/delete_api_keys",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.deleteAuthenticators=async Er=>this.request("/public/v1/submit/delete_authenticators",Er),this.stampDeleteAuthenticators=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/delete_authenticators",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.deleteInvitation=async Er=>this.request("/public/v1/submit/delete_invitation",Er),this.stampDeleteInvitation=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/delete_invitation",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.deleteOauthProviders=async Er=>this.request("/public/v1/submit/delete_oauth_providers",Er),this.stampDeleteOauthProviders=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/delete_oauth_providers",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.deletePolicy=async Er=>this.request("/public/v1/submit/delete_policy",Er),this.stampDeletePolicy=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/delete_policy",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.deletePrivateKeyTags=async Er=>this.request("/public/v1/submit/delete_private_key_tags",Er),this.stampDeletePrivateKeyTags=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/delete_private_key_tags",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.deleteUserTags=async Er=>this.request("/public/v1/submit/delete_user_tags",Er),this.stampDeleteUserTags=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/delete_user_tags",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.deleteUsers=async Er=>this.request("/public/v1/submit/delete_users",Er),this.stampDeleteUsers=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/delete_users",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.emailAuth=async Er=>this.request("/public/v1/submit/email_auth",Er),this.stampEmailAuth=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/email_auth",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.exportPrivateKey=async Er=>this.request("/public/v1/submit/export_private_key",Er),this.stampExportPrivateKey=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/export_private_key",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.exportWallet=async Er=>this.request("/public/v1/submit/export_wallet",Er),this.stampExportWallet=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/export_wallet",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.exportWalletAccount=async Er=>this.request("/public/v1/submit/export_wallet_account",Er),this.stampExportWalletAccount=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/export_wallet_account",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.importPrivateKey=async Er=>this.request("/public/v1/submit/import_private_key",Er),this.stampImportPrivateKey=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/import_private_key",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.importWallet=async Er=>this.request("/public/v1/submit/import_wallet",Er),this.stampImportWallet=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/import_wallet",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.initImportPrivateKey=async Er=>this.request("/public/v1/submit/init_import_private_key",Er),this.stampInitImportPrivateKey=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/init_import_private_key",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.initImportWallet=async Er=>this.request("/public/v1/submit/init_import_wallet",Er),this.stampInitImportWallet=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/init_import_wallet",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.initUserEmailRecovery=async Er=>this.request("/public/v1/submit/init_user_email_recovery",Er),this.stampInitUserEmailRecovery=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/init_user_email_recovery",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.oauth=async Er=>this.request("/public/v1/submit/oauth",Er),this.stampOauth=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/oauth",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.recoverUser=async Er=>this.request("/public/v1/submit/recover_user",Er),this.stampRecoverUser=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/recover_user",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.rejectActivity=async Er=>this.request("/public/v1/submit/reject_activity",Er),this.stampRejectActivity=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/reject_activity",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.removeOrganizationFeature=async Er=>this.request("/public/v1/submit/remove_organization_feature",Er),this.stampRemoveOrganizationFeature=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/remove_organization_feature",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.setOrganizationFeature=async Er=>this.request("/public/v1/submit/set_organization_feature",Er),this.stampSetOrganizationFeature=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/set_organization_feature",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.signRawPayload=async Er=>this.request("/public/v1/submit/sign_raw_payload",Er),this.stampSignRawPayload=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/sign_raw_payload",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.signRawPayloads=async Er=>this.request("/public/v1/submit/sign_raw_payloads",Er),this.stampSignRawPayloads=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/sign_raw_payloads",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.signTransaction=async Er=>this.request("/public/v1/submit/sign_transaction",Er),this.stampSignTransaction=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/sign_transaction",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.updatePolicy=async Er=>this.request("/public/v1/submit/update_policy",Er),this.stampUpdatePolicy=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/update_policy",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.updatePrivateKeyTag=async Er=>this.request("/public/v1/submit/update_private_key_tag",Er),this.stampUpdatePrivateKeyTag=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/update_private_key_tag",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.updateRootQuorum=async Er=>this.request("/public/v1/submit/update_root_quorum",Er),this.stampUpdateRootQuorum=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/update_root_quorum",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.updateUser=async Er=>this.request("/public/v1/submit/update_user",Er),this.stampUpdateUser=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/update_user",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.updateUserTag=async Er=>this.request("/public/v1/submit/update_user_tag",Er),this.stampUpdateUserTag=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/update_user_tag",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},!br.baseUrl)throw new Error("Missing base URL. Please verify env vars.");this.config=br,this.stamper=wr}async request(br,wr){const Er=this.config.baseUrl+br,kr=JSON.stringify(wr),jr=await this.stamper.stamp(kr),Br=await fetch$1(Er,{method:"POST",headers:{[jr.stampHeaderName]:jr.stampHeaderValue,"X-Client-Version":VERSION$1},body:kr,redirect:"follow"});if(!Br.ok){let qr;try{qr=await Br.json()}catch{throw new Error(`${Br.status} ${Br.statusText}`)}throw new TurnkeyRequestError(qr)}return await Br.json()}}class TurnkeyActivityError extends Error{constructor(br){const{message:wr,cause:Er,activityId:kr,activityStatus:jr,activityType:Br}=br;super(wr),this.name="TurnkeyActivityError",this.activityId=kr??null,this.activityStatus=jr??null,this.activityType=Br??null,this.cause=Er??null}}function bufferToBase64url(fr){const br=new Uint8Array(fr);let wr="";for(const jr of br)wr+=String.fromCharCode(jr);return btoa(wr).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}const copyValue="copy",convertValue="convert";function convert$1(fr,br,wr){if(br===copyValue)return wr;if(br===convertValue)return fr(wr);if(br instanceof Array)return wr.map(Er=>convert$1(fr,br[0],Er));if(br instanceof Object){const Er={};for(const[kr,jr]of Object.entries(br)){if(jr.derive){const Br=jr.derive(wr);Br!==void 0&&(wr[kr]=Br)}if(!(kr in wr)){if(jr.required)throw new Error(`Missing key: ${kr}`);continue}if(wr[kr]==null){Er[kr]=null;continue}Er[kr]=convert$1(fr,jr.schema,wr[kr])}return Er}}function derived(fr,br){return{required:!0,schema:fr,derive:br}}function required(fr){return{required:!0,schema:fr}}function optional$3(fr){return{required:!1,schema:fr}}const simplifiedClientExtensionResultsSchema={appid:optional$3(copyValue),appidExclude:optional$3(copyValue),credProps:optional$3(copyValue)},publicKeyCredentialWithAssertion={type:required(copyValue),id:required(copyValue),rawId:required(convertValue),authenticatorAttachment:optional$3(copyValue),response:required({clientDataJSON:required(convertValue),authenticatorData:required(convertValue),signature:required(convertValue),userHandle:required(convertValue)}),clientExtensionResults:derived(simplifiedClientExtensionResultsSchema,fr=>fr.getClientExtensionResults())};function getResponseToJSON(fr){return convert$1(bufferToBase64url,publicKeyCredentialWithAssertion,fr)}async function get$2(fr){const br=await navigator.credentials.get(fr);return br.toJSON=()=>getResponseToJSON(br),br}const K$2=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998];function createHash(fr){return new Hash}class Hash{constructor(){this.A=1779033703,this.B=-1150833019,this.C=1013904242,this.D=-1521486534,this.E=1359893119,this.F=-1694144372,this.G=528734635,this.H=1541459225,this._size=0,this._sp=0,(!sharedBuffer||sharedOffset>=8e3)&&(sharedBuffer=new ArrayBuffer(8e3),sharedOffset=0),this._byte=new Uint8Array(sharedBuffer,sharedOffset,80),this._word=new Int32Array(sharedBuffer,sharedOffset,20),sharedOffset+=80}update(br){if(typeof br=="string")return this._utf8(br);if(br==null)throw new TypeError("Invalid type: "+typeof br);const wr=br.byteOffset,Er=br.byteLength;let kr=Er/64|0,jr=0;if(kr&&!(wr&3)&&!(this._size%64)){const Wr=new Int32Array(br.buffer,wr,kr*16);for(;kr--;)this._int32(Wr,jr>>2),jr+=64;this._size+=jr}if(br.BYTES_PER_ELEMENT!==1&&br.buffer){const Wr=new Uint8Array(br.buffer,wr+jr,Er-jr);return this._uint8(Wr)}return jr===Er?this:this._uint8(br,jr)}_uint8(br,wr){const{_byte:Er,_word:kr}=this,jr=br.length;for(wr=wr|0;wr=64&&this._int32(kr),this._size+=Wr-Br}return this}_utf8(br){const{_byte:wr,_word:Er}=this,kr=br.length;let jr=this._sp;for(let Br=0;Br>>6,wr[qr++]=128|Gr&63):Gr<55296||Gr>57343?(wr[qr++]=224|Gr>>>12,wr[qr++]=128|Gr>>>6&63,wr[qr++]=128|Gr&63):jr?(Gr=((jr&1023)<<10)+(Gr&1023)+65536,wr[qr++]=240|Gr>>>18,wr[qr++]=128|Gr>>>12&63,wr[qr++]=128|Gr>>>6&63,wr[qr++]=128|Gr&63,jr=0):jr=Gr}qr>=64&&(this._int32(Er),Er[0]=Er[16]),this._size+=qr-Wr}return this._sp=jr,this}_int32(br,wr){let{A:Er,B:kr,C:jr,D:Br,E:Wr,F:qr,G:Gr,H:Vr}=this,Zr=0;for(wr=wr|0;Zr<16;)W$1[Zr++]=swap32(br[wr++]);for(Zr=16;Zr<64;Zr++)W$1[Zr]=gamma1(W$1[Zr-2])+W$1[Zr-7]+gamma0(W$1[Zr-15])+W$1[Zr-16]|0;for(Zr=0;Zr<64;Zr++){const Jr=Vr+sigma1(Wr)+ch(Wr,qr,Gr)+K$2[Zr]+W$1[Zr]|0,Qr=sigma0(Er)+maj(Er,kr,jr)|0;Vr=Gr,Gr=qr,qr=Wr,Wr=Br+Jr|0,Br=jr,jr=kr,kr=Er,Er=Jr+Qr|0}this.A=Er+this.A|0,this.B=kr+this.B|0,this.C=jr+this.C|0,this.D=Br+this.D|0,this.E=Wr+this.E|0,this.F=qr+this.F|0,this.G=Gr+this.G|0,this.H=Vr+this.H|0}digest(br){const{_byte:wr,_word:Er}=this;let kr=this._size%64|0;for(wr[kr++]=128;kr&3;)wr[kr++]=0;if(kr>>=2,kr>14){for(;kr<16;)Er[kr++]=0;kr=0,this._int32(Er)}for(;kr<16;)Er[kr++]=0;const jr=this._size*8,Br=(jr&4294967295)>>>0,Wr=(jr-Br)/4294967296;return Wr&&(Er[14]=swap32(Wr)),Br&&(Er[15]=swap32(Br)),this._int32(Er),br==="hex"?this._hex():this._bin()}_hex(){const{A:br,B:wr,C:Er,D:kr,E:jr,F:Br,G:Wr,H:qr}=this;return hex32(br)+hex32(wr)+hex32(Er)+hex32(kr)+hex32(jr)+hex32(Br)+hex32(Wr)+hex32(qr)}_bin(){const{A:br,B:wr,C:Er,D:kr,E:jr,F:Br,G:Wr,H:qr,_byte:Gr,_word:Vr}=this;return Vr[0]=swap32(br),Vr[1]=swap32(wr),Vr[2]=swap32(Er),Vr[3]=swap32(kr),Vr[4]=swap32(jr),Vr[5]=swap32(Br),Vr[6]=swap32(Wr),Vr[7]=swap32(qr),Gr.slice(0,32)}}const W$1=new Int32Array(64);let sharedBuffer,sharedOffset=0;const hex32=fr=>(fr+4294967296).toString(16).substr(-8),swapLE=fr=>fr<<24&4278190080|fr<<8&16711680|fr>>8&65280|fr>>24&255,swapBE=fr=>fr,swap32=isBE()?swapBE:swapLE,ch=(fr,br,wr)=>wr^fr&(br^wr),maj=(fr,br,wr)=>fr&br|wr&(fr|br),sigma0=fr=>(fr>>>2|fr<<30)^(fr>>>13|fr<<19)^(fr>>>22|fr<<10),sigma1=fr=>(fr>>>6|fr<<26)^(fr>>>11|fr<<21)^(fr>>>25|fr<<7),gamma0=fr=>(fr>>>7|fr<<25)^(fr>>>18|fr<<14)^fr>>>3,gamma1=fr=>(fr>>>17|fr<<15)^(fr>>>19|fr<<13)^fr>>>10;function isBE(){return new Uint8Array(new Uint16Array([65279]).buffer)[0]===254}const stampHeaderName="X-Stamp-Webauthn",defaultTimeout=5*60*1e3,defaultUserVerification="preferred";class WebauthnStamper{constructor(br){this.rpId=br.rpId,this.timeout=br.timeout||defaultTimeout,this.userVerification=br.userVerification||defaultUserVerification,this.allowCredentials=br.allowCredentials||[]}async stamp(br){const wr=getChallengeFromPayload(br),Er={publicKey:{rpId:this.rpId,challenge:wr,allowCredentials:this.allowCredentials,timeout:this.timeout,userVerification:this.userVerification}},jr=(await get$2(Er)).toJSON(),Br={authenticatorData:jr.response.authenticatorData,clientDataJson:jr.response.clientDataJSON,credentialId:jr.id,signature:jr.response.signature};return{stampHeaderName,stampHeaderValue:JSON.stringify(Br)}}}function getChallengeFromPayload(fr){const br=createHash().update(fr).digest("hex");return new TextEncoder().encode(br)}var version$b="3.8.2";class WebauthnNotSupportedError extends Error{constructor(){super("Webauthn is not supported on this device")}}function __awaiter$b(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;function utf8StringToBuffer(fr){return new TextEncoder().encode(fr)}function bufferToBase64URLString(fr){const br=new Uint8Array(fr);let wr="";for(const kr of br)wr+=String.fromCharCode(kr);return btoa(wr).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function base64URLStringToBuffer(fr){const br=fr.replace(/-/g,"+").replace(/_/g,"/"),wr=(4-br.length%4)%4,Er=br.padEnd(br.length+wr,"="),kr=atob(Er),jr=new ArrayBuffer(kr.length),Br=new Uint8Array(jr);for(let Wr=0;WrBr.type==="public-key").length===0?new WebAuthnError({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:fr}):new WebAuthnError({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:fr});if(fr.name==="SecurityError"){const jr=window.location.hostname;if(isValidDomain(jr)){if(wr.rp.id!==jr)return new WebAuthnError({message:`The RP ID "${wr.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:fr})}else return new WebAuthnError({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:fr})}else if(fr.name==="TypeError"){if(wr.user.id.byteLength<1||wr.user.id.byteLength>64)return new WebAuthnError({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:fr})}else if(fr.name==="UnknownError")return new WebAuthnError({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:fr})}return fr}class BaseWebAuthnAbortService{createNewAbortSignal(){if(this.controller){const wr=new Error("Cancelling existing WebAuthn API call for new one");wr.name="AbortError",this.controller.abort(wr)}const br=new AbortController;return this.controller=br,br.signal}cancelCeremony(){if(this.controller){const br=new Error("Manually cancelling existing WebAuthn API call");br.name="AbortError",this.controller.abort(br),this.controller=void 0}}}const WebAuthnAbortService=new BaseWebAuthnAbortService,attachments=["cross-platform","platform"];function toAuthenticatorAttachment(fr){if(fr&&!(attachments.indexOf(fr)<0))return fr}async function startRegistration(fr){var Jr;if(!browserSupportsWebAuthn())throw new Error("WebAuthn is not supported in this browser");const wr={publicKey:{...fr,challenge:base64URLStringToBuffer(fr.challenge),user:{...fr.user,id:utf8StringToBuffer(fr.user.id)},excludeCredentials:(Jr=fr.excludeCredentials)==null?void 0:Jr.map(toPublicKeyCredentialDescriptor)}};wr.signal=WebAuthnAbortService.createNewAbortSignal();let Er;try{Er=await navigator.credentials.create(wr)}catch(Qr){throw identifyRegistrationError({error:Qr,options:wr})}if(!Er)throw new Error("Registration was not completed");const{id:kr,rawId:jr,response:Br,type:Wr}=Er;let qr;typeof Br.getTransports=="function"&&(qr=Br.getTransports());let Gr;if(typeof Br.getPublicKeyAlgorithm=="function")try{Gr=Br.getPublicKeyAlgorithm()}catch(Qr){warnOnBrokenImplementation("getPublicKeyAlgorithm()",Qr)}let Vr;if(typeof Br.getPublicKey=="function")try{const Qr=Br.getPublicKey();Qr!==null&&(Vr=bufferToBase64URLString(Qr))}catch(Qr){warnOnBrokenImplementation("getPublicKey()",Qr)}let Zr;if(typeof Br.getAuthenticatorData=="function")try{Zr=bufferToBase64URLString(Br.getAuthenticatorData())}catch(Qr){warnOnBrokenImplementation("getAuthenticatorData()",Qr)}return{id:kr,rawId:bufferToBase64URLString(jr),response:{attestationObject:bufferToBase64URLString(Br.attestationObject),clientDataJSON:bufferToBase64URLString(Br.clientDataJSON),transports:qr,publicKeyAlgorithm:Gr,publicKey:Vr,authenticatorData:Zr},type:Wr,clientExtensionResults:Er.getClientExtensionResults(),authenticatorAttachment:toAuthenticatorAttachment(Er.authenticatorAttachment)}}function warnOnBrokenImplementation(fr,br){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${fr}. You should report this error to them. -`,br)}const logger$3=new Logger$1("Webauthn"),createWebauthnCredential=fr=>__awaiter$b(void 0,void 0,void 0,function*(){if(!browserSupportsWebAuthn())throw new WebauthnNotSupportedError;let br;try{br=yield startRegistration(fr)}catch(wr){throw logger$3.debug("Failed to create webauthn credential",wr),wr}return br}),convertTransportEnumToTurnkeyEnum=fr=>{switch(fr){case"internal":return"AUTHENTICATOR_TRANSPORT_INTERNAL";case"usb":return"AUTHENTICATOR_TRANSPORT_USB";case"nfc":return"AUTHENTICATOR_TRANSPORT_NFC";case"ble":return"AUTHENTICATOR_TRANSPORT_BLE";case"hybrid":return"AUTHENTICATOR_TRANSPORT_HYBRID";default:throw new Error("unsupported transport format "+fr)}},getWebAuthnAttestationTurnkeyAdapter=fr=>__awaiter$b(void 0,void 0,void 0,function*(){var br,wr;if(!fr.publicKey)throw new Error("Invalid options. Public key attribute must be defined");const Er=Object.assign(Object.assign({},fr.publicKey),{challenge:bufferSourceToString(fr.publicKey.challenge),excludeCredentials:(br=fr.publicKey.excludeCredentials)===null||br===void 0?void 0:br.map(jr=>Object.assign(Object.assign({},jr),{id:bufferSourceToString(jr.id)})),user:Object.assign(Object.assign({},fr.publicKey.user),{id:bufferSourceToString(fr.publicKey.user.id)})}),kr=yield createWebauthnCredential(Er);return{attestationObject:kr.response.attestationObject,clientDataJson:kr.response.clientDataJSON,credentialId:kr.rawId,transports:((wr=kr.response.transports)===null||wr===void 0?void 0:wr.map(convertTransportEnumToTurnkeyEnum))||[]}}),bufferSourceToString=fr=>{if(fr instanceof ArrayBuffer)return bufferToBase64URLString(fr);{const br=new Uint8Array(fr.buffer,fr.byteOffset,fr.byteLength);return bufferToBase64URLString(br)}};assertPackageVersion("@dynamic-labs/webauthn",version$b);const createTurnkeyPasskeyService=()=>({createWebauthnStamper:fr=>new WebauthnStamper(fr),getWebAuthnAttestation:getWebAuthnAttestationTurnkeyAdapter});var _a,_PasskeyService_implementation;class PasskeyService{static get implementation(){return __classPrivateFieldGet$4(_a,_a,"f",_PasskeyService_implementation)?__classPrivateFieldGet$4(_a,_a,"f",_PasskeyService_implementation):createTurnkeyPasskeyService()}static set implementation(br){__classPrivateFieldSet$4(_a,_a,br,"f",_PasskeyService_implementation)}static get getWebAuthnAttestation(){return _a.implementation.getWebAuthnAttestation}static get createWebauthnStamper(){return _a.implementation.createWebauthnStamper}}_a=PasskeyService;_PasskeyService_implementation={value:void 0};const turnkeyBaseUrl$1="https://api.turnkey.com",turnkeyPasskeyRecoveryUrl="https://recovery.turnkey.com",turnkeyEmailRecoveryUrl="https://auth.turnkey.com",TURNKEY_RECOVERY_CREDENTIAL_EXPIRATION_SECONDS=900,TURNKEY_SESSION_EXPIRATION_SECONDS=1800,EMAIL_AUTH_CREDENTIAL_TYPE="CREDENTIAL_TYPE_API_KEY_P256",PASSKEY_RECOVERY_CREDENTIAL_TYPE="CREDENTIAL_TYPE_RECOVER_USER_KEY_P256";class TurnkeyAuthenticatorRecoveryHandler{constructor(){this.isSessionActive=()=>!this.__createdAt||this.__recoveryType!=="email"?!1:this.isExpired(this.__createdAt,this.__sessionExpiration||TURNKEY_SESSION_EXPIRATION_SECONDS)?(this.clear(),!1):!0,this.isValidCode=br=>__awaiter$c(this,void 0,void 0,function*(){var wr,Er,kr,jr;if(!br||!this.__turnkeyRecoveryUserId)throw new DynamicError("Cannot proceed with your request");const Br=yield(wr=this.__client)===null||wr===void 0?void 0:wr.getUser({organizationId:br,userId:this.__turnkeyRecoveryUserId}),Wr={email:EMAIL_AUTH_CREDENTIAL_TYPE,passkey:PASSKEY_RECOVERY_CREDENTIAL_TYPE},qr=(jr=(kr=(Er=Br==null?void 0:Br.user)===null||Er===void 0?void 0:Er.apiKeys)===null||kr===void 0?void 0:kr.filter(Vr=>Vr.credential.type===Wr[this.__recoveryType]))===null||jr===void 0?void 0:jr.pop();return!qr||this.isExpired(parseInt(qr.createdAt.seconds,10),TURNKEY_RECOVERY_CREDENTIAL_EXPIRATION_SECONDS)?!1:(this.__createdAt=parseInt(qr.createdAt.seconds,10),!0)}),this.isExpired=(br,wr)=>{const Er=br+wr,kr=new Date(Er*1e3);return new Date>=kr}}get publicKey(){return this.__publicKey}get client(){return this.__client}get recoveryType(){return this.__recoveryType}get recoveryUserId(){return this.__turnkeyRecoveryUserId||""}set recoveryUserId(br){this.__turnkeyRecoveryUserId=br}clear(){var br;(br=this.__iframeStamper)===null||br===void 0||br.clear(),this.__recoveryType=void 0,this.__iframeStamper=void 0,this.__publicKey=void 0,this.__client=void 0,this.__turnkeyRecoveryUserId=void 0,this.__createdAt=void 0}initRecovery(br,wr,Er,kr){return __awaiter$c(this,void 0,void 0,function*(){this.__recoveryType&&this.clear(),this.__sessionExpiration=kr,this.__recoveryType=br;const jr=br==="passkey"?turnkeyPasskeyRecoveryUrl:turnkeyEmailRecoveryUrl;return this.__iframeStamper=new IframeStamper({iframeContainer:wr,iframeElementId:Er,iframeUrl:jr}),yield this.__iframeStamper.init(),this.__publicKey=this.__iframeStamper.publicKey(),this.__publicKey})}verifyRecoveryCode(br,wr){return __awaiter$c(this,void 0,void 0,function*(){if(!this.__iframeStamper)throw new DynamicError("Cannot proceed with your request");try{if(yield this.__iframeStamper.injectCredentialBundle(br),this.__client=new TurnkeyClient({baseUrl:turnkeyBaseUrl$1},this.__iframeStamper),!wr||!this.__turnkeyRecoveryUserId)throw new DynamicError("Cannot proceed with your request");if(!(yield this.isValidCode(wr)))throw new DynamicError("The code is invalid or expired.")}catch(Er){throw logger$4.error("Error while verifying recovery code",Er),Er instanceof DynamicError?Er:new DynamicError("The code is invalid or expired.")}})}completeRecovery(br){return __awaiter$c(this,arguments,void 0,function*({attestation:wr,challenge:Er,turnkeySubOrganizationId:kr}){if(!this.__client||!this.__turnkeyRecoveryUserId)throw new DynamicError("Cannot proceed with your request");try{return this.__client.recoverUser({organizationId:kr,parameters:{authenticator:{attestation:wr,authenticatorName:"Passkey",challenge:Er},userId:this.__turnkeyRecoveryUserId},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_RECOVER_USER"})}catch(jr){throw logger$4.error("[TK] Error while completing recovery process",jr),jr}})}addPasskeyAuthenticator(br){return __awaiter$c(this,arguments,void 0,function*({attestation:wr,challenge:Er,turnkeySubOrganizationId:kr}){if(!this.__client||!this.__turnkeyRecoveryUserId)throw new DynamicError("Cannot proceed with your request");try{return this.__client.createAuthenticators({organizationId:kr,parameters:{authenticators:[{attestation:wr,authenticatorName:"Passkey",challenge:Er}],userId:this.__turnkeyRecoveryUserId},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2"})}catch(jr){throw logger$4.error("[TK] Error while creating new authenticator",jr),jr}})}addEmailRecovery(br){return __awaiter$c(this,arguments,void 0,function*({organizationId:wr,email:Er,turnkeyUserId:kr}){let jr=getTLD();jr||(jr=PlatformService.getHostname());const Br=PasskeyService.createWebauthnStamper({rpId:jr}),Wr=new TurnkeyClient({baseUrl:turnkeyBaseUrl$1},Br);try{return{signedRequest:yield Wr.stampUpdateUser({organizationId:wr,parameters:{userEmail:Er,userId:kr,userTagIds:[]},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_UPDATE_USER"}),userId:kr}}catch(qr){throw logger$4.error("Error while adding email recovery",qr),qr}})}}const turnkeyAuthenticatorRecoveryHandler=new TurnkeyAuthenticatorRecoveryHandler,turnkeyBaseUrl="https://api.turnkey.com",turnkeyExportUrl="https://export.turnkey.com";class ExportHandler{get publicKey(){return this.__publicKey}clear(){var br;(br=this.__iframeStamper)===null||br===void 0||br.clear(),this.__iframeStamper=void 0,this.__publicKey=void 0,this.__turnkeyClient=void 0}initExport(br,wr){return __awaiter$c(this,void 0,void 0,function*(){if(this.__iframeStamper=new IframeStamper({iframeContainer:br,iframeElementId:wr,iframeUrl:turnkeyExportUrl}),yield this.__iframeStamper.init(),this.__publicKey=this.__iframeStamper.publicKey(),turnkeyAuthenticatorRecoveryHandler.isSessionActive())this.__turnkeyClient=turnkeyAuthenticatorRecoveryHandler.client;else{let Er=getTLD();Er||(Er=PlatformService.getHostname());const kr=PasskeyService.createWebauthnStamper({rpId:Er}),jr=ExportHandler==null?void 0:ExportHandler.apiKeyStamper,Br=jr??kr;this.__turnkeyClient=new TurnkeyClient({baseUrl:turnkeyBaseUrl},Br)}return this.__publicKey})}verifyExportWallet(br){return __awaiter$c(this,arguments,void 0,function*({exportBundle:wr,organizationId:Er}){if(!this.__iframeStamper)throw new DynamicError("Cannot proceed with your request");try{return yield this.__iframeStamper.injectWalletExportBundle(wr,Er)}catch(kr){throw logger$4.error("Error while verifying export wallet",kr),kr}})}verifyExportPrivateKey(br){return __awaiter$c(this,arguments,void 0,function*({exportBundle:wr,organizationId:Er,chain:kr}){if(!this.__iframeStamper)throw new DynamicError("Cannot proceed with your request");const jr=kr==="solana"||kr==="SOL"?KeyFormat.Solana:KeyFormat.Hexadecimal;try{return yield this.__iframeStamper.injectKeyExportBundle(wr,Er,jr)}catch(Br){throw logger$4.error("Error while verifying export private key",Br),Br}})}exportPrivateKey(br){return __awaiter$c(this,arguments,void 0,function*({privateKeyId:wr,organizationId:Er}){const kr=ExportHandler==null?void 0:ExportHandler.apiKeyStamper;if(kr&&(this.__turnkeyClient=new TurnkeyClient({baseUrl:turnkeyBaseUrl},kr)),!this.__iframeStamper||!this.__publicKey||!this.__turnkeyClient||!wr)throw new DynamicError("Cannot proceed with your request");try{return(yield this.__turnkeyClient.exportPrivateKey({organizationId:Er,parameters:{privateKeyId:wr,targetPublicKey:this.__publicKey},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_EXPORT_PRIVATE_KEY"})).activity}catch(jr){throw logger$4.error("[TK] Error while completing export private key process",jr),jr}})}exportWallet(br){return __awaiter$c(this,arguments,void 0,function*({walletId:wr,organizationId:Er,address:kr}){const jr=ExportHandler==null?void 0:ExportHandler.apiKeyStamper;if(jr&&(this.__turnkeyClient=new TurnkeyClient({baseUrl:turnkeyBaseUrl},jr)),!this.__iframeStamper||!this.__publicKey||!this.__turnkeyClient||!wr)throw new DynamicError("Cannot proceed with your request");try{return kr?(yield this.__turnkeyClient.exportWalletAccount({organizationId:Er,parameters:{address:kr,targetPublicKey:this.__publicKey},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT"})).activity:(yield this.__turnkeyClient.exportWallet({organizationId:Er,parameters:{targetPublicKey:this.__publicKey,walletId:wr},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_EXPORT_WALLET"})).activity}catch(Br){throw logger$4.error("[TK] Error while completing export wallet process",Br),Br}})}}class TurnkeyWalletConnectorBase extends WalletConnectorBase{constructor(br,wr){if(super(wr),this.requiresNonDynamicEmailOtp=!1,this.isEmbeddedWallet=!0,this.removeSessionKeys=()=>__awaiter$c(this,void 0,void 0,function*(){TurnkeyWalletConnectorBase.sessionKeys=void 0,TurnkeyWalletConnectorBase.apiKeyStamper=void 0,ExportHandler.apiKeyStamper=void 0,typeof(this===null||this===void 0?void 0:this.removeSessionKeysFunction)=="function"&&this.removeSessionKeysFunction()}),!wr.appName)throw new Error("appName not set");this.name=br.name,this.overrideKey=br.key,this.appName=wr.appName,this.__authenticatorMethodHandler=turnkeyAuthenticatorRecoveryHandler,this.__exportHandler=new ExportHandler}getWebAuthnAttestation(){return __awaiter$c(this,void 0,void 0,function*(){const br=generateRandomBuffer(),wr=generateRandomBuffer(),{email:Er,passkeyIdentifier:kr}=this;if(!Er&&!kr)throw new Error("Email or passkeyIdentifier must be set to register a webauthn credential.");const jr=Er||`${this.appName} - ${kr}`,Br={publicKey:{authenticatorSelection:{authenticatorAttachment:void 0,requireResidentKey:!1,residentKey:"preferred",userVerification:"discouraged"},challenge:br,pubKeyCredParams:[{alg:-7,type:"public-key"}],rp:{id:getTLD(),name:this.appName},user:{displayName:jr,id:wr,name:Er||`${this.appName} - ${kr}`}}};let Wr;try{Wr=yield PasskeyService.getWebAuthnAttestation(Br)}catch(qr){logger$4.warn(`Unable to register webauthn credential on the current page's TLD ${getTLD()}. Falling back to using hostname. ${PlatformService.getHostname()}`,qr),Br.publicKey.rp.id=PlatformService.getHostname(),Wr=yield PasskeyService.getWebAuthnAttestation(Br)}return{attestation:{attestationObject:Wr.attestationObject,clientDataJson:Wr.clientDataJson,credentialId:Wr.credentialId,transports:convertAttestationTransports(Wr.transports)},challenge:base64UrlEncode(br),displayName:jr}})}getAuthenticatorHandler(){return this.__authenticatorMethodHandler}getExportHandler(){return this.__exportHandler}get email(){return this._email}setEmail(br){this._email=br}get phone(){return this._phone}setPhone(br){this._phone=br}get passkeyIdentifier(){return this._passkeyIdentifier}setPasskeyIdentifier(br){this._passkeyIdentifier=br}clearEmail(){this._email=null}getAddress(){return __awaiter$c(this,void 0,void 0,function*(){var br;return(br=this.verifiedCredential)===null||br===void 0?void 0:br.address})}getConnectedAccounts(){return __awaiter$c(this,void 0,void 0,function*(){return(this.verifiedCredentials||[]).map(Er=>Er==null?void 0:Er.address).filter(Er=>typeof Er=="string")})}get turnkeyAddress(){var br;const{address:wr}=(br=this.verifiedCredential)!==null&&br!==void 0?br:{};return wr}get walletProperties(){const{walletProperties:br}=this.verifiedCredential||{};return br}set verifiedCredentials(br){this._verifiedCredentials=br}get verifiedCredentials(){return this._verifiedCredentials}set verifiedCredential(br){this._verifiedCredential=br}get verifiedCredential(){return this._verifiedCredential}setSessionKeyFetcher(br){this.createOrRestoreSessionFetcherFunction=br}setSessionKeyRemoveFunction(br){this.removeSessionKeysFunction=br}createOrRestoreSession(){return __awaiter$c(this,arguments,void 0,function*({ignoreRestore:br}={}){if(!this.isSessionKeyCompatible()||TurnkeyWalletConnectorBase.isLoadingSession)return;if(!this.createOrRestoreSessionFetcherFunction)throw new DynamicError("Cannot register session key to init provider");const{sessionKeys:wr}=TurnkeyWalletConnectorBase;if(wr!=null&&wr.publicKey&&!(new Date>=new Date(wr.expirationDate)))return wr.publicKey;try{TurnkeyWalletConnectorBase.isLoadingSession=!0;const Er=yield this.createOrRestoreSessionFetcherFunction({ignoreRestore:br});return TurnkeyWalletConnectorBase.sessionKeys=Er,TurnkeyWalletConnectorBase.apiKeyStamper=new ApiKeyStamper({apiPrivateKey:Er.privateKey,apiPublicKey:Er.publicKey}),ExportHandler.apiKeyStamper=TurnkeyWalletConnectorBase.apiKeyStamper,logger$4.setMetaData("sessionApiPublicKey",Er.publicKey),Er.publicKey}catch{throw new DynamicError("Failed to create or restore session")}finally{TurnkeyWalletConnectorBase.isLoadingSession=!1}})}isSessionKeyCompatible(){var br;const wr=(br=this.verifiedCredential)===null||br===void 0?void 0:br.walletProperties;return!!(wr==null?void 0:wr.isSessionKeyCompatible)}isSessionActive(){return __awaiter$c(this,void 0,void 0,function*(){return!!((yield this.getAddress())&&TurnkeyWalletConnectorBase.sessionKeys&&TurnkeyWalletConnectorBase.apiKeyStamper)})}get sessionKeys(){return TurnkeyWalletConnectorBase.sessionKeys}setLoggerMetadata(){var br,wr,Er;logger$4.setMetaData("turnkeySubOrganizationId",(wr=(br=this._verifiedCredential)===null||br===void 0?void 0:br.walletProperties)===null||wr===void 0?void 0:wr.turnkeySubOrganizationId),logger$4.setMetaData("walletId",(Er=this._verifiedCredential)===null||Er===void 0?void 0:Er.id);let kr="Unknown";this.isSessionKeyCompatible()?kr="SessionKeys":this.__authenticatorMethodHandler.recoveryType==="passkey"?kr="Passkey":this.__authenticatorMethodHandler.recoveryType==="email"&&(kr="EmailAuth"),logger$4.setMetaData("authMethod",kr)}}TurnkeyWalletConnectorBase.isLoadingSession=!1;const TurnkeyWalletConnectorInfo={Turnkey:{key:"turnkey",name:"Turnkey"},TurnkeyHD:{key:"turnkeyhd",name:"Turnkey HD"}},findTurnkeyVerifiedCredentials=(fr,br)=>fr==null?void 0:fr.filter(({walletName:wr,chain:Er})=>(wr==null?void 0:wr.startsWith("turnkey"))&&br===Er),findTurnkeyVerifiedCredentialsWithSmartWalletRef=(fr,br)=>fr==null?void 0:fr.reduce((wr,Er)=>{var kr;if(!((kr=Er.walletName)===null||kr===void 0)&&kr.startsWith("turnkey")&&br===Er.chain){const jr=fr.find(qr=>qr.signerRefId===Er.id),Br=jr==null?void 0:jr.id,Wr=jr==null?void 0:jr.address;wr.push(Object.assign(Object.assign({},Er),{smartWalletRefAddress:Wr,smartWalletRefId:Br}))}return wr},[]);assertPackageVersion("@dynamic-labs/embedded-wallet",version$c);function __awaiter$a(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,br||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;async function createAccount(fr){var jr;const{client:br,organizationId:wr,signWith:Er}=fr;let{ethereumAddress:kr}=fr;if(!Er)throw new TurnkeyActivityError({message:"Missing signWith parameter"});if(isAddress(Er))kr=Er;else if(!kr&&(kr=(jr=(await br.getPrivateKey({privateKeyId:Er,organizationId:wr})).privateKey.addresses.find(Wr=>Wr.format==="ADDRESS_FORMAT_ETHEREUM"))==null?void 0:jr.address,typeof kr!="string"||!kr))throw new TurnkeyActivityError({message:`Unable to find Ethereum address for key ${Er} under organization ${wr}`});return toAccount({address:kr,signMessage:function({message:Br}){return signMessage(br,Br,wr,Er)},signTransaction:function(Br,Wr){const qr=Wr!=null&&Wr.serializer?Wr.serializer:serializeTransaction$4;return signTransaction(br,Br,qr,wr,Er)},signTypedData:function(Br){return signTypedData(br,Br,wr,Er)}})}async function signMessage(fr,br,wr,Er){const kr=hashMessage(br);return`${await signMessageWithErrorWrapping(fr,kr,wr,Er)}`}async function signTransaction(fr,br,wr,Er,kr){const Br=wr(br).replace(/^0x/,"");return await signTransactionWithErrorWrapping(fr,Br,Er,kr)}async function signTypedData(fr,br,wr,Er){const kr=hashTypedData(br);return await signMessageWithErrorWrapping(fr,kr,wr,Er)}async function signTransactionWithErrorWrapping(fr,br,wr,Er){let kr;try{kr=await signTransactionImpl(fr,br,wr,Er)}catch(jr){throw jr instanceof TurnkeyActivityError?jr:new TurnkeyActivityError({message:`Failed to sign transaction: ${jr.message}`,cause:jr})}return`0x${kr}`}async function signTransactionImpl(fr,br,wr,Er){var kr,jr;if(fr instanceof TurnkeyClient){const{activity:Br}=await fr.signTransaction({type:"ACTIVITY_TYPE_SIGN_TRANSACTION_V2",organizationId:wr,parameters:{signWith:Er,type:"TRANSACTION_TYPE_ETHEREUM",unsignedTransaction:br},timestampMs:String(Date.now())}),{id:Wr,status:qr,type:Gr}=Br;if(Br.status!=="ACTIVITY_STATUS_COMPLETED")throw new TurnkeyActivityError({message:`Invalid activity status: ${Br.status}`,activityId:Wr,activityStatus:qr,activityType:Gr});return assertNonNull((jr=(kr=Br==null?void 0:Br.result)==null?void 0:kr.signTransactionResult)==null?void 0:jr.signedTransaction)}else{const Br=await fr.signTransaction({signWith:Er,type:"TRANSACTION_TYPE_ETHEREUM",unsignedTransaction:br});return assertNonNull(Br==null?void 0:Br.signedTransaction)}}async function signMessageWithErrorWrapping(fr,br,wr,Er){let kr;try{kr=await signMessageImpl(fr,br,wr,Er)}catch(jr){throw jr instanceof TurnkeyActivityError?jr:new TurnkeyActivityError({message:`Failed to sign: ${jr.message}`,cause:jr})}return kr}async function signMessageImpl(fr,br,wr,Er){var Br;let kr;if(fr instanceof TurnkeyClient){const{activity:Wr}=await fr.signRawPayload({type:"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",organizationId:wr,parameters:{signWith:Er,payload:br,encoding:"PAYLOAD_ENCODING_HEXADECIMAL",hashFunction:"HASH_FUNCTION_NO_OP"},timestampMs:String(Date.now())}),{id:qr,status:Gr,type:Vr}=Wr;if(Gr!=="ACTIVITY_STATUS_COMPLETED")throw new TurnkeyActivityError({message:`Invalid activity status: ${Wr.status}`,activityId:qr,activityStatus:Gr,activityType:Vr});kr=assertNonNull((Br=Wr==null?void 0:Wr.result)==null?void 0:Br.signRawPayloadResult)}else kr=await fr.signRawPayload({signWith:Er,payload:br,encoding:"PAYLOAD_ENCODING_HEXADECIMAL",hashFunction:"HASH_FUNCTION_NO_OP"});let jr=serializeSignature({r:`0x${kr.r}`,s:`0x${kr.s}`,v:kr.v==="00"?27n:28n});return assertNonNull(jr)}function assertNonNull(fr){if(fr==null)throw new Error(`Got unexpected ${JSON.stringify(fr)}`);return fr}var version$a="3.8.2";function __awaiter$9(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,br||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;const logger$2=new Logger$1("ethereum-core"),gasPriceOracleAbiAddress="0x420000000000000000000000000000000000000F",gasPriceOracleAbi=[{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"getL1Fee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}],estimateL1Fee$1=(fr,br)=>__awaiter$9(void 0,void 0,void 0,function*(){const wr=serializeTransaction$4(Object.assign(Object.assign({chainId:fr.chain.id},br),{type:br.type?br.type:"eip1559"}));return fr.readContract({abi:gasPriceOracleAbi,address:gasPriceOracleAbiAddress,args:[wr],functionName:"getL1Fee"})}),opStackSupportedChains=[optimism.id,optimismGoerli.id,optimismSepolia.id,base$7.id,baseGoerli.id,baseSepolia$1.id],chainsMap=Object.values(viemChains).reduce((fr,br)=>Object.assign(Object.assign({},fr),{[br.id]:br}),{}),erc20Abi=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}];class Eip1559FeeFeed{constructor({publicClient:br,initialGasLimit:wr,initialMaxFeePerGas:Er}){this.fee={gas:BigInt(0)},this.publicClient=br,this.initialGasLimit=wr,this.initialMaxFeePerGas=Er}fetchFee(){return __awaiter$9(this,void 0,void 0,function*(){try{const br=yield this.estimateL1Fee();if(this.initialGasLimit&&this.initialMaxFeePerGas){this.fee.gas=this.initialGasLimit*this.initialMaxFeePerGas+br;return}const wr=yield this.estimateGas();if(this.initialMaxFeePerGas){this.fee.gas=wr*this.initialMaxFeePerGas+br;return}const Er=yield this.publicClient.estimateFeesPerGas();if(!Er||!Er.maxFeePerGas)return;this.fee.gas=wr*Er.maxFeePerGas+br,this.maxFeePerGas=Er.maxFeePerGas,this.maxPriorityFeePerGas=Er.maxPriorityFeePerGas}catch(br){logger$2.debug(br);return}})}}const estimateL1Fee=(fr,br)=>__awaiter$9(void 0,void 0,void 0,function*(){const{chain:wr}=fr;if(!wr)throw new Error("Chain is not defined");const Er=fr;if(opStackSupportedChains.includes(wr.id))return estimateL1Fee$1(Er,br);throw new Error("Chain is not supported")}),estimateL1FeeSupportedChains=[...opStackSupportedChains],isL1FeeSupportedByChain=fr=>estimateL1FeeSupportedChains.includes(fr),validateAddressFormat=fr=>/^0x[0-9a-fA-F]{40}$/.test(fr),parseEther=fr=>parseEther$1(fr,"wei"),formatEther=(fr,{precision:br}={})=>formatNumberText(formatEther$1(fr),{precision:br});class ViemUiTransaction extends Eip1559FeeFeed{constructor({transaction:br,onSubmit:wr,publicClient:Er,account:kr}){super({initialGasLimit:br.gas,initialMaxFeePerGas:br.maxFeePerGas,publicClient:Er}),this.chain="EVM",this.validateAddressFormat=validateAddressFormat,this.parse=parseEther,this.parseNonNativeToken=(jr,Br)=>parseUnits(jr,Br),this.format=formatEther,this.formatNonNativeToken=(jr,Br)=>formatUnits(jr,Br),this.transaction=br,this.onSubmit=wr,this.publicClient=Er,this.address=kr}get to(){return this.transaction.to||void 0}set to(br){this.transaction.to=br}get from(){return this.address}get value(){return this.transaction.value}set value(br){this.transaction.value=br}get nonNativeValue(){return this.transaction.nonNativeValue}set nonNativeValue(br){this.transaction.nonNativeValue=br}get nonNativeAddress(){return this.transaction.nonNativeAddress}set nonNativeAddress(br){this.transaction.nonNativeAddress=br}get nonNativeDecimal(){return this.transaction.nonNativeDecimal}set nonNativeDecimal(br){this.transaction.nonNativeDecimal=br}get data(){return this.transaction.data}submit(){return __awaiter$9(this,void 0,void 0,function*(){return this.onSubmit(this.transaction).catch(br=>{throw br instanceof UserRejectedTransactionError?new TransactionExecutionError(new BaseError(br.message),this.transaction):br})})}getBalance(){return this.publicClient.getBalance({address:this.address})}estimateGas(){return __awaiter$9(this,void 0,void 0,function*(){const br=yield this.publicClient.transport.request({method:"eth_estimateGas",params:[{data:this.data,to:this.to,value:this.convertBigIntToHex(this.value)}]});return hexToBigInt(br)})}convertBigIntToHex(br){return br?toHex(br):void 0}estimateL1Fee(){return __awaiter$9(this,void 0,void 0,function*(){var br;return isL1FeeSupportedByChain(((br=this.publicClient.chain)===null||br===void 0?void 0:br.id)||0)?estimateL1Fee(this.publicClient,{data:this.transaction.data,to:this.transaction.to,value:this.transaction.value}):BigInt(0)})}set maxFeePerGas(br){this.transaction.maxFeePerGas=br}set maxPriorityFeePerGas(br){this.transaction.maxPriorityFeePerGas=br}}const createViemUiTransaction=fr=>__awaiter$9(void 0,[fr],void 0,function*({from:br,publicClient:wr,walletClient:Er}){return new ViemUiTransaction({account:br,onSubmit:kr=>__awaiter$9(void 0,void 0,void 0,function*(){return kr.nonNativeAddress?Er.writeContract({abi:erc20Abi,account:br,address:kr.nonNativeAddress,args:[kr.to,kr.nonNativeValue],functionName:"transfer",maxFeePerGas:kr.maxFeePerGas,maxPriorityFeePerGas:kr.maxPriorityFeePerGas}):Er.sendTransaction({account:br,maxFeePerGas:kr.maxFeePerGas,maxPriorityFeePerGas:kr.maxPriorityFeePerGas,to:kr.to,value:kr.value})}),publicClient:wr,transaction:{}})}),getChain=fr=>{for(const br of Object.values(viemChains))if("id"in br&&br.id===fr)return br;throw new Error(`Chain with id ${fr} not found`)},mapChain=fr=>{var br;return{blockExplorers:!((br=fr.blockExplorerUrls)===null||br===void 0)&&br[0]?{default:{name:fr.blockExplorerUrls[0],url:fr.blockExplorerUrls[0]}}:void 0,id:fr.chainId,name:fr.vanityName||fr.name||fr.chainName,nativeCurrency:fr.nativeCurrency,rpcUrls:{default:{http:fr.rpcUrls},public:{http:fr.rpcUrls}}}},getOrMapViemChain=fr=>{let br;try{br=getChain(fr.chainId)}catch{logger$2.debug(`Chain with id ${fr.chainId} not found in viem's chains`)}const wr=mapChain(fr);return br?Object.assign(Object.assign({},br),wr):wr},findEvmNetwork=({chainId:fr,name:br,networks:wr})=>{if(!(!fr&&!br))return fr&&br?wr.find(Er=>Er.chainId===fr&&Er.name===br):fr?wr.find(Er=>Er.chainId===fr):wr.find(Er=>Er.name===br)};var L2ResolverAbi=[{inputs:[{internalType:"contract ENS",name:"ens_",type:"address"},{internalType:"address",name:"registrarController_",type:"address"},{internalType:"address",name:"reverseRegistrar_",type:"address"},{internalType:"address",name:"owner_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AlreadyInitialized",type:"error"},{inputs:[],name:"CantSetSelfAsDelegate",type:"error"},{inputs:[],name:"CantSetSelfAsOperator",type:"error"},{inputs:[],name:"NewOwnerIsZeroAddress",type:"error"},{inputs:[],name:"NoHandoverRequest",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"uint256",name:"contentType",type:"uint256"}],name:"ABIChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"a",type:"address"}],name:"AddrChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"coinType",type:"uint256"},{indexed:!1,internalType:"bytes",name:"newAddress",type:"bytes"}],name:"AddressChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"address",name:"delegate",type:"address"},{indexed:!0,internalType:"bool",name:"approved",type:"bool"}],name:"Approved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"hash",type:"bytes"}],name:"ContenthashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"uint16",name:"resource",type:"uint16"},{indexed:!1,internalType:"bytes",name:"record",type:"bytes"}],name:"DNSRecordChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"uint16",name:"resource",type:"uint16"}],name:"DNSRecordDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"lastzonehash",type:"bytes"},{indexed:!1,internalType:"bytes",name:"zonehash",type:"bytes"}],name:"DNSZonehashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"bytes4",name:"interfaceID",type:"bytes4"},{indexed:!1,internalType:"address",name:"implementer",type:"address"}],name:"InterfaceChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"string",name:"name",type:"string"}],name:"NameChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"pendingOwner",type:"address"}],name:"OwnershipHandoverCanceled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"pendingOwner",type:"address"}],name:"OwnershipHandoverRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"x",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"y",type:"bytes32"}],name:"PubkeyChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newRegistrarController",type:"address"}],name:"RegistrarControllerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newReverseRegistrar",type:"address"}],name:"ReverseRegistrarUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"string",name:"indexedKey",type:"string"},{indexed:!1,internalType:"string",name:"key",type:"string"},{indexed:!1,internalType:"string",name:"value",type:"string"}],name:"TextChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint64",name:"newVersion",type:"uint64"}],name:"VersionChanged",type:"event"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentTypes",type:"uint256"}],name:"ABI",outputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"addr",outputs:[{internalType:"address payable",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"}],name:"addr",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"delegate",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"cancelOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"clearRecords",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"pendingOwner",type:"address"}],name:"completeOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"contenthash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"name",type:"bytes32"},{internalType:"uint16",name:"resource",type:"uint16"}],name:"dnsRecord",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[],name:"ens",outputs:[{internalType:"contract ENS",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"name",type:"bytes32"}],name:"hasDNSRecords",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"interfaceImplementer",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"delegate",type:"address"}],name:"isApprovedFor",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"nodehash",type:"bytes32"},{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicallWithNodeCheck",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"pendingOwner",type:"address"}],name:"ownershipHandoverExpiresAt",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"pubkey",outputs:[{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"recordVersions",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"registrarController",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"requestOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"",type:"bytes"},{internalType:"bytes",name:"data",type:"bytes"}],name:"resolve",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[],name:"reverseRegistrar",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentType",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"setABI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"},{internalType:"bytes",name:"a",type:"bytes"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"a",type:"address"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"hash",type:"bytes"}],name:"setContenthash",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"data",type:"bytes"}],name:"setDNSRecords",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"},{internalType:"address",name:"implementer",type:"address"}],name:"setInterface",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"newName",type:"string"}],name:"setName",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],name:"setPubkey",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"registrarController_",type:"address"}],name:"setRegistrarController",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"reverseRegistrar_",type:"address"}],name:"setReverseRegistrar",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"},{internalType:"string",name:"value",type:"string"}],name:"setText",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"hash",type:"bytes"}],name:"setZonehash",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"}],name:"text",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"zonehash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"}];const getNameservice=fr=>__awaiter$9(void 0,[fr],void 0,function*({rpcProvider:br,address:wr}){const Er={avatar:void 0,name:void 0},kr=yield br.getChainId();if(!kr)return Er;const jr=(Wr,qr)=>{const Gr=Wr.toLocaleLowerCase(),Vr=keccak256(Gr.substring(2)),Zr=Br(qr),Jr=namehash(`${Zr.toLocaleUpperCase()}.reverse`);return keccak256(encodePacked(["bytes32","bytes32"],[Jr,Vr]))},Br=Wr=>((2147483648|Wr)>>>0).toString(16).toLocaleUpperCase();if(kr===8453){const Wr=jr(wr,8453);try{const qr=yield br.readContract({abi:L2ResolverAbi,address:"0xC6d566A56A1aFf6508b41f6c90ff131615583BCD",args:[Wr],functionName:"name"});if(qr)return Er.name=qr,Er}catch{return Er}}else Er.name=yield br.getEnsName({address:wr}),Er.avatar=Er.name?yield br.getEnsAvatar({name:Er.name}):void 0;return Er}),isTransactionExecutionError=fr=>fr!=null&&typeof fr=="object"&&"walk"in fr&&typeof fr.walk=="function",interceptTransport=({getAccounts:fr,onPersonalSign:br,onSendTransaction:wr,onSignTypedData:Er,transport:kr})=>jr=>{const Br=kr(jr);return custom({request:Wr=>__awaiter$9(void 0,void 0,void 0,function*(){var qr;const{method:Gr,params:Vr}=Wr;if(fr&&Gr==="eth_accounts")return fr({provider:Br});if(br&&Gr==="personal_sign"){const[Zr]=Vr;return br({args:Wr,message:Zr,provider:Br}).catch(Jr=>{throw Jr instanceof UserRejectedRequestError$1?new UserRejectedRequestError(Jr):Jr})}if(wr&&Gr==="eth_sendTransaction"){const[Zr]=Vr;return wr({args:Wr,provider:Br,transaction:Zr}).catch(Jr=>{throw isTransactionExecutionError(Jr)&&Jr.walk()instanceof UserRejectedTransactionError?new UserRejectedRequestError(Jr.walk()):Jr instanceof UserRejectedRequestError$1?new UserRejectedRequestError(Jr):Jr})}if(Er&&Gr==="eth_signTypedData_v4"){const[,Zr]=(qr=Vr)!==null&&qr!==void 0?qr:[];return Er({args:Wr,message:Zr,provider:Br}).catch(Jr=>{throw Jr instanceof UserRejectedRequestError$1?new UserRejectedRequestError(Jr):Jr})}return Br.request(Wr)})})(jr)};class EthereumWallet extends Wallet$2{getPublicClient(){return __awaiter$9(this,void 0,void 0,function*(){const br=yield this._connector.getPublicClient();if(!br)throw new Error("Unable to retrieve PublicClient");return br})}getWalletClient(br){return __awaiter$9(this,void 0,void 0,function*(){const wr=this._connector.getWalletClient(br);if(!wr)throw new Error("Unable to retrieve WalletClient");return createWalletClient({account:this.address,chain:wr.chain,transport:interceptTransport({onPersonalSign:Er=>__awaiter$9(this,[Er],void 0,function*({provider:kr,args:jr}){return yield this.sync(),kr.request(jr)}),onSendTransaction:Er=>__awaiter$9(this,[Er],void 0,function*({provider:kr,args:jr}){return yield this.sync(),kr.request(jr)}),onSignTypedData:Er=>__awaiter$9(this,[Er],void 0,function*({provider:kr,args:jr}){return yield this.sync(),kr.request(jr)}),transport:custom(wr.transport)})})})}}class EthereumWalletConnector extends WalletConnectorBase{getPublicClient(){return __awaiter$9(this,void 0,void 0,function*(){var br,wr;const Er=(br=yield this.getNetwork())!==null&&br!==void 0?br:1;if(this.evmNetworks.length===0)return;const kr={cosmos:[],evm:this.evmNetworks,solana:[],starknet:void 0};if(!this.chainRpcProviders)return;const jr=this.chainRpcProviders.getProviders(kr);return(wr=this.chainRpcProviders.getEvmProviderByChainId(jr,Er))===null||wr===void 0?void 0:wr.provider})}constructor(br){var wr;super(br),this.ChainWallet=EthereumWallet,this.evmNetworkRpcMap=()=>this.evmNetworks.reduce((Er,kr)=>{var jr;return[Er[kr.chainId]]=!((jr=kr==null?void 0:kr.privateCustomerRpcUrls)===null||jr===void 0)&&jr.length?kr.privateCustomerRpcUrls:kr.rpcUrls,Er},{}),this.evmNetworks=parseEvmNetworks(br.evmNetworks),this.chainRpcProviders=br.chainRpcProviders,(wr=this.chainRpcProviders)===null||wr===void 0||wr.registerEvmProviders()}getNetwork(){return __awaiter$9(this,void 0,void 0,function*(){const br=this.getWalletClient();if(!this.supportsNetworkSwitching||!br)return Promise.resolve(void 0);const wr=yield retryableFn(br.getChainId,{fallbackValue:FALLBACK_UNDEFINED,timeoutMs:1e3});return this.setActiveChain(chainsMap[wr]),wr})}getNameService(br){return __awaiter$9(this,void 0,void 0,function*(){const wr=yield this.getPublicClient();if(wr)return getNameservice({address:br,rpcProvider:wr})})}isTestnet(){return __awaiter$9(this,void 0,void 0,function*(){var br,wr,Er;return(Er=(wr=(br=yield this.getPublicClient())===null||br===void 0?void 0:br.chain)===null||wr===void 0?void 0:wr.testnet)!==null&&Er!==void 0?Er:!1})}parseAddress(br){try{return getAddress(br)}catch(wr){logger$7.debug(`Failed to parse EVM address into EIP55 format: error getting checksum, returning default ${br}`,wr)}return br}getSigner(){return __awaiter$9(this,void 0,void 0,function*(){return this.getWalletClient()})}getBalance(br){return __awaiter$9(this,void 0,void 0,function*(){const wr=yield this.getPublicClient(),Er=yield wr==null?void 0:wr.getBalance({address:br});if(!(!Er&&Er!==BigInt(0)))return formatEther$1(Er)})}supportsNetworkSwitching(){return!0}switchNetwork(br){return __awaiter$9(this,arguments,void 0,function*({networkName:wr,networkChainId:Er}){const kr=findEvmNetwork({chainId:Er,name:wr,networks:this.evmNetworks});if(!kr)throw new DynamicError(`Could not find network mapping for chain ${wr||Er}`);if(!this.supportsNetworkSwitching())throw new DynamicError("Network switching is not supported");const jr=this.getWalletClient();if(!jr)throw new DynamicError("Provider not found");return this.providerSwitchNetwork({network:kr,provider:jr})})}chooseAccountsToConnect(){return __awaiter$9(this,void 0,void 0,function*(){var br,wr,Er;const kr=this.getWalletClient();if(!kr)return[];try{const jr=yield kr.requestPermissions({eth_accounts:{}});logger$7.debug("chooseAccountsToConnect - requestPermissions result",jr);const Br=(Er=(wr=(br=jr==null?void 0:jr.find(Wr=>Wr.parentCapability==="eth_accounts"))===null||br===void 0?void 0:br.caveats)===null||wr===void 0?void 0:wr[0])===null||Er===void 0?void 0:Er.value;return typeof Br=="string"?[Br]:Array.isArray(Br)?Br:[]}catch(jr){if(logger$7.debug("chooseAccountsToConnect - error",jr),jr.code===4001)throw new UserRejectedRequestError$1}return[]})}getConnectedAccounts(){return __awaiter$9(this,void 0,void 0,function*(){const br=this.getWalletClient();if(!br)return[];const wr=yield retryableFn(br.getAddresses,{fallbackValue:[],timeoutMs:500});return wr.length&&this.setActiveAccount(wr[0]),wr})}providerSwitchNetwork(br){return __awaiter$9(this,arguments,void 0,function*({network:wr,provider:Er}){var kr,jr,Br,Wr;const{chainId:qr}=wr,Gr=yield this.getNetwork();if(!(Gr&&Gr===qr))try{if(!this.supportsNetworkSwitching())throw new DynamicError("Network switching is not supported");const Vr=getOrMapViemChain(wr);if(yield Er.switchChain(Vr),this.key==="magiceden"){const Zr=yield Er.getChainId();this.emit("chainChange",{chain:Zr.toString()})}else this.setActiveChain(Vr)}catch(Vr){if(Vr.code===4902||!((kr=Vr.message)===null||kr===void 0)&&kr.includes("Unrecognized chain")||((Br=(jr=Vr.data)===null||jr===void 0?void 0:jr.orginalError)===null||Br===void 0?void 0:Br.code)===4902)return this.providerAddNetwork({network:wr,provider:Er});throw!((Wr=Vr.message)===null||Wr===void 0)&&Wr.includes("rejected")||typeof Vr=="string"&&Vr.includes("rejected")?new DynamicError("User rejected the wallet's request to switch network"):Vr}})}providerAddNetwork(br){return __awaiter$9(this,arguments,void 0,function*({network:wr,provider:Er}){var kr;try{return yield Er.addChain({chain:getOrMapViemChain(wr)})}catch(jr){throw!((kr=jr.message)===null||kr===void 0)&&kr.includes("rejected")||typeof jr=="string"&&jr.includes("rejected")?new DynamicError("User rejected the wallet's request to add network"):jr}})}setActiveAccount(br){this.activeAccount=br?toAccount(br):void 0}getActiveAccount(){return this.activeAccount}setActiveChain(br){this.activeChain=br}getActiveChain(){return this.activeChain}createUiTransaction(br){return __awaiter$9(this,void 0,void 0,function*(){yield this.validateActiveWallet(br);const wr=yield this.getWalletClient(),Er=yield this.getPublicClient();if(!Er||!wr)throw new DynamicError("No public client available");return createViemUiTransaction({from:br,publicClient:Er,walletClient:wr})})}confirmTransactionStatus(br){return __awaiter$9(this,void 0,void 0,function*(){const wr=yield this.getPublicClient();if(!wr)throw new DynamicError("No public client available");return wr.waitForTransactionReceipt({confirmations:3,hash:br})})}}ChainRpcProviders.getEvmProviderByChainId=(fr,br)=>{var wr;return(wr=fr.evm)===null||wr===void 0?void 0:wr.find(kr=>kr.chainId===br)};ChainRpcProviders.registerEvmProviders=()=>{ChainRpcProviders.registerChainProviders(ProviderChain.EVM,fr=>{const br={};return fr!=null&&fr.evm&&(br.evm=parseEvmNetworks(fr.evm).map(wr=>{var Er;const kr=((Er=wr.privateCustomerRpcUrls)===null||Er===void 0?void 0:Er[0])||wr.rpcUrls[0],jr=createPublicClient({chain:getOrMapViemChain(wr),transport:http(kr)});return{chainId:wr.chainId,chainName:wr.name,provider:jr}})),br.evm})};const unFormatTransaction=fr=>Object.assign(Object.assign({},fr),{gas:typeof fr.gas<"u"?hexToBigInt(fr.gas):void 0,gasPrice:typeof fr.gasPrice<"u"?hexToBigInt(fr.gasPrice):void 0,maxFeePerGas:typeof fr.maxFeePerGas<"u"?hexToBigInt(fr.maxFeePerGas):void 0,maxPriorityFeePerGas:typeof fr.maxPriorityFeePerGas<"u"?hexToBigInt(fr.maxPriorityFeePerGas):void 0,nonce:typeof fr.nonce<"u"?hexToBigInt(fr.nonce):void 0,value:typeof fr.value<"u"?hexToBigInt(fr.value):void 0}),createAccountWithUiConfirmation=({address:fr,account:br,provider:wr,walletConnector:Er,walletUiUtils:kr})=>toAccount({address:fr,signMessage:(...jr)=>__awaiter$9(void 0,void 0,void 0,function*(){return kr.signMessage({handler:()=>__awaiter$9(void 0,void 0,void 0,function*(){return(yield br()).signMessage(...jr)}),message:(()=>{var Br;const Wr=(Br=jr[0])===null||Br===void 0?void 0:Br.message;return Wr&&!(typeof Wr=="string"&&Array.isArray(Wr))?JSON.stringify(Wr):Wr==null?void 0:Wr.toString()})(),walletConnector:Er})}),signTransaction:(...jr)=>__awaiter$9(void 0,void 0,void 0,function*(){const Br=new ViemUiTransaction({account:fr,onSubmit:Wr=>__awaiter$9(void 0,void 0,void 0,function*(){return(yield br()).signTransaction(Wr)}),publicClient:wr,transaction:jr[0]});return kr.sendTransaction(Er,Br)}),signTypedData:(...jr)=>kr.signMessage({handler:()=>__awaiter$9(void 0,void 0,void 0,function*(){return(yield br()).signTypedData(...jr)}),message:JSON.stringify(jr[0]),walletConnector:Er})}),createWalletClientWithUiConfirmation=({address:fr,account:br,chain:wr,transport:Er,walletConnector:kr,walletUiUtils:jr})=>{let Br=null;const Wr=createPublicClient({chain:wr,transport:Er}),qr=createAccountWithUiConfirmation({account:br,address:fr,provider:Wr,walletConnector:kr,walletUiUtils:jr}),Gr=interceptTransport({getAccounts:()=>__awaiter$9(void 0,void 0,void 0,function*(){return[fr]}),onPersonalSign:Vr=>__awaiter$9(void 0,[Vr],void 0,function*({message:Zr}){if(!Br)throw new Error("Client not initialized");return Br.signMessage({message:{raw:Zr}})}),onSendTransaction:Vr=>__awaiter$9(void 0,[Vr],void 0,function*({transaction:Zr}){if(!Br)throw new Error("Client not initialized");const Jr=unFormatTransaction(Zr);return Br.sendTransaction(Jr)}),onSignTypedData:Vr=>__awaiter$9(void 0,[Vr],void 0,function*({message:Zr}){if(!Br)throw new Error("Client not initialized");return Br.signTypedData(JSON.parse(Zr))}),transport:Er});return Br=createWalletClient({account:qr,chain:wr,transport:Gr}),Br};assertPackageVersion("@dynamic-labs/ethereum-core",version$a);class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBase{constructor(br,wr){var Er;super(br,wr),this.walletFallback={brand:{alt:"Turnkey Wallet",spriteId:"turnkey"},name:"Turnkey HD"},this.ChainWallet=EthereumWallet,this.connectedChain="EVM",this.supportedChains=["ETH","EVM"],this.verifiedCredentialChain="eip155",this.stampCreateWalletAccountRequest=kr=>__awaiter$a(this,[kr],void 0,function*({request:jr}){return yield this.createOrRestoreSession(),this.getTurnkeyClient().stampCreateWalletAccounts(jr)}),this.evmNetworks=parseEvmNetworks(wr.evmNetworks),this.walletUiUtils=wr.walletUiUtils,this._turnkeyAccount=void 0,this._selectedChainId=this.getLastUsedChainId(),this.chainRpcProviders=wr.chainRpcProviders,(Er=this.chainRpcProviders)===null||Er===void 0||Er.registerEvmProviders(),this.__turnkeyClient=this.getTurnkeyClient()}getLastUsedChainId(){var br;if(this.lastUsedChainId)return this.lastUsedChainId;if(!((br=this.evmNetworks)===null||br===void 0)&&br.length)return this.evmNetworks[0].chainId}getNetwork(){return __awaiter$a(this,void 0,void 0,function*(){var br;return(br=yield this.getSigner())===null||br===void 0?void 0:br.getChainId()})}supportsNetworkSwitching(){return!0}switchNetwork(br){return __awaiter$a(this,arguments,void 0,function*({networkChainId:wr}){wr&&(typeof wr=="string"&&(wr=parseInt(wr)),this.lastUsedChainId=wr,this._selectedChainId=wr,yield this.refreshTurnkeyAccount(),this.emit("chainChange",{chain:wr.toString()}))})}setVerifiedCredentials(br){const wr=findTurnkeyVerifiedCredentialsWithSmartWalletRef(br,"eip155"),[Er]=wr;JSON.stringify(this.verifiedCredentials)!==JSON.stringify(wr)&&(this.verifiedCredential=Er,this.verifiedCredentials=wr,this.refreshTurnkeyAccount())}validateActiveWallet(br){return __awaiter$a(this,void 0,void 0,function*(){var wr,Er;const kr=((wr=this.verifiedCredential)===null||wr===void 0?void 0:wr.address)||"";if(!isSameAddress$1(kr,br,this.connectedChain)){const Br=(Er=this.verifiedCredentials)===null||Er===void 0?void 0:Er.find(Wr=>(Wr==null?void 0:Wr.address)===br);if(!Br)throw new DynamicError("Account not found");this.verifiedCredential=Br,this.refreshTurnkeyAccount()}})}getRpcUrl(){const br=this._selectedChainId;return getRpcUrlForChain({chainId:br,networks:this.evmNetworks})}getBalance(br){return __awaiter$a(this,void 0,void 0,function*(){const wr=this.getRpcUrl();if(!wr)return;const kr=yield createPublicClient({transport:http(wr)}).getBalance({address:br});return formatEther$1(kr)})}signMessage(br){return __awaiter$a(this,void 0,void 0,function*(){const wr=yield this.getSigner();if(!wr)throw new Error("Signer not found");return wr.signMessage({message:br})})}getPublicClient(){return __awaiter$a(this,void 0,void 0,function*(){var br,wr;if(this.evmNetworks.length===0)return;const Er=(br=yield this.getNetwork())!==null&&br!==void 0?br:1,kr={cosmos:[],evm:this.evmNetworks,solana:[],starknet:void 0};if(!this.chainRpcProviders)return;const jr=this.chainRpcProviders.getProviders(kr);return(wr=this.chainRpcProviders.getEvmProviderByChainId(jr,Er))===null||wr===void 0?void 0:wr.provider})}getSigner(){return __awaiter$a(this,void 0,void 0,function*(){return yield this.getTurnkeyAccount(),this.getWalletClient()})}getTurnkeyClient(){var br;let wr=getTLD();wr||(wr=PlatformService.getHostname());const Er=PasskeyService.createWebauthnStamper({rpId:wr}),kr=TurnkeyWalletConnectorBase==null?void 0:TurnkeyWalletConnectorBase.apiKeyStamper,jr=kr??Er;return this.__turnkeyClient=(br=this.getAuthenticatorHandler().client)!==null&&br!==void 0?br:new TurnkeyClient({baseUrl:TURNKEY_API_BASE_URL},jr),this.__turnkeyClient}getAccount(){return __awaiter$a(this,void 0,void 0,function*(){var br,wr,Er;return this.isSessionKeyCompatible()&&((br=this.__turnkeyClient)===null||br===void 0?void 0:br.stamper)instanceof ApiKeyStamper?this._turnkeyAccount:((this.getAuthenticatorHandler().recoveryType==="passkey"&&((wr=this.__turnkeyClient)===null||wr===void 0?void 0:wr.stamper)instanceof IframeStamper||this.getAuthenticatorHandler().recoveryType==="email"&&((Er=this.__turnkeyClient)===null||Er===void 0?void 0:Er.stamper)instanceof WebauthnStamper||this.__turnkeyClient!==this.getAuthenticatorHandler().client)&&(yield this.refreshTurnkeyAccount()),this._turnkeyAccount)})}getWalletClient(){const br=this.networkRpcUrl,wr=this._turnkeyAccount,Er=this.currentEvmNetwork;if(!(!wr||!br||!Er))return createWalletClientWithUiConfirmation({account:this.getAccount.bind(this),address:this.turnkeyAddress,chain:getOrMapViemChain(Er),transport:http(br),walletConnector:this,walletUiUtils:this.walletUiUtils})}get currentChainId(){var br,wr,Er;return(br=this._selectedChainId)!==null&&br!==void 0?br:(Er=(wr=this.evmNetworks)===null||wr===void 0?void 0:wr[0])===null||Er===void 0?void 0:Er.chainId}get lastUsedChainId(){const br=localStorage.getItem(TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey);if(br)try{const wr=parseInt(br);if(isNaN(wr))return;if(!this.evmNetworks.some(kr=>kr.chainId===wr)){const kr=this.evmNetworks[0].chainId;return this.lastUsedChainId=kr,this.lastUsedChainId}return wr}catch(wr){logger$4.error(wr);return}}set lastUsedChainId(br){br===void 0?localStorage.removeItem(TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey):localStorage.setItem(TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey,br.toString())}get networkRpcUrl(){const br=this.currentChainId;return this.evmNetworks.find(kr=>kr.chainId===br)?getRpcUrlForChain({chainId:br,networks:this.evmNetworks}):void 0}get currentEvmNetwork(){const br=this.currentChainId;return this.evmNetworks.find(wr=>wr.chainId===br)}internalSignTransaction(br){return __awaiter$a(this,arguments,void 0,function*({transaction:wr,args:Er,address:kr,turnkeySubOrganizationId:jr}){return this.doRetryableTurnkeyAction({action:Br=>Br.signTransaction(wr,Er),activityType:"SignTransaction",address:kr,turnkeySubOrganizationId:jr})})}internalSignTypedData(br){return __awaiter$a(this,arguments,void 0,function*({typedData:wr,address:Er,turnkeySubOrganizationId:kr}){return this.doRetryableTurnkeyAction({action:jr=>jr.signTypedData(wr),activityType:"SignTypedData",address:Er,turnkeySubOrganizationId:kr})})}internalSignMessage(br){return __awaiter$a(this,arguments,void 0,function*({message:wr,address:Er,turnkeySubOrganizationId:kr}){return this.doRetryableTurnkeyAction({action:jr=>jr.signMessage({message:wr}),activityType:"SignMessage",address:Er,turnkeySubOrganizationId:kr})})}doRetryableTurnkeyAction(br){return __awaiter$a(this,arguments,void 0,function*({action:wr,activityType:Er,address:kr,turnkeySubOrganizationId:jr}){yield this.createOrRestoreSession();let Br=yield this.createTurnkeyAccount({address:kr,turnkeySubOrganizationId:jr});try{return yield wr(Br)}catch(Wr){if(TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS.some(qr=>Wr.message.includes(qr)))return yield this.removeSessionKeys(),yield this.createOrRestoreSession({ignoreRestore:!0}),Br=yield this.createTurnkeyAccount({address:kr,turnkeySubOrganizationId:jr}),wr(Br);throw logger$4.error(`[TK] failed to perform ${Er} activity`,Wr),Wr}})}createTurnkeyAccount(br){return __awaiter$a(this,arguments,void 0,function*({address:wr,turnkeySubOrganizationId:Er}){return createAccount({client:this.getTurnkeyClient(),ethereumAddress:wr,organizationId:Er,signWith:wr})})}refreshTurnkeyAccount(){return __awaiter$a(this,void 0,void 0,function*(){return this._turnkeyAccount=void 0,this.getTurnkeyAccount()})}getTurnkeyAccount(){return __awaiter$a(this,void 0,void 0,function*(){var br,wr;if(this._turnkeyAccount)return this._turnkeyAccount;const{turnkeySubOrganizationId:Er}=(br=this.walletProperties)!==null&&br!==void 0?br:{},{address:kr}=(wr=this.verifiedCredential)!==null&&wr!==void 0?wr:{};if(!(!Er||!kr))return this._turnkeyAccount=toAccount({address:kr,signMessage:jr=>__awaiter$a(this,[jr],void 0,function*({message:Br}){return this.internalSignMessage({address:kr,message:Br,turnkeySubOrganizationId:Er})}),signTransaction:(jr,Br)=>__awaiter$a(this,void 0,void 0,function*(){return this.internalSignTransaction({address:kr,args:Br,transaction:jr,turnkeySubOrganizationId:Er})}),signTypedData:jr=>__awaiter$a(this,void 0,void 0,function*(){return this.internalSignTypedData({address:kr,turnkeySubOrganizationId:Er,typedData:jr})})}),this.setLoggerMetadata(),this._turnkeyAccount})}createUiTransaction(br){return __awaiter$a(this,void 0,void 0,function*(){yield this.validateActiveWallet(br);const wr=this.getWalletClient(),Er=yield this.getPublicClient();if(!Er||!wr)throw new DynamicError("No public client available");return createViemUiTransaction({from:br,publicClient:Er,walletClient:wr})})}}TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey="turnkey-last-used-chain-id";const TurnkeyEVMWalletConnectors=fr=>{var br;return!((br=fr.apiProviders)===null||br===void 0)&&br.turnkey?[TurnkeyEVMWalletConnector.bind(null,TurnkeyWalletConnectorInfo.TurnkeyHD),TurnkeyEVMWalletConnector.bind(null,TurnkeyWalletConnectorInfo.Turnkey)]:[]};assertPackageVersion("@dynamic-labs/embedded-wallet-evm",version$d);var version$9="3.8.2";function __rest$6(fr,br){var wr={};for(var Er in fr)Object.prototype.hasOwnProperty.call(fr,Er)&&br.indexOf(Er)<0&&(wr[Er]=fr[Er]);if(fr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var kr=0,Er=Object.getOwnPropertySymbols(fr);krwr.chain==="evm")}installedProviders(){const br=this.getInjectedConfig();if(!br)return[];const wr=[];if(br.windowLocations)for(const Er of br.windowLocations){const kr=getProvidersFromWindow(Er);kr&&kr.length&&wr.push(...kr)}return window.ethereum&&(!window.ethereum.providers||!window.ethereum.providers.length?wr.push(window.ethereum):window.ethereum.providers.forEach(Er=>wr.push(Er))),wr}installedProviderLookup(br){const wr=this.installedProviders();return ProviderLookup(wr,br)}eip6963ProviderLookup(br){var wr;const{providers:Er}=Eip6963ProviderSingleton.get();return(wr=Er.find(kr=>{var jr;return((jr=kr==null?void 0:kr.info)===null||jr===void 0?void 0:jr.rdns)===br}))===null||wr===void 0?void 0:wr.provider}isInstalledHelper(){return this.findProvider()!==void 0}findProvider(){return this.connector.findProvider()}findWalletClient(br){const wr=this.findProvider();if(wr)return createWalletClient({account:this.connector.getActiveAccount(),chain:br?chainsMap[br]:this.connector.getActiveChain(),transport:custom(wr)})}getAddress(){return __awaiter$8(this,void 0,void 0,function*(){const br=this.findWalletClient();return br?this.getAddressWithProvider(br):Promise.resolve(void 0)})}getAddressWithProvider(br){return __awaiter$8(this,void 0,void 0,function*(){try{const[wr]=yield br.requestAddresses(),Er=getAddress(wr);return this.connector.setActiveAccount(Er),Er}catch(wr){return logger$7.error(wr),Promise.reject(wr)}})}signMessage(br){return __awaiter$8(this,void 0,void 0,function*(){const wr=yield this.getAddress();if(!wr)return Promise.resolve(void 0);const Er=this.findWalletClient();return Er?yield Er.signMessage({account:wr,message:br}):Promise.resolve(void 0)})}_setupEventListeners(br){const wr=this.findProvider();if(!wr)return logger$7.warn("Provider not found",{connector:br}),{tearDownEventListeners:()=>{}};if(!wr.on)return logger$7.warn("Provider does not support event listeners",{connector:br,provider:wr}),{tearDownEventListeners:()=>{}};const{handleAccountChange:Er,handleChainChange:kr,handleDisconnect:jr}=eventListenerHandlers(br);return wr.on("accountsChanged",Er),wr.on("chainChanged",kr),wr.on("disconnect",jr),{tearDownEventListeners:()=>{const Wr=this.findProvider();Wr&&(Er&&Wr.removeListener("accountsChanged",Er),kr&&Wr.removeListener("chainChanged",kr),jr&&Wr.removeListener("disconnect",jr))}}}}var chacha20poly1305={},chacha={},binary={},int={};(function(fr){Object.defineProperty(fr,"__esModule",{value:!0});function br(Wr,qr){var Gr=Wr>>>16&65535,Vr=Wr&65535,Zr=qr>>>16&65535,Jr=qr&65535;return Vr*Jr+(Gr*Jr+Vr*Zr<<16>>>0)|0}fr.mul=Math.imul||br;function wr(Wr,qr){return Wr+qr|0}fr.add=wr;function Er(Wr,qr){return Wr-qr|0}fr.sub=Er;function kr(Wr,qr){return Wr<>>32-qr}fr.rotl=kr;function jr(Wr,qr){return Wr<<32-qr|Wr>>>qr}fr.rotr=jr;function Br(Wr){return typeof Wr=="number"&&isFinite(Wr)&&Math.floor(Wr)===Wr}fr.isInteger=Number.isInteger||Br,fr.MAX_SAFE_INTEGER=9007199254740991,fr.isSafeInteger=function(Wr){return fr.isInteger(Wr)&&Wr>=-fr.MAX_SAFE_INTEGER&&Wr<=fr.MAX_SAFE_INTEGER}})(int);Object.defineProperty(binary,"__esModule",{value:!0});var int_1=int;function readInt16BE(fr,br){return br===void 0&&(br=0),(fr[br+0]<<8|fr[br+1])<<16>>16}binary.readInt16BE=readInt16BE;function readUint16BE(fr,br){return br===void 0&&(br=0),(fr[br+0]<<8|fr[br+1])>>>0}binary.readUint16BE=readUint16BE;function readInt16LE(fr,br){return br===void 0&&(br=0),(fr[br+1]<<8|fr[br])<<16>>16}binary.readInt16LE=readInt16LE;function readUint16LE(fr,br){return br===void 0&&(br=0),(fr[br+1]<<8|fr[br])>>>0}binary.readUint16LE=readUint16LE;function writeUint16BE(fr,br,wr){return br===void 0&&(br=new Uint8Array(2)),wr===void 0&&(wr=0),br[wr+0]=fr>>>8,br[wr+1]=fr>>>0,br}binary.writeUint16BE=writeUint16BE;binary.writeInt16BE=writeUint16BE;function writeUint16LE(fr,br,wr){return br===void 0&&(br=new Uint8Array(2)),wr===void 0&&(wr=0),br[wr+0]=fr>>>0,br[wr+1]=fr>>>8,br}binary.writeUint16LE=writeUint16LE;binary.writeInt16LE=writeUint16LE;function readInt32BE(fr,br){return br===void 0&&(br=0),fr[br]<<24|fr[br+1]<<16|fr[br+2]<<8|fr[br+3]}binary.readInt32BE=readInt32BE;function readUint32BE(fr,br){return br===void 0&&(br=0),(fr[br]<<24|fr[br+1]<<16|fr[br+2]<<8|fr[br+3])>>>0}binary.readUint32BE=readUint32BE;function readInt32LE(fr,br){return br===void 0&&(br=0),fr[br+3]<<24|fr[br+2]<<16|fr[br+1]<<8|fr[br]}binary.readInt32LE=readInt32LE;function readUint32LE(fr,br){return br===void 0&&(br=0),(fr[br+3]<<24|fr[br+2]<<16|fr[br+1]<<8|fr[br])>>>0}binary.readUint32LE=readUint32LE;function writeUint32BE(fr,br,wr){return br===void 0&&(br=new Uint8Array(4)),wr===void 0&&(wr=0),br[wr+0]=fr>>>24,br[wr+1]=fr>>>16,br[wr+2]=fr>>>8,br[wr+3]=fr>>>0,br}binary.writeUint32BE=writeUint32BE;binary.writeInt32BE=writeUint32BE;function writeUint32LE(fr,br,wr){return br===void 0&&(br=new Uint8Array(4)),wr===void 0&&(wr=0),br[wr+0]=fr>>>0,br[wr+1]=fr>>>8,br[wr+2]=fr>>>16,br[wr+3]=fr>>>24,br}binary.writeUint32LE=writeUint32LE;binary.writeInt32LE=writeUint32LE;function readInt64BE(fr,br){br===void 0&&(br=0);var wr=readInt32BE(fr,br),Er=readInt32BE(fr,br+4);return wr*4294967296+Er-(Er>>31)*4294967296}binary.readInt64BE=readInt64BE;function readUint64BE(fr,br){br===void 0&&(br=0);var wr=readUint32BE(fr,br),Er=readUint32BE(fr,br+4);return wr*4294967296+Er}binary.readUint64BE=readUint64BE;function readInt64LE(fr,br){br===void 0&&(br=0);var wr=readInt32LE(fr,br),Er=readInt32LE(fr,br+4);return Er*4294967296+wr-(wr>>31)*4294967296}binary.readInt64LE=readInt64LE;function readUint64LE(fr,br){br===void 0&&(br=0);var wr=readUint32LE(fr,br),Er=readUint32LE(fr,br+4);return Er*4294967296+wr}binary.readUint64LE=readUint64LE;function writeUint64BE(fr,br,wr){return br===void 0&&(br=new Uint8Array(8)),wr===void 0&&(wr=0),writeUint32BE(fr/4294967296>>>0,br,wr),writeUint32BE(fr>>>0,br,wr+4),br}binary.writeUint64BE=writeUint64BE;binary.writeInt64BE=writeUint64BE;function writeUint64LE(fr,br,wr){return br===void 0&&(br=new Uint8Array(8)),wr===void 0&&(wr=0),writeUint32LE(fr>>>0,br,wr),writeUint32LE(fr/4294967296>>>0,br,wr+4),br}binary.writeUint64LE=writeUint64LE;binary.writeInt64LE=writeUint64LE;function readUintBE(fr,br,wr){if(wr===void 0&&(wr=0),fr%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(fr/8>br.length-wr)throw new Error("readUintBE: array is too short for the given bitLength");for(var Er=0,kr=1,jr=fr/8+wr-1;jr>=wr;jr--)Er+=br[jr]*kr,kr*=256;return Er}binary.readUintBE=readUintBE;function readUintLE(fr,br,wr){if(wr===void 0&&(wr=0),fr%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(fr/8>br.length-wr)throw new Error("readUintLE: array is too short for the given bitLength");for(var Er=0,kr=1,jr=wr;jr=Er;jr--)wr[jr]=br/kr&255,kr*=256;return wr}binary.writeUintBE=writeUintBE;function writeUintLE(fr,br,wr,Er){if(wr===void 0&&(wr=new Uint8Array(fr/8)),Er===void 0&&(Er=0),fr%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(br))throw new Error("writeUintLE value must be an integer");for(var kr=1,jr=Er;jr>>16|Xr<<16,so=so+Xr|0,_i^=so,_i=_i>>>20|_i<<12,eo=eo+oo|0,Sn^=eo,Sn=Sn>>>16|Sn<<16,no=no+Sn|0,oo^=no,oo=oo>>>20|oo<<12,ro=ro+io|0,Rn^=ro,Rn=Rn>>>16|Rn<<16,Tn=Tn+Rn|0,io^=Tn,io=io>>>20|io<<12,to=to+co|0,Pn^=to,Pn=Pn>>>16|Pn<<16,Hr=Hr+Pn|0,co^=Hr,co=co>>>20|co<<12,ro=ro+io|0,Rn^=ro,Rn=Rn>>>24|Rn<<8,Tn=Tn+Rn|0,io^=Tn,io=io>>>25|io<<7,to=to+co|0,Pn^=to,Pn=Pn>>>24|Pn<<8,Hr=Hr+Pn|0,co^=Hr,co=co>>>25|co<<7,eo=eo+oo|0,Sn^=eo,Sn=Sn>>>24|Sn<<8,no=no+Sn|0,oo^=no,oo=oo>>>25|oo<<7,jn=jn+_i|0,Xr^=jn,Xr=Xr>>>24|Xr<<8,so=so+Xr|0,_i^=so,_i=_i>>>25|_i<<7,jn=jn+oo|0,Pn^=jn,Pn=Pn>>>16|Pn<<16,Tn=Tn+Pn|0,oo^=Tn,oo=oo>>>20|oo<<12,eo=eo+io|0,Xr^=eo,Xr=Xr>>>16|Xr<<16,Hr=Hr+Xr|0,io^=Hr,io=io>>>20|io<<12,ro=ro+co|0,Sn^=ro,Sn=Sn>>>16|Sn<<16,so=so+Sn|0,co^=so,co=co>>>20|co<<12,to=to+_i|0,Rn^=to,Rn=Rn>>>16|Rn<<16,no=no+Rn|0,_i^=no,_i=_i>>>20|_i<<12,ro=ro+co|0,Sn^=ro,Sn=Sn>>>24|Sn<<8,so=so+Sn|0,co^=so,co=co>>>25|co<<7,to=to+_i|0,Rn^=to,Rn=Rn>>>24|Rn<<8,no=no+Rn|0,_i^=no,_i=_i>>>25|_i<<7,eo=eo+io|0,Xr^=eo,Xr=Xr>>>24|Xr<<8,Hr=Hr+Xr|0,io^=Hr,io=io>>>25|io<<7,jn=jn+oo|0,Pn^=jn,Pn=Pn>>>24|Pn<<8,Tn=Tn+Pn|0,oo^=Tn,oo=oo>>>25|oo<<7;binary_1.writeUint32LE(jn+Er|0,fr,0),binary_1.writeUint32LE(eo+kr|0,fr,4),binary_1.writeUint32LE(ro+jr|0,fr,8),binary_1.writeUint32LE(to+Br|0,fr,12),binary_1.writeUint32LE(_i+Wr|0,fr,16),binary_1.writeUint32LE(oo+qr|0,fr,20),binary_1.writeUint32LE(io+Gr|0,fr,24),binary_1.writeUint32LE(co+Vr|0,fr,28),binary_1.writeUint32LE(so+Zr|0,fr,32),binary_1.writeUint32LE(no+Jr|0,fr,36),binary_1.writeUint32LE(Tn+Qr|0,fr,40),binary_1.writeUint32LE(Hr+_n|0,fr,44),binary_1.writeUint32LE(Xr+En|0,fr,48),binary_1.writeUint32LE(Sn+Cn|0,fr,52),binary_1.writeUint32LE(Rn+In|0,fr,56),binary_1.writeUint32LE(Pn+An|0,fr,60)}function streamXOR(fr,br,wr,Er,kr){if(kr===void 0&&(kr=0),fr.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(Er.length>>=8,br++;if(Er>0)throw new Error("ChaCha: counter overflow")}var poly1305={},constantTime={};Object.defineProperty(constantTime,"__esModule",{value:!0});function select(fr,br,wr){return~(fr-1)&br|fr-1&wr}constantTime.select=select;function lessOrEqual(fr,br){return(fr|0)-(br|0)-1>>>31&1}constantTime.lessOrEqual=lessOrEqual;function compare(fr,br){if(fr.length!==br.length)return 0;for(var wr=0,Er=0;Er>>8}constantTime.compare=compare;function equal(fr,br){return fr.length===0||br.length===0?!1:compare(fr,br)!==0}constantTime.equal=equal;(function(fr){Object.defineProperty(fr,"__esModule",{value:!0});var br=constantTime,wr=wipe$1;fr.DIGEST_LENGTH=16;var Er=function(){function Br(Wr){this.digestLength=fr.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var qr=Wr[0]|Wr[1]<<8;this._r[0]=qr&8191;var Gr=Wr[2]|Wr[3]<<8;this._r[1]=(qr>>>13|Gr<<3)&8191;var Vr=Wr[4]|Wr[5]<<8;this._r[2]=(Gr>>>10|Vr<<6)&7939;var Zr=Wr[6]|Wr[7]<<8;this._r[3]=(Vr>>>7|Zr<<9)&8191;var Jr=Wr[8]|Wr[9]<<8;this._r[4]=(Zr>>>4|Jr<<12)&255,this._r[5]=Jr>>>1&8190;var Qr=Wr[10]|Wr[11]<<8;this._r[6]=(Jr>>>14|Qr<<2)&8191;var _n=Wr[12]|Wr[13]<<8;this._r[7]=(Qr>>>11|_n<<5)&8065;var En=Wr[14]|Wr[15]<<8;this._r[8]=(_n>>>8|En<<8)&8191,this._r[9]=En>>>5&127,this._pad[0]=Wr[16]|Wr[17]<<8,this._pad[1]=Wr[18]|Wr[19]<<8,this._pad[2]=Wr[20]|Wr[21]<<8,this._pad[3]=Wr[22]|Wr[23]<<8,this._pad[4]=Wr[24]|Wr[25]<<8,this._pad[5]=Wr[26]|Wr[27]<<8,this._pad[6]=Wr[28]|Wr[29]<<8,this._pad[7]=Wr[30]|Wr[31]<<8}return Br.prototype._blocks=function(Wr,qr,Gr){for(var Vr=this._fin?0:2048,Zr=this._h[0],Jr=this._h[1],Qr=this._h[2],_n=this._h[3],En=this._h[4],Cn=this._h[5],In=this._h[6],An=this._h[7],jn=this._h[8],eo=this._h[9],ro=this._r[0],to=this._r[1],_i=this._r[2],oo=this._r[3],io=this._r[4],co=this._r[5],so=this._r[6],no=this._r[7],Tn=this._r[8],Hr=this._r[9];Gr>=16;){var Xr=Wr[qr+0]|Wr[qr+1]<<8;Zr+=Xr&8191;var Sn=Wr[qr+2]|Wr[qr+3]<<8;Jr+=(Xr>>>13|Sn<<3)&8191;var Rn=Wr[qr+4]|Wr[qr+5]<<8;Qr+=(Sn>>>10|Rn<<6)&8191;var Pn=Wr[qr+6]|Wr[qr+7]<<8;_n+=(Rn>>>7|Pn<<9)&8191;var On=Wr[qr+8]|Wr[qr+9]<<8;En+=(Pn>>>4|On<<12)&8191,Cn+=On>>>1&8191;var Zn=Wr[qr+10]|Wr[qr+11]<<8;In+=(On>>>14|Zn<<2)&8191;var Nn=Wr[qr+12]|Wr[qr+13]<<8;An+=(Zn>>>11|Nn<<5)&8191;var wn=Wr[qr+14]|Wr[qr+15]<<8;jn+=(Nn>>>8|wn<<8)&8191,eo+=wn>>>5|Vr;var zn=0,fo=zn;fo+=Zr*ro,fo+=Jr*(5*Hr),fo+=Qr*(5*Tn),fo+=_n*(5*no),fo+=En*(5*so),zn=fo>>>13,fo&=8191,fo+=Cn*(5*co),fo+=In*(5*io),fo+=An*(5*oo),fo+=jn*(5*_i),fo+=eo*(5*to),zn+=fo>>>13,fo&=8191;var vo=zn;vo+=Zr*to,vo+=Jr*ro,vo+=Qr*(5*Hr),vo+=_n*(5*Tn),vo+=En*(5*no),zn=vo>>>13,vo&=8191,vo+=Cn*(5*so),vo+=In*(5*co),vo+=An*(5*io),vo+=jn*(5*oo),vo+=eo*(5*_i),zn+=vo>>>13,vo&=8191;var go=zn;go+=Zr*_i,go+=Jr*to,go+=Qr*ro,go+=_n*(5*Hr),go+=En*(5*Tn),zn=go>>>13,go&=8191,go+=Cn*(5*no),go+=In*(5*so),go+=An*(5*co),go+=jn*(5*io),go+=eo*(5*oo),zn+=go>>>13,go&=8191;var uo=zn;uo+=Zr*oo,uo+=Jr*_i,uo+=Qr*to,uo+=_n*ro,uo+=En*(5*Hr),zn=uo>>>13,uo&=8191,uo+=Cn*(5*Tn),uo+=In*(5*no),uo+=An*(5*so),uo+=jn*(5*co),uo+=eo*(5*io),zn+=uo>>>13,uo&=8191;var lo=zn;lo+=Zr*io,lo+=Jr*oo,lo+=Qr*_i,lo+=_n*to,lo+=En*ro,zn=lo>>>13,lo&=8191,lo+=Cn*(5*Hr),lo+=In*(5*Tn),lo+=An*(5*no),lo+=jn*(5*so),lo+=eo*(5*co),zn+=lo>>>13,lo&=8191;var Eo=zn;Eo+=Zr*co,Eo+=Jr*io,Eo+=Qr*oo,Eo+=_n*_i,Eo+=En*to,zn=Eo>>>13,Eo&=8191,Eo+=Cn*ro,Eo+=In*(5*Hr),Eo+=An*(5*Tn),Eo+=jn*(5*no),Eo+=eo*(5*so),zn+=Eo>>>13,Eo&=8191;var mo=zn;mo+=Zr*so,mo+=Jr*co,mo+=Qr*io,mo+=_n*oo,mo+=En*_i,zn=mo>>>13,mo&=8191,mo+=Cn*to,mo+=In*ro,mo+=An*(5*Hr),mo+=jn*(5*Tn),mo+=eo*(5*no),zn+=mo>>>13,mo&=8191;var yo=zn;yo+=Zr*no,yo+=Jr*so,yo+=Qr*co,yo+=_n*io,yo+=En*oo,zn=yo>>>13,yo&=8191,yo+=Cn*_i,yo+=In*to,yo+=An*ro,yo+=jn*(5*Hr),yo+=eo*(5*Tn),zn+=yo>>>13,yo&=8191;var _o=zn;_o+=Zr*Tn,_o+=Jr*no,_o+=Qr*so,_o+=_n*co,_o+=En*io,zn=_o>>>13,_o&=8191,_o+=Cn*oo,_o+=In*_i,_o+=An*to,_o+=jn*ro,_o+=eo*(5*Hr),zn+=_o>>>13,_o&=8191;var Bo=zn;Bo+=Zr*Hr,Bo+=Jr*Tn,Bo+=Qr*no,Bo+=_n*so,Bo+=En*co,zn=Bo>>>13,Bo&=8191,Bo+=Cn*io,Bo+=In*oo,Bo+=An*_i,Bo+=jn*to,Bo+=eo*ro,zn+=Bo>>>13,Bo&=8191,zn=(zn<<2)+zn|0,zn=zn+fo|0,fo=zn&8191,zn=zn>>>13,vo+=zn,Zr=fo,Jr=vo,Qr=go,_n=uo,En=lo,Cn=Eo,In=mo,An=yo,jn=_o,eo=Bo,qr+=16,Gr-=16}this._h[0]=Zr,this._h[1]=Jr,this._h[2]=Qr,this._h[3]=_n,this._h[4]=En,this._h[5]=Cn,this._h[6]=In,this._h[7]=An,this._h[8]=jn,this._h[9]=eo},Br.prototype.finish=function(Wr,qr){qr===void 0&&(qr=0);var Gr=new Uint16Array(10),Vr,Zr,Jr,Qr;if(this._leftover){for(Qr=this._leftover,this._buffer[Qr++]=1;Qr<16;Qr++)this._buffer[Qr]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(Vr=this._h[1]>>>13,this._h[1]&=8191,Qr=2;Qr<10;Qr++)this._h[Qr]+=Vr,Vr=this._h[Qr]>>>13,this._h[Qr]&=8191;for(this._h[0]+=Vr*5,Vr=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=Vr,Vr=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=Vr,Gr[0]=this._h[0]+5,Vr=Gr[0]>>>13,Gr[0]&=8191,Qr=1;Qr<10;Qr++)Gr[Qr]=this._h[Qr]+Vr,Vr=Gr[Qr]>>>13,Gr[Qr]&=8191;for(Gr[9]-=8192,Zr=(Vr^1)-1,Qr=0;Qr<10;Qr++)Gr[Qr]&=Zr;for(Zr=~Zr,Qr=0;Qr<10;Qr++)this._h[Qr]=this._h[Qr]&Zr|Gr[Qr];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,Jr=this._h[0]+this._pad[0],this._h[0]=Jr&65535,Qr=1;Qr<8;Qr++)Jr=(this._h[Qr]+this._pad[Qr]|0)+(Jr>>>16)|0,this._h[Qr]=Jr&65535;return Wr[qr+0]=this._h[0]>>>0,Wr[qr+1]=this._h[0]>>>8,Wr[qr+2]=this._h[1]>>>0,Wr[qr+3]=this._h[1]>>>8,Wr[qr+4]=this._h[2]>>>0,Wr[qr+5]=this._h[2]>>>8,Wr[qr+6]=this._h[3]>>>0,Wr[qr+7]=this._h[3]>>>8,Wr[qr+8]=this._h[4]>>>0,Wr[qr+9]=this._h[4]>>>8,Wr[qr+10]=this._h[5]>>>0,Wr[qr+11]=this._h[5]>>>8,Wr[qr+12]=this._h[6]>>>0,Wr[qr+13]=this._h[6]>>>8,Wr[qr+14]=this._h[7]>>>0,Wr[qr+15]=this._h[7]>>>8,this._finished=!0,this},Br.prototype.update=function(Wr){var qr=0,Gr=Wr.length,Vr;if(this._leftover){Vr=16-this._leftover,Vr>Gr&&(Vr=Gr);for(var Zr=0;Zr=16&&(Vr=Gr-Gr%16,this._blocks(Wr,qr,Vr),qr+=Vr,Gr-=Vr),Gr){for(var Zr=0;Zr16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var Qr=new Uint8Array(16);Qr.set(Gr,Qr.length-Gr.length);var _n=new Uint8Array(32);br.stream(this._key,Qr,_n,4);var En=Vr.length+this.tagLength,Cn;if(Jr){if(Jr.length!==En)throw new Error("ChaCha20Poly1305: incorrect destination length");Cn=Jr}else Cn=new Uint8Array(En);return br.streamXOR(this._key,Qr,Vr,Cn,4),this._authenticate(Cn.subarray(Cn.length-this.tagLength,Cn.length),_n,Cn.subarray(0,Cn.length-this.tagLength),Zr),Er.wipe(Qr),Cn},qr.prototype.open=function(Gr,Vr,Zr,Jr){if(Gr.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(Vr.length0&&Qr.update(Br.subarray(Jr.length%16))),Qr.update(Zr),Zr.length%16>0&&Qr.update(Br.subarray(Zr.length%16));var _n=new Uint8Array(8);Jr&&kr.writeUint64LE(Jr.length,_n),Qr.update(_n),kr.writeUint64LE(Zr.length,_n),Qr.update(_n);for(var En=Qr.digest(),Cn=0;Cnthis.blockSize?this._inner.update(wr).finish(Er).clean():Er.set(wr);for(var kr=0;kr1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},fr.prototype.expand=function(br){for(var wr=new Uint8Array(br),Er=0;Er256)throw new Error("randomString charset is too long");let Jr="";const Qr=Vr.length,_n=256-256%Qr;for(;Gr>0;){const En=kr(Math.ceil(Gr*256/_n),Zr);for(let Cn=0;Cn0;Cn++){const In=En[Cn];In<_n&&(Jr+=Vr.charAt(In%Qr),Gr--)}(0,Er.wipe)(En)}return Jr}fr.randomString=Wr;function qr(Gr,Vr=Br,Zr=fr.defaultRandomSource){const Jr=Math.ceil(Gr/(Math.log(Vr.length)/Math.LN2));return Wr(Jr,Vr,Zr)}fr.randomStringForEntropy=qr})(random);var sha256={};(function(fr){Object.defineProperty(fr,"__esModule",{value:!0});var br=binary,wr=wipe$1;fr.DIGEST_LENGTH=32,fr.BLOCK_SIZE=64;var Er=function(){function Wr(){this.digestLength=fr.DIGEST_LENGTH,this.blockSize=fr.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return Wr.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},Wr.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},Wr.prototype.clean=function(){wr.wipe(this._buffer),wr.wipe(this._temp),this.reset()},Wr.prototype.update=function(qr,Gr){if(Gr===void 0&&(Gr=qr.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var Vr=0;if(this._bytesHashed+=Gr,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=qr[Vr++],Gr--;this._bufferLength===this.blockSize&&(jr(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(Gr>=this.blockSize&&(Vr=jr(this._temp,this._state,qr,Vr,Gr),Gr%=this.blockSize);Gr>0;)this._buffer[this._bufferLength++]=qr[Vr++],Gr--;return this},Wr.prototype.finish=function(qr){if(!this._finished){var Gr=this._bytesHashed,Vr=this._bufferLength,Zr=Gr/536870912|0,Jr=Gr<<3,Qr=Gr%64<56?64:128;this._buffer[Vr]=128;for(var _n=Vr+1;_n0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},Wr.prototype.restoreState=function(qr){return this._state.set(qr.state),this._bufferLength=qr.bufferLength,qr.buffer&&this._buffer.set(qr.buffer),this._bytesHashed=qr.bytesHashed,this._finished=!1,this},Wr.prototype.cleanSavedState=function(qr){wr.wipe(qr.state),qr.buffer&&wr.wipe(qr.buffer),qr.bufferLength=0,qr.bytesHashed=0},Wr}();fr.SHA256=Er;var kr=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function jr(Wr,qr,Gr,Vr,Zr){for(;Zr>=64;){for(var Jr=qr[0],Qr=qr[1],_n=qr[2],En=qr[3],Cn=qr[4],In=qr[5],An=qr[6],jn=qr[7],eo=0;eo<16;eo++){var ro=Vr+eo*4;Wr[eo]=br.readUint32BE(Gr,ro)}for(var eo=16;eo<64;eo++){var to=Wr[eo-2],_i=(to>>>17|to<<15)^(to>>>19|to<<13)^to>>>10;to=Wr[eo-15];var oo=(to>>>7|to<<25)^(to>>>18|to<<14)^to>>>3;Wr[eo]=(_i+Wr[eo-7]|0)+(oo+Wr[eo-16]|0)}for(var eo=0;eo<64;eo++){var _i=(((Cn>>>6|Cn<<26)^(Cn>>>11|Cn<<21)^(Cn>>>25|Cn<<7))+(Cn&In^~Cn&An)|0)+(jn+(kr[eo]+Wr[eo]|0)|0)|0,oo=((Jr>>>2|Jr<<30)^(Jr>>>13|Jr<<19)^(Jr>>>22|Jr<<10))+(Jr&Qr^Jr&_n^Qr&_n)|0;jn=An,An=In,In=Cn,Cn=En+_i|0,En=_n,_n=Qr,Qr=Jr,Jr=_i+oo|0}qr[0]+=Jr,qr[1]+=Qr,qr[2]+=_n,qr[3]+=En,qr[4]+=Cn,qr[5]+=In,qr[6]+=An,qr[7]+=jn,Vr+=64,Zr-=64}return Vr}function Br(Wr){var qr=new Er;qr.update(Wr);var Gr=qr.digest();return qr.clean(),Gr}fr.hash=Br})(sha256);var x25519={};(function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.sharedKey=fr.generateKeyPair=fr.generateKeyPairFromSeed=fr.scalarMultBase=fr.scalarMult=fr.SHARED_KEY_LENGTH=fr.SECRET_KEY_LENGTH=fr.PUBLIC_KEY_LENGTH=void 0;const br=random,wr=wipe$1;fr.PUBLIC_KEY_LENGTH=32,fr.SECRET_KEY_LENGTH=32,fr.SHARED_KEY_LENGTH=32;function Er(eo){const ro=new Float64Array(16);if(eo)for(let to=0;to>16&1),to[co-1]&=65535;to[15]=_i[15]-32767-(to[14]>>16&1);const io=to[15]>>16&1;to[14]&=65535,Wr(_i,to,1-io)}for(let oo=0;oo<16;oo++)eo[2*oo]=_i[oo]&255,eo[2*oo+1]=_i[oo]>>8}function Gr(eo,ro){for(let to=0;to<16;to++)eo[to]=ro[2*to]+(ro[2*to+1]<<8);eo[15]&=32767}function Vr(eo,ro,to){for(let _i=0;_i<16;_i++)eo[_i]=ro[_i]+to[_i]}function Zr(eo,ro,to){for(let _i=0;_i<16;_i++)eo[_i]=ro[_i]-to[_i]}function Jr(eo,ro,to){let _i,oo,io=0,co=0,so=0,no=0,Tn=0,Hr=0,Xr=0,Sn=0,Rn=0,Pn=0,On=0,Zn=0,Nn=0,wn=0,zn=0,fo=0,vo=0,go=0,uo=0,lo=0,Eo=0,mo=0,yo=0,_o=0,Bo=0,Lo=0,Wo=0,na=0,qo=0,ga=0,wl=0,No=to[0],Fo=to[1],Nl=to[2],Vo=to[3],Uo=to[4],Ml=to[5],$a=to[6],Jo=to[7],Zl=to[8],Cl=to[9],ko=to[10],wo=to[11],bo=to[12],Io=to[13],Ho=to[14],Do=to[15];_i=ro[0],io+=_i*No,co+=_i*Fo,so+=_i*Nl,no+=_i*Vo,Tn+=_i*Uo,Hr+=_i*Ml,Xr+=_i*$a,Sn+=_i*Jo,Rn+=_i*Zl,Pn+=_i*Cl,On+=_i*ko,Zn+=_i*wo,Nn+=_i*bo,wn+=_i*Io,zn+=_i*Ho,fo+=_i*Do,_i=ro[1],co+=_i*No,so+=_i*Fo,no+=_i*Nl,Tn+=_i*Vo,Hr+=_i*Uo,Xr+=_i*Ml,Sn+=_i*$a,Rn+=_i*Jo,Pn+=_i*Zl,On+=_i*Cl,Zn+=_i*ko,Nn+=_i*wo,wn+=_i*bo,zn+=_i*Io,fo+=_i*Ho,vo+=_i*Do,_i=ro[2],so+=_i*No,no+=_i*Fo,Tn+=_i*Nl,Hr+=_i*Vo,Xr+=_i*Uo,Sn+=_i*Ml,Rn+=_i*$a,Pn+=_i*Jo,On+=_i*Zl,Zn+=_i*Cl,Nn+=_i*ko,wn+=_i*wo,zn+=_i*bo,fo+=_i*Io,vo+=_i*Ho,go+=_i*Do,_i=ro[3],no+=_i*No,Tn+=_i*Fo,Hr+=_i*Nl,Xr+=_i*Vo,Sn+=_i*Uo,Rn+=_i*Ml,Pn+=_i*$a,On+=_i*Jo,Zn+=_i*Zl,Nn+=_i*Cl,wn+=_i*ko,zn+=_i*wo,fo+=_i*bo,vo+=_i*Io,go+=_i*Ho,uo+=_i*Do,_i=ro[4],Tn+=_i*No,Hr+=_i*Fo,Xr+=_i*Nl,Sn+=_i*Vo,Rn+=_i*Uo,Pn+=_i*Ml,On+=_i*$a,Zn+=_i*Jo,Nn+=_i*Zl,wn+=_i*Cl,zn+=_i*ko,fo+=_i*wo,vo+=_i*bo,go+=_i*Io,uo+=_i*Ho,lo+=_i*Do,_i=ro[5],Hr+=_i*No,Xr+=_i*Fo,Sn+=_i*Nl,Rn+=_i*Vo,Pn+=_i*Uo,On+=_i*Ml,Zn+=_i*$a,Nn+=_i*Jo,wn+=_i*Zl,zn+=_i*Cl,fo+=_i*ko,vo+=_i*wo,go+=_i*bo,uo+=_i*Io,lo+=_i*Ho,Eo+=_i*Do,_i=ro[6],Xr+=_i*No,Sn+=_i*Fo,Rn+=_i*Nl,Pn+=_i*Vo,On+=_i*Uo,Zn+=_i*Ml,Nn+=_i*$a,wn+=_i*Jo,zn+=_i*Zl,fo+=_i*Cl,vo+=_i*ko,go+=_i*wo,uo+=_i*bo,lo+=_i*Io,Eo+=_i*Ho,mo+=_i*Do,_i=ro[7],Sn+=_i*No,Rn+=_i*Fo,Pn+=_i*Nl,On+=_i*Vo,Zn+=_i*Uo,Nn+=_i*Ml,wn+=_i*$a,zn+=_i*Jo,fo+=_i*Zl,vo+=_i*Cl,go+=_i*ko,uo+=_i*wo,lo+=_i*bo,Eo+=_i*Io,mo+=_i*Ho,yo+=_i*Do,_i=ro[8],Rn+=_i*No,Pn+=_i*Fo,On+=_i*Nl,Zn+=_i*Vo,Nn+=_i*Uo,wn+=_i*Ml,zn+=_i*$a,fo+=_i*Jo,vo+=_i*Zl,go+=_i*Cl,uo+=_i*ko,lo+=_i*wo,Eo+=_i*bo,mo+=_i*Io,yo+=_i*Ho,_o+=_i*Do,_i=ro[9],Pn+=_i*No,On+=_i*Fo,Zn+=_i*Nl,Nn+=_i*Vo,wn+=_i*Uo,zn+=_i*Ml,fo+=_i*$a,vo+=_i*Jo,go+=_i*Zl,uo+=_i*Cl,lo+=_i*ko,Eo+=_i*wo,mo+=_i*bo,yo+=_i*Io,_o+=_i*Ho,Bo+=_i*Do,_i=ro[10],On+=_i*No,Zn+=_i*Fo,Nn+=_i*Nl,wn+=_i*Vo,zn+=_i*Uo,fo+=_i*Ml,vo+=_i*$a,go+=_i*Jo,uo+=_i*Zl,lo+=_i*Cl,Eo+=_i*ko,mo+=_i*wo,yo+=_i*bo,_o+=_i*Io,Bo+=_i*Ho,Lo+=_i*Do,_i=ro[11],Zn+=_i*No,Nn+=_i*Fo,wn+=_i*Nl,zn+=_i*Vo,fo+=_i*Uo,vo+=_i*Ml,go+=_i*$a,uo+=_i*Jo,lo+=_i*Zl,Eo+=_i*Cl,mo+=_i*ko,yo+=_i*wo,_o+=_i*bo,Bo+=_i*Io,Lo+=_i*Ho,Wo+=_i*Do,_i=ro[12],Nn+=_i*No,wn+=_i*Fo,zn+=_i*Nl,fo+=_i*Vo,vo+=_i*Uo,go+=_i*Ml,uo+=_i*$a,lo+=_i*Jo,Eo+=_i*Zl,mo+=_i*Cl,yo+=_i*ko,_o+=_i*wo,Bo+=_i*bo,Lo+=_i*Io,Wo+=_i*Ho,na+=_i*Do,_i=ro[13],wn+=_i*No,zn+=_i*Fo,fo+=_i*Nl,vo+=_i*Vo,go+=_i*Uo,uo+=_i*Ml,lo+=_i*$a,Eo+=_i*Jo,mo+=_i*Zl,yo+=_i*Cl,_o+=_i*ko,Bo+=_i*wo,Lo+=_i*bo,Wo+=_i*Io,na+=_i*Ho,qo+=_i*Do,_i=ro[14],zn+=_i*No,fo+=_i*Fo,vo+=_i*Nl,go+=_i*Vo,uo+=_i*Uo,lo+=_i*Ml,Eo+=_i*$a,mo+=_i*Jo,yo+=_i*Zl,_o+=_i*Cl,Bo+=_i*ko,Lo+=_i*wo,Wo+=_i*bo,na+=_i*Io,qo+=_i*Ho,ga+=_i*Do,_i=ro[15],fo+=_i*No,vo+=_i*Fo,go+=_i*Nl,uo+=_i*Vo,lo+=_i*Uo,Eo+=_i*Ml,mo+=_i*$a,yo+=_i*Jo,_o+=_i*Zl,Bo+=_i*Cl,Lo+=_i*ko,Wo+=_i*wo,na+=_i*bo,qo+=_i*Io,ga+=_i*Ho,wl+=_i*Do,io+=38*vo,co+=38*go,so+=38*uo,no+=38*lo,Tn+=38*Eo,Hr+=38*mo,Xr+=38*yo,Sn+=38*_o,Rn+=38*Bo,Pn+=38*Lo,On+=38*Wo,Zn+=38*na,Nn+=38*qo,wn+=38*ga,zn+=38*wl,oo=1,_i=io+oo+65535,oo=Math.floor(_i/65536),io=_i-oo*65536,_i=co+oo+65535,oo=Math.floor(_i/65536),co=_i-oo*65536,_i=so+oo+65535,oo=Math.floor(_i/65536),so=_i-oo*65536,_i=no+oo+65535,oo=Math.floor(_i/65536),no=_i-oo*65536,_i=Tn+oo+65535,oo=Math.floor(_i/65536),Tn=_i-oo*65536,_i=Hr+oo+65535,oo=Math.floor(_i/65536),Hr=_i-oo*65536,_i=Xr+oo+65535,oo=Math.floor(_i/65536),Xr=_i-oo*65536,_i=Sn+oo+65535,oo=Math.floor(_i/65536),Sn=_i-oo*65536,_i=Rn+oo+65535,oo=Math.floor(_i/65536),Rn=_i-oo*65536,_i=Pn+oo+65535,oo=Math.floor(_i/65536),Pn=_i-oo*65536,_i=On+oo+65535,oo=Math.floor(_i/65536),On=_i-oo*65536,_i=Zn+oo+65535,oo=Math.floor(_i/65536),Zn=_i-oo*65536,_i=Nn+oo+65535,oo=Math.floor(_i/65536),Nn=_i-oo*65536,_i=wn+oo+65535,oo=Math.floor(_i/65536),wn=_i-oo*65536,_i=zn+oo+65535,oo=Math.floor(_i/65536),zn=_i-oo*65536,_i=fo+oo+65535,oo=Math.floor(_i/65536),fo=_i-oo*65536,io+=oo-1+37*(oo-1),oo=1,_i=io+oo+65535,oo=Math.floor(_i/65536),io=_i-oo*65536,_i=co+oo+65535,oo=Math.floor(_i/65536),co=_i-oo*65536,_i=so+oo+65535,oo=Math.floor(_i/65536),so=_i-oo*65536,_i=no+oo+65535,oo=Math.floor(_i/65536),no=_i-oo*65536,_i=Tn+oo+65535,oo=Math.floor(_i/65536),Tn=_i-oo*65536,_i=Hr+oo+65535,oo=Math.floor(_i/65536),Hr=_i-oo*65536,_i=Xr+oo+65535,oo=Math.floor(_i/65536),Xr=_i-oo*65536,_i=Sn+oo+65535,oo=Math.floor(_i/65536),Sn=_i-oo*65536,_i=Rn+oo+65535,oo=Math.floor(_i/65536),Rn=_i-oo*65536,_i=Pn+oo+65535,oo=Math.floor(_i/65536),Pn=_i-oo*65536,_i=On+oo+65535,oo=Math.floor(_i/65536),On=_i-oo*65536,_i=Zn+oo+65535,oo=Math.floor(_i/65536),Zn=_i-oo*65536,_i=Nn+oo+65535,oo=Math.floor(_i/65536),Nn=_i-oo*65536,_i=wn+oo+65535,oo=Math.floor(_i/65536),wn=_i-oo*65536,_i=zn+oo+65535,oo=Math.floor(_i/65536),zn=_i-oo*65536,_i=fo+oo+65535,oo=Math.floor(_i/65536),fo=_i-oo*65536,io+=oo-1+37*(oo-1),eo[0]=io,eo[1]=co,eo[2]=so,eo[3]=no,eo[4]=Tn,eo[5]=Hr,eo[6]=Xr,eo[7]=Sn,eo[8]=Rn,eo[9]=Pn,eo[10]=On,eo[11]=Zn,eo[12]=Nn,eo[13]=wn,eo[14]=zn,eo[15]=fo}function Qr(eo,ro){Jr(eo,ro,ro)}function _n(eo,ro){const to=Er();for(let _i=0;_i<16;_i++)to[_i]=ro[_i];for(let _i=253;_i>=0;_i--)Qr(to,to),_i!==2&&_i!==4&&Jr(to,to,ro);for(let _i=0;_i<16;_i++)eo[_i]=to[_i]}function En(eo,ro){const to=new Uint8Array(32),_i=new Float64Array(80),oo=Er(),io=Er(),co=Er(),so=Er(),no=Er(),Tn=Er();for(let Rn=0;Rn<31;Rn++)to[Rn]=eo[Rn];to[31]=eo[31]&127|64,to[0]&=248,Gr(_i,ro);for(let Rn=0;Rn<16;Rn++)io[Rn]=_i[Rn];oo[0]=so[0]=1;for(let Rn=254;Rn>=0;--Rn){const Pn=to[Rn>>>3]>>>(Rn&7)&1;Wr(oo,io,Pn),Wr(co,so,Pn),Vr(no,oo,co),Zr(oo,oo,co),Vr(co,io,so),Zr(io,io,so),Qr(so,no),Qr(Tn,oo),Jr(oo,co,oo),Jr(co,io,no),Vr(no,oo,co),Zr(oo,oo,co),Qr(io,oo),Zr(co,so,Tn),Jr(oo,co,jr),Vr(oo,oo,so),Jr(co,co,oo),Jr(oo,so,Tn),Jr(so,io,_i),Qr(io,no),Wr(oo,io,Pn),Wr(co,so,Pn)}for(let Rn=0;Rn<16;Rn++)_i[Rn+16]=oo[Rn],_i[Rn+32]=co[Rn],_i[Rn+48]=io[Rn],_i[Rn+64]=so[Rn];const Hr=_i.subarray(32),Xr=_i.subarray(16);_n(Hr,Hr),Jr(Xr,Xr,Hr);const Sn=new Uint8Array(32);return qr(Sn,Xr),Sn}fr.scalarMult=En;function Cn(eo){return En(eo,kr)}fr.scalarMultBase=Cn;function In(eo){if(eo.length!==fr.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${fr.SECRET_KEY_LENGTH} bytes`);const ro=new Uint8Array(eo);return{publicKey:Cn(ro),secretKey:ro}}fr.generateKeyPairFromSeed=In;function An(eo){const ro=(0,br.randomBytes)(32,eo),to=In(ro);return(0,wr.wipe)(ro),to}fr.generateKeyPair=An;function jn(eo,ro,to=!1){if(eo.length!==fr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(ro.length!==fr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const _i=En(eo,ro);if(to){let oo=0;for(let io=0;io<_i.length;io++)oo|=_i[io];if(oo===0)throw new Error("X25519: invalid shared key")}return _i}fr.sharedKey=jn})(x25519);function asUint8Array(fr){return globalThis.Buffer!=null?new Uint8Array(fr.buffer,fr.byteOffset,fr.byteLength):fr}function allocUnsafe(fr=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?asUint8Array(globalThis.Buffer.allocUnsafe(fr)):new Uint8Array(fr)}function concat(fr,br){br||(br=fr.reduce((kr,jr)=>kr+jr.length,0));const wr=allocUnsafe(br);let Er=0;for(const kr of fr)wr.set(kr,Er),Er+=kr.length;return asUint8Array(wr)}function base$4(fr,br){if(fr.length>=255)throw new TypeError("Alphabet too long");for(var wr=new Uint8Array(256),Er=0;Er>>0,eo=new Uint8Array(jn);In!==An;){for(var ro=_n[In],to=0,_i=jn-1;(ro!==0||to>>0,eo[_i]=ro%Wr>>>0,ro=ro/Wr>>>0;if(ro!==0)throw new Error("Non-zero carry");Cn=to,In++}for(var oo=jn-Cn;oo!==jn&&eo[oo]===0;)oo++;for(var io=qr.repeat(En);oo>>0,jn=new Uint8Array(An);_n[En];){var eo=wr[_n.charCodeAt(En)];if(eo===255)return;for(var ro=0,to=An-1;(eo!==0||ro>>0,jn[to]=eo%256>>>0,eo=eo/256>>>0;if(eo!==0)throw new Error("Non-zero carry");In=ro,En++}if(_n[En]!==" "){for(var _i=An-In;_i!==An&&jn[_i]===0;)_i++;for(var oo=new Uint8Array(Cn+(An-_i)),io=Cn;_i!==An;)oo[io++]=jn[_i++];return oo}}}function Qr(_n){var En=Jr(_n);if(En)return En;throw new Error(`Non-${br} character`)}return{encode:Zr,decodeUnsafe:Jr,decode:Qr}}var src$4=base$4,_brrp__multiformats_scope_baseX=src$4;const coerce$3=fr=>{if(fr instanceof Uint8Array&&fr.constructor.name==="Uint8Array")return fr;if(fr instanceof ArrayBuffer)return new Uint8Array(fr);if(ArrayBuffer.isView(fr))return new Uint8Array(fr.buffer,fr.byteOffset,fr.byteLength);throw new Error("Unknown type, must be binary type")},fromString$1=fr=>new TextEncoder().encode(fr),toString$1=fr=>new TextDecoder().decode(fr);class Encoder{constructor(br,wr,Er){this.name=br,this.prefix=wr,this.baseEncode=Er}encode(br){if(br instanceof Uint8Array)return`${this.prefix}${this.baseEncode(br)}`;throw Error("Unknown type, must be binary type")}}class Decoder{constructor(br,wr,Er){if(this.name=br,this.prefix=wr,wr.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=wr.codePointAt(0),this.baseDecode=Er}decode(br){if(typeof br=="string"){if(br.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(br)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(br.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(br){return or$2(this,br)}}class ComposedDecoder{constructor(br){this.decoders=br}or(br){return or$2(this,br)}decode(br){const wr=br[0],Er=this.decoders[wr];if(Er)return Er.decode(br);throw RangeError(`Unable to decode multibase string ${JSON.stringify(br)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const or$2=(fr,br)=>new ComposedDecoder({...fr.decoders||{[fr.prefix]:fr},...br.decoders||{[br.prefix]:br}});class Codec{constructor(br,wr,Er,kr){this.name=br,this.prefix=wr,this.baseEncode=Er,this.baseDecode=kr,this.encoder=new Encoder(br,wr,Er),this.decoder=new Decoder(br,wr,kr)}encode(br){return this.encoder.encode(br)}decode(br){return this.decoder.decode(br)}}const from=({name:fr,prefix:br,encode:wr,decode:Er})=>new Codec(fr,br,wr,Er),baseX=({prefix:fr,name:br,alphabet:wr})=>{const{encode:Er,decode:kr}=_brrp__multiformats_scope_baseX(wr,br);return from({prefix:fr,name:br,encode:Er,decode:jr=>coerce$3(kr(jr))})},decode$2=(fr,br,wr,Er)=>{const kr={};for(let Vr=0;Vr=8&&(Wr-=8,Br[Gr++]=255&qr>>Wr)}if(Wr>=wr||255&qr<<8-Wr)throw new SyntaxError("Unexpected end of data");return Br},encode$1=(fr,br,wr)=>{const Er=br[br.length-1]==="=",kr=(1<wr;)Br-=wr,jr+=br[kr&Wr>>Br];if(Br&&(jr+=br[kr&Wr<from({prefix:br,name:fr,encode(kr){return encode$1(kr,Er,wr)},decode(kr){return decode$2(kr,Er,wr,fr)}}),identity=from({prefix:"\0",name:"identity",encode:fr=>toString$1(fr),decode:fr=>fromString$1(fr)}),identityBase=Object.freeze(Object.defineProperty({__proto__:null,identity},Symbol.toStringTag,{value:"Module"})),base2=rfc4648({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),base2$1=Object.freeze(Object.defineProperty({__proto__:null,base2},Symbol.toStringTag,{value:"Module"})),base8=rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$1=Object.freeze(Object.defineProperty({__proto__:null,base8},Symbol.toStringTag,{value:"Module"})),base10=baseX({prefix:"9",name:"base10",alphabet:"0123456789"}),base10$1=Object.freeze(Object.defineProperty({__proto__:null,base10},Symbol.toStringTag,{value:"Module"})),base16=rfc4648({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper=rfc4648({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),base16$1=Object.freeze(Object.defineProperty({__proto__:null,base16,base16upper},Symbol.toStringTag,{value:"Module"})),base32=rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper=rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad=rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper=rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex=rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper=rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad=rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper=rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z=rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$1=Object.freeze(Object.defineProperty({__proto__:null,base32,base32hex,base32hexpad,base32hexpadupper,base32hexupper,base32pad,base32padupper,base32upper,base32z},Symbol.toStringTag,{value:"Module"})),base36=baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$1=Object.freeze(Object.defineProperty({__proto__:null,base36,base36upper},Symbol.toStringTag,{value:"Module"})),base58btc=baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr=baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58=Object.freeze(Object.defineProperty({__proto__:null,base58btc,base58flickr},Symbol.toStringTag,{value:"Module"})),base64=rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$1=Object.freeze(Object.defineProperty({__proto__:null,base64,base64pad,base64url,base64urlpad},Symbol.toStringTag,{value:"Module"})),alphabet=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),alphabetBytesToChars=alphabet.reduce((fr,br,wr)=>(fr[wr]=br,fr),[]),alphabetCharsToBytes=alphabet.reduce((fr,br,wr)=>(fr[br.codePointAt(0)]=wr,fr),[]);function encode(fr){return fr.reduce((br,wr)=>(br+=alphabetBytesToChars[wr],br),"")}function decode$1(fr){const br=[];for(const wr of fr){const Er=alphabetCharsToBytes[wr.codePointAt(0)];if(Er===void 0)throw new Error(`Non-base256emoji character: ${wr}`);br.push(Er)}return new Uint8Array(br)}const base256emoji=from({prefix:"🚀",name:"base256emoji",encode,decode:decode$1}),base256emoji$1=Object.freeze(Object.defineProperty({__proto__:null,base256emoji},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const bases={...identityBase,...base2$1,...base8$1,...base10$1,...base16$1,...base32$1,...base36$1,...base58,...base64$1,...base256emoji$1};function createCodec(fr,br,wr,Er){return{name:fr,prefix:br,encoder:{name:fr,prefix:br,encode:wr},decoder:{decode:Er}}}const string$3=createCodec("utf8","u",fr=>"u"+new TextDecoder("utf8").decode(fr),fr=>new TextEncoder().encode(fr.substring(1))),ascii=createCodec("ascii","a",fr=>{let br="a";for(let wr=0;wr{fr=fr.substring(1);const br=allocUnsafe(fr.length);for(let wr=0;wr"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ReactNativeInfo:typeof navigator<"u"?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(fr){return fr!==""&&userAgentRules.reduce(function(br,wr){var Er=wr[0],kr=wr[1];if(br)return br;var jr=kr.exec(fr);return!!jr&&[Er,jr]},!1)}function parseUserAgent(fr){var br=matchUserAgent(fr);if(!br)return null;var wr=br[0],Er=br[1];if(wr==="searchbot")return new BotInfo;var kr=Er[1]&&Er[1].split(".").join("_").split("_").slice(0,3);kr?kr.lengthkr+String.fromCharCode(jr),""))}function base64StringToBase64UrlEncodedString(fr){return fr.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function uint8ArrayToHexString(fr){return fr.reduce((br,wr)=>br+wr.toString(16).padStart(2,"0"),"")}const uint8ArrayFromHexString=(fr,br)=>{const wr=/^[0-9A-Fa-f]+$/;if(!fr||fr.length%2!=0||!wr.test(fr))throw new Error(`cannot create uint8array from invalid hex string: "${fr}"`);const Er=new Uint8Array(fr.match(/../g).map(jr=>parseInt(jr,16)));if(!br)return Er;if(fr.length/2>br)throw new Error("hex value cannot fit in a buffer of "+br+" byte(s)");let kr=new Uint8Array(br);return kr.set(Er,br-Er.length),kr};function btoa$1(fr){if(arguments.length===0)throw new TypeError("1 argument required, but only 0 present.");let br;for(fr=`${fr}`,br=0;br255)throw new Error(`InvalidCharacterError: found code point greater than 255:${fr.charCodeAt(br)} at position ${br}`);let wr="";for(br=0;br>2,Er[1]=(fr.charCodeAt(br)&3)<<4,fr.length>br+1&&(Er[1]|=fr.charCodeAt(br+1)>>4,Er[2]=(fr.charCodeAt(br+1)&15)<<2),fr.length>br+2&&(Er[2]|=fr.charCodeAt(br+2)>>6,Er[3]=fr.charCodeAt(br+2)&63);for(let kr=0;kr"u"?wr+="=":wr+=btoaLookup(Er[kr])}return wr}function btoaLookup(fr){const br="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";if(fr>=0&&fr<64)return br[fr]}const stampHeaderName$2="X-Stamp",isCryptoEnabledBrowser=typeof window<"u"&&typeof window.document<"u"&&typeof crypto<"u"&&typeof crypto.subtle<"u",isNode=typeof process$1$1<"u"&&process$1$1.versions!=null&&process$1$1.versions.node!=null,signWithApiKey=async fr=>isCryptoEnabledBrowser?(await __vitePreload(()=>import("./webcrypto-CPaydEYP.js"),__vite__mapDeps([0,1])).then(wr=>wr.signWithApiKey))(fr):isNode?(await __vitePreload(()=>import("./nodecrypto-CtIF-oIC.js"),__vite__mapDeps([2,1])).then(wr=>wr.signWithApiKey))(fr):(await __vitePreload(()=>import("./purejs-DPZGIi36.js"),[]).then(wr=>wr.signWithApiKey))(fr);class ApiKeyStamper{constructor(br){this.apiPublicKey=br.apiPublicKey,this.apiPrivateKey=br.apiPrivateKey}async stamp(br){const wr=await signWithApiKey({publicKey:this.apiPublicKey,privateKey:this.apiPrivateKey,content:br}),Er={publicKey:this.apiPublicKey,scheme:"SIGNATURE_SCHEME_TK_API_P256",signature:wr};return{stampHeaderName:stampHeaderName$2,stampHeaderValue:stringToBase64urlString(JSON.stringify(Er))}}}const base64UrlEncode=fr=>Buffer$2.from(fr).toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,""),generateRandomBuffer=()=>{const fr=new Uint8Array(32);return crypto.getRandomValues(fr),fr.buffer},transportMap={AUTHENTICATOR_TRANSPORT_BLE:AuthenticatorTransportProtocol.Ble,AUTHENTICATOR_TRANSPORT_HYBRID:AuthenticatorTransportProtocol.Hybrid,AUTHENTICATOR_TRANSPORT_INTERNAL:AuthenticatorTransportProtocol.Internal,AUTHENTICATOR_TRANSPORT_NFC:AuthenticatorTransportProtocol.Nfc,AUTHENTICATOR_TRANSPORT_USB:AuthenticatorTransportProtocol.Usb},convertAttestationTransports=fr=>fr.map(br=>transportMap[br]),TURNKEY_API_BASE_URL="https://api.turnkey.com",TURNKEY_API_KEY_EXPIRY_MESSAGE="Turnkey error 16: expired api key",TURNKEY_API_KEY_NOT_FOUND_MESSAGE="Turnkey error 16: could not find public key",WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE="The operation either timed out or was not allowed",WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE="The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.",INVALID_PASSKEY_SELECTED_ERROR_MESSAGE="Turnkey error 5: webauthn authenticator not found in organization or parent organization",USER_CANCELLED_REQUEST_ERROR_MESSAGE="The user cancelled the request",TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS=[TURNKEY_API_KEY_EXPIRY_MESSAGE,TURNKEY_API_KEY_NOT_FOUND_MESSAGE],TURNKEY_SDK_BENIGN_ERRORS=[WEBAUTHN_NOT_SUPPORTED_OR_CANCELLED_ERROR_MESSAGE,WEBAUTHN_NOT_SUPPORTED_OR_DISABLED_ERROR_MESSAGE,INVALID_PASSKEY_SELECTED_ERROR_MESSAGE,USER_CANCELLED_REQUEST_ERROR_MESSAGE];class DynamicEmbeddedWalletsLogger extends Logger$1{constructor(br,wr){super(br,wr)}error(br,...wr){const[Er]=wr;!(Er!=null&&Er.message)||!TURNKEY_SDK_BENIGN_ERRORS.some(kr=>Er.message.includes(kr))?(Logger$1.events.emit("error",br),this.log(LogLevel.ERROR,br,...wr)):this.warn(br,...wr)}}const logger$4=new DynamicEmbeddedWalletsLogger("Dynamic embedded wallets",LogLevel.INFO),stampHeaderName$1="X-Stamp";var IframeEventType;(function(fr){fr.PublicKeyReady="PUBLIC_KEY_READY",fr.InjectCredentialBundle="INJECT_CREDENTIAL_BUNDLE",fr.InjectKeyExportBundle="INJECT_KEY_EXPORT_BUNDLE",fr.InjectWalletExportBundle="INJECT_WALLET_EXPORT_BUNDLE",fr.InjectImportBundle="INJECT_IMPORT_BUNDLE",fr.ExtractWalletEncryptedBundle="EXTRACT_WALLET_ENCRYPTED_BUNDLE",fr.ExtractKeyEncryptedBundle="EXTRACT_KEY_ENCRYPTED_BUNDLE",fr.ApplySettings="APPLY_SETTINGS",fr.BundleInjected="BUNDLE_INJECTED",fr.EncryptedBundleExtracted="ENCRYPTED_BUNDLE_EXTRACTED",fr.SettingsApplied="SETTINGS_APPLIED",fr.StampRequest="STAMP_REQUEST",fr.Stamp="STAMP",fr.Error="ERROR"})(IframeEventType||(IframeEventType={}));var KeyFormat;(function(fr){fr.Hexadecimal="HEXADECIMAL",fr.Solana="SOLANA"})(KeyFormat||(KeyFormat={}));class IframeStamper{constructor(br){if(typeof window>"u")throw new Error("Cannot initialize iframe in non-browser environment");if(!br.iframeContainer)throw new Error("Iframe container cannot be found");if(this.container=br.iframeContainer,this.container.querySelector(`#${br.iframeElementId}`))throw new Error(`Iframe element with ID ${br.iframeElementId} already exists`);let wr=window.document.createElement("iframe");wr.setAttribute("sandbox","allow-scripts allow-same-origin"),wr.id=br.iframeElementId,wr.src=br.iframeUrl,this.iframe=wr;const Er=new URL(br.iframeUrl);this.iframeOrigin=Er.origin,this.iframePublicKey=null}async init(){return this.container.appendChild(this.iframe),new Promise((br,wr)=>{window.addEventListener("message",Er=>{var kr;Er.origin===this.iframeOrigin&&((kr=Er.data)==null?void 0:kr.type)===IframeEventType.PublicKeyReady&&(this.iframePublicKey=Er.data.value,br(Er.data.value))},!1)})}clear(){this.iframe.remove()}publicKey(){return this.iframePublicKey}async injectCredentialBundle(br){return new Promise((wr,Er)=>{var kr;(kr=this.iframe.contentWindow)==null||kr.postMessage({type:IframeEventType.InjectCredentialBundle,value:br},"*"),window.addEventListener("message",jr=>{var Br,Wr;jr.origin===this.iframeOrigin&&(((Br=jr.data)==null?void 0:Br.type)===IframeEventType.BundleInjected&&wr(jr.data.value),((Wr=jr.data)==null?void 0:Wr.type)===IframeEventType.Error&&Er(jr.data.value))},!1)})}async injectKeyExportBundle(br,wr,Er){var kr;return(kr=this.iframe.contentWindow)==null||kr.postMessage({type:IframeEventType.InjectKeyExportBundle,value:br,keyFormat:Er,organizationId:wr},"*"),new Promise((jr,Br)=>{window.addEventListener("message",Wr=>{var qr,Gr;Wr.origin===this.iframeOrigin&&(((qr=Wr.data)==null?void 0:qr.type)===IframeEventType.BundleInjected&&jr(Wr.data.value),((Gr=Wr.data)==null?void 0:Gr.type)===IframeEventType.Error&&Br(Wr.data.value))},!1)})}async injectWalletExportBundle(br,wr){var Er;return(Er=this.iframe.contentWindow)==null||Er.postMessage({type:IframeEventType.InjectWalletExportBundle,value:br,organizationId:wr},"*"),new Promise((kr,jr)=>{window.addEventListener("message",Br=>{var Wr,qr;Br.origin===this.iframeOrigin&&(((Wr=Br.data)==null?void 0:Wr.type)===IframeEventType.BundleInjected&&kr(Br.data.value),((qr=Br.data)==null?void 0:qr.type)===IframeEventType.Error&&jr(Br.data.value))},!1)})}async injectImportBundle(br,wr,Er){var kr;return(kr=this.iframe.contentWindow)==null||kr.postMessage({type:IframeEventType.InjectImportBundle,value:br,organizationId:wr,userId:Er},"*"),new Promise((jr,Br)=>{window.addEventListener("message",Wr=>{var qr,Gr;Wr.origin===this.iframeOrigin&&(((qr=Wr.data)==null?void 0:qr.type)===IframeEventType.BundleInjected&&jr(Wr.data.value),((Gr=Wr.data)==null?void 0:Gr.type)===IframeEventType.Error&&Br(Wr.data.value))},!1)})}async extractWalletEncryptedBundle(){var br;return(br=this.iframe.contentWindow)==null||br.postMessage({type:IframeEventType.ExtractWalletEncryptedBundle},"*"),new Promise((wr,Er)=>{window.addEventListener("message",kr=>{var jr,Br;kr.origin===this.iframeOrigin&&(((jr=kr.data)==null?void 0:jr.type)===IframeEventType.EncryptedBundleExtracted&&wr(kr.data.value),((Br=kr.data)==null?void 0:Br.type)===IframeEventType.Error&&Er(kr.data.value))},!1)})}async extractKeyEncryptedBundle(br){var wr;return(wr=this.iframe.contentWindow)==null||wr.postMessage({type:IframeEventType.ExtractKeyEncryptedBundle,keyFormat:br},"*"),new Promise((Er,kr)=>{window.addEventListener("message",jr=>{var Br,Wr;jr.origin===this.iframeOrigin&&(((Br=jr.data)==null?void 0:Br.type)===IframeEventType.EncryptedBundleExtracted&&Er(jr.data.value),((Wr=jr.data)==null?void 0:Wr.type)===IframeEventType.Error&&kr(jr.data.value))},!1)})}async applySettings(br){var Er;const wr=JSON.stringify(br);return(Er=this.iframe.contentWindow)==null||Er.postMessage({type:IframeEventType.ApplySettings,value:wr},"*"),new Promise((kr,jr)=>{window.addEventListener("message",Br=>{var Wr,qr;Br.origin===this.iframeOrigin&&(((Wr=Br.data)==null?void 0:Wr.type)===IframeEventType.SettingsApplied&&kr(Br.data.value),((qr=Br.data)==null?void 0:qr.type)===IframeEventType.Error&&jr(Br.data.value))},!1)})}async stamp(br){var Er;if(this.iframePublicKey===null)throw new Error("null iframe public key. Have you called/awaited .init()?");const wr=this.iframeOrigin;return(Er=this.iframe.contentWindow)==null||Er.postMessage({type:IframeEventType.StampRequest,value:br},"*"),new Promise(function(kr,jr){window.addEventListener("message",Br=>{var Wr,qr;Br.origin===wr&&(((Wr=Br.data)==null?void 0:Wr.type)===IframeEventType.Stamp&&kr({stampHeaderName:stampHeaderName$1,stampHeaderValue:Br.data.value}),((qr=Br.data)==null?void 0:qr.type)===IframeEventType.Error&&jr(Br.data.value))},!1)})}}var browserPonyfill={exports:{}};(function(fr,br){var wr=typeof self<"u"?self:commonjsGlobal,Er=function(){function jr(){this.fetch=!1,this.DOMException=wr.DOMException}return jr.prototype=wr,new jr}();(function(jr){(function(Br){var Wr={searchParams:"URLSearchParams"in jr,iterable:"Symbol"in jr&&"iterator"in Symbol,blob:"FileReader"in jr&&"Blob"in jr&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in jr,arrayBuffer:"ArrayBuffer"in jr};function qr(Hr){return Hr&&DataView.prototype.isPrototypeOf(Hr)}if(Wr.arrayBuffer)var Gr=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],Vr=ArrayBuffer.isView||function(Hr){return Hr&&Gr.indexOf(Object.prototype.toString.call(Hr))>-1};function Zr(Hr){if(typeof Hr!="string"&&(Hr=String(Hr)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(Hr))throw new TypeError("Invalid character in header field name");return Hr.toLowerCase()}function Jr(Hr){return typeof Hr!="string"&&(Hr=String(Hr)),Hr}function Qr(Hr){var Xr={next:function(){var Sn=Hr.shift();return{done:Sn===void 0,value:Sn}}};return Wr.iterable&&(Xr[Symbol.iterator]=function(){return Xr}),Xr}function _n(Hr){this.map={},Hr instanceof _n?Hr.forEach(function(Xr,Sn){this.append(Sn,Xr)},this):Array.isArray(Hr)?Hr.forEach(function(Xr){this.append(Xr[0],Xr[1])},this):Hr&&Object.getOwnPropertyNames(Hr).forEach(function(Xr){this.append(Xr,Hr[Xr])},this)}_n.prototype.append=function(Hr,Xr){Hr=Zr(Hr),Xr=Jr(Xr);var Sn=this.map[Hr];this.map[Hr]=Sn?Sn+", "+Xr:Xr},_n.prototype.delete=function(Hr){delete this.map[Zr(Hr)]},_n.prototype.get=function(Hr){return Hr=Zr(Hr),this.has(Hr)?this.map[Hr]:null},_n.prototype.has=function(Hr){return this.map.hasOwnProperty(Zr(Hr))},_n.prototype.set=function(Hr,Xr){this.map[Zr(Hr)]=Jr(Xr)},_n.prototype.forEach=function(Hr,Xr){for(var Sn in this.map)this.map.hasOwnProperty(Sn)&&Hr.call(Xr,this.map[Sn],Sn,this)},_n.prototype.keys=function(){var Hr=[];return this.forEach(function(Xr,Sn){Hr.push(Sn)}),Qr(Hr)},_n.prototype.values=function(){var Hr=[];return this.forEach(function(Xr){Hr.push(Xr)}),Qr(Hr)},_n.prototype.entries=function(){var Hr=[];return this.forEach(function(Xr,Sn){Hr.push([Sn,Xr])}),Qr(Hr)},Wr.iterable&&(_n.prototype[Symbol.iterator]=_n.prototype.entries);function En(Hr){if(Hr.bodyUsed)return Promise.reject(new TypeError("Already read"));Hr.bodyUsed=!0}function Cn(Hr){return new Promise(function(Xr,Sn){Hr.onload=function(){Xr(Hr.result)},Hr.onerror=function(){Sn(Hr.error)}})}function In(Hr){var Xr=new FileReader,Sn=Cn(Xr);return Xr.readAsArrayBuffer(Hr),Sn}function An(Hr){var Xr=new FileReader,Sn=Cn(Xr);return Xr.readAsText(Hr),Sn}function jn(Hr){for(var Xr=new Uint8Array(Hr),Sn=new Array(Xr.length),Rn=0;Rn-1?Xr:Hr}function oo(Hr,Xr){Xr=Xr||{};var Sn=Xr.body;if(Hr instanceof oo){if(Hr.bodyUsed)throw new TypeError("Already read");this.url=Hr.url,this.credentials=Hr.credentials,Xr.headers||(this.headers=new _n(Hr.headers)),this.method=Hr.method,this.mode=Hr.mode,this.signal=Hr.signal,!Sn&&Hr._bodyInit!=null&&(Sn=Hr._bodyInit,Hr.bodyUsed=!0)}else this.url=String(Hr);if(this.credentials=Xr.credentials||this.credentials||"same-origin",(Xr.headers||!this.headers)&&(this.headers=new _n(Xr.headers)),this.method=_i(Xr.method||this.method||"GET"),this.mode=Xr.mode||this.mode||null,this.signal=Xr.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&Sn)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(Sn)}oo.prototype.clone=function(){return new oo(this,{body:this._bodyInit})};function io(Hr){var Xr=new FormData;return Hr.trim().split("&").forEach(function(Sn){if(Sn){var Rn=Sn.split("="),Pn=Rn.shift().replace(/\+/g," "),On=Rn.join("=").replace(/\+/g," ");Xr.append(decodeURIComponent(Pn),decodeURIComponent(On))}}),Xr}function co(Hr){var Xr=new _n,Sn=Hr.replace(/\r?\n[\t ]+/g," ");return Sn.split(/\r?\n/).forEach(function(Rn){var Pn=Rn.split(":"),On=Pn.shift().trim();if(On){var Zn=Pn.join(":").trim();Xr.append(On,Zn)}}),Xr}ro.call(oo.prototype);function so(Hr,Xr){Xr||(Xr={}),this.type="default",this.status=Xr.status===void 0?200:Xr.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in Xr?Xr.statusText:"OK",this.headers=new _n(Xr.headers),this.url=Xr.url||"",this._initBody(Hr)}ro.call(so.prototype),so.prototype.clone=function(){return new so(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new _n(this.headers),url:this.url})},so.error=function(){var Hr=new so(null,{status:0,statusText:""});return Hr.type="error",Hr};var no=[301,302,303,307,308];so.redirect=function(Hr,Xr){if(no.indexOf(Xr)===-1)throw new RangeError("Invalid status code");return new so(null,{status:Xr,headers:{location:Hr}})},Br.DOMException=jr.DOMException;try{new Br.DOMException}catch{Br.DOMException=function(Xr,Sn){this.message=Xr,this.name=Sn;var Rn=Error(Xr);this.stack=Rn.stack},Br.DOMException.prototype=Object.create(Error.prototype),Br.DOMException.prototype.constructor=Br.DOMException}function Tn(Hr,Xr){return new Promise(function(Sn,Rn){var Pn=new oo(Hr,Xr);if(Pn.signal&&Pn.signal.aborted)return Rn(new Br.DOMException("Aborted","AbortError"));var On=new XMLHttpRequest;function Zn(){On.abort()}On.onload=function(){var Nn={status:On.status,statusText:On.statusText,headers:co(On.getAllResponseHeaders()||"")};Nn.url="responseURL"in On?On.responseURL:Nn.headers.get("X-Request-URL");var wn="response"in On?On.response:On.responseText;Sn(new so(wn,Nn))},On.onerror=function(){Rn(new TypeError("Network request failed"))},On.ontimeout=function(){Rn(new TypeError("Network request failed"))},On.onabort=function(){Rn(new Br.DOMException("Aborted","AbortError"))},On.open(Pn.method,Pn.url,!0),Pn.credentials==="include"?On.withCredentials=!0:Pn.credentials==="omit"&&(On.withCredentials=!1),"responseType"in On&&Wr.blob&&(On.responseType="blob"),Pn.headers.forEach(function(Nn,wn){On.setRequestHeader(wn,Nn)}),Pn.signal&&(Pn.signal.addEventListener("abort",Zn),On.onreadystatechange=function(){On.readyState===4&&Pn.signal.removeEventListener("abort",Zn)}),On.send(typeof Pn._bodyInit>"u"?null:Pn._bodyInit)})}return Tn.polyfill=!0,jr.fetch||(jr.fetch=Tn,jr.Headers=_n,jr.Request=oo,jr.Response=so),Br.Headers=_n,Br.Request=oo,Br.Response=so,Br.fetch=Tn,Object.defineProperty(Br,"__esModule",{value:!0}),Br})({})})(Er),Er.fetch.ponyfill=!0,delete Er.fetch.polyfill;var kr=Er;br=kr.fetch,br.default=kr.fetch,br.fetch=kr.fetch,br.Headers=kr.Headers,br.Request=kr.Request,br.Response=kr.Response,fr.exports=br})(browserPonyfill,browserPonyfill.exports);var browserPonyfillExports=browserPonyfill.exports;const o$2=getDefaultExportFromCjs$2(browserPonyfillExports),fetch$1=browserPonyfillExports.fetch;class TurnkeyRequestError extends Error{constructor(br){let wr=`Turnkey error ${br.code}: ${br.message}`;br.details!=null&&(wr+=` (Details: ${JSON.stringify(br.details)})`),super(wr),this.name="TurnkeyRequestError",this.details=br.details??null,this.code=br.code}}const VERSION$1="@turnkey/http@2.12.2";class TurnkeyClient{constructor(br,wr){if(this.getActivity=async Er=>this.request("/public/v1/query/get_activity",Er),this.stampGetActivity=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_activity",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getApiKey=async Er=>this.request("/public/v1/query/get_api_key",Er),this.stampGetApiKey=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_api_key",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getApiKeys=async Er=>this.request("/public/v1/query/get_api_keys",Er),this.stampGetApiKeys=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_api_keys",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getAttestationDocument=async Er=>this.request("/public/v1/query/get_attestation",Er),this.stampGetAttestationDocument=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_attestation",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getAuthenticator=async Er=>this.request("/public/v1/query/get_authenticator",Er),this.stampGetAuthenticator=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_authenticator",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getAuthenticators=async Er=>this.request("/public/v1/query/get_authenticators",Er),this.stampGetAuthenticators=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_authenticators",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getOauthProviders=async Er=>this.request("/public/v1/query/get_oauth_providers",Er),this.stampGetOauthProviders=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_oauth_providers",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getOrganization=async Er=>this.request("/public/v1/query/get_organization",Er),this.stampGetOrganization=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_organization",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getOrganizationConfigs=async Er=>this.request("/public/v1/query/get_organization_configs",Er),this.stampGetOrganizationConfigs=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_organization_configs",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getPolicy=async Er=>this.request("/public/v1/query/get_policy",Er),this.stampGetPolicy=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_policy",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getPrivateKey=async Er=>this.request("/public/v1/query/get_private_key",Er),this.stampGetPrivateKey=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_private_key",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getUser=async Er=>this.request("/public/v1/query/get_user",Er),this.stampGetUser=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_user",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getWallet=async Er=>this.request("/public/v1/query/get_wallet",Er),this.stampGetWallet=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/get_wallet",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getActivities=async Er=>this.request("/public/v1/query/list_activities",Er),this.stampGetActivities=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_activities",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getPolicies=async Er=>this.request("/public/v1/query/list_policies",Er),this.stampGetPolicies=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_policies",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.listPrivateKeyTags=async Er=>this.request("/public/v1/query/list_private_key_tags",Er),this.stampListPrivateKeyTags=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_private_key_tags",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getPrivateKeys=async Er=>this.request("/public/v1/query/list_private_keys",Er),this.stampGetPrivateKeys=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_private_keys",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getSubOrgIds=async Er=>this.request("/public/v1/query/list_suborgs",Er),this.stampGetSubOrgIds=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_suborgs",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.listUserTags=async Er=>this.request("/public/v1/query/list_user_tags",Er),this.stampListUserTags=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_user_tags",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getUsers=async Er=>this.request("/public/v1/query/list_users",Er),this.stampGetUsers=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_users",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getWalletAccounts=async Er=>this.request("/public/v1/query/list_wallet_accounts",Er),this.stampGetWalletAccounts=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_wallet_accounts",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getWallets=async Er=>this.request("/public/v1/query/list_wallets",Er),this.stampGetWallets=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/list_wallets",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.getWhoami=async Er=>this.request("/public/v1/query/whoami",Er),this.stampGetWhoami=async Er=>{const kr=this.config.baseUrl+"/public/v1/query/whoami",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.approveActivity=async Er=>this.request("/public/v1/submit/approve_activity",Er),this.stampApproveActivity=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/approve_activity",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createApiKeys=async Er=>this.request("/public/v1/submit/create_api_keys",Er),this.stampCreateApiKeys=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_api_keys",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createApiOnlyUsers=async Er=>this.request("/public/v1/submit/create_api_only_users",Er),this.stampCreateApiOnlyUsers=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_api_only_users",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createAuthenticators=async Er=>this.request("/public/v1/submit/create_authenticators",Er),this.stampCreateAuthenticators=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_authenticators",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createInvitations=async Er=>this.request("/public/v1/submit/create_invitations",Er),this.stampCreateInvitations=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_invitations",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createOauthProviders=async Er=>this.request("/public/v1/submit/create_oauth_providers",Er),this.stampCreateOauthProviders=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_oauth_providers",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createPolicies=async Er=>this.request("/public/v1/submit/create_policies",Er),this.stampCreatePolicies=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_policies",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createPolicy=async Er=>this.request("/public/v1/submit/create_policy",Er),this.stampCreatePolicy=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_policy",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createPrivateKeyTag=async Er=>this.request("/public/v1/submit/create_private_key_tag",Er),this.stampCreatePrivateKeyTag=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_private_key_tag",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createPrivateKeys=async Er=>this.request("/public/v1/submit/create_private_keys",Er),this.stampCreatePrivateKeys=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_private_keys",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createReadOnlySession=async Er=>this.request("/public/v1/submit/create_read_only_session",Er),this.stampCreateReadOnlySession=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_read_only_session",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createReadWriteSession=async Er=>this.request("/public/v1/submit/create_read_write_session",Er),this.stampCreateReadWriteSession=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_read_write_session",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createSubOrganization=async Er=>this.request("/public/v1/submit/create_sub_organization",Er),this.stampCreateSubOrganization=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_sub_organization",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createUserTag=async Er=>this.request("/public/v1/submit/create_user_tag",Er),this.stampCreateUserTag=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_user_tag",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createUsers=async Er=>this.request("/public/v1/submit/create_users",Er),this.stampCreateUsers=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_users",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createWallet=async Er=>this.request("/public/v1/submit/create_wallet",Er),this.stampCreateWallet=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_wallet",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.createWalletAccounts=async Er=>this.request("/public/v1/submit/create_wallet_accounts",Er),this.stampCreateWalletAccounts=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/create_wallet_accounts",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.deleteApiKeys=async Er=>this.request("/public/v1/submit/delete_api_keys",Er),this.stampDeleteApiKeys=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/delete_api_keys",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.deleteAuthenticators=async Er=>this.request("/public/v1/submit/delete_authenticators",Er),this.stampDeleteAuthenticators=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/delete_authenticators",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.deleteInvitation=async Er=>this.request("/public/v1/submit/delete_invitation",Er),this.stampDeleteInvitation=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/delete_invitation",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.deleteOauthProviders=async Er=>this.request("/public/v1/submit/delete_oauth_providers",Er),this.stampDeleteOauthProviders=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/delete_oauth_providers",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.deletePolicy=async Er=>this.request("/public/v1/submit/delete_policy",Er),this.stampDeletePolicy=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/delete_policy",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.deletePrivateKeyTags=async Er=>this.request("/public/v1/submit/delete_private_key_tags",Er),this.stampDeletePrivateKeyTags=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/delete_private_key_tags",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.deleteUserTags=async Er=>this.request("/public/v1/submit/delete_user_tags",Er),this.stampDeleteUserTags=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/delete_user_tags",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.deleteUsers=async Er=>this.request("/public/v1/submit/delete_users",Er),this.stampDeleteUsers=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/delete_users",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.emailAuth=async Er=>this.request("/public/v1/submit/email_auth",Er),this.stampEmailAuth=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/email_auth",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.exportPrivateKey=async Er=>this.request("/public/v1/submit/export_private_key",Er),this.stampExportPrivateKey=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/export_private_key",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.exportWallet=async Er=>this.request("/public/v1/submit/export_wallet",Er),this.stampExportWallet=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/export_wallet",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.exportWalletAccount=async Er=>this.request("/public/v1/submit/export_wallet_account",Er),this.stampExportWalletAccount=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/export_wallet_account",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.importPrivateKey=async Er=>this.request("/public/v1/submit/import_private_key",Er),this.stampImportPrivateKey=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/import_private_key",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.importWallet=async Er=>this.request("/public/v1/submit/import_wallet",Er),this.stampImportWallet=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/import_wallet",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.initImportPrivateKey=async Er=>this.request("/public/v1/submit/init_import_private_key",Er),this.stampInitImportPrivateKey=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/init_import_private_key",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.initImportWallet=async Er=>this.request("/public/v1/submit/init_import_wallet",Er),this.stampInitImportWallet=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/init_import_wallet",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.initUserEmailRecovery=async Er=>this.request("/public/v1/submit/init_user_email_recovery",Er),this.stampInitUserEmailRecovery=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/init_user_email_recovery",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.oauth=async Er=>this.request("/public/v1/submit/oauth",Er),this.stampOauth=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/oauth",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.recoverUser=async Er=>this.request("/public/v1/submit/recover_user",Er),this.stampRecoverUser=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/recover_user",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.rejectActivity=async Er=>this.request("/public/v1/submit/reject_activity",Er),this.stampRejectActivity=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/reject_activity",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.removeOrganizationFeature=async Er=>this.request("/public/v1/submit/remove_organization_feature",Er),this.stampRemoveOrganizationFeature=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/remove_organization_feature",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.setOrganizationFeature=async Er=>this.request("/public/v1/submit/set_organization_feature",Er),this.stampSetOrganizationFeature=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/set_organization_feature",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.signRawPayload=async Er=>this.request("/public/v1/submit/sign_raw_payload",Er),this.stampSignRawPayload=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/sign_raw_payload",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.signRawPayloads=async Er=>this.request("/public/v1/submit/sign_raw_payloads",Er),this.stampSignRawPayloads=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/sign_raw_payloads",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.signTransaction=async Er=>this.request("/public/v1/submit/sign_transaction",Er),this.stampSignTransaction=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/sign_transaction",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.updatePolicy=async Er=>this.request("/public/v1/submit/update_policy",Er),this.stampUpdatePolicy=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/update_policy",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.updatePrivateKeyTag=async Er=>this.request("/public/v1/submit/update_private_key_tag",Er),this.stampUpdatePrivateKeyTag=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/update_private_key_tag",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.updateRootQuorum=async Er=>this.request("/public/v1/submit/update_root_quorum",Er),this.stampUpdateRootQuorum=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/update_root_quorum",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.updateUser=async Er=>this.request("/public/v1/submit/update_user",Er),this.stampUpdateUser=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/update_user",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},this.updateUserTag=async Er=>this.request("/public/v1/submit/update_user_tag",Er),this.stampUpdateUserTag=async Er=>{const kr=this.config.baseUrl+"/public/v1/submit/update_user_tag",jr=JSON.stringify(Er),Br=await this.stamper.stamp(jr);return{body:jr,stamp:Br,url:kr}},!br.baseUrl)throw new Error("Missing base URL. Please verify env vars.");this.config=br,this.stamper=wr}async request(br,wr){const Er=this.config.baseUrl+br,kr=JSON.stringify(wr),jr=await this.stamper.stamp(kr),Br=await fetch$1(Er,{method:"POST",headers:{[jr.stampHeaderName]:jr.stampHeaderValue,"X-Client-Version":VERSION$1},body:kr,redirect:"follow"});if(!Br.ok){let qr;try{qr=await Br.json()}catch{throw new Error(`${Br.status} ${Br.statusText}`)}throw new TurnkeyRequestError(qr)}return await Br.json()}}class TurnkeyActivityError extends Error{constructor(br){const{message:wr,cause:Er,activityId:kr,activityStatus:jr,activityType:Br}=br;super(wr),this.name="TurnkeyActivityError",this.activityId=kr??null,this.activityStatus=jr??null,this.activityType=Br??null,this.cause=Er??null}}function bufferToBase64url(fr){const br=new Uint8Array(fr);let wr="";for(const jr of br)wr+=String.fromCharCode(jr);return btoa(wr).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}const copyValue="copy",convertValue="convert";function convert$1(fr,br,wr){if(br===copyValue)return wr;if(br===convertValue)return fr(wr);if(br instanceof Array)return wr.map(Er=>convert$1(fr,br[0],Er));if(br instanceof Object){const Er={};for(const[kr,jr]of Object.entries(br)){if(jr.derive){const Br=jr.derive(wr);Br!==void 0&&(wr[kr]=Br)}if(!(kr in wr)){if(jr.required)throw new Error(`Missing key: ${kr}`);continue}if(wr[kr]==null){Er[kr]=null;continue}Er[kr]=convert$1(fr,jr.schema,wr[kr])}return Er}}function derived(fr,br){return{required:!0,schema:fr,derive:br}}function required(fr){return{required:!0,schema:fr}}function optional$3(fr){return{required:!1,schema:fr}}const simplifiedClientExtensionResultsSchema={appid:optional$3(copyValue),appidExclude:optional$3(copyValue),credProps:optional$3(copyValue)},publicKeyCredentialWithAssertion={type:required(copyValue),id:required(copyValue),rawId:required(convertValue),authenticatorAttachment:optional$3(copyValue),response:required({clientDataJSON:required(convertValue),authenticatorData:required(convertValue),signature:required(convertValue),userHandle:required(convertValue)}),clientExtensionResults:derived(simplifiedClientExtensionResultsSchema,fr=>fr.getClientExtensionResults())};function getResponseToJSON(fr){return convert$1(bufferToBase64url,publicKeyCredentialWithAssertion,fr)}async function get$2(fr){const br=await navigator.credentials.get(fr);return br.toJSON=()=>getResponseToJSON(br),br}const K$2=[1116352408,1899447441,-1245643825,-373957723,961987163,1508970993,-1841331548,-1424204075,-670586216,310598401,607225278,1426881987,1925078388,-2132889090,-1680079193,-1046744716,-459576895,-272742522,264347078,604807628,770255983,1249150122,1555081692,1996064986,-1740746414,-1473132947,-1341970488,-1084653625,-958395405,-710438585,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,-2117940946,-1838011259,-1564481375,-1474664885,-1035236496,-949202525,-778901479,-694614492,-200395387,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,-2067236844,-1933114872,-1866530822,-1538233109,-1090935817,-965641998];function createHash(fr){return new Hash}class Hash{constructor(){this.A=1779033703,this.B=-1150833019,this.C=1013904242,this.D=-1521486534,this.E=1359893119,this.F=-1694144372,this.G=528734635,this.H=1541459225,this._size=0,this._sp=0,(!sharedBuffer||sharedOffset>=8e3)&&(sharedBuffer=new ArrayBuffer(8e3),sharedOffset=0),this._byte=new Uint8Array(sharedBuffer,sharedOffset,80),this._word=new Int32Array(sharedBuffer,sharedOffset,20),sharedOffset+=80}update(br){if(typeof br=="string")return this._utf8(br);if(br==null)throw new TypeError("Invalid type: "+typeof br);const wr=br.byteOffset,Er=br.byteLength;let kr=Er/64|0,jr=0;if(kr&&!(wr&3)&&!(this._size%64)){const Wr=new Int32Array(br.buffer,wr,kr*16);for(;kr--;)this._int32(Wr,jr>>2),jr+=64;this._size+=jr}if(br.BYTES_PER_ELEMENT!==1&&br.buffer){const Wr=new Uint8Array(br.buffer,wr+jr,Er-jr);return this._uint8(Wr)}return jr===Er?this:this._uint8(br,jr)}_uint8(br,wr){const{_byte:Er,_word:kr}=this,jr=br.length;for(wr=wr|0;wr=64&&this._int32(kr),this._size+=Wr-Br}return this}_utf8(br){const{_byte:wr,_word:Er}=this,kr=br.length;let jr=this._sp;for(let Br=0;Br>>6,wr[qr++]=128|Gr&63):Gr<55296||Gr>57343?(wr[qr++]=224|Gr>>>12,wr[qr++]=128|Gr>>>6&63,wr[qr++]=128|Gr&63):jr?(Gr=((jr&1023)<<10)+(Gr&1023)+65536,wr[qr++]=240|Gr>>>18,wr[qr++]=128|Gr>>>12&63,wr[qr++]=128|Gr>>>6&63,wr[qr++]=128|Gr&63,jr=0):jr=Gr}qr>=64&&(this._int32(Er),Er[0]=Er[16]),this._size+=qr-Wr}return this._sp=jr,this}_int32(br,wr){let{A:Er,B:kr,C:jr,D:Br,E:Wr,F:qr,G:Gr,H:Vr}=this,Zr=0;for(wr=wr|0;Zr<16;)W$1[Zr++]=swap32(br[wr++]);for(Zr=16;Zr<64;Zr++)W$1[Zr]=gamma1(W$1[Zr-2])+W$1[Zr-7]+gamma0(W$1[Zr-15])+W$1[Zr-16]|0;for(Zr=0;Zr<64;Zr++){const Jr=Vr+sigma1(Wr)+ch(Wr,qr,Gr)+K$2[Zr]+W$1[Zr]|0,Qr=sigma0(Er)+maj(Er,kr,jr)|0;Vr=Gr,Gr=qr,qr=Wr,Wr=Br+Jr|0,Br=jr,jr=kr,kr=Er,Er=Jr+Qr|0}this.A=Er+this.A|0,this.B=kr+this.B|0,this.C=jr+this.C|0,this.D=Br+this.D|0,this.E=Wr+this.E|0,this.F=qr+this.F|0,this.G=Gr+this.G|0,this.H=Vr+this.H|0}digest(br){const{_byte:wr,_word:Er}=this;let kr=this._size%64|0;for(wr[kr++]=128;kr&3;)wr[kr++]=0;if(kr>>=2,kr>14){for(;kr<16;)Er[kr++]=0;kr=0,this._int32(Er)}for(;kr<16;)Er[kr++]=0;const jr=this._size*8,Br=(jr&4294967295)>>>0,Wr=(jr-Br)/4294967296;return Wr&&(Er[14]=swap32(Wr)),Br&&(Er[15]=swap32(Br)),this._int32(Er),br==="hex"?this._hex():this._bin()}_hex(){const{A:br,B:wr,C:Er,D:kr,E:jr,F:Br,G:Wr,H:qr}=this;return hex32(br)+hex32(wr)+hex32(Er)+hex32(kr)+hex32(jr)+hex32(Br)+hex32(Wr)+hex32(qr)}_bin(){const{A:br,B:wr,C:Er,D:kr,E:jr,F:Br,G:Wr,H:qr,_byte:Gr,_word:Vr}=this;return Vr[0]=swap32(br),Vr[1]=swap32(wr),Vr[2]=swap32(Er),Vr[3]=swap32(kr),Vr[4]=swap32(jr),Vr[5]=swap32(Br),Vr[6]=swap32(Wr),Vr[7]=swap32(qr),Gr.slice(0,32)}}const W$1=new Int32Array(64);let sharedBuffer,sharedOffset=0;const hex32=fr=>(fr+4294967296).toString(16).substr(-8),swapLE=fr=>fr<<24&4278190080|fr<<8&16711680|fr>>8&65280|fr>>24&255,swapBE=fr=>fr,swap32=isBE()?swapBE:swapLE,ch=(fr,br,wr)=>wr^fr&(br^wr),maj=(fr,br,wr)=>fr&br|wr&(fr|br),sigma0=fr=>(fr>>>2|fr<<30)^(fr>>>13|fr<<19)^(fr>>>22|fr<<10),sigma1=fr=>(fr>>>6|fr<<26)^(fr>>>11|fr<<21)^(fr>>>25|fr<<7),gamma0=fr=>(fr>>>7|fr<<25)^(fr>>>18|fr<<14)^fr>>>3,gamma1=fr=>(fr>>>17|fr<<15)^(fr>>>19|fr<<13)^fr>>>10;function isBE(){return new Uint8Array(new Uint16Array([65279]).buffer)[0]===254}const stampHeaderName="X-Stamp-Webauthn",defaultTimeout=5*60*1e3,defaultUserVerification="preferred";class WebauthnStamper{constructor(br){this.rpId=br.rpId,this.timeout=br.timeout||defaultTimeout,this.userVerification=br.userVerification||defaultUserVerification,this.allowCredentials=br.allowCredentials||[]}async stamp(br){const wr=getChallengeFromPayload(br),Er={publicKey:{rpId:this.rpId,challenge:wr,allowCredentials:this.allowCredentials,timeout:this.timeout,userVerification:this.userVerification}},jr=(await get$2(Er)).toJSON(),Br={authenticatorData:jr.response.authenticatorData,clientDataJson:jr.response.clientDataJSON,credentialId:jr.id,signature:jr.response.signature};return{stampHeaderName,stampHeaderValue:JSON.stringify(Br)}}}function getChallengeFromPayload(fr){const br=createHash().update(fr).digest("hex");return new TextEncoder().encode(br)}var version$b="3.8.2";class WebauthnNotSupportedError extends Error{constructor(){super("Webauthn is not supported on this device")}}function __awaiter$b(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;function utf8StringToBuffer(fr){return new TextEncoder().encode(fr)}function bufferToBase64URLString(fr){const br=new Uint8Array(fr);let wr="";for(const kr of br)wr+=String.fromCharCode(kr);return btoa(wr).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function base64URLStringToBuffer(fr){const br=fr.replace(/-/g,"+").replace(/_/g,"/"),wr=(4-br.length%4)%4,Er=br.padEnd(br.length+wr,"="),kr=atob(Er),jr=new ArrayBuffer(kr.length),Br=new Uint8Array(jr);for(let Wr=0;WrBr.type==="public-key").length===0?new WebAuthnError({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:fr}):new WebAuthnError({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:fr});if(fr.name==="SecurityError"){const jr=window.location.hostname;if(isValidDomain(jr)){if(wr.rp.id!==jr)return new WebAuthnError({message:`The RP ID "${wr.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:fr})}else return new WebAuthnError({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:fr})}else if(fr.name==="TypeError"){if(wr.user.id.byteLength<1||wr.user.id.byteLength>64)return new WebAuthnError({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:fr})}else if(fr.name==="UnknownError")return new WebAuthnError({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:fr})}return fr}class BaseWebAuthnAbortService{createNewAbortSignal(){if(this.controller){const wr=new Error("Cancelling existing WebAuthn API call for new one");wr.name="AbortError",this.controller.abort(wr)}const br=new AbortController;return this.controller=br,br.signal}cancelCeremony(){if(this.controller){const br=new Error("Manually cancelling existing WebAuthn API call");br.name="AbortError",this.controller.abort(br),this.controller=void 0}}}const WebAuthnAbortService=new BaseWebAuthnAbortService,attachments=["cross-platform","platform"];function toAuthenticatorAttachment(fr){if(fr&&!(attachments.indexOf(fr)<0))return fr}async function startRegistration(fr){var Jr;if(!browserSupportsWebAuthn())throw new Error("WebAuthn is not supported in this browser");const wr={publicKey:{...fr,challenge:base64URLStringToBuffer(fr.challenge),user:{...fr.user,id:utf8StringToBuffer(fr.user.id)},excludeCredentials:(Jr=fr.excludeCredentials)==null?void 0:Jr.map(toPublicKeyCredentialDescriptor)}};wr.signal=WebAuthnAbortService.createNewAbortSignal();let Er;try{Er=await navigator.credentials.create(wr)}catch(Qr){throw identifyRegistrationError({error:Qr,options:wr})}if(!Er)throw new Error("Registration was not completed");const{id:kr,rawId:jr,response:Br,type:Wr}=Er;let qr;typeof Br.getTransports=="function"&&(qr=Br.getTransports());let Gr;if(typeof Br.getPublicKeyAlgorithm=="function")try{Gr=Br.getPublicKeyAlgorithm()}catch(Qr){warnOnBrokenImplementation("getPublicKeyAlgorithm()",Qr)}let Vr;if(typeof Br.getPublicKey=="function")try{const Qr=Br.getPublicKey();Qr!==null&&(Vr=bufferToBase64URLString(Qr))}catch(Qr){warnOnBrokenImplementation("getPublicKey()",Qr)}let Zr;if(typeof Br.getAuthenticatorData=="function")try{Zr=bufferToBase64URLString(Br.getAuthenticatorData())}catch(Qr){warnOnBrokenImplementation("getAuthenticatorData()",Qr)}return{id:kr,rawId:bufferToBase64URLString(jr),response:{attestationObject:bufferToBase64URLString(Br.attestationObject),clientDataJSON:bufferToBase64URLString(Br.clientDataJSON),transports:qr,publicKeyAlgorithm:Gr,publicKey:Vr,authenticatorData:Zr},type:Wr,clientExtensionResults:Er.getClientExtensionResults(),authenticatorAttachment:toAuthenticatorAttachment(Er.authenticatorAttachment)}}function warnOnBrokenImplementation(fr,br){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${fr}. You should report this error to them. +`,br)}const logger$3=new Logger$1("Webauthn"),createWebauthnCredential=fr=>__awaiter$b(void 0,void 0,void 0,function*(){if(!browserSupportsWebAuthn())throw new WebauthnNotSupportedError;let br;try{br=yield startRegistration(fr)}catch(wr){throw logger$3.debug("Failed to create webauthn credential",wr),wr}return br}),convertTransportEnumToTurnkeyEnum=fr=>{switch(fr){case"internal":return"AUTHENTICATOR_TRANSPORT_INTERNAL";case"usb":return"AUTHENTICATOR_TRANSPORT_USB";case"nfc":return"AUTHENTICATOR_TRANSPORT_NFC";case"ble":return"AUTHENTICATOR_TRANSPORT_BLE";case"hybrid":return"AUTHENTICATOR_TRANSPORT_HYBRID";default:throw new Error("unsupported transport format "+fr)}},getWebAuthnAttestationTurnkeyAdapter=fr=>__awaiter$b(void 0,void 0,void 0,function*(){var br,wr;if(!fr.publicKey)throw new Error("Invalid options. Public key attribute must be defined");const Er=Object.assign(Object.assign({},fr.publicKey),{challenge:bufferSourceToString(fr.publicKey.challenge),excludeCredentials:(br=fr.publicKey.excludeCredentials)===null||br===void 0?void 0:br.map(jr=>Object.assign(Object.assign({},jr),{id:bufferSourceToString(jr.id)})),user:Object.assign(Object.assign({},fr.publicKey.user),{id:bufferSourceToString(fr.publicKey.user.id)})}),kr=yield createWebauthnCredential(Er);return{attestationObject:kr.response.attestationObject,clientDataJson:kr.response.clientDataJSON,credentialId:kr.rawId,transports:((wr=kr.response.transports)===null||wr===void 0?void 0:wr.map(convertTransportEnumToTurnkeyEnum))||[]}}),bufferSourceToString=fr=>{if(fr instanceof ArrayBuffer)return bufferToBase64URLString(fr);{const br=new Uint8Array(fr.buffer,fr.byteOffset,fr.byteLength);return bufferToBase64URLString(br)}};assertPackageVersion("@dynamic-labs/webauthn",version$b);const createTurnkeyPasskeyService=()=>({createWebauthnStamper:fr=>new WebauthnStamper(fr),getWebAuthnAttestation:getWebAuthnAttestationTurnkeyAdapter});var _a,_PasskeyService_implementation;class PasskeyService{static get implementation(){return __classPrivateFieldGet$4(_a,_a,"f",_PasskeyService_implementation)?__classPrivateFieldGet$4(_a,_a,"f",_PasskeyService_implementation):createTurnkeyPasskeyService()}static set implementation(br){__classPrivateFieldSet$4(_a,_a,br,"f",_PasskeyService_implementation)}static get getWebAuthnAttestation(){return _a.implementation.getWebAuthnAttestation}static get createWebauthnStamper(){return _a.implementation.createWebauthnStamper}}_a=PasskeyService;_PasskeyService_implementation={value:void 0};const turnkeyBaseUrl$1="https://api.turnkey.com",turnkeyPasskeyRecoveryUrl="https://recovery.turnkey.com",turnkeyEmailRecoveryUrl="https://auth.turnkey.com",TURNKEY_RECOVERY_CREDENTIAL_EXPIRATION_SECONDS=900,TURNKEY_SESSION_EXPIRATION_SECONDS=1800,EMAIL_AUTH_CREDENTIAL_TYPE="CREDENTIAL_TYPE_API_KEY_P256",PASSKEY_RECOVERY_CREDENTIAL_TYPE="CREDENTIAL_TYPE_RECOVER_USER_KEY_P256";class TurnkeyAuthenticatorRecoveryHandler{constructor(){this.isSessionActive=()=>!this.__createdAt||this.__recoveryType!=="email"?!1:this.isExpired(this.__createdAt,this.__sessionExpiration||TURNKEY_SESSION_EXPIRATION_SECONDS)?(this.clear(),!1):!0,this.isValidCode=br=>__awaiter$c(this,void 0,void 0,function*(){var wr,Er,kr,jr;if(!br||!this.__turnkeyRecoveryUserId)throw new DynamicError("Cannot proceed with your request");const Br=yield(wr=this.__client)===null||wr===void 0?void 0:wr.getUser({organizationId:br,userId:this.__turnkeyRecoveryUserId}),Wr={email:EMAIL_AUTH_CREDENTIAL_TYPE,passkey:PASSKEY_RECOVERY_CREDENTIAL_TYPE},qr=(jr=(kr=(Er=Br==null?void 0:Br.user)===null||Er===void 0?void 0:Er.apiKeys)===null||kr===void 0?void 0:kr.filter(Vr=>Vr.credential.type===Wr[this.__recoveryType]))===null||jr===void 0?void 0:jr.pop();return!qr||this.isExpired(parseInt(qr.createdAt.seconds,10),TURNKEY_RECOVERY_CREDENTIAL_EXPIRATION_SECONDS)?!1:(this.__createdAt=parseInt(qr.createdAt.seconds,10),!0)}),this.isExpired=(br,wr)=>{const Er=br+wr,kr=new Date(Er*1e3);return new Date>=kr}}get publicKey(){return this.__publicKey}get client(){return this.__client}get recoveryType(){return this.__recoveryType}get recoveryUserId(){return this.__turnkeyRecoveryUserId||""}set recoveryUserId(br){this.__turnkeyRecoveryUserId=br}clear(){var br;(br=this.__iframeStamper)===null||br===void 0||br.clear(),this.__recoveryType=void 0,this.__iframeStamper=void 0,this.__publicKey=void 0,this.__client=void 0,this.__turnkeyRecoveryUserId=void 0,this.__createdAt=void 0}initRecovery(br,wr,Er,kr){return __awaiter$c(this,void 0,void 0,function*(){this.__recoveryType&&this.clear(),this.__sessionExpiration=kr,this.__recoveryType=br;const jr=br==="passkey"?turnkeyPasskeyRecoveryUrl:turnkeyEmailRecoveryUrl;return this.__iframeStamper=new IframeStamper({iframeContainer:wr,iframeElementId:Er,iframeUrl:jr}),yield this.__iframeStamper.init(),this.__publicKey=this.__iframeStamper.publicKey(),this.__publicKey})}verifyRecoveryCode(br,wr){return __awaiter$c(this,void 0,void 0,function*(){if(!this.__iframeStamper)throw new DynamicError("Cannot proceed with your request");try{if(yield this.__iframeStamper.injectCredentialBundle(br),this.__client=new TurnkeyClient({baseUrl:turnkeyBaseUrl$1},this.__iframeStamper),!wr||!this.__turnkeyRecoveryUserId)throw new DynamicError("Cannot proceed with your request");if(!(yield this.isValidCode(wr)))throw new DynamicError("The code is invalid or expired.")}catch(Er){throw logger$4.error("Error while verifying recovery code",Er),Er instanceof DynamicError?Er:new DynamicError("The code is invalid or expired.")}})}completeRecovery(br){return __awaiter$c(this,arguments,void 0,function*({attestation:wr,challenge:Er,turnkeySubOrganizationId:kr}){if(!this.__client||!this.__turnkeyRecoveryUserId)throw new DynamicError("Cannot proceed with your request");try{return this.__client.recoverUser({organizationId:kr,parameters:{authenticator:{attestation:wr,authenticatorName:"Passkey",challenge:Er},userId:this.__turnkeyRecoveryUserId},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_RECOVER_USER"})}catch(jr){throw logger$4.error("[TK] Error while completing recovery process",jr),jr}})}addPasskeyAuthenticator(br){return __awaiter$c(this,arguments,void 0,function*({attestation:wr,challenge:Er,turnkeySubOrganizationId:kr}){if(!this.__client||!this.__turnkeyRecoveryUserId)throw new DynamicError("Cannot proceed with your request");try{return this.__client.createAuthenticators({organizationId:kr,parameters:{authenticators:[{attestation:wr,authenticatorName:"Passkey",challenge:Er}],userId:this.__turnkeyRecoveryUserId},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2"})}catch(jr){throw logger$4.error("[TK] Error while creating new authenticator",jr),jr}})}addEmailRecovery(br){return __awaiter$c(this,arguments,void 0,function*({organizationId:wr,email:Er,turnkeyUserId:kr}){let jr=getTLD();jr||(jr=PlatformService.getHostname());const Br=PasskeyService.createWebauthnStamper({rpId:jr}),Wr=new TurnkeyClient({baseUrl:turnkeyBaseUrl$1},Br);try{return{signedRequest:yield Wr.stampUpdateUser({organizationId:wr,parameters:{userEmail:Er,userId:kr,userTagIds:[]},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_UPDATE_USER"}),userId:kr}}catch(qr){throw logger$4.error("Error while adding email recovery",qr),qr}})}}const turnkeyAuthenticatorRecoveryHandler=new TurnkeyAuthenticatorRecoveryHandler,turnkeyBaseUrl="https://api.turnkey.com",turnkeyExportUrl="https://export.turnkey.com";class ExportHandler{get publicKey(){return this.__publicKey}clear(){var br;(br=this.__iframeStamper)===null||br===void 0||br.clear(),this.__iframeStamper=void 0,this.__publicKey=void 0,this.__turnkeyClient=void 0}initExport(br,wr){return __awaiter$c(this,void 0,void 0,function*(){if(this.__iframeStamper=new IframeStamper({iframeContainer:br,iframeElementId:wr,iframeUrl:turnkeyExportUrl}),yield this.__iframeStamper.init(),this.__publicKey=this.__iframeStamper.publicKey(),turnkeyAuthenticatorRecoveryHandler.isSessionActive())this.__turnkeyClient=turnkeyAuthenticatorRecoveryHandler.client;else{let Er=getTLD();Er||(Er=PlatformService.getHostname());const kr=PasskeyService.createWebauthnStamper({rpId:Er}),jr=ExportHandler==null?void 0:ExportHandler.apiKeyStamper,Br=jr??kr;this.__turnkeyClient=new TurnkeyClient({baseUrl:turnkeyBaseUrl},Br)}return this.__publicKey})}verifyExportWallet(br){return __awaiter$c(this,arguments,void 0,function*({exportBundle:wr,organizationId:Er}){if(!this.__iframeStamper)throw new DynamicError("Cannot proceed with your request");try{return yield this.__iframeStamper.injectWalletExportBundle(wr,Er)}catch(kr){throw logger$4.error("Error while verifying export wallet",kr),kr}})}verifyExportPrivateKey(br){return __awaiter$c(this,arguments,void 0,function*({exportBundle:wr,organizationId:Er,chain:kr}){if(!this.__iframeStamper)throw new DynamicError("Cannot proceed with your request");const jr=kr==="solana"||kr==="SOL"?KeyFormat.Solana:KeyFormat.Hexadecimal;try{return yield this.__iframeStamper.injectKeyExportBundle(wr,Er,jr)}catch(Br){throw logger$4.error("Error while verifying export private key",Br),Br}})}exportPrivateKey(br){return __awaiter$c(this,arguments,void 0,function*({privateKeyId:wr,organizationId:Er}){const kr=ExportHandler==null?void 0:ExportHandler.apiKeyStamper;if(kr&&(this.__turnkeyClient=new TurnkeyClient({baseUrl:turnkeyBaseUrl},kr)),!this.__iframeStamper||!this.__publicKey||!this.__turnkeyClient||!wr)throw new DynamicError("Cannot proceed with your request");try{return(yield this.__turnkeyClient.exportPrivateKey({organizationId:Er,parameters:{privateKeyId:wr,targetPublicKey:this.__publicKey},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_EXPORT_PRIVATE_KEY"})).activity}catch(jr){throw logger$4.error("[TK] Error while completing export private key process",jr),jr}})}exportWallet(br){return __awaiter$c(this,arguments,void 0,function*({walletId:wr,organizationId:Er,address:kr}){const jr=ExportHandler==null?void 0:ExportHandler.apiKeyStamper;if(jr&&(this.__turnkeyClient=new TurnkeyClient({baseUrl:turnkeyBaseUrl},jr)),!this.__iframeStamper||!this.__publicKey||!this.__turnkeyClient||!wr)throw new DynamicError("Cannot proceed with your request");try{return kr?(yield this.__turnkeyClient.exportWalletAccount({organizationId:Er,parameters:{address:kr,targetPublicKey:this.__publicKey},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT"})).activity:(yield this.__turnkeyClient.exportWallet({organizationId:Er,parameters:{targetPublicKey:this.__publicKey,walletId:wr},timestampMs:String(Date.now()),type:"ACTIVITY_TYPE_EXPORT_WALLET"})).activity}catch(Br){throw logger$4.error("[TK] Error while completing export wallet process",Br),Br}})}}class TurnkeyWalletConnectorBase extends WalletConnectorBase{constructor(br,wr){if(super(wr),this.requiresNonDynamicEmailOtp=!1,this.isEmbeddedWallet=!0,this.removeSessionKeys=()=>__awaiter$c(this,void 0,void 0,function*(){TurnkeyWalletConnectorBase.sessionKeys=void 0,TurnkeyWalletConnectorBase.apiKeyStamper=void 0,ExportHandler.apiKeyStamper=void 0,typeof(this===null||this===void 0?void 0:this.removeSessionKeysFunction)=="function"&&this.removeSessionKeysFunction()}),!wr.appName)throw new Error("appName not set");this.name=br.name,this.overrideKey=br.key,this.appName=wr.appName,this.__authenticatorMethodHandler=turnkeyAuthenticatorRecoveryHandler,this.__exportHandler=new ExportHandler}getWebAuthnAttestation(){return __awaiter$c(this,void 0,void 0,function*(){const br=generateRandomBuffer(),wr=generateRandomBuffer(),{email:Er,passkeyIdentifier:kr}=this;if(!Er&&!kr)throw new Error("Email or passkeyIdentifier must be set to register a webauthn credential.");const jr=Er||`${this.appName} - ${kr}`,Br={publicKey:{authenticatorSelection:{authenticatorAttachment:void 0,requireResidentKey:!1,residentKey:"preferred",userVerification:"discouraged"},challenge:br,pubKeyCredParams:[{alg:-7,type:"public-key"}],rp:{id:getTLD(),name:this.appName},user:{displayName:jr,id:wr,name:Er||`${this.appName} - ${kr}`}}};let Wr;try{Wr=yield PasskeyService.getWebAuthnAttestation(Br)}catch(qr){logger$4.warn(`Unable to register webauthn credential on the current page's TLD ${getTLD()}. Falling back to using hostname. ${PlatformService.getHostname()}`,qr),Br.publicKey.rp.id=PlatformService.getHostname(),Wr=yield PasskeyService.getWebAuthnAttestation(Br)}return{attestation:{attestationObject:Wr.attestationObject,clientDataJson:Wr.clientDataJson,credentialId:Wr.credentialId,transports:convertAttestationTransports(Wr.transports)},challenge:base64UrlEncode(br),displayName:jr}})}getAuthenticatorHandler(){return this.__authenticatorMethodHandler}getExportHandler(){return this.__exportHandler}get email(){return this._email}setEmail(br){this._email=br}get phone(){return this._phone}setPhone(br){this._phone=br}get passkeyIdentifier(){return this._passkeyIdentifier}setPasskeyIdentifier(br){this._passkeyIdentifier=br}clearEmail(){this._email=null}getAddress(){return __awaiter$c(this,void 0,void 0,function*(){var br;return(br=this.verifiedCredential)===null||br===void 0?void 0:br.address})}getConnectedAccounts(){return __awaiter$c(this,void 0,void 0,function*(){return(this.verifiedCredentials||[]).map(Er=>Er==null?void 0:Er.address).filter(Er=>typeof Er=="string")})}get turnkeyAddress(){var br;const{address:wr}=(br=this.verifiedCredential)!==null&&br!==void 0?br:{};return wr}get walletProperties(){const{walletProperties:br}=this.verifiedCredential||{};return br}set verifiedCredentials(br){this._verifiedCredentials=br}get verifiedCredentials(){return this._verifiedCredentials}set verifiedCredential(br){this._verifiedCredential=br}get verifiedCredential(){return this._verifiedCredential}setSessionKeyFetcher(br){this.createOrRestoreSessionFetcherFunction=br}setSessionKeyRemoveFunction(br){this.removeSessionKeysFunction=br}createOrRestoreSession(){return __awaiter$c(this,arguments,void 0,function*({ignoreRestore:br}={}){if(!this.isSessionKeyCompatible()||TurnkeyWalletConnectorBase.isLoadingSession)return;if(!this.createOrRestoreSessionFetcherFunction)throw new DynamicError("Cannot register session key to init provider");const{sessionKeys:wr}=TurnkeyWalletConnectorBase;if(wr!=null&&wr.publicKey&&!(new Date>=new Date(wr.expirationDate)))return wr.publicKey;try{TurnkeyWalletConnectorBase.isLoadingSession=!0;const Er=yield this.createOrRestoreSessionFetcherFunction({ignoreRestore:br});return TurnkeyWalletConnectorBase.sessionKeys=Er,TurnkeyWalletConnectorBase.apiKeyStamper=new ApiKeyStamper({apiPrivateKey:Er.privateKey,apiPublicKey:Er.publicKey}),ExportHandler.apiKeyStamper=TurnkeyWalletConnectorBase.apiKeyStamper,logger$4.setMetaData("sessionApiPublicKey",Er.publicKey),Er.publicKey}catch{throw new DynamicError("Failed to create or restore session")}finally{TurnkeyWalletConnectorBase.isLoadingSession=!1}})}isSessionKeyCompatible(){var br;const wr=(br=this.verifiedCredential)===null||br===void 0?void 0:br.walletProperties;return!!(wr==null?void 0:wr.isSessionKeyCompatible)}isSessionActive(){return __awaiter$c(this,void 0,void 0,function*(){return!!((yield this.getAddress())&&TurnkeyWalletConnectorBase.sessionKeys&&TurnkeyWalletConnectorBase.apiKeyStamper)})}get sessionKeys(){return TurnkeyWalletConnectorBase.sessionKeys}setLoggerMetadata(){var br,wr,Er;logger$4.setMetaData("turnkeySubOrganizationId",(wr=(br=this._verifiedCredential)===null||br===void 0?void 0:br.walletProperties)===null||wr===void 0?void 0:wr.turnkeySubOrganizationId),logger$4.setMetaData("walletId",(Er=this._verifiedCredential)===null||Er===void 0?void 0:Er.id);let kr="Unknown";this.isSessionKeyCompatible()?kr="SessionKeys":this.__authenticatorMethodHandler.recoveryType==="passkey"?kr="Passkey":this.__authenticatorMethodHandler.recoveryType==="email"&&(kr="EmailAuth"),logger$4.setMetaData("authMethod",kr)}}TurnkeyWalletConnectorBase.isLoadingSession=!1;const TurnkeyWalletConnectorInfo={Turnkey:{key:"turnkey",name:"Turnkey"},TurnkeyHD:{key:"turnkeyhd",name:"Turnkey HD"}},findTurnkeyVerifiedCredentials=(fr,br)=>fr==null?void 0:fr.filter(({walletName:wr,chain:Er})=>(wr==null?void 0:wr.startsWith("turnkey"))&&br===Er),findTurnkeyVerifiedCredentialsWithSmartWalletRef=(fr,br)=>fr==null?void 0:fr.reduce((wr,Er)=>{var kr;if(!((kr=Er.walletName)===null||kr===void 0)&&kr.startsWith("turnkey")&&br===Er.chain){const jr=fr.find(qr=>qr.signerRefId===Er.id),Br=jr==null?void 0:jr.id,Wr=jr==null?void 0:jr.address;wr.push(Object.assign(Object.assign({},Er),{smartWalletRefAddress:Wr,smartWalletRefId:Br}))}return wr},[]);assertPackageVersion("@dynamic-labs/embedded-wallet",version$c);function __awaiter$a(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,br||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;async function createAccount(fr){var jr;const{client:br,organizationId:wr,signWith:Er}=fr;let{ethereumAddress:kr}=fr;if(!Er)throw new TurnkeyActivityError({message:"Missing signWith parameter"});if(isAddress(Er))kr=Er;else if(!kr&&(kr=(jr=(await br.getPrivateKey({privateKeyId:Er,organizationId:wr})).privateKey.addresses.find(Wr=>Wr.format==="ADDRESS_FORMAT_ETHEREUM"))==null?void 0:jr.address,typeof kr!="string"||!kr))throw new TurnkeyActivityError({message:`Unable to find Ethereum address for key ${Er} under organization ${wr}`});return toAccount({address:kr,signMessage:function({message:Br}){return signMessage(br,Br,wr,Er)},signTransaction:function(Br,Wr){const qr=Wr!=null&&Wr.serializer?Wr.serializer:serializeTransaction$4;return signTransaction(br,Br,qr,wr,Er)},signTypedData:function(Br){return signTypedData(br,Br,wr,Er)}})}async function signMessage(fr,br,wr,Er){const kr=hashMessage(br);return`${await signMessageWithErrorWrapping(fr,kr,wr,Er)}`}async function signTransaction(fr,br,wr,Er,kr){const Br=wr(br).replace(/^0x/,"");return await signTransactionWithErrorWrapping(fr,Br,Er,kr)}async function signTypedData(fr,br,wr,Er){const kr=hashTypedData(br);return await signMessageWithErrorWrapping(fr,kr,wr,Er)}async function signTransactionWithErrorWrapping(fr,br,wr,Er){let kr;try{kr=await signTransactionImpl(fr,br,wr,Er)}catch(jr){throw jr instanceof TurnkeyActivityError?jr:new TurnkeyActivityError({message:`Failed to sign transaction: ${jr.message}`,cause:jr})}return`0x${kr}`}async function signTransactionImpl(fr,br,wr,Er){var kr,jr;if(fr instanceof TurnkeyClient){const{activity:Br}=await fr.signTransaction({type:"ACTIVITY_TYPE_SIGN_TRANSACTION_V2",organizationId:wr,parameters:{signWith:Er,type:"TRANSACTION_TYPE_ETHEREUM",unsignedTransaction:br},timestampMs:String(Date.now())}),{id:Wr,status:qr,type:Gr}=Br;if(Br.status!=="ACTIVITY_STATUS_COMPLETED")throw new TurnkeyActivityError({message:`Invalid activity status: ${Br.status}`,activityId:Wr,activityStatus:qr,activityType:Gr});return assertNonNull((jr=(kr=Br==null?void 0:Br.result)==null?void 0:kr.signTransactionResult)==null?void 0:jr.signedTransaction)}else{const Br=await fr.signTransaction({signWith:Er,type:"TRANSACTION_TYPE_ETHEREUM",unsignedTransaction:br});return assertNonNull(Br==null?void 0:Br.signedTransaction)}}async function signMessageWithErrorWrapping(fr,br,wr,Er){let kr;try{kr=await signMessageImpl(fr,br,wr,Er)}catch(jr){throw jr instanceof TurnkeyActivityError?jr:new TurnkeyActivityError({message:`Failed to sign: ${jr.message}`,cause:jr})}return kr}async function signMessageImpl(fr,br,wr,Er){var Br;let kr;if(fr instanceof TurnkeyClient){const{activity:Wr}=await fr.signRawPayload({type:"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",organizationId:wr,parameters:{signWith:Er,payload:br,encoding:"PAYLOAD_ENCODING_HEXADECIMAL",hashFunction:"HASH_FUNCTION_NO_OP"},timestampMs:String(Date.now())}),{id:qr,status:Gr,type:Vr}=Wr;if(Gr!=="ACTIVITY_STATUS_COMPLETED")throw new TurnkeyActivityError({message:`Invalid activity status: ${Wr.status}`,activityId:qr,activityStatus:Gr,activityType:Vr});kr=assertNonNull((Br=Wr==null?void 0:Wr.result)==null?void 0:Br.signRawPayloadResult)}else kr=await fr.signRawPayload({signWith:Er,payload:br,encoding:"PAYLOAD_ENCODING_HEXADECIMAL",hashFunction:"HASH_FUNCTION_NO_OP"});let jr=serializeSignature({r:`0x${kr.r}`,s:`0x${kr.s}`,v:kr.v==="00"?27n:28n});return assertNonNull(jr)}function assertNonNull(fr){if(fr==null)throw new Error(`Got unexpected ${JSON.stringify(fr)}`);return fr}var version$a="3.8.2";function __awaiter$9(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,br||[])).next())})}typeof SuppressedError=="function"&&SuppressedError;const logger$2=new Logger$1("ethereum-core"),gasPriceOracleAbiAddress="0x420000000000000000000000000000000000000F",gasPriceOracleAbi=[{inputs:[{internalType:"bytes",name:"_data",type:"bytes"}],name:"getL1Fee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"}],estimateL1Fee$1=(fr,br)=>__awaiter$9(void 0,void 0,void 0,function*(){const wr=serializeTransaction$4(Object.assign(Object.assign({chainId:fr.chain.id},br),{type:br.type?br.type:"eip1559"}));return fr.readContract({abi:gasPriceOracleAbi,address:gasPriceOracleAbiAddress,args:[wr],functionName:"getL1Fee"})}),opStackSupportedChains=[optimism.id,optimismGoerli.id,optimismSepolia.id,base$7.id,baseGoerli.id,baseSepolia$1.id],chainsMap=Object.values(viemChains).reduce((fr,br)=>Object.assign(Object.assign({},fr),{[br.id]:br}),{}),erc20Abi=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}];class Eip1559FeeFeed{constructor({publicClient:br,initialGasLimit:wr,initialMaxFeePerGas:Er}){this.fee={gas:BigInt(0)},this.publicClient=br,this.initialGasLimit=wr,this.initialMaxFeePerGas=Er}fetchFee(){return __awaiter$9(this,void 0,void 0,function*(){try{const br=yield this.estimateL1Fee();if(this.initialGasLimit&&this.initialMaxFeePerGas){this.fee.gas=this.initialGasLimit*this.initialMaxFeePerGas+br;return}const wr=yield this.estimateGas();if(this.initialMaxFeePerGas){this.fee.gas=wr*this.initialMaxFeePerGas+br;return}const Er=yield this.publicClient.estimateFeesPerGas();if(!Er||!Er.maxFeePerGas)return;this.fee.gas=wr*Er.maxFeePerGas+br,this.maxFeePerGas=Er.maxFeePerGas,this.maxPriorityFeePerGas=Er.maxPriorityFeePerGas}catch(br){logger$2.debug(br);return}})}}const estimateL1Fee=(fr,br)=>__awaiter$9(void 0,void 0,void 0,function*(){const{chain:wr}=fr;if(!wr)throw new Error("Chain is not defined");const Er=fr;if(opStackSupportedChains.includes(wr.id))return estimateL1Fee$1(Er,br);throw new Error("Chain is not supported")}),estimateL1FeeSupportedChains=[...opStackSupportedChains],isL1FeeSupportedByChain=fr=>estimateL1FeeSupportedChains.includes(fr),validateAddressFormat=fr=>/^0x[0-9a-fA-F]{40}$/.test(fr),parseEther=fr=>parseEther$1(fr,"wei"),formatEther=(fr,{precision:br}={})=>formatNumberText(formatEther$1(fr),{precision:br});class ViemUiTransaction extends Eip1559FeeFeed{constructor({transaction:br,onSubmit:wr,publicClient:Er,account:kr}){super({initialGasLimit:br.gas,initialMaxFeePerGas:br.maxFeePerGas,publicClient:Er}),this.chain="EVM",this.validateAddressFormat=validateAddressFormat,this.parse=parseEther,this.parseNonNativeToken=(jr,Br)=>parseUnits(jr,Br),this.format=formatEther,this.formatNonNativeToken=(jr,Br)=>formatUnits(jr,Br),this.transaction=br,this.onSubmit=wr,this.publicClient=Er,this.address=kr}get to(){return this.transaction.to||void 0}set to(br){this.transaction.to=br}get from(){return this.address}get value(){return this.transaction.value}set value(br){this.transaction.value=br}get nonNativeValue(){return this.transaction.nonNativeValue}set nonNativeValue(br){this.transaction.nonNativeValue=br}get nonNativeAddress(){return this.transaction.nonNativeAddress}set nonNativeAddress(br){this.transaction.nonNativeAddress=br}get nonNativeDecimal(){return this.transaction.nonNativeDecimal}set nonNativeDecimal(br){this.transaction.nonNativeDecimal=br}get data(){return this.transaction.data}submit(){return __awaiter$9(this,void 0,void 0,function*(){return this.onSubmit(this.transaction).catch(br=>{throw br instanceof UserRejectedTransactionError?new TransactionExecutionError(new BaseError(br.message),this.transaction):br})})}getBalance(){return this.publicClient.getBalance({address:this.address})}estimateGas(){return __awaiter$9(this,void 0,void 0,function*(){const br=yield this.publicClient.transport.request({method:"eth_estimateGas",params:[{data:this.data,to:this.to,value:this.convertBigIntToHex(this.value)}]});return hexToBigInt(br)})}convertBigIntToHex(br){return br?toHex(br):void 0}estimateL1Fee(){return __awaiter$9(this,void 0,void 0,function*(){var br;return isL1FeeSupportedByChain(((br=this.publicClient.chain)===null||br===void 0?void 0:br.id)||0)?estimateL1Fee(this.publicClient,{data:this.transaction.data,to:this.transaction.to,value:this.transaction.value}):BigInt(0)})}set maxFeePerGas(br){this.transaction.maxFeePerGas=br}set maxPriorityFeePerGas(br){this.transaction.maxPriorityFeePerGas=br}}const createViemUiTransaction=fr=>__awaiter$9(void 0,[fr],void 0,function*({from:br,publicClient:wr,walletClient:Er}){return new ViemUiTransaction({account:br,onSubmit:kr=>__awaiter$9(void 0,void 0,void 0,function*(){return kr.nonNativeAddress?Er.writeContract({abi:erc20Abi,account:br,address:kr.nonNativeAddress,args:[kr.to,kr.nonNativeValue],functionName:"transfer",maxFeePerGas:kr.maxFeePerGas,maxPriorityFeePerGas:kr.maxPriorityFeePerGas}):Er.sendTransaction({account:br,maxFeePerGas:kr.maxFeePerGas,maxPriorityFeePerGas:kr.maxPriorityFeePerGas,to:kr.to,value:kr.value})}),publicClient:wr,transaction:{}})}),getChain=fr=>{for(const br of Object.values(viemChains))if("id"in br&&br.id===fr)return br;throw new Error(`Chain with id ${fr} not found`)},mapChain=fr=>{var br;return{blockExplorers:!((br=fr.blockExplorerUrls)===null||br===void 0)&&br[0]?{default:{name:fr.blockExplorerUrls[0],url:fr.blockExplorerUrls[0]}}:void 0,id:fr.chainId,name:fr.vanityName||fr.name||fr.chainName,nativeCurrency:fr.nativeCurrency,rpcUrls:{default:{http:fr.rpcUrls},public:{http:fr.rpcUrls}}}},getOrMapViemChain=fr=>{let br;try{br=getChain(fr.chainId)}catch{logger$2.debug(`Chain with id ${fr.chainId} not found in viem's chains`)}const wr=mapChain(fr);return br?Object.assign(Object.assign({},br),wr):wr},findEvmNetwork=({chainId:fr,name:br,networks:wr})=>{if(!(!fr&&!br))return fr&&br?wr.find(Er=>Er.chainId===fr&&Er.name===br):fr?wr.find(Er=>Er.chainId===fr):wr.find(Er=>Er.name===br)};var L2ResolverAbi=[{inputs:[{internalType:"contract ENS",name:"ens_",type:"address"},{internalType:"address",name:"registrarController_",type:"address"},{internalType:"address",name:"reverseRegistrar_",type:"address"},{internalType:"address",name:"owner_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AlreadyInitialized",type:"error"},{inputs:[],name:"CantSetSelfAsDelegate",type:"error"},{inputs:[],name:"CantSetSelfAsOperator",type:"error"},{inputs:[],name:"NewOwnerIsZeroAddress",type:"error"},{inputs:[],name:"NoHandoverRequest",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"uint256",name:"contentType",type:"uint256"}],name:"ABIChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"address",name:"a",type:"address"}],name:"AddrChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"coinType",type:"uint256"},{indexed:!1,internalType:"bytes",name:"newAddress",type:"bytes"}],name:"AddressChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"address",name:"delegate",type:"address"},{indexed:!0,internalType:"bool",name:"approved",type:"bool"}],name:"Approved",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"hash",type:"bytes"}],name:"ContenthashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"uint16",name:"resource",type:"uint16"},{indexed:!1,internalType:"bytes",name:"record",type:"bytes"}],name:"DNSRecordChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"name",type:"bytes"},{indexed:!1,internalType:"uint16",name:"resource",type:"uint16"}],name:"DNSRecordDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"lastzonehash",type:"bytes"},{indexed:!1,internalType:"bytes",name:"zonehash",type:"bytes"}],name:"DNSZonehashChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"bytes4",name:"interfaceID",type:"bytes4"},{indexed:!1,internalType:"address",name:"implementer",type:"address"}],name:"InterfaceChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"string",name:"name",type:"string"}],name:"NameChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"pendingOwner",type:"address"}],name:"OwnershipHandoverCanceled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"pendingOwner",type:"address"}],name:"OwnershipHandoverRequested",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"x",type:"bytes32"},{indexed:!1,internalType:"bytes32",name:"y",type:"bytes32"}],name:"PubkeyChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newRegistrarController",type:"address"}],name:"RegistrarControllerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newReverseRegistrar",type:"address"}],name:"ReverseRegistrarUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!0,internalType:"string",name:"indexedKey",type:"string"},{indexed:!1,internalType:"string",name:"key",type:"string"},{indexed:!1,internalType:"string",name:"value",type:"string"}],name:"TextChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"node",type:"bytes32"},{indexed:!1,internalType:"uint64",name:"newVersion",type:"uint64"}],name:"VersionChanged",type:"event"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentTypes",type:"uint256"}],name:"ABI",outputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"addr",outputs:[{internalType:"address payable",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"}],name:"addr",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"delegate",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"cancelOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"clearRecords",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"pendingOwner",type:"address"}],name:"completeOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"contenthash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"name",type:"bytes32"},{internalType:"uint16",name:"resource",type:"uint16"}],name:"dnsRecord",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[],name:"ens",outputs:[{internalType:"contract ENS",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"name",type:"bytes32"}],name:"hasDNSRecords",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"interfaceImplementer",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"delegate",type:"address"}],name:"isApprovedFor",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicall",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"nodehash",type:"bytes32"},{internalType:"bytes[]",name:"data",type:"bytes[]"}],name:"multicallWithNodeCheck",outputs:[{internalType:"bytes[]",name:"results",type:"bytes[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"result",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"pendingOwner",type:"address"}],name:"ownershipHandoverExpiresAt",outputs:[{internalType:"uint256",name:"result",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"pubkey",outputs:[{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"recordVersions",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"registrarController",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"requestOwnershipHandover",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes",name:"",type:"bytes"},{internalType:"bytes",name:"data",type:"bytes"}],name:"resolve",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"},{inputs:[],name:"reverseRegistrar",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"contentType",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"setABI",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"uint256",name:"coinType",type:"uint256"},{internalType:"bytes",name:"a",type:"bytes"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"address",name:"a",type:"address"}],name:"setAddr",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"hash",type:"bytes"}],name:"setContenthash",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"data",type:"bytes"}],name:"setDNSRecords",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes4",name:"interfaceID",type:"bytes4"},{internalType:"address",name:"implementer",type:"address"}],name:"setInterface",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"newName",type:"string"}],name:"setName",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes32",name:"x",type:"bytes32"},{internalType:"bytes32",name:"y",type:"bytes32"}],name:"setPubkey",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"registrarController_",type:"address"}],name:"setRegistrarController",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"reverseRegistrar_",type:"address"}],name:"setReverseRegistrar",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"},{internalType:"string",name:"value",type:"string"}],name:"setText",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"bytes",name:"hash",type:"bytes"}],name:"setZonehash",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceID",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"},{internalType:"string",name:"key",type:"string"}],name:"text",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"node",type:"bytes32"}],name:"zonehash",outputs:[{internalType:"bytes",name:"",type:"bytes"}],stateMutability:"view",type:"function"}];const getNameservice=fr=>__awaiter$9(void 0,[fr],void 0,function*({rpcProvider:br,address:wr}){const Er={avatar:void 0,name:void 0},kr=yield br.getChainId();if(!kr)return Er;const jr=(Wr,qr)=>{const Gr=Wr.toLocaleLowerCase(),Vr=keccak256(Gr.substring(2)),Zr=Br(qr),Jr=namehash(`${Zr.toLocaleUpperCase()}.reverse`);return keccak256(encodePacked(["bytes32","bytes32"],[Jr,Vr]))},Br=Wr=>((2147483648|Wr)>>>0).toString(16).toLocaleUpperCase();if(kr===8453){const Wr=jr(wr,8453);try{const qr=yield br.readContract({abi:L2ResolverAbi,address:"0xC6d566A56A1aFf6508b41f6c90ff131615583BCD",args:[Wr],functionName:"name"});if(qr)return Er.name=qr,Er}catch{return Er}}else Er.name=yield br.getEnsName({address:wr}),Er.avatar=Er.name?yield br.getEnsAvatar({name:Er.name}):void 0;return Er}),isTransactionExecutionError=fr=>fr!=null&&typeof fr=="object"&&"walk"in fr&&typeof fr.walk=="function",interceptTransport=({getAccounts:fr,onPersonalSign:br,onSendTransaction:wr,onSignTypedData:Er,transport:kr})=>jr=>{const Br=kr(jr);return custom({request:Wr=>__awaiter$9(void 0,void 0,void 0,function*(){var qr;const{method:Gr,params:Vr}=Wr;if(fr&&Gr==="eth_accounts")return fr({provider:Br});if(br&&Gr==="personal_sign"){const[Zr]=Vr;return br({args:Wr,message:Zr,provider:Br}).catch(Jr=>{throw Jr instanceof UserRejectedRequestError$1?new UserRejectedRequestError(Jr):Jr})}if(wr&&Gr==="eth_sendTransaction"){const[Zr]=Vr;return wr({args:Wr,provider:Br,transaction:Zr}).catch(Jr=>{throw isTransactionExecutionError(Jr)&&Jr.walk()instanceof UserRejectedTransactionError?new UserRejectedRequestError(Jr.walk()):Jr instanceof UserRejectedRequestError$1?new UserRejectedRequestError(Jr):Jr})}if(Er&&Gr==="eth_signTypedData_v4"){const[,Zr]=(qr=Vr)!==null&&qr!==void 0?qr:[];return Er({args:Wr,message:Zr,provider:Br}).catch(Jr=>{throw Jr instanceof UserRejectedRequestError$1?new UserRejectedRequestError(Jr):Jr})}return Br.request(Wr)})})(jr)};class EthereumWallet extends Wallet$2{getPublicClient(){return __awaiter$9(this,void 0,void 0,function*(){const br=yield this._connector.getPublicClient();if(!br)throw new Error("Unable to retrieve PublicClient");return br})}getWalletClient(br){return __awaiter$9(this,void 0,void 0,function*(){const wr=this._connector.getWalletClient(br);if(!wr)throw new Error("Unable to retrieve WalletClient");return createWalletClient({account:this.address,chain:wr.chain,transport:interceptTransport({onPersonalSign:Er=>__awaiter$9(this,[Er],void 0,function*({provider:kr,args:jr}){return yield this.sync(),kr.request(jr)}),onSendTransaction:Er=>__awaiter$9(this,[Er],void 0,function*({provider:kr,args:jr}){return yield this.sync(),kr.request(jr)}),onSignTypedData:Er=>__awaiter$9(this,[Er],void 0,function*({provider:kr,args:jr}){return yield this.sync(),kr.request(jr)}),transport:custom(wr.transport)})})})}}class EthereumWalletConnector extends WalletConnectorBase{getPublicClient(){return __awaiter$9(this,void 0,void 0,function*(){var br,wr;const Er=(br=yield this.getNetwork())!==null&&br!==void 0?br:1;if(this.evmNetworks.length===0)return;const kr={cosmos:[],evm:this.evmNetworks,solana:[],starknet:void 0};if(!this.chainRpcProviders)return;const jr=this.chainRpcProviders.getProviders(kr);return(wr=this.chainRpcProviders.getEvmProviderByChainId(jr,Er))===null||wr===void 0?void 0:wr.provider})}constructor(br){var wr;super(br),this.ChainWallet=EthereumWallet,this.evmNetworkRpcMap=()=>this.evmNetworks.reduce((Er,kr)=>{var jr;return[Er[kr.chainId]]=!((jr=kr==null?void 0:kr.privateCustomerRpcUrls)===null||jr===void 0)&&jr.length?kr.privateCustomerRpcUrls:kr.rpcUrls,Er},{}),this.evmNetworks=parseEvmNetworks(br.evmNetworks),this.chainRpcProviders=br.chainRpcProviders,(wr=this.chainRpcProviders)===null||wr===void 0||wr.registerEvmProviders()}getNetwork(){return __awaiter$9(this,void 0,void 0,function*(){const br=this.getWalletClient();if(!this.supportsNetworkSwitching||!br)return Promise.resolve(void 0);const wr=yield retryableFn(br.getChainId,{fallbackValue:FALLBACK_UNDEFINED,timeoutMs:1e3});return this.setActiveChain(chainsMap[wr]),wr})}getNameService(br){return __awaiter$9(this,void 0,void 0,function*(){const wr=yield this.getPublicClient();if(wr)return getNameservice({address:br,rpcProvider:wr})})}isTestnet(){return __awaiter$9(this,void 0,void 0,function*(){var br,wr,Er;return(Er=(wr=(br=yield this.getPublicClient())===null||br===void 0?void 0:br.chain)===null||wr===void 0?void 0:wr.testnet)!==null&&Er!==void 0?Er:!1})}parseAddress(br){try{return getAddress(br)}catch(wr){logger$7.debug(`Failed to parse EVM address into EIP55 format: error getting checksum, returning default ${br}`,wr)}return br}getSigner(){return __awaiter$9(this,void 0,void 0,function*(){return this.getWalletClient()})}getBalance(br){return __awaiter$9(this,void 0,void 0,function*(){const wr=yield this.getPublicClient(),Er=yield wr==null?void 0:wr.getBalance({address:br});if(!(!Er&&Er!==BigInt(0)))return formatEther$1(Er)})}supportsNetworkSwitching(){return!0}switchNetwork(br){return __awaiter$9(this,arguments,void 0,function*({networkName:wr,networkChainId:Er}){const kr=findEvmNetwork({chainId:Er,name:wr,networks:this.evmNetworks});if(!kr)throw new DynamicError(`Could not find network mapping for chain ${wr||Er}`);if(!this.supportsNetworkSwitching())throw new DynamicError("Network switching is not supported");const jr=this.getWalletClient();if(!jr)throw new DynamicError("Provider not found");return this.providerSwitchNetwork({network:kr,provider:jr})})}chooseAccountsToConnect(){return __awaiter$9(this,void 0,void 0,function*(){var br,wr,Er;const kr=this.getWalletClient();if(!kr)return[];try{const jr=yield kr.requestPermissions({eth_accounts:{}});logger$7.debug("chooseAccountsToConnect - requestPermissions result",jr);const Br=(Er=(wr=(br=jr==null?void 0:jr.find(Wr=>Wr.parentCapability==="eth_accounts"))===null||br===void 0?void 0:br.caveats)===null||wr===void 0?void 0:wr[0])===null||Er===void 0?void 0:Er.value;return typeof Br=="string"?[Br]:Array.isArray(Br)?Br:[]}catch(jr){if(logger$7.debug("chooseAccountsToConnect - error",jr),jr.code===4001)throw new UserRejectedRequestError$1}return[]})}getConnectedAccounts(){return __awaiter$9(this,void 0,void 0,function*(){const br=this.getWalletClient();if(!br)return[];const wr=yield retryableFn(br.getAddresses,{fallbackValue:[],timeoutMs:500});return wr.length&&this.setActiveAccount(wr[0]),wr})}providerSwitchNetwork(br){return __awaiter$9(this,arguments,void 0,function*({network:wr,provider:Er}){var kr,jr,Br,Wr;const{chainId:qr}=wr,Gr=yield this.getNetwork();if(!(Gr&&Gr===qr))try{if(!this.supportsNetworkSwitching())throw new DynamicError("Network switching is not supported");const Vr=getOrMapViemChain(wr);if(yield Er.switchChain(Vr),this.key==="magiceden"){const Zr=yield Er.getChainId();this.emit("chainChange",{chain:Zr.toString()})}else this.setActiveChain(Vr)}catch(Vr){if(Vr.code===4902||!((kr=Vr.message)===null||kr===void 0)&&kr.includes("Unrecognized chain")||((Br=(jr=Vr.data)===null||jr===void 0?void 0:jr.orginalError)===null||Br===void 0?void 0:Br.code)===4902)return this.providerAddNetwork({network:wr,provider:Er});throw!((Wr=Vr.message)===null||Wr===void 0)&&Wr.includes("rejected")||typeof Vr=="string"&&Vr.includes("rejected")?new DynamicError("User rejected the wallet's request to switch network"):Vr}})}providerAddNetwork(br){return __awaiter$9(this,arguments,void 0,function*({network:wr,provider:Er}){var kr;try{return yield Er.addChain({chain:getOrMapViemChain(wr)})}catch(jr){throw!((kr=jr.message)===null||kr===void 0)&&kr.includes("rejected")||typeof jr=="string"&&jr.includes("rejected")?new DynamicError("User rejected the wallet's request to add network"):jr}})}setActiveAccount(br){this.activeAccount=br?toAccount(br):void 0}getActiveAccount(){return this.activeAccount}setActiveChain(br){this.activeChain=br}getActiveChain(){return this.activeChain}createUiTransaction(br){return __awaiter$9(this,void 0,void 0,function*(){yield this.validateActiveWallet(br);const wr=yield this.getWalletClient(),Er=yield this.getPublicClient();if(!Er||!wr)throw new DynamicError("No public client available");return createViemUiTransaction({from:br,publicClient:Er,walletClient:wr})})}confirmTransactionStatus(br){return __awaiter$9(this,void 0,void 0,function*(){const wr=yield this.getPublicClient();if(!wr)throw new DynamicError("No public client available");return wr.waitForTransactionReceipt({confirmations:3,hash:br})})}}ChainRpcProviders.getEvmProviderByChainId=(fr,br)=>{var wr;return(wr=fr.evm)===null||wr===void 0?void 0:wr.find(kr=>kr.chainId===br)};ChainRpcProviders.registerEvmProviders=()=>{ChainRpcProviders.registerChainProviders(ProviderChain.EVM,fr=>{const br={};return fr!=null&&fr.evm&&(br.evm=parseEvmNetworks(fr.evm).map(wr=>{var Er;const kr=((Er=wr.privateCustomerRpcUrls)===null||Er===void 0?void 0:Er[0])||wr.rpcUrls[0],jr=createPublicClient({chain:getOrMapViemChain(wr),transport:http(kr)});return{chainId:wr.chainId,chainName:wr.name,provider:jr}})),br.evm})};const unFormatTransaction=fr=>Object.assign(Object.assign({},fr),{gas:typeof fr.gas<"u"?hexToBigInt(fr.gas):void 0,gasPrice:typeof fr.gasPrice<"u"?hexToBigInt(fr.gasPrice):void 0,maxFeePerGas:typeof fr.maxFeePerGas<"u"?hexToBigInt(fr.maxFeePerGas):void 0,maxPriorityFeePerGas:typeof fr.maxPriorityFeePerGas<"u"?hexToBigInt(fr.maxPriorityFeePerGas):void 0,nonce:typeof fr.nonce<"u"?hexToBigInt(fr.nonce):void 0,value:typeof fr.value<"u"?hexToBigInt(fr.value):void 0}),createAccountWithUiConfirmation=({address:fr,account:br,provider:wr,walletConnector:Er,walletUiUtils:kr})=>toAccount({address:fr,signMessage:(...jr)=>__awaiter$9(void 0,void 0,void 0,function*(){return kr.signMessage({handler:()=>__awaiter$9(void 0,void 0,void 0,function*(){return(yield br()).signMessage(...jr)}),message:(()=>{var Br;const Wr=(Br=jr[0])===null||Br===void 0?void 0:Br.message;return Wr&&!(typeof Wr=="string"&&Array.isArray(Wr))?JSON.stringify(Wr):Wr==null?void 0:Wr.toString()})(),walletConnector:Er})}),signTransaction:(...jr)=>__awaiter$9(void 0,void 0,void 0,function*(){const Br=new ViemUiTransaction({account:fr,onSubmit:Wr=>__awaiter$9(void 0,void 0,void 0,function*(){return(yield br()).signTransaction(Wr)}),publicClient:wr,transaction:jr[0]});return kr.sendTransaction(Er,Br)}),signTypedData:(...jr)=>kr.signMessage({handler:()=>__awaiter$9(void 0,void 0,void 0,function*(){return(yield br()).signTypedData(...jr)}),message:JSON.stringify(jr[0]),walletConnector:Er})}),createWalletClientWithUiConfirmation=({address:fr,account:br,chain:wr,transport:Er,walletConnector:kr,walletUiUtils:jr})=>{let Br=null;const Wr=createPublicClient({chain:wr,transport:Er}),qr=createAccountWithUiConfirmation({account:br,address:fr,provider:Wr,walletConnector:kr,walletUiUtils:jr}),Gr=interceptTransport({getAccounts:()=>__awaiter$9(void 0,void 0,void 0,function*(){return[fr]}),onPersonalSign:Vr=>__awaiter$9(void 0,[Vr],void 0,function*({message:Zr}){if(!Br)throw new Error("Client not initialized");return Br.signMessage({message:{raw:Zr}})}),onSendTransaction:Vr=>__awaiter$9(void 0,[Vr],void 0,function*({transaction:Zr}){if(!Br)throw new Error("Client not initialized");const Jr=unFormatTransaction(Zr);return Br.sendTransaction(Jr)}),onSignTypedData:Vr=>__awaiter$9(void 0,[Vr],void 0,function*({message:Zr}){if(!Br)throw new Error("Client not initialized");return Br.signTypedData(JSON.parse(Zr))}),transport:Er});return Br=createWalletClient({account:qr,chain:wr,transport:Gr}),Br};assertPackageVersion("@dynamic-labs/ethereum-core",version$a);class TurnkeyEVMWalletConnector extends TurnkeyWalletConnectorBase{constructor(br,wr){var Er;super(br,wr),this.walletFallback={brand:{alt:"Turnkey Wallet",spriteId:"turnkey"},name:"Turnkey HD"},this.ChainWallet=EthereumWallet,this.connectedChain="EVM",this.supportedChains=["ETH","EVM"],this.verifiedCredentialChain="eip155",this.stampCreateWalletAccountRequest=kr=>__awaiter$a(this,[kr],void 0,function*({request:jr}){return yield this.createOrRestoreSession(),this.getTurnkeyClient().stampCreateWalletAccounts(jr)}),this.evmNetworks=parseEvmNetworks(wr.evmNetworks),this.walletUiUtils=wr.walletUiUtils,this._turnkeyAccount=void 0,this._selectedChainId=this.getLastUsedChainId(),this.chainRpcProviders=wr.chainRpcProviders,(Er=this.chainRpcProviders)===null||Er===void 0||Er.registerEvmProviders(),this.__turnkeyClient=this.getTurnkeyClient()}getLastUsedChainId(){var br;if(this.lastUsedChainId)return this.lastUsedChainId;if(!((br=this.evmNetworks)===null||br===void 0)&&br.length)return this.evmNetworks[0].chainId}getNetwork(){return __awaiter$a(this,void 0,void 0,function*(){var br;return(br=yield this.getSigner())===null||br===void 0?void 0:br.getChainId()})}supportsNetworkSwitching(){return!0}switchNetwork(br){return __awaiter$a(this,arguments,void 0,function*({networkChainId:wr}){wr&&(typeof wr=="string"&&(wr=parseInt(wr)),this.lastUsedChainId=wr,this._selectedChainId=wr,yield this.refreshTurnkeyAccount(),this.emit("chainChange",{chain:wr.toString()}))})}setVerifiedCredentials(br){const wr=findTurnkeyVerifiedCredentialsWithSmartWalletRef(br,"eip155"),[Er]=wr;JSON.stringify(this.verifiedCredentials)!==JSON.stringify(wr)&&(this.verifiedCredential=Er,this.verifiedCredentials=wr,this.refreshTurnkeyAccount())}validateActiveWallet(br){return __awaiter$a(this,void 0,void 0,function*(){var wr,Er;const kr=((wr=this.verifiedCredential)===null||wr===void 0?void 0:wr.address)||"";if(!isSameAddress$1(kr,br,this.connectedChain)){const Br=(Er=this.verifiedCredentials)===null||Er===void 0?void 0:Er.find(Wr=>(Wr==null?void 0:Wr.address)===br);if(!Br)throw new DynamicError("Account not found");this.verifiedCredential=Br,this.refreshTurnkeyAccount()}})}getRpcUrl(){const br=this._selectedChainId;return getRpcUrlForChain({chainId:br,networks:this.evmNetworks})}getBalance(br){return __awaiter$a(this,void 0,void 0,function*(){const wr=this.getRpcUrl();if(!wr)return;const kr=yield createPublicClient({transport:http(wr)}).getBalance({address:br});return formatEther$1(kr)})}signMessage(br){return __awaiter$a(this,void 0,void 0,function*(){const wr=yield this.getSigner();if(!wr)throw new Error("Signer not found");return wr.signMessage({message:br})})}getPublicClient(){return __awaiter$a(this,void 0,void 0,function*(){var br,wr;if(this.evmNetworks.length===0)return;const Er=(br=yield this.getNetwork())!==null&&br!==void 0?br:1,kr={cosmos:[],evm:this.evmNetworks,solana:[],starknet:void 0};if(!this.chainRpcProviders)return;const jr=this.chainRpcProviders.getProviders(kr);return(wr=this.chainRpcProviders.getEvmProviderByChainId(jr,Er))===null||wr===void 0?void 0:wr.provider})}getSigner(){return __awaiter$a(this,void 0,void 0,function*(){return yield this.getTurnkeyAccount(),this.getWalletClient()})}getTurnkeyClient(){var br;let wr=getTLD();wr||(wr=PlatformService.getHostname());const Er=PasskeyService.createWebauthnStamper({rpId:wr}),kr=TurnkeyWalletConnectorBase==null?void 0:TurnkeyWalletConnectorBase.apiKeyStamper,jr=kr??Er;return this.__turnkeyClient=(br=this.getAuthenticatorHandler().client)!==null&&br!==void 0?br:new TurnkeyClient({baseUrl:TURNKEY_API_BASE_URL},jr),this.__turnkeyClient}getAccount(){return __awaiter$a(this,void 0,void 0,function*(){var br,wr,Er;return this.isSessionKeyCompatible()&&((br=this.__turnkeyClient)===null||br===void 0?void 0:br.stamper)instanceof ApiKeyStamper?this._turnkeyAccount:((this.getAuthenticatorHandler().recoveryType==="passkey"&&((wr=this.__turnkeyClient)===null||wr===void 0?void 0:wr.stamper)instanceof IframeStamper||this.getAuthenticatorHandler().recoveryType==="email"&&((Er=this.__turnkeyClient)===null||Er===void 0?void 0:Er.stamper)instanceof WebauthnStamper||this.__turnkeyClient!==this.getAuthenticatorHandler().client)&&(yield this.refreshTurnkeyAccount()),this._turnkeyAccount)})}getWalletClient(){const br=this.networkRpcUrl,wr=this._turnkeyAccount,Er=this.currentEvmNetwork;if(!(!wr||!br||!Er))return createWalletClientWithUiConfirmation({account:this.getAccount.bind(this),address:this.turnkeyAddress,chain:getOrMapViemChain(Er),transport:http(br),walletConnector:this,walletUiUtils:this.walletUiUtils})}get currentChainId(){var br,wr,Er;return(br=this._selectedChainId)!==null&&br!==void 0?br:(Er=(wr=this.evmNetworks)===null||wr===void 0?void 0:wr[0])===null||Er===void 0?void 0:Er.chainId}get lastUsedChainId(){const br=localStorage.getItem(TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey);if(br)try{const wr=parseInt(br);if(isNaN(wr))return;if(!this.evmNetworks.some(kr=>kr.chainId===wr)){const kr=this.evmNetworks[0].chainId;return this.lastUsedChainId=kr,this.lastUsedChainId}return wr}catch(wr){logger$4.error(wr);return}}set lastUsedChainId(br){br===void 0?localStorage.removeItem(TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey):localStorage.setItem(TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey,br.toString())}get networkRpcUrl(){const br=this.currentChainId;return this.evmNetworks.find(kr=>kr.chainId===br)?getRpcUrlForChain({chainId:br,networks:this.evmNetworks}):void 0}get currentEvmNetwork(){const br=this.currentChainId;return this.evmNetworks.find(wr=>wr.chainId===br)}internalSignTransaction(br){return __awaiter$a(this,arguments,void 0,function*({transaction:wr,args:Er,address:kr,turnkeySubOrganizationId:jr}){return this.doRetryableTurnkeyAction({action:Br=>Br.signTransaction(wr,Er),activityType:"SignTransaction",address:kr,turnkeySubOrganizationId:jr})})}internalSignTypedData(br){return __awaiter$a(this,arguments,void 0,function*({typedData:wr,address:Er,turnkeySubOrganizationId:kr}){return this.doRetryableTurnkeyAction({action:jr=>jr.signTypedData(wr),activityType:"SignTypedData",address:Er,turnkeySubOrganizationId:kr})})}internalSignMessage(br){return __awaiter$a(this,arguments,void 0,function*({message:wr,address:Er,turnkeySubOrganizationId:kr}){return this.doRetryableTurnkeyAction({action:jr=>jr.signMessage({message:wr}),activityType:"SignMessage",address:Er,turnkeySubOrganizationId:kr})})}doRetryableTurnkeyAction(br){return __awaiter$a(this,arguments,void 0,function*({action:wr,activityType:Er,address:kr,turnkeySubOrganizationId:jr}){yield this.createOrRestoreSession();let Br=yield this.createTurnkeyAccount({address:kr,turnkeySubOrganizationId:jr});try{return yield wr(Br)}catch(Wr){if(TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS.some(qr=>Wr.message.includes(qr)))return yield this.removeSessionKeys(),yield this.createOrRestoreSession({ignoreRestore:!0}),Br=yield this.createTurnkeyAccount({address:kr,turnkeySubOrganizationId:jr}),wr(Br);throw logger$4.error(`[TK] failed to perform ${Er} activity`,Wr),Wr}})}createTurnkeyAccount(br){return __awaiter$a(this,arguments,void 0,function*({address:wr,turnkeySubOrganizationId:Er}){return createAccount({client:this.getTurnkeyClient(),ethereumAddress:wr,organizationId:Er,signWith:wr})})}refreshTurnkeyAccount(){return __awaiter$a(this,void 0,void 0,function*(){return this._turnkeyAccount=void 0,this.getTurnkeyAccount()})}getTurnkeyAccount(){return __awaiter$a(this,void 0,void 0,function*(){var br,wr;if(this._turnkeyAccount)return this._turnkeyAccount;const{turnkeySubOrganizationId:Er}=(br=this.walletProperties)!==null&&br!==void 0?br:{},{address:kr}=(wr=this.verifiedCredential)!==null&&wr!==void 0?wr:{};if(!(!Er||!kr))return this._turnkeyAccount=toAccount({address:kr,signMessage:jr=>__awaiter$a(this,[jr],void 0,function*({message:Br}){return this.internalSignMessage({address:kr,message:Br,turnkeySubOrganizationId:Er})}),signTransaction:(jr,Br)=>__awaiter$a(this,void 0,void 0,function*(){return this.internalSignTransaction({address:kr,args:Br,transaction:jr,turnkeySubOrganizationId:Er})}),signTypedData:jr=>__awaiter$a(this,void 0,void 0,function*(){return this.internalSignTypedData({address:kr,turnkeySubOrganizationId:Er,typedData:jr})})}),this.setLoggerMetadata(),this._turnkeyAccount})}createUiTransaction(br){return __awaiter$a(this,void 0,void 0,function*(){yield this.validateActiveWallet(br);const wr=this.getWalletClient(),Er=yield this.getPublicClient();if(!Er||!wr)throw new DynamicError("No public client available");return createViemUiTransaction({from:br,publicClient:Er,walletClient:wr})})}}TurnkeyEVMWalletConnector.lastUsedChainIdStorageKey="turnkey-last-used-chain-id";const TurnkeyEVMWalletConnectors=fr=>{var br;return!((br=fr.apiProviders)===null||br===void 0)&&br.turnkey?[TurnkeyEVMWalletConnector.bind(null,TurnkeyWalletConnectorInfo.TurnkeyHD),TurnkeyEVMWalletConnector.bind(null,TurnkeyWalletConnectorInfo.Turnkey)]:[]};assertPackageVersion("@dynamic-labs/embedded-wallet-evm",version$d);var version$9="3.8.2";function __rest$6(fr,br){var wr={};for(var Er in fr)Object.prototype.hasOwnProperty.call(fr,Er)&&br.indexOf(Er)<0&&(wr[Er]=fr[Er]);if(fr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var kr=0,Er=Object.getOwnPropertySymbols(fr);krwr.chain==="evm")}installedProviders(){const br=this.getInjectedConfig();if(!br)return[];const wr=[];if(br.windowLocations)for(const Er of br.windowLocations){const kr=getProvidersFromWindow(Er);kr&&kr.length&&wr.push(...kr)}return window.ethereum&&(!window.ethereum.providers||!window.ethereum.providers.length?wr.push(window.ethereum):window.ethereum.providers.forEach(Er=>wr.push(Er))),wr}installedProviderLookup(br){const wr=this.installedProviders();return ProviderLookup(wr,br)}eip6963ProviderLookup(br){var wr;const{providers:Er}=Eip6963ProviderSingleton.get();return(wr=Er.find(kr=>{var jr;return((jr=kr==null?void 0:kr.info)===null||jr===void 0?void 0:jr.rdns)===br}))===null||wr===void 0?void 0:wr.provider}isInstalledHelper(){return this.findProvider()!==void 0}findProvider(){return this.connector.findProvider()}findWalletClient(br){const wr=this.findProvider();if(wr)return createWalletClient({account:this.connector.getActiveAccount(),chain:br?chainsMap[br]:this.connector.getActiveChain(),transport:custom(wr)})}getAddress(){return __awaiter$8(this,void 0,void 0,function*(){const br=this.findWalletClient();return br?this.getAddressWithProvider(br):Promise.resolve(void 0)})}getAddressWithProvider(br){return __awaiter$8(this,void 0,void 0,function*(){try{const[wr]=yield br.requestAddresses(),Er=getAddress(wr);return this.connector.setActiveAccount(Er),Er}catch(wr){return logger$7.error(wr),Promise.reject(wr)}})}signMessage(br){return __awaiter$8(this,void 0,void 0,function*(){const wr=yield this.getAddress();if(!wr)return Promise.resolve(void 0);const Er=this.findWalletClient();return Er?yield Er.signMessage({account:wr,message:br}):Promise.resolve(void 0)})}_setupEventListeners(br){const wr=this.findProvider();if(!wr)return logger$7.warn("Provider not found",{connector:br}),{tearDownEventListeners:()=>{}};if(!wr.on)return logger$7.warn("Provider does not support event listeners",{connector:br,provider:wr}),{tearDownEventListeners:()=>{}};const{handleAccountChange:Er,handleChainChange:kr,handleDisconnect:jr}=eventListenerHandlers(br);return wr.on("accountsChanged",Er),wr.on("chainChanged",kr),wr.on("disconnect",jr),{tearDownEventListeners:()=>{const Wr=this.findProvider();Wr&&(Er&&Wr.removeListener("accountsChanged",Er),kr&&Wr.removeListener("chainChanged",kr),jr&&Wr.removeListener("disconnect",jr))}}}}var chacha20poly1305={},chacha={},binary={},int={};(function(fr){Object.defineProperty(fr,"__esModule",{value:!0});function br(Wr,qr){var Gr=Wr>>>16&65535,Vr=Wr&65535,Zr=qr>>>16&65535,Jr=qr&65535;return Vr*Jr+(Gr*Jr+Vr*Zr<<16>>>0)|0}fr.mul=Math.imul||br;function wr(Wr,qr){return Wr+qr|0}fr.add=wr;function Er(Wr,qr){return Wr-qr|0}fr.sub=Er;function kr(Wr,qr){return Wr<>>32-qr}fr.rotl=kr;function jr(Wr,qr){return Wr<<32-qr|Wr>>>qr}fr.rotr=jr;function Br(Wr){return typeof Wr=="number"&&isFinite(Wr)&&Math.floor(Wr)===Wr}fr.isInteger=Number.isInteger||Br,fr.MAX_SAFE_INTEGER=9007199254740991,fr.isSafeInteger=function(Wr){return fr.isInteger(Wr)&&Wr>=-fr.MAX_SAFE_INTEGER&&Wr<=fr.MAX_SAFE_INTEGER}})(int);Object.defineProperty(binary,"__esModule",{value:!0});var int_1=int;function readInt16BE(fr,br){return br===void 0&&(br=0),(fr[br+0]<<8|fr[br+1])<<16>>16}binary.readInt16BE=readInt16BE;function readUint16BE(fr,br){return br===void 0&&(br=0),(fr[br+0]<<8|fr[br+1])>>>0}binary.readUint16BE=readUint16BE;function readInt16LE(fr,br){return br===void 0&&(br=0),(fr[br+1]<<8|fr[br])<<16>>16}binary.readInt16LE=readInt16LE;function readUint16LE(fr,br){return br===void 0&&(br=0),(fr[br+1]<<8|fr[br])>>>0}binary.readUint16LE=readUint16LE;function writeUint16BE(fr,br,wr){return br===void 0&&(br=new Uint8Array(2)),wr===void 0&&(wr=0),br[wr+0]=fr>>>8,br[wr+1]=fr>>>0,br}binary.writeUint16BE=writeUint16BE;binary.writeInt16BE=writeUint16BE;function writeUint16LE(fr,br,wr){return br===void 0&&(br=new Uint8Array(2)),wr===void 0&&(wr=0),br[wr+0]=fr>>>0,br[wr+1]=fr>>>8,br}binary.writeUint16LE=writeUint16LE;binary.writeInt16LE=writeUint16LE;function readInt32BE(fr,br){return br===void 0&&(br=0),fr[br]<<24|fr[br+1]<<16|fr[br+2]<<8|fr[br+3]}binary.readInt32BE=readInt32BE;function readUint32BE(fr,br){return br===void 0&&(br=0),(fr[br]<<24|fr[br+1]<<16|fr[br+2]<<8|fr[br+3])>>>0}binary.readUint32BE=readUint32BE;function readInt32LE(fr,br){return br===void 0&&(br=0),fr[br+3]<<24|fr[br+2]<<16|fr[br+1]<<8|fr[br]}binary.readInt32LE=readInt32LE;function readUint32LE(fr,br){return br===void 0&&(br=0),(fr[br+3]<<24|fr[br+2]<<16|fr[br+1]<<8|fr[br])>>>0}binary.readUint32LE=readUint32LE;function writeUint32BE(fr,br,wr){return br===void 0&&(br=new Uint8Array(4)),wr===void 0&&(wr=0),br[wr+0]=fr>>>24,br[wr+1]=fr>>>16,br[wr+2]=fr>>>8,br[wr+3]=fr>>>0,br}binary.writeUint32BE=writeUint32BE;binary.writeInt32BE=writeUint32BE;function writeUint32LE(fr,br,wr){return br===void 0&&(br=new Uint8Array(4)),wr===void 0&&(wr=0),br[wr+0]=fr>>>0,br[wr+1]=fr>>>8,br[wr+2]=fr>>>16,br[wr+3]=fr>>>24,br}binary.writeUint32LE=writeUint32LE;binary.writeInt32LE=writeUint32LE;function readInt64BE(fr,br){br===void 0&&(br=0);var wr=readInt32BE(fr,br),Er=readInt32BE(fr,br+4);return wr*4294967296+Er-(Er>>31)*4294967296}binary.readInt64BE=readInt64BE;function readUint64BE(fr,br){br===void 0&&(br=0);var wr=readUint32BE(fr,br),Er=readUint32BE(fr,br+4);return wr*4294967296+Er}binary.readUint64BE=readUint64BE;function readInt64LE(fr,br){br===void 0&&(br=0);var wr=readInt32LE(fr,br),Er=readInt32LE(fr,br+4);return Er*4294967296+wr-(wr>>31)*4294967296}binary.readInt64LE=readInt64LE;function readUint64LE(fr,br){br===void 0&&(br=0);var wr=readUint32LE(fr,br),Er=readUint32LE(fr,br+4);return Er*4294967296+wr}binary.readUint64LE=readUint64LE;function writeUint64BE(fr,br,wr){return br===void 0&&(br=new Uint8Array(8)),wr===void 0&&(wr=0),writeUint32BE(fr/4294967296>>>0,br,wr),writeUint32BE(fr>>>0,br,wr+4),br}binary.writeUint64BE=writeUint64BE;binary.writeInt64BE=writeUint64BE;function writeUint64LE(fr,br,wr){return br===void 0&&(br=new Uint8Array(8)),wr===void 0&&(wr=0),writeUint32LE(fr>>>0,br,wr),writeUint32LE(fr/4294967296>>>0,br,wr+4),br}binary.writeUint64LE=writeUint64LE;binary.writeInt64LE=writeUint64LE;function readUintBE(fr,br,wr){if(wr===void 0&&(wr=0),fr%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(fr/8>br.length-wr)throw new Error("readUintBE: array is too short for the given bitLength");for(var Er=0,kr=1,jr=fr/8+wr-1;jr>=wr;jr--)Er+=br[jr]*kr,kr*=256;return Er}binary.readUintBE=readUintBE;function readUintLE(fr,br,wr){if(wr===void 0&&(wr=0),fr%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(fr/8>br.length-wr)throw new Error("readUintLE: array is too short for the given bitLength");for(var Er=0,kr=1,jr=wr;jr=Er;jr--)wr[jr]=br/kr&255,kr*=256;return wr}binary.writeUintBE=writeUintBE;function writeUintLE(fr,br,wr,Er){if(wr===void 0&&(wr=new Uint8Array(fr/8)),Er===void 0&&(Er=0),fr%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(br))throw new Error("writeUintLE value must be an integer");for(var kr=1,jr=Er;jr>>16|Xr<<16,so=so+Xr|0,_i^=so,_i=_i>>>20|_i<<12,eo=eo+oo|0,Sn^=eo,Sn=Sn>>>16|Sn<<16,no=no+Sn|0,oo^=no,oo=oo>>>20|oo<<12,ro=ro+io|0,Rn^=ro,Rn=Rn>>>16|Rn<<16,Tn=Tn+Rn|0,io^=Tn,io=io>>>20|io<<12,to=to+co|0,Pn^=to,Pn=Pn>>>16|Pn<<16,Hr=Hr+Pn|0,co^=Hr,co=co>>>20|co<<12,ro=ro+io|0,Rn^=ro,Rn=Rn>>>24|Rn<<8,Tn=Tn+Rn|0,io^=Tn,io=io>>>25|io<<7,to=to+co|0,Pn^=to,Pn=Pn>>>24|Pn<<8,Hr=Hr+Pn|0,co^=Hr,co=co>>>25|co<<7,eo=eo+oo|0,Sn^=eo,Sn=Sn>>>24|Sn<<8,no=no+Sn|0,oo^=no,oo=oo>>>25|oo<<7,jn=jn+_i|0,Xr^=jn,Xr=Xr>>>24|Xr<<8,so=so+Xr|0,_i^=so,_i=_i>>>25|_i<<7,jn=jn+oo|0,Pn^=jn,Pn=Pn>>>16|Pn<<16,Tn=Tn+Pn|0,oo^=Tn,oo=oo>>>20|oo<<12,eo=eo+io|0,Xr^=eo,Xr=Xr>>>16|Xr<<16,Hr=Hr+Xr|0,io^=Hr,io=io>>>20|io<<12,ro=ro+co|0,Sn^=ro,Sn=Sn>>>16|Sn<<16,so=so+Sn|0,co^=so,co=co>>>20|co<<12,to=to+_i|0,Rn^=to,Rn=Rn>>>16|Rn<<16,no=no+Rn|0,_i^=no,_i=_i>>>20|_i<<12,ro=ro+co|0,Sn^=ro,Sn=Sn>>>24|Sn<<8,so=so+Sn|0,co^=so,co=co>>>25|co<<7,to=to+_i|0,Rn^=to,Rn=Rn>>>24|Rn<<8,no=no+Rn|0,_i^=no,_i=_i>>>25|_i<<7,eo=eo+io|0,Xr^=eo,Xr=Xr>>>24|Xr<<8,Hr=Hr+Xr|0,io^=Hr,io=io>>>25|io<<7,jn=jn+oo|0,Pn^=jn,Pn=Pn>>>24|Pn<<8,Tn=Tn+Pn|0,oo^=Tn,oo=oo>>>25|oo<<7;binary_1.writeUint32LE(jn+Er|0,fr,0),binary_1.writeUint32LE(eo+kr|0,fr,4),binary_1.writeUint32LE(ro+jr|0,fr,8),binary_1.writeUint32LE(to+Br|0,fr,12),binary_1.writeUint32LE(_i+Wr|0,fr,16),binary_1.writeUint32LE(oo+qr|0,fr,20),binary_1.writeUint32LE(io+Gr|0,fr,24),binary_1.writeUint32LE(co+Vr|0,fr,28),binary_1.writeUint32LE(so+Zr|0,fr,32),binary_1.writeUint32LE(no+Jr|0,fr,36),binary_1.writeUint32LE(Tn+Qr|0,fr,40),binary_1.writeUint32LE(Hr+_n|0,fr,44),binary_1.writeUint32LE(Xr+En|0,fr,48),binary_1.writeUint32LE(Sn+Cn|0,fr,52),binary_1.writeUint32LE(Rn+In|0,fr,56),binary_1.writeUint32LE(Pn+An|0,fr,60)}function streamXOR(fr,br,wr,Er,kr){if(kr===void 0&&(kr=0),fr.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(Er.length>>=8,br++;if(Er>0)throw new Error("ChaCha: counter overflow")}var poly1305={},constantTime={};Object.defineProperty(constantTime,"__esModule",{value:!0});function select(fr,br,wr){return~(fr-1)&br|fr-1&wr}constantTime.select=select;function lessOrEqual(fr,br){return(fr|0)-(br|0)-1>>>31&1}constantTime.lessOrEqual=lessOrEqual;function compare(fr,br){if(fr.length!==br.length)return 0;for(var wr=0,Er=0;Er>>8}constantTime.compare=compare;function equal(fr,br){return fr.length===0||br.length===0?!1:compare(fr,br)!==0}constantTime.equal=equal;(function(fr){Object.defineProperty(fr,"__esModule",{value:!0});var br=constantTime,wr=wipe$1;fr.DIGEST_LENGTH=16;var Er=function(){function Br(Wr){this.digestLength=fr.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var qr=Wr[0]|Wr[1]<<8;this._r[0]=qr&8191;var Gr=Wr[2]|Wr[3]<<8;this._r[1]=(qr>>>13|Gr<<3)&8191;var Vr=Wr[4]|Wr[5]<<8;this._r[2]=(Gr>>>10|Vr<<6)&7939;var Zr=Wr[6]|Wr[7]<<8;this._r[3]=(Vr>>>7|Zr<<9)&8191;var Jr=Wr[8]|Wr[9]<<8;this._r[4]=(Zr>>>4|Jr<<12)&255,this._r[5]=Jr>>>1&8190;var Qr=Wr[10]|Wr[11]<<8;this._r[6]=(Jr>>>14|Qr<<2)&8191;var _n=Wr[12]|Wr[13]<<8;this._r[7]=(Qr>>>11|_n<<5)&8065;var En=Wr[14]|Wr[15]<<8;this._r[8]=(_n>>>8|En<<8)&8191,this._r[9]=En>>>5&127,this._pad[0]=Wr[16]|Wr[17]<<8,this._pad[1]=Wr[18]|Wr[19]<<8,this._pad[2]=Wr[20]|Wr[21]<<8,this._pad[3]=Wr[22]|Wr[23]<<8,this._pad[4]=Wr[24]|Wr[25]<<8,this._pad[5]=Wr[26]|Wr[27]<<8,this._pad[6]=Wr[28]|Wr[29]<<8,this._pad[7]=Wr[30]|Wr[31]<<8}return Br.prototype._blocks=function(Wr,qr,Gr){for(var Vr=this._fin?0:2048,Zr=this._h[0],Jr=this._h[1],Qr=this._h[2],_n=this._h[3],En=this._h[4],Cn=this._h[5],In=this._h[6],An=this._h[7],jn=this._h[8],eo=this._h[9],ro=this._r[0],to=this._r[1],_i=this._r[2],oo=this._r[3],io=this._r[4],co=this._r[5],so=this._r[6],no=this._r[7],Tn=this._r[8],Hr=this._r[9];Gr>=16;){var Xr=Wr[qr+0]|Wr[qr+1]<<8;Zr+=Xr&8191;var Sn=Wr[qr+2]|Wr[qr+3]<<8;Jr+=(Xr>>>13|Sn<<3)&8191;var Rn=Wr[qr+4]|Wr[qr+5]<<8;Qr+=(Sn>>>10|Rn<<6)&8191;var Pn=Wr[qr+6]|Wr[qr+7]<<8;_n+=(Rn>>>7|Pn<<9)&8191;var On=Wr[qr+8]|Wr[qr+9]<<8;En+=(Pn>>>4|On<<12)&8191,Cn+=On>>>1&8191;var Zn=Wr[qr+10]|Wr[qr+11]<<8;In+=(On>>>14|Zn<<2)&8191;var Nn=Wr[qr+12]|Wr[qr+13]<<8;An+=(Zn>>>11|Nn<<5)&8191;var wn=Wr[qr+14]|Wr[qr+15]<<8;jn+=(Nn>>>8|wn<<8)&8191,eo+=wn>>>5|Vr;var zn=0,fo=zn;fo+=Zr*ro,fo+=Jr*(5*Hr),fo+=Qr*(5*Tn),fo+=_n*(5*no),fo+=En*(5*so),zn=fo>>>13,fo&=8191,fo+=Cn*(5*co),fo+=In*(5*io),fo+=An*(5*oo),fo+=jn*(5*_i),fo+=eo*(5*to),zn+=fo>>>13,fo&=8191;var vo=zn;vo+=Zr*to,vo+=Jr*ro,vo+=Qr*(5*Hr),vo+=_n*(5*Tn),vo+=En*(5*no),zn=vo>>>13,vo&=8191,vo+=Cn*(5*so),vo+=In*(5*co),vo+=An*(5*io),vo+=jn*(5*oo),vo+=eo*(5*_i),zn+=vo>>>13,vo&=8191;var go=zn;go+=Zr*_i,go+=Jr*to,go+=Qr*ro,go+=_n*(5*Hr),go+=En*(5*Tn),zn=go>>>13,go&=8191,go+=Cn*(5*no),go+=In*(5*so),go+=An*(5*co),go+=jn*(5*io),go+=eo*(5*oo),zn+=go>>>13,go&=8191;var uo=zn;uo+=Zr*oo,uo+=Jr*_i,uo+=Qr*to,uo+=_n*ro,uo+=En*(5*Hr),zn=uo>>>13,uo&=8191,uo+=Cn*(5*Tn),uo+=In*(5*no),uo+=An*(5*so),uo+=jn*(5*co),uo+=eo*(5*io),zn+=uo>>>13,uo&=8191;var lo=zn;lo+=Zr*io,lo+=Jr*oo,lo+=Qr*_i,lo+=_n*to,lo+=En*ro,zn=lo>>>13,lo&=8191,lo+=Cn*(5*Hr),lo+=In*(5*Tn),lo+=An*(5*no),lo+=jn*(5*so),lo+=eo*(5*co),zn+=lo>>>13,lo&=8191;var Eo=zn;Eo+=Zr*co,Eo+=Jr*io,Eo+=Qr*oo,Eo+=_n*_i,Eo+=En*to,zn=Eo>>>13,Eo&=8191,Eo+=Cn*ro,Eo+=In*(5*Hr),Eo+=An*(5*Tn),Eo+=jn*(5*no),Eo+=eo*(5*so),zn+=Eo>>>13,Eo&=8191;var mo=zn;mo+=Zr*so,mo+=Jr*co,mo+=Qr*io,mo+=_n*oo,mo+=En*_i,zn=mo>>>13,mo&=8191,mo+=Cn*to,mo+=In*ro,mo+=An*(5*Hr),mo+=jn*(5*Tn),mo+=eo*(5*no),zn+=mo>>>13,mo&=8191;var yo=zn;yo+=Zr*no,yo+=Jr*so,yo+=Qr*co,yo+=_n*io,yo+=En*oo,zn=yo>>>13,yo&=8191,yo+=Cn*_i,yo+=In*to,yo+=An*ro,yo+=jn*(5*Hr),yo+=eo*(5*Tn),zn+=yo>>>13,yo&=8191;var _o=zn;_o+=Zr*Tn,_o+=Jr*no,_o+=Qr*so,_o+=_n*co,_o+=En*io,zn=_o>>>13,_o&=8191,_o+=Cn*oo,_o+=In*_i,_o+=An*to,_o+=jn*ro,_o+=eo*(5*Hr),zn+=_o>>>13,_o&=8191;var Bo=zn;Bo+=Zr*Hr,Bo+=Jr*Tn,Bo+=Qr*no,Bo+=_n*so,Bo+=En*co,zn=Bo>>>13,Bo&=8191,Bo+=Cn*io,Bo+=In*oo,Bo+=An*_i,Bo+=jn*to,Bo+=eo*ro,zn+=Bo>>>13,Bo&=8191,zn=(zn<<2)+zn|0,zn=zn+fo|0,fo=zn&8191,zn=zn>>>13,vo+=zn,Zr=fo,Jr=vo,Qr=go,_n=uo,En=lo,Cn=Eo,In=mo,An=yo,jn=_o,eo=Bo,qr+=16,Gr-=16}this._h[0]=Zr,this._h[1]=Jr,this._h[2]=Qr,this._h[3]=_n,this._h[4]=En,this._h[5]=Cn,this._h[6]=In,this._h[7]=An,this._h[8]=jn,this._h[9]=eo},Br.prototype.finish=function(Wr,qr){qr===void 0&&(qr=0);var Gr=new Uint16Array(10),Vr,Zr,Jr,Qr;if(this._leftover){for(Qr=this._leftover,this._buffer[Qr++]=1;Qr<16;Qr++)this._buffer[Qr]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(Vr=this._h[1]>>>13,this._h[1]&=8191,Qr=2;Qr<10;Qr++)this._h[Qr]+=Vr,Vr=this._h[Qr]>>>13,this._h[Qr]&=8191;for(this._h[0]+=Vr*5,Vr=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=Vr,Vr=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=Vr,Gr[0]=this._h[0]+5,Vr=Gr[0]>>>13,Gr[0]&=8191,Qr=1;Qr<10;Qr++)Gr[Qr]=this._h[Qr]+Vr,Vr=Gr[Qr]>>>13,Gr[Qr]&=8191;for(Gr[9]-=8192,Zr=(Vr^1)-1,Qr=0;Qr<10;Qr++)Gr[Qr]&=Zr;for(Zr=~Zr,Qr=0;Qr<10;Qr++)this._h[Qr]=this._h[Qr]&Zr|Gr[Qr];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,Jr=this._h[0]+this._pad[0],this._h[0]=Jr&65535,Qr=1;Qr<8;Qr++)Jr=(this._h[Qr]+this._pad[Qr]|0)+(Jr>>>16)|0,this._h[Qr]=Jr&65535;return Wr[qr+0]=this._h[0]>>>0,Wr[qr+1]=this._h[0]>>>8,Wr[qr+2]=this._h[1]>>>0,Wr[qr+3]=this._h[1]>>>8,Wr[qr+4]=this._h[2]>>>0,Wr[qr+5]=this._h[2]>>>8,Wr[qr+6]=this._h[3]>>>0,Wr[qr+7]=this._h[3]>>>8,Wr[qr+8]=this._h[4]>>>0,Wr[qr+9]=this._h[4]>>>8,Wr[qr+10]=this._h[5]>>>0,Wr[qr+11]=this._h[5]>>>8,Wr[qr+12]=this._h[6]>>>0,Wr[qr+13]=this._h[6]>>>8,Wr[qr+14]=this._h[7]>>>0,Wr[qr+15]=this._h[7]>>>8,this._finished=!0,this},Br.prototype.update=function(Wr){var qr=0,Gr=Wr.length,Vr;if(this._leftover){Vr=16-this._leftover,Vr>Gr&&(Vr=Gr);for(var Zr=0;Zr=16&&(Vr=Gr-Gr%16,this._blocks(Wr,qr,Vr),qr+=Vr,Gr-=Vr),Gr){for(var Zr=0;Zr16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var Qr=new Uint8Array(16);Qr.set(Gr,Qr.length-Gr.length);var _n=new Uint8Array(32);br.stream(this._key,Qr,_n,4);var En=Vr.length+this.tagLength,Cn;if(Jr){if(Jr.length!==En)throw new Error("ChaCha20Poly1305: incorrect destination length");Cn=Jr}else Cn=new Uint8Array(En);return br.streamXOR(this._key,Qr,Vr,Cn,4),this._authenticate(Cn.subarray(Cn.length-this.tagLength,Cn.length),_n,Cn.subarray(0,Cn.length-this.tagLength),Zr),Er.wipe(Qr),Cn},qr.prototype.open=function(Gr,Vr,Zr,Jr){if(Gr.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(Vr.length0&&Qr.update(Br.subarray(Jr.length%16))),Qr.update(Zr),Zr.length%16>0&&Qr.update(Br.subarray(Zr.length%16));var _n=new Uint8Array(8);Jr&&kr.writeUint64LE(Jr.length,_n),Qr.update(_n),kr.writeUint64LE(Zr.length,_n),Qr.update(_n);for(var En=Qr.digest(),Cn=0;Cnthis.blockSize?this._inner.update(wr).finish(Er).clean():Er.set(wr);for(var kr=0;kr1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},fr.prototype.expand=function(br){for(var wr=new Uint8Array(br),Er=0;Er256)throw new Error("randomString charset is too long");let Jr="";const Qr=Vr.length,_n=256-256%Qr;for(;Gr>0;){const En=kr(Math.ceil(Gr*256/_n),Zr);for(let Cn=0;Cn0;Cn++){const In=En[Cn];In<_n&&(Jr+=Vr.charAt(In%Qr),Gr--)}(0,Er.wipe)(En)}return Jr}fr.randomString=Wr;function qr(Gr,Vr=Br,Zr=fr.defaultRandomSource){const Jr=Math.ceil(Gr/(Math.log(Vr.length)/Math.LN2));return Wr(Jr,Vr,Zr)}fr.randomStringForEntropy=qr})(random);var sha256={};(function(fr){Object.defineProperty(fr,"__esModule",{value:!0});var br=binary,wr=wipe$1;fr.DIGEST_LENGTH=32,fr.BLOCK_SIZE=64;var Er=function(){function Wr(){this.digestLength=fr.DIGEST_LENGTH,this.blockSize=fr.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return Wr.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},Wr.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},Wr.prototype.clean=function(){wr.wipe(this._buffer),wr.wipe(this._temp),this.reset()},Wr.prototype.update=function(qr,Gr){if(Gr===void 0&&(Gr=qr.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var Vr=0;if(this._bytesHashed+=Gr,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=qr[Vr++],Gr--;this._bufferLength===this.blockSize&&(jr(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(Gr>=this.blockSize&&(Vr=jr(this._temp,this._state,qr,Vr,Gr),Gr%=this.blockSize);Gr>0;)this._buffer[this._bufferLength++]=qr[Vr++],Gr--;return this},Wr.prototype.finish=function(qr){if(!this._finished){var Gr=this._bytesHashed,Vr=this._bufferLength,Zr=Gr/536870912|0,Jr=Gr<<3,Qr=Gr%64<56?64:128;this._buffer[Vr]=128;for(var _n=Vr+1;_n0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},Wr.prototype.restoreState=function(qr){return this._state.set(qr.state),this._bufferLength=qr.bufferLength,qr.buffer&&this._buffer.set(qr.buffer),this._bytesHashed=qr.bytesHashed,this._finished=!1,this},Wr.prototype.cleanSavedState=function(qr){wr.wipe(qr.state),qr.buffer&&wr.wipe(qr.buffer),qr.bufferLength=0,qr.bytesHashed=0},Wr}();fr.SHA256=Er;var kr=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function jr(Wr,qr,Gr,Vr,Zr){for(;Zr>=64;){for(var Jr=qr[0],Qr=qr[1],_n=qr[2],En=qr[3],Cn=qr[4],In=qr[5],An=qr[6],jn=qr[7],eo=0;eo<16;eo++){var ro=Vr+eo*4;Wr[eo]=br.readUint32BE(Gr,ro)}for(var eo=16;eo<64;eo++){var to=Wr[eo-2],_i=(to>>>17|to<<15)^(to>>>19|to<<13)^to>>>10;to=Wr[eo-15];var oo=(to>>>7|to<<25)^(to>>>18|to<<14)^to>>>3;Wr[eo]=(_i+Wr[eo-7]|0)+(oo+Wr[eo-16]|0)}for(var eo=0;eo<64;eo++){var _i=(((Cn>>>6|Cn<<26)^(Cn>>>11|Cn<<21)^(Cn>>>25|Cn<<7))+(Cn&In^~Cn&An)|0)+(jn+(kr[eo]+Wr[eo]|0)|0)|0,oo=((Jr>>>2|Jr<<30)^(Jr>>>13|Jr<<19)^(Jr>>>22|Jr<<10))+(Jr&Qr^Jr&_n^Qr&_n)|0;jn=An,An=In,In=Cn,Cn=En+_i|0,En=_n,_n=Qr,Qr=Jr,Jr=_i+oo|0}qr[0]+=Jr,qr[1]+=Qr,qr[2]+=_n,qr[3]+=En,qr[4]+=Cn,qr[5]+=In,qr[6]+=An,qr[7]+=jn,Vr+=64,Zr-=64}return Vr}function Br(Wr){var qr=new Er;qr.update(Wr);var Gr=qr.digest();return qr.clean(),Gr}fr.hash=Br})(sha256);var x25519={};(function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.sharedKey=fr.generateKeyPair=fr.generateKeyPairFromSeed=fr.scalarMultBase=fr.scalarMult=fr.SHARED_KEY_LENGTH=fr.SECRET_KEY_LENGTH=fr.PUBLIC_KEY_LENGTH=void 0;const br=random,wr=wipe$1;fr.PUBLIC_KEY_LENGTH=32,fr.SECRET_KEY_LENGTH=32,fr.SHARED_KEY_LENGTH=32;function Er(eo){const ro=new Float64Array(16);if(eo)for(let to=0;to>16&1),to[co-1]&=65535;to[15]=_i[15]-32767-(to[14]>>16&1);const io=to[15]>>16&1;to[14]&=65535,Wr(_i,to,1-io)}for(let oo=0;oo<16;oo++)eo[2*oo]=_i[oo]&255,eo[2*oo+1]=_i[oo]>>8}function Gr(eo,ro){for(let to=0;to<16;to++)eo[to]=ro[2*to]+(ro[2*to+1]<<8);eo[15]&=32767}function Vr(eo,ro,to){for(let _i=0;_i<16;_i++)eo[_i]=ro[_i]+to[_i]}function Zr(eo,ro,to){for(let _i=0;_i<16;_i++)eo[_i]=ro[_i]-to[_i]}function Jr(eo,ro,to){let _i,oo,io=0,co=0,so=0,no=0,Tn=0,Hr=0,Xr=0,Sn=0,Rn=0,Pn=0,On=0,Zn=0,Nn=0,wn=0,zn=0,fo=0,vo=0,go=0,uo=0,lo=0,Eo=0,mo=0,yo=0,_o=0,Bo=0,Lo=0,Wo=0,na=0,qo=0,ga=0,wl=0,No=to[0],Uo=to[1],Nl=to[2],Vo=to[3],Fo=to[4],Ol=to[5],$a=to[6],Jo=to[7],Zl=to[8],Cl=to[9],ko=to[10],wo=to[11],bo=to[12],Io=to[13],Ho=to[14],Do=to[15];_i=ro[0],io+=_i*No,co+=_i*Uo,so+=_i*Nl,no+=_i*Vo,Tn+=_i*Fo,Hr+=_i*Ol,Xr+=_i*$a,Sn+=_i*Jo,Rn+=_i*Zl,Pn+=_i*Cl,On+=_i*ko,Zn+=_i*wo,Nn+=_i*bo,wn+=_i*Io,zn+=_i*Ho,fo+=_i*Do,_i=ro[1],co+=_i*No,so+=_i*Uo,no+=_i*Nl,Tn+=_i*Vo,Hr+=_i*Fo,Xr+=_i*Ol,Sn+=_i*$a,Rn+=_i*Jo,Pn+=_i*Zl,On+=_i*Cl,Zn+=_i*ko,Nn+=_i*wo,wn+=_i*bo,zn+=_i*Io,fo+=_i*Ho,vo+=_i*Do,_i=ro[2],so+=_i*No,no+=_i*Uo,Tn+=_i*Nl,Hr+=_i*Vo,Xr+=_i*Fo,Sn+=_i*Ol,Rn+=_i*$a,Pn+=_i*Jo,On+=_i*Zl,Zn+=_i*Cl,Nn+=_i*ko,wn+=_i*wo,zn+=_i*bo,fo+=_i*Io,vo+=_i*Ho,go+=_i*Do,_i=ro[3],no+=_i*No,Tn+=_i*Uo,Hr+=_i*Nl,Xr+=_i*Vo,Sn+=_i*Fo,Rn+=_i*Ol,Pn+=_i*$a,On+=_i*Jo,Zn+=_i*Zl,Nn+=_i*Cl,wn+=_i*ko,zn+=_i*wo,fo+=_i*bo,vo+=_i*Io,go+=_i*Ho,uo+=_i*Do,_i=ro[4],Tn+=_i*No,Hr+=_i*Uo,Xr+=_i*Nl,Sn+=_i*Vo,Rn+=_i*Fo,Pn+=_i*Ol,On+=_i*$a,Zn+=_i*Jo,Nn+=_i*Zl,wn+=_i*Cl,zn+=_i*ko,fo+=_i*wo,vo+=_i*bo,go+=_i*Io,uo+=_i*Ho,lo+=_i*Do,_i=ro[5],Hr+=_i*No,Xr+=_i*Uo,Sn+=_i*Nl,Rn+=_i*Vo,Pn+=_i*Fo,On+=_i*Ol,Zn+=_i*$a,Nn+=_i*Jo,wn+=_i*Zl,zn+=_i*Cl,fo+=_i*ko,vo+=_i*wo,go+=_i*bo,uo+=_i*Io,lo+=_i*Ho,Eo+=_i*Do,_i=ro[6],Xr+=_i*No,Sn+=_i*Uo,Rn+=_i*Nl,Pn+=_i*Vo,On+=_i*Fo,Zn+=_i*Ol,Nn+=_i*$a,wn+=_i*Jo,zn+=_i*Zl,fo+=_i*Cl,vo+=_i*ko,go+=_i*wo,uo+=_i*bo,lo+=_i*Io,Eo+=_i*Ho,mo+=_i*Do,_i=ro[7],Sn+=_i*No,Rn+=_i*Uo,Pn+=_i*Nl,On+=_i*Vo,Zn+=_i*Fo,Nn+=_i*Ol,wn+=_i*$a,zn+=_i*Jo,fo+=_i*Zl,vo+=_i*Cl,go+=_i*ko,uo+=_i*wo,lo+=_i*bo,Eo+=_i*Io,mo+=_i*Ho,yo+=_i*Do,_i=ro[8],Rn+=_i*No,Pn+=_i*Uo,On+=_i*Nl,Zn+=_i*Vo,Nn+=_i*Fo,wn+=_i*Ol,zn+=_i*$a,fo+=_i*Jo,vo+=_i*Zl,go+=_i*Cl,uo+=_i*ko,lo+=_i*wo,Eo+=_i*bo,mo+=_i*Io,yo+=_i*Ho,_o+=_i*Do,_i=ro[9],Pn+=_i*No,On+=_i*Uo,Zn+=_i*Nl,Nn+=_i*Vo,wn+=_i*Fo,zn+=_i*Ol,fo+=_i*$a,vo+=_i*Jo,go+=_i*Zl,uo+=_i*Cl,lo+=_i*ko,Eo+=_i*wo,mo+=_i*bo,yo+=_i*Io,_o+=_i*Ho,Bo+=_i*Do,_i=ro[10],On+=_i*No,Zn+=_i*Uo,Nn+=_i*Nl,wn+=_i*Vo,zn+=_i*Fo,fo+=_i*Ol,vo+=_i*$a,go+=_i*Jo,uo+=_i*Zl,lo+=_i*Cl,Eo+=_i*ko,mo+=_i*wo,yo+=_i*bo,_o+=_i*Io,Bo+=_i*Ho,Lo+=_i*Do,_i=ro[11],Zn+=_i*No,Nn+=_i*Uo,wn+=_i*Nl,zn+=_i*Vo,fo+=_i*Fo,vo+=_i*Ol,go+=_i*$a,uo+=_i*Jo,lo+=_i*Zl,Eo+=_i*Cl,mo+=_i*ko,yo+=_i*wo,_o+=_i*bo,Bo+=_i*Io,Lo+=_i*Ho,Wo+=_i*Do,_i=ro[12],Nn+=_i*No,wn+=_i*Uo,zn+=_i*Nl,fo+=_i*Vo,vo+=_i*Fo,go+=_i*Ol,uo+=_i*$a,lo+=_i*Jo,Eo+=_i*Zl,mo+=_i*Cl,yo+=_i*ko,_o+=_i*wo,Bo+=_i*bo,Lo+=_i*Io,Wo+=_i*Ho,na+=_i*Do,_i=ro[13],wn+=_i*No,zn+=_i*Uo,fo+=_i*Nl,vo+=_i*Vo,go+=_i*Fo,uo+=_i*Ol,lo+=_i*$a,Eo+=_i*Jo,mo+=_i*Zl,yo+=_i*Cl,_o+=_i*ko,Bo+=_i*wo,Lo+=_i*bo,Wo+=_i*Io,na+=_i*Ho,qo+=_i*Do,_i=ro[14],zn+=_i*No,fo+=_i*Uo,vo+=_i*Nl,go+=_i*Vo,uo+=_i*Fo,lo+=_i*Ol,Eo+=_i*$a,mo+=_i*Jo,yo+=_i*Zl,_o+=_i*Cl,Bo+=_i*ko,Lo+=_i*wo,Wo+=_i*bo,na+=_i*Io,qo+=_i*Ho,ga+=_i*Do,_i=ro[15],fo+=_i*No,vo+=_i*Uo,go+=_i*Nl,uo+=_i*Vo,lo+=_i*Fo,Eo+=_i*Ol,mo+=_i*$a,yo+=_i*Jo,_o+=_i*Zl,Bo+=_i*Cl,Lo+=_i*ko,Wo+=_i*wo,na+=_i*bo,qo+=_i*Io,ga+=_i*Ho,wl+=_i*Do,io+=38*vo,co+=38*go,so+=38*uo,no+=38*lo,Tn+=38*Eo,Hr+=38*mo,Xr+=38*yo,Sn+=38*_o,Rn+=38*Bo,Pn+=38*Lo,On+=38*Wo,Zn+=38*na,Nn+=38*qo,wn+=38*ga,zn+=38*wl,oo=1,_i=io+oo+65535,oo=Math.floor(_i/65536),io=_i-oo*65536,_i=co+oo+65535,oo=Math.floor(_i/65536),co=_i-oo*65536,_i=so+oo+65535,oo=Math.floor(_i/65536),so=_i-oo*65536,_i=no+oo+65535,oo=Math.floor(_i/65536),no=_i-oo*65536,_i=Tn+oo+65535,oo=Math.floor(_i/65536),Tn=_i-oo*65536,_i=Hr+oo+65535,oo=Math.floor(_i/65536),Hr=_i-oo*65536,_i=Xr+oo+65535,oo=Math.floor(_i/65536),Xr=_i-oo*65536,_i=Sn+oo+65535,oo=Math.floor(_i/65536),Sn=_i-oo*65536,_i=Rn+oo+65535,oo=Math.floor(_i/65536),Rn=_i-oo*65536,_i=Pn+oo+65535,oo=Math.floor(_i/65536),Pn=_i-oo*65536,_i=On+oo+65535,oo=Math.floor(_i/65536),On=_i-oo*65536,_i=Zn+oo+65535,oo=Math.floor(_i/65536),Zn=_i-oo*65536,_i=Nn+oo+65535,oo=Math.floor(_i/65536),Nn=_i-oo*65536,_i=wn+oo+65535,oo=Math.floor(_i/65536),wn=_i-oo*65536,_i=zn+oo+65535,oo=Math.floor(_i/65536),zn=_i-oo*65536,_i=fo+oo+65535,oo=Math.floor(_i/65536),fo=_i-oo*65536,io+=oo-1+37*(oo-1),oo=1,_i=io+oo+65535,oo=Math.floor(_i/65536),io=_i-oo*65536,_i=co+oo+65535,oo=Math.floor(_i/65536),co=_i-oo*65536,_i=so+oo+65535,oo=Math.floor(_i/65536),so=_i-oo*65536,_i=no+oo+65535,oo=Math.floor(_i/65536),no=_i-oo*65536,_i=Tn+oo+65535,oo=Math.floor(_i/65536),Tn=_i-oo*65536,_i=Hr+oo+65535,oo=Math.floor(_i/65536),Hr=_i-oo*65536,_i=Xr+oo+65535,oo=Math.floor(_i/65536),Xr=_i-oo*65536,_i=Sn+oo+65535,oo=Math.floor(_i/65536),Sn=_i-oo*65536,_i=Rn+oo+65535,oo=Math.floor(_i/65536),Rn=_i-oo*65536,_i=Pn+oo+65535,oo=Math.floor(_i/65536),Pn=_i-oo*65536,_i=On+oo+65535,oo=Math.floor(_i/65536),On=_i-oo*65536,_i=Zn+oo+65535,oo=Math.floor(_i/65536),Zn=_i-oo*65536,_i=Nn+oo+65535,oo=Math.floor(_i/65536),Nn=_i-oo*65536,_i=wn+oo+65535,oo=Math.floor(_i/65536),wn=_i-oo*65536,_i=zn+oo+65535,oo=Math.floor(_i/65536),zn=_i-oo*65536,_i=fo+oo+65535,oo=Math.floor(_i/65536),fo=_i-oo*65536,io+=oo-1+37*(oo-1),eo[0]=io,eo[1]=co,eo[2]=so,eo[3]=no,eo[4]=Tn,eo[5]=Hr,eo[6]=Xr,eo[7]=Sn,eo[8]=Rn,eo[9]=Pn,eo[10]=On,eo[11]=Zn,eo[12]=Nn,eo[13]=wn,eo[14]=zn,eo[15]=fo}function Qr(eo,ro){Jr(eo,ro,ro)}function _n(eo,ro){const to=Er();for(let _i=0;_i<16;_i++)to[_i]=ro[_i];for(let _i=253;_i>=0;_i--)Qr(to,to),_i!==2&&_i!==4&&Jr(to,to,ro);for(let _i=0;_i<16;_i++)eo[_i]=to[_i]}function En(eo,ro){const to=new Uint8Array(32),_i=new Float64Array(80),oo=Er(),io=Er(),co=Er(),so=Er(),no=Er(),Tn=Er();for(let Rn=0;Rn<31;Rn++)to[Rn]=eo[Rn];to[31]=eo[31]&127|64,to[0]&=248,Gr(_i,ro);for(let Rn=0;Rn<16;Rn++)io[Rn]=_i[Rn];oo[0]=so[0]=1;for(let Rn=254;Rn>=0;--Rn){const Pn=to[Rn>>>3]>>>(Rn&7)&1;Wr(oo,io,Pn),Wr(co,so,Pn),Vr(no,oo,co),Zr(oo,oo,co),Vr(co,io,so),Zr(io,io,so),Qr(so,no),Qr(Tn,oo),Jr(oo,co,oo),Jr(co,io,no),Vr(no,oo,co),Zr(oo,oo,co),Qr(io,oo),Zr(co,so,Tn),Jr(oo,co,jr),Vr(oo,oo,so),Jr(co,co,oo),Jr(oo,so,Tn),Jr(so,io,_i),Qr(io,no),Wr(oo,io,Pn),Wr(co,so,Pn)}for(let Rn=0;Rn<16;Rn++)_i[Rn+16]=oo[Rn],_i[Rn+32]=co[Rn],_i[Rn+48]=io[Rn],_i[Rn+64]=so[Rn];const Hr=_i.subarray(32),Xr=_i.subarray(16);_n(Hr,Hr),Jr(Xr,Xr,Hr);const Sn=new Uint8Array(32);return qr(Sn,Xr),Sn}fr.scalarMult=En;function Cn(eo){return En(eo,kr)}fr.scalarMultBase=Cn;function In(eo){if(eo.length!==fr.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${fr.SECRET_KEY_LENGTH} bytes`);const ro=new Uint8Array(eo);return{publicKey:Cn(ro),secretKey:ro}}fr.generateKeyPairFromSeed=In;function An(eo){const ro=(0,br.randomBytes)(32,eo),to=In(ro);return(0,wr.wipe)(ro),to}fr.generateKeyPair=An;function jn(eo,ro,to=!1){if(eo.length!==fr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(ro.length!==fr.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const _i=En(eo,ro);if(to){let oo=0;for(let io=0;io<_i.length;io++)oo|=_i[io];if(oo===0)throw new Error("X25519: invalid shared key")}return _i}fr.sharedKey=jn})(x25519);function asUint8Array(fr){return globalThis.Buffer!=null?new Uint8Array(fr.buffer,fr.byteOffset,fr.byteLength):fr}function allocUnsafe(fr=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?asUint8Array(globalThis.Buffer.allocUnsafe(fr)):new Uint8Array(fr)}function concat(fr,br){br||(br=fr.reduce((kr,jr)=>kr+jr.length,0));const wr=allocUnsafe(br);let Er=0;for(const kr of fr)wr.set(kr,Er),Er+=kr.length;return asUint8Array(wr)}function base$4(fr,br){if(fr.length>=255)throw new TypeError("Alphabet too long");for(var wr=new Uint8Array(256),Er=0;Er>>0,eo=new Uint8Array(jn);In!==An;){for(var ro=_n[In],to=0,_i=jn-1;(ro!==0||to>>0,eo[_i]=ro%Wr>>>0,ro=ro/Wr>>>0;if(ro!==0)throw new Error("Non-zero carry");Cn=to,In++}for(var oo=jn-Cn;oo!==jn&&eo[oo]===0;)oo++;for(var io=qr.repeat(En);oo>>0,jn=new Uint8Array(An);_n[En];){var eo=wr[_n.charCodeAt(En)];if(eo===255)return;for(var ro=0,to=An-1;(eo!==0||ro>>0,jn[to]=eo%256>>>0,eo=eo/256>>>0;if(eo!==0)throw new Error("Non-zero carry");In=ro,En++}if(_n[En]!==" "){for(var _i=An-In;_i!==An&&jn[_i]===0;)_i++;for(var oo=new Uint8Array(Cn+(An-_i)),io=Cn;_i!==An;)oo[io++]=jn[_i++];return oo}}}function Qr(_n){var En=Jr(_n);if(En)return En;throw new Error(`Non-${br} character`)}return{encode:Zr,decodeUnsafe:Jr,decode:Qr}}var src$4=base$4,_brrp__multiformats_scope_baseX=src$4;const coerce$3=fr=>{if(fr instanceof Uint8Array&&fr.constructor.name==="Uint8Array")return fr;if(fr instanceof ArrayBuffer)return new Uint8Array(fr);if(ArrayBuffer.isView(fr))return new Uint8Array(fr.buffer,fr.byteOffset,fr.byteLength);throw new Error("Unknown type, must be binary type")},fromString$1=fr=>new TextEncoder().encode(fr),toString$1=fr=>new TextDecoder().decode(fr);class Encoder{constructor(br,wr,Er){this.name=br,this.prefix=wr,this.baseEncode=Er}encode(br){if(br instanceof Uint8Array)return`${this.prefix}${this.baseEncode(br)}`;throw Error("Unknown type, must be binary type")}}class Decoder{constructor(br,wr,Er){if(this.name=br,this.prefix=wr,wr.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=wr.codePointAt(0),this.baseDecode=Er}decode(br){if(typeof br=="string"){if(br.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(br)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(br.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(br){return or$2(this,br)}}class ComposedDecoder{constructor(br){this.decoders=br}or(br){return or$2(this,br)}decode(br){const wr=br[0],Er=this.decoders[wr];if(Er)return Er.decode(br);throw RangeError(`Unable to decode multibase string ${JSON.stringify(br)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const or$2=(fr,br)=>new ComposedDecoder({...fr.decoders||{[fr.prefix]:fr},...br.decoders||{[br.prefix]:br}});class Codec{constructor(br,wr,Er,kr){this.name=br,this.prefix=wr,this.baseEncode=Er,this.baseDecode=kr,this.encoder=new Encoder(br,wr,Er),this.decoder=new Decoder(br,wr,kr)}encode(br){return this.encoder.encode(br)}decode(br){return this.decoder.decode(br)}}const from=({name:fr,prefix:br,encode:wr,decode:Er})=>new Codec(fr,br,wr,Er),baseX=({prefix:fr,name:br,alphabet:wr})=>{const{encode:Er,decode:kr}=_brrp__multiformats_scope_baseX(wr,br);return from({prefix:fr,name:br,encode:Er,decode:jr=>coerce$3(kr(jr))})},decode$2=(fr,br,wr,Er)=>{const kr={};for(let Vr=0;Vr=8&&(Wr-=8,Br[Gr++]=255&qr>>Wr)}if(Wr>=wr||255&qr<<8-Wr)throw new SyntaxError("Unexpected end of data");return Br},encode$1=(fr,br,wr)=>{const Er=br[br.length-1]==="=",kr=(1<wr;)Br-=wr,jr+=br[kr&Wr>>Br];if(Br&&(jr+=br[kr&Wr<from({prefix:br,name:fr,encode(kr){return encode$1(kr,Er,wr)},decode(kr){return decode$2(kr,Er,wr,fr)}}),identity=from({prefix:"\0",name:"identity",encode:fr=>toString$1(fr),decode:fr=>fromString$1(fr)}),identityBase=Object.freeze(Object.defineProperty({__proto__:null,identity},Symbol.toStringTag,{value:"Module"})),base2=rfc4648({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),base2$1=Object.freeze(Object.defineProperty({__proto__:null,base2},Symbol.toStringTag,{value:"Module"})),base8=rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$1=Object.freeze(Object.defineProperty({__proto__:null,base8},Symbol.toStringTag,{value:"Module"})),base10=baseX({prefix:"9",name:"base10",alphabet:"0123456789"}),base10$1=Object.freeze(Object.defineProperty({__proto__:null,base10},Symbol.toStringTag,{value:"Module"})),base16=rfc4648({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper=rfc4648({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),base16$1=Object.freeze(Object.defineProperty({__proto__:null,base16,base16upper},Symbol.toStringTag,{value:"Module"})),base32=rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper=rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad=rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper=rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex=rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper=rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad=rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper=rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z=rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$1=Object.freeze(Object.defineProperty({__proto__:null,base32,base32hex,base32hexpad,base32hexpadupper,base32hexupper,base32pad,base32padupper,base32upper,base32z},Symbol.toStringTag,{value:"Module"})),base36=baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$1=Object.freeze(Object.defineProperty({__proto__:null,base36,base36upper},Symbol.toStringTag,{value:"Module"})),base58btc=baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr=baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58=Object.freeze(Object.defineProperty({__proto__:null,base58btc,base58flickr},Symbol.toStringTag,{value:"Module"})),base64=rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$1=Object.freeze(Object.defineProperty({__proto__:null,base64,base64pad,base64url,base64urlpad},Symbol.toStringTag,{value:"Module"})),alphabet=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),alphabetBytesToChars=alphabet.reduce((fr,br,wr)=>(fr[wr]=br,fr),[]),alphabetCharsToBytes=alphabet.reduce((fr,br,wr)=>(fr[br.codePointAt(0)]=wr,fr),[]);function encode(fr){return fr.reduce((br,wr)=>(br+=alphabetBytesToChars[wr],br),"")}function decode$1(fr){const br=[];for(const wr of fr){const Er=alphabetCharsToBytes[wr.codePointAt(0)];if(Er===void 0)throw new Error(`Non-base256emoji character: ${wr}`);br.push(Er)}return new Uint8Array(br)}const base256emoji=from({prefix:"🚀",name:"base256emoji",encode,decode:decode$1}),base256emoji$1=Object.freeze(Object.defineProperty({__proto__:null,base256emoji},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const bases={...identityBase,...base2$1,...base8$1,...base10$1,...base16$1,...base32$1,...base36$1,...base58,...base64$1,...base256emoji$1};function createCodec(fr,br,wr,Er){return{name:fr,prefix:br,encoder:{name:fr,prefix:br,encode:wr},decoder:{decode:Er}}}const string$3=createCodec("utf8","u",fr=>"u"+new TextDecoder("utf8").decode(fr),fr=>new TextEncoder().encode(fr.substring(1))),ascii=createCodec("ascii","a",fr=>{let br="a";for(let wr=0;wr{fr=fr.substring(1);const br=allocUnsafe(fr.length);for(let wr=0;wr"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ReactNativeInfo:typeof navigator<"u"?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(fr){return fr!==""&&userAgentRules.reduce(function(br,wr){var Er=wr[0],kr=wr[1];if(br)return br;var jr=kr.exec(fr);return!!jr&&[Er,jr]},!1)}function parseUserAgent(fr){var br=matchUserAgent(fr);if(!br)return null;var wr=br[0],Er=br[1];if(wr==="searchbot")return new BotInfo;var kr=Er[1]&&Er[1].split(".").join("_").split("_").slice(0,3);kr?kr.length=0;Wr--)(Br=fr[Wr])&&(jr=(kr<3?Br(jr):kr>3?Br(br,wr,jr):Br(br,wr))||jr);return kr>3&&jr&&Object.defineProperty(br,wr,jr),jr}function __param$1(fr,br){return function(wr,Er){br(wr,Er,fr)}}function __metadata$1(fr,br){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(fr,br)}function __awaiter$6(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,br||[])).next())})}function __generator$1(fr,br){var wr={label:0,sent:function(){if(jr[0]&1)throw jr[1];return jr[1]},trys:[],ops:[]},Er,kr,jr,Br;return Br={next:Wr(0),throw:Wr(1),return:Wr(2)},typeof Symbol=="function"&&(Br[Symbol.iterator]=function(){return this}),Br;function Wr(Gr){return function(Vr){return qr([Gr,Vr])}}function qr(Gr){if(Er)throw new TypeError("Generator is already executing.");for(;wr;)try{if(Er=1,kr&&(jr=Gr[0]&2?kr.return:Gr[0]?kr.throw||((jr=kr.return)&&jr.call(kr),0):kr.next)&&!(jr=jr.call(kr,Gr[1])).done)return jr;switch(kr=0,jr&&(Gr=[Gr[0]&2,jr.value]),Gr[0]){case 0:case 1:jr=Gr;break;case 4:return wr.label++,{value:Gr[1],done:!1};case 5:wr.label++,kr=Gr[1],Gr=[0];continue;case 7:Gr=wr.ops.pop(),wr.trys.pop();continue;default:if(jr=wr.trys,!(jr=jr.length>0&&jr[jr.length-1])&&(Gr[0]===6||Gr[0]===2)){wr=0;continue}if(Gr[0]===3&&(!jr||Gr[1]>jr[0]&&Gr[1]=fr.length&&(fr=void 0),{value:fr&&fr[Er++],done:!fr}}};throw new TypeError(br?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read$1(fr,br){var wr=typeof Symbol=="function"&&fr[Symbol.iterator];if(!wr)return fr;var Er=wr.call(fr),kr,jr=[],Br;try{for(;(br===void 0||br-- >0)&&!(kr=Er.next()).done;)jr.push(kr.value)}catch(Wr){Br={error:Wr}}finally{try{kr&&!kr.done&&(wr=Er.return)&&wr.call(Er)}finally{if(Br)throw Br.error}}return jr}function __spread$1(){for(var fr=[],br=0;br1||Wr(Jr,Qr)})})}function Wr(Jr,Qr){try{qr(Er[Jr](Qr))}catch(_n){Zr(jr[0][3],_n)}}function qr(Jr){Jr.value instanceof __await$1?Promise.resolve(Jr.value.v).then(Gr,Vr):Zr(jr[0][2],Jr)}function Gr(Jr){Wr("next",Jr)}function Vr(Jr){Wr("throw",Jr)}function Zr(Jr,Qr){Jr(Qr),jr.shift(),jr.length&&Wr(jr[0][0],jr[0][1])}}function __asyncDelegator$1(fr){var br,wr;return br={},Er("next"),Er("throw",function(kr){throw kr}),Er("return"),br[Symbol.iterator]=function(){return this},br;function Er(kr,jr){br[kr]=fr[kr]?function(Br){return(wr=!wr)?{value:__await$1(fr[kr](Br)),done:kr==="return"}:jr?jr(Br):Br}:jr}}function __asyncValues$1(fr){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var br=fr[Symbol.asyncIterator],wr;return br?br.call(fr):(fr=typeof __values$2=="function"?__values$2(fr):fr[Symbol.iterator](),wr={},Er("next"),Er("throw"),Er("return"),wr[Symbol.asyncIterator]=function(){return this},wr);function Er(jr){wr[jr]=fr[jr]&&function(Br){return new Promise(function(Wr,qr){Br=fr[jr](Br),kr(Wr,qr,Br.done,Br.value)})}}function kr(jr,Br,Wr,qr){Promise.resolve(qr).then(function(Gr){jr({value:Gr,done:Wr})},Br)}}function __makeTemplateObject$1(fr,br){return Object.defineProperty?Object.defineProperty(fr,"raw",{value:br}):fr.raw=br,fr}function __importStar$2(fr){if(fr&&fr.__esModule)return fr;var br={};if(fr!=null)for(var wr in fr)Object.hasOwnProperty.call(fr,wr)&&(br[wr]=fr[wr]);return br.default=fr,br}function __importDefault$6(fr){return fr&&fr.__esModule?fr:{default:fr}}function __classPrivateFieldGet$2(fr,br){if(!br.has(fr))throw new TypeError("attempted to get private field on non-instance");return br.get(fr)}function __classPrivateFieldSet$2(fr,br,wr){if(!br.has(fr))throw new TypeError("attempted to set private field on non-instance");return br.set(fr,wr),wr}const tslib_es6$1=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return __assign$1},__asyncDelegator:__asyncDelegator$1,__asyncGenerator:__asyncGenerator$1,__asyncValues:__asyncValues$1,__await:__await$1,__awaiter:__awaiter$6,__classPrivateFieldGet:__classPrivateFieldGet$2,__classPrivateFieldSet:__classPrivateFieldSet$2,__createBinding:__createBinding$2,__decorate:__decorate$2,__exportStar:__exportStar$1,__extends:__extends$1,__generator:__generator$1,__importDefault:__importDefault$6,__importStar:__importStar$2,__makeTemplateObject:__makeTemplateObject$1,__metadata:__metadata$1,__param:__param$1,__read:__read$1,__rest:__rest$4,__spread:__spread$1,__spreadArrays:__spreadArrays$1,__values:__values$2},Symbol.toStringTag,{value:"Module"})),require$$0$6=getAugmentedNamespace(tslib_es6$1);var heartbeat$2={},types={},heartbeat$1={};class IEvents{}const esm=Object.freeze(Object.defineProperty({__proto__:null,IEvents},Symbol.toStringTag,{value:"Module"})),require$$0$5=getAugmentedNamespace(esm);var hasRequiredHeartbeat$2;function requireHeartbeat$2(){if(hasRequiredHeartbeat$2)return heartbeat$1;hasRequiredHeartbeat$2=1,Object.defineProperty(heartbeat$1,"__esModule",{value:!0}),heartbeat$1.IHeartBeat=void 0;const fr=require$$0$5;class br extends fr.IEvents{constructor(Er){super()}}return heartbeat$1.IHeartBeat=br,heartbeat$1}var hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),require$$0$6.__exportStar(requireHeartbeat$2(),fr)}(types)),types}var constants$3={},heartbeat={},hasRequiredHeartbeat$1;function requireHeartbeat$1(){if(hasRequiredHeartbeat$1)return heartbeat;hasRequiredHeartbeat$1=1,Object.defineProperty(heartbeat,"__esModule",{value:!0}),heartbeat.HEARTBEAT_EVENTS=heartbeat.HEARTBEAT_INTERVAL=void 0;const fr=cjs$4;return heartbeat.HEARTBEAT_INTERVAL=fr.FIVE_SECONDS,heartbeat.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},heartbeat}var hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),require$$0$6.__exportStar(requireHeartbeat$1(),fr)}(constants$3)),constants$3}var hasRequiredHeartbeat;function requireHeartbeat(){if(hasRequiredHeartbeat)return heartbeat$2;hasRequiredHeartbeat=1,Object.defineProperty(heartbeat$2,"__esModule",{value:!0}),heartbeat$2.HeartBeat=void 0;const fr=require$$0$6,br=eventsExports,wr=cjs$4,Er=requireTypes(),kr=requireConstants();class jr extends Er.IHeartBeat{constructor(Wr){super(Wr),this.events=new br.EventEmitter,this.interval=kr.HEARTBEAT_INTERVAL,this.interval=(Wr==null?void 0:Wr.interval)||kr.HEARTBEAT_INTERVAL}static init(Wr){return fr.__awaiter(this,void 0,void 0,function*(){const qr=new jr(Wr);return yield qr.init(),qr})}init(){return fr.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(Wr,qr){this.events.on(Wr,qr)}once(Wr,qr){this.events.once(Wr,qr)}off(Wr,qr){this.events.off(Wr,qr)}removeListener(Wr,qr){this.events.removeListener(Wr,qr)}initialize(){return fr.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),wr.toMiliseconds(this.interval))})}pulse(){this.events.emit(kr.HEARTBEAT_EVENTS.pulse)}}return heartbeat$2.HeartBeat=jr,heartbeat$2}(function(fr){Object.defineProperty(fr,"__esModule",{value:!0});const br=require$$0$6;br.__exportStar(requireHeartbeat(),fr),br.__exportStar(requireTypes(),fr),br.__exportStar(requireConstants(),fr)})(cjs$1);function tryStringify(fr){try{return JSON.stringify(fr)}catch{return'"[Circular]"'}}var quickFormatUnescaped=format$1;function format$1(fr,br,wr){var Er=wr&&wr.stringify||tryStringify,kr=1;if(typeof fr=="object"&&fr!==null){var jr=br.length+kr;if(jr===1)return fr;var Br=new Array(jr);Br[0]=Er(fr);for(var Wr=1;Wr-1?Zr:0,fr.charCodeAt(Qr+1)){case 100:case 102:if(Vr>=qr||br[Vr]==null)break;Zr=qr||br[Vr]==null)break;Zr=qr||br[Vr]===void 0)break;Zr",Zr=Qr+2,Qr++;break}Gr+=Er(br[Vr]),Zr=Qr+2,Qr++;break;case 115:if(Vr>=qr)break;Zr-1&&(jr=!1);const Br=["error","fatal","warn","info","debug","trace"];typeof wr=="function"&&(wr.error=wr.fatal=wr.warn=wr.info=wr.debug=wr.trace=wr),fr.enabled===!1&&(fr.level="silent");const Wr=fr.level||"info",qr=Object.create(wr);qr.log||(qr.log=noop),Object.defineProperty(qr,"levelVal",{get:Vr}),Object.defineProperty(qr,"level",{get:Zr,set:Jr});const Gr={transmit:br,serialize:kr,asObject:fr.browser.asObject,levels:Br,timestamp:getTimeFunction(fr)};qr.levels=pino.levels,qr.level=Wr,qr.setMaxListeners=qr.getMaxListeners=qr.emit=qr.addListener=qr.on=qr.prependListener=qr.once=qr.prependOnceListener=qr.removeListener=qr.removeAllListeners=qr.listeners=qr.listenerCount=qr.eventNames=qr.write=qr.flush=noop,qr.serializers=Er,qr._serialize=kr,qr._stdErrSerialize=jr,qr.child=Qr,br&&(qr._logEvent=createLogEventShape());function Vr(){return this.level==="silent"?1/0:this.levels.values[this.level]}function Zr(){return this._level}function Jr(_n){if(_n!=="silent"&&!this.levels.values[_n])throw Error("unknown level "+_n);this._level=_n,set(Gr,qr,"error","log"),set(Gr,qr,"fatal","error"),set(Gr,qr,"warn","error"),set(Gr,qr,"info","log"),set(Gr,qr,"debug","log"),set(Gr,qr,"trace","log")}function Qr(_n,En){if(!_n)throw new Error("missing bindings for child Pino");En=En||{},kr&&_n.serializers&&(En.serializers=_n.serializers);const Cn=En.serializers;if(kr&&Cn){var In=Object.assign({},Er,Cn),An=fr.browser.serialize===!0?Object.keys(In):kr;delete _n.serializers,applySerializers([_n],An,In,this._stdErrSerialize)}function jn(eo){this._childLevel=(eo._childLevel|0)+1,this.error=bind(eo,_n,"error"),this.fatal=bind(eo,_n,"fatal"),this.warn=bind(eo,_n,"warn"),this.info=bind(eo,_n,"info"),this.debug=bind(eo,_n,"debug"),this.trace=bind(eo,_n,"trace"),In&&(this.serializers=In,this._serialize=An),br&&(this._logEvent=createLogEventShape([].concat(eo._logEvent.bindings,_n)))}return jn.prototype=this,new jn(this)}return qr}pino.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};pino.stdSerializers=stdSerializers;pino.stdTimeFunctions=Object.assign({},{nullTime,epochTime,unixTime,isoTime});function set(fr,br,wr,Er){const kr=Object.getPrototypeOf(br);br[wr]=br.levelVal>br.levels.values[wr]?noop:kr[wr]?kr[wr]:_console[wr]||_console[Er]||noop,wrap(fr,br,wr)}function wrap(fr,br,wr){!fr.transmit&&br[wr]===noop||(br[wr]=function(Er){return function(){const jr=fr.timestamp(),Br=new Array(arguments.length),Wr=Object.getPrototypeOf&&Object.getPrototypeOf(this)===_console?_console:this;for(var qr=0;qr-1&&jr in wr&&(fr[kr][jr]=wr[jr](fr[kr][jr]))}function bind(fr,br,wr){return function(){const Er=new Array(1+arguments.length);Er[0]=br;for(var kr=1;krbr in fr?x$2(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,i$3=(fr,br)=>{for(var wr in br||(br={}))T$3.call(br,wr)&&f$6(fr,wr,br[wr]);if(p$6)for(var wr of p$6(br))z$3.call(br,wr)&&f$6(fr,wr,br[wr]);return fr},g$8=(fr,br)=>S$4(fr,_$4(br));function k$4(fr){return g$8(i$3({},fr),{level:(fr==null?void 0:fr.level)||c$3.level})}function v$6(fr,br=n$3){return fr[br]||""}function b$4(fr,br,wr=n$3){return fr[wr]=br,fr}function y$4(fr,br=n$3){let wr="";return typeof fr.bindings>"u"?wr=v$6(fr,br):wr=fr.bindings().context||"",wr}function w$7(fr,br,wr=n$3){const Er=y$4(fr,wr);return Er.trim()?`${Er}/${br}`:br}function E$4(fr,br,wr=n$3){const Er=w$7(fr,br,wr),kr=fr.child({context:Er});return b$4(kr,Er,wr)}let n$2=class extends IEvents{constructor(br){super(),this.opts=br,this.protocol="wc",this.version=2}},h$3=class extends IEvents{constructor(br,wr){super(),this.core=br,this.logger=wr,this.records=new Map}},a$3=class{constructor(br,wr){this.logger=br,this.core=wr}},u$3=class extends IEvents{constructor(br,wr){super(),this.relayer=br,this.logger=wr}},g$7=class extends IEvents{constructor(br){super()}},p$5=class{constructor(br,wr,Er,kr){this.core=br,this.logger=wr,this.name=Er}},d$3=class extends IEvents{constructor(br,wr){super(),this.relayer=br,this.logger=wr}},E$3=class extends IEvents{constructor(br,wr){super(),this.core=br,this.logger=wr}},y$3=class{constructor(br,wr){this.projectId=br,this.logger=wr}},v$5=class{constructor(br,wr){this.projectId=br,this.logger=wr}},b$3=class{constructor(br){this.opts=br,this.protocol="wc",this.version=2}},w$6=class{constructor(br){this.client=br}};var ed25519$1={},sha512$1={};(function(fr){Object.defineProperty(fr,"__esModule",{value:!0});var br=binary,wr=wipe$1;fr.DIGEST_LENGTH=64,fr.BLOCK_SIZE=128;var Er=function(){function Wr(){this.digestLength=fr.DIGEST_LENGTH,this.blockSize=fr.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return Wr.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},Wr.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},Wr.prototype.clean=function(){wr.wipe(this._buffer),wr.wipe(this._tempHi),wr.wipe(this._tempLo),this.reset()},Wr.prototype.update=function(qr,Gr){if(Gr===void 0&&(Gr=qr.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var Vr=0;if(this._bytesHashed+=Gr,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=qr[Vr++],Gr--;this._bufferLength===this.blockSize&&(jr(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(Gr>=this.blockSize&&(Vr=jr(this._tempHi,this._tempLo,this._stateHi,this._stateLo,qr,Vr,Gr),Gr%=this.blockSize);Gr>0;)this._buffer[this._bufferLength++]=qr[Vr++],Gr--;return this},Wr.prototype.finish=function(qr){if(!this._finished){var Gr=this._bytesHashed,Vr=this._bufferLength,Zr=Gr/536870912|0,Jr=Gr<<3,Qr=Gr%128<112?128:256;this._buffer[Vr]=128;for(var _n=Vr+1;_n0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},Wr.prototype.restoreState=function(qr){return this._stateHi.set(qr.stateHi),this._stateLo.set(qr.stateLo),this._bufferLength=qr.bufferLength,qr.buffer&&this._buffer.set(qr.buffer),this._bytesHashed=qr.bytesHashed,this._finished=!1,this},Wr.prototype.cleanSavedState=function(qr){wr.wipe(qr.stateHi),wr.wipe(qr.stateLo),qr.buffer&&wr.wipe(qr.buffer),qr.bufferLength=0,qr.bytesHashed=0},Wr}();fr.SHA512=Er;var kr=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function jr(Wr,qr,Gr,Vr,Zr,Jr,Qr){for(var _n=Gr[0],En=Gr[1],Cn=Gr[2],In=Gr[3],An=Gr[4],jn=Gr[5],eo=Gr[6],ro=Gr[7],to=Vr[0],_i=Vr[1],oo=Vr[2],io=Vr[3],co=Vr[4],so=Vr[5],no=Vr[6],Tn=Vr[7],Hr,Xr,Sn,Rn,Pn,On,Zn,Nn;Qr>=128;){for(var wn=0;wn<16;wn++){var zn=8*wn+Jr;Wr[wn]=br.readUint32BE(Zr,zn),qr[wn]=br.readUint32BE(Zr,zn+4)}for(var wn=0;wn<80;wn++){var fo=_n,vo=En,go=Cn,uo=In,lo=An,Eo=jn,mo=eo,yo=ro,_o=to,Bo=_i,Lo=oo,Wo=io,na=co,qo=so,ga=no,wl=Tn;if(Hr=ro,Xr=Tn,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=(An>>>14|co<<18)^(An>>>18|co<<14)^(co>>>9|An<<23),Xr=(co>>>14|An<<18)^(co>>>18|An<<14)^(An>>>9|co<<23),Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,Hr=An&jn^~An&eo,Xr=co&so^~co&no,Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,Hr=kr[wn*2],Xr=kr[wn*2+1],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,Hr=Wr[wn%16],Xr=qr[wn%16],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Sn=Zn&65535|Nn<<16,Rn=Pn&65535|On<<16,Hr=Sn,Xr=Rn,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=(_n>>>28|to<<4)^(to>>>2|_n<<30)^(to>>>7|_n<<25),Xr=(to>>>28|_n<<4)^(_n>>>2|to<<30)^(_n>>>7|to<<25),Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,Hr=_n&En^_n&Cn^En&Cn,Xr=to&_i^to&oo^_i&oo,Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,yo=Zn&65535|Nn<<16,wl=Pn&65535|On<<16,Hr=uo,Xr=Wo,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Sn,Xr=Rn,Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,uo=Zn&65535|Nn<<16,Wo=Pn&65535|On<<16,En=fo,Cn=vo,In=go,An=uo,jn=lo,eo=Eo,ro=mo,_n=yo,_i=_o,oo=Bo,io=Lo,co=Wo,so=na,no=qo,Tn=ga,to=wl,wn%16===15)for(var zn=0;zn<16;zn++)Hr=Wr[zn],Xr=qr[zn],Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Wr[(zn+9)%16],Xr=qr[(zn+9)%16],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,Sn=Wr[(zn+1)%16],Rn=qr[(zn+1)%16],Hr=(Sn>>>1|Rn<<31)^(Sn>>>8|Rn<<24)^Sn>>>7,Xr=(Rn>>>1|Sn<<31)^(Rn>>>8|Sn<<24)^(Rn>>>7|Sn<<25),Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,Sn=Wr[(zn+14)%16],Rn=qr[(zn+14)%16],Hr=(Sn>>>19|Rn<<13)^(Rn>>>29|Sn<<3)^Sn>>>6,Xr=(Rn>>>19|Sn<<13)^(Sn>>>29|Rn<<3)^(Rn>>>6|Sn<<26),Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Wr[zn]=Zn&65535|Nn<<16,qr[zn]=Pn&65535|On<<16}Hr=_n,Xr=to,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Gr[0],Xr=Vr[0],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Gr[0]=_n=Zn&65535|Nn<<16,Vr[0]=to=Pn&65535|On<<16,Hr=En,Xr=_i,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Gr[1],Xr=Vr[1],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Gr[1]=En=Zn&65535|Nn<<16,Vr[1]=_i=Pn&65535|On<<16,Hr=Cn,Xr=oo,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Gr[2],Xr=Vr[2],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Gr[2]=Cn=Zn&65535|Nn<<16,Vr[2]=oo=Pn&65535|On<<16,Hr=In,Xr=io,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Gr[3],Xr=Vr[3],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Gr[3]=In=Zn&65535|Nn<<16,Vr[3]=io=Pn&65535|On<<16,Hr=An,Xr=co,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Gr[4],Xr=Vr[4],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Gr[4]=An=Zn&65535|Nn<<16,Vr[4]=co=Pn&65535|On<<16,Hr=jn,Xr=so,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Gr[5],Xr=Vr[5],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Gr[5]=jn=Zn&65535|Nn<<16,Vr[5]=so=Pn&65535|On<<16,Hr=eo,Xr=no,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Gr[6],Xr=Vr[6],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Gr[6]=eo=Zn&65535|Nn<<16,Vr[6]=no=Pn&65535|On<<16,Hr=ro,Xr=Tn,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Gr[7],Xr=Vr[7],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Gr[7]=ro=Zn&65535|Nn<<16,Vr[7]=Tn=Pn&65535|On<<16,Jr+=128,Qr-=128}return Jr}function Br(Wr){var qr=new Er;qr.update(Wr);var Gr=qr.digest();return qr.clean(),Gr}fr.hash=Br})(sha512$1);(function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.convertSecretKeyToX25519=fr.convertPublicKeyToX25519=fr.verify=fr.sign=fr.extractPublicKeyFromSecretKey=fr.generateKeyPair=fr.generateKeyPairFromSeed=fr.SEED_LENGTH=fr.SECRET_KEY_LENGTH=fr.PUBLIC_KEY_LENGTH=fr.SIGNATURE_LENGTH=void 0;const br=random,wr=sha512$1,Er=wipe$1;fr.SIGNATURE_LENGTH=64,fr.PUBLIC_KEY_LENGTH=32,fr.SECRET_KEY_LENGTH=64,fr.SEED_LENGTH=32;function kr(uo){const lo=new Float64Array(16);if(uo)for(let Eo=0;Eo>16&1),Eo[Bo-1]&=65535;Eo[15]=mo[15]-32767-(Eo[14]>>16&1);const _o=Eo[15]>>16&1;Eo[14]&=65535,En(mo,Eo,1-_o)}for(let yo=0;yo<16;yo++)uo[2*yo]=mo[yo]&255,uo[2*yo+1]=mo[yo]>>8}function In(uo,lo){let Eo=0;for(let mo=0;mo<32;mo++)Eo|=uo[mo]^lo[mo];return(1&Eo-1>>>8)-1}function An(uo,lo){const Eo=new Uint8Array(32),mo=new Uint8Array(32);return Cn(Eo,uo),Cn(mo,lo),In(Eo,mo)}function jn(uo){const lo=new Uint8Array(32);return Cn(lo,uo),lo[0]&1}function eo(uo,lo){for(let Eo=0;Eo<16;Eo++)uo[Eo]=lo[2*Eo]+(lo[2*Eo+1]<<8);uo[15]&=32767}function ro(uo,lo,Eo){for(let mo=0;mo<16;mo++)uo[mo]=lo[mo]+Eo[mo]}function to(uo,lo,Eo){for(let mo=0;mo<16;mo++)uo[mo]=lo[mo]-Eo[mo]}function _i(uo,lo,Eo){let mo,yo,_o=0,Bo=0,Lo=0,Wo=0,na=0,qo=0,ga=0,wl=0,No=0,Fo=0,Nl=0,Vo=0,Uo=0,Ml=0,$a=0,Jo=0,Zl=0,Cl=0,ko=0,wo=0,bo=0,Io=0,Ho=0,Do=0,zo=0,nu=0,Ll=0,_l=0,bu=0,xl=0,Tl=0,du=Eo[0],Bl=Eo[1],Il=Eo[2],Eu=Eo[3],Al=Eo[4],Ol=Eo[5],Tu=Eo[6],Ul=Eo[7],Sl=Eo[8],_u=Eo[9],So=Eo[10],Co=Eo[11],Ao=Eo[12],po=Eo[13],Ro=Eo[14],Xo=Eo[15];mo=lo[0],_o+=mo*du,Bo+=mo*Bl,Lo+=mo*Il,Wo+=mo*Eu,na+=mo*Al,qo+=mo*Ol,ga+=mo*Tu,wl+=mo*Ul,No+=mo*Sl,Fo+=mo*_u,Nl+=mo*So,Vo+=mo*Co,Uo+=mo*Ao,Ml+=mo*po,$a+=mo*Ro,Jo+=mo*Xo,mo=lo[1],Bo+=mo*du,Lo+=mo*Bl,Wo+=mo*Il,na+=mo*Eu,qo+=mo*Al,ga+=mo*Ol,wl+=mo*Tu,No+=mo*Ul,Fo+=mo*Sl,Nl+=mo*_u,Vo+=mo*So,Uo+=mo*Co,Ml+=mo*Ao,$a+=mo*po,Jo+=mo*Ro,Zl+=mo*Xo,mo=lo[2],Lo+=mo*du,Wo+=mo*Bl,na+=mo*Il,qo+=mo*Eu,ga+=mo*Al,wl+=mo*Ol,No+=mo*Tu,Fo+=mo*Ul,Nl+=mo*Sl,Vo+=mo*_u,Uo+=mo*So,Ml+=mo*Co,$a+=mo*Ao,Jo+=mo*po,Zl+=mo*Ro,Cl+=mo*Xo,mo=lo[3],Wo+=mo*du,na+=mo*Bl,qo+=mo*Il,ga+=mo*Eu,wl+=mo*Al,No+=mo*Ol,Fo+=mo*Tu,Nl+=mo*Ul,Vo+=mo*Sl,Uo+=mo*_u,Ml+=mo*So,$a+=mo*Co,Jo+=mo*Ao,Zl+=mo*po,Cl+=mo*Ro,ko+=mo*Xo,mo=lo[4],na+=mo*du,qo+=mo*Bl,ga+=mo*Il,wl+=mo*Eu,No+=mo*Al,Fo+=mo*Ol,Nl+=mo*Tu,Vo+=mo*Ul,Uo+=mo*Sl,Ml+=mo*_u,$a+=mo*So,Jo+=mo*Co,Zl+=mo*Ao,Cl+=mo*po,ko+=mo*Ro,wo+=mo*Xo,mo=lo[5],qo+=mo*du,ga+=mo*Bl,wl+=mo*Il,No+=mo*Eu,Fo+=mo*Al,Nl+=mo*Ol,Vo+=mo*Tu,Uo+=mo*Ul,Ml+=mo*Sl,$a+=mo*_u,Jo+=mo*So,Zl+=mo*Co,Cl+=mo*Ao,ko+=mo*po,wo+=mo*Ro,bo+=mo*Xo,mo=lo[6],ga+=mo*du,wl+=mo*Bl,No+=mo*Il,Fo+=mo*Eu,Nl+=mo*Al,Vo+=mo*Ol,Uo+=mo*Tu,Ml+=mo*Ul,$a+=mo*Sl,Jo+=mo*_u,Zl+=mo*So,Cl+=mo*Co,ko+=mo*Ao,wo+=mo*po,bo+=mo*Ro,Io+=mo*Xo,mo=lo[7],wl+=mo*du,No+=mo*Bl,Fo+=mo*Il,Nl+=mo*Eu,Vo+=mo*Al,Uo+=mo*Ol,Ml+=mo*Tu,$a+=mo*Ul,Jo+=mo*Sl,Zl+=mo*_u,Cl+=mo*So,ko+=mo*Co,wo+=mo*Ao,bo+=mo*po,Io+=mo*Ro,Ho+=mo*Xo,mo=lo[8],No+=mo*du,Fo+=mo*Bl,Nl+=mo*Il,Vo+=mo*Eu,Uo+=mo*Al,Ml+=mo*Ol,$a+=mo*Tu,Jo+=mo*Ul,Zl+=mo*Sl,Cl+=mo*_u,ko+=mo*So,wo+=mo*Co,bo+=mo*Ao,Io+=mo*po,Ho+=mo*Ro,Do+=mo*Xo,mo=lo[9],Fo+=mo*du,Nl+=mo*Bl,Vo+=mo*Il,Uo+=mo*Eu,Ml+=mo*Al,$a+=mo*Ol,Jo+=mo*Tu,Zl+=mo*Ul,Cl+=mo*Sl,ko+=mo*_u,wo+=mo*So,bo+=mo*Co,Io+=mo*Ao,Ho+=mo*po,Do+=mo*Ro,zo+=mo*Xo,mo=lo[10],Nl+=mo*du,Vo+=mo*Bl,Uo+=mo*Il,Ml+=mo*Eu,$a+=mo*Al,Jo+=mo*Ol,Zl+=mo*Tu,Cl+=mo*Ul,ko+=mo*Sl,wo+=mo*_u,bo+=mo*So,Io+=mo*Co,Ho+=mo*Ao,Do+=mo*po,zo+=mo*Ro,nu+=mo*Xo,mo=lo[11],Vo+=mo*du,Uo+=mo*Bl,Ml+=mo*Il,$a+=mo*Eu,Jo+=mo*Al,Zl+=mo*Ol,Cl+=mo*Tu,ko+=mo*Ul,wo+=mo*Sl,bo+=mo*_u,Io+=mo*So,Ho+=mo*Co,Do+=mo*Ao,zo+=mo*po,nu+=mo*Ro,Ll+=mo*Xo,mo=lo[12],Uo+=mo*du,Ml+=mo*Bl,$a+=mo*Il,Jo+=mo*Eu,Zl+=mo*Al,Cl+=mo*Ol,ko+=mo*Tu,wo+=mo*Ul,bo+=mo*Sl,Io+=mo*_u,Ho+=mo*So,Do+=mo*Co,zo+=mo*Ao,nu+=mo*po,Ll+=mo*Ro,_l+=mo*Xo,mo=lo[13],Ml+=mo*du,$a+=mo*Bl,Jo+=mo*Il,Zl+=mo*Eu,Cl+=mo*Al,ko+=mo*Ol,wo+=mo*Tu,bo+=mo*Ul,Io+=mo*Sl,Ho+=mo*_u,Do+=mo*So,zo+=mo*Co,nu+=mo*Ao,Ll+=mo*po,_l+=mo*Ro,bu+=mo*Xo,mo=lo[14],$a+=mo*du,Jo+=mo*Bl,Zl+=mo*Il,Cl+=mo*Eu,ko+=mo*Al,wo+=mo*Ol,bo+=mo*Tu,Io+=mo*Ul,Ho+=mo*Sl,Do+=mo*_u,zo+=mo*So,nu+=mo*Co,Ll+=mo*Ao,_l+=mo*po,bu+=mo*Ro,xl+=mo*Xo,mo=lo[15],Jo+=mo*du,Zl+=mo*Bl,Cl+=mo*Il,ko+=mo*Eu,wo+=mo*Al,bo+=mo*Ol,Io+=mo*Tu,Ho+=mo*Ul,Do+=mo*Sl,zo+=mo*_u,nu+=mo*So,Ll+=mo*Co,_l+=mo*Ao,bu+=mo*po,xl+=mo*Ro,Tl+=mo*Xo,_o+=38*Zl,Bo+=38*Cl,Lo+=38*ko,Wo+=38*wo,na+=38*bo,qo+=38*Io,ga+=38*Ho,wl+=38*Do,No+=38*zo,Fo+=38*nu,Nl+=38*Ll,Vo+=38*_l,Uo+=38*bu,Ml+=38*xl,$a+=38*Tl,yo=1,mo=_o+yo+65535,yo=Math.floor(mo/65536),_o=mo-yo*65536,mo=Bo+yo+65535,yo=Math.floor(mo/65536),Bo=mo-yo*65536,mo=Lo+yo+65535,yo=Math.floor(mo/65536),Lo=mo-yo*65536,mo=Wo+yo+65535,yo=Math.floor(mo/65536),Wo=mo-yo*65536,mo=na+yo+65535,yo=Math.floor(mo/65536),na=mo-yo*65536,mo=qo+yo+65535,yo=Math.floor(mo/65536),qo=mo-yo*65536,mo=ga+yo+65535,yo=Math.floor(mo/65536),ga=mo-yo*65536,mo=wl+yo+65535,yo=Math.floor(mo/65536),wl=mo-yo*65536,mo=No+yo+65535,yo=Math.floor(mo/65536),No=mo-yo*65536,mo=Fo+yo+65535,yo=Math.floor(mo/65536),Fo=mo-yo*65536,mo=Nl+yo+65535,yo=Math.floor(mo/65536),Nl=mo-yo*65536,mo=Vo+yo+65535,yo=Math.floor(mo/65536),Vo=mo-yo*65536,mo=Uo+yo+65535,yo=Math.floor(mo/65536),Uo=mo-yo*65536,mo=Ml+yo+65535,yo=Math.floor(mo/65536),Ml=mo-yo*65536,mo=$a+yo+65535,yo=Math.floor(mo/65536),$a=mo-yo*65536,mo=Jo+yo+65535,yo=Math.floor(mo/65536),Jo=mo-yo*65536,_o+=yo-1+37*(yo-1),yo=1,mo=_o+yo+65535,yo=Math.floor(mo/65536),_o=mo-yo*65536,mo=Bo+yo+65535,yo=Math.floor(mo/65536),Bo=mo-yo*65536,mo=Lo+yo+65535,yo=Math.floor(mo/65536),Lo=mo-yo*65536,mo=Wo+yo+65535,yo=Math.floor(mo/65536),Wo=mo-yo*65536,mo=na+yo+65535,yo=Math.floor(mo/65536),na=mo-yo*65536,mo=qo+yo+65535,yo=Math.floor(mo/65536),qo=mo-yo*65536,mo=ga+yo+65535,yo=Math.floor(mo/65536),ga=mo-yo*65536,mo=wl+yo+65535,yo=Math.floor(mo/65536),wl=mo-yo*65536,mo=No+yo+65535,yo=Math.floor(mo/65536),No=mo-yo*65536,mo=Fo+yo+65535,yo=Math.floor(mo/65536),Fo=mo-yo*65536,mo=Nl+yo+65535,yo=Math.floor(mo/65536),Nl=mo-yo*65536,mo=Vo+yo+65535,yo=Math.floor(mo/65536),Vo=mo-yo*65536,mo=Uo+yo+65535,yo=Math.floor(mo/65536),Uo=mo-yo*65536,mo=Ml+yo+65535,yo=Math.floor(mo/65536),Ml=mo-yo*65536,mo=$a+yo+65535,yo=Math.floor(mo/65536),$a=mo-yo*65536,mo=Jo+yo+65535,yo=Math.floor(mo/65536),Jo=mo-yo*65536,_o+=yo-1+37*(yo-1),uo[0]=_o,uo[1]=Bo,uo[2]=Lo,uo[3]=Wo,uo[4]=na,uo[5]=qo,uo[6]=ga,uo[7]=wl,uo[8]=No,uo[9]=Fo,uo[10]=Nl,uo[11]=Vo,uo[12]=Uo,uo[13]=Ml,uo[14]=$a,uo[15]=Jo}function oo(uo,lo){_i(uo,lo,lo)}function io(uo,lo){const Eo=kr();let mo;for(mo=0;mo<16;mo++)Eo[mo]=lo[mo];for(mo=253;mo>=0;mo--)oo(Eo,Eo),mo!==2&&mo!==4&&_i(Eo,Eo,lo);for(mo=0;mo<16;mo++)uo[mo]=Eo[mo]}function co(uo,lo){const Eo=kr();let mo;for(mo=0;mo<16;mo++)Eo[mo]=lo[mo];for(mo=250;mo>=0;mo--)oo(Eo,Eo),mo!==1&&_i(Eo,Eo,lo);for(mo=0;mo<16;mo++)uo[mo]=Eo[mo]}function so(uo,lo){const Eo=kr(),mo=kr(),yo=kr(),_o=kr(),Bo=kr(),Lo=kr(),Wo=kr(),na=kr(),qo=kr();to(Eo,uo[1],uo[0]),to(qo,lo[1],lo[0]),_i(Eo,Eo,qo),ro(mo,uo[0],uo[1]),ro(qo,lo[0],lo[1]),_i(mo,mo,qo),_i(yo,uo[3],lo[3]),_i(yo,yo,Gr),_i(_o,uo[2],lo[2]),ro(_o,_o,_o),to(Bo,mo,Eo),to(Lo,_o,yo),ro(Wo,_o,yo),ro(na,mo,Eo),_i(uo[0],Bo,Lo),_i(uo[1],na,Wo),_i(uo[2],Wo,Lo),_i(uo[3],Bo,na)}function no(uo,lo,Eo){for(let mo=0;mo<4;mo++)En(uo[mo],lo[mo],Eo)}function Tn(uo,lo){const Eo=kr(),mo=kr(),yo=kr();io(yo,lo[2]),_i(Eo,lo[0],yo),_i(mo,lo[1],yo),Cn(uo,mo),uo[31]^=jn(Eo)<<7}function Hr(uo,lo,Eo){Qr(uo[0],Br),Qr(uo[1],Wr),Qr(uo[2],Wr),Qr(uo[3],Br);for(let mo=255;mo>=0;--mo){const yo=Eo[mo/8|0]>>(mo&7)&1;no(uo,lo,yo),so(lo,uo),so(uo,uo),no(uo,lo,yo)}}function Xr(uo,lo){const Eo=[kr(),kr(),kr(),kr()];Qr(Eo[0],Vr),Qr(Eo[1],Zr),Qr(Eo[2],Wr),_i(Eo[3],Vr,Zr),Hr(uo,Eo,lo)}function Sn(uo){if(uo.length!==fr.SEED_LENGTH)throw new Error(`ed25519: seed must be ${fr.SEED_LENGTH} bytes`);const lo=(0,wr.hash)(uo);lo[0]&=248,lo[31]&=127,lo[31]|=64;const Eo=new Uint8Array(32),mo=[kr(),kr(),kr(),kr()];Xr(mo,lo),Tn(Eo,mo);const yo=new Uint8Array(64);return yo.set(uo),yo.set(Eo,32),{publicKey:Eo,secretKey:yo}}fr.generateKeyPairFromSeed=Sn;function Rn(uo){const lo=(0,br.randomBytes)(32,uo),Eo=Sn(lo);return(0,Er.wipe)(lo),Eo}fr.generateKeyPair=Rn;function Pn(uo){if(uo.length!==fr.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${fr.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(uo.subarray(32))}fr.extractPublicKeyFromSecretKey=Pn;const On=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Zn(uo,lo){let Eo,mo,yo,_o;for(mo=63;mo>=32;--mo){for(Eo=0,yo=mo-32,_o=mo-12;yo<_o;++yo)lo[yo]+=Eo-16*lo[mo]*On[yo-(mo-32)],Eo=Math.floor((lo[yo]+128)/256),lo[yo]-=Eo*256;lo[yo]+=Eo,lo[mo]=0}for(Eo=0,yo=0;yo<32;yo++)lo[yo]+=Eo-(lo[31]>>4)*On[yo],Eo=lo[yo]>>8,lo[yo]&=255;for(yo=0;yo<32;yo++)lo[yo]-=Eo*On[yo];for(mo=0;mo<32;mo++)lo[mo+1]+=lo[mo]>>8,uo[mo]=lo[mo]&255}function Nn(uo){const lo=new Float64Array(64);for(let Eo=0;Eo<64;Eo++)lo[Eo]=uo[Eo];for(let Eo=0;Eo<64;Eo++)uo[Eo]=0;Zn(uo,lo)}function wn(uo,lo){const Eo=new Float64Array(64),mo=[kr(),kr(),kr(),kr()],yo=(0,wr.hash)(uo.subarray(0,32));yo[0]&=248,yo[31]&=127,yo[31]|=64;const _o=new Uint8Array(64);_o.set(yo.subarray(32),32);const Bo=new wr.SHA512;Bo.update(_o.subarray(32)),Bo.update(lo);const Lo=Bo.digest();Bo.clean(),Nn(Lo),Xr(mo,Lo),Tn(_o,mo),Bo.reset(),Bo.update(_o.subarray(0,32)),Bo.update(uo.subarray(32)),Bo.update(lo);const Wo=Bo.digest();Nn(Wo);for(let na=0;na<32;na++)Eo[na]=Lo[na];for(let na=0;na<32;na++)for(let qo=0;qo<32;qo++)Eo[na+qo]+=Wo[na]*yo[qo];return Zn(_o.subarray(32),Eo),_o}fr.sign=wn;function zn(uo,lo){const Eo=kr(),mo=kr(),yo=kr(),_o=kr(),Bo=kr(),Lo=kr(),Wo=kr();return Qr(uo[2],Wr),eo(uo[1],lo),oo(yo,uo[1]),_i(_o,yo,qr),to(yo,yo,uo[2]),ro(_o,uo[2],_o),oo(Bo,_o),oo(Lo,Bo),_i(Wo,Lo,Bo),_i(Eo,Wo,yo),_i(Eo,Eo,_o),co(Eo,Eo),_i(Eo,Eo,yo),_i(Eo,Eo,_o),_i(Eo,Eo,_o),_i(uo[0],Eo,_o),oo(mo,uo[0]),_i(mo,mo,_o),An(mo,yo)&&_i(uo[0],uo[0],Jr),oo(mo,uo[0]),_i(mo,mo,_o),An(mo,yo)?-1:(jn(uo[0])===lo[31]>>7&&to(uo[0],Br,uo[0]),_i(uo[3],uo[0],uo[1]),0)}function fo(uo,lo,Eo){const mo=new Uint8Array(32),yo=[kr(),kr(),kr(),kr()],_o=[kr(),kr(),kr(),kr()];if(Eo.length!==fr.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${fr.SIGNATURE_LENGTH} bytes`);if(zn(_o,uo))return!1;const Bo=new wr.SHA512;Bo.update(Eo.subarray(0,32)),Bo.update(uo),Bo.update(lo);const Lo=Bo.digest();return Nn(Lo),Hr(yo,_o,Lo),Xr(_o,Eo.subarray(32)),so(yo,_o),Tn(mo,yo),!In(Eo,mo)}fr.verify=fo;function vo(uo){let lo=[kr(),kr(),kr(),kr()];if(zn(lo,uo))throw new Error("Ed25519: invalid public key");let Eo=kr(),mo=kr(),yo=lo[1];ro(Eo,Wr,yo),to(mo,Wr,yo),io(mo,mo),_i(Eo,Eo,mo);let _o=new Uint8Array(32);return Cn(_o,Eo),_o}fr.convertPublicKeyToX25519=vo;function go(uo){const lo=(0,wr.hash)(uo.subarray(0,32));lo[0]&=248,lo[31]&=127,lo[31]|=64;const Eo=new Uint8Array(lo.subarray(0,32));return(0,Er.wipe)(lo),Eo}fr.convertSecretKeyToX25519=go})(ed25519$1);const JWT_IRIDIUM_ALG="EdDSA",JWT_IRIDIUM_TYP="JWT",JWT_DELIMITER=".",JWT_ENCODING="base64url",JSON_ENCODING="utf8",DATA_ENCODING="utf8",DID_DELIMITER=":",DID_PREFIX="did",DID_METHOD="key",MULTICODEC_ED25519_ENCODING="base58btc",MULTICODEC_ED25519_BASE="z",MULTICODEC_ED25519_HEADER="K36",KEY_PAIR_SEED_LENGTH=32;function encodeJSON(fr){return toString(fromString(safeJsonStringify(fr),JSON_ENCODING),JWT_ENCODING)}function encodeIss(fr){const br=fromString(MULTICODEC_ED25519_HEADER,MULTICODEC_ED25519_ENCODING),wr=MULTICODEC_ED25519_BASE+toString(concat([br,fr]),MULTICODEC_ED25519_ENCODING);return[DID_PREFIX,DID_METHOD,wr].join(DID_DELIMITER)}function encodeSig(fr){return toString(fr,JWT_ENCODING)}function encodeData$1(fr){return fromString([encodeJSON(fr.header),encodeJSON(fr.payload)].join(JWT_DELIMITER),DATA_ENCODING)}function encodeJWT(fr){return[encodeJSON(fr.header),encodeJSON(fr.payload),encodeSig(fr.signature)].join(JWT_DELIMITER)}function generateKeyPair$1(fr=random.randomBytes(KEY_PAIR_SEED_LENGTH)){return ed25519$1.generateKeyPairFromSeed(fr)}async function signJWT(fr,br,wr,Er,kr=cjs$4.fromMiliseconds(Date.now())){const jr={alg:JWT_IRIDIUM_ALG,typ:JWT_IRIDIUM_TYP},Br=encodeIss(Er.publicKey),Wr=kr+wr,qr={iss:Br,sub:fr,aud:br,iat:kr,exp:Wr},Gr=encodeData$1({header:jr,payload:qr}),Vr=ed25519$1.sign(Er.secretKey,Gr);return encodeJWT({header:jr,payload:qr,signature:Vr})}function L$4(fr,br){return fr.includes(":")?[fr]:br.chains||[]}const J$1="base10",p$4="base16",F$4="base64pad",H$2="utf8",Q$3=0,_$3=1,Dn=0,Te=1,Z$1=12,X$1=32;function kn(){const fr=x25519.generateKeyPair();return{privateKey:toString(fr.secretKey,p$4),publicKey:toString(fr.publicKey,p$4)}}function Vn$1(){const fr=random.randomBytes(X$1);return toString(fr,p$4)}function Mn(fr,br){const wr=x25519.sharedKey(fromString(fr,p$4),fromString(br,p$4),!0),Er=new HKDF_1(sha256.SHA256,wr).expand(X$1);return toString(Er,p$4)}function Kn(fr){const br=sha256.hash(fromString(fr,p$4));return toString(br,p$4)}function Ln(fr){const br=sha256.hash(fromString(fr,H$2));return toString(br,p$4)}function Pe(fr){return fromString(`${fr}`,J$1)}function j$4(fr){return Number(toString(fr,J$1))}function xn(fr){const br=Pe(typeof fr.type<"u"?fr.type:Q$3);if(j$4(br)===_$3&&typeof fr.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const wr=typeof fr.senderPublicKey<"u"?fromString(fr.senderPublicKey,p$4):void 0,Er=typeof fr.iv<"u"?fromString(fr.iv,p$4):random.randomBytes(Z$1),kr=new chacha20poly1305.ChaCha20Poly1305(fromString(fr.symKey,p$4)).seal(Er,fromString(fr.message,H$2));return Re({type:br,sealed:kr,iv:Er,senderPublicKey:wr})}function Fn(fr){const br=new chacha20poly1305.ChaCha20Poly1305(fromString(fr.symKey,p$4)),{sealed:wr,iv:Er}=ee$2(fr.encoded),kr=br.open(Er,wr);if(kr===null)throw new Error("Failed to decrypt");return toString(kr,H$2)}function Re(fr){if(j$4(fr.type)===_$3){if(typeof fr.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return toString(concat([fr.type,fr.senderPublicKey,fr.iv,fr.sealed]),F$4)}return toString(concat([fr.type,fr.iv,fr.sealed]),F$4)}function ee$2(fr){const br=fromString(fr,F$4),wr=br.slice(Dn,Te),Er=Te;if(j$4(wr)===_$3){const Wr=Er+X$1,qr=Wr+Z$1,Gr=br.slice(Er,Wr),Vr=br.slice(Wr,qr),Zr=br.slice(qr);return{type:wr,sealed:Zr,iv:Vr,senderPublicKey:Gr}}const kr=Er+Z$1,jr=br.slice(Er,kr),Br=br.slice(kr);return{type:wr,sealed:Br,iv:jr}}function Hn(fr,br){const wr=ee$2(fr);return Ae({type:j$4(wr.type),senderPublicKey:typeof wr.senderPublicKey<"u"?toString(wr.senderPublicKey,p$4):void 0,receiverPublicKey:br==null?void 0:br.receiverPublicKey})}function Ae(fr){const br=(fr==null?void 0:fr.type)||Q$3;if(br===_$3){if(typeof(fr==null?void 0:fr.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(fr==null?void 0:fr.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:br,senderPublicKey:fr==null?void 0:fr.senderPublicKey,receiverPublicKey:fr==null?void 0:fr.receiverPublicKey}}function qn(fr){return fr.type===_$3&&typeof fr.senderPublicKey=="string"&&typeof fr.receiverPublicKey=="string"}var Bn=Object.defineProperty,Ue$1=Object.getOwnPropertySymbols,Gn=Object.prototype.hasOwnProperty,Wn=Object.prototype.propertyIsEnumerable,_e=(fr,br,wr)=>br in fr?Bn(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,$e$1=(fr,br)=>{for(var wr in br||(br={}))Gn.call(br,wr)&&_e(fr,wr,br[wr]);if(Ue$1)for(var wr of Ue$1(br))Wn.call(br,wr)&&_e(fr,wr,br[wr]);return fr};const Ce="ReactNative",m$3={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},De$1="js";function te$1(){return typeof process$1$1<"u"&&typeof process$1$1.versions<"u"&&typeof process$1$1.versions.node<"u"}function $$3(){return!getDocument_1()&&!!getNavigator_1()&&navigator.product===Ce}function D$5(){return!te$1()&&!!getNavigator_1()&&!!getDocument_1()}function R$2(){return $$3()?m$3.reactNative:te$1()?m$3.node:D$5()?m$3.browser:m$3.unknown}function Jn(){var fr;try{return $$3()&&typeof global$1<"u"&&typeof(global$1==null?void 0:global$1.Application)<"u"?(fr=global$1.Application)==null?void 0:fr.applicationId:void 0}catch{return}}function ke$1(fr,br){let wr=queryString.parse(fr);return wr=$e$1($e$1({},wr),br),fr=queryString.stringify(wr),fr}function Qn(){return getWindowMetadata_1()||{name:"",description:"",url:"",icons:[""]}}function Ve$1(){if(R$2()===m$3.reactNative&&typeof global$1<"u"&&typeof(global$1==null?void 0:global$1.Platform)<"u"){const{OS:wr,Version:Er}=global$1.Platform;return[wr,Er].join("-")}const fr=detect();if(fr===null)return"unknown";const br=fr.os?fr.os.replace(" ","").toLowerCase():"unknown";return fr.type==="browser"?[br,fr.name,fr.version].join("-"):[br,fr.version].join("-")}function Me$1(){var fr;const br=R$2();return br===m$3.browser?[br,((fr=getLocation_1())==null?void 0:fr.host)||"unknown"].join(":"):br}function Ke$1(fr,br,wr){const Er=Ve$1(),kr=Me$1();return[[fr,br].join("-"),[De$1,wr].join("-"),Er,kr].join("/")}function Xn({protocol:fr,version:br,relayUrl:wr,sdkVersion:Er,auth:kr,projectId:jr,useOnCloseEvent:Br,bundleId:Wr}){const qr=wr.split("?"),Gr=Ke$1(fr,br,Er),Vr={auth:kr,ua:Gr,projectId:jr,useOnCloseEvent:Br||void 0,origin:Wr||void 0},Zr=ke$1(qr[1]||"",Vr);return qr[0]+"?"+Zr}function O$4(fr,br){return fr.filter(wr=>br.includes(wr)).length===fr.length}function rt$1(fr){return Object.fromEntries(fr.entries())}function ot$1(fr){return new Map(Object.entries(fr))}function at$1(fr=cjs$4.FIVE_MINUTES,br){const wr=cjs$4.toMiliseconds(fr||cjs$4.FIVE_MINUTES);let Er,kr,jr;return{resolve:Br=>{jr&&Er&&(clearTimeout(jr),Er(Br))},reject:Br=>{jr&&kr&&(clearTimeout(jr),kr(Br))},done:()=>new Promise((Br,Wr)=>{jr=setTimeout(()=>{Wr(new Error(br))},wr),Er=Br,kr=Wr})}}function ut$1(fr,br,wr){return new Promise(async(Er,kr)=>{const jr=setTimeout(()=>kr(new Error(wr)),br);try{const Br=await fr;Er(Br)}catch(Br){kr(Br)}clearTimeout(jr)})}function re(fr,br){if(typeof br=="string"&&br.startsWith(`${fr}:`))return br;if(fr.toLowerCase()==="topic"){if(typeof br!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${br}`}else if(fr.toLowerCase()==="id"){if(typeof br!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${br}`}throw new Error(`Unknown expirer target type: ${fr}`)}function lt$1(fr){return re("topic",fr)}function dt$1(fr){return re("id",fr)}function ft$2(fr){const[br,wr]=fr.split(":"),Er={id:void 0,topic:void 0};if(br==="topic"&&typeof wr=="string")Er.topic=wr;else if(br==="id"&&Number.isInteger(Number(wr)))Er.id=Number(wr);else throw new Error(`Invalid target, expected id:number or topic:string, got ${br}:${wr}`);return Er}function pt$1(fr,br){return cjs$4.fromMiliseconds(Date.now()+cjs$4.toMiliseconds(fr))}function mt$1(fr){return Date.now()>=cjs$4.toMiliseconds(fr)}function yt$1(fr,br){return`${fr}${br?`:${br}`:""}`}async function gt$1({id:fr,topic:br,wcDeepLink:wr}){try{if(!wr)return;const Er=typeof wr=="string"?JSON.parse(wr):wr;let kr=Er==null?void 0:Er.href;if(typeof kr!="string")return;kr.endsWith("/")&&(kr=kr.slice(0,-1));const jr=`${kr}/wc?requestId=${fr}&sessionTopic=${br}`,Br=R$2();Br===m$3.browser?jr.startsWith("https://")?window.open(jr,"_blank","noreferrer noopener"):window.open(jr,"_self","noreferrer noopener"):Br===m$3.reactNative&&typeof(global$1==null?void 0:global$1.Linking)<"u"&&await global$1.Linking.openURL(jr)}catch(Er){console.error(Er)}}async function ht$1(fr,br){try{return await fr.getItem(br)||(D$5()?localStorage.getItem(br):void 0)}catch(wr){console.error(wr)}}const He$1="irn";function vt$1(fr){return(fr==null?void 0:fr.relay)||{protocol:He$1}}function Et$1(fr){const br=C$2[fr];if(typeof br>"u")throw new Error(`Relay Protocol not supported: ${fr}`);return br}var bt$1=Object.defineProperty,Nt$1=Object.defineProperties,Ot$1=Object.getOwnPropertyDescriptors,qe$1=Object.getOwnPropertySymbols,St$1=Object.prototype.hasOwnProperty,wt$1=Object.prototype.propertyIsEnumerable,Be$1=(fr,br,wr)=>br in fr?bt$1(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,It$1=(fr,br)=>{for(var wr in br||(br={}))St$1.call(br,wr)&&Be$1(fr,wr,br[wr]);if(qe$1)for(var wr of qe$1(br))wt$1.call(br,wr)&&Be$1(fr,wr,br[wr]);return fr},Tt$1=(fr,br)=>Nt$1(fr,Ot$1(br));function Ge$1(fr,br="-"){const wr={},Er="relay"+br;return Object.keys(fr).forEach(kr=>{if(kr.startsWith(Er)){const jr=kr.replace(Er,""),Br=fr[kr];wr[jr]=Br}}),wr}function Pt$1(fr){fr=fr.includes("wc://")?fr.replace("wc://",""):fr,fr=fr.includes("wc:")?fr.replace("wc:",""):fr;const br=fr.indexOf(":"),wr=fr.indexOf("?")!==-1?fr.indexOf("?"):void 0,Er=fr.substring(0,br),kr=fr.substring(br+1,wr).split("@"),jr=typeof wr<"u"?fr.substring(wr):"",Br=queryString.parse(jr);return{protocol:Er,topic:We$1(kr[0]),version:parseInt(kr[1],10),symKey:Br.symKey,relay:Ge$1(Br),expiryTimestamp:Br.expiryTimestamp?parseInt(Br.expiryTimestamp,10):void 0}}function We$1(fr){return fr.startsWith("//")?fr.substring(2):fr}function ze(fr,br="-"){const wr="relay",Er={};return Object.keys(fr).forEach(kr=>{const jr=wr+br+kr;fr[kr]&&(Er[jr]=fr[kr])}),Er}function Rt$1(fr){return`${fr.protocol}:${fr.topic}@${fr.version}?`+queryString.stringify(Tt$1(It$1({symKey:fr.symKey},ze(fr.relay)),{expiryTimestamp:fr.expiryTimestamp}))}function A$2(fr){const br=[];return fr.forEach(wr=>{const[Er,kr]=wr.split(":");br.push(`${Er}:${kr}`)}),br}function Qe$1(fr){const br=[];return Object.values(fr).forEach(wr=>{br.push(...A$2(wr.accounts))}),br}function Ze$1(fr,br){const wr=[];return Object.values(fr).forEach(Er=>{A$2(Er.accounts).includes(br)&&wr.push(...Er.methods)}),wr}function Xe$1(fr,br){const wr=[];return Object.values(fr).forEach(Er=>{A$2(Er.accounts).includes(br)&&wr.push(...Er.events)}),wr}const nn$1={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},tn={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function N$2(fr,br){const{message:wr,code:Er}=tn[fr];return{message:br?`${wr} ${br}`:wr,code:Er}}function U$3(fr,br){const{message:wr,code:Er}=nn$1[fr];return{message:br?`${wr} ${br}`:wr,code:Er}}function k$3(fr,br){return!!Array.isArray(fr)}function B$4(fr){return Object.getPrototypeOf(fr)===Object.prototype&&Object.keys(fr).length}function w$5(fr){return typeof fr>"u"}function g$6(fr,br){return br&&w$5(fr)?!0:typeof fr=="string"&&!!fr.trim().length}function G$2(fr,br){return typeof fr=="number"&&!isNaN(fr)}function Mt$1(fr,br){const{requiredNamespaces:wr}=br,Er=Object.keys(fr.namespaces),kr=Object.keys(wr);let jr=!0;return O$4(kr,Er)?(Er.forEach(Br=>{const{accounts:Wr,methods:qr,events:Gr}=fr.namespaces[Br],Vr=A$2(Wr),Zr=wr[Br];(!O$4(L$4(Br,Zr),Vr)||!O$4(Zr.methods,qr)||!O$4(Zr.events,Gr))&&(jr=!1)}),jr):!1}function V$2(fr){return g$6(fr,!1)&&fr.includes(":")?fr.split(":").length===2:!1}function rn(fr){if(g$6(fr,!1)&&fr.includes(":")){const br=fr.split(":");if(br.length===3){const wr=br[0]+":"+br[1];return!!br[2]&&V$2(wr)}}return!1}function Kt$1(fr){if(g$6(fr,!1))try{return typeof new URL(fr)<"u"}catch{return!1}return!1}function Lt$1(fr){var br;return(br=fr==null?void 0:fr.proposer)==null?void 0:br.publicKey}function xt$1(fr){return fr==null?void 0:fr.topic}function Ft$1(fr,br){let wr=null;return g$6(fr==null?void 0:fr.publicKey,!1)||(wr=N$2("MISSING_OR_INVALID",`${br} controller public key should be a string`)),wr}function ie(fr){let br=!0;return k$3(fr)?fr.length&&(br=fr.every(wr=>g$6(wr,!1))):br=!1,br}function on$1(fr,br,wr){let Er=null;return k$3(br)&&br.length?br.forEach(kr=>{Er||V$2(kr)||(Er=U$3("UNSUPPORTED_CHAINS",`${wr}, chain ${kr} should be a string and conform to "namespace:chainId" format`))}):V$2(fr)||(Er=U$3("UNSUPPORTED_CHAINS",`${wr}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),Er}function sn(fr,br,wr){let Er=null;return Object.entries(fr).forEach(([kr,jr])=>{if(Er)return;const Br=on$1(kr,L$4(kr,jr),`${br} ${wr}`);Br&&(Er=Br)}),Er}function cn(fr,br){let wr=null;return k$3(fr)?fr.forEach(Er=>{wr||rn(Er)||(wr=U$3("UNSUPPORTED_ACCOUNTS",`${br}, account ${Er} should be a string and conform to "namespace:chainId:address" format`))}):wr=U$3("UNSUPPORTED_ACCOUNTS",`${br}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),wr}function an(fr,br){let wr=null;return Object.values(fr).forEach(Er=>{if(wr)return;const kr=cn(Er==null?void 0:Er.accounts,`${br} namespace`);kr&&(wr=kr)}),wr}function un(fr,br){let wr=null;return ie(fr==null?void 0:fr.methods)?ie(fr==null?void 0:fr.events)||(wr=U$3("UNSUPPORTED_EVENTS",`${br}, events should be an array of strings or empty array for no events`)):wr=U$3("UNSUPPORTED_METHODS",`${br}, methods should be an array of strings or empty array for no methods`),wr}function ce$2(fr,br){let wr=null;return Object.values(fr).forEach(Er=>{if(wr)return;const kr=un(Er,`${br}, namespace`);kr&&(wr=kr)}),wr}function Ht$1(fr,br,wr){let Er=null;if(fr&&B$4(fr)){const kr=ce$2(fr,br);kr&&(Er=kr);const jr=sn(fr,br,wr);jr&&(Er=jr)}else Er=N$2("MISSING_OR_INVALID",`${br}, ${wr} should be an object with data`);return Er}function ln(fr,br){let wr=null;if(fr&&B$4(fr)){const Er=ce$2(fr,br);Er&&(wr=Er);const kr=an(fr,br);kr&&(wr=kr)}else wr=N$2("MISSING_OR_INVALID",`${br}, namespaces should be an object with data`);return wr}function dn(fr){return g$6(fr.protocol,!0)}function qt$1(fr,br){let wr=!1;return fr?fr&&k$3(fr)&&fr.length&&fr.forEach(Er=>{wr=dn(Er)}):wr=!0,wr}function Bt$1(fr){return typeof fr=="number"}function Gt$1(fr){return typeof fr<"u"&&typeof fr!==null}function Wt(fr){return!(!fr||typeof fr!="object"||!fr.code||!G$2(fr.code)||!fr.message||!g$6(fr.message,!1))}function zt$1(fr){return!(w$5(fr)||!g$6(fr.method,!1))}function Yt$1(fr){return!(w$5(fr)||w$5(fr.result)&&w$5(fr.error)||!G$2(fr.id)||!g$6(fr.jsonrpc,!1))}function Jt$1(fr){return!(w$5(fr)||!g$6(fr.name,!1))}function Qt(fr,br){return!(!V$2(br)||!Qe$1(fr).includes(br))}function Zt(fr,br,wr){return g$6(wr,!1)?Ze$1(fr,br).includes(wr):!1}function Xt(fr,br,wr){return g$6(wr,!1)?Xe$1(fr,br).includes(wr):!1}function fn(fr,br,wr){let Er=null;const kr=er$1(fr),jr=nr$1(br),Br=Object.keys(kr),Wr=Object.keys(jr),qr=pn(Object.keys(fr)),Gr=pn(Object.keys(br)),Vr=qr.filter(Zr=>!Gr.includes(Zr));return Vr.length&&(Er=N$2("NON_CONFORMING_NAMESPACES",`${wr} namespaces keys don't satisfy requiredNamespaces. +***************************************************************************** */var extendStatics$1=function(fr,br){return extendStatics$1=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(wr,Er){wr.__proto__=Er}||function(wr,Er){for(var kr in Er)Er.hasOwnProperty(kr)&&(wr[kr]=Er[kr])},extendStatics$1(fr,br)};function __extends$1(fr,br){extendStatics$1(fr,br);function wr(){this.constructor=fr}fr.prototype=br===null?Object.create(br):(wr.prototype=br.prototype,new wr)}var __assign$1=function(){return __assign$1=Object.assign||function(br){for(var wr,Er=1,kr=arguments.length;Er=0;Wr--)(Br=fr[Wr])&&(jr=(kr<3?Br(jr):kr>3?Br(br,wr,jr):Br(br,wr))||jr);return kr>3&&jr&&Object.defineProperty(br,wr,jr),jr}function __param$1(fr,br){return function(wr,Er){br(wr,Er,fr)}}function __metadata$1(fr,br){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(fr,br)}function __awaiter$6(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,br||[])).next())})}function __generator$1(fr,br){var wr={label:0,sent:function(){if(jr[0]&1)throw jr[1];return jr[1]},trys:[],ops:[]},Er,kr,jr,Br;return Br={next:Wr(0),throw:Wr(1),return:Wr(2)},typeof Symbol=="function"&&(Br[Symbol.iterator]=function(){return this}),Br;function Wr(Gr){return function(Vr){return qr([Gr,Vr])}}function qr(Gr){if(Er)throw new TypeError("Generator is already executing.");for(;wr;)try{if(Er=1,kr&&(jr=Gr[0]&2?kr.return:Gr[0]?kr.throw||((jr=kr.return)&&jr.call(kr),0):kr.next)&&!(jr=jr.call(kr,Gr[1])).done)return jr;switch(kr=0,jr&&(Gr=[Gr[0]&2,jr.value]),Gr[0]){case 0:case 1:jr=Gr;break;case 4:return wr.label++,{value:Gr[1],done:!1};case 5:wr.label++,kr=Gr[1],Gr=[0];continue;case 7:Gr=wr.ops.pop(),wr.trys.pop();continue;default:if(jr=wr.trys,!(jr=jr.length>0&&jr[jr.length-1])&&(Gr[0]===6||Gr[0]===2)){wr=0;continue}if(Gr[0]===3&&(!jr||Gr[1]>jr[0]&&Gr[1]=fr.length&&(fr=void 0),{value:fr&&fr[Er++],done:!fr}}};throw new TypeError(br?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read$1(fr,br){var wr=typeof Symbol=="function"&&fr[Symbol.iterator];if(!wr)return fr;var Er=wr.call(fr),kr,jr=[],Br;try{for(;(br===void 0||br-- >0)&&!(kr=Er.next()).done;)jr.push(kr.value)}catch(Wr){Br={error:Wr}}finally{try{kr&&!kr.done&&(wr=Er.return)&&wr.call(Er)}finally{if(Br)throw Br.error}}return jr}function __spread$1(){for(var fr=[],br=0;br1||Wr(Jr,Qr)})})}function Wr(Jr,Qr){try{qr(Er[Jr](Qr))}catch(_n){Zr(jr[0][3],_n)}}function qr(Jr){Jr.value instanceof __await$1?Promise.resolve(Jr.value.v).then(Gr,Vr):Zr(jr[0][2],Jr)}function Gr(Jr){Wr("next",Jr)}function Vr(Jr){Wr("throw",Jr)}function Zr(Jr,Qr){Jr(Qr),jr.shift(),jr.length&&Wr(jr[0][0],jr[0][1])}}function __asyncDelegator$1(fr){var br,wr;return br={},Er("next"),Er("throw",function(kr){throw kr}),Er("return"),br[Symbol.iterator]=function(){return this},br;function Er(kr,jr){br[kr]=fr[kr]?function(Br){return(wr=!wr)?{value:__await$1(fr[kr](Br)),done:kr==="return"}:jr?jr(Br):Br}:jr}}function __asyncValues$1(fr){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var br=fr[Symbol.asyncIterator],wr;return br?br.call(fr):(fr=typeof __values$2=="function"?__values$2(fr):fr[Symbol.iterator](),wr={},Er("next"),Er("throw"),Er("return"),wr[Symbol.asyncIterator]=function(){return this},wr);function Er(jr){wr[jr]=fr[jr]&&function(Br){return new Promise(function(Wr,qr){Br=fr[jr](Br),kr(Wr,qr,Br.done,Br.value)})}}function kr(jr,Br,Wr,qr){Promise.resolve(qr).then(function(Gr){jr({value:Gr,done:Wr})},Br)}}function __makeTemplateObject$1(fr,br){return Object.defineProperty?Object.defineProperty(fr,"raw",{value:br}):fr.raw=br,fr}function __importStar$2(fr){if(fr&&fr.__esModule)return fr;var br={};if(fr!=null)for(var wr in fr)Object.hasOwnProperty.call(fr,wr)&&(br[wr]=fr[wr]);return br.default=fr,br}function __importDefault$6(fr){return fr&&fr.__esModule?fr:{default:fr}}function __classPrivateFieldGet$2(fr,br){if(!br.has(fr))throw new TypeError("attempted to get private field on non-instance");return br.get(fr)}function __classPrivateFieldSet$2(fr,br,wr){if(!br.has(fr))throw new TypeError("attempted to set private field on non-instance");return br.set(fr,wr),wr}const tslib_es6$1=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return __assign$1},__asyncDelegator:__asyncDelegator$1,__asyncGenerator:__asyncGenerator$1,__asyncValues:__asyncValues$1,__await:__await$1,__awaiter:__awaiter$6,__classPrivateFieldGet:__classPrivateFieldGet$2,__classPrivateFieldSet:__classPrivateFieldSet$2,__createBinding:__createBinding$2,__decorate:__decorate$2,__exportStar:__exportStar$1,__extends:__extends$1,__generator:__generator$1,__importDefault:__importDefault$6,__importStar:__importStar$2,__makeTemplateObject:__makeTemplateObject$1,__metadata:__metadata$1,__param:__param$1,__read:__read$1,__rest:__rest$4,__spread:__spread$1,__spreadArrays:__spreadArrays$1,__values:__values$2},Symbol.toStringTag,{value:"Module"})),require$$0$6=getAugmentedNamespace(tslib_es6$1);var heartbeat$2={},types={},heartbeat$1={};class IEvents{}const esm=Object.freeze(Object.defineProperty({__proto__:null,IEvents},Symbol.toStringTag,{value:"Module"})),require$$0$5=getAugmentedNamespace(esm);var hasRequiredHeartbeat$2;function requireHeartbeat$2(){if(hasRequiredHeartbeat$2)return heartbeat$1;hasRequiredHeartbeat$2=1,Object.defineProperty(heartbeat$1,"__esModule",{value:!0}),heartbeat$1.IHeartBeat=void 0;const fr=require$$0$5;class br extends fr.IEvents{constructor(Er){super()}}return heartbeat$1.IHeartBeat=br,heartbeat$1}var hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),require$$0$6.__exportStar(requireHeartbeat$2(),fr)}(types)),types}var constants$3={},heartbeat={},hasRequiredHeartbeat$1;function requireHeartbeat$1(){if(hasRequiredHeartbeat$1)return heartbeat;hasRequiredHeartbeat$1=1,Object.defineProperty(heartbeat,"__esModule",{value:!0}),heartbeat.HEARTBEAT_EVENTS=heartbeat.HEARTBEAT_INTERVAL=void 0;const fr=cjs$4;return heartbeat.HEARTBEAT_INTERVAL=fr.FIVE_SECONDS,heartbeat.HEARTBEAT_EVENTS={pulse:"heartbeat_pulse"},heartbeat}var hasRequiredConstants;function requireConstants(){return hasRequiredConstants||(hasRequiredConstants=1,function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),require$$0$6.__exportStar(requireHeartbeat$1(),fr)}(constants$3)),constants$3}var hasRequiredHeartbeat;function requireHeartbeat(){if(hasRequiredHeartbeat)return heartbeat$2;hasRequiredHeartbeat=1,Object.defineProperty(heartbeat$2,"__esModule",{value:!0}),heartbeat$2.HeartBeat=void 0;const fr=require$$0$6,br=eventsExports,wr=cjs$4,Er=requireTypes(),kr=requireConstants();class jr extends Er.IHeartBeat{constructor(Wr){super(Wr),this.events=new br.EventEmitter,this.interval=kr.HEARTBEAT_INTERVAL,this.interval=(Wr==null?void 0:Wr.interval)||kr.HEARTBEAT_INTERVAL}static init(Wr){return fr.__awaiter(this,void 0,void 0,function*(){const qr=new jr(Wr);return yield qr.init(),qr})}init(){return fr.__awaiter(this,void 0,void 0,function*(){yield this.initialize()})}stop(){clearInterval(this.intervalRef)}on(Wr,qr){this.events.on(Wr,qr)}once(Wr,qr){this.events.once(Wr,qr)}off(Wr,qr){this.events.off(Wr,qr)}removeListener(Wr,qr){this.events.removeListener(Wr,qr)}initialize(){return fr.__awaiter(this,void 0,void 0,function*(){this.intervalRef=setInterval(()=>this.pulse(),wr.toMiliseconds(this.interval))})}pulse(){this.events.emit(kr.HEARTBEAT_EVENTS.pulse)}}return heartbeat$2.HeartBeat=jr,heartbeat$2}(function(fr){Object.defineProperty(fr,"__esModule",{value:!0});const br=require$$0$6;br.__exportStar(requireHeartbeat(),fr),br.__exportStar(requireTypes(),fr),br.__exportStar(requireConstants(),fr)})(cjs$1);function tryStringify(fr){try{return JSON.stringify(fr)}catch{return'"[Circular]"'}}var quickFormatUnescaped=format$1;function format$1(fr,br,wr){var Er=wr&&wr.stringify||tryStringify,kr=1;if(typeof fr=="object"&&fr!==null){var jr=br.length+kr;if(jr===1)return fr;var Br=new Array(jr);Br[0]=Er(fr);for(var Wr=1;Wr-1?Zr:0,fr.charCodeAt(Qr+1)){case 100:case 102:if(Vr>=qr||br[Vr]==null)break;Zr=qr||br[Vr]==null)break;Zr=qr||br[Vr]===void 0)break;Zr",Zr=Qr+2,Qr++;break}Gr+=Er(br[Vr]),Zr=Qr+2,Qr++;break;case 115:if(Vr>=qr)break;Zr-1&&(jr=!1);const Br=["error","fatal","warn","info","debug","trace"];typeof wr=="function"&&(wr.error=wr.fatal=wr.warn=wr.info=wr.debug=wr.trace=wr),fr.enabled===!1&&(fr.level="silent");const Wr=fr.level||"info",qr=Object.create(wr);qr.log||(qr.log=noop),Object.defineProperty(qr,"levelVal",{get:Vr}),Object.defineProperty(qr,"level",{get:Zr,set:Jr});const Gr={transmit:br,serialize:kr,asObject:fr.browser.asObject,levels:Br,timestamp:getTimeFunction(fr)};qr.levels=pino.levels,qr.level=Wr,qr.setMaxListeners=qr.getMaxListeners=qr.emit=qr.addListener=qr.on=qr.prependListener=qr.once=qr.prependOnceListener=qr.removeListener=qr.removeAllListeners=qr.listeners=qr.listenerCount=qr.eventNames=qr.write=qr.flush=noop,qr.serializers=Er,qr._serialize=kr,qr._stdErrSerialize=jr,qr.child=Qr,br&&(qr._logEvent=createLogEventShape());function Vr(){return this.level==="silent"?1/0:this.levels.values[this.level]}function Zr(){return this._level}function Jr(_n){if(_n!=="silent"&&!this.levels.values[_n])throw Error("unknown level "+_n);this._level=_n,set(Gr,qr,"error","log"),set(Gr,qr,"fatal","error"),set(Gr,qr,"warn","error"),set(Gr,qr,"info","log"),set(Gr,qr,"debug","log"),set(Gr,qr,"trace","log")}function Qr(_n,En){if(!_n)throw new Error("missing bindings for child Pino");En=En||{},kr&&_n.serializers&&(En.serializers=_n.serializers);const Cn=En.serializers;if(kr&&Cn){var In=Object.assign({},Er,Cn),An=fr.browser.serialize===!0?Object.keys(In):kr;delete _n.serializers,applySerializers([_n],An,In,this._stdErrSerialize)}function jn(eo){this._childLevel=(eo._childLevel|0)+1,this.error=bind(eo,_n,"error"),this.fatal=bind(eo,_n,"fatal"),this.warn=bind(eo,_n,"warn"),this.info=bind(eo,_n,"info"),this.debug=bind(eo,_n,"debug"),this.trace=bind(eo,_n,"trace"),In&&(this.serializers=In,this._serialize=An),br&&(this._logEvent=createLogEventShape([].concat(eo._logEvent.bindings,_n)))}return jn.prototype=this,new jn(this)}return qr}pino.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};pino.stdSerializers=stdSerializers;pino.stdTimeFunctions=Object.assign({},{nullTime,epochTime,unixTime,isoTime});function set(fr,br,wr,Er){const kr=Object.getPrototypeOf(br);br[wr]=br.levelVal>br.levels.values[wr]?noop:kr[wr]?kr[wr]:_console[wr]||_console[Er]||noop,wrap(fr,br,wr)}function wrap(fr,br,wr){!fr.transmit&&br[wr]===noop||(br[wr]=function(Er){return function(){const jr=fr.timestamp(),Br=new Array(arguments.length),Wr=Object.getPrototypeOf&&Object.getPrototypeOf(this)===_console?_console:this;for(var qr=0;qr-1&&jr in wr&&(fr[kr][jr]=wr[jr](fr[kr][jr]))}function bind(fr,br,wr){return function(){const Er=new Array(1+arguments.length);Er[0]=br;for(var kr=1;krbr in fr?x$2(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,i$3=(fr,br)=>{for(var wr in br||(br={}))T$3.call(br,wr)&&f$6(fr,wr,br[wr]);if(p$6)for(var wr of p$6(br))z$3.call(br,wr)&&f$6(fr,wr,br[wr]);return fr},g$8=(fr,br)=>S$4(fr,_$4(br));function k$4(fr){return g$8(i$3({},fr),{level:(fr==null?void 0:fr.level)||c$3.level})}function v$6(fr,br=n$3){return fr[br]||""}function b$4(fr,br,wr=n$3){return fr[wr]=br,fr}function y$4(fr,br=n$3){let wr="";return typeof fr.bindings>"u"?wr=v$6(fr,br):wr=fr.bindings().context||"",wr}function w$7(fr,br,wr=n$3){const Er=y$4(fr,wr);return Er.trim()?`${Er}/${br}`:br}function E$4(fr,br,wr=n$3){const Er=w$7(fr,br,wr),kr=fr.child({context:Er});return b$4(kr,Er,wr)}let n$2=class extends IEvents{constructor(br){super(),this.opts=br,this.protocol="wc",this.version=2}},h$3=class extends IEvents{constructor(br,wr){super(),this.core=br,this.logger=wr,this.records=new Map}},a$3=class{constructor(br,wr){this.logger=br,this.core=wr}},u$3=class extends IEvents{constructor(br,wr){super(),this.relayer=br,this.logger=wr}},g$7=class extends IEvents{constructor(br){super()}},p$5=class{constructor(br,wr,Er,kr){this.core=br,this.logger=wr,this.name=Er}},d$3=class extends IEvents{constructor(br,wr){super(),this.relayer=br,this.logger=wr}},E$3=class extends IEvents{constructor(br,wr){super(),this.core=br,this.logger=wr}},y$3=class{constructor(br,wr){this.projectId=br,this.logger=wr}},v$5=class{constructor(br,wr){this.projectId=br,this.logger=wr}},b$3=class{constructor(br){this.opts=br,this.protocol="wc",this.version=2}},w$6=class{constructor(br){this.client=br}};var ed25519$1={},sha512$1={};(function(fr){Object.defineProperty(fr,"__esModule",{value:!0});var br=binary,wr=wipe$1;fr.DIGEST_LENGTH=64,fr.BLOCK_SIZE=128;var Er=function(){function Wr(){this.digestLength=fr.DIGEST_LENGTH,this.blockSize=fr.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return Wr.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},Wr.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},Wr.prototype.clean=function(){wr.wipe(this._buffer),wr.wipe(this._tempHi),wr.wipe(this._tempLo),this.reset()},Wr.prototype.update=function(qr,Gr){if(Gr===void 0&&(Gr=qr.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var Vr=0;if(this._bytesHashed+=Gr,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=qr[Vr++],Gr--;this._bufferLength===this.blockSize&&(jr(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(Gr>=this.blockSize&&(Vr=jr(this._tempHi,this._tempLo,this._stateHi,this._stateLo,qr,Vr,Gr),Gr%=this.blockSize);Gr>0;)this._buffer[this._bufferLength++]=qr[Vr++],Gr--;return this},Wr.prototype.finish=function(qr){if(!this._finished){var Gr=this._bytesHashed,Vr=this._bufferLength,Zr=Gr/536870912|0,Jr=Gr<<3,Qr=Gr%128<112?128:256;this._buffer[Vr]=128;for(var _n=Vr+1;_n0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},Wr.prototype.restoreState=function(qr){return this._stateHi.set(qr.stateHi),this._stateLo.set(qr.stateLo),this._bufferLength=qr.bufferLength,qr.buffer&&this._buffer.set(qr.buffer),this._bytesHashed=qr.bytesHashed,this._finished=!1,this},Wr.prototype.cleanSavedState=function(qr){wr.wipe(qr.stateHi),wr.wipe(qr.stateLo),qr.buffer&&wr.wipe(qr.buffer),qr.bufferLength=0,qr.bytesHashed=0},Wr}();fr.SHA512=Er;var kr=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function jr(Wr,qr,Gr,Vr,Zr,Jr,Qr){for(var _n=Gr[0],En=Gr[1],Cn=Gr[2],In=Gr[3],An=Gr[4],jn=Gr[5],eo=Gr[6],ro=Gr[7],to=Vr[0],_i=Vr[1],oo=Vr[2],io=Vr[3],co=Vr[4],so=Vr[5],no=Vr[6],Tn=Vr[7],Hr,Xr,Sn,Rn,Pn,On,Zn,Nn;Qr>=128;){for(var wn=0;wn<16;wn++){var zn=8*wn+Jr;Wr[wn]=br.readUint32BE(Zr,zn),qr[wn]=br.readUint32BE(Zr,zn+4)}for(var wn=0;wn<80;wn++){var fo=_n,vo=En,go=Cn,uo=In,lo=An,Eo=jn,mo=eo,yo=ro,_o=to,Bo=_i,Lo=oo,Wo=io,na=co,qo=so,ga=no,wl=Tn;if(Hr=ro,Xr=Tn,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=(An>>>14|co<<18)^(An>>>18|co<<14)^(co>>>9|An<<23),Xr=(co>>>14|An<<18)^(co>>>18|An<<14)^(An>>>9|co<<23),Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,Hr=An&jn^~An&eo,Xr=co&so^~co&no,Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,Hr=kr[wn*2],Xr=kr[wn*2+1],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,Hr=Wr[wn%16],Xr=qr[wn%16],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Sn=Zn&65535|Nn<<16,Rn=Pn&65535|On<<16,Hr=Sn,Xr=Rn,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=(_n>>>28|to<<4)^(to>>>2|_n<<30)^(to>>>7|_n<<25),Xr=(to>>>28|_n<<4)^(_n>>>2|to<<30)^(_n>>>7|to<<25),Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,Hr=_n&En^_n&Cn^En&Cn,Xr=to&_i^to&oo^_i&oo,Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,yo=Zn&65535|Nn<<16,wl=Pn&65535|On<<16,Hr=uo,Xr=Wo,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Sn,Xr=Rn,Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,uo=Zn&65535|Nn<<16,Wo=Pn&65535|On<<16,En=fo,Cn=vo,In=go,An=uo,jn=lo,eo=Eo,ro=mo,_n=yo,_i=_o,oo=Bo,io=Lo,co=Wo,so=na,no=qo,Tn=ga,to=wl,wn%16===15)for(var zn=0;zn<16;zn++)Hr=Wr[zn],Xr=qr[zn],Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Wr[(zn+9)%16],Xr=qr[(zn+9)%16],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,Sn=Wr[(zn+1)%16],Rn=qr[(zn+1)%16],Hr=(Sn>>>1|Rn<<31)^(Sn>>>8|Rn<<24)^Sn>>>7,Xr=(Rn>>>1|Sn<<31)^(Rn>>>8|Sn<<24)^(Rn>>>7|Sn<<25),Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,Sn=Wr[(zn+14)%16],Rn=qr[(zn+14)%16],Hr=(Sn>>>19|Rn<<13)^(Rn>>>29|Sn<<3)^Sn>>>6,Xr=(Rn>>>19|Sn<<13)^(Sn>>>29|Rn<<3)^(Rn>>>6|Sn<<26),Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Wr[zn]=Zn&65535|Nn<<16,qr[zn]=Pn&65535|On<<16}Hr=_n,Xr=to,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Gr[0],Xr=Vr[0],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Gr[0]=_n=Zn&65535|Nn<<16,Vr[0]=to=Pn&65535|On<<16,Hr=En,Xr=_i,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Gr[1],Xr=Vr[1],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Gr[1]=En=Zn&65535|Nn<<16,Vr[1]=_i=Pn&65535|On<<16,Hr=Cn,Xr=oo,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Gr[2],Xr=Vr[2],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Gr[2]=Cn=Zn&65535|Nn<<16,Vr[2]=oo=Pn&65535|On<<16,Hr=In,Xr=io,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Gr[3],Xr=Vr[3],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Gr[3]=In=Zn&65535|Nn<<16,Vr[3]=io=Pn&65535|On<<16,Hr=An,Xr=co,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Gr[4],Xr=Vr[4],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Gr[4]=An=Zn&65535|Nn<<16,Vr[4]=co=Pn&65535|On<<16,Hr=jn,Xr=so,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Gr[5],Xr=Vr[5],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Gr[5]=jn=Zn&65535|Nn<<16,Vr[5]=so=Pn&65535|On<<16,Hr=eo,Xr=no,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Gr[6],Xr=Vr[6],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Gr[6]=eo=Zn&65535|Nn<<16,Vr[6]=no=Pn&65535|On<<16,Hr=ro,Xr=Tn,Pn=Xr&65535,On=Xr>>>16,Zn=Hr&65535,Nn=Hr>>>16,Hr=Gr[7],Xr=Vr[7],Pn+=Xr&65535,On+=Xr>>>16,Zn+=Hr&65535,Nn+=Hr>>>16,On+=Pn>>>16,Zn+=On>>>16,Nn+=Zn>>>16,Gr[7]=ro=Zn&65535|Nn<<16,Vr[7]=Tn=Pn&65535|On<<16,Jr+=128,Qr-=128}return Jr}function Br(Wr){var qr=new Er;qr.update(Wr);var Gr=qr.digest();return qr.clean(),Gr}fr.hash=Br})(sha512$1);(function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.convertSecretKeyToX25519=fr.convertPublicKeyToX25519=fr.verify=fr.sign=fr.extractPublicKeyFromSecretKey=fr.generateKeyPair=fr.generateKeyPairFromSeed=fr.SEED_LENGTH=fr.SECRET_KEY_LENGTH=fr.PUBLIC_KEY_LENGTH=fr.SIGNATURE_LENGTH=void 0;const br=random,wr=sha512$1,Er=wipe$1;fr.SIGNATURE_LENGTH=64,fr.PUBLIC_KEY_LENGTH=32,fr.SECRET_KEY_LENGTH=64,fr.SEED_LENGTH=32;function kr(uo){const lo=new Float64Array(16);if(uo)for(let Eo=0;Eo>16&1),Eo[Bo-1]&=65535;Eo[15]=mo[15]-32767-(Eo[14]>>16&1);const _o=Eo[15]>>16&1;Eo[14]&=65535,En(mo,Eo,1-_o)}for(let yo=0;yo<16;yo++)uo[2*yo]=mo[yo]&255,uo[2*yo+1]=mo[yo]>>8}function In(uo,lo){let Eo=0;for(let mo=0;mo<32;mo++)Eo|=uo[mo]^lo[mo];return(1&Eo-1>>>8)-1}function An(uo,lo){const Eo=new Uint8Array(32),mo=new Uint8Array(32);return Cn(Eo,uo),Cn(mo,lo),In(Eo,mo)}function jn(uo){const lo=new Uint8Array(32);return Cn(lo,uo),lo[0]&1}function eo(uo,lo){for(let Eo=0;Eo<16;Eo++)uo[Eo]=lo[2*Eo]+(lo[2*Eo+1]<<8);uo[15]&=32767}function ro(uo,lo,Eo){for(let mo=0;mo<16;mo++)uo[mo]=lo[mo]+Eo[mo]}function to(uo,lo,Eo){for(let mo=0;mo<16;mo++)uo[mo]=lo[mo]-Eo[mo]}function _i(uo,lo,Eo){let mo,yo,_o=0,Bo=0,Lo=0,Wo=0,na=0,qo=0,ga=0,wl=0,No=0,Uo=0,Nl=0,Vo=0,Fo=0,Ol=0,$a=0,Jo=0,Zl=0,Cl=0,ko=0,wo=0,bo=0,Io=0,Ho=0,Do=0,zo=0,nu=0,Ll=0,_l=0,bu=0,xl=0,Tl=0,du=Eo[0],Bl=Eo[1],Il=Eo[2],Eu=Eo[3],Al=Eo[4],Ml=Eo[5],Tu=Eo[6],Fl=Eo[7],Sl=Eo[8],_u=Eo[9],So=Eo[10],Co=Eo[11],Ao=Eo[12],po=Eo[13],Ro=Eo[14],Xo=Eo[15];mo=lo[0],_o+=mo*du,Bo+=mo*Bl,Lo+=mo*Il,Wo+=mo*Eu,na+=mo*Al,qo+=mo*Ml,ga+=mo*Tu,wl+=mo*Fl,No+=mo*Sl,Uo+=mo*_u,Nl+=mo*So,Vo+=mo*Co,Fo+=mo*Ao,Ol+=mo*po,$a+=mo*Ro,Jo+=mo*Xo,mo=lo[1],Bo+=mo*du,Lo+=mo*Bl,Wo+=mo*Il,na+=mo*Eu,qo+=mo*Al,ga+=mo*Ml,wl+=mo*Tu,No+=mo*Fl,Uo+=mo*Sl,Nl+=mo*_u,Vo+=mo*So,Fo+=mo*Co,Ol+=mo*Ao,$a+=mo*po,Jo+=mo*Ro,Zl+=mo*Xo,mo=lo[2],Lo+=mo*du,Wo+=mo*Bl,na+=mo*Il,qo+=mo*Eu,ga+=mo*Al,wl+=mo*Ml,No+=mo*Tu,Uo+=mo*Fl,Nl+=mo*Sl,Vo+=mo*_u,Fo+=mo*So,Ol+=mo*Co,$a+=mo*Ao,Jo+=mo*po,Zl+=mo*Ro,Cl+=mo*Xo,mo=lo[3],Wo+=mo*du,na+=mo*Bl,qo+=mo*Il,ga+=mo*Eu,wl+=mo*Al,No+=mo*Ml,Uo+=mo*Tu,Nl+=mo*Fl,Vo+=mo*Sl,Fo+=mo*_u,Ol+=mo*So,$a+=mo*Co,Jo+=mo*Ao,Zl+=mo*po,Cl+=mo*Ro,ko+=mo*Xo,mo=lo[4],na+=mo*du,qo+=mo*Bl,ga+=mo*Il,wl+=mo*Eu,No+=mo*Al,Uo+=mo*Ml,Nl+=mo*Tu,Vo+=mo*Fl,Fo+=mo*Sl,Ol+=mo*_u,$a+=mo*So,Jo+=mo*Co,Zl+=mo*Ao,Cl+=mo*po,ko+=mo*Ro,wo+=mo*Xo,mo=lo[5],qo+=mo*du,ga+=mo*Bl,wl+=mo*Il,No+=mo*Eu,Uo+=mo*Al,Nl+=mo*Ml,Vo+=mo*Tu,Fo+=mo*Fl,Ol+=mo*Sl,$a+=mo*_u,Jo+=mo*So,Zl+=mo*Co,Cl+=mo*Ao,ko+=mo*po,wo+=mo*Ro,bo+=mo*Xo,mo=lo[6],ga+=mo*du,wl+=mo*Bl,No+=mo*Il,Uo+=mo*Eu,Nl+=mo*Al,Vo+=mo*Ml,Fo+=mo*Tu,Ol+=mo*Fl,$a+=mo*Sl,Jo+=mo*_u,Zl+=mo*So,Cl+=mo*Co,ko+=mo*Ao,wo+=mo*po,bo+=mo*Ro,Io+=mo*Xo,mo=lo[7],wl+=mo*du,No+=mo*Bl,Uo+=mo*Il,Nl+=mo*Eu,Vo+=mo*Al,Fo+=mo*Ml,Ol+=mo*Tu,$a+=mo*Fl,Jo+=mo*Sl,Zl+=mo*_u,Cl+=mo*So,ko+=mo*Co,wo+=mo*Ao,bo+=mo*po,Io+=mo*Ro,Ho+=mo*Xo,mo=lo[8],No+=mo*du,Uo+=mo*Bl,Nl+=mo*Il,Vo+=mo*Eu,Fo+=mo*Al,Ol+=mo*Ml,$a+=mo*Tu,Jo+=mo*Fl,Zl+=mo*Sl,Cl+=mo*_u,ko+=mo*So,wo+=mo*Co,bo+=mo*Ao,Io+=mo*po,Ho+=mo*Ro,Do+=mo*Xo,mo=lo[9],Uo+=mo*du,Nl+=mo*Bl,Vo+=mo*Il,Fo+=mo*Eu,Ol+=mo*Al,$a+=mo*Ml,Jo+=mo*Tu,Zl+=mo*Fl,Cl+=mo*Sl,ko+=mo*_u,wo+=mo*So,bo+=mo*Co,Io+=mo*Ao,Ho+=mo*po,Do+=mo*Ro,zo+=mo*Xo,mo=lo[10],Nl+=mo*du,Vo+=mo*Bl,Fo+=mo*Il,Ol+=mo*Eu,$a+=mo*Al,Jo+=mo*Ml,Zl+=mo*Tu,Cl+=mo*Fl,ko+=mo*Sl,wo+=mo*_u,bo+=mo*So,Io+=mo*Co,Ho+=mo*Ao,Do+=mo*po,zo+=mo*Ro,nu+=mo*Xo,mo=lo[11],Vo+=mo*du,Fo+=mo*Bl,Ol+=mo*Il,$a+=mo*Eu,Jo+=mo*Al,Zl+=mo*Ml,Cl+=mo*Tu,ko+=mo*Fl,wo+=mo*Sl,bo+=mo*_u,Io+=mo*So,Ho+=mo*Co,Do+=mo*Ao,zo+=mo*po,nu+=mo*Ro,Ll+=mo*Xo,mo=lo[12],Fo+=mo*du,Ol+=mo*Bl,$a+=mo*Il,Jo+=mo*Eu,Zl+=mo*Al,Cl+=mo*Ml,ko+=mo*Tu,wo+=mo*Fl,bo+=mo*Sl,Io+=mo*_u,Ho+=mo*So,Do+=mo*Co,zo+=mo*Ao,nu+=mo*po,Ll+=mo*Ro,_l+=mo*Xo,mo=lo[13],Ol+=mo*du,$a+=mo*Bl,Jo+=mo*Il,Zl+=mo*Eu,Cl+=mo*Al,ko+=mo*Ml,wo+=mo*Tu,bo+=mo*Fl,Io+=mo*Sl,Ho+=mo*_u,Do+=mo*So,zo+=mo*Co,nu+=mo*Ao,Ll+=mo*po,_l+=mo*Ro,bu+=mo*Xo,mo=lo[14],$a+=mo*du,Jo+=mo*Bl,Zl+=mo*Il,Cl+=mo*Eu,ko+=mo*Al,wo+=mo*Ml,bo+=mo*Tu,Io+=mo*Fl,Ho+=mo*Sl,Do+=mo*_u,zo+=mo*So,nu+=mo*Co,Ll+=mo*Ao,_l+=mo*po,bu+=mo*Ro,xl+=mo*Xo,mo=lo[15],Jo+=mo*du,Zl+=mo*Bl,Cl+=mo*Il,ko+=mo*Eu,wo+=mo*Al,bo+=mo*Ml,Io+=mo*Tu,Ho+=mo*Fl,Do+=mo*Sl,zo+=mo*_u,nu+=mo*So,Ll+=mo*Co,_l+=mo*Ao,bu+=mo*po,xl+=mo*Ro,Tl+=mo*Xo,_o+=38*Zl,Bo+=38*Cl,Lo+=38*ko,Wo+=38*wo,na+=38*bo,qo+=38*Io,ga+=38*Ho,wl+=38*Do,No+=38*zo,Uo+=38*nu,Nl+=38*Ll,Vo+=38*_l,Fo+=38*bu,Ol+=38*xl,$a+=38*Tl,yo=1,mo=_o+yo+65535,yo=Math.floor(mo/65536),_o=mo-yo*65536,mo=Bo+yo+65535,yo=Math.floor(mo/65536),Bo=mo-yo*65536,mo=Lo+yo+65535,yo=Math.floor(mo/65536),Lo=mo-yo*65536,mo=Wo+yo+65535,yo=Math.floor(mo/65536),Wo=mo-yo*65536,mo=na+yo+65535,yo=Math.floor(mo/65536),na=mo-yo*65536,mo=qo+yo+65535,yo=Math.floor(mo/65536),qo=mo-yo*65536,mo=ga+yo+65535,yo=Math.floor(mo/65536),ga=mo-yo*65536,mo=wl+yo+65535,yo=Math.floor(mo/65536),wl=mo-yo*65536,mo=No+yo+65535,yo=Math.floor(mo/65536),No=mo-yo*65536,mo=Uo+yo+65535,yo=Math.floor(mo/65536),Uo=mo-yo*65536,mo=Nl+yo+65535,yo=Math.floor(mo/65536),Nl=mo-yo*65536,mo=Vo+yo+65535,yo=Math.floor(mo/65536),Vo=mo-yo*65536,mo=Fo+yo+65535,yo=Math.floor(mo/65536),Fo=mo-yo*65536,mo=Ol+yo+65535,yo=Math.floor(mo/65536),Ol=mo-yo*65536,mo=$a+yo+65535,yo=Math.floor(mo/65536),$a=mo-yo*65536,mo=Jo+yo+65535,yo=Math.floor(mo/65536),Jo=mo-yo*65536,_o+=yo-1+37*(yo-1),yo=1,mo=_o+yo+65535,yo=Math.floor(mo/65536),_o=mo-yo*65536,mo=Bo+yo+65535,yo=Math.floor(mo/65536),Bo=mo-yo*65536,mo=Lo+yo+65535,yo=Math.floor(mo/65536),Lo=mo-yo*65536,mo=Wo+yo+65535,yo=Math.floor(mo/65536),Wo=mo-yo*65536,mo=na+yo+65535,yo=Math.floor(mo/65536),na=mo-yo*65536,mo=qo+yo+65535,yo=Math.floor(mo/65536),qo=mo-yo*65536,mo=ga+yo+65535,yo=Math.floor(mo/65536),ga=mo-yo*65536,mo=wl+yo+65535,yo=Math.floor(mo/65536),wl=mo-yo*65536,mo=No+yo+65535,yo=Math.floor(mo/65536),No=mo-yo*65536,mo=Uo+yo+65535,yo=Math.floor(mo/65536),Uo=mo-yo*65536,mo=Nl+yo+65535,yo=Math.floor(mo/65536),Nl=mo-yo*65536,mo=Vo+yo+65535,yo=Math.floor(mo/65536),Vo=mo-yo*65536,mo=Fo+yo+65535,yo=Math.floor(mo/65536),Fo=mo-yo*65536,mo=Ol+yo+65535,yo=Math.floor(mo/65536),Ol=mo-yo*65536,mo=$a+yo+65535,yo=Math.floor(mo/65536),$a=mo-yo*65536,mo=Jo+yo+65535,yo=Math.floor(mo/65536),Jo=mo-yo*65536,_o+=yo-1+37*(yo-1),uo[0]=_o,uo[1]=Bo,uo[2]=Lo,uo[3]=Wo,uo[4]=na,uo[5]=qo,uo[6]=ga,uo[7]=wl,uo[8]=No,uo[9]=Uo,uo[10]=Nl,uo[11]=Vo,uo[12]=Fo,uo[13]=Ol,uo[14]=$a,uo[15]=Jo}function oo(uo,lo){_i(uo,lo,lo)}function io(uo,lo){const Eo=kr();let mo;for(mo=0;mo<16;mo++)Eo[mo]=lo[mo];for(mo=253;mo>=0;mo--)oo(Eo,Eo),mo!==2&&mo!==4&&_i(Eo,Eo,lo);for(mo=0;mo<16;mo++)uo[mo]=Eo[mo]}function co(uo,lo){const Eo=kr();let mo;for(mo=0;mo<16;mo++)Eo[mo]=lo[mo];for(mo=250;mo>=0;mo--)oo(Eo,Eo),mo!==1&&_i(Eo,Eo,lo);for(mo=0;mo<16;mo++)uo[mo]=Eo[mo]}function so(uo,lo){const Eo=kr(),mo=kr(),yo=kr(),_o=kr(),Bo=kr(),Lo=kr(),Wo=kr(),na=kr(),qo=kr();to(Eo,uo[1],uo[0]),to(qo,lo[1],lo[0]),_i(Eo,Eo,qo),ro(mo,uo[0],uo[1]),ro(qo,lo[0],lo[1]),_i(mo,mo,qo),_i(yo,uo[3],lo[3]),_i(yo,yo,Gr),_i(_o,uo[2],lo[2]),ro(_o,_o,_o),to(Bo,mo,Eo),to(Lo,_o,yo),ro(Wo,_o,yo),ro(na,mo,Eo),_i(uo[0],Bo,Lo),_i(uo[1],na,Wo),_i(uo[2],Wo,Lo),_i(uo[3],Bo,na)}function no(uo,lo,Eo){for(let mo=0;mo<4;mo++)En(uo[mo],lo[mo],Eo)}function Tn(uo,lo){const Eo=kr(),mo=kr(),yo=kr();io(yo,lo[2]),_i(Eo,lo[0],yo),_i(mo,lo[1],yo),Cn(uo,mo),uo[31]^=jn(Eo)<<7}function Hr(uo,lo,Eo){Qr(uo[0],Br),Qr(uo[1],Wr),Qr(uo[2],Wr),Qr(uo[3],Br);for(let mo=255;mo>=0;--mo){const yo=Eo[mo/8|0]>>(mo&7)&1;no(uo,lo,yo),so(lo,uo),so(uo,uo),no(uo,lo,yo)}}function Xr(uo,lo){const Eo=[kr(),kr(),kr(),kr()];Qr(Eo[0],Vr),Qr(Eo[1],Zr),Qr(Eo[2],Wr),_i(Eo[3],Vr,Zr),Hr(uo,Eo,lo)}function Sn(uo){if(uo.length!==fr.SEED_LENGTH)throw new Error(`ed25519: seed must be ${fr.SEED_LENGTH} bytes`);const lo=(0,wr.hash)(uo);lo[0]&=248,lo[31]&=127,lo[31]|=64;const Eo=new Uint8Array(32),mo=[kr(),kr(),kr(),kr()];Xr(mo,lo),Tn(Eo,mo);const yo=new Uint8Array(64);return yo.set(uo),yo.set(Eo,32),{publicKey:Eo,secretKey:yo}}fr.generateKeyPairFromSeed=Sn;function Rn(uo){const lo=(0,br.randomBytes)(32,uo),Eo=Sn(lo);return(0,Er.wipe)(lo),Eo}fr.generateKeyPair=Rn;function Pn(uo){if(uo.length!==fr.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${fr.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(uo.subarray(32))}fr.extractPublicKeyFromSecretKey=Pn;const On=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Zn(uo,lo){let Eo,mo,yo,_o;for(mo=63;mo>=32;--mo){for(Eo=0,yo=mo-32,_o=mo-12;yo<_o;++yo)lo[yo]+=Eo-16*lo[mo]*On[yo-(mo-32)],Eo=Math.floor((lo[yo]+128)/256),lo[yo]-=Eo*256;lo[yo]+=Eo,lo[mo]=0}for(Eo=0,yo=0;yo<32;yo++)lo[yo]+=Eo-(lo[31]>>4)*On[yo],Eo=lo[yo]>>8,lo[yo]&=255;for(yo=0;yo<32;yo++)lo[yo]-=Eo*On[yo];for(mo=0;mo<32;mo++)lo[mo+1]+=lo[mo]>>8,uo[mo]=lo[mo]&255}function Nn(uo){const lo=new Float64Array(64);for(let Eo=0;Eo<64;Eo++)lo[Eo]=uo[Eo];for(let Eo=0;Eo<64;Eo++)uo[Eo]=0;Zn(uo,lo)}function wn(uo,lo){const Eo=new Float64Array(64),mo=[kr(),kr(),kr(),kr()],yo=(0,wr.hash)(uo.subarray(0,32));yo[0]&=248,yo[31]&=127,yo[31]|=64;const _o=new Uint8Array(64);_o.set(yo.subarray(32),32);const Bo=new wr.SHA512;Bo.update(_o.subarray(32)),Bo.update(lo);const Lo=Bo.digest();Bo.clean(),Nn(Lo),Xr(mo,Lo),Tn(_o,mo),Bo.reset(),Bo.update(_o.subarray(0,32)),Bo.update(uo.subarray(32)),Bo.update(lo);const Wo=Bo.digest();Nn(Wo);for(let na=0;na<32;na++)Eo[na]=Lo[na];for(let na=0;na<32;na++)for(let qo=0;qo<32;qo++)Eo[na+qo]+=Wo[na]*yo[qo];return Zn(_o.subarray(32),Eo),_o}fr.sign=wn;function zn(uo,lo){const Eo=kr(),mo=kr(),yo=kr(),_o=kr(),Bo=kr(),Lo=kr(),Wo=kr();return Qr(uo[2],Wr),eo(uo[1],lo),oo(yo,uo[1]),_i(_o,yo,qr),to(yo,yo,uo[2]),ro(_o,uo[2],_o),oo(Bo,_o),oo(Lo,Bo),_i(Wo,Lo,Bo),_i(Eo,Wo,yo),_i(Eo,Eo,_o),co(Eo,Eo),_i(Eo,Eo,yo),_i(Eo,Eo,_o),_i(Eo,Eo,_o),_i(uo[0],Eo,_o),oo(mo,uo[0]),_i(mo,mo,_o),An(mo,yo)&&_i(uo[0],uo[0],Jr),oo(mo,uo[0]),_i(mo,mo,_o),An(mo,yo)?-1:(jn(uo[0])===lo[31]>>7&&to(uo[0],Br,uo[0]),_i(uo[3],uo[0],uo[1]),0)}function fo(uo,lo,Eo){const mo=new Uint8Array(32),yo=[kr(),kr(),kr(),kr()],_o=[kr(),kr(),kr(),kr()];if(Eo.length!==fr.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${fr.SIGNATURE_LENGTH} bytes`);if(zn(_o,uo))return!1;const Bo=new wr.SHA512;Bo.update(Eo.subarray(0,32)),Bo.update(uo),Bo.update(lo);const Lo=Bo.digest();return Nn(Lo),Hr(yo,_o,Lo),Xr(_o,Eo.subarray(32)),so(yo,_o),Tn(mo,yo),!In(Eo,mo)}fr.verify=fo;function vo(uo){let lo=[kr(),kr(),kr(),kr()];if(zn(lo,uo))throw new Error("Ed25519: invalid public key");let Eo=kr(),mo=kr(),yo=lo[1];ro(Eo,Wr,yo),to(mo,Wr,yo),io(mo,mo),_i(Eo,Eo,mo);let _o=new Uint8Array(32);return Cn(_o,Eo),_o}fr.convertPublicKeyToX25519=vo;function go(uo){const lo=(0,wr.hash)(uo.subarray(0,32));lo[0]&=248,lo[31]&=127,lo[31]|=64;const Eo=new Uint8Array(lo.subarray(0,32));return(0,Er.wipe)(lo),Eo}fr.convertSecretKeyToX25519=go})(ed25519$1);const JWT_IRIDIUM_ALG="EdDSA",JWT_IRIDIUM_TYP="JWT",JWT_DELIMITER=".",JWT_ENCODING="base64url",JSON_ENCODING="utf8",DATA_ENCODING="utf8",DID_DELIMITER=":",DID_PREFIX="did",DID_METHOD="key",MULTICODEC_ED25519_ENCODING="base58btc",MULTICODEC_ED25519_BASE="z",MULTICODEC_ED25519_HEADER="K36",KEY_PAIR_SEED_LENGTH=32;function encodeJSON(fr){return toString(fromString(safeJsonStringify(fr),JSON_ENCODING),JWT_ENCODING)}function encodeIss(fr){const br=fromString(MULTICODEC_ED25519_HEADER,MULTICODEC_ED25519_ENCODING),wr=MULTICODEC_ED25519_BASE+toString(concat([br,fr]),MULTICODEC_ED25519_ENCODING);return[DID_PREFIX,DID_METHOD,wr].join(DID_DELIMITER)}function encodeSig(fr){return toString(fr,JWT_ENCODING)}function encodeData$1(fr){return fromString([encodeJSON(fr.header),encodeJSON(fr.payload)].join(JWT_DELIMITER),DATA_ENCODING)}function encodeJWT(fr){return[encodeJSON(fr.header),encodeJSON(fr.payload),encodeSig(fr.signature)].join(JWT_DELIMITER)}function generateKeyPair$1(fr=random.randomBytes(KEY_PAIR_SEED_LENGTH)){return ed25519$1.generateKeyPairFromSeed(fr)}async function signJWT(fr,br,wr,Er,kr=cjs$4.fromMiliseconds(Date.now())){const jr={alg:JWT_IRIDIUM_ALG,typ:JWT_IRIDIUM_TYP},Br=encodeIss(Er.publicKey),Wr=kr+wr,qr={iss:Br,sub:fr,aud:br,iat:kr,exp:Wr},Gr=encodeData$1({header:jr,payload:qr}),Vr=ed25519$1.sign(Er.secretKey,Gr);return encodeJWT({header:jr,payload:qr,signature:Vr})}function L$4(fr,br){return fr.includes(":")?[fr]:br.chains||[]}const J$1="base10",p$4="base16",F$4="base64pad",H$2="utf8",Q$3=0,_$3=1,Dn=0,Te=1,Z$1=12,X$1=32;function kn(){const fr=x25519.generateKeyPair();return{privateKey:toString(fr.secretKey,p$4),publicKey:toString(fr.publicKey,p$4)}}function Vn$1(){const fr=random.randomBytes(X$1);return toString(fr,p$4)}function Mn(fr,br){const wr=x25519.sharedKey(fromString(fr,p$4),fromString(br,p$4),!0),Er=new HKDF_1(sha256.SHA256,wr).expand(X$1);return toString(Er,p$4)}function Kn(fr){const br=sha256.hash(fromString(fr,p$4));return toString(br,p$4)}function Ln(fr){const br=sha256.hash(fromString(fr,H$2));return toString(br,p$4)}function Pe(fr){return fromString(`${fr}`,J$1)}function j$4(fr){return Number(toString(fr,J$1))}function xn(fr){const br=Pe(typeof fr.type<"u"?fr.type:Q$3);if(j$4(br)===_$3&&typeof fr.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const wr=typeof fr.senderPublicKey<"u"?fromString(fr.senderPublicKey,p$4):void 0,Er=typeof fr.iv<"u"?fromString(fr.iv,p$4):random.randomBytes(Z$1),kr=new chacha20poly1305.ChaCha20Poly1305(fromString(fr.symKey,p$4)).seal(Er,fromString(fr.message,H$2));return Re({type:br,sealed:kr,iv:Er,senderPublicKey:wr})}function Fn(fr){const br=new chacha20poly1305.ChaCha20Poly1305(fromString(fr.symKey,p$4)),{sealed:wr,iv:Er}=ee$2(fr.encoded),kr=br.open(Er,wr);if(kr===null)throw new Error("Failed to decrypt");return toString(kr,H$2)}function Re(fr){if(j$4(fr.type)===_$3){if(typeof fr.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return toString(concat([fr.type,fr.senderPublicKey,fr.iv,fr.sealed]),F$4)}return toString(concat([fr.type,fr.iv,fr.sealed]),F$4)}function ee$2(fr){const br=fromString(fr,F$4),wr=br.slice(Dn,Te),Er=Te;if(j$4(wr)===_$3){const Wr=Er+X$1,qr=Wr+Z$1,Gr=br.slice(Er,Wr),Vr=br.slice(Wr,qr),Zr=br.slice(qr);return{type:wr,sealed:Zr,iv:Vr,senderPublicKey:Gr}}const kr=Er+Z$1,jr=br.slice(Er,kr),Br=br.slice(kr);return{type:wr,sealed:Br,iv:jr}}function Hn(fr,br){const wr=ee$2(fr);return Ae({type:j$4(wr.type),senderPublicKey:typeof wr.senderPublicKey<"u"?toString(wr.senderPublicKey,p$4):void 0,receiverPublicKey:br==null?void 0:br.receiverPublicKey})}function Ae(fr){const br=(fr==null?void 0:fr.type)||Q$3;if(br===_$3){if(typeof(fr==null?void 0:fr.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(fr==null?void 0:fr.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:br,senderPublicKey:fr==null?void 0:fr.senderPublicKey,receiverPublicKey:fr==null?void 0:fr.receiverPublicKey}}function qn(fr){return fr.type===_$3&&typeof fr.senderPublicKey=="string"&&typeof fr.receiverPublicKey=="string"}var Bn=Object.defineProperty,Ue$1=Object.getOwnPropertySymbols,Gn=Object.prototype.hasOwnProperty,Wn=Object.prototype.propertyIsEnumerable,_e=(fr,br,wr)=>br in fr?Bn(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,$e$1=(fr,br)=>{for(var wr in br||(br={}))Gn.call(br,wr)&&_e(fr,wr,br[wr]);if(Ue$1)for(var wr of Ue$1(br))Wn.call(br,wr)&&_e(fr,wr,br[wr]);return fr};const Ce="ReactNative",m$3={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},De$1="js";function te$1(){return typeof process$1$1<"u"&&typeof process$1$1.versions<"u"&&typeof process$1$1.versions.node<"u"}function $$3(){return!getDocument_1()&&!!getNavigator_1()&&navigator.product===Ce}function D$5(){return!te$1()&&!!getNavigator_1()&&!!getDocument_1()}function R$2(){return $$3()?m$3.reactNative:te$1()?m$3.node:D$5()?m$3.browser:m$3.unknown}function Jn(){var fr;try{return $$3()&&typeof global$1<"u"&&typeof(global$1==null?void 0:global$1.Application)<"u"?(fr=global$1.Application)==null?void 0:fr.applicationId:void 0}catch{return}}function ke$1(fr,br){let wr=queryString.parse(fr);return wr=$e$1($e$1({},wr),br),fr=queryString.stringify(wr),fr}function Qn(){return getWindowMetadata_1()||{name:"",description:"",url:"",icons:[""]}}function Ve$1(){if(R$2()===m$3.reactNative&&typeof global$1<"u"&&typeof(global$1==null?void 0:global$1.Platform)<"u"){const{OS:wr,Version:Er}=global$1.Platform;return[wr,Er].join("-")}const fr=detect();if(fr===null)return"unknown";const br=fr.os?fr.os.replace(" ","").toLowerCase():"unknown";return fr.type==="browser"?[br,fr.name,fr.version].join("-"):[br,fr.version].join("-")}function Me$1(){var fr;const br=R$2();return br===m$3.browser?[br,((fr=getLocation_1())==null?void 0:fr.host)||"unknown"].join(":"):br}function Ke$1(fr,br,wr){const Er=Ve$1(),kr=Me$1();return[[fr,br].join("-"),[De$1,wr].join("-"),Er,kr].join("/")}function Xn({protocol:fr,version:br,relayUrl:wr,sdkVersion:Er,auth:kr,projectId:jr,useOnCloseEvent:Br,bundleId:Wr}){const qr=wr.split("?"),Gr=Ke$1(fr,br,Er),Vr={auth:kr,ua:Gr,projectId:jr,useOnCloseEvent:Br||void 0,origin:Wr||void 0},Zr=ke$1(qr[1]||"",Vr);return qr[0]+"?"+Zr}function O$4(fr,br){return fr.filter(wr=>br.includes(wr)).length===fr.length}function rt$1(fr){return Object.fromEntries(fr.entries())}function ot$1(fr){return new Map(Object.entries(fr))}function at$1(fr=cjs$4.FIVE_MINUTES,br){const wr=cjs$4.toMiliseconds(fr||cjs$4.FIVE_MINUTES);let Er,kr,jr;return{resolve:Br=>{jr&&Er&&(clearTimeout(jr),Er(Br))},reject:Br=>{jr&&kr&&(clearTimeout(jr),kr(Br))},done:()=>new Promise((Br,Wr)=>{jr=setTimeout(()=>{Wr(new Error(br))},wr),Er=Br,kr=Wr})}}function ut$1(fr,br,wr){return new Promise(async(Er,kr)=>{const jr=setTimeout(()=>kr(new Error(wr)),br);try{const Br=await fr;Er(Br)}catch(Br){kr(Br)}clearTimeout(jr)})}function re(fr,br){if(typeof br=="string"&&br.startsWith(`${fr}:`))return br;if(fr.toLowerCase()==="topic"){if(typeof br!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${br}`}else if(fr.toLowerCase()==="id"){if(typeof br!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${br}`}throw new Error(`Unknown expirer target type: ${fr}`)}function lt$1(fr){return re("topic",fr)}function dt$1(fr){return re("id",fr)}function ft$2(fr){const[br,wr]=fr.split(":"),Er={id:void 0,topic:void 0};if(br==="topic"&&typeof wr=="string")Er.topic=wr;else if(br==="id"&&Number.isInteger(Number(wr)))Er.id=Number(wr);else throw new Error(`Invalid target, expected id:number or topic:string, got ${br}:${wr}`);return Er}function pt$1(fr,br){return cjs$4.fromMiliseconds(Date.now()+cjs$4.toMiliseconds(fr))}function mt$1(fr){return Date.now()>=cjs$4.toMiliseconds(fr)}function yt$1(fr,br){return`${fr}${br?`:${br}`:""}`}async function gt$1({id:fr,topic:br,wcDeepLink:wr}){try{if(!wr)return;const Er=typeof wr=="string"?JSON.parse(wr):wr;let kr=Er==null?void 0:Er.href;if(typeof kr!="string")return;kr.endsWith("/")&&(kr=kr.slice(0,-1));const jr=`${kr}/wc?requestId=${fr}&sessionTopic=${br}`,Br=R$2();Br===m$3.browser?jr.startsWith("https://")?window.open(jr,"_blank","noreferrer noopener"):window.open(jr,"_self","noreferrer noopener"):Br===m$3.reactNative&&typeof(global$1==null?void 0:global$1.Linking)<"u"&&await global$1.Linking.openURL(jr)}catch(Er){console.error(Er)}}async function ht$1(fr,br){try{return await fr.getItem(br)||(D$5()?localStorage.getItem(br):void 0)}catch(wr){console.error(wr)}}const He$1="irn";function vt$1(fr){return(fr==null?void 0:fr.relay)||{protocol:He$1}}function Et$1(fr){const br=C$2[fr];if(typeof br>"u")throw new Error(`Relay Protocol not supported: ${fr}`);return br}var bt$1=Object.defineProperty,Nt$1=Object.defineProperties,Ot$1=Object.getOwnPropertyDescriptors,qe$1=Object.getOwnPropertySymbols,St$1=Object.prototype.hasOwnProperty,wt$1=Object.prototype.propertyIsEnumerable,Be$1=(fr,br,wr)=>br in fr?bt$1(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,It$1=(fr,br)=>{for(var wr in br||(br={}))St$1.call(br,wr)&&Be$1(fr,wr,br[wr]);if(qe$1)for(var wr of qe$1(br))wt$1.call(br,wr)&&Be$1(fr,wr,br[wr]);return fr},Tt$1=(fr,br)=>Nt$1(fr,Ot$1(br));function Ge$1(fr,br="-"){const wr={},Er="relay"+br;return Object.keys(fr).forEach(kr=>{if(kr.startsWith(Er)){const jr=kr.replace(Er,""),Br=fr[kr];wr[jr]=Br}}),wr}function Pt$1(fr){fr=fr.includes("wc://")?fr.replace("wc://",""):fr,fr=fr.includes("wc:")?fr.replace("wc:",""):fr;const br=fr.indexOf(":"),wr=fr.indexOf("?")!==-1?fr.indexOf("?"):void 0,Er=fr.substring(0,br),kr=fr.substring(br+1,wr).split("@"),jr=typeof wr<"u"?fr.substring(wr):"",Br=queryString.parse(jr);return{protocol:Er,topic:We$1(kr[0]),version:parseInt(kr[1],10),symKey:Br.symKey,relay:Ge$1(Br),expiryTimestamp:Br.expiryTimestamp?parseInt(Br.expiryTimestamp,10):void 0}}function We$1(fr){return fr.startsWith("//")?fr.substring(2):fr}function ze(fr,br="-"){const wr="relay",Er={};return Object.keys(fr).forEach(kr=>{const jr=wr+br+kr;fr[kr]&&(Er[jr]=fr[kr])}),Er}function Rt$1(fr){return`${fr.protocol}:${fr.topic}@${fr.version}?`+queryString.stringify(Tt$1(It$1({symKey:fr.symKey},ze(fr.relay)),{expiryTimestamp:fr.expiryTimestamp}))}function A$2(fr){const br=[];return fr.forEach(wr=>{const[Er,kr]=wr.split(":");br.push(`${Er}:${kr}`)}),br}function Qe$1(fr){const br=[];return Object.values(fr).forEach(wr=>{br.push(...A$2(wr.accounts))}),br}function Ze$1(fr,br){const wr=[];return Object.values(fr).forEach(Er=>{A$2(Er.accounts).includes(br)&&wr.push(...Er.methods)}),wr}function Xe$1(fr,br){const wr=[];return Object.values(fr).forEach(Er=>{A$2(Er.accounts).includes(br)&&wr.push(...Er.events)}),wr}const nn$1={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},tn={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function N$2(fr,br){const{message:wr,code:Er}=tn[fr];return{message:br?`${wr} ${br}`:wr,code:Er}}function U$3(fr,br){const{message:wr,code:Er}=nn$1[fr];return{message:br?`${wr} ${br}`:wr,code:Er}}function k$3(fr,br){return!!Array.isArray(fr)}function B$4(fr){return Object.getPrototypeOf(fr)===Object.prototype&&Object.keys(fr).length}function w$5(fr){return typeof fr>"u"}function g$6(fr,br){return br&&w$5(fr)?!0:typeof fr=="string"&&!!fr.trim().length}function G$2(fr,br){return typeof fr=="number"&&!isNaN(fr)}function Mt$1(fr,br){const{requiredNamespaces:wr}=br,Er=Object.keys(fr.namespaces),kr=Object.keys(wr);let jr=!0;return O$4(kr,Er)?(Er.forEach(Br=>{const{accounts:Wr,methods:qr,events:Gr}=fr.namespaces[Br],Vr=A$2(Wr),Zr=wr[Br];(!O$4(L$4(Br,Zr),Vr)||!O$4(Zr.methods,qr)||!O$4(Zr.events,Gr))&&(jr=!1)}),jr):!1}function V$2(fr){return g$6(fr,!1)&&fr.includes(":")?fr.split(":").length===2:!1}function rn(fr){if(g$6(fr,!1)&&fr.includes(":")){const br=fr.split(":");if(br.length===3){const wr=br[0]+":"+br[1];return!!br[2]&&V$2(wr)}}return!1}function Kt$1(fr){if(g$6(fr,!1))try{return typeof new URL(fr)<"u"}catch{return!1}return!1}function Lt$1(fr){var br;return(br=fr==null?void 0:fr.proposer)==null?void 0:br.publicKey}function xt$1(fr){return fr==null?void 0:fr.topic}function Ft$1(fr,br){let wr=null;return g$6(fr==null?void 0:fr.publicKey,!1)||(wr=N$2("MISSING_OR_INVALID",`${br} controller public key should be a string`)),wr}function ie(fr){let br=!0;return k$3(fr)?fr.length&&(br=fr.every(wr=>g$6(wr,!1))):br=!1,br}function on$1(fr,br,wr){let Er=null;return k$3(br)&&br.length?br.forEach(kr=>{Er||V$2(kr)||(Er=U$3("UNSUPPORTED_CHAINS",`${wr}, chain ${kr} should be a string and conform to "namespace:chainId" format`))}):V$2(fr)||(Er=U$3("UNSUPPORTED_CHAINS",`${wr}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),Er}function sn(fr,br,wr){let Er=null;return Object.entries(fr).forEach(([kr,jr])=>{if(Er)return;const Br=on$1(kr,L$4(kr,jr),`${br} ${wr}`);Br&&(Er=Br)}),Er}function cn(fr,br){let wr=null;return k$3(fr)?fr.forEach(Er=>{wr||rn(Er)||(wr=U$3("UNSUPPORTED_ACCOUNTS",`${br}, account ${Er} should be a string and conform to "namespace:chainId:address" format`))}):wr=U$3("UNSUPPORTED_ACCOUNTS",`${br}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),wr}function an(fr,br){let wr=null;return Object.values(fr).forEach(Er=>{if(wr)return;const kr=cn(Er==null?void 0:Er.accounts,`${br} namespace`);kr&&(wr=kr)}),wr}function un(fr,br){let wr=null;return ie(fr==null?void 0:fr.methods)?ie(fr==null?void 0:fr.events)||(wr=U$3("UNSUPPORTED_EVENTS",`${br}, events should be an array of strings or empty array for no events`)):wr=U$3("UNSUPPORTED_METHODS",`${br}, methods should be an array of strings or empty array for no methods`),wr}function ce$2(fr,br){let wr=null;return Object.values(fr).forEach(Er=>{if(wr)return;const kr=un(Er,`${br}, namespace`);kr&&(wr=kr)}),wr}function Ht$1(fr,br,wr){let Er=null;if(fr&&B$4(fr)){const kr=ce$2(fr,br);kr&&(Er=kr);const jr=sn(fr,br,wr);jr&&(Er=jr)}else Er=N$2("MISSING_OR_INVALID",`${br}, ${wr} should be an object with data`);return Er}function ln(fr,br){let wr=null;if(fr&&B$4(fr)){const Er=ce$2(fr,br);Er&&(wr=Er);const kr=an(fr,br);kr&&(wr=kr)}else wr=N$2("MISSING_OR_INVALID",`${br}, namespaces should be an object with data`);return wr}function dn(fr){return g$6(fr.protocol,!0)}function qt$1(fr,br){let wr=!1;return fr?fr&&k$3(fr)&&fr.length&&fr.forEach(Er=>{wr=dn(Er)}):wr=!0,wr}function Bt$1(fr){return typeof fr=="number"}function Gt$1(fr){return typeof fr<"u"&&typeof fr!==null}function Wt(fr){return!(!fr||typeof fr!="object"||!fr.code||!G$2(fr.code)||!fr.message||!g$6(fr.message,!1))}function zt$1(fr){return!(w$5(fr)||!g$6(fr.method,!1))}function Yt$1(fr){return!(w$5(fr)||w$5(fr.result)&&w$5(fr.error)||!G$2(fr.id)||!g$6(fr.jsonrpc,!1))}function Jt$1(fr){return!(w$5(fr)||!g$6(fr.name,!1))}function Qt(fr,br){return!(!V$2(br)||!Qe$1(fr).includes(br))}function Zt(fr,br,wr){return g$6(wr,!1)?Ze$1(fr,br).includes(wr):!1}function Xt(fr,br,wr){return g$6(wr,!1)?Xe$1(fr,br).includes(wr):!1}function fn(fr,br,wr){let Er=null;const kr=er$1(fr),jr=nr$1(br),Br=Object.keys(kr),Wr=Object.keys(jr),qr=pn(Object.keys(fr)),Gr=pn(Object.keys(br)),Vr=qr.filter(Zr=>!Gr.includes(Zr));return Vr.length&&(Er=N$2("NON_CONFORMING_NAMESPACES",`${wr} namespaces keys don't satisfy requiredNamespaces. Required: ${Vr.toString()} Received: ${Object.keys(br).toString()}`)),O$4(Br,Wr)||(Er=N$2("NON_CONFORMING_NAMESPACES",`${wr} namespaces chains don't satisfy required namespaces. Required: ${Br.toString()} @@ -4163,19 +4167,19 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var extendStatics=function(fr,br){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(wr,Er){wr.__proto__=Er}||function(wr,Er){for(var kr in Er)Er.hasOwnProperty(kr)&&(wr[kr]=Er[kr])},extendStatics(fr,br)};function __extends(fr,br){extendStatics(fr,br);function wr(){this.constructor=fr}fr.prototype=br===null?Object.create(br):(wr.prototype=br.prototype,new wr)}var __assign=function(){return __assign=Object.assign||function(br){for(var wr,Er=1,kr=arguments.length;Er=0;Wr--)(Br=fr[Wr])&&(jr=(kr<3?Br(jr):kr>3?Br(br,wr,jr):Br(br,wr))||jr);return kr>3&&jr&&Object.defineProperty(br,wr,jr),jr}function __param(fr,br){return function(wr,Er){br(wr,Er,fr)}}function __metadata(fr,br){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(fr,br)}function __awaiter$5(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,br||[])).next())})}function __generator(fr,br){var wr={label:0,sent:function(){if(jr[0]&1)throw jr[1];return jr[1]},trys:[],ops:[]},Er,kr,jr,Br;return Br={next:Wr(0),throw:Wr(1),return:Wr(2)},typeof Symbol=="function"&&(Br[Symbol.iterator]=function(){return this}),Br;function Wr(Gr){return function(Vr){return qr([Gr,Vr])}}function qr(Gr){if(Er)throw new TypeError("Generator is already executing.");for(;wr;)try{if(Er=1,kr&&(jr=Gr[0]&2?kr.return:Gr[0]?kr.throw||((jr=kr.return)&&jr.call(kr),0):kr.next)&&!(jr=jr.call(kr,Gr[1])).done)return jr;switch(kr=0,jr&&(Gr=[Gr[0]&2,jr.value]),Gr[0]){case 0:case 1:jr=Gr;break;case 4:return wr.label++,{value:Gr[1],done:!1};case 5:wr.label++,kr=Gr[1],Gr=[0];continue;case 7:Gr=wr.ops.pop(),wr.trys.pop();continue;default:if(jr=wr.trys,!(jr=jr.length>0&&jr[jr.length-1])&&(Gr[0]===6||Gr[0]===2)){wr=0;continue}if(Gr[0]===3&&(!jr||Gr[1]>jr[0]&&Gr[1]=fr.length&&(fr=void 0),{value:fr&&fr[Er++],done:!fr}}};throw new TypeError(br?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(fr,br){var wr=typeof Symbol=="function"&&fr[Symbol.iterator];if(!wr)return fr;var Er=wr.call(fr),kr,jr=[],Br;try{for(;(br===void 0||br-- >0)&&!(kr=Er.next()).done;)jr.push(kr.value)}catch(Wr){Br={error:Wr}}finally{try{kr&&!kr.done&&(wr=Er.return)&&wr.call(Er)}finally{if(Br)throw Br.error}}return jr}function __spread(){for(var fr=[],br=0;br1||Wr(Jr,Qr)})})}function Wr(Jr,Qr){try{qr(Er[Jr](Qr))}catch(_n){Zr(jr[0][3],_n)}}function qr(Jr){Jr.value instanceof __await?Promise.resolve(Jr.value.v).then(Gr,Vr):Zr(jr[0][2],Jr)}function Gr(Jr){Wr("next",Jr)}function Vr(Jr){Wr("throw",Jr)}function Zr(Jr,Qr){Jr(Qr),jr.shift(),jr.length&&Wr(jr[0][0],jr[0][1])}}function __asyncDelegator(fr){var br,wr;return br={},Er("next"),Er("throw",function(kr){throw kr}),Er("return"),br[Symbol.iterator]=function(){return this},br;function Er(kr,jr){br[kr]=fr[kr]?function(Br){return(wr=!wr)?{value:__await(fr[kr](Br)),done:kr==="return"}:jr?jr(Br):Br}:jr}}function __asyncValues(fr){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var br=fr[Symbol.asyncIterator],wr;return br?br.call(fr):(fr=typeof __values$1=="function"?__values$1(fr):fr[Symbol.iterator](),wr={},Er("next"),Er("throw"),Er("return"),wr[Symbol.asyncIterator]=function(){return this},wr);function Er(jr){wr[jr]=fr[jr]&&function(Br){return new Promise(function(Wr,qr){Br=fr[jr](Br),kr(Wr,qr,Br.done,Br.value)})}}function kr(jr,Br,Wr,qr){Promise.resolve(qr).then(function(Gr){jr({value:Gr,done:Wr})},Br)}}function __makeTemplateObject(fr,br){return Object.defineProperty?Object.defineProperty(fr,"raw",{value:br}):fr.raw=br,fr}function __importStar$1(fr){if(fr&&fr.__esModule)return fr;var br={};if(fr!=null)for(var wr in fr)Object.hasOwnProperty.call(fr,wr)&&(br[wr]=fr[wr]);return br.default=fr,br}function __importDefault$5(fr){return fr&&fr.__esModule?fr:{default:fr}}function __classPrivateFieldGet$1(fr,br){if(!br.has(fr))throw new TypeError("attempted to get private field on non-instance");return br.get(fr)}function __classPrivateFieldSet$1(fr,br,wr){if(!br.has(fr))throw new TypeError("attempted to set private field on non-instance");return br.set(fr,wr),wr}const tslib_es6=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return __assign},__asyncDelegator,__asyncGenerator,__asyncValues,__await,__awaiter:__awaiter$5,__classPrivateFieldGet:__classPrivateFieldGet$1,__classPrivateFieldSet:__classPrivateFieldSet$1,__createBinding:__createBinding$1,__decorate:__decorate$1,__exportStar,__extends,__generator,__importDefault:__importDefault$5,__importStar:__importStar$1,__makeTemplateObject,__metadata,__param,__read,__rest:__rest$3,__spread,__spreadArrays,__values:__values$1},Symbol.toStringTag,{value:"Module"})),require$$0$4=getAugmentedNamespace(tslib_es6);var crypto$1={},hasRequiredCrypto;function requireCrypto(){if(hasRequiredCrypto)return crypto$1;hasRequiredCrypto=1,Object.defineProperty(crypto$1,"__esModule",{value:!0}),crypto$1.isBrowserCryptoAvailable=crypto$1.getSubtleCrypto=crypto$1.getBrowerCrypto=void 0;function fr(){return(commonjsGlobal==null?void 0:commonjsGlobal.crypto)||(commonjsGlobal==null?void 0:commonjsGlobal.msCrypto)||{}}crypto$1.getBrowerCrypto=fr;function br(){const Er=fr();return Er.subtle||Er.webkitSubtle}crypto$1.getSubtleCrypto=br;function wr(){return!!fr()&&!!br()}return crypto$1.isBrowserCryptoAvailable=wr,crypto$1}var env={},hasRequiredEnv;function requireEnv(){if(hasRequiredEnv)return env;hasRequiredEnv=1,Object.defineProperty(env,"__esModule",{value:!0}),env.isBrowser=env.isNode=env.isReactNative=void 0;function fr(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}env.isReactNative=fr;function br(){return typeof process$1$1<"u"&&typeof process$1$1.versions<"u"&&typeof process$1$1.versions.node<"u"}env.isNode=br;function wr(){return!fr()&&!br()}return env.isBrowser=wr,env}(function(fr){Object.defineProperty(fr,"__esModule",{value:!0});const br=require$$0$4;br.__exportStar(requireCrypto(),fr),br.__exportStar(requireEnv(),fr)})(cjs);function payloadId(fr=3){const br=Date.now()*Math.pow(10,fr),wr=Math.floor(Math.random()*Math.pow(10,fr));return br+wr}function getBigIntRpcId(fr=6){return BigInt(payloadId(fr))}function formatJsonRpcRequest(fr,br,wr){return{id:wr||payloadId(),jsonrpc:"2.0",method:fr,params:br}}function formatJsonRpcResult(fr,br){return{id:fr,jsonrpc:"2.0",result:br}}function formatJsonRpcError(fr,br,wr){return{id:fr,jsonrpc:"2.0",error:formatErrorMessage(br)}}function formatErrorMessage(fr,br){return typeof fr>"u"?getError(INTERNAL_ERROR):(typeof fr=="string"&&(fr=Object.assign(Object.assign({},getError(SERVER_ERROR)),{message:fr})),isReservedErrorCode(fr.code)&&(fr=getErrorByCode(fr.code)),fr)}let e$2=class{},n$1=class extends e$2{constructor(){super()}},r$3=class extends n$1{constructor(br){super()}};const HTTP_REGEX="^https?:",WS_REGEX="^wss?:";function getUrlProtocol(fr){const br=fr.match(new RegExp(/^\w+:/,"gi"));if(!(!br||!br.length))return br[0]}function matchRegexProtocol(fr,br){const wr=getUrlProtocol(fr);return typeof wr>"u"?!1:new RegExp(br).test(wr)}function isHttpUrl(fr){return matchRegexProtocol(fr,HTTP_REGEX)}function isWsUrl(fr){return matchRegexProtocol(fr,WS_REGEX)}function isLocalhostUrl(fr){return new RegExp("wss?://localhost(:d{2,5})?").test(fr)}function isJsonRpcPayload(fr){return typeof fr=="object"&&"id"in fr&&"jsonrpc"in fr&&fr.jsonrpc==="2.0"}function isJsonRpcRequest(fr){return isJsonRpcPayload(fr)&&"method"in fr}function isJsonRpcResponse(fr){return isJsonRpcPayload(fr)&&(isJsonRpcResult(fr)||isJsonRpcError(fr))}function isJsonRpcResult(fr){return"result"in fr}function isJsonRpcError(fr){return"error"in fr}let JsonRpcProvider$1=class extends r$3{constructor(br){super(br),this.events=new eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(br),this.connection.connected&&this.registerEventListeners()}async connect(br=this.connection){await this.open(br)}async disconnect(){await this.close()}on(br,wr){this.events.on(br,wr)}once(br,wr){this.events.once(br,wr)}off(br,wr){this.events.off(br,wr)}removeListener(br,wr){this.events.removeListener(br,wr)}async request(br,wr){return this.requestStrict(formatJsonRpcRequest(br.method,br.params||[],br.id||getBigIntRpcId().toString()),wr)}async requestStrict(br,wr){return new Promise(async(Er,kr)=>{if(!this.connection.connected)try{await this.open()}catch(jr){kr(jr)}this.events.on(`${br.id}`,jr=>{isJsonRpcError(jr)?kr(jr.error):Er(jr.result)});try{await this.connection.send(br,wr)}catch(jr){kr(jr)}})}setConnection(br=this.connection){return br}onPayload(br){this.events.emit("payload",br),isJsonRpcResponse(br)?this.events.emit(`${br.id}`,br):this.events.emit("message",{type:br.method,data:br.params})}onClose(br){br&&br.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${br.code} ${br.reason?`(${br.reason})`:""}`)),this.events.emit("disconnect")}async open(br=this.connection){this.connection===br&&this.connection.connected||(this.connection.connected&&this.close(),typeof br=="string"&&(await this.connection.open(br),br=this.connection),this.connection=this.setConnection(br),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",br=>this.onPayload(br)),this.connection.on("close",br=>this.onClose(br)),this.connection.on("error",br=>this.events.emit("error",br)),this.connection.on("register_error",br=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const w$4=()=>typeof WebSocket<"u"?WebSocket:typeof global$1<"u"&&typeof global$1.WebSocket<"u"?global$1.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),b$2=()=>typeof WebSocket<"u"||typeof global$1<"u"&&typeof global$1.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",a$2=fr=>fr.split("?")[0],h$2=10,S$3=w$4();let f$5=class{constructor(br){if(this.url=br,this.events=new eventsExports.EventEmitter,this.registering=!1,!isWsUrl(br))throw new Error(`Provided URL is not compatible with WebSocket connection: ${br}`);this.url=br}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(br,wr){this.events.on(br,wr)}once(br,wr){this.events.once(br,wr)}off(br,wr){this.events.off(br,wr)}removeListener(br,wr){this.events.removeListener(br,wr)}async open(br=this.url){await this.register(br)}async close(){return new Promise((br,wr)=>{if(typeof this.socket>"u"){wr(new Error("Connection already closed"));return}this.socket.onclose=Er=>{this.onClose(Er),br()},this.socket.close()})}async send(br){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(safeJsonStringify(br))}catch(wr){this.onError(br.id,wr)}}register(br=this.url){if(!isWsUrl(br))throw new Error(`Provided URL is not compatible with WebSocket connection: ${br}`);if(this.registering){const wr=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=wr||this.events.listenerCount("open")>=wr)&&this.events.setMaxListeners(wr+1),new Promise((Er,kr)=>{this.events.once("register_error",jr=>{this.resetMaxListeners(),kr(jr)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return kr(new Error("WebSocket connection is missing or invalid"));Er(this.socket)})})}return this.url=br,this.registering=!0,new Promise((wr,Er)=>{const kr=new URLSearchParams(br).get("origin"),jr=cjs.isReactNative()?{headers:{origin:kr}}:{rejectUnauthorized:!isLocalhostUrl(br)},Br=new S$3(br,[],jr);b$2()?Br.onerror=Wr=>{const qr=Wr;Er(this.emitError(qr.error))}:Br.on("error",Wr=>{Er(this.emitError(Wr))}),Br.onopen=()=>{this.onOpen(Br),wr(Br)}})}onOpen(br){br.onmessage=wr=>this.onPayload(wr),br.onclose=wr=>this.onClose(wr),this.socket=br,this.registering=!1,this.events.emit("open")}onClose(br){this.socket=void 0,this.registering=!1,this.events.emit("close",br)}onPayload(br){if(typeof br.data>"u")return;const wr=typeof br.data=="string"?safeJsonParse(br.data):br.data;this.events.emit("payload",wr)}onError(br,wr){const Er=this.parseError(wr),kr=Er.message||Er.toString(),jr=formatJsonRpcError(br,kr);this.events.emit("payload",jr)}parseError(br,wr=this.url){return parseConnectionError(br,a$2(wr),"WS")}resetMaxListeners(){this.events.getMaxListeners()>h$2&&this.events.setMaxListeners(h$2)}emitError(br){const wr=this.parseError(new Error((br==null?void 0:br.message)||`WebSocket connection failed for host: ${a$2(this.url)}`));return this.events.emit("register_error",wr),wr}};var lodash_isequal={exports:{}};lodash_isequal.exports;(function(fr,br){var wr=200,Er="__lodash_hash_undefined__",kr=1,jr=2,Br=9007199254740991,Wr="[object Arguments]",qr="[object Array]",Gr="[object AsyncFunction]",Vr="[object Boolean]",Zr="[object Date]",Jr="[object Error]",Qr="[object Function]",_n="[object GeneratorFunction]",En="[object Map]",Cn="[object Number]",In="[object Null]",An="[object Object]",jn="[object Promise]",eo="[object Proxy]",ro="[object RegExp]",to="[object Set]",_i="[object String]",oo="[object Symbol]",io="[object Undefined]",co="[object WeakMap]",so="[object ArrayBuffer]",no="[object DataView]",Tn="[object Float32Array]",Hr="[object Float64Array]",Xr="[object Int8Array]",Sn="[object Int16Array]",Rn="[object Int32Array]",Pn="[object Uint8Array]",On="[object Uint8ClampedArray]",Zn="[object Uint16Array]",Nn="[object Uint32Array]",wn=/[\\^$.*+?()[\]{}|]/g,zn=/^\[object .+?Constructor\]$/,fo=/^(?:0|[1-9]\d*)$/,vo={};vo[Tn]=vo[Hr]=vo[Xr]=vo[Sn]=vo[Rn]=vo[Pn]=vo[On]=vo[Zn]=vo[Nn]=!0,vo[Wr]=vo[qr]=vo[so]=vo[Vr]=vo[no]=vo[Zr]=vo[Jr]=vo[Qr]=vo[En]=vo[Cn]=vo[An]=vo[ro]=vo[to]=vo[_i]=vo[co]=!1;var go=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,uo=typeof self=="object"&&self&&self.Object===Object&&self,lo=go||uo||Function("return this")(),Eo=br&&!br.nodeType&&br,mo=Eo&&!0&&fr&&!fr.nodeType&&fr,yo=mo&&mo.exports===Eo,_o=yo&&go.process,Bo=function(){try{return _o&&_o.binding&&_o.binding("util")}catch{}}(),Lo=Bo&&Bo.isTypedArray;function Wo(Zo,Dl){for(var ru=-1,Au=Zo==null?0:Zo.length,Yu=0,Xu=[];++ru-1}function yu(Zo,Dl){var ru=this.__data__,Au=au(ru,Zo);return Au<0?(++this.size,ru.push([Zo,Dl])):ru[Au][1]=Dl,this}$l.prototype.clear=El,$l.prototype.delete=Cu,$l.prototype.get=iu,$l.prototype.has=pu,$l.prototype.set=yu;function hu(Zo){var Dl=-1,ru=Zo==null?0:Zo.length;for(this.clear();++DlKp))return!1;var gp=Xu.get(Zo);if(gp&&Xu.get(Dl))return gp==Dl;var _p=-1,sm=!0,Wp=ru&jr?new su:void 0;for(Xu.set(Zo,Dl),Xu.set(Dl,Zo);++_p-1&&Zo%1==0&&Zo-1&&Zo%1==0&&Zo<=Br}function h0(Zo){var Dl=typeof Zo;return Zo!=null&&(Dl=="object"||Dl=="function")}function zm(Zo){return Zo!=null&&typeof Zo=="object"}var p0=Lo?wl(Lo):Qu;function ry(Zo){return d0(Zo)?Ql(Zo):_h(Zo)}function Lu(){return[]}function Du(){return!1}fr.exports=Rm})(lodash_isequal,lodash_isequal.exports);var lodash_isequalExports=lodash_isequal.exports;const Gi=getDefaultExportFromCjs$2(lodash_isequalExports);function unfetch_module(fr,br){return br=br||{},new Promise(function(wr,Er){var kr=new XMLHttpRequest,jr=[],Br=[],Wr={},qr=function(){return{ok:(kr.status/100|0)==2,statusText:kr.statusText,status:kr.status,url:kr.responseURL,text:function(){return Promise.resolve(kr.responseText)},json:function(){return Promise.resolve(kr.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([kr.response]))},clone:qr,headers:{keys:function(){return jr},entries:function(){return Br},get:function(Vr){return Wr[Vr.toLowerCase()]},has:function(Vr){return Vr.toLowerCase()in Wr}}}};for(var Gr in kr.open(br.method||"get",fr,!0),kr.onload=function(){kr.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(Vr,Zr,Jr){jr.push(Zr=Zr.toLowerCase()),Br.push([Zr,Jr]),Wr[Zr]=Wr[Zr]?Wr[Zr]+","+Jr:Jr}),wr(qr())},kr.onerror=Er,kr.withCredentials=br.credentials=="include",br.headers)kr.setRequestHeader(Gr,br.headers[Gr]);kr.send(br.body||null)})}const unfetch_module$1=Object.freeze(Object.defineProperty({__proto__:null,default:unfetch_module},Symbol.toStringTag,{value:"Module"})),require$$0$3=getAugmentedNamespace(unfetch_module$1);var browser$2=self.fetch||(self.fetch=require$$0$3.default||require$$0$3);const Yi=getDefaultExportFromCjs$2(browser$2);var define_process_env_default$2={};function Hi(fr,br){if(fr.length>=255)throw new TypeError("Alphabet too long");for(var wr=new Uint8Array(256),Er=0;Er>>0,eo=new Uint8Array(jn);In!==An;){for(var ro=_n[In],to=0,_i=jn-1;(ro!==0||to>>0,eo[_i]=ro%Wr>>>0,ro=ro/Wr>>>0;if(ro!==0)throw new Error("Non-zero carry");Cn=to,In++}for(var oo=jn-Cn;oo!==jn&&eo[oo]===0;)oo++;for(var io=qr.repeat(En);oo>>0,jn=new Uint8Array(An);_n[En];){var eo=wr[_n.charCodeAt(En)];if(eo===255)return;for(var ro=0,to=An-1;(eo!==0||ro>>0,jn[to]=eo%256>>>0,eo=eo/256>>>0;if(eo!==0)throw new Error("Non-zero carry");In=ro,En++}if(_n[En]!==" "){for(var _i=An-In;_i!==An&&jn[_i]===0;)_i++;for(var oo=new Uint8Array(Cn+(An-_i)),io=Cn;_i!==An;)oo[io++]=jn[_i++];return oo}}}function Qr(_n){var En=Jr(_n);if(En)return En;throw new Error(`Non-${br} character`)}return{encode:Zr,decodeUnsafe:Jr,decode:Qr}}var Ji=Hi,Xi=Ji;const Ne=fr=>{if(fr instanceof Uint8Array&&fr.constructor.name==="Uint8Array")return fr;if(fr instanceof ArrayBuffer)return new Uint8Array(fr);if(ArrayBuffer.isView(fr))return new Uint8Array(fr.buffer,fr.byteOffset,fr.byteLength);throw new Error("Unknown type, must be binary type")},Wi$1=fr=>new TextEncoder().encode(fr),Qi=fr=>new TextDecoder().decode(fr);class Zi{constructor(br,wr,Er){this.name=br,this.prefix=wr,this.baseEncode=Er}encode(br){if(br instanceof Uint8Array)return`${this.prefix}${this.baseEncode(br)}`;throw Error("Unknown type, must be binary type")}}class es{constructor(br,wr,Er){if(this.name=br,this.prefix=wr,wr.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=wr.codePointAt(0),this.baseDecode=Er}decode(br){if(typeof br=="string"){if(br.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(br)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(br.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(br){return Ue(this,br)}}class ts{constructor(br){this.decoders=br}or(br){return Ue(this,br)}decode(br){const wr=br[0],Er=this.decoders[wr];if(Er)return Er.decode(br);throw RangeError(`Unable to decode multibase string ${JSON.stringify(br)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Ue=(fr,br)=>new ts({...fr.decoders||{[fr.prefix]:fr},...br.decoders||{[br.prefix]:br}});let is$3=class{constructor(br,wr,Er,kr){this.name=br,this.prefix=wr,this.baseEncode=Er,this.baseDecode=kr,this.encoder=new Zi(br,wr,Er),this.decoder=new es(br,wr,kr)}encode(br){return this.encoder.encode(br)}decode(br){return this.decoder.decode(br)}};const W=({name:fr,prefix:br,encode:wr,decode:Er})=>new is$3(fr,br,wr,Er),B$3=({prefix:fr,name:br,alphabet:wr})=>{const{encode:Er,decode:kr}=Xi(wr,br);return W({prefix:fr,name:br,encode:Er,decode:jr=>Ne(kr(jr))})},ss=(fr,br,wr,Er)=>{const kr={};for(let Vr=0;Vr=8&&(Wr-=8,Br[Gr++]=255&qr>>Wr)}if(Wr>=wr||255&qr<<8-Wr)throw new SyntaxError("Unexpected end of data");return Br},rs=(fr,br,wr)=>{const Er=br[br.length-1]==="=",kr=(1<wr;)Br-=wr,jr+=br[kr&Wr>>Br];if(Br&&(jr+=br[kr&Wr<W({prefix:br,name:fr,encode(kr){return rs(kr,Er,wr)},decode(kr){return ss(kr,Er,wr,fr)}}),ns=W({prefix:"\0",name:"identity",encode:fr=>Qi(fr),decode:fr=>Wi$1(fr)});var os=Object.freeze({__proto__:null,identity:ns});const as$1=g$5({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var hs$1=Object.freeze({__proto__:null,base2:as$1});const cs$1=g$5({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var us$1=Object.freeze({__proto__:null,base8:cs$1});const ls$1=B$3({prefix:"9",name:"base10",alphabet:"0123456789"});var ds$1=Object.freeze({__proto__:null,base10:ls$1});const gs$1=g$5({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ps$1=g$5({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ds=Object.freeze({__proto__:null,base16:gs$1,base16upper:ps$1});const ys=g$5({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ms=g$5({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),bs=g$5({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),fs=g$5({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Es=g$5({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ws=g$5({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),vs=g$5({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Is=g$5({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Cs=g$5({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Rs=Object.freeze({__proto__:null,base32:ys,base32upper:ms,base32pad:bs,base32padupper:fs,base32hex:Es,base32hexupper:ws,base32hexpad:vs,base32hexpadupper:Is,base32z:Cs});const _s=B$3({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Ts=B$3({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ss=Object.freeze({__proto__:null,base36:_s,base36upper:Ts});const Ps=B$3({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),xs=B$3({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Os=Object.freeze({__proto__:null,base58btc:Ps,base58flickr:xs});const As=g$5({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zs=g$5({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Ns=g$5({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Us=g$5({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ls=Object.freeze({__proto__:null,base64:As,base64pad:zs,base64url:Ns,base64urlpad:Us});const Le=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),$s=Le.reduce((fr,br,wr)=>(fr[wr]=br,fr),[]),Fs=Le.reduce((fr,br,wr)=>(fr[br.codePointAt(0)]=wr,fr),[]);function Ms(fr){return fr.reduce((br,wr)=>(br+=$s[wr],br),"")}function ks(fr){const br=[];for(const wr of fr){const Er=Fs[wr.codePointAt(0)];if(Er===void 0)throw new Error(`Non-base256emoji character: ${wr}`);br.push(Er)}return new Uint8Array(br)}const Ks=W({prefix:"🚀",name:"base256emoji",encode:Ms,decode:ks});var Bs=Object.freeze({__proto__:null,base256emoji:Ks}),Vs=Fe,$e=128,qs=127,js$1=~qs,Gs=Math.pow(2,31);function Fe(fr,br,wr){br=br||[],wr=wr||0;for(var Er=wr;fr>=Gs;)br[wr++]=fr&255|$e,fr/=128;for(;fr&js$1;)br[wr++]=fr&255|$e,fr>>>=7;return br[wr]=fr|0,Fe.bytes=wr-Er+1,br}var Ys=he$1,Hs=128,Me=127;function he$1(fr,Er){var wr=0,Er=Er||0,kr=0,jr=Er,Br,Wr=fr.length;do{if(jr>=Wr)throw he$1.bytes=0,new RangeError("Could not decode varint");Br=fr[jr++],wr+=kr<28?(Br&Me)<=Hs);return he$1.bytes=jr-Er,wr}var Js=Math.pow(2,7),Xs=Math.pow(2,14),Ws=Math.pow(2,21),Qs=Math.pow(2,28),Zs=Math.pow(2,35),er=Math.pow(2,42),tr=Math.pow(2,49),ir=Math.pow(2,56),sr=Math.pow(2,63),rr=function(fr){return fr(ke.encode(fr,br,wr),br),Be=fr=>ke.encodingLength(fr),ce$1=(fr,br)=>{const wr=br.byteLength,Er=Be(fr),kr=Er+Be(wr),jr=new Uint8Array(kr+wr);return Ke(fr,jr,0),Ke(wr,jr,Er),jr.set(br,kr),new or(fr,wr,br,jr)};class or{constructor(br,wr,Er,kr){this.code=br,this.size=wr,this.digest=Er,this.bytes=kr}}const Ve=({name:fr,code:br,encode:wr})=>new ar(fr,br,wr);class ar{constructor(br,wr,Er){this.name=br,this.code=wr,this.encode=Er}digest(br){if(br instanceof Uint8Array){const wr=this.encode(br);return wr instanceof Uint8Array?ce$1(this.code,wr):wr.then(Er=>ce$1(this.code,Er))}else throw Error("Unknown type, must be binary type")}}const qe=fr=>async br=>new Uint8Array(await crypto.subtle.digest(fr,br)),hr$1=Ve({name:"sha2-256",code:18,encode:qe("SHA-256")}),cr$1=Ve({name:"sha2-512",code:19,encode:qe("SHA-512")});var ur=Object.freeze({__proto__:null,sha256:hr$1,sha512:cr$1});const je=0,lr$1="identity",Ge=Ne,dr=fr=>ce$1(je,Ge(fr)),gr={code:je,name:lr$1,encode:Ge,digest:dr};var pr=Object.freeze({__proto__:null,identity:gr});new TextEncoder,new TextDecoder;const Ye={...os,...hs$1,...us$1,...ds$1,...Ds,...Rs,...Ss,...Os,...Ls,...Bs};({...ur,...pr});function He(fr){return globalThis.Buffer!=null?new Uint8Array(fr.buffer,fr.byteOffset,fr.byteLength):fr}function Dr(fr=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?He(globalThis.Buffer.allocUnsafe(fr)):new Uint8Array(fr)}function Je(fr,br,wr,Er){return{name:fr,prefix:br,encoder:{name:fr,prefix:br,encode:wr},decoder:{decode:Er}}}const Xe=Je("utf8","u",fr=>"u"+new TextDecoder("utf8").decode(fr),fr=>new TextEncoder().encode(fr.substring(1))),ue$1=Je("ascii","a",fr=>{let br="a";for(let wr=0;wr{fr=fr.substring(1);const br=Dr(fr.length);for(let wr=0;wr{if(!this.initialized){const Er=await this.getKeyChain();typeof Er<"u"&&(this.keychain=Er),this.initialized=!0}},this.has=Er=>(this.isInitialized(),this.keychain.has(Er)),this.set=async(Er,kr)=>{this.isInitialized(),this.keychain.set(Er,kr),await this.persist()},this.get=Er=>{this.isInitialized();const kr=this.keychain.get(Er);if(typeof kr>"u"){const{message:jr}=N$2("NO_MATCHING_KEY",`${this.name}: ${Er}`);throw new Error(jr)}return kr},this.del=async Er=>{this.isInitialized(),this.keychain.delete(Er),await this.persist()},this.core=br,this.logger=E$4(wr,this.name)}get context(){return y$4(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(br){await this.core.storage.setItem(this.storageKey,rt$1(br))}async getKeyChain(){const br=await this.core.storage.getItem(this.storageKey);return typeof br<"u"?ot$1(br):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}}class xt{constructor(br,wr,Er){this.core=br,this.logger=wr,this.name=et,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=kr=>(this.isInitialized(),this.keychain.has(kr)),this.getClientId=async()=>{this.isInitialized();const kr=await this.getClientSeed(),jr=generateKeyPair$1(kr);return encodeIss(jr.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const kr=kn();return this.setPrivateKey(kr.publicKey,kr.privateKey)},this.signJWT=async kr=>{this.isInitialized();const jr=await this.getClientSeed(),Br=generateKeyPair$1(jr),Wr=Vn$1();return await signJWT(Wr,kr,tt,Br)},this.generateSharedKey=(kr,jr,Br)=>{this.isInitialized();const Wr=this.getPrivateKey(kr),qr=Mn(Wr,jr);return this.setSymKey(qr,Br)},this.setSymKey=async(kr,jr)=>{this.isInitialized();const Br=jr||Kn(kr);return await this.keychain.set(Br,kr),Br},this.deleteKeyPair=async kr=>{this.isInitialized(),await this.keychain.del(kr)},this.deleteSymKey=async kr=>{this.isInitialized(),await this.keychain.del(kr)},this.encode=async(kr,jr,Br)=>{this.isInitialized();const Wr=Ae(Br),qr=safeJsonStringify(jr);if(qn(Wr)){const Jr=Wr.senderPublicKey,Qr=Wr.receiverPublicKey;kr=await this.generateSharedKey(Jr,Qr)}const Gr=this.getSymKey(kr),{type:Vr,senderPublicKey:Zr}=Wr;return xn({type:Vr,symKey:Gr,message:qr,senderPublicKey:Zr})},this.decode=async(kr,jr,Br)=>{this.isInitialized();const Wr=Hn(jr,Br);if(qn(Wr)){const qr=Wr.receiverPublicKey,Gr=Wr.senderPublicKey;kr=await this.generateSharedKey(qr,Gr)}try{const qr=this.getSymKey(kr),Gr=Fn({symKey:qr,encoded:jr});return safeJsonParse(Gr)}catch(qr){this.logger.error(`Failed to decode message from topic: '${kr}', clientId: '${await this.getClientId()}'`),this.logger.error(qr)}},this.getPayloadType=kr=>{const jr=ee$2(kr);return j$4(jr.type)},this.getPayloadSenderPublicKey=kr=>{const jr=ee$2(kr);return jr.senderPublicKey?toString(jr.senderPublicKey,p$4):void 0},this.core=br,this.logger=E$4(wr,this.name),this.keychain=Er||new Pt(this.core,this.logger)}get context(){return y$4(this.logger)}async setPrivateKey(br,wr){return await this.keychain.set(br,wr),br}getPrivateKey(br){return this.keychain.get(br)}async getClientSeed(){let br="";try{br=this.keychain.get(de$1)}catch{br=Vn$1(),await this.keychain.set(de$1,br)}return mr(br,"base16")}getSymKey(br){return this.keychain.get(br)}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}}class Ot extends a$3{constructor(br,wr){super(br,wr),this.logger=br,this.core=wr,this.messages=new Map,this.name=rt,this.version=nt,this.initialized=!1,this.storagePrefix=O$3,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const Er=await this.getRelayerMessages();typeof Er<"u"&&(this.messages=Er),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(Er){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(Er)}finally{this.initialized=!0}}},this.set=async(Er,kr)=>{this.isInitialized();const jr=Ln(kr);let Br=this.messages.get(Er);return typeof Br>"u"&&(Br={}),typeof Br[jr]<"u"||(Br[jr]=kr,this.messages.set(Er,Br),await this.persist()),jr},this.get=Er=>{this.isInitialized();let kr=this.messages.get(Er);return typeof kr>"u"&&(kr={}),kr},this.has=(Er,kr)=>{this.isInitialized();const jr=this.get(Er),Br=Ln(kr);return typeof jr[Br]<"u"},this.del=async Er=>{this.isInitialized(),this.messages.delete(Er),await this.persist()},this.logger=E$4(br,this.name),this.core=wr}get context(){return y$4(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(br){await this.core.storage.setItem(this.storageKey,rt$1(br))}async getRelayerMessages(){const br=await this.core.storage.getItem(this.storageKey);return typeof br<"u"?ot$1(br):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}}class vr extends u$3{constructor(br,wr){super(br,wr),this.relayer=br,this.logger=wr,this.events=new eventsExports.EventEmitter,this.name=at,this.queue=new Map,this.publishTimeout=cjs$4.toMiliseconds(cjs$4.TEN_SECONDS*2),this.needsTransportRestart=!1,this.publish=async(Er,kr,jr)=>{var Br;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:Er,message:kr,opts:jr}});try{const Wr=(jr==null?void 0:jr.ttl)||ot,qr=vt$1(jr),Gr=(jr==null?void 0:jr.prompt)||!1,Vr=(jr==null?void 0:jr.tag)||0,Zr=(jr==null?void 0:jr.id)||getBigIntRpcId().toString(),Jr={topic:Er,message:kr,opts:{ttl:Wr,relay:qr,prompt:Gr,tag:Vr,id:Zr}},Qr=setTimeout(()=>this.queue.set(Zr,Jr),this.publishTimeout);try{await await ut$1(this.rpcPublish(Er,kr,Wr,qr,Gr,Vr,Zr),this.publishTimeout,`Failed to publish payload, please try again. id:${Zr} tag:${Vr}`),this.removeRequestFromQueue(Zr),this.relayer.events.emit(D$4.publish,Jr)}catch(_n){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(Br=jr==null?void 0:jr.internal)!=null&&Br.throwOnFailedPublish)throw this.removeRequestFromQueue(Zr),_n;return}finally{clearTimeout(Qr)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:Er,message:kr,opts:jr}})}catch(Wr){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(Wr),Wr}},this.on=(Er,kr)=>{this.events.on(Er,kr)},this.once=(Er,kr)=>{this.events.once(Er,kr)},this.off=(Er,kr)=>{this.events.off(Er,kr)},this.removeListener=(Er,kr)=>{this.events.removeListener(Er,kr)},this.relayer=br,this.logger=E$4(wr,this.name),this.registerEventListeners()}get context(){return y$4(this.logger)}rpcPublish(br,wr,Er,kr,jr,Br,Wr){var qr,Gr,Vr,Zr;const Jr={method:Et$1(kr.protocol).publish,params:{topic:br,message:wr,ttl:Er,prompt:jr,tag:Br},id:Wr};return w$5((qr=Jr.params)==null?void 0:qr.prompt)&&((Gr=Jr.params)==null||delete Gr.prompt),w$5((Vr=Jr.params)==null?void 0:Vr.tag)&&((Zr=Jr.params)==null||delete Zr.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:Jr}),this.relayer.request(Jr)}removeRequestFromQueue(br){this.queue.delete(br)}checkQueue(){this.queue.forEach(async br=>{const{topic:wr,message:Er,opts:kr}=br;await this.publish(wr,Er,kr)})}registerEventListeners(){this.relayer.core.heartbeat.on(cjs$1.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(D$4.connection_stalled);return}this.checkQueue()}),this.relayer.on(D$4.message_ack,br=>{this.removeRequestFromQueue(br.id.toString())})}}class Ir{constructor(){this.map=new Map,this.set=(br,wr)=>{const Er=this.get(br);this.exists(br,wr)||this.map.set(br,[...Er,wr])},this.get=br=>this.map.get(br)||[],this.exists=(br,wr)=>this.get(br).includes(wr),this.delete=(br,wr)=>{if(typeof wr>"u"){this.map.delete(br);return}if(!this.map.has(br))return;const Er=this.get(br);if(!this.exists(br,wr))return;const kr=Er.filter(jr=>jr!==wr);if(!kr.length){this.map.delete(br);return}this.map.set(br,kr)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var Cr=Object.defineProperty,Rr=Object.defineProperties,_r=Object.getOwnPropertyDescriptors,At=Object.getOwnPropertySymbols,Tr=Object.prototype.hasOwnProperty,Sr=Object.prototype.propertyIsEnumerable,zt=(fr,br,wr)=>br in fr?Cr(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,q$3=(fr,br)=>{for(var wr in br||(br={}))Tr.call(br,wr)&&zt(fr,wr,br[wr]);if(At)for(var wr of At(br))Sr.call(br,wr)&&zt(fr,wr,br[wr]);return fr},De=(fr,br)=>Rr(fr,_r(br));class Nt extends d$3{constructor(br,wr){super(br,wr),this.relayer=br,this.logger=wr,this.subscriptions=new Map,this.topicMap=new Ir,this.events=new eventsExports.EventEmitter,this.name=mt,this.version=bt,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=O$3,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(Er,kr)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:Er,opts:kr}});try{const jr=vt$1(kr),Br={topic:Er,relay:jr};this.pending.set(Er,Br);const Wr=await this.rpcSubscribe(Er,jr);return this.onSubscribe(Wr,Br),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:Er,opts:kr}}),Wr}catch(jr){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(jr),jr}},this.unsubscribe=async(Er,kr)=>{await this.restartToComplete(),this.isInitialized(),typeof(kr==null?void 0:kr.id)<"u"?await this.unsubscribeById(Er,kr.id,kr):await this.unsubscribeByTopic(Er,kr)},this.isSubscribed=async Er=>{if(this.topics.includes(Er))return!0;const kr=`${this.pendingSubscriptionWatchLabel}_${Er}`;return await new Promise((jr,Br)=>{const Wr=new cjs$4.Watch;Wr.start(kr);const qr=setInterval(()=>{!this.pending.has(Er)&&this.topics.includes(Er)&&(clearInterval(qr),Wr.stop(kr),jr(!0)),Wr.elapsed(kr)>=ft$1&&(clearInterval(qr),Wr.stop(kr),Br(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(Er,kr)=>{this.events.on(Er,kr)},this.once=(Er,kr)=>{this.events.once(Er,kr)},this.off=(Er,kr)=>{this.events.off(Er,kr)},this.removeListener=(Er,kr)=>{this.events.removeListener(Er,kr)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=br,this.logger=E$4(wr,this.name),this.clientId=""}get context(){return y$4(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(br,wr){let Er=!1;try{Er=this.getSubscription(br).topic===wr}catch{}return Er}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(br,wr){const Er=this.topicMap.get(br);await Promise.all(Er.map(async kr=>await this.unsubscribeById(br,kr,wr)))}async unsubscribeById(br,wr,Er){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:br,id:wr,opts:Er}});try{const kr=vt$1(Er);await this.rpcUnsubscribe(br,wr,kr);const jr=U$3("USER_DISCONNECTED",`${this.name}, ${br}`);await this.onUnsubscribe(br,wr,jr),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:br,id:wr,opts:Er}})}catch(kr){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(kr),kr}}async rpcSubscribe(br,wr){const Er={method:Et$1(wr.protocol).subscribe,params:{topic:br}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:Er});try{await await ut$1(this.relayer.request(Er),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(D$4.connection_stalled)}return Ln(br+this.clientId)}async rpcBatchSubscribe(br){if(!br.length)return;const wr=br[0].relay,Er={method:Et$1(wr.protocol).batchSubscribe,params:{topics:br.map(kr=>kr.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:Er});try{return await await ut$1(this.relayer.request(Er),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(D$4.connection_stalled)}}rpcUnsubscribe(br,wr,Er){const kr={method:Et$1(Er.protocol).unsubscribe,params:{topic:br,id:wr}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:kr}),this.relayer.request(kr)}onSubscribe(br,wr){this.setSubscription(br,De(q$3({},wr),{id:br})),this.pending.delete(wr.topic)}onBatchSubscribe(br){br.length&&br.forEach(wr=>{this.setSubscription(wr.id,q$3({},wr)),this.pending.delete(wr.topic)})}async onUnsubscribe(br,wr,Er){this.events.removeAllListeners(wr),this.hasSubscription(wr,br)&&this.deleteSubscription(wr,Er),await this.relayer.messages.del(br)}async setRelayerSubscriptions(br){await this.relayer.core.storage.setItem(this.storageKey,br)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(br,wr){this.subscriptions.has(br)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:br,subscription:wr}),this.addSubscription(br,wr))}addSubscription(br,wr){this.subscriptions.set(br,q$3({},wr)),this.topicMap.set(wr.topic,br),this.events.emit(w$3.created,wr)}getSubscription(br){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:br});const wr=this.subscriptions.get(br);if(!wr){const{message:Er}=N$2("NO_MATCHING_KEY",`${this.name}: ${br}`);throw new Error(Er)}return wr}deleteSubscription(br,wr){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:br,reason:wr});const Er=this.getSubscription(br);this.subscriptions.delete(br),this.topicMap.delete(Er.topic,br),this.events.emit(w$3.deleted,De(q$3({},Er),{reason:wr}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(w$3.sync)}async reset(){if(this.cached.length){const br=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let wr=0;wr"u"||!br.length)return;if(this.subscriptions.size){const{message:wr}=N$2("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(wr),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(wr)}this.cached=br,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(br){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(br)}}async batchSubscribe(br){if(!br.length)return;const wr=await this.rpcBatchSubscribe(br);k$3(wr)&&this.onBatchSubscribe(wr.map((Er,kr)=>De(q$3({},br[kr]),{id:Er})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;const br=[];this.pending.forEach(wr=>{br.push(wr)}),await this.batchSubscribe(br)}registerEventListeners(){this.relayer.core.heartbeat.on(cjs$1.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(D$4.connect,async()=>{await this.onConnect()}),this.relayer.on(D$4.disconnect,()=>{this.onDisconnect()}),this.events.on(w$3.created,async br=>{const wr=w$3.created;this.logger.info(`Emitting ${wr}`),this.logger.debug({type:"event",event:wr,data:br}),await this.persist()}),this.events.on(w$3.deleted,async br=>{const wr=w$3.deleted;this.logger.info(`Emitting ${wr}`),this.logger.debug({type:"event",event:wr,data:br}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}async restartToComplete(){this.restartInProgress&&await new Promise(br=>{const wr=setInterval(()=>{this.restartInProgress||(clearInterval(wr),br())},this.pollingInterval)})}}var Pr=Object.defineProperty,Ut=Object.getOwnPropertySymbols,xr=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,Lt=(fr,br,wr)=>br in fr?Pr(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,Ar=(fr,br)=>{for(var wr in br||(br={}))xr.call(br,wr)&&Lt(fr,wr,br[wr]);if(Ut)for(var wr of Ut(br))Or.call(br,wr)&&Lt(fr,wr,br[wr]);return fr};class $t extends g$7{constructor(br){super(br),this.protocol="wc",this.version=2,this.events=new eventsExports.EventEmitter,this.name=ut,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.request=async wr=>{this.logger.debug("Publishing Request Payload");const Er=wr.id;try{await this.toEstablishConnection();const kr=this.provider.request(wr);return this.requestsInFlight.set(Er,{promise:kr,request:wr}),await kr}catch(kr){throw this.logger.debug("Failed to Publish Request"),this.logger.error(kr),kr}finally{this.requestsInFlight.delete(Er)}},this.onPayloadHandler=wr=>{this.onProviderPayload(wr)},this.onConnectHandler=()=>{this.events.emit(D$4.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=wr=>{this.logger.error(wr),this.events.emit(D$4.error,wr),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(P$4.payload,this.onPayloadHandler),this.provider.on(P$4.connect,this.onConnectHandler),this.provider.on(P$4.disconnect,this.onDisconnectHandler),this.provider.on(P$4.error,this.onProviderErrorHandler)},this.core=br.core,this.logger=typeof br.logger<"u"&&typeof br.logger!="string"?E$4(br.logger,this.name):Hg(k$4({level:br.logger||ct})),this.messages=new Ot(this.logger,br.core),this.subscriber=new Nt(this,this.logger),this.publisher=new vr(this,this.logger),this.relayUrl=(br==null?void 0:br.relayUrl)||ge$2,this.projectId=br.projectId,this.bundleId=Jn(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${pe$1}...`),await this.restartTransport(pe$1)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},pt)}get context(){return y$4(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(br,wr,Er){this.isInitialized(),await this.publisher.publish(br,wr,Er),await this.recordMessageEvent({topic:br,message:wr,publishedAt:Date.now()})}async subscribe(br,wr){var Er;this.isInitialized();let kr=((Er=this.subscriber.topicMap.get(br))==null?void 0:Er[0])||"";if(kr)return kr;let jr;const Br=Wr=>{Wr.topic===br&&(this.subscriber.off(w$3.created,Br),jr())};return await Promise.all([new Promise(Wr=>{jr=Wr,this.subscriber.on(w$3.created,Br)}),new Promise(async Wr=>{kr=await this.subscriber.subscribe(br,wr),Wr()})]),kr}async unsubscribe(br,wr){this.isInitialized(),await this.subscriber.unsubscribe(br,wr)}on(br,wr){this.events.on(br,wr)}once(br,wr){this.events.once(br,wr)}off(br,wr){this.events.off(br,wr)}removeListener(br,wr){this.events.removeListener(br,wr)}async transportClose(){this.requestsInFlight.size>0&&(this.logger.debug("Waiting for all in-flight requests to finish before closing transport..."),this.requestsInFlight.forEach(async br=>{await br.promise})),this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await ut$1(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(br){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){br&&br!==this.relayUrl&&(this.relayUrl=br,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(wr=>{if(!this.initialized)return wr();this.subscriber.once(w$3.resubscribed,()=>{wr()})}),new Promise(async(wr,Er)=>{try{await ut$1(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(kr){Er(kr);return}wr()})])}catch(wr){this.logger.error(wr);const Er=wr;if(!this.isConnectionStalled(Er.message))throw wr;this.provider.events.emit(P$4.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(br){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=br||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await rr$1())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(br){return this.staleConnectionErrors.some(wr=>br.includes(wr))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const br=await this.core.crypto.signJWT(this.relayUrl);this.provider=new JsonRpcProvider$1(new f$5(Xn({sdkVersion:gt,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:br,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(br){const{topic:wr,message:Er}=br;await this.messages.set(wr,Er)}async shouldIgnoreMessageEvent(br){const{topic:wr,message:Er}=br;if(!Er||Er.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${Er}`),!0;if(!await this.subscriber.isSubscribed(wr))return this.logger.debug(`Ignoring message for non-subscribed topic ${wr}`),!0;const kr=this.messages.has(wr,Er);return kr&&this.logger.debug(`Ignoring duplicate message: ${Er}`),kr}async onProviderPayload(br){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:br}),isJsonRpcRequest(br)){if(!br.method.endsWith(lt))return;const wr=br.params,{topic:Er,message:kr,publishedAt:jr}=wr.data,Br={topic:Er,message:kr,publishedAt:jr};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Ar({type:"event",event:wr.id},Br)),this.events.emit(wr.id,Br),await this.acknowledgePayload(br),await this.onMessageEvent(Br)}else isJsonRpcResponse(br)&&this.events.emit(D$4.message_ack,br)}async onMessageEvent(br){await this.shouldIgnoreMessageEvent(br)||(this.events.emit(D$4.message,br),await this.recordMessageEvent(br))}async acknowledgePayload(br){const wr=formatJsonRpcResult(br.id,!0);await this.provider.connection.send(wr)}unregisterProviderListeners(){this.provider.off(P$4.payload,this.onPayloadHandler),this.provider.off(P$4.connect,this.onConnectHandler),this.provider.off(P$4.disconnect,this.onDisconnectHandler),this.provider.off(P$4.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(D$4.connection_stalled,()=>{this.restartTransport().catch(wr=>this.logger.error(wr))});let br=await rr$1();or$1(async wr=>{this.initialized&&br!==wr&&(br=wr,wr?await this.restartTransport().catch(Er=>this.logger.error(Er)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(Er=>this.logger.error(Er))))})}onProviderDisconnect(){this.events.emit(D$4.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(br=>this.logger.error(br))},cjs$4.toMiliseconds(dt)))}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(br=>{const wr=setInterval(()=>{this.connected&&(clearInterval(wr),br())},this.connectionStatusPollingInterval)});await this.restartTransport()}}}var zr=Object.defineProperty,Ft=Object.getOwnPropertySymbols,Nr=Object.prototype.hasOwnProperty,Ur=Object.prototype.propertyIsEnumerable,Mt=(fr,br,wr)=>br in fr?zr(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,kt=(fr,br)=>{for(var wr in br||(br={}))Nr.call(br,wr)&&Mt(fr,wr,br[wr]);if(Ft)for(var wr of Ft(br))Ur.call(br,wr)&&Mt(fr,wr,br[wr]);return fr};class Kt extends p$5{constructor(br,wr,Er,kr=O$3,jr=void 0){super(br,wr,Er,kr),this.core=br,this.logger=wr,this.name=Er,this.map=new Map,this.version=Dt,this.cached=[],this.initialized=!1,this.storagePrefix=O$3,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(Br=>{this.getKey&&Br!==null&&!w$5(Br)?this.map.set(this.getKey(Br),Br):Lt$1(Br)?this.map.set(Br.id,Br):xt$1(Br)&&this.map.set(Br.topic,Br)}),this.cached=[],this.initialized=!0)},this.set=async(Br,Wr)=>{this.isInitialized(),this.map.has(Br)?await this.update(Br,Wr):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:Br,value:Wr}),this.map.set(Br,Wr),await this.persist())},this.get=Br=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:Br}),this.getData(Br)),this.getAll=Br=>(this.isInitialized(),Br?this.values.filter(Wr=>Object.keys(Br).every(qr=>Gi(Wr[qr],Br[qr]))):this.values),this.update=async(Br,Wr)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:Br,update:Wr});const qr=kt(kt({},this.getData(Br)),Wr);this.map.set(Br,qr),await this.persist()},this.delete=async(Br,Wr)=>{this.isInitialized(),this.map.has(Br)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:Br,reason:Wr}),this.map.delete(Br),await this.persist())},this.logger=E$4(wr,this.name),this.storagePrefix=kr,this.getKey=jr}get context(){return y$4(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(br){await this.core.storage.setItem(this.storageKey,br)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(br){const wr=this.map.get(br);if(!wr){const{message:Er}=N$2("NO_MATCHING_KEY",`${this.name}: ${br}`);throw this.logger.error(Er),new Error(Er)}return wr}async persist(){await this.setDataStore(this.values)}async restore(){try{const br=await this.getDataStore();if(typeof br>"u"||!br.length)return;if(this.map.size){const{message:wr}=N$2("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(wr),new Error(wr)}this.cached=br,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(br){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(br)}}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}}class Bt{constructor(br,wr){this.core=br,this.logger=wr,this.name=Et,this.version=wt,this.events=new Ug,this.initialized=!1,this.storagePrefix=O$3,this.ignoredPayloadTypes=[_$3],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:Er})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...Er])]},this.create=async()=>{this.isInitialized();const Er=Vn$1(),kr=await this.core.crypto.setSymKey(Er),jr=pt$1(cjs$4.FIVE_MINUTES),Br={protocol:ht},Wr={topic:kr,expiry:jr,relay:Br,active:!1},qr=Rt$1({protocol:this.core.protocol,version:this.core.version,topic:kr,symKey:Er,relay:Br,expiryTimestamp:jr});return await this.pairings.set(kr,Wr),await this.core.relayer.subscribe(kr),this.core.expirer.set(kr,jr),{topic:kr,uri:qr}},this.pair=async Er=>{this.isInitialized(),this.isValidPair(Er);const{topic:kr,symKey:jr,relay:Br,expiryTimestamp:Wr}=Pt$1(Er.uri);let qr;if(this.pairings.keys.includes(kr)&&(qr=this.pairings.get(kr),qr.active))throw new Error(`Pairing already exists: ${kr}. Please try again with a new connection URI.`);const Gr=Wr||pt$1(cjs$4.FIVE_MINUTES),Vr={topic:kr,relay:Br,expiry:Gr,active:!1};return await this.pairings.set(kr,Vr),this.core.expirer.set(kr,Gr),Er.activatePairing&&await this.activate({topic:kr}),this.events.emit(V$1.create,Vr),this.core.crypto.keychain.has(kr)||(await this.core.crypto.setSymKey(jr,kr),await this.core.relayer.subscribe(kr,{relay:Br})),Vr},this.activate=async({topic:Er})=>{this.isInitialized();const kr=pt$1(cjs$4.THIRTY_DAYS);await this.pairings.update(Er,{active:!0,expiry:kr}),this.core.expirer.set(Er,kr)},this.ping=async Er=>{this.isInitialized(),await this.isValidPing(Er);const{topic:kr}=Er;if(this.pairings.keys.includes(kr)){const jr=await this.sendRequest(kr,"wc_pairingPing",{}),{done:Br,resolve:Wr,reject:qr}=at$1();this.events.once(yt$1("pairing_ping",jr),({error:Gr})=>{Gr?qr(Gr):Wr()}),await Br()}},this.updateExpiry=async({topic:Er,expiry:kr})=>{this.isInitialized(),await this.pairings.update(Er,{expiry:kr})},this.updateMetadata=async({topic:Er,metadata:kr})=>{this.isInitialized(),await this.pairings.update(Er,{peerMetadata:kr})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async Er=>{this.isInitialized(),await this.isValidDisconnect(Er);const{topic:kr}=Er;this.pairings.keys.includes(kr)&&(await this.sendRequest(kr,"wc_pairingDelete",U$3("USER_DISCONNECTED")),await this.deletePairing(kr))},this.sendRequest=async(Er,kr,jr)=>{const Br=formatJsonRpcRequest(kr,jr),Wr=await this.core.crypto.encode(Er,Br),qr=$$2[kr].req;return this.core.history.set(Er,Br),this.core.relayer.publish(Er,Wr,qr),Br.id},this.sendResult=async(Er,kr,jr)=>{const Br=formatJsonRpcResult(Er,jr),Wr=await this.core.crypto.encode(kr,Br),qr=await this.core.history.get(kr,Er),Gr=$$2[qr.request.method].res;await this.core.relayer.publish(kr,Wr,Gr),await this.core.history.resolve(Br)},this.sendError=async(Er,kr,jr)=>{const Br=formatJsonRpcError(Er,jr),Wr=await this.core.crypto.encode(kr,Br),qr=await this.core.history.get(kr,Er),Gr=$$2[qr.request.method]?$$2[qr.request.method].res:$$2.unregistered_method.res;await this.core.relayer.publish(kr,Wr,Gr),await this.core.history.resolve(Br)},this.deletePairing=async(Er,kr)=>{await this.core.relayer.unsubscribe(Er),await Promise.all([this.pairings.delete(Er,U$3("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(Er),kr?Promise.resolve():this.core.expirer.del(Er)])},this.cleanup=async()=>{const Er=this.pairings.getAll().filter(kr=>mt$1(kr.expiry));await Promise.all(Er.map(kr=>this.deletePairing(kr.topic)))},this.onRelayEventRequest=Er=>{const{topic:kr,payload:jr}=Er;switch(jr.method){case"wc_pairingPing":return this.onPairingPingRequest(kr,jr);case"wc_pairingDelete":return this.onPairingDeleteRequest(kr,jr);default:return this.onUnknownRpcMethodRequest(kr,jr)}},this.onRelayEventResponse=async Er=>{const{topic:kr,payload:jr}=Er,Br=(await this.core.history.get(kr,jr.id)).request.method;switch(Br){case"wc_pairingPing":return this.onPairingPingResponse(kr,jr);default:return this.onUnknownRpcMethodResponse(Br)}},this.onPairingPingRequest=async(Er,kr)=>{const{id:jr}=kr;try{this.isValidPing({topic:Er}),await this.sendResult(jr,Er,!0),this.events.emit(V$1.ping,{id:jr,topic:Er})}catch(Br){await this.sendError(jr,Er,Br),this.logger.error(Br)}},this.onPairingPingResponse=(Er,kr)=>{const{id:jr}=kr;setTimeout(()=>{isJsonRpcResult(kr)?this.events.emit(yt$1("pairing_ping",jr),{}):isJsonRpcError(kr)&&this.events.emit(yt$1("pairing_ping",jr),{error:kr.error})},500)},this.onPairingDeleteRequest=async(Er,kr)=>{const{id:jr}=kr;try{this.isValidDisconnect({topic:Er}),await this.deletePairing(Er),this.events.emit(V$1.delete,{id:jr,topic:Er})}catch(Br){await this.sendError(jr,Er,Br),this.logger.error(Br)}},this.onUnknownRpcMethodRequest=async(Er,kr)=>{const{id:jr,method:Br}=kr;try{if(this.registeredMethods.includes(Br))return;const Wr=U$3("WC_METHOD_UNSUPPORTED",Br);await this.sendError(jr,Er,Wr),this.logger.error(Wr)}catch(Wr){await this.sendError(jr,Er,Wr),this.logger.error(Wr)}},this.onUnknownRpcMethodResponse=Er=>{this.registeredMethods.includes(Er)||this.logger.error(U$3("WC_METHOD_UNSUPPORTED",Er))},this.isValidPair=Er=>{var kr;if(!Gt$1(Er)){const{message:Br}=N$2("MISSING_OR_INVALID",`pair() params: ${Er}`);throw new Error(Br)}if(!Kt$1(Er.uri)){const{message:Br}=N$2("MISSING_OR_INVALID",`pair() uri: ${Er.uri}`);throw new Error(Br)}const jr=Pt$1(Er.uri);if(!((kr=jr==null?void 0:jr.relay)!=null&&kr.protocol)){const{message:Br}=N$2("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(Br)}if(!(jr!=null&&jr.symKey)){const{message:Br}=N$2("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(Br)}if(jr!=null&&jr.expiryTimestamp&&cjs$4.toMiliseconds(jr==null?void 0:jr.expiryTimestamp){if(!Gt$1(Er)){const{message:jr}=N$2("MISSING_OR_INVALID",`ping() params: ${Er}`);throw new Error(jr)}const{topic:kr}=Er;await this.isValidPairingTopic(kr)},this.isValidDisconnect=async Er=>{if(!Gt$1(Er)){const{message:jr}=N$2("MISSING_OR_INVALID",`disconnect() params: ${Er}`);throw new Error(jr)}const{topic:kr}=Er;await this.isValidPairingTopic(kr)},this.isValidPairingTopic=async Er=>{if(!g$6(Er,!1)){const{message:kr}=N$2("MISSING_OR_INVALID",`pairing topic should be a string: ${Er}`);throw new Error(kr)}if(!this.pairings.keys.includes(Er)){const{message:kr}=N$2("NO_MATCHING_KEY",`pairing topic doesn't exist: ${Er}`);throw new Error(kr)}if(mt$1(this.pairings.get(Er).expiry)){await this.deletePairing(Er);const{message:kr}=N$2("EXPIRED",`pairing topic: ${Er}`);throw new Error(kr)}},this.core=br,this.logger=E$4(wr,this.name),this.pairings=new Kt(this.core,this.logger,this.name,this.storagePrefix)}get context(){return y$4(this.logger)}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}registerRelayerEvents(){this.core.relayer.on(D$4.message,async br=>{const{topic:wr,message:Er}=br;if(!this.pairings.keys.includes(wr)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(Er)))return;const kr=await this.core.crypto.decode(wr,Er);try{isJsonRpcRequest(kr)?(this.core.history.set(wr,kr),this.onRelayEventRequest({topic:wr,payload:kr})):isJsonRpcResponse(kr)&&(await this.core.history.resolve(kr),await this.onRelayEventResponse({topic:wr,payload:kr}),this.core.history.delete(wr,kr.id))}catch(jr){this.logger.error(jr)}})}registerExpirerEvents(){this.core.expirer.on(v$4.expired,async br=>{const{topic:wr}=ft$2(br.target);wr&&this.pairings.keys.includes(wr)&&(await this.deletePairing(wr,!0),this.events.emit(V$1.expire,{topic:wr}))})}}class Vt extends h$3{constructor(br,wr){super(br,wr),this.core=br,this.logger=wr,this.records=new Map,this.events=new eventsExports.EventEmitter,this.name=vt,this.version=It,this.cached=[],this.initialized=!1,this.storagePrefix=O$3,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(Er=>this.records.set(Er.id,Er)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(Er,kr,jr)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:Er,request:kr,chainId:jr}),this.records.has(kr.id))return;const Br={id:kr.id,topic:Er,request:{method:kr.method,params:kr.params||null},chainId:jr,expiry:pt$1(cjs$4.THIRTY_DAYS)};this.records.set(Br.id,Br),this.events.emit(R$1.created,Br)},this.resolve=async Er=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:Er}),!this.records.has(Er.id))return;const kr=await this.getRecord(Er.id);typeof kr.response>"u"&&(kr.response=isJsonRpcError(Er)?{error:Er.error}:{result:Er.result},this.records.set(kr.id,kr),this.events.emit(R$1.updated,kr))},this.get=async(Er,kr)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:Er,id:kr}),await this.getRecord(kr)),this.delete=(Er,kr)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:kr}),this.values.forEach(jr=>{if(jr.topic===Er){if(typeof kr<"u"&&jr.id!==kr)return;this.records.delete(jr.id),this.events.emit(R$1.deleted,jr)}})},this.exists=async(Er,kr)=>(this.isInitialized(),this.records.has(kr)?(await this.getRecord(kr)).topic===Er:!1),this.on=(Er,kr)=>{this.events.on(Er,kr)},this.once=(Er,kr)=>{this.events.once(Er,kr)},this.off=(Er,kr)=>{this.events.off(Er,kr)},this.removeListener=(Er,kr)=>{this.events.removeListener(Er,kr)},this.logger=E$4(wr,this.name)}get context(){return y$4(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const br=[];return this.values.forEach(wr=>{if(typeof wr.response<"u")return;const Er={topic:wr.topic,request:formatJsonRpcRequest(wr.request.method,wr.request.params,wr.id),chainId:wr.chainId};return br.push(Er)}),br}async setJsonRpcRecords(br){await this.core.storage.setItem(this.storageKey,br)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(br){this.isInitialized();const wr=this.records.get(br);if(!wr){const{message:Er}=N$2("NO_MATCHING_KEY",`${this.name}: ${br}`);throw new Error(Er)}return wr}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(R$1.sync)}async restore(){try{const br=await this.getJsonRpcRecords();if(typeof br>"u"||!br.length)return;if(this.records.size){const{message:wr}=N$2("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(wr),new Error(wr)}this.cached=br,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(br){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(br)}}registerEventListeners(){this.events.on(R$1.created,br=>{const wr=R$1.created;this.logger.info(`Emitting ${wr}`),this.logger.debug({type:"event",event:wr,record:br}),this.persist()}),this.events.on(R$1.updated,br=>{const wr=R$1.updated;this.logger.info(`Emitting ${wr}`),this.logger.debug({type:"event",event:wr,record:br}),this.persist()}),this.events.on(R$1.deleted,br=>{const wr=R$1.deleted;this.logger.info(`Emitting ${wr}`),this.logger.debug({type:"event",event:wr,record:br}),this.persist()}),this.core.heartbeat.on(cjs$1.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(br=>{cjs$4.toMiliseconds(br.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${br.id}`),this.delete(br.topic,br.id))})}catch(br){this.logger.warn(br)}}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}}class qt extends E$3{constructor(br,wr){super(br,wr),this.core=br,this.logger=wr,this.expirations=new Map,this.events=new eventsExports.EventEmitter,this.name=Ct$1,this.version=Rt,this.cached=[],this.initialized=!1,this.storagePrefix=O$3,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(Er=>this.expirations.set(Er.target,Er)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=Er=>{try{const kr=this.formatTarget(Er);return typeof this.getExpiration(kr)<"u"}catch{return!1}},this.set=(Er,kr)=>{this.isInitialized();const jr=this.formatTarget(Er),Br={target:jr,expiry:kr};this.expirations.set(jr,Br),this.checkExpiry(jr,Br),this.events.emit(v$4.created,{target:jr,expiration:Br})},this.get=Er=>{this.isInitialized();const kr=this.formatTarget(Er);return this.getExpiration(kr)},this.del=Er=>{if(this.isInitialized(),this.has(Er)){const kr=this.formatTarget(Er),jr=this.getExpiration(kr);this.expirations.delete(kr),this.events.emit(v$4.deleted,{target:kr,expiration:jr})}},this.on=(Er,kr)=>{this.events.on(Er,kr)},this.once=(Er,kr)=>{this.events.once(Er,kr)},this.off=(Er,kr)=>{this.events.off(Er,kr)},this.removeListener=(Er,kr)=>{this.events.removeListener(Er,kr)},this.logger=E$4(wr,this.name)}get context(){return y$4(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(br){if(typeof br=="string")return lt$1(br);if(typeof br=="number")return dt$1(br);const{message:wr}=N$2("UNKNOWN_TYPE",`Target type: ${typeof br}`);throw new Error(wr)}async setExpirations(br){await this.core.storage.setItem(this.storageKey,br)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(v$4.sync)}async restore(){try{const br=await this.getExpirations();if(typeof br>"u"||!br.length)return;if(this.expirations.size){const{message:wr}=N$2("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(wr),new Error(wr)}this.cached=br,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(br){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(br)}}getExpiration(br){const wr=this.expirations.get(br);if(!wr){const{message:Er}=N$2("NO_MATCHING_KEY",`${this.name}: ${br}`);throw this.logger.error(Er),new Error(Er)}return wr}checkExpiry(br,wr){const{expiry:Er}=wr;cjs$4.toMiliseconds(Er)-Date.now()<=0&&this.expire(br,wr)}expire(br,wr){this.expirations.delete(br),this.events.emit(v$4.expired,{target:br,expiration:wr})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((br,wr)=>this.checkExpiry(wr,br))}registerEventListeners(){this.core.heartbeat.on(cjs$1.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(v$4.created,br=>{const wr=v$4.created;this.logger.info(`Emitting ${wr}`),this.logger.debug({type:"event",event:wr,data:br}),this.persist()}),this.events.on(v$4.expired,br=>{const wr=v$4.expired;this.logger.info(`Emitting ${wr}`),this.logger.debug({type:"event",event:wr,data:br}),this.persist()}),this.events.on(v$4.deleted,br=>{const wr=v$4.deleted;this.logger.info(`Emitting ${wr}`),this.logger.debug({type:"event",event:wr,data:br}),this.persist()})}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}}class jt extends y$3{constructor(br,wr){super(br,wr),this.projectId=br,this.logger=wr,this.name=Z,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async Er=>{if(this.verifyDisabled||$$3()||!D$5())return;const kr=this.getVerifyUrl(Er==null?void 0:Er.verifyUrl);this.verifyUrl!==kr&&this.removeIframe(),this.verifyUrl=kr;try{await this.createIframe()}catch(jr){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(jr)}if(!this.initialized){this.removeIframe(),this.verifyUrl=ee$1;try{await this.createIframe()}catch(jr){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(jr),this.verifyDisabled=!0}}},this.register=async Er=>{this.initialized?this.sendPost(Er.attestationId):(this.addToQueue(Er.attestationId),await this.init())},this.resolve=async Er=>{if(this.isDevEnv)return"";const kr=this.getVerifyUrl(Er==null?void 0:Er.verifyUrl);let jr;try{jr=await this.fetchAttestation(Er.attestationId,kr)}catch(Br){this.logger.info(`failed to resolve attestation: ${Er.attestationId} from url: ${kr}`),this.logger.info(Br),jr=await this.fetchAttestation(Er.attestationId,ee$1)}return jr},this.fetchAttestation=async(Er,kr)=>{this.logger.info(`resolving attestation: ${Er} from url: ${kr}`);const jr=this.startAbortTimer(cjs$4.ONE_SECOND*2),Br=await fetch(`${kr}/attestation/${Er}`,{signal:this.abortController.signal});return clearTimeout(jr),Br.status===200?await Br.json():void 0},this.addToQueue=Er=>{this.queue.push(Er)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(Er=>this.sendPost(Er)),this.queue=[])},this.sendPost=Er=>{var kr;try{if(!this.iframe)return;(kr=this.iframe.contentWindow)==null||kr.postMessage(Er,"*"),this.logger.info(`postMessage sent: ${Er} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let Er;const kr=jr=>{jr.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",kr),Er())};await Promise.race([new Promise(jr=>{if(document.getElementById(Z))return jr();window.addEventListener("message",kr);const Br=document.createElement("iframe");Br.id=Z,Br.src=`${this.verifyUrl}/${this.projectId}`,Br.style.display="none",document.body.append(Br),this.iframe=Br,Er=jr}),new Promise((jr,Br)=>setTimeout(()=>{window.removeEventListener("message",kr),Br("verify iframe load timeout")},cjs$4.toMiliseconds(cjs$4.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=Er=>{let kr=Er||F$3;return _t.includes(kr)||(this.logger.info(`verify url: ${kr}, not included in trusted list, assigning default: ${F$3}`),kr=F$3),kr},this.logger=E$4(wr,this.name),this.verifyUrl=F$3,this.abortController=new AbortController,this.isDevEnv=te$1()&&define_process_env_default$2.IS_VITEST}get context(){return y$4(this.logger)}startAbortTimer(br){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),cjs$4.toMiliseconds(br))}}class Gt extends v$5{constructor(br,wr){super(br,wr),this.projectId=br,this.logger=wr,this.context=Tt,this.registerDeviceToken=async Er=>{const{clientId:kr,token:jr,notificationType:Br,enableEncrypted:Wr=!1}=Er,qr=`${St}/${this.projectId}/clients`;await Yi(qr,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:kr,type:Br,token:jr,always_raw:Wr})})},this.logger=E$4(wr,this.context)}}var Lr=Object.defineProperty,Yt=Object.getOwnPropertySymbols,$r=Object.prototype.hasOwnProperty,Fr=Object.prototype.propertyIsEnumerable,Ht=(fr,br,wr)=>br in fr?Lr(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,Jt=(fr,br)=>{for(var wr in br||(br={}))$r.call(br,wr)&&Ht(fr,wr,br[wr]);if(Yt)for(var wr of Yt(br))Fr.call(br,wr)&&Ht(fr,wr,br[wr]);return fr};class te extends n$2{constructor(br){super(br),this.protocol=le$1,this.version=We,this.name=Q$2,this.events=new eventsExports.EventEmitter,this.initialized=!1,this.on=(Er,kr)=>this.events.on(Er,kr),this.once=(Er,kr)=>this.events.once(Er,kr),this.off=(Er,kr)=>this.events.off(Er,kr),this.removeListener=(Er,kr)=>this.events.removeListener(Er,kr),this.projectId=br==null?void 0:br.projectId,this.relayUrl=(br==null?void 0:br.relayUrl)||ge$2,this.customStoragePrefix=br!=null&&br.customStoragePrefix?`:${br.customStoragePrefix}`:"";const wr=typeof(br==null?void 0:br.logger)<"u"&&typeof(br==null?void 0:br.logger)!="string"?br.logger:Hg(k$4({level:(br==null?void 0:br.logger)||Qe.logger}));this.logger=E$4(wr,this.name),this.heartbeat=new cjs$1.HeartBeat,this.crypto=new xt(this,this.logger,br==null?void 0:br.keychain),this.history=new Vt(this,this.logger),this.expirer=new qt(this,this.logger),this.storage=br!=null&&br.storage?br.storage:new h$4(Jt(Jt({},Ze),br==null?void 0:br.storageOptions)),this.relayer=new $t({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Bt(this,this.logger),this.verify=new jt(this.projectId||"",this.logger),this.echoClient=new Gt(this.projectId||"",this.logger)}static async init(br){const wr=new te(br);await wr.initialize();const Er=await wr.crypto.getClientId();return await wr.storage.setItem(yt,Er),wr}get context(){return y$4(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(br){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,br),this.logger.error(br.message),br}}}const Mr=te,J="wc",F$2=2,X="client",G$1=`${J}@${F$2}:${X}:`,M$2={name:X,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},H$1="WALLETCONNECT_DEEPLINK_CHOICE",oe$1="proposal",ae="Proposal expired",ce="session",L$3=cjs$4.SEVEN_DAYS,le="engine",R={wc_sessionPropose:{req:{ttl:cjs$4.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1104},res:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1106},res:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:cjs$4.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:cjs$4.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1112},res:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:cjs$4.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:cjs$4.THIRTY_SECONDS,prompt:!1,tag:1115}}},U$2={min:cjs$4.FIVE_MINUTES,max:cjs$4.SEVEN_DAYS},I$1={idle:"IDLE",active:"ACTIVE"},pe="request",he=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var as=Object.defineProperty,cs=Object.defineProperties,ls=Object.getOwnPropertyDescriptors,de=Object.getOwnPropertySymbols,ps=Object.prototype.hasOwnProperty,hs=Object.prototype.propertyIsEnumerable,ue=(fr,br,wr)=>br in fr?as(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,g$4=(fr,br)=>{for(var wr in br||(br={}))ps.call(br,wr)&&ue(fr,wr,br[wr]);if(de)for(var wr of de(br))hs.call(br,wr)&&ue(fr,wr,br[wr]);return fr},D$3=(fr,br)=>cs(fr,ls(br));class ds extends w$6{constructor(br){super(br),this.name=le,this.events=new Ug,this.initialized=!1,this.ignoredPayloadTypes=[_$3],this.requestQueue={state:I$1.idle,queue:[]},this.sessionRequestQueue={state:I$1.idle,queue:[]},this.requestQueueDelay=cjs$4.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(R)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},cjs$4.toMiliseconds(this.requestQueueDelay)))},this.connect=async wr=>{await this.isInitialized();const Er=D$3(g$4({},wr),{requiredNamespaces:wr.requiredNamespaces||{},optionalNamespaces:wr.optionalNamespaces||{}});await this.isValidConnect(Er);const{pairingTopic:kr,requiredNamespaces:jr,optionalNamespaces:Br,sessionProperties:Wr,relays:qr}=Er;let Gr=kr,Vr,Zr=!1;if(Gr&&(Zr=this.client.core.pairing.pairings.get(Gr).active),!Gr||!Zr){const{topic:eo,uri:ro}=await this.client.core.pairing.create();Gr=eo,Vr=ro}const Jr=await this.client.core.crypto.generateKeyPair(),Qr=R.wc_sessionPropose.req.ttl||cjs$4.FIVE_MINUTES,_n=pt$1(Qr),En=g$4({requiredNamespaces:jr,optionalNamespaces:Br,relays:qr??[{protocol:ht}],proposer:{publicKey:Jr,metadata:this.client.metadata},expiryTimestamp:_n},Wr&&{sessionProperties:Wr}),{reject:Cn,resolve:In,done:An}=at$1(Qr,ae);if(this.events.once(yt$1("session_connect"),async({error:eo,session:ro})=>{if(eo)Cn(eo);else if(ro){ro.self.publicKey=Jr;const to=D$3(g$4({},ro),{requiredNamespaces:En.requiredNamespaces,optionalNamespaces:En.optionalNamespaces});await this.client.session.set(ro.topic,to),await this.setExpiry(ro.topic,ro.expiry),Gr&&await this.client.core.pairing.updateMetadata({topic:Gr,metadata:ro.peer.metadata}),In(to)}}),!Gr){const{message:eo}=N$2("NO_MATCHING_KEY",`connect() pairing topic: ${Gr}`);throw new Error(eo)}const jn=await this.sendRequest({topic:Gr,method:"wc_sessionPropose",params:En,throwOnFailedPublish:!0});return await this.setProposal(jn,g$4({id:jn},En)),{uri:Vr,approval:An}},this.pair=async wr=>(await this.isInitialized(),await this.client.core.pairing.pair(wr)),this.approve=async wr=>{await this.isInitialized(),await this.isValidApprove(wr);const{id:Er,relayProtocol:kr,namespaces:jr,sessionProperties:Br}=wr,Wr=this.client.proposal.get(Er);let{pairingTopic:qr,proposer:Gr,requiredNamespaces:Vr,optionalNamespaces:Zr}=Wr;qr=qr||"";const Jr=await this.client.core.crypto.generateKeyPair(),Qr=Gr.publicKey,_n=await this.client.core.crypto.generateSharedKey(Jr,Qr);qr&&Er&&(await this.client.core.pairing.updateMetadata({topic:qr,metadata:Gr.metadata}),await this.sendResult({id:Er,topic:qr,result:{relay:{protocol:kr??"irn"},responderPublicKey:Jr}}),await this.client.proposal.delete(Er,U$3("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:qr}));const En=g$4({relay:{protocol:kr??"irn"},namespaces:jr,pairingTopic:qr,controller:{publicKey:Jr,metadata:this.client.metadata},expiry:pt$1(L$3)},Br&&{sessionProperties:Br});await this.client.core.relayer.subscribe(_n);const Cn=D$3(g$4({},En),{topic:_n,requiredNamespaces:Vr,optionalNamespaces:Zr,pairingTopic:qr,acknowledged:!1,self:En.controller,peer:{publicKey:Gr.publicKey,metadata:Gr.metadata},controller:Jr});await this.client.session.set(_n,Cn);try{await this.sendRequest({topic:_n,method:"wc_sessionSettle",params:En,throwOnFailedPublish:!0})}catch(In){throw this.client.logger.error(In),this.client.session.delete(_n,U$3("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(_n),In}return await this.setExpiry(_n,pt$1(L$3)),{topic:_n,acknowledged:()=>new Promise(In=>setTimeout(()=>In(this.client.session.get(_n)),500))}},this.reject=async wr=>{await this.isInitialized(),await this.isValidReject(wr);const{id:Er,reason:kr}=wr,{pairingTopic:jr}=this.client.proposal.get(Er);jr&&(await this.sendError(Er,jr,kr),await this.client.proposal.delete(Er,U$3("USER_DISCONNECTED")))},this.update=async wr=>{await this.isInitialized(),await this.isValidUpdate(wr);const{topic:Er,namespaces:kr}=wr,jr=await this.sendRequest({topic:Er,method:"wc_sessionUpdate",params:{namespaces:kr}}),{done:Br,resolve:Wr,reject:qr}=at$1();return this.events.once(yt$1("session_update",jr),({error:Gr})=>{Gr?qr(Gr):Wr()}),await this.client.session.update(Er,{namespaces:kr}),{acknowledged:Br}},this.extend=async wr=>{await this.isInitialized(),await this.isValidExtend(wr);const{topic:Er}=wr,kr=await this.sendRequest({topic:Er,method:"wc_sessionExtend",params:{}}),{done:jr,resolve:Br,reject:Wr}=at$1();return this.events.once(yt$1("session_extend",kr),({error:qr})=>{qr?Wr(qr):Br()}),await this.setExpiry(Er,pt$1(L$3)),{acknowledged:jr}},this.request=async wr=>{await this.isInitialized(),await this.isValidRequest(wr);const{chainId:Er,request:kr,topic:jr,expiry:Br=R.wc_sessionRequest.req.ttl}=wr,Wr=payloadId(),{done:qr,resolve:Gr,reject:Vr}=at$1(Br,"Request expired. Please try again.");return this.events.once(yt$1("session_request",Wr),({error:Zr,result:Jr})=>{Zr?Vr(Zr):Gr(Jr)}),await Promise.all([new Promise(async Zr=>{await this.sendRequest({clientRpcId:Wr,topic:jr,method:"wc_sessionRequest",params:{request:D$3(g$4({},kr),{expiryTimestamp:pt$1(Br)}),chainId:Er},expiry:Br,throwOnFailedPublish:!0}).catch(Jr=>Vr(Jr)),this.client.events.emit("session_request_sent",{topic:jr,request:kr,chainId:Er,id:Wr}),Zr()}),new Promise(async Zr=>{const Jr=await ht$1(this.client.core.storage,H$1);gt$1({id:Wr,topic:jr,wcDeepLink:Jr}),Zr()}),qr()]).then(Zr=>Zr[2])},this.respond=async wr=>{await this.isInitialized(),await this.isValidRespond(wr);const{topic:Er,response:kr}=wr,{id:jr}=kr;isJsonRpcResult(kr)?await this.sendResult({id:jr,topic:Er,result:kr.result,throwOnFailedPublish:!0}):isJsonRpcError(kr)&&await this.sendError(jr,Er,kr.error),this.cleanupAfterResponse(wr)},this.ping=async wr=>{await this.isInitialized(),await this.isValidPing(wr);const{topic:Er}=wr;if(this.client.session.keys.includes(Er)){const kr=await this.sendRequest({topic:Er,method:"wc_sessionPing",params:{}}),{done:jr,resolve:Br,reject:Wr}=at$1();this.events.once(yt$1("session_ping",kr),({error:qr})=>{qr?Wr(qr):Br()}),await jr()}else this.client.core.pairing.pairings.keys.includes(Er)&&await this.client.core.pairing.ping({topic:Er})},this.emit=async wr=>{await this.isInitialized(),await this.isValidEmit(wr);const{topic:Er,event:kr,chainId:jr}=wr;await this.sendRequest({topic:Er,method:"wc_sessionEvent",params:{event:kr,chainId:jr}})},this.disconnect=async wr=>{await this.isInitialized(),await this.isValidDisconnect(wr);const{topic:Er}=wr;if(this.client.session.keys.includes(Er))await this.sendRequest({topic:Er,method:"wc_sessionDelete",params:U$3("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:Er,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(Er))await this.client.core.pairing.disconnect({topic:Er});else{const{message:kr}=N$2("MISMATCHED_TOPIC",`Session or pairing topic not found: ${Er}`);throw new Error(kr)}},this.find=wr=>(this.isInitialized(),this.client.session.getAll().filter(Er=>Mt$1(Er,wr))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.cleanupDuplicatePairings=async wr=>{if(wr.pairingTopic)try{const Er=this.client.core.pairing.pairings.get(wr.pairingTopic),kr=this.client.core.pairing.pairings.getAll().filter(jr=>{var Br,Wr;return((Br=jr.peerMetadata)==null?void 0:Br.url)&&((Wr=jr.peerMetadata)==null?void 0:Wr.url)===wr.peer.metadata.url&&jr.topic&&jr.topic!==Er.topic});if(kr.length===0)return;this.client.logger.info(`Cleaning up ${kr.length} duplicate pairing(s)`),await Promise.all(kr.map(jr=>this.client.core.pairing.disconnect({topic:jr.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(Er){this.client.logger.error(Er)}},this.deleteSession=async wr=>{const{topic:Er,expirerHasDeleted:kr=!1,emitEvent:jr=!0,id:Br=0}=wr,{self:Wr}=this.client.session.get(Er);await this.client.core.relayer.unsubscribe(Er),await this.client.session.delete(Er,U$3("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(Wr.publicKey)&&await this.client.core.crypto.deleteKeyPair(Wr.publicKey),this.client.core.crypto.keychain.has(Er)&&await this.client.core.crypto.deleteSymKey(Er),kr||this.client.core.expirer.del(Er),this.client.core.storage.removeItem(H$1).catch(qr=>this.client.logger.warn(qr)),this.getPendingSessionRequests().forEach(qr=>{qr.topic===Er&&this.deletePendingSessionRequest(qr.id,U$3("USER_DISCONNECTED"))}),jr&&this.client.events.emit("session_delete",{id:Br,topic:Er})},this.deleteProposal=async(wr,Er)=>{await Promise.all([this.client.proposal.delete(wr,U$3("USER_DISCONNECTED")),Er?Promise.resolve():this.client.core.expirer.del(wr)])},this.deletePendingSessionRequest=async(wr,Er,kr=!1)=>{await Promise.all([this.client.pendingRequest.delete(wr,Er),kr?Promise.resolve():this.client.core.expirer.del(wr)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(jr=>jr.id!==wr),kr&&(this.sessionRequestQueue.state=I$1.idle,this.client.events.emit("session_request_expire",{id:wr}))},this.setExpiry=async(wr,Er)=>{this.client.session.keys.includes(wr)&&await this.client.session.update(wr,{expiry:Er}),this.client.core.expirer.set(wr,Er)},this.setProposal=async(wr,Er)=>{await this.client.proposal.set(wr,Er),this.client.core.expirer.set(wr,pt$1(R.wc_sessionPropose.req.ttl))},this.setPendingSessionRequest=async wr=>{const{id:Er,topic:kr,params:jr,verifyContext:Br}=wr,Wr=jr.request.expiryTimestamp||pt$1(R.wc_sessionRequest.req.ttl);await this.client.pendingRequest.set(Er,{id:Er,topic:kr,params:jr,verifyContext:Br}),Wr&&this.client.core.expirer.set(Er,Wr)},this.sendRequest=async wr=>{const{topic:Er,method:kr,params:jr,expiry:Br,relayRpcId:Wr,clientRpcId:qr,throwOnFailedPublish:Gr}=wr,Vr=formatJsonRpcRequest(kr,jr,qr);if(D$5()&&he.includes(kr)){const Qr=Ln(JSON.stringify(Vr));this.client.core.verify.register({attestationId:Qr})}const Zr=await this.client.core.crypto.encode(Er,Vr),Jr=R[kr].req;return Br&&(Jr.ttl=Br),Wr&&(Jr.id=Wr),this.client.core.history.set(Er,Vr),Gr?(Jr.internal=D$3(g$4({},Jr.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(Er,Zr,Jr)):this.client.core.relayer.publish(Er,Zr,Jr).catch(Qr=>this.client.logger.error(Qr)),Vr.id},this.sendResult=async wr=>{const{id:Er,topic:kr,result:jr,throwOnFailedPublish:Br}=wr,Wr=formatJsonRpcResult(Er,jr),qr=await this.client.core.crypto.encode(kr,Wr),Gr=await this.client.core.history.get(kr,Er),Vr=R[Gr.request.method].res;Br?(Vr.internal=D$3(g$4({},Vr.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(kr,qr,Vr)):this.client.core.relayer.publish(kr,qr,Vr).catch(Zr=>this.client.logger.error(Zr)),await this.client.core.history.resolve(Wr)},this.sendError=async(wr,Er,kr)=>{const jr=formatJsonRpcError(wr,kr),Br=await this.client.core.crypto.encode(Er,jr),Wr=await this.client.core.history.get(Er,wr),qr=R[Wr.request.method].res;this.client.core.relayer.publish(Er,Br,qr),await this.client.core.history.resolve(jr)},this.cleanup=async()=>{const wr=[],Er=[];this.client.session.getAll().forEach(kr=>{let jr=!1;mt$1(kr.expiry)&&(jr=!0),this.client.core.crypto.keychain.has(kr.topic)||(jr=!0),jr&&wr.push(kr.topic)}),this.client.proposal.getAll().forEach(kr=>{mt$1(kr.expiryTimestamp)&&Er.push(kr.id)}),await Promise.all([...wr.map(kr=>this.deleteSession({topic:kr})),...Er.map(kr=>this.deleteProposal(kr))])},this.onRelayEventRequest=async wr=>{this.requestQueue.queue.push(wr),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===I$1.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=I$1.active;const wr=this.requestQueue.queue.shift();if(wr)try{this.processRequest(wr),await new Promise(Er=>setTimeout(Er,300))}catch(Er){this.client.logger.warn(Er)}}this.requestQueue.state=I$1.idle},this.processRequest=wr=>{const{topic:Er,payload:kr}=wr,jr=kr.method;switch(jr){case"wc_sessionPropose":return this.onSessionProposeRequest(Er,kr);case"wc_sessionSettle":return this.onSessionSettleRequest(Er,kr);case"wc_sessionUpdate":return this.onSessionUpdateRequest(Er,kr);case"wc_sessionExtend":return this.onSessionExtendRequest(Er,kr);case"wc_sessionPing":return this.onSessionPingRequest(Er,kr);case"wc_sessionDelete":return this.onSessionDeleteRequest(Er,kr);case"wc_sessionRequest":return this.onSessionRequest(Er,kr);case"wc_sessionEvent":return this.onSessionEventRequest(Er,kr);default:return this.client.logger.info(`Unsupported request method ${jr}`)}},this.onRelayEventResponse=async wr=>{const{topic:Er,payload:kr}=wr,jr=(await this.client.core.history.get(Er,kr.id)).request.method;switch(jr){case"wc_sessionPropose":return this.onSessionProposeResponse(Er,kr);case"wc_sessionSettle":return this.onSessionSettleResponse(Er,kr);case"wc_sessionUpdate":return this.onSessionUpdateResponse(Er,kr);case"wc_sessionExtend":return this.onSessionExtendResponse(Er,kr);case"wc_sessionPing":return this.onSessionPingResponse(Er,kr);case"wc_sessionRequest":return this.onSessionRequestResponse(Er,kr);default:return this.client.logger.info(`Unsupported response method ${jr}`)}},this.onRelayEventUnknownPayload=wr=>{const{topic:Er}=wr,{message:kr}=N$2("MISSING_OR_INVALID",`Decoded payload on topic ${Er} is not identifiable as a JSON-RPC request or a response.`);throw new Error(kr)},this.onSessionProposeRequest=async(wr,Er)=>{const{params:kr,id:jr}=Er;try{this.isValidConnect(g$4({},Er.params));const Br=kr.expiryTimestamp||pt$1(R.wc_sessionPropose.req.ttl),Wr=g$4({id:jr,pairingTopic:wr,expiryTimestamp:Br},kr);await this.setProposal(jr,Wr);const qr=Ln(JSON.stringify(Er)),Gr=await this.getVerifyContext(qr,Wr.proposer.metadata);this.client.events.emit("session_proposal",{id:jr,params:Wr,verifyContext:Gr})}catch(Br){await this.sendError(jr,wr,Br),this.client.logger.error(Br)}},this.onSessionProposeResponse=async(wr,Er)=>{const{id:kr}=Er;if(isJsonRpcResult(Er)){const{result:jr}=Er;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:jr});const Br=this.client.proposal.get(kr);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:Br});const Wr=Br.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:Wr});const qr=jr.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:qr});const Gr=await this.client.core.crypto.generateSharedKey(Wr,qr);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:Gr});const Vr=await this.client.core.relayer.subscribe(Gr);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:Vr}),await this.client.core.pairing.activate({topic:wr})}else isJsonRpcError(Er)&&(await this.client.proposal.delete(kr,U$3("USER_DISCONNECTED")),this.events.emit(yt$1("session_connect"),{error:Er.error}))},this.onSessionSettleRequest=async(wr,Er)=>{const{id:kr,params:jr}=Er;try{this.isValidSessionSettleRequest(jr);const{relay:Br,controller:Wr,expiry:qr,namespaces:Gr,sessionProperties:Vr,pairingTopic:Zr}=Er.params,Jr=g$4({topic:wr,relay:Br,expiry:qr,namespaces:Gr,acknowledged:!0,pairingTopic:Zr,requiredNamespaces:{},optionalNamespaces:{},controller:Wr.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:Wr.publicKey,metadata:Wr.metadata}},Vr&&{sessionProperties:Vr});await this.sendResult({id:Er.id,topic:wr,result:!0}),this.events.emit(yt$1("session_connect"),{session:Jr}),this.cleanupDuplicatePairings(Jr)}catch(Br){await this.sendError(kr,wr,Br),this.client.logger.error(Br)}},this.onSessionSettleResponse=async(wr,Er)=>{const{id:kr}=Er;isJsonRpcResult(Er)?(await this.client.session.update(wr,{acknowledged:!0}),this.events.emit(yt$1("session_approve",kr),{})):isJsonRpcError(Er)&&(await this.client.session.delete(wr,U$3("USER_DISCONNECTED")),this.events.emit(yt$1("session_approve",kr),{error:Er.error}))},this.onSessionUpdateRequest=async(wr,Er)=>{const{params:kr,id:jr}=Er;try{const Br=`${wr}_session_update`,Wr=sr$1.get(Br);if(Wr&&this.isRequestOutOfSync(Wr,jr)){this.client.logger.info(`Discarding out of sync request - ${jr}`);return}this.isValidUpdate(g$4({topic:wr},kr)),await this.client.session.update(wr,{namespaces:kr.namespaces}),await this.sendResult({id:jr,topic:wr,result:!0}),this.client.events.emit("session_update",{id:jr,topic:wr,params:kr}),sr$1.set(Br,jr)}catch(Br){await this.sendError(jr,wr,Br),this.client.logger.error(Br)}},this.isRequestOutOfSync=(wr,Er)=>parseInt(Er.toString().slice(0,-3))<=parseInt(wr.toString().slice(0,-3)),this.onSessionUpdateResponse=(wr,Er)=>{const{id:kr}=Er;isJsonRpcResult(Er)?this.events.emit(yt$1("session_update",kr),{}):isJsonRpcError(Er)&&this.events.emit(yt$1("session_update",kr),{error:Er.error})},this.onSessionExtendRequest=async(wr,Er)=>{const{id:kr}=Er;try{this.isValidExtend({topic:wr}),await this.setExpiry(wr,pt$1(L$3)),await this.sendResult({id:kr,topic:wr,result:!0}),this.client.events.emit("session_extend",{id:kr,topic:wr})}catch(jr){await this.sendError(kr,wr,jr),this.client.logger.error(jr)}},this.onSessionExtendResponse=(wr,Er)=>{const{id:kr}=Er;isJsonRpcResult(Er)?this.events.emit(yt$1("session_extend",kr),{}):isJsonRpcError(Er)&&this.events.emit(yt$1("session_extend",kr),{error:Er.error})},this.onSessionPingRequest=async(wr,Er)=>{const{id:kr}=Er;try{this.isValidPing({topic:wr}),await this.sendResult({id:kr,topic:wr,result:!0}),this.client.events.emit("session_ping",{id:kr,topic:wr})}catch(jr){await this.sendError(kr,wr,jr),this.client.logger.error(jr)}},this.onSessionPingResponse=(wr,Er)=>{const{id:kr}=Er;setTimeout(()=>{isJsonRpcResult(Er)?this.events.emit(yt$1("session_ping",kr),{}):isJsonRpcError(Er)&&this.events.emit(yt$1("session_ping",kr),{error:Er.error})},500)},this.onSessionDeleteRequest=async(wr,Er)=>{const{id:kr}=Er;try{this.isValidDisconnect({topic:wr,reason:Er.params}),await Promise.all([new Promise(jr=>{this.client.core.relayer.once(D$4.publish,async()=>{jr(await this.deleteSession({topic:wr,id:kr}))})}),this.sendResult({id:kr,topic:wr,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:wr,error:U$3("USER_DISCONNECTED")})])}catch(jr){this.client.logger.error(jr)}},this.onSessionRequest=async(wr,Er)=>{const{id:kr,params:jr}=Er;try{this.isValidRequest(g$4({topic:wr},jr));const Br=Ln(JSON.stringify(formatJsonRpcRequest("wc_sessionRequest",jr,kr))),Wr=this.client.session.get(wr),qr=await this.getVerifyContext(Br,Wr.peer.metadata),Gr={id:kr,topic:wr,params:jr,verifyContext:qr};await this.setPendingSessionRequest(Gr),this.addSessionRequestToSessionRequestQueue(Gr),this.processSessionRequestQueue()}catch(Br){await this.sendError(kr,wr,Br),this.client.logger.error(Br)}},this.onSessionRequestResponse=(wr,Er)=>{const{id:kr}=Er;isJsonRpcResult(Er)?this.events.emit(yt$1("session_request",kr),{result:Er.result}):isJsonRpcError(Er)&&this.events.emit(yt$1("session_request",kr),{error:Er.error})},this.onSessionEventRequest=async(wr,Er)=>{const{id:kr,params:jr}=Er;try{const Br=`${wr}_session_event_${jr.event.name}`,Wr=sr$1.get(Br);if(Wr&&this.isRequestOutOfSync(Wr,kr)){this.client.logger.info(`Discarding out of sync request - ${kr}`);return}this.isValidEmit(g$4({topic:wr},jr)),this.client.events.emit("session_event",{id:kr,topic:wr,params:jr}),sr$1.set(Br,kr)}catch(Br){await this.sendError(kr,wr,Br),this.client.logger.error(Br)}},this.addSessionRequestToSessionRequestQueue=wr=>{this.sessionRequestQueue.queue.push(wr)},this.cleanupAfterResponse=wr=>{this.deletePendingSessionRequest(wr.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=I$1.idle,this.processSessionRequestQueue()},cjs$4.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:wr,error:Er})=>{const kr=this.client.core.history.pending;kr.length>0&&kr.filter(jr=>jr.topic===wr&&jr.request.method==="wc_sessionRequest").forEach(jr=>{this.events.emit(yt$1("session_request",jr.request.id),{error:Er})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===I$1.active){this.client.logger.info("session request queue is already active.");return}const wr=this.sessionRequestQueue.queue[0];if(!wr){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=I$1.active,this.client.events.emit("session_request",wr)}catch(Er){this.client.logger.error(Er)}},this.onPairingCreated=wr=>{if(wr.active)return;const Er=this.client.proposal.getAll().find(kr=>kr.pairingTopic===wr.topic);Er&&this.onSessionProposeRequest(wr.topic,formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:Er.requiredNamespaces,optionalNamespaces:Er.optionalNamespaces,relays:Er.relays,proposer:Er.proposer,sessionProperties:Er.sessionProperties},Er.id))},this.isValidConnect=async wr=>{if(!Gt$1(wr)){const{message:qr}=N$2("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(wr)}`);throw new Error(qr)}const{pairingTopic:Er,requiredNamespaces:kr,optionalNamespaces:jr,sessionProperties:Br,relays:Wr}=wr;if(w$5(Er)||await this.isValidPairingTopic(Er),!qt$1(Wr)){const{message:qr}=N$2("MISSING_OR_INVALID",`connect() relays: ${Wr}`);throw new Error(qr)}!w$5(kr)&&B$4(kr)!==0&&this.validateNamespaces(kr,"requiredNamespaces"),!w$5(jr)&&B$4(jr)!==0&&this.validateNamespaces(jr,"optionalNamespaces"),w$5(Br)||this.validateSessionProps(Br,"sessionProperties")},this.validateNamespaces=(wr,Er)=>{const kr=Ht$1(wr,"connect()",Er);if(kr)throw new Error(kr.message)},this.isValidApprove=async wr=>{if(!Gt$1(wr))throw new Error(N$2("MISSING_OR_INVALID",`approve() params: ${wr}`).message);const{id:Er,namespaces:kr,relayProtocol:jr,sessionProperties:Br}=wr;await this.isValidProposalId(Er);const Wr=this.client.proposal.get(Er),qr=ln(kr,"approve()");if(qr)throw new Error(qr.message);const Gr=fn(Wr.requiredNamespaces,kr,"approve()");if(Gr)throw new Error(Gr.message);if(!g$6(jr,!0)){const{message:Vr}=N$2("MISSING_OR_INVALID",`approve() relayProtocol: ${jr}`);throw new Error(Vr)}w$5(Br)||this.validateSessionProps(Br,"sessionProperties")},this.isValidReject=async wr=>{if(!Gt$1(wr)){const{message:jr}=N$2("MISSING_OR_INVALID",`reject() params: ${wr}`);throw new Error(jr)}const{id:Er,reason:kr}=wr;if(await this.isValidProposalId(Er),!Wt(kr)){const{message:jr}=N$2("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(kr)}`);throw new Error(jr)}},this.isValidSessionSettleRequest=wr=>{if(!Gt$1(wr)){const{message:Gr}=N$2("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${wr}`);throw new Error(Gr)}const{relay:Er,controller:kr,namespaces:jr,expiry:Br}=wr;if(!dn(Er)){const{message:Gr}=N$2("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(Gr)}const Wr=Ft$1(kr,"onSessionSettleRequest()");if(Wr)throw new Error(Wr.message);const qr=ln(jr,"onSessionSettleRequest()");if(qr)throw new Error(qr.message);if(mt$1(Br)){const{message:Gr}=N$2("EXPIRED","onSessionSettleRequest()");throw new Error(Gr)}},this.isValidUpdate=async wr=>{if(!Gt$1(wr)){const{message:qr}=N$2("MISSING_OR_INVALID",`update() params: ${wr}`);throw new Error(qr)}const{topic:Er,namespaces:kr}=wr;await this.isValidSessionTopic(Er);const jr=this.client.session.get(Er),Br=ln(kr,"update()");if(Br)throw new Error(Br.message);const Wr=fn(jr.requiredNamespaces,kr,"update()");if(Wr)throw new Error(Wr.message)},this.isValidExtend=async wr=>{if(!Gt$1(wr)){const{message:kr}=N$2("MISSING_OR_INVALID",`extend() params: ${wr}`);throw new Error(kr)}const{topic:Er}=wr;await this.isValidSessionTopic(Er)},this.isValidRequest=async wr=>{if(!Gt$1(wr)){const{message:qr}=N$2("MISSING_OR_INVALID",`request() params: ${wr}`);throw new Error(qr)}const{topic:Er,request:kr,chainId:jr,expiry:Br}=wr;await this.isValidSessionTopic(Er);const{namespaces:Wr}=this.client.session.get(Er);if(!Qt(Wr,jr)){const{message:qr}=N$2("MISSING_OR_INVALID",`request() chainId: ${jr}`);throw new Error(qr)}if(!zt$1(kr)){const{message:qr}=N$2("MISSING_OR_INVALID",`request() ${JSON.stringify(kr)}`);throw new Error(qr)}if(!Zt(Wr,jr,kr.method)){const{message:qr}=N$2("MISSING_OR_INVALID",`request() method: ${kr.method}`);throw new Error(qr)}if(Br&&!tr$1(Br,U$2)){const{message:qr}=N$2("MISSING_OR_INVALID",`request() expiry: ${Br}. Expiry must be a number (in seconds) between ${U$2.min} and ${U$2.max}`);throw new Error(qr)}},this.isValidRespond=async wr=>{var Er;if(!Gt$1(wr)){const{message:Br}=N$2("MISSING_OR_INVALID",`respond() params: ${wr}`);throw new Error(Br)}const{topic:kr,response:jr}=wr;try{await this.isValidSessionTopic(kr)}catch(Br){throw(Er=wr==null?void 0:wr.response)!=null&&Er.id&&this.cleanupAfterResponse(wr),Br}if(!Yt$1(jr)){const{message:Br}=N$2("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(jr)}`);throw new Error(Br)}},this.isValidPing=async wr=>{if(!Gt$1(wr)){const{message:kr}=N$2("MISSING_OR_INVALID",`ping() params: ${wr}`);throw new Error(kr)}const{topic:Er}=wr;await this.isValidSessionOrPairingTopic(Er)},this.isValidEmit=async wr=>{if(!Gt$1(wr)){const{message:Wr}=N$2("MISSING_OR_INVALID",`emit() params: ${wr}`);throw new Error(Wr)}const{topic:Er,event:kr,chainId:jr}=wr;await this.isValidSessionTopic(Er);const{namespaces:Br}=this.client.session.get(Er);if(!Qt(Br,jr)){const{message:Wr}=N$2("MISSING_OR_INVALID",`emit() chainId: ${jr}`);throw new Error(Wr)}if(!Jt$1(kr)){const{message:Wr}=N$2("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(kr)}`);throw new Error(Wr)}if(!Xt(Br,jr,kr.name)){const{message:Wr}=N$2("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(kr)}`);throw new Error(Wr)}},this.isValidDisconnect=async wr=>{if(!Gt$1(wr)){const{message:kr}=N$2("MISSING_OR_INVALID",`disconnect() params: ${wr}`);throw new Error(kr)}const{topic:Er}=wr;await this.isValidSessionOrPairingTopic(Er)},this.getVerifyContext=async(wr,Er)=>{const kr={verified:{verifyUrl:Er.verifyUrl||F$3,validation:"UNKNOWN",origin:Er.url||""}};try{const jr=await this.client.core.verify.resolve({attestationId:wr,verifyUrl:Er.verifyUrl});jr&&(kr.verified.origin=jr.origin,kr.verified.isScam=jr.isScam,kr.verified.validation=jr.origin===new URL(Er.url).origin?"VALID":"INVALID")}catch(jr){this.client.logger.info(jr)}return this.client.logger.info(`Verify context: ${JSON.stringify(kr)}`),kr},this.validateSessionProps=(wr,Er)=>{Object.values(wr).forEach(kr=>{if(!g$6(kr,!1)){const{message:jr}=N$2("MISSING_OR_INVALID",`${Er} must be in Record format. Received: ${JSON.stringify(kr)}`);throw new Error(jr)}})}}async isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(D$4.message,async br=>{const{topic:wr,message:Er}=br;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(Er)))return;const kr=await this.client.core.crypto.decode(wr,Er);try{isJsonRpcRequest(kr)?(this.client.core.history.set(wr,kr),this.onRelayEventRequest({topic:wr,payload:kr})):isJsonRpcResponse(kr)?(await this.client.core.history.resolve(kr),await this.onRelayEventResponse({topic:wr,payload:kr}),this.client.core.history.delete(wr,kr.id)):this.onRelayEventUnknownPayload({topic:wr,payload:kr})}catch(jr){this.client.logger.error(jr)}})}registerExpirerEvents(){this.client.core.expirer.on(v$4.expired,async br=>{const{topic:wr,id:Er}=ft$2(br.target);if(Er&&this.client.pendingRequest.keys.includes(Er))return await this.deletePendingSessionRequest(Er,N$2("EXPIRED"),!0);wr?this.client.session.keys.includes(wr)&&(await this.deleteSession({topic:wr,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:wr})):Er&&(await this.deleteProposal(Er,!0),this.client.events.emit("proposal_expire",{id:Er}))})}registerPairingEvents(){this.client.core.pairing.events.on(V$1.create,br=>this.onPairingCreated(br))}isValidPairingTopic(br){if(!g$6(br,!1)){const{message:wr}=N$2("MISSING_OR_INVALID",`pairing topic should be a string: ${br}`);throw new Error(wr)}if(!this.client.core.pairing.pairings.keys.includes(br)){const{message:wr}=N$2("NO_MATCHING_KEY",`pairing topic doesn't exist: ${br}`);throw new Error(wr)}if(mt$1(this.client.core.pairing.pairings.get(br).expiry)){const{message:wr}=N$2("EXPIRED",`pairing topic: ${br}`);throw new Error(wr)}}async isValidSessionTopic(br){if(!g$6(br,!1)){const{message:wr}=N$2("MISSING_OR_INVALID",`session topic should be a string: ${br}`);throw new Error(wr)}if(!this.client.session.keys.includes(br)){const{message:wr}=N$2("NO_MATCHING_KEY",`session topic doesn't exist: ${br}`);throw new Error(wr)}if(mt$1(this.client.session.get(br).expiry)){await this.deleteSession({topic:br});const{message:wr}=N$2("EXPIRED",`session topic: ${br}`);throw new Error(wr)}if(!this.client.core.crypto.keychain.has(br)){const{message:wr}=N$2("MISSING_OR_INVALID",`session topic does not exist in keychain: ${br}`);throw await this.deleteSession({topic:br}),new Error(wr)}}async isValidSessionOrPairingTopic(br){if(this.client.session.keys.includes(br))await this.isValidSessionTopic(br);else if(this.client.core.pairing.pairings.keys.includes(br))this.isValidPairingTopic(br);else if(g$6(br,!1)){const{message:wr}=N$2("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${br}`);throw new Error(wr)}else{const{message:wr}=N$2("MISSING_OR_INVALID",`session or pairing topic should be a string: ${br}`);throw new Error(wr)}}async isValidProposalId(br){if(!Bt$1(br)){const{message:wr}=N$2("MISSING_OR_INVALID",`proposal id should be a number: ${br}`);throw new Error(wr)}if(!this.client.proposal.keys.includes(br)){const{message:wr}=N$2("NO_MATCHING_KEY",`proposal id doesn't exist: ${br}`);throw new Error(wr)}if(mt$1(this.client.proposal.get(br).expiryTimestamp)){await this.deleteProposal(br);const{message:wr}=N$2("EXPIRED",`proposal id: ${br}`);throw new Error(wr)}}}class us extends Kt{constructor(br,wr){super(br,wr,oe$1,G$1),this.core=br,this.logger=wr}}let ge$1=class extends Kt{constructor(br,wr){super(br,wr,ce,G$1),this.core=br,this.logger=wr}};class gs extends Kt{constructor(br,wr){super(br,wr,pe,G$1,Er=>Er.id),this.core=br,this.logger=wr}}let Q$1=class uS extends b$3{constructor(br){super(br),this.protocol=J,this.version=F$2,this.name=M$2.name,this.events=new eventsExports.EventEmitter,this.on=(Er,kr)=>this.events.on(Er,kr),this.once=(Er,kr)=>this.events.once(Er,kr),this.off=(Er,kr)=>this.events.off(Er,kr),this.removeListener=(Er,kr)=>this.events.removeListener(Er,kr),this.removeAllListeners=Er=>this.events.removeAllListeners(Er),this.connect=async Er=>{try{return await this.engine.connect(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.pair=async Er=>{try{return await this.engine.pair(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.approve=async Er=>{try{return await this.engine.approve(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.reject=async Er=>{try{return await this.engine.reject(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.update=async Er=>{try{return await this.engine.update(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.extend=async Er=>{try{return await this.engine.extend(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.request=async Er=>{try{return await this.engine.request(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.respond=async Er=>{try{return await this.engine.respond(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.ping=async Er=>{try{return await this.engine.ping(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.emit=async Er=>{try{return await this.engine.emit(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.disconnect=async Er=>{try{return await this.engine.disconnect(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.find=Er=>{try{return this.engine.find(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(Er){throw this.logger.error(Er.message),Er}},this.name=(br==null?void 0:br.name)||M$2.name,this.metadata=(br==null?void 0:br.metadata)||Qn();const wr=typeof(br==null?void 0:br.logger)<"u"&&typeof(br==null?void 0:br.logger)!="string"?br.logger:Hg(k$4({level:(br==null?void 0:br.logger)||M$2.logger}));this.core=(br==null?void 0:br.core)||new Mr(br),this.logger=E$4(wr,this.name),this.session=new ge$1(this.core,this.logger),this.proposal=new us(this.core,this.logger),this.pendingRequest=new gs(this.core,this.logger),this.engine=new ds(this)}static async init(br){const wr=new uS(br);return await wr.initialize(),wr}get context(){return y$4(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(br){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(br.message),br}}};const K=":";function ve(fr){const[br,wr]=fr.split(K);return{namespace:br,reference:wr}}function S$2(fr=[],br=[]){return[...new Set([...fr,...br])]}function oe(fr){return fr.includes(":")}function en(fr){return oe(fr)?fr.split(":")[0]:fr}const nn={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function U$1(fr,br){const{message:wr,code:Er}=nn[fr];return{message:br?`${wr} ${br}`:wr,code:Er}}function k$2(fr,br){return!!Array.isArray(fr)}function B$2(fr){return Object.getPrototypeOf(fr)===Object.prototype&&Object.keys(fr).length}var P$3=Object.defineProperty,w$2=Object.defineProperties,E$2=Object.getOwnPropertyDescriptors,c$2=Object.getOwnPropertySymbols,L$2=Object.prototype.hasOwnProperty,O$2=Object.prototype.propertyIsEnumerable,l$2=(fr,br,wr)=>br in fr?P$3(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,p$3=(fr,br)=>{for(var wr in br||(br={}))L$2.call(br,wr)&&l$2(fr,wr,br[wr]);if(c$2)for(var wr of c$2(br))O$2.call(br,wr)&&l$2(fr,wr,br[wr]);return fr},v$3=(fr,br)=>w$2(fr,E$2(br));const j$3={Accept:"application/json","Content-Type":"application/json"},T$2="POST",d$2={headers:j$3,method:T$2},g$3=10;let f$4=class{constructor(br,wr=!1){if(this.url=br,this.disableProviderPing=wr,this.events=new eventsExports.EventEmitter,this.isAvailable=!1,this.registering=!1,!isHttpUrl(br))throw new Error(`Provided URL is not compatible with HTTP connection: ${br}`);this.url=br,this.disableProviderPing=wr}get connected(){return this.isAvailable}get connecting(){return this.registering}on(br,wr){this.events.on(br,wr)}once(br,wr){this.events.once(br,wr)}off(br,wr){this.events.off(br,wr)}removeListener(br,wr){this.events.removeListener(br,wr)}async open(br=this.url){await this.register(br)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(br){this.isAvailable||await this.register();try{const wr=safeJsonStringify(br),Er=await(await o$2(this.url,v$3(p$3({},d$2),{body:wr}))).json();this.onPayload({data:Er})}catch(wr){this.onError(br.id,wr)}}async register(br=this.url){if(!isHttpUrl(br))throw new Error(`Provided URL is not compatible with HTTP connection: ${br}`);if(this.registering){const wr=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=wr||this.events.listenerCount("open")>=wr)&&this.events.setMaxListeners(wr+1),new Promise((Er,kr)=>{this.events.once("register_error",jr=>{this.resetMaxListeners(),kr(jr)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return kr(new Error("HTTP connection is missing or invalid"));Er()})})}this.url=br,this.registering=!0;try{if(!this.disableProviderPing){const wr=safeJsonStringify({id:1,jsonrpc:"2.0",method:"test",params:[]});await o$2(br,v$3(p$3({},d$2),{body:wr}))}this.onOpen()}catch(wr){const Er=this.parseError(wr);throw this.events.emit("register_error",Er),this.onClose(),Er}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(br){if(typeof br.data>"u")return;const wr=typeof br.data=="string"?safeJsonParse(br.data):br.data;this.events.emit("payload",wr)}onError(br,wr){const Er=this.parseError(wr),kr=Er.message||Er.toString(),jr=formatJsonRpcError(br,kr);this.events.emit("payload",jr)}parseError(br,wr=this.url){return parseConnectionError(br,wr,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>g$3&&this.events.setMaxListeners(g$3)}};class JsonRpcProvider extends r$3{constructor(br){super(br),this.events=new eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(br),this.connection.connected&&this.registerEventListeners()}async connect(br=this.connection){await this.open(br)}async disconnect(){await this.close()}on(br,wr){this.events.on(br,wr)}once(br,wr){this.events.once(br,wr)}off(br,wr){this.events.off(br,wr)}removeListener(br,wr){this.events.removeListener(br,wr)}async request(br,wr){return this.requestStrict(formatJsonRpcRequest(br.method,br.params||[],br.id||getBigIntRpcId().toString()),wr)}async requestStrict(br,wr){return new Promise(async(Er,kr)=>{if(!this.connection.connected)try{await this.open()}catch(jr){kr(jr)}this.events.on(`${br.id}`,jr=>{isJsonRpcError(jr)?kr(jr.error):Er(jr.result)});try{await this.connection.send(br,wr)}catch(jr){kr(jr)}})}setConnection(br=this.connection){return br}onPayload(br){this.events.emit("payload",br),isJsonRpcResponse(br)?this.events.emit(`${br.id}`,br):this.events.emit("message",{type:br.method,data:br.params})}onClose(br){br&&br.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${br.code} ${br.reason?`(${br.reason})`:""}`)),this.events.emit("disconnect")}async open(br=this.connection){this.connection===br&&this.connection.connected||(this.connection.connected&&this.close(),typeof br=="string"&&(await this.connection.open(br),br=this.connection),this.connection=this.setConnection(br),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",br=>this.onPayload(br)),this.connection.on("close",br=>this.onClose(br)),this.connection.on("error",br=>this.events.emit("error",br)),this.connection.on("register_error",br=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const Ia="error",Fg="wss://relay.walletconnect.com",Mg="wc",qg="universal_provider",xa=`${Mg}@2:${qg}:`,Bg="https://rpc.walletconnect.com/v1/",Vn={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var ge=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global$1<"u"?global$1:typeof self<"u"?self:{},Ui={exports:{}};/** +***************************************************************************** */var extendStatics=function(fr,br){return extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(wr,Er){wr.__proto__=Er}||function(wr,Er){for(var kr in Er)Er.hasOwnProperty(kr)&&(wr[kr]=Er[kr])},extendStatics(fr,br)};function __extends(fr,br){extendStatics(fr,br);function wr(){this.constructor=fr}fr.prototype=br===null?Object.create(br):(wr.prototype=br.prototype,new wr)}var __assign=function(){return __assign=Object.assign||function(br){for(var wr,Er=1,kr=arguments.length;Er=0;Wr--)(Br=fr[Wr])&&(jr=(kr<3?Br(jr):kr>3?Br(br,wr,jr):Br(br,wr))||jr);return kr>3&&jr&&Object.defineProperty(br,wr,jr),jr}function __param(fr,br){return function(wr,Er){br(wr,Er,fr)}}function __metadata(fr,br){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(fr,br)}function __awaiter$5(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,br||[])).next())})}function __generator(fr,br){var wr={label:0,sent:function(){if(jr[0]&1)throw jr[1];return jr[1]},trys:[],ops:[]},Er,kr,jr,Br;return Br={next:Wr(0),throw:Wr(1),return:Wr(2)},typeof Symbol=="function"&&(Br[Symbol.iterator]=function(){return this}),Br;function Wr(Gr){return function(Vr){return qr([Gr,Vr])}}function qr(Gr){if(Er)throw new TypeError("Generator is already executing.");for(;wr;)try{if(Er=1,kr&&(jr=Gr[0]&2?kr.return:Gr[0]?kr.throw||((jr=kr.return)&&jr.call(kr),0):kr.next)&&!(jr=jr.call(kr,Gr[1])).done)return jr;switch(kr=0,jr&&(Gr=[Gr[0]&2,jr.value]),Gr[0]){case 0:case 1:jr=Gr;break;case 4:return wr.label++,{value:Gr[1],done:!1};case 5:wr.label++,kr=Gr[1],Gr=[0];continue;case 7:Gr=wr.ops.pop(),wr.trys.pop();continue;default:if(jr=wr.trys,!(jr=jr.length>0&&jr[jr.length-1])&&(Gr[0]===6||Gr[0]===2)){wr=0;continue}if(Gr[0]===3&&(!jr||Gr[1]>jr[0]&&Gr[1]=fr.length&&(fr=void 0),{value:fr&&fr[Er++],done:!fr}}};throw new TypeError(br?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(fr,br){var wr=typeof Symbol=="function"&&fr[Symbol.iterator];if(!wr)return fr;var Er=wr.call(fr),kr,jr=[],Br;try{for(;(br===void 0||br-- >0)&&!(kr=Er.next()).done;)jr.push(kr.value)}catch(Wr){Br={error:Wr}}finally{try{kr&&!kr.done&&(wr=Er.return)&&wr.call(Er)}finally{if(Br)throw Br.error}}return jr}function __spread(){for(var fr=[],br=0;br1||Wr(Jr,Qr)})})}function Wr(Jr,Qr){try{qr(Er[Jr](Qr))}catch(_n){Zr(jr[0][3],_n)}}function qr(Jr){Jr.value instanceof __await?Promise.resolve(Jr.value.v).then(Gr,Vr):Zr(jr[0][2],Jr)}function Gr(Jr){Wr("next",Jr)}function Vr(Jr){Wr("throw",Jr)}function Zr(Jr,Qr){Jr(Qr),jr.shift(),jr.length&&Wr(jr[0][0],jr[0][1])}}function __asyncDelegator(fr){var br,wr;return br={},Er("next"),Er("throw",function(kr){throw kr}),Er("return"),br[Symbol.iterator]=function(){return this},br;function Er(kr,jr){br[kr]=fr[kr]?function(Br){return(wr=!wr)?{value:__await(fr[kr](Br)),done:kr==="return"}:jr?jr(Br):Br}:jr}}function __asyncValues(fr){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var br=fr[Symbol.asyncIterator],wr;return br?br.call(fr):(fr=typeof __values$1=="function"?__values$1(fr):fr[Symbol.iterator](),wr={},Er("next"),Er("throw"),Er("return"),wr[Symbol.asyncIterator]=function(){return this},wr);function Er(jr){wr[jr]=fr[jr]&&function(Br){return new Promise(function(Wr,qr){Br=fr[jr](Br),kr(Wr,qr,Br.done,Br.value)})}}function kr(jr,Br,Wr,qr){Promise.resolve(qr).then(function(Gr){jr({value:Gr,done:Wr})},Br)}}function __makeTemplateObject(fr,br){return Object.defineProperty?Object.defineProperty(fr,"raw",{value:br}):fr.raw=br,fr}function __importStar$1(fr){if(fr&&fr.__esModule)return fr;var br={};if(fr!=null)for(var wr in fr)Object.hasOwnProperty.call(fr,wr)&&(br[wr]=fr[wr]);return br.default=fr,br}function __importDefault$5(fr){return fr&&fr.__esModule?fr:{default:fr}}function __classPrivateFieldGet$1(fr,br){if(!br.has(fr))throw new TypeError("attempted to get private field on non-instance");return br.get(fr)}function __classPrivateFieldSet$1(fr,br,wr){if(!br.has(fr))throw new TypeError("attempted to set private field on non-instance");return br.set(fr,wr),wr}const tslib_es6=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return __assign},__asyncDelegator,__asyncGenerator,__asyncValues,__await,__awaiter:__awaiter$5,__classPrivateFieldGet:__classPrivateFieldGet$1,__classPrivateFieldSet:__classPrivateFieldSet$1,__createBinding:__createBinding$1,__decorate:__decorate$1,__exportStar,__extends,__generator,__importDefault:__importDefault$5,__importStar:__importStar$1,__makeTemplateObject,__metadata,__param,__read,__rest:__rest$3,__spread,__spreadArrays,__values:__values$1},Symbol.toStringTag,{value:"Module"})),require$$0$4=getAugmentedNamespace(tslib_es6);var crypto$1={},hasRequiredCrypto;function requireCrypto(){if(hasRequiredCrypto)return crypto$1;hasRequiredCrypto=1,Object.defineProperty(crypto$1,"__esModule",{value:!0}),crypto$1.isBrowserCryptoAvailable=crypto$1.getSubtleCrypto=crypto$1.getBrowerCrypto=void 0;function fr(){return(commonjsGlobal==null?void 0:commonjsGlobal.crypto)||(commonjsGlobal==null?void 0:commonjsGlobal.msCrypto)||{}}crypto$1.getBrowerCrypto=fr;function br(){const Er=fr();return Er.subtle||Er.webkitSubtle}crypto$1.getSubtleCrypto=br;function wr(){return!!fr()&&!!br()}return crypto$1.isBrowserCryptoAvailable=wr,crypto$1}var env={},hasRequiredEnv;function requireEnv(){if(hasRequiredEnv)return env;hasRequiredEnv=1,Object.defineProperty(env,"__esModule",{value:!0}),env.isBrowser=env.isNode=env.isReactNative=void 0;function fr(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}env.isReactNative=fr;function br(){return typeof process$1$1<"u"&&typeof process$1$1.versions<"u"&&typeof process$1$1.versions.node<"u"}env.isNode=br;function wr(){return!fr()&&!br()}return env.isBrowser=wr,env}(function(fr){Object.defineProperty(fr,"__esModule",{value:!0});const br=require$$0$4;br.__exportStar(requireCrypto(),fr),br.__exportStar(requireEnv(),fr)})(cjs);function payloadId(fr=3){const br=Date.now()*Math.pow(10,fr),wr=Math.floor(Math.random()*Math.pow(10,fr));return br+wr}function getBigIntRpcId(fr=6){return BigInt(payloadId(fr))}function formatJsonRpcRequest(fr,br,wr){return{id:wr||payloadId(),jsonrpc:"2.0",method:fr,params:br}}function formatJsonRpcResult(fr,br){return{id:fr,jsonrpc:"2.0",result:br}}function formatJsonRpcError(fr,br,wr){return{id:fr,jsonrpc:"2.0",error:formatErrorMessage(br)}}function formatErrorMessage(fr,br){return typeof fr>"u"?getError(INTERNAL_ERROR):(typeof fr=="string"&&(fr=Object.assign(Object.assign({},getError(SERVER_ERROR)),{message:fr})),isReservedErrorCode(fr.code)&&(fr=getErrorByCode(fr.code)),fr)}let e$2=class{},n$1=class extends e$2{constructor(){super()}},r$3=class extends n$1{constructor(br){super()}};const HTTP_REGEX="^https?:",WS_REGEX="^wss?:";function getUrlProtocol(fr){const br=fr.match(new RegExp(/^\w+:/,"gi"));if(!(!br||!br.length))return br[0]}function matchRegexProtocol(fr,br){const wr=getUrlProtocol(fr);return typeof wr>"u"?!1:new RegExp(br).test(wr)}function isHttpUrl(fr){return matchRegexProtocol(fr,HTTP_REGEX)}function isWsUrl(fr){return matchRegexProtocol(fr,WS_REGEX)}function isLocalhostUrl(fr){return new RegExp("wss?://localhost(:d{2,5})?").test(fr)}function isJsonRpcPayload(fr){return typeof fr=="object"&&"id"in fr&&"jsonrpc"in fr&&fr.jsonrpc==="2.0"}function isJsonRpcRequest(fr){return isJsonRpcPayload(fr)&&"method"in fr}function isJsonRpcResponse(fr){return isJsonRpcPayload(fr)&&(isJsonRpcResult(fr)||isJsonRpcError(fr))}function isJsonRpcResult(fr){return"result"in fr}function isJsonRpcError(fr){return"error"in fr}let JsonRpcProvider$1=class extends r$3{constructor(br){super(br),this.events=new eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(br),this.connection.connected&&this.registerEventListeners()}async connect(br=this.connection){await this.open(br)}async disconnect(){await this.close()}on(br,wr){this.events.on(br,wr)}once(br,wr){this.events.once(br,wr)}off(br,wr){this.events.off(br,wr)}removeListener(br,wr){this.events.removeListener(br,wr)}async request(br,wr){return this.requestStrict(formatJsonRpcRequest(br.method,br.params||[],br.id||getBigIntRpcId().toString()),wr)}async requestStrict(br,wr){return new Promise(async(Er,kr)=>{if(!this.connection.connected)try{await this.open()}catch(jr){kr(jr)}this.events.on(`${br.id}`,jr=>{isJsonRpcError(jr)?kr(jr.error):Er(jr.result)});try{await this.connection.send(br,wr)}catch(jr){kr(jr)}})}setConnection(br=this.connection){return br}onPayload(br){this.events.emit("payload",br),isJsonRpcResponse(br)?this.events.emit(`${br.id}`,br):this.events.emit("message",{type:br.method,data:br.params})}onClose(br){br&&br.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${br.code} ${br.reason?`(${br.reason})`:""}`)),this.events.emit("disconnect")}async open(br=this.connection){this.connection===br&&this.connection.connected||(this.connection.connected&&this.close(),typeof br=="string"&&(await this.connection.open(br),br=this.connection),this.connection=this.setConnection(br),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",br=>this.onPayload(br)),this.connection.on("close",br=>this.onClose(br)),this.connection.on("error",br=>this.events.emit("error",br)),this.connection.on("register_error",br=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const w$4=()=>typeof WebSocket<"u"?WebSocket:typeof global$1<"u"&&typeof global$1.WebSocket<"u"?global$1.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:require("ws"),b$2=()=>typeof WebSocket<"u"||typeof global$1<"u"&&typeof global$1.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",a$2=fr=>fr.split("?")[0],h$2=10,S$3=w$4();let f$5=class{constructor(br){if(this.url=br,this.events=new eventsExports.EventEmitter,this.registering=!1,!isWsUrl(br))throw new Error(`Provided URL is not compatible with WebSocket connection: ${br}`);this.url=br}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(br,wr){this.events.on(br,wr)}once(br,wr){this.events.once(br,wr)}off(br,wr){this.events.off(br,wr)}removeListener(br,wr){this.events.removeListener(br,wr)}async open(br=this.url){await this.register(br)}async close(){return new Promise((br,wr)=>{if(typeof this.socket>"u"){wr(new Error("Connection already closed"));return}this.socket.onclose=Er=>{this.onClose(Er),br()},this.socket.close()})}async send(br){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(safeJsonStringify(br))}catch(wr){this.onError(br.id,wr)}}register(br=this.url){if(!isWsUrl(br))throw new Error(`Provided URL is not compatible with WebSocket connection: ${br}`);if(this.registering){const wr=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=wr||this.events.listenerCount("open")>=wr)&&this.events.setMaxListeners(wr+1),new Promise((Er,kr)=>{this.events.once("register_error",jr=>{this.resetMaxListeners(),kr(jr)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return kr(new Error("WebSocket connection is missing or invalid"));Er(this.socket)})})}return this.url=br,this.registering=!0,new Promise((wr,Er)=>{const kr=new URLSearchParams(br).get("origin"),jr=cjs.isReactNative()?{headers:{origin:kr}}:{rejectUnauthorized:!isLocalhostUrl(br)},Br=new S$3(br,[],jr);b$2()?Br.onerror=Wr=>{const qr=Wr;Er(this.emitError(qr.error))}:Br.on("error",Wr=>{Er(this.emitError(Wr))}),Br.onopen=()=>{this.onOpen(Br),wr(Br)}})}onOpen(br){br.onmessage=wr=>this.onPayload(wr),br.onclose=wr=>this.onClose(wr),this.socket=br,this.registering=!1,this.events.emit("open")}onClose(br){this.socket=void 0,this.registering=!1,this.events.emit("close",br)}onPayload(br){if(typeof br.data>"u")return;const wr=typeof br.data=="string"?safeJsonParse(br.data):br.data;this.events.emit("payload",wr)}onError(br,wr){const Er=this.parseError(wr),kr=Er.message||Er.toString(),jr=formatJsonRpcError(br,kr);this.events.emit("payload",jr)}parseError(br,wr=this.url){return parseConnectionError(br,a$2(wr),"WS")}resetMaxListeners(){this.events.getMaxListeners()>h$2&&this.events.setMaxListeners(h$2)}emitError(br){const wr=this.parseError(new Error((br==null?void 0:br.message)||`WebSocket connection failed for host: ${a$2(this.url)}`));return this.events.emit("register_error",wr),wr}};var lodash_isequal={exports:{}};lodash_isequal.exports;(function(fr,br){var wr=200,Er="__lodash_hash_undefined__",kr=1,jr=2,Br=9007199254740991,Wr="[object Arguments]",qr="[object Array]",Gr="[object AsyncFunction]",Vr="[object Boolean]",Zr="[object Date]",Jr="[object Error]",Qr="[object Function]",_n="[object GeneratorFunction]",En="[object Map]",Cn="[object Number]",In="[object Null]",An="[object Object]",jn="[object Promise]",eo="[object Proxy]",ro="[object RegExp]",to="[object Set]",_i="[object String]",oo="[object Symbol]",io="[object Undefined]",co="[object WeakMap]",so="[object ArrayBuffer]",no="[object DataView]",Tn="[object Float32Array]",Hr="[object Float64Array]",Xr="[object Int8Array]",Sn="[object Int16Array]",Rn="[object Int32Array]",Pn="[object Uint8Array]",On="[object Uint8ClampedArray]",Zn="[object Uint16Array]",Nn="[object Uint32Array]",wn=/[\\^$.*+?()[\]{}|]/g,zn=/^\[object .+?Constructor\]$/,fo=/^(?:0|[1-9]\d*)$/,vo={};vo[Tn]=vo[Hr]=vo[Xr]=vo[Sn]=vo[Rn]=vo[Pn]=vo[On]=vo[Zn]=vo[Nn]=!0,vo[Wr]=vo[qr]=vo[so]=vo[Vr]=vo[no]=vo[Zr]=vo[Jr]=vo[Qr]=vo[En]=vo[Cn]=vo[An]=vo[ro]=vo[to]=vo[_i]=vo[co]=!1;var go=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,uo=typeof self=="object"&&self&&self.Object===Object&&self,lo=go||uo||Function("return this")(),Eo=br&&!br.nodeType&&br,mo=Eo&&!0&&fr&&!fr.nodeType&&fr,yo=mo&&mo.exports===Eo,_o=yo&&go.process,Bo=function(){try{return _o&&_o.binding&&_o.binding("util")}catch{}}(),Lo=Bo&&Bo.isTypedArray;function Wo(Zo,Dl){for(var ru=-1,Au=Zo==null?0:Zo.length,Yu=0,Xu=[];++ru-1}function yu(Zo,Dl){var ru=this.__data__,Au=au(ru,Zo);return Au<0?(++this.size,ru.push([Zo,Dl])):ru[Au][1]=Dl,this}$l.prototype.clear=El,$l.prototype.delete=Cu,$l.prototype.get=iu,$l.prototype.has=pu,$l.prototype.set=yu;function hu(Zo){var Dl=-1,ru=Zo==null?0:Zo.length;for(this.clear();++DlKp))return!1;var gp=Xu.get(Zo);if(gp&&Xu.get(Dl))return gp==Dl;var _p=-1,sm=!0,Wp=ru&jr?new su:void 0;for(Xu.set(Zo,Dl),Xu.set(Dl,Zo);++_p-1&&Zo%1==0&&Zo-1&&Zo%1==0&&Zo<=Br}function h0(Zo){var Dl=typeof Zo;return Zo!=null&&(Dl=="object"||Dl=="function")}function zm(Zo){return Zo!=null&&typeof Zo=="object"}var p0=Lo?wl(Lo):Qu;function r1(Zo){return d0(Zo)?Ql(Zo):_h(Zo)}function Lu(){return[]}function Du(){return!1}fr.exports=Rm})(lodash_isequal,lodash_isequal.exports);var lodash_isequalExports=lodash_isequal.exports;const Gi=getDefaultExportFromCjs$2(lodash_isequalExports);function unfetch_module(fr,br){return br=br||{},new Promise(function(wr,Er){var kr=new XMLHttpRequest,jr=[],Br=[],Wr={},qr=function(){return{ok:(kr.status/100|0)==2,statusText:kr.statusText,status:kr.status,url:kr.responseURL,text:function(){return Promise.resolve(kr.responseText)},json:function(){return Promise.resolve(kr.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([kr.response]))},clone:qr,headers:{keys:function(){return jr},entries:function(){return Br},get:function(Vr){return Wr[Vr.toLowerCase()]},has:function(Vr){return Vr.toLowerCase()in Wr}}}};for(var Gr in kr.open(br.method||"get",fr,!0),kr.onload=function(){kr.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(Vr,Zr,Jr){jr.push(Zr=Zr.toLowerCase()),Br.push([Zr,Jr]),Wr[Zr]=Wr[Zr]?Wr[Zr]+","+Jr:Jr}),wr(qr())},kr.onerror=Er,kr.withCredentials=br.credentials=="include",br.headers)kr.setRequestHeader(Gr,br.headers[Gr]);kr.send(br.body||null)})}const unfetch_module$1=Object.freeze(Object.defineProperty({__proto__:null,default:unfetch_module},Symbol.toStringTag,{value:"Module"})),require$$0$3=getAugmentedNamespace(unfetch_module$1);var browser$2=self.fetch||(self.fetch=require$$0$3.default||require$$0$3);const Yi=getDefaultExportFromCjs$2(browser$2);var define_process_env_default$2={};function Hi(fr,br){if(fr.length>=255)throw new TypeError("Alphabet too long");for(var wr=new Uint8Array(256),Er=0;Er>>0,eo=new Uint8Array(jn);In!==An;){for(var ro=_n[In],to=0,_i=jn-1;(ro!==0||to>>0,eo[_i]=ro%Wr>>>0,ro=ro/Wr>>>0;if(ro!==0)throw new Error("Non-zero carry");Cn=to,In++}for(var oo=jn-Cn;oo!==jn&&eo[oo]===0;)oo++;for(var io=qr.repeat(En);oo>>0,jn=new Uint8Array(An);_n[En];){var eo=wr[_n.charCodeAt(En)];if(eo===255)return;for(var ro=0,to=An-1;(eo!==0||ro>>0,jn[to]=eo%256>>>0,eo=eo/256>>>0;if(eo!==0)throw new Error("Non-zero carry");In=ro,En++}if(_n[En]!==" "){for(var _i=An-In;_i!==An&&jn[_i]===0;)_i++;for(var oo=new Uint8Array(Cn+(An-_i)),io=Cn;_i!==An;)oo[io++]=jn[_i++];return oo}}}function Qr(_n){var En=Jr(_n);if(En)return En;throw new Error(`Non-${br} character`)}return{encode:Zr,decodeUnsafe:Jr,decode:Qr}}var Ji=Hi,Xi=Ji;const Ne=fr=>{if(fr instanceof Uint8Array&&fr.constructor.name==="Uint8Array")return fr;if(fr instanceof ArrayBuffer)return new Uint8Array(fr);if(ArrayBuffer.isView(fr))return new Uint8Array(fr.buffer,fr.byteOffset,fr.byteLength);throw new Error("Unknown type, must be binary type")},Wi$1=fr=>new TextEncoder().encode(fr),Qi=fr=>new TextDecoder().decode(fr);class Zi{constructor(br,wr,Er){this.name=br,this.prefix=wr,this.baseEncode=Er}encode(br){if(br instanceof Uint8Array)return`${this.prefix}${this.baseEncode(br)}`;throw Error("Unknown type, must be binary type")}}class es{constructor(br,wr,Er){if(this.name=br,this.prefix=wr,wr.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=wr.codePointAt(0),this.baseDecode=Er}decode(br){if(typeof br=="string"){if(br.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(br)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(br.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(br){return Ue(this,br)}}class ts{constructor(br){this.decoders=br}or(br){return Ue(this,br)}decode(br){const wr=br[0],Er=this.decoders[wr];if(Er)return Er.decode(br);throw RangeError(`Unable to decode multibase string ${JSON.stringify(br)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Ue=(fr,br)=>new ts({...fr.decoders||{[fr.prefix]:fr},...br.decoders||{[br.prefix]:br}});let is$3=class{constructor(br,wr,Er,kr){this.name=br,this.prefix=wr,this.baseEncode=Er,this.baseDecode=kr,this.encoder=new Zi(br,wr,Er),this.decoder=new es(br,wr,kr)}encode(br){return this.encoder.encode(br)}decode(br){return this.decoder.decode(br)}};const W=({name:fr,prefix:br,encode:wr,decode:Er})=>new is$3(fr,br,wr,Er),B$3=({prefix:fr,name:br,alphabet:wr})=>{const{encode:Er,decode:kr}=Xi(wr,br);return W({prefix:fr,name:br,encode:Er,decode:jr=>Ne(kr(jr))})},ss=(fr,br,wr,Er)=>{const kr={};for(let Vr=0;Vr=8&&(Wr-=8,Br[Gr++]=255&qr>>Wr)}if(Wr>=wr||255&qr<<8-Wr)throw new SyntaxError("Unexpected end of data");return Br},rs=(fr,br,wr)=>{const Er=br[br.length-1]==="=",kr=(1<wr;)Br-=wr,jr+=br[kr&Wr>>Br];if(Br&&(jr+=br[kr&Wr<W({prefix:br,name:fr,encode(kr){return rs(kr,Er,wr)},decode(kr){return ss(kr,Er,wr,fr)}}),ns=W({prefix:"\0",name:"identity",encode:fr=>Qi(fr),decode:fr=>Wi$1(fr)});var os=Object.freeze({__proto__:null,identity:ns});const as$1=g$5({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var hs$1=Object.freeze({__proto__:null,base2:as$1});const cs$1=g$5({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var us$1=Object.freeze({__proto__:null,base8:cs$1});const ls$1=B$3({prefix:"9",name:"base10",alphabet:"0123456789"});var ds$1=Object.freeze({__proto__:null,base10:ls$1});const gs$1=g$5({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ps$1=g$5({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ds=Object.freeze({__proto__:null,base16:gs$1,base16upper:ps$1});const ys=g$5({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ms=g$5({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),bs=g$5({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),fs=g$5({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Es=g$5({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ws=g$5({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),vs=g$5({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Is=g$5({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Cs=g$5({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Rs=Object.freeze({__proto__:null,base32:ys,base32upper:ms,base32pad:bs,base32padupper:fs,base32hex:Es,base32hexupper:ws,base32hexpad:vs,base32hexpadupper:Is,base32z:Cs});const _s=B$3({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Ts=B$3({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ss=Object.freeze({__proto__:null,base36:_s,base36upper:Ts});const Ps=B$3({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),xs=B$3({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Os=Object.freeze({__proto__:null,base58btc:Ps,base58flickr:xs});const As=g$5({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zs=g$5({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Ns=g$5({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Us=g$5({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ls=Object.freeze({__proto__:null,base64:As,base64pad:zs,base64url:Ns,base64urlpad:Us});const Le=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),$s=Le.reduce((fr,br,wr)=>(fr[wr]=br,fr),[]),Fs=Le.reduce((fr,br,wr)=>(fr[br.codePointAt(0)]=wr,fr),[]);function Ms(fr){return fr.reduce((br,wr)=>(br+=$s[wr],br),"")}function ks(fr){const br=[];for(const wr of fr){const Er=Fs[wr.codePointAt(0)];if(Er===void 0)throw new Error(`Non-base256emoji character: ${wr}`);br.push(Er)}return new Uint8Array(br)}const Ks=W({prefix:"🚀",name:"base256emoji",encode:Ms,decode:ks});var Bs=Object.freeze({__proto__:null,base256emoji:Ks}),Vs=Fe,$e=128,qs=127,js$1=~qs,Gs=Math.pow(2,31);function Fe(fr,br,wr){br=br||[],wr=wr||0;for(var Er=wr;fr>=Gs;)br[wr++]=fr&255|$e,fr/=128;for(;fr&js$1;)br[wr++]=fr&255|$e,fr>>>=7;return br[wr]=fr|0,Fe.bytes=wr-Er+1,br}var Ys=he$1,Hs=128,Me=127;function he$1(fr,Er){var wr=0,Er=Er||0,kr=0,jr=Er,Br,Wr=fr.length;do{if(jr>=Wr)throw he$1.bytes=0,new RangeError("Could not decode varint");Br=fr[jr++],wr+=kr<28?(Br&Me)<=Hs);return he$1.bytes=jr-Er,wr}var Js=Math.pow(2,7),Xs=Math.pow(2,14),Ws=Math.pow(2,21),Qs=Math.pow(2,28),Zs=Math.pow(2,35),er=Math.pow(2,42),tr=Math.pow(2,49),ir=Math.pow(2,56),sr=Math.pow(2,63),rr=function(fr){return fr(ke.encode(fr,br,wr),br),Be=fr=>ke.encodingLength(fr),ce$1=(fr,br)=>{const wr=br.byteLength,Er=Be(fr),kr=Er+Be(wr),jr=new Uint8Array(kr+wr);return Ke(fr,jr,0),Ke(wr,jr,Er),jr.set(br,kr),new or(fr,wr,br,jr)};class or{constructor(br,wr,Er,kr){this.code=br,this.size=wr,this.digest=Er,this.bytes=kr}}const Ve=({name:fr,code:br,encode:wr})=>new ar(fr,br,wr);class ar{constructor(br,wr,Er){this.name=br,this.code=wr,this.encode=Er}digest(br){if(br instanceof Uint8Array){const wr=this.encode(br);return wr instanceof Uint8Array?ce$1(this.code,wr):wr.then(Er=>ce$1(this.code,Er))}else throw Error("Unknown type, must be binary type")}}const qe=fr=>async br=>new Uint8Array(await crypto.subtle.digest(fr,br)),hr$1=Ve({name:"sha2-256",code:18,encode:qe("SHA-256")}),cr$1=Ve({name:"sha2-512",code:19,encode:qe("SHA-512")});var ur=Object.freeze({__proto__:null,sha256:hr$1,sha512:cr$1});const je=0,lr$1="identity",Ge=Ne,dr=fr=>ce$1(je,Ge(fr)),gr={code:je,name:lr$1,encode:Ge,digest:dr};var pr=Object.freeze({__proto__:null,identity:gr});new TextEncoder,new TextDecoder;const Ye={...os,...hs$1,...us$1,...ds$1,...Ds,...Rs,...Ss,...Os,...Ls,...Bs};({...ur,...pr});function He(fr){return globalThis.Buffer!=null?new Uint8Array(fr.buffer,fr.byteOffset,fr.byteLength):fr}function Dr(fr=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?He(globalThis.Buffer.allocUnsafe(fr)):new Uint8Array(fr)}function Je(fr,br,wr,Er){return{name:fr,prefix:br,encoder:{name:fr,prefix:br,encode:wr},decoder:{decode:Er}}}const Xe=Je("utf8","u",fr=>"u"+new TextDecoder("utf8").decode(fr),fr=>new TextEncoder().encode(fr.substring(1))),ue$1=Je("ascii","a",fr=>{let br="a";for(let wr=0;wr{fr=fr.substring(1);const br=Dr(fr.length);for(let wr=0;wr{if(!this.initialized){const Er=await this.getKeyChain();typeof Er<"u"&&(this.keychain=Er),this.initialized=!0}},this.has=Er=>(this.isInitialized(),this.keychain.has(Er)),this.set=async(Er,kr)=>{this.isInitialized(),this.keychain.set(Er,kr),await this.persist()},this.get=Er=>{this.isInitialized();const kr=this.keychain.get(Er);if(typeof kr>"u"){const{message:jr}=N$2("NO_MATCHING_KEY",`${this.name}: ${Er}`);throw new Error(jr)}return kr},this.del=async Er=>{this.isInitialized(),this.keychain.delete(Er),await this.persist()},this.core=br,this.logger=E$4(wr,this.name)}get context(){return y$4(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(br){await this.core.storage.setItem(this.storageKey,rt$1(br))}async getKeyChain(){const br=await this.core.storage.getItem(this.storageKey);return typeof br<"u"?ot$1(br):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}}class xt{constructor(br,wr,Er){this.core=br,this.logger=wr,this.name=et,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=kr=>(this.isInitialized(),this.keychain.has(kr)),this.getClientId=async()=>{this.isInitialized();const kr=await this.getClientSeed(),jr=generateKeyPair$1(kr);return encodeIss(jr.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const kr=kn();return this.setPrivateKey(kr.publicKey,kr.privateKey)},this.signJWT=async kr=>{this.isInitialized();const jr=await this.getClientSeed(),Br=generateKeyPair$1(jr),Wr=Vn$1();return await signJWT(Wr,kr,tt,Br)},this.generateSharedKey=(kr,jr,Br)=>{this.isInitialized();const Wr=this.getPrivateKey(kr),qr=Mn(Wr,jr);return this.setSymKey(qr,Br)},this.setSymKey=async(kr,jr)=>{this.isInitialized();const Br=jr||Kn(kr);return await this.keychain.set(Br,kr),Br},this.deleteKeyPair=async kr=>{this.isInitialized(),await this.keychain.del(kr)},this.deleteSymKey=async kr=>{this.isInitialized(),await this.keychain.del(kr)},this.encode=async(kr,jr,Br)=>{this.isInitialized();const Wr=Ae(Br),qr=safeJsonStringify(jr);if(qn(Wr)){const Jr=Wr.senderPublicKey,Qr=Wr.receiverPublicKey;kr=await this.generateSharedKey(Jr,Qr)}const Gr=this.getSymKey(kr),{type:Vr,senderPublicKey:Zr}=Wr;return xn({type:Vr,symKey:Gr,message:qr,senderPublicKey:Zr})},this.decode=async(kr,jr,Br)=>{this.isInitialized();const Wr=Hn(jr,Br);if(qn(Wr)){const qr=Wr.receiverPublicKey,Gr=Wr.senderPublicKey;kr=await this.generateSharedKey(qr,Gr)}try{const qr=this.getSymKey(kr),Gr=Fn({symKey:qr,encoded:jr});return safeJsonParse(Gr)}catch(qr){this.logger.error(`Failed to decode message from topic: '${kr}', clientId: '${await this.getClientId()}'`),this.logger.error(qr)}},this.getPayloadType=kr=>{const jr=ee$2(kr);return j$4(jr.type)},this.getPayloadSenderPublicKey=kr=>{const jr=ee$2(kr);return jr.senderPublicKey?toString(jr.senderPublicKey,p$4):void 0},this.core=br,this.logger=E$4(wr,this.name),this.keychain=Er||new Pt(this.core,this.logger)}get context(){return y$4(this.logger)}async setPrivateKey(br,wr){return await this.keychain.set(br,wr),br}getPrivateKey(br){return this.keychain.get(br)}async getClientSeed(){let br="";try{br=this.keychain.get(de$1)}catch{br=Vn$1(),await this.keychain.set(de$1,br)}return mr(br,"base16")}getSymKey(br){return this.keychain.get(br)}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}}class Ot extends a$3{constructor(br,wr){super(br,wr),this.logger=br,this.core=wr,this.messages=new Map,this.name=rt,this.version=nt,this.initialized=!1,this.storagePrefix=O$3,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const Er=await this.getRelayerMessages();typeof Er<"u"&&(this.messages=Er),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(Er){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(Er)}finally{this.initialized=!0}}},this.set=async(Er,kr)=>{this.isInitialized();const jr=Ln(kr);let Br=this.messages.get(Er);return typeof Br>"u"&&(Br={}),typeof Br[jr]<"u"||(Br[jr]=kr,this.messages.set(Er,Br),await this.persist()),jr},this.get=Er=>{this.isInitialized();let kr=this.messages.get(Er);return typeof kr>"u"&&(kr={}),kr},this.has=(Er,kr)=>{this.isInitialized();const jr=this.get(Er),Br=Ln(kr);return typeof jr[Br]<"u"},this.del=async Er=>{this.isInitialized(),this.messages.delete(Er),await this.persist()},this.logger=E$4(br,this.name),this.core=wr}get context(){return y$4(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(br){await this.core.storage.setItem(this.storageKey,rt$1(br))}async getRelayerMessages(){const br=await this.core.storage.getItem(this.storageKey);return typeof br<"u"?ot$1(br):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}}class vr extends u$3{constructor(br,wr){super(br,wr),this.relayer=br,this.logger=wr,this.events=new eventsExports.EventEmitter,this.name=at,this.queue=new Map,this.publishTimeout=cjs$4.toMiliseconds(cjs$4.TEN_SECONDS*2),this.needsTransportRestart=!1,this.publish=async(Er,kr,jr)=>{var Br;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:Er,message:kr,opts:jr}});try{const Wr=(jr==null?void 0:jr.ttl)||ot,qr=vt$1(jr),Gr=(jr==null?void 0:jr.prompt)||!1,Vr=(jr==null?void 0:jr.tag)||0,Zr=(jr==null?void 0:jr.id)||getBigIntRpcId().toString(),Jr={topic:Er,message:kr,opts:{ttl:Wr,relay:qr,prompt:Gr,tag:Vr,id:Zr}},Qr=setTimeout(()=>this.queue.set(Zr,Jr),this.publishTimeout);try{await await ut$1(this.rpcPublish(Er,kr,Wr,qr,Gr,Vr,Zr),this.publishTimeout,`Failed to publish payload, please try again. id:${Zr} tag:${Vr}`),this.removeRequestFromQueue(Zr),this.relayer.events.emit(D$4.publish,Jr)}catch(_n){if(this.logger.debug("Publishing Payload stalled"),this.needsTransportRestart=!0,(Br=jr==null?void 0:jr.internal)!=null&&Br.throwOnFailedPublish)throw this.removeRequestFromQueue(Zr),_n;return}finally{clearTimeout(Qr)}this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:Er,message:kr,opts:jr}})}catch(Wr){throw this.logger.debug("Failed to Publish Payload"),this.logger.error(Wr),Wr}},this.on=(Er,kr)=>{this.events.on(Er,kr)},this.once=(Er,kr)=>{this.events.once(Er,kr)},this.off=(Er,kr)=>{this.events.off(Er,kr)},this.removeListener=(Er,kr)=>{this.events.removeListener(Er,kr)},this.relayer=br,this.logger=E$4(wr,this.name),this.registerEventListeners()}get context(){return y$4(this.logger)}rpcPublish(br,wr,Er,kr,jr,Br,Wr){var qr,Gr,Vr,Zr;const Jr={method:Et$1(kr.protocol).publish,params:{topic:br,message:wr,ttl:Er,prompt:jr,tag:Br},id:Wr};return w$5((qr=Jr.params)==null?void 0:qr.prompt)&&((Gr=Jr.params)==null||delete Gr.prompt),w$5((Vr=Jr.params)==null?void 0:Vr.tag)&&((Zr=Jr.params)==null||delete Zr.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:Jr}),this.relayer.request(Jr)}removeRequestFromQueue(br){this.queue.delete(br)}checkQueue(){this.queue.forEach(async br=>{const{topic:wr,message:Er,opts:kr}=br;await this.publish(wr,Er,kr)})}registerEventListeners(){this.relayer.core.heartbeat.on(cjs$1.HEARTBEAT_EVENTS.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(D$4.connection_stalled);return}this.checkQueue()}),this.relayer.on(D$4.message_ack,br=>{this.removeRequestFromQueue(br.id.toString())})}}class Ir{constructor(){this.map=new Map,this.set=(br,wr)=>{const Er=this.get(br);this.exists(br,wr)||this.map.set(br,[...Er,wr])},this.get=br=>this.map.get(br)||[],this.exists=(br,wr)=>this.get(br).includes(wr),this.delete=(br,wr)=>{if(typeof wr>"u"){this.map.delete(br);return}if(!this.map.has(br))return;const Er=this.get(br);if(!this.exists(br,wr))return;const kr=Er.filter(jr=>jr!==wr);if(!kr.length){this.map.delete(br);return}this.map.set(br,kr)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var Cr=Object.defineProperty,Rr=Object.defineProperties,_r=Object.getOwnPropertyDescriptors,At=Object.getOwnPropertySymbols,Tr=Object.prototype.hasOwnProperty,Sr=Object.prototype.propertyIsEnumerable,zt=(fr,br,wr)=>br in fr?Cr(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,q$3=(fr,br)=>{for(var wr in br||(br={}))Tr.call(br,wr)&&zt(fr,wr,br[wr]);if(At)for(var wr of At(br))Sr.call(br,wr)&&zt(fr,wr,br[wr]);return fr},De=(fr,br)=>Rr(fr,_r(br));class Nt extends d$3{constructor(br,wr){super(br,wr),this.relayer=br,this.logger=wr,this.subscriptions=new Map,this.topicMap=new Ir,this.events=new eventsExports.EventEmitter,this.name=mt,this.version=bt,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=O$3,this.subscribeTimeout=1e4,this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(Er,kr)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:Er,opts:kr}});try{const jr=vt$1(kr),Br={topic:Er,relay:jr};this.pending.set(Er,Br);const Wr=await this.rpcSubscribe(Er,jr);return this.onSubscribe(Wr,Br),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:Er,opts:kr}}),Wr}catch(jr){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(jr),jr}},this.unsubscribe=async(Er,kr)=>{await this.restartToComplete(),this.isInitialized(),typeof(kr==null?void 0:kr.id)<"u"?await this.unsubscribeById(Er,kr.id,kr):await this.unsubscribeByTopic(Er,kr)},this.isSubscribed=async Er=>{if(this.topics.includes(Er))return!0;const kr=`${this.pendingSubscriptionWatchLabel}_${Er}`;return await new Promise((jr,Br)=>{const Wr=new cjs$4.Watch;Wr.start(kr);const qr=setInterval(()=>{!this.pending.has(Er)&&this.topics.includes(Er)&&(clearInterval(qr),Wr.stop(kr),jr(!0)),Wr.elapsed(kr)>=ft$1&&(clearInterval(qr),Wr.stop(kr),Br(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(Er,kr)=>{this.events.on(Er,kr)},this.once=(Er,kr)=>{this.events.once(Er,kr)},this.off=(Er,kr)=>{this.events.off(Er,kr)},this.removeListener=(Er,kr)=>{this.events.removeListener(Er,kr)},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=br,this.logger=E$4(wr,this.name),this.clientId=""}get context(){return y$4(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}hasSubscription(br,wr){let Er=!1;try{Er=this.getSubscription(br).topic===wr}catch{}return Er}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(br,wr){const Er=this.topicMap.get(br);await Promise.all(Er.map(async kr=>await this.unsubscribeById(br,kr,wr)))}async unsubscribeById(br,wr,Er){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:br,id:wr,opts:Er}});try{const kr=vt$1(Er);await this.rpcUnsubscribe(br,wr,kr);const jr=U$3("USER_DISCONNECTED",`${this.name}, ${br}`);await this.onUnsubscribe(br,wr,jr),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:br,id:wr,opts:Er}})}catch(kr){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(kr),kr}}async rpcSubscribe(br,wr){const Er={method:Et$1(wr.protocol).subscribe,params:{topic:br}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:Er});try{await await ut$1(this.relayer.request(Er),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(D$4.connection_stalled)}return Ln(br+this.clientId)}async rpcBatchSubscribe(br){if(!br.length)return;const wr=br[0].relay,Er={method:Et$1(wr.protocol).batchSubscribe,params:{topics:br.map(kr=>kr.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:Er});try{return await await ut$1(this.relayer.request(Er),this.subscribeTimeout)}catch{this.logger.debug("Outgoing Relay Payload stalled"),this.relayer.events.emit(D$4.connection_stalled)}}rpcUnsubscribe(br,wr,Er){const kr={method:Et$1(Er.protocol).unsubscribe,params:{topic:br,id:wr}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:kr}),this.relayer.request(kr)}onSubscribe(br,wr){this.setSubscription(br,De(q$3({},wr),{id:br})),this.pending.delete(wr.topic)}onBatchSubscribe(br){br.length&&br.forEach(wr=>{this.setSubscription(wr.id,q$3({},wr)),this.pending.delete(wr.topic)})}async onUnsubscribe(br,wr,Er){this.events.removeAllListeners(wr),this.hasSubscription(wr,br)&&this.deleteSubscription(wr,Er),await this.relayer.messages.del(br)}async setRelayerSubscriptions(br){await this.relayer.core.storage.setItem(this.storageKey,br)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(br,wr){this.subscriptions.has(br)||(this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:br,subscription:wr}),this.addSubscription(br,wr))}addSubscription(br,wr){this.subscriptions.set(br,q$3({},wr)),this.topicMap.set(wr.topic,br),this.events.emit(w$3.created,wr)}getSubscription(br){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:br});const wr=this.subscriptions.get(br);if(!wr){const{message:Er}=N$2("NO_MATCHING_KEY",`${this.name}: ${br}`);throw new Error(Er)}return wr}deleteSubscription(br,wr){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:br,reason:wr});const Er=this.getSubscription(br);this.subscriptions.delete(br),this.topicMap.delete(Er.topic,br),this.events.emit(w$3.deleted,De(q$3({},Er),{reason:wr}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(w$3.sync)}async reset(){if(this.cached.length){const br=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let wr=0;wr"u"||!br.length)return;if(this.subscriptions.size){const{message:wr}=N$2("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(wr),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(wr)}this.cached=br,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(br){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(br)}}async batchSubscribe(br){if(!br.length)return;const wr=await this.rpcBatchSubscribe(br);k$3(wr)&&this.onBatchSubscribe(wr.map((Er,kr)=>De(q$3({},br[kr]),{id:Er})))}async onConnect(){this.restartInProgress||(await this.restart(),this.onEnable())}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||this.relayer.transportExplicitlyClosed)return;const br=[];this.pending.forEach(wr=>{br.push(wr)}),await this.batchSubscribe(br)}registerEventListeners(){this.relayer.core.heartbeat.on(cjs$1.HEARTBEAT_EVENTS.pulse,async()=>{await this.checkPending()}),this.relayer.on(D$4.connect,async()=>{await this.onConnect()}),this.relayer.on(D$4.disconnect,()=>{this.onDisconnect()}),this.events.on(w$3.created,async br=>{const wr=w$3.created;this.logger.info(`Emitting ${wr}`),this.logger.debug({type:"event",event:wr,data:br}),await this.persist()}),this.events.on(w$3.deleted,async br=>{const wr=w$3.deleted;this.logger.info(`Emitting ${wr}`),this.logger.debug({type:"event",event:wr,data:br}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}async restartToComplete(){this.restartInProgress&&await new Promise(br=>{const wr=setInterval(()=>{this.restartInProgress||(clearInterval(wr),br())},this.pollingInterval)})}}var Pr=Object.defineProperty,Ut=Object.getOwnPropertySymbols,xr=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,Lt=(fr,br,wr)=>br in fr?Pr(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,Ar=(fr,br)=>{for(var wr in br||(br={}))xr.call(br,wr)&&Lt(fr,wr,br[wr]);if(Ut)for(var wr of Ut(br))Or.call(br,wr)&&Lt(fr,wr,br[wr]);return fr};class $t extends g$7{constructor(br){super(br),this.protocol="wc",this.version=2,this.events=new eventsExports.EventEmitter,this.name=ut,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","socket stalled"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.request=async wr=>{this.logger.debug("Publishing Request Payload");const Er=wr.id;try{await this.toEstablishConnection();const kr=this.provider.request(wr);return this.requestsInFlight.set(Er,{promise:kr,request:wr}),await kr}catch(kr){throw this.logger.debug("Failed to Publish Request"),this.logger.error(kr),kr}finally{this.requestsInFlight.delete(Er)}},this.onPayloadHandler=wr=>{this.onProviderPayload(wr)},this.onConnectHandler=()=>{this.events.emit(D$4.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=wr=>{this.logger.error(wr),this.events.emit(D$4.error,wr),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(P$4.payload,this.onPayloadHandler),this.provider.on(P$4.connect,this.onConnectHandler),this.provider.on(P$4.disconnect,this.onDisconnectHandler),this.provider.on(P$4.error,this.onProviderErrorHandler)},this.core=br.core,this.logger=typeof br.logger<"u"&&typeof br.logger!="string"?E$4(br.logger,this.name):Hg(k$4({level:br.logger||ct})),this.messages=new Ot(this.logger,br.core),this.subscriber=new Nt(this,this.logger),this.publisher=new vr(this,this.logger),this.relayUrl=(br==null?void 0:br.relayUrl)||ge$2,this.projectId=br.projectId,this.bundleId=Jn(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await this.createProvider(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${pe$1}...`),await this.restartTransport(pe$1)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},pt)}get context(){return y$4(this.logger)}get connected(){return this.provider.connection.connected}get connecting(){return this.provider.connection.connecting}async publish(br,wr,Er){this.isInitialized(),await this.publisher.publish(br,wr,Er),await this.recordMessageEvent({topic:br,message:wr,publishedAt:Date.now()})}async subscribe(br,wr){var Er;this.isInitialized();let kr=((Er=this.subscriber.topicMap.get(br))==null?void 0:Er[0])||"";if(kr)return kr;let jr;const Br=Wr=>{Wr.topic===br&&(this.subscriber.off(w$3.created,Br),jr())};return await Promise.all([new Promise(Wr=>{jr=Wr,this.subscriber.on(w$3.created,Br)}),new Promise(async Wr=>{kr=await this.subscriber.subscribe(br,wr),Wr()})]),kr}async unsubscribe(br,wr){this.isInitialized(),await this.subscriber.unsubscribe(br,wr)}on(br,wr){this.events.on(br,wr)}once(br,wr){this.events.once(br,wr)}off(br,wr){this.events.off(br,wr)}removeListener(br,wr){this.events.removeListener(br,wr)}async transportClose(){this.requestsInFlight.size>0&&(this.logger.debug("Waiting for all in-flight requests to finish before closing transport..."),this.requestsInFlight.forEach(async br=>{await br.promise})),this.transportExplicitlyClosed=!0,this.hasExperiencedNetworkDisruption&&this.connected?await ut$1(this.provider.disconnect(),1e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.connected&&await this.provider.disconnect()}async transportOpen(br){if(this.transportExplicitlyClosed=!1,await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress){br&&br!==this.relayUrl&&(this.relayUrl=br,await this.transportClose(),await this.createProvider()),this.connectionAttemptInProgress=!0;try{await Promise.all([new Promise(wr=>{if(!this.initialized)return wr();this.subscriber.once(w$3.resubscribed,()=>{wr()})}),new Promise(async(wr,Er)=>{try{await ut$1(this.provider.connect(),1e4,`Socket stalled when trying to connect to ${this.relayUrl}`)}catch(kr){Er(kr);return}wr()})])}catch(wr){this.logger.error(wr);const Er=wr;if(!this.isConnectionStalled(Er.message))throw wr;this.provider.events.emit(P$4.disconnect)}finally{this.connectionAttemptInProgress=!1,this.hasExperiencedNetworkDisruption=!1}}}async restartTransport(br){await this.confirmOnlineStateOrThrow(),!this.connectionAttemptInProgress&&(this.relayUrl=br||this.relayUrl,await this.transportClose(),await this.createProvider(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await rr$1())throw new Error("No internet connection detected. Please restart your network and try again.")}isConnectionStalled(br){return this.staleConnectionErrors.some(wr=>br.includes(wr))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const br=await this.core.crypto.signJWT(this.relayUrl);this.provider=new JsonRpcProvider$1(new f$5(Xn({sdkVersion:gt,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:br,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(br){const{topic:wr,message:Er}=br;await this.messages.set(wr,Er)}async shouldIgnoreMessageEvent(br){const{topic:wr,message:Er}=br;if(!Er||Er.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${Er}`),!0;if(!await this.subscriber.isSubscribed(wr))return this.logger.debug(`Ignoring message for non-subscribed topic ${wr}`),!0;const kr=this.messages.has(wr,Er);return kr&&this.logger.debug(`Ignoring duplicate message: ${Er}`),kr}async onProviderPayload(br){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:br}),isJsonRpcRequest(br)){if(!br.method.endsWith(lt))return;const wr=br.params,{topic:Er,message:kr,publishedAt:jr}=wr.data,Br={topic:Er,message:kr,publishedAt:jr};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Ar({type:"event",event:wr.id},Br)),this.events.emit(wr.id,Br),await this.acknowledgePayload(br),await this.onMessageEvent(Br)}else isJsonRpcResponse(br)&&this.events.emit(D$4.message_ack,br)}async onMessageEvent(br){await this.shouldIgnoreMessageEvent(br)||(this.events.emit(D$4.message,br),await this.recordMessageEvent(br))}async acknowledgePayload(br){const wr=formatJsonRpcResult(br.id,!0);await this.provider.connection.send(wr)}unregisterProviderListeners(){this.provider.off(P$4.payload,this.onPayloadHandler),this.provider.off(P$4.connect,this.onConnectHandler),this.provider.off(P$4.disconnect,this.onDisconnectHandler),this.provider.off(P$4.error,this.onProviderErrorHandler)}async registerEventListeners(){this.events.on(D$4.connection_stalled,()=>{this.restartTransport().catch(wr=>this.logger.error(wr))});let br=await rr$1();or$1(async wr=>{this.initialized&&br!==wr&&(br=wr,wr?await this.restartTransport().catch(Er=>this.logger.error(Er)):(this.hasExperiencedNetworkDisruption=!0,await this.transportClose().catch(Er=>this.logger.error(Er))))})}onProviderDisconnect(){this.events.emit(D$4.disconnect),this.attemptToReconnect()}attemptToReconnect(){this.transportExplicitlyClosed||(this.logger.info("attemptToReconnect called. Connecting..."),setTimeout(async()=>{await this.restartTransport().catch(br=>this.logger.error(br))},cjs$4.toMiliseconds(dt)))}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectionAttemptInProgress)return await new Promise(br=>{const wr=setInterval(()=>{this.connected&&(clearInterval(wr),br())},this.connectionStatusPollingInterval)});await this.restartTransport()}}}var zr=Object.defineProperty,Ft=Object.getOwnPropertySymbols,Nr=Object.prototype.hasOwnProperty,Ur=Object.prototype.propertyIsEnumerable,Mt=(fr,br,wr)=>br in fr?zr(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,kt=(fr,br)=>{for(var wr in br||(br={}))Nr.call(br,wr)&&Mt(fr,wr,br[wr]);if(Ft)for(var wr of Ft(br))Ur.call(br,wr)&&Mt(fr,wr,br[wr]);return fr};class Kt extends p$5{constructor(br,wr,Er,kr=O$3,jr=void 0){super(br,wr,Er,kr),this.core=br,this.logger=wr,this.name=Er,this.map=new Map,this.version=Dt,this.cached=[],this.initialized=!1,this.storagePrefix=O$3,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(Br=>{this.getKey&&Br!==null&&!w$5(Br)?this.map.set(this.getKey(Br),Br):Lt$1(Br)?this.map.set(Br.id,Br):xt$1(Br)&&this.map.set(Br.topic,Br)}),this.cached=[],this.initialized=!0)},this.set=async(Br,Wr)=>{this.isInitialized(),this.map.has(Br)?await this.update(Br,Wr):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:Br,value:Wr}),this.map.set(Br,Wr),await this.persist())},this.get=Br=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:Br}),this.getData(Br)),this.getAll=Br=>(this.isInitialized(),Br?this.values.filter(Wr=>Object.keys(Br).every(qr=>Gi(Wr[qr],Br[qr]))):this.values),this.update=async(Br,Wr)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:Br,update:Wr});const qr=kt(kt({},this.getData(Br)),Wr);this.map.set(Br,qr),await this.persist()},this.delete=async(Br,Wr)=>{this.isInitialized(),this.map.has(Br)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:Br,reason:Wr}),this.map.delete(Br),await this.persist())},this.logger=E$4(wr,this.name),this.storagePrefix=kr,this.getKey=jr}get context(){return y$4(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}async setDataStore(br){await this.core.storage.setItem(this.storageKey,br)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(br){const wr=this.map.get(br);if(!wr){const{message:Er}=N$2("NO_MATCHING_KEY",`${this.name}: ${br}`);throw this.logger.error(Er),new Error(Er)}return wr}async persist(){await this.setDataStore(this.values)}async restore(){try{const br=await this.getDataStore();if(typeof br>"u"||!br.length)return;if(this.map.size){const{message:wr}=N$2("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(wr),new Error(wr)}this.cached=br,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(br){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(br)}}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}}class Bt{constructor(br,wr){this.core=br,this.logger=wr,this.name=Et,this.version=wt,this.events=new Ug,this.initialized=!1,this.storagePrefix=O$3,this.ignoredPayloadTypes=[_$3],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:Er})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...Er])]},this.create=async()=>{this.isInitialized();const Er=Vn$1(),kr=await this.core.crypto.setSymKey(Er),jr=pt$1(cjs$4.FIVE_MINUTES),Br={protocol:ht},Wr={topic:kr,expiry:jr,relay:Br,active:!1},qr=Rt$1({protocol:this.core.protocol,version:this.core.version,topic:kr,symKey:Er,relay:Br,expiryTimestamp:jr});return await this.pairings.set(kr,Wr),await this.core.relayer.subscribe(kr),this.core.expirer.set(kr,jr),{topic:kr,uri:qr}},this.pair=async Er=>{this.isInitialized(),this.isValidPair(Er);const{topic:kr,symKey:jr,relay:Br,expiryTimestamp:Wr}=Pt$1(Er.uri);let qr;if(this.pairings.keys.includes(kr)&&(qr=this.pairings.get(kr),qr.active))throw new Error(`Pairing already exists: ${kr}. Please try again with a new connection URI.`);const Gr=Wr||pt$1(cjs$4.FIVE_MINUTES),Vr={topic:kr,relay:Br,expiry:Gr,active:!1};return await this.pairings.set(kr,Vr),this.core.expirer.set(kr,Gr),Er.activatePairing&&await this.activate({topic:kr}),this.events.emit(V$1.create,Vr),this.core.crypto.keychain.has(kr)||(await this.core.crypto.setSymKey(jr,kr),await this.core.relayer.subscribe(kr,{relay:Br})),Vr},this.activate=async({topic:Er})=>{this.isInitialized();const kr=pt$1(cjs$4.THIRTY_DAYS);await this.pairings.update(Er,{active:!0,expiry:kr}),this.core.expirer.set(Er,kr)},this.ping=async Er=>{this.isInitialized(),await this.isValidPing(Er);const{topic:kr}=Er;if(this.pairings.keys.includes(kr)){const jr=await this.sendRequest(kr,"wc_pairingPing",{}),{done:Br,resolve:Wr,reject:qr}=at$1();this.events.once(yt$1("pairing_ping",jr),({error:Gr})=>{Gr?qr(Gr):Wr()}),await Br()}},this.updateExpiry=async({topic:Er,expiry:kr})=>{this.isInitialized(),await this.pairings.update(Er,{expiry:kr})},this.updateMetadata=async({topic:Er,metadata:kr})=>{this.isInitialized(),await this.pairings.update(Er,{peerMetadata:kr})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async Er=>{this.isInitialized(),await this.isValidDisconnect(Er);const{topic:kr}=Er;this.pairings.keys.includes(kr)&&(await this.sendRequest(kr,"wc_pairingDelete",U$3("USER_DISCONNECTED")),await this.deletePairing(kr))},this.sendRequest=async(Er,kr,jr)=>{const Br=formatJsonRpcRequest(kr,jr),Wr=await this.core.crypto.encode(Er,Br),qr=$$2[kr].req;return this.core.history.set(Er,Br),this.core.relayer.publish(Er,Wr,qr),Br.id},this.sendResult=async(Er,kr,jr)=>{const Br=formatJsonRpcResult(Er,jr),Wr=await this.core.crypto.encode(kr,Br),qr=await this.core.history.get(kr,Er),Gr=$$2[qr.request.method].res;await this.core.relayer.publish(kr,Wr,Gr),await this.core.history.resolve(Br)},this.sendError=async(Er,kr,jr)=>{const Br=formatJsonRpcError(Er,jr),Wr=await this.core.crypto.encode(kr,Br),qr=await this.core.history.get(kr,Er),Gr=$$2[qr.request.method]?$$2[qr.request.method].res:$$2.unregistered_method.res;await this.core.relayer.publish(kr,Wr,Gr),await this.core.history.resolve(Br)},this.deletePairing=async(Er,kr)=>{await this.core.relayer.unsubscribe(Er),await Promise.all([this.pairings.delete(Er,U$3("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(Er),kr?Promise.resolve():this.core.expirer.del(Er)])},this.cleanup=async()=>{const Er=this.pairings.getAll().filter(kr=>mt$1(kr.expiry));await Promise.all(Er.map(kr=>this.deletePairing(kr.topic)))},this.onRelayEventRequest=Er=>{const{topic:kr,payload:jr}=Er;switch(jr.method){case"wc_pairingPing":return this.onPairingPingRequest(kr,jr);case"wc_pairingDelete":return this.onPairingDeleteRequest(kr,jr);default:return this.onUnknownRpcMethodRequest(kr,jr)}},this.onRelayEventResponse=async Er=>{const{topic:kr,payload:jr}=Er,Br=(await this.core.history.get(kr,jr.id)).request.method;switch(Br){case"wc_pairingPing":return this.onPairingPingResponse(kr,jr);default:return this.onUnknownRpcMethodResponse(Br)}},this.onPairingPingRequest=async(Er,kr)=>{const{id:jr}=kr;try{this.isValidPing({topic:Er}),await this.sendResult(jr,Er,!0),this.events.emit(V$1.ping,{id:jr,topic:Er})}catch(Br){await this.sendError(jr,Er,Br),this.logger.error(Br)}},this.onPairingPingResponse=(Er,kr)=>{const{id:jr}=kr;setTimeout(()=>{isJsonRpcResult(kr)?this.events.emit(yt$1("pairing_ping",jr),{}):isJsonRpcError(kr)&&this.events.emit(yt$1("pairing_ping",jr),{error:kr.error})},500)},this.onPairingDeleteRequest=async(Er,kr)=>{const{id:jr}=kr;try{this.isValidDisconnect({topic:Er}),await this.deletePairing(Er),this.events.emit(V$1.delete,{id:jr,topic:Er})}catch(Br){await this.sendError(jr,Er,Br),this.logger.error(Br)}},this.onUnknownRpcMethodRequest=async(Er,kr)=>{const{id:jr,method:Br}=kr;try{if(this.registeredMethods.includes(Br))return;const Wr=U$3("WC_METHOD_UNSUPPORTED",Br);await this.sendError(jr,Er,Wr),this.logger.error(Wr)}catch(Wr){await this.sendError(jr,Er,Wr),this.logger.error(Wr)}},this.onUnknownRpcMethodResponse=Er=>{this.registeredMethods.includes(Er)||this.logger.error(U$3("WC_METHOD_UNSUPPORTED",Er))},this.isValidPair=Er=>{var kr;if(!Gt$1(Er)){const{message:Br}=N$2("MISSING_OR_INVALID",`pair() params: ${Er}`);throw new Error(Br)}if(!Kt$1(Er.uri)){const{message:Br}=N$2("MISSING_OR_INVALID",`pair() uri: ${Er.uri}`);throw new Error(Br)}const jr=Pt$1(Er.uri);if(!((kr=jr==null?void 0:jr.relay)!=null&&kr.protocol)){const{message:Br}=N$2("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(Br)}if(!(jr!=null&&jr.symKey)){const{message:Br}=N$2("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(Br)}if(jr!=null&&jr.expiryTimestamp&&cjs$4.toMiliseconds(jr==null?void 0:jr.expiryTimestamp){if(!Gt$1(Er)){const{message:jr}=N$2("MISSING_OR_INVALID",`ping() params: ${Er}`);throw new Error(jr)}const{topic:kr}=Er;await this.isValidPairingTopic(kr)},this.isValidDisconnect=async Er=>{if(!Gt$1(Er)){const{message:jr}=N$2("MISSING_OR_INVALID",`disconnect() params: ${Er}`);throw new Error(jr)}const{topic:kr}=Er;await this.isValidPairingTopic(kr)},this.isValidPairingTopic=async Er=>{if(!g$6(Er,!1)){const{message:kr}=N$2("MISSING_OR_INVALID",`pairing topic should be a string: ${Er}`);throw new Error(kr)}if(!this.pairings.keys.includes(Er)){const{message:kr}=N$2("NO_MATCHING_KEY",`pairing topic doesn't exist: ${Er}`);throw new Error(kr)}if(mt$1(this.pairings.get(Er).expiry)){await this.deletePairing(Er);const{message:kr}=N$2("EXPIRED",`pairing topic: ${Er}`);throw new Error(kr)}},this.core=br,this.logger=E$4(wr,this.name),this.pairings=new Kt(this.core,this.logger,this.name,this.storagePrefix)}get context(){return y$4(this.logger)}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}registerRelayerEvents(){this.core.relayer.on(D$4.message,async br=>{const{topic:wr,message:Er}=br;if(!this.pairings.keys.includes(wr)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(Er)))return;const kr=await this.core.crypto.decode(wr,Er);try{isJsonRpcRequest(kr)?(this.core.history.set(wr,kr),this.onRelayEventRequest({topic:wr,payload:kr})):isJsonRpcResponse(kr)&&(await this.core.history.resolve(kr),await this.onRelayEventResponse({topic:wr,payload:kr}),this.core.history.delete(wr,kr.id))}catch(jr){this.logger.error(jr)}})}registerExpirerEvents(){this.core.expirer.on(v$4.expired,async br=>{const{topic:wr}=ft$2(br.target);wr&&this.pairings.keys.includes(wr)&&(await this.deletePairing(wr,!0),this.events.emit(V$1.expire,{topic:wr}))})}}class Vt extends h$3{constructor(br,wr){super(br,wr),this.core=br,this.logger=wr,this.records=new Map,this.events=new eventsExports.EventEmitter,this.name=vt,this.version=It,this.cached=[],this.initialized=!1,this.storagePrefix=O$3,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(Er=>this.records.set(Er.id,Er)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(Er,kr,jr)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:Er,request:kr,chainId:jr}),this.records.has(kr.id))return;const Br={id:kr.id,topic:Er,request:{method:kr.method,params:kr.params||null},chainId:jr,expiry:pt$1(cjs$4.THIRTY_DAYS)};this.records.set(Br.id,Br),this.events.emit(R$1.created,Br)},this.resolve=async Er=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:Er}),!this.records.has(Er.id))return;const kr=await this.getRecord(Er.id);typeof kr.response>"u"&&(kr.response=isJsonRpcError(Er)?{error:Er.error}:{result:Er.result},this.records.set(kr.id,kr),this.events.emit(R$1.updated,kr))},this.get=async(Er,kr)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:Er,id:kr}),await this.getRecord(kr)),this.delete=(Er,kr)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:kr}),this.values.forEach(jr=>{if(jr.topic===Er){if(typeof kr<"u"&&jr.id!==kr)return;this.records.delete(jr.id),this.events.emit(R$1.deleted,jr)}})},this.exists=async(Er,kr)=>(this.isInitialized(),this.records.has(kr)?(await this.getRecord(kr)).topic===Er:!1),this.on=(Er,kr)=>{this.events.on(Er,kr)},this.once=(Er,kr)=>{this.events.once(Er,kr)},this.off=(Er,kr)=>{this.events.off(Er,kr)},this.removeListener=(Er,kr)=>{this.events.removeListener(Er,kr)},this.logger=E$4(wr,this.name)}get context(){return y$4(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const br=[];return this.values.forEach(wr=>{if(typeof wr.response<"u")return;const Er={topic:wr.topic,request:formatJsonRpcRequest(wr.request.method,wr.request.params,wr.id),chainId:wr.chainId};return br.push(Er)}),br}async setJsonRpcRecords(br){await this.core.storage.setItem(this.storageKey,br)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(br){this.isInitialized();const wr=this.records.get(br);if(!wr){const{message:Er}=N$2("NO_MATCHING_KEY",`${this.name}: ${br}`);throw new Error(Er)}return wr}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(R$1.sync)}async restore(){try{const br=await this.getJsonRpcRecords();if(typeof br>"u"||!br.length)return;if(this.records.size){const{message:wr}=N$2("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(wr),new Error(wr)}this.cached=br,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(br){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(br)}}registerEventListeners(){this.events.on(R$1.created,br=>{const wr=R$1.created;this.logger.info(`Emitting ${wr}`),this.logger.debug({type:"event",event:wr,record:br}),this.persist()}),this.events.on(R$1.updated,br=>{const wr=R$1.updated;this.logger.info(`Emitting ${wr}`),this.logger.debug({type:"event",event:wr,record:br}),this.persist()}),this.events.on(R$1.deleted,br=>{const wr=R$1.deleted;this.logger.info(`Emitting ${wr}`),this.logger.debug({type:"event",event:wr,record:br}),this.persist()}),this.core.heartbeat.on(cjs$1.HEARTBEAT_EVENTS.pulse,()=>{this.cleanup()})}cleanup(){try{this.records.forEach(br=>{cjs$4.toMiliseconds(br.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${br.id}`),this.delete(br.topic,br.id))})}catch(br){this.logger.warn(br)}}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}}class qt extends E$3{constructor(br,wr){super(br,wr),this.core=br,this.logger=wr,this.expirations=new Map,this.events=new eventsExports.EventEmitter,this.name=Ct$1,this.version=Rt,this.cached=[],this.initialized=!1,this.storagePrefix=O$3,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(Er=>this.expirations.set(Er.target,Er)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=Er=>{try{const kr=this.formatTarget(Er);return typeof this.getExpiration(kr)<"u"}catch{return!1}},this.set=(Er,kr)=>{this.isInitialized();const jr=this.formatTarget(Er),Br={target:jr,expiry:kr};this.expirations.set(jr,Br),this.checkExpiry(jr,Br),this.events.emit(v$4.created,{target:jr,expiration:Br})},this.get=Er=>{this.isInitialized();const kr=this.formatTarget(Er);return this.getExpiration(kr)},this.del=Er=>{if(this.isInitialized(),this.has(Er)){const kr=this.formatTarget(Er),jr=this.getExpiration(kr);this.expirations.delete(kr),this.events.emit(v$4.deleted,{target:kr,expiration:jr})}},this.on=(Er,kr)=>{this.events.on(Er,kr)},this.once=(Er,kr)=>{this.events.once(Er,kr)},this.off=(Er,kr)=>{this.events.off(Er,kr)},this.removeListener=(Er,kr)=>{this.events.removeListener(Er,kr)},this.logger=E$4(wr,this.name)}get context(){return y$4(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(br){if(typeof br=="string")return lt$1(br);if(typeof br=="number")return dt$1(br);const{message:wr}=N$2("UNKNOWN_TYPE",`Target type: ${typeof br}`);throw new Error(wr)}async setExpirations(br){await this.core.storage.setItem(this.storageKey,br)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(v$4.sync)}async restore(){try{const br=await this.getExpirations();if(typeof br>"u"||!br.length)return;if(this.expirations.size){const{message:wr}=N$2("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(wr),new Error(wr)}this.cached=br,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(br){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(br)}}getExpiration(br){const wr=this.expirations.get(br);if(!wr){const{message:Er}=N$2("NO_MATCHING_KEY",`${this.name}: ${br}`);throw this.logger.error(Er),new Error(Er)}return wr}checkExpiry(br,wr){const{expiry:Er}=wr;cjs$4.toMiliseconds(Er)-Date.now()<=0&&this.expire(br,wr)}expire(br,wr){this.expirations.delete(br),this.events.emit(v$4.expired,{target:br,expiration:wr})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((br,wr)=>this.checkExpiry(wr,br))}registerEventListeners(){this.core.heartbeat.on(cjs$1.HEARTBEAT_EVENTS.pulse,()=>this.checkExpirations()),this.events.on(v$4.created,br=>{const wr=v$4.created;this.logger.info(`Emitting ${wr}`),this.logger.debug({type:"event",event:wr,data:br}),this.persist()}),this.events.on(v$4.expired,br=>{const wr=v$4.expired;this.logger.info(`Emitting ${wr}`),this.logger.debug({type:"event",event:wr,data:br}),this.persist()}),this.events.on(v$4.deleted,br=>{const wr=v$4.deleted;this.logger.info(`Emitting ${wr}`),this.logger.debug({type:"event",event:wr,data:br}),this.persist()})}isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}}}class jt extends y$3{constructor(br,wr){super(br,wr),this.projectId=br,this.logger=wr,this.name=Z,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async Er=>{if(this.verifyDisabled||$$3()||!D$5())return;const kr=this.getVerifyUrl(Er==null?void 0:Er.verifyUrl);this.verifyUrl!==kr&&this.removeIframe(),this.verifyUrl=kr;try{await this.createIframe()}catch(jr){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(jr)}if(!this.initialized){this.removeIframe(),this.verifyUrl=ee$1;try{await this.createIframe()}catch(jr){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(jr),this.verifyDisabled=!0}}},this.register=async Er=>{this.initialized?this.sendPost(Er.attestationId):(this.addToQueue(Er.attestationId),await this.init())},this.resolve=async Er=>{if(this.isDevEnv)return"";const kr=this.getVerifyUrl(Er==null?void 0:Er.verifyUrl);let jr;try{jr=await this.fetchAttestation(Er.attestationId,kr)}catch(Br){this.logger.info(`failed to resolve attestation: ${Er.attestationId} from url: ${kr}`),this.logger.info(Br),jr=await this.fetchAttestation(Er.attestationId,ee$1)}return jr},this.fetchAttestation=async(Er,kr)=>{this.logger.info(`resolving attestation: ${Er} from url: ${kr}`);const jr=this.startAbortTimer(cjs$4.ONE_SECOND*2),Br=await fetch(`${kr}/attestation/${Er}`,{signal:this.abortController.signal});return clearTimeout(jr),Br.status===200?await Br.json():void 0},this.addToQueue=Er=>{this.queue.push(Er)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(Er=>this.sendPost(Er)),this.queue=[])},this.sendPost=Er=>{var kr;try{if(!this.iframe)return;(kr=this.iframe.contentWindow)==null||kr.postMessage(Er,"*"),this.logger.info(`postMessage sent: ${Er} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let Er;const kr=jr=>{jr.data==="verify_ready"&&(this.initialized=!0,this.processQueue(),window.removeEventListener("message",kr),Er())};await Promise.race([new Promise(jr=>{if(document.getElementById(Z))return jr();window.addEventListener("message",kr);const Br=document.createElement("iframe");Br.id=Z,Br.src=`${this.verifyUrl}/${this.projectId}`,Br.style.display="none",document.body.append(Br),this.iframe=Br,Er=jr}),new Promise((jr,Br)=>setTimeout(()=>{window.removeEventListener("message",kr),Br("verify iframe load timeout")},cjs$4.toMiliseconds(cjs$4.FIVE_SECONDS)))])},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=Er=>{let kr=Er||F$3;return _t.includes(kr)||(this.logger.info(`verify url: ${kr}, not included in trusted list, assigning default: ${F$3}`),kr=F$3),kr},this.logger=E$4(wr,this.name),this.verifyUrl=F$3,this.abortController=new AbortController,this.isDevEnv=te$1()&&define_process_env_default$2.IS_VITEST}get context(){return y$4(this.logger)}startAbortTimer(br){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),cjs$4.toMiliseconds(br))}}class Gt extends v$5{constructor(br,wr){super(br,wr),this.projectId=br,this.logger=wr,this.context=Tt,this.registerDeviceToken=async Er=>{const{clientId:kr,token:jr,notificationType:Br,enableEncrypted:Wr=!1}=Er,qr=`${St}/${this.projectId}/clients`;await Yi(qr,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:kr,type:Br,token:jr,always_raw:Wr})})},this.logger=E$4(wr,this.context)}}var Lr=Object.defineProperty,Yt=Object.getOwnPropertySymbols,$r=Object.prototype.hasOwnProperty,Fr=Object.prototype.propertyIsEnumerable,Ht=(fr,br,wr)=>br in fr?Lr(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,Jt=(fr,br)=>{for(var wr in br||(br={}))$r.call(br,wr)&&Ht(fr,wr,br[wr]);if(Yt)for(var wr of Yt(br))Fr.call(br,wr)&&Ht(fr,wr,br[wr]);return fr};class te extends n$2{constructor(br){super(br),this.protocol=le$1,this.version=We,this.name=Q$2,this.events=new eventsExports.EventEmitter,this.initialized=!1,this.on=(Er,kr)=>this.events.on(Er,kr),this.once=(Er,kr)=>this.events.once(Er,kr),this.off=(Er,kr)=>this.events.off(Er,kr),this.removeListener=(Er,kr)=>this.events.removeListener(Er,kr),this.projectId=br==null?void 0:br.projectId,this.relayUrl=(br==null?void 0:br.relayUrl)||ge$2,this.customStoragePrefix=br!=null&&br.customStoragePrefix?`:${br.customStoragePrefix}`:"";const wr=typeof(br==null?void 0:br.logger)<"u"&&typeof(br==null?void 0:br.logger)!="string"?br.logger:Hg(k$4({level:(br==null?void 0:br.logger)||Qe.logger}));this.logger=E$4(wr,this.name),this.heartbeat=new cjs$1.HeartBeat,this.crypto=new xt(this,this.logger,br==null?void 0:br.keychain),this.history=new Vt(this,this.logger),this.expirer=new qt(this,this.logger),this.storage=br!=null&&br.storage?br.storage:new h$4(Jt(Jt({},Ze),br==null?void 0:br.storageOptions)),this.relayer=new $t({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Bt(this,this.logger),this.verify=new jt(this.projectId||"",this.logger),this.echoClient=new Gt(this.projectId||"",this.logger)}static async init(br){const wr=new te(br);await wr.initialize();const Er=await wr.crypto.getClientId();return await wr.storage.setItem(yt,Er),wr}get context(){return y$4(this.logger)}async start(){this.initialized||await this.initialize()}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(br){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,br),this.logger.error(br.message),br}}}const Mr=te,J="wc",F$2=2,X="client",G$1=`${J}@${F$2}:${X}:`,M$2={name:X,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},H$1="WALLETCONNECT_DEEPLINK_CHOICE",oe$1="proposal",ae="Proposal expired",ce="session",L$3=cjs$4.SEVEN_DAYS,le="engine",R={wc_sessionPropose:{req:{ttl:cjs$4.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1104},res:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1106},res:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:cjs$4.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:cjs$4.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:cjs$4.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1112},res:{ttl:cjs$4.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:cjs$4.THIRTY_SECONDS,prompt:!1,tag:1114},res:{ttl:cjs$4.THIRTY_SECONDS,prompt:!1,tag:1115}}},U$2={min:cjs$4.FIVE_MINUTES,max:cjs$4.SEVEN_DAYS},I$1={idle:"IDLE",active:"ACTIVE"},pe="request",he=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"];var as=Object.defineProperty,cs=Object.defineProperties,ls=Object.getOwnPropertyDescriptors,de=Object.getOwnPropertySymbols,ps=Object.prototype.hasOwnProperty,hs=Object.prototype.propertyIsEnumerable,ue=(fr,br,wr)=>br in fr?as(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,g$4=(fr,br)=>{for(var wr in br||(br={}))ps.call(br,wr)&&ue(fr,wr,br[wr]);if(de)for(var wr of de(br))hs.call(br,wr)&&ue(fr,wr,br[wr]);return fr},D$3=(fr,br)=>cs(fr,ls(br));class ds extends w$6{constructor(br){super(br),this.name=le,this.events=new Ug,this.initialized=!1,this.ignoredPayloadTypes=[_$3],this.requestQueue={state:I$1.idle,queue:[]},this.sessionRequestQueue={state:I$1.idle,queue:[]},this.requestQueueDelay=cjs$4.ONE_SECOND,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(R)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},cjs$4.toMiliseconds(this.requestQueueDelay)))},this.connect=async wr=>{await this.isInitialized();const Er=D$3(g$4({},wr),{requiredNamespaces:wr.requiredNamespaces||{},optionalNamespaces:wr.optionalNamespaces||{}});await this.isValidConnect(Er);const{pairingTopic:kr,requiredNamespaces:jr,optionalNamespaces:Br,sessionProperties:Wr,relays:qr}=Er;let Gr=kr,Vr,Zr=!1;if(Gr&&(Zr=this.client.core.pairing.pairings.get(Gr).active),!Gr||!Zr){const{topic:eo,uri:ro}=await this.client.core.pairing.create();Gr=eo,Vr=ro}const Jr=await this.client.core.crypto.generateKeyPair(),Qr=R.wc_sessionPropose.req.ttl||cjs$4.FIVE_MINUTES,_n=pt$1(Qr),En=g$4({requiredNamespaces:jr,optionalNamespaces:Br,relays:qr??[{protocol:ht}],proposer:{publicKey:Jr,metadata:this.client.metadata},expiryTimestamp:_n},Wr&&{sessionProperties:Wr}),{reject:Cn,resolve:In,done:An}=at$1(Qr,ae);if(this.events.once(yt$1("session_connect"),async({error:eo,session:ro})=>{if(eo)Cn(eo);else if(ro){ro.self.publicKey=Jr;const to=D$3(g$4({},ro),{requiredNamespaces:En.requiredNamespaces,optionalNamespaces:En.optionalNamespaces});await this.client.session.set(ro.topic,to),await this.setExpiry(ro.topic,ro.expiry),Gr&&await this.client.core.pairing.updateMetadata({topic:Gr,metadata:ro.peer.metadata}),In(to)}}),!Gr){const{message:eo}=N$2("NO_MATCHING_KEY",`connect() pairing topic: ${Gr}`);throw new Error(eo)}const jn=await this.sendRequest({topic:Gr,method:"wc_sessionPropose",params:En,throwOnFailedPublish:!0});return await this.setProposal(jn,g$4({id:jn},En)),{uri:Vr,approval:An}},this.pair=async wr=>(await this.isInitialized(),await this.client.core.pairing.pair(wr)),this.approve=async wr=>{await this.isInitialized(),await this.isValidApprove(wr);const{id:Er,relayProtocol:kr,namespaces:jr,sessionProperties:Br}=wr,Wr=this.client.proposal.get(Er);let{pairingTopic:qr,proposer:Gr,requiredNamespaces:Vr,optionalNamespaces:Zr}=Wr;qr=qr||"";const Jr=await this.client.core.crypto.generateKeyPair(),Qr=Gr.publicKey,_n=await this.client.core.crypto.generateSharedKey(Jr,Qr);qr&&Er&&(await this.client.core.pairing.updateMetadata({topic:qr,metadata:Gr.metadata}),await this.sendResult({id:Er,topic:qr,result:{relay:{protocol:kr??"irn"},responderPublicKey:Jr}}),await this.client.proposal.delete(Er,U$3("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:qr}));const En=g$4({relay:{protocol:kr??"irn"},namespaces:jr,pairingTopic:qr,controller:{publicKey:Jr,metadata:this.client.metadata},expiry:pt$1(L$3)},Br&&{sessionProperties:Br});await this.client.core.relayer.subscribe(_n);const Cn=D$3(g$4({},En),{topic:_n,requiredNamespaces:Vr,optionalNamespaces:Zr,pairingTopic:qr,acknowledged:!1,self:En.controller,peer:{publicKey:Gr.publicKey,metadata:Gr.metadata},controller:Jr});await this.client.session.set(_n,Cn);try{await this.sendRequest({topic:_n,method:"wc_sessionSettle",params:En,throwOnFailedPublish:!0})}catch(In){throw this.client.logger.error(In),this.client.session.delete(_n,U$3("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(_n),In}return await this.setExpiry(_n,pt$1(L$3)),{topic:_n,acknowledged:()=>new Promise(In=>setTimeout(()=>In(this.client.session.get(_n)),500))}},this.reject=async wr=>{await this.isInitialized(),await this.isValidReject(wr);const{id:Er,reason:kr}=wr,{pairingTopic:jr}=this.client.proposal.get(Er);jr&&(await this.sendError(Er,jr,kr),await this.client.proposal.delete(Er,U$3("USER_DISCONNECTED")))},this.update=async wr=>{await this.isInitialized(),await this.isValidUpdate(wr);const{topic:Er,namespaces:kr}=wr,jr=await this.sendRequest({topic:Er,method:"wc_sessionUpdate",params:{namespaces:kr}}),{done:Br,resolve:Wr,reject:qr}=at$1();return this.events.once(yt$1("session_update",jr),({error:Gr})=>{Gr?qr(Gr):Wr()}),await this.client.session.update(Er,{namespaces:kr}),{acknowledged:Br}},this.extend=async wr=>{await this.isInitialized(),await this.isValidExtend(wr);const{topic:Er}=wr,kr=await this.sendRequest({topic:Er,method:"wc_sessionExtend",params:{}}),{done:jr,resolve:Br,reject:Wr}=at$1();return this.events.once(yt$1("session_extend",kr),({error:qr})=>{qr?Wr(qr):Br()}),await this.setExpiry(Er,pt$1(L$3)),{acknowledged:jr}},this.request=async wr=>{await this.isInitialized(),await this.isValidRequest(wr);const{chainId:Er,request:kr,topic:jr,expiry:Br=R.wc_sessionRequest.req.ttl}=wr,Wr=payloadId(),{done:qr,resolve:Gr,reject:Vr}=at$1(Br,"Request expired. Please try again.");return this.events.once(yt$1("session_request",Wr),({error:Zr,result:Jr})=>{Zr?Vr(Zr):Gr(Jr)}),await Promise.all([new Promise(async Zr=>{await this.sendRequest({clientRpcId:Wr,topic:jr,method:"wc_sessionRequest",params:{request:D$3(g$4({},kr),{expiryTimestamp:pt$1(Br)}),chainId:Er},expiry:Br,throwOnFailedPublish:!0}).catch(Jr=>Vr(Jr)),this.client.events.emit("session_request_sent",{topic:jr,request:kr,chainId:Er,id:Wr}),Zr()}),new Promise(async Zr=>{const Jr=await ht$1(this.client.core.storage,H$1);gt$1({id:Wr,topic:jr,wcDeepLink:Jr}),Zr()}),qr()]).then(Zr=>Zr[2])},this.respond=async wr=>{await this.isInitialized(),await this.isValidRespond(wr);const{topic:Er,response:kr}=wr,{id:jr}=kr;isJsonRpcResult(kr)?await this.sendResult({id:jr,topic:Er,result:kr.result,throwOnFailedPublish:!0}):isJsonRpcError(kr)&&await this.sendError(jr,Er,kr.error),this.cleanupAfterResponse(wr)},this.ping=async wr=>{await this.isInitialized(),await this.isValidPing(wr);const{topic:Er}=wr;if(this.client.session.keys.includes(Er)){const kr=await this.sendRequest({topic:Er,method:"wc_sessionPing",params:{}}),{done:jr,resolve:Br,reject:Wr}=at$1();this.events.once(yt$1("session_ping",kr),({error:qr})=>{qr?Wr(qr):Br()}),await jr()}else this.client.core.pairing.pairings.keys.includes(Er)&&await this.client.core.pairing.ping({topic:Er})},this.emit=async wr=>{await this.isInitialized(),await this.isValidEmit(wr);const{topic:Er,event:kr,chainId:jr}=wr;await this.sendRequest({topic:Er,method:"wc_sessionEvent",params:{event:kr,chainId:jr}})},this.disconnect=async wr=>{await this.isInitialized(),await this.isValidDisconnect(wr);const{topic:Er}=wr;if(this.client.session.keys.includes(Er))await this.sendRequest({topic:Er,method:"wc_sessionDelete",params:U$3("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:Er,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(Er))await this.client.core.pairing.disconnect({topic:Er});else{const{message:kr}=N$2("MISMATCHED_TOPIC",`Session or pairing topic not found: ${Er}`);throw new Error(kr)}},this.find=wr=>(this.isInitialized(),this.client.session.getAll().filter(Er=>Mt$1(Er,wr))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.cleanupDuplicatePairings=async wr=>{if(wr.pairingTopic)try{const Er=this.client.core.pairing.pairings.get(wr.pairingTopic),kr=this.client.core.pairing.pairings.getAll().filter(jr=>{var Br,Wr;return((Br=jr.peerMetadata)==null?void 0:Br.url)&&((Wr=jr.peerMetadata)==null?void 0:Wr.url)===wr.peer.metadata.url&&jr.topic&&jr.topic!==Er.topic});if(kr.length===0)return;this.client.logger.info(`Cleaning up ${kr.length} duplicate pairing(s)`),await Promise.all(kr.map(jr=>this.client.core.pairing.disconnect({topic:jr.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(Er){this.client.logger.error(Er)}},this.deleteSession=async wr=>{const{topic:Er,expirerHasDeleted:kr=!1,emitEvent:jr=!0,id:Br=0}=wr,{self:Wr}=this.client.session.get(Er);await this.client.core.relayer.unsubscribe(Er),await this.client.session.delete(Er,U$3("USER_DISCONNECTED")),this.client.core.crypto.keychain.has(Wr.publicKey)&&await this.client.core.crypto.deleteKeyPair(Wr.publicKey),this.client.core.crypto.keychain.has(Er)&&await this.client.core.crypto.deleteSymKey(Er),kr||this.client.core.expirer.del(Er),this.client.core.storage.removeItem(H$1).catch(qr=>this.client.logger.warn(qr)),this.getPendingSessionRequests().forEach(qr=>{qr.topic===Er&&this.deletePendingSessionRequest(qr.id,U$3("USER_DISCONNECTED"))}),jr&&this.client.events.emit("session_delete",{id:Br,topic:Er})},this.deleteProposal=async(wr,Er)=>{await Promise.all([this.client.proposal.delete(wr,U$3("USER_DISCONNECTED")),Er?Promise.resolve():this.client.core.expirer.del(wr)])},this.deletePendingSessionRequest=async(wr,Er,kr=!1)=>{await Promise.all([this.client.pendingRequest.delete(wr,Er),kr?Promise.resolve():this.client.core.expirer.del(wr)]),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(jr=>jr.id!==wr),kr&&(this.sessionRequestQueue.state=I$1.idle,this.client.events.emit("session_request_expire",{id:wr}))},this.setExpiry=async(wr,Er)=>{this.client.session.keys.includes(wr)&&await this.client.session.update(wr,{expiry:Er}),this.client.core.expirer.set(wr,Er)},this.setProposal=async(wr,Er)=>{await this.client.proposal.set(wr,Er),this.client.core.expirer.set(wr,pt$1(R.wc_sessionPropose.req.ttl))},this.setPendingSessionRequest=async wr=>{const{id:Er,topic:kr,params:jr,verifyContext:Br}=wr,Wr=jr.request.expiryTimestamp||pt$1(R.wc_sessionRequest.req.ttl);await this.client.pendingRequest.set(Er,{id:Er,topic:kr,params:jr,verifyContext:Br}),Wr&&this.client.core.expirer.set(Er,Wr)},this.sendRequest=async wr=>{const{topic:Er,method:kr,params:jr,expiry:Br,relayRpcId:Wr,clientRpcId:qr,throwOnFailedPublish:Gr}=wr,Vr=formatJsonRpcRequest(kr,jr,qr);if(D$5()&&he.includes(kr)){const Qr=Ln(JSON.stringify(Vr));this.client.core.verify.register({attestationId:Qr})}const Zr=await this.client.core.crypto.encode(Er,Vr),Jr=R[kr].req;return Br&&(Jr.ttl=Br),Wr&&(Jr.id=Wr),this.client.core.history.set(Er,Vr),Gr?(Jr.internal=D$3(g$4({},Jr.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(Er,Zr,Jr)):this.client.core.relayer.publish(Er,Zr,Jr).catch(Qr=>this.client.logger.error(Qr)),Vr.id},this.sendResult=async wr=>{const{id:Er,topic:kr,result:jr,throwOnFailedPublish:Br}=wr,Wr=formatJsonRpcResult(Er,jr),qr=await this.client.core.crypto.encode(kr,Wr),Gr=await this.client.core.history.get(kr,Er),Vr=R[Gr.request.method].res;Br?(Vr.internal=D$3(g$4({},Vr.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(kr,qr,Vr)):this.client.core.relayer.publish(kr,qr,Vr).catch(Zr=>this.client.logger.error(Zr)),await this.client.core.history.resolve(Wr)},this.sendError=async(wr,Er,kr)=>{const jr=formatJsonRpcError(wr,kr),Br=await this.client.core.crypto.encode(Er,jr),Wr=await this.client.core.history.get(Er,wr),qr=R[Wr.request.method].res;this.client.core.relayer.publish(Er,Br,qr),await this.client.core.history.resolve(jr)},this.cleanup=async()=>{const wr=[],Er=[];this.client.session.getAll().forEach(kr=>{let jr=!1;mt$1(kr.expiry)&&(jr=!0),this.client.core.crypto.keychain.has(kr.topic)||(jr=!0),jr&&wr.push(kr.topic)}),this.client.proposal.getAll().forEach(kr=>{mt$1(kr.expiryTimestamp)&&Er.push(kr.id)}),await Promise.all([...wr.map(kr=>this.deleteSession({topic:kr})),...Er.map(kr=>this.deleteProposal(kr))])},this.onRelayEventRequest=async wr=>{this.requestQueue.queue.push(wr),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===I$1.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=I$1.active;const wr=this.requestQueue.queue.shift();if(wr)try{this.processRequest(wr),await new Promise(Er=>setTimeout(Er,300))}catch(Er){this.client.logger.warn(Er)}}this.requestQueue.state=I$1.idle},this.processRequest=wr=>{const{topic:Er,payload:kr}=wr,jr=kr.method;switch(jr){case"wc_sessionPropose":return this.onSessionProposeRequest(Er,kr);case"wc_sessionSettle":return this.onSessionSettleRequest(Er,kr);case"wc_sessionUpdate":return this.onSessionUpdateRequest(Er,kr);case"wc_sessionExtend":return this.onSessionExtendRequest(Er,kr);case"wc_sessionPing":return this.onSessionPingRequest(Er,kr);case"wc_sessionDelete":return this.onSessionDeleteRequest(Er,kr);case"wc_sessionRequest":return this.onSessionRequest(Er,kr);case"wc_sessionEvent":return this.onSessionEventRequest(Er,kr);default:return this.client.logger.info(`Unsupported request method ${jr}`)}},this.onRelayEventResponse=async wr=>{const{topic:Er,payload:kr}=wr,jr=(await this.client.core.history.get(Er,kr.id)).request.method;switch(jr){case"wc_sessionPropose":return this.onSessionProposeResponse(Er,kr);case"wc_sessionSettle":return this.onSessionSettleResponse(Er,kr);case"wc_sessionUpdate":return this.onSessionUpdateResponse(Er,kr);case"wc_sessionExtend":return this.onSessionExtendResponse(Er,kr);case"wc_sessionPing":return this.onSessionPingResponse(Er,kr);case"wc_sessionRequest":return this.onSessionRequestResponse(Er,kr);default:return this.client.logger.info(`Unsupported response method ${jr}`)}},this.onRelayEventUnknownPayload=wr=>{const{topic:Er}=wr,{message:kr}=N$2("MISSING_OR_INVALID",`Decoded payload on topic ${Er} is not identifiable as a JSON-RPC request or a response.`);throw new Error(kr)},this.onSessionProposeRequest=async(wr,Er)=>{const{params:kr,id:jr}=Er;try{this.isValidConnect(g$4({},Er.params));const Br=kr.expiryTimestamp||pt$1(R.wc_sessionPropose.req.ttl),Wr=g$4({id:jr,pairingTopic:wr,expiryTimestamp:Br},kr);await this.setProposal(jr,Wr);const qr=Ln(JSON.stringify(Er)),Gr=await this.getVerifyContext(qr,Wr.proposer.metadata);this.client.events.emit("session_proposal",{id:jr,params:Wr,verifyContext:Gr})}catch(Br){await this.sendError(jr,wr,Br),this.client.logger.error(Br)}},this.onSessionProposeResponse=async(wr,Er)=>{const{id:kr}=Er;if(isJsonRpcResult(Er)){const{result:jr}=Er;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:jr});const Br=this.client.proposal.get(kr);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:Br});const Wr=Br.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:Wr});const qr=jr.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:qr});const Gr=await this.client.core.crypto.generateSharedKey(Wr,qr);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:Gr});const Vr=await this.client.core.relayer.subscribe(Gr);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:Vr}),await this.client.core.pairing.activate({topic:wr})}else isJsonRpcError(Er)&&(await this.client.proposal.delete(kr,U$3("USER_DISCONNECTED")),this.events.emit(yt$1("session_connect"),{error:Er.error}))},this.onSessionSettleRequest=async(wr,Er)=>{const{id:kr,params:jr}=Er;try{this.isValidSessionSettleRequest(jr);const{relay:Br,controller:Wr,expiry:qr,namespaces:Gr,sessionProperties:Vr,pairingTopic:Zr}=Er.params,Jr=g$4({topic:wr,relay:Br,expiry:qr,namespaces:Gr,acknowledged:!0,pairingTopic:Zr,requiredNamespaces:{},optionalNamespaces:{},controller:Wr.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:Wr.publicKey,metadata:Wr.metadata}},Vr&&{sessionProperties:Vr});await this.sendResult({id:Er.id,topic:wr,result:!0}),this.events.emit(yt$1("session_connect"),{session:Jr}),this.cleanupDuplicatePairings(Jr)}catch(Br){await this.sendError(kr,wr,Br),this.client.logger.error(Br)}},this.onSessionSettleResponse=async(wr,Er)=>{const{id:kr}=Er;isJsonRpcResult(Er)?(await this.client.session.update(wr,{acknowledged:!0}),this.events.emit(yt$1("session_approve",kr),{})):isJsonRpcError(Er)&&(await this.client.session.delete(wr,U$3("USER_DISCONNECTED")),this.events.emit(yt$1("session_approve",kr),{error:Er.error}))},this.onSessionUpdateRequest=async(wr,Er)=>{const{params:kr,id:jr}=Er;try{const Br=`${wr}_session_update`,Wr=sr$1.get(Br);if(Wr&&this.isRequestOutOfSync(Wr,jr)){this.client.logger.info(`Discarding out of sync request - ${jr}`);return}this.isValidUpdate(g$4({topic:wr},kr)),await this.client.session.update(wr,{namespaces:kr.namespaces}),await this.sendResult({id:jr,topic:wr,result:!0}),this.client.events.emit("session_update",{id:jr,topic:wr,params:kr}),sr$1.set(Br,jr)}catch(Br){await this.sendError(jr,wr,Br),this.client.logger.error(Br)}},this.isRequestOutOfSync=(wr,Er)=>parseInt(Er.toString().slice(0,-3))<=parseInt(wr.toString().slice(0,-3)),this.onSessionUpdateResponse=(wr,Er)=>{const{id:kr}=Er;isJsonRpcResult(Er)?this.events.emit(yt$1("session_update",kr),{}):isJsonRpcError(Er)&&this.events.emit(yt$1("session_update",kr),{error:Er.error})},this.onSessionExtendRequest=async(wr,Er)=>{const{id:kr}=Er;try{this.isValidExtend({topic:wr}),await this.setExpiry(wr,pt$1(L$3)),await this.sendResult({id:kr,topic:wr,result:!0}),this.client.events.emit("session_extend",{id:kr,topic:wr})}catch(jr){await this.sendError(kr,wr,jr),this.client.logger.error(jr)}},this.onSessionExtendResponse=(wr,Er)=>{const{id:kr}=Er;isJsonRpcResult(Er)?this.events.emit(yt$1("session_extend",kr),{}):isJsonRpcError(Er)&&this.events.emit(yt$1("session_extend",kr),{error:Er.error})},this.onSessionPingRequest=async(wr,Er)=>{const{id:kr}=Er;try{this.isValidPing({topic:wr}),await this.sendResult({id:kr,topic:wr,result:!0}),this.client.events.emit("session_ping",{id:kr,topic:wr})}catch(jr){await this.sendError(kr,wr,jr),this.client.logger.error(jr)}},this.onSessionPingResponse=(wr,Er)=>{const{id:kr}=Er;setTimeout(()=>{isJsonRpcResult(Er)?this.events.emit(yt$1("session_ping",kr),{}):isJsonRpcError(Er)&&this.events.emit(yt$1("session_ping",kr),{error:Er.error})},500)},this.onSessionDeleteRequest=async(wr,Er)=>{const{id:kr}=Er;try{this.isValidDisconnect({topic:wr,reason:Er.params}),await Promise.all([new Promise(jr=>{this.client.core.relayer.once(D$4.publish,async()=>{jr(await this.deleteSession({topic:wr,id:kr}))})}),this.sendResult({id:kr,topic:wr,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:wr,error:U$3("USER_DISCONNECTED")})])}catch(jr){this.client.logger.error(jr)}},this.onSessionRequest=async(wr,Er)=>{const{id:kr,params:jr}=Er;try{this.isValidRequest(g$4({topic:wr},jr));const Br=Ln(JSON.stringify(formatJsonRpcRequest("wc_sessionRequest",jr,kr))),Wr=this.client.session.get(wr),qr=await this.getVerifyContext(Br,Wr.peer.metadata),Gr={id:kr,topic:wr,params:jr,verifyContext:qr};await this.setPendingSessionRequest(Gr),this.addSessionRequestToSessionRequestQueue(Gr),this.processSessionRequestQueue()}catch(Br){await this.sendError(kr,wr,Br),this.client.logger.error(Br)}},this.onSessionRequestResponse=(wr,Er)=>{const{id:kr}=Er;isJsonRpcResult(Er)?this.events.emit(yt$1("session_request",kr),{result:Er.result}):isJsonRpcError(Er)&&this.events.emit(yt$1("session_request",kr),{error:Er.error})},this.onSessionEventRequest=async(wr,Er)=>{const{id:kr,params:jr}=Er;try{const Br=`${wr}_session_event_${jr.event.name}`,Wr=sr$1.get(Br);if(Wr&&this.isRequestOutOfSync(Wr,kr)){this.client.logger.info(`Discarding out of sync request - ${kr}`);return}this.isValidEmit(g$4({topic:wr},jr)),this.client.events.emit("session_event",{id:kr,topic:wr,params:jr}),sr$1.set(Br,kr)}catch(Br){await this.sendError(kr,wr,Br),this.client.logger.error(Br)}},this.addSessionRequestToSessionRequestQueue=wr=>{this.sessionRequestQueue.queue.push(wr)},this.cleanupAfterResponse=wr=>{this.deletePendingSessionRequest(wr.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=I$1.idle,this.processSessionRequestQueue()},cjs$4.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:wr,error:Er})=>{const kr=this.client.core.history.pending;kr.length>0&&kr.filter(jr=>jr.topic===wr&&jr.request.method==="wc_sessionRequest").forEach(jr=>{this.events.emit(yt$1("session_request",jr.request.id),{error:Er})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===I$1.active){this.client.logger.info("session request queue is already active.");return}const wr=this.sessionRequestQueue.queue[0];if(!wr){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=I$1.active,this.client.events.emit("session_request",wr)}catch(Er){this.client.logger.error(Er)}},this.onPairingCreated=wr=>{if(wr.active)return;const Er=this.client.proposal.getAll().find(kr=>kr.pairingTopic===wr.topic);Er&&this.onSessionProposeRequest(wr.topic,formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:Er.requiredNamespaces,optionalNamespaces:Er.optionalNamespaces,relays:Er.relays,proposer:Er.proposer,sessionProperties:Er.sessionProperties},Er.id))},this.isValidConnect=async wr=>{if(!Gt$1(wr)){const{message:qr}=N$2("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(wr)}`);throw new Error(qr)}const{pairingTopic:Er,requiredNamespaces:kr,optionalNamespaces:jr,sessionProperties:Br,relays:Wr}=wr;if(w$5(Er)||await this.isValidPairingTopic(Er),!qt$1(Wr)){const{message:qr}=N$2("MISSING_OR_INVALID",`connect() relays: ${Wr}`);throw new Error(qr)}!w$5(kr)&&B$4(kr)!==0&&this.validateNamespaces(kr,"requiredNamespaces"),!w$5(jr)&&B$4(jr)!==0&&this.validateNamespaces(jr,"optionalNamespaces"),w$5(Br)||this.validateSessionProps(Br,"sessionProperties")},this.validateNamespaces=(wr,Er)=>{const kr=Ht$1(wr,"connect()",Er);if(kr)throw new Error(kr.message)},this.isValidApprove=async wr=>{if(!Gt$1(wr))throw new Error(N$2("MISSING_OR_INVALID",`approve() params: ${wr}`).message);const{id:Er,namespaces:kr,relayProtocol:jr,sessionProperties:Br}=wr;await this.isValidProposalId(Er);const Wr=this.client.proposal.get(Er),qr=ln(kr,"approve()");if(qr)throw new Error(qr.message);const Gr=fn(Wr.requiredNamespaces,kr,"approve()");if(Gr)throw new Error(Gr.message);if(!g$6(jr,!0)){const{message:Vr}=N$2("MISSING_OR_INVALID",`approve() relayProtocol: ${jr}`);throw new Error(Vr)}w$5(Br)||this.validateSessionProps(Br,"sessionProperties")},this.isValidReject=async wr=>{if(!Gt$1(wr)){const{message:jr}=N$2("MISSING_OR_INVALID",`reject() params: ${wr}`);throw new Error(jr)}const{id:Er,reason:kr}=wr;if(await this.isValidProposalId(Er),!Wt(kr)){const{message:jr}=N$2("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(kr)}`);throw new Error(jr)}},this.isValidSessionSettleRequest=wr=>{if(!Gt$1(wr)){const{message:Gr}=N$2("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${wr}`);throw new Error(Gr)}const{relay:Er,controller:kr,namespaces:jr,expiry:Br}=wr;if(!dn(Er)){const{message:Gr}=N$2("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(Gr)}const Wr=Ft$1(kr,"onSessionSettleRequest()");if(Wr)throw new Error(Wr.message);const qr=ln(jr,"onSessionSettleRequest()");if(qr)throw new Error(qr.message);if(mt$1(Br)){const{message:Gr}=N$2("EXPIRED","onSessionSettleRequest()");throw new Error(Gr)}},this.isValidUpdate=async wr=>{if(!Gt$1(wr)){const{message:qr}=N$2("MISSING_OR_INVALID",`update() params: ${wr}`);throw new Error(qr)}const{topic:Er,namespaces:kr}=wr;await this.isValidSessionTopic(Er);const jr=this.client.session.get(Er),Br=ln(kr,"update()");if(Br)throw new Error(Br.message);const Wr=fn(jr.requiredNamespaces,kr,"update()");if(Wr)throw new Error(Wr.message)},this.isValidExtend=async wr=>{if(!Gt$1(wr)){const{message:kr}=N$2("MISSING_OR_INVALID",`extend() params: ${wr}`);throw new Error(kr)}const{topic:Er}=wr;await this.isValidSessionTopic(Er)},this.isValidRequest=async wr=>{if(!Gt$1(wr)){const{message:qr}=N$2("MISSING_OR_INVALID",`request() params: ${wr}`);throw new Error(qr)}const{topic:Er,request:kr,chainId:jr,expiry:Br}=wr;await this.isValidSessionTopic(Er);const{namespaces:Wr}=this.client.session.get(Er);if(!Qt(Wr,jr)){const{message:qr}=N$2("MISSING_OR_INVALID",`request() chainId: ${jr}`);throw new Error(qr)}if(!zt$1(kr)){const{message:qr}=N$2("MISSING_OR_INVALID",`request() ${JSON.stringify(kr)}`);throw new Error(qr)}if(!Zt(Wr,jr,kr.method)){const{message:qr}=N$2("MISSING_OR_INVALID",`request() method: ${kr.method}`);throw new Error(qr)}if(Br&&!tr$1(Br,U$2)){const{message:qr}=N$2("MISSING_OR_INVALID",`request() expiry: ${Br}. Expiry must be a number (in seconds) between ${U$2.min} and ${U$2.max}`);throw new Error(qr)}},this.isValidRespond=async wr=>{var Er;if(!Gt$1(wr)){const{message:Br}=N$2("MISSING_OR_INVALID",`respond() params: ${wr}`);throw new Error(Br)}const{topic:kr,response:jr}=wr;try{await this.isValidSessionTopic(kr)}catch(Br){throw(Er=wr==null?void 0:wr.response)!=null&&Er.id&&this.cleanupAfterResponse(wr),Br}if(!Yt$1(jr)){const{message:Br}=N$2("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(jr)}`);throw new Error(Br)}},this.isValidPing=async wr=>{if(!Gt$1(wr)){const{message:kr}=N$2("MISSING_OR_INVALID",`ping() params: ${wr}`);throw new Error(kr)}const{topic:Er}=wr;await this.isValidSessionOrPairingTopic(Er)},this.isValidEmit=async wr=>{if(!Gt$1(wr)){const{message:Wr}=N$2("MISSING_OR_INVALID",`emit() params: ${wr}`);throw new Error(Wr)}const{topic:Er,event:kr,chainId:jr}=wr;await this.isValidSessionTopic(Er);const{namespaces:Br}=this.client.session.get(Er);if(!Qt(Br,jr)){const{message:Wr}=N$2("MISSING_OR_INVALID",`emit() chainId: ${jr}`);throw new Error(Wr)}if(!Jt$1(kr)){const{message:Wr}=N$2("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(kr)}`);throw new Error(Wr)}if(!Xt(Br,jr,kr.name)){const{message:Wr}=N$2("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(kr)}`);throw new Error(Wr)}},this.isValidDisconnect=async wr=>{if(!Gt$1(wr)){const{message:kr}=N$2("MISSING_OR_INVALID",`disconnect() params: ${wr}`);throw new Error(kr)}const{topic:Er}=wr;await this.isValidSessionOrPairingTopic(Er)},this.getVerifyContext=async(wr,Er)=>{const kr={verified:{verifyUrl:Er.verifyUrl||F$3,validation:"UNKNOWN",origin:Er.url||""}};try{const jr=await this.client.core.verify.resolve({attestationId:wr,verifyUrl:Er.verifyUrl});jr&&(kr.verified.origin=jr.origin,kr.verified.isScam=jr.isScam,kr.verified.validation=jr.origin===new URL(Er.url).origin?"VALID":"INVALID")}catch(jr){this.client.logger.info(jr)}return this.client.logger.info(`Verify context: ${JSON.stringify(kr)}`),kr},this.validateSessionProps=(wr,Er)=>{Object.values(wr).forEach(kr=>{if(!g$6(kr,!1)){const{message:jr}=N$2("MISSING_OR_INVALID",`${Er} must be in Record format. Received: ${JSON.stringify(kr)}`);throw new Error(jr)}})}}async isInitialized(){if(!this.initialized){const{message:br}=N$2("NOT_INITIALIZED",this.name);throw new Error(br)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(D$4.message,async br=>{const{topic:wr,message:Er}=br;if(this.ignoredPayloadTypes.includes(this.client.core.crypto.getPayloadType(Er)))return;const kr=await this.client.core.crypto.decode(wr,Er);try{isJsonRpcRequest(kr)?(this.client.core.history.set(wr,kr),this.onRelayEventRequest({topic:wr,payload:kr})):isJsonRpcResponse(kr)?(await this.client.core.history.resolve(kr),await this.onRelayEventResponse({topic:wr,payload:kr}),this.client.core.history.delete(wr,kr.id)):this.onRelayEventUnknownPayload({topic:wr,payload:kr})}catch(jr){this.client.logger.error(jr)}})}registerExpirerEvents(){this.client.core.expirer.on(v$4.expired,async br=>{const{topic:wr,id:Er}=ft$2(br.target);if(Er&&this.client.pendingRequest.keys.includes(Er))return await this.deletePendingSessionRequest(Er,N$2("EXPIRED"),!0);wr?this.client.session.keys.includes(wr)&&(await this.deleteSession({topic:wr,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:wr})):Er&&(await this.deleteProposal(Er,!0),this.client.events.emit("proposal_expire",{id:Er}))})}registerPairingEvents(){this.client.core.pairing.events.on(V$1.create,br=>this.onPairingCreated(br))}isValidPairingTopic(br){if(!g$6(br,!1)){const{message:wr}=N$2("MISSING_OR_INVALID",`pairing topic should be a string: ${br}`);throw new Error(wr)}if(!this.client.core.pairing.pairings.keys.includes(br)){const{message:wr}=N$2("NO_MATCHING_KEY",`pairing topic doesn't exist: ${br}`);throw new Error(wr)}if(mt$1(this.client.core.pairing.pairings.get(br).expiry)){const{message:wr}=N$2("EXPIRED",`pairing topic: ${br}`);throw new Error(wr)}}async isValidSessionTopic(br){if(!g$6(br,!1)){const{message:wr}=N$2("MISSING_OR_INVALID",`session topic should be a string: ${br}`);throw new Error(wr)}if(!this.client.session.keys.includes(br)){const{message:wr}=N$2("NO_MATCHING_KEY",`session topic doesn't exist: ${br}`);throw new Error(wr)}if(mt$1(this.client.session.get(br).expiry)){await this.deleteSession({topic:br});const{message:wr}=N$2("EXPIRED",`session topic: ${br}`);throw new Error(wr)}if(!this.client.core.crypto.keychain.has(br)){const{message:wr}=N$2("MISSING_OR_INVALID",`session topic does not exist in keychain: ${br}`);throw await this.deleteSession({topic:br}),new Error(wr)}}async isValidSessionOrPairingTopic(br){if(this.client.session.keys.includes(br))await this.isValidSessionTopic(br);else if(this.client.core.pairing.pairings.keys.includes(br))this.isValidPairingTopic(br);else if(g$6(br,!1)){const{message:wr}=N$2("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${br}`);throw new Error(wr)}else{const{message:wr}=N$2("MISSING_OR_INVALID",`session or pairing topic should be a string: ${br}`);throw new Error(wr)}}async isValidProposalId(br){if(!Bt$1(br)){const{message:wr}=N$2("MISSING_OR_INVALID",`proposal id should be a number: ${br}`);throw new Error(wr)}if(!this.client.proposal.keys.includes(br)){const{message:wr}=N$2("NO_MATCHING_KEY",`proposal id doesn't exist: ${br}`);throw new Error(wr)}if(mt$1(this.client.proposal.get(br).expiryTimestamp)){await this.deleteProposal(br);const{message:wr}=N$2("EXPIRED",`proposal id: ${br}`);throw new Error(wr)}}}class us extends Kt{constructor(br,wr){super(br,wr,oe$1,G$1),this.core=br,this.logger=wr}}let ge$1=class extends Kt{constructor(br,wr){super(br,wr,ce,G$1),this.core=br,this.logger=wr}};class gs extends Kt{constructor(br,wr){super(br,wr,pe,G$1,Er=>Er.id),this.core=br,this.logger=wr}}let Q$1=class uS extends b$3{constructor(br){super(br),this.protocol=J,this.version=F$2,this.name=M$2.name,this.events=new eventsExports.EventEmitter,this.on=(Er,kr)=>this.events.on(Er,kr),this.once=(Er,kr)=>this.events.once(Er,kr),this.off=(Er,kr)=>this.events.off(Er,kr),this.removeListener=(Er,kr)=>this.events.removeListener(Er,kr),this.removeAllListeners=Er=>this.events.removeAllListeners(Er),this.connect=async Er=>{try{return await this.engine.connect(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.pair=async Er=>{try{return await this.engine.pair(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.approve=async Er=>{try{return await this.engine.approve(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.reject=async Er=>{try{return await this.engine.reject(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.update=async Er=>{try{return await this.engine.update(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.extend=async Er=>{try{return await this.engine.extend(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.request=async Er=>{try{return await this.engine.request(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.respond=async Er=>{try{return await this.engine.respond(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.ping=async Er=>{try{return await this.engine.ping(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.emit=async Er=>{try{return await this.engine.emit(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.disconnect=async Er=>{try{return await this.engine.disconnect(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.find=Er=>{try{return this.engine.find(Er)}catch(kr){throw this.logger.error(kr.message),kr}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(Er){throw this.logger.error(Er.message),Er}},this.name=(br==null?void 0:br.name)||M$2.name,this.metadata=(br==null?void 0:br.metadata)||Qn();const wr=typeof(br==null?void 0:br.logger)<"u"&&typeof(br==null?void 0:br.logger)!="string"?br.logger:Hg(k$4({level:(br==null?void 0:br.logger)||M$2.logger}));this.core=(br==null?void 0:br.core)||new Mr(br),this.logger=E$4(wr,this.name),this.session=new ge$1(this.core,this.logger),this.proposal=new us(this.core,this.logger),this.pendingRequest=new gs(this.core,this.logger),this.engine=new ds(this)}static async init(br){const wr=new uS(br);return await wr.initialize(),wr}get context(){return y$4(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(br){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(br.message),br}}};const K=":";function ve(fr){const[br,wr]=fr.split(K);return{namespace:br,reference:wr}}function S$2(fr=[],br=[]){return[...new Set([...fr,...br])]}function oe(fr){return fr.includes(":")}function en(fr){return oe(fr)?fr.split(":")[0]:fr}const nn={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}};function U$1(fr,br){const{message:wr,code:Er}=nn[fr];return{message:br?`${wr} ${br}`:wr,code:Er}}function k$2(fr,br){return!!Array.isArray(fr)}function B$2(fr){return Object.getPrototypeOf(fr)===Object.prototype&&Object.keys(fr).length}var P$3=Object.defineProperty,w$2=Object.defineProperties,E$2=Object.getOwnPropertyDescriptors,c$2=Object.getOwnPropertySymbols,L$2=Object.prototype.hasOwnProperty,O$2=Object.prototype.propertyIsEnumerable,l$2=(fr,br,wr)=>br in fr?P$3(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,p$3=(fr,br)=>{for(var wr in br||(br={}))L$2.call(br,wr)&&l$2(fr,wr,br[wr]);if(c$2)for(var wr of c$2(br))O$2.call(br,wr)&&l$2(fr,wr,br[wr]);return fr},v$3=(fr,br)=>w$2(fr,E$2(br));const j$3={Accept:"application/json","Content-Type":"application/json"},T$2="POST",d$2={headers:j$3,method:T$2},g$3=10;let f$4=class{constructor(br,wr=!1){if(this.url=br,this.disableProviderPing=wr,this.events=new eventsExports.EventEmitter,this.isAvailable=!1,this.registering=!1,!isHttpUrl(br))throw new Error(`Provided URL is not compatible with HTTP connection: ${br}`);this.url=br,this.disableProviderPing=wr}get connected(){return this.isAvailable}get connecting(){return this.registering}on(br,wr){this.events.on(br,wr)}once(br,wr){this.events.once(br,wr)}off(br,wr){this.events.off(br,wr)}removeListener(br,wr){this.events.removeListener(br,wr)}async open(br=this.url){await this.register(br)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(br){this.isAvailable||await this.register();try{const wr=safeJsonStringify(br),Er=await(await o$2(this.url,v$3(p$3({},d$2),{body:wr}))).json();this.onPayload({data:Er})}catch(wr){this.onError(br.id,wr)}}async register(br=this.url){if(!isHttpUrl(br))throw new Error(`Provided URL is not compatible with HTTP connection: ${br}`);if(this.registering){const wr=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=wr||this.events.listenerCount("open")>=wr)&&this.events.setMaxListeners(wr+1),new Promise((Er,kr)=>{this.events.once("register_error",jr=>{this.resetMaxListeners(),kr(jr)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return kr(new Error("HTTP connection is missing or invalid"));Er()})})}this.url=br,this.registering=!0;try{if(!this.disableProviderPing){const wr=safeJsonStringify({id:1,jsonrpc:"2.0",method:"test",params:[]});await o$2(br,v$3(p$3({},d$2),{body:wr}))}this.onOpen()}catch(wr){const Er=this.parseError(wr);throw this.events.emit("register_error",Er),this.onClose(),Er}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(br){if(typeof br.data>"u")return;const wr=typeof br.data=="string"?safeJsonParse(br.data):br.data;this.events.emit("payload",wr)}onError(br,wr){const Er=this.parseError(wr),kr=Er.message||Er.toString(),jr=formatJsonRpcError(br,kr);this.events.emit("payload",jr)}parseError(br,wr=this.url){return parseConnectionError(br,wr,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>g$3&&this.events.setMaxListeners(g$3)}};class JsonRpcProvider extends r$3{constructor(br){super(br),this.events=new eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(br),this.connection.connected&&this.registerEventListeners()}async connect(br=this.connection){await this.open(br)}async disconnect(){await this.close()}on(br,wr){this.events.on(br,wr)}once(br,wr){this.events.once(br,wr)}off(br,wr){this.events.off(br,wr)}removeListener(br,wr){this.events.removeListener(br,wr)}async request(br,wr){return this.requestStrict(formatJsonRpcRequest(br.method,br.params||[],br.id||getBigIntRpcId().toString()),wr)}async requestStrict(br,wr){return new Promise(async(Er,kr)=>{if(!this.connection.connected)try{await this.open()}catch(jr){kr(jr)}this.events.on(`${br.id}`,jr=>{isJsonRpcError(jr)?kr(jr.error):Er(jr.result)});try{await this.connection.send(br,wr)}catch(jr){kr(jr)}})}setConnection(br=this.connection){return br}onPayload(br){this.events.emit("payload",br),isJsonRpcResponse(br)?this.events.emit(`${br.id}`,br):this.events.emit("message",{type:br.method,data:br.params})}onClose(br){br&&br.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${br.code} ${br.reason?`(${br.reason})`:""}`)),this.events.emit("disconnect")}async open(br=this.connection){this.connection===br&&this.connection.connected||(this.connection.connected&&this.close(),typeof br=="string"&&(await this.connection.open(br),br=this.connection),this.connection=this.setConnection(br),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",br=>this.onPayload(br)),this.connection.on("close",br=>this.onClose(br)),this.connection.on("error",br=>this.events.emit("error",br)),this.connection.on("register_error",br=>this.onClose()),this.hasRegisteredEventListeners=!0)}}const Ia="error",Fg="wss://relay.walletconnect.com",Mg="wc",qg="universal_provider",xa=`${Mg}@2:${qg}:`,Bg="https://rpc.walletconnect.com/v1/",Vn={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var ge=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global$1<"u"?global$1:typeof self<"u"?self:{},Ui={exports:{}};/** * @license * Lodash * Copyright OpenJS Foundation and other contributors * Released under MIT license * Based on Underscore.js 1.8.3 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -*/(function(fr,br){(function(){var wr,Er="4.17.21",kr=200,jr="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",Br="Expected a function",Wr="Invalid `variable` option passed into `_.template`",qr="__lodash_hash_undefined__",Gr=500,Vr="__lodash_placeholder__",Zr=1,Jr=2,Qr=4,_n=1,En=2,Cn=1,In=2,An=4,jn=8,eo=16,ro=32,to=64,_i=128,oo=256,io=512,co=30,so="...",no=800,Tn=16,Hr=1,Xr=2,Sn=3,Rn=1/0,Pn=9007199254740991,On=17976931348623157e292,Zn=NaN,Nn=4294967295,wn=Nn-1,zn=Nn>>>1,fo=[["ary",_i],["bind",Cn],["bindKey",In],["curry",jn],["curryRight",eo],["flip",io],["partial",ro],["partialRight",to],["rearg",oo]],vo="[object Arguments]",go="[object Array]",uo="[object AsyncFunction]",lo="[object Boolean]",Eo="[object Date]",mo="[object DOMException]",yo="[object Error]",_o="[object Function]",Bo="[object GeneratorFunction]",Lo="[object Map]",Wo="[object Number]",na="[object Null]",qo="[object Object]",ga="[object Promise]",wl="[object Proxy]",No="[object RegExp]",Fo="[object Set]",Nl="[object String]",Vo="[object Symbol]",Uo="[object Undefined]",Ml="[object WeakMap]",$a="[object WeakSet]",Jo="[object ArrayBuffer]",Zl="[object DataView]",Cl="[object Float32Array]",ko="[object Float64Array]",wo="[object Int8Array]",bo="[object Int16Array]",Io="[object Int32Array]",Ho="[object Uint8Array]",Do="[object Uint8ClampedArray]",zo="[object Uint16Array]",nu="[object Uint32Array]",Ll=/\b__p \+= '';/g,_l=/\b(__p \+=) '' \+/g,bu=/(__e\(.*?\)|\b__t\)) \+\n'';/g,xl=/&(?:amp|lt|gt|quot|#39);/g,Tl=/[&<>"']/g,du=RegExp(xl.source),Bl=RegExp(Tl.source),Il=/<%-([\s\S]+?)%>/g,Eu=/<%([\s\S]+?)%>/g,Al=/<%=([\s\S]+?)%>/g,Ol=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Tu=/^\w*$/,Ul=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Sl=/[\\^$.*+?()[\]{}|]/g,_u=RegExp(Sl.source),So=/^\s+/,Co=/\s/,Ao=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,po=/\{\n\/\* \[wrapped with (.+)\] \*/,Ro=/,? & /,Xo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,jo=/[()=,{}\[\]\/\s]/,Ko=/\\(\\)?/g,Wl=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,$l=/\w*$/,El=/^[-+]0x[0-9a-f]+$/i,Cu=/^0b[01]+$/i,iu=/^\[object .+?Constructor\]$/,pu=/^0o[0-7]+$/i,yu=/^(?:0|[1-9]\d*)$/,hu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,mu=/($^)/,vu=/['\n\r\u2028\u2029\\]/g,fu="\\ud800-\\udfff",gu="\\u0300-\\u036f",ou="\\ufe20-\\ufe2f",su="\\u20d0-\\u20ff",tu=gu+ou+su,zl="\\u2700-\\u27bf",Gl="a-z\\xdf-\\xf6\\xf8-\\xff",Jl="\\xac\\xb1\\xd7\\xf7",Pl="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Fl="\\u2000-\\u206f",Yl=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Vl="A-Z\\xc0-\\xd6\\xd8-\\xde",Ql="\\ufe0e\\ufe0f",au=Jl+Pl+Fl+Yl,Nu="['’]",Wu="["+fu+"]",zu="["+au+"]",Bu="["+tu+"]",Qo="\\d+",Zu="["+zl+"]",Qu="["+Gl+"]",_h="[^"+fu+au+Qo+zl+Gl+Vl+"]",qu="\\ud83c[\\udffb-\\udfff]",Ju="(?:"+Bu+"|"+qu+")",_d="[^"+fu+"]",dp="(?:\\ud83c[\\udde6-\\uddff]){2}",Ku="[\\ud800-\\udbff][\\udc00-\\udfff]",Vu="["+Vl+"]",cp="\\u200d",fp="(?:"+Qu+"|"+_h+")",lp="(?:"+Vu+"|"+_h+")",np="(?:"+Nu+"(?:d|ll|m|re|s|t|ve))?",Rp="(?:"+Nu+"(?:D|LL|M|RE|S|T|VE))?",wp=Ju+"?",a0="["+Ql+"]?",ey="(?:"+cp+"(?:"+[_d,dp,Ku].join("|")+")"+a0+wp+")*",ym="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",s0="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",c0=a0+wp+ey,l0="(?:"+[Zu,dp,Ku].join("|")+")"+c0,d0="(?:"+[_d+Bu+"?",Bu,dp,Ku,Wu].join("|")+")",ty=RegExp(Nu,"g"),Rm=RegExp(Bu,"g"),qm=RegExp(qu+"(?="+qu+")|"+d0+c0,"g"),f0=RegExp([Vu+"?"+Qu+"+"+np+"(?="+[zu,Vu,"$"].join("|")+")",lp+"+"+Rp+"(?="+[zu,Vu+fp,"$"].join("|")+")",Vu+"?"+fp+"+"+np,Vu+"+"+Rp,s0,ym,Qo,l0].join("|"),"g"),h0=RegExp("["+cp+fu+tu+Ql+"]"),zm=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,p0=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ry=-1,Lu={};Lu[Cl]=Lu[ko]=Lu[wo]=Lu[bo]=Lu[Io]=Lu[Ho]=Lu[Do]=Lu[zo]=Lu[nu]=!0,Lu[vo]=Lu[go]=Lu[Jo]=Lu[lo]=Lu[Zl]=Lu[Eo]=Lu[yo]=Lu[_o]=Lu[Lo]=Lu[Wo]=Lu[qo]=Lu[No]=Lu[Fo]=Lu[Nl]=Lu[Ml]=!1;var Du={};Du[vo]=Du[go]=Du[Jo]=Du[Zl]=Du[lo]=Du[Eo]=Du[Cl]=Du[ko]=Du[wo]=Du[bo]=Du[Io]=Du[Lo]=Du[Wo]=Du[qo]=Du[No]=Du[Fo]=Du[Nl]=Du[Vo]=Du[Ho]=Du[Do]=Du[zo]=Du[nu]=!0,Du[yo]=Du[_o]=Du[Ml]=!1;var Zo={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Dl={"&":"&","<":"<",">":">",'"':""","'":"'"},ru={"&":"&","<":"<",">":">",""":'"',"'":"'"},Au={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Yu=parseFloat,Xu=parseInt,Cp=typeof ge=="object"&&ge&&ge.Object===Object&&ge,Kp=typeof self=="object"&&self&&self.Object===Object&&self,Hu=Cp||Kp||Function("return this")(),gp=br&&!br.nodeType&&br,_p=gp&&!0&&fr&&!fr.nodeType&&fr,sm=_p&&_p.exports===gp,Wp=sm&&Cp.process,ap=function(){try{var Oo=_p&&_p.require&&_p.require("util").types;return Oo||Wp&&Wp.binding&&Wp.binding("util")}catch{}}(),am=ap&&ap.isArrayBuffer,Cm=ap&&ap.isDate,vm=ap&&ap.isMap,Tm=ap&&ap.isRegExp,ny=ap&&ap.isSet,u0=ap&&ap.isTypedArray;function mp(Oo,Yo,Go){switch(Go.length){case 0:return Oo.call(Yo);case 1:return Oo.call(Yo,Go[0]);case 2:return Oo.call(Yo,Go[0],Go[1]);case 3:return Oo.call(Yo,Go[0],Go[1],Go[2])}return Oo.apply(Yo,Go)}function Cx(Oo,Yo,Go,Xl){for(var xu=-1,Ou=Oo==null?0:Oo.length;++xu-1}function oy(Oo,Yo,Go){for(var Xl=-1,xu=Oo==null?0:Oo.length;++Xl-1;);return Go}function E1(Oo,Yo){for(var Go=Oo.length;Go--&&Im(Yo,Oo[Go],0)>-1;);return Go}function jx(Oo,Yo){for(var Go=Oo.length,Xl=0;Go--;)Oo[Go]===Yo&&++Xl;return Xl}var Bx=ly(Zo),Dx=ly(Dl);function Lx(Oo){return"\\"+Au[Oo]}function Fx(Oo,Yo){return Oo==null?wr:Oo[Yo]}function Am(Oo){return h0.test(Oo)}function Ux(Oo){return zm.test(Oo)}function Wx(Oo){for(var Yo,Go=[];!(Yo=Oo.next()).done;)Go.push(Yo.value);return Go}function hy(Oo){var Yo=-1,Go=Array(Oo.size);return Oo.forEach(function(Xl,xu){Go[++Yo]=[xu,Xl]}),Go}function $1(Oo,Yo){return function(Go){return Oo(Yo(Go))}}function um(Oo,Yo){for(var Go=-1,Xl=Oo.length,xu=0,Ou=[];++Go-1}function Tw(Yr,$n){var Yn=this.__data__,ao=P0(Yn,Yr);return ao<0?(++this.size,Yn.push([Yr,$n])):Yn[ao][1]=$n,this}Yp.prototype.clear=Sw,Yp.prototype.delete=kw,Yp.prototype.get=Cw,Yp.prototype.has=Rw,Yp.prototype.set=Tw;function Xp(Yr){var $n=-1,Yn=Yr==null?0:Yr.length;for(this.clear();++$n=$n?Yr:$n)),Yr}function Bp(Yr,$n,Yn,ao,ho,$o){var To,Po=$n&Zr,Mo=$n&Jr,_c=$n&Qr;if(Yn&&(To=ho?Yn(Yr,ao,ho,$o):Yn(Yr)),To!==wr)return To;if(!_f(Yr))return Yr;var yl=wu(Yr);if(yl){if(To=N_(Yr),!Po)return Ep(Yr,To)}else{var Rl=pp(Yr),Hl=Rl==_o||Rl==Bo;if(gm(Yr))return vv(Yr,Po);if(Rl==qo||Rl==vo||Hl&&!ho){if(To=Mo||Hl?{}:Bv(Yr),!Po)return Mo?__(Yr,Vw(To,Yr)):w_(Yr,j1(To,Yr))}else{if(!Du[Rl])return ho?Yr:{};To=O_(Yr,Rl,Po)}}$o||($o=new zp);var eu=$o.get(Yr);if(eu)return eu;$o.set(Yr,To),fx(Yr)?Yr.forEach(function(uu){To.add(Bp(uu,$n,Yn,uu,Yr,$o))}):ux(Yr)&&Yr.forEach(function(uu,Ru){To.set(Ru,Bp(uu,$n,Yn,Ru,Yr,$o))});var lu=_c?Mo?Ly:Dy:Mo?Sp:sp,Su=yl?wr:lu(Yr);return Op(Su||Yr,function(uu,Ru){Su&&(Ru=uu,uu=Yr[Ru]),Ym(To,Ru,Bp(uu,$n,Yn,Ru,Yr,$o))}),To}function Hw(Yr){var $n=sp(Yr);return function(Yn){return B1(Yn,Yr,$n)}}function B1(Yr,$n,Yn){var ao=Yn.length;if(Yr==null)return!ao;for(Yr=Fu(Yr);ao--;){var ho=Yn[ao],$o=$n[ho],To=Yr[ho];if(To===wr&&!(ho in Yr)||!$o(To))return!1}return!0}function D1(Yr,$n,Yn){if(typeof Yr!="function")throw new Mp(Br);return i0(function(){Yr.apply(wr,Yn)},$n)}function Xm(Yr,$n,Yn,ao){var ho=-1,$o=m0,To=!0,Po=Yr.length,Mo=[],_c=$n.length;if(!Po)return Mo;Yn&&($n=Gu($n,Tp(Yn))),ao?($o=oy,To=!1):$n.length>=kr&&($o=Vm,To=!1,$n=new wm($n));e:for(;++hoho?0:ho+Yn),ao=ao===wr||ao>ho?ho:$u(ao),ao<0&&(ao+=ho),ao=Yn>ao?0:px(ao);Yn0&&Yn(Po)?$n>1?up(Po,$n-1,Yn,ao,ho):lm(ho,Po):ao||(ho[ho.length]=Po)}return ho}var xy=$v(),U1=$v(!0);function Gp(Yr,$n){return Yr&&xy(Yr,$n,sp)}function wy(Yr,$n){return Yr&&U1(Yr,$n,sp)}function O0(Yr,$n){return cm($n,function(Yn){return nm(Yr[Yn])})}function Em(Yr,$n){$n=pm($n,Yr);for(var Yn=0,ao=$n.length;Yr!=null&&Yn$n}function Zw(Yr,$n){return Yr!=null&&ju.call(Yr,$n)}function Jw(Yr,$n){return Yr!=null&&$n in Fu(Yr)}function Yw(Yr,$n,Yn){return Yr>=hp($n,Yn)&&Yr=120&&yl.length>=120)?new wm(To&&yl):wr}yl=Yr[0];var Rl=-1,Hl=Po[0];e:for(;++Rl-1;)Po!==Yr&&S0.call(Po,Mo,1),S0.call(Yr,Mo,1);return Yr}function X1(Yr,$n){for(var Yn=Yr?$n.length:0,ao=Yn-1;Yn--;){var ho=$n[Yn];if(Yn==ao||ho!==$o){var $o=ho;rm(ho)?S0.call(Yr,ho,1):Ay(Yr,ho)}}return Yr}function Ry(Yr,$n){return Yr+R0(P1()*($n-Yr+1))}function u_(Yr,$n,Yn,ao){for(var ho=-1,$o=op(C0(($n-Yr)/(Yn||1)),0),To=Go($o);$o--;)To[ao?$o:++ho]=Yr,Yr+=Yn;return To}function Ty(Yr,$n){var Yn="";if(!Yr||$n<1||$n>Pn)return Yn;do $n%2&&(Yn+=Yr),$n=R0($n/2),$n&&(Yr+=Yr);while($n);return Yn}function ku(Yr,$n){return Hy(Fv(Yr,$n,kp),Yr+"")}function d_(Yr){return M1(Wm(Yr))}function f_(Yr,$n){var Yn=Wm(Yr);return V0(Yn,_m($n,0,Yn.length))}function t0(Yr,$n,Yn,ao){if(!_f(Yr))return Yr;$n=pm($n,Yr);for(var ho=-1,$o=$n.length,To=$o-1,Po=Yr;Po!=null&&++ho<$o;){var Mo=Jp($n[ho]),_c=Yn;if(Mo==="__proto__"||Mo==="constructor"||Mo==="prototype")return Yr;if(ho!=To){var yl=Po[Mo];_c=ao?ao(yl,Mo,Po):wr,_c===wr&&(_c=_f(yl)?yl:rm($n[ho+1])?[]:{})}Ym(Po,Mo,_c),Po=Po[Mo]}return Yr}var Q1=T0?function(Yr,$n){return T0.set(Yr,$n),Yr}:kp,h_=k0?function(Yr,$n){return k0(Yr,"toString",{configurable:!0,enumerable:!1,value:r1($n),writable:!0})}:kp;function p_(Yr){return V0(Wm(Yr))}function Dp(Yr,$n,Yn){var ao=-1,ho=Yr.length;$n<0&&($n=-$n>ho?0:ho+$n),Yn=Yn>ho?ho:Yn,Yn<0&&(Yn+=ho),ho=$n>Yn?0:Yn-$n>>>0,$n>>>=0;for(var $o=Go(ho);++ao>>1,To=Yr[$o];To!==null&&!Ap(To)&&(Yn?To<=$n:To<$n)?ao=$o+1:ho=$o}return ho}return Iy(Yr,$n,kp,Yn)}function Iy(Yr,$n,Yn,ao){var ho=0,$o=Yr==null?0:Yr.length;if($o===0)return 0;$n=Yn($n);for(var To=$n!==$n,Po=$n===null,Mo=Ap($n),_c=$n===wr;ho<$o;){var yl=R0((ho+$o)/2),Rl=Yn(Yr[yl]),Hl=Rl!==wr,eu=Rl===null,lu=Rl===Rl,Su=Ap(Rl);if(To)var uu=ao||lu;else _c?uu=lu&&(ao||Hl):Po?uu=lu&&Hl&&(ao||!eu):Mo?uu=lu&&Hl&&!eu&&(ao||!Su):eu||Su?uu=!1:uu=ao?Rl<=$n:Rl<$n;uu?ho=yl+1:$o=yl}return hp($o,wn)}function lv(Yr,$n){for(var Yn=-1,ao=Yr.length,ho=0,$o=[];++Yn=kr){var _c=$n?null:k_(Yr);if(_c)return y0(_c);To=!1,ho=Vm,Mo=new wm}else Mo=$n?[]:Po;e:for(;++ao<$o;){var yl=Yr[ao],Rl=$n?$n(yl):yl;if(yl=Yn||yl!==0?yl:0,To&&Rl===Rl){for(var Hl=Mo.length;Hl--;)if(Mo[Hl]===Rl)continue e;$n&&Mo.push(Rl),Po.push(yl)}else ho(Mo,Rl,Yn)||(Mo!==Po&&Mo.push(Rl),Po.push(yl))}return Po}function Ay(Yr,$n){return $n=pm($n,Yr),Yr=Uv(Yr,$n),Yr==null||delete Yr[Jp(Lp($n))]}function pv(Yr,$n,Yn,ao){return t0(Yr,$n,Yn(Em(Yr,$n)),ao)}function B0(Yr,$n,Yn,ao){for(var ho=Yr.length,$o=ao?ho:-1;(ao?$o--:++$o=ao?Yr:Dp(Yr,$n,Yn)}var yv=nw||function(Yr){return Hu.clearTimeout(Yr)};function vv(Yr,$n){if($n)return Yr.slice();var Yn=Yr.length,ao=C1?C1(Yn):new Yr.constructor(Yn);return Yr.copy(ao),ao}function My(Yr){var $n=new Yr.constructor(Yr.byteLength);return new E0($n).set(new E0(Yr)),$n}function y_(Yr,$n){var Yn=$n?My(Yr.buffer):Yr.buffer;return new Yr.constructor(Yn,Yr.byteOffset,Yr.byteLength)}function v_(Yr){var $n=new Yr.constructor(Yr.source,$l.exec(Yr));return $n.lastIndex=Yr.lastIndex,$n}function b_(Yr){return Jm?Fu(Jm.call(Yr)):{}}function bv(Yr,$n){var Yn=$n?My(Yr.buffer):Yr.buffer;return new Yr.constructor(Yn,Yr.byteOffset,Yr.length)}function xv(Yr,$n){if(Yr!==$n){var Yn=Yr!==wr,ao=Yr===null,ho=Yr===Yr,$o=Ap(Yr),To=$n!==wr,Po=$n===null,Mo=$n===$n,_c=Ap($n);if(!Po&&!_c&&!$o&&Yr>$n||$o&&To&&Mo&&!Po&&!_c||ao&&To&&Mo||!Yn&&Mo||!ho)return 1;if(!ao&&!$o&&!_c&&Yr<$n||_c&&Yn&&ho&&!ao&&!$o||Po&&Yn&&ho||!To&&ho||!Mo)return-1}return 0}function x_(Yr,$n,Yn){for(var ao=-1,ho=Yr.criteria,$o=$n.criteria,To=ho.length,Po=Yn.length;++ao=Po)return Mo;var _c=Yn[ao];return Mo*(_c=="desc"?-1:1)}}return Yr.index-$n.index}function wv(Yr,$n,Yn,ao){for(var ho=-1,$o=Yr.length,To=Yn.length,Po=-1,Mo=$n.length,_c=op($o-To,0),yl=Go(Mo+_c),Rl=!ao;++Po1?Yn[ho-1]:wr,To=ho>2?Yn[2]:wr;for($o=Yr.length>3&&typeof $o=="function"?(ho--,$o):wr,To&&vp(Yn[0],Yn[1],To)&&($o=ho<3?wr:$o,ho=1),$n=Fu($n);++ao-1?ho[$o?$n[To]:To]:wr}}function Cv(Yr){return tm(function($n){var Yn=$n.length,ao=Yn,ho=jp.prototype.thru;for(Yr&&$n.reverse();ao--;){var $o=$n[ao];if(typeof $o!="function")throw new Mp(Br);if(ho&&!To&&q0($o)=="wrapper")var To=new jp([],!0)}for(ao=To?ao:Yn;++ao1&&Pu.reverse(),yl&&MoPo))return!1;var _c=$o.get(Yr),yl=$o.get($n);if(_c&&yl)return _c==$n&&yl==Yr;var Rl=-1,Hl=!0,eu=Yn&En?new wm:wr;for($o.set(Yr,$n),$o.set($n,Yr);++Rl1?"& ":"")+$n[ao],$n=$n.join(Yn>2?", ":" "),Yr.replace(Ao,`{ +*/(function(fr,br){(function(){var wr,Er="4.17.21",kr=200,jr="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",Br="Expected a function",Wr="Invalid `variable` option passed into `_.template`",qr="__lodash_hash_undefined__",Gr=500,Vr="__lodash_placeholder__",Zr=1,Jr=2,Qr=4,_n=1,En=2,Cn=1,In=2,An=4,jn=8,eo=16,ro=32,to=64,_i=128,oo=256,io=512,co=30,so="...",no=800,Tn=16,Hr=1,Xr=2,Sn=3,Rn=1/0,Pn=9007199254740991,On=17976931348623157e292,Zn=NaN,Nn=4294967295,wn=Nn-1,zn=Nn>>>1,fo=[["ary",_i],["bind",Cn],["bindKey",In],["curry",jn],["curryRight",eo],["flip",io],["partial",ro],["partialRight",to],["rearg",oo]],vo="[object Arguments]",go="[object Array]",uo="[object AsyncFunction]",lo="[object Boolean]",Eo="[object Date]",mo="[object DOMException]",yo="[object Error]",_o="[object Function]",Bo="[object GeneratorFunction]",Lo="[object Map]",Wo="[object Number]",na="[object Null]",qo="[object Object]",ga="[object Promise]",wl="[object Proxy]",No="[object RegExp]",Uo="[object Set]",Nl="[object String]",Vo="[object Symbol]",Fo="[object Undefined]",Ol="[object WeakMap]",$a="[object WeakSet]",Jo="[object ArrayBuffer]",Zl="[object DataView]",Cl="[object Float32Array]",ko="[object Float64Array]",wo="[object Int8Array]",bo="[object Int16Array]",Io="[object Int32Array]",Ho="[object Uint8Array]",Do="[object Uint8ClampedArray]",zo="[object Uint16Array]",nu="[object Uint32Array]",Ll=/\b__p \+= '';/g,_l=/\b(__p \+=) '' \+/g,bu=/(__e\(.*?\)|\b__t\)) \+\n'';/g,xl=/&(?:amp|lt|gt|quot|#39);/g,Tl=/[&<>"']/g,du=RegExp(xl.source),Bl=RegExp(Tl.source),Il=/<%-([\s\S]+?)%>/g,Eu=/<%([\s\S]+?)%>/g,Al=/<%=([\s\S]+?)%>/g,Ml=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Tu=/^\w*$/,Fl=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Sl=/[\\^$.*+?()[\]{}|]/g,_u=RegExp(Sl.source),So=/^\s+/,Co=/\s/,Ao=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,po=/\{\n\/\* \[wrapped with (.+)\] \*/,Ro=/,? & /,Xo=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,jo=/[()=,{}\[\]\/\s]/,Ko=/\\(\\)?/g,Wl=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,$l=/\w*$/,El=/^[-+]0x[0-9a-f]+$/i,Cu=/^0b[01]+$/i,iu=/^\[object .+?Constructor\]$/,pu=/^0o[0-7]+$/i,yu=/^(?:0|[1-9]\d*)$/,hu=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,mu=/($^)/,vu=/['\n\r\u2028\u2029\\]/g,fu="\\ud800-\\udfff",gu="\\u0300-\\u036f",ou="\\ufe20-\\ufe2f",su="\\u20d0-\\u20ff",tu=gu+ou+su,zl="\\u2700-\\u27bf",Gl="a-z\\xdf-\\xf6\\xf8-\\xff",Jl="\\xac\\xb1\\xd7\\xf7",Pl="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Ul="\\u2000-\\u206f",Yl=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Vl="A-Z\\xc0-\\xd6\\xd8-\\xde",Ql="\\ufe0e\\ufe0f",au=Jl+Pl+Ul+Yl,Nu="['’]",Wu="["+fu+"]",zu="["+au+"]",Bu="["+tu+"]",Qo="\\d+",Zu="["+zl+"]",Qu="["+Gl+"]",_h="[^"+fu+au+Qo+zl+Gl+Vl+"]",qu="\\ud83c[\\udffb-\\udfff]",Ju="(?:"+Bu+"|"+qu+")",_d="[^"+fu+"]",dp="(?:\\ud83c[\\udde6-\\uddff]){2}",Ku="[\\ud800-\\udbff][\\udc00-\\udfff]",Vu="["+Vl+"]",cp="\\u200d",fp="(?:"+Qu+"|"+_h+")",lp="(?:"+Vu+"|"+_h+")",np="(?:"+Nu+"(?:d|ll|m|re|s|t|ve))?",Rp="(?:"+Nu+"(?:D|LL|M|RE|S|T|VE))?",wp=Ju+"?",a0="["+Ql+"]?",e1="(?:"+cp+"(?:"+[_d,dp,Ku].join("|")+")"+a0+wp+")*",ym="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",s0="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",c0=a0+wp+e1,l0="(?:"+[Zu,dp,Ku].join("|")+")"+c0,d0="(?:"+[_d+Bu+"?",Bu,dp,Ku,Wu].join("|")+")",t1=RegExp(Nu,"g"),Rm=RegExp(Bu,"g"),qm=RegExp(qu+"(?="+qu+")|"+d0+c0,"g"),f0=RegExp([Vu+"?"+Qu+"+"+np+"(?="+[zu,Vu,"$"].join("|")+")",lp+"+"+Rp+"(?="+[zu,Vu+fp,"$"].join("|")+")",Vu+"?"+fp+"+"+np,Vu+"+"+Rp,s0,ym,Qo,l0].join("|"),"g"),h0=RegExp("["+cp+fu+tu+Ql+"]"),zm=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,p0=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],r1=-1,Lu={};Lu[Cl]=Lu[ko]=Lu[wo]=Lu[bo]=Lu[Io]=Lu[Ho]=Lu[Do]=Lu[zo]=Lu[nu]=!0,Lu[vo]=Lu[go]=Lu[Jo]=Lu[lo]=Lu[Zl]=Lu[Eo]=Lu[yo]=Lu[_o]=Lu[Lo]=Lu[Wo]=Lu[qo]=Lu[No]=Lu[Uo]=Lu[Nl]=Lu[Ol]=!1;var Du={};Du[vo]=Du[go]=Du[Jo]=Du[Zl]=Du[lo]=Du[Eo]=Du[Cl]=Du[ko]=Du[wo]=Du[bo]=Du[Io]=Du[Lo]=Du[Wo]=Du[qo]=Du[No]=Du[Uo]=Du[Nl]=Du[Vo]=Du[Ho]=Du[Do]=Du[zo]=Du[nu]=!0,Du[yo]=Du[_o]=Du[Ol]=!1;var Zo={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Dl={"&":"&","<":"<",">":">",'"':""","'":"'"},ru={"&":"&","<":"<",">":">",""":'"',"'":"'"},Au={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Yu=parseFloat,Xu=parseInt,Cp=typeof ge=="object"&&ge&&ge.Object===Object&&ge,Kp=typeof self=="object"&&self&&self.Object===Object&&self,Hu=Cp||Kp||Function("return this")(),gp=br&&!br.nodeType&&br,_p=gp&&!0&&fr&&!fr.nodeType&&fr,sm=_p&&_p.exports===gp,Wp=sm&&Cp.process,ap=function(){try{var Mo=_p&&_p.require&&_p.require("util").types;return Mo||Wp&&Wp.binding&&Wp.binding("util")}catch{}}(),am=ap&&ap.isArrayBuffer,Cm=ap&&ap.isDate,vm=ap&&ap.isMap,Tm=ap&&ap.isRegExp,n1=ap&&ap.isSet,u0=ap&&ap.isTypedArray;function mp(Mo,Yo,Go){switch(Go.length){case 0:return Mo.call(Yo);case 1:return Mo.call(Yo,Go[0]);case 2:return Mo.call(Yo,Go[0],Go[1]);case 3:return Mo.call(Yo,Go[0],Go[1],Go[2])}return Mo.apply(Yo,Go)}function Cx(Mo,Yo,Go,Xl){for(var xu=-1,Mu=Mo==null?0:Mo.length;++xu-1}function o1(Mo,Yo,Go){for(var Xl=-1,xu=Mo==null?0:Mo.length;++Xl-1;);return Go}function Ey(Mo,Yo){for(var Go=Mo.length;Go--&&Im(Yo,Mo[Go],0)>-1;);return Go}function jx(Mo,Yo){for(var Go=Mo.length,Xl=0;Go--;)Mo[Go]===Yo&&++Xl;return Xl}var Bx=l1(Zo),Dx=l1(Dl);function Lx(Mo){return"\\"+Au[Mo]}function Ux(Mo,Yo){return Mo==null?wr:Mo[Yo]}function Am(Mo){return h0.test(Mo)}function Fx(Mo){return zm.test(Mo)}function Wx(Mo){for(var Yo,Go=[];!(Yo=Mo.next()).done;)Go.push(Yo.value);return Go}function h1(Mo){var Yo=-1,Go=Array(Mo.size);return Mo.forEach(function(Xl,xu){Go[++Yo]=[xu,Xl]}),Go}function $y(Mo,Yo){return function(Go){return Mo(Yo(Go))}}function um(Mo,Yo){for(var Go=-1,Xl=Mo.length,xu=0,Mu=[];++Go-1}function Tw(Yr,$n){var Yn=this.__data__,ao=P0(Yn,Yr);return ao<0?(++this.size,Yn.push([Yr,$n])):Yn[ao][1]=$n,this}Yp.prototype.clear=Sw,Yp.prototype.delete=kw,Yp.prototype.get=Cw,Yp.prototype.has=Rw,Yp.prototype.set=Tw;function Xp(Yr){var $n=-1,Yn=Yr==null?0:Yr.length;for(this.clear();++$n=$n?Yr:$n)),Yr}function Bp(Yr,$n,Yn,ao,ho,$o){var To,Po=$n&Zr,Oo=$n&Jr,_c=$n&Qr;if(Yn&&(To=ho?Yn(Yr,ao,ho,$o):Yn(Yr)),To!==wr)return To;if(!_f(Yr))return Yr;var yl=wu(Yr);if(yl){if(To=N_(Yr),!Po)return Ep(Yr,To)}else{var Rl=pp(Yr),Hl=Rl==_o||Rl==Bo;if(gm(Yr))return vv(Yr,Po);if(Rl==qo||Rl==vo||Hl&&!ho){if(To=Oo||Hl?{}:Bv(Yr),!Po)return Oo?__(Yr,Vw(To,Yr)):w_(Yr,jy(To,Yr))}else{if(!Du[Rl])return ho?Yr:{};To=M_(Yr,Rl,Po)}}$o||($o=new zp);var eu=$o.get(Yr);if(eu)return eu;$o.set(Yr,To),fx(Yr)?Yr.forEach(function(uu){To.add(Bp(uu,$n,Yn,uu,Yr,$o))}):ux(Yr)&&Yr.forEach(function(uu,Ru){To.set(Ru,Bp(uu,$n,Yn,Ru,Yr,$o))});var lu=_c?Oo?F1:U1:Oo?Sp:sp,Su=yl?wr:lu(Yr);return Mp(Su||Yr,function(uu,Ru){Su&&(Ru=uu,uu=Yr[Ru]),Ym(To,Ru,Bp(uu,$n,Yn,Ru,Yr,$o))}),To}function Hw(Yr){var $n=sp(Yr);return function(Yn){return By(Yn,Yr,$n)}}function By(Yr,$n,Yn){var ao=Yn.length;if(Yr==null)return!ao;for(Yr=Uu(Yr);ao--;){var ho=Yn[ao],$o=$n[ho],To=Yr[ho];if(To===wr&&!(ho in Yr)||!$o(To))return!1}return!0}function Dy(Yr,$n,Yn){if(typeof Yr!="function")throw new Op(Br);return i0(function(){Yr.apply(wr,Yn)},$n)}function Xm(Yr,$n,Yn,ao){var ho=-1,$o=m0,To=!0,Po=Yr.length,Oo=[],_c=$n.length;if(!Po)return Oo;Yn&&($n=Gu($n,Tp(Yn))),ao?($o=o1,To=!1):$n.length>=kr&&($o=Vm,To=!1,$n=new wm($n));e:for(;++hoho?0:ho+Yn),ao=ao===wr||ao>ho?ho:$u(ao),ao<0&&(ao+=ho),ao=Yn>ao?0:px(ao);Yn0&&Yn(Po)?$n>1?up(Po,$n-1,Yn,ao,ho):lm(ho,Po):ao||(ho[ho.length]=Po)}return ho}var w1=$v(),Fy=$v(!0);function Gp(Yr,$n){return Yr&&w1(Yr,$n,sp)}function E1(Yr,$n){return Yr&&Fy(Yr,$n,sp)}function M0(Yr,$n){return cm($n,function(Yn){return nm(Yr[Yn])})}function Em(Yr,$n){$n=pm($n,Yr);for(var Yn=0,ao=$n.length;Yr!=null&&Yn$n}function Zw(Yr,$n){return Yr!=null&&ju.call(Yr,$n)}function Jw(Yr,$n){return Yr!=null&&$n in Uu(Yr)}function Yw(Yr,$n,Yn){return Yr>=hp($n,Yn)&&Yr=120&&yl.length>=120)?new wm(To&&yl):wr}yl=Yr[0];var Rl=-1,Hl=Po[0];e:for(;++Rl-1;)Po!==Yr&&S0.call(Po,Oo,1),S0.call(Yr,Oo,1);return Yr}function Xy(Yr,$n){for(var Yn=Yr?$n.length:0,ao=Yn-1;Yn--;){var ho=$n[Yn];if(Yn==ao||ho!==$o){var $o=ho;rm(ho)?S0.call(Yr,ho,1):N1(Yr,ho)}}return Yr}function I1(Yr,$n){return Yr+R0(Py()*($n-Yr+1))}function u_(Yr,$n,Yn,ao){for(var ho=-1,$o=op(C0(($n-Yr)/(Yn||1)),0),To=Go($o);$o--;)To[ao?$o:++ho]=Yr,Yr+=Yn;return To}function A1(Yr,$n){var Yn="";if(!Yr||$n<1||$n>Pn)return Yn;do $n%2&&(Yn+=Yr),$n=R0($n/2),$n&&(Yr+=Yr);while($n);return Yn}function ku(Yr,$n){return G1(Uv(Yr,$n,kp),Yr+"")}function d_(Yr){return Oy(Wm(Yr))}function f_(Yr,$n){var Yn=Wm(Yr);return V0(Yn,_m($n,0,Yn.length))}function t0(Yr,$n,Yn,ao){if(!_f(Yr))return Yr;$n=pm($n,Yr);for(var ho=-1,$o=$n.length,To=$o-1,Po=Yr;Po!=null&&++ho<$o;){var Oo=Jp($n[ho]),_c=Yn;if(Oo==="__proto__"||Oo==="constructor"||Oo==="prototype")return Yr;if(ho!=To){var yl=Po[Oo];_c=ao?ao(yl,Oo,Po):wr,_c===wr&&(_c=_f(yl)?yl:rm($n[ho+1])?[]:{})}Ym(Po,Oo,_c),Po=Po[Oo]}return Yr}var Qy=T0?function(Yr,$n){return T0.set(Yr,$n),Yr}:kp,h_=k0?function(Yr,$n){return k0(Yr,"toString",{configurable:!0,enumerable:!1,value:iy($n),writable:!0})}:kp;function p_(Yr){return V0(Wm(Yr))}function Dp(Yr,$n,Yn){var ao=-1,ho=Yr.length;$n<0&&($n=-$n>ho?0:ho+$n),Yn=Yn>ho?ho:Yn,Yn<0&&(Yn+=ho),ho=$n>Yn?0:Yn-$n>>>0,$n>>>=0;for(var $o=Go(ho);++ao>>1,To=Yr[$o];To!==null&&!Ap(To)&&(Yn?To<=$n:To<$n)?ao=$o+1:ho=$o}return ho}return P1(Yr,$n,kp,Yn)}function P1(Yr,$n,Yn,ao){var ho=0,$o=Yr==null?0:Yr.length;if($o===0)return 0;$n=Yn($n);for(var To=$n!==$n,Po=$n===null,Oo=Ap($n),_c=$n===wr;ho<$o;){var yl=R0((ho+$o)/2),Rl=Yn(Yr[yl]),Hl=Rl!==wr,eu=Rl===null,lu=Rl===Rl,Su=Ap(Rl);if(To)var uu=ao||lu;else _c?uu=lu&&(ao||Hl):Po?uu=lu&&Hl&&(ao||!eu):Oo?uu=lu&&Hl&&!eu&&(ao||!Su):eu||Su?uu=!1:uu=ao?Rl<=$n:Rl<$n;uu?ho=yl+1:$o=yl}return hp($o,wn)}function lv(Yr,$n){for(var Yn=-1,ao=Yr.length,ho=0,$o=[];++Yn=kr){var _c=$n?null:k_(Yr);if(_c)return y0(_c);To=!1,ho=Vm,Oo=new wm}else Oo=$n?[]:Po;e:for(;++ao<$o;){var yl=Yr[ao],Rl=$n?$n(yl):yl;if(yl=Yn||yl!==0?yl:0,To&&Rl===Rl){for(var Hl=Oo.length;Hl--;)if(Oo[Hl]===Rl)continue e;$n&&Oo.push(Rl),Po.push(yl)}else ho(Oo,Rl,Yn)||(Oo!==Po&&Oo.push(Rl),Po.push(yl))}return Po}function N1(Yr,$n){return $n=pm($n,Yr),Yr=Fv(Yr,$n),Yr==null||delete Yr[Jp(Lp($n))]}function pv(Yr,$n,Yn,ao){return t0(Yr,$n,Yn(Em(Yr,$n)),ao)}function B0(Yr,$n,Yn,ao){for(var ho=Yr.length,$o=ao?ho:-1;(ao?$o--:++$o=ao?Yr:Dp(Yr,$n,Yn)}var yv=nw||function(Yr){return Hu.clearTimeout(Yr)};function vv(Yr,$n){if($n)return Yr.slice();var Yn=Yr.length,ao=Cy?Cy(Yn):new Yr.constructor(Yn);return Yr.copy(ao),ao}function B1(Yr){var $n=new Yr.constructor(Yr.byteLength);return new E0($n).set(new E0(Yr)),$n}function y_(Yr,$n){var Yn=$n?B1(Yr.buffer):Yr.buffer;return new Yr.constructor(Yn,Yr.byteOffset,Yr.byteLength)}function v_(Yr){var $n=new Yr.constructor(Yr.source,$l.exec(Yr));return $n.lastIndex=Yr.lastIndex,$n}function b_(Yr){return Jm?Uu(Jm.call(Yr)):{}}function bv(Yr,$n){var Yn=$n?B1(Yr.buffer):Yr.buffer;return new Yr.constructor(Yn,Yr.byteOffset,Yr.length)}function xv(Yr,$n){if(Yr!==$n){var Yn=Yr!==wr,ao=Yr===null,ho=Yr===Yr,$o=Ap(Yr),To=$n!==wr,Po=$n===null,Oo=$n===$n,_c=Ap($n);if(!Po&&!_c&&!$o&&Yr>$n||$o&&To&&Oo&&!Po&&!_c||ao&&To&&Oo||!Yn&&Oo||!ho)return 1;if(!ao&&!$o&&!_c&&Yr<$n||_c&&Yn&&ho&&!ao&&!$o||Po&&Yn&&ho||!To&&ho||!Oo)return-1}return 0}function x_(Yr,$n,Yn){for(var ao=-1,ho=Yr.criteria,$o=$n.criteria,To=ho.length,Po=Yn.length;++ao=Po)return Oo;var _c=Yn[ao];return Oo*(_c=="desc"?-1:1)}}return Yr.index-$n.index}function wv(Yr,$n,Yn,ao){for(var ho=-1,$o=Yr.length,To=Yn.length,Po=-1,Oo=$n.length,_c=op($o-To,0),yl=Go(Oo+_c),Rl=!ao;++Po1?Yn[ho-1]:wr,To=ho>2?Yn[2]:wr;for($o=Yr.length>3&&typeof $o=="function"?(ho--,$o):wr,To&&vp(Yn[0],Yn[1],To)&&($o=ho<3?wr:$o,ho=1),$n=Uu($n);++ao-1?ho[$o?$n[To]:To]:wr}}function Cv(Yr){return tm(function($n){var Yn=$n.length,ao=Yn,ho=jp.prototype.thru;for(Yr&&$n.reverse();ao--;){var $o=$n[ao];if(typeof $o!="function")throw new Op(Br);if(ho&&!To&&q0($o)=="wrapper")var To=new jp([],!0)}for(ao=To?ao:Yn;++ao1&&Pu.reverse(),yl&&OoPo))return!1;var _c=$o.get(Yr),yl=$o.get($n);if(_c&&yl)return _c==$n&&yl==Yr;var Rl=-1,Hl=!0,eu=Yn&En?new wm:wr;for($o.set(Yr,$n),$o.set($n,Yr);++Rl1?"& ":"")+$n[ao],$n=$n.join(Yn>2?", ":" "),Yr.replace(Ao,`{ /* [wrapped with `+$n+`] */ -`)}function j_(Yr){return wu(Yr)||km(Yr)||!!(I1&&Yr&&Yr[I1])}function rm(Yr,$n){var Yn=typeof Yr;return $n=$n??Pn,!!$n&&(Yn=="number"||Yn!="symbol"&&yu.test(Yr))&&Yr>-1&&Yr%1==0&&Yr<$n}function vp(Yr,$n,Yn){if(!_f(Yn))return!1;var ao=typeof $n;return(ao=="number"?$p(Yn)&&rm($n,Yn.length):ao=="string"&&$n in Yn)?Vp(Yn[$n],Yr):!1}function qy(Yr,$n){if(wu(Yr))return!1;var Yn=typeof Yr;return Yn=="number"||Yn=="symbol"||Yn=="boolean"||Yr==null||Ap(Yr)?!0:Tu.test(Yr)||!Ol.test(Yr)||$n!=null&&Yr in Fu($n)}function B_(Yr){var $n=typeof Yr;return $n=="string"||$n=="number"||$n=="symbol"||$n=="boolean"?Yr!=="__proto__":Yr===null}function zy(Yr){var $n=q0(Yr),Yn=xo[$n];if(typeof Yn!="function"||!($n in Iu.prototype))return!1;if(Yr===Yn)return!0;var ao=Fy(Yn);return!!ao&&Yr===ao[0]}function D_(Yr){return!!k1&&k1 in Yr}var L_=b0?nm:s1;function n0(Yr){var $n=Yr&&Yr.constructor,Yn=typeof $n=="function"&&$n.prototype||Om;return Yr===Yn}function Dv(Yr){return Yr===Yr&&!_f(Yr)}function Lv(Yr,$n){return function(Yn){return Yn==null?!1:Yn[Yr]===$n&&($n!==wr||Yr in Fu(Yn))}}function F_(Yr){var $n=Z0(Yr,function(ao){return Yn.size===Gr&&Yn.clear(),ao}),Yn=$n.cache;return $n}function U_(Yr,$n){var Yn=Yr[1],ao=$n[1],ho=Yn|ao,$o=ho<(Cn|In|_i),To=ao==_i&&Yn==jn||ao==_i&&Yn==oo&&Yr[7].length<=$n[8]||ao==(_i|oo)&&$n[7].length<=$n[8]&&Yn==jn;if(!($o||To))return Yr;ao&Cn&&(Yr[2]=$n[2],ho|=Yn&Cn?0:An);var Po=$n[3];if(Po){var Mo=Yr[3];Yr[3]=Mo?wv(Mo,Po,$n[4]):Po,Yr[4]=Mo?um(Yr[3],Vr):$n[4]}return Po=$n[5],Po&&(Mo=Yr[5],Yr[5]=Mo?_v(Mo,Po,$n[6]):Po,Yr[6]=Mo?um(Yr[5],Vr):$n[6]),Po=$n[7],Po&&(Yr[7]=Po),ao&_i&&(Yr[8]=Yr[8]==null?$n[8]:hp(Yr[8],$n[8])),Yr[9]==null&&(Yr[9]=$n[9]),Yr[0]=$n[0],Yr[1]=ho,Yr}function W_(Yr){var $n=[];if(Yr!=null)for(var Yn in Fu(Yr))$n.push(Yn);return $n}function q_(Yr){return w0.call(Yr)}function Fv(Yr,$n,Yn){return $n=op($n===wr?Yr.length-1:$n,0),function(){for(var ao=arguments,ho=-1,$o=op(ao.length-$n,0),To=Go($o);++ho<$o;)To[ho]=ao[$n+ho];ho=-1;for(var Po=Go($n+1);++ho<$n;)Po[ho]=ao[ho];return Po[$n]=Yn(To),mp(Yr,this,Po)}}function Uv(Yr,$n){return $n.length<2?Yr:Em(Yr,Dp($n,0,-1))}function z_(Yr,$n){for(var Yn=Yr.length,ao=hp($n.length,Yn),ho=Ep(Yr);ao--;){var $o=$n[ao];Yr[ao]=rm($o,Yn)?ho[$o]:wr}return Yr}function Vy(Yr,$n){if(!($n==="constructor"&&typeof Yr[$n]=="function")&&$n!="__proto__")return Yr[$n]}var Wv=zv(Q1),i0=ow||function(Yr,$n){return Hu.setTimeout(Yr,$n)},Hy=zv(h_);function qv(Yr,$n,Yn){var ao=$n+"";return Hy(Yr,M_(ao,V_(P_(ao),Yn)))}function zv(Yr){var $n=0,Yn=0;return function(){var ao=lw(),ho=Tn-(ao-Yn);if(Yn=ao,ho>0){if(++$n>=no)return arguments[0]}else $n=0;return Yr.apply(wr,arguments)}}function V0(Yr,$n){var Yn=-1,ao=Yr.length,ho=ao-1;for($n=$n===wr?ao:$n;++Yn<$n;){var $o=Ry(Yn,ho),To=Yr[$o];Yr[$o]=Yr[Yn],Yr[Yn]=To}return Yr.length=$n,Yr}var Vv=F_(function(Yr){var $n=[];return Yr.charCodeAt(0)===46&&$n.push(""),Yr.replace(Ul,function(Yn,ao,ho,$o){$n.push(ho?$o.replace(Ko,"$1"):ao||Yn)}),$n});function Jp(Yr){if(typeof Yr=="string"||Ap(Yr))return Yr;var $n=Yr+"";return $n=="0"&&1/Yr==-Rn?"-0":$n}function Sm(Yr){if(Yr!=null){try{return x0.call(Yr)}catch{}try{return Yr+""}catch{}}return""}function V_(Yr,$n){return Op(fo,function(Yn){var ao="_."+Yn[0];$n&Yn[1]&&!m0(Yr,ao)&&Yr.push(ao)}),Yr.sort()}function Hv(Yr){if(Yr instanceof Iu)return Yr.clone();var $n=new jp(Yr.__wrapped__,Yr.__chain__);return $n.__actions__=Ep(Yr.__actions__),$n.__index__=Yr.__index__,$n.__values__=Yr.__values__,$n}function H_(Yr,$n,Yn){(Yn?vp(Yr,$n,Yn):$n===wr)?$n=1:$n=op($u($n),0);var ao=Yr==null?0:Yr.length;if(!ao||$n<1)return[];for(var ho=0,$o=0,To=Go(C0(ao/$n));ho1?Yr[$n-1]:wr;return Yn=typeof Yn=="function"?(Yr.pop(),Yn):wr,Xv(Yr,Yn)});function Qv(Yr){var $n=xo(Yr);return $n.__chain__=!0,$n}function K2(Yr,$n){return $n(Yr),Yr}function H0(Yr,$n){return $n(Yr)}var G2=tm(function(Yr){var $n=Yr.length,Yn=$n?Yr[0]:0,ao=this.__wrapped__,ho=function($o){return by($o,Yr)};return $n>1||this.__actions__.length||!(ao instanceof Iu)||!rm(Yn)?this.thru(ho):(ao=ao.slice(Yn,+Yn+($n?1:0)),ao.__actions__.push({func:H0,args:[ho],thisArg:wr}),new jp(ao,this.__chain__).thru(function($o){return $n&&!$o.length&&$o.push(wr),$o}))});function Z2(){return Qv(this)}function J2(){return new jp(this.value(),this.__chain__)}function Y2(){this.__values__===wr&&(this.__values__=hx(this.value()));var Yr=this.__index__>=this.__values__.length,$n=Yr?wr:this.__values__[this.__index__++];return{done:Yr,value:$n}}function X2(){return this}function Q2(Yr){for(var $n,Yn=this;Yn instanceof A0;){var ao=Hv(Yn);ao.__index__=0,ao.__values__=wr,$n?ho.__wrapped__=ao:$n=ao;var ho=ao;Yn=Yn.__wrapped__}return ho.__wrapped__=Yr,$n}function eE(){var Yr=this.__wrapped__;if(Yr instanceof Iu){var $n=Yr;return this.__actions__.length&&($n=new Iu(this)),$n=$n.reverse(),$n.__actions__.push({func:H0,args:[Ky],thisArg:wr}),new jp($n,this.__chain__)}return this.thru(Ky)}function tE(){return mv(this.__wrapped__,this.__actions__)}var rE=D0(function(Yr,$n,Yn){ju.call(Yr,Yn)?++Yr[Yn]:Qp(Yr,Yn,1)});function nE(Yr,$n,Yn){var ao=wu(Yr)?p1:Kw;return Yn&&vp(Yr,$n,Yn)&&($n=wr),ao(Yr,cu($n,3))}function iE(Yr,$n){var Yn=wu(Yr)?cm:F1;return Yn(Yr,cu($n,3))}var oE=kv(Kv),aE=kv(Gv);function sE(Yr,$n){return up(K0(Yr,$n),1)}function cE(Yr,$n){return up(K0(Yr,$n),Rn)}function lE(Yr,$n,Yn){return Yn=Yn===wr?1:$u(Yn),up(K0(Yr,$n),Yn)}function _b(Yr,$n){var Yn=wu(Yr)?Op:fm;return Yn(Yr,cu($n,3))}function ex(Yr,$n){var Yn=wu(Yr)?Rx:L1;return Yn(Yr,cu($n,3))}var uE=D0(function(Yr,$n,Yn){ju.call(Yr,Yn)?Yr[Yn].push($n):Qp(Yr,Yn,[$n])});function dE(Yr,$n,Yn,ao){Yr=$p(Yr)?Yr:Wm(Yr),Yn=Yn&&!ao?$u(Yn):0;var ho=Yr.length;return Yn<0&&(Yn=op(ho+Yn,0)),X0(Yr)?Yn<=ho&&Yr.indexOf($n,Yn)>-1:!!ho&&Im(Yr,$n,Yn)>-1}var fE=ku(function(Yr,$n,Yn){var ao=-1,ho=typeof $n=="function",$o=$p(Yr)?Go(Yr.length):[];return fm(Yr,function(To){$o[++ao]=ho?mp($n,To,Yn):Qm(To,$n,Yn)}),$o}),hE=D0(function(Yr,$n,Yn){Qp(Yr,Yn,$n)});function K0(Yr,$n){var Yn=wu(Yr)?Gu:H1;return Yn(Yr,cu($n,3))}function pE(Yr,$n,Yn,ao){return Yr==null?[]:(wu($n)||($n=$n==null?[]:[$n]),Yn=ao?wr:Yn,wu(Yn)||(Yn=Yn==null?[]:[Yn]),J1(Yr,$n,Yn))}var mE=D0(function(Yr,$n,Yn){Yr[Yn?0:1].push($n)},function(){return[[],[]]});function gE(Yr,$n,Yn){var ao=wu(Yr)?ay:b1,ho=arguments.length<3;return ao(Yr,cu($n,4),Yn,ho,fm)}function yE(Yr,$n,Yn){var ao=wu(Yr)?Tx:b1,ho=arguments.length<3;return ao(Yr,cu($n,4),Yn,ho,L1)}function vE(Yr,$n){var Yn=wu(Yr)?cm:F1;return Yn(Yr,J0(cu($n,3)))}function bE(Yr){var $n=wu(Yr)?M1:d_;return $n(Yr)}function xE(Yr,$n,Yn){(Yn?vp(Yr,$n,Yn):$n===wr)?$n=1:$n=$u($n);var ao=wu(Yr)?Ww:f_;return ao(Yr,$n)}function wE(Yr){var $n=wu(Yr)?qw:p_;return $n(Yr)}function _E(Yr){if(Yr==null)return 0;if($p(Yr))return X0(Yr)?Pm(Yr):Yr.length;var $n=pp(Yr);return $n==Lo||$n==Fo?Yr.size:Sy(Yr).length}function EE(Yr,$n,Yn){var ao=wu(Yr)?sy:m_;return Yn&&vp(Yr,$n,Yn)&&($n=wr),ao(Yr,cu($n,3))}var $E=ku(function(Yr,$n){if(Yr==null)return[];var Yn=$n.length;return Yn>1&&vp(Yr,$n[0],$n[1])?$n=[]:Yn>2&&vp($n[0],$n[1],$n[2])&&($n=[$n[0]]),J1(Yr,up($n,1),[])}),G0=iw||function(){return Hu.Date.now()};function SE(Yr,$n){if(typeof $n!="function")throw new Mp(Br);return Yr=$u(Yr),function(){if(--Yr<1)return $n.apply(this,arguments)}}function rx(Yr,$n,Yn){return $n=Yn?wr:$n,$n=Yr&&$n==null?Yr.length:$n,em(Yr,_i,wr,wr,wr,wr,$n)}function nx(Yr,$n){var Yn;if(typeof $n!="function")throw new Mp(Br);return Yr=$u(Yr),function(){return--Yr>0&&(Yn=$n.apply(this,arguments)),Yr<=1&&($n=wr),Yn}}var Zy=ku(function(Yr,$n,Yn){var ao=Cn;if(Yn.length){var ho=um(Yn,Fm(Zy));ao|=ro}return em(Yr,ao,$n,Yn,ho)}),ix=ku(function(Yr,$n,Yn){var ao=Cn|In;if(Yn.length){var ho=um(Yn,Fm(ix));ao|=ro}return em($n,ao,Yr,Yn,ho)});function ox(Yr,$n,Yn){$n=Yn?wr:$n;var ao=em(Yr,jn,wr,wr,wr,wr,wr,$n);return ao.placeholder=ox.placeholder,ao}function ax(Yr,$n,Yn){$n=Yn?wr:$n;var ao=em(Yr,eo,wr,wr,wr,wr,wr,$n);return ao.placeholder=ax.placeholder,ao}function sx(Yr,$n,Yn){var ao,ho,$o,To,Po,Mo,_c=0,yl=!1,Rl=!1,Hl=!0;if(typeof Yr!="function")throw new Mp(Br);$n=Up($n)||0,_f(Yn)&&(yl=!!Yn.leading,Rl="maxWait"in Yn,$o=Rl?op(Up(Yn.maxWait)||0,$n):$o,Hl="trailing"in Yn?!!Yn.trailing:Hl);function eu(rp){var Hp=ao,om=ho;return ao=ho=wr,_c=rp,To=Yr.apply(om,Hp),To}function lu(rp){return _c=rp,Po=i0(Ru,$n),yl?eu(rp):To}function Su(rp){var Hp=rp-Mo,om=rp-_c,kx=$n-Hp;return Rl?hp(kx,$o-om):kx}function uu(rp){var Hp=rp-Mo,om=rp-_c;return Mo===wr||Hp>=$n||Hp<0||Rl&&om>=$o}function Ru(){var rp=G0();if(uu(rp))return Pu(rp);Po=i0(Ru,Su(rp))}function Pu(rp){return Po=wr,Hl&&ao?eu(rp):(ao=ho=wr,To)}function Pp(){Po!==wr&&yv(Po),_c=0,ao=Mo=ho=Po=wr}function bp(){return Po===wr?To:Pu(G0())}function Np(){var rp=G0(),Hp=uu(rp);if(ao=arguments,ho=this,Mo=rp,Hp){if(Po===wr)return lu(Mo);if(Rl)return yv(Po),Po=i0(Ru,$n),eu(Mo)}return Po===wr&&(Po=i0(Ru,$n)),To}return Np.cancel=Pp,Np.flush=bp,Np}var kE=ku(function(Yr,$n){return D1(Yr,1,$n)}),CE=ku(function(Yr,$n,Yn){return D1(Yr,Up($n)||0,Yn)});function RE(Yr){return em(Yr,io)}function Z0(Yr,$n){if(typeof Yr!="function"||$n!=null&&typeof $n!="function")throw new Mp(Br);var Yn=function(){var ao=arguments,ho=$n?$n.apply(this,ao):ao[0],$o=Yn.cache;if($o.has(ho))return $o.get(ho);var To=Yr.apply(this,ao);return Yn.cache=$o.set(ho,To)||$o,To};return Yn.cache=new(Z0.Cache||Xp),Yn}Z0.Cache=Xp;function J0(Yr){if(typeof Yr!="function")throw new Mp(Br);return function(){var $n=arguments;switch($n.length){case 0:return!Yr.call(this);case 1:return!Yr.call(this,$n[0]);case 2:return!Yr.call(this,$n[0],$n[1]);case 3:return!Yr.call(this,$n[0],$n[1],$n[2])}return!Yr.apply(this,$n)}}function TE(Yr){return nx(2,Yr)}var IE=g_(function(Yr,$n){$n=$n.length==1&&wu($n[0])?Gu($n[0],Tp(cu())):Gu(up($n,1),Tp(cu()));var Yn=$n.length;return ku(function(ao){for(var ho=-1,$o=hp(ao.length,Yn);++ho<$o;)ao[ho]=$n[ho].call(this,ao[ho]);return mp(Yr,this,ao)})}),Jy=ku(function(Yr,$n){var Yn=um($n,Fm(Jy));return em(Yr,ro,wr,$n,Yn)}),cx=ku(function(Yr,$n){var Yn=um($n,Fm(cx));return em(Yr,to,wr,$n,Yn)}),AE=tm(function(Yr,$n){return em(Yr,oo,wr,wr,wr,$n)});function PE(Yr,$n){if(typeof Yr!="function")throw new Mp(Br);return $n=$n===wr?$n:$u($n),ku(Yr,$n)}function NE(Yr,$n){if(typeof Yr!="function")throw new Mp(Br);return $n=$n==null?0:op($u($n),0),ku(function(Yn){var ao=Yn[$n],ho=mm(Yn,0,$n);return ao&&lm(ho,ao),mp(Yr,this,ho)})}function OE(Yr,$n,Yn){var ao=!0,ho=!0;if(typeof Yr!="function")throw new Mp(Br);return _f(Yn)&&(ao="leading"in Yn?!!Yn.leading:ao,ho="trailing"in Yn?!!Yn.trailing:ho),sx(Yr,$n,{leading:ao,maxWait:$n,trailing:ho})}function ME(Yr){return rx(Yr,1)}function jE(Yr,$n){return Jy(Oy($n),Yr)}function BE(){if(!arguments.length)return[];var Yr=arguments[0];return wu(Yr)?Yr:[Yr]}function DE(Yr){return Bp(Yr,Qr)}function LE(Yr,$n){return $n=typeof $n=="function"?$n:wr,Bp(Yr,Qr,$n)}function FE(Yr){return Bp(Yr,Zr|Qr)}function UE(Yr,$n){return $n=typeof $n=="function"?$n:wr,Bp(Yr,Zr|Qr,$n)}function WE(Yr,$n){return $n==null||B1(Yr,$n,sp($n))}function Vp(Yr,$n){return Yr===$n||Yr!==Yr&&$n!==$n}var qE=W0(_y),zE=W0(function(Yr,$n){return Yr>=$n}),km=q1(function(){return arguments}())?q1:function(Yr){return ep(Yr)&&ju.call(Yr,"callee")&&!T1.call(Yr,"callee")},wu=Go.isArray,VE=am?Tp(am):Qw;function $p(Yr){return Yr!=null&&Y0(Yr.length)&&!nm(Yr)}function tp(Yr){return ep(Yr)&&$p(Yr)}function HE(Yr){return Yr===!0||Yr===!1||ep(Yr)&&yp(Yr)==lo}var gm=aw||s1,KE=Cm?Tp(Cm):e_;function GE(Yr){return ep(Yr)&&Yr.nodeType===1&&!o0(Yr)}function ZE(Yr){if(Yr==null)return!0;if($p(Yr)&&(wu(Yr)||typeof Yr=="string"||typeof Yr.splice=="function"||gm(Yr)||Um(Yr)||km(Yr)))return!Yr.length;var $n=pp(Yr);if($n==Lo||$n==Fo)return!Yr.size;if(n0(Yr))return!Sy(Yr).length;for(var Yn in Yr)if(ju.call(Yr,Yn))return!1;return!0}function JE(Yr,$n){return e0(Yr,$n)}function YE(Yr,$n,Yn){Yn=typeof Yn=="function"?Yn:wr;var ao=Yn?Yn(Yr,$n):wr;return ao===wr?e0(Yr,$n,wr,Yn):!!ao}function Yy(Yr){if(!ep(Yr))return!1;var $n=yp(Yr);return $n==yo||$n==mo||typeof Yr.message=="string"&&typeof Yr.name=="string"&&!o0(Yr)}function XE(Yr){return typeof Yr=="number"&&A1(Yr)}function nm(Yr){if(!_f(Yr))return!1;var $n=yp(Yr);return $n==_o||$n==Bo||$n==uo||$n==wl}function lx(Yr){return typeof Yr=="number"&&Yr==$u(Yr)}function Y0(Yr){return typeof Yr=="number"&&Yr>-1&&Yr%1==0&&Yr<=Pn}function _f(Yr){var $n=typeof Yr;return Yr!=null&&($n=="object"||$n=="function")}function ep(Yr){return Yr!=null&&typeof Yr=="object"}var ux=vm?Tp(vm):r_;function QE(Yr,$n){return Yr===$n||$y(Yr,$n,Uy($n))}function e3(Yr,$n,Yn){return Yn=typeof Yn=="function"?Yn:wr,$y(Yr,$n,Uy($n),Yn)}function t3(Yr){return dx(Yr)&&Yr!=+Yr}function r3(Yr){if(L_(Yr))throw new xu(jr);return z1(Yr)}function n3(Yr){return Yr===null}function i3(Yr){return Yr==null}function dx(Yr){return typeof Yr=="number"||ep(Yr)&&yp(Yr)==Wo}function o0(Yr){if(!ep(Yr)||yp(Yr)!=qo)return!1;var $n=$0(Yr);if($n===null)return!0;var Yn=ju.call($n,"constructor")&&$n.constructor;return typeof Yn=="function"&&Yn instanceof Yn&&x0.call(Yn)==ew}var Xy=Tm?Tp(Tm):n_;function o3(Yr){return lx(Yr)&&Yr>=-Pn&&Yr<=Pn}var fx=ny?Tp(ny):i_;function X0(Yr){return typeof Yr=="string"||!wu(Yr)&&ep(Yr)&&yp(Yr)==Nl}function Ap(Yr){return typeof Yr=="symbol"||ep(Yr)&&yp(Yr)==Vo}var Um=u0?Tp(u0):o_;function a3(Yr){return Yr===wr}function s3(Yr){return ep(Yr)&&pp(Yr)==Ml}function c3(Yr){return ep(Yr)&&yp(Yr)==$a}var l3=W0(ky),u3=W0(function(Yr,$n){return Yr<=$n});function hx(Yr){if(!Yr)return[];if($p(Yr))return X0(Yr)?qp(Yr):Ep(Yr);if(Hm&&Yr[Hm])return Wx(Yr[Hm]());var $n=pp(Yr),Yn=$n==Lo?hy:$n==Fo?y0:Wm;return Yn(Yr)}function im(Yr){if(!Yr)return Yr===0?Yr:0;if(Yr=Up(Yr),Yr===Rn||Yr===-Rn){var $n=Yr<0?-1:1;return $n*On}return Yr===Yr?Yr:0}function $u(Yr){var $n=im(Yr),Yn=$n%1;return $n===$n?Yn?$n-Yn:$n:0}function px(Yr){return Yr?_m($u(Yr),0,Nn):0}function Up(Yr){if(typeof Yr=="number")return Yr;if(Ap(Yr))return Zn;if(_f(Yr)){var $n=typeof Yr.valueOf=="function"?Yr.valueOf():Yr;Yr=_f($n)?$n+"":$n}if(typeof Yr!="string")return Yr===0?Yr:+Yr;Yr=x1(Yr);var Yn=Cu.test(Yr);return Yn||pu.test(Yr)?Xu(Yr.slice(2),Yn?2:8):El.test(Yr)?Zn:+Yr}function mx(Yr){return Zp(Yr,Sp(Yr))}function d3(Yr){return Yr?_m($u(Yr),-Pn,Pn):Yr===0?Yr:0}function Mu(Yr){return Yr==null?"":Ip(Yr)}var f3=Dm(function(Yr,$n){if(n0($n)||$p($n)){Zp($n,sp($n),Yr);return}for(var Yn in $n)ju.call($n,Yn)&&Ym(Yr,Yn,$n[Yn])}),gx=Dm(function(Yr,$n){Zp($n,Sp($n),Yr)}),Q0=Dm(function(Yr,$n,Yn,ao){Zp($n,Sp($n),Yr,ao)}),h3=Dm(function(Yr,$n,Yn,ao){Zp($n,sp($n),Yr,ao)}),p3=tm(by);function m3(Yr,$n){var Yn=Bm(Yr);return $n==null?Yn:j1(Yn,$n)}var g3=ku(function(Yr,$n){Yr=Fu(Yr);var Yn=-1,ao=$n.length,ho=ao>2?$n[2]:wr;for(ho&&vp($n[0],$n[1],ho)&&(ao=1);++Yn1),$o}),Zp(Yr,Ly(Yr),Yn),ao&&(Yn=Bp(Yn,Zr|Jr|Qr,C_));for(var ho=$n.length;ho--;)Ay(Yn,$n[ho]);return Yn});function j3(Yr,$n){return vx(Yr,J0(cu($n)))}var B3=tm(function(Yr,$n){return Yr==null?{}:c_(Yr,$n)});function vx(Yr,$n){if(Yr==null)return{};var Yn=Gu(Ly(Yr),function(ao){return[ao]});return $n=cu($n),Y1(Yr,Yn,function(ao,ho){return $n(ao,ho[0])})}function D3(Yr,$n,Yn){$n=pm($n,Yr);var ao=-1,ho=$n.length;for(ho||(ho=1,Yr=wr);++ao$n){var ao=Yr;Yr=$n,$n=ao}if(Yn||Yr%1||$n%1){var ho=P1();return hp(Yr+ho*($n-Yr+Yu("1e-"+((ho+"").length-1))),$n)}return Ry(Yr,$n)}var Z3=Lm(function(Yr,$n,Yn){return $n=$n.toLowerCase(),Yr+(Yn?wx($n):$n)});function wx(Yr){return t1(Mu(Yr).toLowerCase())}function _x(Yr){return Yr=Mu(Yr),Yr&&Yr.replace(hu,Bx).replace(Rm,"")}function J3(Yr,$n,Yn){Yr=Mu(Yr),$n=Ip($n);var ao=Yr.length;Yn=Yn===wr?ao:_m($u(Yn),0,ao);var ho=Yn;return Yn-=$n.length,Yn>=0&&Yr.slice(Yn,ho)==$n}function Y3(Yr){return Yr=Mu(Yr),Yr&&Bl.test(Yr)?Yr.replace(Tl,Dx):Yr}function X3(Yr){return Yr=Mu(Yr),Yr&&_u.test(Yr)?Yr.replace(Sl,"\\$&"):Yr}var Q3=Lm(function(Yr,$n,Yn){return Yr+(Yn?"-":"")+$n.toLowerCase()}),e$=Lm(function(Yr,$n,Yn){return Yr+(Yn?" ":"")+$n.toLowerCase()}),t$=Sv("toLowerCase");function r$(Yr,$n,Yn){Yr=Mu(Yr),$n=$u($n);var ao=$n?Pm(Yr):0;if(!$n||ao>=$n)return Yr;var ho=($n-ao)/2;return U0(R0(ho),Yn)+Yr+U0(C0(ho),Yn)}function n$(Yr,$n,Yn){Yr=Mu(Yr),$n=$u($n);var ao=$n?Pm(Yr):0;return $n&&ao<$n?Yr+U0($n-ao,Yn):Yr}function i$(Yr,$n,Yn){Yr=Mu(Yr),$n=$u($n);var ao=$n?Pm(Yr):0;return $n&&ao<$n?U0($n-ao,Yn)+Yr:Yr}function o$(Yr,$n,Yn){return Yn||$n==null?$n=0:$n&&($n=+$n),uw(Mu(Yr).replace(So,""),$n||0)}function a$(Yr,$n,Yn){return(Yn?vp(Yr,$n,Yn):$n===wr)?$n=1:$n=$u($n),Ty(Mu(Yr),$n)}function s$(){var Yr=arguments,$n=Mu(Yr[0]);return Yr.length<3?$n:$n.replace(Yr[1],Yr[2])}var c$=Lm(function(Yr,$n,Yn){return Yr+(Yn?"_":"")+$n.toLowerCase()});function l$(Yr,$n,Yn){return Yn&&typeof Yn!="number"&&vp(Yr,$n,Yn)&&($n=Yn=wr),Yn=Yn===wr?Nn:Yn>>>0,Yn?(Yr=Mu(Yr),Yr&&(typeof $n=="string"||$n!=null&&!Xy($n))&&($n=Ip($n),!$n&&Am(Yr))?mm(qp(Yr),0,Yn):Yr.split($n,Yn)):[]}var u$=Lm(function(Yr,$n,Yn){return Yr+(Yn?" ":"")+t1($n)});function d$(Yr,$n,Yn){return Yr=Mu(Yr),Yn=Yn==null?0:_m($u(Yn),0,Yr.length),$n=Ip($n),Yr.slice(Yn,Yn+$n.length)==$n}function f$(Yr,$n,Yn){var ao=xo.templateSettings;Yn&&vp(Yr,$n,Yn)&&($n=wr),Yr=Mu(Yr),$n=Q0({},$n,ao,Pv);var ho=Q0({},$n.imports,ao.imports,Pv),$o=sp(ho),To=fy(ho,$o),Po,Mo,_c=0,yl=$n.interpolate||mu,Rl="__p += '",Hl=py(($n.escape||mu).source+"|"+yl.source+"|"+(yl===Al?Wl:mu).source+"|"+($n.evaluate||mu).source+"|$","g"),eu="//# sourceURL="+(ju.call($n,"sourceURL")?($n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ry+"]")+` +`)}function j_(Yr){return wu(Yr)||km(Yr)||!!(Iy&&Yr&&Yr[Iy])}function rm(Yr,$n){var Yn=typeof Yr;return $n=$n??Pn,!!$n&&(Yn=="number"||Yn!="symbol"&&yu.test(Yr))&&Yr>-1&&Yr%1==0&&Yr<$n}function vp(Yr,$n,Yn){if(!_f(Yn))return!1;var ao=typeof $n;return(ao=="number"?$p(Yn)&&rm($n,Yn.length):ao=="string"&&$n in Yn)?Vp(Yn[$n],Yr):!1}function V1(Yr,$n){if(wu(Yr))return!1;var Yn=typeof Yr;return Yn=="number"||Yn=="symbol"||Yn=="boolean"||Yr==null||Ap(Yr)?!0:Tu.test(Yr)||!Ml.test(Yr)||$n!=null&&Yr in Uu($n)}function B_(Yr){var $n=typeof Yr;return $n=="string"||$n=="number"||$n=="symbol"||$n=="boolean"?Yr!=="__proto__":Yr===null}function H1(Yr){var $n=q0(Yr),Yn=xo[$n];if(typeof Yn!="function"||!($n in Iu.prototype))return!1;if(Yr===Yn)return!0;var ao=W1(Yn);return!!ao&&Yr===ao[0]}function D_(Yr){return!!ky&&ky in Yr}var L_=b0?nm:ly;function n0(Yr){var $n=Yr&&Yr.constructor,Yn=typeof $n=="function"&&$n.prototype||Mm;return Yr===Yn}function Dv(Yr){return Yr===Yr&&!_f(Yr)}function Lv(Yr,$n){return function(Yn){return Yn==null?!1:Yn[Yr]===$n&&($n!==wr||Yr in Uu(Yn))}}function U_(Yr){var $n=Z0(Yr,function(ao){return Yn.size===Gr&&Yn.clear(),ao}),Yn=$n.cache;return $n}function F_(Yr,$n){var Yn=Yr[1],ao=$n[1],ho=Yn|ao,$o=ho<(Cn|In|_i),To=ao==_i&&Yn==jn||ao==_i&&Yn==oo&&Yr[7].length<=$n[8]||ao==(_i|oo)&&$n[7].length<=$n[8]&&Yn==jn;if(!($o||To))return Yr;ao&Cn&&(Yr[2]=$n[2],ho|=Yn&Cn?0:An);var Po=$n[3];if(Po){var Oo=Yr[3];Yr[3]=Oo?wv(Oo,Po,$n[4]):Po,Yr[4]=Oo?um(Yr[3],Vr):$n[4]}return Po=$n[5],Po&&(Oo=Yr[5],Yr[5]=Oo?_v(Oo,Po,$n[6]):Po,Yr[6]=Oo?um(Yr[5],Vr):$n[6]),Po=$n[7],Po&&(Yr[7]=Po),ao&_i&&(Yr[8]=Yr[8]==null?$n[8]:hp(Yr[8],$n[8])),Yr[9]==null&&(Yr[9]=$n[9]),Yr[0]=$n[0],Yr[1]=ho,Yr}function W_(Yr){var $n=[];if(Yr!=null)for(var Yn in Uu(Yr))$n.push(Yn);return $n}function q_(Yr){return w0.call(Yr)}function Uv(Yr,$n,Yn){return $n=op($n===wr?Yr.length-1:$n,0),function(){for(var ao=arguments,ho=-1,$o=op(ao.length-$n,0),To=Go($o);++ho<$o;)To[ho]=ao[$n+ho];ho=-1;for(var Po=Go($n+1);++ho<$n;)Po[ho]=ao[ho];return Po[$n]=Yn(To),mp(Yr,this,Po)}}function Fv(Yr,$n){return $n.length<2?Yr:Em(Yr,Dp($n,0,-1))}function z_(Yr,$n){for(var Yn=Yr.length,ao=hp($n.length,Yn),ho=Ep(Yr);ao--;){var $o=$n[ao];Yr[ao]=rm($o,Yn)?ho[$o]:wr}return Yr}function K1(Yr,$n){if(!($n==="constructor"&&typeof Yr[$n]=="function")&&$n!="__proto__")return Yr[$n]}var Wv=zv(Qy),i0=ow||function(Yr,$n){return Hu.setTimeout(Yr,$n)},G1=zv(h_);function qv(Yr,$n,Yn){var ao=$n+"";return G1(Yr,O_(ao,V_(P_(ao),Yn)))}function zv(Yr){var $n=0,Yn=0;return function(){var ao=lw(),ho=Tn-(ao-Yn);if(Yn=ao,ho>0){if(++$n>=no)return arguments[0]}else $n=0;return Yr.apply(wr,arguments)}}function V0(Yr,$n){var Yn=-1,ao=Yr.length,ho=ao-1;for($n=$n===wr?ao:$n;++Yn<$n;){var $o=I1(Yn,ho),To=Yr[$o];Yr[$o]=Yr[Yn],Yr[Yn]=To}return Yr.length=$n,Yr}var Vv=U_(function(Yr){var $n=[];return Yr.charCodeAt(0)===46&&$n.push(""),Yr.replace(Fl,function(Yn,ao,ho,$o){$n.push(ho?$o.replace(Ko,"$1"):ao||Yn)}),$n});function Jp(Yr){if(typeof Yr=="string"||Ap(Yr))return Yr;var $n=Yr+"";return $n=="0"&&1/Yr==-Rn?"-0":$n}function Sm(Yr){if(Yr!=null){try{return x0.call(Yr)}catch{}try{return Yr+""}catch{}}return""}function V_(Yr,$n){return Mp(fo,function(Yn){var ao="_."+Yn[0];$n&Yn[1]&&!m0(Yr,ao)&&Yr.push(ao)}),Yr.sort()}function Hv(Yr){if(Yr instanceof Iu)return Yr.clone();var $n=new jp(Yr.__wrapped__,Yr.__chain__);return $n.__actions__=Ep(Yr.__actions__),$n.__index__=Yr.__index__,$n.__values__=Yr.__values__,$n}function H_(Yr,$n,Yn){(Yn?vp(Yr,$n,Yn):$n===wr)?$n=1:$n=op($u($n),0);var ao=Yr==null?0:Yr.length;if(!ao||$n<1)return[];for(var ho=0,$o=0,To=Go(C0(ao/$n));ho1?Yr[$n-1]:wr;return Yn=typeof Yn=="function"?(Yr.pop(),Yn):wr,Xv(Yr,Yn)});function Qv(Yr){var $n=xo(Yr);return $n.__chain__=!0,$n}function K2(Yr,$n){return $n(Yr),Yr}function H0(Yr,$n){return $n(Yr)}var G2=tm(function(Yr){var $n=Yr.length,Yn=$n?Yr[0]:0,ao=this.__wrapped__,ho=function($o){return x1($o,Yr)};return $n>1||this.__actions__.length||!(ao instanceof Iu)||!rm(Yn)?this.thru(ho):(ao=ao.slice(Yn,+Yn+($n?1:0)),ao.__actions__.push({func:H0,args:[ho],thisArg:wr}),new jp(ao,this.__chain__).thru(function($o){return $n&&!$o.length&&$o.push(wr),$o}))});function Z2(){return Qv(this)}function J2(){return new jp(this.value(),this.__chain__)}function Y2(){this.__values__===wr&&(this.__values__=hx(this.value()));var Yr=this.__index__>=this.__values__.length,$n=Yr?wr:this.__values__[this.__index__++];return{done:Yr,value:$n}}function X2(){return this}function Q2(Yr){for(var $n,Yn=this;Yn instanceof A0;){var ao=Hv(Yn);ao.__index__=0,ao.__values__=wr,$n?ho.__wrapped__=ao:$n=ao;var ho=ao;Yn=Yn.__wrapped__}return ho.__wrapped__=Yr,$n}function eE(){var Yr=this.__wrapped__;if(Yr instanceof Iu){var $n=Yr;return this.__actions__.length&&($n=new Iu(this)),$n=$n.reverse(),$n.__actions__.push({func:H0,args:[Z1],thisArg:wr}),new jp($n,this.__chain__)}return this.thru(Z1)}function tE(){return mv(this.__wrapped__,this.__actions__)}var rE=D0(function(Yr,$n,Yn){ju.call(Yr,Yn)?++Yr[Yn]:Qp(Yr,Yn,1)});function nE(Yr,$n,Yn){var ao=wu(Yr)?gy:Kw;return Yn&&vp(Yr,$n,Yn)&&($n=wr),ao(Yr,cu($n,3))}function iE(Yr,$n){var Yn=wu(Yr)?cm:Uy;return Yn(Yr,cu($n,3))}var oE=kv(Kv),aE=kv(Gv);function sE(Yr,$n){return up(K0(Yr,$n),1)}function cE(Yr,$n){return up(K0(Yr,$n),Rn)}function lE(Yr,$n,Yn){return Yn=Yn===wr?1:$u(Yn),up(K0(Yr,$n),Yn)}function _b(Yr,$n){var Yn=wu(Yr)?Mp:fm;return Yn(Yr,cu($n,3))}function ex(Yr,$n){var Yn=wu(Yr)?Rx:Ly;return Yn(Yr,cu($n,3))}var uE=D0(function(Yr,$n,Yn){ju.call(Yr,Yn)?Yr[Yn].push($n):Qp(Yr,Yn,[$n])});function dE(Yr,$n,Yn,ao){Yr=$p(Yr)?Yr:Wm(Yr),Yn=Yn&&!ao?$u(Yn):0;var ho=Yr.length;return Yn<0&&(Yn=op(ho+Yn,0)),X0(Yr)?Yn<=ho&&Yr.indexOf($n,Yn)>-1:!!ho&&Im(Yr,$n,Yn)>-1}var fE=ku(function(Yr,$n,Yn){var ao=-1,ho=typeof $n=="function",$o=$p(Yr)?Go(Yr.length):[];return fm(Yr,function(To){$o[++ao]=ho?mp($n,To,Yn):Qm(To,$n,Yn)}),$o}),hE=D0(function(Yr,$n,Yn){Qp(Yr,Yn,$n)});function K0(Yr,$n){var Yn=wu(Yr)?Gu:Hy;return Yn(Yr,cu($n,3))}function pE(Yr,$n,Yn,ao){return Yr==null?[]:(wu($n)||($n=$n==null?[]:[$n]),Yn=ao?wr:Yn,wu(Yn)||(Yn=Yn==null?[]:[Yn]),Jy(Yr,$n,Yn))}var mE=D0(function(Yr,$n,Yn){Yr[Yn?0:1].push($n)},function(){return[[],[]]});function gE(Yr,$n,Yn){var ao=wu(Yr)?a1:xy,ho=arguments.length<3;return ao(Yr,cu($n,4),Yn,ho,fm)}function yE(Yr,$n,Yn){var ao=wu(Yr)?Tx:xy,ho=arguments.length<3;return ao(Yr,cu($n,4),Yn,ho,Ly)}function vE(Yr,$n){var Yn=wu(Yr)?cm:Uy;return Yn(Yr,J0(cu($n,3)))}function bE(Yr){var $n=wu(Yr)?Oy:d_;return $n(Yr)}function xE(Yr,$n,Yn){(Yn?vp(Yr,$n,Yn):$n===wr)?$n=1:$n=$u($n);var ao=wu(Yr)?Ww:f_;return ao(Yr,$n)}function wE(Yr){var $n=wu(Yr)?qw:p_;return $n(Yr)}function _E(Yr){if(Yr==null)return 0;if($p(Yr))return X0(Yr)?Pm(Yr):Yr.length;var $n=pp(Yr);return $n==Lo||$n==Uo?Yr.size:C1(Yr).length}function EE(Yr,$n,Yn){var ao=wu(Yr)?s1:m_;return Yn&&vp(Yr,$n,Yn)&&($n=wr),ao(Yr,cu($n,3))}var $E=ku(function(Yr,$n){if(Yr==null)return[];var Yn=$n.length;return Yn>1&&vp(Yr,$n[0],$n[1])?$n=[]:Yn>2&&vp($n[0],$n[1],$n[2])&&($n=[$n[0]]),Jy(Yr,up($n,1),[])}),G0=iw||function(){return Hu.Date.now()};function SE(Yr,$n){if(typeof $n!="function")throw new Op(Br);return Yr=$u(Yr),function(){if(--Yr<1)return $n.apply(this,arguments)}}function rx(Yr,$n,Yn){return $n=Yn?wr:$n,$n=Yr&&$n==null?Yr.length:$n,em(Yr,_i,wr,wr,wr,wr,$n)}function nx(Yr,$n){var Yn;if(typeof $n!="function")throw new Op(Br);return Yr=$u(Yr),function(){return--Yr>0&&(Yn=$n.apply(this,arguments)),Yr<=1&&($n=wr),Yn}}var Y1=ku(function(Yr,$n,Yn){var ao=Cn;if(Yn.length){var ho=um(Yn,Um(Y1));ao|=ro}return em(Yr,ao,$n,Yn,ho)}),ix=ku(function(Yr,$n,Yn){var ao=Cn|In;if(Yn.length){var ho=um(Yn,Um(ix));ao|=ro}return em($n,ao,Yr,Yn,ho)});function ox(Yr,$n,Yn){$n=Yn?wr:$n;var ao=em(Yr,jn,wr,wr,wr,wr,wr,$n);return ao.placeholder=ox.placeholder,ao}function ax(Yr,$n,Yn){$n=Yn?wr:$n;var ao=em(Yr,eo,wr,wr,wr,wr,wr,$n);return ao.placeholder=ax.placeholder,ao}function sx(Yr,$n,Yn){var ao,ho,$o,To,Po,Oo,_c=0,yl=!1,Rl=!1,Hl=!0;if(typeof Yr!="function")throw new Op(Br);$n=Up($n)||0,_f(Yn)&&(yl=!!Yn.leading,Rl="maxWait"in Yn,$o=Rl?op(Up(Yn.maxWait)||0,$n):$o,Hl="trailing"in Yn?!!Yn.trailing:Hl);function eu(rp){var Hp=ao,om=ho;return ao=ho=wr,_c=rp,To=Yr.apply(om,Hp),To}function lu(rp){return _c=rp,Po=i0(Ru,$n),yl?eu(rp):To}function Su(rp){var Hp=rp-Oo,om=rp-_c,kx=$n-Hp;return Rl?hp(kx,$o-om):kx}function uu(rp){var Hp=rp-Oo,om=rp-_c;return Oo===wr||Hp>=$n||Hp<0||Rl&&om>=$o}function Ru(){var rp=G0();if(uu(rp))return Pu(rp);Po=i0(Ru,Su(rp))}function Pu(rp){return Po=wr,Hl&&ao?eu(rp):(ao=ho=wr,To)}function Pp(){Po!==wr&&yv(Po),_c=0,ao=Oo=ho=Po=wr}function bp(){return Po===wr?To:Pu(G0())}function Np(){var rp=G0(),Hp=uu(rp);if(ao=arguments,ho=this,Oo=rp,Hp){if(Po===wr)return lu(Oo);if(Rl)return yv(Po),Po=i0(Ru,$n),eu(Oo)}return Po===wr&&(Po=i0(Ru,$n)),To}return Np.cancel=Pp,Np.flush=bp,Np}var kE=ku(function(Yr,$n){return Dy(Yr,1,$n)}),CE=ku(function(Yr,$n,Yn){return Dy(Yr,Up($n)||0,Yn)});function RE(Yr){return em(Yr,io)}function Z0(Yr,$n){if(typeof Yr!="function"||$n!=null&&typeof $n!="function")throw new Op(Br);var Yn=function(){var ao=arguments,ho=$n?$n.apply(this,ao):ao[0],$o=Yn.cache;if($o.has(ho))return $o.get(ho);var To=Yr.apply(this,ao);return Yn.cache=$o.set(ho,To)||$o,To};return Yn.cache=new(Z0.Cache||Xp),Yn}Z0.Cache=Xp;function J0(Yr){if(typeof Yr!="function")throw new Op(Br);return function(){var $n=arguments;switch($n.length){case 0:return!Yr.call(this);case 1:return!Yr.call(this,$n[0]);case 2:return!Yr.call(this,$n[0],$n[1]);case 3:return!Yr.call(this,$n[0],$n[1],$n[2])}return!Yr.apply(this,$n)}}function TE(Yr){return nx(2,Yr)}var IE=g_(function(Yr,$n){$n=$n.length==1&&wu($n[0])?Gu($n[0],Tp(cu())):Gu(up($n,1),Tp(cu()));var Yn=$n.length;return ku(function(ao){for(var ho=-1,$o=hp(ao.length,Yn);++ho<$o;)ao[ho]=$n[ho].call(this,ao[ho]);return mp(Yr,this,ao)})}),X1=ku(function(Yr,$n){var Yn=um($n,Um(X1));return em(Yr,ro,wr,$n,Yn)}),cx=ku(function(Yr,$n){var Yn=um($n,Um(cx));return em(Yr,to,wr,$n,Yn)}),AE=tm(function(Yr,$n){return em(Yr,oo,wr,wr,wr,$n)});function PE(Yr,$n){if(typeof Yr!="function")throw new Op(Br);return $n=$n===wr?$n:$u($n),ku(Yr,$n)}function NE(Yr,$n){if(typeof Yr!="function")throw new Op(Br);return $n=$n==null?0:op($u($n),0),ku(function(Yn){var ao=Yn[$n],ho=mm(Yn,0,$n);return ao&&lm(ho,ao),mp(Yr,this,ho)})}function ME(Yr,$n,Yn){var ao=!0,ho=!0;if(typeof Yr!="function")throw new Op(Br);return _f(Yn)&&(ao="leading"in Yn?!!Yn.leading:ao,ho="trailing"in Yn?!!Yn.trailing:ho),sx(Yr,$n,{leading:ao,maxWait:$n,trailing:ho})}function OE(Yr){return rx(Yr,1)}function jE(Yr,$n){return X1(j1($n),Yr)}function BE(){if(!arguments.length)return[];var Yr=arguments[0];return wu(Yr)?Yr:[Yr]}function DE(Yr){return Bp(Yr,Qr)}function LE(Yr,$n){return $n=typeof $n=="function"?$n:wr,Bp(Yr,Qr,$n)}function UE(Yr){return Bp(Yr,Zr|Qr)}function FE(Yr,$n){return $n=typeof $n=="function"?$n:wr,Bp(Yr,Zr|Qr,$n)}function WE(Yr,$n){return $n==null||By(Yr,$n,sp($n))}function Vp(Yr,$n){return Yr===$n||Yr!==Yr&&$n!==$n}var qE=W0($1),zE=W0(function(Yr,$n){return Yr>=$n}),km=qy(function(){return arguments}())?qy:function(Yr){return ep(Yr)&&ju.call(Yr,"callee")&&!Ty.call(Yr,"callee")},wu=Go.isArray,VE=am?Tp(am):Qw;function $p(Yr){return Yr!=null&&Y0(Yr.length)&&!nm(Yr)}function tp(Yr){return ep(Yr)&&$p(Yr)}function HE(Yr){return Yr===!0||Yr===!1||ep(Yr)&&yp(Yr)==lo}var gm=aw||ly,KE=Cm?Tp(Cm):e_;function GE(Yr){return ep(Yr)&&Yr.nodeType===1&&!o0(Yr)}function ZE(Yr){if(Yr==null)return!0;if($p(Yr)&&(wu(Yr)||typeof Yr=="string"||typeof Yr.splice=="function"||gm(Yr)||Fm(Yr)||km(Yr)))return!Yr.length;var $n=pp(Yr);if($n==Lo||$n==Uo)return!Yr.size;if(n0(Yr))return!C1(Yr).length;for(var Yn in Yr)if(ju.call(Yr,Yn))return!1;return!0}function JE(Yr,$n){return e0(Yr,$n)}function YE(Yr,$n,Yn){Yn=typeof Yn=="function"?Yn:wr;var ao=Yn?Yn(Yr,$n):wr;return ao===wr?e0(Yr,$n,wr,Yn):!!ao}function Q1(Yr){if(!ep(Yr))return!1;var $n=yp(Yr);return $n==yo||$n==mo||typeof Yr.message=="string"&&typeof Yr.name=="string"&&!o0(Yr)}function XE(Yr){return typeof Yr=="number"&&Ay(Yr)}function nm(Yr){if(!_f(Yr))return!1;var $n=yp(Yr);return $n==_o||$n==Bo||$n==uo||$n==wl}function lx(Yr){return typeof Yr=="number"&&Yr==$u(Yr)}function Y0(Yr){return typeof Yr=="number"&&Yr>-1&&Yr%1==0&&Yr<=Pn}function _f(Yr){var $n=typeof Yr;return Yr!=null&&($n=="object"||$n=="function")}function ep(Yr){return Yr!=null&&typeof Yr=="object"}var ux=vm?Tp(vm):r_;function QE(Yr,$n){return Yr===$n||k1(Yr,$n,q1($n))}function e3(Yr,$n,Yn){return Yn=typeof Yn=="function"?Yn:wr,k1(Yr,$n,q1($n),Yn)}function t3(Yr){return dx(Yr)&&Yr!=+Yr}function r3(Yr){if(L_(Yr))throw new xu(jr);return zy(Yr)}function n3(Yr){return Yr===null}function i3(Yr){return Yr==null}function dx(Yr){return typeof Yr=="number"||ep(Yr)&&yp(Yr)==Wo}function o0(Yr){if(!ep(Yr)||yp(Yr)!=qo)return!1;var $n=$0(Yr);if($n===null)return!0;var Yn=ju.call($n,"constructor")&&$n.constructor;return typeof Yn=="function"&&Yn instanceof Yn&&x0.call(Yn)==ew}var ey=Tm?Tp(Tm):n_;function o3(Yr){return lx(Yr)&&Yr>=-Pn&&Yr<=Pn}var fx=n1?Tp(n1):i_;function X0(Yr){return typeof Yr=="string"||!wu(Yr)&&ep(Yr)&&yp(Yr)==Nl}function Ap(Yr){return typeof Yr=="symbol"||ep(Yr)&&yp(Yr)==Vo}var Fm=u0?Tp(u0):o_;function a3(Yr){return Yr===wr}function s3(Yr){return ep(Yr)&&pp(Yr)==Ol}function c3(Yr){return ep(Yr)&&yp(Yr)==$a}var l3=W0(R1),u3=W0(function(Yr,$n){return Yr<=$n});function hx(Yr){if(!Yr)return[];if($p(Yr))return X0(Yr)?qp(Yr):Ep(Yr);if(Hm&&Yr[Hm])return Wx(Yr[Hm]());var $n=pp(Yr),Yn=$n==Lo?h1:$n==Uo?y0:Wm;return Yn(Yr)}function im(Yr){if(!Yr)return Yr===0?Yr:0;if(Yr=Up(Yr),Yr===Rn||Yr===-Rn){var $n=Yr<0?-1:1;return $n*On}return Yr===Yr?Yr:0}function $u(Yr){var $n=im(Yr),Yn=$n%1;return $n===$n?Yn?$n-Yn:$n:0}function px(Yr){return Yr?_m($u(Yr),0,Nn):0}function Up(Yr){if(typeof Yr=="number")return Yr;if(Ap(Yr))return Zn;if(_f(Yr)){var $n=typeof Yr.valueOf=="function"?Yr.valueOf():Yr;Yr=_f($n)?$n+"":$n}if(typeof Yr!="string")return Yr===0?Yr:+Yr;Yr=wy(Yr);var Yn=Cu.test(Yr);return Yn||pu.test(Yr)?Xu(Yr.slice(2),Yn?2:8):El.test(Yr)?Zn:+Yr}function mx(Yr){return Zp(Yr,Sp(Yr))}function d3(Yr){return Yr?_m($u(Yr),-Pn,Pn):Yr===0?Yr:0}function Ou(Yr){return Yr==null?"":Ip(Yr)}var f3=Dm(function(Yr,$n){if(n0($n)||$p($n)){Zp($n,sp($n),Yr);return}for(var Yn in $n)ju.call($n,Yn)&&Ym(Yr,Yn,$n[Yn])}),gx=Dm(function(Yr,$n){Zp($n,Sp($n),Yr)}),Q0=Dm(function(Yr,$n,Yn,ao){Zp($n,Sp($n),Yr,ao)}),h3=Dm(function(Yr,$n,Yn,ao){Zp($n,sp($n),Yr,ao)}),p3=tm(x1);function m3(Yr,$n){var Yn=Bm(Yr);return $n==null?Yn:jy(Yn,$n)}var g3=ku(function(Yr,$n){Yr=Uu(Yr);var Yn=-1,ao=$n.length,ho=ao>2?$n[2]:wr;for(ho&&vp($n[0],$n[1],ho)&&(ao=1);++Yn1),$o}),Zp(Yr,F1(Yr),Yn),ao&&(Yn=Bp(Yn,Zr|Jr|Qr,C_));for(var ho=$n.length;ho--;)N1(Yn,$n[ho]);return Yn});function j3(Yr,$n){return vx(Yr,J0(cu($n)))}var B3=tm(function(Yr,$n){return Yr==null?{}:c_(Yr,$n)});function vx(Yr,$n){if(Yr==null)return{};var Yn=Gu(F1(Yr),function(ao){return[ao]});return $n=cu($n),Yy(Yr,Yn,function(ao,ho){return $n(ao,ho[0])})}function D3(Yr,$n,Yn){$n=pm($n,Yr);var ao=-1,ho=$n.length;for(ho||(ho=1,Yr=wr);++ao$n){var ao=Yr;Yr=$n,$n=ao}if(Yn||Yr%1||$n%1){var ho=Py();return hp(Yr+ho*($n-Yr+Yu("1e-"+((ho+"").length-1))),$n)}return I1(Yr,$n)}var Z3=Lm(function(Yr,$n,Yn){return $n=$n.toLowerCase(),Yr+(Yn?wx($n):$n)});function wx(Yr){return ny(Ou(Yr).toLowerCase())}function _x(Yr){return Yr=Ou(Yr),Yr&&Yr.replace(hu,Bx).replace(Rm,"")}function J3(Yr,$n,Yn){Yr=Ou(Yr),$n=Ip($n);var ao=Yr.length;Yn=Yn===wr?ao:_m($u(Yn),0,ao);var ho=Yn;return Yn-=$n.length,Yn>=0&&Yr.slice(Yn,ho)==$n}function Y3(Yr){return Yr=Ou(Yr),Yr&&Bl.test(Yr)?Yr.replace(Tl,Dx):Yr}function X3(Yr){return Yr=Ou(Yr),Yr&&_u.test(Yr)?Yr.replace(Sl,"\\$&"):Yr}var Q3=Lm(function(Yr,$n,Yn){return Yr+(Yn?"-":"")+$n.toLowerCase()}),e$=Lm(function(Yr,$n,Yn){return Yr+(Yn?" ":"")+$n.toLowerCase()}),t$=Sv("toLowerCase");function r$(Yr,$n,Yn){Yr=Ou(Yr),$n=$u($n);var ao=$n?Pm(Yr):0;if(!$n||ao>=$n)return Yr;var ho=($n-ao)/2;return F0(R0(ho),Yn)+Yr+F0(C0(ho),Yn)}function n$(Yr,$n,Yn){Yr=Ou(Yr),$n=$u($n);var ao=$n?Pm(Yr):0;return $n&&ao<$n?Yr+F0($n-ao,Yn):Yr}function i$(Yr,$n,Yn){Yr=Ou(Yr),$n=$u($n);var ao=$n?Pm(Yr):0;return $n&&ao<$n?F0($n-ao,Yn)+Yr:Yr}function o$(Yr,$n,Yn){return Yn||$n==null?$n=0:$n&&($n=+$n),uw(Ou(Yr).replace(So,""),$n||0)}function a$(Yr,$n,Yn){return(Yn?vp(Yr,$n,Yn):$n===wr)?$n=1:$n=$u($n),A1(Ou(Yr),$n)}function s$(){var Yr=arguments,$n=Ou(Yr[0]);return Yr.length<3?$n:$n.replace(Yr[1],Yr[2])}var c$=Lm(function(Yr,$n,Yn){return Yr+(Yn?"_":"")+$n.toLowerCase()});function l$(Yr,$n,Yn){return Yn&&typeof Yn!="number"&&vp(Yr,$n,Yn)&&($n=Yn=wr),Yn=Yn===wr?Nn:Yn>>>0,Yn?(Yr=Ou(Yr),Yr&&(typeof $n=="string"||$n!=null&&!ey($n))&&($n=Ip($n),!$n&&Am(Yr))?mm(qp(Yr),0,Yn):Yr.split($n,Yn)):[]}var u$=Lm(function(Yr,$n,Yn){return Yr+(Yn?" ":"")+ny($n)});function d$(Yr,$n,Yn){return Yr=Ou(Yr),Yn=Yn==null?0:_m($u(Yn),0,Yr.length),$n=Ip($n),Yr.slice(Yn,Yn+$n.length)==$n}function f$(Yr,$n,Yn){var ao=xo.templateSettings;Yn&&vp(Yr,$n,Yn)&&($n=wr),Yr=Ou(Yr),$n=Q0({},$n,ao,Pv);var ho=Q0({},$n.imports,ao.imports,Pv),$o=sp(ho),To=f1(ho,$o),Po,Oo,_c=0,yl=$n.interpolate||mu,Rl="__p += '",Hl=p1(($n.escape||mu).source+"|"+yl.source+"|"+(yl===Al?Wl:mu).source+"|"+($n.evaluate||mu).source+"|$","g"),eu="//# sourceURL="+(ju.call($n,"sourceURL")?($n.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++r1+"]")+` `;Yr.replace(Hl,function(uu,Ru,Pu,Pp,bp,Np){return Pu||(Pu=Pp),Rl+=Yr.slice(_c,Np).replace(vu,Lx),Ru&&(Po=!0,Rl+=`' + __e(`+Ru+`) + -'`),bp&&(Mo=!0,Rl+=`'; +'`),bp&&(Oo=!0,Rl+=`'; `+bp+`; __p += '`),Pu&&(Rl+=`' + ((__t = (`+Pu+`)) == null ? '' : __t) + @@ -4183,13 +4187,13 @@ __p += '`),Pu&&(Rl+=`' + `;var lu=ju.call($n,"variable")&&$n.variable;if(!lu)Rl=`with (obj) { `+Rl+` } -`;else if(jo.test(lu))throw new xu(Wr);Rl=(Mo?Rl.replace(Ll,""):Rl).replace(_l,"$1").replace(bu,"$1;"),Rl="function("+(lu||"obj")+`) { +`;else if(jo.test(lu))throw new xu(Wr);Rl=(Oo?Rl.replace(Ll,""):Rl).replace(_l,"$1").replace(bu,"$1;"),Rl="function("+(lu||"obj")+`) { `+(lu?"":`obj || (obj = {}); -`)+"var __t, __p = ''"+(Po?", __e = _.escape":"")+(Mo?`, __j = Array.prototype.join; +`)+"var __t, __p = ''"+(Po?", __e = _.escape":"")+(Oo?`, __j = Array.prototype.join; function print() { __p += __j.call(arguments, '') } `:`; `)+Rl+`return __p -}`;var Su=$x(function(){return Ou($o,eu+"return "+Rl).apply(wr,To)});if(Su.source=Rl,Yy(Su))throw Su;return Su}function h$(Yr){return Mu(Yr).toLowerCase()}function p$(Yr){return Mu(Yr).toUpperCase()}function m$(Yr,$n,Yn){if(Yr=Mu(Yr),Yr&&(Yn||$n===wr))return x1(Yr);if(!Yr||!($n=Ip($n)))return Yr;var ao=qp(Yr),ho=qp($n),$o=w1(ao,ho),To=E1(ao,ho)+1;return mm(ao,$o,To).join("")}function g$(Yr,$n,Yn){if(Yr=Mu(Yr),Yr&&(Yn||$n===wr))return Yr.slice(0,S1(Yr)+1);if(!Yr||!($n=Ip($n)))return Yr;var ao=qp(Yr),ho=E1(ao,qp($n))+1;return mm(ao,0,ho).join("")}function y$(Yr,$n,Yn){if(Yr=Mu(Yr),Yr&&(Yn||$n===wr))return Yr.replace(So,"");if(!Yr||!($n=Ip($n)))return Yr;var ao=qp(Yr),ho=w1(ao,qp($n));return mm(ao,ho).join("")}function v$(Yr,$n){var Yn=co,ao=so;if(_f($n)){var ho="separator"in $n?$n.separator:ho;Yn="length"in $n?$u($n.length):Yn,ao="omission"in $n?Ip($n.omission):ao}Yr=Mu(Yr);var $o=Yr.length;if(Am(Yr)){var To=qp(Yr);$o=To.length}if(Yn>=$o)return Yr;var Po=Yn-Pm(ao);if(Po<1)return ao;var Mo=To?mm(To,0,Po).join(""):Yr.slice(0,Po);if(ho===wr)return Mo+ao;if(To&&(Po+=Mo.length-Po),Xy(ho)){if(Yr.slice(Po).search(ho)){var _c,yl=Mo;for(ho.global||(ho=py(ho.source,Mu($l.exec(ho))+"g")),ho.lastIndex=0;_c=ho.exec(yl);)var Rl=_c.index;Mo=Mo.slice(0,Rl===wr?Po:Rl)}}else if(Yr.indexOf(Ip(ho),Po)!=Po){var Hl=Mo.lastIndexOf(ho);Hl>-1&&(Mo=Mo.slice(0,Hl))}return Mo+ao}function b$(Yr){return Yr=Mu(Yr),Yr&&du.test(Yr)?Yr.replace(xl,Hx):Yr}var x$=Lm(function(Yr,$n,Yn){return Yr+(Yn?" ":"")+$n.toUpperCase()}),t1=Sv("toUpperCase");function Ex(Yr,$n,Yn){return Yr=Mu(Yr),$n=Yn?wr:$n,$n===wr?Ux(Yr)?Zx(Yr):Px(Yr):Yr.match($n)||[]}var $x=ku(function(Yr,$n){try{return mp(Yr,wr,$n)}catch(Yn){return Yy(Yn)?Yn:new xu(Yn)}}),w$=tm(function(Yr,$n){return Op($n,function(Yn){Yn=Jp(Yn),Qp(Yr,Yn,Zy(Yr[Yn],Yr))}),Yr});function _$(Yr){var $n=Yr==null?0:Yr.length,Yn=cu();return Yr=$n?Gu(Yr,function(ao){if(typeof ao[1]!="function")throw new Mp(Br);return[Yn(ao[0]),ao[1]]}):[],ku(function(ao){for(var ho=-1;++ho<$n;){var $o=Yr[ho];if(mp($o[0],this,ao))return mp($o[1],this,ao)}})}function E$(Yr){return Hw(Bp(Yr,Zr))}function r1(Yr){return function(){return Yr}}function $$(Yr,$n){return Yr==null||Yr!==Yr?$n:Yr}var S$=Cv(),k$=Cv(!0);function kp(Yr){return Yr}function n1(Yr){return V1(typeof Yr=="function"?Yr:Bp(Yr,Zr))}function C$(Yr){return K1(Bp(Yr,Zr))}function R$(Yr,$n){return G1(Yr,Bp($n,Zr))}var T$=ku(function(Yr,$n){return function(Yn){return Qm(Yn,Yr,$n)}}),I$=ku(function(Yr,$n){return function(Yn){return Qm(Yr,Yn,$n)}});function i1(Yr,$n,Yn){var ao=sp($n),ho=O0($n,ao);Yn==null&&!(_f($n)&&(ho.length||!ao.length))&&(Yn=$n,$n=Yr,Yr=this,ho=O0($n,sp($n)));var $o=!(_f(Yn)&&"chain"in Yn)||!!Yn.chain,To=nm(Yr);return Op(ho,function(Po){var Mo=$n[Po];Yr[Po]=Mo,To&&(Yr.prototype[Po]=function(){var _c=this.__chain__;if($o||_c){var yl=Yr(this.__wrapped__),Rl=yl.__actions__=Ep(this.__actions__);return Rl.push({func:Mo,args:arguments,thisArg:Yr}),yl.__chain__=_c,yl}return Mo.apply(Yr,lm([this.value()],arguments))})}),Yr}function A$(){return Hu._===this&&(Hu._=tw),this}function o1(){}function P$(Yr){return Yr=$u(Yr),ku(function($n){return Z1($n,Yr)})}var N$=jy(Gu),O$=jy(p1),M$=jy(sy);function Sx(Yr){return qy(Yr)?cy(Jp(Yr)):l_(Yr)}function j$(Yr){return function($n){return Yr==null?wr:Em(Yr,$n)}}var B$=Tv(),D$=Tv(!0);function a1(){return[]}function s1(){return!1}function L$(){return{}}function F$(){return""}function U$(){return!0}function W$(Yr,$n){if(Yr=$u(Yr),Yr<1||Yr>Pn)return[];var Yn=Nn,ao=hp(Yr,Nn);$n=cu($n),Yr-=Nn;for(var ho=dy(ao,$n);++Yn0||$n<0)?new Iu(Yn):(Yr<0?Yn=Yn.takeRight(-Yr):Yr&&(Yn=Yn.drop(Yr)),$n!==wr&&($n=$u($n),Yn=$n<0?Yn.dropRight(-$n):Yn.take($n-Yr)),Yn)},Iu.prototype.takeRightWhile=function(Yr){return this.reverse().takeWhile(Yr).reverse()},Iu.prototype.toArray=function(){return this.take(Nn)},Gp(Iu.prototype,function(Yr,$n){var Yn=/^(?:filter|find|map|reject)|While$/.test($n),ao=/^(?:head|last)$/.test($n),ho=xo[ao?"take"+($n=="last"?"Right":""):$n],$o=ao||/^find/.test($n);ho&&(xo.prototype[$n]=function(){var To=this.__wrapped__,Po=ao?[1]:arguments,Mo=To instanceof Iu,_c=Po[0],yl=Mo||wu(To),Rl=function(Ru){var Pu=ho.apply(xo,lm([Ru],Po));return ao&&Hl?Pu[0]:Pu};yl&&Yn&&typeof _c=="function"&&_c.length!=1&&(Mo=yl=!1);var Hl=this.__chain__,eu=!!this.__actions__.length,lu=$o&&!Hl,Su=Mo&&!eu;if(!$o&&yl){To=Su?To:new Iu(this);var uu=Yr.apply(To,Po);return uu.__actions__.push({func:H0,args:[Rl],thisArg:wr}),new jp(uu,Hl)}return lu&&Su?Yr.apply(this,Po):(uu=this.thru(Rl),lu?ao?uu.value()[0]:uu.value():uu)})}),Op(["pop","push","shift","sort","splice","unshift"],function(Yr){var $n=v0[Yr],Yn=/^(?:push|sort|unshift)$/.test(Yr)?"tap":"thru",ao=/^(?:pop|shift)$/.test(Yr);xo.prototype[Yr]=function(){var ho=arguments;if(ao&&!this.__chain__){var $o=this.value();return $n.apply(wu($o)?$o:[],ho)}return this[Yn](function(To){return $n.apply(wu(To)?To:[],ho)})}}),Gp(Iu.prototype,function(Yr,$n){var Yn=xo[$n];if(Yn){var ao=Yn.name+"";ju.call(jm,ao)||(jm[ao]=[]),jm[ao].push({name:$n,func:Yn})}}),jm[L0(wr,In).name]=[{name:"wrapper",func:wr}],Iu.prototype.clone=yw,Iu.prototype.reverse=vw,Iu.prototype.value=bw,xo.prototype.at=G2,xo.prototype.chain=Z2,xo.prototype.commit=J2,xo.prototype.next=Y2,xo.prototype.plant=Q2,xo.prototype.reverse=eE,xo.prototype.toJSON=xo.prototype.valueOf=xo.prototype.value=tE,xo.prototype.first=xo.prototype.head,Hm&&(xo.prototype[Hm]=X2),xo},Nm=Jx();_p?((_p.exports=Nm)._=Nm,gp._=Nm):Hu._=Nm}).call(ge)})(Ui,Ui.exports);var Gg=Object.defineProperty,zg=Object.defineProperties,Kg=Object.getOwnPropertyDescriptors,Ea=Object.getOwnPropertySymbols,Yg=Object.prototype.hasOwnProperty,Zg=Object.prototype.propertyIsEnumerable,ya=(fr,br,wr)=>br in fr?Gg(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,cr=(fr,br)=>{for(var wr in br||(br={}))Yg.call(br,wr)&&ya(fr,wr,br[wr]);if(Ea)for(var wr of Ea(br))Zg.call(br,wr)&&ya(fr,wr,br[wr]);return fr},Jg=(fr,br)=>zg(fr,Kg(br));function ft(fr,br,wr){var Er;const kr=ve(fr);return((Er=br.rpcMap)==null?void 0:Er[kr.reference])||`${Bg}?chainId=${kr.namespace}:${kr.reference}&projectId=${wr}`}function Ct(fr){return fr.includes(":")?fr.split(":")[1]:fr}function Sa(fr){return fr.map(br=>`${br.split(":")[0]}:${br.split(":")[1]}`)}function Xg(fr,br){const wr=Object.keys(br.namespaces).filter(kr=>kr.includes(fr));if(!wr.length)return[];const Er=[];return wr.forEach(kr=>{const jr=br.namespaces[kr].accounts;Er.push(...jr)}),Er}function Oa(fr={},br={}){const wr=Ra(fr),Er=Ra(br);return Ui.exports.merge(wr,Er)}function Ra(fr){var br,wr,Er,kr;const jr={};if(!B$2(fr))return jr;for(const[Br,Wr]of Object.entries(fr)){const qr=oe(Br)?[Br]:Wr.chains,Gr=Wr.methods||[],Vr=Wr.events||[],Zr=Wr.rpcMap||{},Jr=en(Br);jr[Jr]=Jg(cr(cr({},jr[Jr]),Wr),{chains:S$2(qr,(br=jr[Jr])==null?void 0:br.chains),methods:S$2(Gr,(wr=jr[Jr])==null?void 0:wr.methods),events:S$2(Vr,(Er=jr[Jr])==null?void 0:Er.events),rpcMap:cr(cr({},Zr),(kr=jr[Jr])==null?void 0:kr.rpcMap)})}return jr}function Qg(fr){return fr.includes(":")?fr.split(":")[2]:fr}function Vg(fr){const br={};for(const[wr,Er]of Object.entries(fr)){const kr=Er.methods||[],jr=Er.events||[],Br=Er.accounts||[],Wr=oe(wr)?[wr]:Er.chains?Er.chains:Sa(Er.accounts);br[wr]={chains:Wr,methods:kr,events:jr,accounts:Br}}return br}function Wi(fr){return typeof fr=="number"?fr:fr.includes("0x")?parseInt(fr,16):(fr=fr.includes(":")?fr.split(":")[1]:fr,isNaN(Number(fr))?fr:Number(fr))}const ba={},z$2=fr=>ba[fr],Fi=(fr,br)=>{ba[fr]=br};class kg{constructor(br){this.name="polkadot",this.namespace=br.namespace,this.events=z$2("events"),this.client=z$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(br){this.namespace=Object.assign(this.namespace,br)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const br=this.namespace.chains[0];if(!br)throw new Error("ChainId not found");return br.split(":")[1]}request(br){return this.namespace.methods.includes(br.request.method)?this.client.request(br):this.getHttpProvider().request(br.request)}setDefaultChain(br,wr){this.httpProviders[br]||this.setHttpProvider(br,wr),this.chainId=br,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${br}`)}getAccounts(){const br=this.namespace.accounts;return br?br.filter(wr=>wr.split(":")[1]===this.chainId.toString()).map(wr=>wr.split(":")[2])||[]:[]}createHttpProviders(){const br={};return this.namespace.chains.forEach(wr=>{var Er;const kr=Ct(wr);br[kr]=this.createHttpProvider(kr,(Er=this.namespace.rpcMap)==null?void 0:Er[wr])}),br}getHttpProvider(){const br=`${this.name}:${this.chainId}`,wr=this.httpProviders[br];if(typeof wr>"u")throw new Error(`JSON-RPC provider for ${br} not found`);return wr}setHttpProvider(br,wr){const Er=this.createHttpProvider(br,wr);Er&&(this.httpProviders[br]=Er)}createHttpProvider(br,wr){const Er=wr||ft(br,this.namespace,this.client.core.projectId);if(!Er)throw new Error(`No RPC url provided for chainId: ${br}`);return new JsonRpcProvider(new f$4(Er,z$2("disableProviderPing")))}}class jg{constructor(br){this.name="eip155",this.namespace=br.namespace,this.events=z$2("events"),this.client=z$2("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(br){switch(br.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(br);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(br.request.method)?await this.client.request(br):this.getHttpProvider().request(br.request)}updateNamespace(br){this.namespace=Object.assign(this.namespace,br)}setDefaultChain(br,wr){this.httpProviders[br]||this.setHttpProvider(parseInt(br),wr),this.chainId=parseInt(br),this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${br}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const br=this.namespace.chains[0];if(!br)throw new Error("ChainId not found");return br.split(":")[1]}createHttpProvider(br,wr){const Er=wr||ft(`${this.name}:${br}`,this.namespace,this.client.core.projectId);if(!Er)throw new Error(`No RPC url provided for chainId: ${br}`);return new JsonRpcProvider(new f$4(Er,z$2("disableProviderPing")))}setHttpProvider(br,wr){const Er=this.createHttpProvider(br,wr);Er&&(this.httpProviders[br]=Er)}createHttpProviders(){const br={};return this.namespace.chains.forEach(wr=>{var Er;const kr=parseInt(Ct(wr));br[kr]=this.createHttpProvider(kr,(Er=this.namespace.rpcMap)==null?void 0:Er[wr])}),br}getAccounts(){const br=this.namespace.accounts;return br?[...new Set(br.filter(wr=>wr.split(":")[1]===this.chainId.toString()).map(wr=>wr.split(":")[2]))]:[]}getHttpProvider(){const br=this.chainId,wr=this.httpProviders[br];if(typeof wr>"u")throw new Error(`JSON-RPC provider for ${br} not found`);return wr}async handleSwitchChain(br){var wr,Er;let kr=br.request.params?(wr=br.request.params[0])==null?void 0:wr.chainId:"0x0";kr=kr.startsWith("0x")?kr:`0x${kr}`;const jr=parseInt(kr,16);if(this.isChainApproved(jr))this.setDefaultChain(`${jr}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:br.topic,request:{method:br.request.method,params:[{chainId:kr}]},chainId:(Er=this.namespace.chains)==null?void 0:Er[0]}),this.setDefaultChain(`${jr}`);else throw new Error(`Failed to switch to chain 'eip155:${jr}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(br){return this.namespace.chains.includes(`${this.name}:${br}`)}}class nv{constructor(br){this.name="solana",this.namespace=br.namespace,this.events=z$2("events"),this.client=z$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(br){this.namespace=Object.assign(this.namespace,br)}requestAccounts(){return this.getAccounts()}request(br){return this.namespace.methods.includes(br.request.method)?this.client.request(br):this.getHttpProvider().request(br.request)}setDefaultChain(br,wr){this.httpProviders[br]||this.setHttpProvider(br,wr),this.chainId=br,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${br}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const br=this.namespace.chains[0];if(!br)throw new Error("ChainId not found");return br.split(":")[1]}getAccounts(){const br=this.namespace.accounts;return br?[...new Set(br.filter(wr=>wr.split(":")[1]===this.chainId.toString()).map(wr=>wr.split(":")[2]))]:[]}createHttpProviders(){const br={};return this.namespace.chains.forEach(wr=>{var Er;const kr=Ct(wr);br[kr]=this.createHttpProvider(kr,(Er=this.namespace.rpcMap)==null?void 0:Er[wr])}),br}getHttpProvider(){const br=`${this.name}:${this.chainId}`,wr=this.httpProviders[br];if(typeof wr>"u")throw new Error(`JSON-RPC provider for ${br} not found`);return wr}setHttpProvider(br,wr){const Er=this.createHttpProvider(br,wr);Er&&(this.httpProviders[br]=Er)}createHttpProvider(br,wr){const Er=wr||ft(br,this.namespace,this.client.core.projectId);if(!Er)throw new Error(`No RPC url provided for chainId: ${br}`);return new JsonRpcProvider(new f$4(Er,z$2("disableProviderPing")))}}class tv{constructor(br){this.name="cosmos",this.namespace=br.namespace,this.events=z$2("events"),this.client=z$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(br){this.namespace=Object.assign(this.namespace,br)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const br=this.namespace.chains[0];if(!br)throw new Error("ChainId not found");return br.split(":")[1]}request(br){return this.namespace.methods.includes(br.request.method)?this.client.request(br):this.getHttpProvider().request(br.request)}setDefaultChain(br,wr){this.httpProviders[br]||this.setHttpProvider(br,wr),this.chainId=br,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const br=this.namespace.accounts;return br?[...new Set(br.filter(wr=>wr.split(":")[1]===this.chainId.toString()).map(wr=>wr.split(":")[2]))]:[]}createHttpProviders(){const br={};return this.namespace.chains.forEach(wr=>{var Er;const kr=Ct(wr);br[kr]=this.createHttpProvider(kr,(Er=this.namespace.rpcMap)==null?void 0:Er[wr])}),br}getHttpProvider(){const br=`${this.name}:${this.chainId}`,wr=this.httpProviders[br];if(typeof wr>"u")throw new Error(`JSON-RPC provider for ${br} not found`);return wr}setHttpProvider(br,wr){const Er=this.createHttpProvider(br,wr);Er&&(this.httpProviders[br]=Er)}createHttpProvider(br,wr){const Er=wr||ft(br,this.namespace,this.client.core.projectId);if(!Er)throw new Error(`No RPC url provided for chainId: ${br}`);return new JsonRpcProvider(new f$4(Er,z$2("disableProviderPing")))}}class ev{constructor(br){this.name="cip34",this.namespace=br.namespace,this.events=z$2("events"),this.client=z$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(br){this.namespace=Object.assign(this.namespace,br)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const br=this.namespace.chains[0];if(!br)throw new Error("ChainId not found");return br.split(":")[1]}request(br){return this.namespace.methods.includes(br.request.method)?this.client.request(br):this.getHttpProvider().request(br.request)}setDefaultChain(br,wr){this.httpProviders[br]||this.setHttpProvider(br,wr),this.chainId=br,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const br=this.namespace.accounts;return br?[...new Set(br.filter(wr=>wr.split(":")[1]===this.chainId.toString()).map(wr=>wr.split(":")[2]))]:[]}createHttpProviders(){const br={};return this.namespace.chains.forEach(wr=>{const Er=this.getCardanoRPCUrl(wr),kr=Ct(wr);br[kr]=this.createHttpProvider(kr,Er)}),br}getHttpProvider(){const br=`${this.name}:${this.chainId}`,wr=this.httpProviders[br];if(typeof wr>"u")throw new Error(`JSON-RPC provider for ${br} not found`);return wr}getCardanoRPCUrl(br){const wr=this.namespace.rpcMap;if(wr)return wr[br]}setHttpProvider(br,wr){const Er=this.createHttpProvider(br,wr);Er&&(this.httpProviders[br]=Er)}createHttpProvider(br,wr){const Er=wr||this.getCardanoRPCUrl(br);if(!Er)throw new Error(`No RPC url provided for chainId: ${br}`);return new JsonRpcProvider(new f$4(Er,z$2("disableProviderPing")))}}class rv{constructor(br){this.name="elrond",this.namespace=br.namespace,this.events=z$2("events"),this.client=z$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(br){this.namespace=Object.assign(this.namespace,br)}requestAccounts(){return this.getAccounts()}request(br){return this.namespace.methods.includes(br.request.method)?this.client.request(br):this.getHttpProvider().request(br.request)}setDefaultChain(br,wr){this.httpProviders[br]||this.setHttpProvider(br,wr),this.chainId=br,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${br}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const br=this.namespace.chains[0];if(!br)throw new Error("ChainId not found");return br.split(":")[1]}getAccounts(){const br=this.namespace.accounts;return br?[...new Set(br.filter(wr=>wr.split(":")[1]===this.chainId.toString()).map(wr=>wr.split(":")[2]))]:[]}createHttpProviders(){const br={};return this.namespace.chains.forEach(wr=>{var Er;const kr=Ct(wr);br[kr]=this.createHttpProvider(kr,(Er=this.namespace.rpcMap)==null?void 0:Er[wr])}),br}getHttpProvider(){const br=`${this.name}:${this.chainId}`,wr=this.httpProviders[br];if(typeof wr>"u")throw new Error(`JSON-RPC provider for ${br} not found`);return wr}setHttpProvider(br,wr){const Er=this.createHttpProvider(br,wr);Er&&(this.httpProviders[br]=Er)}createHttpProvider(br,wr){const Er=wr||ft(br,this.namespace,this.client.core.projectId);if(!Er)throw new Error(`No RPC url provided for chainId: ${br}`);return new JsonRpcProvider(new f$4(Er,z$2("disableProviderPing")))}}class iv{constructor(br){this.name="multiversx",this.namespace=br.namespace,this.events=z$2("events"),this.client=z$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(br){this.namespace=Object.assign(this.namespace,br)}requestAccounts(){return this.getAccounts()}request(br){return this.namespace.methods.includes(br.request.method)?this.client.request(br):this.getHttpProvider().request(br.request)}setDefaultChain(br,wr){this.httpProviders[br]||this.setHttpProvider(br,wr),this.chainId=br,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${br}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const br=this.namespace.chains[0];if(!br)throw new Error("ChainId not found");return br.split(":")[1]}getAccounts(){const br=this.namespace.accounts;return br?[...new Set(br.filter(wr=>wr.split(":")[1]===this.chainId.toString()).map(wr=>wr.split(":")[2]))]:[]}createHttpProviders(){const br={};return this.namespace.chains.forEach(wr=>{var Er;const kr=Ct(wr);br[kr]=this.createHttpProvider(kr,(Er=this.namespace.rpcMap)==null?void 0:Er[wr])}),br}getHttpProvider(){const br=`${this.name}:${this.chainId}`,wr=this.httpProviders[br];if(typeof wr>"u")throw new Error(`JSON-RPC provider for ${br} not found`);return wr}setHttpProvider(br,wr){const Er=this.createHttpProvider(br,wr);Er&&(this.httpProviders[br]=Er)}createHttpProvider(br,wr){const Er=wr||ft(br,this.namespace,this.client.core.projectId);if(!Er)throw new Error(`No RPC url provided for chainId: ${br}`);return new JsonRpcProvider(new f$4(Er,z$2("disableProviderPing")))}}class sv{constructor(br){this.name="near",this.namespace=br.namespace,this.events=z$2("events"),this.client=z$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(br){this.namespace=Object.assign(this.namespace,br)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const br=this.namespace.chains[0];if(!br)throw new Error("ChainId not found");return br.split(":")[1]}request(br){return this.namespace.methods.includes(br.request.method)?this.client.request(br):this.getHttpProvider().request(br.request)}setDefaultChain(br,wr){if(this.chainId=br,!this.httpProviders[br]){const Er=wr||ft(`${this.name}:${br}`,this.namespace);if(!Er)throw new Error(`No RPC url provided for chainId: ${br}`);this.setHttpProvider(br,Er)}this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const br=this.namespace.accounts;return br?br.filter(wr=>wr.split(":")[1]===this.chainId.toString()).map(wr=>wr.split(":")[2])||[]:[]}createHttpProviders(){const br={};return this.namespace.chains.forEach(wr=>{var Er;br[wr]=this.createHttpProvider(wr,(Er=this.namespace.rpcMap)==null?void 0:Er[wr])}),br}getHttpProvider(){const br=`${this.name}:${this.chainId}`,wr=this.httpProviders[br];if(typeof wr>"u")throw new Error(`JSON-RPC provider for ${br} not found`);return wr}setHttpProvider(br,wr){const Er=this.createHttpProvider(br,wr);Er&&(this.httpProviders[br]=Er)}createHttpProvider(br,wr){const Er=wr||ft(br,this.namespace);return typeof Er>"u"?void 0:new JsonRpcProvider(new f$4(Er,z$2("disableProviderPing")))}}var uv=Object.defineProperty,av=Object.defineProperties,ov=Object.getOwnPropertyDescriptors,Ta=Object.getOwnPropertySymbols,fv=Object.prototype.hasOwnProperty,cv=Object.prototype.propertyIsEnumerable,La=(fr,br,wr)=>br in fr?uv(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,hr=(fr,br)=>{for(var wr in br||(br={}))fv.call(br,wr)&&La(fr,wr,br[wr]);if(Ta)for(var wr of Ta(br))cv.call(br,wr)&&La(fr,wr,br[wr]);return fr},Mi=(fr,br)=>av(fr,ov(br));class lr{constructor(br){this.events=new Ug,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=br,this.logger=typeof(br==null?void 0:br.logger)<"u"&&typeof(br==null?void 0:br.logger)!="string"?br.logger:Hg(k$4({level:(br==null?void 0:br.logger)||Ia})),this.disableProviderPing=(br==null?void 0:br.disableProviderPing)||!1}static async init(br){const wr=new lr(br);return await wr.initialize(),wr}async request(br,wr,Er){const[kr,jr]=this.validateChain(wr);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(kr).request({request:hr({},br),chainId:`${kr}:${jr}`,topic:this.session.topic,expiry:Er})}sendAsync(br,wr,Er,kr){const jr=new Date().getTime();this.request(br,Er,kr).then(Br=>wr(null,formatJsonRpcResult(jr,Br))).catch(Br=>wr(Br,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 br;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(br=this.session)==null?void 0:br.topic,reason:U$1("USER_DISCONNECTED")}),await this.cleanup()}async connect(br){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(br),await this.cleanupPendingPairings(),!br.skipPairing)return await this.pair(br.pairingTopic)}on(br,wr){this.events.on(br,wr)}once(br,wr){this.events.once(br,wr)}removeListener(br,wr){this.events.removeListener(br,wr)}off(br,wr){this.events.off(br,wr)}get isWalletConnect(){return!0}async pair(br){this.shouldAbortPairingAttempt=!1;let wr=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(wr>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:Er,approval:kr}=await this.client.connect({pairingTopic:br,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});Er&&(this.uri=Er,this.events.emit("display_uri",Er)),await kr().then(jr=>{this.session=jr;const Br=Vg(jr.namespaces);this.namespaces=Oa(this.namespaces,Br),this.persist("namespaces",this.namespaces)}).catch(jr=>{if(jr.message!==ae)throw jr;wr++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(br,wr){try{if(!this.session)return;const[Er,kr]=this.validateChain(br);this.getProvider(Er).setDefaultChain(kr,wr)}catch(Er){if(!/Please call connect/.test(Er.message))throw Er}}async cleanupPendingPairings(br={}){this.logger.info("Cleaning up inactive pairings...");const wr=this.client.pairing.getAll();if(k$2(wr)){for(const Er of wr)br.deletePairings?this.client.core.expirer.set(Er.topic,0):await this.client.core.relayer.subscriber.unsubscribe(Er.topic);this.logger.info(`Inactive pairings cleared: ${wr.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 br=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[br]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await Q$1.init({logger:this.providerOpts.logger||Ia,relayUrl:this.providerOpts.relayUrl||Fg,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),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 br=[...new Set(Object.keys(this.session.namespaces).map(wr=>en(wr)))];Fi("client",this.client),Fi("events",this.events),Fi("disableProviderPing",this.disableProviderPing),br.forEach(wr=>{if(!this.session)return;const Er=Xg(wr,this.session),kr=Sa(Er),jr=Oa(this.namespaces,this.optionalNamespaces),Br=Mi(hr({},jr[wr]),{accounts:Er,chains:kr});switch(wr){case"eip155":this.rpcProviders[wr]=new jg({namespace:Br});break;case"solana":this.rpcProviders[wr]=new nv({namespace:Br});break;case"cosmos":this.rpcProviders[wr]=new tv({namespace:Br});break;case"polkadot":this.rpcProviders[wr]=new kg({namespace:Br});break;case"cip34":this.rpcProviders[wr]=new ev({namespace:Br});break;case"elrond":this.rpcProviders[wr]=new rv({namespace:Br});break;case"multiversx":this.rpcProviders[wr]=new iv({namespace:Br});break;case"near":this.rpcProviders[wr]=new sv({namespace:Br});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",br=>{this.events.emit("session_ping",br)}),this.client.on("session_event",br=>{const{params:wr}=br,{event:Er}=wr;if(Er.name==="accountsChanged"){const kr=Er.data;kr&&k$2(kr)&&this.events.emit("accountsChanged",kr.map(Qg))}else if(Er.name==="chainChanged"){const kr=wr.chainId,jr=wr.event.data,Br=en(kr),Wr=Wi(kr)!==Wi(jr)?`${Br}:${Wi(jr)}`:kr;this.onChainChanged(Wr)}else this.events.emit(Er.name,Er.data);this.events.emit("session_event",br)}),this.client.on("session_update",({topic:br,params:wr})=>{var Er;const{namespaces:kr}=wr,jr=(Er=this.client)==null?void 0:Er.session.get(br);this.session=Mi(hr({},jr),{namespaces:kr}),this.onSessionUpdate(),this.events.emit("session_update",{topic:br,params:wr})}),this.client.on("session_delete",async br=>{await this.cleanup(),this.events.emit("session_delete",br),this.events.emit("disconnect",Mi(hr({},U$1("USER_DISCONNECTED")),{data:br.topic}))}),this.on(Vn.DEFAULT_CHAIN_CHANGED,br=>{this.onChainChanged(br,!0)})}getProvider(br){if(!this.rpcProviders[br])throw new Error(`Provider not found: ${br}`);return this.rpcProviders[br]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(br=>{var wr;this.getProvider(br).updateNamespace((wr=this.session)==null?void 0:wr.namespaces[br])})}setNamespaces(br){const{namespaces:wr,optionalNamespaces:Er,sessionProperties:kr}=br;wr&&Object.keys(wr).length&&(this.namespaces=wr),Er&&Object.keys(Er).length&&(this.optionalNamespaces=Er),this.sessionProperties=kr,this.persist("namespaces",wr),this.persist("optionalNamespaces",Er)}validateChain(br){const[wr,Er]=(br==null?void 0:br.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[wr,Er];if(wr&&!Object.keys(this.namespaces||{}).map(Br=>en(Br)).includes(wr))throw new Error(`Namespace '${wr}' is not configured. Please call connect() first with namespace config.`);if(wr&&Er)return[wr,Er];const kr=en(Object.keys(this.namespaces)[0]),jr=this.rpcProviders[kr].getDefaultChain();return[kr,jr]}async requestAccounts(){const[br]=this.validateChain();return await this.getProvider(br).requestAccounts()}onChainChanged(br,wr=!1){if(!this.namespaces)return;const[Er,kr]=this.validateChain(br);kr&&(wr||this.getProvider(Er).setDefaultChain(kr),this.namespaces[Er]?this.namespaces[Er].defaultChain=kr:this.namespaces[`${Er}:${kr}`]?this.namespaces[`${Er}:${kr}`].defaultChain=kr:this.namespaces[`${Er}:${kr}`]={defaultChain:kr},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",kr))}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(br,wr){this.client.core.storage.setItem(`${xa}/${br}`,wr)}async getFromStore(br){return await this.client.core.storage.getItem(`${xa}/${br}`)}}const hv=lr,P$2="wc",S$1="ethereum_provider",$$1=`${P$2}@2:${S$1}:`,j$2="https://rpc.walletconnect.com/v1/",u$2=["eth_sendTransaction","personal_sign"],E$1=["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"],m$2=["chainChanged","accountsChanged"],_$2=["chainChanged","accountsChanged","message","disconnect","connect"];var N$1=Object.defineProperty,q$2=Object.defineProperties,D$2=Object.getOwnPropertyDescriptors,y$2=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,O$1=(fr,br,wr)=>br in fr?N$1(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,p$2=(fr,br)=>{for(var wr in br||(br={}))U.call(br,wr)&&O$1(fr,wr,br[wr]);if(y$2)for(var wr of y$2(br))Q.call(br,wr)&&O$1(fr,wr,br[wr]);return fr},M$1=(fr,br)=>q$2(fr,D$2(br));function g$2(fr){return Number(fr[0].split(":")[1])}function f$3(fr){return`0x${fr.toString(16)}`}function L$1(fr){const{chains:br,optionalChains:wr,methods:Er,optionalMethods:kr,events:jr,optionalEvents:Br,rpcMap:Wr}=fr;if(!k$6(br))throw new Error("Invalid chains");const qr={chains:br,methods:Er||u$2,events:jr||m$2,rpcMap:p$2({},br.length?{[g$2(br)]:Wr[g$2(br)]}:{})},Gr=jr==null?void 0:jr.filter(Qr=>!m$2.includes(Qr)),Vr=Er==null?void 0:Er.filter(Qr=>!u$2.includes(Qr));if(!wr&&!Br&&!kr&&!(Gr!=null&&Gr.length)&&!(Vr!=null&&Vr.length))return{required:br.length?qr:void 0};const Zr=(Gr==null?void 0:Gr.length)&&(Vr==null?void 0:Vr.length)||!wr,Jr={chains:[...new Set(Zr?qr.chains.concat(wr||[]):wr)],methods:[...new Set(qr.methods.concat(kr!=null&&kr.length?kr:E$1))],events:[...new Set(qr.events.concat(Br!=null&&Br.length?Br:_$2))],rpcMap:Wr};return{required:br.length?qr:void 0,optional:wr.length?Jr:void 0}}let v$2=class dS{constructor(){this.events=new eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=$$1,this.on=(br,wr)=>(this.events.on(br,wr),this),this.once=(br,wr)=>(this.events.once(br,wr),this),this.removeListener=(br,wr)=>(this.events.removeListener(br,wr),this),this.off=(br,wr)=>(this.events.off(br,wr),this),this.parseAccount=br=>this.isCompatibleChainId(br)?this.parseAccountId(br).address:br,this.signer={},this.rpc={}}static async init(br){const wr=new dS;return await wr.initialize(br),wr}async request(br,wr){return await this.signer.request(br,this.formatChainId(this.chainId),wr)}sendAsync(br,wr,Er){this.signer.sendAsync(br,wr,this.formatChainId(this.chainId),Er)}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(br){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(br);const{required:wr,optional:Er}=L$1(this.rpc);try{const kr=await new Promise(async(Br,Wr)=>{var qr;this.rpc.showQrModal&&((qr=this.modal)==null||qr.subscribeModal(Gr=>{!Gr.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),Wr(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(M$1(p$2({namespaces:p$2({},wr&&{[this.namespace]:wr})},Er&&{optionalNamespaces:{[this.namespace]:Er}}),{pairingTopic:br==null?void 0:br.pairingTopic})).then(Gr=>{Br(Gr)}).catch(Gr=>{Wr(new Error(Gr.message))})});if(!kr)return;const jr=Un(kr.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:jr),this.setAccounts(jr),this.events.emit("connect",{chainId:f$3(this.chainId)})}catch(kr){throw this.signer.logger.error(kr),kr}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",br=>{const{params:wr}=br,{event:Er}=wr;Er.name==="accountsChanged"?(this.accounts=this.parseAccounts(Er.data),this.events.emit("accountsChanged",this.accounts)):Er.name==="chainChanged"?this.setChainId(this.formatChainId(Er.data)):this.events.emit(Er.name,Er.data),this.events.emit("session_event",br)}),this.signer.on("chainChanged",br=>{const wr=parseInt(br);this.chainId=wr,this.events.emit("chainChanged",f$3(this.chainId)),this.persist()}),this.signer.on("session_update",br=>{this.events.emit("session_update",br)}),this.signer.on("session_delete",br=>{this.reset(),this.events.emit("session_delete",br),this.events.emit("disconnect",M$1(p$2({},U$4("USER_DISCONNECTED")),{data:br.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",br=>{var wr,Er;this.rpc.showQrModal&&((wr=this.modal)==null||wr.closeModal(),(Er=this.modal)==null||Er.openModal({uri:br})),this.events.emit("display_uri",br)})}switchEthereumChain(br){this.request({method:"wallet_switchEthereumChain",params:[{chainId:br.toString(16)}]})}isCompatibleChainId(br){return typeof br=="string"?br.startsWith(`${this.namespace}:`):!1}formatChainId(br){return`${this.namespace}:${br}`}parseChainId(br){return Number(br.split(":")[1])}setChainIds(br){const wr=br.filter(Er=>this.isCompatibleChainId(Er)).map(Er=>this.parseChainId(Er));wr.length&&(this.chainId=wr[0],this.events.emit("chainChanged",f$3(this.chainId)),this.persist())}setChainId(br){if(this.isCompatibleChainId(br)){const wr=this.parseChainId(br);this.chainId=wr,this.switchEthereumChain(wr)}}parseAccountId(br){const[wr,Er,kr]=br.split(":");return{chainId:`${wr}:${Er}`,address:kr}}setAccounts(br){this.accounts=br.filter(wr=>this.parseChainId(this.parseAccountId(wr).chainId)===this.chainId).map(wr=>this.parseAccountId(wr).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(br){var wr,Er;const kr=(wr=br==null?void 0:br.chains)!=null?wr:[],jr=(Er=br==null?void 0:br.optionalChains)!=null?Er:[],Br=kr.concat(jr);if(!Br.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const Wr=kr.length?(br==null?void 0:br.methods)||u$2:[],qr=kr.length?(br==null?void 0:br.events)||m$2:[],Gr=(br==null?void 0:br.optionalMethods)||[],Vr=(br==null?void 0:br.optionalEvents)||[],Zr=(br==null?void 0:br.rpcMap)||this.buildRpcMap(Br,br.projectId),Jr=(br==null?void 0:br.qrModalOptions)||void 0;return{chains:kr==null?void 0:kr.map(Qr=>this.formatChainId(Qr)),optionalChains:jr.map(Qr=>this.formatChainId(Qr)),methods:Wr,events:qr,optionalMethods:Gr,optionalEvents:Vr,rpcMap:Zr,showQrModal:!!(br!=null&&br.showQrModal),qrModalOptions:Jr,projectId:br.projectId,metadata:br.metadata}}buildRpcMap(br,wr){const Er={};return br.forEach(kr=>{Er[kr]=this.getRpcUrl(kr,wr)}),Er}async initialize(br){if(this.rpc=this.getRpcConfig(br),this.chainId=this.rpc.chains.length?g$2(this.rpc.chains):g$2(this.rpc.optionalChains),this.signer=await hv.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:br.disableProviderPing,relayUrl:br.relayUrl,storageOptions:br.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let wr;try{const{WalletConnectModal:Er}=await __vitePreload(()=>import("./index-kIiSzqeW.js").then(kr=>kr.i),[]);wr=Er}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(wr)try{this.modal=new wr(p$2({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(Er){throw this.signer.logger.error(Er),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(br){if(!br)return;const{chains:wr,optionalChains:Er,rpcMap:kr}=br;wr&&k$6(wr)&&(this.rpc.chains=wr.map(jr=>this.formatChainId(jr)),wr.forEach(jr=>{this.rpc.rpcMap[jr]=(kr==null?void 0:kr[jr])||this.getRpcUrl(jr)})),Er&&k$6(Er)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=Er==null?void 0:Er.map(jr=>this.formatChainId(jr)),Er.forEach(jr=>{this.rpc.rpcMap[jr]=(kr==null?void 0:kr[jr])||this.getRpcUrl(jr)}))}getRpcUrl(br,wr){var Er;return((Er=this.rpc.rpcMap)==null?void 0:Er[br])||`${j$2}?chainId=eip155:${br}&projectId=${wr||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const br=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),wr=this.session.namespaces[`${this.namespace}:${br}`]?this.session.namespaces[`${this.namespace}:${br}`]:this.session.namespaces[this.namespace];this.setChainIds(br?[this.formatChainId(br)]:wr==null?void 0:wr.accounts),this.setAccounts(wr==null?void 0:wr.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(br){return typeof br=="string"||br instanceof String?[this.parseAccount(br)]:br.map(wr=>this.parseAccount(wr))}};const parseIntSafe=(fr,br=10)=>{try{const wr=parseInt(String(fr),br);if(isNaN(wr)){logger$7.error(`Error parsing ${fr}`);return}return wr}catch(wr){logger$7.error(`Error parsing ${fr} to int: ${wr}`)}},activeAccountKey=fr=>`dynamic-wc2-active-account-${fr}`,sessionTopicKey=fr=>`dynamic-wc2-session-topic-${fr}`,swicthedNetworkKey=fr=>`dynamic-wc2-switched-network-${fr}`,currentChainKey=fr=>`dynamic-wc2-current-chain-${fr}`,ee=new EventEmitter$2;class WalletConnect extends EthereumWalletConnector{constructor(br){var wr;super(br),this.supportedChains=["EVM","ETH"],this.connectedChain="EVM",this.isInitialized=!1,this.canConnectViaQrCode=!0,this.isWalletConnect=!0,this.preferredChains=[],this._hasSwitchedNetwork=!1,this.sessionEventHandler=()=>{},this.sessionDeleteHandler=()=>{},this.name=br.walletName,this.projectId=br.projectId,this.deepLinkPreference=br.deepLinkPreference||"native",this.preferredChains=br.walletConnectPreferredChains||[],this.hasSwitchedNetwork=(wr=!!localStorage.getItem(this.swicthedNetworkKey))!==null&&wr!==void 0?wr:!1;const Er=localStorage.getItem(this.currentChainKey);this.currentChainId=Er?parseIntSafe(Er):void 0}getMappedChains(){return this.evmNetworks.filter(br=>br.chainId!==11297108109).map(br=>`eip155:${br.chainId}`)}getMappedChainsByPreferredOrder(){const br=this.getMappedChains(),wr=this.preferredChains.filter(kr=>br.includes(kr)),Er=br.filter(kr=>!this.preferredChains.includes(kr));return[...wr,...Er].map(kr=>Number(kr.split(":")[1]))}initConnection(){return __awaiter$8(this,void 0,void 0,function*(){const{provider:br}=WalletConnect;if(!br)throw new DynamicError("No provider found (init connection)");br!=null&&br.signer.uri||br.connect().catch(wr=>{logger$7.error(wr),ee.emit("walletconnect_connection_failed",wr)})})}createProvider(){return __awaiter$8(this,void 0,void 0,function*(){return v$2.init({events:["chainChanged","accountsChanged"],methods:[],optionalChains:this.getMappedChainsByPreferredOrder(),optionalMethods:["eth_chainId","eth_signTypedData","eth_signTransaction","eth_sign","personal_sign","eth_sendTransaction","eth_signTypedData_v4","wallet_switchEthereumChain","wallet_addEthereumChain"],projectId:this.projectId,rpcMap:this.evmNetworkRpcMap(),showQrModal:!1})})}getWalletClientFromInitializedProvider(){return __awaiter$8(this,void 0,void 0,function*(){const br=this.createProvider();return createWalletClient({account:this.getActiveAccount(),transport:custom(yield br)})})}createInitProviderPromise(){return __awaiter$8(this,void 0,void 0,function*(){WalletConnect.provider=yield this.createProvider(),this.teardownEventListeners(),this.setupEventListeners()})}initProvider(){return __awaiter$8(this,void 0,void 0,function*(){const{provider:br}=WalletConnect;br||(this.initializePromise===void 0&&(this.initializePromise=this.createInitProviderPromise()),yield this.initializePromise)})}refreshSession(){var br,wr,Er,kr,jr;!((wr=(br=WalletConnect.provider)===null||br===void 0?void 0:br.session)===null||wr===void 0)&&wr.topic&&localStorage.getItem(this.sessionTopicKey)===((kr=(Er=WalletConnect.provider)===null||Er===void 0?void 0:Er.session)===null||kr===void 0?void 0:kr.topic)&&(this.session=WalletConnect.provider.session,this.setActiveAccount((jr=localStorage.getItem(this.activeAccountKey))!==null&&jr!==void 0?jr:void 0))}init(){return __awaiter$8(this,void 0,void 0,function*(){yield this.initProvider(),yield this.initConnection(),this.isInitialized=!0})}get sessionTopicKey(){return sessionTopicKey(this.key)}get activeAccountKey(){return activeAccountKey(this.key)}get swicthedNetworkKey(){return swicthedNetworkKey(this.key)}get currentChainKey(){return currentChainKey(this.key)}set currentChainId(br){this._currentChainId=br,br?localStorage.setItem(this.currentChainKey,br.toString()):localStorage.removeItem(this.currentChainKey)}get currentChainId(){return this._currentChainId}set hasSwitchedNetwork(br){this._hasSwitchedNetwork=br,br?localStorage.setItem(this.swicthedNetworkKey,br.toString()):localStorage.removeItem(this.swicthedNetworkKey)}get hasSwitchedNetwork(){return this._hasSwitchedNetwork}supportsNetworkSwitching(){return!0}setupEventListeners(){WalletConnect.provider&&(this.sessionEventHandler=({params:br})=>{if(logger$7.debug("session_event was called",{params:br}),!br||!br.event){logger$7.debug("session_event was called without params or params.event");return}const{name:wr,data:Er}=br.event;if(wr==="chainChanged"){const kr=parseIntSafe(Er);if(kr===this.currentChainId){logger$7.debug(`ignoring chainChanged event with same chain id as current chain id: ${kr}`);return}if(kr===void 0){logger$7.debug(`received unexpected data for chainChanged: ${Er} with type ${typeof Er}}`);return}this.currentChainId=kr,this.emit("chainChange",{chain:String(kr)}),this.hasSwitchedNetwork=!0,this.switchNetwork({networkChainId:kr})}else if(wr==="accountsChanged"){if(!Array.isArray(Er)){logger$7.debug(`received unexpected data for accountsChanged: ${Er} with type ${typeof Er}}`);return}const kr=Er[0].split(":")[2];this.setWCActiveAccount(kr)}},WalletConnect.provider.on("session_event",this.sessionEventHandler),this.sessionDeleteHandler=()=>__awaiter$8(this,void 0,void 0,function*(){this.endSession(),this.emit("disconnect")}),WalletConnect.provider.on("session_delete",this.sessionDeleteHandler))}teardownEventListeners(){WalletConnect.provider&&(WalletConnect.provider.off("session_event",this.sessionEventHandler),WalletConnect.provider.off("session_delete",this.sessionDeleteHandler))}getWalletClient(br){if(WalletConnect.provider)return createWalletClient({account:this.getActiveAccount(),chain:chainsMap[br??String(this.currentChainId)],transport:custom(WalletConnect.provider)})}getAddress(br){return __awaiter$8(this,void 0,void 0,function*(){var wr,Er;const kr=this.getActiveAccount();if(kr!=null&&kr.address)return kr.address;if((!WalletConnect.provider||!(!((wr=WalletConnect.provider)===null||wr===void 0)&&wr.signer.uri))&&(logger$7.debug("No WC2 provider found, re-initializing..."),yield this.endSession(),yield this.init(),yield sleep$1(1e3),!WalletConnect.provider||!(!((Er=WalletConnect.provider)===null||Er===void 0)&&Er.signer.uri)))throw logger$7.debug("No WC2 provider found, escaping and throwing error"),new DynamicError("No provider found");const jr=getWalletBookWallet(this.walletBook,this.key,this.walletFallback);return performPlatformSpecificConnectionMethod(WalletConnect.provider.signer.uri,jr,{onDesktopUri:br==null?void 0:br.onDesktopUri,onDisplayUri:br==null?void 0:br.onDisplayUri},this.deepLinkPreference),new Promise((Br,Wr)=>{if(!WalletConnect.provider){Wr(new DynamicError("No provider found"));return}const qr=()=>{const Zr=new DynamicError("Connection rejected. Please try again.");Zr.code="connection_rejected",WalletConnect.provider&&(WalletConnect.provider.signer.uri=void 0,this.init()),Wr(Zr),Vr()},Gr=()=>{var Zr;const Jr=(Zr=WalletConnect.provider)===null||Zr===void 0?void 0:Zr.session;if(!Jr){Wr(new DynamicError("No session found"));return}this.setSession(Jr),this.setWCActiveAccount(Jr.namespaces.eip155.accounts[0].split(":")[2]),this.getNetwork().then(Qr=>{var _n;this.currentChainId=Qr,Br((_n=this.getActiveAccount())===null||_n===void 0?void 0:_n.address)}),Vr()},Vr=()=>{var Zr;ee.off("walletconnect_connection_failed",qr),(Zr=WalletConnect.provider)===null||Zr===void 0||Zr.off("connect",Gr)};ee.on("walletconnect_connection_failed",qr),WalletConnect.provider.on("connect",Gr)})})}waitForSignMessage(br,wr){return __awaiter$8(this,void 0,void 0,function*(){const kr=yield new Promise((jr,Br)=>{this.on("chainChange",()=>jr({success:!1})),br(wr).then(Wr=>jr({signedMessage:Wr,success:!0})).catch(Br)});return kr.success===!1?br(wr):kr.signedMessage})}getDeepLink(){var br;if(!this.session)return;const wr=getWalletBookWallet(this.walletBook,this.key),Er=getDeepLink({metadata:wr,mode:"regular",preference:this.deepLinkPreference,uri:(br=WalletConnect.provider)===null||br===void 0?void 0:br.signer.uri});if(Er)return`${Er}?sessionTopic=${this.session.topic}`}signMessage(br){return __awaiter$8(this,void 0,void 0,function*(){if(!this.session)throw new DynamicError("no session");const wr=this.getDeepLink();isMobile()&&wr&&(window.location.href=wr);const Er=jr=>__awaiter$8(this,void 0,void 0,function*(){const Br=this.getActiveAccount();return Br?(yield this.getWalletClientFromInitializedProvider()).signMessage({account:Br,message:jr}):void 0});return yield this.waitForSignMessage(Er,br)})}clearActiveAccount(){localStorage.removeItem(this.activeAccountKey),this.setActiveAccount(void 0)}clearSession(){localStorage.removeItem(this.sessionTopicKey),this.session=void 0}setWCActiveAccount(br){localStorage.setItem(this.activeAccountKey,br),this.setActiveAccount(br),this.emit("accountChange",{accounts:[br]})}setSession(br){localStorage.setItem(this.sessionTopicKey,br.topic),this.session=br}endSession(){return __awaiter$8(this,void 0,void 0,function*(){var br;if(this.clearActiveAccount(),this.clearSession(),this.hasSwitchedNetwork=!1,this.currentChainId=void 0,!!(!((br=WalletConnect.provider)===null||br===void 0)&&br.session))try{yield WalletConnect.provider.disconnect(),WalletConnect.provider=void 0}catch(wr){logger$7.debug(wr)}})}getNetwork(){const br=Object.create(null,{getNetwork:{get:()=>super.getNetwork}});return __awaiter$8(this,void 0,void 0,function*(){return this.currentChainId?this.currentChainId:(yield this.initProvider(),br.getNetwork.call(this))})}providerSwitchNetwork(br){const wr=Object.create(null,{providerSwitchNetwork:{get:()=>super.providerSwitchNetwork}});return __awaiter$8(this,arguments,void 0,function*({network:Er}){const kr=yield this.getSupportedNetworks();if(!(kr!=null&&kr.includes(Er.chainId.toString()))){const Wr=new DynamicError("Network switching is not available at this time. The user should manually switch network in their wallet");throw Wr.code="network_switching_only_available_in_wallet",Wr}const jr=yield this.getNetwork();if(jr&&jr===Er.chainId)return;if(this.switchNetworkOnlyFromWallet)throw new DynamicError("Network switching is only supported through the wallet");if(!this.supportsNetworkSwitching())throw new DynamicError("Network switching not supported");const Br=yield this.getWalletClientFromInitializedProvider();if(this.isMetaMask()){const Wr=this.getDeepLink();Wr&&(window.location.href=Wr)}yield wr.providerSwitchNetwork.call(this,{network:Er,provider:Br}),this.currentChainId=Er.chainId,this.hasSwitchedNetwork=!0,this.emit("chainChange",{chain:String(Er.chainId)})})}getConnectedAccounts(){return __awaiter$8(this,void 0,void 0,function*(){this.isInitialized===!1&&(yield this.initProvider(),this.refreshSession(),this.isInitialized=!0);const br=this.getActiveAccount();return br!=null&&br.address?[br.address]:[]})}isMetaMask(){var br,wr,Er,kr,jr;return(jr=(kr=(Er=(wr=(br=this.session)===null||br===void 0?void 0:br.peer)===null||wr===void 0?void 0:wr.metadata)===null||Er===void 0?void 0:Er.name)===null||kr===void 0?void 0:kr.toLowerCase().startsWith("metamask"))!==null&&jr!==void 0?jr:!1}getSupportedNetworks(){return __awaiter$8(this,void 0,void 0,function*(){var br;if(yield this.initProvider(),this.refreshSession(),this.isMetaMask())return this.hasSwitchedNetwork?[String(this.currentChainId)]:this.evmNetworks.map(Er=>Er.chainId.toString());if(!this.session)return[];const wr=[];return Object.keys(this.session.namespaces).forEach(Er=>{Er.startsWith("eip155:")&&wr.push(Er.split(":")[1])}),(br=this.session.namespaces.eip155)===null||br===void 0||br.accounts.forEach(Er=>wr.push(Er.split(":")[1])),wr.length?wr:this.evmNetworks.map(Er=>Er.chainId.toString())})}}let InjectedWalletBase$1=class extends EthereumWalletConnector{constructor(){super(...arguments),this.supportedChains=["ETH","EVM"],this.connectedChain="EVM",this.walletConnectorFallback=!1}getEthProviderHelper(){return this.wallet||(this.wallet=findWalletBookWallet(this.walletBook,this.key)),this.wallet&&!this.ethProviderHelper&&(this.ethProviderHelper=new EthProviderHelper(this.wallet,this)),this.ethProviderHelper}getMobileOrInstalledWallet(){var br,wr;return this.wallet||(this.wallet=findWalletBookWallet(this.walletBook,this.key)),this.isInstalledOnBrowser()?this:!((wr=(br=this.wallet)===null||br===void 0?void 0:br.mobile)===null||wr===void 0)&&wr.inAppBrowser&&this.mobileExperience==="in-app-browser"&&isMobile()?this:this.walletConnectorFallback?new WalletConnect(Object.assign(Object.assign({},this.constructorProps),{walletName:this.name})):this}findProvider(){const br=this.getEthProviderHelper();if(br)return br.getInstalledProvider()}setupEventListeners(){if(!this.getWalletClient())return;const wr=this.getEthProviderHelper();if(!wr)return;const{tearDownEventListeners:Er}=wr._setupEventListeners(this);this.teardownEventListeners=Er}getWalletClient(br){var wr;return(wr=this.getEthProviderHelper())===null||wr===void 0?void 0:wr.findWalletClient(br)}isInstalledOnBrowser(){var br;return((br=this.getEthProviderHelper())===null||br===void 0?void 0:br.findProvider())!==void 0}getAddress(){return __awaiter$8(this,void 0,void 0,function*(){var br;return(br=this.getEthProviderHelper())===null||br===void 0?void 0:br.getAddress()})}connect(){return __awaiter$8(this,void 0,void 0,function*(){yield this.getAddress()})}signMessage(br){return __awaiter$8(this,void 0,void 0,function*(){var wr;return(wr=this.getEthProviderHelper())===null||wr===void 0?void 0:wr.signMessage(br)})}proveOwnership(br,wr){return __awaiter$8(this,void 0,void 0,function*(){return yield this.validateActiveWallet(br),this.signMessage(wr)})}endSession(){return __awaiter$8(this,void 0,void 0,function*(){})}providerSwitchNetwork(br){const wr=Object.create(null,{providerSwitchNetwork:{get:()=>super.providerSwitchNetwork}});return __awaiter$8(this,arguments,void 0,function*({network:Er,provider:kr}){return wr.providerSwitchNetwork.call(this,{network:Er,provider:kr})})}};class PhantomEvm extends InjectedWalletBase$1{constructor(br){super(br),this.name="Phantom",this.overrideKey="phantomevm",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getAddress(){const br=Object.create(null,{getAddress:{get:()=>super.getAddress}});return __awaiter$8(this,void 0,void 0,function*(){if(this.isInstalledOnBrowser())return br.getAddress.call(this);isMobile()&&handleMobileWalletRedirect({nativeLink:"phantom://browse",universalLink:"https://phantom.app/ul/browse"})})}canGetChainAddress(){var br,wr;return!!(!((wr=(br=this.getEthProviderHelper())===null||br===void 0?void 0:br.findProvider())===null||wr===void 0)&&wr.selectedAddress)}}class ExodusEvm extends InjectedWalletBase$1{constructor(br){super(br),this.name="ExodusEvm",this.overrideKey="exodusevm",this.walletConnectorFallback=!0,this.wallet=findWalletBookWallet(this.walletBook,this.key)}}let UnknownInjected$1=class extends InjectedWalletBase$1{constructor(br){super(br),this.name="Unknown",this.overrideKey="unknown",this.wallet=findWalletBookWallet(this.walletBook,this.key)}isInstalledOnBrowser(){return!1}};class FallbackEvmConnector extends InjectedWalletBase$1{constructor(br){super(br),this.name="Fallback Connector",this.overrideKey="fallbackconnector",this.isAvailable=!1,this.wallet=findWalletBookWallet(this.walletBook,this.key)}isInstalledOnBrowser(){return!1}}const injectedWalletOverrides$1=[PhantomEvm,ExodusEvm],filteredInjectedWalletKeysOverrides$1=["phantomevm","coinbase","exodusevm"],fetchInjectedWalletConnector=({walletBook:fr})=>{var br;return Object.entries((br=fr==null?void 0:fr.wallets)!==null&&br!==void 0?br:{}).filter(([wr,Er])=>{var kr;return((kr=Er.injectedConfig)===null||kr===void 0?void 0:kr.find(jr=>jr.chain==="evm"))&&!filteredInjectedWalletKeysOverrides$1.includes(wr)}).map(([wr,Er])=>{const{shortName:kr}=Er,jr=kr||Er.name,Br=!!Er.walletConnect;return class extends InjectedWalletBase$1{constructor(Wr){super(Object.assign({},Wr)),this.name=jr,this.wallet=Er,this.walletConnectorFallback=Br,this.overrideKey=wr}getAddress(){const Wr=Object.create(null,{getAddress:{get:()=>super.getAddress}});return __awaiter$8(this,void 0,void 0,function*(){var qr;if(this.isInstalledOnBrowser())return Wr.getAddress.call(this);const Gr=(qr=this.wallet.mobile)===null||qr===void 0?void 0:qr.inAppBrowser;if(!Gr){const Vr=new Error(`No inAppBrowserBase found for ${this.name}.`);throw logger$7.error(Vr.message),Vr}window.location.href=`${Gr}/${window.location.href}`})}}})},fetchWalletConnectWallets=({walletBook:fr})=>{var br;return Object.entries((br=fr==null?void 0:fr.wallets)!==null&&br!==void 0?br:{}).filter(([,wr])=>wr.walletConnect&&!wr.filterFromWalletConnect).map(([wr,Er])=>{const{shortName:kr}=Er,jr=kr||Er.name;return class extends WalletConnect{constructor(Br){super(Object.assign(Object.assign({},Br),{walletName:jr})),this.overrideKey=wr}}})},getWalletConnectConnector=()=>class extends WalletConnect{constructor(fr){super(Object.assign(Object.assign({},fr),{walletName:"WalletConnect"}))}};var dist={},CoinbaseWalletSDK$1={},walletLogo$1={};Object.defineProperty(walletLogo$1,"__esModule",{value:!0});walletLogo$1.walletLogo=void 0;const walletLogo=(fr,br)=>{let wr;switch(fr){case"standard":return wr=br,`data:image/svg+xml,%3Csvg width='${br}' height='${wr}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return wr=br,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${br}' height='${wr}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return wr=(.1*br).toFixed(2),`data:image/svg+xml,%3Csvg width='${br}' height='${wr}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return wr=(.25*br).toFixed(2),`data:image/svg+xml,%3Csvg width='${br}' height='${wr}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return wr=(.1*br).toFixed(2),`data:image/svg+xml,%3Csvg width='${br}' height='${wr}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return wr=(.25*br).toFixed(2),`data:image/svg+xml,%3Csvg width='${br}' height='${wr}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return wr=br,`data:image/svg+xml,%3Csvg width='${br}' height='${wr}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};walletLogo$1.walletLogo=walletLogo;var CoinbaseWalletProvider$1={};const require$$0$2=getAugmentedNamespace(eventemitter3$1);var error={},constants$2={};Object.defineProperty(constants$2,"__esModule",{value:!0});constants$2.errorValues=constants$2.standardErrorCodes=void 0;constants$2.standardErrorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}};constants$2.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}};var errors$1={},utils$1={};(function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.serialize=fr.getErrorCode=fr.isValidCode=fr.getMessageFromCode=fr.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const br=constants$2,wr="Unspecified error message.";fr.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function Er(Jr,Qr=wr){if(Jr&&Number.isInteger(Jr)){const _n=Jr.toString();if(Vr(br.errorValues,_n))return br.errorValues[_n].message;if(qr(Jr))return fr.JSON_RPC_SERVER_ERROR_MESSAGE}return Qr}fr.getMessageFromCode=Er;function kr(Jr){if(!Number.isInteger(Jr))return!1;const Qr=Jr.toString();return!!(br.errorValues[Qr]||qr(Jr))}fr.isValidCode=kr;function jr(Jr){var Qr;if(typeof Jr=="number")return Jr;if(Br(Jr))return(Qr=Jr.code)!==null&&Qr!==void 0?Qr:Jr.errorCode}fr.getErrorCode=jr;function Br(Jr){return typeof Jr=="object"&&Jr!==null&&(typeof Jr.code=="number"||typeof Jr.errorCode=="number")}function Wr(Jr,{shouldIncludeStack:Qr=!1}={}){const _n={};if(Jr&&typeof Jr=="object"&&!Array.isArray(Jr)&&Vr(Jr,"code")&&kr(Jr.code)){const En=Jr;_n.code=En.code,En.message&&typeof En.message=="string"?(_n.message=En.message,Vr(En,"data")&&(_n.data=En.data)):(_n.message=Er(_n.code),_n.data={originalError:Gr(Jr)})}else _n.code=br.standardErrorCodes.rpc.internal,_n.message=Zr(Jr,"message")?Jr.message:wr,_n.data={originalError:Gr(Jr)};return Qr&&(_n.stack=Zr(Jr,"stack")?Jr.stack:void 0),_n}fr.serialize=Wr;function qr(Jr){return Jr>=-32099&&Jr<=-32e3}function Gr(Jr){return Jr&&typeof Jr=="object"&&!Array.isArray(Jr)?Object.assign({},Jr):Jr}function Vr(Jr,Qr){return Object.prototype.hasOwnProperty.call(Jr,Qr)}function Zr(Jr,Qr){return typeof Jr=="object"&&Jr!==null&&Qr in Jr&&typeof Jr[Qr]=="string"}})(utils$1);Object.defineProperty(errors$1,"__esModule",{value:!0});errors$1.standardErrors=void 0;const constants_1$6=constants$2,utils_1$1=utils$1;errors$1.standardErrors={rpc:{parse:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.parse,fr),invalidRequest:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.invalidRequest,fr),invalidParams:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.invalidParams,fr),methodNotFound:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.methodNotFound,fr),internal:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.internal,fr),server:fr=>{if(!fr||typeof fr!="object"||Array.isArray(fr))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:br}=fr;if(!Number.isInteger(br)||br>-32005||br<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return getEthJsonRpcError(br,fr)},invalidInput:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.invalidInput,fr),resourceNotFound:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.resourceNotFound,fr),resourceUnavailable:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.resourceUnavailable,fr),transactionRejected:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.transactionRejected,fr),methodNotSupported:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.methodNotSupported,fr),limitExceeded:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.limitExceeded,fr)},provider:{userRejectedRequest:fr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.userRejectedRequest,fr),unauthorized:fr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.unauthorized,fr),unsupportedMethod:fr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.unsupportedMethod,fr),disconnected:fr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.disconnected,fr),chainDisconnected:fr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.chainDisconnected,fr),unsupportedChain:fr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.unsupportedChain,fr),custom:fr=>{if(!fr||typeof fr!="object"||Array.isArray(fr))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:br,message:wr,data:Er}=fr;if(!wr||typeof wr!="string")throw new Error('"message" must be a nonempty string');return new EthereumProviderError(br,wr,Er)}}};function getEthJsonRpcError(fr,br){const[wr,Er]=parseOpts(br);return new EthereumRpcError(fr,wr||(0,utils_1$1.getMessageFromCode)(fr),Er)}function getEthProviderError(fr,br){const[wr,Er]=parseOpts(br);return new EthereumProviderError(fr,wr||(0,utils_1$1.getMessageFromCode)(fr),Er)}function parseOpts(fr){if(fr){if(typeof fr=="string")return[fr];if(typeof fr=="object"&&!Array.isArray(fr)){const{message:br,data:wr}=fr;if(br&&typeof br!="string")throw new Error("Must specify string message.");return[br||void 0,wr]}}return[]}class EthereumRpcError extends Error{constructor(br,wr,Er){if(!Number.isInteger(br))throw new Error('"code" must be an integer.');if(!wr||typeof wr!="string")throw new Error('"message" must be a nonempty string.');super(wr),this.code=br,Er!==void 0&&(this.data=Er)}}class EthereumProviderError extends EthereumRpcError{constructor(br,wr,Er){if(!isValidEthProviderCode(br))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(br,wr,Er)}}function isValidEthProviderCode(fr){return Number.isInteger(fr)&&fr>=1e3&&fr<=4999}(function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.standardErrors=fr.standardErrorCodes=void 0;var br=constants$2;Object.defineProperty(fr,"standardErrorCodes",{enumerable:!0,get:function(){return br.standardErrorCodes}});var wr=errors$1;Object.defineProperty(fr,"standardErrors",{enumerable:!0,get:function(){return wr.standardErrors}})})(error);var serialize$1={},Web3Response={};Object.defineProperty(Web3Response,"__esModule",{value:!0});Web3Response.isErrorResponse=void 0;function isErrorResponse(fr){return fr.errorMessage!==void 0}Web3Response.isErrorResponse=isErrorResponse;var version$8={};Object.defineProperty(version$8,"__esModule",{value:!0});version$8.LIB_VERSION=void 0;version$8.LIB_VERSION="4.0.4";Object.defineProperty(serialize$1,"__esModule",{value:!0});serialize$1.serializeError=void 0;const Web3Response_1$2=Web3Response,version_1$3=version$8,constants_1$5=constants$2,utils_1=utils$1;function serializeError(fr,br){const wr=(0,utils_1.serialize)(getErrorObject(fr),{shouldIncludeStack:!0}),Er=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");Er.searchParams.set("version",version_1$3.LIB_VERSION),Er.searchParams.set("code",wr.code.toString());const kr=getMethod(wr.data,br);return kr&&Er.searchParams.set("method",kr),Er.searchParams.set("message",wr.message),Object.assign(Object.assign({},wr),{docUrl:Er.href})}serialize$1.serializeError=serializeError;function getErrorObject(fr){return typeof fr=="string"?{message:fr,code:constants_1$5.standardErrorCodes.rpc.internal}:(0,Web3Response_1$2.isErrorResponse)(fr)?Object.assign(Object.assign({},fr),{message:fr.errorMessage,code:fr.errorCode,data:{method:fr.method}}):fr}function getMethod(fr,br){const wr=fr==null?void 0:fr.method;if(wr)return wr;if(br!==void 0){if(typeof br=="string")return br;if(Array.isArray(br)){if(br.length>0)return br[0].method}else return br.method}}var type$3={};Object.defineProperty(type$3,"__esModule",{value:!0});type$3.RegExpString=type$3.IntNumber=type$3.BigIntString=type$3.AddressString=type$3.HexString=type$3.OpaqueType=void 0;function OpaqueType(){return fr=>fr}type$3.OpaqueType=OpaqueType;type$3.HexString=OpaqueType();type$3.AddressString=OpaqueType();type$3.BigIntString=OpaqueType();function IntNumber(fr){return Math.floor(fr)}type$3.IntNumber=IntNumber;type$3.RegExpString=OpaqueType();var util$6={};Object.defineProperty(util$6,"__esModule",{value:!0});util$6.areAddressArraysEqual=util$6.getFavicon=util$6.range=util$6.isBigNumber=util$6.ensureParsedJSONObject=util$6.ensureBigInt=util$6.ensureRegExpString=util$6.ensureIntNumber=util$6.ensureBuffer=util$6.ensureAddressString=util$6.ensureEvenLengthHexString=util$6.ensureHexString=util$6.isHexString=util$6.prepend0x=util$6.strip0x=util$6.has0xPrefix=util$6.hexStringFromIntNumber=util$6.intNumberFromHexString=util$6.bigIntStringFromBigInt=util$6.hexStringFromBuffer=util$6.hexStringToUint8Array=util$6.uint8ArrayToHex=util$6.randomBytesHex=void 0;const error_1$8=error,_1=type$3,INT_STRING_REGEX=/^[0-9]*$/,HEXADECIMAL_STRING_REGEX=/^[a-f0-9]*$/;function randomBytesHex(fr){return uint8ArrayToHex(crypto.getRandomValues(new Uint8Array(fr)))}util$6.randomBytesHex=randomBytesHex;function uint8ArrayToHex(fr){return[...fr].map(br=>br.toString(16).padStart(2,"0")).join("")}util$6.uint8ArrayToHex=uint8ArrayToHex;function hexStringToUint8Array(fr){return new Uint8Array(fr.match(/.{1,2}/g).map(br=>parseInt(br,16)))}util$6.hexStringToUint8Array=hexStringToUint8Array;function hexStringFromBuffer(fr,br=!1){const wr=fr.toString("hex");return(0,_1.HexString)(br?`0x${wr}`:wr)}util$6.hexStringFromBuffer=hexStringFromBuffer;function bigIntStringFromBigInt(fr){return(0,_1.BigIntString)(fr.toString(10))}util$6.bigIntStringFromBigInt=bigIntStringFromBigInt;function intNumberFromHexString(fr){return(0,_1.IntNumber)(Number(BigInt(ensureEvenLengthHexString(fr,!0))))}util$6.intNumberFromHexString=intNumberFromHexString;function hexStringFromIntNumber(fr){return(0,_1.HexString)(`0x${BigInt(fr).toString(16)}`)}util$6.hexStringFromIntNumber=hexStringFromIntNumber;function has0xPrefix(fr){return fr.startsWith("0x")||fr.startsWith("0X")}util$6.has0xPrefix=has0xPrefix;function strip0x(fr){return has0xPrefix(fr)?fr.slice(2):fr}util$6.strip0x=strip0x;function prepend0x(fr){return has0xPrefix(fr)?`0x${fr.slice(2)}`:`0x${fr}`}util$6.prepend0x=prepend0x;function isHexString$1(fr){if(typeof fr!="string")return!1;const br=strip0x(fr).toLowerCase();return HEXADECIMAL_STRING_REGEX.test(br)}util$6.isHexString=isHexString$1;function ensureHexString(fr,br=!1){if(typeof fr=="string"){const wr=strip0x(fr).toLowerCase();if(HEXADECIMAL_STRING_REGEX.test(wr))return(0,_1.HexString)(br?`0x${wr}`:wr)}throw error_1$8.standardErrors.rpc.invalidParams(`"${String(fr)}" is not a hexadecimal string`)}util$6.ensureHexString=ensureHexString;function ensureEvenLengthHexString(fr,br=!1){let wr=ensureHexString(fr,!1);return wr.length%2===1&&(wr=(0,_1.HexString)(`0${wr}`)),br?(0,_1.HexString)(`0x${wr}`):wr}util$6.ensureEvenLengthHexString=ensureEvenLengthHexString;function ensureAddressString(fr){if(typeof fr=="string"){const br=strip0x(fr).toLowerCase();if(isHexString$1(br)&&br.length===40)return(0,_1.AddressString)(prepend0x(br))}throw error_1$8.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(fr)}`)}util$6.ensureAddressString=ensureAddressString;function ensureBuffer(fr){if(Buffer$2.isBuffer(fr))return fr;if(typeof fr=="string"){if(isHexString$1(fr)){const br=ensureEvenLengthHexString(fr,!1);return Buffer$2.from(br,"hex")}return Buffer$2.from(fr,"utf8")}throw error_1$8.standardErrors.rpc.invalidParams(`Not binary data: ${String(fr)}`)}util$6.ensureBuffer=ensureBuffer;function ensureIntNumber(fr){if(typeof fr=="number"&&Number.isInteger(fr))return(0,_1.IntNumber)(fr);if(typeof fr=="string"){if(INT_STRING_REGEX.test(fr))return(0,_1.IntNumber)(Number(fr));if(isHexString$1(fr))return(0,_1.IntNumber)(Number(BigInt(ensureEvenLengthHexString(fr,!0))))}throw error_1$8.standardErrors.rpc.invalidParams(`Not an integer: ${String(fr)}`)}util$6.ensureIntNumber=ensureIntNumber;function ensureRegExpString(fr){if(fr instanceof RegExp)return(0,_1.RegExpString)(fr.toString());throw error_1$8.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(fr)}`)}util$6.ensureRegExpString=ensureRegExpString;function ensureBigInt(fr){if(fr!==null&&(typeof fr=="bigint"||isBigNumber(fr)))return BigInt(fr.toString(10));if(typeof fr=="number")return BigInt(ensureIntNumber(fr));if(typeof fr=="string"){if(INT_STRING_REGEX.test(fr))return BigInt(fr);if(isHexString$1(fr))return BigInt(ensureEvenLengthHexString(fr,!0))}throw error_1$8.standardErrors.rpc.invalidParams(`Not an integer: ${String(fr)}`)}util$6.ensureBigInt=ensureBigInt;function ensureParsedJSONObject(fr){if(typeof fr=="string")return JSON.parse(fr);if(typeof fr=="object")return fr;throw error_1$8.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(fr)}`)}util$6.ensureParsedJSONObject=ensureParsedJSONObject;function isBigNumber(fr){if(fr==null||typeof fr.constructor!="function")return!1;const{constructor:br}=fr;return typeof br.config=="function"&&typeof br.EUCLID=="number"}util$6.isBigNumber=isBigNumber;function range(fr,br){return Array.from({length:br-fr},(wr,Er)=>fr+Er)}util$6.range=range;function getFavicon(){const fr=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:br,host:wr}=document.location,Er=fr?fr.getAttribute("href"):null;return!Er||Er.startsWith("javascript:")||Er.startsWith("vbscript:")?null:Er.startsWith("http://")||Er.startsWith("https://")||Er.startsWith("data:")?Er:Er.startsWith("//")?br+Er:`${br}//${wr}${Er}`}util$6.getFavicon=getFavicon;function areAddressArraysEqual(fr,br){return fr.length===br.length&&fr.every((wr,Er)=>wr===br[Er])}util$6.areAddressArraysEqual=areAddressArraysEqual;var util$5={},SCWSigner$1={},SCWKeyManager$1={},cipher={};Object.defineProperty(cipher,"__esModule",{value:!0});cipher.decryptContent=cipher.encryptContent=cipher.importKeyFromHexString=cipher.exportKeyToHexString=cipher.decrypt=cipher.encrypt=cipher.deriveSharedSecret=cipher.generateKeyPair=void 0;const util_1$b=util$6;async function generateKeyPair(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}cipher.generateKeyPair=generateKeyPair;async function deriveSharedSecret(fr,br){return crypto.subtle.deriveKey({name:"ECDH",public:br},fr,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}cipher.deriveSharedSecret=deriveSharedSecret;async function encrypt(fr,br){const wr=crypto.getRandomValues(new Uint8Array(12)),Er=await crypto.subtle.encrypt({name:"AES-GCM",iv:wr},fr,new TextEncoder().encode(br));return{iv:wr,cipherText:Er}}cipher.encrypt=encrypt;async function decrypt(fr,{iv:br,cipherText:wr}){const Er=await crypto.subtle.decrypt({name:"AES-GCM",iv:br},fr,wr);return new TextDecoder().decode(Er)}cipher.decrypt=decrypt;function getFormat(fr){switch(fr){case"public":return"spki";case"private":return"pkcs8"}}async function exportKeyToHexString(fr,br){const wr=getFormat(fr),Er=await crypto.subtle.exportKey(wr,br);return(0,util_1$b.uint8ArrayToHex)(new Uint8Array(Er))}cipher.exportKeyToHexString=exportKeyToHexString;async function importKeyFromHexString(fr,br){const wr=getFormat(fr),Er=(0,util_1$b.hexStringToUint8Array)(br).buffer;return await crypto.subtle.importKey(wr,Er,{name:"ECDH",namedCurve:"P-256"},!0,fr==="private"?["deriveKey"]:[])}cipher.importKeyFromHexString=importKeyFromHexString;async function encryptContent(fr,br){const wr=JSON.stringify(fr,(Er,kr)=>{if(!(kr instanceof Error))return kr;const jr=kr;return Object.assign(Object.assign({},jr.code?{code:jr.code}:{}),{message:jr.message})});return encrypt(br,wr)}cipher.encryptContent=encryptContent;async function decryptContent(fr,br){return JSON.parse(await decrypt(br,fr))}cipher.decryptContent=decryptContent;var ScopedLocalStorage$1={};Object.defineProperty(ScopedLocalStorage$1,"__esModule",{value:!0});ScopedLocalStorage$1.ScopedLocalStorage=void 0;class ScopedLocalStorage{constructor(br,wr){this.scope=br,this.module=wr}setItem(br,wr){localStorage.setItem(this.scopedKey(br),wr)}getItem(br){return localStorage.getItem(this.scopedKey(br))}removeItem(br){localStorage.removeItem(this.scopedKey(br))}clear(){const br=this.scopedKey(""),wr=[];for(let Er=0;ErlocalStorage.removeItem(Er))}scopedKey(br){return`-${this.scope}${this.module?`:${this.module}`:""}:${br}`}static clearAll(){new ScopedLocalStorage("CBWSDK").clear(),new ScopedLocalStorage("walletlink").clear()}}ScopedLocalStorage$1.ScopedLocalStorage=ScopedLocalStorage;Object.defineProperty(SCWKeyManager$1,"__esModule",{value:!0});SCWKeyManager$1.SCWKeyManager=void 0;const cipher_1$1=cipher,ScopedLocalStorage_1$6=ScopedLocalStorage$1,OWN_PRIVATE_KEY={storageKey:"ownPrivateKey",keyType:"private"},OWN_PUBLIC_KEY={storageKey:"ownPublicKey",keyType:"public"},PEER_PUBLIC_KEY={storageKey:"peerPublicKey",keyType:"public"};class SCWKeyManager{constructor(){this.storage=new ScopedLocalStorage_1$6.ScopedLocalStorage("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(br){this.sharedSecret=null,this.peerPublicKey=br,await this.storeKey(PEER_PUBLIC_KEY,br),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(OWN_PUBLIC_KEY.storageKey),this.storage.removeItem(OWN_PRIVATE_KEY.storageKey),this.storage.removeItem(PEER_PUBLIC_KEY.storageKey)}async generateKeyPair(){const br=await(0,cipher_1$1.generateKeyPair)();this.ownPrivateKey=br.privateKey,this.ownPublicKey=br.publicKey,await this.storeKey(OWN_PRIVATE_KEY,br.privateKey),await this.storeKey(OWN_PUBLIC_KEY,br.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(OWN_PRIVATE_KEY)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(OWN_PUBLIC_KEY)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(PEER_PUBLIC_KEY)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await(0,cipher_1$1.deriveSharedSecret)(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(br){const wr=this.storage.getItem(br.storageKey);return wr?(0,cipher_1$1.importKeyFromHexString)(br.keyType,wr):null}async storeKey(br,wr){const Er=await(0,cipher_1$1.exportKeyToHexString)(br.keyType,wr);this.storage.setItem(br.storageKey,Er)}}SCWKeyManager$1.SCWKeyManager=SCWKeyManager;var SCWStateManager$1={};Object.defineProperty(SCWStateManager$1,"__esModule",{value:!0});SCWStateManager$1.SCWStateManager=void 0;const ScopedLocalStorage_1$5=ScopedLocalStorage$1,ACCOUNTS_KEY="accounts",ACTIVE_CHAIN_STORAGE_KEY="activeChain",AVAILABLE_CHAINS_STORAGE_KEY="availableChains",WALLET_CAPABILITIES_STORAGE_KEY="walletCapabilities";class SCWStateManager{get accounts(){return this._accounts}get activeChain(){return this._activeChain}get walletCapabilities(){return this._walletCapabilities}constructor(br){var wr,Er;this.storage=new ScopedLocalStorage_1$5.ScopedLocalStorage("CBWSDK","SCWStateManager"),this.updateListener=br.updateListener,this.availableChains=this.loadItemFromStorage(AVAILABLE_CHAINS_STORAGE_KEY),this._walletCapabilities=this.loadItemFromStorage(WALLET_CAPABILITIES_STORAGE_KEY);const kr=this.loadItemFromStorage(ACCOUNTS_KEY),jr=this.loadItemFromStorage(ACTIVE_CHAIN_STORAGE_KEY);kr&&this.updateListener.onAccountsUpdate({accounts:kr,source:"storage"}),jr&&this.updateListener.onChainUpdate({chain:jr,source:"storage"}),this._accounts=kr||[],this._activeChain=jr||{id:(Er=(wr=br.appChainIds)===null||wr===void 0?void 0:wr[0])!==null&&Er!==void 0?Er:1}}updateAccounts(br){this._accounts=br,this.storeItemToStorage(ACCOUNTS_KEY,br),this.updateListener.onAccountsUpdate({accounts:br,source:"wallet"})}switchChain(br){var wr;const Er=(wr=this.availableChains)===null||wr===void 0?void 0:wr.find(kr=>kr.id===br);return Er?(Er===this._activeChain||(this._activeChain=Er,this.storeItemToStorage(ACTIVE_CHAIN_STORAGE_KEY,Er),this.updateListener.onChainUpdate({chain:Er,source:"wallet"})),!0):!1}updateAvailableChains(br){if(!br||Object.keys(br).length===0)return;const wr=Object.entries(br).map(([Er,kr])=>({id:Number(Er),rpcUrl:kr}));this.availableChains=wr,this.storeItemToStorage(AVAILABLE_CHAINS_STORAGE_KEY,wr),this.switchChain(this._activeChain.id)}updateWalletCapabilities(br){this._walletCapabilities=br,this.storeItemToStorage(WALLET_CAPABILITIES_STORAGE_KEY,br)}storeItemToStorage(br,wr){this.storage.setItem(br,JSON.stringify(wr))}loadItemFromStorage(br){const wr=this.storage.getItem(br);return wr?JSON.parse(wr):void 0}clear(){this.storage.clear()}}SCWStateManager$1.SCWStateManager=SCWStateManager;Object.defineProperty(SCWSigner$1,"__esModule",{value:!0});SCWSigner$1.SCWSigner=void 0;const SCWKeyManager_1=SCWKeyManager$1,SCWStateManager_1=SCWStateManager$1,error_1$7=error,util_1$a=util$6,cipher_1=cipher;class SCWSigner{constructor(br){this.metadata=br.metadata,this.communicator=br.communicator,this.keyManager=new SCWKeyManager_1.SCWKeyManager,this.stateManager=new SCWStateManager_1.SCWStateManager({appChainIds:this.metadata.appChainIds,updateListener:br.updateListener}),this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(){const br=await this.createRequestMessage({handshake:{method:"eth_requestAccounts",params:this.metadata}}),wr=await this.communicator.postRequestAndWaitForResponse(br);if("failure"in wr.content)throw wr.content.failure;const Er=await(0,cipher_1.importKeyFromHexString)("public",wr.sender);await this.keyManager.setPeerPublicKey(Er);const kr=await this.decryptResponseMessage(wr);this.updateInternalState({method:"eth_requestAccounts"},kr);const jr=kr.result;if("error"in jr)throw jr.error;return this.stateManager.accounts}async request(br){const wr=this.tryLocalHandling(br);if(wr!==void 0){if(wr instanceof Error)throw wr;return wr}await this.communicator.waitForPopupLoaded();const Er=await this.sendEncryptedRequest(br),kr=await this.decryptResponseMessage(Er);this.updateInternalState(br,kr);const jr=kr.result;if("error"in jr)throw jr.error;return jr.value}async disconnect(){this.stateManager.clear(),await this.keyManager.clear()}tryLocalHandling(br){var wr;switch(br.method){case"wallet_switchEthereumChain":{const Er=br.params;if(!Er||!(!((wr=Er[0])===null||wr===void 0)&&wr.chainId))throw error_1$7.standardErrors.rpc.invalidParams();const kr=(0,util_1$a.ensureIntNumber)(Er[0].chainId);return this.stateManager.switchChain(kr)?null:void 0}case"wallet_getCapabilities":{const Er=this.stateManager.walletCapabilities;if(!Er)throw error_1$7.standardErrors.provider.unauthorized("No wallet capabilities found, please disconnect and reconnect");return Er}default:return}}async sendEncryptedRequest(br){const wr=await this.keyManager.getSharedSecret();if(!wr)throw error_1$7.standardErrors.provider.unauthorized("No valid session found, try requestAccounts before other methods");const Er=await(0,cipher_1.encryptContent)({action:br,chainId:this.stateManager.activeChain.id},wr),kr=await this.createRequestMessage({encrypted:Er});return this.communicator.postRequestAndWaitForResponse(kr)}async createRequestMessage(br){const wr=await(0,cipher_1.exportKeyToHexString)("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:wr,content:br,timestamp:new Date}}async decryptResponseMessage(br){const wr=br.content;if("failure"in wr)throw wr.failure;const Er=await this.keyManager.getSharedSecret();if(!Er)throw error_1$7.standardErrors.provider.unauthorized("Invalid session");return(0,cipher_1.decryptContent)(wr.encrypted,Er)}updateInternalState(br,wr){var Er,kr;const jr=(Er=wr.data)===null||Er===void 0?void 0:Er.chains;jr&&this.stateManager.updateAvailableChains(jr);const Br=(kr=wr.data)===null||kr===void 0?void 0:kr.capabilities;Br&&this.stateManager.updateWalletCapabilities(Br);const Wr=wr.result;if(!("error"in Wr))switch(br.method){case"eth_requestAccounts":{const qr=Wr.value;this.stateManager.updateAccounts(qr);break}case"wallet_switchEthereumChain":{if(Wr.value!==null)return;const qr=br.params,Gr=(0,util_1$a.ensureIntNumber)(qr[0].chainId);this.stateManager.switchChain(Gr);break}}}}SCWSigner$1.SCWSigner=SCWSigner;var WalletLinkSigner$1={};const{Transform:Transform$1}=requireReadableBrowser$1();var keccak$2=fr=>class fS extends Transform$1{constructor(wr,Er,kr,jr,Br){super(Br),this._rate=wr,this._capacity=Er,this._delimitedSuffix=kr,this._hashBitLength=jr,this._options=Br,this._state=new fr,this._state.initialize(wr,Er),this._finalized=!1}_transform(wr,Er,kr){let jr=null;try{this.update(wr,Er)}catch(Br){jr=Br}kr(jr)}_flush(wr){let Er=null;try{this.push(this.digest())}catch(kr){Er=kr}wr(Er)}update(wr,Er){if(!Buffer$2.isBuffer(wr)&&typeof wr!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer$2.isBuffer(wr)||(wr=Buffer$2.from(wr,Er)),this._state.absorb(wr),this}digest(wr){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let Er=this._state.squeeze(this._hashBitLength/8);return wr!==void 0&&(Er=Er.toString(wr)),this._resetState(),Er}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const wr=new fS(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(wr._state),wr._finalized=this._finalized,wr}};const{Transform}=requireReadableBrowser$1();var shake=fr=>class hS extends Transform{constructor(wr,Er,kr,jr){super(jr),this._rate=wr,this._capacity=Er,this._delimitedSuffix=kr,this._options=jr,this._state=new fr,this._state.initialize(wr,Er),this._finalized=!1}_transform(wr,Er,kr){let jr=null;try{this.update(wr,Er)}catch(Br){jr=Br}kr(jr)}_flush(){}_read(wr){this.push(this.squeeze(wr))}update(wr,Er){if(!Buffer$2.isBuffer(wr)&&typeof wr!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer$2.isBuffer(wr)||(wr=Buffer$2.from(wr,Er)),this._state.absorb(wr),this}squeeze(wr,Er){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let kr=this._state.squeeze(wr);return Er!==void 0&&(kr=kr.toString(Er)),kr}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const wr=new hS(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(wr._state),wr._finalized=this._finalized,wr}};const createKeccak=keccak$2,createShake=shake;var api=function(fr){const br=createKeccak(fr),wr=createShake(fr);return function(Er,kr){switch(typeof Er=="string"?Er.toLowerCase():Er){case"keccak224":return new br(1152,448,null,224,kr);case"keccak256":return new br(1088,512,null,256,kr);case"keccak384":return new br(832,768,null,384,kr);case"keccak512":return new br(576,1024,null,512,kr);case"sha3-224":return new br(1152,448,6,224,kr);case"sha3-256":return new br(1088,512,6,256,kr);case"sha3-384":return new br(832,768,6,384,kr);case"sha3-512":return new br(576,1024,6,512,kr);case"shake128":return new wr(1344,256,31,kr);case"shake256":return new wr(1088,512,31,kr);default:throw new Error("Invald algorithm: "+Er)}}},keccakStateUnroll={};const P1600_ROUND_CONSTANTS=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];keccakStateUnroll.p1600=function(fr){for(let br=0;br<24;++br){const wr=fr[0]^fr[10]^fr[20]^fr[30]^fr[40],Er=fr[1]^fr[11]^fr[21]^fr[31]^fr[41],kr=fr[2]^fr[12]^fr[22]^fr[32]^fr[42],jr=fr[3]^fr[13]^fr[23]^fr[33]^fr[43],Br=fr[4]^fr[14]^fr[24]^fr[34]^fr[44],Wr=fr[5]^fr[15]^fr[25]^fr[35]^fr[45],qr=fr[6]^fr[16]^fr[26]^fr[36]^fr[46],Gr=fr[7]^fr[17]^fr[27]^fr[37]^fr[47],Vr=fr[8]^fr[18]^fr[28]^fr[38]^fr[48],Zr=fr[9]^fr[19]^fr[29]^fr[39]^fr[49];let Jr=Vr^(kr<<1|jr>>>31),Qr=Zr^(jr<<1|kr>>>31);const _n=fr[0]^Jr,En=fr[1]^Qr,Cn=fr[10]^Jr,In=fr[11]^Qr,An=fr[20]^Jr,jn=fr[21]^Qr,eo=fr[30]^Jr,ro=fr[31]^Qr,to=fr[40]^Jr,_i=fr[41]^Qr;Jr=wr^(Br<<1|Wr>>>31),Qr=Er^(Wr<<1|Br>>>31);const oo=fr[2]^Jr,io=fr[3]^Qr,co=fr[12]^Jr,so=fr[13]^Qr,no=fr[22]^Jr,Tn=fr[23]^Qr,Hr=fr[32]^Jr,Xr=fr[33]^Qr,Sn=fr[42]^Jr,Rn=fr[43]^Qr;Jr=kr^(qr<<1|Gr>>>31),Qr=jr^(Gr<<1|qr>>>31);const Pn=fr[4]^Jr,On=fr[5]^Qr,Zn=fr[14]^Jr,Nn=fr[15]^Qr,wn=fr[24]^Jr,zn=fr[25]^Qr,fo=fr[34]^Jr,vo=fr[35]^Qr,go=fr[44]^Jr,uo=fr[45]^Qr;Jr=Br^(Vr<<1|Zr>>>31),Qr=Wr^(Zr<<1|Vr>>>31);const lo=fr[6]^Jr,Eo=fr[7]^Qr,mo=fr[16]^Jr,yo=fr[17]^Qr,_o=fr[26]^Jr,Bo=fr[27]^Qr,Lo=fr[36]^Jr,Wo=fr[37]^Qr,na=fr[46]^Jr,qo=fr[47]^Qr;Jr=qr^(wr<<1|Er>>>31),Qr=Gr^(Er<<1|wr>>>31);const ga=fr[8]^Jr,wl=fr[9]^Qr,No=fr[18]^Jr,Fo=fr[19]^Qr,Nl=fr[28]^Jr,Vo=fr[29]^Qr,Uo=fr[38]^Jr,Ml=fr[39]^Qr,$a=fr[48]^Jr,Jo=fr[49]^Qr,Zl=_n,Cl=En,ko=In<<4|Cn>>>28,wo=Cn<<4|In>>>28,bo=An<<3|jn>>>29,Io=jn<<3|An>>>29,Ho=ro<<9|eo>>>23,Do=eo<<9|ro>>>23,zo=to<<18|_i>>>14,nu=_i<<18|to>>>14,Ll=oo<<1|io>>>31,_l=io<<1|oo>>>31,bu=so<<12|co>>>20,xl=co<<12|so>>>20,Tl=no<<10|Tn>>>22,du=Tn<<10|no>>>22,Bl=Xr<<13|Hr>>>19,Il=Hr<<13|Xr>>>19,Eu=Sn<<2|Rn>>>30,Al=Rn<<2|Sn>>>30,Ol=On<<30|Pn>>>2,Tu=Pn<<30|On>>>2,Ul=Zn<<6|Nn>>>26,Sl=Nn<<6|Zn>>>26,_u=zn<<11|wn>>>21,So=wn<<11|zn>>>21,Co=fo<<15|vo>>>17,Ao=vo<<15|fo>>>17,po=uo<<29|go>>>3,Ro=go<<29|uo>>>3,Xo=lo<<28|Eo>>>4,jo=Eo<<28|lo>>>4,Ko=yo<<23|mo>>>9,Wl=mo<<23|yo>>>9,$l=_o<<25|Bo>>>7,El=Bo<<25|_o>>>7,Cu=Lo<<21|Wo>>>11,iu=Wo<<21|Lo>>>11,pu=qo<<24|na>>>8,yu=na<<24|qo>>>8,hu=ga<<27|wl>>>5,mu=wl<<27|ga>>>5,vu=No<<20|Fo>>>12,fu=Fo<<20|No>>>12,gu=Vo<<7|Nl>>>25,ou=Nl<<7|Vo>>>25,su=Uo<<8|Ml>>>24,tu=Ml<<8|Uo>>>24,zl=$a<<14|Jo>>>18,Gl=Jo<<14|$a>>>18;fr[0]=Zl^~bu&_u,fr[1]=Cl^~xl&So,fr[10]=Xo^~vu&bo,fr[11]=jo^~fu&Io,fr[20]=Ll^~Ul&$l,fr[21]=_l^~Sl&El,fr[30]=hu^~ko&Tl,fr[31]=mu^~wo&du,fr[40]=Ol^~Ko&gu,fr[41]=Tu^~Wl&ou,fr[2]=bu^~_u&Cu,fr[3]=xl^~So&iu,fr[12]=vu^~bo&Bl,fr[13]=fu^~Io&Il,fr[22]=Ul^~$l&su,fr[23]=Sl^~El&tu,fr[32]=ko^~Tl&Co,fr[33]=wo^~du&Ao,fr[42]=Ko^~gu&Ho,fr[43]=Wl^~ou&Do,fr[4]=_u^~Cu&zl,fr[5]=So^~iu&Gl,fr[14]=bo^~Bl&po,fr[15]=Io^~Il&Ro,fr[24]=$l^~su&zo,fr[25]=El^~tu&nu,fr[34]=Tl^~Co&pu,fr[35]=du^~Ao&yu,fr[44]=gu^~Ho&Eu,fr[45]=ou^~Do&Al,fr[6]=Cu^~zl&Zl,fr[7]=iu^~Gl&Cl,fr[16]=Bl^~po&Xo,fr[17]=Il^~Ro&jo,fr[26]=su^~zo&Ll,fr[27]=tu^~nu&_l,fr[36]=Co^~pu&hu,fr[37]=Ao^~yu&mu,fr[46]=Ho^~Eu&Ol,fr[47]=Do^~Al&Tu,fr[8]=zl^~Zl&bu,fr[9]=Gl^~Cl&xl,fr[18]=po^~Xo&vu,fr[19]=Ro^~jo&fu,fr[28]=zo^~Ll&Ul,fr[29]=nu^~_l&Sl,fr[38]=pu^~hu&ko,fr[39]=yu^~mu&wo,fr[48]=Eu^~Ol&Ko,fr[49]=Al^~Tu&Wl,fr[0]^=P1600_ROUND_CONSTANTS[br*2],fr[1]^=P1600_ROUND_CONSTANTS[br*2+1]}};const keccakState=keccakStateUnroll;function Keccak(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}Keccak.prototype.initialize=function(fr,br){for(let wr=0;wr<50;++wr)this.state[wr]=0;this.blockSize=fr/8,this.count=0,this.squeezing=!1};Keccak.prototype.absorb=function(fr){for(let br=0;br>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(keccakState.p1600(this.state),this.count=0);return br};Keccak.prototype.copy=function(fr){for(let br=0;br<50;++br)fr.state[br]=this.state[br];fr.blockSize=this.blockSize,fr.count=this.count,fr.squeezing=this.squeezing};var keccak$1=Keccak,js=api(keccak$1);const createKeccakHash=js;function zeros(fr){return Buffer$2.allocUnsafe(fr).fill(0)}function bitLengthFromBigInt(fr){return fr.toString(2).length}function bufferBEFromBigInt(fr,br){let wr=fr.toString(16);wr.length%2!==0&&(wr="0"+wr);const Er=wr.match(/.{1,2}/g).map(kr=>parseInt(kr,16));for(;Er.length"u")throw new Error("Not an array?");if(wr=parseTypeArray(fr),wr!=="dynamic"&&wr!==0&&br.length>wr)throw new Error("Elements exceed array size: "+wr);kr=[],fr=fr.slice(0,fr.lastIndexOf("[")),typeof br=="string"&&(br=JSON.parse(br));for(jr in br)kr.push(encodeSingle(fr,br[jr]));if(wr==="dynamic"){var Br=encodeSingle("uint256",br.length);kr.unshift(Br)}return Buffer$2.concat(kr)}else{if(fr==="bytes")return br=new Buffer$2(br),kr=Buffer$2.concat([encodeSingle("uint256",br.length),br]),br.length%32!==0&&(kr=Buffer$2.concat([kr,util$3.zeros(32-br.length%32)])),kr;if(fr.startsWith("bytes")){if(wr=parseTypeN(fr),wr<1||wr>32)throw new Error("Invalid bytes width: "+wr);return util$3.setLengthRight(br,32)}else if(fr.startsWith("uint")){if(wr=parseTypeN(fr),wr%8||wr<8||wr>256)throw new Error("Invalid uint width: "+wr);Er=parseNumber(br);const Wr=util$3.bitLengthFromBigInt(Er);if(Wr>wr)throw new Error("Supplied uint exceeds width: "+wr+" vs "+Wr);if(Er<0)throw new Error("Supplied uint is negative");return util$3.bufferBEFromBigInt(Er,32)}else if(fr.startsWith("int")){if(wr=parseTypeN(fr),wr%8||wr<8||wr>256)throw new Error("Invalid int width: "+wr);Er=parseNumber(br);const Wr=util$3.bitLengthFromBigInt(Er);if(Wr>wr)throw new Error("Supplied int exceeds width: "+wr+" vs "+Wr);const qr=util$3.twosFromBigInt(Er,256);return util$3.bufferBEFromBigInt(qr,32)}else if(fr.startsWith("ufixed")){if(wr=parseTypeNxM(fr),Er=parseNumber(br),Er<0)throw new Error("Supplied ufixed is negative");return encodeSingle("uint256",Er*BigInt(2)**BigInt(wr[1]))}else if(fr.startsWith("fixed"))return wr=parseTypeNxM(fr),encodeSingle("int256",parseNumber(br)*BigInt(2)**BigInt(wr[1]))}throw new Error("Unsupported or invalid type: "+fr)}function isDynamic(fr){return fr==="string"||fr==="bytes"||parseTypeArray(fr)==="dynamic"}function isArray(fr){return fr.lastIndexOf("]")===fr.length-1}function rawEncode(fr,br){var wr=[],Er=[],kr=32*fr.length;for(var jr in fr){var Br=elementaryName(fr[jr]),Wr=br[jr],qr=encodeSingle(Br,Wr);isDynamic(Br)?(wr.push(encodeSingle("uint256",kr)),Er.push(qr),kr+=qr.length):wr.push(qr)}return Buffer$2.concat(wr.concat(Er))}function solidityPack(fr,br){if(fr.length!==br.length)throw new Error("Number of types are not matching the values");for(var wr,Er,kr=[],jr=0;jr32)throw new Error("Invalid bytes width: "+wr);kr.push(util$3.setLengthRight(Wr,wr))}else if(Br.startsWith("uint")){if(wr=parseTypeN(Br),wr%8||wr<8||wr>256)throw new Error("Invalid uint width: "+wr);Er=parseNumber(Wr);const qr=util$3.bitLengthFromBigInt(Er);if(qr>wr)throw new Error("Supplied uint exceeds width: "+wr+" vs "+qr);kr.push(util$3.bufferBEFromBigInt(Er,wr/8))}else if(Br.startsWith("int")){if(wr=parseTypeN(Br),wr%8||wr<8||wr>256)throw new Error("Invalid int width: "+wr);Er=parseNumber(Wr);const qr=util$3.bitLengthFromBigInt(Er);if(qr>wr)throw new Error("Supplied int exceeds width: "+wr+" vs "+qr);const Gr=util$3.twosFromBigInt(Er,wr);kr.push(util$3.bufferBEFromBigInt(Gr,wr/8))}else throw new Error("Unsupported or invalid type: "+Br)}return Buffer$2.concat(kr)}function soliditySHA3(fr,br){return util$3.keccak(solidityPack(fr,br))}var abi$1={rawEncode,solidityPack,soliditySHA3};const util$2=util$4,abi=abi$1,TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},TypedDataUtils={encodeData(fr,br,wr,Er=!0){const kr=["bytes32"],jr=[this.hashType(fr,wr)];if(Er){const Br=(Wr,qr,Gr)=>{if(wr[qr]!==void 0)return["bytes32",Gr==null?"0x0000000000000000000000000000000000000000000000000000000000000000":util$2.keccak(this.encodeData(qr,Gr,wr,Er))];if(Gr===void 0)throw new Error(`missing value for field ${Wr} of type ${qr}`);if(qr==="bytes")return["bytes32",util$2.keccak(Gr)];if(qr==="string")return typeof Gr=="string"&&(Gr=Buffer$2.from(Gr,"utf8")),["bytes32",util$2.keccak(Gr)];if(qr.lastIndexOf("]")===qr.length-1){const Vr=qr.slice(0,qr.lastIndexOf("[")),Zr=Gr.map(Jr=>Br(Wr,Vr,Jr));return["bytes32",util$2.keccak(abi.rawEncode(Zr.map(([Jr])=>Jr),Zr.map(([,Jr])=>Jr)))]}return[qr,Gr]};for(const Wr of wr[fr]){const[qr,Gr]=Br(Wr.name,Wr.type,br[Wr.name]);kr.push(qr),jr.push(Gr)}}else for(const Br of wr[fr]){let Wr=br[Br.name];if(Wr!==void 0)if(Br.type==="bytes")kr.push("bytes32"),Wr=util$2.keccak(Wr),jr.push(Wr);else if(Br.type==="string")kr.push("bytes32"),typeof Wr=="string"&&(Wr=Buffer$2.from(Wr,"utf8")),Wr=util$2.keccak(Wr),jr.push(Wr);else if(wr[Br.type]!==void 0)kr.push("bytes32"),Wr=util$2.keccak(this.encodeData(Br.type,Wr,wr,Er)),jr.push(Wr);else{if(Br.type.lastIndexOf("]")===Br.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");kr.push(Br.type),jr.push(Wr)}}return abi.rawEncode(kr,jr)},encodeType(fr,br){let wr="",Er=this.findTypeDependencies(fr,br).filter(kr=>kr!==fr);Er=[fr].concat(Er.sort());for(const kr of Er){if(!br[kr])throw new Error("No type definition specified: "+kr);wr+=kr+"("+br[kr].map(({name:Br,type:Wr})=>Wr+" "+Br).join(",")+")"}return wr},findTypeDependencies(fr,br,wr=[]){if(fr=fr.match(/^\w*/)[0],wr.includes(fr)||br[fr]===void 0)return wr;wr.push(fr);for(const Er of br[fr])for(const kr of this.findTypeDependencies(Er.type,br,wr))!wr.includes(kr)&&wr.push(kr);return wr},hashStruct(fr,br,wr,Er=!0){return util$2.keccak(this.encodeData(fr,br,wr,Er))},hashType(fr,br){return util$2.keccak(this.encodeType(fr,br))},sanitizeData(fr){const br={};for(const wr in TYPED_MESSAGE_SCHEMA.properties)fr[wr]&&(br[wr]=fr[wr]);return br.types&&(br.types=Object.assign({EIP712Domain:[]},br.types)),br},hash(fr,br=!0){const wr=this.sanitizeData(fr),Er=[Buffer$2.from("1901","hex")];return Er.push(this.hashStruct("EIP712Domain",wr.domain,wr.types,br)),wr.primaryType!=="EIP712Domain"&&Er.push(this.hashStruct(wr.primaryType,wr.message,wr.types,br)),util$2.keccak(Buffer$2.concat(Er))}};var ethEip712Util={TYPED_MESSAGE_SCHEMA,TypedDataUtils,hashForSignTypedDataLegacy:function(fr){return typedSignatureHashLegacy(fr.data)},hashForSignTypedData_v3:function(fr){return TypedDataUtils.hash(fr.data,!1)},hashForSignTypedData_v4:function(fr){return TypedDataUtils.hash(fr.data)}};function typedSignatureHashLegacy(fr){const br=new Error("Expect argument to be non-empty array");if(typeof fr!="object"||!fr.length)throw br;const wr=fr.map(function(jr){return jr.type==="bytes"?util$2.toBuffer(jr.value):jr.value}),Er=fr.map(function(jr){return jr.type}),kr=fr.map(function(jr){if(!jr.name)throw br;return jr.type+" "+jr.name});return abi.soliditySHA3(["bytes32","bytes32"],[abi.soliditySHA3(new Array(fr.length).fill("string"),kr),abi.soliditySHA3(Er,wr)])}var constants$1={};Object.defineProperty(constants$1,"__esModule",{value:!0});constants$1.APP_VERSION_KEY=constants$1.LOCAL_STORAGE_ADDRESSES_KEY=constants$1.WALLET_USER_NAME_KEY=void 0;constants$1.WALLET_USER_NAME_KEY="walletUsername";constants$1.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";constants$1.APP_VERSION_KEY="AppVersion";var RelayEventManager$1={};Object.defineProperty(RelayEventManager$1,"__esModule",{value:!0});RelayEventManager$1.RelayEventManager=void 0;const util_1$9=util$6;class RelayEventManager{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const br=this._nextRequestId,wr=(0,util_1$9.prepend0x)(br.toString(16));return this.callbacks.get(wr)&&this.callbacks.delete(wr),br}}RelayEventManager$1.RelayEventManager=RelayEventManager;var WalletLinkRelay$1={},WalletLinkConnection$1={},WalletLinkCipher$1={};Object.defineProperty(WalletLinkCipher$1,"__esModule",{value:!0});WalletLinkCipher$1.WalletLinkCipher=void 0;const util_1$8=util$6;class WalletLinkCipher{constructor(br){this.secret=br}async encrypt(br){const wr=this.secret;if(wr.length!==64)throw Error("secret must be 256 bits");const Er=crypto.getRandomValues(new Uint8Array(12)),kr=await crypto.subtle.importKey("raw",(0,util_1$8.hexStringToUint8Array)(wr),{name:"aes-gcm"},!1,["encrypt","decrypt"]),jr=new TextEncoder,Br=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:Er},kr,jr.encode(br)),Wr=16,qr=Br.slice(Br.byteLength-Wr),Gr=Br.slice(0,Br.byteLength-Wr),Vr=new Uint8Array(qr),Zr=new Uint8Array(Gr),Jr=new Uint8Array([...Er,...Vr,...Zr]);return(0,util_1$8.uint8ArrayToHex)(Jr)}async decrypt(br){const wr=this.secret;if(wr.length!==64)throw Error("secret must be 256 bits");return new Promise((Er,kr)=>{(async function(){const jr=await crypto.subtle.importKey("raw",(0,util_1$8.hexStringToUint8Array)(wr),{name:"aes-gcm"},!1,["encrypt","decrypt"]),Br=(0,util_1$8.hexStringToUint8Array)(br),Wr=Br.slice(0,12),qr=Br.slice(12,28),Gr=Br.slice(28),Vr=new Uint8Array([...Gr,...qr]),Zr={name:"AES-GCM",iv:new Uint8Array(Wr)};try{const Jr=await window.crypto.subtle.decrypt(Zr,jr,Vr),Qr=new TextDecoder;Er(Qr.decode(Jr))}catch(Jr){kr(Jr)}})()})}}WalletLinkCipher$1.WalletLinkCipher=WalletLinkCipher;var WalletLinkHTTP$1={};Object.defineProperty(WalletLinkHTTP$1,"__esModule",{value:!0});WalletLinkHTTP$1.WalletLinkHTTP=void 0;class WalletLinkHTTP{constructor(br,wr,Er){this.linkAPIUrl=br,this.sessionId=wr;const kr=`${wr}:${Er}`;this.auth=`Basic ${btoa(kr)}`}async markUnseenEventsAsSeen(br){return Promise.all(br.map(wr=>fetch(`${this.linkAPIUrl}/events/${wr.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(wr=>console.error("Unabled to mark event as failed:",wr))}async fetchUnseenEvents(){var br;const wr=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(wr.ok){const{events:Er,error:kr}=await wr.json();if(kr)throw new Error(`Check unseen events failed: ${kr}`);const jr=(br=Er==null?void 0:Er.filter(Br=>Br.event==="Web3Response").map(Br=>({type:"Event",sessionId:this.sessionId,eventId:Br.id,event:Br.event,data:Br.data})))!==null&&br!==void 0?br:[];return this.markUnseenEventsAsSeen(jr),jr}throw new Error(`Check unseen events failed: ${wr.status}`)}}WalletLinkHTTP$1.WalletLinkHTTP=WalletLinkHTTP;var WalletLinkWebSocket$1={};Object.defineProperty(WalletLinkWebSocket$1,"__esModule",{value:!0});WalletLinkWebSocket$1.WalletLinkWebSocket=WalletLinkWebSocket$1.ConnectionState=void 0;var ConnectionState;(function(fr){fr[fr.DISCONNECTED=0]="DISCONNECTED",fr[fr.CONNECTING=1]="CONNECTING",fr[fr.CONNECTED=2]="CONNECTED"})(ConnectionState||(WalletLinkWebSocket$1.ConnectionState=ConnectionState={}));class WalletLinkWebSocket{setConnectionStateListener(br){this.connectionStateListener=br}setIncomingDataListener(br){this.incomingDataListener=br}constructor(br,wr=WebSocket){this.WebSocketClass=wr,this.webSocket=null,this.pendingData=[],this.url=br.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((br,wr)=>{var Er;let kr;try{this.webSocket=kr=new this.WebSocketClass(this.url)}catch(jr){wr(jr);return}(Er=this.connectionStateListener)===null||Er===void 0||Er.call(this,ConnectionState.CONNECTING),kr.onclose=jr=>{var Br;this.clearWebSocket(),wr(new Error(`websocket error ${jr.code}: ${jr.reason}`)),(Br=this.connectionStateListener)===null||Br===void 0||Br.call(this,ConnectionState.DISCONNECTED)},kr.onopen=jr=>{var Br;br(),(Br=this.connectionStateListener)===null||Br===void 0||Br.call(this,ConnectionState.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(qr=>this.sendData(qr)),this.pendingData=[])},kr.onmessage=jr=>{var Br,Wr;if(jr.data==="h")(Br=this.incomingDataListener)===null||Br===void 0||Br.call(this,{type:"Heartbeat"});else try{const qr=JSON.parse(jr.data);(Wr=this.incomingDataListener)===null||Wr===void 0||Wr.call(this,qr)}catch{}}})}disconnect(){var br;const{webSocket:wr}=this;if(wr){this.clearWebSocket(),(br=this.connectionStateListener)===null||br===void 0||br.call(this,ConnectionState.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{wr.close()}catch{}}}sendData(br){const{webSocket:wr}=this;if(!wr){this.pendingData.push(br),this.connect();return}wr.send(br)}clearWebSocket(){const{webSocket:br}=this;br&&(this.webSocket=null,br.onclose=null,br.onerror=null,br.onmessage=null,br.onopen=null)}}WalletLinkWebSocket$1.WalletLinkWebSocket=WalletLinkWebSocket;Object.defineProperty(WalletLinkConnection$1,"__esModule",{value:!0});WalletLinkConnection$1.WalletLinkConnection=void 0;const constants_1$4=constants$1,WalletLinkCipher_1=WalletLinkCipher$1,WalletLinkHTTP_1=WalletLinkHTTP$1,WalletLinkWebSocket_1=WalletLinkWebSocket$1,type_1$1=type$3,HEARTBEAT_INTERVAL=1e4,REQUEST_TIMEOUT=6e4;class WalletLinkConnection{constructor({session:br,linkAPIUrl:wr,listener:Er,WebSocketClass:kr=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,type_1$1.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=Br=>{if(!Br)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",qr=>Br.JsonRpcUrl&&this.handleChainUpdated(qr,Br.JsonRpcUrl)]]).forEach((qr,Gr)=>{const Vr=Br[Gr];Vr!==void 0&&qr(Vr)})},this.handleDestroyed=Br=>{var Wr;Br==="1"&&((Wr=this.listener)===null||Wr===void 0||Wr.resetAndReload())},this.handleAccountUpdated=async Br=>{var Wr;{const qr=await this.cipher.decrypt(Br);(Wr=this.listener)===null||Wr===void 0||Wr.accountUpdated(qr)}},this.handleMetadataUpdated=async(Br,Wr)=>{var qr;{const Gr=await this.cipher.decrypt(Wr);(qr=this.listener)===null||qr===void 0||qr.metadataUpdated(Br,Gr)}},this.handleWalletUsernameUpdated=async Br=>{this.handleMetadataUpdated(constants_1$4.WALLET_USER_NAME_KEY,Br)},this.handleAppVersionUpdated=async Br=>{this.handleMetadataUpdated(constants_1$4.APP_VERSION_KEY,Br)},this.handleChainUpdated=async(Br,Wr)=>{var qr;{const Gr=await this.cipher.decrypt(Br),Vr=await this.cipher.decrypt(Wr);(qr=this.listener)===null||qr===void 0||qr.chainUpdated(Gr,Vr)}},this.session=br,this.cipher=new WalletLinkCipher_1.WalletLinkCipher(br.secret),this.listener=Er;const jr=new WalletLinkWebSocket_1.WalletLinkWebSocket(`${wr}/rpc`,kr);jr.setConnectionStateListener(async Br=>{let Wr=!1;switch(Br){case WalletLinkWebSocket_1.ConnectionState.DISCONNECTED:if(!this.destroyed){const qr=async()=>{await new Promise(Gr=>setTimeout(Gr,5e3)),this.destroyed||jr.connect().catch(()=>{qr()})};qr()}break;case WalletLinkWebSocket_1.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),Wr=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},HEARTBEAT_INTERVAL),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case WalletLinkWebSocket_1.ConnectionState.CONNECTING:break}this.connected!==Wr&&(this.connected=Wr)}),jr.setIncomingDataListener(Br=>{var Wr;switch(Br.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const qr=Br.type==="IsLinkedOK"?Br.linked:void 0;this.linked=qr||Br.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(Br.metadata);break}case"Event":{this.handleIncomingEvent(Br);break}}Br.id!==void 0&&((Wr=this.requestResolutions.get(Br.id))===null||Wr===void 0||Wr(Br))}),this.ws=jr,this.http=new WalletLinkHTTP_1.WalletLinkHTTP(wr,br.id,br.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}destroy(){this.destroyed=!0,this.ws.disconnect(),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(br){var wr;this._connected=br,br&&((wr=this.onceConnected)===null||wr===void 0||wr.call(this))}setOnceConnected(br){return new Promise(wr=>{this.connected?br().then(wr):this.onceConnected=()=>{br().then(wr),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(br){var wr,Er;this._linked=br,br&&((wr=this.onceLinked)===null||wr===void 0||wr.call(this)),(Er=this.listener)===null||Er===void 0||Er.linkedUpdated(br)}setOnceLinked(br){return new Promise(wr=>{this.linked?br().then(wr):this.onceLinked=()=>{br().then(wr),this.onceLinked=void 0}})}async handleIncomingEvent(br){var wr;if(!(br.type!=="Event"||br.event!=="Web3Response")){const Er=await this.cipher.decrypt(br.data),kr=JSON.parse(Er);if(kr.type!=="WEB3_RESPONSE")return;(wr=this.listener)===null||wr===void 0||wr.handleWeb3ResponseMessage(kr)}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(br=>setTimeout(br,250));try{await this.fetchUnseenEventsAPI()}catch(br){console.error("Unable to check for unseen events",br)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(wr=>this.handleIncomingEvent(wr))}async setSessionMetadata(br,wr){const Er={type:"SetSessionConfig",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[br]:wr}};return this.setOnceConnected(async()=>{const kr=await this.makeRequest(Er);if(kr.type==="Fail")throw new Error(kr.error||"failed to set session metadata")})}async publishEvent(br,wr,Er=!1){const kr=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},wr),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),jr={type:"PublishEvent",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:br,data:kr,callWebhook:Er};return this.setOnceLinked(async()=>{const Br=await this.makeRequest(jr);if(Br.type==="Fail")throw new Error(Br.error||"failed to publish event");return Br.eventId})}sendData(br){this.ws.sendData(JSON.stringify(br))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>HEARTBEAT_INTERVAL*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(br,wr=REQUEST_TIMEOUT){const Er=br.id;this.sendData(br);let kr;return Promise.race([new Promise((jr,Br)=>{kr=window.setTimeout(()=>{Br(new Error(`request ${Er} timed out`))},wr)}),new Promise(jr=>{this.requestResolutions.set(Er,Br=>{clearTimeout(kr),jr(Br),this.requestResolutions.delete(Er)})})])}async authenticate(){const br={type:"HostSession",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},wr=await this.makeRequest(br);if(wr.type==="Fail")throw new Error(wr.error||"failed to authenticate")}sendIsLinked(){const br={type:"IsLinked",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(br)}sendGetSessionConfig(){const br={type:"GetSessionConfig",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(br)}}WalletLinkConnection$1.WalletLinkConnection=WalletLinkConnection;var WalletLinkSession$1={};Object.defineProperty(WalletLinkSession$1,"__esModule",{value:!0});WalletLinkSession$1.WalletLinkSession=void 0;const sha_js_1=requireSha_js(),util_1$7=util$6,STORAGE_KEY_SESSION_ID="session:id",STORAGE_KEY_SESSION_SECRET="session:secret",STORAGE_KEY_SESSION_LINKED="session:linked";class WalletLinkSession{constructor(br,wr,Er,kr){this._storage=br,this._id=wr||(0,util_1$7.randomBytesHex)(16),this._secret=Er||(0,util_1$7.randomBytesHex)(32),this._key=new sha_js_1.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!kr}static load(br){const wr=br.getItem(STORAGE_KEY_SESSION_ID),Er=br.getItem(STORAGE_KEY_SESSION_LINKED),kr=br.getItem(STORAGE_KEY_SESSION_SECRET);return wr&&kr?new WalletLinkSession(br,wr,kr,Er==="1"):null}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(br){this._linked=br,this.persistLinked()}save(){return this._storage.setItem(STORAGE_KEY_SESSION_ID,this._id),this._storage.setItem(STORAGE_KEY_SESSION_SECRET,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(STORAGE_KEY_SESSION_LINKED,this._linked?"1":"0")}}WalletLinkSession$1.WalletLinkSession=WalletLinkSession;var util$1={};Object.defineProperty(util$1,"__esModule",{value:!0});util$1.isDarkMode=util$1.isMobileWeb=util$1.getLocation=util$1.createQrUrl=void 0;function createQrUrl(fr,br,wr,Er,kr,jr){const Br=Er?"parent-id":"id",Wr=new URLSearchParams({[Br]:fr,secret:br,server:wr,v:kr,chainId:jr.toString()}).toString();return`${wr}/#/link?${Wr}`}util$1.createQrUrl=createQrUrl;function isInIFrame(){try{return window.frameElement!==null}catch{return!1}}function getLocation(){try{return isInIFrame()&&window.top?window.top.location:window.location}catch{return window.location}}util$1.getLocation=getLocation;function isMobileWeb(){var fr;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((fr=window==null?void 0:window.navigator)===null||fr===void 0?void 0:fr.userAgent)}util$1.isMobileWeb=isMobileWeb;function isDarkMode(){var fr,br;return(br=(fr=window==null?void 0:window.matchMedia)===null||fr===void 0?void 0:fr.call(window,"(prefers-color-scheme: dark)").matches)!==null&&br!==void 0?br:!1}util$1.isDarkMode=isDarkMode;var WalletLinkRelayUI$1={},cssReset={},cssResetCss={};Object.defineProperty(cssResetCss,"__esModule",{value:!0});cssResetCss.default='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';var __importDefault$4=commonjsGlobal&&commonjsGlobal.__importDefault||function(fr){return fr&&fr.__esModule?fr:{default:fr}};Object.defineProperty(cssReset,"__esModule",{value:!0});cssReset.injectCssReset=void 0;const cssReset_css_1=__importDefault$4(cssResetCss);function injectCssReset(){const fr=document.createElement("style");fr.type="text/css",fr.appendChild(document.createTextNode(cssReset_css_1.default)),document.documentElement.appendChild(fr)}cssReset.injectCssReset=injectCssReset;var Snackbar={};function r$2(fr){var br,wr,Er="";if(typeof fr=="string"||typeof fr=="number")Er+=fr;else if(typeof fr=="object")if(Array.isArray(fr))for(br=0;br2&&(Br.children=arguments.length>3?n.call(arguments,2):wr),typeof fr=="function"&&fr.defaultProps!=null)for(jr in fr.defaultProps)Br[jr]===void 0&&(Br[jr]=fr.defaultProps[jr]);return g$1(fr,Br,Er,kr,null)}function g$1(fr,br,wr,Er,kr){var jr={type:fr,props:br,key:wr,ref:Er,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:kr??++u$1,__i:-1,__u:0};return kr==null&&l$1.vnode!=null&&l$1.vnode(jr),jr}function m$1(){return{current:null}}function b$1(fr){return fr.children}function k$1(fr,br){this.props=fr,this.context=br}function x$1(fr,br){if(br==null)return fr.__?x$1(fr.__,fr.__i+1):null;for(var wr;brbr&&i$2.sort(f$2));M.__r=0}function P$1(fr,br,wr,Er,kr,jr,Br,Wr,qr,Gr,Vr){var Zr,Jr,Qr,_n,En,Cn=Er&&Er.__k||v$1,In=br.length;for(wr.__d=qr,$(wr,br,Cn),qr=wr.__d,Zr=0;Zr0?g$1(kr.type,kr.props,kr.key,kr.ref?kr.ref:null,kr.__v):kr).__=fr,kr.__b=fr.__b+1,jr=null,(Wr=kr.__i=L(kr,wr,Br,Vr))!==-1&&(Vr--,(jr=wr[Wr])&&(jr.__u|=131072)),jr==null||jr.__v===null?(Wr==-1&&Zr--,typeof kr.type!="function"&&(kr.__u|=65536)):Wr!==Br&&(Wr==Br-1?Zr--:Wr==Br+1?Zr++:(Wr>Br?Zr--:Zr++,kr.__u|=65536))):kr=fr.__k[Er]=null;if(Vr)for(Er=0;Er(qr!=null&&!(131072&qr.__u)?1:0))for(;Br>=0||Wr=0){if((qr=br[Br])&&!(131072&qr.__u)&&kr==qr.key&&jr===qr.type)return Br;Br--}if(Wr2&&(Wr.children=arguments.length>3?n.call(arguments,2):wr),g$1(fr.type,Wr,Er||fr.key,kr||fr.ref,null)}function G(fr,br){var wr={__c:br="__cC"+a$1++,__:fr,Consumer:function(Er,kr){return Er.children(kr)},Provider:function(Er){var kr,jr;return this.getChildContext||(kr=new Set,(jr={})[br]=this,this.getChildContext=function(){return jr},this.componentWillUnmount=function(){kr=null},this.shouldComponentUpdate=function(Br){this.props.value!==Br.value&&kr.forEach(function(Wr){Wr.__e=!0,S(Wr)})},this.sub=function(Br){kr.add(Br);var Wr=Br.componentWillUnmount;Br.componentWillUnmount=function(){kr&&kr.delete(Br),Wr&&Wr.call(Br)}}),Er.children}};return wr.Provider.__=wr.Consumer.contextType=wr}n=v$1.slice,l$1={__e:function(fr,br,wr,Er){for(var kr,jr,Br;br=br.__;)if((kr=br.__c)&&!kr.__)try{if((jr=kr.constructor)&&jr.getDerivedStateFromError!=null&&(kr.setState(jr.getDerivedStateFromError(fr)),Br=kr.__d),kr.componentDidCatch!=null&&(kr.componentDidCatch(fr,Er||{}),Br=kr.__d),Br)return kr.__E=kr}catch(Wr){fr=Wr}throw fr}},u$1=0,t$1=function(fr){return fr!=null&&fr.constructor==null},k$1.prototype.setState=function(fr,br){var wr;wr=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=d$1({},this.state),typeof fr=="function"&&(fr=fr(d$1({},wr),this.props)),fr&&d$1(wr,fr),fr!=null&&this.__v&&(br&&this._sb.push(br),S(this))},k$1.prototype.forceUpdate=function(fr){this.__v&&(this.__e=!0,fr&&this.__h.push(fr),S(this))},k$1.prototype.render=b$1,i$2=[],r$1=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f$2=function(fr,br){return fr.__v.__b-br.__v.__b},M.__r=0,e$1=0,c$1=F$1(!1),s$1=F$1(!0),a$1=0;const preact_module=Object.freeze(Object.defineProperty({__proto__:null,Component:k$1,Fragment:b$1,cloneElement:D$1,createContext:G,createElement:_$1,createRef:m$1,h:_$1,hydrate:B$1,get isValidElement(){return t$1},get options(){return l$1},render:q$1,toChildArray:H},Symbol.toStringTag,{value:"Module"})),require$$1=getAugmentedNamespace(preact_module);var t,r,u,i$1,o=0,f$1=[],c=l$1,e=c.__b,a=c.__r,v=c.diffed,l=c.__c,m=c.unmount,s=c.__;function d(fr,br){c.__h&&c.__h(r,fr,o||br),o=0;var wr=r.__H||(r.__H={__:[],__h:[]});return fr>=wr.__.length&&wr.__.push({}),wr.__[fr]}function h(fr){return o=1,p(D,fr)}function p(fr,br,wr){var Er=d(t++,2);if(Er.t=fr,!Er.__c&&(Er.__=[wr?wr(br):D(void 0,br),function(Wr){var qr=Er.__N?Er.__N[0]:Er.__[0],Gr=Er.t(qr,Wr);qr!==Gr&&(Er.__N=[Gr,Er.__[1]],Er.__c.setState({}))}],Er.__c=r,!r.u)){var kr=function(Wr,qr,Gr){if(!Er.__c.__H)return!0;var Vr=Er.__c.__H.__.filter(function(Jr){return!!Jr.__c});if(Vr.every(function(Jr){return!Jr.__N}))return!jr||jr.call(this,Wr,qr,Gr);var Zr=Er.__c.props!==Wr;return Vr.forEach(function(Jr){if(Jr.__N){var Qr=Jr.__[0];Jr.__=Jr.__N,Jr.__N=void 0,Qr!==Jr.__[0]&&(Zr=!0)}}),jr&&jr.call(this,Wr,qr,Gr)||Zr};r.u=!0;var jr=r.shouldComponentUpdate,Br=r.componentWillUpdate;r.componentWillUpdate=function(Wr,qr,Gr){if(this.__e){var Vr=jr;jr=void 0,kr(Wr,qr,Gr),jr=Vr}Br&&Br.call(this,Wr,qr,Gr)},r.shouldComponentUpdate=kr}return Er.__N||Er.__}function y(fr,br){var wr=d(t++,3);!c.__s&&C(wr.__H,br)&&(wr.__=fr,wr.i=br,r.__H.__h.push(wr))}function _(fr,br){var wr=d(t++,4);!c.__s&&C(wr.__H,br)&&(wr.__=fr,wr.i=br,r.__h.push(wr))}function A(fr){return o=5,T(function(){return{current:fr}},[])}function F(fr,br,wr){o=6,_(function(){return typeof fr=="function"?(fr(br()),function(){return fr(null)}):fr?(fr.current=br(),function(){return fr.current=null}):void 0},wr==null?wr:wr.concat(fr))}function T(fr,br){var wr=d(t++,7);return C(wr.__H,br)&&(wr.__=fr(),wr.__H=br,wr.__h=fr),wr.__}function q(fr,br){return o=8,T(function(){return fr},br)}function x(fr){var br=r.context[fr.__c],wr=d(t++,9);return wr.c=fr,br?(wr.__==null&&(wr.__=!0,br.sub(r)),br.props.value):fr.__}function P(fr,br){c.useDebugValue&&c.useDebugValue(br?br(fr):fr)}function b(fr){var br=d(t++,10),wr=h();return br.__=fr,r.componentDidCatch||(r.componentDidCatch=function(Er,kr){br.__&&br.__(Er,kr),wr[1](Er)}),[wr[0],function(){wr[1](void 0)}]}function g(){var fr=d(t++,11);if(!fr.__){for(var br=r.__v;br!==null&&!br.__m&&br.__!==null;)br=br.__;var wr=br.__m||(br.__m=[0,0]);fr.__="P"+wr[0]+"-"+wr[1]++}return fr.__}function j(){for(var fr;fr=f$1.shift();)if(fr.__P&&fr.__H)try{fr.__H.__h.forEach(z),fr.__H.__h.forEach(B),fr.__H.__h=[]}catch(br){fr.__H.__h=[],c.__e(br,fr.__v)}}c.__b=function(fr){r=null,e&&e(fr)},c.__=function(fr,br){fr&&br.__k&&br.__k.__m&&(fr.__m=br.__k.__m),s&&s(fr,br)},c.__r=function(fr){a&&a(fr),t=0;var br=(r=fr.__c).__H;br&&(u===r?(br.__h=[],r.__h=[],br.__.forEach(function(wr){wr.__N&&(wr.__=wr.__N),wr.i=wr.__N=void 0})):(br.__h.forEach(z),br.__h.forEach(B),br.__h=[],t=0)),u=r},c.diffed=function(fr){v&&v(fr);var br=fr.__c;br&&br.__H&&(br.__H.__h.length&&(f$1.push(br)!==1&&i$1===c.requestAnimationFrame||((i$1=c.requestAnimationFrame)||w)(j)),br.__H.__.forEach(function(wr){wr.i&&(wr.__H=wr.i),wr.i=void 0})),u=r=null},c.__c=function(fr,br){br.some(function(wr){try{wr.__h.forEach(z),wr.__h=wr.__h.filter(function(Er){return!Er.__||B(Er)})}catch(Er){br.some(function(kr){kr.__h&&(kr.__h=[])}),br=[],c.__e(Er,wr.__v)}}),l&&l(fr,br)},c.unmount=function(fr){m&&m(fr);var br,wr=fr.__c;wr&&wr.__H&&(wr.__H.__.forEach(function(Er){try{z(Er)}catch(kr){br=kr}}),wr.__H=void 0,br&&c.__e(br,wr.__v))};var k=typeof requestAnimationFrame=="function";function w(fr){var br,wr=function(){clearTimeout(Er),k&&cancelAnimationFrame(br),setTimeout(fr)},Er=setTimeout(wr,100);k&&(br=requestAnimationFrame(wr))}function z(fr){var br=r,wr=fr.__c;typeof wr=="function"&&(fr.__c=void 0,wr()),r=br}function B(fr){var br=r;fr.__c=fr.__(),r=br}function C(fr,br){return!fr||fr.length!==br.length||br.some(function(wr,Er){return wr!==fr[Er]})}function D(fr,br){return typeof br=="function"?br(fr):br}const hooks_module=Object.freeze(Object.defineProperty({__proto__:null,useCallback:q,useContext:x,useDebugValue:P,useEffect:y,useErrorBoundary:b,useId:g,useImperativeHandle:F,useLayoutEffect:_,useMemo:T,useReducer:p,useRef:A,useState:h},Symbol.toStringTag,{value:"Module"})),require$$2$1=getAugmentedNamespace(hooks_module);var SnackbarCss={};Object.defineProperty(SnackbarCss,"__esModule",{value:!0});SnackbarCss.default=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}";(function(fr){var br=commonjsGlobal&&commonjsGlobal.__importDefault||function(Jr){return Jr&&Jr.__esModule?Jr:{default:Jr}};Object.defineProperty(fr,"__esModule",{value:!0}),fr.SnackbarInstance=fr.SnackbarContainer=fr.Snackbar=void 0;const wr=br(require$$0$1),Er=require$$1,kr=require$$2$1,jr=util$1,Br=br(SnackbarCss),Wr="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",qr="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class Gr{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=(0,jr.isDarkMode)()}attach(Qr){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",Qr.appendChild(this.root),this.render()}presentItem(Qr){const _n=this.nextItemKey++;return this.items.set(_n,Qr),this.render(),()=>{this.items.delete(_n),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,Er.render)((0,Er.h)("div",null,(0,Er.h)(fr.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([Qr,_n])=>(0,Er.h)(fr.SnackbarInstance,Object.assign({},_n,{key:Qr}))))),this.root)}}fr.Snackbar=Gr;const Vr=Jr=>(0,Er.h)("div",{class:(0,wr.default)("-cbwsdk-snackbar-container")},(0,Er.h)("style",null,Br.default),(0,Er.h)("div",{class:"-cbwsdk-snackbar"},Jr.children));fr.SnackbarContainer=Vr;const Zr=({autoExpand:Jr,message:Qr,menuItems:_n})=>{const[En,Cn]=(0,kr.useState)(!0),[In,An]=(0,kr.useState)(Jr??!1);(0,kr.useEffect)(()=>{const eo=[window.setTimeout(()=>{Cn(!1)},1),window.setTimeout(()=>{An(!0)},1e4)];return()=>{eo.forEach(window.clearTimeout)}});const jn=()=>{An(!In)};return(0,Er.h)("div",{class:(0,wr.default)("-cbwsdk-snackbar-instance",En&&"-cbwsdk-snackbar-instance-hidden",In&&"-cbwsdk-snackbar-instance-expanded")},(0,Er.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:jn},(0,Er.h)("img",{src:Wr,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,Er.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},Qr),(0,Er.h)("div",{class:"-gear-container"},!In&&(0,Er.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,Er.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,Er.h)("img",{src:qr,class:"-gear-icon",title:"Expand"}))),_n&&_n.length>0&&(0,Er.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},_n.map((eo,ro)=>(0,Er.h)("div",{class:(0,wr.default)("-cbwsdk-snackbar-instance-menu-item",eo.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:eo.onClick,key:ro},(0,Er.h)("svg",{width:eo.svgWidth,height:eo.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,Er.h)("path",{"fill-rule":eo.defaultFillRule,"clip-rule":eo.defaultClipRule,d:eo.path,fill:"#AAAAAA"})),(0,Er.h)("span",{class:(0,wr.default)("-cbwsdk-snackbar-instance-menu-item-info",eo.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},eo.info)))))};fr.SnackbarInstance=Zr})(Snackbar);Object.defineProperty(WalletLinkRelayUI$1,"__esModule",{value:!0});WalletLinkRelayUI$1.WalletLinkRelayUI=void 0;const cssReset_1$1=cssReset,Snackbar_1$1=Snackbar;class WalletLinkRelayUI{constructor(){this.attached=!1,this.snackbar=new Snackbar_1$1.Snackbar}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const br=document.documentElement,wr=document.createElement("div");wr.className="-cbwsdk-css-reset",br.appendChild(wr),this.snackbar.attach(wr),this.attached=!0,(0,cssReset_1$1.injectCssReset)()}showConnecting(br){let wr;return br.isUnlinkedErrorState?wr={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:br.onResetConnection}]}:wr={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:br.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:br.onResetConnection}]},this.snackbar.presentItem(wr)}}WalletLinkRelayUI$1.WalletLinkRelayUI=WalletLinkRelayUI;var WLMobileRelayUI$1={},RedirectDialog$1={},RedirectDialogCss={};Object.defineProperty(RedirectDialogCss,"__esModule",{value:!0});RedirectDialogCss.default=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";var __importDefault$3=commonjsGlobal&&commonjsGlobal.__importDefault||function(fr){return fr&&fr.__esModule?fr:{default:fr}};Object.defineProperty(RedirectDialog$1,"__esModule",{value:!0});RedirectDialog$1.RedirectDialog=void 0;const clsx_1=__importDefault$3(require$$0$1),preact_1=require$$1,cssReset_1=cssReset,Snackbar_1=Snackbar,util_1$6=util$1,RedirectDialog_css_1=__importDefault$3(RedirectDialogCss);class RedirectDialog{constructor(){this.root=null,this.darkMode=(0,util_1$6.isDarkMode)()}attach(){const br=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",br.appendChild(this.root),(0,cssReset_1.injectCssReset)()}present(br){this.render(br)}clear(){this.render(null)}render(br){this.root&&((0,preact_1.render)(null,this.root),br&&(0,preact_1.render)((0,preact_1.h)(RedirectDialogContent,Object.assign({},br,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}RedirectDialog$1.RedirectDialog=RedirectDialog;const RedirectDialogContent=({title:fr,buttonText:br,darkMode:wr,onButtonClick:Er,onDismiss:kr})=>{const jr=wr?"dark":"light";return(0,preact_1.h)(Snackbar_1.SnackbarContainer,{darkMode:wr},(0,preact_1.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,preact_1.h)("style",null,RedirectDialog_css_1.default),(0,preact_1.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:kr}),(0,preact_1.h)("div",{class:(0,clsx_1.default)("-cbwsdk-redirect-dialog-box",jr)},(0,preact_1.h)("p",null,fr),(0,preact_1.h)("button",{onClick:Er},br))))};var constants={};Object.defineProperty(constants,"__esModule",{value:!0});constants.CBW_MOBILE_DEEPLINK_URL=constants.WALLETLINK_URL=constants.CB_KEYS_URL=void 0;constants.CB_KEYS_URL="https://keys.coinbase.com/connect";constants.WALLETLINK_URL="https://www.walletlink.org";constants.CBW_MOBILE_DEEPLINK_URL="https://go.cb-w.com/walletlink";Object.defineProperty(WLMobileRelayUI$1,"__esModule",{value:!0});WLMobileRelayUI$1.WLMobileRelayUI=void 0;const RedirectDialog_1=RedirectDialog$1,util_1$5=util$1,constants_1$3=constants;class WLMobileRelayUI{constructor(){this.attached=!1,this.redirectDialog=new RedirectDialog_1.RedirectDialog}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(br){const wr=new URL(constants_1$3.CBW_MOBILE_DEEPLINK_URL);wr.searchParams.append("redirect_url",(0,util_1$5.getLocation)().href),br&&wr.searchParams.append("wl_url",br);const Er=document.createElement("a");Er.target="cbw-opener",Er.href=wr.href,Er.rel="noreferrer noopener",Er.click()}openCoinbaseWalletDeeplink(br){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(br)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(br)},99)}showConnecting(br){return()=>{this.redirectDialog.clear()}}}WLMobileRelayUI$1.WLMobileRelayUI=WLMobileRelayUI;Object.defineProperty(WalletLinkRelay$1,"__esModule",{value:!0});WalletLinkRelay$1.WalletLinkRelay=void 0;const WalletLinkConnection_1=WalletLinkConnection$1,constants_1$2=constants$1,RelayEventManager_1$1=RelayEventManager$1,WalletLinkSession_1=WalletLinkSession$1,Web3Response_1$1=Web3Response,util_1$4=util$1,WalletLinkRelayUI_1=WalletLinkRelayUI$1,WLMobileRelayUI_1=WLMobileRelayUI$1,error_1$6=error,util_2$1=util$6,ScopedLocalStorage_1$4=ScopedLocalStorage$1;class WalletLinkRelay{constructor(br){this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,util_1$4.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=jr=>{this.isLinked=jr;const Br=this.storage.getItem(constants_1$2.LOCAL_STORAGE_ADDRESSES_KEY);if(jr&&(this._session.linked=jr),this.isUnlinkedErrorState=!1,Br){const Wr=Br.split(" "),qr=this.storage.getItem("IsStandaloneSigning")==="true";Wr[0]!==""&&!jr&&this._session.linked&&!qr&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(jr,Br)=>{this.storage.setItem(jr,Br)},this.chainUpdated=(jr,Br)=>{this.chainCallbackParams.chainId===jr&&this.chainCallbackParams.jsonRpcUrl===Br||(this.chainCallbackParams={chainId:jr,jsonRpcUrl:Br},this.chainCallback&&this.chainCallback(jr,Br))},this.accountUpdated=jr=>{this.accountsCallback&&this.accountsCallback([jr]),WalletLinkRelay.accountRequestCallbackIds.size>0&&(Array.from(WalletLinkRelay.accountRequestCallbackIds.values()).forEach(Br=>{const Wr={type:"WEB3_RESPONSE",id:Br,response:{method:"requestEthereumAccounts",result:[jr]}};this.invokeCallback(Object.assign(Object.assign({},Wr),{id:Br}))}),WalletLinkRelay.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=br.linkAPIUrl,this.storage=br.storage;const{session:wr,ui:Er,connection:kr}=this.subscribe();this._session=wr,this.connection=kr,this.relayEventManager=new RelayEventManager_1$1.RelayEventManager,this.ui=Er}subscribe(){const br=WalletLinkSession_1.WalletLinkSession.load(this.storage)||new WalletLinkSession_1.WalletLinkSession(this.storage).save(),{linkAPIUrl:wr}=this,Er=new WalletLinkConnection_1.WalletLinkConnection({session:br,linkAPIUrl:wr,listener:this}),kr=this.isMobileWeb?new WLMobileRelayUI_1.WLMobileRelayUI:new WalletLinkRelayUI_1.WalletLinkRelayUI;return Er.connect(),{session:br,ui:kr,connection:Er}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(br=>setTimeout(()=>br(null),1e3))]).then(()=>{this.connection.destroy();const br=WalletLinkSession_1.WalletLinkSession.load(this.storage);(br==null?void 0:br.id)===this._session.id&&ScopedLocalStorage_1$4.ScopedLocalStorage.clearAll(),document.location.reload()}).catch(br=>{})}setAppInfo(br,wr){this.appName=br,this.appLogoUrl=wr}getStorageItem(br){return this.storage.getItem(br)}setStorageItem(br,wr){this.storage.setItem(br,wr)}signEthereumMessage(br,wr,Er,kr){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,util_2$1.hexStringFromBuffer)(br,!0),address:wr,addPrefix:Er,typedDataJson:kr||null}})}ethereumAddressFromSignedMessage(br,wr,Er){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,util_2$1.hexStringFromBuffer)(br,!0),signature:(0,util_2$1.hexStringFromBuffer)(wr,!0),addPrefix:Er}})}signEthereumTransaction(br){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:br.fromAddress,toAddress:br.toAddress,weiValue:(0,util_2$1.bigIntStringFromBigInt)(br.weiValue),data:(0,util_2$1.hexStringFromBuffer)(br.data,!0),nonce:br.nonce,gasPriceInWei:br.gasPriceInWei?(0,util_2$1.bigIntStringFromBigInt)(br.gasPriceInWei):null,maxFeePerGas:br.gasPriceInWei?(0,util_2$1.bigIntStringFromBigInt)(br.gasPriceInWei):null,maxPriorityFeePerGas:br.gasPriceInWei?(0,util_2$1.bigIntStringFromBigInt)(br.gasPriceInWei):null,gasLimit:br.gasLimit?(0,util_2$1.bigIntStringFromBigInt)(br.gasLimit):null,chainId:br.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(br){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:br.fromAddress,toAddress:br.toAddress,weiValue:(0,util_2$1.bigIntStringFromBigInt)(br.weiValue),data:(0,util_2$1.hexStringFromBuffer)(br.data,!0),nonce:br.nonce,gasPriceInWei:br.gasPriceInWei?(0,util_2$1.bigIntStringFromBigInt)(br.gasPriceInWei):null,maxFeePerGas:br.maxFeePerGas?(0,util_2$1.bigIntStringFromBigInt)(br.maxFeePerGas):null,maxPriorityFeePerGas:br.maxPriorityFeePerGas?(0,util_2$1.bigIntStringFromBigInt)(br.maxPriorityFeePerGas):null,gasLimit:br.gasLimit?(0,util_2$1.bigIntStringFromBigInt)(br.gasLimit):null,chainId:br.chainId,shouldSubmit:!0}})}submitEthereumTransaction(br,wr){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,util_2$1.hexStringFromBuffer)(br,!0),chainId:wr}})}scanQRCode(br){return this.sendRequest({method:"scanQRCode",params:{regExp:br}})}getWalletLinkSession(){return this._session}genericRequest(br,wr){return this.sendRequest({method:"generic",params:{action:wr,data:br}})}sendGenericMessage(br){return this.sendRequest(br)}sendRequest(br){let wr=null;const Er=(0,util_2$1.randomBytesHex)(8),kr=jr=>{this.publishWeb3RequestCanceledEvent(Er),this.handleErrorResponse(Er,br.method,jr),wr==null||wr()};return new Promise((jr,Br)=>{wr=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:kr,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(Er,Wr=>{if(wr==null||wr(),(0,Web3Response_1$1.isErrorResponse)(Wr))return Br(new Error(Wr.errorMessage));jr(Wr)}),this.publishWeb3RequestEvent(Er,br)})}setAccountsCallback(br){this.accountsCallback=br}setChainCallback(br){this.chainCallback=br}setDappDefaultChainCallback(br){this.dappDefaultChain=br}publishWeb3RequestEvent(br,wr){const Er={type:"WEB3_REQUEST",id:br,request:wr};this.publishEvent("Web3Request",Er,!0).then(kr=>{}).catch(kr=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:Er.id,response:{method:wr.method,errorMessage:kr.message}})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(wr.method)}openCoinbaseWalletDeeplink(br){if(this.ui instanceof WLMobileRelayUI_1.WLMobileRelayUI)switch(br){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(br){const wr={type:"WEB3_REQUEST_CANCELED",id:br};this.publishEvent("Web3RequestCanceled",wr,!1).then()}publishEvent(br,wr,Er){return this.connection.publishEvent(br,wr,Er)}handleWeb3ResponseMessage(br){const{response:wr}=br;if(wr.method==="requestEthereumAccounts"){WalletLinkRelay.accountRequestCallbackIds.forEach(Er=>this.invokeCallback(Object.assign(Object.assign({},br),{id:Er}))),WalletLinkRelay.accountRequestCallbackIds.clear();return}this.invokeCallback(br)}handleErrorResponse(br,wr,Er){var kr;const jr=(kr=Er==null?void 0:Er.message)!==null&&kr!==void 0?kr:"Unspecified error message.";this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:br,response:{method:wr,errorMessage:jr}})}invokeCallback(br){const wr=this.relayEventManager.callbacks.get(br.id);wr&&(wr(br.response),this.relayEventManager.callbacks.delete(br.id))}requestEthereumAccounts(){const br={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},wr=(0,util_2$1.randomBytesHex)(8);return new Promise((Er,kr)=>{this.relayEventManager.callbacks.set(wr,jr=>{if((0,Web3Response_1$1.isErrorResponse)(jr))return kr(new Error(jr.errorMessage));Er(jr)}),WalletLinkRelay.accountRequestCallbackIds.add(wr),this.publishWeb3RequestEvent(wr,br)})}watchAsset(br,wr,Er,kr,jr,Br){const Wr={method:"watchAsset",params:{type:br,options:{address:wr,symbol:Er,decimals:kr,image:jr},chainId:Br}};let qr=null;const Gr=(0,util_2$1.randomBytesHex)(8),Vr=Zr=>{this.publishWeb3RequestCanceledEvent(Gr),this.handleErrorResponse(Gr,Wr.method,Zr),qr==null||qr()};return qr=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:Vr,onResetConnection:this.resetAndReload}),new Promise((Zr,Jr)=>{this.relayEventManager.callbacks.set(Gr,Qr=>{if(qr==null||qr(),(0,Web3Response_1$1.isErrorResponse)(Qr))return Jr(new Error(Qr.errorMessage));Zr(Qr)}),this.publishWeb3RequestEvent(Gr,Wr)})}addEthereumChain(br,wr,Er,kr,jr,Br){const Wr={method:"addEthereumChain",params:{chainId:br,rpcUrls:wr,blockExplorerUrls:kr,chainName:jr,iconUrls:Er,nativeCurrency:Br}};let qr=null;const Gr=(0,util_2$1.randomBytesHex)(8),Vr=Zr=>{this.publishWeb3RequestCanceledEvent(Gr),this.handleErrorResponse(Gr,Wr.method,Zr),qr==null||qr()};return qr=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:Vr,onResetConnection:this.resetAndReload}),new Promise((Zr,Jr)=>{this.relayEventManager.callbacks.set(Gr,Qr=>{if(qr==null||qr(),(0,Web3Response_1$1.isErrorResponse)(Qr))return Jr(new Error(Qr.errorMessage));Zr(Qr)}),this.publishWeb3RequestEvent(Gr,Wr)})}switchEthereumChain(br,wr){const Er={method:"switchEthereumChain",params:Object.assign({chainId:br},{address:wr})},kr=(0,util_2$1.randomBytesHex)(8);return new Promise((jr,Br)=>{this.relayEventManager.callbacks.set(kr,Wr=>{if((0,Web3Response_1$1.isErrorResponse)(Wr)&&Wr.errorCode)return Br(error_1$6.standardErrors.provider.custom({code:Wr.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,Web3Response_1$1.isErrorResponse)(Wr))return Br(new Error(Wr.errorMessage));jr(Wr)}),this.publishWeb3RequestEvent(kr,Er)})}}WalletLinkRelay$1.WalletLinkRelay=WalletLinkRelay;WalletLinkRelay.accountRequestCallbackIds=new Set;var __importDefault$2=commonjsGlobal&&commonjsGlobal.__importDefault||function(fr){return fr&&fr.__esModule?fr:{default:fr}};Object.defineProperty(WalletLinkSigner$1,"__esModule",{value:!0});WalletLinkSigner$1.WalletLinkSigner=void 0;const eth_eip712_util_1=__importDefault$2(ethEip712Util),constants_1$1=constants$1,RelayEventManager_1=RelayEventManager$1,Web3Response_1=Web3Response,WalletLinkRelay_1=WalletLinkRelay$1,constants_2=constants,error_1$5=error,util_1$3=util$6,ScopedLocalStorage_1$3=ScopedLocalStorage$1,DEFAULT_CHAIN_ID_KEY="DefaultChainId",DEFAULT_JSON_RPC_URL="DefaultJsonRpcUrl";class WalletLinkSigner{constructor(br){var wr,Er;this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1;const{appName:kr,appLogoUrl:jr}=br.metadata;this._appName=kr,this._appLogoUrl=jr,this._storage=new ScopedLocalStorage_1$3.ScopedLocalStorage("walletlink",constants_2.WALLETLINK_URL),this.updateListener=br.updateListener,this._relayEventManager=new RelayEventManager_1.RelayEventManager,this._jsonRpcUrlFromOpts="";const Br=this._storage.getItem(constants_1$1.LOCAL_STORAGE_ADDRESSES_KEY);if(Br){const qr=Br.split(" ");qr[0]!==""&&(this._addresses=qr.map(Gr=>(0,util_1$3.ensureAddressString)(Gr)),(wr=this.updateListener)===null||wr===void 0||wr.onAccountsUpdate({accounts:this._addresses,source:"storage"}))}this._storage.getItem(DEFAULT_CHAIN_ID_KEY)&&((Er=this.updateListener)===null||Er===void 0||Er.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0),this.initializeRelay()}getSession(){const br=this.initializeRelay(),{id:wr,secret:Er}=br.getWalletLinkSession();return{id:wr,secret:Er}}async handshake(){return await this.request({method:"eth_requestAccounts"})}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var br;return(br=this._storage.getItem(DEFAULT_JSON_RPC_URL))!==null&&br!==void 0?br:this._jsonRpcUrlFromOpts}set jsonRpcUrl(br){this._storage.setItem(DEFAULT_JSON_RPC_URL,br)}updateProviderInfo(br,wr){var Er;this.jsonRpcUrl=br;const kr=this.getChainId();this._storage.setItem(DEFAULT_CHAIN_ID_KEY,wr.toString(10)),((0,util_1$3.ensureIntNumber)(wr)!==kr||!this.hasMadeFirstChainChangedEmission)&&((Er=this.updateListener)===null||Er===void 0||Er.onChainUpdate({chain:{id:wr,rpcUrl:br},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(br,wr,Er,kr,jr,Br){const qr=await this.initializeRelay().watchAsset(br,wr,Er,kr,jr,Br==null?void 0:Br.toString());return(0,Web3Response_1.isErrorResponse)(qr)?!1:!!qr.result}async addEthereumChain(br,wr,Er,kr,jr,Br){var Wr,qr;if((0,util_1$3.ensureIntNumber)(br)===this.getChainId())return!1;const Gr=this.initializeRelay();this._isAuthorized()||await Gr.requestEthereumAccounts();const Vr=await Gr.addEthereumChain(br.toString(),wr,jr,Er,kr,Br);return(0,Web3Response_1.isErrorResponse)(Vr)?!1:(((Wr=Vr.result)===null||Wr===void 0?void 0:Wr.isApproved)===!0&&this.updateProviderInfo(wr[0],br),((qr=Vr.result)===null||qr===void 0?void 0:qr.isApproved)===!0)}async switchEthereumChain(br){const Er=await this.initializeRelay().switchEthereumChain(br.toString(10),this.selectedAddress||void 0);if((0,Web3Response_1.isErrorResponse)(Er)){if(!Er.errorCode)return;throw Er.errorCode===error_1$5.standardErrorCodes.provider.unsupportedChain?error_1$5.standardErrors.provider.unsupportedChain():error_1$5.standardErrors.provider.custom({message:Er.errorMessage,code:Er.errorCode})}const kr=Er.result;kr.isApproved&&kr.rpcUrl.length>0&&this.updateProviderInfo(kr.rpcUrl,br)}async disconnect(){this._relay&&this._relay.resetAndReload(),this._storage.clear()}async request(br){try{return this._request(br).catch(wr=>{throw wr})}catch(wr){return Promise.reject(wr)}}async _request(br){if(!br||typeof br!="object"||Array.isArray(br))throw error_1$5.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:br});const{method:wr,params:Er}=br;if(typeof wr!="string"||wr.length===0)throw error_1$5.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:br});if(Er!==void 0&&!Array.isArray(Er)&&(typeof Er!="object"||Er===null))throw error_1$5.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:br});const kr=Er===void 0?[]:Er,jr=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:wr,params:kr,jsonrpc:"2.0",id:jr})).result}_setAddresses(br,wr){var Er;if(!Array.isArray(br))throw new Error("addresses is not an array");const kr=br.map(jr=>(0,util_1$3.ensureAddressString)(jr));JSON.stringify(kr)!==JSON.stringify(this._addresses)&&(this._addresses=kr,(Er=this.updateListener)===null||Er===void 0||Er.onAccountsUpdate({accounts:kr,source:"wallet"}),this._storage.setItem(constants_1$1.LOCAL_STORAGE_ADDRESSES_KEY,kr.join(" ")))}_sendRequestAsync(br){return new Promise((wr,Er)=>{try{const kr=this._handleSynchronousMethods(br);if(kr!==void 0)return wr({jsonrpc:"2.0",id:br.id,result:kr})}catch(kr){return Er(kr)}this._handleAsynchronousMethods(br).then(kr=>kr&&wr(Object.assign(Object.assign({},kr),{id:br.id}))).catch(kr=>Er(kr))})}_handleSynchronousMethods(br){const{method:wr}=br;switch(wr){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(br){const{method:wr}=br,Er=br.params||[];switch(wr){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(Er);case"eth_ecRecover":return this._eth_ecRecover(Er);case"personal_sign":return this._personal_sign(Er);case"personal_ecRecover":return this._personal_ecRecover(Er);case"eth_signTransaction":return this._eth_signTransaction(Er);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(Er);case"eth_sendTransaction":return this._eth_sendTransaction(Er);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(Er);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(Er);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(Er);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(Er);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(Er);case"wallet_watchAsset":return this._wallet_watchAsset(Er);default:return this._throwUnsupportedMethodError()}}_isKnownAddress(br){try{const wr=(0,util_1$3.ensureAddressString)(br);return this._addresses.map(kr=>(0,util_1$3.ensureAddressString)(kr)).includes(wr)}catch{}return!1}_ensureKnownAddress(br){if(!this._isKnownAddress(br))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(br){const wr=br.from?(0,util_1$3.ensureAddressString)(br.from):this.selectedAddress;if(!wr)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(wr);const Er=br.to?(0,util_1$3.ensureAddressString)(br.to):null,kr=br.value!=null?(0,util_1$3.ensureBigInt)(br.value):BigInt(0),jr=br.data?(0,util_1$3.ensureBuffer)(br.data):Buffer$2.alloc(0),Br=br.nonce!=null?(0,util_1$3.ensureIntNumber)(br.nonce):null,Wr=br.gasPrice!=null?(0,util_1$3.ensureBigInt)(br.gasPrice):null,qr=br.maxFeePerGas!=null?(0,util_1$3.ensureBigInt)(br.maxFeePerGas):null,Gr=br.maxPriorityFeePerGas!=null?(0,util_1$3.ensureBigInt)(br.maxPriorityFeePerGas):null,Vr=br.gas!=null?(0,util_1$3.ensureBigInt)(br.gas):null,Zr=br.chainId?(0,util_1$3.ensureIntNumber)(br.chainId):this.getChainId();return{fromAddress:wr,toAddress:Er,weiValue:kr,data:jr,nonce:Br,gasPriceInWei:Wr,maxFeePerGas:qr,maxPriorityFeePerGas:Gr,gasLimit:Vr,chainId:Zr}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw error_1$5.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw error_1$5.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(br,wr,Er,kr){this._ensureKnownAddress(wr);try{const Br=await this.initializeRelay().signEthereumMessage(br,wr,Er,kr);if((0,Web3Response_1.isErrorResponse)(Br))throw new Error(Br.errorMessage);return{jsonrpc:"2.0",id:0,result:Br.result}}catch(jr){throw typeof jr.message=="string"&&jr.message.match(/(denied|rejected)/i)?error_1$5.standardErrors.provider.userRejectedRequest("User denied message signature"):jr}}async _ethereumAddressFromSignedMessage(br,wr,Er){const jr=await this.initializeRelay().ethereumAddressFromSignedMessage(br,wr,Er);if((0,Web3Response_1.isErrorResponse)(jr))throw new Error(jr.errorMessage);return{jsonrpc:"2.0",id:0,result:jr.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,util_1$3.hexStringFromIntNumber)(this.getChainId())}getChainId(){const br=this._storage.getItem(DEFAULT_CHAIN_ID_KEY);if(!br)return(0,util_1$3.ensureIntNumber)(1);const wr=parseInt(br,10);return(0,util_1$3.ensureIntNumber)(wr)}async _eth_requestAccounts(){if(this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let br;try{if(br=await this.initializeRelay().requestEthereumAccounts(),(0,Web3Response_1.isErrorResponse)(br))throw new Error(br.errorMessage)}catch(wr){throw typeof wr.message=="string"&&wr.message.match(/(denied|rejected)/i)?error_1$5.standardErrors.provider.userRejectedRequest("User denied account authorization"):wr}if(!br.result)throw new Error("accounts received is empty");return this._setAddresses(br.result),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(br){this._requireAuthorization();const wr=(0,util_1$3.ensureAddressString)(br[0]),Er=(0,util_1$3.ensureBuffer)(br[1]);return this._signEthereumMessage(Er,wr,!1)}_eth_ecRecover(br){const wr=(0,util_1$3.ensureBuffer)(br[0]),Er=(0,util_1$3.ensureBuffer)(br[1]);return this._ethereumAddressFromSignedMessage(wr,Er,!1)}_personal_sign(br){this._requireAuthorization();const wr=(0,util_1$3.ensureBuffer)(br[0]),Er=(0,util_1$3.ensureAddressString)(br[1]);return this._signEthereumMessage(wr,Er,!0)}_personal_ecRecover(br){const wr=(0,util_1$3.ensureBuffer)(br[0]),Er=(0,util_1$3.ensureBuffer)(br[1]);return this._ethereumAddressFromSignedMessage(wr,Er,!0)}async _eth_signTransaction(br){this._requireAuthorization();const wr=this._prepareTransactionParams(br[0]||{});try{const kr=await this.initializeRelay().signEthereumTransaction(wr);if((0,Web3Response_1.isErrorResponse)(kr))throw new Error(kr.errorMessage);return{jsonrpc:"2.0",id:0,result:kr.result}}catch(Er){throw typeof Er.message=="string"&&Er.message.match(/(denied|rejected)/i)?error_1$5.standardErrors.provider.userRejectedRequest("User denied transaction signature"):Er}}async _eth_sendRawTransaction(br){const wr=(0,util_1$3.ensureBuffer)(br[0]),kr=await this.initializeRelay().submitEthereumTransaction(wr,this.getChainId());if((0,Web3Response_1.isErrorResponse)(kr))throw new Error(kr.errorMessage);return{jsonrpc:"2.0",id:0,result:kr.result}}async _eth_sendTransaction(br){this._requireAuthorization();const wr=this._prepareTransactionParams(br[0]||{});try{const kr=await this.initializeRelay().signAndSubmitEthereumTransaction(wr);if((0,Web3Response_1.isErrorResponse)(kr))throw new Error(kr.errorMessage);return{jsonrpc:"2.0",id:0,result:kr.result}}catch(Er){throw typeof Er.message=="string"&&Er.message.match(/(denied|rejected)/i)?error_1$5.standardErrors.provider.userRejectedRequest("User denied transaction signature"):Er}}async _eth_signTypedData_v1(br){this._requireAuthorization();const wr=(0,util_1$3.ensureParsedJSONObject)(br[0]),Er=(0,util_1$3.ensureAddressString)(br[1]);this._ensureKnownAddress(Er);const kr=eth_eip712_util_1.default.hashForSignTypedDataLegacy({data:wr}),jr=JSON.stringify(wr,null,2);return this._signEthereumMessage(kr,Er,!1,jr)}async _eth_signTypedData_v3(br){this._requireAuthorization();const wr=(0,util_1$3.ensureAddressString)(br[0]),Er=(0,util_1$3.ensureParsedJSONObject)(br[1]);this._ensureKnownAddress(wr);const kr=eth_eip712_util_1.default.hashForSignTypedData_v3({data:Er}),jr=JSON.stringify(Er,null,2);return this._signEthereumMessage(kr,wr,!1,jr)}async _eth_signTypedData_v4(br){this._requireAuthorization();const wr=(0,util_1$3.ensureAddressString)(br[0]),Er=(0,util_1$3.ensureParsedJSONObject)(br[1]);this._ensureKnownAddress(wr);const kr=eth_eip712_util_1.default.hashForSignTypedData_v4({data:Er}),jr=JSON.stringify(Er,null,2);return this._signEthereumMessage(kr,wr,!1,jr)}async _wallet_addEthereumChain(br){var wr,Er,kr,jr;const Br=br[0];if(((wr=Br.rpcUrls)===null||wr===void 0?void 0:wr.length)===0)return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!Br.chainName||Br.chainName.trim()==="")throw error_1$5.standardErrors.rpc.invalidParams("chainName is a required field");if(!Br.nativeCurrency)throw error_1$5.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const Wr=parseInt(Br.chainId,16);return await this.addEthereumChain(Wr,(Er=Br.rpcUrls)!==null&&Er!==void 0?Er:[],(kr=Br.blockExplorerUrls)!==null&&kr!==void 0?kr:[],Br.chainName,(jr=Br.iconUrls)!==null&&jr!==void 0?jr:[],Br.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(br){const wr=br[0];return await this.switchEthereumChain(parseInt(wr.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(br){const wr=Array.isArray(br)?br[0]:br;if(!wr.type)throw error_1$5.standardErrors.rpc.invalidParams("Type is required");if((wr==null?void 0:wr.type)!=="ERC20")throw error_1$5.standardErrors.rpc.invalidParams(`Asset of type '${wr.type}' is not supported`);if(!(wr!=null&&wr.options))throw error_1$5.standardErrors.rpc.invalidParams("Options are required");if(!(wr!=null&&wr.options.address))throw error_1$5.standardErrors.rpc.invalidParams("Address is required");const Er=this.getChainId(),{address:kr,symbol:jr,image:Br,decimals:Wr}=wr.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(wr.type,kr,jr,Wr,Br,Er)}}initializeRelay(){if(!this._relay){const br=new WalletLinkRelay_1.WalletLinkRelay({linkAPIUrl:constants_2.WALLETLINK_URL,storage:this._storage});br.setAppInfo(this._appName,this._appLogoUrl),br.attachUI(),br.setAccountsCallback((wr,Er)=>this._setAddresses(wr,Er)),br.setChainCallback((wr,Er)=>{this.updateProviderInfo(Er,parseInt(wr,10))}),this._relay=br}return this._relay}}WalletLinkSigner$1.WalletLinkSigner=WalletLinkSigner;var provider={};Object.defineProperty(provider,"__esModule",{value:!0});provider.checkErrorForInvalidRequestArgs=provider.getCoinbaseInjectedProvider=provider.getCoinbaseInjectedSigner=provider.fetchRPCRequest=void 0;const version_1$2=version$8,error_1$4=error;async function fetchRPCRequest(fr,br){if(!br.rpcUrl)throw error_1$4.standardErrors.rpc.internal("No RPC URL set for chain");const wr=Object.assign(Object.assign({},fr),{jsonrpc:"2.0",id:crypto.randomUUID()});return(await(await window.fetch(br.rpcUrl,{method:"POST",body:JSON.stringify(wr),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":version_1$2.LIB_VERSION}})).json()).result}provider.fetchRPCRequest=fetchRPCRequest;function getCoinbaseInjectedSigner(){return globalThis.coinbaseWalletSigner}provider.getCoinbaseInjectedSigner=getCoinbaseInjectedSigner;function getCoinbaseInjectedLegacyProvider(){return globalThis.coinbaseWalletExtension}function getInjectedEthereum(){var fr,br;try{const wr=globalThis;return(fr=wr.ethereum)!==null&&fr!==void 0?fr:(br=wr.top)===null||br===void 0?void 0:br.ethereum}catch{return}}function getCoinbaseInjectedProvider({metadata:fr,preference:br}){var wr;if(br.options!=="smartWalletOnly"){if(getCoinbaseInjectedSigner())return;const jr=getCoinbaseInjectedLegacyProvider();if(jr){const{appName:Br,appLogoUrl:Wr,appChainIds:qr}=fr;return(wr=jr.setAppInfo)===null||wr===void 0||wr.call(jr,Br,Wr,qr),jr}}const Er=getInjectedEthereum();if(Er!=null&&Er.isCoinbaseBrowser)return Er}provider.getCoinbaseInjectedProvider=getCoinbaseInjectedProvider;function checkErrorForInvalidRequestArgs(fr){if(!fr||typeof fr!="object"||Array.isArray(fr))return error_1$4.standardErrors.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:fr});const{method:br,params:wr}=fr;if(typeof br!="string"||br.length===0)return error_1$4.standardErrors.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:fr});if(wr!==void 0&&!Array.isArray(wr)&&(typeof wr!="object"||wr===null))return error_1$4.standardErrors.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:fr})}provider.checkErrorForInvalidRequestArgs=checkErrorForInvalidRequestArgs;Object.defineProperty(util$5,"__esModule",{value:!0});util$5.createSigner=util$5.fetchSignerType=util$5.storeSignerType=util$5.loadSignerType=void 0;const SCWSigner_1=SCWSigner$1,WalletLinkSigner_1=WalletLinkSigner$1,error_1$3=error,provider_1$2=provider,ScopedLocalStorage_1$2=ScopedLocalStorage$1,SIGNER_TYPE_KEY="SignerType",storage$1=new ScopedLocalStorage_1$2.ScopedLocalStorage("CBWSDK","SignerConfigurator");function loadSignerType(){return storage$1.getItem(SIGNER_TYPE_KEY)}util$5.loadSignerType=loadSignerType;function storeSignerType(fr){storage$1.setItem(SIGNER_TYPE_KEY,fr)}util$5.storeSignerType=storeSignerType;async function fetchSignerType(fr){const{communicator:br,metadata:wr}=fr;listenForWalletLinkSessionRequest(br,wr).catch(()=>{});const Er={id:crypto.randomUUID(),event:"selectSignerType",data:fr.preference},{data:kr}=await br.postRequestAndWaitForResponse(Er);return kr}util$5.fetchSignerType=fetchSignerType;function createSigner(fr){const{signerType:br,metadata:wr,communicator:Er,updateListener:kr}=fr;switch(br){case"scw":return new SCWSigner_1.SCWSigner({metadata:wr,updateListener:kr,communicator:Er});case"walletlink":return new WalletLinkSigner_1.WalletLinkSigner({metadata:wr,updateListener:kr});case"extension":{const jr=(0,provider_1$2.getCoinbaseInjectedSigner)();if(!jr)throw error_1$3.standardErrors.rpc.internal("injected signer not found");return jr}}}util$5.createSigner=createSigner;async function listenForWalletLinkSessionRequest(fr,br){await fr.onMessage(({event:Er})=>Er==="WalletLinkSessionRequest");const wr=new WalletLinkSigner_1.WalletLinkSigner({metadata:br});fr.postMessage({event:"WalletLinkUpdate",data:{session:wr.getSession()}}),await wr.handshake(),fr.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}var Communicator$1={},util={};Object.defineProperty(util,"__esModule",{value:!0});util.closePopup=util.openPopup=void 0;const error_1$2=error,POPUP_WIDTH=420,POPUP_HEIGHT=540;function openPopup(fr){const br=(window.innerWidth-POPUP_WIDTH)/2+window.screenX,wr=(window.innerHeight-POPUP_HEIGHT)/2+window.screenY,Er=window.open(fr,"Smart Wallet",`width=${POPUP_WIDTH}, height=${POPUP_HEIGHT}, left=${br}, top=${wr}`);if(Er==null||Er.focus(),!Er)throw error_1$2.standardErrors.rpc.internal("Pop up window failed to open");return Er}util.openPopup=openPopup;function closePopup(fr){fr&&!fr.closed&&fr.close()}util.closePopup=closePopup;Object.defineProperty(Communicator$1,"__esModule",{value:!0});Communicator$1.Communicator=void 0;const version_1$1=version$8,util_1$2=util,constants_1=constants,error_1$1=error;class Communicator{constructor(br=constants_1.CB_KEYS_URL){this.popup=null,this.listeners=new Map,this.postMessage=async wr=>{(await this.waitForPopupLoaded()).postMessage(wr,this.url.origin)},this.postRequestAndWaitForResponse=async wr=>{const Er=this.onMessage(({requestId:kr})=>kr===wr.id);return this.postMessage(wr),await Er},this.onMessage=async wr=>new Promise((Er,kr)=>{const jr=Br=>{if(Br.origin!==this.url.origin)return;const Wr=Br.data;wr(Wr)&&(Er(Wr),window.removeEventListener("message",jr),this.listeners.delete(jr))};window.addEventListener("message",jr),this.listeners.set(jr,{reject:kr})}),this.disconnect=()=>{(0,util_1$2.closePopup)(this.popup),this.popup=null,this.listeners.forEach(({reject:wr},Er)=>{wr(error_1$1.standardErrors.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",Er)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=(0,util_1$2.openPopup)(this.url),this.onMessage(({event:wr})=>wr==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:wr})=>wr==="PopupLoaded").then(wr=>{this.postMessage({requestId:wr.id,data:{version:version_1$1.LIB_VERSION}})}).then(()=>{if(!this.popup)throw error_1$1.standardErrors.rpc.internal();return this.popup})),this.url=new URL(br)}}Communicator$1.Communicator=Communicator;var method={};Object.defineProperty(method,"__esModule",{value:!0});method.determineMethodCategory=void 0;const mapping={handshake:["eth_requestAccounts"],sign:["eth_ecRecover","personal_sign","personal_ecRecover","eth_signTransaction","eth_sendTransaction","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","eth_signTypedData","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_watchAsset","wallet_getCapabilities","wallet_sendCalls","wallet_showCallsStatus"],state:["eth_chainId","eth_accounts","eth_coinbase","net_version"],deprecated:["eth_sign","eth_signTypedData_v2"],unsupported:["eth_subscribe","eth_unsubscribe"],fetch:[]};function determineMethodCategory(fr){for(const br in mapping){const wr=br;if(mapping[wr].includes(fr))return wr}}method.determineMethodCategory=determineMethodCategory;var __rest$2=commonjsGlobal&&commonjsGlobal.__rest||function(fr,br){var wr={};for(var Er in fr)Object.prototype.hasOwnProperty.call(fr,Er)&&br.indexOf(Er)<0&&(wr[Er]=fr[Er]);if(fr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var kr=0,Er=Object.getOwnPropertySymbols(fr);kr{try{if(this.connected)return this.emit("connect",{chainId:(0,util_1$1.hexStringFromIntNumber)((0,type_1.IntNumber)(this.chain.id))}),this.accounts;const Vr=await this.requestSignerSelection(),Zr=this.initSigner(Vr),Jr=await Zr.handshake();return this.signer=Zr,(0,util_2.storeSignerType)(Vr),this.emit("connect",{chainId:(0,util_1$1.hexStringFromIntNumber)((0,type_1.IntNumber)(this.chain.id))}),Jr}catch(Vr){throw this.handleUnauthorizedError(Vr),Vr}},sign:async Gr=>{if(!this.connected||!this.signer)throw error_1.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");try{return await this.signer.request(Gr)}catch(Vr){throw this.handleUnauthorizedError(Vr),Vr}},fetch:Gr=>(0,provider_1$1.fetchRPCRequest)(Gr,this.chain),state:Gr=>{const Vr=()=>{if(this.connected)return this.accounts;throw error_1.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")};switch(Gr.method){case"eth_chainId":return(0,util_1$1.hexStringFromIntNumber)((0,type_1.IntNumber)(this.chain.id));case"net_version":return this.chain.id;case"eth_accounts":return Vr();case"eth_coinbase":return Vr()[0];default:return this.handlers.unsupported(Gr)}},deprecated:({method:Gr})=>{throw error_1.standardErrors.rpc.methodNotSupported(`Method ${Gr} is deprecated.`)},unsupported:({method:Gr})=>{throw error_1.standardErrors.rpc.methodNotSupported(`Method ${Gr} is not supported.`)}},this.isCoinbaseWallet=!0,this.updateListener={onAccountsUpdate:({accounts:Gr,source:Vr})=>{(0,util_1$1.areAddressArraysEqual)(this.accounts,Gr)||(this.accounts=Gr,Vr!=="storage"&&this.emit("accountsChanged",this.accounts))},onChainUpdate:({chain:Gr,source:Vr})=>{Gr.id===this.chain.id&&Gr.rpcUrl===this.chain.rpcUrl||(this.chain=Gr,Vr!=="storage"&&this.emit("chainChanged",(0,util_1$1.hexStringFromIntNumber)((0,type_1.IntNumber)(Gr.id))))}},this.metadata=kr,this.preference=Wr,this.communicator=new Communicator_1.Communicator(Br),this.chain={id:(Er=(wr=kr.appChainIds)===null||wr===void 0?void 0:wr[0])!==null&&Er!==void 0?Er:1};const qr=(0,util_2.loadSignerType)();this.signer=qr?this.initSigner(qr):null}get connected(){return this.accounts.length>0}async request(br){var wr;try{const Er=(0,provider_1$1.checkErrorForInvalidRequestArgs)(br);if(Er)throw Er;const kr=(wr=(0,method_1.determineMethodCategory)(br.method))!==null&&wr!==void 0?wr:"fetch";return this.handlers[kr](br)}catch(Er){return Promise.reject((0,serialize_1$1.serializeError)(Er,br.method))}}handleUnauthorizedError(br){br.code===error_1.standardErrorCodes.provider.unauthorized&&this.disconnect()}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),await this.request({method:"eth_requestAccounts"})}async disconnect(){this.accounts=[],this.chain={id:1},ScopedLocalStorage_1$1.ScopedLocalStorage.clearAll(),this.emit("disconnect",error_1.standardErrors.provider.disconnected("User initiated disconnection"))}requestSignerSelection(){return(0,util_2.fetchSignerType)({communicator:this.communicator,preference:this.preference,metadata:this.metadata})}initSigner(br){return(0,util_2.createSigner)({signerType:br,metadata:this.metadata,communicator:this.communicator,updateListener:this.updateListener})}}CoinbaseWalletProvider$1.CoinbaseWalletProvider=CoinbaseWalletProvider;Object.defineProperty(CoinbaseWalletSDK$1,"__esModule",{value:!0});CoinbaseWalletSDK$1.CoinbaseWalletSDK=void 0;const wallet_logo_1=walletLogo$1,CoinbaseWalletProvider_1=CoinbaseWalletProvider$1,ScopedLocalStorage_1=ScopedLocalStorage$1,version_1=version$8,util_1=util$6,provider_1=provider;class CoinbaseWalletSDK{constructor(br){this.metadata={appName:br.appName||"Dapp",appLogoUrl:br.appLogoUrl||(0,util_1.getFavicon)(),appChainIds:br.appChainIds||[]},this.storeLatestVersion()}makeWeb3Provider(br={options:"all"}){var wr;const Er={metadata:this.metadata,preference:br};return(wr=(0,provider_1.getCoinbaseInjectedProvider)(Er))!==null&&wr!==void 0?wr:new CoinbaseWalletProvider_1.CoinbaseWalletProvider(Er)}getCoinbaseWalletLogo(br,wr=240){return(0,wallet_logo_1.walletLogo)(br,wr)}storeLatestVersion(){new ScopedLocalStorage_1.ScopedLocalStorage("CBWSDK").setItem("VERSION",version_1.LIB_VERSION)}}CoinbaseWalletSDK$1.CoinbaseWalletSDK=CoinbaseWalletSDK;(function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.CoinbaseWalletSDK=void 0;const br=CoinbaseWalletSDK$1;fr.default=br.CoinbaseWalletSDK;var wr=CoinbaseWalletSDK$1;Object.defineProperty(fr,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return wr.CoinbaseWalletSDK}})})(dist);let coinbaseProvider;const baseSepolia=84532,baseMainnet=8453,getCoinbaseProvider=({appLogoUrl:fr,appName:br,evmNetworks:wr,walletPreference:Er}={})=>{const kr=wr==null?void 0:wr.map(Wr=>Number(Wr.chainId));return(wr==null?void 0:wr.some(Wr=>Wr.chainId===baseSepolia))&&(kr==null||kr.sort((Wr,qr)=>Wr===baseSepolia?-1:qr===baseSepolia?1:0)),(wr==null?void 0:wr.some(Wr=>Wr.chainId===baseMainnet))&&(kr==null||kr.sort((Wr,qr)=>Wr===baseMainnet?-1:qr===baseMainnet?1:0)),coinbaseProvider||(coinbaseProvider=new dist.CoinbaseWalletSDK({appChainIds:kr,appLogoUrl:fr,appName:br}).makeWeb3Provider({options:Er??"all"})),coinbaseProvider};class Coinbase extends EthereumWalletConnector{constructor(br){var{appName:wr,appLogoUrl:Er,evmNetworks:kr,coinbaseWalletPreference:jr}=br,Br=__rest$6(br,["appName","appLogoUrl","evmNetworks","coinbaseWalletPreference"]);super(Object.assign({evmNetworks:kr},Br)),this.name="Coinbase",this.overrideKey="coinbase",this.supportedChains=["EVM","ETH"],this.connectedChain="EVM",this.canConnectViaQrCode=!1,this.canConnectViaCustodialService=!this.isInstalledOnBrowser(),this.coinbaseProviderOpts={appLogoUrl:Er,appName:wr,evmNetworks:kr,walletPreference:jr}}get coinbaseProvider(){return getCoinbaseProvider(this.coinbaseProviderOpts)}getConnectedAccounts(){return __awaiter$8(this,void 0,void 0,function*(){try{const br=yield this.coinbaseProvider.request({method:"eth_accounts"});return br[0]&&this.setActiveAccount(br[0]),br}catch{return[]}})}isInstalledOnBrowser(){var br;return!!(!((br=window==null?void 0:window.coinbaseWalletExtension)===null||br===void 0)&&br.isCoinbaseWallet)}getAddress(){return __awaiter$8(this,void 0,void 0,function*(){const[br]=yield this.coinbaseProvider.request({method:"eth_requestAccounts"});return this.setActiveAccount(br),br})}signMessage(br){return __awaiter$8(this,void 0,void 0,function*(){const[wr]=yield this.coinbaseProvider.request({method:"eth_requestAccounts"});try{return yield this.coinbaseProvider.request({method:"personal_sign",params:[toHex(toBytes$3(br)),wr.toLowerCase()]})}catch{return}})}setupEventListeners(){const{handleAccountChange:br,handleChainChange:wr,handleDisconnect:Er}=eventListenerHandlers(this);this.coinbaseProvider.on("accountsChanged",br),this.coinbaseProvider.on("chainChanged",wr),this.coinbaseProvider.on("disconnect",Er),this.teardownEventListeners=()=>{this.coinbaseProvider.removeListener("accountsChanged",br),this.coinbaseProvider.removeListener("chainChanged",wr),this.coinbaseProvider.removeListener("disconnect",Er)}}getWalletClient(br){return createWalletClient({account:this.getActiveAccount(),chain:br?chainsMap[br]:void 0,transport:custom(this.coinbaseProvider)})}}assertPackageVersion("@dynamic-labs/ethereum",version$9);const EthereumWalletConnectors=fr=>[...injectedWalletOverrides$1,...fetchInjectedWalletConnector(fr),...fetchWalletConnectWallets(fr),...TurnkeyEVMWalletConnectors(fr),Coinbase,UnknownInjected$1,FallbackEvmConnector,getWalletConnectConnector()];var version$7="3.8.2",version$6="3.8.2";function __awaiter$4(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;const U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(fr,br=!1){return br?{h:Number(fr&U32_MASK64),l:Number(fr>>_32n&U32_MASK64)}:{h:Number(fr>>_32n&U32_MASK64)|0,l:Number(fr&U32_MASK64)|0}}function split(fr,br=!1){let wr=new Uint32Array(fr.length),Er=new Uint32Array(fr.length);for(let kr=0;krBigInt(fr>>>0)<<_32n|BigInt(br>>>0),shrSH=(fr,br,wr)=>fr>>>wr,shrSL=(fr,br,wr)=>fr<<32-wr|br>>>wr,rotrSH=(fr,br,wr)=>fr>>>wr|br<<32-wr,rotrSL=(fr,br,wr)=>fr<<32-wr|br>>>wr,rotrBH=(fr,br,wr)=>fr<<64-wr|br>>>wr-32,rotrBL=(fr,br,wr)=>fr>>>wr-32|br<<64-wr,rotr32H=(fr,br)=>br,rotr32L=(fr,br)=>fr,rotlSH=(fr,br,wr)=>fr<>>32-wr,rotlSL=(fr,br,wr)=>br<>>32-wr,rotlBH=(fr,br,wr)=>br<>>64-wr,rotlBL=(fr,br,wr)=>fr<>>64-wr;function add(fr,br,wr,Er){const kr=(br>>>0)+(Er>>>0);return{h:fr+wr+(kr/2**32|0)|0,l:kr|0}}const add3L=(fr,br,wr)=>(fr>>>0)+(br>>>0)+(wr>>>0),add3H=(fr,br,wr,Er)=>br+wr+Er+(fr/2**32|0)|0,add4L=(fr,br,wr,Er)=>(fr>>>0)+(br>>>0)+(wr>>>0)+(Er>>>0),add4H=(fr,br,wr,Er,kr)=>br+wr+Er+kr+(fr/2**32|0)|0,add5L=(fr,br,wr,Er,kr)=>(fr>>>0)+(br>>>0)+(wr>>>0)+(Er>>>0)+(kr>>>0),add5H=(fr,br,wr,Er,kr,jr)=>br+wr+Er+kr+jr+(fr/2**32|0)|0,u64$4={fromBig,split,toBig,shrSH,shrSL,rotrSH,rotrSL,rotrBH,rotrBL,rotr32H,rotr32L,rotlSH,rotlSL,rotlBH,rotlBL,add,add3L,add3H,add4L,add4H,add5H,add5L},[SHA512_Kh,SHA512_Kl]=u64$4.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(fr=>BigInt(fr))),SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:br,Al:wr,Bh:Er,Bl:kr,Ch:jr,Cl:Br,Dh:Wr,Dl:qr,Eh:Gr,El:Vr,Fh:Zr,Fl:Jr,Gh:Qr,Gl:_n,Hh:En,Hl:Cn}=this;return[br,wr,Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En,Cn]}set(br,wr,Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En,Cn){this.Ah=br|0,this.Al=wr|0,this.Bh=Er|0,this.Bl=kr|0,this.Ch=jr|0,this.Cl=Br|0,this.Dh=Wr|0,this.Dl=qr|0,this.Eh=Gr|0,this.El=Vr|0,this.Fh=Zr|0,this.Fl=Jr|0,this.Gh=Qr|0,this.Gl=_n|0,this.Hh=En|0,this.Hl=Cn|0}process(br,wr){for(let jn=0;jn<16;jn++,wr+=4)SHA512_W_H[jn]=br.getUint32(wr),SHA512_W_L[jn]=br.getUint32(wr+=4);for(let jn=16;jn<80;jn++){const eo=SHA512_W_H[jn-15]|0,ro=SHA512_W_L[jn-15]|0,to=u64$4.rotrSH(eo,ro,1)^u64$4.rotrSH(eo,ro,8)^u64$4.shrSH(eo,ro,7),_i=u64$4.rotrSL(eo,ro,1)^u64$4.rotrSL(eo,ro,8)^u64$4.shrSL(eo,ro,7),oo=SHA512_W_H[jn-2]|0,io=SHA512_W_L[jn-2]|0,co=u64$4.rotrSH(oo,io,19)^u64$4.rotrBH(oo,io,61)^u64$4.shrSH(oo,io,6),so=u64$4.rotrSL(oo,io,19)^u64$4.rotrBL(oo,io,61)^u64$4.shrSL(oo,io,6),no=u64$4.add4L(_i,so,SHA512_W_L[jn-7],SHA512_W_L[jn-16]),Tn=u64$4.add4H(no,to,co,SHA512_W_H[jn-7],SHA512_W_H[jn-16]);SHA512_W_H[jn]=Tn|0,SHA512_W_L[jn]=no|0}let{Ah:Er,Al:kr,Bh:jr,Bl:Br,Ch:Wr,Cl:qr,Dh:Gr,Dl:Vr,Eh:Zr,El:Jr,Fh:Qr,Fl:_n,Gh:En,Gl:Cn,Hh:In,Hl:An}=this;for(let jn=0;jn<80;jn++){const eo=u64$4.rotrSH(Zr,Jr,14)^u64$4.rotrSH(Zr,Jr,18)^u64$4.rotrBH(Zr,Jr,41),ro=u64$4.rotrSL(Zr,Jr,14)^u64$4.rotrSL(Zr,Jr,18)^u64$4.rotrBL(Zr,Jr,41),to=Zr&Qr^~Zr&En,_i=Jr&_n^~Jr&Cn,oo=u64$4.add5L(An,ro,_i,SHA512_Kl[jn],SHA512_W_L[jn]),io=u64$4.add5H(oo,In,eo,to,SHA512_Kh[jn],SHA512_W_H[jn]),co=oo|0,so=u64$4.rotrSH(Er,kr,28)^u64$4.rotrBH(Er,kr,34)^u64$4.rotrBH(Er,kr,39),no=u64$4.rotrSL(Er,kr,28)^u64$4.rotrBL(Er,kr,34)^u64$4.rotrBL(Er,kr,39),Tn=Er&jr^Er&Wr^jr&Wr,Hr=kr&Br^kr&qr^Br&qr;In=En|0,An=Cn|0,En=Qr|0,Cn=_n|0,Qr=Zr|0,_n=Jr|0,{h:Zr,l:Jr}=u64$4.add(Gr|0,Vr|0,io|0,co|0),Gr=Wr|0,Vr=qr|0,Wr=jr|0,qr=Br|0,jr=Er|0,Br=kr|0;const Xr=u64$4.add3L(co,no,Hr);Er=u64$4.add3H(Xr,io,so,Tn),kr=Xr|0}({h:Er,l:kr}=u64$4.add(this.Ah|0,this.Al|0,Er|0,kr|0)),{h:jr,l:Br}=u64$4.add(this.Bh|0,this.Bl|0,jr|0,Br|0),{h:Wr,l:qr}=u64$4.add(this.Ch|0,this.Cl|0,Wr|0,qr|0),{h:Gr,l:Vr}=u64$4.add(this.Dh|0,this.Dl|0,Gr|0,Vr|0),{h:Zr,l:Jr}=u64$4.add(this.Eh|0,this.El|0,Zr|0,Jr|0),{h:Qr,l:_n}=u64$4.add(this.Fh|0,this.Fl|0,Qr|0,_n|0),{h:En,l:Cn}=u64$4.add(this.Gh|0,this.Gl|0,En|0,Cn|0),{h:In,l:An}=u64$4.add(this.Hh|0,this.Hl|0,In|0,An|0),this.set(Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En,Cn,In,An)}roundClean(){SHA512_W_H.fill(0),SHA512_W_L.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sha512=wrapConstructor(()=>new SHA512);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n=BigInt(0),_1n$1=BigInt(1),_2n$1=BigInt(2),_8n$1=BigInt(8),VERIFY_DEFAULT={zip215:!0};function validateOpts(fr){const br=validateBasic(fr);return validateObject(fr,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...br})}function twistedEdwards(fr){const br=validateOpts(fr),{Fp:wr,n:Er,prehash:kr,hash:jr,randomBytes:Br,nByteLength:Wr,h:qr}=br,Gr=_2n$1<{try{return{isValid:!0,value:wr.sqrt(Sn*wr.inv(Rn))}}catch{return{isValid:!1,value:_0n}}}),Qr=br.adjustScalarBytes||(Sn=>Sn),_n=br.domain||((Sn,Rn,Pn)=>{if(abool("phflag",Pn),Rn.length||Pn)throw new Error("Contexts/pre-hash are not supported");return Sn});function En(Sn,Rn){aInRange("coordinate "+Sn,Rn,_0n,Gr)}function Cn(Sn){if(!(Sn instanceof jn))throw new Error("ExtendedPoint expected")}const In=memoized((Sn,Rn)=>{const{ex:Pn,ey:On,ez:Zn}=Sn,Nn=Sn.is0();Rn==null&&(Rn=Nn?_8n$1:wr.inv(Zn));const wn=Vr(Pn*Rn),zn=Vr(On*Rn),fo=Vr(Zn*Rn);if(Nn)return{x:_0n,y:_1n$1};if(fo!==_1n$1)throw new Error("invZ was invalid");return{x:wn,y:zn}}),An=memoized(Sn=>{const{a:Rn,d:Pn}=br;if(Sn.is0())throw new Error("bad point: ZERO");const{ex:On,ey:Zn,ez:Nn,et:wn}=Sn,zn=Vr(On*On),fo=Vr(Zn*Zn),vo=Vr(Nn*Nn),go=Vr(vo*vo),uo=Vr(zn*Rn),lo=Vr(vo*Vr(uo+fo)),Eo=Vr(go+Vr(Pn*Vr(zn*fo)));if(lo!==Eo)throw new Error("bad point: equation left != right (1)");const mo=Vr(On*Zn),yo=Vr(Nn*wn);if(mo!==yo)throw new Error("bad point: equation left != right (2)");return!0});class jn{constructor(Rn,Pn,On,Zn){this.ex=Rn,this.ey=Pn,this.ez=On,this.et=Zn,En("x",Rn),En("y",Pn),En("z",On),En("t",Zn),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(Rn){if(Rn instanceof jn)throw new Error("extended point not allowed");const{x:Pn,y:On}=Rn||{};return En("x",Pn),En("y",On),new jn(Pn,On,_1n$1,Vr(Pn*On))}static normalizeZ(Rn){const Pn=wr.invertBatch(Rn.map(On=>On.ez));return Rn.map((On,Zn)=>On.toAffine(Pn[Zn])).map(jn.fromAffine)}static msm(Rn,Pn){return pippenger(jn,Zr,Rn,Pn)}_setWindowSize(Rn){to.setWindowSize(this,Rn)}assertValidity(){An(this)}equals(Rn){Cn(Rn);const{ex:Pn,ey:On,ez:Zn}=this,{ex:Nn,ey:wn,ez:zn}=Rn,fo=Vr(Pn*zn),vo=Vr(Nn*Zn),go=Vr(On*zn),uo=Vr(wn*Zn);return fo===vo&&go===uo}is0(){return this.equals(jn.ZERO)}negate(){return new jn(Vr(-this.ex),this.ey,this.ez,Vr(-this.et))}double(){const{a:Rn}=br,{ex:Pn,ey:On,ez:Zn}=this,Nn=Vr(Pn*Pn),wn=Vr(On*On),zn=Vr(_2n$1*Vr(Zn*Zn)),fo=Vr(Rn*Nn),vo=Pn+On,go=Vr(Vr(vo*vo)-Nn-wn),uo=fo+wn,lo=uo-zn,Eo=fo-wn,mo=Vr(go*lo),yo=Vr(uo*Eo),_o=Vr(go*Eo),Bo=Vr(lo*uo);return new jn(mo,yo,Bo,_o)}add(Rn){Cn(Rn);const{a:Pn,d:On}=br,{ex:Zn,ey:Nn,ez:wn,et:zn}=this,{ex:fo,ey:vo,ez:go,et:uo}=Rn;if(Pn===BigInt(-1)){const No=Vr((Nn-Zn)*(vo+fo)),Fo=Vr((Nn+Zn)*(vo-fo)),Nl=Vr(Fo-No);if(Nl===_0n)return this.double();const Vo=Vr(wn*_2n$1*uo),Uo=Vr(zn*_2n$1*go),Ml=Uo+Vo,$a=Fo+No,Jo=Uo-Vo,Zl=Vr(Ml*Nl),Cl=Vr($a*Jo),ko=Vr(Ml*Jo),wo=Vr(Nl*$a);return new jn(Zl,Cl,wo,ko)}const lo=Vr(Zn*fo),Eo=Vr(Nn*vo),mo=Vr(zn*On*uo),yo=Vr(wn*go),_o=Vr((Zn+Nn)*(fo+vo)-lo-Eo),Bo=yo-mo,Lo=yo+mo,Wo=Vr(Eo-Pn*lo),na=Vr(_o*Bo),qo=Vr(Lo*Wo),ga=Vr(_o*Wo),wl=Vr(Bo*Lo);return new jn(na,qo,wl,ga)}subtract(Rn){return this.add(Rn.negate())}wNAF(Rn){return to.wNAFCached(this,Rn,jn.normalizeZ)}multiply(Rn){const Pn=Rn;aInRange("scalar",Pn,_1n$1,Er);const{p:On,f:Zn}=this.wNAF(Pn);return jn.normalizeZ([On,Zn])[0]}multiplyUnsafe(Rn,Pn=jn.ZERO){const On=Rn;return aInRange("scalar",On,_0n,Er),On===_0n?ro:this.is0()||On===_1n$1?this:to.wNAFCachedUnsafe(this,On,jn.normalizeZ,Pn)}isSmallOrder(){return this.multiplyUnsafe(qr).is0()}isTorsionFree(){return to.unsafeLadder(this,Er).is0()}toAffine(Rn){return In(this,Rn)}clearCofactor(){const{h:Rn}=br;return Rn===_1n$1?this:this.multiplyUnsafe(Rn)}static fromHex(Rn,Pn=!1){const{d:On,a:Zn}=br,Nn=wr.BYTES;Rn=ensureBytes("pointHex",Rn,Nn),abool("zip215",Pn);const wn=Rn.slice(),zn=Rn[Nn-1];wn[Nn-1]=zn&-129;const fo=bytesToNumberLE(wn),vo=Pn?Gr:wr.ORDER;aInRange("pointHex.y",fo,_0n,vo);const go=Vr(fo*fo),uo=Vr(go-_1n$1),lo=Vr(On*go-Zn);let{isValid:Eo,value:mo}=Jr(uo,lo);if(!Eo)throw new Error("Point.fromHex: invalid y coordinate");const yo=(mo&_1n$1)===_1n$1,_o=(zn&128)!==0;if(!Pn&&mo===_0n&&_o)throw new Error("Point.fromHex: x=0 and x_0=1");return _o!==yo&&(mo=Vr(-mo)),jn.fromAffine({x:mo,y:fo})}static fromPrivateKey(Rn){return io(Rn).point}toRawBytes(){const{x:Rn,y:Pn}=this.toAffine(),On=numberToBytesLE(Pn,wr.BYTES);return On[On.length-1]|=Rn&_1n$1?128:0,On}toHex(){return bytesToHex(this.toRawBytes())}}jn.BASE=new jn(br.Gx,br.Gy,_1n$1,Vr(br.Gx*br.Gy)),jn.ZERO=new jn(_0n,_1n$1,_1n$1,_0n);const{BASE:eo,ZERO:ro}=jn,to=wNAF(jn,Wr*8);function _i(Sn){return mod(Sn,Er)}function oo(Sn){return _i(bytesToNumberLE(Sn))}function io(Sn){const Rn=wr.BYTES;Sn=ensureBytes("private key",Sn,Rn);const Pn=ensureBytes("hashed private key",jr(Sn),2*Rn),On=Qr(Pn.slice(0,Rn)),Zn=Pn.slice(Rn,2*Rn),Nn=oo(On),wn=eo.multiply(Nn),zn=wn.toRawBytes();return{head:On,prefix:Zn,scalar:Nn,point:wn,pointBytes:zn}}function co(Sn){return io(Sn).pointBytes}function so(Sn=new Uint8Array,...Rn){const Pn=concatBytes(...Rn);return oo(jr(_n(Pn,ensureBytes("context",Sn),!!kr)))}function no(Sn,Rn,Pn={}){Sn=ensureBytes("message",Sn),kr&&(Sn=kr(Sn));const{prefix:On,scalar:Zn,pointBytes:Nn}=io(Rn),wn=so(Pn.context,On,Sn),zn=eo.multiply(wn).toRawBytes(),fo=so(Pn.context,zn,Nn,Sn),vo=_i(wn+fo*Zn);aInRange("signature.s",vo,_0n,Er);const go=concatBytes(zn,numberToBytesLE(vo,wr.BYTES));return ensureBytes("result",go,wr.BYTES*2)}const Tn=VERIFY_DEFAULT;function Hr(Sn,Rn,Pn,On=Tn){const{context:Zn,zip215:Nn}=On,wn=wr.BYTES;Sn=ensureBytes("signature",Sn,2*wn),Rn=ensureBytes("message",Rn),Pn=ensureBytes("publicKey",Pn,wn),Nn!==void 0&&abool("zip215",Nn),kr&&(Rn=kr(Rn));const zn=bytesToNumberLE(Sn.slice(wn,2*wn));let fo,vo,go;try{fo=jn.fromHex(Pn,Nn),vo=jn.fromHex(Sn.slice(0,wn),Nn),go=eo.multiplyUnsafe(zn)}catch{return!1}if(!Nn&&fo.isSmallOrder())return!1;const uo=so(Zn,vo.toRawBytes(),fo.toRawBytes(),Rn);return vo.add(fo.multiplyUnsafe(uo)).subtract(go).clearCofactor().equals(jn.ZERO)}return eo._setWindowSize(8),{CURVE:br,getPublicKey:co,sign:no,verify:Hr,ExtendedPoint:jn,utils:{getExtendedPublicKey:io,randomPrivateKey:()=>Br(wr.BYTES),precompute(Sn=8,Rn=jn.BASE){return Rn._setWindowSize(Sn),Rn.multiply(BigInt(3)),Rn}}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ED25519_P=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ED25519_SQRT_M1=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const _1n=BigInt(1),_2n=BigInt(2);BigInt(3);const _5n=BigInt(5),_8n=BigInt(8);function ed25519_pow_2_252_3(fr){const br=BigInt(10),wr=BigInt(20),Er=BigInt(40),kr=BigInt(80),jr=ED25519_P,Wr=fr*fr%jr*fr%jr,qr=pow2(Wr,_2n,jr)*Wr%jr,Gr=pow2(qr,_1n,jr)*fr%jr,Vr=pow2(Gr,_5n,jr)*Gr%jr,Zr=pow2(Vr,br,jr)*Vr%jr,Jr=pow2(Zr,wr,jr)*Zr%jr,Qr=pow2(Jr,Er,jr)*Jr%jr,_n=pow2(Qr,kr,jr)*Qr%jr,En=pow2(_n,kr,jr)*Qr%jr,Cn=pow2(En,br,jr)*Vr%jr;return{pow_p_5_8:pow2(Cn,_2n,jr)*fr%jr,b2:Wr}}function adjustScalarBytes(fr){return fr[0]&=248,fr[31]&=127,fr[31]|=64,fr}function uvRatio(fr,br){const wr=ED25519_P,Er=mod(br*br*br,wr),kr=mod(Er*Er*br,wr),jr=ed25519_pow_2_252_3(fr*kr).pow_p_5_8;let Br=mod(fr*Er*jr,wr);const Wr=mod(br*Br*Br,wr),qr=Br,Gr=mod(Br*ED25519_SQRT_M1,wr),Vr=Wr===fr,Zr=Wr===mod(-fr,wr),Jr=Wr===mod(-fr*ED25519_SQRT_M1,wr);return Vr&&(Br=qr),(Zr||Jr)&&(Br=Gr),isNegativeLE(Br,wr)&&(Br=mod(-Br,wr)),{isValid:Vr||Zr,value:Br}}const Fp=Field(ED25519_P,void 0,!0),ed25519Defaults={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:_8n,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:sha512,randomBytes,adjustScalarBytes,uvRatio},ed25519=twistedEdwards(ed25519Defaults);var bn$3={exports:{}};bn$3.exports;(function(fr){(function(br,wr){function Er(Tn,Hr){if(!Tn)throw new Error(Hr||"Assertion failed")}function kr(Tn,Hr){Tn.super_=Hr;var Xr=function(){};Xr.prototype=Hr.prototype,Tn.prototype=new Xr,Tn.prototype.constructor=Tn}function jr(Tn,Hr,Xr){if(jr.isBN(Tn))return Tn;this.negative=0,this.words=null,this.length=0,this.red=null,Tn!==null&&((Hr==="le"||Hr==="be")&&(Xr=Hr,Hr=10),this._init(Tn||0,Hr||10,Xr||"be"))}typeof br=="object"?br.exports=jr:wr.BN=jr,jr.BN=jr,jr.wordSize=26;var Br;try{typeof window<"u"&&typeof window.Buffer<"u"?Br=window.Buffer:Br=require$$0$9.Buffer}catch{}jr.isBN=function(Hr){return Hr instanceof jr?!0:Hr!==null&&typeof Hr=="object"&&Hr.constructor.wordSize===jr.wordSize&&Array.isArray(Hr.words)},jr.max=function(Hr,Xr){return Hr.cmp(Xr)>0?Hr:Xr},jr.min=function(Hr,Xr){return Hr.cmp(Xr)<0?Hr:Xr},jr.prototype._init=function(Hr,Xr,Sn){if(typeof Hr=="number")return this._initNumber(Hr,Xr,Sn);if(typeof Hr=="object")return this._initArray(Hr,Xr,Sn);Xr==="hex"&&(Xr=16),Er(Xr===(Xr|0)&&Xr>=2&&Xr<=36),Hr=Hr.toString().replace(/\s+/g,"");var Rn=0;Hr[0]==="-"&&(Rn++,this.negative=1),Rn=0;Rn-=3)On=Hr[Rn]|Hr[Rn-1]<<8|Hr[Rn-2]<<16,this.words[Pn]|=On<>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);else if(Sn==="le")for(Rn=0,Pn=0;Rn>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);return this._strip()};function Wr(Tn,Hr){var Xr=Tn.charCodeAt(Hr);if(Xr>=48&&Xr<=57)return Xr-48;if(Xr>=65&&Xr<=70)return Xr-55;if(Xr>=97&&Xr<=102)return Xr-87;Er(!1,"Invalid character in "+Tn)}function qr(Tn,Hr,Xr){var Sn=Wr(Tn,Xr);return Xr-1>=Hr&&(Sn|=Wr(Tn,Xr-1)<<4),Sn}jr.prototype._parseHex=function(Hr,Xr,Sn){this.length=Math.ceil((Hr.length-Xr)/6),this.words=new Array(this.length);for(var Rn=0;Rn=Xr;Rn-=2)Zn=qr(Hr,Xr,Rn)<=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8;else{var Nn=Hr.length-Xr;for(Rn=Nn%2===0?Xr+1:Xr;Rn=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8}this._strip()};function Gr(Tn,Hr,Xr,Sn){for(var Rn=0,Pn=0,On=Math.min(Tn.length,Xr),Zn=Hr;Zn=49?Pn=Nn-49+10:Nn>=17?Pn=Nn-17+10:Pn=Nn,Er(Nn>=0&&Pn1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},jr.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{jr.prototype[Symbol.for("nodejs.util.inspect.custom")]=Zr}catch{jr.prototype.inspect=Zr}else jr.prototype.inspect=Zr;function Zr(){return(this.red?""}var Jr=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Qr=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_n=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];jr.prototype.toString=function(Hr,Xr){Hr=Hr||10,Xr=Xr|0||1;var Sn;if(Hr===16||Hr==="hex"){Sn="";for(var Rn=0,Pn=0,On=0;On>>24-Rn&16777215,Rn+=2,Rn>=26&&(Rn-=26,On--),Pn!==0||On!==this.length-1?Sn=Jr[6-Nn.length]+Nn+Sn:Sn=Nn+Sn}for(Pn!==0&&(Sn=Pn.toString(16)+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}if(Hr===(Hr|0)&&Hr>=2&&Hr<=36){var wn=Qr[Hr],zn=_n[Hr];Sn="";var fo=this.clone();for(fo.negative=0;!fo.isZero();){var vo=fo.modrn(zn).toString(Hr);fo=fo.idivn(zn),fo.isZero()?Sn=vo+Sn:Sn=Jr[wn-vo.length]+vo+Sn}for(this.isZero()&&(Sn="0"+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}Er(!1,"Base should be between 2 and 36")},jr.prototype.toNumber=function(){var Hr=this.words[0];return this.length===2?Hr+=this.words[1]*67108864:this.length===3&&this.words[2]===1?Hr+=4503599627370496+this.words[1]*67108864:this.length>2&&Er(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-Hr:Hr},jr.prototype.toJSON=function(){return this.toString(16,2)},Br&&(jr.prototype.toBuffer=function(Hr,Xr){return this.toArrayLike(Br,Hr,Xr)}),jr.prototype.toArray=function(Hr,Xr){return this.toArrayLike(Array,Hr,Xr)};var En=function(Hr,Xr){return Hr.allocUnsafe?Hr.allocUnsafe(Xr):new Hr(Xr)};jr.prototype.toArrayLike=function(Hr,Xr,Sn){this._strip();var Rn=this.byteLength(),Pn=Sn||Math.max(1,Rn);Er(Rn<=Pn,"byte array longer than desired length"),Er(Pn>0,"Requested array length <= 0");var On=En(Hr,Pn),Zn=Xr==="le"?"LE":"BE";return this["_toArrayLike"+Zn](On,Rn),On},jr.prototype._toArrayLikeLE=function(Hr,Xr){for(var Sn=0,Rn=0,Pn=0,On=0;Pn>8&255),Sn>16&255),On===6?(Sn>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn=0&&(Hr[Sn--]=Zn>>8&255),Sn>=0&&(Hr[Sn--]=Zn>>16&255),On===6?(Sn>=0&&(Hr[Sn--]=Zn>>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn>=0)for(Hr[Sn--]=Rn;Sn>=0;)Hr[Sn--]=0},Math.clz32?jr.prototype._countBits=function(Hr){return 32-Math.clz32(Hr)}:jr.prototype._countBits=function(Hr){var Xr=Hr,Sn=0;return Xr>=4096&&(Sn+=13,Xr>>>=13),Xr>=64&&(Sn+=7,Xr>>>=7),Xr>=8&&(Sn+=4,Xr>>>=4),Xr>=2&&(Sn+=2,Xr>>>=2),Sn+Xr},jr.prototype._zeroBits=function(Hr){if(Hr===0)return 26;var Xr=Hr,Sn=0;return Xr&8191||(Sn+=13,Xr>>>=13),Xr&127||(Sn+=7,Xr>>>=7),Xr&15||(Sn+=4,Xr>>>=4),Xr&3||(Sn+=2,Xr>>>=2),Xr&1||Sn++,Sn},jr.prototype.bitLength=function(){var Hr=this.words[this.length-1],Xr=this._countBits(Hr);return(this.length-1)*26+Xr};function Cn(Tn){for(var Hr=new Array(Tn.bitLength()),Xr=0;Xr>>Rn&1}return Hr}jr.prototype.zeroBits=function(){if(this.isZero())return 0;for(var Hr=0,Xr=0;XrHr.length?this.clone().ior(Hr):Hr.clone().ior(this)},jr.prototype.uor=function(Hr){return this.length>Hr.length?this.clone().iuor(Hr):Hr.clone().iuor(this)},jr.prototype.iuand=function(Hr){var Xr;this.length>Hr.length?Xr=Hr:Xr=this;for(var Sn=0;SnHr.length?this.clone().iand(Hr):Hr.clone().iand(this)},jr.prototype.uand=function(Hr){return this.length>Hr.length?this.clone().iuand(Hr):Hr.clone().iuand(this)},jr.prototype.iuxor=function(Hr){var Xr,Sn;this.length>Hr.length?(Xr=this,Sn=Hr):(Xr=Hr,Sn=this);for(var Rn=0;RnHr.length?this.clone().ixor(Hr):Hr.clone().ixor(this)},jr.prototype.uxor=function(Hr){return this.length>Hr.length?this.clone().iuxor(Hr):Hr.clone().iuxor(this)},jr.prototype.inotn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Math.ceil(Hr/26)|0,Sn=Hr%26;this._expand(Xr),Sn>0&&Xr--;for(var Rn=0;Rn0&&(this.words[Rn]=~this.words[Rn]&67108863>>26-Sn),this._strip()},jr.prototype.notn=function(Hr){return this.clone().inotn(Hr)},jr.prototype.setn=function(Hr,Xr){Er(typeof Hr=="number"&&Hr>=0);var Sn=Hr/26|0,Rn=Hr%26;return this._expand(Sn+1),Xr?this.words[Sn]=this.words[Sn]|1<Hr.length?(Sn=this,Rn=Hr):(Sn=Hr,Rn=this);for(var Pn=0,On=0;On>>26;for(;Pn!==0&&On>>26;if(this.length=Sn.length,Pn!==0)this.words[this.length]=Pn,this.length++;else if(Sn!==this)for(;OnHr.length?this.clone().iadd(Hr):Hr.clone().iadd(this)},jr.prototype.isub=function(Hr){if(Hr.negative!==0){Hr.negative=0;var Xr=this.iadd(Hr);return Hr.negative=1,Xr._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Hr),this.negative=1,this._normSign();var Sn=this.cmp(Hr);if(Sn===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Rn,Pn;Sn>0?(Rn=this,Pn=Hr):(Rn=Hr,Pn=this);for(var On=0,Zn=0;Zn>26,this.words[Zn]=Xr&67108863;for(;On!==0&&Zn>26,this.words[Zn]=Xr&67108863;if(On===0&&Zn>>26,fo=Nn&67108863,vo=Math.min(wn,Hr.length-1),go=Math.max(0,wn-Tn.length+1);go<=vo;go++){var uo=wn-go|0;Rn=Tn.words[uo]|0,Pn=Hr.words[go]|0,On=Rn*Pn+fo,zn+=On/67108864|0,fo=On&67108863}Xr.words[wn]=fo|0,Nn=zn|0}return Nn!==0?Xr.words[wn]=Nn|0:Xr.length--,Xr._strip()}var An=function(Hr,Xr,Sn){var Rn=Hr.words,Pn=Xr.words,On=Sn.words,Zn=0,Nn,wn,zn,fo=Rn[0]|0,vo=fo&8191,go=fo>>>13,uo=Rn[1]|0,lo=uo&8191,Eo=uo>>>13,mo=Rn[2]|0,yo=mo&8191,_o=mo>>>13,Bo=Rn[3]|0,Lo=Bo&8191,Wo=Bo>>>13,na=Rn[4]|0,qo=na&8191,ga=na>>>13,wl=Rn[5]|0,No=wl&8191,Fo=wl>>>13,Nl=Rn[6]|0,Vo=Nl&8191,Uo=Nl>>>13,Ml=Rn[7]|0,$a=Ml&8191,Jo=Ml>>>13,Zl=Rn[8]|0,Cl=Zl&8191,ko=Zl>>>13,wo=Rn[9]|0,bo=wo&8191,Io=wo>>>13,Ho=Pn[0]|0,Do=Ho&8191,zo=Ho>>>13,nu=Pn[1]|0,Ll=nu&8191,_l=nu>>>13,bu=Pn[2]|0,xl=bu&8191,Tl=bu>>>13,du=Pn[3]|0,Bl=du&8191,Il=du>>>13,Eu=Pn[4]|0,Al=Eu&8191,Ol=Eu>>>13,Tu=Pn[5]|0,Ul=Tu&8191,Sl=Tu>>>13,_u=Pn[6]|0,So=_u&8191,Co=_u>>>13,Ao=Pn[7]|0,po=Ao&8191,Ro=Ao>>>13,Xo=Pn[8]|0,jo=Xo&8191,Ko=Xo>>>13,Wl=Pn[9]|0,$l=Wl&8191,El=Wl>>>13;Sn.negative=Hr.negative^Xr.negative,Sn.length=19,Nn=Math.imul(vo,Do),wn=Math.imul(vo,zo),wn=wn+Math.imul(go,Do)|0,zn=Math.imul(go,zo);var Cu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,Nn=Math.imul(lo,Do),wn=Math.imul(lo,zo),wn=wn+Math.imul(Eo,Do)|0,zn=Math.imul(Eo,zo),Nn=Nn+Math.imul(vo,Ll)|0,wn=wn+Math.imul(vo,_l)|0,wn=wn+Math.imul(go,Ll)|0,zn=zn+Math.imul(go,_l)|0;var iu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(iu>>>26)|0,iu&=67108863,Nn=Math.imul(yo,Do),wn=Math.imul(yo,zo),wn=wn+Math.imul(_o,Do)|0,zn=Math.imul(_o,zo),Nn=Nn+Math.imul(lo,Ll)|0,wn=wn+Math.imul(lo,_l)|0,wn=wn+Math.imul(Eo,Ll)|0,zn=zn+Math.imul(Eo,_l)|0,Nn=Nn+Math.imul(vo,xl)|0,wn=wn+Math.imul(vo,Tl)|0,wn=wn+Math.imul(go,xl)|0,zn=zn+Math.imul(go,Tl)|0;var pu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(pu>>>26)|0,pu&=67108863,Nn=Math.imul(Lo,Do),wn=Math.imul(Lo,zo),wn=wn+Math.imul(Wo,Do)|0,zn=Math.imul(Wo,zo),Nn=Nn+Math.imul(yo,Ll)|0,wn=wn+Math.imul(yo,_l)|0,wn=wn+Math.imul(_o,Ll)|0,zn=zn+Math.imul(_o,_l)|0,Nn=Nn+Math.imul(lo,xl)|0,wn=wn+Math.imul(lo,Tl)|0,wn=wn+Math.imul(Eo,xl)|0,zn=zn+Math.imul(Eo,Tl)|0,Nn=Nn+Math.imul(vo,Bl)|0,wn=wn+Math.imul(vo,Il)|0,wn=wn+Math.imul(go,Bl)|0,zn=zn+Math.imul(go,Il)|0;var yu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(yu>>>26)|0,yu&=67108863,Nn=Math.imul(qo,Do),wn=Math.imul(qo,zo),wn=wn+Math.imul(ga,Do)|0,zn=Math.imul(ga,zo),Nn=Nn+Math.imul(Lo,Ll)|0,wn=wn+Math.imul(Lo,_l)|0,wn=wn+Math.imul(Wo,Ll)|0,zn=zn+Math.imul(Wo,_l)|0,Nn=Nn+Math.imul(yo,xl)|0,wn=wn+Math.imul(yo,Tl)|0,wn=wn+Math.imul(_o,xl)|0,zn=zn+Math.imul(_o,Tl)|0,Nn=Nn+Math.imul(lo,Bl)|0,wn=wn+Math.imul(lo,Il)|0,wn=wn+Math.imul(Eo,Bl)|0,zn=zn+Math.imul(Eo,Il)|0,Nn=Nn+Math.imul(vo,Al)|0,wn=wn+Math.imul(vo,Ol)|0,wn=wn+Math.imul(go,Al)|0,zn=zn+Math.imul(go,Ol)|0;var hu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(hu>>>26)|0,hu&=67108863,Nn=Math.imul(No,Do),wn=Math.imul(No,zo),wn=wn+Math.imul(Fo,Do)|0,zn=Math.imul(Fo,zo),Nn=Nn+Math.imul(qo,Ll)|0,wn=wn+Math.imul(qo,_l)|0,wn=wn+Math.imul(ga,Ll)|0,zn=zn+Math.imul(ga,_l)|0,Nn=Nn+Math.imul(Lo,xl)|0,wn=wn+Math.imul(Lo,Tl)|0,wn=wn+Math.imul(Wo,xl)|0,zn=zn+Math.imul(Wo,Tl)|0,Nn=Nn+Math.imul(yo,Bl)|0,wn=wn+Math.imul(yo,Il)|0,wn=wn+Math.imul(_o,Bl)|0,zn=zn+Math.imul(_o,Il)|0,Nn=Nn+Math.imul(lo,Al)|0,wn=wn+Math.imul(lo,Ol)|0,wn=wn+Math.imul(Eo,Al)|0,zn=zn+Math.imul(Eo,Ol)|0,Nn=Nn+Math.imul(vo,Ul)|0,wn=wn+Math.imul(vo,Sl)|0,wn=wn+Math.imul(go,Ul)|0,zn=zn+Math.imul(go,Sl)|0;var mu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(mu>>>26)|0,mu&=67108863,Nn=Math.imul(Vo,Do),wn=Math.imul(Vo,zo),wn=wn+Math.imul(Uo,Do)|0,zn=Math.imul(Uo,zo),Nn=Nn+Math.imul(No,Ll)|0,wn=wn+Math.imul(No,_l)|0,wn=wn+Math.imul(Fo,Ll)|0,zn=zn+Math.imul(Fo,_l)|0,Nn=Nn+Math.imul(qo,xl)|0,wn=wn+Math.imul(qo,Tl)|0,wn=wn+Math.imul(ga,xl)|0,zn=zn+Math.imul(ga,Tl)|0,Nn=Nn+Math.imul(Lo,Bl)|0,wn=wn+Math.imul(Lo,Il)|0,wn=wn+Math.imul(Wo,Bl)|0,zn=zn+Math.imul(Wo,Il)|0,Nn=Nn+Math.imul(yo,Al)|0,wn=wn+Math.imul(yo,Ol)|0,wn=wn+Math.imul(_o,Al)|0,zn=zn+Math.imul(_o,Ol)|0,Nn=Nn+Math.imul(lo,Ul)|0,wn=wn+Math.imul(lo,Sl)|0,wn=wn+Math.imul(Eo,Ul)|0,zn=zn+Math.imul(Eo,Sl)|0,Nn=Nn+Math.imul(vo,So)|0,wn=wn+Math.imul(vo,Co)|0,wn=wn+Math.imul(go,So)|0,zn=zn+Math.imul(go,Co)|0;var vu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(vu>>>26)|0,vu&=67108863,Nn=Math.imul($a,Do),wn=Math.imul($a,zo),wn=wn+Math.imul(Jo,Do)|0,zn=Math.imul(Jo,zo),Nn=Nn+Math.imul(Vo,Ll)|0,wn=wn+Math.imul(Vo,_l)|0,wn=wn+Math.imul(Uo,Ll)|0,zn=zn+Math.imul(Uo,_l)|0,Nn=Nn+Math.imul(No,xl)|0,wn=wn+Math.imul(No,Tl)|0,wn=wn+Math.imul(Fo,xl)|0,zn=zn+Math.imul(Fo,Tl)|0,Nn=Nn+Math.imul(qo,Bl)|0,wn=wn+Math.imul(qo,Il)|0,wn=wn+Math.imul(ga,Bl)|0,zn=zn+Math.imul(ga,Il)|0,Nn=Nn+Math.imul(Lo,Al)|0,wn=wn+Math.imul(Lo,Ol)|0,wn=wn+Math.imul(Wo,Al)|0,zn=zn+Math.imul(Wo,Ol)|0,Nn=Nn+Math.imul(yo,Ul)|0,wn=wn+Math.imul(yo,Sl)|0,wn=wn+Math.imul(_o,Ul)|0,zn=zn+Math.imul(_o,Sl)|0,Nn=Nn+Math.imul(lo,So)|0,wn=wn+Math.imul(lo,Co)|0,wn=wn+Math.imul(Eo,So)|0,zn=zn+Math.imul(Eo,Co)|0,Nn=Nn+Math.imul(vo,po)|0,wn=wn+Math.imul(vo,Ro)|0,wn=wn+Math.imul(go,po)|0,zn=zn+Math.imul(go,Ro)|0;var fu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(fu>>>26)|0,fu&=67108863,Nn=Math.imul(Cl,Do),wn=Math.imul(Cl,zo),wn=wn+Math.imul(ko,Do)|0,zn=Math.imul(ko,zo),Nn=Nn+Math.imul($a,Ll)|0,wn=wn+Math.imul($a,_l)|0,wn=wn+Math.imul(Jo,Ll)|0,zn=zn+Math.imul(Jo,_l)|0,Nn=Nn+Math.imul(Vo,xl)|0,wn=wn+Math.imul(Vo,Tl)|0,wn=wn+Math.imul(Uo,xl)|0,zn=zn+Math.imul(Uo,Tl)|0,Nn=Nn+Math.imul(No,Bl)|0,wn=wn+Math.imul(No,Il)|0,wn=wn+Math.imul(Fo,Bl)|0,zn=zn+Math.imul(Fo,Il)|0,Nn=Nn+Math.imul(qo,Al)|0,wn=wn+Math.imul(qo,Ol)|0,wn=wn+Math.imul(ga,Al)|0,zn=zn+Math.imul(ga,Ol)|0,Nn=Nn+Math.imul(Lo,Ul)|0,wn=wn+Math.imul(Lo,Sl)|0,wn=wn+Math.imul(Wo,Ul)|0,zn=zn+Math.imul(Wo,Sl)|0,Nn=Nn+Math.imul(yo,So)|0,wn=wn+Math.imul(yo,Co)|0,wn=wn+Math.imul(_o,So)|0,zn=zn+Math.imul(_o,Co)|0,Nn=Nn+Math.imul(lo,po)|0,wn=wn+Math.imul(lo,Ro)|0,wn=wn+Math.imul(Eo,po)|0,zn=zn+Math.imul(Eo,Ro)|0,Nn=Nn+Math.imul(vo,jo)|0,wn=wn+Math.imul(vo,Ko)|0,wn=wn+Math.imul(go,jo)|0,zn=zn+Math.imul(go,Ko)|0;var gu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(gu>>>26)|0,gu&=67108863,Nn=Math.imul(bo,Do),wn=Math.imul(bo,zo),wn=wn+Math.imul(Io,Do)|0,zn=Math.imul(Io,zo),Nn=Nn+Math.imul(Cl,Ll)|0,wn=wn+Math.imul(Cl,_l)|0,wn=wn+Math.imul(ko,Ll)|0,zn=zn+Math.imul(ko,_l)|0,Nn=Nn+Math.imul($a,xl)|0,wn=wn+Math.imul($a,Tl)|0,wn=wn+Math.imul(Jo,xl)|0,zn=zn+Math.imul(Jo,Tl)|0,Nn=Nn+Math.imul(Vo,Bl)|0,wn=wn+Math.imul(Vo,Il)|0,wn=wn+Math.imul(Uo,Bl)|0,zn=zn+Math.imul(Uo,Il)|0,Nn=Nn+Math.imul(No,Al)|0,wn=wn+Math.imul(No,Ol)|0,wn=wn+Math.imul(Fo,Al)|0,zn=zn+Math.imul(Fo,Ol)|0,Nn=Nn+Math.imul(qo,Ul)|0,wn=wn+Math.imul(qo,Sl)|0,wn=wn+Math.imul(ga,Ul)|0,zn=zn+Math.imul(ga,Sl)|0,Nn=Nn+Math.imul(Lo,So)|0,wn=wn+Math.imul(Lo,Co)|0,wn=wn+Math.imul(Wo,So)|0,zn=zn+Math.imul(Wo,Co)|0,Nn=Nn+Math.imul(yo,po)|0,wn=wn+Math.imul(yo,Ro)|0,wn=wn+Math.imul(_o,po)|0,zn=zn+Math.imul(_o,Ro)|0,Nn=Nn+Math.imul(lo,jo)|0,wn=wn+Math.imul(lo,Ko)|0,wn=wn+Math.imul(Eo,jo)|0,zn=zn+Math.imul(Eo,Ko)|0,Nn=Nn+Math.imul(vo,$l)|0,wn=wn+Math.imul(vo,El)|0,wn=wn+Math.imul(go,$l)|0,zn=zn+Math.imul(go,El)|0;var ou=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(ou>>>26)|0,ou&=67108863,Nn=Math.imul(bo,Ll),wn=Math.imul(bo,_l),wn=wn+Math.imul(Io,Ll)|0,zn=Math.imul(Io,_l),Nn=Nn+Math.imul(Cl,xl)|0,wn=wn+Math.imul(Cl,Tl)|0,wn=wn+Math.imul(ko,xl)|0,zn=zn+Math.imul(ko,Tl)|0,Nn=Nn+Math.imul($a,Bl)|0,wn=wn+Math.imul($a,Il)|0,wn=wn+Math.imul(Jo,Bl)|0,zn=zn+Math.imul(Jo,Il)|0,Nn=Nn+Math.imul(Vo,Al)|0,wn=wn+Math.imul(Vo,Ol)|0,wn=wn+Math.imul(Uo,Al)|0,zn=zn+Math.imul(Uo,Ol)|0,Nn=Nn+Math.imul(No,Ul)|0,wn=wn+Math.imul(No,Sl)|0,wn=wn+Math.imul(Fo,Ul)|0,zn=zn+Math.imul(Fo,Sl)|0,Nn=Nn+Math.imul(qo,So)|0,wn=wn+Math.imul(qo,Co)|0,wn=wn+Math.imul(ga,So)|0,zn=zn+Math.imul(ga,Co)|0,Nn=Nn+Math.imul(Lo,po)|0,wn=wn+Math.imul(Lo,Ro)|0,wn=wn+Math.imul(Wo,po)|0,zn=zn+Math.imul(Wo,Ro)|0,Nn=Nn+Math.imul(yo,jo)|0,wn=wn+Math.imul(yo,Ko)|0,wn=wn+Math.imul(_o,jo)|0,zn=zn+Math.imul(_o,Ko)|0,Nn=Nn+Math.imul(lo,$l)|0,wn=wn+Math.imul(lo,El)|0,wn=wn+Math.imul(Eo,$l)|0,zn=zn+Math.imul(Eo,El)|0;var su=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(su>>>26)|0,su&=67108863,Nn=Math.imul(bo,xl),wn=Math.imul(bo,Tl),wn=wn+Math.imul(Io,xl)|0,zn=Math.imul(Io,Tl),Nn=Nn+Math.imul(Cl,Bl)|0,wn=wn+Math.imul(Cl,Il)|0,wn=wn+Math.imul(ko,Bl)|0,zn=zn+Math.imul(ko,Il)|0,Nn=Nn+Math.imul($a,Al)|0,wn=wn+Math.imul($a,Ol)|0,wn=wn+Math.imul(Jo,Al)|0,zn=zn+Math.imul(Jo,Ol)|0,Nn=Nn+Math.imul(Vo,Ul)|0,wn=wn+Math.imul(Vo,Sl)|0,wn=wn+Math.imul(Uo,Ul)|0,zn=zn+Math.imul(Uo,Sl)|0,Nn=Nn+Math.imul(No,So)|0,wn=wn+Math.imul(No,Co)|0,wn=wn+Math.imul(Fo,So)|0,zn=zn+Math.imul(Fo,Co)|0,Nn=Nn+Math.imul(qo,po)|0,wn=wn+Math.imul(qo,Ro)|0,wn=wn+Math.imul(ga,po)|0,zn=zn+Math.imul(ga,Ro)|0,Nn=Nn+Math.imul(Lo,jo)|0,wn=wn+Math.imul(Lo,Ko)|0,wn=wn+Math.imul(Wo,jo)|0,zn=zn+Math.imul(Wo,Ko)|0,Nn=Nn+Math.imul(yo,$l)|0,wn=wn+Math.imul(yo,El)|0,wn=wn+Math.imul(_o,$l)|0,zn=zn+Math.imul(_o,El)|0;var tu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(tu>>>26)|0,tu&=67108863,Nn=Math.imul(bo,Bl),wn=Math.imul(bo,Il),wn=wn+Math.imul(Io,Bl)|0,zn=Math.imul(Io,Il),Nn=Nn+Math.imul(Cl,Al)|0,wn=wn+Math.imul(Cl,Ol)|0,wn=wn+Math.imul(ko,Al)|0,zn=zn+Math.imul(ko,Ol)|0,Nn=Nn+Math.imul($a,Ul)|0,wn=wn+Math.imul($a,Sl)|0,wn=wn+Math.imul(Jo,Ul)|0,zn=zn+Math.imul(Jo,Sl)|0,Nn=Nn+Math.imul(Vo,So)|0,wn=wn+Math.imul(Vo,Co)|0,wn=wn+Math.imul(Uo,So)|0,zn=zn+Math.imul(Uo,Co)|0,Nn=Nn+Math.imul(No,po)|0,wn=wn+Math.imul(No,Ro)|0,wn=wn+Math.imul(Fo,po)|0,zn=zn+Math.imul(Fo,Ro)|0,Nn=Nn+Math.imul(qo,jo)|0,wn=wn+Math.imul(qo,Ko)|0,wn=wn+Math.imul(ga,jo)|0,zn=zn+Math.imul(ga,Ko)|0,Nn=Nn+Math.imul(Lo,$l)|0,wn=wn+Math.imul(Lo,El)|0,wn=wn+Math.imul(Wo,$l)|0,zn=zn+Math.imul(Wo,El)|0;var zl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(zl>>>26)|0,zl&=67108863,Nn=Math.imul(bo,Al),wn=Math.imul(bo,Ol),wn=wn+Math.imul(Io,Al)|0,zn=Math.imul(Io,Ol),Nn=Nn+Math.imul(Cl,Ul)|0,wn=wn+Math.imul(Cl,Sl)|0,wn=wn+Math.imul(ko,Ul)|0,zn=zn+Math.imul(ko,Sl)|0,Nn=Nn+Math.imul($a,So)|0,wn=wn+Math.imul($a,Co)|0,wn=wn+Math.imul(Jo,So)|0,zn=zn+Math.imul(Jo,Co)|0,Nn=Nn+Math.imul(Vo,po)|0,wn=wn+Math.imul(Vo,Ro)|0,wn=wn+Math.imul(Uo,po)|0,zn=zn+Math.imul(Uo,Ro)|0,Nn=Nn+Math.imul(No,jo)|0,wn=wn+Math.imul(No,Ko)|0,wn=wn+Math.imul(Fo,jo)|0,zn=zn+Math.imul(Fo,Ko)|0,Nn=Nn+Math.imul(qo,$l)|0,wn=wn+Math.imul(qo,El)|0,wn=wn+Math.imul(ga,$l)|0,zn=zn+Math.imul(ga,El)|0;var Gl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Gl>>>26)|0,Gl&=67108863,Nn=Math.imul(bo,Ul),wn=Math.imul(bo,Sl),wn=wn+Math.imul(Io,Ul)|0,zn=Math.imul(Io,Sl),Nn=Nn+Math.imul(Cl,So)|0,wn=wn+Math.imul(Cl,Co)|0,wn=wn+Math.imul(ko,So)|0,zn=zn+Math.imul(ko,Co)|0,Nn=Nn+Math.imul($a,po)|0,wn=wn+Math.imul($a,Ro)|0,wn=wn+Math.imul(Jo,po)|0,zn=zn+Math.imul(Jo,Ro)|0,Nn=Nn+Math.imul(Vo,jo)|0,wn=wn+Math.imul(Vo,Ko)|0,wn=wn+Math.imul(Uo,jo)|0,zn=zn+Math.imul(Uo,Ko)|0,Nn=Nn+Math.imul(No,$l)|0,wn=wn+Math.imul(No,El)|0,wn=wn+Math.imul(Fo,$l)|0,zn=zn+Math.imul(Fo,El)|0;var Jl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Jl>>>26)|0,Jl&=67108863,Nn=Math.imul(bo,So),wn=Math.imul(bo,Co),wn=wn+Math.imul(Io,So)|0,zn=Math.imul(Io,Co),Nn=Nn+Math.imul(Cl,po)|0,wn=wn+Math.imul(Cl,Ro)|0,wn=wn+Math.imul(ko,po)|0,zn=zn+Math.imul(ko,Ro)|0,Nn=Nn+Math.imul($a,jo)|0,wn=wn+Math.imul($a,Ko)|0,wn=wn+Math.imul(Jo,jo)|0,zn=zn+Math.imul(Jo,Ko)|0,Nn=Nn+Math.imul(Vo,$l)|0,wn=wn+Math.imul(Vo,El)|0,wn=wn+Math.imul(Uo,$l)|0,zn=zn+Math.imul(Uo,El)|0;var Pl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Pl>>>26)|0,Pl&=67108863,Nn=Math.imul(bo,po),wn=Math.imul(bo,Ro),wn=wn+Math.imul(Io,po)|0,zn=Math.imul(Io,Ro),Nn=Nn+Math.imul(Cl,jo)|0,wn=wn+Math.imul(Cl,Ko)|0,wn=wn+Math.imul(ko,jo)|0,zn=zn+Math.imul(ko,Ko)|0,Nn=Nn+Math.imul($a,$l)|0,wn=wn+Math.imul($a,El)|0,wn=wn+Math.imul(Jo,$l)|0,zn=zn+Math.imul(Jo,El)|0;var Fl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Fl>>>26)|0,Fl&=67108863,Nn=Math.imul(bo,jo),wn=Math.imul(bo,Ko),wn=wn+Math.imul(Io,jo)|0,zn=Math.imul(Io,Ko),Nn=Nn+Math.imul(Cl,$l)|0,wn=wn+Math.imul(Cl,El)|0,wn=wn+Math.imul(ko,$l)|0,zn=zn+Math.imul(ko,El)|0;var Yl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Yl>>>26)|0,Yl&=67108863,Nn=Math.imul(bo,$l),wn=Math.imul(bo,El),wn=wn+Math.imul(Io,$l)|0,zn=Math.imul(Io,El);var Vl=(Zn+Nn|0)+((wn&8191)<<13)|0;return Zn=(zn+(wn>>>13)|0)+(Vl>>>26)|0,Vl&=67108863,On[0]=Cu,On[1]=iu,On[2]=pu,On[3]=yu,On[4]=hu,On[5]=mu,On[6]=vu,On[7]=fu,On[8]=gu,On[9]=ou,On[10]=su,On[11]=tu,On[12]=zl,On[13]=Gl,On[14]=Jl,On[15]=Pl,On[16]=Fl,On[17]=Yl,On[18]=Vl,Zn!==0&&(On[19]=Zn,Sn.length++),Sn};Math.imul||(An=In);function jn(Tn,Hr,Xr){Xr.negative=Hr.negative^Tn.negative,Xr.length=Tn.length+Hr.length;for(var Sn=0,Rn=0,Pn=0;Pn>>26)|0,Rn+=On>>>26,On&=67108863}Xr.words[Pn]=Zn,Sn=On,On=Rn}return Sn!==0?Xr.words[Pn]=Sn:Xr.length--,Xr._strip()}function eo(Tn,Hr,Xr){return jn(Tn,Hr,Xr)}jr.prototype.mulTo=function(Hr,Xr){var Sn,Rn=this.length+Hr.length;return this.length===10&&Hr.length===10?Sn=An(this,Hr,Xr):Rn<63?Sn=In(this,Hr,Xr):Rn<1024?Sn=jn(this,Hr,Xr):Sn=eo(this,Hr,Xr),Sn},jr.prototype.mul=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),this.mulTo(Hr,Xr)},jr.prototype.mulf=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),eo(this,Hr,Xr)},jr.prototype.imul=function(Hr){return this.clone().mulTo(Hr,this)},jr.prototype.imuln=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(typeof Hr=="number"),Er(Hr<67108864);for(var Sn=0,Rn=0;Rn>=26,Sn+=Pn/67108864|0,Sn+=On>>>26,this.words[Rn]=On&67108863}return Sn!==0&&(this.words[Rn]=Sn,this.length++),Xr?this.ineg():this},jr.prototype.muln=function(Hr){return this.clone().imuln(Hr)},jr.prototype.sqr=function(){return this.mul(this)},jr.prototype.isqr=function(){return this.imul(this.clone())},jr.prototype.pow=function(Hr){var Xr=Cn(Hr);if(Xr.length===0)return new jr(1);for(var Sn=this,Rn=0;Rn=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=67108863>>>26-Xr<<26-Xr,Pn;if(Xr!==0){var On=0;for(Pn=0;Pn>>26-Xr}On&&(this.words[Pn]=On,this.length++)}if(Sn!==0){for(Pn=this.length-1;Pn>=0;Pn--)this.words[Pn+Sn]=this.words[Pn];for(Pn=0;Pn=0);var Rn;Xr?Rn=(Xr-Xr%26)/26:Rn=0;var Pn=Hr%26,On=Math.min((Hr-Pn)/26,this.length),Zn=67108863^67108863>>>Pn<On)for(this.length-=On,wn=0;wn=0&&(zn!==0||wn>=Rn);wn--){var fo=this.words[wn]|0;this.words[wn]=zn<<26-Pn|fo>>>Pn,zn=fo&Zn}return Nn&&zn!==0&&(Nn.words[Nn.length++]=zn),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},jr.prototype.ishrn=function(Hr,Xr,Sn){return Er(this.negative===0),this.iushrn(Hr,Xr,Sn)},jr.prototype.shln=function(Hr){return this.clone().ishln(Hr)},jr.prototype.ushln=function(Hr){return this.clone().iushln(Hr)},jr.prototype.shrn=function(Hr){return this.clone().ishrn(Hr)},jr.prototype.ushrn=function(Hr){return this.clone().iushrn(Hr)},jr.prototype.testn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<=0);var Xr=Hr%26,Sn=(Hr-Xr)/26;if(Er(this.negative===0,"imaskn works only with positive numbers"),this.length<=Sn)return this;if(Xr!==0&&Sn++,this.length=Math.min(Sn,this.length),Xr!==0){var Rn=67108863^67108863>>>Xr<=67108864;Xr++)this.words[Xr]-=67108864,Xr===this.length-1?this.words[Xr+1]=1:this.words[Xr+1]++;return this.length=Math.max(this.length,Xr+1),this},jr.prototype.isubn=function(Hr){if(Er(typeof Hr=="number"),Er(Hr<67108864),Hr<0)return this.iaddn(-Hr);if(this.negative!==0)return this.negative=0,this.iaddn(Hr),this.negative=1,this;if(this.words[0]-=Hr,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Xr=0;Xr>26)-(Nn/67108864|0),this.words[Pn+Sn]=On&67108863}for(;Pn>26,this.words[Pn+Sn]=On&67108863;if(Zn===0)return this._strip();for(Er(Zn===-1),Zn=0,Pn=0;Pn>26,this.words[Pn]=On&67108863;return this.negative=1,this._strip()},jr.prototype._wordDiv=function(Hr,Xr){var Sn=this.length-Hr.length,Rn=this.clone(),Pn=Hr,On=Pn.words[Pn.length-1]|0,Zn=this._countBits(On);Sn=26-Zn,Sn!==0&&(Pn=Pn.ushln(Sn),Rn.iushln(Sn),On=Pn.words[Pn.length-1]|0);var Nn=Rn.length-Pn.length,wn;if(Xr!=="mod"){wn=new jr(null),wn.length=Nn+1,wn.words=new Array(wn.length);for(var zn=0;zn=0;vo--){var go=(Rn.words[Pn.length+vo]|0)*67108864+(Rn.words[Pn.length+vo-1]|0);for(go=Math.min(go/On|0,67108863),Rn._ishlnsubmul(Pn,go,vo);Rn.negative!==0;)go--,Rn.negative=0,Rn._ishlnsubmul(Pn,1,vo),Rn.isZero()||(Rn.negative^=1);wn&&(wn.words[vo]=go)}return wn&&wn._strip(),Rn._strip(),Xr!=="div"&&Sn!==0&&Rn.iushrn(Sn),{div:wn||null,mod:Rn}},jr.prototype.divmod=function(Hr,Xr,Sn){if(Er(!Hr.isZero()),this.isZero())return{div:new jr(0),mod:new jr(0)};var Rn,Pn,On;return this.negative!==0&&Hr.negative===0?(On=this.neg().divmod(Hr,Xr),Xr!=="mod"&&(Rn=On.div.neg()),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.iadd(Hr)),{div:Rn,mod:Pn}):this.negative===0&&Hr.negative!==0?(On=this.divmod(Hr.neg(),Xr),Xr!=="mod"&&(Rn=On.div.neg()),{div:Rn,mod:On.mod}):this.negative&Hr.negative?(On=this.neg().divmod(Hr.neg(),Xr),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.isub(Hr)),{div:On.div,mod:Pn}):Hr.length>this.length||this.cmp(Hr)<0?{div:new jr(0),mod:this}:Hr.length===1?Xr==="div"?{div:this.divn(Hr.words[0]),mod:null}:Xr==="mod"?{div:null,mod:new jr(this.modrn(Hr.words[0]))}:{div:this.divn(Hr.words[0]),mod:new jr(this.modrn(Hr.words[0]))}:this._wordDiv(Hr,Xr)},jr.prototype.div=function(Hr){return this.divmod(Hr,"div",!1).div},jr.prototype.mod=function(Hr){return this.divmod(Hr,"mod",!1).mod},jr.prototype.umod=function(Hr){return this.divmod(Hr,"mod",!0).mod},jr.prototype.divRound=function(Hr){var Xr=this.divmod(Hr);if(Xr.mod.isZero())return Xr.div;var Sn=Xr.div.negative!==0?Xr.mod.isub(Hr):Xr.mod,Rn=Hr.ushrn(1),Pn=Hr.andln(1),On=Sn.cmp(Rn);return On<0||Pn===1&&On===0?Xr.div:Xr.div.negative!==0?Xr.div.isubn(1):Xr.div.iaddn(1)},jr.prototype.modrn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=(1<<26)%Hr,Rn=0,Pn=this.length-1;Pn>=0;Pn--)Rn=(Sn*Rn+(this.words[Pn]|0))%Hr;return Xr?-Rn:Rn},jr.prototype.modn=function(Hr){return this.modrn(Hr)},jr.prototype.idivn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=0,Rn=this.length-1;Rn>=0;Rn--){var Pn=(this.words[Rn]|0)+Sn*67108864;this.words[Rn]=Pn/Hr|0,Sn=Pn%Hr}return this._strip(),Xr?this.ineg():this},jr.prototype.divn=function(Hr){return this.clone().idivn(Hr)},jr.prototype.egcd=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=new jr(0),Zn=new jr(1),Nn=0;Xr.isEven()&&Sn.isEven();)Xr.iushrn(1),Sn.iushrn(1),++Nn;for(var wn=Sn.clone(),zn=Xr.clone();!Xr.isZero();){for(var fo=0,vo=1;!(Xr.words[0]&vo)&&fo<26;++fo,vo<<=1);if(fo>0)for(Xr.iushrn(fo);fo-- >0;)(Rn.isOdd()||Pn.isOdd())&&(Rn.iadd(wn),Pn.isub(zn)),Rn.iushrn(1),Pn.iushrn(1);for(var go=0,uo=1;!(Sn.words[0]&uo)&&go<26;++go,uo<<=1);if(go>0)for(Sn.iushrn(go);go-- >0;)(On.isOdd()||Zn.isOdd())&&(On.iadd(wn),Zn.isub(zn)),On.iushrn(1),Zn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(On),Pn.isub(Zn)):(Sn.isub(Xr),On.isub(Rn),Zn.isub(Pn))}return{a:On,b:Zn,gcd:Sn.iushln(Nn)}},jr.prototype._invmp=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=Sn.clone();Xr.cmpn(1)>0&&Sn.cmpn(1)>0;){for(var Zn=0,Nn=1;!(Xr.words[0]&Nn)&&Zn<26;++Zn,Nn<<=1);if(Zn>0)for(Xr.iushrn(Zn);Zn-- >0;)Rn.isOdd()&&Rn.iadd(On),Rn.iushrn(1);for(var wn=0,zn=1;!(Sn.words[0]&zn)&&wn<26;++wn,zn<<=1);if(wn>0)for(Sn.iushrn(wn);wn-- >0;)Pn.isOdd()&&Pn.iadd(On),Pn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(Pn)):(Sn.isub(Xr),Pn.isub(Rn))}var fo;return Xr.cmpn(1)===0?fo=Rn:fo=Pn,fo.cmpn(0)<0&&fo.iadd(Hr),fo},jr.prototype.gcd=function(Hr){if(this.isZero())return Hr.abs();if(Hr.isZero())return this.abs();var Xr=this.clone(),Sn=Hr.clone();Xr.negative=0,Sn.negative=0;for(var Rn=0;Xr.isEven()&&Sn.isEven();Rn++)Xr.iushrn(1),Sn.iushrn(1);do{for(;Xr.isEven();)Xr.iushrn(1);for(;Sn.isEven();)Sn.iushrn(1);var Pn=Xr.cmp(Sn);if(Pn<0){var On=Xr;Xr=Sn,Sn=On}else if(Pn===0||Sn.cmpn(1)===0)break;Xr.isub(Sn)}while(!0);return Sn.iushln(Rn)},jr.prototype.invm=function(Hr){return this.egcd(Hr).a.umod(Hr)},jr.prototype.isEven=function(){return(this.words[0]&1)===0},jr.prototype.isOdd=function(){return(this.words[0]&1)===1},jr.prototype.andln=function(Hr){return this.words[0]&Hr},jr.prototype.bincn=function(Hr){Er(typeof Hr=="number");var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<>>26,Zn&=67108863,this.words[On]=Zn}return Pn!==0&&(this.words[On]=Pn,this.length++),this},jr.prototype.isZero=function(){return this.length===1&&this.words[0]===0},jr.prototype.cmpn=function(Hr){var Xr=Hr<0;if(this.negative!==0&&!Xr)return-1;if(this.negative===0&&Xr)return 1;this._strip();var Sn;if(this.length>1)Sn=1;else{Xr&&(Hr=-Hr),Er(Hr<=67108863,"Number is too big");var Rn=this.words[0]|0;Sn=Rn===Hr?0:RnHr.length)return 1;if(this.length=0;Sn--){var Rn=this.words[Sn]|0,Pn=Hr.words[Sn]|0;if(Rn!==Pn){RnPn&&(Xr=1);break}}return Xr},jr.prototype.gtn=function(Hr){return this.cmpn(Hr)===1},jr.prototype.gt=function(Hr){return this.cmp(Hr)===1},jr.prototype.gten=function(Hr){return this.cmpn(Hr)>=0},jr.prototype.gte=function(Hr){return this.cmp(Hr)>=0},jr.prototype.ltn=function(Hr){return this.cmpn(Hr)===-1},jr.prototype.lt=function(Hr){return this.cmp(Hr)===-1},jr.prototype.lten=function(Hr){return this.cmpn(Hr)<=0},jr.prototype.lte=function(Hr){return this.cmp(Hr)<=0},jr.prototype.eqn=function(Hr){return this.cmpn(Hr)===0},jr.prototype.eq=function(Hr){return this.cmp(Hr)===0},jr.red=function(Hr){return new so(Hr)},jr.prototype.toRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),Er(this.negative===0,"red works only with positives"),Hr.convertTo(this)._forceRed(Hr)},jr.prototype.fromRed=function(){return Er(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},jr.prototype._forceRed=function(Hr){return this.red=Hr,this},jr.prototype.forceRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),this._forceRed(Hr)},jr.prototype.redAdd=function(Hr){return Er(this.red,"redAdd works only with red numbers"),this.red.add(this,Hr)},jr.prototype.redIAdd=function(Hr){return Er(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Hr)},jr.prototype.redSub=function(Hr){return Er(this.red,"redSub works only with red numbers"),this.red.sub(this,Hr)},jr.prototype.redISub=function(Hr){return Er(this.red,"redISub works only with red numbers"),this.red.isub(this,Hr)},jr.prototype.redShl=function(Hr){return Er(this.red,"redShl works only with red numbers"),this.red.shl(this,Hr)},jr.prototype.redMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.mul(this,Hr)},jr.prototype.redIMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.imul(this,Hr)},jr.prototype.redSqr=function(){return Er(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},jr.prototype.redISqr=function(){return Er(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},jr.prototype.redSqrt=function(){return Er(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},jr.prototype.redInvm=function(){return Er(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},jr.prototype.redNeg=function(){return Er(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},jr.prototype.redPow=function(Hr){return Er(this.red&&!Hr.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Hr)};var ro={k256:null,p224:null,p192:null,p25519:null};function to(Tn,Hr){this.name=Tn,this.p=new jr(Hr,16),this.n=this.p.bitLength(),this.k=new jr(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}to.prototype._tmp=function(){var Hr=new jr(null);return Hr.words=new Array(Math.ceil(this.n/13)),Hr},to.prototype.ireduce=function(Hr){var Xr=Hr,Sn;do this.split(Xr,this.tmp),Xr=this.imulK(Xr),Xr=Xr.iadd(this.tmp),Sn=Xr.bitLength();while(Sn>this.n);var Rn=Sn0?Xr.isub(this.p):Xr.strip!==void 0?Xr.strip():Xr._strip(),Xr},to.prototype.split=function(Hr,Xr){Hr.iushrn(this.n,0,Xr)},to.prototype.imulK=function(Hr){return Hr.imul(this.k)};function _i(){to.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}kr(_i,to),_i.prototype.split=function(Hr,Xr){for(var Sn=4194303,Rn=Math.min(Hr.length,9),Pn=0;Pn>>22,On=Zn}On>>>=22,Hr.words[Pn-10]=On,On===0&&Hr.length>10?Hr.length-=10:Hr.length-=9},_i.prototype.imulK=function(Hr){Hr.words[Hr.length]=0,Hr.words[Hr.length+1]=0,Hr.length+=2;for(var Xr=0,Sn=0;Sn>>=26,Hr.words[Sn]=Pn,Xr=Rn}return Xr!==0&&(Hr.words[Hr.length++]=Xr),Hr},jr._prime=function(Hr){if(ro[Hr])return ro[Hr];var Xr;if(Hr==="k256")Xr=new _i;else if(Hr==="p224")Xr=new oo;else if(Hr==="p192")Xr=new io;else if(Hr==="p25519")Xr=new co;else throw new Error("Unknown prime "+Hr);return ro[Hr]=Xr,Xr};function so(Tn){if(typeof Tn=="string"){var Hr=jr._prime(Tn);this.m=Hr.p,this.prime=Hr}else Er(Tn.gtn(1),"modulus must be greater than 1"),this.m=Tn,this.prime=null}so.prototype._verify1=function(Hr){Er(Hr.negative===0,"red works only with positives"),Er(Hr.red,"red works only with red numbers")},so.prototype._verify2=function(Hr,Xr){Er((Hr.negative|Xr.negative)===0,"red works only with positives"),Er(Hr.red&&Hr.red===Xr.red,"red works only with red numbers")},so.prototype.imod=function(Hr){return this.prime?this.prime.ireduce(Hr)._forceRed(this):(Vr(Hr,Hr.umod(this.m)._forceRed(this)),Hr)},so.prototype.neg=function(Hr){return Hr.isZero()?Hr.clone():this.m.sub(Hr)._forceRed(this)},so.prototype.add=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.add(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn._forceRed(this)},so.prototype.iadd=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.iadd(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn},so.prototype.sub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.sub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn._forceRed(this)},so.prototype.isub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.isub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn},so.prototype.shl=function(Hr,Xr){return this._verify1(Hr),this.imod(Hr.ushln(Xr))},so.prototype.imul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.imul(Xr))},so.prototype.mul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.mul(Xr))},so.prototype.isqr=function(Hr){return this.imul(Hr,Hr.clone())},so.prototype.sqr=function(Hr){return this.mul(Hr,Hr)},so.prototype.sqrt=function(Hr){if(Hr.isZero())return Hr.clone();var Xr=this.m.andln(3);if(Er(Xr%2===1),Xr===3){var Sn=this.m.add(new jr(1)).iushrn(2);return this.pow(Hr,Sn)}for(var Rn=this.m.subn(1),Pn=0;!Rn.isZero()&&Rn.andln(1)===0;)Pn++,Rn.iushrn(1);Er(!Rn.isZero());var On=new jr(1).toRed(this),Zn=On.redNeg(),Nn=this.m.subn(1).iushrn(1),wn=this.m.bitLength();for(wn=new jr(2*wn*wn).toRed(this);this.pow(wn,Nn).cmp(Zn)!==0;)wn.redIAdd(Zn);for(var zn=this.pow(wn,Rn),fo=this.pow(Hr,Rn.addn(1).iushrn(1)),vo=this.pow(Hr,Rn),go=Pn;vo.cmp(On)!==0;){for(var uo=vo,lo=0;uo.cmp(On)!==0;lo++)uo=uo.redSqr();Er(lo=0;Pn--){for(var zn=Xr.words[Pn],fo=wn-1;fo>=0;fo--){var vo=zn>>fo&1;if(On!==Rn[0]&&(On=this.sqr(On)),vo===0&&Zn===0){Nn=0;continue}Zn<<=1,Zn|=vo,Nn++,!(Nn!==Sn&&(Pn!==0||fo!==0))&&(On=this.mul(On,Rn[Zn]),Nn=0,Zn=0)}wn=26}return On},so.prototype.convertTo=function(Hr){var Xr=Hr.umod(this.m);return Xr===Hr?Xr.clone():Xr},so.prototype.convertFrom=function(Hr){var Xr=Hr.clone();return Xr.red=null,Xr},jr.mont=function(Hr){return new no(Hr)};function no(Tn){so.call(this,Tn),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new jr(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}kr(no,so),no.prototype.convertTo=function(Hr){return this.imod(Hr.ushln(this.shift))},no.prototype.convertFrom=function(Hr){var Xr=this.imod(Hr.mul(this.rinv));return Xr.red=null,Xr},no.prototype.imul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return Hr.words[0]=0,Hr.length=1,Hr;var Sn=Hr.imul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.mul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return new jr(0)._forceRed(this);var Sn=Hr.mul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.invm=function(Hr){var Xr=this.imod(Hr._invmp(this.m).mul(this.r2));return Xr._forceRed(this)}})(fr,commonjsGlobal)})(bn$3);var bnExports$3=bn$3.exports;const BN$2=getDefaultExportFromCjs$2(bnExports$3);var _Buffer$3=safeBufferExports.Buffer;function base$3(fr){if(fr.length>=255)throw new TypeError("Alphabet too long");for(var br=new Uint8Array(256),wr=0;wr>>0,jn=new Uint8Array(An);Cn!==In;){for(var eo=Qr[Cn],ro=0,to=An-1;(eo!==0||ro>>0,jn[to]=eo%Br>>>0,eo=eo/Br>>>0;if(eo!==0)throw new Error("Non-zero carry");En=ro,Cn++}for(var _i=An-En;_i!==An&&jn[_i]===0;)_i++;for(var oo=Wr.repeat(_n);_i>>0,An=new Uint8Array(In);_n>>0,An[ro]=jn%256>>>0,jn=jn/256>>>0;if(jn!==0)throw new Error("Non-zero carry");Cn=eo,_n++}for(var to=In-Cn;to!==In&&An[to]===0;)to++;var _i=_Buffer$3.allocUnsafe(En+(In-to));_i.fill(0,0,En);for(var oo=En;to!==In;)_i[oo++]=An[to++];return _i}function Jr(Qr){var _n=Zr(Qr);if(_n)return _n;throw new Error("Non-base"+Br+" character")}return{encode:Vr,decodeUnsafe:Zr,decode:Jr}}var src$3=base$3,basex$3=src$3,ALPHABET$3="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58$5=basex$3(ALPHABET$3);const bs58$6=getDefaultExportFromCjs$2(bs58$5);var lib={},bn$2={exports:{}};bn$2.exports;(function(fr){(function(br,wr){function Er(Tn,Hr){if(!Tn)throw new Error(Hr||"Assertion failed")}function kr(Tn,Hr){Tn.super_=Hr;var Xr=function(){};Xr.prototype=Hr.prototype,Tn.prototype=new Xr,Tn.prototype.constructor=Tn}function jr(Tn,Hr,Xr){if(jr.isBN(Tn))return Tn;this.negative=0,this.words=null,this.length=0,this.red=null,Tn!==null&&((Hr==="le"||Hr==="be")&&(Xr=Hr,Hr=10),this._init(Tn||0,Hr||10,Xr||"be"))}typeof br=="object"?br.exports=jr:wr.BN=jr,jr.BN=jr,jr.wordSize=26;var Br;try{typeof window<"u"&&typeof window.Buffer<"u"?Br=window.Buffer:Br=require$$0$9.Buffer}catch{}jr.isBN=function(Hr){return Hr instanceof jr?!0:Hr!==null&&typeof Hr=="object"&&Hr.constructor.wordSize===jr.wordSize&&Array.isArray(Hr.words)},jr.max=function(Hr,Xr){return Hr.cmp(Xr)>0?Hr:Xr},jr.min=function(Hr,Xr){return Hr.cmp(Xr)<0?Hr:Xr},jr.prototype._init=function(Hr,Xr,Sn){if(typeof Hr=="number")return this._initNumber(Hr,Xr,Sn);if(typeof Hr=="object")return this._initArray(Hr,Xr,Sn);Xr==="hex"&&(Xr=16),Er(Xr===(Xr|0)&&Xr>=2&&Xr<=36),Hr=Hr.toString().replace(/\s+/g,"");var Rn=0;Hr[0]==="-"&&(Rn++,this.negative=1),Rn=0;Rn-=3)On=Hr[Rn]|Hr[Rn-1]<<8|Hr[Rn-2]<<16,this.words[Pn]|=On<>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);else if(Sn==="le")for(Rn=0,Pn=0;Rn>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);return this._strip()};function Wr(Tn,Hr){var Xr=Tn.charCodeAt(Hr);if(Xr>=48&&Xr<=57)return Xr-48;if(Xr>=65&&Xr<=70)return Xr-55;if(Xr>=97&&Xr<=102)return Xr-87;Er(!1,"Invalid character in "+Tn)}function qr(Tn,Hr,Xr){var Sn=Wr(Tn,Xr);return Xr-1>=Hr&&(Sn|=Wr(Tn,Xr-1)<<4),Sn}jr.prototype._parseHex=function(Hr,Xr,Sn){this.length=Math.ceil((Hr.length-Xr)/6),this.words=new Array(this.length);for(var Rn=0;Rn=Xr;Rn-=2)Zn=qr(Hr,Xr,Rn)<=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8;else{var Nn=Hr.length-Xr;for(Rn=Nn%2===0?Xr+1:Xr;Rn=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8}this._strip()};function Gr(Tn,Hr,Xr,Sn){for(var Rn=0,Pn=0,On=Math.min(Tn.length,Xr),Zn=Hr;Zn=49?Pn=Nn-49+10:Nn>=17?Pn=Nn-17+10:Pn=Nn,Er(Nn>=0&&Pn1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},jr.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{jr.prototype[Symbol.for("nodejs.util.inspect.custom")]=Zr}catch{jr.prototype.inspect=Zr}else jr.prototype.inspect=Zr;function Zr(){return(this.red?""}var Jr=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Qr=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_n=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];jr.prototype.toString=function(Hr,Xr){Hr=Hr||10,Xr=Xr|0||1;var Sn;if(Hr===16||Hr==="hex"){Sn="";for(var Rn=0,Pn=0,On=0;On>>24-Rn&16777215,Rn+=2,Rn>=26&&(Rn-=26,On--),Pn!==0||On!==this.length-1?Sn=Jr[6-Nn.length]+Nn+Sn:Sn=Nn+Sn}for(Pn!==0&&(Sn=Pn.toString(16)+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}if(Hr===(Hr|0)&&Hr>=2&&Hr<=36){var wn=Qr[Hr],zn=_n[Hr];Sn="";var fo=this.clone();for(fo.negative=0;!fo.isZero();){var vo=fo.modrn(zn).toString(Hr);fo=fo.idivn(zn),fo.isZero()?Sn=vo+Sn:Sn=Jr[wn-vo.length]+vo+Sn}for(this.isZero()&&(Sn="0"+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}Er(!1,"Base should be between 2 and 36")},jr.prototype.toNumber=function(){var Hr=this.words[0];return this.length===2?Hr+=this.words[1]*67108864:this.length===3&&this.words[2]===1?Hr+=4503599627370496+this.words[1]*67108864:this.length>2&&Er(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-Hr:Hr},jr.prototype.toJSON=function(){return this.toString(16,2)},Br&&(jr.prototype.toBuffer=function(Hr,Xr){return this.toArrayLike(Br,Hr,Xr)}),jr.prototype.toArray=function(Hr,Xr){return this.toArrayLike(Array,Hr,Xr)};var En=function(Hr,Xr){return Hr.allocUnsafe?Hr.allocUnsafe(Xr):new Hr(Xr)};jr.prototype.toArrayLike=function(Hr,Xr,Sn){this._strip();var Rn=this.byteLength(),Pn=Sn||Math.max(1,Rn);Er(Rn<=Pn,"byte array longer than desired length"),Er(Pn>0,"Requested array length <= 0");var On=En(Hr,Pn),Zn=Xr==="le"?"LE":"BE";return this["_toArrayLike"+Zn](On,Rn),On},jr.prototype._toArrayLikeLE=function(Hr,Xr){for(var Sn=0,Rn=0,Pn=0,On=0;Pn>8&255),Sn>16&255),On===6?(Sn>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn=0&&(Hr[Sn--]=Zn>>8&255),Sn>=0&&(Hr[Sn--]=Zn>>16&255),On===6?(Sn>=0&&(Hr[Sn--]=Zn>>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn>=0)for(Hr[Sn--]=Rn;Sn>=0;)Hr[Sn--]=0},Math.clz32?jr.prototype._countBits=function(Hr){return 32-Math.clz32(Hr)}:jr.prototype._countBits=function(Hr){var Xr=Hr,Sn=0;return Xr>=4096&&(Sn+=13,Xr>>>=13),Xr>=64&&(Sn+=7,Xr>>>=7),Xr>=8&&(Sn+=4,Xr>>>=4),Xr>=2&&(Sn+=2,Xr>>>=2),Sn+Xr},jr.prototype._zeroBits=function(Hr){if(Hr===0)return 26;var Xr=Hr,Sn=0;return Xr&8191||(Sn+=13,Xr>>>=13),Xr&127||(Sn+=7,Xr>>>=7),Xr&15||(Sn+=4,Xr>>>=4),Xr&3||(Sn+=2,Xr>>>=2),Xr&1||Sn++,Sn},jr.prototype.bitLength=function(){var Hr=this.words[this.length-1],Xr=this._countBits(Hr);return(this.length-1)*26+Xr};function Cn(Tn){for(var Hr=new Array(Tn.bitLength()),Xr=0;Xr>>Rn&1}return Hr}jr.prototype.zeroBits=function(){if(this.isZero())return 0;for(var Hr=0,Xr=0;XrHr.length?this.clone().ior(Hr):Hr.clone().ior(this)},jr.prototype.uor=function(Hr){return this.length>Hr.length?this.clone().iuor(Hr):Hr.clone().iuor(this)},jr.prototype.iuand=function(Hr){var Xr;this.length>Hr.length?Xr=Hr:Xr=this;for(var Sn=0;SnHr.length?this.clone().iand(Hr):Hr.clone().iand(this)},jr.prototype.uand=function(Hr){return this.length>Hr.length?this.clone().iuand(Hr):Hr.clone().iuand(this)},jr.prototype.iuxor=function(Hr){var Xr,Sn;this.length>Hr.length?(Xr=this,Sn=Hr):(Xr=Hr,Sn=this);for(var Rn=0;RnHr.length?this.clone().ixor(Hr):Hr.clone().ixor(this)},jr.prototype.uxor=function(Hr){return this.length>Hr.length?this.clone().iuxor(Hr):Hr.clone().iuxor(this)},jr.prototype.inotn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Math.ceil(Hr/26)|0,Sn=Hr%26;this._expand(Xr),Sn>0&&Xr--;for(var Rn=0;Rn0&&(this.words[Rn]=~this.words[Rn]&67108863>>26-Sn),this._strip()},jr.prototype.notn=function(Hr){return this.clone().inotn(Hr)},jr.prototype.setn=function(Hr,Xr){Er(typeof Hr=="number"&&Hr>=0);var Sn=Hr/26|0,Rn=Hr%26;return this._expand(Sn+1),Xr?this.words[Sn]=this.words[Sn]|1<Hr.length?(Sn=this,Rn=Hr):(Sn=Hr,Rn=this);for(var Pn=0,On=0;On>>26;for(;Pn!==0&&On>>26;if(this.length=Sn.length,Pn!==0)this.words[this.length]=Pn,this.length++;else if(Sn!==this)for(;OnHr.length?this.clone().iadd(Hr):Hr.clone().iadd(this)},jr.prototype.isub=function(Hr){if(Hr.negative!==0){Hr.negative=0;var Xr=this.iadd(Hr);return Hr.negative=1,Xr._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Hr),this.negative=1,this._normSign();var Sn=this.cmp(Hr);if(Sn===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Rn,Pn;Sn>0?(Rn=this,Pn=Hr):(Rn=Hr,Pn=this);for(var On=0,Zn=0;Zn>26,this.words[Zn]=Xr&67108863;for(;On!==0&&Zn>26,this.words[Zn]=Xr&67108863;if(On===0&&Zn>>26,fo=Nn&67108863,vo=Math.min(wn,Hr.length-1),go=Math.max(0,wn-Tn.length+1);go<=vo;go++){var uo=wn-go|0;Rn=Tn.words[uo]|0,Pn=Hr.words[go]|0,On=Rn*Pn+fo,zn+=On/67108864|0,fo=On&67108863}Xr.words[wn]=fo|0,Nn=zn|0}return Nn!==0?Xr.words[wn]=Nn|0:Xr.length--,Xr._strip()}var An=function(Hr,Xr,Sn){var Rn=Hr.words,Pn=Xr.words,On=Sn.words,Zn=0,Nn,wn,zn,fo=Rn[0]|0,vo=fo&8191,go=fo>>>13,uo=Rn[1]|0,lo=uo&8191,Eo=uo>>>13,mo=Rn[2]|0,yo=mo&8191,_o=mo>>>13,Bo=Rn[3]|0,Lo=Bo&8191,Wo=Bo>>>13,na=Rn[4]|0,qo=na&8191,ga=na>>>13,wl=Rn[5]|0,No=wl&8191,Fo=wl>>>13,Nl=Rn[6]|0,Vo=Nl&8191,Uo=Nl>>>13,Ml=Rn[7]|0,$a=Ml&8191,Jo=Ml>>>13,Zl=Rn[8]|0,Cl=Zl&8191,ko=Zl>>>13,wo=Rn[9]|0,bo=wo&8191,Io=wo>>>13,Ho=Pn[0]|0,Do=Ho&8191,zo=Ho>>>13,nu=Pn[1]|0,Ll=nu&8191,_l=nu>>>13,bu=Pn[2]|0,xl=bu&8191,Tl=bu>>>13,du=Pn[3]|0,Bl=du&8191,Il=du>>>13,Eu=Pn[4]|0,Al=Eu&8191,Ol=Eu>>>13,Tu=Pn[5]|0,Ul=Tu&8191,Sl=Tu>>>13,_u=Pn[6]|0,So=_u&8191,Co=_u>>>13,Ao=Pn[7]|0,po=Ao&8191,Ro=Ao>>>13,Xo=Pn[8]|0,jo=Xo&8191,Ko=Xo>>>13,Wl=Pn[9]|0,$l=Wl&8191,El=Wl>>>13;Sn.negative=Hr.negative^Xr.negative,Sn.length=19,Nn=Math.imul(vo,Do),wn=Math.imul(vo,zo),wn=wn+Math.imul(go,Do)|0,zn=Math.imul(go,zo);var Cu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,Nn=Math.imul(lo,Do),wn=Math.imul(lo,zo),wn=wn+Math.imul(Eo,Do)|0,zn=Math.imul(Eo,zo),Nn=Nn+Math.imul(vo,Ll)|0,wn=wn+Math.imul(vo,_l)|0,wn=wn+Math.imul(go,Ll)|0,zn=zn+Math.imul(go,_l)|0;var iu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(iu>>>26)|0,iu&=67108863,Nn=Math.imul(yo,Do),wn=Math.imul(yo,zo),wn=wn+Math.imul(_o,Do)|0,zn=Math.imul(_o,zo),Nn=Nn+Math.imul(lo,Ll)|0,wn=wn+Math.imul(lo,_l)|0,wn=wn+Math.imul(Eo,Ll)|0,zn=zn+Math.imul(Eo,_l)|0,Nn=Nn+Math.imul(vo,xl)|0,wn=wn+Math.imul(vo,Tl)|0,wn=wn+Math.imul(go,xl)|0,zn=zn+Math.imul(go,Tl)|0;var pu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(pu>>>26)|0,pu&=67108863,Nn=Math.imul(Lo,Do),wn=Math.imul(Lo,zo),wn=wn+Math.imul(Wo,Do)|0,zn=Math.imul(Wo,zo),Nn=Nn+Math.imul(yo,Ll)|0,wn=wn+Math.imul(yo,_l)|0,wn=wn+Math.imul(_o,Ll)|0,zn=zn+Math.imul(_o,_l)|0,Nn=Nn+Math.imul(lo,xl)|0,wn=wn+Math.imul(lo,Tl)|0,wn=wn+Math.imul(Eo,xl)|0,zn=zn+Math.imul(Eo,Tl)|0,Nn=Nn+Math.imul(vo,Bl)|0,wn=wn+Math.imul(vo,Il)|0,wn=wn+Math.imul(go,Bl)|0,zn=zn+Math.imul(go,Il)|0;var yu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(yu>>>26)|0,yu&=67108863,Nn=Math.imul(qo,Do),wn=Math.imul(qo,zo),wn=wn+Math.imul(ga,Do)|0,zn=Math.imul(ga,zo),Nn=Nn+Math.imul(Lo,Ll)|0,wn=wn+Math.imul(Lo,_l)|0,wn=wn+Math.imul(Wo,Ll)|0,zn=zn+Math.imul(Wo,_l)|0,Nn=Nn+Math.imul(yo,xl)|0,wn=wn+Math.imul(yo,Tl)|0,wn=wn+Math.imul(_o,xl)|0,zn=zn+Math.imul(_o,Tl)|0,Nn=Nn+Math.imul(lo,Bl)|0,wn=wn+Math.imul(lo,Il)|0,wn=wn+Math.imul(Eo,Bl)|0,zn=zn+Math.imul(Eo,Il)|0,Nn=Nn+Math.imul(vo,Al)|0,wn=wn+Math.imul(vo,Ol)|0,wn=wn+Math.imul(go,Al)|0,zn=zn+Math.imul(go,Ol)|0;var hu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(hu>>>26)|0,hu&=67108863,Nn=Math.imul(No,Do),wn=Math.imul(No,zo),wn=wn+Math.imul(Fo,Do)|0,zn=Math.imul(Fo,zo),Nn=Nn+Math.imul(qo,Ll)|0,wn=wn+Math.imul(qo,_l)|0,wn=wn+Math.imul(ga,Ll)|0,zn=zn+Math.imul(ga,_l)|0,Nn=Nn+Math.imul(Lo,xl)|0,wn=wn+Math.imul(Lo,Tl)|0,wn=wn+Math.imul(Wo,xl)|0,zn=zn+Math.imul(Wo,Tl)|0,Nn=Nn+Math.imul(yo,Bl)|0,wn=wn+Math.imul(yo,Il)|0,wn=wn+Math.imul(_o,Bl)|0,zn=zn+Math.imul(_o,Il)|0,Nn=Nn+Math.imul(lo,Al)|0,wn=wn+Math.imul(lo,Ol)|0,wn=wn+Math.imul(Eo,Al)|0,zn=zn+Math.imul(Eo,Ol)|0,Nn=Nn+Math.imul(vo,Ul)|0,wn=wn+Math.imul(vo,Sl)|0,wn=wn+Math.imul(go,Ul)|0,zn=zn+Math.imul(go,Sl)|0;var mu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(mu>>>26)|0,mu&=67108863,Nn=Math.imul(Vo,Do),wn=Math.imul(Vo,zo),wn=wn+Math.imul(Uo,Do)|0,zn=Math.imul(Uo,zo),Nn=Nn+Math.imul(No,Ll)|0,wn=wn+Math.imul(No,_l)|0,wn=wn+Math.imul(Fo,Ll)|0,zn=zn+Math.imul(Fo,_l)|0,Nn=Nn+Math.imul(qo,xl)|0,wn=wn+Math.imul(qo,Tl)|0,wn=wn+Math.imul(ga,xl)|0,zn=zn+Math.imul(ga,Tl)|0,Nn=Nn+Math.imul(Lo,Bl)|0,wn=wn+Math.imul(Lo,Il)|0,wn=wn+Math.imul(Wo,Bl)|0,zn=zn+Math.imul(Wo,Il)|0,Nn=Nn+Math.imul(yo,Al)|0,wn=wn+Math.imul(yo,Ol)|0,wn=wn+Math.imul(_o,Al)|0,zn=zn+Math.imul(_o,Ol)|0,Nn=Nn+Math.imul(lo,Ul)|0,wn=wn+Math.imul(lo,Sl)|0,wn=wn+Math.imul(Eo,Ul)|0,zn=zn+Math.imul(Eo,Sl)|0,Nn=Nn+Math.imul(vo,So)|0,wn=wn+Math.imul(vo,Co)|0,wn=wn+Math.imul(go,So)|0,zn=zn+Math.imul(go,Co)|0;var vu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(vu>>>26)|0,vu&=67108863,Nn=Math.imul($a,Do),wn=Math.imul($a,zo),wn=wn+Math.imul(Jo,Do)|0,zn=Math.imul(Jo,zo),Nn=Nn+Math.imul(Vo,Ll)|0,wn=wn+Math.imul(Vo,_l)|0,wn=wn+Math.imul(Uo,Ll)|0,zn=zn+Math.imul(Uo,_l)|0,Nn=Nn+Math.imul(No,xl)|0,wn=wn+Math.imul(No,Tl)|0,wn=wn+Math.imul(Fo,xl)|0,zn=zn+Math.imul(Fo,Tl)|0,Nn=Nn+Math.imul(qo,Bl)|0,wn=wn+Math.imul(qo,Il)|0,wn=wn+Math.imul(ga,Bl)|0,zn=zn+Math.imul(ga,Il)|0,Nn=Nn+Math.imul(Lo,Al)|0,wn=wn+Math.imul(Lo,Ol)|0,wn=wn+Math.imul(Wo,Al)|0,zn=zn+Math.imul(Wo,Ol)|0,Nn=Nn+Math.imul(yo,Ul)|0,wn=wn+Math.imul(yo,Sl)|0,wn=wn+Math.imul(_o,Ul)|0,zn=zn+Math.imul(_o,Sl)|0,Nn=Nn+Math.imul(lo,So)|0,wn=wn+Math.imul(lo,Co)|0,wn=wn+Math.imul(Eo,So)|0,zn=zn+Math.imul(Eo,Co)|0,Nn=Nn+Math.imul(vo,po)|0,wn=wn+Math.imul(vo,Ro)|0,wn=wn+Math.imul(go,po)|0,zn=zn+Math.imul(go,Ro)|0;var fu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(fu>>>26)|0,fu&=67108863,Nn=Math.imul(Cl,Do),wn=Math.imul(Cl,zo),wn=wn+Math.imul(ko,Do)|0,zn=Math.imul(ko,zo),Nn=Nn+Math.imul($a,Ll)|0,wn=wn+Math.imul($a,_l)|0,wn=wn+Math.imul(Jo,Ll)|0,zn=zn+Math.imul(Jo,_l)|0,Nn=Nn+Math.imul(Vo,xl)|0,wn=wn+Math.imul(Vo,Tl)|0,wn=wn+Math.imul(Uo,xl)|0,zn=zn+Math.imul(Uo,Tl)|0,Nn=Nn+Math.imul(No,Bl)|0,wn=wn+Math.imul(No,Il)|0,wn=wn+Math.imul(Fo,Bl)|0,zn=zn+Math.imul(Fo,Il)|0,Nn=Nn+Math.imul(qo,Al)|0,wn=wn+Math.imul(qo,Ol)|0,wn=wn+Math.imul(ga,Al)|0,zn=zn+Math.imul(ga,Ol)|0,Nn=Nn+Math.imul(Lo,Ul)|0,wn=wn+Math.imul(Lo,Sl)|0,wn=wn+Math.imul(Wo,Ul)|0,zn=zn+Math.imul(Wo,Sl)|0,Nn=Nn+Math.imul(yo,So)|0,wn=wn+Math.imul(yo,Co)|0,wn=wn+Math.imul(_o,So)|0,zn=zn+Math.imul(_o,Co)|0,Nn=Nn+Math.imul(lo,po)|0,wn=wn+Math.imul(lo,Ro)|0,wn=wn+Math.imul(Eo,po)|0,zn=zn+Math.imul(Eo,Ro)|0,Nn=Nn+Math.imul(vo,jo)|0,wn=wn+Math.imul(vo,Ko)|0,wn=wn+Math.imul(go,jo)|0,zn=zn+Math.imul(go,Ko)|0;var gu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(gu>>>26)|0,gu&=67108863,Nn=Math.imul(bo,Do),wn=Math.imul(bo,zo),wn=wn+Math.imul(Io,Do)|0,zn=Math.imul(Io,zo),Nn=Nn+Math.imul(Cl,Ll)|0,wn=wn+Math.imul(Cl,_l)|0,wn=wn+Math.imul(ko,Ll)|0,zn=zn+Math.imul(ko,_l)|0,Nn=Nn+Math.imul($a,xl)|0,wn=wn+Math.imul($a,Tl)|0,wn=wn+Math.imul(Jo,xl)|0,zn=zn+Math.imul(Jo,Tl)|0,Nn=Nn+Math.imul(Vo,Bl)|0,wn=wn+Math.imul(Vo,Il)|0,wn=wn+Math.imul(Uo,Bl)|0,zn=zn+Math.imul(Uo,Il)|0,Nn=Nn+Math.imul(No,Al)|0,wn=wn+Math.imul(No,Ol)|0,wn=wn+Math.imul(Fo,Al)|0,zn=zn+Math.imul(Fo,Ol)|0,Nn=Nn+Math.imul(qo,Ul)|0,wn=wn+Math.imul(qo,Sl)|0,wn=wn+Math.imul(ga,Ul)|0,zn=zn+Math.imul(ga,Sl)|0,Nn=Nn+Math.imul(Lo,So)|0,wn=wn+Math.imul(Lo,Co)|0,wn=wn+Math.imul(Wo,So)|0,zn=zn+Math.imul(Wo,Co)|0,Nn=Nn+Math.imul(yo,po)|0,wn=wn+Math.imul(yo,Ro)|0,wn=wn+Math.imul(_o,po)|0,zn=zn+Math.imul(_o,Ro)|0,Nn=Nn+Math.imul(lo,jo)|0,wn=wn+Math.imul(lo,Ko)|0,wn=wn+Math.imul(Eo,jo)|0,zn=zn+Math.imul(Eo,Ko)|0,Nn=Nn+Math.imul(vo,$l)|0,wn=wn+Math.imul(vo,El)|0,wn=wn+Math.imul(go,$l)|0,zn=zn+Math.imul(go,El)|0;var ou=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(ou>>>26)|0,ou&=67108863,Nn=Math.imul(bo,Ll),wn=Math.imul(bo,_l),wn=wn+Math.imul(Io,Ll)|0,zn=Math.imul(Io,_l),Nn=Nn+Math.imul(Cl,xl)|0,wn=wn+Math.imul(Cl,Tl)|0,wn=wn+Math.imul(ko,xl)|0,zn=zn+Math.imul(ko,Tl)|0,Nn=Nn+Math.imul($a,Bl)|0,wn=wn+Math.imul($a,Il)|0,wn=wn+Math.imul(Jo,Bl)|0,zn=zn+Math.imul(Jo,Il)|0,Nn=Nn+Math.imul(Vo,Al)|0,wn=wn+Math.imul(Vo,Ol)|0,wn=wn+Math.imul(Uo,Al)|0,zn=zn+Math.imul(Uo,Ol)|0,Nn=Nn+Math.imul(No,Ul)|0,wn=wn+Math.imul(No,Sl)|0,wn=wn+Math.imul(Fo,Ul)|0,zn=zn+Math.imul(Fo,Sl)|0,Nn=Nn+Math.imul(qo,So)|0,wn=wn+Math.imul(qo,Co)|0,wn=wn+Math.imul(ga,So)|0,zn=zn+Math.imul(ga,Co)|0,Nn=Nn+Math.imul(Lo,po)|0,wn=wn+Math.imul(Lo,Ro)|0,wn=wn+Math.imul(Wo,po)|0,zn=zn+Math.imul(Wo,Ro)|0,Nn=Nn+Math.imul(yo,jo)|0,wn=wn+Math.imul(yo,Ko)|0,wn=wn+Math.imul(_o,jo)|0,zn=zn+Math.imul(_o,Ko)|0,Nn=Nn+Math.imul(lo,$l)|0,wn=wn+Math.imul(lo,El)|0,wn=wn+Math.imul(Eo,$l)|0,zn=zn+Math.imul(Eo,El)|0;var su=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(su>>>26)|0,su&=67108863,Nn=Math.imul(bo,xl),wn=Math.imul(bo,Tl),wn=wn+Math.imul(Io,xl)|0,zn=Math.imul(Io,Tl),Nn=Nn+Math.imul(Cl,Bl)|0,wn=wn+Math.imul(Cl,Il)|0,wn=wn+Math.imul(ko,Bl)|0,zn=zn+Math.imul(ko,Il)|0,Nn=Nn+Math.imul($a,Al)|0,wn=wn+Math.imul($a,Ol)|0,wn=wn+Math.imul(Jo,Al)|0,zn=zn+Math.imul(Jo,Ol)|0,Nn=Nn+Math.imul(Vo,Ul)|0,wn=wn+Math.imul(Vo,Sl)|0,wn=wn+Math.imul(Uo,Ul)|0,zn=zn+Math.imul(Uo,Sl)|0,Nn=Nn+Math.imul(No,So)|0,wn=wn+Math.imul(No,Co)|0,wn=wn+Math.imul(Fo,So)|0,zn=zn+Math.imul(Fo,Co)|0,Nn=Nn+Math.imul(qo,po)|0,wn=wn+Math.imul(qo,Ro)|0,wn=wn+Math.imul(ga,po)|0,zn=zn+Math.imul(ga,Ro)|0,Nn=Nn+Math.imul(Lo,jo)|0,wn=wn+Math.imul(Lo,Ko)|0,wn=wn+Math.imul(Wo,jo)|0,zn=zn+Math.imul(Wo,Ko)|0,Nn=Nn+Math.imul(yo,$l)|0,wn=wn+Math.imul(yo,El)|0,wn=wn+Math.imul(_o,$l)|0,zn=zn+Math.imul(_o,El)|0;var tu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(tu>>>26)|0,tu&=67108863,Nn=Math.imul(bo,Bl),wn=Math.imul(bo,Il),wn=wn+Math.imul(Io,Bl)|0,zn=Math.imul(Io,Il),Nn=Nn+Math.imul(Cl,Al)|0,wn=wn+Math.imul(Cl,Ol)|0,wn=wn+Math.imul(ko,Al)|0,zn=zn+Math.imul(ko,Ol)|0,Nn=Nn+Math.imul($a,Ul)|0,wn=wn+Math.imul($a,Sl)|0,wn=wn+Math.imul(Jo,Ul)|0,zn=zn+Math.imul(Jo,Sl)|0,Nn=Nn+Math.imul(Vo,So)|0,wn=wn+Math.imul(Vo,Co)|0,wn=wn+Math.imul(Uo,So)|0,zn=zn+Math.imul(Uo,Co)|0,Nn=Nn+Math.imul(No,po)|0,wn=wn+Math.imul(No,Ro)|0,wn=wn+Math.imul(Fo,po)|0,zn=zn+Math.imul(Fo,Ro)|0,Nn=Nn+Math.imul(qo,jo)|0,wn=wn+Math.imul(qo,Ko)|0,wn=wn+Math.imul(ga,jo)|0,zn=zn+Math.imul(ga,Ko)|0,Nn=Nn+Math.imul(Lo,$l)|0,wn=wn+Math.imul(Lo,El)|0,wn=wn+Math.imul(Wo,$l)|0,zn=zn+Math.imul(Wo,El)|0;var zl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(zl>>>26)|0,zl&=67108863,Nn=Math.imul(bo,Al),wn=Math.imul(bo,Ol),wn=wn+Math.imul(Io,Al)|0,zn=Math.imul(Io,Ol),Nn=Nn+Math.imul(Cl,Ul)|0,wn=wn+Math.imul(Cl,Sl)|0,wn=wn+Math.imul(ko,Ul)|0,zn=zn+Math.imul(ko,Sl)|0,Nn=Nn+Math.imul($a,So)|0,wn=wn+Math.imul($a,Co)|0,wn=wn+Math.imul(Jo,So)|0,zn=zn+Math.imul(Jo,Co)|0,Nn=Nn+Math.imul(Vo,po)|0,wn=wn+Math.imul(Vo,Ro)|0,wn=wn+Math.imul(Uo,po)|0,zn=zn+Math.imul(Uo,Ro)|0,Nn=Nn+Math.imul(No,jo)|0,wn=wn+Math.imul(No,Ko)|0,wn=wn+Math.imul(Fo,jo)|0,zn=zn+Math.imul(Fo,Ko)|0,Nn=Nn+Math.imul(qo,$l)|0,wn=wn+Math.imul(qo,El)|0,wn=wn+Math.imul(ga,$l)|0,zn=zn+Math.imul(ga,El)|0;var Gl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Gl>>>26)|0,Gl&=67108863,Nn=Math.imul(bo,Ul),wn=Math.imul(bo,Sl),wn=wn+Math.imul(Io,Ul)|0,zn=Math.imul(Io,Sl),Nn=Nn+Math.imul(Cl,So)|0,wn=wn+Math.imul(Cl,Co)|0,wn=wn+Math.imul(ko,So)|0,zn=zn+Math.imul(ko,Co)|0,Nn=Nn+Math.imul($a,po)|0,wn=wn+Math.imul($a,Ro)|0,wn=wn+Math.imul(Jo,po)|0,zn=zn+Math.imul(Jo,Ro)|0,Nn=Nn+Math.imul(Vo,jo)|0,wn=wn+Math.imul(Vo,Ko)|0,wn=wn+Math.imul(Uo,jo)|0,zn=zn+Math.imul(Uo,Ko)|0,Nn=Nn+Math.imul(No,$l)|0,wn=wn+Math.imul(No,El)|0,wn=wn+Math.imul(Fo,$l)|0,zn=zn+Math.imul(Fo,El)|0;var Jl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Jl>>>26)|0,Jl&=67108863,Nn=Math.imul(bo,So),wn=Math.imul(bo,Co),wn=wn+Math.imul(Io,So)|0,zn=Math.imul(Io,Co),Nn=Nn+Math.imul(Cl,po)|0,wn=wn+Math.imul(Cl,Ro)|0,wn=wn+Math.imul(ko,po)|0,zn=zn+Math.imul(ko,Ro)|0,Nn=Nn+Math.imul($a,jo)|0,wn=wn+Math.imul($a,Ko)|0,wn=wn+Math.imul(Jo,jo)|0,zn=zn+Math.imul(Jo,Ko)|0,Nn=Nn+Math.imul(Vo,$l)|0,wn=wn+Math.imul(Vo,El)|0,wn=wn+Math.imul(Uo,$l)|0,zn=zn+Math.imul(Uo,El)|0;var Pl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Pl>>>26)|0,Pl&=67108863,Nn=Math.imul(bo,po),wn=Math.imul(bo,Ro),wn=wn+Math.imul(Io,po)|0,zn=Math.imul(Io,Ro),Nn=Nn+Math.imul(Cl,jo)|0,wn=wn+Math.imul(Cl,Ko)|0,wn=wn+Math.imul(ko,jo)|0,zn=zn+Math.imul(ko,Ko)|0,Nn=Nn+Math.imul($a,$l)|0,wn=wn+Math.imul($a,El)|0,wn=wn+Math.imul(Jo,$l)|0,zn=zn+Math.imul(Jo,El)|0;var Fl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Fl>>>26)|0,Fl&=67108863,Nn=Math.imul(bo,jo),wn=Math.imul(bo,Ko),wn=wn+Math.imul(Io,jo)|0,zn=Math.imul(Io,Ko),Nn=Nn+Math.imul(Cl,$l)|0,wn=wn+Math.imul(Cl,El)|0,wn=wn+Math.imul(ko,$l)|0,zn=zn+Math.imul(ko,El)|0;var Yl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Yl>>>26)|0,Yl&=67108863,Nn=Math.imul(bo,$l),wn=Math.imul(bo,El),wn=wn+Math.imul(Io,$l)|0,zn=Math.imul(Io,El);var Vl=(Zn+Nn|0)+((wn&8191)<<13)|0;return Zn=(zn+(wn>>>13)|0)+(Vl>>>26)|0,Vl&=67108863,On[0]=Cu,On[1]=iu,On[2]=pu,On[3]=yu,On[4]=hu,On[5]=mu,On[6]=vu,On[7]=fu,On[8]=gu,On[9]=ou,On[10]=su,On[11]=tu,On[12]=zl,On[13]=Gl,On[14]=Jl,On[15]=Pl,On[16]=Fl,On[17]=Yl,On[18]=Vl,Zn!==0&&(On[19]=Zn,Sn.length++),Sn};Math.imul||(An=In);function jn(Tn,Hr,Xr){Xr.negative=Hr.negative^Tn.negative,Xr.length=Tn.length+Hr.length;for(var Sn=0,Rn=0,Pn=0;Pn>>26)|0,Rn+=On>>>26,On&=67108863}Xr.words[Pn]=Zn,Sn=On,On=Rn}return Sn!==0?Xr.words[Pn]=Sn:Xr.length--,Xr._strip()}function eo(Tn,Hr,Xr){return jn(Tn,Hr,Xr)}jr.prototype.mulTo=function(Hr,Xr){var Sn,Rn=this.length+Hr.length;return this.length===10&&Hr.length===10?Sn=An(this,Hr,Xr):Rn<63?Sn=In(this,Hr,Xr):Rn<1024?Sn=jn(this,Hr,Xr):Sn=eo(this,Hr,Xr),Sn},jr.prototype.mul=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),this.mulTo(Hr,Xr)},jr.prototype.mulf=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),eo(this,Hr,Xr)},jr.prototype.imul=function(Hr){return this.clone().mulTo(Hr,this)},jr.prototype.imuln=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(typeof Hr=="number"),Er(Hr<67108864);for(var Sn=0,Rn=0;Rn>=26,Sn+=Pn/67108864|0,Sn+=On>>>26,this.words[Rn]=On&67108863}return Sn!==0&&(this.words[Rn]=Sn,this.length++),Xr?this.ineg():this},jr.prototype.muln=function(Hr){return this.clone().imuln(Hr)},jr.prototype.sqr=function(){return this.mul(this)},jr.prototype.isqr=function(){return this.imul(this.clone())},jr.prototype.pow=function(Hr){var Xr=Cn(Hr);if(Xr.length===0)return new jr(1);for(var Sn=this,Rn=0;Rn=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=67108863>>>26-Xr<<26-Xr,Pn;if(Xr!==0){var On=0;for(Pn=0;Pn>>26-Xr}On&&(this.words[Pn]=On,this.length++)}if(Sn!==0){for(Pn=this.length-1;Pn>=0;Pn--)this.words[Pn+Sn]=this.words[Pn];for(Pn=0;Pn=0);var Rn;Xr?Rn=(Xr-Xr%26)/26:Rn=0;var Pn=Hr%26,On=Math.min((Hr-Pn)/26,this.length),Zn=67108863^67108863>>>Pn<On)for(this.length-=On,wn=0;wn=0&&(zn!==0||wn>=Rn);wn--){var fo=this.words[wn]|0;this.words[wn]=zn<<26-Pn|fo>>>Pn,zn=fo&Zn}return Nn&&zn!==0&&(Nn.words[Nn.length++]=zn),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},jr.prototype.ishrn=function(Hr,Xr,Sn){return Er(this.negative===0),this.iushrn(Hr,Xr,Sn)},jr.prototype.shln=function(Hr){return this.clone().ishln(Hr)},jr.prototype.ushln=function(Hr){return this.clone().iushln(Hr)},jr.prototype.shrn=function(Hr){return this.clone().ishrn(Hr)},jr.prototype.ushrn=function(Hr){return this.clone().iushrn(Hr)},jr.prototype.testn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<=0);var Xr=Hr%26,Sn=(Hr-Xr)/26;if(Er(this.negative===0,"imaskn works only with positive numbers"),this.length<=Sn)return this;if(Xr!==0&&Sn++,this.length=Math.min(Sn,this.length),Xr!==0){var Rn=67108863^67108863>>>Xr<=67108864;Xr++)this.words[Xr]-=67108864,Xr===this.length-1?this.words[Xr+1]=1:this.words[Xr+1]++;return this.length=Math.max(this.length,Xr+1),this},jr.prototype.isubn=function(Hr){if(Er(typeof Hr=="number"),Er(Hr<67108864),Hr<0)return this.iaddn(-Hr);if(this.negative!==0)return this.negative=0,this.iaddn(Hr),this.negative=1,this;if(this.words[0]-=Hr,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Xr=0;Xr>26)-(Nn/67108864|0),this.words[Pn+Sn]=On&67108863}for(;Pn>26,this.words[Pn+Sn]=On&67108863;if(Zn===0)return this._strip();for(Er(Zn===-1),Zn=0,Pn=0;Pn>26,this.words[Pn]=On&67108863;return this.negative=1,this._strip()},jr.prototype._wordDiv=function(Hr,Xr){var Sn=this.length-Hr.length,Rn=this.clone(),Pn=Hr,On=Pn.words[Pn.length-1]|0,Zn=this._countBits(On);Sn=26-Zn,Sn!==0&&(Pn=Pn.ushln(Sn),Rn.iushln(Sn),On=Pn.words[Pn.length-1]|0);var Nn=Rn.length-Pn.length,wn;if(Xr!=="mod"){wn=new jr(null),wn.length=Nn+1,wn.words=new Array(wn.length);for(var zn=0;zn=0;vo--){var go=(Rn.words[Pn.length+vo]|0)*67108864+(Rn.words[Pn.length+vo-1]|0);for(go=Math.min(go/On|0,67108863),Rn._ishlnsubmul(Pn,go,vo);Rn.negative!==0;)go--,Rn.negative=0,Rn._ishlnsubmul(Pn,1,vo),Rn.isZero()||(Rn.negative^=1);wn&&(wn.words[vo]=go)}return wn&&wn._strip(),Rn._strip(),Xr!=="div"&&Sn!==0&&Rn.iushrn(Sn),{div:wn||null,mod:Rn}},jr.prototype.divmod=function(Hr,Xr,Sn){if(Er(!Hr.isZero()),this.isZero())return{div:new jr(0),mod:new jr(0)};var Rn,Pn,On;return this.negative!==0&&Hr.negative===0?(On=this.neg().divmod(Hr,Xr),Xr!=="mod"&&(Rn=On.div.neg()),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.iadd(Hr)),{div:Rn,mod:Pn}):this.negative===0&&Hr.negative!==0?(On=this.divmod(Hr.neg(),Xr),Xr!=="mod"&&(Rn=On.div.neg()),{div:Rn,mod:On.mod}):this.negative&Hr.negative?(On=this.neg().divmod(Hr.neg(),Xr),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.isub(Hr)),{div:On.div,mod:Pn}):Hr.length>this.length||this.cmp(Hr)<0?{div:new jr(0),mod:this}:Hr.length===1?Xr==="div"?{div:this.divn(Hr.words[0]),mod:null}:Xr==="mod"?{div:null,mod:new jr(this.modrn(Hr.words[0]))}:{div:this.divn(Hr.words[0]),mod:new jr(this.modrn(Hr.words[0]))}:this._wordDiv(Hr,Xr)},jr.prototype.div=function(Hr){return this.divmod(Hr,"div",!1).div},jr.prototype.mod=function(Hr){return this.divmod(Hr,"mod",!1).mod},jr.prototype.umod=function(Hr){return this.divmod(Hr,"mod",!0).mod},jr.prototype.divRound=function(Hr){var Xr=this.divmod(Hr);if(Xr.mod.isZero())return Xr.div;var Sn=Xr.div.negative!==0?Xr.mod.isub(Hr):Xr.mod,Rn=Hr.ushrn(1),Pn=Hr.andln(1),On=Sn.cmp(Rn);return On<0||Pn===1&&On===0?Xr.div:Xr.div.negative!==0?Xr.div.isubn(1):Xr.div.iaddn(1)},jr.prototype.modrn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=(1<<26)%Hr,Rn=0,Pn=this.length-1;Pn>=0;Pn--)Rn=(Sn*Rn+(this.words[Pn]|0))%Hr;return Xr?-Rn:Rn},jr.prototype.modn=function(Hr){return this.modrn(Hr)},jr.prototype.idivn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=0,Rn=this.length-1;Rn>=0;Rn--){var Pn=(this.words[Rn]|0)+Sn*67108864;this.words[Rn]=Pn/Hr|0,Sn=Pn%Hr}return this._strip(),Xr?this.ineg():this},jr.prototype.divn=function(Hr){return this.clone().idivn(Hr)},jr.prototype.egcd=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=new jr(0),Zn=new jr(1),Nn=0;Xr.isEven()&&Sn.isEven();)Xr.iushrn(1),Sn.iushrn(1),++Nn;for(var wn=Sn.clone(),zn=Xr.clone();!Xr.isZero();){for(var fo=0,vo=1;!(Xr.words[0]&vo)&&fo<26;++fo,vo<<=1);if(fo>0)for(Xr.iushrn(fo);fo-- >0;)(Rn.isOdd()||Pn.isOdd())&&(Rn.iadd(wn),Pn.isub(zn)),Rn.iushrn(1),Pn.iushrn(1);for(var go=0,uo=1;!(Sn.words[0]&uo)&&go<26;++go,uo<<=1);if(go>0)for(Sn.iushrn(go);go-- >0;)(On.isOdd()||Zn.isOdd())&&(On.iadd(wn),Zn.isub(zn)),On.iushrn(1),Zn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(On),Pn.isub(Zn)):(Sn.isub(Xr),On.isub(Rn),Zn.isub(Pn))}return{a:On,b:Zn,gcd:Sn.iushln(Nn)}},jr.prototype._invmp=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=Sn.clone();Xr.cmpn(1)>0&&Sn.cmpn(1)>0;){for(var Zn=0,Nn=1;!(Xr.words[0]&Nn)&&Zn<26;++Zn,Nn<<=1);if(Zn>0)for(Xr.iushrn(Zn);Zn-- >0;)Rn.isOdd()&&Rn.iadd(On),Rn.iushrn(1);for(var wn=0,zn=1;!(Sn.words[0]&zn)&&wn<26;++wn,zn<<=1);if(wn>0)for(Sn.iushrn(wn);wn-- >0;)Pn.isOdd()&&Pn.iadd(On),Pn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(Pn)):(Sn.isub(Xr),Pn.isub(Rn))}var fo;return Xr.cmpn(1)===0?fo=Rn:fo=Pn,fo.cmpn(0)<0&&fo.iadd(Hr),fo},jr.prototype.gcd=function(Hr){if(this.isZero())return Hr.abs();if(Hr.isZero())return this.abs();var Xr=this.clone(),Sn=Hr.clone();Xr.negative=0,Sn.negative=0;for(var Rn=0;Xr.isEven()&&Sn.isEven();Rn++)Xr.iushrn(1),Sn.iushrn(1);do{for(;Xr.isEven();)Xr.iushrn(1);for(;Sn.isEven();)Sn.iushrn(1);var Pn=Xr.cmp(Sn);if(Pn<0){var On=Xr;Xr=Sn,Sn=On}else if(Pn===0||Sn.cmpn(1)===0)break;Xr.isub(Sn)}while(!0);return Sn.iushln(Rn)},jr.prototype.invm=function(Hr){return this.egcd(Hr).a.umod(Hr)},jr.prototype.isEven=function(){return(this.words[0]&1)===0},jr.prototype.isOdd=function(){return(this.words[0]&1)===1},jr.prototype.andln=function(Hr){return this.words[0]&Hr},jr.prototype.bincn=function(Hr){Er(typeof Hr=="number");var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<>>26,Zn&=67108863,this.words[On]=Zn}return Pn!==0&&(this.words[On]=Pn,this.length++),this},jr.prototype.isZero=function(){return this.length===1&&this.words[0]===0},jr.prototype.cmpn=function(Hr){var Xr=Hr<0;if(this.negative!==0&&!Xr)return-1;if(this.negative===0&&Xr)return 1;this._strip();var Sn;if(this.length>1)Sn=1;else{Xr&&(Hr=-Hr),Er(Hr<=67108863,"Number is too big");var Rn=this.words[0]|0;Sn=Rn===Hr?0:RnHr.length)return 1;if(this.length=0;Sn--){var Rn=this.words[Sn]|0,Pn=Hr.words[Sn]|0;if(Rn!==Pn){RnPn&&(Xr=1);break}}return Xr},jr.prototype.gtn=function(Hr){return this.cmpn(Hr)===1},jr.prototype.gt=function(Hr){return this.cmp(Hr)===1},jr.prototype.gten=function(Hr){return this.cmpn(Hr)>=0},jr.prototype.gte=function(Hr){return this.cmp(Hr)>=0},jr.prototype.ltn=function(Hr){return this.cmpn(Hr)===-1},jr.prototype.lt=function(Hr){return this.cmp(Hr)===-1},jr.prototype.lten=function(Hr){return this.cmpn(Hr)<=0},jr.prototype.lte=function(Hr){return this.cmp(Hr)<=0},jr.prototype.eqn=function(Hr){return this.cmpn(Hr)===0},jr.prototype.eq=function(Hr){return this.cmp(Hr)===0},jr.red=function(Hr){return new so(Hr)},jr.prototype.toRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),Er(this.negative===0,"red works only with positives"),Hr.convertTo(this)._forceRed(Hr)},jr.prototype.fromRed=function(){return Er(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},jr.prototype._forceRed=function(Hr){return this.red=Hr,this},jr.prototype.forceRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),this._forceRed(Hr)},jr.prototype.redAdd=function(Hr){return Er(this.red,"redAdd works only with red numbers"),this.red.add(this,Hr)},jr.prototype.redIAdd=function(Hr){return Er(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Hr)},jr.prototype.redSub=function(Hr){return Er(this.red,"redSub works only with red numbers"),this.red.sub(this,Hr)},jr.prototype.redISub=function(Hr){return Er(this.red,"redISub works only with red numbers"),this.red.isub(this,Hr)},jr.prototype.redShl=function(Hr){return Er(this.red,"redShl works only with red numbers"),this.red.shl(this,Hr)},jr.prototype.redMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.mul(this,Hr)},jr.prototype.redIMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.imul(this,Hr)},jr.prototype.redSqr=function(){return Er(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},jr.prototype.redISqr=function(){return Er(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},jr.prototype.redSqrt=function(){return Er(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},jr.prototype.redInvm=function(){return Er(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},jr.prototype.redNeg=function(){return Er(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},jr.prototype.redPow=function(Hr){return Er(this.red&&!Hr.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Hr)};var ro={k256:null,p224:null,p192:null,p25519:null};function to(Tn,Hr){this.name=Tn,this.p=new jr(Hr,16),this.n=this.p.bitLength(),this.k=new jr(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}to.prototype._tmp=function(){var Hr=new jr(null);return Hr.words=new Array(Math.ceil(this.n/13)),Hr},to.prototype.ireduce=function(Hr){var Xr=Hr,Sn;do this.split(Xr,this.tmp),Xr=this.imulK(Xr),Xr=Xr.iadd(this.tmp),Sn=Xr.bitLength();while(Sn>this.n);var Rn=Sn0?Xr.isub(this.p):Xr.strip!==void 0?Xr.strip():Xr._strip(),Xr},to.prototype.split=function(Hr,Xr){Hr.iushrn(this.n,0,Xr)},to.prototype.imulK=function(Hr){return Hr.imul(this.k)};function _i(){to.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}kr(_i,to),_i.prototype.split=function(Hr,Xr){for(var Sn=4194303,Rn=Math.min(Hr.length,9),Pn=0;Pn>>22,On=Zn}On>>>=22,Hr.words[Pn-10]=On,On===0&&Hr.length>10?Hr.length-=10:Hr.length-=9},_i.prototype.imulK=function(Hr){Hr.words[Hr.length]=0,Hr.words[Hr.length+1]=0,Hr.length+=2;for(var Xr=0,Sn=0;Sn>>=26,Hr.words[Sn]=Pn,Xr=Rn}return Xr!==0&&(Hr.words[Hr.length++]=Xr),Hr},jr._prime=function(Hr){if(ro[Hr])return ro[Hr];var Xr;if(Hr==="k256")Xr=new _i;else if(Hr==="p224")Xr=new oo;else if(Hr==="p192")Xr=new io;else if(Hr==="p25519")Xr=new co;else throw new Error("Unknown prime "+Hr);return ro[Hr]=Xr,Xr};function so(Tn){if(typeof Tn=="string"){var Hr=jr._prime(Tn);this.m=Hr.p,this.prime=Hr}else Er(Tn.gtn(1),"modulus must be greater than 1"),this.m=Tn,this.prime=null}so.prototype._verify1=function(Hr){Er(Hr.negative===0,"red works only with positives"),Er(Hr.red,"red works only with red numbers")},so.prototype._verify2=function(Hr,Xr){Er((Hr.negative|Xr.negative)===0,"red works only with positives"),Er(Hr.red&&Hr.red===Xr.red,"red works only with red numbers")},so.prototype.imod=function(Hr){return this.prime?this.prime.ireduce(Hr)._forceRed(this):(Vr(Hr,Hr.umod(this.m)._forceRed(this)),Hr)},so.prototype.neg=function(Hr){return Hr.isZero()?Hr.clone():this.m.sub(Hr)._forceRed(this)},so.prototype.add=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.add(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn._forceRed(this)},so.prototype.iadd=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.iadd(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn},so.prototype.sub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.sub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn._forceRed(this)},so.prototype.isub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.isub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn},so.prototype.shl=function(Hr,Xr){return this._verify1(Hr),this.imod(Hr.ushln(Xr))},so.prototype.imul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.imul(Xr))},so.prototype.mul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.mul(Xr))},so.prototype.isqr=function(Hr){return this.imul(Hr,Hr.clone())},so.prototype.sqr=function(Hr){return this.mul(Hr,Hr)},so.prototype.sqrt=function(Hr){if(Hr.isZero())return Hr.clone();var Xr=this.m.andln(3);if(Er(Xr%2===1),Xr===3){var Sn=this.m.add(new jr(1)).iushrn(2);return this.pow(Hr,Sn)}for(var Rn=this.m.subn(1),Pn=0;!Rn.isZero()&&Rn.andln(1)===0;)Pn++,Rn.iushrn(1);Er(!Rn.isZero());var On=new jr(1).toRed(this),Zn=On.redNeg(),Nn=this.m.subn(1).iushrn(1),wn=this.m.bitLength();for(wn=new jr(2*wn*wn).toRed(this);this.pow(wn,Nn).cmp(Zn)!==0;)wn.redIAdd(Zn);for(var zn=this.pow(wn,Rn),fo=this.pow(Hr,Rn.addn(1).iushrn(1)),vo=this.pow(Hr,Rn),go=Pn;vo.cmp(On)!==0;){for(var uo=vo,lo=0;uo.cmp(On)!==0;lo++)uo=uo.redSqr();Er(lo=0;Pn--){for(var zn=Xr.words[Pn],fo=wn-1;fo>=0;fo--){var vo=zn>>fo&1;if(On!==Rn[0]&&(On=this.sqr(On)),vo===0&&Zn===0){Nn=0;continue}Zn<<=1,Zn|=vo,Nn++,!(Nn!==Sn&&(Pn!==0||fo!==0))&&(On=this.mul(On,Rn[Zn]),Nn=0,Zn=0)}wn=26}return On},so.prototype.convertTo=function(Hr){var Xr=Hr.umod(this.m);return Xr===Hr?Xr.clone():Xr},so.prototype.convertFrom=function(Hr){var Xr=Hr.clone();return Xr.red=null,Xr},jr.mont=function(Hr){return new no(Hr)};function no(Tn){so.call(this,Tn),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new jr(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}kr(no,so),no.prototype.convertTo=function(Hr){return this.imod(Hr.ushln(this.shift))},no.prototype.convertFrom=function(Hr){var Xr=this.imod(Hr.mul(this.rinv));return Xr.red=null,Xr},no.prototype.imul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return Hr.words[0]=0,Hr.length=1,Hr;var Sn=Hr.imul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.mul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return new jr(0)._forceRed(this);var Sn=Hr.mul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.invm=function(Hr){var Xr=this.imod(Hr._invmp(this.m).mul(this.r2));return Xr._forceRed(this)}})(fr,commonjsGlobal)})(bn$2);var bnExports$2=bn$2.exports,_Buffer$2=safeBufferExports.Buffer;function base$2(fr){if(fr.length>=255)throw new TypeError("Alphabet too long");for(var br=new Uint8Array(256),wr=0;wr>>0,jn=new Uint8Array(An);Cn!==In;){for(var eo=Qr[Cn],ro=0,to=An-1;(eo!==0||ro>>0,jn[to]=eo%Br>>>0,eo=eo/Br>>>0;if(eo!==0)throw new Error("Non-zero carry");En=ro,Cn++}for(var _i=An-En;_i!==An&&jn[_i]===0;)_i++;for(var oo=Wr.repeat(_n);_i>>0,An=new Uint8Array(In);_n>>0,An[ro]=jn%256>>>0,jn=jn/256>>>0;if(jn!==0)throw new Error("Non-zero carry");Cn=eo,_n++}for(var to=In-Cn;to!==In&&An[to]===0;)to++;var _i=_Buffer$2.allocUnsafe(En+(In-to));_i.fill(0,0,En);for(var oo=En;to!==In;)_i[oo++]=An[to++];return _i}function Jr(Qr){var _n=Zr(Qr);if(_n)return _n;throw new Error("Non-base"+Br+" character")}return{encode:Vr,decodeUnsafe:Zr,decode:Jr}}var src$2=base$2,basex$2=src$2,ALPHABET$2="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58$4=basex$2(ALPHABET$2);function inRange(fr,br,wr){return br<=fr&&fr<=wr}function ToDictionary(fr){if(fr===void 0)return{};if(fr===Object(fr))return fr;throw TypeError("Could not convert argument to dictionary")}function stringToCodePoints(fr){for(var br=String(fr),wr=br.length,Er=0,kr=[];Er57343)kr.push(jr);else if(56320<=jr&&jr<=57343)kr.push(65533);else if(55296<=jr&&jr<=56319)if(Er===wr-1)kr.push(65533);else{var Br=fr.charCodeAt(Er+1);if(56320<=Br&&Br<=57343){var Wr=jr&1023,qr=Br&1023;kr.push(65536+(Wr<<10)+qr),Er+=1}else kr.push(65533)}Er+=1}return kr}function codePointsToString(fr){for(var br="",wr=0;wr>10)+55296,(Er&1023)+56320))}return br}var end_of_stream=-1;function Stream(fr){this.tokens=[].slice.call(fr)}Stream.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():end_of_stream},prepend:function(fr){if(Array.isArray(fr))for(var br=fr;br.length;)this.tokens.unshift(br.pop());else this.tokens.unshift(fr)},push:function(fr){if(Array.isArray(fr))for(var br=fr;br.length;)this.tokens.push(br.shift());else this.tokens.push(fr)}};var finished=-1;function decoderError(fr,br){if(fr)throw TypeError("Decoder error");return br||65533}var DEFAULT_ENCODING="utf-8";function TextDecoder$1(fr,br){if(!(this instanceof TextDecoder$1))return new TextDecoder$1(fr,br);if(fr=fr!==void 0?String(fr).toLowerCase():DEFAULT_ENCODING,fr!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");br=ToDictionary(br),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!br.fatal,this._ignoreBOM=!!br.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}TextDecoder$1.prototype={decode:function fr(br,wr){var Er;typeof br=="object"&&br instanceof ArrayBuffer?Er=new Uint8Array(br):typeof br=="object"&&"buffer"in br&&br.buffer instanceof ArrayBuffer?Er=new Uint8Array(br.buffer,br.byteOffset,br.byteLength):Er=new Uint8Array(0),wr=ToDictionary(wr),this._streaming||(this._decoder=new UTF8Decoder({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!wr.stream;for(var kr=new Stream(Er),jr=[],Br;!kr.endOfStream()&&(Br=this._decoder.handler(kr,kr.read()),Br!==finished);)Br!==null&&(Array.isArray(Br)?jr.push.apply(jr,Br):jr.push(Br));if(!this._streaming){do{if(Br=this._decoder.handler(kr,kr.read()),Br===finished)break;Br!==null&&(Array.isArray(Br)?jr.push.apply(jr,Br):jr.push(Br))}while(!kr.endOfStream());this._decoder=null}return jr.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(jr[0]===65279?(this._BOMseen=!0,jr.shift()):this._BOMseen=!0),codePointsToString(jr)}};function TextEncoder$1(fr,br){if(!(this instanceof TextEncoder$1))return new TextEncoder$1(fr,br);if(fr=fr!==void 0?String(fr).toLowerCase():DEFAULT_ENCODING,fr!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");br=ToDictionary(br),this._streaming=!1,this._encoder=null,this._options={fatal:!!br.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}TextEncoder$1.prototype={encode:function fr(br,wr){br=br?String(br):"",wr=ToDictionary(wr),this._streaming||(this._encoder=new UTF8Encoder(this._options)),this._streaming=!!wr.stream;for(var Er=[],kr=new Stream(stringToCodePoints(br)),jr;!kr.endOfStream()&&(jr=this._encoder.handler(kr,kr.read()),jr!==finished);)Array.isArray(jr)?Er.push.apply(Er,jr):Er.push(jr);if(!this._streaming){for(;jr=this._encoder.handler(kr,kr.read()),jr!==finished;)Array.isArray(jr)?Er.push.apply(Er,jr):Er.push(jr);this._encoder=null}return new Uint8Array(Er)}};function UTF8Decoder(fr){var br=fr.fatal,wr=0,Er=0,kr=0,jr=128,Br=191;this.handler=function(Wr,qr){if(qr===end_of_stream&&kr!==0)return kr=0,decoderError(br);if(qr===end_of_stream)return finished;if(kr===0){if(inRange(qr,0,127))return qr;if(inRange(qr,194,223))kr=1,wr=qr-192;else if(inRange(qr,224,239))qr===224&&(jr=160),qr===237&&(Br=159),kr=2,wr=qr-224;else if(inRange(qr,240,244))qr===240&&(jr=144),qr===244&&(Br=143),kr=3,wr=qr-240;else return decoderError(br);return wr=wr<<6*kr,null}if(!inRange(qr,jr,Br))return wr=kr=Er=0,jr=128,Br=191,Wr.prepend(qr),decoderError(br);if(jr=128,Br=191,Er+=1,wr+=qr-128<<6*(kr-Er),Er!==kr)return null;var Gr=wr;return wr=kr=Er=0,Gr}}function UTF8Encoder(fr){fr.fatal,this.handler=function(br,wr){if(wr===end_of_stream)return finished;if(inRange(wr,0,127))return wr;var Er,kr;inRange(wr,128,2047)?(Er=1,kr=192):inRange(wr,2048,65535)?(Er=2,kr=224):inRange(wr,65536,1114111)&&(Er=3,kr=240);for(var jr=[(wr>>6*Er)+kr];Er>0;){var Br=wr>>6*(Er-1);jr.push(128|Br&63),Er-=1}return jr}}const encoding$1=Object.freeze(Object.defineProperty({__proto__:null,TextDecoder:TextDecoder$1,TextEncoder:TextEncoder$1},Symbol.toStringTag,{value:"Module"})),require$$2=getAugmentedNamespace(encoding$1);var __createBinding=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(fr,br,wr,Er){Er===void 0&&(Er=wr),Object.defineProperty(fr,Er,{enumerable:!0,get:function(){return br[wr]}})}:function(fr,br,wr,Er){Er===void 0&&(Er=wr),fr[Er]=br[wr]}),__setModuleDefault=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(fr,br){Object.defineProperty(fr,"default",{enumerable:!0,value:br})}:function(fr,br){fr.default=br}),__decorate=commonjsGlobal&&commonjsGlobal.__decorate||function(fr,br,wr,Er){var kr=arguments.length,jr=kr<3?br:Er===null?Er=Object.getOwnPropertyDescriptor(br,wr):Er,Br;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")jr=Reflect.decorate(fr,br,wr,Er);else for(var Wr=fr.length-1;Wr>=0;Wr--)(Br=fr[Wr])&&(jr=(kr<3?Br(jr):kr>3?Br(br,wr,jr):Br(br,wr))||jr);return kr>3&&jr&&Object.defineProperty(br,wr,jr),jr},__importStar=commonjsGlobal&&commonjsGlobal.__importStar||function(fr){if(fr&&fr.__esModule)return fr;var br={};if(fr!=null)for(var wr in fr)wr!=="default"&&Object.hasOwnProperty.call(fr,wr)&&__createBinding(br,fr,wr);return __setModuleDefault(br,fr),br},__importDefault=commonjsGlobal&&commonjsGlobal.__importDefault||function(fr){return fr&&fr.__esModule?fr:{default:fr}};Object.defineProperty(lib,"__esModule",{value:!0});var deserializeUnchecked_1=lib.deserializeUnchecked=deserialize_1=lib.deserialize=serialize_1=lib.serialize=lib.BinaryReader=lib.BinaryWriter=lib.BorshError=lib.baseDecode=lib.baseEncode=void 0;const bn_js_1=__importDefault(bnExports$2),bs58_1=__importDefault(bs58$4),encoding=__importStar(require$$2),ResolvedTextDecoder=typeof TextDecoder!="function"?encoding.TextDecoder:TextDecoder,textDecoder=new ResolvedTextDecoder("utf-8",{fatal:!0});function baseEncode(fr){return typeof fr=="string"&&(fr=Buffer$2.from(fr,"utf8")),bs58_1.default.encode(Buffer$2.from(fr))}lib.baseEncode=baseEncode;function baseDecode(fr){return Buffer$2.from(bs58_1.default.decode(fr))}lib.baseDecode=baseDecode;const INITIAL_LENGTH=1024;class BorshError extends Error{constructor(br){super(br),this.fieldPath=[],this.originalMessage=br}addToFieldPath(br){this.fieldPath.splice(0,0,br),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}lib.BorshError=BorshError;class BinaryWriter{constructor(){this.buf=Buffer$2.alloc(INITIAL_LENGTH),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer$2.concat([this.buf,Buffer$2.alloc(INITIAL_LENGTH)]))}writeU8(br){this.maybeResize(),this.buf.writeUInt8(br,this.length),this.length+=1}writeU16(br){this.maybeResize(),this.buf.writeUInt16LE(br,this.length),this.length+=2}writeU32(br){this.maybeResize(),this.buf.writeUInt32LE(br,this.length),this.length+=4}writeU64(br){this.maybeResize(),this.writeBuffer(Buffer$2.from(new bn_js_1.default(br).toArray("le",8)))}writeU128(br){this.maybeResize(),this.writeBuffer(Buffer$2.from(new bn_js_1.default(br).toArray("le",16)))}writeU256(br){this.maybeResize(),this.writeBuffer(Buffer$2.from(new bn_js_1.default(br).toArray("le",32)))}writeU512(br){this.maybeResize(),this.writeBuffer(Buffer$2.from(new bn_js_1.default(br).toArray("le",64)))}writeBuffer(br){this.buf=Buffer$2.concat([Buffer$2.from(this.buf.subarray(0,this.length)),br,Buffer$2.alloc(INITIAL_LENGTH)]),this.length+=br.length}writeString(br){this.maybeResize();const wr=Buffer$2.from(br,"utf8");this.writeU32(wr.length),this.writeBuffer(wr)}writeFixedArray(br){this.writeBuffer(Buffer$2.from(br))}writeArray(br,wr){this.maybeResize(),this.writeU32(br.length);for(const Er of br)this.maybeResize(),wr(Er)}toArray(){return this.buf.subarray(0,this.length)}}lib.BinaryWriter=BinaryWriter;function handlingRangeError(fr,br,wr){const Er=wr.value;wr.value=function(...kr){try{return Er.apply(this,kr)}catch(jr){if(jr instanceof RangeError){const Br=jr.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(Br)>=0)throw new BorshError("Reached the end of buffer when deserializing")}throw jr}}}class BinaryReader{constructor(br){this.buf=br,this.offset=0}readU8(){const br=this.buf.readUInt8(this.offset);return this.offset+=1,br}readU16(){const br=this.buf.readUInt16LE(this.offset);return this.offset+=2,br}readU32(){const br=this.buf.readUInt32LE(this.offset);return this.offset+=4,br}readU64(){const br=this.readBuffer(8);return new bn_js_1.default(br,"le")}readU128(){const br=this.readBuffer(16);return new bn_js_1.default(br,"le")}readU256(){const br=this.readBuffer(32);return new bn_js_1.default(br,"le")}readU512(){const br=this.readBuffer(64);return new bn_js_1.default(br,"le")}readBuffer(br){if(this.offset+br>this.buf.length)throw new BorshError(`Expected buffer length ${br} isn't within bounds`);const wr=this.buf.slice(this.offset,this.offset+br);return this.offset+=br,wr}readString(){const br=this.readU32(),wr=this.readBuffer(br);try{return textDecoder.decode(wr)}catch(Er){throw new BorshError(`Error decoding UTF-8 string: ${Er}`)}}readFixedArray(br){return new Uint8Array(this.readBuffer(br))}readArray(br){const wr=this.readU32(),Er=Array();for(let kr=0;kr{serializeField(fr,br,jr,Er[0],kr)});else if(Er.kind!==void 0)switch(Er.kind){case"option":{wr==null?kr.writeU8(0):(kr.writeU8(1),serializeField(fr,br,wr,Er.type,kr));break}case"map":{kr.writeU32(wr.size),wr.forEach((jr,Br)=>{serializeField(fr,br,Br,Er.key,kr),serializeField(fr,br,jr,Er.value,kr)});break}default:throw new BorshError(`FieldType ${Er} unrecognized`)}else serializeStruct(fr,wr,kr)}catch(jr){throw jr instanceof BorshError&&jr.addToFieldPath(br),jr}}function serializeStruct(fr,br,wr){if(typeof br.borshSerialize=="function"){br.borshSerialize(wr);return}const Er=fr.get(br.constructor);if(!Er)throw new BorshError(`Class ${br.constructor.name} is missing in schema`);if(Er.kind==="struct")Er.fields.map(([kr,jr])=>{serializeField(fr,kr,br[kr],jr,wr)});else if(Er.kind==="enum"){const kr=br[Er.field];for(let jr=0;jrdeserializeField(fr,br,wr[0],Er))}if(wr.kind==="option")return Er.readU8()?deserializeField(fr,br,wr.type,Er):void 0;if(wr.kind==="map"){let kr=new Map;const jr=Er.readU32();for(let Br=0;Br=Er.values.length)throw new BorshError(`Enum index: ${kr} is out of range`);const[jr,Br]=Er.values[kr],Wr=deserializeField(fr,jr,Br,wr);return new br({[jr]:Wr})}throw new BorshError(`Unexpected schema kind: ${Er.kind} for ${br.constructor.name}`)}function deserialize(fr,br,wr,Er=BinaryReader){const kr=new Er(wr),jr=deserializeStruct(fr,br,kr);if(kr.offsetthis.span)throw new RangeError("indeterminate span");return this.span}replicate(br){const wr=Object.create(this.constructor.prototype);return Object.assign(wr,this),wr.property=br,wr}fromArray(br){}}Layout$1.Layout=Layout;function nameWithProperty(fr,br){return br.property?fr+"["+br.property+"]":fr}Layout$1.nameWithProperty=nameWithProperty;function bindConstructorLayout(fr,br){if(typeof fr!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(fr,"layout_"))throw new Error("Class is already bound to a layout");if(!(br&&br instanceof Layout))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(br,"boundConstructor_"))throw new Error("layout is already bound to a constructor");fr.layout_=br,br.boundConstructor_=fr,br.makeDestinationObject=()=>new fr,Object.defineProperty(fr.prototype,"encode",{value(wr,Er){return br.encode(this,wr,Er)},writable:!0}),Object.defineProperty(fr,"decode",{value(wr,Er){return br.decode(wr,Er)},writable:!0})}Layout$1.bindConstructorLayout=bindConstructorLayout;class ExternalLayout extends Layout{isCount(){throw new Error("ExternalLayout is abstract")}}Layout$1.ExternalLayout=ExternalLayout;class GreedyCount extends ExternalLayout{constructor(br=1,wr){if(!Number.isInteger(br)||0>=br)throw new TypeError("elementSpan must be a (positive) integer");super(-1,wr),this.elementSpan=br}isCount(){return!0}decode(br,wr=0){checkUint8Array(br);const Er=br.length-wr;return Math.floor(Er/this.elementSpan)}encode(br,wr,Er){return 0}}Layout$1.GreedyCount=GreedyCount;class OffsetLayout extends ExternalLayout{constructor(br,wr=0,Er){if(!(br instanceof Layout))throw new TypeError("layout must be a Layout");if(!Number.isInteger(wr))throw new TypeError("offset must be integer or undefined");super(br.span,Er||br.property),this.layout=br,this.offset=wr}isCount(){return this.layout instanceof UInt||this.layout instanceof UIntBE}decode(br,wr=0){return this.layout.decode(br,wr+this.offset)}encode(br,wr,Er=0){return this.layout.encode(br,wr,Er+this.offset)}}Layout$1.OffsetLayout=OffsetLayout;class UInt extends Layout{constructor(br,wr){if(super(br,wr),6Br+kr.encode(Wr,wr,Er+Br),0);return this.count instanceof ExternalLayout&&this.count.encode(br.length,wr,Er),jr}}Layout$1.Sequence=Sequence;class Structure extends Layout{constructor(br,wr,Er){if(!(Array.isArray(br)&&br.reduce((jr,Br)=>jr&&Br instanceof Layout,!0)))throw new TypeError("fields must be array of Layout instances");typeof wr=="boolean"&&Er===void 0&&(Er=wr,wr=void 0);for(const jr of br)if(0>jr.span&&jr.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let kr=-1;try{kr=br.reduce((jr,Br)=>jr+Br.getSpan(),0)}catch{}super(kr,wr),this.fields=br,this.decodePrefixes=!!Er}getSpan(br,wr=0){if(0<=this.span)return this.span;let Er=0;try{Er=this.fields.reduce((kr,jr)=>{const Br=jr.getSpan(br,wr);return wr+=Br,kr+Br},0)}catch{throw new RangeError("indeterminate span")}return Er}decode(br,wr=0){checkUint8Array(br);const Er=this.makeDestinationObject();for(const kr of this.fields)if(kr.property!==void 0&&(Er[kr.property]=kr.decode(br,wr)),wr+=kr.getSpan(br,wr),this.decodePrefixes&&br.length===wr)break;return Er}encode(br,wr,Er=0){const kr=Er;let jr=0,Br=0;for(const Wr of this.fields){let qr=Wr.span;if(Br=0qr&&(qr=Wr.getSpan(wr,Er)))}jr=Er,Er+=qr}return jr+Br-kr}fromArray(br){const wr=this.makeDestinationObject();for(const Er of this.fields)Er.property!==void 0&&0Er.span?wr=-1:0<=wr&&(wr+=Er.span)}}}Layout$1.Structure=Structure;class UnionDiscriminator{constructor(br){this.property=br}decode(br,wr){throw new Error("UnionDiscriminator is abstract")}encode(br,wr,Er){throw new Error("UnionDiscriminator is abstract")}}Layout$1.UnionDiscriminator=UnionDiscriminator;class UnionLayoutDiscriminator extends UnionDiscriminator{constructor(br,wr){if(!(br instanceof ExternalLayout&&br.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(wr||br.property||"variant"),this.layout=br}decode(br,wr){return this.layout.decode(br,wr)}encode(br,wr,Er){return this.layout.encode(br,wr,Er)}}Layout$1.UnionLayoutDiscriminator=UnionLayoutDiscriminator;class Union extends Layout{constructor(br,wr,Er){let kr;if(br instanceof UInt||br instanceof UIntBE)kr=new UnionLayoutDiscriminator(new OffsetLayout(br));else if(br instanceof ExternalLayout&&br.isCount())kr=new UnionLayoutDiscriminator(br);else if(br instanceof UnionDiscriminator)kr=br;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(wr===void 0&&(wr=null),!(wr===null||wr instanceof Layout))throw new TypeError("defaultLayout must be null or a Layout");if(wr!==null){if(0>wr.span)throw new Error("defaultLayout must have constant span");wr.property===void 0&&(wr=wr.replicate("content"))}let jr=-1;wr&&(jr=wr.span,0<=jr&&(br instanceof UInt||br instanceof UIntBE)&&(jr+=kr.layout.span)),super(jr,Er),this.discriminator=kr,this.usesPrefixDiscriminator=br instanceof UInt||br instanceof UIntBE,this.defaultLayout=wr,this.registry={};let Br=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(Wr){return Br(Wr)},this.configGetSourceVariant=function(Wr){Br=Wr.bind(this)}}getSpan(br,wr=0){if(0<=this.span)return this.span;const Er=this.getVariant(br,wr);if(!Er)throw new Error("unable to determine span for unrecognized variant");return Er.getSpan(br,wr)}defaultGetSourceVariant(br){if(Object.prototype.hasOwnProperty.call(br,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(br,this.defaultLayout.property))return;const wr=this.registry[br[this.discriminator.property]];if(wr&&(!wr.layout||wr.property&&Object.prototype.hasOwnProperty.call(br,wr.property)))return wr}else for(const wr in this.registry){const Er=this.registry[wr];if(Er.property&&Object.prototype.hasOwnProperty.call(br,Er.property))return Er}throw new Error("unable to infer src variant")}decode(br,wr=0){let Er;const kr=this.discriminator,jr=kr.decode(br,wr),Br=this.registry[jr];if(Br===void 0){const Wr=this.defaultLayout;let qr=0;this.usesPrefixDiscriminator&&(qr=kr.layout.span),Er=this.makeDestinationObject(),Er[kr.property]=jr,Er[Wr.property]=Wr.decode(br,wr+qr)}else Er=Br.decode(br,wr);return Er}encode(br,wr,Er=0){const kr=this.getSourceVariant(br);if(kr===void 0){const jr=this.discriminator,Br=this.defaultLayout;let Wr=0;return this.usesPrefixDiscriminator&&(Wr=jr.layout.span),jr.encode(br[jr.property],wr,Er),Wr+Br.encode(br[Br.property],wr,Er+Wr)}return kr.encode(br,wr,Er)}addVariant(br,wr,Er){const kr=new VariantLayout(this,br,wr,Er);return this.registry[br]=kr,kr}getVariant(br,wr=0){let Er;return br instanceof Uint8Array?Er=this.discriminator.decode(br,wr):Er=br,this.registry[Er]}}Layout$1.Union=Union;class VariantLayout extends Layout{constructor(br,wr,Er,kr){if(!(br instanceof Union))throw new TypeError("union must be a Union");if(!Number.isInteger(wr)||0>wr)throw new TypeError("variant must be a (non-negative) integer");if(typeof Er=="string"&&kr===void 0&&(kr=Er,Er=null),Er){if(!(Er instanceof Layout))throw new TypeError("layout must be a Layout");if(br.defaultLayout!==null&&0<=Er.span&&Er.span>br.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof kr!="string")throw new TypeError("variant must have a String property")}let jr=br.span;0>br.span&&(jr=Er?Er.span:0,0<=jr&&br.usesPrefixDiscriminator&&(jr+=br.discriminator.layout.span)),super(jr,kr),this.union=br,this.variant=wr,this.layout=Er||null}getSpan(br,wr=0){if(0<=this.span)return this.span;let Er=0;this.union.usesPrefixDiscriminator&&(Er=this.union.discriminator.layout.span);let kr=0;return this.layout&&(kr=this.layout.getSpan(br,wr+Er)),Er+kr}decode(br,wr=0){const Er=this.makeDestinationObject();if(this!==this.union.getVariant(br,wr))throw new Error("variant mismatch");let kr=0;return this.union.usesPrefixDiscriminator&&(kr=this.union.discriminator.layout.span),this.layout?Er[this.property]=this.layout.decode(br,wr+kr):this.property?Er[this.property]=!0:this.union.usesPrefixDiscriminator&&(Er[this.union.discriminator.property]=this.variant),Er}encode(br,wr,Er=0){let kr=0;if(this.union.usesPrefixDiscriminator&&(kr=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(br,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,wr,Er);let jr=kr;if(this.layout&&(this.layout.encode(br[this.property],wr,Er+kr),jr+=this.layout.getSpan(wr,Er+kr),0<=this.union.span&&jr>this.union.span))throw new Error("encoded variant overruns containing union");return jr}fromArray(br){if(this.layout)return this.layout.fromArray(br)}}Layout$1.VariantLayout=VariantLayout;function fixBitwiseResult(fr){return 0>fr&&(fr+=4294967296),fr}class BitStructure extends Layout{constructor(br,wr,Er){if(!(br instanceof UInt||br instanceof UIntBE))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof wr=="string"&&Er===void 0&&(Er=wr,wr=!1),4=wr)throw new TypeError("bits must be positive integer");const kr=8*br.span,jr=br.fields.reduce((Br,Wr)=>Br+Wr.bits,0);if(wr+jr>kr)throw new Error("bits too long for span remainder ("+(kr-jr)+" of "+kr+" remain)");this.container=br,this.bits=wr,this.valueMask=(1<>>this.start}encode(br){if(typeof br!="number"||!Number.isInteger(br)||br!==fixBitwiseResult(br&this.valueMask))throw new TypeError(nameWithProperty("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const wr=this.container._packedGetValue(),Er=fixBitwiseResult(br<Er&&(Er=this.length.decode(br,wr)),Er}decode(br,wr=0){let Er=this.span;return 0>Er&&(Er=this.length.decode(br,wr)),uint8ArrayToBuffer(br).slice(wr,wr+Er)}encode(br,wr,Er){let kr=this.length;if(this.length instanceof ExternalLayout&&(kr=br.length),!(br instanceof Uint8Array&&kr===br.length))throw new TypeError(nameWithProperty("Blob.encode",this)+" requires (length "+kr+") Uint8Array as src");if(Er+kr>wr.length)throw new RangeError("encoding overruns Uint8Array");const jr=uint8ArrayToBuffer(br);return uint8ArrayToBuffer(wr).write(jr.toString("hex"),Er,kr,"hex"),this.length instanceof ExternalLayout&&this.length.encode(kr,wr,Er),kr}};Layout$1.Blob=Blob$1;class CString extends Layout{constructor(br){super(-1,br)}getSpan(br,wr=0){checkUint8Array(br);let Er=wr;for(;Erwr.length)throw new RangeError("encoding overruns Buffer");const Br=uint8ArrayToBuffer(wr);return kr.copy(Br,Er),Br[Er+jr]=0,jr+1}}Layout$1.CString=CString;class UTF8 extends Layout{constructor(br,wr){if(typeof br=="string"&&wr===void 0&&(wr=br,br=void 0),br===void 0)br=-1;else if(!Number.isInteger(br))throw new TypeError("maxSpan must be an integer");super(-1,wr),this.maxSpan=br}getSpan(br,wr=0){return checkUint8Array(br),br.length-wr}decode(br,wr=0){const Er=this.getSpan(br,wr);if(0<=this.maxSpan&&this.maxSpanwr.length)throw new RangeError("encoding overruns Buffer");return kr.copy(uint8ArrayToBuffer(wr),Er),jr}}Layout$1.UTF8=UTF8;class Constant extends Layout{constructor(br,wr){super(0,wr),this.value=br}decode(br,wr){return this.value}encode(br,wr,Er){return 0}}Layout$1.Constant=Constant;Layout$1.greedy=(fr,br)=>new GreedyCount(fr,br);var offset=Layout$1.offset=(fr,br,wr)=>new OffsetLayout(fr,br,wr),u8=Layout$1.u8=fr=>new UInt(1,fr),u16=Layout$1.u16=fr=>new UInt(2,fr);Layout$1.u24=fr=>new UInt(3,fr);var u32=Layout$1.u32=fr=>new UInt(4,fr);Layout$1.u40=fr=>new UInt(5,fr);Layout$1.u48=fr=>new UInt(6,fr);var nu64=Layout$1.nu64=fr=>new NearUInt64(fr);Layout$1.u16be=fr=>new UIntBE(2,fr);Layout$1.u24be=fr=>new UIntBE(3,fr);Layout$1.u32be=fr=>new UIntBE(4,fr);Layout$1.u40be=fr=>new UIntBE(5,fr);Layout$1.u48be=fr=>new UIntBE(6,fr);Layout$1.nu64be=fr=>new NearUInt64BE(fr);Layout$1.s8=fr=>new Int(1,fr);Layout$1.s16=fr=>new Int(2,fr);Layout$1.s24=fr=>new Int(3,fr);Layout$1.s32=fr=>new Int(4,fr);Layout$1.s40=fr=>new Int(5,fr);Layout$1.s48=fr=>new Int(6,fr);var ns64=Layout$1.ns64=fr=>new NearInt64(fr);Layout$1.s16be=fr=>new IntBE(2,fr);Layout$1.s24be=fr=>new IntBE(3,fr);Layout$1.s32be=fr=>new IntBE(4,fr);Layout$1.s40be=fr=>new IntBE(5,fr);Layout$1.s48be=fr=>new IntBE(6,fr);Layout$1.ns64be=fr=>new NearInt64BE(fr);Layout$1.f32=fr=>new Float(fr);Layout$1.f32be=fr=>new FloatBE(fr);Layout$1.f64=fr=>new Double(fr);Layout$1.f64be=fr=>new DoubleBE(fr);var struct=Layout$1.struct=(fr,br,wr)=>new Structure(fr,br,wr);Layout$1.bits=(fr,br,wr)=>new BitStructure(fr,br,wr);var seq=Layout$1.seq=(fr,br,wr)=>new Sequence(fr,br,wr);Layout$1.union=(fr,br,wr)=>new Union(fr,br,wr);Layout$1.unionLayoutDiscriminator=(fr,br)=>new UnionLayoutDiscriminator(fr,br);var blob=Layout$1.blob=(fr,br)=>new Blob$1(fr,br);Layout$1.cstr=fr=>new CString(fr);Layout$1.utf8=(fr,br)=>new UTF8(fr,br);Layout$1.constant=(fr,br)=>new Constant(fr,br);var browser$1={};Object.defineProperty(browser$1,"__esModule",{value:!0});function toBigIntLE(fr){{const br=Buffer$2.from(fr);br.reverse();const wr=br.toString("hex");return wr.length===0?BigInt(0):BigInt(`0x${wr}`)}}var toBigIntLE_1=browser$1.toBigIntLE=toBigIntLE;function toBigIntBE(fr){{const br=fr.toString("hex");return br.length===0?BigInt(0):BigInt(`0x${br}`)}}browser$1.toBigIntBE=toBigIntBE;function toBufferLE(fr,br){{const wr=fr.toString(16),Er=Buffer$2.from(wr.padStart(br*2,"0").slice(0,br*2),"hex");return Er.reverse(),Er}}var toBufferLE_1=browser$1.toBufferLE=toBufferLE;function toBufferBE(fr,br){{const wr=fr.toString(16);return Buffer$2.from(wr.padStart(br*2,"0").slice(0,br*2),"hex")}}browser$1.toBufferBE=toBufferBE;let StructError$2=class extends TypeError{constructor(br,wr){let Er;const{message:kr,explanation:jr,...Br}=br,{path:Wr}=br,qr=Wr.length===0?kr:`At path: ${Wr.join(".")} -- ${kr}`;super(jr??qr),jr!=null&&(this.cause=qr),Object.assign(this,Br),this.name=this.constructor.name,this.failures=()=>Er??(Er=[br,...wr()])}};function isIterable$2(fr){return isObject$2(fr)&&typeof fr[Symbol.iterator]=="function"}function isObject$2(fr){return typeof fr=="object"&&fr!=null}function print$2(fr){return typeof fr=="symbol"?fr.toString():typeof fr=="string"?JSON.stringify(fr):`${fr}`}function shiftIterator$2(fr){const{done:br,value:wr}=fr.next();return br?void 0:wr}function toFailure$2(fr,br,wr,Er){if(fr===!0)return;fr===!1?fr={}:typeof fr=="string"&&(fr={message:fr});const{path:kr,branch:jr}=br,{type:Br}=wr,{refinement:Wr,message:qr=`Expected a value of type \`${Br}\`${Wr?` with refinement \`${Wr}\``:""}, but received: \`${print$2(Er)}\``}=fr;return{value:Er,type:Br,refinement:Wr,key:kr[kr.length-1],path:kr,branch:jr,...fr,message:qr}}function*toFailures$2(fr,br,wr,Er){isIterable$2(fr)||(fr=[fr]);for(const kr of fr){const jr=toFailure$2(kr,br,wr,Er);jr&&(yield jr)}}function*run$2(fr,br,wr={}){const{path:Er=[],branch:kr=[fr],coerce:jr=!1,mask:Br=!1}=wr,Wr={path:Er,branch:kr};if(jr&&(fr=br.coercer(fr,Wr),Br&&br.type!=="type"&&isObject$2(br.schema)&&isObject$2(fr)&&!Array.isArray(fr)))for(const Gr in fr)br.schema[Gr]===void 0&&delete fr[Gr];let qr="valid";for(const Gr of br.validator(fr,Wr))Gr.explanation=wr.message,qr="not_valid",yield[Gr,void 0];for(let[Gr,Vr,Zr]of br.entries(fr,Wr)){const Jr=run$2(Vr,Zr,{path:Gr===void 0?Er:[...Er,Gr],branch:Gr===void 0?kr:[...kr,Vr],coerce:jr,mask:Br,message:wr.message});for(const Qr of Jr)Qr[0]?(qr=Qr[0].refinement!=null?"not_refined":"not_valid",yield[Qr[0],void 0]):jr&&(Vr=Qr[1],Gr===void 0?fr=Vr:fr instanceof Map?fr.set(Gr,Vr):fr instanceof Set?fr.add(Vr):isObject$2(fr)&&(Vr!==void 0||Gr in fr)&&(fr[Gr]=Vr))}if(qr!=="not_valid")for(const Gr of br.refiner(fr,Wr))Gr.explanation=wr.message,qr="not_refined",yield[Gr,void 0];qr==="valid"&&(yield[void 0,fr])}let Struct$5=class{constructor(br){const{type:wr,schema:Er,validator:kr,refiner:jr,coercer:Br=qr=>qr,entries:Wr=function*(){}}=br;this.type=wr,this.schema=Er,this.entries=Wr,this.coercer=Br,kr?this.validator=(qr,Gr)=>{const Vr=kr(qr,Gr);return toFailures$2(Vr,Gr,this,qr)}:this.validator=()=>[],jr?this.refiner=(qr,Gr)=>{const Vr=jr(qr,Gr);return toFailures$2(Vr,Gr,this,qr)}:this.refiner=()=>[]}assert(br,wr){return assert$3(br,this,wr)}create(br,wr){return create$2(br,this,wr)}is(br){return is$2(br,this)}mask(br,wr){return mask$2(br,this,wr)}validate(br,wr={}){return validate$3(br,this,wr)}};function assert$3(fr,br,wr){const Er=validate$3(fr,br,{message:wr});if(Er[0])throw Er[0]}function create$2(fr,br,wr){const Er=validate$3(fr,br,{coerce:!0,message:wr});if(Er[0])throw Er[0];return Er[1]}function mask$2(fr,br,wr){const Er=validate$3(fr,br,{coerce:!0,mask:!0,message:wr});if(Er[0])throw Er[0];return Er[1]}function is$2(fr,br){return!validate$3(fr,br)[0]}function validate$3(fr,br,wr={}){const Er=run$2(fr,br,wr),kr=shiftIterator$2(Er);return kr[0]?[new StructError$2(kr[0],function*(){for(const Br of Er)Br[0]&&(yield Br[0])}),void 0]:[void 0,kr[1]]}function define$2(fr,br){return new Struct$5({type:fr,schema:null,validator:br})}function any$2(){return define$2("any",()=>!0)}function array$2(fr){return new Struct$5({type:"array",schema:fr,*entries(br){if(fr&&Array.isArray(br))for(const[wr,Er]of br.entries())yield[wr,Er,fr]},coercer(br){return Array.isArray(br)?br.slice():br},validator(br){return Array.isArray(br)||`Expected an array value, but received: ${print$2(br)}`}})}function boolean$2(){return define$2("boolean",fr=>typeof fr=="boolean")}function instance$2(fr){return define$2("instance",br=>br instanceof fr||`Expected a \`${fr.name}\` instance, but received: ${print$2(br)}`)}function literal$2(fr){const br=print$2(fr),wr=typeof fr;return new Struct$5({type:"literal",schema:wr==="string"||wr==="number"||wr==="boolean"?fr:null,validator(Er){return Er===fr||`Expected the literal \`${br}\`, but received: ${print$2(Er)}`}})}function never$2(){return define$2("never",()=>!1)}function nullable$2(fr){return new Struct$5({...fr,validator:(br,wr)=>br===null||fr.validator(br,wr),refiner:(br,wr)=>br===null||fr.refiner(br,wr)})}function number$2(){return define$2("number",fr=>typeof fr=="number"&&!isNaN(fr)||`Expected a number, but received: ${print$2(fr)}`)}function optional$2(fr){return new Struct$5({...fr,validator:(br,wr)=>br===void 0||fr.validator(br,wr),refiner:(br,wr)=>br===void 0||fr.refiner(br,wr)})}function record$2(fr,br){return new Struct$5({type:"record",schema:null,*entries(wr){if(isObject$2(wr))for(const Er in wr){const kr=wr[Er];yield[Er,Er,fr],yield[Er,kr,br]}},validator(wr){return isObject$2(wr)||`Expected an object, but received: ${print$2(wr)}`}})}function string$2(){return define$2("string",fr=>typeof fr=="string"||`Expected a string, but received: ${print$2(fr)}`)}function tuple$2(fr){const br=never$2();return new Struct$5({type:"tuple",schema:null,*entries(wr){if(Array.isArray(wr)){const Er=Math.max(fr.length,wr.length);for(let kr=0;krwr.type).join(" | ");return new Struct$5({type:"union",schema:null,coercer(wr){for(const Er of fr){const[kr,jr]=Er.validate(wr,{coerce:!0});if(!kr)return jr}return wr},validator(wr,Er){const kr=[];for(const jr of fr){const[...Br]=run$2(wr,jr,Er),[Wr]=Br;if(Wr[0])for(const[qr]of Br)qr&&kr.push(qr);else return[]}return[`Expected the value to satisfy a union of \`${br}\`, but received: ${print$2(wr)}`,...kr]}})}function unknown$2(){return define$2("unknown",()=>!0)}function coerce$2(fr,br,wr){return new Struct$5({...fr,coercer:(Er,kr)=>is$2(Er,br)?fr.coercer(wr(Er,kr),kr):fr.coercer(Er,kr)})}var getRandomValues,rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}const REGEX=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function validate$2(fr){return typeof fr=="string"&®EX.test(fr)}var byteToHex=[];for(var i=0;i<256;++i)byteToHex.push((i+256).toString(16).substr(1));function stringify$1(fr){var br=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,wr=(byteToHex[fr[br+0]]+byteToHex[fr[br+1]]+byteToHex[fr[br+2]]+byteToHex[fr[br+3]]+"-"+byteToHex[fr[br+4]]+byteToHex[fr[br+5]]+"-"+byteToHex[fr[br+6]]+byteToHex[fr[br+7]]+"-"+byteToHex[fr[br+8]]+byteToHex[fr[br+9]]+"-"+byteToHex[fr[br+10]]+byteToHex[fr[br+11]]+byteToHex[fr[br+12]]+byteToHex[fr[br+13]]+byteToHex[fr[br+14]]+byteToHex[fr[br+15]]).toLowerCase();if(!validate$2(wr))throw TypeError("Stringified UUID is invalid");return wr}var _nodeId,_clockseq,_lastMSecs=0,_lastNSecs=0;function v1(fr,br,wr){var Er=br&&wr||0,kr=br||new Array(16);fr=fr||{};var jr=fr.node||_nodeId,Br=fr.clockseq!==void 0?fr.clockseq:_clockseq;if(jr==null||Br==null){var Wr=fr.random||(fr.rng||rng)();jr==null&&(jr=_nodeId=[Wr[0]|1,Wr[1],Wr[2],Wr[3],Wr[4],Wr[5]]),Br==null&&(Br=_clockseq=(Wr[6]<<8|Wr[7])&16383)}var qr=fr.msecs!==void 0?fr.msecs:Date.now(),Gr=fr.nsecs!==void 0?fr.nsecs:_lastNSecs+1,Vr=qr-_lastMSecs+(Gr-_lastNSecs)/1e4;if(Vr<0&&fr.clockseq===void 0&&(Br=Br+1&16383),(Vr<0||qr>_lastMSecs)&&fr.nsecs===void 0&&(Gr=0),Gr>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=qr,_lastNSecs=Gr,_clockseq=Br,qr+=122192928e5;var Zr=((qr&268435455)*1e4+Gr)%4294967296;kr[Er++]=Zr>>>24&255,kr[Er++]=Zr>>>16&255,kr[Er++]=Zr>>>8&255,kr[Er++]=Zr&255;var Jr=qr/4294967296*1e4&268435455;kr[Er++]=Jr>>>8&255,kr[Er++]=Jr&255,kr[Er++]=Jr>>>24&15|16,kr[Er++]=Jr>>>16&255,kr[Er++]=Br>>>8|128,kr[Er++]=Br&255;for(var Qr=0;Qr<6;++Qr)kr[Er+Qr]=jr[Qr];return br||stringify$1(kr)}function parse(fr){if(!validate$2(fr))throw TypeError("Invalid UUID");var br,wr=new Uint8Array(16);return wr[0]=(br=parseInt(fr.slice(0,8),16))>>>24,wr[1]=br>>>16&255,wr[2]=br>>>8&255,wr[3]=br&255,wr[4]=(br=parseInt(fr.slice(9,13),16))>>>8,wr[5]=br&255,wr[6]=(br=parseInt(fr.slice(14,18),16))>>>8,wr[7]=br&255,wr[8]=(br=parseInt(fr.slice(19,23),16))>>>8,wr[9]=br&255,wr[10]=(br=parseInt(fr.slice(24,36),16))/1099511627776&255,wr[11]=br/4294967296&255,wr[12]=br>>>24&255,wr[13]=br>>>16&255,wr[14]=br>>>8&255,wr[15]=br&255,wr}function stringToBytes(fr){fr=unescape(encodeURIComponent(fr));for(var br=[],wr=0;wr>5]>>>kr%32&255,Br=parseInt(Er.charAt(jr>>>4&15)+Er.charAt(jr&15),16);br.push(Br)}return br}function getOutputLength(fr){return(fr+64>>>9<<4)+14+1}function wordsToMd5(fr,br){fr[br>>5]|=128<>5]|=(fr[Er/8]&255)<>16)+(br>>16)+(wr>>16);return Er<<16|wr&65535}function bitRotateLeft(fr,br){return fr<>>32-br}function md5cmn(fr,br,wr,Er,kr,jr){return safeAdd(bitRotateLeft(safeAdd(safeAdd(br,fr),safeAdd(Er,jr)),kr),wr)}function md5ff(fr,br,wr,Er,kr,jr,Br){return md5cmn(br&wr|~br&Er,fr,br,kr,jr,Br)}function md5gg(fr,br,wr,Er,kr,jr,Br){return md5cmn(br&Er|wr&~Er,fr,br,kr,jr,Br)}function md5hh(fr,br,wr,Er,kr,jr,Br){return md5cmn(br^wr^Er,fr,br,kr,jr,Br)}function md5ii(fr,br,wr,Er,kr,jr,Br){return md5cmn(wr^(br|~Er),fr,br,kr,jr,Br)}var v3=v35("v3",48,md5);function v4(fr,br,wr){fr=fr||{};var Er=fr.random||(fr.rng||rng)();if(Er[6]=Er[6]&15|64,Er[8]=Er[8]&63|128,br){wr=wr||0;for(var kr=0;kr<16;++kr)br[wr+kr]=Er[kr];return br}return stringify$1(Er)}function f(fr,br,wr,Er){switch(fr){case 0:return br&wr^~br&Er;case 1:return br^wr^Er;case 2:return br&wr^br&Er^wr&Er;case 3:return br^wr^Er}}function ROTL(fr,br){return fr<>>32-br}function sha1(fr){var br=[1518500249,1859775393,2400959708,3395469782],wr=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof fr=="string"){var Er=unescape(encodeURIComponent(fr));fr=[];for(var kr=0;kr>>0;jn=An,An=In,In=ROTL(Cn,30)>>>0,Cn=En,En=to}wr[0]=wr[0]+En>>>0,wr[1]=wr[1]+Cn>>>0,wr[2]=wr[2]+In>>>0,wr[3]=wr[3]+An>>>0,wr[4]=wr[4]+jn>>>0}return[wr[0]>>24&255,wr[0]>>16&255,wr[0]>>8&255,wr[0]&255,wr[1]>>24&255,wr[1]>>16&255,wr[1]>>8&255,wr[1]&255,wr[2]>>24&255,wr[2]>>16&255,wr[2]>>8&255,wr[2]&255,wr[3]>>24&255,wr[3]>>16&255,wr[3]>>8&255,wr[3]&255,wr[4]>>24&255,wr[4]>>16&255,wr[4]>>8&255,wr[4]&255]}var v5=v35("v5",80,sha1);const nil="00000000-0000-0000-0000-000000000000";function version$5(fr){if(!validate$2(fr))throw TypeError("Invalid UUID");return parseInt(fr.substr(14,1),16)}const esmBrowser=Object.freeze(Object.defineProperty({__proto__:null,NIL:nil,parse,stringify:stringify$1,v1,v3,v4,v5,validate:validate$2,version:version$5},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(esmBrowser),uuid$1=require$$0.v4,generateRequest$1=function(fr,br,wr,Er){if(typeof fr!="string")throw new TypeError(fr+" must be a string");Er=Er||{};const kr=typeof Er.version=="number"?Er.version:2;if(kr!==1&&kr!==2)throw new TypeError(kr+" must be 1 or 2");const jr={method:fr};if(kr===2&&(jr.jsonrpc="2.0"),br){if(typeof br!="object"&&!Array.isArray(br))throw new TypeError(br+" must be an object, array or omitted");jr.params=br}if(typeof wr>"u"){const Br=typeof Er.generator=="function"?Er.generator:function(){return uuid$1()};jr.id=Br(jr,Er)}else kr===2&&wr===null?Er.notificationIdNull&&(jr.id=null):jr.id=wr;return jr};var generateRequest_1=generateRequest$1;const uuid=require$$0.v4,generateRequest=generateRequest_1,ClientBrowser=function(fr,br){if(!(this instanceof ClientBrowser))return new ClientBrowser(fr,br);br||(br={}),this.options={reviver:typeof br.reviver<"u"?br.reviver:null,replacer:typeof br.replacer<"u"?br.replacer:null,generator:typeof br.generator<"u"?br.generator:function(){return uuid()},version:typeof br.version<"u"?br.version:2,notificationIdNull:typeof br.notificationIdNull=="boolean"?br.notificationIdNull:!1},this.callServer=fr};var browser=ClientBrowser;ClientBrowser.prototype.request=function(fr,br,wr,Er){const kr=this;let jr=null;const Br=Array.isArray(fr)&&typeof br=="function";if(this.options.version===1&&Br)throw new TypeError("JSON-RPC 1.0 does not support batching");if(Br||!Br&&fr&&typeof fr=="object"&&typeof br=="function")Er=br,jr=fr;else{typeof wr=="function"&&(Er=wr,wr=void 0);const Gr=typeof Er=="function";try{jr=generateRequest(fr,br,wr,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(Vr){if(Gr)return Er(Vr);throw Vr}if(!Gr)return jr}let qr;try{qr=JSON.stringify(jr,this.options.replacer)}catch(Gr){return Er(Gr)}return this.callServer(qr,function(Gr,Vr){kr._parseResponse(Gr,Vr,Er)}),jr};ClientBrowser.prototype._parseResponse=function(fr,br,wr){if(fr){wr(fr);return}if(!br)return wr();let Er;try{Er=JSON.parse(br,this.options.reviver)}catch(kr){return wr(kr)}if(wr.length===3)if(Array.isArray(Er)){const kr=function(Br){return typeof Br.error<"u"},jr=function(Br){return!kr(Br)};return wr(null,Er.filter(kr),Er.filter(jr))}else return wr(null,Er.error,Er.result);wr(null,Er)};const RpcClient=getDefaultExportFromCjs$2(browser);var client={},eventemitter3={exports:{}};(function(fr){var br=Object.prototype.hasOwnProperty,wr="~";function Er(){}Object.create&&(Er.prototype=Object.create(null),new Er().__proto__||(wr=!1));function kr(qr,Gr,Vr){this.fn=qr,this.context=Gr,this.once=Vr||!1}function jr(qr,Gr,Vr,Zr,Jr){if(typeof Vr!="function")throw new TypeError("The listener must be a function");var Qr=new kr(Vr,Zr||qr,Jr),_n=wr?wr+Gr:Gr;return qr._events[_n]?qr._events[_n].fn?qr._events[_n]=[qr._events[_n],Qr]:qr._events[_n].push(Qr):(qr._events[_n]=Qr,qr._eventsCount++),qr}function Br(qr,Gr){--qr._eventsCount===0?qr._events=new Er:delete qr._events[Gr]}function Wr(){this._events=new Er,this._eventsCount=0}Wr.prototype.eventNames=function(){var Gr=[],Vr,Zr;if(this._eventsCount===0)return Gr;for(Zr in Vr=this._events)br.call(Vr,Zr)&&Gr.push(wr?Zr.slice(1):Zr);return Object.getOwnPropertySymbols?Gr.concat(Object.getOwnPropertySymbols(Vr)):Gr},Wr.prototype.listeners=function(Gr){var Vr=wr?wr+Gr:Gr,Zr=this._events[Vr];if(!Zr)return[];if(Zr.fn)return[Zr.fn];for(var Jr=0,Qr=Zr.length,_n=new Array(Qr);Jr++this.rpc_id),Vr?this.dataPack=Vr:this.dataPack=new utils_cjs_1.DefaultDataPack,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(wr,Er,kr,jr){return!jr&&typeof kr=="object"&&(jr=kr,kr=null),new Promise((Br,Wr)=>{if(!this.ready)return Wr(new Error("socket not ready"));const qr=this.generate_request_id(wr,Er),Gr={jsonrpc:"2.0",method:wr,params:Er||void 0,id:qr};this.socket.send(this.dataPack.encode(Gr),jr,Vr=>{if(Vr)return Wr(Vr);this.queue[qr]={promise:[Br,Wr]},kr&&(this.queue[qr].timeout=setTimeout(()=>{delete this.queue[qr],Wr(new Error("reply timeout"))},kr))})})}async login(wr){const Er=await this.call("rpc.login",wr);if(!Er)throw new Error("authentication failed");return Er}async listMethods(){return await this.call("__listMethods")}notify(wr,Er){return new Promise((kr,jr)=>{if(!this.ready)return jr(new Error("socket not ready"));const Br={jsonrpc:"2.0",method:wr,params:Er};this.socket.send(this.dataPack.encode(Br),Wr=>{if(Wr)return jr(Wr);kr()})})}async subscribe(wr){typeof wr=="string"&&(wr=[wr]);const Er=await this.call("rpc.on",wr);if(typeof wr=="string"&&Er[wr]!=="ok")throw new Error("Failed subscribing to an event '"+wr+"' with: "+Er[wr]);return Er}async unsubscribe(wr){typeof wr=="string"&&(wr=[wr]);const Er=await this.call("rpc.off",wr);if(typeof wr=="string"&&Er[wr]!=="ok")throw new Error("Failed unsubscribing from an event with: "+Er);return Er}close(wr,Er){this.socket.close(wr||1e3,Er)}setAutoReconnect(wr){this.reconnect=wr}setReconnectInterval(wr){this.reconnect_interval=wr}setMaxReconnects(wr){this.max_reconnects=wr}_connect(wr,Er){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(wr,Er),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:kr})=>{kr instanceof ArrayBuffer&&(kr=Buffer$2.from(kr).toString());try{kr=this.dataPack.decode(kr)}catch{return}if(kr.notification&&this.listeners(kr.notification).length){if(!Object.keys(kr.params).length)return this.emit(kr.notification);const jr=[kr.notification];if(kr.params.constructor===Object)jr.push(kr.params);else for(let Br=0;Br{this.emit.apply(this,jr)})}if(!this.queue[kr.id])return kr.method?Promise.resolve().then(()=>{this.emit(kr.method,kr==null?void 0:kr.params)}):void 0;"error"in kr=="result"in kr&&this.queue[kr.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[kr.id].timeout&&clearTimeout(this.queue[kr.id].timeout),kr.error?this.queue[kr.id].promise[1](kr.error):this.queue[kr.id].promise[0](kr.result),delete this.queue[kr.id]}),this.socket.addEventListener("error",kr=>this.emit("error",kr)),this.socket.addEventListener("close",({code:kr,reason:jr})=>{this.ready&&setTimeout(()=>this.emit("close",kr,jr),0),this.ready=!1,this.socket=void 0,kr!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)&&(this.reconnect_timer_id=setTimeout(()=>this._connect(wr,Er),this.reconnect_interval)))})}}var _default$1=client.default=CommonClient,websocket_browser={};Object.defineProperty(websocket_browser,"__esModule",{value:!0});const eventemitter3_1=eventemitter3Exports;class WebSocketBrowserImpl extends eventemitter3_1.EventEmitter{constructor(wr,Er,kr){super();Uu(this,"socket");this.socket=new window.WebSocket(wr,kr),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=jr=>this.emit("message",jr.data),this.socket.onerror=jr=>this.emit("error",jr),this.socket.onclose=jr=>{this.emit("close",jr.code,jr.reason)}}send(wr,Er,kr){const jr=kr||Er;try{this.socket.send(wr),jr()}catch(Br){jr(Br)}}close(wr,Er){this.socket.close(wr,Er)}addEventListener(wr,Er,kr){this.socket.addEventListener(wr,Er,kr)}}function default_1(fr,br){return new WebSocketBrowserImpl(fr,br)}var _default=websocket_browser.default=default_1;function isOnCurve$2(fr){try{return ed25519.ExtendedPoint.fromHex(fr),!0}catch{return!1}}const sign=(fr,br)=>ed25519.sign(fr,br.slice(0,32)),verify=ed25519.verify,toBuffer$2=fr=>Buffer$1$1.isBuffer(fr)?fr:fr instanceof Uint8Array?Buffer$1$1.from(fr.buffer,fr.byteOffset,fr.byteLength):Buffer$1$1.from(fr);let Struct$4=class{constructor(br){Object.assign(this,br)}encode(){return Buffer$1$1.from(serialize_1(SOLANA_SCHEMA$2,this))}static decode(br){return deserialize_1(SOLANA_SCHEMA$2,this,br)}static decodeUnchecked(br){return deserializeUnchecked_1(SOLANA_SCHEMA$2,this,br)}};const SOLANA_SCHEMA$2=new Map;var _PublicKey$2;const MAX_SEED_LENGTH$2=32,PUBLIC_KEY_LENGTH$2=32;function isPublicKeyData$2(fr){return fr._bn!==void 0}let uniquePublicKeyCounter$2=1,PublicKey$2=class d1 extends Struct$4{constructor(br){if(super({}),this._bn=void 0,isPublicKeyData$2(br))this._bn=br._bn;else{if(typeof br=="string"){const wr=bs58$6.decode(br);if(wr.length!=PUBLIC_KEY_LENGTH$2)throw new Error("Invalid public key input");this._bn=new BN$2(wr)}else this._bn=new BN$2(br);if(this._bn.byteLength()>PUBLIC_KEY_LENGTH$2)throw new Error("Invalid public key input")}}static unique(){const br=new d1(uniquePublicKeyCounter$2);return uniquePublicKeyCounter$2+=1,new d1(br.toBuffer())}equals(br){return this._bn.eq(br._bn)}toBase58(){return bs58$6.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const br=this.toBuffer();return new Uint8Array(br.buffer,br.byteOffset,br.byteLength)}toBuffer(){const br=this._bn.toArrayLike(Buffer$1$1);if(br.length===PUBLIC_KEY_LENGTH$2)return br;const wr=Buffer$1$1.alloc(32);return br.copy(wr,32-br.length),wr}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(br,wr,Er){const kr=Buffer$1$1.concat([br.toBuffer(),Buffer$1$1.from(wr),Er.toBuffer()]),jr=sha256$4(kr);return new d1(jr)}static createProgramAddressSync(br,wr){let Er=Buffer$1$1.alloc(0);br.forEach(function(jr){if(jr.length>MAX_SEED_LENGTH$2)throw new TypeError("Max seed length exceeded");Er=Buffer$1$1.concat([Er,toBuffer$2(jr)])}),Er=Buffer$1$1.concat([Er,wr.toBuffer(),Buffer$1$1.from("ProgramDerivedAddress")]);const kr=sha256$4(Er);if(isOnCurve$2(kr))throw new Error("Invalid seeds, address must fall off the curve");return new d1(kr)}static async createProgramAddress(br,wr){return this.createProgramAddressSync(br,wr)}static findProgramAddressSync(br,wr){let Er=255,kr;for(;Er!=0;){try{const jr=br.concat(Buffer$1$1.from([Er]));kr=this.createProgramAddressSync(jr,wr)}catch(jr){if(jr instanceof TypeError)throw jr;Er--;continue}return[kr,Er]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(br,wr){return this.findProgramAddressSync(br,wr)}static isOnCurve(br){const wr=new d1(br);return isOnCurve$2(wr.toBytes())}};_PublicKey$2=PublicKey$2;PublicKey$2.default=new _PublicKey$2("11111111111111111111111111111111");SOLANA_SCHEMA$2.set(PublicKey$2,{kind:"struct",fields:[["_bn","u256"]]});new PublicKey$2("BPFLoader1111111111111111111111111111111111");const PACKET_DATA_SIZE=1232,VERSION_PREFIX_MASK=127,SIGNATURE_LENGTH_IN_BYTES$2=64;class TransactionExpiredBlockheightExceededError extends Error{constructor(br){super(`Signature ${br} has expired: block height exceeded.`),this.signature=void 0,this.signature=br}}Object.defineProperty(TransactionExpiredBlockheightExceededError.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class TransactionExpiredTimeoutError extends Error{constructor(br,wr){super(`Transaction was not confirmed in ${wr.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${br} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=br}}Object.defineProperty(TransactionExpiredTimeoutError.prototype,"name",{value:"TransactionExpiredTimeoutError"});class TransactionExpiredNonceInvalidError extends Error{constructor(br){super(`Signature ${br} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=br}}Object.defineProperty(TransactionExpiredNonceInvalidError.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class MessageAccountKeys{constructor(br,wr){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=br,this.accountKeysFromLookups=wr}keySegments(){const br=[this.staticAccountKeys];return this.accountKeysFromLookups&&(br.push(this.accountKeysFromLookups.writable),br.push(this.accountKeysFromLookups.readonly)),br}get(br){for(const wr of this.keySegments()){if(br256)throw new Error("Account index overflow encountered during compilation");const Er=new Map;this.keySegments().flat().forEach((jr,Br)=>{Er.set(jr.toBase58(),Br)});const kr=jr=>{const Br=Er.get(jr.toBase58());if(Br===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return Br};return br.map(jr=>({programIdIndex:kr(jr.programId),accountKeyIndexes:jr.keys.map(Br=>kr(Br.pubkey)),data:jr.data}))}}const publicKey$3=(fr="publicKey")=>blob(32,fr),signature=(fr="signature")=>blob(64,fr),rustString$2=(fr="string")=>{const br=struct([u32("length"),u32("lengthPadding"),blob(offset(u32(),-8),"chars")],fr),wr=br.decode.bind(br),Er=br.encode.bind(br),kr=br;return kr.decode=(jr,Br)=>wr(jr,Br).chars.toString(),kr.encode=(jr,Br,Wr)=>{const qr={chars:Buffer$1$1.from(jr,"utf8")};return Er(qr,Br,Wr)},kr.alloc=jr=>u32().span+u32().span+Buffer$1$1.from(jr,"utf8").length,kr},authorized$2=(fr="authorized")=>struct([publicKey$3("staker"),publicKey$3("withdrawer")],fr),lockup$2=(fr="lockup")=>struct([ns64("unixTimestamp"),ns64("epoch"),publicKey$3("custodian")],fr),voteInit$2=(fr="voteInit")=>struct([publicKey$3("nodePubkey"),publicKey$3("authorizedVoter"),publicKey$3("authorizedWithdrawer"),u8("commission")],fr),voteAuthorizeWithSeedArgs$2=(fr="voteAuthorizeWithSeedArgs")=>struct([u32("voteAuthorizationType"),publicKey$3("currentAuthorityDerivedKeyOwnerPubkey"),rustString$2("currentAuthorityDerivedKeySeed"),publicKey$3("newAuthorized")],fr);function getAlloc(fr,br){const wr=kr=>{if(kr.span>=0)return kr.span;if(typeof kr.alloc=="function")return kr.alloc(br[kr.property]);if("count"in kr&&"elementLayout"in kr){const jr=br[kr.property];if(Array.isArray(jr))return jr.length*wr(kr.elementLayout)}else if("fields"in kr)return getAlloc({layout:kr},br[kr.property]);return 0};let Er=0;return fr.layout.fields.forEach(kr=>{Er+=wr(kr)}),Er}function decodeLength(fr){let br=0,wr=0;for(;;){let Er=fr.shift();if(br|=(Er&127)<>=7,wr==0){fr.push(Er);break}else Er|=128,fr.push(Er)}}function assert$2(fr,br){if(!fr)throw new Error(br||"Assertion failed")}class CompiledKeys{constructor(br,wr){this.payer=void 0,this.keyMetaMap=void 0,this.payer=br,this.keyMetaMap=wr}static compile(br,wr){const Er=new Map,kr=Br=>{const Wr=Br.toBase58();let qr=Er.get(Wr);return qr===void 0&&(qr={isSigner:!1,isWritable:!1,isInvoked:!1},Er.set(Wr,qr)),qr},jr=kr(wr);jr.isSigner=!0,jr.isWritable=!0;for(const Br of br){kr(Br.programId).isInvoked=!0;for(const Wr of Br.keys){const qr=kr(Wr.pubkey);qr.isSigner||(qr.isSigner=Wr.isSigner),qr.isWritable||(qr.isWritable=Wr.isWritable)}}return new CompiledKeys(wr,Er)}getMessageComponents(){const br=[...this.keyMetaMap.entries()];assert$2(br.length<=256,"Max static account keys length exceeded");const wr=br.filter(([,qr])=>qr.isSigner&&qr.isWritable),Er=br.filter(([,qr])=>qr.isSigner&&!qr.isWritable),kr=br.filter(([,qr])=>!qr.isSigner&&qr.isWritable),jr=br.filter(([,qr])=>!qr.isSigner&&!qr.isWritable),Br={numRequiredSignatures:wr.length+Er.length,numReadonlySignedAccounts:Er.length,numReadonlyUnsignedAccounts:jr.length};{assert$2(wr.length>0,"Expected at least one writable signer key");const[qr]=wr[0];assert$2(qr===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const Wr=[...wr.map(([qr])=>new PublicKey$2(qr)),...Er.map(([qr])=>new PublicKey$2(qr)),...kr.map(([qr])=>new PublicKey$2(qr)),...jr.map(([qr])=>new PublicKey$2(qr))];return[Br,Wr]}extractTableLookup(br){const[wr,Er]=this.drainKeysFoundInLookupTable(br.state.addresses,Br=>!Br.isSigner&&!Br.isInvoked&&Br.isWritable),[kr,jr]=this.drainKeysFoundInLookupTable(br.state.addresses,Br=>!Br.isSigner&&!Br.isInvoked&&!Br.isWritable);if(!(wr.length===0&&kr.length===0))return[{accountKey:br.key,writableIndexes:wr,readonlyIndexes:kr},{writable:Er,readonly:jr}]}drainKeysFoundInLookupTable(br,wr){const Er=new Array,kr=new Array;for(const[jr,Br]of this.keyMetaMap.entries())if(wr(Br)){const Wr=new PublicKey$2(jr),qr=br.findIndex(Gr=>Gr.equals(Wr));qr>=0&&(assert$2(qr<256,"Max lookup table index exceeded"),Er.push(qr),kr.push(Wr),this.keyMetaMap.delete(jr))}return[Er,kr]}}const END_OF_BUFFER_ERROR_MESSAGE="Reached end of buffer unexpectedly";function guardedShift(fr){if(fr.length===0)throw new Error(END_OF_BUFFER_ERROR_MESSAGE);return fr.shift()}function guardedSplice(fr,...br){const[wr]=br;if(br.length===2?wr+(br[1]??0)>fr.length:wr>=fr.length)throw new Error(END_OF_BUFFER_ERROR_MESSAGE);return fr.splice(...br)}class Message{constructor(br){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=br.header,this.accountKeys=br.accountKeys.map(wr=>new PublicKey$2(wr)),this.recentBlockhash=br.recentBlockhash,this.instructions=br.instructions,this.instructions.forEach(wr=>this.indexToProgramIds.set(wr.programIdIndex,this.accountKeys[wr.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(br=>({programIdIndex:br.programIdIndex,accountKeyIndexes:br.accounts,data:bs58$6.decode(br.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new MessageAccountKeys(this.staticAccountKeys)}static compile(br){const wr=CompiledKeys.compile(br.instructions,br.payerKey),[Er,kr]=wr.getMessageComponents(),Br=new MessageAccountKeys(kr).compileInstructions(br.instructions).map(Wr=>({programIdIndex:Wr.programIdIndex,accounts:Wr.accountKeyIndexes,data:bs58$6.encode(Wr.data)}));return new Message({header:Er,accountKeys:kr,recentBlockhash:br.recentBlockhash,instructions:Br})}isAccountSigner(br){return br=this.header.numRequiredSignatures){const Er=br-wr,jr=this.accountKeys.length-wr-this.header.numReadonlyUnsignedAccounts;return Er!this.isProgramId(wr))}serialize(){const br=this.accountKeys.length;let wr=[];encodeLength(wr,br);const Er=this.instructions.map(Zr=>{const{accounts:Jr,programIdIndex:Qr}=Zr,_n=Array.from(bs58$6.decode(Zr.data));let En=[];encodeLength(En,Jr.length);let Cn=[];return encodeLength(Cn,_n.length),{programIdIndex:Qr,keyIndicesCount:Buffer$1$1.from(En),keyIndices:Jr,dataLength:Buffer$1$1.from(Cn),data:_n}});let kr=[];encodeLength(kr,Er.length);let jr=Buffer$1$1.alloc(PACKET_DATA_SIZE);Buffer$1$1.from(kr).copy(jr);let Br=kr.length;Er.forEach(Zr=>{const Qr=struct([u8("programIdIndex"),blob(Zr.keyIndicesCount.length,"keyIndicesCount"),seq(u8("keyIndex"),Zr.keyIndices.length,"keyIndices"),blob(Zr.dataLength.length,"dataLength"),seq(u8("userdatum"),Zr.data.length,"data")]).encode(Zr,jr,Br);Br+=Qr}),jr=jr.slice(0,Br);const Wr=struct([blob(1,"numRequiredSignatures"),blob(1,"numReadonlySignedAccounts"),blob(1,"numReadonlyUnsignedAccounts"),blob(wr.length,"keyCount"),seq(publicKey$3("key"),br,"keys"),publicKey$3("recentBlockhash")]),qr={numRequiredSignatures:Buffer$1$1.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Buffer$1$1.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Buffer$1$1.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Buffer$1$1.from(wr),keys:this.accountKeys.map(Zr=>toBuffer$2(Zr.toBytes())),recentBlockhash:bs58$6.decode(this.recentBlockhash)};let Gr=Buffer$1$1.alloc(2048);const Vr=Wr.encode(qr,Gr);return jr.copy(Gr,Vr),Gr.slice(0,Vr+jr.length)}static from(br){let wr=[...br];const Er=guardedShift(wr);if(Er!==(Er&VERSION_PREFIX_MASK))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const kr=guardedShift(wr),jr=guardedShift(wr),Br=decodeLength(wr);let Wr=[];for(let Jr=0;Jr0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new MessageAccountKeys(this.staticAccountKeys,wr)}isAccountSigner(br){return br=Er){const kr=br-Er,jr=this.addressTableLookups.reduce((Br,Wr)=>Br+Wr.writableIndexes.length,0);return kr=this.header.numRequiredSignatures){const kr=br-wr,Br=Er-wr-this.header.numReadonlyUnsignedAccounts;return krjr.key.equals(Er.accountKey));if(!kr)throw new Error(`Failed to find address lookup table account for table key ${Er.accountKey.toBase58()}`);for(const jr of Er.writableIndexes)if(jrVr.toBytes()),recentBlockhash:bs58$6.decode(this.recentBlockhash),instructionsLength:new Uint8Array(Er),serializedInstructions:wr,addressTableLookupsLength:new Uint8Array(jr),serializedAddressTableLookups:kr},Wr);return Wr.slice(0,Gr)}serializeInstructions(){let br=0;const wr=new Uint8Array(PACKET_DATA_SIZE);for(const Er of this.compiledInstructions){const kr=Array();encodeLength(kr,Er.accountKeyIndexes.length);const jr=Array();encodeLength(jr,Er.data.length);const Br=struct([u8("programIdIndex"),blob(kr.length,"encodedAccountKeyIndexesLength"),seq(u8(),Er.accountKeyIndexes.length,"accountKeyIndexes"),blob(jr.length,"encodedDataLength"),blob(Er.data.length,"data")]);br+=Br.encode({programIdIndex:Er.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(kr),accountKeyIndexes:Er.accountKeyIndexes,encodedDataLength:new Uint8Array(jr),data:Er.data},wr,br)}return wr.slice(0,br)}serializeAddressTableLookups(){let br=0;const wr=new Uint8Array(PACKET_DATA_SIZE);for(const Er of this.addressTableLookups){const kr=Array();encodeLength(kr,Er.writableIndexes.length);const jr=Array();encodeLength(jr,Er.readonlyIndexes.length);const Br=struct([publicKey$3("accountKey"),blob(kr.length,"encodedWritableIndexesLength"),seq(u8(),Er.writableIndexes.length,"writableIndexes"),blob(jr.length,"encodedReadonlyIndexesLength"),seq(u8(),Er.readonlyIndexes.length,"readonlyIndexes")]);br+=Br.encode({accountKey:Er.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(kr),writableIndexes:Er.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(jr),readonlyIndexes:Er.readonlyIndexes},wr,br)}return wr.slice(0,br)}static deserialize(br){let wr=[...br];const Er=guardedShift(wr),kr=Er&VERSION_PREFIX_MASK;assert$2(Er!==kr,"Expected versioned message but received legacy message");const jr=kr;assert$2(jr===0,`Expected versioned message with version 0 but found version ${jr}`);const Br={numRequiredSignatures:guardedShift(wr),numReadonlySignedAccounts:guardedShift(wr),numReadonlyUnsignedAccounts:guardedShift(wr)},Wr=[],qr=decodeLength(wr);for(let _n=0;_n{const br=VersionedMessage.deserializeMessageVersion(fr);if(br==="legacy")return Message.from(fr);if(br===0)return MessageV0.deserialize(fr);throw new Error(`Transaction message version ${br} deserialization is not supported`)}};let TransactionStatus=function(fr){return fr[fr.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",fr[fr.PROCESSED=1]="PROCESSED",fr[fr.TIMED_OUT=2]="TIMED_OUT",fr[fr.NONCE_INVALID=3]="NONCE_INVALID",fr}({});const DEFAULT_SIGNATURE=Buffer$1$1.alloc(SIGNATURE_LENGTH_IN_BYTES$2).fill(0);class TransactionInstruction{constructor(br){this.keys=void 0,this.programId=void 0,this.data=Buffer$1$1.alloc(0),this.programId=br.programId,this.keys=br.keys,br.data&&(this.data=br.data)}toJSON(){return{keys:this.keys.map(({pubkey:br,isSigner:wr,isWritable:Er})=>({pubkey:br.toJSON(),isSigner:wr,isWritable:Er})),programId:this.programId.toJSON(),data:[...this.data]}}}class Transaction{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(br){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!br)if(br.feePayer&&(this.feePayer=br.feePayer),br.signatures&&(this.signatures=br.signatures),Object.prototype.hasOwnProperty.call(br,"nonceInfo")){const{minContextSlot:wr,nonceInfo:Er}=br;this.minNonceContextSlot=wr,this.nonceInfo=Er}else if(Object.prototype.hasOwnProperty.call(br,"lastValidBlockHeight")){const{blockhash:wr,lastValidBlockHeight:Er}=br;this.recentBlockhash=wr,this.lastValidBlockHeight=Er}else{const{recentBlockhash:wr,nonceInfo:Er}=br;Er&&(this.nonceInfo=Er),this.recentBlockhash=wr}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(br=>br.toJSON()),signers:this.signatures.map(({publicKey:br})=>br.toJSON())}}add(...br){if(br.length===0)throw new Error("No instructions");return br.forEach(wr=>{"instructions"in wr?this.instructions=this.instructions.concat(wr.instructions):"data"in wr&&"programId"in wr&&"keys"in wr?this.instructions.push(wr):this.instructions.push(new TransactionInstruction(wr))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let br,wr;if(this.nonceInfo?(br=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?wr=[this.nonceInfo.nonceInstruction,...this.instructions]:wr=this.instructions):(br=this.recentBlockhash,wr=this.instructions),!br)throw new Error("Transaction recentBlockhash required");wr.length<1&&console.warn("No instructions provided");let Er;if(this.feePayer)Er=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)Er=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let En=0;En{En.keys.forEach(In=>{jr.push({...In})});const Cn=En.programId.toString();kr.includes(Cn)||kr.push(Cn)}),kr.forEach(En=>{jr.push({pubkey:new PublicKey$2(En),isSigner:!1,isWritable:!1})});const Br=[];jr.forEach(En=>{const Cn=En.pubkey.toString(),In=Br.findIndex(An=>An.pubkey.toString()===Cn);In>-1?(Br[In].isWritable=Br[In].isWritable||En.isWritable,Br[In].isSigner=Br[In].isSigner||En.isSigner):Br.push(En)}),Br.sort(function(En,Cn){if(En.isSigner!==Cn.isSigner)return En.isSigner?-1:1;if(En.isWritable!==Cn.isWritable)return En.isWritable?-1:1;const In={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return En.pubkey.toBase58().localeCompare(Cn.pubkey.toBase58(),"en",In)});const Wr=Br.findIndex(En=>En.pubkey.equals(Er));if(Wr>-1){const[En]=Br.splice(Wr,1);En.isSigner=!0,En.isWritable=!0,Br.unshift(En)}else Br.unshift({pubkey:Er,isSigner:!0,isWritable:!0});for(const En of this.signatures){const Cn=Br.findIndex(In=>In.pubkey.equals(En.publicKey));if(Cn>-1)Br[Cn].isSigner||(Br[Cn].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${En.publicKey.toString()}`)}let qr=0,Gr=0,Vr=0;const Zr=[],Jr=[];Br.forEach(({pubkey:En,isSigner:Cn,isWritable:In})=>{Cn?(Zr.push(En.toString()),qr+=1,In||(Gr+=1)):(Jr.push(En.toString()),In||(Vr+=1))});const Qr=Zr.concat(Jr),_n=wr.map(En=>{const{data:Cn,programId:In}=En;return{programIdIndex:Qr.indexOf(In.toString()),accounts:En.keys.map(An=>Qr.indexOf(An.pubkey.toString())),data:bs58$6.encode(Cn)}});return _n.forEach(En=>{assert$2(En.programIdIndex>=0),En.accounts.forEach(Cn=>assert$2(Cn>=0))}),new Message({header:{numRequiredSignatures:qr,numReadonlySignedAccounts:Gr,numReadonlyUnsignedAccounts:Vr},accountKeys:Qr,recentBlockhash:br,instructions:_n})}_compile(){const br=this.compileMessage(),wr=br.accountKeys.slice(0,br.header.numRequiredSignatures);return this.signatures.length===wr.length&&this.signatures.every((kr,jr)=>wr[jr].equals(kr.publicKey))||(this.signatures=wr.map(Er=>({signature:null,publicKey:Er}))),br}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(br){return(await br.getFeeForMessage(this.compileMessage())).value}setSigners(...br){if(br.length===0)throw new Error("No signers");const wr=new Set;this.signatures=br.filter(Er=>{const kr=Er.toString();return wr.has(kr)?!1:(wr.add(kr),!0)}).map(Er=>({signature:null,publicKey:Er}))}sign(...br){if(br.length===0)throw new Error("No signers");const wr=new Set,Er=[];for(const jr of br){const Br=jr.publicKey.toString();wr.has(Br)||(wr.add(Br),Er.push(jr))}this.signatures=Er.map(jr=>({signature:null,publicKey:jr.publicKey}));const kr=this._compile();this._partialSign(kr,...Er)}partialSign(...br){if(br.length===0)throw new Error("No signers");const wr=new Set,Er=[];for(const jr of br){const Br=jr.publicKey.toString();wr.has(Br)||(wr.add(Br),Er.push(jr))}const kr=this._compile();this._partialSign(kr,...Er)}_partialSign(br,...wr){const Er=br.serialize();wr.forEach(kr=>{const jr=sign(Er,kr.secretKey);this._addSignature(kr.publicKey,toBuffer$2(jr))})}addSignature(br,wr){this._compile(),this._addSignature(br,wr)}_addSignature(br,wr){assert$2(wr.length===64);const Er=this.signatures.findIndex(kr=>br.equals(kr.publicKey));if(Er<0)throw new Error(`unknown signer: ${br.toString()}`);this.signatures[Er].signature=Buffer$1$1.from(wr)}verifySignatures(br=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),br)}_getMessageSignednessErrors(br,wr){const Er={};for(const{signature:kr,publicKey:jr}of this.signatures)kr===null?wr&&(Er.missing||(Er.missing=[])).push(jr):verify(kr,br,jr.toBytes())||(Er.invalid||(Er.invalid=[])).push(jr);return Er.invalid||Er.missing?Er:void 0}serialize(br){const{requireAllSignatures:wr,verifySignatures:Er}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},br),kr=this.serializeMessage();if(Er){const jr=this._getMessageSignednessErrors(kr,wr);if(jr){let Br="Signature verification failed.";throw jr.invalid&&(Br+=` +}`;var Su=$x(function(){return Mu($o,eu+"return "+Rl).apply(wr,To)});if(Su.source=Rl,Q1(Su))throw Su;return Su}function h$(Yr){return Ou(Yr).toLowerCase()}function p$(Yr){return Ou(Yr).toUpperCase()}function m$(Yr,$n,Yn){if(Yr=Ou(Yr),Yr&&(Yn||$n===wr))return wy(Yr);if(!Yr||!($n=Ip($n)))return Yr;var ao=qp(Yr),ho=qp($n),$o=_y(ao,ho),To=Ey(ao,ho)+1;return mm(ao,$o,To).join("")}function g$(Yr,$n,Yn){if(Yr=Ou(Yr),Yr&&(Yn||$n===wr))return Yr.slice(0,Sy(Yr)+1);if(!Yr||!($n=Ip($n)))return Yr;var ao=qp(Yr),ho=Ey(ao,qp($n))+1;return mm(ao,0,ho).join("")}function y$(Yr,$n,Yn){if(Yr=Ou(Yr),Yr&&(Yn||$n===wr))return Yr.replace(So,"");if(!Yr||!($n=Ip($n)))return Yr;var ao=qp(Yr),ho=_y(ao,qp($n));return mm(ao,ho).join("")}function v$(Yr,$n){var Yn=co,ao=so;if(_f($n)){var ho="separator"in $n?$n.separator:ho;Yn="length"in $n?$u($n.length):Yn,ao="omission"in $n?Ip($n.omission):ao}Yr=Ou(Yr);var $o=Yr.length;if(Am(Yr)){var To=qp(Yr);$o=To.length}if(Yn>=$o)return Yr;var Po=Yn-Pm(ao);if(Po<1)return ao;var Oo=To?mm(To,0,Po).join(""):Yr.slice(0,Po);if(ho===wr)return Oo+ao;if(To&&(Po+=Oo.length-Po),ey(ho)){if(Yr.slice(Po).search(ho)){var _c,yl=Oo;for(ho.global||(ho=p1(ho.source,Ou($l.exec(ho))+"g")),ho.lastIndex=0;_c=ho.exec(yl);)var Rl=_c.index;Oo=Oo.slice(0,Rl===wr?Po:Rl)}}else if(Yr.indexOf(Ip(ho),Po)!=Po){var Hl=Oo.lastIndexOf(ho);Hl>-1&&(Oo=Oo.slice(0,Hl))}return Oo+ao}function b$(Yr){return Yr=Ou(Yr),Yr&&du.test(Yr)?Yr.replace(xl,Hx):Yr}var x$=Lm(function(Yr,$n,Yn){return Yr+(Yn?" ":"")+$n.toUpperCase()}),ny=Sv("toUpperCase");function Ex(Yr,$n,Yn){return Yr=Ou(Yr),$n=Yn?wr:$n,$n===wr?Fx(Yr)?Zx(Yr):Px(Yr):Yr.match($n)||[]}var $x=ku(function(Yr,$n){try{return mp(Yr,wr,$n)}catch(Yn){return Q1(Yn)?Yn:new xu(Yn)}}),w$=tm(function(Yr,$n){return Mp($n,function(Yn){Yn=Jp(Yn),Qp(Yr,Yn,Y1(Yr[Yn],Yr))}),Yr});function _$(Yr){var $n=Yr==null?0:Yr.length,Yn=cu();return Yr=$n?Gu(Yr,function(ao){if(typeof ao[1]!="function")throw new Op(Br);return[Yn(ao[0]),ao[1]]}):[],ku(function(ao){for(var ho=-1;++ho<$n;){var $o=Yr[ho];if(mp($o[0],this,ao))return mp($o[1],this,ao)}})}function E$(Yr){return Hw(Bp(Yr,Zr))}function iy(Yr){return function(){return Yr}}function $$(Yr,$n){return Yr==null||Yr!==Yr?$n:Yr}var S$=Cv(),k$=Cv(!0);function kp(Yr){return Yr}function oy(Yr){return Vy(typeof Yr=="function"?Yr:Bp(Yr,Zr))}function C$(Yr){return Ky(Bp(Yr,Zr))}function R$(Yr,$n){return Gy(Yr,Bp($n,Zr))}var T$=ku(function(Yr,$n){return function(Yn){return Qm(Yn,Yr,$n)}}),I$=ku(function(Yr,$n){return function(Yn){return Qm(Yr,Yn,$n)}});function ay(Yr,$n,Yn){var ao=sp($n),ho=M0($n,ao);Yn==null&&!(_f($n)&&(ho.length||!ao.length))&&(Yn=$n,$n=Yr,Yr=this,ho=M0($n,sp($n)));var $o=!(_f(Yn)&&"chain"in Yn)||!!Yn.chain,To=nm(Yr);return Mp(ho,function(Po){var Oo=$n[Po];Yr[Po]=Oo,To&&(Yr.prototype[Po]=function(){var _c=this.__chain__;if($o||_c){var yl=Yr(this.__wrapped__),Rl=yl.__actions__=Ep(this.__actions__);return Rl.push({func:Oo,args:arguments,thisArg:Yr}),yl.__chain__=_c,yl}return Oo.apply(Yr,lm([this.value()],arguments))})}),Yr}function A$(){return Hu._===this&&(Hu._=tw),this}function sy(){}function P$(Yr){return Yr=$u(Yr),ku(function($n){return Zy($n,Yr)})}var N$=D1(Gu),M$=D1(gy),O$=D1(s1);function Sx(Yr){return V1(Yr)?c1(Jp(Yr)):l_(Yr)}function j$(Yr){return function($n){return Yr==null?wr:Em(Yr,$n)}}var B$=Tv(),D$=Tv(!0);function cy(){return[]}function ly(){return!1}function L$(){return{}}function U$(){return""}function F$(){return!0}function W$(Yr,$n){if(Yr=$u(Yr),Yr<1||Yr>Pn)return[];var Yn=Nn,ao=hp(Yr,Nn);$n=cu($n),Yr-=Nn;for(var ho=d1(ao,$n);++Yn0||$n<0)?new Iu(Yn):(Yr<0?Yn=Yn.takeRight(-Yr):Yr&&(Yn=Yn.drop(Yr)),$n!==wr&&($n=$u($n),Yn=$n<0?Yn.dropRight(-$n):Yn.take($n-Yr)),Yn)},Iu.prototype.takeRightWhile=function(Yr){return this.reverse().takeWhile(Yr).reverse()},Iu.prototype.toArray=function(){return this.take(Nn)},Gp(Iu.prototype,function(Yr,$n){var Yn=/^(?:filter|find|map|reject)|While$/.test($n),ao=/^(?:head|last)$/.test($n),ho=xo[ao?"take"+($n=="last"?"Right":""):$n],$o=ao||/^find/.test($n);ho&&(xo.prototype[$n]=function(){var To=this.__wrapped__,Po=ao?[1]:arguments,Oo=To instanceof Iu,_c=Po[0],yl=Oo||wu(To),Rl=function(Ru){var Pu=ho.apply(xo,lm([Ru],Po));return ao&&Hl?Pu[0]:Pu};yl&&Yn&&typeof _c=="function"&&_c.length!=1&&(Oo=yl=!1);var Hl=this.__chain__,eu=!!this.__actions__.length,lu=$o&&!Hl,Su=Oo&&!eu;if(!$o&&yl){To=Su?To:new Iu(this);var uu=Yr.apply(To,Po);return uu.__actions__.push({func:H0,args:[Rl],thisArg:wr}),new jp(uu,Hl)}return lu&&Su?Yr.apply(this,Po):(uu=this.thru(Rl),lu?ao?uu.value()[0]:uu.value():uu)})}),Mp(["pop","push","shift","sort","splice","unshift"],function(Yr){var $n=v0[Yr],Yn=/^(?:push|sort|unshift)$/.test(Yr)?"tap":"thru",ao=/^(?:pop|shift)$/.test(Yr);xo.prototype[Yr]=function(){var ho=arguments;if(ao&&!this.__chain__){var $o=this.value();return $n.apply(wu($o)?$o:[],ho)}return this[Yn](function(To){return $n.apply(wu(To)?To:[],ho)})}}),Gp(Iu.prototype,function(Yr,$n){var Yn=xo[$n];if(Yn){var ao=Yn.name+"";ju.call(jm,ao)||(jm[ao]=[]),jm[ao].push({name:$n,func:Yn})}}),jm[L0(wr,In).name]=[{name:"wrapper",func:wr}],Iu.prototype.clone=yw,Iu.prototype.reverse=vw,Iu.prototype.value=bw,xo.prototype.at=G2,xo.prototype.chain=Z2,xo.prototype.commit=J2,xo.prototype.next=Y2,xo.prototype.plant=Q2,xo.prototype.reverse=eE,xo.prototype.toJSON=xo.prototype.valueOf=xo.prototype.value=tE,xo.prototype.first=xo.prototype.head,Hm&&(xo.prototype[Hm]=X2),xo},Nm=Jx();_p?((_p.exports=Nm)._=Nm,gp._=Nm):Hu._=Nm}).call(ge)})(Ui,Ui.exports);var Gg=Object.defineProperty,zg=Object.defineProperties,Kg=Object.getOwnPropertyDescriptors,Ea=Object.getOwnPropertySymbols,Yg=Object.prototype.hasOwnProperty,Zg=Object.prototype.propertyIsEnumerable,ya=(fr,br,wr)=>br in fr?Gg(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,cr=(fr,br)=>{for(var wr in br||(br={}))Yg.call(br,wr)&&ya(fr,wr,br[wr]);if(Ea)for(var wr of Ea(br))Zg.call(br,wr)&&ya(fr,wr,br[wr]);return fr},Jg=(fr,br)=>zg(fr,Kg(br));function ft(fr,br,wr){var Er;const kr=ve(fr);return((Er=br.rpcMap)==null?void 0:Er[kr.reference])||`${Bg}?chainId=${kr.namespace}:${kr.reference}&projectId=${wr}`}function Ct(fr){return fr.includes(":")?fr.split(":")[1]:fr}function Sa(fr){return fr.map(br=>`${br.split(":")[0]}:${br.split(":")[1]}`)}function Xg(fr,br){const wr=Object.keys(br.namespaces).filter(kr=>kr.includes(fr));if(!wr.length)return[];const Er=[];return wr.forEach(kr=>{const jr=br.namespaces[kr].accounts;Er.push(...jr)}),Er}function Oa(fr={},br={}){const wr=Ra(fr),Er=Ra(br);return Ui.exports.merge(wr,Er)}function Ra(fr){var br,wr,Er,kr;const jr={};if(!B$2(fr))return jr;for(const[Br,Wr]of Object.entries(fr)){const qr=oe(Br)?[Br]:Wr.chains,Gr=Wr.methods||[],Vr=Wr.events||[],Zr=Wr.rpcMap||{},Jr=en(Br);jr[Jr]=Jg(cr(cr({},jr[Jr]),Wr),{chains:S$2(qr,(br=jr[Jr])==null?void 0:br.chains),methods:S$2(Gr,(wr=jr[Jr])==null?void 0:wr.methods),events:S$2(Vr,(Er=jr[Jr])==null?void 0:Er.events),rpcMap:cr(cr({},Zr),(kr=jr[Jr])==null?void 0:kr.rpcMap)})}return jr}function Qg(fr){return fr.includes(":")?fr.split(":")[2]:fr}function Vg(fr){const br={};for(const[wr,Er]of Object.entries(fr)){const kr=Er.methods||[],jr=Er.events||[],Br=Er.accounts||[],Wr=oe(wr)?[wr]:Er.chains?Er.chains:Sa(Er.accounts);br[wr]={chains:Wr,methods:kr,events:jr,accounts:Br}}return br}function Wi(fr){return typeof fr=="number"?fr:fr.includes("0x")?parseInt(fr,16):(fr=fr.includes(":")?fr.split(":")[1]:fr,isNaN(Number(fr))?fr:Number(fr))}const ba={},z$2=fr=>ba[fr],Fi=(fr,br)=>{ba[fr]=br};class kg{constructor(br){this.name="polkadot",this.namespace=br.namespace,this.events=z$2("events"),this.client=z$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(br){this.namespace=Object.assign(this.namespace,br)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const br=this.namespace.chains[0];if(!br)throw new Error("ChainId not found");return br.split(":")[1]}request(br){return this.namespace.methods.includes(br.request.method)?this.client.request(br):this.getHttpProvider().request(br.request)}setDefaultChain(br,wr){this.httpProviders[br]||this.setHttpProvider(br,wr),this.chainId=br,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${br}`)}getAccounts(){const br=this.namespace.accounts;return br?br.filter(wr=>wr.split(":")[1]===this.chainId.toString()).map(wr=>wr.split(":")[2])||[]:[]}createHttpProviders(){const br={};return this.namespace.chains.forEach(wr=>{var Er;const kr=Ct(wr);br[kr]=this.createHttpProvider(kr,(Er=this.namespace.rpcMap)==null?void 0:Er[wr])}),br}getHttpProvider(){const br=`${this.name}:${this.chainId}`,wr=this.httpProviders[br];if(typeof wr>"u")throw new Error(`JSON-RPC provider for ${br} not found`);return wr}setHttpProvider(br,wr){const Er=this.createHttpProvider(br,wr);Er&&(this.httpProviders[br]=Er)}createHttpProvider(br,wr){const Er=wr||ft(br,this.namespace,this.client.core.projectId);if(!Er)throw new Error(`No RPC url provided for chainId: ${br}`);return new JsonRpcProvider(new f$4(Er,z$2("disableProviderPing")))}}class jg{constructor(br){this.name="eip155",this.namespace=br.namespace,this.events=z$2("events"),this.client=z$2("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(br){switch(br.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(br);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(br.request.method)?await this.client.request(br):this.getHttpProvider().request(br.request)}updateNamespace(br){this.namespace=Object.assign(this.namespace,br)}setDefaultChain(br,wr){this.httpProviders[br]||this.setHttpProvider(parseInt(br),wr),this.chainId=parseInt(br),this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${br}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const br=this.namespace.chains[0];if(!br)throw new Error("ChainId not found");return br.split(":")[1]}createHttpProvider(br,wr){const Er=wr||ft(`${this.name}:${br}`,this.namespace,this.client.core.projectId);if(!Er)throw new Error(`No RPC url provided for chainId: ${br}`);return new JsonRpcProvider(new f$4(Er,z$2("disableProviderPing")))}setHttpProvider(br,wr){const Er=this.createHttpProvider(br,wr);Er&&(this.httpProviders[br]=Er)}createHttpProviders(){const br={};return this.namespace.chains.forEach(wr=>{var Er;const kr=parseInt(Ct(wr));br[kr]=this.createHttpProvider(kr,(Er=this.namespace.rpcMap)==null?void 0:Er[wr])}),br}getAccounts(){const br=this.namespace.accounts;return br?[...new Set(br.filter(wr=>wr.split(":")[1]===this.chainId.toString()).map(wr=>wr.split(":")[2]))]:[]}getHttpProvider(){const br=this.chainId,wr=this.httpProviders[br];if(typeof wr>"u")throw new Error(`JSON-RPC provider for ${br} not found`);return wr}async handleSwitchChain(br){var wr,Er;let kr=br.request.params?(wr=br.request.params[0])==null?void 0:wr.chainId:"0x0";kr=kr.startsWith("0x")?kr:`0x${kr}`;const jr=parseInt(kr,16);if(this.isChainApproved(jr))this.setDefaultChain(`${jr}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:br.topic,request:{method:br.request.method,params:[{chainId:kr}]},chainId:(Er=this.namespace.chains)==null?void 0:Er[0]}),this.setDefaultChain(`${jr}`);else throw new Error(`Failed to switch to chain 'eip155:${jr}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(br){return this.namespace.chains.includes(`${this.name}:${br}`)}}class nv{constructor(br){this.name="solana",this.namespace=br.namespace,this.events=z$2("events"),this.client=z$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(br){this.namespace=Object.assign(this.namespace,br)}requestAccounts(){return this.getAccounts()}request(br){return this.namespace.methods.includes(br.request.method)?this.client.request(br):this.getHttpProvider().request(br.request)}setDefaultChain(br,wr){this.httpProviders[br]||this.setHttpProvider(br,wr),this.chainId=br,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${br}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const br=this.namespace.chains[0];if(!br)throw new Error("ChainId not found");return br.split(":")[1]}getAccounts(){const br=this.namespace.accounts;return br?[...new Set(br.filter(wr=>wr.split(":")[1]===this.chainId.toString()).map(wr=>wr.split(":")[2]))]:[]}createHttpProviders(){const br={};return this.namespace.chains.forEach(wr=>{var Er;const kr=Ct(wr);br[kr]=this.createHttpProvider(kr,(Er=this.namespace.rpcMap)==null?void 0:Er[wr])}),br}getHttpProvider(){const br=`${this.name}:${this.chainId}`,wr=this.httpProviders[br];if(typeof wr>"u")throw new Error(`JSON-RPC provider for ${br} not found`);return wr}setHttpProvider(br,wr){const Er=this.createHttpProvider(br,wr);Er&&(this.httpProviders[br]=Er)}createHttpProvider(br,wr){const Er=wr||ft(br,this.namespace,this.client.core.projectId);if(!Er)throw new Error(`No RPC url provided for chainId: ${br}`);return new JsonRpcProvider(new f$4(Er,z$2("disableProviderPing")))}}class tv{constructor(br){this.name="cosmos",this.namespace=br.namespace,this.events=z$2("events"),this.client=z$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(br){this.namespace=Object.assign(this.namespace,br)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const br=this.namespace.chains[0];if(!br)throw new Error("ChainId not found");return br.split(":")[1]}request(br){return this.namespace.methods.includes(br.request.method)?this.client.request(br):this.getHttpProvider().request(br.request)}setDefaultChain(br,wr){this.httpProviders[br]||this.setHttpProvider(br,wr),this.chainId=br,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const br=this.namespace.accounts;return br?[...new Set(br.filter(wr=>wr.split(":")[1]===this.chainId.toString()).map(wr=>wr.split(":")[2]))]:[]}createHttpProviders(){const br={};return this.namespace.chains.forEach(wr=>{var Er;const kr=Ct(wr);br[kr]=this.createHttpProvider(kr,(Er=this.namespace.rpcMap)==null?void 0:Er[wr])}),br}getHttpProvider(){const br=`${this.name}:${this.chainId}`,wr=this.httpProviders[br];if(typeof wr>"u")throw new Error(`JSON-RPC provider for ${br} not found`);return wr}setHttpProvider(br,wr){const Er=this.createHttpProvider(br,wr);Er&&(this.httpProviders[br]=Er)}createHttpProvider(br,wr){const Er=wr||ft(br,this.namespace,this.client.core.projectId);if(!Er)throw new Error(`No RPC url provided for chainId: ${br}`);return new JsonRpcProvider(new f$4(Er,z$2("disableProviderPing")))}}class ev{constructor(br){this.name="cip34",this.namespace=br.namespace,this.events=z$2("events"),this.client=z$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(br){this.namespace=Object.assign(this.namespace,br)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const br=this.namespace.chains[0];if(!br)throw new Error("ChainId not found");return br.split(":")[1]}request(br){return this.namespace.methods.includes(br.request.method)?this.client.request(br):this.getHttpProvider().request(br.request)}setDefaultChain(br,wr){this.httpProviders[br]||this.setHttpProvider(br,wr),this.chainId=br,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const br=this.namespace.accounts;return br?[...new Set(br.filter(wr=>wr.split(":")[1]===this.chainId.toString()).map(wr=>wr.split(":")[2]))]:[]}createHttpProviders(){const br={};return this.namespace.chains.forEach(wr=>{const Er=this.getCardanoRPCUrl(wr),kr=Ct(wr);br[kr]=this.createHttpProvider(kr,Er)}),br}getHttpProvider(){const br=`${this.name}:${this.chainId}`,wr=this.httpProviders[br];if(typeof wr>"u")throw new Error(`JSON-RPC provider for ${br} not found`);return wr}getCardanoRPCUrl(br){const wr=this.namespace.rpcMap;if(wr)return wr[br]}setHttpProvider(br,wr){const Er=this.createHttpProvider(br,wr);Er&&(this.httpProviders[br]=Er)}createHttpProvider(br,wr){const Er=wr||this.getCardanoRPCUrl(br);if(!Er)throw new Error(`No RPC url provided for chainId: ${br}`);return new JsonRpcProvider(new f$4(Er,z$2("disableProviderPing")))}}class rv{constructor(br){this.name="elrond",this.namespace=br.namespace,this.events=z$2("events"),this.client=z$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(br){this.namespace=Object.assign(this.namespace,br)}requestAccounts(){return this.getAccounts()}request(br){return this.namespace.methods.includes(br.request.method)?this.client.request(br):this.getHttpProvider().request(br.request)}setDefaultChain(br,wr){this.httpProviders[br]||this.setHttpProvider(br,wr),this.chainId=br,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${br}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const br=this.namespace.chains[0];if(!br)throw new Error("ChainId not found");return br.split(":")[1]}getAccounts(){const br=this.namespace.accounts;return br?[...new Set(br.filter(wr=>wr.split(":")[1]===this.chainId.toString()).map(wr=>wr.split(":")[2]))]:[]}createHttpProviders(){const br={};return this.namespace.chains.forEach(wr=>{var Er;const kr=Ct(wr);br[kr]=this.createHttpProvider(kr,(Er=this.namespace.rpcMap)==null?void 0:Er[wr])}),br}getHttpProvider(){const br=`${this.name}:${this.chainId}`,wr=this.httpProviders[br];if(typeof wr>"u")throw new Error(`JSON-RPC provider for ${br} not found`);return wr}setHttpProvider(br,wr){const Er=this.createHttpProvider(br,wr);Er&&(this.httpProviders[br]=Er)}createHttpProvider(br,wr){const Er=wr||ft(br,this.namespace,this.client.core.projectId);if(!Er)throw new Error(`No RPC url provided for chainId: ${br}`);return new JsonRpcProvider(new f$4(Er,z$2("disableProviderPing")))}}class iv{constructor(br){this.name="multiversx",this.namespace=br.namespace,this.events=z$2("events"),this.client=z$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(br){this.namespace=Object.assign(this.namespace,br)}requestAccounts(){return this.getAccounts()}request(br){return this.namespace.methods.includes(br.request.method)?this.client.request(br):this.getHttpProvider().request(br.request)}setDefaultChain(br,wr){this.httpProviders[br]||this.setHttpProvider(br,wr),this.chainId=br,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${br}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const br=this.namespace.chains[0];if(!br)throw new Error("ChainId not found");return br.split(":")[1]}getAccounts(){const br=this.namespace.accounts;return br?[...new Set(br.filter(wr=>wr.split(":")[1]===this.chainId.toString()).map(wr=>wr.split(":")[2]))]:[]}createHttpProviders(){const br={};return this.namespace.chains.forEach(wr=>{var Er;const kr=Ct(wr);br[kr]=this.createHttpProvider(kr,(Er=this.namespace.rpcMap)==null?void 0:Er[wr])}),br}getHttpProvider(){const br=`${this.name}:${this.chainId}`,wr=this.httpProviders[br];if(typeof wr>"u")throw new Error(`JSON-RPC provider for ${br} not found`);return wr}setHttpProvider(br,wr){const Er=this.createHttpProvider(br,wr);Er&&(this.httpProviders[br]=Er)}createHttpProvider(br,wr){const Er=wr||ft(br,this.namespace,this.client.core.projectId);if(!Er)throw new Error(`No RPC url provided for chainId: ${br}`);return new JsonRpcProvider(new f$4(Er,z$2("disableProviderPing")))}}class sv{constructor(br){this.name="near",this.namespace=br.namespace,this.events=z$2("events"),this.client=z$2("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(br){this.namespace=Object.assign(this.namespace,br)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const br=this.namespace.chains[0];if(!br)throw new Error("ChainId not found");return br.split(":")[1]}request(br){return this.namespace.methods.includes(br.request.method)?this.client.request(br):this.getHttpProvider().request(br.request)}setDefaultChain(br,wr){if(this.chainId=br,!this.httpProviders[br]){const Er=wr||ft(`${this.name}:${br}`,this.namespace);if(!Er)throw new Error(`No RPC url provided for chainId: ${br}`);this.setHttpProvider(br,Er)}this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const br=this.namespace.accounts;return br?br.filter(wr=>wr.split(":")[1]===this.chainId.toString()).map(wr=>wr.split(":")[2])||[]:[]}createHttpProviders(){const br={};return this.namespace.chains.forEach(wr=>{var Er;br[wr]=this.createHttpProvider(wr,(Er=this.namespace.rpcMap)==null?void 0:Er[wr])}),br}getHttpProvider(){const br=`${this.name}:${this.chainId}`,wr=this.httpProviders[br];if(typeof wr>"u")throw new Error(`JSON-RPC provider for ${br} not found`);return wr}setHttpProvider(br,wr){const Er=this.createHttpProvider(br,wr);Er&&(this.httpProviders[br]=Er)}createHttpProvider(br,wr){const Er=wr||ft(br,this.namespace);return typeof Er>"u"?void 0:new JsonRpcProvider(new f$4(Er,z$2("disableProviderPing")))}}var uv=Object.defineProperty,av=Object.defineProperties,ov=Object.getOwnPropertyDescriptors,Ta=Object.getOwnPropertySymbols,fv=Object.prototype.hasOwnProperty,cv=Object.prototype.propertyIsEnumerable,La=(fr,br,wr)=>br in fr?uv(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,hr=(fr,br)=>{for(var wr in br||(br={}))fv.call(br,wr)&&La(fr,wr,br[wr]);if(Ta)for(var wr of Ta(br))cv.call(br,wr)&&La(fr,wr,br[wr]);return fr},Mi=(fr,br)=>av(fr,ov(br));class lr{constructor(br){this.events=new Ug,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=br,this.logger=typeof(br==null?void 0:br.logger)<"u"&&typeof(br==null?void 0:br.logger)!="string"?br.logger:Hg(k$4({level:(br==null?void 0:br.logger)||Ia})),this.disableProviderPing=(br==null?void 0:br.disableProviderPing)||!1}static async init(br){const wr=new lr(br);return await wr.initialize(),wr}async request(br,wr,Er){const[kr,jr]=this.validateChain(wr);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(kr).request({request:hr({},br),chainId:`${kr}:${jr}`,topic:this.session.topic,expiry:Er})}sendAsync(br,wr,Er,kr){const jr=new Date().getTime();this.request(br,Er,kr).then(Br=>wr(null,formatJsonRpcResult(jr,Br))).catch(Br=>wr(Br,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 br;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(br=this.session)==null?void 0:br.topic,reason:U$1("USER_DISCONNECTED")}),await this.cleanup()}async connect(br){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(br),await this.cleanupPendingPairings(),!br.skipPairing)return await this.pair(br.pairingTopic)}on(br,wr){this.events.on(br,wr)}once(br,wr){this.events.once(br,wr)}removeListener(br,wr){this.events.removeListener(br,wr)}off(br,wr){this.events.off(br,wr)}get isWalletConnect(){return!0}async pair(br){this.shouldAbortPairingAttempt=!1;let wr=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(wr>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:Er,approval:kr}=await this.client.connect({pairingTopic:br,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});Er&&(this.uri=Er,this.events.emit("display_uri",Er)),await kr().then(jr=>{this.session=jr;const Br=Vg(jr.namespaces);this.namespaces=Oa(this.namespaces,Br),this.persist("namespaces",this.namespaces)}).catch(jr=>{if(jr.message!==ae)throw jr;wr++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(br,wr){try{if(!this.session)return;const[Er,kr]=this.validateChain(br);this.getProvider(Er).setDefaultChain(kr,wr)}catch(Er){if(!/Please call connect/.test(Er.message))throw Er}}async cleanupPendingPairings(br={}){this.logger.info("Cleaning up inactive pairings...");const wr=this.client.pairing.getAll();if(k$2(wr)){for(const Er of wr)br.deletePairings?this.client.core.expirer.set(Er.topic,0):await this.client.core.relayer.subscriber.unsubscribe(Er.topic);this.logger.info(`Inactive pairings cleared: ${wr.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 br=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[br]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await Q$1.init({logger:this.providerOpts.logger||Ia,relayUrl:this.providerOpts.relayUrl||Fg,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),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 br=[...new Set(Object.keys(this.session.namespaces).map(wr=>en(wr)))];Fi("client",this.client),Fi("events",this.events),Fi("disableProviderPing",this.disableProviderPing),br.forEach(wr=>{if(!this.session)return;const Er=Xg(wr,this.session),kr=Sa(Er),jr=Oa(this.namespaces,this.optionalNamespaces),Br=Mi(hr({},jr[wr]),{accounts:Er,chains:kr});switch(wr){case"eip155":this.rpcProviders[wr]=new jg({namespace:Br});break;case"solana":this.rpcProviders[wr]=new nv({namespace:Br});break;case"cosmos":this.rpcProviders[wr]=new tv({namespace:Br});break;case"polkadot":this.rpcProviders[wr]=new kg({namespace:Br});break;case"cip34":this.rpcProviders[wr]=new ev({namespace:Br});break;case"elrond":this.rpcProviders[wr]=new rv({namespace:Br});break;case"multiversx":this.rpcProviders[wr]=new iv({namespace:Br});break;case"near":this.rpcProviders[wr]=new sv({namespace:Br});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",br=>{this.events.emit("session_ping",br)}),this.client.on("session_event",br=>{const{params:wr}=br,{event:Er}=wr;if(Er.name==="accountsChanged"){const kr=Er.data;kr&&k$2(kr)&&this.events.emit("accountsChanged",kr.map(Qg))}else if(Er.name==="chainChanged"){const kr=wr.chainId,jr=wr.event.data,Br=en(kr),Wr=Wi(kr)!==Wi(jr)?`${Br}:${Wi(jr)}`:kr;this.onChainChanged(Wr)}else this.events.emit(Er.name,Er.data);this.events.emit("session_event",br)}),this.client.on("session_update",({topic:br,params:wr})=>{var Er;const{namespaces:kr}=wr,jr=(Er=this.client)==null?void 0:Er.session.get(br);this.session=Mi(hr({},jr),{namespaces:kr}),this.onSessionUpdate(),this.events.emit("session_update",{topic:br,params:wr})}),this.client.on("session_delete",async br=>{await this.cleanup(),this.events.emit("session_delete",br),this.events.emit("disconnect",Mi(hr({},U$1("USER_DISCONNECTED")),{data:br.topic}))}),this.on(Vn.DEFAULT_CHAIN_CHANGED,br=>{this.onChainChanged(br,!0)})}getProvider(br){if(!this.rpcProviders[br])throw new Error(`Provider not found: ${br}`);return this.rpcProviders[br]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(br=>{var wr;this.getProvider(br).updateNamespace((wr=this.session)==null?void 0:wr.namespaces[br])})}setNamespaces(br){const{namespaces:wr,optionalNamespaces:Er,sessionProperties:kr}=br;wr&&Object.keys(wr).length&&(this.namespaces=wr),Er&&Object.keys(Er).length&&(this.optionalNamespaces=Er),this.sessionProperties=kr,this.persist("namespaces",wr),this.persist("optionalNamespaces",Er)}validateChain(br){const[wr,Er]=(br==null?void 0:br.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[wr,Er];if(wr&&!Object.keys(this.namespaces||{}).map(Br=>en(Br)).includes(wr))throw new Error(`Namespace '${wr}' is not configured. Please call connect() first with namespace config.`);if(wr&&Er)return[wr,Er];const kr=en(Object.keys(this.namespaces)[0]),jr=this.rpcProviders[kr].getDefaultChain();return[kr,jr]}async requestAccounts(){const[br]=this.validateChain();return await this.getProvider(br).requestAccounts()}onChainChanged(br,wr=!1){if(!this.namespaces)return;const[Er,kr]=this.validateChain(br);kr&&(wr||this.getProvider(Er).setDefaultChain(kr),this.namespaces[Er]?this.namespaces[Er].defaultChain=kr:this.namespaces[`${Er}:${kr}`]?this.namespaces[`${Er}:${kr}`].defaultChain=kr:this.namespaces[`${Er}:${kr}`]={defaultChain:kr},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",kr))}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(br,wr){this.client.core.storage.setItem(`${xa}/${br}`,wr)}async getFromStore(br){return await this.client.core.storage.getItem(`${xa}/${br}`)}}const hv=lr,P$2="wc",S$1="ethereum_provider",$$1=`${P$2}@2:${S$1}:`,j$2="https://rpc.walletconnect.com/v1/",u$2=["eth_sendTransaction","personal_sign"],E$1=["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"],m$2=["chainChanged","accountsChanged"],_$2=["chainChanged","accountsChanged","message","disconnect","connect"];var N$1=Object.defineProperty,q$2=Object.defineProperties,D$2=Object.getOwnPropertyDescriptors,y$2=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,O$1=(fr,br,wr)=>br in fr?N$1(fr,br,{enumerable:!0,configurable:!0,writable:!0,value:wr}):fr[br]=wr,p$2=(fr,br)=>{for(var wr in br||(br={}))U.call(br,wr)&&O$1(fr,wr,br[wr]);if(y$2)for(var wr of y$2(br))Q.call(br,wr)&&O$1(fr,wr,br[wr]);return fr},M$1=(fr,br)=>q$2(fr,D$2(br));function g$2(fr){return Number(fr[0].split(":")[1])}function f$3(fr){return`0x${fr.toString(16)}`}function L$1(fr){const{chains:br,optionalChains:wr,methods:Er,optionalMethods:kr,events:jr,optionalEvents:Br,rpcMap:Wr}=fr;if(!k$6(br))throw new Error("Invalid chains");const qr={chains:br,methods:Er||u$2,events:jr||m$2,rpcMap:p$2({},br.length?{[g$2(br)]:Wr[g$2(br)]}:{})},Gr=jr==null?void 0:jr.filter(Qr=>!m$2.includes(Qr)),Vr=Er==null?void 0:Er.filter(Qr=>!u$2.includes(Qr));if(!wr&&!Br&&!kr&&!(Gr!=null&&Gr.length)&&!(Vr!=null&&Vr.length))return{required:br.length?qr:void 0};const Zr=(Gr==null?void 0:Gr.length)&&(Vr==null?void 0:Vr.length)||!wr,Jr={chains:[...new Set(Zr?qr.chains.concat(wr||[]):wr)],methods:[...new Set(qr.methods.concat(kr!=null&&kr.length?kr:E$1))],events:[...new Set(qr.events.concat(Br!=null&&Br.length?Br:_$2))],rpcMap:Wr};return{required:br.length?qr:void 0,optional:wr.length?Jr:void 0}}let v$2=class dS{constructor(){this.events=new eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=$$1,this.on=(br,wr)=>(this.events.on(br,wr),this),this.once=(br,wr)=>(this.events.once(br,wr),this),this.removeListener=(br,wr)=>(this.events.removeListener(br,wr),this),this.off=(br,wr)=>(this.events.off(br,wr),this),this.parseAccount=br=>this.isCompatibleChainId(br)?this.parseAccountId(br).address:br,this.signer={},this.rpc={}}static async init(br){const wr=new dS;return await wr.initialize(br),wr}async request(br,wr){return await this.signer.request(br,this.formatChainId(this.chainId),wr)}sendAsync(br,wr,Er){this.signer.sendAsync(br,wr,this.formatChainId(this.chainId),Er)}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(br){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(br);const{required:wr,optional:Er}=L$1(this.rpc);try{const kr=await new Promise(async(Br,Wr)=>{var qr;this.rpc.showQrModal&&((qr=this.modal)==null||qr.subscribeModal(Gr=>{!Gr.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),Wr(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(M$1(p$2({namespaces:p$2({},wr&&{[this.namespace]:wr})},Er&&{optionalNamespaces:{[this.namespace]:Er}}),{pairingTopic:br==null?void 0:br.pairingTopic})).then(Gr=>{Br(Gr)}).catch(Gr=>{Wr(new Error(Gr.message))})});if(!kr)return;const jr=Un(kr.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:jr),this.setAccounts(jr),this.events.emit("connect",{chainId:f$3(this.chainId)})}catch(kr){throw this.signer.logger.error(kr),kr}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",br=>{const{params:wr}=br,{event:Er}=wr;Er.name==="accountsChanged"?(this.accounts=this.parseAccounts(Er.data),this.events.emit("accountsChanged",this.accounts)):Er.name==="chainChanged"?this.setChainId(this.formatChainId(Er.data)):this.events.emit(Er.name,Er.data),this.events.emit("session_event",br)}),this.signer.on("chainChanged",br=>{const wr=parseInt(br);this.chainId=wr,this.events.emit("chainChanged",f$3(this.chainId)),this.persist()}),this.signer.on("session_update",br=>{this.events.emit("session_update",br)}),this.signer.on("session_delete",br=>{this.reset(),this.events.emit("session_delete",br),this.events.emit("disconnect",M$1(p$2({},U$4("USER_DISCONNECTED")),{data:br.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",br=>{var wr,Er;this.rpc.showQrModal&&((wr=this.modal)==null||wr.closeModal(),(Er=this.modal)==null||Er.openModal({uri:br})),this.events.emit("display_uri",br)})}switchEthereumChain(br){this.request({method:"wallet_switchEthereumChain",params:[{chainId:br.toString(16)}]})}isCompatibleChainId(br){return typeof br=="string"?br.startsWith(`${this.namespace}:`):!1}formatChainId(br){return`${this.namespace}:${br}`}parseChainId(br){return Number(br.split(":")[1])}setChainIds(br){const wr=br.filter(Er=>this.isCompatibleChainId(Er)).map(Er=>this.parseChainId(Er));wr.length&&(this.chainId=wr[0],this.events.emit("chainChanged",f$3(this.chainId)),this.persist())}setChainId(br){if(this.isCompatibleChainId(br)){const wr=this.parseChainId(br);this.chainId=wr,this.switchEthereumChain(wr)}}parseAccountId(br){const[wr,Er,kr]=br.split(":");return{chainId:`${wr}:${Er}`,address:kr}}setAccounts(br){this.accounts=br.filter(wr=>this.parseChainId(this.parseAccountId(wr).chainId)===this.chainId).map(wr=>this.parseAccountId(wr).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(br){var wr,Er;const kr=(wr=br==null?void 0:br.chains)!=null?wr:[],jr=(Er=br==null?void 0:br.optionalChains)!=null?Er:[],Br=kr.concat(jr);if(!Br.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const Wr=kr.length?(br==null?void 0:br.methods)||u$2:[],qr=kr.length?(br==null?void 0:br.events)||m$2:[],Gr=(br==null?void 0:br.optionalMethods)||[],Vr=(br==null?void 0:br.optionalEvents)||[],Zr=(br==null?void 0:br.rpcMap)||this.buildRpcMap(Br,br.projectId),Jr=(br==null?void 0:br.qrModalOptions)||void 0;return{chains:kr==null?void 0:kr.map(Qr=>this.formatChainId(Qr)),optionalChains:jr.map(Qr=>this.formatChainId(Qr)),methods:Wr,events:qr,optionalMethods:Gr,optionalEvents:Vr,rpcMap:Zr,showQrModal:!!(br!=null&&br.showQrModal),qrModalOptions:Jr,projectId:br.projectId,metadata:br.metadata}}buildRpcMap(br,wr){const Er={};return br.forEach(kr=>{Er[kr]=this.getRpcUrl(kr,wr)}),Er}async initialize(br){if(this.rpc=this.getRpcConfig(br),this.chainId=this.rpc.chains.length?g$2(this.rpc.chains):g$2(this.rpc.optionalChains),this.signer=await hv.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:br.disableProviderPing,relayUrl:br.relayUrl,storageOptions:br.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let wr;try{const{WalletConnectModal:Er}=await __vitePreload(()=>import("./index-6To_q7Ed.js").then(kr=>kr.i),[]);wr=Er}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(wr)try{this.modal=new wr(p$2({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(Er){throw this.signer.logger.error(Er),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(br){if(!br)return;const{chains:wr,optionalChains:Er,rpcMap:kr}=br;wr&&k$6(wr)&&(this.rpc.chains=wr.map(jr=>this.formatChainId(jr)),wr.forEach(jr=>{this.rpc.rpcMap[jr]=(kr==null?void 0:kr[jr])||this.getRpcUrl(jr)})),Er&&k$6(Er)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=Er==null?void 0:Er.map(jr=>this.formatChainId(jr)),Er.forEach(jr=>{this.rpc.rpcMap[jr]=(kr==null?void 0:kr[jr])||this.getRpcUrl(jr)}))}getRpcUrl(br,wr){var Er;return((Er=this.rpc.rpcMap)==null?void 0:Er[br])||`${j$2}?chainId=eip155:${br}&projectId=${wr||this.rpc.projectId}`}async loadPersistedSession(){if(!this.session)return;const br=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),wr=this.session.namespaces[`${this.namespace}:${br}`]?this.session.namespaces[`${this.namespace}:${br}`]:this.session.namespaces[this.namespace];this.setChainIds(br?[this.formatChainId(br)]:wr==null?void 0:wr.accounts),this.setAccounts(wr==null?void 0:wr.accounts)}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(br){return typeof br=="string"||br instanceof String?[this.parseAccount(br)]:br.map(wr=>this.parseAccount(wr))}};const parseIntSafe=(fr,br=10)=>{try{const wr=parseInt(String(fr),br);if(isNaN(wr)){logger$7.error(`Error parsing ${fr}`);return}return wr}catch(wr){logger$7.error(`Error parsing ${fr} to int: ${wr}`)}},activeAccountKey=fr=>`dynamic-wc2-active-account-${fr}`,sessionTopicKey=fr=>`dynamic-wc2-session-topic-${fr}`,swicthedNetworkKey=fr=>`dynamic-wc2-switched-network-${fr}`,currentChainKey=fr=>`dynamic-wc2-current-chain-${fr}`,ee=new EventEmitter$2;class WalletConnect extends EthereumWalletConnector{constructor(br){var wr;super(br),this.supportedChains=["EVM","ETH"],this.connectedChain="EVM",this.isInitialized=!1,this.canConnectViaQrCode=!0,this.isWalletConnect=!0,this.preferredChains=[],this._hasSwitchedNetwork=!1,this.sessionEventHandler=()=>{},this.sessionDeleteHandler=()=>{},this.name=br.walletName,this.projectId=br.projectId,this.deepLinkPreference=br.deepLinkPreference||"native",this.preferredChains=br.walletConnectPreferredChains||[],this.hasSwitchedNetwork=(wr=!!localStorage.getItem(this.swicthedNetworkKey))!==null&&wr!==void 0?wr:!1;const Er=localStorage.getItem(this.currentChainKey);this.currentChainId=Er?parseIntSafe(Er):void 0}getMappedChains(){return this.evmNetworks.filter(br=>br.chainId!==11297108109).map(br=>`eip155:${br.chainId}`)}getMappedChainsByPreferredOrder(){const br=this.getMappedChains(),wr=this.preferredChains.filter(kr=>br.includes(kr)),Er=br.filter(kr=>!this.preferredChains.includes(kr));return[...wr,...Er].map(kr=>Number(kr.split(":")[1]))}initConnection(){return __awaiter$8(this,void 0,void 0,function*(){const{provider:br}=WalletConnect;if(!br)throw new DynamicError("No provider found (init connection)");br!=null&&br.signer.uri||br.connect().catch(wr=>{logger$7.error(wr),ee.emit("walletconnect_connection_failed",wr)})})}createProvider(){return __awaiter$8(this,void 0,void 0,function*(){return v$2.init({events:["chainChanged","accountsChanged"],methods:[],optionalChains:this.getMappedChainsByPreferredOrder(),optionalMethods:["eth_chainId","eth_signTypedData","eth_signTransaction","eth_sign","personal_sign","eth_sendTransaction","eth_signTypedData_v4","wallet_switchEthereumChain","wallet_addEthereumChain"],projectId:this.projectId,rpcMap:this.evmNetworkRpcMap(),showQrModal:!1})})}getWalletClientFromInitializedProvider(){return __awaiter$8(this,void 0,void 0,function*(){const br=this.createProvider();return createWalletClient({account:this.getActiveAccount(),transport:custom(yield br)})})}createInitProviderPromise(){return __awaiter$8(this,void 0,void 0,function*(){WalletConnect.provider=yield this.createProvider(),this.teardownEventListeners(),this.setupEventListeners()})}initProvider(){return __awaiter$8(this,void 0,void 0,function*(){const{provider:br}=WalletConnect;br||(this.initializePromise===void 0&&(this.initializePromise=this.createInitProviderPromise()),yield this.initializePromise)})}refreshSession(){var br,wr,Er,kr,jr;!((wr=(br=WalletConnect.provider)===null||br===void 0?void 0:br.session)===null||wr===void 0)&&wr.topic&&localStorage.getItem(this.sessionTopicKey)===((kr=(Er=WalletConnect.provider)===null||Er===void 0?void 0:Er.session)===null||kr===void 0?void 0:kr.topic)&&(this.session=WalletConnect.provider.session,this.setActiveAccount((jr=localStorage.getItem(this.activeAccountKey))!==null&&jr!==void 0?jr:void 0))}init(){return __awaiter$8(this,void 0,void 0,function*(){yield this.initProvider(),yield this.initConnection(),this.isInitialized=!0})}get sessionTopicKey(){return sessionTopicKey(this.key)}get activeAccountKey(){return activeAccountKey(this.key)}get swicthedNetworkKey(){return swicthedNetworkKey(this.key)}get currentChainKey(){return currentChainKey(this.key)}set currentChainId(br){this._currentChainId=br,br?localStorage.setItem(this.currentChainKey,br.toString()):localStorage.removeItem(this.currentChainKey)}get currentChainId(){return this._currentChainId}set hasSwitchedNetwork(br){this._hasSwitchedNetwork=br,br?localStorage.setItem(this.swicthedNetworkKey,br.toString()):localStorage.removeItem(this.swicthedNetworkKey)}get hasSwitchedNetwork(){return this._hasSwitchedNetwork}supportsNetworkSwitching(){return!0}setupEventListeners(){WalletConnect.provider&&(this.sessionEventHandler=({params:br})=>{if(logger$7.debug("session_event was called",{params:br}),!br||!br.event){logger$7.debug("session_event was called without params or params.event");return}const{name:wr,data:Er}=br.event;if(wr==="chainChanged"){const kr=parseIntSafe(Er);if(kr===this.currentChainId){logger$7.debug(`ignoring chainChanged event with same chain id as current chain id: ${kr}`);return}if(kr===void 0){logger$7.debug(`received unexpected data for chainChanged: ${Er} with type ${typeof Er}}`);return}this.currentChainId=kr,this.emit("chainChange",{chain:String(kr)}),this.hasSwitchedNetwork=!0,this.switchNetwork({networkChainId:kr})}else if(wr==="accountsChanged"){if(!Array.isArray(Er)){logger$7.debug(`received unexpected data for accountsChanged: ${Er} with type ${typeof Er}}`);return}const kr=Er[0].split(":")[2];this.setWCActiveAccount(kr)}},WalletConnect.provider.on("session_event",this.sessionEventHandler),this.sessionDeleteHandler=()=>__awaiter$8(this,void 0,void 0,function*(){this.endSession(),this.emit("disconnect")}),WalletConnect.provider.on("session_delete",this.sessionDeleteHandler))}teardownEventListeners(){WalletConnect.provider&&(WalletConnect.provider.off("session_event",this.sessionEventHandler),WalletConnect.provider.off("session_delete",this.sessionDeleteHandler))}getWalletClient(br){if(WalletConnect.provider)return createWalletClient({account:this.getActiveAccount(),chain:chainsMap[br??String(this.currentChainId)],transport:custom(WalletConnect.provider)})}getAddress(br){return __awaiter$8(this,void 0,void 0,function*(){var wr,Er;const kr=this.getActiveAccount();if(kr!=null&&kr.address)return kr.address;if((!WalletConnect.provider||!(!((wr=WalletConnect.provider)===null||wr===void 0)&&wr.signer.uri))&&(logger$7.debug("No WC2 provider found, re-initializing..."),yield this.endSession(),yield this.init(),yield sleep$1(1e3),!WalletConnect.provider||!(!((Er=WalletConnect.provider)===null||Er===void 0)&&Er.signer.uri)))throw logger$7.debug("No WC2 provider found, escaping and throwing error"),new DynamicError("No provider found");const jr=getWalletBookWallet(this.walletBook,this.key,this.walletFallback);return performPlatformSpecificConnectionMethod(WalletConnect.provider.signer.uri,jr,{onDesktopUri:br==null?void 0:br.onDesktopUri,onDisplayUri:br==null?void 0:br.onDisplayUri},this.deepLinkPreference),new Promise((Br,Wr)=>{if(!WalletConnect.provider){Wr(new DynamicError("No provider found"));return}const qr=()=>{const Zr=new DynamicError("Connection rejected. Please try again.");Zr.code="connection_rejected",WalletConnect.provider&&(WalletConnect.provider.signer.uri=void 0,this.init()),Wr(Zr),Vr()},Gr=()=>{var Zr;const Jr=(Zr=WalletConnect.provider)===null||Zr===void 0?void 0:Zr.session;if(!Jr){Wr(new DynamicError("No session found"));return}this.setSession(Jr),this.setWCActiveAccount(Jr.namespaces.eip155.accounts[0].split(":")[2]),this.getNetwork().then(Qr=>{var _n;this.currentChainId=Qr,Br((_n=this.getActiveAccount())===null||_n===void 0?void 0:_n.address)}),Vr()},Vr=()=>{var Zr;ee.off("walletconnect_connection_failed",qr),(Zr=WalletConnect.provider)===null||Zr===void 0||Zr.off("connect",Gr)};ee.on("walletconnect_connection_failed",qr),WalletConnect.provider.on("connect",Gr)})})}waitForSignMessage(br,wr){return __awaiter$8(this,void 0,void 0,function*(){const kr=yield new Promise((jr,Br)=>{this.on("chainChange",()=>jr({success:!1})),br(wr).then(Wr=>jr({signedMessage:Wr,success:!0})).catch(Br)});return kr.success===!1?br(wr):kr.signedMessage})}getDeepLink(){var br;if(!this.session)return;const wr=getWalletBookWallet(this.walletBook,this.key),Er=getDeepLink({metadata:wr,mode:"regular",preference:this.deepLinkPreference,uri:(br=WalletConnect.provider)===null||br===void 0?void 0:br.signer.uri});if(Er)return`${Er}?sessionTopic=${this.session.topic}`}signMessage(br){return __awaiter$8(this,void 0,void 0,function*(){if(!this.session)throw new DynamicError("no session");const wr=this.getDeepLink();isMobile()&&wr&&(window.location.href=wr);const Er=jr=>__awaiter$8(this,void 0,void 0,function*(){const Br=this.getActiveAccount();return Br?(yield this.getWalletClientFromInitializedProvider()).signMessage({account:Br,message:jr}):void 0});return yield this.waitForSignMessage(Er,br)})}clearActiveAccount(){localStorage.removeItem(this.activeAccountKey),this.setActiveAccount(void 0)}clearSession(){localStorage.removeItem(this.sessionTopicKey),this.session=void 0}setWCActiveAccount(br){localStorage.setItem(this.activeAccountKey,br),this.setActiveAccount(br),this.emit("accountChange",{accounts:[br]})}setSession(br){localStorage.setItem(this.sessionTopicKey,br.topic),this.session=br}endSession(){return __awaiter$8(this,void 0,void 0,function*(){var br;if(this.clearActiveAccount(),this.clearSession(),this.hasSwitchedNetwork=!1,this.currentChainId=void 0,!!(!((br=WalletConnect.provider)===null||br===void 0)&&br.session))try{yield WalletConnect.provider.disconnect(),WalletConnect.provider=void 0}catch(wr){logger$7.debug(wr)}})}getNetwork(){const br=Object.create(null,{getNetwork:{get:()=>super.getNetwork}});return __awaiter$8(this,void 0,void 0,function*(){return this.currentChainId?this.currentChainId:(yield this.initProvider(),br.getNetwork.call(this))})}providerSwitchNetwork(br){const wr=Object.create(null,{providerSwitchNetwork:{get:()=>super.providerSwitchNetwork}});return __awaiter$8(this,arguments,void 0,function*({network:Er}){const kr=yield this.getSupportedNetworks();if(!(kr!=null&&kr.includes(Er.chainId.toString()))){const Wr=new DynamicError("Network switching is not available at this time. The user should manually switch network in their wallet");throw Wr.code="network_switching_only_available_in_wallet",Wr}const jr=yield this.getNetwork();if(jr&&jr===Er.chainId)return;if(this.switchNetworkOnlyFromWallet)throw new DynamicError("Network switching is only supported through the wallet");if(!this.supportsNetworkSwitching())throw new DynamicError("Network switching not supported");const Br=yield this.getWalletClientFromInitializedProvider();if(this.isMetaMask()){const Wr=this.getDeepLink();Wr&&(window.location.href=Wr)}yield wr.providerSwitchNetwork.call(this,{network:Er,provider:Br}),this.currentChainId=Er.chainId,this.hasSwitchedNetwork=!0,this.emit("chainChange",{chain:String(Er.chainId)})})}getConnectedAccounts(){return __awaiter$8(this,void 0,void 0,function*(){this.isInitialized===!1&&(yield this.initProvider(),this.refreshSession(),this.isInitialized=!0);const br=this.getActiveAccount();return br!=null&&br.address?[br.address]:[]})}isMetaMask(){var br,wr,Er,kr,jr;return(jr=(kr=(Er=(wr=(br=this.session)===null||br===void 0?void 0:br.peer)===null||wr===void 0?void 0:wr.metadata)===null||Er===void 0?void 0:Er.name)===null||kr===void 0?void 0:kr.toLowerCase().startsWith("metamask"))!==null&&jr!==void 0?jr:!1}getSupportedNetworks(){return __awaiter$8(this,void 0,void 0,function*(){var br;if(yield this.initProvider(),this.refreshSession(),this.isMetaMask())return this.hasSwitchedNetwork?[String(this.currentChainId)]:this.evmNetworks.map(Er=>Er.chainId.toString());if(!this.session)return[];const wr=[];return Object.keys(this.session.namespaces).forEach(Er=>{Er.startsWith("eip155:")&&wr.push(Er.split(":")[1])}),(br=this.session.namespaces.eip155)===null||br===void 0||br.accounts.forEach(Er=>wr.push(Er.split(":")[1])),wr.length?wr:this.evmNetworks.map(Er=>Er.chainId.toString())})}}let InjectedWalletBase$1=class extends EthereumWalletConnector{constructor(){super(...arguments),this.supportedChains=["ETH","EVM"],this.connectedChain="EVM",this.walletConnectorFallback=!1}getEthProviderHelper(){return this.wallet||(this.wallet=findWalletBookWallet(this.walletBook,this.key)),this.wallet&&!this.ethProviderHelper&&(this.ethProviderHelper=new EthProviderHelper(this.wallet,this)),this.ethProviderHelper}getMobileOrInstalledWallet(){var br,wr;return this.wallet||(this.wallet=findWalletBookWallet(this.walletBook,this.key)),this.isInstalledOnBrowser()?this:!((wr=(br=this.wallet)===null||br===void 0?void 0:br.mobile)===null||wr===void 0)&&wr.inAppBrowser&&this.mobileExperience==="in-app-browser"&&isMobile()?this:this.walletConnectorFallback?new WalletConnect(Object.assign(Object.assign({},this.constructorProps),{walletName:this.name})):this}findProvider(){const br=this.getEthProviderHelper();if(br)return br.getInstalledProvider()}setupEventListeners(){if(!this.getWalletClient())return;const wr=this.getEthProviderHelper();if(!wr)return;const{tearDownEventListeners:Er}=wr._setupEventListeners(this);this.teardownEventListeners=Er}getWalletClient(br){var wr;return(wr=this.getEthProviderHelper())===null||wr===void 0?void 0:wr.findWalletClient(br)}isInstalledOnBrowser(){var br;return((br=this.getEthProviderHelper())===null||br===void 0?void 0:br.findProvider())!==void 0}getAddress(){return __awaiter$8(this,void 0,void 0,function*(){var br;return(br=this.getEthProviderHelper())===null||br===void 0?void 0:br.getAddress()})}connect(){return __awaiter$8(this,void 0,void 0,function*(){yield this.getAddress()})}signMessage(br){return __awaiter$8(this,void 0,void 0,function*(){var wr;return(wr=this.getEthProviderHelper())===null||wr===void 0?void 0:wr.signMessage(br)})}proveOwnership(br,wr){return __awaiter$8(this,void 0,void 0,function*(){return yield this.validateActiveWallet(br),this.signMessage(wr)})}endSession(){return __awaiter$8(this,void 0,void 0,function*(){})}providerSwitchNetwork(br){const wr=Object.create(null,{providerSwitchNetwork:{get:()=>super.providerSwitchNetwork}});return __awaiter$8(this,arguments,void 0,function*({network:Er,provider:kr}){return wr.providerSwitchNetwork.call(this,{network:Er,provider:kr})})}};class PhantomEvm extends InjectedWalletBase$1{constructor(br){super(br),this.name="Phantom",this.overrideKey="phantomevm",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getAddress(){const br=Object.create(null,{getAddress:{get:()=>super.getAddress}});return __awaiter$8(this,void 0,void 0,function*(){if(this.isInstalledOnBrowser())return br.getAddress.call(this);isMobile()&&handleMobileWalletRedirect({nativeLink:"phantom://browse",universalLink:"https://phantom.app/ul/browse"})})}canGetChainAddress(){var br,wr;return!!(!((wr=(br=this.getEthProviderHelper())===null||br===void 0?void 0:br.findProvider())===null||wr===void 0)&&wr.selectedAddress)}}class ExodusEvm extends InjectedWalletBase$1{constructor(br){super(br),this.name="ExodusEvm",this.overrideKey="exodusevm",this.walletConnectorFallback=!0,this.wallet=findWalletBookWallet(this.walletBook,this.key)}}let UnknownInjected$1=class extends InjectedWalletBase$1{constructor(br){super(br),this.name="Unknown",this.overrideKey="unknown",this.wallet=findWalletBookWallet(this.walletBook,this.key)}isInstalledOnBrowser(){return!1}};class FallbackEvmConnector extends InjectedWalletBase$1{constructor(br){super(br),this.name="Fallback Connector",this.overrideKey="fallbackconnector",this.isAvailable=!1,this.wallet=findWalletBookWallet(this.walletBook,this.key)}isInstalledOnBrowser(){return!1}}const injectedWalletOverrides$1=[PhantomEvm,ExodusEvm],filteredInjectedWalletKeysOverrides$1=["phantomevm","coinbase","exodusevm"],fetchInjectedWalletConnector=({walletBook:fr})=>{var br;return Object.entries((br=fr==null?void 0:fr.wallets)!==null&&br!==void 0?br:{}).filter(([wr,Er])=>{var kr;return((kr=Er.injectedConfig)===null||kr===void 0?void 0:kr.find(jr=>jr.chain==="evm"))&&!filteredInjectedWalletKeysOverrides$1.includes(wr)}).map(([wr,Er])=>{const{shortName:kr}=Er,jr=kr||Er.name,Br=!!Er.walletConnect;return class extends InjectedWalletBase$1{constructor(Wr){super(Object.assign({},Wr)),this.name=jr,this.wallet=Er,this.walletConnectorFallback=Br,this.overrideKey=wr}getAddress(){const Wr=Object.create(null,{getAddress:{get:()=>super.getAddress}});return __awaiter$8(this,void 0,void 0,function*(){var qr;if(this.isInstalledOnBrowser())return Wr.getAddress.call(this);const Gr=(qr=this.wallet.mobile)===null||qr===void 0?void 0:qr.inAppBrowser;if(!Gr){const Vr=new Error(`No inAppBrowserBase found for ${this.name}.`);throw logger$7.error(Vr.message),Vr}window.location.href=`${Gr}/${window.location.href}`})}}})},fetchWalletConnectWallets=({walletBook:fr})=>{var br;return Object.entries((br=fr==null?void 0:fr.wallets)!==null&&br!==void 0?br:{}).filter(([,wr])=>wr.walletConnect&&!wr.filterFromWalletConnect).map(([wr,Er])=>{const{shortName:kr}=Er,jr=kr||Er.name;return class extends WalletConnect{constructor(Br){super(Object.assign(Object.assign({},Br),{walletName:jr})),this.overrideKey=wr}}})},getWalletConnectConnector=()=>class extends WalletConnect{constructor(fr){super(Object.assign(Object.assign({},fr),{walletName:"WalletConnect"}))}};var dist={},CoinbaseWalletSDK$1={},walletLogo$1={};Object.defineProperty(walletLogo$1,"__esModule",{value:!0});walletLogo$1.walletLogo=void 0;const walletLogo=(fr,br)=>{let wr;switch(fr){case"standard":return wr=br,`data:image/svg+xml,%3Csvg width='${br}' height='${wr}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return wr=br,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${br}' height='${wr}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return wr=(.1*br).toFixed(2),`data:image/svg+xml,%3Csvg width='${br}' height='${wr}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return wr=(.25*br).toFixed(2),`data:image/svg+xml,%3Csvg width='${br}' height='${wr}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return wr=(.1*br).toFixed(2),`data:image/svg+xml,%3Csvg width='${br}' height='${wr}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return wr=(.25*br).toFixed(2),`data:image/svg+xml,%3Csvg width='${br}' height='${wr}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return wr=br,`data:image/svg+xml,%3Csvg width='${br}' height='${wr}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};walletLogo$1.walletLogo=walletLogo;var CoinbaseWalletProvider$1={};const require$$0$2=getAugmentedNamespace(eventemitter3$1);var error={},constants$2={};Object.defineProperty(constants$2,"__esModule",{value:!0});constants$2.errorValues=constants$2.standardErrorCodes=void 0;constants$2.standardErrorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}};constants$2.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}};var errors$1={},utils$1={};(function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.serialize=fr.getErrorCode=fr.isValidCode=fr.getMessageFromCode=fr.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const br=constants$2,wr="Unspecified error message.";fr.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function Er(Jr,Qr=wr){if(Jr&&Number.isInteger(Jr)){const _n=Jr.toString();if(Vr(br.errorValues,_n))return br.errorValues[_n].message;if(qr(Jr))return fr.JSON_RPC_SERVER_ERROR_MESSAGE}return Qr}fr.getMessageFromCode=Er;function kr(Jr){if(!Number.isInteger(Jr))return!1;const Qr=Jr.toString();return!!(br.errorValues[Qr]||qr(Jr))}fr.isValidCode=kr;function jr(Jr){var Qr;if(typeof Jr=="number")return Jr;if(Br(Jr))return(Qr=Jr.code)!==null&&Qr!==void 0?Qr:Jr.errorCode}fr.getErrorCode=jr;function Br(Jr){return typeof Jr=="object"&&Jr!==null&&(typeof Jr.code=="number"||typeof Jr.errorCode=="number")}function Wr(Jr,{shouldIncludeStack:Qr=!1}={}){const _n={};if(Jr&&typeof Jr=="object"&&!Array.isArray(Jr)&&Vr(Jr,"code")&&kr(Jr.code)){const En=Jr;_n.code=En.code,En.message&&typeof En.message=="string"?(_n.message=En.message,Vr(En,"data")&&(_n.data=En.data)):(_n.message=Er(_n.code),_n.data={originalError:Gr(Jr)})}else _n.code=br.standardErrorCodes.rpc.internal,_n.message=Zr(Jr,"message")?Jr.message:wr,_n.data={originalError:Gr(Jr)};return Qr&&(_n.stack=Zr(Jr,"stack")?Jr.stack:void 0),_n}fr.serialize=Wr;function qr(Jr){return Jr>=-32099&&Jr<=-32e3}function Gr(Jr){return Jr&&typeof Jr=="object"&&!Array.isArray(Jr)?Object.assign({},Jr):Jr}function Vr(Jr,Qr){return Object.prototype.hasOwnProperty.call(Jr,Qr)}function Zr(Jr,Qr){return typeof Jr=="object"&&Jr!==null&&Qr in Jr&&typeof Jr[Qr]=="string"}})(utils$1);Object.defineProperty(errors$1,"__esModule",{value:!0});errors$1.standardErrors=void 0;const constants_1$6=constants$2,utils_1$1=utils$1;errors$1.standardErrors={rpc:{parse:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.parse,fr),invalidRequest:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.invalidRequest,fr),invalidParams:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.invalidParams,fr),methodNotFound:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.methodNotFound,fr),internal:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.internal,fr),server:fr=>{if(!fr||typeof fr!="object"||Array.isArray(fr))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:br}=fr;if(!Number.isInteger(br)||br>-32005||br<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return getEthJsonRpcError(br,fr)},invalidInput:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.invalidInput,fr),resourceNotFound:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.resourceNotFound,fr),resourceUnavailable:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.resourceUnavailable,fr),transactionRejected:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.transactionRejected,fr),methodNotSupported:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.methodNotSupported,fr),limitExceeded:fr=>getEthJsonRpcError(constants_1$6.standardErrorCodes.rpc.limitExceeded,fr)},provider:{userRejectedRequest:fr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.userRejectedRequest,fr),unauthorized:fr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.unauthorized,fr),unsupportedMethod:fr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.unsupportedMethod,fr),disconnected:fr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.disconnected,fr),chainDisconnected:fr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.chainDisconnected,fr),unsupportedChain:fr=>getEthProviderError(constants_1$6.standardErrorCodes.provider.unsupportedChain,fr),custom:fr=>{if(!fr||typeof fr!="object"||Array.isArray(fr))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:br,message:wr,data:Er}=fr;if(!wr||typeof wr!="string")throw new Error('"message" must be a nonempty string');return new EthereumProviderError(br,wr,Er)}}};function getEthJsonRpcError(fr,br){const[wr,Er]=parseOpts(br);return new EthereumRpcError(fr,wr||(0,utils_1$1.getMessageFromCode)(fr),Er)}function getEthProviderError(fr,br){const[wr,Er]=parseOpts(br);return new EthereumProviderError(fr,wr||(0,utils_1$1.getMessageFromCode)(fr),Er)}function parseOpts(fr){if(fr){if(typeof fr=="string")return[fr];if(typeof fr=="object"&&!Array.isArray(fr)){const{message:br,data:wr}=fr;if(br&&typeof br!="string")throw new Error("Must specify string message.");return[br||void 0,wr]}}return[]}class EthereumRpcError extends Error{constructor(br,wr,Er){if(!Number.isInteger(br))throw new Error('"code" must be an integer.');if(!wr||typeof wr!="string")throw new Error('"message" must be a nonempty string.');super(wr),this.code=br,Er!==void 0&&(this.data=Er)}}class EthereumProviderError extends EthereumRpcError{constructor(br,wr,Er){if(!isValidEthProviderCode(br))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(br,wr,Er)}}function isValidEthProviderCode(fr){return Number.isInteger(fr)&&fr>=1e3&&fr<=4999}(function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.standardErrors=fr.standardErrorCodes=void 0;var br=constants$2;Object.defineProperty(fr,"standardErrorCodes",{enumerable:!0,get:function(){return br.standardErrorCodes}});var wr=errors$1;Object.defineProperty(fr,"standardErrors",{enumerable:!0,get:function(){return wr.standardErrors}})})(error);var serialize$1={},Web3Response={};Object.defineProperty(Web3Response,"__esModule",{value:!0});Web3Response.isErrorResponse=void 0;function isErrorResponse(fr){return fr.errorMessage!==void 0}Web3Response.isErrorResponse=isErrorResponse;var version$8={};Object.defineProperty(version$8,"__esModule",{value:!0});version$8.LIB_VERSION=void 0;version$8.LIB_VERSION="4.0.4";Object.defineProperty(serialize$1,"__esModule",{value:!0});serialize$1.serializeError=void 0;const Web3Response_1$2=Web3Response,version_1$3=version$8,constants_1$5=constants$2,utils_1=utils$1;function serializeError(fr,br){const wr=(0,utils_1.serialize)(getErrorObject(fr),{shouldIncludeStack:!0}),Er=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");Er.searchParams.set("version",version_1$3.LIB_VERSION),Er.searchParams.set("code",wr.code.toString());const kr=getMethod(wr.data,br);return kr&&Er.searchParams.set("method",kr),Er.searchParams.set("message",wr.message),Object.assign(Object.assign({},wr),{docUrl:Er.href})}serialize$1.serializeError=serializeError;function getErrorObject(fr){return typeof fr=="string"?{message:fr,code:constants_1$5.standardErrorCodes.rpc.internal}:(0,Web3Response_1$2.isErrorResponse)(fr)?Object.assign(Object.assign({},fr),{message:fr.errorMessage,code:fr.errorCode,data:{method:fr.method}}):fr}function getMethod(fr,br){const wr=fr==null?void 0:fr.method;if(wr)return wr;if(br!==void 0){if(typeof br=="string")return br;if(Array.isArray(br)){if(br.length>0)return br[0].method}else return br.method}}var type$3={};Object.defineProperty(type$3,"__esModule",{value:!0});type$3.RegExpString=type$3.IntNumber=type$3.BigIntString=type$3.AddressString=type$3.HexString=type$3.OpaqueType=void 0;function OpaqueType(){return fr=>fr}type$3.OpaqueType=OpaqueType;type$3.HexString=OpaqueType();type$3.AddressString=OpaqueType();type$3.BigIntString=OpaqueType();function IntNumber(fr){return Math.floor(fr)}type$3.IntNumber=IntNumber;type$3.RegExpString=OpaqueType();var util$6={};Object.defineProperty(util$6,"__esModule",{value:!0});util$6.areAddressArraysEqual=util$6.getFavicon=util$6.range=util$6.isBigNumber=util$6.ensureParsedJSONObject=util$6.ensureBigInt=util$6.ensureRegExpString=util$6.ensureIntNumber=util$6.ensureBuffer=util$6.ensureAddressString=util$6.ensureEvenLengthHexString=util$6.ensureHexString=util$6.isHexString=util$6.prepend0x=util$6.strip0x=util$6.has0xPrefix=util$6.hexStringFromIntNumber=util$6.intNumberFromHexString=util$6.bigIntStringFromBigInt=util$6.hexStringFromBuffer=util$6.hexStringToUint8Array=util$6.uint8ArrayToHex=util$6.randomBytesHex=void 0;const error_1$8=error,_1=type$3,INT_STRING_REGEX=/^[0-9]*$/,HEXADECIMAL_STRING_REGEX=/^[a-f0-9]*$/;function randomBytesHex(fr){return uint8ArrayToHex(crypto.getRandomValues(new Uint8Array(fr)))}util$6.randomBytesHex=randomBytesHex;function uint8ArrayToHex(fr){return[...fr].map(br=>br.toString(16).padStart(2,"0")).join("")}util$6.uint8ArrayToHex=uint8ArrayToHex;function hexStringToUint8Array(fr){return new Uint8Array(fr.match(/.{1,2}/g).map(br=>parseInt(br,16)))}util$6.hexStringToUint8Array=hexStringToUint8Array;function hexStringFromBuffer(fr,br=!1){const wr=fr.toString("hex");return(0,_1.HexString)(br?`0x${wr}`:wr)}util$6.hexStringFromBuffer=hexStringFromBuffer;function bigIntStringFromBigInt(fr){return(0,_1.BigIntString)(fr.toString(10))}util$6.bigIntStringFromBigInt=bigIntStringFromBigInt;function intNumberFromHexString(fr){return(0,_1.IntNumber)(Number(BigInt(ensureEvenLengthHexString(fr,!0))))}util$6.intNumberFromHexString=intNumberFromHexString;function hexStringFromIntNumber(fr){return(0,_1.HexString)(`0x${BigInt(fr).toString(16)}`)}util$6.hexStringFromIntNumber=hexStringFromIntNumber;function has0xPrefix(fr){return fr.startsWith("0x")||fr.startsWith("0X")}util$6.has0xPrefix=has0xPrefix;function strip0x(fr){return has0xPrefix(fr)?fr.slice(2):fr}util$6.strip0x=strip0x;function prepend0x(fr){return has0xPrefix(fr)?`0x${fr.slice(2)}`:`0x${fr}`}util$6.prepend0x=prepend0x;function isHexString$1(fr){if(typeof fr!="string")return!1;const br=strip0x(fr).toLowerCase();return HEXADECIMAL_STRING_REGEX.test(br)}util$6.isHexString=isHexString$1;function ensureHexString(fr,br=!1){if(typeof fr=="string"){const wr=strip0x(fr).toLowerCase();if(HEXADECIMAL_STRING_REGEX.test(wr))return(0,_1.HexString)(br?`0x${wr}`:wr)}throw error_1$8.standardErrors.rpc.invalidParams(`"${String(fr)}" is not a hexadecimal string`)}util$6.ensureHexString=ensureHexString;function ensureEvenLengthHexString(fr,br=!1){let wr=ensureHexString(fr,!1);return wr.length%2===1&&(wr=(0,_1.HexString)(`0${wr}`)),br?(0,_1.HexString)(`0x${wr}`):wr}util$6.ensureEvenLengthHexString=ensureEvenLengthHexString;function ensureAddressString(fr){if(typeof fr=="string"){const br=strip0x(fr).toLowerCase();if(isHexString$1(br)&&br.length===40)return(0,_1.AddressString)(prepend0x(br))}throw error_1$8.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(fr)}`)}util$6.ensureAddressString=ensureAddressString;function ensureBuffer(fr){if(Buffer$2.isBuffer(fr))return fr;if(typeof fr=="string"){if(isHexString$1(fr)){const br=ensureEvenLengthHexString(fr,!1);return Buffer$2.from(br,"hex")}return Buffer$2.from(fr,"utf8")}throw error_1$8.standardErrors.rpc.invalidParams(`Not binary data: ${String(fr)}`)}util$6.ensureBuffer=ensureBuffer;function ensureIntNumber(fr){if(typeof fr=="number"&&Number.isInteger(fr))return(0,_1.IntNumber)(fr);if(typeof fr=="string"){if(INT_STRING_REGEX.test(fr))return(0,_1.IntNumber)(Number(fr));if(isHexString$1(fr))return(0,_1.IntNumber)(Number(BigInt(ensureEvenLengthHexString(fr,!0))))}throw error_1$8.standardErrors.rpc.invalidParams(`Not an integer: ${String(fr)}`)}util$6.ensureIntNumber=ensureIntNumber;function ensureRegExpString(fr){if(fr instanceof RegExp)return(0,_1.RegExpString)(fr.toString());throw error_1$8.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(fr)}`)}util$6.ensureRegExpString=ensureRegExpString;function ensureBigInt(fr){if(fr!==null&&(typeof fr=="bigint"||isBigNumber(fr)))return BigInt(fr.toString(10));if(typeof fr=="number")return BigInt(ensureIntNumber(fr));if(typeof fr=="string"){if(INT_STRING_REGEX.test(fr))return BigInt(fr);if(isHexString$1(fr))return BigInt(ensureEvenLengthHexString(fr,!0))}throw error_1$8.standardErrors.rpc.invalidParams(`Not an integer: ${String(fr)}`)}util$6.ensureBigInt=ensureBigInt;function ensureParsedJSONObject(fr){if(typeof fr=="string")return JSON.parse(fr);if(typeof fr=="object")return fr;throw error_1$8.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(fr)}`)}util$6.ensureParsedJSONObject=ensureParsedJSONObject;function isBigNumber(fr){if(fr==null||typeof fr.constructor!="function")return!1;const{constructor:br}=fr;return typeof br.config=="function"&&typeof br.EUCLID=="number"}util$6.isBigNumber=isBigNumber;function range(fr,br){return Array.from({length:br-fr},(wr,Er)=>fr+Er)}util$6.range=range;function getFavicon(){const fr=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:br,host:wr}=document.location,Er=fr?fr.getAttribute("href"):null;return!Er||Er.startsWith("javascript:")||Er.startsWith("vbscript:")?null:Er.startsWith("http://")||Er.startsWith("https://")||Er.startsWith("data:")?Er:Er.startsWith("//")?br+Er:`${br}//${wr}${Er}`}util$6.getFavicon=getFavicon;function areAddressArraysEqual(fr,br){return fr.length===br.length&&fr.every((wr,Er)=>wr===br[Er])}util$6.areAddressArraysEqual=areAddressArraysEqual;var util$5={},SCWSigner$1={},SCWKeyManager$1={},cipher={};Object.defineProperty(cipher,"__esModule",{value:!0});cipher.decryptContent=cipher.encryptContent=cipher.importKeyFromHexString=cipher.exportKeyToHexString=cipher.decrypt=cipher.encrypt=cipher.deriveSharedSecret=cipher.generateKeyPair=void 0;const util_1$b=util$6;async function generateKeyPair(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}cipher.generateKeyPair=generateKeyPair;async function deriveSharedSecret(fr,br){return crypto.subtle.deriveKey({name:"ECDH",public:br},fr,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}cipher.deriveSharedSecret=deriveSharedSecret;async function encrypt(fr,br){const wr=crypto.getRandomValues(new Uint8Array(12)),Er=await crypto.subtle.encrypt({name:"AES-GCM",iv:wr},fr,new TextEncoder().encode(br));return{iv:wr,cipherText:Er}}cipher.encrypt=encrypt;async function decrypt(fr,{iv:br,cipherText:wr}){const Er=await crypto.subtle.decrypt({name:"AES-GCM",iv:br},fr,wr);return new TextDecoder().decode(Er)}cipher.decrypt=decrypt;function getFormat(fr){switch(fr){case"public":return"spki";case"private":return"pkcs8"}}async function exportKeyToHexString(fr,br){const wr=getFormat(fr),Er=await crypto.subtle.exportKey(wr,br);return(0,util_1$b.uint8ArrayToHex)(new Uint8Array(Er))}cipher.exportKeyToHexString=exportKeyToHexString;async function importKeyFromHexString(fr,br){const wr=getFormat(fr),Er=(0,util_1$b.hexStringToUint8Array)(br).buffer;return await crypto.subtle.importKey(wr,Er,{name:"ECDH",namedCurve:"P-256"},!0,fr==="private"?["deriveKey"]:[])}cipher.importKeyFromHexString=importKeyFromHexString;async function encryptContent(fr,br){const wr=JSON.stringify(fr,(Er,kr)=>{if(!(kr instanceof Error))return kr;const jr=kr;return Object.assign(Object.assign({},jr.code?{code:jr.code}:{}),{message:jr.message})});return encrypt(br,wr)}cipher.encryptContent=encryptContent;async function decryptContent(fr,br){return JSON.parse(await decrypt(br,fr))}cipher.decryptContent=decryptContent;var ScopedLocalStorage$1={};Object.defineProperty(ScopedLocalStorage$1,"__esModule",{value:!0});ScopedLocalStorage$1.ScopedLocalStorage=void 0;class ScopedLocalStorage{constructor(br,wr){this.scope=br,this.module=wr}setItem(br,wr){localStorage.setItem(this.scopedKey(br),wr)}getItem(br){return localStorage.getItem(this.scopedKey(br))}removeItem(br){localStorage.removeItem(this.scopedKey(br))}clear(){const br=this.scopedKey(""),wr=[];for(let Er=0;ErlocalStorage.removeItem(Er))}scopedKey(br){return`-${this.scope}${this.module?`:${this.module}`:""}:${br}`}static clearAll(){new ScopedLocalStorage("CBWSDK").clear(),new ScopedLocalStorage("walletlink").clear()}}ScopedLocalStorage$1.ScopedLocalStorage=ScopedLocalStorage;Object.defineProperty(SCWKeyManager$1,"__esModule",{value:!0});SCWKeyManager$1.SCWKeyManager=void 0;const cipher_1$1=cipher,ScopedLocalStorage_1$6=ScopedLocalStorage$1,OWN_PRIVATE_KEY={storageKey:"ownPrivateKey",keyType:"private"},OWN_PUBLIC_KEY={storageKey:"ownPublicKey",keyType:"public"},PEER_PUBLIC_KEY={storageKey:"peerPublicKey",keyType:"public"};class SCWKeyManager{constructor(){this.storage=new ScopedLocalStorage_1$6.ScopedLocalStorage("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(br){this.sharedSecret=null,this.peerPublicKey=br,await this.storeKey(PEER_PUBLIC_KEY,br),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(OWN_PUBLIC_KEY.storageKey),this.storage.removeItem(OWN_PRIVATE_KEY.storageKey),this.storage.removeItem(PEER_PUBLIC_KEY.storageKey)}async generateKeyPair(){const br=await(0,cipher_1$1.generateKeyPair)();this.ownPrivateKey=br.privateKey,this.ownPublicKey=br.publicKey,await this.storeKey(OWN_PRIVATE_KEY,br.privateKey),await this.storeKey(OWN_PUBLIC_KEY,br.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(OWN_PRIVATE_KEY)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(OWN_PUBLIC_KEY)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey(PEER_PUBLIC_KEY)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await(0,cipher_1$1.deriveSharedSecret)(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(br){const wr=this.storage.getItem(br.storageKey);return wr?(0,cipher_1$1.importKeyFromHexString)(br.keyType,wr):null}async storeKey(br,wr){const Er=await(0,cipher_1$1.exportKeyToHexString)(br.keyType,wr);this.storage.setItem(br.storageKey,Er)}}SCWKeyManager$1.SCWKeyManager=SCWKeyManager;var SCWStateManager$1={};Object.defineProperty(SCWStateManager$1,"__esModule",{value:!0});SCWStateManager$1.SCWStateManager=void 0;const ScopedLocalStorage_1$5=ScopedLocalStorage$1,ACCOUNTS_KEY="accounts",ACTIVE_CHAIN_STORAGE_KEY="activeChain",AVAILABLE_CHAINS_STORAGE_KEY="availableChains",WALLET_CAPABILITIES_STORAGE_KEY="walletCapabilities";class SCWStateManager{get accounts(){return this._accounts}get activeChain(){return this._activeChain}get walletCapabilities(){return this._walletCapabilities}constructor(br){var wr,Er;this.storage=new ScopedLocalStorage_1$5.ScopedLocalStorage("CBWSDK","SCWStateManager"),this.updateListener=br.updateListener,this.availableChains=this.loadItemFromStorage(AVAILABLE_CHAINS_STORAGE_KEY),this._walletCapabilities=this.loadItemFromStorage(WALLET_CAPABILITIES_STORAGE_KEY);const kr=this.loadItemFromStorage(ACCOUNTS_KEY),jr=this.loadItemFromStorage(ACTIVE_CHAIN_STORAGE_KEY);kr&&this.updateListener.onAccountsUpdate({accounts:kr,source:"storage"}),jr&&this.updateListener.onChainUpdate({chain:jr,source:"storage"}),this._accounts=kr||[],this._activeChain=jr||{id:(Er=(wr=br.appChainIds)===null||wr===void 0?void 0:wr[0])!==null&&Er!==void 0?Er:1}}updateAccounts(br){this._accounts=br,this.storeItemToStorage(ACCOUNTS_KEY,br),this.updateListener.onAccountsUpdate({accounts:br,source:"wallet"})}switchChain(br){var wr;const Er=(wr=this.availableChains)===null||wr===void 0?void 0:wr.find(kr=>kr.id===br);return Er?(Er===this._activeChain||(this._activeChain=Er,this.storeItemToStorage(ACTIVE_CHAIN_STORAGE_KEY,Er),this.updateListener.onChainUpdate({chain:Er,source:"wallet"})),!0):!1}updateAvailableChains(br){if(!br||Object.keys(br).length===0)return;const wr=Object.entries(br).map(([Er,kr])=>({id:Number(Er),rpcUrl:kr}));this.availableChains=wr,this.storeItemToStorage(AVAILABLE_CHAINS_STORAGE_KEY,wr),this.switchChain(this._activeChain.id)}updateWalletCapabilities(br){this._walletCapabilities=br,this.storeItemToStorage(WALLET_CAPABILITIES_STORAGE_KEY,br)}storeItemToStorage(br,wr){this.storage.setItem(br,JSON.stringify(wr))}loadItemFromStorage(br){const wr=this.storage.getItem(br);return wr?JSON.parse(wr):void 0}clear(){this.storage.clear()}}SCWStateManager$1.SCWStateManager=SCWStateManager;Object.defineProperty(SCWSigner$1,"__esModule",{value:!0});SCWSigner$1.SCWSigner=void 0;const SCWKeyManager_1=SCWKeyManager$1,SCWStateManager_1=SCWStateManager$1,error_1$7=error,util_1$a=util$6,cipher_1=cipher;class SCWSigner{constructor(br){this.metadata=br.metadata,this.communicator=br.communicator,this.keyManager=new SCWKeyManager_1.SCWKeyManager,this.stateManager=new SCWStateManager_1.SCWStateManager({appChainIds:this.metadata.appChainIds,updateListener:br.updateListener}),this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(){const br=await this.createRequestMessage({handshake:{method:"eth_requestAccounts",params:this.metadata}}),wr=await this.communicator.postRequestAndWaitForResponse(br);if("failure"in wr.content)throw wr.content.failure;const Er=await(0,cipher_1.importKeyFromHexString)("public",wr.sender);await this.keyManager.setPeerPublicKey(Er);const kr=await this.decryptResponseMessage(wr);this.updateInternalState({method:"eth_requestAccounts"},kr);const jr=kr.result;if("error"in jr)throw jr.error;return this.stateManager.accounts}async request(br){const wr=this.tryLocalHandling(br);if(wr!==void 0){if(wr instanceof Error)throw wr;return wr}await this.communicator.waitForPopupLoaded();const Er=await this.sendEncryptedRequest(br),kr=await this.decryptResponseMessage(Er);this.updateInternalState(br,kr);const jr=kr.result;if("error"in jr)throw jr.error;return jr.value}async disconnect(){this.stateManager.clear(),await this.keyManager.clear()}tryLocalHandling(br){var wr;switch(br.method){case"wallet_switchEthereumChain":{const Er=br.params;if(!Er||!(!((wr=Er[0])===null||wr===void 0)&&wr.chainId))throw error_1$7.standardErrors.rpc.invalidParams();const kr=(0,util_1$a.ensureIntNumber)(Er[0].chainId);return this.stateManager.switchChain(kr)?null:void 0}case"wallet_getCapabilities":{const Er=this.stateManager.walletCapabilities;if(!Er)throw error_1$7.standardErrors.provider.unauthorized("No wallet capabilities found, please disconnect and reconnect");return Er}default:return}}async sendEncryptedRequest(br){const wr=await this.keyManager.getSharedSecret();if(!wr)throw error_1$7.standardErrors.provider.unauthorized("No valid session found, try requestAccounts before other methods");const Er=await(0,cipher_1.encryptContent)({action:br,chainId:this.stateManager.activeChain.id},wr),kr=await this.createRequestMessage({encrypted:Er});return this.communicator.postRequestAndWaitForResponse(kr)}async createRequestMessage(br){const wr=await(0,cipher_1.exportKeyToHexString)("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:wr,content:br,timestamp:new Date}}async decryptResponseMessage(br){const wr=br.content;if("failure"in wr)throw wr.failure;const Er=await this.keyManager.getSharedSecret();if(!Er)throw error_1$7.standardErrors.provider.unauthorized("Invalid session");return(0,cipher_1.decryptContent)(wr.encrypted,Er)}updateInternalState(br,wr){var Er,kr;const jr=(Er=wr.data)===null||Er===void 0?void 0:Er.chains;jr&&this.stateManager.updateAvailableChains(jr);const Br=(kr=wr.data)===null||kr===void 0?void 0:kr.capabilities;Br&&this.stateManager.updateWalletCapabilities(Br);const Wr=wr.result;if(!("error"in Wr))switch(br.method){case"eth_requestAccounts":{const qr=Wr.value;this.stateManager.updateAccounts(qr);break}case"wallet_switchEthereumChain":{if(Wr.value!==null)return;const qr=br.params,Gr=(0,util_1$a.ensureIntNumber)(qr[0].chainId);this.stateManager.switchChain(Gr);break}}}}SCWSigner$1.SCWSigner=SCWSigner;var WalletLinkSigner$1={};const{Transform:Transform$1}=requireReadableBrowser$1();var keccak$2=fr=>class fS extends Transform$1{constructor(wr,Er,kr,jr,Br){super(Br),this._rate=wr,this._capacity=Er,this._delimitedSuffix=kr,this._hashBitLength=jr,this._options=Br,this._state=new fr,this._state.initialize(wr,Er),this._finalized=!1}_transform(wr,Er,kr){let jr=null;try{this.update(wr,Er)}catch(Br){jr=Br}kr(jr)}_flush(wr){let Er=null;try{this.push(this.digest())}catch(kr){Er=kr}wr(Er)}update(wr,Er){if(!Buffer$2.isBuffer(wr)&&typeof wr!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer$2.isBuffer(wr)||(wr=Buffer$2.from(wr,Er)),this._state.absorb(wr),this}digest(wr){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let Er=this._state.squeeze(this._hashBitLength/8);return wr!==void 0&&(Er=Er.toString(wr)),this._resetState(),Er}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const wr=new fS(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(wr._state),wr._finalized=this._finalized,wr}};const{Transform}=requireReadableBrowser$1();var shake=fr=>class hS extends Transform{constructor(wr,Er,kr,jr){super(jr),this._rate=wr,this._capacity=Er,this._delimitedSuffix=kr,this._options=jr,this._state=new fr,this._state.initialize(wr,Er),this._finalized=!1}_transform(wr,Er,kr){let jr=null;try{this.update(wr,Er)}catch(Br){jr=Br}kr(jr)}_flush(){}_read(wr){this.push(this.squeeze(wr))}update(wr,Er){if(!Buffer$2.isBuffer(wr)&&typeof wr!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer$2.isBuffer(wr)||(wr=Buffer$2.from(wr,Er)),this._state.absorb(wr),this}squeeze(wr,Er){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let kr=this._state.squeeze(wr);return Er!==void 0&&(kr=kr.toString(Er)),kr}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const wr=new hS(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(wr._state),wr._finalized=this._finalized,wr}};const createKeccak=keccak$2,createShake=shake;var api=function(fr){const br=createKeccak(fr),wr=createShake(fr);return function(Er,kr){switch(typeof Er=="string"?Er.toLowerCase():Er){case"keccak224":return new br(1152,448,null,224,kr);case"keccak256":return new br(1088,512,null,256,kr);case"keccak384":return new br(832,768,null,384,kr);case"keccak512":return new br(576,1024,null,512,kr);case"sha3-224":return new br(1152,448,6,224,kr);case"sha3-256":return new br(1088,512,6,256,kr);case"sha3-384":return new br(832,768,6,384,kr);case"sha3-512":return new br(576,1024,6,512,kr);case"shake128":return new wr(1344,256,31,kr);case"shake256":return new wr(1088,512,31,kr);default:throw new Error("Invald algorithm: "+Er)}}},keccakStateUnroll={};const P1600_ROUND_CONSTANTS=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];keccakStateUnroll.p1600=function(fr){for(let br=0;br<24;++br){const wr=fr[0]^fr[10]^fr[20]^fr[30]^fr[40],Er=fr[1]^fr[11]^fr[21]^fr[31]^fr[41],kr=fr[2]^fr[12]^fr[22]^fr[32]^fr[42],jr=fr[3]^fr[13]^fr[23]^fr[33]^fr[43],Br=fr[4]^fr[14]^fr[24]^fr[34]^fr[44],Wr=fr[5]^fr[15]^fr[25]^fr[35]^fr[45],qr=fr[6]^fr[16]^fr[26]^fr[36]^fr[46],Gr=fr[7]^fr[17]^fr[27]^fr[37]^fr[47],Vr=fr[8]^fr[18]^fr[28]^fr[38]^fr[48],Zr=fr[9]^fr[19]^fr[29]^fr[39]^fr[49];let Jr=Vr^(kr<<1|jr>>>31),Qr=Zr^(jr<<1|kr>>>31);const _n=fr[0]^Jr,En=fr[1]^Qr,Cn=fr[10]^Jr,In=fr[11]^Qr,An=fr[20]^Jr,jn=fr[21]^Qr,eo=fr[30]^Jr,ro=fr[31]^Qr,to=fr[40]^Jr,_i=fr[41]^Qr;Jr=wr^(Br<<1|Wr>>>31),Qr=Er^(Wr<<1|Br>>>31);const oo=fr[2]^Jr,io=fr[3]^Qr,co=fr[12]^Jr,so=fr[13]^Qr,no=fr[22]^Jr,Tn=fr[23]^Qr,Hr=fr[32]^Jr,Xr=fr[33]^Qr,Sn=fr[42]^Jr,Rn=fr[43]^Qr;Jr=kr^(qr<<1|Gr>>>31),Qr=jr^(Gr<<1|qr>>>31);const Pn=fr[4]^Jr,On=fr[5]^Qr,Zn=fr[14]^Jr,Nn=fr[15]^Qr,wn=fr[24]^Jr,zn=fr[25]^Qr,fo=fr[34]^Jr,vo=fr[35]^Qr,go=fr[44]^Jr,uo=fr[45]^Qr;Jr=Br^(Vr<<1|Zr>>>31),Qr=Wr^(Zr<<1|Vr>>>31);const lo=fr[6]^Jr,Eo=fr[7]^Qr,mo=fr[16]^Jr,yo=fr[17]^Qr,_o=fr[26]^Jr,Bo=fr[27]^Qr,Lo=fr[36]^Jr,Wo=fr[37]^Qr,na=fr[46]^Jr,qo=fr[47]^Qr;Jr=qr^(wr<<1|Er>>>31),Qr=Gr^(Er<<1|wr>>>31);const ga=fr[8]^Jr,wl=fr[9]^Qr,No=fr[18]^Jr,Uo=fr[19]^Qr,Nl=fr[28]^Jr,Vo=fr[29]^Qr,Fo=fr[38]^Jr,Ol=fr[39]^Qr,$a=fr[48]^Jr,Jo=fr[49]^Qr,Zl=_n,Cl=En,ko=In<<4|Cn>>>28,wo=Cn<<4|In>>>28,bo=An<<3|jn>>>29,Io=jn<<3|An>>>29,Ho=ro<<9|eo>>>23,Do=eo<<9|ro>>>23,zo=to<<18|_i>>>14,nu=_i<<18|to>>>14,Ll=oo<<1|io>>>31,_l=io<<1|oo>>>31,bu=so<<12|co>>>20,xl=co<<12|so>>>20,Tl=no<<10|Tn>>>22,du=Tn<<10|no>>>22,Bl=Xr<<13|Hr>>>19,Il=Hr<<13|Xr>>>19,Eu=Sn<<2|Rn>>>30,Al=Rn<<2|Sn>>>30,Ml=On<<30|Pn>>>2,Tu=Pn<<30|On>>>2,Fl=Zn<<6|Nn>>>26,Sl=Nn<<6|Zn>>>26,_u=zn<<11|wn>>>21,So=wn<<11|zn>>>21,Co=fo<<15|vo>>>17,Ao=vo<<15|fo>>>17,po=uo<<29|go>>>3,Ro=go<<29|uo>>>3,Xo=lo<<28|Eo>>>4,jo=Eo<<28|lo>>>4,Ko=yo<<23|mo>>>9,Wl=mo<<23|yo>>>9,$l=_o<<25|Bo>>>7,El=Bo<<25|_o>>>7,Cu=Lo<<21|Wo>>>11,iu=Wo<<21|Lo>>>11,pu=qo<<24|na>>>8,yu=na<<24|qo>>>8,hu=ga<<27|wl>>>5,mu=wl<<27|ga>>>5,vu=No<<20|Uo>>>12,fu=Uo<<20|No>>>12,gu=Vo<<7|Nl>>>25,ou=Nl<<7|Vo>>>25,su=Fo<<8|Ol>>>24,tu=Ol<<8|Fo>>>24,zl=$a<<14|Jo>>>18,Gl=Jo<<14|$a>>>18;fr[0]=Zl^~bu&_u,fr[1]=Cl^~xl&So,fr[10]=Xo^~vu&bo,fr[11]=jo^~fu&Io,fr[20]=Ll^~Fl&$l,fr[21]=_l^~Sl&El,fr[30]=hu^~ko&Tl,fr[31]=mu^~wo&du,fr[40]=Ml^~Ko&gu,fr[41]=Tu^~Wl&ou,fr[2]=bu^~_u&Cu,fr[3]=xl^~So&iu,fr[12]=vu^~bo&Bl,fr[13]=fu^~Io&Il,fr[22]=Fl^~$l&su,fr[23]=Sl^~El&tu,fr[32]=ko^~Tl&Co,fr[33]=wo^~du&Ao,fr[42]=Ko^~gu&Ho,fr[43]=Wl^~ou&Do,fr[4]=_u^~Cu&zl,fr[5]=So^~iu&Gl,fr[14]=bo^~Bl&po,fr[15]=Io^~Il&Ro,fr[24]=$l^~su&zo,fr[25]=El^~tu&nu,fr[34]=Tl^~Co&pu,fr[35]=du^~Ao&yu,fr[44]=gu^~Ho&Eu,fr[45]=ou^~Do&Al,fr[6]=Cu^~zl&Zl,fr[7]=iu^~Gl&Cl,fr[16]=Bl^~po&Xo,fr[17]=Il^~Ro&jo,fr[26]=su^~zo&Ll,fr[27]=tu^~nu&_l,fr[36]=Co^~pu&hu,fr[37]=Ao^~yu&mu,fr[46]=Ho^~Eu&Ml,fr[47]=Do^~Al&Tu,fr[8]=zl^~Zl&bu,fr[9]=Gl^~Cl&xl,fr[18]=po^~Xo&vu,fr[19]=Ro^~jo&fu,fr[28]=zo^~Ll&Fl,fr[29]=nu^~_l&Sl,fr[38]=pu^~hu&ko,fr[39]=yu^~mu&wo,fr[48]=Eu^~Ml&Ko,fr[49]=Al^~Tu&Wl,fr[0]^=P1600_ROUND_CONSTANTS[br*2],fr[1]^=P1600_ROUND_CONSTANTS[br*2+1]}};const keccakState=keccakStateUnroll;function Keccak(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}Keccak.prototype.initialize=function(fr,br){for(let wr=0;wr<50;++wr)this.state[wr]=0;this.blockSize=fr/8,this.count=0,this.squeezing=!1};Keccak.prototype.absorb=function(fr){for(let br=0;br>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(keccakState.p1600(this.state),this.count=0);return br};Keccak.prototype.copy=function(fr){for(let br=0;br<50;++br)fr.state[br]=this.state[br];fr.blockSize=this.blockSize,fr.count=this.count,fr.squeezing=this.squeezing};var keccak$1=Keccak,js=api(keccak$1);const createKeccakHash=js;function zeros(fr){return Buffer$2.allocUnsafe(fr).fill(0)}function bitLengthFromBigInt(fr){return fr.toString(2).length}function bufferBEFromBigInt(fr,br){let wr=fr.toString(16);wr.length%2!==0&&(wr="0"+wr);const Er=wr.match(/.{1,2}/g).map(kr=>parseInt(kr,16));for(;Er.length"u")throw new Error("Not an array?");if(wr=parseTypeArray(fr),wr!=="dynamic"&&wr!==0&&br.length>wr)throw new Error("Elements exceed array size: "+wr);kr=[],fr=fr.slice(0,fr.lastIndexOf("[")),typeof br=="string"&&(br=JSON.parse(br));for(jr in br)kr.push(encodeSingle(fr,br[jr]));if(wr==="dynamic"){var Br=encodeSingle("uint256",br.length);kr.unshift(Br)}return Buffer$2.concat(kr)}else{if(fr==="bytes")return br=new Buffer$2(br),kr=Buffer$2.concat([encodeSingle("uint256",br.length),br]),br.length%32!==0&&(kr=Buffer$2.concat([kr,util$3.zeros(32-br.length%32)])),kr;if(fr.startsWith("bytes")){if(wr=parseTypeN(fr),wr<1||wr>32)throw new Error("Invalid bytes width: "+wr);return util$3.setLengthRight(br,32)}else if(fr.startsWith("uint")){if(wr=parseTypeN(fr),wr%8||wr<8||wr>256)throw new Error("Invalid uint width: "+wr);Er=parseNumber(br);const Wr=util$3.bitLengthFromBigInt(Er);if(Wr>wr)throw new Error("Supplied uint exceeds width: "+wr+" vs "+Wr);if(Er<0)throw new Error("Supplied uint is negative");return util$3.bufferBEFromBigInt(Er,32)}else if(fr.startsWith("int")){if(wr=parseTypeN(fr),wr%8||wr<8||wr>256)throw new Error("Invalid int width: "+wr);Er=parseNumber(br);const Wr=util$3.bitLengthFromBigInt(Er);if(Wr>wr)throw new Error("Supplied int exceeds width: "+wr+" vs "+Wr);const qr=util$3.twosFromBigInt(Er,256);return util$3.bufferBEFromBigInt(qr,32)}else if(fr.startsWith("ufixed")){if(wr=parseTypeNxM(fr),Er=parseNumber(br),Er<0)throw new Error("Supplied ufixed is negative");return encodeSingle("uint256",Er*BigInt(2)**BigInt(wr[1]))}else if(fr.startsWith("fixed"))return wr=parseTypeNxM(fr),encodeSingle("int256",parseNumber(br)*BigInt(2)**BigInt(wr[1]))}throw new Error("Unsupported or invalid type: "+fr)}function isDynamic(fr){return fr==="string"||fr==="bytes"||parseTypeArray(fr)==="dynamic"}function isArray(fr){return fr.lastIndexOf("]")===fr.length-1}function rawEncode(fr,br){var wr=[],Er=[],kr=32*fr.length;for(var jr in fr){var Br=elementaryName(fr[jr]),Wr=br[jr],qr=encodeSingle(Br,Wr);isDynamic(Br)?(wr.push(encodeSingle("uint256",kr)),Er.push(qr),kr+=qr.length):wr.push(qr)}return Buffer$2.concat(wr.concat(Er))}function solidityPack(fr,br){if(fr.length!==br.length)throw new Error("Number of types are not matching the values");for(var wr,Er,kr=[],jr=0;jr32)throw new Error("Invalid bytes width: "+wr);kr.push(util$3.setLengthRight(Wr,wr))}else if(Br.startsWith("uint")){if(wr=parseTypeN(Br),wr%8||wr<8||wr>256)throw new Error("Invalid uint width: "+wr);Er=parseNumber(Wr);const qr=util$3.bitLengthFromBigInt(Er);if(qr>wr)throw new Error("Supplied uint exceeds width: "+wr+" vs "+qr);kr.push(util$3.bufferBEFromBigInt(Er,wr/8))}else if(Br.startsWith("int")){if(wr=parseTypeN(Br),wr%8||wr<8||wr>256)throw new Error("Invalid int width: "+wr);Er=parseNumber(Wr);const qr=util$3.bitLengthFromBigInt(Er);if(qr>wr)throw new Error("Supplied int exceeds width: "+wr+" vs "+qr);const Gr=util$3.twosFromBigInt(Er,wr);kr.push(util$3.bufferBEFromBigInt(Gr,wr/8))}else throw new Error("Unsupported or invalid type: "+Br)}return Buffer$2.concat(kr)}function soliditySHA3(fr,br){return util$3.keccak(solidityPack(fr,br))}var abi$1={rawEncode,solidityPack,soliditySHA3};const util$2=util$4,abi=abi$1,TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},TypedDataUtils={encodeData(fr,br,wr,Er=!0){const kr=["bytes32"],jr=[this.hashType(fr,wr)];if(Er){const Br=(Wr,qr,Gr)=>{if(wr[qr]!==void 0)return["bytes32",Gr==null?"0x0000000000000000000000000000000000000000000000000000000000000000":util$2.keccak(this.encodeData(qr,Gr,wr,Er))];if(Gr===void 0)throw new Error(`missing value for field ${Wr} of type ${qr}`);if(qr==="bytes")return["bytes32",util$2.keccak(Gr)];if(qr==="string")return typeof Gr=="string"&&(Gr=Buffer$2.from(Gr,"utf8")),["bytes32",util$2.keccak(Gr)];if(qr.lastIndexOf("]")===qr.length-1){const Vr=qr.slice(0,qr.lastIndexOf("[")),Zr=Gr.map(Jr=>Br(Wr,Vr,Jr));return["bytes32",util$2.keccak(abi.rawEncode(Zr.map(([Jr])=>Jr),Zr.map(([,Jr])=>Jr)))]}return[qr,Gr]};for(const Wr of wr[fr]){const[qr,Gr]=Br(Wr.name,Wr.type,br[Wr.name]);kr.push(qr),jr.push(Gr)}}else for(const Br of wr[fr]){let Wr=br[Br.name];if(Wr!==void 0)if(Br.type==="bytes")kr.push("bytes32"),Wr=util$2.keccak(Wr),jr.push(Wr);else if(Br.type==="string")kr.push("bytes32"),typeof Wr=="string"&&(Wr=Buffer$2.from(Wr,"utf8")),Wr=util$2.keccak(Wr),jr.push(Wr);else if(wr[Br.type]!==void 0)kr.push("bytes32"),Wr=util$2.keccak(this.encodeData(Br.type,Wr,wr,Er)),jr.push(Wr);else{if(Br.type.lastIndexOf("]")===Br.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");kr.push(Br.type),jr.push(Wr)}}return abi.rawEncode(kr,jr)},encodeType(fr,br){let wr="",Er=this.findTypeDependencies(fr,br).filter(kr=>kr!==fr);Er=[fr].concat(Er.sort());for(const kr of Er){if(!br[kr])throw new Error("No type definition specified: "+kr);wr+=kr+"("+br[kr].map(({name:Br,type:Wr})=>Wr+" "+Br).join(",")+")"}return wr},findTypeDependencies(fr,br,wr=[]){if(fr=fr.match(/^\w*/)[0],wr.includes(fr)||br[fr]===void 0)return wr;wr.push(fr);for(const Er of br[fr])for(const kr of this.findTypeDependencies(Er.type,br,wr))!wr.includes(kr)&&wr.push(kr);return wr},hashStruct(fr,br,wr,Er=!0){return util$2.keccak(this.encodeData(fr,br,wr,Er))},hashType(fr,br){return util$2.keccak(this.encodeType(fr,br))},sanitizeData(fr){const br={};for(const wr in TYPED_MESSAGE_SCHEMA.properties)fr[wr]&&(br[wr]=fr[wr]);return br.types&&(br.types=Object.assign({EIP712Domain:[]},br.types)),br},hash(fr,br=!0){const wr=this.sanitizeData(fr),Er=[Buffer$2.from("1901","hex")];return Er.push(this.hashStruct("EIP712Domain",wr.domain,wr.types,br)),wr.primaryType!=="EIP712Domain"&&Er.push(this.hashStruct(wr.primaryType,wr.message,wr.types,br)),util$2.keccak(Buffer$2.concat(Er))}};var ethEip712Util={TYPED_MESSAGE_SCHEMA,TypedDataUtils,hashForSignTypedDataLegacy:function(fr){return typedSignatureHashLegacy(fr.data)},hashForSignTypedData_v3:function(fr){return TypedDataUtils.hash(fr.data,!1)},hashForSignTypedData_v4:function(fr){return TypedDataUtils.hash(fr.data)}};function typedSignatureHashLegacy(fr){const br=new Error("Expect argument to be non-empty array");if(typeof fr!="object"||!fr.length)throw br;const wr=fr.map(function(jr){return jr.type==="bytes"?util$2.toBuffer(jr.value):jr.value}),Er=fr.map(function(jr){return jr.type}),kr=fr.map(function(jr){if(!jr.name)throw br;return jr.type+" "+jr.name});return abi.soliditySHA3(["bytes32","bytes32"],[abi.soliditySHA3(new Array(fr.length).fill("string"),kr),abi.soliditySHA3(Er,wr)])}var constants$1={};Object.defineProperty(constants$1,"__esModule",{value:!0});constants$1.APP_VERSION_KEY=constants$1.LOCAL_STORAGE_ADDRESSES_KEY=constants$1.WALLET_USER_NAME_KEY=void 0;constants$1.WALLET_USER_NAME_KEY="walletUsername";constants$1.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";constants$1.APP_VERSION_KEY="AppVersion";var RelayEventManager$1={};Object.defineProperty(RelayEventManager$1,"__esModule",{value:!0});RelayEventManager$1.RelayEventManager=void 0;const util_1$9=util$6;class RelayEventManager{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const br=this._nextRequestId,wr=(0,util_1$9.prepend0x)(br.toString(16));return this.callbacks.get(wr)&&this.callbacks.delete(wr),br}}RelayEventManager$1.RelayEventManager=RelayEventManager;var WalletLinkRelay$1={},WalletLinkConnection$1={},WalletLinkCipher$1={};Object.defineProperty(WalletLinkCipher$1,"__esModule",{value:!0});WalletLinkCipher$1.WalletLinkCipher=void 0;const util_1$8=util$6;class WalletLinkCipher{constructor(br){this.secret=br}async encrypt(br){const wr=this.secret;if(wr.length!==64)throw Error("secret must be 256 bits");const Er=crypto.getRandomValues(new Uint8Array(12)),kr=await crypto.subtle.importKey("raw",(0,util_1$8.hexStringToUint8Array)(wr),{name:"aes-gcm"},!1,["encrypt","decrypt"]),jr=new TextEncoder,Br=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:Er},kr,jr.encode(br)),Wr=16,qr=Br.slice(Br.byteLength-Wr),Gr=Br.slice(0,Br.byteLength-Wr),Vr=new Uint8Array(qr),Zr=new Uint8Array(Gr),Jr=new Uint8Array([...Er,...Vr,...Zr]);return(0,util_1$8.uint8ArrayToHex)(Jr)}async decrypt(br){const wr=this.secret;if(wr.length!==64)throw Error("secret must be 256 bits");return new Promise((Er,kr)=>{(async function(){const jr=await crypto.subtle.importKey("raw",(0,util_1$8.hexStringToUint8Array)(wr),{name:"aes-gcm"},!1,["encrypt","decrypt"]),Br=(0,util_1$8.hexStringToUint8Array)(br),Wr=Br.slice(0,12),qr=Br.slice(12,28),Gr=Br.slice(28),Vr=new Uint8Array([...Gr,...qr]),Zr={name:"AES-GCM",iv:new Uint8Array(Wr)};try{const Jr=await window.crypto.subtle.decrypt(Zr,jr,Vr),Qr=new TextDecoder;Er(Qr.decode(Jr))}catch(Jr){kr(Jr)}})()})}}WalletLinkCipher$1.WalletLinkCipher=WalletLinkCipher;var WalletLinkHTTP$1={};Object.defineProperty(WalletLinkHTTP$1,"__esModule",{value:!0});WalletLinkHTTP$1.WalletLinkHTTP=void 0;class WalletLinkHTTP{constructor(br,wr,Er){this.linkAPIUrl=br,this.sessionId=wr;const kr=`${wr}:${Er}`;this.auth=`Basic ${btoa(kr)}`}async markUnseenEventsAsSeen(br){return Promise.all(br.map(wr=>fetch(`${this.linkAPIUrl}/events/${wr.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(wr=>console.error("Unabled to mark event as failed:",wr))}async fetchUnseenEvents(){var br;const wr=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(wr.ok){const{events:Er,error:kr}=await wr.json();if(kr)throw new Error(`Check unseen events failed: ${kr}`);const jr=(br=Er==null?void 0:Er.filter(Br=>Br.event==="Web3Response").map(Br=>({type:"Event",sessionId:this.sessionId,eventId:Br.id,event:Br.event,data:Br.data})))!==null&&br!==void 0?br:[];return this.markUnseenEventsAsSeen(jr),jr}throw new Error(`Check unseen events failed: ${wr.status}`)}}WalletLinkHTTP$1.WalletLinkHTTP=WalletLinkHTTP;var WalletLinkWebSocket$1={};Object.defineProperty(WalletLinkWebSocket$1,"__esModule",{value:!0});WalletLinkWebSocket$1.WalletLinkWebSocket=WalletLinkWebSocket$1.ConnectionState=void 0;var ConnectionState;(function(fr){fr[fr.DISCONNECTED=0]="DISCONNECTED",fr[fr.CONNECTING=1]="CONNECTING",fr[fr.CONNECTED=2]="CONNECTED"})(ConnectionState||(WalletLinkWebSocket$1.ConnectionState=ConnectionState={}));class WalletLinkWebSocket{setConnectionStateListener(br){this.connectionStateListener=br}setIncomingDataListener(br){this.incomingDataListener=br}constructor(br,wr=WebSocket){this.WebSocketClass=wr,this.webSocket=null,this.pendingData=[],this.url=br.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((br,wr)=>{var Er;let kr;try{this.webSocket=kr=new this.WebSocketClass(this.url)}catch(jr){wr(jr);return}(Er=this.connectionStateListener)===null||Er===void 0||Er.call(this,ConnectionState.CONNECTING),kr.onclose=jr=>{var Br;this.clearWebSocket(),wr(new Error(`websocket error ${jr.code}: ${jr.reason}`)),(Br=this.connectionStateListener)===null||Br===void 0||Br.call(this,ConnectionState.DISCONNECTED)},kr.onopen=jr=>{var Br;br(),(Br=this.connectionStateListener)===null||Br===void 0||Br.call(this,ConnectionState.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(qr=>this.sendData(qr)),this.pendingData=[])},kr.onmessage=jr=>{var Br,Wr;if(jr.data==="h")(Br=this.incomingDataListener)===null||Br===void 0||Br.call(this,{type:"Heartbeat"});else try{const qr=JSON.parse(jr.data);(Wr=this.incomingDataListener)===null||Wr===void 0||Wr.call(this,qr)}catch{}}})}disconnect(){var br;const{webSocket:wr}=this;if(wr){this.clearWebSocket(),(br=this.connectionStateListener)===null||br===void 0||br.call(this,ConnectionState.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{wr.close()}catch{}}}sendData(br){const{webSocket:wr}=this;if(!wr){this.pendingData.push(br),this.connect();return}wr.send(br)}clearWebSocket(){const{webSocket:br}=this;br&&(this.webSocket=null,br.onclose=null,br.onerror=null,br.onmessage=null,br.onopen=null)}}WalletLinkWebSocket$1.WalletLinkWebSocket=WalletLinkWebSocket;Object.defineProperty(WalletLinkConnection$1,"__esModule",{value:!0});WalletLinkConnection$1.WalletLinkConnection=void 0;const constants_1$4=constants$1,WalletLinkCipher_1=WalletLinkCipher$1,WalletLinkHTTP_1=WalletLinkHTTP$1,WalletLinkWebSocket_1=WalletLinkWebSocket$1,type_1$1=type$3,HEARTBEAT_INTERVAL=1e4,REQUEST_TIMEOUT=6e4;class WalletLinkConnection{constructor({session:br,linkAPIUrl:wr,listener:Er,WebSocketClass:kr=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,type_1$1.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=Br=>{if(!Br)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",qr=>Br.JsonRpcUrl&&this.handleChainUpdated(qr,Br.JsonRpcUrl)]]).forEach((qr,Gr)=>{const Vr=Br[Gr];Vr!==void 0&&qr(Vr)})},this.handleDestroyed=Br=>{var Wr;Br==="1"&&((Wr=this.listener)===null||Wr===void 0||Wr.resetAndReload())},this.handleAccountUpdated=async Br=>{var Wr;{const qr=await this.cipher.decrypt(Br);(Wr=this.listener)===null||Wr===void 0||Wr.accountUpdated(qr)}},this.handleMetadataUpdated=async(Br,Wr)=>{var qr;{const Gr=await this.cipher.decrypt(Wr);(qr=this.listener)===null||qr===void 0||qr.metadataUpdated(Br,Gr)}},this.handleWalletUsernameUpdated=async Br=>{this.handleMetadataUpdated(constants_1$4.WALLET_USER_NAME_KEY,Br)},this.handleAppVersionUpdated=async Br=>{this.handleMetadataUpdated(constants_1$4.APP_VERSION_KEY,Br)},this.handleChainUpdated=async(Br,Wr)=>{var qr;{const Gr=await this.cipher.decrypt(Br),Vr=await this.cipher.decrypt(Wr);(qr=this.listener)===null||qr===void 0||qr.chainUpdated(Gr,Vr)}},this.session=br,this.cipher=new WalletLinkCipher_1.WalletLinkCipher(br.secret),this.listener=Er;const jr=new WalletLinkWebSocket_1.WalletLinkWebSocket(`${wr}/rpc`,kr);jr.setConnectionStateListener(async Br=>{let Wr=!1;switch(Br){case WalletLinkWebSocket_1.ConnectionState.DISCONNECTED:if(!this.destroyed){const qr=async()=>{await new Promise(Gr=>setTimeout(Gr,5e3)),this.destroyed||jr.connect().catch(()=>{qr()})};qr()}break;case WalletLinkWebSocket_1.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),Wr=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},HEARTBEAT_INTERVAL),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case WalletLinkWebSocket_1.ConnectionState.CONNECTING:break}this.connected!==Wr&&(this.connected=Wr)}),jr.setIncomingDataListener(Br=>{var Wr;switch(Br.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const qr=Br.type==="IsLinkedOK"?Br.linked:void 0;this.linked=qr||Br.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(Br.metadata);break}case"Event":{this.handleIncomingEvent(Br);break}}Br.id!==void 0&&((Wr=this.requestResolutions.get(Br.id))===null||Wr===void 0||Wr(Br))}),this.ws=jr,this.http=new WalletLinkHTTP_1.WalletLinkHTTP(wr,br.id,br.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}destroy(){this.destroyed=!0,this.ws.disconnect(),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(br){var wr;this._connected=br,br&&((wr=this.onceConnected)===null||wr===void 0||wr.call(this))}setOnceConnected(br){return new Promise(wr=>{this.connected?br().then(wr):this.onceConnected=()=>{br().then(wr),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(br){var wr,Er;this._linked=br,br&&((wr=this.onceLinked)===null||wr===void 0||wr.call(this)),(Er=this.listener)===null||Er===void 0||Er.linkedUpdated(br)}setOnceLinked(br){return new Promise(wr=>{this.linked?br().then(wr):this.onceLinked=()=>{br().then(wr),this.onceLinked=void 0}})}async handleIncomingEvent(br){var wr;if(!(br.type!=="Event"||br.event!=="Web3Response")){const Er=await this.cipher.decrypt(br.data),kr=JSON.parse(Er);if(kr.type!=="WEB3_RESPONSE")return;(wr=this.listener)===null||wr===void 0||wr.handleWeb3ResponseMessage(kr)}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(br=>setTimeout(br,250));try{await this.fetchUnseenEventsAPI()}catch(br){console.error("Unable to check for unseen events",br)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(wr=>this.handleIncomingEvent(wr))}async setSessionMetadata(br,wr){const Er={type:"SetSessionConfig",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[br]:wr}};return this.setOnceConnected(async()=>{const kr=await this.makeRequest(Er);if(kr.type==="Fail")throw new Error(kr.error||"failed to set session metadata")})}async publishEvent(br,wr,Er=!1){const kr=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},wr),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),jr={type:"PublishEvent",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:br,data:kr,callWebhook:Er};return this.setOnceLinked(async()=>{const Br=await this.makeRequest(jr);if(Br.type==="Fail")throw new Error(Br.error||"failed to publish event");return Br.eventId})}sendData(br){this.ws.sendData(JSON.stringify(br))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>HEARTBEAT_INTERVAL*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(br,wr=REQUEST_TIMEOUT){const Er=br.id;this.sendData(br);let kr;return Promise.race([new Promise((jr,Br)=>{kr=window.setTimeout(()=>{Br(new Error(`request ${Er} timed out`))},wr)}),new Promise(jr=>{this.requestResolutions.set(Er,Br=>{clearTimeout(kr),jr(Br),this.requestResolutions.delete(Er)})})])}async authenticate(){const br={type:"HostSession",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},wr=await this.makeRequest(br);if(wr.type==="Fail")throw new Error(wr.error||"failed to authenticate")}sendIsLinked(){const br={type:"IsLinked",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(br)}sendGetSessionConfig(){const br={type:"GetSessionConfig",id:(0,type_1$1.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(br)}}WalletLinkConnection$1.WalletLinkConnection=WalletLinkConnection;var WalletLinkSession$1={};Object.defineProperty(WalletLinkSession$1,"__esModule",{value:!0});WalletLinkSession$1.WalletLinkSession=void 0;const sha_js_1=requireSha_js(),util_1$7=util$6,STORAGE_KEY_SESSION_ID="session:id",STORAGE_KEY_SESSION_SECRET="session:secret",STORAGE_KEY_SESSION_LINKED="session:linked";class WalletLinkSession{constructor(br,wr,Er,kr){this._storage=br,this._id=wr||(0,util_1$7.randomBytesHex)(16),this._secret=Er||(0,util_1$7.randomBytesHex)(32),this._key=new sha_js_1.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!kr}static load(br){const wr=br.getItem(STORAGE_KEY_SESSION_ID),Er=br.getItem(STORAGE_KEY_SESSION_LINKED),kr=br.getItem(STORAGE_KEY_SESSION_SECRET);return wr&&kr?new WalletLinkSession(br,wr,kr,Er==="1"):null}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(br){this._linked=br,this.persistLinked()}save(){return this._storage.setItem(STORAGE_KEY_SESSION_ID,this._id),this._storage.setItem(STORAGE_KEY_SESSION_SECRET,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(STORAGE_KEY_SESSION_LINKED,this._linked?"1":"0")}}WalletLinkSession$1.WalletLinkSession=WalletLinkSession;var util$1={};Object.defineProperty(util$1,"__esModule",{value:!0});util$1.isDarkMode=util$1.isMobileWeb=util$1.getLocation=util$1.createQrUrl=void 0;function createQrUrl(fr,br,wr,Er,kr,jr){const Br=Er?"parent-id":"id",Wr=new URLSearchParams({[Br]:fr,secret:br,server:wr,v:kr,chainId:jr.toString()}).toString();return`${wr}/#/link?${Wr}`}util$1.createQrUrl=createQrUrl;function isInIFrame(){try{return window.frameElement!==null}catch{return!1}}function getLocation(){try{return isInIFrame()&&window.top?window.top.location:window.location}catch{return window.location}}util$1.getLocation=getLocation;function isMobileWeb(){var fr;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((fr=window==null?void 0:window.navigator)===null||fr===void 0?void 0:fr.userAgent)}util$1.isMobileWeb=isMobileWeb;function isDarkMode(){var fr,br;return(br=(fr=window==null?void 0:window.matchMedia)===null||fr===void 0?void 0:fr.call(window,"(prefers-color-scheme: dark)").matches)!==null&&br!==void 0?br:!1}util$1.isDarkMode=isDarkMode;var WalletLinkRelayUI$1={},cssReset={},cssResetCss={};Object.defineProperty(cssResetCss,"__esModule",{value:!0});cssResetCss.default='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';var __importDefault$4=commonjsGlobal&&commonjsGlobal.__importDefault||function(fr){return fr&&fr.__esModule?fr:{default:fr}};Object.defineProperty(cssReset,"__esModule",{value:!0});cssReset.injectCssReset=void 0;const cssReset_css_1=__importDefault$4(cssResetCss);function injectCssReset(){const fr=document.createElement("style");fr.type="text/css",fr.appendChild(document.createTextNode(cssReset_css_1.default)),document.documentElement.appendChild(fr)}cssReset.injectCssReset=injectCssReset;var Snackbar={};function r$2(fr){var br,wr,Er="";if(typeof fr=="string"||typeof fr=="number")Er+=fr;else if(typeof fr=="object")if(Array.isArray(fr))for(br=0;br2&&(Br.children=arguments.length>3?n.call(arguments,2):wr),typeof fr=="function"&&fr.defaultProps!=null)for(jr in fr.defaultProps)Br[jr]===void 0&&(Br[jr]=fr.defaultProps[jr]);return g$1(fr,Br,Er,kr,null)}function g$1(fr,br,wr,Er,kr){var jr={type:fr,props:br,key:wr,ref:Er,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:kr??++u$1,__i:-1,__u:0};return kr==null&&l$1.vnode!=null&&l$1.vnode(jr),jr}function m$1(){return{current:null}}function b$1(fr){return fr.children}function k$1(fr,br){this.props=fr,this.context=br}function x$1(fr,br){if(br==null)return fr.__?x$1(fr.__,fr.__i+1):null;for(var wr;brbr&&i$2.sort(f$2));M.__r=0}function P$1(fr,br,wr,Er,kr,jr,Br,Wr,qr,Gr,Vr){var Zr,Jr,Qr,_n,En,Cn=Er&&Er.__k||v$1,In=br.length;for(wr.__d=qr,$(wr,br,Cn),qr=wr.__d,Zr=0;Zr0?g$1(kr.type,kr.props,kr.key,kr.ref?kr.ref:null,kr.__v):kr).__=fr,kr.__b=fr.__b+1,jr=null,(Wr=kr.__i=L(kr,wr,Br,Vr))!==-1&&(Vr--,(jr=wr[Wr])&&(jr.__u|=131072)),jr==null||jr.__v===null?(Wr==-1&&Zr--,typeof kr.type!="function"&&(kr.__u|=65536)):Wr!==Br&&(Wr==Br-1?Zr--:Wr==Br+1?Zr++:(Wr>Br?Zr--:Zr++,kr.__u|=65536))):kr=fr.__k[Er]=null;if(Vr)for(Er=0;Er(qr!=null&&!(131072&qr.__u)?1:0))for(;Br>=0||Wr=0){if((qr=br[Br])&&!(131072&qr.__u)&&kr==qr.key&&jr===qr.type)return Br;Br--}if(Wr2&&(Wr.children=arguments.length>3?n.call(arguments,2):wr),g$1(fr.type,Wr,Er||fr.key,kr||fr.ref,null)}function G(fr,br){var wr={__c:br="__cC"+a$1++,__:fr,Consumer:function(Er,kr){return Er.children(kr)},Provider:function(Er){var kr,jr;return this.getChildContext||(kr=new Set,(jr={})[br]=this,this.getChildContext=function(){return jr},this.componentWillUnmount=function(){kr=null},this.shouldComponentUpdate=function(Br){this.props.value!==Br.value&&kr.forEach(function(Wr){Wr.__e=!0,S(Wr)})},this.sub=function(Br){kr.add(Br);var Wr=Br.componentWillUnmount;Br.componentWillUnmount=function(){kr&&kr.delete(Br),Wr&&Wr.call(Br)}}),Er.children}};return wr.Provider.__=wr.Consumer.contextType=wr}n=v$1.slice,l$1={__e:function(fr,br,wr,Er){for(var kr,jr,Br;br=br.__;)if((kr=br.__c)&&!kr.__)try{if((jr=kr.constructor)&&jr.getDerivedStateFromError!=null&&(kr.setState(jr.getDerivedStateFromError(fr)),Br=kr.__d),kr.componentDidCatch!=null&&(kr.componentDidCatch(fr,Er||{}),Br=kr.__d),Br)return kr.__E=kr}catch(Wr){fr=Wr}throw fr}},u$1=0,t$1=function(fr){return fr!=null&&fr.constructor==null},k$1.prototype.setState=function(fr,br){var wr;wr=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=d$1({},this.state),typeof fr=="function"&&(fr=fr(d$1({},wr),this.props)),fr&&d$1(wr,fr),fr!=null&&this.__v&&(br&&this._sb.push(br),S(this))},k$1.prototype.forceUpdate=function(fr){this.__v&&(this.__e=!0,fr&&this.__h.push(fr),S(this))},k$1.prototype.render=b$1,i$2=[],r$1=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,f$2=function(fr,br){return fr.__v.__b-br.__v.__b},M.__r=0,e$1=0,c$1=F$1(!1),s$1=F$1(!0),a$1=0;const preact_module=Object.freeze(Object.defineProperty({__proto__:null,Component:k$1,Fragment:b$1,cloneElement:D$1,createContext:G,createElement:_$1,createRef:m$1,h:_$1,hydrate:B$1,get isValidElement(){return t$1},get options(){return l$1},render:q$1,toChildArray:H},Symbol.toStringTag,{value:"Module"})),require$$1=getAugmentedNamespace(preact_module);var t,r,u,i$1,o=0,f$1=[],c=l$1,e=c.__b,a=c.__r,v=c.diffed,l=c.__c,m=c.unmount,s=c.__;function d(fr,br){c.__h&&c.__h(r,fr,o||br),o=0;var wr=r.__H||(r.__H={__:[],__h:[]});return fr>=wr.__.length&&wr.__.push({}),wr.__[fr]}function h(fr){return o=1,p(D,fr)}function p(fr,br,wr){var Er=d(t++,2);if(Er.t=fr,!Er.__c&&(Er.__=[wr?wr(br):D(void 0,br),function(Wr){var qr=Er.__N?Er.__N[0]:Er.__[0],Gr=Er.t(qr,Wr);qr!==Gr&&(Er.__N=[Gr,Er.__[1]],Er.__c.setState({}))}],Er.__c=r,!r.u)){var kr=function(Wr,qr,Gr){if(!Er.__c.__H)return!0;var Vr=Er.__c.__H.__.filter(function(Jr){return!!Jr.__c});if(Vr.every(function(Jr){return!Jr.__N}))return!jr||jr.call(this,Wr,qr,Gr);var Zr=Er.__c.props!==Wr;return Vr.forEach(function(Jr){if(Jr.__N){var Qr=Jr.__[0];Jr.__=Jr.__N,Jr.__N=void 0,Qr!==Jr.__[0]&&(Zr=!0)}}),jr&&jr.call(this,Wr,qr,Gr)||Zr};r.u=!0;var jr=r.shouldComponentUpdate,Br=r.componentWillUpdate;r.componentWillUpdate=function(Wr,qr,Gr){if(this.__e){var Vr=jr;jr=void 0,kr(Wr,qr,Gr),jr=Vr}Br&&Br.call(this,Wr,qr,Gr)},r.shouldComponentUpdate=kr}return Er.__N||Er.__}function y(fr,br){var wr=d(t++,3);!c.__s&&C(wr.__H,br)&&(wr.__=fr,wr.i=br,r.__H.__h.push(wr))}function _(fr,br){var wr=d(t++,4);!c.__s&&C(wr.__H,br)&&(wr.__=fr,wr.i=br,r.__h.push(wr))}function A(fr){return o=5,T(function(){return{current:fr}},[])}function F(fr,br,wr){o=6,_(function(){return typeof fr=="function"?(fr(br()),function(){return fr(null)}):fr?(fr.current=br(),function(){return fr.current=null}):void 0},wr==null?wr:wr.concat(fr))}function T(fr,br){var wr=d(t++,7);return C(wr.__H,br)&&(wr.__=fr(),wr.__H=br,wr.__h=fr),wr.__}function q(fr,br){return o=8,T(function(){return fr},br)}function x(fr){var br=r.context[fr.__c],wr=d(t++,9);return wr.c=fr,br?(wr.__==null&&(wr.__=!0,br.sub(r)),br.props.value):fr.__}function P(fr,br){c.useDebugValue&&c.useDebugValue(br?br(fr):fr)}function b(fr){var br=d(t++,10),wr=h();return br.__=fr,r.componentDidCatch||(r.componentDidCatch=function(Er,kr){br.__&&br.__(Er,kr),wr[1](Er)}),[wr[0],function(){wr[1](void 0)}]}function g(){var fr=d(t++,11);if(!fr.__){for(var br=r.__v;br!==null&&!br.__m&&br.__!==null;)br=br.__;var wr=br.__m||(br.__m=[0,0]);fr.__="P"+wr[0]+"-"+wr[1]++}return fr.__}function j(){for(var fr;fr=f$1.shift();)if(fr.__P&&fr.__H)try{fr.__H.__h.forEach(z),fr.__H.__h.forEach(B),fr.__H.__h=[]}catch(br){fr.__H.__h=[],c.__e(br,fr.__v)}}c.__b=function(fr){r=null,e&&e(fr)},c.__=function(fr,br){fr&&br.__k&&br.__k.__m&&(fr.__m=br.__k.__m),s&&s(fr,br)},c.__r=function(fr){a&&a(fr),t=0;var br=(r=fr.__c).__H;br&&(u===r?(br.__h=[],r.__h=[],br.__.forEach(function(wr){wr.__N&&(wr.__=wr.__N),wr.i=wr.__N=void 0})):(br.__h.forEach(z),br.__h.forEach(B),br.__h=[],t=0)),u=r},c.diffed=function(fr){v&&v(fr);var br=fr.__c;br&&br.__H&&(br.__H.__h.length&&(f$1.push(br)!==1&&i$1===c.requestAnimationFrame||((i$1=c.requestAnimationFrame)||w)(j)),br.__H.__.forEach(function(wr){wr.i&&(wr.__H=wr.i),wr.i=void 0})),u=r=null},c.__c=function(fr,br){br.some(function(wr){try{wr.__h.forEach(z),wr.__h=wr.__h.filter(function(Er){return!Er.__||B(Er)})}catch(Er){br.some(function(kr){kr.__h&&(kr.__h=[])}),br=[],c.__e(Er,wr.__v)}}),l&&l(fr,br)},c.unmount=function(fr){m&&m(fr);var br,wr=fr.__c;wr&&wr.__H&&(wr.__H.__.forEach(function(Er){try{z(Er)}catch(kr){br=kr}}),wr.__H=void 0,br&&c.__e(br,wr.__v))};var k=typeof requestAnimationFrame=="function";function w(fr){var br,wr=function(){clearTimeout(Er),k&&cancelAnimationFrame(br),setTimeout(fr)},Er=setTimeout(wr,100);k&&(br=requestAnimationFrame(wr))}function z(fr){var br=r,wr=fr.__c;typeof wr=="function"&&(fr.__c=void 0,wr()),r=br}function B(fr){var br=r;fr.__c=fr.__(),r=br}function C(fr,br){return!fr||fr.length!==br.length||br.some(function(wr,Er){return wr!==fr[Er]})}function D(fr,br){return typeof br=="function"?br(fr):br}const hooks_module=Object.freeze(Object.defineProperty({__proto__:null,useCallback:q,useContext:x,useDebugValue:P,useEffect:y,useErrorBoundary:b,useId:g,useImperativeHandle:F,useLayoutEffect:_,useMemo:T,useReducer:p,useRef:A,useState:h},Symbol.toStringTag,{value:"Module"})),require$$2$1=getAugmentedNamespace(hooks_module);var SnackbarCss={};Object.defineProperty(SnackbarCss,"__esModule",{value:!0});SnackbarCss.default=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}";(function(fr){var br=commonjsGlobal&&commonjsGlobal.__importDefault||function(Jr){return Jr&&Jr.__esModule?Jr:{default:Jr}};Object.defineProperty(fr,"__esModule",{value:!0}),fr.SnackbarInstance=fr.SnackbarContainer=fr.Snackbar=void 0;const wr=br(require$$0$1),Er=require$$1,kr=require$$2$1,jr=util$1,Br=br(SnackbarCss),Wr="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",qr="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class Gr{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=(0,jr.isDarkMode)()}attach(Qr){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",Qr.appendChild(this.root),this.render()}presentItem(Qr){const _n=this.nextItemKey++;return this.items.set(_n,Qr),this.render(),()=>{this.items.delete(_n),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,Er.render)((0,Er.h)("div",null,(0,Er.h)(fr.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([Qr,_n])=>(0,Er.h)(fr.SnackbarInstance,Object.assign({},_n,{key:Qr}))))),this.root)}}fr.Snackbar=Gr;const Vr=Jr=>(0,Er.h)("div",{class:(0,wr.default)("-cbwsdk-snackbar-container")},(0,Er.h)("style",null,Br.default),(0,Er.h)("div",{class:"-cbwsdk-snackbar"},Jr.children));fr.SnackbarContainer=Vr;const Zr=({autoExpand:Jr,message:Qr,menuItems:_n})=>{const[En,Cn]=(0,kr.useState)(!0),[In,An]=(0,kr.useState)(Jr??!1);(0,kr.useEffect)(()=>{const eo=[window.setTimeout(()=>{Cn(!1)},1),window.setTimeout(()=>{An(!0)},1e4)];return()=>{eo.forEach(window.clearTimeout)}});const jn=()=>{An(!In)};return(0,Er.h)("div",{class:(0,wr.default)("-cbwsdk-snackbar-instance",En&&"-cbwsdk-snackbar-instance-hidden",In&&"-cbwsdk-snackbar-instance-expanded")},(0,Er.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:jn},(0,Er.h)("img",{src:Wr,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,Er.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},Qr),(0,Er.h)("div",{class:"-gear-container"},!In&&(0,Er.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,Er.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,Er.h)("img",{src:qr,class:"-gear-icon",title:"Expand"}))),_n&&_n.length>0&&(0,Er.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},_n.map((eo,ro)=>(0,Er.h)("div",{class:(0,wr.default)("-cbwsdk-snackbar-instance-menu-item",eo.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:eo.onClick,key:ro},(0,Er.h)("svg",{width:eo.svgWidth,height:eo.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,Er.h)("path",{"fill-rule":eo.defaultFillRule,"clip-rule":eo.defaultClipRule,d:eo.path,fill:"#AAAAAA"})),(0,Er.h)("span",{class:(0,wr.default)("-cbwsdk-snackbar-instance-menu-item-info",eo.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},eo.info)))))};fr.SnackbarInstance=Zr})(Snackbar);Object.defineProperty(WalletLinkRelayUI$1,"__esModule",{value:!0});WalletLinkRelayUI$1.WalletLinkRelayUI=void 0;const cssReset_1$1=cssReset,Snackbar_1$1=Snackbar;class WalletLinkRelayUI{constructor(){this.attached=!1,this.snackbar=new Snackbar_1$1.Snackbar}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const br=document.documentElement,wr=document.createElement("div");wr.className="-cbwsdk-css-reset",br.appendChild(wr),this.snackbar.attach(wr),this.attached=!0,(0,cssReset_1$1.injectCssReset)()}showConnecting(br){let wr;return br.isUnlinkedErrorState?wr={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:br.onResetConnection}]}:wr={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:br.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:br.onResetConnection}]},this.snackbar.presentItem(wr)}}WalletLinkRelayUI$1.WalletLinkRelayUI=WalletLinkRelayUI;var WLMobileRelayUI$1={},RedirectDialog$1={},RedirectDialogCss={};Object.defineProperty(RedirectDialogCss,"__esModule",{value:!0});RedirectDialogCss.default=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";var __importDefault$3=commonjsGlobal&&commonjsGlobal.__importDefault||function(fr){return fr&&fr.__esModule?fr:{default:fr}};Object.defineProperty(RedirectDialog$1,"__esModule",{value:!0});RedirectDialog$1.RedirectDialog=void 0;const clsx_1=__importDefault$3(require$$0$1),preact_1=require$$1,cssReset_1=cssReset,Snackbar_1=Snackbar,util_1$6=util$1,RedirectDialog_css_1=__importDefault$3(RedirectDialogCss);class RedirectDialog{constructor(){this.root=null,this.darkMode=(0,util_1$6.isDarkMode)()}attach(){const br=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",br.appendChild(this.root),(0,cssReset_1.injectCssReset)()}present(br){this.render(br)}clear(){this.render(null)}render(br){this.root&&((0,preact_1.render)(null,this.root),br&&(0,preact_1.render)((0,preact_1.h)(RedirectDialogContent,Object.assign({},br,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}RedirectDialog$1.RedirectDialog=RedirectDialog;const RedirectDialogContent=({title:fr,buttonText:br,darkMode:wr,onButtonClick:Er,onDismiss:kr})=>{const jr=wr?"dark":"light";return(0,preact_1.h)(Snackbar_1.SnackbarContainer,{darkMode:wr},(0,preact_1.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,preact_1.h)("style",null,RedirectDialog_css_1.default),(0,preact_1.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:kr}),(0,preact_1.h)("div",{class:(0,clsx_1.default)("-cbwsdk-redirect-dialog-box",jr)},(0,preact_1.h)("p",null,fr),(0,preact_1.h)("button",{onClick:Er},br))))};var constants={};Object.defineProperty(constants,"__esModule",{value:!0});constants.CBW_MOBILE_DEEPLINK_URL=constants.WALLETLINK_URL=constants.CB_KEYS_URL=void 0;constants.CB_KEYS_URL="https://keys.coinbase.com/connect";constants.WALLETLINK_URL="https://www.walletlink.org";constants.CBW_MOBILE_DEEPLINK_URL="https://go.cb-w.com/walletlink";Object.defineProperty(WLMobileRelayUI$1,"__esModule",{value:!0});WLMobileRelayUI$1.WLMobileRelayUI=void 0;const RedirectDialog_1=RedirectDialog$1,util_1$5=util$1,constants_1$3=constants;class WLMobileRelayUI{constructor(){this.attached=!1,this.redirectDialog=new RedirectDialog_1.RedirectDialog}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(br){const wr=new URL(constants_1$3.CBW_MOBILE_DEEPLINK_URL);wr.searchParams.append("redirect_url",(0,util_1$5.getLocation)().href),br&&wr.searchParams.append("wl_url",br);const Er=document.createElement("a");Er.target="cbw-opener",Er.href=wr.href,Er.rel="noreferrer noopener",Er.click()}openCoinbaseWalletDeeplink(br){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(br)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(br)},99)}showConnecting(br){return()=>{this.redirectDialog.clear()}}}WLMobileRelayUI$1.WLMobileRelayUI=WLMobileRelayUI;Object.defineProperty(WalletLinkRelay$1,"__esModule",{value:!0});WalletLinkRelay$1.WalletLinkRelay=void 0;const WalletLinkConnection_1=WalletLinkConnection$1,constants_1$2=constants$1,RelayEventManager_1$1=RelayEventManager$1,WalletLinkSession_1=WalletLinkSession$1,Web3Response_1$1=Web3Response,util_1$4=util$1,WalletLinkRelayUI_1=WalletLinkRelayUI$1,WLMobileRelayUI_1=WLMobileRelayUI$1,error_1$6=error,util_2$1=util$6,ScopedLocalStorage_1$4=ScopedLocalStorage$1;class WalletLinkRelay{constructor(br){this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,util_1$4.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=jr=>{this.isLinked=jr;const Br=this.storage.getItem(constants_1$2.LOCAL_STORAGE_ADDRESSES_KEY);if(jr&&(this._session.linked=jr),this.isUnlinkedErrorState=!1,Br){const Wr=Br.split(" "),qr=this.storage.getItem("IsStandaloneSigning")==="true";Wr[0]!==""&&!jr&&this._session.linked&&!qr&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(jr,Br)=>{this.storage.setItem(jr,Br)},this.chainUpdated=(jr,Br)=>{this.chainCallbackParams.chainId===jr&&this.chainCallbackParams.jsonRpcUrl===Br||(this.chainCallbackParams={chainId:jr,jsonRpcUrl:Br},this.chainCallback&&this.chainCallback(jr,Br))},this.accountUpdated=jr=>{this.accountsCallback&&this.accountsCallback([jr]),WalletLinkRelay.accountRequestCallbackIds.size>0&&(Array.from(WalletLinkRelay.accountRequestCallbackIds.values()).forEach(Br=>{const Wr={type:"WEB3_RESPONSE",id:Br,response:{method:"requestEthereumAccounts",result:[jr]}};this.invokeCallback(Object.assign(Object.assign({},Wr),{id:Br}))}),WalletLinkRelay.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=br.linkAPIUrl,this.storage=br.storage;const{session:wr,ui:Er,connection:kr}=this.subscribe();this._session=wr,this.connection=kr,this.relayEventManager=new RelayEventManager_1$1.RelayEventManager,this.ui=Er}subscribe(){const br=WalletLinkSession_1.WalletLinkSession.load(this.storage)||new WalletLinkSession_1.WalletLinkSession(this.storage).save(),{linkAPIUrl:wr}=this,Er=new WalletLinkConnection_1.WalletLinkConnection({session:br,linkAPIUrl:wr,listener:this}),kr=this.isMobileWeb?new WLMobileRelayUI_1.WLMobileRelayUI:new WalletLinkRelayUI_1.WalletLinkRelayUI;return Er.connect(),{session:br,ui:kr,connection:Er}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(br=>setTimeout(()=>br(null),1e3))]).then(()=>{this.connection.destroy();const br=WalletLinkSession_1.WalletLinkSession.load(this.storage);(br==null?void 0:br.id)===this._session.id&&ScopedLocalStorage_1$4.ScopedLocalStorage.clearAll(),document.location.reload()}).catch(br=>{})}setAppInfo(br,wr){this.appName=br,this.appLogoUrl=wr}getStorageItem(br){return this.storage.getItem(br)}setStorageItem(br,wr){this.storage.setItem(br,wr)}signEthereumMessage(br,wr,Er,kr){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,util_2$1.hexStringFromBuffer)(br,!0),address:wr,addPrefix:Er,typedDataJson:kr||null}})}ethereumAddressFromSignedMessage(br,wr,Er){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,util_2$1.hexStringFromBuffer)(br,!0),signature:(0,util_2$1.hexStringFromBuffer)(wr,!0),addPrefix:Er}})}signEthereumTransaction(br){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:br.fromAddress,toAddress:br.toAddress,weiValue:(0,util_2$1.bigIntStringFromBigInt)(br.weiValue),data:(0,util_2$1.hexStringFromBuffer)(br.data,!0),nonce:br.nonce,gasPriceInWei:br.gasPriceInWei?(0,util_2$1.bigIntStringFromBigInt)(br.gasPriceInWei):null,maxFeePerGas:br.gasPriceInWei?(0,util_2$1.bigIntStringFromBigInt)(br.gasPriceInWei):null,maxPriorityFeePerGas:br.gasPriceInWei?(0,util_2$1.bigIntStringFromBigInt)(br.gasPriceInWei):null,gasLimit:br.gasLimit?(0,util_2$1.bigIntStringFromBigInt)(br.gasLimit):null,chainId:br.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(br){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:br.fromAddress,toAddress:br.toAddress,weiValue:(0,util_2$1.bigIntStringFromBigInt)(br.weiValue),data:(0,util_2$1.hexStringFromBuffer)(br.data,!0),nonce:br.nonce,gasPriceInWei:br.gasPriceInWei?(0,util_2$1.bigIntStringFromBigInt)(br.gasPriceInWei):null,maxFeePerGas:br.maxFeePerGas?(0,util_2$1.bigIntStringFromBigInt)(br.maxFeePerGas):null,maxPriorityFeePerGas:br.maxPriorityFeePerGas?(0,util_2$1.bigIntStringFromBigInt)(br.maxPriorityFeePerGas):null,gasLimit:br.gasLimit?(0,util_2$1.bigIntStringFromBigInt)(br.gasLimit):null,chainId:br.chainId,shouldSubmit:!0}})}submitEthereumTransaction(br,wr){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,util_2$1.hexStringFromBuffer)(br,!0),chainId:wr}})}scanQRCode(br){return this.sendRequest({method:"scanQRCode",params:{regExp:br}})}getWalletLinkSession(){return this._session}genericRequest(br,wr){return this.sendRequest({method:"generic",params:{action:wr,data:br}})}sendGenericMessage(br){return this.sendRequest(br)}sendRequest(br){let wr=null;const Er=(0,util_2$1.randomBytesHex)(8),kr=jr=>{this.publishWeb3RequestCanceledEvent(Er),this.handleErrorResponse(Er,br.method,jr),wr==null||wr()};return new Promise((jr,Br)=>{wr=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:kr,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(Er,Wr=>{if(wr==null||wr(),(0,Web3Response_1$1.isErrorResponse)(Wr))return Br(new Error(Wr.errorMessage));jr(Wr)}),this.publishWeb3RequestEvent(Er,br)})}setAccountsCallback(br){this.accountsCallback=br}setChainCallback(br){this.chainCallback=br}setDappDefaultChainCallback(br){this.dappDefaultChain=br}publishWeb3RequestEvent(br,wr){const Er={type:"WEB3_REQUEST",id:br,request:wr};this.publishEvent("Web3Request",Er,!0).then(kr=>{}).catch(kr=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:Er.id,response:{method:wr.method,errorMessage:kr.message}})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(wr.method)}openCoinbaseWalletDeeplink(br){if(this.ui instanceof WLMobileRelayUI_1.WLMobileRelayUI)switch(br){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(br){const wr={type:"WEB3_REQUEST_CANCELED",id:br};this.publishEvent("Web3RequestCanceled",wr,!1).then()}publishEvent(br,wr,Er){return this.connection.publishEvent(br,wr,Er)}handleWeb3ResponseMessage(br){const{response:wr}=br;if(wr.method==="requestEthereumAccounts"){WalletLinkRelay.accountRequestCallbackIds.forEach(Er=>this.invokeCallback(Object.assign(Object.assign({},br),{id:Er}))),WalletLinkRelay.accountRequestCallbackIds.clear();return}this.invokeCallback(br)}handleErrorResponse(br,wr,Er){var kr;const jr=(kr=Er==null?void 0:Er.message)!==null&&kr!==void 0?kr:"Unspecified error message.";this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:br,response:{method:wr,errorMessage:jr}})}invokeCallback(br){const wr=this.relayEventManager.callbacks.get(br.id);wr&&(wr(br.response),this.relayEventManager.callbacks.delete(br.id))}requestEthereumAccounts(){const br={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},wr=(0,util_2$1.randomBytesHex)(8);return new Promise((Er,kr)=>{this.relayEventManager.callbacks.set(wr,jr=>{if((0,Web3Response_1$1.isErrorResponse)(jr))return kr(new Error(jr.errorMessage));Er(jr)}),WalletLinkRelay.accountRequestCallbackIds.add(wr),this.publishWeb3RequestEvent(wr,br)})}watchAsset(br,wr,Er,kr,jr,Br){const Wr={method:"watchAsset",params:{type:br,options:{address:wr,symbol:Er,decimals:kr,image:jr},chainId:Br}};let qr=null;const Gr=(0,util_2$1.randomBytesHex)(8),Vr=Zr=>{this.publishWeb3RequestCanceledEvent(Gr),this.handleErrorResponse(Gr,Wr.method,Zr),qr==null||qr()};return qr=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:Vr,onResetConnection:this.resetAndReload}),new Promise((Zr,Jr)=>{this.relayEventManager.callbacks.set(Gr,Qr=>{if(qr==null||qr(),(0,Web3Response_1$1.isErrorResponse)(Qr))return Jr(new Error(Qr.errorMessage));Zr(Qr)}),this.publishWeb3RequestEvent(Gr,Wr)})}addEthereumChain(br,wr,Er,kr,jr,Br){const Wr={method:"addEthereumChain",params:{chainId:br,rpcUrls:wr,blockExplorerUrls:kr,chainName:jr,iconUrls:Er,nativeCurrency:Br}};let qr=null;const Gr=(0,util_2$1.randomBytesHex)(8),Vr=Zr=>{this.publishWeb3RequestCanceledEvent(Gr),this.handleErrorResponse(Gr,Wr.method,Zr),qr==null||qr()};return qr=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:Vr,onResetConnection:this.resetAndReload}),new Promise((Zr,Jr)=>{this.relayEventManager.callbacks.set(Gr,Qr=>{if(qr==null||qr(),(0,Web3Response_1$1.isErrorResponse)(Qr))return Jr(new Error(Qr.errorMessage));Zr(Qr)}),this.publishWeb3RequestEvent(Gr,Wr)})}switchEthereumChain(br,wr){const Er={method:"switchEthereumChain",params:Object.assign({chainId:br},{address:wr})},kr=(0,util_2$1.randomBytesHex)(8);return new Promise((jr,Br)=>{this.relayEventManager.callbacks.set(kr,Wr=>{if((0,Web3Response_1$1.isErrorResponse)(Wr)&&Wr.errorCode)return Br(error_1$6.standardErrors.provider.custom({code:Wr.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,Web3Response_1$1.isErrorResponse)(Wr))return Br(new Error(Wr.errorMessage));jr(Wr)}),this.publishWeb3RequestEvent(kr,Er)})}}WalletLinkRelay$1.WalletLinkRelay=WalletLinkRelay;WalletLinkRelay.accountRequestCallbackIds=new Set;var __importDefault$2=commonjsGlobal&&commonjsGlobal.__importDefault||function(fr){return fr&&fr.__esModule?fr:{default:fr}};Object.defineProperty(WalletLinkSigner$1,"__esModule",{value:!0});WalletLinkSigner$1.WalletLinkSigner=void 0;const eth_eip712_util_1=__importDefault$2(ethEip712Util),constants_1$1=constants$1,RelayEventManager_1=RelayEventManager$1,Web3Response_1=Web3Response,WalletLinkRelay_1=WalletLinkRelay$1,constants_2=constants,error_1$5=error,util_1$3=util$6,ScopedLocalStorage_1$3=ScopedLocalStorage$1,DEFAULT_CHAIN_ID_KEY="DefaultChainId",DEFAULT_JSON_RPC_URL="DefaultJsonRpcUrl";class WalletLinkSigner{constructor(br){var wr,Er;this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1;const{appName:kr,appLogoUrl:jr}=br.metadata;this._appName=kr,this._appLogoUrl=jr,this._storage=new ScopedLocalStorage_1$3.ScopedLocalStorage("walletlink",constants_2.WALLETLINK_URL),this.updateListener=br.updateListener,this._relayEventManager=new RelayEventManager_1.RelayEventManager,this._jsonRpcUrlFromOpts="";const Br=this._storage.getItem(constants_1$1.LOCAL_STORAGE_ADDRESSES_KEY);if(Br){const qr=Br.split(" ");qr[0]!==""&&(this._addresses=qr.map(Gr=>(0,util_1$3.ensureAddressString)(Gr)),(wr=this.updateListener)===null||wr===void 0||wr.onAccountsUpdate({accounts:this._addresses,source:"storage"}))}this._storage.getItem(DEFAULT_CHAIN_ID_KEY)&&((Er=this.updateListener)===null||Er===void 0||Er.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0),this.initializeRelay()}getSession(){const br=this.initializeRelay(),{id:wr,secret:Er}=br.getWalletLinkSession();return{id:wr,secret:Er}}async handshake(){return await this.request({method:"eth_requestAccounts"})}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var br;return(br=this._storage.getItem(DEFAULT_JSON_RPC_URL))!==null&&br!==void 0?br:this._jsonRpcUrlFromOpts}set jsonRpcUrl(br){this._storage.setItem(DEFAULT_JSON_RPC_URL,br)}updateProviderInfo(br,wr){var Er;this.jsonRpcUrl=br;const kr=this.getChainId();this._storage.setItem(DEFAULT_CHAIN_ID_KEY,wr.toString(10)),((0,util_1$3.ensureIntNumber)(wr)!==kr||!this.hasMadeFirstChainChangedEmission)&&((Er=this.updateListener)===null||Er===void 0||Er.onChainUpdate({chain:{id:wr,rpcUrl:br},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(br,wr,Er,kr,jr,Br){const qr=await this.initializeRelay().watchAsset(br,wr,Er,kr,jr,Br==null?void 0:Br.toString());return(0,Web3Response_1.isErrorResponse)(qr)?!1:!!qr.result}async addEthereumChain(br,wr,Er,kr,jr,Br){var Wr,qr;if((0,util_1$3.ensureIntNumber)(br)===this.getChainId())return!1;const Gr=this.initializeRelay();this._isAuthorized()||await Gr.requestEthereumAccounts();const Vr=await Gr.addEthereumChain(br.toString(),wr,jr,Er,kr,Br);return(0,Web3Response_1.isErrorResponse)(Vr)?!1:(((Wr=Vr.result)===null||Wr===void 0?void 0:Wr.isApproved)===!0&&this.updateProviderInfo(wr[0],br),((qr=Vr.result)===null||qr===void 0?void 0:qr.isApproved)===!0)}async switchEthereumChain(br){const Er=await this.initializeRelay().switchEthereumChain(br.toString(10),this.selectedAddress||void 0);if((0,Web3Response_1.isErrorResponse)(Er)){if(!Er.errorCode)return;throw Er.errorCode===error_1$5.standardErrorCodes.provider.unsupportedChain?error_1$5.standardErrors.provider.unsupportedChain():error_1$5.standardErrors.provider.custom({message:Er.errorMessage,code:Er.errorCode})}const kr=Er.result;kr.isApproved&&kr.rpcUrl.length>0&&this.updateProviderInfo(kr.rpcUrl,br)}async disconnect(){this._relay&&this._relay.resetAndReload(),this._storage.clear()}async request(br){try{return this._request(br).catch(wr=>{throw wr})}catch(wr){return Promise.reject(wr)}}async _request(br){if(!br||typeof br!="object"||Array.isArray(br))throw error_1$5.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:br});const{method:wr,params:Er}=br;if(typeof wr!="string"||wr.length===0)throw error_1$5.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:br});if(Er!==void 0&&!Array.isArray(Er)&&(typeof Er!="object"||Er===null))throw error_1$5.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:br});const kr=Er===void 0?[]:Er,jr=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:wr,params:kr,jsonrpc:"2.0",id:jr})).result}_setAddresses(br,wr){var Er;if(!Array.isArray(br))throw new Error("addresses is not an array");const kr=br.map(jr=>(0,util_1$3.ensureAddressString)(jr));JSON.stringify(kr)!==JSON.stringify(this._addresses)&&(this._addresses=kr,(Er=this.updateListener)===null||Er===void 0||Er.onAccountsUpdate({accounts:kr,source:"wallet"}),this._storage.setItem(constants_1$1.LOCAL_STORAGE_ADDRESSES_KEY,kr.join(" ")))}_sendRequestAsync(br){return new Promise((wr,Er)=>{try{const kr=this._handleSynchronousMethods(br);if(kr!==void 0)return wr({jsonrpc:"2.0",id:br.id,result:kr})}catch(kr){return Er(kr)}this._handleAsynchronousMethods(br).then(kr=>kr&&wr(Object.assign(Object.assign({},kr),{id:br.id}))).catch(kr=>Er(kr))})}_handleSynchronousMethods(br){const{method:wr}=br;switch(wr){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(br){const{method:wr}=br,Er=br.params||[];switch(wr){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(Er);case"eth_ecRecover":return this._eth_ecRecover(Er);case"personal_sign":return this._personal_sign(Er);case"personal_ecRecover":return this._personal_ecRecover(Er);case"eth_signTransaction":return this._eth_signTransaction(Er);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(Er);case"eth_sendTransaction":return this._eth_sendTransaction(Er);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(Er);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(Er);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(Er);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(Er);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(Er);case"wallet_watchAsset":return this._wallet_watchAsset(Er);default:return this._throwUnsupportedMethodError()}}_isKnownAddress(br){try{const wr=(0,util_1$3.ensureAddressString)(br);return this._addresses.map(kr=>(0,util_1$3.ensureAddressString)(kr)).includes(wr)}catch{}return!1}_ensureKnownAddress(br){if(!this._isKnownAddress(br))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(br){const wr=br.from?(0,util_1$3.ensureAddressString)(br.from):this.selectedAddress;if(!wr)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(wr);const Er=br.to?(0,util_1$3.ensureAddressString)(br.to):null,kr=br.value!=null?(0,util_1$3.ensureBigInt)(br.value):BigInt(0),jr=br.data?(0,util_1$3.ensureBuffer)(br.data):Buffer$2.alloc(0),Br=br.nonce!=null?(0,util_1$3.ensureIntNumber)(br.nonce):null,Wr=br.gasPrice!=null?(0,util_1$3.ensureBigInt)(br.gasPrice):null,qr=br.maxFeePerGas!=null?(0,util_1$3.ensureBigInt)(br.maxFeePerGas):null,Gr=br.maxPriorityFeePerGas!=null?(0,util_1$3.ensureBigInt)(br.maxPriorityFeePerGas):null,Vr=br.gas!=null?(0,util_1$3.ensureBigInt)(br.gas):null,Zr=br.chainId?(0,util_1$3.ensureIntNumber)(br.chainId):this.getChainId();return{fromAddress:wr,toAddress:Er,weiValue:kr,data:jr,nonce:Br,gasPriceInWei:Wr,maxFeePerGas:qr,maxPriorityFeePerGas:Gr,gasLimit:Vr,chainId:Zr}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw error_1$5.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw error_1$5.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(br,wr,Er,kr){this._ensureKnownAddress(wr);try{const Br=await this.initializeRelay().signEthereumMessage(br,wr,Er,kr);if((0,Web3Response_1.isErrorResponse)(Br))throw new Error(Br.errorMessage);return{jsonrpc:"2.0",id:0,result:Br.result}}catch(jr){throw typeof jr.message=="string"&&jr.message.match(/(denied|rejected)/i)?error_1$5.standardErrors.provider.userRejectedRequest("User denied message signature"):jr}}async _ethereumAddressFromSignedMessage(br,wr,Er){const jr=await this.initializeRelay().ethereumAddressFromSignedMessage(br,wr,Er);if((0,Web3Response_1.isErrorResponse)(jr))throw new Error(jr.errorMessage);return{jsonrpc:"2.0",id:0,result:jr.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,util_1$3.hexStringFromIntNumber)(this.getChainId())}getChainId(){const br=this._storage.getItem(DEFAULT_CHAIN_ID_KEY);if(!br)return(0,util_1$3.ensureIntNumber)(1);const wr=parseInt(br,10);return(0,util_1$3.ensureIntNumber)(wr)}async _eth_requestAccounts(){if(this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let br;try{if(br=await this.initializeRelay().requestEthereumAccounts(),(0,Web3Response_1.isErrorResponse)(br))throw new Error(br.errorMessage)}catch(wr){throw typeof wr.message=="string"&&wr.message.match(/(denied|rejected)/i)?error_1$5.standardErrors.provider.userRejectedRequest("User denied account authorization"):wr}if(!br.result)throw new Error("accounts received is empty");return this._setAddresses(br.result),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(br){this._requireAuthorization();const wr=(0,util_1$3.ensureAddressString)(br[0]),Er=(0,util_1$3.ensureBuffer)(br[1]);return this._signEthereumMessage(Er,wr,!1)}_eth_ecRecover(br){const wr=(0,util_1$3.ensureBuffer)(br[0]),Er=(0,util_1$3.ensureBuffer)(br[1]);return this._ethereumAddressFromSignedMessage(wr,Er,!1)}_personal_sign(br){this._requireAuthorization();const wr=(0,util_1$3.ensureBuffer)(br[0]),Er=(0,util_1$3.ensureAddressString)(br[1]);return this._signEthereumMessage(wr,Er,!0)}_personal_ecRecover(br){const wr=(0,util_1$3.ensureBuffer)(br[0]),Er=(0,util_1$3.ensureBuffer)(br[1]);return this._ethereumAddressFromSignedMessage(wr,Er,!0)}async _eth_signTransaction(br){this._requireAuthorization();const wr=this._prepareTransactionParams(br[0]||{});try{const kr=await this.initializeRelay().signEthereumTransaction(wr);if((0,Web3Response_1.isErrorResponse)(kr))throw new Error(kr.errorMessage);return{jsonrpc:"2.0",id:0,result:kr.result}}catch(Er){throw typeof Er.message=="string"&&Er.message.match(/(denied|rejected)/i)?error_1$5.standardErrors.provider.userRejectedRequest("User denied transaction signature"):Er}}async _eth_sendRawTransaction(br){const wr=(0,util_1$3.ensureBuffer)(br[0]),kr=await this.initializeRelay().submitEthereumTransaction(wr,this.getChainId());if((0,Web3Response_1.isErrorResponse)(kr))throw new Error(kr.errorMessage);return{jsonrpc:"2.0",id:0,result:kr.result}}async _eth_sendTransaction(br){this._requireAuthorization();const wr=this._prepareTransactionParams(br[0]||{});try{const kr=await this.initializeRelay().signAndSubmitEthereumTransaction(wr);if((0,Web3Response_1.isErrorResponse)(kr))throw new Error(kr.errorMessage);return{jsonrpc:"2.0",id:0,result:kr.result}}catch(Er){throw typeof Er.message=="string"&&Er.message.match(/(denied|rejected)/i)?error_1$5.standardErrors.provider.userRejectedRequest("User denied transaction signature"):Er}}async _eth_signTypedData_v1(br){this._requireAuthorization();const wr=(0,util_1$3.ensureParsedJSONObject)(br[0]),Er=(0,util_1$3.ensureAddressString)(br[1]);this._ensureKnownAddress(Er);const kr=eth_eip712_util_1.default.hashForSignTypedDataLegacy({data:wr}),jr=JSON.stringify(wr,null,2);return this._signEthereumMessage(kr,Er,!1,jr)}async _eth_signTypedData_v3(br){this._requireAuthorization();const wr=(0,util_1$3.ensureAddressString)(br[0]),Er=(0,util_1$3.ensureParsedJSONObject)(br[1]);this._ensureKnownAddress(wr);const kr=eth_eip712_util_1.default.hashForSignTypedData_v3({data:Er}),jr=JSON.stringify(Er,null,2);return this._signEthereumMessage(kr,wr,!1,jr)}async _eth_signTypedData_v4(br){this._requireAuthorization();const wr=(0,util_1$3.ensureAddressString)(br[0]),Er=(0,util_1$3.ensureParsedJSONObject)(br[1]);this._ensureKnownAddress(wr);const kr=eth_eip712_util_1.default.hashForSignTypedData_v4({data:Er}),jr=JSON.stringify(Er,null,2);return this._signEthereumMessage(kr,wr,!1,jr)}async _wallet_addEthereumChain(br){var wr,Er,kr,jr;const Br=br[0];if(((wr=Br.rpcUrls)===null||wr===void 0?void 0:wr.length)===0)return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!Br.chainName||Br.chainName.trim()==="")throw error_1$5.standardErrors.rpc.invalidParams("chainName is a required field");if(!Br.nativeCurrency)throw error_1$5.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const Wr=parseInt(Br.chainId,16);return await this.addEthereumChain(Wr,(Er=Br.rpcUrls)!==null&&Er!==void 0?Er:[],(kr=Br.blockExplorerUrls)!==null&&kr!==void 0?kr:[],Br.chainName,(jr=Br.iconUrls)!==null&&jr!==void 0?jr:[],Br.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(br){const wr=br[0];return await this.switchEthereumChain(parseInt(wr.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(br){const wr=Array.isArray(br)?br[0]:br;if(!wr.type)throw error_1$5.standardErrors.rpc.invalidParams("Type is required");if((wr==null?void 0:wr.type)!=="ERC20")throw error_1$5.standardErrors.rpc.invalidParams(`Asset of type '${wr.type}' is not supported`);if(!(wr!=null&&wr.options))throw error_1$5.standardErrors.rpc.invalidParams("Options are required");if(!(wr!=null&&wr.options.address))throw error_1$5.standardErrors.rpc.invalidParams("Address is required");const Er=this.getChainId(),{address:kr,symbol:jr,image:Br,decimals:Wr}=wr.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(wr.type,kr,jr,Wr,Br,Er)}}initializeRelay(){if(!this._relay){const br=new WalletLinkRelay_1.WalletLinkRelay({linkAPIUrl:constants_2.WALLETLINK_URL,storage:this._storage});br.setAppInfo(this._appName,this._appLogoUrl),br.attachUI(),br.setAccountsCallback((wr,Er)=>this._setAddresses(wr,Er)),br.setChainCallback((wr,Er)=>{this.updateProviderInfo(Er,parseInt(wr,10))}),this._relay=br}return this._relay}}WalletLinkSigner$1.WalletLinkSigner=WalletLinkSigner;var provider={};Object.defineProperty(provider,"__esModule",{value:!0});provider.checkErrorForInvalidRequestArgs=provider.getCoinbaseInjectedProvider=provider.getCoinbaseInjectedSigner=provider.fetchRPCRequest=void 0;const version_1$2=version$8,error_1$4=error;async function fetchRPCRequest(fr,br){if(!br.rpcUrl)throw error_1$4.standardErrors.rpc.internal("No RPC URL set for chain");const wr=Object.assign(Object.assign({},fr),{jsonrpc:"2.0",id:crypto.randomUUID()});return(await(await window.fetch(br.rpcUrl,{method:"POST",body:JSON.stringify(wr),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":version_1$2.LIB_VERSION}})).json()).result}provider.fetchRPCRequest=fetchRPCRequest;function getCoinbaseInjectedSigner(){return globalThis.coinbaseWalletSigner}provider.getCoinbaseInjectedSigner=getCoinbaseInjectedSigner;function getCoinbaseInjectedLegacyProvider(){return globalThis.coinbaseWalletExtension}function getInjectedEthereum(){var fr,br;try{const wr=globalThis;return(fr=wr.ethereum)!==null&&fr!==void 0?fr:(br=wr.top)===null||br===void 0?void 0:br.ethereum}catch{return}}function getCoinbaseInjectedProvider({metadata:fr,preference:br}){var wr;if(br.options!=="smartWalletOnly"){if(getCoinbaseInjectedSigner())return;const jr=getCoinbaseInjectedLegacyProvider();if(jr){const{appName:Br,appLogoUrl:Wr,appChainIds:qr}=fr;return(wr=jr.setAppInfo)===null||wr===void 0||wr.call(jr,Br,Wr,qr),jr}}const Er=getInjectedEthereum();if(Er!=null&&Er.isCoinbaseBrowser)return Er}provider.getCoinbaseInjectedProvider=getCoinbaseInjectedProvider;function checkErrorForInvalidRequestArgs(fr){if(!fr||typeof fr!="object"||Array.isArray(fr))return error_1$4.standardErrors.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:fr});const{method:br,params:wr}=fr;if(typeof br!="string"||br.length===0)return error_1$4.standardErrors.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:fr});if(wr!==void 0&&!Array.isArray(wr)&&(typeof wr!="object"||wr===null))return error_1$4.standardErrors.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:fr})}provider.checkErrorForInvalidRequestArgs=checkErrorForInvalidRequestArgs;Object.defineProperty(util$5,"__esModule",{value:!0});util$5.createSigner=util$5.fetchSignerType=util$5.storeSignerType=util$5.loadSignerType=void 0;const SCWSigner_1=SCWSigner$1,WalletLinkSigner_1=WalletLinkSigner$1,error_1$3=error,provider_1$2=provider,ScopedLocalStorage_1$2=ScopedLocalStorage$1,SIGNER_TYPE_KEY="SignerType",storage$1=new ScopedLocalStorage_1$2.ScopedLocalStorage("CBWSDK","SignerConfigurator");function loadSignerType(){return storage$1.getItem(SIGNER_TYPE_KEY)}util$5.loadSignerType=loadSignerType;function storeSignerType(fr){storage$1.setItem(SIGNER_TYPE_KEY,fr)}util$5.storeSignerType=storeSignerType;async function fetchSignerType(fr){const{communicator:br,metadata:wr}=fr;listenForWalletLinkSessionRequest(br,wr).catch(()=>{});const Er={id:crypto.randomUUID(),event:"selectSignerType",data:fr.preference},{data:kr}=await br.postRequestAndWaitForResponse(Er);return kr}util$5.fetchSignerType=fetchSignerType;function createSigner(fr){const{signerType:br,metadata:wr,communicator:Er,updateListener:kr}=fr;switch(br){case"scw":return new SCWSigner_1.SCWSigner({metadata:wr,updateListener:kr,communicator:Er});case"walletlink":return new WalletLinkSigner_1.WalletLinkSigner({metadata:wr,updateListener:kr});case"extension":{const jr=(0,provider_1$2.getCoinbaseInjectedSigner)();if(!jr)throw error_1$3.standardErrors.rpc.internal("injected signer not found");return jr}}}util$5.createSigner=createSigner;async function listenForWalletLinkSessionRequest(fr,br){await fr.onMessage(({event:Er})=>Er==="WalletLinkSessionRequest");const wr=new WalletLinkSigner_1.WalletLinkSigner({metadata:br});fr.postMessage({event:"WalletLinkUpdate",data:{session:wr.getSession()}}),await wr.handshake(),fr.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}var Communicator$1={},util={};Object.defineProperty(util,"__esModule",{value:!0});util.closePopup=util.openPopup=void 0;const error_1$2=error,POPUP_WIDTH=420,POPUP_HEIGHT=540;function openPopup(fr){const br=(window.innerWidth-POPUP_WIDTH)/2+window.screenX,wr=(window.innerHeight-POPUP_HEIGHT)/2+window.screenY,Er=window.open(fr,"Smart Wallet",`width=${POPUP_WIDTH}, height=${POPUP_HEIGHT}, left=${br}, top=${wr}`);if(Er==null||Er.focus(),!Er)throw error_1$2.standardErrors.rpc.internal("Pop up window failed to open");return Er}util.openPopup=openPopup;function closePopup(fr){fr&&!fr.closed&&fr.close()}util.closePopup=closePopup;Object.defineProperty(Communicator$1,"__esModule",{value:!0});Communicator$1.Communicator=void 0;const version_1$1=version$8,util_1$2=util,constants_1=constants,error_1$1=error;class Communicator{constructor(br=constants_1.CB_KEYS_URL){this.popup=null,this.listeners=new Map,this.postMessage=async wr=>{(await this.waitForPopupLoaded()).postMessage(wr,this.url.origin)},this.postRequestAndWaitForResponse=async wr=>{const Er=this.onMessage(({requestId:kr})=>kr===wr.id);return this.postMessage(wr),await Er},this.onMessage=async wr=>new Promise((Er,kr)=>{const jr=Br=>{if(Br.origin!==this.url.origin)return;const Wr=Br.data;wr(Wr)&&(Er(Wr),window.removeEventListener("message",jr),this.listeners.delete(jr))};window.addEventListener("message",jr),this.listeners.set(jr,{reject:kr})}),this.disconnect=()=>{(0,util_1$2.closePopup)(this.popup),this.popup=null,this.listeners.forEach(({reject:wr},Er)=>{wr(error_1$1.standardErrors.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",Er)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=(0,util_1$2.openPopup)(this.url),this.onMessage(({event:wr})=>wr==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:wr})=>wr==="PopupLoaded").then(wr=>{this.postMessage({requestId:wr.id,data:{version:version_1$1.LIB_VERSION}})}).then(()=>{if(!this.popup)throw error_1$1.standardErrors.rpc.internal();return this.popup})),this.url=new URL(br)}}Communicator$1.Communicator=Communicator;var method={};Object.defineProperty(method,"__esModule",{value:!0});method.determineMethodCategory=void 0;const mapping={handshake:["eth_requestAccounts"],sign:["eth_ecRecover","personal_sign","personal_ecRecover","eth_signTransaction","eth_sendTransaction","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","eth_signTypedData","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_watchAsset","wallet_getCapabilities","wallet_sendCalls","wallet_showCallsStatus"],state:["eth_chainId","eth_accounts","eth_coinbase","net_version"],deprecated:["eth_sign","eth_signTypedData_v2"],unsupported:["eth_subscribe","eth_unsubscribe"],fetch:[]};function determineMethodCategory(fr){for(const br in mapping){const wr=br;if(mapping[wr].includes(fr))return wr}}method.determineMethodCategory=determineMethodCategory;var __rest$2=commonjsGlobal&&commonjsGlobal.__rest||function(fr,br){var wr={};for(var Er in fr)Object.prototype.hasOwnProperty.call(fr,Er)&&br.indexOf(Er)<0&&(wr[Er]=fr[Er]);if(fr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var kr=0,Er=Object.getOwnPropertySymbols(fr);kr{try{if(this.connected)return this.emit("connect",{chainId:(0,util_1$1.hexStringFromIntNumber)((0,type_1.IntNumber)(this.chain.id))}),this.accounts;const Vr=await this.requestSignerSelection(),Zr=this.initSigner(Vr),Jr=await Zr.handshake();return this.signer=Zr,(0,util_2.storeSignerType)(Vr),this.emit("connect",{chainId:(0,util_1$1.hexStringFromIntNumber)((0,type_1.IntNumber)(this.chain.id))}),Jr}catch(Vr){throw this.handleUnauthorizedError(Vr),Vr}},sign:async Gr=>{if(!this.connected||!this.signer)throw error_1.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");try{return await this.signer.request(Gr)}catch(Vr){throw this.handleUnauthorizedError(Vr),Vr}},fetch:Gr=>(0,provider_1$1.fetchRPCRequest)(Gr,this.chain),state:Gr=>{const Vr=()=>{if(this.connected)return this.accounts;throw error_1.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")};switch(Gr.method){case"eth_chainId":return(0,util_1$1.hexStringFromIntNumber)((0,type_1.IntNumber)(this.chain.id));case"net_version":return this.chain.id;case"eth_accounts":return Vr();case"eth_coinbase":return Vr()[0];default:return this.handlers.unsupported(Gr)}},deprecated:({method:Gr})=>{throw error_1.standardErrors.rpc.methodNotSupported(`Method ${Gr} is deprecated.`)},unsupported:({method:Gr})=>{throw error_1.standardErrors.rpc.methodNotSupported(`Method ${Gr} is not supported.`)}},this.isCoinbaseWallet=!0,this.updateListener={onAccountsUpdate:({accounts:Gr,source:Vr})=>{(0,util_1$1.areAddressArraysEqual)(this.accounts,Gr)||(this.accounts=Gr,Vr!=="storage"&&this.emit("accountsChanged",this.accounts))},onChainUpdate:({chain:Gr,source:Vr})=>{Gr.id===this.chain.id&&Gr.rpcUrl===this.chain.rpcUrl||(this.chain=Gr,Vr!=="storage"&&this.emit("chainChanged",(0,util_1$1.hexStringFromIntNumber)((0,type_1.IntNumber)(Gr.id))))}},this.metadata=kr,this.preference=Wr,this.communicator=new Communicator_1.Communicator(Br),this.chain={id:(Er=(wr=kr.appChainIds)===null||wr===void 0?void 0:wr[0])!==null&&Er!==void 0?Er:1};const qr=(0,util_2.loadSignerType)();this.signer=qr?this.initSigner(qr):null}get connected(){return this.accounts.length>0}async request(br){var wr;try{const Er=(0,provider_1$1.checkErrorForInvalidRequestArgs)(br);if(Er)throw Er;const kr=(wr=(0,method_1.determineMethodCategory)(br.method))!==null&&wr!==void 0?wr:"fetch";return this.handlers[kr](br)}catch(Er){return Promise.reject((0,serialize_1$1.serializeError)(Er,br.method))}}handleUnauthorizedError(br){br.code===error_1.standardErrorCodes.provider.unauthorized&&this.disconnect()}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),await this.request({method:"eth_requestAccounts"})}async disconnect(){this.accounts=[],this.chain={id:1},ScopedLocalStorage_1$1.ScopedLocalStorage.clearAll(),this.emit("disconnect",error_1.standardErrors.provider.disconnected("User initiated disconnection"))}requestSignerSelection(){return(0,util_2.fetchSignerType)({communicator:this.communicator,preference:this.preference,metadata:this.metadata})}initSigner(br){return(0,util_2.createSigner)({signerType:br,metadata:this.metadata,communicator:this.communicator,updateListener:this.updateListener})}}CoinbaseWalletProvider$1.CoinbaseWalletProvider=CoinbaseWalletProvider;Object.defineProperty(CoinbaseWalletSDK$1,"__esModule",{value:!0});CoinbaseWalletSDK$1.CoinbaseWalletSDK=void 0;const wallet_logo_1=walletLogo$1,CoinbaseWalletProvider_1=CoinbaseWalletProvider$1,ScopedLocalStorage_1=ScopedLocalStorage$1,version_1=version$8,util_1=util$6,provider_1=provider;class CoinbaseWalletSDK{constructor(br){this.metadata={appName:br.appName||"Dapp",appLogoUrl:br.appLogoUrl||(0,util_1.getFavicon)(),appChainIds:br.appChainIds||[]},this.storeLatestVersion()}makeWeb3Provider(br={options:"all"}){var wr;const Er={metadata:this.metadata,preference:br};return(wr=(0,provider_1.getCoinbaseInjectedProvider)(Er))!==null&&wr!==void 0?wr:new CoinbaseWalletProvider_1.CoinbaseWalletProvider(Er)}getCoinbaseWalletLogo(br,wr=240){return(0,wallet_logo_1.walletLogo)(br,wr)}storeLatestVersion(){new ScopedLocalStorage_1.ScopedLocalStorage("CBWSDK").setItem("VERSION",version_1.LIB_VERSION)}}CoinbaseWalletSDK$1.CoinbaseWalletSDK=CoinbaseWalletSDK;(function(fr){Object.defineProperty(fr,"__esModule",{value:!0}),fr.CoinbaseWalletSDK=void 0;const br=CoinbaseWalletSDK$1;fr.default=br.CoinbaseWalletSDK;var wr=CoinbaseWalletSDK$1;Object.defineProperty(fr,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return wr.CoinbaseWalletSDK}})})(dist);let coinbaseProvider;const baseSepolia=84532,baseMainnet=8453,getCoinbaseProvider=({appLogoUrl:fr,appName:br,evmNetworks:wr,walletPreference:Er}={})=>{const kr=wr==null?void 0:wr.map(Wr=>Number(Wr.chainId));return(wr==null?void 0:wr.some(Wr=>Wr.chainId===baseSepolia))&&(kr==null||kr.sort((Wr,qr)=>Wr===baseSepolia?-1:qr===baseSepolia?1:0)),(wr==null?void 0:wr.some(Wr=>Wr.chainId===baseMainnet))&&(kr==null||kr.sort((Wr,qr)=>Wr===baseMainnet?-1:qr===baseMainnet?1:0)),coinbaseProvider||(coinbaseProvider=new dist.CoinbaseWalletSDK({appChainIds:kr,appLogoUrl:fr,appName:br}).makeWeb3Provider({options:Er??"all"})),coinbaseProvider};class Coinbase extends EthereumWalletConnector{constructor(br){var{appName:wr,appLogoUrl:Er,evmNetworks:kr,coinbaseWalletPreference:jr}=br,Br=__rest$6(br,["appName","appLogoUrl","evmNetworks","coinbaseWalletPreference"]);super(Object.assign({evmNetworks:kr},Br)),this.name="Coinbase",this.overrideKey="coinbase",this.supportedChains=["EVM","ETH"],this.connectedChain="EVM",this.canConnectViaQrCode=!1,this.canConnectViaCustodialService=!this.isInstalledOnBrowser(),this.coinbaseProviderOpts={appLogoUrl:Er,appName:wr,evmNetworks:kr,walletPreference:jr}}get coinbaseProvider(){return getCoinbaseProvider(this.coinbaseProviderOpts)}getConnectedAccounts(){return __awaiter$8(this,void 0,void 0,function*(){try{const br=yield this.coinbaseProvider.request({method:"eth_accounts"});return br[0]&&this.setActiveAccount(br[0]),br}catch{return[]}})}isInstalledOnBrowser(){var br;return!!(!((br=window==null?void 0:window.coinbaseWalletExtension)===null||br===void 0)&&br.isCoinbaseWallet)}getAddress(){return __awaiter$8(this,void 0,void 0,function*(){const[br]=yield this.coinbaseProvider.request({method:"eth_requestAccounts"});return this.setActiveAccount(br),br})}signMessage(br){return __awaiter$8(this,void 0,void 0,function*(){const[wr]=yield this.coinbaseProvider.request({method:"eth_requestAccounts"});try{return yield this.coinbaseProvider.request({method:"personal_sign",params:[toHex(toBytes$3(br)),wr.toLowerCase()]})}catch{return}})}setupEventListeners(){const{handleAccountChange:br,handleChainChange:wr,handleDisconnect:Er}=eventListenerHandlers(this);this.coinbaseProvider.on("accountsChanged",br),this.coinbaseProvider.on("chainChanged",wr),this.coinbaseProvider.on("disconnect",Er),this.teardownEventListeners=()=>{this.coinbaseProvider.removeListener("accountsChanged",br),this.coinbaseProvider.removeListener("chainChanged",wr),this.coinbaseProvider.removeListener("disconnect",Er)}}getWalletClient(br){return createWalletClient({account:this.getActiveAccount(),chain:br?chainsMap[br]:void 0,transport:custom(this.coinbaseProvider)})}}assertPackageVersion("@dynamic-labs/ethereum",version$9);const EthereumWalletConnectors=fr=>[...injectedWalletOverrides$1,...fetchInjectedWalletConnector(fr),...fetchWalletConnectWallets(fr),...TurnkeyEVMWalletConnectors(fr),Coinbase,UnknownInjected$1,FallbackEvmConnector,getWalletConnectConnector()];var version$7="3.8.2",version$6="3.8.2";function __awaiter$4(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;const U32_MASK64=BigInt(2**32-1),_32n=BigInt(32);function fromBig(fr,br=!1){return br?{h:Number(fr&U32_MASK64),l:Number(fr>>_32n&U32_MASK64)}:{h:Number(fr>>_32n&U32_MASK64)|0,l:Number(fr&U32_MASK64)|0}}function split(fr,br=!1){let wr=new Uint32Array(fr.length),Er=new Uint32Array(fr.length);for(let kr=0;krBigInt(fr>>>0)<<_32n|BigInt(br>>>0),shrSH=(fr,br,wr)=>fr>>>wr,shrSL=(fr,br,wr)=>fr<<32-wr|br>>>wr,rotrSH=(fr,br,wr)=>fr>>>wr|br<<32-wr,rotrSL=(fr,br,wr)=>fr<<32-wr|br>>>wr,rotrBH=(fr,br,wr)=>fr<<64-wr|br>>>wr-32,rotrBL=(fr,br,wr)=>fr>>>wr-32|br<<64-wr,rotr32H=(fr,br)=>br,rotr32L=(fr,br)=>fr,rotlSH=(fr,br,wr)=>fr<>>32-wr,rotlSL=(fr,br,wr)=>br<>>32-wr,rotlBH=(fr,br,wr)=>br<>>64-wr,rotlBL=(fr,br,wr)=>fr<>>64-wr;function add(fr,br,wr,Er){const kr=(br>>>0)+(Er>>>0);return{h:fr+wr+(kr/2**32|0)|0,l:kr|0}}const add3L=(fr,br,wr)=>(fr>>>0)+(br>>>0)+(wr>>>0),add3H=(fr,br,wr,Er)=>br+wr+Er+(fr/2**32|0)|0,add4L=(fr,br,wr,Er)=>(fr>>>0)+(br>>>0)+(wr>>>0)+(Er>>>0),add4H=(fr,br,wr,Er,kr)=>br+wr+Er+kr+(fr/2**32|0)|0,add5L=(fr,br,wr,Er,kr)=>(fr>>>0)+(br>>>0)+(wr>>>0)+(Er>>>0)+(kr>>>0),add5H=(fr,br,wr,Er,kr,jr)=>br+wr+Er+kr+jr+(fr/2**32|0)|0,u64$4={fromBig,split,toBig,shrSH,shrSL,rotrSH,rotrSL,rotrBH,rotrBL,rotr32H,rotr32L,rotlSH,rotlSL,rotlBH,rotlBL,add,add3L,add3H,add4L,add4H,add5H,add5L},[SHA512_Kh,SHA512_Kl]=u64$4.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(fr=>BigInt(fr))),SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:br,Al:wr,Bh:Er,Bl:kr,Ch:jr,Cl:Br,Dh:Wr,Dl:qr,Eh:Gr,El:Vr,Fh:Zr,Fl:Jr,Gh:Qr,Gl:_n,Hh:En,Hl:Cn}=this;return[br,wr,Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En,Cn]}set(br,wr,Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En,Cn){this.Ah=br|0,this.Al=wr|0,this.Bh=Er|0,this.Bl=kr|0,this.Ch=jr|0,this.Cl=Br|0,this.Dh=Wr|0,this.Dl=qr|0,this.Eh=Gr|0,this.El=Vr|0,this.Fh=Zr|0,this.Fl=Jr|0,this.Gh=Qr|0,this.Gl=_n|0,this.Hh=En|0,this.Hl=Cn|0}process(br,wr){for(let jn=0;jn<16;jn++,wr+=4)SHA512_W_H[jn]=br.getUint32(wr),SHA512_W_L[jn]=br.getUint32(wr+=4);for(let jn=16;jn<80;jn++){const eo=SHA512_W_H[jn-15]|0,ro=SHA512_W_L[jn-15]|0,to=u64$4.rotrSH(eo,ro,1)^u64$4.rotrSH(eo,ro,8)^u64$4.shrSH(eo,ro,7),_i=u64$4.rotrSL(eo,ro,1)^u64$4.rotrSL(eo,ro,8)^u64$4.shrSL(eo,ro,7),oo=SHA512_W_H[jn-2]|0,io=SHA512_W_L[jn-2]|0,co=u64$4.rotrSH(oo,io,19)^u64$4.rotrBH(oo,io,61)^u64$4.shrSH(oo,io,6),so=u64$4.rotrSL(oo,io,19)^u64$4.rotrBL(oo,io,61)^u64$4.shrSL(oo,io,6),no=u64$4.add4L(_i,so,SHA512_W_L[jn-7],SHA512_W_L[jn-16]),Tn=u64$4.add4H(no,to,co,SHA512_W_H[jn-7],SHA512_W_H[jn-16]);SHA512_W_H[jn]=Tn|0,SHA512_W_L[jn]=no|0}let{Ah:Er,Al:kr,Bh:jr,Bl:Br,Ch:Wr,Cl:qr,Dh:Gr,Dl:Vr,Eh:Zr,El:Jr,Fh:Qr,Fl:_n,Gh:En,Gl:Cn,Hh:In,Hl:An}=this;for(let jn=0;jn<80;jn++){const eo=u64$4.rotrSH(Zr,Jr,14)^u64$4.rotrSH(Zr,Jr,18)^u64$4.rotrBH(Zr,Jr,41),ro=u64$4.rotrSL(Zr,Jr,14)^u64$4.rotrSL(Zr,Jr,18)^u64$4.rotrBL(Zr,Jr,41),to=Zr&Qr^~Zr&En,_i=Jr&_n^~Jr&Cn,oo=u64$4.add5L(An,ro,_i,SHA512_Kl[jn],SHA512_W_L[jn]),io=u64$4.add5H(oo,In,eo,to,SHA512_Kh[jn],SHA512_W_H[jn]),co=oo|0,so=u64$4.rotrSH(Er,kr,28)^u64$4.rotrBH(Er,kr,34)^u64$4.rotrBH(Er,kr,39),no=u64$4.rotrSL(Er,kr,28)^u64$4.rotrBL(Er,kr,34)^u64$4.rotrBL(Er,kr,39),Tn=Er&jr^Er&Wr^jr&Wr,Hr=kr&Br^kr&qr^Br&qr;In=En|0,An=Cn|0,En=Qr|0,Cn=_n|0,Qr=Zr|0,_n=Jr|0,{h:Zr,l:Jr}=u64$4.add(Gr|0,Vr|0,io|0,co|0),Gr=Wr|0,Vr=qr|0,Wr=jr|0,qr=Br|0,jr=Er|0,Br=kr|0;const Xr=u64$4.add3L(co,no,Hr);Er=u64$4.add3H(Xr,io,so,Tn),kr=Xr|0}({h:Er,l:kr}=u64$4.add(this.Ah|0,this.Al|0,Er|0,kr|0)),{h:jr,l:Br}=u64$4.add(this.Bh|0,this.Bl|0,jr|0,Br|0),{h:Wr,l:qr}=u64$4.add(this.Ch|0,this.Cl|0,Wr|0,qr|0),{h:Gr,l:Vr}=u64$4.add(this.Dh|0,this.Dl|0,Gr|0,Vr|0),{h:Zr,l:Jr}=u64$4.add(this.Eh|0,this.El|0,Zr|0,Jr|0),{h:Qr,l:_n}=u64$4.add(this.Fh|0,this.Fl|0,Qr|0,_n|0),{h:En,l:Cn}=u64$4.add(this.Gh|0,this.Gl|0,En|0,Cn|0),{h:In,l:An}=u64$4.add(this.Hh|0,this.Hl|0,In|0,An|0),this.set(Er,kr,jr,Br,Wr,qr,Gr,Vr,Zr,Jr,Qr,_n,En,Cn,In,An)}roundClean(){SHA512_W_H.fill(0),SHA512_W_L.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sha512=wrapConstructor(()=>new SHA512);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n=BigInt(0),_1n$1=BigInt(1),_2n$1=BigInt(2),_8n$1=BigInt(8),VERIFY_DEFAULT={zip215:!0};function validateOpts(fr){const br=validateBasic(fr);return validateObject(fr,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...br})}function twistedEdwards(fr){const br=validateOpts(fr),{Fp:wr,n:Er,prehash:kr,hash:jr,randomBytes:Br,nByteLength:Wr,h:qr}=br,Gr=_2n$1<{try{return{isValid:!0,value:wr.sqrt(Sn*wr.inv(Rn))}}catch{return{isValid:!1,value:_0n}}}),Qr=br.adjustScalarBytes||(Sn=>Sn),_n=br.domain||((Sn,Rn,Pn)=>{if(abool("phflag",Pn),Rn.length||Pn)throw new Error("Contexts/pre-hash are not supported");return Sn});function En(Sn,Rn){aInRange("coordinate "+Sn,Rn,_0n,Gr)}function Cn(Sn){if(!(Sn instanceof jn))throw new Error("ExtendedPoint expected")}const In=memoized((Sn,Rn)=>{const{ex:Pn,ey:On,ez:Zn}=Sn,Nn=Sn.is0();Rn==null&&(Rn=Nn?_8n$1:wr.inv(Zn));const wn=Vr(Pn*Rn),zn=Vr(On*Rn),fo=Vr(Zn*Rn);if(Nn)return{x:_0n,y:_1n$1};if(fo!==_1n$1)throw new Error("invZ was invalid");return{x:wn,y:zn}}),An=memoized(Sn=>{const{a:Rn,d:Pn}=br;if(Sn.is0())throw new Error("bad point: ZERO");const{ex:On,ey:Zn,ez:Nn,et:wn}=Sn,zn=Vr(On*On),fo=Vr(Zn*Zn),vo=Vr(Nn*Nn),go=Vr(vo*vo),uo=Vr(zn*Rn),lo=Vr(vo*Vr(uo+fo)),Eo=Vr(go+Vr(Pn*Vr(zn*fo)));if(lo!==Eo)throw new Error("bad point: equation left != right (1)");const mo=Vr(On*Zn),yo=Vr(Nn*wn);if(mo!==yo)throw new Error("bad point: equation left != right (2)");return!0});class jn{constructor(Rn,Pn,On,Zn){this.ex=Rn,this.ey=Pn,this.ez=On,this.et=Zn,En("x",Rn),En("y",Pn),En("z",On),En("t",Zn),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(Rn){if(Rn instanceof jn)throw new Error("extended point not allowed");const{x:Pn,y:On}=Rn||{};return En("x",Pn),En("y",On),new jn(Pn,On,_1n$1,Vr(Pn*On))}static normalizeZ(Rn){const Pn=wr.invertBatch(Rn.map(On=>On.ez));return Rn.map((On,Zn)=>On.toAffine(Pn[Zn])).map(jn.fromAffine)}static msm(Rn,Pn){return pippenger(jn,Zr,Rn,Pn)}_setWindowSize(Rn){to.setWindowSize(this,Rn)}assertValidity(){An(this)}equals(Rn){Cn(Rn);const{ex:Pn,ey:On,ez:Zn}=this,{ex:Nn,ey:wn,ez:zn}=Rn,fo=Vr(Pn*zn),vo=Vr(Nn*Zn),go=Vr(On*zn),uo=Vr(wn*Zn);return fo===vo&&go===uo}is0(){return this.equals(jn.ZERO)}negate(){return new jn(Vr(-this.ex),this.ey,this.ez,Vr(-this.et))}double(){const{a:Rn}=br,{ex:Pn,ey:On,ez:Zn}=this,Nn=Vr(Pn*Pn),wn=Vr(On*On),zn=Vr(_2n$1*Vr(Zn*Zn)),fo=Vr(Rn*Nn),vo=Pn+On,go=Vr(Vr(vo*vo)-Nn-wn),uo=fo+wn,lo=uo-zn,Eo=fo-wn,mo=Vr(go*lo),yo=Vr(uo*Eo),_o=Vr(go*Eo),Bo=Vr(lo*uo);return new jn(mo,yo,Bo,_o)}add(Rn){Cn(Rn);const{a:Pn,d:On}=br,{ex:Zn,ey:Nn,ez:wn,et:zn}=this,{ex:fo,ey:vo,ez:go,et:uo}=Rn;if(Pn===BigInt(-1)){const No=Vr((Nn-Zn)*(vo+fo)),Uo=Vr((Nn+Zn)*(vo-fo)),Nl=Vr(Uo-No);if(Nl===_0n)return this.double();const Vo=Vr(wn*_2n$1*uo),Fo=Vr(zn*_2n$1*go),Ol=Fo+Vo,$a=Uo+No,Jo=Fo-Vo,Zl=Vr(Ol*Nl),Cl=Vr($a*Jo),ko=Vr(Ol*Jo),wo=Vr(Nl*$a);return new jn(Zl,Cl,wo,ko)}const lo=Vr(Zn*fo),Eo=Vr(Nn*vo),mo=Vr(zn*On*uo),yo=Vr(wn*go),_o=Vr((Zn+Nn)*(fo+vo)-lo-Eo),Bo=yo-mo,Lo=yo+mo,Wo=Vr(Eo-Pn*lo),na=Vr(_o*Bo),qo=Vr(Lo*Wo),ga=Vr(_o*Wo),wl=Vr(Bo*Lo);return new jn(na,qo,wl,ga)}subtract(Rn){return this.add(Rn.negate())}wNAF(Rn){return to.wNAFCached(this,Rn,jn.normalizeZ)}multiply(Rn){const Pn=Rn;aInRange("scalar",Pn,_1n$1,Er);const{p:On,f:Zn}=this.wNAF(Pn);return jn.normalizeZ([On,Zn])[0]}multiplyUnsafe(Rn,Pn=jn.ZERO){const On=Rn;return aInRange("scalar",On,_0n,Er),On===_0n?ro:this.is0()||On===_1n$1?this:to.wNAFCachedUnsafe(this,On,jn.normalizeZ,Pn)}isSmallOrder(){return this.multiplyUnsafe(qr).is0()}isTorsionFree(){return to.unsafeLadder(this,Er).is0()}toAffine(Rn){return In(this,Rn)}clearCofactor(){const{h:Rn}=br;return Rn===_1n$1?this:this.multiplyUnsafe(Rn)}static fromHex(Rn,Pn=!1){const{d:On,a:Zn}=br,Nn=wr.BYTES;Rn=ensureBytes("pointHex",Rn,Nn),abool("zip215",Pn);const wn=Rn.slice(),zn=Rn[Nn-1];wn[Nn-1]=zn&-129;const fo=bytesToNumberLE(wn),vo=Pn?Gr:wr.ORDER;aInRange("pointHex.y",fo,_0n,vo);const go=Vr(fo*fo),uo=Vr(go-_1n$1),lo=Vr(On*go-Zn);let{isValid:Eo,value:mo}=Jr(uo,lo);if(!Eo)throw new Error("Point.fromHex: invalid y coordinate");const yo=(mo&_1n$1)===_1n$1,_o=(zn&128)!==0;if(!Pn&&mo===_0n&&_o)throw new Error("Point.fromHex: x=0 and x_0=1");return _o!==yo&&(mo=Vr(-mo)),jn.fromAffine({x:mo,y:fo})}static fromPrivateKey(Rn){return io(Rn).point}toRawBytes(){const{x:Rn,y:Pn}=this.toAffine(),On=numberToBytesLE(Pn,wr.BYTES);return On[On.length-1]|=Rn&_1n$1?128:0,On}toHex(){return bytesToHex(this.toRawBytes())}}jn.BASE=new jn(br.Gx,br.Gy,_1n$1,Vr(br.Gx*br.Gy)),jn.ZERO=new jn(_0n,_1n$1,_1n$1,_0n);const{BASE:eo,ZERO:ro}=jn,to=wNAF(jn,Wr*8);function _i(Sn){return mod(Sn,Er)}function oo(Sn){return _i(bytesToNumberLE(Sn))}function io(Sn){const Rn=wr.BYTES;Sn=ensureBytes("private key",Sn,Rn);const Pn=ensureBytes("hashed private key",jr(Sn),2*Rn),On=Qr(Pn.slice(0,Rn)),Zn=Pn.slice(Rn,2*Rn),Nn=oo(On),wn=eo.multiply(Nn),zn=wn.toRawBytes();return{head:On,prefix:Zn,scalar:Nn,point:wn,pointBytes:zn}}function co(Sn){return io(Sn).pointBytes}function so(Sn=new Uint8Array,...Rn){const Pn=concatBytes(...Rn);return oo(jr(_n(Pn,ensureBytes("context",Sn),!!kr)))}function no(Sn,Rn,Pn={}){Sn=ensureBytes("message",Sn),kr&&(Sn=kr(Sn));const{prefix:On,scalar:Zn,pointBytes:Nn}=io(Rn),wn=so(Pn.context,On,Sn),zn=eo.multiply(wn).toRawBytes(),fo=so(Pn.context,zn,Nn,Sn),vo=_i(wn+fo*Zn);aInRange("signature.s",vo,_0n,Er);const go=concatBytes(zn,numberToBytesLE(vo,wr.BYTES));return ensureBytes("result",go,wr.BYTES*2)}const Tn=VERIFY_DEFAULT;function Hr(Sn,Rn,Pn,On=Tn){const{context:Zn,zip215:Nn}=On,wn=wr.BYTES;Sn=ensureBytes("signature",Sn,2*wn),Rn=ensureBytes("message",Rn),Pn=ensureBytes("publicKey",Pn,wn),Nn!==void 0&&abool("zip215",Nn),kr&&(Rn=kr(Rn));const zn=bytesToNumberLE(Sn.slice(wn,2*wn));let fo,vo,go;try{fo=jn.fromHex(Pn,Nn),vo=jn.fromHex(Sn.slice(0,wn),Nn),go=eo.multiplyUnsafe(zn)}catch{return!1}if(!Nn&&fo.isSmallOrder())return!1;const uo=so(Zn,vo.toRawBytes(),fo.toRawBytes(),Rn);return vo.add(fo.multiplyUnsafe(uo)).subtract(go).clearCofactor().equals(jn.ZERO)}return eo._setWindowSize(8),{CURVE:br,getPublicKey:co,sign:no,verify:Hr,ExtendedPoint:jn,utils:{getExtendedPublicKey:io,randomPrivateKey:()=>Br(wr.BYTES),precompute(Sn=8,Rn=jn.BASE){return Rn._setWindowSize(Sn),Rn.multiply(BigInt(3)),Rn}}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ED25519_P=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ED25519_SQRT_M1=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const _1n=BigInt(1),_2n=BigInt(2);BigInt(3);const _5n=BigInt(5),_8n=BigInt(8);function ed25519_pow_2_252_3(fr){const br=BigInt(10),wr=BigInt(20),Er=BigInt(40),kr=BigInt(80),jr=ED25519_P,Wr=fr*fr%jr*fr%jr,qr=pow2(Wr,_2n,jr)*Wr%jr,Gr=pow2(qr,_1n,jr)*fr%jr,Vr=pow2(Gr,_5n,jr)*Gr%jr,Zr=pow2(Vr,br,jr)*Vr%jr,Jr=pow2(Zr,wr,jr)*Zr%jr,Qr=pow2(Jr,Er,jr)*Jr%jr,_n=pow2(Qr,kr,jr)*Qr%jr,En=pow2(_n,kr,jr)*Qr%jr,Cn=pow2(En,br,jr)*Vr%jr;return{pow_p_5_8:pow2(Cn,_2n,jr)*fr%jr,b2:Wr}}function adjustScalarBytes(fr){return fr[0]&=248,fr[31]&=127,fr[31]|=64,fr}function uvRatio(fr,br){const wr=ED25519_P,Er=mod(br*br*br,wr),kr=mod(Er*Er*br,wr),jr=ed25519_pow_2_252_3(fr*kr).pow_p_5_8;let Br=mod(fr*Er*jr,wr);const Wr=mod(br*Br*Br,wr),qr=Br,Gr=mod(Br*ED25519_SQRT_M1,wr),Vr=Wr===fr,Zr=Wr===mod(-fr,wr),Jr=Wr===mod(-fr*ED25519_SQRT_M1,wr);return Vr&&(Br=qr),(Zr||Jr)&&(Br=Gr),isNegativeLE(Br,wr)&&(Br=mod(-Br,wr)),{isValid:Vr||Zr,value:Br}}const Fp=Field(ED25519_P,void 0,!0),ed25519Defaults={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:_8n,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:sha512,randomBytes,adjustScalarBytes,uvRatio},ed25519=twistedEdwards(ed25519Defaults);var bn$3={exports:{}};bn$3.exports;(function(fr){(function(br,wr){function Er(Tn,Hr){if(!Tn)throw new Error(Hr||"Assertion failed")}function kr(Tn,Hr){Tn.super_=Hr;var Xr=function(){};Xr.prototype=Hr.prototype,Tn.prototype=new Xr,Tn.prototype.constructor=Tn}function jr(Tn,Hr,Xr){if(jr.isBN(Tn))return Tn;this.negative=0,this.words=null,this.length=0,this.red=null,Tn!==null&&((Hr==="le"||Hr==="be")&&(Xr=Hr,Hr=10),this._init(Tn||0,Hr||10,Xr||"be"))}typeof br=="object"?br.exports=jr:wr.BN=jr,jr.BN=jr,jr.wordSize=26;var Br;try{typeof window<"u"&&typeof window.Buffer<"u"?Br=window.Buffer:Br=require$$0$9.Buffer}catch{}jr.isBN=function(Hr){return Hr instanceof jr?!0:Hr!==null&&typeof Hr=="object"&&Hr.constructor.wordSize===jr.wordSize&&Array.isArray(Hr.words)},jr.max=function(Hr,Xr){return Hr.cmp(Xr)>0?Hr:Xr},jr.min=function(Hr,Xr){return Hr.cmp(Xr)<0?Hr:Xr},jr.prototype._init=function(Hr,Xr,Sn){if(typeof Hr=="number")return this._initNumber(Hr,Xr,Sn);if(typeof Hr=="object")return this._initArray(Hr,Xr,Sn);Xr==="hex"&&(Xr=16),Er(Xr===(Xr|0)&&Xr>=2&&Xr<=36),Hr=Hr.toString().replace(/\s+/g,"");var Rn=0;Hr[0]==="-"&&(Rn++,this.negative=1),Rn=0;Rn-=3)On=Hr[Rn]|Hr[Rn-1]<<8|Hr[Rn-2]<<16,this.words[Pn]|=On<>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);else if(Sn==="le")for(Rn=0,Pn=0;Rn>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);return this._strip()};function Wr(Tn,Hr){var Xr=Tn.charCodeAt(Hr);if(Xr>=48&&Xr<=57)return Xr-48;if(Xr>=65&&Xr<=70)return Xr-55;if(Xr>=97&&Xr<=102)return Xr-87;Er(!1,"Invalid character in "+Tn)}function qr(Tn,Hr,Xr){var Sn=Wr(Tn,Xr);return Xr-1>=Hr&&(Sn|=Wr(Tn,Xr-1)<<4),Sn}jr.prototype._parseHex=function(Hr,Xr,Sn){this.length=Math.ceil((Hr.length-Xr)/6),this.words=new Array(this.length);for(var Rn=0;Rn=Xr;Rn-=2)Zn=qr(Hr,Xr,Rn)<=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8;else{var Nn=Hr.length-Xr;for(Rn=Nn%2===0?Xr+1:Xr;Rn=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8}this._strip()};function Gr(Tn,Hr,Xr,Sn){for(var Rn=0,Pn=0,On=Math.min(Tn.length,Xr),Zn=Hr;Zn=49?Pn=Nn-49+10:Nn>=17?Pn=Nn-17+10:Pn=Nn,Er(Nn>=0&&Pn1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},jr.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{jr.prototype[Symbol.for("nodejs.util.inspect.custom")]=Zr}catch{jr.prototype.inspect=Zr}else jr.prototype.inspect=Zr;function Zr(){return(this.red?""}var Jr=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Qr=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_n=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];jr.prototype.toString=function(Hr,Xr){Hr=Hr||10,Xr=Xr|0||1;var Sn;if(Hr===16||Hr==="hex"){Sn="";for(var Rn=0,Pn=0,On=0;On>>24-Rn&16777215,Rn+=2,Rn>=26&&(Rn-=26,On--),Pn!==0||On!==this.length-1?Sn=Jr[6-Nn.length]+Nn+Sn:Sn=Nn+Sn}for(Pn!==0&&(Sn=Pn.toString(16)+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}if(Hr===(Hr|0)&&Hr>=2&&Hr<=36){var wn=Qr[Hr],zn=_n[Hr];Sn="";var fo=this.clone();for(fo.negative=0;!fo.isZero();){var vo=fo.modrn(zn).toString(Hr);fo=fo.idivn(zn),fo.isZero()?Sn=vo+Sn:Sn=Jr[wn-vo.length]+vo+Sn}for(this.isZero()&&(Sn="0"+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}Er(!1,"Base should be between 2 and 36")},jr.prototype.toNumber=function(){var Hr=this.words[0];return this.length===2?Hr+=this.words[1]*67108864:this.length===3&&this.words[2]===1?Hr+=4503599627370496+this.words[1]*67108864:this.length>2&&Er(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-Hr:Hr},jr.prototype.toJSON=function(){return this.toString(16,2)},Br&&(jr.prototype.toBuffer=function(Hr,Xr){return this.toArrayLike(Br,Hr,Xr)}),jr.prototype.toArray=function(Hr,Xr){return this.toArrayLike(Array,Hr,Xr)};var En=function(Hr,Xr){return Hr.allocUnsafe?Hr.allocUnsafe(Xr):new Hr(Xr)};jr.prototype.toArrayLike=function(Hr,Xr,Sn){this._strip();var Rn=this.byteLength(),Pn=Sn||Math.max(1,Rn);Er(Rn<=Pn,"byte array longer than desired length"),Er(Pn>0,"Requested array length <= 0");var On=En(Hr,Pn),Zn=Xr==="le"?"LE":"BE";return this["_toArrayLike"+Zn](On,Rn),On},jr.prototype._toArrayLikeLE=function(Hr,Xr){for(var Sn=0,Rn=0,Pn=0,On=0;Pn>8&255),Sn>16&255),On===6?(Sn>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn=0&&(Hr[Sn--]=Zn>>8&255),Sn>=0&&(Hr[Sn--]=Zn>>16&255),On===6?(Sn>=0&&(Hr[Sn--]=Zn>>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn>=0)for(Hr[Sn--]=Rn;Sn>=0;)Hr[Sn--]=0},Math.clz32?jr.prototype._countBits=function(Hr){return 32-Math.clz32(Hr)}:jr.prototype._countBits=function(Hr){var Xr=Hr,Sn=0;return Xr>=4096&&(Sn+=13,Xr>>>=13),Xr>=64&&(Sn+=7,Xr>>>=7),Xr>=8&&(Sn+=4,Xr>>>=4),Xr>=2&&(Sn+=2,Xr>>>=2),Sn+Xr},jr.prototype._zeroBits=function(Hr){if(Hr===0)return 26;var Xr=Hr,Sn=0;return Xr&8191||(Sn+=13,Xr>>>=13),Xr&127||(Sn+=7,Xr>>>=7),Xr&15||(Sn+=4,Xr>>>=4),Xr&3||(Sn+=2,Xr>>>=2),Xr&1||Sn++,Sn},jr.prototype.bitLength=function(){var Hr=this.words[this.length-1],Xr=this._countBits(Hr);return(this.length-1)*26+Xr};function Cn(Tn){for(var Hr=new Array(Tn.bitLength()),Xr=0;Xr>>Rn&1}return Hr}jr.prototype.zeroBits=function(){if(this.isZero())return 0;for(var Hr=0,Xr=0;XrHr.length?this.clone().ior(Hr):Hr.clone().ior(this)},jr.prototype.uor=function(Hr){return this.length>Hr.length?this.clone().iuor(Hr):Hr.clone().iuor(this)},jr.prototype.iuand=function(Hr){var Xr;this.length>Hr.length?Xr=Hr:Xr=this;for(var Sn=0;SnHr.length?this.clone().iand(Hr):Hr.clone().iand(this)},jr.prototype.uand=function(Hr){return this.length>Hr.length?this.clone().iuand(Hr):Hr.clone().iuand(this)},jr.prototype.iuxor=function(Hr){var Xr,Sn;this.length>Hr.length?(Xr=this,Sn=Hr):(Xr=Hr,Sn=this);for(var Rn=0;RnHr.length?this.clone().ixor(Hr):Hr.clone().ixor(this)},jr.prototype.uxor=function(Hr){return this.length>Hr.length?this.clone().iuxor(Hr):Hr.clone().iuxor(this)},jr.prototype.inotn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Math.ceil(Hr/26)|0,Sn=Hr%26;this._expand(Xr),Sn>0&&Xr--;for(var Rn=0;Rn0&&(this.words[Rn]=~this.words[Rn]&67108863>>26-Sn),this._strip()},jr.prototype.notn=function(Hr){return this.clone().inotn(Hr)},jr.prototype.setn=function(Hr,Xr){Er(typeof Hr=="number"&&Hr>=0);var Sn=Hr/26|0,Rn=Hr%26;return this._expand(Sn+1),Xr?this.words[Sn]=this.words[Sn]|1<Hr.length?(Sn=this,Rn=Hr):(Sn=Hr,Rn=this);for(var Pn=0,On=0;On>>26;for(;Pn!==0&&On>>26;if(this.length=Sn.length,Pn!==0)this.words[this.length]=Pn,this.length++;else if(Sn!==this)for(;OnHr.length?this.clone().iadd(Hr):Hr.clone().iadd(this)},jr.prototype.isub=function(Hr){if(Hr.negative!==0){Hr.negative=0;var Xr=this.iadd(Hr);return Hr.negative=1,Xr._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Hr),this.negative=1,this._normSign();var Sn=this.cmp(Hr);if(Sn===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Rn,Pn;Sn>0?(Rn=this,Pn=Hr):(Rn=Hr,Pn=this);for(var On=0,Zn=0;Zn>26,this.words[Zn]=Xr&67108863;for(;On!==0&&Zn>26,this.words[Zn]=Xr&67108863;if(On===0&&Zn>>26,fo=Nn&67108863,vo=Math.min(wn,Hr.length-1),go=Math.max(0,wn-Tn.length+1);go<=vo;go++){var uo=wn-go|0;Rn=Tn.words[uo]|0,Pn=Hr.words[go]|0,On=Rn*Pn+fo,zn+=On/67108864|0,fo=On&67108863}Xr.words[wn]=fo|0,Nn=zn|0}return Nn!==0?Xr.words[wn]=Nn|0:Xr.length--,Xr._strip()}var An=function(Hr,Xr,Sn){var Rn=Hr.words,Pn=Xr.words,On=Sn.words,Zn=0,Nn,wn,zn,fo=Rn[0]|0,vo=fo&8191,go=fo>>>13,uo=Rn[1]|0,lo=uo&8191,Eo=uo>>>13,mo=Rn[2]|0,yo=mo&8191,_o=mo>>>13,Bo=Rn[3]|0,Lo=Bo&8191,Wo=Bo>>>13,na=Rn[4]|0,qo=na&8191,ga=na>>>13,wl=Rn[5]|0,No=wl&8191,Uo=wl>>>13,Nl=Rn[6]|0,Vo=Nl&8191,Fo=Nl>>>13,Ol=Rn[7]|0,$a=Ol&8191,Jo=Ol>>>13,Zl=Rn[8]|0,Cl=Zl&8191,ko=Zl>>>13,wo=Rn[9]|0,bo=wo&8191,Io=wo>>>13,Ho=Pn[0]|0,Do=Ho&8191,zo=Ho>>>13,nu=Pn[1]|0,Ll=nu&8191,_l=nu>>>13,bu=Pn[2]|0,xl=bu&8191,Tl=bu>>>13,du=Pn[3]|0,Bl=du&8191,Il=du>>>13,Eu=Pn[4]|0,Al=Eu&8191,Ml=Eu>>>13,Tu=Pn[5]|0,Fl=Tu&8191,Sl=Tu>>>13,_u=Pn[6]|0,So=_u&8191,Co=_u>>>13,Ao=Pn[7]|0,po=Ao&8191,Ro=Ao>>>13,Xo=Pn[8]|0,jo=Xo&8191,Ko=Xo>>>13,Wl=Pn[9]|0,$l=Wl&8191,El=Wl>>>13;Sn.negative=Hr.negative^Xr.negative,Sn.length=19,Nn=Math.imul(vo,Do),wn=Math.imul(vo,zo),wn=wn+Math.imul(go,Do)|0,zn=Math.imul(go,zo);var Cu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,Nn=Math.imul(lo,Do),wn=Math.imul(lo,zo),wn=wn+Math.imul(Eo,Do)|0,zn=Math.imul(Eo,zo),Nn=Nn+Math.imul(vo,Ll)|0,wn=wn+Math.imul(vo,_l)|0,wn=wn+Math.imul(go,Ll)|0,zn=zn+Math.imul(go,_l)|0;var iu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(iu>>>26)|0,iu&=67108863,Nn=Math.imul(yo,Do),wn=Math.imul(yo,zo),wn=wn+Math.imul(_o,Do)|0,zn=Math.imul(_o,zo),Nn=Nn+Math.imul(lo,Ll)|0,wn=wn+Math.imul(lo,_l)|0,wn=wn+Math.imul(Eo,Ll)|0,zn=zn+Math.imul(Eo,_l)|0,Nn=Nn+Math.imul(vo,xl)|0,wn=wn+Math.imul(vo,Tl)|0,wn=wn+Math.imul(go,xl)|0,zn=zn+Math.imul(go,Tl)|0;var pu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(pu>>>26)|0,pu&=67108863,Nn=Math.imul(Lo,Do),wn=Math.imul(Lo,zo),wn=wn+Math.imul(Wo,Do)|0,zn=Math.imul(Wo,zo),Nn=Nn+Math.imul(yo,Ll)|0,wn=wn+Math.imul(yo,_l)|0,wn=wn+Math.imul(_o,Ll)|0,zn=zn+Math.imul(_o,_l)|0,Nn=Nn+Math.imul(lo,xl)|0,wn=wn+Math.imul(lo,Tl)|0,wn=wn+Math.imul(Eo,xl)|0,zn=zn+Math.imul(Eo,Tl)|0,Nn=Nn+Math.imul(vo,Bl)|0,wn=wn+Math.imul(vo,Il)|0,wn=wn+Math.imul(go,Bl)|0,zn=zn+Math.imul(go,Il)|0;var yu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(yu>>>26)|0,yu&=67108863,Nn=Math.imul(qo,Do),wn=Math.imul(qo,zo),wn=wn+Math.imul(ga,Do)|0,zn=Math.imul(ga,zo),Nn=Nn+Math.imul(Lo,Ll)|0,wn=wn+Math.imul(Lo,_l)|0,wn=wn+Math.imul(Wo,Ll)|0,zn=zn+Math.imul(Wo,_l)|0,Nn=Nn+Math.imul(yo,xl)|0,wn=wn+Math.imul(yo,Tl)|0,wn=wn+Math.imul(_o,xl)|0,zn=zn+Math.imul(_o,Tl)|0,Nn=Nn+Math.imul(lo,Bl)|0,wn=wn+Math.imul(lo,Il)|0,wn=wn+Math.imul(Eo,Bl)|0,zn=zn+Math.imul(Eo,Il)|0,Nn=Nn+Math.imul(vo,Al)|0,wn=wn+Math.imul(vo,Ml)|0,wn=wn+Math.imul(go,Al)|0,zn=zn+Math.imul(go,Ml)|0;var hu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(hu>>>26)|0,hu&=67108863,Nn=Math.imul(No,Do),wn=Math.imul(No,zo),wn=wn+Math.imul(Uo,Do)|0,zn=Math.imul(Uo,zo),Nn=Nn+Math.imul(qo,Ll)|0,wn=wn+Math.imul(qo,_l)|0,wn=wn+Math.imul(ga,Ll)|0,zn=zn+Math.imul(ga,_l)|0,Nn=Nn+Math.imul(Lo,xl)|0,wn=wn+Math.imul(Lo,Tl)|0,wn=wn+Math.imul(Wo,xl)|0,zn=zn+Math.imul(Wo,Tl)|0,Nn=Nn+Math.imul(yo,Bl)|0,wn=wn+Math.imul(yo,Il)|0,wn=wn+Math.imul(_o,Bl)|0,zn=zn+Math.imul(_o,Il)|0,Nn=Nn+Math.imul(lo,Al)|0,wn=wn+Math.imul(lo,Ml)|0,wn=wn+Math.imul(Eo,Al)|0,zn=zn+Math.imul(Eo,Ml)|0,Nn=Nn+Math.imul(vo,Fl)|0,wn=wn+Math.imul(vo,Sl)|0,wn=wn+Math.imul(go,Fl)|0,zn=zn+Math.imul(go,Sl)|0;var mu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(mu>>>26)|0,mu&=67108863,Nn=Math.imul(Vo,Do),wn=Math.imul(Vo,zo),wn=wn+Math.imul(Fo,Do)|0,zn=Math.imul(Fo,zo),Nn=Nn+Math.imul(No,Ll)|0,wn=wn+Math.imul(No,_l)|0,wn=wn+Math.imul(Uo,Ll)|0,zn=zn+Math.imul(Uo,_l)|0,Nn=Nn+Math.imul(qo,xl)|0,wn=wn+Math.imul(qo,Tl)|0,wn=wn+Math.imul(ga,xl)|0,zn=zn+Math.imul(ga,Tl)|0,Nn=Nn+Math.imul(Lo,Bl)|0,wn=wn+Math.imul(Lo,Il)|0,wn=wn+Math.imul(Wo,Bl)|0,zn=zn+Math.imul(Wo,Il)|0,Nn=Nn+Math.imul(yo,Al)|0,wn=wn+Math.imul(yo,Ml)|0,wn=wn+Math.imul(_o,Al)|0,zn=zn+Math.imul(_o,Ml)|0,Nn=Nn+Math.imul(lo,Fl)|0,wn=wn+Math.imul(lo,Sl)|0,wn=wn+Math.imul(Eo,Fl)|0,zn=zn+Math.imul(Eo,Sl)|0,Nn=Nn+Math.imul(vo,So)|0,wn=wn+Math.imul(vo,Co)|0,wn=wn+Math.imul(go,So)|0,zn=zn+Math.imul(go,Co)|0;var vu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(vu>>>26)|0,vu&=67108863,Nn=Math.imul($a,Do),wn=Math.imul($a,zo),wn=wn+Math.imul(Jo,Do)|0,zn=Math.imul(Jo,zo),Nn=Nn+Math.imul(Vo,Ll)|0,wn=wn+Math.imul(Vo,_l)|0,wn=wn+Math.imul(Fo,Ll)|0,zn=zn+Math.imul(Fo,_l)|0,Nn=Nn+Math.imul(No,xl)|0,wn=wn+Math.imul(No,Tl)|0,wn=wn+Math.imul(Uo,xl)|0,zn=zn+Math.imul(Uo,Tl)|0,Nn=Nn+Math.imul(qo,Bl)|0,wn=wn+Math.imul(qo,Il)|0,wn=wn+Math.imul(ga,Bl)|0,zn=zn+Math.imul(ga,Il)|0,Nn=Nn+Math.imul(Lo,Al)|0,wn=wn+Math.imul(Lo,Ml)|0,wn=wn+Math.imul(Wo,Al)|0,zn=zn+Math.imul(Wo,Ml)|0,Nn=Nn+Math.imul(yo,Fl)|0,wn=wn+Math.imul(yo,Sl)|0,wn=wn+Math.imul(_o,Fl)|0,zn=zn+Math.imul(_o,Sl)|0,Nn=Nn+Math.imul(lo,So)|0,wn=wn+Math.imul(lo,Co)|0,wn=wn+Math.imul(Eo,So)|0,zn=zn+Math.imul(Eo,Co)|0,Nn=Nn+Math.imul(vo,po)|0,wn=wn+Math.imul(vo,Ro)|0,wn=wn+Math.imul(go,po)|0,zn=zn+Math.imul(go,Ro)|0;var fu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(fu>>>26)|0,fu&=67108863,Nn=Math.imul(Cl,Do),wn=Math.imul(Cl,zo),wn=wn+Math.imul(ko,Do)|0,zn=Math.imul(ko,zo),Nn=Nn+Math.imul($a,Ll)|0,wn=wn+Math.imul($a,_l)|0,wn=wn+Math.imul(Jo,Ll)|0,zn=zn+Math.imul(Jo,_l)|0,Nn=Nn+Math.imul(Vo,xl)|0,wn=wn+Math.imul(Vo,Tl)|0,wn=wn+Math.imul(Fo,xl)|0,zn=zn+Math.imul(Fo,Tl)|0,Nn=Nn+Math.imul(No,Bl)|0,wn=wn+Math.imul(No,Il)|0,wn=wn+Math.imul(Uo,Bl)|0,zn=zn+Math.imul(Uo,Il)|0,Nn=Nn+Math.imul(qo,Al)|0,wn=wn+Math.imul(qo,Ml)|0,wn=wn+Math.imul(ga,Al)|0,zn=zn+Math.imul(ga,Ml)|0,Nn=Nn+Math.imul(Lo,Fl)|0,wn=wn+Math.imul(Lo,Sl)|0,wn=wn+Math.imul(Wo,Fl)|0,zn=zn+Math.imul(Wo,Sl)|0,Nn=Nn+Math.imul(yo,So)|0,wn=wn+Math.imul(yo,Co)|0,wn=wn+Math.imul(_o,So)|0,zn=zn+Math.imul(_o,Co)|0,Nn=Nn+Math.imul(lo,po)|0,wn=wn+Math.imul(lo,Ro)|0,wn=wn+Math.imul(Eo,po)|0,zn=zn+Math.imul(Eo,Ro)|0,Nn=Nn+Math.imul(vo,jo)|0,wn=wn+Math.imul(vo,Ko)|0,wn=wn+Math.imul(go,jo)|0,zn=zn+Math.imul(go,Ko)|0;var gu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(gu>>>26)|0,gu&=67108863,Nn=Math.imul(bo,Do),wn=Math.imul(bo,zo),wn=wn+Math.imul(Io,Do)|0,zn=Math.imul(Io,zo),Nn=Nn+Math.imul(Cl,Ll)|0,wn=wn+Math.imul(Cl,_l)|0,wn=wn+Math.imul(ko,Ll)|0,zn=zn+Math.imul(ko,_l)|0,Nn=Nn+Math.imul($a,xl)|0,wn=wn+Math.imul($a,Tl)|0,wn=wn+Math.imul(Jo,xl)|0,zn=zn+Math.imul(Jo,Tl)|0,Nn=Nn+Math.imul(Vo,Bl)|0,wn=wn+Math.imul(Vo,Il)|0,wn=wn+Math.imul(Fo,Bl)|0,zn=zn+Math.imul(Fo,Il)|0,Nn=Nn+Math.imul(No,Al)|0,wn=wn+Math.imul(No,Ml)|0,wn=wn+Math.imul(Uo,Al)|0,zn=zn+Math.imul(Uo,Ml)|0,Nn=Nn+Math.imul(qo,Fl)|0,wn=wn+Math.imul(qo,Sl)|0,wn=wn+Math.imul(ga,Fl)|0,zn=zn+Math.imul(ga,Sl)|0,Nn=Nn+Math.imul(Lo,So)|0,wn=wn+Math.imul(Lo,Co)|0,wn=wn+Math.imul(Wo,So)|0,zn=zn+Math.imul(Wo,Co)|0,Nn=Nn+Math.imul(yo,po)|0,wn=wn+Math.imul(yo,Ro)|0,wn=wn+Math.imul(_o,po)|0,zn=zn+Math.imul(_o,Ro)|0,Nn=Nn+Math.imul(lo,jo)|0,wn=wn+Math.imul(lo,Ko)|0,wn=wn+Math.imul(Eo,jo)|0,zn=zn+Math.imul(Eo,Ko)|0,Nn=Nn+Math.imul(vo,$l)|0,wn=wn+Math.imul(vo,El)|0,wn=wn+Math.imul(go,$l)|0,zn=zn+Math.imul(go,El)|0;var ou=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(ou>>>26)|0,ou&=67108863,Nn=Math.imul(bo,Ll),wn=Math.imul(bo,_l),wn=wn+Math.imul(Io,Ll)|0,zn=Math.imul(Io,_l),Nn=Nn+Math.imul(Cl,xl)|0,wn=wn+Math.imul(Cl,Tl)|0,wn=wn+Math.imul(ko,xl)|0,zn=zn+Math.imul(ko,Tl)|0,Nn=Nn+Math.imul($a,Bl)|0,wn=wn+Math.imul($a,Il)|0,wn=wn+Math.imul(Jo,Bl)|0,zn=zn+Math.imul(Jo,Il)|0,Nn=Nn+Math.imul(Vo,Al)|0,wn=wn+Math.imul(Vo,Ml)|0,wn=wn+Math.imul(Fo,Al)|0,zn=zn+Math.imul(Fo,Ml)|0,Nn=Nn+Math.imul(No,Fl)|0,wn=wn+Math.imul(No,Sl)|0,wn=wn+Math.imul(Uo,Fl)|0,zn=zn+Math.imul(Uo,Sl)|0,Nn=Nn+Math.imul(qo,So)|0,wn=wn+Math.imul(qo,Co)|0,wn=wn+Math.imul(ga,So)|0,zn=zn+Math.imul(ga,Co)|0,Nn=Nn+Math.imul(Lo,po)|0,wn=wn+Math.imul(Lo,Ro)|0,wn=wn+Math.imul(Wo,po)|0,zn=zn+Math.imul(Wo,Ro)|0,Nn=Nn+Math.imul(yo,jo)|0,wn=wn+Math.imul(yo,Ko)|0,wn=wn+Math.imul(_o,jo)|0,zn=zn+Math.imul(_o,Ko)|0,Nn=Nn+Math.imul(lo,$l)|0,wn=wn+Math.imul(lo,El)|0,wn=wn+Math.imul(Eo,$l)|0,zn=zn+Math.imul(Eo,El)|0;var su=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(su>>>26)|0,su&=67108863,Nn=Math.imul(bo,xl),wn=Math.imul(bo,Tl),wn=wn+Math.imul(Io,xl)|0,zn=Math.imul(Io,Tl),Nn=Nn+Math.imul(Cl,Bl)|0,wn=wn+Math.imul(Cl,Il)|0,wn=wn+Math.imul(ko,Bl)|0,zn=zn+Math.imul(ko,Il)|0,Nn=Nn+Math.imul($a,Al)|0,wn=wn+Math.imul($a,Ml)|0,wn=wn+Math.imul(Jo,Al)|0,zn=zn+Math.imul(Jo,Ml)|0,Nn=Nn+Math.imul(Vo,Fl)|0,wn=wn+Math.imul(Vo,Sl)|0,wn=wn+Math.imul(Fo,Fl)|0,zn=zn+Math.imul(Fo,Sl)|0,Nn=Nn+Math.imul(No,So)|0,wn=wn+Math.imul(No,Co)|0,wn=wn+Math.imul(Uo,So)|0,zn=zn+Math.imul(Uo,Co)|0,Nn=Nn+Math.imul(qo,po)|0,wn=wn+Math.imul(qo,Ro)|0,wn=wn+Math.imul(ga,po)|0,zn=zn+Math.imul(ga,Ro)|0,Nn=Nn+Math.imul(Lo,jo)|0,wn=wn+Math.imul(Lo,Ko)|0,wn=wn+Math.imul(Wo,jo)|0,zn=zn+Math.imul(Wo,Ko)|0,Nn=Nn+Math.imul(yo,$l)|0,wn=wn+Math.imul(yo,El)|0,wn=wn+Math.imul(_o,$l)|0,zn=zn+Math.imul(_o,El)|0;var tu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(tu>>>26)|0,tu&=67108863,Nn=Math.imul(bo,Bl),wn=Math.imul(bo,Il),wn=wn+Math.imul(Io,Bl)|0,zn=Math.imul(Io,Il),Nn=Nn+Math.imul(Cl,Al)|0,wn=wn+Math.imul(Cl,Ml)|0,wn=wn+Math.imul(ko,Al)|0,zn=zn+Math.imul(ko,Ml)|0,Nn=Nn+Math.imul($a,Fl)|0,wn=wn+Math.imul($a,Sl)|0,wn=wn+Math.imul(Jo,Fl)|0,zn=zn+Math.imul(Jo,Sl)|0,Nn=Nn+Math.imul(Vo,So)|0,wn=wn+Math.imul(Vo,Co)|0,wn=wn+Math.imul(Fo,So)|0,zn=zn+Math.imul(Fo,Co)|0,Nn=Nn+Math.imul(No,po)|0,wn=wn+Math.imul(No,Ro)|0,wn=wn+Math.imul(Uo,po)|0,zn=zn+Math.imul(Uo,Ro)|0,Nn=Nn+Math.imul(qo,jo)|0,wn=wn+Math.imul(qo,Ko)|0,wn=wn+Math.imul(ga,jo)|0,zn=zn+Math.imul(ga,Ko)|0,Nn=Nn+Math.imul(Lo,$l)|0,wn=wn+Math.imul(Lo,El)|0,wn=wn+Math.imul(Wo,$l)|0,zn=zn+Math.imul(Wo,El)|0;var zl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(zl>>>26)|0,zl&=67108863,Nn=Math.imul(bo,Al),wn=Math.imul(bo,Ml),wn=wn+Math.imul(Io,Al)|0,zn=Math.imul(Io,Ml),Nn=Nn+Math.imul(Cl,Fl)|0,wn=wn+Math.imul(Cl,Sl)|0,wn=wn+Math.imul(ko,Fl)|0,zn=zn+Math.imul(ko,Sl)|0,Nn=Nn+Math.imul($a,So)|0,wn=wn+Math.imul($a,Co)|0,wn=wn+Math.imul(Jo,So)|0,zn=zn+Math.imul(Jo,Co)|0,Nn=Nn+Math.imul(Vo,po)|0,wn=wn+Math.imul(Vo,Ro)|0,wn=wn+Math.imul(Fo,po)|0,zn=zn+Math.imul(Fo,Ro)|0,Nn=Nn+Math.imul(No,jo)|0,wn=wn+Math.imul(No,Ko)|0,wn=wn+Math.imul(Uo,jo)|0,zn=zn+Math.imul(Uo,Ko)|0,Nn=Nn+Math.imul(qo,$l)|0,wn=wn+Math.imul(qo,El)|0,wn=wn+Math.imul(ga,$l)|0,zn=zn+Math.imul(ga,El)|0;var Gl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Gl>>>26)|0,Gl&=67108863,Nn=Math.imul(bo,Fl),wn=Math.imul(bo,Sl),wn=wn+Math.imul(Io,Fl)|0,zn=Math.imul(Io,Sl),Nn=Nn+Math.imul(Cl,So)|0,wn=wn+Math.imul(Cl,Co)|0,wn=wn+Math.imul(ko,So)|0,zn=zn+Math.imul(ko,Co)|0,Nn=Nn+Math.imul($a,po)|0,wn=wn+Math.imul($a,Ro)|0,wn=wn+Math.imul(Jo,po)|0,zn=zn+Math.imul(Jo,Ro)|0,Nn=Nn+Math.imul(Vo,jo)|0,wn=wn+Math.imul(Vo,Ko)|0,wn=wn+Math.imul(Fo,jo)|0,zn=zn+Math.imul(Fo,Ko)|0,Nn=Nn+Math.imul(No,$l)|0,wn=wn+Math.imul(No,El)|0,wn=wn+Math.imul(Uo,$l)|0,zn=zn+Math.imul(Uo,El)|0;var Jl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Jl>>>26)|0,Jl&=67108863,Nn=Math.imul(bo,So),wn=Math.imul(bo,Co),wn=wn+Math.imul(Io,So)|0,zn=Math.imul(Io,Co),Nn=Nn+Math.imul(Cl,po)|0,wn=wn+Math.imul(Cl,Ro)|0,wn=wn+Math.imul(ko,po)|0,zn=zn+Math.imul(ko,Ro)|0,Nn=Nn+Math.imul($a,jo)|0,wn=wn+Math.imul($a,Ko)|0,wn=wn+Math.imul(Jo,jo)|0,zn=zn+Math.imul(Jo,Ko)|0,Nn=Nn+Math.imul(Vo,$l)|0,wn=wn+Math.imul(Vo,El)|0,wn=wn+Math.imul(Fo,$l)|0,zn=zn+Math.imul(Fo,El)|0;var Pl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Pl>>>26)|0,Pl&=67108863,Nn=Math.imul(bo,po),wn=Math.imul(bo,Ro),wn=wn+Math.imul(Io,po)|0,zn=Math.imul(Io,Ro),Nn=Nn+Math.imul(Cl,jo)|0,wn=wn+Math.imul(Cl,Ko)|0,wn=wn+Math.imul(ko,jo)|0,zn=zn+Math.imul(ko,Ko)|0,Nn=Nn+Math.imul($a,$l)|0,wn=wn+Math.imul($a,El)|0,wn=wn+Math.imul(Jo,$l)|0,zn=zn+Math.imul(Jo,El)|0;var Ul=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Ul>>>26)|0,Ul&=67108863,Nn=Math.imul(bo,jo),wn=Math.imul(bo,Ko),wn=wn+Math.imul(Io,jo)|0,zn=Math.imul(Io,Ko),Nn=Nn+Math.imul(Cl,$l)|0,wn=wn+Math.imul(Cl,El)|0,wn=wn+Math.imul(ko,$l)|0,zn=zn+Math.imul(ko,El)|0;var Yl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Yl>>>26)|0,Yl&=67108863,Nn=Math.imul(bo,$l),wn=Math.imul(bo,El),wn=wn+Math.imul(Io,$l)|0,zn=Math.imul(Io,El);var Vl=(Zn+Nn|0)+((wn&8191)<<13)|0;return Zn=(zn+(wn>>>13)|0)+(Vl>>>26)|0,Vl&=67108863,On[0]=Cu,On[1]=iu,On[2]=pu,On[3]=yu,On[4]=hu,On[5]=mu,On[6]=vu,On[7]=fu,On[8]=gu,On[9]=ou,On[10]=su,On[11]=tu,On[12]=zl,On[13]=Gl,On[14]=Jl,On[15]=Pl,On[16]=Ul,On[17]=Yl,On[18]=Vl,Zn!==0&&(On[19]=Zn,Sn.length++),Sn};Math.imul||(An=In);function jn(Tn,Hr,Xr){Xr.negative=Hr.negative^Tn.negative,Xr.length=Tn.length+Hr.length;for(var Sn=0,Rn=0,Pn=0;Pn>>26)|0,Rn+=On>>>26,On&=67108863}Xr.words[Pn]=Zn,Sn=On,On=Rn}return Sn!==0?Xr.words[Pn]=Sn:Xr.length--,Xr._strip()}function eo(Tn,Hr,Xr){return jn(Tn,Hr,Xr)}jr.prototype.mulTo=function(Hr,Xr){var Sn,Rn=this.length+Hr.length;return this.length===10&&Hr.length===10?Sn=An(this,Hr,Xr):Rn<63?Sn=In(this,Hr,Xr):Rn<1024?Sn=jn(this,Hr,Xr):Sn=eo(this,Hr,Xr),Sn},jr.prototype.mul=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),this.mulTo(Hr,Xr)},jr.prototype.mulf=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),eo(this,Hr,Xr)},jr.prototype.imul=function(Hr){return this.clone().mulTo(Hr,this)},jr.prototype.imuln=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(typeof Hr=="number"),Er(Hr<67108864);for(var Sn=0,Rn=0;Rn>=26,Sn+=Pn/67108864|0,Sn+=On>>>26,this.words[Rn]=On&67108863}return Sn!==0&&(this.words[Rn]=Sn,this.length++),Xr?this.ineg():this},jr.prototype.muln=function(Hr){return this.clone().imuln(Hr)},jr.prototype.sqr=function(){return this.mul(this)},jr.prototype.isqr=function(){return this.imul(this.clone())},jr.prototype.pow=function(Hr){var Xr=Cn(Hr);if(Xr.length===0)return new jr(1);for(var Sn=this,Rn=0;Rn=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=67108863>>>26-Xr<<26-Xr,Pn;if(Xr!==0){var On=0;for(Pn=0;Pn>>26-Xr}On&&(this.words[Pn]=On,this.length++)}if(Sn!==0){for(Pn=this.length-1;Pn>=0;Pn--)this.words[Pn+Sn]=this.words[Pn];for(Pn=0;Pn=0);var Rn;Xr?Rn=(Xr-Xr%26)/26:Rn=0;var Pn=Hr%26,On=Math.min((Hr-Pn)/26,this.length),Zn=67108863^67108863>>>Pn<On)for(this.length-=On,wn=0;wn=0&&(zn!==0||wn>=Rn);wn--){var fo=this.words[wn]|0;this.words[wn]=zn<<26-Pn|fo>>>Pn,zn=fo&Zn}return Nn&&zn!==0&&(Nn.words[Nn.length++]=zn),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},jr.prototype.ishrn=function(Hr,Xr,Sn){return Er(this.negative===0),this.iushrn(Hr,Xr,Sn)},jr.prototype.shln=function(Hr){return this.clone().ishln(Hr)},jr.prototype.ushln=function(Hr){return this.clone().iushln(Hr)},jr.prototype.shrn=function(Hr){return this.clone().ishrn(Hr)},jr.prototype.ushrn=function(Hr){return this.clone().iushrn(Hr)},jr.prototype.testn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<=0);var Xr=Hr%26,Sn=(Hr-Xr)/26;if(Er(this.negative===0,"imaskn works only with positive numbers"),this.length<=Sn)return this;if(Xr!==0&&Sn++,this.length=Math.min(Sn,this.length),Xr!==0){var Rn=67108863^67108863>>>Xr<=67108864;Xr++)this.words[Xr]-=67108864,Xr===this.length-1?this.words[Xr+1]=1:this.words[Xr+1]++;return this.length=Math.max(this.length,Xr+1),this},jr.prototype.isubn=function(Hr){if(Er(typeof Hr=="number"),Er(Hr<67108864),Hr<0)return this.iaddn(-Hr);if(this.negative!==0)return this.negative=0,this.iaddn(Hr),this.negative=1,this;if(this.words[0]-=Hr,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Xr=0;Xr>26)-(Nn/67108864|0),this.words[Pn+Sn]=On&67108863}for(;Pn>26,this.words[Pn+Sn]=On&67108863;if(Zn===0)return this._strip();for(Er(Zn===-1),Zn=0,Pn=0;Pn>26,this.words[Pn]=On&67108863;return this.negative=1,this._strip()},jr.prototype._wordDiv=function(Hr,Xr){var Sn=this.length-Hr.length,Rn=this.clone(),Pn=Hr,On=Pn.words[Pn.length-1]|0,Zn=this._countBits(On);Sn=26-Zn,Sn!==0&&(Pn=Pn.ushln(Sn),Rn.iushln(Sn),On=Pn.words[Pn.length-1]|0);var Nn=Rn.length-Pn.length,wn;if(Xr!=="mod"){wn=new jr(null),wn.length=Nn+1,wn.words=new Array(wn.length);for(var zn=0;zn=0;vo--){var go=(Rn.words[Pn.length+vo]|0)*67108864+(Rn.words[Pn.length+vo-1]|0);for(go=Math.min(go/On|0,67108863),Rn._ishlnsubmul(Pn,go,vo);Rn.negative!==0;)go--,Rn.negative=0,Rn._ishlnsubmul(Pn,1,vo),Rn.isZero()||(Rn.negative^=1);wn&&(wn.words[vo]=go)}return wn&&wn._strip(),Rn._strip(),Xr!=="div"&&Sn!==0&&Rn.iushrn(Sn),{div:wn||null,mod:Rn}},jr.prototype.divmod=function(Hr,Xr,Sn){if(Er(!Hr.isZero()),this.isZero())return{div:new jr(0),mod:new jr(0)};var Rn,Pn,On;return this.negative!==0&&Hr.negative===0?(On=this.neg().divmod(Hr,Xr),Xr!=="mod"&&(Rn=On.div.neg()),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.iadd(Hr)),{div:Rn,mod:Pn}):this.negative===0&&Hr.negative!==0?(On=this.divmod(Hr.neg(),Xr),Xr!=="mod"&&(Rn=On.div.neg()),{div:Rn,mod:On.mod}):this.negative&Hr.negative?(On=this.neg().divmod(Hr.neg(),Xr),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.isub(Hr)),{div:On.div,mod:Pn}):Hr.length>this.length||this.cmp(Hr)<0?{div:new jr(0),mod:this}:Hr.length===1?Xr==="div"?{div:this.divn(Hr.words[0]),mod:null}:Xr==="mod"?{div:null,mod:new jr(this.modrn(Hr.words[0]))}:{div:this.divn(Hr.words[0]),mod:new jr(this.modrn(Hr.words[0]))}:this._wordDiv(Hr,Xr)},jr.prototype.div=function(Hr){return this.divmod(Hr,"div",!1).div},jr.prototype.mod=function(Hr){return this.divmod(Hr,"mod",!1).mod},jr.prototype.umod=function(Hr){return this.divmod(Hr,"mod",!0).mod},jr.prototype.divRound=function(Hr){var Xr=this.divmod(Hr);if(Xr.mod.isZero())return Xr.div;var Sn=Xr.div.negative!==0?Xr.mod.isub(Hr):Xr.mod,Rn=Hr.ushrn(1),Pn=Hr.andln(1),On=Sn.cmp(Rn);return On<0||Pn===1&&On===0?Xr.div:Xr.div.negative!==0?Xr.div.isubn(1):Xr.div.iaddn(1)},jr.prototype.modrn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=(1<<26)%Hr,Rn=0,Pn=this.length-1;Pn>=0;Pn--)Rn=(Sn*Rn+(this.words[Pn]|0))%Hr;return Xr?-Rn:Rn},jr.prototype.modn=function(Hr){return this.modrn(Hr)},jr.prototype.idivn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=0,Rn=this.length-1;Rn>=0;Rn--){var Pn=(this.words[Rn]|0)+Sn*67108864;this.words[Rn]=Pn/Hr|0,Sn=Pn%Hr}return this._strip(),Xr?this.ineg():this},jr.prototype.divn=function(Hr){return this.clone().idivn(Hr)},jr.prototype.egcd=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=new jr(0),Zn=new jr(1),Nn=0;Xr.isEven()&&Sn.isEven();)Xr.iushrn(1),Sn.iushrn(1),++Nn;for(var wn=Sn.clone(),zn=Xr.clone();!Xr.isZero();){for(var fo=0,vo=1;!(Xr.words[0]&vo)&&fo<26;++fo,vo<<=1);if(fo>0)for(Xr.iushrn(fo);fo-- >0;)(Rn.isOdd()||Pn.isOdd())&&(Rn.iadd(wn),Pn.isub(zn)),Rn.iushrn(1),Pn.iushrn(1);for(var go=0,uo=1;!(Sn.words[0]&uo)&&go<26;++go,uo<<=1);if(go>0)for(Sn.iushrn(go);go-- >0;)(On.isOdd()||Zn.isOdd())&&(On.iadd(wn),Zn.isub(zn)),On.iushrn(1),Zn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(On),Pn.isub(Zn)):(Sn.isub(Xr),On.isub(Rn),Zn.isub(Pn))}return{a:On,b:Zn,gcd:Sn.iushln(Nn)}},jr.prototype._invmp=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=Sn.clone();Xr.cmpn(1)>0&&Sn.cmpn(1)>0;){for(var Zn=0,Nn=1;!(Xr.words[0]&Nn)&&Zn<26;++Zn,Nn<<=1);if(Zn>0)for(Xr.iushrn(Zn);Zn-- >0;)Rn.isOdd()&&Rn.iadd(On),Rn.iushrn(1);for(var wn=0,zn=1;!(Sn.words[0]&zn)&&wn<26;++wn,zn<<=1);if(wn>0)for(Sn.iushrn(wn);wn-- >0;)Pn.isOdd()&&Pn.iadd(On),Pn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(Pn)):(Sn.isub(Xr),Pn.isub(Rn))}var fo;return Xr.cmpn(1)===0?fo=Rn:fo=Pn,fo.cmpn(0)<0&&fo.iadd(Hr),fo},jr.prototype.gcd=function(Hr){if(this.isZero())return Hr.abs();if(Hr.isZero())return this.abs();var Xr=this.clone(),Sn=Hr.clone();Xr.negative=0,Sn.negative=0;for(var Rn=0;Xr.isEven()&&Sn.isEven();Rn++)Xr.iushrn(1),Sn.iushrn(1);do{for(;Xr.isEven();)Xr.iushrn(1);for(;Sn.isEven();)Sn.iushrn(1);var Pn=Xr.cmp(Sn);if(Pn<0){var On=Xr;Xr=Sn,Sn=On}else if(Pn===0||Sn.cmpn(1)===0)break;Xr.isub(Sn)}while(!0);return Sn.iushln(Rn)},jr.prototype.invm=function(Hr){return this.egcd(Hr).a.umod(Hr)},jr.prototype.isEven=function(){return(this.words[0]&1)===0},jr.prototype.isOdd=function(){return(this.words[0]&1)===1},jr.prototype.andln=function(Hr){return this.words[0]&Hr},jr.prototype.bincn=function(Hr){Er(typeof Hr=="number");var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<>>26,Zn&=67108863,this.words[On]=Zn}return Pn!==0&&(this.words[On]=Pn,this.length++),this},jr.prototype.isZero=function(){return this.length===1&&this.words[0]===0},jr.prototype.cmpn=function(Hr){var Xr=Hr<0;if(this.negative!==0&&!Xr)return-1;if(this.negative===0&&Xr)return 1;this._strip();var Sn;if(this.length>1)Sn=1;else{Xr&&(Hr=-Hr),Er(Hr<=67108863,"Number is too big");var Rn=this.words[0]|0;Sn=Rn===Hr?0:RnHr.length)return 1;if(this.length=0;Sn--){var Rn=this.words[Sn]|0,Pn=Hr.words[Sn]|0;if(Rn!==Pn){RnPn&&(Xr=1);break}}return Xr},jr.prototype.gtn=function(Hr){return this.cmpn(Hr)===1},jr.prototype.gt=function(Hr){return this.cmp(Hr)===1},jr.prototype.gten=function(Hr){return this.cmpn(Hr)>=0},jr.prototype.gte=function(Hr){return this.cmp(Hr)>=0},jr.prototype.ltn=function(Hr){return this.cmpn(Hr)===-1},jr.prototype.lt=function(Hr){return this.cmp(Hr)===-1},jr.prototype.lten=function(Hr){return this.cmpn(Hr)<=0},jr.prototype.lte=function(Hr){return this.cmp(Hr)<=0},jr.prototype.eqn=function(Hr){return this.cmpn(Hr)===0},jr.prototype.eq=function(Hr){return this.cmp(Hr)===0},jr.red=function(Hr){return new so(Hr)},jr.prototype.toRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),Er(this.negative===0,"red works only with positives"),Hr.convertTo(this)._forceRed(Hr)},jr.prototype.fromRed=function(){return Er(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},jr.prototype._forceRed=function(Hr){return this.red=Hr,this},jr.prototype.forceRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),this._forceRed(Hr)},jr.prototype.redAdd=function(Hr){return Er(this.red,"redAdd works only with red numbers"),this.red.add(this,Hr)},jr.prototype.redIAdd=function(Hr){return Er(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Hr)},jr.prototype.redSub=function(Hr){return Er(this.red,"redSub works only with red numbers"),this.red.sub(this,Hr)},jr.prototype.redISub=function(Hr){return Er(this.red,"redISub works only with red numbers"),this.red.isub(this,Hr)},jr.prototype.redShl=function(Hr){return Er(this.red,"redShl works only with red numbers"),this.red.shl(this,Hr)},jr.prototype.redMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.mul(this,Hr)},jr.prototype.redIMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.imul(this,Hr)},jr.prototype.redSqr=function(){return Er(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},jr.prototype.redISqr=function(){return Er(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},jr.prototype.redSqrt=function(){return Er(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},jr.prototype.redInvm=function(){return Er(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},jr.prototype.redNeg=function(){return Er(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},jr.prototype.redPow=function(Hr){return Er(this.red&&!Hr.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Hr)};var ro={k256:null,p224:null,p192:null,p25519:null};function to(Tn,Hr){this.name=Tn,this.p=new jr(Hr,16),this.n=this.p.bitLength(),this.k=new jr(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}to.prototype._tmp=function(){var Hr=new jr(null);return Hr.words=new Array(Math.ceil(this.n/13)),Hr},to.prototype.ireduce=function(Hr){var Xr=Hr,Sn;do this.split(Xr,this.tmp),Xr=this.imulK(Xr),Xr=Xr.iadd(this.tmp),Sn=Xr.bitLength();while(Sn>this.n);var Rn=Sn0?Xr.isub(this.p):Xr.strip!==void 0?Xr.strip():Xr._strip(),Xr},to.prototype.split=function(Hr,Xr){Hr.iushrn(this.n,0,Xr)},to.prototype.imulK=function(Hr){return Hr.imul(this.k)};function _i(){to.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}kr(_i,to),_i.prototype.split=function(Hr,Xr){for(var Sn=4194303,Rn=Math.min(Hr.length,9),Pn=0;Pn>>22,On=Zn}On>>>=22,Hr.words[Pn-10]=On,On===0&&Hr.length>10?Hr.length-=10:Hr.length-=9},_i.prototype.imulK=function(Hr){Hr.words[Hr.length]=0,Hr.words[Hr.length+1]=0,Hr.length+=2;for(var Xr=0,Sn=0;Sn>>=26,Hr.words[Sn]=Pn,Xr=Rn}return Xr!==0&&(Hr.words[Hr.length++]=Xr),Hr},jr._prime=function(Hr){if(ro[Hr])return ro[Hr];var Xr;if(Hr==="k256")Xr=new _i;else if(Hr==="p224")Xr=new oo;else if(Hr==="p192")Xr=new io;else if(Hr==="p25519")Xr=new co;else throw new Error("Unknown prime "+Hr);return ro[Hr]=Xr,Xr};function so(Tn){if(typeof Tn=="string"){var Hr=jr._prime(Tn);this.m=Hr.p,this.prime=Hr}else Er(Tn.gtn(1),"modulus must be greater than 1"),this.m=Tn,this.prime=null}so.prototype._verify1=function(Hr){Er(Hr.negative===0,"red works only with positives"),Er(Hr.red,"red works only with red numbers")},so.prototype._verify2=function(Hr,Xr){Er((Hr.negative|Xr.negative)===0,"red works only with positives"),Er(Hr.red&&Hr.red===Xr.red,"red works only with red numbers")},so.prototype.imod=function(Hr){return this.prime?this.prime.ireduce(Hr)._forceRed(this):(Vr(Hr,Hr.umod(this.m)._forceRed(this)),Hr)},so.prototype.neg=function(Hr){return Hr.isZero()?Hr.clone():this.m.sub(Hr)._forceRed(this)},so.prototype.add=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.add(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn._forceRed(this)},so.prototype.iadd=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.iadd(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn},so.prototype.sub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.sub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn._forceRed(this)},so.prototype.isub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.isub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn},so.prototype.shl=function(Hr,Xr){return this._verify1(Hr),this.imod(Hr.ushln(Xr))},so.prototype.imul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.imul(Xr))},so.prototype.mul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.mul(Xr))},so.prototype.isqr=function(Hr){return this.imul(Hr,Hr.clone())},so.prototype.sqr=function(Hr){return this.mul(Hr,Hr)},so.prototype.sqrt=function(Hr){if(Hr.isZero())return Hr.clone();var Xr=this.m.andln(3);if(Er(Xr%2===1),Xr===3){var Sn=this.m.add(new jr(1)).iushrn(2);return this.pow(Hr,Sn)}for(var Rn=this.m.subn(1),Pn=0;!Rn.isZero()&&Rn.andln(1)===0;)Pn++,Rn.iushrn(1);Er(!Rn.isZero());var On=new jr(1).toRed(this),Zn=On.redNeg(),Nn=this.m.subn(1).iushrn(1),wn=this.m.bitLength();for(wn=new jr(2*wn*wn).toRed(this);this.pow(wn,Nn).cmp(Zn)!==0;)wn.redIAdd(Zn);for(var zn=this.pow(wn,Rn),fo=this.pow(Hr,Rn.addn(1).iushrn(1)),vo=this.pow(Hr,Rn),go=Pn;vo.cmp(On)!==0;){for(var uo=vo,lo=0;uo.cmp(On)!==0;lo++)uo=uo.redSqr();Er(lo=0;Pn--){for(var zn=Xr.words[Pn],fo=wn-1;fo>=0;fo--){var vo=zn>>fo&1;if(On!==Rn[0]&&(On=this.sqr(On)),vo===0&&Zn===0){Nn=0;continue}Zn<<=1,Zn|=vo,Nn++,!(Nn!==Sn&&(Pn!==0||fo!==0))&&(On=this.mul(On,Rn[Zn]),Nn=0,Zn=0)}wn=26}return On},so.prototype.convertTo=function(Hr){var Xr=Hr.umod(this.m);return Xr===Hr?Xr.clone():Xr},so.prototype.convertFrom=function(Hr){var Xr=Hr.clone();return Xr.red=null,Xr},jr.mont=function(Hr){return new no(Hr)};function no(Tn){so.call(this,Tn),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new jr(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}kr(no,so),no.prototype.convertTo=function(Hr){return this.imod(Hr.ushln(this.shift))},no.prototype.convertFrom=function(Hr){var Xr=this.imod(Hr.mul(this.rinv));return Xr.red=null,Xr},no.prototype.imul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return Hr.words[0]=0,Hr.length=1,Hr;var Sn=Hr.imul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.mul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return new jr(0)._forceRed(this);var Sn=Hr.mul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.invm=function(Hr){var Xr=this.imod(Hr._invmp(this.m).mul(this.r2));return Xr._forceRed(this)}})(fr,commonjsGlobal)})(bn$3);var bnExports$3=bn$3.exports;const BN$2=getDefaultExportFromCjs$2(bnExports$3);var _Buffer$3=safeBufferExports.Buffer;function base$3(fr){if(fr.length>=255)throw new TypeError("Alphabet too long");for(var br=new Uint8Array(256),wr=0;wr>>0,jn=new Uint8Array(An);Cn!==In;){for(var eo=Qr[Cn],ro=0,to=An-1;(eo!==0||ro>>0,jn[to]=eo%Br>>>0,eo=eo/Br>>>0;if(eo!==0)throw new Error("Non-zero carry");En=ro,Cn++}for(var _i=An-En;_i!==An&&jn[_i]===0;)_i++;for(var oo=Wr.repeat(_n);_i>>0,An=new Uint8Array(In);_n>>0,An[ro]=jn%256>>>0,jn=jn/256>>>0;if(jn!==0)throw new Error("Non-zero carry");Cn=eo,_n++}for(var to=In-Cn;to!==In&&An[to]===0;)to++;var _i=_Buffer$3.allocUnsafe(En+(In-to));_i.fill(0,0,En);for(var oo=En;to!==In;)_i[oo++]=An[to++];return _i}function Jr(Qr){var _n=Zr(Qr);if(_n)return _n;throw new Error("Non-base"+Br+" character")}return{encode:Vr,decodeUnsafe:Zr,decode:Jr}}var src$3=base$3,basex$3=src$3,ALPHABET$3="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58$5=basex$3(ALPHABET$3);const bs58$6=getDefaultExportFromCjs$2(bs58$5);var lib={},bn$2={exports:{}};bn$2.exports;(function(fr){(function(br,wr){function Er(Tn,Hr){if(!Tn)throw new Error(Hr||"Assertion failed")}function kr(Tn,Hr){Tn.super_=Hr;var Xr=function(){};Xr.prototype=Hr.prototype,Tn.prototype=new Xr,Tn.prototype.constructor=Tn}function jr(Tn,Hr,Xr){if(jr.isBN(Tn))return Tn;this.negative=0,this.words=null,this.length=0,this.red=null,Tn!==null&&((Hr==="le"||Hr==="be")&&(Xr=Hr,Hr=10),this._init(Tn||0,Hr||10,Xr||"be"))}typeof br=="object"?br.exports=jr:wr.BN=jr,jr.BN=jr,jr.wordSize=26;var Br;try{typeof window<"u"&&typeof window.Buffer<"u"?Br=window.Buffer:Br=require$$0$9.Buffer}catch{}jr.isBN=function(Hr){return Hr instanceof jr?!0:Hr!==null&&typeof Hr=="object"&&Hr.constructor.wordSize===jr.wordSize&&Array.isArray(Hr.words)},jr.max=function(Hr,Xr){return Hr.cmp(Xr)>0?Hr:Xr},jr.min=function(Hr,Xr){return Hr.cmp(Xr)<0?Hr:Xr},jr.prototype._init=function(Hr,Xr,Sn){if(typeof Hr=="number")return this._initNumber(Hr,Xr,Sn);if(typeof Hr=="object")return this._initArray(Hr,Xr,Sn);Xr==="hex"&&(Xr=16),Er(Xr===(Xr|0)&&Xr>=2&&Xr<=36),Hr=Hr.toString().replace(/\s+/g,"");var Rn=0;Hr[0]==="-"&&(Rn++,this.negative=1),Rn=0;Rn-=3)On=Hr[Rn]|Hr[Rn-1]<<8|Hr[Rn-2]<<16,this.words[Pn]|=On<>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);else if(Sn==="le")for(Rn=0,Pn=0;Rn>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);return this._strip()};function Wr(Tn,Hr){var Xr=Tn.charCodeAt(Hr);if(Xr>=48&&Xr<=57)return Xr-48;if(Xr>=65&&Xr<=70)return Xr-55;if(Xr>=97&&Xr<=102)return Xr-87;Er(!1,"Invalid character in "+Tn)}function qr(Tn,Hr,Xr){var Sn=Wr(Tn,Xr);return Xr-1>=Hr&&(Sn|=Wr(Tn,Xr-1)<<4),Sn}jr.prototype._parseHex=function(Hr,Xr,Sn){this.length=Math.ceil((Hr.length-Xr)/6),this.words=new Array(this.length);for(var Rn=0;Rn=Xr;Rn-=2)Zn=qr(Hr,Xr,Rn)<=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8;else{var Nn=Hr.length-Xr;for(Rn=Nn%2===0?Xr+1:Xr;Rn=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8}this._strip()};function Gr(Tn,Hr,Xr,Sn){for(var Rn=0,Pn=0,On=Math.min(Tn.length,Xr),Zn=Hr;Zn=49?Pn=Nn-49+10:Nn>=17?Pn=Nn-17+10:Pn=Nn,Er(Nn>=0&&Pn1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},jr.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{jr.prototype[Symbol.for("nodejs.util.inspect.custom")]=Zr}catch{jr.prototype.inspect=Zr}else jr.prototype.inspect=Zr;function Zr(){return(this.red?""}var Jr=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Qr=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_n=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];jr.prototype.toString=function(Hr,Xr){Hr=Hr||10,Xr=Xr|0||1;var Sn;if(Hr===16||Hr==="hex"){Sn="";for(var Rn=0,Pn=0,On=0;On>>24-Rn&16777215,Rn+=2,Rn>=26&&(Rn-=26,On--),Pn!==0||On!==this.length-1?Sn=Jr[6-Nn.length]+Nn+Sn:Sn=Nn+Sn}for(Pn!==0&&(Sn=Pn.toString(16)+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}if(Hr===(Hr|0)&&Hr>=2&&Hr<=36){var wn=Qr[Hr],zn=_n[Hr];Sn="";var fo=this.clone();for(fo.negative=0;!fo.isZero();){var vo=fo.modrn(zn).toString(Hr);fo=fo.idivn(zn),fo.isZero()?Sn=vo+Sn:Sn=Jr[wn-vo.length]+vo+Sn}for(this.isZero()&&(Sn="0"+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}Er(!1,"Base should be between 2 and 36")},jr.prototype.toNumber=function(){var Hr=this.words[0];return this.length===2?Hr+=this.words[1]*67108864:this.length===3&&this.words[2]===1?Hr+=4503599627370496+this.words[1]*67108864:this.length>2&&Er(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-Hr:Hr},jr.prototype.toJSON=function(){return this.toString(16,2)},Br&&(jr.prototype.toBuffer=function(Hr,Xr){return this.toArrayLike(Br,Hr,Xr)}),jr.prototype.toArray=function(Hr,Xr){return this.toArrayLike(Array,Hr,Xr)};var En=function(Hr,Xr){return Hr.allocUnsafe?Hr.allocUnsafe(Xr):new Hr(Xr)};jr.prototype.toArrayLike=function(Hr,Xr,Sn){this._strip();var Rn=this.byteLength(),Pn=Sn||Math.max(1,Rn);Er(Rn<=Pn,"byte array longer than desired length"),Er(Pn>0,"Requested array length <= 0");var On=En(Hr,Pn),Zn=Xr==="le"?"LE":"BE";return this["_toArrayLike"+Zn](On,Rn),On},jr.prototype._toArrayLikeLE=function(Hr,Xr){for(var Sn=0,Rn=0,Pn=0,On=0;Pn>8&255),Sn>16&255),On===6?(Sn>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn=0&&(Hr[Sn--]=Zn>>8&255),Sn>=0&&(Hr[Sn--]=Zn>>16&255),On===6?(Sn>=0&&(Hr[Sn--]=Zn>>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn>=0)for(Hr[Sn--]=Rn;Sn>=0;)Hr[Sn--]=0},Math.clz32?jr.prototype._countBits=function(Hr){return 32-Math.clz32(Hr)}:jr.prototype._countBits=function(Hr){var Xr=Hr,Sn=0;return Xr>=4096&&(Sn+=13,Xr>>>=13),Xr>=64&&(Sn+=7,Xr>>>=7),Xr>=8&&(Sn+=4,Xr>>>=4),Xr>=2&&(Sn+=2,Xr>>>=2),Sn+Xr},jr.prototype._zeroBits=function(Hr){if(Hr===0)return 26;var Xr=Hr,Sn=0;return Xr&8191||(Sn+=13,Xr>>>=13),Xr&127||(Sn+=7,Xr>>>=7),Xr&15||(Sn+=4,Xr>>>=4),Xr&3||(Sn+=2,Xr>>>=2),Xr&1||Sn++,Sn},jr.prototype.bitLength=function(){var Hr=this.words[this.length-1],Xr=this._countBits(Hr);return(this.length-1)*26+Xr};function Cn(Tn){for(var Hr=new Array(Tn.bitLength()),Xr=0;Xr>>Rn&1}return Hr}jr.prototype.zeroBits=function(){if(this.isZero())return 0;for(var Hr=0,Xr=0;XrHr.length?this.clone().ior(Hr):Hr.clone().ior(this)},jr.prototype.uor=function(Hr){return this.length>Hr.length?this.clone().iuor(Hr):Hr.clone().iuor(this)},jr.prototype.iuand=function(Hr){var Xr;this.length>Hr.length?Xr=Hr:Xr=this;for(var Sn=0;SnHr.length?this.clone().iand(Hr):Hr.clone().iand(this)},jr.prototype.uand=function(Hr){return this.length>Hr.length?this.clone().iuand(Hr):Hr.clone().iuand(this)},jr.prototype.iuxor=function(Hr){var Xr,Sn;this.length>Hr.length?(Xr=this,Sn=Hr):(Xr=Hr,Sn=this);for(var Rn=0;RnHr.length?this.clone().ixor(Hr):Hr.clone().ixor(this)},jr.prototype.uxor=function(Hr){return this.length>Hr.length?this.clone().iuxor(Hr):Hr.clone().iuxor(this)},jr.prototype.inotn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Math.ceil(Hr/26)|0,Sn=Hr%26;this._expand(Xr),Sn>0&&Xr--;for(var Rn=0;Rn0&&(this.words[Rn]=~this.words[Rn]&67108863>>26-Sn),this._strip()},jr.prototype.notn=function(Hr){return this.clone().inotn(Hr)},jr.prototype.setn=function(Hr,Xr){Er(typeof Hr=="number"&&Hr>=0);var Sn=Hr/26|0,Rn=Hr%26;return this._expand(Sn+1),Xr?this.words[Sn]=this.words[Sn]|1<Hr.length?(Sn=this,Rn=Hr):(Sn=Hr,Rn=this);for(var Pn=0,On=0;On>>26;for(;Pn!==0&&On>>26;if(this.length=Sn.length,Pn!==0)this.words[this.length]=Pn,this.length++;else if(Sn!==this)for(;OnHr.length?this.clone().iadd(Hr):Hr.clone().iadd(this)},jr.prototype.isub=function(Hr){if(Hr.negative!==0){Hr.negative=0;var Xr=this.iadd(Hr);return Hr.negative=1,Xr._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Hr),this.negative=1,this._normSign();var Sn=this.cmp(Hr);if(Sn===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Rn,Pn;Sn>0?(Rn=this,Pn=Hr):(Rn=Hr,Pn=this);for(var On=0,Zn=0;Zn>26,this.words[Zn]=Xr&67108863;for(;On!==0&&Zn>26,this.words[Zn]=Xr&67108863;if(On===0&&Zn>>26,fo=Nn&67108863,vo=Math.min(wn,Hr.length-1),go=Math.max(0,wn-Tn.length+1);go<=vo;go++){var uo=wn-go|0;Rn=Tn.words[uo]|0,Pn=Hr.words[go]|0,On=Rn*Pn+fo,zn+=On/67108864|0,fo=On&67108863}Xr.words[wn]=fo|0,Nn=zn|0}return Nn!==0?Xr.words[wn]=Nn|0:Xr.length--,Xr._strip()}var An=function(Hr,Xr,Sn){var Rn=Hr.words,Pn=Xr.words,On=Sn.words,Zn=0,Nn,wn,zn,fo=Rn[0]|0,vo=fo&8191,go=fo>>>13,uo=Rn[1]|0,lo=uo&8191,Eo=uo>>>13,mo=Rn[2]|0,yo=mo&8191,_o=mo>>>13,Bo=Rn[3]|0,Lo=Bo&8191,Wo=Bo>>>13,na=Rn[4]|0,qo=na&8191,ga=na>>>13,wl=Rn[5]|0,No=wl&8191,Uo=wl>>>13,Nl=Rn[6]|0,Vo=Nl&8191,Fo=Nl>>>13,Ol=Rn[7]|0,$a=Ol&8191,Jo=Ol>>>13,Zl=Rn[8]|0,Cl=Zl&8191,ko=Zl>>>13,wo=Rn[9]|0,bo=wo&8191,Io=wo>>>13,Ho=Pn[0]|0,Do=Ho&8191,zo=Ho>>>13,nu=Pn[1]|0,Ll=nu&8191,_l=nu>>>13,bu=Pn[2]|0,xl=bu&8191,Tl=bu>>>13,du=Pn[3]|0,Bl=du&8191,Il=du>>>13,Eu=Pn[4]|0,Al=Eu&8191,Ml=Eu>>>13,Tu=Pn[5]|0,Fl=Tu&8191,Sl=Tu>>>13,_u=Pn[6]|0,So=_u&8191,Co=_u>>>13,Ao=Pn[7]|0,po=Ao&8191,Ro=Ao>>>13,Xo=Pn[8]|0,jo=Xo&8191,Ko=Xo>>>13,Wl=Pn[9]|0,$l=Wl&8191,El=Wl>>>13;Sn.negative=Hr.negative^Xr.negative,Sn.length=19,Nn=Math.imul(vo,Do),wn=Math.imul(vo,zo),wn=wn+Math.imul(go,Do)|0,zn=Math.imul(go,zo);var Cu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,Nn=Math.imul(lo,Do),wn=Math.imul(lo,zo),wn=wn+Math.imul(Eo,Do)|0,zn=Math.imul(Eo,zo),Nn=Nn+Math.imul(vo,Ll)|0,wn=wn+Math.imul(vo,_l)|0,wn=wn+Math.imul(go,Ll)|0,zn=zn+Math.imul(go,_l)|0;var iu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(iu>>>26)|0,iu&=67108863,Nn=Math.imul(yo,Do),wn=Math.imul(yo,zo),wn=wn+Math.imul(_o,Do)|0,zn=Math.imul(_o,zo),Nn=Nn+Math.imul(lo,Ll)|0,wn=wn+Math.imul(lo,_l)|0,wn=wn+Math.imul(Eo,Ll)|0,zn=zn+Math.imul(Eo,_l)|0,Nn=Nn+Math.imul(vo,xl)|0,wn=wn+Math.imul(vo,Tl)|0,wn=wn+Math.imul(go,xl)|0,zn=zn+Math.imul(go,Tl)|0;var pu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(pu>>>26)|0,pu&=67108863,Nn=Math.imul(Lo,Do),wn=Math.imul(Lo,zo),wn=wn+Math.imul(Wo,Do)|0,zn=Math.imul(Wo,zo),Nn=Nn+Math.imul(yo,Ll)|0,wn=wn+Math.imul(yo,_l)|0,wn=wn+Math.imul(_o,Ll)|0,zn=zn+Math.imul(_o,_l)|0,Nn=Nn+Math.imul(lo,xl)|0,wn=wn+Math.imul(lo,Tl)|0,wn=wn+Math.imul(Eo,xl)|0,zn=zn+Math.imul(Eo,Tl)|0,Nn=Nn+Math.imul(vo,Bl)|0,wn=wn+Math.imul(vo,Il)|0,wn=wn+Math.imul(go,Bl)|0,zn=zn+Math.imul(go,Il)|0;var yu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(yu>>>26)|0,yu&=67108863,Nn=Math.imul(qo,Do),wn=Math.imul(qo,zo),wn=wn+Math.imul(ga,Do)|0,zn=Math.imul(ga,zo),Nn=Nn+Math.imul(Lo,Ll)|0,wn=wn+Math.imul(Lo,_l)|0,wn=wn+Math.imul(Wo,Ll)|0,zn=zn+Math.imul(Wo,_l)|0,Nn=Nn+Math.imul(yo,xl)|0,wn=wn+Math.imul(yo,Tl)|0,wn=wn+Math.imul(_o,xl)|0,zn=zn+Math.imul(_o,Tl)|0,Nn=Nn+Math.imul(lo,Bl)|0,wn=wn+Math.imul(lo,Il)|0,wn=wn+Math.imul(Eo,Bl)|0,zn=zn+Math.imul(Eo,Il)|0,Nn=Nn+Math.imul(vo,Al)|0,wn=wn+Math.imul(vo,Ml)|0,wn=wn+Math.imul(go,Al)|0,zn=zn+Math.imul(go,Ml)|0;var hu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(hu>>>26)|0,hu&=67108863,Nn=Math.imul(No,Do),wn=Math.imul(No,zo),wn=wn+Math.imul(Uo,Do)|0,zn=Math.imul(Uo,zo),Nn=Nn+Math.imul(qo,Ll)|0,wn=wn+Math.imul(qo,_l)|0,wn=wn+Math.imul(ga,Ll)|0,zn=zn+Math.imul(ga,_l)|0,Nn=Nn+Math.imul(Lo,xl)|0,wn=wn+Math.imul(Lo,Tl)|0,wn=wn+Math.imul(Wo,xl)|0,zn=zn+Math.imul(Wo,Tl)|0,Nn=Nn+Math.imul(yo,Bl)|0,wn=wn+Math.imul(yo,Il)|0,wn=wn+Math.imul(_o,Bl)|0,zn=zn+Math.imul(_o,Il)|0,Nn=Nn+Math.imul(lo,Al)|0,wn=wn+Math.imul(lo,Ml)|0,wn=wn+Math.imul(Eo,Al)|0,zn=zn+Math.imul(Eo,Ml)|0,Nn=Nn+Math.imul(vo,Fl)|0,wn=wn+Math.imul(vo,Sl)|0,wn=wn+Math.imul(go,Fl)|0,zn=zn+Math.imul(go,Sl)|0;var mu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(mu>>>26)|0,mu&=67108863,Nn=Math.imul(Vo,Do),wn=Math.imul(Vo,zo),wn=wn+Math.imul(Fo,Do)|0,zn=Math.imul(Fo,zo),Nn=Nn+Math.imul(No,Ll)|0,wn=wn+Math.imul(No,_l)|0,wn=wn+Math.imul(Uo,Ll)|0,zn=zn+Math.imul(Uo,_l)|0,Nn=Nn+Math.imul(qo,xl)|0,wn=wn+Math.imul(qo,Tl)|0,wn=wn+Math.imul(ga,xl)|0,zn=zn+Math.imul(ga,Tl)|0,Nn=Nn+Math.imul(Lo,Bl)|0,wn=wn+Math.imul(Lo,Il)|0,wn=wn+Math.imul(Wo,Bl)|0,zn=zn+Math.imul(Wo,Il)|0,Nn=Nn+Math.imul(yo,Al)|0,wn=wn+Math.imul(yo,Ml)|0,wn=wn+Math.imul(_o,Al)|0,zn=zn+Math.imul(_o,Ml)|0,Nn=Nn+Math.imul(lo,Fl)|0,wn=wn+Math.imul(lo,Sl)|0,wn=wn+Math.imul(Eo,Fl)|0,zn=zn+Math.imul(Eo,Sl)|0,Nn=Nn+Math.imul(vo,So)|0,wn=wn+Math.imul(vo,Co)|0,wn=wn+Math.imul(go,So)|0,zn=zn+Math.imul(go,Co)|0;var vu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(vu>>>26)|0,vu&=67108863,Nn=Math.imul($a,Do),wn=Math.imul($a,zo),wn=wn+Math.imul(Jo,Do)|0,zn=Math.imul(Jo,zo),Nn=Nn+Math.imul(Vo,Ll)|0,wn=wn+Math.imul(Vo,_l)|0,wn=wn+Math.imul(Fo,Ll)|0,zn=zn+Math.imul(Fo,_l)|0,Nn=Nn+Math.imul(No,xl)|0,wn=wn+Math.imul(No,Tl)|0,wn=wn+Math.imul(Uo,xl)|0,zn=zn+Math.imul(Uo,Tl)|0,Nn=Nn+Math.imul(qo,Bl)|0,wn=wn+Math.imul(qo,Il)|0,wn=wn+Math.imul(ga,Bl)|0,zn=zn+Math.imul(ga,Il)|0,Nn=Nn+Math.imul(Lo,Al)|0,wn=wn+Math.imul(Lo,Ml)|0,wn=wn+Math.imul(Wo,Al)|0,zn=zn+Math.imul(Wo,Ml)|0,Nn=Nn+Math.imul(yo,Fl)|0,wn=wn+Math.imul(yo,Sl)|0,wn=wn+Math.imul(_o,Fl)|0,zn=zn+Math.imul(_o,Sl)|0,Nn=Nn+Math.imul(lo,So)|0,wn=wn+Math.imul(lo,Co)|0,wn=wn+Math.imul(Eo,So)|0,zn=zn+Math.imul(Eo,Co)|0,Nn=Nn+Math.imul(vo,po)|0,wn=wn+Math.imul(vo,Ro)|0,wn=wn+Math.imul(go,po)|0,zn=zn+Math.imul(go,Ro)|0;var fu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(fu>>>26)|0,fu&=67108863,Nn=Math.imul(Cl,Do),wn=Math.imul(Cl,zo),wn=wn+Math.imul(ko,Do)|0,zn=Math.imul(ko,zo),Nn=Nn+Math.imul($a,Ll)|0,wn=wn+Math.imul($a,_l)|0,wn=wn+Math.imul(Jo,Ll)|0,zn=zn+Math.imul(Jo,_l)|0,Nn=Nn+Math.imul(Vo,xl)|0,wn=wn+Math.imul(Vo,Tl)|0,wn=wn+Math.imul(Fo,xl)|0,zn=zn+Math.imul(Fo,Tl)|0,Nn=Nn+Math.imul(No,Bl)|0,wn=wn+Math.imul(No,Il)|0,wn=wn+Math.imul(Uo,Bl)|0,zn=zn+Math.imul(Uo,Il)|0,Nn=Nn+Math.imul(qo,Al)|0,wn=wn+Math.imul(qo,Ml)|0,wn=wn+Math.imul(ga,Al)|0,zn=zn+Math.imul(ga,Ml)|0,Nn=Nn+Math.imul(Lo,Fl)|0,wn=wn+Math.imul(Lo,Sl)|0,wn=wn+Math.imul(Wo,Fl)|0,zn=zn+Math.imul(Wo,Sl)|0,Nn=Nn+Math.imul(yo,So)|0,wn=wn+Math.imul(yo,Co)|0,wn=wn+Math.imul(_o,So)|0,zn=zn+Math.imul(_o,Co)|0,Nn=Nn+Math.imul(lo,po)|0,wn=wn+Math.imul(lo,Ro)|0,wn=wn+Math.imul(Eo,po)|0,zn=zn+Math.imul(Eo,Ro)|0,Nn=Nn+Math.imul(vo,jo)|0,wn=wn+Math.imul(vo,Ko)|0,wn=wn+Math.imul(go,jo)|0,zn=zn+Math.imul(go,Ko)|0;var gu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(gu>>>26)|0,gu&=67108863,Nn=Math.imul(bo,Do),wn=Math.imul(bo,zo),wn=wn+Math.imul(Io,Do)|0,zn=Math.imul(Io,zo),Nn=Nn+Math.imul(Cl,Ll)|0,wn=wn+Math.imul(Cl,_l)|0,wn=wn+Math.imul(ko,Ll)|0,zn=zn+Math.imul(ko,_l)|0,Nn=Nn+Math.imul($a,xl)|0,wn=wn+Math.imul($a,Tl)|0,wn=wn+Math.imul(Jo,xl)|0,zn=zn+Math.imul(Jo,Tl)|0,Nn=Nn+Math.imul(Vo,Bl)|0,wn=wn+Math.imul(Vo,Il)|0,wn=wn+Math.imul(Fo,Bl)|0,zn=zn+Math.imul(Fo,Il)|0,Nn=Nn+Math.imul(No,Al)|0,wn=wn+Math.imul(No,Ml)|0,wn=wn+Math.imul(Uo,Al)|0,zn=zn+Math.imul(Uo,Ml)|0,Nn=Nn+Math.imul(qo,Fl)|0,wn=wn+Math.imul(qo,Sl)|0,wn=wn+Math.imul(ga,Fl)|0,zn=zn+Math.imul(ga,Sl)|0,Nn=Nn+Math.imul(Lo,So)|0,wn=wn+Math.imul(Lo,Co)|0,wn=wn+Math.imul(Wo,So)|0,zn=zn+Math.imul(Wo,Co)|0,Nn=Nn+Math.imul(yo,po)|0,wn=wn+Math.imul(yo,Ro)|0,wn=wn+Math.imul(_o,po)|0,zn=zn+Math.imul(_o,Ro)|0,Nn=Nn+Math.imul(lo,jo)|0,wn=wn+Math.imul(lo,Ko)|0,wn=wn+Math.imul(Eo,jo)|0,zn=zn+Math.imul(Eo,Ko)|0,Nn=Nn+Math.imul(vo,$l)|0,wn=wn+Math.imul(vo,El)|0,wn=wn+Math.imul(go,$l)|0,zn=zn+Math.imul(go,El)|0;var ou=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(ou>>>26)|0,ou&=67108863,Nn=Math.imul(bo,Ll),wn=Math.imul(bo,_l),wn=wn+Math.imul(Io,Ll)|0,zn=Math.imul(Io,_l),Nn=Nn+Math.imul(Cl,xl)|0,wn=wn+Math.imul(Cl,Tl)|0,wn=wn+Math.imul(ko,xl)|0,zn=zn+Math.imul(ko,Tl)|0,Nn=Nn+Math.imul($a,Bl)|0,wn=wn+Math.imul($a,Il)|0,wn=wn+Math.imul(Jo,Bl)|0,zn=zn+Math.imul(Jo,Il)|0,Nn=Nn+Math.imul(Vo,Al)|0,wn=wn+Math.imul(Vo,Ml)|0,wn=wn+Math.imul(Fo,Al)|0,zn=zn+Math.imul(Fo,Ml)|0,Nn=Nn+Math.imul(No,Fl)|0,wn=wn+Math.imul(No,Sl)|0,wn=wn+Math.imul(Uo,Fl)|0,zn=zn+Math.imul(Uo,Sl)|0,Nn=Nn+Math.imul(qo,So)|0,wn=wn+Math.imul(qo,Co)|0,wn=wn+Math.imul(ga,So)|0,zn=zn+Math.imul(ga,Co)|0,Nn=Nn+Math.imul(Lo,po)|0,wn=wn+Math.imul(Lo,Ro)|0,wn=wn+Math.imul(Wo,po)|0,zn=zn+Math.imul(Wo,Ro)|0,Nn=Nn+Math.imul(yo,jo)|0,wn=wn+Math.imul(yo,Ko)|0,wn=wn+Math.imul(_o,jo)|0,zn=zn+Math.imul(_o,Ko)|0,Nn=Nn+Math.imul(lo,$l)|0,wn=wn+Math.imul(lo,El)|0,wn=wn+Math.imul(Eo,$l)|0,zn=zn+Math.imul(Eo,El)|0;var su=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(su>>>26)|0,su&=67108863,Nn=Math.imul(bo,xl),wn=Math.imul(bo,Tl),wn=wn+Math.imul(Io,xl)|0,zn=Math.imul(Io,Tl),Nn=Nn+Math.imul(Cl,Bl)|0,wn=wn+Math.imul(Cl,Il)|0,wn=wn+Math.imul(ko,Bl)|0,zn=zn+Math.imul(ko,Il)|0,Nn=Nn+Math.imul($a,Al)|0,wn=wn+Math.imul($a,Ml)|0,wn=wn+Math.imul(Jo,Al)|0,zn=zn+Math.imul(Jo,Ml)|0,Nn=Nn+Math.imul(Vo,Fl)|0,wn=wn+Math.imul(Vo,Sl)|0,wn=wn+Math.imul(Fo,Fl)|0,zn=zn+Math.imul(Fo,Sl)|0,Nn=Nn+Math.imul(No,So)|0,wn=wn+Math.imul(No,Co)|0,wn=wn+Math.imul(Uo,So)|0,zn=zn+Math.imul(Uo,Co)|0,Nn=Nn+Math.imul(qo,po)|0,wn=wn+Math.imul(qo,Ro)|0,wn=wn+Math.imul(ga,po)|0,zn=zn+Math.imul(ga,Ro)|0,Nn=Nn+Math.imul(Lo,jo)|0,wn=wn+Math.imul(Lo,Ko)|0,wn=wn+Math.imul(Wo,jo)|0,zn=zn+Math.imul(Wo,Ko)|0,Nn=Nn+Math.imul(yo,$l)|0,wn=wn+Math.imul(yo,El)|0,wn=wn+Math.imul(_o,$l)|0,zn=zn+Math.imul(_o,El)|0;var tu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(tu>>>26)|0,tu&=67108863,Nn=Math.imul(bo,Bl),wn=Math.imul(bo,Il),wn=wn+Math.imul(Io,Bl)|0,zn=Math.imul(Io,Il),Nn=Nn+Math.imul(Cl,Al)|0,wn=wn+Math.imul(Cl,Ml)|0,wn=wn+Math.imul(ko,Al)|0,zn=zn+Math.imul(ko,Ml)|0,Nn=Nn+Math.imul($a,Fl)|0,wn=wn+Math.imul($a,Sl)|0,wn=wn+Math.imul(Jo,Fl)|0,zn=zn+Math.imul(Jo,Sl)|0,Nn=Nn+Math.imul(Vo,So)|0,wn=wn+Math.imul(Vo,Co)|0,wn=wn+Math.imul(Fo,So)|0,zn=zn+Math.imul(Fo,Co)|0,Nn=Nn+Math.imul(No,po)|0,wn=wn+Math.imul(No,Ro)|0,wn=wn+Math.imul(Uo,po)|0,zn=zn+Math.imul(Uo,Ro)|0,Nn=Nn+Math.imul(qo,jo)|0,wn=wn+Math.imul(qo,Ko)|0,wn=wn+Math.imul(ga,jo)|0,zn=zn+Math.imul(ga,Ko)|0,Nn=Nn+Math.imul(Lo,$l)|0,wn=wn+Math.imul(Lo,El)|0,wn=wn+Math.imul(Wo,$l)|0,zn=zn+Math.imul(Wo,El)|0;var zl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(zl>>>26)|0,zl&=67108863,Nn=Math.imul(bo,Al),wn=Math.imul(bo,Ml),wn=wn+Math.imul(Io,Al)|0,zn=Math.imul(Io,Ml),Nn=Nn+Math.imul(Cl,Fl)|0,wn=wn+Math.imul(Cl,Sl)|0,wn=wn+Math.imul(ko,Fl)|0,zn=zn+Math.imul(ko,Sl)|0,Nn=Nn+Math.imul($a,So)|0,wn=wn+Math.imul($a,Co)|0,wn=wn+Math.imul(Jo,So)|0,zn=zn+Math.imul(Jo,Co)|0,Nn=Nn+Math.imul(Vo,po)|0,wn=wn+Math.imul(Vo,Ro)|0,wn=wn+Math.imul(Fo,po)|0,zn=zn+Math.imul(Fo,Ro)|0,Nn=Nn+Math.imul(No,jo)|0,wn=wn+Math.imul(No,Ko)|0,wn=wn+Math.imul(Uo,jo)|0,zn=zn+Math.imul(Uo,Ko)|0,Nn=Nn+Math.imul(qo,$l)|0,wn=wn+Math.imul(qo,El)|0,wn=wn+Math.imul(ga,$l)|0,zn=zn+Math.imul(ga,El)|0;var Gl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Gl>>>26)|0,Gl&=67108863,Nn=Math.imul(bo,Fl),wn=Math.imul(bo,Sl),wn=wn+Math.imul(Io,Fl)|0,zn=Math.imul(Io,Sl),Nn=Nn+Math.imul(Cl,So)|0,wn=wn+Math.imul(Cl,Co)|0,wn=wn+Math.imul(ko,So)|0,zn=zn+Math.imul(ko,Co)|0,Nn=Nn+Math.imul($a,po)|0,wn=wn+Math.imul($a,Ro)|0,wn=wn+Math.imul(Jo,po)|0,zn=zn+Math.imul(Jo,Ro)|0,Nn=Nn+Math.imul(Vo,jo)|0,wn=wn+Math.imul(Vo,Ko)|0,wn=wn+Math.imul(Fo,jo)|0,zn=zn+Math.imul(Fo,Ko)|0,Nn=Nn+Math.imul(No,$l)|0,wn=wn+Math.imul(No,El)|0,wn=wn+Math.imul(Uo,$l)|0,zn=zn+Math.imul(Uo,El)|0;var Jl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Jl>>>26)|0,Jl&=67108863,Nn=Math.imul(bo,So),wn=Math.imul(bo,Co),wn=wn+Math.imul(Io,So)|0,zn=Math.imul(Io,Co),Nn=Nn+Math.imul(Cl,po)|0,wn=wn+Math.imul(Cl,Ro)|0,wn=wn+Math.imul(ko,po)|0,zn=zn+Math.imul(ko,Ro)|0,Nn=Nn+Math.imul($a,jo)|0,wn=wn+Math.imul($a,Ko)|0,wn=wn+Math.imul(Jo,jo)|0,zn=zn+Math.imul(Jo,Ko)|0,Nn=Nn+Math.imul(Vo,$l)|0,wn=wn+Math.imul(Vo,El)|0,wn=wn+Math.imul(Fo,$l)|0,zn=zn+Math.imul(Fo,El)|0;var Pl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Pl>>>26)|0,Pl&=67108863,Nn=Math.imul(bo,po),wn=Math.imul(bo,Ro),wn=wn+Math.imul(Io,po)|0,zn=Math.imul(Io,Ro),Nn=Nn+Math.imul(Cl,jo)|0,wn=wn+Math.imul(Cl,Ko)|0,wn=wn+Math.imul(ko,jo)|0,zn=zn+Math.imul(ko,Ko)|0,Nn=Nn+Math.imul($a,$l)|0,wn=wn+Math.imul($a,El)|0,wn=wn+Math.imul(Jo,$l)|0,zn=zn+Math.imul(Jo,El)|0;var Ul=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Ul>>>26)|0,Ul&=67108863,Nn=Math.imul(bo,jo),wn=Math.imul(bo,Ko),wn=wn+Math.imul(Io,jo)|0,zn=Math.imul(Io,Ko),Nn=Nn+Math.imul(Cl,$l)|0,wn=wn+Math.imul(Cl,El)|0,wn=wn+Math.imul(ko,$l)|0,zn=zn+Math.imul(ko,El)|0;var Yl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Yl>>>26)|0,Yl&=67108863,Nn=Math.imul(bo,$l),wn=Math.imul(bo,El),wn=wn+Math.imul(Io,$l)|0,zn=Math.imul(Io,El);var Vl=(Zn+Nn|0)+((wn&8191)<<13)|0;return Zn=(zn+(wn>>>13)|0)+(Vl>>>26)|0,Vl&=67108863,On[0]=Cu,On[1]=iu,On[2]=pu,On[3]=yu,On[4]=hu,On[5]=mu,On[6]=vu,On[7]=fu,On[8]=gu,On[9]=ou,On[10]=su,On[11]=tu,On[12]=zl,On[13]=Gl,On[14]=Jl,On[15]=Pl,On[16]=Ul,On[17]=Yl,On[18]=Vl,Zn!==0&&(On[19]=Zn,Sn.length++),Sn};Math.imul||(An=In);function jn(Tn,Hr,Xr){Xr.negative=Hr.negative^Tn.negative,Xr.length=Tn.length+Hr.length;for(var Sn=0,Rn=0,Pn=0;Pn>>26)|0,Rn+=On>>>26,On&=67108863}Xr.words[Pn]=Zn,Sn=On,On=Rn}return Sn!==0?Xr.words[Pn]=Sn:Xr.length--,Xr._strip()}function eo(Tn,Hr,Xr){return jn(Tn,Hr,Xr)}jr.prototype.mulTo=function(Hr,Xr){var Sn,Rn=this.length+Hr.length;return this.length===10&&Hr.length===10?Sn=An(this,Hr,Xr):Rn<63?Sn=In(this,Hr,Xr):Rn<1024?Sn=jn(this,Hr,Xr):Sn=eo(this,Hr,Xr),Sn},jr.prototype.mul=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),this.mulTo(Hr,Xr)},jr.prototype.mulf=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),eo(this,Hr,Xr)},jr.prototype.imul=function(Hr){return this.clone().mulTo(Hr,this)},jr.prototype.imuln=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(typeof Hr=="number"),Er(Hr<67108864);for(var Sn=0,Rn=0;Rn>=26,Sn+=Pn/67108864|0,Sn+=On>>>26,this.words[Rn]=On&67108863}return Sn!==0&&(this.words[Rn]=Sn,this.length++),Xr?this.ineg():this},jr.prototype.muln=function(Hr){return this.clone().imuln(Hr)},jr.prototype.sqr=function(){return this.mul(this)},jr.prototype.isqr=function(){return this.imul(this.clone())},jr.prototype.pow=function(Hr){var Xr=Cn(Hr);if(Xr.length===0)return new jr(1);for(var Sn=this,Rn=0;Rn=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=67108863>>>26-Xr<<26-Xr,Pn;if(Xr!==0){var On=0;for(Pn=0;Pn>>26-Xr}On&&(this.words[Pn]=On,this.length++)}if(Sn!==0){for(Pn=this.length-1;Pn>=0;Pn--)this.words[Pn+Sn]=this.words[Pn];for(Pn=0;Pn=0);var Rn;Xr?Rn=(Xr-Xr%26)/26:Rn=0;var Pn=Hr%26,On=Math.min((Hr-Pn)/26,this.length),Zn=67108863^67108863>>>Pn<On)for(this.length-=On,wn=0;wn=0&&(zn!==0||wn>=Rn);wn--){var fo=this.words[wn]|0;this.words[wn]=zn<<26-Pn|fo>>>Pn,zn=fo&Zn}return Nn&&zn!==0&&(Nn.words[Nn.length++]=zn),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},jr.prototype.ishrn=function(Hr,Xr,Sn){return Er(this.negative===0),this.iushrn(Hr,Xr,Sn)},jr.prototype.shln=function(Hr){return this.clone().ishln(Hr)},jr.prototype.ushln=function(Hr){return this.clone().iushln(Hr)},jr.prototype.shrn=function(Hr){return this.clone().ishrn(Hr)},jr.prototype.ushrn=function(Hr){return this.clone().iushrn(Hr)},jr.prototype.testn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<=0);var Xr=Hr%26,Sn=(Hr-Xr)/26;if(Er(this.negative===0,"imaskn works only with positive numbers"),this.length<=Sn)return this;if(Xr!==0&&Sn++,this.length=Math.min(Sn,this.length),Xr!==0){var Rn=67108863^67108863>>>Xr<=67108864;Xr++)this.words[Xr]-=67108864,Xr===this.length-1?this.words[Xr+1]=1:this.words[Xr+1]++;return this.length=Math.max(this.length,Xr+1),this},jr.prototype.isubn=function(Hr){if(Er(typeof Hr=="number"),Er(Hr<67108864),Hr<0)return this.iaddn(-Hr);if(this.negative!==0)return this.negative=0,this.iaddn(Hr),this.negative=1,this;if(this.words[0]-=Hr,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Xr=0;Xr>26)-(Nn/67108864|0),this.words[Pn+Sn]=On&67108863}for(;Pn>26,this.words[Pn+Sn]=On&67108863;if(Zn===0)return this._strip();for(Er(Zn===-1),Zn=0,Pn=0;Pn>26,this.words[Pn]=On&67108863;return this.negative=1,this._strip()},jr.prototype._wordDiv=function(Hr,Xr){var Sn=this.length-Hr.length,Rn=this.clone(),Pn=Hr,On=Pn.words[Pn.length-1]|0,Zn=this._countBits(On);Sn=26-Zn,Sn!==0&&(Pn=Pn.ushln(Sn),Rn.iushln(Sn),On=Pn.words[Pn.length-1]|0);var Nn=Rn.length-Pn.length,wn;if(Xr!=="mod"){wn=new jr(null),wn.length=Nn+1,wn.words=new Array(wn.length);for(var zn=0;zn=0;vo--){var go=(Rn.words[Pn.length+vo]|0)*67108864+(Rn.words[Pn.length+vo-1]|0);for(go=Math.min(go/On|0,67108863),Rn._ishlnsubmul(Pn,go,vo);Rn.negative!==0;)go--,Rn.negative=0,Rn._ishlnsubmul(Pn,1,vo),Rn.isZero()||(Rn.negative^=1);wn&&(wn.words[vo]=go)}return wn&&wn._strip(),Rn._strip(),Xr!=="div"&&Sn!==0&&Rn.iushrn(Sn),{div:wn||null,mod:Rn}},jr.prototype.divmod=function(Hr,Xr,Sn){if(Er(!Hr.isZero()),this.isZero())return{div:new jr(0),mod:new jr(0)};var Rn,Pn,On;return this.negative!==0&&Hr.negative===0?(On=this.neg().divmod(Hr,Xr),Xr!=="mod"&&(Rn=On.div.neg()),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.iadd(Hr)),{div:Rn,mod:Pn}):this.negative===0&&Hr.negative!==0?(On=this.divmod(Hr.neg(),Xr),Xr!=="mod"&&(Rn=On.div.neg()),{div:Rn,mod:On.mod}):this.negative&Hr.negative?(On=this.neg().divmod(Hr.neg(),Xr),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.isub(Hr)),{div:On.div,mod:Pn}):Hr.length>this.length||this.cmp(Hr)<0?{div:new jr(0),mod:this}:Hr.length===1?Xr==="div"?{div:this.divn(Hr.words[0]),mod:null}:Xr==="mod"?{div:null,mod:new jr(this.modrn(Hr.words[0]))}:{div:this.divn(Hr.words[0]),mod:new jr(this.modrn(Hr.words[0]))}:this._wordDiv(Hr,Xr)},jr.prototype.div=function(Hr){return this.divmod(Hr,"div",!1).div},jr.prototype.mod=function(Hr){return this.divmod(Hr,"mod",!1).mod},jr.prototype.umod=function(Hr){return this.divmod(Hr,"mod",!0).mod},jr.prototype.divRound=function(Hr){var Xr=this.divmod(Hr);if(Xr.mod.isZero())return Xr.div;var Sn=Xr.div.negative!==0?Xr.mod.isub(Hr):Xr.mod,Rn=Hr.ushrn(1),Pn=Hr.andln(1),On=Sn.cmp(Rn);return On<0||Pn===1&&On===0?Xr.div:Xr.div.negative!==0?Xr.div.isubn(1):Xr.div.iaddn(1)},jr.prototype.modrn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=(1<<26)%Hr,Rn=0,Pn=this.length-1;Pn>=0;Pn--)Rn=(Sn*Rn+(this.words[Pn]|0))%Hr;return Xr?-Rn:Rn},jr.prototype.modn=function(Hr){return this.modrn(Hr)},jr.prototype.idivn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=0,Rn=this.length-1;Rn>=0;Rn--){var Pn=(this.words[Rn]|0)+Sn*67108864;this.words[Rn]=Pn/Hr|0,Sn=Pn%Hr}return this._strip(),Xr?this.ineg():this},jr.prototype.divn=function(Hr){return this.clone().idivn(Hr)},jr.prototype.egcd=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=new jr(0),Zn=new jr(1),Nn=0;Xr.isEven()&&Sn.isEven();)Xr.iushrn(1),Sn.iushrn(1),++Nn;for(var wn=Sn.clone(),zn=Xr.clone();!Xr.isZero();){for(var fo=0,vo=1;!(Xr.words[0]&vo)&&fo<26;++fo,vo<<=1);if(fo>0)for(Xr.iushrn(fo);fo-- >0;)(Rn.isOdd()||Pn.isOdd())&&(Rn.iadd(wn),Pn.isub(zn)),Rn.iushrn(1),Pn.iushrn(1);for(var go=0,uo=1;!(Sn.words[0]&uo)&&go<26;++go,uo<<=1);if(go>0)for(Sn.iushrn(go);go-- >0;)(On.isOdd()||Zn.isOdd())&&(On.iadd(wn),Zn.isub(zn)),On.iushrn(1),Zn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(On),Pn.isub(Zn)):(Sn.isub(Xr),On.isub(Rn),Zn.isub(Pn))}return{a:On,b:Zn,gcd:Sn.iushln(Nn)}},jr.prototype._invmp=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=Sn.clone();Xr.cmpn(1)>0&&Sn.cmpn(1)>0;){for(var Zn=0,Nn=1;!(Xr.words[0]&Nn)&&Zn<26;++Zn,Nn<<=1);if(Zn>0)for(Xr.iushrn(Zn);Zn-- >0;)Rn.isOdd()&&Rn.iadd(On),Rn.iushrn(1);for(var wn=0,zn=1;!(Sn.words[0]&zn)&&wn<26;++wn,zn<<=1);if(wn>0)for(Sn.iushrn(wn);wn-- >0;)Pn.isOdd()&&Pn.iadd(On),Pn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(Pn)):(Sn.isub(Xr),Pn.isub(Rn))}var fo;return Xr.cmpn(1)===0?fo=Rn:fo=Pn,fo.cmpn(0)<0&&fo.iadd(Hr),fo},jr.prototype.gcd=function(Hr){if(this.isZero())return Hr.abs();if(Hr.isZero())return this.abs();var Xr=this.clone(),Sn=Hr.clone();Xr.negative=0,Sn.negative=0;for(var Rn=0;Xr.isEven()&&Sn.isEven();Rn++)Xr.iushrn(1),Sn.iushrn(1);do{for(;Xr.isEven();)Xr.iushrn(1);for(;Sn.isEven();)Sn.iushrn(1);var Pn=Xr.cmp(Sn);if(Pn<0){var On=Xr;Xr=Sn,Sn=On}else if(Pn===0||Sn.cmpn(1)===0)break;Xr.isub(Sn)}while(!0);return Sn.iushln(Rn)},jr.prototype.invm=function(Hr){return this.egcd(Hr).a.umod(Hr)},jr.prototype.isEven=function(){return(this.words[0]&1)===0},jr.prototype.isOdd=function(){return(this.words[0]&1)===1},jr.prototype.andln=function(Hr){return this.words[0]&Hr},jr.prototype.bincn=function(Hr){Er(typeof Hr=="number");var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<>>26,Zn&=67108863,this.words[On]=Zn}return Pn!==0&&(this.words[On]=Pn,this.length++),this},jr.prototype.isZero=function(){return this.length===1&&this.words[0]===0},jr.prototype.cmpn=function(Hr){var Xr=Hr<0;if(this.negative!==0&&!Xr)return-1;if(this.negative===0&&Xr)return 1;this._strip();var Sn;if(this.length>1)Sn=1;else{Xr&&(Hr=-Hr),Er(Hr<=67108863,"Number is too big");var Rn=this.words[0]|0;Sn=Rn===Hr?0:RnHr.length)return 1;if(this.length=0;Sn--){var Rn=this.words[Sn]|0,Pn=Hr.words[Sn]|0;if(Rn!==Pn){RnPn&&(Xr=1);break}}return Xr},jr.prototype.gtn=function(Hr){return this.cmpn(Hr)===1},jr.prototype.gt=function(Hr){return this.cmp(Hr)===1},jr.prototype.gten=function(Hr){return this.cmpn(Hr)>=0},jr.prototype.gte=function(Hr){return this.cmp(Hr)>=0},jr.prototype.ltn=function(Hr){return this.cmpn(Hr)===-1},jr.prototype.lt=function(Hr){return this.cmp(Hr)===-1},jr.prototype.lten=function(Hr){return this.cmpn(Hr)<=0},jr.prototype.lte=function(Hr){return this.cmp(Hr)<=0},jr.prototype.eqn=function(Hr){return this.cmpn(Hr)===0},jr.prototype.eq=function(Hr){return this.cmp(Hr)===0},jr.red=function(Hr){return new so(Hr)},jr.prototype.toRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),Er(this.negative===0,"red works only with positives"),Hr.convertTo(this)._forceRed(Hr)},jr.prototype.fromRed=function(){return Er(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},jr.prototype._forceRed=function(Hr){return this.red=Hr,this},jr.prototype.forceRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),this._forceRed(Hr)},jr.prototype.redAdd=function(Hr){return Er(this.red,"redAdd works only with red numbers"),this.red.add(this,Hr)},jr.prototype.redIAdd=function(Hr){return Er(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Hr)},jr.prototype.redSub=function(Hr){return Er(this.red,"redSub works only with red numbers"),this.red.sub(this,Hr)},jr.prototype.redISub=function(Hr){return Er(this.red,"redISub works only with red numbers"),this.red.isub(this,Hr)},jr.prototype.redShl=function(Hr){return Er(this.red,"redShl works only with red numbers"),this.red.shl(this,Hr)},jr.prototype.redMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.mul(this,Hr)},jr.prototype.redIMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.imul(this,Hr)},jr.prototype.redSqr=function(){return Er(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},jr.prototype.redISqr=function(){return Er(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},jr.prototype.redSqrt=function(){return Er(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},jr.prototype.redInvm=function(){return Er(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},jr.prototype.redNeg=function(){return Er(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},jr.prototype.redPow=function(Hr){return Er(this.red&&!Hr.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Hr)};var ro={k256:null,p224:null,p192:null,p25519:null};function to(Tn,Hr){this.name=Tn,this.p=new jr(Hr,16),this.n=this.p.bitLength(),this.k=new jr(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}to.prototype._tmp=function(){var Hr=new jr(null);return Hr.words=new Array(Math.ceil(this.n/13)),Hr},to.prototype.ireduce=function(Hr){var Xr=Hr,Sn;do this.split(Xr,this.tmp),Xr=this.imulK(Xr),Xr=Xr.iadd(this.tmp),Sn=Xr.bitLength();while(Sn>this.n);var Rn=Sn0?Xr.isub(this.p):Xr.strip!==void 0?Xr.strip():Xr._strip(),Xr},to.prototype.split=function(Hr,Xr){Hr.iushrn(this.n,0,Xr)},to.prototype.imulK=function(Hr){return Hr.imul(this.k)};function _i(){to.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}kr(_i,to),_i.prototype.split=function(Hr,Xr){for(var Sn=4194303,Rn=Math.min(Hr.length,9),Pn=0;Pn>>22,On=Zn}On>>>=22,Hr.words[Pn-10]=On,On===0&&Hr.length>10?Hr.length-=10:Hr.length-=9},_i.prototype.imulK=function(Hr){Hr.words[Hr.length]=0,Hr.words[Hr.length+1]=0,Hr.length+=2;for(var Xr=0,Sn=0;Sn>>=26,Hr.words[Sn]=Pn,Xr=Rn}return Xr!==0&&(Hr.words[Hr.length++]=Xr),Hr},jr._prime=function(Hr){if(ro[Hr])return ro[Hr];var Xr;if(Hr==="k256")Xr=new _i;else if(Hr==="p224")Xr=new oo;else if(Hr==="p192")Xr=new io;else if(Hr==="p25519")Xr=new co;else throw new Error("Unknown prime "+Hr);return ro[Hr]=Xr,Xr};function so(Tn){if(typeof Tn=="string"){var Hr=jr._prime(Tn);this.m=Hr.p,this.prime=Hr}else Er(Tn.gtn(1),"modulus must be greater than 1"),this.m=Tn,this.prime=null}so.prototype._verify1=function(Hr){Er(Hr.negative===0,"red works only with positives"),Er(Hr.red,"red works only with red numbers")},so.prototype._verify2=function(Hr,Xr){Er((Hr.negative|Xr.negative)===0,"red works only with positives"),Er(Hr.red&&Hr.red===Xr.red,"red works only with red numbers")},so.prototype.imod=function(Hr){return this.prime?this.prime.ireduce(Hr)._forceRed(this):(Vr(Hr,Hr.umod(this.m)._forceRed(this)),Hr)},so.prototype.neg=function(Hr){return Hr.isZero()?Hr.clone():this.m.sub(Hr)._forceRed(this)},so.prototype.add=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.add(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn._forceRed(this)},so.prototype.iadd=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.iadd(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn},so.prototype.sub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.sub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn._forceRed(this)},so.prototype.isub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.isub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn},so.prototype.shl=function(Hr,Xr){return this._verify1(Hr),this.imod(Hr.ushln(Xr))},so.prototype.imul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.imul(Xr))},so.prototype.mul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.mul(Xr))},so.prototype.isqr=function(Hr){return this.imul(Hr,Hr.clone())},so.prototype.sqr=function(Hr){return this.mul(Hr,Hr)},so.prototype.sqrt=function(Hr){if(Hr.isZero())return Hr.clone();var Xr=this.m.andln(3);if(Er(Xr%2===1),Xr===3){var Sn=this.m.add(new jr(1)).iushrn(2);return this.pow(Hr,Sn)}for(var Rn=this.m.subn(1),Pn=0;!Rn.isZero()&&Rn.andln(1)===0;)Pn++,Rn.iushrn(1);Er(!Rn.isZero());var On=new jr(1).toRed(this),Zn=On.redNeg(),Nn=this.m.subn(1).iushrn(1),wn=this.m.bitLength();for(wn=new jr(2*wn*wn).toRed(this);this.pow(wn,Nn).cmp(Zn)!==0;)wn.redIAdd(Zn);for(var zn=this.pow(wn,Rn),fo=this.pow(Hr,Rn.addn(1).iushrn(1)),vo=this.pow(Hr,Rn),go=Pn;vo.cmp(On)!==0;){for(var uo=vo,lo=0;uo.cmp(On)!==0;lo++)uo=uo.redSqr();Er(lo=0;Pn--){for(var zn=Xr.words[Pn],fo=wn-1;fo>=0;fo--){var vo=zn>>fo&1;if(On!==Rn[0]&&(On=this.sqr(On)),vo===0&&Zn===0){Nn=0;continue}Zn<<=1,Zn|=vo,Nn++,!(Nn!==Sn&&(Pn!==0||fo!==0))&&(On=this.mul(On,Rn[Zn]),Nn=0,Zn=0)}wn=26}return On},so.prototype.convertTo=function(Hr){var Xr=Hr.umod(this.m);return Xr===Hr?Xr.clone():Xr},so.prototype.convertFrom=function(Hr){var Xr=Hr.clone();return Xr.red=null,Xr},jr.mont=function(Hr){return new no(Hr)};function no(Tn){so.call(this,Tn),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new jr(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}kr(no,so),no.prototype.convertTo=function(Hr){return this.imod(Hr.ushln(this.shift))},no.prototype.convertFrom=function(Hr){var Xr=this.imod(Hr.mul(this.rinv));return Xr.red=null,Xr},no.prototype.imul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return Hr.words[0]=0,Hr.length=1,Hr;var Sn=Hr.imul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.mul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return new jr(0)._forceRed(this);var Sn=Hr.mul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.invm=function(Hr){var Xr=this.imod(Hr._invmp(this.m).mul(this.r2));return Xr._forceRed(this)}})(fr,commonjsGlobal)})(bn$2);var bnExports$2=bn$2.exports,_Buffer$2=safeBufferExports.Buffer;function base$2(fr){if(fr.length>=255)throw new TypeError("Alphabet too long");for(var br=new Uint8Array(256),wr=0;wr>>0,jn=new Uint8Array(An);Cn!==In;){for(var eo=Qr[Cn],ro=0,to=An-1;(eo!==0||ro>>0,jn[to]=eo%Br>>>0,eo=eo/Br>>>0;if(eo!==0)throw new Error("Non-zero carry");En=ro,Cn++}for(var _i=An-En;_i!==An&&jn[_i]===0;)_i++;for(var oo=Wr.repeat(_n);_i>>0,An=new Uint8Array(In);_n>>0,An[ro]=jn%256>>>0,jn=jn/256>>>0;if(jn!==0)throw new Error("Non-zero carry");Cn=eo,_n++}for(var to=In-Cn;to!==In&&An[to]===0;)to++;var _i=_Buffer$2.allocUnsafe(En+(In-to));_i.fill(0,0,En);for(var oo=En;to!==In;)_i[oo++]=An[to++];return _i}function Jr(Qr){var _n=Zr(Qr);if(_n)return _n;throw new Error("Non-base"+Br+" character")}return{encode:Vr,decodeUnsafe:Zr,decode:Jr}}var src$2=base$2,basex$2=src$2,ALPHABET$2="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58$4=basex$2(ALPHABET$2);function inRange(fr,br,wr){return br<=fr&&fr<=wr}function ToDictionary(fr){if(fr===void 0)return{};if(fr===Object(fr))return fr;throw TypeError("Could not convert argument to dictionary")}function stringToCodePoints(fr){for(var br=String(fr),wr=br.length,Er=0,kr=[];Er57343)kr.push(jr);else if(56320<=jr&&jr<=57343)kr.push(65533);else if(55296<=jr&&jr<=56319)if(Er===wr-1)kr.push(65533);else{var Br=fr.charCodeAt(Er+1);if(56320<=Br&&Br<=57343){var Wr=jr&1023,qr=Br&1023;kr.push(65536+(Wr<<10)+qr),Er+=1}else kr.push(65533)}Er+=1}return kr}function codePointsToString(fr){for(var br="",wr=0;wr>10)+55296,(Er&1023)+56320))}return br}var end_of_stream=-1;function Stream(fr){this.tokens=[].slice.call(fr)}Stream.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():end_of_stream},prepend:function(fr){if(Array.isArray(fr))for(var br=fr;br.length;)this.tokens.unshift(br.pop());else this.tokens.unshift(fr)},push:function(fr){if(Array.isArray(fr))for(var br=fr;br.length;)this.tokens.push(br.shift());else this.tokens.push(fr)}};var finished=-1;function decoderError(fr,br){if(fr)throw TypeError("Decoder error");return br||65533}var DEFAULT_ENCODING="utf-8";function TextDecoder$1(fr,br){if(!(this instanceof TextDecoder$1))return new TextDecoder$1(fr,br);if(fr=fr!==void 0?String(fr).toLowerCase():DEFAULT_ENCODING,fr!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");br=ToDictionary(br),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!br.fatal,this._ignoreBOM=!!br.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}TextDecoder$1.prototype={decode:function fr(br,wr){var Er;typeof br=="object"&&br instanceof ArrayBuffer?Er=new Uint8Array(br):typeof br=="object"&&"buffer"in br&&br.buffer instanceof ArrayBuffer?Er=new Uint8Array(br.buffer,br.byteOffset,br.byteLength):Er=new Uint8Array(0),wr=ToDictionary(wr),this._streaming||(this._decoder=new UTF8Decoder({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!wr.stream;for(var kr=new Stream(Er),jr=[],Br;!kr.endOfStream()&&(Br=this._decoder.handler(kr,kr.read()),Br!==finished);)Br!==null&&(Array.isArray(Br)?jr.push.apply(jr,Br):jr.push(Br));if(!this._streaming){do{if(Br=this._decoder.handler(kr,kr.read()),Br===finished)break;Br!==null&&(Array.isArray(Br)?jr.push.apply(jr,Br):jr.push(Br))}while(!kr.endOfStream());this._decoder=null}return jr.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(jr[0]===65279?(this._BOMseen=!0,jr.shift()):this._BOMseen=!0),codePointsToString(jr)}};function TextEncoder$1(fr,br){if(!(this instanceof TextEncoder$1))return new TextEncoder$1(fr,br);if(fr=fr!==void 0?String(fr).toLowerCase():DEFAULT_ENCODING,fr!==DEFAULT_ENCODING)throw new Error("Encoding not supported. Only utf-8 is supported");br=ToDictionary(br),this._streaming=!1,this._encoder=null,this._options={fatal:!!br.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}TextEncoder$1.prototype={encode:function fr(br,wr){br=br?String(br):"",wr=ToDictionary(wr),this._streaming||(this._encoder=new UTF8Encoder(this._options)),this._streaming=!!wr.stream;for(var Er=[],kr=new Stream(stringToCodePoints(br)),jr;!kr.endOfStream()&&(jr=this._encoder.handler(kr,kr.read()),jr!==finished);)Array.isArray(jr)?Er.push.apply(Er,jr):Er.push(jr);if(!this._streaming){for(;jr=this._encoder.handler(kr,kr.read()),jr!==finished;)Array.isArray(jr)?Er.push.apply(Er,jr):Er.push(jr);this._encoder=null}return new Uint8Array(Er)}};function UTF8Decoder(fr){var br=fr.fatal,wr=0,Er=0,kr=0,jr=128,Br=191;this.handler=function(Wr,qr){if(qr===end_of_stream&&kr!==0)return kr=0,decoderError(br);if(qr===end_of_stream)return finished;if(kr===0){if(inRange(qr,0,127))return qr;if(inRange(qr,194,223))kr=1,wr=qr-192;else if(inRange(qr,224,239))qr===224&&(jr=160),qr===237&&(Br=159),kr=2,wr=qr-224;else if(inRange(qr,240,244))qr===240&&(jr=144),qr===244&&(Br=143),kr=3,wr=qr-240;else return decoderError(br);return wr=wr<<6*kr,null}if(!inRange(qr,jr,Br))return wr=kr=Er=0,jr=128,Br=191,Wr.prepend(qr),decoderError(br);if(jr=128,Br=191,Er+=1,wr+=qr-128<<6*(kr-Er),Er!==kr)return null;var Gr=wr;return wr=kr=Er=0,Gr}}function UTF8Encoder(fr){fr.fatal,this.handler=function(br,wr){if(wr===end_of_stream)return finished;if(inRange(wr,0,127))return wr;var Er,kr;inRange(wr,128,2047)?(Er=1,kr=192):inRange(wr,2048,65535)?(Er=2,kr=224):inRange(wr,65536,1114111)&&(Er=3,kr=240);for(var jr=[(wr>>6*Er)+kr];Er>0;){var Br=wr>>6*(Er-1);jr.push(128|Br&63),Er-=1}return jr}}const encoding$1=Object.freeze(Object.defineProperty({__proto__:null,TextDecoder:TextDecoder$1,TextEncoder:TextEncoder$1},Symbol.toStringTag,{value:"Module"})),require$$2=getAugmentedNamespace(encoding$1);var __createBinding=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(fr,br,wr,Er){Er===void 0&&(Er=wr),Object.defineProperty(fr,Er,{enumerable:!0,get:function(){return br[wr]}})}:function(fr,br,wr,Er){Er===void 0&&(Er=wr),fr[Er]=br[wr]}),__setModuleDefault=commonjsGlobal&&commonjsGlobal.__setModuleDefault||(Object.create?function(fr,br){Object.defineProperty(fr,"default",{enumerable:!0,value:br})}:function(fr,br){fr.default=br}),__decorate=commonjsGlobal&&commonjsGlobal.__decorate||function(fr,br,wr,Er){var kr=arguments.length,jr=kr<3?br:Er===null?Er=Object.getOwnPropertyDescriptor(br,wr):Er,Br;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")jr=Reflect.decorate(fr,br,wr,Er);else for(var Wr=fr.length-1;Wr>=0;Wr--)(Br=fr[Wr])&&(jr=(kr<3?Br(jr):kr>3?Br(br,wr,jr):Br(br,wr))||jr);return kr>3&&jr&&Object.defineProperty(br,wr,jr),jr},__importStar=commonjsGlobal&&commonjsGlobal.__importStar||function(fr){if(fr&&fr.__esModule)return fr;var br={};if(fr!=null)for(var wr in fr)wr!=="default"&&Object.hasOwnProperty.call(fr,wr)&&__createBinding(br,fr,wr);return __setModuleDefault(br,fr),br},__importDefault=commonjsGlobal&&commonjsGlobal.__importDefault||function(fr){return fr&&fr.__esModule?fr:{default:fr}};Object.defineProperty(lib,"__esModule",{value:!0});var deserializeUnchecked_1=lib.deserializeUnchecked=deserialize_1=lib.deserialize=serialize_1=lib.serialize=lib.BinaryReader=lib.BinaryWriter=lib.BorshError=lib.baseDecode=lib.baseEncode=void 0;const bn_js_1=__importDefault(bnExports$2),bs58_1=__importDefault(bs58$4),encoding=__importStar(require$$2),ResolvedTextDecoder=typeof TextDecoder!="function"?encoding.TextDecoder:TextDecoder,textDecoder=new ResolvedTextDecoder("utf-8",{fatal:!0});function baseEncode(fr){return typeof fr=="string"&&(fr=Buffer$2.from(fr,"utf8")),bs58_1.default.encode(Buffer$2.from(fr))}lib.baseEncode=baseEncode;function baseDecode(fr){return Buffer$2.from(bs58_1.default.decode(fr))}lib.baseDecode=baseDecode;const INITIAL_LENGTH=1024;class BorshError extends Error{constructor(br){super(br),this.fieldPath=[],this.originalMessage=br}addToFieldPath(br){this.fieldPath.splice(0,0,br),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}lib.BorshError=BorshError;class BinaryWriter{constructor(){this.buf=Buffer$2.alloc(INITIAL_LENGTH),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer$2.concat([this.buf,Buffer$2.alloc(INITIAL_LENGTH)]))}writeU8(br){this.maybeResize(),this.buf.writeUInt8(br,this.length),this.length+=1}writeU16(br){this.maybeResize(),this.buf.writeUInt16LE(br,this.length),this.length+=2}writeU32(br){this.maybeResize(),this.buf.writeUInt32LE(br,this.length),this.length+=4}writeU64(br){this.maybeResize(),this.writeBuffer(Buffer$2.from(new bn_js_1.default(br).toArray("le",8)))}writeU128(br){this.maybeResize(),this.writeBuffer(Buffer$2.from(new bn_js_1.default(br).toArray("le",16)))}writeU256(br){this.maybeResize(),this.writeBuffer(Buffer$2.from(new bn_js_1.default(br).toArray("le",32)))}writeU512(br){this.maybeResize(),this.writeBuffer(Buffer$2.from(new bn_js_1.default(br).toArray("le",64)))}writeBuffer(br){this.buf=Buffer$2.concat([Buffer$2.from(this.buf.subarray(0,this.length)),br,Buffer$2.alloc(INITIAL_LENGTH)]),this.length+=br.length}writeString(br){this.maybeResize();const wr=Buffer$2.from(br,"utf8");this.writeU32(wr.length),this.writeBuffer(wr)}writeFixedArray(br){this.writeBuffer(Buffer$2.from(br))}writeArray(br,wr){this.maybeResize(),this.writeU32(br.length);for(const Er of br)this.maybeResize(),wr(Er)}toArray(){return this.buf.subarray(0,this.length)}}lib.BinaryWriter=BinaryWriter;function handlingRangeError(fr,br,wr){const Er=wr.value;wr.value=function(...kr){try{return Er.apply(this,kr)}catch(jr){if(jr instanceof RangeError){const Br=jr.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(Br)>=0)throw new BorshError("Reached the end of buffer when deserializing")}throw jr}}}class BinaryReader{constructor(br){this.buf=br,this.offset=0}readU8(){const br=this.buf.readUInt8(this.offset);return this.offset+=1,br}readU16(){const br=this.buf.readUInt16LE(this.offset);return this.offset+=2,br}readU32(){const br=this.buf.readUInt32LE(this.offset);return this.offset+=4,br}readU64(){const br=this.readBuffer(8);return new bn_js_1.default(br,"le")}readU128(){const br=this.readBuffer(16);return new bn_js_1.default(br,"le")}readU256(){const br=this.readBuffer(32);return new bn_js_1.default(br,"le")}readU512(){const br=this.readBuffer(64);return new bn_js_1.default(br,"le")}readBuffer(br){if(this.offset+br>this.buf.length)throw new BorshError(`Expected buffer length ${br} isn't within bounds`);const wr=this.buf.slice(this.offset,this.offset+br);return this.offset+=br,wr}readString(){const br=this.readU32(),wr=this.readBuffer(br);try{return textDecoder.decode(wr)}catch(Er){throw new BorshError(`Error decoding UTF-8 string: ${Er}`)}}readFixedArray(br){return new Uint8Array(this.readBuffer(br))}readArray(br){const wr=this.readU32(),Er=Array();for(let kr=0;kr{serializeField(fr,br,jr,Er[0],kr)});else if(Er.kind!==void 0)switch(Er.kind){case"option":{wr==null?kr.writeU8(0):(kr.writeU8(1),serializeField(fr,br,wr,Er.type,kr));break}case"map":{kr.writeU32(wr.size),wr.forEach((jr,Br)=>{serializeField(fr,br,Br,Er.key,kr),serializeField(fr,br,jr,Er.value,kr)});break}default:throw new BorshError(`FieldType ${Er} unrecognized`)}else serializeStruct(fr,wr,kr)}catch(jr){throw jr instanceof BorshError&&jr.addToFieldPath(br),jr}}function serializeStruct(fr,br,wr){if(typeof br.borshSerialize=="function"){br.borshSerialize(wr);return}const Er=fr.get(br.constructor);if(!Er)throw new BorshError(`Class ${br.constructor.name} is missing in schema`);if(Er.kind==="struct")Er.fields.map(([kr,jr])=>{serializeField(fr,kr,br[kr],jr,wr)});else if(Er.kind==="enum"){const kr=br[Er.field];for(let jr=0;jrdeserializeField(fr,br,wr[0],Er))}if(wr.kind==="option")return Er.readU8()?deserializeField(fr,br,wr.type,Er):void 0;if(wr.kind==="map"){let kr=new Map;const jr=Er.readU32();for(let Br=0;Br=Er.values.length)throw new BorshError(`Enum index: ${kr} is out of range`);const[jr,Br]=Er.values[kr],Wr=deserializeField(fr,jr,Br,wr);return new br({[jr]:Wr})}throw new BorshError(`Unexpected schema kind: ${Er.kind} for ${br.constructor.name}`)}function deserialize(fr,br,wr,Er=BinaryReader){const kr=new Er(wr),jr=deserializeStruct(fr,br,kr);if(kr.offsetthis.span)throw new RangeError("indeterminate span");return this.span}replicate(br){const wr=Object.create(this.constructor.prototype);return Object.assign(wr,this),wr.property=br,wr}fromArray(br){}}Layout$1.Layout=Layout;function nameWithProperty(fr,br){return br.property?fr+"["+br.property+"]":fr}Layout$1.nameWithProperty=nameWithProperty;function bindConstructorLayout(fr,br){if(typeof fr!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(fr,"layout_"))throw new Error("Class is already bound to a layout");if(!(br&&br instanceof Layout))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(br,"boundConstructor_"))throw new Error("layout is already bound to a constructor");fr.layout_=br,br.boundConstructor_=fr,br.makeDestinationObject=()=>new fr,Object.defineProperty(fr.prototype,"encode",{value(wr,Er){return br.encode(this,wr,Er)},writable:!0}),Object.defineProperty(fr,"decode",{value(wr,Er){return br.decode(wr,Er)},writable:!0})}Layout$1.bindConstructorLayout=bindConstructorLayout;class ExternalLayout extends Layout{isCount(){throw new Error("ExternalLayout is abstract")}}Layout$1.ExternalLayout=ExternalLayout;class GreedyCount extends ExternalLayout{constructor(br=1,wr){if(!Number.isInteger(br)||0>=br)throw new TypeError("elementSpan must be a (positive) integer");super(-1,wr),this.elementSpan=br}isCount(){return!0}decode(br,wr=0){checkUint8Array(br);const Er=br.length-wr;return Math.floor(Er/this.elementSpan)}encode(br,wr,Er){return 0}}Layout$1.GreedyCount=GreedyCount;class OffsetLayout extends ExternalLayout{constructor(br,wr=0,Er){if(!(br instanceof Layout))throw new TypeError("layout must be a Layout");if(!Number.isInteger(wr))throw new TypeError("offset must be integer or undefined");super(br.span,Er||br.property),this.layout=br,this.offset=wr}isCount(){return this.layout instanceof UInt||this.layout instanceof UIntBE}decode(br,wr=0){return this.layout.decode(br,wr+this.offset)}encode(br,wr,Er=0){return this.layout.encode(br,wr,Er+this.offset)}}Layout$1.OffsetLayout=OffsetLayout;class UInt extends Layout{constructor(br,wr){if(super(br,wr),6Br+kr.encode(Wr,wr,Er+Br),0);return this.count instanceof ExternalLayout&&this.count.encode(br.length,wr,Er),jr}}Layout$1.Sequence=Sequence;class Structure extends Layout{constructor(br,wr,Er){if(!(Array.isArray(br)&&br.reduce((jr,Br)=>jr&&Br instanceof Layout,!0)))throw new TypeError("fields must be array of Layout instances");typeof wr=="boolean"&&Er===void 0&&(Er=wr,wr=void 0);for(const jr of br)if(0>jr.span&&jr.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let kr=-1;try{kr=br.reduce((jr,Br)=>jr+Br.getSpan(),0)}catch{}super(kr,wr),this.fields=br,this.decodePrefixes=!!Er}getSpan(br,wr=0){if(0<=this.span)return this.span;let Er=0;try{Er=this.fields.reduce((kr,jr)=>{const Br=jr.getSpan(br,wr);return wr+=Br,kr+Br},0)}catch{throw new RangeError("indeterminate span")}return Er}decode(br,wr=0){checkUint8Array(br);const Er=this.makeDestinationObject();for(const kr of this.fields)if(kr.property!==void 0&&(Er[kr.property]=kr.decode(br,wr)),wr+=kr.getSpan(br,wr),this.decodePrefixes&&br.length===wr)break;return Er}encode(br,wr,Er=0){const kr=Er;let jr=0,Br=0;for(const Wr of this.fields){let qr=Wr.span;if(Br=0qr&&(qr=Wr.getSpan(wr,Er)))}jr=Er,Er+=qr}return jr+Br-kr}fromArray(br){const wr=this.makeDestinationObject();for(const Er of this.fields)Er.property!==void 0&&0Er.span?wr=-1:0<=wr&&(wr+=Er.span)}}}Layout$1.Structure=Structure;class UnionDiscriminator{constructor(br){this.property=br}decode(br,wr){throw new Error("UnionDiscriminator is abstract")}encode(br,wr,Er){throw new Error("UnionDiscriminator is abstract")}}Layout$1.UnionDiscriminator=UnionDiscriminator;class UnionLayoutDiscriminator extends UnionDiscriminator{constructor(br,wr){if(!(br instanceof ExternalLayout&&br.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(wr||br.property||"variant"),this.layout=br}decode(br,wr){return this.layout.decode(br,wr)}encode(br,wr,Er){return this.layout.encode(br,wr,Er)}}Layout$1.UnionLayoutDiscriminator=UnionLayoutDiscriminator;class Union extends Layout{constructor(br,wr,Er){let kr;if(br instanceof UInt||br instanceof UIntBE)kr=new UnionLayoutDiscriminator(new OffsetLayout(br));else if(br instanceof ExternalLayout&&br.isCount())kr=new UnionLayoutDiscriminator(br);else if(br instanceof UnionDiscriminator)kr=br;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(wr===void 0&&(wr=null),!(wr===null||wr instanceof Layout))throw new TypeError("defaultLayout must be null or a Layout");if(wr!==null){if(0>wr.span)throw new Error("defaultLayout must have constant span");wr.property===void 0&&(wr=wr.replicate("content"))}let jr=-1;wr&&(jr=wr.span,0<=jr&&(br instanceof UInt||br instanceof UIntBE)&&(jr+=kr.layout.span)),super(jr,Er),this.discriminator=kr,this.usesPrefixDiscriminator=br instanceof UInt||br instanceof UIntBE,this.defaultLayout=wr,this.registry={};let Br=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(Wr){return Br(Wr)},this.configGetSourceVariant=function(Wr){Br=Wr.bind(this)}}getSpan(br,wr=0){if(0<=this.span)return this.span;const Er=this.getVariant(br,wr);if(!Er)throw new Error("unable to determine span for unrecognized variant");return Er.getSpan(br,wr)}defaultGetSourceVariant(br){if(Object.prototype.hasOwnProperty.call(br,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(br,this.defaultLayout.property))return;const wr=this.registry[br[this.discriminator.property]];if(wr&&(!wr.layout||wr.property&&Object.prototype.hasOwnProperty.call(br,wr.property)))return wr}else for(const wr in this.registry){const Er=this.registry[wr];if(Er.property&&Object.prototype.hasOwnProperty.call(br,Er.property))return Er}throw new Error("unable to infer src variant")}decode(br,wr=0){let Er;const kr=this.discriminator,jr=kr.decode(br,wr),Br=this.registry[jr];if(Br===void 0){const Wr=this.defaultLayout;let qr=0;this.usesPrefixDiscriminator&&(qr=kr.layout.span),Er=this.makeDestinationObject(),Er[kr.property]=jr,Er[Wr.property]=Wr.decode(br,wr+qr)}else Er=Br.decode(br,wr);return Er}encode(br,wr,Er=0){const kr=this.getSourceVariant(br);if(kr===void 0){const jr=this.discriminator,Br=this.defaultLayout;let Wr=0;return this.usesPrefixDiscriminator&&(Wr=jr.layout.span),jr.encode(br[jr.property],wr,Er),Wr+Br.encode(br[Br.property],wr,Er+Wr)}return kr.encode(br,wr,Er)}addVariant(br,wr,Er){const kr=new VariantLayout(this,br,wr,Er);return this.registry[br]=kr,kr}getVariant(br,wr=0){let Er;return br instanceof Uint8Array?Er=this.discriminator.decode(br,wr):Er=br,this.registry[Er]}}Layout$1.Union=Union;class VariantLayout extends Layout{constructor(br,wr,Er,kr){if(!(br instanceof Union))throw new TypeError("union must be a Union");if(!Number.isInteger(wr)||0>wr)throw new TypeError("variant must be a (non-negative) integer");if(typeof Er=="string"&&kr===void 0&&(kr=Er,Er=null),Er){if(!(Er instanceof Layout))throw new TypeError("layout must be a Layout");if(br.defaultLayout!==null&&0<=Er.span&&Er.span>br.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof kr!="string")throw new TypeError("variant must have a String property")}let jr=br.span;0>br.span&&(jr=Er?Er.span:0,0<=jr&&br.usesPrefixDiscriminator&&(jr+=br.discriminator.layout.span)),super(jr,kr),this.union=br,this.variant=wr,this.layout=Er||null}getSpan(br,wr=0){if(0<=this.span)return this.span;let Er=0;this.union.usesPrefixDiscriminator&&(Er=this.union.discriminator.layout.span);let kr=0;return this.layout&&(kr=this.layout.getSpan(br,wr+Er)),Er+kr}decode(br,wr=0){const Er=this.makeDestinationObject();if(this!==this.union.getVariant(br,wr))throw new Error("variant mismatch");let kr=0;return this.union.usesPrefixDiscriminator&&(kr=this.union.discriminator.layout.span),this.layout?Er[this.property]=this.layout.decode(br,wr+kr):this.property?Er[this.property]=!0:this.union.usesPrefixDiscriminator&&(Er[this.union.discriminator.property]=this.variant),Er}encode(br,wr,Er=0){let kr=0;if(this.union.usesPrefixDiscriminator&&(kr=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(br,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,wr,Er);let jr=kr;if(this.layout&&(this.layout.encode(br[this.property],wr,Er+kr),jr+=this.layout.getSpan(wr,Er+kr),0<=this.union.span&&jr>this.union.span))throw new Error("encoded variant overruns containing union");return jr}fromArray(br){if(this.layout)return this.layout.fromArray(br)}}Layout$1.VariantLayout=VariantLayout;function fixBitwiseResult(fr){return 0>fr&&(fr+=4294967296),fr}class BitStructure extends Layout{constructor(br,wr,Er){if(!(br instanceof UInt||br instanceof UIntBE))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof wr=="string"&&Er===void 0&&(Er=wr,wr=!1),4=wr)throw new TypeError("bits must be positive integer");const kr=8*br.span,jr=br.fields.reduce((Br,Wr)=>Br+Wr.bits,0);if(wr+jr>kr)throw new Error("bits too long for span remainder ("+(kr-jr)+" of "+kr+" remain)");this.container=br,this.bits=wr,this.valueMask=(1<>>this.start}encode(br){if(typeof br!="number"||!Number.isInteger(br)||br!==fixBitwiseResult(br&this.valueMask))throw new TypeError(nameWithProperty("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const wr=this.container._packedGetValue(),Er=fixBitwiseResult(br<Er&&(Er=this.length.decode(br,wr)),Er}decode(br,wr=0){let Er=this.span;return 0>Er&&(Er=this.length.decode(br,wr)),uint8ArrayToBuffer(br).slice(wr,wr+Er)}encode(br,wr,Er){let kr=this.length;if(this.length instanceof ExternalLayout&&(kr=br.length),!(br instanceof Uint8Array&&kr===br.length))throw new TypeError(nameWithProperty("Blob.encode",this)+" requires (length "+kr+") Uint8Array as src");if(Er+kr>wr.length)throw new RangeError("encoding overruns Uint8Array");const jr=uint8ArrayToBuffer(br);return uint8ArrayToBuffer(wr).write(jr.toString("hex"),Er,kr,"hex"),this.length instanceof ExternalLayout&&this.length.encode(kr,wr,Er),kr}};Layout$1.Blob=Blob$1;class CString extends Layout{constructor(br){super(-1,br)}getSpan(br,wr=0){checkUint8Array(br);let Er=wr;for(;Erwr.length)throw new RangeError("encoding overruns Buffer");const Br=uint8ArrayToBuffer(wr);return kr.copy(Br,Er),Br[Er+jr]=0,jr+1}}Layout$1.CString=CString;class UTF8 extends Layout{constructor(br,wr){if(typeof br=="string"&&wr===void 0&&(wr=br,br=void 0),br===void 0)br=-1;else if(!Number.isInteger(br))throw new TypeError("maxSpan must be an integer");super(-1,wr),this.maxSpan=br}getSpan(br,wr=0){return checkUint8Array(br),br.length-wr}decode(br,wr=0){const Er=this.getSpan(br,wr);if(0<=this.maxSpan&&this.maxSpanwr.length)throw new RangeError("encoding overruns Buffer");return kr.copy(uint8ArrayToBuffer(wr),Er),jr}}Layout$1.UTF8=UTF8;class Constant extends Layout{constructor(br,wr){super(0,wr),this.value=br}decode(br,wr){return this.value}encode(br,wr,Er){return 0}}Layout$1.Constant=Constant;Layout$1.greedy=(fr,br)=>new GreedyCount(fr,br);var offset=Layout$1.offset=(fr,br,wr)=>new OffsetLayout(fr,br,wr),u8=Layout$1.u8=fr=>new UInt(1,fr),u16=Layout$1.u16=fr=>new UInt(2,fr);Layout$1.u24=fr=>new UInt(3,fr);var u32=Layout$1.u32=fr=>new UInt(4,fr);Layout$1.u40=fr=>new UInt(5,fr);Layout$1.u48=fr=>new UInt(6,fr);var nu64=Layout$1.nu64=fr=>new NearUInt64(fr);Layout$1.u16be=fr=>new UIntBE(2,fr);Layout$1.u24be=fr=>new UIntBE(3,fr);Layout$1.u32be=fr=>new UIntBE(4,fr);Layout$1.u40be=fr=>new UIntBE(5,fr);Layout$1.u48be=fr=>new UIntBE(6,fr);Layout$1.nu64be=fr=>new NearUInt64BE(fr);Layout$1.s8=fr=>new Int(1,fr);Layout$1.s16=fr=>new Int(2,fr);Layout$1.s24=fr=>new Int(3,fr);Layout$1.s32=fr=>new Int(4,fr);Layout$1.s40=fr=>new Int(5,fr);Layout$1.s48=fr=>new Int(6,fr);var ns64=Layout$1.ns64=fr=>new NearInt64(fr);Layout$1.s16be=fr=>new IntBE(2,fr);Layout$1.s24be=fr=>new IntBE(3,fr);Layout$1.s32be=fr=>new IntBE(4,fr);Layout$1.s40be=fr=>new IntBE(5,fr);Layout$1.s48be=fr=>new IntBE(6,fr);Layout$1.ns64be=fr=>new NearInt64BE(fr);Layout$1.f32=fr=>new Float(fr);Layout$1.f32be=fr=>new FloatBE(fr);Layout$1.f64=fr=>new Double(fr);Layout$1.f64be=fr=>new DoubleBE(fr);var struct=Layout$1.struct=(fr,br,wr)=>new Structure(fr,br,wr);Layout$1.bits=(fr,br,wr)=>new BitStructure(fr,br,wr);var seq=Layout$1.seq=(fr,br,wr)=>new Sequence(fr,br,wr);Layout$1.union=(fr,br,wr)=>new Union(fr,br,wr);Layout$1.unionLayoutDiscriminator=(fr,br)=>new UnionLayoutDiscriminator(fr,br);var blob=Layout$1.blob=(fr,br)=>new Blob$1(fr,br);Layout$1.cstr=fr=>new CString(fr);Layout$1.utf8=(fr,br)=>new UTF8(fr,br);Layout$1.constant=(fr,br)=>new Constant(fr,br);var browser$1={};Object.defineProperty(browser$1,"__esModule",{value:!0});function toBigIntLE(fr){{const br=Buffer$2.from(fr);br.reverse();const wr=br.toString("hex");return wr.length===0?BigInt(0):BigInt(`0x${wr}`)}}var toBigIntLE_1=browser$1.toBigIntLE=toBigIntLE;function toBigIntBE(fr){{const br=fr.toString("hex");return br.length===0?BigInt(0):BigInt(`0x${br}`)}}browser$1.toBigIntBE=toBigIntBE;function toBufferLE(fr,br){{const wr=fr.toString(16),Er=Buffer$2.from(wr.padStart(br*2,"0").slice(0,br*2),"hex");return Er.reverse(),Er}}var toBufferLE_1=browser$1.toBufferLE=toBufferLE;function toBufferBE(fr,br){{const wr=fr.toString(16);return Buffer$2.from(wr.padStart(br*2,"0").slice(0,br*2),"hex")}}browser$1.toBufferBE=toBufferBE;let StructError$2=class extends TypeError{constructor(br,wr){let Er;const{message:kr,explanation:jr,...Br}=br,{path:Wr}=br,qr=Wr.length===0?kr:`At path: ${Wr.join(".")} -- ${kr}`;super(jr??qr),jr!=null&&(this.cause=qr),Object.assign(this,Br),this.name=this.constructor.name,this.failures=()=>Er??(Er=[br,...wr()])}};function isIterable$2(fr){return isObject$2(fr)&&typeof fr[Symbol.iterator]=="function"}function isObject$2(fr){return typeof fr=="object"&&fr!=null}function print$2(fr){return typeof fr=="symbol"?fr.toString():typeof fr=="string"?JSON.stringify(fr):`${fr}`}function shiftIterator$2(fr){const{done:br,value:wr}=fr.next();return br?void 0:wr}function toFailure$2(fr,br,wr,Er){if(fr===!0)return;fr===!1?fr={}:typeof fr=="string"&&(fr={message:fr});const{path:kr,branch:jr}=br,{type:Br}=wr,{refinement:Wr,message:qr=`Expected a value of type \`${Br}\`${Wr?` with refinement \`${Wr}\``:""}, but received: \`${print$2(Er)}\``}=fr;return{value:Er,type:Br,refinement:Wr,key:kr[kr.length-1],path:kr,branch:jr,...fr,message:qr}}function*toFailures$2(fr,br,wr,Er){isIterable$2(fr)||(fr=[fr]);for(const kr of fr){const jr=toFailure$2(kr,br,wr,Er);jr&&(yield jr)}}function*run$2(fr,br,wr={}){const{path:Er=[],branch:kr=[fr],coerce:jr=!1,mask:Br=!1}=wr,Wr={path:Er,branch:kr};if(jr&&(fr=br.coercer(fr,Wr),Br&&br.type!=="type"&&isObject$2(br.schema)&&isObject$2(fr)&&!Array.isArray(fr)))for(const Gr in fr)br.schema[Gr]===void 0&&delete fr[Gr];let qr="valid";for(const Gr of br.validator(fr,Wr))Gr.explanation=wr.message,qr="not_valid",yield[Gr,void 0];for(let[Gr,Vr,Zr]of br.entries(fr,Wr)){const Jr=run$2(Vr,Zr,{path:Gr===void 0?Er:[...Er,Gr],branch:Gr===void 0?kr:[...kr,Vr],coerce:jr,mask:Br,message:wr.message});for(const Qr of Jr)Qr[0]?(qr=Qr[0].refinement!=null?"not_refined":"not_valid",yield[Qr[0],void 0]):jr&&(Vr=Qr[1],Gr===void 0?fr=Vr:fr instanceof Map?fr.set(Gr,Vr):fr instanceof Set?fr.add(Vr):isObject$2(fr)&&(Vr!==void 0||Gr in fr)&&(fr[Gr]=Vr))}if(qr!=="not_valid")for(const Gr of br.refiner(fr,Wr))Gr.explanation=wr.message,qr="not_refined",yield[Gr,void 0];qr==="valid"&&(yield[void 0,fr])}let Struct$5=class{constructor(br){const{type:wr,schema:Er,validator:kr,refiner:jr,coercer:Br=qr=>qr,entries:Wr=function*(){}}=br;this.type=wr,this.schema=Er,this.entries=Wr,this.coercer=Br,kr?this.validator=(qr,Gr)=>{const Vr=kr(qr,Gr);return toFailures$2(Vr,Gr,this,qr)}:this.validator=()=>[],jr?this.refiner=(qr,Gr)=>{const Vr=jr(qr,Gr);return toFailures$2(Vr,Gr,this,qr)}:this.refiner=()=>[]}assert(br,wr){return assert$3(br,this,wr)}create(br,wr){return create$2(br,this,wr)}is(br){return is$2(br,this)}mask(br,wr){return mask$2(br,this,wr)}validate(br,wr={}){return validate$3(br,this,wr)}};function assert$3(fr,br,wr){const Er=validate$3(fr,br,{message:wr});if(Er[0])throw Er[0]}function create$2(fr,br,wr){const Er=validate$3(fr,br,{coerce:!0,message:wr});if(Er[0])throw Er[0];return Er[1]}function mask$2(fr,br,wr){const Er=validate$3(fr,br,{coerce:!0,mask:!0,message:wr});if(Er[0])throw Er[0];return Er[1]}function is$2(fr,br){return!validate$3(fr,br)[0]}function validate$3(fr,br,wr={}){const Er=run$2(fr,br,wr),kr=shiftIterator$2(Er);return kr[0]?[new StructError$2(kr[0],function*(){for(const Br of Er)Br[0]&&(yield Br[0])}),void 0]:[void 0,kr[1]]}function define$2(fr,br){return new Struct$5({type:fr,schema:null,validator:br})}function any$2(){return define$2("any",()=>!0)}function array$2(fr){return new Struct$5({type:"array",schema:fr,*entries(br){if(fr&&Array.isArray(br))for(const[wr,Er]of br.entries())yield[wr,Er,fr]},coercer(br){return Array.isArray(br)?br.slice():br},validator(br){return Array.isArray(br)||`Expected an array value, but received: ${print$2(br)}`}})}function boolean$2(){return define$2("boolean",fr=>typeof fr=="boolean")}function instance$2(fr){return define$2("instance",br=>br instanceof fr||`Expected a \`${fr.name}\` instance, but received: ${print$2(br)}`)}function literal$2(fr){const br=print$2(fr),wr=typeof fr;return new Struct$5({type:"literal",schema:wr==="string"||wr==="number"||wr==="boolean"?fr:null,validator(Er){return Er===fr||`Expected the literal \`${br}\`, but received: ${print$2(Er)}`}})}function never$2(){return define$2("never",()=>!1)}function nullable$2(fr){return new Struct$5({...fr,validator:(br,wr)=>br===null||fr.validator(br,wr),refiner:(br,wr)=>br===null||fr.refiner(br,wr)})}function number$2(){return define$2("number",fr=>typeof fr=="number"&&!isNaN(fr)||`Expected a number, but received: ${print$2(fr)}`)}function optional$2(fr){return new Struct$5({...fr,validator:(br,wr)=>br===void 0||fr.validator(br,wr),refiner:(br,wr)=>br===void 0||fr.refiner(br,wr)})}function record$2(fr,br){return new Struct$5({type:"record",schema:null,*entries(wr){if(isObject$2(wr))for(const Er in wr){const kr=wr[Er];yield[Er,Er,fr],yield[Er,kr,br]}},validator(wr){return isObject$2(wr)||`Expected an object, but received: ${print$2(wr)}`}})}function string$2(){return define$2("string",fr=>typeof fr=="string"||`Expected a string, but received: ${print$2(fr)}`)}function tuple$2(fr){const br=never$2();return new Struct$5({type:"tuple",schema:null,*entries(wr){if(Array.isArray(wr)){const Er=Math.max(fr.length,wr.length);for(let kr=0;krwr.type).join(" | ");return new Struct$5({type:"union",schema:null,coercer(wr){for(const Er of fr){const[kr,jr]=Er.validate(wr,{coerce:!0});if(!kr)return jr}return wr},validator(wr,Er){const kr=[];for(const jr of fr){const[...Br]=run$2(wr,jr,Er),[Wr]=Br;if(Wr[0])for(const[qr]of Br)qr&&kr.push(qr);else return[]}return[`Expected the value to satisfy a union of \`${br}\`, but received: ${print$2(wr)}`,...kr]}})}function unknown$2(){return define$2("unknown",()=>!0)}function coerce$2(fr,br,wr){return new Struct$5({...fr,coercer:(Er,kr)=>is$2(Er,br)?fr.coercer(wr(Er,kr),kr):fr.coercer(Er,kr)})}var getRandomValues,rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}const REGEX=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function validate$2(fr){return typeof fr=="string"&®EX.test(fr)}var byteToHex=[];for(var i=0;i<256;++i)byteToHex.push((i+256).toString(16).substr(1));function stringify$1(fr){var br=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,wr=(byteToHex[fr[br+0]]+byteToHex[fr[br+1]]+byteToHex[fr[br+2]]+byteToHex[fr[br+3]]+"-"+byteToHex[fr[br+4]]+byteToHex[fr[br+5]]+"-"+byteToHex[fr[br+6]]+byteToHex[fr[br+7]]+"-"+byteToHex[fr[br+8]]+byteToHex[fr[br+9]]+"-"+byteToHex[fr[br+10]]+byteToHex[fr[br+11]]+byteToHex[fr[br+12]]+byteToHex[fr[br+13]]+byteToHex[fr[br+14]]+byteToHex[fr[br+15]]).toLowerCase();if(!validate$2(wr))throw TypeError("Stringified UUID is invalid");return wr}var _nodeId,_clockseq,_lastMSecs=0,_lastNSecs=0;function v1(fr,br,wr){var Er=br&&wr||0,kr=br||new Array(16);fr=fr||{};var jr=fr.node||_nodeId,Br=fr.clockseq!==void 0?fr.clockseq:_clockseq;if(jr==null||Br==null){var Wr=fr.random||(fr.rng||rng)();jr==null&&(jr=_nodeId=[Wr[0]|1,Wr[1],Wr[2],Wr[3],Wr[4],Wr[5]]),Br==null&&(Br=_clockseq=(Wr[6]<<8|Wr[7])&16383)}var qr=fr.msecs!==void 0?fr.msecs:Date.now(),Gr=fr.nsecs!==void 0?fr.nsecs:_lastNSecs+1,Vr=qr-_lastMSecs+(Gr-_lastNSecs)/1e4;if(Vr<0&&fr.clockseq===void 0&&(Br=Br+1&16383),(Vr<0||qr>_lastMSecs)&&fr.nsecs===void 0&&(Gr=0),Gr>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");_lastMSecs=qr,_lastNSecs=Gr,_clockseq=Br,qr+=122192928e5;var Zr=((qr&268435455)*1e4+Gr)%4294967296;kr[Er++]=Zr>>>24&255,kr[Er++]=Zr>>>16&255,kr[Er++]=Zr>>>8&255,kr[Er++]=Zr&255;var Jr=qr/4294967296*1e4&268435455;kr[Er++]=Jr>>>8&255,kr[Er++]=Jr&255,kr[Er++]=Jr>>>24&15|16,kr[Er++]=Jr>>>16&255,kr[Er++]=Br>>>8|128,kr[Er++]=Br&255;for(var Qr=0;Qr<6;++Qr)kr[Er+Qr]=jr[Qr];return br||stringify$1(kr)}function parse(fr){if(!validate$2(fr))throw TypeError("Invalid UUID");var br,wr=new Uint8Array(16);return wr[0]=(br=parseInt(fr.slice(0,8),16))>>>24,wr[1]=br>>>16&255,wr[2]=br>>>8&255,wr[3]=br&255,wr[4]=(br=parseInt(fr.slice(9,13),16))>>>8,wr[5]=br&255,wr[6]=(br=parseInt(fr.slice(14,18),16))>>>8,wr[7]=br&255,wr[8]=(br=parseInt(fr.slice(19,23),16))>>>8,wr[9]=br&255,wr[10]=(br=parseInt(fr.slice(24,36),16))/1099511627776&255,wr[11]=br/4294967296&255,wr[12]=br>>>24&255,wr[13]=br>>>16&255,wr[14]=br>>>8&255,wr[15]=br&255,wr}function stringToBytes(fr){fr=unescape(encodeURIComponent(fr));for(var br=[],wr=0;wr>5]>>>kr%32&255,Br=parseInt(Er.charAt(jr>>>4&15)+Er.charAt(jr&15),16);br.push(Br)}return br}function getOutputLength(fr){return(fr+64>>>9<<4)+14+1}function wordsToMd5(fr,br){fr[br>>5]|=128<>5]|=(fr[Er/8]&255)<>16)+(br>>16)+(wr>>16);return Er<<16|wr&65535}function bitRotateLeft(fr,br){return fr<>>32-br}function md5cmn(fr,br,wr,Er,kr,jr){return safeAdd(bitRotateLeft(safeAdd(safeAdd(br,fr),safeAdd(Er,jr)),kr),wr)}function md5ff(fr,br,wr,Er,kr,jr,Br){return md5cmn(br&wr|~br&Er,fr,br,kr,jr,Br)}function md5gg(fr,br,wr,Er,kr,jr,Br){return md5cmn(br&Er|wr&~Er,fr,br,kr,jr,Br)}function md5hh(fr,br,wr,Er,kr,jr,Br){return md5cmn(br^wr^Er,fr,br,kr,jr,Br)}function md5ii(fr,br,wr,Er,kr,jr,Br){return md5cmn(wr^(br|~Er),fr,br,kr,jr,Br)}var v3=v35("v3",48,md5);function v4(fr,br,wr){fr=fr||{};var Er=fr.random||(fr.rng||rng)();if(Er[6]=Er[6]&15|64,Er[8]=Er[8]&63|128,br){wr=wr||0;for(var kr=0;kr<16;++kr)br[wr+kr]=Er[kr];return br}return stringify$1(Er)}function f(fr,br,wr,Er){switch(fr){case 0:return br&wr^~br&Er;case 1:return br^wr^Er;case 2:return br&wr^br&Er^wr&Er;case 3:return br^wr^Er}}function ROTL(fr,br){return fr<>>32-br}function sha1(fr){var br=[1518500249,1859775393,2400959708,3395469782],wr=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof fr=="string"){var Er=unescape(encodeURIComponent(fr));fr=[];for(var kr=0;kr>>0;jn=An,An=In,In=ROTL(Cn,30)>>>0,Cn=En,En=to}wr[0]=wr[0]+En>>>0,wr[1]=wr[1]+Cn>>>0,wr[2]=wr[2]+In>>>0,wr[3]=wr[3]+An>>>0,wr[4]=wr[4]+jn>>>0}return[wr[0]>>24&255,wr[0]>>16&255,wr[0]>>8&255,wr[0]&255,wr[1]>>24&255,wr[1]>>16&255,wr[1]>>8&255,wr[1]&255,wr[2]>>24&255,wr[2]>>16&255,wr[2]>>8&255,wr[2]&255,wr[3]>>24&255,wr[3]>>16&255,wr[3]>>8&255,wr[3]&255,wr[4]>>24&255,wr[4]>>16&255,wr[4]>>8&255,wr[4]&255]}var v5=v35("v5",80,sha1);const nil="00000000-0000-0000-0000-000000000000";function version$5(fr){if(!validate$2(fr))throw TypeError("Invalid UUID");return parseInt(fr.substr(14,1),16)}const esmBrowser=Object.freeze(Object.defineProperty({__proto__:null,NIL:nil,parse,stringify:stringify$1,v1,v3,v4,v5,validate:validate$2,version:version$5},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(esmBrowser),uuid$1=require$$0.v4,generateRequest$1=function(fr,br,wr,Er){if(typeof fr!="string")throw new TypeError(fr+" must be a string");Er=Er||{};const kr=typeof Er.version=="number"?Er.version:2;if(kr!==1&&kr!==2)throw new TypeError(kr+" must be 1 or 2");const jr={method:fr};if(kr===2&&(jr.jsonrpc="2.0"),br){if(typeof br!="object"&&!Array.isArray(br))throw new TypeError(br+" must be an object, array or omitted");jr.params=br}if(typeof wr>"u"){const Br=typeof Er.generator=="function"?Er.generator:function(){return uuid$1()};jr.id=Br(jr,Er)}else kr===2&&wr===null?Er.notificationIdNull&&(jr.id=null):jr.id=wr;return jr};var generateRequest_1=generateRequest$1;const uuid=require$$0.v4,generateRequest=generateRequest_1,ClientBrowser=function(fr,br){if(!(this instanceof ClientBrowser))return new ClientBrowser(fr,br);br||(br={}),this.options={reviver:typeof br.reviver<"u"?br.reviver:null,replacer:typeof br.replacer<"u"?br.replacer:null,generator:typeof br.generator<"u"?br.generator:function(){return uuid()},version:typeof br.version<"u"?br.version:2,notificationIdNull:typeof br.notificationIdNull=="boolean"?br.notificationIdNull:!1},this.callServer=fr};var browser=ClientBrowser;ClientBrowser.prototype.request=function(fr,br,wr,Er){const kr=this;let jr=null;const Br=Array.isArray(fr)&&typeof br=="function";if(this.options.version===1&&Br)throw new TypeError("JSON-RPC 1.0 does not support batching");if(Br||!Br&&fr&&typeof fr=="object"&&typeof br=="function")Er=br,jr=fr;else{typeof wr=="function"&&(Er=wr,wr=void 0);const Gr=typeof Er=="function";try{jr=generateRequest(fr,br,wr,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(Vr){if(Gr)return Er(Vr);throw Vr}if(!Gr)return jr}let qr;try{qr=JSON.stringify(jr,this.options.replacer)}catch(Gr){return Er(Gr)}return this.callServer(qr,function(Gr,Vr){kr._parseResponse(Gr,Vr,Er)}),jr};ClientBrowser.prototype._parseResponse=function(fr,br,wr){if(fr){wr(fr);return}if(!br)return wr();let Er;try{Er=JSON.parse(br,this.options.reviver)}catch(kr){return wr(kr)}if(wr.length===3)if(Array.isArray(Er)){const kr=function(Br){return typeof Br.error<"u"},jr=function(Br){return!kr(Br)};return wr(null,Er.filter(kr),Er.filter(jr))}else return wr(null,Er.error,Er.result);wr(null,Er)};const RpcClient=getDefaultExportFromCjs$2(browser);var client={},eventemitter3={exports:{}};(function(fr){var br=Object.prototype.hasOwnProperty,wr="~";function Er(){}Object.create&&(Er.prototype=Object.create(null),new Er().__proto__||(wr=!1));function kr(qr,Gr,Vr){this.fn=qr,this.context=Gr,this.once=Vr||!1}function jr(qr,Gr,Vr,Zr,Jr){if(typeof Vr!="function")throw new TypeError("The listener must be a function");var Qr=new kr(Vr,Zr||qr,Jr),_n=wr?wr+Gr:Gr;return qr._events[_n]?qr._events[_n].fn?qr._events[_n]=[qr._events[_n],Qr]:qr._events[_n].push(Qr):(qr._events[_n]=Qr,qr._eventsCount++),qr}function Br(qr,Gr){--qr._eventsCount===0?qr._events=new Er:delete qr._events[Gr]}function Wr(){this._events=new Er,this._eventsCount=0}Wr.prototype.eventNames=function(){var Gr=[],Vr,Zr;if(this._eventsCount===0)return Gr;for(Zr in Vr=this._events)br.call(Vr,Zr)&&Gr.push(wr?Zr.slice(1):Zr);return Object.getOwnPropertySymbols?Gr.concat(Object.getOwnPropertySymbols(Vr)):Gr},Wr.prototype.listeners=function(Gr){var Vr=wr?wr+Gr:Gr,Zr=this._events[Vr];if(!Zr)return[];if(Zr.fn)return[Zr.fn];for(var Jr=0,Qr=Zr.length,_n=new Array(Qr);Jr++this.rpc_id),Vr?this.dataPack=Vr:this.dataPack=new utils_cjs_1.DefaultDataPack,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(wr,Er,kr,jr){return!jr&&typeof kr=="object"&&(jr=kr,kr=null),new Promise((Br,Wr)=>{if(!this.ready)return Wr(new Error("socket not ready"));const qr=this.generate_request_id(wr,Er),Gr={jsonrpc:"2.0",method:wr,params:Er||void 0,id:qr};this.socket.send(this.dataPack.encode(Gr),jr,Vr=>{if(Vr)return Wr(Vr);this.queue[qr]={promise:[Br,Wr]},kr&&(this.queue[qr].timeout=setTimeout(()=>{delete this.queue[qr],Wr(new Error("reply timeout"))},kr))})})}async login(wr){const Er=await this.call("rpc.login",wr);if(!Er)throw new Error("authentication failed");return Er}async listMethods(){return await this.call("__listMethods")}notify(wr,Er){return new Promise((kr,jr)=>{if(!this.ready)return jr(new Error("socket not ready"));const Br={jsonrpc:"2.0",method:wr,params:Er};this.socket.send(this.dataPack.encode(Br),Wr=>{if(Wr)return jr(Wr);kr()})})}async subscribe(wr){typeof wr=="string"&&(wr=[wr]);const Er=await this.call("rpc.on",wr);if(typeof wr=="string"&&Er[wr]!=="ok")throw new Error("Failed subscribing to an event '"+wr+"' with: "+Er[wr]);return Er}async unsubscribe(wr){typeof wr=="string"&&(wr=[wr]);const Er=await this.call("rpc.off",wr);if(typeof wr=="string"&&Er[wr]!=="ok")throw new Error("Failed unsubscribing from an event with: "+Er);return Er}close(wr,Er){this.socket.close(wr||1e3,Er)}setAutoReconnect(wr){this.reconnect=wr}setReconnectInterval(wr){this.reconnect_interval=wr}setMaxReconnects(wr){this.max_reconnects=wr}_connect(wr,Er){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(wr,Er),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:kr})=>{kr instanceof ArrayBuffer&&(kr=Buffer$2.from(kr).toString());try{kr=this.dataPack.decode(kr)}catch{return}if(kr.notification&&this.listeners(kr.notification).length){if(!Object.keys(kr.params).length)return this.emit(kr.notification);const jr=[kr.notification];if(kr.params.constructor===Object)jr.push(kr.params);else for(let Br=0;Br{this.emit.apply(this,jr)})}if(!this.queue[kr.id])return kr.method?Promise.resolve().then(()=>{this.emit(kr.method,kr==null?void 0:kr.params)}):void 0;"error"in kr=="result"in kr&&this.queue[kr.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[kr.id].timeout&&clearTimeout(this.queue[kr.id].timeout),kr.error?this.queue[kr.id].promise[1](kr.error):this.queue[kr.id].promise[0](kr.result),delete this.queue[kr.id]}),this.socket.addEventListener("error",kr=>this.emit("error",kr)),this.socket.addEventListener("close",({code:kr,reason:jr})=>{this.ready&&setTimeout(()=>this.emit("close",kr,jr),0),this.ready=!1,this.socket=void 0,kr!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)&&(this.reconnect_timer_id=setTimeout(()=>this._connect(wr,Er),this.reconnect_interval)))})}}var _default$1=client.default=CommonClient,websocket_browser={};Object.defineProperty(websocket_browser,"__esModule",{value:!0});const eventemitter3_1=eventemitter3Exports;class WebSocketBrowserImpl extends eventemitter3_1.EventEmitter{constructor(wr,Er,kr){super();Fu(this,"socket");this.socket=new window.WebSocket(wr,kr),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=jr=>this.emit("message",jr.data),this.socket.onerror=jr=>this.emit("error",jr),this.socket.onclose=jr=>{this.emit("close",jr.code,jr.reason)}}send(wr,Er,kr){const jr=kr||Er;try{this.socket.send(wr),jr()}catch(Br){jr(Br)}}close(wr,Er){this.socket.close(wr,Er)}addEventListener(wr,Er,kr){this.socket.addEventListener(wr,Er,kr)}}function default_1(fr,br){return new WebSocketBrowserImpl(fr,br)}var _default=websocket_browser.default=default_1;function isOnCurve$2(fr){try{return ed25519.ExtendedPoint.fromHex(fr),!0}catch{return!1}}const sign=(fr,br)=>ed25519.sign(fr,br.slice(0,32)),verify=ed25519.verify,toBuffer$2=fr=>Buffer$1$1.isBuffer(fr)?fr:fr instanceof Uint8Array?Buffer$1$1.from(fr.buffer,fr.byteOffset,fr.byteLength):Buffer$1$1.from(fr);let Struct$4=class{constructor(br){Object.assign(this,br)}encode(){return Buffer$1$1.from(serialize_1(SOLANA_SCHEMA$2,this))}static decode(br){return deserialize_1(SOLANA_SCHEMA$2,this,br)}static decodeUnchecked(br){return deserializeUnchecked_1(SOLANA_SCHEMA$2,this,br)}};const SOLANA_SCHEMA$2=new Map;var _PublicKey$2;const MAX_SEED_LENGTH$2=32,PUBLIC_KEY_LENGTH$2=32;function isPublicKeyData$2(fr){return fr._bn!==void 0}let uniquePublicKeyCounter$2=1,PublicKey$2=class hy extends Struct$4{constructor(br){if(super({}),this._bn=void 0,isPublicKeyData$2(br))this._bn=br._bn;else{if(typeof br=="string"){const wr=bs58$6.decode(br);if(wr.length!=PUBLIC_KEY_LENGTH$2)throw new Error("Invalid public key input");this._bn=new BN$2(wr)}else this._bn=new BN$2(br);if(this._bn.byteLength()>PUBLIC_KEY_LENGTH$2)throw new Error("Invalid public key input")}}static unique(){const br=new hy(uniquePublicKeyCounter$2);return uniquePublicKeyCounter$2+=1,new hy(br.toBuffer())}equals(br){return this._bn.eq(br._bn)}toBase58(){return bs58$6.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const br=this.toBuffer();return new Uint8Array(br.buffer,br.byteOffset,br.byteLength)}toBuffer(){const br=this._bn.toArrayLike(Buffer$1$1);if(br.length===PUBLIC_KEY_LENGTH$2)return br;const wr=Buffer$1$1.alloc(32);return br.copy(wr,32-br.length),wr}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(br,wr,Er){const kr=Buffer$1$1.concat([br.toBuffer(),Buffer$1$1.from(wr),Er.toBuffer()]),jr=sha256$4(kr);return new hy(jr)}static createProgramAddressSync(br,wr){let Er=Buffer$1$1.alloc(0);br.forEach(function(jr){if(jr.length>MAX_SEED_LENGTH$2)throw new TypeError("Max seed length exceeded");Er=Buffer$1$1.concat([Er,toBuffer$2(jr)])}),Er=Buffer$1$1.concat([Er,wr.toBuffer(),Buffer$1$1.from("ProgramDerivedAddress")]);const kr=sha256$4(Er);if(isOnCurve$2(kr))throw new Error("Invalid seeds, address must fall off the curve");return new hy(kr)}static async createProgramAddress(br,wr){return this.createProgramAddressSync(br,wr)}static findProgramAddressSync(br,wr){let Er=255,kr;for(;Er!=0;){try{const jr=br.concat(Buffer$1$1.from([Er]));kr=this.createProgramAddressSync(jr,wr)}catch(jr){if(jr instanceof TypeError)throw jr;Er--;continue}return[kr,Er]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(br,wr){return this.findProgramAddressSync(br,wr)}static isOnCurve(br){const wr=new hy(br);return isOnCurve$2(wr.toBytes())}};_PublicKey$2=PublicKey$2;PublicKey$2.default=new _PublicKey$2("11111111111111111111111111111111");SOLANA_SCHEMA$2.set(PublicKey$2,{kind:"struct",fields:[["_bn","u256"]]});new PublicKey$2("BPFLoader1111111111111111111111111111111111");const PACKET_DATA_SIZE=1232,VERSION_PREFIX_MASK=127,SIGNATURE_LENGTH_IN_BYTES$2=64;class TransactionExpiredBlockheightExceededError extends Error{constructor(br){super(`Signature ${br} has expired: block height exceeded.`),this.signature=void 0,this.signature=br}}Object.defineProperty(TransactionExpiredBlockheightExceededError.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class TransactionExpiredTimeoutError extends Error{constructor(br,wr){super(`Transaction was not confirmed in ${wr.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${br} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=br}}Object.defineProperty(TransactionExpiredTimeoutError.prototype,"name",{value:"TransactionExpiredTimeoutError"});class TransactionExpiredNonceInvalidError extends Error{constructor(br){super(`Signature ${br} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=br}}Object.defineProperty(TransactionExpiredNonceInvalidError.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class MessageAccountKeys{constructor(br,wr){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=br,this.accountKeysFromLookups=wr}keySegments(){const br=[this.staticAccountKeys];return this.accountKeysFromLookups&&(br.push(this.accountKeysFromLookups.writable),br.push(this.accountKeysFromLookups.readonly)),br}get(br){for(const wr of this.keySegments()){if(br256)throw new Error("Account index overflow encountered during compilation");const Er=new Map;this.keySegments().flat().forEach((jr,Br)=>{Er.set(jr.toBase58(),Br)});const kr=jr=>{const Br=Er.get(jr.toBase58());if(Br===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return Br};return br.map(jr=>({programIdIndex:kr(jr.programId),accountKeyIndexes:jr.keys.map(Br=>kr(Br.pubkey)),data:jr.data}))}}const publicKey$3=(fr="publicKey")=>blob(32,fr),signature=(fr="signature")=>blob(64,fr),rustString$2=(fr="string")=>{const br=struct([u32("length"),u32("lengthPadding"),blob(offset(u32(),-8),"chars")],fr),wr=br.decode.bind(br),Er=br.encode.bind(br),kr=br;return kr.decode=(jr,Br)=>wr(jr,Br).chars.toString(),kr.encode=(jr,Br,Wr)=>{const qr={chars:Buffer$1$1.from(jr,"utf8")};return Er(qr,Br,Wr)},kr.alloc=jr=>u32().span+u32().span+Buffer$1$1.from(jr,"utf8").length,kr},authorized$2=(fr="authorized")=>struct([publicKey$3("staker"),publicKey$3("withdrawer")],fr),lockup$2=(fr="lockup")=>struct([ns64("unixTimestamp"),ns64("epoch"),publicKey$3("custodian")],fr),voteInit$2=(fr="voteInit")=>struct([publicKey$3("nodePubkey"),publicKey$3("authorizedVoter"),publicKey$3("authorizedWithdrawer"),u8("commission")],fr),voteAuthorizeWithSeedArgs$2=(fr="voteAuthorizeWithSeedArgs")=>struct([u32("voteAuthorizationType"),publicKey$3("currentAuthorityDerivedKeyOwnerPubkey"),rustString$2("currentAuthorityDerivedKeySeed"),publicKey$3("newAuthorized")],fr);function getAlloc(fr,br){const wr=kr=>{if(kr.span>=0)return kr.span;if(typeof kr.alloc=="function")return kr.alloc(br[kr.property]);if("count"in kr&&"elementLayout"in kr){const jr=br[kr.property];if(Array.isArray(jr))return jr.length*wr(kr.elementLayout)}else if("fields"in kr)return getAlloc({layout:kr},br[kr.property]);return 0};let Er=0;return fr.layout.fields.forEach(kr=>{Er+=wr(kr)}),Er}function decodeLength(fr){let br=0,wr=0;for(;;){let Er=fr.shift();if(br|=(Er&127)<>=7,wr==0){fr.push(Er);break}else Er|=128,fr.push(Er)}}function assert$2(fr,br){if(!fr)throw new Error(br||"Assertion failed")}class CompiledKeys{constructor(br,wr){this.payer=void 0,this.keyMetaMap=void 0,this.payer=br,this.keyMetaMap=wr}static compile(br,wr){const Er=new Map,kr=Br=>{const Wr=Br.toBase58();let qr=Er.get(Wr);return qr===void 0&&(qr={isSigner:!1,isWritable:!1,isInvoked:!1},Er.set(Wr,qr)),qr},jr=kr(wr);jr.isSigner=!0,jr.isWritable=!0;for(const Br of br){kr(Br.programId).isInvoked=!0;for(const Wr of Br.keys){const qr=kr(Wr.pubkey);qr.isSigner||(qr.isSigner=Wr.isSigner),qr.isWritable||(qr.isWritable=Wr.isWritable)}}return new CompiledKeys(wr,Er)}getMessageComponents(){const br=[...this.keyMetaMap.entries()];assert$2(br.length<=256,"Max static account keys length exceeded");const wr=br.filter(([,qr])=>qr.isSigner&&qr.isWritable),Er=br.filter(([,qr])=>qr.isSigner&&!qr.isWritable),kr=br.filter(([,qr])=>!qr.isSigner&&qr.isWritable),jr=br.filter(([,qr])=>!qr.isSigner&&!qr.isWritable),Br={numRequiredSignatures:wr.length+Er.length,numReadonlySignedAccounts:Er.length,numReadonlyUnsignedAccounts:jr.length};{assert$2(wr.length>0,"Expected at least one writable signer key");const[qr]=wr[0];assert$2(qr===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const Wr=[...wr.map(([qr])=>new PublicKey$2(qr)),...Er.map(([qr])=>new PublicKey$2(qr)),...kr.map(([qr])=>new PublicKey$2(qr)),...jr.map(([qr])=>new PublicKey$2(qr))];return[Br,Wr]}extractTableLookup(br){const[wr,Er]=this.drainKeysFoundInLookupTable(br.state.addresses,Br=>!Br.isSigner&&!Br.isInvoked&&Br.isWritable),[kr,jr]=this.drainKeysFoundInLookupTable(br.state.addresses,Br=>!Br.isSigner&&!Br.isInvoked&&!Br.isWritable);if(!(wr.length===0&&kr.length===0))return[{accountKey:br.key,writableIndexes:wr,readonlyIndexes:kr},{writable:Er,readonly:jr}]}drainKeysFoundInLookupTable(br,wr){const Er=new Array,kr=new Array;for(const[jr,Br]of this.keyMetaMap.entries())if(wr(Br)){const Wr=new PublicKey$2(jr),qr=br.findIndex(Gr=>Gr.equals(Wr));qr>=0&&(assert$2(qr<256,"Max lookup table index exceeded"),Er.push(qr),kr.push(Wr),this.keyMetaMap.delete(jr))}return[Er,kr]}}const END_OF_BUFFER_ERROR_MESSAGE="Reached end of buffer unexpectedly";function guardedShift(fr){if(fr.length===0)throw new Error(END_OF_BUFFER_ERROR_MESSAGE);return fr.shift()}function guardedSplice(fr,...br){const[wr]=br;if(br.length===2?wr+(br[1]??0)>fr.length:wr>=fr.length)throw new Error(END_OF_BUFFER_ERROR_MESSAGE);return fr.splice(...br)}class Message{constructor(br){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=br.header,this.accountKeys=br.accountKeys.map(wr=>new PublicKey$2(wr)),this.recentBlockhash=br.recentBlockhash,this.instructions=br.instructions,this.instructions.forEach(wr=>this.indexToProgramIds.set(wr.programIdIndex,this.accountKeys[wr.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(br=>({programIdIndex:br.programIdIndex,accountKeyIndexes:br.accounts,data:bs58$6.decode(br.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new MessageAccountKeys(this.staticAccountKeys)}static compile(br){const wr=CompiledKeys.compile(br.instructions,br.payerKey),[Er,kr]=wr.getMessageComponents(),Br=new MessageAccountKeys(kr).compileInstructions(br.instructions).map(Wr=>({programIdIndex:Wr.programIdIndex,accounts:Wr.accountKeyIndexes,data:bs58$6.encode(Wr.data)}));return new Message({header:Er,accountKeys:kr,recentBlockhash:br.recentBlockhash,instructions:Br})}isAccountSigner(br){return br=this.header.numRequiredSignatures){const Er=br-wr,jr=this.accountKeys.length-wr-this.header.numReadonlyUnsignedAccounts;return Er!this.isProgramId(wr))}serialize(){const br=this.accountKeys.length;let wr=[];encodeLength(wr,br);const Er=this.instructions.map(Zr=>{const{accounts:Jr,programIdIndex:Qr}=Zr,_n=Array.from(bs58$6.decode(Zr.data));let En=[];encodeLength(En,Jr.length);let Cn=[];return encodeLength(Cn,_n.length),{programIdIndex:Qr,keyIndicesCount:Buffer$1$1.from(En),keyIndices:Jr,dataLength:Buffer$1$1.from(Cn),data:_n}});let kr=[];encodeLength(kr,Er.length);let jr=Buffer$1$1.alloc(PACKET_DATA_SIZE);Buffer$1$1.from(kr).copy(jr);let Br=kr.length;Er.forEach(Zr=>{const Qr=struct([u8("programIdIndex"),blob(Zr.keyIndicesCount.length,"keyIndicesCount"),seq(u8("keyIndex"),Zr.keyIndices.length,"keyIndices"),blob(Zr.dataLength.length,"dataLength"),seq(u8("userdatum"),Zr.data.length,"data")]).encode(Zr,jr,Br);Br+=Qr}),jr=jr.slice(0,Br);const Wr=struct([blob(1,"numRequiredSignatures"),blob(1,"numReadonlySignedAccounts"),blob(1,"numReadonlyUnsignedAccounts"),blob(wr.length,"keyCount"),seq(publicKey$3("key"),br,"keys"),publicKey$3("recentBlockhash")]),qr={numRequiredSignatures:Buffer$1$1.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Buffer$1$1.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Buffer$1$1.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Buffer$1$1.from(wr),keys:this.accountKeys.map(Zr=>toBuffer$2(Zr.toBytes())),recentBlockhash:bs58$6.decode(this.recentBlockhash)};let Gr=Buffer$1$1.alloc(2048);const Vr=Wr.encode(qr,Gr);return jr.copy(Gr,Vr),Gr.slice(0,Vr+jr.length)}static from(br){let wr=[...br];const Er=guardedShift(wr);if(Er!==(Er&VERSION_PREFIX_MASK))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const kr=guardedShift(wr),jr=guardedShift(wr),Br=decodeLength(wr);let Wr=[];for(let Jr=0;Jr0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new MessageAccountKeys(this.staticAccountKeys,wr)}isAccountSigner(br){return br=Er){const kr=br-Er,jr=this.addressTableLookups.reduce((Br,Wr)=>Br+Wr.writableIndexes.length,0);return kr=this.header.numRequiredSignatures){const kr=br-wr,Br=Er-wr-this.header.numReadonlyUnsignedAccounts;return krjr.key.equals(Er.accountKey));if(!kr)throw new Error(`Failed to find address lookup table account for table key ${Er.accountKey.toBase58()}`);for(const jr of Er.writableIndexes)if(jrVr.toBytes()),recentBlockhash:bs58$6.decode(this.recentBlockhash),instructionsLength:new Uint8Array(Er),serializedInstructions:wr,addressTableLookupsLength:new Uint8Array(jr),serializedAddressTableLookups:kr},Wr);return Wr.slice(0,Gr)}serializeInstructions(){let br=0;const wr=new Uint8Array(PACKET_DATA_SIZE);for(const Er of this.compiledInstructions){const kr=Array();encodeLength(kr,Er.accountKeyIndexes.length);const jr=Array();encodeLength(jr,Er.data.length);const Br=struct([u8("programIdIndex"),blob(kr.length,"encodedAccountKeyIndexesLength"),seq(u8(),Er.accountKeyIndexes.length,"accountKeyIndexes"),blob(jr.length,"encodedDataLength"),blob(Er.data.length,"data")]);br+=Br.encode({programIdIndex:Er.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(kr),accountKeyIndexes:Er.accountKeyIndexes,encodedDataLength:new Uint8Array(jr),data:Er.data},wr,br)}return wr.slice(0,br)}serializeAddressTableLookups(){let br=0;const wr=new Uint8Array(PACKET_DATA_SIZE);for(const Er of this.addressTableLookups){const kr=Array();encodeLength(kr,Er.writableIndexes.length);const jr=Array();encodeLength(jr,Er.readonlyIndexes.length);const Br=struct([publicKey$3("accountKey"),blob(kr.length,"encodedWritableIndexesLength"),seq(u8(),Er.writableIndexes.length,"writableIndexes"),blob(jr.length,"encodedReadonlyIndexesLength"),seq(u8(),Er.readonlyIndexes.length,"readonlyIndexes")]);br+=Br.encode({accountKey:Er.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(kr),writableIndexes:Er.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(jr),readonlyIndexes:Er.readonlyIndexes},wr,br)}return wr.slice(0,br)}static deserialize(br){let wr=[...br];const Er=guardedShift(wr),kr=Er&VERSION_PREFIX_MASK;assert$2(Er!==kr,"Expected versioned message but received legacy message");const jr=kr;assert$2(jr===0,`Expected versioned message with version 0 but found version ${jr}`);const Br={numRequiredSignatures:guardedShift(wr),numReadonlySignedAccounts:guardedShift(wr),numReadonlyUnsignedAccounts:guardedShift(wr)},Wr=[],qr=decodeLength(wr);for(let _n=0;_n{const br=VersionedMessage.deserializeMessageVersion(fr);if(br==="legacy")return Message.from(fr);if(br===0)return MessageV0.deserialize(fr);throw new Error(`Transaction message version ${br} deserialization is not supported`)}};let TransactionStatus=function(fr){return fr[fr.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",fr[fr.PROCESSED=1]="PROCESSED",fr[fr.TIMED_OUT=2]="TIMED_OUT",fr[fr.NONCE_INVALID=3]="NONCE_INVALID",fr}({});const DEFAULT_SIGNATURE=Buffer$1$1.alloc(SIGNATURE_LENGTH_IN_BYTES$2).fill(0);class TransactionInstruction{constructor(br){this.keys=void 0,this.programId=void 0,this.data=Buffer$1$1.alloc(0),this.programId=br.programId,this.keys=br.keys,br.data&&(this.data=br.data)}toJSON(){return{keys:this.keys.map(({pubkey:br,isSigner:wr,isWritable:Er})=>({pubkey:br.toJSON(),isSigner:wr,isWritable:Er})),programId:this.programId.toJSON(),data:[...this.data]}}}class Transaction{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(br){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!br)if(br.feePayer&&(this.feePayer=br.feePayer),br.signatures&&(this.signatures=br.signatures),Object.prototype.hasOwnProperty.call(br,"nonceInfo")){const{minContextSlot:wr,nonceInfo:Er}=br;this.minNonceContextSlot=wr,this.nonceInfo=Er}else if(Object.prototype.hasOwnProperty.call(br,"lastValidBlockHeight")){const{blockhash:wr,lastValidBlockHeight:Er}=br;this.recentBlockhash=wr,this.lastValidBlockHeight=Er}else{const{recentBlockhash:wr,nonceInfo:Er}=br;Er&&(this.nonceInfo=Er),this.recentBlockhash=wr}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(br=>br.toJSON()),signers:this.signatures.map(({publicKey:br})=>br.toJSON())}}add(...br){if(br.length===0)throw new Error("No instructions");return br.forEach(wr=>{"instructions"in wr?this.instructions=this.instructions.concat(wr.instructions):"data"in wr&&"programId"in wr&&"keys"in wr?this.instructions.push(wr):this.instructions.push(new TransactionInstruction(wr))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let br,wr;if(this.nonceInfo?(br=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?wr=[this.nonceInfo.nonceInstruction,...this.instructions]:wr=this.instructions):(br=this.recentBlockhash,wr=this.instructions),!br)throw new Error("Transaction recentBlockhash required");wr.length<1&&console.warn("No instructions provided");let Er;if(this.feePayer)Er=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)Er=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let En=0;En{En.keys.forEach(In=>{jr.push({...In})});const Cn=En.programId.toString();kr.includes(Cn)||kr.push(Cn)}),kr.forEach(En=>{jr.push({pubkey:new PublicKey$2(En),isSigner:!1,isWritable:!1})});const Br=[];jr.forEach(En=>{const Cn=En.pubkey.toString(),In=Br.findIndex(An=>An.pubkey.toString()===Cn);In>-1?(Br[In].isWritable=Br[In].isWritable||En.isWritable,Br[In].isSigner=Br[In].isSigner||En.isSigner):Br.push(En)}),Br.sort(function(En,Cn){if(En.isSigner!==Cn.isSigner)return En.isSigner?-1:1;if(En.isWritable!==Cn.isWritable)return En.isWritable?-1:1;const In={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return En.pubkey.toBase58().localeCompare(Cn.pubkey.toBase58(),"en",In)});const Wr=Br.findIndex(En=>En.pubkey.equals(Er));if(Wr>-1){const[En]=Br.splice(Wr,1);En.isSigner=!0,En.isWritable=!0,Br.unshift(En)}else Br.unshift({pubkey:Er,isSigner:!0,isWritable:!0});for(const En of this.signatures){const Cn=Br.findIndex(In=>In.pubkey.equals(En.publicKey));if(Cn>-1)Br[Cn].isSigner||(Br[Cn].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${En.publicKey.toString()}`)}let qr=0,Gr=0,Vr=0;const Zr=[],Jr=[];Br.forEach(({pubkey:En,isSigner:Cn,isWritable:In})=>{Cn?(Zr.push(En.toString()),qr+=1,In||(Gr+=1)):(Jr.push(En.toString()),In||(Vr+=1))});const Qr=Zr.concat(Jr),_n=wr.map(En=>{const{data:Cn,programId:In}=En;return{programIdIndex:Qr.indexOf(In.toString()),accounts:En.keys.map(An=>Qr.indexOf(An.pubkey.toString())),data:bs58$6.encode(Cn)}});return _n.forEach(En=>{assert$2(En.programIdIndex>=0),En.accounts.forEach(Cn=>assert$2(Cn>=0))}),new Message({header:{numRequiredSignatures:qr,numReadonlySignedAccounts:Gr,numReadonlyUnsignedAccounts:Vr},accountKeys:Qr,recentBlockhash:br,instructions:_n})}_compile(){const br=this.compileMessage(),wr=br.accountKeys.slice(0,br.header.numRequiredSignatures);return this.signatures.length===wr.length&&this.signatures.every((kr,jr)=>wr[jr].equals(kr.publicKey))||(this.signatures=wr.map(Er=>({signature:null,publicKey:Er}))),br}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(br){return(await br.getFeeForMessage(this.compileMessage())).value}setSigners(...br){if(br.length===0)throw new Error("No signers");const wr=new Set;this.signatures=br.filter(Er=>{const kr=Er.toString();return wr.has(kr)?!1:(wr.add(kr),!0)}).map(Er=>({signature:null,publicKey:Er}))}sign(...br){if(br.length===0)throw new Error("No signers");const wr=new Set,Er=[];for(const jr of br){const Br=jr.publicKey.toString();wr.has(Br)||(wr.add(Br),Er.push(jr))}this.signatures=Er.map(jr=>({signature:null,publicKey:jr.publicKey}));const kr=this._compile();this._partialSign(kr,...Er)}partialSign(...br){if(br.length===0)throw new Error("No signers");const wr=new Set,Er=[];for(const jr of br){const Br=jr.publicKey.toString();wr.has(Br)||(wr.add(Br),Er.push(jr))}const kr=this._compile();this._partialSign(kr,...Er)}_partialSign(br,...wr){const Er=br.serialize();wr.forEach(kr=>{const jr=sign(Er,kr.secretKey);this._addSignature(kr.publicKey,toBuffer$2(jr))})}addSignature(br,wr){this._compile(),this._addSignature(br,wr)}_addSignature(br,wr){assert$2(wr.length===64);const Er=this.signatures.findIndex(kr=>br.equals(kr.publicKey));if(Er<0)throw new Error(`unknown signer: ${br.toString()}`);this.signatures[Er].signature=Buffer$1$1.from(wr)}verifySignatures(br=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),br)}_getMessageSignednessErrors(br,wr){const Er={};for(const{signature:kr,publicKey:jr}of this.signatures)kr===null?wr&&(Er.missing||(Er.missing=[])).push(jr):verify(kr,br,jr.toBytes())||(Er.invalid||(Er.invalid=[])).push(jr);return Er.invalid||Er.missing?Er:void 0}serialize(br){const{requireAllSignatures:wr,verifySignatures:Er}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},br),kr=this.serializeMessage();if(Er){const jr=this._getMessageSignednessErrors(kr,wr);if(jr){let Br="Signature verification failed.";throw jr.invalid&&(Br+=` Invalid signature for public key${jr.invalid.length===1?"":"(s)"} [\`${jr.invalid.map(Wr=>Wr.toBase58()).join("`, `")}\`].`),jr.missing&&(Br+=` Missing signature for public key${jr.missing.length===1?"":"(s)"} [\`${jr.missing.map(Wr=>Wr.toBase58()).join("`, `")}\`].`),new Error(Br)}}return this._serialize(kr)}_serialize(br){const{signatures:wr}=this,Er=[];encodeLength(Er,wr.length);const kr=Er.length+wr.length*64+br.length,jr=Buffer$1$1.alloc(kr);return assert$2(wr.length<256),Buffer$1$1.from(Er).copy(jr,0),wr.forEach(({signature:Br},Wr)=>{Br!==null&&(assert$2(Br.length===64,"signature has invalid length"),Buffer$1$1.from(Br).copy(jr,Er.length+Wr*64))}),br.copy(jr,Er.length+wr.length*64),assert$2(jr.length<=PACKET_DATA_SIZE,`Transaction too large: ${jr.length} > ${PACKET_DATA_SIZE}`),jr}get keys(){return assert$2(this.instructions.length===1),this.instructions[0].keys.map(br=>br.pubkey)}get programId(){return assert$2(this.instructions.length===1),this.instructions[0].programId}get data(){return assert$2(this.instructions.length===1),this.instructions[0].data}static from(br){let wr=[...br];const Er=decodeLength(wr);let kr=[];for(let jr=0;jr0&&(Er.feePayer=br.accountKeys[0]),wr.forEach((kr,jr)=>{const Br={signature:kr==bs58$6.encode(DEFAULT_SIGNATURE)?null:bs58$6.decode(kr),publicKey:br.accountKeys[jr]};Er.signatures.push(Br)}),br.instructions.forEach(kr=>{const jr=kr.accounts.map(Br=>{const Wr=br.accountKeys[Br];return{pubkey:Wr,isSigner:Er.signatures.some(qr=>qr.publicKey.toString()===Wr.toString())||br.isAccountSigner(Br),isWritable:br.isAccountWritable(Br)}});Er.instructions.push(new TransactionInstruction({keys:jr,programId:br.accountKeys[kr.programIdIndex],data:bs58$6.decode(kr.data)}))}),Er._message=br,Er._json=Er.toJSON(),Er}}class VersionedTransaction{get version(){return this.message.version}constructor(br,wr){if(this.signatures=void 0,this.message=void 0,wr!==void 0)assert$2(wr.length===br.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=wr;else{const Er=[];for(let kr=0;krBr.equals(kr.publicKey));assert$2(jr>=0,`Cannot sign with non signer key ${kr.publicKey.toBase58()}`),this.signatures[jr]=sign(wr,kr.secretKey)}}addSignature(br,wr){assert$2(wr.byteLength===64,"Signature must be 64 bytes long");const kr=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(jr=>jr.equals(br));assert$2(kr>=0,`Can not add signature; \`${br.toBase58()}\` is not required to sign this transaction`),this.signatures[kr]=wr}}const NUM_TICKS_PER_SECOND=160,DEFAULT_TICKS_PER_SLOT=64,NUM_SLOTS_PER_SECOND=NUM_TICKS_PER_SECOND/DEFAULT_TICKS_PER_SLOT,MS_PER_SLOT=1e3/NUM_SLOTS_PER_SECOND;new PublicKey$2("SysvarC1ock11111111111111111111111111111111");new PublicKey$2("SysvarEpochSchedu1e111111111111111111111111");new PublicKey$2("Sysvar1nstructions1111111111111111111111111");const SYSVAR_RECENT_BLOCKHASHES_PUBKEY=new PublicKey$2("SysvarRecentB1ockHashes11111111111111111111"),SYSVAR_RENT_PUBKEY=new PublicKey$2("SysvarRent111111111111111111111111111111111");new PublicKey$2("SysvarRewards111111111111111111111111111111");new PublicKey$2("SysvarS1otHashes111111111111111111111111111");new PublicKey$2("SysvarS1otHistory11111111111111111111111111");new PublicKey$2("SysvarStakeHistory1111111111111111111111111");class SendTransactionError extends Error{constructor({action:br,signature:wr,transactionMessage:Er,logs:kr}){let jr;switch(br){case"send":jr=`Transaction ${wr} resulted in an error. ${Er}. `+(kr?`Logs: @@ -4200,9 +4204,9 @@ ${JSON.stringify(kr.slice(-10),null,2)}. `:"")+"\nCatch the SendTransactionError `,Cn=En+_n.join(En);console.error(Qr.error.message,Cn)}throw new SendTransactionError({action:"simulate",signature:"",transactionMessage:Qr.error.message,logs:_n})}return Qr.result}async sendTransaction(br,wr,Er){if("version"in br){if(wr&&Array.isArray(wr))throw new Error("Invalid arguments");const Br=br.serialize();return await this.sendRawTransaction(Br,wr)}if(wr===void 0||!Array.isArray(wr))throw new Error("Invalid arguments");const kr=wr;if(br.nonceInfo)br.sign(...kr);else{let Br=this._disableBlockhashCaching;for(;;){const Wr=await this._blockhashWithExpiryBlockHeight(Br);if(br.lastValidBlockHeight=Wr.lastValidBlockHeight,br.recentBlockhash=Wr.blockhash,br.sign(...kr),!br.signature)throw new Error("!signature");const qr=br.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(qr))Br=!0;else{this._blockhashInfo.transactionSignatures.push(qr);break}}}const jr=br.serialize();return await this.sendRawTransaction(jr,Er)}async sendRawTransaction(br,wr){const Er=toBuffer$2(br).toString("base64");return await this.sendEncodedTransaction(Er,wr)}async sendEncodedTransaction(br,wr){const Er={encoding:"base64"},kr=wr&&wr.skipPreflight,jr=kr===!0?"processed":wr&&wr.preflightCommitment||this.commitment;wr&&wr.maxRetries!=null&&(Er.maxRetries=wr.maxRetries),wr&&wr.minContextSlot!=null&&(Er.minContextSlot=wr.minContextSlot),kr&&(Er.skipPreflight=kr),jr&&(Er.preflightCommitment=jr);const Br=[br,Er],Wr=await this._rpcRequest("sendTransaction",Br),qr=create$2(Wr,SendTransactionRpcResult);if("error"in qr){let Gr;throw"data"in qr.error&&(Gr=qr.error.data.logs),new SendTransactionError({action:kr?"send":"simulate",signature:"",transactionMessage:qr.error.message,logs:Gr})}return qr.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(br){this._rpcWebSocketConnected=!1,console.error("ws error:",br.message)}_wsOnClose(br){if(this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),br===1e3){this._updateSubscriptions();return}this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([wr,Er])=>{this._setSubscription(wr,{...Er,state:"pending"})})}_setSubscription(br,wr){var kr;const Er=(kr=this._subscriptionsByHash[br])==null?void 0:kr.state;if(this._subscriptionsByHash[br]=wr,Er!==wr.state){const jr=this._subscriptionStateChangeCallbacksByHash[br];jr&&jr.forEach(Br=>{try{Br(wr.state)}catch{}})}}_onSubscriptionStateChange(br,wr){var jr;const Er=this._subscriptionHashByClientSubscriptionId[br];if(Er==null)return()=>{};const kr=(jr=this._subscriptionStateChangeCallbacksByHash)[Er]||(jr[Er]=new Set);return kr.add(wr),()=>{kr.delete(wr),kr.size===0&&delete this._subscriptionStateChangeCallbacksByHash[Er]}}async _updateSubscriptions(){if(Object.keys(this._subscriptionsByHash).length===0){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(Er){Er instanceof Error&&console.log(`Error when closing socket connection: ${Er.message}`)}},500));return}if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected){this._rpcWebSocket.connect();return}const br=this._rpcWebSocketGeneration,wr=()=>br===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async Er=>{const kr=this._subscriptionsByHash[Er];if(kr!==void 0)switch(kr.state){case"pending":case"unsubscribed":if(kr.callbacks.size===0){delete this._subscriptionsByHash[Er],kr.state==="unsubscribed"&&delete this._subscriptionCallbacksByServerSubscriptionId[kr.serverSubscriptionId],await this._updateSubscriptions();return}await(async()=>{const{args:jr,method:Br}=kr;try{this._setSubscription(Er,{...kr,state:"subscribing"});const Wr=await this._rpcWebSocket.call(Br,jr);this._setSubscription(Er,{...kr,serverSubscriptionId:Wr,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[Wr]=kr.callbacks,await this._updateSubscriptions()}catch(Wr){if(Wr instanceof Error&&console.error(`${Br} error for argument`,jr,Wr.message),!wr())return;this._setSubscription(Er,{...kr,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":kr.callbacks.size===0&&await(async()=>{const{serverSubscriptionId:jr,unsubscribeMethod:Br}=kr;if(this._subscriptionsAutoDisposedByRpc.has(jr))this._subscriptionsAutoDisposedByRpc.delete(jr);else{this._setSubscription(Er,{...kr,state:"unsubscribing"}),this._setSubscription(Er,{...kr,state:"unsubscribing"});try{await this._rpcWebSocket.call(Br,[jr])}catch(Wr){if(Wr instanceof Error&&console.error(`${Br} error:`,Wr.message),!wr())return;this._setSubscription(Er,{...kr,state:"subscribed"}),await this._updateSubscriptions();return}}this._setSubscription(Er,{...kr,state:"unsubscribed"}),await this._updateSubscriptions()})();break}}))}_handleServerNotification(br,wr){const Er=this._subscriptionCallbacksByServerSubscriptionId[br];Er!==void 0&&Er.forEach(kr=>{try{kr(...wr)}catch(jr){console.error(jr)}})}_wsOnAccountNotification(br){const{result:wr,subscription:Er}=create$2(br,AccountNotificationResult);this._handleServerNotification(Er,[wr.value,wr.context])}_makeSubscription(br,wr){const Er=this._nextClientSubscriptionId++,kr=fastStableStringify$1([br.method,wr]),jr=this._subscriptionsByHash[kr];return jr===void 0?this._subscriptionsByHash[kr]={...br,args:wr,callbacks:new Set([br.callback]),state:"pending"}:jr.callbacks.add(br.callback),this._subscriptionHashByClientSubscriptionId[Er]=kr,this._subscriptionDisposeFunctionsByClientSubscriptionId[Er]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[Er],delete this._subscriptionHashByClientSubscriptionId[Er];const Br=this._subscriptionsByHash[kr];assert$2(Br!==void 0,`Could not find a \`Subscription\` when tearing down client subscription #${Er}`),Br.callbacks.delete(br.callback),await this._updateSubscriptions()},this._updateSubscriptions(),Er}onAccountChange(br,wr,Er){const kr=this._buildArgs([br.toBase58()],Er||this._commitment||"finalized","base64");return this._makeSubscription({callback:wr,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},kr)}async removeAccountChangeListener(br){await this._unsubscribeClientSubscription(br,"account change")}_wsOnProgramAccountNotification(br){const{result:wr,subscription:Er}=create$2(br,ProgramAccountNotificationResult);this._handleServerNotification(Er,[{accountId:wr.value.pubkey,accountInfo:wr.value.account},wr.context])}onProgramAccountChange(br,wr,Er,kr){const jr=this._buildArgs([br.toBase58()],Er||this._commitment||"finalized","base64",kr?{filters:kr}:void 0);return this._makeSubscription({callback:wr,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},jr)}async removeProgramAccountChangeListener(br){await this._unsubscribeClientSubscription(br,"program account change")}onLogs(br,wr,Er){const kr=this._buildArgs([typeof br=="object"?{mentions:[br.toString()]}:br],Er||this._commitment||"finalized");return this._makeSubscription({callback:wr,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},kr)}async removeOnLogsListener(br){await this._unsubscribeClientSubscription(br,"logs")}_wsOnLogsNotification(br){const{result:wr,subscription:Er}=create$2(br,LogsNotificationResult);this._handleServerNotification(Er,[wr.value,wr.context])}_wsOnSlotNotification(br){const{result:wr,subscription:Er}=create$2(br,SlotNotificationResult);this._handleServerNotification(Er,[wr])}onSlotChange(br){return this._makeSubscription({callback:br,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(br){await this._unsubscribeClientSubscription(br,"slot change")}_wsOnSlotUpdatesNotification(br){const{result:wr,subscription:Er}=create$2(br,SlotUpdateNotificationResult);this._handleServerNotification(Er,[wr])}onSlotUpdate(br){return this._makeSubscription({callback:br,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(br){await this._unsubscribeClientSubscription(br,"slot update")}async _unsubscribeClientSubscription(br,wr){const Er=this._subscriptionDisposeFunctionsByClientSubscriptionId[br];Er?await Er():console.warn(`Ignored unsubscribe request because an active subscription with id \`${br}\` for '${wr}' events could not be found.`)}_buildArgs(br,wr,Er,kr){const jr=wr||this._commitment;if(jr||Er||kr){let Br={};Er&&(Br.encoding=Er),jr&&(Br.commitment=jr),kr&&(Br=Object.assign(Br,kr)),br.push(Br)}return br}_buildArgsAtLeastConfirmed(br,wr,Er,kr){const jr=wr||this._commitment;if(jr&&!["confirmed","finalized"].includes(jr))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(br,wr,Er,kr)}_wsOnSignatureNotification(br){const{result:wr,subscription:Er}=create$2(br,SignatureNotificationResult);wr.value!=="receivedSignature"&&this._subscriptionsAutoDisposedByRpc.add(Er),this._handleServerNotification(Er,wr.value==="receivedSignature"?[{type:"received"},wr.context]:[{type:"status",result:wr.value},wr.context])}onSignature(br,wr,Er){const kr=this._buildArgs([br],Er||this._commitment||"finalized"),jr=this._makeSubscription({callback:(Br,Wr)=>{if(Br.type==="status"){wr(Br.result,Wr);try{this.removeSignatureListener(jr)}catch{}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},kr);return jr}onSignatureWithOptions(br,wr,Er){const{commitment:kr,...jr}={...Er,commitment:Er&&Er.commitment||this._commitment||"finalized"},Br=this._buildArgs([br],kr,void 0,jr),Wr=this._makeSubscription({callback:(qr,Gr)=>{wr(qr,Gr);try{this.removeSignatureListener(Wr)}catch{}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},Br);return Wr}async removeSignatureListener(br){await this._unsubscribeClientSubscription(br,"signature result")}_wsOnRootNotification(br){const{result:wr,subscription:Er}=create$2(br,RootNotificationResult);this._handleServerNotification(Er,[wr])}onRootChange(br){return this._makeSubscription({callback:br,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(br){await this._unsubscribeClientSubscription(br,"root change")}}Object.freeze({CreateLookupTable:{index:0,layout:struct([u32("instruction"),u64$3("recentSlot"),u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:struct([u32("instruction")])},ExtendLookupTable:{index:2,layout:struct([u32("instruction"),u64$3(),seq(publicKey$3(),offset(u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:struct([u32("instruction")])},CloseLookupTable:{index:4,layout:struct([u32("instruction")])}});new PublicKey$2("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:struct([u8("instruction"),u32("units"),u32("additionalFee")])},RequestHeapFrame:{index:1,layout:struct([u8("instruction"),u32("bytes")])},SetComputeUnitLimit:{index:2,layout:struct([u8("instruction"),u32("units")])},SetComputeUnitPrice:{index:3,layout:struct([u8("instruction"),u64$3("microLamports")])}});new PublicKey$2("ComputeBudget111111111111111111111111111111");struct([u8("numSignatures"),u8("padding"),u16("signatureOffset"),u16("signatureInstructionIndex"),u16("publicKeyOffset"),u16("publicKeyInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u16("messageInstructionIndex")]);new PublicKey$2("Ed25519SigVerify111111111111111111111111111");secp256k1$1.utils.isValidPrivateKey;secp256k1$1.getPublicKey;struct([u8("numSignatures"),u16("signatureOffset"),u8("signatureInstructionIndex"),u16("ethAddressOffset"),u8("ethAddressInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u8("messageInstructionIndex"),blob(20,"ethAddress"),blob(64,"signature"),u8("recoveryId")]);new PublicKey$2("KeccakSecp256k11111111111111111111111111111");var _Lockup$2;new PublicKey$2("StakeConfig11111111111111111111111111111111");let Lockup$2=class{constructor(br,wr,Er){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=br,this.epoch=wr,this.custodian=Er}};_Lockup$2=Lockup$2;Lockup$2.default=new _Lockup$2(0,0,PublicKey$2.default);Object.freeze({Initialize:{index:0,layout:struct([u32("instruction"),authorized$2(),lockup$2()])},Authorize:{index:1,layout:struct([u32("instruction"),publicKey$3("newAuthorized"),u32("stakeAuthorizationType")])},Delegate:{index:2,layout:struct([u32("instruction")])},Split:{index:3,layout:struct([u32("instruction"),ns64("lamports")])},Withdraw:{index:4,layout:struct([u32("instruction"),ns64("lamports")])},Deactivate:{index:5,layout:struct([u32("instruction")])},Merge:{index:7,layout:struct([u32("instruction")])},AuthorizeWithSeed:{index:8,layout:struct([u32("instruction"),publicKey$3("newAuthorized"),u32("stakeAuthorizationType"),rustString$2("authoritySeed"),publicKey$3("authorityOwner")])}});new PublicKey$2("Stake11111111111111111111111111111111111111");Object.freeze({InitializeAccount:{index:0,layout:struct([u32("instruction"),voteInit$2()])},Authorize:{index:1,layout:struct([u32("instruction"),publicKey$3("newAuthorized"),u32("voteAuthorizationType")])},Withdraw:{index:3,layout:struct([u32("instruction"),ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:struct([u32("instruction")])},AuthorizeWithSeed:{index:10,layout:struct([u32("instruction"),voteAuthorizeWithSeedArgs$2()])}});new PublicKey$2("Vote111111111111111111111111111111111111111");new PublicKey$2("Va1idator1nfo111111111111111111111111111111");type$2({name:string$2(),website:optional$2(string$2()),details:optional$2(string$2()),keybaseUsername:optional$2(string$2())});new PublicKey$2("Vote111111111111111111111111111111111111111");struct([publicKey$3("nodePubkey"),publicKey$3("authorizedWithdrawer"),u8("commission"),nu64(),seq(struct([nu64("slot"),u32("confirmationCount")]),offset(u32(),-8),"votes"),u8("rootSlotValid"),nu64("rootSlot"),nu64(),seq(struct([nu64("epoch"),publicKey$3("authorizedVoter")]),offset(u32(),-8),"authorizedVoters"),struct([seq(struct([publicKey$3("authorizedPubkey"),nu64("epochOfLastAuthorizedSwitch"),nu64("targetEpoch")]),32,"buf"),nu64("idx"),u8("isEmpty")],"priorVoters"),nu64(),seq(struct([nu64("epoch"),nu64("credits"),nu64("prevCredits")]),offset(u32(),-8),"epochCredits"),struct([nu64("slot"),nu64("timestamp")],"lastTimestamp")]);const LAMPORTS_PER_SOL$2=1e9;let SolanaWallet$1=class extends Wallet$2{getConnection(){return __awaiter$4(this,void 0,void 0,function*(){return this._connector.getWalletClient()})}getSigner(){return __awaiter$4(this,void 0,void 0,function*(){const br=yield this._connector.getSigner();if(!br)throw new Error("unable to retrieve Solana signer");try{return cloneObjectWithOverrides(br,{signAllTransactions:wr=>__awaiter$4(this,void 0,void 0,function*(){return yield this.sync(),br.signAllTransactions(wr)}),signAndSendTransaction:(wr,...Er)=>__awaiter$4(this,void 0,void 0,function*(){return yield this.sync(),br.signAndSendTransaction(wr,...Er)}),signMessage:(wr,...Er)=>__awaiter$4(this,void 0,void 0,function*(){return yield this.sync(),br.signMessage(wr,...Er)}),signTransaction:wr=>__awaiter$4(this,void 0,void 0,function*(){return yield this.sync(),br.signTransaction(wr)})})}catch(wr){return logger$7.warn(`Failed to add logic to auto-sync the wallet. Signer might be out of sync for wallet: ${this._connector.name} (${this.address})`,wr),br}})}};const extractNonce=fr=>{const br=fr.match(/Nonce: (.*)/);if(br&&br.length===2)return br[1]},SOLANA_GENESIS_HASH$1="genesis-hash",getGenesisHashLSKey$1=fr=>`${fr}_${SOLANA_GENESIS_HASH$1}`,MEMO_PROGRAM_ID=new PublicKey$2("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");class SolanaWalletConnector extends WalletConnectorBase{constructor(br){var wr;super(br),this.isHardwareWalletEnabled=!1,this.verifiedCredentials=[],this.ChainWallet=SolanaWallet$1,this.supportedChains=["SOL"],this.connectedChain="SOL",this.solNetworks=br.solNetworks,this.chainRpcProviders=br.chainRpcProviders,this.connectionConfig=br.connectionConfig,(wr=this.chainRpcProviders)===null||wr===void 0||wr.registerSolanaProviders(this.connectionConfig)}getNetwork(){return __awaiter$4(this,void 0,void 0,function*(){const br=this.getWalletClient();let wr=localStorage.getItem(getGenesisHashLSKey$1(br.rpcEndpoint));wr||(wr=yield br.getGenesisHash(),localStorage.setItem(getGenesisHashLSKey$1(br.rpcEndpoint),wr)),wr=wr.substring(0,32);let Er;return wr==="5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"?Er="mainnet":wr==="EtWTRABZaYq6iMfeYKouRu166VU2xqa1"?Er="devnet":Er="testnet",Er})}endSession(){return __awaiter$4(this,void 0,void 0,function*(){localStorage.removeItem(getGenesisHashLSKey$1(this.getWalletClient().rpcEndpoint))})}getWalletClient(){var br,wr;const[Er]=this.solNetworks;if(!Er)throw new DynamicError("No enabled networks");const kr=((br=Er.privateCustomerRpcUrls)===null||br===void 0?void 0:br[0])||Er.rpcUrls[0];return new Connection(kr,(wr=this.connectionConfig)!==null&&wr!==void 0?wr:"confirmed")}getPublicClient(){return __awaiter$4(this,void 0,void 0,function*(){var br;if(this.solNetworks.length===0)return;const wr={cosmos:[],evm:void 0,solana:this.solNetworks,starknet:void 0};if(!this.chainRpcProviders)return;const Er=this.chainRpcProviders.getProviders(wr);return(br=this.chainRpcProviders.getSolanaProviderByChainId(Er,"101"))===null||br===void 0?void 0:br.provider})}getBalance(br){return __awaiter$4(this,void 0,void 0,function*(){const wr=new PublicKey$2(br);return this.lamportsToSol(yield this.getWalletClient().getBalance(wr)).toString()})}lamportsToSol(br){return br/1e9}canConnectWithHardwareWallet(){const br=findWalletBookWallet(this.walletBook,this.key);return!br||!br.hardwareWallets?!1:br.hardwareWallets.includes("ledger")}signMessage(br){const wr=Object.create(null,{signMessage:{get:()=>super.signMessage}});return __awaiter$4(this,void 0,void 0,function*(){if(this.isHardwareWalletEnabled)throw new NotSupportedError(`Message signing is currently not supported on ${this.name} hardware wallet. You can use signMessageViaTransaction instead to achieve similar functionality by signing a transaction with a memo instruction. - You can read more about it here https://github.com/solana-labs/solana/issues/21366`);return wr.signMessage.call(this,br)})}proveOwnership(br,wr){const Er=Object.create(null,{proveOwnership:{get:()=>super.proveOwnership}});return __awaiter$4(this,void 0,void 0,function*(){if(yield this.validateActiveWallet(br),this.isHardwareWalletEnabled){const kr=extractNonce(wr);if(!kr)throw new DynamicError("Nonce missing");return this.signMessageViaTransaction(kr)}return Er.proveOwnership.call(this,br,wr)})}signMessageViaTransaction(br){return __awaiter$4(this,void 0,void 0,function*(){const wr=yield this.getAddress();if(!wr)throw new DynamicError("Address missing");const Er=this.buildAuthTx(br);Er.feePayer=new PublicKey$2(wr),Er.recentBlockhash=(yield this.getWalletClient().getLatestBlockhash()).blockhash;const kr=yield this.getSigner();if(!kr)throw new DynamicError("Signer not found");const Br=(yield kr.signTransaction(Er)).serialize();return JSON.stringify({signedTransaction:{data:Array.from(Br),type:"Buffer"}})})}buildAuthTx(br){const wr=new Transaction;return wr.add(new TransactionInstruction({data:Buffer$2.from(br,"utf8"),keys:[],programId:MEMO_PROGRAM_ID})),wr}setVerifiedCredentials(br){this.verifiedCredentials=br}isLedgerAddress(br){return isLedgerAddressViaVerifiedCredentials(br,this.verifiedCredentials)}}ChainRpcProviders.getSolanaProviderByChainId=(fr,br)=>{var wr;return(wr=fr.solana)===null||wr===void 0?void 0:wr.find(kr=>kr.chainId===br)};ChainRpcProviders.registerSolanaProviders=fr=>{ChainRpcProviders.registerChainProviders(ProviderChain.SOLANA,br=>{const wr={};return br!=null&&br.solana&&(wr.solana=br.solana.map(Er=>{var kr;const jr=((kr=Er.privateCustomerRpcUrls)===null||kr===void 0?void 0:kr[0])||Er.rpcUrls[0],Br=new Connection(jr,fr);return{chainId:Er.chainId.toString(),chainName:Er.name,provider:Br}})),wr.solana})};const TOKEN_PROGRAM_ID=new PublicKey$2("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new PublicKey$2("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const ASSOCIATED_TOKEN_PROGRAM_ID=new PublicKey$2("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new PublicKey$2("So11111111111111111111111111111111111111112");new PublicKey$2("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");const encodeDecode$2=fr=>{const br=fr.decode.bind(fr),wr=fr.encode.bind(fr);return{decode:br,encode:wr}},bigInt$2=fr=>br=>{const wr=blob(fr,br),{encode:Er,decode:kr}=encodeDecode$2(wr),jr=wr;return jr.decode=(Br,Wr)=>{const qr=kr(Br,Wr);return toBigIntLE_1(Buffer$2.from(qr))},jr.encode=(Br,Wr,qr)=>{const Gr=toBufferLE_1(Br,fr);return Er(Gr,Wr,qr)},jr},u64$2=bigInt$2(8),bool=fr=>{const br=u8(fr),{encode:wr,decode:Er}=encodeDecode$2(br),kr=br;return kr.decode=(jr,Br)=>!!Er(jr,Br),kr.encode=(jr,Br,Wr)=>{const qr=Number(jr);return wr(qr,Br,Wr)},kr};var bn$1={exports:{}};bn$1.exports;(function(fr){(function(br,wr){function Er(Tn,Hr){if(!Tn)throw new Error(Hr||"Assertion failed")}function kr(Tn,Hr){Tn.super_=Hr;var Xr=function(){};Xr.prototype=Hr.prototype,Tn.prototype=new Xr,Tn.prototype.constructor=Tn}function jr(Tn,Hr,Xr){if(jr.isBN(Tn))return Tn;this.negative=0,this.words=null,this.length=0,this.red=null,Tn!==null&&((Hr==="le"||Hr==="be")&&(Xr=Hr,Hr=10),this._init(Tn||0,Hr||10,Xr||"be"))}typeof br=="object"?br.exports=jr:wr.BN=jr,jr.BN=jr,jr.wordSize=26;var Br;try{typeof window<"u"&&typeof window.Buffer<"u"?Br=window.Buffer:Br=require$$0$9.Buffer}catch{}jr.isBN=function(Hr){return Hr instanceof jr?!0:Hr!==null&&typeof Hr=="object"&&Hr.constructor.wordSize===jr.wordSize&&Array.isArray(Hr.words)},jr.max=function(Hr,Xr){return Hr.cmp(Xr)>0?Hr:Xr},jr.min=function(Hr,Xr){return Hr.cmp(Xr)<0?Hr:Xr},jr.prototype._init=function(Hr,Xr,Sn){if(typeof Hr=="number")return this._initNumber(Hr,Xr,Sn);if(typeof Hr=="object")return this._initArray(Hr,Xr,Sn);Xr==="hex"&&(Xr=16),Er(Xr===(Xr|0)&&Xr>=2&&Xr<=36),Hr=Hr.toString().replace(/\s+/g,"");var Rn=0;Hr[0]==="-"&&(Rn++,this.negative=1),Rn=0;Rn-=3)On=Hr[Rn]|Hr[Rn-1]<<8|Hr[Rn-2]<<16,this.words[Pn]|=On<>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);else if(Sn==="le")for(Rn=0,Pn=0;Rn>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);return this._strip()};function Wr(Tn,Hr){var Xr=Tn.charCodeAt(Hr);if(Xr>=48&&Xr<=57)return Xr-48;if(Xr>=65&&Xr<=70)return Xr-55;if(Xr>=97&&Xr<=102)return Xr-87;Er(!1,"Invalid character in "+Tn)}function qr(Tn,Hr,Xr){var Sn=Wr(Tn,Xr);return Xr-1>=Hr&&(Sn|=Wr(Tn,Xr-1)<<4),Sn}jr.prototype._parseHex=function(Hr,Xr,Sn){this.length=Math.ceil((Hr.length-Xr)/6),this.words=new Array(this.length);for(var Rn=0;Rn=Xr;Rn-=2)Zn=qr(Hr,Xr,Rn)<=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8;else{var Nn=Hr.length-Xr;for(Rn=Nn%2===0?Xr+1:Xr;Rn=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8}this._strip()};function Gr(Tn,Hr,Xr,Sn){for(var Rn=0,Pn=0,On=Math.min(Tn.length,Xr),Zn=Hr;Zn=49?Pn=Nn-49+10:Nn>=17?Pn=Nn-17+10:Pn=Nn,Er(Nn>=0&&Pn1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},jr.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{jr.prototype[Symbol.for("nodejs.util.inspect.custom")]=Zr}catch{jr.prototype.inspect=Zr}else jr.prototype.inspect=Zr;function Zr(){return(this.red?""}var Jr=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Qr=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_n=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];jr.prototype.toString=function(Hr,Xr){Hr=Hr||10,Xr=Xr|0||1;var Sn;if(Hr===16||Hr==="hex"){Sn="";for(var Rn=0,Pn=0,On=0;On>>24-Rn&16777215,Rn+=2,Rn>=26&&(Rn-=26,On--),Pn!==0||On!==this.length-1?Sn=Jr[6-Nn.length]+Nn+Sn:Sn=Nn+Sn}for(Pn!==0&&(Sn=Pn.toString(16)+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}if(Hr===(Hr|0)&&Hr>=2&&Hr<=36){var wn=Qr[Hr],zn=_n[Hr];Sn="";var fo=this.clone();for(fo.negative=0;!fo.isZero();){var vo=fo.modrn(zn).toString(Hr);fo=fo.idivn(zn),fo.isZero()?Sn=vo+Sn:Sn=Jr[wn-vo.length]+vo+Sn}for(this.isZero()&&(Sn="0"+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}Er(!1,"Base should be between 2 and 36")},jr.prototype.toNumber=function(){var Hr=this.words[0];return this.length===2?Hr+=this.words[1]*67108864:this.length===3&&this.words[2]===1?Hr+=4503599627370496+this.words[1]*67108864:this.length>2&&Er(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-Hr:Hr},jr.prototype.toJSON=function(){return this.toString(16,2)},Br&&(jr.prototype.toBuffer=function(Hr,Xr){return this.toArrayLike(Br,Hr,Xr)}),jr.prototype.toArray=function(Hr,Xr){return this.toArrayLike(Array,Hr,Xr)};var En=function(Hr,Xr){return Hr.allocUnsafe?Hr.allocUnsafe(Xr):new Hr(Xr)};jr.prototype.toArrayLike=function(Hr,Xr,Sn){this._strip();var Rn=this.byteLength(),Pn=Sn||Math.max(1,Rn);Er(Rn<=Pn,"byte array longer than desired length"),Er(Pn>0,"Requested array length <= 0");var On=En(Hr,Pn),Zn=Xr==="le"?"LE":"BE";return this["_toArrayLike"+Zn](On,Rn),On},jr.prototype._toArrayLikeLE=function(Hr,Xr){for(var Sn=0,Rn=0,Pn=0,On=0;Pn>8&255),Sn>16&255),On===6?(Sn>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn=0&&(Hr[Sn--]=Zn>>8&255),Sn>=0&&(Hr[Sn--]=Zn>>16&255),On===6?(Sn>=0&&(Hr[Sn--]=Zn>>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn>=0)for(Hr[Sn--]=Rn;Sn>=0;)Hr[Sn--]=0},Math.clz32?jr.prototype._countBits=function(Hr){return 32-Math.clz32(Hr)}:jr.prototype._countBits=function(Hr){var Xr=Hr,Sn=0;return Xr>=4096&&(Sn+=13,Xr>>>=13),Xr>=64&&(Sn+=7,Xr>>>=7),Xr>=8&&(Sn+=4,Xr>>>=4),Xr>=2&&(Sn+=2,Xr>>>=2),Sn+Xr},jr.prototype._zeroBits=function(Hr){if(Hr===0)return 26;var Xr=Hr,Sn=0;return Xr&8191||(Sn+=13,Xr>>>=13),Xr&127||(Sn+=7,Xr>>>=7),Xr&15||(Sn+=4,Xr>>>=4),Xr&3||(Sn+=2,Xr>>>=2),Xr&1||Sn++,Sn},jr.prototype.bitLength=function(){var Hr=this.words[this.length-1],Xr=this._countBits(Hr);return(this.length-1)*26+Xr};function Cn(Tn){for(var Hr=new Array(Tn.bitLength()),Xr=0;Xr>>Rn&1}return Hr}jr.prototype.zeroBits=function(){if(this.isZero())return 0;for(var Hr=0,Xr=0;XrHr.length?this.clone().ior(Hr):Hr.clone().ior(this)},jr.prototype.uor=function(Hr){return this.length>Hr.length?this.clone().iuor(Hr):Hr.clone().iuor(this)},jr.prototype.iuand=function(Hr){var Xr;this.length>Hr.length?Xr=Hr:Xr=this;for(var Sn=0;SnHr.length?this.clone().iand(Hr):Hr.clone().iand(this)},jr.prototype.uand=function(Hr){return this.length>Hr.length?this.clone().iuand(Hr):Hr.clone().iuand(this)},jr.prototype.iuxor=function(Hr){var Xr,Sn;this.length>Hr.length?(Xr=this,Sn=Hr):(Xr=Hr,Sn=this);for(var Rn=0;RnHr.length?this.clone().ixor(Hr):Hr.clone().ixor(this)},jr.prototype.uxor=function(Hr){return this.length>Hr.length?this.clone().iuxor(Hr):Hr.clone().iuxor(this)},jr.prototype.inotn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Math.ceil(Hr/26)|0,Sn=Hr%26;this._expand(Xr),Sn>0&&Xr--;for(var Rn=0;Rn0&&(this.words[Rn]=~this.words[Rn]&67108863>>26-Sn),this._strip()},jr.prototype.notn=function(Hr){return this.clone().inotn(Hr)},jr.prototype.setn=function(Hr,Xr){Er(typeof Hr=="number"&&Hr>=0);var Sn=Hr/26|0,Rn=Hr%26;return this._expand(Sn+1),Xr?this.words[Sn]=this.words[Sn]|1<Hr.length?(Sn=this,Rn=Hr):(Sn=Hr,Rn=this);for(var Pn=0,On=0;On>>26;for(;Pn!==0&&On>>26;if(this.length=Sn.length,Pn!==0)this.words[this.length]=Pn,this.length++;else if(Sn!==this)for(;OnHr.length?this.clone().iadd(Hr):Hr.clone().iadd(this)},jr.prototype.isub=function(Hr){if(Hr.negative!==0){Hr.negative=0;var Xr=this.iadd(Hr);return Hr.negative=1,Xr._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Hr),this.negative=1,this._normSign();var Sn=this.cmp(Hr);if(Sn===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Rn,Pn;Sn>0?(Rn=this,Pn=Hr):(Rn=Hr,Pn=this);for(var On=0,Zn=0;Zn>26,this.words[Zn]=Xr&67108863;for(;On!==0&&Zn>26,this.words[Zn]=Xr&67108863;if(On===0&&Zn>>26,fo=Nn&67108863,vo=Math.min(wn,Hr.length-1),go=Math.max(0,wn-Tn.length+1);go<=vo;go++){var uo=wn-go|0;Rn=Tn.words[uo]|0,Pn=Hr.words[go]|0,On=Rn*Pn+fo,zn+=On/67108864|0,fo=On&67108863}Xr.words[wn]=fo|0,Nn=zn|0}return Nn!==0?Xr.words[wn]=Nn|0:Xr.length--,Xr._strip()}var An=function(Hr,Xr,Sn){var Rn=Hr.words,Pn=Xr.words,On=Sn.words,Zn=0,Nn,wn,zn,fo=Rn[0]|0,vo=fo&8191,go=fo>>>13,uo=Rn[1]|0,lo=uo&8191,Eo=uo>>>13,mo=Rn[2]|0,yo=mo&8191,_o=mo>>>13,Bo=Rn[3]|0,Lo=Bo&8191,Wo=Bo>>>13,na=Rn[4]|0,qo=na&8191,ga=na>>>13,wl=Rn[5]|0,No=wl&8191,Fo=wl>>>13,Nl=Rn[6]|0,Vo=Nl&8191,Uo=Nl>>>13,Ml=Rn[7]|0,$a=Ml&8191,Jo=Ml>>>13,Zl=Rn[8]|0,Cl=Zl&8191,ko=Zl>>>13,wo=Rn[9]|0,bo=wo&8191,Io=wo>>>13,Ho=Pn[0]|0,Do=Ho&8191,zo=Ho>>>13,nu=Pn[1]|0,Ll=nu&8191,_l=nu>>>13,bu=Pn[2]|0,xl=bu&8191,Tl=bu>>>13,du=Pn[3]|0,Bl=du&8191,Il=du>>>13,Eu=Pn[4]|0,Al=Eu&8191,Ol=Eu>>>13,Tu=Pn[5]|0,Ul=Tu&8191,Sl=Tu>>>13,_u=Pn[6]|0,So=_u&8191,Co=_u>>>13,Ao=Pn[7]|0,po=Ao&8191,Ro=Ao>>>13,Xo=Pn[8]|0,jo=Xo&8191,Ko=Xo>>>13,Wl=Pn[9]|0,$l=Wl&8191,El=Wl>>>13;Sn.negative=Hr.negative^Xr.negative,Sn.length=19,Nn=Math.imul(vo,Do),wn=Math.imul(vo,zo),wn=wn+Math.imul(go,Do)|0,zn=Math.imul(go,zo);var Cu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,Nn=Math.imul(lo,Do),wn=Math.imul(lo,zo),wn=wn+Math.imul(Eo,Do)|0,zn=Math.imul(Eo,zo),Nn=Nn+Math.imul(vo,Ll)|0,wn=wn+Math.imul(vo,_l)|0,wn=wn+Math.imul(go,Ll)|0,zn=zn+Math.imul(go,_l)|0;var iu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(iu>>>26)|0,iu&=67108863,Nn=Math.imul(yo,Do),wn=Math.imul(yo,zo),wn=wn+Math.imul(_o,Do)|0,zn=Math.imul(_o,zo),Nn=Nn+Math.imul(lo,Ll)|0,wn=wn+Math.imul(lo,_l)|0,wn=wn+Math.imul(Eo,Ll)|0,zn=zn+Math.imul(Eo,_l)|0,Nn=Nn+Math.imul(vo,xl)|0,wn=wn+Math.imul(vo,Tl)|0,wn=wn+Math.imul(go,xl)|0,zn=zn+Math.imul(go,Tl)|0;var pu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(pu>>>26)|0,pu&=67108863,Nn=Math.imul(Lo,Do),wn=Math.imul(Lo,zo),wn=wn+Math.imul(Wo,Do)|0,zn=Math.imul(Wo,zo),Nn=Nn+Math.imul(yo,Ll)|0,wn=wn+Math.imul(yo,_l)|0,wn=wn+Math.imul(_o,Ll)|0,zn=zn+Math.imul(_o,_l)|0,Nn=Nn+Math.imul(lo,xl)|0,wn=wn+Math.imul(lo,Tl)|0,wn=wn+Math.imul(Eo,xl)|0,zn=zn+Math.imul(Eo,Tl)|0,Nn=Nn+Math.imul(vo,Bl)|0,wn=wn+Math.imul(vo,Il)|0,wn=wn+Math.imul(go,Bl)|0,zn=zn+Math.imul(go,Il)|0;var yu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(yu>>>26)|0,yu&=67108863,Nn=Math.imul(qo,Do),wn=Math.imul(qo,zo),wn=wn+Math.imul(ga,Do)|0,zn=Math.imul(ga,zo),Nn=Nn+Math.imul(Lo,Ll)|0,wn=wn+Math.imul(Lo,_l)|0,wn=wn+Math.imul(Wo,Ll)|0,zn=zn+Math.imul(Wo,_l)|0,Nn=Nn+Math.imul(yo,xl)|0,wn=wn+Math.imul(yo,Tl)|0,wn=wn+Math.imul(_o,xl)|0,zn=zn+Math.imul(_o,Tl)|0,Nn=Nn+Math.imul(lo,Bl)|0,wn=wn+Math.imul(lo,Il)|0,wn=wn+Math.imul(Eo,Bl)|0,zn=zn+Math.imul(Eo,Il)|0,Nn=Nn+Math.imul(vo,Al)|0,wn=wn+Math.imul(vo,Ol)|0,wn=wn+Math.imul(go,Al)|0,zn=zn+Math.imul(go,Ol)|0;var hu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(hu>>>26)|0,hu&=67108863,Nn=Math.imul(No,Do),wn=Math.imul(No,zo),wn=wn+Math.imul(Fo,Do)|0,zn=Math.imul(Fo,zo),Nn=Nn+Math.imul(qo,Ll)|0,wn=wn+Math.imul(qo,_l)|0,wn=wn+Math.imul(ga,Ll)|0,zn=zn+Math.imul(ga,_l)|0,Nn=Nn+Math.imul(Lo,xl)|0,wn=wn+Math.imul(Lo,Tl)|0,wn=wn+Math.imul(Wo,xl)|0,zn=zn+Math.imul(Wo,Tl)|0,Nn=Nn+Math.imul(yo,Bl)|0,wn=wn+Math.imul(yo,Il)|0,wn=wn+Math.imul(_o,Bl)|0,zn=zn+Math.imul(_o,Il)|0,Nn=Nn+Math.imul(lo,Al)|0,wn=wn+Math.imul(lo,Ol)|0,wn=wn+Math.imul(Eo,Al)|0,zn=zn+Math.imul(Eo,Ol)|0,Nn=Nn+Math.imul(vo,Ul)|0,wn=wn+Math.imul(vo,Sl)|0,wn=wn+Math.imul(go,Ul)|0,zn=zn+Math.imul(go,Sl)|0;var mu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(mu>>>26)|0,mu&=67108863,Nn=Math.imul(Vo,Do),wn=Math.imul(Vo,zo),wn=wn+Math.imul(Uo,Do)|0,zn=Math.imul(Uo,zo),Nn=Nn+Math.imul(No,Ll)|0,wn=wn+Math.imul(No,_l)|0,wn=wn+Math.imul(Fo,Ll)|0,zn=zn+Math.imul(Fo,_l)|0,Nn=Nn+Math.imul(qo,xl)|0,wn=wn+Math.imul(qo,Tl)|0,wn=wn+Math.imul(ga,xl)|0,zn=zn+Math.imul(ga,Tl)|0,Nn=Nn+Math.imul(Lo,Bl)|0,wn=wn+Math.imul(Lo,Il)|0,wn=wn+Math.imul(Wo,Bl)|0,zn=zn+Math.imul(Wo,Il)|0,Nn=Nn+Math.imul(yo,Al)|0,wn=wn+Math.imul(yo,Ol)|0,wn=wn+Math.imul(_o,Al)|0,zn=zn+Math.imul(_o,Ol)|0,Nn=Nn+Math.imul(lo,Ul)|0,wn=wn+Math.imul(lo,Sl)|0,wn=wn+Math.imul(Eo,Ul)|0,zn=zn+Math.imul(Eo,Sl)|0,Nn=Nn+Math.imul(vo,So)|0,wn=wn+Math.imul(vo,Co)|0,wn=wn+Math.imul(go,So)|0,zn=zn+Math.imul(go,Co)|0;var vu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(vu>>>26)|0,vu&=67108863,Nn=Math.imul($a,Do),wn=Math.imul($a,zo),wn=wn+Math.imul(Jo,Do)|0,zn=Math.imul(Jo,zo),Nn=Nn+Math.imul(Vo,Ll)|0,wn=wn+Math.imul(Vo,_l)|0,wn=wn+Math.imul(Uo,Ll)|0,zn=zn+Math.imul(Uo,_l)|0,Nn=Nn+Math.imul(No,xl)|0,wn=wn+Math.imul(No,Tl)|0,wn=wn+Math.imul(Fo,xl)|0,zn=zn+Math.imul(Fo,Tl)|0,Nn=Nn+Math.imul(qo,Bl)|0,wn=wn+Math.imul(qo,Il)|0,wn=wn+Math.imul(ga,Bl)|0,zn=zn+Math.imul(ga,Il)|0,Nn=Nn+Math.imul(Lo,Al)|0,wn=wn+Math.imul(Lo,Ol)|0,wn=wn+Math.imul(Wo,Al)|0,zn=zn+Math.imul(Wo,Ol)|0,Nn=Nn+Math.imul(yo,Ul)|0,wn=wn+Math.imul(yo,Sl)|0,wn=wn+Math.imul(_o,Ul)|0,zn=zn+Math.imul(_o,Sl)|0,Nn=Nn+Math.imul(lo,So)|0,wn=wn+Math.imul(lo,Co)|0,wn=wn+Math.imul(Eo,So)|0,zn=zn+Math.imul(Eo,Co)|0,Nn=Nn+Math.imul(vo,po)|0,wn=wn+Math.imul(vo,Ro)|0,wn=wn+Math.imul(go,po)|0,zn=zn+Math.imul(go,Ro)|0;var fu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(fu>>>26)|0,fu&=67108863,Nn=Math.imul(Cl,Do),wn=Math.imul(Cl,zo),wn=wn+Math.imul(ko,Do)|0,zn=Math.imul(ko,zo),Nn=Nn+Math.imul($a,Ll)|0,wn=wn+Math.imul($a,_l)|0,wn=wn+Math.imul(Jo,Ll)|0,zn=zn+Math.imul(Jo,_l)|0,Nn=Nn+Math.imul(Vo,xl)|0,wn=wn+Math.imul(Vo,Tl)|0,wn=wn+Math.imul(Uo,xl)|0,zn=zn+Math.imul(Uo,Tl)|0,Nn=Nn+Math.imul(No,Bl)|0,wn=wn+Math.imul(No,Il)|0,wn=wn+Math.imul(Fo,Bl)|0,zn=zn+Math.imul(Fo,Il)|0,Nn=Nn+Math.imul(qo,Al)|0,wn=wn+Math.imul(qo,Ol)|0,wn=wn+Math.imul(ga,Al)|0,zn=zn+Math.imul(ga,Ol)|0,Nn=Nn+Math.imul(Lo,Ul)|0,wn=wn+Math.imul(Lo,Sl)|0,wn=wn+Math.imul(Wo,Ul)|0,zn=zn+Math.imul(Wo,Sl)|0,Nn=Nn+Math.imul(yo,So)|0,wn=wn+Math.imul(yo,Co)|0,wn=wn+Math.imul(_o,So)|0,zn=zn+Math.imul(_o,Co)|0,Nn=Nn+Math.imul(lo,po)|0,wn=wn+Math.imul(lo,Ro)|0,wn=wn+Math.imul(Eo,po)|0,zn=zn+Math.imul(Eo,Ro)|0,Nn=Nn+Math.imul(vo,jo)|0,wn=wn+Math.imul(vo,Ko)|0,wn=wn+Math.imul(go,jo)|0,zn=zn+Math.imul(go,Ko)|0;var gu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(gu>>>26)|0,gu&=67108863,Nn=Math.imul(bo,Do),wn=Math.imul(bo,zo),wn=wn+Math.imul(Io,Do)|0,zn=Math.imul(Io,zo),Nn=Nn+Math.imul(Cl,Ll)|0,wn=wn+Math.imul(Cl,_l)|0,wn=wn+Math.imul(ko,Ll)|0,zn=zn+Math.imul(ko,_l)|0,Nn=Nn+Math.imul($a,xl)|0,wn=wn+Math.imul($a,Tl)|0,wn=wn+Math.imul(Jo,xl)|0,zn=zn+Math.imul(Jo,Tl)|0,Nn=Nn+Math.imul(Vo,Bl)|0,wn=wn+Math.imul(Vo,Il)|0,wn=wn+Math.imul(Uo,Bl)|0,zn=zn+Math.imul(Uo,Il)|0,Nn=Nn+Math.imul(No,Al)|0,wn=wn+Math.imul(No,Ol)|0,wn=wn+Math.imul(Fo,Al)|0,zn=zn+Math.imul(Fo,Ol)|0,Nn=Nn+Math.imul(qo,Ul)|0,wn=wn+Math.imul(qo,Sl)|0,wn=wn+Math.imul(ga,Ul)|0,zn=zn+Math.imul(ga,Sl)|0,Nn=Nn+Math.imul(Lo,So)|0,wn=wn+Math.imul(Lo,Co)|0,wn=wn+Math.imul(Wo,So)|0,zn=zn+Math.imul(Wo,Co)|0,Nn=Nn+Math.imul(yo,po)|0,wn=wn+Math.imul(yo,Ro)|0,wn=wn+Math.imul(_o,po)|0,zn=zn+Math.imul(_o,Ro)|0,Nn=Nn+Math.imul(lo,jo)|0,wn=wn+Math.imul(lo,Ko)|0,wn=wn+Math.imul(Eo,jo)|0,zn=zn+Math.imul(Eo,Ko)|0,Nn=Nn+Math.imul(vo,$l)|0,wn=wn+Math.imul(vo,El)|0,wn=wn+Math.imul(go,$l)|0,zn=zn+Math.imul(go,El)|0;var ou=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(ou>>>26)|0,ou&=67108863,Nn=Math.imul(bo,Ll),wn=Math.imul(bo,_l),wn=wn+Math.imul(Io,Ll)|0,zn=Math.imul(Io,_l),Nn=Nn+Math.imul(Cl,xl)|0,wn=wn+Math.imul(Cl,Tl)|0,wn=wn+Math.imul(ko,xl)|0,zn=zn+Math.imul(ko,Tl)|0,Nn=Nn+Math.imul($a,Bl)|0,wn=wn+Math.imul($a,Il)|0,wn=wn+Math.imul(Jo,Bl)|0,zn=zn+Math.imul(Jo,Il)|0,Nn=Nn+Math.imul(Vo,Al)|0,wn=wn+Math.imul(Vo,Ol)|0,wn=wn+Math.imul(Uo,Al)|0,zn=zn+Math.imul(Uo,Ol)|0,Nn=Nn+Math.imul(No,Ul)|0,wn=wn+Math.imul(No,Sl)|0,wn=wn+Math.imul(Fo,Ul)|0,zn=zn+Math.imul(Fo,Sl)|0,Nn=Nn+Math.imul(qo,So)|0,wn=wn+Math.imul(qo,Co)|0,wn=wn+Math.imul(ga,So)|0,zn=zn+Math.imul(ga,Co)|0,Nn=Nn+Math.imul(Lo,po)|0,wn=wn+Math.imul(Lo,Ro)|0,wn=wn+Math.imul(Wo,po)|0,zn=zn+Math.imul(Wo,Ro)|0,Nn=Nn+Math.imul(yo,jo)|0,wn=wn+Math.imul(yo,Ko)|0,wn=wn+Math.imul(_o,jo)|0,zn=zn+Math.imul(_o,Ko)|0,Nn=Nn+Math.imul(lo,$l)|0,wn=wn+Math.imul(lo,El)|0,wn=wn+Math.imul(Eo,$l)|0,zn=zn+Math.imul(Eo,El)|0;var su=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(su>>>26)|0,su&=67108863,Nn=Math.imul(bo,xl),wn=Math.imul(bo,Tl),wn=wn+Math.imul(Io,xl)|0,zn=Math.imul(Io,Tl),Nn=Nn+Math.imul(Cl,Bl)|0,wn=wn+Math.imul(Cl,Il)|0,wn=wn+Math.imul(ko,Bl)|0,zn=zn+Math.imul(ko,Il)|0,Nn=Nn+Math.imul($a,Al)|0,wn=wn+Math.imul($a,Ol)|0,wn=wn+Math.imul(Jo,Al)|0,zn=zn+Math.imul(Jo,Ol)|0,Nn=Nn+Math.imul(Vo,Ul)|0,wn=wn+Math.imul(Vo,Sl)|0,wn=wn+Math.imul(Uo,Ul)|0,zn=zn+Math.imul(Uo,Sl)|0,Nn=Nn+Math.imul(No,So)|0,wn=wn+Math.imul(No,Co)|0,wn=wn+Math.imul(Fo,So)|0,zn=zn+Math.imul(Fo,Co)|0,Nn=Nn+Math.imul(qo,po)|0,wn=wn+Math.imul(qo,Ro)|0,wn=wn+Math.imul(ga,po)|0,zn=zn+Math.imul(ga,Ro)|0,Nn=Nn+Math.imul(Lo,jo)|0,wn=wn+Math.imul(Lo,Ko)|0,wn=wn+Math.imul(Wo,jo)|0,zn=zn+Math.imul(Wo,Ko)|0,Nn=Nn+Math.imul(yo,$l)|0,wn=wn+Math.imul(yo,El)|0,wn=wn+Math.imul(_o,$l)|0,zn=zn+Math.imul(_o,El)|0;var tu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(tu>>>26)|0,tu&=67108863,Nn=Math.imul(bo,Bl),wn=Math.imul(bo,Il),wn=wn+Math.imul(Io,Bl)|0,zn=Math.imul(Io,Il),Nn=Nn+Math.imul(Cl,Al)|0,wn=wn+Math.imul(Cl,Ol)|0,wn=wn+Math.imul(ko,Al)|0,zn=zn+Math.imul(ko,Ol)|0,Nn=Nn+Math.imul($a,Ul)|0,wn=wn+Math.imul($a,Sl)|0,wn=wn+Math.imul(Jo,Ul)|0,zn=zn+Math.imul(Jo,Sl)|0,Nn=Nn+Math.imul(Vo,So)|0,wn=wn+Math.imul(Vo,Co)|0,wn=wn+Math.imul(Uo,So)|0,zn=zn+Math.imul(Uo,Co)|0,Nn=Nn+Math.imul(No,po)|0,wn=wn+Math.imul(No,Ro)|0,wn=wn+Math.imul(Fo,po)|0,zn=zn+Math.imul(Fo,Ro)|0,Nn=Nn+Math.imul(qo,jo)|0,wn=wn+Math.imul(qo,Ko)|0,wn=wn+Math.imul(ga,jo)|0,zn=zn+Math.imul(ga,Ko)|0,Nn=Nn+Math.imul(Lo,$l)|0,wn=wn+Math.imul(Lo,El)|0,wn=wn+Math.imul(Wo,$l)|0,zn=zn+Math.imul(Wo,El)|0;var zl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(zl>>>26)|0,zl&=67108863,Nn=Math.imul(bo,Al),wn=Math.imul(bo,Ol),wn=wn+Math.imul(Io,Al)|0,zn=Math.imul(Io,Ol),Nn=Nn+Math.imul(Cl,Ul)|0,wn=wn+Math.imul(Cl,Sl)|0,wn=wn+Math.imul(ko,Ul)|0,zn=zn+Math.imul(ko,Sl)|0,Nn=Nn+Math.imul($a,So)|0,wn=wn+Math.imul($a,Co)|0,wn=wn+Math.imul(Jo,So)|0,zn=zn+Math.imul(Jo,Co)|0,Nn=Nn+Math.imul(Vo,po)|0,wn=wn+Math.imul(Vo,Ro)|0,wn=wn+Math.imul(Uo,po)|0,zn=zn+Math.imul(Uo,Ro)|0,Nn=Nn+Math.imul(No,jo)|0,wn=wn+Math.imul(No,Ko)|0,wn=wn+Math.imul(Fo,jo)|0,zn=zn+Math.imul(Fo,Ko)|0,Nn=Nn+Math.imul(qo,$l)|0,wn=wn+Math.imul(qo,El)|0,wn=wn+Math.imul(ga,$l)|0,zn=zn+Math.imul(ga,El)|0;var Gl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Gl>>>26)|0,Gl&=67108863,Nn=Math.imul(bo,Ul),wn=Math.imul(bo,Sl),wn=wn+Math.imul(Io,Ul)|0,zn=Math.imul(Io,Sl),Nn=Nn+Math.imul(Cl,So)|0,wn=wn+Math.imul(Cl,Co)|0,wn=wn+Math.imul(ko,So)|0,zn=zn+Math.imul(ko,Co)|0,Nn=Nn+Math.imul($a,po)|0,wn=wn+Math.imul($a,Ro)|0,wn=wn+Math.imul(Jo,po)|0,zn=zn+Math.imul(Jo,Ro)|0,Nn=Nn+Math.imul(Vo,jo)|0,wn=wn+Math.imul(Vo,Ko)|0,wn=wn+Math.imul(Uo,jo)|0,zn=zn+Math.imul(Uo,Ko)|0,Nn=Nn+Math.imul(No,$l)|0,wn=wn+Math.imul(No,El)|0,wn=wn+Math.imul(Fo,$l)|0,zn=zn+Math.imul(Fo,El)|0;var Jl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Jl>>>26)|0,Jl&=67108863,Nn=Math.imul(bo,So),wn=Math.imul(bo,Co),wn=wn+Math.imul(Io,So)|0,zn=Math.imul(Io,Co),Nn=Nn+Math.imul(Cl,po)|0,wn=wn+Math.imul(Cl,Ro)|0,wn=wn+Math.imul(ko,po)|0,zn=zn+Math.imul(ko,Ro)|0,Nn=Nn+Math.imul($a,jo)|0,wn=wn+Math.imul($a,Ko)|0,wn=wn+Math.imul(Jo,jo)|0,zn=zn+Math.imul(Jo,Ko)|0,Nn=Nn+Math.imul(Vo,$l)|0,wn=wn+Math.imul(Vo,El)|0,wn=wn+Math.imul(Uo,$l)|0,zn=zn+Math.imul(Uo,El)|0;var Pl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Pl>>>26)|0,Pl&=67108863,Nn=Math.imul(bo,po),wn=Math.imul(bo,Ro),wn=wn+Math.imul(Io,po)|0,zn=Math.imul(Io,Ro),Nn=Nn+Math.imul(Cl,jo)|0,wn=wn+Math.imul(Cl,Ko)|0,wn=wn+Math.imul(ko,jo)|0,zn=zn+Math.imul(ko,Ko)|0,Nn=Nn+Math.imul($a,$l)|0,wn=wn+Math.imul($a,El)|0,wn=wn+Math.imul(Jo,$l)|0,zn=zn+Math.imul(Jo,El)|0;var Fl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Fl>>>26)|0,Fl&=67108863,Nn=Math.imul(bo,jo),wn=Math.imul(bo,Ko),wn=wn+Math.imul(Io,jo)|0,zn=Math.imul(Io,Ko),Nn=Nn+Math.imul(Cl,$l)|0,wn=wn+Math.imul(Cl,El)|0,wn=wn+Math.imul(ko,$l)|0,zn=zn+Math.imul(ko,El)|0;var Yl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Yl>>>26)|0,Yl&=67108863,Nn=Math.imul(bo,$l),wn=Math.imul(bo,El),wn=wn+Math.imul(Io,$l)|0,zn=Math.imul(Io,El);var Vl=(Zn+Nn|0)+((wn&8191)<<13)|0;return Zn=(zn+(wn>>>13)|0)+(Vl>>>26)|0,Vl&=67108863,On[0]=Cu,On[1]=iu,On[2]=pu,On[3]=yu,On[4]=hu,On[5]=mu,On[6]=vu,On[7]=fu,On[8]=gu,On[9]=ou,On[10]=su,On[11]=tu,On[12]=zl,On[13]=Gl,On[14]=Jl,On[15]=Pl,On[16]=Fl,On[17]=Yl,On[18]=Vl,Zn!==0&&(On[19]=Zn,Sn.length++),Sn};Math.imul||(An=In);function jn(Tn,Hr,Xr){Xr.negative=Hr.negative^Tn.negative,Xr.length=Tn.length+Hr.length;for(var Sn=0,Rn=0,Pn=0;Pn>>26)|0,Rn+=On>>>26,On&=67108863}Xr.words[Pn]=Zn,Sn=On,On=Rn}return Sn!==0?Xr.words[Pn]=Sn:Xr.length--,Xr._strip()}function eo(Tn,Hr,Xr){return jn(Tn,Hr,Xr)}jr.prototype.mulTo=function(Hr,Xr){var Sn,Rn=this.length+Hr.length;return this.length===10&&Hr.length===10?Sn=An(this,Hr,Xr):Rn<63?Sn=In(this,Hr,Xr):Rn<1024?Sn=jn(this,Hr,Xr):Sn=eo(this,Hr,Xr),Sn},jr.prototype.mul=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),this.mulTo(Hr,Xr)},jr.prototype.mulf=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),eo(this,Hr,Xr)},jr.prototype.imul=function(Hr){return this.clone().mulTo(Hr,this)},jr.prototype.imuln=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(typeof Hr=="number"),Er(Hr<67108864);for(var Sn=0,Rn=0;Rn>=26,Sn+=Pn/67108864|0,Sn+=On>>>26,this.words[Rn]=On&67108863}return Sn!==0&&(this.words[Rn]=Sn,this.length++),Xr?this.ineg():this},jr.prototype.muln=function(Hr){return this.clone().imuln(Hr)},jr.prototype.sqr=function(){return this.mul(this)},jr.prototype.isqr=function(){return this.imul(this.clone())},jr.prototype.pow=function(Hr){var Xr=Cn(Hr);if(Xr.length===0)return new jr(1);for(var Sn=this,Rn=0;Rn=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=67108863>>>26-Xr<<26-Xr,Pn;if(Xr!==0){var On=0;for(Pn=0;Pn>>26-Xr}On&&(this.words[Pn]=On,this.length++)}if(Sn!==0){for(Pn=this.length-1;Pn>=0;Pn--)this.words[Pn+Sn]=this.words[Pn];for(Pn=0;Pn=0);var Rn;Xr?Rn=(Xr-Xr%26)/26:Rn=0;var Pn=Hr%26,On=Math.min((Hr-Pn)/26,this.length),Zn=67108863^67108863>>>Pn<On)for(this.length-=On,wn=0;wn=0&&(zn!==0||wn>=Rn);wn--){var fo=this.words[wn]|0;this.words[wn]=zn<<26-Pn|fo>>>Pn,zn=fo&Zn}return Nn&&zn!==0&&(Nn.words[Nn.length++]=zn),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},jr.prototype.ishrn=function(Hr,Xr,Sn){return Er(this.negative===0),this.iushrn(Hr,Xr,Sn)},jr.prototype.shln=function(Hr){return this.clone().ishln(Hr)},jr.prototype.ushln=function(Hr){return this.clone().iushln(Hr)},jr.prototype.shrn=function(Hr){return this.clone().ishrn(Hr)},jr.prototype.ushrn=function(Hr){return this.clone().iushrn(Hr)},jr.prototype.testn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<=0);var Xr=Hr%26,Sn=(Hr-Xr)/26;if(Er(this.negative===0,"imaskn works only with positive numbers"),this.length<=Sn)return this;if(Xr!==0&&Sn++,this.length=Math.min(Sn,this.length),Xr!==0){var Rn=67108863^67108863>>>Xr<=67108864;Xr++)this.words[Xr]-=67108864,Xr===this.length-1?this.words[Xr+1]=1:this.words[Xr+1]++;return this.length=Math.max(this.length,Xr+1),this},jr.prototype.isubn=function(Hr){if(Er(typeof Hr=="number"),Er(Hr<67108864),Hr<0)return this.iaddn(-Hr);if(this.negative!==0)return this.negative=0,this.iaddn(Hr),this.negative=1,this;if(this.words[0]-=Hr,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Xr=0;Xr>26)-(Nn/67108864|0),this.words[Pn+Sn]=On&67108863}for(;Pn>26,this.words[Pn+Sn]=On&67108863;if(Zn===0)return this._strip();for(Er(Zn===-1),Zn=0,Pn=0;Pn>26,this.words[Pn]=On&67108863;return this.negative=1,this._strip()},jr.prototype._wordDiv=function(Hr,Xr){var Sn=this.length-Hr.length,Rn=this.clone(),Pn=Hr,On=Pn.words[Pn.length-1]|0,Zn=this._countBits(On);Sn=26-Zn,Sn!==0&&(Pn=Pn.ushln(Sn),Rn.iushln(Sn),On=Pn.words[Pn.length-1]|0);var Nn=Rn.length-Pn.length,wn;if(Xr!=="mod"){wn=new jr(null),wn.length=Nn+1,wn.words=new Array(wn.length);for(var zn=0;zn=0;vo--){var go=(Rn.words[Pn.length+vo]|0)*67108864+(Rn.words[Pn.length+vo-1]|0);for(go=Math.min(go/On|0,67108863),Rn._ishlnsubmul(Pn,go,vo);Rn.negative!==0;)go--,Rn.negative=0,Rn._ishlnsubmul(Pn,1,vo),Rn.isZero()||(Rn.negative^=1);wn&&(wn.words[vo]=go)}return wn&&wn._strip(),Rn._strip(),Xr!=="div"&&Sn!==0&&Rn.iushrn(Sn),{div:wn||null,mod:Rn}},jr.prototype.divmod=function(Hr,Xr,Sn){if(Er(!Hr.isZero()),this.isZero())return{div:new jr(0),mod:new jr(0)};var Rn,Pn,On;return this.negative!==0&&Hr.negative===0?(On=this.neg().divmod(Hr,Xr),Xr!=="mod"&&(Rn=On.div.neg()),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.iadd(Hr)),{div:Rn,mod:Pn}):this.negative===0&&Hr.negative!==0?(On=this.divmod(Hr.neg(),Xr),Xr!=="mod"&&(Rn=On.div.neg()),{div:Rn,mod:On.mod}):this.negative&Hr.negative?(On=this.neg().divmod(Hr.neg(),Xr),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.isub(Hr)),{div:On.div,mod:Pn}):Hr.length>this.length||this.cmp(Hr)<0?{div:new jr(0),mod:this}:Hr.length===1?Xr==="div"?{div:this.divn(Hr.words[0]),mod:null}:Xr==="mod"?{div:null,mod:new jr(this.modrn(Hr.words[0]))}:{div:this.divn(Hr.words[0]),mod:new jr(this.modrn(Hr.words[0]))}:this._wordDiv(Hr,Xr)},jr.prototype.div=function(Hr){return this.divmod(Hr,"div",!1).div},jr.prototype.mod=function(Hr){return this.divmod(Hr,"mod",!1).mod},jr.prototype.umod=function(Hr){return this.divmod(Hr,"mod",!0).mod},jr.prototype.divRound=function(Hr){var Xr=this.divmod(Hr);if(Xr.mod.isZero())return Xr.div;var Sn=Xr.div.negative!==0?Xr.mod.isub(Hr):Xr.mod,Rn=Hr.ushrn(1),Pn=Hr.andln(1),On=Sn.cmp(Rn);return On<0||Pn===1&&On===0?Xr.div:Xr.div.negative!==0?Xr.div.isubn(1):Xr.div.iaddn(1)},jr.prototype.modrn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=(1<<26)%Hr,Rn=0,Pn=this.length-1;Pn>=0;Pn--)Rn=(Sn*Rn+(this.words[Pn]|0))%Hr;return Xr?-Rn:Rn},jr.prototype.modn=function(Hr){return this.modrn(Hr)},jr.prototype.idivn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=0,Rn=this.length-1;Rn>=0;Rn--){var Pn=(this.words[Rn]|0)+Sn*67108864;this.words[Rn]=Pn/Hr|0,Sn=Pn%Hr}return this._strip(),Xr?this.ineg():this},jr.prototype.divn=function(Hr){return this.clone().idivn(Hr)},jr.prototype.egcd=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=new jr(0),Zn=new jr(1),Nn=0;Xr.isEven()&&Sn.isEven();)Xr.iushrn(1),Sn.iushrn(1),++Nn;for(var wn=Sn.clone(),zn=Xr.clone();!Xr.isZero();){for(var fo=0,vo=1;!(Xr.words[0]&vo)&&fo<26;++fo,vo<<=1);if(fo>0)for(Xr.iushrn(fo);fo-- >0;)(Rn.isOdd()||Pn.isOdd())&&(Rn.iadd(wn),Pn.isub(zn)),Rn.iushrn(1),Pn.iushrn(1);for(var go=0,uo=1;!(Sn.words[0]&uo)&&go<26;++go,uo<<=1);if(go>0)for(Sn.iushrn(go);go-- >0;)(On.isOdd()||Zn.isOdd())&&(On.iadd(wn),Zn.isub(zn)),On.iushrn(1),Zn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(On),Pn.isub(Zn)):(Sn.isub(Xr),On.isub(Rn),Zn.isub(Pn))}return{a:On,b:Zn,gcd:Sn.iushln(Nn)}},jr.prototype._invmp=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=Sn.clone();Xr.cmpn(1)>0&&Sn.cmpn(1)>0;){for(var Zn=0,Nn=1;!(Xr.words[0]&Nn)&&Zn<26;++Zn,Nn<<=1);if(Zn>0)for(Xr.iushrn(Zn);Zn-- >0;)Rn.isOdd()&&Rn.iadd(On),Rn.iushrn(1);for(var wn=0,zn=1;!(Sn.words[0]&zn)&&wn<26;++wn,zn<<=1);if(wn>0)for(Sn.iushrn(wn);wn-- >0;)Pn.isOdd()&&Pn.iadd(On),Pn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(Pn)):(Sn.isub(Xr),Pn.isub(Rn))}var fo;return Xr.cmpn(1)===0?fo=Rn:fo=Pn,fo.cmpn(0)<0&&fo.iadd(Hr),fo},jr.prototype.gcd=function(Hr){if(this.isZero())return Hr.abs();if(Hr.isZero())return this.abs();var Xr=this.clone(),Sn=Hr.clone();Xr.negative=0,Sn.negative=0;for(var Rn=0;Xr.isEven()&&Sn.isEven();Rn++)Xr.iushrn(1),Sn.iushrn(1);do{for(;Xr.isEven();)Xr.iushrn(1);for(;Sn.isEven();)Sn.iushrn(1);var Pn=Xr.cmp(Sn);if(Pn<0){var On=Xr;Xr=Sn,Sn=On}else if(Pn===0||Sn.cmpn(1)===0)break;Xr.isub(Sn)}while(!0);return Sn.iushln(Rn)},jr.prototype.invm=function(Hr){return this.egcd(Hr).a.umod(Hr)},jr.prototype.isEven=function(){return(this.words[0]&1)===0},jr.prototype.isOdd=function(){return(this.words[0]&1)===1},jr.prototype.andln=function(Hr){return this.words[0]&Hr},jr.prototype.bincn=function(Hr){Er(typeof Hr=="number");var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<>>26,Zn&=67108863,this.words[On]=Zn}return Pn!==0&&(this.words[On]=Pn,this.length++),this},jr.prototype.isZero=function(){return this.length===1&&this.words[0]===0},jr.prototype.cmpn=function(Hr){var Xr=Hr<0;if(this.negative!==0&&!Xr)return-1;if(this.negative===0&&Xr)return 1;this._strip();var Sn;if(this.length>1)Sn=1;else{Xr&&(Hr=-Hr),Er(Hr<=67108863,"Number is too big");var Rn=this.words[0]|0;Sn=Rn===Hr?0:RnHr.length)return 1;if(this.length=0;Sn--){var Rn=this.words[Sn]|0,Pn=Hr.words[Sn]|0;if(Rn!==Pn){RnPn&&(Xr=1);break}}return Xr},jr.prototype.gtn=function(Hr){return this.cmpn(Hr)===1},jr.prototype.gt=function(Hr){return this.cmp(Hr)===1},jr.prototype.gten=function(Hr){return this.cmpn(Hr)>=0},jr.prototype.gte=function(Hr){return this.cmp(Hr)>=0},jr.prototype.ltn=function(Hr){return this.cmpn(Hr)===-1},jr.prototype.lt=function(Hr){return this.cmp(Hr)===-1},jr.prototype.lten=function(Hr){return this.cmpn(Hr)<=0},jr.prototype.lte=function(Hr){return this.cmp(Hr)<=0},jr.prototype.eqn=function(Hr){return this.cmpn(Hr)===0},jr.prototype.eq=function(Hr){return this.cmp(Hr)===0},jr.red=function(Hr){return new so(Hr)},jr.prototype.toRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),Er(this.negative===0,"red works only with positives"),Hr.convertTo(this)._forceRed(Hr)},jr.prototype.fromRed=function(){return Er(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},jr.prototype._forceRed=function(Hr){return this.red=Hr,this},jr.prototype.forceRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),this._forceRed(Hr)},jr.prototype.redAdd=function(Hr){return Er(this.red,"redAdd works only with red numbers"),this.red.add(this,Hr)},jr.prototype.redIAdd=function(Hr){return Er(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Hr)},jr.prototype.redSub=function(Hr){return Er(this.red,"redSub works only with red numbers"),this.red.sub(this,Hr)},jr.prototype.redISub=function(Hr){return Er(this.red,"redISub works only with red numbers"),this.red.isub(this,Hr)},jr.prototype.redShl=function(Hr){return Er(this.red,"redShl works only with red numbers"),this.red.shl(this,Hr)},jr.prototype.redMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.mul(this,Hr)},jr.prototype.redIMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.imul(this,Hr)},jr.prototype.redSqr=function(){return Er(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},jr.prototype.redISqr=function(){return Er(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},jr.prototype.redSqrt=function(){return Er(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},jr.prototype.redInvm=function(){return Er(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},jr.prototype.redNeg=function(){return Er(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},jr.prototype.redPow=function(Hr){return Er(this.red&&!Hr.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Hr)};var ro={k256:null,p224:null,p192:null,p25519:null};function to(Tn,Hr){this.name=Tn,this.p=new jr(Hr,16),this.n=this.p.bitLength(),this.k=new jr(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}to.prototype._tmp=function(){var Hr=new jr(null);return Hr.words=new Array(Math.ceil(this.n/13)),Hr},to.prototype.ireduce=function(Hr){var Xr=Hr,Sn;do this.split(Xr,this.tmp),Xr=this.imulK(Xr),Xr=Xr.iadd(this.tmp),Sn=Xr.bitLength();while(Sn>this.n);var Rn=Sn0?Xr.isub(this.p):Xr.strip!==void 0?Xr.strip():Xr._strip(),Xr},to.prototype.split=function(Hr,Xr){Hr.iushrn(this.n,0,Xr)},to.prototype.imulK=function(Hr){return Hr.imul(this.k)};function _i(){to.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}kr(_i,to),_i.prototype.split=function(Hr,Xr){for(var Sn=4194303,Rn=Math.min(Hr.length,9),Pn=0;Pn>>22,On=Zn}On>>>=22,Hr.words[Pn-10]=On,On===0&&Hr.length>10?Hr.length-=10:Hr.length-=9},_i.prototype.imulK=function(Hr){Hr.words[Hr.length]=0,Hr.words[Hr.length+1]=0,Hr.length+=2;for(var Xr=0,Sn=0;Sn>>=26,Hr.words[Sn]=Pn,Xr=Rn}return Xr!==0&&(Hr.words[Hr.length++]=Xr),Hr},jr._prime=function(Hr){if(ro[Hr])return ro[Hr];var Xr;if(Hr==="k256")Xr=new _i;else if(Hr==="p224")Xr=new oo;else if(Hr==="p192")Xr=new io;else if(Hr==="p25519")Xr=new co;else throw new Error("Unknown prime "+Hr);return ro[Hr]=Xr,Xr};function so(Tn){if(typeof Tn=="string"){var Hr=jr._prime(Tn);this.m=Hr.p,this.prime=Hr}else Er(Tn.gtn(1),"modulus must be greater than 1"),this.m=Tn,this.prime=null}so.prototype._verify1=function(Hr){Er(Hr.negative===0,"red works only with positives"),Er(Hr.red,"red works only with red numbers")},so.prototype._verify2=function(Hr,Xr){Er((Hr.negative|Xr.negative)===0,"red works only with positives"),Er(Hr.red&&Hr.red===Xr.red,"red works only with red numbers")},so.prototype.imod=function(Hr){return this.prime?this.prime.ireduce(Hr)._forceRed(this):(Vr(Hr,Hr.umod(this.m)._forceRed(this)),Hr)},so.prototype.neg=function(Hr){return Hr.isZero()?Hr.clone():this.m.sub(Hr)._forceRed(this)},so.prototype.add=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.add(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn._forceRed(this)},so.prototype.iadd=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.iadd(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn},so.prototype.sub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.sub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn._forceRed(this)},so.prototype.isub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.isub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn},so.prototype.shl=function(Hr,Xr){return this._verify1(Hr),this.imod(Hr.ushln(Xr))},so.prototype.imul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.imul(Xr))},so.prototype.mul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.mul(Xr))},so.prototype.isqr=function(Hr){return this.imul(Hr,Hr.clone())},so.prototype.sqr=function(Hr){return this.mul(Hr,Hr)},so.prototype.sqrt=function(Hr){if(Hr.isZero())return Hr.clone();var Xr=this.m.andln(3);if(Er(Xr%2===1),Xr===3){var Sn=this.m.add(new jr(1)).iushrn(2);return this.pow(Hr,Sn)}for(var Rn=this.m.subn(1),Pn=0;!Rn.isZero()&&Rn.andln(1)===0;)Pn++,Rn.iushrn(1);Er(!Rn.isZero());var On=new jr(1).toRed(this),Zn=On.redNeg(),Nn=this.m.subn(1).iushrn(1),wn=this.m.bitLength();for(wn=new jr(2*wn*wn).toRed(this);this.pow(wn,Nn).cmp(Zn)!==0;)wn.redIAdd(Zn);for(var zn=this.pow(wn,Rn),fo=this.pow(Hr,Rn.addn(1).iushrn(1)),vo=this.pow(Hr,Rn),go=Pn;vo.cmp(On)!==0;){for(var uo=vo,lo=0;uo.cmp(On)!==0;lo++)uo=uo.redSqr();Er(lo=0;Pn--){for(var zn=Xr.words[Pn],fo=wn-1;fo>=0;fo--){var vo=zn>>fo&1;if(On!==Rn[0]&&(On=this.sqr(On)),vo===0&&Zn===0){Nn=0;continue}Zn<<=1,Zn|=vo,Nn++,!(Nn!==Sn&&(Pn!==0||fo!==0))&&(On=this.mul(On,Rn[Zn]),Nn=0,Zn=0)}wn=26}return On},so.prototype.convertTo=function(Hr){var Xr=Hr.umod(this.m);return Xr===Hr?Xr.clone():Xr},so.prototype.convertFrom=function(Hr){var Xr=Hr.clone();return Xr.red=null,Xr},jr.mont=function(Hr){return new no(Hr)};function no(Tn){so.call(this,Tn),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new jr(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}kr(no,so),no.prototype.convertTo=function(Hr){return this.imod(Hr.ushln(this.shift))},no.prototype.convertFrom=function(Hr){var Xr=this.imod(Hr.mul(this.rinv));return Xr.red=null,Xr},no.prototype.imul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return Hr.words[0]=0,Hr.length=1,Hr;var Sn=Hr.imul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.mul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return new jr(0)._forceRed(this);var Sn=Hr.mul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.invm=function(Hr){var Xr=this.imod(Hr._invmp(this.m).mul(this.r2));return Xr._forceRed(this)}})(fr,commonjsGlobal)})(bn$1);var bnExports$1=bn$1.exports;const BN$1=getDefaultExportFromCjs$2(bnExports$1);var _Buffer$1=safeBufferExports.Buffer;function base$1(fr){if(fr.length>=255)throw new TypeError("Alphabet too long");for(var br=new Uint8Array(256),wr=0;wr>>0,jn=new Uint8Array(An);Cn!==In;){for(var eo=Qr[Cn],ro=0,to=An-1;(eo!==0||ro>>0,jn[to]=eo%Br>>>0,eo=eo/Br>>>0;if(eo!==0)throw new Error("Non-zero carry");En=ro,Cn++}for(var _i=An-En;_i!==An&&jn[_i]===0;)_i++;for(var oo=Wr.repeat(_n);_i>>0,An=new Uint8Array(In);_n>>0,An[ro]=jn%256>>>0,jn=jn/256>>>0;if(jn!==0)throw new Error("Non-zero carry");Cn=eo,_n++}for(var to=In-Cn;to!==In&&An[to]===0;)to++;var _i=_Buffer$1.allocUnsafe(En+(In-to));_i.fill(0,0,En);for(var oo=En;to!==In;)_i[oo++]=An[to++];return _i}function Jr(Qr){var _n=Zr(Qr);if(_n)return _n;throw new Error("Non-base"+Br+" character")}return{encode:Vr,decodeUnsafe:Zr,decode:Jr}}var src$1=base$1,basex$1=src$1,ALPHABET$1="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58$2=basex$1(ALPHABET$1);const bs58$3=getDefaultExportFromCjs$2(bs58$2);let StructError$1=class extends TypeError{constructor(br,wr){let Er;const{message:kr,explanation:jr,...Br}=br,{path:Wr}=br,qr=Wr.length===0?kr:`At path: ${Wr.join(".")} -- ${kr}`;super(jr??qr),jr!=null&&(this.cause=qr),Object.assign(this,Br),this.name=this.constructor.name,this.failures=()=>Er??(Er=[br,...wr()])}};function isIterable$1(fr){return isObject$1(fr)&&typeof fr[Symbol.iterator]=="function"}function isObject$1(fr){return typeof fr=="object"&&fr!=null}function isNonArrayObject$1(fr){return isObject$1(fr)&&!Array.isArray(fr)}function print$1(fr){return typeof fr=="symbol"?fr.toString():typeof fr=="string"?JSON.stringify(fr):`${fr}`}function shiftIterator$1(fr){const{done:br,value:wr}=fr.next();return br?void 0:wr}function toFailure$1(fr,br,wr,Er){if(fr===!0)return;fr===!1?fr={}:typeof fr=="string"&&(fr={message:fr});const{path:kr,branch:jr}=br,{type:Br}=wr,{refinement:Wr,message:qr=`Expected a value of type \`${Br}\`${Wr?` with refinement \`${Wr}\``:""}, but received: \`${print$1(Er)}\``}=fr;return{value:Er,type:Br,refinement:Wr,key:kr[kr.length-1],path:kr,branch:jr,...fr,message:qr}}function*toFailures$1(fr,br,wr,Er){isIterable$1(fr)||(fr=[fr]);for(const kr of fr){const jr=toFailure$1(kr,br,wr,Er);jr&&(yield jr)}}function*run$1(fr,br,wr={}){const{path:Er=[],branch:kr=[fr],coerce:jr=!1,mask:Br=!1}=wr,Wr={path:Er,branch:kr,mask:Br};jr&&(fr=br.coercer(fr,Wr));let qr="valid";for(const Gr of br.validator(fr,Wr))Gr.explanation=wr.message,qr="not_valid",yield[Gr,void 0];for(let[Gr,Vr,Zr]of br.entries(fr,Wr)){const Jr=run$1(Vr,Zr,{path:Gr===void 0?Er:[...Er,Gr],branch:Gr===void 0?kr:[...kr,Vr],coerce:jr,mask:Br,message:wr.message});for(const Qr of Jr)Qr[0]?(qr=Qr[0].refinement!=null?"not_refined":"not_valid",yield[Qr[0],void 0]):jr&&(Vr=Qr[1],Gr===void 0?fr=Vr:fr instanceof Map?fr.set(Gr,Vr):fr instanceof Set?fr.add(Vr):isObject$1(fr)&&(Vr!==void 0||Gr in fr)&&(fr[Gr]=Vr))}if(qr!=="not_valid")for(const Gr of br.refiner(fr,Wr))Gr.explanation=wr.message,qr="not_refined",yield[Gr,void 0];qr==="valid"&&(yield[void 0,fr])}let Struct$3=class{constructor(br){const{type:wr,schema:Er,validator:kr,refiner:jr,coercer:Br=qr=>qr,entries:Wr=function*(){}}=br;this.type=wr,this.schema=Er,this.entries=Wr,this.coercer=Br,kr?this.validator=(qr,Gr)=>{const Vr=kr(qr,Gr);return toFailures$1(Vr,Gr,this,qr)}:this.validator=()=>[],jr?this.refiner=(qr,Gr)=>{const Vr=jr(qr,Gr);return toFailures$1(Vr,Gr,this,qr)}:this.refiner=()=>[]}assert(br,wr){return assert$1(br,this,wr)}create(br,wr){return create$1(br,this,wr)}is(br){return is$1(br,this)}mask(br,wr){return mask$1(br,this,wr)}validate(br,wr={}){return validate$1(br,this,wr)}};function assert$1(fr,br,wr){const Er=validate$1(fr,br,{message:wr});if(Er[0])throw Er[0]}function create$1(fr,br,wr){const Er=validate$1(fr,br,{coerce:!0,message:wr});if(Er[0])throw Er[0];return Er[1]}function mask$1(fr,br,wr){const Er=validate$1(fr,br,{coerce:!0,mask:!0,message:wr});if(Er[0])throw Er[0];return Er[1]}function is$1(fr,br){return!validate$1(fr,br)[0]}function validate$1(fr,br,wr={}){const Er=run$1(fr,br,wr),kr=shiftIterator$1(Er);return kr[0]?[new StructError$1(kr[0],function*(){for(const Br of Er)Br[0]&&(yield Br[0])}),void 0]:[void 0,kr[1]]}function define$1(fr,br){return new Struct$3({type:fr,schema:null,validator:br})}function any$1(){return define$1("any",()=>!0)}function array$1(fr){return new Struct$3({type:"array",schema:fr,*entries(br){if(fr&&Array.isArray(br))for(const[wr,Er]of br.entries())yield[wr,Er,fr]},coercer(br){return Array.isArray(br)?br.slice():br},validator(br){return Array.isArray(br)||`Expected an array value, but received: ${print$1(br)}`}})}function boolean$1(){return define$1("boolean",fr=>typeof fr=="boolean")}function instance$1(fr){return define$1("instance",br=>br instanceof fr||`Expected a \`${fr.name}\` instance, but received: ${print$1(br)}`)}function literal$1(fr){const br=print$1(fr),wr=typeof fr;return new Struct$3({type:"literal",schema:wr==="string"||wr==="number"||wr==="boolean"?fr:null,validator(Er){return Er===fr||`Expected the literal \`${br}\`, but received: ${print$1(Er)}`}})}function never$1(){return define$1("never",()=>!1)}function nullable$1(fr){return new Struct$3({...fr,validator:(br,wr)=>br===null||fr.validator(br,wr),refiner:(br,wr)=>br===null||fr.refiner(br,wr)})}function number$1(){return define$1("number",fr=>typeof fr=="number"&&!isNaN(fr)||`Expected a number, but received: ${print$1(fr)}`)}function optional$1(fr){return new Struct$3({...fr,validator:(br,wr)=>br===void 0||fr.validator(br,wr),refiner:(br,wr)=>br===void 0||fr.refiner(br,wr)})}function record$1(fr,br){return new Struct$3({type:"record",schema:null,*entries(wr){if(isObject$1(wr))for(const Er in wr){const kr=wr[Er];yield[Er,Er,fr],yield[Er,kr,br]}},validator(wr){return isNonArrayObject$1(wr)||`Expected an object, but received: ${print$1(wr)}`},coercer(wr){return isNonArrayObject$1(wr)?{...wr}:wr}})}function string$1(){return define$1("string",fr=>typeof fr=="string"||`Expected a string, but received: ${print$1(fr)}`)}function tuple$1(fr){const br=never$1();return new Struct$3({type:"tuple",schema:null,*entries(wr){if(Array.isArray(wr)){const Er=Math.max(fr.length,wr.length);for(let kr=0;krwr.type).join(" | ");return new Struct$3({type:"union",schema:null,coercer(wr,Er){for(const kr of fr){const[jr,Br]=kr.validate(wr,{coerce:!0,mask:Er.mask});if(!jr)return Br}return wr},validator(wr,Er){const kr=[];for(const jr of fr){const[...Br]=run$1(wr,jr,Er),[Wr]=Br;if(Wr[0])for(const[qr]of Br)qr&&kr.push(qr);else return[]}return[`Expected the value to satisfy a union of \`${br}\`, but received: ${print$1(wr)}`,...kr]}})}function unknown$1(){return define$1("unknown",()=>!0)}function coerce$1(fr,br,wr){return new Struct$3({...fr,coercer:(Er,kr)=>is$1(Er,br)?fr.coercer(wr(Er,kr),kr):fr.coercer(Er,kr)})}function isOnCurve$1(fr){try{return ed25519.ExtendedPoint.fromHex(fr),!0}catch{return!1}}const toBuffer$1=fr=>Buffer$1$1.isBuffer(fr)?fr:fr instanceof Uint8Array?Buffer$1$1.from(fr.buffer,fr.byteOffset,fr.byteLength):Buffer$1$1.from(fr);let Struct$2=class{constructor(br){Object.assign(this,br)}encode(){return Buffer$1$1.from(serialize_1(SOLANA_SCHEMA$1,this))}static decode(br){return deserialize_1(SOLANA_SCHEMA$1,this,br)}static decodeUnchecked(br){return deserializeUnchecked_1(SOLANA_SCHEMA$1,this,br)}};const SOLANA_SCHEMA$1=new Map;var _PublicKey$1;const MAX_SEED_LENGTH$1=32,PUBLIC_KEY_LENGTH$1=32;function isPublicKeyData$1(fr){return fr._bn!==void 0}let uniquePublicKeyCounter$1=1,PublicKey$1=class f1 extends Struct$2{constructor(br){if(super({}),this._bn=void 0,isPublicKeyData$1(br))this._bn=br._bn;else{if(typeof br=="string"){const wr=bs58$3.decode(br);if(wr.length!=PUBLIC_KEY_LENGTH$1)throw new Error("Invalid public key input");this._bn=new BN$1(wr)}else this._bn=new BN$1(br);if(this._bn.byteLength()>PUBLIC_KEY_LENGTH$1)throw new Error("Invalid public key input")}}static unique(){const br=new f1(uniquePublicKeyCounter$1);return uniquePublicKeyCounter$1+=1,new f1(br.toBuffer())}equals(br){return this._bn.eq(br._bn)}toBase58(){return bs58$3.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const br=this.toBuffer();return new Uint8Array(br.buffer,br.byteOffset,br.byteLength)}toBuffer(){const br=this._bn.toArrayLike(Buffer$1$1);if(br.length===PUBLIC_KEY_LENGTH$1)return br;const wr=Buffer$1$1.alloc(32);return br.copy(wr,32-br.length),wr}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(br,wr,Er){const kr=Buffer$1$1.concat([br.toBuffer(),Buffer$1$1.from(wr),Er.toBuffer()]),jr=sha256$4(kr);return new f1(jr)}static createProgramAddressSync(br,wr){let Er=Buffer$1$1.alloc(0);br.forEach(function(jr){if(jr.length>MAX_SEED_LENGTH$1)throw new TypeError("Max seed length exceeded");Er=Buffer$1$1.concat([Er,toBuffer$1(jr)])}),Er=Buffer$1$1.concat([Er,wr.toBuffer(),Buffer$1$1.from("ProgramDerivedAddress")]);const kr=sha256$4(Er);if(isOnCurve$1(kr))throw new Error("Invalid seeds, address must fall off the curve");return new f1(kr)}static async createProgramAddress(br,wr){return this.createProgramAddressSync(br,wr)}static findProgramAddressSync(br,wr){let Er=255,kr;for(;Er!=0;){try{const jr=br.concat(Buffer$1$1.from([Er]));kr=this.createProgramAddressSync(jr,wr)}catch(jr){if(jr instanceof TypeError)throw jr;Er--;continue}return[kr,Er]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(br,wr){return this.findProgramAddressSync(br,wr)}static isOnCurve(br){const wr=new f1(br);return isOnCurve$1(wr.toBytes())}};_PublicKey$1=PublicKey$1;PublicKey$1.default=new _PublicKey$1("11111111111111111111111111111111");SOLANA_SCHEMA$1.set(PublicKey$1,{kind:"struct",fields:[["_bn","u256"]]});new PublicKey$1("BPFLoader1111111111111111111111111111111111");const SIGNATURE_LENGTH_IN_BYTES$1=64,publicKey$2=(fr="publicKey")=>blob(32,fr),rustString$1=(fr="string")=>{const br=struct([u32("length"),u32("lengthPadding"),blob(offset(u32(),-8),"chars")],fr),wr=br.decode.bind(br),Er=br.encode.bind(br),kr=br;return kr.decode=(jr,Br)=>wr(jr,Br).chars.toString(),kr.encode=(jr,Br,Wr)=>{const qr={chars:Buffer$1$1.from(jr,"utf8")};return Er(qr,Br,Wr)},kr.alloc=jr=>u32().span+u32().span+Buffer$1$1.from(jr,"utf8").length,kr},authorized$1=(fr="authorized")=>struct([publicKey$2("staker"),publicKey$2("withdrawer")],fr),lockup$1=(fr="lockup")=>struct([ns64("unixTimestamp"),ns64("epoch"),publicKey$2("custodian")],fr),voteInit$1=(fr="voteInit")=>struct([publicKey$2("nodePubkey"),publicKey$2("authorizedVoter"),publicKey$2("authorizedWithdrawer"),u8("commission")],fr),voteAuthorizeWithSeedArgs$1=(fr="voteAuthorizeWithSeedArgs")=>struct([u32("voteAuthorizationType"),publicKey$2("currentAuthorityDerivedKeyOwnerPubkey"),rustString$1("currentAuthorityDerivedKeySeed"),publicKey$2("newAuthorized")],fr);Buffer$1$1.alloc(SIGNATURE_LENGTH_IN_BYTES$1).fill(0);new PublicKey$1("SysvarC1ock11111111111111111111111111111111");new PublicKey$1("SysvarEpochSchedu1e111111111111111111111111");new PublicKey$1("Sysvar1nstructions1111111111111111111111111");new PublicKey$1("SysvarRecentB1ockHashes11111111111111111111");new PublicKey$1("SysvarRent111111111111111111111111111111111");new PublicKey$1("SysvarRewards111111111111111111111111111111");new PublicKey$1("SysvarS1otHashes111111111111111111111111111");new PublicKey$1("SysvarS1otHistory11111111111111111111111111");new PublicKey$1("SysvarStakeHistory1111111111111111111111111");const FeeCalculatorLayout$1=nu64("lamportsPerSignature"),NonceAccountLayout$1=struct([u32("version"),u32("state"),publicKey$2("authorizedPubkey"),publicKey$2("nonce"),struct([FeeCalculatorLayout$1],"feeCalculator")]);NonceAccountLayout$1.span;const encodeDecode$1=fr=>{const br=fr.decode.bind(fr),wr=fr.encode.bind(fr);return{decode:br,encode:wr}},bigInt$1=fr=>br=>{const wr=blob(fr,br),{encode:Er,decode:kr}=encodeDecode$1(wr),jr=wr;return jr.decode=(Br,Wr)=>{const qr=kr(Br,Wr);return toBigIntLE_1(Buffer$1$1.from(qr))},jr.encode=(Br,Wr,qr)=>{const Gr=toBufferLE_1(Br,fr);return Er(Gr,Wr,qr)},jr},u64$1=bigInt$1(8);Object.freeze({Create:{index:0,layout:struct([u32("instruction"),ns64("lamports"),ns64("space"),publicKey$2("programId")])},Assign:{index:1,layout:struct([u32("instruction"),publicKey$2("programId")])},Transfer:{index:2,layout:struct([u32("instruction"),u64$1("lamports")])},CreateWithSeed:{index:3,layout:struct([u32("instruction"),publicKey$2("base"),rustString$1("seed"),ns64("lamports"),ns64("space"),publicKey$2("programId")])},AdvanceNonceAccount:{index:4,layout:struct([u32("instruction")])},WithdrawNonceAccount:{index:5,layout:struct([u32("instruction"),ns64("lamports")])},InitializeNonceAccount:{index:6,layout:struct([u32("instruction"),publicKey$2("authorized")])},AuthorizeNonceAccount:{index:7,layout:struct([u32("instruction"),publicKey$2("authorized")])},Allocate:{index:8,layout:struct([u32("instruction"),ns64("space")])},AllocateWithSeed:{index:9,layout:struct([u32("instruction"),publicKey$2("base"),rustString$1("seed"),ns64("space"),publicKey$2("programId")])},AssignWithSeed:{index:10,layout:struct([u32("instruction"),publicKey$2("base"),rustString$1("seed"),publicKey$2("programId")])},TransferWithSeed:{index:11,layout:struct([u32("instruction"),u64$1("lamports"),rustString$1("seed"),publicKey$2("programId")])},UpgradeNonceAccount:{index:12,layout:struct([u32("instruction")])}});new PublicKey$1("11111111111111111111111111111111");new PublicKey$1("BPFLoader2111111111111111111111111111111111");struct([u32("typeIndex"),u64$1("deactivationSlot"),nu64("lastExtendedSlot"),u8("lastExtendedStartIndex"),u8(),seq(publicKey$2(),offset(u8(),-1),"authority")]);const PublicKeyFromString$1=coerce$1(instance$1(PublicKey$1),string$1(),fr=>new PublicKey$1(fr)),RawAccountDataResult$1=tuple$1([string$1(),literal$1("base64")]),BufferFromRawAccountData$1=coerce$1(instance$1(Buffer$1$1),RawAccountDataResult$1,fr=>Buffer$1$1.from(fr[0],"base64"));function createRpcResult$1(fr){return union$1([type$1({jsonrpc:literal$1("2.0"),id:string$1(),result:fr}),type$1({jsonrpc:literal$1("2.0"),id:string$1(),error:type$1({code:unknown$1(),message:string$1(),data:optional$1(any$1())})})])}const UnknownRpcResult$1=createRpcResult$1(unknown$1());function jsonRpcResult$1(fr){return coerce$1(createRpcResult$1(fr),UnknownRpcResult$1,br=>"error"in br?br:{...br,result:create$1(br.result,fr)})}function jsonRpcResultAndContext$1(fr){return jsonRpcResult$1(type$1({context:type$1({slot:number$1()}),value:fr}))}function notificationResultAndContext$1(fr){return type$1({context:type$1({slot:number$1()}),value:fr})}const GetInflationGovernorResult$1=type$1({foundation:number$1(),foundationTerm:number$1(),initial:number$1(),taper:number$1(),terminal:number$1()});jsonRpcResult$1(array$1(nullable$1(type$1({epoch:number$1(),effectiveSlot:number$1(),amount:number$1(),postBalance:number$1(),commission:optional$1(nullable$1(number$1()))}))));const GetRecentPrioritizationFeesResult$1=array$1(type$1({slot:number$1(),prioritizationFee:number$1()})),GetInflationRateResult$1=type$1({total:number$1(),validator:number$1(),foundation:number$1(),epoch:number$1()}),GetEpochInfoResult$1=type$1({epoch:number$1(),slotIndex:number$1(),slotsInEpoch:number$1(),absoluteSlot:number$1(),blockHeight:optional$1(number$1()),transactionCount:optional$1(number$1())}),GetEpochScheduleResult$1=type$1({slotsPerEpoch:number$1(),leaderScheduleSlotOffset:number$1(),warmup:boolean$1(),firstNormalEpoch:number$1(),firstNormalSlot:number$1()}),GetLeaderScheduleResult$1=record$1(string$1(),array$1(number$1())),TransactionErrorResult$1=nullable$1(union$1([type$1({}),string$1()])),SignatureStatusResult$1=type$1({err:TransactionErrorResult$1}),SignatureReceivedResult$1=literal$1("receivedSignature");type$1({"solana-core":string$1(),"feature-set":optional$1(number$1())});const ParsedInstructionStruct$1=type$1({program:string$1(),programId:PublicKeyFromString$1,parsed:unknown$1()}),PartiallyDecodedInstructionStruct$1=type$1({programId:PublicKeyFromString$1,accounts:array$1(PublicKeyFromString$1),data:string$1()});jsonRpcResultAndContext$1(type$1({err:nullable$1(union$1([type$1({}),string$1()])),logs:nullable$1(array$1(string$1())),accounts:optional$1(nullable$1(array$1(nullable$1(type$1({executable:boolean$1(),owner:string$1(),lamports:number$1(),data:array$1(string$1()),rentEpoch:optional$1(number$1())}))))),unitsConsumed:optional$1(number$1()),returnData:optional$1(nullable$1(type$1({programId:string$1(),data:tuple$1([string$1(),literal$1("base64")])}))),innerInstructions:optional$1(nullable$1(array$1(type$1({index:number$1(),instructions:array$1(union$1([ParsedInstructionStruct$1,PartiallyDecodedInstructionStruct$1]))}))))}));jsonRpcResultAndContext$1(type$1({byIdentity:record$1(string$1(),array$1(number$1())),range:type$1({firstSlot:number$1(),lastSlot:number$1()})}));jsonRpcResult$1(GetInflationGovernorResult$1);jsonRpcResult$1(GetInflationRateResult$1);jsonRpcResult$1(GetRecentPrioritizationFeesResult$1);jsonRpcResult$1(GetEpochInfoResult$1);jsonRpcResult$1(GetEpochScheduleResult$1);jsonRpcResult$1(GetLeaderScheduleResult$1);jsonRpcResult$1(number$1());jsonRpcResultAndContext$1(type$1({total:number$1(),circulating:number$1(),nonCirculating:number$1(),nonCirculatingAccounts:array$1(PublicKeyFromString$1)}));const TokenAmountResult$1=type$1({amount:string$1(),uiAmount:nullable$1(number$1()),decimals:number$1(),uiAmountString:optional$1(string$1())});jsonRpcResultAndContext$1(array$1(type$1({address:PublicKeyFromString$1,amount:string$1(),uiAmount:nullable$1(number$1()),decimals:number$1(),uiAmountString:optional$1(string$1())})));jsonRpcResultAndContext$1(array$1(type$1({pubkey:PublicKeyFromString$1,account:type$1({executable:boolean$1(),owner:PublicKeyFromString$1,lamports:number$1(),data:BufferFromRawAccountData$1,rentEpoch:number$1()})})));const ParsedAccountDataResult$1=type$1({program:string$1(),parsed:unknown$1(),space:number$1()});jsonRpcResultAndContext$1(array$1(type$1({pubkey:PublicKeyFromString$1,account:type$1({executable:boolean$1(),owner:PublicKeyFromString$1,lamports:number$1(),data:ParsedAccountDataResult$1,rentEpoch:number$1()})})));jsonRpcResultAndContext$1(array$1(type$1({lamports:number$1(),address:PublicKeyFromString$1})));const AccountInfoResult$1=type$1({executable:boolean$1(),owner:PublicKeyFromString$1,lamports:number$1(),data:BufferFromRawAccountData$1,rentEpoch:number$1()});type$1({pubkey:PublicKeyFromString$1,account:AccountInfoResult$1});const ParsedOrRawAccountData$1=coerce$1(union$1([instance$1(Buffer$1$1),ParsedAccountDataResult$1]),union$1([RawAccountDataResult$1,ParsedAccountDataResult$1]),fr=>Array.isArray(fr)?create$1(fr,BufferFromRawAccountData$1):fr),ParsedAccountInfoResult$1=type$1({executable:boolean$1(),owner:PublicKeyFromString$1,lamports:number$1(),data:ParsedOrRawAccountData$1,rentEpoch:number$1()});type$1({pubkey:PublicKeyFromString$1,account:ParsedAccountInfoResult$1});type$1({state:union$1([literal$1("active"),literal$1("inactive"),literal$1("activating"),literal$1("deactivating")]),active:number$1(),inactive:number$1()});jsonRpcResult$1(array$1(type$1({signature:string$1(),slot:number$1(),err:TransactionErrorResult$1,memo:nullable$1(string$1()),blockTime:optional$1(nullable$1(number$1()))})));jsonRpcResult$1(array$1(type$1({signature:string$1(),slot:number$1(),err:TransactionErrorResult$1,memo:nullable$1(string$1()),blockTime:optional$1(nullable$1(number$1()))})));type$1({subscription:number$1(),result:notificationResultAndContext$1(AccountInfoResult$1)});const ProgramAccountInfoResult$1=type$1({pubkey:PublicKeyFromString$1,account:AccountInfoResult$1});type$1({subscription:number$1(),result:notificationResultAndContext$1(ProgramAccountInfoResult$1)});const SlotInfoResult$1=type$1({parent:number$1(),slot:number$1(),root:number$1()});type$1({subscription:number$1(),result:SlotInfoResult$1});const SlotUpdateResult$1=union$1([type$1({type:union$1([literal$1("firstShredReceived"),literal$1("completed"),literal$1("optimisticConfirmation"),literal$1("root")]),slot:number$1(),timestamp:number$1()}),type$1({type:literal$1("createdBank"),parent:number$1(),slot:number$1(),timestamp:number$1()}),type$1({type:literal$1("frozen"),slot:number$1(),timestamp:number$1(),stats:type$1({numTransactionEntries:number$1(),numSuccessfulTransactions:number$1(),numFailedTransactions:number$1(),maxTransactionsPerEntry:number$1()})}),type$1({type:literal$1("dead"),slot:number$1(),timestamp:number$1(),err:string$1()})]);type$1({subscription:number$1(),result:SlotUpdateResult$1});type$1({subscription:number$1(),result:notificationResultAndContext$1(union$1([SignatureStatusResult$1,SignatureReceivedResult$1]))});type$1({subscription:number$1(),result:number$1()});type$1({pubkey:string$1(),gossip:nullable$1(string$1()),tpu:nullable$1(string$1()),rpc:nullable$1(string$1()),version:nullable$1(string$1())});const VoteAccountInfoResult$1=type$1({votePubkey:string$1(),nodePubkey:string$1(),activatedStake:number$1(),epochVoteAccount:boolean$1(),epochCredits:array$1(tuple$1([number$1(),number$1(),number$1()])),commission:number$1(),lastVote:number$1(),rootSlot:nullable$1(number$1())});jsonRpcResult$1(type$1({current:array$1(VoteAccountInfoResult$1),delinquent:array$1(VoteAccountInfoResult$1)}));const ConfirmationStatus$1=union$1([literal$1("processed"),literal$1("confirmed"),literal$1("finalized")]),SignatureStatusResponse$1=type$1({slot:number$1(),confirmations:nullable$1(number$1()),err:TransactionErrorResult$1,confirmationStatus:optional$1(ConfirmationStatus$1)});jsonRpcResultAndContext$1(array$1(nullable$1(SignatureStatusResponse$1)));jsonRpcResult$1(number$1());const AddressTableLookupStruct$1=type$1({accountKey:PublicKeyFromString$1,writableIndexes:array$1(number$1()),readonlyIndexes:array$1(number$1())}),ConfirmedTransactionResult$1=type$1({signatures:array$1(string$1()),message:type$1({accountKeys:array$1(string$1()),header:type$1({numRequiredSignatures:number$1(),numReadonlySignedAccounts:number$1(),numReadonlyUnsignedAccounts:number$1()}),instructions:array$1(type$1({accounts:array$1(number$1()),data:string$1(),programIdIndex:number$1()})),recentBlockhash:string$1(),addressTableLookups:optional$1(array$1(AddressTableLookupStruct$1))})}),AnnotatedAccountKey$1=type$1({pubkey:PublicKeyFromString$1,signer:boolean$1(),writable:boolean$1(),source:optional$1(union$1([literal$1("transaction"),literal$1("lookupTable")]))}),ConfirmedTransactionAccountsModeResult$1=type$1({accountKeys:array$1(AnnotatedAccountKey$1),signatures:array$1(string$1())}),ParsedInstructionResult$1=type$1({parsed:unknown$1(),program:string$1(),programId:PublicKeyFromString$1}),RawInstructionResult$1=type$1({accounts:array$1(PublicKeyFromString$1),data:string$1(),programId:PublicKeyFromString$1}),InstructionResult$1=union$1([RawInstructionResult$1,ParsedInstructionResult$1]),UnknownInstructionResult$1=union$1([type$1({parsed:unknown$1(),program:string$1(),programId:string$1()}),type$1({accounts:array$1(string$1()),data:string$1(),programId:string$1()})]),ParsedOrRawInstruction$1=coerce$1(InstructionResult$1,UnknownInstructionResult$1,fr=>"accounts"in fr?create$1(fr,RawInstructionResult$1):create$1(fr,ParsedInstructionResult$1)),ParsedConfirmedTransactionResult$1=type$1({signatures:array$1(string$1()),message:type$1({accountKeys:array$1(AnnotatedAccountKey$1),instructions:array$1(ParsedOrRawInstruction$1),recentBlockhash:string$1(),addressTableLookups:optional$1(nullable$1(array$1(AddressTableLookupStruct$1)))})}),TokenBalanceResult$1=type$1({accountIndex:number$1(),mint:string$1(),owner:optional$1(string$1()),programId:optional$1(string$1()),uiTokenAmount:TokenAmountResult$1}),LoadedAddressesResult$1=type$1({writable:array$1(PublicKeyFromString$1),readonly:array$1(PublicKeyFromString$1)}),ConfirmedTransactionMetaResult$1=type$1({err:TransactionErrorResult$1,fee:number$1(),innerInstructions:optional$1(nullable$1(array$1(type$1({index:number$1(),instructions:array$1(type$1({accounts:array$1(number$1()),data:string$1(),programIdIndex:number$1()}))})))),preBalances:array$1(number$1()),postBalances:array$1(number$1()),logMessages:optional$1(nullable$1(array$1(string$1()))),preTokenBalances:optional$1(nullable$1(array$1(TokenBalanceResult$1))),postTokenBalances:optional$1(nullable$1(array$1(TokenBalanceResult$1))),loadedAddresses:optional$1(LoadedAddressesResult$1),computeUnitsConsumed:optional$1(number$1())}),ParsedConfirmedTransactionMetaResult$1=type$1({err:TransactionErrorResult$1,fee:number$1(),innerInstructions:optional$1(nullable$1(array$1(type$1({index:number$1(),instructions:array$1(ParsedOrRawInstruction$1)})))),preBalances:array$1(number$1()),postBalances:array$1(number$1()),logMessages:optional$1(nullable$1(array$1(string$1()))),preTokenBalances:optional$1(nullable$1(array$1(TokenBalanceResult$1))),postTokenBalances:optional$1(nullable$1(array$1(TokenBalanceResult$1))),loadedAddresses:optional$1(LoadedAddressesResult$1),computeUnitsConsumed:optional$1(number$1())}),TransactionVersionStruct$1=union$1([literal$1(0),literal$1("legacy")]),RewardsResult$1=type$1({pubkey:string$1(),lamports:number$1(),postBalance:nullable$1(number$1()),rewardType:nullable$1(string$1()),commission:optional$1(nullable$1(number$1()))});jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$1(),transactions:array$1(type$1({transaction:ConfirmedTransactionResult$1,meta:nullable$1(ConfirmedTransactionMetaResult$1),version:optional$1(TransactionVersionStruct$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$1()),blockHeight:nullable$1(number$1())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$1(),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$1()),blockHeight:nullable$1(number$1())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$1(),transactions:array$1(type$1({transaction:ConfirmedTransactionAccountsModeResult$1,meta:nullable$1(ConfirmedTransactionMetaResult$1),version:optional$1(TransactionVersionStruct$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$1()),blockHeight:nullable$1(number$1())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$1(),transactions:array$1(type$1({transaction:ParsedConfirmedTransactionResult$1,meta:nullable$1(ParsedConfirmedTransactionMetaResult$1),version:optional$1(TransactionVersionStruct$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$1()),blockHeight:nullable$1(number$1())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$1(),transactions:array$1(type$1({transaction:ConfirmedTransactionAccountsModeResult$1,meta:nullable$1(ParsedConfirmedTransactionMetaResult$1),version:optional$1(TransactionVersionStruct$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$1()),blockHeight:nullable$1(number$1())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$1(),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$1()),blockHeight:nullable$1(number$1())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$1(),transactions:array$1(type$1({transaction:ConfirmedTransactionResult$1,meta:nullable$1(ConfirmedTransactionMetaResult$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$1())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$1(),signatures:array$1(string$1()),blockTime:nullable$1(number$1())})));jsonRpcResult$1(nullable$1(type$1({slot:number$1(),meta:nullable$1(ConfirmedTransactionMetaResult$1),blockTime:optional$1(nullable$1(number$1())),transaction:ConfirmedTransactionResult$1,version:optional$1(TransactionVersionStruct$1)})));jsonRpcResult$1(nullable$1(type$1({slot:number$1(),transaction:ParsedConfirmedTransactionResult$1,meta:nullable$1(ParsedConfirmedTransactionMetaResult$1),blockTime:optional$1(nullable$1(number$1())),version:optional$1(TransactionVersionStruct$1)})));jsonRpcResultAndContext$1(type$1({blockhash:string$1(),feeCalculator:type$1({lamportsPerSignature:number$1()})}));jsonRpcResultAndContext$1(type$1({blockhash:string$1(),lastValidBlockHeight:number$1()}));jsonRpcResultAndContext$1(boolean$1());const PerfSampleResult$1=type$1({slot:number$1(),numTransactions:number$1(),numSlots:number$1(),samplePeriodSecs:number$1()});jsonRpcResult$1(array$1(PerfSampleResult$1));jsonRpcResultAndContext$1(nullable$1(type$1({feeCalculator:type$1({lamportsPerSignature:number$1()})})));jsonRpcResult$1(string$1());jsonRpcResult$1(string$1());const LogsResult$1=type$1({err:TransactionErrorResult$1,logs:array$1(string$1()),signature:string$1()});type$1({result:notificationResultAndContext$1(LogsResult$1),subscription:number$1()});Object.freeze({CreateLookupTable:{index:0,layout:struct([u32("instruction"),u64$1("recentSlot"),u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:struct([u32("instruction")])},ExtendLookupTable:{index:2,layout:struct([u32("instruction"),u64$1(),seq(publicKey$2(),offset(u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:struct([u32("instruction")])},CloseLookupTable:{index:4,layout:struct([u32("instruction")])}});new PublicKey$1("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:struct([u8("instruction"),u32("units"),u32("additionalFee")])},RequestHeapFrame:{index:1,layout:struct([u8("instruction"),u32("bytes")])},SetComputeUnitLimit:{index:2,layout:struct([u8("instruction"),u32("units")])},SetComputeUnitPrice:{index:3,layout:struct([u8("instruction"),u64$1("microLamports")])}});new PublicKey$1("ComputeBudget111111111111111111111111111111");struct([u8("numSignatures"),u8("padding"),u16("signatureOffset"),u16("signatureInstructionIndex"),u16("publicKeyOffset"),u16("publicKeyInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u16("messageInstructionIndex")]);new PublicKey$1("Ed25519SigVerify111111111111111111111111111");secp256k1$1.utils.isValidPrivateKey;secp256k1$1.getPublicKey;struct([u8("numSignatures"),u16("signatureOffset"),u8("signatureInstructionIndex"),u16("ethAddressOffset"),u8("ethAddressInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u8("messageInstructionIndex"),blob(20,"ethAddress"),blob(64,"signature"),u8("recoveryId")]);new PublicKey$1("KeccakSecp256k11111111111111111111111111111");var _Lockup$1;new PublicKey$1("StakeConfig11111111111111111111111111111111");let Lockup$1=class{constructor(br,wr,Er){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=br,this.epoch=wr,this.custodian=Er}};_Lockup$1=Lockup$1;Lockup$1.default=new _Lockup$1(0,0,PublicKey$1.default);Object.freeze({Initialize:{index:0,layout:struct([u32("instruction"),authorized$1(),lockup$1()])},Authorize:{index:1,layout:struct([u32("instruction"),publicKey$2("newAuthorized"),u32("stakeAuthorizationType")])},Delegate:{index:2,layout:struct([u32("instruction")])},Split:{index:3,layout:struct([u32("instruction"),ns64("lamports")])},Withdraw:{index:4,layout:struct([u32("instruction"),ns64("lamports")])},Deactivate:{index:5,layout:struct([u32("instruction")])},Merge:{index:7,layout:struct([u32("instruction")])},AuthorizeWithSeed:{index:8,layout:struct([u32("instruction"),publicKey$2("newAuthorized"),u32("stakeAuthorizationType"),rustString$1("authoritySeed"),publicKey$2("authorityOwner")])}});new PublicKey$1("Stake11111111111111111111111111111111111111");Object.freeze({InitializeAccount:{index:0,layout:struct([u32("instruction"),voteInit$1()])},Authorize:{index:1,layout:struct([u32("instruction"),publicKey$2("newAuthorized"),u32("voteAuthorizationType")])},Withdraw:{index:3,layout:struct([u32("instruction"),ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:struct([u32("instruction")])},AuthorizeWithSeed:{index:10,layout:struct([u32("instruction"),voteAuthorizeWithSeedArgs$1()])}});new PublicKey$1("Vote111111111111111111111111111111111111111");new PublicKey$1("Va1idator1nfo111111111111111111111111111111");type$1({name:string$1(),website:optional$1(string$1()),details:optional$1(string$1()),iconUrl:optional$1(string$1()),keybaseUsername:optional$1(string$1())});new PublicKey$1("Vote111111111111111111111111111111111111111");struct([publicKey$2("nodePubkey"),publicKey$2("authorizedWithdrawer"),u8("commission"),nu64(),seq(struct([nu64("slot"),u32("confirmationCount")]),offset(u32(),-8),"votes"),u8("rootSlotValid"),nu64("rootSlot"),nu64(),seq(struct([nu64("epoch"),publicKey$2("authorizedVoter")]),offset(u32(),-8),"authorizedVoters"),struct([seq(struct([publicKey$2("authorizedPubkey"),nu64("epochOfLastAuthorizedSwitch"),nu64("targetEpoch")]),32,"buf"),nu64("idx"),u8("isEmpty")],"priorVoters"),nu64(),seq(struct([nu64("epoch"),nu64("credits"),nu64("prevCredits")]),offset(u32(),-8),"epochCredits"),struct([nu64("slot"),nu64("timestamp")],"lastTimestamp")]);const publicKey$1=fr=>{const br=blob(32,fr),{encode:wr,decode:Er}=encodeDecode$2(br),kr=br;return kr.decode=(jr,Br)=>{const Wr=Er(jr,Br);return new PublicKey$1(Wr)},kr.encode=(jr,Br,Wr)=>{const qr=jr.toBuffer();return wr(qr,Br,Wr)},kr};class TokenError extends Error{constructor(br){super(br)}}class TokenOwnerOffCurveError extends TokenError{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var TokenInstruction;(function(fr){fr[fr.InitializeMint=0]="InitializeMint",fr[fr.InitializeAccount=1]="InitializeAccount",fr[fr.InitializeMultisig=2]="InitializeMultisig",fr[fr.Transfer=3]="Transfer",fr[fr.Approve=4]="Approve",fr[fr.Revoke=5]="Revoke",fr[fr.SetAuthority=6]="SetAuthority",fr[fr.MintTo=7]="MintTo",fr[fr.Burn=8]="Burn",fr[fr.CloseAccount=9]="CloseAccount",fr[fr.FreezeAccount=10]="FreezeAccount",fr[fr.ThawAccount=11]="ThawAccount",fr[fr.TransferChecked=12]="TransferChecked",fr[fr.ApproveChecked=13]="ApproveChecked",fr[fr.MintToChecked=14]="MintToChecked",fr[fr.BurnChecked=15]="BurnChecked",fr[fr.InitializeAccount2=16]="InitializeAccount2",fr[fr.SyncNative=17]="SyncNative",fr[fr.InitializeAccount3=18]="InitializeAccount3",fr[fr.InitializeMultisig2=19]="InitializeMultisig2",fr[fr.InitializeMint2=20]="InitializeMint2",fr[fr.GetAccountDataSize=21]="GetAccountDataSize",fr[fr.InitializeImmutableOwner=22]="InitializeImmutableOwner",fr[fr.AmountToUiAmount=23]="AmountToUiAmount",fr[fr.UiAmountToAmount=24]="UiAmountToAmount",fr[fr.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",fr[fr.TransferFeeExtension=26]="TransferFeeExtension",fr[fr.ConfidentialTransferExtension=27]="ConfidentialTransferExtension",fr[fr.DefaultAccountStateExtension=28]="DefaultAccountStateExtension",fr[fr.Reallocate=29]="Reallocate",fr[fr.MemoTransferExtension=30]="MemoTransferExtension",fr[fr.CreateNativeMint=31]="CreateNativeMint",fr[fr.InitializeNonTransferableMint=32]="InitializeNonTransferableMint",fr[fr.InterestBearingMintExtension=33]="InterestBearingMintExtension",fr[fr.CpiGuardExtension=34]="CpiGuardExtension",fr[fr.InitializePermanentDelegate=35]="InitializePermanentDelegate",fr[fr.TransferHookExtension=36]="TransferHookExtension",fr[fr.MetadataPointerExtension=39]="MetadataPointerExtension",fr[fr.GroupPointerExtension=40]="GroupPointerExtension",fr[fr.GroupMemberPointerExtension=41]="GroupMemberPointerExtension"})(TokenInstruction||(TokenInstruction={}));function addSigners(fr,br,wr){if(wr.length){fr.push({pubkey:br,isSigner:!1,isWritable:!1});for(const Er of wr)fr.push({pubkey:Er instanceof PublicKey$2?Er:Er.publicKey,isSigner:!0,isWritable:!1})}else fr.push({pubkey:br,isSigner:!0,isWritable:!1});return fr}const MintLayout=struct([u32("mintAuthorityOption"),publicKey$1("mintAuthority"),u64$2("supply"),u8("decimals"),bool("isInitialized"),u32("freezeAuthorityOption"),publicKey$1("freezeAuthority")]);MintLayout.span;async function getAssociatedTokenAddress(fr,br,wr=!1,Er=TOKEN_PROGRAM_ID,kr=ASSOCIATED_TOKEN_PROGRAM_ID){if(!wr&&!PublicKey$2.isOnCurve(br.toBuffer()))throw new TokenOwnerOffCurveError;const[jr]=await PublicKey$2.findProgramAddress([br.toBuffer(),Er.toBuffer(),fr.toBuffer()],kr);return jr}function createAssociatedTokenAccountInstruction(fr,br,wr,Er,kr=TOKEN_PROGRAM_ID,jr=ASSOCIATED_TOKEN_PROGRAM_ID){return buildAssociatedTokenAccountInstruction(fr,br,wr,Er,Buffer$2.alloc(0),kr,jr)}function buildAssociatedTokenAccountInstruction(fr,br,wr,Er,kr,jr=TOKEN_PROGRAM_ID,Br=ASSOCIATED_TOKEN_PROGRAM_ID){const Wr=[{pubkey:fr,isSigner:!0,isWritable:!0},{pubkey:br,isSigner:!1,isWritable:!0},{pubkey:wr,isSigner:!1,isWritable:!1},{pubkey:Er,isSigner:!1,isWritable:!1},{pubkey:SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:jr,isSigner:!1,isWritable:!1}];return new TransactionInstruction({keys:Wr,programId:Br,data:kr})}const transferInstructionData=struct([u8("instruction"),u64$2("amount")]);function createTransferInstruction(fr,br,wr,Er,kr=[],jr=TOKEN_PROGRAM_ID){const Br=addSigners([{pubkey:fr,isSigner:!1,isWritable:!0},{pubkey:br,isSigner:!1,isWritable:!0}],wr,kr),Wr=Buffer$2.alloc(transferInstructionData.span);return transferInstructionData.encode({instruction:TokenInstruction.Transfer,amount:BigInt(Er)},Wr),new TransactionInstruction({keys:Br,programId:jr,data:Wr})}const isTxAlreadySigned$1=fr=>{let br=!1;return"version"in fr?br=fr.signatures.some(wr=>!wr.every(Er=>Er===0)):br=fr.signatures.some(wr=>wr.signature),br},LAMPORTS_PER_SOL$1=1e9;let SolanaUiTransaction$1=class{constructor({onSubmit:br,from:wr,connection:Er,multipleTransactions:kr}){this.chain="SOL",this.data=void 0,this.fee={gas:void 0},this.formatNonNativeToken=(jr,Br)=>(Number(jr)/Number(Math.pow(10,Br))).toString(),this.from=wr,this.onSubmit=br,this.connection=Er,this.multipleTransactions=kr}fetchFee(){return __awaiter$4(this,void 0,void 0,function*(){if(this.fee.gas)return;let br=this.multipleTransactions;if(!br){const Br=yield this.createTransactionSafe();if(!Br)return;br=Br instanceof Array?Br:[Br]}const{blockhash:wr}=yield this.connection.getLatestBlockhash(),Er=yield Promise.all(br.map(Br=>__awaiter$4(this,void 0,void 0,function*(){return"version"in Br?((yield isTxAlreadySigned$1(Br))||(Br.message.recentBlockhash=wr),Br.message):((yield isTxAlreadySigned$1(Br))||(Br.recentBlockhash=wr),Br.compileMessage())})));if(Er.some(Br=>!Br))throw new Error("Invalid transaction");const kr=Br=>__awaiter$4(this,void 0,void 0,function*(){let Wr=yield this.connection.getFeeForMessage(Br),qr=0;for(;Wr.value===null&&qr<5;)Wr=yield this.connection.getFeeForMessage(Br),qr++;return Wr.value?BigInt(Wr.value):BigInt(0)}),jr=yield Promise.all(Er.map(Br=>kr(Br)));this.fee.gas=jr.reduce((Br,Wr)=>Br+Wr,BigInt(0)),this.fee.gas===BigInt(0)&&(this.fee.gas=void 0)})}isGasSponsored(){var br;return!((br=this.multipleTransactions)===null||br===void 0)&&br.length?this.multipleTransactions.every(wr=>{var Er;return"version"in wr?this.from!==wr.message.staticAccountKeys[0].toBase58():"feePayer"in wr?this.from!==((Er=wr.feePayer)===null||Er===void 0?void 0:Er.toBase58()):!1}):!1}parse(br){const wr=parseFloat(br),Er=Math.round(wr*LAMPORTS_PER_SOL$1);return BigInt(Er)}parseNonNativeToken(br,wr){return BigInt(Math.floor(Number(br)*Math.pow(10,wr)))}format(br,{precision:wr}={}){const kr=(Number(br)/LAMPORTS_PER_SOL$1).toLocaleString("fullwide",{maximumFractionDigits:20,minimumFractionDigits:0,useGrouping:!1});return formatNumberText(kr,{precision:wr})}submit(){return __awaiter$4(this,void 0,void 0,function*(){if(this.multipleTransactions)return this.onSubmit();const br=yield this.createTransaction();return this.onSubmit(br)})}getBalance(){return __awaiter$4(this,void 0,void 0,function*(){const br=new PublicKey$2(this.from),wr=yield this.connection.getBalance(br);return BigInt(wr)})}validateAddressFormat(br){return br==="dyn_send_transaction.multiple_recipients"?!0:/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(br)}createTransaction(){return __awaiter$4(this,void 0,void 0,function*(){var br;const{value:wr,to:Er,nonNativeAddress:kr,nonNativeValue:jr}=this;if(!Er)throw new Error("Destination is required");if(this.multipleTransactions)return this.multipleTransactions;const Br=new Transaction,Wr=new PublicKey$2(this.from),qr=new PublicKey$2(Er);if(kr&&jr){const Vr=new PublicKey$2(kr),Zr=jr,Jr=(br=(yield this.connection.getTokenAccountsByOwner(Wr,{mint:Vr})).value[0])===null||br===void 0?void 0:br.pubkey;if(!Jr)throw new Error("Source token account not found");let Qr;try{Qr=yield getAssociatedTokenAddress(Vr,qr),yield this.connection.getTokenAccountBalance(Qr)}catch{Qr=yield getAssociatedTokenAddress(Vr,qr),Br.add(createAssociatedTokenAccountInstruction(Wr,Qr,qr,Vr))}Br.add(createTransferInstruction(Jr,Qr,Wr,Zr))}else{const Vr=wr??BigInt(0);Br.add(SystemProgram.transfer({fromPubkey:Wr,lamports:Vr,toPubkey:qr}))}const{blockhash:Gr}=yield this.connection.getLatestBlockhash();return Br.feePayer=new PublicKey$2(this.from),Br.recentBlockhash=Gr,Br})}createTransactionSafe(){return __awaiter$4(this,void 0,void 0,function*(){try{return yield this.createTransaction()}catch{return}})}};assertPackageVersion("@dynamic-labs/solana-core",version$6);function __awaiter$3(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;const isSignedMessage=fr=>!!fr&&fr.signature!==void 0;var __classPrivateFieldSet=function(fr,br,wr,Er,kr){if(Er==="m")throw new TypeError("Private method is not writable");if(Er==="a"&&!kr)throw new TypeError("Private accessor was defined without a setter");if(typeof br=="function"?fr!==br||!kr:!br.has(fr))throw new TypeError("Cannot write private member to an object whose class did not declare it");return Er==="a"?kr.call(fr,wr):kr?kr.value=wr:br.set(fr,wr),wr},__classPrivateFieldGet=function(fr,br,wr,Er){if(wr==="a"&&!Er)throw new TypeError("Private accessor was defined without a getter");if(typeof br=="function"?fr!==br||!Er:!br.has(fr))throw new TypeError("Cannot read private member from an object whose class did not declare it");return wr==="m"?Er:wr==="a"?Er.call(fr):Er?Er.value:br.get(fr)},_AppReadyEvent_detail;let wallets;const registered=new Set,listeners={};function getWallets(){if(wallets||(wallets=Object.freeze({register,get,on}),typeof window>"u"))return wallets;const fr=Object.freeze({register});try{window.addEventListener("wallet-standard:register-wallet",({detail:br})=>br(fr))}catch(br){console.error(`wallet-standard:register-wallet event listener could not be added + You can read more about it here https://github.com/solana-labs/solana/issues/21366`);return wr.signMessage.call(this,br)})}proveOwnership(br,wr){const Er=Object.create(null,{proveOwnership:{get:()=>super.proveOwnership}});return __awaiter$4(this,void 0,void 0,function*(){if(yield this.validateActiveWallet(br),this.isHardwareWalletEnabled){const kr=extractNonce(wr);if(!kr)throw new DynamicError("Nonce missing");return this.signMessageViaTransaction(kr)}return Er.proveOwnership.call(this,br,wr)})}signMessageViaTransaction(br){return __awaiter$4(this,void 0,void 0,function*(){const wr=yield this.getAddress();if(!wr)throw new DynamicError("Address missing");const Er=this.buildAuthTx(br);Er.feePayer=new PublicKey$2(wr),Er.recentBlockhash=(yield this.getWalletClient().getLatestBlockhash()).blockhash;const kr=yield this.getSigner();if(!kr)throw new DynamicError("Signer not found");const Br=(yield kr.signTransaction(Er)).serialize();return JSON.stringify({signedTransaction:{data:Array.from(Br),type:"Buffer"}})})}buildAuthTx(br){const wr=new Transaction;return wr.add(new TransactionInstruction({data:Buffer$2.from(br,"utf8"),keys:[],programId:MEMO_PROGRAM_ID})),wr}setVerifiedCredentials(br){this.verifiedCredentials=br}isLedgerAddress(br){return isLedgerAddressViaVerifiedCredentials(br,this.verifiedCredentials)}}ChainRpcProviders.getSolanaProviderByChainId=(fr,br)=>{var wr;return(wr=fr.solana)===null||wr===void 0?void 0:wr.find(kr=>kr.chainId===br)};ChainRpcProviders.registerSolanaProviders=fr=>{ChainRpcProviders.registerChainProviders(ProviderChain.SOLANA,br=>{const wr={};return br!=null&&br.solana&&(wr.solana=br.solana.map(Er=>{var kr;const jr=((kr=Er.privateCustomerRpcUrls)===null||kr===void 0?void 0:kr[0])||Er.rpcUrls[0],Br=new Connection(jr,fr);return{chainId:Er.chainId.toString(),chainName:Er.name,provider:Br}})),wr.solana})};const TOKEN_PROGRAM_ID=new PublicKey$2("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new PublicKey$2("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const ASSOCIATED_TOKEN_PROGRAM_ID=new PublicKey$2("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new PublicKey$2("So11111111111111111111111111111111111111112");new PublicKey$2("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");const encodeDecode$2=fr=>{const br=fr.decode.bind(fr),wr=fr.encode.bind(fr);return{decode:br,encode:wr}},bigInt$2=fr=>br=>{const wr=blob(fr,br),{encode:Er,decode:kr}=encodeDecode$2(wr),jr=wr;return jr.decode=(Br,Wr)=>{const qr=kr(Br,Wr);return toBigIntLE_1(Buffer$2.from(qr))},jr.encode=(Br,Wr,qr)=>{const Gr=toBufferLE_1(Br,fr);return Er(Gr,Wr,qr)},jr},u64$2=bigInt$2(8),bool=fr=>{const br=u8(fr),{encode:wr,decode:Er}=encodeDecode$2(br),kr=br;return kr.decode=(jr,Br)=>!!Er(jr,Br),kr.encode=(jr,Br,Wr)=>{const qr=Number(jr);return wr(qr,Br,Wr)},kr};var bn$1={exports:{}};bn$1.exports;(function(fr){(function(br,wr){function Er(Tn,Hr){if(!Tn)throw new Error(Hr||"Assertion failed")}function kr(Tn,Hr){Tn.super_=Hr;var Xr=function(){};Xr.prototype=Hr.prototype,Tn.prototype=new Xr,Tn.prototype.constructor=Tn}function jr(Tn,Hr,Xr){if(jr.isBN(Tn))return Tn;this.negative=0,this.words=null,this.length=0,this.red=null,Tn!==null&&((Hr==="le"||Hr==="be")&&(Xr=Hr,Hr=10),this._init(Tn||0,Hr||10,Xr||"be"))}typeof br=="object"?br.exports=jr:wr.BN=jr,jr.BN=jr,jr.wordSize=26;var Br;try{typeof window<"u"&&typeof window.Buffer<"u"?Br=window.Buffer:Br=require$$0$9.Buffer}catch{}jr.isBN=function(Hr){return Hr instanceof jr?!0:Hr!==null&&typeof Hr=="object"&&Hr.constructor.wordSize===jr.wordSize&&Array.isArray(Hr.words)},jr.max=function(Hr,Xr){return Hr.cmp(Xr)>0?Hr:Xr},jr.min=function(Hr,Xr){return Hr.cmp(Xr)<0?Hr:Xr},jr.prototype._init=function(Hr,Xr,Sn){if(typeof Hr=="number")return this._initNumber(Hr,Xr,Sn);if(typeof Hr=="object")return this._initArray(Hr,Xr,Sn);Xr==="hex"&&(Xr=16),Er(Xr===(Xr|0)&&Xr>=2&&Xr<=36),Hr=Hr.toString().replace(/\s+/g,"");var Rn=0;Hr[0]==="-"&&(Rn++,this.negative=1),Rn=0;Rn-=3)On=Hr[Rn]|Hr[Rn-1]<<8|Hr[Rn-2]<<16,this.words[Pn]|=On<>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);else if(Sn==="le")for(Rn=0,Pn=0;Rn>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);return this._strip()};function Wr(Tn,Hr){var Xr=Tn.charCodeAt(Hr);if(Xr>=48&&Xr<=57)return Xr-48;if(Xr>=65&&Xr<=70)return Xr-55;if(Xr>=97&&Xr<=102)return Xr-87;Er(!1,"Invalid character in "+Tn)}function qr(Tn,Hr,Xr){var Sn=Wr(Tn,Xr);return Xr-1>=Hr&&(Sn|=Wr(Tn,Xr-1)<<4),Sn}jr.prototype._parseHex=function(Hr,Xr,Sn){this.length=Math.ceil((Hr.length-Xr)/6),this.words=new Array(this.length);for(var Rn=0;Rn=Xr;Rn-=2)Zn=qr(Hr,Xr,Rn)<=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8;else{var Nn=Hr.length-Xr;for(Rn=Nn%2===0?Xr+1:Xr;Rn=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8}this._strip()};function Gr(Tn,Hr,Xr,Sn){for(var Rn=0,Pn=0,On=Math.min(Tn.length,Xr),Zn=Hr;Zn=49?Pn=Nn-49+10:Nn>=17?Pn=Nn-17+10:Pn=Nn,Er(Nn>=0&&Pn1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},jr.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{jr.prototype[Symbol.for("nodejs.util.inspect.custom")]=Zr}catch{jr.prototype.inspect=Zr}else jr.prototype.inspect=Zr;function Zr(){return(this.red?""}var Jr=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Qr=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_n=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];jr.prototype.toString=function(Hr,Xr){Hr=Hr||10,Xr=Xr|0||1;var Sn;if(Hr===16||Hr==="hex"){Sn="";for(var Rn=0,Pn=0,On=0;On>>24-Rn&16777215,Rn+=2,Rn>=26&&(Rn-=26,On--),Pn!==0||On!==this.length-1?Sn=Jr[6-Nn.length]+Nn+Sn:Sn=Nn+Sn}for(Pn!==0&&(Sn=Pn.toString(16)+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}if(Hr===(Hr|0)&&Hr>=2&&Hr<=36){var wn=Qr[Hr],zn=_n[Hr];Sn="";var fo=this.clone();for(fo.negative=0;!fo.isZero();){var vo=fo.modrn(zn).toString(Hr);fo=fo.idivn(zn),fo.isZero()?Sn=vo+Sn:Sn=Jr[wn-vo.length]+vo+Sn}for(this.isZero()&&(Sn="0"+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}Er(!1,"Base should be between 2 and 36")},jr.prototype.toNumber=function(){var Hr=this.words[0];return this.length===2?Hr+=this.words[1]*67108864:this.length===3&&this.words[2]===1?Hr+=4503599627370496+this.words[1]*67108864:this.length>2&&Er(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-Hr:Hr},jr.prototype.toJSON=function(){return this.toString(16,2)},Br&&(jr.prototype.toBuffer=function(Hr,Xr){return this.toArrayLike(Br,Hr,Xr)}),jr.prototype.toArray=function(Hr,Xr){return this.toArrayLike(Array,Hr,Xr)};var En=function(Hr,Xr){return Hr.allocUnsafe?Hr.allocUnsafe(Xr):new Hr(Xr)};jr.prototype.toArrayLike=function(Hr,Xr,Sn){this._strip();var Rn=this.byteLength(),Pn=Sn||Math.max(1,Rn);Er(Rn<=Pn,"byte array longer than desired length"),Er(Pn>0,"Requested array length <= 0");var On=En(Hr,Pn),Zn=Xr==="le"?"LE":"BE";return this["_toArrayLike"+Zn](On,Rn),On},jr.prototype._toArrayLikeLE=function(Hr,Xr){for(var Sn=0,Rn=0,Pn=0,On=0;Pn>8&255),Sn>16&255),On===6?(Sn>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn=0&&(Hr[Sn--]=Zn>>8&255),Sn>=0&&(Hr[Sn--]=Zn>>16&255),On===6?(Sn>=0&&(Hr[Sn--]=Zn>>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn>=0)for(Hr[Sn--]=Rn;Sn>=0;)Hr[Sn--]=0},Math.clz32?jr.prototype._countBits=function(Hr){return 32-Math.clz32(Hr)}:jr.prototype._countBits=function(Hr){var Xr=Hr,Sn=0;return Xr>=4096&&(Sn+=13,Xr>>>=13),Xr>=64&&(Sn+=7,Xr>>>=7),Xr>=8&&(Sn+=4,Xr>>>=4),Xr>=2&&(Sn+=2,Xr>>>=2),Sn+Xr},jr.prototype._zeroBits=function(Hr){if(Hr===0)return 26;var Xr=Hr,Sn=0;return Xr&8191||(Sn+=13,Xr>>>=13),Xr&127||(Sn+=7,Xr>>>=7),Xr&15||(Sn+=4,Xr>>>=4),Xr&3||(Sn+=2,Xr>>>=2),Xr&1||Sn++,Sn},jr.prototype.bitLength=function(){var Hr=this.words[this.length-1],Xr=this._countBits(Hr);return(this.length-1)*26+Xr};function Cn(Tn){for(var Hr=new Array(Tn.bitLength()),Xr=0;Xr>>Rn&1}return Hr}jr.prototype.zeroBits=function(){if(this.isZero())return 0;for(var Hr=0,Xr=0;XrHr.length?this.clone().ior(Hr):Hr.clone().ior(this)},jr.prototype.uor=function(Hr){return this.length>Hr.length?this.clone().iuor(Hr):Hr.clone().iuor(this)},jr.prototype.iuand=function(Hr){var Xr;this.length>Hr.length?Xr=Hr:Xr=this;for(var Sn=0;SnHr.length?this.clone().iand(Hr):Hr.clone().iand(this)},jr.prototype.uand=function(Hr){return this.length>Hr.length?this.clone().iuand(Hr):Hr.clone().iuand(this)},jr.prototype.iuxor=function(Hr){var Xr,Sn;this.length>Hr.length?(Xr=this,Sn=Hr):(Xr=Hr,Sn=this);for(var Rn=0;RnHr.length?this.clone().ixor(Hr):Hr.clone().ixor(this)},jr.prototype.uxor=function(Hr){return this.length>Hr.length?this.clone().iuxor(Hr):Hr.clone().iuxor(this)},jr.prototype.inotn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Math.ceil(Hr/26)|0,Sn=Hr%26;this._expand(Xr),Sn>0&&Xr--;for(var Rn=0;Rn0&&(this.words[Rn]=~this.words[Rn]&67108863>>26-Sn),this._strip()},jr.prototype.notn=function(Hr){return this.clone().inotn(Hr)},jr.prototype.setn=function(Hr,Xr){Er(typeof Hr=="number"&&Hr>=0);var Sn=Hr/26|0,Rn=Hr%26;return this._expand(Sn+1),Xr?this.words[Sn]=this.words[Sn]|1<Hr.length?(Sn=this,Rn=Hr):(Sn=Hr,Rn=this);for(var Pn=0,On=0;On>>26;for(;Pn!==0&&On>>26;if(this.length=Sn.length,Pn!==0)this.words[this.length]=Pn,this.length++;else if(Sn!==this)for(;OnHr.length?this.clone().iadd(Hr):Hr.clone().iadd(this)},jr.prototype.isub=function(Hr){if(Hr.negative!==0){Hr.negative=0;var Xr=this.iadd(Hr);return Hr.negative=1,Xr._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Hr),this.negative=1,this._normSign();var Sn=this.cmp(Hr);if(Sn===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Rn,Pn;Sn>0?(Rn=this,Pn=Hr):(Rn=Hr,Pn=this);for(var On=0,Zn=0;Zn>26,this.words[Zn]=Xr&67108863;for(;On!==0&&Zn>26,this.words[Zn]=Xr&67108863;if(On===0&&Zn>>26,fo=Nn&67108863,vo=Math.min(wn,Hr.length-1),go=Math.max(0,wn-Tn.length+1);go<=vo;go++){var uo=wn-go|0;Rn=Tn.words[uo]|0,Pn=Hr.words[go]|0,On=Rn*Pn+fo,zn+=On/67108864|0,fo=On&67108863}Xr.words[wn]=fo|0,Nn=zn|0}return Nn!==0?Xr.words[wn]=Nn|0:Xr.length--,Xr._strip()}var An=function(Hr,Xr,Sn){var Rn=Hr.words,Pn=Xr.words,On=Sn.words,Zn=0,Nn,wn,zn,fo=Rn[0]|0,vo=fo&8191,go=fo>>>13,uo=Rn[1]|0,lo=uo&8191,Eo=uo>>>13,mo=Rn[2]|0,yo=mo&8191,_o=mo>>>13,Bo=Rn[3]|0,Lo=Bo&8191,Wo=Bo>>>13,na=Rn[4]|0,qo=na&8191,ga=na>>>13,wl=Rn[5]|0,No=wl&8191,Uo=wl>>>13,Nl=Rn[6]|0,Vo=Nl&8191,Fo=Nl>>>13,Ol=Rn[7]|0,$a=Ol&8191,Jo=Ol>>>13,Zl=Rn[8]|0,Cl=Zl&8191,ko=Zl>>>13,wo=Rn[9]|0,bo=wo&8191,Io=wo>>>13,Ho=Pn[0]|0,Do=Ho&8191,zo=Ho>>>13,nu=Pn[1]|0,Ll=nu&8191,_l=nu>>>13,bu=Pn[2]|0,xl=bu&8191,Tl=bu>>>13,du=Pn[3]|0,Bl=du&8191,Il=du>>>13,Eu=Pn[4]|0,Al=Eu&8191,Ml=Eu>>>13,Tu=Pn[5]|0,Fl=Tu&8191,Sl=Tu>>>13,_u=Pn[6]|0,So=_u&8191,Co=_u>>>13,Ao=Pn[7]|0,po=Ao&8191,Ro=Ao>>>13,Xo=Pn[8]|0,jo=Xo&8191,Ko=Xo>>>13,Wl=Pn[9]|0,$l=Wl&8191,El=Wl>>>13;Sn.negative=Hr.negative^Xr.negative,Sn.length=19,Nn=Math.imul(vo,Do),wn=Math.imul(vo,zo),wn=wn+Math.imul(go,Do)|0,zn=Math.imul(go,zo);var Cu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,Nn=Math.imul(lo,Do),wn=Math.imul(lo,zo),wn=wn+Math.imul(Eo,Do)|0,zn=Math.imul(Eo,zo),Nn=Nn+Math.imul(vo,Ll)|0,wn=wn+Math.imul(vo,_l)|0,wn=wn+Math.imul(go,Ll)|0,zn=zn+Math.imul(go,_l)|0;var iu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(iu>>>26)|0,iu&=67108863,Nn=Math.imul(yo,Do),wn=Math.imul(yo,zo),wn=wn+Math.imul(_o,Do)|0,zn=Math.imul(_o,zo),Nn=Nn+Math.imul(lo,Ll)|0,wn=wn+Math.imul(lo,_l)|0,wn=wn+Math.imul(Eo,Ll)|0,zn=zn+Math.imul(Eo,_l)|0,Nn=Nn+Math.imul(vo,xl)|0,wn=wn+Math.imul(vo,Tl)|0,wn=wn+Math.imul(go,xl)|0,zn=zn+Math.imul(go,Tl)|0;var pu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(pu>>>26)|0,pu&=67108863,Nn=Math.imul(Lo,Do),wn=Math.imul(Lo,zo),wn=wn+Math.imul(Wo,Do)|0,zn=Math.imul(Wo,zo),Nn=Nn+Math.imul(yo,Ll)|0,wn=wn+Math.imul(yo,_l)|0,wn=wn+Math.imul(_o,Ll)|0,zn=zn+Math.imul(_o,_l)|0,Nn=Nn+Math.imul(lo,xl)|0,wn=wn+Math.imul(lo,Tl)|0,wn=wn+Math.imul(Eo,xl)|0,zn=zn+Math.imul(Eo,Tl)|0,Nn=Nn+Math.imul(vo,Bl)|0,wn=wn+Math.imul(vo,Il)|0,wn=wn+Math.imul(go,Bl)|0,zn=zn+Math.imul(go,Il)|0;var yu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(yu>>>26)|0,yu&=67108863,Nn=Math.imul(qo,Do),wn=Math.imul(qo,zo),wn=wn+Math.imul(ga,Do)|0,zn=Math.imul(ga,zo),Nn=Nn+Math.imul(Lo,Ll)|0,wn=wn+Math.imul(Lo,_l)|0,wn=wn+Math.imul(Wo,Ll)|0,zn=zn+Math.imul(Wo,_l)|0,Nn=Nn+Math.imul(yo,xl)|0,wn=wn+Math.imul(yo,Tl)|0,wn=wn+Math.imul(_o,xl)|0,zn=zn+Math.imul(_o,Tl)|0,Nn=Nn+Math.imul(lo,Bl)|0,wn=wn+Math.imul(lo,Il)|0,wn=wn+Math.imul(Eo,Bl)|0,zn=zn+Math.imul(Eo,Il)|0,Nn=Nn+Math.imul(vo,Al)|0,wn=wn+Math.imul(vo,Ml)|0,wn=wn+Math.imul(go,Al)|0,zn=zn+Math.imul(go,Ml)|0;var hu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(hu>>>26)|0,hu&=67108863,Nn=Math.imul(No,Do),wn=Math.imul(No,zo),wn=wn+Math.imul(Uo,Do)|0,zn=Math.imul(Uo,zo),Nn=Nn+Math.imul(qo,Ll)|0,wn=wn+Math.imul(qo,_l)|0,wn=wn+Math.imul(ga,Ll)|0,zn=zn+Math.imul(ga,_l)|0,Nn=Nn+Math.imul(Lo,xl)|0,wn=wn+Math.imul(Lo,Tl)|0,wn=wn+Math.imul(Wo,xl)|0,zn=zn+Math.imul(Wo,Tl)|0,Nn=Nn+Math.imul(yo,Bl)|0,wn=wn+Math.imul(yo,Il)|0,wn=wn+Math.imul(_o,Bl)|0,zn=zn+Math.imul(_o,Il)|0,Nn=Nn+Math.imul(lo,Al)|0,wn=wn+Math.imul(lo,Ml)|0,wn=wn+Math.imul(Eo,Al)|0,zn=zn+Math.imul(Eo,Ml)|0,Nn=Nn+Math.imul(vo,Fl)|0,wn=wn+Math.imul(vo,Sl)|0,wn=wn+Math.imul(go,Fl)|0,zn=zn+Math.imul(go,Sl)|0;var mu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(mu>>>26)|0,mu&=67108863,Nn=Math.imul(Vo,Do),wn=Math.imul(Vo,zo),wn=wn+Math.imul(Fo,Do)|0,zn=Math.imul(Fo,zo),Nn=Nn+Math.imul(No,Ll)|0,wn=wn+Math.imul(No,_l)|0,wn=wn+Math.imul(Uo,Ll)|0,zn=zn+Math.imul(Uo,_l)|0,Nn=Nn+Math.imul(qo,xl)|0,wn=wn+Math.imul(qo,Tl)|0,wn=wn+Math.imul(ga,xl)|0,zn=zn+Math.imul(ga,Tl)|0,Nn=Nn+Math.imul(Lo,Bl)|0,wn=wn+Math.imul(Lo,Il)|0,wn=wn+Math.imul(Wo,Bl)|0,zn=zn+Math.imul(Wo,Il)|0,Nn=Nn+Math.imul(yo,Al)|0,wn=wn+Math.imul(yo,Ml)|0,wn=wn+Math.imul(_o,Al)|0,zn=zn+Math.imul(_o,Ml)|0,Nn=Nn+Math.imul(lo,Fl)|0,wn=wn+Math.imul(lo,Sl)|0,wn=wn+Math.imul(Eo,Fl)|0,zn=zn+Math.imul(Eo,Sl)|0,Nn=Nn+Math.imul(vo,So)|0,wn=wn+Math.imul(vo,Co)|0,wn=wn+Math.imul(go,So)|0,zn=zn+Math.imul(go,Co)|0;var vu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(vu>>>26)|0,vu&=67108863,Nn=Math.imul($a,Do),wn=Math.imul($a,zo),wn=wn+Math.imul(Jo,Do)|0,zn=Math.imul(Jo,zo),Nn=Nn+Math.imul(Vo,Ll)|0,wn=wn+Math.imul(Vo,_l)|0,wn=wn+Math.imul(Fo,Ll)|0,zn=zn+Math.imul(Fo,_l)|0,Nn=Nn+Math.imul(No,xl)|0,wn=wn+Math.imul(No,Tl)|0,wn=wn+Math.imul(Uo,xl)|0,zn=zn+Math.imul(Uo,Tl)|0,Nn=Nn+Math.imul(qo,Bl)|0,wn=wn+Math.imul(qo,Il)|0,wn=wn+Math.imul(ga,Bl)|0,zn=zn+Math.imul(ga,Il)|0,Nn=Nn+Math.imul(Lo,Al)|0,wn=wn+Math.imul(Lo,Ml)|0,wn=wn+Math.imul(Wo,Al)|0,zn=zn+Math.imul(Wo,Ml)|0,Nn=Nn+Math.imul(yo,Fl)|0,wn=wn+Math.imul(yo,Sl)|0,wn=wn+Math.imul(_o,Fl)|0,zn=zn+Math.imul(_o,Sl)|0,Nn=Nn+Math.imul(lo,So)|0,wn=wn+Math.imul(lo,Co)|0,wn=wn+Math.imul(Eo,So)|0,zn=zn+Math.imul(Eo,Co)|0,Nn=Nn+Math.imul(vo,po)|0,wn=wn+Math.imul(vo,Ro)|0,wn=wn+Math.imul(go,po)|0,zn=zn+Math.imul(go,Ro)|0;var fu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(fu>>>26)|0,fu&=67108863,Nn=Math.imul(Cl,Do),wn=Math.imul(Cl,zo),wn=wn+Math.imul(ko,Do)|0,zn=Math.imul(ko,zo),Nn=Nn+Math.imul($a,Ll)|0,wn=wn+Math.imul($a,_l)|0,wn=wn+Math.imul(Jo,Ll)|0,zn=zn+Math.imul(Jo,_l)|0,Nn=Nn+Math.imul(Vo,xl)|0,wn=wn+Math.imul(Vo,Tl)|0,wn=wn+Math.imul(Fo,xl)|0,zn=zn+Math.imul(Fo,Tl)|0,Nn=Nn+Math.imul(No,Bl)|0,wn=wn+Math.imul(No,Il)|0,wn=wn+Math.imul(Uo,Bl)|0,zn=zn+Math.imul(Uo,Il)|0,Nn=Nn+Math.imul(qo,Al)|0,wn=wn+Math.imul(qo,Ml)|0,wn=wn+Math.imul(ga,Al)|0,zn=zn+Math.imul(ga,Ml)|0,Nn=Nn+Math.imul(Lo,Fl)|0,wn=wn+Math.imul(Lo,Sl)|0,wn=wn+Math.imul(Wo,Fl)|0,zn=zn+Math.imul(Wo,Sl)|0,Nn=Nn+Math.imul(yo,So)|0,wn=wn+Math.imul(yo,Co)|0,wn=wn+Math.imul(_o,So)|0,zn=zn+Math.imul(_o,Co)|0,Nn=Nn+Math.imul(lo,po)|0,wn=wn+Math.imul(lo,Ro)|0,wn=wn+Math.imul(Eo,po)|0,zn=zn+Math.imul(Eo,Ro)|0,Nn=Nn+Math.imul(vo,jo)|0,wn=wn+Math.imul(vo,Ko)|0,wn=wn+Math.imul(go,jo)|0,zn=zn+Math.imul(go,Ko)|0;var gu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(gu>>>26)|0,gu&=67108863,Nn=Math.imul(bo,Do),wn=Math.imul(bo,zo),wn=wn+Math.imul(Io,Do)|0,zn=Math.imul(Io,zo),Nn=Nn+Math.imul(Cl,Ll)|0,wn=wn+Math.imul(Cl,_l)|0,wn=wn+Math.imul(ko,Ll)|0,zn=zn+Math.imul(ko,_l)|0,Nn=Nn+Math.imul($a,xl)|0,wn=wn+Math.imul($a,Tl)|0,wn=wn+Math.imul(Jo,xl)|0,zn=zn+Math.imul(Jo,Tl)|0,Nn=Nn+Math.imul(Vo,Bl)|0,wn=wn+Math.imul(Vo,Il)|0,wn=wn+Math.imul(Fo,Bl)|0,zn=zn+Math.imul(Fo,Il)|0,Nn=Nn+Math.imul(No,Al)|0,wn=wn+Math.imul(No,Ml)|0,wn=wn+Math.imul(Uo,Al)|0,zn=zn+Math.imul(Uo,Ml)|0,Nn=Nn+Math.imul(qo,Fl)|0,wn=wn+Math.imul(qo,Sl)|0,wn=wn+Math.imul(ga,Fl)|0,zn=zn+Math.imul(ga,Sl)|0,Nn=Nn+Math.imul(Lo,So)|0,wn=wn+Math.imul(Lo,Co)|0,wn=wn+Math.imul(Wo,So)|0,zn=zn+Math.imul(Wo,Co)|0,Nn=Nn+Math.imul(yo,po)|0,wn=wn+Math.imul(yo,Ro)|0,wn=wn+Math.imul(_o,po)|0,zn=zn+Math.imul(_o,Ro)|0,Nn=Nn+Math.imul(lo,jo)|0,wn=wn+Math.imul(lo,Ko)|0,wn=wn+Math.imul(Eo,jo)|0,zn=zn+Math.imul(Eo,Ko)|0,Nn=Nn+Math.imul(vo,$l)|0,wn=wn+Math.imul(vo,El)|0,wn=wn+Math.imul(go,$l)|0,zn=zn+Math.imul(go,El)|0;var ou=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(ou>>>26)|0,ou&=67108863,Nn=Math.imul(bo,Ll),wn=Math.imul(bo,_l),wn=wn+Math.imul(Io,Ll)|0,zn=Math.imul(Io,_l),Nn=Nn+Math.imul(Cl,xl)|0,wn=wn+Math.imul(Cl,Tl)|0,wn=wn+Math.imul(ko,xl)|0,zn=zn+Math.imul(ko,Tl)|0,Nn=Nn+Math.imul($a,Bl)|0,wn=wn+Math.imul($a,Il)|0,wn=wn+Math.imul(Jo,Bl)|0,zn=zn+Math.imul(Jo,Il)|0,Nn=Nn+Math.imul(Vo,Al)|0,wn=wn+Math.imul(Vo,Ml)|0,wn=wn+Math.imul(Fo,Al)|0,zn=zn+Math.imul(Fo,Ml)|0,Nn=Nn+Math.imul(No,Fl)|0,wn=wn+Math.imul(No,Sl)|0,wn=wn+Math.imul(Uo,Fl)|0,zn=zn+Math.imul(Uo,Sl)|0,Nn=Nn+Math.imul(qo,So)|0,wn=wn+Math.imul(qo,Co)|0,wn=wn+Math.imul(ga,So)|0,zn=zn+Math.imul(ga,Co)|0,Nn=Nn+Math.imul(Lo,po)|0,wn=wn+Math.imul(Lo,Ro)|0,wn=wn+Math.imul(Wo,po)|0,zn=zn+Math.imul(Wo,Ro)|0,Nn=Nn+Math.imul(yo,jo)|0,wn=wn+Math.imul(yo,Ko)|0,wn=wn+Math.imul(_o,jo)|0,zn=zn+Math.imul(_o,Ko)|0,Nn=Nn+Math.imul(lo,$l)|0,wn=wn+Math.imul(lo,El)|0,wn=wn+Math.imul(Eo,$l)|0,zn=zn+Math.imul(Eo,El)|0;var su=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(su>>>26)|0,su&=67108863,Nn=Math.imul(bo,xl),wn=Math.imul(bo,Tl),wn=wn+Math.imul(Io,xl)|0,zn=Math.imul(Io,Tl),Nn=Nn+Math.imul(Cl,Bl)|0,wn=wn+Math.imul(Cl,Il)|0,wn=wn+Math.imul(ko,Bl)|0,zn=zn+Math.imul(ko,Il)|0,Nn=Nn+Math.imul($a,Al)|0,wn=wn+Math.imul($a,Ml)|0,wn=wn+Math.imul(Jo,Al)|0,zn=zn+Math.imul(Jo,Ml)|0,Nn=Nn+Math.imul(Vo,Fl)|0,wn=wn+Math.imul(Vo,Sl)|0,wn=wn+Math.imul(Fo,Fl)|0,zn=zn+Math.imul(Fo,Sl)|0,Nn=Nn+Math.imul(No,So)|0,wn=wn+Math.imul(No,Co)|0,wn=wn+Math.imul(Uo,So)|0,zn=zn+Math.imul(Uo,Co)|0,Nn=Nn+Math.imul(qo,po)|0,wn=wn+Math.imul(qo,Ro)|0,wn=wn+Math.imul(ga,po)|0,zn=zn+Math.imul(ga,Ro)|0,Nn=Nn+Math.imul(Lo,jo)|0,wn=wn+Math.imul(Lo,Ko)|0,wn=wn+Math.imul(Wo,jo)|0,zn=zn+Math.imul(Wo,Ko)|0,Nn=Nn+Math.imul(yo,$l)|0,wn=wn+Math.imul(yo,El)|0,wn=wn+Math.imul(_o,$l)|0,zn=zn+Math.imul(_o,El)|0;var tu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(tu>>>26)|0,tu&=67108863,Nn=Math.imul(bo,Bl),wn=Math.imul(bo,Il),wn=wn+Math.imul(Io,Bl)|0,zn=Math.imul(Io,Il),Nn=Nn+Math.imul(Cl,Al)|0,wn=wn+Math.imul(Cl,Ml)|0,wn=wn+Math.imul(ko,Al)|0,zn=zn+Math.imul(ko,Ml)|0,Nn=Nn+Math.imul($a,Fl)|0,wn=wn+Math.imul($a,Sl)|0,wn=wn+Math.imul(Jo,Fl)|0,zn=zn+Math.imul(Jo,Sl)|0,Nn=Nn+Math.imul(Vo,So)|0,wn=wn+Math.imul(Vo,Co)|0,wn=wn+Math.imul(Fo,So)|0,zn=zn+Math.imul(Fo,Co)|0,Nn=Nn+Math.imul(No,po)|0,wn=wn+Math.imul(No,Ro)|0,wn=wn+Math.imul(Uo,po)|0,zn=zn+Math.imul(Uo,Ro)|0,Nn=Nn+Math.imul(qo,jo)|0,wn=wn+Math.imul(qo,Ko)|0,wn=wn+Math.imul(ga,jo)|0,zn=zn+Math.imul(ga,Ko)|0,Nn=Nn+Math.imul(Lo,$l)|0,wn=wn+Math.imul(Lo,El)|0,wn=wn+Math.imul(Wo,$l)|0,zn=zn+Math.imul(Wo,El)|0;var zl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(zl>>>26)|0,zl&=67108863,Nn=Math.imul(bo,Al),wn=Math.imul(bo,Ml),wn=wn+Math.imul(Io,Al)|0,zn=Math.imul(Io,Ml),Nn=Nn+Math.imul(Cl,Fl)|0,wn=wn+Math.imul(Cl,Sl)|0,wn=wn+Math.imul(ko,Fl)|0,zn=zn+Math.imul(ko,Sl)|0,Nn=Nn+Math.imul($a,So)|0,wn=wn+Math.imul($a,Co)|0,wn=wn+Math.imul(Jo,So)|0,zn=zn+Math.imul(Jo,Co)|0,Nn=Nn+Math.imul(Vo,po)|0,wn=wn+Math.imul(Vo,Ro)|0,wn=wn+Math.imul(Fo,po)|0,zn=zn+Math.imul(Fo,Ro)|0,Nn=Nn+Math.imul(No,jo)|0,wn=wn+Math.imul(No,Ko)|0,wn=wn+Math.imul(Uo,jo)|0,zn=zn+Math.imul(Uo,Ko)|0,Nn=Nn+Math.imul(qo,$l)|0,wn=wn+Math.imul(qo,El)|0,wn=wn+Math.imul(ga,$l)|0,zn=zn+Math.imul(ga,El)|0;var Gl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Gl>>>26)|0,Gl&=67108863,Nn=Math.imul(bo,Fl),wn=Math.imul(bo,Sl),wn=wn+Math.imul(Io,Fl)|0,zn=Math.imul(Io,Sl),Nn=Nn+Math.imul(Cl,So)|0,wn=wn+Math.imul(Cl,Co)|0,wn=wn+Math.imul(ko,So)|0,zn=zn+Math.imul(ko,Co)|0,Nn=Nn+Math.imul($a,po)|0,wn=wn+Math.imul($a,Ro)|0,wn=wn+Math.imul(Jo,po)|0,zn=zn+Math.imul(Jo,Ro)|0,Nn=Nn+Math.imul(Vo,jo)|0,wn=wn+Math.imul(Vo,Ko)|0,wn=wn+Math.imul(Fo,jo)|0,zn=zn+Math.imul(Fo,Ko)|0,Nn=Nn+Math.imul(No,$l)|0,wn=wn+Math.imul(No,El)|0,wn=wn+Math.imul(Uo,$l)|0,zn=zn+Math.imul(Uo,El)|0;var Jl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Jl>>>26)|0,Jl&=67108863,Nn=Math.imul(bo,So),wn=Math.imul(bo,Co),wn=wn+Math.imul(Io,So)|0,zn=Math.imul(Io,Co),Nn=Nn+Math.imul(Cl,po)|0,wn=wn+Math.imul(Cl,Ro)|0,wn=wn+Math.imul(ko,po)|0,zn=zn+Math.imul(ko,Ro)|0,Nn=Nn+Math.imul($a,jo)|0,wn=wn+Math.imul($a,Ko)|0,wn=wn+Math.imul(Jo,jo)|0,zn=zn+Math.imul(Jo,Ko)|0,Nn=Nn+Math.imul(Vo,$l)|0,wn=wn+Math.imul(Vo,El)|0,wn=wn+Math.imul(Fo,$l)|0,zn=zn+Math.imul(Fo,El)|0;var Pl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Pl>>>26)|0,Pl&=67108863,Nn=Math.imul(bo,po),wn=Math.imul(bo,Ro),wn=wn+Math.imul(Io,po)|0,zn=Math.imul(Io,Ro),Nn=Nn+Math.imul(Cl,jo)|0,wn=wn+Math.imul(Cl,Ko)|0,wn=wn+Math.imul(ko,jo)|0,zn=zn+Math.imul(ko,Ko)|0,Nn=Nn+Math.imul($a,$l)|0,wn=wn+Math.imul($a,El)|0,wn=wn+Math.imul(Jo,$l)|0,zn=zn+Math.imul(Jo,El)|0;var Ul=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Ul>>>26)|0,Ul&=67108863,Nn=Math.imul(bo,jo),wn=Math.imul(bo,Ko),wn=wn+Math.imul(Io,jo)|0,zn=Math.imul(Io,Ko),Nn=Nn+Math.imul(Cl,$l)|0,wn=wn+Math.imul(Cl,El)|0,wn=wn+Math.imul(ko,$l)|0,zn=zn+Math.imul(ko,El)|0;var Yl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Yl>>>26)|0,Yl&=67108863,Nn=Math.imul(bo,$l),wn=Math.imul(bo,El),wn=wn+Math.imul(Io,$l)|0,zn=Math.imul(Io,El);var Vl=(Zn+Nn|0)+((wn&8191)<<13)|0;return Zn=(zn+(wn>>>13)|0)+(Vl>>>26)|0,Vl&=67108863,On[0]=Cu,On[1]=iu,On[2]=pu,On[3]=yu,On[4]=hu,On[5]=mu,On[6]=vu,On[7]=fu,On[8]=gu,On[9]=ou,On[10]=su,On[11]=tu,On[12]=zl,On[13]=Gl,On[14]=Jl,On[15]=Pl,On[16]=Ul,On[17]=Yl,On[18]=Vl,Zn!==0&&(On[19]=Zn,Sn.length++),Sn};Math.imul||(An=In);function jn(Tn,Hr,Xr){Xr.negative=Hr.negative^Tn.negative,Xr.length=Tn.length+Hr.length;for(var Sn=0,Rn=0,Pn=0;Pn>>26)|0,Rn+=On>>>26,On&=67108863}Xr.words[Pn]=Zn,Sn=On,On=Rn}return Sn!==0?Xr.words[Pn]=Sn:Xr.length--,Xr._strip()}function eo(Tn,Hr,Xr){return jn(Tn,Hr,Xr)}jr.prototype.mulTo=function(Hr,Xr){var Sn,Rn=this.length+Hr.length;return this.length===10&&Hr.length===10?Sn=An(this,Hr,Xr):Rn<63?Sn=In(this,Hr,Xr):Rn<1024?Sn=jn(this,Hr,Xr):Sn=eo(this,Hr,Xr),Sn},jr.prototype.mul=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),this.mulTo(Hr,Xr)},jr.prototype.mulf=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),eo(this,Hr,Xr)},jr.prototype.imul=function(Hr){return this.clone().mulTo(Hr,this)},jr.prototype.imuln=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(typeof Hr=="number"),Er(Hr<67108864);for(var Sn=0,Rn=0;Rn>=26,Sn+=Pn/67108864|0,Sn+=On>>>26,this.words[Rn]=On&67108863}return Sn!==0&&(this.words[Rn]=Sn,this.length++),Xr?this.ineg():this},jr.prototype.muln=function(Hr){return this.clone().imuln(Hr)},jr.prototype.sqr=function(){return this.mul(this)},jr.prototype.isqr=function(){return this.imul(this.clone())},jr.prototype.pow=function(Hr){var Xr=Cn(Hr);if(Xr.length===0)return new jr(1);for(var Sn=this,Rn=0;Rn=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=67108863>>>26-Xr<<26-Xr,Pn;if(Xr!==0){var On=0;for(Pn=0;Pn>>26-Xr}On&&(this.words[Pn]=On,this.length++)}if(Sn!==0){for(Pn=this.length-1;Pn>=0;Pn--)this.words[Pn+Sn]=this.words[Pn];for(Pn=0;Pn=0);var Rn;Xr?Rn=(Xr-Xr%26)/26:Rn=0;var Pn=Hr%26,On=Math.min((Hr-Pn)/26,this.length),Zn=67108863^67108863>>>Pn<On)for(this.length-=On,wn=0;wn=0&&(zn!==0||wn>=Rn);wn--){var fo=this.words[wn]|0;this.words[wn]=zn<<26-Pn|fo>>>Pn,zn=fo&Zn}return Nn&&zn!==0&&(Nn.words[Nn.length++]=zn),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},jr.prototype.ishrn=function(Hr,Xr,Sn){return Er(this.negative===0),this.iushrn(Hr,Xr,Sn)},jr.prototype.shln=function(Hr){return this.clone().ishln(Hr)},jr.prototype.ushln=function(Hr){return this.clone().iushln(Hr)},jr.prototype.shrn=function(Hr){return this.clone().ishrn(Hr)},jr.prototype.ushrn=function(Hr){return this.clone().iushrn(Hr)},jr.prototype.testn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<=0);var Xr=Hr%26,Sn=(Hr-Xr)/26;if(Er(this.negative===0,"imaskn works only with positive numbers"),this.length<=Sn)return this;if(Xr!==0&&Sn++,this.length=Math.min(Sn,this.length),Xr!==0){var Rn=67108863^67108863>>>Xr<=67108864;Xr++)this.words[Xr]-=67108864,Xr===this.length-1?this.words[Xr+1]=1:this.words[Xr+1]++;return this.length=Math.max(this.length,Xr+1),this},jr.prototype.isubn=function(Hr){if(Er(typeof Hr=="number"),Er(Hr<67108864),Hr<0)return this.iaddn(-Hr);if(this.negative!==0)return this.negative=0,this.iaddn(Hr),this.negative=1,this;if(this.words[0]-=Hr,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Xr=0;Xr>26)-(Nn/67108864|0),this.words[Pn+Sn]=On&67108863}for(;Pn>26,this.words[Pn+Sn]=On&67108863;if(Zn===0)return this._strip();for(Er(Zn===-1),Zn=0,Pn=0;Pn>26,this.words[Pn]=On&67108863;return this.negative=1,this._strip()},jr.prototype._wordDiv=function(Hr,Xr){var Sn=this.length-Hr.length,Rn=this.clone(),Pn=Hr,On=Pn.words[Pn.length-1]|0,Zn=this._countBits(On);Sn=26-Zn,Sn!==0&&(Pn=Pn.ushln(Sn),Rn.iushln(Sn),On=Pn.words[Pn.length-1]|0);var Nn=Rn.length-Pn.length,wn;if(Xr!=="mod"){wn=new jr(null),wn.length=Nn+1,wn.words=new Array(wn.length);for(var zn=0;zn=0;vo--){var go=(Rn.words[Pn.length+vo]|0)*67108864+(Rn.words[Pn.length+vo-1]|0);for(go=Math.min(go/On|0,67108863),Rn._ishlnsubmul(Pn,go,vo);Rn.negative!==0;)go--,Rn.negative=0,Rn._ishlnsubmul(Pn,1,vo),Rn.isZero()||(Rn.negative^=1);wn&&(wn.words[vo]=go)}return wn&&wn._strip(),Rn._strip(),Xr!=="div"&&Sn!==0&&Rn.iushrn(Sn),{div:wn||null,mod:Rn}},jr.prototype.divmod=function(Hr,Xr,Sn){if(Er(!Hr.isZero()),this.isZero())return{div:new jr(0),mod:new jr(0)};var Rn,Pn,On;return this.negative!==0&&Hr.negative===0?(On=this.neg().divmod(Hr,Xr),Xr!=="mod"&&(Rn=On.div.neg()),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.iadd(Hr)),{div:Rn,mod:Pn}):this.negative===0&&Hr.negative!==0?(On=this.divmod(Hr.neg(),Xr),Xr!=="mod"&&(Rn=On.div.neg()),{div:Rn,mod:On.mod}):this.negative&Hr.negative?(On=this.neg().divmod(Hr.neg(),Xr),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.isub(Hr)),{div:On.div,mod:Pn}):Hr.length>this.length||this.cmp(Hr)<0?{div:new jr(0),mod:this}:Hr.length===1?Xr==="div"?{div:this.divn(Hr.words[0]),mod:null}:Xr==="mod"?{div:null,mod:new jr(this.modrn(Hr.words[0]))}:{div:this.divn(Hr.words[0]),mod:new jr(this.modrn(Hr.words[0]))}:this._wordDiv(Hr,Xr)},jr.prototype.div=function(Hr){return this.divmod(Hr,"div",!1).div},jr.prototype.mod=function(Hr){return this.divmod(Hr,"mod",!1).mod},jr.prototype.umod=function(Hr){return this.divmod(Hr,"mod",!0).mod},jr.prototype.divRound=function(Hr){var Xr=this.divmod(Hr);if(Xr.mod.isZero())return Xr.div;var Sn=Xr.div.negative!==0?Xr.mod.isub(Hr):Xr.mod,Rn=Hr.ushrn(1),Pn=Hr.andln(1),On=Sn.cmp(Rn);return On<0||Pn===1&&On===0?Xr.div:Xr.div.negative!==0?Xr.div.isubn(1):Xr.div.iaddn(1)},jr.prototype.modrn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=(1<<26)%Hr,Rn=0,Pn=this.length-1;Pn>=0;Pn--)Rn=(Sn*Rn+(this.words[Pn]|0))%Hr;return Xr?-Rn:Rn},jr.prototype.modn=function(Hr){return this.modrn(Hr)},jr.prototype.idivn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=0,Rn=this.length-1;Rn>=0;Rn--){var Pn=(this.words[Rn]|0)+Sn*67108864;this.words[Rn]=Pn/Hr|0,Sn=Pn%Hr}return this._strip(),Xr?this.ineg():this},jr.prototype.divn=function(Hr){return this.clone().idivn(Hr)},jr.prototype.egcd=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=new jr(0),Zn=new jr(1),Nn=0;Xr.isEven()&&Sn.isEven();)Xr.iushrn(1),Sn.iushrn(1),++Nn;for(var wn=Sn.clone(),zn=Xr.clone();!Xr.isZero();){for(var fo=0,vo=1;!(Xr.words[0]&vo)&&fo<26;++fo,vo<<=1);if(fo>0)for(Xr.iushrn(fo);fo-- >0;)(Rn.isOdd()||Pn.isOdd())&&(Rn.iadd(wn),Pn.isub(zn)),Rn.iushrn(1),Pn.iushrn(1);for(var go=0,uo=1;!(Sn.words[0]&uo)&&go<26;++go,uo<<=1);if(go>0)for(Sn.iushrn(go);go-- >0;)(On.isOdd()||Zn.isOdd())&&(On.iadd(wn),Zn.isub(zn)),On.iushrn(1),Zn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(On),Pn.isub(Zn)):(Sn.isub(Xr),On.isub(Rn),Zn.isub(Pn))}return{a:On,b:Zn,gcd:Sn.iushln(Nn)}},jr.prototype._invmp=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=Sn.clone();Xr.cmpn(1)>0&&Sn.cmpn(1)>0;){for(var Zn=0,Nn=1;!(Xr.words[0]&Nn)&&Zn<26;++Zn,Nn<<=1);if(Zn>0)for(Xr.iushrn(Zn);Zn-- >0;)Rn.isOdd()&&Rn.iadd(On),Rn.iushrn(1);for(var wn=0,zn=1;!(Sn.words[0]&zn)&&wn<26;++wn,zn<<=1);if(wn>0)for(Sn.iushrn(wn);wn-- >0;)Pn.isOdd()&&Pn.iadd(On),Pn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(Pn)):(Sn.isub(Xr),Pn.isub(Rn))}var fo;return Xr.cmpn(1)===0?fo=Rn:fo=Pn,fo.cmpn(0)<0&&fo.iadd(Hr),fo},jr.prototype.gcd=function(Hr){if(this.isZero())return Hr.abs();if(Hr.isZero())return this.abs();var Xr=this.clone(),Sn=Hr.clone();Xr.negative=0,Sn.negative=0;for(var Rn=0;Xr.isEven()&&Sn.isEven();Rn++)Xr.iushrn(1),Sn.iushrn(1);do{for(;Xr.isEven();)Xr.iushrn(1);for(;Sn.isEven();)Sn.iushrn(1);var Pn=Xr.cmp(Sn);if(Pn<0){var On=Xr;Xr=Sn,Sn=On}else if(Pn===0||Sn.cmpn(1)===0)break;Xr.isub(Sn)}while(!0);return Sn.iushln(Rn)},jr.prototype.invm=function(Hr){return this.egcd(Hr).a.umod(Hr)},jr.prototype.isEven=function(){return(this.words[0]&1)===0},jr.prototype.isOdd=function(){return(this.words[0]&1)===1},jr.prototype.andln=function(Hr){return this.words[0]&Hr},jr.prototype.bincn=function(Hr){Er(typeof Hr=="number");var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<>>26,Zn&=67108863,this.words[On]=Zn}return Pn!==0&&(this.words[On]=Pn,this.length++),this},jr.prototype.isZero=function(){return this.length===1&&this.words[0]===0},jr.prototype.cmpn=function(Hr){var Xr=Hr<0;if(this.negative!==0&&!Xr)return-1;if(this.negative===0&&Xr)return 1;this._strip();var Sn;if(this.length>1)Sn=1;else{Xr&&(Hr=-Hr),Er(Hr<=67108863,"Number is too big");var Rn=this.words[0]|0;Sn=Rn===Hr?0:RnHr.length)return 1;if(this.length=0;Sn--){var Rn=this.words[Sn]|0,Pn=Hr.words[Sn]|0;if(Rn!==Pn){RnPn&&(Xr=1);break}}return Xr},jr.prototype.gtn=function(Hr){return this.cmpn(Hr)===1},jr.prototype.gt=function(Hr){return this.cmp(Hr)===1},jr.prototype.gten=function(Hr){return this.cmpn(Hr)>=0},jr.prototype.gte=function(Hr){return this.cmp(Hr)>=0},jr.prototype.ltn=function(Hr){return this.cmpn(Hr)===-1},jr.prototype.lt=function(Hr){return this.cmp(Hr)===-1},jr.prototype.lten=function(Hr){return this.cmpn(Hr)<=0},jr.prototype.lte=function(Hr){return this.cmp(Hr)<=0},jr.prototype.eqn=function(Hr){return this.cmpn(Hr)===0},jr.prototype.eq=function(Hr){return this.cmp(Hr)===0},jr.red=function(Hr){return new so(Hr)},jr.prototype.toRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),Er(this.negative===0,"red works only with positives"),Hr.convertTo(this)._forceRed(Hr)},jr.prototype.fromRed=function(){return Er(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},jr.prototype._forceRed=function(Hr){return this.red=Hr,this},jr.prototype.forceRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),this._forceRed(Hr)},jr.prototype.redAdd=function(Hr){return Er(this.red,"redAdd works only with red numbers"),this.red.add(this,Hr)},jr.prototype.redIAdd=function(Hr){return Er(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Hr)},jr.prototype.redSub=function(Hr){return Er(this.red,"redSub works only with red numbers"),this.red.sub(this,Hr)},jr.prototype.redISub=function(Hr){return Er(this.red,"redISub works only with red numbers"),this.red.isub(this,Hr)},jr.prototype.redShl=function(Hr){return Er(this.red,"redShl works only with red numbers"),this.red.shl(this,Hr)},jr.prototype.redMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.mul(this,Hr)},jr.prototype.redIMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.imul(this,Hr)},jr.prototype.redSqr=function(){return Er(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},jr.prototype.redISqr=function(){return Er(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},jr.prototype.redSqrt=function(){return Er(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},jr.prototype.redInvm=function(){return Er(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},jr.prototype.redNeg=function(){return Er(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},jr.prototype.redPow=function(Hr){return Er(this.red&&!Hr.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Hr)};var ro={k256:null,p224:null,p192:null,p25519:null};function to(Tn,Hr){this.name=Tn,this.p=new jr(Hr,16),this.n=this.p.bitLength(),this.k=new jr(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}to.prototype._tmp=function(){var Hr=new jr(null);return Hr.words=new Array(Math.ceil(this.n/13)),Hr},to.prototype.ireduce=function(Hr){var Xr=Hr,Sn;do this.split(Xr,this.tmp),Xr=this.imulK(Xr),Xr=Xr.iadd(this.tmp),Sn=Xr.bitLength();while(Sn>this.n);var Rn=Sn0?Xr.isub(this.p):Xr.strip!==void 0?Xr.strip():Xr._strip(),Xr},to.prototype.split=function(Hr,Xr){Hr.iushrn(this.n,0,Xr)},to.prototype.imulK=function(Hr){return Hr.imul(this.k)};function _i(){to.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}kr(_i,to),_i.prototype.split=function(Hr,Xr){for(var Sn=4194303,Rn=Math.min(Hr.length,9),Pn=0;Pn>>22,On=Zn}On>>>=22,Hr.words[Pn-10]=On,On===0&&Hr.length>10?Hr.length-=10:Hr.length-=9},_i.prototype.imulK=function(Hr){Hr.words[Hr.length]=0,Hr.words[Hr.length+1]=0,Hr.length+=2;for(var Xr=0,Sn=0;Sn>>=26,Hr.words[Sn]=Pn,Xr=Rn}return Xr!==0&&(Hr.words[Hr.length++]=Xr),Hr},jr._prime=function(Hr){if(ro[Hr])return ro[Hr];var Xr;if(Hr==="k256")Xr=new _i;else if(Hr==="p224")Xr=new oo;else if(Hr==="p192")Xr=new io;else if(Hr==="p25519")Xr=new co;else throw new Error("Unknown prime "+Hr);return ro[Hr]=Xr,Xr};function so(Tn){if(typeof Tn=="string"){var Hr=jr._prime(Tn);this.m=Hr.p,this.prime=Hr}else Er(Tn.gtn(1),"modulus must be greater than 1"),this.m=Tn,this.prime=null}so.prototype._verify1=function(Hr){Er(Hr.negative===0,"red works only with positives"),Er(Hr.red,"red works only with red numbers")},so.prototype._verify2=function(Hr,Xr){Er((Hr.negative|Xr.negative)===0,"red works only with positives"),Er(Hr.red&&Hr.red===Xr.red,"red works only with red numbers")},so.prototype.imod=function(Hr){return this.prime?this.prime.ireduce(Hr)._forceRed(this):(Vr(Hr,Hr.umod(this.m)._forceRed(this)),Hr)},so.prototype.neg=function(Hr){return Hr.isZero()?Hr.clone():this.m.sub(Hr)._forceRed(this)},so.prototype.add=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.add(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn._forceRed(this)},so.prototype.iadd=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.iadd(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn},so.prototype.sub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.sub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn._forceRed(this)},so.prototype.isub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.isub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn},so.prototype.shl=function(Hr,Xr){return this._verify1(Hr),this.imod(Hr.ushln(Xr))},so.prototype.imul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.imul(Xr))},so.prototype.mul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.mul(Xr))},so.prototype.isqr=function(Hr){return this.imul(Hr,Hr.clone())},so.prototype.sqr=function(Hr){return this.mul(Hr,Hr)},so.prototype.sqrt=function(Hr){if(Hr.isZero())return Hr.clone();var Xr=this.m.andln(3);if(Er(Xr%2===1),Xr===3){var Sn=this.m.add(new jr(1)).iushrn(2);return this.pow(Hr,Sn)}for(var Rn=this.m.subn(1),Pn=0;!Rn.isZero()&&Rn.andln(1)===0;)Pn++,Rn.iushrn(1);Er(!Rn.isZero());var On=new jr(1).toRed(this),Zn=On.redNeg(),Nn=this.m.subn(1).iushrn(1),wn=this.m.bitLength();for(wn=new jr(2*wn*wn).toRed(this);this.pow(wn,Nn).cmp(Zn)!==0;)wn.redIAdd(Zn);for(var zn=this.pow(wn,Rn),fo=this.pow(Hr,Rn.addn(1).iushrn(1)),vo=this.pow(Hr,Rn),go=Pn;vo.cmp(On)!==0;){for(var uo=vo,lo=0;uo.cmp(On)!==0;lo++)uo=uo.redSqr();Er(lo=0;Pn--){for(var zn=Xr.words[Pn],fo=wn-1;fo>=0;fo--){var vo=zn>>fo&1;if(On!==Rn[0]&&(On=this.sqr(On)),vo===0&&Zn===0){Nn=0;continue}Zn<<=1,Zn|=vo,Nn++,!(Nn!==Sn&&(Pn!==0||fo!==0))&&(On=this.mul(On,Rn[Zn]),Nn=0,Zn=0)}wn=26}return On},so.prototype.convertTo=function(Hr){var Xr=Hr.umod(this.m);return Xr===Hr?Xr.clone():Xr},so.prototype.convertFrom=function(Hr){var Xr=Hr.clone();return Xr.red=null,Xr},jr.mont=function(Hr){return new no(Hr)};function no(Tn){so.call(this,Tn),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new jr(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}kr(no,so),no.prototype.convertTo=function(Hr){return this.imod(Hr.ushln(this.shift))},no.prototype.convertFrom=function(Hr){var Xr=this.imod(Hr.mul(this.rinv));return Xr.red=null,Xr},no.prototype.imul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return Hr.words[0]=0,Hr.length=1,Hr;var Sn=Hr.imul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.mul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return new jr(0)._forceRed(this);var Sn=Hr.mul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.invm=function(Hr){var Xr=this.imod(Hr._invmp(this.m).mul(this.r2));return Xr._forceRed(this)}})(fr,commonjsGlobal)})(bn$1);var bnExports$1=bn$1.exports;const BN$1=getDefaultExportFromCjs$2(bnExports$1);var _Buffer$1=safeBufferExports.Buffer;function base$1(fr){if(fr.length>=255)throw new TypeError("Alphabet too long");for(var br=new Uint8Array(256),wr=0;wr>>0,jn=new Uint8Array(An);Cn!==In;){for(var eo=Qr[Cn],ro=0,to=An-1;(eo!==0||ro>>0,jn[to]=eo%Br>>>0,eo=eo/Br>>>0;if(eo!==0)throw new Error("Non-zero carry");En=ro,Cn++}for(var _i=An-En;_i!==An&&jn[_i]===0;)_i++;for(var oo=Wr.repeat(_n);_i>>0,An=new Uint8Array(In);_n>>0,An[ro]=jn%256>>>0,jn=jn/256>>>0;if(jn!==0)throw new Error("Non-zero carry");Cn=eo,_n++}for(var to=In-Cn;to!==In&&An[to]===0;)to++;var _i=_Buffer$1.allocUnsafe(En+(In-to));_i.fill(0,0,En);for(var oo=En;to!==In;)_i[oo++]=An[to++];return _i}function Jr(Qr){var _n=Zr(Qr);if(_n)return _n;throw new Error("Non-base"+Br+" character")}return{encode:Vr,decodeUnsafe:Zr,decode:Jr}}var src$1=base$1,basex$1=src$1,ALPHABET$1="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58$2=basex$1(ALPHABET$1);const bs58$3=getDefaultExportFromCjs$2(bs58$2);let StructError$1=class extends TypeError{constructor(br,wr){let Er;const{message:kr,explanation:jr,...Br}=br,{path:Wr}=br,qr=Wr.length===0?kr:`At path: ${Wr.join(".")} -- ${kr}`;super(jr??qr),jr!=null&&(this.cause=qr),Object.assign(this,Br),this.name=this.constructor.name,this.failures=()=>Er??(Er=[br,...wr()])}};function isIterable$1(fr){return isObject$1(fr)&&typeof fr[Symbol.iterator]=="function"}function isObject$1(fr){return typeof fr=="object"&&fr!=null}function isNonArrayObject$1(fr){return isObject$1(fr)&&!Array.isArray(fr)}function print$1(fr){return typeof fr=="symbol"?fr.toString():typeof fr=="string"?JSON.stringify(fr):`${fr}`}function shiftIterator$1(fr){const{done:br,value:wr}=fr.next();return br?void 0:wr}function toFailure$1(fr,br,wr,Er){if(fr===!0)return;fr===!1?fr={}:typeof fr=="string"&&(fr={message:fr});const{path:kr,branch:jr}=br,{type:Br}=wr,{refinement:Wr,message:qr=`Expected a value of type \`${Br}\`${Wr?` with refinement \`${Wr}\``:""}, but received: \`${print$1(Er)}\``}=fr;return{value:Er,type:Br,refinement:Wr,key:kr[kr.length-1],path:kr,branch:jr,...fr,message:qr}}function*toFailures$1(fr,br,wr,Er){isIterable$1(fr)||(fr=[fr]);for(const kr of fr){const jr=toFailure$1(kr,br,wr,Er);jr&&(yield jr)}}function*run$1(fr,br,wr={}){const{path:Er=[],branch:kr=[fr],coerce:jr=!1,mask:Br=!1}=wr,Wr={path:Er,branch:kr,mask:Br};jr&&(fr=br.coercer(fr,Wr));let qr="valid";for(const Gr of br.validator(fr,Wr))Gr.explanation=wr.message,qr="not_valid",yield[Gr,void 0];for(let[Gr,Vr,Zr]of br.entries(fr,Wr)){const Jr=run$1(Vr,Zr,{path:Gr===void 0?Er:[...Er,Gr],branch:Gr===void 0?kr:[...kr,Vr],coerce:jr,mask:Br,message:wr.message});for(const Qr of Jr)Qr[0]?(qr=Qr[0].refinement!=null?"not_refined":"not_valid",yield[Qr[0],void 0]):jr&&(Vr=Qr[1],Gr===void 0?fr=Vr:fr instanceof Map?fr.set(Gr,Vr):fr instanceof Set?fr.add(Vr):isObject$1(fr)&&(Vr!==void 0||Gr in fr)&&(fr[Gr]=Vr))}if(qr!=="not_valid")for(const Gr of br.refiner(fr,Wr))Gr.explanation=wr.message,qr="not_refined",yield[Gr,void 0];qr==="valid"&&(yield[void 0,fr])}let Struct$3=class{constructor(br){const{type:wr,schema:Er,validator:kr,refiner:jr,coercer:Br=qr=>qr,entries:Wr=function*(){}}=br;this.type=wr,this.schema=Er,this.entries=Wr,this.coercer=Br,kr?this.validator=(qr,Gr)=>{const Vr=kr(qr,Gr);return toFailures$1(Vr,Gr,this,qr)}:this.validator=()=>[],jr?this.refiner=(qr,Gr)=>{const Vr=jr(qr,Gr);return toFailures$1(Vr,Gr,this,qr)}:this.refiner=()=>[]}assert(br,wr){return assert$1(br,this,wr)}create(br,wr){return create$1(br,this,wr)}is(br){return is$1(br,this)}mask(br,wr){return mask$1(br,this,wr)}validate(br,wr={}){return validate$1(br,this,wr)}};function assert$1(fr,br,wr){const Er=validate$1(fr,br,{message:wr});if(Er[0])throw Er[0]}function create$1(fr,br,wr){const Er=validate$1(fr,br,{coerce:!0,message:wr});if(Er[0])throw Er[0];return Er[1]}function mask$1(fr,br,wr){const Er=validate$1(fr,br,{coerce:!0,mask:!0,message:wr});if(Er[0])throw Er[0];return Er[1]}function is$1(fr,br){return!validate$1(fr,br)[0]}function validate$1(fr,br,wr={}){const Er=run$1(fr,br,wr),kr=shiftIterator$1(Er);return kr[0]?[new StructError$1(kr[0],function*(){for(const Br of Er)Br[0]&&(yield Br[0])}),void 0]:[void 0,kr[1]]}function define$1(fr,br){return new Struct$3({type:fr,schema:null,validator:br})}function any$1(){return define$1("any",()=>!0)}function array$1(fr){return new Struct$3({type:"array",schema:fr,*entries(br){if(fr&&Array.isArray(br))for(const[wr,Er]of br.entries())yield[wr,Er,fr]},coercer(br){return Array.isArray(br)?br.slice():br},validator(br){return Array.isArray(br)||`Expected an array value, but received: ${print$1(br)}`}})}function boolean$1(){return define$1("boolean",fr=>typeof fr=="boolean")}function instance$1(fr){return define$1("instance",br=>br instanceof fr||`Expected a \`${fr.name}\` instance, but received: ${print$1(br)}`)}function literal$1(fr){const br=print$1(fr),wr=typeof fr;return new Struct$3({type:"literal",schema:wr==="string"||wr==="number"||wr==="boolean"?fr:null,validator(Er){return Er===fr||`Expected the literal \`${br}\`, but received: ${print$1(Er)}`}})}function never$1(){return define$1("never",()=>!1)}function nullable$1(fr){return new Struct$3({...fr,validator:(br,wr)=>br===null||fr.validator(br,wr),refiner:(br,wr)=>br===null||fr.refiner(br,wr)})}function number$1(){return define$1("number",fr=>typeof fr=="number"&&!isNaN(fr)||`Expected a number, but received: ${print$1(fr)}`)}function optional$1(fr){return new Struct$3({...fr,validator:(br,wr)=>br===void 0||fr.validator(br,wr),refiner:(br,wr)=>br===void 0||fr.refiner(br,wr)})}function record$1(fr,br){return new Struct$3({type:"record",schema:null,*entries(wr){if(isObject$1(wr))for(const Er in wr){const kr=wr[Er];yield[Er,Er,fr],yield[Er,kr,br]}},validator(wr){return isNonArrayObject$1(wr)||`Expected an object, but received: ${print$1(wr)}`},coercer(wr){return isNonArrayObject$1(wr)?{...wr}:wr}})}function string$1(){return define$1("string",fr=>typeof fr=="string"||`Expected a string, but received: ${print$1(fr)}`)}function tuple$1(fr){const br=never$1();return new Struct$3({type:"tuple",schema:null,*entries(wr){if(Array.isArray(wr)){const Er=Math.max(fr.length,wr.length);for(let kr=0;krwr.type).join(" | ");return new Struct$3({type:"union",schema:null,coercer(wr,Er){for(const kr of fr){const[jr,Br]=kr.validate(wr,{coerce:!0,mask:Er.mask});if(!jr)return Br}return wr},validator(wr,Er){const kr=[];for(const jr of fr){const[...Br]=run$1(wr,jr,Er),[Wr]=Br;if(Wr[0])for(const[qr]of Br)qr&&kr.push(qr);else return[]}return[`Expected the value to satisfy a union of \`${br}\`, but received: ${print$1(wr)}`,...kr]}})}function unknown$1(){return define$1("unknown",()=>!0)}function coerce$1(fr,br,wr){return new Struct$3({...fr,coercer:(Er,kr)=>is$1(Er,br)?fr.coercer(wr(Er,kr),kr):fr.coercer(Er,kr)})}function isOnCurve$1(fr){try{return ed25519.ExtendedPoint.fromHex(fr),!0}catch{return!1}}const toBuffer$1=fr=>Buffer$1$1.isBuffer(fr)?fr:fr instanceof Uint8Array?Buffer$1$1.from(fr.buffer,fr.byteOffset,fr.byteLength):Buffer$1$1.from(fr);let Struct$2=class{constructor(br){Object.assign(this,br)}encode(){return Buffer$1$1.from(serialize_1(SOLANA_SCHEMA$1,this))}static decode(br){return deserialize_1(SOLANA_SCHEMA$1,this,br)}static decodeUnchecked(br){return deserializeUnchecked_1(SOLANA_SCHEMA$1,this,br)}};const SOLANA_SCHEMA$1=new Map;var _PublicKey$1;const MAX_SEED_LENGTH$1=32,PUBLIC_KEY_LENGTH$1=32;function isPublicKeyData$1(fr){return fr._bn!==void 0}let uniquePublicKeyCounter$1=1,PublicKey$1=class py extends Struct$2{constructor(br){if(super({}),this._bn=void 0,isPublicKeyData$1(br))this._bn=br._bn;else{if(typeof br=="string"){const wr=bs58$3.decode(br);if(wr.length!=PUBLIC_KEY_LENGTH$1)throw new Error("Invalid public key input");this._bn=new BN$1(wr)}else this._bn=new BN$1(br);if(this._bn.byteLength()>PUBLIC_KEY_LENGTH$1)throw new Error("Invalid public key input")}}static unique(){const br=new py(uniquePublicKeyCounter$1);return uniquePublicKeyCounter$1+=1,new py(br.toBuffer())}equals(br){return this._bn.eq(br._bn)}toBase58(){return bs58$3.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const br=this.toBuffer();return new Uint8Array(br.buffer,br.byteOffset,br.byteLength)}toBuffer(){const br=this._bn.toArrayLike(Buffer$1$1);if(br.length===PUBLIC_KEY_LENGTH$1)return br;const wr=Buffer$1$1.alloc(32);return br.copy(wr,32-br.length),wr}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(br,wr,Er){const kr=Buffer$1$1.concat([br.toBuffer(),Buffer$1$1.from(wr),Er.toBuffer()]),jr=sha256$4(kr);return new py(jr)}static createProgramAddressSync(br,wr){let Er=Buffer$1$1.alloc(0);br.forEach(function(jr){if(jr.length>MAX_SEED_LENGTH$1)throw new TypeError("Max seed length exceeded");Er=Buffer$1$1.concat([Er,toBuffer$1(jr)])}),Er=Buffer$1$1.concat([Er,wr.toBuffer(),Buffer$1$1.from("ProgramDerivedAddress")]);const kr=sha256$4(Er);if(isOnCurve$1(kr))throw new Error("Invalid seeds, address must fall off the curve");return new py(kr)}static async createProgramAddress(br,wr){return this.createProgramAddressSync(br,wr)}static findProgramAddressSync(br,wr){let Er=255,kr;for(;Er!=0;){try{const jr=br.concat(Buffer$1$1.from([Er]));kr=this.createProgramAddressSync(jr,wr)}catch(jr){if(jr instanceof TypeError)throw jr;Er--;continue}return[kr,Er]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(br,wr){return this.findProgramAddressSync(br,wr)}static isOnCurve(br){const wr=new py(br);return isOnCurve$1(wr.toBytes())}};_PublicKey$1=PublicKey$1;PublicKey$1.default=new _PublicKey$1("11111111111111111111111111111111");SOLANA_SCHEMA$1.set(PublicKey$1,{kind:"struct",fields:[["_bn","u256"]]});new PublicKey$1("BPFLoader1111111111111111111111111111111111");const SIGNATURE_LENGTH_IN_BYTES$1=64,publicKey$2=(fr="publicKey")=>blob(32,fr),rustString$1=(fr="string")=>{const br=struct([u32("length"),u32("lengthPadding"),blob(offset(u32(),-8),"chars")],fr),wr=br.decode.bind(br),Er=br.encode.bind(br),kr=br;return kr.decode=(jr,Br)=>wr(jr,Br).chars.toString(),kr.encode=(jr,Br,Wr)=>{const qr={chars:Buffer$1$1.from(jr,"utf8")};return Er(qr,Br,Wr)},kr.alloc=jr=>u32().span+u32().span+Buffer$1$1.from(jr,"utf8").length,kr},authorized$1=(fr="authorized")=>struct([publicKey$2("staker"),publicKey$2("withdrawer")],fr),lockup$1=(fr="lockup")=>struct([ns64("unixTimestamp"),ns64("epoch"),publicKey$2("custodian")],fr),voteInit$1=(fr="voteInit")=>struct([publicKey$2("nodePubkey"),publicKey$2("authorizedVoter"),publicKey$2("authorizedWithdrawer"),u8("commission")],fr),voteAuthorizeWithSeedArgs$1=(fr="voteAuthorizeWithSeedArgs")=>struct([u32("voteAuthorizationType"),publicKey$2("currentAuthorityDerivedKeyOwnerPubkey"),rustString$1("currentAuthorityDerivedKeySeed"),publicKey$2("newAuthorized")],fr);Buffer$1$1.alloc(SIGNATURE_LENGTH_IN_BYTES$1).fill(0);new PublicKey$1("SysvarC1ock11111111111111111111111111111111");new PublicKey$1("SysvarEpochSchedu1e111111111111111111111111");new PublicKey$1("Sysvar1nstructions1111111111111111111111111");new PublicKey$1("SysvarRecentB1ockHashes11111111111111111111");new PublicKey$1("SysvarRent111111111111111111111111111111111");new PublicKey$1("SysvarRewards111111111111111111111111111111");new PublicKey$1("SysvarS1otHashes111111111111111111111111111");new PublicKey$1("SysvarS1otHistory11111111111111111111111111");new PublicKey$1("SysvarStakeHistory1111111111111111111111111");const FeeCalculatorLayout$1=nu64("lamportsPerSignature"),NonceAccountLayout$1=struct([u32("version"),u32("state"),publicKey$2("authorizedPubkey"),publicKey$2("nonce"),struct([FeeCalculatorLayout$1],"feeCalculator")]);NonceAccountLayout$1.span;const encodeDecode$1=fr=>{const br=fr.decode.bind(fr),wr=fr.encode.bind(fr);return{decode:br,encode:wr}},bigInt$1=fr=>br=>{const wr=blob(fr,br),{encode:Er,decode:kr}=encodeDecode$1(wr),jr=wr;return jr.decode=(Br,Wr)=>{const qr=kr(Br,Wr);return toBigIntLE_1(Buffer$1$1.from(qr))},jr.encode=(Br,Wr,qr)=>{const Gr=toBufferLE_1(Br,fr);return Er(Gr,Wr,qr)},jr},u64$1=bigInt$1(8);Object.freeze({Create:{index:0,layout:struct([u32("instruction"),ns64("lamports"),ns64("space"),publicKey$2("programId")])},Assign:{index:1,layout:struct([u32("instruction"),publicKey$2("programId")])},Transfer:{index:2,layout:struct([u32("instruction"),u64$1("lamports")])},CreateWithSeed:{index:3,layout:struct([u32("instruction"),publicKey$2("base"),rustString$1("seed"),ns64("lamports"),ns64("space"),publicKey$2("programId")])},AdvanceNonceAccount:{index:4,layout:struct([u32("instruction")])},WithdrawNonceAccount:{index:5,layout:struct([u32("instruction"),ns64("lamports")])},InitializeNonceAccount:{index:6,layout:struct([u32("instruction"),publicKey$2("authorized")])},AuthorizeNonceAccount:{index:7,layout:struct([u32("instruction"),publicKey$2("authorized")])},Allocate:{index:8,layout:struct([u32("instruction"),ns64("space")])},AllocateWithSeed:{index:9,layout:struct([u32("instruction"),publicKey$2("base"),rustString$1("seed"),ns64("space"),publicKey$2("programId")])},AssignWithSeed:{index:10,layout:struct([u32("instruction"),publicKey$2("base"),rustString$1("seed"),publicKey$2("programId")])},TransferWithSeed:{index:11,layout:struct([u32("instruction"),u64$1("lamports"),rustString$1("seed"),publicKey$2("programId")])},UpgradeNonceAccount:{index:12,layout:struct([u32("instruction")])}});new PublicKey$1("11111111111111111111111111111111");new PublicKey$1("BPFLoader2111111111111111111111111111111111");struct([u32("typeIndex"),u64$1("deactivationSlot"),nu64("lastExtendedSlot"),u8("lastExtendedStartIndex"),u8(),seq(publicKey$2(),offset(u8(),-1),"authority")]);const PublicKeyFromString$1=coerce$1(instance$1(PublicKey$1),string$1(),fr=>new PublicKey$1(fr)),RawAccountDataResult$1=tuple$1([string$1(),literal$1("base64")]),BufferFromRawAccountData$1=coerce$1(instance$1(Buffer$1$1),RawAccountDataResult$1,fr=>Buffer$1$1.from(fr[0],"base64"));function createRpcResult$1(fr){return union$1([type$1({jsonrpc:literal$1("2.0"),id:string$1(),result:fr}),type$1({jsonrpc:literal$1("2.0"),id:string$1(),error:type$1({code:unknown$1(),message:string$1(),data:optional$1(any$1())})})])}const UnknownRpcResult$1=createRpcResult$1(unknown$1());function jsonRpcResult$1(fr){return coerce$1(createRpcResult$1(fr),UnknownRpcResult$1,br=>"error"in br?br:{...br,result:create$1(br.result,fr)})}function jsonRpcResultAndContext$1(fr){return jsonRpcResult$1(type$1({context:type$1({slot:number$1()}),value:fr}))}function notificationResultAndContext$1(fr){return type$1({context:type$1({slot:number$1()}),value:fr})}const GetInflationGovernorResult$1=type$1({foundation:number$1(),foundationTerm:number$1(),initial:number$1(),taper:number$1(),terminal:number$1()});jsonRpcResult$1(array$1(nullable$1(type$1({epoch:number$1(),effectiveSlot:number$1(),amount:number$1(),postBalance:number$1(),commission:optional$1(nullable$1(number$1()))}))));const GetRecentPrioritizationFeesResult$1=array$1(type$1({slot:number$1(),prioritizationFee:number$1()})),GetInflationRateResult$1=type$1({total:number$1(),validator:number$1(),foundation:number$1(),epoch:number$1()}),GetEpochInfoResult$1=type$1({epoch:number$1(),slotIndex:number$1(),slotsInEpoch:number$1(),absoluteSlot:number$1(),blockHeight:optional$1(number$1()),transactionCount:optional$1(number$1())}),GetEpochScheduleResult$1=type$1({slotsPerEpoch:number$1(),leaderScheduleSlotOffset:number$1(),warmup:boolean$1(),firstNormalEpoch:number$1(),firstNormalSlot:number$1()}),GetLeaderScheduleResult$1=record$1(string$1(),array$1(number$1())),TransactionErrorResult$1=nullable$1(union$1([type$1({}),string$1()])),SignatureStatusResult$1=type$1({err:TransactionErrorResult$1}),SignatureReceivedResult$1=literal$1("receivedSignature");type$1({"solana-core":string$1(),"feature-set":optional$1(number$1())});const ParsedInstructionStruct$1=type$1({program:string$1(),programId:PublicKeyFromString$1,parsed:unknown$1()}),PartiallyDecodedInstructionStruct$1=type$1({programId:PublicKeyFromString$1,accounts:array$1(PublicKeyFromString$1),data:string$1()});jsonRpcResultAndContext$1(type$1({err:nullable$1(union$1([type$1({}),string$1()])),logs:nullable$1(array$1(string$1())),accounts:optional$1(nullable$1(array$1(nullable$1(type$1({executable:boolean$1(),owner:string$1(),lamports:number$1(),data:array$1(string$1()),rentEpoch:optional$1(number$1())}))))),unitsConsumed:optional$1(number$1()),returnData:optional$1(nullable$1(type$1({programId:string$1(),data:tuple$1([string$1(),literal$1("base64")])}))),innerInstructions:optional$1(nullable$1(array$1(type$1({index:number$1(),instructions:array$1(union$1([ParsedInstructionStruct$1,PartiallyDecodedInstructionStruct$1]))}))))}));jsonRpcResultAndContext$1(type$1({byIdentity:record$1(string$1(),array$1(number$1())),range:type$1({firstSlot:number$1(),lastSlot:number$1()})}));jsonRpcResult$1(GetInflationGovernorResult$1);jsonRpcResult$1(GetInflationRateResult$1);jsonRpcResult$1(GetRecentPrioritizationFeesResult$1);jsonRpcResult$1(GetEpochInfoResult$1);jsonRpcResult$1(GetEpochScheduleResult$1);jsonRpcResult$1(GetLeaderScheduleResult$1);jsonRpcResult$1(number$1());jsonRpcResultAndContext$1(type$1({total:number$1(),circulating:number$1(),nonCirculating:number$1(),nonCirculatingAccounts:array$1(PublicKeyFromString$1)}));const TokenAmountResult$1=type$1({amount:string$1(),uiAmount:nullable$1(number$1()),decimals:number$1(),uiAmountString:optional$1(string$1())});jsonRpcResultAndContext$1(array$1(type$1({address:PublicKeyFromString$1,amount:string$1(),uiAmount:nullable$1(number$1()),decimals:number$1(),uiAmountString:optional$1(string$1())})));jsonRpcResultAndContext$1(array$1(type$1({pubkey:PublicKeyFromString$1,account:type$1({executable:boolean$1(),owner:PublicKeyFromString$1,lamports:number$1(),data:BufferFromRawAccountData$1,rentEpoch:number$1()})})));const ParsedAccountDataResult$1=type$1({program:string$1(),parsed:unknown$1(),space:number$1()});jsonRpcResultAndContext$1(array$1(type$1({pubkey:PublicKeyFromString$1,account:type$1({executable:boolean$1(),owner:PublicKeyFromString$1,lamports:number$1(),data:ParsedAccountDataResult$1,rentEpoch:number$1()})})));jsonRpcResultAndContext$1(array$1(type$1({lamports:number$1(),address:PublicKeyFromString$1})));const AccountInfoResult$1=type$1({executable:boolean$1(),owner:PublicKeyFromString$1,lamports:number$1(),data:BufferFromRawAccountData$1,rentEpoch:number$1()});type$1({pubkey:PublicKeyFromString$1,account:AccountInfoResult$1});const ParsedOrRawAccountData$1=coerce$1(union$1([instance$1(Buffer$1$1),ParsedAccountDataResult$1]),union$1([RawAccountDataResult$1,ParsedAccountDataResult$1]),fr=>Array.isArray(fr)?create$1(fr,BufferFromRawAccountData$1):fr),ParsedAccountInfoResult$1=type$1({executable:boolean$1(),owner:PublicKeyFromString$1,lamports:number$1(),data:ParsedOrRawAccountData$1,rentEpoch:number$1()});type$1({pubkey:PublicKeyFromString$1,account:ParsedAccountInfoResult$1});type$1({state:union$1([literal$1("active"),literal$1("inactive"),literal$1("activating"),literal$1("deactivating")]),active:number$1(),inactive:number$1()});jsonRpcResult$1(array$1(type$1({signature:string$1(),slot:number$1(),err:TransactionErrorResult$1,memo:nullable$1(string$1()),blockTime:optional$1(nullable$1(number$1()))})));jsonRpcResult$1(array$1(type$1({signature:string$1(),slot:number$1(),err:TransactionErrorResult$1,memo:nullable$1(string$1()),blockTime:optional$1(nullable$1(number$1()))})));type$1({subscription:number$1(),result:notificationResultAndContext$1(AccountInfoResult$1)});const ProgramAccountInfoResult$1=type$1({pubkey:PublicKeyFromString$1,account:AccountInfoResult$1});type$1({subscription:number$1(),result:notificationResultAndContext$1(ProgramAccountInfoResult$1)});const SlotInfoResult$1=type$1({parent:number$1(),slot:number$1(),root:number$1()});type$1({subscription:number$1(),result:SlotInfoResult$1});const SlotUpdateResult$1=union$1([type$1({type:union$1([literal$1("firstShredReceived"),literal$1("completed"),literal$1("optimisticConfirmation"),literal$1("root")]),slot:number$1(),timestamp:number$1()}),type$1({type:literal$1("createdBank"),parent:number$1(),slot:number$1(),timestamp:number$1()}),type$1({type:literal$1("frozen"),slot:number$1(),timestamp:number$1(),stats:type$1({numTransactionEntries:number$1(),numSuccessfulTransactions:number$1(),numFailedTransactions:number$1(),maxTransactionsPerEntry:number$1()})}),type$1({type:literal$1("dead"),slot:number$1(),timestamp:number$1(),err:string$1()})]);type$1({subscription:number$1(),result:SlotUpdateResult$1});type$1({subscription:number$1(),result:notificationResultAndContext$1(union$1([SignatureStatusResult$1,SignatureReceivedResult$1]))});type$1({subscription:number$1(),result:number$1()});type$1({pubkey:string$1(),gossip:nullable$1(string$1()),tpu:nullable$1(string$1()),rpc:nullable$1(string$1()),version:nullable$1(string$1())});const VoteAccountInfoResult$1=type$1({votePubkey:string$1(),nodePubkey:string$1(),activatedStake:number$1(),epochVoteAccount:boolean$1(),epochCredits:array$1(tuple$1([number$1(),number$1(),number$1()])),commission:number$1(),lastVote:number$1(),rootSlot:nullable$1(number$1())});jsonRpcResult$1(type$1({current:array$1(VoteAccountInfoResult$1),delinquent:array$1(VoteAccountInfoResult$1)}));const ConfirmationStatus$1=union$1([literal$1("processed"),literal$1("confirmed"),literal$1("finalized")]),SignatureStatusResponse$1=type$1({slot:number$1(),confirmations:nullable$1(number$1()),err:TransactionErrorResult$1,confirmationStatus:optional$1(ConfirmationStatus$1)});jsonRpcResultAndContext$1(array$1(nullable$1(SignatureStatusResponse$1)));jsonRpcResult$1(number$1());const AddressTableLookupStruct$1=type$1({accountKey:PublicKeyFromString$1,writableIndexes:array$1(number$1()),readonlyIndexes:array$1(number$1())}),ConfirmedTransactionResult$1=type$1({signatures:array$1(string$1()),message:type$1({accountKeys:array$1(string$1()),header:type$1({numRequiredSignatures:number$1(),numReadonlySignedAccounts:number$1(),numReadonlyUnsignedAccounts:number$1()}),instructions:array$1(type$1({accounts:array$1(number$1()),data:string$1(),programIdIndex:number$1()})),recentBlockhash:string$1(),addressTableLookups:optional$1(array$1(AddressTableLookupStruct$1))})}),AnnotatedAccountKey$1=type$1({pubkey:PublicKeyFromString$1,signer:boolean$1(),writable:boolean$1(),source:optional$1(union$1([literal$1("transaction"),literal$1("lookupTable")]))}),ConfirmedTransactionAccountsModeResult$1=type$1({accountKeys:array$1(AnnotatedAccountKey$1),signatures:array$1(string$1())}),ParsedInstructionResult$1=type$1({parsed:unknown$1(),program:string$1(),programId:PublicKeyFromString$1}),RawInstructionResult$1=type$1({accounts:array$1(PublicKeyFromString$1),data:string$1(),programId:PublicKeyFromString$1}),InstructionResult$1=union$1([RawInstructionResult$1,ParsedInstructionResult$1]),UnknownInstructionResult$1=union$1([type$1({parsed:unknown$1(),program:string$1(),programId:string$1()}),type$1({accounts:array$1(string$1()),data:string$1(),programId:string$1()})]),ParsedOrRawInstruction$1=coerce$1(InstructionResult$1,UnknownInstructionResult$1,fr=>"accounts"in fr?create$1(fr,RawInstructionResult$1):create$1(fr,ParsedInstructionResult$1)),ParsedConfirmedTransactionResult$1=type$1({signatures:array$1(string$1()),message:type$1({accountKeys:array$1(AnnotatedAccountKey$1),instructions:array$1(ParsedOrRawInstruction$1),recentBlockhash:string$1(),addressTableLookups:optional$1(nullable$1(array$1(AddressTableLookupStruct$1)))})}),TokenBalanceResult$1=type$1({accountIndex:number$1(),mint:string$1(),owner:optional$1(string$1()),programId:optional$1(string$1()),uiTokenAmount:TokenAmountResult$1}),LoadedAddressesResult$1=type$1({writable:array$1(PublicKeyFromString$1),readonly:array$1(PublicKeyFromString$1)}),ConfirmedTransactionMetaResult$1=type$1({err:TransactionErrorResult$1,fee:number$1(),innerInstructions:optional$1(nullable$1(array$1(type$1({index:number$1(),instructions:array$1(type$1({accounts:array$1(number$1()),data:string$1(),programIdIndex:number$1()}))})))),preBalances:array$1(number$1()),postBalances:array$1(number$1()),logMessages:optional$1(nullable$1(array$1(string$1()))),preTokenBalances:optional$1(nullable$1(array$1(TokenBalanceResult$1))),postTokenBalances:optional$1(nullable$1(array$1(TokenBalanceResult$1))),loadedAddresses:optional$1(LoadedAddressesResult$1),computeUnitsConsumed:optional$1(number$1())}),ParsedConfirmedTransactionMetaResult$1=type$1({err:TransactionErrorResult$1,fee:number$1(),innerInstructions:optional$1(nullable$1(array$1(type$1({index:number$1(),instructions:array$1(ParsedOrRawInstruction$1)})))),preBalances:array$1(number$1()),postBalances:array$1(number$1()),logMessages:optional$1(nullable$1(array$1(string$1()))),preTokenBalances:optional$1(nullable$1(array$1(TokenBalanceResult$1))),postTokenBalances:optional$1(nullable$1(array$1(TokenBalanceResult$1))),loadedAddresses:optional$1(LoadedAddressesResult$1),computeUnitsConsumed:optional$1(number$1())}),TransactionVersionStruct$1=union$1([literal$1(0),literal$1("legacy")]),RewardsResult$1=type$1({pubkey:string$1(),lamports:number$1(),postBalance:nullable$1(number$1()),rewardType:nullable$1(string$1()),commission:optional$1(nullable$1(number$1()))});jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$1(),transactions:array$1(type$1({transaction:ConfirmedTransactionResult$1,meta:nullable$1(ConfirmedTransactionMetaResult$1),version:optional$1(TransactionVersionStruct$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$1()),blockHeight:nullable$1(number$1())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$1(),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$1()),blockHeight:nullable$1(number$1())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$1(),transactions:array$1(type$1({transaction:ConfirmedTransactionAccountsModeResult$1,meta:nullable$1(ConfirmedTransactionMetaResult$1),version:optional$1(TransactionVersionStruct$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$1()),blockHeight:nullable$1(number$1())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$1(),transactions:array$1(type$1({transaction:ParsedConfirmedTransactionResult$1,meta:nullable$1(ParsedConfirmedTransactionMetaResult$1),version:optional$1(TransactionVersionStruct$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$1()),blockHeight:nullable$1(number$1())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$1(),transactions:array$1(type$1({transaction:ConfirmedTransactionAccountsModeResult$1,meta:nullable$1(ParsedConfirmedTransactionMetaResult$1),version:optional$1(TransactionVersionStruct$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$1()),blockHeight:nullable$1(number$1())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$1(),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$1()),blockHeight:nullable$1(number$1())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$1(),transactions:array$1(type$1({transaction:ConfirmedTransactionResult$1,meta:nullable$1(ConfirmedTransactionMetaResult$1)})),rewards:optional$1(array$1(RewardsResult$1)),blockTime:nullable$1(number$1())})));jsonRpcResult$1(nullable$1(type$1({blockhash:string$1(),previousBlockhash:string$1(),parentSlot:number$1(),signatures:array$1(string$1()),blockTime:nullable$1(number$1())})));jsonRpcResult$1(nullable$1(type$1({slot:number$1(),meta:nullable$1(ConfirmedTransactionMetaResult$1),blockTime:optional$1(nullable$1(number$1())),transaction:ConfirmedTransactionResult$1,version:optional$1(TransactionVersionStruct$1)})));jsonRpcResult$1(nullable$1(type$1({slot:number$1(),transaction:ParsedConfirmedTransactionResult$1,meta:nullable$1(ParsedConfirmedTransactionMetaResult$1),blockTime:optional$1(nullable$1(number$1())),version:optional$1(TransactionVersionStruct$1)})));jsonRpcResultAndContext$1(type$1({blockhash:string$1(),feeCalculator:type$1({lamportsPerSignature:number$1()})}));jsonRpcResultAndContext$1(type$1({blockhash:string$1(),lastValidBlockHeight:number$1()}));jsonRpcResultAndContext$1(boolean$1());const PerfSampleResult$1=type$1({slot:number$1(),numTransactions:number$1(),numSlots:number$1(),samplePeriodSecs:number$1()});jsonRpcResult$1(array$1(PerfSampleResult$1));jsonRpcResultAndContext$1(nullable$1(type$1({feeCalculator:type$1({lamportsPerSignature:number$1()})})));jsonRpcResult$1(string$1());jsonRpcResult$1(string$1());const LogsResult$1=type$1({err:TransactionErrorResult$1,logs:array$1(string$1()),signature:string$1()});type$1({result:notificationResultAndContext$1(LogsResult$1),subscription:number$1()});Object.freeze({CreateLookupTable:{index:0,layout:struct([u32("instruction"),u64$1("recentSlot"),u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:struct([u32("instruction")])},ExtendLookupTable:{index:2,layout:struct([u32("instruction"),u64$1(),seq(publicKey$2(),offset(u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:struct([u32("instruction")])},CloseLookupTable:{index:4,layout:struct([u32("instruction")])}});new PublicKey$1("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:struct([u8("instruction"),u32("units"),u32("additionalFee")])},RequestHeapFrame:{index:1,layout:struct([u8("instruction"),u32("bytes")])},SetComputeUnitLimit:{index:2,layout:struct([u8("instruction"),u32("units")])},SetComputeUnitPrice:{index:3,layout:struct([u8("instruction"),u64$1("microLamports")])}});new PublicKey$1("ComputeBudget111111111111111111111111111111");struct([u8("numSignatures"),u8("padding"),u16("signatureOffset"),u16("signatureInstructionIndex"),u16("publicKeyOffset"),u16("publicKeyInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u16("messageInstructionIndex")]);new PublicKey$1("Ed25519SigVerify111111111111111111111111111");secp256k1$1.utils.isValidPrivateKey;secp256k1$1.getPublicKey;struct([u8("numSignatures"),u16("signatureOffset"),u8("signatureInstructionIndex"),u16("ethAddressOffset"),u8("ethAddressInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u8("messageInstructionIndex"),blob(20,"ethAddress"),blob(64,"signature"),u8("recoveryId")]);new PublicKey$1("KeccakSecp256k11111111111111111111111111111");var _Lockup$1;new PublicKey$1("StakeConfig11111111111111111111111111111111");let Lockup$1=class{constructor(br,wr,Er){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=br,this.epoch=wr,this.custodian=Er}};_Lockup$1=Lockup$1;Lockup$1.default=new _Lockup$1(0,0,PublicKey$1.default);Object.freeze({Initialize:{index:0,layout:struct([u32("instruction"),authorized$1(),lockup$1()])},Authorize:{index:1,layout:struct([u32("instruction"),publicKey$2("newAuthorized"),u32("stakeAuthorizationType")])},Delegate:{index:2,layout:struct([u32("instruction")])},Split:{index:3,layout:struct([u32("instruction"),ns64("lamports")])},Withdraw:{index:4,layout:struct([u32("instruction"),ns64("lamports")])},Deactivate:{index:5,layout:struct([u32("instruction")])},Merge:{index:7,layout:struct([u32("instruction")])},AuthorizeWithSeed:{index:8,layout:struct([u32("instruction"),publicKey$2("newAuthorized"),u32("stakeAuthorizationType"),rustString$1("authoritySeed"),publicKey$2("authorityOwner")])}});new PublicKey$1("Stake11111111111111111111111111111111111111");Object.freeze({InitializeAccount:{index:0,layout:struct([u32("instruction"),voteInit$1()])},Authorize:{index:1,layout:struct([u32("instruction"),publicKey$2("newAuthorized"),u32("voteAuthorizationType")])},Withdraw:{index:3,layout:struct([u32("instruction"),ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:struct([u32("instruction")])},AuthorizeWithSeed:{index:10,layout:struct([u32("instruction"),voteAuthorizeWithSeedArgs$1()])}});new PublicKey$1("Vote111111111111111111111111111111111111111");new PublicKey$1("Va1idator1nfo111111111111111111111111111111");type$1({name:string$1(),website:optional$1(string$1()),details:optional$1(string$1()),iconUrl:optional$1(string$1()),keybaseUsername:optional$1(string$1())});new PublicKey$1("Vote111111111111111111111111111111111111111");struct([publicKey$2("nodePubkey"),publicKey$2("authorizedWithdrawer"),u8("commission"),nu64(),seq(struct([nu64("slot"),u32("confirmationCount")]),offset(u32(),-8),"votes"),u8("rootSlotValid"),nu64("rootSlot"),nu64(),seq(struct([nu64("epoch"),publicKey$2("authorizedVoter")]),offset(u32(),-8),"authorizedVoters"),struct([seq(struct([publicKey$2("authorizedPubkey"),nu64("epochOfLastAuthorizedSwitch"),nu64("targetEpoch")]),32,"buf"),nu64("idx"),u8("isEmpty")],"priorVoters"),nu64(),seq(struct([nu64("epoch"),nu64("credits"),nu64("prevCredits")]),offset(u32(),-8),"epochCredits"),struct([nu64("slot"),nu64("timestamp")],"lastTimestamp")]);const publicKey$1=fr=>{const br=blob(32,fr),{encode:wr,decode:Er}=encodeDecode$2(br),kr=br;return kr.decode=(jr,Br)=>{const Wr=Er(jr,Br);return new PublicKey$1(Wr)},kr.encode=(jr,Br,Wr)=>{const qr=jr.toBuffer();return wr(qr,Br,Wr)},kr};class TokenError extends Error{constructor(br){super(br)}}class TokenOwnerOffCurveError extends TokenError{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var TokenInstruction;(function(fr){fr[fr.InitializeMint=0]="InitializeMint",fr[fr.InitializeAccount=1]="InitializeAccount",fr[fr.InitializeMultisig=2]="InitializeMultisig",fr[fr.Transfer=3]="Transfer",fr[fr.Approve=4]="Approve",fr[fr.Revoke=5]="Revoke",fr[fr.SetAuthority=6]="SetAuthority",fr[fr.MintTo=7]="MintTo",fr[fr.Burn=8]="Burn",fr[fr.CloseAccount=9]="CloseAccount",fr[fr.FreezeAccount=10]="FreezeAccount",fr[fr.ThawAccount=11]="ThawAccount",fr[fr.TransferChecked=12]="TransferChecked",fr[fr.ApproveChecked=13]="ApproveChecked",fr[fr.MintToChecked=14]="MintToChecked",fr[fr.BurnChecked=15]="BurnChecked",fr[fr.InitializeAccount2=16]="InitializeAccount2",fr[fr.SyncNative=17]="SyncNative",fr[fr.InitializeAccount3=18]="InitializeAccount3",fr[fr.InitializeMultisig2=19]="InitializeMultisig2",fr[fr.InitializeMint2=20]="InitializeMint2",fr[fr.GetAccountDataSize=21]="GetAccountDataSize",fr[fr.InitializeImmutableOwner=22]="InitializeImmutableOwner",fr[fr.AmountToUiAmount=23]="AmountToUiAmount",fr[fr.UiAmountToAmount=24]="UiAmountToAmount",fr[fr.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",fr[fr.TransferFeeExtension=26]="TransferFeeExtension",fr[fr.ConfidentialTransferExtension=27]="ConfidentialTransferExtension",fr[fr.DefaultAccountStateExtension=28]="DefaultAccountStateExtension",fr[fr.Reallocate=29]="Reallocate",fr[fr.MemoTransferExtension=30]="MemoTransferExtension",fr[fr.CreateNativeMint=31]="CreateNativeMint",fr[fr.InitializeNonTransferableMint=32]="InitializeNonTransferableMint",fr[fr.InterestBearingMintExtension=33]="InterestBearingMintExtension",fr[fr.CpiGuardExtension=34]="CpiGuardExtension",fr[fr.InitializePermanentDelegate=35]="InitializePermanentDelegate",fr[fr.TransferHookExtension=36]="TransferHookExtension",fr[fr.MetadataPointerExtension=39]="MetadataPointerExtension",fr[fr.GroupPointerExtension=40]="GroupPointerExtension",fr[fr.GroupMemberPointerExtension=41]="GroupMemberPointerExtension"})(TokenInstruction||(TokenInstruction={}));function addSigners(fr,br,wr){if(wr.length){fr.push({pubkey:br,isSigner:!1,isWritable:!1});for(const Er of wr)fr.push({pubkey:Er instanceof PublicKey$2?Er:Er.publicKey,isSigner:!0,isWritable:!1})}else fr.push({pubkey:br,isSigner:!0,isWritable:!1});return fr}const MintLayout=struct([u32("mintAuthorityOption"),publicKey$1("mintAuthority"),u64$2("supply"),u8("decimals"),bool("isInitialized"),u32("freezeAuthorityOption"),publicKey$1("freezeAuthority")]);MintLayout.span;async function getAssociatedTokenAddress(fr,br,wr=!1,Er=TOKEN_PROGRAM_ID,kr=ASSOCIATED_TOKEN_PROGRAM_ID){if(!wr&&!PublicKey$2.isOnCurve(br.toBuffer()))throw new TokenOwnerOffCurveError;const[jr]=await PublicKey$2.findProgramAddress([br.toBuffer(),Er.toBuffer(),fr.toBuffer()],kr);return jr}function createAssociatedTokenAccountInstruction(fr,br,wr,Er,kr=TOKEN_PROGRAM_ID,jr=ASSOCIATED_TOKEN_PROGRAM_ID){return buildAssociatedTokenAccountInstruction(fr,br,wr,Er,Buffer$2.alloc(0),kr,jr)}function buildAssociatedTokenAccountInstruction(fr,br,wr,Er,kr,jr=TOKEN_PROGRAM_ID,Br=ASSOCIATED_TOKEN_PROGRAM_ID){const Wr=[{pubkey:fr,isSigner:!0,isWritable:!0},{pubkey:br,isSigner:!1,isWritable:!0},{pubkey:wr,isSigner:!1,isWritable:!1},{pubkey:Er,isSigner:!1,isWritable:!1},{pubkey:SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:jr,isSigner:!1,isWritable:!1}];return new TransactionInstruction({keys:Wr,programId:Br,data:kr})}const transferInstructionData=struct([u8("instruction"),u64$2("amount")]);function createTransferInstruction(fr,br,wr,Er,kr=[],jr=TOKEN_PROGRAM_ID){const Br=addSigners([{pubkey:fr,isSigner:!1,isWritable:!0},{pubkey:br,isSigner:!1,isWritable:!0}],wr,kr),Wr=Buffer$2.alloc(transferInstructionData.span);return transferInstructionData.encode({instruction:TokenInstruction.Transfer,amount:BigInt(Er)},Wr),new TransactionInstruction({keys:Br,programId:jr,data:Wr})}const isTxAlreadySigned$1=fr=>{let br=!1;return"version"in fr?br=fr.signatures.some(wr=>!wr.every(Er=>Er===0)):br=fr.signatures.some(wr=>wr.signature),br},LAMPORTS_PER_SOL$1=1e9;let SolanaUiTransaction$1=class{constructor({onSubmit:br,from:wr,connection:Er,multipleTransactions:kr}){this.chain="SOL",this.data=void 0,this.fee={gas:void 0},this.formatNonNativeToken=(jr,Br)=>(Number(jr)/Number(Math.pow(10,Br))).toString(),this.from=wr,this.onSubmit=br,this.connection=Er,this.multipleTransactions=kr}fetchFee(){return __awaiter$4(this,void 0,void 0,function*(){if(this.fee.gas)return;let br=this.multipleTransactions;if(!br){const Br=yield this.createTransactionSafe();if(!Br)return;br=Br instanceof Array?Br:[Br]}const{blockhash:wr}=yield this.connection.getLatestBlockhash(),Er=yield Promise.all(br.map(Br=>__awaiter$4(this,void 0,void 0,function*(){return"version"in Br?((yield isTxAlreadySigned$1(Br))||(Br.message.recentBlockhash=wr),Br.message):((yield isTxAlreadySigned$1(Br))||(Br.recentBlockhash=wr),Br.compileMessage())})));if(Er.some(Br=>!Br))throw new Error("Invalid transaction");const kr=Br=>__awaiter$4(this,void 0,void 0,function*(){let Wr=yield this.connection.getFeeForMessage(Br),qr=0;for(;Wr.value===null&&qr<5;)Wr=yield this.connection.getFeeForMessage(Br),qr++;return Wr.value?BigInt(Wr.value):BigInt(0)}),jr=yield Promise.all(Er.map(Br=>kr(Br)));this.fee.gas=jr.reduce((Br,Wr)=>Br+Wr,BigInt(0)),this.fee.gas===BigInt(0)&&(this.fee.gas=void 0)})}isGasSponsored(){var br;return!((br=this.multipleTransactions)===null||br===void 0)&&br.length?this.multipleTransactions.every(wr=>{var Er;return"version"in wr?this.from!==wr.message.staticAccountKeys[0].toBase58():"feePayer"in wr?this.from!==((Er=wr.feePayer)===null||Er===void 0?void 0:Er.toBase58()):!1}):!1}parse(br){const wr=parseFloat(br),Er=Math.round(wr*LAMPORTS_PER_SOL$1);return BigInt(Er)}parseNonNativeToken(br,wr){return BigInt(Math.floor(Number(br)*Math.pow(10,wr)))}format(br,{precision:wr}={}){const kr=(Number(br)/LAMPORTS_PER_SOL$1).toLocaleString("fullwide",{maximumFractionDigits:20,minimumFractionDigits:0,useGrouping:!1});return formatNumberText(kr,{precision:wr})}submit(){return __awaiter$4(this,void 0,void 0,function*(){if(this.multipleTransactions)return this.onSubmit();const br=yield this.createTransaction();return this.onSubmit(br)})}getBalance(){return __awaiter$4(this,void 0,void 0,function*(){const br=new PublicKey$2(this.from),wr=yield this.connection.getBalance(br);return BigInt(wr)})}validateAddressFormat(br){return br==="dyn_send_transaction.multiple_recipients"?!0:/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(br)}createTransaction(){return __awaiter$4(this,void 0,void 0,function*(){var br;const{value:wr,to:Er,nonNativeAddress:kr,nonNativeValue:jr}=this;if(!Er)throw new Error("Destination is required");if(this.multipleTransactions)return this.multipleTransactions;const Br=new Transaction,Wr=new PublicKey$2(this.from),qr=new PublicKey$2(Er);if(kr&&jr){const Vr=new PublicKey$2(kr),Zr=jr,Jr=(br=(yield this.connection.getTokenAccountsByOwner(Wr,{mint:Vr})).value[0])===null||br===void 0?void 0:br.pubkey;if(!Jr)throw new Error("Source token account not found");let Qr;try{Qr=yield getAssociatedTokenAddress(Vr,qr),yield this.connection.getTokenAccountBalance(Qr)}catch{Qr=yield getAssociatedTokenAddress(Vr,qr),Br.add(createAssociatedTokenAccountInstruction(Wr,Qr,qr,Vr))}Br.add(createTransferInstruction(Jr,Qr,Wr,Zr))}else{const Vr=wr??BigInt(0);Br.add(SystemProgram.transfer({fromPubkey:Wr,lamports:Vr,toPubkey:qr}))}const{blockhash:Gr}=yield this.connection.getLatestBlockhash();return Br.feePayer=new PublicKey$2(this.from),Br.recentBlockhash=Gr,Br})}createTransactionSafe(){return __awaiter$4(this,void 0,void 0,function*(){try{return yield this.createTransaction()}catch{return}})}};assertPackageVersion("@dynamic-labs/solana-core",version$6);function __awaiter$3(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;const isSignedMessage=fr=>!!fr&&fr.signature!==void 0;var __classPrivateFieldSet=function(fr,br,wr,Er,kr){if(Er==="m")throw new TypeError("Private method is not writable");if(Er==="a"&&!kr)throw new TypeError("Private accessor was defined without a setter");if(typeof br=="function"?fr!==br||!kr:!br.has(fr))throw new TypeError("Cannot write private member to an object whose class did not declare it");return Er==="a"?kr.call(fr,wr):kr?kr.value=wr:br.set(fr,wr),wr},__classPrivateFieldGet=function(fr,br,wr,Er){if(wr==="a"&&!Er)throw new TypeError("Private accessor was defined without a getter");if(typeof br=="function"?fr!==br||!Er:!br.has(fr))throw new TypeError("Cannot read private member from an object whose class did not declare it");return wr==="m"?Er:wr==="a"?Er.call(fr):Er?Er.value:br.get(fr)},_AppReadyEvent_detail;let wallets;const registered=new Set,listeners={};function getWallets(){if(wallets||(wallets=Object.freeze({register,get,on}),typeof window>"u"))return wallets;const fr=Object.freeze({register});try{window.addEventListener("wallet-standard:register-wallet",({detail:br})=>br(fr))}catch(br){console.error(`wallet-standard:register-wallet event listener could not be added `,br)}try{window.dispatchEvent(new AppReadyEvent(fr))}catch(br){console.error(`wallet-standard:app-ready event could not be dispatched `,br)}return wallets}function register(...fr){var br;return fr=fr.filter(wr=>!registered.has(wr)),fr.length?(fr.forEach(wr=>registered.add(wr)),(br=listeners.register)==null||br.forEach(wr=>guard(()=>wr(...fr))),function(){var Er;fr.forEach(kr=>registered.delete(kr)),(Er=listeners.unregister)==null||Er.forEach(kr=>guard(()=>kr(...fr)))}):()=>{}}function get(){return[...registered]}function on(fr,br){var wr;return(wr=listeners[fr])!=null&&wr.push(br)||(listeners[fr]=[br]),function(){var kr;listeners[fr]=(kr=listeners[fr])==null?void 0:kr.filter(jr=>br!==jr)}}function guard(fr){try{fr()}catch(br){console.error(br)}}class AppReadyEvent extends Event{constructor(br){super("wallet-standard:app-ready",{bubbles:!1,cancelable:!1,composed:!1}),_AppReadyEvent_detail.set(this,void 0),__classPrivateFieldSet(this,_AppReadyEvent_detail,br,"f")}get detail(){return __classPrivateFieldGet(this,_AppReadyEvent_detail,"f")}get type(){return"wallet-standard:app-ready"}preventDefault(){throw new Error("preventDefault cannot be called")}stopImmediatePropagation(){throw new Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw new Error("stopPropagation cannot be called")}}_AppReadyEvent_detail=new WeakMap;const findWalletProviderFromWalletStandard=fr=>{const{walletStandardLocators:br}=fr;if(!br||br.length===0)return;const wr=getWallets().get();return br.reduce((Er,kr)=>{if(Er)return Er;const jr=wr.find(Br=>Br.name===kr.name);if(jr)return get$6(jr,kr.locator)},void 0)};class SolProviderHelper{constructor(br){this.wallet=br}getInjectedConfig(){if(!this.wallet||!this.wallet.injectedConfig)return;const{injectedConfig:br}=this.wallet;return br.find(wr=>wr.chain==="sol")}getInstalledProvider(){const br=this.getInjectedConfig();if(!(!br||!br.extensionLocators))return this.installedProviderLookup(br.extensionLocators)}installedProviders(){var br,wr;const Er=this.getInjectedConfig();if(!Er)return[];const kr=[];if(Er.windowLocations)for(const jr of Er.windowLocations){const Br=getProvidersFromWindow(jr);Br&&Br.length&&kr.push(...Br)}if(Er.extensionLocators.length!==0&&window.solana&&(window.solana.providers?window.solana.providers.forEach(jr=>kr.push(jr)):kr.push(window.solana)),((wr=(br=Er.walletStandardLocators)===null||br===void 0?void 0:br.length)!==null&&wr!==void 0?wr:0)>0){const jr=findWalletProviderFromWalletStandard(Er);jr&&kr.push(jr)}return kr}installedProviderLookup(br){const wr=this.installedProviders();return br.length===0?wr[0]:ProviderLookup(wr,br)}findProvider(){return this.getInstalledProvider()}isInstalledHelper(){return this.findProvider()!==void 0}getAddress(){return __awaiter$3(this,void 0,void 0,function*(){var br;const wr=this.findProvider();if(wr)return yield wr.connect(),(br=wr.publicKey)===null||br===void 0?void 0:br.toString()})}connect(){return __awaiter$3(this,void 0,void 0,function*(){const br=this.findProvider();if(br)try{return br.isConnected||(yield br.connect()),br}catch{return}})}signMessage(br){return __awaiter$3(this,void 0,void 0,function*(){if(!(yield this.getAddress()))return;const Er=this.findProvider();if(!Er)return;const kr=new TextEncoder().encode(br),jr=yield Er.signMessage(kr,"utf8");if(jr)return bufferToBase64(isSignedMessage(jr)?jr.signature:jr)})}handleAccountChange(br,wr,Er){return __awaiter$3(this,void 0,void 0,function*(){var kr;if(!Er){yield wr==null?void 0:wr.connect(),!((kr=wr==null?void 0:wr.publicKey)===null||kr===void 0)&&kr.toString()&&br.emit("accountChange",{accounts:[wr.publicKey.toString()]});return}Er.toString()&&br.emit("accountChange",{accounts:[Er.toString()]})})}_setupEventListeners(br){const wr=this.findProvider();if(!wr){logger$7.warn("Provider not found",{connector:br});return}if(!wr.on){logger$7.warn("Provider does not support event listeners",{connector:br,provider:wr});return}wr.on("accountChanged",Er=>this.handleAccountChange(br,wr,Er)),wr.on("disconnect",()=>br.emit("disconnect"))}_teardownEventListeners(){const br=this.findProvider();br&&br.removeAllListeners()}getConnectedAccounts(){return __awaiter$3(this,void 0,void 0,function*(){var br,wr;const Er=this.findProvider();if(!Er)return[];let kr;try{Er.isConnected||(kr=yield Er.connect({onlyIfTrusted:!0}))}catch{return[]}const jr=kr==null?void 0:kr.address,Br=(br=kr==null?void 0:kr.publicKey)!==null&&br!==void 0?br:(wr=Er.publicKey)===null||wr===void 0?void 0:wr.toString();return jr?[jr]:Br?[Br==null?void 0:Br.toString()]:[]})}}class SignMessageNotSupportedError extends NotSupportedError{constructor(br){super(`Message signing is currently not supported on ${br} hardware wallet. You can use signMessageViaTransaction instead to achieve similar functionality by signing a transaction with a memo instruction. - You can read more about it here https://github.com/solana-labs/solana/issues/21366`)}}class InjectedWalletBase extends SolanaWalletConnector{getSolProviderHelper(){return this.wallet||(this.wallet=findWalletBookWallet(this.walletBook,this.key)),this.wallet&&!this.solProviderHelper&&(this.solProviderHelper=new SolProviderHelper(this.wallet)),this.solProviderHelper}getProvider(){var br;return(br=this.getSolProviderHelper())===null||br===void 0?void 0:br.getInstalledProvider()}setupEventListeners(){var br;(br=this.getSolProviderHelper())===null||br===void 0||br._setupEventListeners(this)}teardownEventListeners(){var br;(br=this.getSolProviderHelper())===null||br===void 0||br._teardownEventListeners()}connect(){return __awaiter$3(this,void 0,void 0,function*(){var br;yield(br=this.getSolProviderHelper())===null||br===void 0?void 0:br.connect()})}getSigner(){return __awaiter$3(this,void 0,void 0,function*(){var br;return(br=this.getSolProviderHelper())===null||br===void 0?void 0:br.connect()})}createUiTransaction(br){return __awaiter$3(this,void 0,void 0,function*(){return yield this.validateActiveWallet(br),new SolanaUiTransaction$1({connection:this.getWalletClient(),from:br,onSubmit:Er=>__awaiter$3(this,void 0,void 0,function*(){var kr;if(!Er)return;const jr=yield this.getSigner();if(!jr)throw new Error("Signer not found");const Br=yield this.getWalletClient().getLatestBlockhash();if("version"in Er)Er.message.recentBlockhash=Br.blockhash;else{const Wr=yield this.getAddress();if(!Wr)throw new Error("User address not found");Er.recentBlockhash=Br.blockhash,Er.feePayer=(kr=Er.feePayer)!==null&&kr!==void 0?kr:new PublicKey$2(Wr)}return(yield jr.signAndSendTransaction(Er)).signature})})})}isInstalledOnBrowser(){var br;return!!(!((br=this.getSolProviderHelper())===null||br===void 0)&&br.isInstalledHelper())}getAddress(){return __awaiter$3(this,void 0,void 0,function*(){var br,wr;if(!this.isInstalledOnBrowser()){if(isMobile()&&(!((br=this.wallet)===null||br===void 0)&&br.mobile)&&this.wallet.mobile.inAppBrowser&&this.mobileExperience==="in-app-browser"){const kr=template(this.wallet.mobile.inAppBrowser)({encodedDappURI:encodeURIComponent(window.location.toString())});window.location.assign(kr)}return}return(wr=this.getSolProviderHelper())===null||wr===void 0?void 0:wr.getAddress()})}signMessage(br){return __awaiter$3(this,void 0,void 0,function*(){var wr,Er;const kr=yield(wr=this.getSolProviderHelper())===null||wr===void 0?void 0:wr.getAddress();if(kr&&this.isLedgerAddress(kr))throw new SignMessageNotSupportedError(this.name);return(Er=this.getSolProviderHelper())===null||Er===void 0?void 0:Er.signMessage(br)})}getConnectedAccounts(){return __awaiter$3(this,void 0,void 0,function*(){var br,wr;return(wr=(br=this.getSolProviderHelper())===null||br===void 0?void 0:br.getConnectedAccounts())!==null&&wr!==void 0?wr:[]})}}var version$4="3.8.2",dependencies={"@dynamic-labs/sdk-api-core":"0.0.570","@dynamic-labs/utils":"3.8.2","@dynamic-labs/logger":"3.8.2","@dynamic-labs/types":"3.8.2",eventemitter3:"5.0.1","@solana/web3.js":"1.92.1","@turnkey/http":"2.12.2","@turnkey/iframe-stamper":"2.0.0","@turnkey/solana":"0.3.9","@turnkey/webauthn-stamper":"0.5.0"};function __rest$1(fr,br){var wr={};for(var Er in fr)Object.prototype.hasOwnProperty.call(fr,Er)&&br.indexOf(Er)<0&&(wr[Er]=fr[Er]);if(fr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var kr=0,Er=Object.getOwnPropertySymbols(fr);kr0?Hr:Xr},jr.min=function(Hr,Xr){return Hr.cmp(Xr)<0?Hr:Xr},jr.prototype._init=function(Hr,Xr,Sn){if(typeof Hr=="number")return this._initNumber(Hr,Xr,Sn);if(typeof Hr=="object")return this._initArray(Hr,Xr,Sn);Xr==="hex"&&(Xr=16),Er(Xr===(Xr|0)&&Xr>=2&&Xr<=36),Hr=Hr.toString().replace(/\s+/g,"");var Rn=0;Hr[0]==="-"&&(Rn++,this.negative=1),Rn=0;Rn-=3)On=Hr[Rn]|Hr[Rn-1]<<8|Hr[Rn-2]<<16,this.words[Pn]|=On<>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);else if(Sn==="le")for(Rn=0,Pn=0;Rn>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);return this._strip()};function Wr(Tn,Hr){var Xr=Tn.charCodeAt(Hr);if(Xr>=48&&Xr<=57)return Xr-48;if(Xr>=65&&Xr<=70)return Xr-55;if(Xr>=97&&Xr<=102)return Xr-87;Er(!1,"Invalid character in "+Tn)}function qr(Tn,Hr,Xr){var Sn=Wr(Tn,Xr);return Xr-1>=Hr&&(Sn|=Wr(Tn,Xr-1)<<4),Sn}jr.prototype._parseHex=function(Hr,Xr,Sn){this.length=Math.ceil((Hr.length-Xr)/6),this.words=new Array(this.length);for(var Rn=0;Rn=Xr;Rn-=2)Zn=qr(Hr,Xr,Rn)<=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8;else{var Nn=Hr.length-Xr;for(Rn=Nn%2===0?Xr+1:Xr;Rn=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8}this._strip()};function Gr(Tn,Hr,Xr,Sn){for(var Rn=0,Pn=0,On=Math.min(Tn.length,Xr),Zn=Hr;Zn=49?Pn=Nn-49+10:Nn>=17?Pn=Nn-17+10:Pn=Nn,Er(Nn>=0&&Pn1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},jr.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{jr.prototype[Symbol.for("nodejs.util.inspect.custom")]=Zr}catch{jr.prototype.inspect=Zr}else jr.prototype.inspect=Zr;function Zr(){return(this.red?""}var Jr=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Qr=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_n=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];jr.prototype.toString=function(Hr,Xr){Hr=Hr||10,Xr=Xr|0||1;var Sn;if(Hr===16||Hr==="hex"){Sn="";for(var Rn=0,Pn=0,On=0;On>>24-Rn&16777215,Rn+=2,Rn>=26&&(Rn-=26,On--),Pn!==0||On!==this.length-1?Sn=Jr[6-Nn.length]+Nn+Sn:Sn=Nn+Sn}for(Pn!==0&&(Sn=Pn.toString(16)+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}if(Hr===(Hr|0)&&Hr>=2&&Hr<=36){var wn=Qr[Hr],zn=_n[Hr];Sn="";var fo=this.clone();for(fo.negative=0;!fo.isZero();){var vo=fo.modrn(zn).toString(Hr);fo=fo.idivn(zn),fo.isZero()?Sn=vo+Sn:Sn=Jr[wn-vo.length]+vo+Sn}for(this.isZero()&&(Sn="0"+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}Er(!1,"Base should be between 2 and 36")},jr.prototype.toNumber=function(){var Hr=this.words[0];return this.length===2?Hr+=this.words[1]*67108864:this.length===3&&this.words[2]===1?Hr+=4503599627370496+this.words[1]*67108864:this.length>2&&Er(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-Hr:Hr},jr.prototype.toJSON=function(){return this.toString(16,2)},Br&&(jr.prototype.toBuffer=function(Hr,Xr){return this.toArrayLike(Br,Hr,Xr)}),jr.prototype.toArray=function(Hr,Xr){return this.toArrayLike(Array,Hr,Xr)};var En=function(Hr,Xr){return Hr.allocUnsafe?Hr.allocUnsafe(Xr):new Hr(Xr)};jr.prototype.toArrayLike=function(Hr,Xr,Sn){this._strip();var Rn=this.byteLength(),Pn=Sn||Math.max(1,Rn);Er(Rn<=Pn,"byte array longer than desired length"),Er(Pn>0,"Requested array length <= 0");var On=En(Hr,Pn),Zn=Xr==="le"?"LE":"BE";return this["_toArrayLike"+Zn](On,Rn),On},jr.prototype._toArrayLikeLE=function(Hr,Xr){for(var Sn=0,Rn=0,Pn=0,On=0;Pn>8&255),Sn>16&255),On===6?(Sn>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn=0&&(Hr[Sn--]=Zn>>8&255),Sn>=0&&(Hr[Sn--]=Zn>>16&255),On===6?(Sn>=0&&(Hr[Sn--]=Zn>>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn>=0)for(Hr[Sn--]=Rn;Sn>=0;)Hr[Sn--]=0},Math.clz32?jr.prototype._countBits=function(Hr){return 32-Math.clz32(Hr)}:jr.prototype._countBits=function(Hr){var Xr=Hr,Sn=0;return Xr>=4096&&(Sn+=13,Xr>>>=13),Xr>=64&&(Sn+=7,Xr>>>=7),Xr>=8&&(Sn+=4,Xr>>>=4),Xr>=2&&(Sn+=2,Xr>>>=2),Sn+Xr},jr.prototype._zeroBits=function(Hr){if(Hr===0)return 26;var Xr=Hr,Sn=0;return Xr&8191||(Sn+=13,Xr>>>=13),Xr&127||(Sn+=7,Xr>>>=7),Xr&15||(Sn+=4,Xr>>>=4),Xr&3||(Sn+=2,Xr>>>=2),Xr&1||Sn++,Sn},jr.prototype.bitLength=function(){var Hr=this.words[this.length-1],Xr=this._countBits(Hr);return(this.length-1)*26+Xr};function Cn(Tn){for(var Hr=new Array(Tn.bitLength()),Xr=0;Xr>>Rn&1}return Hr}jr.prototype.zeroBits=function(){if(this.isZero())return 0;for(var Hr=0,Xr=0;XrHr.length?this.clone().ior(Hr):Hr.clone().ior(this)},jr.prototype.uor=function(Hr){return this.length>Hr.length?this.clone().iuor(Hr):Hr.clone().iuor(this)},jr.prototype.iuand=function(Hr){var Xr;this.length>Hr.length?Xr=Hr:Xr=this;for(var Sn=0;SnHr.length?this.clone().iand(Hr):Hr.clone().iand(this)},jr.prototype.uand=function(Hr){return this.length>Hr.length?this.clone().iuand(Hr):Hr.clone().iuand(this)},jr.prototype.iuxor=function(Hr){var Xr,Sn;this.length>Hr.length?(Xr=this,Sn=Hr):(Xr=Hr,Sn=this);for(var Rn=0;RnHr.length?this.clone().ixor(Hr):Hr.clone().ixor(this)},jr.prototype.uxor=function(Hr){return this.length>Hr.length?this.clone().iuxor(Hr):Hr.clone().iuxor(this)},jr.prototype.inotn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Math.ceil(Hr/26)|0,Sn=Hr%26;this._expand(Xr),Sn>0&&Xr--;for(var Rn=0;Rn0&&(this.words[Rn]=~this.words[Rn]&67108863>>26-Sn),this._strip()},jr.prototype.notn=function(Hr){return this.clone().inotn(Hr)},jr.prototype.setn=function(Hr,Xr){Er(typeof Hr=="number"&&Hr>=0);var Sn=Hr/26|0,Rn=Hr%26;return this._expand(Sn+1),Xr?this.words[Sn]=this.words[Sn]|1<Hr.length?(Sn=this,Rn=Hr):(Sn=Hr,Rn=this);for(var Pn=0,On=0;On>>26;for(;Pn!==0&&On>>26;if(this.length=Sn.length,Pn!==0)this.words[this.length]=Pn,this.length++;else if(Sn!==this)for(;OnHr.length?this.clone().iadd(Hr):Hr.clone().iadd(this)},jr.prototype.isub=function(Hr){if(Hr.negative!==0){Hr.negative=0;var Xr=this.iadd(Hr);return Hr.negative=1,Xr._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Hr),this.negative=1,this._normSign();var Sn=this.cmp(Hr);if(Sn===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Rn,Pn;Sn>0?(Rn=this,Pn=Hr):(Rn=Hr,Pn=this);for(var On=0,Zn=0;Zn>26,this.words[Zn]=Xr&67108863;for(;On!==0&&Zn>26,this.words[Zn]=Xr&67108863;if(On===0&&Zn>>26,fo=Nn&67108863,vo=Math.min(wn,Hr.length-1),go=Math.max(0,wn-Tn.length+1);go<=vo;go++){var uo=wn-go|0;Rn=Tn.words[uo]|0,Pn=Hr.words[go]|0,On=Rn*Pn+fo,zn+=On/67108864|0,fo=On&67108863}Xr.words[wn]=fo|0,Nn=zn|0}return Nn!==0?Xr.words[wn]=Nn|0:Xr.length--,Xr._strip()}var An=function(Hr,Xr,Sn){var Rn=Hr.words,Pn=Xr.words,On=Sn.words,Zn=0,Nn,wn,zn,fo=Rn[0]|0,vo=fo&8191,go=fo>>>13,uo=Rn[1]|0,lo=uo&8191,Eo=uo>>>13,mo=Rn[2]|0,yo=mo&8191,_o=mo>>>13,Bo=Rn[3]|0,Lo=Bo&8191,Wo=Bo>>>13,na=Rn[4]|0,qo=na&8191,ga=na>>>13,wl=Rn[5]|0,No=wl&8191,Fo=wl>>>13,Nl=Rn[6]|0,Vo=Nl&8191,Uo=Nl>>>13,Ml=Rn[7]|0,$a=Ml&8191,Jo=Ml>>>13,Zl=Rn[8]|0,Cl=Zl&8191,ko=Zl>>>13,wo=Rn[9]|0,bo=wo&8191,Io=wo>>>13,Ho=Pn[0]|0,Do=Ho&8191,zo=Ho>>>13,nu=Pn[1]|0,Ll=nu&8191,_l=nu>>>13,bu=Pn[2]|0,xl=bu&8191,Tl=bu>>>13,du=Pn[3]|0,Bl=du&8191,Il=du>>>13,Eu=Pn[4]|0,Al=Eu&8191,Ol=Eu>>>13,Tu=Pn[5]|0,Ul=Tu&8191,Sl=Tu>>>13,_u=Pn[6]|0,So=_u&8191,Co=_u>>>13,Ao=Pn[7]|0,po=Ao&8191,Ro=Ao>>>13,Xo=Pn[8]|0,jo=Xo&8191,Ko=Xo>>>13,Wl=Pn[9]|0,$l=Wl&8191,El=Wl>>>13;Sn.negative=Hr.negative^Xr.negative,Sn.length=19,Nn=Math.imul(vo,Do),wn=Math.imul(vo,zo),wn=wn+Math.imul(go,Do)|0,zn=Math.imul(go,zo);var Cu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,Nn=Math.imul(lo,Do),wn=Math.imul(lo,zo),wn=wn+Math.imul(Eo,Do)|0,zn=Math.imul(Eo,zo),Nn=Nn+Math.imul(vo,Ll)|0,wn=wn+Math.imul(vo,_l)|0,wn=wn+Math.imul(go,Ll)|0,zn=zn+Math.imul(go,_l)|0;var iu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(iu>>>26)|0,iu&=67108863,Nn=Math.imul(yo,Do),wn=Math.imul(yo,zo),wn=wn+Math.imul(_o,Do)|0,zn=Math.imul(_o,zo),Nn=Nn+Math.imul(lo,Ll)|0,wn=wn+Math.imul(lo,_l)|0,wn=wn+Math.imul(Eo,Ll)|0,zn=zn+Math.imul(Eo,_l)|0,Nn=Nn+Math.imul(vo,xl)|0,wn=wn+Math.imul(vo,Tl)|0,wn=wn+Math.imul(go,xl)|0,zn=zn+Math.imul(go,Tl)|0;var pu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(pu>>>26)|0,pu&=67108863,Nn=Math.imul(Lo,Do),wn=Math.imul(Lo,zo),wn=wn+Math.imul(Wo,Do)|0,zn=Math.imul(Wo,zo),Nn=Nn+Math.imul(yo,Ll)|0,wn=wn+Math.imul(yo,_l)|0,wn=wn+Math.imul(_o,Ll)|0,zn=zn+Math.imul(_o,_l)|0,Nn=Nn+Math.imul(lo,xl)|0,wn=wn+Math.imul(lo,Tl)|0,wn=wn+Math.imul(Eo,xl)|0,zn=zn+Math.imul(Eo,Tl)|0,Nn=Nn+Math.imul(vo,Bl)|0,wn=wn+Math.imul(vo,Il)|0,wn=wn+Math.imul(go,Bl)|0,zn=zn+Math.imul(go,Il)|0;var yu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(yu>>>26)|0,yu&=67108863,Nn=Math.imul(qo,Do),wn=Math.imul(qo,zo),wn=wn+Math.imul(ga,Do)|0,zn=Math.imul(ga,zo),Nn=Nn+Math.imul(Lo,Ll)|0,wn=wn+Math.imul(Lo,_l)|0,wn=wn+Math.imul(Wo,Ll)|0,zn=zn+Math.imul(Wo,_l)|0,Nn=Nn+Math.imul(yo,xl)|0,wn=wn+Math.imul(yo,Tl)|0,wn=wn+Math.imul(_o,xl)|0,zn=zn+Math.imul(_o,Tl)|0,Nn=Nn+Math.imul(lo,Bl)|0,wn=wn+Math.imul(lo,Il)|0,wn=wn+Math.imul(Eo,Bl)|0,zn=zn+Math.imul(Eo,Il)|0,Nn=Nn+Math.imul(vo,Al)|0,wn=wn+Math.imul(vo,Ol)|0,wn=wn+Math.imul(go,Al)|0,zn=zn+Math.imul(go,Ol)|0;var hu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(hu>>>26)|0,hu&=67108863,Nn=Math.imul(No,Do),wn=Math.imul(No,zo),wn=wn+Math.imul(Fo,Do)|0,zn=Math.imul(Fo,zo),Nn=Nn+Math.imul(qo,Ll)|0,wn=wn+Math.imul(qo,_l)|0,wn=wn+Math.imul(ga,Ll)|0,zn=zn+Math.imul(ga,_l)|0,Nn=Nn+Math.imul(Lo,xl)|0,wn=wn+Math.imul(Lo,Tl)|0,wn=wn+Math.imul(Wo,xl)|0,zn=zn+Math.imul(Wo,Tl)|0,Nn=Nn+Math.imul(yo,Bl)|0,wn=wn+Math.imul(yo,Il)|0,wn=wn+Math.imul(_o,Bl)|0,zn=zn+Math.imul(_o,Il)|0,Nn=Nn+Math.imul(lo,Al)|0,wn=wn+Math.imul(lo,Ol)|0,wn=wn+Math.imul(Eo,Al)|0,zn=zn+Math.imul(Eo,Ol)|0,Nn=Nn+Math.imul(vo,Ul)|0,wn=wn+Math.imul(vo,Sl)|0,wn=wn+Math.imul(go,Ul)|0,zn=zn+Math.imul(go,Sl)|0;var mu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(mu>>>26)|0,mu&=67108863,Nn=Math.imul(Vo,Do),wn=Math.imul(Vo,zo),wn=wn+Math.imul(Uo,Do)|0,zn=Math.imul(Uo,zo),Nn=Nn+Math.imul(No,Ll)|0,wn=wn+Math.imul(No,_l)|0,wn=wn+Math.imul(Fo,Ll)|0,zn=zn+Math.imul(Fo,_l)|0,Nn=Nn+Math.imul(qo,xl)|0,wn=wn+Math.imul(qo,Tl)|0,wn=wn+Math.imul(ga,xl)|0,zn=zn+Math.imul(ga,Tl)|0,Nn=Nn+Math.imul(Lo,Bl)|0,wn=wn+Math.imul(Lo,Il)|0,wn=wn+Math.imul(Wo,Bl)|0,zn=zn+Math.imul(Wo,Il)|0,Nn=Nn+Math.imul(yo,Al)|0,wn=wn+Math.imul(yo,Ol)|0,wn=wn+Math.imul(_o,Al)|0,zn=zn+Math.imul(_o,Ol)|0,Nn=Nn+Math.imul(lo,Ul)|0,wn=wn+Math.imul(lo,Sl)|0,wn=wn+Math.imul(Eo,Ul)|0,zn=zn+Math.imul(Eo,Sl)|0,Nn=Nn+Math.imul(vo,So)|0,wn=wn+Math.imul(vo,Co)|0,wn=wn+Math.imul(go,So)|0,zn=zn+Math.imul(go,Co)|0;var vu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(vu>>>26)|0,vu&=67108863,Nn=Math.imul($a,Do),wn=Math.imul($a,zo),wn=wn+Math.imul(Jo,Do)|0,zn=Math.imul(Jo,zo),Nn=Nn+Math.imul(Vo,Ll)|0,wn=wn+Math.imul(Vo,_l)|0,wn=wn+Math.imul(Uo,Ll)|0,zn=zn+Math.imul(Uo,_l)|0,Nn=Nn+Math.imul(No,xl)|0,wn=wn+Math.imul(No,Tl)|0,wn=wn+Math.imul(Fo,xl)|0,zn=zn+Math.imul(Fo,Tl)|0,Nn=Nn+Math.imul(qo,Bl)|0,wn=wn+Math.imul(qo,Il)|0,wn=wn+Math.imul(ga,Bl)|0,zn=zn+Math.imul(ga,Il)|0,Nn=Nn+Math.imul(Lo,Al)|0,wn=wn+Math.imul(Lo,Ol)|0,wn=wn+Math.imul(Wo,Al)|0,zn=zn+Math.imul(Wo,Ol)|0,Nn=Nn+Math.imul(yo,Ul)|0,wn=wn+Math.imul(yo,Sl)|0,wn=wn+Math.imul(_o,Ul)|0,zn=zn+Math.imul(_o,Sl)|0,Nn=Nn+Math.imul(lo,So)|0,wn=wn+Math.imul(lo,Co)|0,wn=wn+Math.imul(Eo,So)|0,zn=zn+Math.imul(Eo,Co)|0,Nn=Nn+Math.imul(vo,po)|0,wn=wn+Math.imul(vo,Ro)|0,wn=wn+Math.imul(go,po)|0,zn=zn+Math.imul(go,Ro)|0;var fu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(fu>>>26)|0,fu&=67108863,Nn=Math.imul(Cl,Do),wn=Math.imul(Cl,zo),wn=wn+Math.imul(ko,Do)|0,zn=Math.imul(ko,zo),Nn=Nn+Math.imul($a,Ll)|0,wn=wn+Math.imul($a,_l)|0,wn=wn+Math.imul(Jo,Ll)|0,zn=zn+Math.imul(Jo,_l)|0,Nn=Nn+Math.imul(Vo,xl)|0,wn=wn+Math.imul(Vo,Tl)|0,wn=wn+Math.imul(Uo,xl)|0,zn=zn+Math.imul(Uo,Tl)|0,Nn=Nn+Math.imul(No,Bl)|0,wn=wn+Math.imul(No,Il)|0,wn=wn+Math.imul(Fo,Bl)|0,zn=zn+Math.imul(Fo,Il)|0,Nn=Nn+Math.imul(qo,Al)|0,wn=wn+Math.imul(qo,Ol)|0,wn=wn+Math.imul(ga,Al)|0,zn=zn+Math.imul(ga,Ol)|0,Nn=Nn+Math.imul(Lo,Ul)|0,wn=wn+Math.imul(Lo,Sl)|0,wn=wn+Math.imul(Wo,Ul)|0,zn=zn+Math.imul(Wo,Sl)|0,Nn=Nn+Math.imul(yo,So)|0,wn=wn+Math.imul(yo,Co)|0,wn=wn+Math.imul(_o,So)|0,zn=zn+Math.imul(_o,Co)|0,Nn=Nn+Math.imul(lo,po)|0,wn=wn+Math.imul(lo,Ro)|0,wn=wn+Math.imul(Eo,po)|0,zn=zn+Math.imul(Eo,Ro)|0,Nn=Nn+Math.imul(vo,jo)|0,wn=wn+Math.imul(vo,Ko)|0,wn=wn+Math.imul(go,jo)|0,zn=zn+Math.imul(go,Ko)|0;var gu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(gu>>>26)|0,gu&=67108863,Nn=Math.imul(bo,Do),wn=Math.imul(bo,zo),wn=wn+Math.imul(Io,Do)|0,zn=Math.imul(Io,zo),Nn=Nn+Math.imul(Cl,Ll)|0,wn=wn+Math.imul(Cl,_l)|0,wn=wn+Math.imul(ko,Ll)|0,zn=zn+Math.imul(ko,_l)|0,Nn=Nn+Math.imul($a,xl)|0,wn=wn+Math.imul($a,Tl)|0,wn=wn+Math.imul(Jo,xl)|0,zn=zn+Math.imul(Jo,Tl)|0,Nn=Nn+Math.imul(Vo,Bl)|0,wn=wn+Math.imul(Vo,Il)|0,wn=wn+Math.imul(Uo,Bl)|0,zn=zn+Math.imul(Uo,Il)|0,Nn=Nn+Math.imul(No,Al)|0,wn=wn+Math.imul(No,Ol)|0,wn=wn+Math.imul(Fo,Al)|0,zn=zn+Math.imul(Fo,Ol)|0,Nn=Nn+Math.imul(qo,Ul)|0,wn=wn+Math.imul(qo,Sl)|0,wn=wn+Math.imul(ga,Ul)|0,zn=zn+Math.imul(ga,Sl)|0,Nn=Nn+Math.imul(Lo,So)|0,wn=wn+Math.imul(Lo,Co)|0,wn=wn+Math.imul(Wo,So)|0,zn=zn+Math.imul(Wo,Co)|0,Nn=Nn+Math.imul(yo,po)|0,wn=wn+Math.imul(yo,Ro)|0,wn=wn+Math.imul(_o,po)|0,zn=zn+Math.imul(_o,Ro)|0,Nn=Nn+Math.imul(lo,jo)|0,wn=wn+Math.imul(lo,Ko)|0,wn=wn+Math.imul(Eo,jo)|0,zn=zn+Math.imul(Eo,Ko)|0,Nn=Nn+Math.imul(vo,$l)|0,wn=wn+Math.imul(vo,El)|0,wn=wn+Math.imul(go,$l)|0,zn=zn+Math.imul(go,El)|0;var ou=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(ou>>>26)|0,ou&=67108863,Nn=Math.imul(bo,Ll),wn=Math.imul(bo,_l),wn=wn+Math.imul(Io,Ll)|0,zn=Math.imul(Io,_l),Nn=Nn+Math.imul(Cl,xl)|0,wn=wn+Math.imul(Cl,Tl)|0,wn=wn+Math.imul(ko,xl)|0,zn=zn+Math.imul(ko,Tl)|0,Nn=Nn+Math.imul($a,Bl)|0,wn=wn+Math.imul($a,Il)|0,wn=wn+Math.imul(Jo,Bl)|0,zn=zn+Math.imul(Jo,Il)|0,Nn=Nn+Math.imul(Vo,Al)|0,wn=wn+Math.imul(Vo,Ol)|0,wn=wn+Math.imul(Uo,Al)|0,zn=zn+Math.imul(Uo,Ol)|0,Nn=Nn+Math.imul(No,Ul)|0,wn=wn+Math.imul(No,Sl)|0,wn=wn+Math.imul(Fo,Ul)|0,zn=zn+Math.imul(Fo,Sl)|0,Nn=Nn+Math.imul(qo,So)|0,wn=wn+Math.imul(qo,Co)|0,wn=wn+Math.imul(ga,So)|0,zn=zn+Math.imul(ga,Co)|0,Nn=Nn+Math.imul(Lo,po)|0,wn=wn+Math.imul(Lo,Ro)|0,wn=wn+Math.imul(Wo,po)|0,zn=zn+Math.imul(Wo,Ro)|0,Nn=Nn+Math.imul(yo,jo)|0,wn=wn+Math.imul(yo,Ko)|0,wn=wn+Math.imul(_o,jo)|0,zn=zn+Math.imul(_o,Ko)|0,Nn=Nn+Math.imul(lo,$l)|0,wn=wn+Math.imul(lo,El)|0,wn=wn+Math.imul(Eo,$l)|0,zn=zn+Math.imul(Eo,El)|0;var su=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(su>>>26)|0,su&=67108863,Nn=Math.imul(bo,xl),wn=Math.imul(bo,Tl),wn=wn+Math.imul(Io,xl)|0,zn=Math.imul(Io,Tl),Nn=Nn+Math.imul(Cl,Bl)|0,wn=wn+Math.imul(Cl,Il)|0,wn=wn+Math.imul(ko,Bl)|0,zn=zn+Math.imul(ko,Il)|0,Nn=Nn+Math.imul($a,Al)|0,wn=wn+Math.imul($a,Ol)|0,wn=wn+Math.imul(Jo,Al)|0,zn=zn+Math.imul(Jo,Ol)|0,Nn=Nn+Math.imul(Vo,Ul)|0,wn=wn+Math.imul(Vo,Sl)|0,wn=wn+Math.imul(Uo,Ul)|0,zn=zn+Math.imul(Uo,Sl)|0,Nn=Nn+Math.imul(No,So)|0,wn=wn+Math.imul(No,Co)|0,wn=wn+Math.imul(Fo,So)|0,zn=zn+Math.imul(Fo,Co)|0,Nn=Nn+Math.imul(qo,po)|0,wn=wn+Math.imul(qo,Ro)|0,wn=wn+Math.imul(ga,po)|0,zn=zn+Math.imul(ga,Ro)|0,Nn=Nn+Math.imul(Lo,jo)|0,wn=wn+Math.imul(Lo,Ko)|0,wn=wn+Math.imul(Wo,jo)|0,zn=zn+Math.imul(Wo,Ko)|0,Nn=Nn+Math.imul(yo,$l)|0,wn=wn+Math.imul(yo,El)|0,wn=wn+Math.imul(_o,$l)|0,zn=zn+Math.imul(_o,El)|0;var tu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(tu>>>26)|0,tu&=67108863,Nn=Math.imul(bo,Bl),wn=Math.imul(bo,Il),wn=wn+Math.imul(Io,Bl)|0,zn=Math.imul(Io,Il),Nn=Nn+Math.imul(Cl,Al)|0,wn=wn+Math.imul(Cl,Ol)|0,wn=wn+Math.imul(ko,Al)|0,zn=zn+Math.imul(ko,Ol)|0,Nn=Nn+Math.imul($a,Ul)|0,wn=wn+Math.imul($a,Sl)|0,wn=wn+Math.imul(Jo,Ul)|0,zn=zn+Math.imul(Jo,Sl)|0,Nn=Nn+Math.imul(Vo,So)|0,wn=wn+Math.imul(Vo,Co)|0,wn=wn+Math.imul(Uo,So)|0,zn=zn+Math.imul(Uo,Co)|0,Nn=Nn+Math.imul(No,po)|0,wn=wn+Math.imul(No,Ro)|0,wn=wn+Math.imul(Fo,po)|0,zn=zn+Math.imul(Fo,Ro)|0,Nn=Nn+Math.imul(qo,jo)|0,wn=wn+Math.imul(qo,Ko)|0,wn=wn+Math.imul(ga,jo)|0,zn=zn+Math.imul(ga,Ko)|0,Nn=Nn+Math.imul(Lo,$l)|0,wn=wn+Math.imul(Lo,El)|0,wn=wn+Math.imul(Wo,$l)|0,zn=zn+Math.imul(Wo,El)|0;var zl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(zl>>>26)|0,zl&=67108863,Nn=Math.imul(bo,Al),wn=Math.imul(bo,Ol),wn=wn+Math.imul(Io,Al)|0,zn=Math.imul(Io,Ol),Nn=Nn+Math.imul(Cl,Ul)|0,wn=wn+Math.imul(Cl,Sl)|0,wn=wn+Math.imul(ko,Ul)|0,zn=zn+Math.imul(ko,Sl)|0,Nn=Nn+Math.imul($a,So)|0,wn=wn+Math.imul($a,Co)|0,wn=wn+Math.imul(Jo,So)|0,zn=zn+Math.imul(Jo,Co)|0,Nn=Nn+Math.imul(Vo,po)|0,wn=wn+Math.imul(Vo,Ro)|0,wn=wn+Math.imul(Uo,po)|0,zn=zn+Math.imul(Uo,Ro)|0,Nn=Nn+Math.imul(No,jo)|0,wn=wn+Math.imul(No,Ko)|0,wn=wn+Math.imul(Fo,jo)|0,zn=zn+Math.imul(Fo,Ko)|0,Nn=Nn+Math.imul(qo,$l)|0,wn=wn+Math.imul(qo,El)|0,wn=wn+Math.imul(ga,$l)|0,zn=zn+Math.imul(ga,El)|0;var Gl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Gl>>>26)|0,Gl&=67108863,Nn=Math.imul(bo,Ul),wn=Math.imul(bo,Sl),wn=wn+Math.imul(Io,Ul)|0,zn=Math.imul(Io,Sl),Nn=Nn+Math.imul(Cl,So)|0,wn=wn+Math.imul(Cl,Co)|0,wn=wn+Math.imul(ko,So)|0,zn=zn+Math.imul(ko,Co)|0,Nn=Nn+Math.imul($a,po)|0,wn=wn+Math.imul($a,Ro)|0,wn=wn+Math.imul(Jo,po)|0,zn=zn+Math.imul(Jo,Ro)|0,Nn=Nn+Math.imul(Vo,jo)|0,wn=wn+Math.imul(Vo,Ko)|0,wn=wn+Math.imul(Uo,jo)|0,zn=zn+Math.imul(Uo,Ko)|0,Nn=Nn+Math.imul(No,$l)|0,wn=wn+Math.imul(No,El)|0,wn=wn+Math.imul(Fo,$l)|0,zn=zn+Math.imul(Fo,El)|0;var Jl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Jl>>>26)|0,Jl&=67108863,Nn=Math.imul(bo,So),wn=Math.imul(bo,Co),wn=wn+Math.imul(Io,So)|0,zn=Math.imul(Io,Co),Nn=Nn+Math.imul(Cl,po)|0,wn=wn+Math.imul(Cl,Ro)|0,wn=wn+Math.imul(ko,po)|0,zn=zn+Math.imul(ko,Ro)|0,Nn=Nn+Math.imul($a,jo)|0,wn=wn+Math.imul($a,Ko)|0,wn=wn+Math.imul(Jo,jo)|0,zn=zn+Math.imul(Jo,Ko)|0,Nn=Nn+Math.imul(Vo,$l)|0,wn=wn+Math.imul(Vo,El)|0,wn=wn+Math.imul(Uo,$l)|0,zn=zn+Math.imul(Uo,El)|0;var Pl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Pl>>>26)|0,Pl&=67108863,Nn=Math.imul(bo,po),wn=Math.imul(bo,Ro),wn=wn+Math.imul(Io,po)|0,zn=Math.imul(Io,Ro),Nn=Nn+Math.imul(Cl,jo)|0,wn=wn+Math.imul(Cl,Ko)|0,wn=wn+Math.imul(ko,jo)|0,zn=zn+Math.imul(ko,Ko)|0,Nn=Nn+Math.imul($a,$l)|0,wn=wn+Math.imul($a,El)|0,wn=wn+Math.imul(Jo,$l)|0,zn=zn+Math.imul(Jo,El)|0;var Fl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Fl>>>26)|0,Fl&=67108863,Nn=Math.imul(bo,jo),wn=Math.imul(bo,Ko),wn=wn+Math.imul(Io,jo)|0,zn=Math.imul(Io,Ko),Nn=Nn+Math.imul(Cl,$l)|0,wn=wn+Math.imul(Cl,El)|0,wn=wn+Math.imul(ko,$l)|0,zn=zn+Math.imul(ko,El)|0;var Yl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Yl>>>26)|0,Yl&=67108863,Nn=Math.imul(bo,$l),wn=Math.imul(bo,El),wn=wn+Math.imul(Io,$l)|0,zn=Math.imul(Io,El);var Vl=(Zn+Nn|0)+((wn&8191)<<13)|0;return Zn=(zn+(wn>>>13)|0)+(Vl>>>26)|0,Vl&=67108863,On[0]=Cu,On[1]=iu,On[2]=pu,On[3]=yu,On[4]=hu,On[5]=mu,On[6]=vu,On[7]=fu,On[8]=gu,On[9]=ou,On[10]=su,On[11]=tu,On[12]=zl,On[13]=Gl,On[14]=Jl,On[15]=Pl,On[16]=Fl,On[17]=Yl,On[18]=Vl,Zn!==0&&(On[19]=Zn,Sn.length++),Sn};Math.imul||(An=In);function jn(Tn,Hr,Xr){Xr.negative=Hr.negative^Tn.negative,Xr.length=Tn.length+Hr.length;for(var Sn=0,Rn=0,Pn=0;Pn>>26)|0,Rn+=On>>>26,On&=67108863}Xr.words[Pn]=Zn,Sn=On,On=Rn}return Sn!==0?Xr.words[Pn]=Sn:Xr.length--,Xr._strip()}function eo(Tn,Hr,Xr){return jn(Tn,Hr,Xr)}jr.prototype.mulTo=function(Hr,Xr){var Sn,Rn=this.length+Hr.length;return this.length===10&&Hr.length===10?Sn=An(this,Hr,Xr):Rn<63?Sn=In(this,Hr,Xr):Rn<1024?Sn=jn(this,Hr,Xr):Sn=eo(this,Hr,Xr),Sn},jr.prototype.mul=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),this.mulTo(Hr,Xr)},jr.prototype.mulf=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),eo(this,Hr,Xr)},jr.prototype.imul=function(Hr){return this.clone().mulTo(Hr,this)},jr.prototype.imuln=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(typeof Hr=="number"),Er(Hr<67108864);for(var Sn=0,Rn=0;Rn>=26,Sn+=Pn/67108864|0,Sn+=On>>>26,this.words[Rn]=On&67108863}return Sn!==0&&(this.words[Rn]=Sn,this.length++),Xr?this.ineg():this},jr.prototype.muln=function(Hr){return this.clone().imuln(Hr)},jr.prototype.sqr=function(){return this.mul(this)},jr.prototype.isqr=function(){return this.imul(this.clone())},jr.prototype.pow=function(Hr){var Xr=Cn(Hr);if(Xr.length===0)return new jr(1);for(var Sn=this,Rn=0;Rn=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=67108863>>>26-Xr<<26-Xr,Pn;if(Xr!==0){var On=0;for(Pn=0;Pn>>26-Xr}On&&(this.words[Pn]=On,this.length++)}if(Sn!==0){for(Pn=this.length-1;Pn>=0;Pn--)this.words[Pn+Sn]=this.words[Pn];for(Pn=0;Pn=0);var Rn;Xr?Rn=(Xr-Xr%26)/26:Rn=0;var Pn=Hr%26,On=Math.min((Hr-Pn)/26,this.length),Zn=67108863^67108863>>>Pn<On)for(this.length-=On,wn=0;wn=0&&(zn!==0||wn>=Rn);wn--){var fo=this.words[wn]|0;this.words[wn]=zn<<26-Pn|fo>>>Pn,zn=fo&Zn}return Nn&&zn!==0&&(Nn.words[Nn.length++]=zn),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},jr.prototype.ishrn=function(Hr,Xr,Sn){return Er(this.negative===0),this.iushrn(Hr,Xr,Sn)},jr.prototype.shln=function(Hr){return this.clone().ishln(Hr)},jr.prototype.ushln=function(Hr){return this.clone().iushln(Hr)},jr.prototype.shrn=function(Hr){return this.clone().ishrn(Hr)},jr.prototype.ushrn=function(Hr){return this.clone().iushrn(Hr)},jr.prototype.testn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<=0);var Xr=Hr%26,Sn=(Hr-Xr)/26;if(Er(this.negative===0,"imaskn works only with positive numbers"),this.length<=Sn)return this;if(Xr!==0&&Sn++,this.length=Math.min(Sn,this.length),Xr!==0){var Rn=67108863^67108863>>>Xr<=67108864;Xr++)this.words[Xr]-=67108864,Xr===this.length-1?this.words[Xr+1]=1:this.words[Xr+1]++;return this.length=Math.max(this.length,Xr+1),this},jr.prototype.isubn=function(Hr){if(Er(typeof Hr=="number"),Er(Hr<67108864),Hr<0)return this.iaddn(-Hr);if(this.negative!==0)return this.negative=0,this.iaddn(Hr),this.negative=1,this;if(this.words[0]-=Hr,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Xr=0;Xr>26)-(Nn/67108864|0),this.words[Pn+Sn]=On&67108863}for(;Pn>26,this.words[Pn+Sn]=On&67108863;if(Zn===0)return this._strip();for(Er(Zn===-1),Zn=0,Pn=0;Pn>26,this.words[Pn]=On&67108863;return this.negative=1,this._strip()},jr.prototype._wordDiv=function(Hr,Xr){var Sn=this.length-Hr.length,Rn=this.clone(),Pn=Hr,On=Pn.words[Pn.length-1]|0,Zn=this._countBits(On);Sn=26-Zn,Sn!==0&&(Pn=Pn.ushln(Sn),Rn.iushln(Sn),On=Pn.words[Pn.length-1]|0);var Nn=Rn.length-Pn.length,wn;if(Xr!=="mod"){wn=new jr(null),wn.length=Nn+1,wn.words=new Array(wn.length);for(var zn=0;zn=0;vo--){var go=(Rn.words[Pn.length+vo]|0)*67108864+(Rn.words[Pn.length+vo-1]|0);for(go=Math.min(go/On|0,67108863),Rn._ishlnsubmul(Pn,go,vo);Rn.negative!==0;)go--,Rn.negative=0,Rn._ishlnsubmul(Pn,1,vo),Rn.isZero()||(Rn.negative^=1);wn&&(wn.words[vo]=go)}return wn&&wn._strip(),Rn._strip(),Xr!=="div"&&Sn!==0&&Rn.iushrn(Sn),{div:wn||null,mod:Rn}},jr.prototype.divmod=function(Hr,Xr,Sn){if(Er(!Hr.isZero()),this.isZero())return{div:new jr(0),mod:new jr(0)};var Rn,Pn,On;return this.negative!==0&&Hr.negative===0?(On=this.neg().divmod(Hr,Xr),Xr!=="mod"&&(Rn=On.div.neg()),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.iadd(Hr)),{div:Rn,mod:Pn}):this.negative===0&&Hr.negative!==0?(On=this.divmod(Hr.neg(),Xr),Xr!=="mod"&&(Rn=On.div.neg()),{div:Rn,mod:On.mod}):this.negative&Hr.negative?(On=this.neg().divmod(Hr.neg(),Xr),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.isub(Hr)),{div:On.div,mod:Pn}):Hr.length>this.length||this.cmp(Hr)<0?{div:new jr(0),mod:this}:Hr.length===1?Xr==="div"?{div:this.divn(Hr.words[0]),mod:null}:Xr==="mod"?{div:null,mod:new jr(this.modrn(Hr.words[0]))}:{div:this.divn(Hr.words[0]),mod:new jr(this.modrn(Hr.words[0]))}:this._wordDiv(Hr,Xr)},jr.prototype.div=function(Hr){return this.divmod(Hr,"div",!1).div},jr.prototype.mod=function(Hr){return this.divmod(Hr,"mod",!1).mod},jr.prototype.umod=function(Hr){return this.divmod(Hr,"mod",!0).mod},jr.prototype.divRound=function(Hr){var Xr=this.divmod(Hr);if(Xr.mod.isZero())return Xr.div;var Sn=Xr.div.negative!==0?Xr.mod.isub(Hr):Xr.mod,Rn=Hr.ushrn(1),Pn=Hr.andln(1),On=Sn.cmp(Rn);return On<0||Pn===1&&On===0?Xr.div:Xr.div.negative!==0?Xr.div.isubn(1):Xr.div.iaddn(1)},jr.prototype.modrn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=(1<<26)%Hr,Rn=0,Pn=this.length-1;Pn>=0;Pn--)Rn=(Sn*Rn+(this.words[Pn]|0))%Hr;return Xr?-Rn:Rn},jr.prototype.modn=function(Hr){return this.modrn(Hr)},jr.prototype.idivn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=0,Rn=this.length-1;Rn>=0;Rn--){var Pn=(this.words[Rn]|0)+Sn*67108864;this.words[Rn]=Pn/Hr|0,Sn=Pn%Hr}return this._strip(),Xr?this.ineg():this},jr.prototype.divn=function(Hr){return this.clone().idivn(Hr)},jr.prototype.egcd=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=new jr(0),Zn=new jr(1),Nn=0;Xr.isEven()&&Sn.isEven();)Xr.iushrn(1),Sn.iushrn(1),++Nn;for(var wn=Sn.clone(),zn=Xr.clone();!Xr.isZero();){for(var fo=0,vo=1;!(Xr.words[0]&vo)&&fo<26;++fo,vo<<=1);if(fo>0)for(Xr.iushrn(fo);fo-- >0;)(Rn.isOdd()||Pn.isOdd())&&(Rn.iadd(wn),Pn.isub(zn)),Rn.iushrn(1),Pn.iushrn(1);for(var go=0,uo=1;!(Sn.words[0]&uo)&&go<26;++go,uo<<=1);if(go>0)for(Sn.iushrn(go);go-- >0;)(On.isOdd()||Zn.isOdd())&&(On.iadd(wn),Zn.isub(zn)),On.iushrn(1),Zn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(On),Pn.isub(Zn)):(Sn.isub(Xr),On.isub(Rn),Zn.isub(Pn))}return{a:On,b:Zn,gcd:Sn.iushln(Nn)}},jr.prototype._invmp=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=Sn.clone();Xr.cmpn(1)>0&&Sn.cmpn(1)>0;){for(var Zn=0,Nn=1;!(Xr.words[0]&Nn)&&Zn<26;++Zn,Nn<<=1);if(Zn>0)for(Xr.iushrn(Zn);Zn-- >0;)Rn.isOdd()&&Rn.iadd(On),Rn.iushrn(1);for(var wn=0,zn=1;!(Sn.words[0]&zn)&&wn<26;++wn,zn<<=1);if(wn>0)for(Sn.iushrn(wn);wn-- >0;)Pn.isOdd()&&Pn.iadd(On),Pn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(Pn)):(Sn.isub(Xr),Pn.isub(Rn))}var fo;return Xr.cmpn(1)===0?fo=Rn:fo=Pn,fo.cmpn(0)<0&&fo.iadd(Hr),fo},jr.prototype.gcd=function(Hr){if(this.isZero())return Hr.abs();if(Hr.isZero())return this.abs();var Xr=this.clone(),Sn=Hr.clone();Xr.negative=0,Sn.negative=0;for(var Rn=0;Xr.isEven()&&Sn.isEven();Rn++)Xr.iushrn(1),Sn.iushrn(1);do{for(;Xr.isEven();)Xr.iushrn(1);for(;Sn.isEven();)Sn.iushrn(1);var Pn=Xr.cmp(Sn);if(Pn<0){var On=Xr;Xr=Sn,Sn=On}else if(Pn===0||Sn.cmpn(1)===0)break;Xr.isub(Sn)}while(!0);return Sn.iushln(Rn)},jr.prototype.invm=function(Hr){return this.egcd(Hr).a.umod(Hr)},jr.prototype.isEven=function(){return(this.words[0]&1)===0},jr.prototype.isOdd=function(){return(this.words[0]&1)===1},jr.prototype.andln=function(Hr){return this.words[0]&Hr},jr.prototype.bincn=function(Hr){Er(typeof Hr=="number");var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<>>26,Zn&=67108863,this.words[On]=Zn}return Pn!==0&&(this.words[On]=Pn,this.length++),this},jr.prototype.isZero=function(){return this.length===1&&this.words[0]===0},jr.prototype.cmpn=function(Hr){var Xr=Hr<0;if(this.negative!==0&&!Xr)return-1;if(this.negative===0&&Xr)return 1;this._strip();var Sn;if(this.length>1)Sn=1;else{Xr&&(Hr=-Hr),Er(Hr<=67108863,"Number is too big");var Rn=this.words[0]|0;Sn=Rn===Hr?0:RnHr.length)return 1;if(this.length=0;Sn--){var Rn=this.words[Sn]|0,Pn=Hr.words[Sn]|0;if(Rn!==Pn){RnPn&&(Xr=1);break}}return Xr},jr.prototype.gtn=function(Hr){return this.cmpn(Hr)===1},jr.prototype.gt=function(Hr){return this.cmp(Hr)===1},jr.prototype.gten=function(Hr){return this.cmpn(Hr)>=0},jr.prototype.gte=function(Hr){return this.cmp(Hr)>=0},jr.prototype.ltn=function(Hr){return this.cmpn(Hr)===-1},jr.prototype.lt=function(Hr){return this.cmp(Hr)===-1},jr.prototype.lten=function(Hr){return this.cmpn(Hr)<=0},jr.prototype.lte=function(Hr){return this.cmp(Hr)<=0},jr.prototype.eqn=function(Hr){return this.cmpn(Hr)===0},jr.prototype.eq=function(Hr){return this.cmp(Hr)===0},jr.red=function(Hr){return new so(Hr)},jr.prototype.toRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),Er(this.negative===0,"red works only with positives"),Hr.convertTo(this)._forceRed(Hr)},jr.prototype.fromRed=function(){return Er(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},jr.prototype._forceRed=function(Hr){return this.red=Hr,this},jr.prototype.forceRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),this._forceRed(Hr)},jr.prototype.redAdd=function(Hr){return Er(this.red,"redAdd works only with red numbers"),this.red.add(this,Hr)},jr.prototype.redIAdd=function(Hr){return Er(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Hr)},jr.prototype.redSub=function(Hr){return Er(this.red,"redSub works only with red numbers"),this.red.sub(this,Hr)},jr.prototype.redISub=function(Hr){return Er(this.red,"redISub works only with red numbers"),this.red.isub(this,Hr)},jr.prototype.redShl=function(Hr){return Er(this.red,"redShl works only with red numbers"),this.red.shl(this,Hr)},jr.prototype.redMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.mul(this,Hr)},jr.prototype.redIMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.imul(this,Hr)},jr.prototype.redSqr=function(){return Er(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},jr.prototype.redISqr=function(){return Er(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},jr.prototype.redSqrt=function(){return Er(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},jr.prototype.redInvm=function(){return Er(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},jr.prototype.redNeg=function(){return Er(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},jr.prototype.redPow=function(Hr){return Er(this.red&&!Hr.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Hr)};var ro={k256:null,p224:null,p192:null,p25519:null};function to(Tn,Hr){this.name=Tn,this.p=new jr(Hr,16),this.n=this.p.bitLength(),this.k=new jr(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}to.prototype._tmp=function(){var Hr=new jr(null);return Hr.words=new Array(Math.ceil(this.n/13)),Hr},to.prototype.ireduce=function(Hr){var Xr=Hr,Sn;do this.split(Xr,this.tmp),Xr=this.imulK(Xr),Xr=Xr.iadd(this.tmp),Sn=Xr.bitLength();while(Sn>this.n);var Rn=Sn0?Xr.isub(this.p):Xr.strip!==void 0?Xr.strip():Xr._strip(),Xr},to.prototype.split=function(Hr,Xr){Hr.iushrn(this.n,0,Xr)},to.prototype.imulK=function(Hr){return Hr.imul(this.k)};function _i(){to.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}kr(_i,to),_i.prototype.split=function(Hr,Xr){for(var Sn=4194303,Rn=Math.min(Hr.length,9),Pn=0;Pn>>22,On=Zn}On>>>=22,Hr.words[Pn-10]=On,On===0&&Hr.length>10?Hr.length-=10:Hr.length-=9},_i.prototype.imulK=function(Hr){Hr.words[Hr.length]=0,Hr.words[Hr.length+1]=0,Hr.length+=2;for(var Xr=0,Sn=0;Sn>>=26,Hr.words[Sn]=Pn,Xr=Rn}return Xr!==0&&(Hr.words[Hr.length++]=Xr),Hr},jr._prime=function(Hr){if(ro[Hr])return ro[Hr];var Xr;if(Hr==="k256")Xr=new _i;else if(Hr==="p224")Xr=new oo;else if(Hr==="p192")Xr=new io;else if(Hr==="p25519")Xr=new co;else throw new Error("Unknown prime "+Hr);return ro[Hr]=Xr,Xr};function so(Tn){if(typeof Tn=="string"){var Hr=jr._prime(Tn);this.m=Hr.p,this.prime=Hr}else Er(Tn.gtn(1),"modulus must be greater than 1"),this.m=Tn,this.prime=null}so.prototype._verify1=function(Hr){Er(Hr.negative===0,"red works only with positives"),Er(Hr.red,"red works only with red numbers")},so.prototype._verify2=function(Hr,Xr){Er((Hr.negative|Xr.negative)===0,"red works only with positives"),Er(Hr.red&&Hr.red===Xr.red,"red works only with red numbers")},so.prototype.imod=function(Hr){return this.prime?this.prime.ireduce(Hr)._forceRed(this):(Vr(Hr,Hr.umod(this.m)._forceRed(this)),Hr)},so.prototype.neg=function(Hr){return Hr.isZero()?Hr.clone():this.m.sub(Hr)._forceRed(this)},so.prototype.add=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.add(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn._forceRed(this)},so.prototype.iadd=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.iadd(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn},so.prototype.sub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.sub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn._forceRed(this)},so.prototype.isub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.isub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn},so.prototype.shl=function(Hr,Xr){return this._verify1(Hr),this.imod(Hr.ushln(Xr))},so.prototype.imul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.imul(Xr))},so.prototype.mul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.mul(Xr))},so.prototype.isqr=function(Hr){return this.imul(Hr,Hr.clone())},so.prototype.sqr=function(Hr){return this.mul(Hr,Hr)},so.prototype.sqrt=function(Hr){if(Hr.isZero())return Hr.clone();var Xr=this.m.andln(3);if(Er(Xr%2===1),Xr===3){var Sn=this.m.add(new jr(1)).iushrn(2);return this.pow(Hr,Sn)}for(var Rn=this.m.subn(1),Pn=0;!Rn.isZero()&&Rn.andln(1)===0;)Pn++,Rn.iushrn(1);Er(!Rn.isZero());var On=new jr(1).toRed(this),Zn=On.redNeg(),Nn=this.m.subn(1).iushrn(1),wn=this.m.bitLength();for(wn=new jr(2*wn*wn).toRed(this);this.pow(wn,Nn).cmp(Zn)!==0;)wn.redIAdd(Zn);for(var zn=this.pow(wn,Rn),fo=this.pow(Hr,Rn.addn(1).iushrn(1)),vo=this.pow(Hr,Rn),go=Pn;vo.cmp(On)!==0;){for(var uo=vo,lo=0;uo.cmp(On)!==0;lo++)uo=uo.redSqr();Er(lo=0;Pn--){for(var zn=Xr.words[Pn],fo=wn-1;fo>=0;fo--){var vo=zn>>fo&1;if(On!==Rn[0]&&(On=this.sqr(On)),vo===0&&Zn===0){Nn=0;continue}Zn<<=1,Zn|=vo,Nn++,!(Nn!==Sn&&(Pn!==0||fo!==0))&&(On=this.mul(On,Rn[Zn]),Nn=0,Zn=0)}wn=26}return On},so.prototype.convertTo=function(Hr){var Xr=Hr.umod(this.m);return Xr===Hr?Xr.clone():Xr},so.prototype.convertFrom=function(Hr){var Xr=Hr.clone();return Xr.red=null,Xr},jr.mont=function(Hr){return new no(Hr)};function no(Tn){so.call(this,Tn),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new jr(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}kr(no,so),no.prototype.convertTo=function(Hr){return this.imod(Hr.ushln(this.shift))},no.prototype.convertFrom=function(Hr){var Xr=this.imod(Hr.mul(this.rinv));return Xr.red=null,Xr},no.prototype.imul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return Hr.words[0]=0,Hr.length=1,Hr;var Sn=Hr.imul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.mul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return new jr(0)._forceRed(this);var Sn=Hr.mul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.invm=function(Hr){var Xr=this.imod(Hr._invmp(this.m).mul(this.r2));return Xr._forceRed(this)}})(fr,commonjsGlobal)})(bn);var bnExports=bn.exports;const BN=getDefaultExportFromCjs$2(bnExports);var _Buffer=safeBufferExports.Buffer;function base(fr){if(fr.length>=255)throw new TypeError("Alphabet too long");for(var br=new Uint8Array(256),wr=0;wr>>0,jn=new Uint8Array(An);Cn!==In;){for(var eo=Qr[Cn],ro=0,to=An-1;(eo!==0||ro>>0,jn[to]=eo%Br>>>0,eo=eo/Br>>>0;if(eo!==0)throw new Error("Non-zero carry");En=ro,Cn++}for(var _i=An-En;_i!==An&&jn[_i]===0;)_i++;for(var oo=Wr.repeat(_n);_i>>0,An=new Uint8Array(In);_n>>0,An[ro]=jn%256>>>0,jn=jn/256>>>0;if(jn!==0)throw new Error("Non-zero carry");Cn=eo,_n++}for(var to=In-Cn;to!==In&&An[to]===0;)to++;var _i=_Buffer.allocUnsafe(En+(In-to));_i.fill(0,0,En);for(var oo=En;to!==In;)_i[oo++]=An[to++];return _i}function Jr(Qr){var _n=Zr(Qr);if(_n)return _n;throw new Error("Non-base"+Br+" character")}return{encode:Vr,decodeUnsafe:Zr,decode:Jr}}var src=base,basex=src,ALPHABET="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58=basex(ALPHABET);const bs58$1=getDefaultExportFromCjs$2(bs58);class StructError extends TypeError{constructor(br,wr){let Er;const{message:kr,explanation:jr,...Br}=br,{path:Wr}=br,qr=Wr.length===0?kr:`At path: ${Wr.join(".")} -- ${kr}`;super(jr??qr),jr!=null&&(this.cause=qr),Object.assign(this,Br),this.name=this.constructor.name,this.failures=()=>Er??(Er=[br,...wr()])}}function isIterable(fr){return isObject(fr)&&typeof fr[Symbol.iterator]=="function"}function isObject(fr){return typeof fr=="object"&&fr!=null}function isNonArrayObject(fr){return isObject(fr)&&!Array.isArray(fr)}function print(fr){return typeof fr=="symbol"?fr.toString():typeof fr=="string"?JSON.stringify(fr):`${fr}`}function shiftIterator(fr){const{done:br,value:wr}=fr.next();return br?void 0:wr}function toFailure(fr,br,wr,Er){if(fr===!0)return;fr===!1?fr={}:typeof fr=="string"&&(fr={message:fr});const{path:kr,branch:jr}=br,{type:Br}=wr,{refinement:Wr,message:qr=`Expected a value of type \`${Br}\`${Wr?` with refinement \`${Wr}\``:""}, but received: \`${print(Er)}\``}=fr;return{value:Er,type:Br,refinement:Wr,key:kr[kr.length-1],path:kr,branch:jr,...fr,message:qr}}function*toFailures(fr,br,wr,Er){isIterable(fr)||(fr=[fr]);for(const kr of fr){const jr=toFailure(kr,br,wr,Er);jr&&(yield jr)}}function*run(fr,br,wr={}){const{path:Er=[],branch:kr=[fr],coerce:jr=!1,mask:Br=!1}=wr,Wr={path:Er,branch:kr,mask:Br};jr&&(fr=br.coercer(fr,Wr));let qr="valid";for(const Gr of br.validator(fr,Wr))Gr.explanation=wr.message,qr="not_valid",yield[Gr,void 0];for(let[Gr,Vr,Zr]of br.entries(fr,Wr)){const Jr=run(Vr,Zr,{path:Gr===void 0?Er:[...Er,Gr],branch:Gr===void 0?kr:[...kr,Vr],coerce:jr,mask:Br,message:wr.message});for(const Qr of Jr)Qr[0]?(qr=Qr[0].refinement!=null?"not_refined":"not_valid",yield[Qr[0],void 0]):jr&&(Vr=Qr[1],Gr===void 0?fr=Vr:fr instanceof Map?fr.set(Gr,Vr):fr instanceof Set?fr.add(Vr):isObject(fr)&&(Vr!==void 0||Gr in fr)&&(fr[Gr]=Vr))}if(qr!=="not_valid")for(const Gr of br.refiner(fr,Wr))Gr.explanation=wr.message,qr="not_refined",yield[Gr,void 0];qr==="valid"&&(yield[void 0,fr])}let Struct$1=class{constructor(br){const{type:wr,schema:Er,validator:kr,refiner:jr,coercer:Br=qr=>qr,entries:Wr=function*(){}}=br;this.type=wr,this.schema=Er,this.entries=Wr,this.coercer=Br,kr?this.validator=(qr,Gr)=>{const Vr=kr(qr,Gr);return toFailures(Vr,Gr,this,qr)}:this.validator=()=>[],jr?this.refiner=(qr,Gr)=>{const Vr=jr(qr,Gr);return toFailures(Vr,Gr,this,qr)}:this.refiner=()=>[]}assert(br,wr){return assert(br,this,wr)}create(br,wr){return create(br,this,wr)}is(br){return is(br,this)}mask(br,wr){return mask(br,this,wr)}validate(br,wr={}){return validate(br,this,wr)}};function assert(fr,br,wr){const Er=validate(fr,br,{message:wr});if(Er[0])throw Er[0]}function create(fr,br,wr){const Er=validate(fr,br,{coerce:!0,message:wr});if(Er[0])throw Er[0];return Er[1]}function mask(fr,br,wr){const Er=validate(fr,br,{coerce:!0,mask:!0,message:wr});if(Er[0])throw Er[0];return Er[1]}function is(fr,br){return!validate(fr,br)[0]}function validate(fr,br,wr={}){const Er=run(fr,br,wr),kr=shiftIterator(Er);return kr[0]?[new StructError(kr[0],function*(){for(const Br of Er)Br[0]&&(yield Br[0])}),void 0]:[void 0,kr[1]]}function define(fr,br){return new Struct$1({type:fr,schema:null,validator:br})}function any(){return define("any",()=>!0)}function array(fr){return new Struct$1({type:"array",schema:fr,*entries(br){if(fr&&Array.isArray(br))for(const[wr,Er]of br.entries())yield[wr,Er,fr]},coercer(br){return Array.isArray(br)?br.slice():br},validator(br){return Array.isArray(br)||`Expected an array value, but received: ${print(br)}`}})}function boolean(){return define("boolean",fr=>typeof fr=="boolean")}function instance(fr){return define("instance",br=>br instanceof fr||`Expected a \`${fr.name}\` instance, but received: ${print(br)}`)}function literal(fr){const br=print(fr),wr=typeof fr;return new Struct$1({type:"literal",schema:wr==="string"||wr==="number"||wr==="boolean"?fr:null,validator(Er){return Er===fr||`Expected the literal \`${br}\`, but received: ${print(Er)}`}})}function never(){return define("never",()=>!1)}function nullable(fr){return new Struct$1({...fr,validator:(br,wr)=>br===null||fr.validator(br,wr),refiner:(br,wr)=>br===null||fr.refiner(br,wr)})}function number(){return define("number",fr=>typeof fr=="number"&&!isNaN(fr)||`Expected a number, but received: ${print(fr)}`)}function optional(fr){return new Struct$1({...fr,validator:(br,wr)=>br===void 0||fr.validator(br,wr),refiner:(br,wr)=>br===void 0||fr.refiner(br,wr)})}function record(fr,br){return new Struct$1({type:"record",schema:null,*entries(wr){if(isObject(wr))for(const Er in wr){const kr=wr[Er];yield[Er,Er,fr],yield[Er,kr,br]}},validator(wr){return isNonArrayObject(wr)||`Expected an object, but received: ${print(wr)}`},coercer(wr){return isNonArrayObject(wr)?{...wr}:wr}})}function string(){return define("string",fr=>typeof fr=="string"||`Expected a string, but received: ${print(fr)}`)}function tuple(fr){const br=never();return new Struct$1({type:"tuple",schema:null,*entries(wr){if(Array.isArray(wr)){const Er=Math.max(fr.length,wr.length);for(let kr=0;krwr.type).join(" | ");return new Struct$1({type:"union",schema:null,coercer(wr,Er){for(const kr of fr){const[jr,Br]=kr.validate(wr,{coerce:!0,mask:Er.mask});if(!jr)return Br}return wr},validator(wr,Er){const kr=[];for(const jr of fr){const[...Br]=run(wr,jr,Er),[Wr]=Br;if(Wr[0])for(const[qr]of Br)qr&&kr.push(qr);else return[]}return[`Expected the value to satisfy a union of \`${br}\`, but received: ${print(wr)}`,...kr]}})}function unknown(){return define("unknown",()=>!0)}function coerce(fr,br,wr){return new Struct$1({...fr,coercer:(Er,kr)=>is(Er,br)?fr.coercer(wr(Er,kr),kr):fr.coercer(Er,kr)})}function isOnCurve(fr){try{return ed25519.ExtendedPoint.fromHex(fr),!0}catch{return!1}}const toBuffer=fr=>Buffer$1$1.isBuffer(fr)?fr:fr instanceof Uint8Array?Buffer$1$1.from(fr.buffer,fr.byteOffset,fr.byteLength):Buffer$1$1.from(fr);class Struct{constructor(br){Object.assign(this,br)}encode(){return Buffer$1$1.from(serialize_1(SOLANA_SCHEMA,this))}static decode(br){return deserialize_1(SOLANA_SCHEMA,this,br)}static decodeUnchecked(br){return deserializeUnchecked_1(SOLANA_SCHEMA,this,br)}}const SOLANA_SCHEMA=new Map;var _PublicKey;const MAX_SEED_LENGTH=32,PUBLIC_KEY_LENGTH=32;function isPublicKeyData(fr){return fr._bn!==void 0}let uniquePublicKeyCounter=1;class PublicKey extends Struct{constructor(br){if(super({}),this._bn=void 0,isPublicKeyData(br))this._bn=br._bn;else{if(typeof br=="string"){const wr=bs58$1.decode(br);if(wr.length!=PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input");this._bn=new BN(wr)}else this._bn=new BN(br);if(this._bn.byteLength()>PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input")}}static unique(){const br=new PublicKey(uniquePublicKeyCounter);return uniquePublicKeyCounter+=1,new PublicKey(br.toBuffer())}equals(br){return this._bn.eq(br._bn)}toBase58(){return bs58$1.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const br=this.toBuffer();return new Uint8Array(br.buffer,br.byteOffset,br.byteLength)}toBuffer(){const br=this._bn.toArrayLike(Buffer$1$1);if(br.length===PUBLIC_KEY_LENGTH)return br;const wr=Buffer$1$1.alloc(32);return br.copy(wr,32-br.length),wr}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(br,wr,Er){const kr=Buffer$1$1.concat([br.toBuffer(),Buffer$1$1.from(wr),Er.toBuffer()]),jr=sha256$4(kr);return new PublicKey(jr)}static createProgramAddressSync(br,wr){let Er=Buffer$1$1.alloc(0);br.forEach(function(jr){if(jr.length>MAX_SEED_LENGTH)throw new TypeError("Max seed length exceeded");Er=Buffer$1$1.concat([Er,toBuffer(jr)])}),Er=Buffer$1$1.concat([Er,wr.toBuffer(),Buffer$1$1.from("ProgramDerivedAddress")]);const kr=sha256$4(Er);if(isOnCurve(kr))throw new Error("Invalid seeds, address must fall off the curve");return new PublicKey(kr)}static async createProgramAddress(br,wr){return this.createProgramAddressSync(br,wr)}static findProgramAddressSync(br,wr){let Er=255,kr;for(;Er!=0;){try{const jr=br.concat(Buffer$1$1.from([Er]));kr=this.createProgramAddressSync(jr,wr)}catch(jr){if(jr instanceof TypeError)throw jr;Er--;continue}return[kr,Er]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(br,wr){return this.findProgramAddressSync(br,wr)}static isOnCurve(br){const wr=new PublicKey(br);return isOnCurve(wr.toBytes())}}_PublicKey=PublicKey;PublicKey.default=new _PublicKey("11111111111111111111111111111111");SOLANA_SCHEMA.set(PublicKey,{kind:"struct",fields:[["_bn","u256"]]});new PublicKey("BPFLoader1111111111111111111111111111111111");const SIGNATURE_LENGTH_IN_BYTES=64,publicKey=(fr="publicKey")=>blob(32,fr),rustString=(fr="string")=>{const br=struct([u32("length"),u32("lengthPadding"),blob(offset(u32(),-8),"chars")],fr),wr=br.decode.bind(br),Er=br.encode.bind(br),kr=br;return kr.decode=(jr,Br)=>wr(jr,Br).chars.toString(),kr.encode=(jr,Br,Wr)=>{const qr={chars:Buffer$1$1.from(jr,"utf8")};return Er(qr,Br,Wr)},kr.alloc=jr=>u32().span+u32().span+Buffer$1$1.from(jr,"utf8").length,kr},authorized=(fr="authorized")=>struct([publicKey("staker"),publicKey("withdrawer")],fr),lockup=(fr="lockup")=>struct([ns64("unixTimestamp"),ns64("epoch"),publicKey("custodian")],fr),voteInit=(fr="voteInit")=>struct([publicKey("nodePubkey"),publicKey("authorizedVoter"),publicKey("authorizedWithdrawer"),u8("commission")],fr),voteAuthorizeWithSeedArgs=(fr="voteAuthorizeWithSeedArgs")=>struct([u32("voteAuthorizationType"),publicKey("currentAuthorityDerivedKeyOwnerPubkey"),rustString("currentAuthorityDerivedKeySeed"),publicKey("newAuthorized")],fr);Buffer$1$1.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);new PublicKey("SysvarC1ock11111111111111111111111111111111");new PublicKey("SysvarEpochSchedu1e111111111111111111111111");new PublicKey("Sysvar1nstructions1111111111111111111111111");new PublicKey("SysvarRecentB1ockHashes11111111111111111111");new PublicKey("SysvarRent111111111111111111111111111111111");new PublicKey("SysvarRewards111111111111111111111111111111");new PublicKey("SysvarS1otHashes111111111111111111111111111");new PublicKey("SysvarS1otHistory11111111111111111111111111");new PublicKey("SysvarStakeHistory1111111111111111111111111");const FeeCalculatorLayout=nu64("lamportsPerSignature"),NonceAccountLayout=struct([u32("version"),u32("state"),publicKey("authorizedPubkey"),publicKey("nonce"),struct([FeeCalculatorLayout],"feeCalculator")]);NonceAccountLayout.span;const encodeDecode=fr=>{const br=fr.decode.bind(fr),wr=fr.encode.bind(fr);return{decode:br,encode:wr}},bigInt=fr=>br=>{const wr=blob(fr,br),{encode:Er,decode:kr}=encodeDecode(wr),jr=wr;return jr.decode=(Br,Wr)=>{const qr=kr(Br,Wr);return toBigIntLE_1(Buffer$1$1.from(qr))},jr.encode=(Br,Wr,qr)=>{const Gr=toBufferLE_1(Br,fr);return Er(Gr,Wr,qr)},jr},u64=bigInt(8);Object.freeze({Create:{index:0,layout:struct([u32("instruction"),ns64("lamports"),ns64("space"),publicKey("programId")])},Assign:{index:1,layout:struct([u32("instruction"),publicKey("programId")])},Transfer:{index:2,layout:struct([u32("instruction"),u64("lamports")])},CreateWithSeed:{index:3,layout:struct([u32("instruction"),publicKey("base"),rustString("seed"),ns64("lamports"),ns64("space"),publicKey("programId")])},AdvanceNonceAccount:{index:4,layout:struct([u32("instruction")])},WithdrawNonceAccount:{index:5,layout:struct([u32("instruction"),ns64("lamports")])},InitializeNonceAccount:{index:6,layout:struct([u32("instruction"),publicKey("authorized")])},AuthorizeNonceAccount:{index:7,layout:struct([u32("instruction"),publicKey("authorized")])},Allocate:{index:8,layout:struct([u32("instruction"),ns64("space")])},AllocateWithSeed:{index:9,layout:struct([u32("instruction"),publicKey("base"),rustString("seed"),ns64("space"),publicKey("programId")])},AssignWithSeed:{index:10,layout:struct([u32("instruction"),publicKey("base"),rustString("seed"),publicKey("programId")])},TransferWithSeed:{index:11,layout:struct([u32("instruction"),u64("lamports"),rustString("seed"),publicKey("programId")])},UpgradeNonceAccount:{index:12,layout:struct([u32("instruction")])}});new PublicKey("11111111111111111111111111111111");new PublicKey("BPFLoader2111111111111111111111111111111111");struct([u32("typeIndex"),u64("deactivationSlot"),nu64("lastExtendedSlot"),u8("lastExtendedStartIndex"),u8(),seq(publicKey(),offset(u8(),-1),"authority")]);const PublicKeyFromString=coerce(instance(PublicKey),string(),fr=>new PublicKey(fr)),RawAccountDataResult=tuple([string(),literal("base64")]),BufferFromRawAccountData=coerce(instance(Buffer$1$1),RawAccountDataResult,fr=>Buffer$1$1.from(fr[0],"base64"));function createRpcResult(fr){return union([type({jsonrpc:literal("2.0"),id:string(),result:fr}),type({jsonrpc:literal("2.0"),id:string(),error:type({code:unknown(),message:string(),data:optional(any())})})])}const UnknownRpcResult=createRpcResult(unknown());function jsonRpcResult(fr){return coerce(createRpcResult(fr),UnknownRpcResult,br=>"error"in br?br:{...br,result:create(br.result,fr)})}function jsonRpcResultAndContext(fr){return jsonRpcResult(type({context:type({slot:number()}),value:fr}))}function notificationResultAndContext(fr){return type({context:type({slot:number()}),value:fr})}const GetInflationGovernorResult=type({foundation:number(),foundationTerm:number(),initial:number(),taper:number(),terminal:number()});jsonRpcResult(array(nullable(type({epoch:number(),effectiveSlot:number(),amount:number(),postBalance:number(),commission:optional(nullable(number()))}))));const GetRecentPrioritizationFeesResult=array(type({slot:number(),prioritizationFee:number()})),GetInflationRateResult=type({total:number(),validator:number(),foundation:number(),epoch:number()}),GetEpochInfoResult=type({epoch:number(),slotIndex:number(),slotsInEpoch:number(),absoluteSlot:number(),blockHeight:optional(number()),transactionCount:optional(number())}),GetEpochScheduleResult=type({slotsPerEpoch:number(),leaderScheduleSlotOffset:number(),warmup:boolean(),firstNormalEpoch:number(),firstNormalSlot:number()}),GetLeaderScheduleResult=record(string(),array(number())),TransactionErrorResult=nullable(union([type({}),string()])),SignatureStatusResult=type({err:TransactionErrorResult}),SignatureReceivedResult=literal("receivedSignature");type({"solana-core":string(),"feature-set":optional(number())});const ParsedInstructionStruct=type({program:string(),programId:PublicKeyFromString,parsed:unknown()}),PartiallyDecodedInstructionStruct=type({programId:PublicKeyFromString,accounts:array(PublicKeyFromString),data:string()});jsonRpcResultAndContext(type({err:nullable(union([type({}),string()])),logs:nullable(array(string())),accounts:optional(nullable(array(nullable(type({executable:boolean(),owner:string(),lamports:number(),data:array(string()),rentEpoch:optional(number())}))))),unitsConsumed:optional(number()),returnData:optional(nullable(type({programId:string(),data:tuple([string(),literal("base64")])}))),innerInstructions:optional(nullable(array(type({index:number(),instructions:array(union([ParsedInstructionStruct,PartiallyDecodedInstructionStruct]))}))))}));jsonRpcResultAndContext(type({byIdentity:record(string(),array(number())),range:type({firstSlot:number(),lastSlot:number()})}));jsonRpcResult(GetInflationGovernorResult);jsonRpcResult(GetInflationRateResult);jsonRpcResult(GetRecentPrioritizationFeesResult);jsonRpcResult(GetEpochInfoResult);jsonRpcResult(GetEpochScheduleResult);jsonRpcResult(GetLeaderScheduleResult);jsonRpcResult(number());jsonRpcResultAndContext(type({total:number(),circulating:number(),nonCirculating:number(),nonCirculatingAccounts:array(PublicKeyFromString)}));const TokenAmountResult=type({amount:string(),uiAmount:nullable(number()),decimals:number(),uiAmountString:optional(string())});jsonRpcResultAndContext(array(type({address:PublicKeyFromString,amount:string(),uiAmount:nullable(number()),decimals:number(),uiAmountString:optional(string())})));jsonRpcResultAndContext(array(type({pubkey:PublicKeyFromString,account:type({executable:boolean(),owner:PublicKeyFromString,lamports:number(),data:BufferFromRawAccountData,rentEpoch:number()})})));const ParsedAccountDataResult=type({program:string(),parsed:unknown(),space:number()});jsonRpcResultAndContext(array(type({pubkey:PublicKeyFromString,account:type({executable:boolean(),owner:PublicKeyFromString,lamports:number(),data:ParsedAccountDataResult,rentEpoch:number()})})));jsonRpcResultAndContext(array(type({lamports:number(),address:PublicKeyFromString})));const AccountInfoResult=type({executable:boolean(),owner:PublicKeyFromString,lamports:number(),data:BufferFromRawAccountData,rentEpoch:number()});type({pubkey:PublicKeyFromString,account:AccountInfoResult});const ParsedOrRawAccountData=coerce(union([instance(Buffer$1$1),ParsedAccountDataResult]),union([RawAccountDataResult,ParsedAccountDataResult]),fr=>Array.isArray(fr)?create(fr,BufferFromRawAccountData):fr),ParsedAccountInfoResult=type({executable:boolean(),owner:PublicKeyFromString,lamports:number(),data:ParsedOrRawAccountData,rentEpoch:number()});type({pubkey:PublicKeyFromString,account:ParsedAccountInfoResult});type({state:union([literal("active"),literal("inactive"),literal("activating"),literal("deactivating")]),active:number(),inactive:number()});jsonRpcResult(array(type({signature:string(),slot:number(),err:TransactionErrorResult,memo:nullable(string()),blockTime:optional(nullable(number()))})));jsonRpcResult(array(type({signature:string(),slot:number(),err:TransactionErrorResult,memo:nullable(string()),blockTime:optional(nullable(number()))})));type({subscription:number(),result:notificationResultAndContext(AccountInfoResult)});const ProgramAccountInfoResult=type({pubkey:PublicKeyFromString,account:AccountInfoResult});type({subscription:number(),result:notificationResultAndContext(ProgramAccountInfoResult)});const SlotInfoResult=type({parent:number(),slot:number(),root:number()});type({subscription:number(),result:SlotInfoResult});const SlotUpdateResult=union([type({type:union([literal("firstShredReceived"),literal("completed"),literal("optimisticConfirmation"),literal("root")]),slot:number(),timestamp:number()}),type({type:literal("createdBank"),parent:number(),slot:number(),timestamp:number()}),type({type:literal("frozen"),slot:number(),timestamp:number(),stats:type({numTransactionEntries:number(),numSuccessfulTransactions:number(),numFailedTransactions:number(),maxTransactionsPerEntry:number()})}),type({type:literal("dead"),slot:number(),timestamp:number(),err:string()})]);type({subscription:number(),result:SlotUpdateResult});type({subscription:number(),result:notificationResultAndContext(union([SignatureStatusResult,SignatureReceivedResult]))});type({subscription:number(),result:number()});type({pubkey:string(),gossip:nullable(string()),tpu:nullable(string()),rpc:nullable(string()),version:nullable(string())});const VoteAccountInfoResult=type({votePubkey:string(),nodePubkey:string(),activatedStake:number(),epochVoteAccount:boolean(),epochCredits:array(tuple([number(),number(),number()])),commission:number(),lastVote:number(),rootSlot:nullable(number())});jsonRpcResult(type({current:array(VoteAccountInfoResult),delinquent:array(VoteAccountInfoResult)}));const ConfirmationStatus=union([literal("processed"),literal("confirmed"),literal("finalized")]),SignatureStatusResponse=type({slot:number(),confirmations:nullable(number()),err:TransactionErrorResult,confirmationStatus:optional(ConfirmationStatus)});jsonRpcResultAndContext(array(nullable(SignatureStatusResponse)));jsonRpcResult(number());const AddressTableLookupStruct=type({accountKey:PublicKeyFromString,writableIndexes:array(number()),readonlyIndexes:array(number())}),ConfirmedTransactionResult=type({signatures:array(string()),message:type({accountKeys:array(string()),header:type({numRequiredSignatures:number(),numReadonlySignedAccounts:number(),numReadonlyUnsignedAccounts:number()}),instructions:array(type({accounts:array(number()),data:string(),programIdIndex:number()})),recentBlockhash:string(),addressTableLookups:optional(array(AddressTableLookupStruct))})}),AnnotatedAccountKey=type({pubkey:PublicKeyFromString,signer:boolean(),writable:boolean(),source:optional(union([literal("transaction"),literal("lookupTable")]))}),ConfirmedTransactionAccountsModeResult=type({accountKeys:array(AnnotatedAccountKey),signatures:array(string())}),ParsedInstructionResult=type({parsed:unknown(),program:string(),programId:PublicKeyFromString}),RawInstructionResult=type({accounts:array(PublicKeyFromString),data:string(),programId:PublicKeyFromString}),InstructionResult=union([RawInstructionResult,ParsedInstructionResult]),UnknownInstructionResult=union([type({parsed:unknown(),program:string(),programId:string()}),type({accounts:array(string()),data:string(),programId:string()})]),ParsedOrRawInstruction=coerce(InstructionResult,UnknownInstructionResult,fr=>"accounts"in fr?create(fr,RawInstructionResult):create(fr,ParsedInstructionResult)),ParsedConfirmedTransactionResult=type({signatures:array(string()),message:type({accountKeys:array(AnnotatedAccountKey),instructions:array(ParsedOrRawInstruction),recentBlockhash:string(),addressTableLookups:optional(nullable(array(AddressTableLookupStruct)))})}),TokenBalanceResult=type({accountIndex:number(),mint:string(),owner:optional(string()),programId:optional(string()),uiTokenAmount:TokenAmountResult}),LoadedAddressesResult=type({writable:array(PublicKeyFromString),readonly:array(PublicKeyFromString)}),ConfirmedTransactionMetaResult=type({err:TransactionErrorResult,fee:number(),innerInstructions:optional(nullable(array(type({index:number(),instructions:array(type({accounts:array(number()),data:string(),programIdIndex:number()}))})))),preBalances:array(number()),postBalances:array(number()),logMessages:optional(nullable(array(string()))),preTokenBalances:optional(nullable(array(TokenBalanceResult))),postTokenBalances:optional(nullable(array(TokenBalanceResult))),loadedAddresses:optional(LoadedAddressesResult),computeUnitsConsumed:optional(number())}),ParsedConfirmedTransactionMetaResult=type({err:TransactionErrorResult,fee:number(),innerInstructions:optional(nullable(array(type({index:number(),instructions:array(ParsedOrRawInstruction)})))),preBalances:array(number()),postBalances:array(number()),logMessages:optional(nullable(array(string()))),preTokenBalances:optional(nullable(array(TokenBalanceResult))),postTokenBalances:optional(nullable(array(TokenBalanceResult))),loadedAddresses:optional(LoadedAddressesResult),computeUnitsConsumed:optional(number())}),TransactionVersionStruct=union([literal(0),literal("legacy")]),RewardsResult=type({pubkey:string(),lamports:number(),postBalance:nullable(number()),rewardType:nullable(string()),commission:optional(nullable(number()))});jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number(),transactions:array(type({transaction:ConfirmedTransactionResult,meta:nullable(ConfirmedTransactionMetaResult),version:optional(TransactionVersionStruct)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number()),blockHeight:nullable(number())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number(),rewards:optional(array(RewardsResult)),blockTime:nullable(number()),blockHeight:nullable(number())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number(),transactions:array(type({transaction:ConfirmedTransactionAccountsModeResult,meta:nullable(ConfirmedTransactionMetaResult),version:optional(TransactionVersionStruct)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number()),blockHeight:nullable(number())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number(),transactions:array(type({transaction:ParsedConfirmedTransactionResult,meta:nullable(ParsedConfirmedTransactionMetaResult),version:optional(TransactionVersionStruct)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number()),blockHeight:nullable(number())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number(),transactions:array(type({transaction:ConfirmedTransactionAccountsModeResult,meta:nullable(ParsedConfirmedTransactionMetaResult),version:optional(TransactionVersionStruct)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number()),blockHeight:nullable(number())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number(),rewards:optional(array(RewardsResult)),blockTime:nullable(number()),blockHeight:nullable(number())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number(),transactions:array(type({transaction:ConfirmedTransactionResult,meta:nullable(ConfirmedTransactionMetaResult)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number(),signatures:array(string()),blockTime:nullable(number())})));jsonRpcResult(nullable(type({slot:number(),meta:nullable(ConfirmedTransactionMetaResult),blockTime:optional(nullable(number())),transaction:ConfirmedTransactionResult,version:optional(TransactionVersionStruct)})));jsonRpcResult(nullable(type({slot:number(),transaction:ParsedConfirmedTransactionResult,meta:nullable(ParsedConfirmedTransactionMetaResult),blockTime:optional(nullable(number())),version:optional(TransactionVersionStruct)})));jsonRpcResultAndContext(type({blockhash:string(),feeCalculator:type({lamportsPerSignature:number()})}));jsonRpcResultAndContext(type({blockhash:string(),lastValidBlockHeight:number()}));jsonRpcResultAndContext(boolean());const PerfSampleResult=type({slot:number(),numTransactions:number(),numSlots:number(),samplePeriodSecs:number()});jsonRpcResult(array(PerfSampleResult));jsonRpcResultAndContext(nullable(type({feeCalculator:type({lamportsPerSignature:number()})})));jsonRpcResult(string());jsonRpcResult(string());const LogsResult=type({err:TransactionErrorResult,logs:array(string()),signature:string()});type({result:notificationResultAndContext(LogsResult),subscription:number()});Object.freeze({CreateLookupTable:{index:0,layout:struct([u32("instruction"),u64("recentSlot"),u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:struct([u32("instruction")])},ExtendLookupTable:{index:2,layout:struct([u32("instruction"),u64(),seq(publicKey(),offset(u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:struct([u32("instruction")])},CloseLookupTable:{index:4,layout:struct([u32("instruction")])}});new PublicKey("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:struct([u8("instruction"),u32("units"),u32("additionalFee")])},RequestHeapFrame:{index:1,layout:struct([u8("instruction"),u32("bytes")])},SetComputeUnitLimit:{index:2,layout:struct([u8("instruction"),u32("units")])},SetComputeUnitPrice:{index:3,layout:struct([u8("instruction"),u64("microLamports")])}});new PublicKey("ComputeBudget111111111111111111111111111111");struct([u8("numSignatures"),u8("padding"),u16("signatureOffset"),u16("signatureInstructionIndex"),u16("publicKeyOffset"),u16("publicKeyInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u16("messageInstructionIndex")]);new PublicKey("Ed25519SigVerify111111111111111111111111111");secp256k1$1.utils.isValidPrivateKey;secp256k1$1.getPublicKey;struct([u8("numSignatures"),u16("signatureOffset"),u8("signatureInstructionIndex"),u16("ethAddressOffset"),u8("ethAddressInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u8("messageInstructionIndex"),blob(20,"ethAddress"),blob(64,"signature"),u8("recoveryId")]);new PublicKey("KeccakSecp256k11111111111111111111111111111");var _Lockup;new PublicKey("StakeConfig11111111111111111111111111111111");class Lockup{constructor(br,wr,Er){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=br,this.epoch=wr,this.custodian=Er}}_Lockup=Lockup;Lockup.default=new _Lockup(0,0,PublicKey.default);Object.freeze({Initialize:{index:0,layout:struct([u32("instruction"),authorized(),lockup()])},Authorize:{index:1,layout:struct([u32("instruction"),publicKey("newAuthorized"),u32("stakeAuthorizationType")])},Delegate:{index:2,layout:struct([u32("instruction")])},Split:{index:3,layout:struct([u32("instruction"),ns64("lamports")])},Withdraw:{index:4,layout:struct([u32("instruction"),ns64("lamports")])},Deactivate:{index:5,layout:struct([u32("instruction")])},Merge:{index:7,layout:struct([u32("instruction")])},AuthorizeWithSeed:{index:8,layout:struct([u32("instruction"),publicKey("newAuthorized"),u32("stakeAuthorizationType"),rustString("authoritySeed"),publicKey("authorityOwner")])}});new PublicKey("Stake11111111111111111111111111111111111111");Object.freeze({InitializeAccount:{index:0,layout:struct([u32("instruction"),voteInit()])},Authorize:{index:1,layout:struct([u32("instruction"),publicKey("newAuthorized"),u32("voteAuthorizationType")])},Withdraw:{index:3,layout:struct([u32("instruction"),ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:struct([u32("instruction")])},AuthorizeWithSeed:{index:10,layout:struct([u32("instruction"),voteAuthorizeWithSeedArgs()])}});new PublicKey("Vote111111111111111111111111111111111111111");new PublicKey("Va1idator1nfo111111111111111111111111111111");type({name:string(),website:optional(string()),details:optional(string()),iconUrl:optional(string()),keybaseUsername:optional(string())});new PublicKey("Vote111111111111111111111111111111111111111");struct([publicKey("nodePubkey"),publicKey("authorizedWithdrawer"),u8("commission"),nu64(),seq(struct([nu64("slot"),u32("confirmationCount")]),offset(u32(),-8),"votes"),u8("rootSlotValid"),nu64("rootSlot"),nu64(),seq(struct([nu64("epoch"),publicKey("authorizedVoter")]),offset(u32(),-8),"authorizedVoters"),struct([seq(struct([publicKey("authorizedPubkey"),nu64("epochOfLastAuthorizedSwitch"),nu64("targetEpoch")]),32,"buf"),nu64("idx"),u8("isEmpty")],"priorVoters"),nu64(),seq(struct([nu64("epoch"),nu64("credits"),nu64("prevCredits")]),offset(u32(),-8),"epochCredits"),struct([nu64("slot"),nu64("timestamp")],"lastTimestamp")]);class TurnkeySigner{constructor(br){this.organizationId=br.organizationId,this.client=br.client}async signAllTransactions(br,wr){var Wr,qr,Gr;const Er=new PublicKey(wr);let kr=br.map(Vr=>this.getMessageToSign(Vr).toString("hex"));const Br=(qr=(Wr=(await this.signRawPayloads(kr,wr)).signRawPayloadsResult)==null?void 0:Wr.signatures)==null?void 0:qr.map(Vr=>`${Vr==null?void 0:Vr.r}${Vr==null?void 0:Vr.s}`);for(let Vr in br)(Gr=br[Vr])==null||Gr.addSignature(Er,Buffer$2.from(Br[Vr],"hex"));return br}async addSignature(br,wr){var Wr,qr;const Er=new PublicKey(wr);let kr=this.getMessageToSign(br);const jr=await this.signRawPayload(kr.toString("hex"),wr),Br=`${(Wr=jr.signRawPayloadResult)==null?void 0:Wr.r}${(qr=jr.signRawPayloadResult)==null?void 0:qr.s}`;br.addSignature(Er,Buffer$2.from(Br,"hex"))}async signMessage(br,wr){var kr,jr;const Er=await this.signRawPayload(Buffer$2.from(br).toString("hex"),wr);return Buffer$2.from(`${(kr=Er.signRawPayloadResult)==null?void 0:kr.r}${(jr=Er.signRawPayloadResult)==null?void 0:jr.s}`,"hex")}async signRawPayload(br,wr){const Er=await this.client.signRawPayload({type:"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",organizationId:this.organizationId,timestampMs:String(Date.now()),parameters:{signWith:wr,payload:br,encoding:"PAYLOAD_ENCODING_HEXADECIMAL",hashFunction:"HASH_FUNCTION_NOT_APPLICABLE"}}),{id:kr,status:jr,type:Br,result:Wr}=Er.activity;if(jr!=="ACTIVITY_STATUS_COMPLETED")throw new TurnkeyActivityError({message:`Expected COMPLETED status, got ${jr}`,activityId:kr,activityStatus:jr,activityType:Br});return Wr}async signRawPayloads(br,wr){const Er=await this.client.signRawPayloads({type:"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS",organizationId:this.organizationId,timestampMs:String(Date.now()),parameters:{signWith:wr,payloads:br,encoding:"PAYLOAD_ENCODING_HEXADECIMAL",hashFunction:"HASH_FUNCTION_NOT_APPLICABLE"}}),{id:kr,status:jr,type:Br,result:Wr}=Er.activity;if(jr!=="ACTIVITY_STATUS_COMPLETED")throw new TurnkeyActivityError({message:`Expected COMPLETED status, got ${jr}`,activityId:kr,activityStatus:jr,activityType:Br});return Wr}getMessageToSign(br){let wr;return typeof br.serializeMessage=="function"?wr=br.serializeMessage():wr=Buffer$2.from(br.message.serialize()),wr}}var version$3="3.8.2";function __awaiter$1(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var version$2="3.8.2";function __rest(fr,br){var wr={};for(var Er in fr)Object.prototype.hasOwnProperty.call(fr,Er)&&br.indexOf(Er)<0&&(wr[Er]=fr[Er]);if(fr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var kr=0,Er=Object.getOwnPropertySymbols(fr);kr{var fr,br,wr;return typeof process$1$1<"u"&&define_process_env_default$1&&(wr=(br=(fr=define_process_env_default$1.ICONIC_SPRITE_CDN_URL)!==null&&fr!==void 0?fr:define_process_env_default$1.NEXT_PUBLIC_ICONIC_SPRITE_CDN_URL)!==null&&br!==void 0?br:define_process_env_default$1.REACT_APP_ICONIC_SPRITE_CDN_URLL)!==null&&wr!==void 0?wr:DEFAULT_ICONIC_SPRITE_URL},ICONIC_SPRITE_URL=getIconicSpriteUrl(),createIconic=fr=>{const br=Object.assign(Object.assign({},fr),{function:Er=>{const kr=`${ICONIC_SPRITE_URL}#${br.iconName}`;return reactExports.createElement("img",Object.assign(Object.assign({"data-testid":`iconic-${br.iconName}`},Er),{alt:br.alt,src:kr}))}}),wr=br.function.bind(br);return Object.assign(wr,{iconName:br.iconName,sourcePath:br.sourcePath}),wr};createIconic({alt:"Brave Browser",iconName:"brave",sourcePath:"icons/browsers/brave.svg"});createIconic({alt:"Chrome Browser",iconName:"chrome",sourcePath:"icons/browsers/chrome.svg"});createIconic({alt:"Edge Browser",iconName:"edge",sourcePath:"icons/browsers/edge.svg"});createIconic({alt:"Firefox Browser",iconName:"firefox",sourcePath:"icons/browsers/firefox.svg"});createIconic({alt:"Opera Browser",iconName:"opera",sourcePath:"icons/browsers/opera.svg"});createIconic({alt:"Opera Browser",iconName:"safari",sourcePath:"icons/browsers/safari.svg"});createIconic({alt:"Algorand Chain",iconName:"algorand",sourcePath:"icons/chains/algorand.svg"});createIconic({alt:"Arbitrum Chain",iconName:"arbitrum",sourcePath:"icons/chains/arbitrum.svg"});createIconic({alt:"Aurora Chain",iconName:"aurora",sourcePath:"icons/chains/aurora.svg"});createIconic({alt:"Base Chain",iconName:"base",sourcePath:"icons/chains/base.svg"});createIconic({alt:"Berachain Chain",iconName:"berachain",sourcePath:"icons/chains/berachain.svg"});createIconic({alt:"Bitcoin Chain",iconName:"bitcoin",sourcePath:"icons/chains/bitcoin.svg"});createIconic({alt:"BNB Chain",iconName:"bnb",sourcePath:"icons/chains/bnb.svg"});createIconic({alt:"Cosmos Chain",iconName:"cosmos",sourcePath:"icons/chains/cosmos.svg"});createIconic({alt:"Osmosis Chain",iconName:"osmosis",sourcePath:"icons/chains/osmosis.svg"});createIconic({alt:"Axelar Chain",iconName:"axelar",sourcePath:"icons/chains/axelar.svg"});createIconic({alt:"Ethereum Chain",iconName:"ethereum",sourcePath:"icons/chains/ethereum.svg"});createIconic({alt:"Goerli Chain",iconName:"goerli",sourcePath:"icons/chains/goerli.svg"});createIconic({alt:"zkSync Era Chain",iconName:"zkSync",sourcePath:"icons/chains/zkSync.svg"});createIconic({alt:"Flow Chain",iconName:"flow",sourcePath:"icons/chains/flow.svg"});createIconic({alt:"Gnosis Chain",iconName:"gnosis",sourcePath:"icons/chains/gnosis.svg"});createIconic({alt:"Optimism Chain",iconName:"optimism",sourcePath:"icons/chains/optimism.svg"});createIconic({alt:"Palm Chain",iconName:"palm",sourcePath:"icons/chains/palm.svg"});createIconic({alt:"Polygon Chain",iconName:"polygon",sourcePath:"icons/chains/polygon.svg"});createIconic({alt:"Solana Chain",iconName:"solana",sourcePath:"icons/chains/solana.svg"});createIconic({alt:"Starknet Chain",iconName:"starknet",sourcePath:"icons/chains/starknet.svg"});createIconic({alt:"1inch Wallet",iconName:"1inch.svg",sourcePath:"icons/wallets/1inch.svg"});createIconic({alt:"Argent X Wallet",iconName:"argentx",sourcePath:"icons/wallets/argentx.svg"});createIconic({alt:"Argent Mobile",iconName:"argentmobile",sourcePath:"icons/wallets/argent-mobile.svg"});createIconic({alt:"Argent Web Wallet",iconName:"argentwebwallet",sourcePath:"icons/wallets/argent-web-wallet.svg"});createIconic({alt:"Backpack Wallet",iconName:"backpack",sourcePath:"icons/wallets/backpack.svg"});createIconic({alt:"Binance Wallet",iconName:"binance.svg",sourcePath:"icons/wallets/binance.svg"});createIconic({alt:"BitPay Wallet",iconName:"bitpay.svg",sourcePath:"icons/wallets/bitpay.svg"});createIconic({alt:"Blocto Wallet",iconName:"blocto",sourcePath:"icons/wallets/blocto.svg"});createIconic({alt:"Braavos Wallet",iconName:"braavos",sourcePath:"icons/wallets/braavos.svg"});createIconic({alt:"Coin98 Wallet",iconName:"coin98",sourcePath:"icons/wallets/coin98.svg"});createIconic({alt:"Coinbase Wallet",iconName:"coinbase",sourcePath:"icons/wallets/coinbase.svg"});createIconic({alt:"Crypto Wallet",iconName:"crypto.svg",sourcePath:"icons/wallets/crypto.svg"});createIconic({alt:"Dapper Wallet",iconName:"dapper",sourcePath:"icons/wallets/dapper.svg"});createIconic({alt:"Dawn Wallet",iconName:"dawn",sourcePath:"icons/wallets/dawn.svg"});createIconic({alt:"Default Wallet",iconName:"defaultwallet",sourcePath:"icons/wallets/default.svg"});createIconic({alt:"Dapper Wallet",iconName:"emailsign.svg",sourcePath:"icons/wallets/emailsign.svg"});createIconic({alt:"Sign in with Email",iconName:"signinwithemail",sourcePath:"icons/wallets/signinwithemail.svg"});createIconic({alt:"Exodus Wallet",iconName:"exodus",sourcePath:"icons/wallets/exodus.svg"});createIconic({alt:"Fireblocks Wallet",iconName:"fireblocks.svg",sourcePath:"icons/wallets/fireblocks.svg"});createIconic({alt:"Fortmatic Wallet",iconName:"fortmatic",sourcePath:"icons/wallets/fortmatic.svg"});createIconic({alt:"Frame Wallet",iconName:"frame",sourcePath:"icons/wallets/frame.svg"});createIconic({alt:"Gamestop Wallet",iconName:"gamestop",sourcePath:"icons/wallets/gamestop.svg"});createIconic({alt:"Glow Wallet",iconName:"glow",sourcePath:"icons/wallets/glow.svg"});createIconic({alt:"ImToken Wallet",iconName:"imtoken.svg",sourcePath:"icons/wallets/imtoken.svg"});createIconic({alt:"Injected Wallet",iconName:"injectedwallet",sourcePath:"icons/wallets/injectedwallet.svg"});createIconic({alt:"Keplr Wallet",iconName:"keplr",sourcePath:"icons/wallets/keplr.svg"});createIconic({alt:"Ledger Wallet",iconName:"ledger",sourcePath:"icons/wallets/ledger.svg"});createIconic({alt:"Lilico Wallet",iconName:"lilico",sourcePath:"icons/wallets/lilico.svg"});createIconic({alt:"Linen Wallet",iconName:"linen.svg",sourcePath:"icons/wallets/linen.svg"});createIconic({alt:"Matic Wallet",iconName:"matic",sourcePath:"icons/wallets/matic.svg"});createIconic({alt:"MetaMask Wallet",iconName:"metamask",sourcePath:"icons/wallets/metamask.svg"});createIconic({alt:"Missing Wallet",iconName:"missing",sourcePath:"icons/wallets/missing.svg"});createIconic({alt:"MyAlgo Wallet",iconName:"myalgo",sourcePath:"icons/wallets/myalgo.svg"});createIconic({alt:"Omni Wallet",iconName:"omni",sourcePath:"icons/wallets/omni.svg"});createIconic({alt:"OpeanSea Wallet",iconName:"opeansea",sourcePath:"icons/wallets/opensea.svg"});createIconic({alt:"Pera Wallet",iconName:"pera",sourcePath:"icons/wallets/pera.svg"});createIconic({alt:"Phantom Wallet",iconName:"phantom",sourcePath:"icons/wallets/phantom.svg"});createIconic({alt:"Rabby Wallet",iconName:"rabby",sourcePath:"icons/wallets/rabby.svg"});createIconic({alt:"Rainbow Wallet",iconName:"rainbow",sourcePath:"icons/wallets/rainbow.svg"});createIconic({alt:"Safe Wallet",iconName:"safe",sourcePath:"icons/wallets/safe.svg"});createIconic({alt:"Sequence Wallet",iconName:"sequence",sourcePath:"icons/wallets/sequence.svg"});createIconic({alt:"Solflare Wallet",iconName:"solflare",sourcePath:"icons/wallets/solflare.svg"});createIconic({alt:"Spot Wallet",iconName:"spot",sourcePath:"icons/wallets/spot.svg"});createIconic({alt:"Stroke Wallet",iconName:"stroke",sourcePath:"icons/wallets/stroke.svg"});createIconic({alt:"Taho Wallet",iconName:"tallycash",sourcePath:"icons/wallets/tallycash.svg"});createIconic({alt:"Terra Wallet",iconName:"terra",sourcePath:"icons/wallets/terra.svg"});createIconic({alt:"Torus Wallet",iconName:"torus",sourcePath:"icons/wallets/torus.svg"});createIconic({alt:"Trust Wallet",iconName:"trust",sourcePath:"icons/wallets/trust.svg"});createIconic({alt:"Unstoppable Wallet",iconName:"unstoppable",sourcePath:"icons/wallets/unstoppable.svg"});createIconic({alt:"Venly Wallet",iconName:"venly",sourcePath:"icons/wallets/venly.svg"});createIconic({alt:"Wallet Connect Wallet",iconName:"walletconnect",sourcePath:"icons/wallets/walletconnect.svg"});createIconic({alt:"Magic Link Wallet",iconName:"magiclink",sourcePath:"icons/wallets/magic-link.svg"});createIconic({alt:"Turnkey",iconName:"turnkey",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic({alt:"Zengo Wallet",iconName:"zengo",sourcePath:"icons/wallets/zengo.svg"});createIconic({alt:"Superb Wallet",iconName:"superb",sourcePath:"icons/wallets/superb.svg"});createIconic({alt:"ZeroDev",iconName:"zerodev",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic({alt:"Smart Wallet",iconName:"smartwallet",sourcePath:"icons/wallets/smart-wallet.svg"});createIconic({alt:"Magic Eden",iconName:"magiceden",sourcePath:"icons/wallets/magiceden.svg"});createIconic({alt:"Xverse",iconName:"xverse",sourcePath:"icons/wallets/xverse.svg"});createIconic({alt:"Unisat",iconName:"unisat",sourcePath:"icons/wallets/unisat.svg"});createIconic({alt:"Leather",iconName:"leather",sourcePath:"icons/wallets/leather.svg"});createIconic({alt:"OKX",iconName:"okx",sourcePath:"icons/wallets/okx.svg"});createIconic({alt:"Coinbase WaaS",iconName:"coinbasewaas",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic({alt:"MetaMask Starknet Snap",iconName:"metamaskstarknetsnap",sourcePath:"icons/wallets/metamask-starknet.svg"});createIconic({alt:"Nightly",iconName:"nightly",sourcePath:"icons/wallets/nightly.svg"});createIconic({alt:"OneKey",iconName:"onekey",sourcePath:"icons/wallets/onekey.svg"});createIconic({alt:"Ambire",iconName:"ambire",sourcePath:"icons/wallets/ambire.svg"});createIconic({alt:"Bitget Wallet",iconName:"bitgetwallet",sourcePath:"icons/wallets/bitgetwallet.svg"});createIconic({alt:"Math Wallet",iconName:"coin98",sourcePath:"icons/wallets/coin98.svg"});createIconic({alt:"Clover Wallet",iconName:"clover",sourcePath:"icons/wallets/clover.svg"});createIconic({alt:"Apple",iconName:"apple",sourcePath:"icons/mobile/apple.svg"});createIconic({alt:"Android",iconName:"android",sourcePath:"icons/mobile/android.svg"});createIconic({alt:"Bitbucket",iconName:"bitbucket",sourcePath:"icons/social/bitbucket.svg"});createIconic({alt:"Discord",iconName:"discord",sourcePath:"icons/social/discord.svg"});createIconic({alt:"Facebook",iconName:"facebook",sourcePath:"icons/social/facebook.svg"});createIconic({alt:"Farcaster",iconName:"farcaster",sourcePath:"icons/social/farcaster.svg"});createIconic({alt:"Github",iconName:"github",sourcePath:"icons/social/github.svg"});createIconic({alt:"Github",iconName:"github-dark",sourcePath:"icons/social/github-dark.svg"});createIconic({alt:"Gitlab",iconName:"gitlab",sourcePath:"icons/social/gitlab.svg"});createIconic({alt:"Google",iconName:"google",sourcePath:"icons/social/google.svg"});createIconic({alt:"Helpdesk",iconName:"helpdesk",sourcePath:"icons/social/helpdesk.svg"});createIconic({alt:"Linkedin",iconName:"linkedin",sourcePath:"icons/social/linkedin.svg"});createIconic({alt:"Microsoft",iconName:"microsoft",sourcePath:"icons/social/microsoft.svg"});createIconic({alt:"Slack",iconName:"slack",sourcePath:"icons/social/slack.svg"});createIconic({alt:"Telegram",iconName:"telegram",sourcePath:"icons/social/telegram.svg"});createIconic({alt:"Twitch",iconName:"twitch",sourcePath:"icons/social/twitch.svg"});createIconic({alt:"Twitch",iconName:"twitch-dark",sourcePath:"icons/social/twitch-dark.svg"});createIconic({alt:"Twitter",iconName:"twitter",sourcePath:"icons/social/twitter.svg"});createIconic({alt:"Twitter",iconName:"twitter-dark",sourcePath:"icons/social/twitter-dark.svg"});createIconic({alt:"Apple",iconName:"apple",sourcePath:"icons/social/apple.svg"});createIconic({alt:"Apple",iconName:"apple-dark",sourcePath:"icons/social/apple-dark.svg"});createIconic({alt:"Coinbase",iconName:"coinbasesocial",sourcePath:"icons/social/coinbasesocial.svg"});createIconic({alt:"Coinbase",iconName:"coinbasesocial-dark",sourcePath:"icons/social/coinbasesocial-dark.svg"});createIconic({alt:"Instagram",iconName:"instagram",sourcePath:"icons/social/instagram.svg"});createIconic({alt:"YouTube",iconName:"youtube",sourcePath:"icons/social/youtube.svg"});createIconic({alt:"onePassword",iconName:"one-password",sourcePath:"icons/social/onePassword.svg"});createIconic({alt:"onePassword-dark",iconName:"one-password-dark",sourcePath:"icons/social/onePassword-dark.svg"});createIconic({alt:"epicGames",iconName:"epicgames",sourcePath:"icons/social/epicgames.svg"});createIconic({alt:"epicGames-dark",iconName:"epicgames-dark",sourcePath:"icons/social/epicgames-dark.svg"});createIconic({alt:"spotify",iconName:"spotify",sourcePath:"icons/social/spotify.svg"});createIconic({alt:"spotify-dark",iconName:"spotify-dark",sourcePath:"icons/social/spotify-dark.svg"});createIconic({alt:"steam",iconName:"steam",sourcePath:"icons/social/steam.svg"});createIconic({alt:"steam-dark",iconName:"steam-dark",sourcePath:"icons/social/steam-dark.svg"});createIconic({alt:"tiktok",iconName:"tiktok",sourcePath:"icons/social/tiktok.svg"});createIconic({alt:"tiktok-dark",iconName:"tiktok-dark",sourcePath:"icons/social/tiktok-dark.svg"});createIconic({alt:"line",iconName:"line",sourcePath:"icons/social/line.svg"});createIconic({alt:"Captcha Wave",iconName:"captcha-wave",sourcePath:"icons/misc/captcha-wave.svg"});createIconic({alt:"User Profile",iconName:"user-profile",sourcePath:"icons/misc/user-profile.svg"});createIconic({alt:"Arrow Send",iconName:"arrow-send",sourcePath:"icons/misc/arrow-send.svg"});typeof SuppressedError=="function"&&SuppressedError;new Logger$1("iconic");assertPackageVersion("@dynamic-labs/iconic",version);`${getIconicSpriteUrl()}`;new Logger$1("WalletBook");typeof SuppressedError=="function"&&SuppressedError;const walletConnectSourceValueSchema=z$6.object({app:z$6.object({android:z$6.string().nullable(),browser:z$6.string().nullable(),chrome:z$6.string().nullable(),edge:z$6.string().nullable(),firefox:z$6.string().nullable(),ios:z$6.string().nullable(),linux:z$6.string().nullable(),mac:z$6.string().nullable(),opera:z$6.string().nullable(),safari:z$6.string().nullable(),windows:z$6.string().nullable()}),app_type:z$6.string(),category:z$6.string().nullable(),chains:z$6.array(z$6.string()),description:z$6.string().nullable(),desktop:z$6.object({native:z$6.string().nullable(),universal:z$6.string().nullable()}),homepage:z$6.string(),id:z$6.string(),image_id:z$6.string(),image_url:z$6.object({lg:z$6.string(),md:z$6.string(),sm:z$6.string()}),injected:z$6.array(z$6.object({injected_id:z$6.string(),namespace:z$6.string()})).nullable(),metadata:z$6.object({colors:z$6.object({primary:z$6.string().nullable(),secondary:z$6.string().nullable()}),shortName:z$6.string().nullable()}),mobile:z$6.object({native:z$6.string().nullable(),universal:z$6.string().nullable()}),name:z$6.string(),rdns:z$6.string().nullable(),sdks:z$6.array(z$6.string()),slug:z$6.string(),supported_standards:z$6.array(z$6.object({id:z$6.string(),standard_id:z$6.number(),standard_prefix:z$6.string(),title:z$6.string(),url:z$6.string()})).optional(),updatedAt:z$6.string(),versions:z$6.array(z$6.string())}).strict();z$6.record(z$6.string(),walletConnectSourceValueSchema);const nonEmptyString=z$6.preprocess(fr=>fr||void 0,z$6.string().optional()),transformChromeExtensionId=fr=>{if(fr!=null&&fr.match(/^[a-z]{32}$/))return fr;if(fr!=null&&fr.includes("chrome.google.com/webstore/detail/"))try{return new URL(fr).pathname.split("/").at(-1)}catch{}},transformEdgeExtensionId=fr=>{if(fr!=null&&fr.match(/^[a-z]{32}$/))return fr;if(fr!=null&&fr.includes("microsoftedge.microsoft.com/addons/detail/"))try{return new URL(fr).pathname.split("/").at(-1)}catch{}},transformFirefoxExtensionId=fr=>{if(!(fr!=null&&fr.match(/^https?:\/\//)))return fr;if(fr!=null&&fr.includes("addons.mozilla.org"))try{return new URL(fr).pathname.replace(/\/$/,"").split("/").at(-1)}catch{}},idRegex=/^id[0-9]{1,36}$/,transformIosId=fr=>{if(fr!=null&&fr.match(idRegex))return fr;if(fr!=null&&fr.match(/^https:\/\/[a-zA-Z0-9-]+\.apple\.com/))try{const wr=new URL(fr).pathname.replace(/\/$/,"").split("/").at(-1);if(wr!=null&&wr.match(idRegex))return wr}catch{}},transformAndroidId=fr=>{if(!(fr!=null&&fr.match(/^https?:\/\//)))return fr;if(fr)try{const wr=new URL(fr).searchParams.get("id");if(wr)return wr}catch{}},nonEmptyStringArray=z$6.preprocess(fr=>Array.isArray(fr)&&fr.length>0?fr:void 0,z$6.array(z$6.string()).optional()),filterEmptyObject=fr=>fr&&Object.values(fr).some(br=>!!br)?fr:void 0,injectedConfigSchema=z$6.object({chain:z$6.string(),extensionLocators:z$6.array(z$6.object({flag:z$6.string(),value:z$6.boolean().optional().default(!0)})),providerInterface:z$6.string().optional(),walletStandard:z$6.object({features:z$6.array(z$6.string()),name:z$6.string(),providerId:z$6.string().optional()}).optional(),walletStandardLocators:z$6.array(z$6.object({locator:z$6.string(),name:z$6.string()})).optional(),windowLocations:z$6.array(z$6.string()).optional().refine(fr=>!fr||!fr.some(br=>["ethereum","ethereum.providers"].includes(br)),{message:"windowLocations cannot include ethereum or ethereum.providers as they are included by default",path:["config"]})}),brandSchema=z$6.object({alt:nonEmptyString,primaryColor:nonEmptyString,spriteId:nonEmptyString}),walletSchema=z$6.preprocess(fr=>fr,z$6.object({brand:brandSchema.optional(),chainGroup:z$6.string().optional(),chains:z$6.array(z$6.string()).optional(),desktop:z$6.object({chromeId:nonEmptyString.transform(transformChromeExtensionId),edgeId:nonEmptyString.transform(transformEdgeExtensionId),firefoxId:nonEmptyString.transform(transformFirefoxExtensionId),native:nonEmptyString,operaId:nonEmptyString,safariId:nonEmptyString,universal:nonEmptyString}).optional().transform(filterEmptyObject),eip6963Config:z$6.object({rdns:z$6.string()}).optional(),filterFromWalletConnect:z$6.boolean().optional(),group:z$6.string().optional(),hardwareWallets:z$6.array(z$6.string()).optional(),injectedConfig:z$6.array(injectedConfigSchema).optional(),mobile:z$6.object({android:stringType().nullish(),androidId:nonEmptyString.transform(transformAndroidId),inAppBrowser:stringType().nullish(),ios:stringType().nullish(),iosId:nonEmptyString.transform(transformIosId),native:nonEmptyString,universal:nonEmptyString}).optional().transform(filterEmptyObject),mobileExperience:z$6.enum(["in-app-browser","redirect"]).optional(),name:z$6.string(),shortName:nonEmptyString,showOnlyIfInstalled:z$6.boolean().optional(),switchNetworkOnlyFromWallet:z$6.boolean().optional(),walletConnect:z$6.object({sdks:nonEmptyStringArray}).optional().transform(filterEmptyObject),walletGroup:z$6.string().optional(),walletLimitations:z$6.object({browserExtension:z$6.object({unsupportedEvents:z$6.array(z$6.string()).optional(),unsupportedMethods:z$6.array(z$6.string()).optional()}).optional(),mobile:z$6.object({unsupportedEvents:z$6.array(z$6.string()).optional(),unsupportedMethods:z$6.array(z$6.string()).optional()}).optional()}).optional()})).transform(fr=>{var br,wr,Er,kr,jr,Br;return fr.group&&(fr.chainGroup=fr.group),(!((br=fr.mobile)===null||br===void 0)&&br.iosId||((wr=fr.mobile)===null||wr===void 0?void 0:wr.ios)===null)&&((Er=fr.mobile)===null||Er===void 0||delete Er.ios),(!((kr=fr.mobile)===null||kr===void 0)&&kr.androidId||((jr=fr.mobile)===null||jr===void 0?void 0:jr.android)===null)&&((Br=fr.mobile)===null||Br===void 0||delete Br.android),fr}),WalletOverrideEntrySchema=z$6.object({brand:brandSchema.optional(),name:nonEmptyString}),walletGroupSchema=z$6.object({brand:z$6.object({alt:nonEmptyString,primaryColor:nonEmptyString,spriteId:nonEmptyString}).optional(),key:z$6.string(),name:z$6.string(),walletOverrides:z$6.record(WalletOverrideEntrySchema).optional()});z$6.record(z$6.string(),walletSchema);z$6.preprocess(fr=>fr,z$6.object({groups:z$6.record(z$6.string(),walletGroupSchema),wallets:z$6.record(z$6.string(),walletSchema)}));z$6.record(z$6.string(),walletGroupSchema);assertPackageVersion("@dynamic-labs/wallet-book",version$1);const logger$1=new Logger$1("WalletConnector"),shouldLowercaseAddress=fr=>["eip155","flow","evm","eth","avax","matic"].includes(fr.toLowerCase()),normalizeAddress=(fr,br)=>(fr.startsWith("0x")&&(fr=fr.slice(2)),shouldLowercaseAddress(br)?fr.toLowerCase():fr),isSameAddress=(fr,br,wr)=>normalizeAddress(fr,wr)===normalizeAddress(br,wr);new EventEmitter$2;class Wallet extends BaseWallet{constructor(br){var{connector:wr}=br,Er=__rest(br,["connector"]);super(Er),this._connector=wr}get connector(){return this._connector}getBalance(){return __awaiter(this,void 0,void 0,function*(){return this._connector.getBalance(this.address)})}getNameService(){return __awaiter(this,void 0,void 0,function*(){return this._connector.getNameService(this.address)})}getNetwork(){return __awaiter(this,void 0,void 0,function*(){return this._connector.getNetwork()})}isConnected(){return __awaiter(this,void 0,void 0,function*(){try{return(yield this._connector.getConnectedAccounts()).map(wr=>normalizeAddress(wr,this.chain)).includes(normalizeAddress(this.address,this.chain))}catch(br){return logger$1.error("[Wallet] isConnected - Error detecting if wallet is connected",br),!1}})}proveOwnership(br){return __awaiter(this,void 0,void 0,function*(){return this._connector.proveOwnership(this.address,br)})}signMessage(br){return __awaiter(this,void 0,void 0,function*(){return yield this.sync(),this._connector.signMessage(br,this.address)})}switchNetwork(br){return __awaiter(this,void 0,void 0,function*(){return this._connector.switchNetwork({networkChainId:br})})}sync(){return __awaiter(this,void 0,void 0,function*(){return this._connector.validateActiveWallet(this.address)})}}assertPackageVersion("@dynamic-labs/wallet-connector-core",version$2);class SolanaWallet extends Wallet{getConnection(){return __awaiter$1(this,void 0,void 0,function*(){return this._connector.getWalletClient()})}getSigner(){return __awaiter$1(this,void 0,void 0,function*(){const br=yield this._connector.getSigner();if(!br)throw new Error("unable to retrieve Solana signer");try{return cloneObjectWithOverrides(br,{signAllTransactions:wr=>__awaiter$1(this,void 0,void 0,function*(){return yield this.sync(),br.signAllTransactions(wr)}),signAndSendTransaction:(wr,...Er)=>__awaiter$1(this,void 0,void 0,function*(){return yield this.sync(),br.signAndSendTransaction(wr,...Er)}),signMessage:(wr,...Er)=>__awaiter$1(this,void 0,void 0,function*(){return yield this.sync(),br.signMessage(wr,...Er)}),signTransaction:wr=>__awaiter$1(this,void 0,void 0,function*(){return yield this.sync(),br.signTransaction(wr)})})}catch(wr){return logger$1.warn(`Failed to add logic to auto-sync the wallet. Signer might be out of sync for wallet: ${this._connector.name} (${this.address})`,wr),br}})}}const SOLANA_GENESIS_HASH="genesis-hash",getGenesisHashLSKey=fr=>`${fr}_${SOLANA_GENESIS_HASH}`;new PublicKey$2("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");ChainRpcProviders.getSolanaProviderByChainId=(fr,br)=>{var wr;return(wr=fr.solana)===null||wr===void 0?void 0:wr.find(kr=>kr.chainId===br)};ChainRpcProviders.registerSolanaProviders=fr=>{ChainRpcProviders.registerChainProviders(ProviderChain.SOLANA,br=>{const wr={};return br!=null&&br.solana&&(wr.solana=br.solana.map(Er=>{var kr;const jr=((kr=Er.privateCustomerRpcUrls)===null||kr===void 0?void 0:kr[0])||Er.rpcUrls[0],Br=new Connection(jr,fr);return{chainId:Er.chainId.toString(),chainName:Er.name,provider:Br}})),wr.solana})};const isTxAlreadySigned=fr=>{let br=!1;return"version"in fr?br=fr.signatures.some(wr=>!wr.every(Er=>Er===0)):br=fr.signatures.some(wr=>wr.signature),br},LAMPORTS_PER_SOL=1e9;class SolanaUiTransaction{constructor({onSubmit:br,from:wr,connection:Er,multipleTransactions:kr}){this.chain="SOL",this.data=void 0,this.fee={gas:void 0},this.formatNonNativeToken=(jr,Br)=>(Number(jr)/Number(Math.pow(10,Br))).toString(),this.from=wr,this.onSubmit=br,this.connection=Er,this.multipleTransactions=kr}fetchFee(){return __awaiter$1(this,void 0,void 0,function*(){if(this.fee.gas)return;let br=this.multipleTransactions;if(!br){const Br=yield this.createTransactionSafe();if(!Br)return;br=Br instanceof Array?Br:[Br]}const{blockhash:wr}=yield this.connection.getLatestBlockhash(),Er=yield Promise.all(br.map(Br=>__awaiter$1(this,void 0,void 0,function*(){return"version"in Br?((yield isTxAlreadySigned(Br))||(Br.message.recentBlockhash=wr),Br.message):((yield isTxAlreadySigned(Br))||(Br.recentBlockhash=wr),Br.compileMessage())})));if(Er.some(Br=>!Br))throw new Error("Invalid transaction");const kr=Br=>__awaiter$1(this,void 0,void 0,function*(){let Wr=yield this.connection.getFeeForMessage(Br),qr=0;for(;Wr.value===null&&qr<5;)Wr=yield this.connection.getFeeForMessage(Br),qr++;return Wr.value?BigInt(Wr.value):BigInt(0)}),jr=yield Promise.all(Er.map(Br=>kr(Br)));this.fee.gas=jr.reduce((Br,Wr)=>Br+Wr,BigInt(0)),this.fee.gas===BigInt(0)&&(this.fee.gas=void 0)})}isGasSponsored(){var br;return!((br=this.multipleTransactions)===null||br===void 0)&&br.length?this.multipleTransactions.every(wr=>{var Er;return"version"in wr?this.from!==wr.message.staticAccountKeys[0].toBase58():"feePayer"in wr?this.from!==((Er=wr.feePayer)===null||Er===void 0?void 0:Er.toBase58()):!1}):!1}parse(br){const wr=parseFloat(br),Er=Math.round(wr*LAMPORTS_PER_SOL);return BigInt(Er)}parseNonNativeToken(br,wr){return BigInt(Math.floor(Number(br)*Math.pow(10,wr)))}format(br,{precision:wr}={}){const kr=(Number(br)/LAMPORTS_PER_SOL).toLocaleString("fullwide",{maximumFractionDigits:20,minimumFractionDigits:0,useGrouping:!1});return formatNumberText(kr,{precision:wr})}submit(){return __awaiter$1(this,void 0,void 0,function*(){if(this.multipleTransactions)return this.onSubmit();const br=yield this.createTransaction();return this.onSubmit(br)})}getBalance(){return __awaiter$1(this,void 0,void 0,function*(){const br=new PublicKey$2(this.from),wr=yield this.connection.getBalance(br);return BigInt(wr)})}validateAddressFormat(br){return br==="dyn_send_transaction.multiple_recipients"?!0:/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(br)}createTransaction(){return __awaiter$1(this,void 0,void 0,function*(){var br;const{value:wr,to:Er,nonNativeAddress:kr,nonNativeValue:jr}=this;if(!Er)throw new Error("Destination is required");if(this.multipleTransactions)return this.multipleTransactions;const Br=new Transaction,Wr=new PublicKey$2(this.from),qr=new PublicKey$2(Er);if(kr&&jr){const Vr=new PublicKey$2(kr),Zr=jr,Jr=(br=(yield this.connection.getTokenAccountsByOwner(Wr,{mint:Vr})).value[0])===null||br===void 0?void 0:br.pubkey;if(!Jr)throw new Error("Source token account not found");let Qr;try{Qr=yield getAssociatedTokenAddress(Vr,qr),yield this.connection.getTokenAccountBalance(Qr)}catch{Qr=yield getAssociatedTokenAddress(Vr,qr),Br.add(createAssociatedTokenAccountInstruction(Wr,Qr,qr,Vr))}Br.add(createTransferInstruction(Jr,Qr,Wr,Zr))}else{const Vr=wr??BigInt(0);Br.add(SystemProgram.transfer({fromPubkey:Wr,lamports:Vr,toPubkey:qr}))}const{blockhash:Gr}=yield this.connection.getLatestBlockhash();return Br.feePayer=new PublicKey$2(this.from),Br.recentBlockhash=Gr,Br})}createTransactionSafe(){return __awaiter$1(this,void 0,void 0,function*(){try{return yield this.createTransaction()}catch{return}})}}assertPackageVersion("@dynamic-labs/solana-core",version$3);const createSolanaConnection=(fr,br)=>{if(!fr)throw new Error("rpcUrl is required");return new Connection(fr,br)},logger=new Logger$1("DynamicSDK"),AUTH_MIN_TOKEN="dynamic_min_authentication_token",AUTH_MIN_TOKEN_DEMO="dynamic_min_authentication_token_demo",isCookieEnabled=()=>{var fr,br,wr,Er;let kr=(fr=StorageService.getItem("dynamic_store"))!==null&&fr!==void 0?fr:StorageService.getItem("dynamic_store_demo");if(kr=(br=kr==null?void 0:kr.settings)===null||br===void 0?void 0:br.security,!kr)return!1;const jr=(((wr=kr.auth)===null||wr===void 0?void 0:wr.storage)||[]).includes(AuthStorageEnum.Cookie),Br=!!(!((Er=kr.externalAuth)===null||Er===void 0)&&Er.cookieName);return jr||Br},parseToken=fr=>{var br;if(!fr)return;const wr=(br=fr.split(".")[1])===null||br===void 0?void 0:br.replace(/-/g,"+").replace(/_/g,"/"),Er=wr&&decodeURIComponent(atob(wr).split("").map(kr=>`%${`00${kr.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(Er)},decodeMinJwt=fr=>{try{const br=parseToken(fr);return br?MinifiedDynamicJwtFromJSON(br):void 0}catch(br){logger.error(br);return}},getMinAuthToken=()=>{var fr;if(typeof window>"u")return;const br=(fr=StorageService.getItem(AUTH_MIN_TOKEN,{priority:["secureStorage","localStorage"]}))!==null&&fr!==void 0?fr:StorageService.getItem(AUTH_MIN_TOKEN_DEMO,{priority:["secureStorage","localStorage"]});if(!(!br||isMinAuthTokenExpired(br)))return br},isMinAuthTokenExpired=fr=>{const br=decodeMinJwt(fr);return isTokenExpired(br)},isTokenExpired=fr=>{if(!fr||!fr.exp)return!0;const br=new Date(fr.exp*1e3).getTime();return new Date().getTime()>=br};class ApiEndpoint{}ApiEndpoint.getBaseUrl=()=>{if(!ApiEndpoint.__defined__)throw new Error("ApiEndpoint Base URL has not been initialized");return ApiEndpoint.__baseUrl__};ApiEndpoint.setBaseUrl=fr=>{if(!ApiEndpoint.__defined__)fr?ApiEndpoint.__baseUrl__=fr:ApiEndpoint.__baseUrl__=new Configuration().basePath,ApiEndpoint.__defined__=!0;else{if(!fr&&ApiEndpoint.__defined__)return;if(ApiEndpoint.__baseUrl__!==fr)throw new Error(`ApiEndpoint baseUrl is already set to ${ApiEndpoint.__baseUrl__}, cannot change it to ${fr}`)}Object.freeze(ApiEndpoint)};const VERSION=version$4,API_VERSION=dependencies["@dynamic-labs/sdk-api-core"];var define_process_env_default={};const sdkApi=()=>{const fr=define_process_env_default.API_BASE_URL||define_process_env_default.NX_API_BASE_URL||"https://app.dynamic.xyz/api/v0";ApiEndpoint.setBaseUrl(fr);const br={basePath:ApiEndpoint.getBaseUrl(),headers:{"Content-Type":"application/json"}},wr=getMinAuthToken();wr&&(br.headers.Authorization=`Bearer ${wr}`);const Er=isCookieEnabled()?"include":void 0;return br.headers["x-dyn-version"]=`WalletKit/${VERSION}`,br.headers["x-dyn-api-version"]=`API/${API_VERSION}`,new SDKApi(new Configuration(Object.assign(Object.assign({},br),{credentials:Er,fetchApi:FetchService.fetch})))},serializeTransaction=fr=>fr instanceof VersionedTransaction?Buffer$2.from(fr.serialize()).toString("base64"):Buffer$2.from(fr.serialize({verifySignatures:!1})).toString("base64"),deserializeTransaction=fr=>{const br=Buffer$2.from(fr,"base64");return VersionedTransaction.deserialize(br)},optimizeSolanaTransaction=(fr,br,wr)=>__awaiter$2(void 0,void 0,void 0,function*(){const Er=serializeTransaction(br),kr={environmentId:fr,solanaTransactionOptimizationRequest:{address:wr,transaction:Er}},jr=yield sdkApi().optimizeTransaction(kr);return deserializeTransaction(jr.transaction)});class TurnkeySolanaSigner{constructor({walletConnector:br}){this.isConnected=!0,this.providers=[this],this.walletConnector=br,this.turnkeyAddress=this.walletConnector.turnkeyAddress,this.publicKey=this.turnkeyAddress?new PublicKey$2(this.turnkeyAddress):void 0}signMessage(br){return __awaiter$2(this,void 0,void 0,function*(){return{signature:yield this.walletConnector.signUint8ArrayMessage(br)}})}signTransaction(br){return __awaiter$2(this,void 0,void 0,function*(){return this.walletConnector.signTransaction(br)})}signAllTransactions(br){return __awaiter$2(this,void 0,void 0,function*(){return this.walletConnector.signAllTransactions(br)})}signAndSendTransaction(br,wr){return __awaiter$2(this,void 0,void 0,function*(){return{signature:yield this.walletConnector.signAndSendTransaction(br,wr)}})}connect(br){return __awaiter$2(this,void 0,void 0,function*(){return{address:this.turnkeyAddress,publicKey:this.publicKey}})}disconnect(){return __awaiter$2(this,void 0,void 0,function*(){})}}class TurnkeySolanaWalletConnector extends TurnkeyWalletConnectorBase{constructor(br,wr){var Er;super(br,wr),this.ChainWallet=SolanaWallet,this.connectedChain="SOL",this.supportedChains=["SOL"],this.verifiedCredentialChain="solana",this.getEnvId=()=>{const kr=localStorage.getItem("dynamic_nonce");if(kr){const Br=JSON.parse(kr);if(Br&&Br.environmentId)return Br.environmentId}const jr=localStorage.getItem("dynamic_nonce_demo");if(jr){const Br=JSON.parse(jr);if(Br&&Br.environmentId)return Br.environmentId}throw new Error("Failed to get environment id")},this.stampCreateWalletAccountRequest=kr=>__awaiter$2(this,[kr],void 0,function*({request:jr}){return yield this.createOrRestoreSession(),this.getTurnkeyClient().stampCreateWalletAccounts(jr)}),this.solNetworks=wr.solNetworks,this.walletUiUtils=wr.walletUiUtils,this._turnkeyAccount=void 0,this._connectionClient=void 0,this.chainRpcProviders=wr.chainRpcProviders,this.connectionConfig=wr.connectionConfig,(Er=this.chainRpcProviders)===null||Er===void 0||Er.registerSolanaProviders(this.connectionConfig),this.__turnkeyClient=this.getTurnkeyClient()}getRpcUrl(){var br;const[wr]=this.solNetworks;if(!wr)throw new DynamicError("No enabled networks");return((br=wr.privateCustomerRpcUrls)===null||br===void 0?void 0:br[0])||wr.rpcUrls[0]}getConnection(br){if(!this._connectionClient){const wr=this.getRpcUrl();if(!wr)throw new DynamicError("No rpcUrl");const Er=typeof br=="string"?Object.assign(Object.assign({},this.connectionConfig),{commitment:br}):Object.assign(Object.assign({},this.connectionConfig),br);this._connectionClient=createSolanaConnection(wr,Er)}return this._connectionClient}getWalletClient(){return this.getConnection()}getNetwork(){return __awaiter$2(this,void 0,void 0,function*(){const br=this.getConnection();let wr=localStorage.getItem(getGenesisHashLSKey(br.rpcEndpoint));return wr||(wr=yield br.getGenesisHash(),localStorage.setItem(getGenesisHashLSKey(br.rpcEndpoint),wr)),wr=wr.substring(0,32),wr==="5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"?"mainnet":wr==="EtWTRABZaYq6iMfeYKouRu166VU2xqa1"?"devnet":"testnet"})}getPublicClient(){return __awaiter$2(this,void 0,void 0,function*(){var br;if(this.solNetworks.length===0)return;const wr={cosmos:[],evm:void 0,solana:this.solNetworks,starknet:void 0};if(!this.chainRpcProviders)return;const Er=this.chainRpcProviders.getProviders(wr);return(br=this.chainRpcProviders.getSolanaProviderByChainId(Er,"101"))===null||br===void 0?void 0:br.provider})}supportsNetworkSwitching(){return!1}setVerifiedCredentials(br){const wr=findTurnkeyVerifiedCredentials(br,ProviderChain.SOLANA),[Er]=wr;JSON.stringify(this.verifiedCredentials)!==JSON.stringify(wr)&&(this.verifiedCredential=Er,this.verifiedCredentials=wr,this.refreshTurnkeyAccount())}validateActiveWallet(br){return __awaiter$2(this,void 0,void 0,function*(){var wr,Er;const kr=((wr=this.verifiedCredential)===null||wr===void 0?void 0:wr.address)||"";if(!isSameAddress(kr,br,this.connectedChain)){const Br=(Er=this.verifiedCredentials)===null||Er===void 0?void 0:Er.find(Wr=>(Wr==null?void 0:Wr.address)===br);if(!Br)throw new DynamicError("Account not found");this.verifiedCredential=Br,this.refreshTurnkeyAccount()}})}getAccount(){return this.turnkeyAddress}endSession(){return __awaiter$2(this,void 0,void 0,function*(){localStorage.removeItem(getGenesisHashLSKey(this.getRpcUrl()))})}refreshTurnkeyAccount(){return __awaiter$2(this,void 0,void 0,function*(){return this._turnkeyAccount=void 0,this.getTurnkeyAccount()})}getTurnkeyClient(){var br;let wr=getTLD();wr||(wr=PlatformService.getHostname());const Er=PasskeyService.createWebauthnStamper({rpId:wr}),kr=TurnkeyWalletConnectorBase==null?void 0:TurnkeyWalletConnectorBase.apiKeyStamper,jr=kr??Er;return this.__turnkeyClient=(br=this.getAuthenticatorHandler().client)!==null&&br!==void 0?br:new TurnkeyClient({baseUrl:TURNKEY_API_BASE_URL},jr),this.__turnkeyClient}createTurnkeyAccount(br){return __awaiter$2(this,arguments,void 0,function*({organizationId:wr}){const Er=this.getTurnkeyClient();return new TurnkeySigner({client:Er,organizationId:wr})})}getTurnkeyAccount(){return __awaiter$2(this,void 0,void 0,function*(){var br,wr,Er,kr;if(this._turnkeyAccount&&(this.getAuthenticatorHandler().recoveryType==="passkey"&&((br=this.__turnkeyClient)===null||br===void 0?void 0:br.stamper)instanceof WebauthnStamper||this.getAuthenticatorHandler().recoveryType==="email"&&((wr=this.__turnkeyClient)===null||wr===void 0?void 0:wr.stamper)instanceof IframeStamper)&&this.__turnkeyClient===this.getAuthenticatorHandler().client)return this._turnkeyAccount;const{turnkeySubOrganizationId:jr}=(Er=this.walletProperties)!==null&&Er!==void 0?Er:{},{address:Br}=(kr=this.verifiedCredential)!==null&&kr!==void 0?kr:{};if(!(!jr||!Br))return this._turnkeyAccount=yield this.createTurnkeyAccount({organizationId:jr}),this.setLoggerMetadata(),this._turnkeyAccount})}getSigner(){return __awaiter$2(this,void 0,void 0,function*(){return new TurnkeySolanaSigner({walletConnector:this})})}getBalance(br){return __awaiter$2(this,void 0,void 0,function*(){const wr=this.getConnection(),Er=new PublicKey$2(br),kr=yield wr.getBalance(Er);return this.lamportsToSol(kr).toString()})}signUint8ArrayMessage(br){return __awaiter$2(this,void 0,void 0,function*(){if(!this.turnkeyAddress)throw new DynamicError("No turnkey account");const wr=this.turnkeyAddress;let Er;if(yield this.createOrRestoreSession(),yield this.walletUiUtils.signMessage({handler:()=>__awaiter$2(this,void 0,void 0,function*(){let kr=yield this.getTurnkeyAccount();try{Er=yield kr==null?void 0:kr.signMessage(br,wr)}catch{yield this.removeSessionKeys(),yield this.createOrRestoreSession({ignoreRestore:!0}),kr=yield this.getTurnkeyAccount(),Er=yield kr==null?void 0:kr.signMessage(br,wr)}return bufferToBase64(Er||Buffer$2.from([]))}),message:new TextDecoder().decode(br)}),!Er)throw new Error("Failed to sign message");return Er})}signMessage(br){return __awaiter$2(this,void 0,void 0,function*(){const Er=new TextEncoder().encode(br),kr=yield this.signUint8ArrayMessage(Er);return bufferToBase64(kr)})}internalSignTransaction(br){return __awaiter$2(this,void 0,void 0,function*(){yield this.createOrRestoreSession();let wr=yield this.getTurnkeyAccount();const Er=this.turnkeyAddress;if(!wr||!Er)throw new Error("No turnkey account");try{yield wr.addSignature(br,Er)}catch(kr){if(TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS.some(jr=>kr.message.includes(jr)))yield this.removeSessionKeys(),yield this.createOrRestoreSession({ignoreRestore:!0}),wr=yield this.getTurnkeyAccount(),yield wr.addSignature(br,Er);else throw logger$4.error("[TK] failed to perform SignTransaction activity",kr),kr}return br})}signTransaction(br){return __awaiter$2(this,void 0,void 0,function*(){if(!this.turnkeyAddress)throw new DynamicError("No turnkey account");const wr=new SolanaUiTransaction({connection:this.getConnection("confirmed"),from:this.turnkeyAddress,multipleTransactions:[br],onSubmit:()=>__awaiter$2(this,void 0,void 0,function*(){return this.internalSignTransaction(br)})});return this.walletUiUtils.signTransaction(this,wr)})}createUiTransaction(br){return __awaiter$2(this,void 0,void 0,function*(){return yield this.validateActiveWallet(br),new SolanaUiTransaction({connection:this.getConnection("confirmed"),from:br,onSubmit:Er=>__awaiter$2(this,void 0,void 0,function*(){if(Er)return this.internalSignAndSendTransaction(Er)})})})}internalSignAllTransactions(br){return __awaiter$2(this,void 0,void 0,function*(){yield this.createOrRestoreSession();let wr=yield this.getTurnkeyAccount();const Er=this.turnkeyAddress;if(!wr||!Er)throw new Error("No turnkey account");try{return yield wr.signAllTransactions(br,Er)}catch(kr){if(TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS.some(jr=>kr.message.includes(jr)))return yield this.removeSessionKeys(),yield this.createOrRestoreSession({ignoreRestore:!0}),wr=yield this.getTurnkeyAccount(),yield wr.signAllTransactions(br,Er);throw logger$4.error("[TK] failed to perform SignAllTransactions activity",kr),kr}})}signAllTransactions(br){return __awaiter$2(this,void 0,void 0,function*(){if(!this.turnkeyAddress)throw new DynamicError("No turnkey account");const wr=new SolanaUiTransaction({connection:this.getConnection("confirmed"),from:this.turnkeyAddress,multipleTransactions:br,onSubmit:()=>__awaiter$2(this,void 0,void 0,function*(){return this.internalSignAllTransactions(br)})});return this.walletUiUtils.signTransaction(this,wr)})}internalSignAndSendTransaction(br,wr){return __awaiter$2(this,void 0,void 0,function*(){var Er,kr;if(!this.turnkeyAddress)throw new DynamicError("Solana wallet not found");const jr=this.getConnection((kr=(Er=this.connectionConfig)===null||Er===void 0?void 0:Er.commitment)!==null&&kr!==void 0?kr:"confirmed"),Br=yield this.internalSignTransaction(br),Wr=yield jr.sendRawTransaction(Br.serialize(),wr);return new Promise((qr,Gr)=>{const Vr=setTimeout(()=>{Gr(new DynamicError("Transaction timed out"))},6e4);jr.onSignature(Wr,Zr=>{clearTimeout(Vr),Zr.err?Gr(new DynamicError("Transaction failed")):qr(Wr)},"confirmed")})})}signAndSendTransaction(br,wr){return __awaiter$2(this,void 0,void 0,function*(){if(!this.turnkeyAddress)throw new DynamicError("Solana wallet not found");const Er=yield this.optimizeTransaction(br),kr=new SolanaUiTransaction({connection:this.getConnection("confirmed"),from:this.turnkeyAddress,multipleTransactions:[Er],onSubmit:()=>__awaiter$2(this,void 0,void 0,function*(){return this.internalSignAndSendTransaction(Er,wr)})});return this.walletUiUtils.sendTransaction(this,kr)})}sendTransaction(br,wr){return __awaiter$2(this,arguments,void 0,function*(Er,kr,jr={}){var Br;if(!this.turnkeyAddress)throw new DynamicError("Solana wallet not found");if(!Er||!kr)throw new DynamicError("Transaction and connection are required");const{signers:Wr}=jr,qr=__rest$1(jr,["signers"]),Gr=yield kr.getLatestBlockhash({commitment:jr.preflightCommitment,minContextSlot:jr.minContextSlot});"version"in Er?Wr!=null&&Wr.length&&Er.sign(Wr):(Er.feePayer=Er.feePayer||new PublicKey$2(this.turnkeyAddress),Er.recentBlockhash=Er.recentBlockhash||Gr.blockhash,Wr!=null&&Wr.length&&Er.partialSign(...Wr)),qr.preflightCommitment=qr.preflightCommitment||kr.commitment;const Vr=yield kr.sendRawTransaction(Er.serialize(),jr),Zr={blockhash:Gr.blockhash,lastValidBlockHeight:Gr.lastValidBlockHeight,signature:Vr},Jr=yield kr==null?void 0:kr.confirmTransaction(Zr);return!((Br=Jr==null?void 0:Jr.value)===null||Br===void 0)&&Br.err?JSON.stringify(Jr.value.err):Vr})}lamportsToSol(br){return br/LAMPORTS_PER_SOL$2}optimizeTransaction(br){return __awaiter$2(this,void 0,void 0,function*(){var wr;let Er=br;try{(yield this.getNetwork())==="mainnet"&&!isTxAlreadySigned(br)&&(Er=yield optimizeSolanaTransaction(this.getEnvId(),br,(wr=this.turnkeyAddress)!==null&&wr!==void 0?wr:""))}catch(kr){logger$4.warn("Failed to optimize transaction",kr)}return Er})}}const TurnkeySolanaWalletConnectors=fr=>{var br;return!((br=fr.apiProviders)===null||br===void 0)&&br.turnkey?[class extends TurnkeySolanaWalletConnector{constructor(wr){super(TurnkeyWalletConnectorInfo.TurnkeyHD,Object.assign(Object.assign({},fr),wr))}}]:[]};assertPackageVersion("@dynamic-labs/embedded-wallet-solana",version$4);var naclFast={exports:{}};(function(fr){(function(br){var wr=function(So){var Co,Ao=new Float64Array(16);if(So)for(Co=0;Co>24&255,So[Co+1]=Ao>>16&255,So[Co+2]=Ao>>8&255,So[Co+3]=Ao&255,So[Co+4]=po>>24&255,So[Co+5]=po>>16&255,So[Co+6]=po>>8&255,So[Co+7]=po&255}function En(So,Co,Ao,po,Ro){var Xo,jo=0;for(Xo=0;Xo>>8)-1}function Cn(So,Co,Ao,po){return En(So,Co,Ao,po,16)}function In(So,Co,Ao,po){return En(So,Co,Ao,po,32)}function An(So,Co,Ao,po){for(var Ro=po[0]&255|(po[1]&255)<<8|(po[2]&255)<<16|(po[3]&255)<<24,Xo=Ao[0]&255|(Ao[1]&255)<<8|(Ao[2]&255)<<16|(Ao[3]&255)<<24,jo=Ao[4]&255|(Ao[5]&255)<<8|(Ao[6]&255)<<16|(Ao[7]&255)<<24,Ko=Ao[8]&255|(Ao[9]&255)<<8|(Ao[10]&255)<<16|(Ao[11]&255)<<24,Wl=Ao[12]&255|(Ao[13]&255)<<8|(Ao[14]&255)<<16|(Ao[15]&255)<<24,$l=po[4]&255|(po[5]&255)<<8|(po[6]&255)<<16|(po[7]&255)<<24,El=Co[0]&255|(Co[1]&255)<<8|(Co[2]&255)<<16|(Co[3]&255)<<24,Cu=Co[4]&255|(Co[5]&255)<<8|(Co[6]&255)<<16|(Co[7]&255)<<24,iu=Co[8]&255|(Co[9]&255)<<8|(Co[10]&255)<<16|(Co[11]&255)<<24,pu=Co[12]&255|(Co[13]&255)<<8|(Co[14]&255)<<16|(Co[15]&255)<<24,yu=po[8]&255|(po[9]&255)<<8|(po[10]&255)<<16|(po[11]&255)<<24,hu=Ao[16]&255|(Ao[17]&255)<<8|(Ao[18]&255)<<16|(Ao[19]&255)<<24,mu=Ao[20]&255|(Ao[21]&255)<<8|(Ao[22]&255)<<16|(Ao[23]&255)<<24,vu=Ao[24]&255|(Ao[25]&255)<<8|(Ao[26]&255)<<16|(Ao[27]&255)<<24,fu=Ao[28]&255|(Ao[29]&255)<<8|(Ao[30]&255)<<16|(Ao[31]&255)<<24,gu=po[12]&255|(po[13]&255)<<8|(po[14]&255)<<16|(po[15]&255)<<24,ou=Ro,su=Xo,tu=jo,zl=Ko,Gl=Wl,Jl=$l,Pl=El,Fl=Cu,Yl=iu,Vl=pu,Ql=yu,au=hu,Nu=mu,Wu=vu,zu=fu,Bu=gu,Qo,Zu=0;Zu<20;Zu+=2)Qo=ou+Nu|0,Gl^=Qo<<7|Qo>>>25,Qo=Gl+ou|0,Yl^=Qo<<9|Qo>>>23,Qo=Yl+Gl|0,Nu^=Qo<<13|Qo>>>19,Qo=Nu+Yl|0,ou^=Qo<<18|Qo>>>14,Qo=Jl+su|0,Vl^=Qo<<7|Qo>>>25,Qo=Vl+Jl|0,Wu^=Qo<<9|Qo>>>23,Qo=Wu+Vl|0,su^=Qo<<13|Qo>>>19,Qo=su+Wu|0,Jl^=Qo<<18|Qo>>>14,Qo=Ql+Pl|0,zu^=Qo<<7|Qo>>>25,Qo=zu+Ql|0,tu^=Qo<<9|Qo>>>23,Qo=tu+zu|0,Pl^=Qo<<13|Qo>>>19,Qo=Pl+tu|0,Ql^=Qo<<18|Qo>>>14,Qo=Bu+au|0,zl^=Qo<<7|Qo>>>25,Qo=zl+Bu|0,Fl^=Qo<<9|Qo>>>23,Qo=Fl+zl|0,au^=Qo<<13|Qo>>>19,Qo=au+Fl|0,Bu^=Qo<<18|Qo>>>14,Qo=ou+zl|0,su^=Qo<<7|Qo>>>25,Qo=su+ou|0,tu^=Qo<<9|Qo>>>23,Qo=tu+su|0,zl^=Qo<<13|Qo>>>19,Qo=zl+tu|0,ou^=Qo<<18|Qo>>>14,Qo=Jl+Gl|0,Pl^=Qo<<7|Qo>>>25,Qo=Pl+Jl|0,Fl^=Qo<<9|Qo>>>23,Qo=Fl+Pl|0,Gl^=Qo<<13|Qo>>>19,Qo=Gl+Fl|0,Jl^=Qo<<18|Qo>>>14,Qo=Ql+Vl|0,au^=Qo<<7|Qo>>>25,Qo=au+Ql|0,Yl^=Qo<<9|Qo>>>23,Qo=Yl+au|0,Vl^=Qo<<13|Qo>>>19,Qo=Vl+Yl|0,Ql^=Qo<<18|Qo>>>14,Qo=Bu+zu|0,Nu^=Qo<<7|Qo>>>25,Qo=Nu+Bu|0,Wu^=Qo<<9|Qo>>>23,Qo=Wu+Nu|0,zu^=Qo<<13|Qo>>>19,Qo=zu+Wu|0,Bu^=Qo<<18|Qo>>>14;ou=ou+Ro|0,su=su+Xo|0,tu=tu+jo|0,zl=zl+Ko|0,Gl=Gl+Wl|0,Jl=Jl+$l|0,Pl=Pl+El|0,Fl=Fl+Cu|0,Yl=Yl+iu|0,Vl=Vl+pu|0,Ql=Ql+yu|0,au=au+hu|0,Nu=Nu+mu|0,Wu=Wu+vu|0,zu=zu+fu|0,Bu=Bu+gu|0,So[0]=ou>>>0&255,So[1]=ou>>>8&255,So[2]=ou>>>16&255,So[3]=ou>>>24&255,So[4]=su>>>0&255,So[5]=su>>>8&255,So[6]=su>>>16&255,So[7]=su>>>24&255,So[8]=tu>>>0&255,So[9]=tu>>>8&255,So[10]=tu>>>16&255,So[11]=tu>>>24&255,So[12]=zl>>>0&255,So[13]=zl>>>8&255,So[14]=zl>>>16&255,So[15]=zl>>>24&255,So[16]=Gl>>>0&255,So[17]=Gl>>>8&255,So[18]=Gl>>>16&255,So[19]=Gl>>>24&255,So[20]=Jl>>>0&255,So[21]=Jl>>>8&255,So[22]=Jl>>>16&255,So[23]=Jl>>>24&255,So[24]=Pl>>>0&255,So[25]=Pl>>>8&255,So[26]=Pl>>>16&255,So[27]=Pl>>>24&255,So[28]=Fl>>>0&255,So[29]=Fl>>>8&255,So[30]=Fl>>>16&255,So[31]=Fl>>>24&255,So[32]=Yl>>>0&255,So[33]=Yl>>>8&255,So[34]=Yl>>>16&255,So[35]=Yl>>>24&255,So[36]=Vl>>>0&255,So[37]=Vl>>>8&255,So[38]=Vl>>>16&255,So[39]=Vl>>>24&255,So[40]=Ql>>>0&255,So[41]=Ql>>>8&255,So[42]=Ql>>>16&255,So[43]=Ql>>>24&255,So[44]=au>>>0&255,So[45]=au>>>8&255,So[46]=au>>>16&255,So[47]=au>>>24&255,So[48]=Nu>>>0&255,So[49]=Nu>>>8&255,So[50]=Nu>>>16&255,So[51]=Nu>>>24&255,So[52]=Wu>>>0&255,So[53]=Wu>>>8&255,So[54]=Wu>>>16&255,So[55]=Wu>>>24&255,So[56]=zu>>>0&255,So[57]=zu>>>8&255,So[58]=zu>>>16&255,So[59]=zu>>>24&255,So[60]=Bu>>>0&255,So[61]=Bu>>>8&255,So[62]=Bu>>>16&255,So[63]=Bu>>>24&255}function jn(So,Co,Ao,po){for(var Ro=po[0]&255|(po[1]&255)<<8|(po[2]&255)<<16|(po[3]&255)<<24,Xo=Ao[0]&255|(Ao[1]&255)<<8|(Ao[2]&255)<<16|(Ao[3]&255)<<24,jo=Ao[4]&255|(Ao[5]&255)<<8|(Ao[6]&255)<<16|(Ao[7]&255)<<24,Ko=Ao[8]&255|(Ao[9]&255)<<8|(Ao[10]&255)<<16|(Ao[11]&255)<<24,Wl=Ao[12]&255|(Ao[13]&255)<<8|(Ao[14]&255)<<16|(Ao[15]&255)<<24,$l=po[4]&255|(po[5]&255)<<8|(po[6]&255)<<16|(po[7]&255)<<24,El=Co[0]&255|(Co[1]&255)<<8|(Co[2]&255)<<16|(Co[3]&255)<<24,Cu=Co[4]&255|(Co[5]&255)<<8|(Co[6]&255)<<16|(Co[7]&255)<<24,iu=Co[8]&255|(Co[9]&255)<<8|(Co[10]&255)<<16|(Co[11]&255)<<24,pu=Co[12]&255|(Co[13]&255)<<8|(Co[14]&255)<<16|(Co[15]&255)<<24,yu=po[8]&255|(po[9]&255)<<8|(po[10]&255)<<16|(po[11]&255)<<24,hu=Ao[16]&255|(Ao[17]&255)<<8|(Ao[18]&255)<<16|(Ao[19]&255)<<24,mu=Ao[20]&255|(Ao[21]&255)<<8|(Ao[22]&255)<<16|(Ao[23]&255)<<24,vu=Ao[24]&255|(Ao[25]&255)<<8|(Ao[26]&255)<<16|(Ao[27]&255)<<24,fu=Ao[28]&255|(Ao[29]&255)<<8|(Ao[30]&255)<<16|(Ao[31]&255)<<24,gu=po[12]&255|(po[13]&255)<<8|(po[14]&255)<<16|(po[15]&255)<<24,ou=Ro,su=Xo,tu=jo,zl=Ko,Gl=Wl,Jl=$l,Pl=El,Fl=Cu,Yl=iu,Vl=pu,Ql=yu,au=hu,Nu=mu,Wu=vu,zu=fu,Bu=gu,Qo,Zu=0;Zu<20;Zu+=2)Qo=ou+Nu|0,Gl^=Qo<<7|Qo>>>25,Qo=Gl+ou|0,Yl^=Qo<<9|Qo>>>23,Qo=Yl+Gl|0,Nu^=Qo<<13|Qo>>>19,Qo=Nu+Yl|0,ou^=Qo<<18|Qo>>>14,Qo=Jl+su|0,Vl^=Qo<<7|Qo>>>25,Qo=Vl+Jl|0,Wu^=Qo<<9|Qo>>>23,Qo=Wu+Vl|0,su^=Qo<<13|Qo>>>19,Qo=su+Wu|0,Jl^=Qo<<18|Qo>>>14,Qo=Ql+Pl|0,zu^=Qo<<7|Qo>>>25,Qo=zu+Ql|0,tu^=Qo<<9|Qo>>>23,Qo=tu+zu|0,Pl^=Qo<<13|Qo>>>19,Qo=Pl+tu|0,Ql^=Qo<<18|Qo>>>14,Qo=Bu+au|0,zl^=Qo<<7|Qo>>>25,Qo=zl+Bu|0,Fl^=Qo<<9|Qo>>>23,Qo=Fl+zl|0,au^=Qo<<13|Qo>>>19,Qo=au+Fl|0,Bu^=Qo<<18|Qo>>>14,Qo=ou+zl|0,su^=Qo<<7|Qo>>>25,Qo=su+ou|0,tu^=Qo<<9|Qo>>>23,Qo=tu+su|0,zl^=Qo<<13|Qo>>>19,Qo=zl+tu|0,ou^=Qo<<18|Qo>>>14,Qo=Jl+Gl|0,Pl^=Qo<<7|Qo>>>25,Qo=Pl+Jl|0,Fl^=Qo<<9|Qo>>>23,Qo=Fl+Pl|0,Gl^=Qo<<13|Qo>>>19,Qo=Gl+Fl|0,Jl^=Qo<<18|Qo>>>14,Qo=Ql+Vl|0,au^=Qo<<7|Qo>>>25,Qo=au+Ql|0,Yl^=Qo<<9|Qo>>>23,Qo=Yl+au|0,Vl^=Qo<<13|Qo>>>19,Qo=Vl+Yl|0,Ql^=Qo<<18|Qo>>>14,Qo=Bu+zu|0,Nu^=Qo<<7|Qo>>>25,Qo=Nu+Bu|0,Wu^=Qo<<9|Qo>>>23,Qo=Wu+Nu|0,zu^=Qo<<13|Qo>>>19,Qo=zu+Wu|0,Bu^=Qo<<18|Qo>>>14;So[0]=ou>>>0&255,So[1]=ou>>>8&255,So[2]=ou>>>16&255,So[3]=ou>>>24&255,So[4]=Jl>>>0&255,So[5]=Jl>>>8&255,So[6]=Jl>>>16&255,So[7]=Jl>>>24&255,So[8]=Ql>>>0&255,So[9]=Ql>>>8&255,So[10]=Ql>>>16&255,So[11]=Ql>>>24&255,So[12]=Bu>>>0&255,So[13]=Bu>>>8&255,So[14]=Bu>>>16&255,So[15]=Bu>>>24&255,So[16]=Pl>>>0&255,So[17]=Pl>>>8&255,So[18]=Pl>>>16&255,So[19]=Pl>>>24&255,So[20]=Fl>>>0&255,So[21]=Fl>>>8&255,So[22]=Fl>>>16&255,So[23]=Fl>>>24&255,So[24]=Yl>>>0&255,So[25]=Yl>>>8&255,So[26]=Yl>>>16&255,So[27]=Yl>>>24&255,So[28]=Vl>>>0&255,So[29]=Vl>>>8&255,So[30]=Vl>>>16&255,So[31]=Vl>>>24&255}function eo(So,Co,Ao,po){An(So,Co,Ao,po)}function ro(So,Co,Ao,po){jn(So,Co,Ao,po)}var to=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function _i(So,Co,Ao,po,Ro,Xo,jo){var Ko=new Uint8Array(16),Wl=new Uint8Array(64),$l,El;for(El=0;El<16;El++)Ko[El]=0;for(El=0;El<8;El++)Ko[El]=Xo[El];for(;Ro>=64;){for(eo(Wl,Ko,jo,to),El=0;El<64;El++)So[Co+El]=Ao[po+El]^Wl[El];for($l=1,El=8;El<16;El++)$l=$l+(Ko[El]&255)|0,Ko[El]=$l&255,$l>>>=8;Ro-=64,Co+=64,po+=64}if(Ro>0)for(eo(Wl,Ko,jo,to),El=0;El=64;){for(eo(jo,Xo,Ro,to),Wl=0;Wl<64;Wl++)So[Co+Wl]=jo[Wl];for(Ko=1,Wl=8;Wl<16;Wl++)Ko=Ko+(Xo[Wl]&255)|0,Xo[Wl]=Ko&255,Ko>>>=8;Ao-=64,Co+=64}if(Ao>0)for(eo(jo,Xo,Ro,to),Wl=0;Wl>>13|Ao<<3)&8191,po=So[4]&255|(So[5]&255)<<8,this.r[2]=(Ao>>>10|po<<6)&7939,Ro=So[6]&255|(So[7]&255)<<8,this.r[3]=(po>>>7|Ro<<9)&8191,Xo=So[8]&255|(So[9]&255)<<8,this.r[4]=(Ro>>>4|Xo<<12)&255,this.r[5]=Xo>>>1&8190,jo=So[10]&255|(So[11]&255)<<8,this.r[6]=(Xo>>>14|jo<<2)&8191,Ko=So[12]&255|(So[13]&255)<<8,this.r[7]=(jo>>>11|Ko<<5)&8065,Wl=So[14]&255|(So[15]&255)<<8,this.r[8]=(Ko>>>8|Wl<<8)&8191,this.r[9]=Wl>>>5&127,this.pad[0]=So[16]&255|(So[17]&255)<<8,this.pad[1]=So[18]&255|(So[19]&255)<<8,this.pad[2]=So[20]&255|(So[21]&255)<<8,this.pad[3]=So[22]&255|(So[23]&255)<<8,this.pad[4]=So[24]&255|(So[25]&255)<<8,this.pad[5]=So[26]&255|(So[27]&255)<<8,this.pad[6]=So[28]&255|(So[29]&255)<<8,this.pad[7]=So[30]&255|(So[31]&255)<<8};so.prototype.blocks=function(So,Co,Ao){for(var po=this.fin?0:2048,Ro,Xo,jo,Ko,Wl,$l,El,Cu,iu,pu,yu,hu,mu,vu,fu,gu,ou,su,tu,zl=this.h[0],Gl=this.h[1],Jl=this.h[2],Pl=this.h[3],Fl=this.h[4],Yl=this.h[5],Vl=this.h[6],Ql=this.h[7],au=this.h[8],Nu=this.h[9],Wu=this.r[0],zu=this.r[1],Bu=this.r[2],Qo=this.r[3],Zu=this.r[4],Qu=this.r[5],_h=this.r[6],qu=this.r[7],Ju=this.r[8],_d=this.r[9];Ao>=16;)Ro=So[Co+0]&255|(So[Co+1]&255)<<8,zl+=Ro&8191,Xo=So[Co+2]&255|(So[Co+3]&255)<<8,Gl+=(Ro>>>13|Xo<<3)&8191,jo=So[Co+4]&255|(So[Co+5]&255)<<8,Jl+=(Xo>>>10|jo<<6)&8191,Ko=So[Co+6]&255|(So[Co+7]&255)<<8,Pl+=(jo>>>7|Ko<<9)&8191,Wl=So[Co+8]&255|(So[Co+9]&255)<<8,Fl+=(Ko>>>4|Wl<<12)&8191,Yl+=Wl>>>1&8191,$l=So[Co+10]&255|(So[Co+11]&255)<<8,Vl+=(Wl>>>14|$l<<2)&8191,El=So[Co+12]&255|(So[Co+13]&255)<<8,Ql+=($l>>>11|El<<5)&8191,Cu=So[Co+14]&255|(So[Co+15]&255)<<8,au+=(El>>>8|Cu<<8)&8191,Nu+=Cu>>>5|po,iu=0,pu=iu,pu+=zl*Wu,pu+=Gl*(5*_d),pu+=Jl*(5*Ju),pu+=Pl*(5*qu),pu+=Fl*(5*_h),iu=pu>>>13,pu&=8191,pu+=Yl*(5*Qu),pu+=Vl*(5*Zu),pu+=Ql*(5*Qo),pu+=au*(5*Bu),pu+=Nu*(5*zu),iu+=pu>>>13,pu&=8191,yu=iu,yu+=zl*zu,yu+=Gl*Wu,yu+=Jl*(5*_d),yu+=Pl*(5*Ju),yu+=Fl*(5*qu),iu=yu>>>13,yu&=8191,yu+=Yl*(5*_h),yu+=Vl*(5*Qu),yu+=Ql*(5*Zu),yu+=au*(5*Qo),yu+=Nu*(5*Bu),iu+=yu>>>13,yu&=8191,hu=iu,hu+=zl*Bu,hu+=Gl*zu,hu+=Jl*Wu,hu+=Pl*(5*_d),hu+=Fl*(5*Ju),iu=hu>>>13,hu&=8191,hu+=Yl*(5*qu),hu+=Vl*(5*_h),hu+=Ql*(5*Qu),hu+=au*(5*Zu),hu+=Nu*(5*Qo),iu+=hu>>>13,hu&=8191,mu=iu,mu+=zl*Qo,mu+=Gl*Bu,mu+=Jl*zu,mu+=Pl*Wu,mu+=Fl*(5*_d),iu=mu>>>13,mu&=8191,mu+=Yl*(5*Ju),mu+=Vl*(5*qu),mu+=Ql*(5*_h),mu+=au*(5*Qu),mu+=Nu*(5*Zu),iu+=mu>>>13,mu&=8191,vu=iu,vu+=zl*Zu,vu+=Gl*Qo,vu+=Jl*Bu,vu+=Pl*zu,vu+=Fl*Wu,iu=vu>>>13,vu&=8191,vu+=Yl*(5*_d),vu+=Vl*(5*Ju),vu+=Ql*(5*qu),vu+=au*(5*_h),vu+=Nu*(5*Qu),iu+=vu>>>13,vu&=8191,fu=iu,fu+=zl*Qu,fu+=Gl*Zu,fu+=Jl*Qo,fu+=Pl*Bu,fu+=Fl*zu,iu=fu>>>13,fu&=8191,fu+=Yl*Wu,fu+=Vl*(5*_d),fu+=Ql*(5*Ju),fu+=au*(5*qu),fu+=Nu*(5*_h),iu+=fu>>>13,fu&=8191,gu=iu,gu+=zl*_h,gu+=Gl*Qu,gu+=Jl*Zu,gu+=Pl*Qo,gu+=Fl*Bu,iu=gu>>>13,gu&=8191,gu+=Yl*zu,gu+=Vl*Wu,gu+=Ql*(5*_d),gu+=au*(5*Ju),gu+=Nu*(5*qu),iu+=gu>>>13,gu&=8191,ou=iu,ou+=zl*qu,ou+=Gl*_h,ou+=Jl*Qu,ou+=Pl*Zu,ou+=Fl*Qo,iu=ou>>>13,ou&=8191,ou+=Yl*Bu,ou+=Vl*zu,ou+=Ql*Wu,ou+=au*(5*_d),ou+=Nu*(5*Ju),iu+=ou>>>13,ou&=8191,su=iu,su+=zl*Ju,su+=Gl*qu,su+=Jl*_h,su+=Pl*Qu,su+=Fl*Zu,iu=su>>>13,su&=8191,su+=Yl*Qo,su+=Vl*Bu,su+=Ql*zu,su+=au*Wu,su+=Nu*(5*_d),iu+=su>>>13,su&=8191,tu=iu,tu+=zl*_d,tu+=Gl*Ju,tu+=Jl*qu,tu+=Pl*_h,tu+=Fl*Qu,iu=tu>>>13,tu&=8191,tu+=Yl*Zu,tu+=Vl*Qo,tu+=Ql*Bu,tu+=au*zu,tu+=Nu*Wu,iu+=tu>>>13,tu&=8191,iu=(iu<<2)+iu|0,iu=iu+pu|0,pu=iu&8191,iu=iu>>>13,yu+=iu,zl=pu,Gl=yu,Jl=hu,Pl=mu,Fl=vu,Yl=fu,Vl=gu,Ql=ou,au=su,Nu=tu,Co+=16,Ao-=16;this.h[0]=zl,this.h[1]=Gl,this.h[2]=Jl,this.h[3]=Pl,this.h[4]=Fl,this.h[5]=Yl,this.h[6]=Vl,this.h[7]=Ql,this.h[8]=au,this.h[9]=Nu},so.prototype.finish=function(So,Co){var Ao=new Uint16Array(10),po,Ro,Xo,jo;if(this.leftover){for(jo=this.leftover,this.buffer[jo++]=1;jo<16;jo++)this.buffer[jo]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(po=this.h[1]>>>13,this.h[1]&=8191,jo=2;jo<10;jo++)this.h[jo]+=po,po=this.h[jo]>>>13,this.h[jo]&=8191;for(this.h[0]+=po*5,po=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=po,po=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=po,Ao[0]=this.h[0]+5,po=Ao[0]>>>13,Ao[0]&=8191,jo=1;jo<10;jo++)Ao[jo]=this.h[jo]+po,po=Ao[jo]>>>13,Ao[jo]&=8191;for(Ao[9]-=8192,Ro=(po^1)-1,jo=0;jo<10;jo++)Ao[jo]&=Ro;for(Ro=~Ro,jo=0;jo<10;jo++)this.h[jo]=this.h[jo]&Ro|Ao[jo];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,Xo=this.h[0]+this.pad[0],this.h[0]=Xo&65535,jo=1;jo<8;jo++)Xo=(this.h[jo]+this.pad[jo]|0)+(Xo>>>16)|0,this.h[jo]=Xo&65535;So[Co+0]=this.h[0]>>>0&255,So[Co+1]=this.h[0]>>>8&255,So[Co+2]=this.h[1]>>>0&255,So[Co+3]=this.h[1]>>>8&255,So[Co+4]=this.h[2]>>>0&255,So[Co+5]=this.h[2]>>>8&255,So[Co+6]=this.h[3]>>>0&255,So[Co+7]=this.h[3]>>>8&255,So[Co+8]=this.h[4]>>>0&255,So[Co+9]=this.h[4]>>>8&255,So[Co+10]=this.h[5]>>>0&255,So[Co+11]=this.h[5]>>>8&255,So[Co+12]=this.h[6]>>>0&255,So[Co+13]=this.h[6]>>>8&255,So[Co+14]=this.h[7]>>>0&255,So[Co+15]=this.h[7]>>>8&255},so.prototype.update=function(So,Co,Ao){var po,Ro;if(this.leftover){for(Ro=16-this.leftover,Ro>Ao&&(Ro=Ao),po=0;po=16&&(Ro=Ao-Ao%16,this.blocks(So,Co,Ro),Co+=Ro,Ao-=Ro),Ao){for(po=0;po>16&1),Xo[Ao-1]&=65535;Xo[15]=jo[15]-32767-(Xo[14]>>16&1),Ro=Xo[15]>>16&1,Xo[14]&=65535,Pn(jo,Xo,1-Ro)}for(Ao=0;Ao<16;Ao++)So[2*Ao]=jo[Ao]&255,So[2*Ao+1]=jo[Ao]>>8}function Zn(So,Co){var Ao=new Uint8Array(32),po=new Uint8Array(32);return On(Ao,So),On(po,Co),In(Ao,0,po,0)}function Nn(So){var Co=new Uint8Array(32);return On(Co,So),Co[0]&1}function wn(So,Co){var Ao;for(Ao=0;Ao<16;Ao++)So[Ao]=Co[2*Ao]+(Co[2*Ao+1]<<8);So[15]&=32767}function zn(So,Co,Ao){for(var po=0;po<16;po++)So[po]=Co[po]+Ao[po]}function fo(So,Co,Ao){for(var po=0;po<16;po++)So[po]=Co[po]-Ao[po]}function vo(So,Co,Ao){var po,Ro,Xo=0,jo=0,Ko=0,Wl=0,$l=0,El=0,Cu=0,iu=0,pu=0,yu=0,hu=0,mu=0,vu=0,fu=0,gu=0,ou=0,su=0,tu=0,zl=0,Gl=0,Jl=0,Pl=0,Fl=0,Yl=0,Vl=0,Ql=0,au=0,Nu=0,Wu=0,zu=0,Bu=0,Qo=Ao[0],Zu=Ao[1],Qu=Ao[2],_h=Ao[3],qu=Ao[4],Ju=Ao[5],_d=Ao[6],dp=Ao[7],Ku=Ao[8],Vu=Ao[9],cp=Ao[10],fp=Ao[11],lp=Ao[12],np=Ao[13],Rp=Ao[14],wp=Ao[15];po=Co[0],Xo+=po*Qo,jo+=po*Zu,Ko+=po*Qu,Wl+=po*_h,$l+=po*qu,El+=po*Ju,Cu+=po*_d,iu+=po*dp,pu+=po*Ku,yu+=po*Vu,hu+=po*cp,mu+=po*fp,vu+=po*lp,fu+=po*np,gu+=po*Rp,ou+=po*wp,po=Co[1],jo+=po*Qo,Ko+=po*Zu,Wl+=po*Qu,$l+=po*_h,El+=po*qu,Cu+=po*Ju,iu+=po*_d,pu+=po*dp,yu+=po*Ku,hu+=po*Vu,mu+=po*cp,vu+=po*fp,fu+=po*lp,gu+=po*np,ou+=po*Rp,su+=po*wp,po=Co[2],Ko+=po*Qo,Wl+=po*Zu,$l+=po*Qu,El+=po*_h,Cu+=po*qu,iu+=po*Ju,pu+=po*_d,yu+=po*dp,hu+=po*Ku,mu+=po*Vu,vu+=po*cp,fu+=po*fp,gu+=po*lp,ou+=po*np,su+=po*Rp,tu+=po*wp,po=Co[3],Wl+=po*Qo,$l+=po*Zu,El+=po*Qu,Cu+=po*_h,iu+=po*qu,pu+=po*Ju,yu+=po*_d,hu+=po*dp,mu+=po*Ku,vu+=po*Vu,fu+=po*cp,gu+=po*fp,ou+=po*lp,su+=po*np,tu+=po*Rp,zl+=po*wp,po=Co[4],$l+=po*Qo,El+=po*Zu,Cu+=po*Qu,iu+=po*_h,pu+=po*qu,yu+=po*Ju,hu+=po*_d,mu+=po*dp,vu+=po*Ku,fu+=po*Vu,gu+=po*cp,ou+=po*fp,su+=po*lp,tu+=po*np,zl+=po*Rp,Gl+=po*wp,po=Co[5],El+=po*Qo,Cu+=po*Zu,iu+=po*Qu,pu+=po*_h,yu+=po*qu,hu+=po*Ju,mu+=po*_d,vu+=po*dp,fu+=po*Ku,gu+=po*Vu,ou+=po*cp,su+=po*fp,tu+=po*lp,zl+=po*np,Gl+=po*Rp,Jl+=po*wp,po=Co[6],Cu+=po*Qo,iu+=po*Zu,pu+=po*Qu,yu+=po*_h,hu+=po*qu,mu+=po*Ju,vu+=po*_d,fu+=po*dp,gu+=po*Ku,ou+=po*Vu,su+=po*cp,tu+=po*fp,zl+=po*lp,Gl+=po*np,Jl+=po*Rp,Pl+=po*wp,po=Co[7],iu+=po*Qo,pu+=po*Zu,yu+=po*Qu,hu+=po*_h,mu+=po*qu,vu+=po*Ju,fu+=po*_d,gu+=po*dp,ou+=po*Ku,su+=po*Vu,tu+=po*cp,zl+=po*fp,Gl+=po*lp,Jl+=po*np,Pl+=po*Rp,Fl+=po*wp,po=Co[8],pu+=po*Qo,yu+=po*Zu,hu+=po*Qu,mu+=po*_h,vu+=po*qu,fu+=po*Ju,gu+=po*_d,ou+=po*dp,su+=po*Ku,tu+=po*Vu,zl+=po*cp,Gl+=po*fp,Jl+=po*lp,Pl+=po*np,Fl+=po*Rp,Yl+=po*wp,po=Co[9],yu+=po*Qo,hu+=po*Zu,mu+=po*Qu,vu+=po*_h,fu+=po*qu,gu+=po*Ju,ou+=po*_d,su+=po*dp,tu+=po*Ku,zl+=po*Vu,Gl+=po*cp,Jl+=po*fp,Pl+=po*lp,Fl+=po*np,Yl+=po*Rp,Vl+=po*wp,po=Co[10],hu+=po*Qo,mu+=po*Zu,vu+=po*Qu,fu+=po*_h,gu+=po*qu,ou+=po*Ju,su+=po*_d,tu+=po*dp,zl+=po*Ku,Gl+=po*Vu,Jl+=po*cp,Pl+=po*fp,Fl+=po*lp,Yl+=po*np,Vl+=po*Rp,Ql+=po*wp,po=Co[11],mu+=po*Qo,vu+=po*Zu,fu+=po*Qu,gu+=po*_h,ou+=po*qu,su+=po*Ju,tu+=po*_d,zl+=po*dp,Gl+=po*Ku,Jl+=po*Vu,Pl+=po*cp,Fl+=po*fp,Yl+=po*lp,Vl+=po*np,Ql+=po*Rp,au+=po*wp,po=Co[12],vu+=po*Qo,fu+=po*Zu,gu+=po*Qu,ou+=po*_h,su+=po*qu,tu+=po*Ju,zl+=po*_d,Gl+=po*dp,Jl+=po*Ku,Pl+=po*Vu,Fl+=po*cp,Yl+=po*fp,Vl+=po*lp,Ql+=po*np,au+=po*Rp,Nu+=po*wp,po=Co[13],fu+=po*Qo,gu+=po*Zu,ou+=po*Qu,su+=po*_h,tu+=po*qu,zl+=po*Ju,Gl+=po*_d,Jl+=po*dp,Pl+=po*Ku,Fl+=po*Vu,Yl+=po*cp,Vl+=po*fp,Ql+=po*lp,au+=po*np,Nu+=po*Rp,Wu+=po*wp,po=Co[14],gu+=po*Qo,ou+=po*Zu,su+=po*Qu,tu+=po*_h,zl+=po*qu,Gl+=po*Ju,Jl+=po*_d,Pl+=po*dp,Fl+=po*Ku,Yl+=po*Vu,Vl+=po*cp,Ql+=po*fp,au+=po*lp,Nu+=po*np,Wu+=po*Rp,zu+=po*wp,po=Co[15],ou+=po*Qo,su+=po*Zu,tu+=po*Qu,zl+=po*_h,Gl+=po*qu,Jl+=po*Ju,Pl+=po*_d,Fl+=po*dp,Yl+=po*Ku,Vl+=po*Vu,Ql+=po*cp,au+=po*fp,Nu+=po*lp,Wu+=po*np,zu+=po*Rp,Bu+=po*wp,Xo+=38*su,jo+=38*tu,Ko+=38*zl,Wl+=38*Gl,$l+=38*Jl,El+=38*Pl,Cu+=38*Fl,iu+=38*Yl,pu+=38*Vl,yu+=38*Ql,hu+=38*au,mu+=38*Nu,vu+=38*Wu,fu+=38*zu,gu+=38*Bu,Ro=1,po=Xo+Ro+65535,Ro=Math.floor(po/65536),Xo=po-Ro*65536,po=jo+Ro+65535,Ro=Math.floor(po/65536),jo=po-Ro*65536,po=Ko+Ro+65535,Ro=Math.floor(po/65536),Ko=po-Ro*65536,po=Wl+Ro+65535,Ro=Math.floor(po/65536),Wl=po-Ro*65536,po=$l+Ro+65535,Ro=Math.floor(po/65536),$l=po-Ro*65536,po=El+Ro+65535,Ro=Math.floor(po/65536),El=po-Ro*65536,po=Cu+Ro+65535,Ro=Math.floor(po/65536),Cu=po-Ro*65536,po=iu+Ro+65535,Ro=Math.floor(po/65536),iu=po-Ro*65536,po=pu+Ro+65535,Ro=Math.floor(po/65536),pu=po-Ro*65536,po=yu+Ro+65535,Ro=Math.floor(po/65536),yu=po-Ro*65536,po=hu+Ro+65535,Ro=Math.floor(po/65536),hu=po-Ro*65536,po=mu+Ro+65535,Ro=Math.floor(po/65536),mu=po-Ro*65536,po=vu+Ro+65535,Ro=Math.floor(po/65536),vu=po-Ro*65536,po=fu+Ro+65535,Ro=Math.floor(po/65536),fu=po-Ro*65536,po=gu+Ro+65535,Ro=Math.floor(po/65536),gu=po-Ro*65536,po=ou+Ro+65535,Ro=Math.floor(po/65536),ou=po-Ro*65536,Xo+=Ro-1+37*(Ro-1),Ro=1,po=Xo+Ro+65535,Ro=Math.floor(po/65536),Xo=po-Ro*65536,po=jo+Ro+65535,Ro=Math.floor(po/65536),jo=po-Ro*65536,po=Ko+Ro+65535,Ro=Math.floor(po/65536),Ko=po-Ro*65536,po=Wl+Ro+65535,Ro=Math.floor(po/65536),Wl=po-Ro*65536,po=$l+Ro+65535,Ro=Math.floor(po/65536),$l=po-Ro*65536,po=El+Ro+65535,Ro=Math.floor(po/65536),El=po-Ro*65536,po=Cu+Ro+65535,Ro=Math.floor(po/65536),Cu=po-Ro*65536,po=iu+Ro+65535,Ro=Math.floor(po/65536),iu=po-Ro*65536,po=pu+Ro+65535,Ro=Math.floor(po/65536),pu=po-Ro*65536,po=yu+Ro+65535,Ro=Math.floor(po/65536),yu=po-Ro*65536,po=hu+Ro+65535,Ro=Math.floor(po/65536),hu=po-Ro*65536,po=mu+Ro+65535,Ro=Math.floor(po/65536),mu=po-Ro*65536,po=vu+Ro+65535,Ro=Math.floor(po/65536),vu=po-Ro*65536,po=fu+Ro+65535,Ro=Math.floor(po/65536),fu=po-Ro*65536,po=gu+Ro+65535,Ro=Math.floor(po/65536),gu=po-Ro*65536,po=ou+Ro+65535,Ro=Math.floor(po/65536),ou=po-Ro*65536,Xo+=Ro-1+37*(Ro-1),So[0]=Xo,So[1]=jo,So[2]=Ko,So[3]=Wl,So[4]=$l,So[5]=El,So[6]=Cu,So[7]=iu,So[8]=pu,So[9]=yu,So[10]=hu,So[11]=mu,So[12]=vu,So[13]=fu,So[14]=gu,So[15]=ou}function go(So,Co){vo(So,Co,Co)}function uo(So,Co){var Ao=wr(),po;for(po=0;po<16;po++)Ao[po]=Co[po];for(po=253;po>=0;po--)go(Ao,Ao),po!==2&&po!==4&&vo(Ao,Ao,Co);for(po=0;po<16;po++)So[po]=Ao[po]}function lo(So,Co){var Ao=wr(),po;for(po=0;po<16;po++)Ao[po]=Co[po];for(po=250;po>=0;po--)go(Ao,Ao),po!==1&&vo(Ao,Ao,Co);for(po=0;po<16;po++)So[po]=Ao[po]}function Eo(So,Co,Ao){var po=new Uint8Array(32),Ro=new Float64Array(80),Xo,jo,Ko=wr(),Wl=wr(),$l=wr(),El=wr(),Cu=wr(),iu=wr();for(jo=0;jo<31;jo++)po[jo]=Co[jo];for(po[31]=Co[31]&127|64,po[0]&=248,wn(Ro,Ao),jo=0;jo<16;jo++)Wl[jo]=Ro[jo],El[jo]=Ko[jo]=$l[jo]=0;for(Ko[0]=El[0]=1,jo=254;jo>=0;--jo)Xo=po[jo>>>3]>>>(jo&7)&1,Pn(Ko,Wl,Xo),Pn($l,El,Xo),zn(Cu,Ko,$l),fo(Ko,Ko,$l),zn($l,Wl,El),fo(Wl,Wl,El),go(El,Cu),go(iu,Ko),vo(Ko,$l,Ko),vo($l,Wl,Cu),zn(Cu,Ko,$l),fo(Ko,Ko,$l),go(Wl,Ko),fo($l,El,iu),vo(Ko,$l,qr),zn(Ko,Ko,El),vo($l,$l,Ko),vo(Ko,El,iu),vo(El,Wl,Ro),go(Wl,Cu),Pn(Ko,Wl,Xo),Pn($l,El,Xo);for(jo=0;jo<16;jo++)Ro[jo+16]=Ko[jo],Ro[jo+32]=$l[jo],Ro[jo+48]=Wl[jo],Ro[jo+64]=El[jo];var pu=Ro.subarray(32),yu=Ro.subarray(16);return uo(pu,pu),vo(yu,yu,pu),On(So,yu),0}function mo(So,Co){return Eo(So,Co,jr)}function yo(So,Co){return Er(Co,32),mo(So,Co)}function _o(So,Co,Ao){var po=new Uint8Array(32);return Eo(po,Ao,Co),ro(So,kr,po,to)}var Bo=Hr,Lo=Xr;function Wo(So,Co,Ao,po,Ro,Xo){var jo=new Uint8Array(32);return _o(jo,Ro,Xo),Bo(So,Co,Ao,po,jo)}function na(So,Co,Ao,po,Ro,Xo){var jo=new Uint8Array(32);return _o(jo,Ro,Xo),Lo(So,Co,Ao,po,jo)}var qo=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function ga(So,Co,Ao,po){for(var Ro=new Int32Array(16),Xo=new Int32Array(16),jo,Ko,Wl,$l,El,Cu,iu,pu,yu,hu,mu,vu,fu,gu,ou,su,tu,zl,Gl,Jl,Pl,Fl,Yl,Vl,Ql,au,Nu=So[0],Wu=So[1],zu=So[2],Bu=So[3],Qo=So[4],Zu=So[5],Qu=So[6],_h=So[7],qu=Co[0],Ju=Co[1],_d=Co[2],dp=Co[3],Ku=Co[4],Vu=Co[5],cp=Co[6],fp=Co[7],lp=0;po>=128;){for(Gl=0;Gl<16;Gl++)Jl=8*Gl+lp,Ro[Gl]=Ao[Jl+0]<<24|Ao[Jl+1]<<16|Ao[Jl+2]<<8|Ao[Jl+3],Xo[Gl]=Ao[Jl+4]<<24|Ao[Jl+5]<<16|Ao[Jl+6]<<8|Ao[Jl+7];for(Gl=0;Gl<80;Gl++)if(jo=Nu,Ko=Wu,Wl=zu,$l=Bu,El=Qo,Cu=Zu,iu=Qu,pu=_h,yu=qu,hu=Ju,mu=_d,vu=dp,fu=Ku,gu=Vu,ou=cp,su=fp,Pl=_h,Fl=fp,Yl=Fl&65535,Vl=Fl>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=(Qo>>>14|Ku<<18)^(Qo>>>18|Ku<<14)^(Ku>>>9|Qo<<23),Fl=(Ku>>>14|Qo<<18)^(Ku>>>18|Qo<<14)^(Qo>>>9|Ku<<23),Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,Pl=Qo&Zu^~Qo&Qu,Fl=Ku&Vu^~Ku&cp,Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,Pl=qo[Gl*2],Fl=qo[Gl*2+1],Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,Pl=Ro[Gl%16],Fl=Xo[Gl%16],Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,tu=Ql&65535|au<<16,zl=Yl&65535|Vl<<16,Pl=tu,Fl=zl,Yl=Fl&65535,Vl=Fl>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=(Nu>>>28|qu<<4)^(qu>>>2|Nu<<30)^(qu>>>7|Nu<<25),Fl=(qu>>>28|Nu<<4)^(Nu>>>2|qu<<30)^(Nu>>>7|qu<<25),Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,Pl=Nu&Wu^Nu&zu^Wu&zu,Fl=qu&Ju^qu&_d^Ju&_d,Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,pu=Ql&65535|au<<16,su=Yl&65535|Vl<<16,Pl=$l,Fl=vu,Yl=Fl&65535,Vl=Fl>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=tu,Fl=zl,Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,$l=Ql&65535|au<<16,vu=Yl&65535|Vl<<16,Wu=jo,zu=Ko,Bu=Wl,Qo=$l,Zu=El,Qu=Cu,_h=iu,Nu=pu,Ju=yu,_d=hu,dp=mu,Ku=vu,Vu=fu,cp=gu,fp=ou,qu=su,Gl%16===15)for(Jl=0;Jl<16;Jl++)Pl=Ro[Jl],Fl=Xo[Jl],Yl=Fl&65535,Vl=Fl>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=Ro[(Jl+9)%16],Fl=Xo[(Jl+9)%16],Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,tu=Ro[(Jl+1)%16],zl=Xo[(Jl+1)%16],Pl=(tu>>>1|zl<<31)^(tu>>>8|zl<<24)^tu>>>7,Fl=(zl>>>1|tu<<31)^(zl>>>8|tu<<24)^(zl>>>7|tu<<25),Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,tu=Ro[(Jl+14)%16],zl=Xo[(Jl+14)%16],Pl=(tu>>>19|zl<<13)^(zl>>>29|tu<<3)^tu>>>6,Fl=(zl>>>19|tu<<13)^(tu>>>29|zl<<3)^(zl>>>6|tu<<26),Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,Ro[Jl]=Ql&65535|au<<16,Xo[Jl]=Yl&65535|Vl<<16;Pl=Nu,Fl=qu,Yl=Fl&65535,Vl=Fl>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=So[0],Fl=Co[0],Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,So[0]=Nu=Ql&65535|au<<16,Co[0]=qu=Yl&65535|Vl<<16,Pl=Wu,Fl=Ju,Yl=Fl&65535,Vl=Fl>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=So[1],Fl=Co[1],Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,So[1]=Wu=Ql&65535|au<<16,Co[1]=Ju=Yl&65535|Vl<<16,Pl=zu,Fl=_d,Yl=Fl&65535,Vl=Fl>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=So[2],Fl=Co[2],Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,So[2]=zu=Ql&65535|au<<16,Co[2]=_d=Yl&65535|Vl<<16,Pl=Bu,Fl=dp,Yl=Fl&65535,Vl=Fl>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=So[3],Fl=Co[3],Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,So[3]=Bu=Ql&65535|au<<16,Co[3]=dp=Yl&65535|Vl<<16,Pl=Qo,Fl=Ku,Yl=Fl&65535,Vl=Fl>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=So[4],Fl=Co[4],Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,So[4]=Qo=Ql&65535|au<<16,Co[4]=Ku=Yl&65535|Vl<<16,Pl=Zu,Fl=Vu,Yl=Fl&65535,Vl=Fl>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=So[5],Fl=Co[5],Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,So[5]=Zu=Ql&65535|au<<16,Co[5]=Vu=Yl&65535|Vl<<16,Pl=Qu,Fl=cp,Yl=Fl&65535,Vl=Fl>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=So[6],Fl=Co[6],Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,So[6]=Qu=Ql&65535|au<<16,Co[6]=cp=Yl&65535|Vl<<16,Pl=_h,Fl=fp,Yl=Fl&65535,Vl=Fl>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=So[7],Fl=Co[7],Yl+=Fl&65535,Vl+=Fl>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,So[7]=_h=Ql&65535|au<<16,Co[7]=fp=Yl&65535|Vl<<16,lp+=128,po-=128}return po}function wl(So,Co,Ao){var po=new Int32Array(8),Ro=new Int32Array(8),Xo=new Uint8Array(256),jo,Ko=Ao;for(po[0]=1779033703,po[1]=3144134277,po[2]=1013904242,po[3]=2773480762,po[4]=1359893119,po[5]=2600822924,po[6]=528734635,po[7]=1541459225,Ro[0]=4089235720,Ro[1]=2227873595,Ro[2]=4271175723,Ro[3]=1595750129,Ro[4]=2917565137,Ro[5]=725511199,Ro[6]=4215389547,Ro[7]=327033209,ga(po,Ro,Co,Ao),Ao%=128,jo=0;jo=0;--Ro)po=Ao[Ro/8|0]>>(Ro&7)&1,Fo(So,Co,po),No(Co,So),No(So,So),Fo(So,Co,po)}function Uo(So,Co){var Ao=[wr(),wr(),wr(),wr()];Sn(Ao[0],Zr),Sn(Ao[1],Jr),Sn(Ao[2],Wr),vo(Ao[3],Zr,Jr),Vo(So,Ao,Co)}function Ml(So,Co,Ao){var po=new Uint8Array(64),Ro=[wr(),wr(),wr(),wr()],Xo;for(Ao||Er(Co,32),wl(po,Co,32),po[0]&=248,po[31]&=127,po[31]|=64,Uo(Ro,po),Nl(So,Ro),Xo=0;Xo<32;Xo++)Co[Xo+32]=So[Xo];return 0}var $a=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Jo(So,Co){var Ao,po,Ro,Xo;for(po=63;po>=32;--po){for(Ao=0,Ro=po-32,Xo=po-12;Ro>4)*$a[Ro],Ao=Co[Ro]>>8,Co[Ro]&=255;for(Ro=0;Ro<32;Ro++)Co[Ro]-=Ao*$a[Ro];for(po=0;po<32;po++)Co[po+1]+=Co[po]>>8,So[po]=Co[po]&255}function Zl(So){var Co=new Float64Array(64),Ao;for(Ao=0;Ao<64;Ao++)Co[Ao]=So[Ao];for(Ao=0;Ao<64;Ao++)So[Ao]=0;Jo(So,Co)}function Cl(So,Co,Ao,po){var Ro=new Uint8Array(64),Xo=new Uint8Array(64),jo=new Uint8Array(64),Ko,Wl,$l=new Float64Array(64),El=[wr(),wr(),wr(),wr()];wl(Ro,po,32),Ro[0]&=248,Ro[31]&=127,Ro[31]|=64;var Cu=Ao+64;for(Ko=0;Ko>7&&fo(So[0],Br,So[0]),vo(So[3],So[0],So[1]),0)}function wo(So,Co,Ao,po){var Ro,Xo=new Uint8Array(32),jo=new Uint8Array(64),Ko=[wr(),wr(),wr(),wr()],Wl=[wr(),wr(),wr(),wr()];if(Ao<64||ko(Wl,po))return-1;for(Ro=0;Ro=0},br.sign.keyPair=function(){var So=new Uint8Array(Il),Co=new Uint8Array(Eu);return Ml(So,Co),{publicKey:So,secretKey:Co}},br.sign.keyPair.fromSecretKey=function(So){if(Sl(So),So.length!==Eu)throw new Error("bad secret key size");for(var Co=new Uint8Array(Il),Ao=0;Ao`https://phantom.app/ul/v1/${fr}?${br.toString()}`,decryptPayload=(fr,br,wr)=>{const Er=nacl.box.open.after(bs58$8.decode(fr),bs58$8.decode(br),wr);if(!Er)throw new Error("Unable to decrypt data");return JSON.parse(Buffer$2.from(Er).toString("utf8"))},encryptPayload=(fr,br)=>{const wr=nacl.randomBytes(24),Er=nacl.box.after(Buffer$2.from(JSON.stringify(fr)),wr,br);return[wr,Er]},GENESIS_HASHES={"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zQawwpjk2NsNY":"testnet","5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d":"mainnet-beta",EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG:"devnet"},fetchCluster=fr=>__awaiter$3(void 0,void 0,void 0,function*(){try{const{result:br}=yield(yield fetch(fr,{body:JSON.stringify({id:1,jsonrpc:"2.0",method:"getGenesisHash"}),headers:{"Content-Type":"application/json"},method:"POST"})).json();return GENESIS_HASHES[br]}catch{return"mainnet-beta"}}),storage={address:{get:()=>{var fr;return(fr=localStorage.getItem("dynamic_phantom_wallet_address"))!==null&&fr!==void 0?fr:void 0},remove:()=>{localStorage.removeItem("dynamic_phantom_wallet_address")},set:fr=>{localStorage.setItem("dynamic_phantom_wallet_address",fr.toString())}},encryptionPublicKey:{get:()=>{const fr=localStorage.getItem("dynamic_phantom_public_key");if(fr)return new Uint8Array(JSON.parse(fr))},remove:()=>{localStorage.removeItem("dynamic_phantom_public_key")},set:fr=>{localStorage.setItem("dynamic_phantom_public_key",JSON.stringify([...fr]))}},encryptionSecretKey:{get:()=>{const fr=localStorage.getItem("dynamic_phantom_secret_key");if(fr)return new Uint8Array(JSON.parse(fr))},remove:()=>{localStorage.removeItem("dynamic_phantom_secret_key")},set:fr=>{localStorage.setItem("dynamic_phantom_secret_key",JSON.stringify([...fr]))}},message:{get:()=>{var fr;return(fr=localStorage.getItem("dynamic_phantom_message_to_sign"))!==null&&fr!==void 0?fr:void 0},remove:()=>{localStorage.removeItem("dynamic_phantom_message_to_sign")},set:fr=>{localStorage.setItem("dynamic_phantom_message_to_sign",fr)}},method:{get:()=>{var fr;return(fr=localStorage.getItem("dynamic_phantom_method"))!==null&&fr!==void 0?fr:void 0},remove:()=>{localStorage.removeItem("dynamic_phantom_method")},set:fr=>{localStorage.setItem("dynamic_phantom_method",fr)}},session:{get:()=>{var fr;return(fr=localStorage.getItem("dynamic_phantom_session"))!==null&&fr!==void 0?fr:void 0},remove:()=>{localStorage.removeItem("dynamic_phantom_session")},set:fr=>{localStorage.setItem("dynamic_phantom_session",fr)}},sharedSecret:{get:()=>{const fr=localStorage.getItem("dynamic_phantom_shared_secret");if(fr)return new Uint8Array(JSON.parse(fr))},remove:()=>{localStorage.removeItem("dynamic_phantom_shared_secret")},set:fr=>{localStorage.setItem("dynamic_phantom_shared_secret",JSON.stringify([...fr]))}}},clearStorage=()=>{for(const fr in storage)storage[fr].remove()};class PhantomRedirect extends SolanaWalletConnector{constructor(br){super(Object.assign({},br)),this.name="Phantom",this.overrideKey="phantom"}getMethod(){throw new Error("Method not implemented.")}getAddress(){return __awaiter$3(this,void 0,void 0,function*(){const br=storage.address.get();if(br)return br;yield this.connect()})}connect(){return __awaiter$3(this,void 0,void 0,function*(){var br,wr;const Er=nacl.box.keyPair();storage.encryptionPublicKey.set(Er.publicKey),storage.encryptionSecretKey.set(Er.secretKey);const kr=window.location.href.includes("localhost")||window.location.href.includes("0.0.0.0")||window.location.href.includes("127.0.0.1"),jr=(wr=(br=this.solNetworks[0].privateCustomerRpcUrls)===null||br===void 0?void 0:br[0])!==null&&wr!==void 0?wr:this.solNetworks[0].rpcUrls[0],Br=new URLSearchParams({app_url:kr?"https://demo.dynamic.xyz":window.location.href,cluster:yield fetchCluster(jr),dapp_encryption_public_key:bs58$8.encode(Er.publicKey),redirect_link:window.location.href}),Wr=buildUrl("connect",Br);window.location.href=Wr})}getSession(){return __awaiter$3(this,void 0,void 0,function*(){const br=new URLSearchParams(window.location.search),{data:wr,nonce:Er,phantom_encryption_public_key:kr,encryptionSecretKey:jr}=this.getInputsOrThrow("getSession",["data","nonce","phantom_encryption_public_key"],["encryptionSecretKey"]),Br=nacl.box.before(bs58$8.decode(kr),jr);storage.sharedSecret.set(Br);const Wr=decryptPayload(wr,Er,Br);return storage.session.set(Wr.session),storage.address.set(new PublicKey$2(Wr.public_key)),br.delete("phantom_encryption_public_key"),br.delete("data"),br.delete("nonce"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${br.toString()}`),Wr.public_key})}signMessage(br){return __awaiter$3(this,void 0,void 0,function*(){const{session:wr,sharedSecret:Er,encryptionPublicKey:kr}=this.getInputsOrThrow("signMessage",[],["session","sharedSecret","encryptionPublicKey"]);storage.message.set(br);const jr={message:bs58$8.encode(Buffer$2.from(br)),session:wr},[Br,Wr]=encryptPayload(jr,Er),qr=new URLSearchParams({dapp_encryption_public_key:bs58$8.encode(kr),nonce:bs58$8.encode(Br),payload:bs58$8.encode(Wr),redirect_link:window.location.href}),Gr=buildUrl("signMessage",qr);throw storage.method.set("signMessage"),window.location.href=Gr,new Error("ignore")})}extractSignature(){const br=new URLSearchParams(window.location.search),{data:wr,nonce:Er,sharedSecret:kr,message:jr}=this.getInputsOrThrow("extractSignature",["data","nonce"],["sharedSecret","message"]),Br=decryptPayload(wr,Er,kr);return br.delete("data"),br.delete("nonce"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${br.toString()}`),{message:jr,signature:Br.signature}}extractTransactions(){const br=new URLSearchParams(window.location.search),{data:wr,nonce:Er,sharedSecret:kr}=this.getInputsOrThrow("extractTransactions",["data","nonce"],["sharedSecret"]),Br=decryptPayload(wr,Er,kr).transactions.map(Wr=>Transaction.from(bs58$8.decode(Wr)));return br.delete("data"),br.delete("nonce"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${br.toString()}`),Br}extractTransaction(){const br=new URLSearchParams(window.location.search),{data:wr,nonce:Er,sharedSecret:kr}=this.getInputsOrThrow("extractTransaction",["data","nonce"],["sharedSecret"]),jr=decryptPayload(wr,Er,kr),Br=Transaction.from(bs58$8.decode(jr.transaction));return br.delete("data"),br.delete("nonce"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${br.toString()}`),Br}consumeMethod(){const br=storage.method.get();return storage.method.remove(),br}getSigner(){return __awaiter$3(this,void 0,void 0,function*(){const br=storage.address.get();if(br)return{addListener:()=>{throw new Error("Not implemented")},connect:()=>{throw new Error("Not implemented")},disconnect:()=>{throw new Error("Not implemented")},emit:()=>{throw new Error("Not implemented")},eventNames:()=>{throw new Error("Not implemented")},isBackpack:!1,isBraveWallet:!1,isConnected:!0,isExodus:!1,isGlow:!1,isMagicEden:!1,isPhantom:!0,isSolflare:!1,listenerCount:()=>{throw new Error("Not implemented")},listeners:()=>{throw new Error("Not implemented")},off:()=>{throw new Error("Not implemented")},on:()=>{throw new Error("Not implemented")},once:()=>{throw new Error("Not implemented")},providers:[],publicKey:new PublicKey$2(br),removeAllListeners:()=>{throw new Error("Not implemented")},removeListener:()=>{throw new Error("Not implemented")},signAllTransactions:wr=>__awaiter$3(this,void 0,void 0,function*(){const Er=wr.map(Jr=>bs58$8.encode(Jr.serialize({requireAllSignatures:!1}))),{session:kr,sharedSecret:jr,encryptionPublicKey:Br}=this.getInputsOrThrow("signAllTransactions",[],["session","sharedSecret","encryptionPublicKey"]),Wr={session:kr,transactions:Er},[qr,Gr]=encryptPayload(Wr,jr),Vr=new URLSearchParams({dapp_encryption_public_key:bs58$8.encode(Br),nonce:bs58$8.encode(qr),payload:bs58$8.encode(Gr),redirect_link:window.location.href}),Zr=buildUrl("signAllTransactions",Vr);return window.location.href=Zr,[]}),signAndSendTransaction:(wr,Er)=>__awaiter$3(this,void 0,void 0,function*(){const{session:kr,sharedSecret:jr,encryptionPublicKey:Br}=this.getInputsOrThrow("signAndSendTransaction",[],["session","sharedSecret","encryptionPublicKey"]),Wr={options:Er,session:kr,transaction:bs58$8.encode(wr.serialize({requireAllSignatures:!1}))},[qr,Gr]=encryptPayload(Wr,jr),Vr=new URLSearchParams({dapp_encryption_public_key:bs58$8.encode(Br),nonce:bs58$8.encode(qr),payload:bs58$8.encode(Gr),redirect_link:window.location.href}),Zr=buildUrl("signAndSendTransaction",Vr);return storage.method.set("signAndSendTransaction"),window.location.href=Zr,{signature:""}}),signMessage:wr=>__awaiter$3(this,void 0,void 0,function*(){const{session:Er,sharedSecret:kr,encryptionPublicKey:jr}=this.getInputsOrThrow("signMessage",[],["session","sharedSecret","encryptionPublicKey"]),Br={message:bs58$8.encode(Buffer$2.from(wr)),session:Er},[Wr,qr]=encryptPayload(Br,kr),Gr=new URLSearchParams({dapp_encryption_public_key:bs58$8.encode(jr),nonce:bs58$8.encode(Wr),payload:bs58$8.encode(qr),redirect_link:window.location.href}),Vr=buildUrl("signMessage",Gr);return window.location.href=Vr,{signature:Buffer$2.from("")}}),signTransaction:wr=>__awaiter$3(this,void 0,void 0,function*(){const Er=bs58$8.encode(wr.serialize({requireAllSignatures:!1})),{session:kr,sharedSecret:jr,encryptionPublicKey:Br}=this.getInputsOrThrow("signTransaction",[],["session","sharedSecret","encryptionPublicKey"]),Wr={session:kr,transaction:Er},[qr,Gr]=encryptPayload(Wr,jr),Vr=new URLSearchParams({dapp_encryption_public_key:bs58$8.encode(Br),nonce:bs58$8.encode(qr),payload:bs58$8.encode(Gr),redirect_link:window.location.href}),Zr=buildUrl("signTransaction",Vr);return window.location.href=Zr,wr})}})}getConnectedAccounts(){return __awaiter$3(this,void 0,void 0,function*(){const br=storage.address.get();return br?[br]:[]})}endSession(){return __awaiter$3(this,void 0,void 0,function*(){const br=storage.address.get(),wr=storage.session.get(),Er=storage.sharedSecret.get(),kr=storage.encryptionPublicKey.get();if(clearStorage(),!br||!wr||!kr||!Er)return;const jr={session:wr},[Br,Wr]=encryptPayload(jr,Er),qr=new URLSearchParams({dapp_encryption_public_key:bs58$8.encode(kr),nonce:bs58$8.encode(Br),payload:bs58$8.encode(Wr),redirect_link:window.location.href}),Gr=buildUrl("disconnect",qr);window.location.href=Gr})}getInputsOrThrow(br,wr,Er){const kr={},jr=new URLSearchParams(window.location.search);return wr.forEach(Br=>{const Wr=jr.get(Br);if(!Wr)throw new Error(`[PhantomRedirect] ${br} called, but required input '${Br}' not found in query params`);kr[Br]=Wr}),Er.forEach(Br=>{const Wr=storage[Br].get();if(!Wr)throw new Error(`[PhantomRedirect] ${br} called, but required input '${Br}' not found in local storage`);kr[Br]=Wr}),kr}}class PhantomInjected extends InjectedWalletBase{constructor(br){super(br),this.name="Phantom",this.overrideKey="phantom",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getAddress(){const br=Object.create(null,{getAddress:{get:()=>super.getAddress}});return __awaiter$3(this,void 0,void 0,function*(){if(this.isInstalledOnBrowser())return br.getAddress.call(this);isMobile()&&handleMobileWalletRedirect({nativeLink:"phantom://browse",universalLink:"https://phantom.app/ul/browse"})})}canGetChainAddress(){var br,wr;return((wr=(br=this.getSolProviderHelper())===null||br===void 0?void 0:br.findProvider())===null||wr===void 0?void 0:wr.publicKey)!==null}}class Phantom extends SolanaWalletConnector{constructor(br){super(br),this.name="Phantom",this.overrideKey="phantom",this.wallet=findWalletBookWallet(this.walletBook,this.key)}connect(){return __awaiter$3(this,void 0,void 0,function*(){yield this.getMobileOrInstalledWallet().connect()})}getSigner(){return __awaiter$3(this,void 0,void 0,function*(){return this.getMobileOrInstalledWallet().getSigner()})}getMobileOrInstalledWallet(){const br=new PhantomInjected(this.constructorProps);return!isMobile()||br.isInstalledOnBrowser()?br:this.mobileExperience==="redirect"?new PhantomRedirect(this.constructorProps):new PhantomInjected(this.constructorProps)}}class CoinbaseSolana extends InjectedWalletBase{constructor(br){super(br),this.name="CoinbaseSolana",this.overrideKey="coinbasesolana",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getSigner(){return __awaiter$3(this,void 0,void 0,function*(){var br;return(br=this.getSolProviderHelper())===null||br===void 0?void 0:br.connect()})}signMessage(br){return __awaiter$3(this,void 0,void 0,function*(){const wr=yield this.getAddress();if(!wr)return;const Er=yield this.getSigner();if(!Er)return;const kr=new TextEncoder().encode(br),jr=yield Er.signMessage(kr,wr);if(jr)return bufferToBase64(isSignedMessage(jr)?jr.signature:jr)})}}class Solflare extends InjectedWalletBase{constructor(br){super(br),this.name="Solflare",this.overrideKey="solflare",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getAddress(){return __awaiter$3(this,void 0,void 0,function*(){var br,wr,Er,kr,jr;if(isMobile()&&!this.isInstalledOnBrowser()){handleMobileWalletRedirect({nativeLink:((wr=(br=this.wallet)===null||br===void 0?void 0:br.mobile)===null||wr===void 0?void 0:wr.native)||"solflare://ul/v1/browse",universalLink:((kr=(Er=this.wallet)===null||Er===void 0?void 0:Er.mobile)===null||kr===void 0?void 0:kr.universal)||"https://solflare.com/ul/v1/browse"});return}return(jr=this.getSolProviderHelper())===null||jr===void 0?void 0:jr.getAddress()})}signMessage(br){return __awaiter$3(this,void 0,void 0,function*(){if(!(yield this.getAddress()))return;const Er=yield this.getSigner();if(!Er)return;const kr=new TextEncoder().encode(br),jr=Wr=>Wr.signature!==void 0;yield Er.connect(),yield new Promise(Wr=>{setTimeout(Wr,100)});const Br=yield Er.signMessage(kr,"utf8");return jr(Br)?bufferToBase64(Br.signature):void 0})}}const isVersionedTransaction=fr=>!("instructions"in fr),createSolanaSignerFromWalletStandard=(fr,br)=>{const wr=fr.features,Er=()=>__awaiter$3(void 0,void 0,void 0,function*(){const Gr=yield br.getAddress(),Vr=fr.accounts.find(Zr=>Zr.address===Gr);if(!Vr)throw new Error("Account not found");return Vr}),kr=()=>__awaiter$3(void 0,void 0,void 0,function*(){var Gr,Vr;const Zr=(Vr=(Gr=br.solNetworks[0].privateCustomerRpcUrls)===null||Gr===void 0?void 0:Gr[0])!==null&&Vr!==void 0?Vr:br.solNetworks[0].rpcUrls[0];return`solana:${yield fetchCluster(Zr)}`}),jr=Gr=>__awaiter$3(void 0,void 0,void 0,function*(){const Vr=yield Er(),Zr=yield wr["solana:signTransaction"].signTransaction({account:Vr,chain:yield kr(),transaction:Gr.serialize({requireAllSignatures:!1})});return isVersionedTransaction(Gr)?VersionedTransaction.deserialize(Zr[0].signedTransaction):Transaction.from(Zr[0].signedTransaction)});return{addListener:()=>{throw new Error("Not implemented")},connect:()=>{throw new Error("Not implemented")},disconnect:()=>br.endSession(),emit:()=>{throw new Error("Not implemented")},eventNames:()=>{throw new Error("Not implemented")},isBackpack:!1,isBraveWallet:!1,isConnected:!0,isExodus:!1,isGlow:!1,isMagicEden:!1,isPhantom:!1,isSolflare:!1,listenerCount:()=>{throw new Error("Not implemented")},listeners:()=>{throw new Error("Not implemented")},off:()=>{throw new Error("Not implemented")},on:()=>{throw new Error("Not implemented")},once:()=>{throw new Error("Not implemented")},providers:[],get publicKey(){return new PublicKey$2(fr.accounts[0].publicKey)},removeAllListeners:()=>{throw new Error("Not implemented")},removeListener:()=>{throw new Error("Not implemented")},send:()=>{throw new Error("Not implemented")},signAllTransactions:Gr=>__awaiter$3(void 0,void 0,void 0,function*(){return Promise.all(Gr.map(jr))}),signAndSendTransaction:Gr=>__awaiter$3(void 0,void 0,void 0,function*(){const Vr=yield Er(),Zr=yield wr["solana:signAndSendTransaction"].signAndSendTransaction({account:Vr,chain:yield kr(),transaction:Gr.serialize()}),[{signature:Jr}]=Zr;return{signature:new TextDecoder().decode(Jr)}}),signMessage:Gr=>__awaiter$3(void 0,void 0,void 0,function*(){const Vr=yield Er();return{signature:(yield wr["solana:signMessage"].signMessage({account:Vr,message:Gr}))[0].signature}}),signTransaction:jr}},encoder=new TextEncoder;class SolanaWalletStandardConnector extends SolanaWalletConnector{constructor(br){super(br),this.connectedChain="SOL",this.supportedChains=["SOL"]}get wallet(){const br=SolanaWalletStandardConnector.getWallet(this.walletBook,this.key);if(!br)throw new Error("Wallet not found");return br}get walletFeatures(){return this.wallet.features}connect(){return __awaiter$3(this,void 0,void 0,function*(){yield this.walletFeatures["standard:connect"].connect()})}endSession(){return __awaiter$3(this,void 0,void 0,function*(){yield this.walletFeatures["standard:disconnect"].disconnect()})}isInstalledOnBrowser(){return!0}getAddress(){return __awaiter$3(this,void 0,void 0,function*(){yield this.connect();const[br]=yield this.getConnectedAccounts();return br})}getConnectedAccounts(){return __awaiter$3(this,void 0,void 0,function*(){return this.wallet.accounts.map(wr=>wr.address)})}signMessage(br){return __awaiter$3(this,void 0,void 0,function*(){const wr=yield this.getSigner();if(!wr)throw new Error("Signer not found");const Er=encoder.encode(br),{signature:kr}=yield wr.signMessage(Er);if(!(kr instanceof Uint8Array))throw new Error("Signature not found");return Buffer$2.from(kr).toString("base64")})}getSigner(){return __awaiter$3(this,void 0,void 0,function*(){const{wallet:br}=this;return createSolanaSignerFromWalletStandard(br,this)})}static getWallet(br,wr){var Er,kr;const jr=getWallets().get(),Br=(Er=br.wallets[wr].injectedConfig)===null||Er===void 0?void 0:Er.find(Gr=>Gr.chain==="sol");if(!Br)return;const{features:Wr}=(kr=Br.walletStandard)!==null&&kr!==void 0?kr:{};return Wr?jr.find(Gr=>{var Vr;return Gr.name===((Vr=Br.walletStandard)===null||Vr===void 0?void 0:Vr.name)?Wr.reduce((Qr,_n)=>{const En=Object.keys(Gr.features);return Qr?En.includes(_n):!1},!0):!1}):void 0}}class BackpackSol extends InjectedWalletBase{constructor(br){super(br),this.name="Backpack",this.overrideKey="backpacksol",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getSigner(){return __awaiter$3(this,void 0,void 0,function*(){var br;return(br=this.getSolProviderHelper())===null||br===void 0?void 0:br.connect()})}signMessage(br){return __awaiter$3(this,void 0,void 0,function*(){if(!(yield this.getAddress()))return;const Er=yield this.getSigner();if(!Er)return;const kr=yield Er.signMessage(Buffer$2.from(br,"utf8"));if(kr)return typeof kr=="object"&&"signature"in kr?bufferToBase64(kr.signature):bufferToBase64(kr)})}}const injectedWalletOverrides=[CoinbaseSolana,BackpackSol,Solflare],filteredInjectedWalletKeysOverrides=["coinbasesolana","phantom","phantomledger","backpacksol","solflare"],fetchInjectedWalletConnectors=({walletBook:fr})=>{var br;return Object.entries((br=fr==null?void 0:fr.wallets)!==null&&br!==void 0?br:{}).filter(([wr,Er])=>{var kr;const jr=!!(!((kr=Er.injectedConfig)===null||kr===void 0)&&kr.find(Wr=>Wr.chain==="sol")),Br=filteredInjectedWalletKeysOverrides.includes(wr);return jr&&!Br}).map(([wr,Er])=>{var kr;const{shortName:jr}=Er,Br=jr||Er.name;return!!(!((kr=Er.injectedConfig)===null||kr===void 0)&&kr.find(qr=>qr.walletStandard))&&!!SolanaWalletStandardConnector.getWallet(fr,wr)?class extends SolanaWalletStandardConnector{constructor(Gr){super(Object.assign({},Gr)),this.name=Br,this.overrideKey=wr}}:class extends InjectedWalletBase{constructor(qr){super(Object.assign({},qr)),this.name=Br,this.wallet=Er,this.overrideKey=wr}}})};class UnknownInjected extends InjectedWalletBase{constructor(br){super(br),this.name="Unknown",this.overrideKey="unknown",this.wallet=findWalletBookWallet(this.walletBook,this.key)}isInstalledOnBrowser(){return!1}}class FallbackSolanaConnector extends InjectedWalletBase{constructor(br){super(br),this.name="Fallback Connector",this.overrideKey="fallbackconnector",this.isAvailable=!1,this.wallet=findWalletBookWallet(this.walletBook,this.key)}isInstalledOnBrowser(){return!1}}const SolanaWalletConnectors=fr=>[...injectedWalletOverrides,...fetchInjectedWalletConnectors(fr),...TurnkeySolanaWalletConnectors(fr),Phantom,UnknownInjected,FallbackSolanaConnector];assertPackageVersion("@dynamic-labs/solana",version$7);client$1.createRoot(document.getElementById("root")).render(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(DynamicContextProvider,{theme:"dark",settings:{initialAuthenticationMode:"connect-only",environmentId:"7a6006b6-fa19-4e7a-abcf-34add623dff5",walletConnectors:[EthereumWalletConnectors,SolanaWalletConnectors]},children:jsxRuntimeExports.jsx(App,{})})}));export{Buffer$2 as B,DEFAULT_JWK_MEMBER_BYTE_LENGTH as D,Field as F,__vitePreload as _,uint8ArrayFromHexString as a,createHash as b,createCurve as c,dijkstraExports as d,encodeUtf8$1 as e,global$1 as g,hexStringToBase64url as h,requireCryptoBrowserify as r,sha256$3 as s,uint8ArrayToHexString as u}; + You can read more about it here https://github.com/solana-labs/solana/issues/21366`)}}class InjectedWalletBase extends SolanaWalletConnector{getSolProviderHelper(){return this.wallet||(this.wallet=findWalletBookWallet(this.walletBook,this.key)),this.wallet&&!this.solProviderHelper&&(this.solProviderHelper=new SolProviderHelper(this.wallet)),this.solProviderHelper}getProvider(){var br;return(br=this.getSolProviderHelper())===null||br===void 0?void 0:br.getInstalledProvider()}setupEventListeners(){var br;(br=this.getSolProviderHelper())===null||br===void 0||br._setupEventListeners(this)}teardownEventListeners(){var br;(br=this.getSolProviderHelper())===null||br===void 0||br._teardownEventListeners()}connect(){return __awaiter$3(this,void 0,void 0,function*(){var br;yield(br=this.getSolProviderHelper())===null||br===void 0?void 0:br.connect()})}getSigner(){return __awaiter$3(this,void 0,void 0,function*(){var br;return(br=this.getSolProviderHelper())===null||br===void 0?void 0:br.connect()})}createUiTransaction(br){return __awaiter$3(this,void 0,void 0,function*(){return yield this.validateActiveWallet(br),new SolanaUiTransaction$1({connection:this.getWalletClient(),from:br,onSubmit:Er=>__awaiter$3(this,void 0,void 0,function*(){var kr;if(!Er)return;const jr=yield this.getSigner();if(!jr)throw new Error("Signer not found");const Br=yield this.getWalletClient().getLatestBlockhash();if("version"in Er)Er.message.recentBlockhash=Br.blockhash;else{const Wr=yield this.getAddress();if(!Wr)throw new Error("User address not found");Er.recentBlockhash=Br.blockhash,Er.feePayer=(kr=Er.feePayer)!==null&&kr!==void 0?kr:new PublicKey$2(Wr)}return(yield jr.signAndSendTransaction(Er)).signature})})})}isInstalledOnBrowser(){var br;return!!(!((br=this.getSolProviderHelper())===null||br===void 0)&&br.isInstalledHelper())}getAddress(){return __awaiter$3(this,void 0,void 0,function*(){var br,wr;if(!this.isInstalledOnBrowser()){if(isMobile()&&(!((br=this.wallet)===null||br===void 0)&&br.mobile)&&this.wallet.mobile.inAppBrowser&&this.mobileExperience==="in-app-browser"){const kr=template(this.wallet.mobile.inAppBrowser)({encodedDappURI:encodeURIComponent(window.location.toString())});window.location.assign(kr)}return}return(wr=this.getSolProviderHelper())===null||wr===void 0?void 0:wr.getAddress()})}signMessage(br){return __awaiter$3(this,void 0,void 0,function*(){var wr,Er;const kr=yield(wr=this.getSolProviderHelper())===null||wr===void 0?void 0:wr.getAddress();if(kr&&this.isLedgerAddress(kr))throw new SignMessageNotSupportedError(this.name);return(Er=this.getSolProviderHelper())===null||Er===void 0?void 0:Er.signMessage(br)})}getConnectedAccounts(){return __awaiter$3(this,void 0,void 0,function*(){var br,wr;return(wr=(br=this.getSolProviderHelper())===null||br===void 0?void 0:br.getConnectedAccounts())!==null&&wr!==void 0?wr:[]})}}var version$4="3.8.2",dependencies={"@dynamic-labs/sdk-api-core":"0.0.570","@dynamic-labs/utils":"3.8.2","@dynamic-labs/logger":"3.8.2","@dynamic-labs/types":"3.8.2",eventemitter3:"5.0.1","@solana/web3.js":"1.92.1","@turnkey/http":"2.12.2","@turnkey/iframe-stamper":"2.0.0","@turnkey/solana":"0.3.9","@turnkey/webauthn-stamper":"0.5.0"};function __rest$1(fr,br){var wr={};for(var Er in fr)Object.prototype.hasOwnProperty.call(fr,Er)&&br.indexOf(Er)<0&&(wr[Er]=fr[Er]);if(fr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var kr=0,Er=Object.getOwnPropertySymbols(fr);kr0?Hr:Xr},jr.min=function(Hr,Xr){return Hr.cmp(Xr)<0?Hr:Xr},jr.prototype._init=function(Hr,Xr,Sn){if(typeof Hr=="number")return this._initNumber(Hr,Xr,Sn);if(typeof Hr=="object")return this._initArray(Hr,Xr,Sn);Xr==="hex"&&(Xr=16),Er(Xr===(Xr|0)&&Xr>=2&&Xr<=36),Hr=Hr.toString().replace(/\s+/g,"");var Rn=0;Hr[0]==="-"&&(Rn++,this.negative=1),Rn=0;Rn-=3)On=Hr[Rn]|Hr[Rn-1]<<8|Hr[Rn-2]<<16,this.words[Pn]|=On<>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);else if(Sn==="le")for(Rn=0,Pn=0;Rn>>26-Zn&67108863,Zn+=24,Zn>=26&&(Zn-=26,Pn++);return this._strip()};function Wr(Tn,Hr){var Xr=Tn.charCodeAt(Hr);if(Xr>=48&&Xr<=57)return Xr-48;if(Xr>=65&&Xr<=70)return Xr-55;if(Xr>=97&&Xr<=102)return Xr-87;Er(!1,"Invalid character in "+Tn)}function qr(Tn,Hr,Xr){var Sn=Wr(Tn,Xr);return Xr-1>=Hr&&(Sn|=Wr(Tn,Xr-1)<<4),Sn}jr.prototype._parseHex=function(Hr,Xr,Sn){this.length=Math.ceil((Hr.length-Xr)/6),this.words=new Array(this.length);for(var Rn=0;Rn=Xr;Rn-=2)Zn=qr(Hr,Xr,Rn)<=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8;else{var Nn=Hr.length-Xr;for(Rn=Nn%2===0?Xr+1:Xr;Rn=18?(Pn-=18,On+=1,this.words[On]|=Zn>>>26):Pn+=8}this._strip()};function Gr(Tn,Hr,Xr,Sn){for(var Rn=0,Pn=0,On=Math.min(Tn.length,Xr),Zn=Hr;Zn=49?Pn=Nn-49+10:Nn>=17?Pn=Nn-17+10:Pn=Nn,Er(Nn>=0&&Pn1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},jr.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{jr.prototype[Symbol.for("nodejs.util.inspect.custom")]=Zr}catch{jr.prototype.inspect=Zr}else jr.prototype.inspect=Zr;function Zr(){return(this.red?""}var Jr=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],Qr=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_n=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];jr.prototype.toString=function(Hr,Xr){Hr=Hr||10,Xr=Xr|0||1;var Sn;if(Hr===16||Hr==="hex"){Sn="";for(var Rn=0,Pn=0,On=0;On>>24-Rn&16777215,Rn+=2,Rn>=26&&(Rn-=26,On--),Pn!==0||On!==this.length-1?Sn=Jr[6-Nn.length]+Nn+Sn:Sn=Nn+Sn}for(Pn!==0&&(Sn=Pn.toString(16)+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}if(Hr===(Hr|0)&&Hr>=2&&Hr<=36){var wn=Qr[Hr],zn=_n[Hr];Sn="";var fo=this.clone();for(fo.negative=0;!fo.isZero();){var vo=fo.modrn(zn).toString(Hr);fo=fo.idivn(zn),fo.isZero()?Sn=vo+Sn:Sn=Jr[wn-vo.length]+vo+Sn}for(this.isZero()&&(Sn="0"+Sn);Sn.length%Xr!==0;)Sn="0"+Sn;return this.negative!==0&&(Sn="-"+Sn),Sn}Er(!1,"Base should be between 2 and 36")},jr.prototype.toNumber=function(){var Hr=this.words[0];return this.length===2?Hr+=this.words[1]*67108864:this.length===3&&this.words[2]===1?Hr+=4503599627370496+this.words[1]*67108864:this.length>2&&Er(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-Hr:Hr},jr.prototype.toJSON=function(){return this.toString(16,2)},Br&&(jr.prototype.toBuffer=function(Hr,Xr){return this.toArrayLike(Br,Hr,Xr)}),jr.prototype.toArray=function(Hr,Xr){return this.toArrayLike(Array,Hr,Xr)};var En=function(Hr,Xr){return Hr.allocUnsafe?Hr.allocUnsafe(Xr):new Hr(Xr)};jr.prototype.toArrayLike=function(Hr,Xr,Sn){this._strip();var Rn=this.byteLength(),Pn=Sn||Math.max(1,Rn);Er(Rn<=Pn,"byte array longer than desired length"),Er(Pn>0,"Requested array length <= 0");var On=En(Hr,Pn),Zn=Xr==="le"?"LE":"BE";return this["_toArrayLike"+Zn](On,Rn),On},jr.prototype._toArrayLikeLE=function(Hr,Xr){for(var Sn=0,Rn=0,Pn=0,On=0;Pn>8&255),Sn>16&255),On===6?(Sn>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn=0&&(Hr[Sn--]=Zn>>8&255),Sn>=0&&(Hr[Sn--]=Zn>>16&255),On===6?(Sn>=0&&(Hr[Sn--]=Zn>>24&255),Rn=0,On=0):(Rn=Zn>>>24,On+=2)}if(Sn>=0)for(Hr[Sn--]=Rn;Sn>=0;)Hr[Sn--]=0},Math.clz32?jr.prototype._countBits=function(Hr){return 32-Math.clz32(Hr)}:jr.prototype._countBits=function(Hr){var Xr=Hr,Sn=0;return Xr>=4096&&(Sn+=13,Xr>>>=13),Xr>=64&&(Sn+=7,Xr>>>=7),Xr>=8&&(Sn+=4,Xr>>>=4),Xr>=2&&(Sn+=2,Xr>>>=2),Sn+Xr},jr.prototype._zeroBits=function(Hr){if(Hr===0)return 26;var Xr=Hr,Sn=0;return Xr&8191||(Sn+=13,Xr>>>=13),Xr&127||(Sn+=7,Xr>>>=7),Xr&15||(Sn+=4,Xr>>>=4),Xr&3||(Sn+=2,Xr>>>=2),Xr&1||Sn++,Sn},jr.prototype.bitLength=function(){var Hr=this.words[this.length-1],Xr=this._countBits(Hr);return(this.length-1)*26+Xr};function Cn(Tn){for(var Hr=new Array(Tn.bitLength()),Xr=0;Xr>>Rn&1}return Hr}jr.prototype.zeroBits=function(){if(this.isZero())return 0;for(var Hr=0,Xr=0;XrHr.length?this.clone().ior(Hr):Hr.clone().ior(this)},jr.prototype.uor=function(Hr){return this.length>Hr.length?this.clone().iuor(Hr):Hr.clone().iuor(this)},jr.prototype.iuand=function(Hr){var Xr;this.length>Hr.length?Xr=Hr:Xr=this;for(var Sn=0;SnHr.length?this.clone().iand(Hr):Hr.clone().iand(this)},jr.prototype.uand=function(Hr){return this.length>Hr.length?this.clone().iuand(Hr):Hr.clone().iuand(this)},jr.prototype.iuxor=function(Hr){var Xr,Sn;this.length>Hr.length?(Xr=this,Sn=Hr):(Xr=Hr,Sn=this);for(var Rn=0;RnHr.length?this.clone().ixor(Hr):Hr.clone().ixor(this)},jr.prototype.uxor=function(Hr){return this.length>Hr.length?this.clone().iuxor(Hr):Hr.clone().iuxor(this)},jr.prototype.inotn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Math.ceil(Hr/26)|0,Sn=Hr%26;this._expand(Xr),Sn>0&&Xr--;for(var Rn=0;Rn0&&(this.words[Rn]=~this.words[Rn]&67108863>>26-Sn),this._strip()},jr.prototype.notn=function(Hr){return this.clone().inotn(Hr)},jr.prototype.setn=function(Hr,Xr){Er(typeof Hr=="number"&&Hr>=0);var Sn=Hr/26|0,Rn=Hr%26;return this._expand(Sn+1),Xr?this.words[Sn]=this.words[Sn]|1<Hr.length?(Sn=this,Rn=Hr):(Sn=Hr,Rn=this);for(var Pn=0,On=0;On>>26;for(;Pn!==0&&On>>26;if(this.length=Sn.length,Pn!==0)this.words[this.length]=Pn,this.length++;else if(Sn!==this)for(;OnHr.length?this.clone().iadd(Hr):Hr.clone().iadd(this)},jr.prototype.isub=function(Hr){if(Hr.negative!==0){Hr.negative=0;var Xr=this.iadd(Hr);return Hr.negative=1,Xr._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(Hr),this.negative=1,this._normSign();var Sn=this.cmp(Hr);if(Sn===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Rn,Pn;Sn>0?(Rn=this,Pn=Hr):(Rn=Hr,Pn=this);for(var On=0,Zn=0;Zn>26,this.words[Zn]=Xr&67108863;for(;On!==0&&Zn>26,this.words[Zn]=Xr&67108863;if(On===0&&Zn>>26,fo=Nn&67108863,vo=Math.min(wn,Hr.length-1),go=Math.max(0,wn-Tn.length+1);go<=vo;go++){var uo=wn-go|0;Rn=Tn.words[uo]|0,Pn=Hr.words[go]|0,On=Rn*Pn+fo,zn+=On/67108864|0,fo=On&67108863}Xr.words[wn]=fo|0,Nn=zn|0}return Nn!==0?Xr.words[wn]=Nn|0:Xr.length--,Xr._strip()}var An=function(Hr,Xr,Sn){var Rn=Hr.words,Pn=Xr.words,On=Sn.words,Zn=0,Nn,wn,zn,fo=Rn[0]|0,vo=fo&8191,go=fo>>>13,uo=Rn[1]|0,lo=uo&8191,Eo=uo>>>13,mo=Rn[2]|0,yo=mo&8191,_o=mo>>>13,Bo=Rn[3]|0,Lo=Bo&8191,Wo=Bo>>>13,na=Rn[4]|0,qo=na&8191,ga=na>>>13,wl=Rn[5]|0,No=wl&8191,Uo=wl>>>13,Nl=Rn[6]|0,Vo=Nl&8191,Fo=Nl>>>13,Ol=Rn[7]|0,$a=Ol&8191,Jo=Ol>>>13,Zl=Rn[8]|0,Cl=Zl&8191,ko=Zl>>>13,wo=Rn[9]|0,bo=wo&8191,Io=wo>>>13,Ho=Pn[0]|0,Do=Ho&8191,zo=Ho>>>13,nu=Pn[1]|0,Ll=nu&8191,_l=nu>>>13,bu=Pn[2]|0,xl=bu&8191,Tl=bu>>>13,du=Pn[3]|0,Bl=du&8191,Il=du>>>13,Eu=Pn[4]|0,Al=Eu&8191,Ml=Eu>>>13,Tu=Pn[5]|0,Fl=Tu&8191,Sl=Tu>>>13,_u=Pn[6]|0,So=_u&8191,Co=_u>>>13,Ao=Pn[7]|0,po=Ao&8191,Ro=Ao>>>13,Xo=Pn[8]|0,jo=Xo&8191,Ko=Xo>>>13,Wl=Pn[9]|0,$l=Wl&8191,El=Wl>>>13;Sn.negative=Hr.negative^Xr.negative,Sn.length=19,Nn=Math.imul(vo,Do),wn=Math.imul(vo,zo),wn=wn+Math.imul(go,Do)|0,zn=Math.imul(go,zo);var Cu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Cu>>>26)|0,Cu&=67108863,Nn=Math.imul(lo,Do),wn=Math.imul(lo,zo),wn=wn+Math.imul(Eo,Do)|0,zn=Math.imul(Eo,zo),Nn=Nn+Math.imul(vo,Ll)|0,wn=wn+Math.imul(vo,_l)|0,wn=wn+Math.imul(go,Ll)|0,zn=zn+Math.imul(go,_l)|0;var iu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(iu>>>26)|0,iu&=67108863,Nn=Math.imul(yo,Do),wn=Math.imul(yo,zo),wn=wn+Math.imul(_o,Do)|0,zn=Math.imul(_o,zo),Nn=Nn+Math.imul(lo,Ll)|0,wn=wn+Math.imul(lo,_l)|0,wn=wn+Math.imul(Eo,Ll)|0,zn=zn+Math.imul(Eo,_l)|0,Nn=Nn+Math.imul(vo,xl)|0,wn=wn+Math.imul(vo,Tl)|0,wn=wn+Math.imul(go,xl)|0,zn=zn+Math.imul(go,Tl)|0;var pu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(pu>>>26)|0,pu&=67108863,Nn=Math.imul(Lo,Do),wn=Math.imul(Lo,zo),wn=wn+Math.imul(Wo,Do)|0,zn=Math.imul(Wo,zo),Nn=Nn+Math.imul(yo,Ll)|0,wn=wn+Math.imul(yo,_l)|0,wn=wn+Math.imul(_o,Ll)|0,zn=zn+Math.imul(_o,_l)|0,Nn=Nn+Math.imul(lo,xl)|0,wn=wn+Math.imul(lo,Tl)|0,wn=wn+Math.imul(Eo,xl)|0,zn=zn+Math.imul(Eo,Tl)|0,Nn=Nn+Math.imul(vo,Bl)|0,wn=wn+Math.imul(vo,Il)|0,wn=wn+Math.imul(go,Bl)|0,zn=zn+Math.imul(go,Il)|0;var yu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(yu>>>26)|0,yu&=67108863,Nn=Math.imul(qo,Do),wn=Math.imul(qo,zo),wn=wn+Math.imul(ga,Do)|0,zn=Math.imul(ga,zo),Nn=Nn+Math.imul(Lo,Ll)|0,wn=wn+Math.imul(Lo,_l)|0,wn=wn+Math.imul(Wo,Ll)|0,zn=zn+Math.imul(Wo,_l)|0,Nn=Nn+Math.imul(yo,xl)|0,wn=wn+Math.imul(yo,Tl)|0,wn=wn+Math.imul(_o,xl)|0,zn=zn+Math.imul(_o,Tl)|0,Nn=Nn+Math.imul(lo,Bl)|0,wn=wn+Math.imul(lo,Il)|0,wn=wn+Math.imul(Eo,Bl)|0,zn=zn+Math.imul(Eo,Il)|0,Nn=Nn+Math.imul(vo,Al)|0,wn=wn+Math.imul(vo,Ml)|0,wn=wn+Math.imul(go,Al)|0,zn=zn+Math.imul(go,Ml)|0;var hu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(hu>>>26)|0,hu&=67108863,Nn=Math.imul(No,Do),wn=Math.imul(No,zo),wn=wn+Math.imul(Uo,Do)|0,zn=Math.imul(Uo,zo),Nn=Nn+Math.imul(qo,Ll)|0,wn=wn+Math.imul(qo,_l)|0,wn=wn+Math.imul(ga,Ll)|0,zn=zn+Math.imul(ga,_l)|0,Nn=Nn+Math.imul(Lo,xl)|0,wn=wn+Math.imul(Lo,Tl)|0,wn=wn+Math.imul(Wo,xl)|0,zn=zn+Math.imul(Wo,Tl)|0,Nn=Nn+Math.imul(yo,Bl)|0,wn=wn+Math.imul(yo,Il)|0,wn=wn+Math.imul(_o,Bl)|0,zn=zn+Math.imul(_o,Il)|0,Nn=Nn+Math.imul(lo,Al)|0,wn=wn+Math.imul(lo,Ml)|0,wn=wn+Math.imul(Eo,Al)|0,zn=zn+Math.imul(Eo,Ml)|0,Nn=Nn+Math.imul(vo,Fl)|0,wn=wn+Math.imul(vo,Sl)|0,wn=wn+Math.imul(go,Fl)|0,zn=zn+Math.imul(go,Sl)|0;var mu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(mu>>>26)|0,mu&=67108863,Nn=Math.imul(Vo,Do),wn=Math.imul(Vo,zo),wn=wn+Math.imul(Fo,Do)|0,zn=Math.imul(Fo,zo),Nn=Nn+Math.imul(No,Ll)|0,wn=wn+Math.imul(No,_l)|0,wn=wn+Math.imul(Uo,Ll)|0,zn=zn+Math.imul(Uo,_l)|0,Nn=Nn+Math.imul(qo,xl)|0,wn=wn+Math.imul(qo,Tl)|0,wn=wn+Math.imul(ga,xl)|0,zn=zn+Math.imul(ga,Tl)|0,Nn=Nn+Math.imul(Lo,Bl)|0,wn=wn+Math.imul(Lo,Il)|0,wn=wn+Math.imul(Wo,Bl)|0,zn=zn+Math.imul(Wo,Il)|0,Nn=Nn+Math.imul(yo,Al)|0,wn=wn+Math.imul(yo,Ml)|0,wn=wn+Math.imul(_o,Al)|0,zn=zn+Math.imul(_o,Ml)|0,Nn=Nn+Math.imul(lo,Fl)|0,wn=wn+Math.imul(lo,Sl)|0,wn=wn+Math.imul(Eo,Fl)|0,zn=zn+Math.imul(Eo,Sl)|0,Nn=Nn+Math.imul(vo,So)|0,wn=wn+Math.imul(vo,Co)|0,wn=wn+Math.imul(go,So)|0,zn=zn+Math.imul(go,Co)|0;var vu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(vu>>>26)|0,vu&=67108863,Nn=Math.imul($a,Do),wn=Math.imul($a,zo),wn=wn+Math.imul(Jo,Do)|0,zn=Math.imul(Jo,zo),Nn=Nn+Math.imul(Vo,Ll)|0,wn=wn+Math.imul(Vo,_l)|0,wn=wn+Math.imul(Fo,Ll)|0,zn=zn+Math.imul(Fo,_l)|0,Nn=Nn+Math.imul(No,xl)|0,wn=wn+Math.imul(No,Tl)|0,wn=wn+Math.imul(Uo,xl)|0,zn=zn+Math.imul(Uo,Tl)|0,Nn=Nn+Math.imul(qo,Bl)|0,wn=wn+Math.imul(qo,Il)|0,wn=wn+Math.imul(ga,Bl)|0,zn=zn+Math.imul(ga,Il)|0,Nn=Nn+Math.imul(Lo,Al)|0,wn=wn+Math.imul(Lo,Ml)|0,wn=wn+Math.imul(Wo,Al)|0,zn=zn+Math.imul(Wo,Ml)|0,Nn=Nn+Math.imul(yo,Fl)|0,wn=wn+Math.imul(yo,Sl)|0,wn=wn+Math.imul(_o,Fl)|0,zn=zn+Math.imul(_o,Sl)|0,Nn=Nn+Math.imul(lo,So)|0,wn=wn+Math.imul(lo,Co)|0,wn=wn+Math.imul(Eo,So)|0,zn=zn+Math.imul(Eo,Co)|0,Nn=Nn+Math.imul(vo,po)|0,wn=wn+Math.imul(vo,Ro)|0,wn=wn+Math.imul(go,po)|0,zn=zn+Math.imul(go,Ro)|0;var fu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(fu>>>26)|0,fu&=67108863,Nn=Math.imul(Cl,Do),wn=Math.imul(Cl,zo),wn=wn+Math.imul(ko,Do)|0,zn=Math.imul(ko,zo),Nn=Nn+Math.imul($a,Ll)|0,wn=wn+Math.imul($a,_l)|0,wn=wn+Math.imul(Jo,Ll)|0,zn=zn+Math.imul(Jo,_l)|0,Nn=Nn+Math.imul(Vo,xl)|0,wn=wn+Math.imul(Vo,Tl)|0,wn=wn+Math.imul(Fo,xl)|0,zn=zn+Math.imul(Fo,Tl)|0,Nn=Nn+Math.imul(No,Bl)|0,wn=wn+Math.imul(No,Il)|0,wn=wn+Math.imul(Uo,Bl)|0,zn=zn+Math.imul(Uo,Il)|0,Nn=Nn+Math.imul(qo,Al)|0,wn=wn+Math.imul(qo,Ml)|0,wn=wn+Math.imul(ga,Al)|0,zn=zn+Math.imul(ga,Ml)|0,Nn=Nn+Math.imul(Lo,Fl)|0,wn=wn+Math.imul(Lo,Sl)|0,wn=wn+Math.imul(Wo,Fl)|0,zn=zn+Math.imul(Wo,Sl)|0,Nn=Nn+Math.imul(yo,So)|0,wn=wn+Math.imul(yo,Co)|0,wn=wn+Math.imul(_o,So)|0,zn=zn+Math.imul(_o,Co)|0,Nn=Nn+Math.imul(lo,po)|0,wn=wn+Math.imul(lo,Ro)|0,wn=wn+Math.imul(Eo,po)|0,zn=zn+Math.imul(Eo,Ro)|0,Nn=Nn+Math.imul(vo,jo)|0,wn=wn+Math.imul(vo,Ko)|0,wn=wn+Math.imul(go,jo)|0,zn=zn+Math.imul(go,Ko)|0;var gu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(gu>>>26)|0,gu&=67108863,Nn=Math.imul(bo,Do),wn=Math.imul(bo,zo),wn=wn+Math.imul(Io,Do)|0,zn=Math.imul(Io,zo),Nn=Nn+Math.imul(Cl,Ll)|0,wn=wn+Math.imul(Cl,_l)|0,wn=wn+Math.imul(ko,Ll)|0,zn=zn+Math.imul(ko,_l)|0,Nn=Nn+Math.imul($a,xl)|0,wn=wn+Math.imul($a,Tl)|0,wn=wn+Math.imul(Jo,xl)|0,zn=zn+Math.imul(Jo,Tl)|0,Nn=Nn+Math.imul(Vo,Bl)|0,wn=wn+Math.imul(Vo,Il)|0,wn=wn+Math.imul(Fo,Bl)|0,zn=zn+Math.imul(Fo,Il)|0,Nn=Nn+Math.imul(No,Al)|0,wn=wn+Math.imul(No,Ml)|0,wn=wn+Math.imul(Uo,Al)|0,zn=zn+Math.imul(Uo,Ml)|0,Nn=Nn+Math.imul(qo,Fl)|0,wn=wn+Math.imul(qo,Sl)|0,wn=wn+Math.imul(ga,Fl)|0,zn=zn+Math.imul(ga,Sl)|0,Nn=Nn+Math.imul(Lo,So)|0,wn=wn+Math.imul(Lo,Co)|0,wn=wn+Math.imul(Wo,So)|0,zn=zn+Math.imul(Wo,Co)|0,Nn=Nn+Math.imul(yo,po)|0,wn=wn+Math.imul(yo,Ro)|0,wn=wn+Math.imul(_o,po)|0,zn=zn+Math.imul(_o,Ro)|0,Nn=Nn+Math.imul(lo,jo)|0,wn=wn+Math.imul(lo,Ko)|0,wn=wn+Math.imul(Eo,jo)|0,zn=zn+Math.imul(Eo,Ko)|0,Nn=Nn+Math.imul(vo,$l)|0,wn=wn+Math.imul(vo,El)|0,wn=wn+Math.imul(go,$l)|0,zn=zn+Math.imul(go,El)|0;var ou=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(ou>>>26)|0,ou&=67108863,Nn=Math.imul(bo,Ll),wn=Math.imul(bo,_l),wn=wn+Math.imul(Io,Ll)|0,zn=Math.imul(Io,_l),Nn=Nn+Math.imul(Cl,xl)|0,wn=wn+Math.imul(Cl,Tl)|0,wn=wn+Math.imul(ko,xl)|0,zn=zn+Math.imul(ko,Tl)|0,Nn=Nn+Math.imul($a,Bl)|0,wn=wn+Math.imul($a,Il)|0,wn=wn+Math.imul(Jo,Bl)|0,zn=zn+Math.imul(Jo,Il)|0,Nn=Nn+Math.imul(Vo,Al)|0,wn=wn+Math.imul(Vo,Ml)|0,wn=wn+Math.imul(Fo,Al)|0,zn=zn+Math.imul(Fo,Ml)|0,Nn=Nn+Math.imul(No,Fl)|0,wn=wn+Math.imul(No,Sl)|0,wn=wn+Math.imul(Uo,Fl)|0,zn=zn+Math.imul(Uo,Sl)|0,Nn=Nn+Math.imul(qo,So)|0,wn=wn+Math.imul(qo,Co)|0,wn=wn+Math.imul(ga,So)|0,zn=zn+Math.imul(ga,Co)|0,Nn=Nn+Math.imul(Lo,po)|0,wn=wn+Math.imul(Lo,Ro)|0,wn=wn+Math.imul(Wo,po)|0,zn=zn+Math.imul(Wo,Ro)|0,Nn=Nn+Math.imul(yo,jo)|0,wn=wn+Math.imul(yo,Ko)|0,wn=wn+Math.imul(_o,jo)|0,zn=zn+Math.imul(_o,Ko)|0,Nn=Nn+Math.imul(lo,$l)|0,wn=wn+Math.imul(lo,El)|0,wn=wn+Math.imul(Eo,$l)|0,zn=zn+Math.imul(Eo,El)|0;var su=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(su>>>26)|0,su&=67108863,Nn=Math.imul(bo,xl),wn=Math.imul(bo,Tl),wn=wn+Math.imul(Io,xl)|0,zn=Math.imul(Io,Tl),Nn=Nn+Math.imul(Cl,Bl)|0,wn=wn+Math.imul(Cl,Il)|0,wn=wn+Math.imul(ko,Bl)|0,zn=zn+Math.imul(ko,Il)|0,Nn=Nn+Math.imul($a,Al)|0,wn=wn+Math.imul($a,Ml)|0,wn=wn+Math.imul(Jo,Al)|0,zn=zn+Math.imul(Jo,Ml)|0,Nn=Nn+Math.imul(Vo,Fl)|0,wn=wn+Math.imul(Vo,Sl)|0,wn=wn+Math.imul(Fo,Fl)|0,zn=zn+Math.imul(Fo,Sl)|0,Nn=Nn+Math.imul(No,So)|0,wn=wn+Math.imul(No,Co)|0,wn=wn+Math.imul(Uo,So)|0,zn=zn+Math.imul(Uo,Co)|0,Nn=Nn+Math.imul(qo,po)|0,wn=wn+Math.imul(qo,Ro)|0,wn=wn+Math.imul(ga,po)|0,zn=zn+Math.imul(ga,Ro)|0,Nn=Nn+Math.imul(Lo,jo)|0,wn=wn+Math.imul(Lo,Ko)|0,wn=wn+Math.imul(Wo,jo)|0,zn=zn+Math.imul(Wo,Ko)|0,Nn=Nn+Math.imul(yo,$l)|0,wn=wn+Math.imul(yo,El)|0,wn=wn+Math.imul(_o,$l)|0,zn=zn+Math.imul(_o,El)|0;var tu=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(tu>>>26)|0,tu&=67108863,Nn=Math.imul(bo,Bl),wn=Math.imul(bo,Il),wn=wn+Math.imul(Io,Bl)|0,zn=Math.imul(Io,Il),Nn=Nn+Math.imul(Cl,Al)|0,wn=wn+Math.imul(Cl,Ml)|0,wn=wn+Math.imul(ko,Al)|0,zn=zn+Math.imul(ko,Ml)|0,Nn=Nn+Math.imul($a,Fl)|0,wn=wn+Math.imul($a,Sl)|0,wn=wn+Math.imul(Jo,Fl)|0,zn=zn+Math.imul(Jo,Sl)|0,Nn=Nn+Math.imul(Vo,So)|0,wn=wn+Math.imul(Vo,Co)|0,wn=wn+Math.imul(Fo,So)|0,zn=zn+Math.imul(Fo,Co)|0,Nn=Nn+Math.imul(No,po)|0,wn=wn+Math.imul(No,Ro)|0,wn=wn+Math.imul(Uo,po)|0,zn=zn+Math.imul(Uo,Ro)|0,Nn=Nn+Math.imul(qo,jo)|0,wn=wn+Math.imul(qo,Ko)|0,wn=wn+Math.imul(ga,jo)|0,zn=zn+Math.imul(ga,Ko)|0,Nn=Nn+Math.imul(Lo,$l)|0,wn=wn+Math.imul(Lo,El)|0,wn=wn+Math.imul(Wo,$l)|0,zn=zn+Math.imul(Wo,El)|0;var zl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(zl>>>26)|0,zl&=67108863,Nn=Math.imul(bo,Al),wn=Math.imul(bo,Ml),wn=wn+Math.imul(Io,Al)|0,zn=Math.imul(Io,Ml),Nn=Nn+Math.imul(Cl,Fl)|0,wn=wn+Math.imul(Cl,Sl)|0,wn=wn+Math.imul(ko,Fl)|0,zn=zn+Math.imul(ko,Sl)|0,Nn=Nn+Math.imul($a,So)|0,wn=wn+Math.imul($a,Co)|0,wn=wn+Math.imul(Jo,So)|0,zn=zn+Math.imul(Jo,Co)|0,Nn=Nn+Math.imul(Vo,po)|0,wn=wn+Math.imul(Vo,Ro)|0,wn=wn+Math.imul(Fo,po)|0,zn=zn+Math.imul(Fo,Ro)|0,Nn=Nn+Math.imul(No,jo)|0,wn=wn+Math.imul(No,Ko)|0,wn=wn+Math.imul(Uo,jo)|0,zn=zn+Math.imul(Uo,Ko)|0,Nn=Nn+Math.imul(qo,$l)|0,wn=wn+Math.imul(qo,El)|0,wn=wn+Math.imul(ga,$l)|0,zn=zn+Math.imul(ga,El)|0;var Gl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Gl>>>26)|0,Gl&=67108863,Nn=Math.imul(bo,Fl),wn=Math.imul(bo,Sl),wn=wn+Math.imul(Io,Fl)|0,zn=Math.imul(Io,Sl),Nn=Nn+Math.imul(Cl,So)|0,wn=wn+Math.imul(Cl,Co)|0,wn=wn+Math.imul(ko,So)|0,zn=zn+Math.imul(ko,Co)|0,Nn=Nn+Math.imul($a,po)|0,wn=wn+Math.imul($a,Ro)|0,wn=wn+Math.imul(Jo,po)|0,zn=zn+Math.imul(Jo,Ro)|0,Nn=Nn+Math.imul(Vo,jo)|0,wn=wn+Math.imul(Vo,Ko)|0,wn=wn+Math.imul(Fo,jo)|0,zn=zn+Math.imul(Fo,Ko)|0,Nn=Nn+Math.imul(No,$l)|0,wn=wn+Math.imul(No,El)|0,wn=wn+Math.imul(Uo,$l)|0,zn=zn+Math.imul(Uo,El)|0;var Jl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Jl>>>26)|0,Jl&=67108863,Nn=Math.imul(bo,So),wn=Math.imul(bo,Co),wn=wn+Math.imul(Io,So)|0,zn=Math.imul(Io,Co),Nn=Nn+Math.imul(Cl,po)|0,wn=wn+Math.imul(Cl,Ro)|0,wn=wn+Math.imul(ko,po)|0,zn=zn+Math.imul(ko,Ro)|0,Nn=Nn+Math.imul($a,jo)|0,wn=wn+Math.imul($a,Ko)|0,wn=wn+Math.imul(Jo,jo)|0,zn=zn+Math.imul(Jo,Ko)|0,Nn=Nn+Math.imul(Vo,$l)|0,wn=wn+Math.imul(Vo,El)|0,wn=wn+Math.imul(Fo,$l)|0,zn=zn+Math.imul(Fo,El)|0;var Pl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Pl>>>26)|0,Pl&=67108863,Nn=Math.imul(bo,po),wn=Math.imul(bo,Ro),wn=wn+Math.imul(Io,po)|0,zn=Math.imul(Io,Ro),Nn=Nn+Math.imul(Cl,jo)|0,wn=wn+Math.imul(Cl,Ko)|0,wn=wn+Math.imul(ko,jo)|0,zn=zn+Math.imul(ko,Ko)|0,Nn=Nn+Math.imul($a,$l)|0,wn=wn+Math.imul($a,El)|0,wn=wn+Math.imul(Jo,$l)|0,zn=zn+Math.imul(Jo,El)|0;var Ul=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Ul>>>26)|0,Ul&=67108863,Nn=Math.imul(bo,jo),wn=Math.imul(bo,Ko),wn=wn+Math.imul(Io,jo)|0,zn=Math.imul(Io,Ko),Nn=Nn+Math.imul(Cl,$l)|0,wn=wn+Math.imul(Cl,El)|0,wn=wn+Math.imul(ko,$l)|0,zn=zn+Math.imul(ko,El)|0;var Yl=(Zn+Nn|0)+((wn&8191)<<13)|0;Zn=(zn+(wn>>>13)|0)+(Yl>>>26)|0,Yl&=67108863,Nn=Math.imul(bo,$l),wn=Math.imul(bo,El),wn=wn+Math.imul(Io,$l)|0,zn=Math.imul(Io,El);var Vl=(Zn+Nn|0)+((wn&8191)<<13)|0;return Zn=(zn+(wn>>>13)|0)+(Vl>>>26)|0,Vl&=67108863,On[0]=Cu,On[1]=iu,On[2]=pu,On[3]=yu,On[4]=hu,On[5]=mu,On[6]=vu,On[7]=fu,On[8]=gu,On[9]=ou,On[10]=su,On[11]=tu,On[12]=zl,On[13]=Gl,On[14]=Jl,On[15]=Pl,On[16]=Ul,On[17]=Yl,On[18]=Vl,Zn!==0&&(On[19]=Zn,Sn.length++),Sn};Math.imul||(An=In);function jn(Tn,Hr,Xr){Xr.negative=Hr.negative^Tn.negative,Xr.length=Tn.length+Hr.length;for(var Sn=0,Rn=0,Pn=0;Pn>>26)|0,Rn+=On>>>26,On&=67108863}Xr.words[Pn]=Zn,Sn=On,On=Rn}return Sn!==0?Xr.words[Pn]=Sn:Xr.length--,Xr._strip()}function eo(Tn,Hr,Xr){return jn(Tn,Hr,Xr)}jr.prototype.mulTo=function(Hr,Xr){var Sn,Rn=this.length+Hr.length;return this.length===10&&Hr.length===10?Sn=An(this,Hr,Xr):Rn<63?Sn=In(this,Hr,Xr):Rn<1024?Sn=jn(this,Hr,Xr):Sn=eo(this,Hr,Xr),Sn},jr.prototype.mul=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),this.mulTo(Hr,Xr)},jr.prototype.mulf=function(Hr){var Xr=new jr(null);return Xr.words=new Array(this.length+Hr.length),eo(this,Hr,Xr)},jr.prototype.imul=function(Hr){return this.clone().mulTo(Hr,this)},jr.prototype.imuln=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(typeof Hr=="number"),Er(Hr<67108864);for(var Sn=0,Rn=0;Rn>=26,Sn+=Pn/67108864|0,Sn+=On>>>26,this.words[Rn]=On&67108863}return Sn!==0&&(this.words[Rn]=Sn,this.length++),Xr?this.ineg():this},jr.prototype.muln=function(Hr){return this.clone().imuln(Hr)},jr.prototype.sqr=function(){return this.mul(this)},jr.prototype.isqr=function(){return this.imul(this.clone())},jr.prototype.pow=function(Hr){var Xr=Cn(Hr);if(Xr.length===0)return new jr(1);for(var Sn=this,Rn=0;Rn=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=67108863>>>26-Xr<<26-Xr,Pn;if(Xr!==0){var On=0;for(Pn=0;Pn>>26-Xr}On&&(this.words[Pn]=On,this.length++)}if(Sn!==0){for(Pn=this.length-1;Pn>=0;Pn--)this.words[Pn+Sn]=this.words[Pn];for(Pn=0;Pn=0);var Rn;Xr?Rn=(Xr-Xr%26)/26:Rn=0;var Pn=Hr%26,On=Math.min((Hr-Pn)/26,this.length),Zn=67108863^67108863>>>Pn<On)for(this.length-=On,wn=0;wn=0&&(zn!==0||wn>=Rn);wn--){var fo=this.words[wn]|0;this.words[wn]=zn<<26-Pn|fo>>>Pn,zn=fo&Zn}return Nn&&zn!==0&&(Nn.words[Nn.length++]=zn),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},jr.prototype.ishrn=function(Hr,Xr,Sn){return Er(this.negative===0),this.iushrn(Hr,Xr,Sn)},jr.prototype.shln=function(Hr){return this.clone().ishln(Hr)},jr.prototype.ushln=function(Hr){return this.clone().iushln(Hr)},jr.prototype.shrn=function(Hr){return this.clone().ishrn(Hr)},jr.prototype.ushrn=function(Hr){return this.clone().iushrn(Hr)},jr.prototype.testn=function(Hr){Er(typeof Hr=="number"&&Hr>=0);var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<=0);var Xr=Hr%26,Sn=(Hr-Xr)/26;if(Er(this.negative===0,"imaskn works only with positive numbers"),this.length<=Sn)return this;if(Xr!==0&&Sn++,this.length=Math.min(Sn,this.length),Xr!==0){var Rn=67108863^67108863>>>Xr<=67108864;Xr++)this.words[Xr]-=67108864,Xr===this.length-1?this.words[Xr+1]=1:this.words[Xr+1]++;return this.length=Math.max(this.length,Xr+1),this},jr.prototype.isubn=function(Hr){if(Er(typeof Hr=="number"),Er(Hr<67108864),Hr<0)return this.iaddn(-Hr);if(this.negative!==0)return this.negative=0,this.iaddn(Hr),this.negative=1,this;if(this.words[0]-=Hr,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Xr=0;Xr>26)-(Nn/67108864|0),this.words[Pn+Sn]=On&67108863}for(;Pn>26,this.words[Pn+Sn]=On&67108863;if(Zn===0)return this._strip();for(Er(Zn===-1),Zn=0,Pn=0;Pn>26,this.words[Pn]=On&67108863;return this.negative=1,this._strip()},jr.prototype._wordDiv=function(Hr,Xr){var Sn=this.length-Hr.length,Rn=this.clone(),Pn=Hr,On=Pn.words[Pn.length-1]|0,Zn=this._countBits(On);Sn=26-Zn,Sn!==0&&(Pn=Pn.ushln(Sn),Rn.iushln(Sn),On=Pn.words[Pn.length-1]|0);var Nn=Rn.length-Pn.length,wn;if(Xr!=="mod"){wn=new jr(null),wn.length=Nn+1,wn.words=new Array(wn.length);for(var zn=0;zn=0;vo--){var go=(Rn.words[Pn.length+vo]|0)*67108864+(Rn.words[Pn.length+vo-1]|0);for(go=Math.min(go/On|0,67108863),Rn._ishlnsubmul(Pn,go,vo);Rn.negative!==0;)go--,Rn.negative=0,Rn._ishlnsubmul(Pn,1,vo),Rn.isZero()||(Rn.negative^=1);wn&&(wn.words[vo]=go)}return wn&&wn._strip(),Rn._strip(),Xr!=="div"&&Sn!==0&&Rn.iushrn(Sn),{div:wn||null,mod:Rn}},jr.prototype.divmod=function(Hr,Xr,Sn){if(Er(!Hr.isZero()),this.isZero())return{div:new jr(0),mod:new jr(0)};var Rn,Pn,On;return this.negative!==0&&Hr.negative===0?(On=this.neg().divmod(Hr,Xr),Xr!=="mod"&&(Rn=On.div.neg()),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.iadd(Hr)),{div:Rn,mod:Pn}):this.negative===0&&Hr.negative!==0?(On=this.divmod(Hr.neg(),Xr),Xr!=="mod"&&(Rn=On.div.neg()),{div:Rn,mod:On.mod}):this.negative&Hr.negative?(On=this.neg().divmod(Hr.neg(),Xr),Xr!=="div"&&(Pn=On.mod.neg(),Sn&&Pn.negative!==0&&Pn.isub(Hr)),{div:On.div,mod:Pn}):Hr.length>this.length||this.cmp(Hr)<0?{div:new jr(0),mod:this}:Hr.length===1?Xr==="div"?{div:this.divn(Hr.words[0]),mod:null}:Xr==="mod"?{div:null,mod:new jr(this.modrn(Hr.words[0]))}:{div:this.divn(Hr.words[0]),mod:new jr(this.modrn(Hr.words[0]))}:this._wordDiv(Hr,Xr)},jr.prototype.div=function(Hr){return this.divmod(Hr,"div",!1).div},jr.prototype.mod=function(Hr){return this.divmod(Hr,"mod",!1).mod},jr.prototype.umod=function(Hr){return this.divmod(Hr,"mod",!0).mod},jr.prototype.divRound=function(Hr){var Xr=this.divmod(Hr);if(Xr.mod.isZero())return Xr.div;var Sn=Xr.div.negative!==0?Xr.mod.isub(Hr):Xr.mod,Rn=Hr.ushrn(1),Pn=Hr.andln(1),On=Sn.cmp(Rn);return On<0||Pn===1&&On===0?Xr.div:Xr.div.negative!==0?Xr.div.isubn(1):Xr.div.iaddn(1)},jr.prototype.modrn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=(1<<26)%Hr,Rn=0,Pn=this.length-1;Pn>=0;Pn--)Rn=(Sn*Rn+(this.words[Pn]|0))%Hr;return Xr?-Rn:Rn},jr.prototype.modn=function(Hr){return this.modrn(Hr)},jr.prototype.idivn=function(Hr){var Xr=Hr<0;Xr&&(Hr=-Hr),Er(Hr<=67108863);for(var Sn=0,Rn=this.length-1;Rn>=0;Rn--){var Pn=(this.words[Rn]|0)+Sn*67108864;this.words[Rn]=Pn/Hr|0,Sn=Pn%Hr}return this._strip(),Xr?this.ineg():this},jr.prototype.divn=function(Hr){return this.clone().idivn(Hr)},jr.prototype.egcd=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=new jr(0),Zn=new jr(1),Nn=0;Xr.isEven()&&Sn.isEven();)Xr.iushrn(1),Sn.iushrn(1),++Nn;for(var wn=Sn.clone(),zn=Xr.clone();!Xr.isZero();){for(var fo=0,vo=1;!(Xr.words[0]&vo)&&fo<26;++fo,vo<<=1);if(fo>0)for(Xr.iushrn(fo);fo-- >0;)(Rn.isOdd()||Pn.isOdd())&&(Rn.iadd(wn),Pn.isub(zn)),Rn.iushrn(1),Pn.iushrn(1);for(var go=0,uo=1;!(Sn.words[0]&uo)&&go<26;++go,uo<<=1);if(go>0)for(Sn.iushrn(go);go-- >0;)(On.isOdd()||Zn.isOdd())&&(On.iadd(wn),Zn.isub(zn)),On.iushrn(1),Zn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(On),Pn.isub(Zn)):(Sn.isub(Xr),On.isub(Rn),Zn.isub(Pn))}return{a:On,b:Zn,gcd:Sn.iushln(Nn)}},jr.prototype._invmp=function(Hr){Er(Hr.negative===0),Er(!Hr.isZero());var Xr=this,Sn=Hr.clone();Xr.negative!==0?Xr=Xr.umod(Hr):Xr=Xr.clone();for(var Rn=new jr(1),Pn=new jr(0),On=Sn.clone();Xr.cmpn(1)>0&&Sn.cmpn(1)>0;){for(var Zn=0,Nn=1;!(Xr.words[0]&Nn)&&Zn<26;++Zn,Nn<<=1);if(Zn>0)for(Xr.iushrn(Zn);Zn-- >0;)Rn.isOdd()&&Rn.iadd(On),Rn.iushrn(1);for(var wn=0,zn=1;!(Sn.words[0]&zn)&&wn<26;++wn,zn<<=1);if(wn>0)for(Sn.iushrn(wn);wn-- >0;)Pn.isOdd()&&Pn.iadd(On),Pn.iushrn(1);Xr.cmp(Sn)>=0?(Xr.isub(Sn),Rn.isub(Pn)):(Sn.isub(Xr),Pn.isub(Rn))}var fo;return Xr.cmpn(1)===0?fo=Rn:fo=Pn,fo.cmpn(0)<0&&fo.iadd(Hr),fo},jr.prototype.gcd=function(Hr){if(this.isZero())return Hr.abs();if(Hr.isZero())return this.abs();var Xr=this.clone(),Sn=Hr.clone();Xr.negative=0,Sn.negative=0;for(var Rn=0;Xr.isEven()&&Sn.isEven();Rn++)Xr.iushrn(1),Sn.iushrn(1);do{for(;Xr.isEven();)Xr.iushrn(1);for(;Sn.isEven();)Sn.iushrn(1);var Pn=Xr.cmp(Sn);if(Pn<0){var On=Xr;Xr=Sn,Sn=On}else if(Pn===0||Sn.cmpn(1)===0)break;Xr.isub(Sn)}while(!0);return Sn.iushln(Rn)},jr.prototype.invm=function(Hr){return this.egcd(Hr).a.umod(Hr)},jr.prototype.isEven=function(){return(this.words[0]&1)===0},jr.prototype.isOdd=function(){return(this.words[0]&1)===1},jr.prototype.andln=function(Hr){return this.words[0]&Hr},jr.prototype.bincn=function(Hr){Er(typeof Hr=="number");var Xr=Hr%26,Sn=(Hr-Xr)/26,Rn=1<>>26,Zn&=67108863,this.words[On]=Zn}return Pn!==0&&(this.words[On]=Pn,this.length++),this},jr.prototype.isZero=function(){return this.length===1&&this.words[0]===0},jr.prototype.cmpn=function(Hr){var Xr=Hr<0;if(this.negative!==0&&!Xr)return-1;if(this.negative===0&&Xr)return 1;this._strip();var Sn;if(this.length>1)Sn=1;else{Xr&&(Hr=-Hr),Er(Hr<=67108863,"Number is too big");var Rn=this.words[0]|0;Sn=Rn===Hr?0:RnHr.length)return 1;if(this.length=0;Sn--){var Rn=this.words[Sn]|0,Pn=Hr.words[Sn]|0;if(Rn!==Pn){RnPn&&(Xr=1);break}}return Xr},jr.prototype.gtn=function(Hr){return this.cmpn(Hr)===1},jr.prototype.gt=function(Hr){return this.cmp(Hr)===1},jr.prototype.gten=function(Hr){return this.cmpn(Hr)>=0},jr.prototype.gte=function(Hr){return this.cmp(Hr)>=0},jr.prototype.ltn=function(Hr){return this.cmpn(Hr)===-1},jr.prototype.lt=function(Hr){return this.cmp(Hr)===-1},jr.prototype.lten=function(Hr){return this.cmpn(Hr)<=0},jr.prototype.lte=function(Hr){return this.cmp(Hr)<=0},jr.prototype.eqn=function(Hr){return this.cmpn(Hr)===0},jr.prototype.eq=function(Hr){return this.cmp(Hr)===0},jr.red=function(Hr){return new so(Hr)},jr.prototype.toRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),Er(this.negative===0,"red works only with positives"),Hr.convertTo(this)._forceRed(Hr)},jr.prototype.fromRed=function(){return Er(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},jr.prototype._forceRed=function(Hr){return this.red=Hr,this},jr.prototype.forceRed=function(Hr){return Er(!this.red,"Already a number in reduction context"),this._forceRed(Hr)},jr.prototype.redAdd=function(Hr){return Er(this.red,"redAdd works only with red numbers"),this.red.add(this,Hr)},jr.prototype.redIAdd=function(Hr){return Er(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,Hr)},jr.prototype.redSub=function(Hr){return Er(this.red,"redSub works only with red numbers"),this.red.sub(this,Hr)},jr.prototype.redISub=function(Hr){return Er(this.red,"redISub works only with red numbers"),this.red.isub(this,Hr)},jr.prototype.redShl=function(Hr){return Er(this.red,"redShl works only with red numbers"),this.red.shl(this,Hr)},jr.prototype.redMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.mul(this,Hr)},jr.prototype.redIMul=function(Hr){return Er(this.red,"redMul works only with red numbers"),this.red._verify2(this,Hr),this.red.imul(this,Hr)},jr.prototype.redSqr=function(){return Er(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},jr.prototype.redISqr=function(){return Er(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},jr.prototype.redSqrt=function(){return Er(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},jr.prototype.redInvm=function(){return Er(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},jr.prototype.redNeg=function(){return Er(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},jr.prototype.redPow=function(Hr){return Er(this.red&&!Hr.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,Hr)};var ro={k256:null,p224:null,p192:null,p25519:null};function to(Tn,Hr){this.name=Tn,this.p=new jr(Hr,16),this.n=this.p.bitLength(),this.k=new jr(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}to.prototype._tmp=function(){var Hr=new jr(null);return Hr.words=new Array(Math.ceil(this.n/13)),Hr},to.prototype.ireduce=function(Hr){var Xr=Hr,Sn;do this.split(Xr,this.tmp),Xr=this.imulK(Xr),Xr=Xr.iadd(this.tmp),Sn=Xr.bitLength();while(Sn>this.n);var Rn=Sn0?Xr.isub(this.p):Xr.strip!==void 0?Xr.strip():Xr._strip(),Xr},to.prototype.split=function(Hr,Xr){Hr.iushrn(this.n,0,Xr)},to.prototype.imulK=function(Hr){return Hr.imul(this.k)};function _i(){to.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}kr(_i,to),_i.prototype.split=function(Hr,Xr){for(var Sn=4194303,Rn=Math.min(Hr.length,9),Pn=0;Pn>>22,On=Zn}On>>>=22,Hr.words[Pn-10]=On,On===0&&Hr.length>10?Hr.length-=10:Hr.length-=9},_i.prototype.imulK=function(Hr){Hr.words[Hr.length]=0,Hr.words[Hr.length+1]=0,Hr.length+=2;for(var Xr=0,Sn=0;Sn>>=26,Hr.words[Sn]=Pn,Xr=Rn}return Xr!==0&&(Hr.words[Hr.length++]=Xr),Hr},jr._prime=function(Hr){if(ro[Hr])return ro[Hr];var Xr;if(Hr==="k256")Xr=new _i;else if(Hr==="p224")Xr=new oo;else if(Hr==="p192")Xr=new io;else if(Hr==="p25519")Xr=new co;else throw new Error("Unknown prime "+Hr);return ro[Hr]=Xr,Xr};function so(Tn){if(typeof Tn=="string"){var Hr=jr._prime(Tn);this.m=Hr.p,this.prime=Hr}else Er(Tn.gtn(1),"modulus must be greater than 1"),this.m=Tn,this.prime=null}so.prototype._verify1=function(Hr){Er(Hr.negative===0,"red works only with positives"),Er(Hr.red,"red works only with red numbers")},so.prototype._verify2=function(Hr,Xr){Er((Hr.negative|Xr.negative)===0,"red works only with positives"),Er(Hr.red&&Hr.red===Xr.red,"red works only with red numbers")},so.prototype.imod=function(Hr){return this.prime?this.prime.ireduce(Hr)._forceRed(this):(Vr(Hr,Hr.umod(this.m)._forceRed(this)),Hr)},so.prototype.neg=function(Hr){return Hr.isZero()?Hr.clone():this.m.sub(Hr)._forceRed(this)},so.prototype.add=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.add(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn._forceRed(this)},so.prototype.iadd=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.iadd(Xr);return Sn.cmp(this.m)>=0&&Sn.isub(this.m),Sn},so.prototype.sub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.sub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn._forceRed(this)},so.prototype.isub=function(Hr,Xr){this._verify2(Hr,Xr);var Sn=Hr.isub(Xr);return Sn.cmpn(0)<0&&Sn.iadd(this.m),Sn},so.prototype.shl=function(Hr,Xr){return this._verify1(Hr),this.imod(Hr.ushln(Xr))},so.prototype.imul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.imul(Xr))},so.prototype.mul=function(Hr,Xr){return this._verify2(Hr,Xr),this.imod(Hr.mul(Xr))},so.prototype.isqr=function(Hr){return this.imul(Hr,Hr.clone())},so.prototype.sqr=function(Hr){return this.mul(Hr,Hr)},so.prototype.sqrt=function(Hr){if(Hr.isZero())return Hr.clone();var Xr=this.m.andln(3);if(Er(Xr%2===1),Xr===3){var Sn=this.m.add(new jr(1)).iushrn(2);return this.pow(Hr,Sn)}for(var Rn=this.m.subn(1),Pn=0;!Rn.isZero()&&Rn.andln(1)===0;)Pn++,Rn.iushrn(1);Er(!Rn.isZero());var On=new jr(1).toRed(this),Zn=On.redNeg(),Nn=this.m.subn(1).iushrn(1),wn=this.m.bitLength();for(wn=new jr(2*wn*wn).toRed(this);this.pow(wn,Nn).cmp(Zn)!==0;)wn.redIAdd(Zn);for(var zn=this.pow(wn,Rn),fo=this.pow(Hr,Rn.addn(1).iushrn(1)),vo=this.pow(Hr,Rn),go=Pn;vo.cmp(On)!==0;){for(var uo=vo,lo=0;uo.cmp(On)!==0;lo++)uo=uo.redSqr();Er(lo=0;Pn--){for(var zn=Xr.words[Pn],fo=wn-1;fo>=0;fo--){var vo=zn>>fo&1;if(On!==Rn[0]&&(On=this.sqr(On)),vo===0&&Zn===0){Nn=0;continue}Zn<<=1,Zn|=vo,Nn++,!(Nn!==Sn&&(Pn!==0||fo!==0))&&(On=this.mul(On,Rn[Zn]),Nn=0,Zn=0)}wn=26}return On},so.prototype.convertTo=function(Hr){var Xr=Hr.umod(this.m);return Xr===Hr?Xr.clone():Xr},so.prototype.convertFrom=function(Hr){var Xr=Hr.clone();return Xr.red=null,Xr},jr.mont=function(Hr){return new no(Hr)};function no(Tn){so.call(this,Tn),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new jr(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}kr(no,so),no.prototype.convertTo=function(Hr){return this.imod(Hr.ushln(this.shift))},no.prototype.convertFrom=function(Hr){var Xr=this.imod(Hr.mul(this.rinv));return Xr.red=null,Xr},no.prototype.imul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return Hr.words[0]=0,Hr.length=1,Hr;var Sn=Hr.imul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.mul=function(Hr,Xr){if(Hr.isZero()||Xr.isZero())return new jr(0)._forceRed(this);var Sn=Hr.mul(Xr),Rn=Sn.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Pn=Sn.isub(Rn).iushrn(this.shift),On=Pn;return Pn.cmp(this.m)>=0?On=Pn.isub(this.m):Pn.cmpn(0)<0&&(On=Pn.iadd(this.m)),On._forceRed(this)},no.prototype.invm=function(Hr){var Xr=this.imod(Hr._invmp(this.m).mul(this.r2));return Xr._forceRed(this)}})(fr,commonjsGlobal)})(bn);var bnExports=bn.exports;const BN=getDefaultExportFromCjs$2(bnExports);var _Buffer=safeBufferExports.Buffer;function base(fr){if(fr.length>=255)throw new TypeError("Alphabet too long");for(var br=new Uint8Array(256),wr=0;wr>>0,jn=new Uint8Array(An);Cn!==In;){for(var eo=Qr[Cn],ro=0,to=An-1;(eo!==0||ro>>0,jn[to]=eo%Br>>>0,eo=eo/Br>>>0;if(eo!==0)throw new Error("Non-zero carry");En=ro,Cn++}for(var _i=An-En;_i!==An&&jn[_i]===0;)_i++;for(var oo=Wr.repeat(_n);_i>>0,An=new Uint8Array(In);_n>>0,An[ro]=jn%256>>>0,jn=jn/256>>>0;if(jn!==0)throw new Error("Non-zero carry");Cn=eo,_n++}for(var to=In-Cn;to!==In&&An[to]===0;)to++;var _i=_Buffer.allocUnsafe(En+(In-to));_i.fill(0,0,En);for(var oo=En;to!==In;)_i[oo++]=An[to++];return _i}function Jr(Qr){var _n=Zr(Qr);if(_n)return _n;throw new Error("Non-base"+Br+" character")}return{encode:Vr,decodeUnsafe:Zr,decode:Jr}}var src=base,basex=src,ALPHABET="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",bs58=basex(ALPHABET);const bs58$1=getDefaultExportFromCjs$2(bs58);class StructError extends TypeError{constructor(br,wr){let Er;const{message:kr,explanation:jr,...Br}=br,{path:Wr}=br,qr=Wr.length===0?kr:`At path: ${Wr.join(".")} -- ${kr}`;super(jr??qr),jr!=null&&(this.cause=qr),Object.assign(this,Br),this.name=this.constructor.name,this.failures=()=>Er??(Er=[br,...wr()])}}function isIterable(fr){return isObject(fr)&&typeof fr[Symbol.iterator]=="function"}function isObject(fr){return typeof fr=="object"&&fr!=null}function isNonArrayObject(fr){return isObject(fr)&&!Array.isArray(fr)}function print(fr){return typeof fr=="symbol"?fr.toString():typeof fr=="string"?JSON.stringify(fr):`${fr}`}function shiftIterator(fr){const{done:br,value:wr}=fr.next();return br?void 0:wr}function toFailure(fr,br,wr,Er){if(fr===!0)return;fr===!1?fr={}:typeof fr=="string"&&(fr={message:fr});const{path:kr,branch:jr}=br,{type:Br}=wr,{refinement:Wr,message:qr=`Expected a value of type \`${Br}\`${Wr?` with refinement \`${Wr}\``:""}, but received: \`${print(Er)}\``}=fr;return{value:Er,type:Br,refinement:Wr,key:kr[kr.length-1],path:kr,branch:jr,...fr,message:qr}}function*toFailures(fr,br,wr,Er){isIterable(fr)||(fr=[fr]);for(const kr of fr){const jr=toFailure(kr,br,wr,Er);jr&&(yield jr)}}function*run(fr,br,wr={}){const{path:Er=[],branch:kr=[fr],coerce:jr=!1,mask:Br=!1}=wr,Wr={path:Er,branch:kr,mask:Br};jr&&(fr=br.coercer(fr,Wr));let qr="valid";for(const Gr of br.validator(fr,Wr))Gr.explanation=wr.message,qr="not_valid",yield[Gr,void 0];for(let[Gr,Vr,Zr]of br.entries(fr,Wr)){const Jr=run(Vr,Zr,{path:Gr===void 0?Er:[...Er,Gr],branch:Gr===void 0?kr:[...kr,Vr],coerce:jr,mask:Br,message:wr.message});for(const Qr of Jr)Qr[0]?(qr=Qr[0].refinement!=null?"not_refined":"not_valid",yield[Qr[0],void 0]):jr&&(Vr=Qr[1],Gr===void 0?fr=Vr:fr instanceof Map?fr.set(Gr,Vr):fr instanceof Set?fr.add(Vr):isObject(fr)&&(Vr!==void 0||Gr in fr)&&(fr[Gr]=Vr))}if(qr!=="not_valid")for(const Gr of br.refiner(fr,Wr))Gr.explanation=wr.message,qr="not_refined",yield[Gr,void 0];qr==="valid"&&(yield[void 0,fr])}let Struct$1=class{constructor(br){const{type:wr,schema:Er,validator:kr,refiner:jr,coercer:Br=qr=>qr,entries:Wr=function*(){}}=br;this.type=wr,this.schema=Er,this.entries=Wr,this.coercer=Br,kr?this.validator=(qr,Gr)=>{const Vr=kr(qr,Gr);return toFailures(Vr,Gr,this,qr)}:this.validator=()=>[],jr?this.refiner=(qr,Gr)=>{const Vr=jr(qr,Gr);return toFailures(Vr,Gr,this,qr)}:this.refiner=()=>[]}assert(br,wr){return assert(br,this,wr)}create(br,wr){return create(br,this,wr)}is(br){return is(br,this)}mask(br,wr){return mask(br,this,wr)}validate(br,wr={}){return validate(br,this,wr)}};function assert(fr,br,wr){const Er=validate(fr,br,{message:wr});if(Er[0])throw Er[0]}function create(fr,br,wr){const Er=validate(fr,br,{coerce:!0,message:wr});if(Er[0])throw Er[0];return Er[1]}function mask(fr,br,wr){const Er=validate(fr,br,{coerce:!0,mask:!0,message:wr});if(Er[0])throw Er[0];return Er[1]}function is(fr,br){return!validate(fr,br)[0]}function validate(fr,br,wr={}){const Er=run(fr,br,wr),kr=shiftIterator(Er);return kr[0]?[new StructError(kr[0],function*(){for(const Br of Er)Br[0]&&(yield Br[0])}),void 0]:[void 0,kr[1]]}function define(fr,br){return new Struct$1({type:fr,schema:null,validator:br})}function any(){return define("any",()=>!0)}function array(fr){return new Struct$1({type:"array",schema:fr,*entries(br){if(fr&&Array.isArray(br))for(const[wr,Er]of br.entries())yield[wr,Er,fr]},coercer(br){return Array.isArray(br)?br.slice():br},validator(br){return Array.isArray(br)||`Expected an array value, but received: ${print(br)}`}})}function boolean(){return define("boolean",fr=>typeof fr=="boolean")}function instance(fr){return define("instance",br=>br instanceof fr||`Expected a \`${fr.name}\` instance, but received: ${print(br)}`)}function literal(fr){const br=print(fr),wr=typeof fr;return new Struct$1({type:"literal",schema:wr==="string"||wr==="number"||wr==="boolean"?fr:null,validator(Er){return Er===fr||`Expected the literal \`${br}\`, but received: ${print(Er)}`}})}function never(){return define("never",()=>!1)}function nullable(fr){return new Struct$1({...fr,validator:(br,wr)=>br===null||fr.validator(br,wr),refiner:(br,wr)=>br===null||fr.refiner(br,wr)})}function number(){return define("number",fr=>typeof fr=="number"&&!isNaN(fr)||`Expected a number, but received: ${print(fr)}`)}function optional(fr){return new Struct$1({...fr,validator:(br,wr)=>br===void 0||fr.validator(br,wr),refiner:(br,wr)=>br===void 0||fr.refiner(br,wr)})}function record(fr,br){return new Struct$1({type:"record",schema:null,*entries(wr){if(isObject(wr))for(const Er in wr){const kr=wr[Er];yield[Er,Er,fr],yield[Er,kr,br]}},validator(wr){return isNonArrayObject(wr)||`Expected an object, but received: ${print(wr)}`},coercer(wr){return isNonArrayObject(wr)?{...wr}:wr}})}function string(){return define("string",fr=>typeof fr=="string"||`Expected a string, but received: ${print(fr)}`)}function tuple(fr){const br=never();return new Struct$1({type:"tuple",schema:null,*entries(wr){if(Array.isArray(wr)){const Er=Math.max(fr.length,wr.length);for(let kr=0;krwr.type).join(" | ");return new Struct$1({type:"union",schema:null,coercer(wr,Er){for(const kr of fr){const[jr,Br]=kr.validate(wr,{coerce:!0,mask:Er.mask});if(!jr)return Br}return wr},validator(wr,Er){const kr=[];for(const jr of fr){const[...Br]=run(wr,jr,Er),[Wr]=Br;if(Wr[0])for(const[qr]of Br)qr&&kr.push(qr);else return[]}return[`Expected the value to satisfy a union of \`${br}\`, but received: ${print(wr)}`,...kr]}})}function unknown(){return define("unknown",()=>!0)}function coerce(fr,br,wr){return new Struct$1({...fr,coercer:(Er,kr)=>is(Er,br)?fr.coercer(wr(Er,kr),kr):fr.coercer(Er,kr)})}function isOnCurve(fr){try{return ed25519.ExtendedPoint.fromHex(fr),!0}catch{return!1}}const toBuffer=fr=>Buffer$1$1.isBuffer(fr)?fr:fr instanceof Uint8Array?Buffer$1$1.from(fr.buffer,fr.byteOffset,fr.byteLength):Buffer$1$1.from(fr);class Struct{constructor(br){Object.assign(this,br)}encode(){return Buffer$1$1.from(serialize_1(SOLANA_SCHEMA,this))}static decode(br){return deserialize_1(SOLANA_SCHEMA,this,br)}static decodeUnchecked(br){return deserializeUnchecked_1(SOLANA_SCHEMA,this,br)}}const SOLANA_SCHEMA=new Map;var _PublicKey;const MAX_SEED_LENGTH=32,PUBLIC_KEY_LENGTH=32;function isPublicKeyData(fr){return fr._bn!==void 0}let uniquePublicKeyCounter=1;class PublicKey extends Struct{constructor(br){if(super({}),this._bn=void 0,isPublicKeyData(br))this._bn=br._bn;else{if(typeof br=="string"){const wr=bs58$1.decode(br);if(wr.length!=PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input");this._bn=new BN(wr)}else this._bn=new BN(br);if(this._bn.byteLength()>PUBLIC_KEY_LENGTH)throw new Error("Invalid public key input")}}static unique(){const br=new PublicKey(uniquePublicKeyCounter);return uniquePublicKeyCounter+=1,new PublicKey(br.toBuffer())}equals(br){return this._bn.eq(br._bn)}toBase58(){return bs58$1.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const br=this.toBuffer();return new Uint8Array(br.buffer,br.byteOffset,br.byteLength)}toBuffer(){const br=this._bn.toArrayLike(Buffer$1$1);if(br.length===PUBLIC_KEY_LENGTH)return br;const wr=Buffer$1$1.alloc(32);return br.copy(wr,32-br.length),wr}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(br,wr,Er){const kr=Buffer$1$1.concat([br.toBuffer(),Buffer$1$1.from(wr),Er.toBuffer()]),jr=sha256$4(kr);return new PublicKey(jr)}static createProgramAddressSync(br,wr){let Er=Buffer$1$1.alloc(0);br.forEach(function(jr){if(jr.length>MAX_SEED_LENGTH)throw new TypeError("Max seed length exceeded");Er=Buffer$1$1.concat([Er,toBuffer(jr)])}),Er=Buffer$1$1.concat([Er,wr.toBuffer(),Buffer$1$1.from("ProgramDerivedAddress")]);const kr=sha256$4(Er);if(isOnCurve(kr))throw new Error("Invalid seeds, address must fall off the curve");return new PublicKey(kr)}static async createProgramAddress(br,wr){return this.createProgramAddressSync(br,wr)}static findProgramAddressSync(br,wr){let Er=255,kr;for(;Er!=0;){try{const jr=br.concat(Buffer$1$1.from([Er]));kr=this.createProgramAddressSync(jr,wr)}catch(jr){if(jr instanceof TypeError)throw jr;Er--;continue}return[kr,Er]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(br,wr){return this.findProgramAddressSync(br,wr)}static isOnCurve(br){const wr=new PublicKey(br);return isOnCurve(wr.toBytes())}}_PublicKey=PublicKey;PublicKey.default=new _PublicKey("11111111111111111111111111111111");SOLANA_SCHEMA.set(PublicKey,{kind:"struct",fields:[["_bn","u256"]]});new PublicKey("BPFLoader1111111111111111111111111111111111");const SIGNATURE_LENGTH_IN_BYTES=64,publicKey=(fr="publicKey")=>blob(32,fr),rustString=(fr="string")=>{const br=struct([u32("length"),u32("lengthPadding"),blob(offset(u32(),-8),"chars")],fr),wr=br.decode.bind(br),Er=br.encode.bind(br),kr=br;return kr.decode=(jr,Br)=>wr(jr,Br).chars.toString(),kr.encode=(jr,Br,Wr)=>{const qr={chars:Buffer$1$1.from(jr,"utf8")};return Er(qr,Br,Wr)},kr.alloc=jr=>u32().span+u32().span+Buffer$1$1.from(jr,"utf8").length,kr},authorized=(fr="authorized")=>struct([publicKey("staker"),publicKey("withdrawer")],fr),lockup=(fr="lockup")=>struct([ns64("unixTimestamp"),ns64("epoch"),publicKey("custodian")],fr),voteInit=(fr="voteInit")=>struct([publicKey("nodePubkey"),publicKey("authorizedVoter"),publicKey("authorizedWithdrawer"),u8("commission")],fr),voteAuthorizeWithSeedArgs=(fr="voteAuthorizeWithSeedArgs")=>struct([u32("voteAuthorizationType"),publicKey("currentAuthorityDerivedKeyOwnerPubkey"),rustString("currentAuthorityDerivedKeySeed"),publicKey("newAuthorized")],fr);Buffer$1$1.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);new PublicKey("SysvarC1ock11111111111111111111111111111111");new PublicKey("SysvarEpochSchedu1e111111111111111111111111");new PublicKey("Sysvar1nstructions1111111111111111111111111");new PublicKey("SysvarRecentB1ockHashes11111111111111111111");new PublicKey("SysvarRent111111111111111111111111111111111");new PublicKey("SysvarRewards111111111111111111111111111111");new PublicKey("SysvarS1otHashes111111111111111111111111111");new PublicKey("SysvarS1otHistory11111111111111111111111111");new PublicKey("SysvarStakeHistory1111111111111111111111111");const FeeCalculatorLayout=nu64("lamportsPerSignature"),NonceAccountLayout=struct([u32("version"),u32("state"),publicKey("authorizedPubkey"),publicKey("nonce"),struct([FeeCalculatorLayout],"feeCalculator")]);NonceAccountLayout.span;const encodeDecode=fr=>{const br=fr.decode.bind(fr),wr=fr.encode.bind(fr);return{decode:br,encode:wr}},bigInt=fr=>br=>{const wr=blob(fr,br),{encode:Er,decode:kr}=encodeDecode(wr),jr=wr;return jr.decode=(Br,Wr)=>{const qr=kr(Br,Wr);return toBigIntLE_1(Buffer$1$1.from(qr))},jr.encode=(Br,Wr,qr)=>{const Gr=toBufferLE_1(Br,fr);return Er(Gr,Wr,qr)},jr},u64=bigInt(8);Object.freeze({Create:{index:0,layout:struct([u32("instruction"),ns64("lamports"),ns64("space"),publicKey("programId")])},Assign:{index:1,layout:struct([u32("instruction"),publicKey("programId")])},Transfer:{index:2,layout:struct([u32("instruction"),u64("lamports")])},CreateWithSeed:{index:3,layout:struct([u32("instruction"),publicKey("base"),rustString("seed"),ns64("lamports"),ns64("space"),publicKey("programId")])},AdvanceNonceAccount:{index:4,layout:struct([u32("instruction")])},WithdrawNonceAccount:{index:5,layout:struct([u32("instruction"),ns64("lamports")])},InitializeNonceAccount:{index:6,layout:struct([u32("instruction"),publicKey("authorized")])},AuthorizeNonceAccount:{index:7,layout:struct([u32("instruction"),publicKey("authorized")])},Allocate:{index:8,layout:struct([u32("instruction"),ns64("space")])},AllocateWithSeed:{index:9,layout:struct([u32("instruction"),publicKey("base"),rustString("seed"),ns64("space"),publicKey("programId")])},AssignWithSeed:{index:10,layout:struct([u32("instruction"),publicKey("base"),rustString("seed"),publicKey("programId")])},TransferWithSeed:{index:11,layout:struct([u32("instruction"),u64("lamports"),rustString("seed"),publicKey("programId")])},UpgradeNonceAccount:{index:12,layout:struct([u32("instruction")])}});new PublicKey("11111111111111111111111111111111");new PublicKey("BPFLoader2111111111111111111111111111111111");struct([u32("typeIndex"),u64("deactivationSlot"),nu64("lastExtendedSlot"),u8("lastExtendedStartIndex"),u8(),seq(publicKey(),offset(u8(),-1),"authority")]);const PublicKeyFromString=coerce(instance(PublicKey),string(),fr=>new PublicKey(fr)),RawAccountDataResult=tuple([string(),literal("base64")]),BufferFromRawAccountData=coerce(instance(Buffer$1$1),RawAccountDataResult,fr=>Buffer$1$1.from(fr[0],"base64"));function createRpcResult(fr){return union([type({jsonrpc:literal("2.0"),id:string(),result:fr}),type({jsonrpc:literal("2.0"),id:string(),error:type({code:unknown(),message:string(),data:optional(any())})})])}const UnknownRpcResult=createRpcResult(unknown());function jsonRpcResult(fr){return coerce(createRpcResult(fr),UnknownRpcResult,br=>"error"in br?br:{...br,result:create(br.result,fr)})}function jsonRpcResultAndContext(fr){return jsonRpcResult(type({context:type({slot:number()}),value:fr}))}function notificationResultAndContext(fr){return type({context:type({slot:number()}),value:fr})}const GetInflationGovernorResult=type({foundation:number(),foundationTerm:number(),initial:number(),taper:number(),terminal:number()});jsonRpcResult(array(nullable(type({epoch:number(),effectiveSlot:number(),amount:number(),postBalance:number(),commission:optional(nullable(number()))}))));const GetRecentPrioritizationFeesResult=array(type({slot:number(),prioritizationFee:number()})),GetInflationRateResult=type({total:number(),validator:number(),foundation:number(),epoch:number()}),GetEpochInfoResult=type({epoch:number(),slotIndex:number(),slotsInEpoch:number(),absoluteSlot:number(),blockHeight:optional(number()),transactionCount:optional(number())}),GetEpochScheduleResult=type({slotsPerEpoch:number(),leaderScheduleSlotOffset:number(),warmup:boolean(),firstNormalEpoch:number(),firstNormalSlot:number()}),GetLeaderScheduleResult=record(string(),array(number())),TransactionErrorResult=nullable(union([type({}),string()])),SignatureStatusResult=type({err:TransactionErrorResult}),SignatureReceivedResult=literal("receivedSignature");type({"solana-core":string(),"feature-set":optional(number())});const ParsedInstructionStruct=type({program:string(),programId:PublicKeyFromString,parsed:unknown()}),PartiallyDecodedInstructionStruct=type({programId:PublicKeyFromString,accounts:array(PublicKeyFromString),data:string()});jsonRpcResultAndContext(type({err:nullable(union([type({}),string()])),logs:nullable(array(string())),accounts:optional(nullable(array(nullable(type({executable:boolean(),owner:string(),lamports:number(),data:array(string()),rentEpoch:optional(number())}))))),unitsConsumed:optional(number()),returnData:optional(nullable(type({programId:string(),data:tuple([string(),literal("base64")])}))),innerInstructions:optional(nullable(array(type({index:number(),instructions:array(union([ParsedInstructionStruct,PartiallyDecodedInstructionStruct]))}))))}));jsonRpcResultAndContext(type({byIdentity:record(string(),array(number())),range:type({firstSlot:number(),lastSlot:number()})}));jsonRpcResult(GetInflationGovernorResult);jsonRpcResult(GetInflationRateResult);jsonRpcResult(GetRecentPrioritizationFeesResult);jsonRpcResult(GetEpochInfoResult);jsonRpcResult(GetEpochScheduleResult);jsonRpcResult(GetLeaderScheduleResult);jsonRpcResult(number());jsonRpcResultAndContext(type({total:number(),circulating:number(),nonCirculating:number(),nonCirculatingAccounts:array(PublicKeyFromString)}));const TokenAmountResult=type({amount:string(),uiAmount:nullable(number()),decimals:number(),uiAmountString:optional(string())});jsonRpcResultAndContext(array(type({address:PublicKeyFromString,amount:string(),uiAmount:nullable(number()),decimals:number(),uiAmountString:optional(string())})));jsonRpcResultAndContext(array(type({pubkey:PublicKeyFromString,account:type({executable:boolean(),owner:PublicKeyFromString,lamports:number(),data:BufferFromRawAccountData,rentEpoch:number()})})));const ParsedAccountDataResult=type({program:string(),parsed:unknown(),space:number()});jsonRpcResultAndContext(array(type({pubkey:PublicKeyFromString,account:type({executable:boolean(),owner:PublicKeyFromString,lamports:number(),data:ParsedAccountDataResult,rentEpoch:number()})})));jsonRpcResultAndContext(array(type({lamports:number(),address:PublicKeyFromString})));const AccountInfoResult=type({executable:boolean(),owner:PublicKeyFromString,lamports:number(),data:BufferFromRawAccountData,rentEpoch:number()});type({pubkey:PublicKeyFromString,account:AccountInfoResult});const ParsedOrRawAccountData=coerce(union([instance(Buffer$1$1),ParsedAccountDataResult]),union([RawAccountDataResult,ParsedAccountDataResult]),fr=>Array.isArray(fr)?create(fr,BufferFromRawAccountData):fr),ParsedAccountInfoResult=type({executable:boolean(),owner:PublicKeyFromString,lamports:number(),data:ParsedOrRawAccountData,rentEpoch:number()});type({pubkey:PublicKeyFromString,account:ParsedAccountInfoResult});type({state:union([literal("active"),literal("inactive"),literal("activating"),literal("deactivating")]),active:number(),inactive:number()});jsonRpcResult(array(type({signature:string(),slot:number(),err:TransactionErrorResult,memo:nullable(string()),blockTime:optional(nullable(number()))})));jsonRpcResult(array(type({signature:string(),slot:number(),err:TransactionErrorResult,memo:nullable(string()),blockTime:optional(nullable(number()))})));type({subscription:number(),result:notificationResultAndContext(AccountInfoResult)});const ProgramAccountInfoResult=type({pubkey:PublicKeyFromString,account:AccountInfoResult});type({subscription:number(),result:notificationResultAndContext(ProgramAccountInfoResult)});const SlotInfoResult=type({parent:number(),slot:number(),root:number()});type({subscription:number(),result:SlotInfoResult});const SlotUpdateResult=union([type({type:union([literal("firstShredReceived"),literal("completed"),literal("optimisticConfirmation"),literal("root")]),slot:number(),timestamp:number()}),type({type:literal("createdBank"),parent:number(),slot:number(),timestamp:number()}),type({type:literal("frozen"),slot:number(),timestamp:number(),stats:type({numTransactionEntries:number(),numSuccessfulTransactions:number(),numFailedTransactions:number(),maxTransactionsPerEntry:number()})}),type({type:literal("dead"),slot:number(),timestamp:number(),err:string()})]);type({subscription:number(),result:SlotUpdateResult});type({subscription:number(),result:notificationResultAndContext(union([SignatureStatusResult,SignatureReceivedResult]))});type({subscription:number(),result:number()});type({pubkey:string(),gossip:nullable(string()),tpu:nullable(string()),rpc:nullable(string()),version:nullable(string())});const VoteAccountInfoResult=type({votePubkey:string(),nodePubkey:string(),activatedStake:number(),epochVoteAccount:boolean(),epochCredits:array(tuple([number(),number(),number()])),commission:number(),lastVote:number(),rootSlot:nullable(number())});jsonRpcResult(type({current:array(VoteAccountInfoResult),delinquent:array(VoteAccountInfoResult)}));const ConfirmationStatus=union([literal("processed"),literal("confirmed"),literal("finalized")]),SignatureStatusResponse=type({slot:number(),confirmations:nullable(number()),err:TransactionErrorResult,confirmationStatus:optional(ConfirmationStatus)});jsonRpcResultAndContext(array(nullable(SignatureStatusResponse)));jsonRpcResult(number());const AddressTableLookupStruct=type({accountKey:PublicKeyFromString,writableIndexes:array(number()),readonlyIndexes:array(number())}),ConfirmedTransactionResult=type({signatures:array(string()),message:type({accountKeys:array(string()),header:type({numRequiredSignatures:number(),numReadonlySignedAccounts:number(),numReadonlyUnsignedAccounts:number()}),instructions:array(type({accounts:array(number()),data:string(),programIdIndex:number()})),recentBlockhash:string(),addressTableLookups:optional(array(AddressTableLookupStruct))})}),AnnotatedAccountKey=type({pubkey:PublicKeyFromString,signer:boolean(),writable:boolean(),source:optional(union([literal("transaction"),literal("lookupTable")]))}),ConfirmedTransactionAccountsModeResult=type({accountKeys:array(AnnotatedAccountKey),signatures:array(string())}),ParsedInstructionResult=type({parsed:unknown(),program:string(),programId:PublicKeyFromString}),RawInstructionResult=type({accounts:array(PublicKeyFromString),data:string(),programId:PublicKeyFromString}),InstructionResult=union([RawInstructionResult,ParsedInstructionResult]),UnknownInstructionResult=union([type({parsed:unknown(),program:string(),programId:string()}),type({accounts:array(string()),data:string(),programId:string()})]),ParsedOrRawInstruction=coerce(InstructionResult,UnknownInstructionResult,fr=>"accounts"in fr?create(fr,RawInstructionResult):create(fr,ParsedInstructionResult)),ParsedConfirmedTransactionResult=type({signatures:array(string()),message:type({accountKeys:array(AnnotatedAccountKey),instructions:array(ParsedOrRawInstruction),recentBlockhash:string(),addressTableLookups:optional(nullable(array(AddressTableLookupStruct)))})}),TokenBalanceResult=type({accountIndex:number(),mint:string(),owner:optional(string()),programId:optional(string()),uiTokenAmount:TokenAmountResult}),LoadedAddressesResult=type({writable:array(PublicKeyFromString),readonly:array(PublicKeyFromString)}),ConfirmedTransactionMetaResult=type({err:TransactionErrorResult,fee:number(),innerInstructions:optional(nullable(array(type({index:number(),instructions:array(type({accounts:array(number()),data:string(),programIdIndex:number()}))})))),preBalances:array(number()),postBalances:array(number()),logMessages:optional(nullable(array(string()))),preTokenBalances:optional(nullable(array(TokenBalanceResult))),postTokenBalances:optional(nullable(array(TokenBalanceResult))),loadedAddresses:optional(LoadedAddressesResult),computeUnitsConsumed:optional(number())}),ParsedConfirmedTransactionMetaResult=type({err:TransactionErrorResult,fee:number(),innerInstructions:optional(nullable(array(type({index:number(),instructions:array(ParsedOrRawInstruction)})))),preBalances:array(number()),postBalances:array(number()),logMessages:optional(nullable(array(string()))),preTokenBalances:optional(nullable(array(TokenBalanceResult))),postTokenBalances:optional(nullable(array(TokenBalanceResult))),loadedAddresses:optional(LoadedAddressesResult),computeUnitsConsumed:optional(number())}),TransactionVersionStruct=union([literal(0),literal("legacy")]),RewardsResult=type({pubkey:string(),lamports:number(),postBalance:nullable(number()),rewardType:nullable(string()),commission:optional(nullable(number()))});jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number(),transactions:array(type({transaction:ConfirmedTransactionResult,meta:nullable(ConfirmedTransactionMetaResult),version:optional(TransactionVersionStruct)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number()),blockHeight:nullable(number())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number(),rewards:optional(array(RewardsResult)),blockTime:nullable(number()),blockHeight:nullable(number())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number(),transactions:array(type({transaction:ConfirmedTransactionAccountsModeResult,meta:nullable(ConfirmedTransactionMetaResult),version:optional(TransactionVersionStruct)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number()),blockHeight:nullable(number())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number(),transactions:array(type({transaction:ParsedConfirmedTransactionResult,meta:nullable(ParsedConfirmedTransactionMetaResult),version:optional(TransactionVersionStruct)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number()),blockHeight:nullable(number())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number(),transactions:array(type({transaction:ConfirmedTransactionAccountsModeResult,meta:nullable(ParsedConfirmedTransactionMetaResult),version:optional(TransactionVersionStruct)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number()),blockHeight:nullable(number())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number(),rewards:optional(array(RewardsResult)),blockTime:nullable(number()),blockHeight:nullable(number())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number(),transactions:array(type({transaction:ConfirmedTransactionResult,meta:nullable(ConfirmedTransactionMetaResult)})),rewards:optional(array(RewardsResult)),blockTime:nullable(number())})));jsonRpcResult(nullable(type({blockhash:string(),previousBlockhash:string(),parentSlot:number(),signatures:array(string()),blockTime:nullable(number())})));jsonRpcResult(nullable(type({slot:number(),meta:nullable(ConfirmedTransactionMetaResult),blockTime:optional(nullable(number())),transaction:ConfirmedTransactionResult,version:optional(TransactionVersionStruct)})));jsonRpcResult(nullable(type({slot:number(),transaction:ParsedConfirmedTransactionResult,meta:nullable(ParsedConfirmedTransactionMetaResult),blockTime:optional(nullable(number())),version:optional(TransactionVersionStruct)})));jsonRpcResultAndContext(type({blockhash:string(),feeCalculator:type({lamportsPerSignature:number()})}));jsonRpcResultAndContext(type({blockhash:string(),lastValidBlockHeight:number()}));jsonRpcResultAndContext(boolean());const PerfSampleResult=type({slot:number(),numTransactions:number(),numSlots:number(),samplePeriodSecs:number()});jsonRpcResult(array(PerfSampleResult));jsonRpcResultAndContext(nullable(type({feeCalculator:type({lamportsPerSignature:number()})})));jsonRpcResult(string());jsonRpcResult(string());const LogsResult=type({err:TransactionErrorResult,logs:array(string()),signature:string()});type({result:notificationResultAndContext(LogsResult),subscription:number()});Object.freeze({CreateLookupTable:{index:0,layout:struct([u32("instruction"),u64("recentSlot"),u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:struct([u32("instruction")])},ExtendLookupTable:{index:2,layout:struct([u32("instruction"),u64(),seq(publicKey(),offset(u32(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:struct([u32("instruction")])},CloseLookupTable:{index:4,layout:struct([u32("instruction")])}});new PublicKey("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:struct([u8("instruction"),u32("units"),u32("additionalFee")])},RequestHeapFrame:{index:1,layout:struct([u8("instruction"),u32("bytes")])},SetComputeUnitLimit:{index:2,layout:struct([u8("instruction"),u32("units")])},SetComputeUnitPrice:{index:3,layout:struct([u8("instruction"),u64("microLamports")])}});new PublicKey("ComputeBudget111111111111111111111111111111");struct([u8("numSignatures"),u8("padding"),u16("signatureOffset"),u16("signatureInstructionIndex"),u16("publicKeyOffset"),u16("publicKeyInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u16("messageInstructionIndex")]);new PublicKey("Ed25519SigVerify111111111111111111111111111");secp256k1$1.utils.isValidPrivateKey;secp256k1$1.getPublicKey;struct([u8("numSignatures"),u16("signatureOffset"),u8("signatureInstructionIndex"),u16("ethAddressOffset"),u8("ethAddressInstructionIndex"),u16("messageDataOffset"),u16("messageDataSize"),u8("messageInstructionIndex"),blob(20,"ethAddress"),blob(64,"signature"),u8("recoveryId")]);new PublicKey("KeccakSecp256k11111111111111111111111111111");var _Lockup;new PublicKey("StakeConfig11111111111111111111111111111111");class Lockup{constructor(br,wr,Er){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=br,this.epoch=wr,this.custodian=Er}}_Lockup=Lockup;Lockup.default=new _Lockup(0,0,PublicKey.default);Object.freeze({Initialize:{index:0,layout:struct([u32("instruction"),authorized(),lockup()])},Authorize:{index:1,layout:struct([u32("instruction"),publicKey("newAuthorized"),u32("stakeAuthorizationType")])},Delegate:{index:2,layout:struct([u32("instruction")])},Split:{index:3,layout:struct([u32("instruction"),ns64("lamports")])},Withdraw:{index:4,layout:struct([u32("instruction"),ns64("lamports")])},Deactivate:{index:5,layout:struct([u32("instruction")])},Merge:{index:7,layout:struct([u32("instruction")])},AuthorizeWithSeed:{index:8,layout:struct([u32("instruction"),publicKey("newAuthorized"),u32("stakeAuthorizationType"),rustString("authoritySeed"),publicKey("authorityOwner")])}});new PublicKey("Stake11111111111111111111111111111111111111");Object.freeze({InitializeAccount:{index:0,layout:struct([u32("instruction"),voteInit()])},Authorize:{index:1,layout:struct([u32("instruction"),publicKey("newAuthorized"),u32("voteAuthorizationType")])},Withdraw:{index:3,layout:struct([u32("instruction"),ns64("lamports")])},UpdateValidatorIdentity:{index:4,layout:struct([u32("instruction")])},AuthorizeWithSeed:{index:10,layout:struct([u32("instruction"),voteAuthorizeWithSeedArgs()])}});new PublicKey("Vote111111111111111111111111111111111111111");new PublicKey("Va1idator1nfo111111111111111111111111111111");type({name:string(),website:optional(string()),details:optional(string()),iconUrl:optional(string()),keybaseUsername:optional(string())});new PublicKey("Vote111111111111111111111111111111111111111");struct([publicKey("nodePubkey"),publicKey("authorizedWithdrawer"),u8("commission"),nu64(),seq(struct([nu64("slot"),u32("confirmationCount")]),offset(u32(),-8),"votes"),u8("rootSlotValid"),nu64("rootSlot"),nu64(),seq(struct([nu64("epoch"),publicKey("authorizedVoter")]),offset(u32(),-8),"authorizedVoters"),struct([seq(struct([publicKey("authorizedPubkey"),nu64("epochOfLastAuthorizedSwitch"),nu64("targetEpoch")]),32,"buf"),nu64("idx"),u8("isEmpty")],"priorVoters"),nu64(),seq(struct([nu64("epoch"),nu64("credits"),nu64("prevCredits")]),offset(u32(),-8),"epochCredits"),struct([nu64("slot"),nu64("timestamp")],"lastTimestamp")]);class TurnkeySigner{constructor(br){this.organizationId=br.organizationId,this.client=br.client}async signAllTransactions(br,wr){var Wr,qr,Gr;const Er=new PublicKey(wr);let kr=br.map(Vr=>this.getMessageToSign(Vr).toString("hex"));const Br=(qr=(Wr=(await this.signRawPayloads(kr,wr)).signRawPayloadsResult)==null?void 0:Wr.signatures)==null?void 0:qr.map(Vr=>`${Vr==null?void 0:Vr.r}${Vr==null?void 0:Vr.s}`);for(let Vr in br)(Gr=br[Vr])==null||Gr.addSignature(Er,Buffer$2.from(Br[Vr],"hex"));return br}async addSignature(br,wr){var Wr,qr;const Er=new PublicKey(wr);let kr=this.getMessageToSign(br);const jr=await this.signRawPayload(kr.toString("hex"),wr),Br=`${(Wr=jr.signRawPayloadResult)==null?void 0:Wr.r}${(qr=jr.signRawPayloadResult)==null?void 0:qr.s}`;br.addSignature(Er,Buffer$2.from(Br,"hex"))}async signMessage(br,wr){var kr,jr;const Er=await this.signRawPayload(Buffer$2.from(br).toString("hex"),wr);return Buffer$2.from(`${(kr=Er.signRawPayloadResult)==null?void 0:kr.r}${(jr=Er.signRawPayloadResult)==null?void 0:jr.s}`,"hex")}async signRawPayload(br,wr){const Er=await this.client.signRawPayload({type:"ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",organizationId:this.organizationId,timestampMs:String(Date.now()),parameters:{signWith:wr,payload:br,encoding:"PAYLOAD_ENCODING_HEXADECIMAL",hashFunction:"HASH_FUNCTION_NOT_APPLICABLE"}}),{id:kr,status:jr,type:Br,result:Wr}=Er.activity;if(jr!=="ACTIVITY_STATUS_COMPLETED")throw new TurnkeyActivityError({message:`Expected COMPLETED status, got ${jr}`,activityId:kr,activityStatus:jr,activityType:Br});return Wr}async signRawPayloads(br,wr){const Er=await this.client.signRawPayloads({type:"ACTIVITY_TYPE_SIGN_RAW_PAYLOADS",organizationId:this.organizationId,timestampMs:String(Date.now()),parameters:{signWith:wr,payloads:br,encoding:"PAYLOAD_ENCODING_HEXADECIMAL",hashFunction:"HASH_FUNCTION_NOT_APPLICABLE"}}),{id:kr,status:jr,type:Br,result:Wr}=Er.activity;if(jr!=="ACTIVITY_STATUS_COMPLETED")throw new TurnkeyActivityError({message:`Expected COMPLETED status, got ${jr}`,activityId:kr,activityStatus:jr,activityType:Br});return Wr}getMessageToSign(br){let wr;return typeof br.serializeMessage=="function"?wr=br.serializeMessage():wr=Buffer$2.from(br.message.serialize()),wr}}var version$3="3.8.2";function __awaiter$1(fr,br,wr,Er){function kr(jr){return jr instanceof wr?jr:new wr(function(Br){Br(jr)})}return new(wr||(wr=Promise))(function(jr,Br){function Wr(Vr){try{Gr(Er.next(Vr))}catch(Zr){Br(Zr)}}function qr(Vr){try{Gr(Er.throw(Vr))}catch(Zr){Br(Zr)}}function Gr(Vr){Vr.done?jr(Vr.value):kr(Vr.value).then(Wr,qr)}Gr((Er=Er.apply(fr,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var version$2="3.8.2";function __rest(fr,br){var wr={};for(var Er in fr)Object.prototype.hasOwnProperty.call(fr,Er)&&br.indexOf(Er)<0&&(wr[Er]=fr[Er]);if(fr!=null&&typeof Object.getOwnPropertySymbols=="function")for(var kr=0,Er=Object.getOwnPropertySymbols(fr);kr{var fr,br,wr;return typeof process$1$1<"u"&&define_process_env_default$1&&(wr=(br=(fr=define_process_env_default$1.ICONIC_SPRITE_CDN_URL)!==null&&fr!==void 0?fr:define_process_env_default$1.NEXT_PUBLIC_ICONIC_SPRITE_CDN_URL)!==null&&br!==void 0?br:define_process_env_default$1.REACT_APP_ICONIC_SPRITE_CDN_URLL)!==null&&wr!==void 0?wr:DEFAULT_ICONIC_SPRITE_URL},ICONIC_SPRITE_URL=getIconicSpriteUrl(),createIconic=fr=>{const br=Object.assign(Object.assign({},fr),{function:Er=>{const kr=`${ICONIC_SPRITE_URL}#${br.iconName}`;return reactExports.createElement("img",Object.assign(Object.assign({"data-testid":`iconic-${br.iconName}`},Er),{alt:br.alt,src:kr}))}}),wr=br.function.bind(br);return Object.assign(wr,{iconName:br.iconName,sourcePath:br.sourcePath}),wr};createIconic({alt:"Brave Browser",iconName:"brave",sourcePath:"icons/browsers/brave.svg"});createIconic({alt:"Chrome Browser",iconName:"chrome",sourcePath:"icons/browsers/chrome.svg"});createIconic({alt:"Edge Browser",iconName:"edge",sourcePath:"icons/browsers/edge.svg"});createIconic({alt:"Firefox Browser",iconName:"firefox",sourcePath:"icons/browsers/firefox.svg"});createIconic({alt:"Opera Browser",iconName:"opera",sourcePath:"icons/browsers/opera.svg"});createIconic({alt:"Opera Browser",iconName:"safari",sourcePath:"icons/browsers/safari.svg"});createIconic({alt:"Algorand Chain",iconName:"algorand",sourcePath:"icons/chains/algorand.svg"});createIconic({alt:"Arbitrum Chain",iconName:"arbitrum",sourcePath:"icons/chains/arbitrum.svg"});createIconic({alt:"Aurora Chain",iconName:"aurora",sourcePath:"icons/chains/aurora.svg"});createIconic({alt:"Base Chain",iconName:"base",sourcePath:"icons/chains/base.svg"});createIconic({alt:"Berachain Chain",iconName:"berachain",sourcePath:"icons/chains/berachain.svg"});createIconic({alt:"Bitcoin Chain",iconName:"bitcoin",sourcePath:"icons/chains/bitcoin.svg"});createIconic({alt:"BNB Chain",iconName:"bnb",sourcePath:"icons/chains/bnb.svg"});createIconic({alt:"Cosmos Chain",iconName:"cosmos",sourcePath:"icons/chains/cosmos.svg"});createIconic({alt:"Osmosis Chain",iconName:"osmosis",sourcePath:"icons/chains/osmosis.svg"});createIconic({alt:"Axelar Chain",iconName:"axelar",sourcePath:"icons/chains/axelar.svg"});createIconic({alt:"Ethereum Chain",iconName:"ethereum",sourcePath:"icons/chains/ethereum.svg"});createIconic({alt:"Goerli Chain",iconName:"goerli",sourcePath:"icons/chains/goerli.svg"});createIconic({alt:"zkSync Era Chain",iconName:"zkSync",sourcePath:"icons/chains/zkSync.svg"});createIconic({alt:"Flow Chain",iconName:"flow",sourcePath:"icons/chains/flow.svg"});createIconic({alt:"Gnosis Chain",iconName:"gnosis",sourcePath:"icons/chains/gnosis.svg"});createIconic({alt:"Optimism Chain",iconName:"optimism",sourcePath:"icons/chains/optimism.svg"});createIconic({alt:"Palm Chain",iconName:"palm",sourcePath:"icons/chains/palm.svg"});createIconic({alt:"Polygon Chain",iconName:"polygon",sourcePath:"icons/chains/polygon.svg"});createIconic({alt:"Solana Chain",iconName:"solana",sourcePath:"icons/chains/solana.svg"});createIconic({alt:"Starknet Chain",iconName:"starknet",sourcePath:"icons/chains/starknet.svg"});createIconic({alt:"1inch Wallet",iconName:"1inch.svg",sourcePath:"icons/wallets/1inch.svg"});createIconic({alt:"Argent X Wallet",iconName:"argentx",sourcePath:"icons/wallets/argentx.svg"});createIconic({alt:"Argent Mobile",iconName:"argentmobile",sourcePath:"icons/wallets/argent-mobile.svg"});createIconic({alt:"Argent Web Wallet",iconName:"argentwebwallet",sourcePath:"icons/wallets/argent-web-wallet.svg"});createIconic({alt:"Backpack Wallet",iconName:"backpack",sourcePath:"icons/wallets/backpack.svg"});createIconic({alt:"Binance Wallet",iconName:"binance.svg",sourcePath:"icons/wallets/binance.svg"});createIconic({alt:"BitPay Wallet",iconName:"bitpay.svg",sourcePath:"icons/wallets/bitpay.svg"});createIconic({alt:"Blocto Wallet",iconName:"blocto",sourcePath:"icons/wallets/blocto.svg"});createIconic({alt:"Braavos Wallet",iconName:"braavos",sourcePath:"icons/wallets/braavos.svg"});createIconic({alt:"Coin98 Wallet",iconName:"coin98",sourcePath:"icons/wallets/coin98.svg"});createIconic({alt:"Coinbase Wallet",iconName:"coinbase",sourcePath:"icons/wallets/coinbase.svg"});createIconic({alt:"Crypto Wallet",iconName:"crypto.svg",sourcePath:"icons/wallets/crypto.svg"});createIconic({alt:"Dapper Wallet",iconName:"dapper",sourcePath:"icons/wallets/dapper.svg"});createIconic({alt:"Dawn Wallet",iconName:"dawn",sourcePath:"icons/wallets/dawn.svg"});createIconic({alt:"Default Wallet",iconName:"defaultwallet",sourcePath:"icons/wallets/default.svg"});createIconic({alt:"Dapper Wallet",iconName:"emailsign.svg",sourcePath:"icons/wallets/emailsign.svg"});createIconic({alt:"Sign in with Email",iconName:"signinwithemail",sourcePath:"icons/wallets/signinwithemail.svg"});createIconic({alt:"Exodus Wallet",iconName:"exodus",sourcePath:"icons/wallets/exodus.svg"});createIconic({alt:"Fireblocks Wallet",iconName:"fireblocks.svg",sourcePath:"icons/wallets/fireblocks.svg"});createIconic({alt:"Fortmatic Wallet",iconName:"fortmatic",sourcePath:"icons/wallets/fortmatic.svg"});createIconic({alt:"Frame Wallet",iconName:"frame",sourcePath:"icons/wallets/frame.svg"});createIconic({alt:"Gamestop Wallet",iconName:"gamestop",sourcePath:"icons/wallets/gamestop.svg"});createIconic({alt:"Glow Wallet",iconName:"glow",sourcePath:"icons/wallets/glow.svg"});createIconic({alt:"ImToken Wallet",iconName:"imtoken.svg",sourcePath:"icons/wallets/imtoken.svg"});createIconic({alt:"Injected Wallet",iconName:"injectedwallet",sourcePath:"icons/wallets/injectedwallet.svg"});createIconic({alt:"Keplr Wallet",iconName:"keplr",sourcePath:"icons/wallets/keplr.svg"});createIconic({alt:"Ledger Wallet",iconName:"ledger",sourcePath:"icons/wallets/ledger.svg"});createIconic({alt:"Lilico Wallet",iconName:"lilico",sourcePath:"icons/wallets/lilico.svg"});createIconic({alt:"Linen Wallet",iconName:"linen.svg",sourcePath:"icons/wallets/linen.svg"});createIconic({alt:"Matic Wallet",iconName:"matic",sourcePath:"icons/wallets/matic.svg"});createIconic({alt:"MetaMask Wallet",iconName:"metamask",sourcePath:"icons/wallets/metamask.svg"});createIconic({alt:"Missing Wallet",iconName:"missing",sourcePath:"icons/wallets/missing.svg"});createIconic({alt:"MyAlgo Wallet",iconName:"myalgo",sourcePath:"icons/wallets/myalgo.svg"});createIconic({alt:"Omni Wallet",iconName:"omni",sourcePath:"icons/wallets/omni.svg"});createIconic({alt:"OpeanSea Wallet",iconName:"opeansea",sourcePath:"icons/wallets/opensea.svg"});createIconic({alt:"Pera Wallet",iconName:"pera",sourcePath:"icons/wallets/pera.svg"});createIconic({alt:"Phantom Wallet",iconName:"phantom",sourcePath:"icons/wallets/phantom.svg"});createIconic({alt:"Rabby Wallet",iconName:"rabby",sourcePath:"icons/wallets/rabby.svg"});createIconic({alt:"Rainbow Wallet",iconName:"rainbow",sourcePath:"icons/wallets/rainbow.svg"});createIconic({alt:"Safe Wallet",iconName:"safe",sourcePath:"icons/wallets/safe.svg"});createIconic({alt:"Sequence Wallet",iconName:"sequence",sourcePath:"icons/wallets/sequence.svg"});createIconic({alt:"Solflare Wallet",iconName:"solflare",sourcePath:"icons/wallets/solflare.svg"});createIconic({alt:"Spot Wallet",iconName:"spot",sourcePath:"icons/wallets/spot.svg"});createIconic({alt:"Stroke Wallet",iconName:"stroke",sourcePath:"icons/wallets/stroke.svg"});createIconic({alt:"Taho Wallet",iconName:"tallycash",sourcePath:"icons/wallets/tallycash.svg"});createIconic({alt:"Terra Wallet",iconName:"terra",sourcePath:"icons/wallets/terra.svg"});createIconic({alt:"Torus Wallet",iconName:"torus",sourcePath:"icons/wallets/torus.svg"});createIconic({alt:"Trust Wallet",iconName:"trust",sourcePath:"icons/wallets/trust.svg"});createIconic({alt:"Unstoppable Wallet",iconName:"unstoppable",sourcePath:"icons/wallets/unstoppable.svg"});createIconic({alt:"Venly Wallet",iconName:"venly",sourcePath:"icons/wallets/venly.svg"});createIconic({alt:"Wallet Connect Wallet",iconName:"walletconnect",sourcePath:"icons/wallets/walletconnect.svg"});createIconic({alt:"Magic Link Wallet",iconName:"magiclink",sourcePath:"icons/wallets/magic-link.svg"});createIconic({alt:"Turnkey",iconName:"turnkey",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic({alt:"Zengo Wallet",iconName:"zengo",sourcePath:"icons/wallets/zengo.svg"});createIconic({alt:"Superb Wallet",iconName:"superb",sourcePath:"icons/wallets/superb.svg"});createIconic({alt:"ZeroDev",iconName:"zerodev",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic({alt:"Smart Wallet",iconName:"smartwallet",sourcePath:"icons/wallets/smart-wallet.svg"});createIconic({alt:"Magic Eden",iconName:"magiceden",sourcePath:"icons/wallets/magiceden.svg"});createIconic({alt:"Xverse",iconName:"xverse",sourcePath:"icons/wallets/xverse.svg"});createIconic({alt:"Unisat",iconName:"unisat",sourcePath:"icons/wallets/unisat.svg"});createIconic({alt:"Leather",iconName:"leather",sourcePath:"icons/wallets/leather.svg"});createIconic({alt:"OKX",iconName:"okx",sourcePath:"icons/wallets/okx.svg"});createIconic({alt:"Coinbase WaaS",iconName:"coinbasewaas",sourcePath:"icons/wallets/embedded-wallet.svg"});createIconic({alt:"MetaMask Starknet Snap",iconName:"metamaskstarknetsnap",sourcePath:"icons/wallets/metamask-starknet.svg"});createIconic({alt:"Nightly",iconName:"nightly",sourcePath:"icons/wallets/nightly.svg"});createIconic({alt:"OneKey",iconName:"onekey",sourcePath:"icons/wallets/onekey.svg"});createIconic({alt:"Ambire",iconName:"ambire",sourcePath:"icons/wallets/ambire.svg"});createIconic({alt:"Bitget Wallet",iconName:"bitgetwallet",sourcePath:"icons/wallets/bitgetwallet.svg"});createIconic({alt:"Math Wallet",iconName:"coin98",sourcePath:"icons/wallets/coin98.svg"});createIconic({alt:"Clover Wallet",iconName:"clover",sourcePath:"icons/wallets/clover.svg"});createIconic({alt:"Apple",iconName:"apple",sourcePath:"icons/mobile/apple.svg"});createIconic({alt:"Android",iconName:"android",sourcePath:"icons/mobile/android.svg"});createIconic({alt:"Bitbucket",iconName:"bitbucket",sourcePath:"icons/social/bitbucket.svg"});createIconic({alt:"Discord",iconName:"discord",sourcePath:"icons/social/discord.svg"});createIconic({alt:"Facebook",iconName:"facebook",sourcePath:"icons/social/facebook.svg"});createIconic({alt:"Farcaster",iconName:"farcaster",sourcePath:"icons/social/farcaster.svg"});createIconic({alt:"Github",iconName:"github",sourcePath:"icons/social/github.svg"});createIconic({alt:"Github",iconName:"github-dark",sourcePath:"icons/social/github-dark.svg"});createIconic({alt:"Gitlab",iconName:"gitlab",sourcePath:"icons/social/gitlab.svg"});createIconic({alt:"Google",iconName:"google",sourcePath:"icons/social/google.svg"});createIconic({alt:"Helpdesk",iconName:"helpdesk",sourcePath:"icons/social/helpdesk.svg"});createIconic({alt:"Linkedin",iconName:"linkedin",sourcePath:"icons/social/linkedin.svg"});createIconic({alt:"Microsoft",iconName:"microsoft",sourcePath:"icons/social/microsoft.svg"});createIconic({alt:"Slack",iconName:"slack",sourcePath:"icons/social/slack.svg"});createIconic({alt:"Telegram",iconName:"telegram",sourcePath:"icons/social/telegram.svg"});createIconic({alt:"Twitch",iconName:"twitch",sourcePath:"icons/social/twitch.svg"});createIconic({alt:"Twitch",iconName:"twitch-dark",sourcePath:"icons/social/twitch-dark.svg"});createIconic({alt:"Twitter",iconName:"twitter",sourcePath:"icons/social/twitter.svg"});createIconic({alt:"Twitter",iconName:"twitter-dark",sourcePath:"icons/social/twitter-dark.svg"});createIconic({alt:"Apple",iconName:"apple",sourcePath:"icons/social/apple.svg"});createIconic({alt:"Apple",iconName:"apple-dark",sourcePath:"icons/social/apple-dark.svg"});createIconic({alt:"Coinbase",iconName:"coinbasesocial",sourcePath:"icons/social/coinbasesocial.svg"});createIconic({alt:"Coinbase",iconName:"coinbasesocial-dark",sourcePath:"icons/social/coinbasesocial-dark.svg"});createIconic({alt:"Instagram",iconName:"instagram",sourcePath:"icons/social/instagram.svg"});createIconic({alt:"YouTube",iconName:"youtube",sourcePath:"icons/social/youtube.svg"});createIconic({alt:"onePassword",iconName:"one-password",sourcePath:"icons/social/onePassword.svg"});createIconic({alt:"onePassword-dark",iconName:"one-password-dark",sourcePath:"icons/social/onePassword-dark.svg"});createIconic({alt:"epicGames",iconName:"epicgames",sourcePath:"icons/social/epicgames.svg"});createIconic({alt:"epicGames-dark",iconName:"epicgames-dark",sourcePath:"icons/social/epicgames-dark.svg"});createIconic({alt:"spotify",iconName:"spotify",sourcePath:"icons/social/spotify.svg"});createIconic({alt:"spotify-dark",iconName:"spotify-dark",sourcePath:"icons/social/spotify-dark.svg"});createIconic({alt:"steam",iconName:"steam",sourcePath:"icons/social/steam.svg"});createIconic({alt:"steam-dark",iconName:"steam-dark",sourcePath:"icons/social/steam-dark.svg"});createIconic({alt:"tiktok",iconName:"tiktok",sourcePath:"icons/social/tiktok.svg"});createIconic({alt:"tiktok-dark",iconName:"tiktok-dark",sourcePath:"icons/social/tiktok-dark.svg"});createIconic({alt:"line",iconName:"line",sourcePath:"icons/social/line.svg"});createIconic({alt:"Captcha Wave",iconName:"captcha-wave",sourcePath:"icons/misc/captcha-wave.svg"});createIconic({alt:"User Profile",iconName:"user-profile",sourcePath:"icons/misc/user-profile.svg"});createIconic({alt:"Arrow Send",iconName:"arrow-send",sourcePath:"icons/misc/arrow-send.svg"});typeof SuppressedError=="function"&&SuppressedError;new Logger$1("iconic");assertPackageVersion("@dynamic-labs/iconic",version);`${getIconicSpriteUrl()}`;new Logger$1("WalletBook");typeof SuppressedError=="function"&&SuppressedError;const walletConnectSourceValueSchema=z$6.object({app:z$6.object({android:z$6.string().nullable(),browser:z$6.string().nullable(),chrome:z$6.string().nullable(),edge:z$6.string().nullable(),firefox:z$6.string().nullable(),ios:z$6.string().nullable(),linux:z$6.string().nullable(),mac:z$6.string().nullable(),opera:z$6.string().nullable(),safari:z$6.string().nullable(),windows:z$6.string().nullable()}),app_type:z$6.string(),category:z$6.string().nullable(),chains:z$6.array(z$6.string()),description:z$6.string().nullable(),desktop:z$6.object({native:z$6.string().nullable(),universal:z$6.string().nullable()}),homepage:z$6.string(),id:z$6.string(),image_id:z$6.string(),image_url:z$6.object({lg:z$6.string(),md:z$6.string(),sm:z$6.string()}),injected:z$6.array(z$6.object({injected_id:z$6.string(),namespace:z$6.string()})).nullable(),metadata:z$6.object({colors:z$6.object({primary:z$6.string().nullable(),secondary:z$6.string().nullable()}),shortName:z$6.string().nullable()}),mobile:z$6.object({native:z$6.string().nullable(),universal:z$6.string().nullable()}),name:z$6.string(),rdns:z$6.string().nullable(),sdks:z$6.array(z$6.string()),slug:z$6.string(),supported_standards:z$6.array(z$6.object({id:z$6.string(),standard_id:z$6.number(),standard_prefix:z$6.string(),title:z$6.string(),url:z$6.string()})).optional(),updatedAt:z$6.string(),versions:z$6.array(z$6.string())}).strict();z$6.record(z$6.string(),walletConnectSourceValueSchema);const nonEmptyString=z$6.preprocess(fr=>fr||void 0,z$6.string().optional()),transformChromeExtensionId=fr=>{if(fr!=null&&fr.match(/^[a-z]{32}$/))return fr;if(fr!=null&&fr.includes("chrome.google.com/webstore/detail/"))try{return new URL(fr).pathname.split("/").at(-1)}catch{}},transformEdgeExtensionId=fr=>{if(fr!=null&&fr.match(/^[a-z]{32}$/))return fr;if(fr!=null&&fr.includes("microsoftedge.microsoft.com/addons/detail/"))try{return new URL(fr).pathname.split("/").at(-1)}catch{}},transformFirefoxExtensionId=fr=>{if(!(fr!=null&&fr.match(/^https?:\/\//)))return fr;if(fr!=null&&fr.includes("addons.mozilla.org"))try{return new URL(fr).pathname.replace(/\/$/,"").split("/").at(-1)}catch{}},idRegex=/^id[0-9]{1,36}$/,transformIosId=fr=>{if(fr!=null&&fr.match(idRegex))return fr;if(fr!=null&&fr.match(/^https:\/\/[a-zA-Z0-9-]+\.apple\.com/))try{const wr=new URL(fr).pathname.replace(/\/$/,"").split("/").at(-1);if(wr!=null&&wr.match(idRegex))return wr}catch{}},transformAndroidId=fr=>{if(!(fr!=null&&fr.match(/^https?:\/\//)))return fr;if(fr)try{const wr=new URL(fr).searchParams.get("id");if(wr)return wr}catch{}},nonEmptyStringArray=z$6.preprocess(fr=>Array.isArray(fr)&&fr.length>0?fr:void 0,z$6.array(z$6.string()).optional()),filterEmptyObject=fr=>fr&&Object.values(fr).some(br=>!!br)?fr:void 0,injectedConfigSchema=z$6.object({chain:z$6.string(),extensionLocators:z$6.array(z$6.object({flag:z$6.string(),value:z$6.boolean().optional().default(!0)})),providerInterface:z$6.string().optional(),walletStandard:z$6.object({features:z$6.array(z$6.string()),name:z$6.string(),providerId:z$6.string().optional()}).optional(),walletStandardLocators:z$6.array(z$6.object({locator:z$6.string(),name:z$6.string()})).optional(),windowLocations:z$6.array(z$6.string()).optional().refine(fr=>!fr||!fr.some(br=>["ethereum","ethereum.providers"].includes(br)),{message:"windowLocations cannot include ethereum or ethereum.providers as they are included by default",path:["config"]})}),brandSchema=z$6.object({alt:nonEmptyString,primaryColor:nonEmptyString,spriteId:nonEmptyString}),walletSchema=z$6.preprocess(fr=>fr,z$6.object({brand:brandSchema.optional(),chainGroup:z$6.string().optional(),chains:z$6.array(z$6.string()).optional(),desktop:z$6.object({chromeId:nonEmptyString.transform(transformChromeExtensionId),edgeId:nonEmptyString.transform(transformEdgeExtensionId),firefoxId:nonEmptyString.transform(transformFirefoxExtensionId),native:nonEmptyString,operaId:nonEmptyString,safariId:nonEmptyString,universal:nonEmptyString}).optional().transform(filterEmptyObject),eip6963Config:z$6.object({rdns:z$6.string()}).optional(),filterFromWalletConnect:z$6.boolean().optional(),group:z$6.string().optional(),hardwareWallets:z$6.array(z$6.string()).optional(),injectedConfig:z$6.array(injectedConfigSchema).optional(),mobile:z$6.object({android:stringType().nullish(),androidId:nonEmptyString.transform(transformAndroidId),inAppBrowser:stringType().nullish(),ios:stringType().nullish(),iosId:nonEmptyString.transform(transformIosId),native:nonEmptyString,universal:nonEmptyString}).optional().transform(filterEmptyObject),mobileExperience:z$6.enum(["in-app-browser","redirect"]).optional(),name:z$6.string(),shortName:nonEmptyString,showOnlyIfInstalled:z$6.boolean().optional(),switchNetworkOnlyFromWallet:z$6.boolean().optional(),walletConnect:z$6.object({sdks:nonEmptyStringArray}).optional().transform(filterEmptyObject),walletGroup:z$6.string().optional(),walletLimitations:z$6.object({browserExtension:z$6.object({unsupportedEvents:z$6.array(z$6.string()).optional(),unsupportedMethods:z$6.array(z$6.string()).optional()}).optional(),mobile:z$6.object({unsupportedEvents:z$6.array(z$6.string()).optional(),unsupportedMethods:z$6.array(z$6.string()).optional()}).optional()}).optional()})).transform(fr=>{var br,wr,Er,kr,jr,Br;return fr.group&&(fr.chainGroup=fr.group),(!((br=fr.mobile)===null||br===void 0)&&br.iosId||((wr=fr.mobile)===null||wr===void 0?void 0:wr.ios)===null)&&((Er=fr.mobile)===null||Er===void 0||delete Er.ios),(!((kr=fr.mobile)===null||kr===void 0)&&kr.androidId||((jr=fr.mobile)===null||jr===void 0?void 0:jr.android)===null)&&((Br=fr.mobile)===null||Br===void 0||delete Br.android),fr}),WalletOverrideEntrySchema=z$6.object({brand:brandSchema.optional(),name:nonEmptyString}),walletGroupSchema=z$6.object({brand:z$6.object({alt:nonEmptyString,primaryColor:nonEmptyString,spriteId:nonEmptyString}).optional(),key:z$6.string(),name:z$6.string(),walletOverrides:z$6.record(WalletOverrideEntrySchema).optional()});z$6.record(z$6.string(),walletSchema);z$6.preprocess(fr=>fr,z$6.object({groups:z$6.record(z$6.string(),walletGroupSchema),wallets:z$6.record(z$6.string(),walletSchema)}));z$6.record(z$6.string(),walletGroupSchema);assertPackageVersion("@dynamic-labs/wallet-book",version$1);const logger$1=new Logger$1("WalletConnector"),shouldLowercaseAddress=fr=>["eip155","flow","evm","eth","avax","matic"].includes(fr.toLowerCase()),normalizeAddress=(fr,br)=>(fr.startsWith("0x")&&(fr=fr.slice(2)),shouldLowercaseAddress(br)?fr.toLowerCase():fr),isSameAddress=(fr,br,wr)=>normalizeAddress(fr,wr)===normalizeAddress(br,wr);new EventEmitter$2;class Wallet extends BaseWallet{constructor(br){var{connector:wr}=br,Er=__rest(br,["connector"]);super(Er),this._connector=wr}get connector(){return this._connector}getBalance(){return __awaiter(this,void 0,void 0,function*(){return this._connector.getBalance(this.address)})}getNameService(){return __awaiter(this,void 0,void 0,function*(){return this._connector.getNameService(this.address)})}getNetwork(){return __awaiter(this,void 0,void 0,function*(){return this._connector.getNetwork()})}isConnected(){return __awaiter(this,void 0,void 0,function*(){try{return(yield this._connector.getConnectedAccounts()).map(wr=>normalizeAddress(wr,this.chain)).includes(normalizeAddress(this.address,this.chain))}catch(br){return logger$1.error("[Wallet] isConnected - Error detecting if wallet is connected",br),!1}})}proveOwnership(br){return __awaiter(this,void 0,void 0,function*(){return this._connector.proveOwnership(this.address,br)})}signMessage(br){return __awaiter(this,void 0,void 0,function*(){return yield this.sync(),this._connector.signMessage(br,this.address)})}switchNetwork(br){return __awaiter(this,void 0,void 0,function*(){return this._connector.switchNetwork({networkChainId:br})})}sync(){return __awaiter(this,void 0,void 0,function*(){return this._connector.validateActiveWallet(this.address)})}}assertPackageVersion("@dynamic-labs/wallet-connector-core",version$2);class SolanaWallet extends Wallet{getConnection(){return __awaiter$1(this,void 0,void 0,function*(){return this._connector.getWalletClient()})}getSigner(){return __awaiter$1(this,void 0,void 0,function*(){const br=yield this._connector.getSigner();if(!br)throw new Error("unable to retrieve Solana signer");try{return cloneObjectWithOverrides(br,{signAllTransactions:wr=>__awaiter$1(this,void 0,void 0,function*(){return yield this.sync(),br.signAllTransactions(wr)}),signAndSendTransaction:(wr,...Er)=>__awaiter$1(this,void 0,void 0,function*(){return yield this.sync(),br.signAndSendTransaction(wr,...Er)}),signMessage:(wr,...Er)=>__awaiter$1(this,void 0,void 0,function*(){return yield this.sync(),br.signMessage(wr,...Er)}),signTransaction:wr=>__awaiter$1(this,void 0,void 0,function*(){return yield this.sync(),br.signTransaction(wr)})})}catch(wr){return logger$1.warn(`Failed to add logic to auto-sync the wallet. Signer might be out of sync for wallet: ${this._connector.name} (${this.address})`,wr),br}})}}const SOLANA_GENESIS_HASH="genesis-hash",getGenesisHashLSKey=fr=>`${fr}_${SOLANA_GENESIS_HASH}`;new PublicKey$2("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr");ChainRpcProviders.getSolanaProviderByChainId=(fr,br)=>{var wr;return(wr=fr.solana)===null||wr===void 0?void 0:wr.find(kr=>kr.chainId===br)};ChainRpcProviders.registerSolanaProviders=fr=>{ChainRpcProviders.registerChainProviders(ProviderChain.SOLANA,br=>{const wr={};return br!=null&&br.solana&&(wr.solana=br.solana.map(Er=>{var kr;const jr=((kr=Er.privateCustomerRpcUrls)===null||kr===void 0?void 0:kr[0])||Er.rpcUrls[0],Br=new Connection(jr,fr);return{chainId:Er.chainId.toString(),chainName:Er.name,provider:Br}})),wr.solana})};const isTxAlreadySigned=fr=>{let br=!1;return"version"in fr?br=fr.signatures.some(wr=>!wr.every(Er=>Er===0)):br=fr.signatures.some(wr=>wr.signature),br},LAMPORTS_PER_SOL=1e9;class SolanaUiTransaction{constructor({onSubmit:br,from:wr,connection:Er,multipleTransactions:kr}){this.chain="SOL",this.data=void 0,this.fee={gas:void 0},this.formatNonNativeToken=(jr,Br)=>(Number(jr)/Number(Math.pow(10,Br))).toString(),this.from=wr,this.onSubmit=br,this.connection=Er,this.multipleTransactions=kr}fetchFee(){return __awaiter$1(this,void 0,void 0,function*(){if(this.fee.gas)return;let br=this.multipleTransactions;if(!br){const Br=yield this.createTransactionSafe();if(!Br)return;br=Br instanceof Array?Br:[Br]}const{blockhash:wr}=yield this.connection.getLatestBlockhash(),Er=yield Promise.all(br.map(Br=>__awaiter$1(this,void 0,void 0,function*(){return"version"in Br?((yield isTxAlreadySigned(Br))||(Br.message.recentBlockhash=wr),Br.message):((yield isTxAlreadySigned(Br))||(Br.recentBlockhash=wr),Br.compileMessage())})));if(Er.some(Br=>!Br))throw new Error("Invalid transaction");const kr=Br=>__awaiter$1(this,void 0,void 0,function*(){let Wr=yield this.connection.getFeeForMessage(Br),qr=0;for(;Wr.value===null&&qr<5;)Wr=yield this.connection.getFeeForMessage(Br),qr++;return Wr.value?BigInt(Wr.value):BigInt(0)}),jr=yield Promise.all(Er.map(Br=>kr(Br)));this.fee.gas=jr.reduce((Br,Wr)=>Br+Wr,BigInt(0)),this.fee.gas===BigInt(0)&&(this.fee.gas=void 0)})}isGasSponsored(){var br;return!((br=this.multipleTransactions)===null||br===void 0)&&br.length?this.multipleTransactions.every(wr=>{var Er;return"version"in wr?this.from!==wr.message.staticAccountKeys[0].toBase58():"feePayer"in wr?this.from!==((Er=wr.feePayer)===null||Er===void 0?void 0:Er.toBase58()):!1}):!1}parse(br){const wr=parseFloat(br),Er=Math.round(wr*LAMPORTS_PER_SOL);return BigInt(Er)}parseNonNativeToken(br,wr){return BigInt(Math.floor(Number(br)*Math.pow(10,wr)))}format(br,{precision:wr}={}){const kr=(Number(br)/LAMPORTS_PER_SOL).toLocaleString("fullwide",{maximumFractionDigits:20,minimumFractionDigits:0,useGrouping:!1});return formatNumberText(kr,{precision:wr})}submit(){return __awaiter$1(this,void 0,void 0,function*(){if(this.multipleTransactions)return this.onSubmit();const br=yield this.createTransaction();return this.onSubmit(br)})}getBalance(){return __awaiter$1(this,void 0,void 0,function*(){const br=new PublicKey$2(this.from),wr=yield this.connection.getBalance(br);return BigInt(wr)})}validateAddressFormat(br){return br==="dyn_send_transaction.multiple_recipients"?!0:/^[1-9A-HJ-NP-Za-km-z]{32,44}$/.test(br)}createTransaction(){return __awaiter$1(this,void 0,void 0,function*(){var br;const{value:wr,to:Er,nonNativeAddress:kr,nonNativeValue:jr}=this;if(!Er)throw new Error("Destination is required");if(this.multipleTransactions)return this.multipleTransactions;const Br=new Transaction,Wr=new PublicKey$2(this.from),qr=new PublicKey$2(Er);if(kr&&jr){const Vr=new PublicKey$2(kr),Zr=jr,Jr=(br=(yield this.connection.getTokenAccountsByOwner(Wr,{mint:Vr})).value[0])===null||br===void 0?void 0:br.pubkey;if(!Jr)throw new Error("Source token account not found");let Qr;try{Qr=yield getAssociatedTokenAddress(Vr,qr),yield this.connection.getTokenAccountBalance(Qr)}catch{Qr=yield getAssociatedTokenAddress(Vr,qr),Br.add(createAssociatedTokenAccountInstruction(Wr,Qr,qr,Vr))}Br.add(createTransferInstruction(Jr,Qr,Wr,Zr))}else{const Vr=wr??BigInt(0);Br.add(SystemProgram.transfer({fromPubkey:Wr,lamports:Vr,toPubkey:qr}))}const{blockhash:Gr}=yield this.connection.getLatestBlockhash();return Br.feePayer=new PublicKey$2(this.from),Br.recentBlockhash=Gr,Br})}createTransactionSafe(){return __awaiter$1(this,void 0,void 0,function*(){try{return yield this.createTransaction()}catch{return}})}}assertPackageVersion("@dynamic-labs/solana-core",version$3);const createSolanaConnection=(fr,br)=>{if(!fr)throw new Error("rpcUrl is required");return new Connection(fr,br)},logger=new Logger$1("DynamicSDK"),AUTH_MIN_TOKEN="dynamic_min_authentication_token",AUTH_MIN_TOKEN_DEMO="dynamic_min_authentication_token_demo",isCookieEnabled=()=>{var fr,br,wr,Er;let kr=(fr=StorageService.getItem("dynamic_store"))!==null&&fr!==void 0?fr:StorageService.getItem("dynamic_store_demo");if(kr=(br=kr==null?void 0:kr.settings)===null||br===void 0?void 0:br.security,!kr)return!1;const jr=(((wr=kr.auth)===null||wr===void 0?void 0:wr.storage)||[]).includes(AuthStorageEnum.Cookie),Br=!!(!((Er=kr.externalAuth)===null||Er===void 0)&&Er.cookieName);return jr||Br},parseToken=fr=>{var br;if(!fr)return;const wr=(br=fr.split(".")[1])===null||br===void 0?void 0:br.replace(/-/g,"+").replace(/_/g,"/"),Er=wr&&decodeURIComponent(atob(wr).split("").map(kr=>`%${`00${kr.charCodeAt(0).toString(16)}`.slice(-2)}`).join(""));return JSON.parse(Er)},decodeMinJwt=fr=>{try{const br=parseToken(fr);return br?MinifiedDynamicJwtFromJSON(br):void 0}catch(br){logger.error(br);return}},getMinAuthToken=()=>{var fr;if(typeof window>"u")return;const br=(fr=StorageService.getItem(AUTH_MIN_TOKEN,{priority:["secureStorage","localStorage"]}))!==null&&fr!==void 0?fr:StorageService.getItem(AUTH_MIN_TOKEN_DEMO,{priority:["secureStorage","localStorage"]});if(!(!br||isMinAuthTokenExpired(br)))return br},isMinAuthTokenExpired=fr=>{const br=decodeMinJwt(fr);return isTokenExpired(br)},isTokenExpired=fr=>{if(!fr||!fr.exp)return!0;const br=new Date(fr.exp*1e3).getTime();return new Date().getTime()>=br};class ApiEndpoint{}ApiEndpoint.getBaseUrl=()=>{if(!ApiEndpoint.__defined__)throw new Error("ApiEndpoint Base URL has not been initialized");return ApiEndpoint.__baseUrl__};ApiEndpoint.setBaseUrl=fr=>{if(!ApiEndpoint.__defined__)fr?ApiEndpoint.__baseUrl__=fr:ApiEndpoint.__baseUrl__=new Configuration().basePath,ApiEndpoint.__defined__=!0;else{if(!fr&&ApiEndpoint.__defined__)return;if(ApiEndpoint.__baseUrl__!==fr)throw new Error(`ApiEndpoint baseUrl is already set to ${ApiEndpoint.__baseUrl__}, cannot change it to ${fr}`)}Object.freeze(ApiEndpoint)};const VERSION=version$4,API_VERSION=dependencies["@dynamic-labs/sdk-api-core"];var define_process_env_default={};const sdkApi=()=>{const fr=define_process_env_default.API_BASE_URL||define_process_env_default.NX_API_BASE_URL||"https://app.dynamic.xyz/api/v0";ApiEndpoint.setBaseUrl(fr);const br={basePath:ApiEndpoint.getBaseUrl(),headers:{"Content-Type":"application/json"}},wr=getMinAuthToken();wr&&(br.headers.Authorization=`Bearer ${wr}`);const Er=isCookieEnabled()?"include":void 0;return br.headers["x-dyn-version"]=`WalletKit/${VERSION}`,br.headers["x-dyn-api-version"]=`API/${API_VERSION}`,new SDKApi(new Configuration(Object.assign(Object.assign({},br),{credentials:Er,fetchApi:FetchService.fetch})))},serializeTransaction=fr=>fr instanceof VersionedTransaction?Buffer$2.from(fr.serialize()).toString("base64"):Buffer$2.from(fr.serialize({verifySignatures:!1})).toString("base64"),deserializeTransaction=fr=>{const br=Buffer$2.from(fr,"base64");return VersionedTransaction.deserialize(br)},optimizeSolanaTransaction=(fr,br,wr)=>__awaiter$2(void 0,void 0,void 0,function*(){const Er=serializeTransaction(br),kr={environmentId:fr,solanaTransactionOptimizationRequest:{address:wr,transaction:Er}},jr=yield sdkApi().optimizeTransaction(kr);return deserializeTransaction(jr.transaction)});class TurnkeySolanaSigner{constructor({walletConnector:br}){this.isConnected=!0,this.providers=[this],this.walletConnector=br,this.turnkeyAddress=this.walletConnector.turnkeyAddress,this.publicKey=this.turnkeyAddress?new PublicKey$2(this.turnkeyAddress):void 0}signMessage(br){return __awaiter$2(this,void 0,void 0,function*(){return{signature:yield this.walletConnector.signUint8ArrayMessage(br)}})}signTransaction(br){return __awaiter$2(this,void 0,void 0,function*(){return this.walletConnector.signTransaction(br)})}signAllTransactions(br){return __awaiter$2(this,void 0,void 0,function*(){return this.walletConnector.signAllTransactions(br)})}signAndSendTransaction(br,wr){return __awaiter$2(this,void 0,void 0,function*(){return{signature:yield this.walletConnector.signAndSendTransaction(br,wr)}})}connect(br){return __awaiter$2(this,void 0,void 0,function*(){return{address:this.turnkeyAddress,publicKey:this.publicKey}})}disconnect(){return __awaiter$2(this,void 0,void 0,function*(){})}}class TurnkeySolanaWalletConnector extends TurnkeyWalletConnectorBase{constructor(br,wr){var Er;super(br,wr),this.ChainWallet=SolanaWallet,this.connectedChain="SOL",this.supportedChains=["SOL"],this.verifiedCredentialChain="solana",this.getEnvId=()=>{const kr=localStorage.getItem("dynamic_nonce");if(kr){const Br=JSON.parse(kr);if(Br&&Br.environmentId)return Br.environmentId}const jr=localStorage.getItem("dynamic_nonce_demo");if(jr){const Br=JSON.parse(jr);if(Br&&Br.environmentId)return Br.environmentId}throw new Error("Failed to get environment id")},this.stampCreateWalletAccountRequest=kr=>__awaiter$2(this,[kr],void 0,function*({request:jr}){return yield this.createOrRestoreSession(),this.getTurnkeyClient().stampCreateWalletAccounts(jr)}),this.solNetworks=wr.solNetworks,this.walletUiUtils=wr.walletUiUtils,this._turnkeyAccount=void 0,this._connectionClient=void 0,this.chainRpcProviders=wr.chainRpcProviders,this.connectionConfig=wr.connectionConfig,(Er=this.chainRpcProviders)===null||Er===void 0||Er.registerSolanaProviders(this.connectionConfig),this.__turnkeyClient=this.getTurnkeyClient()}getRpcUrl(){var br;const[wr]=this.solNetworks;if(!wr)throw new DynamicError("No enabled networks");return((br=wr.privateCustomerRpcUrls)===null||br===void 0?void 0:br[0])||wr.rpcUrls[0]}getConnection(br){if(!this._connectionClient){const wr=this.getRpcUrl();if(!wr)throw new DynamicError("No rpcUrl");const Er=typeof br=="string"?Object.assign(Object.assign({},this.connectionConfig),{commitment:br}):Object.assign(Object.assign({},this.connectionConfig),br);this._connectionClient=createSolanaConnection(wr,Er)}return this._connectionClient}getWalletClient(){return this.getConnection()}getNetwork(){return __awaiter$2(this,void 0,void 0,function*(){const br=this.getConnection();let wr=localStorage.getItem(getGenesisHashLSKey(br.rpcEndpoint));return wr||(wr=yield br.getGenesisHash(),localStorage.setItem(getGenesisHashLSKey(br.rpcEndpoint),wr)),wr=wr.substring(0,32),wr==="5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"?"mainnet":wr==="EtWTRABZaYq6iMfeYKouRu166VU2xqa1"?"devnet":"testnet"})}getPublicClient(){return __awaiter$2(this,void 0,void 0,function*(){var br;if(this.solNetworks.length===0)return;const wr={cosmos:[],evm:void 0,solana:this.solNetworks,starknet:void 0};if(!this.chainRpcProviders)return;const Er=this.chainRpcProviders.getProviders(wr);return(br=this.chainRpcProviders.getSolanaProviderByChainId(Er,"101"))===null||br===void 0?void 0:br.provider})}supportsNetworkSwitching(){return!1}setVerifiedCredentials(br){const wr=findTurnkeyVerifiedCredentials(br,ProviderChain.SOLANA),[Er]=wr;JSON.stringify(this.verifiedCredentials)!==JSON.stringify(wr)&&(this.verifiedCredential=Er,this.verifiedCredentials=wr,this.refreshTurnkeyAccount())}validateActiveWallet(br){return __awaiter$2(this,void 0,void 0,function*(){var wr,Er;const kr=((wr=this.verifiedCredential)===null||wr===void 0?void 0:wr.address)||"";if(!isSameAddress(kr,br,this.connectedChain)){const Br=(Er=this.verifiedCredentials)===null||Er===void 0?void 0:Er.find(Wr=>(Wr==null?void 0:Wr.address)===br);if(!Br)throw new DynamicError("Account not found");this.verifiedCredential=Br,this.refreshTurnkeyAccount()}})}getAccount(){return this.turnkeyAddress}endSession(){return __awaiter$2(this,void 0,void 0,function*(){localStorage.removeItem(getGenesisHashLSKey(this.getRpcUrl()))})}refreshTurnkeyAccount(){return __awaiter$2(this,void 0,void 0,function*(){return this._turnkeyAccount=void 0,this.getTurnkeyAccount()})}getTurnkeyClient(){var br;let wr=getTLD();wr||(wr=PlatformService.getHostname());const Er=PasskeyService.createWebauthnStamper({rpId:wr}),kr=TurnkeyWalletConnectorBase==null?void 0:TurnkeyWalletConnectorBase.apiKeyStamper,jr=kr??Er;return this.__turnkeyClient=(br=this.getAuthenticatorHandler().client)!==null&&br!==void 0?br:new TurnkeyClient({baseUrl:TURNKEY_API_BASE_URL},jr),this.__turnkeyClient}createTurnkeyAccount(br){return __awaiter$2(this,arguments,void 0,function*({organizationId:wr}){const Er=this.getTurnkeyClient();return new TurnkeySigner({client:Er,organizationId:wr})})}getTurnkeyAccount(){return __awaiter$2(this,void 0,void 0,function*(){var br,wr,Er,kr;if(this._turnkeyAccount&&(this.getAuthenticatorHandler().recoveryType==="passkey"&&((br=this.__turnkeyClient)===null||br===void 0?void 0:br.stamper)instanceof WebauthnStamper||this.getAuthenticatorHandler().recoveryType==="email"&&((wr=this.__turnkeyClient)===null||wr===void 0?void 0:wr.stamper)instanceof IframeStamper)&&this.__turnkeyClient===this.getAuthenticatorHandler().client)return this._turnkeyAccount;const{turnkeySubOrganizationId:jr}=(Er=this.walletProperties)!==null&&Er!==void 0?Er:{},{address:Br}=(kr=this.verifiedCredential)!==null&&kr!==void 0?kr:{};if(!(!jr||!Br))return this._turnkeyAccount=yield this.createTurnkeyAccount({organizationId:jr}),this.setLoggerMetadata(),this._turnkeyAccount})}getSigner(){return __awaiter$2(this,void 0,void 0,function*(){return new TurnkeySolanaSigner({walletConnector:this})})}getBalance(br){return __awaiter$2(this,void 0,void 0,function*(){const wr=this.getConnection(),Er=new PublicKey$2(br),kr=yield wr.getBalance(Er);return this.lamportsToSol(kr).toString()})}signUint8ArrayMessage(br){return __awaiter$2(this,void 0,void 0,function*(){if(!this.turnkeyAddress)throw new DynamicError("No turnkey account");const wr=this.turnkeyAddress;let Er;if(yield this.createOrRestoreSession(),yield this.walletUiUtils.signMessage({handler:()=>__awaiter$2(this,void 0,void 0,function*(){let kr=yield this.getTurnkeyAccount();try{Er=yield kr==null?void 0:kr.signMessage(br,wr)}catch{yield this.removeSessionKeys(),yield this.createOrRestoreSession({ignoreRestore:!0}),kr=yield this.getTurnkeyAccount(),Er=yield kr==null?void 0:kr.signMessage(br,wr)}return bufferToBase64(Er||Buffer$2.from([]))}),message:new TextDecoder().decode(br)}),!Er)throw new Error("Failed to sign message");return Er})}signMessage(br){return __awaiter$2(this,void 0,void 0,function*(){const Er=new TextEncoder().encode(br),kr=yield this.signUint8ArrayMessage(Er);return bufferToBase64(kr)})}internalSignTransaction(br){return __awaiter$2(this,void 0,void 0,function*(){yield this.createOrRestoreSession();let wr=yield this.getTurnkeyAccount();const Er=this.turnkeyAddress;if(!wr||!Er)throw new Error("No turnkey account");try{yield wr.addSignature(br,Er)}catch(kr){if(TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS.some(jr=>kr.message.includes(jr)))yield this.removeSessionKeys(),yield this.createOrRestoreSession({ignoreRestore:!0}),wr=yield this.getTurnkeyAccount(),yield wr.addSignature(br,Er);else throw logger$4.error("[TK] failed to perform SignTransaction activity",kr),kr}return br})}signTransaction(br){return __awaiter$2(this,void 0,void 0,function*(){if(!this.turnkeyAddress)throw new DynamicError("No turnkey account");const wr=new SolanaUiTransaction({connection:this.getConnection("confirmed"),from:this.turnkeyAddress,multipleTransactions:[br],onSubmit:()=>__awaiter$2(this,void 0,void 0,function*(){return this.internalSignTransaction(br)})});return this.walletUiUtils.signTransaction(this,wr)})}createUiTransaction(br){return __awaiter$2(this,void 0,void 0,function*(){return yield this.validateActiveWallet(br),new SolanaUiTransaction({connection:this.getConnection("confirmed"),from:br,onSubmit:Er=>__awaiter$2(this,void 0,void 0,function*(){if(Er)return this.internalSignAndSendTransaction(Er)})})})}internalSignAllTransactions(br){return __awaiter$2(this,void 0,void 0,function*(){yield this.createOrRestoreSession();let wr=yield this.getTurnkeyAccount();const Er=this.turnkeyAddress;if(!wr||!Er)throw new Error("No turnkey account");try{return yield wr.signAllTransactions(br,Er)}catch(kr){if(TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS.some(jr=>kr.message.includes(jr)))return yield this.removeSessionKeys(),yield this.createOrRestoreSession({ignoreRestore:!0}),wr=yield this.getTurnkeyAccount(),yield wr.signAllTransactions(br,Er);throw logger$4.error("[TK] failed to perform SignAllTransactions activity",kr),kr}})}signAllTransactions(br){return __awaiter$2(this,void 0,void 0,function*(){if(!this.turnkeyAddress)throw new DynamicError("No turnkey account");const wr=new SolanaUiTransaction({connection:this.getConnection("confirmed"),from:this.turnkeyAddress,multipleTransactions:br,onSubmit:()=>__awaiter$2(this,void 0,void 0,function*(){return this.internalSignAllTransactions(br)})});return this.walletUiUtils.signTransaction(this,wr)})}internalSignAndSendTransaction(br,wr){return __awaiter$2(this,void 0,void 0,function*(){var Er,kr;if(!this.turnkeyAddress)throw new DynamicError("Solana wallet not found");const jr=this.getConnection((kr=(Er=this.connectionConfig)===null||Er===void 0?void 0:Er.commitment)!==null&&kr!==void 0?kr:"confirmed"),Br=yield this.internalSignTransaction(br),Wr=yield jr.sendRawTransaction(Br.serialize(),wr);return new Promise((qr,Gr)=>{const Vr=setTimeout(()=>{Gr(new DynamicError("Transaction timed out"))},6e4);jr.onSignature(Wr,Zr=>{clearTimeout(Vr),Zr.err?Gr(new DynamicError("Transaction failed")):qr(Wr)},"confirmed")})})}signAndSendTransaction(br,wr){return __awaiter$2(this,void 0,void 0,function*(){if(!this.turnkeyAddress)throw new DynamicError("Solana wallet not found");const Er=yield this.optimizeTransaction(br),kr=new SolanaUiTransaction({connection:this.getConnection("confirmed"),from:this.turnkeyAddress,multipleTransactions:[Er],onSubmit:()=>__awaiter$2(this,void 0,void 0,function*(){return this.internalSignAndSendTransaction(Er,wr)})});return this.walletUiUtils.sendTransaction(this,kr)})}sendTransaction(br,wr){return __awaiter$2(this,arguments,void 0,function*(Er,kr,jr={}){var Br;if(!this.turnkeyAddress)throw new DynamicError("Solana wallet not found");if(!Er||!kr)throw new DynamicError("Transaction and connection are required");const{signers:Wr}=jr,qr=__rest$1(jr,["signers"]),Gr=yield kr.getLatestBlockhash({commitment:jr.preflightCommitment,minContextSlot:jr.minContextSlot});"version"in Er?Wr!=null&&Wr.length&&Er.sign(Wr):(Er.feePayer=Er.feePayer||new PublicKey$2(this.turnkeyAddress),Er.recentBlockhash=Er.recentBlockhash||Gr.blockhash,Wr!=null&&Wr.length&&Er.partialSign(...Wr)),qr.preflightCommitment=qr.preflightCommitment||kr.commitment;const Vr=yield kr.sendRawTransaction(Er.serialize(),jr),Zr={blockhash:Gr.blockhash,lastValidBlockHeight:Gr.lastValidBlockHeight,signature:Vr},Jr=yield kr==null?void 0:kr.confirmTransaction(Zr);return!((Br=Jr==null?void 0:Jr.value)===null||Br===void 0)&&Br.err?JSON.stringify(Jr.value.err):Vr})}lamportsToSol(br){return br/LAMPORTS_PER_SOL$2}optimizeTransaction(br){return __awaiter$2(this,void 0,void 0,function*(){var wr;let Er=br;try{(yield this.getNetwork())==="mainnet"&&!isTxAlreadySigned(br)&&(Er=yield optimizeSolanaTransaction(this.getEnvId(),br,(wr=this.turnkeyAddress)!==null&&wr!==void 0?wr:""))}catch(kr){logger$4.warn("Failed to optimize transaction",kr)}return Er})}}const TurnkeySolanaWalletConnectors=fr=>{var br;return!((br=fr.apiProviders)===null||br===void 0)&&br.turnkey?[class extends TurnkeySolanaWalletConnector{constructor(wr){super(TurnkeyWalletConnectorInfo.TurnkeyHD,Object.assign(Object.assign({},fr),wr))}}]:[]};assertPackageVersion("@dynamic-labs/embedded-wallet-solana",version$4);var naclFast={exports:{}};(function(fr){(function(br){var wr=function(So){var Co,Ao=new Float64Array(16);if(So)for(Co=0;Co>24&255,So[Co+1]=Ao>>16&255,So[Co+2]=Ao>>8&255,So[Co+3]=Ao&255,So[Co+4]=po>>24&255,So[Co+5]=po>>16&255,So[Co+6]=po>>8&255,So[Co+7]=po&255}function En(So,Co,Ao,po,Ro){var Xo,jo=0;for(Xo=0;Xo>>8)-1}function Cn(So,Co,Ao,po){return En(So,Co,Ao,po,16)}function In(So,Co,Ao,po){return En(So,Co,Ao,po,32)}function An(So,Co,Ao,po){for(var Ro=po[0]&255|(po[1]&255)<<8|(po[2]&255)<<16|(po[3]&255)<<24,Xo=Ao[0]&255|(Ao[1]&255)<<8|(Ao[2]&255)<<16|(Ao[3]&255)<<24,jo=Ao[4]&255|(Ao[5]&255)<<8|(Ao[6]&255)<<16|(Ao[7]&255)<<24,Ko=Ao[8]&255|(Ao[9]&255)<<8|(Ao[10]&255)<<16|(Ao[11]&255)<<24,Wl=Ao[12]&255|(Ao[13]&255)<<8|(Ao[14]&255)<<16|(Ao[15]&255)<<24,$l=po[4]&255|(po[5]&255)<<8|(po[6]&255)<<16|(po[7]&255)<<24,El=Co[0]&255|(Co[1]&255)<<8|(Co[2]&255)<<16|(Co[3]&255)<<24,Cu=Co[4]&255|(Co[5]&255)<<8|(Co[6]&255)<<16|(Co[7]&255)<<24,iu=Co[8]&255|(Co[9]&255)<<8|(Co[10]&255)<<16|(Co[11]&255)<<24,pu=Co[12]&255|(Co[13]&255)<<8|(Co[14]&255)<<16|(Co[15]&255)<<24,yu=po[8]&255|(po[9]&255)<<8|(po[10]&255)<<16|(po[11]&255)<<24,hu=Ao[16]&255|(Ao[17]&255)<<8|(Ao[18]&255)<<16|(Ao[19]&255)<<24,mu=Ao[20]&255|(Ao[21]&255)<<8|(Ao[22]&255)<<16|(Ao[23]&255)<<24,vu=Ao[24]&255|(Ao[25]&255)<<8|(Ao[26]&255)<<16|(Ao[27]&255)<<24,fu=Ao[28]&255|(Ao[29]&255)<<8|(Ao[30]&255)<<16|(Ao[31]&255)<<24,gu=po[12]&255|(po[13]&255)<<8|(po[14]&255)<<16|(po[15]&255)<<24,ou=Ro,su=Xo,tu=jo,zl=Ko,Gl=Wl,Jl=$l,Pl=El,Ul=Cu,Yl=iu,Vl=pu,Ql=yu,au=hu,Nu=mu,Wu=vu,zu=fu,Bu=gu,Qo,Zu=0;Zu<20;Zu+=2)Qo=ou+Nu|0,Gl^=Qo<<7|Qo>>>25,Qo=Gl+ou|0,Yl^=Qo<<9|Qo>>>23,Qo=Yl+Gl|0,Nu^=Qo<<13|Qo>>>19,Qo=Nu+Yl|0,ou^=Qo<<18|Qo>>>14,Qo=Jl+su|0,Vl^=Qo<<7|Qo>>>25,Qo=Vl+Jl|0,Wu^=Qo<<9|Qo>>>23,Qo=Wu+Vl|0,su^=Qo<<13|Qo>>>19,Qo=su+Wu|0,Jl^=Qo<<18|Qo>>>14,Qo=Ql+Pl|0,zu^=Qo<<7|Qo>>>25,Qo=zu+Ql|0,tu^=Qo<<9|Qo>>>23,Qo=tu+zu|0,Pl^=Qo<<13|Qo>>>19,Qo=Pl+tu|0,Ql^=Qo<<18|Qo>>>14,Qo=Bu+au|0,zl^=Qo<<7|Qo>>>25,Qo=zl+Bu|0,Ul^=Qo<<9|Qo>>>23,Qo=Ul+zl|0,au^=Qo<<13|Qo>>>19,Qo=au+Ul|0,Bu^=Qo<<18|Qo>>>14,Qo=ou+zl|0,su^=Qo<<7|Qo>>>25,Qo=su+ou|0,tu^=Qo<<9|Qo>>>23,Qo=tu+su|0,zl^=Qo<<13|Qo>>>19,Qo=zl+tu|0,ou^=Qo<<18|Qo>>>14,Qo=Jl+Gl|0,Pl^=Qo<<7|Qo>>>25,Qo=Pl+Jl|0,Ul^=Qo<<9|Qo>>>23,Qo=Ul+Pl|0,Gl^=Qo<<13|Qo>>>19,Qo=Gl+Ul|0,Jl^=Qo<<18|Qo>>>14,Qo=Ql+Vl|0,au^=Qo<<7|Qo>>>25,Qo=au+Ql|0,Yl^=Qo<<9|Qo>>>23,Qo=Yl+au|0,Vl^=Qo<<13|Qo>>>19,Qo=Vl+Yl|0,Ql^=Qo<<18|Qo>>>14,Qo=Bu+zu|0,Nu^=Qo<<7|Qo>>>25,Qo=Nu+Bu|0,Wu^=Qo<<9|Qo>>>23,Qo=Wu+Nu|0,zu^=Qo<<13|Qo>>>19,Qo=zu+Wu|0,Bu^=Qo<<18|Qo>>>14;ou=ou+Ro|0,su=su+Xo|0,tu=tu+jo|0,zl=zl+Ko|0,Gl=Gl+Wl|0,Jl=Jl+$l|0,Pl=Pl+El|0,Ul=Ul+Cu|0,Yl=Yl+iu|0,Vl=Vl+pu|0,Ql=Ql+yu|0,au=au+hu|0,Nu=Nu+mu|0,Wu=Wu+vu|0,zu=zu+fu|0,Bu=Bu+gu|0,So[0]=ou>>>0&255,So[1]=ou>>>8&255,So[2]=ou>>>16&255,So[3]=ou>>>24&255,So[4]=su>>>0&255,So[5]=su>>>8&255,So[6]=su>>>16&255,So[7]=su>>>24&255,So[8]=tu>>>0&255,So[9]=tu>>>8&255,So[10]=tu>>>16&255,So[11]=tu>>>24&255,So[12]=zl>>>0&255,So[13]=zl>>>8&255,So[14]=zl>>>16&255,So[15]=zl>>>24&255,So[16]=Gl>>>0&255,So[17]=Gl>>>8&255,So[18]=Gl>>>16&255,So[19]=Gl>>>24&255,So[20]=Jl>>>0&255,So[21]=Jl>>>8&255,So[22]=Jl>>>16&255,So[23]=Jl>>>24&255,So[24]=Pl>>>0&255,So[25]=Pl>>>8&255,So[26]=Pl>>>16&255,So[27]=Pl>>>24&255,So[28]=Ul>>>0&255,So[29]=Ul>>>8&255,So[30]=Ul>>>16&255,So[31]=Ul>>>24&255,So[32]=Yl>>>0&255,So[33]=Yl>>>8&255,So[34]=Yl>>>16&255,So[35]=Yl>>>24&255,So[36]=Vl>>>0&255,So[37]=Vl>>>8&255,So[38]=Vl>>>16&255,So[39]=Vl>>>24&255,So[40]=Ql>>>0&255,So[41]=Ql>>>8&255,So[42]=Ql>>>16&255,So[43]=Ql>>>24&255,So[44]=au>>>0&255,So[45]=au>>>8&255,So[46]=au>>>16&255,So[47]=au>>>24&255,So[48]=Nu>>>0&255,So[49]=Nu>>>8&255,So[50]=Nu>>>16&255,So[51]=Nu>>>24&255,So[52]=Wu>>>0&255,So[53]=Wu>>>8&255,So[54]=Wu>>>16&255,So[55]=Wu>>>24&255,So[56]=zu>>>0&255,So[57]=zu>>>8&255,So[58]=zu>>>16&255,So[59]=zu>>>24&255,So[60]=Bu>>>0&255,So[61]=Bu>>>8&255,So[62]=Bu>>>16&255,So[63]=Bu>>>24&255}function jn(So,Co,Ao,po){for(var Ro=po[0]&255|(po[1]&255)<<8|(po[2]&255)<<16|(po[3]&255)<<24,Xo=Ao[0]&255|(Ao[1]&255)<<8|(Ao[2]&255)<<16|(Ao[3]&255)<<24,jo=Ao[4]&255|(Ao[5]&255)<<8|(Ao[6]&255)<<16|(Ao[7]&255)<<24,Ko=Ao[8]&255|(Ao[9]&255)<<8|(Ao[10]&255)<<16|(Ao[11]&255)<<24,Wl=Ao[12]&255|(Ao[13]&255)<<8|(Ao[14]&255)<<16|(Ao[15]&255)<<24,$l=po[4]&255|(po[5]&255)<<8|(po[6]&255)<<16|(po[7]&255)<<24,El=Co[0]&255|(Co[1]&255)<<8|(Co[2]&255)<<16|(Co[3]&255)<<24,Cu=Co[4]&255|(Co[5]&255)<<8|(Co[6]&255)<<16|(Co[7]&255)<<24,iu=Co[8]&255|(Co[9]&255)<<8|(Co[10]&255)<<16|(Co[11]&255)<<24,pu=Co[12]&255|(Co[13]&255)<<8|(Co[14]&255)<<16|(Co[15]&255)<<24,yu=po[8]&255|(po[9]&255)<<8|(po[10]&255)<<16|(po[11]&255)<<24,hu=Ao[16]&255|(Ao[17]&255)<<8|(Ao[18]&255)<<16|(Ao[19]&255)<<24,mu=Ao[20]&255|(Ao[21]&255)<<8|(Ao[22]&255)<<16|(Ao[23]&255)<<24,vu=Ao[24]&255|(Ao[25]&255)<<8|(Ao[26]&255)<<16|(Ao[27]&255)<<24,fu=Ao[28]&255|(Ao[29]&255)<<8|(Ao[30]&255)<<16|(Ao[31]&255)<<24,gu=po[12]&255|(po[13]&255)<<8|(po[14]&255)<<16|(po[15]&255)<<24,ou=Ro,su=Xo,tu=jo,zl=Ko,Gl=Wl,Jl=$l,Pl=El,Ul=Cu,Yl=iu,Vl=pu,Ql=yu,au=hu,Nu=mu,Wu=vu,zu=fu,Bu=gu,Qo,Zu=0;Zu<20;Zu+=2)Qo=ou+Nu|0,Gl^=Qo<<7|Qo>>>25,Qo=Gl+ou|0,Yl^=Qo<<9|Qo>>>23,Qo=Yl+Gl|0,Nu^=Qo<<13|Qo>>>19,Qo=Nu+Yl|0,ou^=Qo<<18|Qo>>>14,Qo=Jl+su|0,Vl^=Qo<<7|Qo>>>25,Qo=Vl+Jl|0,Wu^=Qo<<9|Qo>>>23,Qo=Wu+Vl|0,su^=Qo<<13|Qo>>>19,Qo=su+Wu|0,Jl^=Qo<<18|Qo>>>14,Qo=Ql+Pl|0,zu^=Qo<<7|Qo>>>25,Qo=zu+Ql|0,tu^=Qo<<9|Qo>>>23,Qo=tu+zu|0,Pl^=Qo<<13|Qo>>>19,Qo=Pl+tu|0,Ql^=Qo<<18|Qo>>>14,Qo=Bu+au|0,zl^=Qo<<7|Qo>>>25,Qo=zl+Bu|0,Ul^=Qo<<9|Qo>>>23,Qo=Ul+zl|0,au^=Qo<<13|Qo>>>19,Qo=au+Ul|0,Bu^=Qo<<18|Qo>>>14,Qo=ou+zl|0,su^=Qo<<7|Qo>>>25,Qo=su+ou|0,tu^=Qo<<9|Qo>>>23,Qo=tu+su|0,zl^=Qo<<13|Qo>>>19,Qo=zl+tu|0,ou^=Qo<<18|Qo>>>14,Qo=Jl+Gl|0,Pl^=Qo<<7|Qo>>>25,Qo=Pl+Jl|0,Ul^=Qo<<9|Qo>>>23,Qo=Ul+Pl|0,Gl^=Qo<<13|Qo>>>19,Qo=Gl+Ul|0,Jl^=Qo<<18|Qo>>>14,Qo=Ql+Vl|0,au^=Qo<<7|Qo>>>25,Qo=au+Ql|0,Yl^=Qo<<9|Qo>>>23,Qo=Yl+au|0,Vl^=Qo<<13|Qo>>>19,Qo=Vl+Yl|0,Ql^=Qo<<18|Qo>>>14,Qo=Bu+zu|0,Nu^=Qo<<7|Qo>>>25,Qo=Nu+Bu|0,Wu^=Qo<<9|Qo>>>23,Qo=Wu+Nu|0,zu^=Qo<<13|Qo>>>19,Qo=zu+Wu|0,Bu^=Qo<<18|Qo>>>14;So[0]=ou>>>0&255,So[1]=ou>>>8&255,So[2]=ou>>>16&255,So[3]=ou>>>24&255,So[4]=Jl>>>0&255,So[5]=Jl>>>8&255,So[6]=Jl>>>16&255,So[7]=Jl>>>24&255,So[8]=Ql>>>0&255,So[9]=Ql>>>8&255,So[10]=Ql>>>16&255,So[11]=Ql>>>24&255,So[12]=Bu>>>0&255,So[13]=Bu>>>8&255,So[14]=Bu>>>16&255,So[15]=Bu>>>24&255,So[16]=Pl>>>0&255,So[17]=Pl>>>8&255,So[18]=Pl>>>16&255,So[19]=Pl>>>24&255,So[20]=Ul>>>0&255,So[21]=Ul>>>8&255,So[22]=Ul>>>16&255,So[23]=Ul>>>24&255,So[24]=Yl>>>0&255,So[25]=Yl>>>8&255,So[26]=Yl>>>16&255,So[27]=Yl>>>24&255,So[28]=Vl>>>0&255,So[29]=Vl>>>8&255,So[30]=Vl>>>16&255,So[31]=Vl>>>24&255}function eo(So,Co,Ao,po){An(So,Co,Ao,po)}function ro(So,Co,Ao,po){jn(So,Co,Ao,po)}var to=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function _i(So,Co,Ao,po,Ro,Xo,jo){var Ko=new Uint8Array(16),Wl=new Uint8Array(64),$l,El;for(El=0;El<16;El++)Ko[El]=0;for(El=0;El<8;El++)Ko[El]=Xo[El];for(;Ro>=64;){for(eo(Wl,Ko,jo,to),El=0;El<64;El++)So[Co+El]=Ao[po+El]^Wl[El];for($l=1,El=8;El<16;El++)$l=$l+(Ko[El]&255)|0,Ko[El]=$l&255,$l>>>=8;Ro-=64,Co+=64,po+=64}if(Ro>0)for(eo(Wl,Ko,jo,to),El=0;El=64;){for(eo(jo,Xo,Ro,to),Wl=0;Wl<64;Wl++)So[Co+Wl]=jo[Wl];for(Ko=1,Wl=8;Wl<16;Wl++)Ko=Ko+(Xo[Wl]&255)|0,Xo[Wl]=Ko&255,Ko>>>=8;Ao-=64,Co+=64}if(Ao>0)for(eo(jo,Xo,Ro,to),Wl=0;Wl>>13|Ao<<3)&8191,po=So[4]&255|(So[5]&255)<<8,this.r[2]=(Ao>>>10|po<<6)&7939,Ro=So[6]&255|(So[7]&255)<<8,this.r[3]=(po>>>7|Ro<<9)&8191,Xo=So[8]&255|(So[9]&255)<<8,this.r[4]=(Ro>>>4|Xo<<12)&255,this.r[5]=Xo>>>1&8190,jo=So[10]&255|(So[11]&255)<<8,this.r[6]=(Xo>>>14|jo<<2)&8191,Ko=So[12]&255|(So[13]&255)<<8,this.r[7]=(jo>>>11|Ko<<5)&8065,Wl=So[14]&255|(So[15]&255)<<8,this.r[8]=(Ko>>>8|Wl<<8)&8191,this.r[9]=Wl>>>5&127,this.pad[0]=So[16]&255|(So[17]&255)<<8,this.pad[1]=So[18]&255|(So[19]&255)<<8,this.pad[2]=So[20]&255|(So[21]&255)<<8,this.pad[3]=So[22]&255|(So[23]&255)<<8,this.pad[4]=So[24]&255|(So[25]&255)<<8,this.pad[5]=So[26]&255|(So[27]&255)<<8,this.pad[6]=So[28]&255|(So[29]&255)<<8,this.pad[7]=So[30]&255|(So[31]&255)<<8};so.prototype.blocks=function(So,Co,Ao){for(var po=this.fin?0:2048,Ro,Xo,jo,Ko,Wl,$l,El,Cu,iu,pu,yu,hu,mu,vu,fu,gu,ou,su,tu,zl=this.h[0],Gl=this.h[1],Jl=this.h[2],Pl=this.h[3],Ul=this.h[4],Yl=this.h[5],Vl=this.h[6],Ql=this.h[7],au=this.h[8],Nu=this.h[9],Wu=this.r[0],zu=this.r[1],Bu=this.r[2],Qo=this.r[3],Zu=this.r[4],Qu=this.r[5],_h=this.r[6],qu=this.r[7],Ju=this.r[8],_d=this.r[9];Ao>=16;)Ro=So[Co+0]&255|(So[Co+1]&255)<<8,zl+=Ro&8191,Xo=So[Co+2]&255|(So[Co+3]&255)<<8,Gl+=(Ro>>>13|Xo<<3)&8191,jo=So[Co+4]&255|(So[Co+5]&255)<<8,Jl+=(Xo>>>10|jo<<6)&8191,Ko=So[Co+6]&255|(So[Co+7]&255)<<8,Pl+=(jo>>>7|Ko<<9)&8191,Wl=So[Co+8]&255|(So[Co+9]&255)<<8,Ul+=(Ko>>>4|Wl<<12)&8191,Yl+=Wl>>>1&8191,$l=So[Co+10]&255|(So[Co+11]&255)<<8,Vl+=(Wl>>>14|$l<<2)&8191,El=So[Co+12]&255|(So[Co+13]&255)<<8,Ql+=($l>>>11|El<<5)&8191,Cu=So[Co+14]&255|(So[Co+15]&255)<<8,au+=(El>>>8|Cu<<8)&8191,Nu+=Cu>>>5|po,iu=0,pu=iu,pu+=zl*Wu,pu+=Gl*(5*_d),pu+=Jl*(5*Ju),pu+=Pl*(5*qu),pu+=Ul*(5*_h),iu=pu>>>13,pu&=8191,pu+=Yl*(5*Qu),pu+=Vl*(5*Zu),pu+=Ql*(5*Qo),pu+=au*(5*Bu),pu+=Nu*(5*zu),iu+=pu>>>13,pu&=8191,yu=iu,yu+=zl*zu,yu+=Gl*Wu,yu+=Jl*(5*_d),yu+=Pl*(5*Ju),yu+=Ul*(5*qu),iu=yu>>>13,yu&=8191,yu+=Yl*(5*_h),yu+=Vl*(5*Qu),yu+=Ql*(5*Zu),yu+=au*(5*Qo),yu+=Nu*(5*Bu),iu+=yu>>>13,yu&=8191,hu=iu,hu+=zl*Bu,hu+=Gl*zu,hu+=Jl*Wu,hu+=Pl*(5*_d),hu+=Ul*(5*Ju),iu=hu>>>13,hu&=8191,hu+=Yl*(5*qu),hu+=Vl*(5*_h),hu+=Ql*(5*Qu),hu+=au*(5*Zu),hu+=Nu*(5*Qo),iu+=hu>>>13,hu&=8191,mu=iu,mu+=zl*Qo,mu+=Gl*Bu,mu+=Jl*zu,mu+=Pl*Wu,mu+=Ul*(5*_d),iu=mu>>>13,mu&=8191,mu+=Yl*(5*Ju),mu+=Vl*(5*qu),mu+=Ql*(5*_h),mu+=au*(5*Qu),mu+=Nu*(5*Zu),iu+=mu>>>13,mu&=8191,vu=iu,vu+=zl*Zu,vu+=Gl*Qo,vu+=Jl*Bu,vu+=Pl*zu,vu+=Ul*Wu,iu=vu>>>13,vu&=8191,vu+=Yl*(5*_d),vu+=Vl*(5*Ju),vu+=Ql*(5*qu),vu+=au*(5*_h),vu+=Nu*(5*Qu),iu+=vu>>>13,vu&=8191,fu=iu,fu+=zl*Qu,fu+=Gl*Zu,fu+=Jl*Qo,fu+=Pl*Bu,fu+=Ul*zu,iu=fu>>>13,fu&=8191,fu+=Yl*Wu,fu+=Vl*(5*_d),fu+=Ql*(5*Ju),fu+=au*(5*qu),fu+=Nu*(5*_h),iu+=fu>>>13,fu&=8191,gu=iu,gu+=zl*_h,gu+=Gl*Qu,gu+=Jl*Zu,gu+=Pl*Qo,gu+=Ul*Bu,iu=gu>>>13,gu&=8191,gu+=Yl*zu,gu+=Vl*Wu,gu+=Ql*(5*_d),gu+=au*(5*Ju),gu+=Nu*(5*qu),iu+=gu>>>13,gu&=8191,ou=iu,ou+=zl*qu,ou+=Gl*_h,ou+=Jl*Qu,ou+=Pl*Zu,ou+=Ul*Qo,iu=ou>>>13,ou&=8191,ou+=Yl*Bu,ou+=Vl*zu,ou+=Ql*Wu,ou+=au*(5*_d),ou+=Nu*(5*Ju),iu+=ou>>>13,ou&=8191,su=iu,su+=zl*Ju,su+=Gl*qu,su+=Jl*_h,su+=Pl*Qu,su+=Ul*Zu,iu=su>>>13,su&=8191,su+=Yl*Qo,su+=Vl*Bu,su+=Ql*zu,su+=au*Wu,su+=Nu*(5*_d),iu+=su>>>13,su&=8191,tu=iu,tu+=zl*_d,tu+=Gl*Ju,tu+=Jl*qu,tu+=Pl*_h,tu+=Ul*Qu,iu=tu>>>13,tu&=8191,tu+=Yl*Zu,tu+=Vl*Qo,tu+=Ql*Bu,tu+=au*zu,tu+=Nu*Wu,iu+=tu>>>13,tu&=8191,iu=(iu<<2)+iu|0,iu=iu+pu|0,pu=iu&8191,iu=iu>>>13,yu+=iu,zl=pu,Gl=yu,Jl=hu,Pl=mu,Ul=vu,Yl=fu,Vl=gu,Ql=ou,au=su,Nu=tu,Co+=16,Ao-=16;this.h[0]=zl,this.h[1]=Gl,this.h[2]=Jl,this.h[3]=Pl,this.h[4]=Ul,this.h[5]=Yl,this.h[6]=Vl,this.h[7]=Ql,this.h[8]=au,this.h[9]=Nu},so.prototype.finish=function(So,Co){var Ao=new Uint16Array(10),po,Ro,Xo,jo;if(this.leftover){for(jo=this.leftover,this.buffer[jo++]=1;jo<16;jo++)this.buffer[jo]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(po=this.h[1]>>>13,this.h[1]&=8191,jo=2;jo<10;jo++)this.h[jo]+=po,po=this.h[jo]>>>13,this.h[jo]&=8191;for(this.h[0]+=po*5,po=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=po,po=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=po,Ao[0]=this.h[0]+5,po=Ao[0]>>>13,Ao[0]&=8191,jo=1;jo<10;jo++)Ao[jo]=this.h[jo]+po,po=Ao[jo]>>>13,Ao[jo]&=8191;for(Ao[9]-=8192,Ro=(po^1)-1,jo=0;jo<10;jo++)Ao[jo]&=Ro;for(Ro=~Ro,jo=0;jo<10;jo++)this.h[jo]=this.h[jo]&Ro|Ao[jo];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,Xo=this.h[0]+this.pad[0],this.h[0]=Xo&65535,jo=1;jo<8;jo++)Xo=(this.h[jo]+this.pad[jo]|0)+(Xo>>>16)|0,this.h[jo]=Xo&65535;So[Co+0]=this.h[0]>>>0&255,So[Co+1]=this.h[0]>>>8&255,So[Co+2]=this.h[1]>>>0&255,So[Co+3]=this.h[1]>>>8&255,So[Co+4]=this.h[2]>>>0&255,So[Co+5]=this.h[2]>>>8&255,So[Co+6]=this.h[3]>>>0&255,So[Co+7]=this.h[3]>>>8&255,So[Co+8]=this.h[4]>>>0&255,So[Co+9]=this.h[4]>>>8&255,So[Co+10]=this.h[5]>>>0&255,So[Co+11]=this.h[5]>>>8&255,So[Co+12]=this.h[6]>>>0&255,So[Co+13]=this.h[6]>>>8&255,So[Co+14]=this.h[7]>>>0&255,So[Co+15]=this.h[7]>>>8&255},so.prototype.update=function(So,Co,Ao){var po,Ro;if(this.leftover){for(Ro=16-this.leftover,Ro>Ao&&(Ro=Ao),po=0;po=16&&(Ro=Ao-Ao%16,this.blocks(So,Co,Ro),Co+=Ro,Ao-=Ro),Ao){for(po=0;po>16&1),Xo[Ao-1]&=65535;Xo[15]=jo[15]-32767-(Xo[14]>>16&1),Ro=Xo[15]>>16&1,Xo[14]&=65535,Pn(jo,Xo,1-Ro)}for(Ao=0;Ao<16;Ao++)So[2*Ao]=jo[Ao]&255,So[2*Ao+1]=jo[Ao]>>8}function Zn(So,Co){var Ao=new Uint8Array(32),po=new Uint8Array(32);return On(Ao,So),On(po,Co),In(Ao,0,po,0)}function Nn(So){var Co=new Uint8Array(32);return On(Co,So),Co[0]&1}function wn(So,Co){var Ao;for(Ao=0;Ao<16;Ao++)So[Ao]=Co[2*Ao]+(Co[2*Ao+1]<<8);So[15]&=32767}function zn(So,Co,Ao){for(var po=0;po<16;po++)So[po]=Co[po]+Ao[po]}function fo(So,Co,Ao){for(var po=0;po<16;po++)So[po]=Co[po]-Ao[po]}function vo(So,Co,Ao){var po,Ro,Xo=0,jo=0,Ko=0,Wl=0,$l=0,El=0,Cu=0,iu=0,pu=0,yu=0,hu=0,mu=0,vu=0,fu=0,gu=0,ou=0,su=0,tu=0,zl=0,Gl=0,Jl=0,Pl=0,Ul=0,Yl=0,Vl=0,Ql=0,au=0,Nu=0,Wu=0,zu=0,Bu=0,Qo=Ao[0],Zu=Ao[1],Qu=Ao[2],_h=Ao[3],qu=Ao[4],Ju=Ao[5],_d=Ao[6],dp=Ao[7],Ku=Ao[8],Vu=Ao[9],cp=Ao[10],fp=Ao[11],lp=Ao[12],np=Ao[13],Rp=Ao[14],wp=Ao[15];po=Co[0],Xo+=po*Qo,jo+=po*Zu,Ko+=po*Qu,Wl+=po*_h,$l+=po*qu,El+=po*Ju,Cu+=po*_d,iu+=po*dp,pu+=po*Ku,yu+=po*Vu,hu+=po*cp,mu+=po*fp,vu+=po*lp,fu+=po*np,gu+=po*Rp,ou+=po*wp,po=Co[1],jo+=po*Qo,Ko+=po*Zu,Wl+=po*Qu,$l+=po*_h,El+=po*qu,Cu+=po*Ju,iu+=po*_d,pu+=po*dp,yu+=po*Ku,hu+=po*Vu,mu+=po*cp,vu+=po*fp,fu+=po*lp,gu+=po*np,ou+=po*Rp,su+=po*wp,po=Co[2],Ko+=po*Qo,Wl+=po*Zu,$l+=po*Qu,El+=po*_h,Cu+=po*qu,iu+=po*Ju,pu+=po*_d,yu+=po*dp,hu+=po*Ku,mu+=po*Vu,vu+=po*cp,fu+=po*fp,gu+=po*lp,ou+=po*np,su+=po*Rp,tu+=po*wp,po=Co[3],Wl+=po*Qo,$l+=po*Zu,El+=po*Qu,Cu+=po*_h,iu+=po*qu,pu+=po*Ju,yu+=po*_d,hu+=po*dp,mu+=po*Ku,vu+=po*Vu,fu+=po*cp,gu+=po*fp,ou+=po*lp,su+=po*np,tu+=po*Rp,zl+=po*wp,po=Co[4],$l+=po*Qo,El+=po*Zu,Cu+=po*Qu,iu+=po*_h,pu+=po*qu,yu+=po*Ju,hu+=po*_d,mu+=po*dp,vu+=po*Ku,fu+=po*Vu,gu+=po*cp,ou+=po*fp,su+=po*lp,tu+=po*np,zl+=po*Rp,Gl+=po*wp,po=Co[5],El+=po*Qo,Cu+=po*Zu,iu+=po*Qu,pu+=po*_h,yu+=po*qu,hu+=po*Ju,mu+=po*_d,vu+=po*dp,fu+=po*Ku,gu+=po*Vu,ou+=po*cp,su+=po*fp,tu+=po*lp,zl+=po*np,Gl+=po*Rp,Jl+=po*wp,po=Co[6],Cu+=po*Qo,iu+=po*Zu,pu+=po*Qu,yu+=po*_h,hu+=po*qu,mu+=po*Ju,vu+=po*_d,fu+=po*dp,gu+=po*Ku,ou+=po*Vu,su+=po*cp,tu+=po*fp,zl+=po*lp,Gl+=po*np,Jl+=po*Rp,Pl+=po*wp,po=Co[7],iu+=po*Qo,pu+=po*Zu,yu+=po*Qu,hu+=po*_h,mu+=po*qu,vu+=po*Ju,fu+=po*_d,gu+=po*dp,ou+=po*Ku,su+=po*Vu,tu+=po*cp,zl+=po*fp,Gl+=po*lp,Jl+=po*np,Pl+=po*Rp,Ul+=po*wp,po=Co[8],pu+=po*Qo,yu+=po*Zu,hu+=po*Qu,mu+=po*_h,vu+=po*qu,fu+=po*Ju,gu+=po*_d,ou+=po*dp,su+=po*Ku,tu+=po*Vu,zl+=po*cp,Gl+=po*fp,Jl+=po*lp,Pl+=po*np,Ul+=po*Rp,Yl+=po*wp,po=Co[9],yu+=po*Qo,hu+=po*Zu,mu+=po*Qu,vu+=po*_h,fu+=po*qu,gu+=po*Ju,ou+=po*_d,su+=po*dp,tu+=po*Ku,zl+=po*Vu,Gl+=po*cp,Jl+=po*fp,Pl+=po*lp,Ul+=po*np,Yl+=po*Rp,Vl+=po*wp,po=Co[10],hu+=po*Qo,mu+=po*Zu,vu+=po*Qu,fu+=po*_h,gu+=po*qu,ou+=po*Ju,su+=po*_d,tu+=po*dp,zl+=po*Ku,Gl+=po*Vu,Jl+=po*cp,Pl+=po*fp,Ul+=po*lp,Yl+=po*np,Vl+=po*Rp,Ql+=po*wp,po=Co[11],mu+=po*Qo,vu+=po*Zu,fu+=po*Qu,gu+=po*_h,ou+=po*qu,su+=po*Ju,tu+=po*_d,zl+=po*dp,Gl+=po*Ku,Jl+=po*Vu,Pl+=po*cp,Ul+=po*fp,Yl+=po*lp,Vl+=po*np,Ql+=po*Rp,au+=po*wp,po=Co[12],vu+=po*Qo,fu+=po*Zu,gu+=po*Qu,ou+=po*_h,su+=po*qu,tu+=po*Ju,zl+=po*_d,Gl+=po*dp,Jl+=po*Ku,Pl+=po*Vu,Ul+=po*cp,Yl+=po*fp,Vl+=po*lp,Ql+=po*np,au+=po*Rp,Nu+=po*wp,po=Co[13],fu+=po*Qo,gu+=po*Zu,ou+=po*Qu,su+=po*_h,tu+=po*qu,zl+=po*Ju,Gl+=po*_d,Jl+=po*dp,Pl+=po*Ku,Ul+=po*Vu,Yl+=po*cp,Vl+=po*fp,Ql+=po*lp,au+=po*np,Nu+=po*Rp,Wu+=po*wp,po=Co[14],gu+=po*Qo,ou+=po*Zu,su+=po*Qu,tu+=po*_h,zl+=po*qu,Gl+=po*Ju,Jl+=po*_d,Pl+=po*dp,Ul+=po*Ku,Yl+=po*Vu,Vl+=po*cp,Ql+=po*fp,au+=po*lp,Nu+=po*np,Wu+=po*Rp,zu+=po*wp,po=Co[15],ou+=po*Qo,su+=po*Zu,tu+=po*Qu,zl+=po*_h,Gl+=po*qu,Jl+=po*Ju,Pl+=po*_d,Ul+=po*dp,Yl+=po*Ku,Vl+=po*Vu,Ql+=po*cp,au+=po*fp,Nu+=po*lp,Wu+=po*np,zu+=po*Rp,Bu+=po*wp,Xo+=38*su,jo+=38*tu,Ko+=38*zl,Wl+=38*Gl,$l+=38*Jl,El+=38*Pl,Cu+=38*Ul,iu+=38*Yl,pu+=38*Vl,yu+=38*Ql,hu+=38*au,mu+=38*Nu,vu+=38*Wu,fu+=38*zu,gu+=38*Bu,Ro=1,po=Xo+Ro+65535,Ro=Math.floor(po/65536),Xo=po-Ro*65536,po=jo+Ro+65535,Ro=Math.floor(po/65536),jo=po-Ro*65536,po=Ko+Ro+65535,Ro=Math.floor(po/65536),Ko=po-Ro*65536,po=Wl+Ro+65535,Ro=Math.floor(po/65536),Wl=po-Ro*65536,po=$l+Ro+65535,Ro=Math.floor(po/65536),$l=po-Ro*65536,po=El+Ro+65535,Ro=Math.floor(po/65536),El=po-Ro*65536,po=Cu+Ro+65535,Ro=Math.floor(po/65536),Cu=po-Ro*65536,po=iu+Ro+65535,Ro=Math.floor(po/65536),iu=po-Ro*65536,po=pu+Ro+65535,Ro=Math.floor(po/65536),pu=po-Ro*65536,po=yu+Ro+65535,Ro=Math.floor(po/65536),yu=po-Ro*65536,po=hu+Ro+65535,Ro=Math.floor(po/65536),hu=po-Ro*65536,po=mu+Ro+65535,Ro=Math.floor(po/65536),mu=po-Ro*65536,po=vu+Ro+65535,Ro=Math.floor(po/65536),vu=po-Ro*65536,po=fu+Ro+65535,Ro=Math.floor(po/65536),fu=po-Ro*65536,po=gu+Ro+65535,Ro=Math.floor(po/65536),gu=po-Ro*65536,po=ou+Ro+65535,Ro=Math.floor(po/65536),ou=po-Ro*65536,Xo+=Ro-1+37*(Ro-1),Ro=1,po=Xo+Ro+65535,Ro=Math.floor(po/65536),Xo=po-Ro*65536,po=jo+Ro+65535,Ro=Math.floor(po/65536),jo=po-Ro*65536,po=Ko+Ro+65535,Ro=Math.floor(po/65536),Ko=po-Ro*65536,po=Wl+Ro+65535,Ro=Math.floor(po/65536),Wl=po-Ro*65536,po=$l+Ro+65535,Ro=Math.floor(po/65536),$l=po-Ro*65536,po=El+Ro+65535,Ro=Math.floor(po/65536),El=po-Ro*65536,po=Cu+Ro+65535,Ro=Math.floor(po/65536),Cu=po-Ro*65536,po=iu+Ro+65535,Ro=Math.floor(po/65536),iu=po-Ro*65536,po=pu+Ro+65535,Ro=Math.floor(po/65536),pu=po-Ro*65536,po=yu+Ro+65535,Ro=Math.floor(po/65536),yu=po-Ro*65536,po=hu+Ro+65535,Ro=Math.floor(po/65536),hu=po-Ro*65536,po=mu+Ro+65535,Ro=Math.floor(po/65536),mu=po-Ro*65536,po=vu+Ro+65535,Ro=Math.floor(po/65536),vu=po-Ro*65536,po=fu+Ro+65535,Ro=Math.floor(po/65536),fu=po-Ro*65536,po=gu+Ro+65535,Ro=Math.floor(po/65536),gu=po-Ro*65536,po=ou+Ro+65535,Ro=Math.floor(po/65536),ou=po-Ro*65536,Xo+=Ro-1+37*(Ro-1),So[0]=Xo,So[1]=jo,So[2]=Ko,So[3]=Wl,So[4]=$l,So[5]=El,So[6]=Cu,So[7]=iu,So[8]=pu,So[9]=yu,So[10]=hu,So[11]=mu,So[12]=vu,So[13]=fu,So[14]=gu,So[15]=ou}function go(So,Co){vo(So,Co,Co)}function uo(So,Co){var Ao=wr(),po;for(po=0;po<16;po++)Ao[po]=Co[po];for(po=253;po>=0;po--)go(Ao,Ao),po!==2&&po!==4&&vo(Ao,Ao,Co);for(po=0;po<16;po++)So[po]=Ao[po]}function lo(So,Co){var Ao=wr(),po;for(po=0;po<16;po++)Ao[po]=Co[po];for(po=250;po>=0;po--)go(Ao,Ao),po!==1&&vo(Ao,Ao,Co);for(po=0;po<16;po++)So[po]=Ao[po]}function Eo(So,Co,Ao){var po=new Uint8Array(32),Ro=new Float64Array(80),Xo,jo,Ko=wr(),Wl=wr(),$l=wr(),El=wr(),Cu=wr(),iu=wr();for(jo=0;jo<31;jo++)po[jo]=Co[jo];for(po[31]=Co[31]&127|64,po[0]&=248,wn(Ro,Ao),jo=0;jo<16;jo++)Wl[jo]=Ro[jo],El[jo]=Ko[jo]=$l[jo]=0;for(Ko[0]=El[0]=1,jo=254;jo>=0;--jo)Xo=po[jo>>>3]>>>(jo&7)&1,Pn(Ko,Wl,Xo),Pn($l,El,Xo),zn(Cu,Ko,$l),fo(Ko,Ko,$l),zn($l,Wl,El),fo(Wl,Wl,El),go(El,Cu),go(iu,Ko),vo(Ko,$l,Ko),vo($l,Wl,Cu),zn(Cu,Ko,$l),fo(Ko,Ko,$l),go(Wl,Ko),fo($l,El,iu),vo(Ko,$l,qr),zn(Ko,Ko,El),vo($l,$l,Ko),vo(Ko,El,iu),vo(El,Wl,Ro),go(Wl,Cu),Pn(Ko,Wl,Xo),Pn($l,El,Xo);for(jo=0;jo<16;jo++)Ro[jo+16]=Ko[jo],Ro[jo+32]=$l[jo],Ro[jo+48]=Wl[jo],Ro[jo+64]=El[jo];var pu=Ro.subarray(32),yu=Ro.subarray(16);return uo(pu,pu),vo(yu,yu,pu),On(So,yu),0}function mo(So,Co){return Eo(So,Co,jr)}function yo(So,Co){return Er(Co,32),mo(So,Co)}function _o(So,Co,Ao){var po=new Uint8Array(32);return Eo(po,Ao,Co),ro(So,kr,po,to)}var Bo=Hr,Lo=Xr;function Wo(So,Co,Ao,po,Ro,Xo){var jo=new Uint8Array(32);return _o(jo,Ro,Xo),Bo(So,Co,Ao,po,jo)}function na(So,Co,Ao,po,Ro,Xo){var jo=new Uint8Array(32);return _o(jo,Ro,Xo),Lo(So,Co,Ao,po,jo)}var qo=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function ga(So,Co,Ao,po){for(var Ro=new Int32Array(16),Xo=new Int32Array(16),jo,Ko,Wl,$l,El,Cu,iu,pu,yu,hu,mu,vu,fu,gu,ou,su,tu,zl,Gl,Jl,Pl,Ul,Yl,Vl,Ql,au,Nu=So[0],Wu=So[1],zu=So[2],Bu=So[3],Qo=So[4],Zu=So[5],Qu=So[6],_h=So[7],qu=Co[0],Ju=Co[1],_d=Co[2],dp=Co[3],Ku=Co[4],Vu=Co[5],cp=Co[6],fp=Co[7],lp=0;po>=128;){for(Gl=0;Gl<16;Gl++)Jl=8*Gl+lp,Ro[Gl]=Ao[Jl+0]<<24|Ao[Jl+1]<<16|Ao[Jl+2]<<8|Ao[Jl+3],Xo[Gl]=Ao[Jl+4]<<24|Ao[Jl+5]<<16|Ao[Jl+6]<<8|Ao[Jl+7];for(Gl=0;Gl<80;Gl++)if(jo=Nu,Ko=Wu,Wl=zu,$l=Bu,El=Qo,Cu=Zu,iu=Qu,pu=_h,yu=qu,hu=Ju,mu=_d,vu=dp,fu=Ku,gu=Vu,ou=cp,su=fp,Pl=_h,Ul=fp,Yl=Ul&65535,Vl=Ul>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=(Qo>>>14|Ku<<18)^(Qo>>>18|Ku<<14)^(Ku>>>9|Qo<<23),Ul=(Ku>>>14|Qo<<18)^(Ku>>>18|Qo<<14)^(Qo>>>9|Ku<<23),Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,Pl=Qo&Zu^~Qo&Qu,Ul=Ku&Vu^~Ku&cp,Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,Pl=qo[Gl*2],Ul=qo[Gl*2+1],Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,Pl=Ro[Gl%16],Ul=Xo[Gl%16],Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,tu=Ql&65535|au<<16,zl=Yl&65535|Vl<<16,Pl=tu,Ul=zl,Yl=Ul&65535,Vl=Ul>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=(Nu>>>28|qu<<4)^(qu>>>2|Nu<<30)^(qu>>>7|Nu<<25),Ul=(qu>>>28|Nu<<4)^(Nu>>>2|qu<<30)^(Nu>>>7|qu<<25),Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,Pl=Nu&Wu^Nu&zu^Wu&zu,Ul=qu&Ju^qu&_d^Ju&_d,Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,pu=Ql&65535|au<<16,su=Yl&65535|Vl<<16,Pl=$l,Ul=vu,Yl=Ul&65535,Vl=Ul>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=tu,Ul=zl,Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,$l=Ql&65535|au<<16,vu=Yl&65535|Vl<<16,Wu=jo,zu=Ko,Bu=Wl,Qo=$l,Zu=El,Qu=Cu,_h=iu,Nu=pu,Ju=yu,_d=hu,dp=mu,Ku=vu,Vu=fu,cp=gu,fp=ou,qu=su,Gl%16===15)for(Jl=0;Jl<16;Jl++)Pl=Ro[Jl],Ul=Xo[Jl],Yl=Ul&65535,Vl=Ul>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=Ro[(Jl+9)%16],Ul=Xo[(Jl+9)%16],Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,tu=Ro[(Jl+1)%16],zl=Xo[(Jl+1)%16],Pl=(tu>>>1|zl<<31)^(tu>>>8|zl<<24)^tu>>>7,Ul=(zl>>>1|tu<<31)^(zl>>>8|tu<<24)^(zl>>>7|tu<<25),Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,tu=Ro[(Jl+14)%16],zl=Xo[(Jl+14)%16],Pl=(tu>>>19|zl<<13)^(zl>>>29|tu<<3)^tu>>>6,Ul=(zl>>>19|tu<<13)^(tu>>>29|zl<<3)^(zl>>>6|tu<<26),Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,Ro[Jl]=Ql&65535|au<<16,Xo[Jl]=Yl&65535|Vl<<16;Pl=Nu,Ul=qu,Yl=Ul&65535,Vl=Ul>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=So[0],Ul=Co[0],Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,So[0]=Nu=Ql&65535|au<<16,Co[0]=qu=Yl&65535|Vl<<16,Pl=Wu,Ul=Ju,Yl=Ul&65535,Vl=Ul>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=So[1],Ul=Co[1],Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,So[1]=Wu=Ql&65535|au<<16,Co[1]=Ju=Yl&65535|Vl<<16,Pl=zu,Ul=_d,Yl=Ul&65535,Vl=Ul>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=So[2],Ul=Co[2],Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,So[2]=zu=Ql&65535|au<<16,Co[2]=_d=Yl&65535|Vl<<16,Pl=Bu,Ul=dp,Yl=Ul&65535,Vl=Ul>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=So[3],Ul=Co[3],Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,So[3]=Bu=Ql&65535|au<<16,Co[3]=dp=Yl&65535|Vl<<16,Pl=Qo,Ul=Ku,Yl=Ul&65535,Vl=Ul>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=So[4],Ul=Co[4],Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,So[4]=Qo=Ql&65535|au<<16,Co[4]=Ku=Yl&65535|Vl<<16,Pl=Zu,Ul=Vu,Yl=Ul&65535,Vl=Ul>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=So[5],Ul=Co[5],Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,So[5]=Zu=Ql&65535|au<<16,Co[5]=Vu=Yl&65535|Vl<<16,Pl=Qu,Ul=cp,Yl=Ul&65535,Vl=Ul>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=So[6],Ul=Co[6],Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,So[6]=Qu=Ql&65535|au<<16,Co[6]=cp=Yl&65535|Vl<<16,Pl=_h,Ul=fp,Yl=Ul&65535,Vl=Ul>>>16,Ql=Pl&65535,au=Pl>>>16,Pl=So[7],Ul=Co[7],Yl+=Ul&65535,Vl+=Ul>>>16,Ql+=Pl&65535,au+=Pl>>>16,Vl+=Yl>>>16,Ql+=Vl>>>16,au+=Ql>>>16,So[7]=_h=Ql&65535|au<<16,Co[7]=fp=Yl&65535|Vl<<16,lp+=128,po-=128}return po}function wl(So,Co,Ao){var po=new Int32Array(8),Ro=new Int32Array(8),Xo=new Uint8Array(256),jo,Ko=Ao;for(po[0]=1779033703,po[1]=3144134277,po[2]=1013904242,po[3]=2773480762,po[4]=1359893119,po[5]=2600822924,po[6]=528734635,po[7]=1541459225,Ro[0]=4089235720,Ro[1]=2227873595,Ro[2]=4271175723,Ro[3]=1595750129,Ro[4]=2917565137,Ro[5]=725511199,Ro[6]=4215389547,Ro[7]=327033209,ga(po,Ro,Co,Ao),Ao%=128,jo=0;jo=0;--Ro)po=Ao[Ro/8|0]>>(Ro&7)&1,Uo(So,Co,po),No(Co,So),No(So,So),Uo(So,Co,po)}function Fo(So,Co){var Ao=[wr(),wr(),wr(),wr()];Sn(Ao[0],Zr),Sn(Ao[1],Jr),Sn(Ao[2],Wr),vo(Ao[3],Zr,Jr),Vo(So,Ao,Co)}function Ol(So,Co,Ao){var po=new Uint8Array(64),Ro=[wr(),wr(),wr(),wr()],Xo;for(Ao||Er(Co,32),wl(po,Co,32),po[0]&=248,po[31]&=127,po[31]|=64,Fo(Ro,po),Nl(So,Ro),Xo=0;Xo<32;Xo++)Co[Xo+32]=So[Xo];return 0}var $a=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Jo(So,Co){var Ao,po,Ro,Xo;for(po=63;po>=32;--po){for(Ao=0,Ro=po-32,Xo=po-12;Ro>4)*$a[Ro],Ao=Co[Ro]>>8,Co[Ro]&=255;for(Ro=0;Ro<32;Ro++)Co[Ro]-=Ao*$a[Ro];for(po=0;po<32;po++)Co[po+1]+=Co[po]>>8,So[po]=Co[po]&255}function Zl(So){var Co=new Float64Array(64),Ao;for(Ao=0;Ao<64;Ao++)Co[Ao]=So[Ao];for(Ao=0;Ao<64;Ao++)So[Ao]=0;Jo(So,Co)}function Cl(So,Co,Ao,po){var Ro=new Uint8Array(64),Xo=new Uint8Array(64),jo=new Uint8Array(64),Ko,Wl,$l=new Float64Array(64),El=[wr(),wr(),wr(),wr()];wl(Ro,po,32),Ro[0]&=248,Ro[31]&=127,Ro[31]|=64;var Cu=Ao+64;for(Ko=0;Ko>7&&fo(So[0],Br,So[0]),vo(So[3],So[0],So[1]),0)}function wo(So,Co,Ao,po){var Ro,Xo=new Uint8Array(32),jo=new Uint8Array(64),Ko=[wr(),wr(),wr(),wr()],Wl=[wr(),wr(),wr(),wr()];if(Ao<64||ko(Wl,po))return-1;for(Ro=0;Ro=0},br.sign.keyPair=function(){var So=new Uint8Array(Il),Co=new Uint8Array(Eu);return Ol(So,Co),{publicKey:So,secretKey:Co}},br.sign.keyPair.fromSecretKey=function(So){if(Sl(So),So.length!==Eu)throw new Error("bad secret key size");for(var Co=new Uint8Array(Il),Ao=0;Ao`https://phantom.app/ul/v1/${fr}?${br.toString()}`,decryptPayload=(fr,br,wr)=>{const Er=nacl.box.open.after(bs58$8.decode(fr),bs58$8.decode(br),wr);if(!Er)throw new Error("Unable to decrypt data");return JSON.parse(Buffer$2.from(Er).toString("utf8"))},encryptPayload=(fr,br)=>{const wr=nacl.randomBytes(24),Er=nacl.box.after(Buffer$2.from(JSON.stringify(fr)),wr,br);return[wr,Er]},GENESIS_HASHES={"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3zQawwpjk2NsNY":"testnet","5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d":"mainnet-beta",EtWTRABZaYq6iMfeYKouRu166VU2xqa1wcaWoxPkrZBG:"devnet"},fetchCluster=fr=>__awaiter$3(void 0,void 0,void 0,function*(){try{const{result:br}=yield(yield fetch(fr,{body:JSON.stringify({id:1,jsonrpc:"2.0",method:"getGenesisHash"}),headers:{"Content-Type":"application/json"},method:"POST"})).json();return GENESIS_HASHES[br]}catch{return"mainnet-beta"}}),storage={address:{get:()=>{var fr;return(fr=localStorage.getItem("dynamic_phantom_wallet_address"))!==null&&fr!==void 0?fr:void 0},remove:()=>{localStorage.removeItem("dynamic_phantom_wallet_address")},set:fr=>{localStorage.setItem("dynamic_phantom_wallet_address",fr.toString())}},encryptionPublicKey:{get:()=>{const fr=localStorage.getItem("dynamic_phantom_public_key");if(fr)return new Uint8Array(JSON.parse(fr))},remove:()=>{localStorage.removeItem("dynamic_phantom_public_key")},set:fr=>{localStorage.setItem("dynamic_phantom_public_key",JSON.stringify([...fr]))}},encryptionSecretKey:{get:()=>{const fr=localStorage.getItem("dynamic_phantom_secret_key");if(fr)return new Uint8Array(JSON.parse(fr))},remove:()=>{localStorage.removeItem("dynamic_phantom_secret_key")},set:fr=>{localStorage.setItem("dynamic_phantom_secret_key",JSON.stringify([...fr]))}},message:{get:()=>{var fr;return(fr=localStorage.getItem("dynamic_phantom_message_to_sign"))!==null&&fr!==void 0?fr:void 0},remove:()=>{localStorage.removeItem("dynamic_phantom_message_to_sign")},set:fr=>{localStorage.setItem("dynamic_phantom_message_to_sign",fr)}},method:{get:()=>{var fr;return(fr=localStorage.getItem("dynamic_phantom_method"))!==null&&fr!==void 0?fr:void 0},remove:()=>{localStorage.removeItem("dynamic_phantom_method")},set:fr=>{localStorage.setItem("dynamic_phantom_method",fr)}},session:{get:()=>{var fr;return(fr=localStorage.getItem("dynamic_phantom_session"))!==null&&fr!==void 0?fr:void 0},remove:()=>{localStorage.removeItem("dynamic_phantom_session")},set:fr=>{localStorage.setItem("dynamic_phantom_session",fr)}},sharedSecret:{get:()=>{const fr=localStorage.getItem("dynamic_phantom_shared_secret");if(fr)return new Uint8Array(JSON.parse(fr))},remove:()=>{localStorage.removeItem("dynamic_phantom_shared_secret")},set:fr=>{localStorage.setItem("dynamic_phantom_shared_secret",JSON.stringify([...fr]))}}},clearStorage=()=>{for(const fr in storage)storage[fr].remove()};class PhantomRedirect extends SolanaWalletConnector{constructor(br){super(Object.assign({},br)),this.name="Phantom",this.overrideKey="phantom"}getMethod(){throw new Error("Method not implemented.")}getAddress(){return __awaiter$3(this,void 0,void 0,function*(){const br=storage.address.get();if(br)return br;yield this.connect()})}connect(){return __awaiter$3(this,void 0,void 0,function*(){var br,wr;const Er=nacl.box.keyPair();storage.encryptionPublicKey.set(Er.publicKey),storage.encryptionSecretKey.set(Er.secretKey);const kr=window.location.href.includes("localhost")||window.location.href.includes("0.0.0.0")||window.location.href.includes("127.0.0.1"),jr=(wr=(br=this.solNetworks[0].privateCustomerRpcUrls)===null||br===void 0?void 0:br[0])!==null&&wr!==void 0?wr:this.solNetworks[0].rpcUrls[0],Br=new URLSearchParams({app_url:kr?"https://demo.dynamic.xyz":window.location.href,cluster:yield fetchCluster(jr),dapp_encryption_public_key:bs58$8.encode(Er.publicKey),redirect_link:window.location.href}),Wr=buildUrl("connect",Br);window.location.href=Wr})}getSession(){return __awaiter$3(this,void 0,void 0,function*(){const br=new URLSearchParams(window.location.search),{data:wr,nonce:Er,phantom_encryption_public_key:kr,encryptionSecretKey:jr}=this.getInputsOrThrow("getSession",["data","nonce","phantom_encryption_public_key"],["encryptionSecretKey"]),Br=nacl.box.before(bs58$8.decode(kr),jr);storage.sharedSecret.set(Br);const Wr=decryptPayload(wr,Er,Br);return storage.session.set(Wr.session),storage.address.set(new PublicKey$2(Wr.public_key)),br.delete("phantom_encryption_public_key"),br.delete("data"),br.delete("nonce"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${br.toString()}`),Wr.public_key})}signMessage(br){return __awaiter$3(this,void 0,void 0,function*(){const{session:wr,sharedSecret:Er,encryptionPublicKey:kr}=this.getInputsOrThrow("signMessage",[],["session","sharedSecret","encryptionPublicKey"]);storage.message.set(br);const jr={message:bs58$8.encode(Buffer$2.from(br)),session:wr},[Br,Wr]=encryptPayload(jr,Er),qr=new URLSearchParams({dapp_encryption_public_key:bs58$8.encode(kr),nonce:bs58$8.encode(Br),payload:bs58$8.encode(Wr),redirect_link:window.location.href}),Gr=buildUrl("signMessage",qr);throw storage.method.set("signMessage"),window.location.href=Gr,new Error("ignore")})}extractSignature(){const br=new URLSearchParams(window.location.search),{data:wr,nonce:Er,sharedSecret:kr,message:jr}=this.getInputsOrThrow("extractSignature",["data","nonce"],["sharedSecret","message"]),Br=decryptPayload(wr,Er,kr);return br.delete("data"),br.delete("nonce"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${br.toString()}`),{message:jr,signature:Br.signature}}extractTransactions(){const br=new URLSearchParams(window.location.search),{data:wr,nonce:Er,sharedSecret:kr}=this.getInputsOrThrow("extractTransactions",["data","nonce"],["sharedSecret"]),Br=decryptPayload(wr,Er,kr).transactions.map(Wr=>Transaction.from(bs58$8.decode(Wr)));return br.delete("data"),br.delete("nonce"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${br.toString()}`),Br}extractTransaction(){const br=new URLSearchParams(window.location.search),{data:wr,nonce:Er,sharedSecret:kr}=this.getInputsOrThrow("extractTransaction",["data","nonce"],["sharedSecret"]),jr=decryptPayload(wr,Er,kr),Br=Transaction.from(bs58$8.decode(jr.transaction));return br.delete("data"),br.delete("nonce"),history.replaceState(null,"",`${window.location.origin}${window.location.pathname}?${br.toString()}`),Br}consumeMethod(){const br=storage.method.get();return storage.method.remove(),br}getSigner(){return __awaiter$3(this,void 0,void 0,function*(){const br=storage.address.get();if(br)return{addListener:()=>{throw new Error("Not implemented")},connect:()=>{throw new Error("Not implemented")},disconnect:()=>{throw new Error("Not implemented")},emit:()=>{throw new Error("Not implemented")},eventNames:()=>{throw new Error("Not implemented")},isBackpack:!1,isBraveWallet:!1,isConnected:!0,isExodus:!1,isGlow:!1,isMagicEden:!1,isPhantom:!0,isSolflare:!1,listenerCount:()=>{throw new Error("Not implemented")},listeners:()=>{throw new Error("Not implemented")},off:()=>{throw new Error("Not implemented")},on:()=>{throw new Error("Not implemented")},once:()=>{throw new Error("Not implemented")},providers:[],publicKey:new PublicKey$2(br),removeAllListeners:()=>{throw new Error("Not implemented")},removeListener:()=>{throw new Error("Not implemented")},signAllTransactions:wr=>__awaiter$3(this,void 0,void 0,function*(){const Er=wr.map(Jr=>bs58$8.encode(Jr.serialize({requireAllSignatures:!1}))),{session:kr,sharedSecret:jr,encryptionPublicKey:Br}=this.getInputsOrThrow("signAllTransactions",[],["session","sharedSecret","encryptionPublicKey"]),Wr={session:kr,transactions:Er},[qr,Gr]=encryptPayload(Wr,jr),Vr=new URLSearchParams({dapp_encryption_public_key:bs58$8.encode(Br),nonce:bs58$8.encode(qr),payload:bs58$8.encode(Gr),redirect_link:window.location.href}),Zr=buildUrl("signAllTransactions",Vr);return window.location.href=Zr,[]}),signAndSendTransaction:(wr,Er)=>__awaiter$3(this,void 0,void 0,function*(){const{session:kr,sharedSecret:jr,encryptionPublicKey:Br}=this.getInputsOrThrow("signAndSendTransaction",[],["session","sharedSecret","encryptionPublicKey"]),Wr={options:Er,session:kr,transaction:bs58$8.encode(wr.serialize({requireAllSignatures:!1}))},[qr,Gr]=encryptPayload(Wr,jr),Vr=new URLSearchParams({dapp_encryption_public_key:bs58$8.encode(Br),nonce:bs58$8.encode(qr),payload:bs58$8.encode(Gr),redirect_link:window.location.href}),Zr=buildUrl("signAndSendTransaction",Vr);return storage.method.set("signAndSendTransaction"),window.location.href=Zr,{signature:""}}),signMessage:wr=>__awaiter$3(this,void 0,void 0,function*(){const{session:Er,sharedSecret:kr,encryptionPublicKey:jr}=this.getInputsOrThrow("signMessage",[],["session","sharedSecret","encryptionPublicKey"]),Br={message:bs58$8.encode(Buffer$2.from(wr)),session:Er},[Wr,qr]=encryptPayload(Br,kr),Gr=new URLSearchParams({dapp_encryption_public_key:bs58$8.encode(jr),nonce:bs58$8.encode(Wr),payload:bs58$8.encode(qr),redirect_link:window.location.href}),Vr=buildUrl("signMessage",Gr);return window.location.href=Vr,{signature:Buffer$2.from("")}}),signTransaction:wr=>__awaiter$3(this,void 0,void 0,function*(){const Er=bs58$8.encode(wr.serialize({requireAllSignatures:!1})),{session:kr,sharedSecret:jr,encryptionPublicKey:Br}=this.getInputsOrThrow("signTransaction",[],["session","sharedSecret","encryptionPublicKey"]),Wr={session:kr,transaction:Er},[qr,Gr]=encryptPayload(Wr,jr),Vr=new URLSearchParams({dapp_encryption_public_key:bs58$8.encode(Br),nonce:bs58$8.encode(qr),payload:bs58$8.encode(Gr),redirect_link:window.location.href}),Zr=buildUrl("signTransaction",Vr);return window.location.href=Zr,wr})}})}getConnectedAccounts(){return __awaiter$3(this,void 0,void 0,function*(){const br=storage.address.get();return br?[br]:[]})}endSession(){return __awaiter$3(this,void 0,void 0,function*(){const br=storage.address.get(),wr=storage.session.get(),Er=storage.sharedSecret.get(),kr=storage.encryptionPublicKey.get();if(clearStorage(),!br||!wr||!kr||!Er)return;const jr={session:wr},[Br,Wr]=encryptPayload(jr,Er),qr=new URLSearchParams({dapp_encryption_public_key:bs58$8.encode(kr),nonce:bs58$8.encode(Br),payload:bs58$8.encode(Wr),redirect_link:window.location.href}),Gr=buildUrl("disconnect",qr);window.location.href=Gr})}getInputsOrThrow(br,wr,Er){const kr={},jr=new URLSearchParams(window.location.search);return wr.forEach(Br=>{const Wr=jr.get(Br);if(!Wr)throw new Error(`[PhantomRedirect] ${br} called, but required input '${Br}' not found in query params`);kr[Br]=Wr}),Er.forEach(Br=>{const Wr=storage[Br].get();if(!Wr)throw new Error(`[PhantomRedirect] ${br} called, but required input '${Br}' not found in local storage`);kr[Br]=Wr}),kr}}class PhantomInjected extends InjectedWalletBase{constructor(br){super(br),this.name="Phantom",this.overrideKey="phantom",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getAddress(){const br=Object.create(null,{getAddress:{get:()=>super.getAddress}});return __awaiter$3(this,void 0,void 0,function*(){if(this.isInstalledOnBrowser())return br.getAddress.call(this);isMobile()&&handleMobileWalletRedirect({nativeLink:"phantom://browse",universalLink:"https://phantom.app/ul/browse"})})}canGetChainAddress(){var br,wr;return((wr=(br=this.getSolProviderHelper())===null||br===void 0?void 0:br.findProvider())===null||wr===void 0?void 0:wr.publicKey)!==null}}class Phantom extends SolanaWalletConnector{constructor(br){super(br),this.name="Phantom",this.overrideKey="phantom",this.wallet=findWalletBookWallet(this.walletBook,this.key)}connect(){return __awaiter$3(this,void 0,void 0,function*(){yield this.getMobileOrInstalledWallet().connect()})}getSigner(){return __awaiter$3(this,void 0,void 0,function*(){return this.getMobileOrInstalledWallet().getSigner()})}getMobileOrInstalledWallet(){const br=new PhantomInjected(this.constructorProps);return!isMobile()||br.isInstalledOnBrowser()?br:this.mobileExperience==="redirect"?new PhantomRedirect(this.constructorProps):new PhantomInjected(this.constructorProps)}}class CoinbaseSolana extends InjectedWalletBase{constructor(br){super(br),this.name="CoinbaseSolana",this.overrideKey="coinbasesolana",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getSigner(){return __awaiter$3(this,void 0,void 0,function*(){var br;return(br=this.getSolProviderHelper())===null||br===void 0?void 0:br.connect()})}signMessage(br){return __awaiter$3(this,void 0,void 0,function*(){const wr=yield this.getAddress();if(!wr)return;const Er=yield this.getSigner();if(!Er)return;const kr=new TextEncoder().encode(br),jr=yield Er.signMessage(kr,wr);if(jr)return bufferToBase64(isSignedMessage(jr)?jr.signature:jr)})}}class Solflare extends InjectedWalletBase{constructor(br){super(br),this.name="Solflare",this.overrideKey="solflare",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getAddress(){return __awaiter$3(this,void 0,void 0,function*(){var br,wr,Er,kr,jr;if(isMobile()&&!this.isInstalledOnBrowser()){handleMobileWalletRedirect({nativeLink:((wr=(br=this.wallet)===null||br===void 0?void 0:br.mobile)===null||wr===void 0?void 0:wr.native)||"solflare://ul/v1/browse",universalLink:((kr=(Er=this.wallet)===null||Er===void 0?void 0:Er.mobile)===null||kr===void 0?void 0:kr.universal)||"https://solflare.com/ul/v1/browse"});return}return(jr=this.getSolProviderHelper())===null||jr===void 0?void 0:jr.getAddress()})}signMessage(br){return __awaiter$3(this,void 0,void 0,function*(){if(!(yield this.getAddress()))return;const Er=yield this.getSigner();if(!Er)return;const kr=new TextEncoder().encode(br),jr=Wr=>Wr.signature!==void 0;yield Er.connect(),yield new Promise(Wr=>{setTimeout(Wr,100)});const Br=yield Er.signMessage(kr,"utf8");return jr(Br)?bufferToBase64(Br.signature):void 0})}}const isVersionedTransaction=fr=>!("instructions"in fr),createSolanaSignerFromWalletStandard=(fr,br)=>{const wr=fr.features,Er=()=>__awaiter$3(void 0,void 0,void 0,function*(){const Gr=yield br.getAddress(),Vr=fr.accounts.find(Zr=>Zr.address===Gr);if(!Vr)throw new Error("Account not found");return Vr}),kr=()=>__awaiter$3(void 0,void 0,void 0,function*(){var Gr,Vr;const Zr=(Vr=(Gr=br.solNetworks[0].privateCustomerRpcUrls)===null||Gr===void 0?void 0:Gr[0])!==null&&Vr!==void 0?Vr:br.solNetworks[0].rpcUrls[0];return`solana:${yield fetchCluster(Zr)}`}),jr=Gr=>__awaiter$3(void 0,void 0,void 0,function*(){const Vr=yield Er(),Zr=yield wr["solana:signTransaction"].signTransaction({account:Vr,chain:yield kr(),transaction:Gr.serialize({requireAllSignatures:!1})});return isVersionedTransaction(Gr)?VersionedTransaction.deserialize(Zr[0].signedTransaction):Transaction.from(Zr[0].signedTransaction)});return{addListener:()=>{throw new Error("Not implemented")},connect:()=>{throw new Error("Not implemented")},disconnect:()=>br.endSession(),emit:()=>{throw new Error("Not implemented")},eventNames:()=>{throw new Error("Not implemented")},isBackpack:!1,isBraveWallet:!1,isConnected:!0,isExodus:!1,isGlow:!1,isMagicEden:!1,isPhantom:!1,isSolflare:!1,listenerCount:()=>{throw new Error("Not implemented")},listeners:()=>{throw new Error("Not implemented")},off:()=>{throw new Error("Not implemented")},on:()=>{throw new Error("Not implemented")},once:()=>{throw new Error("Not implemented")},providers:[],get publicKey(){return new PublicKey$2(fr.accounts[0].publicKey)},removeAllListeners:()=>{throw new Error("Not implemented")},removeListener:()=>{throw new Error("Not implemented")},send:()=>{throw new Error("Not implemented")},signAllTransactions:Gr=>__awaiter$3(void 0,void 0,void 0,function*(){return Promise.all(Gr.map(jr))}),signAndSendTransaction:Gr=>__awaiter$3(void 0,void 0,void 0,function*(){const Vr=yield Er(),Zr=yield wr["solana:signAndSendTransaction"].signAndSendTransaction({account:Vr,chain:yield kr(),transaction:Gr.serialize()}),[{signature:Jr}]=Zr;return{signature:new TextDecoder().decode(Jr)}}),signMessage:Gr=>__awaiter$3(void 0,void 0,void 0,function*(){const Vr=yield Er();return{signature:(yield wr["solana:signMessage"].signMessage({account:Vr,message:Gr}))[0].signature}}),signTransaction:jr}},encoder=new TextEncoder;class SolanaWalletStandardConnector extends SolanaWalletConnector{constructor(br){super(br),this.connectedChain="SOL",this.supportedChains=["SOL"]}get wallet(){const br=SolanaWalletStandardConnector.getWallet(this.walletBook,this.key);if(!br)throw new Error("Wallet not found");return br}get walletFeatures(){return this.wallet.features}connect(){return __awaiter$3(this,void 0,void 0,function*(){yield this.walletFeatures["standard:connect"].connect()})}endSession(){return __awaiter$3(this,void 0,void 0,function*(){yield this.walletFeatures["standard:disconnect"].disconnect()})}isInstalledOnBrowser(){return!0}getAddress(){return __awaiter$3(this,void 0,void 0,function*(){yield this.connect();const[br]=yield this.getConnectedAccounts();return br})}getConnectedAccounts(){return __awaiter$3(this,void 0,void 0,function*(){return this.wallet.accounts.map(wr=>wr.address)})}signMessage(br){return __awaiter$3(this,void 0,void 0,function*(){const wr=yield this.getSigner();if(!wr)throw new Error("Signer not found");const Er=encoder.encode(br),{signature:kr}=yield wr.signMessage(Er);if(!(kr instanceof Uint8Array))throw new Error("Signature not found");return Buffer$2.from(kr).toString("base64")})}getSigner(){return __awaiter$3(this,void 0,void 0,function*(){const{wallet:br}=this;return createSolanaSignerFromWalletStandard(br,this)})}static getWallet(br,wr){var Er,kr;const jr=getWallets().get(),Br=(Er=br.wallets[wr].injectedConfig)===null||Er===void 0?void 0:Er.find(Gr=>Gr.chain==="sol");if(!Br)return;const{features:Wr}=(kr=Br.walletStandard)!==null&&kr!==void 0?kr:{};return Wr?jr.find(Gr=>{var Vr;return Gr.name===((Vr=Br.walletStandard)===null||Vr===void 0?void 0:Vr.name)?Wr.reduce((Qr,_n)=>{const En=Object.keys(Gr.features);return Qr?En.includes(_n):!1},!0):!1}):void 0}}class BackpackSol extends InjectedWalletBase{constructor(br){super(br),this.name="Backpack",this.overrideKey="backpacksol",this.wallet=findWalletBookWallet(this.walletBook,this.key)}getSigner(){return __awaiter$3(this,void 0,void 0,function*(){var br;return(br=this.getSolProviderHelper())===null||br===void 0?void 0:br.connect()})}signMessage(br){return __awaiter$3(this,void 0,void 0,function*(){if(!(yield this.getAddress()))return;const Er=yield this.getSigner();if(!Er)return;const kr=yield Er.signMessage(Buffer$2.from(br,"utf8"));if(kr)return typeof kr=="object"&&"signature"in kr?bufferToBase64(kr.signature):bufferToBase64(kr)})}}const injectedWalletOverrides=[CoinbaseSolana,BackpackSol,Solflare],filteredInjectedWalletKeysOverrides=["coinbasesolana","phantom","phantomledger","backpacksol","solflare"],fetchInjectedWalletConnectors=({walletBook:fr})=>{var br;return Object.entries((br=fr==null?void 0:fr.wallets)!==null&&br!==void 0?br:{}).filter(([wr,Er])=>{var kr;const jr=!!(!((kr=Er.injectedConfig)===null||kr===void 0)&&kr.find(Wr=>Wr.chain==="sol")),Br=filteredInjectedWalletKeysOverrides.includes(wr);return jr&&!Br}).map(([wr,Er])=>{var kr;const{shortName:jr}=Er,Br=jr||Er.name;return!!(!((kr=Er.injectedConfig)===null||kr===void 0)&&kr.find(qr=>qr.walletStandard))&&!!SolanaWalletStandardConnector.getWallet(fr,wr)?class extends SolanaWalletStandardConnector{constructor(Gr){super(Object.assign({},Gr)),this.name=Br,this.overrideKey=wr}}:class extends InjectedWalletBase{constructor(qr){super(Object.assign({},qr)),this.name=Br,this.wallet=Er,this.overrideKey=wr}}})};class UnknownInjected extends InjectedWalletBase{constructor(br){super(br),this.name="Unknown",this.overrideKey="unknown",this.wallet=findWalletBookWallet(this.walletBook,this.key)}isInstalledOnBrowser(){return!1}}class FallbackSolanaConnector extends InjectedWalletBase{constructor(br){super(br),this.name="Fallback Connector",this.overrideKey="fallbackconnector",this.isAvailable=!1,this.wallet=findWalletBookWallet(this.walletBook,this.key)}isInstalledOnBrowser(){return!1}}const SolanaWalletConnectors=fr=>[...injectedWalletOverrides,...fetchInjectedWalletConnectors(fr),...TurnkeySolanaWalletConnectors(fr),Phantom,UnknownInjected,FallbackSolanaConnector];assertPackageVersion("@dynamic-labs/solana",version$7);client$1.createRoot(document.getElementById("root")).render(jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(DynamicContextProvider,{theme:"dark",settings:{initialAuthenticationMode:"connect-only",environmentId:"82e8732d-11b8-428d-a553-7087d0c44171",walletConnectors:[EthereumWalletConnectors,SolanaWalletConnectors]},children:jsxRuntimeExports.jsx(App,{})})}));export{Buffer$2 as B,DEFAULT_JWK_MEMBER_BYTE_LENGTH as D,Field as F,__vitePreload as _,uint8ArrayFromHexString as a,createHash as b,createCurve as c,dijkstraExports as d,encodeUtf8$1 as e,global$1 as g,hexStringToBase64url as h,requireCryptoBrowserify as r,sha256$3 as s,uint8ArrayToHexString as u}; diff --git a/assets/native-CSxBbLxR.js b/assets/native-BCwCyULO.js similarity index 81% rename from assets/native-CSxBbLxR.js rename to assets/native-BCwCyULO.js index 870a0c4..a2f8635 100644 --- a/assets/native-CSxBbLxR.js +++ b/assets/native-BCwCyULO.js @@ -1 +1 @@ -import{g as e}from"./index-DQigAB7X.js";function t(){if(typeof WebSocket<"u")return WebSocket;if(typeof e.WebSocket<"u")return e.WebSocket;if(typeof window.WebSocket<"u")return window.WebSocket;if(typeof self.WebSocket<"u")return self.WebSocket;throw new Error("`WebSocket` is not supported in this environment")}const n=t();export{n as WebSocket}; +import{g as e}from"./index-lKOqBfdS.js";function t(){if(typeof WebSocket<"u")return WebSocket;if(typeof e.WebSocket<"u")return e.WebSocket;if(typeof window.WebSocket<"u")return window.WebSocket;if(typeof self.WebSocket<"u")return self.WebSocket;throw new Error("`WebSocket` is not supported in this environment")}const n=t();export{n as WebSocket}; diff --git a/assets/nodecrypto-D2ugBmJb.js b/assets/nodecrypto-CtIF-oIC.js similarity index 64% rename from assets/nodecrypto-D2ugBmJb.js rename to assets/nodecrypto-CtIF-oIC.js index 0c4a932..f599374 100644 --- a/assets/nodecrypto-D2ugBmJb.js +++ b/assets/nodecrypto-CtIF-oIC.js @@ -1 +1 @@ -import{r as n,B as y}from"./index-DQigAB7X.js";import{c as p}from"./utils-Ci-V-obq.js";var r=n();const m=async t=>{const{content:o,publicKey:i,privateKey:s}=t,c=r.createPrivateKey({key:p({uncompressedPrivateKeyHex:s,compressedPublicKeyHex:i}),format:"jwk"}),e=r.createSign("SHA256");return e.write(y.from(o)),e.end(),e.sign(c,"hex")};export{m as signWithApiKey}; +import{r as n,B as y}from"./index-lKOqBfdS.js";import{c as p}from"./utils-CY2aEMoz.js";var r=n();const m=async t=>{const{content:o,publicKey:i,privateKey:s}=t,c=r.createPrivateKey({key:p({uncompressedPrivateKeyHex:s,compressedPublicKeyHex:i}),format:"jwk"}),e=r.createSign("SHA256");return e.write(y.from(o)),e.end(),e.sign(c,"hex")};export{m as signWithApiKey}; diff --git a/assets/purejs-CAiGQDMH.js b/assets/purejs-DPZGIi36.js similarity index 92% rename from assets/purejs-CAiGQDMH.js rename to assets/purejs-DPZGIi36.js index bceb409..f4b21f0 100644 --- a/assets/purejs-CAiGQDMH.js +++ b/assets/purejs-DPZGIi36.js @@ -1 +1 @@ -import{F as n,c as s,s as i,u as r,b as o}from"./index-DQigAB7X.js";/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=n(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),g=t.create(BigInt("-3")),d=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),c=s({a:g,b:d,Fp:t,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},i),u=async f=>{const a=c.getPublicKey(f.privateKey,!0),e=r(a);if(e!=f.publicKey)throw new Error(`Bad API key. Expected to get public key ${f.publicKey}, got ${e}`);const b=o().update(f.content).digest();return c.sign(b,f.privateKey).toDERHex()};export{u as signWithApiKey}; +import{F as n,c as s,s as i,u as r,b as o}from"./index-lKOqBfdS.js";/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=n(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),g=t.create(BigInt("-3")),d=BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),c=s({a:g,b:d,Fp:t,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},i),u=async f=>{const a=c.getPublicKey(f.privateKey,!0),e=r(a);if(e!=f.publicKey)throw new Error(`Bad API key. Expected to get public key ${f.publicKey}, got ${e}`);const b=o().update(f.content).digest();return c.sign(b,f.privateKey).toDERHex()};export{u as signWithApiKey}; diff --git a/assets/utils-Ci-V-obq.js b/assets/utils-CY2aEMoz.js similarity index 98% rename from assets/utils-Ci-V-obq.js rename to assets/utils-CY2aEMoz.js index 39998f8..db08b1a 100644 --- a/assets/utils-Ci-V-obq.js +++ b/assets/utils-CY2aEMoz.js @@ -1,4 +1,4 @@ -import{a as d,h as B,D as w}from"./index-DQigAB7X.js";/** +import{a as d,h as B,D as w}from"./index-lKOqBfdS.js";/** * Code modified from https://github.com/google/tink/blob/6f74b99a2bfe6677e3670799116a57268fd067fa/javascript/subtle/bytes.ts * * @license diff --git a/assets/webcrypto-BwsVVJaH.js b/assets/webcrypto-CPaydEYP.js similarity index 90% rename from assets/webcrypto-BwsVVJaH.js rename to assets/webcrypto-CPaydEYP.js index 947295d..11f025f 100644 --- a/assets/webcrypto-BwsVVJaH.js +++ b/assets/webcrypto-CPaydEYP.js @@ -1 +1 @@ -import{c}from"./utils-Ci-V-obq.js";import{u as i}from"./index-DQigAB7X.js";const p=async n=>{const{content:e,publicKey:s,privateKey:t}=n,o=await g({uncompressedPrivateKeyHex:t,compressedPublicKeyHex:s});return await l({key:o,content:e})};async function g(n){const{uncompressedPrivateKeyHex:e,compressedPublicKeyHex:s}=n,t=c({uncompressedPrivateKeyHex:e,compressedPublicKeyHex:s});return await crypto.subtle.importKey("jwk",t,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"])}async function l(n){const{key:e,content:s}=n,t=await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e,new TextEncoder().encode(s)),o=u(new Uint8Array(t));return i(o)}function u(n){if(n.length%2!=0||n.length==0||n.length>132)throw new Error("Invalid IEEE P1363 signature encoding. Length: "+n.length);const e=a(n.subarray(0,n.length/2)),s=a(n.subarray(n.length/2,n.length));let t=0;const o=2+e.length+1+1+s.length;let r;return o>=128?(r=new Uint8Array(o+3),r[t++]=48,r[t++]=129,r[t++]=o):(r=new Uint8Array(o+2),r[t++]=48,r[t++]=o),r[t++]=2,r[t++]=e.length,r.set(e,t),t+=e.length,r[t++]=2,r[t++]=s.length,r.set(s,t),r}function a(n){let e=0;for(;e{const{content:e,publicKey:s,privateKey:t}=n,o=await g({uncompressedPrivateKeyHex:t,compressedPublicKeyHex:s});return await l({key:o,content:e})};async function g(n){const{uncompressedPrivateKeyHex:e,compressedPublicKeyHex:s}=n,t=c({uncompressedPrivateKeyHex:e,compressedPublicKeyHex:s});return await crypto.subtle.importKey("jwk",t,{name:"ECDSA",namedCurve:"P-256"},!1,["sign"])}async function l(n){const{key:e,content:s}=n,t=await crypto.subtle.sign({name:"ECDSA",hash:"SHA-256"},e,new TextEncoder().encode(s)),o=u(new Uint8Array(t));return i(o)}function u(n){if(n.length%2!=0||n.length==0||n.length>132)throw new Error("Invalid IEEE P1363 signature encoding. Length: "+n.length);const e=a(n.subarray(0,n.length/2)),s=a(n.subarray(n.length/2,n.length));let t=0;const o=2+e.length+1+1+s.length;let r;return o>=128?(r=new Uint8Array(o+3),r[t++]=48,r[t++]=129,r[t++]=o):(r=new Uint8Array(o+2),r[t++]=48,r[t++]=o),r[t++]=2,r[t++]=e.length,r.set(e,t),t+=e.length,r[t++]=2,r[t++]=s.length,r.set(s,t),r}function a(n){let e=0;for(;e - +