1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[240],{80637:function(e,t,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/profile/[username]",function(){return i(84621)}])},84621:function(e,t,i){"use strict";i.r(t),i.d(t,{default:function(){return _username_}});var r=i(85893),n=i(32488),l=i(34024),o=i(82729),s=i(57747),a=i(81136),c=i(34292),d=i(71293),p=i(55281),u=i(5460),x=i(48783),h=i(70959),m=i(44461),g=i(24124),y=i(84028),j=i(90889),f=i(36948),b=i(99161),v=i(41664),w=i.n(v),C=i(11163),_=i(67294),k=i(8193),S=i(81511),P=i(79352),T=i(88095),A=i(7963),B=i(35541),E=i(19778),O=i(82770),N=i(64859),z=i(66205),D=i(54346),L=i(14253),I=i(14225),M=i(54306),R=i(91377),U=i(80325),F=i(39418),G=i(86047);let ApiClient=class ApiClient extends F.J{async fetchProfileByUserName(e){try{let t=await this.secureApiCall({type:"GET",url:U.z.profile.fetchByUserName.replace(":username",e)});return t.data}catch(e){return Promise.reject((0,G.x)(e))}}async fetchProfileByPublicKey(e){try{let t=await this.secureApiCall({type:"GET",url:U.z.profile.fetchByPublicKey.replace(":public_key",e)});return t.data}catch(e){return Promise.reject((0,G.x)(e))}}async fetchCoinsByPublicKey(e){try{let t=await this.secureApiCall({type:"GET",url:U.z.profile.fetchCoinsByPublicKey.replace(":public_key",e)});return t.data}catch(e){return Promise.reject((0,G.x)(e))}}async fetchCoinsCreatedByAgent(e){try{let t=await this.secureApiCall({type:"GET",url:U.z.agents.fetchCoinsHeldByAgentId.replace(":agent_id",e)});return t.data}catch(e){return Promise.reject((0,G.x)(e))}}async getLinkTwitterUrl(e){try{let t=await this.secureApiCall({type:"POST",url:U.z.agents.reconnectTwitter,body:{mintPublicKey:e}});return t.data}catch(e){return Promise.reject((0,G.x)(e))}}constructor(){super({})}};let K=new ApiClient;var SocialModal=function(e){var t,i,n,l,o,s,a,p,u,x,h,m;let g=(0,A.p)(),{publicKey:y,connected:j}=(0,M.O)(),[f,b]=(0,_.useState)(!1),startPolling=async function(){var t,i;let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=await R.m.getAgent(e.data.mint_public_key);if(10===r&&(null===(t=n.social)||void 0===t?void 0:t[e.name])===""){g({title:"Error",description:"unable to connect",status:"error",position:"bottom-right"});return}(null===(i=n.social)||void 0===i?void 0:i[e.name])===""?(await new Promise(e=>setTimeout(e,1e3)),r+=1,await startPolling(r)):e.setSelectedSocial(n)},connectTwitter=async()=>{try{b(!0);let{authUrl:t}=await K.getLinkTwitterUrl(e.data.mint_public_key);window.open(t,"_blank"),await startPolling()}catch(e){console.error(e),g({title:"Error",description:"Something went wrong",status:"error",position:"bottom-right"})}finally{b(!1)}};(0,_.useEffect)(()=>{console.log(j,null==y?void 0:y.toString())},[e.isOpen]);let handleVisit=()=>{var t,i;let r=null===(i=e.data)||void 0===i?void 0:null===(t=i.social)||void 0===t?void 0:t[e.name];"twitter"===e.name?window.open("https://x.com/".concat(r)):window.open(r)};return(0,r.jsxs)(B.u_,{isOpen:e.isOpen,onClose:e.onClose,children:[(0,r.jsx)(E.Z,{}),(0,r.jsxs)(O.h,{backgroundColor:"grey.50",color:"white",justifyContent:"center",alignItems:"center",borderWidth:"1px",children:[(0,r.jsx)(N.x,{textTransform:"capitalize",children:e.name}),(0,r.jsx)(z.o,{onClick:e.onClose}),(0,r.jsx)(D.f,{width:"100%",children:(0,r.jsxs)(c.U,{justifyContent:"center",children:[(0,r.jsx)(d.x,{marginRight:"1rem",children:"Status:"}),(0,r.jsx)(d.x,{color:(null===(i=e.data)||void 0===i?void 0:null===(t=i.social)||void 0===t?void 0:t[e.name])!==""?"green":"red",children:(null===(l=e.data)||void 0===l?void 0:null===(n=l.social)||void 0===n?void 0:n[e.name])!==""?"Connected":"Not Connected"})]})}),(0,r.jsx)(L.m,{children:(null==e?void 0:null===(s=e.data)||void 0===s?void 0:null===(o=s.user_details)||void 0===o?void 0:o.address)!==(null==y?void 0:y.toString())?(0,r.jsx)(I.z,{_hover:{opacity:.8},width:"100%",isDisabled:(null===(p=e.data)||void 0===p?void 0:null===(a=p.social)||void 0===a?void 0:a[e.name])==="",display:"flex",justifyContent:"center",gap:"10px",onClick:handleVisit,children:"Visit"}):(0,r.jsx)(I.z,{_hover:{opacity:.8},width:"100%",isLoading:f,isDisabled:f,display:"flex",justifyContent:"center",gap:"10px",onClick:(null===(x=e.data)||void 0===x?void 0:null===(u=x.social)||void 0===u?void 0:u[e.name])!==""?handleVisit:()=>{try{"twitter"===e.name?connectTwitter():g({title:"Coming Soon",description:"This functionality will be available soon.",status:"info",containerStyle:{backgroundColor:"blue"},position:"bottom-right"})}catch(e){console.error(e),g({title:"Error",description:"Something went wrong",status:"error",position:"bottom-right"})}}
1,children:(null===(m=e.data)||void 0===m?void 0:null===(h=m.social)||void 0===h?void 0:h[e.name])!==""?"Visit":(0,r.jsx)(r.Fragment,{children:"twitter"===e.name?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(P.Gh0,{size:"15px"}),(0,r.jsx)("span",{children:"Connect Twitter"})]}):(0,r.jsx)("span",{children:"Connect"})})})})]})]})},components_SubscriptText=e=>{let{value:t,dollar:i=!0}=e,n=null==t?void 0:t.toLowerCase().includes("e"),l=t,o="",s="",a="";if(n&&(l=Number(t).toFixed(20).replace(/\.?0+$/,"")),!t)return null;let c=parseFloat(l);if(c<.1&&0!==c){var d,p,u;let[e,t]=l.split("."),n=null==t?void 0:t.search(/[1-9]/);return o=null!==(d=null==t?void 0:t.slice(0,n))&&void 0!==d?d:"",s=null!==(p=null==t?void 0:t.charAt(null!=n?n:0))&&void 0!==p?p:"",a=null!==(u=null==t?void 0:t.slice((null!=n?n:0)+1))&&void 0!==u?u:"",(0,r.jsxs)("span",{children:[i?"$":"",e,".",o,(0,r.jsx)("span",{style:{verticalAlign:"sub",fontSize:"0.8em"},children:s}),a]})}return(0,r.jsxs)("span",{children:[i?"$":""," ",t]})},V=i(58306),$=i(30750),H=i(66218);function _templateObject(){let e=(0,o._)(["\n width: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n padding: 1rem;\n"]);return _templateObject=function(){return e},e}let X=T.ZP.div.withConfig({componentId:"sc-7778736f-0"})(_templateObject());var Profile=function(){var e;let t=(0,C.useRouter)(),{username:i}=t.query,[n,l]=(0,_.useState)(0),[o,v]=(0,_.useState)([]),[T,A]=(0,_.useState)(null),[B,E]=(0,_.useState)(!0),[O,N]=(0,_.useState)(""),[z,D]=(0,_.useState)(""),[L,I]=(0,_.useState)([]),[M,R]=(0,_.useState)(!1),[U,F]=(0,_.useState)(),[G,J]=(0,_.useState)("");return((0,_.useEffect)(()=>{if(!i)return;let fetchData=async()=>{let e=!1,t=!1;try{E(!0);let r=await K.fetchProfileByUserName(i),n=r.user;A(n);let o=await K.fetchCoinsByPublicKey(n.public_key),s=(await H.D.solPrice()).solana.usd,a=o.agents.map(async e=>{let t=await V.pC.getBondingCurveAccount(new b.PublicKey(e.mint_public_key));if(!t||t.complete)return null;let i=(await t.getSellPrice(1,0)||0)/100*s,r=(t.getMarketCapSOL()||0)/b.LAMPORTS_PER_SOL*s;return{...e,price:i.toExponential(1),marketcap:r.toFixed(3)}}),c=(await Promise.all(a)).filter(Boolean);v(c),e||(l(1),E(!1),t=!0);let d=await (0,$.v)(n.public_key),p=d.map(async e=>{try{let t=await K.fetchCoinsCreatedByAgent(e.mint);return t?{...e,...t}:null}catch(e){return null}}),u=(await Promise.all(p)).filter(Boolean);I(u),t||(l(0),E(!1),e=!0),E(!1)}catch(e){console.error(e),N("User not found!"),E(!1)}};fetchData()},[i]),i)?T?(0,r.jsxs)(X,{children:[(0,r.jsx)(c.U,{width:"100%",px:{base:"0",md:"10%"},alignItems:"center",py:"1rem",maxWidth:"1200px",margin:"auto",mb:"20px",children:(0,r.jsx)(s.xu,{width:"100%",gap:"20px",height:"100%",padding:"4px 9px",display:"flex",flexDirection:"column",justifyContent:"space-between",className:"knf",children:(0,r.jsxs)(d.x,{fontSize:"18px",cursor:"pointer",children:[(0,r.jsx)(w(),{href:"/app",children:(0,r.jsx)("span",{style:{color:"#959595"},children:"HOME / "})})," ","PROFILE"]})})}),(0,r.jsxs)(p.K,{width:"100%",px:{base:"0",md:"15%"},alignItems:"flex-start",py:"1rem",maxWidth:"1200px",margin:"auto",mb:"20px",children:[(0,r.jsxs)(c.U,{alignItems:"center",gap:"10px",children:[(0,r.jsx)(u.E,{boxSize:"64px",src:null==T?void 0:T.profile_pic}),(0,r.jsx)(d.x,{fontSize:"32px",children:null!==(e=null==T?void 0:T.username)&&void 0!==e?e:""})]}),(0,r.jsxs)(x.g,{width:"100%",children:[(0,r.jsxs)(h.m,{index:n,onChange:l,variant:"unstyled",width:"100%",children:[(0,r.jsxs)(m.t,{width:"100%",pt:"10px",mt:"10px",children:[(0,r.jsxs)(g.O,{_selected:{color:"white",borderBottom:"2px solid",borderColor:"blue.500"},color:0===n?"white":"#4A4A55",borderBottom:"2px solid",borderColor:0===n?"blue.500":"transparent",display:"flex",alignItems:"center",gap:"5px",children:[(0,r.jsx)("span",{children:"COINS HELD"})," "]}),(0,r.jsx)(g.O,{_selected:{color:"white",borderBottom:"2px solid",borderColor:"blue.500"},color:1===n?"white":"#4A4A55",borderBottom:"2px solid",borderColor:1===n?"blue.500":"transparent",children:"AGENTS CREATED"})]}),(0,r.jsxs)(y.n,{children:[(0,r.jsx)(j.x,{}),(0,r.jsx)(j.x,{})]})]}),B?(0,r.jsx)(a.$,{marginTop:20}):0===n&&0===L.length||1===n&&0===o.length?(0,r.jsx)(x.g,{alignItems:"center",pt:"50px",justifyContent:"center",children:(0,r.jsx)(d.x,{children:0===n?"No Coins Held!":"No Agents Created!"})}):(0,r.jsx)(x.g,{bg:"#1B1B1E",width:"100%",overflowX:"auto",children:(0,r.jsxs)("table",{style:{width:"100%",borderCollapse:"separate",borderSpacing:"0 20px",padding:"0 20px"},children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{style:{color:"#656565",textAlign:"left",padding:"1rem"},children:"Name"}),0===n?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("th",{style:{color:"#656565",textAlign:"left",padding:"1rem"},children:"Coins"}),(0,r.jsx)("th",{style:{color:"#656565",textAlign:"left",padding:"1rem"},children:"Value"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("th",{style:{color:"#656565",textAlign:"left",padding:"1rem"},children:"Price"}),(0,r.jsx)("th",{style:{color:"#656565",padding:"1rem",textAlign:"left"},children:"Market Cap"}),1===n&&(0,r.jsx)("th",{style:{color:"#656565",padding:"1rem",textAlign:"left"},children:"Social"})]})]})}),(0,r.jsx)("tbody",{children:0===n?L.map((e,i)=>(0,r.jsxs)("tr",{style:{backgroundColor:z===i?"#2D2D2D":"transparent",curs
1or:"pointer"},onClick:()=>t.push("/".concat(i)),onMouseEnter:()=>D(i),onMouseLeave:()=>D(""),children:[(0,r.jsx)("td",{style:{height:"80px",padding:"1rem",borderLeft:"1px solid #343434",borderTop:"1px solid #343434",borderBottom:"1px solid #343434"},children:e.name}),(0,r.jsx)("td",{style:{padding:"1rem",borderTop:"1px solid #343434",borderBottom:"1px solid #343434"},children:e.ticker}),(0,r.jsx)("td",{style:{padding:"1rem",borderTop:"1px solid #343434",borderBottom:"1px solid #343434",borderRight:"1px solid #343434"},children:e.balance})]},i)):o.map((e,i)=>(0,r.jsxs)("tr",{style:{backgroundColor:z===e.ticker?"#2D2D2D":"transparent",cursor:"pointer"},onMouseEnter:()=>D(e.ticker),onMouseLeave:()=>D(""),children:[(0,r.jsx)("td",{onClick:()=>t.push("/".concat(e.mint_public_key)),style:{height:"80px",padding:"0.5rem 1rem",borderLeft:"1px solid #343434",borderTop:"1px solid #343434",borderBottom:"1px solid #343434"},children:e.name}),(0,r.jsx)("td",{onClick:()=>t.push("/".concat(e.mint_public_key)),style:{padding:"0.5rem 1rem",borderTop:"1px solid #343434",borderBottom:"1px solid #343434"},children:e.price?(0,r.jsx)(components_SubscriptText,{value:e.price}):"--"}),(0,r.jsxs)("td",{onClick:()=>t.push("/".concat(e.mint_public_key)),style:{padding:"0.5rem 1rem",borderTop:"1px solid #343434",borderBottom:"1px solid #343434",borderRight:"1px solid #343434"},children:["$",e.market_cap]}),(0,r.jsx)("td",{style:{padding:"0.5rem 1rem",borderTop:"1px solid #343434",borderBottom:"1px solid #343434",borderRight:"1px solid #343434"},children:(0,r.jsxs)(c.U,{children:[(0,r.jsx)(f.J,{as:P.Gh0,size:"1.2rem",_hover:{opacity:"0.8"},onClick:()=>{F(e),R(!0),J("twitter")}}),(0,r.jsx)(f.J,{as:S.Gke,size:"1.5rem",_hover:{opacity:"0.8"},onClick:()=>{F(e),R(!0),J("telegram")}}),(0,r.jsx)(f.J,{as:k.HmR,size:"1.5rem",_hover:{opacity:"0.8"},onClick:()=>{F(e),R(!0),J("website")}})]})})]},e.ticker))})]})})]})]}),(0,r.jsx)(SocialModal,{isOpen:M,onClose:()=>{F(void 0),R(!1),J("")},setSelectedSocial:F,data:U,name:G})]}):(0,r.jsx)(s.xu,{className:"flex h-[80vh] w-screen items-center justify-center",children:B?(0,r.jsx)(a.$,{}):O}):null},J=i(78230),Z=i(1349),_username_=()=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.Z,{}),(0,r.jsx)(J.Z,{meta:(0,r.jsx)(l.h,{title:Z.X.title,description:Z.X.description}),nofooter:!0,children:(0,r.jsx)(Profile,{})})]})}},function(e){e.O(0,[228,445,874,174,401,774,937,861,655,617,309,699,498,702,527,461,371,928,888,179],function(){return e(e.s=80637)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.