@dcl/auth-site 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/{fortmatic-7379efff.js → fortmatic-26a47a11.js} +2 -2
- package/assets/{fortmatic-7379efff.js.map → fortmatic-26a47a11.js.map} +1 -1
- package/assets/{index-508f5b2c.js → index-14dfc4a0.js} +2 -2
- package/assets/{index-508f5b2c.js.map → index-14dfc4a0.js.map} +1 -1
- package/assets/{index-80adc4ef.js → index-7911507e.js} +2 -2
- package/assets/{index-80adc4ef.js.map → index-7911507e.js.map} +1 -1
- package/assets/{index-c5bbafed.js → index-7fbad618.js} +2 -2
- package/assets/{index-c5bbafed.js.map → index-7fbad618.js.map} +1 -1
- package/assets/{index-26b3bea2.css → index-8006ed4b.css} +3 -3
- package/assets/{index-c1d19e23.js → index-8a109c4c.js} +4 -4
- package/assets/{index-c1d19e23.js.map → index-8a109c4c.js.map} +1 -1
- package/assets/{index-9b300f37.js → index-9dc2a34d.js} +2 -2
- package/assets/{index-9b300f37.js.map → index-9dc2a34d.js.map} +1 -1
- package/assets/{index-8a46796e.js → index-f0f060e7.js} +2 -2
- package/assets/{index-8a46796e.js.map → index-f0f060e7.js.map} +1 -1
- package/assets/{index-c906fe37.js → index-fcfdb43d.js} +2 -2
- package/assets/{index-c906fe37.js.map → index-fcfdb43d.js.map} +1 -1
- package/assets/{index.es-17ca196b.js → index.es-7af53fc6.js} +3 -3
- package/assets/{index.es-17ca196b.js.map → index.es-7af53fc6.js.map} +1 -1
- package/index.html +2 -2
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{p as ri,b as D1,d as Z3,r as t6,g as Ie,B as ca,e as Di,a as Tl,c as Zi,f as Fl,o as ad,_ as e6}from"./index-c1d19e23.js";import{t as r6}from"./tslib.es6-c2094241.js";var cd=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var i=0,s=t.length,a;i<s;i++)(a||!(i in t))&&(a||(a=Array.prototype.slice.call(t,0,i)),a[i]=t[i]);return r.concat(a||Array.prototype.slice.call(t))},i6=function(){function r(t,e,i){this.name=t,this.version=e,this.os=i,this.type="browser"}return r}(),n6=function(){function r(t){this.version=t,this.type="node",this.name="node",this.os=ri.platform}return r}(),s6=function(){function r(t,e,i,s){this.name=t,this.version=e,this.os=i,this.bot=s,this.type="bot-device"}return r}(),o6=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),a6=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),c6=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,u6=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,ud=3,h6=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",c6]],hd=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function l6(r){return r?ld(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new a6:typeof navigator<"u"?ld(navigator.userAgent):p6()}function f6(r){return r!==""&&h6.reduce(function(t,e){var i=e[0],s=e[1];if(t)return t;var a=s.exec(r);return!!a&&[i,a]},!1)}function ld(r){var t=f6(r);if(!t)return null;var e=t[0],i=t[1];if(e==="searchbot")return new o6;var s=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);s?s.length<ud&&(s=cd(cd([],s,!0),g6(ud-s.length),!0)):s=[];var a=s.join("."),u=d6(r),l=u6.exec(r);return l&&l[1]?new s6(e,a,u,l[1]):new i6(e,a,u)}function d6(r){for(var t=0,e=hd.length;t<e;t++){var i=hd[t],s=i[0],a=i[1],u=a.exec(r);if(u)return s}return null}function p6(){var r=typeof ri<"u"&&ri.version;return r?new n6(ri.version.slice(1)):null}function g6(r){for(var t=[],e=0;e<r;e++)t.push("0");return t}var yt={};const ua=D1(r6);var xh={},jo={},fd;function m6(){if(fd)return jo;fd=1,Object.defineProperty(jo,"__esModule",{value:!0}),jo.delay=void 0;function r(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}return jo.delay=r,jo}var ys={},Mh={},ws={},dd;function v6(){return dd||(dd=1,Object.defineProperty(ws,"__esModule",{value:!0}),ws.ONE_THOUSAND=ws.ONE_HUNDRED=void 0,ws.ONE_HUNDRED=100,ws.ONE_THOUSAND=1e3),ws}var Ch={},pd;function y6(){return pd||(pd=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(Ch)),Ch}var gd;function x1(){return gd||(gd=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=ua;t.__exportStar(v6(),r),t.__exportStar(y6(),r)}(Mh)),Mh}var md;function w6(){if(md)return ys;md=1,Object.defineProperty(ys,"__esModule",{value:!0}),ys.fromMiliseconds=ys.toMiliseconds=void 0;const r=x1();function t(i){return i*r.ONE_THOUSAND}ys.toMiliseconds=t;function e(i){return Math.floor(i/r.ONE_THOUSAND)}return ys.fromMiliseconds=e,ys}var vd;function b6(){return vd||(vd=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=ua;t.__exportStar(m6(),r),t.__exportStar(w6(),r)}(xh)),xh}var Qs={},yd;function _6(){if(yd)return Qs;yd=1,Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){const i=this.get(e);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);const s=Date.now()-i.started;this.timestamps.set(e,{started:i.started,elapsed:s})}get(e){const i=this.timestamps.get(e);if(typeof i>"u")throw new Error(`No timestamp found for label: ${e}`);return i}elapsed(e){const i=this.get(e);return i.elapsed||Date.now()-i.started}}return Qs.Watch=r,Qs.default=r,Qs}var Ph={},$o={},wd;function E6(){if(wd)return $o;wd=1,Object.defineProperty($o,"__esModule",{value:!0}),$o.IWatch=void 0;class r{}return $o.IWatch=r,$o}var bd;function A6(){return bd||(bd=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),ua.__exportStar(E6(),r)}(Ph)),Ph}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=ua;t.__exportStar(b6(),r),t.__exportStar(_6(),r),t.__exportStar(A6(),r),t.__exportStar(x1(),r)})(yt);var je={};Object.defineProperty(je,"__esModule",{value:!0});je.getLocalStorage=je.getLocalStorageOrThrow=je.getCrypto=je.getCryptoOrThrow=M1=je.getLocation=je.getLocationOrThrow=Bl=je.getNavigator=je.getNavigatorOrThrow=Ul=je.getDocument=je.getDocumentOrThrow=je.getFromWindowOrThrow=je.getFromWindow=void 0;function xs(r){let t;return typeof window<"u"&&typeof window[r]<"u"&&(t=window[r]),t}je.getFromWindow=xs;function lo(r){const t=xs(r);if(!t)throw new Error(`${r} is not defined in Window`);return t}je.getFromWindowOrThrow=lo;function S6(){return lo("document")}je.getDocumentOrThrow=S6;function I6(){return xs("document")}var Ul=je.getDocument=I6;function D6(){return lo("navigator")}je.getNavigatorOrThrow=D6;function x6(){return xs("navigator")}var Bl=je.getNavigator=x6;function M6(){return lo("location")}je.getLocationOrThrow=M6;function C6(){return xs("location")}var M1=je.getLocation=C6;function P6(){return lo("crypto")}je.getCryptoOrThrow=P6;function O6(){return xs("crypto")}je.getCrypto=O6;function N6(){return lo("localStorage")}je.getLocalStorageOrThrow=N6;function R6(){return xs("localStorage")}je.getLocalStorage=R6;var Ll={};Object.defineProperty(Ll,"__esModule",{value:!0});var C1=Ll.getWindowMetadata=void 0;const _d=je;function T6(){let r,t;try{r=_d.getDocumentOrThrow(),t=_d.getLocationOrThrow()}catch{return null}function e(){const E=r.getElementsByTagName("link"),x=[];for(let I=0;I<E.length;I++){const N=E[I],Y=N.getAttribute("rel");if(Y&&Y.toLowerCase().indexOf("icon")>-1){const G=N.getAttribute("href");if(G)if(G.toLowerCase().indexOf("https:")===-1&&G.toLowerCase().indexOf("http:")===-1&&G.indexOf("//")!==0){let tt=t.protocol+"//"+t.host;if(G.indexOf("/")===0)tt+=G;else{const K=t.pathname.split("/");K.pop();const V=K.join("/");tt+=V+"/"+G}x.push(tt)}else if(G.indexOf("//")===0){const tt=t.protocol+G;x.push(tt)}else x.push(G)}}return x}function i(...E){const x=r.getElementsByTagName("meta");for(let I=0;I<x.length;I++){const N=x[I],Y=["itemprop","property","name"].map(G=>N.getAttribute(G)).filter(G=>G?E.includes(G):!1);if(Y.length&&Y){const G=N.getAttribute("content");if(G)return G}}return""}function s(){let E=i("name","og:site_name","og:title","twitter:title");return E||(E=r.title),E}function a(){return i("description","og:description","twitter:description","keywords")}const u=s(),l=a(),m=t.origin,f=e();return{description:l,url:m,icons:f,name:u}}C1=Ll.getWindowMetadata=T6;var ea={},F6=r=>encodeURIComponent(r).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),P1="%[a-f0-9]{2}",Ed=new RegExp("("+P1+")|([^%]+?)","gi"),Ad=new RegExp("("+P1+")+","gi");function ul(r,t){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;t=t||1;var e=r.slice(0,t),i=r.slice(t);return Array.prototype.concat.call([],ul(e),ul(i))}function U6(r){try{return decodeURIComponent(r)}catch{for(var t=r.match(Ed)||[],e=1;e<t.length;e++)r=ul(t,e).join(""),t=r.match(Ed)||[];return r}}function B6(r){for(var t={"%FE%FF":"��","%FF%FE":"��"},e=Ad.exec(r);e;){try{t[e[0]]=decodeURIComponent(e[0])}catch{var i=U6(e[0]);i!==e[0]&&(t[e[0]]=i)}e=Ad.exec(r)}t["%C2"]="�";for(var s=Object.keys(t),a=0;a<s.length;a++){var u=s[a];r=r.replace(new RegExp(u,"g"),t[u])}return r}var L6=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch{return B6(r)}},q6=(r,t)=>{if(!(typeof r=="string"&&typeof t=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(t==="")return[r];const e=r.indexOf(t);return e===-1?[r]:[r.slice(0,e),r.slice(e+t.length)]},j6=function(r,t){for(var e={},i=Object.keys(r),s=Array.isArray(t),a=0;a<i.length;a++){var u=i[a],l=r[u];(s?t.indexOf(u)!==-1:t(u,l,r))&&(e[u]=l)}return e};(function(r){const t=F6,e=L6,i=q6,s=j6,a=K=>K==null,u=Symbol("encodeFragmentIdentifier");function l(K){switch(K.arrayFormat){case"index":return V=>(B,z)=>{const $=B.length;return z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,[w(V,K),"[",$,"]"].join("")]:[...B,[w(V,K),"[",w($,K),"]=",w(z,K)].join("")]};case"bracket":return V=>(B,z)=>z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,[w(V,K),"[]"].join("")]:[...B,[w(V,K),"[]=",w(z,K)].join("")];case"colon-list-separator":return V=>(B,z)=>z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,[w(V,K),":list="].join("")]:[...B,[w(V,K),":list=",w(z,K)].join("")];case"comma":case"separator":case"bracket-separator":{const V=K.arrayFormat==="bracket-separator"?"[]=":"=";return B=>(z,$)=>$===void 0||K.skipNull&&$===null||K.skipEmptyString&&$===""?z:($=$===null?"":$,z.length===0?[[w(B,K),V,w($,K)].join("")]:[[z,w($,K)].join(K.arrayFormatSeparator)])}default:return V=>(B,z)=>z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,w(V,K)]:[...B,[w(V,K),"=",w(z,K)].join("")]}}function m(K){let V;switch(K.arrayFormat){case"index":return(B,z,$)=>{if(V=/\[(\d*)\]$/.exec(B),B=B.replace(/\[\d*\]$/,""),!V){$[B]=z;return}$[B]===void 0&&($[B]={}),$[B][V[1]]=z};case"bracket":return(B,z,$)=>{if(V=/(\[\])$/.exec(B),B=B.replace(/\[\]$/,""),!V){$[B]=z;return}if($[B]===void 0){$[B]=[z];return}$[B]=[].concat($[B],z)};case"colon-list-separator":return(B,z,$)=>{if(V=/(:list)$/.exec(B),B=B.replace(/:list$/,""),!V){$[B]=z;return}if($[B]===void 0){$[B]=[z];return}$[B]=[].concat($[B],z)};case"comma":case"separator":return(B,z,$)=>{const v=typeof z=="string"&&z.includes(K.arrayFormatSeparator),T=typeof z=="string"&&!v&&E(z,K).includes(K.arrayFormatSeparator);z=T?E(z,K):z;const nt=v||T?z.split(K.arrayFormatSeparator).map(ft=>E(ft,K)):z===null?z:E(z,K);$[B]=nt};case"bracket-separator":return(B,z,$)=>{const v=/(\[\])$/.test(B);if(B=B.replace(/\[\]$/,""),!v){$[B]=z&&E(z,K);return}const T=z===null?[]:z.split(K.arrayFormatSeparator).map(nt=>E(nt,K));if($[B]===void 0){$[B]=T;return}$[B]=[].concat($[B],T)};default:return(B,z,$)=>{if($[B]===void 0){$[B]=z;return}$[B]=[].concat($[B],z)}}}function f(K){if(typeof K!="string"||K.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function w(K,V){return V.encode?V.strict?t(K):encodeURIComponent(K):K}function E(K,V){return V.decode?e(K):K}function x(K){return Array.isArray(K)?K.sort():typeof K=="object"?x(Object.keys(K)).sort((V,B)=>Number(V)-Number(B)).map(V=>K[V]):K}function I(K){const V=K.indexOf("#");return V!==-1&&(K=K.slice(0,V)),K}function N(K){let V="";const B=K.indexOf("#");return B!==-1&&(V=K.slice(B)),V}function Y(K){K=I(K);const V=K.indexOf("?");return V===-1?"":K.slice(V+1)}function G(K,V){return V.parseNumbers&&!Number.isNaN(Number(K))&&typeof K=="string"&&K.trim()!==""?K=Number(K):V.parseBooleans&&K!==null&&(K.toLowerCase()==="true"||K.toLowerCase()==="false")&&(K=K.toLowerCase()==="true"),K}function tt(K,V){V=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},V),f(V.arrayFormatSeparator);const B=m(V),z=Object.create(null);if(typeof K!="string"||(K=K.trim().replace(/^[?#&]/,""),!K))return z;for(const $ of K.split("&")){if($==="")continue;let[v,T]=i(V.decode?$.replace(/\+/g," "):$,"=");T=T===void 0?null:["comma","separator","bracket-separator"].includes(V.arrayFormat)?T:E(T,V),B(E(v,V),T,z)}for(const $ of Object.keys(z)){const v=z[$];if(typeof v=="object"&&v!==null)for(const T of Object.keys(v))v[T]=G(v[T],V);else z[$]=G(v,V)}return V.sort===!1?z:(V.sort===!0?Object.keys(z).sort():Object.keys(z).sort(V.sort)).reduce(($,v)=>{const T=z[v];return T&&typeof T=="object"&&!Array.isArray(T)?$[v]=x(T):$[v]=T,$},Object.create(null))}r.extract=Y,r.parse=tt,r.stringify=(K,V)=>{if(!K)return"";V=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},V),f(V.arrayFormatSeparator);const B=T=>V.skipNull&&a(K[T])||V.skipEmptyString&&K[T]==="",z=l(V),$={};for(const T of Object.keys(K))B(T)||($[T]=K[T]);const v=Object.keys($);return V.sort!==!1&&v.sort(V.sort),v.map(T=>{const nt=K[T];return nt===void 0?"":nt===null?w(T,V):Array.isArray(nt)?nt.length===0&&V.arrayFormat==="bracket-separator"?w(T,V)+"[]":nt.reduce(z(T),[]).join("&"):w(T,V)+"="+w(nt,V)}).filter(T=>T.length>0).join("&")},r.parseUrl=(K,V)=>{V=Object.assign({decode:!0},V);const[B,z]=i(K,"#");return Object.assign({url:B.split("?")[0]||"",query:tt(Y(K),V)},V&&V.parseFragmentIdentifier&&z?{fragmentIdentifier:E(z,V)}:{})},r.stringifyUrl=(K,V)=>{V=Object.assign({encode:!0,strict:!0,[u]:!0},V);const B=I(K.url).split("?")[0]||"",z=r.extract(K.url),$=r.parse(z,{sort:!1}),v=Object.assign($,K.query);let T=r.stringify(v,V);T&&(T=`?${T}`);let nt=N(K.url);return K.fragmentIdentifier&&(nt=`#${V[u]?w(K.fragmentIdentifier,V):K.fragmentIdentifier}`),`${B}${T}${nt}`},r.pick=(K,V,B)=>{B=Object.assign({parseFragmentIdentifier:!0,[u]:!1},B);const{url:z,query:$,fragmentIdentifier:v}=r.parseUrl(K,B);return r.stringifyUrl({url:z,query:s($,V),fragmentIdentifier:v},B)},r.exclude=(K,V,B)=>{const z=Array.isArray(V)?$=>!V.includes($):($,v)=>!V($,v);return r.pick(K,z,B)}})(ea);var ql={},nu={},oe={},O1={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function t(l,m){var f=l>>>16&65535,w=l&65535,E=m>>>16&65535,x=m&65535;return w*x+(f*x+w*E<<16>>>0)|0}r.mul=Math.imul||t;function e(l,m){return l+m|0}r.add=e;function i(l,m){return l-m|0}r.sub=i;function s(l,m){return l<<m|l>>>32-m}r.rotl=s;function a(l,m){return l<<32-m|l>>>m}r.rotr=a;function u(l){return typeof l=="number"&&isFinite(l)&&Math.floor(l)===l}r.isInteger=Number.isInteger||u,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(l){return r.isInteger(l)&&l>=-r.MAX_SAFE_INTEGER&&l<=r.MAX_SAFE_INTEGER}})(O1);Object.defineProperty(oe,"__esModule",{value:!0});var N1=O1;function $6(r,t){return t===void 0&&(t=0),(r[t+0]<<8|r[t+1])<<16>>16}oe.readInt16BE=$6;function z6(r,t){return t===void 0&&(t=0),(r[t+0]<<8|r[t+1])>>>0}oe.readUint16BE=z6;function k6(r,t){return t===void 0&&(t=0),(r[t+1]<<8|r[t])<<16>>16}oe.readInt16LE=k6;function H6(r,t){return t===void 0&&(t=0),(r[t+1]<<8|r[t])>>>0}oe.readUint16LE=H6;function R1(r,t,e){return t===void 0&&(t=new Uint8Array(2)),e===void 0&&(e=0),t[e+0]=r>>>8,t[e+1]=r>>>0,t}oe.writeUint16BE=R1;oe.writeInt16BE=R1;function T1(r,t,e){return t===void 0&&(t=new Uint8Array(2)),e===void 0&&(e=0),t[e+0]=r>>>0,t[e+1]=r>>>8,t}oe.writeUint16LE=T1;oe.writeInt16LE=T1;function hl(r,t){return t===void 0&&(t=0),r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3]}oe.readInt32BE=hl;function ll(r,t){return t===void 0&&(t=0),(r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3])>>>0}oe.readUint32BE=ll;function fl(r,t){return t===void 0&&(t=0),r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t]}oe.readInt32LE=fl;function dl(r,t){return t===void 0&&(t=0),(r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t])>>>0}oe.readUint32LE=dl;function Hc(r,t,e){return t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0),t[e+0]=r>>>24,t[e+1]=r>>>16,t[e+2]=r>>>8,t[e+3]=r>>>0,t}oe.writeUint32BE=Hc;oe.writeInt32BE=Hc;function Kc(r,t,e){return t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0),t[e+0]=r>>>0,t[e+1]=r>>>8,t[e+2]=r>>>16,t[e+3]=r>>>24,t}oe.writeUint32LE=Kc;oe.writeInt32LE=Kc;function K6(r,t){t===void 0&&(t=0);var e=hl(r,t),i=hl(r,t+4);return e*4294967296+i-(i>>31)*4294967296}oe.readInt64BE=K6;function V6(r,t){t===void 0&&(t=0);var e=ll(r,t),i=ll(r,t+4);return e*4294967296+i}oe.readUint64BE=V6;function G6(r,t){t===void 0&&(t=0);var e=fl(r,t),i=fl(r,t+4);return i*4294967296+e-(e>>31)*4294967296}oe.readInt64LE=G6;function W6(r,t){t===void 0&&(t=0);var e=dl(r,t),i=dl(r,t+4);return i*4294967296+e}oe.readUint64LE=W6;function F1(r,t,e){return t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0),Hc(r/4294967296>>>0,t,e),Hc(r>>>0,t,e+4),t}oe.writeUint64BE=F1;oe.writeInt64BE=F1;function U1(r,t,e){return t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0),Kc(r>>>0,t,e),Kc(r/4294967296>>>0,t,e+4),t}oe.writeUint64LE=U1;oe.writeInt64LE=U1;function Y6(r,t,e){if(e===void 0&&(e=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>t.length-e)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,s=1,a=r/8+e-1;a>=e;a--)i+=t[a]*s,s*=256;return i}oe.readUintBE=Y6;function Q6(r,t,e){if(e===void 0&&(e=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>t.length-e)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,s=1,a=e;a<e+r/8;a++)i+=t[a]*s,s*=256;return i}oe.readUintLE=Q6;function J6(r,t,e,i){if(e===void 0&&(e=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!N1.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var s=1,a=r/8+i-1;a>=i;a--)e[a]=t/s&255,s*=256;return e}oe.writeUintBE=J6;function X6(r,t,e,i){if(e===void 0&&(e=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!N1.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var s=1,a=i;a<i+r/8;a++)e[a]=t/s&255,s*=256;return e}oe.writeUintLE=X6;function Z6(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat32(t)}oe.readFloat32BE=Z6;function t_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat32(t,!0)}oe.readFloat32LE=t_;function e_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat64(t)}oe.readFloat64BE=e_;function r_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat64(t,!0)}oe.readFloat64LE=r_;function i_(r,t,e){t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0);var i=new DataView(t.buffer,t.byteOffset,t.byteLength);return i.setFloat32(e,r),t}oe.writeFloat32BE=i_;function n_(r,t,e){t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0);var i=new DataView(t.buffer,t.byteOffset,t.byteLength);return i.setFloat32(e,r,!0),t}oe.writeFloat32LE=n_;function s_(r,t,e){t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0);var i=new DataView(t.buffer,t.byteOffset,t.byteLength);return i.setFloat64(e,r),t}oe.writeFloat64BE=s_;function o_(r,t,e){t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0);var i=new DataView(t.buffer,t.byteOffset,t.byteLength);return i.setFloat64(e,r,!0),t}oe.writeFloat64LE=o_;var si={};Object.defineProperty(si,"__esModule",{value:!0});function a_(r){for(var t=0;t<r.length;t++)r[t]=0;return r}si.wipe=a_;Object.defineProperty(nu,"__esModule",{value:!0});var _r=oe,pl=si,c_=20;function u_(r,t,e){for(var i=1634760805,s=857760878,a=2036477234,u=1797285236,l=e[3]<<24|e[2]<<16|e[1]<<8|e[0],m=e[7]<<24|e[6]<<16|e[5]<<8|e[4],f=e[11]<<24|e[10]<<16|e[9]<<8|e[8],w=e[15]<<24|e[14]<<16|e[13]<<8|e[12],E=e[19]<<24|e[18]<<16|e[17]<<8|e[16],x=e[23]<<24|e[22]<<16|e[21]<<8|e[20],I=e[27]<<24|e[26]<<16|e[25]<<8|e[24],N=e[31]<<24|e[30]<<16|e[29]<<8|e[28],Y=t[3]<<24|t[2]<<16|t[1]<<8|t[0],G=t[7]<<24|t[6]<<16|t[5]<<8|t[4],tt=t[11]<<24|t[10]<<16|t[9]<<8|t[8],K=t[15]<<24|t[14]<<16|t[13]<<8|t[12],V=i,B=s,z=a,$=u,v=l,T=m,nt=f,ft=w,pt=E,mt=x,h=I,y=N,b=Y,M=G,C=tt,R=K,j=0;j<c_;j+=2)V=V+v|0,b^=V,b=b>>>32-16|b<<16,pt=pt+b|0,v^=pt,v=v>>>32-12|v<<12,B=B+T|0,M^=B,M=M>>>32-16|M<<16,mt=mt+M|0,T^=mt,T=T>>>32-12|T<<12,z=z+nt|0,C^=z,C=C>>>32-16|C<<16,h=h+C|0,nt^=h,nt=nt>>>32-12|nt<<12,$=$+ft|0,R^=$,R=R>>>32-16|R<<16,y=y+R|0,ft^=y,ft=ft>>>32-12|ft<<12,z=z+nt|0,C^=z,C=C>>>32-8|C<<8,h=h+C|0,nt^=h,nt=nt>>>32-7|nt<<7,$=$+ft|0,R^=$,R=R>>>32-8|R<<8,y=y+R|0,ft^=y,ft=ft>>>32-7|ft<<7,B=B+T|0,M^=B,M=M>>>32-8|M<<8,mt=mt+M|0,T^=mt,T=T>>>32-7|T<<7,V=V+v|0,b^=V,b=b>>>32-8|b<<8,pt=pt+b|0,v^=pt,v=v>>>32-7|v<<7,V=V+T|0,R^=V,R=R>>>32-16|R<<16,h=h+R|0,T^=h,T=T>>>32-12|T<<12,B=B+nt|0,b^=B,b=b>>>32-16|b<<16,y=y+b|0,nt^=y,nt=nt>>>32-12|nt<<12,z=z+ft|0,M^=z,M=M>>>32-16|M<<16,pt=pt+M|0,ft^=pt,ft=ft>>>32-12|ft<<12,$=$+v|0,C^=$,C=C>>>32-16|C<<16,mt=mt+C|0,v^=mt,v=v>>>32-12|v<<12,z=z+ft|0,M^=z,M=M>>>32-8|M<<8,pt=pt+M|0,ft^=pt,ft=ft>>>32-7|ft<<7,$=$+v|0,C^=$,C=C>>>32-8|C<<8,mt=mt+C|0,v^=mt,v=v>>>32-7|v<<7,B=B+nt|0,b^=B,b=b>>>32-8|b<<8,y=y+b|0,nt^=y,nt=nt>>>32-7|nt<<7,V=V+T|0,R^=V,R=R>>>32-8|R<<8,h=h+R|0,T^=h,T=T>>>32-7|T<<7;_r.writeUint32LE(V+i|0,r,0),_r.writeUint32LE(B+s|0,r,4),_r.writeUint32LE(z+a|0,r,8),_r.writeUint32LE($+u|0,r,12),_r.writeUint32LE(v+l|0,r,16),_r.writeUint32LE(T+m|0,r,20),_r.writeUint32LE(nt+f|0,r,24),_r.writeUint32LE(ft+w|0,r,28),_r.writeUint32LE(pt+E|0,r,32),_r.writeUint32LE(mt+x|0,r,36),_r.writeUint32LE(h+I|0,r,40),_r.writeUint32LE(y+N|0,r,44),_r.writeUint32LE(b+Y|0,r,48),_r.writeUint32LE(M+G|0,r,52),_r.writeUint32LE(C+tt|0,r,56),_r.writeUint32LE(R+K|0,r,60)}function B1(r,t,e,i,s){if(s===void 0&&(s=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<e.length)throw new Error("ChaCha: destination is shorter than source");var a,u;if(s===0){if(t.length!==8&&t.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");a=new Uint8Array(16),u=a.length-t.length,a.set(t,u)}else{if(t.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");a=t,u=s}for(var l=new Uint8Array(64),m=0;m<e.length;m+=64){u_(l,a,r);for(var f=m;f<m+64&&f<e.length;f++)i[f]=e[f]^l[f-m];l_(a,0,u)}return pl.wipe(l),s===0&&pl.wipe(a),i}nu.streamXOR=B1;function h_(r,t,e,i){return i===void 0&&(i=0),pl.wipe(e),B1(r,t,e,e,i)}nu.stream=h_;function l_(r,t,e){for(var i=1;e--;)i=i+(r[t]&255)|0,r[t]=i&255,i>>>=8,t++;if(i>0)throw new Error("ChaCha: counter overflow")}var L1={},Qn={};Object.defineProperty(Qn,"__esModule",{value:!0});function f_(r,t,e){return~(r-1)&t|r-1&e}Qn.select=f_;function d_(r,t){return(r|0)-(t|0)-1>>>31&1}Qn.lessOrEqual=d_;function q1(r,t){if(r.length!==t.length)return 0;for(var e=0,i=0;i<r.length;i++)e|=r[i]^t[i];return 1&e-1>>>8}Qn.compare=q1;function p_(r,t){return r.length===0||t.length===0?!1:q1(r,t)!==0}Qn.equal=p_;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var t=Qn,e=si;r.DIGEST_LENGTH=16;var i=function(){function u(l){this.digestLength=r.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 m=l[0]|l[1]<<8;this._r[0]=m&8191;var f=l[2]|l[3]<<8;this._r[1]=(m>>>13|f<<3)&8191;var w=l[4]|l[5]<<8;this._r[2]=(f>>>10|w<<6)&7939;var E=l[6]|l[7]<<8;this._r[3]=(w>>>7|E<<9)&8191;var x=l[8]|l[9]<<8;this._r[4]=(E>>>4|x<<12)&255,this._r[5]=x>>>1&8190;var I=l[10]|l[11]<<8;this._r[6]=(x>>>14|I<<2)&8191;var N=l[12]|l[13]<<8;this._r[7]=(I>>>11|N<<5)&8065;var Y=l[14]|l[15]<<8;this._r[8]=(N>>>8|Y<<8)&8191,this._r[9]=Y>>>5&127,this._pad[0]=l[16]|l[17]<<8,this._pad[1]=l[18]|l[19]<<8,this._pad[2]=l[20]|l[21]<<8,this._pad[3]=l[22]|l[23]<<8,this._pad[4]=l[24]|l[25]<<8,this._pad[5]=l[26]|l[27]<<8,this._pad[6]=l[28]|l[29]<<8,this._pad[7]=l[30]|l[31]<<8}return u.prototype._blocks=function(l,m,f){for(var w=this._fin?0:2048,E=this._h[0],x=this._h[1],I=this._h[2],N=this._h[3],Y=this._h[4],G=this._h[5],tt=this._h[6],K=this._h[7],V=this._h[8],B=this._h[9],z=this._r[0],$=this._r[1],v=this._r[2],T=this._r[3],nt=this._r[4],ft=this._r[5],pt=this._r[6],mt=this._r[7],h=this._r[8],y=this._r[9];f>=16;){var b=l[m+0]|l[m+1]<<8;E+=b&8191;var M=l[m+2]|l[m+3]<<8;x+=(b>>>13|M<<3)&8191;var C=l[m+4]|l[m+5]<<8;I+=(M>>>10|C<<6)&8191;var R=l[m+6]|l[m+7]<<8;N+=(C>>>7|R<<9)&8191;var j=l[m+8]|l[m+9]<<8;Y+=(R>>>4|j<<12)&8191,G+=j>>>1&8191;var S=l[m+10]|l[m+11]<<8;tt+=(j>>>14|S<<2)&8191;var p=l[m+12]|l[m+13]<<8;K+=(S>>>11|p<<5)&8191;var O=l[m+14]|l[m+15]<<8;V+=(p>>>8|O<<8)&8191,B+=O>>>5|w;var it=0,lt=it;lt+=E*z,lt+=x*(5*y),lt+=I*(5*h),lt+=N*(5*mt),lt+=Y*(5*pt),it=lt>>>13,lt&=8191,lt+=G*(5*ft),lt+=tt*(5*nt),lt+=K*(5*T),lt+=V*(5*v),lt+=B*(5*$),it+=lt>>>13,lt&=8191;var _=it;_+=E*$,_+=x*z,_+=I*(5*y),_+=N*(5*h),_+=Y*(5*mt),it=_>>>13,_&=8191,_+=G*(5*pt),_+=tt*(5*ft),_+=K*(5*nt),_+=V*(5*T),_+=B*(5*v),it+=_>>>13,_&=8191;var Z=it;Z+=E*v,Z+=x*$,Z+=I*z,Z+=N*(5*y),Z+=Y*(5*h),it=Z>>>13,Z&=8191,Z+=G*(5*mt),Z+=tt*(5*pt),Z+=K*(5*ft),Z+=V*(5*nt),Z+=B*(5*T),it+=Z>>>13,Z&=8191;var U=it;U+=E*T,U+=x*v,U+=I*$,U+=N*z,U+=Y*(5*y),it=U>>>13,U&=8191,U+=G*(5*h),U+=tt*(5*mt),U+=K*(5*pt),U+=V*(5*ft),U+=B*(5*nt),it+=U>>>13,U&=8191;var L=it;L+=E*nt,L+=x*T,L+=I*v,L+=N*$,L+=Y*z,it=L>>>13,L&=8191,L+=G*(5*y),L+=tt*(5*h),L+=K*(5*mt),L+=V*(5*pt),L+=B*(5*ft),it+=L>>>13,L&=8191;var k=it;k+=E*ft,k+=x*nt,k+=I*T,k+=N*v,k+=Y*$,it=k>>>13,k&=8191,k+=G*z,k+=tt*(5*y),k+=K*(5*h),k+=V*(5*mt),k+=B*(5*pt),it+=k>>>13,k&=8191;var d=it;d+=E*pt,d+=x*ft,d+=I*nt,d+=N*T,d+=Y*v,it=d>>>13,d&=8191,d+=G*$,d+=tt*z,d+=K*(5*y),d+=V*(5*h),d+=B*(5*mt),it+=d>>>13,d&=8191;var F=it;F+=E*mt,F+=x*pt,F+=I*ft,F+=N*nt,F+=Y*T,it=F>>>13,F&=8191,F+=G*v,F+=tt*$,F+=K*z,F+=V*(5*y),F+=B*(5*h),it+=F>>>13,F&=8191;var et=it;et+=E*h,et+=x*mt,et+=I*pt,et+=N*ft,et+=Y*nt,it=et>>>13,et&=8191,et+=G*T,et+=tt*v,et+=K*$,et+=V*z,et+=B*(5*y),it+=et>>>13,et&=8191;var ut=it;ut+=E*y,ut+=x*h,ut+=I*mt,ut+=N*pt,ut+=Y*ft,it=ut>>>13,ut&=8191,ut+=G*nt,ut+=tt*T,ut+=K*v,ut+=V*$,ut+=B*z,it+=ut>>>13,ut&=8191,it=(it<<2)+it|0,it=it+lt|0,lt=it&8191,it=it>>>13,_+=it,E=lt,x=_,I=Z,N=U,Y=L,G=k,tt=d,K=F,V=et,B=ut,m+=16,f-=16}this._h[0]=E,this._h[1]=x,this._h[2]=I,this._h[3]=N,this._h[4]=Y,this._h[5]=G,this._h[6]=tt,this._h[7]=K,this._h[8]=V,this._h[9]=B},u.prototype.finish=function(l,m){m===void 0&&(m=0);var f=new Uint16Array(10),w,E,x,I;if(this._leftover){for(I=this._leftover,this._buffer[I++]=1;I<16;I++)this._buffer[I]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(w=this._h[1]>>>13,this._h[1]&=8191,I=2;I<10;I++)this._h[I]+=w,w=this._h[I]>>>13,this._h[I]&=8191;for(this._h[0]+=w*5,w=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=w,w=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=w,f[0]=this._h[0]+5,w=f[0]>>>13,f[0]&=8191,I=1;I<10;I++)f[I]=this._h[I]+w,w=f[I]>>>13,f[I]&=8191;for(f[9]-=8192,E=(w^1)-1,I=0;I<10;I++)f[I]&=E;for(E=~E,I=0;I<10;I++)this._h[I]=this._h[I]&E|f[I];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,x=this._h[0]+this._pad[0],this._h[0]=x&65535,I=1;I<8;I++)x=(this._h[I]+this._pad[I]|0)+(x>>>16)|0,this._h[I]=x&65535;return l[m+0]=this._h[0]>>>0,l[m+1]=this._h[0]>>>8,l[m+2]=this._h[1]>>>0,l[m+3]=this._h[1]>>>8,l[m+4]=this._h[2]>>>0,l[m+5]=this._h[2]>>>8,l[m+6]=this._h[3]>>>0,l[m+7]=this._h[3]>>>8,l[m+8]=this._h[4]>>>0,l[m+9]=this._h[4]>>>8,l[m+10]=this._h[5]>>>0,l[m+11]=this._h[5]>>>8,l[m+12]=this._h[6]>>>0,l[m+13]=this._h[6]>>>8,l[m+14]=this._h[7]>>>0,l[m+15]=this._h[7]>>>8,this._finished=!0,this},u.prototype.update=function(l){var m=0,f=l.length,w;if(this._leftover){w=16-this._leftover,w>f&&(w=f);for(var E=0;E<w;E++)this._buffer[this._leftover+E]=l[m+E];if(f-=w,m+=w,this._leftover+=w,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(f>=16&&(w=f-f%16,this._blocks(l,m,w),m+=w,f-=w),f){for(var E=0;E<f;E++)this._buffer[this._leftover+E]=l[m+E];this._leftover+=f}return this},u.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var l=new Uint8Array(16);return this.finish(l),l},u.prototype.clean=function(){return e.wipe(this._buffer),e.wipe(this._r),e.wipe(this._h),e.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},u}();r.Poly1305=i;function s(u,l){var m=new i(u);m.update(l);var f=m.digest();return m.clean(),f}r.oneTimeAuth=s;function a(u,l){return u.length!==r.DIGEST_LENGTH||l.length!==r.DIGEST_LENGTH?!1:t.equal(u,l)}r.equal=a})(L1);(function(r){Object.defineProperty(r,"__esModule",{value:!0});var t=nu,e=L1,i=si,s=oe,a=Qn;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var u=new Uint8Array(16),l=function(){function m(f){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,f.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(f)}return m.prototype.seal=function(f,w,E,x){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var I=new Uint8Array(16);I.set(f,I.length-f.length);var N=new Uint8Array(32);t.stream(this._key,I,N,4);var Y=w.length+this.tagLength,G;if(x){if(x.length!==Y)throw new Error("ChaCha20Poly1305: incorrect destination length");G=x}else G=new Uint8Array(Y);return t.streamXOR(this._key,I,w,G,4),this._authenticate(G.subarray(G.length-this.tagLength,G.length),N,G.subarray(0,G.length-this.tagLength),E),i.wipe(I),G},m.prototype.open=function(f,w,E,x){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(w.length<this.tagLength)return null;var I=new Uint8Array(16);I.set(f,I.length-f.length);var N=new Uint8Array(32);t.stream(this._key,I,N,4);var Y=new Uint8Array(this.tagLength);if(this._authenticate(Y,N,w.subarray(0,w.length-this.tagLength),E),!a.equal(Y,w.subarray(w.length-this.tagLength,w.length)))return null;var G=w.length-this.tagLength,tt;if(x){if(x.length!==G)throw new Error("ChaCha20Poly1305: incorrect destination length");tt=x}else tt=new Uint8Array(G);return t.streamXOR(this._key,I,w.subarray(0,w.length-this.tagLength),tt,4),i.wipe(I),tt},m.prototype.clean=function(){return i.wipe(this._key),this},m.prototype._authenticate=function(f,w,E,x){var I=new e.Poly1305(w);x&&(I.update(x),x.length%16>0&&I.update(u.subarray(x.length%16))),I.update(E),E.length%16>0&&I.update(u.subarray(E.length%16));var N=new Uint8Array(8);x&&s.writeUint64LE(x.length,N),I.update(N),s.writeUint64LE(E.length,N),I.update(N);for(var Y=I.digest(),G=0;G<Y.length;G++)f[G]=Y[G];I.clean(),i.wipe(Y),i.wipe(N)},m}();r.ChaCha20Poly1305=l})(ql);var j1={},ha={},jl={};Object.defineProperty(jl,"__esModule",{value:!0});function g_(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}jl.isSerializableHash=g_;Object.defineProperty(ha,"__esModule",{value:!0});var Gi=jl,m_=Qn,v_=si,$1=function(){function r(t,e){this._finished=!1,this._inner=new t,this._outer=new t,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);e.length>this.blockSize?this._inner.update(e).finish(i).clean():i.set(e);for(var s=0;s<i.length;s++)i[s]^=54;this._inner.update(i);for(var s=0;s<i.length;s++)i[s]^=106;this._outer.update(i),Gi.isSerializableHash(this._inner)&&Gi.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),v_.wipe(i)}return r.prototype.reset=function(){if(!Gi.isSerializableHash(this._inner)||!Gi.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.clean=function(){Gi.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Gi.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},r.prototype.update=function(t){return this._inner.update(t),this},r.prototype.finish=function(t){return this._finished?(this._outer.finish(t),this):(this._inner.finish(t),this._outer.update(t.subarray(0,this.digestLength)).finish(t),this._finished=!0,this)},r.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},r.prototype.saveState=function(){if(!Gi.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},r.prototype.restoreState=function(t){if(!Gi.isSerializableHash(this._inner)||!Gi.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(t),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.cleanSavedState=function(t){if(!Gi.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(t)},r}();ha.HMAC=$1;function y_(r,t,e){var i=new $1(r,t);i.update(e);var s=i.digest();return i.clean(),s}ha.hmac=y_;ha.equal=m_.equal;Object.defineProperty(j1,"__esModule",{value:!0});var Sd=ha,Id=si,w_=function(){function r(t,e,i,s){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=t,this._info=s;var a=Sd.hmac(this._hash,i,e);this._hmac=new Sd.HMAC(t,a),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.prototype._fillBuffer=function(){this._counter[0]++;var t=this._counter[0];if(t===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),t>1&&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},r.prototype.expand=function(t){for(var e=new Uint8Array(t),i=0;i<e.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),e[i]=this._buffer[this._bufpos++];return e},r.prototype.clean=function(){this._hmac.clean(),Id.wipe(this._buffer),Id.wipe(this._counter),this._bufpos=0},r}(),b_=j1.HKDF=w_,fo={},su={},ou={};Object.defineProperty(ou,"__esModule",{value:!0});ou.BrowserRandomSource=void 0;const Dd=65536;class __{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const t=typeof self<"u"?self.crypto||self.msCrypto:null;t&&t.getRandomValues!==void 0&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const e=new Uint8Array(t);for(let i=0;i<e.length;i+=Dd)this._crypto.getRandomValues(e.subarray(i,i+Math.min(e.length-i,Dd)));return e}}ou.BrowserRandomSource=__;var au={};Object.defineProperty(au,"__esModule",{value:!0});au.NodeRandomSource=void 0;const E_=si;class A_{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Z3<"u"){const t=t6();t&&t.randomBytes&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let e=this._crypto.randomBytes(t);if(e.length!==t)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(t);for(let s=0;s<i.length;s++)i[s]=e[s];return(0,E_.wipe)(e),i}}au.NodeRandomSource=A_;Object.defineProperty(su,"__esModule",{value:!0});su.SystemRandomSource=void 0;const S_=ou,I_=au;class D_{constructor(){if(this.isAvailable=!1,this.name="",this._source=new S_.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new I_.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(t){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(t)}}su.SystemRandomSource=D_;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const t=su,e=oe,i=si;r.defaultRandomSource=new t.SystemRandomSource;function s(f,w=r.defaultRandomSource){return w.randomBytes(f)}r.randomBytes=s;function a(f=r.defaultRandomSource){const w=s(4,f),E=(0,e.readUint32LE)(w);return(0,i.wipe)(w),E}r.randomUint32=a;const u="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function l(f,w=u,E=r.defaultRandomSource){if(w.length<2)throw new Error("randomString charset is too short");if(w.length>256)throw new Error("randomString charset is too long");let x="";const I=w.length,N=256-256%I;for(;f>0;){const Y=s(Math.ceil(f*256/N),E);for(let G=0;G<Y.length&&f>0;G++){const tt=Y[G];tt<N&&(x+=w.charAt(tt%I),f--)}(0,i.wipe)(Y)}return x}r.randomString=l;function m(f,w=u,E=r.defaultRandomSource){const x=Math.ceil(f/(Math.log(w.length)/Math.LN2));return l(x,w,E)}r.randomStringForEntropy=m})(fo);var cu={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var t=oe,e=si;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var i=function(){function l(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.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 l.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},l.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},l.prototype.clean=function(){e.wipe(this._buffer),e.wipe(this._temp),this.reset()},l.prototype.update=function(m,f){if(f===void 0&&(f=m.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var w=0;if(this._bytesHashed+=f,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&f>0;)this._buffer[this._bufferLength++]=m[w++],f--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(f>=this.blockSize&&(w=a(this._temp,this._state,m,w,f),f%=this.blockSize);f>0;)this._buffer[this._bufferLength++]=m[w++],f--;return this},l.prototype.finish=function(m){if(!this._finished){var f=this._bytesHashed,w=this._bufferLength,E=f/536870912|0,x=f<<3,I=f%64<56?64:128;this._buffer[w]=128;for(var N=w+1;N<I-8;N++)this._buffer[N]=0;t.writeUint32BE(E,this._buffer,I-8),t.writeUint32BE(x,this._buffer,I-4),a(this._temp,this._state,this._buffer,0,I),this._finished=!0}for(var N=0;N<this.digestLength/4;N++)t.writeUint32BE(this._state[N],m,N*4);return this},l.prototype.digest=function(){var m=new Uint8Array(this.digestLength);return this.finish(m),m},l.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},l.prototype.restoreState=function(m){return this._state.set(m.state),this._bufferLength=m.bufferLength,m.buffer&&this._buffer.set(m.buffer),this._bytesHashed=m.bytesHashed,this._finished=!1,this},l.prototype.cleanSavedState=function(m){e.wipe(m.state),m.buffer&&e.wipe(m.buffer),m.bufferLength=0,m.bytesHashed=0},l}();r.SHA256=i;var s=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 a(l,m,f,w,E){for(;E>=64;){for(var x=m[0],I=m[1],N=m[2],Y=m[3],G=m[4],tt=m[5],K=m[6],V=m[7],B=0;B<16;B++){var z=w+B*4;l[B]=t.readUint32BE(f,z)}for(var B=16;B<64;B++){var $=l[B-2],v=($>>>17|$<<32-17)^($>>>19|$<<32-19)^$>>>10;$=l[B-15];var T=($>>>7|$<<32-7)^($>>>18|$<<32-18)^$>>>3;l[B]=(v+l[B-7]|0)+(T+l[B-16]|0)}for(var B=0;B<64;B++){var v=(((G>>>6|G<<26)^(G>>>11|G<<21)^(G>>>25|G<<7))+(G&tt^~G&K)|0)+(V+(s[B]+l[B]|0)|0)|0,T=((x>>>2|x<<32-2)^(x>>>13|x<<32-13)^(x>>>22|x<<32-22))+(x&I^x&N^I&N)|0;V=K,K=tt,tt=G,G=Y+v|0,Y=N,N=I,I=x,x=v+T|0}m[0]+=x,m[1]+=I,m[2]+=N,m[3]+=Y,m[4]+=G,m[5]+=tt,m[6]+=K,m[7]+=V,w+=64,E-=64}return w}function u(l){var m=new i;m.update(l);var f=m.digest();return m.clean(),f}r.hash=u})(cu);var $l={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const t=fo,e=si;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function i(B){const z=new Float64Array(16);if(B)for(let $=0;$<B.length;$++)z[$]=B[$];return z}const s=new Uint8Array(32);s[0]=9;const a=i([56129,1]);function u(B){let z=1;for(let $=0;$<16;$++){let v=B[$]+z+65535;z=Math.floor(v/65536),B[$]=v-z*65536}B[0]+=z-1+37*(z-1)}function l(B,z,$){const v=~($-1);for(let T=0;T<16;T++){const nt=v&(B[T]^z[T]);B[T]^=nt,z[T]^=nt}}function m(B,z){const $=i(),v=i();for(let T=0;T<16;T++)v[T]=z[T];u(v),u(v),u(v);for(let T=0;T<2;T++){$[0]=v[0]-65517;for(let ft=1;ft<15;ft++)$[ft]=v[ft]-65535-($[ft-1]>>16&1),$[ft-1]&=65535;$[15]=v[15]-32767-($[14]>>16&1);const nt=$[15]>>16&1;$[14]&=65535,l(v,$,1-nt)}for(let T=0;T<16;T++)B[2*T]=v[T]&255,B[2*T+1]=v[T]>>8}function f(B,z){for(let $=0;$<16;$++)B[$]=z[2*$]+(z[2*$+1]<<8);B[15]&=32767}function w(B,z,$){for(let v=0;v<16;v++)B[v]=z[v]+$[v]}function E(B,z,$){for(let v=0;v<16;v++)B[v]=z[v]-$[v]}function x(B,z,$){let v,T,nt=0,ft=0,pt=0,mt=0,h=0,y=0,b=0,M=0,C=0,R=0,j=0,S=0,p=0,O=0,it=0,lt=0,_=0,Z=0,U=0,L=0,k=0,d=0,F=0,et=0,ut=0,at=0,Mt=0,Pt=0,It=0,Ee=0,$t=0,xt=$[0],Bt=$[1],_t=$[2],Et=$[3],Vt=$[4],wt=$[5],At=$[6],Ut=$[7],bt=$[8],Ct=$[9],Lt=$[10],Ot=$[11],Nt=$[12],se=$[13],Tt=$[14],Rt=$[15];v=z[0],nt+=v*xt,ft+=v*Bt,pt+=v*_t,mt+=v*Et,h+=v*Vt,y+=v*wt,b+=v*At,M+=v*Ut,C+=v*bt,R+=v*Ct,j+=v*Lt,S+=v*Ot,p+=v*Nt,O+=v*se,it+=v*Tt,lt+=v*Rt,v=z[1],ft+=v*xt,pt+=v*Bt,mt+=v*_t,h+=v*Et,y+=v*Vt,b+=v*wt,M+=v*At,C+=v*Ut,R+=v*bt,j+=v*Ct,S+=v*Lt,p+=v*Ot,O+=v*Nt,it+=v*se,lt+=v*Tt,_+=v*Rt,v=z[2],pt+=v*xt,mt+=v*Bt,h+=v*_t,y+=v*Et,b+=v*Vt,M+=v*wt,C+=v*At,R+=v*Ut,j+=v*bt,S+=v*Ct,p+=v*Lt,O+=v*Ot,it+=v*Nt,lt+=v*se,_+=v*Tt,Z+=v*Rt,v=z[3],mt+=v*xt,h+=v*Bt,y+=v*_t,b+=v*Et,M+=v*Vt,C+=v*wt,R+=v*At,j+=v*Ut,S+=v*bt,p+=v*Ct,O+=v*Lt,it+=v*Ot,lt+=v*Nt,_+=v*se,Z+=v*Tt,U+=v*Rt,v=z[4],h+=v*xt,y+=v*Bt,b+=v*_t,M+=v*Et,C+=v*Vt,R+=v*wt,j+=v*At,S+=v*Ut,p+=v*bt,O+=v*Ct,it+=v*Lt,lt+=v*Ot,_+=v*Nt,Z+=v*se,U+=v*Tt,L+=v*Rt,v=z[5],y+=v*xt,b+=v*Bt,M+=v*_t,C+=v*Et,R+=v*Vt,j+=v*wt,S+=v*At,p+=v*Ut,O+=v*bt,it+=v*Ct,lt+=v*Lt,_+=v*Ot,Z+=v*Nt,U+=v*se,L+=v*Tt,k+=v*Rt,v=z[6],b+=v*xt,M+=v*Bt,C+=v*_t,R+=v*Et,j+=v*Vt,S+=v*wt,p+=v*At,O+=v*Ut,it+=v*bt,lt+=v*Ct,_+=v*Lt,Z+=v*Ot,U+=v*Nt,L+=v*se,k+=v*Tt,d+=v*Rt,v=z[7],M+=v*xt,C+=v*Bt,R+=v*_t,j+=v*Et,S+=v*Vt,p+=v*wt,O+=v*At,it+=v*Ut,lt+=v*bt,_+=v*Ct,Z+=v*Lt,U+=v*Ot,L+=v*Nt,k+=v*se,d+=v*Tt,F+=v*Rt,v=z[8],C+=v*xt,R+=v*Bt,j+=v*_t,S+=v*Et,p+=v*Vt,O+=v*wt,it+=v*At,lt+=v*Ut,_+=v*bt,Z+=v*Ct,U+=v*Lt,L+=v*Ot,k+=v*Nt,d+=v*se,F+=v*Tt,et+=v*Rt,v=z[9],R+=v*xt,j+=v*Bt,S+=v*_t,p+=v*Et,O+=v*Vt,it+=v*wt,lt+=v*At,_+=v*Ut,Z+=v*bt,U+=v*Ct,L+=v*Lt,k+=v*Ot,d+=v*Nt,F+=v*se,et+=v*Tt,ut+=v*Rt,v=z[10],j+=v*xt,S+=v*Bt,p+=v*_t,O+=v*Et,it+=v*Vt,lt+=v*wt,_+=v*At,Z+=v*Ut,U+=v*bt,L+=v*Ct,k+=v*Lt,d+=v*Ot,F+=v*Nt,et+=v*se,ut+=v*Tt,at+=v*Rt,v=z[11],S+=v*xt,p+=v*Bt,O+=v*_t,it+=v*Et,lt+=v*Vt,_+=v*wt,Z+=v*At,U+=v*Ut,L+=v*bt,k+=v*Ct,d+=v*Lt,F+=v*Ot,et+=v*Nt,ut+=v*se,at+=v*Tt,Mt+=v*Rt,v=z[12],p+=v*xt,O+=v*Bt,it+=v*_t,lt+=v*Et,_+=v*Vt,Z+=v*wt,U+=v*At,L+=v*Ut,k+=v*bt,d+=v*Ct,F+=v*Lt,et+=v*Ot,ut+=v*Nt,at+=v*se,Mt+=v*Tt,Pt+=v*Rt,v=z[13],O+=v*xt,it+=v*Bt,lt+=v*_t,_+=v*Et,Z+=v*Vt,U+=v*wt,L+=v*At,k+=v*Ut,d+=v*bt,F+=v*Ct,et+=v*Lt,ut+=v*Ot,at+=v*Nt,Mt+=v*se,Pt+=v*Tt,It+=v*Rt,v=z[14],it+=v*xt,lt+=v*Bt,_+=v*_t,Z+=v*Et,U+=v*Vt,L+=v*wt,k+=v*At,d+=v*Ut,F+=v*bt,et+=v*Ct,ut+=v*Lt,at+=v*Ot,Mt+=v*Nt,Pt+=v*se,It+=v*Tt,Ee+=v*Rt,v=z[15],lt+=v*xt,_+=v*Bt,Z+=v*_t,U+=v*Et,L+=v*Vt,k+=v*wt,d+=v*At,F+=v*Ut,et+=v*bt,ut+=v*Ct,at+=v*Lt,Mt+=v*Ot,Pt+=v*Nt,It+=v*se,Ee+=v*Tt,$t+=v*Rt,nt+=38*_,ft+=38*Z,pt+=38*U,mt+=38*L,h+=38*k,y+=38*d,b+=38*F,M+=38*et,C+=38*ut,R+=38*at,j+=38*Mt,S+=38*Pt,p+=38*It,O+=38*Ee,it+=38*$t,T=1,v=nt+T+65535,T=Math.floor(v/65536),nt=v-T*65536,v=ft+T+65535,T=Math.floor(v/65536),ft=v-T*65536,v=pt+T+65535,T=Math.floor(v/65536),pt=v-T*65536,v=mt+T+65535,T=Math.floor(v/65536),mt=v-T*65536,v=h+T+65535,T=Math.floor(v/65536),h=v-T*65536,v=y+T+65535,T=Math.floor(v/65536),y=v-T*65536,v=b+T+65535,T=Math.floor(v/65536),b=v-T*65536,v=M+T+65535,T=Math.floor(v/65536),M=v-T*65536,v=C+T+65535,T=Math.floor(v/65536),C=v-T*65536,v=R+T+65535,T=Math.floor(v/65536),R=v-T*65536,v=j+T+65535,T=Math.floor(v/65536),j=v-T*65536,v=S+T+65535,T=Math.floor(v/65536),S=v-T*65536,v=p+T+65535,T=Math.floor(v/65536),p=v-T*65536,v=O+T+65535,T=Math.floor(v/65536),O=v-T*65536,v=it+T+65535,T=Math.floor(v/65536),it=v-T*65536,v=lt+T+65535,T=Math.floor(v/65536),lt=v-T*65536,nt+=T-1+37*(T-1),T=1,v=nt+T+65535,T=Math.floor(v/65536),nt=v-T*65536,v=ft+T+65535,T=Math.floor(v/65536),ft=v-T*65536,v=pt+T+65535,T=Math.floor(v/65536),pt=v-T*65536,v=mt+T+65535,T=Math.floor(v/65536),mt=v-T*65536,v=h+T+65535,T=Math.floor(v/65536),h=v-T*65536,v=y+T+65535,T=Math.floor(v/65536),y=v-T*65536,v=b+T+65535,T=Math.floor(v/65536),b=v-T*65536,v=M+T+65535,T=Math.floor(v/65536),M=v-T*65536,v=C+T+65535,T=Math.floor(v/65536),C=v-T*65536,v=R+T+65535,T=Math.floor(v/65536),R=v-T*65536,v=j+T+65535,T=Math.floor(v/65536),j=v-T*65536,v=S+T+65535,T=Math.floor(v/65536),S=v-T*65536,v=p+T+65535,T=Math.floor(v/65536),p=v-T*65536,v=O+T+65535,T=Math.floor(v/65536),O=v-T*65536,v=it+T+65535,T=Math.floor(v/65536),it=v-T*65536,v=lt+T+65535,T=Math.floor(v/65536),lt=v-T*65536,nt+=T-1+37*(T-1),B[0]=nt,B[1]=ft,B[2]=pt,B[3]=mt,B[4]=h,B[5]=y,B[6]=b,B[7]=M,B[8]=C,B[9]=R,B[10]=j,B[11]=S,B[12]=p,B[13]=O,B[14]=it,B[15]=lt}function I(B,z){x(B,z,z)}function N(B,z){const $=i();for(let v=0;v<16;v++)$[v]=z[v];for(let v=253;v>=0;v--)I($,$),v!==2&&v!==4&&x($,$,z);for(let v=0;v<16;v++)B[v]=$[v]}function Y(B,z){const $=new Uint8Array(32),v=new Float64Array(80),T=i(),nt=i(),ft=i(),pt=i(),mt=i(),h=i();for(let C=0;C<31;C++)$[C]=B[C];$[31]=B[31]&127|64,$[0]&=248,f(v,z);for(let C=0;C<16;C++)nt[C]=v[C];T[0]=pt[0]=1;for(let C=254;C>=0;--C){const R=$[C>>>3]>>>(C&7)&1;l(T,nt,R),l(ft,pt,R),w(mt,T,ft),E(T,T,ft),w(ft,nt,pt),E(nt,nt,pt),I(pt,mt),I(h,T),x(T,ft,T),x(ft,nt,mt),w(mt,T,ft),E(T,T,ft),I(nt,T),E(ft,pt,h),x(T,ft,a),w(T,T,pt),x(ft,ft,T),x(T,pt,h),x(pt,nt,v),I(nt,mt),l(T,nt,R),l(ft,pt,R)}for(let C=0;C<16;C++)v[C+16]=T[C],v[C+32]=ft[C],v[C+48]=nt[C],v[C+64]=pt[C];const y=v.subarray(32),b=v.subarray(16);N(y,y),x(b,b,y);const M=new Uint8Array(32);return m(M,b),M}r.scalarMult=Y;function G(B){return Y(B,s)}r.scalarMultBase=G;function tt(B){if(B.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const z=new Uint8Array(B);return{publicKey:G(z),secretKey:z}}r.generateKeyPairFromSeed=tt;function K(B){const z=(0,t.randomBytes)(32,B),$=tt(z);return(0,e.wipe)(z),$}r.generateKeyPair=K;function V(B,z,$=!1){if(B.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(z.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const v=Y(B,z);if($){let T=0;for(let nt=0;nt<v.length;nt++)T|=v[nt];if(T===0)throw new Error("X25519: invalid shared key")}return v}r.sharedKey=V})($l);function z1(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function gl(r,t){t||(t=r.reduce((s,a)=>s+a.length,0));const e=z1(t);let i=0;for(const s of r)e.set(s,i),i+=s.length;return e}function x_(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),i=0;i<e.length;i++)e[i]=255;for(var s=0;s<r.length;s++){var a=r.charAt(s),u=a.charCodeAt(0);if(e[u]!==255)throw new TypeError(a+" is ambiguous");e[u]=s}var l=r.length,m=r.charAt(0),f=Math.log(l)/Math.log(256),w=Math.log(256)/Math.log(l);function E(N){if(N instanceof Uint8Array||(ArrayBuffer.isView(N)?N=new Uint8Array(N.buffer,N.byteOffset,N.byteLength):Array.isArray(N)&&(N=Uint8Array.from(N))),!(N instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(N.length===0)return"";for(var Y=0,G=0,tt=0,K=N.length;tt!==K&&N[tt]===0;)tt++,Y++;for(var V=(K-tt)*w+1>>>0,B=new Uint8Array(V);tt!==K;){for(var z=N[tt],$=0,v=V-1;(z!==0||$<G)&&v!==-1;v--,$++)z+=256*B[v]>>>0,B[v]=z%l>>>0,z=z/l>>>0;if(z!==0)throw new Error("Non-zero carry");G=$,tt++}for(var T=V-G;T!==V&&B[T]===0;)T++;for(var nt=m.repeat(Y);T<V;++T)nt+=r.charAt(B[T]);return nt}function x(N){if(typeof N!="string")throw new TypeError("Expected String");if(N.length===0)return new Uint8Array;var Y=0;if(N[Y]!==" "){for(var G=0,tt=0;N[Y]===m;)G++,Y++;for(var K=(N.length-Y)*f+1>>>0,V=new Uint8Array(K);N[Y];){var B=e[N.charCodeAt(Y)];if(B===255)return;for(var z=0,$=K-1;(B!==0||z<tt)&&$!==-1;$--,z++)B+=l*V[$]>>>0,V[$]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");tt=z,Y++}if(N[Y]!==" "){for(var v=K-tt;v!==K&&V[v]===0;)v++;for(var T=new Uint8Array(G+(K-v)),nt=G;v!==K;)T[nt++]=V[v++];return T}}}function I(N){var Y=x(N);if(Y)return Y;throw new Error(`Non-${t} character`)}return{encode:E,decodeUnsafe:x,decode:I}}var M_=x_,C_=M_;const P_=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},O_=r=>new TextEncoder().encode(r),N_=r=>new TextDecoder().decode(r);class R_{constructor(t,e,i){this.name=t,this.prefix=e,this.baseEncode=i}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class T_{constructor(t,e,i){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=i}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return k1(this,t)}}class F_{constructor(t){this.decoders=t}or(t){return k1(this,t)}decode(t){const e=t[0],i=this.decoders[e];if(i)return i.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const k1=(r,t)=>new F_({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}});class U_{constructor(t,e,i,s){this.name=t,this.prefix=e,this.baseEncode=i,this.baseDecode=s,this.encoder=new R_(t,e,i),this.decoder=new T_(t,e,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const uu=({name:r,prefix:t,encode:e,decode:i})=>new U_(r,t,e,i),la=({prefix:r,name:t,alphabet:e})=>{const{encode:i,decode:s}=C_(e,t);return uu({prefix:r,name:t,encode:i,decode:a=>P_(s(a))})},B_=(r,t,e,i)=>{const s={};for(let w=0;w<t.length;++w)s[t[w]]=w;let a=r.length;for(;r[a-1]==="=";)--a;const u=new Uint8Array(a*e/8|0);let l=0,m=0,f=0;for(let w=0;w<a;++w){const E=s[r[w]];if(E===void 0)throw new SyntaxError(`Non-${i} character`);m=m<<e|E,l+=e,l>=8&&(l-=8,u[f++]=255&m>>l)}if(l>=e||255&m<<8-l)throw new SyntaxError("Unexpected end of data");return u},L_=(r,t,e)=>{const i=t[t.length-1]==="=",s=(1<<e)-1;let a="",u=0,l=0;for(let m=0;m<r.length;++m)for(l=l<<8|r[m],u+=8;u>e;)u-=e,a+=t[s&l>>u];if(u&&(a+=t[s&l<<e-u]),i)for(;a.length*e&7;)a+="=";return a},vr=({name:r,prefix:t,bitsPerChar:e,alphabet:i})=>uu({prefix:t,name:r,encode(s){return L_(s,i,e)},decode(s){return B_(s,i,e,r)}}),q_=uu({prefix:"\0",name:"identity",encode:r=>N_(r),decode:r=>O_(r)}),j_=Object.freeze(Object.defineProperty({__proto__:null,identity:q_},Symbol.toStringTag,{value:"Module"})),$_=vr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),z_=Object.freeze(Object.defineProperty({__proto__:null,base2:$_},Symbol.toStringTag,{value:"Module"})),k_=vr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),H_=Object.freeze(Object.defineProperty({__proto__:null,base8:k_},Symbol.toStringTag,{value:"Module"})),K_=la({prefix:"9",name:"base10",alphabet:"0123456789"}),V_=Object.freeze(Object.defineProperty({__proto__:null,base10:K_},Symbol.toStringTag,{value:"Module"})),G_=vr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),W_=vr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Y_=Object.freeze(Object.defineProperty({__proto__:null,base16:G_,base16upper:W_},Symbol.toStringTag,{value:"Module"})),Q_=vr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),J_=vr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),X_=vr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Z_=vr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),tE=vr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),eE=vr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),rE=vr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),iE=vr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),nE=vr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),sE=Object.freeze(Object.defineProperty({__proto__:null,base32:Q_,base32hex:tE,base32hexpad:rE,base32hexpadupper:iE,base32hexupper:eE,base32pad:X_,base32padupper:Z_,base32upper:J_,base32z:nE},Symbol.toStringTag,{value:"Module"})),oE=la({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),aE=la({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),cE=Object.freeze(Object.defineProperty({__proto__:null,base36:oE,base36upper:aE},Symbol.toStringTag,{value:"Module"})),uE=la({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),hE=la({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),lE=Object.freeze(Object.defineProperty({__proto__:null,base58btc:uE,base58flickr:hE},Symbol.toStringTag,{value:"Module"})),fE=vr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),dE=vr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),pE=vr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),gE=vr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),mE=Object.freeze(Object.defineProperty({__proto__:null,base64:fE,base64pad:dE,base64url:pE,base64urlpad:gE},Symbol.toStringTag,{value:"Module"})),H1=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),vE=H1.reduce((r,t,e)=>(r[e]=t,r),[]),yE=H1.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function wE(r){return r.reduce((t,e)=>(t+=vE[e],t),"")}function bE(r){const t=[];for(const e of r){const i=yE[e.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(i)}return new Uint8Array(t)}const _E=uu({prefix:"🚀",name:"base256emoji",encode:wE,decode:bE}),EE=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:_E},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const xd={...j_,...z_,...H_,...V_,...Y_,...sE,...cE,...lE,...mE,...EE};function K1(r,t,e,i){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:i}}}const Md=K1("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Oh=K1("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);const t=z1(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),V1={utf8:Md,"utf-8":Md,hex:xd.base16,latin1:Oh,ascii:Oh,binary:Oh,...xd};function Kr(r,t="utf8"){const e=V1[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):e.decoder.decode(`${e.prefix}${r}`)}function Tr(r,t="utf8"){const e=V1[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):e.encoder.encode(r).substring(1)}const AE={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},SE=":";function Tc(r){const[t,e]=r.split(SE);return{namespace:t,reference:e}}function Cd(r,t=[]){const e=[];return Object.keys(r).forEach(i=>{if(t.length&&!t.includes(i))return;const s=r[i];e.push(...s.accounts)}),e}function G1(r,t){return r.includes(":")?[r]:t.chains||[]}var IE=Object.defineProperty,Pd=Object.getOwnPropertySymbols,DE=Object.prototype.hasOwnProperty,xE=Object.prototype.propertyIsEnumerable,Od=(r,t,e)=>t in r?IE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Nd=(r,t)=>{for(var e in t||(t={}))DE.call(t,e)&&Od(r,e,t[e]);if(Pd)for(var e of Pd(t))xE.call(t,e)&&Od(r,e,t[e]);return r};const ME="ReactNative",ei={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},CE="js";function ra(){return typeof ri<"u"&&typeof ri.versions<"u"&&typeof ri.versions.node<"u"}function po(){return!Ul()&&!!Bl()&&navigator.product===ME}function go(){return!ra()&&!!Bl()&&!!Ul()}function fa(){return po()?ei.reactNative:ra()?ei.node:go()?ei.browser:ei.unknown}function PE(){var r;try{return po()&&typeof Ie<"u"&&typeof(Ie==null?void 0:Ie.Application)<"u"?(r=Ie.Application)==null?void 0:r.applicationId:void 0}catch{return}}function OE(r,t){let e=ea.parse(r);return e=Nd(Nd({},e),t),r=ea.stringify(e),r}function NE(){return C1()||{name:"",description:"",url:"",icons:[""]}}function RE(){if(fa()===ei.reactNative&&typeof Ie<"u"&&typeof(Ie==null?void 0:Ie.Platform)<"u"){const{OS:e,Version:i}=Ie.Platform;return[e,i].join("-")}const r=l6();if(r===null)return"unknown";const t=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[t,r.name,r.version].join("-"):[t,r.version].join("-")}function TE(){var r;const t=fa();return t===ei.browser?[t,((r=M1())==null?void 0:r.host)||"unknown"].join(":"):t}function FE(r,t,e){const i=RE(),s=TE();return[[r,t].join("-"),[CE,e].join("-"),i,s].join("/")}function UE({protocol:r,version:t,relayUrl:e,sdkVersion:i,auth:s,projectId:a,useOnCloseEvent:u,bundleId:l}){const m=e.split("?"),f=FE(r,t,i),w={auth:s,ua:f,projectId:a,useOnCloseEvent:u||void 0,origin:l||void 0},E=OE(m[1]||"",w);return m[0]+"?"+E}function Es(r,t){return r.filter(e=>t.includes(e)).length===r.length}function W1(r){return Object.fromEntries(r.entries())}function Y1(r){return new Map(Object.entries(r))}function _s(r=yt.FIVE_MINUTES,t){const e=yt.toMiliseconds(r||yt.FIVE_MINUTES);let i,s,a;return{resolve:u=>{a&&i&&(clearTimeout(a),i(u))},reject:u=>{a&&s&&(clearTimeout(a),s(u))},done:()=>new Promise((u,l)=>{a=setTimeout(()=>{l(new Error(t))},e),i=u,s=l})}}function so(r,t,e){return new Promise(async(i,s)=>{const a=setTimeout(()=>s(new Error(e)),t);try{const u=await r;i(u)}catch(u){s(u)}clearTimeout(a)})}function Q1(r,t){if(typeof t=="string"&&t.startsWith(`${r}:`))return t;if(r.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(r.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${r}`)}function BE(r){return Q1("topic",r)}function LE(r){return Q1("id",r)}function J1(r){const[t,e]=r.split(":"),i={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")i.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))i.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return i}function gr(r,t){return yt.fromMiliseconds((t||Date.now())+yt.toMiliseconds(r))}function Hn(r){return Date.now()>=yt.toMiliseconds(r)}function de(r,t){return`${r}${t?`:${t}`:""}`}function Fc(r=[],t=[]){return[...new Set([...r,...t])]}async function qE({id:r,topic:t,wcDeepLink:e}){try{if(!e)return;const i=typeof e=="string"?JSON.parse(e):e;let s=i==null?void 0:i.href;if(typeof s!="string")return;s.endsWith("/")&&(s=s.slice(0,-1));const a=`${s}/wc?requestId=${r}&sessionTopic=${t}`,u=fa();u===ei.browser?a.startsWith("https://")||a.startsWith("http://")?window.open(a,"_blank","noreferrer noopener"):window.open(a,"_self","noreferrer noopener"):u===ei.reactNative&&typeof(Ie==null?void 0:Ie.Linking)<"u"&&await Ie.Linking.openURL(a)}catch(i){console.error(i)}}async function jE(r,t){try{return await r.getItem(t)||(go()?localStorage.getItem(t):void 0)}catch(e){console.error(e)}}var X1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ie<"u"?Ie:typeof self<"u"?self:{};function $E(r){var t=r.default;if(typeof t=="function"){var e=function(){return t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),e}var Z1={exports:{}};/**
|
|
1
|
+
import{p as ri,b as D1,d as Z3,r as t6,g as Ie,B as ca,e as Di,a as Tl,c as Zi,f as Fl,o as ad,_ as e6}from"./index-8a109c4c.js";import{t as r6}from"./tslib.es6-c2094241.js";var cd=globalThis&&globalThis.__spreadArray||function(r,t,e){if(e||arguments.length===2)for(var i=0,s=t.length,a;i<s;i++)(a||!(i in t))&&(a||(a=Array.prototype.slice.call(t,0,i)),a[i]=t[i]);return r.concat(a||Array.prototype.slice.call(t))},i6=function(){function r(t,e,i){this.name=t,this.version=e,this.os=i,this.type="browser"}return r}(),n6=function(){function r(t){this.version=t,this.type="node",this.name="node",this.os=ri.platform}return r}(),s6=function(){function r(t,e,i,s){this.name=t,this.version=e,this.os=i,this.bot=s,this.type="bot-device"}return r}(),o6=function(){function r(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return r}(),a6=function(){function r(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return r}(),c6=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,u6=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,ud=3,h6=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",c6]],hd=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function l6(r){return r?ld(r):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new a6:typeof navigator<"u"?ld(navigator.userAgent):p6()}function f6(r){return r!==""&&h6.reduce(function(t,e){var i=e[0],s=e[1];if(t)return t;var a=s.exec(r);return!!a&&[i,a]},!1)}function ld(r){var t=f6(r);if(!t)return null;var e=t[0],i=t[1];if(e==="searchbot")return new o6;var s=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);s?s.length<ud&&(s=cd(cd([],s,!0),g6(ud-s.length),!0)):s=[];var a=s.join("."),u=d6(r),l=u6.exec(r);return l&&l[1]?new s6(e,a,u,l[1]):new i6(e,a,u)}function d6(r){for(var t=0,e=hd.length;t<e;t++){var i=hd[t],s=i[0],a=i[1],u=a.exec(r);if(u)return s}return null}function p6(){var r=typeof ri<"u"&&ri.version;return r?new n6(ri.version.slice(1)):null}function g6(r){for(var t=[],e=0;e<r;e++)t.push("0");return t}var yt={};const ua=D1(r6);var xh={},jo={},fd;function m6(){if(fd)return jo;fd=1,Object.defineProperty(jo,"__esModule",{value:!0}),jo.delay=void 0;function r(t){return new Promise(e=>{setTimeout(()=>{e(!0)},t)})}return jo.delay=r,jo}var ys={},Mh={},ws={},dd;function v6(){return dd||(dd=1,Object.defineProperty(ws,"__esModule",{value:!0}),ws.ONE_THOUSAND=ws.ONE_HUNDRED=void 0,ws.ONE_HUNDRED=100,ws.ONE_THOUSAND=1e3),ws}var Ch={},pd;function y6(){return pd||(pd=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ONE_YEAR=r.FOUR_WEEKS=r.THREE_WEEKS=r.TWO_WEEKS=r.ONE_WEEK=r.THIRTY_DAYS=r.SEVEN_DAYS=r.FIVE_DAYS=r.THREE_DAYS=r.ONE_DAY=r.TWENTY_FOUR_HOURS=r.TWELVE_HOURS=r.SIX_HOURS=r.THREE_HOURS=r.ONE_HOUR=r.SIXTY_MINUTES=r.THIRTY_MINUTES=r.TEN_MINUTES=r.FIVE_MINUTES=r.ONE_MINUTE=r.SIXTY_SECONDS=r.THIRTY_SECONDS=r.TEN_SECONDS=r.FIVE_SECONDS=r.ONE_SECOND=void 0,r.ONE_SECOND=1,r.FIVE_SECONDS=5,r.TEN_SECONDS=10,r.THIRTY_SECONDS=30,r.SIXTY_SECONDS=60,r.ONE_MINUTE=r.SIXTY_SECONDS,r.FIVE_MINUTES=r.ONE_MINUTE*5,r.TEN_MINUTES=r.ONE_MINUTE*10,r.THIRTY_MINUTES=r.ONE_MINUTE*30,r.SIXTY_MINUTES=r.ONE_MINUTE*60,r.ONE_HOUR=r.SIXTY_MINUTES,r.THREE_HOURS=r.ONE_HOUR*3,r.SIX_HOURS=r.ONE_HOUR*6,r.TWELVE_HOURS=r.ONE_HOUR*12,r.TWENTY_FOUR_HOURS=r.ONE_HOUR*24,r.ONE_DAY=r.TWENTY_FOUR_HOURS,r.THREE_DAYS=r.ONE_DAY*3,r.FIVE_DAYS=r.ONE_DAY*5,r.SEVEN_DAYS=r.ONE_DAY*7,r.THIRTY_DAYS=r.ONE_DAY*30,r.ONE_WEEK=r.SEVEN_DAYS,r.TWO_WEEKS=r.ONE_WEEK*2,r.THREE_WEEKS=r.ONE_WEEK*3,r.FOUR_WEEKS=r.ONE_WEEK*4,r.ONE_YEAR=r.ONE_DAY*365}(Ch)),Ch}var gd;function x1(){return gd||(gd=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=ua;t.__exportStar(v6(),r),t.__exportStar(y6(),r)}(Mh)),Mh}var md;function w6(){if(md)return ys;md=1,Object.defineProperty(ys,"__esModule",{value:!0}),ys.fromMiliseconds=ys.toMiliseconds=void 0;const r=x1();function t(i){return i*r.ONE_THOUSAND}ys.toMiliseconds=t;function e(i){return Math.floor(i/r.ONE_THOUSAND)}return ys.fromMiliseconds=e,ys}var vd;function b6(){return vd||(vd=1,function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=ua;t.__exportStar(m6(),r),t.__exportStar(w6(),r)}(xh)),xh}var Qs={},yd;function _6(){if(yd)return Qs;yd=1,Object.defineProperty(Qs,"__esModule",{value:!0}),Qs.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw new Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){const i=this.get(e);if(typeof i.elapsed<"u")throw new Error(`Watch already stopped for label: ${e}`);const s=Date.now()-i.started;this.timestamps.set(e,{started:i.started,elapsed:s})}get(e){const i=this.timestamps.get(e);if(typeof i>"u")throw new Error(`No timestamp found for label: ${e}`);return i}elapsed(e){const i=this.get(e);return i.elapsed||Date.now()-i.started}}return Qs.Watch=r,Qs.default=r,Qs}var Ph={},$o={},wd;function E6(){if(wd)return $o;wd=1,Object.defineProperty($o,"__esModule",{value:!0}),$o.IWatch=void 0;class r{}return $o.IWatch=r,$o}var bd;function A6(){return bd||(bd=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),ua.__exportStar(E6(),r)}(Ph)),Ph}(function(r){Object.defineProperty(r,"__esModule",{value:!0});const t=ua;t.__exportStar(b6(),r),t.__exportStar(_6(),r),t.__exportStar(A6(),r),t.__exportStar(x1(),r)})(yt);var je={};Object.defineProperty(je,"__esModule",{value:!0});je.getLocalStorage=je.getLocalStorageOrThrow=je.getCrypto=je.getCryptoOrThrow=M1=je.getLocation=je.getLocationOrThrow=Bl=je.getNavigator=je.getNavigatorOrThrow=Ul=je.getDocument=je.getDocumentOrThrow=je.getFromWindowOrThrow=je.getFromWindow=void 0;function xs(r){let t;return typeof window<"u"&&typeof window[r]<"u"&&(t=window[r]),t}je.getFromWindow=xs;function lo(r){const t=xs(r);if(!t)throw new Error(`${r} is not defined in Window`);return t}je.getFromWindowOrThrow=lo;function S6(){return lo("document")}je.getDocumentOrThrow=S6;function I6(){return xs("document")}var Ul=je.getDocument=I6;function D6(){return lo("navigator")}je.getNavigatorOrThrow=D6;function x6(){return xs("navigator")}var Bl=je.getNavigator=x6;function M6(){return lo("location")}je.getLocationOrThrow=M6;function C6(){return xs("location")}var M1=je.getLocation=C6;function P6(){return lo("crypto")}je.getCryptoOrThrow=P6;function O6(){return xs("crypto")}je.getCrypto=O6;function N6(){return lo("localStorage")}je.getLocalStorageOrThrow=N6;function R6(){return xs("localStorage")}je.getLocalStorage=R6;var Ll={};Object.defineProperty(Ll,"__esModule",{value:!0});var C1=Ll.getWindowMetadata=void 0;const _d=je;function T6(){let r,t;try{r=_d.getDocumentOrThrow(),t=_d.getLocationOrThrow()}catch{return null}function e(){const E=r.getElementsByTagName("link"),x=[];for(let I=0;I<E.length;I++){const N=E[I],Y=N.getAttribute("rel");if(Y&&Y.toLowerCase().indexOf("icon")>-1){const G=N.getAttribute("href");if(G)if(G.toLowerCase().indexOf("https:")===-1&&G.toLowerCase().indexOf("http:")===-1&&G.indexOf("//")!==0){let tt=t.protocol+"//"+t.host;if(G.indexOf("/")===0)tt+=G;else{const K=t.pathname.split("/");K.pop();const V=K.join("/");tt+=V+"/"+G}x.push(tt)}else if(G.indexOf("//")===0){const tt=t.protocol+G;x.push(tt)}else x.push(G)}}return x}function i(...E){const x=r.getElementsByTagName("meta");for(let I=0;I<x.length;I++){const N=x[I],Y=["itemprop","property","name"].map(G=>N.getAttribute(G)).filter(G=>G?E.includes(G):!1);if(Y.length&&Y){const G=N.getAttribute("content");if(G)return G}}return""}function s(){let E=i("name","og:site_name","og:title","twitter:title");return E||(E=r.title),E}function a(){return i("description","og:description","twitter:description","keywords")}const u=s(),l=a(),m=t.origin,f=e();return{description:l,url:m,icons:f,name:u}}C1=Ll.getWindowMetadata=T6;var ea={},F6=r=>encodeURIComponent(r).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),P1="%[a-f0-9]{2}",Ed=new RegExp("("+P1+")|([^%]+?)","gi"),Ad=new RegExp("("+P1+")+","gi");function ul(r,t){try{return[decodeURIComponent(r.join(""))]}catch{}if(r.length===1)return r;t=t||1;var e=r.slice(0,t),i=r.slice(t);return Array.prototype.concat.call([],ul(e),ul(i))}function U6(r){try{return decodeURIComponent(r)}catch{for(var t=r.match(Ed)||[],e=1;e<t.length;e++)r=ul(t,e).join(""),t=r.match(Ed)||[];return r}}function B6(r){for(var t={"%FE%FF":"��","%FF%FE":"��"},e=Ad.exec(r);e;){try{t[e[0]]=decodeURIComponent(e[0])}catch{var i=U6(e[0]);i!==e[0]&&(t[e[0]]=i)}e=Ad.exec(r)}t["%C2"]="�";for(var s=Object.keys(t),a=0;a<s.length;a++){var u=s[a];r=r.replace(new RegExp(u,"g"),t[u])}return r}var L6=function(r){if(typeof r!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof r+"`");try{return r=r.replace(/\+/g," "),decodeURIComponent(r)}catch{return B6(r)}},q6=(r,t)=>{if(!(typeof r=="string"&&typeof t=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(t==="")return[r];const e=r.indexOf(t);return e===-1?[r]:[r.slice(0,e),r.slice(e+t.length)]},j6=function(r,t){for(var e={},i=Object.keys(r),s=Array.isArray(t),a=0;a<i.length;a++){var u=i[a],l=r[u];(s?t.indexOf(u)!==-1:t(u,l,r))&&(e[u]=l)}return e};(function(r){const t=F6,e=L6,i=q6,s=j6,a=K=>K==null,u=Symbol("encodeFragmentIdentifier");function l(K){switch(K.arrayFormat){case"index":return V=>(B,z)=>{const $=B.length;return z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,[w(V,K),"[",$,"]"].join("")]:[...B,[w(V,K),"[",w($,K),"]=",w(z,K)].join("")]};case"bracket":return V=>(B,z)=>z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,[w(V,K),"[]"].join("")]:[...B,[w(V,K),"[]=",w(z,K)].join("")];case"colon-list-separator":return V=>(B,z)=>z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,[w(V,K),":list="].join("")]:[...B,[w(V,K),":list=",w(z,K)].join("")];case"comma":case"separator":case"bracket-separator":{const V=K.arrayFormat==="bracket-separator"?"[]=":"=";return B=>(z,$)=>$===void 0||K.skipNull&&$===null||K.skipEmptyString&&$===""?z:($=$===null?"":$,z.length===0?[[w(B,K),V,w($,K)].join("")]:[[z,w($,K)].join(K.arrayFormatSeparator)])}default:return V=>(B,z)=>z===void 0||K.skipNull&&z===null||K.skipEmptyString&&z===""?B:z===null?[...B,w(V,K)]:[...B,[w(V,K),"=",w(z,K)].join("")]}}function m(K){let V;switch(K.arrayFormat){case"index":return(B,z,$)=>{if(V=/\[(\d*)\]$/.exec(B),B=B.replace(/\[\d*\]$/,""),!V){$[B]=z;return}$[B]===void 0&&($[B]={}),$[B][V[1]]=z};case"bracket":return(B,z,$)=>{if(V=/(\[\])$/.exec(B),B=B.replace(/\[\]$/,""),!V){$[B]=z;return}if($[B]===void 0){$[B]=[z];return}$[B]=[].concat($[B],z)};case"colon-list-separator":return(B,z,$)=>{if(V=/(:list)$/.exec(B),B=B.replace(/:list$/,""),!V){$[B]=z;return}if($[B]===void 0){$[B]=[z];return}$[B]=[].concat($[B],z)};case"comma":case"separator":return(B,z,$)=>{const v=typeof z=="string"&&z.includes(K.arrayFormatSeparator),T=typeof z=="string"&&!v&&E(z,K).includes(K.arrayFormatSeparator);z=T?E(z,K):z;const nt=v||T?z.split(K.arrayFormatSeparator).map(ft=>E(ft,K)):z===null?z:E(z,K);$[B]=nt};case"bracket-separator":return(B,z,$)=>{const v=/(\[\])$/.test(B);if(B=B.replace(/\[\]$/,""),!v){$[B]=z&&E(z,K);return}const T=z===null?[]:z.split(K.arrayFormatSeparator).map(nt=>E(nt,K));if($[B]===void 0){$[B]=T;return}$[B]=[].concat($[B],T)};default:return(B,z,$)=>{if($[B]===void 0){$[B]=z;return}$[B]=[].concat($[B],z)}}}function f(K){if(typeof K!="string"||K.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function w(K,V){return V.encode?V.strict?t(K):encodeURIComponent(K):K}function E(K,V){return V.decode?e(K):K}function x(K){return Array.isArray(K)?K.sort():typeof K=="object"?x(Object.keys(K)).sort((V,B)=>Number(V)-Number(B)).map(V=>K[V]):K}function I(K){const V=K.indexOf("#");return V!==-1&&(K=K.slice(0,V)),K}function N(K){let V="";const B=K.indexOf("#");return B!==-1&&(V=K.slice(B)),V}function Y(K){K=I(K);const V=K.indexOf("?");return V===-1?"":K.slice(V+1)}function G(K,V){return V.parseNumbers&&!Number.isNaN(Number(K))&&typeof K=="string"&&K.trim()!==""?K=Number(K):V.parseBooleans&&K!==null&&(K.toLowerCase()==="true"||K.toLowerCase()==="false")&&(K=K.toLowerCase()==="true"),K}function tt(K,V){V=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},V),f(V.arrayFormatSeparator);const B=m(V),z=Object.create(null);if(typeof K!="string"||(K=K.trim().replace(/^[?#&]/,""),!K))return z;for(const $ of K.split("&")){if($==="")continue;let[v,T]=i(V.decode?$.replace(/\+/g," "):$,"=");T=T===void 0?null:["comma","separator","bracket-separator"].includes(V.arrayFormat)?T:E(T,V),B(E(v,V),T,z)}for(const $ of Object.keys(z)){const v=z[$];if(typeof v=="object"&&v!==null)for(const T of Object.keys(v))v[T]=G(v[T],V);else z[$]=G(v,V)}return V.sort===!1?z:(V.sort===!0?Object.keys(z).sort():Object.keys(z).sort(V.sort)).reduce(($,v)=>{const T=z[v];return T&&typeof T=="object"&&!Array.isArray(T)?$[v]=x(T):$[v]=T,$},Object.create(null))}r.extract=Y,r.parse=tt,r.stringify=(K,V)=>{if(!K)return"";V=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},V),f(V.arrayFormatSeparator);const B=T=>V.skipNull&&a(K[T])||V.skipEmptyString&&K[T]==="",z=l(V),$={};for(const T of Object.keys(K))B(T)||($[T]=K[T]);const v=Object.keys($);return V.sort!==!1&&v.sort(V.sort),v.map(T=>{const nt=K[T];return nt===void 0?"":nt===null?w(T,V):Array.isArray(nt)?nt.length===0&&V.arrayFormat==="bracket-separator"?w(T,V)+"[]":nt.reduce(z(T),[]).join("&"):w(T,V)+"="+w(nt,V)}).filter(T=>T.length>0).join("&")},r.parseUrl=(K,V)=>{V=Object.assign({decode:!0},V);const[B,z]=i(K,"#");return Object.assign({url:B.split("?")[0]||"",query:tt(Y(K),V)},V&&V.parseFragmentIdentifier&&z?{fragmentIdentifier:E(z,V)}:{})},r.stringifyUrl=(K,V)=>{V=Object.assign({encode:!0,strict:!0,[u]:!0},V);const B=I(K.url).split("?")[0]||"",z=r.extract(K.url),$=r.parse(z,{sort:!1}),v=Object.assign($,K.query);let T=r.stringify(v,V);T&&(T=`?${T}`);let nt=N(K.url);return K.fragmentIdentifier&&(nt=`#${V[u]?w(K.fragmentIdentifier,V):K.fragmentIdentifier}`),`${B}${T}${nt}`},r.pick=(K,V,B)=>{B=Object.assign({parseFragmentIdentifier:!0,[u]:!1},B);const{url:z,query:$,fragmentIdentifier:v}=r.parseUrl(K,B);return r.stringifyUrl({url:z,query:s($,V),fragmentIdentifier:v},B)},r.exclude=(K,V,B)=>{const z=Array.isArray(V)?$=>!V.includes($):($,v)=>!V($,v);return r.pick(K,z,B)}})(ea);var ql={},nu={},oe={},O1={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});function t(l,m){var f=l>>>16&65535,w=l&65535,E=m>>>16&65535,x=m&65535;return w*x+(f*x+w*E<<16>>>0)|0}r.mul=Math.imul||t;function e(l,m){return l+m|0}r.add=e;function i(l,m){return l-m|0}r.sub=i;function s(l,m){return l<<m|l>>>32-m}r.rotl=s;function a(l,m){return l<<32-m|l>>>m}r.rotr=a;function u(l){return typeof l=="number"&&isFinite(l)&&Math.floor(l)===l}r.isInteger=Number.isInteger||u,r.MAX_SAFE_INTEGER=9007199254740991,r.isSafeInteger=function(l){return r.isInteger(l)&&l>=-r.MAX_SAFE_INTEGER&&l<=r.MAX_SAFE_INTEGER}})(O1);Object.defineProperty(oe,"__esModule",{value:!0});var N1=O1;function $6(r,t){return t===void 0&&(t=0),(r[t+0]<<8|r[t+1])<<16>>16}oe.readInt16BE=$6;function z6(r,t){return t===void 0&&(t=0),(r[t+0]<<8|r[t+1])>>>0}oe.readUint16BE=z6;function k6(r,t){return t===void 0&&(t=0),(r[t+1]<<8|r[t])<<16>>16}oe.readInt16LE=k6;function H6(r,t){return t===void 0&&(t=0),(r[t+1]<<8|r[t])>>>0}oe.readUint16LE=H6;function R1(r,t,e){return t===void 0&&(t=new Uint8Array(2)),e===void 0&&(e=0),t[e+0]=r>>>8,t[e+1]=r>>>0,t}oe.writeUint16BE=R1;oe.writeInt16BE=R1;function T1(r,t,e){return t===void 0&&(t=new Uint8Array(2)),e===void 0&&(e=0),t[e+0]=r>>>0,t[e+1]=r>>>8,t}oe.writeUint16LE=T1;oe.writeInt16LE=T1;function hl(r,t){return t===void 0&&(t=0),r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3]}oe.readInt32BE=hl;function ll(r,t){return t===void 0&&(t=0),(r[t]<<24|r[t+1]<<16|r[t+2]<<8|r[t+3])>>>0}oe.readUint32BE=ll;function fl(r,t){return t===void 0&&(t=0),r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t]}oe.readInt32LE=fl;function dl(r,t){return t===void 0&&(t=0),(r[t+3]<<24|r[t+2]<<16|r[t+1]<<8|r[t])>>>0}oe.readUint32LE=dl;function Hc(r,t,e){return t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0),t[e+0]=r>>>24,t[e+1]=r>>>16,t[e+2]=r>>>8,t[e+3]=r>>>0,t}oe.writeUint32BE=Hc;oe.writeInt32BE=Hc;function Kc(r,t,e){return t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0),t[e+0]=r>>>0,t[e+1]=r>>>8,t[e+2]=r>>>16,t[e+3]=r>>>24,t}oe.writeUint32LE=Kc;oe.writeInt32LE=Kc;function K6(r,t){t===void 0&&(t=0);var e=hl(r,t),i=hl(r,t+4);return e*4294967296+i-(i>>31)*4294967296}oe.readInt64BE=K6;function V6(r,t){t===void 0&&(t=0);var e=ll(r,t),i=ll(r,t+4);return e*4294967296+i}oe.readUint64BE=V6;function G6(r,t){t===void 0&&(t=0);var e=fl(r,t),i=fl(r,t+4);return i*4294967296+e-(e>>31)*4294967296}oe.readInt64LE=G6;function W6(r,t){t===void 0&&(t=0);var e=dl(r,t),i=dl(r,t+4);return i*4294967296+e}oe.readUint64LE=W6;function F1(r,t,e){return t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0),Hc(r/4294967296>>>0,t,e),Hc(r>>>0,t,e+4),t}oe.writeUint64BE=F1;oe.writeInt64BE=F1;function U1(r,t,e){return t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0),Kc(r>>>0,t,e),Kc(r/4294967296>>>0,t,e+4),t}oe.writeUint64LE=U1;oe.writeInt64LE=U1;function Y6(r,t,e){if(e===void 0&&(e=0),r%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(r/8>t.length-e)throw new Error("readUintBE: array is too short for the given bitLength");for(var i=0,s=1,a=r/8+e-1;a>=e;a--)i+=t[a]*s,s*=256;return i}oe.readUintBE=Y6;function Q6(r,t,e){if(e===void 0&&(e=0),r%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(r/8>t.length-e)throw new Error("readUintLE: array is too short for the given bitLength");for(var i=0,s=1,a=e;a<e+r/8;a++)i+=t[a]*s,s*=256;return i}oe.readUintLE=Q6;function J6(r,t,e,i){if(e===void 0&&(e=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!N1.isSafeInteger(t))throw new Error("writeUintBE value must be an integer");for(var s=1,a=r/8+i-1;a>=i;a--)e[a]=t/s&255,s*=256;return e}oe.writeUintBE=J6;function X6(r,t,e,i){if(e===void 0&&(e=new Uint8Array(r/8)),i===void 0&&(i=0),r%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!N1.isSafeInteger(t))throw new Error("writeUintLE value must be an integer");for(var s=1,a=i;a<i+r/8;a++)e[a]=t/s&255,s*=256;return e}oe.writeUintLE=X6;function Z6(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat32(t)}oe.readFloat32BE=Z6;function t_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat32(t,!0)}oe.readFloat32LE=t_;function e_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat64(t)}oe.readFloat64BE=e_;function r_(r,t){t===void 0&&(t=0);var e=new DataView(r.buffer,r.byteOffset,r.byteLength);return e.getFloat64(t,!0)}oe.readFloat64LE=r_;function i_(r,t,e){t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0);var i=new DataView(t.buffer,t.byteOffset,t.byteLength);return i.setFloat32(e,r),t}oe.writeFloat32BE=i_;function n_(r,t,e){t===void 0&&(t=new Uint8Array(4)),e===void 0&&(e=0);var i=new DataView(t.buffer,t.byteOffset,t.byteLength);return i.setFloat32(e,r,!0),t}oe.writeFloat32LE=n_;function s_(r,t,e){t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0);var i=new DataView(t.buffer,t.byteOffset,t.byteLength);return i.setFloat64(e,r),t}oe.writeFloat64BE=s_;function o_(r,t,e){t===void 0&&(t=new Uint8Array(8)),e===void 0&&(e=0);var i=new DataView(t.buffer,t.byteOffset,t.byteLength);return i.setFloat64(e,r,!0),t}oe.writeFloat64LE=o_;var si={};Object.defineProperty(si,"__esModule",{value:!0});function a_(r){for(var t=0;t<r.length;t++)r[t]=0;return r}si.wipe=a_;Object.defineProperty(nu,"__esModule",{value:!0});var _r=oe,pl=si,c_=20;function u_(r,t,e){for(var i=1634760805,s=857760878,a=2036477234,u=1797285236,l=e[3]<<24|e[2]<<16|e[1]<<8|e[0],m=e[7]<<24|e[6]<<16|e[5]<<8|e[4],f=e[11]<<24|e[10]<<16|e[9]<<8|e[8],w=e[15]<<24|e[14]<<16|e[13]<<8|e[12],E=e[19]<<24|e[18]<<16|e[17]<<8|e[16],x=e[23]<<24|e[22]<<16|e[21]<<8|e[20],I=e[27]<<24|e[26]<<16|e[25]<<8|e[24],N=e[31]<<24|e[30]<<16|e[29]<<8|e[28],Y=t[3]<<24|t[2]<<16|t[1]<<8|t[0],G=t[7]<<24|t[6]<<16|t[5]<<8|t[4],tt=t[11]<<24|t[10]<<16|t[9]<<8|t[8],K=t[15]<<24|t[14]<<16|t[13]<<8|t[12],V=i,B=s,z=a,$=u,v=l,T=m,nt=f,ft=w,pt=E,mt=x,h=I,y=N,b=Y,M=G,C=tt,R=K,j=0;j<c_;j+=2)V=V+v|0,b^=V,b=b>>>32-16|b<<16,pt=pt+b|0,v^=pt,v=v>>>32-12|v<<12,B=B+T|0,M^=B,M=M>>>32-16|M<<16,mt=mt+M|0,T^=mt,T=T>>>32-12|T<<12,z=z+nt|0,C^=z,C=C>>>32-16|C<<16,h=h+C|0,nt^=h,nt=nt>>>32-12|nt<<12,$=$+ft|0,R^=$,R=R>>>32-16|R<<16,y=y+R|0,ft^=y,ft=ft>>>32-12|ft<<12,z=z+nt|0,C^=z,C=C>>>32-8|C<<8,h=h+C|0,nt^=h,nt=nt>>>32-7|nt<<7,$=$+ft|0,R^=$,R=R>>>32-8|R<<8,y=y+R|0,ft^=y,ft=ft>>>32-7|ft<<7,B=B+T|0,M^=B,M=M>>>32-8|M<<8,mt=mt+M|0,T^=mt,T=T>>>32-7|T<<7,V=V+v|0,b^=V,b=b>>>32-8|b<<8,pt=pt+b|0,v^=pt,v=v>>>32-7|v<<7,V=V+T|0,R^=V,R=R>>>32-16|R<<16,h=h+R|0,T^=h,T=T>>>32-12|T<<12,B=B+nt|0,b^=B,b=b>>>32-16|b<<16,y=y+b|0,nt^=y,nt=nt>>>32-12|nt<<12,z=z+ft|0,M^=z,M=M>>>32-16|M<<16,pt=pt+M|0,ft^=pt,ft=ft>>>32-12|ft<<12,$=$+v|0,C^=$,C=C>>>32-16|C<<16,mt=mt+C|0,v^=mt,v=v>>>32-12|v<<12,z=z+ft|0,M^=z,M=M>>>32-8|M<<8,pt=pt+M|0,ft^=pt,ft=ft>>>32-7|ft<<7,$=$+v|0,C^=$,C=C>>>32-8|C<<8,mt=mt+C|0,v^=mt,v=v>>>32-7|v<<7,B=B+nt|0,b^=B,b=b>>>32-8|b<<8,y=y+b|0,nt^=y,nt=nt>>>32-7|nt<<7,V=V+T|0,R^=V,R=R>>>32-8|R<<8,h=h+R|0,T^=h,T=T>>>32-7|T<<7;_r.writeUint32LE(V+i|0,r,0),_r.writeUint32LE(B+s|0,r,4),_r.writeUint32LE(z+a|0,r,8),_r.writeUint32LE($+u|0,r,12),_r.writeUint32LE(v+l|0,r,16),_r.writeUint32LE(T+m|0,r,20),_r.writeUint32LE(nt+f|0,r,24),_r.writeUint32LE(ft+w|0,r,28),_r.writeUint32LE(pt+E|0,r,32),_r.writeUint32LE(mt+x|0,r,36),_r.writeUint32LE(h+I|0,r,40),_r.writeUint32LE(y+N|0,r,44),_r.writeUint32LE(b+Y|0,r,48),_r.writeUint32LE(M+G|0,r,52),_r.writeUint32LE(C+tt|0,r,56),_r.writeUint32LE(R+K|0,r,60)}function B1(r,t,e,i,s){if(s===void 0&&(s=0),r.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(i.length<e.length)throw new Error("ChaCha: destination is shorter than source");var a,u;if(s===0){if(t.length!==8&&t.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");a=new Uint8Array(16),u=a.length-t.length,a.set(t,u)}else{if(t.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");a=t,u=s}for(var l=new Uint8Array(64),m=0;m<e.length;m+=64){u_(l,a,r);for(var f=m;f<m+64&&f<e.length;f++)i[f]=e[f]^l[f-m];l_(a,0,u)}return pl.wipe(l),s===0&&pl.wipe(a),i}nu.streamXOR=B1;function h_(r,t,e,i){return i===void 0&&(i=0),pl.wipe(e),B1(r,t,e,e,i)}nu.stream=h_;function l_(r,t,e){for(var i=1;e--;)i=i+(r[t]&255)|0,r[t]=i&255,i>>>=8,t++;if(i>0)throw new Error("ChaCha: counter overflow")}var L1={},Qn={};Object.defineProperty(Qn,"__esModule",{value:!0});function f_(r,t,e){return~(r-1)&t|r-1&e}Qn.select=f_;function d_(r,t){return(r|0)-(t|0)-1>>>31&1}Qn.lessOrEqual=d_;function q1(r,t){if(r.length!==t.length)return 0;for(var e=0,i=0;i<r.length;i++)e|=r[i]^t[i];return 1&e-1>>>8}Qn.compare=q1;function p_(r,t){return r.length===0||t.length===0?!1:q1(r,t)!==0}Qn.equal=p_;(function(r){Object.defineProperty(r,"__esModule",{value:!0});var t=Qn,e=si;r.DIGEST_LENGTH=16;var i=function(){function u(l){this.digestLength=r.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 m=l[0]|l[1]<<8;this._r[0]=m&8191;var f=l[2]|l[3]<<8;this._r[1]=(m>>>13|f<<3)&8191;var w=l[4]|l[5]<<8;this._r[2]=(f>>>10|w<<6)&7939;var E=l[6]|l[7]<<8;this._r[3]=(w>>>7|E<<9)&8191;var x=l[8]|l[9]<<8;this._r[4]=(E>>>4|x<<12)&255,this._r[5]=x>>>1&8190;var I=l[10]|l[11]<<8;this._r[6]=(x>>>14|I<<2)&8191;var N=l[12]|l[13]<<8;this._r[7]=(I>>>11|N<<5)&8065;var Y=l[14]|l[15]<<8;this._r[8]=(N>>>8|Y<<8)&8191,this._r[9]=Y>>>5&127,this._pad[0]=l[16]|l[17]<<8,this._pad[1]=l[18]|l[19]<<8,this._pad[2]=l[20]|l[21]<<8,this._pad[3]=l[22]|l[23]<<8,this._pad[4]=l[24]|l[25]<<8,this._pad[5]=l[26]|l[27]<<8,this._pad[6]=l[28]|l[29]<<8,this._pad[7]=l[30]|l[31]<<8}return u.prototype._blocks=function(l,m,f){for(var w=this._fin?0:2048,E=this._h[0],x=this._h[1],I=this._h[2],N=this._h[3],Y=this._h[4],G=this._h[5],tt=this._h[6],K=this._h[7],V=this._h[8],B=this._h[9],z=this._r[0],$=this._r[1],v=this._r[2],T=this._r[3],nt=this._r[4],ft=this._r[5],pt=this._r[6],mt=this._r[7],h=this._r[8],y=this._r[9];f>=16;){var b=l[m+0]|l[m+1]<<8;E+=b&8191;var M=l[m+2]|l[m+3]<<8;x+=(b>>>13|M<<3)&8191;var C=l[m+4]|l[m+5]<<8;I+=(M>>>10|C<<6)&8191;var R=l[m+6]|l[m+7]<<8;N+=(C>>>7|R<<9)&8191;var j=l[m+8]|l[m+9]<<8;Y+=(R>>>4|j<<12)&8191,G+=j>>>1&8191;var S=l[m+10]|l[m+11]<<8;tt+=(j>>>14|S<<2)&8191;var p=l[m+12]|l[m+13]<<8;K+=(S>>>11|p<<5)&8191;var O=l[m+14]|l[m+15]<<8;V+=(p>>>8|O<<8)&8191,B+=O>>>5|w;var it=0,lt=it;lt+=E*z,lt+=x*(5*y),lt+=I*(5*h),lt+=N*(5*mt),lt+=Y*(5*pt),it=lt>>>13,lt&=8191,lt+=G*(5*ft),lt+=tt*(5*nt),lt+=K*(5*T),lt+=V*(5*v),lt+=B*(5*$),it+=lt>>>13,lt&=8191;var _=it;_+=E*$,_+=x*z,_+=I*(5*y),_+=N*(5*h),_+=Y*(5*mt),it=_>>>13,_&=8191,_+=G*(5*pt),_+=tt*(5*ft),_+=K*(5*nt),_+=V*(5*T),_+=B*(5*v),it+=_>>>13,_&=8191;var Z=it;Z+=E*v,Z+=x*$,Z+=I*z,Z+=N*(5*y),Z+=Y*(5*h),it=Z>>>13,Z&=8191,Z+=G*(5*mt),Z+=tt*(5*pt),Z+=K*(5*ft),Z+=V*(5*nt),Z+=B*(5*T),it+=Z>>>13,Z&=8191;var U=it;U+=E*T,U+=x*v,U+=I*$,U+=N*z,U+=Y*(5*y),it=U>>>13,U&=8191,U+=G*(5*h),U+=tt*(5*mt),U+=K*(5*pt),U+=V*(5*ft),U+=B*(5*nt),it+=U>>>13,U&=8191;var L=it;L+=E*nt,L+=x*T,L+=I*v,L+=N*$,L+=Y*z,it=L>>>13,L&=8191,L+=G*(5*y),L+=tt*(5*h),L+=K*(5*mt),L+=V*(5*pt),L+=B*(5*ft),it+=L>>>13,L&=8191;var k=it;k+=E*ft,k+=x*nt,k+=I*T,k+=N*v,k+=Y*$,it=k>>>13,k&=8191,k+=G*z,k+=tt*(5*y),k+=K*(5*h),k+=V*(5*mt),k+=B*(5*pt),it+=k>>>13,k&=8191;var d=it;d+=E*pt,d+=x*ft,d+=I*nt,d+=N*T,d+=Y*v,it=d>>>13,d&=8191,d+=G*$,d+=tt*z,d+=K*(5*y),d+=V*(5*h),d+=B*(5*mt),it+=d>>>13,d&=8191;var F=it;F+=E*mt,F+=x*pt,F+=I*ft,F+=N*nt,F+=Y*T,it=F>>>13,F&=8191,F+=G*v,F+=tt*$,F+=K*z,F+=V*(5*y),F+=B*(5*h),it+=F>>>13,F&=8191;var et=it;et+=E*h,et+=x*mt,et+=I*pt,et+=N*ft,et+=Y*nt,it=et>>>13,et&=8191,et+=G*T,et+=tt*v,et+=K*$,et+=V*z,et+=B*(5*y),it+=et>>>13,et&=8191;var ut=it;ut+=E*y,ut+=x*h,ut+=I*mt,ut+=N*pt,ut+=Y*ft,it=ut>>>13,ut&=8191,ut+=G*nt,ut+=tt*T,ut+=K*v,ut+=V*$,ut+=B*z,it+=ut>>>13,ut&=8191,it=(it<<2)+it|0,it=it+lt|0,lt=it&8191,it=it>>>13,_+=it,E=lt,x=_,I=Z,N=U,Y=L,G=k,tt=d,K=F,V=et,B=ut,m+=16,f-=16}this._h[0]=E,this._h[1]=x,this._h[2]=I,this._h[3]=N,this._h[4]=Y,this._h[5]=G,this._h[6]=tt,this._h[7]=K,this._h[8]=V,this._h[9]=B},u.prototype.finish=function(l,m){m===void 0&&(m=0);var f=new Uint16Array(10),w,E,x,I;if(this._leftover){for(I=this._leftover,this._buffer[I++]=1;I<16;I++)this._buffer[I]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(w=this._h[1]>>>13,this._h[1]&=8191,I=2;I<10;I++)this._h[I]+=w,w=this._h[I]>>>13,this._h[I]&=8191;for(this._h[0]+=w*5,w=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=w,w=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=w,f[0]=this._h[0]+5,w=f[0]>>>13,f[0]&=8191,I=1;I<10;I++)f[I]=this._h[I]+w,w=f[I]>>>13,f[I]&=8191;for(f[9]-=8192,E=(w^1)-1,I=0;I<10;I++)f[I]&=E;for(E=~E,I=0;I<10;I++)this._h[I]=this._h[I]&E|f[I];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,x=this._h[0]+this._pad[0],this._h[0]=x&65535,I=1;I<8;I++)x=(this._h[I]+this._pad[I]|0)+(x>>>16)|0,this._h[I]=x&65535;return l[m+0]=this._h[0]>>>0,l[m+1]=this._h[0]>>>8,l[m+2]=this._h[1]>>>0,l[m+3]=this._h[1]>>>8,l[m+4]=this._h[2]>>>0,l[m+5]=this._h[2]>>>8,l[m+6]=this._h[3]>>>0,l[m+7]=this._h[3]>>>8,l[m+8]=this._h[4]>>>0,l[m+9]=this._h[4]>>>8,l[m+10]=this._h[5]>>>0,l[m+11]=this._h[5]>>>8,l[m+12]=this._h[6]>>>0,l[m+13]=this._h[6]>>>8,l[m+14]=this._h[7]>>>0,l[m+15]=this._h[7]>>>8,this._finished=!0,this},u.prototype.update=function(l){var m=0,f=l.length,w;if(this._leftover){w=16-this._leftover,w>f&&(w=f);for(var E=0;E<w;E++)this._buffer[this._leftover+E]=l[m+E];if(f-=w,m+=w,this._leftover+=w,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(f>=16&&(w=f-f%16,this._blocks(l,m,w),m+=w,f-=w),f){for(var E=0;E<f;E++)this._buffer[this._leftover+E]=l[m+E];this._leftover+=f}return this},u.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var l=new Uint8Array(16);return this.finish(l),l},u.prototype.clean=function(){return e.wipe(this._buffer),e.wipe(this._r),e.wipe(this._h),e.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},u}();r.Poly1305=i;function s(u,l){var m=new i(u);m.update(l);var f=m.digest();return m.clean(),f}r.oneTimeAuth=s;function a(u,l){return u.length!==r.DIGEST_LENGTH||l.length!==r.DIGEST_LENGTH?!1:t.equal(u,l)}r.equal=a})(L1);(function(r){Object.defineProperty(r,"__esModule",{value:!0});var t=nu,e=L1,i=si,s=oe,a=Qn;r.KEY_LENGTH=32,r.NONCE_LENGTH=12,r.TAG_LENGTH=16;var u=new Uint8Array(16),l=function(){function m(f){if(this.nonceLength=r.NONCE_LENGTH,this.tagLength=r.TAG_LENGTH,f.length!==r.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(f)}return m.prototype.seal=function(f,w,E,x){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var I=new Uint8Array(16);I.set(f,I.length-f.length);var N=new Uint8Array(32);t.stream(this._key,I,N,4);var Y=w.length+this.tagLength,G;if(x){if(x.length!==Y)throw new Error("ChaCha20Poly1305: incorrect destination length");G=x}else G=new Uint8Array(Y);return t.streamXOR(this._key,I,w,G,4),this._authenticate(G.subarray(G.length-this.tagLength,G.length),N,G.subarray(0,G.length-this.tagLength),E),i.wipe(I),G},m.prototype.open=function(f,w,E,x){if(f.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(w.length<this.tagLength)return null;var I=new Uint8Array(16);I.set(f,I.length-f.length);var N=new Uint8Array(32);t.stream(this._key,I,N,4);var Y=new Uint8Array(this.tagLength);if(this._authenticate(Y,N,w.subarray(0,w.length-this.tagLength),E),!a.equal(Y,w.subarray(w.length-this.tagLength,w.length)))return null;var G=w.length-this.tagLength,tt;if(x){if(x.length!==G)throw new Error("ChaCha20Poly1305: incorrect destination length");tt=x}else tt=new Uint8Array(G);return t.streamXOR(this._key,I,w.subarray(0,w.length-this.tagLength),tt,4),i.wipe(I),tt},m.prototype.clean=function(){return i.wipe(this._key),this},m.prototype._authenticate=function(f,w,E,x){var I=new e.Poly1305(w);x&&(I.update(x),x.length%16>0&&I.update(u.subarray(x.length%16))),I.update(E),E.length%16>0&&I.update(u.subarray(E.length%16));var N=new Uint8Array(8);x&&s.writeUint64LE(x.length,N),I.update(N),s.writeUint64LE(E.length,N),I.update(N);for(var Y=I.digest(),G=0;G<Y.length;G++)f[G]=Y[G];I.clean(),i.wipe(Y),i.wipe(N)},m}();r.ChaCha20Poly1305=l})(ql);var j1={},ha={},jl={};Object.defineProperty(jl,"__esModule",{value:!0});function g_(r){return typeof r.saveState<"u"&&typeof r.restoreState<"u"&&typeof r.cleanSavedState<"u"}jl.isSerializableHash=g_;Object.defineProperty(ha,"__esModule",{value:!0});var Gi=jl,m_=Qn,v_=si,$1=function(){function r(t,e){this._finished=!1,this._inner=new t,this._outer=new t,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var i=new Uint8Array(this.blockSize);e.length>this.blockSize?this._inner.update(e).finish(i).clean():i.set(e);for(var s=0;s<i.length;s++)i[s]^=54;this._inner.update(i);for(var s=0;s<i.length;s++)i[s]^=106;this._outer.update(i),Gi.isSerializableHash(this._inner)&&Gi.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),v_.wipe(i)}return r.prototype.reset=function(){if(!Gi.isSerializableHash(this._inner)||!Gi.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.clean=function(){Gi.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Gi.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},r.prototype.update=function(t){return this._inner.update(t),this},r.prototype.finish=function(t){return this._finished?(this._outer.finish(t),this):(this._inner.finish(t),this._outer.update(t.subarray(0,this.digestLength)).finish(t),this._finished=!0,this)},r.prototype.digest=function(){var t=new Uint8Array(this.digestLength);return this.finish(t),t},r.prototype.saveState=function(){if(!Gi.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},r.prototype.restoreState=function(t){if(!Gi.isSerializableHash(this._inner)||!Gi.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(t),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},r.prototype.cleanSavedState=function(t){if(!Gi.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(t)},r}();ha.HMAC=$1;function y_(r,t,e){var i=new $1(r,t);i.update(e);var s=i.digest();return i.clean(),s}ha.hmac=y_;ha.equal=m_.equal;Object.defineProperty(j1,"__esModule",{value:!0});var Sd=ha,Id=si,w_=function(){function r(t,e,i,s){i===void 0&&(i=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=t,this._info=s;var a=Sd.hmac(this._hash,i,e);this._hmac=new Sd.HMAC(t,a),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return r.prototype._fillBuffer=function(){this._counter[0]++;var t=this._counter[0];if(t===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),t>1&&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},r.prototype.expand=function(t){for(var e=new Uint8Array(t),i=0;i<e.length;i++)this._bufpos===this._buffer.length&&this._fillBuffer(),e[i]=this._buffer[this._bufpos++];return e},r.prototype.clean=function(){this._hmac.clean(),Id.wipe(this._buffer),Id.wipe(this._counter),this._bufpos=0},r}(),b_=j1.HKDF=w_,fo={},su={},ou={};Object.defineProperty(ou,"__esModule",{value:!0});ou.BrowserRandomSource=void 0;const Dd=65536;class __{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const t=typeof self<"u"?self.crypto||self.msCrypto:null;t&&t.getRandomValues!==void 0&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const e=new Uint8Array(t);for(let i=0;i<e.length;i+=Dd)this._crypto.getRandomValues(e.subarray(i,i+Math.min(e.length-i,Dd)));return e}}ou.BrowserRandomSource=__;var au={};Object.defineProperty(au,"__esModule",{value:!0});au.NodeRandomSource=void 0;const E_=si;class A_{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Z3<"u"){const t=t6();t&&t.randomBytes&&(this._crypto=t,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(t){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let e=this._crypto.randomBytes(t);if(e.length!==t)throw new Error("NodeRandomSource: got fewer bytes than requested");const i=new Uint8Array(t);for(let s=0;s<i.length;s++)i[s]=e[s];return(0,E_.wipe)(e),i}}au.NodeRandomSource=A_;Object.defineProperty(su,"__esModule",{value:!0});su.SystemRandomSource=void 0;const S_=ou,I_=au;class D_{constructor(){if(this.isAvailable=!1,this.name="",this._source=new S_.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new I_.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(t){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(t)}}su.SystemRandomSource=D_;(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.randomStringForEntropy=r.randomString=r.randomUint32=r.randomBytes=r.defaultRandomSource=void 0;const t=su,e=oe,i=si;r.defaultRandomSource=new t.SystemRandomSource;function s(f,w=r.defaultRandomSource){return w.randomBytes(f)}r.randomBytes=s;function a(f=r.defaultRandomSource){const w=s(4,f),E=(0,e.readUint32LE)(w);return(0,i.wipe)(w),E}r.randomUint32=a;const u="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function l(f,w=u,E=r.defaultRandomSource){if(w.length<2)throw new Error("randomString charset is too short");if(w.length>256)throw new Error("randomString charset is too long");let x="";const I=w.length,N=256-256%I;for(;f>0;){const Y=s(Math.ceil(f*256/N),E);for(let G=0;G<Y.length&&f>0;G++){const tt=Y[G];tt<N&&(x+=w.charAt(tt%I),f--)}(0,i.wipe)(Y)}return x}r.randomString=l;function m(f,w=u,E=r.defaultRandomSource){const x=Math.ceil(f/(Math.log(w.length)/Math.LN2));return l(x,w,E)}r.randomStringForEntropy=m})(fo);var cu={};(function(r){Object.defineProperty(r,"__esModule",{value:!0});var t=oe,e=si;r.DIGEST_LENGTH=32,r.BLOCK_SIZE=64;var i=function(){function l(){this.digestLength=r.DIGEST_LENGTH,this.blockSize=r.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 l.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},l.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},l.prototype.clean=function(){e.wipe(this._buffer),e.wipe(this._temp),this.reset()},l.prototype.update=function(m,f){if(f===void 0&&(f=m.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var w=0;if(this._bytesHashed+=f,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&f>0;)this._buffer[this._bufferLength++]=m[w++],f--;this._bufferLength===this.blockSize&&(a(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(f>=this.blockSize&&(w=a(this._temp,this._state,m,w,f),f%=this.blockSize);f>0;)this._buffer[this._bufferLength++]=m[w++],f--;return this},l.prototype.finish=function(m){if(!this._finished){var f=this._bytesHashed,w=this._bufferLength,E=f/536870912|0,x=f<<3,I=f%64<56?64:128;this._buffer[w]=128;for(var N=w+1;N<I-8;N++)this._buffer[N]=0;t.writeUint32BE(E,this._buffer,I-8),t.writeUint32BE(x,this._buffer,I-4),a(this._temp,this._state,this._buffer,0,I),this._finished=!0}for(var N=0;N<this.digestLength/4;N++)t.writeUint32BE(this._state[N],m,N*4);return this},l.prototype.digest=function(){var m=new Uint8Array(this.digestLength);return this.finish(m),m},l.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},l.prototype.restoreState=function(m){return this._state.set(m.state),this._bufferLength=m.bufferLength,m.buffer&&this._buffer.set(m.buffer),this._bytesHashed=m.bytesHashed,this._finished=!1,this},l.prototype.cleanSavedState=function(m){e.wipe(m.state),m.buffer&&e.wipe(m.buffer),m.bufferLength=0,m.bytesHashed=0},l}();r.SHA256=i;var s=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 a(l,m,f,w,E){for(;E>=64;){for(var x=m[0],I=m[1],N=m[2],Y=m[3],G=m[4],tt=m[5],K=m[6],V=m[7],B=0;B<16;B++){var z=w+B*4;l[B]=t.readUint32BE(f,z)}for(var B=16;B<64;B++){var $=l[B-2],v=($>>>17|$<<32-17)^($>>>19|$<<32-19)^$>>>10;$=l[B-15];var T=($>>>7|$<<32-7)^($>>>18|$<<32-18)^$>>>3;l[B]=(v+l[B-7]|0)+(T+l[B-16]|0)}for(var B=0;B<64;B++){var v=(((G>>>6|G<<26)^(G>>>11|G<<21)^(G>>>25|G<<7))+(G&tt^~G&K)|0)+(V+(s[B]+l[B]|0)|0)|0,T=((x>>>2|x<<32-2)^(x>>>13|x<<32-13)^(x>>>22|x<<32-22))+(x&I^x&N^I&N)|0;V=K,K=tt,tt=G,G=Y+v|0,Y=N,N=I,I=x,x=v+T|0}m[0]+=x,m[1]+=I,m[2]+=N,m[3]+=Y,m[4]+=G,m[5]+=tt,m[6]+=K,m[7]+=V,w+=64,E-=64}return w}function u(l){var m=new i;m.update(l);var f=m.digest();return m.clean(),f}r.hash=u})(cu);var $l={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.sharedKey=r.generateKeyPair=r.generateKeyPairFromSeed=r.scalarMultBase=r.scalarMult=r.SHARED_KEY_LENGTH=r.SECRET_KEY_LENGTH=r.PUBLIC_KEY_LENGTH=void 0;const t=fo,e=si;r.PUBLIC_KEY_LENGTH=32,r.SECRET_KEY_LENGTH=32,r.SHARED_KEY_LENGTH=32;function i(B){const z=new Float64Array(16);if(B)for(let $=0;$<B.length;$++)z[$]=B[$];return z}const s=new Uint8Array(32);s[0]=9;const a=i([56129,1]);function u(B){let z=1;for(let $=0;$<16;$++){let v=B[$]+z+65535;z=Math.floor(v/65536),B[$]=v-z*65536}B[0]+=z-1+37*(z-1)}function l(B,z,$){const v=~($-1);for(let T=0;T<16;T++){const nt=v&(B[T]^z[T]);B[T]^=nt,z[T]^=nt}}function m(B,z){const $=i(),v=i();for(let T=0;T<16;T++)v[T]=z[T];u(v),u(v),u(v);for(let T=0;T<2;T++){$[0]=v[0]-65517;for(let ft=1;ft<15;ft++)$[ft]=v[ft]-65535-($[ft-1]>>16&1),$[ft-1]&=65535;$[15]=v[15]-32767-($[14]>>16&1);const nt=$[15]>>16&1;$[14]&=65535,l(v,$,1-nt)}for(let T=0;T<16;T++)B[2*T]=v[T]&255,B[2*T+1]=v[T]>>8}function f(B,z){for(let $=0;$<16;$++)B[$]=z[2*$]+(z[2*$+1]<<8);B[15]&=32767}function w(B,z,$){for(let v=0;v<16;v++)B[v]=z[v]+$[v]}function E(B,z,$){for(let v=0;v<16;v++)B[v]=z[v]-$[v]}function x(B,z,$){let v,T,nt=0,ft=0,pt=0,mt=0,h=0,y=0,b=0,M=0,C=0,R=0,j=0,S=0,p=0,O=0,it=0,lt=0,_=0,Z=0,U=0,L=0,k=0,d=0,F=0,et=0,ut=0,at=0,Mt=0,Pt=0,It=0,Ee=0,$t=0,xt=$[0],Bt=$[1],_t=$[2],Et=$[3],Vt=$[4],wt=$[5],At=$[6],Ut=$[7],bt=$[8],Ct=$[9],Lt=$[10],Ot=$[11],Nt=$[12],se=$[13],Tt=$[14],Rt=$[15];v=z[0],nt+=v*xt,ft+=v*Bt,pt+=v*_t,mt+=v*Et,h+=v*Vt,y+=v*wt,b+=v*At,M+=v*Ut,C+=v*bt,R+=v*Ct,j+=v*Lt,S+=v*Ot,p+=v*Nt,O+=v*se,it+=v*Tt,lt+=v*Rt,v=z[1],ft+=v*xt,pt+=v*Bt,mt+=v*_t,h+=v*Et,y+=v*Vt,b+=v*wt,M+=v*At,C+=v*Ut,R+=v*bt,j+=v*Ct,S+=v*Lt,p+=v*Ot,O+=v*Nt,it+=v*se,lt+=v*Tt,_+=v*Rt,v=z[2],pt+=v*xt,mt+=v*Bt,h+=v*_t,y+=v*Et,b+=v*Vt,M+=v*wt,C+=v*At,R+=v*Ut,j+=v*bt,S+=v*Ct,p+=v*Lt,O+=v*Ot,it+=v*Nt,lt+=v*se,_+=v*Tt,Z+=v*Rt,v=z[3],mt+=v*xt,h+=v*Bt,y+=v*_t,b+=v*Et,M+=v*Vt,C+=v*wt,R+=v*At,j+=v*Ut,S+=v*bt,p+=v*Ct,O+=v*Lt,it+=v*Ot,lt+=v*Nt,_+=v*se,Z+=v*Tt,U+=v*Rt,v=z[4],h+=v*xt,y+=v*Bt,b+=v*_t,M+=v*Et,C+=v*Vt,R+=v*wt,j+=v*At,S+=v*Ut,p+=v*bt,O+=v*Ct,it+=v*Lt,lt+=v*Ot,_+=v*Nt,Z+=v*se,U+=v*Tt,L+=v*Rt,v=z[5],y+=v*xt,b+=v*Bt,M+=v*_t,C+=v*Et,R+=v*Vt,j+=v*wt,S+=v*At,p+=v*Ut,O+=v*bt,it+=v*Ct,lt+=v*Lt,_+=v*Ot,Z+=v*Nt,U+=v*se,L+=v*Tt,k+=v*Rt,v=z[6],b+=v*xt,M+=v*Bt,C+=v*_t,R+=v*Et,j+=v*Vt,S+=v*wt,p+=v*At,O+=v*Ut,it+=v*bt,lt+=v*Ct,_+=v*Lt,Z+=v*Ot,U+=v*Nt,L+=v*se,k+=v*Tt,d+=v*Rt,v=z[7],M+=v*xt,C+=v*Bt,R+=v*_t,j+=v*Et,S+=v*Vt,p+=v*wt,O+=v*At,it+=v*Ut,lt+=v*bt,_+=v*Ct,Z+=v*Lt,U+=v*Ot,L+=v*Nt,k+=v*se,d+=v*Tt,F+=v*Rt,v=z[8],C+=v*xt,R+=v*Bt,j+=v*_t,S+=v*Et,p+=v*Vt,O+=v*wt,it+=v*At,lt+=v*Ut,_+=v*bt,Z+=v*Ct,U+=v*Lt,L+=v*Ot,k+=v*Nt,d+=v*se,F+=v*Tt,et+=v*Rt,v=z[9],R+=v*xt,j+=v*Bt,S+=v*_t,p+=v*Et,O+=v*Vt,it+=v*wt,lt+=v*At,_+=v*Ut,Z+=v*bt,U+=v*Ct,L+=v*Lt,k+=v*Ot,d+=v*Nt,F+=v*se,et+=v*Tt,ut+=v*Rt,v=z[10],j+=v*xt,S+=v*Bt,p+=v*_t,O+=v*Et,it+=v*Vt,lt+=v*wt,_+=v*At,Z+=v*Ut,U+=v*bt,L+=v*Ct,k+=v*Lt,d+=v*Ot,F+=v*Nt,et+=v*se,ut+=v*Tt,at+=v*Rt,v=z[11],S+=v*xt,p+=v*Bt,O+=v*_t,it+=v*Et,lt+=v*Vt,_+=v*wt,Z+=v*At,U+=v*Ut,L+=v*bt,k+=v*Ct,d+=v*Lt,F+=v*Ot,et+=v*Nt,ut+=v*se,at+=v*Tt,Mt+=v*Rt,v=z[12],p+=v*xt,O+=v*Bt,it+=v*_t,lt+=v*Et,_+=v*Vt,Z+=v*wt,U+=v*At,L+=v*Ut,k+=v*bt,d+=v*Ct,F+=v*Lt,et+=v*Ot,ut+=v*Nt,at+=v*se,Mt+=v*Tt,Pt+=v*Rt,v=z[13],O+=v*xt,it+=v*Bt,lt+=v*_t,_+=v*Et,Z+=v*Vt,U+=v*wt,L+=v*At,k+=v*Ut,d+=v*bt,F+=v*Ct,et+=v*Lt,ut+=v*Ot,at+=v*Nt,Mt+=v*se,Pt+=v*Tt,It+=v*Rt,v=z[14],it+=v*xt,lt+=v*Bt,_+=v*_t,Z+=v*Et,U+=v*Vt,L+=v*wt,k+=v*At,d+=v*Ut,F+=v*bt,et+=v*Ct,ut+=v*Lt,at+=v*Ot,Mt+=v*Nt,Pt+=v*se,It+=v*Tt,Ee+=v*Rt,v=z[15],lt+=v*xt,_+=v*Bt,Z+=v*_t,U+=v*Et,L+=v*Vt,k+=v*wt,d+=v*At,F+=v*Ut,et+=v*bt,ut+=v*Ct,at+=v*Lt,Mt+=v*Ot,Pt+=v*Nt,It+=v*se,Ee+=v*Tt,$t+=v*Rt,nt+=38*_,ft+=38*Z,pt+=38*U,mt+=38*L,h+=38*k,y+=38*d,b+=38*F,M+=38*et,C+=38*ut,R+=38*at,j+=38*Mt,S+=38*Pt,p+=38*It,O+=38*Ee,it+=38*$t,T=1,v=nt+T+65535,T=Math.floor(v/65536),nt=v-T*65536,v=ft+T+65535,T=Math.floor(v/65536),ft=v-T*65536,v=pt+T+65535,T=Math.floor(v/65536),pt=v-T*65536,v=mt+T+65535,T=Math.floor(v/65536),mt=v-T*65536,v=h+T+65535,T=Math.floor(v/65536),h=v-T*65536,v=y+T+65535,T=Math.floor(v/65536),y=v-T*65536,v=b+T+65535,T=Math.floor(v/65536),b=v-T*65536,v=M+T+65535,T=Math.floor(v/65536),M=v-T*65536,v=C+T+65535,T=Math.floor(v/65536),C=v-T*65536,v=R+T+65535,T=Math.floor(v/65536),R=v-T*65536,v=j+T+65535,T=Math.floor(v/65536),j=v-T*65536,v=S+T+65535,T=Math.floor(v/65536),S=v-T*65536,v=p+T+65535,T=Math.floor(v/65536),p=v-T*65536,v=O+T+65535,T=Math.floor(v/65536),O=v-T*65536,v=it+T+65535,T=Math.floor(v/65536),it=v-T*65536,v=lt+T+65535,T=Math.floor(v/65536),lt=v-T*65536,nt+=T-1+37*(T-1),T=1,v=nt+T+65535,T=Math.floor(v/65536),nt=v-T*65536,v=ft+T+65535,T=Math.floor(v/65536),ft=v-T*65536,v=pt+T+65535,T=Math.floor(v/65536),pt=v-T*65536,v=mt+T+65535,T=Math.floor(v/65536),mt=v-T*65536,v=h+T+65535,T=Math.floor(v/65536),h=v-T*65536,v=y+T+65535,T=Math.floor(v/65536),y=v-T*65536,v=b+T+65535,T=Math.floor(v/65536),b=v-T*65536,v=M+T+65535,T=Math.floor(v/65536),M=v-T*65536,v=C+T+65535,T=Math.floor(v/65536),C=v-T*65536,v=R+T+65535,T=Math.floor(v/65536),R=v-T*65536,v=j+T+65535,T=Math.floor(v/65536),j=v-T*65536,v=S+T+65535,T=Math.floor(v/65536),S=v-T*65536,v=p+T+65535,T=Math.floor(v/65536),p=v-T*65536,v=O+T+65535,T=Math.floor(v/65536),O=v-T*65536,v=it+T+65535,T=Math.floor(v/65536),it=v-T*65536,v=lt+T+65535,T=Math.floor(v/65536),lt=v-T*65536,nt+=T-1+37*(T-1),B[0]=nt,B[1]=ft,B[2]=pt,B[3]=mt,B[4]=h,B[5]=y,B[6]=b,B[7]=M,B[8]=C,B[9]=R,B[10]=j,B[11]=S,B[12]=p,B[13]=O,B[14]=it,B[15]=lt}function I(B,z){x(B,z,z)}function N(B,z){const $=i();for(let v=0;v<16;v++)$[v]=z[v];for(let v=253;v>=0;v--)I($,$),v!==2&&v!==4&&x($,$,z);for(let v=0;v<16;v++)B[v]=$[v]}function Y(B,z){const $=new Uint8Array(32),v=new Float64Array(80),T=i(),nt=i(),ft=i(),pt=i(),mt=i(),h=i();for(let C=0;C<31;C++)$[C]=B[C];$[31]=B[31]&127|64,$[0]&=248,f(v,z);for(let C=0;C<16;C++)nt[C]=v[C];T[0]=pt[0]=1;for(let C=254;C>=0;--C){const R=$[C>>>3]>>>(C&7)&1;l(T,nt,R),l(ft,pt,R),w(mt,T,ft),E(T,T,ft),w(ft,nt,pt),E(nt,nt,pt),I(pt,mt),I(h,T),x(T,ft,T),x(ft,nt,mt),w(mt,T,ft),E(T,T,ft),I(nt,T),E(ft,pt,h),x(T,ft,a),w(T,T,pt),x(ft,ft,T),x(T,pt,h),x(pt,nt,v),I(nt,mt),l(T,nt,R),l(ft,pt,R)}for(let C=0;C<16;C++)v[C+16]=T[C],v[C+32]=ft[C],v[C+48]=nt[C],v[C+64]=pt[C];const y=v.subarray(32),b=v.subarray(16);N(y,y),x(b,b,y);const M=new Uint8Array(32);return m(M,b),M}r.scalarMult=Y;function G(B){return Y(B,s)}r.scalarMultBase=G;function tt(B){if(B.length!==r.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${r.SECRET_KEY_LENGTH} bytes`);const z=new Uint8Array(B);return{publicKey:G(z),secretKey:z}}r.generateKeyPairFromSeed=tt;function K(B){const z=(0,t.randomBytes)(32,B),$=tt(z);return(0,e.wipe)(z),$}r.generateKeyPair=K;function V(B,z,$=!1){if(B.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(z.length!==r.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const v=Y(B,z);if($){let T=0;for(let nt=0;nt<v.length;nt++)T|=v[nt];if(T===0)throw new Error("X25519: invalid shared key")}return v}r.sharedKey=V})($l);function z1(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(r):new Uint8Array(r)}function gl(r,t){t||(t=r.reduce((s,a)=>s+a.length,0));const e=z1(t);let i=0;for(const s of r)e.set(s,i),i+=s.length;return e}function x_(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),i=0;i<e.length;i++)e[i]=255;for(var s=0;s<r.length;s++){var a=r.charAt(s),u=a.charCodeAt(0);if(e[u]!==255)throw new TypeError(a+" is ambiguous");e[u]=s}var l=r.length,m=r.charAt(0),f=Math.log(l)/Math.log(256),w=Math.log(256)/Math.log(l);function E(N){if(N instanceof Uint8Array||(ArrayBuffer.isView(N)?N=new Uint8Array(N.buffer,N.byteOffset,N.byteLength):Array.isArray(N)&&(N=Uint8Array.from(N))),!(N instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(N.length===0)return"";for(var Y=0,G=0,tt=0,K=N.length;tt!==K&&N[tt]===0;)tt++,Y++;for(var V=(K-tt)*w+1>>>0,B=new Uint8Array(V);tt!==K;){for(var z=N[tt],$=0,v=V-1;(z!==0||$<G)&&v!==-1;v--,$++)z+=256*B[v]>>>0,B[v]=z%l>>>0,z=z/l>>>0;if(z!==0)throw new Error("Non-zero carry");G=$,tt++}for(var T=V-G;T!==V&&B[T]===0;)T++;for(var nt=m.repeat(Y);T<V;++T)nt+=r.charAt(B[T]);return nt}function x(N){if(typeof N!="string")throw new TypeError("Expected String");if(N.length===0)return new Uint8Array;var Y=0;if(N[Y]!==" "){for(var G=0,tt=0;N[Y]===m;)G++,Y++;for(var K=(N.length-Y)*f+1>>>0,V=new Uint8Array(K);N[Y];){var B=e[N.charCodeAt(Y)];if(B===255)return;for(var z=0,$=K-1;(B!==0||z<tt)&&$!==-1;$--,z++)B+=l*V[$]>>>0,V[$]=B%256>>>0,B=B/256>>>0;if(B!==0)throw new Error("Non-zero carry");tt=z,Y++}if(N[Y]!==" "){for(var v=K-tt;v!==K&&V[v]===0;)v++;for(var T=new Uint8Array(G+(K-v)),nt=G;v!==K;)T[nt++]=V[v++];return T}}}function I(N){var Y=x(N);if(Y)return Y;throw new Error(`Non-${t} character`)}return{encode:E,decodeUnsafe:x,decode:I}}var M_=x_,C_=M_;const P_=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},O_=r=>new TextEncoder().encode(r),N_=r=>new TextDecoder().decode(r);class R_{constructor(t,e,i){this.name=t,this.prefix=e,this.baseEncode=i}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class T_{constructor(t,e,i){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=i}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return k1(this,t)}}class F_{constructor(t){this.decoders=t}or(t){return k1(this,t)}decode(t){const e=t[0],i=this.decoders[e];if(i)return i.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const k1=(r,t)=>new F_({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}});class U_{constructor(t,e,i,s){this.name=t,this.prefix=e,this.baseEncode=i,this.baseDecode=s,this.encoder=new R_(t,e,i),this.decoder=new T_(t,e,s)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const uu=({name:r,prefix:t,encode:e,decode:i})=>new U_(r,t,e,i),la=({prefix:r,name:t,alphabet:e})=>{const{encode:i,decode:s}=C_(e,t);return uu({prefix:r,name:t,encode:i,decode:a=>P_(s(a))})},B_=(r,t,e,i)=>{const s={};for(let w=0;w<t.length;++w)s[t[w]]=w;let a=r.length;for(;r[a-1]==="=";)--a;const u=new Uint8Array(a*e/8|0);let l=0,m=0,f=0;for(let w=0;w<a;++w){const E=s[r[w]];if(E===void 0)throw new SyntaxError(`Non-${i} character`);m=m<<e|E,l+=e,l>=8&&(l-=8,u[f++]=255&m>>l)}if(l>=e||255&m<<8-l)throw new SyntaxError("Unexpected end of data");return u},L_=(r,t,e)=>{const i=t[t.length-1]==="=",s=(1<<e)-1;let a="",u=0,l=0;for(let m=0;m<r.length;++m)for(l=l<<8|r[m],u+=8;u>e;)u-=e,a+=t[s&l>>u];if(u&&(a+=t[s&l<<e-u]),i)for(;a.length*e&7;)a+="=";return a},vr=({name:r,prefix:t,bitsPerChar:e,alphabet:i})=>uu({prefix:t,name:r,encode(s){return L_(s,i,e)},decode(s){return B_(s,i,e,r)}}),q_=uu({prefix:"\0",name:"identity",encode:r=>N_(r),decode:r=>O_(r)}),j_=Object.freeze(Object.defineProperty({__proto__:null,identity:q_},Symbol.toStringTag,{value:"Module"})),$_=vr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),z_=Object.freeze(Object.defineProperty({__proto__:null,base2:$_},Symbol.toStringTag,{value:"Module"})),k_=vr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),H_=Object.freeze(Object.defineProperty({__proto__:null,base8:k_},Symbol.toStringTag,{value:"Module"})),K_=la({prefix:"9",name:"base10",alphabet:"0123456789"}),V_=Object.freeze(Object.defineProperty({__proto__:null,base10:K_},Symbol.toStringTag,{value:"Module"})),G_=vr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),W_=vr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Y_=Object.freeze(Object.defineProperty({__proto__:null,base16:G_,base16upper:W_},Symbol.toStringTag,{value:"Module"})),Q_=vr({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),J_=vr({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),X_=vr({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Z_=vr({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),tE=vr({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),eE=vr({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),rE=vr({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),iE=vr({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),nE=vr({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),sE=Object.freeze(Object.defineProperty({__proto__:null,base32:Q_,base32hex:tE,base32hexpad:rE,base32hexpadupper:iE,base32hexupper:eE,base32pad:X_,base32padupper:Z_,base32upper:J_,base32z:nE},Symbol.toStringTag,{value:"Module"})),oE=la({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),aE=la({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),cE=Object.freeze(Object.defineProperty({__proto__:null,base36:oE,base36upper:aE},Symbol.toStringTag,{value:"Module"})),uE=la({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),hE=la({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),lE=Object.freeze(Object.defineProperty({__proto__:null,base58btc:uE,base58flickr:hE},Symbol.toStringTag,{value:"Module"})),fE=vr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),dE=vr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),pE=vr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),gE=vr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),mE=Object.freeze(Object.defineProperty({__proto__:null,base64:fE,base64pad:dE,base64url:pE,base64urlpad:gE},Symbol.toStringTag,{value:"Module"})),H1=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),vE=H1.reduce((r,t,e)=>(r[e]=t,r),[]),yE=H1.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function wE(r){return r.reduce((t,e)=>(t+=vE[e],t),"")}function bE(r){const t=[];for(const e of r){const i=yE[e.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(i)}return new Uint8Array(t)}const _E=uu({prefix:"🚀",name:"base256emoji",encode:wE,decode:bE}),EE=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:_E},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const xd={...j_,...z_,...H_,...V_,...Y_,...sE,...cE,...lE,...mE,...EE};function K1(r,t,e,i){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:i}}}const Md=K1("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Oh=K1("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);const t=z1(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),V1={utf8:Md,"utf-8":Md,hex:xd.base16,latin1:Oh,ascii:Oh,binary:Oh,...xd};function Kr(r,t="utf8"){const e=V1[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r,"utf8"):e.decoder.decode(`${e.prefix}${r}`)}function Tr(r,t="utf8"){const e=V1[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString("utf8"):e.encoder.encode(r).substring(1)}const AE={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},SE=":";function Tc(r){const[t,e]=r.split(SE);return{namespace:t,reference:e}}function Cd(r,t=[]){const e=[];return Object.keys(r).forEach(i=>{if(t.length&&!t.includes(i))return;const s=r[i];e.push(...s.accounts)}),e}function G1(r,t){return r.includes(":")?[r]:t.chains||[]}var IE=Object.defineProperty,Pd=Object.getOwnPropertySymbols,DE=Object.prototype.hasOwnProperty,xE=Object.prototype.propertyIsEnumerable,Od=(r,t,e)=>t in r?IE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Nd=(r,t)=>{for(var e in t||(t={}))DE.call(t,e)&&Od(r,e,t[e]);if(Pd)for(var e of Pd(t))xE.call(t,e)&&Od(r,e,t[e]);return r};const ME="ReactNative",ei={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},CE="js";function ra(){return typeof ri<"u"&&typeof ri.versions<"u"&&typeof ri.versions.node<"u"}function po(){return!Ul()&&!!Bl()&&navigator.product===ME}function go(){return!ra()&&!!Bl()&&!!Ul()}function fa(){return po()?ei.reactNative:ra()?ei.node:go()?ei.browser:ei.unknown}function PE(){var r;try{return po()&&typeof Ie<"u"&&typeof(Ie==null?void 0:Ie.Application)<"u"?(r=Ie.Application)==null?void 0:r.applicationId:void 0}catch{return}}function OE(r,t){let e=ea.parse(r);return e=Nd(Nd({},e),t),r=ea.stringify(e),r}function NE(){return C1()||{name:"",description:"",url:"",icons:[""]}}function RE(){if(fa()===ei.reactNative&&typeof Ie<"u"&&typeof(Ie==null?void 0:Ie.Platform)<"u"){const{OS:e,Version:i}=Ie.Platform;return[e,i].join("-")}const r=l6();if(r===null)return"unknown";const t=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[t,r.name,r.version].join("-"):[t,r.version].join("-")}function TE(){var r;const t=fa();return t===ei.browser?[t,((r=M1())==null?void 0:r.host)||"unknown"].join(":"):t}function FE(r,t,e){const i=RE(),s=TE();return[[r,t].join("-"),[CE,e].join("-"),i,s].join("/")}function UE({protocol:r,version:t,relayUrl:e,sdkVersion:i,auth:s,projectId:a,useOnCloseEvent:u,bundleId:l}){const m=e.split("?"),f=FE(r,t,i),w={auth:s,ua:f,projectId:a,useOnCloseEvent:u||void 0,origin:l||void 0},E=OE(m[1]||"",w);return m[0]+"?"+E}function Es(r,t){return r.filter(e=>t.includes(e)).length===r.length}function W1(r){return Object.fromEntries(r.entries())}function Y1(r){return new Map(Object.entries(r))}function _s(r=yt.FIVE_MINUTES,t){const e=yt.toMiliseconds(r||yt.FIVE_MINUTES);let i,s,a;return{resolve:u=>{a&&i&&(clearTimeout(a),i(u))},reject:u=>{a&&s&&(clearTimeout(a),s(u))},done:()=>new Promise((u,l)=>{a=setTimeout(()=>{l(new Error(t))},e),i=u,s=l})}}function so(r,t,e){return new Promise(async(i,s)=>{const a=setTimeout(()=>s(new Error(e)),t);try{const u=await r;i(u)}catch(u){s(u)}clearTimeout(a)})}function Q1(r,t){if(typeof t=="string"&&t.startsWith(`${r}:`))return t;if(r.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(r.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${r}`)}function BE(r){return Q1("topic",r)}function LE(r){return Q1("id",r)}function J1(r){const[t,e]=r.split(":"),i={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")i.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))i.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return i}function gr(r,t){return yt.fromMiliseconds((t||Date.now())+yt.toMiliseconds(r))}function Hn(r){return Date.now()>=yt.toMiliseconds(r)}function de(r,t){return`${r}${t?`:${t}`:""}`}function Fc(r=[],t=[]){return[...new Set([...r,...t])]}async function qE({id:r,topic:t,wcDeepLink:e}){try{if(!e)return;const i=typeof e=="string"?JSON.parse(e):e;let s=i==null?void 0:i.href;if(typeof s!="string")return;s.endsWith("/")&&(s=s.slice(0,-1));const a=`${s}/wc?requestId=${r}&sessionTopic=${t}`,u=fa();u===ei.browser?a.startsWith("https://")||a.startsWith("http://")?window.open(a,"_blank","noreferrer noopener"):window.open(a,"_self","noreferrer noopener"):u===ei.reactNative&&typeof(Ie==null?void 0:Ie.Linking)<"u"&&await Ie.Linking.openURL(a)}catch(i){console.error(i)}}async function jE(r,t){try{return await r.getItem(t)||(go()?localStorage.getItem(t):void 0)}catch(e){console.error(e)}}var X1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ie<"u"?Ie:typeof self<"u"?self:{};function $E(r){var t=r.default;if(typeof t=="function"){var e=function(){return t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),e}var Z1={exports:{}};/**
|
|
2
2
|
* [js-sha3]{@link https://github.com/emn178/js-sha3}
|
|
3
3
|
*
|
|
4
4
|
* @version 0.8.0
|
|
@@ -40,5 +40,5 @@ __p += '`),be&&(dt+=`' +
|
|
|
40
40
|
function print() { __p += __j.call(arguments, '') }
|
|
41
41
|
`:`;
|
|
42
42
|
`)+dt+`return __p
|
|
43
|
-
}`;var ue=nd(function(){return Se(P,Ft+"return "+dt).apply(e,H)});if(ue.source=dt,mh(ue))throw ue;return ue}function o3(n){return Me(n).toLowerCase()}function a3(n){return Me(n).toUpperCase()}function c3(n,o,c){if(n=Me(n),n&&(c||o===e))return df(n);if(!n||!(o=Jr(o)))return n;var g=Ci(n),A=Ci(o),P=pf(g,A),H=gf(g,A)+1;return $n(g,P,H).join("")}function u3(n,o,c){if(n=Me(n),n&&(c||o===e))return n.slice(0,vf(n)+1);if(!n||!(o=Jr(o)))return n;var g=Ci(n),A=gf(g,Ci(o))+1;return $n(g,0,A).join("")}function h3(n,o,c){if(n=Me(n),n&&(c||o===e))return n.replace(Yt,"");if(!n||!(o=Jr(o)))return n;var g=Ci(n),A=pf(g,Ci(o));return $n(g,A).join("")}function l3(n,o){var c=ft,g=pt;if(Ge(o)){var A="separator"in o?o.separator:A;c="length"in o?ae(o.length):c,g="omission"in o?Jr(o.omission):g}n=Me(n);var P=n.length;if(Ls(n)){var H=Ci(n);P=H.length}if(c>=P)return n;var W=c-qs(g);if(W<1)return g;var X=H?$n(H,0,W).join(""):n.slice(0,W);if(A===e)return X+g;if(H&&(W+=X.length-W),vh(A)){if(n.slice(W).search(A)){var ot,ct=X;for(A.global||(A=Ru(A.source,Me(le.exec(A))+"g")),A.lastIndex=0;ot=A.exec(ct);)var dt=ot.index;X=X.slice(0,dt===e?W:dt)}}else if(n.indexOf(Jr(A),W)!=W){var vt=X.lastIndexOf(A);vt>-1&&(X=X.slice(0,vt))}return X+g}function f3(n){return n=Me(n),n&&Gt.test(n)?n.replace(_e,$m):n}var d3=Vs(function(n,o,c){return n+(c?" ":"")+o.toUpperCase()}),bh=s0("toUpperCase");function id(n,o,c){return n=Me(n),o=c?e:o,o===e?Um(n)?Hm(n):xm(n):n.match(o)||[]}var nd=he(function(n,o){try{return cr(n,e,o)}catch(c){return mh(c)?c:new ee(c)}}),p3=mn(function(n,o){return fi(o,function(c){c=Vi(c),pn(n,c,ph(n[c],n))}),n});function g3(n){var o=n==null?0:n.length,c=jt();return n=o?ke(n,function(g){if(typeof g[1]!="function")throw new di(u);return[c(g[0]),g[1]]}):[],he(function(g){for(var A=-1;++A<o;){var P=n[A];if(cr(P[0],this,g))return cr(P[1],this,g)}})}function m3(n){return $v(gi(n,E))}function _h(n){return function(){return n}}function v3(n,o){return n==null||n!==n?o:n}var y3=a0(),w3=a0(!0);function jr(n){return n}function Eh(n){return Bf(typeof n=="function"?n:gi(n,E))}function b3(n){return qf(gi(n,E))}function _3(n,o){return jf(n,gi(o,E))}var E3=he(function(n,o){return function(c){return Ro(c,n,o)}}),A3=he(function(n,o){return function(c){return Ro(n,c,o)}});function Ah(n,o,c){var g=ur(o),A=ic(o,g);c==null&&!(Ge(o)&&(A.length||!g.length))&&(c=o,o=n,n=this,A=ic(o,ur(o)));var P=!(Ge(c)&&"chain"in c)||!!c.chain,H=yn(n);return fi(A,function(W){var X=o[W];n[W]=X,H&&(n.prototype[W]=function(){var ot=this.__chain__;if(P||ot){var ct=n(this.__wrapped__),dt=ct.__actions__=Br(this.__actions__);return dt.push({func:X,args:arguments,thisArg:n}),ct.__chain__=ot,ct}return X.apply(n,Fn([this.value()],arguments))})}),n}function S3(){return we._===this&&(we._=Qm),this}function Sh(){}function I3(n){return n=ae(n),he(function(o){return $f(o,n)})}var D3=eh(ke),x3=eh(cf),M3=eh(Du);function sd(n){return ch(n)?xu(Vi(n)):ny(n)}function C3(n){return function(o){return n==null?e:ps(n,o)}}var P3=u0(),O3=u0(!0);function Ih(){return[]}function Dh(){return!1}function N3(){return{}}function R3(){return""}function T3(){return!0}function F3(n,o){if(n=ae(n),n<1||n>R)return[];var c=p,g=wr(n,p);o=jt(o),n-=p;for(var A=Pu(g,o);++c<n;)o(c);return A}function U3(n){return ie(n)?ke(n,Vi):Xr(n)?[n]:Br(I0(Me(n)))}function B3(n){var o=++Wm;return Me(n)+o}var L3=uc(function(n,o){return n+o},0),q3=rh("ceil"),j3=uc(function(n,o){return n/o},1),$3=rh("floor");function z3(n){return n&&n.length?rc(n,jr,$u):e}function k3(n,o){return n&&n.length?rc(n,jt(o,2),$u):e}function H3(n){return lf(n,jr)}function K3(n,o){return lf(n,jt(o,2))}function V3(n){return n&&n.length?rc(n,jr,Ku):e}function G3(n,o){return n&&n.length?rc(n,jt(o,2),Ku):e}var W3=uc(function(n,o){return n*o},1),Y3=rh("round"),Q3=uc(function(n,o){return n-o},0);function J3(n){return n&&n.length?Cu(n,jr):0}function X3(n,o){return n&&n.length?Cu(n,jt(o,2)):0}return D.after=bb,D.ary=U0,D.assign=a2,D.assignIn=Q0,D.assignInWith=Ec,D.assignWith=c2,D.at=u2,D.before=B0,D.bind=ph,D.bindAll=p3,D.bindKey=L0,D.castArray=Nb,D.chain=R0,D.chunk=$y,D.compact=zy,D.concat=ky,D.cond=g3,D.conforms=m3,D.constant=_h,D.countBy=Jw,D.create=h2,D.curry=q0,D.curryRight=j0,D.debounce=$0,D.defaults=l2,D.defaultsDeep=f2,D.defer=_b,D.delay=Eb,D.difference=Hy,D.differenceBy=Ky,D.differenceWith=Vy,D.drop=Gy,D.dropRight=Wy,D.dropRightWhile=Yy,D.dropWhile=Qy,D.fill=Jy,D.filter=Zw,D.flatMap=rb,D.flatMapDeep=ib,D.flatMapDepth=nb,D.flatten=C0,D.flattenDeep=Xy,D.flattenDepth=Zy,D.flip=Ab,D.flow=y3,D.flowRight=w3,D.fromPairs=tw,D.functions=w2,D.functionsIn=b2,D.groupBy=sb,D.initial=rw,D.intersection=iw,D.intersectionBy=nw,D.intersectionWith=sw,D.invert=E2,D.invertBy=A2,D.invokeMap=ab,D.iteratee=Eh,D.keyBy=cb,D.keys=ur,D.keysIn=qr,D.map=mc,D.mapKeys=I2,D.mapValues=D2,D.matches=b3,D.matchesProperty=_3,D.memoize=yc,D.merge=x2,D.mergeWith=J0,D.method=E3,D.methodOf=A3,D.mixin=Ah,D.negate=wc,D.nthArg=I3,D.omit=M2,D.omitBy=C2,D.once=Sb,D.orderBy=ub,D.over=D3,D.overArgs=Ib,D.overEvery=x3,D.overSome=M3,D.partial=gh,D.partialRight=z0,D.partition=hb,D.pick=P2,D.pickBy=X0,D.property=sd,D.propertyOf=C3,D.pull=uw,D.pullAll=O0,D.pullAllBy=hw,D.pullAllWith=lw,D.pullAt=fw,D.range=P3,D.rangeRight=O3,D.rearg=Db,D.reject=db,D.remove=dw,D.rest=xb,D.reverse=fh,D.sampleSize=gb,D.set=N2,D.setWith=R2,D.shuffle=mb,D.slice=pw,D.sortBy=wb,D.sortedUniq=_w,D.sortedUniqBy=Ew,D.split=r3,D.spread=Mb,D.tail=Aw,D.take=Sw,D.takeRight=Iw,D.takeRightWhile=Dw,D.takeWhile=xw,D.tap=zw,D.throttle=Cb,D.thru=gc,D.toArray=G0,D.toPairs=Z0,D.toPairsIn=td,D.toPath=U3,D.toPlainObject=Y0,D.transform=T2,D.unary=Pb,D.union=Mw,D.unionBy=Cw,D.unionWith=Pw,D.uniq=Ow,D.uniqBy=Nw,D.uniqWith=Rw,D.unset=F2,D.unzip=dh,D.unzipWith=N0,D.update=U2,D.updateWith=B2,D.values=Ys,D.valuesIn=L2,D.without=Tw,D.words=id,D.wrap=Ob,D.xor=Fw,D.xorBy=Uw,D.xorWith=Bw,D.zip=Lw,D.zipObject=qw,D.zipObjectDeep=jw,D.zipWith=$w,D.entries=Z0,D.entriesIn=td,D.extend=Q0,D.extendWith=Ec,Ah(D,D),D.add=L3,D.attempt=nd,D.camelCase=z2,D.capitalize=ed,D.ceil=q3,D.clamp=q2,D.clone=Rb,D.cloneDeep=Fb,D.cloneDeepWith=Ub,D.cloneWith=Tb,D.conformsTo=Bb,D.deburr=rd,D.defaultTo=v3,D.divide=j3,D.endsWith=k2,D.eq=Oi,D.escape=H2,D.escapeRegExp=K2,D.every=Xw,D.find=tb,D.findIndex=x0,D.findKey=d2,D.findLast=eb,D.findLastIndex=M0,D.findLastKey=p2,D.floor=$3,D.forEach=T0,D.forEachRight=F0,D.forIn=g2,D.forInRight=m2,D.forOwn=v2,D.forOwnRight=y2,D.get=yh,D.gt=Lb,D.gte=qb,D.has=_2,D.hasIn=wh,D.head=P0,D.identity=jr,D.includes=ob,D.indexOf=ew,D.inRange=j2,D.invoke=S2,D.isArguments=vs,D.isArray=ie,D.isArrayBuffer=jb,D.isArrayLike=Lr,D.isArrayLikeObject=Je,D.isBoolean=$b,D.isBuffer=zn,D.isDate=zb,D.isElement=kb,D.isEmpty=Hb,D.isEqual=Kb,D.isEqualWith=Vb,D.isError=mh,D.isFinite=Gb,D.isFunction=yn,D.isInteger=k0,D.isLength=bc,D.isMap=H0,D.isMatch=Wb,D.isMatchWith=Yb,D.isNaN=Qb,D.isNative=Jb,D.isNil=Zb,D.isNull=Xb,D.isNumber=K0,D.isObject=Ge,D.isObjectLike=We,D.isPlainObject=qo,D.isRegExp=vh,D.isSafeInteger=t2,D.isSet=V0,D.isString=_c,D.isSymbol=Xr,D.isTypedArray=Ws,D.isUndefined=e2,D.isWeakMap=r2,D.isWeakSet=i2,D.join=ow,D.kebabCase=V2,D.last=vi,D.lastIndexOf=aw,D.lowerCase=G2,D.lowerFirst=W2,D.lt=n2,D.lte=s2,D.max=z3,D.maxBy=k3,D.mean=H3,D.meanBy=K3,D.min=V3,D.minBy=G3,D.stubArray=Ih,D.stubFalse=Dh,D.stubObject=N3,D.stubString=R3,D.stubTrue=T3,D.multiply=W3,D.nth=cw,D.noConflict=S3,D.noop=Sh,D.now=vc,D.pad=Y2,D.padEnd=Q2,D.padStart=J2,D.parseInt=X2,D.random=$2,D.reduce=lb,D.reduceRight=fb,D.repeat=Z2,D.replace=t3,D.result=O2,D.round=Y3,D.runInContext=J,D.sample=pb,D.size=vb,D.snakeCase=e3,D.some=yb,D.sortedIndex=gw,D.sortedIndexBy=mw,D.sortedIndexOf=vw,D.sortedLastIndex=yw,D.sortedLastIndexBy=ww,D.sortedLastIndexOf=bw,D.startCase=i3,D.startsWith=n3,D.subtract=Q3,D.sum=J3,D.sumBy=X3,D.template=s3,D.times=F3,D.toFinite=wn,D.toInteger=ae,D.toLength=W0,D.toLower=o3,D.toNumber=yi,D.toSafeInteger=o2,D.toString=Me,D.toUpper=a3,D.trim=c3,D.trimEnd=u3,D.trimStart=h3,D.truncate=l3,D.unescape=f3,D.uniqueId=B3,D.upperCase=d3,D.upperFirst=bh,D.each=T0,D.eachRight=F0,D.first=P0,Ah(D,function(){var n={};return Hi(D,function(o,c){Ne.call(D.prototype,c)||(n[c]=o)}),n}(),{chain:!1}),D.VERSION=i,fi(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){D[n].placeholder=D}),fi(["drop","take"],function(n,o){ge.prototype[n]=function(c){c=c===e?1:nr(ae(c),0);var g=this.__filtered__&&!o?new ge(this):this.clone();return g.__filtered__?g.__takeCount__=wr(c,g.__takeCount__):g.__views__.push({size:wr(c,p),type:n+(g.__dir__<0?"Right":"")}),g},ge.prototype[n+"Right"]=function(c){return this.reverse()[n](c).reverse()}}),fi(["filter","map","takeWhile"],function(n,o){var c=o+1,g=c==y||c==M;ge.prototype[n]=function(A){var P=this.clone();return P.__iteratees__.push({iteratee:jt(A,3),type:c}),P.__filtered__=P.__filtered__||g,P}}),fi(["head","last"],function(n,o){var c="take"+(o?"Right":"");ge.prototype[n]=function(){return this[c](1).value()[0]}}),fi(["initial","tail"],function(n,o){var c="drop"+(o?"":"Right");ge.prototype[n]=function(){return this.__filtered__?new ge(this):this[c](1)}}),ge.prototype.compact=function(){return this.filter(jr)},ge.prototype.find=function(n){return this.filter(n).head()},ge.prototype.findLast=function(n){return this.reverse().find(n)},ge.prototype.invokeMap=he(function(n,o){return typeof n=="function"?new ge(this):this.map(function(c){return Ro(c,n,o)})}),ge.prototype.reject=function(n){return this.filter(wc(jt(n)))},ge.prototype.slice=function(n,o){n=ae(n);var c=this;return c.__filtered__&&(n>0||o<0)?new ge(c):(n<0?c=c.takeRight(-n):n&&(c=c.drop(n)),o!==e&&(o=ae(o),c=o<0?c.dropRight(-o):c.take(o-n)),c)},ge.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},ge.prototype.toArray=function(){return this.take(p)},Hi(ge.prototype,function(n,o){var c=/^(?:filter|find|map|reject)|While$/.test(o),g=/^(?:head|last)$/.test(o),A=D[g?"take"+(o=="last"?"Right":""):o],P=g||/^find/.test(o);A&&(D.prototype[o]=function(){var H=this.__wrapped__,W=g?[1]:arguments,X=H instanceof ge,ot=W[0],ct=X||ie(H),dt=function(fe){var be=A.apply(D,Fn([fe],W));return g&&vt?be[0]:be};ct&&c&&typeof ot=="function"&&ot.length!=1&&(X=ct=!1);var vt=this.__chain__,Ft=!!this.__actions__.length,kt=P&&!vt,ue=X&&!Ft;if(!P&&ct){H=ue?H:new ge(this);var Ht=n.apply(H,W);return Ht.__actions__.push({func:gc,args:[dt],thisArg:e}),new pi(Ht,vt)}return kt&&ue?n.apply(this,W):(Ht=this.thru(dt),kt?g?Ht.value()[0]:Ht.value():Ht)})}),fi(["pop","push","shift","sort","splice","unshift"],function(n){var o=$a[n],c=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",g=/^(?:pop|shift)$/.test(n);D.prototype[n]=function(){var A=arguments;if(g&&!this.__chain__){var P=this.value();return o.apply(ie(P)?P:[],A)}return this[c](function(H){return o.apply(ie(H)?H:[],A)})}}),Hi(ge.prototype,function(n,o){var c=D[o];if(c){var g=c.name+"";Ne.call(ks,g)||(ks[g]=[]),ks[g].push({name:o,func:c})}}),ks[cc(e,tt).name]=[{name:"wrapper",func:e}],ge.prototype.clone=fv,ge.prototype.reverse=dv,ge.prototype.value=pv,D.prototype.at=kw,D.prototype.chain=Hw,D.prototype.commit=Kw,D.prototype.next=Vw,D.prototype.plant=Ww,D.prototype.reverse=Yw,D.prototype.toJSON=D.prototype.valueOf=D.prototype.value=Qw,D.prototype.first=D.prototype.head,Do&&(D.prototype[Do]=Gw),D},js=Km();Qe?((Qe.exports=js)._=js,Le._=js):we._=js}).call(Wo)})(Ol,Ol.exports);var r9=Object.defineProperty,i9=Object.defineProperties,n9=Object.getOwnPropertyDescriptors,p1=Object.getOwnPropertySymbols,s9=Object.prototype.hasOwnProperty,o9=Object.prototype.propertyIsEnumerable,g1=(r,t,e)=>t in r?r9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Oc=(r,t)=>{for(var e in t||(t={}))s9.call(t,e)&&g1(r,e,t[e]);if(p1)for(var e of p1(t))o9.call(t,e)&&g1(r,e,t[e]);return r},a9=(r,t)=>i9(r,n9(t));function Yn(r,t,e){var i;const s=Tc(r);return((i=t.rpcMap)==null?void 0:i[s.reference])||`${e9}?chainId=${s.namespace}:${s.reference}&projectId=${e}`}function Ns(r){return r.includes(":")?r.split(":")[1]:r}function bm(r){return r.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function c9(r,t){const e=Object.keys(t.namespaces).filter(s=>s.includes(r));if(!e.length)return[];const i=[];return e.forEach(s=>{const a=t.namespaces[s].accounts;i.push(...a)}),i}function nl(r={},t={}){const e=m1(r),i=m1(t);return Ol.exports.merge(e,i)}function m1(r){var t,e,i,s;const a={};if(!sa(r))return a;for(const[u,l]of Object.entries(r)){const m=Ql(u)?[u]:l.chains,f=l.methods||[],w=l.events||[],E=l.rpcMap||{},x=Jo(u);a[x]=a9(Oc(Oc({},a[x]),l),{chains:Fc(m,(t=a[x])==null?void 0:t.chains),methods:Fc(f,(e=a[x])==null?void 0:e.methods),events:Fc(w,(i=a[x])==null?void 0:i.events),rpcMap:Oc(Oc({},E),(s=a[x])==null?void 0:s.rpcMap)})}return a}function u9(r){return r.includes(":")?r.split(":")[2]:r}function v1(r){const t={};for(const[e,i]of Object.entries(r)){const s=i.methods||[],a=i.events||[],u=i.accounts||[],l=Ql(e)?[e]:i.chains?i.chains:bm(i.accounts);t[e]={chains:l,methods:s,events:a,accounts:u}}return t}function sl(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const _m={},He=r=>_m[r],ol=(r,t)=>{_m[r]=t};class h9{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=Ns(e);t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}var l9=Object.defineProperty,f9=Object.defineProperties,d9=Object.getOwnPropertyDescriptors,y1=Object.getOwnPropertySymbols,p9=Object.prototype.hasOwnProperty,g9=Object.prototype.propertyIsEnumerable,w1=(r,t,e)=>t in r?l9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,b1=(r,t)=>{for(var e in t||(t={}))p9.call(t,e)&&w1(r,e,t[e]);if(y1)for(var e of y1(t))g9.call(t,e)&&w1(r,e,t[e]);return r},_1=(r,t)=>f9(r,d9(t));class m9{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(parseInt(t),e),this.chainId=parseInt(t),this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,e){const i=e||Yn(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=parseInt(Ns(e));t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}async handleSwitchChain(t){var e,i;let s=t.request.params?(e=t.request.params[0])==null?void 0:e.chainId:"0x0";s=s.startsWith("0x")?s:`0x${s}`;const a=parseInt(s,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:s}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var e,i,s;const a=(i=(e=t.request)==null?void 0:e.params)==null?void 0:i[0];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const u=this.client.session.get(t.topic),l=((s=u==null?void 0:u.sessionProperties)==null?void 0:s.capabilities)||{};if(l!=null&&l[a])return l==null?void 0:l[a];const m=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:_1(b1({},u.sessionProperties||{}),{capabilities:_1(b1({},l||{}),{[a]:m})})})}catch(f){console.warn("Failed to update session with capabilities",f)}return m}}class v9{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=Ns(e);t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}class y9{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=Ns(e);t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}class w9{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{const i=this.getCardanoRPCUrl(e),s=Ns(e);t[s]=this.createHttpProvider(s,i)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}getCardanoRPCUrl(t){const e=this.namespace.rpcMap;if(e)return e[t]}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||this.getCardanoRPCUrl(t);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}class b9{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=Ns(e);t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}class _9{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=Ns(e);t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}class E9{constructor(t){this.name="near",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(this.chainId=t,!this.httpProviders[t]){const i=e||Yn(`${this.name}:${t}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,i)}this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;t[e]=this.createHttpProvider(e,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace);return typeof i>"u"?void 0:new Cn(new Jn(i,He("disableProviderPing")))}}var A9=Object.defineProperty,S9=Object.defineProperties,I9=Object.getOwnPropertyDescriptors,E1=Object.getOwnPropertySymbols,D9=Object.prototype.hasOwnProperty,x9=Object.prototype.propertyIsEnumerable,A1=(r,t,e)=>t in r?A9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Nc=(r,t)=>{for(var e in t||(t={}))D9.call(t,e)&&A1(r,e,t[e]);if(E1)for(var e of E1(t))x9.call(t,e)&&A1(r,e,t[e]);return r},al=(r,t)=>S9(r,I9(t));class of{constructor(t){this.events=new Fl,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:ya(fu({level:(t==null?void 0:t.logger)||f1})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const e=new of(t);return await e.initialize(),e}async request(t,e,i){const[s,a]=this.validateChain(e);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:Nc({},t),chainId:`${s}:${a}`,topic:this.session.topic,expiry:i})}sendAsync(t,e,i,s){const a=new Date().getTime();this.request(t,i,s).then(u=>e(null,du(a,u))).catch(u=>e(u,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 t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Re("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:e,response:i}=await this.client.authenticate(t);e&&(this.uri=e,this.events.emit("display_uri",e));const s=await i();if(this.session=s.session,this.session){const a=v1(this.session.namespaces);this.namespaces=nl(this.namespaces,a),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}removeListener(t,e){this.events.removeListener(t,e)}off(t,e){this.events.off(t,e)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let e=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(e>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:s}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await s().then(a=>{this.session=a;const u=v1(a.namespaces);this.namespaces=nl(this.namespaces,u),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==wm)throw a;e++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,e){try{if(!this.session)return;const[i,s]=this.validateChain(t);this.getProvider(i).setDefaultChain(s,e)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const e=this.client.pairing.getAll();if(un(e)){for(const i of e)t.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${e.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 t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await sf.init({logger:this.providerOpts.logger||f1,relayUrl:this.providerOpts.relayUrl||X7,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 t=[...new Set(Object.keys(this.session.namespaces).map(e=>Jo(e)))];ol("client",this.client),ol("events",this.events),ol("disableProviderPing",this.disableProviderPing),t.forEach(e=>{if(!this.session)return;const i=c9(e,this.session),s=bm(i),a=nl(this.namespaces,this.optionalNamespaces),u=al(Nc({},a[e]),{accounts:i,chains:s});switch(e){case"eip155":this.rpcProviders[e]=new m9({namespace:u});break;case"solana":this.rpcProviders[e]=new v9({namespace:u});break;case"cosmos":this.rpcProviders[e]=new y9({namespace:u});break;case"polkadot":this.rpcProviders[e]=new h9({namespace:u});break;case"cip34":this.rpcProviders[e]=new w9({namespace:u});break;case"elrond":this.rpcProviders[e]=new b9({namespace:u});break;case"multiversx":this.rpcProviders[e]=new _9({namespace:u});break;case"near":this.rpcProviders[e]=new E9({namespace:u});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:e}=t,{event:i}=e;if(i.name==="accountsChanged"){const s=i.data;s&&un(s)&&this.events.emit("accountsChanged",s.map(u9))}else if(i.name==="chainChanged"){const s=e.chainId,a=e.event.data,u=Jo(s),l=sl(s)!==sl(a)?`${u}:${sl(a)}`:s;this.onChainChanged(l)}else this.events.emit(i.name,i.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:e})=>{var i;const{namespaces:s}=e,a=(i=this.client)==null?void 0:i.session.get(t);this.session=al(Nc({},a),{namespaces:s}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:e})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",al(Nc({},Re("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Pn.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var e;this.getProvider(t).updateNamespace((e=this.session)==null?void 0:e.namespaces[t])})}setNamespaces(t){const{namespaces:e,optionalNamespaces:i,sessionProperties:s}=t;e&&Object.keys(e).length&&(this.namespaces=e),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=s,this.persist("namespaces",e),this.persist("optionalNamespaces",i)}validateChain(t){const[e,i]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[e,i];if(e&&!Object.keys(this.namespaces||{}).map(u=>Jo(u)).includes(e))throw new Error(`Namespace '${e}' is not configured. Please call connect() first with namespace config.`);if(e&&i)return[e,i];const s=Jo(Object.keys(this.namespaces)[0]),a=this.rpcProviders[s].getDefaultChain();return[s,a]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,e=!1){if(!this.namespaces)return;const[i,s]=this.validateChain(t);s&&(e||this.getProvider(i).setDefaultChain(s),this.namespaces[i]?this.namespaces[i].defaultChain=s:this.namespaces[`${i}:${s}`]?this.namespaces[`${i}:${s}`].defaultChain=s:this.namespaces[`${i}:${s}`]={defaultChain:s},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",s))}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(t,e){this.client.core.storage.setItem(`${d1}/${t}`,e)}async getFromStore(t){return await this.client.core.storage.getItem(`${d1}/${t}`)}}const M9=of,C9="wc",P9="ethereum_provider",O9=`${C9}@2:${P9}:`,N9="https://rpc.walletconnect.com/v1/",Nl=["eth_sendTransaction","personal_sign"],R9=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],Rl=["chainChanged","accountsChanged"],T9=["chainChanged","accountsChanged","message","disconnect","connect"];var F9=Object.defineProperty,U9=Object.defineProperties,B9=Object.getOwnPropertyDescriptors,S1=Object.getOwnPropertySymbols,L9=Object.prototype.hasOwnProperty,q9=Object.prototype.propertyIsEnumerable,I1=(r,t,e)=>t in r?F9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ro=(r,t)=>{for(var e in t||(t={}))L9.call(t,e)&&I1(r,e,t[e]);if(S1)for(var e of S1(t))q9.call(t,e)&&I1(r,e,t[e]);return r},cl=(r,t)=>U9(r,B9(t));function iu(r){return Number(r[0].split(":")[1])}function Rc(r){return`0x${r.toString(16)}`}function j9(r){const{chains:t,optionalChains:e,methods:i,optionalMethods:s,events:a,optionalEvents:u,rpcMap:l}=r;if(!un(t))throw new Error("Invalid chains");const m={chains:t,methods:i||Nl,events:a||Rl,rpcMap:ro({},t.length?{[iu(t)]:l[iu(t)]}:{})},f=a==null?void 0:a.filter(I=>!Rl.includes(I)),w=i==null?void 0:i.filter(I=>!Nl.includes(I));if(!e&&!u&&!s&&!(f!=null&&f.length)&&!(w!=null&&w.length))return{required:t.length?m:void 0};const E=(f==null?void 0:f.length)&&(w==null?void 0:w.length)||!e,x={chains:[...new Set(E?m.chains.concat(e||[]):e)],methods:[...new Set(m.methods.concat(s!=null&&s.length?s:R9))],events:[...new Set(m.events.concat(u!=null&&u.length?u:T9))],rpcMap:l};return{required:t.length?m:void 0,optional:e.length?x:void 0}}class af{constructor(){this.events=new Di.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=O9,this.on=(t,e)=>(this.events.on(t,e),this),this.once=(t,e)=>(this.events.once(t,e),this),this.removeListener=(t,e)=>(this.events.removeListener(t,e),this),this.off=(t,e)=>(this.events.off(t,e),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const e=new af;return await e.initialize(t),e}async request(t,e){return await this.signer.request(t,this.formatChainId(this.chainId),e)}sendAsync(t,e,i){this.signer.sendAsync(t,e,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:e,optional:i}=j9(this.rpc);try{const s=await new Promise(async(u,l)=>{var m;this.rpc.showQrModal&&((m=this.modal)==null||m.subscribeModal(f=>{!f.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),l(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(cl(ro({namespaces:ro({},e&&{[this.namespace]:e})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(f=>{u(f)}).catch(f=>{l(new Error(f.message))})});if(!s)return;const a=Cd(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Rc(this.chainId)})}catch(s){throw this.signer.logger.error(s),s}finally{this.modal&&this.modal.closeModal()}}async authenticate(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:t==null?void 0:t.chains});try{const e=await new Promise(async(s,a)=>{var u;this.rpc.showQrModal&&((u=this.modal)==null||u.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(cl(ro({},t),{chains:this.rpc.chains})).then(l=>{s(l)}).catch(l=>{a(new Error(l.message))})}),i=e.session;if(i){const s=Cd(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:Rc(this.chainId)})}return e}catch(e){throw this.signer.logger.error(e),e}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",t=>{const{params:e}=t,{event:i}=e;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const e=parseInt(t);this.chainId=e,this.events.emit("chainChanged",Rc(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",cl(ro({},Re("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var e,i;this.rpc.showQrModal&&((e=this.modal)==null||e.closeModal(),(i=this.modal)==null||i.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const e=t.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));e.length&&(this.chainId=e[0],this.events.emit("chainChanged",Rc(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const e=this.parseChainId(t);this.chainId=e,this.switchEthereumChain(e)}}parseAccountId(t){const[e,i,s]=t.split(":");return{chainId:`${e}:${i}`,address:s}}setAccounts(t){this.accounts=t.filter(e=>this.parseChainId(this.parseAccountId(e).chainId)===this.chainId).map(e=>this.parseAccountId(e).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var e,i;const s=(e=t==null?void 0:t.chains)!=null?e:[],a=(i=t==null?void 0:t.optionalChains)!=null?i:[],u=s.concat(a);if(!u.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const l=s.length?(t==null?void 0:t.methods)||Nl:[],m=s.length?(t==null?void 0:t.events)||Rl:[],f=(t==null?void 0:t.optionalMethods)||[],w=(t==null?void 0:t.optionalEvents)||[],E=(t==null?void 0:t.rpcMap)||this.buildRpcMap(u,t.projectId),x=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:s==null?void 0:s.map(I=>this.formatChainId(I)),optionalChains:a.map(I=>this.formatChainId(I)),methods:l,events:m,optionalMethods:f,optionalEvents:w,rpcMap:E,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:x,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,e){const i={};return t.forEach(s=>{i[s]=this.getRpcUrl(s,e)}),i}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?iu(this.rpc.chains):iu(this.rpc.optionalChains),this.signer=await M9.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let e;try{const{WalletConnectModal:i}=await e6(()=>import("./index-c906fe37.js").then(s=>s.i),["assets/index-c906fe37.js","assets/index-c1d19e23.js","assets/index-26b3bea2.css"]);e=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(e)try{this.modal=new e(ro({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:e,optionalChains:i,rpcMap:s}=t;e&&un(e)&&(this.rpc.chains=e.map(a=>this.formatChainId(a)),e.forEach(a=>{this.rpc.rpcMap[a]=(s==null?void 0:s[a])||this.getRpcUrl(a)})),i&&un(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i==null?void 0:i.map(a=>this.formatChainId(a)),i.forEach(a=>{this.rpc.rpcMap[a]=(s==null?void 0:s[a])||this.getRpcUrl(a)}))}getRpcUrl(t,e){var i;return((i=this.rpc.rpcMap)==null?void 0:i[t])||`${N9}?chainId=eip155:${t}&projectId=${e||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),e=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:e==null?void 0:e.accounts),this.setAccounts(e==null?void 0:e.accounts)}catch(t){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(t),await this.disconnect().catch(e=>this.signer.logger.warn(e))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(e=>this.parseAccount(e))}}const pM=af;export{pM as EthereumProvider,T9 as OPTIONAL_EVENTS,R9 as OPTIONAL_METHODS,Rl as REQUIRED_EVENTS,Nl as REQUIRED_METHODS,af as default};
|
|
44
|
-
//# sourceMappingURL=index.es-
|
|
43
|
+
}`;var ue=nd(function(){return Se(P,Ft+"return "+dt).apply(e,H)});if(ue.source=dt,mh(ue))throw ue;return ue}function o3(n){return Me(n).toLowerCase()}function a3(n){return Me(n).toUpperCase()}function c3(n,o,c){if(n=Me(n),n&&(c||o===e))return df(n);if(!n||!(o=Jr(o)))return n;var g=Ci(n),A=Ci(o),P=pf(g,A),H=gf(g,A)+1;return $n(g,P,H).join("")}function u3(n,o,c){if(n=Me(n),n&&(c||o===e))return n.slice(0,vf(n)+1);if(!n||!(o=Jr(o)))return n;var g=Ci(n),A=gf(g,Ci(o))+1;return $n(g,0,A).join("")}function h3(n,o,c){if(n=Me(n),n&&(c||o===e))return n.replace(Yt,"");if(!n||!(o=Jr(o)))return n;var g=Ci(n),A=pf(g,Ci(o));return $n(g,A).join("")}function l3(n,o){var c=ft,g=pt;if(Ge(o)){var A="separator"in o?o.separator:A;c="length"in o?ae(o.length):c,g="omission"in o?Jr(o.omission):g}n=Me(n);var P=n.length;if(Ls(n)){var H=Ci(n);P=H.length}if(c>=P)return n;var W=c-qs(g);if(W<1)return g;var X=H?$n(H,0,W).join(""):n.slice(0,W);if(A===e)return X+g;if(H&&(W+=X.length-W),vh(A)){if(n.slice(W).search(A)){var ot,ct=X;for(A.global||(A=Ru(A.source,Me(le.exec(A))+"g")),A.lastIndex=0;ot=A.exec(ct);)var dt=ot.index;X=X.slice(0,dt===e?W:dt)}}else if(n.indexOf(Jr(A),W)!=W){var vt=X.lastIndexOf(A);vt>-1&&(X=X.slice(0,vt))}return X+g}function f3(n){return n=Me(n),n&&Gt.test(n)?n.replace(_e,$m):n}var d3=Vs(function(n,o,c){return n+(c?" ":"")+o.toUpperCase()}),bh=s0("toUpperCase");function id(n,o,c){return n=Me(n),o=c?e:o,o===e?Um(n)?Hm(n):xm(n):n.match(o)||[]}var nd=he(function(n,o){try{return cr(n,e,o)}catch(c){return mh(c)?c:new ee(c)}}),p3=mn(function(n,o){return fi(o,function(c){c=Vi(c),pn(n,c,ph(n[c],n))}),n});function g3(n){var o=n==null?0:n.length,c=jt();return n=o?ke(n,function(g){if(typeof g[1]!="function")throw new di(u);return[c(g[0]),g[1]]}):[],he(function(g){for(var A=-1;++A<o;){var P=n[A];if(cr(P[0],this,g))return cr(P[1],this,g)}})}function m3(n){return $v(gi(n,E))}function _h(n){return function(){return n}}function v3(n,o){return n==null||n!==n?o:n}var y3=a0(),w3=a0(!0);function jr(n){return n}function Eh(n){return Bf(typeof n=="function"?n:gi(n,E))}function b3(n){return qf(gi(n,E))}function _3(n,o){return jf(n,gi(o,E))}var E3=he(function(n,o){return function(c){return Ro(c,n,o)}}),A3=he(function(n,o){return function(c){return Ro(n,c,o)}});function Ah(n,o,c){var g=ur(o),A=ic(o,g);c==null&&!(Ge(o)&&(A.length||!g.length))&&(c=o,o=n,n=this,A=ic(o,ur(o)));var P=!(Ge(c)&&"chain"in c)||!!c.chain,H=yn(n);return fi(A,function(W){var X=o[W];n[W]=X,H&&(n.prototype[W]=function(){var ot=this.__chain__;if(P||ot){var ct=n(this.__wrapped__),dt=ct.__actions__=Br(this.__actions__);return dt.push({func:X,args:arguments,thisArg:n}),ct.__chain__=ot,ct}return X.apply(n,Fn([this.value()],arguments))})}),n}function S3(){return we._===this&&(we._=Qm),this}function Sh(){}function I3(n){return n=ae(n),he(function(o){return $f(o,n)})}var D3=eh(ke),x3=eh(cf),M3=eh(Du);function sd(n){return ch(n)?xu(Vi(n)):ny(n)}function C3(n){return function(o){return n==null?e:ps(n,o)}}var P3=u0(),O3=u0(!0);function Ih(){return[]}function Dh(){return!1}function N3(){return{}}function R3(){return""}function T3(){return!0}function F3(n,o){if(n=ae(n),n<1||n>R)return[];var c=p,g=wr(n,p);o=jt(o),n-=p;for(var A=Pu(g,o);++c<n;)o(c);return A}function U3(n){return ie(n)?ke(n,Vi):Xr(n)?[n]:Br(I0(Me(n)))}function B3(n){var o=++Wm;return Me(n)+o}var L3=uc(function(n,o){return n+o},0),q3=rh("ceil"),j3=uc(function(n,o){return n/o},1),$3=rh("floor");function z3(n){return n&&n.length?rc(n,jr,$u):e}function k3(n,o){return n&&n.length?rc(n,jt(o,2),$u):e}function H3(n){return lf(n,jr)}function K3(n,o){return lf(n,jt(o,2))}function V3(n){return n&&n.length?rc(n,jr,Ku):e}function G3(n,o){return n&&n.length?rc(n,jt(o,2),Ku):e}var W3=uc(function(n,o){return n*o},1),Y3=rh("round"),Q3=uc(function(n,o){return n-o},0);function J3(n){return n&&n.length?Cu(n,jr):0}function X3(n,o){return n&&n.length?Cu(n,jt(o,2)):0}return D.after=bb,D.ary=U0,D.assign=a2,D.assignIn=Q0,D.assignInWith=Ec,D.assignWith=c2,D.at=u2,D.before=B0,D.bind=ph,D.bindAll=p3,D.bindKey=L0,D.castArray=Nb,D.chain=R0,D.chunk=$y,D.compact=zy,D.concat=ky,D.cond=g3,D.conforms=m3,D.constant=_h,D.countBy=Jw,D.create=h2,D.curry=q0,D.curryRight=j0,D.debounce=$0,D.defaults=l2,D.defaultsDeep=f2,D.defer=_b,D.delay=Eb,D.difference=Hy,D.differenceBy=Ky,D.differenceWith=Vy,D.drop=Gy,D.dropRight=Wy,D.dropRightWhile=Yy,D.dropWhile=Qy,D.fill=Jy,D.filter=Zw,D.flatMap=rb,D.flatMapDeep=ib,D.flatMapDepth=nb,D.flatten=C0,D.flattenDeep=Xy,D.flattenDepth=Zy,D.flip=Ab,D.flow=y3,D.flowRight=w3,D.fromPairs=tw,D.functions=w2,D.functionsIn=b2,D.groupBy=sb,D.initial=rw,D.intersection=iw,D.intersectionBy=nw,D.intersectionWith=sw,D.invert=E2,D.invertBy=A2,D.invokeMap=ab,D.iteratee=Eh,D.keyBy=cb,D.keys=ur,D.keysIn=qr,D.map=mc,D.mapKeys=I2,D.mapValues=D2,D.matches=b3,D.matchesProperty=_3,D.memoize=yc,D.merge=x2,D.mergeWith=J0,D.method=E3,D.methodOf=A3,D.mixin=Ah,D.negate=wc,D.nthArg=I3,D.omit=M2,D.omitBy=C2,D.once=Sb,D.orderBy=ub,D.over=D3,D.overArgs=Ib,D.overEvery=x3,D.overSome=M3,D.partial=gh,D.partialRight=z0,D.partition=hb,D.pick=P2,D.pickBy=X0,D.property=sd,D.propertyOf=C3,D.pull=uw,D.pullAll=O0,D.pullAllBy=hw,D.pullAllWith=lw,D.pullAt=fw,D.range=P3,D.rangeRight=O3,D.rearg=Db,D.reject=db,D.remove=dw,D.rest=xb,D.reverse=fh,D.sampleSize=gb,D.set=N2,D.setWith=R2,D.shuffle=mb,D.slice=pw,D.sortBy=wb,D.sortedUniq=_w,D.sortedUniqBy=Ew,D.split=r3,D.spread=Mb,D.tail=Aw,D.take=Sw,D.takeRight=Iw,D.takeRightWhile=Dw,D.takeWhile=xw,D.tap=zw,D.throttle=Cb,D.thru=gc,D.toArray=G0,D.toPairs=Z0,D.toPairsIn=td,D.toPath=U3,D.toPlainObject=Y0,D.transform=T2,D.unary=Pb,D.union=Mw,D.unionBy=Cw,D.unionWith=Pw,D.uniq=Ow,D.uniqBy=Nw,D.uniqWith=Rw,D.unset=F2,D.unzip=dh,D.unzipWith=N0,D.update=U2,D.updateWith=B2,D.values=Ys,D.valuesIn=L2,D.without=Tw,D.words=id,D.wrap=Ob,D.xor=Fw,D.xorBy=Uw,D.xorWith=Bw,D.zip=Lw,D.zipObject=qw,D.zipObjectDeep=jw,D.zipWith=$w,D.entries=Z0,D.entriesIn=td,D.extend=Q0,D.extendWith=Ec,Ah(D,D),D.add=L3,D.attempt=nd,D.camelCase=z2,D.capitalize=ed,D.ceil=q3,D.clamp=q2,D.clone=Rb,D.cloneDeep=Fb,D.cloneDeepWith=Ub,D.cloneWith=Tb,D.conformsTo=Bb,D.deburr=rd,D.defaultTo=v3,D.divide=j3,D.endsWith=k2,D.eq=Oi,D.escape=H2,D.escapeRegExp=K2,D.every=Xw,D.find=tb,D.findIndex=x0,D.findKey=d2,D.findLast=eb,D.findLastIndex=M0,D.findLastKey=p2,D.floor=$3,D.forEach=T0,D.forEachRight=F0,D.forIn=g2,D.forInRight=m2,D.forOwn=v2,D.forOwnRight=y2,D.get=yh,D.gt=Lb,D.gte=qb,D.has=_2,D.hasIn=wh,D.head=P0,D.identity=jr,D.includes=ob,D.indexOf=ew,D.inRange=j2,D.invoke=S2,D.isArguments=vs,D.isArray=ie,D.isArrayBuffer=jb,D.isArrayLike=Lr,D.isArrayLikeObject=Je,D.isBoolean=$b,D.isBuffer=zn,D.isDate=zb,D.isElement=kb,D.isEmpty=Hb,D.isEqual=Kb,D.isEqualWith=Vb,D.isError=mh,D.isFinite=Gb,D.isFunction=yn,D.isInteger=k0,D.isLength=bc,D.isMap=H0,D.isMatch=Wb,D.isMatchWith=Yb,D.isNaN=Qb,D.isNative=Jb,D.isNil=Zb,D.isNull=Xb,D.isNumber=K0,D.isObject=Ge,D.isObjectLike=We,D.isPlainObject=qo,D.isRegExp=vh,D.isSafeInteger=t2,D.isSet=V0,D.isString=_c,D.isSymbol=Xr,D.isTypedArray=Ws,D.isUndefined=e2,D.isWeakMap=r2,D.isWeakSet=i2,D.join=ow,D.kebabCase=V2,D.last=vi,D.lastIndexOf=aw,D.lowerCase=G2,D.lowerFirst=W2,D.lt=n2,D.lte=s2,D.max=z3,D.maxBy=k3,D.mean=H3,D.meanBy=K3,D.min=V3,D.minBy=G3,D.stubArray=Ih,D.stubFalse=Dh,D.stubObject=N3,D.stubString=R3,D.stubTrue=T3,D.multiply=W3,D.nth=cw,D.noConflict=S3,D.noop=Sh,D.now=vc,D.pad=Y2,D.padEnd=Q2,D.padStart=J2,D.parseInt=X2,D.random=$2,D.reduce=lb,D.reduceRight=fb,D.repeat=Z2,D.replace=t3,D.result=O2,D.round=Y3,D.runInContext=J,D.sample=pb,D.size=vb,D.snakeCase=e3,D.some=yb,D.sortedIndex=gw,D.sortedIndexBy=mw,D.sortedIndexOf=vw,D.sortedLastIndex=yw,D.sortedLastIndexBy=ww,D.sortedLastIndexOf=bw,D.startCase=i3,D.startsWith=n3,D.subtract=Q3,D.sum=J3,D.sumBy=X3,D.template=s3,D.times=F3,D.toFinite=wn,D.toInteger=ae,D.toLength=W0,D.toLower=o3,D.toNumber=yi,D.toSafeInteger=o2,D.toString=Me,D.toUpper=a3,D.trim=c3,D.trimEnd=u3,D.trimStart=h3,D.truncate=l3,D.unescape=f3,D.uniqueId=B3,D.upperCase=d3,D.upperFirst=bh,D.each=T0,D.eachRight=F0,D.first=P0,Ah(D,function(){var n={};return Hi(D,function(o,c){Ne.call(D.prototype,c)||(n[c]=o)}),n}(),{chain:!1}),D.VERSION=i,fi(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){D[n].placeholder=D}),fi(["drop","take"],function(n,o){ge.prototype[n]=function(c){c=c===e?1:nr(ae(c),0);var g=this.__filtered__&&!o?new ge(this):this.clone();return g.__filtered__?g.__takeCount__=wr(c,g.__takeCount__):g.__views__.push({size:wr(c,p),type:n+(g.__dir__<0?"Right":"")}),g},ge.prototype[n+"Right"]=function(c){return this.reverse()[n](c).reverse()}}),fi(["filter","map","takeWhile"],function(n,o){var c=o+1,g=c==y||c==M;ge.prototype[n]=function(A){var P=this.clone();return P.__iteratees__.push({iteratee:jt(A,3),type:c}),P.__filtered__=P.__filtered__||g,P}}),fi(["head","last"],function(n,o){var c="take"+(o?"Right":"");ge.prototype[n]=function(){return this[c](1).value()[0]}}),fi(["initial","tail"],function(n,o){var c="drop"+(o?"":"Right");ge.prototype[n]=function(){return this.__filtered__?new ge(this):this[c](1)}}),ge.prototype.compact=function(){return this.filter(jr)},ge.prototype.find=function(n){return this.filter(n).head()},ge.prototype.findLast=function(n){return this.reverse().find(n)},ge.prototype.invokeMap=he(function(n,o){return typeof n=="function"?new ge(this):this.map(function(c){return Ro(c,n,o)})}),ge.prototype.reject=function(n){return this.filter(wc(jt(n)))},ge.prototype.slice=function(n,o){n=ae(n);var c=this;return c.__filtered__&&(n>0||o<0)?new ge(c):(n<0?c=c.takeRight(-n):n&&(c=c.drop(n)),o!==e&&(o=ae(o),c=o<0?c.dropRight(-o):c.take(o-n)),c)},ge.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},ge.prototype.toArray=function(){return this.take(p)},Hi(ge.prototype,function(n,o){var c=/^(?:filter|find|map|reject)|While$/.test(o),g=/^(?:head|last)$/.test(o),A=D[g?"take"+(o=="last"?"Right":""):o],P=g||/^find/.test(o);A&&(D.prototype[o]=function(){var H=this.__wrapped__,W=g?[1]:arguments,X=H instanceof ge,ot=W[0],ct=X||ie(H),dt=function(fe){var be=A.apply(D,Fn([fe],W));return g&&vt?be[0]:be};ct&&c&&typeof ot=="function"&&ot.length!=1&&(X=ct=!1);var vt=this.__chain__,Ft=!!this.__actions__.length,kt=P&&!vt,ue=X&&!Ft;if(!P&&ct){H=ue?H:new ge(this);var Ht=n.apply(H,W);return Ht.__actions__.push({func:gc,args:[dt],thisArg:e}),new pi(Ht,vt)}return kt&&ue?n.apply(this,W):(Ht=this.thru(dt),kt?g?Ht.value()[0]:Ht.value():Ht)})}),fi(["pop","push","shift","sort","splice","unshift"],function(n){var o=$a[n],c=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",g=/^(?:pop|shift)$/.test(n);D.prototype[n]=function(){var A=arguments;if(g&&!this.__chain__){var P=this.value();return o.apply(ie(P)?P:[],A)}return this[c](function(H){return o.apply(ie(H)?H:[],A)})}}),Hi(ge.prototype,function(n,o){var c=D[o];if(c){var g=c.name+"";Ne.call(ks,g)||(ks[g]=[]),ks[g].push({name:o,func:c})}}),ks[cc(e,tt).name]=[{name:"wrapper",func:e}],ge.prototype.clone=fv,ge.prototype.reverse=dv,ge.prototype.value=pv,D.prototype.at=kw,D.prototype.chain=Hw,D.prototype.commit=Kw,D.prototype.next=Vw,D.prototype.plant=Ww,D.prototype.reverse=Yw,D.prototype.toJSON=D.prototype.valueOf=D.prototype.value=Qw,D.prototype.first=D.prototype.head,Do&&(D.prototype[Do]=Gw),D},js=Km();Qe?((Qe.exports=js)._=js,Le._=js):we._=js}).call(Wo)})(Ol,Ol.exports);var r9=Object.defineProperty,i9=Object.defineProperties,n9=Object.getOwnPropertyDescriptors,p1=Object.getOwnPropertySymbols,s9=Object.prototype.hasOwnProperty,o9=Object.prototype.propertyIsEnumerable,g1=(r,t,e)=>t in r?r9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Oc=(r,t)=>{for(var e in t||(t={}))s9.call(t,e)&&g1(r,e,t[e]);if(p1)for(var e of p1(t))o9.call(t,e)&&g1(r,e,t[e]);return r},a9=(r,t)=>i9(r,n9(t));function Yn(r,t,e){var i;const s=Tc(r);return((i=t.rpcMap)==null?void 0:i[s.reference])||`${e9}?chainId=${s.namespace}:${s.reference}&projectId=${e}`}function Ns(r){return r.includes(":")?r.split(":")[1]:r}function bm(r){return r.map(t=>`${t.split(":")[0]}:${t.split(":")[1]}`)}function c9(r,t){const e=Object.keys(t.namespaces).filter(s=>s.includes(r));if(!e.length)return[];const i=[];return e.forEach(s=>{const a=t.namespaces[s].accounts;i.push(...a)}),i}function nl(r={},t={}){const e=m1(r),i=m1(t);return Ol.exports.merge(e,i)}function m1(r){var t,e,i,s;const a={};if(!sa(r))return a;for(const[u,l]of Object.entries(r)){const m=Ql(u)?[u]:l.chains,f=l.methods||[],w=l.events||[],E=l.rpcMap||{},x=Jo(u);a[x]=a9(Oc(Oc({},a[x]),l),{chains:Fc(m,(t=a[x])==null?void 0:t.chains),methods:Fc(f,(e=a[x])==null?void 0:e.methods),events:Fc(w,(i=a[x])==null?void 0:i.events),rpcMap:Oc(Oc({},E),(s=a[x])==null?void 0:s.rpcMap)})}return a}function u9(r){return r.includes(":")?r.split(":")[2]:r}function v1(r){const t={};for(const[e,i]of Object.entries(r)){const s=i.methods||[],a=i.events||[],u=i.accounts||[],l=Ql(e)?[e]:i.chains?i.chains:bm(i.accounts);t[e]={chains:l,methods:s,events:a,accounts:u}}return t}function sl(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const _m={},He=r=>_m[r],ol=(r,t)=>{_m[r]=t};class h9{constructor(t){this.name="polkadot",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=Ns(e);t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}var l9=Object.defineProperty,f9=Object.defineProperties,d9=Object.getOwnPropertyDescriptors,y1=Object.getOwnPropertySymbols,p9=Object.prototype.hasOwnProperty,g9=Object.prototype.propertyIsEnumerable,w1=(r,t,e)=>t in r?l9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,b1=(r,t)=>{for(var e in t||(t={}))p9.call(t,e)&&w1(r,e,t[e]);if(y1)for(var e of y1(t))g9.call(t,e)&&w1(r,e,t[e]);return r},_1=(r,t)=>f9(r,d9(t));class m9{constructor(t){this.name="eip155",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(t){switch(t.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(t);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(t)}return this.namespace.methods.includes(t.request.method)?await this.client.request(t):this.getHttpProvider().request(t.request)}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(parseInt(t),e),this.chainId=parseInt(t),this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}createHttpProvider(t,e){const i=e||Yn(`${this.name}:${t}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=parseInt(Ns(e));t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(){const t=this.chainId,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}async handleSwitchChain(t){var e,i;let s=t.request.params?(e=t.request.params[0])==null?void 0:e.chainId:"0x0";s=s.startsWith("0x")?s:`0x${s}`;const a=parseInt(s,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:t.topic,request:{method:t.request.method,params:[{chainId:s}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(t){return this.namespace.chains.includes(`${this.name}:${t}`)}async getCapabilities(t){var e,i,s;const a=(i=(e=t.request)==null?void 0:e.params)==null?void 0:i[0];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const u=this.client.session.get(t.topic),l=((s=u==null?void 0:u.sessionProperties)==null?void 0:s.capabilities)||{};if(l!=null&&l[a])return l==null?void 0:l[a];const m=await this.client.request(t);try{await this.client.session.update(t.topic,{sessionProperties:_1(b1({},u.sessionProperties||{}),{capabilities:_1(b1({},l||{}),{[a]:m})})})}catch(f){console.warn("Failed to update session with capabilities",f)}return m}}class v9{constructor(t){this.name="solana",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=Ns(e);t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}class y9{constructor(t){this.name="cosmos",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=Ns(e);t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}class w9{constructor(t){this.name="cip34",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{const i=this.getCardanoRPCUrl(e),s=Ns(e);t[s]=this.createHttpProvider(s,i)}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}getCardanoRPCUrl(t){const e=this.namespace.rpcMap;if(e)return e[t]}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||this.getCardanoRPCUrl(t);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}class b9{constructor(t){this.name="elrond",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=Ns(e);t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}class _9{constructor(t){this.name="multiversx",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){this.httpProviders[t]||this.setHttpProvider(t,e),this.chainId=t,this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${t}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}getAccounts(){const t=this.namespace.accounts;return t?[...new Set(t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;const s=Ns(e);t[s]=this.createHttpProvider(s,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);return new Cn(new Jn(i,He("disableProviderPing")))}}class E9{constructor(t){this.name="near",this.namespace=t.namespace,this.events=He("events"),this.client=He("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(t){this.namespace=Object.assign(this.namespace,t)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const t=this.namespace.chains[0];if(!t)throw new Error("ChainId not found");return t.split(":")[1]}request(t){return this.namespace.methods.includes(t.request.method)?this.client.request(t):this.getHttpProvider().request(t.request)}setDefaultChain(t,e){if(this.chainId=t,!this.httpProviders[t]){const i=e||Yn(`${this.name}:${t}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${t}`);this.setHttpProvider(t,i)}this.events.emit(Pn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const t=this.namespace.accounts;return t?t.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]:[]}createHttpProviders(){const t={};return this.namespace.chains.forEach(e=>{var i;t[e]=this.createHttpProvider(e,(i=this.namespace.rpcMap)==null?void 0:i[e])}),t}getHttpProvider(){const t=`${this.name}:${this.chainId}`,e=this.httpProviders[t];if(typeof e>"u")throw new Error(`JSON-RPC provider for ${t} not found`);return e}setHttpProvider(t,e){const i=this.createHttpProvider(t,e);i&&(this.httpProviders[t]=i)}createHttpProvider(t,e){const i=e||Yn(t,this.namespace);return typeof i>"u"?void 0:new Cn(new Jn(i,He("disableProviderPing")))}}var A9=Object.defineProperty,S9=Object.defineProperties,I9=Object.getOwnPropertyDescriptors,E1=Object.getOwnPropertySymbols,D9=Object.prototype.hasOwnProperty,x9=Object.prototype.propertyIsEnumerable,A1=(r,t,e)=>t in r?A9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Nc=(r,t)=>{for(var e in t||(t={}))D9.call(t,e)&&A1(r,e,t[e]);if(E1)for(var e of E1(t))x9.call(t,e)&&A1(r,e,t[e]);return r},al=(r,t)=>S9(r,I9(t));class of{constructor(t){this.events=new Fl,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=t,this.logger=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:ya(fu({level:(t==null?void 0:t.logger)||f1})),this.disableProviderPing=(t==null?void 0:t.disableProviderPing)||!1}static async init(t){const e=new of(t);return await e.initialize(),e}async request(t,e,i){const[s,a]=this.validateChain(e);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(s).request({request:Nc({},t),chainId:`${s}:${a}`,topic:this.session.topic,expiry:i})}sendAsync(t,e,i,s){const a=new Date().getTime();this.request(t,i,s).then(u=>e(null,du(a,u))).catch(u=>e(u,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 t;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(t=this.session)==null?void 0:t.topic,reason:Re("USER_DISCONNECTED")}),await this.cleanup()}async connect(t){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(t),await this.cleanupPendingPairings(),!t.skipPairing)return await this.pair(t.pairingTopic)}async authenticate(t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(t),await this.cleanupPendingPairings();const{uri:e,response:i}=await this.client.authenticate(t);e&&(this.uri=e,this.events.emit("display_uri",e));const s=await i();if(this.session=s.session,this.session){const a=v1(this.session.namespaces);this.namespaces=nl(this.namespaces,a),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}removeListener(t,e){this.events.removeListener(t,e)}off(t,e){this.events.off(t,e)}get isWalletConnect(){return!0}async pair(t){this.shouldAbortPairingAttempt=!1;let e=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(e>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:s}=await this.client.connect({pairingTopic:t,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await s().then(a=>{this.session=a;const u=v1(a.namespaces);this.namespaces=nl(this.namespaces,u),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==wm)throw a;e++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(t,e){try{if(!this.session)return;const[i,s]=this.validateChain(t);this.getProvider(i).setDefaultChain(s,e)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(t={}){this.logger.info("Cleaning up inactive pairings...");const e=this.client.pairing.getAll();if(un(e)){for(const i of e)t.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${e.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 t=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[t]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await sf.init({logger:this.providerOpts.logger||f1,relayUrl:this.providerOpts.relayUrl||X7,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 t=[...new Set(Object.keys(this.session.namespaces).map(e=>Jo(e)))];ol("client",this.client),ol("events",this.events),ol("disableProviderPing",this.disableProviderPing),t.forEach(e=>{if(!this.session)return;const i=c9(e,this.session),s=bm(i),a=nl(this.namespaces,this.optionalNamespaces),u=al(Nc({},a[e]),{accounts:i,chains:s});switch(e){case"eip155":this.rpcProviders[e]=new m9({namespace:u});break;case"solana":this.rpcProviders[e]=new v9({namespace:u});break;case"cosmos":this.rpcProviders[e]=new y9({namespace:u});break;case"polkadot":this.rpcProviders[e]=new h9({namespace:u});break;case"cip34":this.rpcProviders[e]=new w9({namespace:u});break;case"elrond":this.rpcProviders[e]=new b9({namespace:u});break;case"multiversx":this.rpcProviders[e]=new _9({namespace:u});break;case"near":this.rpcProviders[e]=new E9({namespace:u});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",t=>{this.events.emit("session_ping",t)}),this.client.on("session_event",t=>{const{params:e}=t,{event:i}=e;if(i.name==="accountsChanged"){const s=i.data;s&&un(s)&&this.events.emit("accountsChanged",s.map(u9))}else if(i.name==="chainChanged"){const s=e.chainId,a=e.event.data,u=Jo(s),l=sl(s)!==sl(a)?`${u}:${sl(a)}`:s;this.onChainChanged(l)}else this.events.emit(i.name,i.data);this.events.emit("session_event",t)}),this.client.on("session_update",({topic:t,params:e})=>{var i;const{namespaces:s}=e,a=(i=this.client)==null?void 0:i.session.get(t);this.session=al(Nc({},a),{namespaces:s}),this.onSessionUpdate(),this.events.emit("session_update",{topic:t,params:e})}),this.client.on("session_delete",async t=>{await this.cleanup(),this.events.emit("session_delete",t),this.events.emit("disconnect",al(Nc({},Re("USER_DISCONNECTED")),{data:t.topic}))}),this.on(Pn.DEFAULT_CHAIN_CHANGED,t=>{this.onChainChanged(t,!0)})}getProvider(t){if(!this.rpcProviders[t])throw new Error(`Provider not found: ${t}`);return this.rpcProviders[t]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(t=>{var e;this.getProvider(t).updateNamespace((e=this.session)==null?void 0:e.namespaces[t])})}setNamespaces(t){const{namespaces:e,optionalNamespaces:i,sessionProperties:s}=t;e&&Object.keys(e).length&&(this.namespaces=e),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=s,this.persist("namespaces",e),this.persist("optionalNamespaces",i)}validateChain(t){const[e,i]=(t==null?void 0:t.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[e,i];if(e&&!Object.keys(this.namespaces||{}).map(u=>Jo(u)).includes(e))throw new Error(`Namespace '${e}' is not configured. Please call connect() first with namespace config.`);if(e&&i)return[e,i];const s=Jo(Object.keys(this.namespaces)[0]),a=this.rpcProviders[s].getDefaultChain();return[s,a]}async requestAccounts(){const[t]=this.validateChain();return await this.getProvider(t).requestAccounts()}onChainChanged(t,e=!1){if(!this.namespaces)return;const[i,s]=this.validateChain(t);s&&(e||this.getProvider(i).setDefaultChain(s),this.namespaces[i]?this.namespaces[i].defaultChain=s:this.namespaces[`${i}:${s}`]?this.namespaces[`${i}:${s}`].defaultChain=s:this.namespaces[`${i}:${s}`]={defaultChain:s},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",s))}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(t,e){this.client.core.storage.setItem(`${d1}/${t}`,e)}async getFromStore(t){return await this.client.core.storage.getItem(`${d1}/${t}`)}}const M9=of,C9="wc",P9="ethereum_provider",O9=`${C9}@2:${P9}:`,N9="https://rpc.walletconnect.com/v1/",Nl=["eth_sendTransaction","personal_sign"],R9=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],Rl=["chainChanged","accountsChanged"],T9=["chainChanged","accountsChanged","message","disconnect","connect"];var F9=Object.defineProperty,U9=Object.defineProperties,B9=Object.getOwnPropertyDescriptors,S1=Object.getOwnPropertySymbols,L9=Object.prototype.hasOwnProperty,q9=Object.prototype.propertyIsEnumerable,I1=(r,t,e)=>t in r?F9(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ro=(r,t)=>{for(var e in t||(t={}))L9.call(t,e)&&I1(r,e,t[e]);if(S1)for(var e of S1(t))q9.call(t,e)&&I1(r,e,t[e]);return r},cl=(r,t)=>U9(r,B9(t));function iu(r){return Number(r[0].split(":")[1])}function Rc(r){return`0x${r.toString(16)}`}function j9(r){const{chains:t,optionalChains:e,methods:i,optionalMethods:s,events:a,optionalEvents:u,rpcMap:l}=r;if(!un(t))throw new Error("Invalid chains");const m={chains:t,methods:i||Nl,events:a||Rl,rpcMap:ro({},t.length?{[iu(t)]:l[iu(t)]}:{})},f=a==null?void 0:a.filter(I=>!Rl.includes(I)),w=i==null?void 0:i.filter(I=>!Nl.includes(I));if(!e&&!u&&!s&&!(f!=null&&f.length)&&!(w!=null&&w.length))return{required:t.length?m:void 0};const E=(f==null?void 0:f.length)&&(w==null?void 0:w.length)||!e,x={chains:[...new Set(E?m.chains.concat(e||[]):e)],methods:[...new Set(m.methods.concat(s!=null&&s.length?s:R9))],events:[...new Set(m.events.concat(u!=null&&u.length?u:T9))],rpcMap:l};return{required:t.length?m:void 0,optional:e.length?x:void 0}}class af{constructor(){this.events=new Di.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=O9,this.on=(t,e)=>(this.events.on(t,e),this),this.once=(t,e)=>(this.events.once(t,e),this),this.removeListener=(t,e)=>(this.events.removeListener(t,e),this),this.off=(t,e)=>(this.events.off(t,e),this),this.parseAccount=t=>this.isCompatibleChainId(t)?this.parseAccountId(t).address:t,this.signer={},this.rpc={}}static async init(t){const e=new af;return await e.initialize(t),e}async request(t,e){return await this.signer.request(t,this.formatChainId(this.chainId),e)}sendAsync(t,e,i){this.signer.sendAsync(t,e,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(t);const{required:e,optional:i}=j9(this.rpc);try{const s=await new Promise(async(u,l)=>{var m;this.rpc.showQrModal&&((m=this.modal)==null||m.subscribeModal(f=>{!f.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),l(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(cl(ro({namespaces:ro({},e&&{[this.namespace]:e})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:t==null?void 0:t.pairingTopic})).then(f=>{u(f)}).catch(f=>{l(new Error(f.message))})});if(!s)return;const a=Cd(s.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:Rc(this.chainId)})}catch(s){throw this.signer.logger.error(s),s}finally{this.modal&&this.modal.closeModal()}}async authenticate(t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:t==null?void 0:t.chains});try{const e=await new Promise(async(s,a)=>{var u;this.rpc.showQrModal&&((u=this.modal)==null||u.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(cl(ro({},t),{chains:this.rpc.chains})).then(l=>{s(l)}).catch(l=>{a(new Error(l.message))})}),i=e.session;if(i){const s=Cd(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:Rc(this.chainId)})}return e}catch(e){throw this.signer.logger.error(e),e}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",t=>{const{params:e}=t,{event:i}=e;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",t)}),this.signer.on("chainChanged",t=>{const e=parseInt(t);this.chainId=e,this.events.emit("chainChanged",Rc(this.chainId)),this.persist()}),this.signer.on("session_update",t=>{this.events.emit("session_update",t)}),this.signer.on("session_delete",t=>{this.reset(),this.events.emit("session_delete",t),this.events.emit("disconnect",cl(ro({},Re("USER_DISCONNECTED")),{data:t.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",t=>{var e,i;this.rpc.showQrModal&&((e=this.modal)==null||e.closeModal(),(i=this.modal)==null||i.openModal({uri:t})),this.events.emit("display_uri",t)})}switchEthereumChain(t){this.request({method:"wallet_switchEthereumChain",params:[{chainId:t.toString(16)}]})}isCompatibleChainId(t){return typeof t=="string"?t.startsWith(`${this.namespace}:`):!1}formatChainId(t){return`${this.namespace}:${t}`}parseChainId(t){return Number(t.split(":")[1])}setChainIds(t){const e=t.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));e.length&&(this.chainId=e[0],this.events.emit("chainChanged",Rc(this.chainId)),this.persist())}setChainId(t){if(this.isCompatibleChainId(t)){const e=this.parseChainId(t);this.chainId=e,this.switchEthereumChain(e)}}parseAccountId(t){const[e,i,s]=t.split(":");return{chainId:`${e}:${i}`,address:s}}setAccounts(t){this.accounts=t.filter(e=>this.parseChainId(this.parseAccountId(e).chainId)===this.chainId).map(e=>this.parseAccountId(e).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(t){var e,i;const s=(e=t==null?void 0:t.chains)!=null?e:[],a=(i=t==null?void 0:t.optionalChains)!=null?i:[],u=s.concat(a);if(!u.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const l=s.length?(t==null?void 0:t.methods)||Nl:[],m=s.length?(t==null?void 0:t.events)||Rl:[],f=(t==null?void 0:t.optionalMethods)||[],w=(t==null?void 0:t.optionalEvents)||[],E=(t==null?void 0:t.rpcMap)||this.buildRpcMap(u,t.projectId),x=(t==null?void 0:t.qrModalOptions)||void 0;return{chains:s==null?void 0:s.map(I=>this.formatChainId(I)),optionalChains:a.map(I=>this.formatChainId(I)),methods:l,events:m,optionalMethods:f,optionalEvents:w,rpcMap:E,showQrModal:!!(t!=null&&t.showQrModal),qrModalOptions:x,projectId:t.projectId,metadata:t.metadata}}buildRpcMap(t,e){const i={};return t.forEach(s=>{i[s]=this.getRpcUrl(s,e)}),i}async initialize(t){if(this.rpc=this.getRpcConfig(t),this.chainId=this.rpc.chains.length?iu(this.rpc.chains):iu(this.rpc.optionalChains),this.signer=await M9.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:t.disableProviderPing,relayUrl:t.relayUrl,storageOptions:t.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let e;try{const{WalletConnectModal:i}=await e6(()=>import("./index-fcfdb43d.js").then(s=>s.i),["assets/index-fcfdb43d.js","assets/index-8a109c4c.js","assets/index-8006ed4b.css"]);e=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(e)try{this.modal=new e(ro({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(t){if(!t)return;const{chains:e,optionalChains:i,rpcMap:s}=t;e&&un(e)&&(this.rpc.chains=e.map(a=>this.formatChainId(a)),e.forEach(a=>{this.rpc.rpcMap[a]=(s==null?void 0:s[a])||this.getRpcUrl(a)})),i&&un(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i==null?void 0:i.map(a=>this.formatChainId(a)),i.forEach(a=>{this.rpc.rpcMap[a]=(s==null?void 0:s[a])||this.getRpcUrl(a)}))}getRpcUrl(t,e){var i;return((i=this.rpc.rpcMap)==null?void 0:i[t])||`${N9}?chainId=eip155:${t}&projectId=${e||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const t=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),e=this.session.namespaces[`${this.namespace}:${t}`]?this.session.namespaces[`${this.namespace}:${t}`]:this.session.namespaces[this.namespace];this.setChainIds(t?[this.formatChainId(t)]:e==null?void 0:e.accounts),this.setAccounts(e==null?void 0:e.accounts)}catch(t){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(t),await this.disconnect().catch(e=>this.signer.logger.warn(e))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(t){return typeof t=="string"||t instanceof String?[this.parseAccount(t)]:t.map(e=>this.parseAccount(e))}}const pM=af;export{pM as EthereumProvider,T9 as OPTIONAL_EVENTS,R9 as OPTIONAL_METHODS,Rl as REQUIRED_EVENTS,Nl as REQUIRED_METHODS,af as default};
|
|
44
|
+
//# sourceMappingURL=index.es-7af53fc6.js.map
|