@liberfi.io/ui-predict 0.1.96 → 0.1.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -15
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
'use strict';var react=require('react'),ui=require('@liberfi.io/ui'),uiScaffold=require('@liberfi.io/ui-scaffold'),i18n=require('@liberfi.io/i18n'),jsxRuntime=require('react/jsx-runtime'),walletConnector=require('@liberfi.io/wallet-connector'),reactQuery=require('@tanstack/react-query'),Gr=require('canvas-confetti'),reactPredict=require('@liberfi.io/react-predict'),types=require('@liberfi.io/types'),utils=require('@liberfi.io/utils'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils$1=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Gr__default=/*#__PURE__*/_interopDefault(Gr);typeof window<"u"&&(window.__LIBERFI_VERSION__=window.__LIBERFI_VERSION__||{},window.__LIBERFI_VERSION__["@liberfi.io/ui-predict"]="0.1.96");var pi="0.1.96";var mi={Weather:["Daily temperature","Snow and rain","Climate change","Natural disasters","Hurricanes"],Companies:["IPOs","Product launches","KPIs","Elon Musk","CEOs","Layoffs"],Crypto:["BTC","15 min","Hourly","ETH","SOL","DOGE","Pre-Market","XRP","BNB","HYPE"],Economics:["Growth","Fed","Inflation","Oil and energy","Employment","Housing","Jobs & Economy","Bankruptcy & Defaults","GDP","Global Central Banks"],Elections:["Primaries","International elections"],Entertainment:["Music","Movies","Music charts","Television","Awards","Video games","Oscars","Rotten Tomatoes"],Financials:["S&P","Nasdaq","Daily","Metals","Treasuries","Oil","EUR/USD","USD/JPY","WTI"],Mentions:["Politicians","Earnings","Entertainment"],Politics:["Trump","Congress","International","SCOTUS & courts","Local","Recurring","Iran","House"],Science:["AI","Energy","Space"],Social:null,Sports:["Soccer","Basketball","Baseball","Football","Hockey","Golf","Tennis","Motorsport","Esports","Boxing","MMA","Rugby","Lacrosse","Mentions","Chess","Cricket","Aussie Rules","Darts"],World:null},to=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],zr=(()=>{let e=t=>{let r=to.indexOf(t);return r===-1?to.length:r};return Object.entries(mi).map(([t,r])=>({slug:t,label:t,tags:(r??[]).map(o=>({slug:o,label:o}))})).sort((t,r)=>e(t.slug)-e(r.slug))})();function oo({categories:e,selectedCategory:t,selectedTag:r,activeTags:o,onCategorySelect:n,onTagSelect:i,trailing:l,pulsingTab:s="Trending",className:a}){let{t:c}=i18n.useTranslation(),u=react.useCallback(()=>{n(null);},[n]),d=c("predict.categories.trending");return jsxRuntime.jsxs("div",{className:ui.cn("sticky top-0 z-30 flex w-full flex-col justify-between gap-2 px-4 py-1 lg:px-2 lg:py-1",a),children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center gap-2",children:[jsxRuntime.jsx("div",{className:"hideScrollbar min-w-0 flex-1 overflow-x-auto overflow-y-hidden",children:jsxRuntime.jsxs("div",{className:"flex min-h-8 items-stretch gap-x-2 lg:min-h-9",children:[jsxRuntime.jsx(ro,{label:d,isSelected:t===null,onPress:u,showPulse:d===s}),jsxRuntime.jsx(xi,{}),e.map(p=>jsxRuntime.jsx(ro,{label:p.category,isSelected:t===p.category,onPress:()=>n(p.category),badge:p.badge,showPulse:p.category===s},p.category))]})}),l&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:l})]}),t&&o.length>0&&jsxRuntime.jsx("div",{className:"hideScrollbar overflow-x-auto overflow-y-hidden flex items-center",children:jsxRuntime.jsxs("div",{className:"flex gap-x-1 pl-2 lg:w-full lg:gap-x-2",children:[jsxRuntime.jsx(no,{label:c("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),o.map(p=>jsxRuntime.jsx(no,{label:p.label,icon:p.icon,isSelected:r===p.label,onPress:()=>i(p.label)},p.label))]})})]})}function ro({label:e,isSelected:t,onPress:r,badge:o,showPulse:n}){return jsxRuntime.jsxs("button",{type:"button",onClick:r,className:ui.cn("relative shrink-0 cursor-pointer whitespace-nowrap border-b p-1 text-base font-normal capitalize transition-colors",t?"border-primary/50 text-primary":"border-transparent text-neutral-500 hover:text-neutral-300"),children:[n?jsxRuntime.jsxs("span",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-[rgb(240,68,56)]"}),jsxRuntime.jsx("span",{children:e})]}):e,o&&jsxRuntime.jsx("span",{className:"absolute -right-1 top-0 rounded bg-primary px-0.5 py-px text-[0.625rem] font-semibold leading-none text-neutral-950",children:o})]})}function xi(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function no({label:e,icon:t,isSelected:r,onPress:o}){return jsxRuntime.jsxs("button",{type:"button",onClick:o,className:ui.cn("flex shrink-0 items-center justify-center gap-x-1 min-w-14 rounded-2xl border px-2 py-1 text-sm font-medium uppercase transition-colors cursor-pointer",r?"border-transparent bg-primary text-black":"border-border/80 text-neutral-200 hover:bg-primary/10 hover:text-primary"),children:[t&&jsxRuntime.jsx("span",{className:ui.cn("iconify size-4",t)}),e]})}function of({count:e=6}){return jsxRuntime.jsx("div",{className:"flex w-full flex-col gap-2 px-4 py-1 lg:px-2 lg:py-1",children:jsxRuntime.jsx("div",{className:"flex min-h-8 items-center gap-x-2 lg:min-h-9",children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-16 shrink-0 rounded"},r))})})}function vi(e){return e.map(t=>({category:t.label,tags:t.tags.map(r=>r.label)}))}function bi(e){return e?e.tags.map(t=>({label:t.label,icon:t.icon})):[]}function io({onSelect:e,trailing:t,className:r}){let[o,n]=react.useState(null),[i,l]=react.useState(null),s=react.useCallback(p=>{n(p),l(null),e?.({categorySlug:p,tagSlug:null});},[e]),a=react.useCallback(p=>{l(p),e?.({categorySlug:o,tagSlug:p});},[o,e]),c=vi(zr),u=zr.find(p=>p.slug===o),d=bi(u);return jsxRuntime.jsx(oo,{categories:c,selectedCategory:o,selectedTag:i,activeTags:d,onCategorySelect:s,onTagSelect:a,trailing:t,className:r})}function lo(e){return {title:e.title,imageUrl:e.image_url}}function co(e){let t=e.outcomes[0],r=e.outcomes[1];return {question:e.question,yesAsk:t?.best_ask??t?.price,noAsk:r?.best_ask??r?.price,yesBid:t?.best_bid,noBid:r?.best_bid,yesSubTitle:t?.label??"Yes",noSubTitle:r?.label??"No"}}var Rt=48,Ur=4,sr={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},Me={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},ar=Me.ALL,ff={[Me.ONE_DAY]:sr.ONE_MINUTE,[Me.ONE_WEEK]:sr.ONE_HOUR,[Me.ONE_MONTH]:sr.ONE_HOUR,[Me.ALL]:sr.ONE_DAY},gf={[Me.ONE_DAY]:300,[Me.ONE_WEEK]:3600,[Me.ONE_MONTH]:10800,[Me.ALL]:1440*60},hf={[Me.ONE_DAY]:1440*60,[Me.ONE_WEEK]:10080*60,[Me.ONE_MONTH]:720*60*60,[Me.ALL]:null},Kr=1,xf=1,vf=1,bf=99,vt={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},yf=vt.ONE_WEEK,kf={[vt.ONE_HOUR]:60,[vt.SIX_HOURS]:60,[vt.ONE_DAY]:300,[vt.ONE_WEEK]:1800,[vt.MAX]:1800};var mo=react.createContext(null);function jr(){let e=react.useContext(mo);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var Ci=1e4;function Mi({pollingInterval:e=Ci,enabled:t=true,children:r}){let o=walletConnector.useWallets(),n=react.useMemo(()=>o.find(v=>v.chainNamespace===types.ChainNamespace.SOLANA&&v.isConnected)?.address,[o]),i=react.useMemo(()=>o.find(v=>v.chainNamespace===types.ChainNamespace.EVM&&v.isConnected)?.address,[o]),{data:l,isLoading:s,isFetching:a,error:c}=reactPredict.useBalance({source:"kalshi",user:n??""},{enabled:t&&!!n,refetchInterval:e}),{data:u,isLoading:d}=reactPredict.useDFlowKYC(n,{enabled:t&&!!n,refetchInterval:3e4}),{data:p,isLoading:m}=reactPredict.usePolymarketSetup(i,{enabled:t&&!!i,refetchInterval:3e4}),f=p?.safe_address,g=p?.verified??false,{data:h,isLoading:x,isFetching:P,error:y}=reactPredict.useBalance({source:"polymarket",user:f??""},{enabled:t&&g&&!!f,refetchInterval:e}),N=react.useMemo(()=>({solanaAddress:n,evmAddress:i,polymarketSafeAddress:f,kalshiUsdcBalance:l?Number(l.balance):null,polymarketUsdcBalance:g&&h?Number(h.balance):null,kalshiKycVerified:u?.verified??false,kalshiKycUrl:u?.kyc_url??null,kalshiKycLoading:d,polymarketSetupVerified:g,polymarketSafeDeployed:p?.safe_deployed??false,polymarketTokenApproved:p?.token_approved??false,polymarketSetupLoading:m,isLoading:s||x,isFetching:a||P,error:c??y??null}),[n,i,f,l,h,g,u,d,p,m,s,x,a,P,c,y]);return jsxRuntime.jsx(mo.Provider,{value:N,children:r})}var Yi={minutes:60,hours:3600,days:86400};function qi(e,t,r){let o=Math.floor(Date.now()/1e3);switch(e){case "5m":return o+300;case "1h":return o+3600;case "12h":return o+720*60;case "24h":return o+1440*60;case "eod":{let n=new Date;return n.setUTCHours(23,59,59,0),Math.floor(n.getTime()/1e3)}case "custom":return o+t*Yi[r]}}function Yr(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};Gr__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{Gr__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{Gr__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}function xo({market:e,initialOutcome:t="yes",initialSide:r="buy"}){let{t:o}=i18n.useTranslation(),{status:n}=walletConnector.useAuth(),i=walletConnector.useWallets(),l=walletConnector.useSwitchChain(),s=reactPredict.usePredictClient(),a=react.useContext(reactPredict.PolymarketContext),c=reactQuery.useQueryClient(),u=e.source,d=u==="polymarket",p=i.find(C=>C.chainNamespace===types.ChainNamespace.SOLANA&&C.isConnected),m=i.find(C=>C.chainNamespace===types.ChainNamespace.EVM&&C.isConnected&&"switchChain"in C),f=n==="authenticated",g=p?.address,h=m?.address,[x,P]=react.useState(t),[y,N]=react.useState(r),[v,H]=react.useState("market"),[b,q]=react.useState(NaN),[V,le]=react.useState(NaN),[z,A]=react.useState(false),[$,F]=react.useState(null),[se,pe]=react.useState(null),[M,L]=react.useState(false),[U,_]=react.useState(false),[oe,ge]=react.useState("1h"),[me,Xe]=react.useState(30),[at,Or]=react.useState("minutes"),ze=null,Zt=false,Jt=null,ht;try{let C=jr();ze={kalshiUsdcBalance:C.kalshiUsdcBalance,polymarketUsdcBalance:C.polymarketUsdcBalance,isLoading:C.isLoading},Zt=C.kalshiKycVerified,Jt=C.kalshiKycUrl,ht=C.polymarketSafeAddress;}catch{}let Se=react.useMemo(()=>{let C=x==="yes"?0:1,Q=e.outcomes[C];return y==="buy"?Q?.best_ask??Q?.price??.5:Q?.best_bid??Q?.price??.5},[e.outcomes,x,y]),Ar=react.useCallback(C=>{H(C);},[]),D=react.useCallback(C=>{P(C),le(NaN);},[]);react.useEffect(()=>{v==="limit"&&isNaN(V)&&le(Math.round(Se*100)/100);},[v,V,Se]);let _e=react.useMemo(()=>isNaN(b)||b<=0?0:y==="buy"?Se>0?b/Se:0:b,[y,b,Se]),Ue=react.useMemo(()=>isNaN(b)||b<=0?"0":String(Math.round(b*1e6)),[b]),Ua=e.provider_meta?.["dflow.yesMint"]??"",Ka=e.provider_meta?.["dflow.noMint"]??"",it=utils.SOLANA_TOKENS.stablecoins.USDC.address,Va=e.provider_meta?.["dflow.collateralMint"]||"",Un=x==="yes"?Ua:Ka,Kn=u==="kalshi"?g??"":h??"",{data:Re,isLoading:ja}=reactPredict.usePositions({source:u,user:Kn},{enabled:!!Kn}),Vn=react.useMemo(()=>!Re||y!=="sell"?null:Re.positions.find(C=>C.side?.toLowerCase()===x&&C.market?.slug===e.slug)??null,[Re,e.slug,x,y])?.market?.provider_meta,Ga=y==="sell"&&Vn?.["dflow.outcomeMint"]||Un,Et=y==="sell"&&Vn?.["dflow.collateralMint"]||Va,Tt=y==="buy"?it:Ga,Lt=y==="buy"?Un:Et||it,Ya=u==="kalshi"&&!!Tt&&!!Lt&&!!g&&Ue!=="0",{refetch:jn}=reactPredict.useDFlowQuote({inputMint:Tt,outputMint:Lt,amount:Ue,userPublicKey:g??"",slippageBps:100},{enabled:Ya}),er=react.useMemo(()=>ze?u==="kalshi"?ze.kalshiUsdcBalance:ze.polymarketUsdcBalance:Re&&Re.positions.reduce((Q,Ce)=>Ce.side==="USDC"||Ce.side==="collateral"?Q+(Ce.current_value??0):Q,0)||null,[ze,Re,u]),qa=ze?ze.isLoading:ja,Dr=react.useMemo(()=>Re?Re.positions.find(Q=>Q.side?.toLowerCase()==="yes"&&Q.market?.slug===e.slug)?.size??0:null,[Re,e.slug]),Fr=react.useMemo(()=>Re?Re.positions.find(Q=>Q.side?.toLowerCase()==="no"&&Q.market?.slug===e.slug)?.size??0:null,[Re,e.slug]),Br=react.useMemo(()=>v==="limit"&&d&&!isNaN(V)?V:Se,[v,d,V,Se]),tr=react.useMemo(()=>{if(isNaN(b)||b<=0)return 0;if(y==="buy")return b;let C=x==="yes"?e.outcomes[0]?.best_bid??0:e.outcomes[1]?.best_bid??0;return b*C},[y,x,b,e.outcomes]),Gn=react.useMemo(()=>isNaN(b)||b<=0?0:y==="buy"?Br>0?b/Br*1:0:tr,[y,b,Br,tr]),Qa=Gn-tr,Xa=react.useCallback(C=>{N(C),q(NaN);},[]),Za=react.useCallback(C=>{if(isNaN(C)){q(NaN);return}let Q=Math.max(0,C),Ce=y==="buy"?Math.round(Q*100)/100:Math.round(Q);q(Ce);},[y]),Ja=react.useCallback(C=>{if(isNaN(C)){le(NaN);return}let Q=Math.max(.01,Math.min(.99,C));le(Math.round(Q*100)/100);},[]),Hr=react.useMemo(()=>{let C=[];(isNaN(b)||b<Kr)&&C.push(`Minimum quantity is ${Kr}`),e.status!=="open"&&C.push("Market is not active"),y==="buy"&&er!=null&&!isNaN(b)&&b>0&&b>er&&C.push("Insufficient USDC balance");let Q=x==="yes"?Dr:Fr;return y==="sell"&&Q!=null&&!isNaN(b)&&b>0&&b>Q&&C.push("Insufficient shares"),v==="limit"&&d&&(isNaN(V)||V<.01||V>.99)&&C.push("Limit price must be between $0.01 and $0.99"),v==="limit"&&d&&U&&oe==="custom"&&(isNaN(me)||me<=0)&&C.push(o("predict.trade.expiration.invalidDate")),{isValid:C.length===0,errors:C}},[b,e.status,y,er,Dr,Fr,x,v,d,V,U,oe,me,o]),{mutateAsync:rr}=reactPredict.useDFlowSubmit(),{data:$r}=reactPredict.useOrder({id:$??"",source:u},{enabled:!!$}),Yn=react.useCallback(async()=>{if(!se||!g||!p)return;let{cashAmount:C,collateral:Q}=se;pe(null);try{let lt=(await s.createDFlowQuote({inputMint:Q,outputMint:it,amount:C,userPublicKey:g,slippageBps:100}))?.transaction;if(!lt)return;let Ze=Uint8Array.from(atob(lt),_t=>_t.charCodeAt(0)),Ke=await p.signTransaction(Ze);await rr({signedTransaction:btoa(String.fromCharCode(...Ke)),orderContext:{user_public_key:g,input_mint:Q,output_mint:it,amount:C,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[se,g,p,s,rr,it]);react.useEffect(()=>{if(!$r||!$)return;let{status:C}=$r;C==="closed"?(F(null),se?Yn().finally(()=>{A(false),ui.toast.success(o("predict.trade.submitSuccess")),Yr(),q(NaN);}):(A(false),ui.toast.success(o("predict.trade.submitSuccess")),Yr(),q(NaN))):(C==="failed"||C==="expired")&&(A(false),F(null),pe(null),ui.toast.error(o("predict.trade.submitError")));},[$r,$,se,Yn,o]);let qn=react.useCallback(async()=>{if(!g||!p)return;if(!Tt||!Lt){ui.toast.error("Missing token mint addresses"),A(false);return}if(!Zt){L(true),A(false);return}let Ce=(await jn()).data,lt=Ce?.transaction;if(!lt){ui.toast.error(o("predict.trade.submitError")),A(false);return}if(y==="sell"&&Et&&Et!==it){let Je=String(Ce?.outAmount??"");Je&&Je!=="0"&&pe({cashAmount:Je,collateral:Et});}let Ze=Uint8Array.from(atob(lt),Je=>Je.charCodeAt(0)),Ke=await p.signTransaction(Ze),_t=await rr({signedTransaction:btoa(String.fromCharCode(...Ke)),orderContext:{user_public_key:g,input_mint:Tt,output_mint:Lt,amount:Ue,price:String(Se),side:y==="buy"?"BUY":"SELL",outcome:x==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});F(_t.signature);},[g,p,s,jn,rr,Tt,Lt,Ue,Se,y,x,e.slug,Et,it,o]),Qn=react.useCallback(async()=>{if(!m||!a)return;let C=m.chain,Q=C!==types.Chain.POLYGON;Q&&await l(types.Chain.POLYGON);try{let Ce=await m.getEip1193Provider();if(!Ce){ui.toast.error(o("predict.trade.submitError")),A(!1);return}let lt=!!ht,Ze={address:m.address,signatureType:lt?2:0,signTypedData:async(ct,li,ci,di)=>{let xt=[];"name"in ct&&xt.push({name:"name",type:"string"}),"version"in ct&&xt.push({name:"version",type:"string"}),"chainId"in ct&&xt.push({name:"chainId",type:"uint256"}),"verifyingContract"in ct&&xt.push({name:"verifyingContract",type:"address"}),"salt"in ct&&xt.push({name:"salt",type:"bytes32"});let ui={EIP712Domain:xt,...li};return await Ce.request({method:"eth_signTypedData_v4",params:[m.address,JSON.stringify({domain:ct,types:ui,primaryType:ci,message:di})]})}},Ke=a.credentials??await a.authenticate(Ze),_t=x==="yes"?0:1,Je="",nr=e.provider_meta?.["polymarket.clobTokenIds"];nr&&(Je=(typeof nr=="string"?JSON.parse(nr):nr)[_t]??"");let Xn=e.provider_meta?.["polymarket.negRisk"]??!1,Wr=v==="limit"&&!isNaN(V)?V:Se,ti=v==="limit"?U?"GTD":"GTC":"FOK",ri=y==="buy"&&Wr>0?b/Wr:b,Zn={tokenId:Je,price:Wr,size:ri,side:y==="buy"?"BUY":"SELL",orderType:ti,tickSize:"0.01",negRisk:Xn,...ht&&{funderAddress:ht},...v==="limit"&&U&&{expiration:qi(oe,me,at)}},ni=reactPredict.buildCtfExchangeDomain(Xn),Jn=reactPredict.buildOrderMessage({...Zn,signerAddress:Ze.address,signatureType:Ze.signatureType}),oi=await Ze.signTypedData(ni,reactPredict.CTF_ORDER_TYPES,"Order",Jn),si=reactPredict.buildSignedOrder(Jn,oi,Zn.orderType),eo=reactPredict.buildClobPayload(si,Ke.apiKey),ai=JSON.stringify(eo),ii=await reactPredict.buildPolymarketL2Headers(Ke.address,{apiKey:Ke.apiKey,secret:Ke.secret,passphrase:Ke.passphrase,method:"POST",requestPath:"/order",body:ai});await s.createPolymarketOrder(eo,ii),c.invalidateQueries({queryKey:["predict","orders"]}),c.invalidateQueries({queryKey:["predict","positions"]}),ui.toast.success(o("predict.trade.submitSuccess")),Yr(),q(NaN),A(!1);}finally{Q&&C&&l(C).catch(()=>{});}},[m,a,l,x,e.provider_meta,v,V,Se,b,y,s,c,U,oe,me,at,o]),ei=react.useCallback(async()=>{if(!(!Hr.isValid||!f)){A(true),F(null),L(false);try{u==="kalshi"?await qn():await Qn();}catch{ui.toast.error(o("predict.trade.submitError")),A(false);}}},[Hr.isValid,f,u,qn,Qn,o]);return {outcome:x,side:y,orderType:v,quantity:b,limitPrice:V,shares:_e,estimatedCost:tr,potentialPayout:Gn,potentialProfit:Qa,usdcBalance:er,yesTokenBalance:Dr,noTokenBalance:Fr,isBalanceLoading:qa,isSubmitting:z,validation:Hr,supportsLimitOrder:d,kycRequired:M,kycUrl:Jt,expirationEnabled:U,expirationPreset:oe,customDuration:me,customDurationUnit:at,setOutcome:D,setSide:Xa,setOrderType:Ar,setQuantity:Za,setLimitPrice:Ja,setExpirationEnabled:_,setExpirationPreset:ge,setCustomDuration:Xe,setCustomDurationUnit:Or,submit:ei}}function bo({isOpen:e,onClose:t,kycUrl:r}){let{t:o}=i18n.useTranslation();return jsxRuntime.jsx(ui.Modal,{isOpen:e,onClose:t,size:"md",children:jsxRuntime.jsxs(ui.ModalContent,{children:[jsxRuntime.jsx(ui.ModalHeader,{className:"flex flex-col gap-1",children:jsxRuntime.jsxs("span",{className:"text-lg",children:["\u{1F6E1}\uFE0F ",o("predict.trade.kycModalTitle")]})}),jsxRuntime.jsxs(ui.ModalBody,{className:"gap-y-4",children:[jsxRuntime.jsx("p",{className:"text-sm text-default-600",children:o("predict.trade.kycModalDescription")}),jsxRuntime.jsxs("ul",{className:"flex flex-col gap-y-2 text-sm text-foreground",children:[jsxRuntime.jsxs("li",{className:"flex items-start gap-x-2",children:[jsxRuntime.jsx("span",{className:"mt-0.5 text-primary",children:"\u2713"}),jsxRuntime.jsx("span",{children:o("predict.trade.kycModalBullet1")})]}),jsxRuntime.jsxs("li",{className:"flex items-start gap-x-2",children:[jsxRuntime.jsx("span",{className:"mt-0.5 text-primary",children:"\u2713"}),jsxRuntime.jsx("span",{children:o("predict.trade.kycModalBullet2")})]}),jsxRuntime.jsxs("li",{className:"flex items-start gap-x-2",children:[jsxRuntime.jsx("span",{className:"mt-0.5 text-primary",children:"\u2713"}),jsxRuntime.jsx("span",{children:o("predict.trade.kycModalBullet3")})]})]}),jsxRuntime.jsx("p",{className:"text-xs text-default-400",children:o("predict.trade.kycModalNote")})]}),jsxRuntime.jsxs(ui.ModalFooter,{children:[jsxRuntime.jsx(ui.Button,{variant:"light",onPress:t,children:o("common.cancel")}),r&&jsxRuntime.jsx(ui.Button,{color:"primary",onPress:()=>{window.open(r,"_blank","noopener,noreferrer"),t();},children:o("predict.trade.goToKYC")})]})]})})}var dl=`https://s1.chainstream.io/chains/sol/tokens/${utils.SOLANA_TOKENS.stablecoins.USDC.address}/image.png`,ul=["5m","1h","12h","24h","eod","custom"],pl={"5m":"predict.trade.expiration.5m","1h":"predict.trade.expiration.1h","12h":"predict.trade.expiration.12h","24h":"predict.trade.expiration.24h",eod:"predict.trade.expiration.eod",custom:"predict.trade.expiration.custom"},ml=["minutes","hours","days"],fl={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"};function Co({event:e,market:t,variant:r="bordered",outcome:o,side:n,orderType:i,quantity:l,limitPrice:s,shares:a,potentialProfit:c,potentialPayout:u,estimatedCost:d,usdcBalance:p,yesTokenBalance:m,noTokenBalance:f,isBalanceLoading:g,isSubmitting:h,isValid:x,validationErrors:P,supportsLimitOrder:y,kycRequired:N,kycUrl:v,expirationEnabled:H,expirationPreset:b,customDuration:q,customDurationUnit:V,onOutcomeChange:le,onSideChange:z,onOrderTypeChange:A,onQuantityChange:$,onLimitPriceChange:F,onExpirationEnabledChange:se,onExpirationPresetChange:pe,onCustomDurationChange:M,onCustomDurationUnitChange:L,onSubmit:U}){let{t:_}=i18n.useTranslation(),[oe,ge]=react.useState(false),me=ui.useDisclosure();react.useEffect(()=>{N&&!me.isOpen&&me.onOpen();},[N]);let Xe=react.useMemo(()=>{let D=n==="buy"?o==="yes"?t.yesAsk:t.noAsk:o==="yes"?t.yesBid:t.noBid;return D!=null?parseFloat((Number(D)*100).toFixed(2)):null},[n,o,t]),at=!isNaN(l)&&l>0,Or=react.useMemo(()=>{if(h)return _("predict.trade.submitting");if(N)return _("predict.trade.kycRequired");if(!at)return _("predict.trade.enterAmount");let D=_(n==="buy"?"predict.trade.buy":"predict.trade.sell"),_e=_(o==="yes"?"predict.trade.yes":"predict.trade.no"),Ue=n==="buy"&&c>0?` \u2192 Win $${c.toFixed(2)}`:"";return `${D} ${_e}${Ue}`},[h,N,at,n,o,c,_]),ze=react.useMemo(()=>o==="yes"?"primary":"secondary",[o]),Zt=()=>{$(Math.floor((p??0)/2*100)/100);},Jt=()=>{$(p??0);},[ht,Se]=react.useState(false),Ar=()=>{if(N){me.onOpen();return}if(!x){Se(true);return}Se(false),U();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:ui.cn("flex w-full flex-col gap-y-4 p-4",r==="bordered"&&"rounded-xl border border-default-200 bg-content1"),children:[e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3",children:[e.imageUrl&&jsxRuntime.jsx("img",{src:e.imageUrl,alt:e.title,className:"h-10 w-10 shrink-0 rounded-lg object-cover"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral-500 leading-tight line-clamp-1",children:e.title}),jsxRuntime.jsxs("span",{className:"text-base font-semibold leading-tight line-clamp-1",children:[jsxRuntime.jsxs("span",{className:o==="yes"?"text-bullish":"text-bearish",children:[_(n==="buy"?"predict.trade.buy":"predict.trade.sell")," ",_(o==="yes"?"predict.trade.yes":"predict.trade.no")]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[y?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:i,onSelectionChange:D=>A(D),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:_("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:_("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:_("predict.trade.market")}),i==="limit"&&y?jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",value:isNaN(s)?void 0:parseFloat((s*100).toFixed(2)),onValueChange:D=>F(D/100),minValue:1,maxValue:99,step:1,formatOptions:{maximumFractionDigits:2},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):Xe!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[Xe," \xA2"]})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(D=>{let _e=D==="yes"?m:f;return jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col gap-y-1",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>le(D),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${o===D?D==="yes"?"border-primary bg-primary-50 text-primary":"border-secondary bg-secondary-50 text-secondary":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:_(D==="yes"?"predict.trade.yes":"predict.trade.no")}),(()=>{let Ue=n==="buy"?D==="yes"?t.yesAsk:t.noAsk:D==="yes"?t.yesBid:t.noBid;return Ue!=null?jsxRuntime.jsxs("span",{className:"ml-1 opacity-70",children:[parseFloat((Number(Ue)*100).toFixed(2)),"\xA2"]}):null})()]}),n==="sell"&&o===D&&jsxRuntime.jsx("span",{className:"text-center text-xs text-foreground",children:g?"\u2013":`${_e??0} shares`})]},D)})}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:_(n==="buy"?"predict.trade.youArePaying":"predict.trade.contracts")}),n==="buy"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("img",{src:dl,alt:"USDC",className:"h-3.5 w-3.5 rounded-full object-cover"}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:p!=null?`${p.toFixed(2)} USDC`:"\u2013"}),jsxRuntime.jsx("button",{type:"button",onClick:Zt,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:_("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:Jt,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:_("predict.trade.max")})]})]}),jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",value:isNaN(l)?void 0:l,onValueChange:D=>{Se(false),$(D);},minValue:0,step:n==="buy"?.01:1,formatOptions:n==="buy"?{maximumFractionDigits:2}:{maximumFractionDigits:0},startContent:n==="buy"?jsxRuntime.jsx("span",{className:"text-default-600 text-xl",children:"$"}):void 0,classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}},n),n==="sell"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2 justify-end",children:[[25,50].map(D=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{$(Math.floor((o==="yes"?m??0:f??0)*D/100));},className:"rounded-md bg-content2 px-2.5 py-1 text-xs font-medium text-default-600 transition-colors hover:bg-content3 cursor-pointer",children:[D,"%"]},D)),jsxRuntime.jsx("button",{type:"button",onClick:()=>{$(o==="yes"?m??0:f??0);},className:"rounded-md bg-content2 px-2.5 py-1 text-xs font-medium text-default-600 transition-colors hover:bg-content3 cursor-pointer",children:_("common.all")})]}),ht&&P.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:P.map(D=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:D},D))})]}),i==="limit"&&y&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary",children:_("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:H,onValueChange:se,"aria-label":_("predict.trade.setExpiration")})]}),H&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":_("predict.trade.setExpiration"),selectedKeys:[b],onSelectionChange:D=>{let _e=Array.from(D)[0];_e&&pe(_e);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:ul.map(D=>jsxRuntime.jsx(ui.SelectItem,{children:_(pl[D])},D))}),b==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(q)?void 0:q,onValueChange:M,minValue:1,step:1,formatOptions:{maximumFractionDigits:0},classNames:{base:"flex-1",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 min-h-10",input:"text-sm"}}),jsxRuntime.jsx(ui.Select,{"aria-label":"Duration unit",selectedKeys:[V],onSelectionChange:D=>{let _e=Array.from(D)[0];_e&&L(_e);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:ml.map(D=>jsxRuntime.jsx(ui.SelectItem,{children:_(fl[D])},D))})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-sm",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>ge(D=>!D),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:_("predict.trade.odds")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-3.5 w-3.5 transition-transform",oe&&"rotate-180")})]}),Xe!=null&&jsxRuntime.jsxs("span",{className:"text-foreground font-medium tabular-nums",children:[Xe,"% chance"]})]}),oe&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5 border-l-2 border-default-300 pl-3 text-sm text-neutral-500",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Total Size"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(l)&&l>0?`$${d.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"No. of Contracts"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(a)&&a>0?parseFloat(a.toFixed(2)):"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Payout"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(l)&&l>0?`$${u.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Est. Profit"}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(l)&&l>0&&c>0?`+$${c.toFixed(2)}`:"\u2013"})]})]})]}),jsxRuntime.jsx(ui.Button,{color:ze,fullWidth:true,radius:"lg",size:"lg",isDisabled:!at||h,isLoading:h,onPress:Ar,children:Or})]}),jsxRuntime.jsx(bo,{isOpen:me.isOpen,onClose:me.onClose,kycUrl:v})]})}function ir({event:e,market:t,variant:r,initialSide:o,initialOutcome:n,chain:i}){let{outcome:l,side:s,orderType:a,quantity:c,limitPrice:u,shares:d,estimatedCost:p,potentialPayout:m,potentialProfit:f,usdcBalance:g,yesTokenBalance:h,noTokenBalance:x,isBalanceLoading:P,isSubmitting:y,validation:N,supportsLimitOrder:v,kycRequired:H,kycUrl:b,expirationEnabled:q,expirationPreset:V,customDuration:le,customDurationUnit:z,setOutcome:A,setSide:$,setOrderType:F,setQuantity:se,setLimitPrice:pe,setExpirationEnabled:M,setExpirationPreset:L,setCustomDuration:U,setCustomDurationUnit:_,submit:oe}=xo({market:t,initialSide:o,initialOutcome:n}),ge=walletConnector.useAuthCallback(oe),me=react.useMemo(()=>e?lo(e):void 0,[e]),Xe=react.useMemo(()=>co(t),[t]);return jsxRuntime.jsx(Co,{event:me,market:Xe,variant:r,outcome:l,side:s,orderType:a,quantity:c,limitPrice:u,shares:d,estimatedCost:p,potentialPayout:m,potentialProfit:f,usdcBalance:g,yesTokenBalance:h,noTokenBalance:x,isBalanceLoading:P,isSubmitting:y,isValid:N.isValid,validationErrors:N.errors,supportsLimitOrder:v,kycRequired:H,kycUrl:b,expirationEnabled:q,expirationPreset:V,customDuration:le,customDurationUnit:z,onOutcomeChange:A,onSideChange:$,onOrderTypeChange:F,onQuantityChange:se,onLimitPriceChange:pe,onExpirationEnabledChange:M,onExpirationPresetChange:L,onCustomDurationChange:U,onCustomDurationUnitChange:_,onSubmit:ge})}var It="predict-trade";function lr({id:e=It}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Sl,{...t})})}function Sl({params:e,isOpen:t,onOpenChange:r}){let{isMobile:o}=ui.useScreen();return e?jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"blur",radius:"lg",children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsx(ui.ModalBody,{className:"p-2",children:jsxRuntime.jsx(ir,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,initialSide:e.initialSide??"buy",chain:e.chain,variant:"flat"})})})}):null}var Xr={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function Zr(e){let t=0;return e.source&&t++,e.timeRemaining&&t++,e.minVolume&&t++,e.minLiquidity&&t++,t}function To({isOpen:e,onClose:t,value:r,onChange:o}){let{t:n}=i18n.useTranslation(),[i,l]=react.useState(r),s=react.useCallback(h=>{h?l(r):t();},[r,t]),a=react.useCallback(()=>{l(Xr);},[]),c=react.useCallback(()=>{o(i),t();},[i,o,t]),u=react.useCallback((h,x)=>{l(P=>({...P,[h]:x}));},[]),d=react.useMemo(()=>Zr(i),[i]),p=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"polymarket",label:n("predict.platform.polymarket")},{value:"kalshi",label:n("predict.platform.kalshi")}],[n]),m=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1d",label:n("predict.filter.lessThanDay")},{value:"7d",label:n("predict.filter.lessThanWeek")},{value:"30d",label:n("predict.filter.lessThanMonth")}],[n]),f=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[n]),g=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[n]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:s,size:"md",scrollBehavior:"inside",children:jsxRuntime.jsxs(ui.ModalContent,{children:[jsxRuntime.jsx(ui.ModalHeader,{className:"px-4 py-2",children:jsxRuntime.jsx("span",{className:"text-base font-semibold",children:n("predict.filter.title")})}),jsxRuntime.jsxs(ui.ModalBody,{className:"flex flex-col gap-5",children:[jsxRuntime.jsx(dr,{label:n("predict.filter.platform"),children:jsxRuntime.jsx(ur,{options:p,selected:i.source,onSelect:h=>u("source",h)})}),jsxRuntime.jsx(dr,{label:n("predict.filter.timeRemaining"),children:jsxRuntime.jsx(ur,{options:m,selected:i.timeRemaining,onSelect:h=>u("timeRemaining",h)})}),jsxRuntime.jsx(dr,{label:n("predict.filter.minVolume"),children:jsxRuntime.jsx(ur,{options:f,selected:i.minVolume,onSelect:h=>u("minVolume",h)})}),jsxRuntime.jsx(dr,{label:n("predict.filter.minLiquidity"),children:jsxRuntime.jsx(ur,{options:g,selected:i.minLiquidity,onSelect:h=>u("minLiquidity",h)})})]}),jsxRuntime.jsx(ui.ModalFooter,{className:"px-4",children:jsxRuntime.jsxs("div",{className:"w-full flex justify-between items-center",children:[jsxRuntime.jsx(ui.Button,{variant:"light",color:"default",size:"sm",radius:"full",startContent:jsxRuntime.jsx(ui.RefreshIcon,{width:16,height:16}),onPress:a,children:n("predict.filter.reset")}),jsxRuntime.jsxs(ui.Button,{color:"primary",size:"sm",radius:"full",onPress:c,children:[n("predict.filter.showResults"),d>0&&jsxRuntime.jsxs("span",{className:"ml-1 text-xs opacity-80",children:["(",d,")"]})]})]})})]})})}function dr({label:e,children:t}){return jsxRuntime.jsxs("div",{className:"flex flex-col gap-2.5",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-foreground",children:e}),t]})}function ur({options:e,selected:t,onSelect:r,allowDeselect:o=true}){return jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:e.map(n=>{let i=t===n.value;return jsxRuntime.jsx("button",{type:"button",onClick:()=>{r(i&&o?void 0:n.value);},className:ui.cn("shrink-0 rounded-lg px-3 py-1.5 text-xs font-medium transition-colors duration-150 cursor-pointer border",i?"bg-primary/15 text-primary border-primary/40":"bg-content2 text-foreground/60 border-default-100 hover:bg-default-100 hover:text-foreground"),children:n.label},n.value??"__all")})})}var Io={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},_o={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},zl=["start_time","volume","liquidity","ending_soon"];function Oo({sortPreset:e,onSortChange:t,sortAsc:r,onSortAscChange:o,onFilterPress:n,filterCount:i=0,className:l}){let{t:s}=i18n.useTranslation(),[a,c]=react.useState(false),u=react.useRef(null);react.useEffect(()=>{if(!a)return;let p=f=>{u.current&&!u.current.contains(f.target)&&c(false);},m=f=>{f.key==="Escape"&&c(false);};return document.addEventListener("mousedown",p),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",m);}},[a]);let d=Ro[e];return jsxRuntime.jsxs("div",{className:ui.cn("flex items-center gap-2",l),children:[jsxRuntime.jsxs("div",{ref:u,className:"relative flex shrink-0 items-center rounded-full border border-border",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>c(p=>!p),className:"flex shrink-0 items-center gap-2 px-3 py-1.5 text-xs font-medium text-neutral transition-colors hover:text-primary/80 cursor-pointer",children:[jsxRuntime.jsx(d,{className:"size-[18px] shrink-0"}),jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:s(_o[e])})]}),jsxRuntime.jsx("div",{className:"h-6 w-px bg-border"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>o(!r),className:"px-2.5 py-1.5 text-xs text-neutral transition-colors hover:text-primary/80 cursor-pointer",children:r?"\u2191":"\u2193"}),a&&jsxRuntime.jsx("div",{className:"absolute left-0 top-full z-20 mt-1 flex min-w-max flex-col gap-0.5 rounded-lg border border-border bg-content1 p-1 shadow-lg",children:zl.map(p=>{let m=Ro[p];return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{t(p),c(false);},className:ui.cn("flex w-full items-center gap-2 rounded px-2.5 py-1.5 text-xs font-medium transition-colors cursor-pointer",p===e?"bg-primary/10 text-primary":"text-neutral hover:bg-content2 hover:text-foreground"),children:[jsxRuntime.jsx(m,{className:"size-4 shrink-0"}),jsxRuntime.jsx("span",{children:s(_o[p])})]},p)})})]}),jsxRuntime.jsx(ui.StyledBadge,{content:i>0?i:void 0,color:"primary",size:"sm",isInvisible:i===0,children:jsxRuntime.jsxs("button",{type:"button",onClick:n,className:"flex shrink-0 items-center gap-2 rounded-full border border-border px-3 py-1.5 text-xs font-medium text-neutral transition-colors hover:text-primary/80 cursor-pointer",children:[jsxRuntime.jsx(ui.FilterIcon,{className:"size-[18px]"}),jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:s("predict.filter.title")})]})})]})}var Ro={start_time:ui.CalendarIcon,volume:ui.ChartLineIcon,liquidity:ui.DropletIcon,ending_soon:ui.TimerIcon};function Fo(e={}){let t=react.useMemo(()=>reactPredict.resolveEventsParams(e),[e.tagSlugSelection,e.limit,e.status,e.sort_by,e.sort_asc,e.source,e.with_markets,e.minVolume,e.minLiquidity,e.timeRemaining]),{data:r,isLoading:o,isFetching:n,isFetchingNextPage:i,isError:l,error:s,hasNextPage:a,fetchNextPage:c,refetch:u}=reactPredict.useInfiniteEvents(t),d=react.useMemo(()=>r?.pages.flatMap(f=>f.items).filter(f=>f!=null)??[],[r]),p=react.useCallback(()=>{c();},[c]),m=react.useCallback(()=>{u();},[u]);return {data:d,isLoading:o,isFetching:n&&!i,isFetchingMore:i,isError:l,error:s??null,hasMore:a??false,fetchMore:p,refetch:m}}function Jr({count:e=6}){return jsxRuntime.jsx("div",{className:"grid w-full grid-cols-1 gap-0 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx("div",{className:"p-2",children:jsxRuntime.jsxs("div",{className:"flex h-full min-h-52 flex-col rounded-xl border border-border/90 bg-background p-3 lg:min-h-72 lg:p-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(ui.Skeleton,{className:"size-10 shrink-0 rounded-lg"}),jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-11/12 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3 w-2/5 rounded"})]})]}),jsxRuntime.jsxs("div",{className:"mt-3 flex flex-1 flex-col gap-2 lg:gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-1/2 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-[85px] rounded-lg lg:h-9 lg:w-24"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-3/5 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-[85px] rounded-lg lg:h-9 lg:w-24"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-2/5 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-[85px] rounded-lg lg:h-9 lg:w-24"})]})]}),jsxRuntime.jsxs("div",{className:"mt-auto flex items-center justify-between pt-3",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-3 w-20 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3 w-24 rounded"})]})]})},r))})}function Mg({count:e=48}){return jsxRuntime.jsxs("div",{className:"flex h-full w-full max-w-[1680px] mx-auto flex-col gap-y-3",children:[jsxRuntime.jsxs("div",{className:"flex min-h-8 items-center justify-between gap-3 lg:min-h-9",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-16 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-20 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-16 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-20 rounded"})]}),jsxRuntime.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-28 rounded-full"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-24 rounded-full"})]})]}),jsxRuntime.jsx("div",{className:"min-h-0 flex-1",children:jsxRuntime.jsx(Jr,{count:e})})]})}var Bo=3,tn={bg:"hsl(var(--heroui-primary) / 0.14)",text:"hsl(var(--heroui-primary))",shadow:"hsl(var(--heroui-primary) / 0.18)"},Ko={bg:"hsl(var(--heroui-secondary) / 0.14)",text:"hsl(var(--heroui-secondary))",shadow:"hsl(var(--heroui-secondary) / 0.18)"},Xl={bg:"rgba(239, 68, 68, 0.14)",text:"rgb(239, 68, 68)",shadow:"rgba(239, 68, 68, 0.18)"},Dt=[{bg:"rgba(139,92,246,0.14)",text:"rgb(139,92,246)",shadow:"rgba(139,92,246,0.18)"},{bg:"rgba(34,197,94,0.14)",text:"rgb(34,197,94)",shadow:"rgba(34,197,94,0.18)"},{bg:"rgba(0,166,212,0.14)",text:"rgb(0,166,212)",shadow:"rgba(0,166,212,0.18)"},{bg:"rgba(194,120,32,0.14)",text:"rgb(194,120,32)",shadow:"rgba(194,120,32,0.18)"},{bg:"rgba(202,138,4,0.14)",text:"rgb(202,138,4)",shadow:"rgba(202,138,4,0.18)"},{bg:"rgba(236,72,153,0.14)",text:"rgb(236,72,153)",shadow:"rgba(236,72,153,0.18)"},{bg:"rgba(99,102,241,0.14)",text:"rgb(99,102,241)",shadow:"rgba(99,102,241,0.18)"},{bg:"rgba(244,114,82,0.14)",text:"rgb(244,114,82)",shadow:"rgba(244,114,82,0.18)"}];function Ho(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return Math.abs(t)}function Zl(e){let t=e.outcomes?.map(l=>l.label?.toLowerCase().trim()??"")??[];if(t.some(l=>l==="up")&&t.some(l=>l==="down"))return [tn,Xl];if(t.some(l=>l==="yes")&&t.some(l=>l==="no"))return [tn,Ko];let r=t[0]??"",o=t[1]??"",n=Ho(r)%Dt.length,i=Ho(o)%Dt.length;return i===n&&(i=(i+1)%Dt.length),[Dt[n],Dt[i]]}function Jl(e){let t=e.outcomes?.[0];return t?t.best_ask??t.price??null:null}function Vo(e){let t=Jl(e);return t!=null?parseFloat((t*100).toFixed(2)):0}function jo(e){return e<=1&&e>0?"< 1%":e>=99&&e<100?"> 99%":`${e}%`}function $o(e){let t=e.outcomes?.[0],r=t?.best_ask??t?.price??0;return parseFloat((r*100).toFixed(2)).toString()}function Wo(e){let t=e.outcomes?.[1];if(t){let n=t.best_ask??t.price??0;return parseFloat((n*100).toFixed(2)).toString()}let r=e.outcomes?.[0],o=r?.best_ask??r?.price??0;return parseFloat(((1-o)*100).toFixed(2)).toString()}function ec(e){let t=new Date(e).getTime()-Date.now();if(t<=0)return null;let r=Math.floor(t/864e5),o=Math.floor(t%864e5/36e5),n=Math.floor(t%36e5/6e4),i=[];return r>0&&i.push(`${r}d`),o>0&&i.push(`${o}h`),i.push(`${n}m`),i.join(" ")}var tc=`
|
|
1
|
+
'use strict';var react=require('react'),ui=require('@liberfi.io/ui'),uiScaffold=require('@liberfi.io/ui-scaffold'),i18n=require('@liberfi.io/i18n'),jsxRuntime=require('react/jsx-runtime'),walletConnector=require('@liberfi.io/wallet-connector'),reactQuery=require('@tanstack/react-query'),Gr=require('canvas-confetti'),reactPredict=require('@liberfi.io/react-predict'),types=require('@liberfi.io/types'),utils=require('@liberfi.io/utils'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils$1=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Gr__default=/*#__PURE__*/_interopDefault(Gr);typeof window<"u"&&(window.__LIBERFI_VERSION__=window.__LIBERFI_VERSION__||{},window.__LIBERFI_VERSION__["@liberfi.io/ui-predict"]="0.1.97");var pi="0.1.97";var mi={Weather:["Daily temperature","Snow and rain","Climate change","Natural disasters","Hurricanes"],Companies:["IPOs","Product launches","KPIs","Elon Musk","CEOs","Layoffs"],Crypto:["BTC","15 min","Hourly","ETH","SOL","DOGE","Pre-Market","XRP","BNB","HYPE"],Economics:["Growth","Fed","Inflation","Oil and energy","Employment","Housing","Jobs & Economy","Bankruptcy & Defaults","GDP","Global Central Banks"],Elections:["Primaries","International elections"],Entertainment:["Music","Movies","Music charts","Television","Awards","Video games","Oscars","Rotten Tomatoes"],Financials:["S&P","Nasdaq","Daily","Metals","Treasuries","Oil","EUR/USD","USD/JPY","WTI"],Mentions:["Politicians","Earnings","Entertainment"],Politics:["Trump","Congress","International","SCOTUS & courts","Local","Recurring","Iran","House"],Science:["AI","Energy","Space"],Social:null,Sports:["Soccer","Basketball","Baseball","Football","Hockey","Golf","Tennis","Motorsport","Esports","Boxing","MMA","Rugby","Lacrosse","Mentions","Chess","Cricket","Aussie Rules","Darts"],World:null},to=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],zr=(()=>{let e=t=>{let r=to.indexOf(t);return r===-1?to.length:r};return Object.entries(mi).map(([t,r])=>({slug:t,label:t,tags:(r??[]).map(o=>({slug:o,label:o}))})).sort((t,r)=>e(t.slug)-e(r.slug))})();function oo({categories:e,selectedCategory:t,selectedTag:r,activeTags:o,onCategorySelect:n,onTagSelect:i,trailing:l,pulsingTab:a="Trending",className:s}){let{t:c}=i18n.useTranslation(),d=react.useCallback(()=>{n(null);},[n]),p=c("predict.categories.trending");return jsxRuntime.jsxs("div",{className:ui.cn("sticky top-0 z-30 flex w-full flex-col justify-between gap-2 px-4 py-1 lg:px-2 lg:py-1",s),children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center gap-2",children:[jsxRuntime.jsx("div",{className:"hideScrollbar min-w-0 flex-1 overflow-x-auto overflow-y-hidden",children:jsxRuntime.jsxs("div",{className:"flex min-h-8 items-stretch gap-x-2 lg:min-h-9",children:[jsxRuntime.jsx(ro,{label:p,isSelected:t===null,onPress:d,showPulse:p===a}),jsxRuntime.jsx(xi,{}),e.map(u=>jsxRuntime.jsx(ro,{label:u.category,isSelected:t===u.category,onPress:()=>n(u.category),badge:u.badge,showPulse:u.category===a},u.category))]})}),l&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:l})]}),t&&o.length>0&&jsxRuntime.jsx("div",{className:"hideScrollbar overflow-x-auto overflow-y-hidden flex items-center",children:jsxRuntime.jsxs("div",{className:"flex gap-x-1 pl-2 lg:w-full lg:gap-x-2",children:[jsxRuntime.jsx(no,{label:c("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),o.map(u=>jsxRuntime.jsx(no,{label:u.label,icon:u.icon,isSelected:r===u.label,onPress:()=>i(u.label)},u.label))]})})]})}function ro({label:e,isSelected:t,onPress:r,badge:o,showPulse:n}){return jsxRuntime.jsxs("button",{type:"button",onClick:r,className:ui.cn("relative shrink-0 cursor-pointer whitespace-nowrap border-b p-1 text-base font-normal capitalize transition-colors",t?"border-primary/50 text-primary":"border-transparent text-neutral-500 hover:text-neutral-300"),children:[n?jsxRuntime.jsxs("span",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-[rgb(240,68,56)]"}),jsxRuntime.jsx("span",{children:e})]}):e,o&&jsxRuntime.jsx("span",{className:"absolute -right-1 top-0 rounded bg-primary px-0.5 py-px text-[0.625rem] font-semibold leading-none text-neutral-950",children:o})]})}function xi(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function no({label:e,icon:t,isSelected:r,onPress:o}){return jsxRuntime.jsxs("button",{type:"button",onClick:o,className:ui.cn("flex shrink-0 items-center justify-center gap-x-1 min-w-14 rounded-2xl border px-2 py-1 text-sm font-medium uppercase transition-colors cursor-pointer",r?"border-transparent bg-primary text-black":"border-border/80 text-neutral-200 hover:bg-primary/10 hover:text-primary"),children:[t&&jsxRuntime.jsx("span",{className:ui.cn("iconify size-4",t)}),e]})}function of({count:e=6}){return jsxRuntime.jsx("div",{className:"flex w-full flex-col gap-2 px-4 py-1 lg:px-2 lg:py-1",children:jsxRuntime.jsx("div",{className:"flex min-h-8 items-center gap-x-2 lg:min-h-9",children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-16 shrink-0 rounded"},r))})})}function vi(e){return e.map(t=>({category:t.label,tags:t.tags.map(r=>r.label)}))}function bi(e){return e?e.tags.map(t=>({label:t.label,icon:t.icon})):[]}function io({onSelect:e,trailing:t,className:r}){let[o,n]=react.useState(null),[i,l]=react.useState(null),a=react.useCallback(u=>{n(u),l(null),e?.({categorySlug:u,tagSlug:null});},[e]),s=react.useCallback(u=>{l(u),e?.({categorySlug:o,tagSlug:u});},[o,e]),c=vi(zr),d=zr.find(u=>u.slug===o),p=bi(d);return jsxRuntime.jsx(oo,{categories:c,selectedCategory:o,selectedTag:i,activeTags:p,onCategorySelect:a,onTagSelect:s,trailing:t,className:r})}function lo(e){return {title:e.title,imageUrl:e.image_url}}function co(e){let t=e.outcomes[0],r=e.outcomes[1];return {question:e.question,yesAsk:t?.best_ask??t?.price,noAsk:r?.best_ask??r?.price,yesBid:t?.best_bid,noBid:r?.best_bid,yesSubTitle:t?.label??"Yes",noSubTitle:r?.label??"No"}}var Rt=48,Ur=4,sr={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},Me={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},ar=Me.ALL,ff={[Me.ONE_DAY]:sr.ONE_MINUTE,[Me.ONE_WEEK]:sr.ONE_HOUR,[Me.ONE_MONTH]:sr.ONE_HOUR,[Me.ALL]:sr.ONE_DAY},gf={[Me.ONE_DAY]:300,[Me.ONE_WEEK]:3600,[Me.ONE_MONTH]:10800,[Me.ALL]:1440*60},hf={[Me.ONE_DAY]:1440*60,[Me.ONE_WEEK]:10080*60,[Me.ONE_MONTH]:720*60*60,[Me.ALL]:null},Kr=1,xf=1,vf=1,bf=99,vt={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},yf=vt.ONE_WEEK,kf={[vt.ONE_HOUR]:60,[vt.SIX_HOURS]:60,[vt.ONE_DAY]:300,[vt.ONE_WEEK]:1800,[vt.MAX]:1800};var mo=react.createContext(null);function jr(){let e=react.useContext(mo);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var Ci=1e4;function Mi({pollingInterval:e=Ci,enabled:t=true,children:r}){let o=walletConnector.useWallets(),n=react.useMemo(()=>o.find(v=>v.chainNamespace===types.ChainNamespace.SOLANA&&v.isConnected)?.address,[o]),i=react.useMemo(()=>o.find(v=>v.chainNamespace===types.ChainNamespace.EVM&&v.isConnected)?.address,[o]),{data:l,isLoading:a,isFetching:s,error:c}=reactPredict.useBalance({source:"kalshi",user:n??""},{enabled:t&&!!n,refetchInterval:e}),{data:d,isLoading:p}=reactPredict.useDFlowKYC(n,{enabled:t&&!!n,refetchInterval:3e4}),{data:u,isLoading:m}=reactPredict.usePolymarketSetup(i,{enabled:t&&!!i,refetchInterval:3e4}),f=u?.safe_address,g=u?.verified??false,{data:h,isLoading:x,isFetching:C,error:b}=reactPredict.useBalance({source:"polymarket",user:f??""},{enabled:t&&g&&!!f,refetchInterval:e}),N=react.useMemo(()=>({solanaAddress:n,evmAddress:i,polymarketSafeAddress:f,kalshiUsdcBalance:l?Number(l.balance):null,polymarketUsdcBalance:g&&h?Number(h.balance):null,kalshiKycVerified:d?.verified??false,kalshiKycUrl:d?.kyc_url??null,kalshiKycLoading:p,polymarketSetupVerified:g,polymarketSafeDeployed:u?.safe_deployed??false,polymarketTokenApproved:u?.token_approved??false,polymarketSetupLoading:m,isLoading:a||x,isFetching:s||C,error:c??b??null}),[n,i,f,l,h,g,d,p,u,m,a,x,s,C,c,b]);return jsxRuntime.jsx(mo.Provider,{value:N,children:r})}var Yi={minutes:60,hours:3600,days:86400};function qi(e,t,r){let o=Math.floor(Date.now()/1e3);switch(e){case "5m":return o+300;case "1h":return o+3600;case "12h":return o+720*60;case "24h":return o+1440*60;case "eod":{let n=new Date;return n.setUTCHours(23,59,59,0),Math.floor(n.getTime()/1e3)}case "custom":return o+t*Yi[r]}}function Yr(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};Gr__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{Gr__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{Gr__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}function xo({market:e,initialOutcome:t="yes",initialSide:r="buy"}){let{t:o}=i18n.useTranslation(),{status:n}=walletConnector.useAuth(),i=walletConnector.useWallets(),l=walletConnector.useSwitchChain(),a=reactPredict.usePredictClient(),s=react.useContext(reactPredict.PolymarketContext),c=reactQuery.useQueryClient(),d=e.source,p=d==="polymarket",u=i.find(M=>M.chainNamespace===types.ChainNamespace.SOLANA&&M.isConnected),m=i.find(M=>M.chainNamespace===types.ChainNamespace.EVM&&M.isConnected&&"switchChain"in M),f=n==="authenticated",g=u?.address,h=m?.address,[x,C]=react.useState(t),[b,N]=react.useState(r),[v,H]=react.useState("market"),[y,G]=react.useState(NaN),[K,oe]=react.useState(NaN),[we,w]=react.useState(false),[F,B]=react.useState(null),[se,ae]=react.useState(null),[E,_]=react.useState(false),[z,R]=react.useState(false),[ne,fe]=react.useState("1h"),[pe,Xe]=react.useState(30),[at,Or]=react.useState("minutes"),ze=null,Zt=false,Jt=null,ht;try{let M=jr();ze={kalshiUsdcBalance:M.kalshiUsdcBalance,polymarketUsdcBalance:M.polymarketUsdcBalance,isLoading:M.isLoading},Zt=M.kalshiKycVerified,Jt=M.kalshiKycUrl,ht=M.polymarketSafeAddress;}catch{}let ke=react.useMemo(()=>{let M=x==="yes"?0:1,q=e.outcomes[M];return b==="buy"?q?.best_ask??q?.price??.5:q?.best_bid??q?.price??.5},[e.outcomes,x,b]),Ar=react.useCallback(M=>{H(M);},[]),D=react.useCallback(M=>{C(M),oe(NaN);},[]);react.useEffect(()=>{v==="limit"&&isNaN(K)&&oe(Math.round(ke*100)/100);},[v,K,ke]);let _e=react.useMemo(()=>isNaN(y)||y<=0?0:b==="buy"?ke>0?y/ke:0:y,[b,y,ke]),Ue=react.useMemo(()=>isNaN(y)||y<=0?"0":String(Math.round(y*1e6)),[y]),Ua=e.provider_meta?.["dflow.yesMint"]??"",Ka=e.provider_meta?.["dflow.noMint"]??"",it=utils.SOLANA_TOKENS.stablecoins.USDC.address,Va=e.provider_meta?.["dflow.collateralMint"]||"",Un=x==="yes"?Ua:Ka,Kn=d==="kalshi"?g??"":h??"",{data:Re,isLoading:ja}=reactPredict.usePositions({source:d,user:Kn},{enabled:!!Kn}),Vn=react.useMemo(()=>!Re||b!=="sell"?null:Re.positions.find(M=>M.side?.toLowerCase()===x&&M.market?.slug===e.slug)??null,[Re,e.slug,x,b])?.market?.provider_meta,Ga=b==="sell"&&Vn?.["dflow.outcomeMint"]||Un,Et=b==="sell"&&Vn?.["dflow.collateralMint"]||Va,Tt=b==="buy"?it:Ga,Lt=b==="buy"?Un:Et||it,Ya=d==="kalshi"&&!!Tt&&!!Lt&&!!g&&Ue!=="0",{refetch:jn}=reactPredict.useDFlowQuote({inputMint:Tt,outputMint:Lt,amount:Ue,userPublicKey:g??"",slippageBps:100},{enabled:Ya}),er=react.useMemo(()=>ze?d==="kalshi"?ze.kalshiUsdcBalance:ze.polymarketUsdcBalance:Re&&Re.positions.reduce((q,Ce)=>Ce.side==="USDC"||Ce.side==="collateral"?q+(Ce.current_value??0):q,0)||null,[ze,Re,d]),qa=ze?ze.isLoading:ja,Dr=react.useMemo(()=>Re?Re.positions.find(q=>q.side?.toLowerCase()==="yes"&&q.market?.slug===e.slug)?.size??0:null,[Re,e.slug]),Fr=react.useMemo(()=>Re?Re.positions.find(q=>q.side?.toLowerCase()==="no"&&q.market?.slug===e.slug)?.size??0:null,[Re,e.slug]),Br=react.useMemo(()=>v==="limit"&&p&&!isNaN(K)?K:ke,[v,p,K,ke]),tr=react.useMemo(()=>{if(isNaN(y)||y<=0)return 0;if(b==="buy")return y;let M=x==="yes"?e.outcomes[0]?.best_bid??0:e.outcomes[1]?.best_bid??0;return y*M},[b,x,y,e.outcomes]),Gn=react.useMemo(()=>isNaN(y)||y<=0?0:b==="buy"?Br>0?y/Br*1:0:tr,[b,y,Br,tr]),Qa=Gn-tr,Xa=react.useCallback(M=>{N(M),G(NaN);},[]),Za=react.useCallback(M=>{if(isNaN(M)){G(NaN);return}let q=Math.max(0,M),Ce=b==="buy"?Math.round(q*100)/100:Math.round(q);G(Ce);},[b]),Ja=react.useCallback(M=>{if(isNaN(M)){oe(NaN);return}let q=Math.max(.01,Math.min(.99,M));oe(Math.round(q*100)/100);},[]),Hr=react.useMemo(()=>{let M=[];(isNaN(y)||y<Kr)&&M.push(`Minimum quantity is ${Kr}`),e.status!=="open"&&M.push("Market is not active"),b==="buy"&&er!=null&&!isNaN(y)&&y>0&&y>er&&M.push("Insufficient USDC balance");let q=x==="yes"?Dr:Fr;return b==="sell"&&q!=null&&!isNaN(y)&&y>0&&y>q&&M.push("Insufficient shares"),v==="limit"&&p&&(isNaN(K)||K<.01||K>.99)&&M.push("Limit price must be between $0.01 and $0.99"),v==="limit"&&p&&z&&ne==="custom"&&(isNaN(pe)||pe<=0)&&M.push(o("predict.trade.expiration.invalidDate")),{isValid:M.length===0,errors:M}},[y,e.status,b,er,Dr,Fr,x,v,p,K,z,ne,pe,o]),{mutateAsync:rr}=reactPredict.useDFlowSubmit(),{data:$r}=reactPredict.useOrder({id:F??"",source:d},{enabled:!!F}),Yn=react.useCallback(async()=>{if(!se||!g||!u)return;let{cashAmount:M,collateral:q}=se;ae(null);try{let lt=(await a.createDFlowQuote({inputMint:q,outputMint:it,amount:M,userPublicKey:g,slippageBps:100}))?.transaction;if(!lt)return;let Ze=Uint8Array.from(atob(lt),_t=>_t.charCodeAt(0)),Ke=await u.signTransaction(Ze);await rr({signedTransaction:btoa(String.fromCharCode(...Ke)),orderContext:{user_public_key:g,input_mint:q,output_mint:it,amount:M,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[se,g,u,a,rr,it]);react.useEffect(()=>{if(!$r||!F)return;let{status:M}=$r;M==="closed"?(B(null),se?Yn().finally(()=>{w(false),ui.toast.success(o("predict.trade.submitSuccess")),Yr(),G(NaN);}):(w(false),ui.toast.success(o("predict.trade.submitSuccess")),Yr(),G(NaN))):(M==="failed"||M==="expired")&&(w(false),B(null),ae(null),ui.toast.error(o("predict.trade.submitError")));},[$r,F,se,Yn,o]);let qn=react.useCallback(async()=>{if(!g||!u)return;if(!Tt||!Lt){ui.toast.error("Missing token mint addresses"),w(false);return}if(!Zt){_(true),w(false);return}let Ce=(await jn()).data,lt=Ce?.transaction;if(!lt){ui.toast.error(o("predict.trade.submitError")),w(false);return}if(b==="sell"&&Et&&Et!==it){let Je=String(Ce?.outAmount??"");Je&&Je!=="0"&&ae({cashAmount:Je,collateral:Et});}let Ze=Uint8Array.from(atob(lt),Je=>Je.charCodeAt(0)),Ke=await u.signTransaction(Ze),_t=await rr({signedTransaction:btoa(String.fromCharCode(...Ke)),orderContext:{user_public_key:g,input_mint:Tt,output_mint:Lt,amount:Ue,price:String(ke),side:b==="buy"?"BUY":"SELL",outcome:x==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});B(_t.signature);},[g,u,a,jn,rr,Tt,Lt,Ue,ke,b,x,e.slug,Et,it,o]),Qn=react.useCallback(async()=>{if(!m||!s)return;let M=m.chain,q=M!==types.Chain.POLYGON;q&&await l(types.Chain.POLYGON);try{let Ce=await m.getEip1193Provider();if(!Ce){ui.toast.error(o("predict.trade.submitError")),w(!1);return}let lt=!!ht,Ze={address:m.address,signatureType:lt?2:0,signTypedData:async(ct,li,ci,di)=>{let xt=[];"name"in ct&&xt.push({name:"name",type:"string"}),"version"in ct&&xt.push({name:"version",type:"string"}),"chainId"in ct&&xt.push({name:"chainId",type:"uint256"}),"verifyingContract"in ct&&xt.push({name:"verifyingContract",type:"address"}),"salt"in ct&&xt.push({name:"salt",type:"bytes32"});let ui={EIP712Domain:xt,...li};return await Ce.request({method:"eth_signTypedData_v4",params:[m.address,JSON.stringify({domain:ct,types:ui,primaryType:ci,message:di})]})}},Ke=s.credentials??await s.authenticate(Ze),_t=x==="yes"?0:1,Je="",nr=e.provider_meta?.["polymarket.clobTokenIds"];nr&&(Je=(typeof nr=="string"?JSON.parse(nr):nr)[_t]??"");let Xn=e.provider_meta?.["polymarket.negRisk"]??!1,Wr=v==="limit"&&!isNaN(K)?K:ke,ti=v==="limit"?z?"GTD":"GTC":"FOK",ri=b==="buy"&&Wr>0?y/Wr:y,Zn={tokenId:Je,price:Wr,size:ri,side:b==="buy"?"BUY":"SELL",orderType:ti,tickSize:"0.01",negRisk:Xn,...ht&&{funderAddress:ht},...v==="limit"&&z&&{expiration:qi(ne,pe,at)}},ni=reactPredict.buildCtfExchangeDomain(Xn),Jn=reactPredict.buildOrderMessage({...Zn,signerAddress:Ze.address,signatureType:Ze.signatureType}),oi=await Ze.signTypedData(ni,reactPredict.CTF_ORDER_TYPES,"Order",Jn),si=reactPredict.buildSignedOrder(Jn,oi,Zn.orderType),eo=reactPredict.buildClobPayload(si,Ke.apiKey),ai=JSON.stringify(eo),ii=await reactPredict.buildPolymarketL2Headers(Ke.address,{apiKey:Ke.apiKey,secret:Ke.secret,passphrase:Ke.passphrase,method:"POST",requestPath:"/order",body:ai});await a.createPolymarketOrder(eo,ii),c.invalidateQueries({queryKey:["predict","orders"]}),c.invalidateQueries({queryKey:["predict","positions"]}),ui.toast.success(o("predict.trade.submitSuccess")),Yr(),G(NaN),w(!1);}finally{q&&M&&l(M).catch(()=>{});}},[m,s,l,x,e.provider_meta,v,K,ke,y,b,a,c,z,ne,pe,at,o]),ei=react.useCallback(async()=>{if(!(!Hr.isValid||!f)){w(true),B(null),_(false);try{d==="kalshi"?await qn():await Qn();}catch{ui.toast.error(o("predict.trade.submitError")),w(false);}}},[Hr.isValid,f,d,qn,Qn,o]);return {outcome:x,side:b,orderType:v,quantity:y,limitPrice:K,shares:_e,estimatedCost:tr,potentialPayout:Gn,potentialProfit:Qa,usdcBalance:er,yesTokenBalance:Dr,noTokenBalance:Fr,isBalanceLoading:qa,isSubmitting:we,validation:Hr,supportsLimitOrder:p,kycRequired:E,kycUrl:Jt,expirationEnabled:z,expirationPreset:ne,customDuration:pe,customDurationUnit:at,setOutcome:D,setSide:Xa,setOrderType:Ar,setQuantity:Za,setLimitPrice:Ja,setExpirationEnabled:R,setExpirationPreset:fe,setCustomDuration:Xe,setCustomDurationUnit:Or,submit:ei}}function bo({isOpen:e,onClose:t,kycUrl:r}){let{t:o}=i18n.useTranslation();return jsxRuntime.jsx(ui.Modal,{isOpen:e,onClose:t,size:"md",children:jsxRuntime.jsxs(ui.ModalContent,{children:[jsxRuntime.jsx(ui.ModalHeader,{className:"flex flex-col gap-1",children:jsxRuntime.jsxs("span",{className:"text-lg",children:["\u{1F6E1}\uFE0F ",o("predict.trade.kycModalTitle")]})}),jsxRuntime.jsxs(ui.ModalBody,{className:"gap-y-4",children:[jsxRuntime.jsx("p",{className:"text-sm text-default-600",children:o("predict.trade.kycModalDescription")}),jsxRuntime.jsxs("ul",{className:"flex flex-col gap-y-2 text-sm text-foreground",children:[jsxRuntime.jsxs("li",{className:"flex items-start gap-x-2",children:[jsxRuntime.jsx("span",{className:"mt-0.5 text-primary",children:"\u2713"}),jsxRuntime.jsx("span",{children:o("predict.trade.kycModalBullet1")})]}),jsxRuntime.jsxs("li",{className:"flex items-start gap-x-2",children:[jsxRuntime.jsx("span",{className:"mt-0.5 text-primary",children:"\u2713"}),jsxRuntime.jsx("span",{children:o("predict.trade.kycModalBullet2")})]}),jsxRuntime.jsxs("li",{className:"flex items-start gap-x-2",children:[jsxRuntime.jsx("span",{className:"mt-0.5 text-primary",children:"\u2713"}),jsxRuntime.jsx("span",{children:o("predict.trade.kycModalBullet3")})]})]}),jsxRuntime.jsx("p",{className:"text-xs text-default-400",children:o("predict.trade.kycModalNote")})]}),jsxRuntime.jsxs(ui.ModalFooter,{children:[jsxRuntime.jsx(ui.Button,{variant:"light",onPress:t,children:o("common.cancel")}),r&&jsxRuntime.jsx(ui.Button,{color:"primary",onPress:()=>{window.open(r,"_blank","noopener,noreferrer"),t();},children:o("predict.trade.goToKYC")})]})]})})}var dl=`https://s1.chainstream.io/chains/sol/tokens/${utils.SOLANA_TOKENS.stablecoins.USDC.address}/image.png`,ul=["5m","1h","12h","24h","eod","custom"],pl={"5m":"predict.trade.expiration.5m","1h":"predict.trade.expiration.1h","12h":"predict.trade.expiration.12h","24h":"predict.trade.expiration.24h",eod:"predict.trade.expiration.eod",custom:"predict.trade.expiration.custom"},ml=["minutes","hours","days"],fl={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"};function Co({event:e,market:t,variant:r="bordered",outcome:o,side:n,orderType:i,quantity:l,limitPrice:a,shares:s,potentialProfit:c,potentialPayout:d,estimatedCost:p,usdcBalance:u,yesTokenBalance:m,noTokenBalance:f,isBalanceLoading:g,isSubmitting:h,isValid:x,validationErrors:C,supportsLimitOrder:b,kycRequired:N,kycUrl:v,expirationEnabled:H,expirationPreset:y,customDuration:G,customDurationUnit:K,onOutcomeChange:oe,onSideChange:we,onOrderTypeChange:w,onQuantityChange:F,onLimitPriceChange:B,onExpirationEnabledChange:se,onExpirationPresetChange:ae,onCustomDurationChange:E,onCustomDurationUnitChange:_,onSubmit:z}){let{t:R}=i18n.useTranslation(),[ne,fe]=react.useState(false),pe=ui.useDisclosure();react.useEffect(()=>{N&&!pe.isOpen&&pe.onOpen();},[N]);let Xe=react.useMemo(()=>{let D=n==="buy"?o==="yes"?t.yesAsk:t.noAsk:o==="yes"?t.yesBid:t.noBid;return D!=null?parseFloat((Number(D)*100).toFixed(2)):null},[n,o,t]),at=!isNaN(l)&&l>0,Or=react.useMemo(()=>{if(h)return R("predict.trade.submitting");if(N)return R("predict.trade.kycRequired");if(!at)return R("predict.trade.enterAmount");let D=R(n==="buy"?"predict.trade.buy":"predict.trade.sell"),_e=R(o==="yes"?"predict.trade.yes":"predict.trade.no"),Ue=n==="buy"&&c>0?` \u2192 Win $${c.toFixed(2)}`:"";return `${D} ${_e}${Ue}`},[h,N,at,n,o,c,R]),ze=react.useMemo(()=>o==="yes"?"primary":"secondary",[o]),Zt=()=>{F(Math.floor((u??0)/2*100)/100);},Jt=()=>{F(u??0);},[ht,ke]=react.useState(false),Ar=()=>{if(N){pe.onOpen();return}if(!x){ke(true);return}ke(false),z();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:ui.cn("flex w-full flex-col gap-y-4 p-4",r==="bordered"&&"rounded-xl border border-default-200 bg-content1"),children:[e&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3",children:[e.imageUrl&&jsxRuntime.jsx("img",{src:e.imageUrl,alt:e.title,className:"h-10 w-10 shrink-0 rounded-lg object-cover"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral-500 leading-tight line-clamp-1",children:e.title}),jsxRuntime.jsxs("span",{className:"text-base font-semibold leading-tight line-clamp-1",children:[jsxRuntime.jsxs("span",{className:o==="yes"?"text-bullish":"text-bearish",children:[R(n==="buy"?"predict.trade.buy":"predict.trade.sell")," ",R(o==="yes"?"predict.trade.yes":"predict.trade.no")]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[b?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:i,onSelectionChange:D=>w(D),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:R("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:R("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:R("predict.trade.market")}),i==="limit"&&b?jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",value:isNaN(a)?void 0:parseFloat((a*100).toFixed(2)),onValueChange:D=>B(D/100),minValue:1,maxValue:99,step:1,formatOptions:{maximumFractionDigits:2},endContent:jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums text-foreground",children:"\xA2"}),classNames:{base:"w-28",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 rounded-lg px-2 h-9 min-h-9",input:"text-xl font-bold tabular-nums text-right"}}):Xe!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[Xe," \xA2"]})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(D=>{let _e=D==="yes"?m:f;return jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col gap-y-1",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>oe(D),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${o===D?D==="yes"?"border-primary bg-primary-50 text-primary":"border-secondary bg-secondary-50 text-secondary":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:R(D==="yes"?"predict.trade.yes":"predict.trade.no")}),(()=>{let Ue=n==="buy"?D==="yes"?t.yesAsk:t.noAsk:D==="yes"?t.yesBid:t.noBid;return Ue!=null?jsxRuntime.jsxs("span",{className:"ml-1 opacity-70",children:[parseFloat((Number(Ue)*100).toFixed(2)),"\xA2"]}):null})()]}),n==="sell"&&o===D&&jsxRuntime.jsx("span",{className:"text-center text-xs text-foreground",children:g?"\u2013":`${_e??0} shares`})]},D)})}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-xs text-neutral-500",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:R(n==="buy"?"predict.trade.youArePaying":"predict.trade.contracts")}),n==="buy"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("img",{src:dl,alt:"USDC",className:"h-3.5 w-3.5 rounded-full object-cover"}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:u!=null?`${u.toFixed(2)} USDC`:"\u2013"}),jsxRuntime.jsx("button",{type:"button",onClick:Zt,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:R("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:Jt,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:R("predict.trade.max")})]})]}),jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",value:isNaN(l)?void 0:l,onValueChange:D=>{ke(false),F(D);},minValue:0,step:n==="buy"?.01:1,formatOptions:n==="buy"?{maximumFractionDigits:2}:{maximumFractionDigits:0},startContent:n==="buy"?jsxRuntime.jsx("span",{className:"text-default-600 text-xl",children:"$"}):void 0,classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}},n),n==="sell"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2 justify-end",children:[[25,50].map(D=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{F(Math.floor((o==="yes"?m??0:f??0)*D/100));},className:"rounded-md bg-content2 px-2.5 py-1 text-xs font-medium text-default-600 transition-colors hover:bg-content3 cursor-pointer",children:[D,"%"]},D)),jsxRuntime.jsx("button",{type:"button",onClick:()=>{F(o==="yes"?m??0:f??0);},className:"rounded-md bg-content2 px-2.5 py-1 text-xs font-medium text-default-600 transition-colors hover:bg-content3 cursor-pointer",children:R("common.all")})]}),ht&&C.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:C.map(D=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:D},D))})]}),i==="limit"&&b&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary",children:R("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:H,onValueChange:se,"aria-label":R("predict.trade.setExpiration")})]}),H&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":R("predict.trade.setExpiration"),selectedKeys:[y],onSelectionChange:D=>{let _e=Array.from(D)[0];_e&&ae(_e);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:ul.map(D=>jsxRuntime.jsx(ui.SelectItem,{children:R(pl[D])},D))}),y==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(G)?void 0:G,onValueChange:E,minValue:1,step:1,formatOptions:{maximumFractionDigits:0},classNames:{base:"flex-1",inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 min-h-10",input:"text-sm"}}),jsxRuntime.jsx(ui.Select,{"aria-label":"Duration unit",selectedKeys:[K],onSelectionChange:D=>{let _e=Array.from(D)[0];_e&&_(_e);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:ml.map(D=>jsxRuntime.jsx(ui.SelectItem,{children:R(fl[D])},D))})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between text-sm",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>fe(D=>!D),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:R("predict.trade.odds")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-3.5 w-3.5 transition-transform",ne&&"rotate-180")})]}),Xe!=null&&jsxRuntime.jsxs("span",{className:"text-foreground font-medium tabular-nums",children:[Xe,"% chance"]})]}),ne&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-1.5 border-l-2 border-default-300 pl-3 text-sm text-neutral-500",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Total Size"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(l)&&l>0?`$${p.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"No. of Contracts"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(s)&&s>0?parseFloat(s.toFixed(2)):"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Payout"}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(l)&&l>0?`$${d.toFixed(2)}`:"\u2013"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:"Est. Profit"}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(l)&&l>0&&c>0?`+$${c.toFixed(2)}`:"\u2013"})]})]})]}),jsxRuntime.jsx(ui.Button,{color:ze,fullWidth:true,radius:"lg",size:"lg",isDisabled:!at||h,isLoading:h,onPress:Ar,children:Or})]}),jsxRuntime.jsx(bo,{isOpen:pe.isOpen,onClose:pe.onClose,kycUrl:v})]})}function ir({event:e,market:t,variant:r,initialSide:o,initialOutcome:n,chain:i}){let{outcome:l,side:a,orderType:s,quantity:c,limitPrice:d,shares:p,estimatedCost:u,potentialPayout:m,potentialProfit:f,usdcBalance:g,yesTokenBalance:h,noTokenBalance:x,isBalanceLoading:C,isSubmitting:b,validation:N,supportsLimitOrder:v,kycRequired:H,kycUrl:y,expirationEnabled:G,expirationPreset:K,customDuration:oe,customDurationUnit:we,setOutcome:w,setSide:F,setOrderType:B,setQuantity:se,setLimitPrice:ae,setExpirationEnabled:E,setExpirationPreset:_,setCustomDuration:z,setCustomDurationUnit:R,submit:ne}=xo({market:t,initialSide:o,initialOutcome:n}),fe=walletConnector.useAuthCallback(ne),pe=react.useMemo(()=>e?lo(e):void 0,[e]),Xe=react.useMemo(()=>co(t),[t]);return jsxRuntime.jsx(Co,{event:pe,market:Xe,variant:r,outcome:l,side:a,orderType:s,quantity:c,limitPrice:d,shares:p,estimatedCost:u,potentialPayout:m,potentialProfit:f,usdcBalance:g,yesTokenBalance:h,noTokenBalance:x,isBalanceLoading:C,isSubmitting:b,isValid:N.isValid,validationErrors:N.errors,supportsLimitOrder:v,kycRequired:H,kycUrl:y,expirationEnabled:G,expirationPreset:K,customDuration:oe,customDurationUnit:we,onOutcomeChange:w,onSideChange:F,onOrderTypeChange:B,onQuantityChange:se,onLimitPriceChange:ae,onExpirationEnabledChange:E,onExpirationPresetChange:_,onCustomDurationChange:z,onCustomDurationUnitChange:R,onSubmit:fe})}var It="predict-trade";function lr({id:e=It}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Sl,{...t})})}function Sl({params:e,isOpen:t,onOpenChange:r}){let{isMobile:o}=ui.useScreen();return e?jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"blur",radius:"lg",children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsx(ui.ModalBody,{className:"p-2",children:jsxRuntime.jsx(ir,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,initialSide:e.initialSide??"buy",chain:e.chain,variant:"flat"})})})}):null}var Xr={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function Zr(e){let t=0;return e.source&&t++,e.timeRemaining&&t++,e.minVolume&&t++,e.minLiquidity&&t++,t}function To({isOpen:e,onClose:t,value:r,onChange:o}){let{t:n}=i18n.useTranslation(),[i,l]=react.useState(r),a=react.useCallback(h=>{h?l(r):t();},[r,t]),s=react.useCallback(()=>{l(Xr);},[]),c=react.useCallback(()=>{o(i),t();},[i,o,t]),d=react.useCallback((h,x)=>{l(C=>({...C,[h]:x}));},[]),p=react.useMemo(()=>Zr(i),[i]),u=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"polymarket",label:n("predict.platform.polymarket")},{value:"kalshi",label:n("predict.platform.kalshi")}],[n]),m=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1d",label:n("predict.filter.lessThanDay")},{value:"7d",label:n("predict.filter.lessThanWeek")},{value:"30d",label:n("predict.filter.lessThanMonth")}],[n]),f=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[n]),g=react.useMemo(()=>[{value:void 0,label:n("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[n]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:a,size:"md",scrollBehavior:"inside",children:jsxRuntime.jsxs(ui.ModalContent,{children:[jsxRuntime.jsx(ui.ModalHeader,{className:"px-4 py-2",children:jsxRuntime.jsx("span",{className:"text-base font-semibold",children:n("predict.filter.title")})}),jsxRuntime.jsxs(ui.ModalBody,{className:"flex flex-col gap-5",children:[jsxRuntime.jsx(dr,{label:n("predict.filter.platform"),children:jsxRuntime.jsx(ur,{options:u,selected:i.source,onSelect:h=>d("source",h)})}),jsxRuntime.jsx(dr,{label:n("predict.filter.timeRemaining"),children:jsxRuntime.jsx(ur,{options:m,selected:i.timeRemaining,onSelect:h=>d("timeRemaining",h)})}),jsxRuntime.jsx(dr,{label:n("predict.filter.minVolume"),children:jsxRuntime.jsx(ur,{options:f,selected:i.minVolume,onSelect:h=>d("minVolume",h)})}),jsxRuntime.jsx(dr,{label:n("predict.filter.minLiquidity"),children:jsxRuntime.jsx(ur,{options:g,selected:i.minLiquidity,onSelect:h=>d("minLiquidity",h)})})]}),jsxRuntime.jsx(ui.ModalFooter,{className:"px-4",children:jsxRuntime.jsxs("div",{className:"w-full flex justify-between items-center",children:[jsxRuntime.jsx(ui.Button,{variant:"light",color:"default",size:"sm",radius:"full",startContent:jsxRuntime.jsx(ui.RefreshIcon,{width:16,height:16}),onPress:s,children:n("predict.filter.reset")}),jsxRuntime.jsxs(ui.Button,{color:"primary",size:"sm",radius:"full",onPress:c,children:[n("predict.filter.showResults"),p>0&&jsxRuntime.jsxs("span",{className:"ml-1 text-xs opacity-80",children:["(",p,")"]})]})]})})]})})}function dr({label:e,children:t}){return jsxRuntime.jsxs("div",{className:"flex flex-col gap-2.5",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-foreground",children:e}),t]})}function ur({options:e,selected:t,onSelect:r,allowDeselect:o=true}){return jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:e.map(n=>{let i=t===n.value;return jsxRuntime.jsx("button",{type:"button",onClick:()=>{r(i&&o?void 0:n.value);},className:ui.cn("shrink-0 rounded-lg px-3 py-1.5 text-xs font-medium transition-colors duration-150 cursor-pointer border",i?"bg-primary/15 text-primary border-primary/40":"bg-content2 text-foreground/60 border-default-100 hover:bg-default-100 hover:text-foreground"),children:n.label},n.value??"__all")})})}var Io={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},_o={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},zl=["start_time","volume","liquidity","ending_soon"];function Oo({sortPreset:e,onSortChange:t,sortAsc:r,onSortAscChange:o,onFilterPress:n,filterCount:i=0,className:l}){let{t:a}=i18n.useTranslation(),[s,c]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{if(!s)return;let u=f=>{d.current&&!d.current.contains(f.target)&&c(false);},m=f=>{f.key==="Escape"&&c(false);};return document.addEventListener("mousedown",u),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",m);}},[s]);let p=Ro[e];return jsxRuntime.jsxs("div",{className:ui.cn("flex items-center gap-2",l),children:[jsxRuntime.jsxs("div",{ref:d,className:"relative flex shrink-0 items-center rounded-full border border-border",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>c(u=>!u),className:"flex shrink-0 items-center gap-2 px-3 py-1.5 text-xs font-medium text-neutral transition-colors hover:text-primary/80 cursor-pointer",children:[jsxRuntime.jsx(p,{className:"size-[18px] shrink-0"}),jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:a(_o[e])})]}),jsxRuntime.jsx("div",{className:"h-6 w-px bg-border"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>o(!r),className:"px-2.5 py-1.5 text-xs text-neutral transition-colors hover:text-primary/80 cursor-pointer",children:r?"\u2191":"\u2193"}),s&&jsxRuntime.jsx("div",{className:"absolute left-0 top-full z-20 mt-1 flex min-w-max flex-col gap-0.5 rounded-lg border border-border bg-content1 p-1 shadow-lg",children:zl.map(u=>{let m=Ro[u];return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{t(u),c(false);},className:ui.cn("flex w-full items-center gap-2 rounded px-2.5 py-1.5 text-xs font-medium transition-colors cursor-pointer",u===e?"bg-primary/10 text-primary":"text-neutral hover:bg-content2 hover:text-foreground"),children:[jsxRuntime.jsx(m,{className:"size-4 shrink-0"}),jsxRuntime.jsx("span",{children:a(_o[u])})]},u)})})]}),jsxRuntime.jsx(ui.StyledBadge,{content:i>0?i:void 0,color:"primary",size:"sm",isInvisible:i===0,children:jsxRuntime.jsxs("button",{type:"button",onClick:n,className:"flex shrink-0 items-center gap-2 rounded-full border border-border px-3 py-1.5 text-xs font-medium text-neutral transition-colors hover:text-primary/80 cursor-pointer",children:[jsxRuntime.jsx(ui.FilterIcon,{className:"size-[18px]"}),jsxRuntime.jsx("span",{className:"whitespace-nowrap",children:a("predict.filter.title")})]})})]})}var Ro={start_time:ui.CalendarIcon,volume:ui.ChartLineIcon,liquidity:ui.DropletIcon,ending_soon:ui.TimerIcon};function Fo(e={}){let t=react.useMemo(()=>reactPredict.resolveEventsParams(e),[e.tagSlugSelection,e.limit,e.status,e.sort_by,e.sort_asc,e.source,e.with_markets,e.minVolume,e.minLiquidity,e.timeRemaining]),{data:r,isLoading:o,isFetching:n,isFetchingNextPage:i,isError:l,error:a,hasNextPage:s,fetchNextPage:c,refetch:d}=reactPredict.useInfiniteEvents(t),p=react.useMemo(()=>r?.pages.flatMap(f=>f.items).filter(f=>f!=null)??[],[r]),u=react.useCallback(()=>{c();},[c]),m=react.useCallback(()=>{d();},[d]);return {data:p,isLoading:o,isFetching:n&&!i,isFetchingMore:i,isError:l,error:a??null,hasMore:s??false,fetchMore:u,refetch:m}}function Jr({count:e=6}){return jsxRuntime.jsx("div",{className:"grid w-full grid-cols-1 gap-0 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx("div",{className:"p-2",children:jsxRuntime.jsxs("div",{className:"flex h-full min-h-52 flex-col rounded-xl border border-border/90 bg-background p-3 lg:min-h-72 lg:p-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-3",children:[jsxRuntime.jsx(ui.Skeleton,{className:"size-10 shrink-0 rounded-lg"}),jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col gap-1",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-11/12 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3 w-2/5 rounded"})]})]}),jsxRuntime.jsxs("div",{className:"mt-3 flex flex-1 flex-col gap-2 lg:gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-1/2 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-[85px] rounded-lg lg:h-9 lg:w-24"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-3/5 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-[85px] rounded-lg lg:h-9 lg:w-24"})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-2/5 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-[85px] rounded-lg lg:h-9 lg:w-24"})]})]}),jsxRuntime.jsxs("div",{className:"mt-auto flex items-center justify-between pt-3",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-3 w-20 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3 w-24 rounded"})]})]})},r))})}function Mg({count:e=48}){return jsxRuntime.jsxs("div",{className:"flex h-full w-full max-w-[1680px] mx-auto flex-col gap-y-3",children:[jsxRuntime.jsxs("div",{className:"flex min-h-8 items-center justify-between gap-3 lg:min-h-9",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 overflow-hidden",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-16 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-20 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-16 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-20 rounded"})]}),jsxRuntime.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-28 rounded-full"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-24 rounded-full"})]})]}),jsxRuntime.jsx("div",{className:"min-h-0 flex-1",children:jsxRuntime.jsx(Jr,{count:e})})]})}var Bo=3,tn={bg:"hsl(var(--heroui-primary) / 0.14)",text:"hsl(var(--heroui-primary))",shadow:"hsl(var(--heroui-primary) / 0.18)"},Ko={bg:"hsl(var(--heroui-secondary) / 0.14)",text:"hsl(var(--heroui-secondary))",shadow:"hsl(var(--heroui-secondary) / 0.18)"},Xl={bg:"rgba(239, 68, 68, 0.14)",text:"rgb(239, 68, 68)",shadow:"rgba(239, 68, 68, 0.18)"},Dt=[{bg:"rgba(139,92,246,0.14)",text:"rgb(139,92,246)",shadow:"rgba(139,92,246,0.18)"},{bg:"rgba(34,197,94,0.14)",text:"rgb(34,197,94)",shadow:"rgba(34,197,94,0.18)"},{bg:"rgba(0,166,212,0.14)",text:"rgb(0,166,212)",shadow:"rgba(0,166,212,0.18)"},{bg:"rgba(194,120,32,0.14)",text:"rgb(194,120,32)",shadow:"rgba(194,120,32,0.18)"},{bg:"rgba(202,138,4,0.14)",text:"rgb(202,138,4)",shadow:"rgba(202,138,4,0.18)"},{bg:"rgba(236,72,153,0.14)",text:"rgb(236,72,153)",shadow:"rgba(236,72,153,0.18)"},{bg:"rgba(99,102,241,0.14)",text:"rgb(99,102,241)",shadow:"rgba(99,102,241,0.18)"},{bg:"rgba(244,114,82,0.14)",text:"rgb(244,114,82)",shadow:"rgba(244,114,82,0.18)"}];function Ho(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r)|0;return Math.abs(t)}function Zl(e){let t=e.outcomes?.map(l=>l.label?.toLowerCase().trim()??"")??[];if(t.some(l=>l==="up")&&t.some(l=>l==="down"))return [tn,Xl];if(t.some(l=>l==="yes")&&t.some(l=>l==="no"))return [tn,Ko];let r=t[0]??"",o=t[1]??"",n=Ho(r)%Dt.length,i=Ho(o)%Dt.length;return i===n&&(i=(i+1)%Dt.length),[Dt[n],Dt[i]]}function Jl(e){let t=e.outcomes?.[0];return t?t.best_ask??t.price??null:null}function Vo(e){let t=Jl(e);return t!=null?parseFloat((t*100).toFixed(2)):0}function jo(e){return e<=1&&e>0?"< 1%":e>=99&&e<100?"> 99%":`${e}%`}function $o(e){let t=e.outcomes?.[0],r=t?.best_ask??t?.price??0;return parseFloat((r*100).toFixed(2)).toString()}function Wo(e){let t=e.outcomes?.[1];if(t){let n=t.best_ask??t.price??0;return parseFloat((n*100).toFixed(2)).toString()}let r=e.outcomes?.[0],o=r?.best_ask??r?.price??0;return parseFloat(((1-o)*100).toFixed(2)).toString()}function ec(e){let t=new Date(e).getTime()-Date.now();if(t<=0)return null;let r=Math.floor(t/864e5),o=Math.floor(t%864e5/36e5),n=Math.floor(t%36e5/6e4),i=[];return r>0&&i.push(`${r}d`),o>0&&i.push(`${o}h`),i.push(`${n}m`),i.join(" ")}var tc=`
|
|
2
2
|
.badge-shine { position: relative; overflow: hidden; }
|
|
3
3
|
.badge-shine::after {
|
|
4
4
|
content: "";
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
60% { transform: translate(200%); }
|
|
17
17
|
100% { transform: translate(200%); }
|
|
18
18
|
}
|
|
19
|
-
`;function Go({event:e,href:t,LinkComponent:r,onSelect:o,onSelectOutcome:n,onHover:i}){let[l,s]=react.useState(null),a=e.markets??[],u=react.useMemo(()=>a.length>2?[...a].sort((N,v)=>(v.outcomes?.[0]?.price??0)-(N.outcomes?.[0]?.price??0)):a,[a]).filter(N=>N.status==="open"),d=u.length===1,p=u.slice(0,Bo),m=u.length-Bo,f=react.useMemo(()=>`$${Math.round(e.volume??0).toLocaleString("en-US")}`,[e.volume]),g=l?u.find(N=>N.slug===l)??null:null,h=!!g||d,x=()=>{h||o?.(e);},P=N=>{N.stopPropagation(),g&&(N.preventDefault(),s(null));},y=N=>{N.stopPropagation(),t||(N.preventDefault(),o?.(e));};return jsxRuntime.jsxs("div",{className:ui.cn("group flex h-full w-full flex-col rounded-xl","min-h-52 border border-border/90 bg-background p-3","lg:min-h-72 lg:max-w-md lg:p-4","gap-y-1.5 lg:gap-y-4","transition duration-300","hover:border-primary/40 hover:shadow-card-glow","focus-within:border-primary/40 focus-within:shadow-card-glow",!h&&"cursor-pointer"),onMouseEnter:()=>i?.(e),onClick:x,children:[jsxRuntime.jsx("style",{children:tc}),jsxRuntime.jsx(rc,{event:e,href:t,LinkComponent:r,onClick:P,isExpanded:h}),jsxRuntime.jsx("div",{className:"flex flex-1 flex-col",children:d?jsxRuntime.jsx(dc,{market:u[0],event:e,formattedVolume:f,href:t,LinkComponent:r,onSelect:o,onSelectOutcome:n}):g?jsxRuntime.jsx(uc,{market:g,event:e,onCollapse:()=>s(null),onSelectOutcome:n}):jsxRuntime.jsx(lc,{displayedMarkets:p,moreCount:m,formattedVolume:f,source:e.source,href:t,LinkComponent:r,onMarketClick:N=>s(N.slug),onShowMore:y})})]})}function rc({event:e,href:t,LinkComponent:r,onClick:o,isExpanded:n}){let i=e.start_at?ec(e.start_at):null;return jsxRuntime.jsxs(ui.Linkable,{href:t,LinkComponent:r,as:"button",className:"group/header flex items-center gap-x-2 lg:gap-x-4 w-full text-left cursor-pointer",onClick:o,children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"lg",className:"h-8 w-8 flex-shrink-0 transition-transform duration-300 group-hover/header:scale-110 lg:h-12 lg:w-12",classNames:{base:"bg-transparent"}}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("p",{className:ui.cn("min-w-0 text-sm font-semibold leading-snug text-slate-200 line-clamp-2 lg:text-base",n&&"group-hover/header:text-neutral-400"),children:e.title}),i&&jsxRuntime.jsxs("span",{className:"text-[10px] leading-4 text-neutral-500",children:["Live in ",i]})]}),jsxRuntime.jsx(oc,{event:e})]})}function nc(e){let t=[];if(e.status==="closed")return t.push({kind:"closed"}),t.slice(0,2);let r=e.tags?.some(n=>n.label?.toLowerCase()==="crypto"),o=e.tags?.some(n=>n.label?.toLowerCase()==="live");if(r&&e.end_at){let n=new Date(e.end_at).getTime()-Date.now(),i=300*1e3,l=900*1e3;if(n>0&&n<=l){let s=n<=i?"#ef4444":"#f59e0b";t.push({kind:"crypto-short",label:n<=i?"5m":"15m",color:s});}}return o&&t.push({kind:"live"}),t.slice(0,2)}function oc({event:e}){let t=react.useMemo(()=>nc(e),[e]);return t.length===0?null:jsxRuntime.jsx("div",{className:"flex flex-shrink-0 flex-col items-end gap-1",children:t.map((r,o)=>{switch(r.kind){case "live":return jsxRuntime.jsx(sc,{},o);case "crypto-short":return jsxRuntime.jsx(ac,{label:r.label,color:r.color},o);case "closed":return jsxRuntime.jsx(ic,{},o)}})})}function sc(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("span",{className:"badge-shine relative inline-flex items-center gap-1 overflow-hidden rounded-md bg-[rgb(240,68,56)]/10 px-1.5 py-0.5 text-xs font-semibold text-[rgb(240,68,56)]",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-current"}),e("predict.event.status.live")]})}function ac({label:e,color:t}){return jsxRuntime.jsxs("span",{className:"badge-shine relative inline-flex items-center gap-1 overflow-hidden rounded-md px-1.5 py-0.5 text-xs font-semibold",style:{backgroundColor:`${t}26`,color:t},children:[jsxRuntime.jsx(ui.TimerIcon,{className:"size-3 shrink-0"}),e]})}function ic(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsx("span",{className:"inline-flex items-center rounded-md bg-neutral-800/80 px-1.5 py-0.5 text-xs font-semibold text-neutral-400",children:e("predict.event.status.closed")})}function lc({displayedMarkets:e,moreCount:t,formattedVolume:r,source:o,href:n,LinkComponent:i,onMarketClick:l,onShowMore:s}){let{t:a}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e.length>0&&jsxRuntime.jsx("div",{className:"flex w-full flex-1 flex-col gap-y-0.5 lg:gap-y-2",children:e.map(c=>{let u=Vo(c);return jsxRuntime.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between gap-x-2 transition-opacity hover:cursor-pointer hover:opacity-80",onClick:d=>{d.stopPropagation(),l(c);},children:[jsxRuntime.jsx("span",{className:"min-w-0 flex-1 text-left text-xs text-slate-200 line-clamp-1 lg:text-sm",children:c.outcomes?.[0]?.label??c.question}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-slate-200 lg:text-lg",children:jo(u)}),jsxRuntime.jsx(cc,{})]})]},c.id??`${c.source}-${c.slug}`)})}),jsxRuntime.jsxs("div",{className:"mt-auto flex items-center justify-between pt-3",children:[t>0?jsxRuntime.jsxs(ui.Linkable,{href:n,LinkComponent:i,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-neutral-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:s,children:[a("predict.event.showMore"),jsxRuntime.jsx(qo,{className:"h-3 w-3"})]}):jsxRuntime.jsx("div",{}),jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1.5 text-[10px] font-normal text-neutral-500 lg:text-xs",children:[r," ",a("predict.event.volume"),jsxRuntime.jsx(Qo,{source:o})]})]})]})}function zo({bgColor:e,textColor:t,shadowColor:r,onClick:o,children:n}){return jsxRuntime.jsx("button",{type:"button",className:"flex h-12 flex-1 w-full items-center justify-center gap-x-1 overflow-hidden rounded-lg p-3 text-base font-normal hover:cursor-pointer will-change-transform [-webkit-tap-highlight-color:transparent]",style:{backgroundColor:e,color:t,"--shadow-color":r,"--shadow-offset":"4px",boxShadow:"inset 0 -1px 0 rgba(255,255,255,0.08), 0 var(--shadow-offset, 4px) 0 var(--shadow-color, rgba(0,0,0,0.22))",transition:"transform .12s, box-shadow .12s, opacity .14s"},onMouseEnter:s=>{let a=s.currentTarget;a.style.setProperty("--shadow-offset","2px"),a.style.transform="translateY(2px)";},onMouseLeave:s=>{let a=s.currentTarget;a.style.setProperty("--shadow-offset","4px"),a.style.transform="translateY(0px)";},onClick:o,children:n})}function Yo({market:e,event:t,onSelectOutcome:r,dynamicColors:o=false,labelFormat:n="action"}){let{t:i}=i18n.useTranslation(),[l,s]=o?Zl(e):[tn,Ko],a=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",c=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",u=n==="label"&&a===c?"action":n,d=u==="label"?`${e.outcomes?.[0]?.label??"Yes"} ${$o(e)}\xA2`:i("predict.market.action.yes",{price:$o(e)}),p=u==="label"?`${e.outcomes?.[1]?.label??"No"} ${Wo(e)}\xA2`:i("predict.market.action.no",{price:Wo(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(zo,{bgColor:l.bg,textColor:l.text,shadowColor:l.shadow,onClick:m=>{m.stopPropagation(),r?.(t,e,"yes");},children:d}),jsxRuntime.jsx(zo,{bgColor:s.bg,textColor:s.text,shadowColor:s.shadow,onClick:m=>{m.stopPropagation(),r?.(t,e,"no");},children:p})]})}function cc(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("span",{className:"inline-flex h-7 w-[85px] items-center justify-center gap-x-3 rounded-lg p-1.5 text-xs font-semibold flex-shrink-0 bg-gradient-to-r from-primary/15 to-secondary/15 lg:h-9 lg:w-24 lg:gap-x-4 lg:p-2 lg:text-sm",children:[jsxRuntime.jsx("span",{className:"text-primary",children:e("predict.market.yes")}),jsxRuntime.jsx("span",{className:"text-neutral-400",children:"/"}),jsxRuntime.jsx("span",{className:"text-secondary",children:e("predict.market.no")})]})}function dc({market:e,event:t,formattedVolume:r,href:o,LinkComponent:n,onSelect:i,onSelectOutcome:l}){let{t:s}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex-1",children:jsxRuntime.jsx(Yo,{market:e,event:t,onSelectOutcome:l,dynamicColors:true,labelFormat:"label"})}),jsxRuntime.jsxs("div",{className:"mt-auto flex items-center justify-between pt-3",children:[jsxRuntime.jsxs(ui.Linkable,{href:o,LinkComponent:n,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-neutral-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:c=>{c.stopPropagation(),o||(c.preventDefault(),i?.(t));},children:[s("predict.event.viewEvent"),jsxRuntime.jsx(qo,{className:"h-3 w-3"})]}),jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1.5 text-[10px] font-normal text-neutral-500 lg:text-xs",children:[r," ",s("predict.event.volume"),jsxRuntime.jsx(Qo,{source:t.source})]})]})]})}function uc({market:e,event:t,onCollapse:r,onSelectOutcome:o}){let{t:n}=i18n.useTranslation(),i=Vo(e);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between cursor-pointer",onClick:l=>{l.stopPropagation(),r();},children:[jsxRuntime.jsx("span",{className:"min-w-0 flex-1 text-left text-xs text-slate-200 lg:text-sm",children:e.outcomes?.[0]?.label??e.question}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1 flex-shrink-0",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-slate-200 lg:text-lg",children:jo(i)}),jsxRuntime.jsx(ui.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{className:"mt-3",children:jsxRuntime.jsx(Yo,{market:e,event:t,onSelectOutcome:o,labelFormat:"action"})})]}),jsxRuntime.jsxs("button",{type:"button",className:"mt-auto flex items-center gap-x-1 pt-4 text-[10px] font-normal text-neutral-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:l=>{l.stopPropagation(),r();},children:[jsxRuntime.jsx(pc,{className:"h-3 w-3"}),n("predict.event.back")]})]})}function qo({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:jsxRuntime.jsx("path",{d:"M4.5 2.5L8 6l-3.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function pc({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:jsxRuntime.jsx("path",{d:"M7.5 2.5L4 6l3.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Qo({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}var vc=768,Zo=1024,bc=1280,yc=8,kc=224,Sc=304,Nc=114;function Pc(e){return e>=bc?4:e>=Zo?3:e>=vc?2:1}function wc(e){return e>=Zo?Sc:kc}function Jo({events:e,hasMore:t=false,onFetchMore:r,onSelect:o,onSelectOutcome:n,getEventHref:i,LinkComponent:l,onHover:s}){let a=react.useRef(null),c=react.useRef(null),{width:u=0,height:d=0}=hooks.useResizeObserver({ref:a}),p=Pc(u),m=wc(u),f=Math.ceil(e.length/p)||0,g=!t&&e.length>0,h=f+(t?1:0)+(g?1:0),x=react.useCallback(v=>v<f,[f]),P=react.useCallback(async()=>{r?.();},[r]),y=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:x,loadMoreRows:P,rowCount:h,threshold:3}),N=react.useCallback(()=>{c.current?.scrollToRow({index:0,behavior:"smooth"});},[]);return jsxRuntime.jsx("div",{ref:a,className:"@container w-full h-full",children:d>0&&jsxRuntime.jsx(reactWindow.List,{listRef:c,className:"no-scrollbar",style:{height:d},onRowsRendered:y,rowComponent:Cc,rowCount:h,rowHeight:v=>g&&v===h-1?Nc:(m),rowProps:{events:e,columnCount:p,dataRowCount:f,showEndOfList:g,totalRowCount:h,onSelect:o,onSelectOutcome:n,getEventHref:i,LinkComponent:l,onHover:s,onScrollToTop:N}})})}function Cc({index:e,style:t,events:r,columnCount:o,dataRowCount:n,showEndOfList:i,totalRowCount:l,onSelect:s,onSelectOutcome:a,getEventHref:c,LinkComponent:u,onHover:d,onScrollToTop:p}){if(i&&e===l-1)return jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(Mc,{onScrollToTop:p})});if(e>=n)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-start pt-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})});let m=e*o,f=r.slice(m,m+o),g=o-f.length;return jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsxs("div",{className:"flex w-full h-full",children:[f.map((h,x)=>h==null?null:jsxRuntime.jsx("div",{className:"flex-1 min-w-0 flex",style:{padding:yc},children:jsxRuntime.jsx(Go,{event:h,href:c?.(h),LinkComponent:u,onSelect:s,onSelectOutcome:a,onHover:d})},`${m+x}-${h.source}-${h.slug}`)),g>0&&Array.from({length:g}).map((h,x)=>jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}},`spacer-${x}`))]})})}function Mc({onScrollToTop:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:"flex w-full flex-col items-center justify-center gap-y-4 py-6",children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-center gap-x-4",children:[jsxRuntime.jsx("div",{className:"h-px w-16 bg-neutral-700"}),jsxRuntime.jsx("span",{className:"text-xs font-medium text-neutral-500",children:t("predict.event.endOfList")}),jsxRuntime.jsx("div",{className:"h-px w-16 bg-neutral-700"})]}),jsxRuntime.jsxs("button",{type:"button",className:"flex cursor-pointer items-center gap-x-1 text-xs font-medium text-neutral-400",onClick:e,children:[jsxRuntime.jsx("span",{className:"iconify size-4 ph--arrow-up-bold"}),jsxRuntime.jsx("span",{children:t("predict.event.backToTop")})]})]})}function ts({tagSlugSelection:e,limit:t=48,status:r,sort_by:o,sort_asc:n,source:i,with_markets:l,timeRemaining:s,minVolume:a,minLiquidity:c,onSelect:u,onSelectOutcome:d,getEventHref:p,LinkComponent:m,onHover:f}){let{data:g,hasMore:h,fetchMore:x,isFetching:P}=Fo({tagSlugSelection:e,limit:t,status:r,sort_by:o,sort_asc:n,source:i,with_markets:l,timeRemaining:s,minVolume:a,minLiquidity:c});return P?jsxRuntime.jsx(Jr,{count:48}):jsxRuntime.jsx(Jo,{events:g,hasMore:h,onFetchMore:x,onSelect:u,onSelectOutcome:d,getEventHref:p,LinkComponent:m,onHover:f})}function o0({onSelect:e,onSelectOutcome:t,getEventHref:r,LinkComponent:o,onHover:n}){let[i,l]=react.useState({categorySlug:null,tagSlug:null}),[s,a]=react.useState(Xr),{isOpen:c,onOpen:u,onClose:d}=ui.useDisclosure(),{onOpen:p}=uiScaffold.useAsyncModal(It),m=react.useCallback((v,H,b)=>{t?.(v,H,b),p({params:{event:v,market:H,initialOutcome:b}});},[t,p]),f=react.useCallback(v=>{l(v);},[]),g=react.useCallback(v=>{a(H=>({...H,sortPreset:v}));},[]),h=react.useCallback(v=>{a(H=>({...H,sortAsc:v}));},[]),x=react.useCallback(v=>{a(v);},[]),P=react.useMemo(()=>Io[s.sortPreset].sort_by,[s.sortPreset]),y=react.useMemo(()=>Zr(s),[s]),N=react.useMemo(()=>jsxRuntime.jsx(Oo,{sortPreset:s.sortPreset,onSortChange:g,sortAsc:s.sortAsc,onSortAscChange:h,onFilterPress:u,filterCount:y}),[s.sortPreset,s.sortAsc,y,g,h,u]);return jsxRuntime.jsxs("div",{className:"flex h-full w-full max-w-[1680px] mx-auto flex-col gap-y-3",children:[jsxRuntime.jsx(io,{onSelect:f,trailing:N}),jsxRuntime.jsx(To,{isOpen:c,onClose:d,value:s,onChange:x}),jsxRuntime.jsx("div",{className:"min-h-0 flex-1",children:jsxRuntime.jsx(ts,{tagSlugSelection:i,sort_by:P,sort_asc:s.sortAsc,source:s.source,timeRemaining:s.timeRemaining,minVolume:s.minVolume,minLiquidity:s.minLiquidity,onSelect:e,onSelectOutcome:m,getEventHref:r,LinkComponent:o,onHover:n})}),jsxRuntime.jsx(lr,{})]})}var cn=40,gr=36,$t=480,dn=$t-gr;function ss({event:e,walletAddress:t,onCancelOrder:r}){let{t:o}=i18n.useTranslation(),[n,i]=react.useState("positions"),l=react.useMemo(()=>e.markets?.map(d=>d.slug)??[],[e.markets]),{data:s}=reactPredict.usePositions({source:e.source,user:t??""}),a=react.useMemo(()=>!s?.positions||!t?0:l.length===0?s.positions.length:s.positions.filter(d=>d.market&&l.includes(d.market.slug)).length,[s?.positions,l,t]),u=[{key:"positions",label:a>0?`${o("predict.positions.title")} (${a})`:o("predict.positions.title")},{key:"orders",label:o("predict.openOrders.title")},{key:"trades",label:o("predict.tradeHistory.title")}];return jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2 mt-6 px-1 lg:px-4",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-x-1 border-b border-border",children:u.map(d=>jsxRuntime.jsx("button",{type:"button",onClick:()=>i(d.key),className:ui.cn("px-3 py-2 text-sm font-medium transition-colors cursor-pointer",n===d.key?"text-foreground border-b-2 border-primary":"text-neutral hover:text-foreground"),children:d.label},d.key))}),t?jsxRuntime.jsxs("div",{style:{height:$t},children:[n==="positions"&&jsxRuntime.jsx(Dc,{source:e.source,walletAddress:t,marketSlugs:l}),n==="orders"&&jsxRuntime.jsx(Bc,{source:e.source,walletAddress:t,marketSlugs:l,onCancelOrder:r}),n==="trades"&&jsxRuntime.jsx(Wc,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:$t},children:o("predict.trade.connectWallet")})]})}function Dc({source:e,walletAddress:t,marketSlugs:r}){let{t:o}=i18n.useTranslation(),{data:n,isLoading:i}=reactPredict.usePositions({source:e,user:t}),l=react.useMemo(()=>n?.positions?r.length===0?n.positions:n.positions.filter(s=>s.market&&r.includes(s.market.slug)):[],[n?.positions,r]);return i?jsxRuntime.jsx(pn,{}):l.length===0?jsxRuntime.jsx(un,{message:o("predict.positions.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:gr},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2 whitespace-nowrap",children:o("predict.positions.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.markPrice")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:o("predict.positions.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:o("predict.positions.estSettlement")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:dn},rowComponent:Fc,rowCount:l.length,rowHeight:cn,rowProps:{positions:l,closeLabel:o("predict.positions.close")}})]})}function Fc({index:e,style:t,positions:r,closeLabel:o}){let n=r[e];if(!n)return null;let i=n.pnl??0,l=n.pnl_percent??0,s=n.avg_price??0,a=n.current_price??0,c=i>0?"text-success":i<0?"text-danger":"text-foreground",u=i>0?"+":"",d=n.market?.outcomes?.[0]?.label??n.market?.question??"\u2014",p=n.side,m=n.size,f=n.size*a,g=n.market?.end_at?Kc(n.market.end_at):"\u2014";return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium",children:d}),jsxRuntime.jsx("span",{className:ui.cn("text-[10px] font-medium",p.toLowerCase()==="yes"?"text-primary":"text-secondary"),children:p})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:n.size}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",f.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:mr(s)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:mr(a)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",c),children:[u,"$",Math.abs(i).toFixed(2),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",u,l.toFixed(1),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",m.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:g}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors rounded px-2 py-0.5 border border-border hover:border-foreground/40",children:o})})]})}function Bc({source:e,walletAddress:t,marketSlugs:r,onCancelOrder:o}){let{t:n}=i18n.useTranslation(),{data:i,isLoading:l,fetchNextPage:s,hasNextPage:a}=reactPredict.useInfiniteOrders({source:e,wallet_address:t}),c=reactPredict.useCancelOrder(),u=react.useMemo(()=>{let x=i?.pages?.flatMap(N=>N.items)??[],P=new Set(["live","open","submitted","pending"]),y=x.filter(N=>P.has(N.status));return r.length>0&&(y=y.filter(N=>N.market_id&&r.includes(N.market_id))),y},[i?.pages,r]),d=react.useCallback(x=>{o?o(x.id):c.mutate({source:x.source,id:x.id});},[o,c]),p=u.length,m=p+(a?1:0),f=react.useCallback(x=>x<p,[p]),g=react.useCallback(async()=>{await s();},[s]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:f,loadMoreRows:g,rowCount:m,threshold:5});return l?jsxRuntime.jsx(pn,{}):u.length===0&&!a?jsxRuntime.jsx(un,{message:n("predict.openOrders.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:gr},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:n("predict.openOrders.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.openOrders.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.openOrders.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.openOrders.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.openOrders.filled")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:n("predict.openOrders.status")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:dn},onRowsRendered:h,rowComponent:Hc,rowCount:m,rowHeight:cn,rowProps:{orders:u,itemCount:p,onCancel:d,isCancelling:c.isPending,cancelLabel:n("predict.openOrders.cancel")}})]})}function Hc({index:e,style:t,orders:r,itemCount:o,onCancel:n,isCancelling:i,cancelLabel:l}){if(e>=o)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})});let s=r[e];if(!s)return null;let a=s.side==="BUY";return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",a?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children:s.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:s.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize",children:s.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:s.price?mr(parseFloat(s.price)):"\u2014"}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:[s.size_matched??"0","/",s.original_size??"\u2014"]}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:jsxRuntime.jsx($c,{status:s.status})}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>n(s),disabled:i,className:"text-[10px] text-danger hover:text-danger/80 cursor-pointer disabled:opacity-50 transition-colors",children:i?jsxRuntime.jsx(ui.Spinner,{size:"sm"}):l})})]})}function $c({status:e}){return jsxRuntime.jsx("span",{className:ui.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium capitalize",{live:"bg-success/10 text-success",open:"bg-success/10 text-success",submitted:"bg-warning/10 text-warning",pending:"bg-warning/10 text-warning",matched:"bg-primary/10 text-primary",cancelled:"bg-neutral/10 text-neutral",failed:"bg-danger/10 text-danger",expired:"bg-neutral/10 text-neutral"}[e]??"bg-neutral/10 text-neutral"),children:e})}function Wc({source:e,walletAddress:t}){let{t:r}=i18n.useTranslation(),{data:o,isLoading:n,fetchNextPage:i,hasNextPage:l}=reactPredict.useInfiniteTrades({source:e,wallet:t,limit:50}),s=react.useMemo(()=>o?.pages?.flatMap(m=>m.items)??[],[o?.pages]),a=s.length,c=a+(l?1:0),u=react.useCallback(m=>m<a,[a]),d=react.useCallback(async()=>{await i();},[i]),p=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:u,loadMoreRows:d,rowCount:c,threshold:5});return n?jsxRuntime.jsx(pn,{}):s.length===0&&!l?jsxRuntime.jsx(un,{message:r("predict.tradeHistory.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:gr},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:r("predict.tradeHistory.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:r("predict.tradeHistory.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.qty")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.total")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:r("predict.tradeHistory.time")})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:dn},onRowsRendered:p,rowComponent:zc,rowCount:c,rowHeight:cn,rowProps:{trades:s,itemCount:a}})]})}function zc({index:e,style:t,trades:r,itemCount:o}){if(e>=o)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})});let n=r[e];if(!n)return null;let i=n.side?.toUpperCase()==="BUY",l=Uc(n.timestamp),s=n.price??0,a=n.usd_size??0;return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",i?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children:n.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:n.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:mr(s)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:n.size}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",a.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:l})]})}function un({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:$t},children:e})}function pn(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:$t},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function mr(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function Uc(e){let t=new Date(e*1e3),r=(t.getMonth()+1).toString().padStart(2,"0"),o=t.getDate().toString().padStart(2,"0"),n=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0");return `${r}/${o} ${n}:${i}`}function Kc(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}function Wt({marketCount:e=4,showBack:t}){return jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-4 animate-pulse lg:gap-6",children:[t&&jsxRuntime.jsx("div",{className:"h-5"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2 h-16 lg:h-20 lg:gap-x-4",children:[jsxRuntime.jsx(ui.Skeleton,{className:"size-16 shrink-0 rounded-lg lg:size-20"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-12 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-10 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-10 rounded"})]}),jsxRuntime.jsx(ui.Skeleton,{className:"h-5 w-full max-w-sm rounded lg:h-6"})]})]}),jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-48 rounded"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-24 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-20 rounded"})]}),jsxRuntime.jsx(ui.Skeleton,{className:"h-[300px] w-full rounded-xl"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-20 rounded"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-[200px] rounded-lg"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-28 rounded-lg"})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("div",{className:"flex items-center py-2",children:[jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-14 rounded"}),jsxRuntime.jsx("div",{className:"flex-1"})]}),Array.from({length:e}).map((r,o)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2 border-b border-border py-2.5 lg:gap-x-3",children:[jsxRuntime.jsx(ui.Skeleton,{className:"size-5 shrink-0 rounded-lg lg:size-8"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-32 rounded lg:h-4 lg:w-48"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-2.5 w-16 rounded"})]}),jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-10 rounded"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-16 rounded-lg lg:w-24"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-16 rounded-lg lg:w-24"})]})]},o))]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-16 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-full rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-4/5 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-3/5 rounded"})]})]})}function as(){return jsxRuntime.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border border-border p-4 animate-pulse",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-10 w-full rounded-lg"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-24 w-full rounded-lg"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-10 w-full rounded-lg"})]})}var ds="var(--color-bullish)",us="var(--color-bearish)";function zt(e){let t=Math.abs(e);return t>=1e9?`${parseFloat((e/1e9).toFixed(2))}B`:t>=1e6?`${parseFloat((e/1e6).toFixed(2))}M`:t>=1e3?`${parseFloat((e/1e3).toFixed(2))}K`:e.toLocaleString()}function Gc(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function Yc(e,t){let r=new Float64Array(101),o=new Float64Array(101);for(let m of e){let f=Math.round(m.price*100);f>=0&&f<=100&&(r[f]+=m.quantity);}for(let m of t){let f=Math.round(m.price*100);f>=0&&f<=100&&(o[f]+=m.quantity);}let n=0,i=0,l=new Float64Array(101),s=new Float64Array(101);for(let m=100;m>=0;m--)n+=r[m],i+=r[m]*m/100,l[m]=n,s[m]=i;let a=0,c=0,u=new Float64Array(101),d=new Float64Array(101);for(let m=0;m<=100;m++)a+=o[m],c+=o[m]*m/100,u[m]=a,d[m]=c;let p=Math.max(l[0]??0,u[100]??0);return Array.from({length:101},(m,f)=>{let g=l[f]>0,h=u[f]>0,x=l[f]||u[f],P=r[f]>0||o[f]>0;return {priceCents:f,displayHeight:Gc(x,p),opacity:x>0?P?1:.5:0,isBid:g,isAsk:h,bidCumTotal:l[f],askCumTotal:u[f],bidCumCost:s[f],askCumCost:d[f]}})}function qc({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?ds:us,o=e.leftPct>65?void 0:`${e.leftPct}%`,n=e.leftPct>65?`${100-e.leftPct}%`:void 0;return jsxRuntime.jsxs("div",{style:{position:"absolute",top:8,left:o,right:n,zIndex:10,background:"rgba(17,24,39,0.95)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:8,padding:"8px 12px",fontSize:12,color:"#f9fafb",minWidth:140,pointerEvents:"none"},children:[jsxRuntime.jsx("div",{style:{marginBottom:4,fontWeight:600},children:t("predict.orderBook.depthToPrice",{price:e.priceCents})}),jsxRuntime.jsx("div",{style:{color:r},children:t("predict.orderBook.depthContracts",{amount:zt(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",zt(Math.round(e.cumCost))]})]})}var Qc=react.memo(function({slot:t,onEnter:r,onLeave:o}){let n=react.useRef(null),i=t.isBid||t.isAsk,l=t.isBid?ds:t.isAsk?us:void 0;return jsxRuntime.jsx("div",{style:{position:"absolute",left:`${t.priceCents}%`,width:"1%",height:"100%",boxSizing:"border-box",borderRight:t.priceCents<100?"1px solid transparent":"none",cursor:i?"crosshair":"default"},onMouseEnter:()=>r(t,n.current),onMouseLeave:o,children:i&&jsxRuntime.jsx("div",{ref:n,style:{position:"absolute",bottom:0,left:0,width:"100%",height:`${t.displayHeight*100}%`,backgroundColor:l,opacity:t.opacity}})})}),Xc=[0,10,20,30,40,50,60,70,80,90,100];function Zc(){return jsxRuntime.jsx("div",{className:"relative flex h-6 items-center border-b border-t border-border px-1",style:{background:"rgba(0,0,0,0.15)"},children:Xc.map(e=>jsxRuntime.jsx("span",{className:"absolute text-neutral font-normal",style:{fontSize:10,left:`${e}%`,transform:e===0?"translateX(0px)":e===100?"translateX(-100%)":"translateX(-50%)"},children:e},e))})}function ps({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),o=react.useMemo(()=>Yc(e,t),[e,t]),n=react.useMemo(()=>{let d=e.length>0?Math.max(...e.map(m=>m.price)):0,p=t.length>0?Math.min(...t.map(m=>m.price)):1;return Math.round((d+p)/2*100)},[e,t]),i=react.useMemo(()=>o.some(d=>d.isBid||d.isAsk),[o]),[l,s]=react.useState(null),a=react.useRef(null),c=react.useCallback((d,p)=>{a.current&&(a.current.style.filter=""),p?(p.style.filter="brightness(1.5)",a.current=p):a.current=null,d.isBid||d.isAsk?s({priceCents:d.priceCents,isBid:d.isBid,cumTotal:d.isBid?d.bidCumTotal:d.askCumTotal,cumCost:d.isBid?d.bidCumCost:d.askCumCost,leftPct:d.priceCents}):s(null);},[]),u=react.useCallback(()=>{a.current&&(a.current.style.filter="",a.current=null),s(null);},[]);return i?jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",userSelect:"none",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{flex:1,position:"relative",width:"100%",overflow:"hidden"},children:[n>0&&jsxRuntime.jsx("div",{style:{position:"absolute",left:`${n}%`,top:0,bottom:0,width:1,backgroundImage:"repeating-linear-gradient(to bottom, #6b7280 0, #6b7280 4px, transparent 4px, transparent 8px)",zIndex:1,pointerEvents:"none"}}),l&&jsxRuntime.jsx(qc,{info:l}),o.map(d=>jsxRuntime.jsx(Qc,{slot:d,onEnter:c,onLeave:u},d.priceCents))]}),jsxRuntime.jsx(Zc,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function fn(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function ms(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-x-2 h-full text-neutral text-xs",children:[jsxRuntime.jsx(ui.Spinner,{size:"sm"}),jsxRuntime.jsx("span",{children:e("predict.orderBook.loading")})]})}function xs({market:e,outcome:t="yes",onTradeAction:r}){let{t:o}=i18n.useTranslation(),[n,i]=react.useState("depth"),l=t==="no",s=e.source,{data:a,isLoading:c}=reactPredict.useOrderbook({slug:e.slug,source:s}),u=react.useMemo(()=>((l?a?.asks:a?.bids)??[]).map(h=>({price:l?1-h.price:h.price,quantity:h.size})),[a?.bids,a?.asks,l]),d=react.useMemo(()=>((l?a?.bids:a?.asks)??[]).map(h=>({price:l?1-h.price:h.price,quantity:h.size})),[a?.bids,a?.asks,l]),p=react.useMemo(()=>u.length>0?Math.max(...u.map(g=>g.price)):null,[u]),m=react.useMemo(()=>d.length>0?Math.min(...d.map(g=>g.price)):null,[d]),f=react.useMemo(()=>{if(p==null||m==null)return null;let g=(m-p)*100;return Math.round(g*10)/10},[p,m]);return jsxRuntime.jsxs("div",{className:"flex flex-col h-[262px]",children:[jsxRuntime.jsxs("div",{className:"flex h-9 items-center border-b border-border px-1 text-xs",children:[jsxRuntime.jsx("span",{className:"flex-1 text-left text-neutral",children:f!=null?`${o("predict.orderBook.spread")}: ${Number.isInteger(f)?`${f}\xA2`:`${f.toFixed(1)}\xA2`}`:null}),jsxRuntime.jsxs("span",{className:"flex flex-1 items-center justify-center gap-x-1 whitespace-nowrap",children:[p!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bullish)"},children:[o("predict.trade.bestBid"),": ",fn(p)]}),p!=null&&m!=null&&jsxRuntime.jsx("span",{className:"text-neutral",children:"|"}),m!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bearish)"},children:[o("predict.trade.bestAsk"),": ",fn(m)]})]}),jsxRuntime.jsx("div",{className:"flex flex-1 justify-end",children:jsxRuntime.jsx("button",{type:"button",title:n==="depth"?"Orderbook":"Depth chart",onClick:()=>i(g=>g==="depth"?"table":"depth"),className:"flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground",children:n==="depth"?jsxRuntime.jsx(ui.OrderbookTableIcon,{className:"h-4 w-4"}):jsxRuntime.jsx(ui.OrderbookDepthIcon,{className:"h-4 w-4"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden",children:[n==="depth"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(ms,{}):jsxRuntime.jsx(ps,{bids:u,asks:d})}),n==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(ms,{}):jsxRuntime.jsx(od,{bids:u,asks:d,bestBid:p??void 0,bestAsk:m??void 0,spread:f??void 0})})]})]})}var fs=8;function od({bids:e,asks:t,spread:r}){let{t:o}=i18n.useTranslation(),n=react.useMemo(()=>[...t].sort((a,c)=>a.price-c.price).slice(0,fs).reverse(),[t]),i=react.useMemo(()=>[...e].sort((a,c)=>c.price-a.price).slice(0,fs),[e]),l=react.useMemo(()=>{let a=[...n,...i].map(c=>c.quantity);return Math.max(...a,1)},[n,i]);return n.length===0&&i.length===0?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full text-xs text-neutral",children:o("predict.orderBook.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full overflow-y-auto text-xs font-mono select-none",children:[n.map(a=>jsxRuntime.jsx(gs,{price:a.price,quantity:a.quantity,side:"ask",maxQty:l},`ask-${a.price}`)),jsxRuntime.jsx("div",{className:"flex items-center justify-center gap-x-2 py-1 border-y border-border text-neutral text-[10px]",children:r!=null&&jsxRuntime.jsxs("span",{children:[o("predict.orderBook.spread"),":"," ",Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`]})}),i.map(a=>jsxRuntime.jsx(gs,{price:a.price,quantity:a.quantity,side:"bid",maxQty:l},`bid-${a.price}`)),jsxRuntime.jsxs("div",{className:"grid grid-cols-3 px-2 pt-2 pb-0.5 text-[10px] text-neutral border-t border-border",children:[jsxRuntime.jsx("span",{children:o("predict.orderBook.price")}),jsxRuntime.jsx("span",{className:"text-center",children:o("predict.orderBook.contracts")}),jsxRuntime.jsx("span",{className:"text-right",children:o("predict.orderBook.total")})]})]})}function gs({price:e,quantity:t,side:r,maxQty:o}){let n=r==="ask",i=Math.min(t/o*100,100),l=n?"bg-bearish/10":"bg-bullish/10",s=n?"text-bearish":"text-bullish",a=zt(Math.round(t)),c=Math.round(t*e),u=`$${zt(c)}`;return jsxRuntime.jsxs("div",{className:"relative grid grid-cols-3 px-2 py-1 hover:bg-content2 transition-colors cursor-default",children:[jsxRuntime.jsx("div",{className:`absolute inset-y-0 left-0 ${l} transition-[width] duration-200`,style:{width:`${i}%`}}),jsxRuntime.jsx("span",{className:`relative z-10 ${s}`,children:fn(e)}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-center",children:a}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-right",children:u})]})}var xn=class extends react.Component{state={error:null};static getDerivedStateFromError(t){return {error:t}}componentDidCatch(t,r){}render(){return this.state.error?jsxRuntime.jsxs("div",{style:{height:this.props.fallbackHeight??320,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,color:"#6b7280",fontSize:13},children:[jsxRuntime.jsx("span",{children:"Chart unavailable"}),jsxRuntime.jsx("span",{style:{fontSize:11,opacity:.7},children:this.state.error.message})]}):this.props.children}},vr=4,vs=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function hd(e,t){let r=new Date(e);return t===reactPredict.ChartRange.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function xd(e,t){let r=new Date(e);return t===reactPredict.ChartRange.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):t===reactPredict.ChartRange.ONE_WEEK?r.toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function bs(e){return `${(e*100).toFixed(2)}%`}var vd=[{range:reactPredict.ChartRange.ONE_DAY,label:"1D"},{range:reactPredict.ChartRange.ONE_WEEK,label:"1W"},{range:reactPredict.ChartRange.ONE_MONTH,label:"1M"},{range:reactPredict.ChartRange.ALL,label:"ALL"}];function bd({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:vd.map(({range:r,label:o})=>{let n=r===e;return jsxRuntime.jsx("button",{onClick:()=>t(r),style:{padding:"2px 8px",border:"none",background:"transparent",color:n?"#f9fafb":"#6b7280",fontWeight:n?700:400,fontSize:12,cursor:"pointer",borderRadius:4,letterSpacing:"0.02em",transition:"color 0.15s",userSelect:"none"},children:o},r)})})}function yd(){let e=react.useRef(null),t=react.useRef(null),r=react.useCallback(n=>{let i=e.current,l=t.current;if(!i||!l)return;let s=i.getBoundingClientRect(),a=(n.clientX-s.left)/s.width*100;l.style.background=`linear-gradient(to right, transparent ${a}%, rgba(0,0,0,0.55) ${a}%)`,l.style.opacity="1";},[]),o=react.useCallback(()=>{t.current&&(t.current.style.opacity="0");},[]);return {wrapperRef:e,overlayRef:t,onMouseMove:r,onMouseLeave:o}}function kd({active:e,payload:t,label:r,labelMap:o,allSeries:n,range:i}){if(!e||!n?.length)return null;let l=new Map;t?.forEach(a=>l.set(a.dataKey,a));let s=n.map(a=>l.get(a.slug)??{dataKey:a.slug,value:void 0,stroke:a.color,color:a.color});return jsxRuntime.jsxs("div",{style:{background:"rgba(10,10,10,0.92)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:8,padding:"8px 12px",minWidth:180,backdropFilter:"blur(8px)",fontSize:12},children:[jsxRuntime.jsx("div",{style:{color:"#9ca3af",marginBottom:6,fontWeight:500},children:typeof r=="number"?xd(r,i):r}),s.map(a=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:3},children:[jsxRuntime.jsx("span",{style:{display:"inline-block",width:3,height:14,borderRadius:2,background:a.stroke??a.color,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:"#9ca3af",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:120},children:o.get(a.dataKey)??a.dataKey}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontWeight:700,fontVariantNumeric:"tabular-nums"},children:a.value!=null?bs(a.value):"--"})]},a.dataKey))]})}function Sd({markets:e,selectedSlugs:t,colorMap:r,onToggle:o}){let[n,i]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{if(!n)return;function c(u){l.current&&!l.current.contains(u.target)&&i(false);}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]);let s=t.length>=vr,a=jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{display:"flex",gap:3,flexShrink:0},children:t.map(c=>jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:r.get(c)??"#6b7280",display:"inline-block"}},c))}),jsxRuntime.jsx("span",{style:{color:"#e5e7eb",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.length===1?(()=>{let c=e.find(u=>u.slug===t[0]);return c?.outcomes?.[0]?.label??c?.question??"1 market"})():`${t.length} / ${e.length} markets`})]});return jsxRuntime.jsxs("div",{ref:l,style:{position:"relative",display:"inline-block",width:200},children:[jsxRuntime.jsxs("button",{onClick:()=>i(c=>!c),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 10px",borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(255,255,255,0.05)",cursor:"pointer",width:"100%",userSelect:"none"},children:[a,jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{flexShrink:0,transform:n?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.15s",color:"#6b7280"},children:jsxRuntime.jsx("path",{d:"M2 4l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),n&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,zIndex:50,background:"#111827",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,boxShadow:"0 8px 24px rgba(0,0,0,0.5)",minWidth:260,maxWidth:360,maxHeight:320,overflowY:"auto",padding:"6px 0"},children:[jsxRuntime.jsxs("div",{style:{padding:"4px 12px 8px",fontSize:11,color:"#6b7280",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:["Select up to ",vr," markets"]}),e.map((c,u)=>{let d=t.includes(c.slug),p=!d&&s,m=d&&t.length===1,f=r.get(c.slug)??"#6b7280",g=c.outcomes.find(x=>x.label.toLowerCase()==="yes")??c.outcomes[0],h=g?.price!=null?`${Math.round(g.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{m||p||o(c.slug);},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"7px 12px",border:"none",background:d?"rgba(255,255,255,0.05)":"transparent",cursor:p||m?"not-allowed":"pointer",opacity:p?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:x=>{!p&&!m&&(x.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:x=>{x.currentTarget.style.background=d?"rgba(255,255,255,0.05)":"transparent";},children:[jsxRuntime.jsx("span",{style:{width:16,height:16,borderRadius:4,border:d?`2px solid ${f}`:"2px solid rgba(255,255,255,0.2)",background:d?`${f}30`:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:d&&jsxRuntime.jsx("svg",{width:"9",height:"7",viewBox:"0 0 9 7",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 3.5L3.5 6L8 1",stroke:f,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:f,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:d?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.outcomes?.[0]?.label??c.question}),h&&jsxRuntime.jsx("span",{style:{color:f,fontWeight:700,fontSize:12,flexShrink:0},children:h})]},c.id??`${u}-${c.slug}`)})]})]})}function Nd({series:e,colorMap:t,displayValues:r}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px 24px",padding:"0 2px"},children:e.map(o=>{let n=t.get(o.marketSlug)??"#6b7280",i=r.get(o.marketSlug);return jsxRuntime.jsxs("div",{style:{display:"inline-flex",alignItems:"flex-start",gap:6},children:[jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:n,flexShrink:0,marginTop:3}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1},children:[jsxRuntime.jsx("span",{style:{color:"#9ca3af",fontSize:12,lineHeight:"17px",whiteSpace:"nowrap"},children:o.label}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontSize:14,fontWeight:700,lineHeight:"20px",fontVariantNumeric:"tabular-nums"},children:i!=null?bs(i):"--"})]})]},o.marketSlug)})})}function Pd(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function wd(e,t){if(e.length<=t)return e;let r=[],o=e.length/t;for(let n=0;n<t;n++){let i=Math.floor(n*o),l=Math.min(Math.floor((n+1)*o),e.length),s=e.slice(i,l),a=s.map(c=>c.price).sort((c,u)=>c-u);r.push({timestamp:s[s.length-1].timestamp,price:Pd(a)});}return r}function Cd(e,t=200){if(e.length===0)return [];let r=e.map(s=>({...s,data:wd(s.data,t)})),o=new Set;r.forEach(s=>s.data.forEach(a=>o.add(a.timestamp)));let n=Array.from(o).sort((s,a)=>s-a),i=r.map(s=>{let a=new Map;return s.data.forEach(c=>a.set(c.timestamp,c.price)),{slug:s.marketSlug,map:a}}),l=new Map;return n.map(s=>{let a={timestamp:s};return i.forEach(({slug:c,map:u})=>{let d=u.get(s);if(d!==void 0)l.set(c,d),a[c]=d;else {let p=l.get(c);p!==void 0&&(a[c]=p);}}),a})}function ys(e){return jsxRuntime.jsx(xn,{children:jsxRuntime.jsx(Md,{...e})})}function Md({event:e,isLoading:t,className:r,volume:o}){let n=react.useMemo(()=>{let M=new Set;return (e.markets??[]).filter(L=>L.status!=="open"||M.has(L.slug)?false:(M.add(L.slug),true))},[e.markets]),i=react.useMemo(()=>[...n].sort((M,L)=>{let U=_=>(_.outcomes.find(oe=>oe.label.toLowerCase()==="yes")??_.outcomes[0])?.price??0;return U(L)-U(M)}),[n]),[l,s]=react.useState(()=>i.slice(0,vr).map(M=>M.slug)),[a,c]=react.useState(ar),u=react.useMemo(()=>{let M=new Map;return l.forEach((L,U)=>{M.set(L,vs[U%vs.length]);}),M},[l]),d=react.useMemo(()=>n.filter(M=>l.includes(M.slug)),[n,l]),{series:p,isLoading:m}=reactPredict.useMarketHistory(d,a),f=t||m,g=react.useMemo(()=>{if(p.length>0&&p.some(U=>U.data.length>0))return p;let M=Date.now(),L=864e5;return d.map(U=>{let oe=(U.outcomes?.find(ge=>ge.label.toLowerCase()==="yes")??U.outcomes?.[0])?.price??.5;return {marketSlug:U.slug,label:U.outcomes?.[0]?.label??U.question,data:[{timestamp:M-7*L,price:oe},{timestamp:M,price:oe}]}})},[p,d]),h=react.useMemo(()=>a===reactPredict.ChartRange.ONE_DAY?96:a===reactPredict.ChartRange.ONE_WEEK?168:a===reactPredict.ChartRange.ONE_MONTH?180:300,[a]),x=react.useMemo(()=>Cd(g,h),[g,h]),P=react.useMemo(()=>{if(x.length===0)return [0,1];let M=1/0,L=-1/0;if(l.forEach(_=>{x.forEach(oe=>{let ge=oe[_];ge!=null&&(ge<M&&(M=ge),ge>L&&(L=ge));});}),!isFinite(M))return [0,1];let U=Math.max((L-M)*.15,.05);return [Math.max(0,M-U),Math.min(1,L+U)]},[x,l]),y=react.useMemo(()=>{let M=new Map;return g.forEach(L=>{L.data.length>0&&M.set(L.marketSlug,L.data[L.data.length-1].price);}),M},[g]),N=react.useMemo(()=>{let M=new Map;return g.forEach(L=>M.set(L.marketSlug,L.label)),M},[g]),v=react.useMemo(()=>g.map(M=>({slug:M.marketSlug,color:u.get(M.marketSlug)??"#6b7280"})),[g,u]),{wrapperRef:H,overlayRef:b,onMouseMove:q,onMouseLeave:V}=yd(),le=react.useCallback(M=>{s(L=>L.includes(M)?L.length<=1?L:L.filter(U=>U!==M):L.length>=vr?L:[...L,M]);},[]),[z,A]=react.useState(null),$=react.useRef(null),F=react.useRef(""),se=react.useRef(0),pe=!f&&x.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsx(Nd,{series:g,colorMap:u,displayValues:z??y}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[jsxRuntime.jsx("div",{ref:H,style:{height:300,width:"100%",userSelect:"none",position:"relative"},onMouseMove:pe?M=>{q(M),cancelAnimationFrame(se.current),se.current=requestAnimationFrame(()=>{A($.current);});}:void 0,onMouseLeave:pe?()=>{V(),cancelAnimationFrame(se.current),F.current="",$.current=null,A(null);}:void 0,children:f?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",border:"2.5px solid #22d3ee",borderTopColor:"transparent",animation:"spin 0.7s linear infinite"}})}):x.length===0?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:"No price history data"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:b,style:{position:"absolute",inset:0,opacity:0,pointerEvents:"none",zIndex:1}}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",children:jsxRuntime.jsxs(recharts.LineChart,{data:x,margin:{top:8,right:16,left:0,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{horizontal:true,vertical:false,strokeDasharray:"3 3",stroke:"#374151",opacity:.5}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"timestamp",type:"number",scale:"time",domain:["dataMin","dataMax"],tickFormatter:M=>hd(M,a),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:P,tickFormatter:M=>`${Math.round(M*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:M=>{let L=M;if(L.active&&L.payload?.length){let U=L.payload.map(_=>`${_.dataKey}:${_.value}`).join(",");if(U!==F.current){F.current=U;let _=new Map;L.payload.forEach(oe=>{oe.value!=null&&_.set(oe.dataKey,oe.value);}),$.current=_;}}return jsxRuntime.jsx(kd,{...L,labelMap:N,allSeries:v,range:a})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),g.map(M=>{let L=u.get(M.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:M.marketSlug,stroke:L,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:L},connectNulls:true,isAnimationActive:false},M.marketSlug)}),z==null&&x.length>0&&g.map(M=>{let L=x[x.length-1],U=L[M.marketSlug];if(U==null)return null;let _=u.get(M.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:L.timestamp,y:U,ifOverflow:"extendDomain",shape:oe=>{let{cx:ge,cy:me}=oe;return ge==null||me==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:ge,cy:me,r:6,fill:_,opacity:.3,children:[jsxRuntime.jsx("animate",{attributeName:"r",values:"4;9;4",dur:"2s",repeatCount:"indefinite"}),jsxRuntime.jsx("animate",{attributeName:"opacity",values:"0.4;0.05;0.4",dur:"2s",repeatCount:"indefinite"})]}),jsxRuntime.jsx("circle",{cx:ge,cy:me,r:3.5,fill:_})]})}},`pulse-${M.marketSlug}`)})]})})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"6px 8px",marginTop:6},children:[o!=null&&o>0&&jsxRuntime.jsxs("span",{style:{color:"#6b7280",fontSize:12},children:["$",Math.round(o).toLocaleString()," vol"]}),jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),jsxRuntime.jsx(bd,{value:a,onChange:c}),i.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(Sd,{markets:i,selectedSlugs:l,colorMap:u,onToggle:le})})]})]})]})}function Kt(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function $d(e){return `${parseFloat((e*100).toFixed(2))}%`}function ks(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function br(e){return e.outcomes?.[0]?.label??e.question}function Wd(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function Ut(e){if(!e)return "\u2014";let t=new Date(e);if(isNaN(t.getTime()))return "\u2014";let r=t.toLocaleString("default",{month:"short"}),o=t.getDate(),n=t.getFullYear(),i=t.getHours().toString().padStart(2,"0"),l=t.getMinutes().toString().padStart(2,"0");return `${r} ${o}, ${n} ${i}:${l}`}function Ss(e){let[t,r]=react.useState(0);if(react.useEffect(()=>{if(!e)return;r(Date.now());let u=setInterval(()=>r(Date.now()),1e3);return ()=>clearInterval(u)},[e]),!e||t===0)return null;let o=new Date(e).getTime();if(isNaN(o))return null;let n=o-t;if(n<=0)return null;let i=Math.floor(n/864e5),l=Math.floor(n%864e5/36e5),s=Math.floor(n%36e5/6e4),a=Math.floor(n%6e4/1e3),c=[];return i>0&&c.push(`${i}d`),c.push(`${String(l).padStart(2,"0")}h`),c.push(`${String(s).padStart(2,"0")}m`),c.push(`${String(a).padStart(2,"0")}s`),c.join(" ")}function Ns(e){if(!e)return null;let t=new Date(e);if(isNaN(t.getTime()))return null;let r=t.getHours().toString().padStart(2,"0"),o=t.getMinutes().toString().padStart(2,"0"),n=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0"),l=t.getFullYear(),s=-t.getTimezoneOffset(),a=s>=0?"+":"-",c=String(Math.abs(Math.floor(s/60))).padStart(2,"0");return `${r}:${o} ${n}/${i}/${l} (${a}${c})`}function Ms({event:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{ref:o,isCollapsed:n}=hooks.useScrollCollapse(),i=react.useMemo(()=>{let d=[...e.markets||[]],p=d.filter(f=>f.status==="open").sort((f,g)=>Kt(g)-Kt(f)),m=d.filter(f=>f.status!=="open").sort((f,g)=>Kt(g)-Kt(f));return [...p,...m]},[e.markets]),l=e.status==="closed"||e.status==="voided",s=Ss(l?void 0:e.start_at),a=Ss(l?void 0:e.end_at),c=Ns(e.start_at),u=Ns(e.end_at);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col gap-y-4 lg:gap-y-6",children:[jsxRuntime.jsxs("div",{ref:o,className:`sticky top-0 z-30 flex items-center backdrop-blur-md transition-all duration-300 ${n?"h-14 lg:h-16 gap-x-2 py-2 px-1 lg:px-4 -mx-1 lg:-mx-4 shadow-sm":"h-16 lg:h-20 gap-x-2 lg:gap-x-4"}`,children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"lg",classNames:{base:"bg-transparent"},className:`flex-shrink-0 transition-all duration-300 ${n?"!h-10 !w-10 lg:!h-12 lg:!w-12":"!h-16 !w-16 lg:!h-20 lg:!w-20"}`}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0 flex-1",children:[!n&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e.tags?.slice(0,3).map((d,p)=>jsxRuntime.jsxs(react.Fragment,{children:[p>0&&jsxRuntime.jsx("span",{className:"text-sm text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral truncate",children:d.label})]},d.slug)),jsxRuntime.jsx(Vd,{source:e.source})]}),jsxRuntime.jsx("span",{className:`font-semibold truncate transition-all duration-300 ${n?"text-sm lg:text-base":"text-lg lg:text-xl"}`,children:e.title})]})]}),(s||a||l)&&jsxRuntime.jsx("div",{className:"flex items-center gap-x-2 text-xs lg:text-sm font-mono",children:l?u&&jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.event.endedAt",{time:u})}):s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.beginsIn",{time:s})}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:c})]})]}):a?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.endsIn",{time:a})}),u&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:u})]})]}):null}),jsxRuntime.jsx(ys,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx(zd,{markets:i,onTradeAction:t}),jsxRuntime.jsx(Kd,{markets:i,event:e})]})}var Ps=5;function zd({markets:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{isMobile:o}=ui.useScreen(),[n,i]=react.useState(false),[l,s]=react.useState(null),a=react.useMemo(()=>{let h=new Set;return e.filter(x=>h.has(x.slug)?false:(h.add(x.slug),true))},[e]),c=a.find(h=>h.status==="open")?.slug,[u,d]=react.useState(c?`${c}:yes`:null);if(a.length===0)return null;let p=a.length>Ps,m=n?a:a.slice(0,Ps),f=h=>{s(x=>x===h?null:h);},g=(h,x,P)=>{d(`${h.slug}:${x}`),o||s(h.slug),t?.(h,x,P);};return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("table",{className:"w-full border-collapse",children:[jsxRuntime.jsx("thead",{children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{}),jsxRuntime.jsx("th",{className:"py-2 text-left text-xs text-neutral font-normal lg:text-center lg:text-sm",children:r("predict.market.table.chance")}),jsxRuntime.jsx("th",{})]})}),jsxRuntime.jsx("tbody",{children:m.map((h,x)=>{let P=Kt(h),y=h.outcomes[1]?.best_ask??h.outcomes[1]?.price,N=l===h.slug;return jsxRuntime.jsx(Ud,{market:h,yesPrice:P,noPrice:y??void 0,activeYes:u===`${h.slug}:yes`,activeNo:u===`${h.slug}:no`,isExpanded:N,onToggleExpand:()=>f(h.slug),onTradeAction:g},h.id??`${x}-${h.slug}`)})})]}),p&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>i(h=>!h),className:"flex w-full items-center justify-start gap-x-2 py-2 pl-1 text-xs text-neutral lg:pl-2 lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r(n?"predict.event.rules.collapse":"predict.event.moreMarketsLabel")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-4 w-4 transition-transform",n&&"rotate-180")})]})]})}function Ud({market:e,yesPrice:t,noPrice:r,activeYes:o,activeNo:n,isExpanded:i,onToggleExpand:l,onTradeAction:s}){let{t:a}=i18n.useTranslation(),c=e.status==="open",u=e.volume?`$${Math.round(e.volume).toLocaleString("en-US")} vol`:void 0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("tr",{className:"cursor-pointer border-b border-border text-xs hover:bg-content2 lg:text-base",onClick:l,role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),l());},children:[jsxRuntime.jsx("td",{className:"py-2 pl-1 lg:pl-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1 lg:gap-x-2",children:[e.image_url&&jsxRuntime.jsx(ui.Avatar,{src:e.image_url,name:br(e)?.[0]||"?",radius:"lg",className:"size-5 shrink-0 lg:size-8",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate max-w-[200px] lg:max-w-[300px]",children:br(e)}),u&&jsxRuntime.jsx("span",{className:"text-[8px] text-neutral lg:text-xxs",children:u})]})]})}),jsxRuntime.jsx("td",{className:"py-2 text-left text-foreground lg:text-center",children:$d(t)}),jsxRuntime.jsx("td",{className:"py-2 pr-1 lg:pr-2",children:c?jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",className:ui.cn("flex min-w-16 items-center justify-center whitespace-nowrap rounded-lg p-2 lg:min-w-24 cursor-pointer hover:opacity-80 transition-all",o?"bg-primary text-primary-foreground":"bg-primary/10 text-primary"),onClick:d=>{d.stopPropagation(),s?.(e,"yes","buy");},children:a("predict.market.action.yes",{price:ks(t)})}),jsxRuntime.jsx("button",{type:"button",className:ui.cn("flex min-w-16 items-center justify-center whitespace-nowrap rounded-lg p-2 lg:min-w-24 cursor-pointer hover:opacity-80 transition-all",n?"bg-secondary text-secondary-foreground":"bg-secondary/10 text-secondary"),onClick:d=>{d.stopPropagation(),s?.(e,"no","buy");},children:r!=null?a("predict.market.action.no",{price:ks(r)}):a("predict.market.no")})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-end",children:jsxRuntime.jsx("span",{className:ui.cn("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",e.status==="closed"?"bg-neutral/10 text-neutral":e.status==="voided"?"bg-warning/10 text-warning":"bg-primary/10 text-primary"),children:e.status==="closed"?a("predict.event.status.closed"):e.status==="voided"?a("predict.event.status.voided"):a("predict.event.status.pending")})})})]}),i&&jsxRuntime.jsx("tr",{children:jsxRuntime.jsx("td",{colSpan:3,className:"pb-3",children:jsxRuntime.jsx("div",{className:"max-h-100 overflow-y-auto",children:jsxRuntime.jsx(xs,{market:e,outcome:n?"no":"yes",onTradeAction:s})})})})]})}function Kd({markets:e,event:t}){let{t:r}=i18n.useTranslation(),[o,n]=react.useState(false),[i,l]=react.useState(false),[s,a]=react.useState(0),c=e.filter(m=>m.rules&&m.rules.length>0||m.description);if(c.length===0)return null;let u=c[s]??c[0],d=u.rules&&u.rules.length>0?u.rules.join(`
|
|
19
|
+
`;function Go({event:e,href:t,LinkComponent:r,onSelect:o,onSelectOutcome:n,onHover:i}){let[l,a]=react.useState(null),s=e.markets??[],d=react.useMemo(()=>s.length>2?[...s].sort((N,v)=>(v.outcomes?.[0]?.price??0)-(N.outcomes?.[0]?.price??0)):s,[s]).filter(N=>N.status==="open"),p=d.length===1,u=d.slice(0,Bo),m=d.length-Bo,f=react.useMemo(()=>`$${Math.round(e.volume??0).toLocaleString("en-US")}`,[e.volume]),g=l?d.find(N=>N.slug===l)??null:null,h=!!g||p,x=()=>{h||o?.(e);},C=N=>{N.stopPropagation(),g&&(N.preventDefault(),a(null));},b=N=>{N.stopPropagation(),t||(N.preventDefault(),o?.(e));};return jsxRuntime.jsxs("div",{className:ui.cn("group flex h-full w-full flex-col rounded-xl","min-h-52 border border-border/90 bg-background p-3","lg:min-h-72 lg:max-w-md lg:p-4","gap-y-1.5 lg:gap-y-4","transition duration-300","hover:border-primary/40 hover:shadow-card-glow","focus-within:border-primary/40 focus-within:shadow-card-glow",!h&&"cursor-pointer"),onMouseEnter:()=>i?.(e),onClick:x,children:[jsxRuntime.jsx("style",{children:tc}),jsxRuntime.jsx(rc,{event:e,href:t,LinkComponent:r,onClick:C,isExpanded:h}),jsxRuntime.jsx("div",{className:"flex flex-1 flex-col",children:p?jsxRuntime.jsx(dc,{market:d[0],event:e,formattedVolume:f,href:t,LinkComponent:r,onSelect:o,onSelectOutcome:n}):g?jsxRuntime.jsx(uc,{market:g,event:e,onCollapse:()=>a(null),onSelectOutcome:n}):jsxRuntime.jsx(lc,{displayedMarkets:u,moreCount:m,formattedVolume:f,source:e.source,href:t,LinkComponent:r,onMarketClick:N=>a(N.slug),onShowMore:b})})]})}function rc({event:e,href:t,LinkComponent:r,onClick:o,isExpanded:n}){let i=e.start_at?ec(e.start_at):null;return jsxRuntime.jsxs(ui.Linkable,{href:t,LinkComponent:r,as:"button",className:"group/header flex items-center gap-x-2 lg:gap-x-4 w-full text-left cursor-pointer",onClick:o,children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"lg",className:"h-8 w-8 flex-shrink-0 transition-transform duration-300 group-hover/header:scale-110 lg:h-12 lg:w-12",classNames:{base:"bg-transparent"}}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("p",{className:ui.cn("min-w-0 text-sm font-semibold leading-snug text-slate-200 line-clamp-2 lg:text-base",n&&"group-hover/header:text-neutral-400"),children:e.title}),i&&jsxRuntime.jsxs("span",{className:"text-[10px] leading-4 text-neutral-500",children:["Live in ",i]})]}),jsxRuntime.jsx(oc,{event:e})]})}function nc(e){let t=[];if(e.status==="closed")return t.push({kind:"closed"}),t.slice(0,2);let r=e.tags?.some(n=>n.label?.toLowerCase()==="crypto"),o=e.tags?.some(n=>n.label?.toLowerCase()==="live");if(r&&e.end_at){let n=new Date(e.end_at).getTime()-Date.now(),i=300*1e3,l=900*1e3;if(n>0&&n<=l){let a=n<=i?"#ef4444":"#f59e0b";t.push({kind:"crypto-short",label:n<=i?"5m":"15m",color:a});}}return o&&t.push({kind:"live"}),t.slice(0,2)}function oc({event:e}){let t=react.useMemo(()=>nc(e),[e]);return t.length===0?null:jsxRuntime.jsx("div",{className:"flex flex-shrink-0 flex-col items-end gap-1",children:t.map((r,o)=>{switch(r.kind){case "live":return jsxRuntime.jsx(sc,{},o);case "crypto-short":return jsxRuntime.jsx(ac,{label:r.label,color:r.color},o);case "closed":return jsxRuntime.jsx(ic,{},o)}})})}function sc(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("span",{className:"badge-shine relative inline-flex items-center gap-1 overflow-hidden rounded-md bg-[rgb(240,68,56)]/10 px-1.5 py-0.5 text-xs font-semibold text-[rgb(240,68,56)]",children:[jsxRuntime.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-current"}),e("predict.event.status.live")]})}function ac({label:e,color:t}){return jsxRuntime.jsxs("span",{className:"badge-shine relative inline-flex items-center gap-1 overflow-hidden rounded-md px-1.5 py-0.5 text-xs font-semibold",style:{backgroundColor:`${t}26`,color:t},children:[jsxRuntime.jsx(ui.TimerIcon,{className:"size-3 shrink-0"}),e]})}function ic(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsx("span",{className:"inline-flex items-center rounded-md bg-neutral-800/80 px-1.5 py-0.5 text-xs font-semibold text-neutral-400",children:e("predict.event.status.closed")})}function lc({displayedMarkets:e,moreCount:t,formattedVolume:r,source:o,href:n,LinkComponent:i,onMarketClick:l,onShowMore:a}){let{t:s}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e.length>0&&jsxRuntime.jsx("div",{className:"flex w-full flex-1 flex-col gap-y-0.5 lg:gap-y-2",children:e.map(c=>{let d=Vo(c);return jsxRuntime.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between gap-x-2 transition-opacity hover:cursor-pointer hover:opacity-80",onClick:p=>{p.stopPropagation(),l(c);},children:[jsxRuntime.jsx("span",{className:"min-w-0 flex-1 text-left text-xs text-slate-200 line-clamp-1 lg:text-sm",children:c.outcomes?.[0]?.label??c.question}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-slate-200 lg:text-lg",children:jo(d)}),jsxRuntime.jsx(cc,{})]})]},c.id??`${c.source}-${c.slug}`)})}),jsxRuntime.jsxs("div",{className:"mt-auto flex items-center justify-between pt-3",children:[t>0?jsxRuntime.jsxs(ui.Linkable,{href:n,LinkComponent:i,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-neutral-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:a,children:[s("predict.event.showMore"),jsxRuntime.jsx(qo,{className:"h-3 w-3"})]}):jsxRuntime.jsx("div",{}),jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1.5 text-[10px] font-normal text-neutral-500 lg:text-xs",children:[r," ",s("predict.event.volume"),jsxRuntime.jsx(Qo,{source:o})]})]})]})}function zo({bgColor:e,textColor:t,shadowColor:r,onClick:o,children:n}){return jsxRuntime.jsx("button",{type:"button",className:"flex h-12 flex-1 w-full items-center justify-center gap-x-1 overflow-hidden rounded-lg p-3 text-base font-normal hover:cursor-pointer will-change-transform [-webkit-tap-highlight-color:transparent]",style:{backgroundColor:e,color:t,"--shadow-color":r,"--shadow-offset":"4px",boxShadow:"inset 0 -1px 0 rgba(255,255,255,0.08), 0 var(--shadow-offset, 4px) 0 var(--shadow-color, rgba(0,0,0,0.22))",transition:"transform .12s, box-shadow .12s, opacity .14s"},onMouseEnter:a=>{let s=a.currentTarget;s.style.setProperty("--shadow-offset","2px"),s.style.transform="translateY(2px)";},onMouseLeave:a=>{let s=a.currentTarget;s.style.setProperty("--shadow-offset","4px"),s.style.transform="translateY(0px)";},onClick:o,children:n})}function Yo({market:e,event:t,onSelectOutcome:r,dynamicColors:o=false,labelFormat:n="action"}){let{t:i}=i18n.useTranslation(),[l,a]=o?Zl(e):[tn,Ko],s=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",c=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",d=n==="label"&&s===c?"action":n,p=d==="label"?`${e.outcomes?.[0]?.label??"Yes"} ${$o(e)}\xA2`:i("predict.market.action.yes",{price:$o(e)}),u=d==="label"?`${e.outcomes?.[1]?.label??"No"} ${Wo(e)}\xA2`:i("predict.market.action.no",{price:Wo(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(zo,{bgColor:l.bg,textColor:l.text,shadowColor:l.shadow,onClick:m=>{m.stopPropagation(),r?.(t,e,"yes");},children:p}),jsxRuntime.jsx(zo,{bgColor:a.bg,textColor:a.text,shadowColor:a.shadow,onClick:m=>{m.stopPropagation(),r?.(t,e,"no");},children:u})]})}function cc(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("span",{className:"inline-flex h-7 w-[85px] items-center justify-center gap-x-3 rounded-lg p-1.5 text-xs font-semibold flex-shrink-0 bg-gradient-to-r from-primary/15 to-secondary/15 lg:h-9 lg:w-24 lg:gap-x-4 lg:p-2 lg:text-sm",children:[jsxRuntime.jsx("span",{className:"text-primary",children:e("predict.market.yes")}),jsxRuntime.jsx("span",{className:"text-neutral-400",children:"/"}),jsxRuntime.jsx("span",{className:"text-secondary",children:e("predict.market.no")})]})}function dc({market:e,event:t,formattedVolume:r,href:o,LinkComponent:n,onSelect:i,onSelectOutcome:l}){let{t:a}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex-1",children:jsxRuntime.jsx(Yo,{market:e,event:t,onSelectOutcome:l,dynamicColors:true,labelFormat:"label"})}),jsxRuntime.jsxs("div",{className:"mt-auto flex items-center justify-between pt-3",children:[jsxRuntime.jsxs(ui.Linkable,{href:o,LinkComponent:n,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-neutral-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:c=>{c.stopPropagation(),o||(c.preventDefault(),i?.(t));},children:[a("predict.event.viewEvent"),jsxRuntime.jsx(qo,{className:"h-3 w-3"})]}),jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1.5 text-[10px] font-normal text-neutral-500 lg:text-xs",children:[r," ",a("predict.event.volume"),jsxRuntime.jsx(Qo,{source:t.source})]})]})]})}function uc({market:e,event:t,onCollapse:r,onSelectOutcome:o}){let{t:n}=i18n.useTranslation(),i=Vo(e);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsxs("button",{type:"button",className:"flex h-9 w-full items-center justify-between cursor-pointer",onClick:l=>{l.stopPropagation(),r();},children:[jsxRuntime.jsx("span",{className:"min-w-0 flex-1 text-left text-xs text-slate-200 lg:text-sm",children:e.outcomes?.[0]?.label??e.question}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1 flex-shrink-0",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-slate-200 lg:text-lg",children:jo(i)}),jsxRuntime.jsx(ui.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{className:"mt-3",children:jsxRuntime.jsx(Yo,{market:e,event:t,onSelectOutcome:o,labelFormat:"action"})})]}),jsxRuntime.jsxs("button",{type:"button",className:"mt-auto flex items-center gap-x-1 pt-4 text-[10px] font-normal text-neutral-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:l=>{l.stopPropagation(),r();},children:[jsxRuntime.jsx(pc,{className:"h-3 w-3"}),n("predict.event.back")]})]})}function qo({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:jsxRuntime.jsx("path",{d:"M4.5 2.5L8 6l-3.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function pc({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,children:jsxRuntime.jsx("path",{d:"M7.5 2.5L4 6l3.5 3.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function Qo({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}var vc=768,Zo=1024,bc=1280,yc=8,kc=224,Sc=304,Nc=114;function Pc(e){return e>=bc?4:e>=Zo?3:e>=vc?2:1}function wc(e){return e>=Zo?Sc:kc}function Jo({events:e,hasMore:t=false,onFetchMore:r,onSelect:o,onSelectOutcome:n,getEventHref:i,LinkComponent:l,onHover:a}){let s=react.useRef(null),c=react.useRef(null),{width:d=0,height:p=0}=hooks.useResizeObserver({ref:s}),u=Pc(d),m=wc(d),f=Math.ceil(e.length/u)||0,g=!t&&e.length>0,h=f+(t?1:0)+(g?1:0),x=react.useCallback(v=>v<f,[f]),C=react.useCallback(async()=>{r?.();},[r]),b=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:x,loadMoreRows:C,rowCount:h,threshold:3}),N=react.useCallback(()=>{c.current?.scrollToRow({index:0,behavior:"smooth"});},[]);return jsxRuntime.jsx("div",{ref:s,className:"@container w-full h-full",children:p>0&&jsxRuntime.jsx(reactWindow.List,{listRef:c,className:"no-scrollbar",style:{height:p},onRowsRendered:b,rowComponent:Cc,rowCount:h,rowHeight:v=>g&&v===h-1?Nc:(m),rowProps:{events:e,columnCount:u,dataRowCount:f,showEndOfList:g,totalRowCount:h,onSelect:o,onSelectOutcome:n,getEventHref:i,LinkComponent:l,onHover:a,onScrollToTop:N}})})}function Cc({index:e,style:t,events:r,columnCount:o,dataRowCount:n,showEndOfList:i,totalRowCount:l,onSelect:a,onSelectOutcome:s,getEventHref:c,LinkComponent:d,onHover:p,onScrollToTop:u}){if(i&&e===l-1)return jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(Mc,{onScrollToTop:u})});if(e>=n)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-start pt-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})});let m=e*o,f=r.slice(m,m+o),g=o-f.length;return jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsxs("div",{className:"flex w-full h-full",children:[f.map((h,x)=>h==null?null:jsxRuntime.jsx("div",{className:"flex-1 min-w-0 flex",style:{padding:yc},children:jsxRuntime.jsx(Go,{event:h,href:c?.(h),LinkComponent:d,onSelect:a,onSelectOutcome:s,onHover:p})},`${m+x}-${h.source}-${h.slug}`)),g>0&&Array.from({length:g}).map((h,x)=>jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}},`spacer-${x}`))]})})}function Mc({onScrollToTop:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:"flex w-full flex-col items-center justify-center gap-y-4 py-6",children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center justify-center gap-x-4",children:[jsxRuntime.jsx("div",{className:"h-px w-16 bg-neutral-700"}),jsxRuntime.jsx("span",{className:"text-xs font-medium text-neutral-500",children:t("predict.event.endOfList")}),jsxRuntime.jsx("div",{className:"h-px w-16 bg-neutral-700"})]}),jsxRuntime.jsxs("button",{type:"button",className:"flex cursor-pointer items-center gap-x-1 text-xs font-medium text-neutral-400",onClick:e,children:[jsxRuntime.jsx("span",{className:"iconify size-4 ph--arrow-up-bold"}),jsxRuntime.jsx("span",{children:t("predict.event.backToTop")})]})]})}function ts({tagSlugSelection:e,limit:t=48,status:r,sort_by:o,sort_asc:n,source:i,with_markets:l,timeRemaining:a,minVolume:s,minLiquidity:c,onSelect:d,onSelectOutcome:p,getEventHref:u,LinkComponent:m,onHover:f}){let{data:g,hasMore:h,fetchMore:x,isFetching:C}=Fo({tagSlugSelection:e,limit:t,status:r,sort_by:o,sort_asc:n,source:i,with_markets:l,timeRemaining:a,minVolume:s,minLiquidity:c});return C?jsxRuntime.jsx(Jr,{count:48}):jsxRuntime.jsx(Jo,{events:g,hasMore:h,onFetchMore:x,onSelect:d,onSelectOutcome:p,getEventHref:u,LinkComponent:m,onHover:f})}function o0({onSelect:e,onSelectOutcome:t,getEventHref:r,LinkComponent:o,onHover:n}){let[i,l]=react.useState({categorySlug:null,tagSlug:null}),[a,s]=react.useState(Xr),{isOpen:c,onOpen:d,onClose:p}=ui.useDisclosure(),{onOpen:u}=uiScaffold.useAsyncModal(It),m=react.useCallback((v,H,y)=>{t?.(v,H,y),u({params:{event:v,market:H,initialOutcome:y}});},[t,u]),f=react.useCallback(v=>{l(v);},[]),g=react.useCallback(v=>{s(H=>({...H,sortPreset:v}));},[]),h=react.useCallback(v=>{s(H=>({...H,sortAsc:v}));},[]),x=react.useCallback(v=>{s(v);},[]),C=react.useMemo(()=>Io[a.sortPreset].sort_by,[a.sortPreset]),b=react.useMemo(()=>Zr(a),[a]),N=react.useMemo(()=>jsxRuntime.jsx(Oo,{sortPreset:a.sortPreset,onSortChange:g,sortAsc:a.sortAsc,onSortAscChange:h,onFilterPress:d,filterCount:b}),[a.sortPreset,a.sortAsc,b,g,h,d]);return jsxRuntime.jsxs("div",{className:"flex h-full w-full max-w-[1680px] mx-auto flex-col gap-y-3",children:[jsxRuntime.jsx(io,{onSelect:f,trailing:N}),jsxRuntime.jsx(To,{isOpen:c,onClose:p,value:a,onChange:x}),jsxRuntime.jsx("div",{className:"min-h-0 flex-1",children:jsxRuntime.jsx(ts,{tagSlugSelection:i,sort_by:C,sort_asc:a.sortAsc,source:a.source,timeRemaining:a.timeRemaining,minVolume:a.minVolume,minLiquidity:a.minLiquidity,onSelect:e,onSelectOutcome:m,getEventHref:r,LinkComponent:o,onHover:n})}),jsxRuntime.jsx(lr,{})]})}var cn=40,gr=36,$t=480,dn=$t-gr;function ss({event:e,walletAddress:t,onCancelOrder:r}){let{t:o}=i18n.useTranslation(),[n,i]=react.useState("positions"),l=react.useMemo(()=>e.markets?.map(p=>p.slug)??[],[e.markets]),{data:a}=reactPredict.usePositions({source:e.source,user:t??""}),s=react.useMemo(()=>!a?.positions||!t?0:l.length===0?a.positions.length:a.positions.filter(p=>p.market&&l.includes(p.market.slug)).length,[a?.positions,l,t]),d=[{key:"positions",label:s>0?`${o("predict.positions.title")} (${s})`:o("predict.positions.title")},{key:"orders",label:o("predict.openOrders.title")},{key:"trades",label:o("predict.tradeHistory.title")}];return jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2 mt-6 px-1 lg:px-4",children:[jsxRuntime.jsx("div",{className:"flex items-center gap-x-1 border-b border-border",children:d.map(p=>jsxRuntime.jsx("button",{type:"button",onClick:()=>i(p.key),className:ui.cn("px-3 py-2 text-sm font-medium transition-colors cursor-pointer",n===p.key?"text-foreground border-b-2 border-primary":"text-neutral hover:text-foreground"),children:p.label},p.key))}),t?jsxRuntime.jsxs("div",{style:{height:$t},children:[n==="positions"&&jsxRuntime.jsx(Dc,{source:e.source,walletAddress:t,marketSlugs:l}),n==="orders"&&jsxRuntime.jsx(Bc,{source:e.source,walletAddress:t,marketSlugs:l,onCancelOrder:r}),n==="trades"&&jsxRuntime.jsx(Wc,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:$t},children:o("predict.trade.connectWallet")})]})}function Dc({source:e,walletAddress:t,marketSlugs:r}){let{t:o}=i18n.useTranslation(),{data:n,isLoading:i}=reactPredict.usePositions({source:e,user:t}),l=react.useMemo(()=>n?.positions?r.length===0?n.positions:n.positions.filter(a=>a.market&&r.includes(a.market.slug)):[],[n?.positions,r]);return i?jsxRuntime.jsx(pn,{}):l.length===0?jsxRuntime.jsx(un,{message:o("predict.positions.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:gr},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2 whitespace-nowrap",children:o("predict.positions.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.markPrice")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:o("predict.positions.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:o("predict.positions.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:o("predict.positions.estSettlement")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:dn},rowComponent:Fc,rowCount:l.length,rowHeight:cn,rowProps:{positions:l,closeLabel:o("predict.positions.close")}})]})}function Fc({index:e,style:t,positions:r,closeLabel:o}){let n=r[e];if(!n)return null;let i=n.pnl??0,l=n.pnl_percent??0,a=n.avg_price??0,s=n.current_price??0,c=i>0?"text-success":i<0?"text-danger":"text-foreground",d=i>0?"+":"",p=n.market?.outcomes?.[0]?.label??n.market?.question??"\u2014",u=n.side,m=n.size,f=n.size*s,g=n.market?.end_at?Kc(n.market.end_at):"\u2014";return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium",children:p}),jsxRuntime.jsx("span",{className:ui.cn("text-[10px] font-medium",u.toLowerCase()==="yes"?"text-primary":"text-secondary"),children:u})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:n.size}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",f.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:mr(a)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:mr(s)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",c),children:[d,"$",Math.abs(i).toFixed(2),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",d,l.toFixed(1),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",m.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:g}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors rounded px-2 py-0.5 border border-border hover:border-foreground/40",children:o})})]})}function Bc({source:e,walletAddress:t,marketSlugs:r,onCancelOrder:o}){let{t:n}=i18n.useTranslation(),{data:i,isLoading:l,fetchNextPage:a,hasNextPage:s}=reactPredict.useInfiniteOrders({source:e,wallet_address:t}),c=reactPredict.useCancelOrder(),d=react.useMemo(()=>{let x=i?.pages?.flatMap(N=>N.items)??[],C=new Set(["live","open","submitted","pending"]),b=x.filter(N=>C.has(N.status));return r.length>0&&(b=b.filter(N=>N.market_id&&r.includes(N.market_id))),b},[i?.pages,r]),p=react.useCallback(x=>{o?o(x.id):c.mutate({source:x.source,id:x.id});},[o,c]),u=d.length,m=u+(s?1:0),f=react.useCallback(x=>x<u,[u]),g=react.useCallback(async()=>{await a();},[a]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:f,loadMoreRows:g,rowCount:m,threshold:5});return l?jsxRuntime.jsx(pn,{}):d.length===0&&!s?jsxRuntime.jsx(un,{message:n("predict.openOrders.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:gr},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:n("predict.openOrders.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.openOrders.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.openOrders.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.openOrders.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.openOrders.filled")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:n("predict.openOrders.status")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:dn},onRowsRendered:h,rowComponent:Hc,rowCount:m,rowHeight:cn,rowProps:{orders:d,itemCount:u,onCancel:p,isCancelling:c.isPending,cancelLabel:n("predict.openOrders.cancel")}})]})}function Hc({index:e,style:t,orders:r,itemCount:o,onCancel:n,isCancelling:i,cancelLabel:l}){if(e>=o)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})});let a=r[e];if(!a)return null;let s=a.side==="BUY";return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",s?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children:a.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:a.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize",children:a.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:a.price?mr(parseFloat(a.price)):"\u2014"}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:[a.size_matched??"0","/",a.original_size??"\u2014"]}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:jsxRuntime.jsx($c,{status:a.status})}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>n(a),disabled:i,className:"text-[10px] text-danger hover:text-danger/80 cursor-pointer disabled:opacity-50 transition-colors",children:i?jsxRuntime.jsx(ui.Spinner,{size:"sm"}):l})})]})}function $c({status:e}){return jsxRuntime.jsx("span",{className:ui.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium capitalize",{live:"bg-success/10 text-success",open:"bg-success/10 text-success",submitted:"bg-warning/10 text-warning",pending:"bg-warning/10 text-warning",matched:"bg-primary/10 text-primary",cancelled:"bg-neutral/10 text-neutral",failed:"bg-danger/10 text-danger",expired:"bg-neutral/10 text-neutral"}[e]??"bg-neutral/10 text-neutral"),children:e})}function Wc({source:e,walletAddress:t}){let{t:r}=i18n.useTranslation(),{data:o,isLoading:n,fetchNextPage:i,hasNextPage:l}=reactPredict.useInfiniteTrades({source:e,wallet:t,limit:50}),a=react.useMemo(()=>o?.pages?.flatMap(m=>m.items)??[],[o?.pages]),s=a.length,c=s+(l?1:0),d=react.useCallback(m=>m<s,[s]),p=react.useCallback(async()=>{await i();},[i]),u=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:d,loadMoreRows:p,rowCount:c,threshold:5});return n?jsxRuntime.jsx(pn,{}):a.length===0&&!l?jsxRuntime.jsx(un,{message:r("predict.tradeHistory.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full",children:[jsxRuntime.jsxs("div",{className:"flex items-center text-neutral text-xs lg:text-sm font-normal shrink-0",style:{height:gr},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:r("predict.tradeHistory.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:r("predict.tradeHistory.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.qty")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.tradeHistory.total")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:r("predict.tradeHistory.time")})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:dn},onRowsRendered:u,rowComponent:zc,rowCount:c,rowHeight:cn,rowProps:{trades:a,itemCount:s}})]})}function zc({index:e,style:t,trades:r,itemCount:o}){if(e>=o)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})});let n=r[e];if(!n)return null;let i=n.side?.toUpperCase()==="BUY",l=Uc(n.timestamp),a=n.price??0,s=n.usd_size??0;return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",i?"bg-primary/10 text-primary":"bg-danger/10 text-danger"),children:n.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:n.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:mr(a)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:n.size}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",s.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:l})]})}function un({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:$t},children:e})}function pn(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:$t},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function mr(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function Uc(e){let t=new Date(e*1e3),r=(t.getMonth()+1).toString().padStart(2,"0"),o=t.getDate().toString().padStart(2,"0"),n=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0");return `${r}/${o} ${n}:${i}`}function Kc(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}function Wt({marketCount:e=4,showBack:t}){return jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-4 animate-pulse lg:gap-6",children:[t&&jsxRuntime.jsx("div",{className:"h-5"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2 h-16 lg:h-20 lg:gap-x-4",children:[jsxRuntime.jsx(ui.Skeleton,{className:"size-16 shrink-0 rounded-lg lg:size-20"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-12 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-10 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-10 rounded"})]}),jsxRuntime.jsx(ui.Skeleton,{className:"h-5 w-full max-w-sm rounded lg:h-6"})]})]}),jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-48 rounded"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-4",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-24 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-20 rounded"})]}),jsxRuntime.jsx(ui.Skeleton,{className:"h-[300px] w-full rounded-xl"}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-20 rounded"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-[200px] rounded-lg"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-7 w-28 rounded-lg"})]})]})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("div",{className:"flex items-center py-2",children:[jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-14 rounded"}),jsxRuntime.jsx("div",{className:"flex-1"})]}),Array.from({length:e}).map((r,o)=>jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2 border-b border-border py-2.5 lg:gap-x-3",children:[jsxRuntime.jsx(ui.Skeleton,{className:"size-5 shrink-0 rounded-lg lg:size-8"}),jsxRuntime.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-32 rounded lg:h-4 lg:w-48"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-2.5 w-16 rounded"})]}),jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-10 rounded"}),jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-16 rounded-lg lg:w-24"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-16 rounded-lg lg:w-24"})]})]},o))]}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-4 w-16 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-full rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-4/5 rounded"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-3.5 w-3/5 rounded"})]})]})}function as(){return jsxRuntime.jsxs("div",{className:"flex flex-col gap-3 rounded-xl border border-border p-4 animate-pulse",children:[jsxRuntime.jsx(ui.Skeleton,{className:"h-10 w-full rounded-lg"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-24 w-full rounded-lg"}),jsxRuntime.jsx(ui.Skeleton,{className:"h-10 w-full rounded-lg"})]})}var ds="var(--color-bullish)",us="var(--color-bearish)";function zt(e){let t=Math.abs(e);return t>=1e9?`${parseFloat((e/1e9).toFixed(2))}B`:t>=1e6?`${parseFloat((e/1e6).toFixed(2))}M`:t>=1e3?`${parseFloat((e/1e3).toFixed(2))}K`:e.toLocaleString()}function Gc(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function Yc(e,t){let r=new Float64Array(101),o=new Float64Array(101);for(let m of e){let f=Math.round(m.price*100);f>=0&&f<=100&&(r[f]+=m.quantity);}for(let m of t){let f=Math.round(m.price*100);f>=0&&f<=100&&(o[f]+=m.quantity);}let n=0,i=0,l=new Float64Array(101),a=new Float64Array(101);for(let m=100;m>=0;m--)n+=r[m],i+=r[m]*m/100,l[m]=n,a[m]=i;let s=0,c=0,d=new Float64Array(101),p=new Float64Array(101);for(let m=0;m<=100;m++)s+=o[m],c+=o[m]*m/100,d[m]=s,p[m]=c;let u=Math.max(l[0]??0,d[100]??0);return Array.from({length:101},(m,f)=>{let g=l[f]>0,h=d[f]>0,x=l[f]||d[f],C=r[f]>0||o[f]>0;return {priceCents:f,displayHeight:Gc(x,u),opacity:x>0?C?1:.5:0,isBid:g,isAsk:h,bidCumTotal:l[f],askCumTotal:d[f],bidCumCost:a[f],askCumCost:p[f]}})}function qc({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?ds:us,o=e.leftPct>65?void 0:`${e.leftPct}%`,n=e.leftPct>65?`${100-e.leftPct}%`:void 0;return jsxRuntime.jsxs("div",{style:{position:"absolute",top:8,left:o,right:n,zIndex:10,background:"rgba(17,24,39,0.95)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:8,padding:"8px 12px",fontSize:12,color:"#f9fafb",minWidth:140,pointerEvents:"none"},children:[jsxRuntime.jsx("div",{style:{marginBottom:4,fontWeight:600},children:t("predict.orderBook.depthToPrice",{price:e.priceCents})}),jsxRuntime.jsx("div",{style:{color:r},children:t("predict.orderBook.depthContracts",{amount:zt(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",zt(Math.round(e.cumCost))]})]})}var Qc=react.memo(function({slot:t,onEnter:r,onLeave:o}){let n=react.useRef(null),i=t.isBid||t.isAsk,l=t.isBid?ds:t.isAsk?us:void 0;return jsxRuntime.jsx("div",{style:{position:"absolute",left:`${t.priceCents}%`,width:"1%",height:"100%",boxSizing:"border-box",borderRight:t.priceCents<100?"1px solid transparent":"none",cursor:i?"crosshair":"default"},onMouseEnter:()=>r(t,n.current),onMouseLeave:o,children:i&&jsxRuntime.jsx("div",{ref:n,style:{position:"absolute",bottom:0,left:0,width:"100%",height:`${t.displayHeight*100}%`,backgroundColor:l,opacity:t.opacity}})})}),Xc=[0,10,20,30,40,50,60,70,80,90,100];function Zc(){return jsxRuntime.jsx("div",{className:"relative flex h-6 items-center border-b border-t border-border px-1",style:{background:"rgba(0,0,0,0.15)"},children:Xc.map(e=>jsxRuntime.jsx("span",{className:"absolute text-neutral font-normal",style:{fontSize:10,left:`${e}%`,transform:e===0?"translateX(0px)":e===100?"translateX(-100%)":"translateX(-50%)"},children:e},e))})}function ps({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),o=react.useMemo(()=>Yc(e,t),[e,t]),n=react.useMemo(()=>{let p=e.length>0?Math.max(...e.map(m=>m.price)):0,u=t.length>0?Math.min(...t.map(m=>m.price)):1;return Math.round((p+u)/2*100)},[e,t]),i=react.useMemo(()=>o.some(p=>p.isBid||p.isAsk),[o]),[l,a]=react.useState(null),s=react.useRef(null),c=react.useCallback((p,u)=>{s.current&&(s.current.style.filter=""),u?(u.style.filter="brightness(1.5)",s.current=u):s.current=null,p.isBid||p.isAsk?a({priceCents:p.priceCents,isBid:p.isBid,cumTotal:p.isBid?p.bidCumTotal:p.askCumTotal,cumCost:p.isBid?p.bidCumCost:p.askCumCost,leftPct:p.priceCents}):a(null);},[]),d=react.useCallback(()=>{s.current&&(s.current.style.filter="",s.current=null),a(null);},[]);return i?jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",userSelect:"none",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{flex:1,position:"relative",width:"100%",overflow:"hidden"},children:[n>0&&jsxRuntime.jsx("div",{style:{position:"absolute",left:`${n}%`,top:0,bottom:0,width:1,backgroundImage:"repeating-linear-gradient(to bottom, #6b7280 0, #6b7280 4px, transparent 4px, transparent 8px)",zIndex:1,pointerEvents:"none"}}),l&&jsxRuntime.jsx(qc,{info:l}),o.map(p=>jsxRuntime.jsx(Qc,{slot:p,onEnter:c,onLeave:d},p.priceCents))]}),jsxRuntime.jsx(Zc,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function fn(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function ms(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:"flex items-center justify-center gap-x-2 h-full text-neutral text-xs",children:[jsxRuntime.jsx(ui.Spinner,{size:"sm"}),jsxRuntime.jsx("span",{children:e("predict.orderBook.loading")})]})}function xs({market:e,outcome:t="yes",onTradeAction:r}){let{t:o}=i18n.useTranslation(),[n,i]=react.useState("depth"),l=t==="no",a=e.source,{data:s,isLoading:c}=reactPredict.useOrderbook({slug:e.slug,source:a}),d=react.useMemo(()=>((l?s?.asks:s?.bids)??[]).map(h=>({price:l?1-h.price:h.price,quantity:h.size})),[s?.bids,s?.asks,l]),p=react.useMemo(()=>((l?s?.bids:s?.asks)??[]).map(h=>({price:l?1-h.price:h.price,quantity:h.size})),[s?.bids,s?.asks,l]),u=react.useMemo(()=>d.length>0?Math.max(...d.map(g=>g.price)):null,[d]),m=react.useMemo(()=>p.length>0?Math.min(...p.map(g=>g.price)):null,[p]),f=react.useMemo(()=>{if(u==null||m==null)return null;let g=(m-u)*100;return Math.round(g*10)/10},[u,m]);return jsxRuntime.jsxs("div",{className:"flex flex-col h-[262px]",children:[jsxRuntime.jsxs("div",{className:"flex h-9 items-center border-b border-border px-1 text-xs",children:[jsxRuntime.jsx("span",{className:"flex-1 text-left text-neutral",children:f!=null?`${o("predict.orderBook.spread")}: ${Number.isInteger(f)?`${f}\xA2`:`${f.toFixed(1)}\xA2`}`:null}),jsxRuntime.jsxs("span",{className:"flex flex-1 items-center justify-center gap-x-1 whitespace-nowrap",children:[u!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bullish)"},children:[o("predict.trade.bestBid"),": ",fn(u)]}),u!=null&&m!=null&&jsxRuntime.jsx("span",{className:"text-neutral",children:"|"}),m!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bearish)"},children:[o("predict.trade.bestAsk"),": ",fn(m)]})]}),jsxRuntime.jsx("div",{className:"flex flex-1 justify-end",children:jsxRuntime.jsx("button",{type:"button",title:n==="depth"?"Orderbook":"Depth chart",onClick:()=>i(g=>g==="depth"?"table":"depth"),className:"flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground",children:n==="depth"?jsxRuntime.jsx(ui.OrderbookTableIcon,{className:"h-4 w-4"}):jsxRuntime.jsx(ui.OrderbookDepthIcon,{className:"h-4 w-4"})})})]}),jsxRuntime.jsxs("div",{className:"flex-1 min-h-0 overflow-hidden",children:[n==="depth"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(ms,{}):jsxRuntime.jsx(ps,{bids:d,asks:p})}),n==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(ms,{}):jsxRuntime.jsx(od,{bids:d,asks:p,bestBid:u??void 0,bestAsk:m??void 0,spread:f??void 0})})]})]})}var fs=8;function od({bids:e,asks:t,spread:r}){let{t:o}=i18n.useTranslation(),n=react.useMemo(()=>[...t].sort((s,c)=>s.price-c.price).slice(0,fs).reverse(),[t]),i=react.useMemo(()=>[...e].sort((s,c)=>c.price-s.price).slice(0,fs),[e]),l=react.useMemo(()=>{let s=[...n,...i].map(c=>c.quantity);return Math.max(...s,1)},[n,i]);return n.length===0&&i.length===0?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-full text-xs text-neutral",children:o("predict.orderBook.empty")}):jsxRuntime.jsxs("div",{className:"flex flex-col h-full overflow-y-auto text-xs font-mono select-none",children:[n.map(s=>jsxRuntime.jsx(gs,{price:s.price,quantity:s.quantity,side:"ask",maxQty:l},`ask-${s.price}`)),jsxRuntime.jsx("div",{className:"flex items-center justify-center gap-x-2 py-1 border-y border-border text-neutral text-[10px]",children:r!=null&&jsxRuntime.jsxs("span",{children:[o("predict.orderBook.spread"),":"," ",Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`]})}),i.map(s=>jsxRuntime.jsx(gs,{price:s.price,quantity:s.quantity,side:"bid",maxQty:l},`bid-${s.price}`)),jsxRuntime.jsxs("div",{className:"grid grid-cols-3 px-2 pt-2 pb-0.5 text-[10px] text-neutral border-t border-border",children:[jsxRuntime.jsx("span",{children:o("predict.orderBook.price")}),jsxRuntime.jsx("span",{className:"text-center",children:o("predict.orderBook.contracts")}),jsxRuntime.jsx("span",{className:"text-right",children:o("predict.orderBook.total")})]})]})}function gs({price:e,quantity:t,side:r,maxQty:o}){let n=r==="ask",i=Math.min(t/o*100,100),l=n?"bg-bearish/10":"bg-bullish/10",a=n?"text-bearish":"text-bullish",s=zt(Math.round(t)),c=Math.round(t*e),d=`$${zt(c)}`;return jsxRuntime.jsxs("div",{className:"relative grid grid-cols-3 px-2 py-1 hover:bg-content2 transition-colors cursor-default",children:[jsxRuntime.jsx("div",{className:`absolute inset-y-0 left-0 ${l} transition-[width] duration-200`,style:{width:`${i}%`}}),jsxRuntime.jsx("span",{className:`relative z-10 ${a}`,children:fn(e)}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-center",children:s}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-right",children:d})]})}var xn=class extends react.Component{state={error:null};static getDerivedStateFromError(t){return {error:t}}componentDidCatch(t,r){}render(){return this.state.error?jsxRuntime.jsxs("div",{style:{height:this.props.fallbackHeight??320,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,color:"#6b7280",fontSize:13},children:[jsxRuntime.jsx("span",{children:"Chart unavailable"}),jsxRuntime.jsx("span",{style:{fontSize:11,opacity:.7},children:this.state.error.message})]}):this.props.children}},vr=4,vs=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function hd(e,t){let r=new Date(e);return t===reactPredict.ChartRange.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function xd(e,t){let r=new Date(e);return t===reactPredict.ChartRange.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):t===reactPredict.ChartRange.ONE_WEEK?r.toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function bs(e){return `${(e*100).toFixed(2)}%`}var vd=[{range:reactPredict.ChartRange.ONE_DAY,label:"1D"},{range:reactPredict.ChartRange.ONE_WEEK,label:"1W"},{range:reactPredict.ChartRange.ONE_MONTH,label:"1M"},{range:reactPredict.ChartRange.ALL,label:"ALL"}];function bd({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:vd.map(({range:r,label:o})=>{let n=r===e;return jsxRuntime.jsx("button",{onClick:()=>t(r),style:{padding:"2px 8px",border:"none",background:"transparent",color:n?"#f9fafb":"#6b7280",fontWeight:n?700:400,fontSize:12,cursor:"pointer",borderRadius:4,letterSpacing:"0.02em",transition:"color 0.15s",userSelect:"none"},children:o},r)})})}function yd(){let e=react.useRef(null),t=react.useRef(null),r=react.useCallback(n=>{let i=e.current,l=t.current;if(!i||!l)return;let a=i.getBoundingClientRect(),s=(n.clientX-a.left)/a.width*100;l.style.background=`linear-gradient(to right, transparent ${s}%, rgba(0,0,0,0.55) ${s}%)`,l.style.opacity="1";},[]),o=react.useCallback(()=>{t.current&&(t.current.style.opacity="0");},[]);return {wrapperRef:e,overlayRef:t,onMouseMove:r,onMouseLeave:o}}function kd({active:e,payload:t,label:r,labelMap:o,allSeries:n,range:i}){if(!e||!n?.length)return null;let l=new Map;t?.forEach(s=>l.set(s.dataKey,s));let a=n.map(s=>l.get(s.slug)??{dataKey:s.slug,value:void 0,stroke:s.color,color:s.color});return jsxRuntime.jsxs("div",{style:{background:"rgba(10,10,10,0.92)",border:"1px solid rgba(255,255,255,0.1)",borderRadius:8,padding:"8px 12px",minWidth:180,backdropFilter:"blur(8px)",fontSize:12},children:[jsxRuntime.jsx("div",{style:{color:"#9ca3af",marginBottom:6,fontWeight:500},children:typeof r=="number"?xd(r,i):r}),a.map(s=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:3},children:[jsxRuntime.jsx("span",{style:{display:"inline-block",width:3,height:14,borderRadius:2,background:s.stroke??s.color,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:"#9ca3af",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:120},children:o.get(s.dataKey)??s.dataKey}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontWeight:700,fontVariantNumeric:"tabular-nums"},children:s.value!=null?bs(s.value):"--"})]},s.dataKey))]})}function Sd({markets:e,selectedSlugs:t,colorMap:r,onToggle:o}){let[n,i]=react.useState(false),l=react.useRef(null);react.useEffect(()=>{if(!n)return;function c(d){l.current&&!l.current.contains(d.target)&&i(false);}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]);let a=t.length>=vr,s=jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,flex:1,minWidth:0},children:[jsxRuntime.jsx("div",{style:{display:"flex",gap:3,flexShrink:0},children:t.map(c=>jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:r.get(c)??"#6b7280",display:"inline-block"}},c))}),jsxRuntime.jsx("span",{style:{color:"#e5e7eb",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.length===1?(()=>{let c=e.find(d=>d.slug===t[0]);return c?.outcomes?.[0]?.label??c?.question??"1 market"})():`${t.length} / ${e.length} markets`})]});return jsxRuntime.jsxs("div",{ref:l,style:{position:"relative",display:"inline-block",width:200},children:[jsxRuntime.jsxs("button",{onClick:()=>i(c=>!c),style:{display:"inline-flex",alignItems:"center",gap:6,padding:"5px 10px",borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(255,255,255,0.05)",cursor:"pointer",width:"100%",userSelect:"none"},children:[s,jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{flexShrink:0,transform:n?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.15s",color:"#6b7280"},children:jsxRuntime.jsx("path",{d:"M2 4l4 4 4-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),n&&jsxRuntime.jsxs("div",{style:{position:"absolute",top:"calc(100% + 4px)",left:0,zIndex:50,background:"#111827",border:"1px solid rgba(255,255,255,0.1)",borderRadius:10,boxShadow:"0 8px 24px rgba(0,0,0,0.5)",minWidth:260,maxWidth:360,maxHeight:320,overflowY:"auto",padding:"6px 0"},children:[jsxRuntime.jsxs("div",{style:{padding:"4px 12px 8px",fontSize:11,color:"#6b7280",borderBottom:"1px solid rgba(255,255,255,0.06)",marginBottom:4},children:["Select up to ",vr," markets"]}),e.map((c,d)=>{let p=t.includes(c.slug),u=!p&&a,m=p&&t.length===1,f=r.get(c.slug)??"#6b7280",g=c.outcomes.find(x=>x.label.toLowerCase()==="yes")??c.outcomes[0],h=g?.price!=null?`${Math.round(g.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{m||u||o(c.slug);},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"7px 12px",border:"none",background:p?"rgba(255,255,255,0.05)":"transparent",cursor:u||m?"not-allowed":"pointer",opacity:u?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:x=>{!u&&!m&&(x.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:x=>{x.currentTarget.style.background=p?"rgba(255,255,255,0.05)":"transparent";},children:[jsxRuntime.jsx("span",{style:{width:16,height:16,borderRadius:4,border:p?`2px solid ${f}`:"2px solid rgba(255,255,255,0.2)",background:p?`${f}30`:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:p&&jsxRuntime.jsx("svg",{width:"9",height:"7",viewBox:"0 0 9 7",fill:"none",children:jsxRuntime.jsx("path",{d:"M1 3.5L3.5 6L8 1",stroke:f,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:f,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:p?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.outcomes?.[0]?.label??c.question}),h&&jsxRuntime.jsx("span",{style:{color:f,fontWeight:700,fontSize:12,flexShrink:0},children:h})]},c.id??`${d}-${c.slug}`)})]})]})}function Nd({series:e,colorMap:t,displayValues:r}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px 24px",padding:"0 2px"},children:e.map(o=>{let n=t.get(o.marketSlug)??"#6b7280",i=r.get(o.marketSlug);return jsxRuntime.jsxs("div",{style:{display:"inline-flex",alignItems:"flex-start",gap:6},children:[jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:n,flexShrink:0,marginTop:3}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:1},children:[jsxRuntime.jsx("span",{style:{color:"#9ca3af",fontSize:12,lineHeight:"17px",whiteSpace:"nowrap"},children:o.label}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontSize:14,fontWeight:700,lineHeight:"20px",fontVariantNumeric:"tabular-nums"},children:i!=null?bs(i):"--"})]})]},o.marketSlug)})})}function Pd(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function wd(e,t){if(e.length<=t)return e;let r=[],o=e.length/t;for(let n=0;n<t;n++){let i=Math.floor(n*o),l=Math.min(Math.floor((n+1)*o),e.length),a=e.slice(i,l),s=a.map(c=>c.price).sort((c,d)=>c-d);r.push({timestamp:a[a.length-1].timestamp,price:Pd(s)});}return r}function Cd(e,t=200){if(e.length===0)return [];let r=e.map(a=>({...a,data:wd(a.data,t)})),o=new Set;r.forEach(a=>a.data.forEach(s=>o.add(s.timestamp)));let n=Array.from(o).sort((a,s)=>a-s),i=r.map(a=>{let s=new Map;return a.data.forEach(c=>s.set(c.timestamp,c.price)),{slug:a.marketSlug,map:s}}),l=new Map;return n.map(a=>{let s={timestamp:a};return i.forEach(({slug:c,map:d})=>{let p=d.get(a);if(p!==void 0)l.set(c,p),s[c]=p;else {let u=l.get(c);u!==void 0&&(s[c]=u);}}),s})}function ys(e){return jsxRuntime.jsx(xn,{children:jsxRuntime.jsx(Md,{...e})})}function Md({event:e,isLoading:t,className:r,volume:o}){let n=react.useMemo(()=>{let E=new Set;return (e.markets??[]).filter(_=>_.status!=="open"||E.has(_.slug)?false:(E.add(_.slug),true))},[e.markets]),i=react.useMemo(()=>[...n].sort((E,_)=>{let z=R=>(R.outcomes.find(ne=>ne.label.toLowerCase()==="yes")??R.outcomes[0])?.price??0;return z(_)-z(E)}),[n]),[l,a]=react.useState(()=>i.slice(0,vr).map(E=>E.slug)),[s,c]=react.useState(ar),d=react.useMemo(()=>{let E=new Map;return l.forEach((_,z)=>{E.set(_,vs[z%vs.length]);}),E},[l]),p=react.useMemo(()=>n.filter(E=>l.includes(E.slug)),[n,l]),{series:u,isLoading:m}=reactPredict.useMarketHistory(p,s),f=t||m,g=react.useMemo(()=>{if(u.length>0&&u.some(z=>z.data.length>0))return u;let E=Date.now(),_=864e5;return p.map(z=>{let ne=(z.outcomes?.find(fe=>fe.label.toLowerCase()==="yes")??z.outcomes?.[0])?.price??.5;return {marketSlug:z.slug,label:z.outcomes?.[0]?.label??z.question,data:[{timestamp:E-7*_,price:ne},{timestamp:E,price:ne}]}})},[u,p]),h=react.useMemo(()=>s===reactPredict.ChartRange.ONE_DAY?96:s===reactPredict.ChartRange.ONE_WEEK?168:s===reactPredict.ChartRange.ONE_MONTH?180:300,[s]),x=react.useMemo(()=>Cd(g,h),[g,h]),C=react.useMemo(()=>{if(x.length===0)return [0,1];let E=1/0,_=-1/0;if(l.forEach(R=>{x.forEach(ne=>{let fe=ne[R];fe!=null&&(fe<E&&(E=fe),fe>_&&(_=fe));});}),!isFinite(E))return [0,1];let z=Math.max((_-E)*.15,.05);return [Math.max(0,E-z),Math.min(1,_+z)]},[x,l]),b=react.useMemo(()=>{let E=new Map;return g.forEach(_=>{_.data.length>0&&E.set(_.marketSlug,_.data[_.data.length-1].price);}),E},[g]),N=react.useMemo(()=>{let E=new Map;return g.forEach(_=>E.set(_.marketSlug,_.label)),E},[g]),v=react.useMemo(()=>g.map(E=>({slug:E.marketSlug,color:d.get(E.marketSlug)??"#6b7280"})),[g,d]),{wrapperRef:H,overlayRef:y,onMouseMove:G,onMouseLeave:K}=yd(),oe=react.useCallback(E=>{a(_=>_.includes(E)?_.length<=1?_:_.filter(z=>z!==E):_.length>=vr?_:[..._,E]);},[]),[we,w]=react.useState(null),F=react.useRef(null),B=react.useRef(""),se=react.useRef(0),ae=!f&&x.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsx(Nd,{series:g,colorMap:d,displayValues:we??b}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[jsxRuntime.jsx("div",{ref:H,style:{height:300,width:"100%",userSelect:"none",position:"relative"},onMouseMove:ae?E=>{G(E),cancelAnimationFrame(se.current),se.current=requestAnimationFrame(()=>{w(F.current);});}:void 0,onMouseLeave:ae?()=>{K(),cancelAnimationFrame(se.current),B.current="",F.current=null,w(null);}:void 0,children:f?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:jsxRuntime.jsx("div",{style:{width:28,height:28,borderRadius:"50%",border:"2.5px solid #22d3ee",borderTopColor:"transparent",animation:"spin 0.7s linear infinite"}})}):x.length===0?jsxRuntime.jsx("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:"No price history data"}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{ref:y,style:{position:"absolute",inset:0,opacity:0,pointerEvents:"none",zIndex:1}}),jsxRuntime.jsx(recharts.ResponsiveContainer,{width:"100%",height:"100%",children:jsxRuntime.jsxs(recharts.LineChart,{data:x,margin:{top:8,right:16,left:0,bottom:0},children:[jsxRuntime.jsx(recharts.CartesianGrid,{horizontal:true,vertical:false,strokeDasharray:"3 3",stroke:"#374151",opacity:.5}),jsxRuntime.jsx(recharts.XAxis,{dataKey:"timestamp",type:"number",scale:"time",domain:["dataMin","dataMax"],tickFormatter:E=>hd(E,s),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:C,tickFormatter:E=>`${Math.round(E*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:E=>{let _=E;if(_.active&&_.payload?.length){let z=_.payload.map(R=>`${R.dataKey}:${R.value}`).join(",");if(z!==B.current){B.current=z;let R=new Map;_.payload.forEach(ne=>{ne.value!=null&&R.set(ne.dataKey,ne.value);}),F.current=R;}}return jsxRuntime.jsx(kd,{..._,labelMap:N,allSeries:v,range:s})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),g.map(E=>{let _=d.get(E.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:E.marketSlug,stroke:_,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:_},connectNulls:true,isAnimationActive:false},E.marketSlug)}),we==null&&x.length>0&&g.map(E=>{let _=x[x.length-1],z=_[E.marketSlug];if(z==null)return null;let R=d.get(E.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:_.timestamp,y:z,ifOverflow:"extendDomain",shape:ne=>{let{cx:fe,cy:pe}=ne;return fe==null||pe==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:fe,cy:pe,r:6,fill:R,opacity:.3,children:[jsxRuntime.jsx("animate",{attributeName:"r",values:"4;9;4",dur:"2s",repeatCount:"indefinite"}),jsxRuntime.jsx("animate",{attributeName:"opacity",values:"0.4;0.05;0.4",dur:"2s",repeatCount:"indefinite"})]}),jsxRuntime.jsx("circle",{cx:fe,cy:pe,r:3.5,fill:R})]})}},`pulse-${E.marketSlug}`)})]})})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"6px 8px",marginTop:6},children:[o!=null&&o>0&&jsxRuntime.jsxs("span",{style:{color:"#6b7280",fontSize:12},children:["$",Math.round(o).toLocaleString()," vol"]}),jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),jsxRuntime.jsx(bd,{value:s,onChange:c}),i.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(Sd,{markets:i,selectedSlugs:l,colorMap:d,onToggle:oe})})]})]})]})}function Kt(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function $d(e){return `${parseFloat((e*100).toFixed(2))}%`}function ks(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function br(e){return e.outcomes?.[0]?.label??e.question}function Wd(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function Ut(e){if(!e)return "\u2014";let t=new Date(e);if(isNaN(t.getTime()))return "\u2014";let r=t.toLocaleString("default",{month:"short"}),o=t.getDate(),n=t.getFullYear(),i=t.getHours().toString().padStart(2,"0"),l=t.getMinutes().toString().padStart(2,"0");return `${r} ${o}, ${n} ${i}:${l}`}function Ss(e){let[t,r]=react.useState(0);if(react.useEffect(()=>{if(!e)return;r(Date.now());let d=setInterval(()=>r(Date.now()),1e3);return ()=>clearInterval(d)},[e]),!e||t===0)return null;let o=new Date(e).getTime();if(isNaN(o))return null;let n=o-t;if(n<=0)return null;let i=Math.floor(n/864e5),l=Math.floor(n%864e5/36e5),a=Math.floor(n%36e5/6e4),s=Math.floor(n%6e4/1e3),c=[];return i>0&&c.push(`${i}d`),c.push(`${String(l).padStart(2,"0")}h`),c.push(`${String(a).padStart(2,"0")}m`),c.push(`${String(s).padStart(2,"0")}s`),c.join(" ")}function Ns(e){if(!e)return null;let t=new Date(e);if(isNaN(t.getTime()))return null;let r=t.getHours().toString().padStart(2,"0"),o=t.getMinutes().toString().padStart(2,"0"),n=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0"),l=t.getFullYear(),a=-t.getTimezoneOffset(),s=a>=0?"+":"-",c=String(Math.abs(Math.floor(a/60))).padStart(2,"0");return `${r}:${o} ${n}/${i}/${l} (${s}${c})`}function Ms({event:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{ref:o,isCollapsed:n}=hooks.useScrollCollapse(),i=react.useMemo(()=>{let p=[...e.markets||[]],u=p.filter(f=>f.status==="open").sort((f,g)=>Kt(g)-Kt(f)),m=p.filter(f=>f.status!=="open").sort((f,g)=>Kt(g)-Kt(f));return [...u,...m]},[e.markets]),l=e.status==="closed"||e.status==="voided",a=Ss(l?void 0:e.start_at),s=Ss(l?void 0:e.end_at),c=Ns(e.start_at),d=Ns(e.end_at);return jsxRuntime.jsxs("div",{className:"w-full flex flex-col gap-y-4 lg:gap-y-6",children:[jsxRuntime.jsxs("div",{ref:o,className:`sticky top-0 z-30 flex items-center backdrop-blur-md transition-all duration-300 ${n?"h-14 lg:h-16 gap-x-2 py-2 px-1 lg:px-4 -mx-1 lg:-mx-4 shadow-sm":"h-16 lg:h-20 gap-x-2 lg:gap-x-4"}`,children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"lg",classNames:{base:"bg-transparent"},className:`flex-shrink-0 transition-all duration-300 ${n?"!h-10 !w-10 lg:!h-12 lg:!w-12":"!h-16 !w-16 lg:!h-20 lg:!w-20"}`}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-0.5 min-w-0 flex-1",children:[!n&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e.tags?.slice(0,3).map((p,u)=>jsxRuntime.jsxs(react.Fragment,{children:[u>0&&jsxRuntime.jsx("span",{className:"text-sm text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral truncate",children:p.label})]},p.slug)),jsxRuntime.jsx(Vd,{source:e.source})]}),jsxRuntime.jsx("span",{className:`font-semibold truncate transition-all duration-300 ${n?"text-sm lg:text-base":"text-lg lg:text-xl"}`,children:e.title})]})]}),(a||s||l)&&jsxRuntime.jsx("div",{className:"flex items-center gap-x-2 text-xs lg:text-sm font-mono",children:l?d&&jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.event.endedAt",{time:d})}):a?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.beginsIn",{time:a})}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:c})]})]}):s?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.endsIn",{time:s})}),d&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:d})]})]}):null}),jsxRuntime.jsx(ys,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx(zd,{markets:i,onTradeAction:t}),jsxRuntime.jsx(Kd,{markets:i,event:e})]})}var Ps=5;function zd({markets:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{isMobile:o}=ui.useScreen(),[n,i]=react.useState(false),[l,a]=react.useState(null),s=react.useMemo(()=>{let h=new Set;return e.filter(x=>h.has(x.slug)?false:(h.add(x.slug),true))},[e]),c=s.find(h=>h.status==="open")?.slug,[d,p]=react.useState(c?`${c}:yes`:null);if(s.length===0)return null;let u=s.length>Ps,m=n?s:s.slice(0,Ps),f=h=>{a(x=>x===h?null:h);},g=(h,x,C)=>{p(`${h.slug}:${x}`),o||a(h.slug),t?.(h,x,C);};return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsxs("table",{className:"w-full border-collapse",children:[jsxRuntime.jsx("thead",{children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{}),jsxRuntime.jsx("th",{className:"py-2 text-left text-xs text-neutral font-normal lg:text-center lg:text-sm",children:r("predict.market.table.chance")}),jsxRuntime.jsx("th",{})]})}),jsxRuntime.jsx("tbody",{children:m.map((h,x)=>{let C=Kt(h),b=h.outcomes[1]?.best_ask??h.outcomes[1]?.price,N=l===h.slug;return jsxRuntime.jsx(Ud,{market:h,yesPrice:C,noPrice:b??void 0,activeYes:d===`${h.slug}:yes`,activeNo:d===`${h.slug}:no`,isExpanded:N,onToggleExpand:()=>f(h.slug),onTradeAction:g},h.id??`${x}-${h.slug}`)})})]}),u&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>i(h=>!h),className:"flex w-full items-center justify-start gap-x-2 py-2 pl-1 text-xs text-neutral lg:pl-2 lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r(n?"predict.event.rules.collapse":"predict.event.moreMarketsLabel")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-4 w-4 transition-transform",n&&"rotate-180")})]})]})}function Ud({market:e,yesPrice:t,noPrice:r,activeYes:o,activeNo:n,isExpanded:i,onToggleExpand:l,onTradeAction:a}){let{t:s}=i18n.useTranslation(),c=e.status==="open",d=e.volume?`$${Math.round(e.volume).toLocaleString("en-US")} vol`:void 0;return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("tr",{className:"cursor-pointer border-b border-border text-xs hover:bg-content2 lg:text-base",onClick:l,role:"button",tabIndex:0,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),l());},children:[jsxRuntime.jsx("td",{className:"py-2 pl-1 lg:pl-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1 lg:gap-x-2",children:[e.image_url&&jsxRuntime.jsx(ui.Avatar,{src:e.image_url,name:br(e)?.[0]||"?",radius:"lg",className:"size-5 shrink-0 lg:size-8",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate max-w-[200px] lg:max-w-[300px]",children:br(e)}),d&&jsxRuntime.jsx("span",{className:"text-[8px] text-neutral lg:text-xxs",children:d})]})]})}),jsxRuntime.jsx("td",{className:"py-2 text-left text-foreground lg:text-center",children:$d(t)}),jsxRuntime.jsx("td",{className:"py-2 pr-1 lg:pr-2",children:c?jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",className:ui.cn("flex min-w-16 items-center justify-center whitespace-nowrap rounded-lg p-2 lg:min-w-24 cursor-pointer hover:opacity-80 transition-all",o?"bg-primary text-primary-foreground":"bg-primary/10 text-primary"),onClick:p=>{p.stopPropagation(),a?.(e,"yes","buy");},children:s("predict.market.action.yes",{price:ks(t)})}),jsxRuntime.jsx("button",{type:"button",className:ui.cn("flex min-w-16 items-center justify-center whitespace-nowrap rounded-lg p-2 lg:min-w-24 cursor-pointer hover:opacity-80 transition-all",n?"bg-secondary text-secondary-foreground":"bg-secondary/10 text-secondary"),onClick:p=>{p.stopPropagation(),a?.(e,"no","buy");},children:r!=null?s("predict.market.action.no",{price:ks(r)}):s("predict.market.no")})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-end",children:jsxRuntime.jsx("span",{className:ui.cn("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",e.status==="closed"?"bg-neutral/10 text-neutral":e.status==="voided"?"bg-warning/10 text-warning":"bg-primary/10 text-primary"),children:e.status==="closed"?s("predict.event.status.closed"):e.status==="voided"?s("predict.event.status.voided"):s("predict.event.status.pending")})})})]}),i&&jsxRuntime.jsx("tr",{children:jsxRuntime.jsx("td",{colSpan:3,className:"pb-3",children:jsxRuntime.jsx("div",{className:"max-h-100 overflow-y-auto",children:jsxRuntime.jsx(xs,{market:e,outcome:n?"no":"yes",onTradeAction:a})})})})]})}function Kd({markets:e,event:t}){let{t:r}=i18n.useTranslation(),[o,n]=react.useState(false),[i,l]=react.useState(false),[a,s]=react.useState(0),c=e.filter(m=>m.rules&&m.rules.length>0||m.description);if(c.length===0)return null;let d=c[a]??c[0],p=d.rules&&d.rules.length>0?d.rules.join(`
|
|
20
20
|
|
|
21
|
-
`):u.description??"";if(!d)return null;let p=d.length>200&&!o?d.slice(0,200)+"...":d;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-foreground lg:text-base",children:r("predict.event.rules")}),c.length>1&&jsxRuntime.jsxs(ui.Dropdown,{placement:"bottom-end",classNames:{content:"min-w-36 bg-content1 border border-border"},children:[jsxRuntime.jsx(ui.DropdownTrigger,{children:jsxRuntime.jsx(ui.Button,{size:"sm",variant:"bordered",radius:"lg",endContent:jsxRuntime.jsx(ui.ChevronDownIcon,{className:"h-3.5 w-3.5"}),className:"text-xs text-foreground",children:br(u)})}),jsxRuntime.jsx(ui.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(s)],onAction:m=>{a(Number(m)),n(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:c.map((m,f)=>jsxRuntime.jsx(ui.DropdownItem,{className:ui.cn(f===s?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:br(m)},String(f)))})]})]}),jsxRuntime.jsx("div",{className:"text-xs text-foreground/80 lg:text-sm whitespace-pre-wrap",children:p}),d.length>200&&jsxRuntime.jsx("button",{type:"button",onClick:()=>n(m=>!m),className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors self-start",children:r(o?"predict.event.rules.collapse":"predict.event.showMore")}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>l(m=>!m),className:"flex items-center justify-between w-full mt-2 text-xs font-medium text-neutral lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r("predict.event.timelineAndPayout")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-4 w-4 transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex flex-col",children:(()=>{let m=u.status,f=[];return u.created_at&&f.push({label:r("predict.event.timeline.created"),value:Ut(u.created_at),isActive:true}),f.push({label:r("predict.event.timeline.open"),value:Ut(u.start_at),isActive:m!=="pending"}),m==="voided"?f.push({label:r("predict.event.timeline.voided"),value:Ut(u.closed_at??u.end_at),isActive:true}):m==="closed"?f.push({label:r("predict.event.timeline.closed"),value:Ut(u.closed_at??u.end_at),isActive:true}):f.push({label:r("predict.event.timeline.close"),value:Ut(u.end_at),isActive:false}),f})().map((m,f,g)=>jsxRuntime.jsxs("div",{className:"flex items-stretch gap-x-3",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-center w-3",children:[jsxRuntime.jsx("div",{className:`h-3 w-3 shrink-0 rounded-full border-2 mt-0.5 ${m.isActive?"border-primary bg-primary":"border-border bg-transparent"}`}),f<g.length-1&&jsxRuntime.jsx("div",{className:"w-px flex-1 bg-border"})]}),jsxRuntime.jsxs("div",{className:`flex flex-col ${f<g.length-1?"pb-4":""}`,children:[jsxRuntime.jsx("span",{className:"text-xs font-medium text-foreground lg:text-sm",children:m.label}),jsxRuntime.jsx("span",{className:"text-xs text-neutral lg:text-sm",children:m.value})]})]},m.label))}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 text-xxs text-neutral mt-2 lg:text-xs",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.event"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:t.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.market"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:u.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.source"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:Wd(u.source)})]})]})]})]})}function Vd({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}function Es({eventSlug:e,source:t,onTradeAction:r}){let{data:o,isLoading:n,error:i}=reactPredict.useEvent({slug:e,source:t});return n?jsxRuntime.jsx(Wt,{}):i||!o?jsxRuntime.jsx("div",{className:"flex w-full items-center justify-center py-20 text-danger",children:i?.message||"Event not found"}):jsxRuntime.jsx(Ms,{event:o,onTradeAction:r})}function Ts({eventSlug:e,source:t,limit:r=4,onEventClick:o}){let{t:n}=i18n.useTranslation(),{data:i,isLoading:l}=reactPredict.useSimilarEvents({slug:e,source:t,limit:r});return l||!i||i.length===0?null:jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3 mt-6 px-1 lg:px-0",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-foreground lg:text-base",children:n("predict.similar.title")}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-3",children:i.map(s=>jsxRuntime.jsx(Xd,{event:s,onClick:o},`${s.source}-${s.slug}`))})]})}function Xd({event:e,onClick:t}){let r=e.volume;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>t?.(e),className:"flex items-center gap-x-3 rounded-xl border border-border p-3 hover:bg-content2 transition-colors cursor-pointer text-left w-full",children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title?.[0]||"?",radius:"lg",className:"size-8 shrink-0 bg-transparent",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:e.title}),r!=null&&r>0&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral",children:["$",Math.round(r).toLocaleString()," vol"]})]}),jsxRuntime.jsx(ui.ChevronRightIcon,{className:"h-4 w-4 text-neutral shrink-0"})]})}function Ls(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function yh({eventSlug:e,source:t,chain:r,walletAddress:o,onSimilarEventClick:n,onBack:i}){let{t:l}=i18n.useTranslation(),{isMobile:s}=ui.useScreen(),{onOpen:a}=uiScaffold.useAsyncModal(It),{data:c,isLoading:u}=reactPredict.useEvent({slug:e,source:t}),d=react.useMemo(()=>[...c?.markets||[]].sort((x,P)=>Ls(P)-Ls(x)),[c?.markets]),[p,m]=react.useState(null),f=react.useCallback((x,P,y)=>{m(N=>({market:x,outcome:P,side:y,version:(N?.version??0)+1})),s&&c&&a({params:{event:c,market:x,initialOutcome:P,chain:r}});},[s,c,r,a]),g=p?.market??d[0];if(u){let x=!!i;return s?jsxRuntime.jsx(Wt,{showBack:x}):jsxRuntime.jsxs("div",{className:"flex w-full max-w-6xl mx-auto gap-x-4 lg:gap-x-6",children:[jsxRuntime.jsx("div",{className:"min-w-0 flex-1 max-w-3xl",children:jsxRuntime.jsx(Wt,{showBack:x})}),jsxRuntime.jsx("aside",{className:"hidden lg:block w-[340px] xl:w-[380px] shrink-0",children:jsxRuntime.jsx("div",{className:"sticky top-4 max-h-[calc(100dvh-2rem)] overflow-y-auto scrollbar-thin",children:jsxRuntime.jsx(as,{})})})]})}let h=p?`${p.market.slug}-${p.version}`:g?.slug??"default";return jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 pb-12 lg:max-w-7xl lg:gap-y-8 lg:pb-16 mx-auto",children:[jsxRuntime.jsxs("div",{className:"flex w-full justify-center gap-4 pt-4 lg:gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-auto min-w-0 flex flex-col gap-y-4 px-4 lg:gap-y-6 lg:px-0",children:[i&&jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsx(ui.Button,{as:"a",onPress:i,startContent:jsxRuntime.jsx(ui.ChevronLeftIcon,{className:"h-4 w-4"}),className:"text-neutral bg-transparent h-5 min-h-5 gap-x-2 p-0 text-base w-auto min-w-auto",children:l("common.back")})}),jsxRuntime.jsx(Es,{eventSlug:e,source:t,onTradeAction:f})]}),jsxRuntime.jsxs("div",{className:"hidden flex-none w-md flex-col gap-y-4 lg:sticky lg:top-4 lg:flex lg:self-start",children:[g&&jsxRuntime.jsx(ir,{event:c,market:g,initialSide:p?.side,initialOutcome:p?.outcome,chain:r},h),c&&jsxRuntime.jsx(Ts,{eventSlug:e,source:c.source,onEventClick:n})]})]}),c&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:jsxRuntime.jsx(ss,{event:c,walletAddress:o})}),jsxRuntime.jsx(lr,{})]})}function _s(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function uu(e){switch(e){case reactPredict.ChartRange.ONE_DAY:return {interval:"15m",limit:96};case reactPredict.ChartRange.ONE_WEEK:return {interval:"1h",limit:168};case reactPredict.ChartRange.ONE_MONTH:return {interval:"4h",limit:180};case reactPredict.ChartRange.ALL:return {interval:"1d",limit:300};default:return {interval:"1h",limit:100}}}var Mh=e=>{let{candlestickMarketSlugs:t,chartRange:r=ar,source:o}=e,n=reactPredict.usePredictClient(),i=react.useMemo(()=>uu(r),[r]),{data:l,isLoading:s,error:a}=reactPredict.useEvent({slug:e.eventSlug,source:o}),c=react.useMemo(()=>{if(!l?.markets)return [];let f=new Set,g=l.markets.filter(x=>f.has(x.slug)?false:(f.add(x.slug),true));return (t&&t.length>0?t.slice(0,4).map(x=>g.find(P=>P.slug===x)).filter(x=>x!==void 0):[...g].sort((x,P)=>_s(P)-_s(x)).slice(0,4)).map(x=>x.slug)},[t,l?.markets]),u=reactQuery.useQueries({queries:c.map(f=>({queryKey:reactPredict.candlesticksQueryKey(f,i),queryFn:()=>n.listCandlesticks(f,i),enabled:c.length>0}))}),d=u.some(f=>f.isLoading),p=react.useMemo(()=>{let f=new Map;return c.forEach((g,h)=>{let x=u[h]?.error;x&&f.set(g,x);}),f},[c,u]),m=react.useMemo(()=>{let f=new Map;return c.forEach((g,h)=>{let x=u[h]?.data;x&&f.set(g,x);}),f},[c,u]);return {event:l,isEventLoading:s,eventError:a,candlestickParams:i,candlesticks:m,isCandlesticksLoading:d,candlestickErrors:p}};var fu=10,gu=utils$1.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function Pr(){let[e,t]=jotai.useAtom(gu),r=react.useCallback(n=>{let i=n.trim();i&&t(l=>{let s=l.filter(a=>a!==i);return [i,...s].slice(0,fu)});},[t]),o=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:o}}function As({histories:e,onSelect:t,onClear:r,className:o}){let{t:n}=i18n.useTranslation();return e.length===0?null:jsxRuntime.jsxs("div",{className:ui.cn("px-4 pb-4",o),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:n("predict.search.history")}),jsxRuntime.jsx(ui.Button,{isIconOnly:true,size:"sm",className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui.TrashIcon,{width:20,height:20})})]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:e.map(i=>jsxRuntime.jsx(ui.Chip,{size:"sm",variant:"bordered",className:ui.cn("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(i),children:i},i))})]})}function Ds({onSelect:e,className:t}){let{histories:r,clearHistories:o}=Pr();return jsxRuntime.jsx(As,{className:ui.cn(t),histories:r,onSelect:e,onClear:o})}function Fs({value:e,onValueChange:t,onClear:r,onEscape:o,className:n}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:n,children:jsxRuntime.jsx(ui.StyledInput,{autoFocus:true,variant:"flat",radius:"full",value:e,onValueChange:t,placeholder:i("predict.search.placeholder"),startContent:jsxRuntime.jsx(ui.SearchIcon,{width:20,height:20,className:"text-neutral"}),endContent:e?jsxRuntime.jsx(ui.Button,{isIconOnly:true,className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui.XCloseIcon,{width:20,height:20})}):jsxRuntime.jsx(ui.Kbd,{className:"min-w-8 justify-center text-xs text-neutral bg-transparent border border-border rounded-full cursor-pointer select-none",onMouseDown:l=>{l.preventDefault(),o?.();},children:"Esc"})})})}function Hs({event:e,href:t,LinkComponent:r,onSelect:o,onHover:n,className:i}){let{t:l}=i18n.useTranslation(),s=e.tags?.[0],a=react.useMemo(()=>`$${Math.round(e.volume??0).toLocaleString("en-US")}`,[e.volume]);return jsxRuntime.jsxs(ui.Linkable,{href:t,LinkComponent:r,className:ui.cn("w-full h-full px-3 flex items-center gap-3","hover:cursor-pointer hover:bg-content2 rounded-lg","transition-colors duration-150",i),onClick:c=>{t&&o&&c.preventDefault(),o?.(e);},onMouseEnter:()=>n?.(e),children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"full",className:"h-10 w-10 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"min-w-0 text-sm font-medium truncate",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2 text-[10px] font-normal text-neutral-500 lg:text-xs",children:[s&&jsxRuntime.jsx("span",{className:ui.cn("inline-flex items-center","rounded-full px-1.5 py-0.5","text-[10px] font-semibold leading-none uppercase","bg-primary/15 text-primary"),children:s.label}),jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1.5",children:[a," ",l("predict.event.volume"),jsxRuntime.jsx(Ou,{source:e.source})]})]})]})]})}function Ou({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}function $s({keyword:e="",limit:t,source:r}){let{data:o,isLoading:n,isFetchingNextPage:i,hasNextPage:l,fetchNextPage:s}=reactPredict.useSearchEvents({keyword:e,limit:t,source:r},{enabled:true});return {events:react.useMemo(()=>o?.pages.flatMap(c=>c.items).filter(c=>c!=null)??[],[o]),isLoading:n,isFetchingNextPage:i,hasNextPage:l??false,fetchNextPage:s}}var Uu=56;function Ks({onSelect:e,getEventHref:t,LinkComponent:r,onHover:o,className:n,...i}){let{events:l,isLoading:s,isFetchingNextPage:a,hasNextPage:c,fetchNextPage:u}=$s(i),d=react.useRef(null),{height:p}=hooks.useResizeObserver({ref:d}),m=react.useCallback(x=>x<l.length,[l]),f=react.useCallback(async()=>{c&&!a&&await u();},[c,a,u]),g=react.useMemo(()=>c?l.length+1:l.length,[l,c]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:m,loadMoreRows:f,rowCount:g,threshold:5});return s?jsxRuntime.jsx(Vu,{className:n}):l.length===0?jsxRuntime.jsx(ju,{className:n}):jsxRuntime.jsx("div",{className:ui.cn("w-full h-full flex flex-col",n),children:jsxRuntime.jsx("div",{className:"flex-auto min-h-0",ref:d,children:jsxRuntime.jsx(reactWindow.List,{style:{height:p},onRowsRendered:h,rowComponent:Ku,rowCount:g,rowHeight:Uu,rowProps:{events:l,onSelect:e,getEventHref:t,LinkComponent:r,onHover:o},overscanCount:5})})})}function Ku({index:e,style:t,events:r,onSelect:o,getEventHref:n,LinkComponent:i,onHover:l}){let s=r[e];return s?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(Hs,{event:s,href:n?.(s),LinkComponent:i,onSelect:o,onHover:l})}):jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})}function Vu({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-2 py-16",e),children:[jsxRuntime.jsx(ui.Spinner,{size:"sm"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral",children:t("predict.search.loading")})]})}function ju({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui.cn("flex flex-col items-center justify-center py-16",e),children:[jsxRuntime.jsx(ui.EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsxRuntime.jsx("p",{className:"mt-2 text-sm text-neutral",children:t("predict.search.noResults")})]})}function Ys({onKeywordChange:e}){let[t,r]=react.useState(""),[o,n]=react.useState(""),{addHistory:i}=Pr(),l=hooks.useCallbackRef(e),s=hooks.useCallbackRef(i),a=react.useMemo(()=>utils.debounce(p=>{n(p),l(p),p&&s(p);},500),[l,s]),c=react.useCallback(p=>{r(p),a(p);},[a]),u=react.useCallback(p=>{a.cancel(),r(p),n(p),l(p),p&&s(p);},[a,l,s]),d=react.useCallback(()=>u(""),[u]);return {text:t,keyword:o,setText:c,setKeyword:u,clearKeyword:d}}function qs({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:o,onHover:n,onEscape:i,source:l}){let{text:s,keyword:a,setText:c,setKeyword:u,clearKeyword:d}=Ys({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(Fs,{value:s,onValueChange:c,onClear:d,onEscape:i}),!a&&jsxRuntime.jsx(Ds,{onSelect:u}),jsxRuntime.jsx(Ks,{className:"flex-auto min-h-0",keyword:a,onSelect:t,getEventHref:r,LinkComponent:o,onHover:n,source:l})]})}var Nn="predict-search";function Gx({id:e=Nn}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(sp,{...t})})}function sp({params:e,isOpen:t,onOpenChange:r,onResult:o}){let{t:n}=i18n.useTranslation(),{isMobile:i}=ui.useScreen(),l=react.useCallback(a=>{o(a);},[o]),s=react.useCallback(()=>{r(false);},[r]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:i?"full":"lg",hideCloseButton:true,backdrop:"blur",radius:"lg",children:jsxRuntime.jsxs(ui.ModalContent,{className:"w-full h-full",children:[jsxRuntime.jsxs(ui.ModalHeader,{className:"sm:hidden flex items-center justify-between pt-4 pb-2",children:[jsxRuntime.jsx("span",{className:"text-base font-semibold",children:n("predict.search.title")}),jsxRuntime.jsx(ui.Button,{isIconOnly:true,onPress:()=>r(false),size:"sm",className:"bg-transparent min-w-6 w-6 h-6",children:jsxRuntime.jsx(ui.XCloseIcon,{width:20,height:20})})]}),jsxRuntime.jsx(ui.ModalBody,{className:"p-4",children:jsxRuntime.jsx(qs,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:l,onEscape:s})})]})})}function rv({onSelectEvent:e,modalParams:t,className:r}){let{t:o}=i18n.useTranslation(),{isDesktop:n,isMobile:i}=ui.useScreen(),{onOpen:l,onClose:s}=uiScaffold.useAsyncModal(Nn),a=hooks.useCallbackRef(e),c=hooks.useCallbackRef(async()=>{let d=await l({params:t});d&&a(d);}),u=hooks.useCallbackRef(()=>{s();});return react.useEffect(()=>{let d=p=>{let m=document.activeElement,f=!!m&&(m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.getAttribute("contenteditable")==="true");p.key==="/"&&!f&&(p.preventDefault(),c()),p.key==="Escape"&&(p.preventDefault(),u());};return window.addEventListener("keydown",d),()=>{window.removeEventListener("keydown",d);}},[c,u]),jsxRuntime.jsx(ui.Button,{size:"sm",radius:"full",isIconOnly:!n,onPress:c,variant:i?"flat":"bordered",startContent:n?jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"}):void 0,endContent:n?jsxRuntime.jsx(ui.Kbd,{className:"ml-auto min-w-6 justify-center text-xs bg-transparent border border-border rounded-full",children:"/"}):void 0,className:ui.cn(n&&"min-w-56 justify-start pl-3 pr-1.5 text-neutral",r),children:n?o("predict.search.placeholder"):jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"})})}var wn=[{value:"spread",labelKey:"predict.matches.sort.spread",descKey:"predict.matches.sort.spreadDesc",icon:"trending-up"},{value:"volume",labelKey:"predict.matches.sort.volume",descKey:"predict.matches.sort.volumeDesc",icon:"chart-column"},{value:"confidence",labelKey:"predict.matches.sort.confidence",descKey:"predict.matches.sort.confidenceDesc",icon:"flame"}],oa=[{labelKey:"predict.matches.filter.noMinimum",label:"$0",value:0},{labelKey:null,label:"$100+",value:100},{labelKey:null,label:"$500+",value:500},{labelKey:null,label:"$1K+",value:1e3},{labelKey:null,label:"$5K+",value:5e3},{labelKey:null,label:"$10K+",value:1e4},{labelKey:null,label:"$50K+",value:5e4},{labelKey:null,label:"$100K+",value:1e5}],ta={display:"inline-flex",alignItems:"center",gap:8,borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"8px 12px",fontSize:14,color:"#d4d4d8",cursor:"pointer",transition:"all 0.15s"},ra={position:"absolute",right:0,top:"100%",zIndex:20,marginTop:8,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"};function gp(e,t){if(!e)return "$5K+";let r=oa.find(o=>o.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function sa({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:o,minVolume:n,onMinVolumeChange:i,onRefresh:l}){let{t:s}=i18n.useTranslation(),[a,c]=react.useState(false),[u,d]=react.useState(false),[p,m]=react.useState(false),[f,g]=react.useState(false),h=react.useRef(null),x=react.useRef(null),P=wn.find(v=>v.value===e)??wn[0],y=react.useCallback(v=>{h.current&&!h.current.contains(v.target)&&c(false),x.current&&!x.current.contains(v.target)&&d(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)),[y]);let N=react.useCallback(()=>{l?.(),g(true),setTimeout(()=>g(false),700);},[l]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
|
|
21
|
+
`):d.description??"";if(!p)return null;let u=p.length>200&&!o?p.slice(0,200)+"...":p;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-foreground lg:text-base",children:r("predict.event.rules")}),c.length>1&&jsxRuntime.jsxs(ui.Dropdown,{placement:"bottom-end",classNames:{content:"min-w-36 bg-content1 border border-border"},children:[jsxRuntime.jsx(ui.DropdownTrigger,{children:jsxRuntime.jsx(ui.Button,{size:"sm",variant:"bordered",radius:"lg",endContent:jsxRuntime.jsx(ui.ChevronDownIcon,{className:"h-3.5 w-3.5"}),className:"text-xs text-foreground",children:br(d)})}),jsxRuntime.jsx(ui.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(a)],onAction:m=>{s(Number(m)),n(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:c.map((m,f)=>jsxRuntime.jsx(ui.DropdownItem,{className:ui.cn(f===a?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:br(m)},String(f)))})]})]}),jsxRuntime.jsx("div",{className:"text-xs text-foreground/80 lg:text-sm whitespace-pre-wrap",children:u}),p.length>200&&jsxRuntime.jsx("button",{type:"button",onClick:()=>n(m=>!m),className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors self-start",children:r(o?"predict.event.rules.collapse":"predict.event.showMore")}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>l(m=>!m),className:"flex items-center justify-between w-full mt-2 text-xs font-medium text-neutral lg:text-sm cursor-pointer hover:text-foreground transition-colors",children:[jsxRuntime.jsx("span",{children:r("predict.event.timelineAndPayout")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-4 w-4 transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex flex-col",children:(()=>{let m=d.status,f=[];return d.created_at&&f.push({label:r("predict.event.timeline.created"),value:Ut(d.created_at),isActive:true}),f.push({label:r("predict.event.timeline.open"),value:Ut(d.start_at),isActive:m!=="pending"}),m==="voided"?f.push({label:r("predict.event.timeline.voided"),value:Ut(d.closed_at??d.end_at),isActive:true}):m==="closed"?f.push({label:r("predict.event.timeline.closed"),value:Ut(d.closed_at??d.end_at),isActive:true}):f.push({label:r("predict.event.timeline.close"),value:Ut(d.end_at),isActive:false}),f})().map((m,f,g)=>jsxRuntime.jsxs("div",{className:"flex items-stretch gap-x-3",children:[jsxRuntime.jsxs("div",{className:"flex flex-col items-center w-3",children:[jsxRuntime.jsx("div",{className:`h-3 w-3 shrink-0 rounded-full border-2 mt-0.5 ${m.isActive?"border-primary bg-primary":"border-border bg-transparent"}`}),f<g.length-1&&jsxRuntime.jsx("div",{className:"w-px flex-1 bg-border"})]}),jsxRuntime.jsxs("div",{className:`flex flex-col ${f<g.length-1?"pb-4":""}`,children:[jsxRuntime.jsx("span",{className:"text-xs font-medium text-foreground lg:text-sm",children:m.label}),jsxRuntime.jsx("span",{className:"text-xs text-neutral lg:text-sm",children:m.value})]})]},m.label))}),jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 text-xxs text-neutral mt-2 lg:text-xs",children:[jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.event"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:t.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.market"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:d.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.source"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:Wd(d.source)})]})]})]})]})}function Vd({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}function Es({eventSlug:e,source:t,onTradeAction:r}){let{data:o,isLoading:n,error:i}=reactPredict.useEvent({slug:e,source:t});return n?jsxRuntime.jsx(Wt,{}):i||!o?jsxRuntime.jsx("div",{className:"flex w-full items-center justify-center py-20 text-danger",children:i?.message||"Event not found"}):jsxRuntime.jsx(Ms,{event:o,onTradeAction:r})}function Ts({eventSlug:e,source:t,limit:r=4,onEventClick:o}){let{t:n}=i18n.useTranslation(),{data:i,isLoading:l}=reactPredict.useSimilarEvents({slug:e,source:t,limit:r});return l||!i||i.length===0?null:jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3 mt-6 px-1 lg:px-0",children:[jsxRuntime.jsx("span",{className:"text-sm font-semibold text-foreground lg:text-base",children:n("predict.similar.title")}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-3",children:i.map(a=>jsxRuntime.jsx(Xd,{event:a,onClick:o},`${a.source}-${a.slug}`))})]})}function Xd({event:e,onClick:t}){let r=e.volume;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>t?.(e),className:"flex items-center gap-x-3 rounded-xl border border-border p-3 hover:bg-content2 transition-colors cursor-pointer text-left w-full",children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title?.[0]||"?",radius:"lg",className:"size-8 shrink-0 bg-transparent",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{className:"flex flex-col min-w-0 flex-1",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:e.title}),r!=null&&r>0&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral",children:["$",Math.round(r).toLocaleString()," vol"]})]}),jsxRuntime.jsx(ui.ChevronRightIcon,{className:"h-4 w-4 text-neutral shrink-0"})]})}function Ls(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function yh({eventSlug:e,source:t,chain:r,walletAddress:o,onSimilarEventClick:n,onBack:i}){let{t:l}=i18n.useTranslation(),{isMobile:a}=ui.useScreen(),{onOpen:s}=uiScaffold.useAsyncModal(It),{data:c,isLoading:d}=reactPredict.useEvent({slug:e,source:t}),p=react.useMemo(()=>[...c?.markets||[]].sort((x,C)=>Ls(C)-Ls(x)),[c?.markets]),[u,m]=react.useState(null),f=react.useCallback((x,C,b)=>{m(N=>({market:x,outcome:C,side:b,version:(N?.version??0)+1})),a&&c&&s({params:{event:c,market:x,initialOutcome:C,chain:r}});},[a,c,r,s]),g=u?.market??p[0];if(d){let x=!!i;return a?jsxRuntime.jsx(Wt,{showBack:x}):jsxRuntime.jsxs("div",{className:"flex w-full max-w-6xl mx-auto gap-x-4 lg:gap-x-6",children:[jsxRuntime.jsx("div",{className:"min-w-0 flex-1 max-w-3xl",children:jsxRuntime.jsx(Wt,{showBack:x})}),jsxRuntime.jsx("aside",{className:"hidden lg:block w-[340px] xl:w-[380px] shrink-0",children:jsxRuntime.jsx("div",{className:"sticky top-4 max-h-[calc(100dvh-2rem)] overflow-y-auto scrollbar-thin",children:jsxRuntime.jsx(as,{})})})]})}let h=u?`${u.market.slug}-${u.version}`:g?.slug??"default";return jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 pb-12 lg:max-w-7xl lg:gap-y-8 lg:pb-16 mx-auto",children:[jsxRuntime.jsxs("div",{className:"flex w-full justify-center gap-4 pt-4 lg:gap-6",children:[jsxRuntime.jsxs("div",{className:"flex-auto min-w-0 flex flex-col gap-y-4 px-4 lg:gap-y-6 lg:px-0",children:[i&&jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsx(ui.Button,{as:"a",onPress:i,startContent:jsxRuntime.jsx(ui.ChevronLeftIcon,{className:"h-4 w-4"}),className:"text-neutral bg-transparent h-5 min-h-5 gap-x-2 p-0 text-base w-auto min-w-auto",children:l("common.back")})}),jsxRuntime.jsx(Es,{eventSlug:e,source:t,onTradeAction:f})]}),jsxRuntime.jsxs("div",{className:"hidden flex-none w-md flex-col gap-y-4 lg:sticky lg:top-4 lg:flex lg:self-start",children:[g&&jsxRuntime.jsx(ir,{event:c,market:g,initialSide:u?.side,initialOutcome:u?.outcome,chain:r},h),c&&jsxRuntime.jsx(Ts,{eventSlug:e,source:c.source,onEventClick:n})]})]}),c&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:jsxRuntime.jsx(ss,{event:c,walletAddress:o})}),jsxRuntime.jsx(lr,{})]})}function _s(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function uu(e){switch(e){case reactPredict.ChartRange.ONE_DAY:return {interval:"15m",limit:96};case reactPredict.ChartRange.ONE_WEEK:return {interval:"1h",limit:168};case reactPredict.ChartRange.ONE_MONTH:return {interval:"4h",limit:180};case reactPredict.ChartRange.ALL:return {interval:"1d",limit:300};default:return {interval:"1h",limit:100}}}var Mh=e=>{let{candlestickMarketSlugs:t,chartRange:r=ar,source:o}=e,n=reactPredict.usePredictClient(),i=react.useMemo(()=>uu(r),[r]),{data:l,isLoading:a,error:s}=reactPredict.useEvent({slug:e.eventSlug,source:o}),c=react.useMemo(()=>{if(!l?.markets)return [];let f=new Set,g=l.markets.filter(x=>f.has(x.slug)?false:(f.add(x.slug),true));return (t&&t.length>0?t.slice(0,4).map(x=>g.find(C=>C.slug===x)).filter(x=>x!==void 0):[...g].sort((x,C)=>_s(C)-_s(x)).slice(0,4)).map(x=>x.slug)},[t,l?.markets]),d=reactQuery.useQueries({queries:c.map(f=>({queryKey:reactPredict.candlesticksQueryKey(f,i),queryFn:()=>n.listCandlesticks(f,i),enabled:c.length>0}))}),p=d.some(f=>f.isLoading),u=react.useMemo(()=>{let f=new Map;return c.forEach((g,h)=>{let x=d[h]?.error;x&&f.set(g,x);}),f},[c,d]),m=react.useMemo(()=>{let f=new Map;return c.forEach((g,h)=>{let x=d[h]?.data;x&&f.set(g,x);}),f},[c,d]);return {event:l,isEventLoading:a,eventError:s,candlestickParams:i,candlesticks:m,isCandlesticksLoading:p,candlestickErrors:u}};var fu=10,gu=utils$1.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function Pr(){let[e,t]=jotai.useAtom(gu),r=react.useCallback(n=>{let i=n.trim();i&&t(l=>{let a=l.filter(s=>s!==i);return [i,...a].slice(0,fu)});},[t]),o=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:o}}function As({histories:e,onSelect:t,onClear:r,className:o}){let{t:n}=i18n.useTranslation();return e.length===0?null:jsxRuntime.jsxs("div",{className:ui.cn("px-4 pb-4",o),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:n("predict.search.history")}),jsxRuntime.jsx(ui.Button,{isIconOnly:true,size:"sm",className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui.TrashIcon,{width:20,height:20})})]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:e.map(i=>jsxRuntime.jsx(ui.Chip,{size:"sm",variant:"bordered",className:ui.cn("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(i),children:i},i))})]})}function Ds({onSelect:e,className:t}){let{histories:r,clearHistories:o}=Pr();return jsxRuntime.jsx(As,{className:ui.cn(t),histories:r,onSelect:e,onClear:o})}function Fs({value:e,onValueChange:t,onClear:r,onEscape:o,className:n}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:n,children:jsxRuntime.jsx(ui.StyledInput,{autoFocus:true,variant:"flat",radius:"full",value:e,onValueChange:t,placeholder:i("predict.search.placeholder"),startContent:jsxRuntime.jsx(ui.SearchIcon,{width:20,height:20,className:"text-neutral"}),endContent:e?jsxRuntime.jsx(ui.Button,{isIconOnly:true,className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui.XCloseIcon,{width:20,height:20})}):jsxRuntime.jsx(ui.Kbd,{className:"min-w-8 justify-center text-xs text-neutral bg-transparent border border-border rounded-full cursor-pointer select-none",onMouseDown:l=>{l.preventDefault(),o?.();},children:"Esc"})})})}function Hs({event:e,href:t,LinkComponent:r,onSelect:o,onHover:n,className:i}){let{t:l}=i18n.useTranslation(),a=e.tags?.[0],s=react.useMemo(()=>`$${Math.round(e.volume??0).toLocaleString("en-US")}`,[e.volume]);return jsxRuntime.jsxs(ui.Linkable,{href:t,LinkComponent:r,className:ui.cn("w-full h-full px-3 flex items-center gap-3","hover:cursor-pointer hover:bg-content2 rounded-lg","transition-colors duration-150",i),onClick:c=>{t&&o&&c.preventDefault(),o?.(e);},onMouseEnter:()=>n?.(e),children:[jsxRuntime.jsx(ui.Avatar,{src:e.image_url||void 0,name:e.title||"Event",radius:"full",className:"h-10 w-10 flex-shrink-0"}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center gap-y-0.5",children:[jsxRuntime.jsx("span",{className:"min-w-0 text-sm font-medium truncate",children:e.title}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2 text-[10px] font-normal text-neutral-500 lg:text-xs",children:[a&&jsxRuntime.jsx("span",{className:ui.cn("inline-flex items-center","rounded-full px-1.5 py-0.5","text-[10px] font-semibold leading-none uppercase","bg-primary/15 text-primary"),children:a.label}),jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1.5",children:[s," ",l("predict.event.volume"),jsxRuntime.jsx(Ou,{source:e.source})]})]})]})]})}function Ou({source:e}){return jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1 text-neutral-400",title:e==="polymarket"?"Polymarket":"Kalshi",children:[jsxRuntime.jsx("span",{className:"text-neutral-600",children:"\xB7"}),e==="polymarket"?jsxRuntime.jsx(ui.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}function $s({keyword:e="",limit:t,source:r}){let{data:o,isLoading:n,isFetchingNextPage:i,hasNextPage:l,fetchNextPage:a}=reactPredict.useSearchEvents({keyword:e,limit:t,source:r},{enabled:true});return {events:react.useMemo(()=>o?.pages.flatMap(c=>c.items).filter(c=>c!=null)??[],[o]),isLoading:n,isFetchingNextPage:i,hasNextPage:l??false,fetchNextPage:a}}var Uu=56;function Ks({onSelect:e,getEventHref:t,LinkComponent:r,onHover:o,className:n,...i}){let{events:l,isLoading:a,isFetchingNextPage:s,hasNextPage:c,fetchNextPage:d}=$s(i),p=react.useRef(null),{height:u}=hooks.useResizeObserver({ref:p}),m=react.useCallback(x=>x<l.length,[l]),f=react.useCallback(async()=>{c&&!s&&await d();},[c,s,d]),g=react.useMemo(()=>c?l.length+1:l.length,[l,c]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:m,loadMoreRows:f,rowCount:g,threshold:5});return a?jsxRuntime.jsx(Vu,{className:n}):l.length===0?jsxRuntime.jsx(ju,{className:n}):jsxRuntime.jsx("div",{className:ui.cn("w-full h-full flex flex-col",n),children:jsxRuntime.jsx("div",{className:"flex-auto min-h-0",ref:p,children:jsxRuntime.jsx(reactWindow.List,{style:{height:u},onRowsRendered:h,rowComponent:Ku,rowCount:g,rowHeight:Uu,rowProps:{events:l,onSelect:e,getEventHref:t,LinkComponent:r,onHover:o},overscanCount:5})})})}function Ku({index:e,style:t,events:r,onSelect:o,getEventHref:n,LinkComponent:i,onHover:l}){let a=r[e];return a?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(Hs,{event:a,href:n?.(a),LinkComponent:i,onSelect:o,onHover:l})}):jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})}function Vu({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-2 py-16",e),children:[jsxRuntime.jsx(ui.Spinner,{size:"sm"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral",children:t("predict.search.loading")})]})}function ju({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui.cn("flex flex-col items-center justify-center py-16",e),children:[jsxRuntime.jsx(ui.EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsxRuntime.jsx("p",{className:"mt-2 text-sm text-neutral",children:t("predict.search.noResults")})]})}function Ys({onKeywordChange:e}){let[t,r]=react.useState(""),[o,n]=react.useState(""),{addHistory:i}=Pr(),l=hooks.useCallbackRef(e),a=hooks.useCallbackRef(i),s=react.useMemo(()=>utils.debounce(u=>{n(u),l(u),u&&a(u);},500),[l,a]),c=react.useCallback(u=>{r(u),s(u);},[s]),d=react.useCallback(u=>{s.cancel(),r(u),n(u),l(u),u&&a(u);},[s,l,a]),p=react.useCallback(()=>d(""),[d]);return {text:t,keyword:o,setText:c,setKeyword:d,clearKeyword:p}}function qs({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:o,onHover:n,onEscape:i,source:l}){let{text:a,keyword:s,setText:c,setKeyword:d,clearKeyword:p}=Ys({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(Fs,{value:a,onValueChange:c,onClear:p,onEscape:i}),!s&&jsxRuntime.jsx(Ds,{onSelect:d}),jsxRuntime.jsx(Ks,{className:"flex-auto min-h-0",keyword:s,onSelect:t,getEventHref:r,LinkComponent:o,onHover:n,source:l})]})}var Nn="predict-search";function Gx({id:e=Nn}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(sp,{...t})})}function sp({params:e,isOpen:t,onOpenChange:r,onResult:o}){let{t:n}=i18n.useTranslation(),{isMobile:i}=ui.useScreen(),l=react.useCallback(s=>{o(s);},[o]),a=react.useCallback(()=>{r(false);},[r]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:i?"full":"lg",hideCloseButton:true,backdrop:"blur",radius:"lg",children:jsxRuntime.jsxs(ui.ModalContent,{className:"w-full h-full",children:[jsxRuntime.jsxs(ui.ModalHeader,{className:"sm:hidden flex items-center justify-between pt-4 pb-2",children:[jsxRuntime.jsx("span",{className:"text-base font-semibold",children:n("predict.search.title")}),jsxRuntime.jsx(ui.Button,{isIconOnly:true,onPress:()=>r(false),size:"sm",className:"bg-transparent min-w-6 w-6 h-6",children:jsxRuntime.jsx(ui.XCloseIcon,{width:20,height:20})})]}),jsxRuntime.jsx(ui.ModalBody,{className:"p-4",children:jsxRuntime.jsx(qs,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:l,onEscape:a})})]})})}function rv({onSelectEvent:e,modalParams:t,className:r}){let{t:o}=i18n.useTranslation(),{isDesktop:n,isMobile:i}=ui.useScreen(),{onOpen:l,onClose:a}=uiScaffold.useAsyncModal(Nn),s=hooks.useCallbackRef(e),c=hooks.useCallbackRef(async()=>{let p=await l({params:t});p&&s(p);}),d=hooks.useCallbackRef(()=>{a();});return react.useEffect(()=>{let p=u=>{let m=document.activeElement,f=!!m&&(m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.getAttribute("contenteditable")==="true");u.key==="/"&&!f&&(u.preventDefault(),c()),u.key==="Escape"&&(u.preventDefault(),d());};return window.addEventListener("keydown",p),()=>{window.removeEventListener("keydown",p);}},[c,d]),jsxRuntime.jsx(ui.Button,{size:"sm",radius:"full",isIconOnly:!n,onPress:c,variant:i?"flat":"bordered",startContent:n?jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"}):void 0,endContent:n?jsxRuntime.jsx(ui.Kbd,{className:"ml-auto min-w-6 justify-center text-xs bg-transparent border border-border rounded-full",children:"/"}):void 0,className:ui.cn(n&&"min-w-56 justify-start pl-3 pr-1.5 text-neutral",r),children:n?o("predict.search.placeholder"):jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"})})}var wn=[{value:"spread",labelKey:"predict.matches.sort.spread",descKey:"predict.matches.sort.spreadDesc",icon:"trending-up"},{value:"volume",labelKey:"predict.matches.sort.volume",descKey:"predict.matches.sort.volumeDesc",icon:"chart-column"},{value:"confidence",labelKey:"predict.matches.sort.confidence",descKey:"predict.matches.sort.confidenceDesc",icon:"flame"}],oa=[{labelKey:"predict.matches.filter.noMinimum",label:"$0",value:0},{labelKey:null,label:"$100+",value:100},{labelKey:null,label:"$500+",value:500},{labelKey:null,label:"$1K+",value:1e3},{labelKey:null,label:"$5K+",value:5e3},{labelKey:null,label:"$10K+",value:1e4},{labelKey:null,label:"$50K+",value:5e4},{labelKey:null,label:"$100K+",value:1e5}],ta={display:"inline-flex",alignItems:"center",gap:8,borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"8px 12px",fontSize:14,color:"#d4d4d8",cursor:"pointer",transition:"all 0.15s"},ra={position:"absolute",right:0,top:"100%",zIndex:20,marginTop:8,borderRadius:14,border:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"};function gp(e,t){if(!e)return "$5K+";let r=oa.find(o=>o.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function sa({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:o,minVolume:n,onMinVolumeChange:i,onRefresh:l}){let{t:a}=i18n.useTranslation(),[s,c]=react.useState(false),[d,p]=react.useState(false),[u,m]=react.useState(false),[f,g]=react.useState(false),h=react.useRef(null),x=react.useRef(null),C=wn.find(v=>v.value===e)??wn[0],b=react.useCallback(v=>{h.current&&!h.current.contains(v.target)&&c(false),x.current&&!x.current.contains(v.target)&&p(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)),[b]);let N=react.useCallback(()=>{l?.(),g(true),setTimeout(()=>g(false),700);},[l]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
|
|
22
22
|
@keyframes matchRefreshSpin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
|
|
23
23
|
.match-refresh-spin{animation:matchRefreshSpin .6s ease-in-out}
|
|
24
|
-
`}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:h,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",style:ta,onMouseEnter:v=>{v.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{c(v=>!v),
|
|
24
|
+
`}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:h,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",style:ta,onMouseEnter:v=>{v.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{c(v=>!v),p(false);},children:[jsxRuntime.jsx(hp,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:a(C.labelKey)}),jsxRuntime.jsx(na,{open:s})]}),s&&jsxRuntime.jsx("div",{style:{...ra,width:224,padding:4},children:wn.map(v=>{let H=e===v.value;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",gap:12,padding:"10px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",transition:"all 0.15s",background:H?"rgba(139,92,246,0.1)":"transparent",color:H?"#c4b5fd":"#a1a1aa",borderRadius:10},onMouseEnter:y=>{H||(y.currentTarget.style.background="rgba(39,39,42,0.5)",y.currentTarget.style.color="#fff");},onMouseLeave:y=>{H||(y.currentTarget.style.background="transparent",y.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===v.value?o(!r):t(v.value),c(false);},children:[jsxRuntime.jsx("div",{style:{color:H?"#a78bfa":"#71717a"},children:jsxRuntime.jsx(xp,{type:v.icon})}),jsxRuntime.jsxs("div",{style:{flex:1,textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:500},children:a(v.labelKey)}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#71717a",marginTop:1},children:a(v.descKey)})]}),H&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#a78bfa",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},v.value)})})]}),i&&jsxRuntime.jsxs("div",{ref:x,style:{position:"relative"},children:[jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",style:ta,onMouseEnter:v=>{v.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{p(v=>!v),c(false);},children:[jsxRuntime.jsx(vp,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:gp(n,a)}),jsxRuntime.jsx(bp,{onMouseEnter:()=>m(true),onMouseLeave:()=>m(false)}),jsxRuntime.jsx(na,{open:d})]}),u&&jsxRuntime.jsxs("div",{style:{position:"absolute",zIndex:100,top:"100%",marginTop:8,left:"50%",transform:"translateX(-50%)",width:256,padding:12,borderRadius:14,background:"rgba(24,24,27,1)",border:"1px solid rgba(63,63,70,0.5)",boxShadow:"0 25px 50px -12px rgba(0,0,0,0.5)",pointerEvents:"none"},children:[jsxRuntime.jsx("div",{style:{position:"absolute",top:-6,left:"50%",transform:"translateX(-50%) rotate(45deg)",width:12,height:12,background:"rgba(24,24,27,1)",borderLeft:"1px solid rgba(63,63,70,0.5)",borderTop:"1px solid rgba(63,63,70,0.5)"}}),jsxRuntime.jsxs("div",{style:{position:"relative",fontSize:12,color:"#d4d4d8",lineHeight:1.625},children:[jsxRuntime.jsxs("div",{style:{fontWeight:600,color:"#fff",display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a78bfa",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"})}),a("predict.matches.filter.liquidityFilter")]}),jsxRuntime.jsx("p",{style:{color:"#a1a1aa",margin:"0 0 4px"},children:a("predict.matches.filter.tooltipDesc")}),jsxRuntime.jsx("p",{style:{color:"#71717a",fontSize:11,margin:0},children:a("predict.matches.filter.tooltipNote")})]})]})]}),d&&jsxRuntime.jsxs("div",{style:{...ra,right:0,width:176},children:[jsxRuntime.jsx("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgba(39,39,42,1)"},children:jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:"#71717a",textTransform:"uppercase",letterSpacing:"0.05em"},children:a("predict.matches.filter.minVolumeEach")})}),jsxRuntime.jsx("div",{style:{padding:4},children:oa.map(v=>{let H=v.value===0?!n:n===v.value;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",justifyContent:"space-between",padding:"8px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",background:H?"rgba(139,92,246,0.1)":"transparent",color:H?"#c4b5fd":"#a1a1aa",borderRadius:10,transition:"all 0.15s"},onMouseEnter:y=>{H||(y.currentTarget.style.background="rgba(39,39,42,0.5)",y.currentTarget.style.color="#fff");},onMouseLeave:y=>{H||(y.currentTarget.style.background="transparent",y.currentTarget.style.color="#a1a1aa");},onClick:()=>{i?.(v.value===0?void 0:v.value),p(false);},children:[jsxRuntime.jsx("span",{children:v.labelKey?a(v.labelKey):v.label}),H&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#a78bfa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},v.value)})})]})]}),l&&jsxRuntime.jsx("button",{type:"button",style:{borderRadius:10,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",width:36,height:36,color:"#a1a1aa",cursor:"pointer",transition:"all 0.15s",display:"inline-flex",alignItems:"center",justifyContent:"center"},onMouseEnter:v=>{v.currentTarget.style.background="rgba(39,39,42,1)",v.currentTarget.style.color="#fff";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(39,39,42,0.6)",v.currentTarget.style.color="#a1a1aa";},onClick:N,children:jsxRuntime.jsxs("svg",{className:f?"match-refresh-spin":void 0,viewBox:"0 0 24 24",style:{width:16,height:16},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"}),jsxRuntime.jsx("path",{d:"M21 3v5h-5"}),jsxRuntime.jsx("path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"}),jsxRuntime.jsx("path",{d:"M8 16H3v5"})]})})]})]})}function hp(){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"m21 16-4 4-4-4"}),jsxRuntime.jsx("path",{d:"M17 20V4"}),jsxRuntime.jsx("path",{d:"m3 8 4-4 4 4"}),jsxRuntime.jsx("path",{d:"M7 4v16"})]})}function xp({type:e}){let t={width:16,height:16},r={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};return e==="trending-up"?jsxRuntime.jsxs("svg",{...r,style:t,children:[jsxRuntime.jsx("path",{d:"M16 7h6v6"}),jsxRuntime.jsx("path",{d:"m22 7-8.5 8.5-5-5L2 17"})]}):e==="chart-column"?jsxRuntime.jsxs("svg",{...r,style:t,children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}):jsxRuntime.jsx("svg",{...r,style:t,children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})})}function vp(){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#a1a1aa"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"})})}function bp({onMouseEnter:e,onMouseLeave:t}){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"hidden sm:block",style:{width:12,height:12,color:"#52525b",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",onMouseEnter:e,onMouseLeave:t,children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M12 16v-4"}),jsxRuntime.jsx("path",{d:"M12 8h.01"})]})}function na({open:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#71717a",transition:"transform 0.15s",transform:e?"rotate(180deg)":void 0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function Sp(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(0)}K`:`$${e.toFixed(0)}`}var Np=[{key:"activePairs",labelKey:"predict.matches.stats.activePairs",format:e=>e.toLocaleString(),valueColor:"#a684ff",gradientFrom:"rgba(142,81,255,0.2)",gradientTo:"rgba(142,81,255,0.05)",borderColor:"rgba(142,81,255,0.2)"},{key:"maxSpread",labelKey:"predict.matches.stats.maxSpread",format:e=>`${(e*100).toFixed(1)}%`,valueColor:"#ffb900",gradientFrom:"rgba(254,154,0,0.2)",gradientTo:"rgba(254,154,0,0.05)",borderColor:"rgba(254,154,0,0.2)"},{key:"highSpreadCount",labelKey:"predict.matches.stats.highSpreadCount",format:e=>e.toLocaleString(),valueColor:"#00d492",gradientFrom:"rgba(0,188,125,0.2)",gradientTo:"rgba(0,188,125,0.05)",borderColor:"rgba(0,188,125,0.2)"},{key:"totalVolume",labelKey:"predict.matches.stats.totalVolume",format:Sp,valueColor:"#00d3f3",gradientFrom:"rgba(0,184,219,0.2)",gradientTo:"rgba(0,184,219,0.05)",borderColor:"rgba(0,184,219,0.2)"}];function aa({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:"flex flex-col items-center text-center",style:{marginBottom:0},children:[jsxRuntime.jsx("style",{children:`
|
|
25
25
|
.matches-hero-title{font-size:30px!important}
|
|
26
26
|
@media(min-width:640px){.matches-hero-title{font-size:36px!important}}
|
|
27
27
|
@media(min-width:1024px){.matches-hero-title{font-size:48px!important}}
|
|
@@ -38,14 +38,14 @@
|
|
|
38
38
|
@keyframes match-live-ping{75%,100%{transform:scale(2.2);opacity:0}}
|
|
39
39
|
@keyframes match-live-breathe{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.85)}}
|
|
40
40
|
`}),jsxRuntime.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:24},children:jsxRuntime.jsxs("div",{className:"inline-flex items-center",style:{gap:8,borderRadius:9999,border:"1px solid rgba(63,63,70,0.5)",background:"rgba(39,39,42,0.6)",padding:"6px 12px",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)"},children:[jsxRuntime.jsxs("span",{style:{position:"relative",display:"flex",width:8,height:8},children:[jsxRuntime.jsx("span",{style:{position:"absolute",display:"inline-flex",width:"100%",height:"100%",borderRadius:9999,background:"#00d492",opacity:.75,animation:"match-live-ping 1.2s cubic-bezier(0,0,0.2,1) infinite"}}),jsxRuntime.jsx("span",{style:{position:"relative",display:"inline-flex",width:8,height:8,borderRadius:9999,background:"#00bc7d",animation:"match-live-breathe 2.4s ease-in-out infinite"}})]}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:500,color:"#d4d4d8",letterSpacing:"0.025em"},children:t("predict.matches.liveBadge")}),jsxRuntime.jsx("span",{style:{borderRadius:4,background:"rgba(142,81,255,0.2)",padding:"2px 6px",fontSize:10,fontWeight:600,color:"#c4b4ff",textTransform:"uppercase",border:"1px solid rgba(142,81,255,0.3)"},children:t("predict.matches.betaTag")})]})}),jsxRuntime.jsxs("div",{style:{textAlign:"center",marginBottom:32},children:[jsxRuntime.jsxs("h1",{className:"matches-hero-title",style:{fontFamily:"var(--font-dm-sans, 'DM Sans', sans-serif)",fontSize:48,fontWeight:700,letterSpacing:"-1.2px",lineHeight:"48px",color:"#fff",margin:"0 0 16px"},children:[jsxRuntime.jsxs("span",{style:{color:"#fff"},children:[t("predict.matches.titlePrefix")," "]}),jsxRuntime.jsx("span",{style:{backgroundImage:"linear-gradient(to right, #a684ff, #ed6aff, #00d3f3)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:t("predict.matches.titleHighlight")})]}),jsxRuntime.jsx("style",{children:".matches-hero-subtitle{font-size:14px}@media(min-width:640px){.matches-hero-subtitle{font-size:16px}}"}),jsxRuntime.jsx("p",{className:"matches-hero-subtitle",style:{lineHeight:1.625,color:"#71717a",maxWidth:576,margin:"0 auto",textAlign:"center"},children:String(t("predict.matches.heroSubtitle")).split(`
|
|
41
|
-
`).map((r,o)=>jsxRuntime.jsxs("span",{children:[o>0&&jsxRuntime.jsx("br",{className:"hidden sm:block"}),r,o===0?" ":""]},o))})]}),jsxRuntime.jsx("div",{className:"matches-hero-stats",style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:12,width:"100%",maxWidth:672,...e?{animation:"matchStatsEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both"}:{}},children:Np.map((r,o)=>jsxRuntime.jsxs("div",{className:"matches-stat-card",style:{borderRadius:14,border:`1px solid ${e?r.borderColor:"rgba(255,255,255,0.06)"}`,background:e?`linear-gradient(to bottom, ${r.gradientFrom}, ${r.gradientTo})`:"rgba(255,255,255,0.02)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",...e?{animation:"matchStatCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:`${o*60}ms`}:{}},children:[jsxRuntime.jsx("div",{className:"matches-stat-val",style:{fontWeight:700,color:e?r.valueColor:"transparent",display:"flex",alignItems:"center"},children:e?r.format(e[r.key]):jsxRuntime.jsx("div",{style:{height:14,width:60,borderRadius:4,background:"rgba(255,255,255,0.06)"}})}),jsxRuntime.jsx("div",{className:"matches-stat-label",style:{fontWeight:500,color:e?"#71717a":"transparent",display:"flex",alignItems:"center"},children:e?t(r.labelKey):jsxRuntime.jsx("div",{style:{height:8,width:80,borderRadius:4,background:"rgba(255,255,255,0.04)"}})})]},r.key))})]})}var Mp={kalshi:{label:"KALSHI",color:"#00d492",bgColor:"rgba(0, 212, 146, 0.12)",icon:jsxRuntime.jsx(ui.KalshiIcon,{className:"w-3.5 h-3.5 shrink-0"})},polymarket:{label:"POLYMARKET",color:"#50a2ff",bgColor:"rgba(43, 127, 255, 0.12)",icon:jsxRuntime.jsx(ui.PolymarketIcon,{className:"w-3.5 h-3.5 shrink-0"})},dflow:{label:"DFLOW",color:"rgb(16, 185, 129)",bgColor:"rgba(16, 185, 129, 0.12)",icon:null}},Ep={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function ft(e){return Mp[e]??Ep}function wv({source:e,className:t}){let r=ft(e);return jsxRuntime.jsxs("span",{className:ui.cn("inline-flex items-center gap-x-1 rounded-md px-1.5 py-0.5 text-xs font-medium",t),style:{backgroundColor:r.bgColor,color:r.color},children:[r.icon,r.label]})}function Cn(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function Mn(e){let t=e.outcomes?.[0];return t?.best_ask??t?.price??null}function Lp(e){return e.outcomes?.[0]?.label||null}var _p={polymarket:{text:"#50a2ff",border:"rgba(43,127,255,0.15)",hoverBorder:"rgba(43,127,255,0.3)",bg:"rgba(43,127,255,0.05)",priceColor:"rgba(244,244,245,1)"},kalshi:{text:"#00d492",border:"rgba(0,212,146,0.15)",hoverBorder:"rgba(0,212,146,0.3)",bg:"rgba(0,212,146,0.05)",priceColor:"#00d492"}},Rp={text:"#9ca3af",border:"rgba(156,163,175,0.15)",hoverBorder:"rgba(156,163,175,0.3)",bg:"rgba(156,163,175,0.05)",priceColor:"rgba(244,244,245,1)"};function Ip(e){return _p[e]??Rp}function da({match:e,onSelect:t,getMarketHref:r,LinkComponent:o}){let{t:n}=i18n.useTranslation(),i=Mn(e.market_a),l=Mn(e.market_b),s=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,a=s!=null&&s>=3,c=i!=null&&l!=null?i<=l?e.source_a:e.source_b:null,u=c?ft(c):null,d=a?"amber":"violet",p=e.event_a_title||e.event_b_title;return jsxRuntime.jsxs("div",{className:"group",style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",position:"relative"},onMouseEnter:m=>{let f=m.currentTarget;f.style.borderColor="rgba(63,63,70,0.6)",f.style.boxShadow="0 10px 15px -3px rgba(0,0,0,0.2)";},onMouseLeave:m=>{let f=m.currentTarget;f.style.borderColor="rgba(39,39,42,0.6)",f.style.boxShadow="none";},children:[s!=null&&jsxRuntime.jsxs("span",{style:{position:"absolute",top:12,right:12,zIndex:10,display:"inline-flex",alignItems:"center",gap:4,borderRadius:10,padding:"4px 10px",fontSize:12,fontWeight:600,border:`1px solid ${a?"rgba(255,185,0,0.3)":s>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:a?"rgba(255,185,0,0.15)":s>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:a?"#ffb900":s>=2?"#a684ff":"#9ca3af"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),s.toFixed(1),"%"]}),jsxRuntime.jsxs("div",{style:{padding:16},children:[jsxRuntime.jsx("h3",{style:{fontSize:14,fontWeight:600,lineHeight:1.375,letterSpacing:"-0.28px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",paddingRight:80,margin:"0 0 16px"},children:p}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[jsxRuntime.jsx(la,{source:e.source_a,market:e.market_a,isCheaper:c===e.source_a,onClick:()=>t?.(e,e.source_a),href:r?.(e,e.source_a),LinkComponent:o}),jsxRuntime.jsx(la,{source:e.source_b,market:e.market_b,isCheaper:c===e.source_b,onClick:()=>t?.(e,e.source_b),href:r?.(e,e.source_b),LinkComponent:o})]}),c&&u&&s!=null&&jsxRuntime.jsxs("div",{style:{marginTop:12,padding:"8px 12px",borderRadius:10,display:"flex",alignItems:"center",gap:8,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${d==="amber"?"rgba(255,185,0,0.15)":"rgba(166,132,255,0.15)"}`,background:d==="amber"?"rgba(255,185,0,0.05)":"rgba(166,132,255,0.05)"},onClick:()=>t?.(e,c),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:d==="amber"?"#ffb900":"#a684ff"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:d==="amber"?"rgba(255,185,0,0.9)":"rgba(166,132,255,0.9)"},children:n("predict.matches.buyEdge",{platform:c.charAt(0).toUpperCase()+c.slice(1),spread:s.toFixed(1)})}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,marginLeft:"auto",color:d==="amber"?"rgba(255,185,0,0.5)":"rgba(166,132,255,0.5)"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M5 12h14"}),jsxRuntime.jsx("path",{d:"m12 5 7 7-7 7"})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.2)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),Cn(e.combined_volume)]}),e.combined_volume_24h!=null&&e.combined_volume_24h>0&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})}),Cn(e.combined_volume_24h)," ",n("predict.matches.vol24h")]})]}),e.similarity_score!=null&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,fontSize:10,color:"#52525b"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"})}),Math.round(e.similarity_score*100),"%"," ",n("predict.matches.match")]})]})]})}function la({source:e,market:t,isCheaper:r,onClick:o,href:n,LinkComponent:i}){let{t:l}=i18n.useTranslation(),s=ft(e),a=Ip(e),c=Mn(t),u=Lp(t),d=t.volume,p=jsxRuntime.jsxs("div",{style:{borderRadius:14,border:`1px solid ${a.border}`,background:a.bg,padding:12,cursor:n||o?"pointer":void 0,transition:"border-color 0.15s"},onMouseEnter:m=>{m.currentTarget.style.borderColor=a.hoverBorder;},onMouseLeave:m=>{m.currentTarget.style.borderColor=a.border;},onClick:o,children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[s.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.05em",color:a.text,textTransform:"uppercase"},children:s.label}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",marginLeft:"auto"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})]}),u&&jsxRuntime.jsx("div",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:u}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[jsxRuntime.jsx("span",{style:{fontSize:20,fontWeight:700,fontVariantNumeric:"tabular-nums",color:a.priceColor},children:c!=null?(c*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a"},children:l("predict.matches.centsYes")})]}),jsxRuntime.jsxs("div",{style:{fontSize:10,color:"#52525b",marginTop:6},children:[Cn(d)," ",l("predict.matches.volume")]})]});return n&&i?jsxRuntime.jsx(i,{href:n,className:"block",children:p}):p}var pa=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:o,onSelect:n,getMarketHref:i,LinkComponent:l,onStatsChange:s},a){let{t:c}=i18n.useTranslation(),u=react.useRef(null),{data:d,hasNextPage:p,fetchNextPage:m,isFetchingNextPage:f,isLoading:g,isPlaceholderData:h,refetch:x}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:o,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[P,y]=react.useState(0),[N,v]=react.useState(false);N&&!h?(v(false),y(z=>z+1)):h&&!N&&v(true);let H=react.useMemo(()=>{let z=d?.pages;return !z||z.length<=1?0:z.slice(0,-1).reduce((A,$)=>A+($.items?.length??0),0)},[d?.pages]);react.useImperativeHandle(a,()=>({refetch:()=>{x();}}),[x]);let b=react.useMemo(()=>d?.pages.flatMap(z=>z.items??[])??[],[d]),q=d?.pages[0]?.total,V=react.useMemo(()=>{let z=0,A=0,$=0;for(let F of b){let se=F.spread??0;se>z&&(z=se),se>=.03&&$++,F.combined_volume!=null&&(A+=F.combined_volume);}return {activePairs:q??b.length,maxSpread:z,highSpreadCount:$,totalVolume:A}},[b,q]);react.useEffect(()=>{V.activePairs>0&&s?.(V);},[V,s]);let le=react.useCallback(()=>{p&&!f&&m();},[p,f,m]);return g?jsxRuntime.jsx(zp,{}):b.length===0?jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"80px 0",color:"rgba(255,255,255,0.35)"},children:jsxRuntime.jsx("p",{style:{fontSize:18},children:c("predict.matches.empty")})}):jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
|
|
41
|
+
`).map((r,o)=>jsxRuntime.jsxs("span",{children:[o>0&&jsxRuntime.jsx("br",{className:"hidden sm:block"}),r,o===0?" ":""]},o))})]}),jsxRuntime.jsx("div",{className:"matches-hero-stats",style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:12,width:"100%",maxWidth:672,...e?{animation:"matchStatsEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both"}:{}},children:Np.map((r,o)=>jsxRuntime.jsxs("div",{className:"matches-stat-card",style:{borderRadius:14,border:`1px solid ${e?r.borderColor:"rgba(255,255,255,0.06)"}`,background:e?`linear-gradient(to bottom, ${r.gradientFrom}, ${r.gradientTo})`:"rgba(255,255,255,0.02)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",...e?{animation:"matchStatCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:`${o*60}ms`}:{}},children:[jsxRuntime.jsx("div",{className:"matches-stat-val",style:{fontWeight:700,color:e?r.valueColor:"transparent",display:"flex",alignItems:"center"},children:e?r.format(e[r.key]):jsxRuntime.jsx("div",{style:{height:14,width:60,borderRadius:4,background:"rgba(255,255,255,0.06)"}})}),jsxRuntime.jsx("div",{className:"matches-stat-label",style:{fontWeight:500,color:e?"#71717a":"transparent",display:"flex",alignItems:"center"},children:e?t(r.labelKey):jsxRuntime.jsx("div",{style:{height:8,width:80,borderRadius:4,background:"rgba(255,255,255,0.04)"}})})]},r.key))})]})}var Mp={kalshi:{label:"KALSHI",color:"#00d492",bgColor:"rgba(0, 212, 146, 0.12)",icon:jsxRuntime.jsx(ui.KalshiIcon,{className:"w-3.5 h-3.5 shrink-0"})},polymarket:{label:"POLYMARKET",color:"#50a2ff",bgColor:"rgba(43, 127, 255, 0.12)",icon:jsxRuntime.jsx(ui.PolymarketIcon,{className:"w-3.5 h-3.5 shrink-0"})},dflow:{label:"DFLOW",color:"rgb(16, 185, 129)",bgColor:"rgba(16, 185, 129, 0.12)",icon:null}},Ep={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function ft(e){return Mp[e]??Ep}function wv({source:e,className:t}){let r=ft(e);return jsxRuntime.jsxs("span",{className:ui.cn("inline-flex items-center gap-x-1 rounded-md px-1.5 py-0.5 text-xs font-medium",t),style:{backgroundColor:r.bgColor,color:r.color},children:[r.icon,r.label]})}function Cn(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}function Mn(e){let t=e.outcomes?.[0];return t?.best_ask??t?.price??null}function Lp(e){return e.outcomes?.[0]?.label||null}var _p={polymarket:{text:"#50a2ff",border:"rgba(43,127,255,0.15)",hoverBorder:"rgba(43,127,255,0.3)",bg:"rgba(43,127,255,0.05)",priceColor:"rgba(244,244,245,1)"},kalshi:{text:"#00d492",border:"rgba(0,212,146,0.15)",hoverBorder:"rgba(0,212,146,0.3)",bg:"rgba(0,212,146,0.05)",priceColor:"#00d492"}},Rp={text:"#9ca3af",border:"rgba(156,163,175,0.15)",hoverBorder:"rgba(156,163,175,0.3)",bg:"rgba(156,163,175,0.05)",priceColor:"rgba(244,244,245,1)"};function Ip(e){return _p[e]??Rp}function da({match:e,onSelect:t,onHover:r,getMarketHref:o,LinkComponent:n}){let{t:i}=i18n.useTranslation(),l=Mn(e.market_a),a=Mn(e.market_b),s=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,c=s!=null&&s>=3,d=l!=null&&a!=null?l<=a?e.source_a:e.source_b:null,p=d?ft(d):null,u=c?"amber":"violet",m=e.event_a_title||e.event_b_title;return jsxRuntime.jsxs("div",{className:"group",style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",position:"relative"},onMouseEnter:f=>{let g=f.currentTarget;g.style.borderColor="rgba(63,63,70,0.6)",g.style.boxShadow="0 10px 15px -3px rgba(0,0,0,0.2)",r?.(e);},onMouseLeave:f=>{let g=f.currentTarget;g.style.borderColor="rgba(39,39,42,0.6)",g.style.boxShadow="none";},children:[s!=null&&jsxRuntime.jsxs("span",{style:{position:"absolute",top:12,right:12,zIndex:10,display:"inline-flex",alignItems:"center",gap:4,borderRadius:10,padding:"4px 10px",fontSize:12,fontWeight:600,border:`1px solid ${c?"rgba(255,185,0,0.3)":s>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:c?"rgba(255,185,0,0.15)":s>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:c?"#ffb900":s>=2?"#a684ff":"#9ca3af"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),s.toFixed(1),"%"]}),jsxRuntime.jsxs("div",{style:{padding:16},children:[jsxRuntime.jsx("h3",{style:{fontSize:14,fontWeight:600,lineHeight:1.375,letterSpacing:"-0.28px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",paddingRight:80,margin:"0 0 16px"},children:m}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[jsxRuntime.jsx(la,{source:e.source_a,market:e.market_a,isCheaper:d===e.source_a,onClick:()=>t?.(e,e.source_a),href:o?.(e,e.source_a),LinkComponent:n}),jsxRuntime.jsx(la,{source:e.source_b,market:e.market_b,isCheaper:d===e.source_b,onClick:()=>t?.(e,e.source_b),href:o?.(e,e.source_b),LinkComponent:n})]}),d&&p&&s!=null&&jsxRuntime.jsxs("div",{style:{marginTop:12,padding:"8px 12px",borderRadius:10,display:"flex",alignItems:"center",gap:8,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${u==="amber"?"rgba(255,185,0,0.15)":"rgba(166,132,255,0.15)"}`,background:u==="amber"?"rgba(255,185,0,0.05)":"rgba(166,132,255,0.05)"},onClick:()=>t?.(e,d),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:u==="amber"?"#ffb900":"#a684ff"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:u==="amber"?"rgba(255,185,0,0.9)":"rgba(166,132,255,0.9)"},children:i("predict.matches.buyEdge",{platform:d.charAt(0).toUpperCase()+d.slice(1),spread:s.toFixed(1)})}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,marginLeft:"auto",color:u==="amber"?"rgba(255,185,0,0.5)":"rgba(166,132,255,0.5)"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M5 12h14"}),jsxRuntime.jsx("path",{d:"m12 5 7 7-7 7"})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.2)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),Cn(e.combined_volume)]}),e.combined_volume_24h!=null&&e.combined_volume_24h>0&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})}),Cn(e.combined_volume_24h)," ",i("predict.matches.vol24h")]})]}),e.similarity_score!=null&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,fontSize:10,color:"#52525b"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"})}),Math.round(e.similarity_score*100),"%"," ",i("predict.matches.match")]})]})]})}function la({source:e,market:t,isCheaper:r,onClick:o,href:n,LinkComponent:i}){let{t:l}=i18n.useTranslation(),a=ft(e),s=Ip(e),c=Mn(t),d=Lp(t),p=t.volume,u=jsxRuntime.jsxs("div",{style:{borderRadius:14,border:`1px solid ${s.border}`,background:s.bg,padding:12,cursor:n||o?"pointer":void 0,transition:"border-color 0.15s"},onMouseEnter:m=>{m.currentTarget.style.borderColor=s.hoverBorder;},onMouseLeave:m=>{m.currentTarget.style.borderColor=s.border;},onClick:o,children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[a.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.05em",color:s.text,textTransform:"uppercase"},children:a.label}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",marginLeft:"auto"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})]}),d&&jsxRuntime.jsx("div",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:d}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[jsxRuntime.jsx("span",{style:{fontSize:20,fontWeight:700,fontVariantNumeric:"tabular-nums",color:s.priceColor},children:c!=null?(c*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a"},children:l("predict.matches.centsYes")})]}),jsxRuntime.jsxs("div",{style:{fontSize:10,color:"#52525b",marginTop:6},children:[Cn(p)," ",l("predict.matches.volume")]})]});return n&&i?jsxRuntime.jsx(i,{href:n,className:"block",children:u}):u}var pa=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:o,onSelect:n,onHover:i,getMarketHref:l,LinkComponent:a,onStatsChange:s},c){let{t:d}=i18n.useTranslation(),p=react.useRef(null),{data:u,hasNextPage:m,fetchNextPage:f,isFetchingNextPage:g,isLoading:h,isPlaceholderData:x,refetch:C}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:o,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[b,N]=react.useState(0),[v,H]=react.useState(false);v&&!x?(H(false),N(w=>w+1)):x&&!v&&H(true);let y=react.useMemo(()=>{let w=u?.pages;return !w||w.length<=1?0:w.slice(0,-1).reduce((F,B)=>F+(B.items?.length??0),0)},[u?.pages]);react.useImperativeHandle(c,()=>({refetch:()=>{C();}}),[C]);let G=react.useMemo(()=>u?.pages.flatMap(w=>w.items??[])??[],[u]),K=u?.pages[0]?.total,oe=react.useMemo(()=>{let w=0,F=0,B=0;for(let se of G){let ae=se.spread??0;ae>w&&(w=ae),ae>=.03&&B++,se.combined_volume!=null&&(F+=se.combined_volume);}return {activePairs:K??G.length,maxSpread:w,highSpreadCount:B,totalVolume:F}},[G,K]);react.useEffect(()=>{oe.activePairs>0&&s?.(oe);},[oe,s]);let we=react.useCallback(()=>{m&&!g&&f();},[m,g,f]);return h?jsxRuntime.jsx(zp,{}):G.length===0?jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"80px 0",color:"rgba(255,255,255,0.35)"},children:jsxRuntime.jsx("p",{style:{fontSize:18},children:d("predict.matches.empty")})}):jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
|
|
42
42
|
@media(max-width:1023px){.matches-card-grid{grid-template-columns:1fr!important}}
|
|
43
43
|
@keyframes matchCardEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
|
|
44
|
-
`}),jsxRuntime.jsx("div",{className:"matches-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16},children:b.map((z,A)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${Math.max(0,A-H)*35}ms both`},children:jsxRuntime.jsx(da,{match:z,onSelect:n,getMarketHref:i,LinkComponent:l})},`${P}-${z.match_id}-${z.source_a}-${z.market_a?.slug??A}`))}),p&&jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0"},children:[jsxRuntime.jsxs("button",{ref:u,disabled:f,onClick:le,style:{display:"flex",alignItems:"center",gap:8,padding:"12px 24px",background:"rgba(39,39,42,0.6)",border:"1px solid rgba(63,63,70,0.5)",borderRadius:14,color:"#d4d4d8",fontSize:16,fontWeight:500,cursor:f?"wait":"pointer",opacity:f?.5:1,transition:"background 0.15s, color 0.15s, opacity 0.15s"},onMouseEnter:z=>{f||(z.currentTarget.style.background="rgba(39,39,42,0.9)",z.currentTarget.style.color="#fff");},onMouseLeave:z=>{z.currentTarget.style.background="rgba(39,39,42,0.6)",z.currentTarget.style.color="#d4d4d8";},children:[f?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"match-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}):jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})}),c("predict.matches.loadMore")]}),jsxRuntime.jsx("style",{children:"@keyframes match-load-spin{to{transform:rotate(360deg)}}"}),q!=null&&jsxRuntime.jsx("span",{style:{fontSize:12,color:"rgba(255,255,255,0.35)"},children:c("predict.matches.showing",{current:b.length,total:q})})]})]})});function zp(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:"@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}@media(max-width:1023px){.matches-skeleton-grid{grid-template-columns:1fr!important}}"}),jsxRuntime.jsx("div",{className:"matches-skeleton-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(Up,{index:t},t))})]})}function Up({index:e}){let r={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.8s ease-in-out infinite ${e*150}ms`,borderRadius:6};return jsxRuntime.jsxs("div",{style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:"16px 16px 12px"},children:[jsxRuntime.jsx("div",{style:{...r,height:14,width:e%2===0?"75%":"60%"}}),jsxRuntime.jsx("div",{style:{...r,height:24,width:64,borderRadius:10,flexShrink:0,marginLeft:12}})]}),jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,padding:"0 16px"},children:[0,1].map(o=>jsxRuntime.jsxs("div",{style:{borderRadius:12,border:"1px solid rgba(255,255,255,0.04)",background:"rgba(255,255,255,0.02)",padding:12,display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:72}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:48}}),jsxRuntime.jsx("div",{style:{...r,height:20,width:56}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:60,marginTop:4}})]},o))}),jsxRuntime.jsx("div",{style:{padding:"12px 16px"},children:jsxRuntime.jsx("div",{style:{...r,height:36,borderRadius:10,width:"100%"}})}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",gap:12},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:40}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:50}})]}),jsxRuntime.jsx("div",{style:{...r,height:10,width:56}})]})]})}var Gp={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function Yp(){let[e,t]=react.useState("");return react.useEffect(()=>{let r=()=>{let n=new Date;return `${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`};t(r());let o=setInterval(()=>t(r()),1e4);return ()=>clearInterval(o)},[]),jsxRuntime.jsx("span",{children:e})}function qp({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:"@media(max-width:768px){.matches-status-bar{display:none!important}}"}),jsxRuntime.jsxs("div",{className:"matches-status-bar",style:{position:"fixed",bottom:0,left:0,right:0,height:28,display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 12px",background:"rgba(12,12,13,0.8)",borderTop:"1px solid rgba(39,39,42,0.6)",fontSize:11,color:"rgba(255,255,255,0.4)",zIndex:50,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",flexShrink:0},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,color:"#00bc7d"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12 20h.01"}),jsxRuntime.jsx("path",{d:"M2 8.82a15 15 0 0 1 20 0"}),jsxRuntime.jsx("path",{d:"M5 12.859a10 10 0 0 1 14 0"}),jsxRuntime.jsx("path",{d:"M8.5 16.429a5 5 0 0 1 7 0"})]}),jsxRuntime.jsx("span",{style:{color:"#00bc7d",fontWeight:500},children:t("predict.matches.status.live")})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)"}}),e&&jsxRuntime.jsxs("div",{className:"hidden sm:flex",style:{alignItems:"center",gap:12},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"})}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:t("predict.matches.status.markets")}),jsxRuntime.jsx("span",{style:{color:"#d4d4d8",fontWeight:500,fontVariantNumeric:"tabular-nums"},children:e.activePairs.toLocaleString()})]}),jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:t("predict.matches.status.vol24h")}),jsxRuntime.jsx("span",{style:{color:"#d4d4d8",fontWeight:500,fontVariantNumeric:"tabular-nums"},children:e.totalVolume>=1e6?`$${(e.totalVolume/1e6).toFixed(1)}M`:e.totalVolume>=1e3?`$${Math.round(e.totalVolume/1e3)}K`:`$${e.totalVolume}`})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("a",{href:"#",target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",textDecoration:"none",transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),jsxRuntime.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),jsxRuntime.jsx("path",{d:"M10 9H8"}),jsxRuntime.jsx("path",{d:"M16 13H8"}),jsxRuntime.jsx("path",{d:"M16 17H8"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.docs")})]}),jsxRuntime.jsxs("a",{href:"#",target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",textDecoration:"none",transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"currentColor",children:jsxRuntime.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:"X"})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)",margin:"0 4px"}}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.watchlist")})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2.5"}),jsxRuntime.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.portfolio")})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),jsxRuntime.jsx("path",{d:"M12 17h.01"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.help")})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)",margin:"0 4px"}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx(Yp,{})]})]})]})]})}function Kv({onSelect:e,getMarketHref:t,LinkComponent:r,bgImageSrc:o}){let{t:n}=i18n.useTranslation(),[i,l]=react.useState("spread"),[s,a]=react.useState(false),[c,u]=react.useState(5e3),[d,p]=react.useState(),m=react.useRef(null),f=react.useCallback(P=>{l(P);},[]),g=react.useCallback(P=>{a(P);},[]),h=react.useCallback(P=>{p(P);},[]),x=react.useCallback(()=>{m.current?.refetch();},[]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative"},children:[o&&jsxRuntime.jsx("img",{src:o,alt:"","aria-hidden":"true",style:{position:"fixed",inset:0,width:"100%",height:"100%",objectFit:"cover",objectPosition:"bottom",opacity:.25,pointerEvents:"none",zIndex:0}}),jsxRuntime.jsx("style",{children:`
|
|
44
|
+
`}),jsxRuntime.jsx("div",{className:"matches-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16},children:G.map((w,F)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${Math.max(0,F-y)*35}ms both`},children:jsxRuntime.jsx(da,{match:w,onSelect:n,onHover:i,getMarketHref:l,LinkComponent:a})},`${b}-${w.match_id}-${w.source_a}-${w.market_a?.slug??F}`))}),m&&jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0"},children:[jsxRuntime.jsxs("button",{ref:p,disabled:g,onClick:we,style:{display:"flex",alignItems:"center",gap:8,padding:"12px 24px",background:"rgba(39,39,42,0.6)",border:"1px solid rgba(63,63,70,0.5)",borderRadius:14,color:"#d4d4d8",fontSize:16,fontWeight:500,cursor:g?"wait":"pointer",opacity:g?.5:1,transition:"background 0.15s, color 0.15s, opacity 0.15s"},onMouseEnter:w=>{g||(w.currentTarget.style.background="rgba(39,39,42,0.9)",w.currentTarget.style.color="#fff");},onMouseLeave:w=>{w.currentTarget.style.background="rgba(39,39,42,0.6)",w.currentTarget.style.color="#d4d4d8";},children:[g?jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"match-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}):jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})}),d("predict.matches.loadMore")]}),jsxRuntime.jsx("style",{children:"@keyframes match-load-spin{to{transform:rotate(360deg)}}"}),K!=null&&jsxRuntime.jsx("span",{style:{fontSize:12,color:"rgba(255,255,255,0.35)"},children:d("predict.matches.showing",{current:G.length,total:K})})]})]})});function zp(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:"@keyframes shimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}@media(max-width:1023px){.matches-skeleton-grid{grid-template-columns:1fr!important}}"}),jsxRuntime.jsx("div",{className:"matches-skeleton-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:16},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(Up,{index:t},t))})]})}function Up({index:e}){let r={background:"linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0.03) 75%)",backgroundSize:"200% 100%",animation:`shimmer 1.8s ease-in-out infinite ${e*150}ms`,borderRadius:6};return jsxRuntime.jsxs("div",{style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",justifyContent:"space-between",padding:"16px 16px 12px"},children:[jsxRuntime.jsx("div",{style:{...r,height:14,width:e%2===0?"75%":"60%"}}),jsxRuntime.jsx("div",{style:{...r,height:24,width:64,borderRadius:10,flexShrink:0,marginLeft:12}})]}),jsxRuntime.jsx("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:16,padding:"0 16px"},children:[0,1].map(o=>jsxRuntime.jsxs("div",{style:{borderRadius:12,border:"1px solid rgba(255,255,255,0.04)",background:"rgba(255,255,255,0.02)",padding:12,display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:72}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:48}}),jsxRuntime.jsx("div",{style:{...r,height:20,width:56}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:60,marginTop:4}})]},o))}),jsxRuntime.jsx("div",{style:{padding:"12px 16px"},children:jsxRuntime.jsx("div",{style:{...r,height:36,borderRadius:10,width:"100%"}})}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",gap:12},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:40}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:50}})]}),jsxRuntime.jsx("div",{style:{...r,height:10,width:56}})]})]})}var Gp={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function Yp(){let[e,t]=react.useState("");return react.useEffect(()=>{let r=()=>{let n=new Date;return `${String(n.getHours()).padStart(2,"0")}:${String(n.getMinutes()).padStart(2,"0")}`};t(r());let o=setInterval(()=>t(r()),1e4);return ()=>clearInterval(o)},[]),jsxRuntime.jsx("span",{children:e})}function qp({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:"@media(max-width:768px){.matches-status-bar{display:none!important}}"}),jsxRuntime.jsxs("div",{className:"matches-status-bar",style:{position:"fixed",bottom:0,left:0,right:0,height:28,display:"flex",alignItems:"center",justifyContent:"space-between",padding:"0 12px",background:"rgba(12,12,13,0.8)",borderTop:"1px solid rgba(39,39,42,0.6)",fontSize:11,color:"rgba(255,255,255,0.4)",zIndex:50,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",flexShrink:0},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,color:"#00bc7d"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12 20h.01"}),jsxRuntime.jsx("path",{d:"M2 8.82a15 15 0 0 1 20 0"}),jsxRuntime.jsx("path",{d:"M5 12.859a10 10 0 0 1 14 0"}),jsxRuntime.jsx("path",{d:"M8.5 16.429a5 5 0 0 1 7 0"})]}),jsxRuntime.jsx("span",{style:{color:"#00bc7d",fontWeight:500},children:t("predict.matches.status.live")})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)"}}),e&&jsxRuntime.jsxs("div",{className:"hidden sm:flex",style:{alignItems:"center",gap:12},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"})}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:t("predict.matches.status.markets")}),jsxRuntime.jsx("span",{style:{color:"#d4d4d8",fontWeight:500,fontVariantNumeric:"tabular-nums"},children:e.activePairs.toLocaleString()})]}),jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:t("predict.matches.status.vol24h")}),jsxRuntime.jsx("span",{style:{color:"#d4d4d8",fontWeight:500,fontVariantNumeric:"tabular-nums"},children:e.totalVolume>=1e6?`$${(e.totalVolume/1e6).toFixed(1)}M`:e.totalVolume>=1e3?`$${Math.round(e.totalVolume/1e3)}K`:`$${e.totalVolume}`})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("a",{href:"#",target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",textDecoration:"none",transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}),jsxRuntime.jsx("path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}),jsxRuntime.jsx("path",{d:"M10 9H8"}),jsxRuntime.jsx("path",{d:"M16 13H8"}),jsxRuntime.jsx("path",{d:"M16 17H8"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.docs")})]}),jsxRuntime.jsxs("a",{href:"#",target:"_blank",rel:"noopener noreferrer",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",textDecoration:"none",transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"currentColor",children:jsxRuntime.jsx("path",{d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:"X"})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)",margin:"0 4px"}}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.watchlist")})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2.5"}),jsxRuntime.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.portfolio")})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",borderRadius:4,color:"#71717a",background:"transparent",border:"none",cursor:"pointer",fontSize:11,transition:"color 0.15s, background 0.15s"},onMouseEnter:r=>{r.currentTarget.style.color="#d4d4d8",r.currentTarget.style.background="rgba(39,39,42,0.5)";},onMouseLeave:r=>{r.currentTarget.style.color="#71717a",r.currentTarget.style.background="transparent";},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),jsxRuntime.jsx("path",{d:"M12 17h.01"})]}),jsxRuntime.jsx("span",{className:"hidden lg:inline",children:t("predict.matches.status.help")})]}),jsxRuntime.jsx("div",{style:{width:1,height:14,background:"rgba(39,39,42,0.8)",margin:"0 4px"}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,color:"#71717a"},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10"}),jsxRuntime.jsx("polyline",{points:"12 6 12 12 16 14"})]}),jsxRuntime.jsx(Yp,{})]})]})]})]})}function Kv({onSelect:e,onHover:t,getMarketHref:r,LinkComponent:o,bgImageSrc:n}){let{t:i}=i18n.useTranslation(),[l,a]=react.useState("spread"),[s,c]=react.useState(false),[d,p]=react.useState(5e3),[u,m]=react.useState(),f=react.useRef(null),g=react.useCallback(b=>{a(b);},[]),h=react.useCallback(b=>{c(b);},[]),x=react.useCallback(b=>{m(b);},[]),C=react.useCallback(()=>{f.current?.refetch();},[]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative"},children:[n&&jsxRuntime.jsx("img",{src:n,alt:"","aria-hidden":"true",style:{position:"fixed",inset:0,width:"100%",height:"100%",objectFit:"cover",objectPosition:"bottom",opacity:.25,pointerEvents:"none",zIndex:0}}),jsxRuntime.jsx("style",{children:`
|
|
45
45
|
@keyframes matchFadeIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
|
|
46
46
|
.match-fade-in{animation:matchFadeIn .5s ease-out both}
|
|
47
47
|
.match-fade-in-d1{animation:matchFadeIn .5s ease-out .1s both}
|
|
48
48
|
.match-fade-in-d2{animation:matchFadeIn .5s ease-out .2s both}
|
|
49
|
-
`}),jsxRuntime.jsxs("div",{style:{position:"relative",overflow:"hidden",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[jsxRuntime.jsx("div",{style:{position:"absolute",inset:0,background:"linear-gradient(to bottom right, rgba(46,16,101,0.2), transparent 50%, rgba(8,51,68,0.1))"}}),jsxRuntime.jsx("div",{style:{position:"absolute",inset:0,opacity:.03,backgroundImage:"radial-gradient(circle at 1px 1px, rgb(255 255 255) 1px, transparent 0)",backgroundSize:"24px 24px"}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:"25%",width:384,height:384,background:"rgba(139,92,246,0.05)",borderRadius:9999,filter:"blur(96px)"}}),jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,right:"25%",width:384,height:384,background:"rgba(6,182,212,0.05)",borderRadius:9999,filter:"blur(96px)"}})]}),jsxRuntime.jsx("style",{children:".matches-hero-wrap{padding:48px 16px 40px}@media(min-width:640px){.matches-hero-wrap{padding:64px 24px 56px}}@media(min-width:1024px){.matches-hero-wrap{padding:64px 32px 56px}}"}),jsxRuntime.jsx("div",{className:"match-fade-in matches-hero-wrap",style:{position:"relative",maxWidth:1152,margin:"0 auto"},children:jsxRuntime.jsx(aa,{stats:d})})]}),jsxRuntime.jsxs("div",{style:{position:"sticky",top:0,zIndex:40,background:"rgba(10,10,11,0.8)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("style",{children:".matches-toolbar-inner{padding:12px 16px}@media(min-width:640px){.matches-toolbar-inner{padding:12px 24px}}@media(min-width:1024px){.matches-toolbar-inner{padding:12px 32px}}"}),jsxRuntime.jsxs("div",{className:"matches-toolbar-inner",style:{maxWidth:1152,margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minWidth:0},children:[jsxRuntime.jsx("div",{className:"hidden sm:flex",style:{alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:10,background:"linear-gradient(to bottom right, rgba(142,81,255,0.2), rgba(225,42,251,0.2))",border:"1px solid rgba(142,81,255,0.2)",flexShrink:0},children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#a684ff"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}),jsxRuntime.jsx("path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}),jsxRuntime.jsx("path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"})]})}),jsxRuntime.jsxs("div",{style:{minWidth:0},children:[jsxRuntime.jsx("h2",{style:{fontSize:14,fontWeight:600,color:"#fff",margin:0,letterSpacing:"-0.28px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n(Gp[i])}),d&&d.activePairs>0&&jsxRuntime.jsx("p",{className:"hidden sm:block",style:{fontSize:11,color:"#71717a",margin:0},children:n("predict.matches.pairsFound",{count:d.activePairs})})]})]}),jsxRuntime.jsx(sa,{sortBy:i,onSortChange:f,sortAsc:s,onSortAscChange:g,minVolume:c,onMinVolumeChange:u,onRefresh:x})]})]}),jsxRuntime.jsx("style",{children:".matches-content-wrap{padding:24px 16px 80px}@media(min-width:640px){.matches-content-wrap{padding:32px 24px 80px}}@media(min-width:1024px){.matches-content-wrap{padding:24px 32px 80px}}"}),jsxRuntime.jsxs("div",{className:"match-fade-in-d2 matches-content-wrap",style:{position:"relative",maxWidth:1152,margin:"0 auto"},children:[jsxRuntime.jsx(pa,{ref:m,sortBy:i,sortAsc:s,minVolume:c,onSelect:e,getMarketHref:t,LinkComponent:r,onStatsChange:h}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12,marginTop:48,padding:16,borderRadius:12,border:"1px solid rgba(39,39,42,0.5)",background:"rgba(24,24,27,0.3)"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#71717a",flexShrink:0,marginTop:1},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{style:{fontSize:12,fontWeight:500,color:"#a1a1aa",margin:"0 0 4px"},children:n("predict.matches.experimentalFeature")}),jsxRuntime.jsx("p",{style:{fontSize:11,color:"#52525b",lineHeight:1.625,margin:0},children:n("predict.matches.disclaimer")})]})]})]}),jsxRuntime.jsx(qp,{stats:d})]})}function Tn(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}var Xp={polymarket:{text:"#50a2ff",border:"rgba(43,127,255,0.15)",hoverBorder:"rgba(43,127,255,0.3)",bg:"rgba(43,127,255,0.05)",priceColor:"rgba(244,244,245,1)",priceActiveColor:"rgba(244,244,245,1)"},kalshi:{text:"#00d492",border:"rgba(0,212,146,0.15)",hoverBorder:"rgba(0,212,146,0.3)",bg:"rgba(0,212,146,0.05)",priceColor:"#00d492",priceActiveColor:"#00d492"}},Zp={text:"#9ca3af",border:"rgba(156,163,175,0.15)",hoverBorder:"rgba(156,163,175,0.3)",bg:"rgba(156,163,175,0.05)",priceColor:"rgba(244,244,245,1)",priceActiveColor:"rgba(244,244,245,1)"};function Jp(e){return Xp[e]??Zp}function em(e){if(!e.matched_markets?.length)return null;let t=null,r=-1;for(let o of e.matched_markets){let n=o.spread??0;n>r&&(r=n,t=o);}return t}function tm(e,t){let r=e.entries.find(s=>s.source===(t?.source_a??e.entries[0]?.source)),o=e.entries.find(s=>s.source===(t?.source_b??e.entries[1]?.source)),n=s=>{if(!s?.outcomes?.[0])return {name:null,price:null};let a=s.outcomes[0];return {name:a.label||null,price:a.best_ask??a.price??null}},i=n(t?.market_a),l=n(t?.market_b);return [{source:t?.source_a??r?.source??"unknown",outcomeName:i.name,yesPrice:i.price,volume:r?.event?.volume??null,event:r?.event},{source:t?.source_b??o?.source??"unknown",outcomeName:l.name,yesPrice:l.price,volume:o?.event?.volume??null,event:o?.event}]}function Qv({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:o}){let {t:n}=i18n.useTranslation(),i=react.useMemo(()=>em(e),[e]),l=e.max_spread!=null?e.max_spread*100:null,[s,a]=react.useMemo(()=>tm(e,i),[e,i]),c=l!=null&&l>=3;s.yesPrice!=null&&a.yesPrice!=null?s.source==="kalshi"?s.yesPrice>a.yesPrice:a.yesPrice>s.yesPrice:false;let d=s.yesPrice!=null&&a.yesPrice!=null?s.yesPrice<=a.yesPrice?s:a:null,p=d?ft(d.source):null,m=c?"amber":"violet";return jsxRuntime.jsxs("div",{className:"group",style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",position:"relative"},onMouseEnter:f=>{let g=f.currentTarget;g.style.borderColor="rgba(63,63,70,0.6)",g.style.boxShadow="0 10px 15px -3px rgba(0,0,0,0.2)";},onMouseLeave:f=>{let g=f.currentTarget;g.style.borderColor="rgba(39,39,42,0.6)",g.style.boxShadow="none";},children:[l!=null&&jsxRuntime.jsxs("span",{style:{position:"absolute",top:12,right:12,zIndex:10,display:"inline-flex",alignItems:"center",gap:4,borderRadius:10,padding:"4px 10px",fontSize:12,fontWeight:600,border:`1px solid ${c?"rgba(255,185,0,0.3)":l>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:c?"rgba(255,185,0,0.15)":l>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:c?"#ffb900":l>=2?"#a684ff":"#9ca3af"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),l.toFixed(1),"%"]}),jsxRuntime.jsxs("div",{style:{padding:16},children:[jsxRuntime.jsx("h3",{style:{fontSize:14,fontWeight:600,lineHeight:1.375,letterSpacing:"-0.28px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",paddingRight:80,margin:"0 0 16px"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[jsxRuntime.jsx(ga,{data:s,isCheaper:d===s,onSelect:t,getEventHref:r,LinkComponent:o}),jsxRuntime.jsx(ga,{data:a,isCheaper:d===a,onSelect:t,getEventHref:r,LinkComponent:o})]}),d&&p&&l!=null&&jsxRuntime.jsxs("div",{style:{marginTop:12,padding:"8px 12px",borderRadius:10,display:"flex",alignItems:"center",gap:8,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${m==="amber"?"rgba(255,185,0,0.15)":"rgba(166,132,255,0.15)"}`,background:m==="amber"?"rgba(255,185,0,0.05)":"rgba(166,132,255,0.05)"},onClick:()=>d.event&&t?.(d.event),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:m==="amber"?"#ffb900":"#a684ff"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:m==="amber"?"rgba(255,185,0,0.9)":"rgba(166,132,255,0.9)"},children:n("predict.matches.buyEdge",{platform:d.source.charAt(0).toUpperCase()+d.source.slice(1),spread:l.toFixed(1)})}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,marginLeft:"auto",color:m==="amber"?"rgba(255,185,0,0.5)":"rgba(166,132,255,0.5)"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M5 12h14"}),jsxRuntime.jsx("path",{d:"m12 5 7 7-7 7"})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.2)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),Tn(e.combined_volume)]}),e.combined_volume_24h!=null&&e.combined_volume_24h>0&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})}),Tn(e.combined_volume_24h)," ",n("predict.matches.vol24h")]})]}),e.confidence!=null&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,fontSize:10,color:"#52525b"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"})}),Math.round(e.confidence*100),"%"," ",n("predict.matches.match")]})]})]})}function ga({data:e,isCheaper:t,onSelect:r,getEventHref:o,LinkComponent:n}){let{t:i}=i18n.useTranslation(),l=ft(e.source),s=Jp(e.source),a=e.event?o?.(e.event):void 0,c=jsxRuntime.jsxs("div",{style:{borderRadius:14,border:`1px solid ${s.border}`,background:s.bg,padding:12,cursor:a||r?"pointer":void 0,transition:"border-color 0.15s"},onMouseEnter:u=>{u.currentTarget.style.borderColor=s.hoverBorder;},onMouseLeave:u=>{u.currentTarget.style.borderColor=s.border;},onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[l.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.05em",color:s.text,textTransform:"uppercase"},children:l.label}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",marginLeft:"auto"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})]}),e.outcomeName&&jsxRuntime.jsx("div",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:e.outcomeName}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[jsxRuntime.jsx("span",{style:{fontSize:20,fontWeight:700,fontVariantNumeric:"tabular-nums",color:t?s.priceActiveColor:s.priceColor},children:e.yesPrice!=null?(e.yesPrice*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a"},children:i("predict.matches.centsYes")})]}),jsxRuntime.jsxs("div",{style:{fontSize:10,color:"#52525b",marginTop:6},children:[Tn(e.volume)," ",i("predict.matches.volume")]})]});return a&&n?jsxRuntime.jsx(n,{href:a,className:"block",children:c}):c}function om(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}function tb({matches:e,total:t}){let{t:r}=i18n.useTranslation(),o=react.useMemo(()=>{let n=0,i=0,l=new Set;for(let s of e){s.max_spread!=null&&s.max_spread>n&&(n=s.max_spread),s.combined_volume!=null&&(i+=s.combined_volume);for(let a of s.entries)l.add(typeof a.source=="string"?a.source:"");}return {count:t??e.length,maxSpread:n,totalVolume:i,platformCount:l.size}},[e,t]);return jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 rounded-xl border border-border/60 bg-background/50 px-4 py-3 text-sm",children:[jsxRuntime.jsx(Er,{label:r("predict.matches.stats.matchedMarkets"),value:o.count.toLocaleString()}),jsxRuntime.jsx(Ln,{}),jsxRuntime.jsx(Er,{label:r("predict.matches.stats.totalVolume"),value:om(o.totalVolume)}),jsxRuntime.jsx(Ln,{}),jsxRuntime.jsx(Er,{label:r("predict.matches.stats.highestSpread"),value:`${(o.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(Ln,{}),jsxRuntime.jsx(Er,{label:r("predict.matches.stats.platforms"),value:String(o.platformCount)})]})}function Er({label:e,value:t,valueClassName:r="text-slate-200"}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsxs("span",{className:"text-neutral-500",children:[e,":"]}),jsxRuntime.jsx("span",{className:`font-semibold ${r}`,children:t})]})}function Ln(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function va(e){return `${(e*100).toFixed(1)}\xA2`}function sm(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function sb({spread:e,arbProfit:t,className:r}){if(e==null)return null;let o=t!=null&&t>0;return jsxRuntime.jsxs("div",{className:ui.cn("flex items-center gap-x-2",r),children:[jsxRuntime.jsx("span",{className:ui.cn("text-sm font-semibold",sm(e)),children:va(e)}),o&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",va(t)]})]})}var qt=10,um=64,Sa=40,Tr=48;function Na({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:o}=i18n.useTranslation(),[n,i]=react.useState(1),{data:l,isLoading:s,fetchNextPage:a,hasNextPage:c,isFetchingNextPage:u}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:d,isLoading:p,fetchNextPage:m,hasNextPage:f,isFetchingNextPage:g}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),h=s||p,x=u||g,P=c||f,y=react.useMemo(()=>{let A=[];return l?.pages&&A.push(...l.pages.flatMap($=>$.items)),d?.pages&&A.push(...d.pages.flatMap($=>$.items)),A.sort(($,F)=>(F.timestamp??0)-($.timestamp??0)),A},[l,d]),N=Math.max(1,Math.ceil(y.length/qt)+(P?1:0)),v=(n-1)*qt,H=y.slice(v,v+qt),b=react.useCallback(()=>{i(A=>Math.max(1,A-1));},[]),q=react.useCallback(async()=>{n*qt>=y.length&&P&&(c&&await a(),f&&await m()),i($=>$+1);},[n,y.length,P,c,f,a,m]),V=n>1,le=n*qt<y.length||P;if(h)return jsxRuntime.jsx(xm,{height:r});if(y.length===0&&!P)return jsxRuntime.jsx(hm,{message:o("predict.profile.noHistory"),height:r});let z=r-Sa-Tr;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:Sa},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:o("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.profile.status")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.price")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:o("predict.profile.depositWithdraw")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.fee")}),jsxRuntime.jsx("div",{className:"w-10 shrink-0"})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:z},children:[H.map((A,$)=>jsxRuntime.jsx(pm,{trade:A},A.id??`${v+$}`)),x&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:Tr},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!V,onClick:b,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",V?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",o("predict.profile.previous")]}),Array.from({length:Math.min(N,5)},(A,$)=>{let F=$+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>i(F),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",F===n?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:F},F)}),jsxRuntime.jsxs("button",{type:"button",disabled:!le,onClick:q,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",le?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[o("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Tr},children:H.map((A,$)=>jsxRuntime.jsx(mm,{trade:A},A.id??`m-${v+$}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:Tr},children:[jsxRuntime.jsx("button",{type:"button",disabled:!V,onClick:b,className:ui.cn("text-sm cursor-pointer",V?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:n}),jsxRuntime.jsx("button",{type:"button",disabled:!le,onClick:q,className:ui.cn("text-sm cursor-pointer",le?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function pm({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",o=e.price??0,n=e.usd_size??0,i=Pa(e.type,t),l=r,s=l?"+":"-",a=l?"text-success":"text-foreground",c=e.event?.title??e.market?.question??"\u2014",u=e.event?.image_url,d=e.outcome??"",p=Ea(e.timestamp),m=wa(e),f=fm(e),g=gm(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:um},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[u&&jsxRuntime.jsx("img",{src:u,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:c}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[d&&jsxRuntime.jsx("span",{className:"mr-1",children:d}),jsxRuntime.jsx("span",{children:p})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("text-sm font-medium",r?"text-success":"text-danger"),children:t(r?"predict.profile.buy":"predict.profile.sell")})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-sm text-foreground",children:i}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Ma(o)}),jsxRuntime.jsx("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",a),children:n>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s,"$",n.toFixed(2)]}):"\u2014"}),jsxRuntime.jsx("div",{className:ui.cn("flex-1 pr-2 text-right font-mono",f!==null?f>=0?"text-success":"text-danger":"text-neutral"),children:f!==null?`${f>=0?"+":"-"}$${Math.abs(f).toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-neutral",children:g!==null?`$${g.toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"w-10 shrink-0 text-right",children:m&&jsxRuntime.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"text-neutral hover:text-foreground transition-colors","aria-label":"View transaction",children:jsxRuntime.jsx(Ca,{})})})]})}function mm({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",o=e.price??0,n=e.usd_size??0,i=Pa(e.type,t),l=e.event?.title??e.market?.question??"\u2014",s=Ea(e.timestamp),a=wa(e);return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.event?.image_url&&jsxRuntime.jsx("img",{src:e.event.image_url,alt:"",className:"w-6 h-6 rounded-full object-cover shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground line-clamp-2",children:l})]}),jsxRuntime.jsx("span",{className:"text-[11px] text-neutral whitespace-nowrap",children:s})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.action")}),jsxRuntime.jsx("span",{className:ui.cn("font-medium",r?"text-success":"text-danger"),children:t(r?"predict.profile.buy":"predict.profile.sell")})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.status")}),jsxRuntime.jsx("span",{className:"text-foreground",children:i})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.price")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:Ma(o)})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.depositWithdraw")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:n>0?`$${n.toFixed(2)}`:"\u2014"})]}),a&&jsxRuntime.jsx("a",{href:a,target:"_blank",rel:"noopener noreferrer",className:"ml-auto text-neutral hover:text-foreground transition-colors",children:jsxRuntime.jsx(Ca,{})})]})]})}function Pa(e,t){switch(e){case "TRADE":return t("predict.profile.filled");case "REDEEM":return t("predict.profile.claimed");case "SPLIT":case "MERGE":case "CONVERSION":return t("predict.profile.created");default:return e}}function wa(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function fm(e){let t=e.provider_meta;if(t){let r=t.pnl??t.profit??t.realized_pnl??t["dflow.pnl"];if(typeof r=="number")return r;if(typeof r=="string"&&r!==""){let o=parseFloat(r);if(!Number.isNaN(o))return o}}return e.type==="REDEEM"&&e.usd_size!=null?e.usd_size:null}function gm(e){let t=e.provider_meta;if(t){let r=t.fee??t.fees??t.trading_fee??t["dflow.fee"];if(typeof r=="number")return r;if(typeof r=="string"&&r!==""){let o=parseFloat(r);if(!Number.isNaN(o))return o}}return null}function Ca(){return jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),jsxRuntime.jsx("polyline",{points:"15 3 21 3 21 9"}),jsxRuntime.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}function hm({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function xm({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Ma(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Ea(e){let t=new Date(e*1e3),r=t.getHours().toString().padStart(2,"0"),o=t.getMinutes().toString().padStart(2,"0"),n=t.getDate().toString().padStart(2,"0"),i=(t.getMonth()+1).toString().padStart(2,"0"),l=t.getFullYear(),s=t.getTimezoneOffset(),a=s<=0?"+":"-",c=String(Math.abs(Math.floor(s/60))).padStart(2,"0");return `${r}:${o} ${n}/${i}/${l} (${a}${c})`}var Qt=10,Pm=64,La=40,Lr=48;function Ra({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:o}=i18n.useTranslation(),n=reactPredict.useCancelOrder(),[i,l]=react.useState(1),{data:s,isLoading:a,fetchNextPage:c,hasNextPage:u,isFetchingNextPage:d}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:p,isLoading:m,fetchNextPage:f,hasNextPage:g,isFetchingNextPage:h}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),x=a||m,P=d||h,y=u||g,N=react.useMemo(()=>{let F=[],se=new Set(["live","open","submitted","pending"]);return s?.pages&&F.push(...s.pages.flatMap(pe=>pe.items).filter(pe=>se.has(pe.status))),p?.pages&&F.push(...p.pages.flatMap(pe=>pe.items).filter(pe=>se.has(pe.status))),F},[s,p]),v=react.useCallback(F=>{n.mutate({source:F.source,id:F.id});},[n]),H=Math.max(1,Math.ceil(N.length/Qt)+(y?1:0)),b=(i-1)*Qt,q=N.slice(b,b+Qt),V=react.useCallback(()=>{l(F=>Math.max(1,F-1));},[]),le=react.useCallback(async()=>{i*Qt>=N.length&&y&&(u&&await c(),g&&await f()),l(se=>se+1);},[i,N.length,y,u,g,c,f]),z=i>1,A=i*Qt<N.length||y;if(x)return jsxRuntime.jsx(Em,{height:r});if(N.length===0&&!y)return jsxRuntime.jsx(Mm,{message:o("predict.profile.noOrders"),height:r});let $=r-La-Lr;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:La},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:o("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.profile.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.fillPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.cost")})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:$},children:[q.map(F=>jsxRuntime.jsx(wm,{order:F,onCancel:v},F.id)),P&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsx(_a,{className:"hidden lg:flex",currentPage:i,totalPages:H,canGoPrev:z,canGoNext:A,onPrev:V,onNext:le,onPage:l,t:o}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Lr},children:q.map(F=>jsxRuntime.jsx(Cm,{order:F,onCancel:v},F.id))}),jsxRuntime.jsx(_a,{className:"lg:hidden",currentPage:i,totalPages:H,canGoPrev:z,canGoNext:A,onPrev:V,onNext:le,onPage:l,t:o,compact:true})]})}function wm({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),o=e.side==="BUY",n=e.price?parseFloat(e.price):0,i=e.in_amount?parseFloat(e.in_amount):n*parseFloat(e.original_size??"0");return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:Pm},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium",children:e.outcome??e.market_id??"\u2014"})})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("text-sm font-medium",o?"text-success":"text-danger"),children:r(o?"predict.profile.buy":"predict.profile.sell")})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize text-sm",children:e.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:n>0?Ia(n):"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]})}function Cm({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),o=e.side==="BUY",n=e.price?parseFloat(e.price):0;return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:ui.cn("text-xs font-medium px-1.5 py-0.5 rounded",o?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:e.side}),jsxRuntime.jsx("span",{className:"text-sm text-foreground capitalize",children:e.outcome??"\u2014"})]}),jsxRuntime.jsx("span",{className:"text-xs text-neutral capitalize",children:e.order_type??"limit"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.profile.fillPrice")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:n>0?Ia(n):"\u2014"})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>t(e),className:"text-xs text-danger hover:text-danger/80 cursor-pointer border border-border rounded px-2 py-1",children:r("predict.orders.cancel")})]})]})}function _a({className:e,currentPage:t,totalPages:r,canGoPrev:o,canGoNext:n,onPrev:i,onNext:l,onPage:s,t:a,compact:c}){return c?jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-3 shrink-0",e),style:{height:Lr},children:[jsxRuntime.jsx("button",{type:"button",disabled:!o,onClick:i,className:ui.cn("text-sm cursor-pointer",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:t}),jsxRuntime.jsx("button",{type:"button",disabled:!n,onClick:l,className:ui.cn("text-sm cursor-pointer",n?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]}):jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-2 shrink-0",e),style:{height:Lr},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!o,onClick:i,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",a("predict.profile.previous")]}),Array.from({length:Math.min(r,5)},(u,d)=>{let p=d+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>s(p),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",p===t?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:p},p)}),jsxRuntime.jsxs("button",{type:"button",disabled:!n,onClick:l,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",n?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[a("predict.profile.next")," \u2192"]})]})}function Mm({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Em({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Ia(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}var An=10,Rm=64,Oa=40,_r=48;function Aa({positions:e,isLoading:t,listHeight:r,onClosePosition:o,onEventClick:n}){let{t:i}=i18n.useTranslation(),[l,s]=react.useState(1),a=react.useCallback(()=>{for(let g of e)o?.(g);},[e,o]);if(t)return jsxRuntime.jsx(Dm,{height:r});if(e.length===0)return jsxRuntime.jsx(Am,{message:i("predict.profile.noPositions"),height:r});let c=Math.max(1,Math.ceil(e.length/An)),u=(l-1)*An,d=e.slice(u,u+An),p=l>1,m=l<c,f=r-Oa-_r;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:Oa},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:i("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.markPrice")}),jsxRuntime.jsxs("div",{className:"flex-[1.5] pr-2 text-right",children:[jsxRuntime.jsx("span",{children:i("predict.profile.pnl")}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",i("predict.profile.pnlExcludeFees"),")"]})]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:i("predict.profile.estSettlement")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:o&&e.length>0&&jsxRuntime.jsx("button",{type:"button",onClick:a,className:"text-xs text-primary hover:text-primary/80 cursor-pointer transition-colors",children:i("predict.profile.closeAll")})})]}),jsxRuntime.jsx("div",{className:"hidden lg:block overflow-y-auto",style:{height:f},children:d.map((g,h)=>jsxRuntime.jsx(Im,{position:g,onClosePosition:o,onEventClick:n},`${g.source}-${g.market?.slug??u+h}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:_r},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!p,onClick:()=>s(g=>Math.max(1,g-1)),className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",p?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",i("predict.profile.previous")]}),Array.from({length:Math.min(c,5)},(g,h)=>{let x=h+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>s(x),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",x===l?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:x},x)}),jsxRuntime.jsxs("button",{type:"button",disabled:!m,onClick:()=>s(g=>g+1),className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",m?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[i("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-_r},children:d.map((g,h)=>jsxRuntime.jsx(Om,{position:g,onClose:o,onEventClick:n},`${g.source}-${g.market?.slug??`m-${u+h}`}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:_r},children:[jsxRuntime.jsx("button",{type:"button",disabled:!p,onClick:()=>s(g=>Math.max(1,g-1)),className:ui.cn("text-sm cursor-pointer",p?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:l}),jsxRuntime.jsx("button",{type:"button",disabled:!m,onClick:()=>s(g=>g+1),className:ui.cn("text-sm cursor-pointer",m?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function Im({position:e,onClosePosition:t,onEventClick:r}){let{t:o}=i18n.useTranslation(),n=e.pnl??0,i=e.pnl_percent??0,l=e.avg_price??0,s=e.current_price??0,a=e.current_value??e.size*s,c=e.size,u=n>0?"text-success":n<0?"text-danger":"text-foreground",d=n>0?"+":"",p=e.event?.title??e.market?.question??"\u2014",m=e.event?.image_url,f=e.side,g=e.market?.outcomes?.[0]?.label??"",h=e.market?.end_at?Fm(e.market.end_at):"\u2014";return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:Rm},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-2.5 min-w-0 cursor-pointer text-left",onClick:()=>e.event&&r?.(e.event),children:[m&&jsxRuntime.jsx("img",{src:m,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:p}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[jsxRuntime.jsx("span",{className:ui.cn("font-medium",f.toLowerCase()==="yes"?"text-success":"text-danger"),children:f}),g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1",children:"\xB7"}),jsxRuntime.jsx("span",{children:g})]})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsxs("span",{className:"font-mono text-foreground",children:["$",a.toFixed(2)]}),jsxRuntime.jsx("span",{className:"text-[10px] text-neutral",children:o("predict.profile.contracts",{count:e.size})})]})}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",(e.size*l).toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Dn(l)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Dn(s)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",u),children:[jsxRuntime.jsxs("span",{children:[d,"$",Math.abs(n).toFixed(2)]}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",d,i.toFixed(2),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",c.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap text-xs",children:h}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:t&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>t(e),className:"inline-flex items-center gap-1 text-xs text-neutral hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{className:"text-danger",children:"\u2715"}),o("predict.profile.close")]})})]})}function Om({position:e,onClose:t,onEventClick:r}){let{t:o}=i18n.useTranslation(),n=e.pnl??0,i=e.pnl_percent??0,l=e.current_price??0,s=n>0?"text-success":n<0?"text-danger":"text-foreground",a=n>0?"+":"",c=e.event?.title??e.market?.question??"\u2014";return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-start justify-between gap-2 text-left cursor-pointer",onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.event?.image_url&&jsxRuntime.jsx("img",{src:e.event.image_url,alt:"",className:"w-7 h-7 rounded-full object-cover shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground line-clamp-2",children:c})]}),jsxRuntime.jsx("span",{className:ui.cn("shrink-0 text-xs font-medium px-1.5 py-0.5 rounded",e.side.toLowerCase()==="yes"?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:e.side})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsx(Rr,{label:o("predict.profile.totalSize"),value:`${e.size}`}),jsxRuntime.jsx(Rr,{label:o("predict.profile.markPrice"),value:Dn(l)}),jsxRuntime.jsx(Rr,{label:o("predict.profile.pnl"),value:`${a}$${Math.abs(n).toFixed(2)} (${a}${i.toFixed(1)}%)`,className:s}),jsxRuntime.jsx(Rr,{label:o("predict.profile.payoutIfRight"),value:`$${e.size.toFixed(2)}`})]}),t&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>t(e),className:"text-xs text-danger hover:text-danger/80 cursor-pointer transition-colors border border-border rounded px-2 py-1",children:o("predict.profile.close")})})]})}function Rr({label:e,value:t,className:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:e}),jsxRuntime.jsx("span",{className:ui.cn("font-mono text-foreground",r),children:t})]})}function Am({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Dm({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Dn(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Fm(e){try{let t=new Date(e),r=t.getHours().toString().padStart(2,"0"),o=t.getMinutes().toString().padStart(2,"0"),n=t.getDate().toString().padStart(2,"0"),i=(t.getMonth()+1).toString().padStart(2,"0"),l=t.getFullYear(),s=t.getTimezoneOffset(),a=s<=0?"+":"-",c=String(Math.abs(Math.floor(s/60))).padStart(2,"0");return `${r}:${o} ${n}/${i}/${l} (${a}${c})`}catch{return "\u2014"}}function Fa({positions:e,trades:t,isLoading:r}){let{t:o}=i18n.useTranslation(),n=react.useMemo(()=>{let s=0,a=0;for(let m of e)s+=m.realized_pnl??0,a+=m.current_value??m.size*(m.current_price??0);let c=0,u=0,d=0;for(let m of t)c+=m.usd_size??0,m.type==="REDEEM"&&(d++,(m.usd_size??0)>0&&u++);let p=d>0?`${u} / ${d}`:"0 / 0";return {realizedPnl:s,positionsValue:a,volume:c,winRateStr:p}},[e,t]),i=n.realizedPnl>0?"text-success":n.realizedPnl<0?"text-danger":"text-foreground",l=n.realizedPnl>0?"+":"";return jsxRuntime.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 py-8",children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx("span",{className:"text-xl text-neutral",children:o("predict.profile.realizedPnl")}),r?jsxRuntime.jsx(ui.Skeleton,{className:"h-14 w-48 rounded-md"}):jsxRuntime.jsxs("span",{className:ui.cn("text-5xl font-bold tabular-nums",i),children:[l,"$",Math.abs(n.realizedPnl).toFixed(2)]})]}),jsxRuntime.jsxs("div",{className:"flex items-end gap-8 sm:gap-10",children:[jsxRuntime.jsx(Bn,{label:o("predict.profile.winRate"),value:n.winRateStr,isLoading:r}),jsxRuntime.jsx(Bn,{label:o("predict.profile.positions"),value:`$${n.positionsValue.toFixed(2)}`,isLoading:r}),jsxRuntime.jsx(Bn,{label:o("predict.profile.volume"),value:`$${n.volume.toFixed(2)}`,isLoading:r})]})]})}function Bn({label:e,value:t,isLoading:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral whitespace-nowrap",children:e}),r?jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-14 rounded-md"}):jsxRuntime.jsx("span",{className:"text-base font-semibold tabular-nums text-foreground",children:t})]})}var Hn=600;function Vm({solanaAddress:e,evmAddress:t,onClosePosition:r,onEventClick:o}){let{t:n}=i18n.useTranslation(),[i,l]=react.useState("positions"),s=!!(e||t),{data:a,isLoading:c}=reactPredict.usePositions({source:"kalshi",user:e??""}),{data:u,isLoading:d}=reactPredict.usePositions({source:"polymarket",user:t??""}),p=react.useMemo(()=>{let b=[];return a?.positions&&b.push(...a.positions),u?.positions&&b.push(...u.positions),b},[a,u]),m=c||d,{data:f,isLoading:g}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:h,isLoading:x}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),P=react.useMemo(()=>[...f?.pages?.flatMap(q=>q.items)??[],...h?.pages?.flatMap(q=>q.items)??[]],[f,h]),y=m||g||x,N=p.length,H=[{key:"positions",label:N>0?`${n("predict.profile.positionsTab")} (${N})`:n("predict.profile.positionsTab")},{key:"orders",label:n("predict.profile.openOrdersTab")},{key:"history",label:n("predict.profile.historyTab")}];return s?jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[1280px] mx-auto w-full px-4 max-sm:px-2",children:[jsxRuntime.jsx(Fa,{positions:p,trades:P,isLoading:y}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:H.map(b=>jsxRuntime.jsx("button",{type:"button",onClick:()=>l(b.key),className:ui.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",i===b.key?"text-foreground border-b-2 border-foreground":"text-neutral hover:text-foreground"),children:b.label},b.key))}),jsxRuntime.jsxs("div",{className:"py-2",children:[i==="positions"&&jsxRuntime.jsx(Aa,{positions:p,isLoading:m,listHeight:Hn,onClosePosition:r,onEventClick:o}),i==="orders"&&jsxRuntime.jsx(Ra,{solanaAddress:e,evmAddress:t,listHeight:Hn}),i==="history"&&jsxRuntime.jsx(Na,{solanaAddress:e,evmAddress:t,listHeight:Hn})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:n("predict.profile.connectWallet")})}function zn(e){return e==="done"?"\u2705":e==="running"?null:"\u23F3"}function ty({isOpen:e,onClose:t,evmAddress:r,safeDeployed:o,tokenApproved:n,keysConnected:i,onDeployAndApprove:l,onConnectKeys:s}){let{t:a}=i18n.useTranslation(),[c,u]=react.useState(false),[d,p]=react.useState(false),[m,f]=react.useState(null),g=o?"done":c?"running":"pending",h=n?"done":o&&c?"running":"pending",x=i?"done":d?"running":"pending",P=o&&n&&i,y=react.useCallback(async()=>{f(null),u(true);try{await l();}catch(v){f(v instanceof Error?v.message:String(v));}finally{u(false);}},[l]),N=react.useCallback(async()=>{f(null),p(true);try{s&&await s();}catch(v){f(v instanceof Error?v.message:String(v));}finally{p(false);}},[s]);return jsxRuntime.jsx(ui.Modal,{isOpen:e,onClose:t,size:"md",children:jsxRuntime.jsxs(ui.ModalContent,{children:[jsxRuntime.jsx(ui.ModalHeader,{className:"flex flex-col gap-1",children:jsxRuntime.jsxs("span",{className:"text-lg",children:["\u{1F527} ",a("predict.setup.modalTitle","Polymarket Wallet Setup")]})}),jsxRuntime.jsxs(ui.ModalBody,{className:"gap-y-4",children:[jsxRuntime.jsx("p",{className:"text-sm text-default-600",children:a("predict.setup.modalDescription","Complete these steps to trade on Polymarket. Gas fees are covered.")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3 rounded-lg border border-default-200 p-3",children:[jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-default-100 text-sm font-bold",children:g==="running"?jsxRuntime.jsx(ui.Spinner,{size:"sm"}):zn(g)}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:a("predict.setup.step1","Deploy Safe Wallet")}),jsxRuntime.jsx("p",{className:"text-xs text-default-400",children:g==="done"?a("predict.setup.stepComplete","Complete"):g==="running"?a("predict.setup.stepRunning","Processing..."):a("predict.setup.stepPending","Pending")})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3 rounded-lg border border-default-200 p-3",children:[jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-default-100 text-sm font-bold",children:h==="running"?jsxRuntime.jsx(ui.Spinner,{size:"sm"}):zn(h)}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:a("predict.setup.step2","Approve USDC")}),jsxRuntime.jsx("p",{className:"text-xs text-default-400",children:h==="done"?a("predict.setup.stepComplete","Complete"):h==="running"?a("predict.setup.stepRunning","Processing..."):a("predict.setup.stepPending","Pending")})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3 rounded-lg border border-default-200 p-3",children:[jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-default-100 text-sm font-bold",children:x==="running"?jsxRuntime.jsx(ui.Spinner,{size:"sm"}):zn(x)}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:a("predict.setup.step3","Connect API Keys")}),jsxRuntime.jsx("p",{className:"text-xs text-default-400",children:x==="done"?a("predict.setup.stepComplete","Complete"):x==="running"?a("predict.setup.stepRunning","Processing..."):a("predict.setup.stepPending","Pending")})]})]}),m&&jsxRuntime.jsx("p",{className:"text-xs text-danger",children:m})]}),jsxRuntime.jsxs(ui.ModalFooter,{children:[jsxRuntime.jsx(ui.Button,{variant:"light",onPress:t,children:a("common.cancel","Cancel")}),P?jsxRuntime.jsx(ui.Button,{color:"success",onPress:t,children:a("predict.setup.done","Done")}):!o||!n?jsxRuntime.jsx(ui.Button,{color:"primary",isLoading:c,onPress:y,children:a("predict.setup.setupButton","Set Up Wallet")}):jsxRuntime.jsx(ui.Button,{color:"primary",isLoading:d,onPress:N,children:a("predict.setup.connectButton","Connect API")})]})]})})}
|
|
49
|
+
`}),jsxRuntime.jsxs("div",{style:{position:"relative",overflow:"hidden",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[jsxRuntime.jsx("div",{style:{position:"absolute",inset:0,background:"linear-gradient(to bottom right, rgba(46,16,101,0.2), transparent 50%, rgba(8,51,68,0.1))"}}),jsxRuntime.jsx("div",{style:{position:"absolute",inset:0,opacity:.03,backgroundImage:"radial-gradient(circle at 1px 1px, rgb(255 255 255) 1px, transparent 0)",backgroundSize:"24px 24px"}}),jsxRuntime.jsx("div",{style:{position:"absolute",top:0,left:"25%",width:384,height:384,background:"rgba(139,92,246,0.05)",borderRadius:9999,filter:"blur(96px)"}}),jsxRuntime.jsx("div",{style:{position:"absolute",bottom:0,right:"25%",width:384,height:384,background:"rgba(6,182,212,0.05)",borderRadius:9999,filter:"blur(96px)"}})]}),jsxRuntime.jsx("style",{children:".matches-hero-wrap{padding:48px 16px 40px}@media(min-width:640px){.matches-hero-wrap{padding:64px 24px 56px}}@media(min-width:1024px){.matches-hero-wrap{padding:64px 32px 56px}}"}),jsxRuntime.jsx("div",{className:"match-fade-in matches-hero-wrap",style:{position:"relative",maxWidth:1152,margin:"0 auto"},children:jsxRuntime.jsx(aa,{stats:u})})]}),jsxRuntime.jsxs("div",{style:{position:"sticky",top:0,zIndex:40,background:"rgba(10,10,11,0.8)",backdropFilter:"blur(24px)",WebkitBackdropFilter:"blur(24px)",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("style",{children:".matches-toolbar-inner{padding:12px 16px}@media(min-width:640px){.matches-toolbar-inner{padding:12px 24px}}@media(min-width:1024px){.matches-toolbar-inner{padding:12px 32px}}"}),jsxRuntime.jsxs("div",{className:"matches-toolbar-inner",style:{maxWidth:1152,margin:"0 auto",display:"flex",alignItems:"center",justifyContent:"space-between",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minWidth:0},children:[jsxRuntime.jsx("div",{className:"hidden sm:flex",style:{alignItems:"center",justifyContent:"center",width:32,height:32,borderRadius:10,background:"linear-gradient(to bottom right, rgba(142,81,255,0.2), rgba(225,42,251,0.2))",border:"1px solid rgba(142,81,255,0.2)",flexShrink:0},children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#a684ff"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z"}),jsxRuntime.jsx("path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12"}),jsxRuntime.jsx("path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17"})]})}),jsxRuntime.jsxs("div",{style:{minWidth:0},children:[jsxRuntime.jsx("h2",{style:{fontSize:14,fontWeight:600,color:"#fff",margin:0,letterSpacing:"-0.28px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i(Gp[l])}),u&&u.activePairs>0&&jsxRuntime.jsx("p",{className:"hidden sm:block",style:{fontSize:11,color:"#71717a",margin:0},children:i("predict.matches.pairsFound",{count:u.activePairs})})]})]}),jsxRuntime.jsx(sa,{sortBy:l,onSortChange:g,sortAsc:s,onSortAscChange:h,minVolume:d,onMinVolumeChange:p,onRefresh:C})]})]}),jsxRuntime.jsx("style",{children:".matches-content-wrap{padding:24px 16px 80px}@media(min-width:640px){.matches-content-wrap{padding:32px 24px 80px}}@media(min-width:1024px){.matches-content-wrap{padding:24px 32px 80px}}"}),jsxRuntime.jsxs("div",{className:"match-fade-in-d2 matches-content-wrap",style:{position:"relative",maxWidth:1152,margin:"0 auto"},children:[jsxRuntime.jsx(pa,{ref:f,sortBy:l,sortAsc:s,minVolume:d,onSelect:e,onHover:t,getMarketHref:r,LinkComponent:o,onStatsChange:x}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:12,marginTop:48,padding:16,borderRadius:12,border:"1px solid rgba(39,39,42,0.5)",background:"rgba(24,24,27,0.3)"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#71717a",flexShrink:0,marginTop:1},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{style:{fontSize:12,fontWeight:500,color:"#a1a1aa",margin:"0 0 4px"},children:i("predict.matches.experimentalFeature")}),jsxRuntime.jsx("p",{style:{fontSize:11,color:"#52525b",lineHeight:1.625,margin:0},children:i("predict.matches.disclaimer")})]})]})]}),jsxRuntime.jsx(qp,{stats:u})]})}function Tn(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}var Xp={polymarket:{text:"#50a2ff",border:"rgba(43,127,255,0.15)",hoverBorder:"rgba(43,127,255,0.3)",bg:"rgba(43,127,255,0.05)",priceColor:"rgba(244,244,245,1)",priceActiveColor:"rgba(244,244,245,1)"},kalshi:{text:"#00d492",border:"rgba(0,212,146,0.15)",hoverBorder:"rgba(0,212,146,0.3)",bg:"rgba(0,212,146,0.05)",priceColor:"#00d492",priceActiveColor:"#00d492"}},Zp={text:"#9ca3af",border:"rgba(156,163,175,0.15)",hoverBorder:"rgba(156,163,175,0.3)",bg:"rgba(156,163,175,0.05)",priceColor:"rgba(244,244,245,1)",priceActiveColor:"rgba(244,244,245,1)"};function Jp(e){return Xp[e]??Zp}function em(e){if(!e.matched_markets?.length)return null;let t=null,r=-1;for(let o of e.matched_markets){let n=o.spread??0;n>r&&(r=n,t=o);}return t}function tm(e,t){let r=e.entries.find(a=>a.source===(t?.source_a??e.entries[0]?.source)),o=e.entries.find(a=>a.source===(t?.source_b??e.entries[1]?.source)),n=a=>{if(!a?.outcomes?.[0])return {name:null,price:null};let s=a.outcomes[0];return {name:s.label||null,price:s.best_ask??s.price??null}},i=n(t?.market_a),l=n(t?.market_b);return [{source:t?.source_a??r?.source??"unknown",outcomeName:i.name,yesPrice:i.price,volume:r?.event?.volume??null,event:r?.event},{source:t?.source_b??o?.source??"unknown",outcomeName:l.name,yesPrice:l.price,volume:o?.event?.volume??null,event:o?.event}]}function Qv({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:o}){let {t:n}=i18n.useTranslation(),i=react.useMemo(()=>em(e),[e]),l=e.max_spread!=null?e.max_spread*100:null,[a,s]=react.useMemo(()=>tm(e,i),[e,i]),c=l!=null&&l>=3;a.yesPrice!=null&&s.yesPrice!=null?a.source==="kalshi"?a.yesPrice>s.yesPrice:s.yesPrice>a.yesPrice:false;let p=a.yesPrice!=null&&s.yesPrice!=null?a.yesPrice<=s.yesPrice?a:s:null,u=p?ft(p.source):null,m=c?"amber":"violet";return jsxRuntime.jsxs("div",{className:"group",style:{borderRadius:16,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",position:"relative"},onMouseEnter:f=>{let g=f.currentTarget;g.style.borderColor="rgba(63,63,70,0.6)",g.style.boxShadow="0 10px 15px -3px rgba(0,0,0,0.2)";},onMouseLeave:f=>{let g=f.currentTarget;g.style.borderColor="rgba(39,39,42,0.6)",g.style.boxShadow="none";},children:[l!=null&&jsxRuntime.jsxs("span",{style:{position:"absolute",top:12,right:12,zIndex:10,display:"inline-flex",alignItems:"center",gap:4,borderRadius:10,padding:"4px 10px",fontSize:12,fontWeight:600,border:`1px solid ${c?"rgba(255,185,0,0.3)":l>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:c?"rgba(255,185,0,0.15)":l>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:c?"#ffb900":l>=2?"#a684ff":"#9ca3af"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),l.toFixed(1),"%"]}),jsxRuntime.jsxs("div",{style:{padding:16},children:[jsxRuntime.jsx("h3",{style:{fontSize:14,fontWeight:600,lineHeight:1.375,letterSpacing:"-0.28px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",paddingRight:80,margin:"0 0 16px"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[jsxRuntime.jsx(ga,{data:a,isCheaper:p===a,onSelect:t,getEventHref:r,LinkComponent:o}),jsxRuntime.jsx(ga,{data:s,isCheaper:p===s,onSelect:t,getEventHref:r,LinkComponent:o})]}),p&&u&&l!=null&&jsxRuntime.jsxs("div",{style:{marginTop:12,padding:"8px 12px",borderRadius:10,display:"flex",alignItems:"center",gap:8,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${m==="amber"?"rgba(255,185,0,0.15)":"rgba(166,132,255,0.15)"}`,background:m==="amber"?"rgba(255,185,0,0.05)":"rgba(166,132,255,0.05)"},onClick:()=>p.event&&t?.(p.event),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:m==="amber"?"#ffb900":"#a684ff"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:m==="amber"?"rgba(255,185,0,0.9)":"rgba(166,132,255,0.9)"},children:n("predict.matches.buyEdge",{platform:p.source.charAt(0).toUpperCase()+p.source.slice(1),spread:l.toFixed(1)})}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,marginLeft:"auto",color:m==="amber"?"rgba(255,185,0,0.5)":"rgba(166,132,255,0.5)"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M5 12h14"}),jsxRuntime.jsx("path",{d:"m12 5 7 7-7 7"})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.2)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),Tn(e.combined_volume)]}),e.combined_volume_24h!=null&&e.combined_volume_24h>0&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z"})}),Tn(e.combined_volume_24h)," ",n("predict.matches.vol24h")]})]}),e.confidence!=null&&jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4,fontSize:10,color:"#52525b"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"})}),Math.round(e.confidence*100),"%"," ",n("predict.matches.match")]})]})]})}function ga({data:e,isCheaper:t,onSelect:r,getEventHref:o,LinkComponent:n}){let{t:i}=i18n.useTranslation(),l=ft(e.source),a=Jp(e.source),s=e.event?o?.(e.event):void 0,c=jsxRuntime.jsxs("div",{style:{borderRadius:14,border:`1px solid ${a.border}`,background:a.bg,padding:12,cursor:s||r?"pointer":void 0,transition:"border-color 0.15s"},onMouseEnter:d=>{d.currentTarget.style.borderColor=a.hoverBorder;},onMouseLeave:d=>{d.currentTarget.style.borderColor=a.border;},onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[l.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.05em",color:a.text,textTransform:"uppercase"},children:l.label}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",marginLeft:"auto"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})]}),e.outcomeName&&jsxRuntime.jsx("div",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:e.outcomeName}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[jsxRuntime.jsx("span",{style:{fontSize:20,fontWeight:700,fontVariantNumeric:"tabular-nums",color:t?a.priceActiveColor:a.priceColor},children:e.yesPrice!=null?(e.yesPrice*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a"},children:i("predict.matches.centsYes")})]}),jsxRuntime.jsxs("div",{style:{fontSize:10,color:"#52525b",marginTop:6},children:[Tn(e.volume)," ",i("predict.matches.volume")]})]});return s&&n?jsxRuntime.jsx(n,{href:s,className:"block",children:c}):c}function om(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}function tb({matches:e,total:t}){let{t:r}=i18n.useTranslation(),o=react.useMemo(()=>{let n=0,i=0,l=new Set;for(let a of e){a.max_spread!=null&&a.max_spread>n&&(n=a.max_spread),a.combined_volume!=null&&(i+=a.combined_volume);for(let s of a.entries)l.add(typeof s.source=="string"?s.source:"");}return {count:t??e.length,maxSpread:n,totalVolume:i,platformCount:l.size}},[e,t]);return jsxRuntime.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2 rounded-xl border border-border/60 bg-background/50 px-4 py-3 text-sm",children:[jsxRuntime.jsx(Er,{label:r("predict.matches.stats.matchedMarkets"),value:o.count.toLocaleString()}),jsxRuntime.jsx(Ln,{}),jsxRuntime.jsx(Er,{label:r("predict.matches.stats.totalVolume"),value:om(o.totalVolume)}),jsxRuntime.jsx(Ln,{}),jsxRuntime.jsx(Er,{label:r("predict.matches.stats.highestSpread"),value:`${(o.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(Ln,{}),jsxRuntime.jsx(Er,{label:r("predict.matches.stats.platforms"),value:String(o.platformCount)})]})}function Er({label:e,value:t,valueClassName:r="text-slate-200"}){return jsxRuntime.jsxs("div",{className:"flex items-center gap-x-1.5",children:[jsxRuntime.jsxs("span",{className:"text-neutral-500",children:[e,":"]}),jsxRuntime.jsx("span",{className:`font-semibold ${r}`,children:t})]})}function Ln(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function va(e){return `${(e*100).toFixed(1)}\xA2`}function sm(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function sb({spread:e,arbProfit:t,className:r}){if(e==null)return null;let o=t!=null&&t>0;return jsxRuntime.jsxs("div",{className:ui.cn("flex items-center gap-x-2",r),children:[jsxRuntime.jsx("span",{className:ui.cn("text-sm font-semibold",sm(e)),children:va(e)}),o&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",va(t)]})]})}var qt=10,um=64,Sa=40,Tr=48;function Na({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:o}=i18n.useTranslation(),[n,i]=react.useState(1),{data:l,isLoading:a,fetchNextPage:s,hasNextPage:c,isFetchingNextPage:d}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:p,isLoading:u,fetchNextPage:m,hasNextPage:f,isFetchingNextPage:g}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),h=a||u,x=d||g,C=c||f,b=react.useMemo(()=>{let w=[];return l?.pages&&w.push(...l.pages.flatMap(F=>F.items)),p?.pages&&w.push(...p.pages.flatMap(F=>F.items)),w.sort((F,B)=>(B.timestamp??0)-(F.timestamp??0)),w},[l,p]),N=Math.max(1,Math.ceil(b.length/qt)+(C?1:0)),v=(n-1)*qt,H=b.slice(v,v+qt),y=react.useCallback(()=>{i(w=>Math.max(1,w-1));},[]),G=react.useCallback(async()=>{n*qt>=b.length&&C&&(c&&await s(),f&&await m()),i(F=>F+1);},[n,b.length,C,c,f,s,m]),K=n>1,oe=n*qt<b.length||C;if(h)return jsxRuntime.jsx(xm,{height:r});if(b.length===0&&!C)return jsxRuntime.jsx(hm,{message:o("predict.profile.noHistory"),height:r});let we=r-Sa-Tr;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:Sa},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:o("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.profile.status")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.price")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:o("predict.profile.depositWithdraw")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.fee")}),jsxRuntime.jsx("div",{className:"w-10 shrink-0"})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:we},children:[H.map((w,F)=>jsxRuntime.jsx(pm,{trade:w},w.id??`${v+F}`)),x&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:Tr},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!K,onClick:y,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",K?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",o("predict.profile.previous")]}),Array.from({length:Math.min(N,5)},(w,F)=>{let B=F+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>i(B),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",B===n?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:B},B)}),jsxRuntime.jsxs("button",{type:"button",disabled:!oe,onClick:G,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",oe?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[o("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Tr},children:H.map((w,F)=>jsxRuntime.jsx(mm,{trade:w},w.id??`m-${v+F}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:Tr},children:[jsxRuntime.jsx("button",{type:"button",disabled:!K,onClick:y,className:ui.cn("text-sm cursor-pointer",K?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:n}),jsxRuntime.jsx("button",{type:"button",disabled:!oe,onClick:G,className:ui.cn("text-sm cursor-pointer",oe?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function pm({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",o=e.price??0,n=e.usd_size??0,i=Pa(e.type,t),l=r,a=l?"+":"-",s=l?"text-success":"text-foreground",c=e.event?.title??e.market?.question??"\u2014",d=e.event?.image_url,p=e.outcome??"",u=Ea(e.timestamp),m=wa(e),f=fm(e),g=gm(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:um},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[d&&jsxRuntime.jsx("img",{src:d,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:c}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[p&&jsxRuntime.jsx("span",{className:"mr-1",children:p}),jsxRuntime.jsx("span",{children:u})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("text-sm font-medium",r?"text-success":"text-danger"),children:t(r?"predict.profile.buy":"predict.profile.sell")})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-sm text-foreground",children:i}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Ma(o)}),jsxRuntime.jsx("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",s),children:n>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[a,"$",n.toFixed(2)]}):"\u2014"}),jsxRuntime.jsx("div",{className:ui.cn("flex-1 pr-2 text-right font-mono",f!==null?f>=0?"text-success":"text-danger":"text-neutral"),children:f!==null?`${f>=0?"+":"-"}$${Math.abs(f).toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-neutral",children:g!==null?`$${g.toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"w-10 shrink-0 text-right",children:m&&jsxRuntime.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:"text-neutral hover:text-foreground transition-colors","aria-label":"View transaction",children:jsxRuntime.jsx(Ca,{})})})]})}function mm({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",o=e.price??0,n=e.usd_size??0,i=Pa(e.type,t),l=e.event?.title??e.market?.question??"\u2014",a=Ea(e.timestamp),s=wa(e);return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-start justify-between gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.event?.image_url&&jsxRuntime.jsx("img",{src:e.event.image_url,alt:"",className:"w-6 h-6 rounded-full object-cover shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground line-clamp-2",children:l})]}),jsxRuntime.jsx("span",{className:"text-[11px] text-neutral whitespace-nowrap",children:a})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.action")}),jsxRuntime.jsx("span",{className:ui.cn("font-medium",r?"text-success":"text-danger"),children:t(r?"predict.profile.buy":"predict.profile.sell")})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.status")}),jsxRuntime.jsx("span",{className:"text-foreground",children:i})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.price")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:Ma(o)})]}),jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:t("predict.profile.depositWithdraw")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:n>0?`$${n.toFixed(2)}`:"\u2014"})]}),s&&jsxRuntime.jsx("a",{href:s,target:"_blank",rel:"noopener noreferrer",className:"ml-auto text-neutral hover:text-foreground transition-colors",children:jsxRuntime.jsx(Ca,{})})]})]})}function Pa(e,t){switch(e){case "TRADE":return t("predict.profile.filled");case "REDEEM":return t("predict.profile.claimed");case "SPLIT":case "MERGE":case "CONVERSION":return t("predict.profile.created");default:return e}}function wa(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function fm(e){let t=e.provider_meta;if(t){let r=t.pnl??t.profit??t.realized_pnl??t["dflow.pnl"];if(typeof r=="number")return r;if(typeof r=="string"&&r!==""){let o=parseFloat(r);if(!Number.isNaN(o))return o}}return e.type==="REDEEM"&&e.usd_size!=null?e.usd_size:null}function gm(e){let t=e.provider_meta;if(t){let r=t.fee??t.fees??t.trading_fee??t["dflow.fee"];if(typeof r=="number")return r;if(typeof r=="string"&&r!==""){let o=parseFloat(r);if(!Number.isNaN(o))return o}}return null}function Ca(){return jsxRuntime.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),jsxRuntime.jsx("polyline",{points:"15 3 21 3 21 9"}),jsxRuntime.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}function hm({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function xm({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Ma(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Ea(e){let t=new Date(e*1e3),r=t.getHours().toString().padStart(2,"0"),o=t.getMinutes().toString().padStart(2,"0"),n=t.getDate().toString().padStart(2,"0"),i=(t.getMonth()+1).toString().padStart(2,"0"),l=t.getFullYear(),a=t.getTimezoneOffset(),s=a<=0?"+":"-",c=String(Math.abs(Math.floor(a/60))).padStart(2,"0");return `${r}:${o} ${n}/${i}/${l} (${s}${c})`}var Qt=10,Pm=64,La=40,Lr=48;function Ra({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:o}=i18n.useTranslation(),n=reactPredict.useCancelOrder(),[i,l]=react.useState(1),{data:a,isLoading:s,fetchNextPage:c,hasNextPage:d,isFetchingNextPage:p}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:u,isLoading:m,fetchNextPage:f,hasNextPage:g,isFetchingNextPage:h}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),x=s||m,C=p||h,b=d||g,N=react.useMemo(()=>{let B=[],se=new Set(["live","open","submitted","pending"]);return a?.pages&&B.push(...a.pages.flatMap(ae=>ae.items).filter(ae=>se.has(ae.status))),u?.pages&&B.push(...u.pages.flatMap(ae=>ae.items).filter(ae=>se.has(ae.status))),B},[a,u]),v=react.useCallback(B=>{n.mutate({source:B.source,id:B.id});},[n]),H=Math.max(1,Math.ceil(N.length/Qt)+(b?1:0)),y=(i-1)*Qt,G=N.slice(y,y+Qt),K=react.useCallback(()=>{l(B=>Math.max(1,B-1));},[]),oe=react.useCallback(async()=>{i*Qt>=N.length&&b&&(d&&await c(),g&&await f()),l(se=>se+1);},[i,N.length,b,d,g,c,f]),we=i>1,w=i*Qt<N.length||b;if(x)return jsxRuntime.jsx(Em,{height:r});if(N.length===0&&!b)return jsxRuntime.jsx(Mm,{message:o("predict.profile.noOrders"),height:r});let F=r-La-Lr;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:La},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:o("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.profile.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.fillPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.profile.cost")})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:F},children:[G.map(B=>jsxRuntime.jsx(wm,{order:B,onCancel:v},B.id)),C&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsx(_a,{className:"hidden lg:flex",currentPage:i,totalPages:H,canGoPrev:we,canGoNext:w,onPrev:K,onNext:oe,onPage:l,t:o}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Lr},children:G.map(B=>jsxRuntime.jsx(Cm,{order:B,onCancel:v},B.id))}),jsxRuntime.jsx(_a,{className:"lg:hidden",currentPage:i,totalPages:H,canGoPrev:we,canGoNext:w,onPrev:K,onNext:oe,onPage:l,t:o,compact:true})]})}function wm({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),o=e.side==="BUY",n=e.price?parseFloat(e.price):0,i=e.in_amount?parseFloat(e.in_amount):n*parseFloat(e.original_size??"0");return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:Pm},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium",children:e.outcome??e.market_id??"\u2014"})})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui.cn("text-sm font-medium",o?"text-success":"text-danger"),children:r(o?"predict.profile.buy":"predict.profile.sell")})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize text-sm",children:e.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:n>0?Ia(n):"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]})}function Cm({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),o=e.side==="BUY",n=e.price?parseFloat(e.price):0;return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("span",{className:ui.cn("text-xs font-medium px-1.5 py-0.5 rounded",o?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:e.side}),jsxRuntime.jsx("span",{className:"text-sm text-foreground capitalize",children:e.outcome??"\u2014"})]}),jsxRuntime.jsx("span",{className:"text-xs text-neutral capitalize",children:e.order_type??"limit"})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs",children:[jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.profile.fillPrice")}),jsxRuntime.jsx("span",{className:"font-mono text-foreground",children:n>0?Ia(n):"\u2014"})]}),jsxRuntime.jsx("div",{className:"flex-1"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>t(e),className:"text-xs text-danger hover:text-danger/80 cursor-pointer border border-border rounded px-2 py-1",children:r("predict.orders.cancel")})]})]})}function _a({className:e,currentPage:t,totalPages:r,canGoPrev:o,canGoNext:n,onPrev:i,onNext:l,onPage:a,t:s,compact:c}){return c?jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-3 shrink-0",e),style:{height:Lr},children:[jsxRuntime.jsx("button",{type:"button",disabled:!o,onClick:i,className:ui.cn("text-sm cursor-pointer",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:t}),jsxRuntime.jsx("button",{type:"button",disabled:!n,onClick:l,className:ui.cn("text-sm cursor-pointer",n?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]}):jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-2 shrink-0",e),style:{height:Lr},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!o,onClick:i,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",s("predict.profile.previous")]}),Array.from({length:Math.min(r,5)},(d,p)=>{let u=p+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>a(u),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",u===t?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:u},u)}),jsxRuntime.jsxs("button",{type:"button",disabled:!n,onClick:l,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",n?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[s("predict.profile.next")," \u2192"]})]})}function Mm({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Em({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Ia(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}var An=10,Rm=64,Oa=40,_r=48;function Aa({positions:e,isLoading:t,listHeight:r,onClosePosition:o,onEventClick:n}){let{t:i}=i18n.useTranslation(),[l,a]=react.useState(1),s=react.useCallback(()=>{for(let g of e)o?.(g);},[e,o]);if(t)return jsxRuntime.jsx(Dm,{height:r});if(e.length===0)return jsxRuntime.jsx(Am,{message:i("predict.profile.noPositions"),height:r});let c=Math.max(1,Math.ceil(e.length/An)),d=(l-1)*An,p=e.slice(d,d+An),u=l>1,m=l<c,f=r-Oa-_r;return jsxRuntime.jsxs("div",{className:"flex flex-col",style:{height:r},children:[jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center text-neutral text-xs font-normal shrink-0 border-b border-border/50",style:{height:Oa},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:i("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.markPrice")}),jsxRuntime.jsxs("div",{className:"flex-[1.5] pr-2 text-right",children:[jsxRuntime.jsx("span",{children:i("predict.profile.pnl")}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",i("predict.profile.pnlExcludeFees"),")"]})]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:i("predict.profile.estSettlement")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:o&&e.length>0&&jsxRuntime.jsx("button",{type:"button",onClick:s,className:"text-xs text-primary hover:text-primary/80 cursor-pointer transition-colors",children:i("predict.profile.closeAll")})})]}),jsxRuntime.jsx("div",{className:"hidden lg:block overflow-y-auto",style:{height:f},children:p.map((g,h)=>jsxRuntime.jsx(Im,{position:g,onClosePosition:o,onEventClick:n},`${g.source}-${g.market?.slug??d+h}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:_r},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!u,onClick:()=>a(g=>Math.max(1,g-1)),className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",u?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",i("predict.profile.previous")]}),Array.from({length:Math.min(c,5)},(g,h)=>{let x=h+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>a(x),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",x===l?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:x},x)}),jsxRuntime.jsxs("button",{type:"button",disabled:!m,onClick:()=>a(g=>g+1),className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",m?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[i("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-_r},children:p.map((g,h)=>jsxRuntime.jsx(Om,{position:g,onClose:o,onEventClick:n},`${g.source}-${g.market?.slug??`m-${d+h}`}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:_r},children:[jsxRuntime.jsx("button",{type:"button",disabled:!u,onClick:()=>a(g=>Math.max(1,g-1)),className:ui.cn("text-sm cursor-pointer",u?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:l}),jsxRuntime.jsx("button",{type:"button",disabled:!m,onClick:()=>a(g=>g+1),className:ui.cn("text-sm cursor-pointer",m?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function Im({position:e,onClosePosition:t,onEventClick:r}){let{t:o}=i18n.useTranslation(),n=e.pnl??0,i=e.pnl_percent??0,l=e.avg_price??0,a=e.current_price??0,s=e.current_value??e.size*a,c=e.size,d=n>0?"text-success":n<0?"text-danger":"text-foreground",p=n>0?"+":"",u=e.event?.title??e.market?.question??"\u2014",m=e.event?.image_url,f=e.side,g=e.market?.outcomes?.[0]?.label??"",h=e.market?.end_at?Fm(e.market.end_at):"\u2014";return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:Rm},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-2.5 min-w-0 cursor-pointer text-left",onClick:()=>e.event&&r?.(e.event),children:[m&&jsxRuntime.jsx("img",{src:m,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:u}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[jsxRuntime.jsx("span",{className:ui.cn("font-medium",f.toLowerCase()==="yes"?"text-success":"text-danger"),children:f}),g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1",children:"\xB7"}),jsxRuntime.jsx("span",{children:g})]})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:jsxRuntime.jsxs("div",{className:"flex flex-col items-end",children:[jsxRuntime.jsxs("span",{className:"font-mono text-foreground",children:["$",s.toFixed(2)]}),jsxRuntime.jsx("span",{className:"text-[10px] text-neutral",children:o("predict.profile.contracts",{count:e.size})})]})}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",(e.size*l).toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Dn(l)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Dn(a)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",d),children:[jsxRuntime.jsxs("span",{children:[p,"$",Math.abs(n).toFixed(2)]}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",p,i.toFixed(2),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",c.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap text-xs",children:h}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:t&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>t(e),className:"inline-flex items-center gap-1 text-xs text-neutral hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{className:"text-danger",children:"\u2715"}),o("predict.profile.close")]})})]})}function Om({position:e,onClose:t,onEventClick:r}){let{t:o}=i18n.useTranslation(),n=e.pnl??0,i=e.pnl_percent??0,l=e.current_price??0,a=n>0?"text-success":n<0?"text-danger":"text-foreground",s=n>0?"+":"",c=e.event?.title??e.market?.question??"\u2014";return jsxRuntime.jsxs("div",{className:"rounded-lg border border-border bg-content1 p-3 flex flex-col gap-2",children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-start justify-between gap-2 text-left cursor-pointer",onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.event?.image_url&&jsxRuntime.jsx("img",{src:e.event.image_url,alt:"",className:"w-7 h-7 rounded-full object-cover shrink-0"}),jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground line-clamp-2",children:c})]}),jsxRuntime.jsx("span",{className:ui.cn("shrink-0 text-xs font-medium px-1.5 py-0.5 rounded",e.side.toLowerCase()==="yes"?"bg-success/10 text-success":"bg-danger/10 text-danger"),children:e.side})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-4 text-xs flex-wrap",children:[jsxRuntime.jsx(Rr,{label:o("predict.profile.totalSize"),value:`${e.size}`}),jsxRuntime.jsx(Rr,{label:o("predict.profile.markPrice"),value:Dn(l)}),jsxRuntime.jsx(Rr,{label:o("predict.profile.pnl"),value:`${s}$${Math.abs(n).toFixed(2)} (${s}${i.toFixed(1)}%)`,className:a}),jsxRuntime.jsx(Rr,{label:o("predict.profile.payoutIfRight"),value:`$${e.size.toFixed(2)}`})]}),t&&jsxRuntime.jsx("div",{className:"flex justify-end",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>t(e),className:"text-xs text-danger hover:text-danger/80 cursor-pointer transition-colors border border-border rounded px-2 py-1",children:o("predict.profile.close")})})]})}function Rr({label:e,value:t,className:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col",children:[jsxRuntime.jsx("span",{className:"text-neutral",children:e}),jsxRuntime.jsx("span",{className:ui.cn("font-mono text-foreground",r),children:t})]})}function Am({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Dm({height:e}){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:e},children:Array.from({length:6}).map((t,r)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Dn(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Fm(e){try{let t=new Date(e),r=t.getHours().toString().padStart(2,"0"),o=t.getMinutes().toString().padStart(2,"0"),n=t.getDate().toString().padStart(2,"0"),i=(t.getMonth()+1).toString().padStart(2,"0"),l=t.getFullYear(),a=t.getTimezoneOffset(),s=a<=0?"+":"-",c=String(Math.abs(Math.floor(a/60))).padStart(2,"0");return `${r}:${o} ${n}/${i}/${l} (${s}${c})`}catch{return "\u2014"}}function Fa({positions:e,trades:t,isLoading:r}){let{t:o}=i18n.useTranslation(),n=react.useMemo(()=>{let a=0,s=0;for(let m of e)a+=m.realized_pnl??0,s+=m.current_value??m.size*(m.current_price??0);let c=0,d=0,p=0;for(let m of t)c+=m.usd_size??0,m.type==="REDEEM"&&(p++,(m.usd_size??0)>0&&d++);let u=p>0?`${d} / ${p}`:"0 / 0";return {realizedPnl:a,positionsValue:s,volume:c,winRateStr:u}},[e,t]),i=n.realizedPnl>0?"text-success":n.realizedPnl<0?"text-danger":"text-foreground",l=n.realizedPnl>0?"+":"";return jsxRuntime.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 py-8",children:[jsxRuntime.jsxs("div",{className:"flex flex-col gap-1",children:[jsxRuntime.jsx("span",{className:"text-xl text-neutral",children:o("predict.profile.realizedPnl")}),r?jsxRuntime.jsx(ui.Skeleton,{className:"h-14 w-48 rounded-md"}):jsxRuntime.jsxs("span",{className:ui.cn("text-5xl font-bold tabular-nums",i),children:[l,"$",Math.abs(n.realizedPnl).toFixed(2)]})]}),jsxRuntime.jsxs("div",{className:"flex items-end gap-8 sm:gap-10",children:[jsxRuntime.jsx(Bn,{label:o("predict.profile.winRate"),value:n.winRateStr,isLoading:r}),jsxRuntime.jsx(Bn,{label:o("predict.profile.positions"),value:`$${n.positionsValue.toFixed(2)}`,isLoading:r}),jsxRuntime.jsx(Bn,{label:o("predict.profile.volume"),value:`$${n.volume.toFixed(2)}`,isLoading:r})]})]})}function Bn({label:e,value:t,isLoading:r}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-end gap-0.5",children:[jsxRuntime.jsx("span",{className:"text-sm text-neutral whitespace-nowrap",children:e}),r?jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-14 rounded-md"}):jsxRuntime.jsx("span",{className:"text-base font-semibold tabular-nums text-foreground",children:t})]})}var Hn=600;function Vm({solanaAddress:e,evmAddress:t,onClosePosition:r,onEventClick:o}){let{t:n}=i18n.useTranslation(),[i,l]=react.useState("positions"),a=!!(e||t),{data:s,isLoading:c}=reactPredict.usePositions({source:"kalshi",user:e??""}),{data:d,isLoading:p}=reactPredict.usePositions({source:"polymarket",user:t??""}),u=react.useMemo(()=>{let y=[];return s?.positions&&y.push(...s.positions),d?.positions&&y.push(...d.positions),y},[s,d]),m=c||p,{data:f,isLoading:g}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:h,isLoading:x}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),C=react.useMemo(()=>[...f?.pages?.flatMap(G=>G.items)??[],...h?.pages?.flatMap(G=>G.items)??[]],[f,h]),b=m||g||x,N=u.length,H=[{key:"positions",label:N>0?`${n("predict.profile.positionsTab")} (${N})`:n("predict.profile.positionsTab")},{key:"orders",label:n("predict.profile.openOrdersTab")},{key:"history",label:n("predict.profile.historyTab")}];return a?jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[1280px] mx-auto w-full px-4 max-sm:px-2",children:[jsxRuntime.jsx(Fa,{positions:u,trades:C,isLoading:b}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:H.map(y=>jsxRuntime.jsx("button",{type:"button",onClick:()=>l(y.key),className:ui.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",i===y.key?"text-foreground border-b-2 border-foreground":"text-neutral hover:text-foreground"),children:y.label},y.key))}),jsxRuntime.jsxs("div",{className:"py-2",children:[i==="positions"&&jsxRuntime.jsx(Aa,{positions:u,isLoading:m,listHeight:Hn,onClosePosition:r,onEventClick:o}),i==="orders"&&jsxRuntime.jsx(Ra,{solanaAddress:e,evmAddress:t,listHeight:Hn}),i==="history"&&jsxRuntime.jsx(Na,{solanaAddress:e,evmAddress:t,listHeight:Hn})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:n("predict.profile.connectWallet")})}function zn(e){return e==="done"?"\u2705":e==="running"?null:"\u23F3"}function ty({isOpen:e,onClose:t,evmAddress:r,safeDeployed:o,tokenApproved:n,keysConnected:i,onDeployAndApprove:l,onConnectKeys:a}){let{t:s}=i18n.useTranslation(),[c,d]=react.useState(false),[p,u]=react.useState(false),[m,f]=react.useState(null),g=o?"done":c?"running":"pending",h=n?"done":o&&c?"running":"pending",x=i?"done":p?"running":"pending",C=o&&n&&i,b=react.useCallback(async()=>{f(null),d(true);try{await l();}catch(v){f(v instanceof Error?v.message:String(v));}finally{d(false);}},[l]),N=react.useCallback(async()=>{f(null),u(true);try{a&&await a();}catch(v){f(v instanceof Error?v.message:String(v));}finally{u(false);}},[a]);return jsxRuntime.jsx(ui.Modal,{isOpen:e,onClose:t,size:"md",children:jsxRuntime.jsxs(ui.ModalContent,{children:[jsxRuntime.jsx(ui.ModalHeader,{className:"flex flex-col gap-1",children:jsxRuntime.jsxs("span",{className:"text-lg",children:["\u{1F527} ",s("predict.setup.modalTitle","Polymarket Wallet Setup")]})}),jsxRuntime.jsxs(ui.ModalBody,{className:"gap-y-4",children:[jsxRuntime.jsx("p",{className:"text-sm text-default-600",children:s("predict.setup.modalDescription","Complete these steps to trade on Polymarket. Gas fees are covered.")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3 rounded-lg border border-default-200 p-3",children:[jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-default-100 text-sm font-bold",children:g==="running"?jsxRuntime.jsx(ui.Spinner,{size:"sm"}):zn(g)}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:s("predict.setup.step1","Deploy Safe Wallet")}),jsxRuntime.jsx("p",{className:"text-xs text-default-400",children:g==="done"?s("predict.setup.stepComplete","Complete"):g==="running"?s("predict.setup.stepRunning","Processing..."):s("predict.setup.stepPending","Pending")})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3 rounded-lg border border-default-200 p-3",children:[jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-default-100 text-sm font-bold",children:h==="running"?jsxRuntime.jsx(ui.Spinner,{size:"sm"}):zn(h)}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:s("predict.setup.step2","Approve USDC")}),jsxRuntime.jsx("p",{className:"text-xs text-default-400",children:h==="done"?s("predict.setup.stepComplete","Complete"):h==="running"?s("predict.setup.stepRunning","Processing..."):s("predict.setup.stepPending","Pending")})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-3 rounded-lg border border-default-200 p-3",children:[jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-default-100 text-sm font-bold",children:x==="running"?jsxRuntime.jsx(ui.Spinner,{size:"sm"}):zn(x)}),jsxRuntime.jsxs("div",{className:"flex-1",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:s("predict.setup.step3","Connect API Keys")}),jsxRuntime.jsx("p",{className:"text-xs text-default-400",children:x==="done"?s("predict.setup.stepComplete","Complete"):x==="running"?s("predict.setup.stepRunning","Processing..."):s("predict.setup.stepPending","Pending")})]})]}),m&&jsxRuntime.jsx("p",{className:"text-xs text-danger",children:m})]}),jsxRuntime.jsxs(ui.ModalFooter,{children:[jsxRuntime.jsx(ui.Button,{variant:"light",onPress:t,children:s("common.cancel","Cancel")}),C?jsxRuntime.jsx(ui.Button,{color:"success",onPress:t,children:s("predict.setup.done","Done")}):!o||!n?jsxRuntime.jsx(ui.Button,{color:"primary",isLoading:c,onPress:b,children:s("predict.setup.setupButton","Set Up Wallet")}):jsxRuntime.jsx(ui.Button,{color:"primary",isLoading:p,onPress:N,children:s("predict.setup.connectButton","Connect API")})]})]})})}
|
|
50
50
|
Object.defineProperty(exports,"PredictClient",{enumerable:true,get:function(){return reactPredict.PredictClient}});Object.defineProperty(exports,"PredictContext",{enumerable:true,get:function(){return reactPredict.PredictContext}});Object.defineProperty(exports,"PredictProvider",{enumerable:true,get:function(){return reactPredict.PredictProvider}});Object.defineProperty(exports,"PredictWsClient",{enumerable:true,get:function(){return reactPredict.PredictWsClient}});Object.defineProperty(exports,"createPredictClient",{enumerable:true,get:function(){return reactPredict.createPredictClient}});Object.defineProperty(exports,"createPredictWsClient",{enumerable:true,get:function(){return reactPredict.createPredictWsClient}});Object.defineProperty(exports,"fetchMatchMarketsPage",{enumerable:true,get:function(){return reactPredict.fetchMatchMarketsPage}});Object.defineProperty(exports,"fetchMatchesPage",{enumerable:true,get:function(){return reactPredict.fetchMatchesPage}});Object.defineProperty(exports,"matchMarketsQueryKey",{enumerable:true,get:function(){return reactPredict.matchMarketsQueryKey}});Object.defineProperty(exports,"matchQueryKey",{enumerable:true,get:function(){return reactPredict.matchQueryKey}});Object.defineProperty(exports,"matchesQueryKey",{enumerable:true,get:function(){return reactPredict.matchesQueryKey}});Object.defineProperty(exports,"useBalance",{enumerable:true,get:function(){return reactPredict.useBalance}});Object.defineProperty(exports,"useCancelOrder",{enumerable:true,get:function(){return reactPredict.useCancelOrder}});Object.defineProperty(exports,"useCandlesticks",{enumerable:true,get:function(){return reactPredict.useCandlesticks}});Object.defineProperty(exports,"useDFlowKYC",{enumerable:true,get:function(){return reactPredict.useDFlowKYC}});Object.defineProperty(exports,"useDFlowQuote",{enumerable:true,get:function(){return reactPredict.useDFlowQuote}});Object.defineProperty(exports,"useDFlowSubmit",{enumerable:true,get:function(){return reactPredict.useDFlowSubmit}});Object.defineProperty(exports,"useEvent",{enumerable:true,get:function(){return reactPredict.useEvent}});Object.defineProperty(exports,"useEvents",{enumerable:true,get:function(){return reactPredict.useEvents}});Object.defineProperty(exports,"useInfiniteEvents",{enumerable:true,get:function(){return reactPredict.useInfiniteEvents}});Object.defineProperty(exports,"useInfiniteMatchMarkets",{enumerable:true,get:function(){return reactPredict.useInfiniteMatchMarkets}});Object.defineProperty(exports,"useInfiniteMatches",{enumerable:true,get:function(){return reactPredict.useInfiniteMatches}});Object.defineProperty(exports,"useInfiniteOrders",{enumerable:true,get:function(){return reactPredict.useInfiniteOrders}});Object.defineProperty(exports,"useInfiniteTrades",{enumerable:true,get:function(){return reactPredict.useInfiniteTrades}});Object.defineProperty(exports,"useMarket",{enumerable:true,get:function(){return reactPredict.useMarket}});Object.defineProperty(exports,"useMarketHistory",{enumerable:true,get:function(){return reactPredict.useMarketHistory}});Object.defineProperty(exports,"useMarketTrades",{enumerable:true,get:function(){return reactPredict.useMarketTrades}});Object.defineProperty(exports,"useMatch",{enumerable:true,get:function(){return reactPredict.useMatch}});Object.defineProperty(exports,"useOrder",{enumerable:true,get:function(){return reactPredict.useOrder}});Object.defineProperty(exports,"useOrderbook",{enumerable:true,get:function(){return reactPredict.useOrderbook}});Object.defineProperty(exports,"useOrders",{enumerable:true,get:function(){return reactPredict.useOrders}});Object.defineProperty(exports,"usePositions",{enumerable:true,get:function(){return reactPredict.usePositions}});Object.defineProperty(exports,"usePredictClient",{enumerable:true,get:function(){return reactPredict.usePredictClient}});Object.defineProperty(exports,"usePriceHistory",{enumerable:true,get:function(){return reactPredict.usePriceHistory}});Object.defineProperty(exports,"useSearchEvents",{enumerable:true,get:function(){return reactPredict.useSearchEvents}});Object.defineProperty(exports,"useSimilarEvents",{enumerable:true,get:function(){return reactPredict.useSimilarEvents}});Object.defineProperty(exports,"useTrades",{enumerable:true,get:function(){return reactPredict.useTrades}});exports.CHART_RANGE_DURATION=hf;exports.CHART_RANGE_PERIOD=ff;exports.CHART_RANGE_SAMPLE_INTERVAL=gf;exports.CandlestickPeriod=sr;exports.CategoriesSkeleton=of;exports.CategoriesUI=oo;exports.CategoriesWidget=io;exports.ChartRange=Me;exports.DEFAULT_CHART_RANGE=ar;exports.DEFAULT_FILTER_STATE=Xr;exports.DEFAULT_PAGE_SIZE=Rt;exports.DEFAULT_PRICE_HISTORY_INTERVAL=yf;exports.EventDetailPage=yh;exports.EventDetailSkeleton=Wt;exports.EventDetailUI=Ms;exports.EventDetailWidget=Es;exports.EventItem=Go;exports.EventMarketDepthChartUI=ps;exports.EventMarketDetailWidget=xs;exports.EventPriceChart=ys;exports.EventsFilterUI=To;exports.EventsPage=o0;exports.EventsPageSkeleton=Mg;exports.EventsSkeleton=Jr;exports.EventsToolbarUI=Oo;exports.EventsUI=Jo;exports.EventsWidget=ts;exports.KycModal=bo;exports.MAX_PRICE_HISTORY_MARKETS=Ur;exports.MatchGroupCard=Qv;exports.MatchMarketCard=da;exports.MatchesFilterBar=sa;exports.MatchesHero=aa;exports.MatchesPage=Kv;exports.MatchesStatsBar=tb;exports.MatchesWidget=pa;exports.ORDER_MAX_PRICE=bf;exports.ORDER_MIN_PRICE=vf;exports.ORDER_MIN_QUANTITY=Kr;exports.ORDER_PRICE_STEP=xf;exports.PREDICT_SEARCH_MODAL_ID=Nn;exports.PREDICT_TRADE_MODAL_ID=It;exports.PRICE_HISTORY_SAMPLE_INTERVAL=kf;exports.PredictSearchModal=Gx;exports.PredictTradeModal=lr;exports.PredictWalletProvider=Mi;exports.PriceHistoryInterval=vt;exports.ProfilePage=Vm;exports.SORT_PRESETS=Io;exports.STATIC_CATEGORIES=zr;exports.SearchEventsButton=rv;exports.SearchHistoryUI=As;exports.SearchHistoryWidget=Ds;exports.SearchInputUI=Fs;exports.SearchResultItemUI=Hs;exports.SearchResultListWidget=Ks;exports.SearchWidget=qs;exports.SetupModal=ty;exports.SimilarEventCard=Xd;exports.SimilarEventsSection=Ts;exports.SourceBadge=wv;exports.SpreadIndicator=sb;exports.TradeFormSkeleton=as;exports.TradeFormUI=Co;exports.TradeFormWidget=ir;exports.UserActivitySection=ss;exports.countActiveFilters=Zr;exports.formatKMB=zt;exports.getSourceMeta=ft;exports.useEventDetail=Mh;exports.useEventsInfinite=Fo;exports.usePredictSearchHistory=Pr;exports.usePredictWallet=jr;exports.useSearchResultListScript=$s;exports.useSearchScript=Ys;exports.useTradeForm=xo;exports.version=pi;//# sourceMappingURL=index.js.map
|
|
51
51
|
//# sourceMappingURL=index.js.map
|