@liberfi.io/ui-predict 0.1.93 → 0.1.95

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.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'),Zt=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 Zt__default=/*#__PURE__*/_interopDefault(Zt);typeof window<"u"&&(window.__LIBERFI_VERSION__=window.__LIBERFI_VERSION__||{},window.__LIBERFI_VERSION__["@liberfi.io/ui-predict"]="0.1.93");var Zo="0.1.93";var es={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},Hr=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],jt=(()=>{let e=t=>{let n=Hr.indexOf(t);return n===-1?Hr.length:n};return Object.entries(es).map(([t,n])=>({slug:t,label:t,tags:(n??[]).map(o=>({slug:o,label:o}))})).sort((t,n)=>e(t.slug)-e(n.slug))})();function Wr({categories:e,selectedCategory:t,selectedTag:n,activeTags:o,onCategorySelect:r,onTagSelect:i,trailing:s,pulsingTab:l="Trending",className:a}){let{t:c}=i18n.useTranslation(),d=react.useCallback(()=>{r(null);},[r]),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",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(Ur,{label:p,isSelected:t===null,onPress:d,showPulse:p===l}),jsxRuntime.jsx(os,{}),e.map(u=>jsxRuntime.jsx(Ur,{label:u.category,isSelected:t===u.category,onPress:()=>r(u.category),badge:u.badge,showPulse:u.category===l},u.category))]})}),s&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:s})]}),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($r,{label:c("predict.categories.allMarkets"),isSelected:n===null,onPress:()=>i(null)}),o.map(u=>jsxRuntime.jsx($r,{label:u.label,icon:u.icon,isSelected:n===u.label,onPress:()=>i(u.label)},u.label))]})})]})}function Ur({label:e,isSelected:t,onPress:n,badge:o,showPulse:r}){return jsxRuntime.jsxs("button",{type:"button",onClick:n,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:[r?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 os(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function $r({label:e,icon:t,isSelected:n,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",n?"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 rd({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,n)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-6 w-16 shrink-0 rounded"},n))})})}function ss(e){return e.map(t=>({category:t.label,tags:t.tags.map(n=>n.label)}))}function as(e){return e?e.tags.map(t=>({label:t.label,icon:t.icon})):[]}function Vr({onSelect:e,trailing:t,className:n}){let[o,r]=react.useState(null),[i,s]=react.useState(null),l=react.useCallback(u=>{r(u),s(null),e?.({categorySlug:u,tagSlug:null});},[e]),a=react.useCallback(u=>{s(u),e?.({categorySlug:o,tagSlug:u});},[o,e]),c=ss(jt),d=jt.find(u=>u.slug===o),p=as(d);return jsxRuntime.jsx(Wr,{categories:c,selectedCategory:o,selectedTag:i,activeTags:p,onCategorySelect:l,onTagSelect:a,trailing:t,className:n})}function Yr(e){return {title:e.title,imageUrl:e.image_url}}function qr(e){let t=e.outcomes[0],n=e.outcomes[1];return {question:e.question,yesAsk:t?.best_ask??t?.price,noAsk:n?.best_ask??n?.price,yesBid:t?.best_bid,noBid:n?.best_bid,yesSubTitle:t?.label??"Yes",noSubTitle:n?.label??"No"}}var Qe=48,Gt=4,xt={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},oe={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},ht=oe.ALL,ud={[oe.ONE_DAY]:xt.ONE_MINUTE,[oe.ONE_WEEK]:xt.ONE_HOUR,[oe.ONE_MONTH]:xt.ONE_HOUR,[oe.ALL]:xt.ONE_DAY},pd={[oe.ONE_DAY]:300,[oe.ONE_WEEK]:3600,[oe.ONE_MONTH]:10800,[oe.ALL]:1440*60},md={[oe.ONE_DAY]:1440*60,[oe.ONE_WEEK]:10080*60,[oe.ONE_MONTH]:720*60*60,[oe.ALL]:null},Xt=1,fd=1,gd=1,vd=99,Be={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},xd=Be.ONE_WEEK,hd={[Be.ONE_HOUR]:60,[Be.SIX_HOURS]:60,[Be.ONE_DAY]:300,[Be.ONE_WEEK]:1800,[Be.MAX]:1800};var Xr=react.createContext(null);function Jt(){let e=react.useContext(Xr);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var us=3e4;function ps({pollingInterval:e=us,enabled:t=true,children:n}){let o=walletConnector.useWallets(),r=react.useMemo(()=>o.find(m=>m.chainNamespace===types.ChainNamespace.SOLANA&&m.isConnected)?.address,[o]),i=react.useMemo(()=>o.find(m=>m.chainNamespace===types.ChainNamespace.EVM&&m.isConnected)?.address,[o]),{data:s,isLoading:l,error:a}=reactPredict.useBalance({source:"kalshi",user:r??""},{enabled:t&&!!r,refetchInterval:e}),{data:c,isLoading:d,error:p}=reactPredict.useBalance({source:"polymarket",user:i??""},{enabled:t&&!!i,refetchInterval:e}),u=react.useMemo(()=>({solanaAddress:r,evmAddress:i,dflowUsdcBalance:s?Number(s.balance):null,polymarketUsdcBalance:c?Number(c.balance):null,isLoading:l||d,error:a??p??null}),[r,i,s,c,l,d,a,p]);return jsxRuntime.jsx(Xr.Provider,{value:u,children:n})}var Os={minutes:60,hours:3600,days:86400};function Is(e,t,n){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 r=new Date;return r.setUTCHours(23,59,59,0),Math.floor(r.getTime()/1e3)}case "custom":return o+t*Os[n]}}function en(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};Zt__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{Zt__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{Zt__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}function tn({market:e,initialOutcome:t="yes",initialSide:n="buy"}){let{t:o}=i18n.useTranslation(),{status:r}=walletConnector.useAuth(),i=walletConnector.useWallets(),s=walletConnector.useSwitchChain(),l=reactPredict.usePredictClient(),a=react.useContext(reactPredict.PolymarketContext),c=reactQuery.useQueryClient(),d=e.source,p=d==="polymarket",u=i.find(N=>N.chainNamespace===types.ChainNamespace.SOLANA&&N.isConnected),m=i.find(N=>N.chainNamespace===types.ChainNamespace.EVM&&N.isConnected&&"switchChain"in N),f=r==="authenticated",g=u?.address,v=m?.address,[h,D]=react.useState(t),[T,M]=react.useState(n),[O,Z]=react.useState("market"),[R,ie]=react.useState(NaN),[K,fe]=react.useState(NaN),[Me,X]=react.useState(false),[Q,le]=react.useState(null),[he,be]=react.useState(false),[S,E]=react.useState(null),[I,y]=react.useState(false),[$,q]=react.useState("1h"),[z,Pe]=react.useState(30),[Re,Bt]=react.useState("minutes"),ye=null;try{let N=Jt();ye={dflowUsdcBalance:N.dflowUsdcBalance,polymarketUsdcBalance:N.polymarketUsdcBalance,isLoading:N.isLoading};}catch{}let ne=react.useMemo(()=>{let N=h==="yes"?0:1,B=e.outcomes[N];return T==="buy"?B?.best_ask??B?.price??.5:B?.best_bid??B?.price??.5},[e.outcomes,h,T]),Ht=react.useCallback(N=>{Z(N);},[]),Ut=react.useCallback(N=>{D(N),fe(NaN);},[]);react.useEffect(()=>{O==="limit"&&isNaN(K)&&fe(Math.round(ne*100)/100);},[O,K,ne]);let je=react.useMemo(()=>isNaN(R)||R<=0?0:T==="buy"?ne>0?R/ne:0:R,[T,R,ne]),Fe=react.useMemo(()=>isNaN(R)||R<=0?"0":String(Math.round(R*1e6)),[R]),C=e.provider_meta?.["dflow.yesMint"]??"",ce=e.provider_meta?.["dflow.noMint"]??"",Le=e.provider_meta?.["dflow.collateralMint"]||utils.SOLANA_TOKENS.stablecoins.USDC.address,Rr=h==="yes"?C:ce,Ge=T==="buy"?Le:Rr,Xe=T==="buy"?Rr:Le,Ao=d==="kalshi"&&!!Ge&&!!Xe&&!!g&&Fe!=="0",{refetch:Lr}=reactPredict.useDFlowQuote({inputMint:Ge,outputMint:Xe,amount:Fe,userPublicKey:g??"",slippageBps:100},{enabled:Ao}),Or=d==="kalshi"?g??"":v??"",{data:Se,isLoading:Fo}=reactPredict.usePositions({source:d,user:Or},{enabled:!!Or}),mt=react.useMemo(()=>ye?d==="kalshi"?ye.dflowUsdcBalance:ye.polymarketUsdcBalance:Se&&Se.positions.reduce((B,Ne)=>Ne.side==="USDC"||Ne.side==="collateral"?B+(Ne.current_value??0):B,0)||null,[ye,Se,d]),Bo=ye?ye.isLoading:Fo,$t=react.useMemo(()=>Se?Se.positions.find(B=>B.side?.toLowerCase()==="yes"&&B.market?.slug===e.slug)?.size??0:null,[Se,e.slug]),Wt=react.useMemo(()=>Se?Se.positions.find(B=>B.side?.toLowerCase()==="no"&&B.market?.slug===e.slug)?.size??0:null,[Se,e.slug]),zt=react.useMemo(()=>O==="limit"&&p&&!isNaN(K)?K:ne,[O,p,K,ne]),ft=react.useMemo(()=>{if(isNaN(R)||R<=0)return 0;if(T==="buy")return R;let N=h==="yes"?e.outcomes[0]?.best_bid??0:e.outcomes[1]?.best_bid??0;return R*N},[T,h,R,e.outcomes]),Ir=react.useMemo(()=>isNaN(R)||R<=0?0:T==="buy"?zt>0?R/zt*1:0:ft,[T,R,zt,ft]),Ho=Ir-ft,Uo=react.useCallback(N=>{M(N),ie(NaN);},[]),$o=react.useCallback(N=>{if(isNaN(N)){ie(NaN);return}let B=Math.max(0,N),Ne=T==="buy"?Math.round(B*100)/100:Math.round(B);ie(Ne);},[T]),Wo=react.useCallback(N=>{if(isNaN(N)){fe(NaN);return}let B=Math.max(.01,Math.min(.99,N));fe(Math.round(B*100)/100);},[]),Kt=react.useMemo(()=>{let N=[];(isNaN(R)||R<Xt)&&N.push(`Minimum quantity is ${Xt}`),e.status!=="open"&&N.push("Market is not active"),T==="buy"&&mt!=null&&!isNaN(R)&&R>0&&R>mt&&N.push("Insufficient USDC balance");let B=h==="yes"?$t:Wt;return T==="sell"&&B!=null&&!isNaN(R)&&R>0&&R>B&&N.push("Insufficient shares"),O==="limit"&&p&&(isNaN(K)||K<.01||K>.99)&&N.push("Limit price must be between $0.01 and $0.99"),O==="limit"&&p&&I&&$==="custom"&&(isNaN(z)||z<=0)&&N.push(o("predict.trade.expiration.invalidDate")),{isValid:N.length===0,errors:N}},[R,e.status,T,mt,$t,Wt,h,O,p,K,I,$,z,o]),{mutateAsync:_r}=reactPredict.useDFlowSubmit(),{data:Vt}=reactPredict.useOrder({id:Q??"",source:d},{enabled:!!Q});react.useEffect(()=>{if(!Vt||!Q)return;let{status:N}=Vt;N==="closed"?(X(false),le(null),ui.toast.success(o("predict.trade.submitSuccess")),en(),ie(NaN)):(N==="failed"||N==="expired")&&(X(false),le(null),ui.toast.error(o("predict.trade.submitError")));},[Vt,Q,o]);let Dr=react.useCallback(async()=>{if(!g||!u)return;if(!Ge||!Xe){ui.toast.error("Missing token mint addresses"),X(false);return}let N=await l.checkDFlowKYC(g);if(!N.verified){be(true),E(N.kyc_url||null),X(false);return}let we=(await Lr()).data?.transaction;if(!we){ui.toast.error(o("predict.trade.submitError")),X(false);return}let ke=Uint8Array.from(atob(we),gt=>gt.charCodeAt(0)),Yt=await u.signTransaction(ke),qt=await _r({signedTransaction:btoa(String.fromCharCode(...Yt)),orderContext:{user_public_key:g,input_mint:Ge,output_mint:Xe,amount:Fe,price:String(ne),side:T==="buy"?"BUY":"SELL",outcome:h==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});le(qt.signature);},[g,u,l,Lr,_r,Ge,Xe,Fe,ne,T,h,e.slug,o]),Ar=react.useCallback(async()=>{if(!m||!a)return;let N=m.chain,B=N!==types.Chain.POLYGON;B&&await s(types.Chain.POLYGON);try{let Ne=await m.getEip1193Provider();if(!Ne){ui.toast.error(o("predict.trade.submitError")),X(!1);return}let we={address:m.address,signatureType:0,signTypedData:async(Xo,Qo,Jo)=>await Ne.request({method:"eth_signTypedData_v4",params:[m.address,JSON.stringify({domain:Xo,types:Qo,message:Jo})]})},ke=a.credentials;if(!ke&&(await a.authenticate(we),ke=a.credentials,!ke))throw new Error("Polymarket authentication failed");let Yt=h==="yes"?0:1,qt=e.provider_meta?.[`polymarket.tokenId${Yt}`]??e.provider_meta?.["polymarket.conditionId"]??"",gt=e.provider_meta?.["polymarket.negRisk"]??!1,Ko=O==="limit"&&!isNaN(K)?K:ne,Fr={tokenId:qt,price:Ko,size:R,side:T==="buy"?"BUY":"SELL",orderType:O==="limit"?I?"GTD":"GTC":"FOK",tickSize:"0.01",negRisk:gt,...O==="limit"&&I&&{expiration:Is($,z,Re)}},Vo=reactPredict.buildCtfExchangeDomain(gt),Yo=reactPredict.buildOrderMessage({...Fr,signerAddress:we.address,signatureType:we.signatureType}),qo=await we.signTypedData(Vo,reactPredict.CTF_ORDER_TYPES,Yo),Br=reactPredict.buildSignedOrder({...Fr,signerAddress:we.address,signatureType:we.signatureType,signature:qo}),jo=JSON.stringify(Br),Go=await reactPredict.buildPolymarketL2Headers(ke.address,{apiKey:ke.apiKey,secret:ke.secret,passphrase:ke.passphrase,method:"POST",requestPath:"/api/v1/orders/polymarket",body:jo});await l.createPolymarketOrder(Br,Go),c.invalidateQueries({queryKey:["predict","orders"]}),c.invalidateQueries({queryKey:["predict","positions"]}),ui.toast.success(o("predict.trade.submitSuccess")),en(),ie(NaN),X(!1);}finally{B&&N&&s(N).catch(()=>{});}},[m,a,s,h,e.provider_meta,O,K,ne,R,T,l,c,I,$,z,Re,o]),zo=react.useCallback(async()=>{if(!(!Kt.isValid||!f)){X(true),le(null),be(false);try{d==="kalshi"?await Dr():await Ar();}catch{ui.toast.error(o("predict.trade.submitError")),X(false);}}},[Kt.isValid,f,d,Dr,Ar,o]);return {outcome:h,side:T,orderType:O,quantity:R,limitPrice:K,shares:je,estimatedCost:ft,potentialPayout:Ir,potentialProfit:Ho,usdcBalance:mt,yesTokenBalance:$t,noTokenBalance:Wt,isBalanceLoading:Bo,isSubmitting:Me,validation:Kt,supportsLimitOrder:p,kycRequired:he,kycUrl:S,expirationEnabled:I,expirationPreset:$,customDuration:z,customDurationUnit:Re,setOutcome:Ut,setSide:Uo,setOrderType:Ht,setQuantity:$o,setLimitPrice:Wo,setExpirationEnabled:y,setExpirationPreset:q,setCustomDuration:Pe,setCustomDurationUnit:Bt,submit:zo}}var Ys=`https://s1.chainstream.io/chains/sol/tokens/${utils.SOLANA_TOKENS.stablecoins.USDC.address}/image.png`,qs=["5m","1h","12h","24h","eod","custom"],js={"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"},Gs=["minutes","hours","days"],Xs={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"};function cn({event:e,market:t,variant:n="bordered",outcome:o,side:r,orderType:i,quantity:s,limitPrice:l,shares:a,potentialProfit:c,potentialPayout:d,estimatedCost:p,usdcBalance:u,yesTokenBalance:m,noTokenBalance:f,isBalanceLoading:g,isSubmitting:v,isValid:h,validationErrors:D,supportsLimitOrder:T,kycRequired:M,kycUrl:O,expirationEnabled:Z,expirationPreset:R,customDuration:ie,customDurationUnit:K,onOutcomeChange:fe,onSideChange:Me,onOrderTypeChange:X,onQuantityChange:Q,onLimitPriceChange:le,onExpirationEnabledChange:he,onExpirationPresetChange:be,onCustomDurationChange:S,onCustomDurationUnitChange:E,onSubmit:I}){let{t:y}=i18n.useTranslation(),[$,q]=react.useState(false),z=ui.useDisclosure();react.useEffect(()=>{M&&!z.isOpen&&z.onOpen();},[M]);let Pe=react.useMemo(()=>{let C=r==="buy"?o==="yes"?t.yesAsk:t.noAsk:o==="yes"?t.yesBid:t.noBid;return C!=null?parseFloat((Number(C)*100).toFixed(2)):null},[r,o,t]),Re=!isNaN(s)&&s>0,Bt=react.useMemo(()=>{if(v)return y("predict.trade.submitting");if(M)return y("predict.trade.kycRequired");if(!Re)return y("predict.trade.enterAmount");let C=y(r==="buy"?"predict.trade.buy":"predict.trade.sell"),ce=y(o==="yes"?"predict.trade.yes":"predict.trade.no"),Le=r==="buy"&&c>0?` \u2192 Win $${c.toFixed(2)}`:"";return `${C} ${ce}${Le}`},[v,M,Re,r,o,c,y]),ye=react.useMemo(()=>o==="yes"?"primary":"secondary",[o]),ne=()=>{Q(Math.floor((u??0)/2*100)/100);},Ht=()=>{Q(u??0);},[Ut,je]=react.useState(false),Fe=()=>{if(M){z.onOpen();return}if(!h){je(true);return}je(false),I();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:ui.cn("flex w-full flex-col gap-y-4 p-4",n==="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:[y(r==="buy"?"predict.trade.buy":"predict.trade.sell")," ",y(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:[T?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:i,onSelectionChange:C=>X(C),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:y("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:y("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:y("predict.trade.market")}),i==="limit"&&T?jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",value:isNaN(l)?void 0:parseFloat((l*100).toFixed(2)),onValueChange:C=>le(C/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"}}):Pe!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[Pe," \xA2"]})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(C=>{let ce=C==="yes"?m:f;return jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col gap-y-1",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>fe(C),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${o===C?C==="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:y(C==="yes"?"predict.trade.yes":"predict.trade.no")}),(()=>{let Le=r==="buy"?C==="yes"?t.yesAsk:t.noAsk:C==="yes"?t.yesBid:t.noBid;return Le!=null?jsxRuntime.jsxs("span",{className:"ml-1 opacity-70",children:[parseFloat((Number(Le)*100).toFixed(2)),"\xA2"]}):null})()]}),r==="sell"&&o===C&&jsxRuntime.jsx("span",{className:"text-center text-xs text-foreground",children:g?"\u2013":`${ce??0} shares`})]},C)})}),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:y(r==="buy"?"predict.trade.youArePaying":"predict.trade.contracts")}),r==="buy"&&jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("img",{src:Ys,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:ne,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:y("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:Ht,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:y("predict.trade.max")})]})]}),jsxRuntime.jsx(ui.StyledNumberInput,{fullWidth:true,placeholder:"0",radius:"lg",size:"lg",value:isNaN(s)?void 0:s,onValueChange:C=>{je(false),Q(C);},minValue:0,step:r==="buy"?.01:1,formatOptions:r==="buy"?{maximumFractionDigits:2}:{maximumFractionDigits:0},startContent:r==="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"}},r),r==="sell"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2 justify-end",children:[[25,50].map(C=>jsxRuntime.jsxs("button",{type:"button",onClick:()=>{Q(Math.floor((o==="yes"?m??0:f??0)*C/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:[C,"%"]},C)),jsxRuntime.jsx("button",{type:"button",onClick:()=>{Q(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:y("common.all")})]}),Ut&&D.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:D.map(C=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:C},C))})]}),i==="limit"&&T&&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:y("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:Z,onValueChange:he,"aria-label":y("predict.trade.setExpiration")})]}),Z&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":y("predict.trade.setExpiration"),selectedKeys:[R],onSelectionChange:C=>{let ce=Array.from(C)[0];ce&&be(ce);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:qs.map(C=>jsxRuntime.jsx(ui.SelectItem,{children:y(js[C])},C))}),R==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(ie)?void 0:ie,onValueChange:S,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:C=>{let ce=Array.from(C)[0];ce&&E(ce);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Gs.map(C=>jsxRuntime.jsx(ui.SelectItem,{children:y(Xs[C])},C))})]})]})]}),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:()=>q(C=>!C),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:y("predict.trade.odds")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-3.5 w-3.5 transition-transform",$&&"rotate-180")})]}),Pe!=null&&jsxRuntime.jsxs("span",{className:"text-foreground font-medium tabular-nums",children:[Pe,"% chance"]})]}),$&&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(s)&&s>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(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(s)&&s>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(s)&&s>0&&c>0?`+$${c.toFixed(2)}`:"\u2013"})]})]})]}),jsxRuntime.jsx(ui.Button,{color:ye,fullWidth:true,radius:"lg",size:"lg",isDisabled:!Re||v,isLoading:v,onPress:Fe,children:Bt})]}),jsxRuntime.jsx(ui.Modal,{isOpen:z.isOpen,onClose:z.onClose,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 ",y("predict.trade.kycModalTitle")]})}),jsxRuntime.jsxs(ui.ModalBody,{className:"gap-y-4",children:[jsxRuntime.jsx("p",{className:"text-sm text-default-600",children:y("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:y("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:y("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:y("predict.trade.kycModalBullet3")})]})]}),jsxRuntime.jsx("p",{className:"text-xs text-default-400",children:y("predict.trade.kycModalNote")})]}),jsxRuntime.jsxs(ui.ModalFooter,{children:[jsxRuntime.jsx(ui.Button,{variant:"light",onPress:z.onClose,children:y("common.cancel")}),O&&jsxRuntime.jsx(ui.Button,{color:"primary",onPress:()=>{window.open(O,"_blank","noopener,noreferrer"),z.onClose();},children:y("predict.trade.goToKYC")})]})]})})]})}function bt({event:e,market:t,variant:n,initialSide:o,initialOutcome:r,chain:i}){let{outcome:s,side:l,orderType:a,quantity:c,limitPrice:d,shares:p,estimatedCost:u,potentialPayout:m,potentialProfit:f,usdcBalance:g,yesTokenBalance:v,noTokenBalance:h,isBalanceLoading:D,isSubmitting:T,validation:M,supportsLimitOrder:O,kycRequired:Z,kycUrl:R,expirationEnabled:ie,expirationPreset:K,customDuration:fe,customDurationUnit:Me,setOutcome:X,setSide:Q,setOrderType:le,setQuantity:he,setLimitPrice:be,setExpirationEnabled:S,setExpirationPreset:E,setCustomDuration:I,setCustomDurationUnit:y,submit:$}=tn({market:t,initialSide:o,initialOutcome:r}),q=walletConnector.useAuthCallback($),z=react.useMemo(()=>e?Yr(e):void 0,[e]),Pe=react.useMemo(()=>qr(t),[t]);return jsxRuntime.jsx(cn,{event:z,market:Pe,variant:n,outcome:s,side:l,orderType:a,quantity:c,limitPrice:d,shares:p,estimatedCost:u,potentialPayout:m,potentialProfit:f,usdcBalance:g,yesTokenBalance:v,noTokenBalance:h,isBalanceLoading:D,isSubmitting:T,isValid:M.isValid,validationErrors:M.errors,supportsLimitOrder:O,kycRequired:Z,kycUrl:R,expirationEnabled:ie,expirationPreset:K,customDuration:fe,customDurationUnit:Me,onOutcomeChange:X,onSideChange:Q,onOrderTypeChange:le,onQuantityChange:he,onLimitPriceChange:be,onExpirationEnabledChange:S,onExpirationPresetChange:E,onCustomDurationChange:I,onCustomDurationUnitChange:y,onSubmit:q})}var Je="predict-trade";function yt({id:e=Je}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(oa,{...t})})}function oa({params:e,isOpen:t,onOpenChange:n}){let{isMobile:o}=ui.useScreen();return e?jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:n,size:o?"lg":"md",backdrop:"blur",radius:"lg",children:jsxRuntime.jsx(ui.ModalContent,{children:jsxRuntime.jsx(ui.ModalBody,{className:"p-2",children:jsxRuntime.jsx(bt,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,initialSide:"buy",chain:e.chain,variant:"flat"})})})}):null}var nr={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function or(e){let t=0;return e.source&&t++,e.timeRemaining&&t++,e.minVolume&&t++,e.minLiquidity&&t++,t}function pn({isOpen:e,onClose:t,value:n,onChange:o}){let{t:r}=i18n.useTranslation(),[i,s]=react.useState(n),l=react.useCallback(v=>{v?s(n):t();},[n,t]),a=react.useCallback(()=>{s(nr);},[]),c=react.useCallback(()=>{o(i),t();},[i,o,t]),d=react.useCallback((v,h)=>{s(D=>({...D,[v]:h}));},[]),p=react.useMemo(()=>or(i),[i]),u=react.useMemo(()=>[{value:void 0,label:r("predict.filter.all")},{value:"polymarket",label:r("predict.platform.polymarket")},{value:"kalshi",label:r("predict.platform.kalshi")}],[r]),m=react.useMemo(()=>[{value:void 0,label:r("predict.filter.all")},{value:"1d",label:r("predict.filter.lessThanDay")},{value:"7d",label:r("predict.filter.lessThanWeek")},{value:"30d",label:r("predict.filter.lessThanMonth")}],[r]),f=react.useMemo(()=>[{value:void 0,label:r("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[r]),g=react.useMemo(()=>[{value:void 0,label:r("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[r]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:e,onOpenChange:l,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:r("predict.filter.title")})}),jsxRuntime.jsxs(ui.ModalBody,{className:"flex flex-col gap-5",children:[jsxRuntime.jsx(Nt,{label:r("predict.filter.platform"),children:jsxRuntime.jsx(wt,{options:u,selected:i.source,onSelect:v=>d("source",v)})}),jsxRuntime.jsx(Nt,{label:r("predict.filter.timeRemaining"),children:jsxRuntime.jsx(wt,{options:m,selected:i.timeRemaining,onSelect:v=>d("timeRemaining",v)})}),jsxRuntime.jsx(Nt,{label:r("predict.filter.minVolume"),children:jsxRuntime.jsx(wt,{options:f,selected:i.minVolume,onSelect:v=>d("minVolume",v)})}),jsxRuntime.jsx(Nt,{label:r("predict.filter.minLiquidity"),children:jsxRuntime.jsx(wt,{options:g,selected:i.minLiquidity,onSelect:v=>d("minLiquidity",v)})})]}),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:r("predict.filter.reset")}),jsxRuntime.jsxs(ui.Button,{color:"primary",size:"sm",radius:"full",onPress:c,children:[r("predict.filter.showResults"),p>0&&jsxRuntime.jsxs("span",{className:"ml-1 text-xs opacity-80",children:["(",p,")"]})]})]})})]})})}function Nt({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 wt({options:e,selected:t,onSelect:n,allowDeselect:o=true}){return jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:e.map(r=>{let i=t===r.value;return jsxRuntime.jsx("button",{type:"button",onClick:()=>{n(i&&o?void 0:r.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:r.label},r.value??"__all")})})}var vn={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},fn={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},ka=["start_time","volume","liquidity","ending_soon"];function xn({sortPreset:e,onSortChange:t,sortAsc:n,onSortAscChange:o,onFilterPress:r,filterCount:i=0,className:s}){let{t:l}=i18n.useTranslation(),[a,c]=react.useState(false),d=react.useRef(null);react.useEffect(()=>{if(!a)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);}},[a]);let p=gn[e];return jsxRuntime.jsxs("div",{className:ui.cn("flex items-center gap-2",s),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:l(fn[e])})]}),jsxRuntime.jsx("div",{className:"h-6 w-px bg-border"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>o(!n),className:"px-2.5 py-1.5 text-xs text-neutral transition-colors hover:text-primary/80 cursor-pointer",children:n?"\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:ka.map(u=>{let m=gn[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:l(fn[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:r,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:l("predict.filter.title")})]})})]})}var gn={start_time:ui.CalendarIcon,volume:ui.ChartLineIcon,liquidity:ui.DropletIcon,ending_soon:ui.TimerIcon};function yn(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:n,isLoading:o,isFetching:r,isFetchingNextPage:i,isError:s,error:l,hasNextPage:a,fetchNextPage:c,refetch:d}=reactPredict.useInfiniteEvents(t),p=react.useMemo(()=>n?.pages.flatMap(f=>f.items).filter(f=>f!=null)??[],[n]),u=react.useCallback(()=>{c();},[c]),m=react.useCallback(()=>{d();},[d]);return {data:p,isLoading:o,isFetching:r&&!i,isFetchingMore:i,isError:s,error:l??null,hasMore:a??false,fetchMore:u,refetch:m}}function sr({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,n)=>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"})]})]})},n))})}function xu({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(sr,{count:e})})]})}var Sn=3,ir={bg:"hsl(var(--heroui-primary) / 0.14)",text:"hsl(var(--heroui-primary))",shadow:"hsl(var(--heroui-primary) / 0.18)"},Cn={bg:"hsl(var(--heroui-secondary) / 0.14)",text:"hsl(var(--heroui-secondary))",shadow:"hsl(var(--heroui-secondary) / 0.18)"},Ia={bg:"rgba(239, 68, 68, 0.14)",text:"rgb(239, 68, 68)",shadow:"rgba(239, 68, 68, 0.18)"},tt=[{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 Nn(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return Math.abs(t)}function _a(e){let t=e.outcomes?.map(s=>s.label?.toLowerCase().trim()??"")??[];if(t.some(s=>s==="up")&&t.some(s=>s==="down"))return [ir,Ia];if(t.some(s=>s==="yes")&&t.some(s=>s==="no"))return [ir,Cn];let n=t[0]??"",o=t[1]??"",r=Nn(n)%tt.length,i=Nn(o)%tt.length;return i===r&&(i=(i+1)%tt.length),[tt[r],tt[i]]}function Da(e){let t=e.outcomes?.[0];return t?t.best_ask??t.price??null:null}function Tn(e){let t=Da(e);return t!=null?parseFloat((t*100).toFixed(2)):0}function Mn(e){return e<=1&&e>0?"< 1%":e>=99&&e<100?"> 99%":`${e}%`}function wn(e){let t=e.outcomes?.[0],n=t?.best_ask??t?.price??0;return parseFloat((n*100).toFixed(2)).toString()}function kn(e){let t=e.outcomes?.[1];if(t){let r=t.best_ask??t.price??0;return parseFloat((r*100).toFixed(2)).toString()}let n=e.outcomes?.[0],o=n?.best_ask??n?.price??0;return parseFloat(((1-o)*100).toFixed(2)).toString()}function Aa(e){let t=new Date(e).getTime()-Date.now();if(t<=0)return null;let n=Math.floor(t/864e5),o=Math.floor(t%864e5/36e5),r=Math.floor(t%36e5/6e4),i=[];return n>0&&i.push(`${n}d`),o>0&&i.push(`${o}h`),i.push(`${r}m`),i.join(" ")}var Fa=`
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'),Ir=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 Ir__default=/*#__PURE__*/_interopDefault(Ir);typeof window<"u"&&(window.__LIBERFI_VERSION__=window.__LIBERFI_VERSION__||{},window.__LIBERFI_VERSION__["@liberfi.io/ui-predict"]="0.1.95");var Ia="0.1.95";var Oa={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},In=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],Mr=(()=>{let e=t=>{let r=In.indexOf(t);return r===-1?In.length:r};return Object.entries(Oa).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 Dn({categories:e,selectedCategory:t,selectedTag:r,activeTags:o,onCategorySelect:n,onTagSelect:a,trailing:i,pulsingTab:s="Trending",className:l}){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",l),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(On,{label:d,isSelected:t===null,onPress:u,showPulse:d===s}),jsxRuntime.jsx(Ha,{}),e.map(p=>jsxRuntime.jsx(On,{label:p.category,isSelected:t===p.category,onPress:()=>n(p.category),badge:p.badge,showPulse:p.category===s},p.category))]})}),i&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:i})]}),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(An,{label:c("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>a(null)}),o.map(p=>jsxRuntime.jsx(An,{label:p.label,icon:p.icon,isSelected:r===p.label,onPress:()=>a(p.label)},p.label))]})})]})}function On({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 Ha(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function An({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 um({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 Ba(e){return e.map(t=>({category:t.label,tags:t.tags.map(r=>r.label)}))}function $a(e){return e?e.tags.map(t=>({label:t.label,icon:t.icon})):[]}function Bn({onSelect:e,trailing:t,className:r}){let[o,n]=react.useState(null),[a,i]=react.useState(null),s=react.useCallback(p=>{n(p),i(null),e?.({categorySlug:p,tagSlug:null});},[e]),l=react.useCallback(p=>{i(p),e?.({categorySlug:o,tagSlug:p});},[o,e]),c=Ba(Mr),u=Mr.find(p=>p.slug===o),d=$a(u);return jsxRuntime.jsx(Dn,{categories:c,selectedCategory:o,selectedTag:a,activeTags:d,onCategorySelect:s,onTagSelect:l,trailing:t,className:r})}function $n(e){return {title:e.title,imageUrl:e.image_url}}function Wn(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 bt=48,Tr=4,Ut={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},Se={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},Kt=Se.ALL,ym={[Se.ONE_DAY]:Ut.ONE_MINUTE,[Se.ONE_WEEK]:Ut.ONE_HOUR,[Se.ONE_MONTH]:Ut.ONE_HOUR,[Se.ALL]:Ut.ONE_DAY},km={[Se.ONE_DAY]:300,[Se.ONE_WEEK]:3600,[Se.ONE_MONTH]:10800,[Se.ALL]:1440*60},Nm={[Se.ONE_DAY]:1440*60,[Se.ONE_WEEK]:10080*60,[Se.ONE_MONTH]:720*60*60,[Se.ALL]:null},Lr=1,Sm=1,wm=1,Pm=99,at={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},Cm=at.ONE_WEEK,Em={[at.ONE_HOUR]:60,[at.SIX_HOURS]:60,[at.ONE_DAY]:300,[at.ONE_WEEK]:1800,[at.MAX]:1800};var Kn=react.createContext(null);function _r(){let e=react.useContext(Kn);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var Va=3e4;function ja({pollingInterval:e=Va,enabled:t=true,children:r}){let o=walletConnector.useWallets(),n=react.useMemo(()=>o.find(m=>m.chainNamespace===types.ChainNamespace.SOLANA&&m.isConnected)?.address,[o]),a=react.useMemo(()=>o.find(m=>m.chainNamespace===types.ChainNamespace.EVM&&m.isConnected)?.address,[o]),{data:i,isLoading:s,error:l}=reactPredict.useBalance({source:"kalshi",user:n??""},{enabled:t&&!!n,refetchInterval:e}),{data:c,isLoading:u,error:d}=reactPredict.useBalance({source:"polymarket",user:a??""},{enabled:t&&!!a,refetchInterval:e}),p=react.useMemo(()=>({solanaAddress:n,evmAddress:a,dflowUsdcBalance:i?Number(i.balance):null,polymarketUsdcBalance:c?Number(c.balance):null,isLoading:s||u,error:l??d??null}),[n,a,i,c,s,u,l,d]);return jsxRuntime.jsx(Kn.Provider,{value:p,children:r})}var pi={minutes:60,hours:3600,days:86400};function mi(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*pi[r]}}function Yn(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};Ir__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{Ir__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{Ir__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}function qn({market:e,initialOutcome:t="yes",initialSide:r="buy"}){let{t:o}=i18n.useTranslation(),{status:n}=walletConnector.useAuth(),a=walletConnector.useWallets(),i=walletConnector.useSwitchChain(),s=reactPredict.usePredictClient(),l=react.useContext(reactPredict.PolymarketContext),c=reactQuery.useQueryClient(),u=e.source,d=u==="polymarket",p=a.find(M=>M.chainNamespace===types.ChainNamespace.SOLANA&&M.isConnected),m=a.find(M=>M.chainNamespace===types.ChainNamespace.EVM&&M.isConnected&&"switchChain"in M),g=n==="authenticated",f=p?.address,h=m?.address,[x,R]=react.useState(t),[N,w]=react.useState(r),[v,B]=react.useState("market"),[b,X]=react.useState(NaN),[j,ie]=react.useState(NaN),[U,F]=react.useState(false),[W,$]=react.useState(null),[oe,pe]=react.useState(false),[C,A]=react.useState(null),[K,P]=react.useState(false),[ne,me]=react.useState("1h"),[le,Ve]=react.useState(30),[Qe,vr]=react.useState("minutes"),Ae=null;try{let M=_r();Ae={dflowUsdcBalance:M.dflowUsdcBalance,polymarketUsdcBalance:M.polymarketUsdcBalance,isLoading:M.isLoading};}catch{}let Ne=react.useMemo(()=>{let M=x==="yes"?0:1,J=e.outcomes[M];return N==="buy"?J?.best_ask??J?.price??.5:J?.best_bid??J?.price??.5},[e.outcomes,x,N]),br=react.useCallback(M=>{B(M);},[]),yr=react.useCallback(M=>{R(M),ie(NaN);},[]);react.useEffect(()=>{v==="limit"&&isNaN(j)&&ie(Math.round(Ne*100)/100);},[v,j,Ne]);let ht=react.useMemo(()=>isNaN(b)||b<=0?0:N==="buy"?Ne>0?b/Ne:0:b,[N,b,Ne]),st=react.useMemo(()=>isNaN(b)||b<=0?"0":String(Math.round(b*1e6)),[b]),D=e.provider_meta?.["dflow.yesMint"]??"",Ee=e.provider_meta?.["dflow.noMint"]??"",Ze=e.provider_meta?.["dflow.collateralMint"]||utils.SOLANA_TOKENS.stablecoins.USDC.address,wn=x==="yes"?D:Ee,xt=N==="buy"?Ze:wn,vt=N==="buy"?wn:Ze,ha=u==="kalshi"&&!!xt&&!!vt&&!!f&&st!=="0",{refetch:Pn}=reactPredict.useDFlowQuote({inputMint:xt,outputMint:vt,amount:st,userPublicKey:f??"",slippageBps:100},{enabled:ha}),Cn=u==="kalshi"?f??"":h??"",{data:De,isLoading:xa}=reactPredict.usePositions({source:u,user:Cn},{enabled:!!Cn}),Bt=react.useMemo(()=>Ae?u==="kalshi"?Ae.dflowUsdcBalance:Ae.polymarketUsdcBalance:De&&De.positions.reduce((J,Fe)=>Fe.side==="USDC"||Fe.side==="collateral"?J+(Fe.current_value??0):J,0)||null,[Ae,De,u]),va=Ae?Ae.isLoading:xa,kr=react.useMemo(()=>De?De.positions.find(J=>J.side?.toLowerCase()==="yes"&&J.market?.slug===e.slug)?.size??0:null,[De,e.slug]),Nr=react.useMemo(()=>De?De.positions.find(J=>J.side?.toLowerCase()==="no"&&J.market?.slug===e.slug)?.size??0:null,[De,e.slug]),Sr=react.useMemo(()=>v==="limit"&&d&&!isNaN(j)?j:Ne,[v,d,j,Ne]),$t=react.useMemo(()=>{if(isNaN(b)||b<=0)return 0;if(N==="buy")return b;let M=x==="yes"?e.outcomes[0]?.best_bid??0:e.outcomes[1]?.best_bid??0;return b*M},[N,x,b,e.outcomes]),En=react.useMemo(()=>isNaN(b)||b<=0?0:N==="buy"?Sr>0?b/Sr*1:0:$t,[N,b,Sr,$t]),ba=En-$t,ya=react.useCallback(M=>{w(M),X(NaN);},[]),ka=react.useCallback(M=>{if(isNaN(M)){X(NaN);return}let J=Math.max(0,M),Fe=N==="buy"?Math.round(J*100)/100:Math.round(J);X(Fe);},[N]),Na=react.useCallback(M=>{if(isNaN(M)){ie(NaN);return}let J=Math.max(.01,Math.min(.99,M));ie(Math.round(J*100)/100);},[]),wr=react.useMemo(()=>{let M=[];(isNaN(b)||b<Lr)&&M.push(`Minimum quantity is ${Lr}`),e.status!=="open"&&M.push("Market is not active"),N==="buy"&&Bt!=null&&!isNaN(b)&&b>0&&b>Bt&&M.push("Insufficient USDC balance");let J=x==="yes"?kr:Nr;return N==="sell"&&J!=null&&!isNaN(b)&&b>0&&b>J&&M.push("Insufficient shares"),v==="limit"&&d&&(isNaN(j)||j<.01||j>.99)&&M.push("Limit price must be between $0.01 and $0.99"),v==="limit"&&d&&K&&ne==="custom"&&(isNaN(le)||le<=0)&&M.push(o("predict.trade.expiration.invalidDate")),{isValid:M.length===0,errors:M}},[b,e.status,N,Bt,kr,Nr,x,v,d,j,K,ne,le,o]),{mutateAsync:Mn}=reactPredict.useDFlowSubmit(),{data:Pr}=reactPredict.useOrder({id:W??"",source:u},{enabled:!!W});react.useEffect(()=>{if(!Pr||!W)return;let{status:M}=Pr;M==="closed"?(F(false),$(null),ui.toast.success(o("predict.trade.submitSuccess")),Yn(),X(NaN)):(M==="failed"||M==="expired")&&(F(false),$(null),ui.toast.error(o("predict.trade.submitError")));},[Pr,W,o]);let Tn=react.useCallback(async()=>{if(!f||!p)return;if(!xt||!vt){ui.toast.error("Missing token mint addresses"),F(false);return}let M=await s.checkDFlowKYC(f);if(!M.verified){pe(true),A(M.kyc_url||null),F(false);return}let He=(await Pn()).data?.transaction;if(!He){ui.toast.error(o("predict.trade.submitError")),F(false);return}let Be=Uint8Array.from(atob(He),Wt=>Wt.charCodeAt(0)),Cr=await p.signTransaction(Be),Er=await Mn({signedTransaction:btoa(String.fromCharCode(...Cr)),orderContext:{user_public_key:f,input_mint:xt,output_mint:vt,amount:st,price:String(Ne),side:N==="buy"?"BUY":"SELL",outcome:x==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});$(Er.signature);},[f,p,s,Pn,Mn,xt,vt,st,Ne,N,x,e.slug,o]),Ln=react.useCallback(async()=>{if(!m||!l)return;let M=m.chain,J=M!==types.Chain.POLYGON;J&&await i(types.Chain.POLYGON);try{let Fe=await m.getEip1193Provider();if(!Fe){ui.toast.error(o("predict.trade.submitError")),F(!1);return}let He={address:m.address,signatureType:0,signTypedData:async(La,Ra,_a)=>await Fe.request({method:"eth_signTypedData_v4",params:[m.address,JSON.stringify({domain:La,types:Ra,message:_a})]})},Be=l.credentials;if(!Be&&(await l.authenticate(He),Be=l.credentials,!Be))throw new Error("Polymarket authentication failed");let Cr=x==="yes"?0:1,Er=e.provider_meta?.[`polymarket.tokenId${Cr}`]??e.provider_meta?.["polymarket.conditionId"]??"",Wt=e.provider_meta?.["polymarket.negRisk"]??!1,wa=v==="limit"&&!isNaN(j)?j:Ne,Rn={tokenId:Er,price:wa,size:b,side:N==="buy"?"BUY":"SELL",orderType:v==="limit"?K?"GTD":"GTC":"FOK",tickSize:"0.01",negRisk:Wt,...v==="limit"&&K&&{expiration:mi(ne,le,Qe)}},Pa=reactPredict.buildCtfExchangeDomain(Wt),Ca=reactPredict.buildOrderMessage({...Rn,signerAddress:He.address,signatureType:He.signatureType}),Ea=await He.signTypedData(Pa,reactPredict.CTF_ORDER_TYPES,Ca),_n=reactPredict.buildSignedOrder({...Rn,signerAddress:He.address,signatureType:He.signatureType,signature:Ea}),Ma=JSON.stringify(_n),Ta=await reactPredict.buildPolymarketL2Headers(Be.address,{apiKey:Be.apiKey,secret:Be.secret,passphrase:Be.passphrase,method:"POST",requestPath:"/api/v1/orders/polymarket",body:Ma});await s.createPolymarketOrder(_n,Ta),c.invalidateQueries({queryKey:["predict","orders"]}),c.invalidateQueries({queryKey:["predict","positions"]}),ui.toast.success(o("predict.trade.submitSuccess")),Yn(),X(NaN),F(!1);}finally{J&&M&&i(M).catch(()=>{});}},[m,l,i,x,e.provider_meta,v,j,Ne,b,N,s,c,K,ne,le,Qe,o]),Sa=react.useCallback(async()=>{if(!(!wr.isValid||!g)){F(true),$(null),pe(false);try{u==="kalshi"?await Tn():await Ln();}catch{ui.toast.error(o("predict.trade.submitError")),F(false);}}},[wr.isValid,g,u,Tn,Ln,o]);return {outcome:x,side:N,orderType:v,quantity:b,limitPrice:j,shares:ht,estimatedCost:$t,potentialPayout:En,potentialProfit:ba,usdcBalance:Bt,yesTokenBalance:kr,noTokenBalance:Nr,isBalanceLoading:va,isSubmitting:U,validation:wr,supportsLimitOrder:d,kycRequired:oe,kycUrl:C,expirationEnabled:K,expirationPreset:ne,customDuration:le,customDurationUnit:Qe,setOutcome:yr,setSide:ya,setOrderType:br,setQuantity:ka,setLimitPrice:Na,setExpirationEnabled:P,setExpirationPreset:me,setCustomDuration:Ve,setCustomDurationUnit:vr,submit:Sa}}var Ci=`https://s1.chainstream.io/chains/sol/tokens/${utils.SOLANA_TOKENS.stablecoins.USDC.address}/image.png`,Ei=["5m","1h","12h","24h","eod","custom"],Mi={"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"},Ti=["minutes","hours","days"],Li={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"};function ro({event:e,market:t,variant:r="bordered",outcome:o,side:n,orderType:a,quantity:i,limitPrice:s,shares:l,potentialProfit:c,potentialPayout:u,estimatedCost:d,usdcBalance:p,yesTokenBalance:m,noTokenBalance:g,isBalanceLoading:f,isSubmitting:h,isValid:x,validationErrors:R,supportsLimitOrder:N,kycRequired:w,kycUrl:v,expirationEnabled:B,expirationPreset:b,customDuration:X,customDurationUnit:j,onOutcomeChange:ie,onSideChange:U,onOrderTypeChange:F,onQuantityChange:W,onLimitPriceChange:$,onExpirationEnabledChange:oe,onExpirationPresetChange:pe,onCustomDurationChange:C,onCustomDurationUnitChange:A,onSubmit:K}){let{t:P}=i18n.useTranslation(),[ne,me]=react.useState(false),le=ui.useDisclosure();react.useEffect(()=>{w&&!le.isOpen&&le.onOpen();},[w]);let Ve=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]),Qe=!isNaN(i)&&i>0,vr=react.useMemo(()=>{if(h)return P("predict.trade.submitting");if(w)return P("predict.trade.kycRequired");if(!Qe)return P("predict.trade.enterAmount");let D=P(n==="buy"?"predict.trade.buy":"predict.trade.sell"),Ee=P(o==="yes"?"predict.trade.yes":"predict.trade.no"),Ze=n==="buy"&&c>0?` \u2192 Win $${c.toFixed(2)}`:"";return `${D} ${Ee}${Ze}`},[h,w,Qe,n,o,c,P]),Ae=react.useMemo(()=>o==="yes"?"primary":"secondary",[o]),Ne=()=>{W(Math.floor((p??0)/2*100)/100);},br=()=>{W(p??0);},[yr,ht]=react.useState(false),st=()=>{if(w){le.onOpen();return}if(!x){ht(true);return}ht(false),K();};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:[P(n==="buy"?"predict.trade.buy":"predict.trade.sell")," ",P(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:[N?jsxRuntime.jsxs(ui.Tabs,{variant:"underlined",selectedKey:a,onSelectionChange:D=>F(D),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui.Tab,{title:P("predict.trade.market")},"market"),jsxRuntime.jsx(ui.Tab,{title:P("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:P("predict.trade.market")}),a==="limit"&&N?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=>$(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"}}):Ve!=null&&jsxRuntime.jsxs("span",{className:"text-xl font-bold tabular-nums",children:[Ve," \xA2"]})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(D=>{let Ee=D==="yes"?m:g;return jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col gap-y-1",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>ie(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:P(D==="yes"?"predict.trade.yes":"predict.trade.no")}),(()=>{let Ze=n==="buy"?D==="yes"?t.yesAsk:t.noAsk:D==="yes"?t.yesBid:t.noBid;return Ze!=null?jsxRuntime.jsxs("span",{className:"ml-1 opacity-70",children:[parseFloat((Number(Ze)*100).toFixed(2)),"\xA2"]}):null})()]}),n==="sell"&&o===D&&jsxRuntime.jsx("span",{className:"text-center text-xs text-foreground",children:f?"\u2013":`${Ee??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:P(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:Ci,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:Ne,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:P("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:br,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-foreground font-medium",children:P("predict.trade.max")})]})]}),jsxRuntime.jsx(ui.StyledNumberInput,{fullWidth:true,placeholder:"0",radius:"lg",size:"lg",value:isNaN(i)?void 0:i,onValueChange:D=>{ht(false),W(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:()=>{W(Math.floor((o==="yes"?m??0:g??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:()=>{W(o==="yes"?m??0:g??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:P("common.all")})]}),yr&&R.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:R.map(D=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:D},D))})]}),a==="limit"&&N&&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:P("predict.trade.setExpiration")}),jsxRuntime.jsx(ui.StyledSwitch,{size:"sm",color:"primary",isSelected:B,onValueChange:oe,"aria-label":P("predict.trade.setExpiration")})]}),B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui.Select,{"aria-label":P("predict.trade.setExpiration"),selectedKeys:[b],onSelectionChange:D=>{let Ee=Array.from(D)[0];Ee&&pe(Ee);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Ei.map(D=>jsxRuntime.jsx(ui.SelectItem,{children:P(Mi[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(X)?void 0:X,onValueChange:C,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:[j],onSelectionChange:D=>{let Ee=Array.from(D)[0];Ee&&A(Ee);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Ti.map(D=>jsxRuntime.jsx(ui.SelectItem,{children:P(Li[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:()=>me(D=>!D),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:P("predict.trade.odds")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-3.5 w-3.5 transition-transform",ne&&"rotate-180")})]}),Ve!=null&&jsxRuntime.jsxs("span",{className:"text-foreground font-medium tabular-nums",children:[Ve,"% 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(i)&&i>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(l)&&l>0?parseFloat(l.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(i)&&i>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(i)&&i>0&&c>0?`+$${c.toFixed(2)}`:"\u2013"})]})]})]}),jsxRuntime.jsx(ui.Button,{color:Ae,fullWidth:true,radius:"lg",size:"lg",isDisabled:!Qe||h,isLoading:h,onPress:st,children:vr})]}),jsxRuntime.jsx(ui.Modal,{isOpen:le.isOpen,onClose:le.onClose,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 ",P("predict.trade.kycModalTitle")]})}),jsxRuntime.jsxs(ui.ModalBody,{className:"gap-y-4",children:[jsxRuntime.jsx("p",{className:"text-sm text-default-600",children:P("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:P("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:P("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:P("predict.trade.kycModalBullet3")})]})]}),jsxRuntime.jsx("p",{className:"text-xs text-default-400",children:P("predict.trade.kycModalNote")})]}),jsxRuntime.jsxs(ui.ModalFooter,{children:[jsxRuntime.jsx(ui.Button,{variant:"light",onPress:le.onClose,children:P("common.cancel")}),v&&jsxRuntime.jsx(ui.Button,{color:"primary",onPress:()=>{window.open(v,"_blank","noopener,noreferrer"),le.onClose();},children:P("predict.trade.goToKYC")})]})]})})]})}function Vt({event:e,market:t,variant:r,initialSide:o,initialOutcome:n,chain:a}){let{outcome:i,side:s,orderType:l,quantity:c,limitPrice:u,shares:d,estimatedCost:p,potentialPayout:m,potentialProfit:g,usdcBalance:f,yesTokenBalance:h,noTokenBalance:x,isBalanceLoading:R,isSubmitting:N,validation:w,supportsLimitOrder:v,kycRequired:B,kycUrl:b,expirationEnabled:X,expirationPreset:j,customDuration:ie,customDurationUnit:U,setOutcome:F,setSide:W,setOrderType:$,setQuantity:oe,setLimitPrice:pe,setExpirationEnabled:C,setExpirationPreset:A,setCustomDuration:K,setCustomDurationUnit:P,submit:ne}=qn({market:t,initialSide:o,initialOutcome:n}),me=walletConnector.useAuthCallback(ne),le=react.useMemo(()=>e?$n(e):void 0,[e]),Ve=react.useMemo(()=>Wn(t),[t]);return jsxRuntime.jsx(ro,{event:le,market:Ve,variant:r,outcome:i,side:s,orderType:l,quantity:c,limitPrice:u,shares:d,estimatedCost:p,potentialPayout:m,potentialProfit:g,usdcBalance:f,yesTokenBalance:h,noTokenBalance:x,isBalanceLoading:R,isSubmitting:N,isValid:w.isValid,validationErrors:w.errors,supportsLimitOrder:v,kycRequired:B,kycUrl:b,expirationEnabled:X,expirationPreset:j,customDuration:ie,customDurationUnit:U,onOutcomeChange:F,onSideChange:W,onOrderTypeChange:$,onQuantityChange:oe,onLimitPriceChange:pe,onExpirationEnabledChange:C,onExpirationPresetChange:A,onCustomDurationChange:K,onCustomDurationUnitChange:P,onSubmit:me})}var yt="predict-trade";function jt({id:e=yt}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Hi,{...t})})}function Hi({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(Vt,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,initialSide:"buy",chain:e.chain,variant:"flat"})})})}):null}var Fr={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function Hr(e){let t=0;return e.source&&t++,e.timeRemaining&&t++,e.minVolume&&t++,e.minLiquidity&&t++,t}function so({isOpen:e,onClose:t,value:r,onChange:o}){let{t:n}=i18n.useTranslation(),[a,i]=react.useState(r),s=react.useCallback(h=>{h?i(r):t();},[r,t]),l=react.useCallback(()=>{i(Fr);},[]),c=react.useCallback(()=>{o(a),t();},[a,o,t]),u=react.useCallback((h,x)=>{i(R=>({...R,[h]:x}));},[]),d=react.useMemo(()=>Hr(a),[a]),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]),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]),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]);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(Yt,{label:n("predict.filter.platform"),children:jsxRuntime.jsx(qt,{options:p,selected:a.source,onSelect:h=>u("source",h)})}),jsxRuntime.jsx(Yt,{label:n("predict.filter.timeRemaining"),children:jsxRuntime.jsx(qt,{options:m,selected:a.timeRemaining,onSelect:h=>u("timeRemaining",h)})}),jsxRuntime.jsx(Yt,{label:n("predict.filter.minVolume"),children:jsxRuntime.jsx(qt,{options:g,selected:a.minVolume,onSelect:h=>u("minVolume",h)})}),jsxRuntime.jsx(Yt,{label:n("predict.filter.minLiquidity"),children:jsxRuntime.jsx(qt,{options:f,selected:a.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:l,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 Yt({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 qt({options:e,selected:t,onSelect:r,allowDeselect:o=true}){return jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2",children:e.map(n=>{let a=t===n.value;return jsxRuntime.jsx("button",{type:"button",onClick:()=>{r(a&&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",a?"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 co={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},io={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},ol=["start_time","volume","liquidity","ending_soon"];function uo({sortPreset:e,onSortChange:t,sortAsc:r,onSortAscChange:o,onFilterPress:n,filterCount:a=0,className:i}){let{t:s}=i18n.useTranslation(),[l,c]=react.useState(false),u=react.useRef(null);react.useEffect(()=>{if(!l)return;let p=g=>{u.current&&!u.current.contains(g.target)&&c(false);},m=g=>{g.key==="Escape"&&c(false);};return document.addEventListener("mousedown",p),document.addEventListener("keydown",m),()=>{document.removeEventListener("mousedown",p),document.removeEventListener("keydown",m);}},[l]);let d=lo[e];return jsxRuntime.jsxs("div",{className:ui.cn("flex items-center gap-2",i),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(io[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"}),l&&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:ol.map(p=>{let m=lo[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(io[p])})]},p)})})]}),jsxRuntime.jsx(ui.StyledBadge,{content:a>0?a:void 0,color:"primary",size:"sm",isInvisible:a===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 lo={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:a,isError:i,error:s,hasNextPage:l,fetchNextPage:c,refetch:u}=reactPredict.useInfiniteEvents(t),d=react.useMemo(()=>r?.pages.flatMap(g=>g.items).filter(g=>g!=null)??[],[r]),p=react.useCallback(()=>{c();},[c]),m=react.useCallback(()=>{u();},[u]);return {data:d,isLoading:o,isFetching:n&&!a,isFetchingMore:a,isError:i,error:s??null,hasMore:l??false,fetchMore:p,refetch:m}}function Br({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 Ef({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(Br,{count:e})})]})}var go=3,Wr={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)"},ml={bg:"rgba(239, 68, 68, 0.14)",text:"rgb(239, 68, 68)",shadow:"rgba(239, 68, 68, 0.18)"},St=[{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 fl(e){let t=e.outcomes?.map(i=>i.label?.toLowerCase().trim()??"")??[];if(t.some(i=>i==="up")&&t.some(i=>i==="down"))return [Wr,ml];if(t.some(i=>i==="yes")&&t.some(i=>i==="no"))return [Wr,ko];let r=t[0]??"",o=t[1]??"",n=ho(r)%St.length,a=ho(o)%St.length;return a===n&&(a=(a+1)%St.length),[St[n],St[a]]}function gl(e){let t=e.outcomes?.[0];return t?t.best_ask??t.price??null:null}function No(e){let t=gl(e);return t!=null?parseFloat((t*100).toFixed(2)):0}function So(e){return e<=1&&e>0?"< 1%":e>=99&&e<100?"> 99%":`${e}%`}function xo(e){let t=e.outcomes?.[0],r=t?.best_ask??t?.price??0;return parseFloat((r*100).toFixed(2)).toString()}function vo(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 hl(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),a=[];return r>0&&a.push(`${r}d`),o>0&&a.push(`${o}h`),a.push(`${n}m`),a.join(" ")}var xl=`
2
2
  .badge-shine { position: relative; overflow: hidden; }
3
3
  .badge-shine::after {
4
4
  content: "";
@@ -16,7 +16,36 @@
16
16
  60% { transform: translate(200%); }
17
17
  100% { transform: translate(200%); }
18
18
  }
19
- `;function Rn({event:e,href:t,LinkComponent:n,onSelect:o,onSelectOutcome:r,onHover:i}){let[s,l]=react.useState(null),a=e.markets??[],c=react.useMemo(()=>a.length>2?[...a].sort((M,O)=>(O.outcomes?.[0]?.price??0)-(M.outcomes?.[0]?.price??0)):a,[a]),d=c.filter(M=>M.status==="open"),p=c.length===1,u=d.slice(0,Sn),m=d.length-Sn,f=react.useMemo(()=>`$${Math.round(e.volume??0).toLocaleString("en-US")}`,[e.volume]),g=s?d.find(M=>M.slug===s)??null:null,v=!!g||p,h=()=>{v||o?.(e);},D=M=>{M.stopPropagation(),g&&(M.preventDefault(),l(null));},T=M=>{M.stopPropagation(),t||(M.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",!v&&"cursor-pointer"),onMouseEnter:()=>i?.(e),onClick:h,children:[jsxRuntime.jsx("style",{children:Fa}),jsxRuntime.jsx(Ba,{event:e,href:t,LinkComponent:n,onClick:D,isExpanded:v}),jsxRuntime.jsx("div",{className:"flex flex-1 flex-col",children:p?jsxRuntime.jsx(Ya,{market:d[0],event:e,formattedVolume:f,href:t,LinkComponent:n,onSelect:o,onSelectOutcome:r}):g?jsxRuntime.jsx(qa,{market:g,event:e,onCollapse:()=>l(null),onSelectOutcome:r}):jsxRuntime.jsx(Ka,{displayedMarkets:u,moreCount:m,formattedVolume:f,source:e.source,href:t,LinkComponent:n,onMarketClick:M=>l(M.slug),onShowMore:T})})]})}function Ba({event:e,href:t,LinkComponent:n,onClick:o,isExpanded:r}){let i=e.start_at?Aa(e.start_at):null;return jsxRuntime.jsxs(ui.Linkable,{href:t,LinkComponent:n,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",r&&"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(Ua,{event:e})]})}function Ha(e){let t=[];if(e.status==="closed")return t.push({kind:"closed"}),t.slice(0,2);let n=e.tags?.some(r=>r.label?.toLowerCase()==="crypto"),o=e.tags?.some(r=>r.label?.toLowerCase()==="live");if(n&&e.end_at){let r=new Date(e.end_at).getTime()-Date.now(),i=300*1e3,s=900*1e3;if(r>0&&r<=s){let l=r<=i?"#ef4444":"#f59e0b";t.push({kind:"crypto-short",label:r<=i?"5m":"15m",color:l});}}return o&&t.push({kind:"live"}),t.slice(0,2)}function Ua({event:e}){let t=react.useMemo(()=>Ha(e),[e]);return t.length===0?null:jsxRuntime.jsx("div",{className:"flex flex-shrink-0 flex-col items-end gap-1",children:t.map((n,o)=>{switch(n.kind){case "live":return jsxRuntime.jsx($a,{},o);case "crypto-short":return jsxRuntime.jsx(Wa,{label:n.label,color:n.color},o);case "closed":return jsxRuntime.jsx(za,{},o)}})})}function $a(){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 Wa({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 za(){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 Ka({displayedMarkets:e,moreCount:t,formattedVolume:n,source:o,href:r,LinkComponent:i,onMarketClick:s,onShowMore:l}){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 d=Tn(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(),s(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:Mn(d)}),jsxRuntime.jsx(Va,{})]})]},c.slug)})}),jsxRuntime.jsxs("div",{className:"mt-auto flex items-center justify-between pt-3",children:[t>0?jsxRuntime.jsxs(ui.Linkable,{href:r,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:l,children:[a("predict.event.showMore"),jsxRuntime.jsx(On,{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:[n," ",a("predict.event.volume"),jsxRuntime.jsx(In,{source:o})]})]})]})}function Pn({bgColor:e,textColor:t,shadowColor:n,onClick:o,children:r}){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":n,"--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:l=>{let a=l.currentTarget;a.style.setProperty("--shadow-offset","2px"),a.style.transform="translateY(2px)";},onMouseLeave:l=>{let a=l.currentTarget;a.style.setProperty("--shadow-offset","4px"),a.style.transform="translateY(0px)";},onClick:o,children:r})}function Ln({market:e,event:t,onSelectOutcome:n,dynamicColors:o=false,labelFormat:r="action"}){let{t:i}=i18n.useTranslation(),[s,l]=o?_a(e):[ir,Cn],a=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",c=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",d=r==="label"&&a===c?"action":r,p=d==="label"?`${e.outcomes?.[0]?.label??"Yes"} ${wn(e)}\xA2`:i("predict.market.action.yes",{price:wn(e)}),u=d==="label"?`${e.outcomes?.[1]?.label??"No"} ${kn(e)}\xA2`:i("predict.market.action.no",{price:kn(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(Pn,{bgColor:s.bg,textColor:s.text,shadowColor:s.shadow,onClick:m=>{m.stopPropagation(),n?.(t,e,"yes");},children:p}),jsxRuntime.jsx(Pn,{bgColor:l.bg,textColor:l.text,shadowColor:l.shadow,onClick:m=>{m.stopPropagation(),n?.(t,e,"no");},children:u})]})}function Va(){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 Ya({market:e,event:t,formattedVolume:n,href:o,LinkComponent:r,onSelect:i,onSelectOutcome:s}){let{t:l}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex-1",children:jsxRuntime.jsx(Ln,{market:e,event:t,onSelectOutcome:s,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:r,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:[l("predict.event.viewEvent"),jsxRuntime.jsx(On,{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:[n," ",l("predict.event.volume"),jsxRuntime.jsx(In,{source:t.source})]})]})]})}function qa({market:e,event:t,onCollapse:n,onSelectOutcome:o}){let{t:r}=i18n.useTranslation(),i=Tn(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:s=>{s.stopPropagation(),n();},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:Mn(i)}),jsxRuntime.jsx(ui.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{className:"mt-3",children:jsxRuntime.jsx(Ln,{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:s=>{s.stopPropagation(),n();},children:[jsxRuntime.jsx(ja,{className:"h-3 w-3"}),r("predict.event.back")]})]})}function On({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 ja({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 In({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 ei=768,Dn=1024,ti=1280,ri=8,ni=224,oi=304,si=114;function ai(e){return e>=ti?4:e>=Dn?3:e>=ei?2:1}function ii(e){return e>=Dn?oi:ni}function An({events:e,hasMore:t=false,onFetchMore:n,onSelect:o,onSelectOutcome:r,getEventHref:i,LinkComponent:s,onHover:l}){let a=react.useRef(null),c=react.useRef(null),{width:d=0,height:p=0}=hooks.useResizeObserver({ref:a}),u=ai(d),m=ii(d),f=Math.ceil(e.length/u)||0,g=!t&&e.length>0,v=f+(t?1:0)+(g?1:0),h=react.useCallback(O=>O<f,[f]),D=react.useCallback(async()=>{n?.();},[n]),T=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:h,loadMoreRows:D,rowCount:v,threshold:3}),M=react.useCallback(()=>{c.current?.scrollToRow({index:0,behavior:"smooth"});},[]);return jsxRuntime.jsx("div",{ref:a,className:"@container w-full h-full",children:p>0&&jsxRuntime.jsx(reactWindow.List,{listRef:c,className:"no-scrollbar",style:{height:p},onRowsRendered:T,rowComponent:li,rowCount:v,rowHeight:O=>g&&O===v-1?si:(m),rowProps:{events:e,columnCount:u,dataRowCount:f,showEndOfList:g,totalRowCount:v,onSelect:o,onSelectOutcome:r,getEventHref:i,LinkComponent:s,onHover:l,onScrollToTop:M}})})}function li({index:e,style:t,events:n,columnCount:o,dataRowCount:r,showEndOfList:i,totalRowCount:s,onSelect:l,onSelectOutcome:a,getEventHref:c,LinkComponent:d,onHover:p,onScrollToTop:u}){if(i&&e===s-1)return jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(ci,{onScrollToTop:u})});if(e>=r)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=n.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(v=>v==null?null:jsxRuntime.jsx("div",{className:"flex-1 min-w-0 flex",style:{padding:ri},children:jsxRuntime.jsx(Rn,{event:v,href:c?.(v),LinkComponent:d,onSelect:l,onSelectOutcome:a,onHover:p})},v.slug)),g>0&&Array.from({length:g}).map((v,h)=>jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}},`spacer-${h}`))]})})}function ci({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 Bn({tagSlugSelection:e,limit:t=48,status:n,sort_by:o,sort_asc:r,source:i,with_markets:s,timeRemaining:l,minVolume:a,minLiquidity:c,onSelect:d,onSelectOutcome:p,getEventHref:u,LinkComponent:m,onHover:f}){let{data:g,hasMore:v,fetchMore:h,isFetching:D}=yn({tagSlugSelection:e,limit:t,status:n,sort_by:o,sort_asc:r,source:i,with_markets:s,timeRemaining:l,minVolume:a,minLiquidity:c});return D?jsxRuntime.jsx(sr,{count:48}):jsxRuntime.jsx(An,{events:g,hasMore:v,onFetchMore:h,onSelect:d,onSelectOutcome:p,getEventHref:u,LinkComponent:m,onHover:f})}function ju({onSelect:e,onSelectOutcome:t,getEventHref:n,LinkComponent:o,onHover:r}){let[i,s]=react.useState({categorySlug:null,tagSlug:null}),[l,a]=react.useState(nr),{isOpen:c,onOpen:d,onClose:p}=ui.useDisclosure(),{onOpen:u}=uiScaffold.useAsyncModal(Je),m=react.useCallback((O,Z,R)=>{t?.(O,Z,R),u({params:{event:O,market:Z,initialOutcome:R}});},[t,u]),f=react.useCallback(O=>{s(O);},[]),g=react.useCallback(O=>{a(Z=>({...Z,sortPreset:O}));},[]),v=react.useCallback(O=>{a(Z=>({...Z,sortAsc:O}));},[]),h=react.useCallback(O=>{a(O);},[]),D=react.useMemo(()=>vn[l.sortPreset].sort_by,[l.sortPreset]),T=react.useMemo(()=>or(l),[l]),M=react.useMemo(()=>jsxRuntime.jsx(xn,{sortPreset:l.sortPreset,onSortChange:g,sortAsc:l.sortAsc,onSortAscChange:v,onFilterPress:d,filterCount:T}),[l.sortPreset,l.sortAsc,T,g,v,d]);return jsxRuntime.jsxs("div",{className:"flex h-full w-full max-w-[1680px] mx-auto flex-col gap-y-3",children:[jsxRuntime.jsx(Vr,{onSelect:f,trailing:M}),jsxRuntime.jsx(pn,{isOpen:c,onClose:p,value:l,onChange:h}),jsxRuntime.jsx("div",{className:"min-h-0 flex-1",children:jsxRuntime.jsx(Bn,{tagSlugSelection:i,sort_by:D,sort_asc:l.sortAsc,source:l.source,timeRemaining:l.timeRemaining,minVolume:l.minVolume,minLiquidity:l.minLiquidity,onSelect:e,onSelectOutcome:m,getEventHref:n,LinkComponent:o,onHover:r})}),jsxRuntime.jsx(yt,{})]})}var fr=40,Ct=36,st=480,gr=st-Ct;function Wn({event:e,walletAddress:t,onCancelOrder:n}){let{t:o}=i18n.useTranslation(),[r,i]=react.useState("positions"),s=react.useMemo(()=>e.markets?.map(p=>p.slug)??[],[e.markets]),{data:l}=reactPredict.usePositions({source:e.source,user:t??""}),a=react.useMemo(()=>!l?.positions||!t?0:s.length===0?l.positions.length:l.positions.filter(p=>p.market&&s.includes(p.market.slug)).length,[l?.positions,s,t]),d=[{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: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",r===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:st},children:[r==="positions"&&jsxRuntime.jsx(hi,{source:e.source,walletAddress:t,marketSlugs:s}),r==="orders"&&jsxRuntime.jsx(yi,{source:e.source,walletAddress:t,marketSlugs:s,onCancelOrder:n}),r==="trades"&&jsxRuntime.jsx(wi,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:st},children:o("predict.trade.connectWallet")})]})}function hi({source:e,walletAddress:t,marketSlugs:n}){let{t:o}=i18n.useTranslation(),{data:r,isLoading:i}=reactPredict.usePositions({source:e,user:t}),s=react.useMemo(()=>r?.positions?n.length===0?r.positions:r.positions.filter(l=>l.market&&n.includes(l.market.slug)):[],[r?.positions,n]);return i?jsxRuntime.jsx(xr,{}):s.length===0?jsxRuntime.jsx(vr,{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:Ct},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:gr},rowComponent:bi,rowCount:s.length,rowHeight:fr,rowProps:{positions:s,closeLabel:o("predict.positions.close")}})]})}function bi({index:e,style:t,positions:n,closeLabel:o}){let r=n[e];if(!r)return null;let i=r.pnl??0,s=r.pnl_percent??0,l=r.avg_price??0,a=r.current_price??0,c=i>0?"text-success":i<0?"text-danger":"text-foreground",d=i>0?"+":"",p=r.market?.outcomes?.[0]?.label??r.market?.question??"\u2014",u=r.side,m=r.size,f=r.size*a,g=r.market?.end_at?Ei(r.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:r.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:Pt(l)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:Pt(a)}),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,s.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 yi({source:e,walletAddress:t,marketSlugs:n,onCancelOrder:o}){let{t:r}=i18n.useTranslation(),{data:i,isLoading:s,fetchNextPage:l,hasNextPage:a}=reactPredict.useInfiniteOrders({source:e,wallet_address:t}),c=reactPredict.useCancelOrder(),d=react.useMemo(()=>{let h=i?.pages?.flatMap(M=>M.items)??[],D=new Set(["live","open","submitted","pending"]),T=h.filter(M=>D.has(M.status));return n.length>0&&(T=T.filter(M=>M.market_id&&n.includes(M.market_id))),T},[i?.pages,n]),p=react.useCallback(h=>{o?o(h.id):c.mutate({source:h.source,id:h.id});},[o,c]),u=d.length,m=u+(a?1:0),f=react.useCallback(h=>h<u,[u]),g=react.useCallback(async()=>{await l();},[l]),v=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:f,loadMoreRows:g,rowCount:m,threshold:5});return s?jsxRuntime.jsx(xr,{}):d.length===0&&!a?jsxRuntime.jsx(vr,{message:r("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:Ct},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:r("predict.openOrders.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:r("predict.openOrders.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:r("predict.openOrders.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.openOrders.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:r("predict.openOrders.filled")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:r("predict.openOrders.status")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:gr},onRowsRendered:v,rowComponent:Si,rowCount:m,rowHeight:fr,rowProps:{orders:d,itemCount:u,onCancel:p,isCancelling:c.isPending,cancelLabel:r("predict.openOrders.cancel")}})]})}function Si({index:e,style:t,orders:n,itemCount:o,onCancel:r,isCancelling:i,cancelLabel:s}){if(e>=o)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})});let l=n[e];if(!l)return null;let a=l.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:l.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:l.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize",children:l.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:l.price?Pt(parseFloat(l.price)):"\u2014"}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:[l.size_matched??"0","/",l.original_size??"\u2014"]}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:jsxRuntime.jsx(Ni,{status:l.status})}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(l),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"}):s})})]})}function Ni({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 wi({source:e,walletAddress:t}){let{t:n}=i18n.useTranslation(),{data:o,isLoading:r,fetchNextPage:i,hasNextPage:s}=reactPredict.useInfiniteTrades({source:e,wallet:t,limit:50}),l=react.useMemo(()=>o?.pages?.flatMap(m=>m.items)??[],[o?.pages]),a=l.length,c=a+(s?1:0),d=react.useCallback(m=>m<a,[a]),p=react.useCallback(async()=>{await i();},[i]),u=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:d,loadMoreRows:p,rowCount:c,threshold:5});return r?jsxRuntime.jsx(xr,{}):l.length===0&&!s?jsxRuntime.jsx(vr,{message:n("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:Ct},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:n("predict.tradeHistory.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.tradeHistory.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.tradeHistory.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.tradeHistory.qty")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.tradeHistory.total")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:n("predict.tradeHistory.time")})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:gr},onRowsRendered:u,rowComponent:ki,rowCount:c,rowHeight:fr,rowProps:{trades:l,itemCount:a}})]})}function ki({index:e,style:t,trades:n,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 r=n[e];if(!r)return null;let i=r.side?.toUpperCase()==="BUY",s=Pi(r.timestamp),l=r.price??0,a=r.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:r.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:r.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Pt(l)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:r.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:s})]})}function vr({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:st},children:e})}function xr(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:st},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function Pt(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function Pi(e){let t=new Date(e*1e3),n=(t.getMonth()+1).toString().padStart(2,"0"),o=t.getDate().toString().padStart(2,"0"),r=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0");return `${n}/${o} ${r}:${i}`}function Ei(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}function at({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((n,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 zn(){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 qn="var(--color-bullish)",jn="var(--color-bearish)";function it(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 Mi(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function Ri(e,t){let n=new Float64Array(101),o=new Float64Array(101);for(let m of e){let f=Math.round(m.price*100);f>=0&&f<=100&&(n[f]+=m.quantity);}for(let m of t){let f=Math.round(m.price*100);f>=0&&f<=100&&(o[f]+=m.quantity);}let r=0,i=0,s=new Float64Array(101),l=new Float64Array(101);for(let m=100;m>=0;m--)r+=n[m],i+=n[m]*m/100,s[m]=r,l[m]=i;let a=0,c=0,d=new Float64Array(101),p=new Float64Array(101);for(let m=0;m<=100;m++)a+=o[m],c+=o[m]*m/100,d[m]=a,p[m]=c;let u=Math.max(s[0]??0,d[100]??0);return Array.from({length:101},(m,f)=>{let g=s[f]>0,v=d[f]>0,h=s[f]||d[f],D=n[f]>0||o[f]>0;return {priceCents:f,displayHeight:Mi(h,u),opacity:h>0?D?1:.5:0,isBid:g,isAsk:v,bidCumTotal:s[f],askCumTotal:d[f],bidCumCost:l[f],askCumCost:p[f]}})}function Li({info:e}){let{t}=i18n.useTranslation(),n=e.isBid?qn:jn,o=e.leftPct>65?void 0:`${e.leftPct}%`,r=e.leftPct>65?`${100-e.leftPct}%`:void 0;return jsxRuntime.jsxs("div",{style:{position:"absolute",top:8,left:o,right:r,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:n},children:t("predict.orderBook.depthContracts",{amount:it(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:n},children:["$",it(Math.round(e.cumCost))]})]})}var Oi=react.memo(function({slot:t,onEnter:n,onLeave:o}){let r=react.useRef(null),i=t.isBid||t.isAsk,s=t.isBid?qn:t.isAsk?jn: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:()=>n(t,r.current),onMouseLeave:o,children:i&&jsxRuntime.jsx("div",{ref:r,style:{position:"absolute",bottom:0,left:0,width:"100%",height:`${t.displayHeight*100}%`,backgroundColor:s,opacity:t.opacity}})})}),Ii=[0,10,20,30,40,50,60,70,80,90,100];function _i(){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:Ii.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 Gn({bids:e,asks:t}){let{t:n}=i18n.useTranslation(),o=react.useMemo(()=>Ri(e,t),[e,t]),r=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]),[s,l]=react.useState(null),a=react.useRef(null),c=react.useCallback((p,u)=>{a.current&&(a.current.style.filter=""),u?(u.style.filter="brightness(1.5)",a.current=u):a.current=null,p.isBid||p.isAsk?l({priceCents:p.priceCents,isBid:p.isBid,cumTotal:p.isBid?p.bidCumTotal:p.askCumTotal,cumCost:p.isBid?p.bidCumCost:p.askCumCost,leftPct:p.priceCents}):l(null);},[]),d=react.useCallback(()=>{a.current&&(a.current.style.filter="",a.current=null),l(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:[r>0&&jsxRuntime.jsx("div",{style:{position:"absolute",left:`${r}%`,top:0,bottom:0,width:1,backgroundImage:"repeating-linear-gradient(to bottom, #6b7280 0, #6b7280 4px, transparent 4px, transparent 8px)",zIndex:1,pointerEvents:"none"}}),s&&jsxRuntime.jsx(Li,{info:s}),o.map(p=>jsxRuntime.jsx(Oi,{slot:p,onEnter:c,onLeave:d},p.priceCents))]}),jsxRuntime.jsx(_i,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:n("predict.orderBook.noData")})}function br(e){let t=e*100,n=Math.round(t*10)/10;return Number.isInteger(n)?`${n}\xA2`:`${n.toFixed(1)}\xA2`}function Xn(){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 eo({market:e,outcome:t="yes",onTradeAction:n}){let{t:o}=i18n.useTranslation(),[r,i]=react.useState("depth"),s=t==="no",l=e.source,{data:a,isLoading:c}=reactPredict.useOrderbook({slug:e.slug,source:l}),d=react.useMemo(()=>((s?a?.asks:a?.bids)??[]).map(v=>({price:s?1-v.price:v.price,quantity:v.size})),[a?.bids,a?.asks,s]),p=react.useMemo(()=>((s?a?.bids:a?.asks)??[]).map(v=>({price:s?1-v.price:v.price,quantity:v.size})),[a?.bids,a?.asks,s]),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"),": ",br(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"),": ",br(m)]})]}),jsxRuntime.jsx("div",{className:"flex flex-1 justify-end",children:jsxRuntime.jsx("button",{type:"button",title:r==="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:r==="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:[r==="depth"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(Xn,{}):jsxRuntime.jsx(Gn,{bids:d,asks:p})}),r==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(Xn,{}):jsxRuntime.jsx(Ui,{bids:d,asks:p,bestBid:u??void 0,bestAsk:m??void 0,spread:f??void 0})})]})]})}var Qn=8;function Ui({bids:e,asks:t,spread:n}){let{t:o}=i18n.useTranslation(),r=react.useMemo(()=>[...t].sort((a,c)=>a.price-c.price).slice(0,Qn).reverse(),[t]),i=react.useMemo(()=>[...e].sort((a,c)=>c.price-a.price).slice(0,Qn),[e]),s=react.useMemo(()=>{let a=[...r,...i].map(c=>c.quantity);return Math.max(...a,1)},[r,i]);return r.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:[r.map(a=>jsxRuntime.jsx(Jn,{price:a.price,quantity:a.quantity,side:"ask",maxQty:s},`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:n!=null&&jsxRuntime.jsxs("span",{children:[o("predict.orderBook.spread"),":"," ",Number.isInteger(n)?`${n}\xA2`:`${n.toFixed(1)}\xA2`]})}),i.map(a=>jsxRuntime.jsx(Jn,{price:a.price,quantity:a.quantity,side:"bid",maxQty:s},`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 Jn({price:e,quantity:t,side:n,maxQty:o}){let r=n==="ask",i=Math.min(t/o*100,100),s=r?"bg-bearish/10":"bg-bullish/10",l=r?"text-bearish":"text-bullish",a=it(Math.round(t)),c=Math.round(t*e),d=`$${it(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 ${s} transition-[width] duration-200`,style:{width:`${i}%`}}),jsxRuntime.jsx("span",{className:`relative z-10 ${l}`,children:br(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:d})]})}var Nr=class extends react.Component{state={error:null};static getDerivedStateFromError(t){return {error:t}}componentDidCatch(t,n){}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}},Rt=4,to=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function Ji(e,t){let n=new Date(e);return t===reactPredict.ChartRange.ONE_DAY?n.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):n.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function Zi(e,t){let n=new Date(e);return t===reactPredict.ChartRange.ONE_DAY?n.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):t===reactPredict.ChartRange.ONE_WEEK?n.toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:false}):n.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function ro(e){return `${(e*100).toFixed(2)}%`}var el=[{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 tl({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:el.map(({range:n,label:o})=>{let r=n===e;return jsxRuntime.jsx("button",{onClick:()=>t(n),style:{padding:"2px 8px",border:"none",background:"transparent",color:r?"#f9fafb":"#6b7280",fontWeight:r?700:400,fontSize:12,cursor:"pointer",borderRadius:4,letterSpacing:"0.02em",transition:"color 0.15s",userSelect:"none"},children:o},n)})})}function rl(){let e=react.useRef(null),t=react.useRef(null),n=react.useCallback(r=>{let i=e.current,s=t.current;if(!i||!s)return;let l=i.getBoundingClientRect(),a=(r.clientX-l.left)/l.width*100;s.style.background=`linear-gradient(to right, transparent ${a}%, rgba(0,0,0,0.55) ${a}%)`,s.style.opacity="1";},[]),o=react.useCallback(()=>{t.current&&(t.current.style.opacity="0");},[]);return {wrapperRef:e,overlayRef:t,onMouseMove:n,onMouseLeave:o}}function nl({active:e,payload:t,label:n,labelMap:o,allSeries:r,range:i}){if(!e||!r?.length)return null;let s=new Map;t?.forEach(a=>s.set(a.dataKey,a));let l=r.map(a=>s.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 n=="number"?Zi(n,i):n}),l.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?ro(a.value):"--"})]},a.dataKey))]})}function ol({markets:e,selectedSlugs:t,colorMap:n,onToggle:o}){let[r,i]=react.useState(false),s=react.useRef(null);react.useEffect(()=>{if(!r)return;function c(d){s.current&&!s.current.contains(d.target)&&i(false);}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);let l=t.length>=Rt,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:n.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:s,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:r?"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"})})]}),r&&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 ",Rt," markets"]}),e.map(c=>{let d=t.includes(c.slug),p=!d&&l,u=d&&t.length===1,m=n.get(c.slug)??"#6b7280",f=c.outcomes.find(v=>v.label.toLowerCase()==="yes")??c.outcomes[0],g=f?.price!=null?`${Math.round(f.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{u||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||u?"not-allowed":"pointer",opacity:p?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:v=>{!p&&!u&&(v.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:v=>{v.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 ${m}`:"2px solid rgba(255,255,255,0.2)",background:d?`${m}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:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:m,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}),g&&jsxRuntime.jsx("span",{style:{color:m,fontWeight:700,fontSize:12,flexShrink:0},children:g})]},c.slug)})]})]})}function sl({series:e,colorMap:t,displayValues:n}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px 24px",padding:"0 2px"},children:e.map(o=>{let r=t.get(o.marketSlug)??"#6b7280",i=n.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:r,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?ro(i):"--"})]})]},o.marketSlug)})})}function al(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function il(e,t){if(e.length<=t)return e;let n=[],o=e.length/t;for(let r=0;r<t;r++){let i=Math.floor(r*o),s=Math.min(Math.floor((r+1)*o),e.length),l=e.slice(i,s),a=l.map(c=>c.price).sort((c,d)=>c-d);n.push({timestamp:l[l.length-1].timestamp,price:al(a)});}return n}function ll(e,t=200){if(e.length===0)return [];let n=e.map(l=>({...l,data:il(l.data,t)})),o=new Set;n.forEach(l=>l.data.forEach(a=>o.add(a.timestamp)));let r=Array.from(o).sort((l,a)=>l-a),i=n.map(l=>{let a=new Map;return l.data.forEach(c=>a.set(c.timestamp,c.price)),{slug:l.marketSlug,map:a}}),s=new Map;return r.map(l=>{let a={timestamp:l};return i.forEach(({slug:c,map:d})=>{let p=d.get(l);if(p!==void 0)s.set(c,p),a[c]=p;else {let u=s.get(c);u!==void 0&&(a[c]=u);}}),a})}function no(e){return jsxRuntime.jsx(Nr,{children:jsxRuntime.jsx(cl,{...e})})}function cl({event:e,isLoading:t,className:n,volume:o}){let r=react.useMemo(()=>(e.markets??[]).filter(S=>S.status==="open"),[e.markets]),i=react.useMemo(()=>[...r].sort((S,E)=>{let I=y=>(y.outcomes.find($=>$.label.toLowerCase()==="yes")??y.outcomes[0])?.price??0;return I(E)-I(S)}),[r]),[s,l]=react.useState(()=>i.slice(0,Rt).map(S=>S.slug)),[a,c]=react.useState(ht),d=react.useMemo(()=>{let S=new Map;return s.forEach((E,I)=>{S.set(E,to[I%to.length]);}),S},[s]),p=react.useMemo(()=>r.filter(S=>s.includes(S.slug)),[r,s]),{series:u,isLoading:m}=reactPredict.useMarketHistory(p,a),f=t||m,g=react.useMemo(()=>{if(u.length>0&&u.some(I=>I.data.length>0))return u;let S=Date.now(),E=864e5;return p.map(I=>{let $=(I.outcomes?.find(q=>q.label.toLowerCase()==="yes")??I.outcomes?.[0])?.price??.5;return {marketSlug:I.slug,label:I.outcomes?.[0]?.label??I.question,data:[{timestamp:S-7*E,price:$},{timestamp:S,price:$}]}})},[u,p]),v=react.useMemo(()=>a===reactPredict.ChartRange.ONE_DAY?96:a===reactPredict.ChartRange.ONE_WEEK?168:a===reactPredict.ChartRange.ONE_MONTH?180:300,[a]),h=react.useMemo(()=>ll(g,v),[g,v]),D=react.useMemo(()=>{if(h.length===0)return [0,1];let S=1/0,E=-1/0;if(s.forEach(y=>{h.forEach($=>{let q=$[y];q!=null&&(q<S&&(S=q),q>E&&(E=q));});}),!isFinite(S))return [0,1];let I=Math.max((E-S)*.15,.05);return [Math.max(0,S-I),Math.min(1,E+I)]},[h,s]),T=react.useMemo(()=>{let S=new Map;return g.forEach(E=>{E.data.length>0&&S.set(E.marketSlug,E.data[E.data.length-1].price);}),S},[g]),M=react.useMemo(()=>{let S=new Map;return g.forEach(E=>S.set(E.marketSlug,E.label)),S},[g]),O=react.useMemo(()=>g.map(S=>({slug:S.marketSlug,color:d.get(S.marketSlug)??"#6b7280"})),[g,d]),{wrapperRef:Z,overlayRef:R,onMouseMove:ie,onMouseLeave:K}=rl(),fe=react.useCallback(S=>{l(E=>E.includes(S)?E.length<=1?E:E.filter(I=>I!==S):E.length>=Rt?E:[...E,S]);},[]),[Me,X]=react.useState(null),Q=react.useRef(null),le=react.useRef(""),he=react.useRef(0),be=!f&&h.length>0;return jsxRuntime.jsxs("div",{className:n,style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsx(sl,{series:g,colorMap:d,displayValues:Me??T}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[jsxRuntime.jsx("div",{ref:Z,style:{height:300,width:"100%",userSelect:"none",position:"relative"},onMouseMove:be?S=>{ie(S),cancelAnimationFrame(he.current),he.current=requestAnimationFrame(()=>{X(Q.current);});}:void 0,onMouseLeave:be?()=>{K(),cancelAnimationFrame(he.current),le.current="",Q.current=null,X(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"}})}):h.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:R,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:h,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:S=>Ji(S,a),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:D,tickFormatter:S=>`${Math.round(S*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:S=>{let E=S;if(E.active&&E.payload?.length){let I=E.payload.map(y=>`${y.dataKey}:${y.value}`).join(",");if(I!==le.current){le.current=I;let y=new Map;E.payload.forEach($=>{$.value!=null&&y.set($.dataKey,$.value);}),Q.current=y;}}return jsxRuntime.jsx(nl,{...E,labelMap:M,allSeries:O,range:a})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),g.map(S=>{let E=d.get(S.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:S.marketSlug,stroke:E,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:E},connectNulls:true,isAnimationActive:false},S.marketSlug)}),Me==null&&h.length>0&&g.map(S=>{let E=h[h.length-1],I=E[S.marketSlug];if(I==null)return null;let y=d.get(S.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:E.timestamp,y:I,ifOverflow:"extendDomain",shape:$=>{let{cx:q,cy:z}=$;return q==null||z==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:q,cy:z,r:6,fill:y,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:q,cy:z,r:3.5,fill:y})]})}},`pulse-${S.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(tl,{value:a,onChange:c}),i.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(ol,{markets:i,selectedSlugs:s,colorMap:d,onToggle:fe})})]})]})]})}function ct(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function wl(e){return `${parseFloat((e*100).toFixed(2))}%`}function oo(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function Lt(e){return e.outcomes?.[0]?.label??e.question}function kl(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function lt(e){if(!e)return "\u2014";let t=new Date(e);if(isNaN(t.getTime()))return "\u2014";let n=t.toLocaleString("default",{month:"short"}),o=t.getDate(),r=t.getFullYear(),i=t.getHours().toString().padStart(2,"0"),s=t.getMinutes().toString().padStart(2,"0");return `${n} ${o}, ${r} ${i}:${s}`}function so(e){let[t,n]=react.useState(Date.now());if(react.useEffect(()=>{if(!e)return;let d=setInterval(()=>n(Date.now()),1e3);return ()=>clearInterval(d)},[e]),!e)return null;let o=new Date(e).getTime();if(isNaN(o))return null;let r=o-t;if(r<=0)return null;let i=Math.floor(r/864e5),s=Math.floor(r%864e5/36e5),l=Math.floor(r%36e5/6e4),a=Math.floor(r%6e4/1e3),c=[];return i>0&&c.push(`${i}d`),c.push(`${String(s).padStart(2,"0")}h`),c.push(`${String(l).padStart(2,"0")}m`),c.push(`${String(a).padStart(2,"0")}s`),c.join(" ")}function ao(e){if(!e)return null;let t=new Date(e);if(isNaN(t.getTime()))return null;let n=t.getHours().toString().padStart(2,"0"),o=t.getMinutes().toString().padStart(2,"0"),r=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0"),s=t.getFullYear(),l=-t.getTimezoneOffset(),a=l>=0?"+":"-",c=String(Math.abs(Math.floor(l/60))).padStart(2,"0");return `${n}:${o} ${r}/${i}/${s} (${a}${c})`}function co({event:e,onTradeAction:t}){let{t:n}=i18n.useTranslation(),{ref:o,isCollapsed:r}=hooks.useScrollCollapse(),i=react.useMemo(()=>{let p=[...e.markets||[]],u=p.filter(f=>f.status==="open").sort((f,g)=>ct(g)-ct(f)),m=p.filter(f=>f.status!=="open").sort((f,g)=>ct(g)-ct(f));return [...u,...m]},[e.markets]),s=e.status==="closed"||e.status==="voided",l=so(s?void 0:e.start_at),a=so(s?void 0:e.end_at),c=ao(e.start_at),d=ao(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 ${r?"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 ${r?"!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:[!r&&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(Tl,{source:e.source})]}),jsxRuntime.jsx("span",{className:`font-semibold truncate transition-all duration-300 ${r?"text-sm lg:text-base":"text-lg lg:text-xl"}`,children:e.title})]})]}),(l||a||s)&&jsxRuntime.jsx("div",{className:"flex items-center gap-x-2 text-xs lg:text-sm font-mono",children:s?d&&jsxRuntime.jsx("span",{className:"text-neutral",children:n("predict.event.endedAt",{time:d})}):l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:n("predict.event.beginsIn",{time:l})}),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:n("predict.event.endsIn",{time:a})}),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(no,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx(Pl,{markets:i,onTradeAction:t}),jsxRuntime.jsx(Cl,{markets:i,event:e})]})}var io=5;function Pl({markets:e,onTradeAction:t}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui.useScreen(),[r,i]=react.useState(false),[s,l]=react.useState(null),a=e.find(g=>g.status==="open")?.slug,[c,d]=react.useState(a?`${a}:yes`:null);if(e.length===0)return null;let p=e.length>io,u=r?e:e.slice(0,io),m=g=>{l(v=>v===g?null:g);},f=(g,v,h)=>{d(`${g.slug}:${v}`),o||l(g.slug),t?.(g,v,h);};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:n("predict.market.table.chance")}),jsxRuntime.jsx("th",{})]})}),jsxRuntime.jsx("tbody",{children:u.map(g=>{let v=ct(g),h=g.outcomes[1]?.best_ask??g.outcomes[1]?.price,D=s===g.slug;return jsxRuntime.jsx(El,{market:g,yesPrice:v,noPrice:h??void 0,activeYes:c===`${g.slug}:yes`,activeNo:c===`${g.slug}:no`,isExpanded:D,onToggleExpand:()=>m(g.slug),onTradeAction:f},g.slug)})})]}),p&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>i(g=>!g),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:n(r?"predict.event.rules.collapse":"predict.event.moreMarketsLabel")}),jsxRuntime.jsx(ui.ChevronDownIcon,{className:ui.cn("h-4 w-4 transition-transform",r&&"rotate-180")})]})]})}function El({market:e,yesPrice:t,noPrice:n,activeYes:o,activeNo:r,isExpanded:i,onToggleExpand:s,onTradeAction:l}){let{t:a}=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:s,role:"button",tabIndex:0,onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),s());},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:Lt(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:Lt(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:wl(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(),l?.(e,"yes","buy");},children:a("predict.market.action.yes",{price:oo(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",r?"bg-secondary text-secondary-foreground":"bg-secondary/10 text-secondary"),onClick:p=>{p.stopPropagation(),l?.(e,"no","buy");},children:n!=null?a("predict.market.action.no",{price:oo(n)}):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(eo,{market:e,outcome:r?"no":"yes",onTradeAction:l})})})})]})}function Cl({markets:e,event:t}){let{t:n}=i18n.useTranslation(),[o,r]=react.useState(false),[i,s]=react.useState(false),[l,a]=react.useState(0),c=e.filter(m=>m.rules&&m.rules.length>0||m.description);if(c.length===0)return null;let d=c[l]??c[0],p=d.rules&&d.rules.length>0?d.rules.join(`
19
+ `;function wo({event:e,href:t,LinkComponent:r,onSelect:o,onSelectOutcome:n,onHover:a}){let[i,s]=react.useState(null),l=e.markets??[],c=react.useMemo(()=>l.length>2?[...l].sort((w,v)=>(v.outcomes?.[0]?.price??0)-(w.outcomes?.[0]?.price??0)):l,[l]),u=c.filter(w=>w.status==="open"),d=c.length===1,p=u.slice(0,go),m=u.length-go,g=react.useMemo(()=>`$${Math.round(e.volume??0).toLocaleString("en-US")}`,[e.volume]),f=i?u.find(w=>w.slug===i)??null:null,h=!!f||d,x=()=>{h||o?.(e);},R=w=>{w.stopPropagation(),f&&(w.preventDefault(),s(null));},N=w=>{w.stopPropagation(),t||(w.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:()=>a?.(e),onClick:x,children:[jsxRuntime.jsx("style",{children:xl}),jsxRuntime.jsx(vl,{event:e,href:t,LinkComponent:r,onClick:R,isExpanded:h}),jsxRuntime.jsx("div",{className:"flex flex-1 flex-col",children:d?jsxRuntime.jsx(Cl,{market:u[0],event:e,formattedVolume:g,href:t,LinkComponent:r,onSelect:o,onSelectOutcome:n}):f?jsxRuntime.jsx(El,{market:f,event:e,onCollapse:()=>s(null),onSelectOutcome:n}):jsxRuntime.jsx(wl,{displayedMarkets:p,moreCount:m,formattedVolume:g,source:e.source,href:t,LinkComponent:r,onMarketClick:w=>s(w.slug),onShowMore:N})})]})}function vl({event:e,href:t,LinkComponent:r,onClick:o,isExpanded:n}){let a=e.start_at?hl(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}),a&&jsxRuntime.jsxs("span",{className:"text-[10px] leading-4 text-neutral-500",children:["Live in ",a]})]}),jsxRuntime.jsx(yl,{event:e})]})}function bl(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(),a=300*1e3,i=900*1e3;if(n>0&&n<=i){let s=n<=a?"#ef4444":"#f59e0b";t.push({kind:"crypto-short",label:n<=a?"5m":"15m",color:s});}}return o&&t.push({kind:"live"}),t.slice(0,2)}function yl({event:e}){let t=react.useMemo(()=>bl(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(kl,{},o);case "crypto-short":return jsxRuntime.jsx(Nl,{label:r.label,color:r.color},o);case "closed":return jsxRuntime.jsx(Sl,{},o)}})})}function kl(){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 Nl({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 Sl(){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 wl({displayedMarkets:e,moreCount:t,formattedVolume:r,source:o,href:n,LinkComponent:a,onMarketClick:i,onShowMore:s}){let{t:l}=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=No(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(),i(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:So(u)}),jsxRuntime.jsx(Pl,{})]})]},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:a,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:[l("predict.event.showMore"),jsxRuntime.jsx(Co,{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," ",l("predict.event.volume"),jsxRuntime.jsx(Eo,{source:o})]})]})]})}function bo({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 l=s.currentTarget;l.style.setProperty("--shadow-offset","2px"),l.style.transform="translateY(2px)";},onMouseLeave:s=>{let l=s.currentTarget;l.style.setProperty("--shadow-offset","4px"),l.style.transform="translateY(0px)";},onClick:o,children:n})}function Po({market:e,event:t,onSelectOutcome:r,dynamicColors:o=false,labelFormat:n="action"}){let{t:a}=i18n.useTranslation(),[i,s]=o?fl(e):[Wr,ko],l=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",c=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",u=n==="label"&&l===c?"action":n,d=u==="label"?`${e.outcomes?.[0]?.label??"Yes"} ${xo(e)}\xA2`:a("predict.market.action.yes",{price:xo(e)}),p=u==="label"?`${e.outcomes?.[1]?.label??"No"} ${vo(e)}\xA2`:a("predict.market.action.no",{price:vo(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(bo,{bgColor:i.bg,textColor:i.text,shadowColor:i.shadow,onClick:m=>{m.stopPropagation(),r?.(t,e,"yes");},children:d}),jsxRuntime.jsx(bo,{bgColor:s.bg,textColor:s.text,shadowColor:s.shadow,onClick:m=>{m.stopPropagation(),r?.(t,e,"no");},children:p})]})}function Pl(){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 Cl({market:e,event:t,formattedVolume:r,href:o,LinkComponent:n,onSelect:a,onSelectOutcome:i}){let{t:s}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex-1",children:jsxRuntime.jsx(Po,{market:e,event:t,onSelectOutcome:i,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(),a?.(t));},children:[s("predict.event.viewEvent"),jsxRuntime.jsx(Co,{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(Eo,{source:t.source})]})]})]})}function El({market:e,event:t,onCollapse:r,onSelectOutcome:o}){let{t:n}=i18n.useTranslation(),a=No(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:i=>{i.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:So(a)}),jsxRuntime.jsx(ui.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{className:"mt-3",children:jsxRuntime.jsx(Po,{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:i=>{i.stopPropagation(),r();},children:[jsxRuntime.jsx(Ml,{className:"h-3 w-3"}),n("predict.event.back")]})]})}function Co({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 Ml({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 Eo({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 Ol=768,To=1024,Al=1280,Dl=8,Fl=224,Hl=304,Bl=114;function $l(e){return e>=Al?4:e>=To?3:e>=Ol?2:1}function Wl(e){return e>=To?Hl:Fl}function Lo({events:e,hasMore:t=false,onFetchMore:r,onSelect:o,onSelectOutcome:n,getEventHref:a,LinkComponent:i,onHover:s}){let l=react.useRef(null),c=react.useRef(null),{width:u=0,height:d=0}=hooks.useResizeObserver({ref:l}),p=$l(u),m=Wl(u),g=Math.ceil(e.length/p)||0,f=!t&&e.length>0,h=g+(t?1:0)+(f?1:0),x=react.useCallback(v=>v<g,[g]),R=react.useCallback(async()=>{r?.();},[r]),N=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:x,loadMoreRows:R,rowCount:h,threshold:3}),w=react.useCallback(()=>{c.current?.scrollToRow({index:0,behavior:"smooth"});},[]);return jsxRuntime.jsx("div",{ref:l,className:"@container w-full h-full",children:d>0&&jsxRuntime.jsx(reactWindow.List,{listRef:c,className:"no-scrollbar",style:{height:d},onRowsRendered:N,rowComponent:zl,rowCount:h,rowHeight:v=>f&&v===h-1?Bl:(m),rowProps:{events:e,columnCount:p,dataRowCount:g,showEndOfList:f,totalRowCount:h,onSelect:o,onSelectOutcome:n,getEventHref:a,LinkComponent:i,onHover:s,onScrollToTop:w}})})}function zl({index:e,style:t,events:r,columnCount:o,dataRowCount:n,showEndOfList:a,totalRowCount:i,onSelect:s,onSelectOutcome:l,getEventHref:c,LinkComponent:u,onHover:d,onScrollToTop:p}){if(a&&e===i-1)return jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(Ul,{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,g=r.slice(m,m+o),f=o-g.length;return jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsxs("div",{className:"flex w-full h-full",children:[g.map(h=>h==null?null:jsxRuntime.jsx("div",{className:"flex-1 min-w-0 flex",style:{padding:Dl},children:jsxRuntime.jsx(wo,{event:h,href:c?.(h),LinkComponent:u,onSelect:s,onSelectOutcome:l,onHover:d})},h.slug)),f>0&&Array.from({length:f}).map((h,x)=>jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}},`spacer-${x}`))]})})}function Ul({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 _o({tagSlugSelection:e,limit:t=48,status:r,sort_by:o,sort_asc:n,source:a,with_markets:i,timeRemaining:s,minVolume:l,minLiquidity:c,onSelect:u,onSelectOutcome:d,getEventHref:p,LinkComponent:m,onHover:g}){let{data:f,hasMore:h,fetchMore:x,isFetching:R}=fo({tagSlugSelection:e,limit:t,status:r,sort_by:o,sort_asc:n,source:a,with_markets:i,timeRemaining:s,minVolume:l,minLiquidity:c});return R?jsxRuntime.jsx(Br,{count:48}):jsxRuntime.jsx(Lo,{events:f,hasMore:h,onFetchMore:x,onSelect:u,onSelectOutcome:d,getEventHref:p,LinkComponent:m,onHover:g})}function og({onSelect:e,onSelectOutcome:t,getEventHref:r,LinkComponent:o,onHover:n}){let[a,i]=react.useState({categorySlug:null,tagSlug:null}),[s,l]=react.useState(Fr),{isOpen:c,onOpen:u,onClose:d}=ui.useDisclosure(),{onOpen:p}=uiScaffold.useAsyncModal(yt),m=react.useCallback((v,B,b)=>{t?.(v,B,b),p({params:{event:v,market:B,initialOutcome:b}});},[t,p]),g=react.useCallback(v=>{i(v);},[]),f=react.useCallback(v=>{l(B=>({...B,sortPreset:v}));},[]),h=react.useCallback(v=>{l(B=>({...B,sortAsc:v}));},[]),x=react.useCallback(v=>{l(v);},[]),R=react.useMemo(()=>co[s.sortPreset].sort_by,[s.sortPreset]),N=react.useMemo(()=>Hr(s),[s]),w=react.useMemo(()=>jsxRuntime.jsx(uo,{sortPreset:s.sortPreset,onSortChange:f,sortAsc:s.sortAsc,onSortAscChange:h,onFilterPress:u,filterCount:N}),[s.sortPreset,s.sortAsc,N,f,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(Bn,{onSelect:g,trailing:w}),jsxRuntime.jsx(so,{isOpen:c,onClose:d,value:s,onChange:x}),jsxRuntime.jsx("div",{className:"min-h-0 flex-1",children:jsxRuntime.jsx(_o,{tagSlugSelection:a,sort_by:R,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(jt,{})]})}var Yr=40,Jt=36,Et=480,qr=Et-Jt;function Do({event:e,walletAddress:t,onCancelOrder:r}){let{t:o}=i18n.useTranslation(),[n,a]=react.useState("positions"),i=react.useMemo(()=>e.markets?.map(d=>d.slug)??[],[e.markets]),{data:s}=reactPredict.usePositions({source:e.source,user:t??""}),l=react.useMemo(()=>!s?.positions||!t?0:i.length===0?s.positions.length:s.positions.filter(d=>d.market&&i.includes(d.market.slug)).length,[s?.positions,i,t]),u=[{key:"positions",label:l>0?`${o("predict.positions.title")} (${l})`: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:()=>a(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:Et},children:[n==="positions"&&jsxRuntime.jsx(Zl,{source:e.source,walletAddress:t,marketSlugs:i}),n==="orders"&&jsxRuntime.jsx(ec,{source:e.source,walletAddress:t,marketSlugs:i,onCancelOrder:r}),n==="trades"&&jsxRuntime.jsx(nc,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Et},children:o("predict.trade.connectWallet")})]})}function Zl({source:e,walletAddress:t,marketSlugs:r}){let{t:o}=i18n.useTranslation(),{data:n,isLoading:a}=reactPredict.usePositions({source:e,user:t}),i=react.useMemo(()=>n?.positions?r.length===0?n.positions:n.positions.filter(s=>s.market&&r.includes(s.market.slug)):[],[n?.positions,r]);return a?jsxRuntime.jsx(Qr,{}):i.length===0?jsxRuntime.jsx(Xr,{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:Jt},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:qr},rowComponent:Jl,rowCount:i.length,rowHeight:Yr,rowProps:{positions:i,closeLabel:o("predict.positions.close")}})]})}function Jl({index:e,style:t,positions:r,closeLabel:o}){let n=r[e];if(!n)return null;let a=n.pnl??0,i=n.pnl_percent??0,s=n.avg_price??0,l=n.current_price??0,c=a>0?"text-success":a<0?"text-danger":"text-foreground",u=a>0?"+":"",d=n.market?.outcomes?.[0]?.label??n.market?.question??"\u2014",p=n.side,m=n.size,g=n.size*l,f=n.market?.end_at?ac(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:["$",g.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:Qt(s)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:Qt(l)}),jsxRuntime.jsxs("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",c),children:[u,"$",Math.abs(a).toFixed(2),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",u,i.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:f}),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 ec({source:e,walletAddress:t,marketSlugs:r,onCancelOrder:o}){let{t:n}=i18n.useTranslation(),{data:a,isLoading:i,fetchNextPage:s,hasNextPage:l}=reactPredict.useInfiniteOrders({source:e,wallet_address:t}),c=reactPredict.useCancelOrder(),u=react.useMemo(()=>{let x=a?.pages?.flatMap(w=>w.items)??[],R=new Set(["live","open","submitted","pending"]),N=x.filter(w=>R.has(w.status));return r.length>0&&(N=N.filter(w=>w.market_id&&r.includes(w.market_id))),N},[a?.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+(l?1:0),g=react.useCallback(x=>x<p,[p]),f=react.useCallback(async()=>{await s();},[s]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:g,loadMoreRows:f,rowCount:m,threshold:5});return i?jsxRuntime.jsx(Qr,{}):u.length===0&&!l?jsxRuntime.jsx(Xr,{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:Jt},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:qr},onRowsRendered:h,rowComponent:tc,rowCount:m,rowHeight:Yr,rowProps:{orders:u,itemCount:p,onCancel:d,isCancelling:c.isPending,cancelLabel:n("predict.openOrders.cancel")}})]})}function tc({index:e,style:t,orders:r,itemCount:o,onCancel:n,isCancelling:a,cancelLabel:i}){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 l=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",l?"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?Qt(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(rc,{status:s.status})}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>n(s),disabled:a,className:"text-[10px] text-danger hover:text-danger/80 cursor-pointer disabled:opacity-50 transition-colors",children:a?jsxRuntime.jsx(ui.Spinner,{size:"sm"}):i})})]})}function rc({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 nc({source:e,walletAddress:t}){let{t:r}=i18n.useTranslation(),{data:o,isLoading:n,fetchNextPage:a,hasNextPage:i}=reactPredict.useInfiniteTrades({source:e,wallet:t,limit:50}),s=react.useMemo(()=>o?.pages?.flatMap(m=>m.items)??[],[o?.pages]),l=s.length,c=l+(i?1:0),u=react.useCallback(m=>m<l,[l]),d=react.useCallback(async()=>{await a();},[a]),p=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:u,loadMoreRows:d,rowCount:c,threshold:5});return n?jsxRuntime.jsx(Qr,{}):s.length===0&&!i?jsxRuntime.jsx(Xr,{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:Jt},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:qr},onRowsRendered:p,rowComponent:oc,rowCount:c,rowHeight:Yr,rowProps:{trades:s,itemCount:l}})]})}function oc({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 a=n.side?.toUpperCase()==="BUY",i=sc(n.timestamp),s=n.price??0,l=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",a?"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:Qt(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:["$",l.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:i})]})}function Xr({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:Et},children:e})}function Qr(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:Et},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function Qt(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function sc(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"),a=t.getMinutes().toString().padStart(2,"0");return `${r}/${o} ${n}:${a}`}function ac(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}function Mt({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 Fo(){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 Wo="var(--color-bullish)",zo="var(--color-bearish)";function Tt(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 cc(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function dc(e,t){let r=new Float64Array(101),o=new Float64Array(101);for(let m of e){let g=Math.round(m.price*100);g>=0&&g<=100&&(r[g]+=m.quantity);}for(let m of t){let g=Math.round(m.price*100);g>=0&&g<=100&&(o[g]+=m.quantity);}let n=0,a=0,i=new Float64Array(101),s=new Float64Array(101);for(let m=100;m>=0;m--)n+=r[m],a+=r[m]*m/100,i[m]=n,s[m]=a;let l=0,c=0,u=new Float64Array(101),d=new Float64Array(101);for(let m=0;m<=100;m++)l+=o[m],c+=o[m]*m/100,u[m]=l,d[m]=c;let p=Math.max(i[0]??0,u[100]??0);return Array.from({length:101},(m,g)=>{let f=i[g]>0,h=u[g]>0,x=i[g]||u[g],R=r[g]>0||o[g]>0;return {priceCents:g,displayHeight:cc(x,p),opacity:x>0?R?1:.5:0,isBid:f,isAsk:h,bidCumTotal:i[g],askCumTotal:u[g],bidCumCost:s[g],askCumCost:d[g]}})}function uc({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?Wo:zo,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:Tt(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",Tt(Math.round(e.cumCost))]})]})}var pc=react.memo(function({slot:t,onEnter:r,onLeave:o}){let n=react.useRef(null),a=t.isBid||t.isAsk,i=t.isBid?Wo:t.isAsk?zo: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:a?"crosshair":"default"},onMouseEnter:()=>r(t,n.current),onMouseLeave:o,children:a&&jsxRuntime.jsx("div",{ref:n,style:{position:"absolute",bottom:0,left:0,width:"100%",height:`${t.displayHeight*100}%`,backgroundColor:i,opacity:t.opacity}})})}),mc=[0,10,20,30,40,50,60,70,80,90,100];function fc(){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:mc.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 Uo({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),o=react.useMemo(()=>dc(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]),a=react.useMemo(()=>o.some(d=>d.isBid||d.isAsk),[o]),[i,s]=react.useState(null),l=react.useRef(null),c=react.useCallback((d,p)=>{l.current&&(l.current.style.filter=""),p?(p.style.filter="brightness(1.5)",l.current=p):l.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(()=>{l.current&&(l.current.style.filter="",l.current=null),s(null);},[]);return a?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"}}),i&&jsxRuntime.jsx(uc,{info:i}),o.map(d=>jsxRuntime.jsx(pc,{slot:d,onEnter:c,onLeave:u},d.priceCents))]}),jsxRuntime.jsx(fc,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function Jr(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function Ko(){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 Yo({market:e,outcome:t="yes",onTradeAction:r}){let{t:o}=i18n.useTranslation(),[n,a]=react.useState("depth"),i=t==="no",s=e.source,{data:l,isLoading:c}=reactPredict.useOrderbook({slug:e.slug,source:s}),u=react.useMemo(()=>((i?l?.asks:l?.bids)??[]).map(h=>({price:i?1-h.price:h.price,quantity:h.size})),[l?.bids,l?.asks,i]),d=react.useMemo(()=>((i?l?.bids:l?.asks)??[]).map(h=>({price:i?1-h.price:h.price,quantity:h.size})),[l?.bids,l?.asks,i]),p=react.useMemo(()=>u.length>0?Math.max(...u.map(f=>f.price)):null,[u]),m=react.useMemo(()=>d.length>0?Math.min(...d.map(f=>f.price)):null,[d]),g=react.useMemo(()=>{if(p==null||m==null)return null;let f=(m-p)*100;return Math.round(f*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:g!=null?`${o("predict.orderBook.spread")}: ${Number.isInteger(g)?`${g}\xA2`:`${g.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"),": ",Jr(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"),": ",Jr(m)]})]}),jsxRuntime.jsx("div",{className:"flex flex-1 justify-end",children:jsxRuntime.jsx("button",{type:"button",title:n==="depth"?"Orderbook":"Depth chart",onClick:()=>a(f=>f==="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(Ko,{}):jsxRuntime.jsx(Uo,{bids:u,asks:d})}),n==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:c?jsxRuntime.jsx(Ko,{}):jsxRuntime.jsx(yc,{bids:u,asks:d,bestBid:p??void 0,bestAsk:m??void 0,spread:g??void 0})})]})]})}var Vo=8;function yc({bids:e,asks:t,spread:r}){let{t:o}=i18n.useTranslation(),n=react.useMemo(()=>[...t].sort((l,c)=>l.price-c.price).slice(0,Vo).reverse(),[t]),a=react.useMemo(()=>[...e].sort((l,c)=>c.price-l.price).slice(0,Vo),[e]),i=react.useMemo(()=>{let l=[...n,...a].map(c=>c.quantity);return Math.max(...l,1)},[n,a]);return n.length===0&&a.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(l=>jsxRuntime.jsx(jo,{price:l.price,quantity:l.quantity,side:"ask",maxQty:i},`ask-${l.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`]})}),a.map(l=>jsxRuntime.jsx(jo,{price:l.price,quantity:l.quantity,side:"bid",maxQty:i},`bid-${l.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 jo({price:e,quantity:t,side:r,maxQty:o}){let n=r==="ask",a=Math.min(t/o*100,100),i=n?"bg-bearish/10":"bg-bullish/10",s=n?"text-bearish":"text-bullish",l=Tt(Math.round(t)),c=Math.round(t*e),u=`$${Tt(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 ${i} transition-[width] duration-200`,style:{width:`${a}%`}}),jsxRuntime.jsx("span",{className:`relative z-10 ${s}`,children:Jr(e)}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-center",children:l}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-right",children:u})]})}var rn=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}},rr=4,qo=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function _c(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 Ic(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 Xo(e){return `${(e*100).toFixed(2)}%`}var Oc=[{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 Ac({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:Oc.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 Dc(){let e=react.useRef(null),t=react.useRef(null),r=react.useCallback(n=>{let a=e.current,i=t.current;if(!a||!i)return;let s=a.getBoundingClientRect(),l=(n.clientX-s.left)/s.width*100;i.style.background=`linear-gradient(to right, transparent ${l}%, rgba(0,0,0,0.55) ${l}%)`,i.style.opacity="1";},[]),o=react.useCallback(()=>{t.current&&(t.current.style.opacity="0");},[]);return {wrapperRef:e,overlayRef:t,onMouseMove:r,onMouseLeave:o}}function Fc({active:e,payload:t,label:r,labelMap:o,allSeries:n,range:a}){if(!e||!n?.length)return null;let i=new Map;t?.forEach(l=>i.set(l.dataKey,l));let s=n.map(l=>i.get(l.slug)??{dataKey:l.slug,value:void 0,stroke:l.color,color:l.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"?Ic(r,a):r}),s.map(l=>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:l.stroke??l.color,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:"#9ca3af",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:120},children:o.get(l.dataKey)??l.dataKey}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontWeight:700,fontVariantNumeric:"tabular-nums"},children:l.value!=null?Xo(l.value):"--"})]},l.dataKey))]})}function Hc({markets:e,selectedSlugs:t,colorMap:r,onToggle:o}){let[n,a]=react.useState(false),i=react.useRef(null);react.useEffect(()=>{if(!n)return;function c(u){i.current&&!i.current.contains(u.target)&&a(false);}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[n]);let s=t.length>=rr,l=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:i,style:{position:"relative",display:"inline-block",width:200},children:[jsxRuntime.jsxs("button",{onClick:()=>a(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:[l,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 ",rr," markets"]}),e.map(c=>{let u=t.includes(c.slug),d=!u&&s,p=u&&t.length===1,m=r.get(c.slug)??"#6b7280",g=c.outcomes.find(h=>h.label.toLowerCase()==="yes")??c.outcomes[0],f=g?.price!=null?`${Math.round(g.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{p||d||o(c.slug);},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"7px 12px",border:"none",background:u?"rgba(255,255,255,0.05)":"transparent",cursor:d||p?"not-allowed":"pointer",opacity:d?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:h=>{!d&&!p&&(h.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:h=>{h.currentTarget.style.background=u?"rgba(255,255,255,0.05)":"transparent";},children:[jsxRuntime.jsx("span",{style:{width:16,height:16,borderRadius:4,border:u?`2px solid ${m}`:"2px solid rgba(255,255,255,0.2)",background:u?`${m}30`:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:u&&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:m,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:m,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:u?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c.outcomes?.[0]?.label??c.question}),f&&jsxRuntime.jsx("span",{style:{color:m,fontWeight:700,fontSize:12,flexShrink:0},children:f})]},c.slug)})]})]})}function Bc({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",a=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:a!=null?Xo(a):"--"})]})]},o.marketSlug)})})}function $c(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function Wc(e,t){if(e.length<=t)return e;let r=[],o=e.length/t;for(let n=0;n<t;n++){let a=Math.floor(n*o),i=Math.min(Math.floor((n+1)*o),e.length),s=e.slice(a,i),l=s.map(c=>c.price).sort((c,u)=>c-u);r.push({timestamp:s[s.length-1].timestamp,price:$c(l)});}return r}function zc(e,t=200){if(e.length===0)return [];let r=e.map(s=>({...s,data:Wc(s.data,t)})),o=new Set;r.forEach(s=>s.data.forEach(l=>o.add(l.timestamp)));let n=Array.from(o).sort((s,l)=>s-l),a=r.map(s=>{let l=new Map;return s.data.forEach(c=>l.set(c.timestamp,c.price)),{slug:s.marketSlug,map:l}}),i=new Map;return n.map(s=>{let l={timestamp:s};return a.forEach(({slug:c,map:u})=>{let d=u.get(s);if(d!==void 0)i.set(c,d),l[c]=d;else {let p=i.get(c);p!==void 0&&(l[c]=p);}}),l})}function Qo(e){return jsxRuntime.jsx(rn,{children:jsxRuntime.jsx(Uc,{...e})})}function Uc({event:e,isLoading:t,className:r,volume:o}){let n=react.useMemo(()=>(e.markets??[]).filter(C=>C.status==="open"),[e.markets]),a=react.useMemo(()=>[...n].sort((C,A)=>{let K=P=>(P.outcomes.find(ne=>ne.label.toLowerCase()==="yes")??P.outcomes[0])?.price??0;return K(A)-K(C)}),[n]),[i,s]=react.useState(()=>a.slice(0,rr).map(C=>C.slug)),[l,c]=react.useState(Kt),u=react.useMemo(()=>{let C=new Map;return i.forEach((A,K)=>{C.set(A,qo[K%qo.length]);}),C},[i]),d=react.useMemo(()=>n.filter(C=>i.includes(C.slug)),[n,i]),{series:p,isLoading:m}=reactPredict.useMarketHistory(d,l),g=t||m,f=react.useMemo(()=>{if(p.length>0&&p.some(K=>K.data.length>0))return p;let C=Date.now(),A=864e5;return d.map(K=>{let ne=(K.outcomes?.find(me=>me.label.toLowerCase()==="yes")??K.outcomes?.[0])?.price??.5;return {marketSlug:K.slug,label:K.outcomes?.[0]?.label??K.question,data:[{timestamp:C-7*A,price:ne},{timestamp:C,price:ne}]}})},[p,d]),h=react.useMemo(()=>l===reactPredict.ChartRange.ONE_DAY?96:l===reactPredict.ChartRange.ONE_WEEK?168:l===reactPredict.ChartRange.ONE_MONTH?180:300,[l]),x=react.useMemo(()=>zc(f,h),[f,h]),R=react.useMemo(()=>{if(x.length===0)return [0,1];let C=1/0,A=-1/0;if(i.forEach(P=>{x.forEach(ne=>{let me=ne[P];me!=null&&(me<C&&(C=me),me>A&&(A=me));});}),!isFinite(C))return [0,1];let K=Math.max((A-C)*.15,.05);return [Math.max(0,C-K),Math.min(1,A+K)]},[x,i]),N=react.useMemo(()=>{let C=new Map;return f.forEach(A=>{A.data.length>0&&C.set(A.marketSlug,A.data[A.data.length-1].price);}),C},[f]),w=react.useMemo(()=>{let C=new Map;return f.forEach(A=>C.set(A.marketSlug,A.label)),C},[f]),v=react.useMemo(()=>f.map(C=>({slug:C.marketSlug,color:u.get(C.marketSlug)??"#6b7280"})),[f,u]),{wrapperRef:B,overlayRef:b,onMouseMove:X,onMouseLeave:j}=Dc(),ie=react.useCallback(C=>{s(A=>A.includes(C)?A.length<=1?A:A.filter(K=>K!==C):A.length>=rr?A:[...A,C]);},[]),[U,F]=react.useState(null),W=react.useRef(null),$=react.useRef(""),oe=react.useRef(0),pe=!g&&x.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsx(Bc,{series:f,colorMap:u,displayValues:U??N}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0},children:[jsxRuntime.jsx("div",{ref:B,style:{height:300,width:"100%",userSelect:"none",position:"relative"},onMouseMove:pe?C=>{X(C),cancelAnimationFrame(oe.current),oe.current=requestAnimationFrame(()=>{F(W.current);});}:void 0,onMouseLeave:pe?()=>{j(),cancelAnimationFrame(oe.current),$.current="",W.current=null,F(null);}:void 0,children:g?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:C=>_c(C,l),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:R,tickFormatter:C=>`${Math.round(C*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:C=>{let A=C;if(A.active&&A.payload?.length){let K=A.payload.map(P=>`${P.dataKey}:${P.value}`).join(",");if(K!==$.current){$.current=K;let P=new Map;A.payload.forEach(ne=>{ne.value!=null&&P.set(ne.dataKey,ne.value);}),W.current=P;}}return jsxRuntime.jsx(Fc,{...A,labelMap:w,allSeries:v,range:l})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),f.map(C=>{let A=u.get(C.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:C.marketSlug,stroke:A,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:A},connectNulls:true,isAnimationActive:false},C.marketSlug)}),U==null&&x.length>0&&f.map(C=>{let A=x[x.length-1],K=A[C.marketSlug];if(K==null)return null;let P=u.get(C.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:A.timestamp,y:K,ifOverflow:"extendDomain",shape:ne=>{let{cx:me,cy:le}=ne;return me==null||le==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:me,cy:le,r:6,fill:P,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:me,cy:le,r:3.5,fill:P})]})}},`pulse-${C.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(Ac,{value:l,onChange:c}),a.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(Hc,{markets:a,selectedSlugs:i,colorMap:u,onToggle:ie})})]})]})]})}function Rt(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function nd(e){return `${parseFloat((e*100).toFixed(2))}%`}function Zo(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function nr(e){return e.outcomes?.[0]?.label??e.question}function od(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function Lt(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(),a=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0");return `${r} ${o}, ${n} ${a}:${i}`}function Jo(e){let[t,r]=react.useState(Date.now());if(react.useEffect(()=>{if(!e)return;let u=setInterval(()=>r(Date.now()),1e3);return ()=>clearInterval(u)},[e]),!e)return null;let o=new Date(e).getTime();if(isNaN(o))return null;let n=o-t;if(n<=0)return null;let a=Math.floor(n/864e5),i=Math.floor(n%864e5/36e5),s=Math.floor(n%36e5/6e4),l=Math.floor(n%6e4/1e3),c=[];return a>0&&c.push(`${a}d`),c.push(`${String(i).padStart(2,"0")}h`),c.push(`${String(s).padStart(2,"0")}m`),c.push(`${String(l).padStart(2,"0")}s`),c.join(" ")}function es(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"),a=t.getDate().toString().padStart(2,"0"),i=t.getFullYear(),s=-t.getTimezoneOffset(),l=s>=0?"+":"-",c=String(Math.abs(Math.floor(s/60))).padStart(2,"0");return `${r}:${o} ${n}/${a}/${i} (${l}${c})`}function ns({event:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{ref:o,isCollapsed:n}=hooks.useScrollCollapse(),a=react.useMemo(()=>{let d=[...e.markets||[]],p=d.filter(g=>g.status==="open").sort((g,f)=>Rt(f)-Rt(g)),m=d.filter(g=>g.status!=="open").sort((g,f)=>Rt(f)-Rt(g));return [...p,...m]},[e.markets]),i=e.status==="closed"||e.status==="voided",s=Jo(i?void 0:e.start_at),l=Jo(i?void 0:e.end_at),c=es(e.start_at),u=es(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(ld,{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||l||i)&&jsxRuntime.jsx("div",{className:"flex items-center gap-x-2 text-xs lg:text-sm font-mono",children:i?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})]})]}):l?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.endsIn",{time:l})}),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(Qo,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx(sd,{markets:a,onTradeAction:t}),jsxRuntime.jsx(id,{markets:a,event:e})]})}var ts=5;function sd({markets:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{isMobile:o}=ui.useScreen(),[n,a]=react.useState(false),[i,s]=react.useState(null),l=e.find(f=>f.status==="open")?.slug,[c,u]=react.useState(l?`${l}:yes`:null);if(e.length===0)return null;let d=e.length>ts,p=n?e:e.slice(0,ts),m=f=>{s(h=>h===f?null:f);},g=(f,h,x)=>{u(`${f.slug}:${h}`),o||s(f.slug),t?.(f,h,x);};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:p.map(f=>{let h=Rt(f),x=f.outcomes[1]?.best_ask??f.outcomes[1]?.price,R=i===f.slug;return jsxRuntime.jsx(ad,{market:f,yesPrice:h,noPrice:x??void 0,activeYes:c===`${f.slug}:yes`,activeNo:c===`${f.slug}:no`,isExpanded:R,onToggleExpand:()=>m(f.slug),onTradeAction:g},f.slug)})})]}),d&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>a(f=>!f),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 ad({market:e,yesPrice:t,noPrice:r,activeYes:o,activeNo:n,isExpanded:a,onToggleExpand:i,onTradeAction:s}){let{t:l}=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:i,role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),i());},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:nr(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:nr(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:nd(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:l("predict.market.action.yes",{price:Zo(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?l("predict.market.action.no",{price:Zo(r)}):l("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"?l("predict.event.status.closed"):e.status==="voided"?l("predict.event.status.voided"):l("predict.event.status.pending")})})})]}),a&&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(Yo,{market:e,outcome:n?"no":"yes",onTradeAction:s})})})})]})}function id({markets:e,event:t}){let{t:r}=i18n.useTranslation(),[o,n]=react.useState(false),[a,i]=react.useState(false),[s,l]=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(`
20
20
 
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:n("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:Lt(d)})}),jsxRuntime.jsx(ui.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(l)],onAction:m=>{a(Number(m)),r(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===l?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:Lt(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:()=>r(m=>!m),className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors self-start",children:n(o?"predict.event.rules.collapse":"predict.event.showMore")}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>s(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:n("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:n("predict.event.timeline.created"),value:lt(d.created_at),isActive:true}),f.push({label:n("predict.event.timeline.open"),value:lt(d.start_at),isActive:m!=="pending"}),m==="voided"?f.push({label:n("predict.event.timeline.voided"),value:lt(d.closed_at??d.end_at),isActive:true}):m==="closed"?f.push({label:n("predict.event.timeline.closed"),value:lt(d.closed_at??d.end_at),isActive:true}):f.push({label:n("predict.event.timeline.close"),value:lt(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:[n("predict.event.id.event"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:t.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[n("predict.event.id.market"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:d.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[n("predict.event.id.source"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:kl(d.source)})]})]})]})]})}function Tl({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 uo({eventSlug:e,source:t,onTradeAction:n}){let{data:o,isLoading:r,error:i}=reactPredict.useEvent({slug:e,source:t});return r?jsxRuntime.jsx(at,{}):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(co,{event:o,onTradeAction:n})}function po({eventSlug:e,source:t,limit:n=4,onEventClick:o}){let{t:r}=i18n.useTranslation(),{data:i,isLoading:s}=reactPredict.useSimilarEvents({slug:e,source:t,limit:n});return s||!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:r("predict.similar.title")}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-3",children:i.map(l=>jsxRuntime.jsx(_l,{event:l,onClick:o},l.slug))})]})}function _l({event:e,onClick:t}){let n=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}),n!=null&&n>0&&jsxRuntime.jsxs("span",{className:"text-xs text-neutral",children:["$",Math.round(n).toLocaleString()," vol"]})]}),jsxRuntime.jsx(ui.ChevronRightIcon,{className:"h-4 w-4 text-neutral shrink-0"})]})}function mo(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function dm({eventSlug:e,source:t,chain:n,walletAddress:o,onSimilarEventClick:r,onBack:i}){let{t:s}=i18n.useTranslation(),{isMobile:l}=ui.useScreen(),{onOpen:a}=uiScaffold.useAsyncModal(Je),{data:c,isLoading:d}=reactPredict.useEvent({slug:e,source:t}),p=react.useMemo(()=>[...c?.markets||[]].sort((h,D)=>mo(D)-mo(h)),[c?.markets]),[u,m]=react.useState(null),f=react.useCallback((h,D,T)=>{m(M=>({market:h,outcome:D,side:T,version:(M?.version??0)+1})),l&&c&&a({params:{event:c,market:h,initialOutcome:D,chain:n}});},[l,c,n,a]),g=u?.market??p[0];if(d){let h=!!i;return l?jsxRuntime.jsx(at,{showBack:h}):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(at,{showBack:h})}),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(zn,{})})})]})}let v=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:s("common.back")})}),jsxRuntime.jsx(uo,{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(bt,{event:c,market:g,initialSide:u?.side,initialOutcome:u?.outcome,chain:n},v),c&&jsxRuntime.jsx(po,{eventSlug:e,source:c.source,onEventClick:r})]})]}),c&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:jsxRuntime.jsx(Wn,{event:c,walletAddress:o})}),jsxRuntime.jsx(yt,{})]})}function fo(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function jl(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 xm=e=>{let{candlestickMarketSlugs:t,chartRange:n=ht,source:o}=e,r=reactPredict.usePredictClient(),i=react.useMemo(()=>jl(n),[n]),{data:s,isLoading:l,error:a}=reactPredict.useEvent({slug:e.eventSlug,source:o}),c=react.useMemo(()=>s?.markets?(t&&t.length>0?t.slice(0,4).map(g=>s.markets.find(v=>v.slug===g)).filter(g=>g!==void 0):[...s.markets].sort((g,v)=>fo(v)-fo(g)).slice(0,4)).map(g=>g.slug):[],[t,s?.markets]),d=reactQuery.useQueries({queries:c.map(f=>({queryKey:reactPredict.candlesticksQueryKey(f,i),queryFn:()=>r.listCandlesticks(f,i),enabled:c.length>0}))}),p=d.some(f=>f.isLoading),u=react.useMemo(()=>{let f=new Map;return c.forEach((g,v)=>{let h=d[v]?.error;h&&f.set(g,h);}),f},[c,d]),m=react.useMemo(()=>{let f=new Map;return c.forEach((g,v)=>{let h=d[v]?.data;h&&f.set(g,h);}),f},[c,d]);return {event:s,isEventLoading:l,eventError:a,candlestickParams:i,candlesticks:m,isCandlesticksLoading:p,candlestickErrors:u}};var Ql=10,Jl=utils$1.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function At(){let[e,t]=jotai.useAtom(Jl),n=react.useCallback(r=>{let i=r.trim();i&&t(s=>{let l=s.filter(a=>a!==i);return [i,...l].slice(0,Ql)});},[t]),o=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:n,clearHistories:o}}function ho({histories:e,onSelect:t,onClear:n,className:o}){let{t:r}=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:r("predict.search.history")}),jsxRuntime.jsx(ui.Button,{isIconOnly:true,size:"sm",className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:n,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 bo({onSelect:e,className:t}){let{histories:n,clearHistories:o}=At();return jsxRuntime.jsx(ho,{className:ui.cn(t),histories:n,onSelect:e,onClear:o})}function yo({value:e,onValueChange:t,onClear:n,onEscape:o,className:r}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:r,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:n,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:s=>{s.preventDefault(),o?.();},children:"Esc"})})})}function No({event:e,href:t,LinkComponent:n,onSelect:o,onHover:r,className:i}){let{t:s}=i18n.useTranslation(),l=e.tags?.[0],a=react.useMemo(()=>`$${Math.round(e.volume??0).toLocaleString("en-US")}`,[e.volume]);return jsxRuntime.jsxs(ui.Linkable,{href:t,LinkComponent:n,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:()=>r?.(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:[l&&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:l.label}),jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-x-1.5",children:[a," ",s("predict.event.volume"),jsxRuntime.jsx(xc,{source:e.source})]})]})]})]})}function xc({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 wo({keyword:e="",limit:t,source:n}){let{data:o,isLoading:r,isFetchingNextPage:i,hasNextPage:s,fetchNextPage:l}=reactPredict.useSearchEvents({keyword:e,limit:t,source:n},{enabled:true});return {events:react.useMemo(()=>o?.pages.flatMap(c=>c.items).filter(c=>c!=null)??[],[o]),isLoading:r,isFetchingNextPage:i,hasNextPage:s??false,fetchNextPage:l}}var Ec=56;function Co({onSelect:e,getEventHref:t,LinkComponent:n,onHover:o,className:r,...i}){let{events:s,isLoading:l,isFetchingNextPage:a,hasNextPage:c,fetchNextPage:d}=wo(i),p=react.useRef(null),{height:u}=hooks.useResizeObserver({ref:p}),m=react.useCallback(h=>h<s.length,[s]),f=react.useCallback(async()=>{c&&!a&&await d();},[c,a,d]),g=react.useMemo(()=>c?s.length+1:s.length,[s,c]),v=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:m,loadMoreRows:f,rowCount:g,threshold:5});return l?jsxRuntime.jsx(Tc,{className:r}):s.length===0?jsxRuntime.jsx(Mc,{className:r}):jsxRuntime.jsx("div",{className:ui.cn("w-full h-full flex flex-col",r),children:jsxRuntime.jsx("div",{className:"flex-auto min-h-0",ref:p,children:jsxRuntime.jsx(reactWindow.List,{style:{height:u},onRowsRendered:v,rowComponent:Cc,rowCount:g,rowHeight:Ec,rowProps:{events:s,onSelect:e,getEventHref:t,LinkComponent:n,onHover:o},overscanCount:5})})})}function Cc({index:e,style:t,events:n,onSelect:o,getEventHref:r,LinkComponent:i,onHover:s}){let l=n[e];return l?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(No,{event:l,href:r?.(l),LinkComponent:i,onSelect:o,onHover:s})}):jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})}function Tc({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 Mc({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 Lo({onKeywordChange:e}){let[t,n]=react.useState(""),[o,r]=react.useState(""),{addHistory:i}=At(),s=hooks.useCallbackRef(e),l=hooks.useCallbackRef(i),a=react.useMemo(()=>utils.debounce(u=>{r(u),s(u),u&&l(u);},500),[s,l]),c=react.useCallback(u=>{n(u),a(u);},[a]),d=react.useCallback(u=>{a.cancel(),n(u),r(u),s(u),u&&l(u);},[a,s,l]),p=react.useCallback(()=>d(""),[d]);return {text:t,keyword:o,setText:c,setKeyword:d,clearKeyword:p}}function Oo({onKeywordChange:e,onSelectEvent:t,getEventHref:n,LinkComponent:o,onHover:r,onEscape:i,source:s}){let{text:l,keyword:a,setText:c,setKeyword:d,clearKeyword:p}=Lo({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(yo,{value:l,onValueChange:c,onClear:p,onEscape:i}),!a&&jsxRuntime.jsx(bo,{onSelect:d}),jsxRuntime.jsx(Co,{className:"flex-auto min-h-0",keyword:a,onSelect:t,getEventHref:n,LinkComponent:o,onHover:r,source:s})]})}var Tr="predict-search";function Bf({id:e=Tr}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Wc,{...t})})}function Wc({params:e,isOpen:t,onOpenChange:n,onResult:o}){let{t:r}=i18n.useTranslation(),{isMobile:i}=ui.useScreen(),s=react.useCallback(a=>{o(a);},[o]),l=react.useCallback(()=>{n(false);},[n]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:n,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:r("predict.search.title")}),jsxRuntime.jsx(ui.Button,{isIconOnly:true,onPress:()=>n(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(Oo,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:s,onEscape:l})})]})})}function qf({onSelectEvent:e,modalParams:t,className:n}){let{t:o}=i18n.useTranslation(),{isDesktop:r,isMobile:i}=ui.useScreen(),{onOpen:s,onClose:l}=uiScaffold.useAsyncModal(Tr),a=hooks.useCallbackRef(e),c=hooks.useCallbackRef(async()=>{let p=await s({params:t});p&&a(p);}),d=hooks.useCallbackRef(()=>{l();});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:!r,onPress:c,variant:i?"flat":"bordered",startContent:r?jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"}):void 0,endContent:r?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(r&&"min-w-56 justify-start pl-3 pr-1.5 text-neutral",n),children:r?o("predict.search.placeholder"):jsxRuntime.jsx(ui.SearchIcon,{className:"text-neutral"})})}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,"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,"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,"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=md;exports.CHART_RANGE_PERIOD=ud;exports.CHART_RANGE_SAMPLE_INTERVAL=pd;exports.CandlestickPeriod=xt;exports.CategoriesSkeleton=rd;exports.CategoriesUI=Wr;exports.CategoriesWidget=Vr;exports.ChartRange=oe;exports.DEFAULT_CHART_RANGE=ht;exports.DEFAULT_FILTER_STATE=nr;exports.DEFAULT_PAGE_SIZE=Qe;exports.DEFAULT_PRICE_HISTORY_INTERVAL=xd;exports.EventDetailPage=dm;exports.EventDetailSkeleton=at;exports.EventDetailUI=co;exports.EventDetailWidget=uo;exports.EventItem=Rn;exports.EventMarketDepthChartUI=Gn;exports.EventMarketDetailWidget=eo;exports.EventPriceChart=no;exports.EventsFilterUI=pn;exports.EventsPage=ju;exports.EventsPageSkeleton=xu;exports.EventsSkeleton=sr;exports.EventsToolbarUI=xn;exports.EventsUI=An;exports.EventsWidget=Bn;exports.MAX_PRICE_HISTORY_MARKETS=Gt;exports.ORDER_MAX_PRICE=vd;exports.ORDER_MIN_PRICE=gd;exports.ORDER_MIN_QUANTITY=Xt;exports.ORDER_PRICE_STEP=fd;exports.PREDICT_SEARCH_MODAL_ID=Tr;exports.PREDICT_TRADE_MODAL_ID=Je;exports.PRICE_HISTORY_SAMPLE_INTERVAL=hd;exports.PredictSearchModal=Bf;exports.PredictTradeModal=yt;exports.PredictWalletProvider=ps;exports.PriceHistoryInterval=Be;exports.SORT_PRESETS=vn;exports.STATIC_CATEGORIES=jt;exports.SearchEventsButton=qf;exports.SearchHistoryUI=ho;exports.SearchHistoryWidget=bo;exports.SearchInputUI=yo;exports.SearchResultItemUI=No;exports.SearchResultListWidget=Co;exports.SearchWidget=Oo;exports.SimilarEventCard=_l;exports.SimilarEventsSection=po;exports.TradeFormSkeleton=zn;exports.TradeFormUI=cn;exports.TradeFormWidget=bt;exports.UserActivitySection=Wn;exports.countActiveFilters=or;exports.formatKMB=it;exports.useEventDetail=xm;exports.useEventsInfinite=yn;exports.usePredictSearchHistory=At;exports.usePredictWallet=Jt;exports.useSearchResultListScript=wo;exports.useSearchScript=Lo;exports.useTradeForm=tn;exports.version=Zo;//# sourceMappingURL=index.js.map
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:nr(u)})}),jsxRuntime.jsx(ui.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(s)],onAction:m=>{l(Number(m)),n(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:c.map((m,g)=>jsxRuntime.jsx(ui.DropdownItem,{className:ui.cn(g===s?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:nr(m)},String(g)))})]})]}),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:()=>i(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",a&&"rotate-180")})]}),a&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"flex flex-col",children:(()=>{let m=u.status,g=[];return u.created_at&&g.push({label:r("predict.event.timeline.created"),value:Lt(u.created_at),isActive:true}),g.push({label:r("predict.event.timeline.open"),value:Lt(u.start_at),isActive:m!=="pending"}),m==="voided"?g.push({label:r("predict.event.timeline.voided"),value:Lt(u.closed_at??u.end_at),isActive:true}):m==="closed"?g.push({label:r("predict.event.timeline.closed"),value:Lt(u.closed_at??u.end_at),isActive:true}):g.push({label:r("predict.event.timeline.close"),value:Lt(u.end_at),isActive:false}),g})().map((m,g,f)=>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"}`}),g<f.length-1&&jsxRuntime.jsx("div",{className:"w-px flex-1 bg-border"})]}),jsxRuntime.jsxs("div",{className:`flex flex-col ${g<f.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:od(u.source)})]})]})]})]})}function ld({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 os({eventSlug:e,source:t,onTradeAction:r}){let{data:o,isLoading:n,error:a}=reactPredict.useEvent({slug:e,source:t});return n?jsxRuntime.jsx(Mt,{}):a||!o?jsxRuntime.jsx("div",{className:"flex w-full items-center justify-center py-20 text-danger",children:a?.message||"Event not found"}):jsxRuntime.jsx(ns,{event:o,onTradeAction:r})}function ss({eventSlug:e,source:t,limit:r=4,onEventClick:o}){let{t:n}=i18n.useTranslation(),{data:a,isLoading:i}=reactPredict.useSimilarEvents({slug:e,source:t,limit:r});return i||!a||a.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:a.map(s=>jsxRuntime.jsx(fd,{event:s,onClick:o},s.slug))})]})}function fd({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 as(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function y0({eventSlug:e,source:t,chain:r,walletAddress:o,onSimilarEventClick:n,onBack:a}){let{t:i}=i18n.useTranslation(),{isMobile:s}=ui.useScreen(),{onOpen:l}=uiScaffold.useAsyncModal(yt),{data:c,isLoading:u}=reactPredict.useEvent({slug:e,source:t}),d=react.useMemo(()=>[...c?.markets||[]].sort((x,R)=>as(R)-as(x)),[c?.markets]),[p,m]=react.useState(null),g=react.useCallback((x,R,N)=>{m(w=>({market:x,outcome:R,side:N,version:(w?.version??0)+1})),s&&c&&l({params:{event:c,market:x,initialOutcome:R,chain:r}});},[s,c,r,l]),f=p?.market??d[0];if(u){let x=!!a;return s?jsxRuntime.jsx(Mt,{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(Mt,{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(Fo,{})})})]})}let h=p?`${p.market.slug}-${p.version}`:f?.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:[a&&jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsx(ui.Button,{as:"a",onPress:a,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:i("common.back")})}),jsxRuntime.jsx(os,{eventSlug:e,source:t,onTradeAction:g})]}),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:[f&&jsxRuntime.jsx(Vt,{event:c,market:f,initialSide:p?.side,initialOutcome:p?.outcome,chain:r},h),c&&jsxRuntime.jsx(ss,{eventSlug:e,source:c.source,onEventClick:n})]})]}),c&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:jsxRuntime.jsx(Do,{event:c,walletAddress:o})}),jsxRuntime.jsx(jt,{})]})}function is(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Md(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 E0=e=>{let{candlestickMarketSlugs:t,chartRange:r=Kt,source:o}=e,n=reactPredict.usePredictClient(),a=react.useMemo(()=>Md(r),[r]),{data:i,isLoading:s,error:l}=reactPredict.useEvent({slug:e.eventSlug,source:o}),c=react.useMemo(()=>i?.markets?(t&&t.length>0?t.slice(0,4).map(f=>i.markets.find(h=>h.slug===f)).filter(f=>f!==void 0):[...i.markets].sort((f,h)=>is(h)-is(f)).slice(0,4)).map(f=>f.slug):[],[t,i?.markets]),u=reactQuery.useQueries({queries:c.map(g=>({queryKey:reactPredict.candlesticksQueryKey(g,a),queryFn:()=>n.listCandlesticks(g,a),enabled:c.length>0}))}),d=u.some(g=>g.isLoading),p=react.useMemo(()=>{let g=new Map;return c.forEach((f,h)=>{let x=u[h]?.error;x&&g.set(f,x);}),g},[c,u]),m=react.useMemo(()=>{let g=new Map;return c.forEach((f,h)=>{let x=u[h]?.data;x&&g.set(f,x);}),g},[c,u]);return {event:i,isEventLoading:s,eventError:l,candlestickParams:a,candlesticks:m,isCandlesticksLoading:d,candlestickErrors:p}};var Rd=10,_d=utils$1.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function lr(){let[e,t]=jotai.useAtom(_d),r=react.useCallback(n=>{let a=n.trim();a&&t(i=>{let s=i.filter(l=>l!==a);return [a,...s].slice(0,Rd)});},[t]),o=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:o}}function us({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(a=>jsxRuntime.jsx(ui.Chip,{size:"sm",variant:"bordered",className:ui.cn("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(a),children:a},a))})]})}function ps({onSelect:e,className:t}){let{histories:r,clearHistories:o}=lr();return jsxRuntime.jsx(us,{className:ui.cn(t),histories:r,onSelect:e,onClear:o})}function ms({value:e,onValueChange:t,onClear:r,onEscape:o,className:n}){let{t:a}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:n,children:jsxRuntime.jsx(ui.StyledInput,{autoFocus:true,variant:"flat",radius:"full",value:e,onValueChange:t,placeholder:a("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:i=>{i.preventDefault(),o?.();},children:"Esc"})})})}function gs({event:e,href:t,LinkComponent:r,onSelect:o,onHover:n,className:a}){let{t:i}=i18n.useTranslation(),s=e.tags?.[0],l=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",a),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:[l," ",i("predict.event.volume"),jsxRuntime.jsx(Qd,{source:e.source})]})]})]})]})}function Qd({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 hs({keyword:e="",limit:t,source:r}){let{data:o,isLoading:n,isFetchingNextPage:a,hasNextPage:i,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:a,hasNextPage:i??false,fetchNextPage:s}}var au=56;function ys({onSelect:e,getEventHref:t,LinkComponent:r,onHover:o,className:n,...a}){let{events:i,isLoading:s,isFetchingNextPage:l,hasNextPage:c,fetchNextPage:u}=hs(a),d=react.useRef(null),{height:p}=hooks.useResizeObserver({ref:d}),m=react.useCallback(x=>x<i.length,[i]),g=react.useCallback(async()=>{c&&!l&&await u();},[c,l,u]),f=react.useMemo(()=>c?i.length+1:i.length,[i,c]),h=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:m,loadMoreRows:g,rowCount:f,threshold:5});return s?jsxRuntime.jsx(lu,{className:n}):i.length===0?jsxRuntime.jsx(cu,{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:iu,rowCount:f,rowHeight:au,rowProps:{events:i,onSelect:e,getEventHref:t,LinkComponent:r,onHover:o},overscanCount:5})})})}function iu({index:e,style:t,events:r,onSelect:o,getEventHref:n,LinkComponent:a,onHover:i}){let s=r[e];return s?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(gs,{event:s,href:n?.(s),LinkComponent:a,onSelect:o,onHover:i})}):jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})}function lu({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 cu({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 ws({onKeywordChange:e}){let[t,r]=react.useState(""),[o,n]=react.useState(""),{addHistory:a}=lr(),i=hooks.useCallbackRef(e),s=hooks.useCallbackRef(a),l=react.useMemo(()=>utils.debounce(p=>{n(p),i(p),p&&s(p);},500),[i,s]),c=react.useCallback(p=>{r(p),l(p);},[l]),u=react.useCallback(p=>{l.cancel(),r(p),n(p),i(p),p&&s(p);},[l,i,s]),d=react.useCallback(()=>u(""),[u]);return {text:t,keyword:o,setText:c,setKeyword:u,clearKeyword:d}}function Ps({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:o,onHover:n,onEscape:a,source:i}){let{text:s,keyword:l,setText:c,setKeyword:u,clearKeyword:d}=ws({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(ms,{value:s,onValueChange:c,onClear:d,onEscape:a}),!l&&jsxRuntime.jsx(ps,{onSelect:u}),jsxRuntime.jsx(ys,{className:"flex-auto min-h-0",keyword:l,onSelect:t,getEventHref:r,LinkComponent:o,onHover:n,source:i})]})}var cn="predict-search";function Gh({id:e=cn}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Nu,{...t})})}function Nu({params:e,isOpen:t,onOpenChange:r,onResult:o}){let{t:n}=i18n.useTranslation(),{isMobile:a}=ui.useScreen(),i=react.useCallback(l=>{o(l);},[o]),s=react.useCallback(()=>{r(false);},[r]);return jsxRuntime.jsx(ui.StyledModal,{isOpen:t,onOpenChange:r,size:a?"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(Ps,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:i,onEscape:s})})]})})}function rx({onSelectEvent:e,modalParams:t,className:r}){let{t:o}=i18n.useTranslation(),{isDesktop:n,isMobile:a}=ui.useScreen(),{onOpen:i,onClose:s}=uiScaffold.useAsyncModal(cn),l=hooks.useCallbackRef(e),c=hooks.useCallbackRef(async()=>{let d=await i({params:t});d&&l(d);}),u=hooks.useCallbackRef(()=>{s();});return react.useEffect(()=>{let d=p=>{let m=document.activeElement,g=!!m&&(m.tagName==="INPUT"||m.tagName==="TEXTAREA"||m.getAttribute("contenteditable")==="true");p.key==="/"&&!g&&(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:a?"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 un=[{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"}],Os=[{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}],Rs={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"},_s={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 _u(e,t){if(!e)return "$5K+";let r=Os.find(o=>o.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function As({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:o,minVolume:n,onMinVolumeChange:a,onRefresh:i}){let{t:s}=i18n.useTranslation(),[l,c]=react.useState(false),[u,d]=react.useState(false),[p,m]=react.useState(false),[g,f]=react.useState(false),h=react.useRef(null),x=react.useRef(null),R=un.find(v=>v.value===e)??un[0],N=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",N),()=>document.removeEventListener("mousedown",N)),[N]);let w=react.useCallback(()=>{i?.(),f(true),setTimeout(()=>f(false),700);},[i]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
22
+ @keyframes matchRefreshSpin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
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:Rs,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),d(false);},children:[jsxRuntime.jsx(Iu,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:s(R.labelKey)}),jsxRuntime.jsx(Is,{open:l})]}),l&&jsxRuntime.jsx("div",{style:{..._s,width:224,padding:4},children:un.map(v=>{let B=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:B?"rgba(139,92,246,0.1)":"transparent",color:B?"#c4b5fd":"#a1a1aa",borderRadius:10},onMouseEnter:b=>{B||(b.currentTarget.style.background="rgba(39,39,42,0.5)",b.currentTarget.style.color="#fff");},onMouseLeave:b=>{B||(b.currentTarget.style.background="transparent",b.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===v.value?o(!r):t(v.value),c(false);},children:[jsxRuntime.jsx("div",{style:{color:B?"#a78bfa":"#71717a"},children:jsxRuntime.jsx(Ou,{type:v.icon})}),jsxRuntime.jsxs("div",{style:{flex:1,textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:500},children:s(v.labelKey)}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#71717a",marginTop:1},children:s(v.descKey)})]}),B&&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)})})]}),a&&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:Rs,onMouseEnter:v=>{v.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:v=>{v.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{d(v=>!v),c(false);},children:[jsxRuntime.jsx(Au,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:_u(n,s)}),jsxRuntime.jsx(Du,{onMouseEnter:()=>m(true),onMouseLeave:()=>m(false)}),jsxRuntime.jsx(Is,{open:u})]}),p&&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"})}),s("predict.matches.filter.liquidityFilter")]}),jsxRuntime.jsx("p",{style:{color:"#a1a1aa",margin:"0 0 4px"},children:s("predict.matches.filter.tooltipDesc")}),jsxRuntime.jsx("p",{style:{color:"#71717a",fontSize:11,margin:0},children:s("predict.matches.filter.tooltipNote")})]})]})]}),u&&jsxRuntime.jsxs("div",{style:{..._s,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:s("predict.matches.filter.minVolumeEach")})}),jsxRuntime.jsx("div",{style:{padding:4},children:Os.map(v=>{let B=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:B?"rgba(139,92,246,0.1)":"transparent",color:B?"#c4b5fd":"#a1a1aa",borderRadius:10,transition:"all 0.15s"},onMouseEnter:b=>{B||(b.currentTarget.style.background="rgba(39,39,42,0.5)",b.currentTarget.style.color="#fff");},onMouseLeave:b=>{B||(b.currentTarget.style.background="transparent",b.currentTarget.style.color="#a1a1aa");},onClick:()=>{a?.(v.value===0?void 0:v.value),d(false);},children:[jsxRuntime.jsx("span",{children:v.labelKey?s(v.labelKey):v.label}),B&&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)})})]})]}),i&&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:w,children:jsxRuntime.jsxs("svg",{className:g?"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 Iu(){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 Ou({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 Au(){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 Du({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 Is({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 Bu(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(0)}K`:`$${e.toFixed(0)}`}var $u=[{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:Bu,valueColor:"#00d3f3",gradientFrom:"rgba(0,184,219,0.2)",gradientTo:"rgba(0,184,219,0.05)",borderColor:"rgba(0,184,219,0.2)"}];function Ds({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
+ .matches-hero-title{font-size:30px!important}
26
+ @media(min-width:640px){.matches-hero-title{font-size:36px!important}}
27
+ @media(min-width:1024px){.matches-hero-title{font-size:48px!important}}
28
+ @media(max-width:639px){.matches-hero-stats{grid-template-columns:repeat(2,1fr)!important}}
29
+ .matches-stat-card{padding:12px}
30
+ @media(min-width:640px){.matches-stat-card{padding:16px}}
31
+ .matches-stat-val{font-size:18px;line-height:25px;min-height:25px}
32
+ @media(min-width:640px){.matches-stat-val{font-size:20px;line-height:28px;min-height:28px}}
33
+ .matches-stat-label{font-size:10px;line-height:14px;min-height:14px}
34
+ @media(min-width:640px){.matches-stat-label{font-size:12px;line-height:16px;min-height:16px}}
35
+ @keyframes matchStatsEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
36
+ @keyframes matchStatCardEnter{from{opacity:0;transform:translateY(12px) scale(0.97)}to{opacity:1;transform:translateY(0) scale(1)}}
37
+ `}),jsxRuntime.jsx("style",{children:`
38
+ @keyframes match-live-ping{75%,100%{transform:scale(2.2);opacity:0}}
39
+ @keyframes match-live-breathe{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.85)}}
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:$u.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 Ku={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}},Vu={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function ur(e){return Ku[e]??Vu}function Px({source:e,className:t}){let r=ur(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 pn(e){return e==null?"-":e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e.toFixed(0)}`}var Gu={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"}},Yu={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 qu(e){return Gu[e]??Yu}function Xu(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 Qu(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 l=s.outcomes[0];return {name:l.label||null,price:l.best_ask??l.price??null}},a=n(t?.market_a),i=n(t?.market_b);return [{source:t?.source_a??r?.source??"unknown",outcomeName:a.name,yesPrice:a.price,volume:r?.event?.volume??null,event:r?.event},{source:t?.source_b??o?.source??"unknown",outcomeName:i.name,yesPrice:i.price,volume:o?.event?.volume??null,event:o?.event}]}function Ws({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:o}){let {t:n}=i18n.useTranslation(),a=react.useMemo(()=>Xu(e),[e]),i=e.max_spread!=null?e.max_spread*100:null,[s,l]=react.useMemo(()=>Qu(e,a),[e,a]),c=i!=null&&i>=3;s.yesPrice!=null&&l.yesPrice!=null?s.source==="kalshi"?s.yesPrice>l.yesPrice:l.yesPrice>s.yesPrice:false;let d=s.yesPrice!=null&&l.yesPrice!=null?s.yesPrice<=l.yesPrice?s:l:null,p=d?ur(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:g=>{let f=g.currentTarget;f.style.borderColor="rgba(63,63,70,0.6)",f.style.boxShadow="0 10px 15px -3px rgba(0,0,0,0.2)";},onMouseLeave:g=>{let f=g.currentTarget;f.style.borderColor="rgba(39,39,42,0.6)",f.style.boxShadow="none";},children:[i!=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)":i>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:c?"rgba(255,185,0,0.15)":i>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:c?"#ffb900":i>=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"})}),i.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(Bs,{data:s,isCheaper:d===s,onSelect:t,getEventHref:r,LinkComponent:o}),jsxRuntime.jsx(Bs,{data:l,isCheaper:d===l,onSelect:t,getEventHref:r,LinkComponent:o})]}),d&&p&&i!=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:i.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"})]}),pn(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"})}),pn(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 Bs({data:e,isCheaper:t,onSelect:r,getEventHref:o,LinkComponent:n}){let{t:a}=i18n.useTranslation(),i=ur(e.source),s=qu(e.source),l=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:l||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:[i.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.05em",color:s.text,textTransform:"uppercase"},children:i.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:a("predict.matches.centsYes")})]}),jsxRuntime.jsxs("div",{style:{fontSize:10,color:"#52525b",marginTop:6},children:[pn(e.volume)," ",a("predict.matches.volume")]})]});return l&&n?jsxRuntime.jsx(n,{href:l,className:"block",children:c}):c}var Us=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:o,onSelectEntry:n,getEventHref:a,LinkComponent:i,onStatsChange:s},l){let{t:c}=i18n.useTranslation(),u=react.useRef(null),{data:d,hasNextPage:p,fetchNextPage:m,isFetchingNextPage:g,isLoading:f,isPlaceholderData:h,refetch:x}=reactPredict.useInfiniteMatches({sort_by:t,sort_asc:r,min_volume:o,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[R,N]=react.useState(0),[w,v]=react.useState(false);w&&!h?(v(false),N(U=>U+1)):h&&!w&&v(true);let B=react.useMemo(()=>{let U=d?.pages;return !U||U.length<=1?0:U.slice(0,-1).reduce((F,W)=>F+(W.items?.length??0),0)},[d?.pages]);react.useImperativeHandle(l,()=>({refetch:()=>{x();}}),[x]);let b=react.useMemo(()=>d?.pages.flatMap(U=>U.items??[])??[],[d]),X=d?.pages[0]?.total,j=react.useMemo(()=>{let U=d?.pages[0]?.stats;if(U)return {activePairs:U.total_matches,maxSpread:U.max_spread/100,highSpreadCount:U.matches_over_3_percent,totalVolume:U.total_volume};let F=0,W=0,$=0;for(let oe of b)oe.max_spread!=null&&(oe.max_spread>F&&(F=oe.max_spread),oe.max_spread>=.03&&$++),oe.combined_volume!=null&&(W+=oe.combined_volume);return {activePairs:X??b.length,maxSpread:F,highSpreadCount:$,totalVolume:W}},[d,b,X]);react.useEffect(()=>{j.activePairs>0&&s?.(j);},[j,s]);let ie=react.useCallback(()=>{p&&!g&&m();},[p,g,m]);return f?jsxRuntime.jsx(ap,{}):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:`
42
+ @media(max-width:1023px){.matches-card-grid{grid-template-columns:1fr!important}}
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((U,F)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${Math.max(0,F-B)*35}ms both`},children:jsxRuntime.jsx(Ws,{group:U,onSelectEntry:n,getEventHref:a,LinkComponent:i})},`${R}-${U.id}`))}),p&&jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0"},children:[jsxRuntime.jsxs("button",{ref:u,disabled:g,onClick:ie,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:U=>{g||(U.currentTarget.style.background="rgba(39,39,42,0.9)",U.currentTarget.style.color="#fff");},onMouseLeave:U=>{U.currentTarget.style.background="rgba(39,39,42,0.6)",U.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"})}),c("predict.matches.loadMore")]}),jsxRuntime.jsx("style",{children:"@keyframes match-load-spin{to{transform:rotate(360deg)}}"}),X!=null&&jsxRuntime.jsx("span",{style:{fontSize:12,color:"rgba(255,255,255,0.35)"},children:c("predict.matches.showing",{current:b.length,total:X})})]})]})});function ap(){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(ip,{index:t},t))})]})}function ip({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 up={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function pp(){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 mp({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(pp,{})]})]})]})]})}function Vx({onSelectEntry:e,getEventHref:t,LinkComponent:r,bgImageSrc:o}){let{t:n}=i18n.useTranslation(),[a,i]=react.useState("spread"),[s,l]=react.useState(false),[c,u]=react.useState(5e3),[d,p]=react.useState(),m=react.useRef(null),g=react.useCallback(R=>{i(R);},[]),f=react.useCallback(R=>{l(R);},[]),h=react.useCallback(R=>{p(R);},[]),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:`
45
+ @keyframes matchFadeIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
46
+ .match-fade-in{animation:matchFadeIn .5s ease-out both}
47
+ .match-fade-in-d1{animation:matchFadeIn .5s ease-out .1s both}
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(Ds,{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(up[a])}),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(As,{sortBy:a,onSortChange:g,sortAsc:s,onSortAscChange:f,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(Us,{ref:m,sortBy:a,sortAsc:s,minVolume:c,onSelectEntry:e,getEventHref: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(mp,{stats:d})]})}function xp(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:e>=1e3?`$${(e/1e3).toFixed(1)}K`:`$${e.toFixed(0)}`}function Xx({matches:e,total:t}){let{t:r}=i18n.useTranslation(),o=react.useMemo(()=>{let n=0,a=0,i=new Set;for(let s of e){s.max_spread!=null&&s.max_spread>n&&(n=s.max_spread),s.combined_volume!=null&&(a+=s.combined_volume);for(let l of s.entries)i.add(typeof l.source=="string"?l.source:"");}return {count:t??e.length,maxSpread:n,totalVolume:a,platformCount:i.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(mr,{label:r("predict.matches.stats.matchedMarkets"),value:o.count.toLocaleString()}),jsxRuntime.jsx(fn,{}),jsxRuntime.jsx(mr,{label:r("predict.matches.stats.totalVolume"),value:xp(o.totalVolume)}),jsxRuntime.jsx(fn,{}),jsxRuntime.jsx(mr,{label:r("predict.matches.stats.highestSpread"),value:`${(o.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(fn,{}),jsxRuntime.jsx(mr,{label:r("predict.matches.stats.platforms"),value:String(o.platformCount)})]})}function mr({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 fn(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function js(e){return `${(e*100).toFixed(1)}\xA2`}function vp(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function ev({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",vp(e)),children:js(e)}),o&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",js(t)]})]})}var Dt=10,wp=64,Xs=40,fr=48;function Qs({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:o}=i18n.useTranslation(),[n,a]=react.useState(1),{data:i,isLoading:s,fetchNextPage:l,hasNextPage:c,isFetchingNextPage:u}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:d,isLoading:p,fetchNextPage:m,hasNextPage:g,isFetchingNextPage:f}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),h=s||p,x=u||f,R=c||g,N=react.useMemo(()=>{let F=[];return i?.pages&&F.push(...i.pages.flatMap(W=>W.items)),d?.pages&&F.push(...d.pages.flatMap(W=>W.items)),F.sort((W,$)=>($.timestamp??0)-(W.timestamp??0)),F},[i,d]),w=Math.max(1,Math.ceil(N.length/Dt)+(R?1:0)),v=(n-1)*Dt,B=N.slice(v,v+Dt),b=react.useCallback(()=>{a(F=>Math.max(1,F-1));},[]),X=react.useCallback(async()=>{n*Dt>=N.length&&R&&(c&&await l(),g&&await m()),a(W=>W+1);},[n,N.length,R,c,g,l,m]),j=n>1,ie=n*Dt<N.length||R;if(h)return jsxRuntime.jsx(Lp,{height:r});if(N.length===0&&!R)return jsxRuntime.jsx(Tp,{message:o("predict.profile.noHistory"),height:r});let U=r-Xs-fr;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:Xs},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:U},children:[B.map((F,W)=>jsxRuntime.jsx(Pp,{trade:F},F.id??`${v+W}`)),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:fr},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!j,onClick:b,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",j?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",o("predict.profile.previous")]}),Array.from({length:Math.min(w,5)},(F,W)=>{let $=W+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>a($),className:ui.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",$===n?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:$},$)}),jsxRuntime.jsxs("button",{type:"button",disabled:!ie,onClick:X,className:ui.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",ie?"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-fr},children:B.map((F,W)=>jsxRuntime.jsx(Cp,{trade:F},F.id??`m-${v+W}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:fr},children:[jsxRuntime.jsx("button",{type:"button",disabled:!j,onClick:b,className:ui.cn("text-sm cursor-pointer",j?"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:!ie,onClick:X,className:ui.cn("text-sm cursor-pointer",ie?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function Pp({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",o=e.price??0,n=e.usd_size??0,a=Zs(e.type,t),i=r,s=i?"+":"-",l=i?"text-success":"text-foreground",c=e.event?.title??e.market?.question??"\u2014",u=e.event?.image_url,d=e.outcome??"",p=ra(e.timestamp),m=Js(e),g=Ep(e),f=Mp(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:wp},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:a}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:ta(o)}),jsxRuntime.jsx("div",{className:ui.cn("flex-[1.5] pr-2 text-right font-mono",l),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",g!==null?g>=0?"text-success":"text-danger":"text-neutral"),children:g!==null?`${g>=0?"+":"-"}$${Math.abs(g).toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-neutral",children:f!==null?`$${f.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(ea,{})})})]})}function Cp({trade:e}){let{t}=i18n.useTranslation(),r=e.side?.toUpperCase()==="BUY",o=e.price??0,n=e.usd_size??0,a=Zs(e.type,t),i=e.event?.title??e.market?.question??"\u2014",s=ra(e.timestamp),l=Js(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:i})]}),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:a})]}),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:ta(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"})]}),l&&jsxRuntime.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"ml-auto text-neutral hover:text-foreground transition-colors",children:jsxRuntime.jsx(ea,{})})]})]})}function Zs(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 Js(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function Ep(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 Mp(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 ea(){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 Tp({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Lp({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 ta(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function ra(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"),a=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getFullYear(),s=t.getTimezoneOffset(),l=s<=0?"+":"-",c=String(Math.abs(Math.floor(s/60))).padStart(2,"0");return `${r}:${o} ${n}/${a}/${i} (${l}${c})`}var Ft=10,Fp=64,oa=40,gr=48;function aa({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:o}=i18n.useTranslation(),n=reactPredict.useCancelOrder(),[a,i]=react.useState(1),{data:s,isLoading:l,fetchNextPage:c,hasNextPage:u,isFetchingNextPage:d}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:p,isLoading:m,fetchNextPage:g,hasNextPage:f,isFetchingNextPage:h}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),x=l||m,R=d||h,N=u||f,w=react.useMemo(()=>{let $=[],oe=new Set(["live","open","submitted","pending"]);return s?.pages&&$.push(...s.pages.flatMap(pe=>pe.items).filter(pe=>oe.has(pe.status))),p?.pages&&$.push(...p.pages.flatMap(pe=>pe.items).filter(pe=>oe.has(pe.status))),$},[s,p]),v=react.useCallback($=>{n.mutate({source:$.source,id:$.id});},[n]),B=Math.max(1,Math.ceil(w.length/Ft)+(N?1:0)),b=(a-1)*Ft,X=w.slice(b,b+Ft),j=react.useCallback(()=>{i($=>Math.max(1,$-1));},[]),ie=react.useCallback(async()=>{a*Ft>=w.length&&N&&(u&&await c(),f&&await g()),i(oe=>oe+1);},[a,w.length,N,u,f,c,g]),U=a>1,F=a*Ft<w.length||N;if(x)return jsxRuntime.jsx(Wp,{height:r});if(w.length===0&&!N)return jsxRuntime.jsx($p,{message:o("predict.profile.noOrders"),height:r});let W=r-oa-gr;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: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:W},children:[X.map($=>jsxRuntime.jsx(Hp,{order:$,onCancel:v},$.id)),R&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui.Spinner,{size:"sm"})})]}),jsxRuntime.jsx(sa,{className:"hidden lg:flex",currentPage:a,totalPages:B,canGoPrev:U,canGoNext:F,onPrev:j,onNext:ie,onPage:i,t:o}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-gr},children:X.map($=>jsxRuntime.jsx(Bp,{order:$,onCancel:v},$.id))}),jsxRuntime.jsx(sa,{className:"lg:hidden",currentPage:a,totalPages:B,canGoPrev:U,canGoNext:F,onPrev:j,onNext:ie,onPage:i,t:o,compact:true})]})}function Hp({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),o=e.side==="BUY",n=e.price?parseFloat(e.price):0,a=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:Fp},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:a>0?`$${a.toFixed(2)}`:"\u2014"})]})}function Bp({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 sa({className:e,currentPage:t,totalPages:r,canGoPrev:o,canGoNext:n,onPrev:a,onNext:i,onPage:s,t:l,compact:c}){return c?jsxRuntime.jsxs("div",{className:ui.cn("flex items-center justify-center gap-3 shrink-0",e),style:{height:gr},children:[jsxRuntime.jsx("button",{type:"button",disabled:!o,onClick:a,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:i,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:gr},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!o,onClick:a,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 ",l("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:i,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:[l("predict.profile.next")," \u2192"]})]})}function $p({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Wp({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 bn=10,Vp=64,la=40,hr=48;function ca({positions:e,isLoading:t,listHeight:r,onClosePosition:o,onEventClick:n}){let{t:a}=i18n.useTranslation(),[i,s]=react.useState(1),l=react.useCallback(()=>{for(let f of e)o?.(f);},[e,o]);if(t)return jsxRuntime.jsx(qp,{height:r});if(e.length===0)return jsxRuntime.jsx(Yp,{message:a("predict.profile.noPositions"),height:r});let c=Math.max(1,Math.ceil(e.length/bn)),u=(i-1)*bn,d=e.slice(u,u+bn),p=i>1,m=i<c,g=r-la-hr;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:a("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:a("predict.profile.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:a("predict.profile.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:a("predict.profile.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:a("predict.profile.markPrice")}),jsxRuntime.jsxs("div",{className:"flex-[1.5] pr-2 text-right",children:[jsxRuntime.jsx("span",{children:a("predict.profile.pnl")}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",a("predict.profile.pnlExcludeFees"),")"]})]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:a("predict.profile.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:a("predict.profile.estSettlement")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:o&&e.length>0&&jsxRuntime.jsx("button",{type:"button",onClick:l,className:"text-xs text-primary hover:text-primary/80 cursor-pointer transition-colors",children:a("predict.profile.closeAll")})})]}),jsxRuntime.jsx("div",{className:"hidden lg:block overflow-y-auto",style:{height:g},children:d.map((f,h)=>jsxRuntime.jsx(jp,{position:f,onClosePosition:o,onEventClick:n},f.market?.slug??`${u+h}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:hr},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!p,onClick:()=>s(f=>Math.max(1,f-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 ",a("predict.profile.previous")]}),Array.from({length:Math.min(c,5)},(f,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===i?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:x},x)}),jsxRuntime.jsxs("button",{type:"button",disabled:!m,onClick:()=>s(f=>f+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:[a("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-hr},children:d.map((f,h)=>jsxRuntime.jsx(Gp,{position:f,onClose:o,onEventClick:n},f.market?.slug??`m-${u+h}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:hr},children:[jsxRuntime.jsx("button",{type:"button",disabled:!p,onClick:()=>s(f=>Math.max(1,f-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:i}),jsxRuntime.jsx("button",{type:"button",disabled:!m,onClick:()=>s(f=>f+1),className:ui.cn("text-sm cursor-pointer",m?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function jp({position:e,onClosePosition:t,onEventClick:r}){let{t:o}=i18n.useTranslation(),n=e.pnl??0,a=e.pnl_percent??0,i=e.avg_price??0,s=e.current_price??0,l=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,g=e.side,f=e.market?.outcomes?.[0]?.label??"",h=e.market?.end_at?Xp(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:Vp},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",g.toLowerCase()==="yes"?"text-success":"text-danger"),children:g}),f&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1",children:"\xB7"}),jsxRuntime.jsx("span",{children:f})]})]})]})]})}),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:["$",l.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*i).toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:yn(i)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:yn(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,a.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 Gp({position:e,onClose:t,onEventClick:r}){let{t:o}=i18n.useTranslation(),n=e.pnl??0,a=e.pnl_percent??0,i=e.current_price??0,s=n>0?"text-success":n<0?"text-danger":"text-foreground",l=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(xr,{label:o("predict.profile.totalSize"),value:`${e.size}`}),jsxRuntime.jsx(xr,{label:o("predict.profile.markPrice"),value:yn(i)}),jsxRuntime.jsx(xr,{label:o("predict.profile.pnl"),value:`${l}$${Math.abs(n).toFixed(2)} (${l}${a.toFixed(1)}%)`,className:s}),jsxRuntime.jsx(xr,{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 xr({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 Yp({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function qp({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 yn(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Xp(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"),a=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getFullYear(),s=t.getTimezoneOffset(),l=s<=0?"+":"-",c=String(Math.abs(Math.floor(s/60))).padStart(2,"0");return `${r}:${o} ${n}/${a}/${i} (${l}${c})`}catch{return "\u2014"}}function ua({positions:e,trades:t,isLoading:r}){let{t:o}=i18n.useTranslation(),n=react.useMemo(()=>{let s=0,l=0;for(let m of e)s+=m.realized_pnl??0,l+=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:l,volume:c,winRateStr:p}},[e,t]),a=n.realizedPnl>0?"text-success":n.realizedPnl<0?"text-danger":"text-foreground",i=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",a),children:[i,"$",Math.abs(n.realizedPnl).toFixed(2)]})]}),jsxRuntime.jsxs("div",{className:"flex items-end gap-8 sm:gap-10",children:[jsxRuntime.jsx(Nn,{label:o("predict.profile.winRate"),value:n.winRateStr,isLoading:r}),jsxRuntime.jsx(Nn,{label:o("predict.profile.positions"),value:`$${n.positionsValue.toFixed(2)}`,isLoading:r}),jsxRuntime.jsx(Nn,{label:o("predict.profile.volume"),value:`$${n.volume.toFixed(2)}`,isLoading:r})]})]})}function Nn({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 Sn=600;function om({solanaAddress:e,evmAddress:t,onClosePosition:r,onEventClick:o}){let{t:n}=i18n.useTranslation(),[a,i]=react.useState("positions"),s=!!(e||t),{data:l,isLoading:c}=reactPredict.usePositions({source:"kalshi",user:e??""}),{data:u,isLoading:d}=reactPredict.usePositions({source:"polymarket",user:t??""}),p=react.useMemo(()=>{let b=[];return l?.positions&&b.push(...l.positions),u?.positions&&b.push(...u.positions),b},[l,u]),m=c||d,{data:g,isLoading:f}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:h,isLoading:x}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),R=react.useMemo(()=>[...g?.pages?.flatMap(X=>X.items)??[],...h?.pages?.flatMap(X=>X.items)??[]],[g,h]),N=m||f||x,w=p.length,B=[{key:"positions",label:w>0?`${n("predict.profile.positionsTab")} (${w})`: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(ua,{positions:p,trades:R,isLoading:N}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:B.map(b=>jsxRuntime.jsx("button",{type:"button",onClick:()=>i(b.key),className:ui.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",a===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:[a==="positions"&&jsxRuntime.jsx(ca,{positions:p,isLoading:m,listHeight:Sn,onClosePosition:r,onEventClick:o}),a==="orders"&&jsxRuntime.jsx(aa,{solanaAddress:e,evmAddress:t,listHeight:Sn}),a==="history"&&jsxRuntime.jsx(Qs,{solanaAddress:e,evmAddress:t,listHeight:Sn})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:n("predict.profile.connectWallet")})}
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,"fetchMatchesPage",{enumerable:true,get:function(){return reactPredict.fetchMatchesPage}});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,"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=Nm;exports.CHART_RANGE_PERIOD=ym;exports.CHART_RANGE_SAMPLE_INTERVAL=km;exports.CandlestickPeriod=Ut;exports.CategoriesSkeleton=um;exports.CategoriesUI=Dn;exports.CategoriesWidget=Bn;exports.ChartRange=Se;exports.DEFAULT_CHART_RANGE=Kt;exports.DEFAULT_FILTER_STATE=Fr;exports.DEFAULT_PAGE_SIZE=bt;exports.DEFAULT_PRICE_HISTORY_INTERVAL=Cm;exports.EventDetailPage=y0;exports.EventDetailSkeleton=Mt;exports.EventDetailUI=ns;exports.EventDetailWidget=os;exports.EventItem=wo;exports.EventMarketDepthChartUI=Uo;exports.EventMarketDetailWidget=Yo;exports.EventPriceChart=Qo;exports.EventsFilterUI=so;exports.EventsPage=og;exports.EventsPageSkeleton=Ef;exports.EventsSkeleton=Br;exports.EventsToolbarUI=uo;exports.EventsUI=Lo;exports.EventsWidget=_o;exports.MAX_PRICE_HISTORY_MARKETS=Tr;exports.MatchGroupCard=Ws;exports.MatchesFilterBar=As;exports.MatchesHero=Ds;exports.MatchesPage=Vx;exports.MatchesStatsBar=Xx;exports.MatchesWidget=Us;exports.ORDER_MAX_PRICE=Pm;exports.ORDER_MIN_PRICE=wm;exports.ORDER_MIN_QUANTITY=Lr;exports.ORDER_PRICE_STEP=Sm;exports.PREDICT_SEARCH_MODAL_ID=cn;exports.PREDICT_TRADE_MODAL_ID=yt;exports.PRICE_HISTORY_SAMPLE_INTERVAL=Em;exports.PredictSearchModal=Gh;exports.PredictTradeModal=jt;exports.PredictWalletProvider=ja;exports.PriceHistoryInterval=at;exports.ProfilePage=om;exports.SORT_PRESETS=co;exports.STATIC_CATEGORIES=Mr;exports.SearchEventsButton=rx;exports.SearchHistoryUI=us;exports.SearchHistoryWidget=ps;exports.SearchInputUI=ms;exports.SearchResultItemUI=gs;exports.SearchResultListWidget=ys;exports.SearchWidget=Ps;exports.SimilarEventCard=fd;exports.SimilarEventsSection=ss;exports.SourceBadge=Px;exports.SpreadIndicator=ev;exports.TradeFormSkeleton=Fo;exports.TradeFormUI=ro;exports.TradeFormWidget=Vt;exports.UserActivitySection=Do;exports.countActiveFilters=Hr;exports.formatKMB=Tt;exports.getSourceMeta=ur;exports.useEventDetail=E0;exports.useEventsInfinite=fo;exports.usePredictSearchHistory=lr;exports.usePredictWallet=_r;exports.useSearchResultListScript=hs;exports.useSearchScript=ws;exports.useTradeForm=qn;exports.version=Ia;//# sourceMappingURL=index.js.map
22
51
  //# sourceMappingURL=index.js.map