-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path2687.8e67e297562789de83cc.js
1 lines (1 loc) · 12.6 KB
/
2687.8e67e297562789de83cc.js
1
"use strict";(self.webpackChunktimeless_frontend=self.webpackChunktimeless_frontend||[]).push([[2687],{97513:(Oe,F,C)=>{C.d(F,{t0:()=>x,zv:()=>v,uA:()=>fe,uc:()=>$e,jb:()=>Ve,zb:()=>j,AV:()=>se,Ic:()=>He,Vs:()=>Fe});var A=C(34553);Symbol();const Z=Symbol(),Y=Object.getPrototypeOf,q=new WeakMap,ue=(e,t=!0)=>{q.set(e,t)},ne=e=>"object"==typeof e&&null!==e,k=new WeakMap,z=new WeakSet,[je]=((e=Object.is,t=((s,I)=>new Proxy(s,I)),n=(s=>ne(s)&&!z.has(s)&&(Array.isArray(s)||!(Symbol.iterator in s))&&!(s instanceof WeakMap)&&!(s instanceof WeakSet)&&!(s instanceof Error)&&!(s instanceof Number)&&!(s instanceof Date)&&!(s instanceof String)&&!(s instanceof RegExp)&&!(s instanceof ArrayBuffer)),r=(s=>s.configurable&&s.enumerable&&s.writable),d=(s=>{switch(s.status){case"fulfilled":return s.value;case"rejected":throw s.reason;default:throw s}}),o=new WeakMap,a=((s,I,g=d)=>{const m=o.get(s);if((null==m?void 0:m[0])===I)return m[1];const h=Array.isArray(s)?[]:Object.create(Object.getPrototypeOf(s));return ue(h,!0),o.set(s,[I,h]),Reflect.ownKeys(s).forEach(b=>{if(Object.getOwnPropertyDescriptor(h,b))return;const E=Reflect.get(s,b),W={value:E,enumerable:!0,configurable:!0};if(z.has(E))ue(E,!1);else if(E instanceof Promise)delete W.value,W.get=()=>g(E);else if(k.has(E)){const[L,le]=k.get(E);W.value=a(L,le(),g)}Object.defineProperty(h,b,W)}),Object.preventExtensions(h)}),l=new WeakMap,p=[1,1],w=(s=>{if(!ne(s))throw new Error("object required");const I=l.get(s);if(I)return I;let g=p[0];const m=new Set,h=(u,c=++p[0])=>{g!==c&&(g=c,m.forEach(f=>f(u,c)))};let b=p[1];const W=u=>(c,f)=>{const i=[...c];i[1]=[u,...i[1]],h(i,f)},L=new Map,ve=u=>{var c;const f=L.get(u);f&&(L.delete(u),null==(c=f[1])||c.call(f))},ce=Array.isArray(s)?[]:Object.create(Object.getPrototypeOf(s)),Ie=(u,c,f,i,_)=>{if(u&&(e(c,i)||l.has(i)&&e(c,l.get(i))))return;ve(f),ne(i)&&(i=(e=>(e=>e&&(q.has(e)?q.get(e):Y(e)===Object.prototype||Y(e)===Array.prototype))(e)&&e[Z]||null)(i)||i);let N=i;if(i instanceof Promise)i.then(S=>{i.status="fulfilled",i.value=S,h(["resolve",[f],S])}).catch(S=>{i.status="rejected",i.reason=S,h(["reject",[f],S])});else{!k.has(i)&&n(i)&&(N=w(i));const S=!z.has(N)&&k.get(N);S&&((u,c)=>{if(L.has(u))throw new Error("prop listener already exists");if(m.size){const f=c[3](W(u));L.set(u,[c,f])}else L.set(u,[c])})(f,S)}_(N),h(["set",[f],i,c])},X=t(ce,{deleteProperty(u,c){const f=Reflect.get(u,c);ve(c);const i=Reflect.deleteProperty(u,c);return i&&h(["delete",[c],f]),i},set(u,c,f,i){const _=Reflect.has(u,c),N=Reflect.get(u,c,i);return Ie(_,N,c,f,S=>{Reflect.set(u,c,S,i)}),!0},defineProperty(u,c,f){if(r(f)){const i=Reflect.getOwnPropertyDescriptor(u,c);if(!i||r(i))return Ie(!!i&&"value"in i,null==i?void 0:i.value,c,f.value,_=>{Reflect.defineProperty(u,c,{...f,value:_})}),!0}return Reflect.defineProperty(u,c,f)}});return l.set(s,X),k.set(X,[ce,(u=++p[1])=>(b!==u&&!m.size&&(b=u,L.forEach(([c])=>{const f=c[1](u);f>g&&(g=f)})),g),a,u=>(m.add(u),1===m.size&&L.forEach(([f,i],_)=>{if(i)throw new Error("remove already exists");const N=f[3](W(_));L.set(_,[f,N])}),()=>{m.delete(u),0===m.size&&L.forEach(([f,i],_)=>{i&&(i(),L.set(_,[f]))})})]),Reflect.ownKeys(s).forEach(u=>{const c=Object.getOwnPropertyDescriptor(s,u);"value"in c&&(X[u]=s[u],delete c.value,delete c.writable),Object.defineProperty(ce,u,c)}),X}))=>[w,k,z,e,t,n,r,d,o,a,l,p])();function R(e={}){return je(e)}function T(e,t,n){const r=k.get(e);let d;!r&&console.warn("Please use proxy object");const o=[];let l=!1;const w=(0,r[3])(s=>{o.push(s),n?t(o.splice(0)):d||(d=Promise.resolve().then(()=>{d=void 0,l&&t(o.splice(0))}))});return l=!0,()=>{l=!1,w()}}const y=R({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),se={state:y,subscribe:e=>T(y,()=>e(y)),push(e,t){e!==y.view&&(y.view=e,t&&(y.data=t),y.history.push(e))},reset(e){y.view=e,y.history=[e]},replace(e){y.history.length>1&&(y.history[y.history.length-1]=e,y.view=e)},goBack(){if(y.history.length>1){y.history.pop();const[e]=y.history.slice(-1);y.view=e}},setData(e){y.data=e}},v={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile:()=>typeof window<"u"&&Boolean(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)),isAndroid:()=>v.isMobile()&&navigator.userAgent.toLowerCase().includes("android"),isIos(){const e=navigator.userAgent.toLowerCase();return v.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl:e=>e.startsWith("http://")||e.startsWith("https://"),isArray:e=>Array.isArray(e)&&e.length>0,formatNativeUrl(e,t,n){if(v.isHttpUrl(e))return this.formatUniversalUrl(e,t,n);let r=e;return r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,n),`${r}wc?uri=${encodeURIComponent(t)}`},formatUniversalUrl(e,t,n){if(!v.isHttpUrl(e))return this.formatNativeUrl(e,t,n);let r=e;return r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,n),`${r}wc?uri=${encodeURIComponent(t)}`},wait:e=>(0,A.Z)(function*(){return new Promise(t=>{setTimeout(t,e)})})(),openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(v.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(v.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(v.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(v.WCM_VERSION,"2.6.1")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=null==(e=se.state.data)?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},O=R({enabled:typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),userSessionId:"",events:[],connectedWalletId:void 0}),fe={state:O,subscribe:e=>T(O.events,()=>e(function(e,t){const n=k.get(e);!n&&console.warn("Please use proxy object");const[r,d,o]=n;return o(r,d(),void 0)}(O.events[O.events.length-1]))),initialize(){O.enabled&&typeof(null==crypto?void 0:crypto.randomUUID)<"u"&&(O.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){O.connectedWalletId=e},click(e){if(O.enabled){const t={type:"CLICK",name:e.name,userSessionId:O.userSessionId,timestamp:Date.now(),data:e};O.events.push(t)}},track(e){if(O.enabled){const t={type:"TRACK",name:e.name,userSessionId:O.userSessionId,timestamp:Date.now(),data:e};O.events.push(t)}},view(e){if(O.enabled){const t={type:"VIEW",name:e.name,userSessionId:O.userSessionId,timestamp:Date.now(),data:e};O.events.push(t)}}},M=R({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),j={state:M,subscribe:e=>T(M,()=>e(M)),setChains(e){M.chains=e},setWalletConnectUri(e){M.walletConnectUri=e},setIsCustomDesktop(e){M.isCustomDesktop=e},setIsCustomMobile(e){M.isCustomMobile=e},setIsDataLoaded(e){M.isDataLoaded=e},setIsUiLoaded(e){M.isUiLoaded=e},setIsAuth(e){M.isAuth=e}},J=R({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),x={state:J,subscribe:e=>T(J,()=>e(J)),setConfig(e){var t,n;fe.initialize(),j.setChains(e.chains),j.setIsAuth(Boolean(e.enableAuthMode)),j.setIsCustomMobile(Boolean(null==(t=e.mobileWallets)?void 0:t.length)),j.setIsCustomDesktop(Boolean(null==(n=e.desktopWallets)?void 0:n.length)),v.setModalVersionInStorage(),Object.assign(J,e)}};var Me=Object.defineProperty,pe=Object.getOwnPropertySymbols,Ue=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,ge=(e,t,n)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Se=(e,t)=>{for(var n in t||(t={}))Ue.call(t,n)&&ge(e,n,t[n]);if(pe)for(var n of pe(t))_e.call(t,n)&&ge(e,n,t[n]);return e};const re="https://explorer-api.walletconnect.com",ie="js-2.6.1";function Q(e,t){return ae.apply(this,arguments)}function ae(){return(ae=(0,A.Z)(function*(e,t){const n=Se({sdkType:"wcm",sdkVersion:ie},t),r=new URL(e,re);return r.searchParams.append("projectId",x.state.projectId),Object.entries(n).forEach(([d,o])=>{o&&r.searchParams.append(d,String(o))}),(yield fetch(r)).json()})).apply(this,arguments)}const $_getDesktopListings=e=>(0,A.Z)(function*(){return Q("/w3m/v1/getDesktopListings",e)})(),$_getMobileListings=e=>(0,A.Z)(function*(){return Q("/w3m/v1/getMobileListings",e)})(),$_getAllListings=e=>(0,A.Z)(function*(){return Q("/w3m/v1/getAllListings",e)})(),$_getWalletImageUrl=e=>`${re}/w3m/v1/getWalletImage/${e}?projectId=${x.state.projectId}&sdkType=wcm&sdkVersion=${ie}`,$_getAssetImageUrl=e=>`${re}/w3m/v1/getAssetImage/${e}?projectId=${x.state.projectId}&sdkType=wcm&sdkVersion=${ie}`;var ke=Object.defineProperty,he=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Ne=Object.prototype.propertyIsEnumerable,me=(e,t,n)=>t in e?ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const be=v.isMobile(),U=R({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),$e={state:U,getRecomendedWallets:()=>(0,A.Z)(function*(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=x.state;if("NONE"===e||"ALL"===t&&!e)return U.recomendedWallets;if(v.isArray(e)){const n={recommendedIds:e.join(",")},{listings:r}=yield $_getAllListings(n),d=Object.values(r);d.sort((o,a)=>e.indexOf(o.id)-e.indexOf(a.id)),U.recomendedWallets=d}else{const{chains:n,isAuth:r}=j.state,d=n?.join(","),o=v.isArray(t),a={page:1,sdks:r?"auth_v1":void 0,entries:v.RECOMMENDED_WALLET_AMOUNT,chains:d,version:2,excludedIds:o?t.join(","):void 0},{listings:l}=be?yield $_getMobileListings(a):yield $_getDesktopListings(a);U.recomendedWallets=Object.values(l)}return U.recomendedWallets})(),getWallets:e=>(0,A.Z)(function*(){const t=((e,t)=>{for(var n in t||(t={}))Re.call(t,n)&&me(e,n,t[n]);if(he)for(var n of he(t))Ne.call(t,n)&&me(e,n,t[n]);return e})({},e),{explorerRecommendedWalletIds:n,explorerExcludedWalletIds:r}=x.state,{recomendedWallets:d}=U;if("ALL"===r)return U.wallets;d.length?t.excludedIds=d.map(I=>I.id).join(","):v.isArray(n)&&(t.excludedIds=n.join(",")),v.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),j.state.isAuth&&(t.sdks="auth_v1");const{page:o,search:a}=e,{listings:l,total:p}=be?yield $_getMobileListings(t):yield $_getDesktopListings(t),w=Object.values(l),s=a?"search":"wallets";return U[s]={listings:[...U[s].listings,...w],total:p,page:o??1},{listings:w,total:p}})(),getWalletImageUrl:e=>$_getWalletImageUrl(e),getAssetImageUrl:e=>$_getAssetImageUrl(e),resetSearch(){U.search={listings:[],total:0,page:1}}},B=R({open:!1}),Ve={state:B,subscribe:e=>T(B,()=>e(B)),open:e=>(0,A.Z)(function*(){return new Promise(t=>{const{isUiLoaded:n,isDataLoaded:r}=j.state;if(v.removeWalletConnectDeepLink(),j.setWalletConnectUri(e?.uri),j.setChains(e?.chains),se.reset("ConnectWallet"),n&&r)B.open=!0,t();else{const d=setInterval(()=>{const o=j.state;o.isUiLoaded&&o.isDataLoaded&&(clearInterval(d),B.open=!0,t())},200)}})})(),close(){B.open=!1}};var Ke=Object.defineProperty,ye=Object.getOwnPropertySymbols,xe=Object.prototype.hasOwnProperty,Be=Object.prototype.propertyIsEnumerable,we=(e,t,n)=>t in e?Ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;const H=R({themeMode:typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}),He={state:H,subscribe:e=>T(H,()=>e(H)),setThemeConfig(e){const{themeMode:t,themeVariables:n}=e;t&&(H.themeMode=t),n&&(H.themeVariables=((e,t)=>{for(var n in t||(t={}))xe.call(t,n)&&we(e,n,t[n]);if(ye)for(var n of ye(t))Be.call(t,n)&&we(e,n,t[n]);return e})({},n))}},V=R({open:!1,message:"",variant:"success"}),Fe={state:V,subscribe:e=>T(V,()=>e(V)),openToast(e,t){V.open=!0,V.message=e,V.variant=t},closeToast(){V.open=!1}}},52687:(Oe,F,C)=>{C.r(F),C.d(F,{WalletConnectModal:()=>Z});var A=C(34553),P=C(97513);class Z{constructor(D){this.openModal=P.jb.open,this.closeModal=P.jb.close,this.subscribeModal=P.jb.subscribe,this.setTheme=P.Ic.setThemeConfig,P.Ic.setThemeConfig(D),P.t0.setConfig(D),this.initUi()}initUi(){return(0,A.Z)(function*(){if(typeof window<"u"){yield Promise.all([C.e(8592),C.e(5756)]).then(C.bind(C,55756));const D=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",D),P.zb.setIsUiLoaded(!0)}})()}}}}]);