"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const N=require("react"),be=require("@solana/wallet-adapter-base"),tt=require("@solana/wallet-adapter-react"),we=require("@solana/wallet-adapter-wallets"),Oe=require("@wagmi/connectors"),M=require("@wagmi/core"),m=require("./index-CfQ9MLb-.js"),_=require("@tanstack/react-query"),Y=require("lucide-react"),Dt=require("@radix-ui/react-dialog"),U=require("vaul"),qt=require("@radix-ui/react-scroll-area"),T=require("ethers"),nt=require("viem"),ce=require("sonner"),K=require("./index.browser.esm-Cupop-lw.js"),ot=require("./constants-DF5r7Vso.js"),Ae=require("next-auth/react"),Ee=require("./index-TT6-myDs.js"),B=require("framer-motion"),Ft=require("qrcode.react"),$t=require("@radix-ui/react-slot"),Ie=require("./chains.cjs");function qe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const D=qe(N),G=qe(Dt),ae=qe(qt);var Te={exports:{}},Ce={};/**
 * @license React
 * react-jsx-runtime.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Le;function Bt(){if(Le)return Ce;Le=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(o,r,i){var a=null;if(i!==void 0&&(a=""+i),r.key!==void 0&&(a=""+r.key),"key"in r){i={};for(var c in r)c!=="key"&&(i[c]=r[c])}else i=r;return r=i.ref,{$$typeof:e,type:o,key:a,ref:r!==void 0?r:null,props:i}}return Ce.Fragment=t,Ce.jsx=n,Ce.jsxs=n,Ce}var je={};/**
 * @license React
 * react-jsx-runtime.development.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var Ge;function Kt(){return Ge||(Ge=1,process.env.NODE_ENV!=="production"&&function(){function e(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===xe?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case v:return"Fragment";case E:return"Profiler";case g:return"StrictMode";case F:return"Suspense";case L:return"SuspenseList";case he:return"Activity"}if(typeof u=="object")switch(typeof u.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),u.$$typeof){case x:return"Portal";case q:return(u.displayName||"Context")+".Provider";case I:return(u._context.displayName||"Context")+".Consumer";case W:var k=u.render;return u=u.displayName,u||(u=k.displayName||k.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case $:return k=u.displayName||null,k!==null?k:e(u.type)||"Memo";case Q:k=u._payload,u=u._init;try{return e(u(k))}catch{}}return null}function t(u){return""+u}function n(u){try{t(u);var k=!1}catch{k=!0}if(k){k=console;var R=k.error,z=typeof Symbol=="function"&&Symbol.toStringTag&&u[Symbol.toStringTag]||u.constructor.name||"Object";return R.call(k,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",z),t(u)}}function o(u){if(u===v)return"<>";if(typeof u=="object"&&u!==null&&u.$$typeof===Q)return"<...>";try{var k=e(u);return k?"<"+k+">":"<...>"}catch{return"<...>"}}function r(){var u=ie.A;return u===null?null:u.getOwner()}function i(){return Error("react-stack-top-frame")}function a(u){if(S.call(u,"key")){var k=Object.getOwnPropertyDescriptor(u,"key").get;if(k&&k.isReactWarning)return!1}return u.key!==void 0}function c(u,k){function R(){ye||(ye=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",k))}R.isReactWarning=!0,Object.defineProperty(u,"key",{get:R,configurable:!0})}function l(){var u=e(this.type);return se[u]||(se[u]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),u=this.props.ref,u!==void 0?u:null}function d(u,k,R,z,ee,V,We,Me){return R=V.ref,u={$$typeof:y,type:u,key:k,props:V,_owner:ee},(R!==void 0?R:null)!==null?Object.defineProperty(u,"ref",{enumerable:!1,get:l}):Object.defineProperty(u,"ref",{enumerable:!1,value:null}),u._store={},Object.defineProperty(u._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(u,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(u,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:We}),Object.defineProperty(u,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:Me}),Object.freeze&&(Object.freeze(u.props),Object.freeze(u)),u}function b(u,k,R,z,ee,V,We,Me){var O=k.children;if(O!==void 0)if(z)if(Pe(O)){for(z=0;z<O.length;z++)w(O[z]);Object.freeze&&Object.freeze(O)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else w(O);if(S.call(k,"key")){O=e(u);var ue=Object.keys(k).filter(function(_t){return _t!=="key"});z=0<ue.length?"{key: someKey, "+ue.join(": ..., ")+": ...}":"{key: someKey}",Z[O+z]||(ue=0<ue.length?"{"+ue.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
  let props = %s;
  <%s {...props} />
React keys must be passed directly to JSX without using spread:
  let props = %s;
  <%s key={someKey} {...props} />`,z,O,ue,O),Z[O+z]=!0)}if(O=null,R!==void 0&&(n(R),O=""+R),a(k)&&(n(k.key),O=""+k.key),"key"in k){R={};for(var ze in k)ze!=="key"&&(R[ze]=k[ze])}else R=k;return O&&c(R,typeof u=="function"?u.displayName||u.name||"Unknown":u),d(u,O,V,ee,r(),R,We,Me)}function w(u){typeof u=="object"&&u!==null&&u.$$typeof===y&&u._store&&(u._store.validated=1)}var f=N,y=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),g=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),q=Symbol.for("react.context"),W=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),$=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),he=Symbol.for("react.activity"),xe=Symbol.for("react.client.reference"),ie=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,S=Object.prototype.hasOwnProperty,Pe=Array.isArray,X=console.createTask?console.createTask:function(){return null};f={"react-stack-bottom-frame":function(u){return u()}};var ye,se={},ve=f["react-stack-bottom-frame"].bind(f,i)(),de=X(o(i)),Z={};je.Fragment=v,je.jsx=function(u,k,R,z,ee){var V=1e4>ie.recentlyCreatedOwnerStacks++;return b(u,k,R,!1,z,ee,V?Error("react-stack-top-frame"):ve,V?X(o(u)):de)},je.jsxs=function(u,k,R,z,ee){var V=1e4>ie.recentlyCreatedOwnerStacks++;return b(u,k,R,!0,z,ee,V?Error("react-stack-top-frame"):ve,V?X(o(u)):de)}}()),je}var Ue;function Lt(){return Ue||(Ue=1,process.env.NODE_ENV==="production"?Te.exports=Bt():Te.exports=Kt()),Te.exports}var s=Lt();const rt=new _.QueryClient,Ve={home:"Login",account:"Account",walletConnecting:"Wallet Connecting",selectETHWallet:"Select ETH Wallet",selectSolanaWallet:"Select Solana Wallet",walletqr:"Wallet QR",switchAccount:"Switch Account",switchingAccount:"Switching Account",switchChain:"Switch Chain",switchingChain:"Switching Chain",withdrawFunds:"Withdraw Funds",withdrawingFunds:"Withdrawing Funds",accountSigning:"Account Signing"},p={home:"home",account:"account",accountSigning:"accountSigning",socialConnecting:"socialConnecting",walletConnecting:"walletConnecting",selectETHWallet:"selectETHWallet",selectSolanaWallet:"selectSolanaWallet",walletqr:"walletqr",switchAccount:"switchAccount",switchingAccount:"switchingAccount",switchChain:"switchChain",switchingChain:"switchingChain",withdrawFunds:"withdrawFunds"},Fe=N.createContext({chains:[],wagmiConfig:null,pendingItem:null,setPendingItem:()=>{},open:!1,setOpen:()=>{},router:p.home,setRouter:()=>{}}),C=()=>N.useContext(Fe),Gt=()=>{const{open:e,setOpen:t,...n}=N.useContext(Fe);return{isOpen:e,openModal:()=>{t(!0)},closeModal:()=>{t(!1)},...n}},Ut=({children:e,chains:t,host:n,name:o,description:r,icon:i,projectId:a})=>{const[c,l]=N.useState(!1),[d,b]=N.useState(null),[w,f]=N.useState(null),y=N.useRef(Oe.walletConnect({projectId:a,metadata:{name:o,description:r,url:n,icons:[i]},showQrModal:!1,qrModalOptions:{themeMode:"dark"}})),x=N.useMemo(()=>{const g=t.filter(I=>I.network.symbol===m.NetworkSymbols.eth),E=!(typeof window>"u")&&(window==null?void 0:window.parent)!==window;return M.createConfig({chains:g,connectors:[M.injected({target:"metaMask"}),y.current,Oe.coinbaseWallet({appName:o,appLogoUrl:i,overrideIsMetaMask:!1,preference:"all"}),...E?[Oe.safe({allowedDomains:[/gnosis-safe.io$/,/app.safe.global$/]})]:[]],storage:M.createStorage({storage:M.cookieStorage}),transports:Object.fromEntries(g.map(I=>[I.id,M.http()]))})},[t]),v=N.useMemo(()=>[new we.CoinbaseWalletAdapter,new we.PhantomWalletAdapter,new we.SafePalWalletAdapter,new we.SolflareWalletAdapter,new we.TrustWalletAdapter,new we.WalletConnectWalletAdapter({network:be.WalletAdapterNetwork.Mainnet,options:{relayUrl:"wss://relay.walletconnect.com",projectId:a,metadata:{name:o,description:r,url:n,icons:[i]}}})],[]);return s.jsx(Fe.Provider,{value:{chains:t,wagmiConfig:x,open:c,setOpen:l,router:d,setRouter:b,pendingItem:w,setPendingItem:f},children:s.jsx(tt.WalletProvider,{wallets:v,autoConnect:!0,children:s.jsx(_.QueryClientProvider,{client:rt,children:e})})})};function it(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=it(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function st(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=it(e))&&(o&&(o+=" "),o+=t);return o}const $e="-",Vt=e=>{const t=Ht(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:a=>{const c=a.split($e);return c[0]===""&&c.length!==1&&c.shift(),at(c,t)||Yt(a)},getConflictingClassGroupIds:(a,c)=>{const l=n[a]||[];return c&&o[a]?[...l,...o[a]]:l}}},at=(e,t)=>{var a;if(e.length===0)return t.classGroupId;const n=e[0],o=t.nextPart.get(n),r=o?at(e.slice(1),o):void 0;if(r)return r;if(t.validators.length===0)return;const i=e.join($e);return(a=t.validators.find(({validator:c})=>c(i)))==null?void 0:a.classGroupId},Ye=/^\[(.+)\]$/,Yt=e=>{if(Ye.test(e)){const t=Ye.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},Ht=e=>{const{theme:t,prefix:n}=e,o={nextPart:new Map,validators:[]};return Qt(Object.entries(e.classGroups),n).forEach(([i,a])=>{De(a,o,i,t)}),o},De=(e,t,n,o)=>{e.forEach(r=>{if(typeof r=="string"){const i=r===""?t:He(t,r);i.classGroupId=n;return}if(typeof r=="function"){if(Jt(r)){De(r(o),t,n,o);return}t.validators.push({validator:r,classGroupId:n});return}Object.entries(r).forEach(([i,a])=>{De(a,He(t,i),n,o)})})},He=(e,t)=>{let n=e;return t.split($e).forEach(o=>{n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n},Jt=e=>e.isThemeGetter,Qt=(e,t)=>t?e.map(([n,o])=>{const r=o.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([a,c])=>[t+a,c])):i);return[n,r]}):e,Xt=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,o=new Map;const r=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,o=n,n=new Map)};return{get(i){let a=n.get(i);if(a!==void 0)return a;if((a=o.get(i))!==void 0)return r(i,a),a},set(i,a){n.has(i)?n.set(i,a):r(i,a)}}},ct="!",Zt=e=>{const{separator:t,experimentalParseClassName:n}=e,o=t.length===1,r=t[0],i=t.length,a=c=>{const l=[];let d=0,b=0,w;for(let g=0;g<c.length;g++){let E=c[g];if(d===0){if(E===r&&(o||c.slice(g,g+i)===t)){l.push(c.slice(b,g)),b=g+i;continue}if(E==="/"){w=g;continue}}E==="["?d++:E==="]"&&d--}const f=l.length===0?c:c.substring(b),y=f.startsWith(ct),x=y?f.substring(1):f,v=w&&w>b?w-b:void 0;return{modifiers:l,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:v}};return n?c=>n({className:c,parseClassName:a}):a},en=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(o=>{o[0]==="["?(t.push(...n.sort(),o),n=[]):n.push(o)}),t.push(...n.sort()),t},tn=e=>({cache:Xt(e.cacheSize),parseClassName:Zt(e),...Vt(e)}),nn=/\s+/,on=(e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:r}=t,i=[],a=e.trim().split(nn);let c="";for(let l=a.length-1;l>=0;l-=1){const d=a[l],{modifiers:b,hasImportantModifier:w,baseClassName:f,maybePostfixModifierPosition:y}=n(d);let x=!!y,v=o(x?f.substring(0,y):f);if(!v){if(!x){c=d+(c.length>0?" "+c:c);continue}if(v=o(f),!v){c=d+(c.length>0?" "+c:c);continue}x=!1}const g=en(b).join(":"),E=w?g+ct:g,I=E+v;if(i.includes(I))continue;i.push(I);const q=r(v,x);for(let W=0;W<q.length;++W){const F=q[W];i.push(E+F)}c=d+(c.length>0?" "+c:c)}return c};function rn(){let e=0,t,n,o="";for(;e<arguments.length;)(t=arguments[e++])&&(n=lt(t))&&(o&&(o+=" "),o+=n);return o}const lt=e=>{if(typeof e=="string")return e;let t,n="";for(let o=0;o<e.length;o++)e[o]&&(t=lt(e[o]))&&(n&&(n+=" "),n+=t);return n};function sn(e,...t){let n,o,r,i=a;function a(l){const d=t.reduce((b,w)=>w(b),e());return n=tn(d),o=n.cache.get,r=n.cache.set,i=c,c(l)}function c(l){const d=o(l);if(d)return d;const b=on(l,n);return r(l,b),b}return function(){return i(rn.apply(null,arguments))}}const A=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},dt=/^\[(?:([a-z-]+):)?(.+)\]$/i,an=/^\d+\/\d+$/,cn=new Set(["px","full","screen"]),ln=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,dn=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,un=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,wn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,bn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,H=e=>fe(e)||cn.has(e)||an.test(e),te=e=>me(e,"length",yn),fe=e=>!!e&&!Number.isNaN(Number(e)),_e=e=>me(e,"number",fe),Ne=e=>!!e&&Number.isInteger(Number(e)),fn=e=>e.endsWith("%")&&fe(e.slice(0,-1)),h=e=>dt.test(e),ne=e=>ln.test(e),mn=new Set(["length","size","percentage"]),kn=e=>me(e,mn,ut),pn=e=>me(e,"position",ut),gn=new Set(["image","url"]),hn=e=>me(e,gn,Cn),xn=e=>me(e,"",vn),Se=()=>!0,me=(e,t,n)=>{const o=dt.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):n(o[2]):!1},yn=e=>dn.test(e)&&!un.test(e),ut=()=>!1,vn=e=>wn.test(e),Cn=e=>bn.test(e),jn=()=>{const e=A("colors"),t=A("spacing"),n=A("blur"),o=A("brightness"),r=A("borderColor"),i=A("borderRadius"),a=A("borderSpacing"),c=A("borderWidth"),l=A("contrast"),d=A("grayscale"),b=A("hueRotate"),w=A("invert"),f=A("gap"),y=A("gradientColorStops"),x=A("gradientColorStopPositions"),v=A("inset"),g=A("margin"),E=A("opacity"),I=A("padding"),q=A("saturate"),W=A("scale"),F=A("sepia"),L=A("skew"),$=A("space"),Q=A("translate"),he=()=>["auto","contain","none"],xe=()=>["auto","hidden","clip","visible","scroll"],ie=()=>["auto",h,t],S=()=>[h,t],Pe=()=>["",H,te],X=()=>["auto",fe,h],ye=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],se=()=>["solid","dashed","dotted","double","none"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],de=()=>["start","end","center","between","around","evenly","stretch"],Z=()=>["","0",h],u=()=>["auto","avoid","all","avoid-page","page","left","right","column"],k=()=>[fe,h];return{cacheSize:500,separator:":",theme:{colors:[Se],spacing:[H,te],blur:["none","",ne,h],brightness:k(),borderColor:[e],borderRadius:["none","","full",ne,h],borderSpacing:S(),borderWidth:Pe(),contrast:k(),grayscale:Z(),hueRotate:k(),invert:Z(),gap:S(),gradientColorStops:[e],gradientColorStopPositions:[fn,te],inset:ie(),margin:ie(),opacity:k(),padding:S(),saturate:k(),scale:k(),sepia:Z(),skew:k(),space:S(),translate:S()},classGroups:{aspect:[{aspect:["auto","square","video",h]}],container:["container"],columns:[{columns:[ne]}],"break-after":[{"break-after":u()}],"break-before":[{"break-before":u()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...ye(),h]}],overflow:[{overflow:xe()}],"overflow-x":[{"overflow-x":xe()}],"overflow-y":[{"overflow-y":xe()}],overscroll:[{overscroll:he()}],"overscroll-x":[{"overscroll-x":he()}],"overscroll-y":[{"overscroll-y":he()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Ne,h]}],basis:[{basis:ie()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",h]}],grow:[{grow:Z()}],shrink:[{shrink:Z()}],order:[{order:["first","last","none",Ne,h]}],"grid-cols":[{"grid-cols":[Se]}],"col-start-end":[{col:["auto",{span:["full",Ne,h]},h]}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":[Se]}],"row-start-end":[{row:["auto",{span:[Ne,h]},h]}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",h]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",h]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...de()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...de(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...de(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[I]}],px:[{px:[I]}],py:[{py:[I]}],ps:[{ps:[I]}],pe:[{pe:[I]}],pt:[{pt:[I]}],pr:[{pr:[I]}],pb:[{pb:[I]}],pl:[{pl:[I]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[$]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[$]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",h,t]}],"min-w":[{"min-w":[h,t,"min","max","fit"]}],"max-w":[{"max-w":[h,t,"none","full","min","max","fit","prose",{screen:[ne]},ne]}],h:[{h:[h,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[h,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[h,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[h,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ne,te]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",_e]}],"font-family":[{font:[Se]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",h]}],"line-clamp":[{"line-clamp":["none",fe,_e]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",H,h]}],"list-image":[{"list-image":["none",h]}],"list-style-type":[{list:["none","disc","decimal",h]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",H,te]}],"underline-offset":[{"underline-offset":["auto",H,h]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:S()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",h]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",h]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ye(),pn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",kn]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},hn]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...se(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[E]}],"divide-style":[{divide:se()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...se()]}],"outline-offset":[{"outline-offset":[H,h]}],"outline-w":[{outline:[H,te]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:Pe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[H,te]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ne,xn]}],"shadow-color":[{shadow:[Se]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...ve(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":ve()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[o]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",ne,h]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[b]}],invert:[{invert:[w]}],saturate:[{saturate:[q]}],sepia:[{sepia:[F]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[b]}],"backdrop-invert":[{"backdrop-invert":[w]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[q]}],"backdrop-sepia":[{"backdrop-sepia":[F]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[a]}],"border-spacing-x":[{"border-spacing-x":[a]}],"border-spacing-y":[{"border-spacing-y":[a]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",h]}],duration:[{duration:k()}],ease:[{ease:["linear","in","out","in-out",h]}],delay:[{delay:k()}],animate:[{animate:["none","spin","ping","pulse","bounce",h]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[W]}],"scale-x":[{"scale-x":[W]}],"scale-y":[{"scale-y":[W]}],rotate:[{rotate:[Ne,h]}],"translate-x":[{"translate-x":[Q]}],"translate-y":[{"translate-y":[Q]}],"skew-x":[{"skew-x":[L]}],"skew-y":[{"skew-y":[L]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",h]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",h]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":S()}],"scroll-mx":[{"scroll-mx":S()}],"scroll-my":[{"scroll-my":S()}],"scroll-ms":[{"scroll-ms":S()}],"scroll-me":[{"scroll-me":S()}],"scroll-mt":[{"scroll-mt":S()}],"scroll-mr":[{"scroll-mr":S()}],"scroll-mb":[{"scroll-mb":S()}],"scroll-ml":[{"scroll-ml":S()}],"scroll-p":[{"scroll-p":S()}],"scroll-px":[{"scroll-px":S()}],"scroll-py":[{"scroll-py":S()}],"scroll-ps":[{"scroll-ps":S()}],"scroll-pe":[{"scroll-pe":S()}],"scroll-pt":[{"scroll-pt":S()}],"scroll-pr":[{"scroll-pr":S()}],"scroll-pb":[{"scroll-pb":S()}],"scroll-pl":[{"scroll-pl":S()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",h]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[H,te,_e]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},Nn=sn(jn);function j(...e){return Nn(st(e))}const Sn=G.Root,En=G.Portal,wt=D.forwardRef(({className:e,...t},n)=>s.jsx(G.Overlay,{ref:n,className:j("web3kit-fixed web3kit-inset-0 web3kit-z-20 web3kit-bg-white/20 data-[state=open]:web3kit-animate-in data-[state=closed]:web3kit-animate-out data-[state=closed]:web3kit-fade-out-0 data-[state=open]:web3kit-fade-in-0",e),...t}));wt.displayName=G.Overlay.displayName;const bt=D.forwardRef(({className:e,children:t,...n},o)=>s.jsxs(En,{children:[s.jsx(wt,{className:"DialogContent"}),s.jsxs(G.Content,{ref:o,className:j("web3kit-fixed web3kit-left-[50%] web3kit-top-[50%] web3kit-z-20 web3kit-grid web3kit-w-full web3kit-max-w-lg web3kit-translate-x-[-50%] web3kit-translate-y-[-50%] web3kit-gap-4 web3kit-border web3kit-bg-background web3kit-p-6 web3kit-shadow-lg web3kit-duration-200 data-[state=open]:web3kit-animate-in data-[state=closed]:web3kit-animate-out data-[state=closed]:web3kit-fade-out-0 data-[state=open]:web3kit-fade-in-0 data-[state=closed]:web3kit-zoom-out-95 data-[state=open]:web3kit-zoom-in-95 data-[state=closed]:web3kit-slide-out-to-left-1/2 data-[state=closed]:web3kit-slide-out-to-top-[48%] data-[state=open]:web3kit-slide-in-from-left-1/2 data-[state=open]:web3kit-slide-in-from-top-[48%] sm:web3kit-rounded-lg",e),...n,children:[t,s.jsxs(G.Close,{className:"web3kit-absolute web3kit-right-4 web3kit-top-4 web3kit-rounded-sm web3kit-opacity-70 web3kit-ring-offset-background web3kit-transition-opacity hover:web3kit-opacity-100 focus:web3kit-outline-none focus:web3kit-ring-2 focus:web3kit-ring-ring focus:web3kit-ring-offset-2 disabled:web3kit-pointer-events-none data-[state=open]:web3kit-bg-accent data-[state=open]:web3kit-text-muted-foreground",children:[s.jsx(Y.X,{className:"web3kit-h-4 web3kit-w-4"}),s.jsx("span",{className:"web3kit-sr-only",children:"Close"})]})]})]}));bt.displayName=G.Content.displayName;const ft=D.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:j("web3kit-flex web3kit-flex-col web3kit-space-y-1.5 web3kit-text-center sm:web3kit-text-left",e),...t}));ft.displayName="DialogHeader";const mt=D.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:j("web3kit-flex web3kit-flex-col-reverse sm:web3kit-flex-row sm:web3kit-justify-end sm:web3kit-space-x-2",e),...t}));mt.displayName="DialogFooter";const kt=D.forwardRef(({className:e,...t},n)=>s.jsx(G.Title,{ref:n,className:j("web3kit-text-lg web3kit-font-semibold web3kit-leading-none web3kit-tracking-tight",e),...t}));kt.displayName=G.Title.displayName;const pt=D.forwardRef(({className:e,...t},n)=>s.jsx(G.Description,{ref:n,className:j("web3kit-text-sm web3kit-text-muted-foreground",e),...t}));pt.displayName=G.Description.displayName;const gt=({shouldScaleBackground:e=!0,...t})=>s.jsx(U.Drawer.Root,{shouldScaleBackground:e,...t});gt.displayName="Drawer";U.Drawer.Trigger;const An=U.Drawer.Portal;U.Drawer.Close;const ht=D.forwardRef(({className:e,...t},n)=>s.jsx(U.Drawer.Overlay,{ref:n,className:j("web3kit-fixed web3kit-inset-0 web3kit-z-20 web3kit-bg-black/80",e),...t}));var Xe;ht.displayName=((Xe=U.Drawer.Overlay)==null?void 0:Xe.displayName)||"DrawerOverlay";const xt=D.forwardRef(({className:e,children:t,...n},o)=>s.jsxs(An,{children:[s.jsx(ht,{}),s.jsxs(U.Drawer.Content,{ref:o,className:j("web3kit-fixed web3kit-inset-x-0 web3kit-bottom-0 web3kit-z-20 web3kit-mt-24 web3kit-flex web3kit-h-auto web3kit-flex-col web3kit-rounded-t-[10px] web3kit-border web3kit-bg-background",e),...n,children:[s.jsx("div",{className:"web3kit-mx-auto web3kit-mt-4 web3kit-h-2 web3kit-w-[100px] web3kit-rounded-full web3kit-bg-muted"}),t]})]}));xt.displayName="DrawerContent";const yt=({className:e,...t})=>s.jsx("div",{className:j("web3kit-grid web3kit-gap-1.5 web3kit-p-4 web3kit-text-center sm:web3kit-text-left",e),...t});yt.displayName="DrawerHeader";const vt=({className:e,...t})=>s.jsx("div",{className:j("web3kit-mt-auto web3kit-flex web3kit-flex-col web3kit-gap-2 web3kit-p-4",e),...t});vt.displayName="DrawerFooter";const Ct=D.forwardRef(({className:e,...t},n)=>s.jsx(U.Drawer.Title,{ref:n,className:j("web3kit-text-lg web3kit-font-semibold web3kit-leading-none web3kit-tracking-tight",e),...t}));var Ze;Ct.displayName=((Ze=U.Drawer.Title)==null?void 0:Ze.displayName)||"DrawerTitle";const jt=D.forwardRef(({className:e,...t},n)=>s.jsx(U.Drawer.Description,{ref:n,className:j("web3kit-text-sm web3kit-text-muted-foreground",e),...t}));var et;jt.displayName=((et=U.Drawer.Description)==null?void 0:et.displayName)||"DrawerDescription";const Nt=D.forwardRef(({className:e,children:t,...n},o)=>s.jsxs(ae.Root,{ref:o,className:j("web3kit-relative web3kit-overflow-hidden",e),...n,children:[s.jsx(ae.Viewport,{className:"web3kit-h-full web3kit-w-full web3kit-rounded-[inherit]",children:t}),s.jsx(St,{}),s.jsx(ae.Corner,{})]}));Nt.displayName=ae.Root.displayName;const St=D.forwardRef(({className:e,orientation:t="vertical",...n},o)=>s.jsx(ae.ScrollAreaScrollbar,{ref:o,orientation:t,className:j("web3kit-flex web3kit-touch-none web3kit-select-none web3kit-transition-colors",t==="vertical"&&"web3kit-h-full web3kit-w-2.5 web3kit-border-l web3kit-border-l-transparent web3kit-p-[1px]",t==="horizontal"&&"web3kit-h-2.5 web3kit-flex-col web3kit-border-t web3kit-border-t-transparent web3kit-p-[1px]",e),...n,children:s.jsx(ae.ScrollAreaThumb,{className:"web3kit-relative web3kit-flex-1 web3kit-rounded-full web3kit-bg-border"})}));St.displayName=ae.ScrollAreaScrollbar.displayName;const ke="(min-width: 768px)",Rn=({className:e,children:t,...n})=>{const r=pe(ke)?Sn:gt;return s.jsx(r,{...n,className:j("web3kit-transition-transform web3kit-duration-300",e),children:t})},Pn=({className:e,children:t,...n})=>{const r=pe(ke)?bt:xt;return s.jsx(r,{className:j("web3kit-bg-card web3kit-text-card-foreground !web3kit-border-0 !web3kit-rounded-3xl md:web3kit-max-w-[380px] [&>button]:web3kit-right-[26px] [&>button]:web3kit-top-[26px] web3kit-transition-transform web3kit-duration-300",e),onOpenAutoFocus:i=>i.preventDefault(),...n,children:t})},Tn=({className:e,children:t,...n})=>{const r=pe(ke)?pt:jt;return s.jsx(r,{className:e,...n,children:t})},In=({className:e,children:t,...n})=>{const r=pe(ke)?ft:yt;return s.jsx(r,{className:j("web3kit-space-y-0 web3kit-pb-6 md:web3kit-pb-3",e),...n,children:t})},Wn=({className:e,children:t,...n})=>{const r=pe(ke)?kt:Ct;return s.jsx(r,{className:j("web3kit-text-center web3kit-py-2",e),...n,children:t})},Mn=({className:e,children:t,...n})=>s.jsx(Nt,{className:j("web3kit-h-[260px] web3kit-max-h-[350px] web3kit-px-6 md:web3kit-h-full md:web3kit-min-h-[260px] md:web3kit-px-0",e),...n,children:s.jsx("div",{className:"web3kit-space-y-2",children:t})}),zn=({className:e,children:t,...n})=>{const r=pe(ke)?mt:vt;return s.jsx(r,{className:j("web3kit-py-3.5 md:web3kit-py-0",e),...n,children:s.jsx("div",{className:"web3kit-flex web3kit-flex-col web3kit-gap-y-4 web3kit-w-full",children:t})})};function pe(e){const[t,n]=D.useState(!1);return D.useEffect(()=>{const o=matchMedia(e);n(o.matches);const r=i=>n(i.matches);return o.addEventListener("change",r),()=>o.removeEventListener("change",r)},[e]),t}function On(e){var r,i;const{chain:t,transport:n}=e,o={chainId:t.id,name:t.name,ensAddress:(i=(r=t.contracts)==null?void 0:r.ensRegistry)==null?void 0:i.address};if(n.type==="fallback"){const a=n.transports.map(({value:c})=>new T.JsonRpcProvider(c==null?void 0:c.url,o));return a.length===1?a[0]:new T.FallbackProvider(a)}return new T.JsonRpcProvider(n.url,o)}function Et(e,{chainId:t}={}){const n=M.getClient(e,{chainId:t});if(n)return On(n)}function P(){const{chains:e}=C(),{data:t,update:n}=Ae.useSession(),{chainId:o=0,network:r="",address:i="",social:a="",name:c="",image:l="",role:d="",provider:b="",users:w=[]}=(t==null?void 0:t.user)||{},f=e.find(y=>y.id===o);return{address:i,chainId:o,social:a,image:l,name:c,role:d,network:r,provider:b,users:w,chain:f,switchChain:async y=>{await n({id:"switchChain",chainId:y})},switchAccount:async(y,x)=>{await n({id:"switchAccount",network:y,address:x})}}}function Be(){var o,r,i,a,c;const{chainId:e}=P(),{chains:t}=C(),n=t.find(l=>l.id===e);return{chainLogo:(n==null?void 0:n.logo)||m.M,networkLogo:((o=n==null?void 0:n.network)==null?void 0:o.logo)||m.M,nativeSymbol:((r=n==null?void 0:n.nativeCurrency)==null?void 0:r.symbol)||"",nativeDecimals:((i=n==null?void 0:n.nativeCurrency)==null?void 0:i.decimals)||18,txExplorer:((a=n==null?void 0:n.blockExplorers)==null?void 0:a.default.hash)||"",addressExplorer:((c=n==null?void 0:n.blockExplorers)==null?void 0:c.default.address)||""}}function Ke(){return _.useQuery({queryKey:["use-social-providers"],queryFn:async()=>{const e=await Ae.getProviders();return Object.values(e||{}).filter(t=>t.id!=="credentials")}})}function oe(){const{wagmiConfig:e}=C(),{data:t,...n}=_.useQuery({queryKey:["use-eth-wallets"],queryFn:async()=>{const o={metaMask:m.b,walletConnect:m.m,coinbaseWalletSDK:m.j};return(await M.getConnectors(e)).map(i=>(i.isInstalled=i.type==="mock"||i.type==="injected"&&i.id!=="metaMask"||i.id==="coinbaseWalletSDK",i.icon=o[i.id]||i.icon,i)).filter((i,a,c)=>c.findIndex(l=>l.id===i.id)===a).map(i=>i.id==="walletConnect"?{...i,name:"WalletConnect"}:i).filter((i,a,c)=>!(i.id==="coinbaseWalletSDK"&&c.find(l=>l.id==="com.coinbase.wallet"))).filter((i,a,c)=>!((i.id==="metaMaskSDK"||i.id==="metaMask")&&c.find(l=>l.id==="io.metamask"||l.id==="io.metamask.mobile"))).sort((i,a)=>{const c=i.isInstalled&&i.type==="injected",l=a.isInstalled&&a.type==="injected";return c&&!l?-1:!c&&l?1:0}).sort((i,a)=>i.id==="walletConnect"?1:a.id==="walletConnect"?-1:0)}});return{...n,data:t||[]}}function re(){const{wallets:e,connect:t,disconnect:n,select:o,signMessage:r}=tt.useWallet();return{solConnect:t,solDisconnect:n,solSelect:o,solSignMessage:r,solWallets:e.filter(i=>i.readyState===be.WalletReadyState.Installed||i.readyState===be.WalletReadyState.Loadable).sort((i,a)=>a.readyState===be.WalletReadyState.Installed?1:-1).map(i=>i.adapter)}}function Re(e,t,n,o){const r=t.find(a=>a.id===e);if(!r)throw new Error("Chain not found");let i;switch(r.network.symbol){case m.NetworkSymbols.eth:i=o?Et(n,{chainId:e}):new T.JsonRpcProvider(r.rpcUrls.default.http[0]);break;case m.NetworkSymbols.sol:i=new K.Connection(K.clusterApiUrl(ot.isMainnet?be.WalletAdapterNetwork.Mainnet:be.WalletAdapterNetwork.Devnet),"confirmed");break}return i}function At({address:e,chainId:t}={}){const{chainId:n,address:o}=P(),{chains:r,wagmiConfig:i}=C(),a=t||n,c=r.find(w=>w.id===a),l=e||o,{data:d,...b}=_.useQuery({queryKey:["use-account-balance",{chainId:a,address:l}],queryFn:async function(){if(!l)return 0n;if(!c)throw new Error("Chain not found");const w=Re(a,r,i,l!=="");switch(c.network.symbol){case m.NetworkSymbols.eth:return w instanceof T.JsonRpcProvider||w instanceof T.FallbackProvider?await w.getBalance(l):0n;case m.NetworkSymbols.sol:if(w instanceof K.Connection){const f=await w.getBalance(new K.PublicKey(l));return BigInt(f)}return 0n;default:return 0n}}});return{...b,data:d||0n}}function _n({address:e,tokenAddress:t,chainId:n}){const{chainId:o,address:r}=P(),{chains:i,wagmiConfig:a}=C(),c=n||o,l=i.find(f=>f.id===c),d=e||r,{data:b,...w}=_.useQuery({queryKey:["use-token-balance",{chainId:c,address:d,tokenAddress:t}],queryFn:async function(){if(!d)return 0n;if(!l)throw new Error("Chain not found");const f=Re(c,i,a,d!=="");switch(l.network.symbol){case m.NetworkSymbols.eth:return f instanceof T.JsonRpcProvider||f instanceof T.FallbackProvider?await new T.Contract(t,nt.erc20Abi,f).balanceOf(d):0n;case m.NetworkSymbols.sol:if(f instanceof K.Connection){const y=await f.getTokenAccountsByOwner(new K.PublicKey(d),{mint:new K.PublicKey(t)});if(y.value.length===0)return 0n;const x=await f.getTokenAccountBalance(y.value[0].pubkey);return BigInt(x.value.amount)}return 0n;default:return 0n}}});return{...w,data:b||0n}}function Rt(){const{chains:e,pendingItem:t,wagmiConfig:n,setRouter:o,setPendingItem:r}=C(),{solWallets:i}=re(),{data:a}=oe(),{data:c}=Ke();return _.useMutation({mutationKey:["use-connect",{id:t==null?void 0:t.id,network:t==null?void 0:t.network}],mutationFn:async()=>{if(t)if(t.network===m.NetworkSymbols.eth){const l=a.find(w=>w.id===t.id);if(!l)throw new Error(`Wallet ${t.id} not found`);try{await M.disconnect(n,{connector:l})}catch{}let d=null;try{const w=await M.connect(n,{connector:l});d={chainId:w.chainId,accounts:Array.from(w.accounts)}}catch(w){if(!(w instanceof M.ConnectorAlreadyConnectedError))throw console.log("error",w),w}if(!d){const w=M.getChainId(n),f=M.getAccount(n);d={chainId:w,accounts:f!=null&&f.address?[f.address]:[]}}if(!(d!=null&&d.chainId))throw new Error("Failed to connect to wallet");console.log({chainId:d.chainId});const b=e.find(w=>w.id===d.chainId);if(!b){const w=e.find(f=>f.network.symbol===m.NetworkSymbols.eth);if(!w)throw new Error("Chain not found");await M.switchChain(n,{connector:l,chainId:w.id})}o(()=>{var w;return r({id:l==null?void 0:l.id,name:l==null?void 0:l.name,logo:l==null?void 0:l.icon,network:m.NetworkSymbols.eth,chainId:b.id,address:(w=d==null?void 0:d.accounts)==null?void 0:w[0]}),p.accountSigning})}else if(t.network===m.NetworkSymbols.sol){const l=i.find(d=>d.name===t.id);if(!l)throw new Error(`Wallet ${t.id} not found`);l.connected&&await l.disconnect(),await l.connect()}else{const l=c.find(d=>d.id===t.id);if(!l)throw new Error(`Provider ${t.id} not found`);await Ae.signIn(l.id),ce.toast.success("Redirecting to oauth provider")}},onSuccess:()=>{ce.toast.success("Connected to wallet")},onError:l=>{throw console.log("connect error",l),l}})}function Dn(){var l;const{address:e,social:t,chain:n,network:o,provider:r,switchChain:i}=P(),{wagmiConfig:a}=C(),{data:c}=oe();return _.useMutation({mutationKey:["use-switch-chain",{social:t,network:(l=n==null?void 0:n.network)==null?void 0:l.symbol}],mutationFn:async d=>{if(e)if(t)await i(d);else if(o===m.NetworkSymbols.eth){const b=c.find(w=>w.id===r);if(!b)throw new Error(`Wallet ${r} not found`);await M.switchChain(a,{connector:b,chainId:d})}else throw o===m.NetworkSymbols.sol?new Error("Solana wallet does not support chain switching"):new Error("Unknown network")},onSuccess:()=>{ce.toast.success("Switched to chain")},onError:d=>{throw console.log("switch chain error",d),d}})}function qn(){const{pendingItem:e,wagmiConfig:t,setRouter:n}=C(),{solWallets:o}=re(),{data:r}=oe(),i=process.env.SIGN_MESSAGE_CONTENT||ot.signMessageContent;return _.useMutation({mutationKey:["use-sign-account",{id:e==null?void 0:e.id,network:e==null?void 0:e.network}],mutationFn:async()=>{if(!e)return;let a;if(e.network===m.NetworkSymbols.eth){const c=r.find(l=>l.id===e.id);if(!c)throw new Error(`Wallet ${e.id} not found`);a=await M.signMessage(t,{connector:c,message:i})}else if(e.network===m.NetworkSymbols.sol){const c=o.find(d=>d.name===e.id);if(!c)throw new Error(`Wallet ${e.id} not found`);const l=await c.signMessage(Buffer.from(i));a=Buffer.from(l).toString("base64")}else throw new Error("Unknown network");await Ae.signIn("credentials",{redirect:!1,signature:a,provider:e.id,chainId:e.chainId,address:e.address,message:i})},onSuccess:()=>{ce.toast.success("Signed in")},onError:a=>{throw console.log("sign account error",a),a}})}function Fn(){const{pendingItem:e,setRouter:t,setPendingItem:n}=C(),{users:o}=P(),{solWallets:r}=re(),{data:i}=oe();return _.useMutation({mutationKey:["use-sign-account",{id:e==null?void 0:e.id,network:e==null?void 0:e.network}],mutationFn:async({network:a,address:c})=>{if(!e)return;const l=o.find(d=>d.network===a&&d.address===c);if(!l)throw new Error("User not found");if(l.social)t(()=>(n({id:l.provider,logo:l.image,network:"",description:`We connect your "${l.name}" account to our platform.`}),p.socialConnecting));else if(l.network===m.NetworkSymbols.eth){const d=i.find(b=>b.id===l.provider);if(!d)throw new Error(`Wallet ${l.provider} not found`);t(()=>(n({id:d.id,logo:d.icon,network:m.NetworkSymbols.eth,description:`Open the ${d.name} browser extension to connect your wallet.`}),p.walletConnecting))}else{const d=r.find(b=>b.name===l.provider);if(!d)throw new Error(`Wallet ${l.provider} not found`);t(()=>(n({id:d.name,logo:d.icon,network:m.NetworkSymbols.sol,description:`Open the ${d.name} browser extension to connect your wallet.`}),p.walletConnecting))}},onSuccess:()=>{},onError:a=>{throw console.log("switch account error",a),a}})}function Pt(){const{wagmiConfig:e}=C(),{data:t}=oe(),{solWallets:n,solDisconnect:o}=re(),{provider:r,social:i,address:a,network:c}=P();return _.useMutation({mutationKey:["use-disconnect-account",{social:i,address:a,network:c}],mutationFn:async()=>{if(!i)if(c===m.NetworkSymbols.eth){const l=t.find(d=>d.id===r);if(!l)throw new Error(`Wallet ${r} not found`);await M.disconnect(e,{connector:l})}else if(c===m.NetworkSymbols.sol){if(!n.find(d=>d.name===r))throw new Error(`Wallet ${r} not found`);await o()}else throw new Error("Unknown network");await Ae.signOut({redirect:!1})},onSuccess:()=>{ce.toast.success("Signed out")},onError:l=>{throw console.log("disconnect account error",l),l}})}function Tt({address:e,chainId:t}={}){const{chainId:n,address:o}=P(),{chains:r,wagmiConfig:i}=C(),a=t||n,c=r.find(b=>b.id===a);if(!c)throw new Error("Chain not found");const l=c.network.symbol,d=e||o;return _.useMutation({mutationKey:["use-balance-async",{chainId:a,address:d}],mutationFn:async function(){let b=0n;const w=Re(a,r,i,d!=="");switch(l){case m.NetworkSymbols.eth:(w instanceof T.JsonRpcProvider||w instanceof T.FallbackProvider)&&(b=await w.getBalance(d));break;case m.NetworkSymbols.sol:if(w instanceof K.Connection){const f=await w.getBalance(new K.PublicKey(d));b=BigInt(f)}break}return b},onError:b=>{console.log(b)}})}function It({address:e,chainId:t}={}){const{chainId:n,address:o}=P(),{chains:r,wagmiConfig:i}=C(),a=t||n,c=r.find(d=>d.id===a);if(!c)throw new Error("Chain not found");const l=e||o;return _.useMutation({mutationKey:["use-token-balance-async",{chainId:a,address:l}],mutationFn:async function(d){if(!l)return 0n;if(!c)throw new Error("Chain not found");const b=Re(a,r,i,l!=="");switch(c.network.symbol){case m.NetworkSymbols.eth:return b instanceof T.JsonRpcProvider||b instanceof T.FallbackProvider?await new T.Contract(d,nt.erc20Abi,b).balanceOf(l):0n;case m.NetworkSymbols.sol:if(b instanceof K.Connection){const w=await b.getTokenAccountsByOwner(new K.PublicKey(l),{mint:new K.PublicKey(d)});if(w.value.length===0)return 0n;const f=await b.getTokenAccountBalance(w.value[0].pubkey);return BigInt(f.value.amount)}return 0n;default:return 0n}},onError:d=>{console.log(d)}})}function $n(){const{chainId:e,social:t}=P();return _.useMutation({mutationKey:["use-send-transaction-async",{chainId:e,social:t}],mutationFn:async({address:n,value:o})=>{if(t){const r=await fetch("/api/based-auth/transfer",{method:"POST",body:JSON.stringify({address:n,value:o})});if(!r.ok){const i=await r.json();throw new Error(i.message)}return r.json()}else throw new Error("This feature is not available for only social wallets")},onError:n=>{throw ce.toast.error(n.message),n},onSuccess:()=>{ce.toast.success("Balance transferred")}})}function Bn({chainId:e}={}){const{chainId:t,social:n,switchChain:o}=P(),{data:r}=oe(),{solWallets:i}=re(),{chains:a,wagmiConfig:c}=C(),l=e||t;return _.useMutation({mutationKey:["use-read-contract-async",{chainId:l,social:n,wallets:[...r.map(d=>d.id),...i.map(d=>d.name)]}],mutationFn:async d=>{const b=a.find(f=>f.id===l);if(!b)throw new Error("Chain not found");const w=b.network.symbol;if(n){t!==l&&await o(l);const f=await fetch("/api/based-auth/read-contract",{method:"POST",body:Ee.serialize(d)});if(!f.ok){const x=await f.json();throw new Error(x.message)}const y=await f.json();return Ee.deserialize(y)}if(w===m.NetworkSymbols.eth){const f=Et(c,{chainId:l}),x=await new T.Contract(d.address,d.abi,f)[d.functionName](...d.args);return Ee.deserialize(Ee.serialize(x))}throw new Error("Unknown network")},onError:d=>{throw console.log(d),d}})}function Kn({key:e,chainId:t}={}){const{chainId:n,social:o,provider:r,switchChain:i}=P(),{chains:a,wagmiConfig:c}=C(),{data:l}=oe(),{solWallets:d}=re(),b=t||n;return _.useMutation({mutationKey:["use-write-contract-async",{chainId:b,key:e,social:o,wallets:[...l.map(w=>w.id),...d.map(w=>w.name)]}],mutationFn:async w=>{const f=a.find(x=>x.id===b);if(!f)throw new Error("Chain not found");const y=f.network.symbol;if(o){b!==w.chainId&&await i(w.chainId);const x=await fetch("/api/based-auth/write-contract",{method:"POST",body:Ee.serialize(w)});if(!x.ok){const v=await x.json();throw console.log(v),new Error(v.message)}return x.json()}else if(y===m.NetworkSymbols.eth){const x=l.find(g=>g.id===r);if(!x)throw new Error(`Wallet ${r} not found`);return await M.writeContract(c,{...w,connector:x})}else if(y===m.NetworkSymbols.sol&&!d.find(v=>v.name===r))throw new Error(`Wallet ${r} not found`)},onError:w=>{throw console.log(w),w}})}const le=({className:e})=>s.jsxs("svg",{"aria-hidden":"true",width:"102",height:"102",viewBox:"0 0 102 102",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:[s.jsx("path",{d:"M52 100C24.3858 100 2 77.6142 2 50",stroke:"url(#paint0_linear_1943_4139)",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("defs",{children:s.jsxs("linearGradient",{id:"paint0_linear_1943_4139",x1:"2",y1:"48.5",x2:"53",y2:"100",gradientUnits:"userSpaceOnUse",children:[s.jsx("stop",{stopColor:"currentColor"}),s.jsx("stop",{offset:"1",stopColor:"currentColor",stopOpacity:"0"})]})})]});function J({className:e,index:t=0,onClick:n,logo:o,children:r,disabled:i=!1,...a}){return s.jsxs(B.motion.button,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1*(t+1)},onClick:n,className:j("web3kit-flex web3kit-justify-between web3kit-h-12 web3kit-items-center web3kit-rounded-xl web3kit-px-4 web3kit-py-2 web3kit-text-lg web3kit-font-semibold web3kit-shadow-md web3kit-bg-muted hover:web3kit-bg-accent hover:web3kit-shadow-xl web3kit-gap-x-2 web3kit-w-full",e),disabled:i,...a,children:[s.jsx("div",{className:"web3kit-leading-none",children:r}),i?s.jsx(le,{className:"web3kit-size-8 web3kit-animate-spin"}):typeof o=="string"?s.jsx(B.motion.img,{src:o,alt:`${t} logo`,className:"web3kit-size-8 web3kit-overflow-hidden web3kit-rounded-lg"}):o]})}function Ln(){const{setPendingItem:e,setRouter:t}=C(),{users:n}=P(),{data:o}=oe();return N.useEffect(()=>{e(null)},[]),s.jsx("div",{className:"web3kit-space-y-2",children:o.filter(r=>!n.find(i=>i.provider===r.id&&i.network===m.NetworkSymbols.eth)).map((r,i)=>s.jsx(J,{index:i,logo:r.icon,onClick:()=>{t(()=>(e({id:r.id,logo:r.icon,network:m.NetworkSymbols.eth,description:`Open the ${r.name} browser extension to connect your wallet.`}),p.walletConnecting))},children:r.name},r.id))})}function Gn(){const{solWallets:e}=re(),{users:t}=P(),{setPendingItem:n,setRouter:o}=C();return N.useEffect(()=>{n(null)},[]),s.jsx("div",{className:"web3kit-space-y-2",children:e.filter(r=>!t.find(i=>i.provider===r.name&&i.network===m.NetworkSymbols.sol)).map((r,i)=>s.jsx(J,{index:i,logo:r.icon,onClick:()=>{o(()=>(n({id:r.name,logo:r.icon,network:m.NetworkSymbols.sol,description:`Open the ${r.name} browser extension to connect your wallet.`}),p.walletConnecting))},children:r.name},i))})}function Un(){const{address:e}=P();return s.jsxs("div",{className:"web3kit-flex web3kit-flex-col web3kit-items-center web3kit-gap-4",children:[s.jsx("div",{className:"web3kit-text-center",children:s.jsx("p",{className:"web3kit-text-sm web3kit-text-muted-foreground",children:"Scan this QR code to send funds to your wallet"})}),s.jsx(B.motion.div,{initial:{scale:.8,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.3},className:"web3kit-flex web3kit-items-center web3kit-justify-center web3kit-p-4 web3kit-bg-white web3kit-rounded-lg",children:s.jsx(Ft.QRCodeSVG,{value:e,size:200,level:"H",marginSize:1,className:"web3kit-border web3kit-rounded-lg"})})]})}const Je=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Qe=st,Vn=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return Qe(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(d=>{const b=n==null?void 0:n[d],w=i==null?void 0:i[d];if(b===null)return null;const f=Je(b)||Je(w);return r[d][f]}),c=n&&Object.entries(n).reduce((d,b)=>{let[w,f]=b;return f===void 0||(d[w]=f),d},{}),l=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((d,b)=>{let{class:w,className:f,...y}=b;return Object.entries(y).every(x=>{let[v,g]=x;return Array.isArray(g)?g.includes({...i,...c}[v]):{...i,...c}[v]===g})?[...d,w,f]:d},[]);return Qe(e,a,l,n==null?void 0:n.class,n==null?void 0:n.className)},Yn=Vn("web3kit-inline-flex web3kit-items-center web3kit-justify-center web3kit-gap-2 web3kit-whitespace-nowrap web3kit-rounded-md web3kit-text-sm web3kit-font-medium web3kit-transition-colors focus-visible:web3kit-outline-none focus-visible:web3kit-ring-1 focus-visible:web3kit-ring-ring disabled:web3kit-pointer-events-none disabled:web3kit-opacity-50 [&_svg]:web3kit-pointer-events-none [&_svg]:web3kit-size-4 [&_svg]:web3kit-shrink-0",{variants:{variant:{default:"web3kit-bg-primary web3kit-text-primary-foreground web3kit-shadow hover:web3kit-bg-primary/90",destructive:"web3kit-bg-destructive web3kit-text-destructive-foreground web3kit-shadow-sm hover:web3kit-bg-destructive/90",outline:"web3kit-border web3kit-border-input web3kit-bg-background web3kit-shadow-sm hover:web3kit-bg-accent hover:web3kit-text-accent-foreground",secondary:"web3kit-bg-secondary web3kit-text-secondary-foreground web3kit-shadow-sm hover:web3kit-bg-secondary/80",ghost:"hover:web3kit-bg-accent hover:web3kit-text-accent-foreground",link:"web3kit-text-primary web3kit-underline-offset-4 hover:web3kit-underline"},size:{default:"web3kit-h-9 web3kit-px-4 web3kit-py-2",sm:"web3kit-h-8 web3kit-rounded-md web3kit-px-3 web3kit-text-xs",lg:"web3kit-h-10 web3kit-rounded-md web3kit-px-8",icon:"web3kit-h-9 web3kit-w-9"}},defaultVariants:{variant:"default",size:"default"}}),ge=D.forwardRef(({className:e,variant:t,size:n,asChild:o=!1,...r},i)=>{const a=o?$t.Slot:"button";return s.jsx(a,{className:j(Yn({variant:t,size:n}),e),ref:i,...r})});ge.displayName="Button";function Hn(){const{pendingItem:e}=C(),{mutateAsync:t,isError:n,error:o,isPending:r}=Rt();return N.useEffect(()=>{t()},[e]),e?s.jsxs("div",{className:"web3kit-flex web3kit-w-full web3kit-flex-col web3kit-items-center web3kit-justify-center web3kit-gap-9 md:web3kit-pt-5",children:[s.jsxs("div",{className:j("web3kit-relative web3kit-size-28 web3kit-flex web3kit-items-center web3kit-justify-center web3kit-rounded-2xl web3kit-p-3"),children:[s.jsx("img",{src:e.logo,alt:e.name,className:"web3kit-size-16 web3kit-overflow-hidden web3kit-rounded-2xl"}),!r&&n?s.jsx(ge,{size:"icon",variant:"ghost",className:"web3kit-group web3kit-absolute -web3kit-bottom-2 -web3kit-right-2 web3kit-rounded-full web3kit-bg-muted web3kit-p-1.5 web3kit-shadow",onClick:()=>{t()},children:s.jsx(Y.RotateCcw,{className:"web3kit-size-4 web3kit-transition-transform group-hover:-web3kit-rotate-45"})}):s.jsx(le,{className:"web3kit-absolute web3kit-w-full web3kit-h-full web3kit-text-primary web3kit-animate-spin"})]}),s.jsxs("div",{className:"web3kit-space-y-3.5 web3kit-px-3.5 web3kit-text-center sm:web3kit-px-0",children:[s.jsx("h1",{className:"web3kit-text-xl web3kit-font-semibold",children:n||o?"Request Error":"Requesting Connection"}),s.jsx("p",{className:"web3kit-text-balance web3kit-text-sm web3kit-text-muted-foreground",children:n||o?"There was an error with the request. Click above to try again.":e.description})]})]}):null}function Jn(){const{pendingItem:e,setRouter:t}=C(),{mutateAsync:n,isError:o,isPending:r}=Dn();return N.useEffect(()=>{e?n(...e.args):t(p.account)},[]),e?s.jsxs("div",{className:"web3kit-flex web3kit-w-full web3kit-flex-col web3kit-items-center web3kit-justify-center web3kit-gap-9 md:web3kit-pt-5",children:[s.jsxs("div",{className:j("web3kit-relative web3kit-size-28 web3kit-flex web3kit-items-center web3kit-justify-center web3kit-rounded-2xl web3kit-p-3"),children:[s.jsx("img",{src:e.logo,alt:e.name,className:"web3kit-size-16 web3kit-overflow-hidden web3kit-rounded-2xl"}),!r&&o?s.jsx(ge,{size:"icon",variant:"ghost",className:"web3kit-group web3kit-absolute -web3kit-bottom-2 -web3kit-right-2 web3kit-rounded-full web3kit-bg-muted web3kit-p-1.5 web3kit-shadow",onClick:()=>{n(...e.args)},children:s.jsx(Y.RotateCcw,{className:"web3kit-size-4 web3kit-transition-transform group-hover:-web3kit-rotate-45"})}):s.jsx(le,{className:"web3kit-absolute web3kit-w-full web3kit-h-full web3kit-text-primary web3kit-animate-spin"})]}),s.jsxs("div",{className:"web3kit-space-y-3.5 web3kit-px-3.5 web3kit-text-center sm:web3kit-px-0",children:[s.jsx("h1",{className:"web3kit-text-xl web3kit-font-semibold",children:o?"Request Error":"Requesting Connection"}),s.jsx("p",{className:"web3kit-text-balance web3kit-text-sm web3kit-text-muted-foreground",children:o?"There was an error with the request. Click above to try again.":`We change your chain to "${e.name}".`})]})]}):null}function Wt(e,t=4){const n=e==null?void 0:e.startsWith("0x");return`${e==null?void 0:e.slice(0,(n?2:0)+t)}...${e==null?void 0:e.slice(-t)}`}function Mt({index:e,className:t}){return s.jsx(B.motion.div,{className:j("web3kit-animate-pulse web3kit-rounded-md web3kit-bg-foreground/10 web3kit-w-full",t),initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3*(e+1)}})}function Qn(){const{address:e,network:t,users:n}=P(),{isPending:o}=Ke(),{setPendingItem:r,setRouter:i}=C();return o?s.jsx("div",{className:"web3kit-space-y-2",children:Array.from({length:3}).map((a,c)=>s.jsx(Mt,{index:c,className:"web3kit-h-12"},c))}):s.jsx("div",{className:"web3kit-space-y-2",children:n.filter(a=>!(a.address===e&&a.network===t)).map((a,c)=>s.jsx(J,{index:c,logo:a.image,onClick:()=>{r(()=>(i(p.switchingAccount),{name:a.name,logo:a.image,args:[{network:a.network,address:a.address}],description:`We change your account to "${a.name}".`}))},children:Wt(a.address)},c))})}function Xn({className:e,...t}){return s.jsx("div",{className:j("web3kit-animate-pulse web3kit-rounded-md web3kit-bg-foreground/10",e),...t})}function Zn({address:e}){const[t,n]=N.useState(!1);N.useEffect(()=>{const r=setTimeout(()=>{t&&n(!1)},1e3);return()=>clearTimeout(r)},[t,n]);async function o(){n(!0),await navigator.clipboard.writeText(e)}return s.jsx("button",{className:"web3kit-cursor-pointer hover:web3kit-text-foreground web3kit-text-muted-foreground",onClick:o,children:t?s.jsx(Y.CheckIcon,{className:"web3kit-size-4"}):s.jsx(Y.CopyIcon,{className:"web3kit-size-4"})})}function eo(e){let t="";for(;e>=10;)t=String.fromCharCode(8320+e%10)+t,e=Math.floor(e/10);return String.fromCharCode(8320+e)+t}function to(e,t=3){if(e=+e,e!==0&&e<+`1e-${t}`){const n=e.toExponential(t-1),o=n.replace(/(\.|e-\d+$)/gi,"").replace(/0+$/,""),r=Number(n.split("e-")[1]);return"0.0"+eo(r-1)+o}return e=+(+e).toFixed(t),e.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")}function zt({className:e=""}){const{chains:t,setRouter:n}=C(),{chainId:o,address:r,network:i,social:a,image:c,users:l}=P(),{chainLogo:d,nativeSymbol:b,addressExplorer:w}=Be(),{data:f,isPending:y}=At(),x=t.filter(g=>g.id!==o).filter(g=>a||g.network.symbol===i).length>0,v=[l.length>1&&{label:"Switch Account",logo:m.T,onClick:()=>{n("switchAccount")}},x&&{label:"Switch Chain",logo:d||m.M,onClick:()=>{n(p.switchChain)}},{label:"Add Account",logo:m.T,onClick:()=>{n(p.home)}},a&&{label:"Withdraw",logo:m.H,onClick:()=>{n(p.withdrawFunds)}}].filter(Boolean);return s.jsxs("div",{className:j("web3kit-space-y-4 web3kit-text-center",e),children:[s.jsx(B.motion.img,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.5,ease:[.4,0,.2,1],delay:.1},src:typeof c=="string"?c:void 0,alt:`avatar for ${r}`,className:"web3kit-size-24 web3kit-rounded-full web3kit-mx-auto"}),s.jsxs("div",{className:"web3kit-flex web3kit-items-end web3kit-gap-2 web3kit-justify-center",children:[s.jsx("div",{className:"web3kit-text-sm web3kit-leading-none",children:y?s.jsx(Xn,{className:"web3kit-h-4 web3kit-w-[50px]"}):`${to(T.formatUnits(f||0n,18))} ${b}`}),s.jsx("a",{target:"_blank",rel:"noopener noreferrer",href:w.replace("{{addr}}",r),className:"web3kit-leading-none web3kit-text-primary",children:Wt(r)}),s.jsx(Zn,{address:r}),s.jsx(Y.QrCodeIcon,{className:"web3kit-size-4 web3kit-cursor-pointer hover:web3kit-text-foreground",onClick:()=>{n(p.walletqr)}})]}),s.jsx("div",{className:"web3kit-space-y-2",children:v.map((g,E)=>s.jsx(J,{index:E,className:"web3kit-w-full",logo:g.logo,onClick:g.onClick,children:s.jsx("div",{className:"web3kit-text-lg",children:g.label})},E))})]})}const no={google:m.e,github:m.c,twitter:m.u,discord:m.n};function Ot(){const{data:e,isPending:t}=Ke(),{chains:n,setPendingItem:o,setRouter:r}=C(),{users:i}=P(),a=Object.values(n.reduce((c,l)=>(c[l.network.symbol]=l.network,c),{}));return N.useEffect(()=>{o(null)},[]),t?s.jsx("div",{className:"web3kit-space-y-2",children:Array.from({length:3}).map((c,l)=>s.jsx(Mt,{index:l,className:"web3kit-h-12"},l))}):s.jsxs("div",{className:"web3kit-space-y-2",children:[e.filter(c=>!i.some(l=>l.provider===c.id)).map((c,l)=>{const d=no[c.id]||m.M;return s.jsx(J,{index:l,logo:d,onClick:()=>{r(()=>(o({id:c.id,chainId:n[0].id,logo:d,network:"",description:`We connect your "${c.name}" account to our platform.`}),p.socialConnecting))},children:c.name},c.id)}),s.jsx("div",{className:"web3kit-flex web3kit-items-center web3kit-gap-2",children:a.map((c,l)=>s.jsx(J,{index:l,logo:c.logo,onClick:()=>{switch(c.symbol){case m.NetworkSymbols.eth:r(p.selectETHWallet);break;case m.NetworkSymbols.sol:r(p.selectSolanaWallet);break}},children:c.name},l))})]})}function oo(){const{chainId:e,network:t,social:n}=P(),{chains:o,setPendingItem:r,setRouter:i}=C();return s.jsx("div",{className:"web3kit-space-y-2",children:o.filter(a=>a.id!==e).filter(a=>n||a.network.symbol===t).map((a,c)=>s.jsx(J,{index:c,logo:a.logo,onClick:()=>{r(()=>(i(p.switchingChain),{name:a.name,logo:a.logo,args:[a.id]}))},className:"web3kit-w-full",children:a.name},c))})}function ro(){const{pendingItem:e,setRouter:t}=C(),{mutateAsync:n,isError:o,isPending:r}=Fn();return N.useEffect(()=>{e?n(...e.args):t(p.account)},[]),e?s.jsxs("div",{className:"web3kit-flex web3kit-w-full web3kit-flex-col web3kit-items-center web3kit-justify-center web3kit-gap-9 md:web3kit-pt-5",children:[s.jsxs("div",{className:j("web3kit-relative web3kit-size-28 web3kit-flex web3kit-items-center web3kit-justify-center web3kit-rounded-2xl web3kit-p-3"),children:[s.jsx("img",{src:e.logo,alt:e.name,className:"web3kit-size-16 web3kit-overflow-hidden web3kit-rounded-2xl"}),!r&&o?s.jsx(ge,{size:"icon",variant:"ghost",className:"web3kit-group web3kit-absolute -web3kit-bottom-2 -web3kit-right-2 web3kit-rounded-full web3kit-bg-muted web3kit-p-1.5 web3kit-shadow",onClick:()=>{n(...e.args)},children:s.jsx(Y.RotateCcw,{className:"web3kit-size-4 web3kit-transition-transform group-hover:-web3kit-rotate-45"})}):s.jsx(le,{className:"web3kit-absolute web3kit-w-full web3kit-h-full web3kit-text-primary web3kit-animate-spin"})]}),s.jsxs("div",{className:"web3kit-space-y-3.5 web3kit-px-3.5 web3kit-text-center sm:web3kit-px-0",children:[s.jsx("h1",{className:"web3kit-text-xl web3kit-font-semibold",children:o?"Request Error":"Requesting Connection"}),s.jsx("p",{className:"web3kit-text-balance web3kit-text-sm web3kit-text-muted-foreground",children:o?"There was an error with the request. Click above to try again.":`We change your account to "${e.name}".`})]})]}):null}function io(){const e=N.useRef(null),t=N.useRef(null),[n,o]=N.useState("native"),{nativeSymbol:r,nativeDecimals:i}=Be(),{chainId:a,address:c,network:l}=P(),{chains:d,wagmiConfig:b}=C(),{mutateAsync:w,isPending:f}=It(),{mutateAsync:y,isPending:x}=Tt(),{mutateAsync:v,isPending:g}=$n();async function E(q){q.preventDefault();const W=new FormData(q.target),F=W.get("type");W.get("token");const L=W.get("amount"),$=W.get("recepient");if(F==="native")await v({address:$,value:T.parseUnits(L,i)});else throw new Error("Not implemented yet")}const I=async q=>{var W;if(q.preventDefault(),e.current){let F=0n;const L=Re(a,d,b,c!=="");if(l===m.NetworkSymbols.eth){const $=21000n;if(!L||!(L instanceof T.JsonRpcProvider||L instanceof T.FallbackProvider))throw new Error("Provider not found");const Q=(await L.getFeeData()).gasPrice;if(!Q)throw new Error("Failed to get gas price");F=Q*$}else if(l===m.NetworkSymbols.sol)F=5000n;else throw new Error("Invalid network");if(n==="token"){const $=await w((W=t.current)==null?void 0:W.value);e.current.value=T.formatUnits($,i)}else{const $=await y();e.current.value=Number(T.formatUnits($<=F?0n:$-F,i)).toString()}}};return s.jsxs("form",{className:"web3kit-flex web3kit-flex-col web3kit-justify-between web3kit-items-center web3kit-gap-y-4",onSubmit:E,children:[s.jsxs(B.motion.select,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"web3kit-bg-background web3kit-rounded-md web3kit-border web3kit-border-input web3kit-text-sm web3kit-ring-offset-background web3kit-focus:web3kit-ring-ring web3kit-focus:web3kit-ring-offset-2 web3kit-disabled:web3kit-cursor-not-allowed web3kit-disabled:web3kit-opacity-50 web3kit-px-4 web3kit-py-2 web3kit-w-full",name:"type",onChange:q=>o(q.target.value),children:[s.jsx(B.motion.option,{value:"native",className:"web3kit-text-sm",children:r}),s.jsx(B.motion.option,{value:"token",className:"web3kit-text-sm",children:"Token"})]}),n==="token"&&s.jsx(B.motion.input,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"web3kit-bg-background web3kit-rounded-md web3kit-border web3kit-border-input web3kit-text-sm web3kit-ring-offset-background web3kit-focus:web3kit-ring-ring web3kit-focus:web3kit-ring-offset-2 web3kit-disabled:web3kit-cursor-not-allowed web3kit-disabled:web3kit-opacity-50 web3kit-px-4 web3kit-py-2 web3kit-w-full",name:"token",placeholder:"Token Address",ref:t}),s.jsxs("div",{className:"web3kit-relative web3kit-w-full",children:[s.jsx(B.motion.input,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"web3kit-bg-background web3kit-rounded-md web3kit-border web3kit-border-input web3kit-text-sm web3kit-ring-offset-background web3kit-focus:web3kit-ring-ring web3kit-focus:web3kit-ring-offset-2 web3kit-disabled:web3kit-cursor-not-allowed web3kit-disabled:web3kit-opacity-50 web3kit-px-4 web3kit-py-2 web3kit-w-full",name:"amount",placeholder:"Amount",ref:e}),s.jsx(B.motion.button,{className:"web3kit-absolute web3kit-right-2 web3kit-top-1/2 web3kit-text-xs web3kit-text-muted-foreground web3kit-font-medium web3kit-bg-background web3kit-rounded-md web3kit-px-2 web3kit-py-1 web3kit-translate-y-[-50%]",onClick:I,disabled:f||x,children:f||x?s.jsx(le,{className:"web3kit-size-6 web3kit-animate-spin"}):"MAX"})]}),s.jsx(B.motion.input,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},className:"web3kit-bg-background web3kit-rounded-md web3kit-border web3kit-border-input web3kit-text-sm web3kit-ring-offset-background web3kit-focus:web3kit-ring-ring web3kit-focus:web3kit-ring-offset-2 web3kit-disabled:web3kit-cursor-not-allowed web3kit-disabled:web3kit-opacity-50 web3kit-px-4 web3kit-py-2 web3kit-w-full",name:"recepient",placeholder:"Recepient Address"}),s.jsx(J,{disabled:g,logo:m.H,children:g?"Withdrawing":"Withdraw"})]})}function so(){const{pendingItem:e}=C(),{mutateAsync:t,isError:n,error:o,isPending:r}=Rt();return N.useEffect(()=>{t()},[e]),e?s.jsxs("div",{className:"web3kit-flex web3kit-w-full web3kit-flex-col web3kit-items-center web3kit-justify-center web3kit-gap-9 md:web3kit-pt-5",children:[s.jsxs("div",{className:j("web3kit-relative web3kit-size-28 web3kit-flex web3kit-items-center web3kit-justify-center web3kit-rounded-2xl web3kit-p-3"),children:[s.jsx("img",{src:e.logo,alt:e.name,className:"web3kit-size-16 web3kit-overflow-hidden web3kit-rounded-2xl"}),!r&&n?s.jsx(ge,{size:"icon",variant:"ghost",className:"web3kit-group web3kit-absolute -web3kit-bottom-2 -web3kit-right-2 web3kit-rounded-full web3kit-bg-muted web3kit-p-1.5 web3kit-shadow",onClick:()=>{t()},children:s.jsx(Y.RotateCcw,{className:"web3kit-size-4 web3kit-transition-transform group-hover:-web3kit-rotate-45"})}):s.jsx(le,{className:"web3kit-absolute web3kit-w-full web3kit-h-full web3kit-text-primary web3kit-animate-spin"})]}),s.jsxs("div",{className:"web3kit-space-y-3.5 web3kit-px-3.5 web3kit-text-center sm:web3kit-px-0",children:[s.jsx("h1",{className:"web3kit-text-xl web3kit-font-semibold",children:n||o?"Request Error":"Requesting Connection"}),s.jsx("p",{className:"web3kit-text-balance web3kit-text-sm web3kit-text-muted-foreground",children:n||o?"There was an error with the request. Click above to try again.":e.description})]})]}):null}function ao(){const{pendingItem:e}=C(),{mutateAsync:t,isError:n,error:o,isPending:r}=qn();return N.useEffect(()=>{t()},[e]),e?s.jsxs("div",{className:"web3kit-flex web3kit-w-full web3kit-flex-col web3kit-items-center web3kit-justify-center web3kit-gap-9 md:web3kit-pt-5",children:[s.jsxs("div",{className:j("web3kit-relative web3kit-size-28 web3kit-flex web3kit-items-center web3kit-justify-center web3kit-rounded-2xl web3kit-p-3"),children:[s.jsx("img",{src:e.logo,alt:e.name,className:"web3kit-size-16 web3kit-overflow-hidden web3kit-rounded-2xl"}),!r&&n?s.jsx(ge,{size:"icon",variant:"ghost",className:"web3kit-group web3kit-absolute -web3kit-bottom-2 -web3kit-right-2 web3kit-rounded-full web3kit-bg-muted web3kit-p-1.5 web3kit-shadow",onClick:()=>{t()},children:s.jsx(Y.RotateCcw,{className:"web3kit-size-4 web3kit-transition-transform group-hover:-web3kit-rotate-45"})}):s.jsx(le,{className:"web3kit-absolute web3kit-w-full web3kit-h-full web3kit-text-primary web3kit-animate-spin"})]}),s.jsxs("div",{className:"web3kit-space-y-3.5 web3kit-px-3.5 web3kit-text-center sm:web3kit-px-0",children:[s.jsx("h1",{className:"web3kit-text-xl web3kit-font-semibold",children:n||o?"Request Error":"Requesting Connection"}),s.jsx("p",{className:"web3kit-text-balance web3kit-text-sm web3kit-text-muted-foreground",children:n||o?"There was an error with the request. Click above to try again.":`We're verifying your ${e.name} account.`})]})]}):null}function co(){const{setRouter:e,setPendingItem:t}=C(),{solWallets:n}=re();return N.useEffect(()=>(n.forEach(o=>{o.on("connect",async r=>{e(()=>(t({id:o.name,logo:o.icon,network:m.NetworkSymbols.sol,chainId:Ie.isMainnet?Ie.chainSol.id:Ie.chainSolDevnet.id,address:r.toBase58()}),p.accountSigning))}),o.on("error",r=>{console.log("error",r,o.name)}),o.on("disconnect",async()=>{console.log("disconnect",o.name)})}),()=>{n.forEach(o=>{o.off("connect"),o.off("error"),o.off("disconnect")})}),[n]),N.useEffect(()=>{rt.fetchQuery({queryKey:["use-social-providers"]})},[]),s.jsx(s.Fragment,{})}const lo={[p.home]:s.jsx(Ot,{}),[p.account]:s.jsx(zt,{}),[p.accountSigning]:s.jsx(ao,{}),[p.switchChain]:s.jsx(oo,{}),[p.switchingChain]:s.jsx(Jn,{}),[p.switchAccount]:s.jsx(Qn,{}),[p.switchingAccount]:s.jsx(ro,{}),[p.selectETHWallet]:s.jsx(Ln,{}),[p.selectSolanaWallet]:s.jsx(Gn,{}),[p.walletConnecting]:s.jsx(Hn,{}),[p.socialConnecting]:s.jsx(so,{}),[p.walletqr]:s.jsx(Un,{}),[p.withdrawFunds]:s.jsx(io,{})};function uo(e){const{address:t,chainId:n}=P(),{router:o,setRouter:r,open:i,setOpen:a,pendingItem:c,setPendingItem:l}=C();return N.useEffect(()=>{a(!1),l(null),r(t?p.account:p.home)},[t,n]),N.useEffect(()=>{i||r(t?p.account:p.home)},[i]),N.useEffect(()=>{const d=new MutationObserver(b=>{b.forEach(w=>{w.type==="attributes"&&w.attributeName==="style"&&document.body.style.pointerEvents==="none"&&!i&&(console.log("pointerEvents removed"),document.body.style.pointerEvents="")})});return d.observe(document.body,{attributes:!0,attributeFilter:["style"]}),()=>{d.disconnect()}},[]),s.jsxs(s.Fragment,{children:[e.children,s.jsx(co,{}),s.jsx(Rn,{open:i,onOpenChange:a,children:s.jsxs(Pn,{children:[s.jsxs(In,{children:[s.jsx(fo,{}),s.jsx(Wn,{children:o&&o in Ve?Ve[o]:"Login"}),s.jsx(Tn,{className:"web3kit-sr-only",children:"Connect your Web3 wallet or create a new one."})]}),s.jsx(Mn,{children:lo[o]||s.jsx(s.Fragment,{children:t?s.jsx(zt,{}):s.jsx(Ot,{})})}),s.jsx(zn,{children:s.jsx(wo,{})})]})})]})}function wo(){const{address:e}=P(),{pendingItem:t}=C();return s.jsx(s.Fragment,{children:e&&!t&&s.jsx(bo,{})})}function bo(){const{mutateAsync:e,isPending:t}=Pt();return s.jsx(J,{logo:m.r,disabled:t,onClick:()=>e(),children:t?"Signing out":"Logout"})}function fo(){const{address:e}=P(),{router:t,setRouter:n,pendingItem:o,setPendingItem:r}=C();if(!t||t===p.home&&!e||t===p.account&&e)return null;function i(){if(o){r(()=>(n(e?p.account:p.home),null));return}switch(t){case p.home:case p.switchChain:case p.switchAccount:case p.walletqr:case p.withdrawFunds:n(p.account);break;default:n(p.home)}}return s.jsxs("button",{className:"web3kit-absolute web3kit-left-[26px] web3kit-top-[42px] web3kit-z-20 web3kit-rounded-sm web3kit-opacity-70 web3kit-ring-offset-background web3kit-transition-opacity hover:web3kit-opacity-100 focus:web3kit-outline-none focus:web3kit-ring-2 focus:web3kit-ring-ring focus:web3kit-ring-offset-2 disabled:web3kit-pointer-events-none data-[state=open]:web3kit-bg-accent data-[state=open]:web3kit-text-muted-foreground md:web3kit-top-[26px]",onClick:i,children:[s.jsx(Y.ChevronLeft,{className:"web3kit-h-4 web3kit-w-4"}),s.jsx("span",{className:"web3kit-sr-only",children:"Cancel connection"})]})}function mo({chains:e,host:t,name:n,description:o,icon:r,projectId:i,children:a}){return s.jsx(Ut,{chains:e||Ie.supportedChains,host:t,name:n,description:o,icon:r,projectId:i,children:s.jsx(uo,{children:a})})}exports.SimpleKitProvider=mo;exports.useAccount=P;exports.useBalance=At;exports.useBalanceAsync=Tt;exports.useChainInfo=Be;exports.useDisconnectAccount=Pt;exports.useReadContractAsync=Bn;exports.useSimpleKit=Gt;exports.useTokenBalance=_n;exports.useTokenBalanceAsync=It;exports.useWriteContractAsync=Kn;
//# sourceMappingURL=react.cjs.map
