PageSourceSearch

https://trade.zipmex.com/_next/static/chunks/3841-6da9707962b0cf1b.js

js zipmex.com collected 2026-09-28 06:42:21 UTC 31,215 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3841],{33841:(e,t,r)=>{r.r(t),r.d(t,{INPUT_MINT_ADDRESS:()=>X,OUTPUT_MINT_ADDRESS:()=>Y,default:()=>G});var n=r(42073),a=r(44904),s=r(48120),i=r(10662),l=r.n(i),o=r(23548),c=r(26653),u=r(29334),d=r(41831),m=r(48386),p=r(27429),f=r(60466),x=r(36387),h=r(71140),w=r(59472),b=r(95431),v=r(30950),g=r(96322),y=r(14790),j=r(90991),N=r(82633),S=r(28120),k=r(25045),A=r(95562),T=r(13741),F=r(84492),M=r(62947),E=r(44466),R=r(91386);let C=new Map,P=new Map;async function L(e,t){let r=C.get(e);if(r&&Date.now()-r.at<6e3)return r.value;let n=P.get(e);if(n)return n;let a=t().then(t=>(C.set(e,{at:Date.now(),value:t}),t)).finally(()=>{P.delete(e)});return P.set(e,a),a}var D=r(17797),_=r(81988),I=r(99047),B=r(4323),U=r(99462),q=r(83229),O=r(34723),z=r(15148),W=r(10536);let V=e=>{let{inputUsdValue:t,placement:r="above"}=e,{isAuthenticated:a,isLoading:s,userProfile:i}=(0,O.iJ)(),{connected:l}=(0,u.v)(),{activate:o,busy:c}=(0,z.l)(),d=(null==i?void 0:i.pointMultiplier)||1;if(!a){if(!l)return"above"!==r?null:(0,n.jsxs)("p",{className:"w-full flex items-center justify-center gap-1.5 py-2 rounded-lg bg-pts/10 border border-pts/30 text-xs font-medium text-pts",children:[(0,n.jsx)(W.A,{className:"w-3 h-3 text-pts","aria-hidden":!0}),"Earn PTS on every swap"]});if("below"!==r)return null;let e=c||s;return(0,n.jsxs)("button",{type:"button",onClick:o,disabled:e,className:"mx-auto flex min-h-touch items-center justify-center gap-1.5 px-3 rounded-md text-xs text-pts transition-colors hover:bg-pts/10 disabled:opacity-50 disabled:cursor-not-allowed focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--c-accent-blue)]",children:[e?(0,n.jsx)(j.A,{className:"w-3 h-3 animate-spin","aria-hidden":!0}):(0,n.jsx)(W.A,{className:"w-3 h-3","aria-hidden":!0}),(0,n.jsx)("span",{className:"font-medium",children:"Activate rewards"}),(0,n.jsx)("span",{className:"text-pts/70",children:"— one signature, no fee"})]})}return"above"!==r?null:(0,n.jsxs)("div",{className:"w-full flex items-center justify-between px-3 py-2 rounded-lg bg-pts/10 border border-pts/30",children:[(0,n.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,n.jsx)(W.A,{className:"w-3 h-3 text-pts"}),(0,n.jsx)("span",{className:"text-xs text-pts/70",children:"Estimated Rewards"})]}),(0,n.jsxs)("div",{className:"flex items-center gap-1",children:[(0,n.jsxs)("span",{className:"text-xs font-semibold text-pts",children:["+",(e=>e>=1e6?"".concat((e/1e6).toFixed(2),"M"):e>=1e3?"".concat((e/1e3).toFixed(2),"K"):e<1&&e>0?e.toFixed(2):Math.round(e).toLocaleString("en-US"))(t*d)," PTS"]}),d>1&&(0,n.jsxs)("span",{className:"text-micro text-pts/60",children:["(",d,"x)"]})]})]})},H=new Set(["noRoute","unavailable","error","zero","rateLimited","belowMinimum","amountTooLarge"]),X="So11111111111111111111111111111111111111112",Y="EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";function $(e,t){let r=parseFloat(e),n=Number(t);if(!Number.isFinite(r)||r<=0||!Number.isFinite(n))return{ok:!1,reason:"invalidAmount"};let a=Math.floor(r*Math.pow(10,n));return a<1?{ok:!1,reason:"belowMinimum"}:Number.isSafeInteger(a)?{ok:!0,value:a.toString()}:{ok:!1,reason:"amountTooLarge"}}function Q(e,t){switch(e){case"belowMinimum":return"That amount is below the smallest unit of ".concat(t||"this token",". Enter a larger amount.");case"amountTooLarge":return"That amount is too large to quote. Enter a smaller amount.";default:return"Enter a valid amount."}}let G=e=>{var t,r,i,P;let{showDetails:O,slippage:z=5,defaultOutputMint:W,defaultInputMint:G}=e,[J,K]=(0,T.useState)(!1),Z=(0,A.useSearchParams)(),ee=null!=(r=null!=(t=Z.get("inputMint"))?t:G)?r:X,et=null!=(P=null!=(i=Z.get("outputMint"))?i:W)?P:Y,{connected:er,publicKey:en,signAllTransactions:ea,sendTransaction:es}=(0,u.v)(),{connection:ei}=(0,d.w)(),[el,eo]=(0,T.useState)(null),{tokenMap:ec,routeMap:eu,loaded:ed,api:em,searchTokens:ep}=(0,F.Ew)(),{getPriceForToken:ef}=(0,M.oM)(),{toast:ex}=(0,x.dj)(),{award:eh,canAward:ew}=(0,q.j)(),[eb,ev]=(0,T.useState)([]),[eg,ey]=(0,T.useState)(null),[ej,eN]=(0,T.useState)(ec.get(ee)),[eS,ek]=(0,T.useState)(ec.get(et)),[eA,eT]=(0,T.useState)(!1),[eF,eM]=(0,T.useState)("idle"),eE=(0,T.useRef)(null),[eR,eC]=(0,T.useState)("loading"),eP=(0,T.useRef)(""),eL="loading"===eR,eD="ok"===eR,{holdings:e_,nativeBalance:eI,refresh:eB}=(0,E.H)(en),[eU,eq]=(0,T.useState)("1"),eO=(0,T.useRef)(eU),[ez,eW]=(0,T.useState)(null),[eV,eH]=(0,T.useState)(!1),eX=(0,T.useRef)(new Set),eY=(0,T.useCallback)(async e=>{try{let t=await fetch("/api/jupiter/tokens/v2/search?query=".concat(e));if(!t.ok)return console.warn("Token not found: ".concat(e)),null;let r=await t.json(),n=Array.isArray(r)?r.find(t=>
1t.id===e):null;if(n&&n.id)return{address:n.id,name:n.name,symbol:n.symbol,logoURI:n.icon,decimals:n.decimals,tags:n.tags||[],extensions:{},chainId:101};return null}catch(t){return console.error("Failed to fetch token info for ".concat(e,":"),t),null}},[]);(0,T.useEffect)(()=>{let e=async()=>{if(ee&&!ec.get(ee)&&!eX.current.has(ee)){eX.current.add(ee);let e=await eY(ee);e&&eN(e)}if(et&&!ec.get(et)&&!eX.current.has(et)){eX.current.add(et);let e=await eY(et);e&&ek(e)}};ed&&e()},[ee,et,ec,ed,eY]),(0,T.useEffect)(()=>{let e=ec.get(ee),t=ec.get(et);e&&eN(e),t&&ek(t)},[ec,ee,et]),(0,T.useEffect)(()=>{window.Buffer=y.Buffer},[]);let e$=Math.round(10*z),eQ=(0,T.useRef)(null),eG=(0,T.useRef)(null);(0,T.useEffect)(()=>()=>{eQ.current&&clearTimeout(eQ.current)},[]);let eJ=T.useCallback(async()=>{var e;if(!ej||!eS||!parseFloat(eU)||0>=parseFloat(eU)){eC("idle"),eo(null);return}if(ej.address===eS.address){eo(null),eC("sameToken");return}let t=$(eU,ej.decimals);if("reason"in t){eo(null),eC(t.reason);return}eC("loading");try{let e=new URLSearchParams({inputMint:null==ej?void 0:ej.address,outputMint:null==eS?void 0:eS.address,amount:t.value,slippageBps:e$.toString(),referralAccount:"Do1w56nR14EPqLD5FWDBzjsjarBXdaF3Rd5XkfneS9x",referralFee:"50"});en&&e.set("taker",en.toBase58());let r="/api/jupiter/swap/v2/order?".concat(e.toString()),n=function(e){return Object.keys(e).sort().map(t=>{var r;return"".concat(t,"=").concat(null!=(r=e[t])?r:"")}).join("&")}({url:r}),{status:a,ok:s,order:i}=await L(n,async()=>{let e=await fetch(r);if(429===e.status)return{status:429,ok:!1,order:null};let t=null;try{t=await e.json()}catch(e){console.error("Order error: unparseable response",e)}return{status:e.status,ok:e.ok,order:t}});if(429===a){console.error("Order error: rate limited (HTTP 429)"),C.delete(n),eo(null),eC("rateLimited"),eQ.current&&clearTimeout(eQ.current),eQ.current=setTimeout(()=>{var e;eQ.current=null,null==(e=eG.current)||e.call(eG)},2500);return}let l={ok:s,status:a},o=Number(null==i?void 0:i.outAmount);i&&Number.isFinite(o)&&o>0?(eo(i),eC("ok")):i&&Number.isFinite(o)?(console.error("Order error: route returned outAmount 0"),eo(null),eC("zero")):(console.error("Order error:",i&&(i.errorMessage||i.error)||"HTTP ".concat(l.status)),eP.current=String(i&&(i.errorMessage||i.error)||"HTTP ".concat(l.status)).slice(0,160),eo(null),eC(l.ok?"noRoute":"unavailable"))}catch(t){console.error("Failed to fetch order:",t),eP.current=String(null!=(e=null==t?void 0:t.message)?e:t).slice(0,160),eo(null),eC("error")}},[eU,ej,eS,e$,en]);eG.current=eJ,(0,T.useEffect)(()=>{let e=setTimeout(()=>{eJ()},350);return()=>clearTimeout(e)},[eJ]);let eK=null==eb?void 0:eb[0];(0,T.useEffect)(()=>{!J&&eK&&(ey(eK),K(!0))},[ed,eK,J]),(0,T.useEffect)(()=>{K(!1)},[ej,eS,eL]);let eZ=async()=>{var e,t,r,a,i,u,d,m;if(!(null==eS?void 0:eS.address))return void(0,R.reportDeadEnd)("swap","press_without_output_token");(0,o.u)("trade_press",{vertical:"swap"});let p="build",f=(null==ej?void 0:ej.address)===c.FX.toBase58(),x=parseFloat(eU);!(!x||isNaN(x))&&isFinite(x)&&(null==ej?void 0:ej.address)||ex({variant:"destructive",title:"Error",description:(0,n.jsx)("div",{className:"flex flex-col gap-1",children:(0,n.jsx)("p",{className:"text-xs font-bold",children:"Invalid amount"})})});let w=f?(null==eI?void 0:eI.uiAmount)||0:(null==e_||null==(e=e_.get(null==ej?void 0:ej.address))?void 0:e.uiAmount)||0;if(null===e3)return eB(),ex({variant:"destructive",title:"Balance not loaded yet",description:(0,n.jsx)("p",{className:"text-xs font-bold",children:"Could not read your wallet balance. Try again in a moment."})});if((0,D.UX)(eU,null==ej?void 0:ej.decimals,e3))return(0,R.reportFriction)("insufficient_balance","swap_input",{vertical:"swap",wallet:null==en?void 0:en.toBase58(),meta:{have:w,needed:x,symbol:null==ej?void 0:ej.symbol}}),ex({variant:"destructive",title:"Not enough ".concat(ej.symbol),description:(0,n.jsxs)("p",{className:"text-xs font-bold",children:["Your wallet has ",l()(w,4)," ",ej.symbol,"."]})});let v=[];try{if(!eL&&el&&en&&ea){eT(!0);let e=$(eU,null==ej?void 0:ej.decimals);if("reason"in e)return eT(!1),ex({variant:"destructive",title:"Error",description:(0,n.jsx)("p",{className:"text-xs font-bold",children:Q(e.reason,null==ej?void 0:ej.symbol)})});let l=new URLSearchParams({inputMint:null==ej?void 0:ej.address,outputMint:null==eS?void 0:eS.address,amount:e.value,taker:en.toBase58(),slippageBps:e$.toString(),referralAccount:"Do1w56nR14EPqLD5FWDBzjsjarBXdaF3Rd5XkfneS9x",referralFee:"50"}),c="/api/jupiter/swap/v2/order?".concat(l.toString()),m=await fetch(c),{transaction:f,requestId:x}=await m.json();if(!f||!x)throw Error("Invalid order response - missing transaction or requestId");let w=y.Buffer.from(f,"base64"),v=b.VersionedTransaction.deserialize(w);eM("signing"),eE.current=ex({title:"Pending Wallet Signature",description:(0,n.jsxs)("span",{className:"flex items-center gap-2 text-xs",children:[(0,n.jsx)(j.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),"Approve transaction in your wallet"]}),duration:18e4}),(0,o.u)("sign_request",{vertical:"swap"}),p="signing";let N=await (0,s.Q5)(ea([v]));if(!N||0===N.length)throw Error("Failed to sign transaction");
1eM("submitting"),null==(t=eE.current)||t.update({id:eE.current.id,title:"Submitting Transaction",description:(0,n.jsxs)("span",{className:"flex items-center gap-2 text-xs",children:[(0,n.jsx)(j.A,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),"Swapping ".concat(eU," ").concat(null!=(r=null==ej?void 0:ej.symbol)?r:""," for ").concat(null!=(a=null==eS?void 0:eS.symbol)?a:"","…")]}),duration:18e4});let S=y.Buffer.from(N[0].serialize()).toString("base64");(0,o.u)("tx_sent",{vertical:"swap"}),p="submitting";let{status:k,signature:A,error:T}=(await g.A.post("/api/jupiter/swap/v2/execute",{signedTransaction:S,requestId:x},{headers:{"Content-Type":"application/json"}})).data;if("Success"===k&&A)ew&&e9>0&&(eh(A,"swap",e9).catch(console.warn),(0,o.y)("swap",{usd:e9})),null==(i=eE.current)||i.dismiss(),eE.current=null,ex({variant:"success",title:"Swap Successful",description:(0,n.jsx)("p",{className:"text-xs",children:"Swapped ".concat(eU," ").concat(null!=(u=null==ej?void 0:ej.symbol)?u:""," for ").concat(null!=(d=null==eS?void 0:eS.symbol)?d:"")}),action:(0,n.jsx)(h.Qg,{altText:"View on Solscan",onClick:()=>{window.open("https://solscan.io/tx/".concat(A),"_blank")},children:"View on Solscan ↗"})});else throw Error(T||"Transaction execution failed")}}catch(t){console.error("Error",t),(0,R.reportTxFailure)("swap",p,t,{wallet:null==en?void 0:en.toBase58(),meta:{in:null==ej?void 0:ej.symbol,out:null==eS?void 0:eS.symbol,amount:eU}}),null==(m=eE.current)||m.dismiss(),eE.current=null;let e=v.length>0?v[v.length-1]:null;ex({variant:"destructive",title:"Transaction Failed",description:(0,n.jsx)("p",{className:"text-xs",children:function(e){let t=e instanceof Error?e.message:String(null!=e?e:""),r=t.toLowerCase();return r.includes("user rejected")||r.includes("user denied")||r.includes("rejected the request")?"User rejected transaction":r.includes("slippage")?"Slippage exceeded — try again or raise your slippage":r.includes("blockhash")?"Blockhash expired — the quote went stale, try again":r.includes("insufficient")?"Insufficient balance for this swap":r.includes("simulation")?"Transaction simulation failed":r.includes("not confirmed")?"Transaction was not confirmed in time":t||"Transaction failed"}(t)}),...e?{action:(0,n.jsx)(h.Qg,{altText:"View on Solscan",onClick:()=>{window.open("https://solscan.io/tx/".concat(e),"_blank")},children:"View on Solscan ↗"})}:{}})}eB(),eT(!1),eM("idle")},e0=el&&(Number(el.outAmount)||0)/Math.pow(10,(null==eS?void 0:eS.decimals)||1),e1=(0,T.useMemo)(()=>{switch(eR){case"sameToken":return"You cannot swap a token for itself. Pick a different token on one side, or use the switch button.";case"zero":return"This route pays out nothing for that amount right now. Try a larger amount.";case"noRoute":return"No route available for this pair right now.";case"rateLimited":return"Too many quote requests just now, so the price could not be fetched. This is not a price of zero — wait a few seconds and retry.";case"unavailable":return"The quote service could not price this swap right now. Retry in a moment.";case"error":return"Could not reach the quote service. Check your connection and retry.";case"belowMinimum":case"amountTooLarge":case"invalidAmount":return Q(eR,null==ej?void 0:ej.symbol);default:return null}},[eR,null==ej?void 0:ej.symbol]),e2="rateLimited"===eR||"unavailable"===eR||"error"===eR||"noRoute"===eR;(0,a.t)("swap",H.has(eR)?"quote_".concat(eR):null,{in:null==ej?void 0:ej.symbol,out:null==eS?void 0:eS.symbol,detail:eP.current});let e3=(0,T.useMemo)(()=>(0,D.DW)(null==ej?void 0:ej.address,{nativeSol:eI,tokens:e_}),[null==ej?void 0:ej.address,eI,e_]),e4=er&&(0,D.UX)(eU,null==ej?void 0:ej.decimals,e3),e5=(0,T.useRef)(new Set);(0,T.useEffect)(()=>{let e=null==ej?void 0:ej.address;(0,D.qj)(e4,eU,eO.current)&&(!e||e5.current.has(e)||(e5.current.add(e),(0,R.reportFriction)("insufficient_balance","swap_input",{vertical:"swap",wallet:null==en?void 0:en.toBase58(),meta:{needed:eU,symbol:null==ej?void 0:ej.symbol}})))},[e4,null==ej?void 0:ej.address,eU===eO.current]);let e6=async()=>{eA||(eJ(),eB())};(0,v.A)(()=>{e6()},3e4);let[e9,e8]=(0,T.useState)(0),[e7,te]=(0,T.useState)(0);(0,T.useEffect)(()=>{el&&void 0!==el.inUsdValue?e8(el.inUsdValue):(async()=>
1{if(ej)try{let e=await ef(ej.address);e8(e*(Number(eU)||0))}catch(e){console.error("Error fetching input token price:",e),e8(0)}})()},[ej,eU,el,ef]),(0,T.useEffect)(()=>{el&&void 0!==el.outUsdValue?te(el.outUsdValue):(async()=>{if(!eS||!e0)return te(0);try{let e=await ef(eS.address);te(e*(Number(e0)||0))}catch(e){console.error("Error fetching output token price:",e),te(0)}})()},[eS,e0,el,ef]),(0,T.useEffect)(()=>{(async()=>{var e;if((null==el||null==(e=el.platformFee)?void 0:e.amount)&&el.feeMint)try{let e=ec.get(el.feeMint),t=(null==e?void 0:e.decimals)||9,r=Number(el.platformFee.amount)/Math.pow(10,t),n=await ef(el.feeMint);eW(r*n)}catch(e){console.error("Error calculating fee:",e),eW(null)}else eW(null)})()},[el,ec,ef]);let tt=(0,T.useMemo)(()=>{let e=null==el?void 0:el.priceImpactPct;if(null==e||""===e)return null;let t=100*Number(e);return Number.isFinite(t)?t:null},[el]),tr=(0,T.useMemo)(()=>{if(null===tt)return"text-[var(--c-text-2)]";let e=Math.abs(tt);return e>5?"text-[var(--c-red)]":e>=1?"text-[var(--c-warn)]":"text-[var(--c-text-2)]"},[tt]),tn=(0,T.useMemo)(()=>{if(null===tt)return"-";let e=Math.abs(tt);return e>0&&e<.01?"< 0.01%":"".concat(tt.toFixed(2),"%")},[tt]),ta=(0,T.useMemo)(()=>{var e,t;let r=null!=(t=null==el||null==(e=el.platformFee)?void 0:e.feeBps)?t:null==el?void 0:el.feeBps;return null!=r&&Number.isFinite(Number(r))?Number(r)/100:null},[el]),ts=(0,T.useMemo)(()=>{var e;let t=null!==ta?"".concat(ta.toFixed(2),"%"):null,r=null!==ez?"~$".concat(ez.toFixed(4)):null;return t&&r?"".concat(t," (").concat(r,")"):null!=(e=null!=t?t:r)?e:"-"},[ta,ez]),ti=(0,T.useMemo)(()=>{let e=Number(null==el?void 0:el.slippageBps);return Number.isFinite(e)&&e>0?e/100:e$>0?e$/100:Number.isFinite(e)?e/100:null},[el,e$]),tl=(0,T.useMemo)(()=>{if(!el||!eS)return null;let e=Math.pow(10,eS.decimals),t=Number(el.outAmount),r=Number(el.otherAmountThreshold),n=Number.isFinite(r)&&r>0;return Number.isFinite(t)?n&&r<t?r/e:t*(1-e$/1e4)/e:n?r/e:null},[el,eS,e$]),to=(0,T.useMemo)(()=>{if(null===tl||!eS)return"-";let e=Number(eS.decimals),t=Number.isFinite(e)?Math.min(Math.max(Math.trunc(e),0),20):6,[r,n=""]=tl.toFixed(t+2).split("."),a=e=>Number("".concat(r,".").concat(n.slice(0,e)||"0")),s=Math.max(0,Math.min(tl>=1?2:tl>=.01?4:6,t));return tl>0&&0===a(s)&&(s=t),"".concat(a(s).toLocaleString("en-US",{minimumFractionDigits:s,maximumFractionDigits:s})," ").concat(eS.symbol)},[tl,eS]),tc=(0,T.useMemo)(()=>{let e=e=>{let t=Number(e);return Number.isFinite(t)&&t>0?t:0},t=e(null==el?void 0:el.signatureFeeLamports),r=e(null==el?void 0:el.prioritizationFeeLamports),n=e(null==el?void 0:el.rentFeeLamports);return t+r+n>0?{baseSol:(t+n)/b.LAMPORTS_PER_SOL,prioritySol:r/b.LAMPORTS_PER_SOL,isEstimate:!1}:{baseSol:5e3/b.LAMPORTS_PER_SOL,prioritySol:null,isEstimate:!0}},[el]);return(0,A.usePathname)(),(0,n.jsx)(n.Fragment,{children:(0,n.jsxs)("div",{className:"w-full flex flex-col gap-3",children:[(0,n.jsxs)("div",{className:"w-full bg-[var(--c-surface-1)] rounded-md p-4 border border-[var(--c-border)]","data-tour":"swap-form",children:[(0,n.jsxs)("div",{className:"mb-1",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,n.jsx)("span",{className:"text-xs text-muted-foreground font-normal",children:"You pay"}),(0,n.jsx)(_.T,{jupiterHoldings:e_,token:ej,setInput:eq,nativeBalance:eI})]}),ej?(0,n.jsxs)("div",{className:"flex justify-between items-start gap-3",children:[(0,n.jsx)(I.I,{tokenInfo:ej,setCoin:eN,isInput:!0,excludeMint:null==eS?void 0:eS.address,showWalletSection:!0}),(0,n.jsxs)("div",{className:"flex flex-col items-end flex-1",children:[(0,n.jsx)(p.p,{value:eU,type:"number",min:"0",inputMode:"decimal","aria-label":"Amount to pay".concat((null==ej?void 0:ej.symbol)?" in ".concat(ej.symbol):""),onChange:e=>{let t=e.target.value.trim();t.startsWith("-")||eq(t.replace(/^0+(?=\d)/,""))},className:"border-0 bg-transparent ".concat(eU.length>8?eU.length>12?"text-lead sm:text-title":"text-title sm:text-title":"text-title sm:text-display"," font-semibold text-text text-right placeholder:text-[var(--c-text-3)] p-0 h-auto w-full font-inter leading-tight [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"),placeholder:"0.00"}),e9>0&&(0,n.jsxs)("div",{className:"text-sm text-[var(--c-text-2)] mt-1",children:["$",e9.toLocaleStr
1ing("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})]})]})]}):(0,n.jsx)(f.E,{className:"h-16 w-full rounded-xl bg-inner"})]}),(0,n.jsxs)("div",{className:"relative my-2",children:[(0,n.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,n.jsx)("div",{className:"w-full border-t border-border"})}),(0,n.jsx)("div",{className:"relative flex justify-center",children:(0,n.jsx)(m.$,{onClick:()=>{if((null==ej?void 0:ej.address)&&ej.address===(null==eS?void 0:eS.address)){let e=ej.address===X?Y:X,t=ec.get(e);if(!t)return;ek(t);return}let e={...ej};eN(eS),ek(e)},disabled:!ej||!eS,size:"icon","aria-label":"Swap input and output tokens",title:"Swap input and output tokens",className:"h-touch w-touch rounded-full bg-[var(--c-surface-2)] hover:bg-[var(--c-surface-3)] border border-[var(--c-border)] disabled:opacity-50",children:(0,n.jsx)(N.A,{className:"h-4 w-4 text-primary"})})})]}),(0,n.jsxs)("div",{className:"mt-1 pt-2",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center mb-2",children:[(0,n.jsx)("span",{className:"text-xs text-muted-foreground font-normal",children:"You receive"}),(0,n.jsx)(_.T,{jupiterHoldings:e_,token:eS,nativeBalance:eI,isSend:!1})]}),eS?(0,n.jsxs)("div",{className:"flex justify-between items-start gap-3",children:[(0,n.jsx)(I.I,{tokenInfo:eS,setCoin:ek,isInput:!1,excludeMint:null==ej?void 0:ej.address,showWalletSection:!0}),(0,n.jsxs)("div",{className:"flex flex-col items-end flex-1 min-w-0 overflow-hidden",children:[(0,n.jsx)("div",{className:"".concat(e0&&e0.toString().length>8?e0.toString().length>12?"text-read sm:text-lead":"text-lead sm:text-lg":"text-title sm:text-display"," font-semibold text-text font-inter leading-tight w-full text-right truncate"),children:"loading"===eR?(0,n.jsx)("span",{className:"text-[var(--c-text-3)]",children:"Loading..."}):"ok"===eR&&e0?Number(e0).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}):"zero"===eR?"0.00":(0,n.jsx)("span",{className:"text-[var(--c-text-3)]",children:"—"})}),(0,n.jsx)("div",{className:"text-sm text-[var(--c-text-2)] mt-1 min-h-[20px]",children:e7>0&&"$".concat(e7.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}))})]})]}):(0,n.jsx)(f.E,{className:"h-16 w-full rounded-xl bg-inner"})]})]}),(0,n.jsx)(V,{inputUsdValue:e9}),er&&en?(0,n.jsx)(m.$,{onClick:eZ,className:"w-full h-14 text-base font-semibold rounded-xl",disabled:!er||eA||!ed||!eD||!ej||!eS||!eU||0>=parseFloat(eU)||e4,children:er?ej&&eS?!eU||0>=parseFloat(eU)?"Enter an amount":e4?"Insufficient ".concat(ej.symbol):eL?"Finding best route...":"sameToken"===eR?"Select two different tokens":"belowMinimum"===eR?"Amount too small":"amountTooLarge"===eR?"Amount too large":"invalidAmount"===eR?"Enter an amount":"rateLimited"===eR||"unavailable"===eR||"error"===eR?"Quote unavailable":"zero"===eR?"No output for this amount":eD?"signing"===eF?(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)(j.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),"Approve in Wallet…"]}):"submitting"===eF||eA?(0,n.jsxs)("span",{className:"flex items-center gap-2",children:[(0,n.jsx)(j.A,{className:"h-4 w-4 animate-spin","aria-hidden":!0}),"Submitting…"]}):"Swap ".concat(ej.symbol," to ").concat(eS.symbol):"No route found":"Select tokens":"Connect Wallet"}):(0,n.jsxs)("div",{className:"flex justify-center items-center w-full",children:[(0,n.jsx)("div",{className:"block sm:hidden w-full",children:(0,n.jsx)(U.R,{label:"Connect Wallet",buttonClassName:"w-full h-14 rounded-xl text-base font-semibold bg-primary text-black hover:bg-primary/90 transition-all duration-200 border-none"})}),(0,n.jsx)("div",{className:"hidden sm:block w-full",children:(0,n.jsx)(B.z,{buttonClassName:"w-full h-14 rounded-xl text-base font-semibold bg-primary text-black hover:bg-primary/90 transition-all duration-200 border-none"})})]}),(0,n.jsx)(V,{inputUsdValue:e9,placement:"below"}),e1&&(0,n.jsxs)("div",{role:"alert",className:"w-full flex flex-col items-center gap-1.5 px-2",children:[(0,n.jsx)("p",{className:"text-xs text-[var(--c-red)] text-center",children:e1}),e2&&(0,n.jsx)("button",{type:"button",onClick:()=>{eJ()},className:"rounded-md border border-[var(--c-border)] bg-[var(--c-surface-2)] px-3 py-1.5 text-caption font-medium text-[var(--c-text-1)] transition-colors hover:bg-[var(--c-surface-3)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--c-text-1)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--c-surface-1)]",children:"Retry quote"})]}),eD&&null!==tt&&Math.abs(tt)>5&&(0,n.jsxs)("p",{role:"alert",className:"w-full text-xs text-[var(--c-red)] text-center px-2",children:["High price impact ",tn," — you would lose a large part of this trade to the route. Try a smaller amount."]}),el&&eD&&(0,n.jsxs)("div",{className:"w-full bg-[var(--c-surface-1)] rounded-md pt-0 pb-3 border border-[var(--c-border)]",children:[(0,n.jsxs)("button",{onClick:()=>eH(!eV),className:"w-full min-h-touch flex justify-between items-center text-xs hover:opacity-80 transition-opacity px-4",children:[(0,n.jsx)("span",{className:"text-text font-medium truncate min-w-0 flex-1 text-left",children:ej&&eS&&el.inAmount&&el.outAmount?"1 ".concat(ej.symbol," = ").concat((Number(el.outAmount)/Math.pow(10,eS.decimals)/(Number(el.inAmount)/Math.pow(10,ej.decimals))).toLocaleStr
1ing("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})," ").concat(eS.symbol):"N/A"}),eV?(0,n.jsx)(S.A,{className:"h-4 w-4 text-muted-foreground"}):(0,n.jsx)(k.A,{className:"h-4 w-4 text-muted-foreground"})]}),(0,n.jsxs)("div",{className:"mt-3 pt-3 border-t border-border space-y-2 px-4",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center text-xs",title:"Full gap between the USD value you pay and the USD value you receive. The platform fee is already part of it.",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Price impact (incl. fee)"}),(0,n.jsx)("span",{className:(0,w.cn)("font-medium",tr),children:tn})]}),(0,n.jsxs)("div",{className:"flex justify-between items-center text-xs",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Minimum received"}),(0,n.jsx)("span",{className:"text-text font-medium",children:to})]}),(0,n.jsxs)("div",{className:"flex justify-between items-center text-xs",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Slippage"}),(0,n.jsx)("span",{className:"text-text font-medium",children:null!==ti?"".concat(ti.toFixed(2),"%"):"-"})]})]}),eV&&(0,n.jsxs)("div",{className:"mt-3 pt-3 border-t border-border space-y-2 px-4",children:[(0,n.jsxs)("div",{className:"flex justify-between items-center text-xs",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Provider"}),(0,n.jsx)("span",{className:"text-text font-medium",children:el.routePlan&&el.routePlan.length>0?el.routePlan.map(e=>e.swapInfo.label).join(" → "):"N/A"})]}),(0,n.jsxs)("div",{className:"flex justify-between items-center text-xs",title:"Breakdown of the price impact above, not an extra charge on top of it.",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Platform fee (included above)"}),(0,n.jsx)("span",{className:"text-text font-medium",children:ts})]}),(0,n.jsxs)("div",{className:"flex justify-between items-center text-xs",title:tc.isEstimate?"Solana base fee for one signature. A priority fee and the rent of a new token account (if you do not hold the output token yet) are added when the swap transaction is built.":"Signature and account-rent fees reported by the router for this route.",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:tc.isEstimate?"Network fee (min.)":"Network fee"}),(0,n.jsx)("span",{className:"text-text font-medium",children:"".concat(tc.isEstimate?"~":"").concat(tc.baseSol.toFixed(6)," SOL")})]}),null!==tc.prioritySol&&(0,n.jsxs)("div",{className:"flex justify-between items-center text-xs",title:"Fee the router attaches to get this transaction landed. It is set automatically for the current network load and is re-priced every time the quote refreshes.",children:[(0,n.jsx)("span",{className:"text-muted-foreground",children:"Priority fee (set by the router)"}),(0,n.jsx)("span",{className:"text-text font-medium",children:"".concat(tc.prioritySol.toFixed(6)," SOL")})]})]})]})]})})}},62947:(e,t,r)=>{r.d(t,{oM:()=>i,un:()=>l});var n=r(37063),a=r(89900),s=r(13741);let i=()=>{let{getTokenPrice:e,getTokenPrices:t,loading:r,error:i,rateLimited:l,retryAfter:o}=(0,a.X)(),c=(0,s.useCallback)(t=>(0,n.I)({queryKey:["token-price",t],queryFn:async()=>{try{return{price:await e(t),tokenId:t}}catch(e){throw console.error("Error fetching price for ".concat(t,":"),e),e}},staleTime:3e4,gcTime:3e5,retry:3,retryDelay:e=>Math.min(1e3*2**e,3e4),enabled:!!t}),[e]),u=(0,s.useCallback)(e=>(0,n.I)({queryKey:["token-prices",e.sort().join(",")],queryFn:async()=>{try{return await t(e)}catch(e){throw console.error("Error fetching multiple token prices:",e),e}},staleTime:3e4,gcTime:3e5,retry:3,retryDelay:e=>Math.min(1e3*2**e,3e4),enabled:e.length>0}),[t]);return{useTokenPrice:c,useTokenPrices:u,getPriceForToken:(0,s.useCallback)(async t=>{try{return await e(t)}catch(e){return console.error("Error fetching price for ".concat(t,":"),e),0}},[e]),getPricesForTokens:(0,s.useCallback)(async e=>{try{let r=await t(e),n={};return Object.entries(r).forEach(e=>{let[t,r]=e;n[t]=r.usdPrice}),n}catch(e){return console.error("Error fetching multiple token prices:",e),{}}},[t]),loading:r,error:i,rateLimited:l,retryAfter:o}},l=e=>{let{useTokenPrice:t}=i();return t(e)}},83229:(e,t,r)=>{r.d(t,{j:()=>u});var n=r(13741),a=r(29334),s=r(34723);async function i(e){let t=new TextEncoder().encode(e);return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",t))).map(e=>e.toString(16).padStart(2,"0")).join("")}async function l(e){try{var t;let r=await fetch("/api/r",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({th:e.tokenHash,sig:e.txSignature,t:e.actionType,amt:e.usdAmount,w:e.walletAddress,mul:null!=(t=e.multiplier)?t:1})}),n=await r.json();if(1===n.s)return{success:!0,pointsAwarded:n.p||0};return{success:!1,pointsAwarded:0,error:n.m||"Unknown error"}}catch(e){return console.error("Failed to award points:",e),{success:!1,pointsAwarded:0,error:"Network error"}}}var o=r(10613),c=r(23548);function u(){let{publicKey:e}=(0,a.v)(),{isAuthenticated:t,session:r,userProfile:u,scheduleProfileRefresh:d}=(0,s.iJ)(),m=e=>new Promise(t=>setTimeout(t,e)),p=(0,n.useCallback)(async function(n,a,s){let f=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;
1if(!t||!(null==r?void 0:r.authToken))return console.warn("[useRewardsAward] Cannot award: not authenticated"),{success:!1,pointsAwarded:0,error:"Not authenticated"};if(!e)return console.warn("[useRewardsAward] Cannot award: wallet not connected"),{success:!1,pointsAwarded:0,error:"Wallet not connected"};if(s<=0)return console.warn("[useRewardsAward] Cannot award: invalid amount",s),{success:!1,pointsAwarded:0,error:"Invalid amount"};if(!n||n.length<32)return console.warn("[useRewardsAward] Cannot award: invalid signature",n),{success:!1,pointsAwarded:0,error:"Invalid transaction signature"};try{var x;let t=await i(r.authToken),h=null!=(x=null==u?void 0:u.pointMultiplier)?x:1;console.log("[useRewardsAward] Awarding points:",{actionType:a,usdAmount:s,multiplier:h,signature:n.slice(0,16)+"...",attempt:f+1});let w=await l({tokenHash:t,txSignature:n,actionType:a,usdAmount:s,multiplier:h,walletAddress:e.toBase58()});if(w.success)console.log("[useRewardsAward] Successfully awarded ".concat(w.pointsAwarded," points")),(0,c.y)(a,{pts:w.pointsAwarded}),setTimeout(()=>{d()},1500),w.pointsAwarded>0&&(0,o.Y2)(w.pointsAwarded);else if(console.warn("[useRewardsAward] Failed to award points:",w.error),["rate limit","timeout","network error","verification failed","Transaction not found"].some(e=>{var t;return null==(t=w.error)?void 0:t.toLowerCase().includes(e.toLowerCase())})&&f<2)return console.log("[useRewardsAward] Retrying in ".concat(2e3,"ms (attempt ").concat(f+2,"/").concat(3,")")),await m(2e3),p(n,a,s,f+1);return w}catch(e){if(console.error("[useRewardsAward] Award points error:",e),f<2)return console.log("[useRewardsAward] Retrying after error in ".concat(2e3,"ms (attempt ").concat(f+2,"/").concat(3,")")),await m(2e3),p(n,a,s,f+1);return{success:!1,pointsAwarded:0,error:e.message||"Failed to award points"}}},[t,r,u,d,e]);return{award:(0,n.useCallback)(async(e,t,r)=>p(e,t,r,0),[p]),canAward:t&&!!(null==r?void 0:r.authToken)&&!!e,isAuthenticated:t}}}}]);

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.