@privy-io/react-auth 1.21.0-beta.9 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var Yl=Object.create;var Po=Object.defineProperty;var Xl=Object.getOwnPropertyDescriptor;var Ql=Object.getOwnPropertyNames;var ec=Object.getPrototypeOf,tc=Object.prototype.hasOwnProperty;var Jn=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ne=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Yn=(e,t)=>{for(var o in t)Po(e,o,{get:t[o],enumerable:!0})},Xn=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ql(t))!tc.call(e,n)&&n!==o&&Po(e,n,{get:()=>t[n],enumerable:!(r=Xl(t,n))||r.enumerable});return e};var oc=(e,t,o)=>(o=e!=null?Yl(ec(e)):{},Xn(t||!e||!e.__esModule?Po(o,"default",{value:e,enumerable:!0}):o,e)),Qn=e=>Xn(Po({},"__esModule",{value:!0}),e);var Go=Ne((I0,Fo)=>{var Di,Ui,Bi,Fi,Gi,Hi,Vi,ji,$i,Uo,Gr,zi,qi,Zi,Rt,Ki,Ji,Yi,Xi,Qi,ea,ta,oa,ra,Bo;(function(e){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(r){e(o(t,o(r)))}):typeof Fo=="object"&&typeof Fo.exports=="object"?e(o(t,o(Fo.exports))):e(o(t));function o(r,n){return r!==t&&(typeof Object.create=="function"?Object.defineProperty(r,"__esModule",{value:!0}):r.__esModule=!0),function(i,a){return r[i]=n?n(i,a):a}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])};Di=function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(r,n);function i(){this.constructor=r}r.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},Ui=Object.assign||function(r){for(var n,i=1,a=arguments.length;i<a;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},Bi=function(r,n){var i={};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&n.indexOf(a)<0&&(i[a]=r[a]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(r);s<a.length;s++)n.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(r,a[s])&&(i[a[s]]=r[a[s]]);return i},Fi=function(r,n,i,a){var s=arguments.length,l=s<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,i):a,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(r,n,i,a);else for(var h=r.length-1;h>=0;h--)(c=r[h])&&(l=(s<3?c(l):s>3?c(n,i,l):c(n,i))||l);return s>3&&l&&Object.defineProperty(n,i,l),l},Gi=function(r,n){return function(i,a){n(i,a,r)}},Hi=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},Vi=function(r,n,i,a){function s(l){return l instanceof i?l:new i(function(c){c(l)})}return new(i||(i=Promise))(function(l,c){function h(g){try{p(a.next(g))}catch(b){c(b)}}function m(g){try{p(a.throw(g))}catch(b){c(b)}}function p(g){g.done?l(g.value):s(g.value).then(h,m)}p((a=a.apply(r,n||[])).next())})},ji=function(r,n){var i={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},a,s,l,c;return c={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function h(p){return function(g){return m([p,g])}}function m(p){if(a)throw new TypeError("Generator is already executing.");for(;i;)try{if(a=1,s&&(l=p[0]&2?s.return:p[0]?s.throw||((l=s.return)&&l.call(s),0):s.next)&&!(l=l.call(s,p[1])).done)return l;switch(s=0,l&&(p=[p[0]&2,l.value]),p[0]){case 0:case 1:l=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,s=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(l=i.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){i.label=p[1];break}if(p[0]===6&&i.label<l[1]){i.label=l[1],l=p;break}if(l&&i.label<l[2]){i.label=l[2],i.ops.push(p);break}l[2]&&i.ops.pop(),i.trys.pop();continue}p=n.call(r,i)}catch(g){p=[6,g],s=0}finally{a=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},$i=function(r,n){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(n,i)&&Bo(n,r,i)},Bo=Object.create?function(r,n,i,a){a===void 0&&(a=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(r,a,s)}:function(r,n,i,a){a===void 0&&(a=i),r[a]=n[i]},Uo=function(r){var n=typeof Symbol=="function"&&Symbol.iterator,i=n&&r[n],a=0;if(i)return i.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&a>=r.length&&(r=void 0),{value:r&&r[a++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},Gr=function(r,n){var i=typeof Symbol=="function"&&r[Symbol.iterator];if(!i)return r;var a=i.call(r),s,l=[],c;try{for(;(n===void 0||n-- >0)&&!(s=a.next()).done;)l.push(s.value)}catch(h){c={error:h}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(c)throw c.error}}return l},zi=function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(Gr(arguments[n]));return r},qi=function(){for(var r=0,n=0,i=arguments.length;n<i;n++)r+=arguments[n].length;for(var a=Array(r),s=0,n=0;n<i;n++)for(var l=arguments[n],c=0,h=l.length;c<h;c++,s++)a[s]=l[c];return a},Zi=function(r,n,i){if(i||arguments.length===2)for(var a=0,s=n.length,l;a<s;a++)(l||!(a in n))&&(l||(l=Array.prototype.slice.call(n,0,a)),l[a]=n[a]);return r.concat(l||Array.prototype.slice.call(n))},Rt=function(r){return this instanceof Rt?(this.v=r,this):new Rt(r)},Ki=function(r,n,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=i.apply(r,n||[]),s,l=[];return s={},c("next"),c("throw"),c("return"),s[Symbol.asyncIterator]=function(){return this},s;function c(d){a[d]&&(s[d]=function(y){return new Promise(function(v,A){l.push([d,y,v,A])>1||h(d,y)})})}function h(d,y){try{m(a[d](y))}catch(v){b(l[0][3],v)}}function m(d){d.value instanceof Rt?Promise.resolve(d.value.v).then(p,g):b(l[0][2],d)}function p(d){h("next",d)}function g(d){h("throw",d)}function b(d,y){d(y),l.shift(),l.length&&h(l[0][0],l[0][1])}},Ji=function(r){var n,i;return n={},a("next"),a("throw",function(s){throw s}),a("return"),n[Symbol.iterator]=function(){return this},n;function a(s,l){n[s]=r[s]?function(c){return(i=!i)?{value:Rt(r[s](c)),done:s==="return"}:l?l(c):c}:l}},Yi=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],i;return n?n.call(r):(r=typeof Uo=="function"?Uo(r):r[Symbol.iterator](),i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i);function a(l){i[l]=r[l]&&function(c){return new Promise(function(h,m){c=r[l](c),s(h,m,c.done,c.value)})}}function s(l,c,h,m){Promise.resolve(m).then(function(p){l({value:p,done:h})},c)}},Xi=function(r,n){return Object.defineProperty?Object.defineProperty(r,"raw",{value:n}):r.raw=n,r};var o=Object.create?function(r,n){Object.defineProperty(r,"default",{enumerable:!0,value:n})}:function(r,n){r.default=n};Qi=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var i in r)i!=="default"&&Object.prototype.hasOwnProperty.call(r,i)&&Bo(n,r,i);return o(n,r),n},ea=function(r){return r&&r.__esModule?r:{default:r}},ta=function(r,n,i,a){if(i==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?r!==n||!a:!n.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(r):a?a.value:n.get(r)},oa=function(r,n,i,a,s){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof n=="function"?r!==n||!s:!n.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?s.call(r,i):s?s.value=i:n.set(r,i),i},ra=function(r,n){if(n===null||typeof n!="object"&&typeof n!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof r=="function"?n===r:r.has(n)},e("__extends",Di),e("__assign",Ui),e("__rest",Bi),e("__decorate",Fi),e("__param",Gi),e("__metadata",Hi),e("__awaiter",Vi),e("__generator",ji),e("__exportStar",$i),e("__createBinding",Bo),e("__values",Uo),e("__read",Gr),e("__spread",zi),e("__spreadArrays",qi),e("__spreadArray",Zi),e("__await",Rt),e("__asyncGenerator",Ki),e("__asyncDelegator",Ji),e("__asyncValues",Yi),e("__makeTemplateObject",Xi),e("__importStar",Qi),e("__importDefault",ea),e("__classPrivateFieldGet",ta),e("__classPrivateFieldSet",oa),e("__classPrivateFieldIn",ra)})});var Hr=Ne(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.getLocalStorage=U.getLocalStorageOrThrow=U.getCrypto=U.getCryptoOrThrow=U.getLocation=U.getLocationOrThrow=U.getNavigator=U.getNavigatorOrThrow=U.getDocument=U.getDocumentOrThrow=U.getFromWindowOrThrow=U.getFromWindow=void 0;function pt(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}U.getFromWindow=pt;function It(e){let t=pt(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}U.getFromWindowOrThrow=It;function Ac(){return It("document")}U.getDocumentOrThrow=Ac;function kc(){return pt("document")}U.getDocument=kc;function Tc(){return It("navigator")}U.getNavigatorOrThrow=Tc;function Wc(){return pt("navigator")}U.getNavigator=Wc;function Rc(){return It("location")}U.getLocationOrThrow=Rc;function Ic(){return pt("location")}U.getLocation=Ic;function Mc(){return It("crypto")}U.getCryptoOrThrow=Mc;function Oc(){return pt("crypto")}U.getCrypto=Oc;function Nc(){return It("localStorage")}U.getLocalStorageOrThrow=Nc;function Dc(){return pt("localStorage")}U.getLocalStorage=Dc});var ia=Ne(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.getWindowMetadata=void 0;var na=Hr();function Uc(){let e,t;try{e=na.getDocumentOrThrow(),t=na.getLocationOrThrow()}catch{return null}function o(){let m=e.getElementsByTagName("link"),p=[];for(let g=0;g<m.length;g++){let b=m[g],d=b.getAttribute("rel");if(d&&d.toLowerCase().indexOf("icon")>-1){let y=b.getAttribute("href");if(y)if(y.toLowerCase().indexOf("https:")===-1&&y.toLowerCase().indexOf("http:")===-1&&y.indexOf("//")!==0){let v=t.protocol+"//"+t.host;if(y.indexOf("/")===0)v+=y;else{let A=t.pathname.split("/");A.pop(),v+=A.join("/")+"/"+y}p.push(v)}else if(y.indexOf("//")===0){let v=t.protocol+y;p.push(v)}else p.push(y)}}return p}function r(...m){let p=e.getElementsByTagName("meta");for(let g=0;g<p.length;g++){let b=p[g],d=["itemprop","property","name"].map(y=>b.getAttribute(y)).filter(y=>y?m.includes(y):!1);if(d.length&&d){let y=b.getAttribute("content");if(y)return y}}return""}function n(){let m=r("name","og:site_name","og:title","twitter:title");return m||(m=e.title),m}function i(){return r("description","og:description","twitter:description","keywords")}let a=n(),s=i(),l=t.origin,c=o();return{description:s,url:l,icons:c,name:a}}Ho.getWindowMetadata=Uc});var ga={};Yn(ga,{BotInfo:()=>pa,BrowserInfo:()=>la,NodeInfo:()=>ca,ReactNativeInfo:()=>ua,SearchBotDeviceInfo:()=>da,browserName:()=>jc,detect:()=>Vc,detectOS:()=>ma,getNodeVersion:()=>ha,parseUserAgent:()=>Vr});function Vc(e){return e?Vr(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ua:typeof navigator<"u"?Vr(navigator.userAgent):ha()}function fa(e){return e!==""&&Hc.reduce(function(t,o){var r=o[0],n=o[1];if(t)return t;var i=n.exec(e);return!!i&&[r,i]},!1)}function jc(e){var t=fa(e);return t?t[0]:null}function Vr(e){var t=fa(e);if(!t)return null;var o=t[0],r=t[1];if(o==="searchbot")return new pa;var n=r[1]&&r[1].split(/[._]/).slice(0,3);n?n.length<aa&&(n=Bc(n,$c(aa-n.length))):n=[];var i=n.join("."),a=ma(e),s=Gc.exec(e);return s&&s[1]?new da(o,i,a,s[1]):new la(o,i,a)}function ma(e){for(var t=0,o=sa.length;t<o;t++){var r=sa[t],n=r[0],i=r[1],a=i.exec(e);if(a)return n}return null}function ha(){var e=typeof process<"u"&&process.version;return e?new ca(process.version.slice(1)):null}function $c(e){for(var t=[],o=0;o<e;o++)t.push("0");return t}var Bc,la,ca,da,pa,ua,Fc,Gc,aa,Hc,sa,ba=Jn(()=>{Bc=function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;for(var r=Array(e),n=0,t=0;t<o;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r},la=function(){function e(t,o,r){this.name=t,this.version=o,this.os=r,this.type="browser"}return e}(),ca=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),da=function(){function e(t,o,r,n){this.name=t,this.version=o,this.os=r,this.bot=n,this.type="bot-device"}return e}(),pa=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),ua=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),Fc=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Gc=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,aa=3,Hc=[["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|$)/],["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",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",Fc]],sa=[["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/],["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/]]});var $r=Ne(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.getClientMeta=P.getLocalStorage=P.getLocalStorageOrThrow=P.getCrypto=P.getCryptoOrThrow=P.getLocation=P.getLocationOrThrow=P.getNavigator=P.getNavigatorOrThrow=P.getDocument=P.getDocumentOrThrow=P.getFromWindowOrThrow=P.getFromWindow=P.isBrowser=P.isNode=P.isMobile=P.isIOS=P.isAndroid=P.detectOS=P.detectEnv=void 0;var ya=Go(),zc=ya.__importStar(ia()),Pe=ya.__importStar(Hr()),qc=(ba(),Qn(ga));function jr(e){return(0,qc.detect)(e)}P.detectEnv=jr;function Vo(){let e=jr();return e&&e.os?e.os:void 0}P.detectOS=Vo;function va(){let e=Vo();return e?e.toLowerCase().includes("android"):!1}P.isAndroid=va;function wa(){let e=Vo();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}P.isIOS=wa;function Zc(){return Vo()?va()||wa():!1}P.isMobile=Zc;function Ca(){let e=jr();return e&&e.name?e.name.toLowerCase()==="node":!1}P.isNode=Ca;function Kc(){return!Ca()&&!!(0,P.getNavigator)()}P.isBrowser=Kc;P.getFromWindow=Pe.getFromWindow;P.getFromWindowOrThrow=Pe.getFromWindowOrThrow;P.getDocumentOrThrow=Pe.getDocumentOrThrow;P.getDocument=Pe.getDocument;P.getNavigatorOrThrow=Pe.getNavigatorOrThrow;P.getNavigator=Pe.getNavigator;P.getLocationOrThrow=Pe.getLocationOrThrow;P.getLocation=Pe.getLocation;P.getCryptoOrThrow=Pe.getCryptoOrThrow;P.getCrypto=Pe.getCrypto;P.getLocalStorageOrThrow=Pe.getLocalStorageOrThrow;P.getLocalStorage=Pe.getLocalStorage;function Jc(){return zc.getWindowMetadata()}P.getClientMeta=Jc});var Ea={};Yn(Ea,{safeJsonParse:()=>Yc,safeJsonStringify:()=>Xc});function Yc(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return JSON.parse(e)}catch{return e}}function Xc(e){return typeof e=="string"?e:JSON.stringify(e)}var xa=Jn(()=>{});var zr=Ne(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.safeJsonStringify=Mt.safeJsonParse=void 0;var Qc=Go(),_a=Qc.__importStar((xa(),Qn(Ea)));Mt.safeJsonParse=_a.safeJsonParse;Mt.safeJsonStringify=_a.safeJsonStringify});var Zr=Ne(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.removeLocal=Ze.getLocal=Ze.setLocal=void 0;var Pa=zr(),qr=$r();function ed(e,t){let o=(0,Pa.safeJsonStringify)(t),r=(0,qr.getLocalStorage)();r&&r.setItem(e,o)}Ze.setLocal=ed;function td(e){let t=null,o=null,r=(0,qr.getLocalStorage)();return r&&(o=r.getItem(e)),t=o&&(0,Pa.safeJsonParse)(o),t}Ze.getLocal=td;function od(e){let t=(0,qr.getLocalStorage)();t&&t.removeItem(e)}Ze.removeLocal=od});var Sa=Ne(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.getMobileLinkRegistry=ue.getMobileRegistryEntry=ue.saveMobileLinkInfo=ue.formatIOSMobile=ue.mobileLinkChoiceKey=void 0;var rd=Zr();ue.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function nd(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${o}`:""}ue.formatIOSMobile=nd;function id(e){let t=e.href.split("?")[0];(0,rd.setLocal)(ue.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}ue.saveMobileLinkInfo=id;function La(e,t){return e.filter(o=>o.name.toLowerCase().includes(t.toLowerCase()))[0]}ue.getMobileRegistryEntry=La;function ad(e,t){let o=e;return t&&(o=t.map(r=>La(e,r)).filter(Boolean)),o}ue.getMobileLinkRegistry=ad});var Ta=Ne(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.formatMobileRegistry=ke.formatMobileRegistryEntry=ke.getDappRegistryUrl=ke.getWalletRegistryUrl=void 0;var Aa="https://registry.walletconnect.com";function sd(){return Aa+"/api/v2/wallets"}ke.getWalletRegistryUrl=sd;function ld(){return Aa+"/api/v2/dapps"}ke.getDappRegistryUrl=ld;function ka(e,t="mobile"){var o;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:(o=e.image_url.sm)!==null&&o!==void 0?o:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}ke.formatMobileRegistryEntry=ka;function cd(e,t="mobile"){return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>ka(o,t))}ke.formatMobileRegistry=cd});var Wa=Ne(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});var oo=Go();oo.__exportStar($r(),ut);oo.__exportStar(zr(),ut);oo.__exportStar(Zr(),ut);oo.__exportStar(Sa(),ut);oo.__exportStar(Ta(),ut)});import{Web3Provider as r2}from"@ethersproject/providers";import{useEffect as qn,useState as ie}from"react";var x=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import rc from"axios";var Le=class extends Error{constructor(o,r){super(o);r instanceof Error&&(this.cause=r)}toString(){return`${this.type}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},_t=class extends Le{constructor(o,r,n,i){super(n,i);this.type=o;this.status=r}},C=class extends Le{constructor(o,r){super(o,r);this.type="client_error"}};var G=class extends Le{constructor(o,r){super(o,r);this.type="connector_error"}},Z=e=>{if(e instanceof Le)return e;if(!rc.isAxiosError(e))return we(e);if(!e.response)return new _t("api_error",null,e.message,e);let{type:t,message:o,error:r}=e.response.data;return new _t(t||"ApiError",e.response.status,o||r,e)},we=e=>e instanceof Le?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var ei=()=>"/api/v1/sessions",ti=()=>"/api/v1/sessions/logout",oi=()=>"/api/v1/sessions/fork",ri=()=>"/api/v1/sessions/fork/recover",ni=()=>"/api/v1/siwe/init",ii=()=>"/api/v1/siwe/authenticate",ai=()=>"/api/v1/siwe/link",si=()=>"/api/v1/passwordless/init",li=()=>"/api/v1/passwordless/authenticate",ci=()=>"/api/v1/passwordless/link",di=()=>"/api/v1/passwordless_sms/init",pi=()=>"/api/v1/passwordless_sms/authenticate",ui=()=>"/api/v1/passwordless_sms/link",fi=()=>"/api/v1/oauth/init",mi=()=>"/api/v1/oauth/authenticate",hi=()=>"/api/v1/oauth/link",gi=()=>"/api/v1/siwe/unlink",bi=()=>"/api/v1/passwordless/unlink",yi=()=>"/api/v1/passwordless_sms/unlink",vi=()=>"/api/v1/oauth/unlink",wi=()=>"/api/v1/analytics_events";var nt=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=li(),o=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=ci();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw Z(t)}}async sendCodeEmail(t){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new C("Email must be set when initialzing authentication.");try{let o=si();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw Z(o)}}};var ze=class{constructor(t,o,r){this.meta={provider:t},this.meta.authorizationCode=o,this.meta.stateCode=r}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");try{let t=mi(),o=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");try{let t=hi();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw Z(t)}}async getAuthorizationUrl(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.provider)throw new C("Provider must be set when initialzing OAuth authentication.");try{let t=fi();return(await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(t){throw Z(t)}}};var qe=class{constructor(t,o,r){this._meta={walletType:o,walletId:r},this.connectors=t,this.walletConnector=this.connectors.createWalletConnector(o,null,r)}get meta(){return{...this._meta,walletName:this.walletConnector.walletBranding.name,walletIcon:this.walletConnector.walletBranding.icon}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(ii(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(ai(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),r.data}catch(t){throw Z(t)}}async promptConnect(){if(!this.api)throw new C("Auth flow has no API instance");let t=await this.walletConnector.connect({showPrompt:!0});return await this.buildSiweMessage(t),t}async sign(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.preparedMessage){let o=await this.walletConnector.connect({showPrompt:!1});await this.buildSiweMessage(o)}if(!this.preparedMessage)throw new C("Could not prepare SIWE message");let t=await this.walletConnector.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async buildSiweMessage(t){if(!this.api)throw new C("Auth flow has no API instance");let o=t.address,r=t.chainId,n=await this.api.post(ni(),{address:o});return this.preparedMessage=this.walletConnector.prepareMessage(r,o,n.data.nonce),this.preparedMessage}};var it=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=pi(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=ui();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw Z(t)}}async sendSmsCode(t){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new C("phone nNumber must be set when initialzing authentication.");try{let o=di();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw Z(o)}}};import{getAddress as pd}from"@ethersproject/address";var Ci="1.21.0-beta.9";var Ei="https://api.privy.io/v0",Lo=process.env.NEXT_PUBLIC_PRIVY_AUTH_URL||"https://auth.privy.io",So="4df5e2316331463a9130964bd6078dfa",xi=1e4,Ce=1400,Wr=Ci;var Pt="privy:token",Ao="privy:refresh_token",to="privy:session_transfer_token",ko="privy:connectors",Rr="walletconnect",_i=3e4;var Ir=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,o){o!==void 0?this._cache[t]=o:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Mr=class{get(t){let o=localStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?localStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function ic(){return typeof window<"u"&&window.localStorage?new Mr:new Ir}var H=ic();import mc from"@coinbase/wallet-sdk";import{getAddress as hc}from"@ethersproject/address";import{jsx as Pi,jsxs as ac}from"react/jsx-runtime";var Ee=({style:e,...t})=>ac("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Pi("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Pi("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as uc}from"@ethersproject/address";import{Web3Provider as fc}from"@ethersproject/providers";import{ErrorCode as sc}from"@ethersproject/logger";var Lt=class extends G{constructor(){super("Wallet timeout");this.type="wallet_error"}},st=class extends G{constructor(){super("User rejected connection");this.type="wallet_error"}},xe=e=>{if(e instanceof G)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new St(e);return e.code===sc.ACTION_REJECTED&&(t.details=at.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new St(e):new G("Unknown connector error",e)},Or=class extends Le{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},St=class extends Or{constructor(o){var i,a,s;let r=o;super(r.message,r.code,r.data);let n=Object.values(at).find(l=>l.eipCode===r.code);this.details=n||at.UNKNOWN_ERROR,r.code===-32002&&((i=r.message)!=null&&i.includes("already pending for origin")?(a=r.message)!=null&&a.includes("wallet_requestPermissions")?this.details=at.E32002_CONNECTION_ALREADY_PENDING:this.details=at.E32002_REQUEST_ALREADY_PENDING:(s=r.message)!=null&&s.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=at.E32002_WALLET_LOCKED))}},lc={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},cc={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},dc={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},at={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...dc,...cc},lt={...lc,...at};var pc=12e4,Nr=(e=new Lt,t=pc)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),Se=class{constructor(t){this.removeListener=(t,o)=>{if(this.walletProvider)return this.walletProvider.removeListener(t,o)};this.setWalletProvider=t=>{this.walletProvider=t,this._subscriptions.forEach(o=>{var r;(r=this.walletProvider)==null||r.on(o.eventName,o.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new G(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),Nr()]).catch(o=>{throw xe(o)})}},ct=class extends Se{constructor(o){super(o)}},To=class extends Se{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Ae=class{constructor(t,o,r){this.createSiweMessage=(t,o,r,n,i,a,s)=>`${r} wants you to sign in with your Ethereum account:
1
+ var Yl=Object.create;var Po=Object.defineProperty;var Xl=Object.getOwnPropertyDescriptor;var Ql=Object.getOwnPropertyNames;var ec=Object.getPrototypeOf,tc=Object.prototype.hasOwnProperty;var Jn=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ne=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Yn=(e,t)=>{for(var o in t)Po(e,o,{get:t[o],enumerable:!0})},Xn=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ql(t))!tc.call(e,n)&&n!==o&&Po(e,n,{get:()=>t[n],enumerable:!(r=Xl(t,n))||r.enumerable});return e};var oc=(e,t,o)=>(o=e!=null?Yl(ec(e)):{},Xn(t||!e||!e.__esModule?Po(o,"default",{value:e,enumerable:!0}):o,e)),Qn=e=>Xn(Po({},"__esModule",{value:!0}),e);var Go=Ne((I0,Fo)=>{var Di,Ui,Bi,Fi,Gi,Hi,Vi,ji,$i,Uo,Gr,zi,qi,Zi,Rt,Ki,Ji,Yi,Xi,Qi,ea,ta,oa,ra,Bo;(function(e){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(r){e(o(t,o(r)))}):typeof Fo=="object"&&typeof Fo.exports=="object"?e(o(t,o(Fo.exports))):e(o(t));function o(r,n){return r!==t&&(typeof Object.create=="function"?Object.defineProperty(r,"__esModule",{value:!0}):r.__esModule=!0),function(i,a){return r[i]=n?n(i,a):a}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])};Di=function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(r,n);function i(){this.constructor=r}r.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},Ui=Object.assign||function(r){for(var n,i=1,a=arguments.length;i<a;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},Bi=function(r,n){var i={};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&n.indexOf(a)<0&&(i[a]=r[a]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(r);s<a.length;s++)n.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(r,a[s])&&(i[a[s]]=r[a[s]]);return i},Fi=function(r,n,i,a){var s=arguments.length,l=s<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,i):a,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(r,n,i,a);else for(var h=r.length-1;h>=0;h--)(c=r[h])&&(l=(s<3?c(l):s>3?c(n,i,l):c(n,i))||l);return s>3&&l&&Object.defineProperty(n,i,l),l},Gi=function(r,n){return function(i,a){n(i,a,r)}},Hi=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},Vi=function(r,n,i,a){function s(l){return l instanceof i?l:new i(function(c){c(l)})}return new(i||(i=Promise))(function(l,c){function h(g){try{p(a.next(g))}catch(b){c(b)}}function m(g){try{p(a.throw(g))}catch(b){c(b)}}function p(g){g.done?l(g.value):s(g.value).then(h,m)}p((a=a.apply(r,n||[])).next())})},ji=function(r,n){var i={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},a,s,l,c;return c={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function h(p){return function(g){return m([p,g])}}function m(p){if(a)throw new TypeError("Generator is already executing.");for(;i;)try{if(a=1,s&&(l=p[0]&2?s.return:p[0]?s.throw||((l=s.return)&&l.call(s),0):s.next)&&!(l=l.call(s,p[1])).done)return l;switch(s=0,l&&(p=[p[0]&2,l.value]),p[0]){case 0:case 1:l=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,s=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(l=i.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){i.label=p[1];break}if(p[0]===6&&i.label<l[1]){i.label=l[1],l=p;break}if(l&&i.label<l[2]){i.label=l[2],i.ops.push(p);break}l[2]&&i.ops.pop(),i.trys.pop();continue}p=n.call(r,i)}catch(g){p=[6,g],s=0}finally{a=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},$i=function(r,n){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(n,i)&&Bo(n,r,i)},Bo=Object.create?function(r,n,i,a){a===void 0&&(a=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(r,a,s)}:function(r,n,i,a){a===void 0&&(a=i),r[a]=n[i]},Uo=function(r){var n=typeof Symbol=="function"&&Symbol.iterator,i=n&&r[n],a=0;if(i)return i.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&a>=r.length&&(r=void 0),{value:r&&r[a++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},Gr=function(r,n){var i=typeof Symbol=="function"&&r[Symbol.iterator];if(!i)return r;var a=i.call(r),s,l=[],c;try{for(;(n===void 0||n-- >0)&&!(s=a.next()).done;)l.push(s.value)}catch(h){c={error:h}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(c)throw c.error}}return l},zi=function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(Gr(arguments[n]));return r},qi=function(){for(var r=0,n=0,i=arguments.length;n<i;n++)r+=arguments[n].length;for(var a=Array(r),s=0,n=0;n<i;n++)for(var l=arguments[n],c=0,h=l.length;c<h;c++,s++)a[s]=l[c];return a},Zi=function(r,n,i){if(i||arguments.length===2)for(var a=0,s=n.length,l;a<s;a++)(l||!(a in n))&&(l||(l=Array.prototype.slice.call(n,0,a)),l[a]=n[a]);return r.concat(l||Array.prototype.slice.call(n))},Rt=function(r){return this instanceof Rt?(this.v=r,this):new Rt(r)},Ki=function(r,n,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=i.apply(r,n||[]),s,l=[];return s={},c("next"),c("throw"),c("return"),s[Symbol.asyncIterator]=function(){return this},s;function c(d){a[d]&&(s[d]=function(y){return new Promise(function(v,A){l.push([d,y,v,A])>1||h(d,y)})})}function h(d,y){try{m(a[d](y))}catch(v){b(l[0][3],v)}}function m(d){d.value instanceof Rt?Promise.resolve(d.value.v).then(p,g):b(l[0][2],d)}function p(d){h("next",d)}function g(d){h("throw",d)}function b(d,y){d(y),l.shift(),l.length&&h(l[0][0],l[0][1])}},Ji=function(r){var n,i;return n={},a("next"),a("throw",function(s){throw s}),a("return"),n[Symbol.iterator]=function(){return this},n;function a(s,l){n[s]=r[s]?function(c){return(i=!i)?{value:Rt(r[s](c)),done:s==="return"}:l?l(c):c}:l}},Yi=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],i;return n?n.call(r):(r=typeof Uo=="function"?Uo(r):r[Symbol.iterator](),i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i);function a(l){i[l]=r[l]&&function(c){return new Promise(function(h,m){c=r[l](c),s(h,m,c.done,c.value)})}}function s(l,c,h,m){Promise.resolve(m).then(function(p){l({value:p,done:h})},c)}},Xi=function(r,n){return Object.defineProperty?Object.defineProperty(r,"raw",{value:n}):r.raw=n,r};var o=Object.create?function(r,n){Object.defineProperty(r,"default",{enumerable:!0,value:n})}:function(r,n){r.default=n};Qi=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var i in r)i!=="default"&&Object.prototype.hasOwnProperty.call(r,i)&&Bo(n,r,i);return o(n,r),n},ea=function(r){return r&&r.__esModule?r:{default:r}},ta=function(r,n,i,a){if(i==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?r!==n||!a:!n.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(r):a?a.value:n.get(r)},oa=function(r,n,i,a,s){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof n=="function"?r!==n||!s:!n.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?s.call(r,i):s?s.value=i:n.set(r,i),i},ra=function(r,n){if(n===null||typeof n!="object"&&typeof n!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof r=="function"?n===r:r.has(n)},e("__extends",Di),e("__assign",Ui),e("__rest",Bi),e("__decorate",Fi),e("__param",Gi),e("__metadata",Hi),e("__awaiter",Vi),e("__generator",ji),e("__exportStar",$i),e("__createBinding",Bo),e("__values",Uo),e("__read",Gr),e("__spread",zi),e("__spreadArrays",qi),e("__spreadArray",Zi),e("__await",Rt),e("__asyncGenerator",Ki),e("__asyncDelegator",Ji),e("__asyncValues",Yi),e("__makeTemplateObject",Xi),e("__importStar",Qi),e("__importDefault",ea),e("__classPrivateFieldGet",ta),e("__classPrivateFieldSet",oa),e("__classPrivateFieldIn",ra)})});var Hr=Ne(U=>{"use strict";Object.defineProperty(U,"__esModule",{value:!0});U.getLocalStorage=U.getLocalStorageOrThrow=U.getCrypto=U.getCryptoOrThrow=U.getLocation=U.getLocationOrThrow=U.getNavigator=U.getNavigatorOrThrow=U.getDocument=U.getDocumentOrThrow=U.getFromWindowOrThrow=U.getFromWindow=void 0;function pt(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}U.getFromWindow=pt;function It(e){let t=pt(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}U.getFromWindowOrThrow=It;function Ac(){return It("document")}U.getDocumentOrThrow=Ac;function kc(){return pt("document")}U.getDocument=kc;function Tc(){return It("navigator")}U.getNavigatorOrThrow=Tc;function Wc(){return pt("navigator")}U.getNavigator=Wc;function Rc(){return It("location")}U.getLocationOrThrow=Rc;function Ic(){return pt("location")}U.getLocation=Ic;function Mc(){return It("crypto")}U.getCryptoOrThrow=Mc;function Oc(){return pt("crypto")}U.getCrypto=Oc;function Nc(){return It("localStorage")}U.getLocalStorageOrThrow=Nc;function Dc(){return pt("localStorage")}U.getLocalStorage=Dc});var ia=Ne(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.getWindowMetadata=void 0;var na=Hr();function Uc(){let e,t;try{e=na.getDocumentOrThrow(),t=na.getLocationOrThrow()}catch{return null}function o(){let m=e.getElementsByTagName("link"),p=[];for(let g=0;g<m.length;g++){let b=m[g],d=b.getAttribute("rel");if(d&&d.toLowerCase().indexOf("icon")>-1){let y=b.getAttribute("href");if(y)if(y.toLowerCase().indexOf("https:")===-1&&y.toLowerCase().indexOf("http:")===-1&&y.indexOf("//")!==0){let v=t.protocol+"//"+t.host;if(y.indexOf("/")===0)v+=y;else{let A=t.pathname.split("/");A.pop(),v+=A.join("/")+"/"+y}p.push(v)}else if(y.indexOf("//")===0){let v=t.protocol+y;p.push(v)}else p.push(y)}}return p}function r(...m){let p=e.getElementsByTagName("meta");for(let g=0;g<p.length;g++){let b=p[g],d=["itemprop","property","name"].map(y=>b.getAttribute(y)).filter(y=>y?m.includes(y):!1);if(d.length&&d){let y=b.getAttribute("content");if(y)return y}}return""}function n(){let m=r("name","og:site_name","og:title","twitter:title");return m||(m=e.title),m}function i(){return r("description","og:description","twitter:description","keywords")}let a=n(),s=i(),l=t.origin,c=o();return{description:s,url:l,icons:c,name:a}}Ho.getWindowMetadata=Uc});var ga={};Yn(ga,{BotInfo:()=>pa,BrowserInfo:()=>la,NodeInfo:()=>ca,ReactNativeInfo:()=>ua,SearchBotDeviceInfo:()=>da,browserName:()=>jc,detect:()=>Vc,detectOS:()=>ma,getNodeVersion:()=>ha,parseUserAgent:()=>Vr});function Vc(e){return e?Vr(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ua:typeof navigator<"u"?Vr(navigator.userAgent):ha()}function fa(e){return e!==""&&Hc.reduce(function(t,o){var r=o[0],n=o[1];if(t)return t;var i=n.exec(e);return!!i&&[r,i]},!1)}function jc(e){var t=fa(e);return t?t[0]:null}function Vr(e){var t=fa(e);if(!t)return null;var o=t[0],r=t[1];if(o==="searchbot")return new pa;var n=r[1]&&r[1].split(/[._]/).slice(0,3);n?n.length<aa&&(n=Bc(n,$c(aa-n.length))):n=[];var i=n.join("."),a=ma(e),s=Gc.exec(e);return s&&s[1]?new da(o,i,a,s[1]):new la(o,i,a)}function ma(e){for(var t=0,o=sa.length;t<o;t++){var r=sa[t],n=r[0],i=r[1],a=i.exec(e);if(a)return n}return null}function ha(){var e=typeof process<"u"&&process.version;return e?new ca(process.version.slice(1)):null}function $c(e){for(var t=[],o=0;o<e;o++)t.push("0");return t}var Bc,la,ca,da,pa,ua,Fc,Gc,aa,Hc,sa,ba=Jn(()=>{Bc=function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;for(var r=Array(e),n=0,t=0;t<o;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r},la=function(){function e(t,o,r){this.name=t,this.version=o,this.os=r,this.type="browser"}return e}(),ca=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),da=function(){function e(t,o,r,n){this.name=t,this.version=o,this.os=r,this.bot=n,this.type="bot-device"}return e}(),pa=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),ua=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),Fc=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Gc=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,aa=3,Hc=[["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|$)/],["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",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",Fc]],sa=[["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/],["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/]]});var $r=Ne(P=>{"use strict";Object.defineProperty(P,"__esModule",{value:!0});P.getClientMeta=P.getLocalStorage=P.getLocalStorageOrThrow=P.getCrypto=P.getCryptoOrThrow=P.getLocation=P.getLocationOrThrow=P.getNavigator=P.getNavigatorOrThrow=P.getDocument=P.getDocumentOrThrow=P.getFromWindowOrThrow=P.getFromWindow=P.isBrowser=P.isNode=P.isMobile=P.isIOS=P.isAndroid=P.detectOS=P.detectEnv=void 0;var ya=Go(),zc=ya.__importStar(ia()),Pe=ya.__importStar(Hr()),qc=(ba(),Qn(ga));function jr(e){return(0,qc.detect)(e)}P.detectEnv=jr;function Vo(){let e=jr();return e&&e.os?e.os:void 0}P.detectOS=Vo;function va(){let e=Vo();return e?e.toLowerCase().includes("android"):!1}P.isAndroid=va;function wa(){let e=Vo();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}P.isIOS=wa;function Zc(){return Vo()?va()||wa():!1}P.isMobile=Zc;function Ca(){let e=jr();return e&&e.name?e.name.toLowerCase()==="node":!1}P.isNode=Ca;function Kc(){return!Ca()&&!!(0,P.getNavigator)()}P.isBrowser=Kc;P.getFromWindow=Pe.getFromWindow;P.getFromWindowOrThrow=Pe.getFromWindowOrThrow;P.getDocumentOrThrow=Pe.getDocumentOrThrow;P.getDocument=Pe.getDocument;P.getNavigatorOrThrow=Pe.getNavigatorOrThrow;P.getNavigator=Pe.getNavigator;P.getLocationOrThrow=Pe.getLocationOrThrow;P.getLocation=Pe.getLocation;P.getCryptoOrThrow=Pe.getCryptoOrThrow;P.getCrypto=Pe.getCrypto;P.getLocalStorageOrThrow=Pe.getLocalStorageOrThrow;P.getLocalStorage=Pe.getLocalStorage;function Jc(){return zc.getWindowMetadata()}P.getClientMeta=Jc});var Ea={};Yn(Ea,{safeJsonParse:()=>Yc,safeJsonStringify:()=>Xc});function Yc(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return JSON.parse(e)}catch{return e}}function Xc(e){return typeof e=="string"?e:JSON.stringify(e)}var xa=Jn(()=>{});var zr=Ne(Mt=>{"use strict";Object.defineProperty(Mt,"__esModule",{value:!0});Mt.safeJsonStringify=Mt.safeJsonParse=void 0;var Qc=Go(),_a=Qc.__importStar((xa(),Qn(Ea)));Mt.safeJsonParse=_a.safeJsonParse;Mt.safeJsonStringify=_a.safeJsonStringify});var Zr=Ne(Ze=>{"use strict";Object.defineProperty(Ze,"__esModule",{value:!0});Ze.removeLocal=Ze.getLocal=Ze.setLocal=void 0;var Pa=zr(),qr=$r();function ed(e,t){let o=(0,Pa.safeJsonStringify)(t),r=(0,qr.getLocalStorage)();r&&r.setItem(e,o)}Ze.setLocal=ed;function td(e){let t=null,o=null,r=(0,qr.getLocalStorage)();return r&&(o=r.getItem(e)),t=o&&(0,Pa.safeJsonParse)(o),t}Ze.getLocal=td;function od(e){let t=(0,qr.getLocalStorage)();t&&t.removeItem(e)}Ze.removeLocal=od});var Sa=Ne(ue=>{"use strict";Object.defineProperty(ue,"__esModule",{value:!0});ue.getMobileLinkRegistry=ue.getMobileRegistryEntry=ue.saveMobileLinkInfo=ue.formatIOSMobile=ue.mobileLinkChoiceKey=void 0;var rd=Zr();ue.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function nd(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${o}`:""}ue.formatIOSMobile=nd;function id(e){let t=e.href.split("?")[0];(0,rd.setLocal)(ue.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}ue.saveMobileLinkInfo=id;function La(e,t){return e.filter(o=>o.name.toLowerCase().includes(t.toLowerCase()))[0]}ue.getMobileRegistryEntry=La;function ad(e,t){let o=e;return t&&(o=t.map(r=>La(e,r)).filter(Boolean)),o}ue.getMobileLinkRegistry=ad});var Ta=Ne(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.formatMobileRegistry=ke.formatMobileRegistryEntry=ke.getDappRegistryUrl=ke.getWalletRegistryUrl=void 0;var Aa="https://registry.walletconnect.com";function sd(){return Aa+"/api/v2/wallets"}ke.getWalletRegistryUrl=sd;function ld(){return Aa+"/api/v2/dapps"}ke.getDappRegistryUrl=ld;function ka(e,t="mobile"){var o;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:(o=e.image_url.sm)!==null&&o!==void 0?o:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}ke.formatMobileRegistryEntry=ka;function cd(e,t="mobile"){return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>ka(o,t))}ke.formatMobileRegistry=cd});var Wa=Ne(ut=>{"use strict";Object.defineProperty(ut,"__esModule",{value:!0});var oo=Go();oo.__exportStar($r(),ut);oo.__exportStar(zr(),ut);oo.__exportStar(Zr(),ut);oo.__exportStar(Sa(),ut);oo.__exportStar(Ta(),ut)});import{Web3Provider as r2}from"@ethersproject/providers";import{useEffect as qn,useState as ie}from"react";var x=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};import rc from"axios";var Le=class extends Error{constructor(o,r){super(o);r instanceof Error&&(this.cause=r)}toString(){return`${this.type}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},_t=class extends Le{constructor(o,r,n,i){super(n,i);this.type=o;this.status=r}},C=class extends Le{constructor(o,r){super(o,r);this.type="client_error"}};var G=class extends Le{constructor(o,r){super(o,r);this.type="connector_error"}},Z=e=>{if(e instanceof Le)return e;if(!rc.isAxiosError(e))return we(e);if(!e.response)return new _t("api_error",null,e.message,e);let{type:t,message:o,error:r}=e.response.data;return new _t(t||"ApiError",e.response.status,o||r,e)},we=e=>e instanceof Le?e:e instanceof Error?new C(e.message,e):new C(`Internal error: ${e}`);var ei=()=>"/api/v1/sessions",ti=()=>"/api/v1/sessions/logout",oi=()=>"/api/v1/sessions/fork",ri=()=>"/api/v1/sessions/fork/recover",ni=()=>"/api/v1/siwe/init",ii=()=>"/api/v1/siwe/authenticate",ai=()=>"/api/v1/siwe/link",si=()=>"/api/v1/passwordless/init",li=()=>"/api/v1/passwordless/authenticate",ci=()=>"/api/v1/passwordless/link",di=()=>"/api/v1/passwordless_sms/init",pi=()=>"/api/v1/passwordless_sms/authenticate",ui=()=>"/api/v1/passwordless_sms/link",fi=()=>"/api/v1/oauth/init",mi=()=>"/api/v1/oauth/authenticate",hi=()=>"/api/v1/oauth/link",gi=()=>"/api/v1/siwe/unlink",bi=()=>"/api/v1/passwordless/unlink",yi=()=>"/api/v1/passwordless_sms/unlink",vi=()=>"/api/v1/oauth/unlink",wi=()=>"/api/v1/analytics_events";var nt=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=li(),o=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new C("Email and email code must be set prior to calling authenticate.");try{let t=ci();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw Z(t)}}async sendCodeEmail(t){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new C("Email must be set when initialzing authentication.");try{let o=si();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw Z(o)}}};var ze=class{constructor(t,o,r){this.meta={provider:t},this.meta.authorizationCode=o,this.meta.stateCode=r}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");try{let t=mi(),o=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new C("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new C("User denied confirmation during OAuth flow");try{let t=hi();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw Z(t)}}async getAuthorizationUrl(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.provider)throw new C("Provider must be set when initialzing OAuth authentication.");try{let t=fi();return(await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(t){throw Z(t)}}};var qe=class{constructor(t,o,r){this._meta={walletType:o,walletId:r},this.connectors=t,this.walletConnector=this.connectors.createWalletConnector(o,null,r)}get meta(){return{...this._meta,walletName:this.walletConnector.walletBranding.name,walletIcon:this.walletConnector.walletBranding.icon}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(ii(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(ai(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),r.data}catch(t){throw Z(t)}}async promptConnect(){if(!this.api)throw new C("Auth flow has no API instance");let t=await this.walletConnector.connect({showPrompt:!0});return await this.buildSiweMessage(t),t}async sign(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.preparedMessage){let o=await this.walletConnector.connect({showPrompt:!1});await this.buildSiweMessage(o)}if(!this.preparedMessage)throw new C("Could not prepare SIWE message");let t=await this.walletConnector.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async buildSiweMessage(t){if(!this.api)throw new C("Auth flow has no API instance");let o=t.address,r=t.chainId,n=await this.api.post(ni(),{address:o});return this.preparedMessage=this.walletConnector.prepareMessage(r,o,n.data.nonce),this.preparedMessage}};var it=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=pi(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw Z(t)}}async link(){if(!this.api)throw new C("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new C("phone number and sms code must be set prior to calling authenticate.");try{let t=ui();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw Z(t)}}async sendSmsCode(t){if(!this.api)throw new C("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new C("phone nNumber must be set when initialzing authentication.");try{let o=di();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw Z(o)}}};import{getAddress as pd}from"@ethersproject/address";var Ci="1.21.0";var Ei="https://api.privy.io/v0",Lo=process.env.NEXT_PUBLIC_PRIVY_AUTH_URL||"https://auth.privy.io",So="4df5e2316331463a9130964bd6078dfa",xi=1e4,Ce=1400,Wr=Ci;var Pt="privy:token",Ao="privy:refresh_token",to="privy:session_transfer_token",ko="privy:connectors",Rr="walletconnect",_i=3e4;var Ir=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,o){o!==void 0?this._cache[t]=o:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Mr=class{get(t){let o=localStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?localStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function ic(){return typeof window<"u"&&window.localStorage?new Mr:new Ir}var H=ic();import mc from"@coinbase/wallet-sdk";import{getAddress as hc}from"@ethersproject/address";import{jsx as Pi,jsxs as ac}from"react/jsx-runtime";var Ee=({style:e,...t})=>ac("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[Pi("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),Pi("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});import{getAddress as uc}from"@ethersproject/address";import{Web3Provider as fc}from"@ethersproject/providers";import{ErrorCode as sc}from"@ethersproject/logger";var Lt=class extends G{constructor(){super("Wallet timeout");this.type="wallet_error"}},st=class extends G{constructor(){super("User rejected connection");this.type="wallet_error"}},xe=e=>{if(e instanceof G)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new St(e);return e.code===sc.ACTION_REJECTED&&(t.details=at.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new St(e):new G("Unknown connector error",e)},Or=class extends Le{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},St=class extends Or{constructor(o){var i,a,s;let r=o;super(r.message,r.code,r.data);let n=Object.values(at).find(l=>l.eipCode===r.code);this.details=n||at.UNKNOWN_ERROR,r.code===-32002&&((i=r.message)!=null&&i.includes("already pending for origin")?(a=r.message)!=null&&a.includes("wallet_requestPermissions")?this.details=at.E32002_CONNECTION_ALREADY_PENDING:this.details=at.E32002_REQUEST_ALREADY_PENDING:(s=r.message)!=null&&s.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=at.E32002_WALLET_LOCKED))}},lc={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},cc={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},dc={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},at={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...dc,...cc},lt={...lc,...at};var pc=12e4,Nr=(e=new Lt,t=pc)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),Se=class{constructor(t){this.removeListener=(t,o)=>{if(this.walletProvider)return this.walletProvider.removeListener(t,o)};this.setWalletProvider=t=>{this.walletProvider=t,this._subscriptions.forEach(o=>{var r;(r=this.walletProvider)==null||r.on(o.eventName,o.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new G(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),Nr()]).catch(o=>{throw xe(o)})}},ct=class extends Se{constructor(o){super(o)}},To=class extends Se{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Ae=class{constructor(t,o,r){this.createSiweMessage=(t,o,r,n,i,a,s)=>`${r} wants you to sign in with your Ethereum account:
2
2
  ${o}
3
3
 
4
4
  ${s}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var Kl=Object.create;var Fo=Object.defineProperty;var Jl=Object.getOwnPropertyDescriptor;var Yl=Object.getOwnPropertyNames;var Xl=Object.getPrototypeOf,Ql=Object.prototype.hasOwnProperty;var di=(e,t)=>()=>(e&&(t=e(e=0)),t);var lt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),en=(e,t)=>{for(var o in t)Fo(e,o,{get:t[o],enumerable:!0})},pi=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Yl(t))!Ql.call(e,n)&&n!==o&&Fo(e,n,{get:()=>t[n],enumerable:!(r=Jl(t,n))||r.enumerable});return e};var L=(e,t,o)=>(o=e!=null?Kl(Xl(e)):{},pi(t||!e||!e.__esModule?Fo(o,"default",{value:e,enumerable:!0}):o,e)),tn=e=>pi(Fo({},"__esModule",{value:!0}),e);var nr=lt((gu,rr)=>{var ta,oa,ra,na,ia,aa,sa,la,ca,tr,un,da,pa,ua,to,fa,ma,ha,ga,ba,ya,va,wa,Ca,or;(function(e){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(r){e(o(t,o(r)))}):typeof rr=="object"&&typeof rr.exports=="object"?e(o(t,o(rr.exports))):e(o(t));function o(r,n){return r!==t&&(typeof Object.create=="function"?Object.defineProperty(r,"__esModule",{value:!0}):r.__esModule=!0),function(i,a){return r[i]=n?n(i,a):a}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])};ta=function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(r,n);function i(){this.constructor=r}r.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},oa=Object.assign||function(r){for(var n,i=1,a=arguments.length;i<a;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},ra=function(r,n){var i={};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&n.indexOf(a)<0&&(i[a]=r[a]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(r);s<a.length;s++)n.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(r,a[s])&&(i[a[s]]=r[a[s]]);return i},na=function(r,n,i,a){var s=arguments.length,l=s<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,i):a,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(r,n,i,a);else for(var h=r.length-1;h>=0;h--)(c=r[h])&&(l=(s<3?c(l):s>3?c(n,i,l):c(n,i))||l);return s>3&&l&&Object.defineProperty(n,i,l),l},ia=function(r,n){return function(i,a){n(i,a,r)}},aa=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},sa=function(r,n,i,a){function s(l){return l instanceof i?l:new i(function(c){c(l)})}return new(i||(i=Promise))(function(l,c){function h(b){try{p(a.next(b))}catch(y){c(y)}}function m(b){try{p(a.throw(b))}catch(y){c(y)}}function p(b){b.done?l(b.value):s(b.value).then(h,m)}p((a=a.apply(r,n||[])).next())})},la=function(r,n){var i={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},a,s,l,c;return c={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function h(p){return function(b){return m([p,b])}}function m(p){if(a)throw new TypeError("Generator is already executing.");for(;i;)try{if(a=1,s&&(l=p[0]&2?s.return:p[0]?s.throw||((l=s.return)&&l.call(s),0):s.next)&&!(l=l.call(s,p[1])).done)return l;switch(s=0,l&&(p=[p[0]&2,l.value]),p[0]){case 0:case 1:l=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,s=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(l=i.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){i.label=p[1];break}if(p[0]===6&&i.label<l[1]){i.label=l[1],l=p;break}if(l&&i.label<l[2]){i.label=l[2],i.ops.push(p);break}l[2]&&i.ops.pop(),i.trys.pop();continue}p=n.call(r,i)}catch(b){p=[6,b],s=0}finally{a=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},ca=function(r,n){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(n,i)&&or(n,r,i)},or=Object.create?function(r,n,i,a){a===void 0&&(a=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(r,a,s)}:function(r,n,i,a){a===void 0&&(a=i),r[a]=n[i]},tr=function(r){var n=typeof Symbol=="function"&&Symbol.iterator,i=n&&r[n],a=0;if(i)return i.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&a>=r.length&&(r=void 0),{value:r&&r[a++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},un=function(r,n){var i=typeof Symbol=="function"&&r[Symbol.iterator];if(!i)return r;var a=i.call(r),s,l=[],c;try{for(;(n===void 0||n-- >0)&&!(s=a.next()).done;)l.push(s.value)}catch(h){c={error:h}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(c)throw c.error}}return l},da=function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(un(arguments[n]));return r},pa=function(){for(var r=0,n=0,i=arguments.length;n<i;n++)r+=arguments[n].length;for(var a=Array(r),s=0,n=0;n<i;n++)for(var l=arguments[n],c=0,h=l.length;c<h;c++,s++)a[s]=l[c];return a},ua=function(r,n,i){if(i||arguments.length===2)for(var a=0,s=n.length,l;a<s;a++)(l||!(a in n))&&(l||(l=Array.prototype.slice.call(n,0,a)),l[a]=n[a]);return r.concat(l||Array.prototype.slice.call(n))},to=function(r){return this instanceof to?(this.v=r,this):new to(r)},fa=function(r,n,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=i.apply(r,n||[]),s,l=[];return s={},c("next"),c("throw"),c("return"),s[Symbol.asyncIterator]=function(){return this},s;function c(d){a[d]&&(s[d]=function(v){return new Promise(function(C,T){l.push([d,v,C,T])>1||h(d,v)})})}function h(d,v){try{m(a[d](v))}catch(C){y(l[0][3],C)}}function m(d){d.value instanceof to?Promise.resolve(d.value.v).then(p,b):y(l[0][2],d)}function p(d){h("next",d)}function b(d){h("throw",d)}function y(d,v){d(v),l.shift(),l.length&&h(l[0][0],l[0][1])}},ma=function(r){var n,i;return n={},a("next"),a("throw",function(s){throw s}),a("return"),n[Symbol.iterator]=function(){return this},n;function a(s,l){n[s]=r[s]?function(c){return(i=!i)?{value:to(r[s](c)),done:s==="return"}:l?l(c):c}:l}},ha=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],i;return n?n.call(r):(r=typeof tr=="function"?tr(r):r[Symbol.iterator](),i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i);function a(l){i[l]=r[l]&&function(c){return new Promise(function(h,m){c=r[l](c),s(h,m,c.done,c.value)})}}function s(l,c,h,m){Promise.resolve(m).then(function(p){l({value:p,done:h})},c)}},ga=function(r,n){return Object.defineProperty?Object.defineProperty(r,"raw",{value:n}):r.raw=n,r};var o=Object.create?function(r,n){Object.defineProperty(r,"default",{enumerable:!0,value:n})}:function(r,n){r.default=n};ba=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var i in r)i!=="default"&&Object.prototype.hasOwnProperty.call(r,i)&&or(n,r,i);return o(n,r),n},ya=function(r){return r&&r.__esModule?r:{default:r}},va=function(r,n,i,a){if(i==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?r!==n||!a:!n.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(r):a?a.value:n.get(r)},wa=function(r,n,i,a,s){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof n=="function"?r!==n||!s:!n.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?s.call(r,i):s?s.value=i:n.set(r,i),i},Ca=function(r,n){if(n===null||typeof n!="object"&&typeof n!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof r=="function"?n===r:r.has(n)},e("__extends",ta),e("__assign",oa),e("__rest",ra),e("__decorate",na),e("__param",ia),e("__metadata",aa),e("__awaiter",sa),e("__generator",la),e("__exportStar",ca),e("__createBinding",or),e("__values",tr),e("__read",un),e("__spread",da),e("__spreadArrays",pa),e("__spreadArray",ua),e("__await",to),e("__asyncGenerator",fa),e("__asyncDelegator",ma),e("__asyncValues",ha),e("__makeTemplateObject",ga),e("__importStar",ba),e("__importDefault",ya),e("__classPrivateFieldGet",va),e("__classPrivateFieldSet",wa),e("__classPrivateFieldIn",Ca)})});var fn=lt(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.getLocalStorage=G.getLocalStorageOrThrow=G.getCrypto=G.getCryptoOrThrow=G.getLocation=G.getLocationOrThrow=G.getNavigator=G.getNavigatorOrThrow=G.getDocument=G.getDocumentOrThrow=G.getFromWindowOrThrow=G.getFromWindow=void 0;function Bt(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}G.getFromWindow=Bt;function oo(e){let t=Bt(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}G.getFromWindowOrThrow=oo;function lc(){return oo("document")}G.getDocumentOrThrow=lc;function cc(){return Bt("document")}G.getDocument=cc;function dc(){return oo("navigator")}G.getNavigatorOrThrow=dc;function pc(){return Bt("navigator")}G.getNavigator=pc;function uc(){return oo("location")}G.getLocationOrThrow=uc;function fc(){return Bt("location")}G.getLocation=fc;function mc(){return oo("crypto")}G.getCryptoOrThrow=mc;function hc(){return Bt("crypto")}G.getCrypto=hc;function gc(){return oo("localStorage")}G.getLocalStorageOrThrow=gc;function bc(){return Bt("localStorage")}G.getLocalStorage=bc});var xa=lt(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.getWindowMetadata=void 0;var Ea=fn();function yc(){let e,t;try{e=Ea.getDocumentOrThrow(),t=Ea.getLocationOrThrow()}catch{return null}function o(){let m=e.getElementsByTagName("link"),p=[];for(let b=0;b<m.length;b++){let y=m[b],d=y.getAttribute("rel");if(d&&d.toLowerCase().indexOf("icon")>-1){let v=y.getAttribute("href");if(v)if(v.toLowerCase().indexOf("https:")===-1&&v.toLowerCase().indexOf("http:")===-1&&v.indexOf("//")!==0){let C=t.protocol+"//"+t.host;if(v.indexOf("/")===0)C+=v;else{let T=t.pathname.split("/");T.pop(),C+=T.join("/")+"/"+v}p.push(C)}else if(v.indexOf("//")===0){let C=t.protocol+v;p.push(C)}else p.push(v)}}return p}function r(...m){let p=e.getElementsByTagName("meta");for(let b=0;b<p.length;b++){let y=p[b],d=["itemprop","property","name"].map(v=>y.getAttribute(v)).filter(v=>v?m.includes(v):!1);if(d.length&&d){let v=y.getAttribute("content");if(v)return v}}return""}function n(){let m=r("name","og:site_name","og:title","twitter:title");return m||(m=e.title),m}function i(){return r("description","og:description","twitter:description","keywords")}let a=n(),s=i(),l=t.origin,c=o();return{description:s,url:l,icons:c,name:a}}ir.getWindowMetadata=yc});var Ma={};en(Ma,{BotInfo:()=>ka,BrowserInfo:()=>La,NodeInfo:()=>Sa,ReactNativeInfo:()=>Ta,SearchBotDeviceInfo:()=>Aa,browserName:()=>_c,detect:()=>xc,detectOS:()=>Ra,getNodeVersion:()=>Ia,parseUserAgent:()=>mn});function xc(e){return e?mn(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Ta:typeof navigator<"u"?mn(navigator.userAgent):Ia()}function Wa(e){return e!==""&&Ec.reduce(function(t,o){var r=o[0],n=o[1];if(t)return t;var i=n.exec(e);return!!i&&[r,i]},!1)}function _c(e){var t=Wa(e);return t?t[0]:null}function mn(e){var t=Wa(e);if(!t)return null;var o=t[0],r=t[1];if(o==="searchbot")return new ka;var n=r[1]&&r[1].split(/[._]/).slice(0,3);n?n.length<_a&&(n=vc(n,Pc(_a-n.length))):n=[];var i=n.join("."),a=Ra(e),s=Cc.exec(e);return s&&s[1]?new Aa(o,i,a,s[1]):new La(o,i,a)}function Ra(e){for(var t=0,o=Pa.length;t<o;t++){var r=Pa[t],n=r[0],i=r[1],a=i.exec(e);if(a)return n}return null}function Ia(){var e=typeof process<"u"&&process.version;return e?new Sa(process.version.slice(1)):null}function Pc(e){for(var t=[],o=0;o<e;o++)t.push("0");return t}var vc,La,Sa,Aa,ka,Ta,wc,Cc,_a,Ec,Pa,Oa=di(()=>{vc=function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;for(var r=Array(e),n=0,t=0;t<o;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r},La=function(){function e(t,o,r){this.name=t,this.version=o,this.os=r,this.type="browser"}return e}(),Sa=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),Aa=function(){function e(t,o,r,n){this.name=t,this.version=o,this.os=r,this.bot=n,this.type="bot-device"}return e}(),ka=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),Ta=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),wc=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Cc=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,_a=3,Ec=[["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|$)/],["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",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",wc]],Pa=[["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/],["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/]]});var gn=lt(S=>{"use strict";Object.defineProperty(S,"__esModule",{value:!0});S.getClientMeta=S.getLocalStorage=S.getLocalStorageOrThrow=S.getCrypto=S.getCryptoOrThrow=S.getLocation=S.getLocationOrThrow=S.getNavigator=S.getNavigatorOrThrow=S.getDocument=S.getDocumentOrThrow=S.getFromWindowOrThrow=S.getFromWindow=S.isBrowser=S.isNode=S.isMobile=S.isIOS=S.isAndroid=S.detectOS=S.detectEnv=void 0;var Na=nr(),Lc=Na.__importStar(xa()),He=Na.__importStar(fn()),Sc=(Oa(),tn(Ma));function hn(e){return(0,Sc.detect)(e)}S.detectEnv=hn;function ar(){let e=hn();return e&&e.os?e.os:void 0}S.detectOS=ar;function Da(){let e=ar();return e?e.toLowerCase().includes("android"):!1}S.isAndroid=Da;function Ua(){let e=ar();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}S.isIOS=Ua;function Ac(){return ar()?Da()||Ua():!1}S.isMobile=Ac;function Ba(){let e=hn();return e&&e.name?e.name.toLowerCase()==="node":!1}S.isNode=Ba;function kc(){return!Ba()&&!!(0,S.getNavigator)()}S.isBrowser=kc;S.getFromWindow=He.getFromWindow;S.getFromWindowOrThrow=He.getFromWindowOrThrow;S.getDocumentOrThrow=He.getDocumentOrThrow;S.getDocument=He.getDocument;S.getNavigatorOrThrow=He.getNavigatorOrThrow;S.getNavigator=He.getNavigator;S.getLocationOrThrow=He.getLocationOrThrow;S.getLocation=He.getLocation;S.getCryptoOrThrow=He.getCryptoOrThrow;S.getCrypto=He.getCrypto;S.getLocalStorageOrThrow=He.getLocalStorageOrThrow;S.getLocalStorage=He.getLocalStorage;function Tc(){return Lc.getWindowMetadata()}S.getClientMeta=Tc});var Fa={};en(Fa,{safeJsonParse:()=>Wc,safeJsonStringify:()=>Rc});function Wc(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return JSON.parse(e)}catch{return e}}function Rc(e){return typeof e=="string"?e:JSON.stringify(e)}var Ga=di(()=>{});var bn=lt(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.safeJsonStringify=ro.safeJsonParse=void 0;var Ic=nr(),Ha=Ic.__importStar((Ga(),tn(Fa)));ro.safeJsonParse=Ha.safeJsonParse;ro.safeJsonStringify=Ha.safeJsonStringify});var vn=lt(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.removeLocal=wt.getLocal=wt.setLocal=void 0;var Va=bn(),yn=gn();function Mc(e,t){let o=(0,Va.safeJsonStringify)(t),r=(0,yn.getLocalStorage)();r&&r.setItem(e,o)}wt.setLocal=Mc;function Oc(e){let t=null,o=null,r=(0,yn.getLocalStorage)();return r&&(o=r.getItem(e)),t=o&&(0,Va.safeJsonParse)(o),t}wt.getLocal=Oc;function Nc(e){let t=(0,yn.getLocalStorage)();t&&t.removeItem(e)}wt.removeLocal=Nc});var $a=lt(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.getMobileLinkRegistry=Ee.getMobileRegistryEntry=Ee.saveMobileLinkInfo=Ee.formatIOSMobile=Ee.mobileLinkChoiceKey=void 0;var Dc=vn();Ee.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function Uc(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${o}`:""}Ee.formatIOSMobile=Uc;function Bc(e){let t=e.href.split("?")[0];(0,Dc.setLocal)(Ee.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}Ee.saveMobileLinkInfo=Bc;function ja(e,t){return e.filter(o=>o.name.toLowerCase().includes(t.toLowerCase()))[0]}Ee.getMobileRegistryEntry=ja;function Fc(e,t){let o=e;return t&&(o=t.map(r=>ja(e,r)).filter(Boolean)),o}Ee.getMobileLinkRegistry=Fc});var Za=lt(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.formatMobileRegistry=et.formatMobileRegistryEntry=et.getDappRegistryUrl=et.getWalletRegistryUrl=void 0;var za="https://registry.walletconnect.com";function Gc(){return za+"/api/v2/wallets"}et.getWalletRegistryUrl=Gc;function Hc(){return za+"/api/v2/dapps"}et.getDappRegistryUrl=Hc;function qa(e,t="mobile"){var o;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:(o=e.image_url.sm)!==null&&o!==void 0?o:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}et.formatMobileRegistryEntry=qa;function Vc(e,t="mobile"){return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>qa(o,t))}et.formatMobileRegistry=Vc});var Ka=lt(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});var Lo=nr();Lo.__exportStar(gn(),Ft);Lo.__exportStar(bn(),Ft);Lo.__exportStar(vn(),Ft);Lo.__exportStar($a(),Ft);Lo.__exportStar(Za(),Ft)});var pp={};en(pp,{AsExternalProvider:()=>vt,ConnectorManager:()=>no,PrivyClient:()=>ao,PrivyProvider:()=>jl,PrivyProxyProvider:()=>Ue,VERSION:()=>Vo,WalletConnector:()=>Be,getAccessToken:()=>Vl,usePrivy:()=>N});module.exports=tn(pp);var Hl=require("@ethersproject/providers"),te=require("react");var _=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var ui=L(require("axios")),qe=class extends Error{constructor(o,r){super(o);r instanceof Error&&(this.cause=r)}toString(){return`${this.type}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Kt=class extends qe{constructor(o,r,n,i){super(n,i);this.type=o;this.status=r}},x=class extends qe{constructor(o,r){super(o,r);this.type="client_error"}};var q=class extends qe{constructor(o,r){super(o,r);this.type="connector_error"}},re=e=>{if(e instanceof qe)return e;if(!ui.default.isAxiosError(e))return Me(e);if(!e.response)return new Kt("api_error",null,e.message,e);let{type:t,message:o,error:r}=e.response.data;return new Kt(t||"ApiError",e.response.status,o||r,e)},Me=e=>e instanceof qe?e:e instanceof Error?new x(e.message,e):new x(`Internal error: ${e}`);var fi=()=>"/api/v1/sessions",mi=()=>"/api/v1/sessions/logout",hi=()=>"/api/v1/sessions/fork",gi=()=>"/api/v1/sessions/fork/recover",bi=()=>"/api/v1/siwe/init",yi=()=>"/api/v1/siwe/authenticate",vi=()=>"/api/v1/siwe/link",wi=()=>"/api/v1/passwordless/init",Ci=()=>"/api/v1/passwordless/authenticate",Ei=()=>"/api/v1/passwordless/link",xi=()=>"/api/v1/passwordless_sms/init",_i=()=>"/api/v1/passwordless_sms/authenticate",Pi=()=>"/api/v1/passwordless_sms/link",Li=()=>"/api/v1/oauth/init",Si=()=>"/api/v1/oauth/authenticate",Ai=()=>"/api/v1/oauth/link",ki=()=>"/api/v1/siwe/unlink",Ti=()=>"/api/v1/passwordless/unlink",Wi=()=>"/api/v1/passwordless_sms/unlink",Ri=()=>"/api/v1/oauth/unlink",Ii=()=>"/api/v1/analytics_events";var It=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{let t=Ci(),o=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw re(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{let t=Ei();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw re(t)}}async sendCodeEmail(t){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new x("Email must be set when initialzing authentication.");try{let o=wi();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw re(o)}}};var bt=class{constructor(t,o,r){this.meta={provider:t},this.meta.authorizationCode=o,this.meta.stateCode=r}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");try{let t=Si(),o=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw re(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");try{let t=Ai();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw re(t)}}async getAuthorizationUrl(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.provider)throw new x("Provider must be set when initialzing OAuth authentication.");try{let t=Li();return(await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(t){throw re(t)}}};var yt=class{constructor(t,o,r){this._meta={walletType:o,walletId:r},this.connectors=t,this.walletConnector=this.connectors.createWalletConnector(o,null,r)}get meta(){return{...this._meta,walletName:this.walletConnector.walletBranding.name,walletIcon:this.walletConnector.walletBranding.icon}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(yi(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw re(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(vi(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),r.data}catch(t){throw re(t)}}async promptConnect(){if(!this.api)throw new x("Auth flow has no API instance");let t=await this.walletConnector.connect({showPrompt:!0});return await this.buildSiweMessage(t),t}async sign(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.preparedMessage){let o=await this.walletConnector.connect({showPrompt:!1});await this.buildSiweMessage(o)}if(!this.preparedMessage)throw new x("Could not prepare SIWE message");let t=await this.walletConnector.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async buildSiweMessage(t){if(!this.api)throw new x("Auth flow has no API instance");let o=t.address,r=t.chainId,n=await this.api.post(bi(),{address:o});return this.preparedMessage=this.walletConnector.prepareMessage(r,o,n.data.nonce),this.preparedMessage}};var Mt=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{let t=_i(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw re(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{let t=Pi();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw re(t)}}async sendSmsCode(t){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new x("phone nNumber must be set when initialzing authentication.");try{let o=xi();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw re(o)}}};var os=require("@ethersproject/address");var Mi="1.21.0-beta.9";var Oi="https://api.privy.io/v0",Go=process.env.NEXT_PUBLIC_PRIVY_AUTH_URL||"https://auth.privy.io",Ho="4df5e2316331463a9130964bd6078dfa",Ni=1e4,Oe=1400,Vo=Mi;var Jt="privy:token",jo="privy:refresh_token",_o="privy:session_transfer_token",$o="privy:connectors",on="walletconnect",Di=3e4;var rn=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,o){o!==void 0?this._cache[t]=o:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},nn=class{get(t){let o=localStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?localStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function tc(){return typeof window<"u"&&window.localStorage?new nn:new rn}var Z=tc();var Gi=L(require("@coinbase/wallet-sdk")),Hi=require("@ethersproject/address");var Po=require("react/jsx-runtime"),Ne=({style:e,...t})=>(0,Po.jsxs)("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[(0,Po.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,Po.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});var Bi=require("@ethersproject/address"),Fi=require("@ethersproject/providers");var Ui=require("@ethersproject/logger");var Yt=class extends q{constructor(){super("Wallet timeout");this.type="wallet_error"}},Nt=class extends q{constructor(){super("User rejected connection");this.type="wallet_error"}},De=e=>{if(e instanceof q)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new Xt(e);return e.code===Ui.ErrorCode.ACTION_REJECTED&&(t.details=Ot.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new Xt(e):new q("Unknown connector error",e)},an=class extends qe{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Xt=class extends an{constructor(o){var i,a,s;let r=o;super(r.message,r.code,r.data);let n=Object.values(Ot).find(l=>l.eipCode===r.code);this.details=n||Ot.UNKNOWN_ERROR,r.code===-32002&&((i=r.message)!=null&&i.includes("already pending for origin")?(a=r.message)!=null&&a.includes("wallet_requestPermissions")?this.details=Ot.E32002_CONNECTION_ALREADY_PENDING:this.details=Ot.E32002_REQUEST_ALREADY_PENDING:(s=r.message)!=null&&s.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=Ot.E32002_WALLET_LOCKED))}},oc={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},rc={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},nc={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},Ot={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...nc,...rc},Dt={...oc,...Ot};var ic=12e4,sn=(e=new Yt,t=ic)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),Ue=class{constructor(t){this.removeListener=(t,o)=>{if(this.walletProvider)return this.walletProvider.removeListener(t,o)};this.setWalletProvider=t=>{this.walletProvider=t,this._subscriptions.forEach(o=>{var r;(r=this.walletProvider)==null||r.on(o.eventName,o.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new q(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),sn()]).catch(o=>{throw De(o)})}},vt=class extends Ue{constructor(o){super(o)}},zo=class extends Ue{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Be=class{constructor(t,o,r){this.createSiweMessage=(t,o,r,n,i,a,s)=>`${r} wants you to sign in with your Ethereum account:
1
+ "use strict";var Kl=Object.create;var Fo=Object.defineProperty;var Jl=Object.getOwnPropertyDescriptor;var Yl=Object.getOwnPropertyNames;var Xl=Object.getPrototypeOf,Ql=Object.prototype.hasOwnProperty;var di=(e,t)=>()=>(e&&(t=e(e=0)),t);var lt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),en=(e,t)=>{for(var o in t)Fo(e,o,{get:t[o],enumerable:!0})},pi=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Yl(t))!Ql.call(e,n)&&n!==o&&Fo(e,n,{get:()=>t[n],enumerable:!(r=Jl(t,n))||r.enumerable});return e};var L=(e,t,o)=>(o=e!=null?Kl(Xl(e)):{},pi(t||!e||!e.__esModule?Fo(o,"default",{value:e,enumerable:!0}):o,e)),tn=e=>pi(Fo({},"__esModule",{value:!0}),e);var nr=lt((gu,rr)=>{var ta,oa,ra,na,ia,aa,sa,la,ca,tr,un,da,pa,ua,to,fa,ma,ha,ga,ba,ya,va,wa,Ca,or;(function(e){var t=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(r){e(o(t,o(r)))}):typeof rr=="object"&&typeof rr.exports=="object"?e(o(t,o(rr.exports))):e(o(t));function o(r,n){return r!==t&&(typeof Object.create=="function"?Object.defineProperty(r,"__esModule",{value:!0}):r.__esModule=!0),function(i,a){return r[i]=n?n(i,a):a}}})(function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])};ta=function(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(r,n);function i(){this.constructor=r}r.prototype=n===null?Object.create(n):(i.prototype=n.prototype,new i)},oa=Object.assign||function(r){for(var n,i=1,a=arguments.length;i<a;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},ra=function(r,n){var i={};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&n.indexOf(a)<0&&(i[a]=r[a]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,a=Object.getOwnPropertySymbols(r);s<a.length;s++)n.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(r,a[s])&&(i[a[s]]=r[a[s]]);return i},na=function(r,n,i,a){var s=arguments.length,l=s<3?n:a===null?a=Object.getOwnPropertyDescriptor(n,i):a,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(r,n,i,a);else for(var h=r.length-1;h>=0;h--)(c=r[h])&&(l=(s<3?c(l):s>3?c(n,i,l):c(n,i))||l);return s>3&&l&&Object.defineProperty(n,i,l),l},ia=function(r,n){return function(i,a){n(i,a,r)}},aa=function(r,n){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,n)},sa=function(r,n,i,a){function s(l){return l instanceof i?l:new i(function(c){c(l)})}return new(i||(i=Promise))(function(l,c){function h(b){try{p(a.next(b))}catch(y){c(y)}}function m(b){try{p(a.throw(b))}catch(y){c(y)}}function p(b){b.done?l(b.value):s(b.value).then(h,m)}p((a=a.apply(r,n||[])).next())})},la=function(r,n){var i={label:0,sent:function(){if(l[0]&1)throw l[1];return l[1]},trys:[],ops:[]},a,s,l,c;return c={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function h(p){return function(b){return m([p,b])}}function m(p){if(a)throw new TypeError("Generator is already executing.");for(;i;)try{if(a=1,s&&(l=p[0]&2?s.return:p[0]?s.throw||((l=s.return)&&l.call(s),0):s.next)&&!(l=l.call(s,p[1])).done)return l;switch(s=0,l&&(p=[p[0]&2,l.value]),p[0]){case 0:case 1:l=p;break;case 4:return i.label++,{value:p[1],done:!1};case 5:i.label++,s=p[1],p=[0];continue;case 7:p=i.ops.pop(),i.trys.pop();continue;default:if(l=i.trys,!(l=l.length>0&&l[l.length-1])&&(p[0]===6||p[0]===2)){i=0;continue}if(p[0]===3&&(!l||p[1]>l[0]&&p[1]<l[3])){i.label=p[1];break}if(p[0]===6&&i.label<l[1]){i.label=l[1],l=p;break}if(l&&i.label<l[2]){i.label=l[2],i.ops.push(p);break}l[2]&&i.ops.pop(),i.trys.pop();continue}p=n.call(r,i)}catch(b){p=[6,b],s=0}finally{a=l=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}},ca=function(r,n){for(var i in r)i!=="default"&&!Object.prototype.hasOwnProperty.call(n,i)&&or(n,r,i)},or=Object.create?function(r,n,i,a){a===void 0&&(a=i);var s=Object.getOwnPropertyDescriptor(n,i);(!s||("get"in s?!n.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return n[i]}}),Object.defineProperty(r,a,s)}:function(r,n,i,a){a===void 0&&(a=i),r[a]=n[i]},tr=function(r){var n=typeof Symbol=="function"&&Symbol.iterator,i=n&&r[n],a=0;if(i)return i.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&a>=r.length&&(r=void 0),{value:r&&r[a++],done:!r}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")},un=function(r,n){var i=typeof Symbol=="function"&&r[Symbol.iterator];if(!i)return r;var a=i.call(r),s,l=[],c;try{for(;(n===void 0||n-- >0)&&!(s=a.next()).done;)l.push(s.value)}catch(h){c={error:h}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(c)throw c.error}}return l},da=function(){for(var r=[],n=0;n<arguments.length;n++)r=r.concat(un(arguments[n]));return r},pa=function(){for(var r=0,n=0,i=arguments.length;n<i;n++)r+=arguments[n].length;for(var a=Array(r),s=0,n=0;n<i;n++)for(var l=arguments[n],c=0,h=l.length;c<h;c++,s++)a[s]=l[c];return a},ua=function(r,n,i){if(i||arguments.length===2)for(var a=0,s=n.length,l;a<s;a++)(l||!(a in n))&&(l||(l=Array.prototype.slice.call(n,0,a)),l[a]=n[a]);return r.concat(l||Array.prototype.slice.call(n))},to=function(r){return this instanceof to?(this.v=r,this):new to(r)},fa=function(r,n,i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=i.apply(r,n||[]),s,l=[];return s={},c("next"),c("throw"),c("return"),s[Symbol.asyncIterator]=function(){return this},s;function c(d){a[d]&&(s[d]=function(v){return new Promise(function(C,T){l.push([d,v,C,T])>1||h(d,v)})})}function h(d,v){try{m(a[d](v))}catch(C){y(l[0][3],C)}}function m(d){d.value instanceof to?Promise.resolve(d.value.v).then(p,b):y(l[0][2],d)}function p(d){h("next",d)}function b(d){h("throw",d)}function y(d,v){d(v),l.shift(),l.length&&h(l[0][0],l[0][1])}},ma=function(r){var n,i;return n={},a("next"),a("throw",function(s){throw s}),a("return"),n[Symbol.iterator]=function(){return this},n;function a(s,l){n[s]=r[s]?function(c){return(i=!i)?{value:to(r[s](c)),done:s==="return"}:l?l(c):c}:l}},ha=function(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r[Symbol.asyncIterator],i;return n?n.call(r):(r=typeof tr=="function"?tr(r):r[Symbol.iterator](),i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i);function a(l){i[l]=r[l]&&function(c){return new Promise(function(h,m){c=r[l](c),s(h,m,c.done,c.value)})}}function s(l,c,h,m){Promise.resolve(m).then(function(p){l({value:p,done:h})},c)}},ga=function(r,n){return Object.defineProperty?Object.defineProperty(r,"raw",{value:n}):r.raw=n,r};var o=Object.create?function(r,n){Object.defineProperty(r,"default",{enumerable:!0,value:n})}:function(r,n){r.default=n};ba=function(r){if(r&&r.__esModule)return r;var n={};if(r!=null)for(var i in r)i!=="default"&&Object.prototype.hasOwnProperty.call(r,i)&&or(n,r,i);return o(n,r),n},ya=function(r){return r&&r.__esModule?r:{default:r}},va=function(r,n,i,a){if(i==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof n=="function"?r!==n||!a:!n.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i==="m"?a:i==="a"?a.call(r):a?a.value:n.get(r)},wa=function(r,n,i,a,s){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof n=="function"?r!==n||!s:!n.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?s.call(r,i):s?s.value=i:n.set(r,i),i},Ca=function(r,n){if(n===null||typeof n!="object"&&typeof n!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof r=="function"?n===r:r.has(n)},e("__extends",ta),e("__assign",oa),e("__rest",ra),e("__decorate",na),e("__param",ia),e("__metadata",aa),e("__awaiter",sa),e("__generator",la),e("__exportStar",ca),e("__createBinding",or),e("__values",tr),e("__read",un),e("__spread",da),e("__spreadArrays",pa),e("__spreadArray",ua),e("__await",to),e("__asyncGenerator",fa),e("__asyncDelegator",ma),e("__asyncValues",ha),e("__makeTemplateObject",ga),e("__importStar",ba),e("__importDefault",ya),e("__classPrivateFieldGet",va),e("__classPrivateFieldSet",wa),e("__classPrivateFieldIn",Ca)})});var fn=lt(G=>{"use strict";Object.defineProperty(G,"__esModule",{value:!0});G.getLocalStorage=G.getLocalStorageOrThrow=G.getCrypto=G.getCryptoOrThrow=G.getLocation=G.getLocationOrThrow=G.getNavigator=G.getNavigatorOrThrow=G.getDocument=G.getDocumentOrThrow=G.getFromWindowOrThrow=G.getFromWindow=void 0;function Bt(e){let t;return typeof window<"u"&&typeof window[e]<"u"&&(t=window[e]),t}G.getFromWindow=Bt;function oo(e){let t=Bt(e);if(!t)throw new Error(`${e} is not defined in Window`);return t}G.getFromWindowOrThrow=oo;function lc(){return oo("document")}G.getDocumentOrThrow=lc;function cc(){return Bt("document")}G.getDocument=cc;function dc(){return oo("navigator")}G.getNavigatorOrThrow=dc;function pc(){return Bt("navigator")}G.getNavigator=pc;function uc(){return oo("location")}G.getLocationOrThrow=uc;function fc(){return Bt("location")}G.getLocation=fc;function mc(){return oo("crypto")}G.getCryptoOrThrow=mc;function hc(){return Bt("crypto")}G.getCrypto=hc;function gc(){return oo("localStorage")}G.getLocalStorageOrThrow=gc;function bc(){return Bt("localStorage")}G.getLocalStorage=bc});var xa=lt(ir=>{"use strict";Object.defineProperty(ir,"__esModule",{value:!0});ir.getWindowMetadata=void 0;var Ea=fn();function yc(){let e,t;try{e=Ea.getDocumentOrThrow(),t=Ea.getLocationOrThrow()}catch{return null}function o(){let m=e.getElementsByTagName("link"),p=[];for(let b=0;b<m.length;b++){let y=m[b],d=y.getAttribute("rel");if(d&&d.toLowerCase().indexOf("icon")>-1){let v=y.getAttribute("href");if(v)if(v.toLowerCase().indexOf("https:")===-1&&v.toLowerCase().indexOf("http:")===-1&&v.indexOf("//")!==0){let C=t.protocol+"//"+t.host;if(v.indexOf("/")===0)C+=v;else{let T=t.pathname.split("/");T.pop(),C+=T.join("/")+"/"+v}p.push(C)}else if(v.indexOf("//")===0){let C=t.protocol+v;p.push(C)}else p.push(v)}}return p}function r(...m){let p=e.getElementsByTagName("meta");for(let b=0;b<p.length;b++){let y=p[b],d=["itemprop","property","name"].map(v=>y.getAttribute(v)).filter(v=>v?m.includes(v):!1);if(d.length&&d){let v=y.getAttribute("content");if(v)return v}}return""}function n(){let m=r("name","og:site_name","og:title","twitter:title");return m||(m=e.title),m}function i(){return r("description","og:description","twitter:description","keywords")}let a=n(),s=i(),l=t.origin,c=o();return{description:s,url:l,icons:c,name:a}}ir.getWindowMetadata=yc});var Ma={};en(Ma,{BotInfo:()=>ka,BrowserInfo:()=>La,NodeInfo:()=>Sa,ReactNativeInfo:()=>Ta,SearchBotDeviceInfo:()=>Aa,browserName:()=>_c,detect:()=>xc,detectOS:()=>Ra,getNodeVersion:()=>Ia,parseUserAgent:()=>mn});function xc(e){return e?mn(e):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Ta:typeof navigator<"u"?mn(navigator.userAgent):Ia()}function Wa(e){return e!==""&&Ec.reduce(function(t,o){var r=o[0],n=o[1];if(t)return t;var i=n.exec(e);return!!i&&[r,i]},!1)}function _c(e){var t=Wa(e);return t?t[0]:null}function mn(e){var t=Wa(e);if(!t)return null;var o=t[0],r=t[1];if(o==="searchbot")return new ka;var n=r[1]&&r[1].split(/[._]/).slice(0,3);n?n.length<_a&&(n=vc(n,Pc(_a-n.length))):n=[];var i=n.join("."),a=Ra(e),s=Cc.exec(e);return s&&s[1]?new Aa(o,i,a,s[1]):new La(o,i,a)}function Ra(e){for(var t=0,o=Pa.length;t<o;t++){var r=Pa[t],n=r[0],i=r[1],a=i.exec(e);if(a)return n}return null}function Ia(){var e=typeof process<"u"&&process.version;return e?new Sa(process.version.slice(1)):null}function Pc(e){for(var t=[],o=0;o<e;o++)t.push("0");return t}var vc,La,Sa,Aa,ka,Ta,wc,Cc,_a,Ec,Pa,Oa=di(()=>{vc=function(){for(var e=0,t=0,o=arguments.length;t<o;t++)e+=arguments[t].length;for(var r=Array(e),n=0,t=0;t<o;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,n++)r[n]=i[a];return r},La=function(){function e(t,o,r){this.name=t,this.version=o,this.os=r,this.type="browser"}return e}(),Sa=function(){function e(t){this.version=t,this.type="node",this.name="node",this.os=process.platform}return e}(),Aa=function(){function e(t,o,r,n){this.name=t,this.version=o,this.os=r,this.bot=n,this.type="bot-device"}return e}(),ka=function(){function e(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return e}(),Ta=function(){function e(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return e}(),wc=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Cc=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,_a=3,Ec=[["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|$)/],["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",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",wc]],Pa=[["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/],["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/]]});var gn=lt(S=>{"use strict";Object.defineProperty(S,"__esModule",{value:!0});S.getClientMeta=S.getLocalStorage=S.getLocalStorageOrThrow=S.getCrypto=S.getCryptoOrThrow=S.getLocation=S.getLocationOrThrow=S.getNavigator=S.getNavigatorOrThrow=S.getDocument=S.getDocumentOrThrow=S.getFromWindowOrThrow=S.getFromWindow=S.isBrowser=S.isNode=S.isMobile=S.isIOS=S.isAndroid=S.detectOS=S.detectEnv=void 0;var Na=nr(),Lc=Na.__importStar(xa()),He=Na.__importStar(fn()),Sc=(Oa(),tn(Ma));function hn(e){return(0,Sc.detect)(e)}S.detectEnv=hn;function ar(){let e=hn();return e&&e.os?e.os:void 0}S.detectOS=ar;function Da(){let e=ar();return e?e.toLowerCase().includes("android"):!1}S.isAndroid=Da;function Ua(){let e=ar();return e?e.toLowerCase().includes("ios")||e.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}S.isIOS=Ua;function Ac(){return ar()?Da()||Ua():!1}S.isMobile=Ac;function Ba(){let e=hn();return e&&e.name?e.name.toLowerCase()==="node":!1}S.isNode=Ba;function kc(){return!Ba()&&!!(0,S.getNavigator)()}S.isBrowser=kc;S.getFromWindow=He.getFromWindow;S.getFromWindowOrThrow=He.getFromWindowOrThrow;S.getDocumentOrThrow=He.getDocumentOrThrow;S.getDocument=He.getDocument;S.getNavigatorOrThrow=He.getNavigatorOrThrow;S.getNavigator=He.getNavigator;S.getLocationOrThrow=He.getLocationOrThrow;S.getLocation=He.getLocation;S.getCryptoOrThrow=He.getCryptoOrThrow;S.getCrypto=He.getCrypto;S.getLocalStorageOrThrow=He.getLocalStorageOrThrow;S.getLocalStorage=He.getLocalStorage;function Tc(){return Lc.getWindowMetadata()}S.getClientMeta=Tc});var Fa={};en(Fa,{safeJsonParse:()=>Wc,safeJsonStringify:()=>Rc});function Wc(e){if(typeof e!="string")throw new Error(`Cannot safe json parse value of type ${typeof e}`);try{return JSON.parse(e)}catch{return e}}function Rc(e){return typeof e=="string"?e:JSON.stringify(e)}var Ga=di(()=>{});var bn=lt(ro=>{"use strict";Object.defineProperty(ro,"__esModule",{value:!0});ro.safeJsonStringify=ro.safeJsonParse=void 0;var Ic=nr(),Ha=Ic.__importStar((Ga(),tn(Fa)));ro.safeJsonParse=Ha.safeJsonParse;ro.safeJsonStringify=Ha.safeJsonStringify});var vn=lt(wt=>{"use strict";Object.defineProperty(wt,"__esModule",{value:!0});wt.removeLocal=wt.getLocal=wt.setLocal=void 0;var Va=bn(),yn=gn();function Mc(e,t){let o=(0,Va.safeJsonStringify)(t),r=(0,yn.getLocalStorage)();r&&r.setItem(e,o)}wt.setLocal=Mc;function Oc(e){let t=null,o=null,r=(0,yn.getLocalStorage)();return r&&(o=r.getItem(e)),t=o&&(0,Va.safeJsonParse)(o),t}wt.getLocal=Oc;function Nc(e){let t=(0,yn.getLocalStorage)();t&&t.removeItem(e)}wt.removeLocal=Nc});var $a=lt(Ee=>{"use strict";Object.defineProperty(Ee,"__esModule",{value:!0});Ee.getMobileLinkRegistry=Ee.getMobileRegistryEntry=Ee.saveMobileLinkInfo=Ee.formatIOSMobile=Ee.mobileLinkChoiceKey=void 0;var Dc=vn();Ee.mobileLinkChoiceKey="WALLETCONNECT_DEEPLINK_CHOICE";function Uc(e,t){let o=encodeURIComponent(e);return t.universalLink?`${t.universalLink}/wc?uri=${o}`:t.deepLink?`${t.deepLink}${t.deepLink.endsWith(":")?"//":"/"}wc?uri=${o}`:""}Ee.formatIOSMobile=Uc;function Bc(e){let t=e.href.split("?")[0];(0,Dc.setLocal)(Ee.mobileLinkChoiceKey,Object.assign(Object.assign({},e),{href:t}))}Ee.saveMobileLinkInfo=Bc;function ja(e,t){return e.filter(o=>o.name.toLowerCase().includes(t.toLowerCase()))[0]}Ee.getMobileRegistryEntry=ja;function Fc(e,t){let o=e;return t&&(o=t.map(r=>ja(e,r)).filter(Boolean)),o}Ee.getMobileLinkRegistry=Fc});var Za=lt(et=>{"use strict";Object.defineProperty(et,"__esModule",{value:!0});et.formatMobileRegistry=et.formatMobileRegistryEntry=et.getDappRegistryUrl=et.getWalletRegistryUrl=void 0;var za="https://registry.walletconnect.com";function Gc(){return za+"/api/v2/wallets"}et.getWalletRegistryUrl=Gc;function Hc(){return za+"/api/v2/dapps"}et.getDappRegistryUrl=Hc;function qa(e,t="mobile"){var o;return{name:e.name||"",shortName:e.metadata.shortName||"",color:e.metadata.colors.primary||"",logo:(o=e.image_url.sm)!==null&&o!==void 0?o:"",universalLink:e[t].universal||"",deepLink:e[t].native||""}}et.formatMobileRegistryEntry=qa;function Vc(e,t="mobile"){return Object.values(e).filter(o=>!!o[t].universal||!!o[t].native).map(o=>qa(o,t))}et.formatMobileRegistry=Vc});var Ka=lt(Ft=>{"use strict";Object.defineProperty(Ft,"__esModule",{value:!0});var Lo=nr();Lo.__exportStar(gn(),Ft);Lo.__exportStar(bn(),Ft);Lo.__exportStar(vn(),Ft);Lo.__exportStar($a(),Ft);Lo.__exportStar(Za(),Ft)});var pp={};en(pp,{AsExternalProvider:()=>vt,ConnectorManager:()=>no,PrivyClient:()=>ao,PrivyProvider:()=>jl,PrivyProxyProvider:()=>Ue,VERSION:()=>Vo,WalletConnector:()=>Be,getAccessToken:()=>Vl,usePrivy:()=>N});module.exports=tn(pp);var Hl=require("@ethersproject/providers"),te=require("react");var _=()=>{throw new Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")};var ui=L(require("axios")),qe=class extends Error{constructor(o,r){super(o);r instanceof Error&&(this.cause=r)}toString(){return`${this.type}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Kt=class extends qe{constructor(o,r,n,i){super(n,i);this.type=o;this.status=r}},x=class extends qe{constructor(o,r){super(o,r);this.type="client_error"}};var q=class extends qe{constructor(o,r){super(o,r);this.type="connector_error"}},re=e=>{if(e instanceof qe)return e;if(!ui.default.isAxiosError(e))return Me(e);if(!e.response)return new Kt("api_error",null,e.message,e);let{type:t,message:o,error:r}=e.response.data;return new Kt(t||"ApiError",e.response.status,o||r,e)},Me=e=>e instanceof qe?e:e instanceof Error?new x(e.message,e):new x(`Internal error: ${e}`);var fi=()=>"/api/v1/sessions",mi=()=>"/api/v1/sessions/logout",hi=()=>"/api/v1/sessions/fork",gi=()=>"/api/v1/sessions/fork/recover",bi=()=>"/api/v1/siwe/init",yi=()=>"/api/v1/siwe/authenticate",vi=()=>"/api/v1/siwe/link",wi=()=>"/api/v1/passwordless/init",Ci=()=>"/api/v1/passwordless/authenticate",Ei=()=>"/api/v1/passwordless/link",xi=()=>"/api/v1/passwordless_sms/init",_i=()=>"/api/v1/passwordless_sms/authenticate",Pi=()=>"/api/v1/passwordless_sms/link",Li=()=>"/api/v1/oauth/init",Si=()=>"/api/v1/oauth/authenticate",Ai=()=>"/api/v1/oauth/link",ki=()=>"/api/v1/siwe/unlink",Ti=()=>"/api/v1/passwordless/unlink",Wi=()=>"/api/v1/passwordless_sms/unlink",Ri=()=>"/api/v1/oauth/unlink",Ii=()=>"/api/v1/analytics_events";var It=class{constructor(t){this.meta={email:t}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{let t=Ci(),o=await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw re(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{let t=Ei();return(await this.api.post(t,{email:this.meta.email,code:this.meta.emailCode})).data}catch(t){throw re(t)}}async sendCodeEmail(t){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.email=t),!this.meta.email)throw new x("Email must be set when initialzing authentication.");try{let o=wi();return(await this.api.post(o,{email:this.meta.email})).data}catch(o){throw re(o)}}};var bt=class{constructor(t,o,r){this.meta={provider:t},this.meta.authorizationCode=o,this.meta.stateCode=r}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");try{let t=Si(),o=await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw re(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");try{let t=Ai();return(await this.api.post(t,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode})).data}catch(t){throw re(t)}}async getAuthorizationUrl(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.provider)throw new x("Provider must be set when initialzing OAuth authentication.");try{let t=Li();return(await this.api.post(t,{provider:this.meta.provider,redirect_to:window.location.href})).data}catch(t){throw re(t)}}};var yt=class{constructor(t,o,r){this._meta={walletType:o,walletId:r},this.connectors=t,this.walletConnector=this.connectors.createWalletConnector(o,null,r)}get meta(){return{...this._meta,walletName:this.walletConnector.walletBranding.name,walletIcon:this.walletConnector.walletBranding.icon}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(yi(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),{user:r.data.user,token:r.data.token,refresh_token:r.data.refresh_token,is_new_user:r.data.is_new_user}}catch(t){throw re(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");try{let{message:t,signature:o}=await this.sign(),r=await this.api.post(vi(),{message:t,signature:o});return this.connectors.addWalletConnector(this.walletConnector),await this.connectors.setActiveWallet(this.walletConnector.address)||console.warn("Failed to set active wallet"),r.data}catch(t){throw re(t)}}async promptConnect(){if(!this.api)throw new x("Auth flow has no API instance");let t=await this.walletConnector.connect({showPrompt:!0});return await this.buildSiweMessage(t),t}async sign(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.preparedMessage){let o=await this.walletConnector.connect({showPrompt:!1});await this.buildSiweMessage(o)}if(!this.preparedMessage)throw new x("Could not prepare SIWE message");let t=await this.walletConnector.sign(this.preparedMessage);return{message:this.preparedMessage,signature:t}}async buildSiweMessage(t){if(!this.api)throw new x("Auth flow has no API instance");let o=t.address,r=t.chainId,n=await this.api.post(bi(),{address:o});return this.preparedMessage=this.walletConnector.prepareMessage(r,o,n.data.nonce),this.preparedMessage}};var Mt=class{constructor(t){this.meta={phoneNumber:t}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{let t=_i(),o=await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode});return{user:o.data.user,token:o.data.token,refresh_token:o.data.refresh_token,is_new_user:o.data.is_new_user}}catch(t){throw re(t)}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.phoneNumber||!this.meta.smsCode)throw new x("phone number and sms code must be set prior to calling authenticate.");try{let t=Pi();return(await this.api.post(t,{phoneNumber:this.meta.phoneNumber,code:this.meta.smsCode})).data}catch(t){throw re(t)}}async sendSmsCode(t){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.phoneNumber=t),!this.meta.phoneNumber)throw new x("phone nNumber must be set when initialzing authentication.");try{let o=xi();return(await this.api.post(o,{phoneNumber:this.meta.phoneNumber})).data}catch(o){throw re(o)}}};var os=require("@ethersproject/address");var Mi="1.21.0";var Oi="https://api.privy.io/v0",Go=process.env.NEXT_PUBLIC_PRIVY_AUTH_URL||"https://auth.privy.io",Ho="4df5e2316331463a9130964bd6078dfa",Ni=1e4,Oe=1400,Vo=Mi;var Jt="privy:token",jo="privy:refresh_token",_o="privy:session_transfer_token",$o="privy:connectors",on="walletconnect",Di=3e4;var rn=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,o){o!==void 0?this._cache[t]=o:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},nn=class{get(t){let o=localStorage.getItem(t);return o===null?void 0:JSON.parse(o)}put(t,o){o!==void 0?localStorage.setItem(t,JSON.stringify(o)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function tc(){return typeof window<"u"&&window.localStorage?new nn:new rn}var Z=tc();var Gi=L(require("@coinbase/wallet-sdk")),Hi=require("@ethersproject/address");var Po=require("react/jsx-runtime"),Ne=({style:e,...t})=>(0,Po.jsxs)("svg",{width:"1024",height:"1024",viewBox:"0 0 1024 1024",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[(0,Po.jsx)("rect",{width:"1024",height:"1024",fill:"#0052FF",rx:100,ry:100}),(0,Po.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z",fill:"white"})]});var Bi=require("@ethersproject/address"),Fi=require("@ethersproject/providers");var Ui=require("@ethersproject/logger");var Yt=class extends q{constructor(){super("Wallet timeout");this.type="wallet_error"}},Nt=class extends q{constructor(){super("User rejected connection");this.type="wallet_error"}},De=e=>{if(e instanceof q)return e;if((e==null?void 0:e.code)&&(e==null?void 0:e.reason)){let t=new Xt(e);return e.code===Ui.ErrorCode.ACTION_REJECTED&&(t.details=Ot.E4001_USER_REJECTED_REQUEST),t}return e!=null&&e.code?new Xt(e):new q("Unknown connector error",e)},an=class extends qe{constructor(o,r,n){super(o);this.type="provider_error";this.code=r,this.data=n}},Xt=class extends an{constructor(o){var i,a,s;let r=o;super(r.message,r.code,r.data);let n=Object.values(Ot).find(l=>l.eipCode===r.code);this.details=n||Ot.UNKNOWN_ERROR,r.code===-32002&&((i=r.message)!=null&&i.includes("already pending for origin")?(a=r.message)!=null&&a.includes("wallet_requestPermissions")?this.details=Ot.E32002_CONNECTION_ALREADY_PENDING:this.details=Ot.E32002_REQUEST_ALREADY_PENDING:(s=r.message)!=null&&s.includes("Already processing")&&r.message.includes("eth_requestAccounts")&&(this.details=Ot.E32002_WALLET_LOCKED))}},oc={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_REJECTED_CONNECTION:{message:"You rejected the request",detail:"Please try connecting again.",retryable:!0}},rc={E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Don\u2019t see your wallet modal? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}},nc={E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1}},Ot={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},...nc,...rc},Dt={...oc,...Ot};var ic=12e4,sn=(e=new Yt,t=ic)=>new Promise((o,r)=>setTimeout(()=>{r(e)},t)),Ue=class{constructor(t){this.removeListener=(t,o)=>{if(this.walletProvider)return this.walletProvider.removeListener(t,o)};this.setWalletProvider=t=>{this.walletProvider=t,this._subscriptions.forEach(o=>{var r;(r=this.walletProvider)==null||r.on(o.eventName,o.listener)})};this.walletProvider=t,this._subscriptions=[]}on(t,o){if(this.walletProvider)return this.walletProvider.on(t,o);this._subscriptions.push({eventName:t,listener:o})}async request(t){if(!this.walletProvider)throw new q(`A wallet request of type ${t.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(t),sn()]).catch(o=>{throw De(o)})}},vt=class extends Ue{constructor(o){super(o)}},zo=class extends Ue{constructor(t){super(t)}sendAsync(t,o){throw new Error("sendAsync is no longer supported by EIP-1193. Use the request method instead.")}};var Be=class{constructor(t,o,r){this.createSiweMessage=(t,o,r,n,i,a,s)=>`${r} wants you to sign in with your Ethereum account:
2
2
  ${o}
3
3
 
4
4
  ${s}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@privy-io/react-auth",
3
- "version": "1.21.0-beta.9",
3
+ "version": "1.21.0",
4
4
  "description": "React client for the Privy Auth API",
5
5
  "keywords": [
6
6
  "authentication",