"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("react"),ye=require("@solana/wallet-adapter-base"),ot=require("@solana/wallet-adapter-react"),he=require("@solana/wallet-adapter-wallets"),De=require("@wagmi/connectors"),K=require("@wagmi/core"),m=require("./sui-CTJDL6Rq.js"),ee=require("next-auth/react"),ae=require("lucide-react"),Dt=require("@radix-ui/react-dialog"),ne=require("vaul"),Bt=require("@radix-ui/react-scroll-area"),D=require("@tanstack/react-query"),M=require("ethers"),rt=require("viem"),ve=require("sonner"),R=require("@solana/web3.js"),Ft=require("@coral-xyz/anchor"),me=require("./serialize-0ZBTpxya.js"),Ie=require("./chains.cjs"),Fe=require("./get-user-profile-BVfAbc29.js"),H=require("framer-motion"),qt=require("qrcode.react"),$t=require("@radix-ui/react-slot");function Oe(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 q=Oe(j),te=Oe(Dt),ke=Oe(Bt),Me=Oe(Ft);var ze={exports:{}},Ae={};/**
 * @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 Ge;function Kt(){if(Ge)return Ae;Ge=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(o,i,r){var c=null;if(r!==void 0&&(c=""+r),i.key!==void 0&&(c=""+i.key),"key"in i){r={};for(var a in i)a!=="key"&&(r[a]=i[a])}else r=i;return i=r.ref,{$$typeof:e,type:o,key:c,ref:i!==void 0?i:null,props:r}}return Ae.Fragment=t,Ae.jsx=n,Ae.jsxs=n,Ae}var Re={};/**
 * @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 Ve;function Lt(){return Ve||(Ve=1,process.env.NODE_ENV!=="production"&&function(){function e(w){if(w==null)return null;if(typeof w=="function")return w.$$typeof===ce?null:w.displayName||w.name||null;if(typeof w=="string")return w;switch(w){case v:return"Fragment";case C:return"Profiler";case k:return"StrictMode";case L:return"Suspense";case Y:return"SuspenseList";case Q:return"Activity"}if(typeof w=="object")switch(typeof w.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),w.$$typeof){case x:return"Portal";case I:return(w.displayName||"Context")+".Provider";case g:return(w._context.displayName||"Context")+".Consumer";case B:var h=w.render;return w=w.displayName,w||(w=h.displayName||h.name||"",w=w!==""?"ForwardRef("+w+")":"ForwardRef"),w;case G:return h=w.displayName||null,h!==null?h:e(w.type)||"Memo";case $:h=w._payload,w=w._init;try{return e(w(h))}catch{}}return null}function t(w){return""+w}function n(w){try{t(w);var h=!1}catch{h=!0}if(h){h=console;var P=h.error,O=typeof Symbol=="function"&&Symbol.toStringTag&&w[Symbol.toStringTag]||w.constructor.name||"Object";return P.call(h,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",O),t(w)}}function o(w){if(w===v)return"<>";if(typeof w=="object"&&w!==null&&w.$$typeof===$)return"<...>";try{var h=e(w);return h?"<"+h+">":"<...>"}catch{return"<...>"}}function i(){var w=F.A;return w===null?null:w.getOwner()}function r(){return Error("react-stack-top-frame")}function c(w){if(N.call(w,"key")){var h=Object.getOwnPropertyDescriptor(w,"key").get;if(h&&h.isReactWarning)return!1}return w.key!==void 0}function a(w,h){function P(){U||(U=!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)",h))}P.isReactWarning=!0,Object.defineProperty(w,"key",{get:P,configurable:!0})}function d(){var w=e(this.type);return re[w]||(re[w]=!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.")),w=this.props.ref,w!==void 0?w:null}function l(w,h,P,O,se,V,We,J){return P=V.ref,w={$$typeof:p,type:w,key:h,props:V,_owner:se},(P!==void 0?P:null)!==null?Object.defineProperty(w,"ref",{enumerable:!1,get:d}):Object.defineProperty(w,"ref",{enumerable:!1,value:null}),w._store={},Object.defineProperty(w._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(w,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(w,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:We}),Object.defineProperty(w,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:J}),Object.freeze&&(Object.freeze(w.props),Object.freeze(w)),w}function u(w,h,P,O,se,V,We,J){var _=h.children;if(_!==void 0)if(O)if(X(_)){for(O=0;O<_.length;O++)b(_[O]);Object.freeze&&Object.freeze(_)}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 b(_);if(N.call(h,"key")){_=e(w);var pe=Object.keys(h).filter(function(_t){return _t!=="key"});O=0<pe.length?"{key: someKey, "+pe.join(": ..., ")+": ...}":"{key: someKey}",ie[_+O]||(pe=0<pe.length?"{"+pe.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} />`,O,_,pe,_),ie[_+O]=!0)}if(_=null,P!==void 0&&(n(P),_=""+P),c(h)&&(n(h.key),_=""+h.key),"key"in h){P={};for(var _e in h)_e!=="key"&&(P[_e]=h[_e])}else P=h;return _&&a(P,typeof w=="function"?w.displayName||w.name||"Unknown":w),l(w,_,V,se,i(),P,We,J)}function b(w){typeof w=="object"&&w!==null&&w.$$typeof===p&&w._store&&(w._store.validated=1)}var f=j,p=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),v=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),g=Symbol.for("react.consumer"),I=Symbol.for("react.context"),B=Symbol.for("react.forward_ref"),L=Symbol.for("react.suspense"),Y=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),$=Symbol.for("react.lazy"),Q=Symbol.for("react.activity"),ce=Symbol.for("react.client.reference"),F=f.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,N=Object.prototype.hasOwnProperty,X=Array.isArray,z=console.createTask?console.createTask:function(){return null};f={"react-stack-bottom-frame":function(w){return w()}};var U,re={},we=f["react-stack-bottom-frame"].bind(f,r)(),Z=z(o(r)),ie={};Re.Fragment=v,Re.jsx=function(w,h,P,O,se){var V=1e4>F.recentlyCreatedOwnerStacks++;return u(w,h,P,!1,O,se,V?Error("react-stack-top-frame"):we,V?z(o(w)):Z)},Re.jsxs=function(w,h,P,O,se){var V=1e4>F.recentlyCreatedOwnerStacks++;return u(w,h,P,!0,O,se,V?Error("react-stack-top-frame"):we,V?z(o(w)):Z)}}()),Re}var Je;function Ut(){return Je||(Je=1,process.env.NODE_ENV==="production"?ze.exports=Kt():ze.exports=Lt()),ze.exports}var s=Ut();const He={home:"Connect",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"},y={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",withdrawingFunds:"withdrawingFunds"},$e=j.createContext({chains:[],wagmiConfig:null,signMessage:"based.bid welcomes you!!!",pendingItem:null,setPendingItem:()=>{},open:!1,setOpen:()=>{},router:y.home,setRouter:()=>{}}),E=()=>j.useContext($e),Gt=()=>{const{open:e,setOpen:t,...n}=j.useContext($e);return{isOpen:e,openModal:()=>{t(!0)},closeModal:()=>{t(!1)},...n}},Vt=({children:e,chains:t,signMessage:n,metadata:o,projectId:i})=>{const{data:r}=ee.useSession(),[c,a]=j.useState(!1),[d,l]=j.useState(null),[u,b]=j.useState(null),f=j.useRef(null),p=j.useRef(null);f.current||(f.current=De.walletConnect({projectId:i,metadata:o})),p.current||(p.current=new he.WalletConnectWalletAdapter({network:ye.WalletAdapterNetwork.Mainnet,options:{projectId:i,metadata:o}}));const x=j.useMemo(()=>{const k=t.filter(g=>g.network.symbol===m.NetworkSymbols.eth),C=!(typeof window>"u")&&(window==null?void 0:window.parent)!==window;return K.createConfig({chains:k,connectors:[K.injected({target:"metaMask"}),f.current,De.coinbaseWallet({appName:o.name,appLogoUrl:o.icons[0],overrideIsMetaMask:!1,preference:"all"}),...C?[De.safe({allowedDomains:[/gnosis-safe.io$/,/app.safe.global$/]})]:[]],storage:K.createStorage({storage:K.cookieStorage}),transports:Object.fromEntries(k.map(g=>[g.id,K.http()]))})},[t]),v=j.useMemo(()=>[new he.CoinbaseWalletAdapter,new he.PhantomWalletAdapter,new he.SafePalWalletAdapter,new he.SolflareWalletAdapter,new he.TrustWalletAdapter,p.current],[]);return s.jsx($e.Provider,{value:{chains:t,wagmiConfig:x,signMessage:n,open:c,setOpen:a,router:d,setRouter:l,pendingItem:u,setPendingItem:b},children:s.jsx(ot.WalletProvider,{wallets:v,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 i=e.length;for(t=0;t<i;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="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=it(e))&&(o&&(o+=" "),o+=t);return o}const Ke="-",Jt=e=>{const t=Yt(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:c=>{const a=c.split(Ke);return a[0]===""&&a.length!==1&&a.shift(),at(a,t)||Ht(c)},getConflictingClassGroupIds:(c,a)=>{const d=n[c]||[];return a&&o[c]?[...d,...o[c]]:d}}},at=(e,t)=>{var c;if(e.length===0)return t.classGroupId;const n=e[0],o=t.nextPart.get(n),i=o?at(e.slice(1),o):void 0;if(i)return i;if(t.validators.length===0)return;const r=e.join(Ke);return(c=t.validators.find(({validator:a})=>a(r)))==null?void 0:c.classGroupId},Ye=/^\[(.+)\]$/,Ht=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}},Yt=e=>{const{theme:t,prefix:n}=e,o={nextPart:new Map,validators:[]};return Xt(Object.entries(e.classGroups),n).forEach(([r,c])=>{qe(c,o,r,t)}),o},qe=(e,t,n,o)=>{e.forEach(i=>{if(typeof i=="string"){const r=i===""?t:Qe(t,i);r.classGroupId=n;return}if(typeof i=="function"){if(Qt(i)){qe(i(o),t,n,o);return}t.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([r,c])=>{qe(c,Qe(t,r),n,o)})})},Qe=(e,t)=>{let n=e;return t.split(Ke).forEach(o=>{n.nextPart.has(o)||n.nextPart.set(o,{nextPart:new Map,validators:[]}),n=n.nextPart.get(o)}),n},Qt=e=>e.isThemeGetter,Xt=(e,t)=>t?e.map(([n,o])=>{const i=o.map(r=>typeof r=="string"?t+r:typeof r=="object"?Object.fromEntries(Object.entries(r).map(([c,a])=>[t+c,a])):r);return[n,i]}):e,Zt=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,o=new Map;const i=(r,c)=>{n.set(r,c),t++,t>e&&(t=0,o=n,n=new Map)};return{get(r){let c=n.get(r);if(c!==void 0)return c;if((c=o.get(r))!==void 0)return i(r,c),c},set(r,c){n.has(r)?n.set(r,c):i(r,c)}}},ct="!",en=e=>{const{separator:t,experimentalParseClassName:n}=e,o=t.length===1,i=t[0],r=t.length,c=a=>{const d=[];let l=0,u=0,b;for(let k=0;k<a.length;k++){let C=a[k];if(l===0){if(C===i&&(o||a.slice(k,k+r)===t)){d.push(a.slice(u,k)),u=k+r;continue}if(C==="/"){b=k;continue}}C==="["?l++:C==="]"&&l--}const f=d.length===0?a:a.substring(u),p=f.startsWith(ct),x=p?f.substring(1):f,v=b&&b>u?b-u:void 0;return{modifiers:d,hasImportantModifier:p,baseClassName:x,maybePostfixModifierPosition:v}};return n?a=>n({className:a,parseClassName:c}):c},tn=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},nn=e=>({cache:Zt(e.cacheSize),parseClassName:en(e),...Jt(e)}),on=/\s+/,rn=(e,t)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:i}=t,r=[],c=e.trim().split(on);let a="";for(let d=c.length-1;d>=0;d-=1){const l=c[d],{modifiers:u,hasImportantModifier:b,baseClassName:f,maybePostfixModifierPosition:p}=n(l);let x=!!p,v=o(x?f.substring(0,p):f);if(!v){if(!x){a=l+(a.length>0?" "+a:a);continue}if(v=o(f),!v){a=l+(a.length>0?" "+a:a);continue}x=!1}const k=tn(u).join(":"),C=b?k+ct:k,g=C+v;if(r.includes(g))continue;r.push(g);const I=i(v,x);for(let B=0;B<I.length;++B){const L=I[B];r.push(C+L)}a=l+(a.length>0?" "+a:a)}return a};function sn(){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 an(e,...t){let n,o,i,r=c;function c(d){const l=t.reduce((u,b)=>b(u),e());return n=nn(l),o=n.cache.get,i=n.cache.set,r=a,a(d)}function a(d){const l=o(d);if(l)return l;const u=rn(d,n);return i(d,u),u}return function(){return r(sn.apply(null,arguments))}}const W=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},dt=/^\[(?:([a-z-]+):)?(.+)\]$/i,cn=/^\d+\/\d+$/,ln=new Set(["px","full","screen"]),dn=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,un=/\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$/,wn=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,bn=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,fn=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,le=e=>xe(e)||ln.has(e)||cn.test(e),be=e=>Ce(e,"length",vn),xe=e=>!!e&&!Number.isNaN(Number(e)),Be=e=>Ce(e,"number",xe),Pe=e=>!!e&&Number.isInteger(Number(e)),mn=e=>e.endsWith("%")&&xe(e.slice(0,-1)),S=e=>dt.test(e),fe=e=>dn.test(e),kn=new Set(["length","size","percentage"]),gn=e=>Ce(e,kn,ut),pn=e=>Ce(e,"position",ut),hn=new Set(["image","url"]),yn=e=>Ce(e,hn,Sn),xn=e=>Ce(e,"",Cn),Te=()=>!0,Ce=(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},vn=e=>un.test(e)&&!wn.test(e),ut=()=>!1,Cn=e=>bn.test(e),Sn=e=>fn.test(e),jn=()=>{const e=W("colors"),t=W("spacing"),n=W("blur"),o=W("brightness"),i=W("borderColor"),r=W("borderRadius"),c=W("borderSpacing"),a=W("borderWidth"),d=W("contrast"),l=W("grayscale"),u=W("hueRotate"),b=W("invert"),f=W("gap"),p=W("gradientColorStops"),x=W("gradientColorStopPositions"),v=W("inset"),k=W("margin"),C=W("opacity"),g=W("padding"),I=W("saturate"),B=W("scale"),L=W("sepia"),Y=W("skew"),G=W("space"),$=W("translate"),Q=()=>["auto","contain","none"],ce=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto",S,t],N=()=>[S,t],X=()=>["",le,be],z=()=>["auto",xe,S],U=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],re=()=>["solid","dashed","dotted","double","none"],we=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>["start","end","center","between","around","evenly","stretch"],ie=()=>["","0",S],w=()=>["auto","avoid","all","avoid-page","page","left","right","column"],h=()=>[xe,S];return{cacheSize:500,separator:":",theme:{colors:[Te],spacing:[le,be],blur:["none","",fe,S],brightness:h(),borderColor:[e],borderRadius:["none","","full",fe,S],borderSpacing:N(),borderWidth:X(),contrast:h(),grayscale:ie(),hueRotate:h(),invert:ie(),gap:N(),gradientColorStops:[e],gradientColorStopPositions:[mn,be],inset:F(),margin:F(),opacity:h(),padding:N(),saturate:h(),scale:h(),sepia:ie(),skew:h(),space:N(),translate:N()},classGroups:{aspect:[{aspect:["auto","square","video",S]}],container:["container"],columns:[{columns:[fe]}],"break-after":[{"break-after":w()}],"break-before":[{"break-before":w()}],"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:[...U(),S]}],overflow:[{overflow:ce()}],"overflow-x":[{"overflow-x":ce()}],"overflow-y":[{"overflow-y":ce()}],overscroll:[{overscroll:Q()}],"overscroll-x":[{"overscroll-x":Q()}],"overscroll-y":[{"overscroll-y":Q()}],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",Pe,S]}],basis:[{basis:F()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",S]}],grow:[{grow:ie()}],shrink:[{shrink:ie()}],order:[{order:["first","last","none",Pe,S]}],"grid-cols":[{"grid-cols":[Te]}],"col-start-end":[{col:["auto",{span:["full",Pe,S]},S]}],"col-start":[{"col-start":z()}],"col-end":[{"col-end":z()}],"grid-rows":[{"grid-rows":[Te]}],"row-start-end":[{row:["auto",{span:[Pe,S]},S]}],"row-start":[{"row-start":z()}],"row-end":[{"row-end":z()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",S]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",S]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...Z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[g]}],px:[{px:[g]}],py:[{py:[g]}],ps:[{ps:[g]}],pe:[{pe:[g]}],pt:[{pt:[g]}],pr:[{pr:[g]}],pb:[{pb:[g]}],pl:[{pl:[g]}],m:[{m:[k]}],mx:[{mx:[k]}],my:[{my:[k]}],ms:[{ms:[k]}],me:[{me:[k]}],mt:[{mt:[k]}],mr:[{mr:[k]}],mb:[{mb:[k]}],ml:[{ml:[k]}],"space-x":[{"space-x":[G]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[G]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",S,t]}],"min-w":[{"min-w":[S,t,"min","max","fit"]}],"max-w":[{"max-w":[S,t,"none","full","min","max","fit","prose",{screen:[fe]},fe]}],h:[{h:[S,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[S,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[S,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[S,t,"auto","min","max","fit"]}],"font-size":[{text:["base",fe,be]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Be]}],"font-family":[{font:[Te]}],"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",S]}],"line-clamp":[{"line-clamp":["none",xe,Be]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",le,S]}],"list-image":[{"list-image":["none",S]}],"list-style-type":[{list:["none","disc","decimal",S]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[C]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[C]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",le,be]}],"underline-offset":[{"underline-offset":["auto",le,S]}],"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:N()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",S]}],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",S]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[C]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...U(),pn]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",gn]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},yn]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[r]}],"rounded-s":[{"rounded-s":[r]}],"rounded-e":[{"rounded-e":[r]}],"rounded-t":[{"rounded-t":[r]}],"rounded-r":[{"rounded-r":[r]}],"rounded-b":[{"rounded-b":[r]}],"rounded-l":[{"rounded-l":[r]}],"rounded-ss":[{"rounded-ss":[r]}],"rounded-se":[{"rounded-se":[r]}],"rounded-ee":[{"rounded-ee":[r]}],"rounded-es":[{"rounded-es":[r]}],"rounded-tl":[{"rounded-tl":[r]}],"rounded-tr":[{"rounded-tr":[r]}],"rounded-br":[{"rounded-br":[r]}],"rounded-bl":[{"rounded-bl":[r]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[C]}],"border-style":[{border:[...re(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[C]}],"divide-style":[{divide:re()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...re()]}],"outline-offset":[{"outline-offset":[le,S]}],"outline-w":[{outline:[le,be]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:X()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[C]}],"ring-offset-w":[{"ring-offset":[le,be]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",fe,xn]}],"shadow-color":[{shadow:[Te]}],opacity:[{opacity:[C]}],"mix-blend":[{"mix-blend":[...we(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":we()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[o]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",fe,S]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[b]}],saturate:[{saturate:[I]}],sepia:[{sepia:[L]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[b]}],"backdrop-opacity":[{"backdrop-opacity":[C]}],"backdrop-saturate":[{"backdrop-saturate":[I]}],"backdrop-sepia":[{"backdrop-sepia":[L]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[c]}],"border-spacing-x":[{"border-spacing-x":[c]}],"border-spacing-y":[{"border-spacing-y":[c]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",S]}],duration:[{duration:h()}],ease:[{ease:["linear","in","out","in-out",S]}],delay:[{delay:h()}],animate:[{animate:["none","spin","ping","pulse","bounce",S]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[B]}],"scale-x":[{"scale-x":[B]}],"scale-y":[{"scale-y":[B]}],rotate:[{rotate:[Pe,S]}],"translate-x":[{"translate-x":[$]}],"translate-y":[{"translate-y":[$]}],"skew-x":[{"skew-x":[Y]}],"skew-y":[{"skew-y":[Y]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",S]}],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",S]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":N()}],"scroll-mx":[{"scroll-mx":N()}],"scroll-my":[{"scroll-my":N()}],"scroll-ms":[{"scroll-ms":N()}],"scroll-me":[{"scroll-me":N()}],"scroll-mt":[{"scroll-mt":N()}],"scroll-mr":[{"scroll-mr":N()}],"scroll-mb":[{"scroll-mb":N()}],"scroll-ml":[{"scroll-ml":N()}],"scroll-p":[{"scroll-p":N()}],"scroll-px":[{"scroll-px":N()}],"scroll-py":[{"scroll-py":N()}],"scroll-ps":[{"scroll-ps":N()}],"scroll-pe":[{"scroll-pe":N()}],"scroll-pt":[{"scroll-pt":N()}],"scroll-pr":[{"scroll-pr":N()}],"scroll-pb":[{"scroll-pb":N()}],"scroll-pl":[{"scroll-pl":N()}],"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",S]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[le,be,Be]}],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=an(jn);function A(...e){return Nn(st(e))}const En=te.Root,An=te.Portal,wt=q.forwardRef(({className:e,...t},n)=>s.jsx(te.Overlay,{ref:n,className:A("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=te.Overlay.displayName;const bt=q.forwardRef(({className:e,children:t,...n},o)=>s.jsxs(An,{children:[s.jsx(wt,{className:"DialogContent"}),s.jsxs(te.Content,{ref:o,className:A("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(te.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(ae.X,{className:"web3kit-h-4 web3kit-w-4"}),s.jsx("span",{className:"web3kit-sr-only",children:"Close"})]})]})]}));bt.displayName=te.Content.displayName;const ft=q.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:A("web3kit-flex web3kit-flex-col web3kit-space-y-1.5 web3kit-text-center sm:web3kit-text-left",e),...t}));ft.displayName="DialogHeader";const mt=q.forwardRef(({className:e,...t},n)=>s.jsx("div",{ref:n,className:A("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=q.forwardRef(({className:e,...t},n)=>s.jsx(te.Title,{ref:n,className:A("web3kit-text-lg web3kit-font-semibold web3kit-leading-none web3kit-tracking-tight",e),...t}));kt.displayName=te.Title.displayName;const gt=q.forwardRef(({className:e,...t},n)=>s.jsx(te.Description,{ref:n,className:A("web3kit-text-sm web3kit-text-muted-foreground",e),...t}));gt.displayName=te.Description.displayName;const pt=({shouldScaleBackground:e=!0,...t})=>s.jsx(ne.Drawer.Root,{shouldScaleBackground:e,...t});pt.displayName="Drawer";ne.Drawer.Trigger;const Rn=ne.Drawer.Portal;ne.Drawer.Close;const ht=q.forwardRef(({className:e,...t},n)=>s.jsx(ne.Drawer.Overlay,{ref:n,className:A("web3kit-fixed web3kit-inset-0 web3kit-z-20 web3kit-bg-black/80",e),...t}));var et;ht.displayName=((et=ne.Drawer.Overlay)==null?void 0:et.displayName)||"DrawerOverlay";const yt=q.forwardRef(({className:e,children:t,...n},o)=>s.jsxs(Rn,{children:[s.jsx(ht,{}),s.jsxs(ne.Drawer.Content,{ref:o,className:A("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]})]}));yt.displayName="DrawerContent";const xt=({className:e,...t})=>s.jsx("div",{className:A("web3kit-grid web3kit-gap-1.5 web3kit-p-4 web3kit-text-center sm:web3kit-text-left",e),...t});xt.displayName="DrawerHeader";const vt=({className:e,...t})=>s.jsx("div",{className:A("web3kit-mt-auto web3kit-flex web3kit-flex-col web3kit-gap-2 web3kit-p-4",e),...t});vt.displayName="DrawerFooter";const Ct=q.forwardRef(({className:e,...t},n)=>s.jsx(ne.Drawer.Title,{ref:n,className:A("web3kit-text-lg web3kit-font-semibold web3kit-leading-none web3kit-tracking-tight",e),...t}));var tt;Ct.displayName=((tt=ne.Drawer.Title)==null?void 0:tt.displayName)||"DrawerTitle";const St=q.forwardRef(({className:e,...t},n)=>s.jsx(ne.Drawer.Description,{ref:n,className:A("web3kit-text-sm web3kit-text-muted-foreground",e),...t}));var nt;St.displayName=((nt=ne.Drawer.Description)==null?void 0:nt.displayName)||"DrawerDescription";const jt=q.forwardRef(({className:e,children:t,...n},o)=>s.jsxs(ke.Root,{ref:o,className:A("web3kit-relative web3kit-overflow-hidden",e),...n,children:[s.jsx(ke.Viewport,{className:"web3kit-h-full web3kit-w-full web3kit-rounded-[inherit]",children:t}),s.jsx(Nt,{}),s.jsx(ke.Corner,{})]}));jt.displayName=ke.Root.displayName;const Nt=q.forwardRef(({className:e,orientation:t="vertical",...n},o)=>s.jsx(ke.ScrollAreaScrollbar,{ref:o,orientation:t,className:A("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(ke.ScrollAreaThumb,{className:"web3kit-relative web3kit-flex-1 web3kit-rounded-full web3kit-bg-border"})}));Nt.displayName=ke.ScrollAreaScrollbar.displayName;const Se="(min-width: 768px)",Pn=({className:e,children:t,...n})=>{const i=je(Se)?En:pt;return s.jsx(i,{...n,className:A("web3kit-transition-transform web3kit-duration-300",e),children:t})},Tn=({className:e,children:t,...n})=>{const i=je(Se)?bt:yt;return s.jsx(i,{className:A("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 web3kit-z-[60]",e),onOpenAutoFocus:r=>r.preventDefault(),...n,children:t})},In=({className:e,children:t,...n})=>{const i=je(Se)?gt:St;return s.jsx(i,{className:e,...n,children:t})},Wn=({className:e,children:t,...n})=>{const i=je(Se)?ft:xt;return s.jsx(i,{className:A("web3kit-space-y-0 web3kit-pb-6 md:web3kit-pb-3",e),...n,children:t})},zn=({className:e,children:t,...n})=>{const i=je(Se)?kt:Ct;return s.jsx(i,{className:A("web3kit-text-center web3kit-py-2",e),...n,children:t})},Mn=({className:e,children:t,...n})=>s.jsx(jt,{className:A("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})}),On=({className:e,children:t,...n})=>{const i=je(Se)?mt:vt;return s.jsx(i,{className:A("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 je(e){const[t,n]=q.useState(!1);return q.useEffect(()=>{const o=matchMedia(e);n(o.matches);const i=r=>n(r.matches);return o.addEventListener("change",i),()=>o.removeEventListener("change",i)},[e]),t}function _n(e){var i,r;const{chain:t,transport:n}=e,o={chainId:t.id,name:t.name,ensAddress:(r=(i=t.contracts)==null?void 0:i.ensRegistry)==null?void 0:r.address};if(n.type==="fallback"){const c=n.transports.map(({value:a})=>new M.JsonRpcProvider(a==null?void 0:a.url,o));return c.length===1?c[0]:new M.FallbackProvider(c)}return new M.JsonRpcProvider(n.url,o)}function Et(e,{chainId:t}={}){const n=K.getClient(e,{chainId:t});if(n)return _n(n)}const Dn=1232,Bn=27;function Fn(e){const t=e.serializeMessage();return 1+(e.signatures.length||1)*64+t.length}function T(){const{chains:e}=E(),{data:t,update:n}=ee.useSession(),{chainId:o=0,network:i="",address:r="",social:c="",name:a="",image:d="",role:l="",provider:u="",users:b=[]}=(t==null?void 0:t.user)||{},f=e.find(p=>p.id===o);return{address:r,chainId:o,social:c,image:d,name:a,role:l,network:i,provider:u,users:b,chain:f,switchChain:async p=>{await n({id:"switchChain",chainId:p})},switchAccount:async(p,x)=>{await n({id:"switchAccount",network:p,address:x})}}}function Le(){var o,i,r,c,a;const{chainId:e}=T(),{chains:t}=E(),n=t.find(d=>d.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:((i=n==null?void 0:n.nativeCurrency)==null?void 0:i.symbol)||"",nativeDecimals:((r=n==null?void 0:n.nativeCurrency)==null?void 0:r.decimals)||18,txExplorer:((c=n==null?void 0:n.blockExplorers)==null?void 0:c.default.hash)||"",addressExplorer:((a=n==null?void 0:n.blockExplorers)==null?void 0:a.default.address)||""}}function Ue(){return D.useQuery({queryKey:["use-social-providers"],queryFn:async()=>{const e=await ee.getProviders();return Object.values(e||{}).filter(t=>t.id!=="credentials")}})}function oe(){const{wagmiConfig:e}=E(),{data:t,...n}=D.useQuery({queryKey:["use-eth-wallets"],queryFn:async()=>{const o={metaMask:m.b,walletConnect:m.m,coinbaseWalletSDK:m.j};return(await K.getConnectors(e)).map(r=>(r.isInstalled=r.type==="mock"||r.type==="injected"&&r.id!=="metaMask"||r.id==="coinbaseWalletSDK",r.icon=o[r.id]||r.icon,r)).filter((r,c,a)=>a.findIndex(d=>d.id===r.id)===c).map(r=>r.id==="walletConnect"?{...r,name:"WalletConnect"}:r).filter((r,c,a)=>!(r.id==="coinbaseWalletSDK"&&a.find(d=>d.id==="com.coinbase.wallet"))).filter((r,c,a)=>!((r.id==="metaMaskSDK"||r.id==="metaMask")&&a.find(d=>d.id==="io.metamask"||d.id==="io.metamask.mobile"))).sort((r,c)=>{const a=r.isInstalled&&r.type==="injected",d=c.isInstalled&&c.type==="injected";return a&&!d?-1:!a&&d?1:0}).sort((r,c)=>r.id==="walletConnect"?1:c.id==="walletConnect"?-1:0)}});return{...n,data:t||[]}}function de(){const{wallet:e,publicKey:t,wallets:n,connect:o,disconnect:i,select:r,signMessage:c,signTransaction:a,signAllTransactions:d}=ot.useWallet();return{wallet:e,publicKey:t,solConnect:o,solDisconnect:i,solSelect:r,solSignMessage:c,solSignTransaction:a,solSignAllTransactions:d,solWallets:n.filter(l=>l.readyState===ye.WalletReadyState.Installed||l.readyState===ye.WalletReadyState.Loadable).sort((l,u)=>u.readyState===ye.WalletReadyState.Installed?1:-1).map(l=>l.adapter)}}function Ne(e,t,n,o){const i=t.find(c=>c.id===e);if(!i)throw new Error("Chain not found");let r;switch(i.network.symbol){case m.NetworkSymbols.eth:r=o?Et(n,{chainId:e}):new M.JsonRpcProvider(i.rpcUrls.default.http[0]);break;case m.NetworkSymbols.sol:r=new R.Connection(R.clusterApiUrl(e===Ie.chainSol.id?ye.WalletAdapterNetwork.Mainnet:ye.WalletAdapterNetwork.Devnet),"finalized");break}return r}function At({address:e,chainId:t}={}){const{chainId:n,address:o}=T(),{chains:i,wagmiConfig:r}=E(),c=t||n,a=i.find(b=>b.id===c),d=e||o,{data:l=0n,...u}=D.useQuery({queryKey:["use-account-balance",{chainId:c,address:d}],queryFn:async function(){if(!d)return 0n;if(!a)throw new Error("Chain not found");const b=Ne(c,i,r,d!=="");switch(a.network.symbol){case m.NetworkSymbols.eth:return b instanceof M.JsonRpcProvider||b instanceof M.FallbackProvider?await b.getBalance(d):0n;case m.NetworkSymbols.sol:if(b instanceof R.Connection){const f=await b.getBalance(new R.PublicKey(d));return BigInt(f)}return 0n;default:return 0n}}});return{...u,data:l}}function qn({address:e,tokenAddress:t,chainId:n}){const{chainId:o,address:i}=T(),{chains:r,wagmiConfig:c}=E(),a=n||o,d=r.find(f=>f.id===a),l=e||i,{data:u=0n,...b}=D.useQuery({queryKey:["use-token-balance",{chainId:a,address:l,tokenAddress:t}],queryFn:async function(){if(!l)return 0n;if(!d)throw new Error("Chain not found");const f=Ne(a,r,c,l!=="");switch(d.network.symbol){case m.NetworkSymbols.eth:return f instanceof M.JsonRpcProvider||f instanceof M.FallbackProvider?t===Fe.constValues[m.NetworkSymbols.eth].zeroAddress?await f.getBalance(l):await new M.Contract(t,rt.erc20Abi,f).balanceOf(l):0n;case m.NetworkSymbols.sol:if(f instanceof R.Connection){if(t===Fe.constValues[m.NetworkSymbols.sol].zeroAddress){const v=await f.getBalance(new R.PublicKey(l));return BigInt(v)}const p=await f.getTokenAccountsByOwner(new R.PublicKey(l),{mint:new R.PublicKey(t)});if(p.value.length===0)return 0n;const x=await f.getTokenAccountBalance(p.value[0].pubkey);return BigInt(x.value.amount)}return 0n;default:return 0n}}});return{...b,data:u}}function Rt(){const{chains:e,pendingItem:t,wagmiConfig:n,setOpen:o,setRouter:i,setPendingItem:r}=E(),{solWallets:c}=de(),{data:a}=oe(),{data:d}=Ue();return D.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(p=>p.id===t.id);if(!l)throw new Error(`Wallet ${t.id} not found`);const[u,b]=await Promise.all([l.getChainId(),l.getAccounts()]);let f=e.find(p=>p.id===u);if(f||(f=e.find(x=>x.network.symbol===m.NetworkSymbols.eth)),!f)throw new Error("There is no chain you can connect to");b.length===0?await K.connect(n,{chainId:f.id,connector:l}):o(()=>(i(()=>(r({id:l.id,name:l.name,logo:l.icon,network:m.NetworkSymbols.eth,chainId:f==null?void 0:f.id,address:b[0]}),y.accountSigning)),!0))}else if(t.network===m.NetworkSymbols.sol){const l=c.find(u=>u.name===t.id);if(!l)throw new Error(`Wallet ${t.id} not found`);l.connected&&await l.disconnect(),await l.connect()}else{const l=d.find(u=>u.id===t.id);if(!l)throw new Error(`Provider ${t.id} not found`);await ee.signIn(l.id,{},{state:JSON.stringify({chainId:t.chainId})}),ve.toast.success("Redirecting to oauth provider")}},onSuccess:()=>{},onError:l=>{throw console.log("connect error",l),l}})}function $n(){var d;const{address:e,social:t,chain:n,network:o,provider:i,switchChain:r}=T(),{wagmiConfig:c}=E(),{data:a}=oe();return D.useMutation({mutationKey:["use-switch-chain",{social:t,network:(d=n==null?void 0:n.network)==null?void 0:d.symbol}],mutationFn:async l=>{if(e){if(!t)if(o===m.NetworkSymbols.eth){const u=a.find(b=>b.id===i);if(!u)throw new Error(`Wallet ${i} not found`);await K.switchChain(c,{connector:u,chainId:l})}else throw o===m.NetworkSymbols.sol?new Error("Solana wallet does not support chain switching"):new Error("Unknown network");await r(l)}},onSuccess:()=>{ve.toast.success("Switched to chain")},onError:l=>{throw console.log("switch chain error",l),l}})}function Kn(){const{pendingItem:e,wagmiConfig:t,signMessage:n}=E(),{solWallets:o}=de(),{data:i}=oe();return D.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 r;if(e.network===m.NetworkSymbols.eth){const c=i.find(a=>a.id===e.id);if(!c)throw new Error(`Wallet ${e.id} not found`);r=await K.signMessage(t,{connector:c,message:n})}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 a=await c.signMessage(Buffer.from(n));r=Buffer.from(a).toString("base64")}else throw new Error("Unknown network");await ee.signIn("credentials",{redirect:!1,signature:r,provider:e.id,chainId:e.chainId,address:e.address,message:n})},onSuccess:()=>{ve.toast.success("Signed in")},onError:async r=>{throw console.log("sign account error",r),await ee.signOut({redirect:!1}),r}})}function Ln(){const{pendingItem:e,setRouter:t,setPendingItem:n}=E(),{users:o}=T(),{solWallets:i}=de(),{data:r}=oe();return D.useMutation({mutationKey:["use-sign-account",{id:e==null?void 0:e.id,network:e==null?void 0:e.network}],mutationFn:async({network:c,address:a})=>{if(!e)return;const d=o.find(l=>l.network===c&&l.address===a);if(!d)throw new Error("User not found");if(d.social)t(()=>(n({id:d.provider,logo:d.image,network:"",description:`We connect your "${d.name}" account to our platform.`}),y.socialConnecting));else if(d.network===m.NetworkSymbols.eth){const l=r.find(u=>u.id===d.provider);if(!l)throw new Error(`Wallet ${d.provider} not found`);t(()=>(n({id:l.id,logo:l.icon,network:m.NetworkSymbols.eth,description:`Open the ${l.name} browser extension to connect your wallet.`}),y.walletConnecting))}else{const l=i.find(u=>u.name===d.provider);if(!l)throw new Error(`Wallet ${d.provider} not found`);t(()=>(n({id:l.name,logo:l.icon,network:m.NetworkSymbols.sol,description:`Open the ${l.name} browser extension to connect your wallet.`}),y.walletConnecting))}},onSuccess:()=>{},onError:c=>{throw console.log("switch account error",c),c}})}function Pt(){const{wagmiConfig:e}=E(),{data:t}=oe(),{solWallets:n,solDisconnect:o}=de(),{provider:i,social:r,address:c,network:a}=T();return D.useMutation({mutationKey:["use-disconnect-account",{social:r,address:c,network:a}],mutationFn:async()=>{if(!r)if(a===m.NetworkSymbols.eth){const d=t.find(l=>l.id===i);if(!d)throw new Error(`Wallet ${i} not found`);await K.disconnect(e,{connector:d})}else if(a===m.NetworkSymbols.sol){if(!n.find(l=>l.name===i))throw new Error(`Wallet ${i} not found`);await o()}else throw new Error("Unknown network");await ee.signOut({redirect:!1})},onSuccess:()=>{ve.toast.success("Signed out")},onError:d=>{throw console.log("disconnect account error",d),d}})}function Tt({address:e,chainId:t}={}){const{chainId:n,address:o}=T(),{chains:i,wagmiConfig:r}=E(),c=t||n,a=i.find(u=>u.id===c);if(!a)throw new Error("Chain not found");const d=a.network.symbol,l=e||o;return D.useMutation({mutationKey:["use-balance-async",{chainId:c,address:l}],mutationFn:async function(){let u=0n;const b=Ne(c,i,r,l!=="");switch(d){case m.NetworkSymbols.eth:(b instanceof M.JsonRpcProvider||b instanceof M.FallbackProvider)&&(u=await b.getBalance(l));break;case m.NetworkSymbols.sol:if(b instanceof R.Connection){const f=await b.getBalance(new R.PublicKey(l));u=BigInt(f)}break}return u},onError:u=>{console.log(u)}})}function It({address:e,chainId:t}={}){const{chainId:n,address:o}=T(),{chains:i,wagmiConfig:r}=E(),c=t||n,a=i.find(l=>l.id===c);if(!a)throw new Error("Chain not found");const d=e||o;return D.useMutation({mutationKey:["use-token-balance-async",{chainId:c,address:d}],mutationFn:async function(l){if(!d)return 0n;if(!a)throw new Error("Chain not found");const u=Ne(c,i,r,d!=="");switch(a.network.symbol){case m.NetworkSymbols.eth:return u instanceof M.JsonRpcProvider||u instanceof M.FallbackProvider?await new M.Contract(l,rt.erc20Abi,u).balanceOf(d):0n;case m.NetworkSymbols.sol:if(u instanceof R.Connection){const b=await u.getTokenAccountsByOwner(new R.PublicKey(d),{mint:new R.PublicKey(l)});if(b.value.length===0)return 0n;const f=await u.getTokenAccountBalance(b.value[0].pubkey);return BigInt(f.value.amount)}return 0n;default:return 0n}},onError:l=>{console.log(l)}})}function Un(){const{chainId:e,social:t}=T(),{chains:n}=E();return D.useMutation({mutationKey:["use-send-transaction-async",{chainId:e,social:t}],mutationFn:async({address:o,value:i})=>{const r=n.find(a=>a.id===e);if(!r)throw new Error("Chain not found");const c=r.network.symbol;if(t){const a=me.serialize(c,{address:o,value:i}),d=await fetch("/api/based-auth/transfer",{method:"POST",body:JSON.stringify(a)});if(!d.ok){const l=await d.json();throw new Error(l.message)}return d.json()}else throw new Error("This feature is not available for only social wallets")},onError:o=>{throw ve.toast.error(o.message),o},onSuccess:()=>{ve.toast.success("Balance transferred")}})}function Gn({chainId:e}={}){const{chainId:t,address:n,social:o,provider:i}=T(),{chains:r,wagmiConfig:c}=E(),{data:a}=oe(),{solWallets:d}=de(),l=e||t;return D.useMutation({mutationKey:["use-sign-message-async",{chainId:l,address:n,social:o}],mutationFn:async u=>{const b=r.find(f=>f.id===l);if(!b)throw new Error("Chain not found");if(o){const f=await fetch("/api/based-auth/sign-message",{method:"POST",body:JSON.stringify({args:[u],address:n})});if(!f.ok){const p=await f.json();throw new Error(p.message)}return await f.json()}else{if(b.network.symbol===m.NetworkSymbols.eth)return await K.signMessage(c,{message:u,connector:a.find(p=>p.id===i)});if(b.network.symbol===m.NetworkSymbols.sol){const f=d.find(x=>x.name===i);if(!f)throw new Error(`Wallet ${i} not found`);const p=await f.signMessage(Buffer.from(u));return Buffer.from(p).toString("base64")}}throw new Error("Unknown network")},onError:u=>{throw console.log(u),u}})}function Vn({chainId:e}={}){const{chainId:t,social:n,provider:o}=T(),{chains:i,wagmiConfig:r}=E(),c=e||t,{data:a}=oe();return D.useMutation({mutationKey:["use-sign-typed-data",{chainId:c,social:n}],mutationFn:async d=>{const l=i.find(b=>b.id===c);if(!l)throw new Error("Chain not found");const u=l.network.symbol;if(n){const b=await fetch("/api/based-auth/sign-typed-data",{method:"POST",body:JSON.stringify(d)});if(!b.ok){const f=await b.json();throw new Error(f.message)}return await b.json()}else if(u===m.NetworkSymbols.eth){const b=a.find(p=>p.id===o);return await K.signTypedData(r,{connector:b,...d})}throw new Error("Unknown network")}})}function Jn({chainId:e}={}){const{chainId:t,social:n,provider:o,switchChain:i}=T(),{data:r}=oe(),{solWallets:c}=de(),{chains:a,wagmiConfig:d}=E(),l=e||t;return D.useMutation({mutationKey:["use-read-contract-async",{chainId:l,social:n,wallets:[...r.map(u=>u.id),...c.map(u=>u.name)]}],mutationFn:async u=>{var x,v;const b=a.find(k=>k.id===l);if(!b)throw new Error("Chain not found");const f=b.network.symbol,p=me.serialize(f,u);if(n){t!==l&&await i(l);const k=await fetch("/api/based-auth/read-contract",{method:"POST",body:JSON.stringify(p)});if(!k.ok){const g=await k.json();throw new Error(g.message)}const C=await k.json();return me.deserialize(C)}if(f===m.NetworkSymbols.eth){const k=Et(d,{chainId:l}),g=await new M.Contract(u.address,u.abi,k)[u.functionName](...u.args);return me.deserialize(me.serialize(f,g))}else if(f===m.NetworkSymbols.sol){const k=c.find(Z=>Z.name===o);if(!k)throw new Error(`Wallet ${o} not found`);const{abi:C,address:g,functionName:I,args:B,accounts:L={},preInstructions:Y=[],remainingAccounts:G=[]}=me.deserialize(p),$=Ne(l,a),Q=new Me.AnchorProvider($,k,{}),F=await new Me.Program(C,new R.PublicKey(g),Q).methods[I](...B).accounts(L).preInstructions(Y).remainingAccounts(G).transaction(),N=new R.TransactionMessage({payerKey:k.publicKey,recentBlockhash:(await $.getLatestBlockhash()).blockhash,instructions:F.instructions}).compileToV0Message([]),X=new R.VersionedTransaction(N),z=await $.simulateTransaction(X);if(!((v=(x=z.value)==null?void 0:x.returnData)!=null&&v.data))throw new Error("Simulation failed");const[U,re]=z.value.returnData.data;return Buffer.from(U,re)}throw new Error("Unknown network")},onError:u=>{throw console.log(u),u}})}function Hn({key:e,chainId:t}={}){const{chainId:n,network:o,social:i,provider:r,switchChain:c,address:a}=T(),{chains:d,wagmiConfig:l}=E(),{data:u}=oe(),{solWallets:b,solSelect:f}=de();j.useEffect(()=>{b.some(x=>x.name===r)&&f(r)},[r,b]);const p=t||n;return D.useMutation({mutationKey:["use-write-contract-async",{key:e,chainId:p,social:i,account:a,wallets:[...u.map(x=>x.id),...b.map(x=>x.name)],provider:r}],mutationFn:async x=>{const v=d.find(g=>g.id===p);if(!v)throw new Error(`Chain not found ${p}`);const k=v.network.symbol;if(k!==o)throw await ee.signOut({redirect:!1}),new Error(`Please connect ${v.name} wallet`);const C=me.serialize(k,x);if(i){const g=await fetch("/api/based-auth/write-contract",{method:"POST",body:JSON.stringify(C)});if(!g.ok){const I=await g.json();throw console.log(I),new Error(I.message)}return g.json()}else if(k===m.NetworkSymbols.eth){const g=u.find(I=>I.id===r);if(!g)throw new Error(`Wallet ${r} not found`);try{const{abi:I,functionName:B,address:L,value:Y=0n,args:G}=x,$=await g.getChainId();return t&&$!==t&&(await g.switchChain({chainId:t}),await c(t)),await K.writeContract(l,{abi:I,args:G,chainId:$,connector:g,value:Y,functionName:B,address:L})}catch(I){throw console.log(I),new Error(I.shortMessage)}}else if(k===m.NetworkSymbols.sol){const g=b.find(z=>z.name===r);if(!g)throw new Error(`Wallet ${r} not found`);if(!g.publicKey)throw await ee.signOut({redirect:!1}),new Error(`Wallet ${r} is not connected`);const{abi:I,address:B,functionName:L,args:Y,accounts:G={},preInstructions:$=[],signers:Q=[],remainingAccounts:ce=[]}=me.deserialize(C),F=Ne(p,d),N=new Me.AnchorProvider(F,g,{}),X=new Me.Program(I,new R.PublicKey(B),N);try{const z=await Promise.all([Promise.resolve(R.ComputeBudgetProgram.setComputeUnitLimit({units:4e5})),Promise.resolve(R.ComputeBudgetProgram.setComputeUnitPrice({microLamports:1e5})),...$.map(J=>J.programId.toBase58()!==X.programId.toBase58()?Promise.resolve(J):X.methods[J.functionName](...J.args||[]).accounts(J.accounts||{}).instruction())]),U=await X.methods[L](...Y).accounts(G).preInstructions(z).remainingAccounts(ce).signers(Q.map(J=>R.Keypair.fromSecretKey(Buffer.from(J,"hex")))).transaction();if(!U)throw new Error("Failed to create transaction");if(U.recentBlockhash=(await F.getLatestBlockhash()).blockhash,U.feePayer=g.publicKey,Fn(U)<Dn)return await N.sendAndConfirm(U,Q.map(_=>R.Keypair.fromSecretKey(Buffer.from(_,"hex"))),{commitment:"finalized"});const[we,Z]=R.AddressLookupTableProgram.createLookupTable({authority:g.publicKey,payer:g.publicKey,recentSlot:await F.getSlot()}),ie=R.AddressLookupTableProgram.extendLookupTable({payer:g.publicKey,authority:g.publicKey,lookupTable:Z,addresses:Object.values(G).slice(0,Bn)}),w=new R.Transaction().add(R.ComputeBudgetProgram.setComputeUnitLimit({units:4e5}),R.ComputeBudgetProgram.setComputeUnitPrice({microLamports:1e5}),we,ie);await N.sendAndConfirm(w);const h=await F.getAddressLookupTable(Z,{commitment:"finalized"});if(!h.value)throw new Error("Lookup table account not found");const P=h.value.state.addresses;if(!P||P.length===0)throw new Error("Lookup table is empty");const O=await X.methods[L](...Y).accounts(G).remainingAccounts(ce).instruction(),se=new R.TransactionMessage({payerKey:g.publicKey,recentBlockhash:(await F.getLatestBlockhash()).blockhash,instructions:[...z,O]}).compileToV0Message([h.value]),V=new R.VersionedTransaction(se);return await N.sendAndConfirm(V)}catch(z){throw console.log(z),new Error(z.transactionMessage||z.message)}}}})}const ge=({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 ue({className:e,index:t=0,onClick:n,logo:o,logoKey:i,children:r,disabled:c=!1,...a}){return s.jsxs(H.motion.button,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{delay:.1*(t+1)},onClick:n,className:A("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 web3kit-gap-x-2 web3kit-w-full",c?"web3kit-bg-muted web3kit-text-muted-foreground":"hover:web3kit-bg-accent hover:web3kit-shadow-xl",e),disabled:c,...a,children:[s.jsx("div",{className:"web3kit-leading-none",children:r}),c?s.jsx(ge,{className:"web3kit-size-8 web3kit-animate-spin"}):typeof o=="string"?s.jsx(H.motion.img,{src:o,alt:`${t} logo`,className:"web3kit-size-8 web3kit-overflow-hidden web3kit-rounded-lg",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.3,ease:"easeInOut"}},i||o):o]})}function Yn(){const{setPendingItem:e,setRouter:t}=E(),{users:n}=T(),{data:o}=oe();return j.useEffect(()=>{e(null)},[]),s.jsx("div",{className:"web3kit-space-y-2",children:o.filter(i=>!n.find(r=>r.provider===i.id&&r.network===m.NetworkSymbols.eth)).map((i,r)=>s.jsx(ue,{index:r,logo:i.icon,onClick:()=>{t(()=>(e({id:i.id,logo:i.icon,network:m.NetworkSymbols.eth,description:`Open the ${i.name} browser extension to connect your wallet.`}),y.walletConnecting))},children:i.name},i.id))})}function Qn(){const{solWallets:e}=de(),{users:t}=T(),{setPendingItem:n,setRouter:o}=E();return j.useEffect(()=>{n(null)},[]),s.jsx("div",{className:"web3kit-space-y-2",children:e.filter(i=>!t.find(r=>r.provider===i.name&&r.network===m.NetworkSymbols.sol)).map((i,r)=>s.jsx(ue,{index:r,logo:i.icon,onClick:()=>{o(()=>(n({id:i.name,logo:i.icon,network:m.NetworkSymbols.sol,description:`Open the ${i.name} browser extension to connect your wallet.`}),y.walletConnecting))},children:i.name},r))})}function Xn(){const{address:e}=T();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(H.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(qt.QRCodeSVG,{value:e,size:200,level:"H",marginSize:1,className:"web3kit-border web3kit-rounded-lg"})})]})}const Xe=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ze=st,Zn=(e,t)=>n=>{var o;if((t==null?void 0:t.variants)==null)return Ze(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:i,defaultVariants:r}=t,c=Object.keys(i).map(l=>{const u=n==null?void 0:n[l],b=r==null?void 0:r[l];if(u===null)return null;const f=Xe(u)||Xe(b);return i[l][f]}),a=n&&Object.entries(n).reduce((l,u)=>{let[b,f]=u;return f===void 0||(l[b]=f),l},{}),d=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((l,u)=>{let{class:b,className:f,...p}=u;return Object.entries(p).every(x=>{let[v,k]=x;return Array.isArray(k)?k.includes({...r,...a}[v]):{...r,...a}[v]===k})?[...l,b,f]:l},[]);return Ze(e,c,d,n==null?void 0:n.class,n==null?void 0:n.className)},eo=Zn("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"}}),Ee=q.forwardRef(({className:e,variant:t,size:n,asChild:o=!1,...i},r)=>{const c=o?$t.Slot:"button";return s.jsx(c,{className:A(eo({variant:t,size:n}),e),ref:r,...i})});Ee.displayName="Button";function to(){const{pendingItem:e}=E(),{mutateAsync:t,isError:n,error:o,isPending:i}=Rt();return j.useEffect(()=>{if(e){const r=localStorage.getItem("last-based-auth-wallet-connect-network");localStorage.setItem("last-based-auth-wallet-connect",JSON.stringify(e)),localStorage.setItem("last-based-auth-wallet-connect-network",e.network),e.id.toLowerCase()==="walletconnect"&&r!==e.network&&window.location.reload()}},[e]),j.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:A("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"}),!i&&n?s.jsx(Ee,{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(ae.RotateCcw,{className:"web3kit-size-4 web3kit-transition-transform group-hover:-web3kit-rotate-45"})}):s.jsx(ge,{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 no(){const{pendingItem:e,setRouter:t}=E(),{mutateAsync:n,isError:o,isPending:i}=$n();return j.useEffect(()=>{e?n(...e.args):t(y.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:A("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"}),!i&&o?s.jsx(Ee,{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(ae.RotateCcw,{className:"web3kit-size-4 web3kit-transition-transform group-hover:-web3kit-rotate-45"})}):s.jsx(ge,{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 zt({index:e,className:t}){return s.jsx(H.motion.div,{className:A("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 oo(){const{address:e,network:t}=T(),{isPending:n}=Ue(),{setPendingItem:o,setRouter:i}=E(),[r,c]=j.useState([]);return j.useEffect(()=>{async function a(){const d=await Fe.getUserProfile(e,t);c((d==null?void 0:d.users)||[])}a()},[e,t]),n?s.jsx("div",{className:"web3kit-space-y-2",children:Array.from({length:3}).map((a,d)=>s.jsx(zt,{index:d,className:"web3kit-h-12"},d))}):s.jsx("div",{className:"web3kit-space-y-2",children:r.filter(a=>!(a.address===e&&a.network===t)).map((a,d)=>s.jsx(ue,{index:d,logo:a.image,onClick:()=>{o(()=>(i(y.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)},d))})}function ro({className:e,...t}){return s.jsx("div",{className:A("web3kit-animate-pulse web3kit-rounded-md web3kit-bg-foreground/10",e),...t})}function io({address:e}){const[t,n]=j.useState(!1);j.useEffect(()=>{const i=setTimeout(()=>{t&&n(!1)},1e3);return()=>clearTimeout(i)},[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(ae.CheckIcon,{className:"web3kit-size-4"}):s.jsx(ae.CopyIcon,{className:"web3kit-size-4"})})}function so(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 ao(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+$/,""),i=Number(n.split("e-")[1]);return"0.0"+so(i-1)+o}return e=+(+e).toFixed(t),e.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,")}function Mt({className:e=""}){const{chains:t,setRouter:n}=E(),{chainId:o,address:i,network:r,social:c,image:a,users:d}=T(),{chainLogo:l,nativeSymbol:u,nativeDecimals:b,addressExplorer:f}=Le(),{data:p,isPending:x}=At(),v=t.filter(C=>C.id!==o).filter(C=>c||C.network.symbol===r).length>0,k=[d.length>1&&{label:"Switch Account",logo:m.T,onClick:()=>{n(y.switchAccount)}},v&&{label:"Switch Chain",logo:l||m.M,onClick:()=>{n(y.switchChain)}},{label:"Add Account",logo:m.T,onClick:()=>{n(y.home)}},c&&{label:"Withdraw",logo:m.H,onClick:()=>{n(y.withdrawFunds)}}].filter(Boolean);return s.jsxs("div",{className:A("web3kit-space-y-4 web3kit-text-center",e),children:[s.jsx(H.motion.img,{initial:{scale:.5,opacity:0},animate:{scale:1,opacity:1},transition:{duration:.5,ease:[.4,0,.2,1],delay:.1},src:typeof a=="string"?a:void 0,alt:`avatar for ${i}`,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:x?s.jsx(ro,{className:"web3kit-h-4 web3kit-w-[50px]"}):`${ao(M.formatUnits(p||0n,b))} ${u}`}),s.jsx("a",{target:"_blank",rel:"noopener noreferrer",href:f.replace("{{addr}}",i),className:"web3kit-leading-none web3kit-text-primary",children:Wt(i)}),s.jsx(io,{address:i}),s.jsx(ae.QrCodeIcon,{className:"web3kit-size-4 web3kit-cursor-pointer hover:web3kit-text-foreground",onClick:()=>{n(y.walletqr)}})]}),s.jsx("div",{className:"web3kit-space-y-2",children:k.map((C,g)=>s.jsx(ue,{index:g,className:"web3kit-w-full",logo:C.logo,onClick:C.onClick,children:s.jsx("div",{className:"web3kit-text-lg",children:C.label})},g))})]})}function co({index:e,network:t,onClick:n}){var l;const[o,i]=j.useState(-1),{chains:r}=E(),c=r.filter(u=>u.network.symbol===t.symbol);j.useEffect(()=>{if(c.length>1){const u=setInterval(()=>{i(b=>(b+1)%c.length)},2e3);return()=>clearInterval(u)}},[]);const a=o===-1?t.logo:(l=c[o])==null?void 0:l.logo,d=`${t.symbol}-${o}`;return s.jsx(ue,{index:e,logo:a,logoKey:d,onClick:n,children:t.name})}const lo={google:m.e,github:m.c,twitter:m.u,discord:m.n};function Ot(){const{data:e,isPending:t}=Ue(),{chains:n,setPendingItem:o,setRouter:i}=E(),{users:r}=T(),c=Object.values(n.reduce((a,d)=>(a[d.network.symbol]=d.network,a),{}));return j.useEffect(()=>{o(null)},[]),t?s.jsx("div",{className:"web3kit-space-y-2",children:Array.from({length:3}).map((a,d)=>s.jsx(zt,{index:d,className:"web3kit-h-12"},d))}):s.jsxs("div",{className:"web3kit-space-y-2",children:[s.jsx("div",{className:"web3kit-flex web3kit-items-center web3kit-gap-2",children:c.map((a,d)=>s.jsx(co,{index:d,network:a,onClick:()=>{switch(a.symbol){case m.NetworkSymbols.eth:i(y.selectETHWallet);break;case m.NetworkSymbols.sol:i(y.selectSolanaWallet);break}}},a.symbol))}),e.filter(a=>!r.some(d=>d.provider===a.id)).map((a,d)=>{const l=lo[a.id]||m.M;return s.jsx(ue,{index:d,logo:l,onClick:()=>{i(()=>(o({id:a.id,chainId:n[0].id,logo:l,network:"",description:`We connect your "${a.name}" account to our platform.`}),y.socialConnecting))},children:a.name},a.id)})]})}function uo(){const{chainId:e,network:t,social:n}=T(),{chains:o,setPendingItem:i,setRouter:r}=E();return s.jsx("div",{className:"web3kit-space-y-2",children:o.filter(c=>c.id!==e).filter(c=>n||c.network.symbol===t).map((c,a)=>s.jsx(ue,{index:a,logo:c.logo,onClick:()=>{i(()=>(r(y.switchingChain),{name:c.name,logo:c.logo,args:[c.id]}))},className:"web3kit-w-full",children:c.name},a))})}function wo(){const{pendingItem:e,setRouter:t}=E(),{mutateAsync:n,isError:o,isPending:i}=Ln();return j.useEffect(()=>{e?n(...e.args):t(y.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:A("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"}),!i&&o?s.jsx(Ee,{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(ae.RotateCcw,{className:"web3kit-size-4 web3kit-transition-transform group-hover:-web3kit-rotate-45"})}):s.jsx(ge,{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 bo(){const e=j.useRef(null),t=j.useRef(null),[n,o]=j.useState("native"),{nativeSymbol:i,nativeDecimals:r}=Le(),{network:c}=T(),{mutateAsync:a,isPending:d}=It(),{mutateAsync:l,isPending:u}=Tt(),{mutateAsync:b,isPending:f}=Un();async function p(v){v.preventDefault();const k=new FormData(v.target),C=k.get("type");k.get("token");const g=k.get("amount"),I=k.get("recepient");if(!I)throw new Error("Recepient address is required");if(C==="native")await b({address:I,value:M.parseUnits(g,r)});else throw new Error("Not implemented yet")}const x=async v=>{var k;if(v.preventDefault(),e.current){let C=0n;if(c===m.NetworkSymbols.eth)C=M.parseUnits("2","gwei")*21000n;else if(c===m.NetworkSymbols.sol)C=5000n;else throw new Error("Invalid network");if(n==="token"){const g=await a((k=t.current)==null?void 0:k.value);e.current.value=M.formatUnits(g,r)}else{const g=await l();e.current.value=M.formatUnits(g<=C?0n:g-C,r)}}};return s.jsxs("form",{className:"web3kit-flex web3kit-flex-col web3kit-justify-between web3kit-items-center web3kit-gap-y-4",onSubmit:p,children:[s.jsxs(H.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:v=>o(v.target.value),children:[s.jsx(H.motion.option,{value:"native",className:"web3kit-text-sm",children:i}),s.jsx(H.motion.option,{value:"token",className:"web3kit-text-sm",children:"Token"})]}),n==="token"&&s.jsx(H.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(H.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(H.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:x,disabled:d||u,children:d||u?s.jsx(ge,{className:"web3kit-size-6 web3kit-animate-spin"}):"MAX"})]}),s.jsx(H.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(ue,{disabled:f,logo:m.H,children:f?"Withdrawing":"Withdraw"})]})}function fo(){const{pendingItem:e}=E(),{mutateAsync:t,isError:n,error:o,isPending:i}=Rt();return j.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:A("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"}),!i&&n?s.jsx(Ee,{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(ae.RotateCcw,{className:"web3kit-size-4 web3kit-transition-transform group-hover:-web3kit-rotate-45"})}):s.jsx(ge,{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 mo(){const{pendingItem:e}=E(),{error:t,isError:n,isPending:o,mutateAsync:i}=Kn();return j.useEffect(()=>{i()},[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:A("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"}),!o&&n?s.jsx(Ee,{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:()=>{i()},children:s.jsx(ae.RotateCcw,{className:"web3kit-size-4 web3kit-transition-transform group-hover:-web3kit-rotate-45"})}):s.jsx(ge,{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||t?"Request Error":"Requesting Connection"}),s.jsx("p",{className:"web3kit-text-balance web3kit-text-sm web3kit-text-muted-foreground",children:n||t?"There was an error with the request. Click above to try again.":`We're verifying your ${e.id} account.`})]})]}):null}function ko(){const{address:e,social:t,network:n}=T(),{open:o,setOpen:i,setRouter:r,setPendingItem:c}=E(),{solWallets:a}=de(),d=D.useQueryClient(),{data:l}=oe();return j.useEffect(()=>(a.forEach(u=>{u.on("connect",b=>{t||e&&n!==m.NetworkSymbols.sol||e&&e===(b==null?void 0:b.toBase58())||i(()=>(r(()=>(c({id:u.name,name:u.name,logo:u.icon,network:m.NetworkSymbols.sol,chainId:Ie.isMainnet?Ie.chainSol.id:Ie.chainSolDevnet.id,address:b.toBase58()}),y.accountSigning)),!0))}),u.on("error",b=>{console.log("sol error",b,u.name)}),u.on("disconnect",()=>{ee.signOut({redirect:!1})})}),()=>{a.forEach(u=>{u.off("connect"),u.off("error"),u.off("disconnect")})}),[a]),j.useEffect(()=>(l.forEach(u=>{u.emitter.on("connect",({accounts:b,chainId:f})=>{Ie.AllChains.filter(x=>x.network.symbol===m.NetworkSymbols.eth).find(x=>x.id===f)&&i(()=>(r(()=>(c({id:u.id,name:u.name,logo:u.icon,network:m.NetworkSymbols.eth,chainId:f,address:b[0]}),y.accountSigning)),!0))}),u.emitter.on("change",(...b)=>{const f=b[0];i(()=>(r(()=>(c({name:u.name,logo:u.icon,args:[f]}),y.switchingChain)),!0))}),u.emitter.on("display_uri",b=>{console.log("eth display_uri",b)}),u.emitter.on("error",b=>{console.log("eth error",b)}),u.emitter.on("disconnect",()=>{ee.signOut({redirect:!1})})}),()=>{l.forEach(u=>{u.emitter.off("connect"),u.emitter.off("change"),u.emitter.off("display_uri"),u.emitter.off("error"),u.emitter.off("disconnect")})}),[l]),j.useEffect(()=>{o||localStorage.setItem("last-based-auth-wallet-connect","")},[o]),j.useEffect(()=>{d.fetchQuery({queryKey:["use-social-providers"]})},[]),s.jsx(s.Fragment,{})}const go={[y.home]:s.jsx(Ot,{}),[y.account]:s.jsx(Mt,{}),[y.accountSigning]:s.jsx(mo,{}),[y.switchChain]:s.jsx(uo,{}),[y.switchingChain]:s.jsx(no,{}),[y.switchAccount]:s.jsx(oo,{}),[y.switchingAccount]:s.jsx(wo,{}),[y.selectETHWallet]:s.jsx(Yn,{}),[y.selectSolanaWallet]:s.jsx(Qn,{}),[y.walletConnecting]:s.jsx(to,{}),[y.socialConnecting]:s.jsx(fo,{}),[y.walletqr]:s.jsx(Xn,{}),[y.withdrawFunds]:s.jsx(bo,{})};function po(e){const{address:t,chainId:n}=T(),{router:o,setRouter:i,open:r,setOpen:c,setPendingItem:a}=E();return j.useEffect(()=>{c(!1),a(null),i(t?y.account:y.home)},[t,n]),j.useEffect(()=>{r||i(t?y.account:y.home)},[r,t]),j.useEffect(()=>{const d=new MutationObserver(l=>{l.forEach(u=>{u.type==="attributes"&&u.attributeName==="style"&&document.body.style.pointerEvents==="none"&&!r&&(document.body.style.pointerEvents="")})});d.observe(document.body,{attributes:!0,attributeFilter:["style"]});try{const l=localStorage.getItem("last-based-auth-wallet-connect");l&&setTimeout(()=>{c(()=>(a(()=>(i(y.walletConnecting),JSON.parse(l))),!0))},200)}catch{}return()=>{d.disconnect()}},[]),s.jsxs(s.Fragment,{children:[e.children,s.jsx(ko,{}),s.jsx(Pn,{open:r,onOpenChange:c,children:s.jsxs(Tn,{children:[s.jsxs(Wn,{children:[s.jsx(xo,{}),s.jsx(zn,{children:o&&o in He?He[o]:"Login"}),s.jsx(In,{className:"web3kit-sr-only",children:"Connect your Web3 wallet or create a new one."})]}),s.jsx(Mn,{children:go[o]||s.jsx(s.Fragment,{children:t?s.jsx(Mt,{}):s.jsx(Ot,{})})}),s.jsx(On,{children:s.jsx(ho,{})})]})})]})}function ho(){const{address:e}=T(),{pendingItem:t}=E();return s.jsx(s.Fragment,{children:e&&!t&&s.jsx(yo,{})})}function yo(){const{mutateAsync:e,isPending:t}=Pt();return s.jsx(ue,{logo:m.r,disabled:t,onClick:()=>e(),children:t?"Signing out":"Logout"})}function xo(){const{address:e}=T(),{router:t,setRouter:n,pendingItem:o,setPendingItem:i}=E();if(!t||t===y.home&&!e||t===y.account&&e)return null;function r(){if(o){i(()=>(n(e?y.account:y.home),null));return}switch(t){case y.home:case y.switchChain:case y.switchAccount:case y.walletqr:case y.withdrawFunds:n(y.account);break;default:n(y.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:r,children:[s.jsx(ae.ChevronLeft,{className:"web3kit-h-4 web3kit-w-4"}),s.jsx("span",{className:"web3kit-sr-only",children:"Cancel connection"})]})}function vo({chains:e,etherWalletConnector:t,solanaWalletConnector:n,children:o,signMessage:i,metadata:r,queryClient:c,projectId:a}){return s.jsx(D.QueryClientProvider,{client:c,children:s.jsx(Vt,{chains:e,metadata:r,projectId:a,signMessage:i,children:s.jsx(po,{children:o})})})}exports.SimpleKitProvider=vo;exports.useAccount=T;exports.useBalance=At;exports.useBalanceAsync=Tt;exports.useChainInfo=Le;exports.useDisconnectAccount=Pt;exports.useReadContractAsync=Jn;exports.useSignMessageAsync=Gn;exports.useSignTypedDataAsync=Vn;exports.useSimpleKit=Gt;exports.useTokenBalance=qn;exports.useTokenBalanceAsync=It;exports.useWriteContractAsync=Hn;
//# sourceMappingURL=react.cjs.map
