@liberfi.io/ui-predict 4.0.65 → 4.0.67

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,9 +1,9 @@
1
- 'use strict';var react=require('react'),ui$1=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'),reactPredict=require('@liberfi.io/react-predict'),types=require('@liberfi.io/types'),utils$1=require('@liberfi.io/utils'),Uo=require('canvas-confetti'),reactQuery=require('@tanstack/react-query'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var Uo__default=/*#__PURE__*/_interopDefault(Uo);var Oc={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},qi=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],Bo=(()=>{let e=t=>{let r=qi.indexOf(t);return r===-1?qi.length:r};return Object.entries(Oc).map(([t,r])=>({slug:t,label:t,tags:(r??[]).map(n=>({slug:n,label:n}))})).sort((t,r)=>e(t.slug)-e(r.slug))})();function Xi({categories:e,selectedCategory:t,selectedTag:r,activeTags:n,onCategorySelect:o,onTagSelect:i,trailing:a,pulsingTab:s="Trending",className:c}){let{t:u}=i18n.useTranslation(),m=react.useCallback(()=>{o(null);},[o]),l=u("predict.categories.trending");return jsxRuntime.jsxs("div",{className:ui$1.cn("sticky top-0 z-30 flex w-full flex-col justify-between gap-2 px-4 py-2.5 lg:px-4 lg:py-2",c),children:[jsxRuntime.jsx("style",{children:".cat-primary-row{display:flex;width:100%;flex-direction:column;gap:8px}@media(min-width:1024px){.cat-primary-row{flex-direction:row;align-items:center}}.cat-primary-row>.cat-tabs{min-width:0;overflow-x:auto;overflow-y:hidden;-ms-overflow-style:none;scrollbar-width:none}.cat-primary-row>.cat-tabs::-webkit-scrollbar{display:none}@media(min-width:1024px){.cat-primary-row>.cat-tabs{flex:1 1 0%}}"}),jsxRuntime.jsxs("div",{className:"cat-primary-row",children:[jsxRuntime.jsx("div",{className:"cat-tabs hideScrollbar",children:jsxRuntime.jsxs("div",{className:"flex min-h-9 items-stretch gap-x-3 lg:min-h-10",children:[jsxRuntime.jsx(Yi,{label:l,isSelected:t===null,onPress:m,showPulse:l===s}),jsxRuntime.jsx(Bc,{}),e.map(f=>{let d=f.slug??f.category,p=f.label??f.category;return jsxRuntime.jsx(Yi,{label:p,isSelected:t===d,onPress:()=>o(d),badge:f.badge,showPulse:d===s||p===s},d)})]})}),a&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:a})]}),t&&n.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.5 pl-1 lg:w-full lg:gap-x-2",children:[jsxRuntime.jsx(Qi,{label:u("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),n.map(f=>{let d=f.slug??f.label;return jsxRuntime.jsx(Qi,{label:f.label,icon:f.icon,isSelected:r===d,onPress:()=>i(d)},d)})]})})]})}function Yi({label:e,isSelected:t,onPress:r,badge:n,showPulse:o}){return jsxRuntime.jsxs("button",{type:"button",onClick:r,className:ui$1.cn("relative shrink-0 cursor-pointer whitespace-nowrap border-b px-2.5 py-1.5 text-sm font-medium capitalize transition-colors",t?"border-primary/50 text-primary":"border-transparent text-neutral-500 hover:text-neutral-300"),children:[o?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,n&&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:n})]})}function Bc(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function Qi({label:e,icon:t,isSelected:r,onPress:n}){return jsxRuntime.jsxs("button",{type:"button",onClick:n,className:ui$1.cn("flex shrink-0 items-center justify-center gap-x-1 min-w-14 rounded-2xl border px-3 py-1.5 text-sm font-medium uppercase transition-colors cursor-pointer",r?"border-primary/40 bg-primary/15 text-primary":"border-border/80 text-neutral-500 hover:bg-primary/10 hover:text-primary"),children:[t&&jsxRuntime.jsx("span",{className:ui$1.cn("iconify size-4",t)}),e]})}function Zv({count:e=6}){return jsxRuntime.jsx("div",{className:"flex w-full flex-col gap-2 px-4 py-2.5 lg:px-4 lg:py-2",children:jsxRuntime.jsx("div",{className:"flex min-h-9 items-center gap-x-3 lg:min-h-10",children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-6 w-16 shrink-0 rounded"},r))})})}function Zi(e){return e.trim().toLowerCase().replace(/&/g,"and").replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function zc(e){return `predict.categories.category.${Zi(e)}`}function es(e){return `predict.categories.tag.${Zi(e)}`}function Wc(e,t){return e.map(r=>({category:r.slug,slug:r.slug,label:t(zc(r.slug),r.label),tags:r.tags.map(n=>({slug:n.slug,label:t(es(n.slug),n.label),icon:n.icon}))}))}function Uc(e,t){return e?e.tags.map(r=>({slug:r.slug,label:t(es(r.slug),r.label),icon:r.icon})):[]}function ts({onSelect:e,trailing:t,className:r}){let{t:n}=i18n.useTranslation(),o=react.useCallback((p,h)=>{let v=n(p);return typeof v=="string"&&v!==p?v:h},[n]),[i,a]=react.useState(null),[s,c]=react.useState(null),u=react.useCallback(p=>{a(p),c(null),e?.({categorySlug:p,tagSlug:null});},[e]),m=react.useCallback(p=>{c(p),e?.({categorySlug:i,tagSlug:p});},[i,e]),l=Wc(Bo,o),f=Bo.find(p=>p.slug===i),d=Uc(f,o);return jsxRuntime.jsx(Xi,{categories:l,selectedCategory:i,selectedTag:s,activeTags:d,onCategorySelect:u,onTagSelect:m,trailing:t,className:r})}function An(e){return {title:e.title,imageUrl:e.image_url}}function Fn(e,t){let r=e.outcomes[0],n=e.outcomes[1];return {question:e.question,yesAsk:t?.yesAsk??r?.best_ask??r?.price,noAsk:t?.noAsk??n?.best_ask??n?.price,yesBid:t?.yesBid??r?.best_bid,noBid:t?.noBid??n?.best_bid,yesSubTitle:r?.label??"Yes",noSubTitle:n?.label??"No"}}var sn=24,zo=4,Bn={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},le={ONE_DAY:"1d",ONE_WEEK:"1w",ONE_MONTH:"1m",ALL:"all"},Hn=le.ALL,cb={[le.ONE_DAY]:Bn.ONE_MINUTE,[le.ONE_WEEK]:Bn.ONE_HOUR,[le.ONE_MONTH]:Bn.ONE_HOUR,[le.ALL]:Bn.ONE_DAY},db={[le.ONE_DAY]:300,[le.ONE_WEEK]:3600,[le.ONE_MONTH]:10800,[le.ALL]:1440*60},ub={[le.ONE_DAY]:1440*60,[le.ONE_WEEK]:10080*60,[le.ONE_MONTH]:720*60*60,[le.ALL]:null},zn=1,Wn=1,pb=1,mb=1,fb=99,zr={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},gb=zr.ONE_WEEK,hb={[zr.ONE_HOUR]:60,[zr.SIX_HOURS]:60,[zr.ONE_DAY]:300,[zr.ONE_WEEK]:1800,[zr.MAX]:1800};var os=react.createContext(null);function yr(){let e=react.useContext(os);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var Yc=1e4;function Qc({pollingInterval:e=Yc,enabled:t=true,enableKalshi:r=true,children:n}){let o=walletConnector.useWallets(),i=react.useMemo(()=>o.find(C=>C.chainNamespace===types.ChainNamespace.SOLANA&&C.isConnected)?.address,[o]),a=react.useMemo(()=>o.find(C=>C.chainNamespace===types.ChainNamespace.EVM&&C.isConnected)?.address,[o]),{data:s,isLoading:c,isFetching:u,error:m}=reactPredict.useBalance({source:"kalshi",user:i??""},{enabled:t&&r&&!!i,refetchInterval:e}),{data:l,isLoading:f}=reactPredict.useDFlowKYC(i,{enabled:t&&r&&!!i,refetchInterval:3e4}),{data:d,isLoading:p}=reactPredict.usePolymarketSetup(a,{enabled:t&&!!a,refetchInterval:3e4}),h=d?.safe_address,g=d?.verified??false,v=d?.wallet_kind??"deposit",x=d?.deposit_wallet_address,k=v==="safe"?d?.safe_address:x,S=v==="safe"?d?.safe_deployed??false:d?.deposit_wallet_deployed??false,{data:b,isLoading:y,isFetching:M,error:A}=reactPredict.useBalance({source:"polymarket",user:a??""},{enabled:t&&g&&!!a,refetchInterval:e}),P=react.useMemo(()=>({enableKalshi:r,solanaAddress:i,evmAddress:a,polymarketWalletKind:v,polymarketWalletAddress:k,polymarketDepositWalletAddress:x,polymarketWalletDeployed:S,polymarketSafeAddress:h,kalshiUsdcBalance:s?Number(s.balance):null,polymarketUsdcBalance:g&&b?Number(b.balance):null,kalshiKycVerified:l?.verified??false,kalshiKycUrl:l?.kyc_url??null,kalshiKycLoading:f,polymarketSetupVerified:g,polymarketSafeDeployed:d?.safe_deployed??false,polymarketTokenApproved:d?.token_approved??false,polymarketSetupLoading:p,isLoading:c||y,isFetching:u||M,error:m??A??null}),[r,i,a,v,k,x,S,h,s,b,g,l,f,d,p,c,y,u,M,m,A]);return jsxRuntime.jsx(os.Provider,{value:P,children:n})}var Jc={minutes:60,hours:3600,days:86400};function Un(e,t,r){let n=Math.floor(Date.now()/1e3);switch(e){case "5m":return n+300;case "1h":return n+3600;case "12h":return n+720*60;case "24h":return n+1440*60;case "eod":{let o=new Date;return o.setUTCHours(23,59,59,0),Math.floor(o.getTime()/1e3)}case "custom":return n+t*Jc[r]}}function $n(e,t){let r=parseFloat(t);return !r||r<=0?e:Math.round(e/r)*r}function be(e,t){let r=Math.pow(10,t);return Math.floor(e*r)/r}function Zc(e){let t=e;return !Number.isFinite(t)||t<=0||t>=1?1:1-t}var ed=100,td=300;function $o(e,t){return ed/1e4+Math.max(0,e)/1e4*Zc(t)}function rd(e,t){let r=e?.[t],n=typeof r=="number"?r:Number(r);return Number.isFinite(n)?n:void 0}function nd(e,t){let r=e?.[t];return typeof r=="string"?r:void 0}function is(e){let t=rd(e,"polymarket.effectiveTakerFeeBps");if(t!==void 0&&t>=0)return t;let r=e?.["polymarket.feeDescriptor"],n=typeof r?.r=="number"?r.r:Number(r?.r);return Number.isFinite(n)&&n>=0?n*1e4:nd(e,"polymarket.sportsMarketType")?td:0}function ss({source:e,usdcBalance:t,safetyBufferUsd:r=.01,feeRateBps:n=0,pricePerShare:o}){if(t==null||!Number.isFinite(t))return 0;let i=be(Math.max(0,t),2);if(e!=="polymarket")return i;let a=$o(n,o??NaN),s=i/(1+a)-r;return be(Math.max(0,s),2)}function as({usdcAmount:e,pricePerShare:t,feeRateBps:r}){if(!Number.isFinite(e)||e<=0)return 0;let n=$o(r,t);return e*n}function ls({grossReturn:e,pricePerShare:t,feeRateBps:r}){if(!Number.isFinite(e)||e<=0)return 0;let n=$o(r,t);return e*n}function Kn(e,t,r){let n=e.match(/Size\s*\(([\d.]+)\)\s*lower than the minimum:\s*([\d.]+)/i);if(n)return t("predict.trade.polymarket.minOrderSize",{current:n[1],min:n[2]});let o=e.match(/balance:\s*(\d+),\s*sum of active orders:\s*(\d+)/i);if(o){let a=parseInt(o[1],10)/1e6,s=parseInt(o[2],10)/1e6,c=Math.max(0,a-s);return t("predict.trade.polymarket.insufficientBalance",{total:be(a,2).toFixed(2),active:be(s,2).toFixed(2),available:be(c,2).toFixed(2)})}return /not enough balance/i.test(e)?t(r==="sell"?"predict.trade.insufficientShares":"predict.trade.insufficientBalance"):/max accuracy of/i.test(e)?t("predict.trade.polymarket.decimalAccuracy"):/tick size/i.test(e)?t("predict.trade.polymarket.tickSizeError"):/couldn.*fully filled|FOK.*filled or killed/i.test(e)?t("predict.trade.polymarket.fokNotFilled"):e.replace(/order\s+0x[a-f0-9]+\s+is invalid\.\s*/i,"")||e}function kr(e,t=2){return parseFloat(be(e,t).toFixed(t)).toString()}function cs(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};Uo__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{Uo__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{Uo__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}var ds={en:{submitted:"Your trade was submitted successfully. Confirming the result.",completed:"Trade completed",delayed:"Your trade was submitted successfully. Confirmation is taking a little longer."},zh:{submitted:"\u60A8\u7684\u4EA4\u6613\u5DF2\u6210\u529F\u63D0\u4EA4\uFF0C\u6B63\u5728\u786E\u8BA4\u4EA4\u6613\u7ED3\u679C",completed:"\u4EA4\u6613\u5DF2\u5B8C\u6210",delayed:"\u60A8\u7684\u4EA4\u6613\u5DF2\u6210\u529F\u63D0\u4EA4\uFF0C\u786E\u8BA4\u65F6\u95F4\u6BD4\u9884\u671F\u7A0D\u957F"}};function od(e){return (e?.resolvedLanguage??e?.language??"").toLowerCase().startsWith("zh")}function Ko(e,t,r){let n=e(t);return n&&n!==t?n:r}function Wr(e,t){let r=od(t)?ds.zh:ds.en;return {submitted:Ko(e,"predict.trade.resultSubmitted",r.submitted),completed:Ko(e,"predict.trade.resultCompleted",r.completed),delayed:Ko(e,"predict.trade.resultDelayed",r.delayed)}}function ld({deadlineAt:e}){let[t,r]=react.useState(()=>Math.max(0,e-Date.now()));return react.useEffect(()=>{let n=setInterval(()=>{r(Math.max(0,e-Date.now()));},1e3);return ()=>clearInterval(n)},[e]),`${Math.max(0,Math.ceil(t/1e3))}s`}function Ur({id:e=`predict-trade-result-${Date.now()}`,durationMs:t=3e4,celebrateOnCompleted:r=false,messages:n}){return {id:e,submitted:()=>{let o=Date.now()+t;ui$1.toast.progress({id:e,message:n.submitted,duration:t,progress:true,action:react.createElement(ld,{deadlineAt:o})});},completed:()=>{ui$1.toast.update(e,{type:"success",message:n.completed,duration:5e3}),r&&cs();},delayed:()=>{ui$1.toast.update(e,{type:"blank",message:n.delayed,duration:8e3});},failed:o=>{ui$1.toast.update(e,{type:"error",message:o,duration:8e3});}}}function ms({market:e,initialOutcome:t="yes",slippageBps:r=100,onInsufficientBalance:n}){let{t:o,i18n:i}=i18n.useTranslation(),{status:a}=walletConnector.useAuth(),s=walletConnector.useWallets(),c=reactPredict.usePredictClient(),u=react.useContext(reactPredict.PolymarketContext),{start:m}=reactPredict.useTradeResultConfirmation(),l=e.source,f=l==="polymarket",d=s.find(_=>_.chainNamespace===types.ChainNamespace.SOLANA&&_.isConnected),p=s.find(_=>_.chainNamespace===types.ChainNamespace.EVM&&_.isConnected&&"switchChain"in _),h=a==="authenticated",g=d?.address,v=p?.address,[x,k]=react.useState(t),[S,b]=react.useState("market"),[y,M]=react.useState(NaN),[A,P]=react.useState(NaN),[C,I]=react.useState(false),[B,Y]=react.useState(null),[z,Q]=react.useState(false),[q,te]=react.useState(false),[N,E]=react.useState("1h"),[H,J]=react.useState(30),[de,se]=react.useState("minutes"),Ve=react.useMemo(()=>Wr(o,i),[i,o]),je=true,Ge=react.useCallback(async(_,Me)=>{let ke=Ur({celebrateOnCompleted:true,messages:Ve});ke.submitted(),await m({source:l,user:l==="kalshi"?g:v,kalshiUser:je?g:void 0,polymarketUser:v,marketSlug:e.slug,eventSlug:e.event_slug,expectation:_,getOrdersHeaders:Me})==="confirmed"?ke.completed():ke.delayed();},[m,je,v,e.event_slug,e.slug,l,Ve,g]),w=react.useMemo(()=>{if(l!=="polymarket")return;let _=e.provider_meta?.["polymarket.clobTokenIds"];return _?(typeof _=="string"?JSON.parse(_):_)[x==="yes"?0:1]:void 0},[l,e.provider_meta,x]),{data:ft,isLoading:qe}=reactPredict.useTickSize(w),Le=reactPredict.normalizePolymarketTickSize(ft?.minimum_tick_size),{data:Nt,isLoading:Re}=reactPredict.useFeeRate(w),Ye=Nt?.base_fee??0,ot=String(Ye),_e=react.useMemo(()=>is(e.provider_meta),[e.provider_meta]),{data:et}=reactPredict.useRebateConfig(),Ie=et?.builder_enabled&&et.builder_code?et.builder_code:void 0,it=null,Ot=false,Ct=null,Mt=false,tt,gt,We;try{let _=yr();je=_.enableKalshi,it={kalshiUsdcBalance:_.kalshiUsdcBalance,polymarketUsdcBalance:_.polymarketUsdcBalance,isLoading:_.isLoading},Ot=_.kalshiKycVerified,Ct=_.kalshiKycUrl,Mt=_.polymarketSetupVerified,tt=_.polymarketSafeAddress,gt=_.polymarketWalletKind,We=_.polymarketWalletAddress;}catch{}let qt=l==="kalshi"&&!Ot,Oe=l==="polymarket"&&!Mt,{data:Qe}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:l,outcome:x},{enabled:e.status==="open"}),me=react.useMemo(()=>{let _=reactPredict.pickBestAsk(Qe,x);if(_!=null&&_>0)return _;let Me=x==="yes"?0:1,ke=e.outcomes[Me];return ke?.best_ask??ke?.price??.5},[Qe,e.outcomes,x]),st=react.useCallback(_=>{b(_);},[]),ht=react.useCallback(_=>{k(_),P(NaN);},[]);react.useEffect(()=>{ht(t);},[t,ht]),react.useEffect(()=>{S==="limit"&&isNaN(A)&&P(Math.round(me*1e4)/1e4);},[S,A,me]);let ve=react.useMemo(()=>S==="limit"&&f&&!isNaN(A)?A:me,[S,f,A,me]),Xe=react.useMemo(()=>isNaN(y)||y<=0?0:ve>0?y/ve:0,[y,ve]),we=react.useMemo(()=>reactPredict.walkOrderbook({orderbook:Qe,outcome:x,side:"buy",sharesNeeded:Xe,slippageBps:r}),[Qe,x,Xe,r]),Tt=react.useMemo(()=>we.status==="ok"&&we.worstPrice!=null&&we.worstPrice>0?we.worstPrice:me,[we,me]),R=react.useMemo(()=>isNaN(y)||y<=0?"0":String(Math.round(y*1e6)),[y]),Ne=e.provider_meta?.["dflow.yesMint"]??"",Ue=e.provider_meta?.["dflow.noMint"]??"",Zr=utils$1.SOLANA_TOKENS.stablecoins.USDC.address,D=x==="yes"?Ne:Ue,Ce=Zr,vt=D,Dt=l==="kalshi"?g??"":v??"",{data:en,isLoading:Eo}=reactPredict.usePositionsMulti({kalshi_user:l==="kalshi"?Dt:void 0,polymarket_user:l==="polymarket"?Dt:void 0},{enabled:!!Dt}),Lo=l==="kalshi"&&!!Ce&&!!vt&&!!g&&R!=="0",{refetch:Yt}=reactPredict.useDFlowQuote({inputMint:Ce,outputMint:vt,amount:R,userPublicKey:g??"",slippageBps:100},{enabled:Lo}),Lr=react.useMemo(()=>it?l==="kalshi"?it.kalshiUsdcBalance:it.polymarketUsdcBalance:en&&en.positions.reduce((Me,ke)=>ke.side==="USDC"||ke.side==="collateral"?Me+(ke.current_value??0):Me,0)||null,[it,en,l]),Ro=it?it.isLoading:Eo,at=react.useMemo(()=>ss({source:l,usdcBalance:Lr,feeRateBps:_e,pricePerShare:ve}),[l,Lr,_e,ve]),Et=Lr==null?null:at,Rr=react.useMemo(()=>isNaN(y)||y<=0?0:y,[y]),tn=react.useMemo(()=>isNaN(y)||y<=0?0:ve>0?y/ve*1:0,[y,ve]),_r=react.useMemo(()=>l!=="polymarket"||isNaN(y)||y<=0?0:as({usdcAmount:y,pricePerShare:ve,feeRateBps:_e}),[l,y,ve,_e]),sr=tn-Rr-_r,_o=react.useCallback(_=>{if(isNaN(_)){M(NaN);return}M(Math.round(Math.max(0,_)*100)/100);},[]),En=react.useCallback(_=>{if(isNaN(_)){P(NaN);return}P(Math.round(_*1e4)/1e4);},[]),Ir=react.useCallback(()=>{M(NaN),P(NaN),b("market"),te(false),E("1h"),J(30),se("minutes");},[]),Qt=react.useMemo(()=>{let _=[];return isNaN(y)||y<=0?_.push(o("predict.trade.minAmountUsd",{amount:Wn})):y<Wn&&_.push(o("predict.trade.minAmountUsd",{amount:Wn})),e.status!=="open"&&_.push(o("predict.trade.marketNotActive")),Et!=null&&!isNaN(y)&&y>0&&y>Et&&_.push(o("predict.trade.insufficientBalance")),S==="limit"&&f&&(isNaN(A)||A<.01||A>.99)&&_.push(o("predict.trade.limitPriceRange")),S==="limit"&&f&&q&&N==="custom"&&(isNaN(H)||H<=0)&&_.push(o("predict.trade.expiration.invalidDate")),l==="polymarket"&&S==="market"&&!isNaN(y)&&y>0&&Xe>0&&(we.status==="insufficient_liquidity"?_.push(o("predict.trade.insufficientLiquidity",{available:be(we.totalAvailable,2)})):we.status==="exceeds_slippage"&&_.push(o("predict.trade.priceImpactTooHigh",{impact:(we.priceImpactBps/100).toFixed(2),slippage:(r/100).toFixed(2)}))),{isValid:_.length===0,errors:_}},[y,e.status,Et,S,f,A,q,N,H,l,Xe,we,r,o]),fr=react.useMemo(()=>Et==null||isNaN(y)||y<=0?false:y>Et,[Et,y]),gr=react.useCallback(()=>{n?.(l);},[n,l]),{mutateAsync:hr}=reactPredict.useDFlowSubmit(),{data:rn}=reactPredict.useOrder({id:B??"",source:l},{enabled:!!B});react.useEffect(()=>{if(!rn||!B)return;let{status:_}=rn;_==="closed"?(Y(null),I(false),Ge("buy-market"),Ir()):(_==="failed"||_==="expired")&&(I(false),Y(null),ui$1.toast.error(o("predict.trade.submitError")));},[Ge,rn,B,Ir,o]);let nn=react.useCallback(async()=>{if(!g||!d)return;if(!Ce||!vt){ui$1.toast.error("Missing token mint addresses"),I(false);return}if(!Ot){Q(true),I(false);return}let Rt=(await Yt()).data?.transaction;if(!Rt){ui$1.toast.error(o("predict.trade.submitError")),I(false);return}let on=Uint8Array.from(atob(Rt),lt=>lt.charCodeAt(0)),Xt=await d.signTransaction(on),Jt=await hr({signedTransaction:btoa(String.fromCharCode(...Xt)),orderContext:{user_public_key:g,input_mint:Ce,output_mint:vt,amount:R,price:String(me),side:"BUY",outcome:x==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});Y(Jt.signature);},[g,d,Yt,hr,Ce,vt,R,me,x,e.slug,o,Ot]),Or=react.useCallback(async()=>{if(!p||!u)return;let _=p.chain,Me=_!==types.Chain.POLYGON;Me&&await p.switchChain(types.Chain.POLYGON);try{let ke=await p.getEip1193Provider();if(!ke){ui$1.toast.error(o("predict.trade.submitError")),I(!1);return}let Rt=gt==="deposit"&&!!We,on=!Rt&&!!tt,Xt=Rt?We:tt,Jt={address:p.address,signatureType:Rt?3:on?2:0,signTypedData:async(_t,T,Se,Pe)=>{let De=[];"name"in _t&&De.push({name:"name",type:"string"}),"version"in _t&&De.push({name:"version",type:"string"}),"chainId"in _t&&De.push({name:"chainId",type:"uint256"}),"verifyingContract"in _t&&De.push({name:"verifyingContract",type:"address"}),"salt"in _t&&De.push({name:"salt",type:"bytes32"});let dt={EIP712Domain:De,...T};return await ke.request({method:"eth_signTypedData_v4",params:[p.address,JSON.stringify({domain:_t,types:dt,primaryType:Se,message:Pe})]})}},lt=u.credentials??await u.authenticate(Jt),Io=x==="yes"?0:1,Ln="",Ht=e.provider_meta?.["polymarket.clobTokenIds"];Ht&&(Ln=(typeof Ht=="string"?JSON.parse(Ht):Ht)[Io]??"");let Dr=e.provider_meta?.["polymarket.negRisk"]??!1,Ar=S==="limit"&&!isNaN(A)?A:Tt,vr=$n(Ar,Le),Rn=S==="limit"?q?"GTD":"GTC":"FOK",br=S==="market"?y:vr>0?y/vr:0,Fr={tokenId:Ln,price:vr,size:br,side:"BUY",orderType:Rn,tickSize:Le,negRisk:Dr,...Xt&&{funderAddress:Xt},...Ie&&{builderCode:Ie},...S==="limit"&&q&&{expiration:Un(N,H,de)}},Br;if(Rt)Br=await reactPredict.buildSignedV2OrderPayload({signer:Jt,depositWalletAddress:Xt,input:Fr,owner:lt.apiKey});else {let _t=reactPredict.buildCtfExchangeDomain(Dr),T=reactPredict.buildOrderMessage({...Fr,signerAddress:Jt.address,signatureType:Jt.signatureType,feeRateBps:ot}),Se=await Jt.signTypedData(_t,reactPredict.CTF_ORDER_TYPES,"Order",T),Pe=reactPredict.buildSignedOrder(T,Se,Fr.orderType);Br=reactPredict.buildClobPayload(Pe,lt.apiKey);}await c.executePolymarketOrder({payload:Br,l2_api_key:lt.apiKey,l2_secret:lt.secret,l2_passphrase:lt.passphrase,signer_address:lt.address,owner:lt.apiKey}),Ge(S==="limit"?"buy-limit":"buy-market",async()=>await reactPredict.buildPolymarketL2Headers(lt.address,{apiKey:lt.apiKey,secret:lt.secret,passphrase:lt.passphrase,method:"GET",requestPath:"/data/orders"})),Ir(),I(!1);}finally{Me&&_&&p.switchChain(_).catch(()=>{});}},[p,u,x,e.provider_meta,S,Ge,A,Tt,y,c,q,N,H,de,Ir,o,Le,ot,tt,gt,We,Ie]),Lt=react.useCallback(async()=>{if(!(!Qt.isValid||!h)){I(true),Y(null),Q(false);try{l==="kalshi"?await nn():await Or();}catch(_){let Me=_ instanceof Error?_.message:"",ke=l==="polymarket"&&Me?Kn(Me,o,"buy"):Me||void 0;ui$1.toast.error(ke||o("predict.trade.submitError")),I(false);}}},[Qt.isValid,h,l,nn,Or,o]);return {outcome:x,orderType:S,quantity:y,limitPrice:A,shares:Xe,effectivePrice:ve,estimatedCost:Rr,estimatedFee:_r,potentialPayout:tn,potentialProfit:sr,pricePerShare:me,usdcBalance:Lr,maxBuyAmount:at,spendableUsdcBalance:Et,isBalanceLoading:Ro,isMarketDataLoading:l==="polymarket"&&(Re||qe),isSubmitting:C,authStatus:a,validation:Qt,isInsufficientBalance:fr,source:l,supportsLimitOrder:f,kycRequired:z,needsKyc:qt,needsSetup:Oe,kycUrl:Ct,expirationEnabled:q,expirationPreset:N,customDuration:H,customDurationUnit:de,setOutcome:ht,setOrderType:st,setQuantity:_o,setLimitPrice:En,setExpirationEnabled:te,setExpirationPreset:E,setCustomDuration:J,setCustomDurationUnit:se,submit:Lt,notifyInsufficientBalance:gr}}function jn({isOpen:e,onClose:t,kycUrl:r}){let{t:n}=i18n.useTranslation();return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:e,onOpenChange:o=>{o||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:n("predict.trade.kycModalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 mb-4 text-left",children:n("predict.trade.kycModalDescription")}),jsxRuntime.jsx("div",{className:"flex flex-col gap-2 mb-4",children:["predict.trade.kycModalBullet1","predict.trade.kycModalBullet2","predict.trade.kycModalBullet3"].map(o=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 text-[13px] text-zinc-300",children:[jsxRuntime.jsx("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:"text-[#c7ff2e] shrink-0",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})}),jsxRuntime.jsx("span",{children:n(o)})]},o))}),r&&jsxRuntime.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[13px] text-[#c7ff2e]/70 hover:text-[#c7ff2e] transition-colors mb-3",children:[n("predict.trade.goToKYC")," \u2192"]}),jsxRuntime.jsx("p",{className:"text-[11px] text-zinc-500 mb-5",children:n("predict.trade.kycModalNote")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:n("common.ok")})]})]})})})}var Gd=["5m","1h","12h","24h","eod","custom"],qd={"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"},Yd=["minutes","hours","days"],Qd={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},Xd={maximumFractionDigits:0},lr="-";function ks({event:e,market:t,variant:r="bordered",outcome:n,orderType:o,quantity:i,limitPrice:a,shares:s,effectivePrice:c,potentialProfit:u,potentialPayout:m,estimatedCost:l,estimatedFee:f=0,usdcBalance:d,isBalanceLoading:p,isMarketDataLoading:h,isSubmitting:g,authStatus:v,isValid:x,validationErrors:k,isInsufficientBalance:S,onInsufficientBalance:b,supportsLimitOrder:y,maxBuyAmount:M,kycRequired:A,needsKyc:P,needsSetup:C,kycUrl:I,expirationEnabled:B,expirationPreset:Y,customDuration:z,customDurationUnit:Q,oddsFormatter:q,outcomeLabels:te,onOutcomeChange:N,onOrderTypeChange:E,onQuantityChange:H,onLimitPriceChange:J,onExpirationEnabledChange:de,onExpirationPresetChange:se,onCustomDurationChange:Ve,onCustomDurationUnitChange:je,onSubmit:Ge}){let{t:w}=i18n.useTranslation(),[ft,qe]=react.useState(true),Le=ui$1.useDisclosure(),[Nt,Re]=react.useState(""),Ye=react.useRef(false);react.useEffect(()=>{Ye.current||Re(isNaN(i)?"":String(i));},[i]);let[ot,_e]=react.useState(""),et=react.useRef(false);react.useEffect(()=>{et.current||(isNaN(a)?_e(""):_e(String(parseFloat((a*100).toFixed(2)))));},[a]);let Ie=react.useCallback(D=>{if(D!==""&&!/^\d*\.?\d{0,2}$/.test(D))return;if(_e(D),D===""||D==="."){J(NaN);return}let vt=parseFloat(D);isNaN(vt)||J(vt/100);},[J]),it=react.useCallback(D=>{if(D!==""&&!/^\d*\.?\d{0,2}$/.test(D))return;if(Re(D),Ue(false),D===""||D==="."){H(NaN);return}let vt=parseFloat(D);isNaN(vt)||H(vt);},[H]);react.useEffect(()=>{A&&!Le.isOpen&&Le.onOpen();},[A]);let Ot=react.useMemo(()=>{let D=n==="yes"?t.yesAsk:t.noAsk;return D!=null?parseFloat((Number(D)*100).toFixed(2)):null},[n,t]),Ct=n==="yes"?t.yesAsk:t.noAsk,Mt=Ct!=null&&q?q(Number(Ct)):Ot!=null?`${Ot} \xA2`:lr,tt=Number.isFinite(c)?parseFloat((c*100).toFixed(2)):null,gt=Number.isFinite(c)&&q?q(c):tt!=null?`${tt} \xA2`:lr,We=!isNaN(i)&&i>0,qt=We?l+f:0,Oe=We&&s>0?qt/s:0,Qe=Oe>0&&q?q(Oe):Oe>0?`${parseFloat((Oe*100).toFixed(2))}\xA2`:lr,me=v==="authenticated",st=v==="authenticating"||v==="deauthenticating",ht=me&&(P||C),ve=react.useCallback(D=>te?.[D]??w(D==="yes"?"predict.trade.yes":"predict.trade.no"),[te,w]),Xe=react.useMemo(()=>{if(st)return w("predict.trade.checkingLogin");if(!me)return w("predict.trade.loginToTrade");if(P)return w("predict.trade.kycRequired");if(C)return w("predict.trade.setupRequired");if(p)return w("predict.trade.loadingBalance");if(h)return w("predict.trade.loadingMarketData");if(g)return w("predict.trade.submitting");if(A)return w("predict.trade.kycRequired");if(!We)return w("predict.trade.enterAmount");let D=ve(n),Ce=u>0?` \u2192 Win $${u.toFixed(2)}`:"";return `${w("predict.trade.buy")} ${D}${Ce}`},[st,me,P,C,p,h,g,A,We,n,ve,u,w]),we="primary",Tt=()=>{let D=M??be(d??0,2);H(be(D/2,2));},R=()=>{H(M??be(d??0,2));},[Ne,Ue]=react.useState(false),Zr=()=>{if(!me){Ue(false),Ge();return}if(P){Le.onOpen();return}if(C&&b){Ue(false),b();return}if(A){Le.onOpen();return}if(S&&b){Ue(false),b();return}if(!x){Ue(true);return}Ue(false),Ge();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter:D=>{r==="bordered"&&(D.currentTarget.style.borderColor="rgba(63,63,70,0.8)");},onMouseLeave:D=>{r==="bordered"&&(D.currentTarget.style.borderColor="rgba(39,39,42,0.6)");},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:"text-bullish",children:[w("predict.trade.buy")," ",ve(n)]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[y?jsxRuntime.jsxs(ui$1.Tabs,{variant:"underlined",selectedKey:o,onSelectionChange:D=>E(D),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui$1.Tab,{title:w("predict.trade.market")},"market"),jsxRuntime.jsx(ui$1.Tab,{title:w("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:w("predict.trade.market")}),o==="limit"&&y?jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:ot,onChange:D=>Ie(D.target.value),onFocus:()=>{et.current=true;},onBlur:()=>{et.current=false,isNaN(a)?_e(""):_e(String(parseFloat((a*100).toFixed(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"}}):Mt!=null&&jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums",children:Mt})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(D=>{let Ce=D==="yes"?t.yesAsk:t.noAsk;return jsxRuntime.jsx("div",{className:"flex flex-1 flex-col gap-y-1",children:jsxRuntime.jsxs("button",{type:"button",onClick:()=>N(D),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${n===D?"border-bullish bg-bullish/10 text-bullish":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:ve(D)}),Ce!=null&&jsxRuntime.jsx("span",{className:"ml-1 opacity-70",children:q?q(Number(Ce)):`${parseFloat((Number(Ce)*100).toFixed(2))}\xA2`})]})},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:w("predict.trade.youArePaying")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:Tt,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:w("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:R,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:w("predict.trade.max")})]})]}),jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:Nt,onChange:D=>it(D.target.value),onFocus:()=>{Ye.current=true;},onBlur:()=>{Ye.current=false,Re(isNaN(i)?"":String(i));},startContent:jsxRuntime.jsx("span",{className:"text-default-600 text-xl",children:"$"}),classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),Ne&&k.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:k.map(D=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:D},D))})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-x-1.5 text-sm",children:[jsxRuntime.jsx("span",{className:"text-neutral-500",children:w("predict.trade.balance")}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:d!=null?`$${be(d,2).toFixed(2)}`:"$0"})]}),o==="limit"&&y&&jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-2",children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium text-primary",children:w("predict.trade.setExpiration")}),jsxRuntime.jsx(ui$1.StyledSwitch,{size:"sm",color:"primary",isSelected:B,onValueChange:de,"aria-label":w("predict.trade.setExpiration")})]}),B&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui$1.Select,{"aria-label":w("predict.trade.setExpiration"),selectedKeys:[Y],onSelectionChange:D=>{let Ce=Array.from(D)[0];Ce&&se(Ce);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Gd.map(D=>jsxRuntime.jsx(ui$1.SelectItem,{children:w(qd[D])},D))}),Y==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui$1.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(z)?void 0:z,onValueChange:Ve,minValue:1,step:1,formatOptions:Xd,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$1.Select,{"aria-label":"Duration unit",selectedKeys:[Q],onSelectionChange:D=>{let Ce=Array.from(D)[0];Ce&&je(Ce);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Yd.map(D=>jsxRuntime.jsx(ui$1.SelectItem,{children:w(Qd[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:()=>qe(D=>!D),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:w("predict.trade.odds")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-3.5 w-3.5 transition-transform",ft&&"rotate-180")})]}),jsxRuntime.jsx("span",{className:"text-foreground font-medium tabular-nums",children:q&&Number.isFinite(c)?gt:tt!=null?w("predict.trade.chance",{percent:tt}):lr})]}),ft&&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:w("predict.trade.totalSize")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${l.toFixed(2)}`:lr})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.numContracts")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(s)&&s>0?kr(s):lr})]}),f>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.estFee")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:`$${f.toFixed(2)}`})]}),f>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.totalPayment")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:`$${qt.toFixed(2)}`})]}),f>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.effectiveOdds")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:Qe})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.payout")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${m.toFixed(2)}`:lr})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.estProfit")}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(i)&&i>0&&u>0?`+$${u.toFixed(2)}`:lr})]})]})]}),jsxRuntime.jsx(ui$1.Button,{color:we,fullWidth:true,radius:"lg",size:"lg",isDisabled:st||me&&!ht&&(p||h||!We||g),isLoading:st||me&&!ht&&(g||p||h),spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),onPress:Zr,children:Xe})]}),jsxRuntime.jsx(jn,{isOpen:Le.isOpen,onClose:Le.onClose,kycUrl:I})]})}function qn({event:e,market:t,variant:r,initialOutcome:n,chain:o,slippageBps:i,onInsufficientBalance:a,onOutcomeChange:s,oddsFormatter:c,outcomeLabels:u}){let{outcome:m,orderType:l,quantity:f,limitPrice:d,shares:p,effectivePrice:h,estimatedCost:g,estimatedFee:v,potentialPayout:x,potentialProfit:k,pricePerShare:S,usdcBalance:b,maxBuyAmount:y,isBalanceLoading:M,isMarketDataLoading:A,isSubmitting:P,authStatus:C,validation:I,isInsufficientBalance:B,supportsLimitOrder:Y,kycRequired:z,needsKyc:Q,needsSetup:q,kycUrl:te,expirationEnabled:N,expirationPreset:E,customDuration:H,customDurationUnit:J,setOutcome:de,setOrderType:se,setQuantity:Ve,setLimitPrice:je,setExpirationEnabled:Ge,setExpirationPreset:w,setCustomDuration:ft,setCustomDurationUnit:qe,submit:Le,notifyInsufficientBalance:Nt}=ms({market:t,initialOutcome:n,slippageBps:i,onInsufficientBalance:a}),Re=walletConnector.useAuthCallback(Le),Ye=react.useCallback(et=>{de(et),s?.(et);},[de,s]),ot=react.useMemo(()=>e?An(e):void 0,[e]),_e=react.useMemo(()=>Fn(t,{yesAsk:m==="yes"?S:void 0,noAsk:m==="no"?S:void 0}),[t,m,S]);return jsxRuntime.jsx(ks,{event:ot,market:_e,variant:r,outcome:m,orderType:l,quantity:f,limitPrice:d,shares:p,effectivePrice:h,estimatedCost:g,estimatedFee:v,potentialPayout:x,potentialProfit:k,usdcBalance:b,maxBuyAmount:y,isBalanceLoading:M,isMarketDataLoading:A,isSubmitting:P,authStatus:C,isValid:I.isValid,validationErrors:I.errors,isInsufficientBalance:B,onInsufficientBalance:a?Nt:void 0,supportsLimitOrder:Y,kycRequired:z,needsKyc:Q,needsSetup:q,kycUrl:te,expirationEnabled:N,expirationPreset:E,customDuration:H,customDurationUnit:J,oddsFormatter:c,outcomeLabels:u,onOutcomeChange:Ye,onOrderTypeChange:se,onQuantityChange:Ve,onLimitPriceChange:je,onExpirationEnabledChange:Ge,onExpirationPresetChange:w,onCustomDurationChange:ft,onCustomDurationUnitChange:qe,onSubmit:Re})}var ln="predict-trade";function Yn({id:e=ln}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(su,{...t})})}function su({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui$1.useScreen();return e?jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{className:o?"":"p-2",children:[jsxRuntime.jsx(qn,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,chain:e.chain,slippageBps:e.slippageBps,variant:"flat",onInsufficientBalance:e.onInsufficientBalance}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:n("common.cancel")})})]})})}):null}var cn={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function qo(e,t=true){let r=0;return t&&e.source&&r++,e.timeRemaining&&r++,e.minVolume&&r++,e.minLiquidity&&r++,r}function Ps({isOpen:e,onClose:t,value:r,onChange:n,enableKalshi:o=true}){let{t:i}=i18n.useTranslation(),[a,s]=react.useState(r),c=react.useMemo(()=>o?cn:{...cn,source:"polymarket"},[o]),u=react.useCallback(x=>{x?s(r):t();},[r,t]),m=react.useCallback(()=>{s(c);},[c]),l=react.useCallback(()=>{n(a),t();},[a,n,t]),f=react.useCallback((x,k)=>{s(S=>({...S,[x]:k}));},[]),d=react.useMemo(()=>qo(a,o),[a,o]),p=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"polymarket",label:i("predict.platform.polymarket")},{value:"kalshi",label:i("predict.platform.kalshi")}],[i]),h=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1d",label:i("predict.filter.lessThanDay")},{value:"7d",label:i("predict.filter.lessThanWeek")},{value:"30d",label:i("predict.filter.lessThanMonth")}],[i]),g=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[i]),v=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[i]);return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:e,onOpenChange:u,size:"md",backdrop:"opaque",scrollBehavior:"inside",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.filter.title")}),jsxRuntime.jsx(pu,{onClick:()=>u(false)})]}),jsxRuntime.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:20},children:[o&&jsxRuntime.jsx(Xn,{label:i("predict.filter.platform"),children:jsxRuntime.jsx(Jn,{options:p,selected:a.source,onSelect:x=>f("source",x)})}),jsxRuntime.jsx(Xn,{label:i("predict.filter.timeRemaining"),children:jsxRuntime.jsx(Jn,{options:h,selected:a.timeRemaining,onSelect:x=>f("timeRemaining",x)})}),jsxRuntime.jsx(Xn,{label:i("predict.filter.minVolume"),children:jsxRuntime.jsx(Jn,{options:g,selected:a.minVolume,onSelect:x=>f("minVolume",x)})}),jsxRuntime.jsx(Xn,{label:i("predict.filter.minLiquidity"),children:jsxRuntime.jsx(Jn,{options:v,selected:a.minLiquidity,onSelect:x=>f("minLiquidity",x)})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 px-5 py-4",style:{borderTop:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("button",{type:"button",className:"inline-flex items-center justify-center py-2.5 px-5 rounded-[10px] text-zinc-400 text-sm font-medium hover:text-white transition-colors cursor-pointer",onClick:m,children:i("predict.filter.reset")}),jsxRuntime.jsxs("button",{type:"button",className:"flex-1 inline-flex items-center justify-center gap-2 py-2.5 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer",onClick:l,children:[i("predict.filter.showResults"),d>0&&jsxRuntime.jsxs("span",{style:{opacity:.7},children:["(",d,")"]})]})]})]})})})}function Xn({label:e,children:t}){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:"#71717a",textTransform:"uppercase",letterSpacing:"0.05em"},children:e}),t]})}function pu({onClick:e}){return jsxRuntime.jsx("button",{type:"button",onClick:e,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}function Jn({options:e,selected:t,onSelect:r,allowDeselect:n=true}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:e.map(o=>{let i=t===o.value;return jsxRuntime.jsx("button",{type:"button",onClick:()=>{r(i&&n?void 0:o.value);},style:{flexShrink:0,borderRadius:10,padding:"6px 14px",fontSize:13,fontWeight:500,cursor:"pointer",transition:"all 0.15s",border:i?"1px solid rgba(199,255,46,0.3)":"1px solid rgba(63,63,70,0.5)",background:i?"rgba(199,255,46,0.08)":"rgba(39,39,42,0.4)",color:i?"#c7ff2e":"#a1a1aa"},onMouseEnter:a=>{i||(a.currentTarget.style.background="rgba(39,39,42,0.8)",a.currentTarget.style.color="#fff");},onMouseLeave:a=>{i||(a.currentTarget.style.background="rgba(39,39,42,0.4)",a.currentTarget.style.color="#a1a1aa");},children:o.label},o.value??"__all")})})}var Ts={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},Ns={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},ku=["start_time","volume","liquidity","ending_soon"],Cs={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"},Su={position:"absolute",left: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 Es({sortPreset:e,onSortChange:t,sortAsc:r,onSortAscChange:n,onFilterPress:o,filterCount:i=0,className:a}){let{t:s}=i18n.useTranslation(),[c,u]=react.useState(false),m=react.useRef(null),l=react.useCallback(d=>{m.current&&!m.current.contains(d.target)&&u(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",l),()=>document.removeEventListener("mousedown",l)),[l]),react.useEffect(()=>{if(!c)return;let d=p=>{p.key==="Escape"&&u(false);};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[c]);let f=Ms[e];return jsxRuntime.jsxs("div",{className:a,style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:m,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",style:Cs,onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>u(d=>!d),children:[jsxRuntime.jsx(Pu,{}),jsxRuntime.jsx(f,{className:"size-4 shrink-0",style:{color:"#a1a1aa"}}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:s(Ns[e])}),jsxRuntime.jsx(Nu,{open:c})]}),c&&jsxRuntime.jsx("div",{style:{...Su,width:224,padding:4},children:ku.map(d=>{let p=Ms[d],h=e===d;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",gap:12,padding:"10px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",transition:"all 0.15s",background:h?"rgba(199,255,46,0.08)":"transparent",color:h?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:g=>{h||(g.currentTarget.style.background="rgba(39,39,42,0.5)",g.currentTarget.style.color="#fff");},onMouseLeave:g=>{h||(g.currentTarget.style.background="transparent",g.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===d?n(!r):t(d),u(false);},children:[jsxRuntime.jsx(p,{className:"size-4 shrink-0",style:{color:h?"#c7ff2e":"#71717a"}}),jsxRuntime.jsx("span",{style:{flex:1,fontWeight:500},children:s(Ns[d])}),h&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},d)})})]}),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",fontSize:14},onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)",d.currentTarget.style.color="#fff";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)",d.currentTarget.style.color="#a1a1aa";},onClick:()=>n(!r),children:r?"\u2191":"\u2193"}),jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",style:Cs,onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:o,children:[jsxRuntime.jsx(wu,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:s("predict.filter.title")})]}),i>0&&jsxRuntime.jsx("span",{style:{position:"absolute",top:-4,right:-4,minWidth:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:8,background:"#c7ff2e",color:"#000",fontSize:10,fontWeight:600,padding:"0 4px"},children:i})]})]})}var Ms={start_time:ui$1.CalendarIcon,volume:ui$1.ChartLineIcon,liquidity:ui$1.DropletIcon,ending_soon:ui$1.TimerIcon};function Pu(){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 wu(){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 Nu({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 _s(e={}){let{i18n:t}=i18n.useTranslation(),r=e.lang??t.resolvedLanguage??t.language,n=react.useMemo(()=>reactPredict.resolveEventsParams({...e,lang:r}),[r,e.tagSlugSelection,e.limit,e.status,e.sort_by,e.sort_asc,e.source,e.with_markets,e.minVolume,e.minLiquidity,e.timeRemaining,e.markets_limit,e.lang]),{data:o,isLoading:i,isFetching:a,isFetchingNextPage:s,isError:c,error:u,hasNextPage:m,fetchNextPage:l,refetch:f}=reactPredict.useInfiniteEvents(n),d=react.useMemo(()=>o?.pages.flatMap(g=>g.items).filter(g=>g!=null)??[],[o]),p=react.useCallback(()=>{l();},[l]),h=react.useCallback(()=>{f();},[f]);return {data:d,isLoading:i,isFetching:a&&!s,isFetchingMore:s,isError:c,error:u??null,hasMore:m??false,fetchMore:p,refetch:h}}var Is=`
1
+ 'use strict';var react=require('react'),ui$1=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'),reactPredict=require('@liberfi.io/react-predict'),types=require('@liberfi.io/types'),utils$1=require('@liberfi.io/utils'),ii=require('canvas-confetti'),reactQuery=require('@tanstack/react-query'),reactWindow=require('react-window'),reactWindowInfiniteLoader=require('react-window-infinite-loader'),hooks=require('@liberfi.io/hooks'),recharts=require('recharts'),jotai=require('jotai'),utils=require('jotai/utils');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var ii__default=/*#__PURE__*/_interopDefault(ii);var ed={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},ds=["Politics","Sports","Crypto","Economics","Financials","Elections","Entertainment","Companies","Science and Technology","Climate and Weather","Mentions","Social","World"],Zo=(()=>{let e=t=>{let r=ds.indexOf(t);return r===-1?ds.length:r};return Object.entries(ed).map(([t,r])=>({slug:t,label:t,tags:(r??[]).map(n=>({slug:n,label:n}))})).sort((t,r)=>e(t.slug)-e(r.slug))})();function ms({categories:e,selectedCategory:t,selectedTag:r,activeTags:n,onCategorySelect:o,onTagSelect:i,trailing:s,pulsingTab:a="Trending",className:l}){let{t:u}=i18n.useTranslation(),p=react.useCallback(()=>{o(null);},[o]),c=u("predict.categories.trending");return jsxRuntime.jsxs("div",{className:ui$1.cn("sticky top-0 z-30 flex w-full flex-col justify-between gap-2 px-4 py-2.5 lg:px-4 lg:py-2",l),children:[jsxRuntime.jsx("style",{children:".cat-primary-row{display:flex;width:100%;flex-direction:column;gap:8px}@media(min-width:1024px){.cat-primary-row{flex-direction:row;align-items:center}}.cat-primary-row>.cat-tabs{min-width:0;overflow-x:auto;overflow-y:hidden;-ms-overflow-style:none;scrollbar-width:none}.cat-primary-row>.cat-tabs::-webkit-scrollbar{display:none}@media(min-width:1024px){.cat-primary-row>.cat-tabs{flex:1 1 0%}}"}),jsxRuntime.jsxs("div",{className:"cat-primary-row",children:[jsxRuntime.jsx("div",{className:"cat-tabs hideScrollbar",children:jsxRuntime.jsxs("div",{className:"flex min-h-9 items-stretch gap-x-3 lg:min-h-10",children:[jsxRuntime.jsx(us,{label:c,isSelected:t===null,onPress:p,showPulse:c===a}),jsxRuntime.jsx(od,{}),e.map(g=>{let d=g.slug??g.category,m=g.label??g.category;return jsxRuntime.jsx(us,{label:m,isSelected:t===d,onPress:()=>o(d),badge:g.badge,showPulse:d===a||m===a},d)})]})}),s&&jsxRuntime.jsx("div",{className:"flex-shrink-0",children:s})]}),t&&n.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.5 pl-1 lg:w-full lg:gap-x-2",children:[jsxRuntime.jsx(ps,{label:u("predict.categories.allMarkets"),isSelected:r===null,onPress:()=>i(null)}),n.map(g=>{let d=g.slug??g.label;return jsxRuntime.jsx(ps,{label:g.label,icon:g.icon,isSelected:r===d,onPress:()=>i(d)},d)})]})})]})}function us({label:e,isSelected:t,onPress:r,badge:n,showPulse:o}){return jsxRuntime.jsxs("button",{type:"button",onClick:r,className:ui$1.cn("relative shrink-0 cursor-pointer whitespace-nowrap border-b px-2.5 py-1.5 text-sm font-medium capitalize transition-colors",t?"border-primary/50 text-primary":"border-transparent text-neutral-500 hover:text-neutral-300"),children:[o?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,n&&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:n})]})}function od(){return jsxRuntime.jsx("span",{className:"flex items-center text-neutral-600","aria-hidden":"true",children:"|"})}function ps({label:e,icon:t,isSelected:r,onPress:n}){return jsxRuntime.jsxs("button",{type:"button",onClick:n,className:ui$1.cn("flex shrink-0 items-center justify-center gap-x-1 min-w-14 rounded-2xl border px-3 py-1.5 text-sm font-medium uppercase transition-colors cursor-pointer",r?"border-primary/40 bg-primary/15 text-primary":"border-border/80 text-neutral-500 hover:bg-primary/10 hover:text-primary"),children:[t&&jsxRuntime.jsx("span",{className:ui$1.cn("iconify size-4",t)}),e]})}function Db({count:e=6}){return jsxRuntime.jsx("div",{className:"flex w-full flex-col gap-2 px-4 py-2.5 lg:px-4 lg:py-2",children:jsxRuntime.jsx("div",{className:"flex min-h-9 items-center gap-x-3 lg:min-h-10",children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-6 w-16 shrink-0 rounded"},r))})})}function gs(e){return e.trim().toLowerCase().replace(/&/g,"and").replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function sd(e){return `predict.categories.category.${gs(e)}`}function hs(e){return `predict.categories.tag.${gs(e)}`}function ad(e,t){return e.map(r=>({category:r.slug,slug:r.slug,label:t(sd(r.slug),r.label),tags:r.tags.map(n=>({slug:n.slug,label:t(hs(n.slug),n.label),icon:n.icon}))}))}function ld(e,t){return e?e.tags.map(r=>({slug:r.slug,label:t(hs(r.slug),r.label),icon:r.icon})):[]}function vs({onSelect:e,trailing:t,className:r}){let{t:n}=i18n.useTranslation(),o=react.useCallback((m,h)=>{let f=n(m);return typeof f=="string"&&f!==m?f:h},[n]),[i,s]=react.useState(null),[a,l]=react.useState(null),u=react.useCallback(m=>{s(m),l(null),e?.({categorySlug:m,tagSlug:null});},[e]),p=react.useCallback(m=>{l(m),e?.({categorySlug:i,tagSlug:m});},[i,e]),c=ad(Zo,o),g=Zo.find(m=>m.slug===i),d=ld(g,o);return jsxRuntime.jsx(ms,{categories:c,selectedCategory:i,selectedTag:a,activeTags:d,onCategorySelect:u,onTagSelect:p,trailing:t,className:r})}function $n(e,t){return e?.trim()||t}function zr(e){return $n(e.title_trans,e.title)??e.title}function ti(e){return $n(e.question_trans,e.question)??e.question}function ri(e){return $n(e.description_trans,e.description)}function Kn(e){return $n(e.label_trans,e.label)??e.label}function lr(e){let t=e.outcomes?.[0];return t?Kn(t):ti(e)}function Vn(e){return {title:zr(e),imageUrl:e.image_url}}function jn(e,t){let r=e.outcomes[0],n=e.outcomes[1];return {question:ti(e),yesAsk:t?.yesAsk??r?.best_ask??r?.price,noAsk:t?.noAsk??n?.best_ask??n?.price,yesBid:t?.yesBid??r?.best_bid,noBid:t?.noBid??n?.best_bid,yesSubTitle:r?Kn(r):lr(e),noSubTitle:n?Kn(n):"No"}}var un=24,ni=4,dn={ONE_MINUTE:1,ONE_HOUR:60,ONE_DAY:1440},$={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_MONTH:"1m",ALL:"all"},Gn=$.ALL,Gb={[$.ONE_HOUR]:dn.ONE_MINUTE,[$.SIX_HOURS]:dn.ONE_MINUTE,[$.ONE_DAY]:dn.ONE_MINUTE,[$.ONE_MONTH]:dn.ONE_MINUTE,[$.ALL]:dn.ONE_MINUTE},qb={[$.ONE_HOUR]:60,[$.SIX_HOURS]:60,[$.ONE_DAY]:300,[$.ONE_MONTH]:900,[$.ALL]:900},bs={[$.ONE_HOUR]:3600,[$.SIX_HOURS]:360*60,[$.ONE_DAY]:1440*60,[$.ONE_MONTH]:720*60*60,[$.ALL]:null},Yb={[$.ONE_HOUR]:1,[$.SIX_HOURS]:1,[$.ONE_DAY]:5,[$.ONE_MONTH]:15,[$.ALL]:15},qn=1,Yn=1,Qb=1,Xb=1,Jb=99,Wr={ONE_HOUR:"1h",SIX_HOURS:"6h",ONE_DAY:"1d",ONE_WEEK:"1w",MAX:"max"},Zb=Wr.ONE_WEEK,ex={[Wr.ONE_HOUR]:60,[Wr.SIX_HOURS]:60,[Wr.ONE_DAY]:300,[Wr.ONE_WEEK]:1800,[Wr.MAX]:1800};var ks=react.createContext(null);function yr(){let e=react.useContext(ks);if(!e)throw new Error("usePredictWallet must be used within a PredictWalletProvider");return e}var gd=1e4;function hd({pollingInterval:e=gd,enabled:t=true,enableKalshi:r=true,children:n}){let o=walletConnector.useWallets(),i=react.useMemo(()=>o.find(C=>C.chainNamespace===types.ChainNamespace.SOLANA&&C.isConnected)?.address,[o]),s=react.useMemo(()=>o.find(C=>C.chainNamespace===types.ChainNamespace.EVM&&C.isConnected)?.address,[o]),{data:a,isLoading:l,isFetching:u,error:p}=reactPredict.useBalance({source:"kalshi",user:i??""},{enabled:t&&r&&!!i,refetchInterval:e}),{data:c,isLoading:g}=reactPredict.useDFlowKYC(i,{enabled:t&&r&&!!i,refetchInterval:3e4}),{data:d,isLoading:m}=reactPredict.usePolymarketSetup(s,{enabled:t&&!!s,refetchInterval:3e4}),h=d?.safe_address,v=d?.verified??false,f=d?.wallet_kind??"deposit",y=d?.deposit_wallet_address,x=f==="safe"?d?.safe_address:y,k=f==="safe"?d?.safe_deployed??false:d?.deposit_wallet_deployed??false,{data:b,isLoading:S,isFetching:M,error:B}=reactPredict.useBalance({source:"polymarket",user:s??""},{enabled:t&&v&&!!s,refetchInterval:e}),N=react.useMemo(()=>({enableKalshi:r,solanaAddress:i,evmAddress:s,polymarketWalletKind:f,polymarketWalletAddress:x,polymarketDepositWalletAddress:y,polymarketWalletDeployed:k,polymarketSafeAddress:h,kalshiUsdcBalance:a?Number(a.balance):null,polymarketUsdcBalance:v&&b?Number(b.balance):null,kalshiKycVerified:c?.verified??false,kalshiKycUrl:c?.kyc_url??null,kalshiKycLoading:g,polymarketSetupVerified:v,polymarketSafeDeployed:d?.safe_deployed??false,polymarketTokenApproved:d?.token_approved??false,polymarketSetupLoading:m,isLoading:l||S,isFetching:u||M,error:p??B??null}),[r,i,s,f,x,y,k,h,a,b,v,c,g,d,m,l,S,u,M,p,B]);return jsxRuntime.jsx(ks.Provider,{value:N,children:n})}var bd={minutes:60,hours:3600,days:86400};function Qn(e,t,r){let n=Math.floor(Date.now()/1e3);switch(e){case "5m":return n+300;case "1h":return n+3600;case "12h":return n+720*60;case "24h":return n+1440*60;case "eod":{let o=new Date;return o.setUTCHours(23,59,59,0),Math.floor(o.getTime()/1e3)}case "custom":return n+t*bd[r]}}function Xn(e,t){let r=parseFloat(t);return !r||r<=0?e:Math.round(e/r)*r}function ke(e,t){let r=Math.pow(10,t);return Math.floor(e*r)/r}function xd(e){let t=e;return !Number.isFinite(t)||t<=0||t>=1?1:1-t}var yd=100,kd=300;function si(e,t){return yd/1e4+Math.max(0,e)/1e4*xd(t)}function Sd(e,t){let r=e?.[t],n=typeof r=="number"?r:Number(r);return Number.isFinite(n)?n:void 0}function Pd(e,t){let r=e?.[t];return typeof r=="string"?r:void 0}function Ss(e){let t=Sd(e,"polymarket.effectiveTakerFeeBps");if(t!==void 0&&t>=0)return t;let r=e?.["polymarket.feeDescriptor"],n=typeof r?.r=="number"?r.r:Number(r?.r);return Number.isFinite(n)&&n>=0?n*1e4:Pd(e,"polymarket.sportsMarketType")?kd:0}function Ps({source:e,usdcBalance:t,safetyBufferUsd:r=.01,feeRateBps:n=0,pricePerShare:o}){if(t==null||!Number.isFinite(t))return 0;let i=ke(Math.max(0,t),2);if(e!=="polymarket")return i;let s=si(n,o??NaN),a=i/(1+s)-r;return ke(Math.max(0,a),2)}function ws({usdcAmount:e,pricePerShare:t,feeRateBps:r}){if(!Number.isFinite(e)||e<=0)return 0;let n=si(r,t);return e*n}function Ns({grossReturn:e,pricePerShare:t,feeRateBps:r}){if(!Number.isFinite(e)||e<=0)return 0;let n=si(r,t);return e*n}function Jn(e,t,r){let n=e.match(/Size\s*\(([\d.]+)\)\s*lower than the minimum:\s*([\d.]+)/i);if(n)return t("predict.trade.polymarket.minOrderSize",{current:n[1],min:n[2]});let o=e.match(/balance:\s*(\d+),\s*sum of active orders:\s*(\d+)/i);if(o){let s=parseInt(o[1],10)/1e6,a=parseInt(o[2],10)/1e6,l=Math.max(0,s-a);return t("predict.trade.polymarket.insufficientBalance",{total:ke(s,2).toFixed(2),active:ke(a,2).toFixed(2),available:ke(l,2).toFixed(2)})}return /not enough balance/i.test(e)?t(r==="sell"?"predict.trade.insufficientShares":"predict.trade.insufficientBalance"):/max accuracy of/i.test(e)?t("predict.trade.polymarket.decimalAccuracy"):/tick size/i.test(e)?t("predict.trade.polymarket.tickSizeError"):/couldn.*fully filled|FOK.*filled or killed/i.test(e)?t("predict.trade.polymarket.fokNotFilled"):e.replace(/order\s+0x[a-f0-9]+\s+is invalid\.\s*/i,"")||e}function kr(e,t=2){return parseFloat(ke(e,t).toFixed(t)).toString()}function Ms(){let e={startVelocity:30,spread:360,ticks:60,zIndex:9999};ii__default.default({...e,particleCount:80,origin:{x:.5,y:.4}}),setTimeout(()=>{ii__default.default({...e,particleCount:40,origin:{x:.3,y:.6}});},150),setTimeout(()=>{ii__default.default({...e,particleCount:40,origin:{x:.7,y:.6}});},300);}var Cs={en:{submitted:"Your trade was submitted successfully. Confirming the result.",completed:"Trade completed",delayed:"Your trade was submitted successfully. Confirmation is taking a little longer."},zh:{submitted:"\u60A8\u7684\u4EA4\u6613\u5DF2\u6210\u529F\u63D0\u4EA4\uFF0C\u6B63\u5728\u786E\u8BA4\u4EA4\u6613\u7ED3\u679C",completed:"\u4EA4\u6613\u5DF2\u5B8C\u6210",delayed:"\u60A8\u7684\u4EA4\u6613\u5DF2\u6210\u529F\u63D0\u4EA4\uFF0C\u786E\u8BA4\u65F6\u95F4\u6BD4\u9884\u671F\u7A0D\u957F"}};function wd(e){return (e?.resolvedLanguage??e?.language??"").toLowerCase().startsWith("zh")}function ai(e,t,r){let n=e(t);return n&&n!==t?n:r}function Ur(e,t){let r=wd(t)?Cs.zh:Cs.en;return {submitted:ai(e,"predict.trade.resultSubmitted",r.submitted),completed:ai(e,"predict.trade.resultCompleted",r.completed),delayed:ai(e,"predict.trade.resultDelayed",r.delayed)}}function Ed({deadlineAt:e}){let[t,r]=react.useState(()=>Math.max(0,e-Date.now()));return react.useEffect(()=>{let n=setInterval(()=>{r(Math.max(0,e-Date.now()));},1e3);return ()=>clearInterval(n)},[e]),`${Math.max(0,Math.ceil(t/1e3))}s`}function $r({id:e=`predict-trade-result-${Date.now()}`,durationMs:t=3e4,celebrateOnCompleted:r=false,messages:n}){return {id:e,submitted:()=>{let o=Date.now()+t;ui$1.toast.progress({id:e,message:n.submitted,duration:t,progress:true,action:react.createElement(Ed,{deadlineAt:o})});},completed:()=>{ui$1.toast.update(e,{type:"success",message:n.completed,duration:5e3}),r&&Ms();},delayed:()=>{ui$1.toast.update(e,{type:"blank",message:n.delayed,duration:8e3});},failed:o=>{ui$1.toast.update(e,{type:"error",message:o,duration:8e3});}}}function Rs({market:e,initialOutcome:t="yes",slippageBps:r=100,onInsufficientBalance:n}){let{t:o,i18n:i}=i18n.useTranslation(),{status:s}=walletConnector.useAuth(),a=walletConnector.useWallets(),l=reactPredict.usePredictClient(),u=react.useContext(reactPredict.PolymarketContext),{start:p}=reactPredict.useTradeResultConfirmation(),c=e.source,g=c==="polymarket",d=a.find(O=>O.chainNamespace===types.ChainNamespace.SOLANA&&O.isConnected),m=a.find(O=>O.chainNamespace===types.ChainNamespace.EVM&&O.isConnected&&"switchChain"in O),h=s==="authenticated",v=d?.address,f=m?.address,[y,x]=react.useState(t),[k,b]=react.useState("market"),[S,M]=react.useState(NaN),[B,N]=react.useState(NaN),[C,I]=react.useState(false),[D,j]=react.useState(null),[L,U]=react.useState(false),[H,ee]=react.useState(false),[re,ue]=react.useState("1h"),[ce,Ae]=react.useState(30),[Xe,Fe]=react.useState("minutes"),ot=react.useMemo(()=>Ur(o,i),[i,o]),$e=true,Be=react.useCallback(async(O,Oe)=>{let Me=$r({celebrateOnCompleted:true,messages:ot});Me.submitted(),await p({source:c,user:c==="kalshi"?v:f,kalshiUser:$e?v:void 0,polymarketUser:f,marketSlug:e.slug,eventSlug:e.event_slug,expectation:O,getOrdersHeaders:Oe})==="confirmed"?Me.completed():Me.delayed();},[p,$e,f,e.event_slug,e.slug,c,ot,v]),P=react.useMemo(()=>{if(c!=="polymarket")return;let O=e.provider_meta?.["polymarket.clobTokenIds"];return O?(typeof O=="string"?JSON.parse(O):O)[y==="yes"?0:1]:void 0},[c,e.provider_meta,y]),{data:Je,isLoading:Te}=reactPredict.useTickSize(P),Ne=reactPredict.normalizePolymarketTickSize(Je?.minimum_tick_size),{data:lt,isLoading:Se}=reactPredict.useFeeRate(P),w=lt?.base_fee??0,T=String(w),W=react.useMemo(()=>Ss(e.provider_meta),[e.provider_meta]),{data:J}=reactPredict.useRebateConfig(),ne=J?.builder_enabled&&J.builder_code?J.builder_code:void 0,me=null,ct=false,Tt=null,Rt=false,it,xt,qe;try{let O=yr();$e=O.enableKalshi,me={kalshiUsdcBalance:O.kalshiUsdcBalance,polymarketUsdcBalance:O.polymarketUsdcBalance,isLoading:O.isLoading},ct=O.kalshiKycVerified,Tt=O.kalshiKycUrl,Rt=O.polymarketSetupVerified,it=O.polymarketSafeAddress,xt=O.polymarketWalletKind,qe=O.polymarketWalletAddress;}catch{}let qt=c==="kalshi"&&!ct,He=c==="polymarket"&&!Rt,{data:Ze}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:c,outcome:y},{enabled:e.status==="open"}),he=react.useMemo(()=>{let O=reactPredict.pickBestAsk(Ze,y);if(O!=null&&O>0)return O;let Oe=y==="yes"?0:1,Me=e.outcomes[Oe];return Me?.best_ask??Me?.price??.5},[Ze,e.outcomes,y]),dt=react.useCallback(O=>{b(O);},[]),yt=react.useCallback(O=>{x(O),N(NaN);},[]);react.useEffect(()=>{yt(t);},[t,yt]),react.useEffect(()=>{k==="limit"&&isNaN(B)&&N(Math.round(he*1e4)/1e4);},[k,B,he]);let ye=react.useMemo(()=>k==="limit"&&g&&!isNaN(B)?B:he,[k,g,B,he]),et=react.useMemo(()=>isNaN(S)||S<=0?0:ye>0?S/ye:0,[S,ye]),Re=react.useMemo(()=>reactPredict.walkOrderbook({orderbook:Ze,outcome:y,side:"buy",sharesNeeded:et,slippageBps:r}),[Ze,y,et,r]),Lt=react.useMemo(()=>Re.status==="ok"&&Re.worstPrice!=null&&Re.worstPrice>0?Re.worstPrice:he,[Re,he]),_=react.useMemo(()=>isNaN(S)||S<=0?"0":String(Math.round(S*1e6)),[S]),Le=e.provider_meta?.["dflow.yesMint"]??"",Ye=e.provider_meta?.["dflow.noMint"]??"",nn=utils$1.SOLANA_TOKENS.stablecoins.USDC.address,F=y==="yes"?Le:Ye,_e=nn,kt=F,Ft=c==="kalshi"?v??"":f??"",{data:on,isLoading:Ko}=reactPredict.usePositionsMulti({kalshi_user:c==="kalshi"?Ft:void 0,polymarket_user:c==="polymarket"?Ft:void 0},{enabled:!!Ft}),Vo=c==="kalshi"&&!!_e&&!!kt&&!!v&&_!=="0",{refetch:Yt}=reactPredict.useDFlowQuote({inputMint:_e,outputMint:kt,amount:_,userPublicKey:v??"",slippageBps:100},{enabled:Vo}),Rr=react.useMemo(()=>me?c==="kalshi"?me.kalshiUsdcBalance:me.polymarketUsdcBalance:on&&on.positions.reduce((Oe,Me)=>Me.side==="USDC"||Me.side==="collateral"?Oe+(Me.current_value??0):Oe,0)||null,[me,on,c]),jo=me?me.isLoading:Ko,ut=react.useMemo(()=>Ps({source:c,usdcBalance:Rr,feeRateBps:W,pricePerShare:ye}),[c,Rr,W,ye]),_t=Rr==null?null:ut,Lr=react.useMemo(()=>isNaN(S)||S<=0?0:S,[S]),sn=react.useMemo(()=>isNaN(S)||S<=0?0:ye>0?S/ye*1:0,[S,ye]),_r=react.useMemo(()=>c!=="polymarket"||isNaN(S)||S<=0?0:ws({usdcAmount:S,pricePerShare:ye,feeRateBps:W}),[c,S,ye,W]),sr=sn-Lr-_r,Go=react.useCallback(O=>{if(isNaN(O)){M(NaN);return}M(Math.round(Math.max(0,O)*100)/100);},[]),An=react.useCallback(O=>{if(isNaN(O)){N(NaN);return}N(Math.round(O*1e4)/1e4);},[]),Or=react.useCallback(()=>{M(NaN),N(NaN),b("market"),ee(false),ue("1h"),Ae(30),Fe("minutes");},[]),Qt=react.useMemo(()=>{let O=[];return isNaN(S)||S<=0?O.push(o("predict.trade.minAmountUsd",{amount:Yn})):S<Yn&&O.push(o("predict.trade.minAmountUsd",{amount:Yn})),e.status!=="open"&&O.push(o("predict.trade.marketNotActive")),_t!=null&&!isNaN(S)&&S>0&&S>_t&&O.push(o("predict.trade.insufficientBalance")),k==="limit"&&g&&(isNaN(B)||B<.01||B>.99)&&O.push(o("predict.trade.limitPriceRange")),k==="limit"&&g&&H&&re==="custom"&&(isNaN(ce)||ce<=0)&&O.push(o("predict.trade.expiration.invalidDate")),c==="polymarket"&&k==="market"&&!isNaN(S)&&S>0&&et>0&&(Re.status==="insufficient_liquidity"?O.push(o("predict.trade.insufficientLiquidity",{available:ke(Re.totalAvailable,2)})):Re.status==="exceeds_slippage"&&O.push(o("predict.trade.priceImpactTooHigh",{impact:(Re.priceImpactBps/100).toFixed(2),slippage:(r/100).toFixed(2)}))),{isValid:O.length===0,errors:O}},[S,e.status,_t,k,g,B,H,re,ce,c,et,Re,r,o]),fr=react.useMemo(()=>_t==null||isNaN(S)||S<=0?false:S>_t,[_t,S]),gr=react.useCallback(()=>{n?.(c);},[n,c]),{mutateAsync:hr}=reactPredict.useDFlowSubmit(),{data:an}=reactPredict.useOrder({id:D??"",source:c},{enabled:!!D});react.useEffect(()=>{if(!an||!D)return;let{status:O}=an;O==="closed"?(j(null),I(false),Be("buy-market"),Or()):(O==="failed"||O==="expired")&&(I(false),j(null),ui$1.toast.error(o("predict.trade.submitError")));},[Be,an,D,Or,o]);let ln=react.useCallback(async()=>{if(!v||!d)return;if(!_e||!kt){ui$1.toast.error("Missing token mint addresses"),I(false);return}if(!ct){U(true),I(false);return}let It=(await Yt()).data?.transaction;if(!It){ui$1.toast.error(o("predict.trade.submitError")),I(false);return}let cn=Uint8Array.from(atob(It),pt=>pt.charCodeAt(0)),Xt=await d.signTransaction(cn),Jt=await hr({signedTransaction:btoa(String.fromCharCode(...Xt)),orderContext:{user_public_key:v,input_mint:_e,output_mint:kt,amount:_,price:String(he),side:"BUY",outcome:y==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});j(Jt.signature);},[v,d,Yt,hr,_e,kt,_,he,y,e.slug,o,ct]),Ir=react.useCallback(async()=>{if(!m||!u)return;let O=m.chain,Oe=O!==types.Chain.POLYGON;Oe&&await m.switchChain(types.Chain.POLYGON);try{let Me=await m.getEip1193Provider();if(!Me){ui$1.toast.error(o("predict.trade.submitError")),I(!1);return}let It=xt==="deposit"&&!!qe,cn=!It&&!!it,Xt=It?qe:it,Jt={address:m.address,signatureType:It?3:cn?2:0,signTypedData:async(Dt,E,Ce,Ee)=>{let ze=[];"name"in Dt&&ze.push({name:"name",type:"string"}),"version"in Dt&&ze.push({name:"version",type:"string"}),"chainId"in Dt&&ze.push({name:"chainId",type:"uint256"}),"verifyingContract"in Dt&&ze.push({name:"verifyingContract",type:"address"}),"salt"in Dt&&ze.push({name:"salt",type:"bytes32"});let ft={EIP712Domain:ze,...E};return await Me.request({method:"eth_signTypedData_v4",params:[m.address,JSON.stringify({domain:Dt,types:ft,primaryType:Ce,message:Ee})]})}},pt=u.credentials??await u.authenticate(Jt),qo=y==="yes"?0:1,Fn="",zt=e.provider_meta?.["polymarket.clobTokenIds"];zt&&(Fn=(typeof zt=="string"?JSON.parse(zt):zt)[qo]??"");let Dr=e.provider_meta?.["polymarket.negRisk"]??!1,Ar=k==="limit"&&!isNaN(B)?B:Lt,vr=Xn(Ar,Ne),Bn=k==="limit"?H?"GTD":"GTC":"FOK",br=k==="market"?S:vr>0?S/vr:0,Fr={tokenId:Fn,price:vr,size:br,side:"BUY",orderType:Bn,tickSize:Ne,negRisk:Dr,...Xt&&{funderAddress:Xt},...ne&&{builderCode:ne},...k==="limit"&&H&&{expiration:Qn(re,ce,Xe)}},Br;if(It)Br=await reactPredict.buildSignedV2OrderPayload({signer:Jt,depositWalletAddress:Xt,input:Fr,owner:pt.apiKey});else {let Dt=reactPredict.buildCtfExchangeDomain(Dr),E=reactPredict.buildOrderMessage({...Fr,signerAddress:Jt.address,signatureType:Jt.signatureType,feeRateBps:T}),Ce=await Jt.signTypedData(Dt,reactPredict.CTF_ORDER_TYPES,"Order",E),Ee=reactPredict.buildSignedOrder(E,Ce,Fr.orderType);Br=reactPredict.buildClobPayload(Ee,pt.apiKey);}await l.executePolymarketOrder({payload:Br,l2_api_key:pt.apiKey,l2_secret:pt.secret,l2_passphrase:pt.passphrase,signer_address:pt.address,owner:pt.apiKey}),Be(k==="limit"?"buy-limit":"buy-market",async()=>await reactPredict.buildPolymarketL2Headers(pt.address,{apiKey:pt.apiKey,secret:pt.secret,passphrase:pt.passphrase,method:"GET",requestPath:"/data/orders"})),Or(),I(!1);}finally{Oe&&O&&m.switchChain(O).catch(()=>{});}},[m,u,y,e.provider_meta,k,Be,B,Lt,S,l,H,re,ce,Xe,Or,o,Ne,T,it,xt,qe,ne]),Ot=react.useCallback(async()=>{if(!(!Qt.isValid||!h)){I(true),j(null),U(false);try{c==="kalshi"?await ln():await Ir();}catch(O){let Oe=O instanceof Error?O.message:"",Me=c==="polymarket"&&Oe?Jn(Oe,o,"buy"):Oe||void 0;ui$1.toast.error(Me||o("predict.trade.submitError")),I(false);}}},[Qt.isValid,h,c,ln,Ir,o]);return {outcome:y,orderType:k,quantity:S,limitPrice:B,shares:et,effectivePrice:ye,estimatedCost:Lr,estimatedFee:_r,potentialPayout:sn,potentialProfit:sr,pricePerShare:he,usdcBalance:Rr,maxBuyAmount:ut,spendableUsdcBalance:_t,isBalanceLoading:jo,isMarketDataLoading:c==="polymarket"&&(Se||Te),isSubmitting:C,authStatus:s,validation:Qt,isInsufficientBalance:fr,source:c,supportsLimitOrder:g,kycRequired:L,needsKyc:qt,needsSetup:He,kycUrl:Tt,expirationEnabled:H,expirationPreset:re,customDuration:ce,customDurationUnit:Xe,setOutcome:yt,setOrderType:dt,setQuantity:Go,setLimitPrice:An,setExpirationEnabled:ee,setExpirationPreset:ue,setCustomDuration:Ae,setCustomDurationUnit:Fe,submit:Ot,notifyInsufficientBalance:gr}}function eo({isOpen:e,onClose:t,kycUrl:r}){let{t:n}=i18n.useTranslation();return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:e,onOpenChange:o=>{o||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:n("predict.trade.kycModalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 mb-4 text-left",children:n("predict.trade.kycModalDescription")}),jsxRuntime.jsx("div",{className:"flex flex-col gap-2 mb-4",children:["predict.trade.kycModalBullet1","predict.trade.kycModalBullet2","predict.trade.kycModalBullet3"].map(o=>jsxRuntime.jsxs("div",{className:"flex items-center gap-2.5 text-[13px] text-zinc-300",children:[jsxRuntime.jsx("svg",{width:14,height:14,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:"text-[#c7ff2e] shrink-0",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})}),jsxRuntime.jsx("span",{children:n(o)})]},o))}),r&&jsxRuntime.jsxs("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-[13px] text-[#c7ff2e]/70 hover:text-[#c7ff2e] transition-colors mb-3",children:[n("predict.trade.goToKYC")," \u2192"]}),jsxRuntime.jsx("p",{className:"text-[11px] text-zinc-500 mb-5",children:n("predict.trade.kycModalNote")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:n("common.ok")})]})]})})})}var mu=["5m","1h","12h","24h","eod","custom"],fu={"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"},gu=["minutes","hours","days"],hu={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},vu={maximumFractionDigits:0},cr="-";function Bs({event:e,market:t,variant:r="bordered",outcome:n,orderType:o,quantity:i,limitPrice:s,shares:a,effectivePrice:l,potentialProfit:u,potentialPayout:p,estimatedCost:c,estimatedFee:g=0,usdcBalance:d,isBalanceLoading:m,isMarketDataLoading:h,isSubmitting:v,authStatus:f,isValid:y,validationErrors:x,isInsufficientBalance:k,onInsufficientBalance:b,supportsLimitOrder:S,maxBuyAmount:M,kycRequired:B,needsKyc:N,needsSetup:C,kycUrl:I,expirationEnabled:D,expirationPreset:j,customDuration:L,customDurationUnit:U,oddsFormatter:H,outcomeLabels:ee,onOutcomeChange:re,onOrderTypeChange:ue,onQuantityChange:ce,onLimitPriceChange:Ae,onExpirationEnabledChange:Xe,onExpirationPresetChange:Fe,onCustomDurationChange:ot,onCustomDurationUnitChange:$e,onSubmit:Be}){let{t:P}=i18n.useTranslation(),[Je,Te]=react.useState(true),Ne=ui$1.useDisclosure(),[lt,Se]=react.useState(""),w=react.useRef(false);react.useEffect(()=>{w.current||Se(isNaN(i)?"":String(i));},[i]);let[T,W]=react.useState(""),J=react.useRef(false);react.useEffect(()=>{J.current||(isNaN(s)?W(""):W(String(parseFloat((s*100).toFixed(2)))));},[s]);let ne=react.useCallback(F=>{if(F!==""&&!/^\d*\.?\d{0,2}$/.test(F))return;if(W(F),F===""||F==="."){Ae(NaN);return}let kt=parseFloat(F);isNaN(kt)||Ae(kt/100);},[Ae]),me=react.useCallback(F=>{if(F!==""&&!/^\d*\.?\d{0,2}$/.test(F))return;if(Se(F),Ye(false),F===""||F==="."){ce(NaN);return}let kt=parseFloat(F);isNaN(kt)||ce(kt);},[ce]);react.useEffect(()=>{B&&!Ne.isOpen&&Ne.onOpen();},[B]);let ct=react.useMemo(()=>{let F=n==="yes"?t.yesAsk:t.noAsk;return F!=null?parseFloat((Number(F)*100).toFixed(2)):null},[n,t]),Tt=n==="yes"?t.yesAsk:t.noAsk,Rt=Tt!=null&&H?H(Number(Tt)):ct!=null?`${ct} \xA2`:cr,it=Number.isFinite(l)?parseFloat((l*100).toFixed(2)):null,xt=Number.isFinite(l)&&H?H(l):it!=null?`${it} \xA2`:cr,qe=!isNaN(i)&&i>0,qt=qe?c+g:0,He=qe&&a>0?qt/a:0,Ze=He>0&&H?H(He):He>0?`${parseFloat((He*100).toFixed(2))}\xA2`:cr,he=f==="authenticated",dt=f==="authenticating"||f==="deauthenticating",yt=he&&(N||C),ye=react.useCallback(F=>ee?.[F]??P(F==="yes"?"predict.trade.yes":"predict.trade.no"),[ee,P]),et=react.useMemo(()=>{if(dt)return P("predict.trade.checkingLogin");if(!he)return P("predict.trade.loginToTrade");if(N)return P("predict.trade.kycRequired");if(C)return P("predict.trade.setupRequired");if(m)return P("predict.trade.loadingBalance");if(h)return P("predict.trade.loadingMarketData");if(v)return P("predict.trade.submitting");if(B)return P("predict.trade.kycRequired");if(!qe)return P("predict.trade.enterAmount");let F=ye(n),_e=u>0?` \u2192 Win $${u.toFixed(2)}`:"";return `${P("predict.trade.buy")} ${F}${_e}`},[dt,he,N,C,m,h,v,B,qe,n,ye,u,P]),Re="primary",Lt=()=>{let F=M??ke(d??0,2);ce(ke(F/2,2));},_=()=>{ce(M??ke(d??0,2));},[Le,Ye]=react.useState(false),nn=()=>{if(!he){Ye(false),Be();return}if(N){Ne.onOpen();return}if(C&&b){Ye(false),b();return}if(B){Ne.onOpen();return}if(k&&b){Ye(false),b();return}if(!y){Ye(true);return}Ye(false),Be();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter:F=>{r==="bordered"&&(F.currentTarget.style.borderColor="rgba(63,63,70,0.8)");},onMouseLeave:F=>{r==="bordered"&&(F.currentTarget.style.borderColor="rgba(39,39,42,0.6)");},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.jsx("span",{className:"text-foreground",children:t.yesSubTitle}),jsxRuntime.jsx("span",{className:"text-foreground",children:" \xB7 "}),jsxRuntime.jsxs("span",{className:"text-bullish",children:[P("predict.trade.buy")," ",ye(n)]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[S?jsxRuntime.jsxs(ui$1.Tabs,{variant:"underlined",selectedKey:o,onSelectionChange:F=>ue(F),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui$1.Tab,{title:P("predict.trade.market")},"market"),jsxRuntime.jsx(ui$1.Tab,{title:P("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:P("predict.trade.market")}),o==="limit"&&S?jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:T,onChange:F=>ne(F.target.value),onFocus:()=>{J.current=true;},onBlur:()=>{J.current=false,isNaN(s)?W(""):W(String(parseFloat((s*100).toFixed(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"}}):Rt!=null&&jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums",children:Rt})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(F=>{let _e=F==="yes"?t.yesAsk:t.noAsk;return jsxRuntime.jsx("div",{className:"flex flex-1 flex-col gap-y-1",children:jsxRuntime.jsxs("button",{type:"button",onClick:()=>re(F),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${n===F?"border-bullish bg-bullish/10 text-bullish":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:ye(F)}),_e!=null&&jsxRuntime.jsx("span",{className:"ml-1 opacity-70",children:H?H(Number(_e)):`${parseFloat((Number(_e)*100).toFixed(2))}\xA2`})]})},F)})}),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("predict.trade.youArePaying")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",onClick:Lt,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:P("predict.trade.half")}),jsxRuntime.jsx("button",{type:"button",onClick:_,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:P("predict.trade.max")})]})]}),jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Trade amount",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:lt,onChange:F=>me(F.target.value),onFocus:()=>{w.current=true;},onBlur:()=>{w.current=false,Se(isNaN(i)?"":String(i));},startContent:jsxRuntime.jsx("span",{className:"text-default-600 text-xl",children:"$"}),classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),Le&&x.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:x.map(F=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:F},F))})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-x-1.5 text-sm",children:[jsxRuntime.jsx("span",{className:"text-neutral-500",children:P("predict.trade.balance")}),jsxRuntime.jsx("span",{className:"font-medium text-foreground tabular-nums",children:d!=null?`$${ke(d,2).toFixed(2)}`:"$0"})]}),o==="limit"&&S&&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$1.StyledSwitch,{size:"sm",color:"primary",isSelected:D,onValueChange:Xe,"aria-label":P("predict.trade.setExpiration")})]}),D&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui$1.Select,{"aria-label":P("predict.trade.setExpiration"),selectedKeys:[j],onSelectionChange:F=>{let _e=Array.from(F)[0];_e&&Fe(_e);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:mu.map(F=>jsxRuntime.jsx(ui$1.SelectItem,{children:P(fu[F])},F))}),j==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui$1.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(L)?void 0:L,onValueChange:ot,minValue:1,step:1,formatOptions:vu,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$1.Select,{"aria-label":"Duration unit",selectedKeys:[U],onSelectionChange:F=>{let _e=Array.from(F)[0];_e&&$e(_e);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:gu.map(F=>jsxRuntime.jsx(ui$1.SelectItem,{children:P(hu[F])},F))})]})]})]}),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:()=>Te(F=>!F),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$1.ChevronDownIcon,{className:ui$1.cn("h-3.5 w-3.5 transition-transform",Je&&"rotate-180")})]}),jsxRuntime.jsx("span",{className:"text-foreground font-medium tabular-nums",children:H&&Number.isFinite(l)?xt:it!=null?P("predict.trade.chance",{percent:it}):cr})]}),Je&&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:P("predict.trade.totalSize")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${c.toFixed(2)}`:cr})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:P("predict.trade.numContracts")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(a)&&a>0?kr(a):cr})]}),g>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:P("predict.trade.estFee")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:`$${g.toFixed(2)}`})]}),g>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:P("predict.trade.totalPayment")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:`$${qt.toFixed(2)}`})]}),g>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:P("predict.trade.effectiveOdds")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:Ze})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:P("predict.trade.payout")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${p.toFixed(2)}`:cr})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:P("predict.trade.estProfit")}),jsxRuntime.jsx("span",{className:"tabular-nums text-bullish",children:!isNaN(i)&&i>0&&u>0?`+$${u.toFixed(2)}`:cr})]})]})]}),jsxRuntime.jsx(ui$1.Button,{color:Re,fullWidth:true,radius:"lg",size:"lg",isDisabled:dt||he&&!yt&&(m||h||!qe||v),isLoading:dt||he&&!yt&&(v||m||h),spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),onPress:nn,children:et})]}),jsxRuntime.jsx(eo,{isOpen:Ne.isOpen,onClose:Ne.onClose,kycUrl:I})]})}function ro({event:e,market:t,variant:r,initialOutcome:n,chain:o,slippageBps:i,onInsufficientBalance:s,onOutcomeChange:a,oddsFormatter:l,outcomeLabels:u}){let{outcome:p,orderType:c,quantity:g,limitPrice:d,shares:m,effectivePrice:h,estimatedCost:v,estimatedFee:f,potentialPayout:y,potentialProfit:x,pricePerShare:k,usdcBalance:b,maxBuyAmount:S,isBalanceLoading:M,isMarketDataLoading:B,isSubmitting:N,authStatus:C,validation:I,isInsufficientBalance:D,supportsLimitOrder:j,kycRequired:L,needsKyc:U,needsSetup:H,kycUrl:ee,expirationEnabled:re,expirationPreset:ue,customDuration:ce,customDurationUnit:Ae,setOutcome:Xe,setOrderType:Fe,setQuantity:ot,setLimitPrice:$e,setExpirationEnabled:Be,setExpirationPreset:P,setCustomDuration:Je,setCustomDurationUnit:Te,submit:Ne,notifyInsufficientBalance:lt}=Rs({market:t,initialOutcome:n,slippageBps:i,onInsufficientBalance:s}),Se=walletConnector.useAuthCallback(Ne),w=react.useCallback(J=>{Xe(J),a?.(J);},[Xe,a]),T=react.useMemo(()=>e?Vn(e):void 0,[e]),W=react.useMemo(()=>jn(t,{yesAsk:p==="yes"?k:void 0,noAsk:p==="no"?k:void 0}),[t,p,k]);return jsxRuntime.jsx(Bs,{event:T,market:W,variant:r,outcome:p,orderType:c,quantity:g,limitPrice:d,shares:m,effectivePrice:h,estimatedCost:v,estimatedFee:f,potentialPayout:y,potentialProfit:x,usdcBalance:b,maxBuyAmount:S,isBalanceLoading:M,isMarketDataLoading:B,isSubmitting:N,authStatus:C,isValid:I.isValid,validationErrors:I.errors,isInsufficientBalance:D,onInsufficientBalance:s?lt:void 0,supportsLimitOrder:j,kycRequired:L,needsKyc:U,needsSetup:H,kycUrl:ee,expirationEnabled:re,expirationPreset:ue,customDuration:ce,customDurationUnit:Ae,oddsFormatter:l,outcomeLabels:u,onOutcomeChange:w,onOrderTypeChange:Fe,onQuantityChange:ot,onLimitPriceChange:$e,onExpirationEnabledChange:Be,onExpirationPresetChange:P,onCustomDurationChange:Je,onCustomDurationUnitChange:Te,onSubmit:Se})}var mn="predict-trade";function no({id:e=mn}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Mu,{...t})})}function Mu({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui$1.useScreen();return e?jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{className:o?"":"p-2",children:[jsxRuntime.jsx(ro,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,chain:e.chain,slippageBps:e.slippageBps,variant:"flat",onInsufficientBalance:e.onInsufficientBalance}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:n("common.cancel")})})]})})}):null}var fn={sortPreset:"volume",sortAsc:false,source:void 0,timeRemaining:void 0,minVolume:void 0,minLiquidity:void 0};function ui(e,t=true){let r=0;return t&&e.source&&r++,e.timeRemaining&&r++,e.minVolume&&r++,e.minLiquidity&&r++,r}function zs({isOpen:e,onClose:t,value:r,onChange:n,enableKalshi:o=true}){let{t:i}=i18n.useTranslation(),[s,a]=react.useState(r),l=react.useMemo(()=>o?fn:{...fn,source:"polymarket"},[o]),u=react.useCallback(y=>{y?a(r):t();},[r,t]),p=react.useCallback(()=>{a(l);},[l]),c=react.useCallback(()=>{n(s),t();},[s,n,t]),g=react.useCallback((y,x)=>{a(k=>({...k,[y]:x}));},[]),d=react.useMemo(()=>ui(s,o),[s,o]),m=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"polymarket",label:i("predict.platform.polymarket")},{value:"kalshi",label:i("predict.platform.kalshi")}],[i]),h=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1d",label:i("predict.filter.lessThanDay")},{value:"7d",label:i("predict.filter.lessThanWeek")},{value:"30d",label:i("predict.filter.lessThanMonth")}],[i]),v=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[i]),f=react.useMemo(()=>[{value:void 0,label:i("predict.filter.all")},{value:"1000",label:">$1K"},{value:"10000",label:">$10K"},{value:"100000",label:">$100K"},{value:"1000000",label:">$1M"}],[i]);return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:e,onOpenChange:u,size:"md",backdrop:"opaque",scrollBehavior:"inside",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.filter.title")}),jsxRuntime.jsx(_u,{onClick:()=>u(false)})]}),jsxRuntime.jsxs("div",{style:{padding:"0 20px 16px",display:"flex",flexDirection:"column",gap:20},children:[o&&jsxRuntime.jsx(io,{label:i("predict.filter.platform"),children:jsxRuntime.jsx(so,{options:m,selected:s.source,onSelect:y=>g("source",y)})}),jsxRuntime.jsx(io,{label:i("predict.filter.timeRemaining"),children:jsxRuntime.jsx(so,{options:h,selected:s.timeRemaining,onSelect:y=>g("timeRemaining",y)})}),jsxRuntime.jsx(io,{label:i("predict.filter.minVolume"),children:jsxRuntime.jsx(so,{options:v,selected:s.minVolume,onSelect:y=>g("minVolume",y)})}),jsxRuntime.jsx(io,{label:i("predict.filter.minLiquidity"),children:jsxRuntime.jsx(so,{options:f,selected:s.minLiquidity,onSelect:y=>g("minLiquidity",y)})})]}),jsxRuntime.jsxs("div",{className:"flex items-center gap-3 px-5 py-4",style:{borderTop:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("button",{type:"button",className:"inline-flex items-center justify-center py-2.5 px-5 rounded-[10px] text-zinc-400 text-sm font-medium hover:text-white transition-colors cursor-pointer",onClick:p,children:i("predict.filter.reset")}),jsxRuntime.jsxs("button",{type:"button",className:"flex-1 inline-flex items-center justify-center gap-2 py-2.5 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer",onClick:c,children:[i("predict.filter.showResults"),d>0&&jsxRuntime.jsxs("span",{style:{opacity:.7},children:["(",d,")"]})]})]})]})})})}function io({label:e,children:t}){return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:"#71717a",textTransform:"uppercase",letterSpacing:"0.05em"},children:e}),t]})}function _u({onClick:e}){return jsxRuntime.jsx("button",{type:"button",onClick:e,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})}function so({options:e,selected:t,onSelect:r,allowDeselect:n=true}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:e.map(o=>{let i=t===o.value;return jsxRuntime.jsx("button",{type:"button",onClick:()=>{r(i&&n?void 0:o.value);},style:{flexShrink:0,borderRadius:10,padding:"6px 14px",fontSize:13,fontWeight:500,cursor:"pointer",transition:"all 0.15s",border:i?"1px solid rgba(199,255,46,0.3)":"1px solid rgba(63,63,70,0.5)",background:i?"rgba(199,255,46,0.08)":"rgba(39,39,42,0.4)",color:i?"#c7ff2e":"#a1a1aa"},onMouseEnter:s=>{i||(s.currentTarget.style.background="rgba(39,39,42,0.8)",s.currentTarget.style.color="#fff");},onMouseLeave:s=>{i||(s.currentTarget.style.background="rgba(39,39,42,0.4)",s.currentTarget.style.color="#a1a1aa");},children:o.label},o.value??"__all")})})}var Vs={start_time:{sort_by:"created_at"},volume:{sort_by:"volume"},liquidity:{sort_by:"liquidity"},ending_soon:{sort_by:"end_at"}},Us={start_time:"predict.sort.startTime",volume:"predict.sort.volume",liquidity:"predict.sort.liquidity",ending_soon:"predict.sort.endingSoon"},Wu=["start_time","volume","liquidity","ending_soon"],$s={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"},Uu={position:"absolute",left: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 js({sortPreset:e,onSortChange:t,sortAsc:r,onSortAscChange:n,onFilterPress:o,filterCount:i=0,className:s}){let{t:a}=i18n.useTranslation(),[l,u]=react.useState(false),p=react.useRef(null),c=react.useCallback(d=>{p.current&&!p.current.contains(d.target)&&u(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)),[c]),react.useEffect(()=>{if(!l)return;let d=m=>{m.key==="Escape"&&u(false);};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[l]);let g=Ks[e];return jsxRuntime.jsxs("div",{className:s,style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:p,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",style:$s,onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>u(d=>!d),children:[jsxRuntime.jsx($u,{}),jsxRuntime.jsx(g,{className:"size-4 shrink-0",style:{color:"#a1a1aa"}}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:a(Us[e])}),jsxRuntime.jsx(Vu,{open:l})]}),l&&jsxRuntime.jsx("div",{style:{...Uu,width:224,padding:4},children:Wu.map(d=>{let m=Ks[d],h=e===d;return jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",width:"100%",alignItems:"center",gap:12,padding:"10px 12px",textAlign:"left",fontSize:14,border:"none",cursor:"pointer",transition:"all 0.15s",background:h?"rgba(199,255,46,0.08)":"transparent",color:h?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:v=>{h||(v.currentTarget.style.background="rgba(39,39,42,0.5)",v.currentTarget.style.color="#fff");},onMouseLeave:v=>{h||(v.currentTarget.style.background="transparent",v.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===d?n(!r):t(d),u(false);},children:[jsxRuntime.jsx(m,{className:"size-4 shrink-0",style:{color:h?"#c7ff2e":"#71717a"}}),jsxRuntime.jsx("span",{style:{flex:1,fontWeight:500},children:a(Us[d])}),h&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},d)})})]}),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",fontSize:14},onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)",d.currentTarget.style.color="#fff";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)",d.currentTarget.style.color="#a1a1aa";},onClick:()=>n(!r),children:r?"\u2191":"\u2193"}),jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",style:$s,onMouseEnter:d=>{d.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:d=>{d.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:o,children:[jsxRuntime.jsx(Ku,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:a("predict.filter.title")})]}),i>0&&jsxRuntime.jsx("span",{style:{position:"absolute",top:-4,right:-4,minWidth:16,height:16,display:"flex",alignItems:"center",justifyContent:"center",borderRadius:8,background:"#c7ff2e",color:"#000",fontSize:10,fontWeight:600,padding:"0 4px"},children:i})]})]})}var Ks={start_time:ui$1.CalendarIcon,volume:ui$1.ChartLineIcon,liquidity:ui$1.DropletIcon,ending_soon:ui$1.TimerIcon};function $u(){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 Ku(){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 Vu({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 Ys(e={}){let{i18n:t}=i18n.useTranslation(),r=e.lang??t.resolvedLanguage??t.language,n=react.useMemo(()=>reactPredict.resolveEventsParams({...e,lang:r}),[r,e.tagSlugSelection,e.limit,e.status,e.sort_by,e.sort_asc,e.source,e.with_markets,e.minVolume,e.minLiquidity,e.timeRemaining,e.markets_limit,e.lang]),{data:o,isLoading:i,isFetching:s,isFetchingNextPage:a,isError:l,error:u,hasNextPage:p,fetchNextPage:c,refetch:g}=reactPredict.useInfiniteEvents(n),d=react.useMemo(()=>o?.pages.flatMap(v=>v.items).filter(v=>v!=null)??[],[o]),m=react.useCallback(()=>{c();},[c]),h=react.useCallback(()=>{g();},[g]);return {data:d,isLoading:i,isFetching:s&&!a,isFetchingMore:a,isError:l,error:u??null,hasMore:p??false,fetchMore:m,refetch:h}}var Qs=`
2
2
  @keyframes evtShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
3
3
  @media(max-width:1279px){.evt-skel-grid{grid-template-columns:repeat(3,1fr)!important}}
4
4
  @media(max-width:1023px){.evt-skel-grid{grid-template-columns:repeat(2,1fr)!important}.evt-skel-card{min-height:200px!important}}
5
5
  @media(max-width:767px){.evt-skel-grid{grid-template-columns:1fr!important}}
6
- `,Os={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:"evtShimmer 1.8s ease-in-out infinite",borderRadius:6};function Zn(e){return {...Os,animationDelay:`${e}ms`}}function Yo({count:e=6}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Is}),jsxRuntime.jsx("div",{className:"evt-skel-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",width:"100%"},children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(Eu,{index:r},r))})]})}function Eu({index:e}){let t=e*120,r={...Os,animationDelay:`${t}ms`},n=e%3===0?"85%":e%3===1?"70%":"60%";return jsxRuntime.jsx("div",{style:{padding:8},children:jsxRuntime.jsxs("div",{className:"evt-skel-card",style:{display:"flex",flexDirection:"column",minHeight:248,borderRadius:14,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:"center",gap:10,padding:"14px 14px 8px"},children:[jsxRuntime.jsx("div",{style:{...r,width:36,height:36,borderRadius:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6},children:[jsxRuntime.jsx("div",{style:{...r,height:12,width:n}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:"40%"}})]})]}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:"4px 14px 14px",flex:1},children:[0,1,2].map(o=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[jsxRuntime.jsx("div",{style:{...r,height:11,width:o===0?"55%":o===1?"45%":"35%"}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("div",{style:{...r,height:11,width:32}}),jsxRuntime.jsx("div",{style:{...r,height:28,width:80,borderRadius:8}})]})]},o))}),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.15)",padding:"8px 14px"},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:56}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:72}})]})]})})}function Lu(){return jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px"},children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:10,minHeight:40,flex:1},children:[48,64,48,56,72,56].map((e,t)=>jsxRuntime.jsx("div",{style:{...Zn(t*50),height:28,width:e,borderRadius:6}},t))}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[jsxRuntime.jsx("div",{style:{...Zn(0),height:36,width:120,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...Zn(50),height:36,width:36,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...Zn(100),height:36,width:80,borderRadius:10}})]})]})}function Rx({count:e=24}){return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("style",{children:Is}),jsxRuntime.jsx("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(Lu,{})}),jsxRuntime.jsx("div",{style:{padding:"12px 8px 80px"},children:jsxRuntime.jsx(Yo,{count:e})})]})}var Ds=3,zu={polymarket:{border:"rgba(80,162,255,0.4)",shadow:"0 2px 18px rgba(80,162,255,0.45)"},kalshi:{border:"rgba(0,212,146,0.4)",shadow:"0 2px 18px rgba(0,212,146,0.45)"}},Wu={border:"hsl(var(--heroui-primary) / 0.4)",shadow:"0 2px 18px hsl(var(--heroui-primary) / 0.45)"},Xo={bg:"hsl(var(--heroui-primary) / 0.14)",text:"hsl(var(--heroui-primary))",shadow:"hsl(var(--heroui-primary) / 0.18)"},Ws={bg:"hsl(var(--heroui-secondary) / 0.14)",text:"hsl(var(--heroui-secondary))",shadow:"hsl(var(--heroui-secondary) / 0.18)"},Uu={bg:"rgba(239, 68, 68, 0.14)",text:"rgb(239, 68, 68)",shadow:"rgba(239, 68, 68, 0.18)"},dn=[{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 As(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 $u(e){let t=e.outcomes?.map(a=>a.label?.toLowerCase().trim()??"")??[];if(t.some(a=>a==="up")&&t.some(a=>a==="down"))return [Xo,Uu];if(t.some(a=>a==="yes")&&t.some(a=>a==="no"))return [Xo,Ws];let r=t[0]??"",n=t[1]??"",o=As(r)%dn.length,i=As(n)%dn.length;return i===o&&(i=(i+1)%dn.length),[dn[o],dn[i]]}function Fs(e){return e.title_trans||e.title}function Ku(e){return e.question_trans||e.question}function Jo(e,t){return e?.label_trans||e?.label||t}function Us(e){return Jo(e.outcomes?.[0],Ku(e))}function Vu(e){let t=e.outcomes?.[0];return t?t.best_ask??t.price??null:null}function $s(e){let t=Vu(e);return t!=null?parseFloat((t*100).toFixed(2)):0}function Ks(e){return e<=1&&e>0?"< 1%":e>=99&&e<100?"> 99%":`${e}%`}function Bs(e){let t=e.outcomes?.[0],r=t?.best_ask??t?.price??0;return parseFloat((r*100).toFixed(2)).toString()}function Hs(e){let t=e.outcomes?.[1];if(t){let o=t.best_ask??t.price??0;return parseFloat((o*100).toFixed(2)).toString()}let r=e.outcomes?.[0],n=r?.best_ask??r?.price??0;return parseFloat(((1-n)*100).toFixed(2)).toString()}function ju(e){let t=new Date(e).getTime()-Date.now();if(t<=0)return null;let r=Math.floor(t/864e5),n=Math.floor(t%864e5/36e5),o=Math.floor(t%36e5/6e4),i=[];return r>0&&i.push(`${r}d`),n>0&&i.push(`${n}h`),i.push(`${o}m`),i.join(" ")}var Gu=`
6
+ `,Xs={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:"evtShimmer 1.8s ease-in-out infinite",borderRadius:6};function ao(e){return {...Xs,animationDelay:`${e}ms`}}function pi({count:e=6}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Qs}),jsxRuntime.jsx("div",{className:"evt-skel-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",width:"100%"},children:Array.from({length:e}).map((t,r)=>jsxRuntime.jsx(Yu,{index:r},r))})]})}function Yu({index:e}){let t=e*120,r={...Xs,animationDelay:`${t}ms`},n=e%3===0?"85%":e%3===1?"70%":"60%";return jsxRuntime.jsx("div",{style:{padding:8},children:jsxRuntime.jsxs("div",{className:"evt-skel-card",style:{display:"flex",flexDirection:"column",minHeight:248,borderRadius:14,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:"center",gap:10,padding:"14px 14px 8px"},children:[jsxRuntime.jsx("div",{style:{...r,width:36,height:36,borderRadius:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",gap:6},children:[jsxRuntime.jsx("div",{style:{...r,height:12,width:n}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:"40%"}})]})]}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",gap:6,padding:"4px 14px 14px",flex:1},children:[0,1,2].map(o=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},children:[jsxRuntime.jsx("div",{style:{...r,height:11,width:o===0?"55%":o===1?"45%":"35%"}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("div",{style:{...r,height:11,width:32}}),jsxRuntime.jsx("div",{style:{...r,height:28,width:80,borderRadius:8}})]})]},o))}),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.15)",padding:"8px 14px"},children:[jsxRuntime.jsx("div",{style:{...r,height:10,width:56}}),jsxRuntime.jsx("div",{style:{...r,height:10,width:72}})]})]})})}function Qu(){return jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"10px 16px"},children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:10,minHeight:40,flex:1},children:[48,64,48,56,72,56].map((e,t)=>jsxRuntime.jsx("div",{style:{...ao(t*50),height:28,width:e,borderRadius:6}},t))}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[jsxRuntime.jsx("div",{style:{...ao(0),height:36,width:120,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...ao(50),height:36,width:36,borderRadius:10}}),jsxRuntime.jsx("div",{style:{...ao(100),height:36,width:80,borderRadius:10}})]})]})}function gy({count:e=24}){return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("style",{children:Qs}),jsxRuntime.jsx("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(Qu,{})}),jsxRuntime.jsx("div",{style:{padding:"12px 8px 80px"},children:jsxRuntime.jsx(pi,{count:e})})]})}var Js=3,sp={polymarket:{border:"rgba(80,162,255,0.4)",shadow:"0 2px 18px rgba(80,162,255,0.45)"},kalshi:{border:"rgba(0,212,146,0.4)",shadow:"0 2px 18px rgba(0,212,146,0.45)"}},ap={border:"hsl(var(--heroui-primary) / 0.4)",shadow:"0 2px 18px hsl(var(--heroui-primary) / 0.45)"},fi={bg:"hsl(var(--heroui-primary) / 0.14)",text:"hsl(var(--heroui-primary))",shadow:"hsl(var(--heroui-primary) / 0.18)"},oa={bg:"hsl(var(--heroui-secondary) / 0.14)",text:"hsl(var(--heroui-secondary))",shadow:"hsl(var(--heroui-secondary) / 0.18)"},lp={bg:"rgba(239, 68, 68, 0.14)",text:"rgb(239, 68, 68)",shadow:"rgba(239, 68, 68, 0.18)"},gn=[{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 Zs(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 cp(e){let t=e.outcomes?.map(s=>s.label?.toLowerCase().trim()??"")??[];if(t.some(s=>s==="up")&&t.some(s=>s==="down"))return [fi,lp];if(t.some(s=>s==="yes")&&t.some(s=>s==="no"))return [fi,oa];let r=t[0]??"",n=t[1]??"",o=Zs(r)%gn.length,i=Zs(n)%gn.length;return i===o&&(i=(i+1)%gn.length),[gn[o],gn[i]]}function ea(e){return e.title_trans||e.title}function dp(e){return e.question_trans||e.question}function gi(e,t){return e?.label_trans||e?.label||t}function ia(e){return gi(e.outcomes?.[0],dp(e))}function up(e){let t=e.outcomes?.[0];return t?t.best_ask??t.price??null:null}function sa(e){let t=up(e);return t!=null?parseFloat((t*100).toFixed(2)):0}function aa(e){return e<=1&&e>0?"< 1%":e>=99&&e<100?"> 99%":`${e}%`}function ta(e){let t=e.outcomes?.[0],r=t?.best_ask??t?.price??0;return parseFloat((r*100).toFixed(2)).toString()}function ra(e){let t=e.outcomes?.[1];if(t){let o=t.best_ask??t.price??0;return parseFloat((o*100).toFixed(2)).toString()}let r=e.outcomes?.[0],n=r?.best_ask??r?.price??0;return parseFloat(((1-n)*100).toFixed(2)).toString()}function pp(e){let t=new Date(e).getTime()-Date.now();if(t<=0)return null;let r=Math.floor(t/864e5),n=Math.floor(t%864e5/36e5),o=Math.floor(t%36e5/6e4),i=[];return r>0&&i.push(`${r}d`),n>0&&i.push(`${n}h`),i.push(`${o}m`),i.join(" ")}var mp=`
7
7
  .badge-shine { position: relative; overflow: hidden; }
8
8
  .badge-shine::after {
9
9
  content: "";
@@ -27,13 +27,13 @@
27
27
  outline: 2px solid hsl(var(--heroui-primary) / 0.4);
28
28
  outline-offset: 2px;
29
29
  }
30
- `;function Vs({event:e,href:t,LinkComponent:r,onSelect:n,onSelectOutcome:o,onHover:i}){let[a,s]=react.useState(null),c=e.markets??[],m=react.useMemo(()=>c.length>2?[...c].sort((b,y)=>(y.outcomes?.[0]?.price??0)-(b.outcomes?.[0]?.price??0)):c,[c]).filter(b=>b.status==="open"),l=m.length===1,f=m.slice(0,Ds),d=m.length-Ds,p=react.useMemo(()=>utils$1.formatAmountInUsd(e.volume??0),[e.volume]),h=a?m.find(b=>b.slug===a)??null:null,g=!!h||l,v=()=>{g||n?.(e);},x=b=>{b.stopPropagation(),h&&(b.preventDefault(),s(null));},k=b=>{b.stopPropagation(),t||(b.preventDefault(),n?.(e));},S=l?jsxRuntime.jsx(ip,{event:e,formattedVolume:p,href:t,LinkComponent:r,onSelect:n}):h?jsxRuntime.jsx(ap,{onCollapse:()=>s(null)}):jsxRuntime.jsx(tp,{moreCount:d,formattedVolume:p,source:e.source,href:t,LinkComponent:r,onShowMore:k});return jsxRuntime.jsxs("div",{className:"group evt-card",style:{display:"flex",flexDirection:"column",height:"100%",width:"100%",borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",cursor:g?void 0:"pointer"},onMouseEnter:b=>{let y=b.currentTarget,M=zu[e.source]??Wu;y.style.borderColor=M.border,y.style.boxShadow=M.shadow,i?.(e);},onMouseLeave:b=>{let y=b.currentTarget;y.style.borderColor="rgba(39,39,42,0.6)",y.style.boxShadow="none";},onClick:v,children:[jsxRuntime.jsx("style",{children:Gu}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,padding:"14px 14px 12px",gap:8},children:[jsxRuntime.jsx(qu,{event:e,href:t,LinkComponent:r,onClick:x,isExpanded:g}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1},children:l?jsxRuntime.jsx(op,{market:m[0],event:e,onSelectOutcome:o}):h?jsxRuntime.jsx(sp,{market:h,event:e,onCollapse:()=>s(null),onSelectOutcome:o}):jsxRuntime.jsx(ep,{displayedMarkets:f,onMarketClick:b=>s(b.slug)})})]}),jsxRuntime.jsx(rp,{children:S})]})}function qu({event:e,href:t,LinkComponent:r,onClick:n,isExpanded:o}){let i=e.start_at?ju(e.start_at):null;return jsxRuntime.jsxs(ui$1.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:n,children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:Fs(e)||"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$1.cn("min-w-0 text-sm font-semibold leading-snug text-slate-200 line-clamp-2 lg:text-base",o&&"group-hover/header:text-neutral-400"),children:Fs(e)}),i&&jsxRuntime.jsxs("span",{className:"text-[10px] leading-4 text-neutral-500",children:["Live in ",i]})]}),jsxRuntime.jsx(Qu,{event:e})]})}function Yu(e){let t=[];if(e.status==="closed")return t.push({kind:"closed"}),t.slice(0,2);let r=e.tags?.some(o=>o.label?.toLowerCase()==="crypto"),n=e.tags?.some(o=>o.label?.toLowerCase()==="live");if(r&&e.end_at){let o=new Date(e.end_at).getTime()-Date.now(),i=300*1e3,a=900*1e3;if(o>0&&o<=a){let s=o<=i?"#ef4444":"#f59e0b";t.push({kind:"crypto-short",label:o<=i?"5m":"15m",color:s});}}return n&&t.push({kind:"live"}),t.slice(0,2)}function Qu({event:e}){let t=react.useMemo(()=>Yu(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,n)=>{switch(r.kind){case "live":return jsxRuntime.jsx(Xu,{},n);case "crypto-short":return jsxRuntime.jsx(Ju,{label:r.label,color:r.color},n);case "closed":return jsxRuntime.jsx(Zu,{},n)}})})}function Xu(){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 Ju({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$1.TimerIcon,{className:"size-3 shrink-0"}),e]})}function Zu(){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 ep({displayedMarkets:e,onMarketClick:t}){return 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(r=>{let n=$s(r);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:o=>{o.stopPropagation(),t(r);},children:[jsxRuntime.jsx("span",{className:"min-w-0 flex-1 text-left text-xs text-slate-200 line-clamp-1 lg:text-sm",children:Us(r)}),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:Ks(n)}),jsxRuntime.jsx(np,{})]})]},r.id??`${r.source}-${r.slug}`)})}):null}function tp({moreCount:e,formattedVolume:t,source:r,href:n,LinkComponent:o,onShowMore:i}){let{t:a}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e>0?jsxRuntime.jsxs(ui$1.Linkable,{href:n,LinkComponent:o,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-zinc-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:i,children:[a("predict.event.showMore"),jsxRuntime.jsx(Gs,{className:"h-3 w-3"})]}):jsxRuntime.jsx("div",{}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[t," ",a("predict.event.volume"),jsxRuntime.jsx(qs,{source:r})]})]})}function rp({children:e}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.15)",padding:"8px 14px",marginTop:"auto"},children:e})}function zs({bgColor:e,textColor:t,shadowColor:r,onClick:n,children:o}){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 c=s.currentTarget;c.style.setProperty("--shadow-offset","2px"),c.style.transform="translateY(2px)";},onMouseLeave:s=>{let c=s.currentTarget;c.style.setProperty("--shadow-offset","4px"),c.style.transform="translateY(0px)";},onClick:n,children:o})}function js({market:e,event:t,onSelectOutcome:r,dynamicColors:n=false,labelFormat:o="action"}){let{t:i}=i18n.useTranslation(),[a,s]=n?$u(e):[Xo,Ws],c=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",u=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",m=o==="label"&&c===u?"action":o,l=m==="label"?`${Jo(e.outcomes?.[0],"Yes")} ${Bs(e)}\xA2`:i("predict.market.action.yes",{price:Bs(e)}),f=m==="label"?`${Jo(e.outcomes?.[1],"No")} ${Hs(e)}\xA2`:i("predict.market.action.no",{price:Hs(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(zs,{bgColor:a.bg,textColor:a.text,shadowColor:a.shadow,onClick:d=>{d.stopPropagation(),r?.(t,e,"yes");},children:l}),jsxRuntime.jsx(zs,{bgColor:s.bg,textColor:s.text,shadowColor:s.shadow,onClick:d=>{d.stopPropagation(),r?.(t,e,"no");},children:f})]})}function np(){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 op({market:e,event:t,onSelectOutcome:r}){return jsxRuntime.jsx("div",{style:{flex:1},children:jsxRuntime.jsx(js,{market:e,event:t,onSelectOutcome:r,dynamicColors:true,labelFormat:"label"})})}function ip({event:e,formattedVolume:t,href:r,LinkComponent:n,onSelect:o}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ui$1.Linkable,{href:r,LinkComponent:n,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-zinc-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:s=>{s.stopPropagation(),r||(s.preventDefault(),o?.(e));},children:[i("predict.event.viewEvent"),jsxRuntime.jsx(Gs,{className:"h-3 w-3"})]}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[t," ",i("predict.event.volume"),jsxRuntime.jsx(qs,{source:e.source})]})]})}function sp({market:e,event:t,onCollapse:r,onSelectOutcome:n}){let o=$s(e);return jsxRuntime.jsxs("div",{style:{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:Us(e)}),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:Ks(o)}),jsxRuntime.jsx(ui$1.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{style:{marginTop:12},children:jsxRuntime.jsx(js,{market:e,event:t,onSelectOutcome:n,labelFormat:"action"})})]})}function ap({onCollapse:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-x-1 text-[10px] font-normal transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",style:{color:"#71717a"},onClick:r=>{r.stopPropagation(),e();},children:[jsxRuntime.jsx(lp,{className:"h-3 w-3"}),t("predict.event.back")]}),jsxRuntime.jsx("div",{})]})}function Gs({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 lp({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 qs({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$1.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui$1.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}var pp=8;function Qs({events:e,hasMore:t=false,isFetchingMore:r=false,onFetchMore:n,onSelect:o,onSelectOutcome:i,getEventHref:a,LinkComponent:s,onHover:c}){let{t:u}=i18n.useTranslation(),m=react.useRef(null);react.useEffect(()=>{let d=m.current;if(!d)return;let p=new IntersectionObserver(h=>{h[0]?.isIntersecting&&t&&!r&&n?.();},{rootMargin:"300px"});return p.observe(d),()=>p.disconnect()},[t,r,n]);let l=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]),f=!t&&e.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("style",{children:`
30
+ `;function la({event:e,href:t,LinkComponent:r,onSelect:n,onSelectOutcome:o,onHover:i}){let[s,a]=react.useState(null),l=e.markets??[],p=react.useMemo(()=>l.length>2?[...l].sort((b,S)=>(S.outcomes?.[0]?.price??0)-(b.outcomes?.[0]?.price??0)):l,[l]).filter(b=>b.status==="open"),c=p.length===1,g=p.slice(0,Js),d=p.length-Js,m=react.useMemo(()=>utils$1.formatAmountInUsd(e.volume??0),[e.volume]),h=s?p.find(b=>b.slug===s)??null:null,v=!!h||c,f=()=>{v||n?.(e);},y=b=>{b.stopPropagation(),h&&(b.preventDefault(),a(null));},x=b=>{b.stopPropagation(),t||(b.preventDefault(),n?.(e));},k=c?jsxRuntime.jsx(Np,{event:e,formattedVolume:m,href:t,LinkComponent:r,onSelect:n}):h?jsxRuntime.jsx(Cp,{onCollapse:()=>a(null)}):jsxRuntime.jsx(kp,{moreCount:d,formattedVolume:m,source:e.source,href:t,LinkComponent:r,onShowMore:x});return jsxRuntime.jsxs("div",{className:"group evt-card",style:{display:"flex",flexDirection:"column",height:"100%",width:"100%",borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",cursor:v?void 0:"pointer"},onMouseEnter:b=>{let S=b.currentTarget,M=sp[e.source]??ap;S.style.borderColor=M.border,S.style.boxShadow=M.shadow,i?.(e);},onMouseLeave:b=>{let S=b.currentTarget;S.style.borderColor="rgba(39,39,42,0.6)",S.style.boxShadow="none";},onClick:f,children:[jsxRuntime.jsx("style",{children:mp}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",flex:1,padding:"14px 14px 12px",gap:8},children:[jsxRuntime.jsx(fp,{event:e,href:t,LinkComponent:r,onClick:y,isExpanded:v}),jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",flex:1},children:c?jsxRuntime.jsx(wp,{market:p[0],event:e,onSelectOutcome:o}):h?jsxRuntime.jsx(Mp,{market:h,event:e,onCollapse:()=>a(null),onSelectOutcome:o}):jsxRuntime.jsx(yp,{displayedMarkets:g,onMarketClick:b=>a(b.slug)})})]}),jsxRuntime.jsx(Sp,{children:k})]})}function fp({event:e,href:t,LinkComponent:r,onClick:n,isExpanded:o}){let i=e.start_at?pp(e.start_at):null;return jsxRuntime.jsxs(ui$1.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:n,children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:ea(e)||"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$1.cn("min-w-0 text-sm font-semibold leading-snug text-slate-200 line-clamp-2 lg:text-base",o&&"group-hover/header:text-neutral-400"),children:ea(e)}),i&&jsxRuntime.jsxs("span",{className:"text-[10px] leading-4 text-neutral-500",children:["Live in ",i]})]}),jsxRuntime.jsx(hp,{event:e})]})}function gp(e){let t=[];if(e.status==="closed")return t.push({kind:"closed"}),t.slice(0,2);let r=e.tags?.some(o=>o.label?.toLowerCase()==="crypto"),n=e.tags?.some(o=>o.label?.toLowerCase()==="live");if(r&&e.end_at){let o=new Date(e.end_at).getTime()-Date.now(),i=300*1e3,s=900*1e3;if(o>0&&o<=s){let a=o<=i?"#ef4444":"#f59e0b";t.push({kind:"crypto-short",label:o<=i?"5m":"15m",color:a});}}return n&&t.push({kind:"live"}),t.slice(0,2)}function hp({event:e}){let t=react.useMemo(()=>gp(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,n)=>{switch(r.kind){case "live":return jsxRuntime.jsx(vp,{},n);case "crypto-short":return jsxRuntime.jsx(bp,{label:r.label,color:r.color},n);case "closed":return jsxRuntime.jsx(xp,{},n)}})})}function vp(){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 bp({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$1.TimerIcon,{className:"size-3 shrink-0"}),e]})}function xp(){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 yp({displayedMarkets:e,onMarketClick:t}){return 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(r=>{let n=sa(r);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:o=>{o.stopPropagation(),t(r);},children:[jsxRuntime.jsx("span",{className:"min-w-0 flex-1 text-left text-xs text-slate-200 line-clamp-1 lg:text-sm",children:ia(r)}),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:aa(n)}),jsxRuntime.jsx(Pp,{})]})]},r.id??`${r.source}-${r.slug}`)})}):null}function kp({moreCount:e,formattedVolume:t,source:r,href:n,LinkComponent:o,onShowMore:i}){let{t:s}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[e>0?jsxRuntime.jsxs(ui$1.Linkable,{href:n,LinkComponent:o,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-zinc-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:i,children:[s("predict.event.showMore"),jsxRuntime.jsx(da,{className:"h-3 w-3"})]}):jsxRuntime.jsx("div",{}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[t," ",s("predict.event.volume"),jsxRuntime.jsx(ua,{source:r})]})]})}function Sp({children:e}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.15)",padding:"8px 14px",marginTop:"auto"},children:e})}function na({bgColor:e,textColor:t,shadowColor:r,onClick:n,children:o}){return jsxRuntime.jsx("button",{type:"button",className:"flex h-12 flex-1 w-full items-center justify-center gap-x-1 overflow-hidden rounded-lg p-3 text-base font-normal hover:cursor-pointer will-change-transform [-webkit-tap-highlight-color:transparent]",style:{backgroundColor:e,color:t,"--shadow-color":r,"--shadow-offset":"4px",boxShadow:"inset 0 -1px 0 rgba(255,255,255,0.08), 0 var(--shadow-offset, 4px) 0 var(--shadow-color, rgba(0,0,0,0.22))",transition:"transform .12s, box-shadow .12s, opacity .14s"},onMouseEnter:a=>{let l=a.currentTarget;l.style.setProperty("--shadow-offset","2px"),l.style.transform="translateY(2px)";},onMouseLeave:a=>{let l=a.currentTarget;l.style.setProperty("--shadow-offset","4px"),l.style.transform="translateY(0px)";},onClick:n,children:o})}function ca({market:e,event:t,onSelectOutcome:r,dynamicColors:n=false,labelFormat:o="action"}){let{t:i}=i18n.useTranslation(),[s,a]=n?cp(e):[fi,oa],l=e.outcomes?.[0]?.label?.toLowerCase().trim()??"",u=e.outcomes?.[1]?.label?.toLowerCase().trim()??"",p=o==="label"&&l===u?"action":o,c=p==="label"?`${gi(e.outcomes?.[0],"Yes")} ${ta(e)}\xA2`:i("predict.market.action.yes",{price:ta(e)}),g=p==="label"?`${gi(e.outcomes?.[1],"No")} ${ra(e)}\xA2`:i("predict.market.action.no",{price:ra(e)});return jsxRuntime.jsxs("div",{className:"flex gap-2",children:[jsxRuntime.jsx(na,{bgColor:s.bg,textColor:s.text,shadowColor:s.shadow,onClick:d=>{d.stopPropagation(),r?.(t,e,"yes");},children:c}),jsxRuntime.jsx(na,{bgColor:a.bg,textColor:a.text,shadowColor:a.shadow,onClick:d=>{d.stopPropagation(),r?.(t,e,"no");},children:g})]})}function Pp(){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 wp({market:e,event:t,onSelectOutcome:r}){return jsxRuntime.jsx("div",{style:{flex:1},children:jsxRuntime.jsx(ca,{market:e,event:t,onSelectOutcome:r,dynamicColors:true,labelFormat:"label"})})}function Np({event:e,formattedVolume:t,href:r,LinkComponent:n,onSelect:o}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(ui$1.Linkable,{href:r,LinkComponent:n,as:"button",className:"flex items-center gap-1 text-[10px] font-normal text-zinc-500 transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",onClick:a=>{a.stopPropagation(),r||(a.preventDefault(),o?.(e));},children:[i("predict.event.viewEvent"),jsxRuntime.jsx(da,{className:"h-3 w-3"})]}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[t," ",i("predict.event.volume"),jsxRuntime.jsx(ua,{source:e.source})]})]})}function Mp({market:e,event:t,onCollapse:r,onSelectOutcome:n}){let o=sa(e);return jsxRuntime.jsxs("div",{style:{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:ia(e)}),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:aa(o)}),jsxRuntime.jsx(ui$1.ChevronUpIcon,{className:"h-4 w-4 text-neutral-400"})]})]}),jsxRuntime.jsx("div",{style:{marginTop:12},children:jsxRuntime.jsx(ca,{market:e,event:t,onSelectOutcome:n,labelFormat:"action"})})]})}function Cp({onCollapse:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("button",{type:"button",className:"flex items-center gap-x-1 text-[10px] font-normal transition-colors hover:text-slate-200 cursor-pointer lg:text-xs",style:{color:"#71717a"},onClick:r=>{r.stopPropagation(),e();},children:[jsxRuntime.jsx(Ep,{className:"h-3 w-3"}),t("predict.event.back")]}),jsxRuntime.jsx("div",{})]})}function da({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 Ep({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 ua({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$1.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui$1.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}var _p=8;function ma({events:e,hasMore:t=false,isFetchingMore:r=false,onFetchMore:n,onSelect:o,onSelectOutcome:i,getEventHref:s,LinkComponent:a,onHover:l}){let{t:u}=i18n.useTranslation(),p=react.useRef(null);react.useEffect(()=>{let d=p.current;if(!d)return;let m=new IntersectionObserver(h=>{h[0]?.isIntersecting&&t&&!r&&n?.();},{rootMargin:"300px"});return m.observe(d),()=>m.disconnect()},[t,r,n]);let c=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]),g=!t&&e.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("style",{children:`
31
31
  @keyframes eventCardEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
32
32
  @keyframes evt-load-spin{to{transform:rotate(360deg)}}
33
33
  @media(max-width:767px){.evt-card-grid{grid-template-columns:1fr!important}}
34
34
  @media(min-width:768px) and (max-width:1023px){.evt-card-grid{grid-template-columns:repeat(2,1fr)!important}}
35
35
  @media(min-width:1024px) and (max-width:1279px){.evt-card-grid{grid-template-columns:repeat(3,1fr)!important}}
36
- `}),jsxRuntime.jsx("div",{className:"evt-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)"},children:e.map((d,p)=>d==null?null:jsxRuntime.jsx("div",{style:{padding:pp,animation:`eventCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${p%4*35}ms both`},children:jsxRuntime.jsx(Vs,{event:d,href:a?.(d),LinkComponent:s,onSelect:o,onSelectOutcome:i,onHover:c})},`${d.source}-${d.slug}`))}),jsxRuntime.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:r&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"evt-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),u("predict.events.loadMore")]})}),f&&jsxRuntime.jsx(mp,{onScrollToTop:l})]})}function mp({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 Js({tagSlugSelection:e,limit:t=24,status:r,sort_by:n,sort_asc:o,source:i,with_markets:a,timeRemaining:s,minVolume:c,minLiquidity:u,markets_limit:m,lang:l,onSelect:f,onSelectOutcome:d,getEventHref:p,LinkComponent:h,onHover:g}){let{data:v,hasMore:x,fetchMore:k,isFetching:S,isFetchingMore:b}=_s({tagSlugSelection:e,limit:t,status:r,sort_by:n,sort_asc:o,source:i,with_markets:a,timeRemaining:s,minVolume:c,minLiquidity:u,markets_limit:m,lang:l});return S?jsxRuntime.jsx(Yo,{count:24}):jsxRuntime.jsx(Qs,{events:v,hasMore:x,isFetchingMore:b,onFetchMore:k,onSelect:f,onSelectOutcome:d,getEventHref:p,LinkComponent:h,onHover:g})}function iy({onSelect:e,onSelectOutcome:t,getEventHref:r,LinkComponent:n,onHover:o,bgImageSrc:i,onInsufficientBalance:a,enableKalshi:s=true,lang:c}){let[u,m]=react.useState({categorySlug:null,tagSlug:null}),[l,f]=react.useState(()=>s?cn:{...cn,source:"polymarket"}),{isOpen:d,onOpen:p,onClose:h}=ui$1.useDisclosure(),{onOpen:g}=uiScaffold.useAsyncModal(ln),v=react.useCallback((P,C,I)=>{t?.(P,C,I),g({params:{event:P,market:C,initialOutcome:I,onInsufficientBalance:a}});},[t,g,a]),x=react.useCallback(P=>{m(P);},[]),k=react.useCallback(P=>{f(C=>({...C,sortPreset:P}));},[]),S=react.useCallback(P=>{f(C=>({...C,sortAsc:P}));},[]),b=react.useCallback(P=>{f(P);},[]),y=react.useMemo(()=>Ts[l.sortPreset].sort_by,[l.sortPreset]),M=react.useMemo(()=>qo(l,s),[l,s]),A=react.useMemo(()=>jsxRuntime.jsx(Es,{sortPreset:l.sortPreset,onSortChange:k,sortAsc:l.sortAsc,onSortAscChange:S,onFilterPress:p,filterCount:M}),[l.sortPreset,l.sortAsc,M,k,S,p]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("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(ts,{onSelect:x,trailing:A})}),jsxRuntime.jsxs("div",{style:{padding:"12px 8px 80px"},children:[jsxRuntime.jsx(Ps,{isOpen:d,onClose:h,value:l,onChange:b,enableKalshi:s}),jsxRuntime.jsx(Js,{tagSlugSelection:u,lang:c,sort_by:y,sort_asc:l.sortAsc,source:l.source,timeRemaining:l.timeRemaining,minVolume:l.minVolume,minLiquidity:l.minLiquidity,onSelect:e,onSelectOutcome:v,getEventHref:r,LinkComponent:n,onHover:o})]}),jsxRuntime.jsx(Yn,{})]})}function ra(e){return utils$1.formatAmountInUsd(e)}var bp=[{key:"total_events",labelKey:"predict.events.stats.totalEvents",format:e=>utils$1.formatAmount(e),valueColor:"#c7ff2e",gradientFrom:"rgba(199,255,46,0.18)",gradientTo:"rgba(199,255,46,0.04)"},{key:"total_volume_24h",labelKey:"predict.events.stats.volume24h",format:ra,valueColor:"#f76816",gradientFrom:"rgba(247,104,22,0.18)",gradientTo:"rgba(247,104,22,0.04)"},{key:"avg_liquidity",labelKey:"predict.events.stats.avgLiquidity",format:ra,valueColor:"#17c964",gradientFrom:"rgba(23,201,100,0.18)",gradientTo:"rgba(23,201,100,0.04)"},{key:"active_sources",labelKey:"predict.events.stats.activeSources",format:e=>utils$1.formatAmount(e),valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)"}];function dy({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
36
+ `}),jsxRuntime.jsx("div",{className:"evt-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(4, 1fr)"},children:e.map((d,m)=>d==null?null:jsxRuntime.jsx("div",{style:{padding:_p,animation:`eventCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${m%4*35}ms both`},children:jsxRuntime.jsx(la,{event:d,href:s?.(d),LinkComponent:a,onSelect:o,onSelectOutcome:i,onHover:l})},`${d.source}-${d.slug}`))}),jsxRuntime.jsx("div",{ref:p,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:r&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{animation:"evt-load-spin 1s linear infinite"},children:jsxRuntime.jsx("path",{d:"M21 12a9 9 0 1 1-6.219-8.56"})}),u("predict.events.loadMore")]})}),g&&jsxRuntime.jsx(Op,{onScrollToTop:c})]})}function Op({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 ga({tagSlugSelection:e,limit:t=24,status:r,sort_by:n,sort_asc:o,source:i,with_markets:s,timeRemaining:a,minVolume:l,minLiquidity:u,markets_limit:p,lang:c,onSelect:g,onSelectOutcome:d,getEventHref:m,LinkComponent:h,onHover:v}){let{data:f,hasMore:y,fetchMore:x,isFetching:k,isFetchingMore:b}=Ys({tagSlugSelection:e,limit:t,status:r,sort_by:n,sort_asc:o,source:i,with_markets:s,timeRemaining:a,minVolume:l,minLiquidity:u,markets_limit:p,lang:c});return k?jsxRuntime.jsx(pi,{count:24}):jsxRuntime.jsx(ma,{events:f,hasMore:y,isFetchingMore:b,onFetchMore:x,onSelect:g,onSelectOutcome:d,getEventHref:m,LinkComponent:h,onHover:v})}function $y({onSelect:e,onSelectOutcome:t,getEventHref:r,LinkComponent:n,onHover:o,bgImageSrc:i,onInsufficientBalance:s,enableKalshi:a=true,lang:l}){let[u,p]=react.useState({categorySlug:null,tagSlug:null}),[c,g]=react.useState(()=>a?fn:{...fn,source:"polymarket"}),{isOpen:d,onOpen:m,onClose:h}=ui$1.useDisclosure(),{onOpen:v}=uiScaffold.useAsyncModal(mn),f=react.useCallback((N,C,I)=>{t?.(N,C,I),v({params:{event:N,market:C,initialOutcome:I,onInsufficientBalance:s}});},[t,v,s]),y=react.useCallback(N=>{p(N);},[]),x=react.useCallback(N=>{g(C=>({...C,sortPreset:N}));},[]),k=react.useCallback(N=>{g(C=>({...C,sortAsc:N}));},[]),b=react.useCallback(N=>{g(N);},[]),S=react.useMemo(()=>Vs[c.sortPreset].sort_by,[c.sortPreset]),M=react.useMemo(()=>ui(c,a),[c,a]),B=react.useMemo(()=>jsxRuntime.jsx(js,{sortPreset:c.sortPreset,onSortChange:x,sortAsc:c.sortAsc,onSortAscChange:k,onFilterPress:m,filterCount:M}),[c.sortPreset,c.sortAsc,M,x,k,m]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative",width:"100%",maxWidth:1680,margin:"0 auto"},children:[jsxRuntime.jsx("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(vs,{onSelect:y,trailing:B})}),jsxRuntime.jsxs("div",{style:{padding:"12px 8px 80px"},children:[jsxRuntime.jsx(zs,{isOpen:d,onClose:h,value:c,onChange:b,enableKalshi:a}),jsxRuntime.jsx(ga,{tagSlugSelection:u,lang:l,sort_by:S,sort_asc:c.sortAsc,source:c.source,timeRemaining:c.timeRemaining,minVolume:c.minVolume,minLiquidity:c.minLiquidity,onSelect:e,onSelectOutcome:f,getEventHref:r,LinkComponent:n,onHover:o})]}),jsxRuntime.jsx(no,{})]})}function xa(e){return utils$1.formatAmountInUsd(e)}var Bp=[{key:"total_events",labelKey:"predict.events.stats.totalEvents",format:e=>utils$1.formatAmount(e),valueColor:"#c7ff2e",gradientFrom:"rgba(199,255,46,0.18)",gradientTo:"rgba(199,255,46,0.04)"},{key:"total_volume_24h",labelKey:"predict.events.stats.volume24h",format:xa,valueColor:"#f76816",gradientFrom:"rgba(247,104,22,0.18)",gradientTo:"rgba(247,104,22,0.04)"},{key:"avg_liquidity",labelKey:"predict.events.stats.avgLiquidity",format:xa,valueColor:"#17c964",gradientFrom:"rgba(23,201,100,0.18)",gradientTo:"rgba(23,201,100,0.04)"},{key:"active_sources",labelKey:"predict.events.stats.activeSources",format:e=>utils$1.formatAmount(e),valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)"}];function qy({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
37
37
  @keyframes evt-live-ping{75%,100%{transform:scale(2.2);opacity:0}}
38
38
  @keyframes evt-live-breathe{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.85)}}
39
39
  @keyframes evtHeroTitleEnter{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
@@ -71,15 +71,15 @@
71
71
  .evt-stat-label{font-size:11px;line-height:16px;min-height:16px;white-space:nowrap}
72
72
  @media(min-width:640px){.evt-stat-label{font-size:12px;line-height:18px;min-height:18px}}
73
73
  `}),jsxRuntime.jsxs("div",{className:"evt-hero-outer",children:[jsxRuntime.jsxs("div",{className:"evt-hero-left",style:{minWidth:0,flex:1,animation:"evtHeroTitleEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both"},children:[jsxRuntime.jsx("div",{className:"evt-hero-live",style:{marginBottom:16},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:"evt-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:"evt-live-breathe 2.4s ease-in-out infinite"}})]}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:500,color:"#d4d4d8",letterSpacing:"0.025em"},children:t("predict.events.liveBadge")})]})}),jsxRuntime.jsxs("h1",{className:"evt-hero-title",style:{fontFamily:"var(--font-dm-sans, 'DM Sans', sans-serif)",fontWeight:700,letterSpacing:"-1.2px",lineHeight:1.2,color:"#fff",margin:"0 0 14px"},children:[jsxRuntime.jsxs("span",{style:{color:"#fff"},children:[t("predict.events.titlePrefix")," "]}),jsxRuntime.jsx("span",{style:{backgroundImage:"linear-gradient(to right, #c7ff2e, #a0e515, #17c964)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:t("predict.events.titleHighlight")})]}),jsxRuntime.jsx("p",{className:"evt-hero-subtitle evt-hero-subtitle-text",style:{lineHeight:1.6,color:"#71717a",maxWidth:460},children:String(t("predict.events.heroSubtitle")).split(`
74
- `).map((r,n)=>jsxRuntime.jsxs("span",{children:[n>0&&jsxRuntime.jsx("br",{className:"hidden sm:block"}),r,n===0?" ":""]},n))})]}),jsxRuntime.jsx("div",{className:"evt-stat-grid",style:e?{animation:"evtStatsEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:"0.1s"}:{},children:bp.map((r,n)=>jsxRuntime.jsxs("div",{style:{padding:"14px 16px",background:e?`linear-gradient(to bottom, ${r.gradientFrom}, ${r.gradientTo})`:"rgba(255,255,255,0.02)",borderRight:n%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:n<2?"1px solid rgba(39,39,42,0.4)":"none",...e?{animation:"evtStatCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:`${150+n*60}ms`}:{}},children:[jsxRuntime.jsx("div",{className:"evt-stat-val",style:{fontWeight:700,fontVariantNumeric:"tabular-nums",color:e?r.valueColor:"transparent",display:"flex",alignItems:"center"},children:e?r.format(e[r.key]):jsxRuntime.jsx("div",{style:{height:16,width:56,borderRadius:4,background:"rgba(255,255,255,0.06)",animation:"evtStatCardEnter 0.6s ease-out both",animationDelay:`${n*80}ms`}})}),jsxRuntime.jsx("div",{className:"evt-stat-label",style:{fontWeight:500,color:e?"#71717a":"transparent",marginTop:2,display:"flex",alignItems:"center"},children:e?t(r.labelKey):jsxRuntime.jsx("div",{style:{height:10,width:64,borderRadius:4,background:"rgba(255,255,255,0.04)",animation:"evtStatCardEnter 0.6s ease-out both",animationDelay:`${50+n*80}ms`}})})]},r.key))})]})]})}function sa({event:e,market:t,position:r,onSuccess:n,onCancel:o}){let{t:i,i18n:a}=i18n.useTranslation(),{mutateAsync:s}=reactPredict.useRedeemPosition(),{start:c}=reactPredict.useTradeResultConfirmation(),{evmAddress:u}=yr(),m=walletConnector.useWallets(),[l,f]=react.useState("idle"),[d,p]=react.useState(null),h=t.provider_meta?.["polymarket.conditionId"],g=t.provider_meta?.["polymarket.negRisk"]??false,v=u??"",x=react.useMemo(()=>Wr(i,a),[a,i]),k=react.useMemo(()=>m.find(Q=>Q.chainNamespace===types.ChainNamespace.EVM&&Q.isConnected),[m]),S=ia(r.side,t.outcomes),y=t.outcomes?.[S]?.label??r.side,M=t.result!=null?ia(t.result,t.outcomes):-1,P=(M>=0?t.outcomes?.[M]:void 0)?.label??t.result??"",C=t.result!=null?S===M:true,I=react.useMemo(()=>C?r.size:0,[C,r.size]),B=react.useCallback(async()=>{if(!(!h||!v||!k)){f("pending"),p(null);try{let Q=await k.getEip1193Provider();if(!Q)throw new Error("EIP-1193 provider unavailable");await s({wallet_address:v,condition_id:h,neg_risk:g,signMessage:async N=>await Q.request({method:"personal_sign",params:[N,v]}),signTypedData:async N=>await Q.request({method:"eth_signTypedData_v4",params:[v,JSON.stringify(N)]})}),f("confirming");let q=Ur({messages:x});q.submitted(),await c({source:r.source,user:v,marketSlug:r.market?.slug??t.slug,eventSlug:r.event?.slug??e?.slug,expectation:"redeem",expectedPayout:I})==="confirmed"?(f("success"),q.completed()):(f("delayed"),q.delayed()),n?.();}catch(Q){f("error"),p(Q instanceof Error?Q.message:i("predict.redeem.error"));}}},[h,v,g,k,s,x,c,r.source,r.market?.slug,r.event?.slug,t.slug,e?.slug,I,n,i]),Y=walletConnector.useAuthCallback(B),z=l==="idle"&&!!h&&!!v&&!!k&&r.redeemable;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[jsxRuntime.jsx("div",{className:"text-base font-medium text-white",children:e?.title??t.question}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2 rounded-xl bg-[rgba(39,39,42,0.4)] p-3",children:[jsxRuntime.jsx(eo,{label:i("predict.positions.side"),value:y,valueClassName:C?"text-green-400":"text-red-400"}),t.result!=null&&jsxRuntime.jsx(eo,{label:i("predict.redeem.result"),value:P,valueClassName:"text-green-400"}),jsxRuntime.jsx(eo,{label:i("predict.positions.size"),value:r.size.toFixed(2)}),jsxRuntime.jsx(eo,{label:i("predict.redeem.expectedPayout"),value:`$${I.toFixed(2)}`,valueClassName:I>0?"text-green-400":"text-zinc-400"})]}),!C&&I===0&&jsxRuntime.jsx("p",{className:"text-sm text-zinc-500",children:i("predict.redeem.noWinnings")}),l==="error"&&d&&jsxRuntime.jsx("p",{className:"text-sm text-red-400",children:d}),l==="success"&&jsxRuntime.jsx("p",{className:"text-sm text-green-400",children:i("predict.redeem.success")}),l==="delayed"&&jsxRuntime.jsx("p",{className:"text-sm text-zinc-400",children:i("predict.trade.resultDelayed",{defaultValue:"Your trade was submitted successfully. Confirmation is taking a little longer."})}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[l!=="success"&&l!=="delayed"&&jsxRuntime.jsx(ui$1.Button,{color:"success",className:"w-full h-12 rounded-xl text-sm font-semibold",isDisabled:!z,isLoading:l==="pending"||l==="confirming",onPress:Y,spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),children:i("predict.redeem.confirm")}),o&&l!=="success"&&l!=="delayed"&&jsxRuntime.jsx("button",{type:"button",onClick:o,className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")}),(l==="success"||l==="delayed")&&o&&jsxRuntime.jsx(ui$1.Button,{className:"w-full h-12 rounded-xl text-sm font-medium",onPress:o,children:i("common.ok")})]})]})}function eo({label:e,value:t,valueClassName:r="text-white"}){return jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm text-zinc-400",children:e}),jsxRuntime.jsx("span",{className:`text-sm font-medium ${r}`,children:t})]})}function ia(e,t){let r=e.toLowerCase();if(r==="yes")return 0;if(r==="no"||!t)return 1;let n=t.findIndex(o=>o.label.toLowerCase()===r);return n>=0?n:1}var Ip="predict-redeem";function la({id:e=Ip}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Op,{...t})})}function Op({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui$1.useScreen();return e?jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{className:o?"":"p-2",children:[jsxRuntime.jsxs("div",{className:"px-4 pt-4 pb-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-white",children:n("predict.redeem.title")}),jsxRuntime.jsx("p",{className:"text-sm text-zinc-400 mt-1",children:n("predict.redeem.description")})]}),jsxRuntime.jsx(sa,{event:e.event,market:e.market,position:e.position,onSuccess:()=>{setTimeout(()=>r(false),1500);},onCancel:()=>r(false)})]})})}):null}function ii(e){return e?.trim().toLowerCase()??""}function oi(e,t){let r=e.provider_meta?.[t];return typeof r=="string"?r:""}function pa(e,t){return !!(e&&t&&e.trim().toLowerCase().includes(t))}function dm(e,t){let r=ii(e.side);if(r==="yes"||r==="no")return r;if(r==="over"||r==="odd")return "yes";if(r==="under"||r==="even")return "no";let n=[t.outcomes?.[0]?.label,oi(t,"polymarket.groupItemTitle"),oi(t,"polymarket.groupItemTitleTrans"),oi(t,"polymarket.group_item_title_trans")],o=[t.outcomes?.[1]?.label];return n.some(i=>pa(i,r))?"yes":o.some(i=>pa(i,r))?"no":null}function ma({market:e,initialOutcome:t="yes",initialPositionSide:r,slippageBps:n=100,onSuccess:o}){let{t:i,i18n:a}=i18n.useTranslation(),s=react.useRef(o);s.current=o;let{status:c}=walletConnector.useAuth(),u=walletConnector.useWallets(),m=reactPredict.usePredictClient(),l=react.useContext(reactPredict.PolymarketContext),f=reactQuery.useQueryClient(),{start:d}=reactPredict.useTradeResultConfirmation(),p=e.source,h=p==="polymarket",g=u.find(T=>T.chainNamespace===types.ChainNamespace.SOLANA&&T.isConnected),v=u.find(T=>T.chainNamespace===types.ChainNamespace.EVM&&T.isConnected&&"switchChain"in T),x=c==="authenticated",k=g?.address,S=v?.address,[b,y]=react.useState(t),[M,A]=react.useState("market"),[P,C]=react.useState(NaN),[I,B]=react.useState(NaN),[Y,z]=react.useState(false),[Q,q]=react.useState(false),[te,N]=react.useState(null),[E,H]=react.useState(null),[J,de]=react.useState(false),[se,Ve]=react.useState(false),[je,Ge]=react.useState("1h"),[w,ft]=react.useState(30),[qe,Le]=react.useState("minutes"),Nt=react.useMemo(()=>Wr(i,a),[a,i]),Re=true,Ye=react.useCallback(async(T,Se)=>{let Pe=Ur({messages:Nt});Pe.submitted(),await d({source:p,user:p==="kalshi"?k:S,kalshiUser:Re?k:void 0,polymarketUser:S,marketSlug:e.slug,eventSlug:e.event_slug,expectation:T,getOrdersHeaders:Se})==="confirmed"?Pe.completed():Pe.delayed();},[d,Re,S,e.event_slug,e.slug,p,Nt,k]),ot=react.useMemo(()=>{if(p!=="polymarket")return;let T=e.provider_meta?.["polymarket.clobTokenIds"];return T?(typeof T=="string"?JSON.parse(T):T)[b==="yes"?0:1]:void 0},[p,e.provider_meta,b]),{data:_e,isLoading:et}=reactPredict.useTickSize(ot),Ie=reactPredict.normalizePolymarketTickSize(_e?.minimum_tick_size),{data:it,isLoading:Ot}=reactPredict.useFeeRate(ot),Ct=String(it?.base_fee??0),{data:Mt}=reactPredict.useRebateConfig(),tt=Mt?.builder_enabled&&Mt.builder_code?Mt.builder_code:void 0,gt=false,We=null,qt=false,Oe,Qe,me;try{let T=yr();Re=T.enableKalshi,gt=T.kalshiKycVerified,We=T.kalshiKycUrl,qt=T.polymarketSetupVerified,Oe=T.polymarketSafeAddress,Qe=T.polymarketWalletKind,me=T.polymarketWalletAddress;}catch{}let st=p==="kalshi"&&!gt,ht=p==="polymarket"&&!qt,ve=react.useCallback(async()=>{if(!v||!l)return null;let T=await v.getEip1193Provider();if(!T)return null;let Se=Qe==="deposit"&&!!me,Pe=!Se&&!!Oe,De={address:v.address,signatureType:Se?3:Pe?2:0,signTypedData:async(dt,Zt,zt,Ae)=>{let ar=[];"name"in dt&&ar.push({name:"name",type:"string"}),"version"in dt&&ar.push({name:"version",type:"string"}),"chainId"in dt&&ar.push({name:"chainId",type:"uint256"}),"verifyingContract"in dt&&ar.push({name:"verifyingContract",type:"address"}),"salt"in dt&&ar.push({name:"salt",type:"bytes32"});let _n={EIP712Domain:ar,...Zt};return await T.request({method:"eth_signTypedData_v4",params:[v.address,JSON.stringify({domain:dt,types:_n,primaryType:zt,message:Ae})]})}};return l.credentials??await l.authenticate(De)},[Oe,Qe,me,v,l]),{data:Xe}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:p,outcome:b},{enabled:e.status==="open"}),we=react.useMemo(()=>{let T=reactPredict.pickBestBid(Xe,b);if(T!=null&&T>0)return T;let Se=b==="yes"?0:1,Pe=e.outcomes[Se];return Pe?.best_bid??Pe?.price??.5},[Xe,e.outcomes,b]),Tt=p==="kalshi"?k??"":S??"",{data:R,isLoading:Ne}=reactPredict.usePositionsMulti({kalshi_user:p==="kalshi"?Tt:void 0,polymarket_user:p==="polymarket"?Tt:void 0},{enabled:!!Tt,refetchInterval:3e4}),Ue=ii(r),Zr=r?.trim(),D=react.useMemo(()=>R?R.positions.find(T=>T.market?.slug!==e.slug?false:Ue?ii(T.side)===Ue:dm(T,e)===b)??null:null,[R,e,e.slug,b,Ue]),Ce=Zr||D?.side||b,vt=react.useCallback(async()=>{let T=await ve();return T?await reactPredict.buildPolymarketL2Headers(T.address,{apiKey:T.apiKey,secret:T.secret,passphrase:T.passphrase,method:"GET",requestPath:"/data/orders",body:""}):{}},[ve]),{data:Dt,isLoading:en}=reactPredict.useAvailableShares({source:p,user:Tt,market:e.slug,side:Ce},p==="polymarket"?{getHeaders:vt}:void 0,{enabled:!!Tt&&!!e.slug,refetchOnMount:"always"}),Eo=e.provider_meta?.["dflow.yesMint"]??"",Lo=e.provider_meta?.["dflow.noMint"]??"",Yt=utils$1.SOLANA_TOKENS.stablecoins.USDC.address,Lr=e.provider_meta?.["dflow.collateralMint"]||"",Ro=b==="yes"?Eo:Lo,at=react.useMemo(()=>p==="polymarket"?reactPredict.getPolymarketSharesPrecision(Ie):Dt?.precision??0,[p,Ie,Dt?.precision]),Et=Dt?.active_order_shares??0,Rr=p==="polymarket"&&!!D?.size&&(Dt?.total_shares??0)<=0&&(Dt?.available_shares??0)<=0,tn=Rr?D?.size??0:0,_r=Rr?tn:Dt?.total_shares??0,sr=Rr?Math.max(0,tn-Et):Dt?.available_shares??0,_o=en||Ne,En=D?.market?.provider_meta,Ir=En?.["dflow.outcomeMint"]||Ro,Qt=En?.["dflow.collateralMint"]||Lr,fr=Ir,gr=Qt||Yt,hr=react.useMemo(()=>isNaN(P)||P<=0?"0":String(Math.round(P*1e6)),[P]),rn=p==="kalshi"&&!!fr&&!!gr&&!!k&&hr!=="0",{refetch:nn}=reactPredict.useDFlowQuote({inputMint:fr,outputMint:gr,amount:hr,userPublicKey:k??"",slippageBps:100},{enabled:rn}),Or=react.useMemo(()=>isNaN(P)||P<=0?0:P,[P]),Lt=react.useMemo(()=>reactPredict.walkOrderbook({orderbook:Xe,outcome:b,side:"sell",sharesNeeded:Or,slippageBps:n}),[Xe,b,Or,n]),_=react.useMemo(()=>Lt.status==="ok"&&Lt.worstPrice!=null&&Lt.worstPrice>0?Lt.worstPrice:we,[Lt,we]),Me=react.useMemo(()=>M==="limit"&&h&&!isNaN(I)?I:_,[M,h,I,_]),ke=react.useMemo(()=>isNaN(P)||P<=0?0:P*Me,[P,Me]),Rt=react.useMemo(()=>p!=="polymarket"?0:ls({grossReturn:ke,pricePerShare:Me,feeRateBps:Number(Ct)}),[p,ke,Me,Ct]),on=react.useMemo(()=>Math.max(0,ke-Rt),[ke,Rt]),Xt=react.useCallback(T=>{y(T),B(NaN),C(NaN),q(false);},[]);react.useEffect(()=>{Xt(t);},[t,Xt]);let Jt=react.useCallback(T=>{A(T);},[]);react.useEffect(()=>{M==="limit"&&B(Math.round(we*1e4)/1e4);},[M,b]);let lt=react.useCallback(T=>{if(q(false),isNaN(T)){C(NaN);return}C(be(Math.max(0,T),at));},[at]),Io=react.useCallback(()=>{q(true),C(be(sr,at));},[sr,at]),Ln=react.useCallback(T=>{if(isNaN(T)){B(NaN);return}B(Math.round(T*1e4)/1e4);},[]),Ht=react.useCallback(()=>{C(NaN),B(NaN),A("market"),q(false),Ve(false),Ge("1h"),ft(30),Le("minutes");},[]),Dr=react.useMemo(()=>{let T=[];return isNaN(P)||P<=0?T.push(i("predict.trade.minQuantity",{amount:zn})):P<zn&&T.push(i("predict.trade.minQuantity",{amount:zn})),e.status!=="open"&&T.push(i("predict.trade.marketNotActive")),!isNaN(P)&&P>0&&!Q&&P>sr&&T.push(i("predict.trade.insufficientSharesDetail",{total:be(_r,at).toFixed(at),active:be(Et,at).toFixed(at),available:be(sr,at).toFixed(at)})),M==="limit"&&h&&(isNaN(I)||I<.01||I>.99)&&T.push(i("predict.trade.limitPriceRange")),M==="limit"&&h&&se&&je==="custom"&&(isNaN(w)||w<=0)&&T.push(i("predict.trade.expiration.invalidDate")),p==="polymarket"&&M==="market"&&!isNaN(P)&&P>0&&(Lt.status==="insufficient_liquidity"?T.push(i("predict.trade.insufficientLiquidity",{available:be(Lt.totalAvailable,2)})):Lt.status==="exceeds_slippage"&&T.push(i("predict.trade.priceImpactTooHigh",{impact:(Lt.priceImpactBps/100).toFixed(2),slippage:(n/100).toFixed(2)}))),{isValid:T.length===0,errors:T}},[P,e.status,sr,_r,Et,Q,M,h,I,se,je,w,at,p,Lt,n,i]),{mutateAsync:Ar}=reactPredict.useDFlowSubmit(),{data:vr}=reactPredict.useOrder({id:te??"",source:p},{enabled:!!te}),Rn=react.useCallback(async()=>{if(!E||!k||!g)return;let{cashAmount:T,collateral:Se}=E;H(null);try{let De=(await m.createDFlowQuote({inputMint:Se,outputMint:Yt,amount:T,userPublicKey:k,slippageBps:100}))?.transaction;if(!De)return;let dt=Uint8Array.from(atob(De),zt=>zt.charCodeAt(0)),Zt=await g.signTransaction(dt);await Ar({signedTransaction:btoa(String.fromCharCode(...Zt)),orderContext:{user_public_key:k,input_mint:Se,output_mint:Yt,amount:T,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[E,k,g,m,Ar,Yt]),br=react.useCallback(()=>{f.invalidateQueries({queryKey:["predict","available-shares"]});},[f]);react.useEffect(()=>{if(!vr||!te)return;let{status:T}=vr;T==="closed"?(N(null),E?Rn().finally(()=>{z(false),Ye("sell-market"),br(),Ht(),s.current?.();}):(z(false),Ye("sell-market"),br(),Ht(),s.current?.())):(T==="failed"||T==="expired")&&(z(false),N(null),H(null),ui$1.toast.error(i("predict.trade.submitError")));},[vr,te,E,Rn,Ye,br,Ht,i]);let Fr=react.useCallback(async()=>{if(!k||!g)return;if(!fr||!gr){ui$1.toast.error("Missing token mint addresses"),z(false);return}if(!gt){de(true),z(false);return}let Pe=(await nn()).data,De=Pe?.transaction;if(!De){ui$1.toast.error(i("predict.trade.submitError")),z(false);return}if(Qt&&Qt!==Yt){let Ae=String(Pe?.outAmount??"");Ae&&Ae!=="0"&&H({cashAmount:Ae,collateral:Qt});}let dt=Uint8Array.from(atob(De),Ae=>Ae.charCodeAt(0)),Zt=await g.signTransaction(dt),zt=await Ar({signedTransaction:btoa(String.fromCharCode(...Zt)),orderContext:{user_public_key:k,input_mint:fr,output_mint:gr,amount:hr,price:String(we),side:"SELL",outcome:b==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});N(zt.signature);},[k,g,nn,Ar,fr,gr,hr,we,b,e.slug,Qt,Yt,i,gt]),Br=react.useCallback(async()=>{if(!v||!l)return;let T=v.chain,Se=T!==types.Chain.POLYGON;Se&&await v.switchChain(types.Chain.POLYGON);try{let Pe=await v.getEip1193Provider();if(!Pe){ui$1.toast.error(i("predict.trade.submitError")),z(!1);return}let De=Qe==="deposit"&&!!me,dt=!De&&!!Oe,Zt=De?me:Oe,zt={address:v.address,signatureType:De?3:dt?2:0,signTypedData:async(Wt,On,Ao,Fo)=>{let Hr=[];"name"in Wt&&Hr.push({name:"name",type:"string"}),"version"in Wt&&Hr.push({name:"version",type:"string"}),"chainId"in Wt&&Hr.push({name:"chainId",type:"uint256"}),"verifyingContract"in Wt&&Hr.push({name:"verifyingContract",type:"address"}),"salt"in Wt&&Hr.push({name:"salt",type:"bytes32"});let Ic={EIP712Domain:Hr,...On};return await Pe.request({method:"eth_signTypedData_v4",params:[v.address,JSON.stringify({domain:Wt,types:Ic,primaryType:Ao,message:Fo})]})}},Ae=await ve();if(!Ae){ui$1.toast.error(i("predict.trade.submitError")),z(!1);return}let ar=b==="yes"?0:1,_n="",In=e.provider_meta?.["polymarket.clobTokenIds"];In&&(_n=(typeof In=="string"?JSON.parse(In):In)[ar]??"");let Gi=e.provider_meta?.["polymarket.negRisk"]??!1,Rc=M==="limit"&&!isNaN(I)?I:_,_c=$n(Rc,Ie),Oo={tokenId:_n,price:_c,size:P,side:"SELL",orderType:M==="limit"?se?"GTD":"GTC":"FOK",tickSize:Ie,negRisk:Gi,...Zt&&{funderAddress:Zt},...tt&&{builderCode:tt},...M==="limit"&&se&&{expiration:Un(je,w,qe)}},Do;if(De)Do=await reactPredict.buildSignedV2OrderPayload({signer:zt,depositWalletAddress:Zt,input:Oo,owner:Ae.apiKey});else {let Wt=reactPredict.buildCtfExchangeDomain(Gi),On=reactPredict.buildOrderMessage({...Oo,signerAddress:zt.address,signatureType:zt.signatureType,feeRateBps:Ct}),Ao=await zt.signTypedData(Wt,reactPredict.CTF_ORDER_TYPES,"Order",On),Fo=reactPredict.buildSignedOrder(On,Ao,Oo.orderType);Do=reactPredict.buildClobPayload(Fo,Ae.apiKey);}await m.executePolymarketOrder({payload:Do,l2_api_key:Ae.apiKey,l2_secret:Ae.secret,l2_passphrase:Ae.passphrase,signer_address:Ae.address,owner:Ae.apiKey}),br(),Ye(M==="limit"?"sell-limit":"sell-market",async()=>await reactPredict.buildPolymarketL2Headers(Ae.address,{apiKey:Ae.apiKey,secret:Ae.secret,passphrase:Ae.passphrase,method:"GET",requestPath:"/data/orders"})),Ht(),z(!1),s.current?.();}finally{Se&&T&&v.switchChain(T).catch(()=>{});}},[v,l,ve,b,e.provider_meta,M,Ye,I,_,P,m,br,se,je,w,qe,Ht,i,Ie,Ct,e.slug,Oe,Qe,me,tt]),_t=react.useCallback(async()=>{if(!(!Dr.isValid||!x)){z(true),N(null),de(false);try{p==="kalshi"?await Fr():await Br();}catch(T){let Se=T instanceof Error?T.message:"",Pe=p==="polymarket"&&Se?Kn(Se,i,"sell"):Se||void 0;ui$1.toast.error(Pe||i("predict.trade.submitError")),z(false);}}},[Dr.isValid,x,p,Fr,Br,i]);return {outcome:b,orderType:M,quantity:P,limitPrice:I,shares:Or,effectivePrice:Me,grossReturn:ke,estimatedFee:Rt,estimatedReturn:on,pricePerShare:we,isMarketDataLoading:p==="polymarket"&&(Ot||et),isSubmitting:Y,authStatus:c,validation:Dr,supportsLimitOrder:h,kycRequired:J,needsKyc:st,needsSetup:ht,kycUrl:We,totalShares:_r,activeOrderShares:Et,availableShares:sr,isAvailableLoading:_o,isSellAll:Q,precision:at,expirationEnabled:se,expirationPreset:je,customDuration:w,customDurationUnit:qe,setOutcome:Xt,setOrderType:Jt,setQuantity:lt,setLimitPrice:Ln,setSellAll:Io,setExpirationEnabled:Ve,setExpirationPreset:Ge,setCustomDuration:ft,setCustomDurationUnit:Le,submit:_t}}var ym=["5m","1h","12h","24h","eod","custom"],km={"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"},Sm=["minutes","hours","days"],Pm={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},wm={maximumFractionDigits:0},mn="-";function ka({event:e,market:t,variant:r="bordered",outcome:n,orderType:o,quantity:i,limitPrice:a,effectivePrice:s,grossReturn:c,estimatedFee:u,estimatedReturn:m,isMarketDataLoading:l,isSubmitting:f,authStatus:d,isValid:p,validationErrors:h,supportsLimitOrder:g,kycRequired:v,needsKyc:x,needsSetup:k,onSetupRequired:S,kycUrl:b,totalShares:y,activeOrderShares:M,availableShares:A,isAvailableLoading:P,precision:C,expirationEnabled:I,expirationPreset:B,customDuration:Y,customDurationUnit:z,oddsFormatter:Q,outcomeLabels:q,onOutcomeChange:te,onOrderTypeChange:N,onQuantityChange:E,onLimitPriceChange:H,onSellAll:J,onExpirationEnabledChange:de,onExpirationPresetChange:se,onCustomDurationChange:Ve,onCustomDurationUnitChange:je,onSubmit:Ge}){let{t:w}=i18n.useTranslation(),[ft,qe]=react.useState(false),[Le,Nt]=react.useState(true),Re=ui$1.useDisclosure(),[Ye,ot]=react.useState(""),_e=react.useRef(false);react.useEffect(()=>{_e.current||ot(isNaN(i)?"":String(i));},[i]);let[et,Ie]=react.useState(""),it=react.useRef(false);react.useEffect(()=>{it.current||(isNaN(a)?Ie(""):Ie(String(parseFloat((a*100).toFixed(2)))));},[a]);let Ot=react.useCallback(R=>{if(R!==""&&!/^\d*\.?\d{0,2}$/.test(R))return;if(Ie(R),R===""||R==="."){H(NaN);return}let Ue=parseFloat(R);isNaN(Ue)||H(Ue/100);},[H]),Ct=react.useCallback(R=>{let Ne=new RegExp(`^\\d*\\.?\\d{0,${C}}$`);if(R!==""&&!Ne.test(R))return;if(ot(R),qe(false),R===""||R==="."){E(NaN);return}let Ue=parseFloat(R);isNaN(Ue)||E(Ue);},[E,C]);react.useEffect(()=>{v&&!Re.isOpen&&Re.onOpen();},[v]);let Mt=react.useMemo(()=>{let R=n==="yes"?t.yesBid:t.noBid;return R!=null?parseFloat((Number(R)*100).toFixed(2)):null},[n,t]),tt=n==="yes"?t.yesBid:t.noBid,gt=tt!=null&&Q?Q(Number(tt)):Mt!=null?`${Mt} \xA2`:null,We=Number.isFinite(s)?parseFloat((s*100).toFixed(2)):null,qt=Number.isFinite(s)&&Q?Q(s):We!=null?`${We} \xA2`:null,Oe=!isNaN(i)&&i>0,Qe=Oe&&i>0?m/i:0,me=Qe>0&&Q?Q(Qe):Qe>0?`${parseFloat((Qe*100).toFixed(2))} \xA2`:mn,st=d==="authenticated",ht=d==="authenticating"||d==="deauthenticating",ve=st&&(x||k),Xe=react.useCallback(R=>q?.[R]??w(R==="yes"?"predict.trade.yes":"predict.trade.no"),[q,w]),we=react.useMemo(()=>{if(ht)return w("predict.trade.checkingLogin");if(!st)return w("predict.trade.loginToTrade");if(x)return w("predict.trade.kycRequired");if(k)return w("predict.trade.setupRequired");if(P)return w("predict.trade.loadingBalance");if(l)return w("predict.trade.loadingMarketData");if(f)return w("predict.trade.submitting");if(v)return w("predict.trade.kycRequired");if(!Oe)return w("predict.trade.enterAmount");let R=Xe(n);return `${w("predict.trade.sell")} ${R}`},[ht,st,x,k,P,l,f,v,Oe,n,Xe,w]),Tt=()=>{if(!st){qe(false),Ge();return}if(x){Re.onOpen();return}if(k&&S){qe(false),S();return}if(v){Re.onOpen();return}if(!p){qe(true);return}qe(false),Ge();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter:R=>{r==="bordered"&&(R.currentTarget.style.borderColor="rgba(63,63,70,0.8)");},onMouseLeave:R=>{r==="bordered"&&(R.currentTarget.style.borderColor="rgba(39,39,42,0.6)");},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:"text-bearish",children:[w("predict.trade.sell")," ",Xe(n)]}),jsxRuntime.jsxs("span",{className:"text-foreground",children:[" \xB7 ",t.yesSubTitle]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[g?jsxRuntime.jsxs(ui$1.Tabs,{variant:"underlined",selectedKey:o,onSelectionChange:R=>N(R),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui$1.Tab,{title:w("predict.trade.market")},"market"),jsxRuntime.jsx(ui$1.Tab,{title:w("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:w("predict.trade.market")}),o==="limit"&&g?jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:et,onChange:R=>Ot(R.target.value),onFocus:()=>{it.current=true;},onBlur:()=>{it.current=false,isNaN(a)?Ie(""):Ie(String(parseFloat((a*100).toFixed(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"}}):gt!=null&&jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums",children:gt})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(R=>{let Ne=R==="yes"?t.yesBid:t.noBid;return jsxRuntime.jsx("div",{className:"flex flex-1 flex-col gap-y-1",children:jsxRuntime.jsxs("button",{type:"button",onClick:()=>te(R),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${n===R?"border-bearish bg-bearish/10 text-bearish":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:Xe(R)}),Ne!=null&&jsxRuntime.jsx("span",{className:"ml-1 opacity-70",children:Q?Q(Number(Ne)):`${parseFloat((Number(Ne)*100).toFixed(2))}\xA2`})]})},R)})}),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:w("predict.trade.sellContracts")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[[25,50].map(R=>{let Ne=Math.pow(10,C);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{E(Math.floor(A*R/100*Ne)/Ne);},className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:[R,"%"]},R)}),jsxRuntime.jsx("button",{type:"button",onClick:J,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:w("common.all")})]})]}),jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Sell quantity",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:Ye,onChange:R=>Ct(R.target.value),onFocus:()=>{_e.current=true;},onBlur:()=>{_e.current=false,ot(isNaN(i)?"":String(i));},classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),ft&&h.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:h.map(R=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:R},R))})]}),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:w("predict.trade.totalShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:P?"\u2013":`${be(y,C).toFixed(C)}${w("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.activeOrders")}),jsxRuntime.jsx("span",{className:"tabular-nums text-warning",children:P?"\u2013":M>0?`-${be(M,C).toFixed(C)}${w("predict.trade.sharesUnit")}`:`0${w("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.availableShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-success font-medium",children:P?"\u2013":`${be(A,C).toFixed(C)}${w("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.estReturn")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${m.toFixed(2)}`:"\u2013"})]})]}),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:()=>Nt(R=>!R),className:"flex items-center gap-x-1 text-neutral-500 hover:text-foreground cursor-pointer transition-colors",children:[jsxRuntime.jsx("span",{children:w("predict.trade.odds")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-3.5 w-3.5 transition-transform",Le&&"rotate-180")})]}),jsxRuntime.jsx("span",{className:"text-foreground font-medium tabular-nums",children:Q&&Number.isFinite(s)?qt:We!=null?w("predict.trade.chance",{percent:We}):mn})]}),Le&&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:w("predict.trade.numContracts")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?kr(i):mn})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.totalSize")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:Oe?`$${c.toFixed(2)}`:mn})]}),(u??0)>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.estFee")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:`$${(u??0).toFixed(2)}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.estReturnAfterFees")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:Oe?`$${m.toFixed(2)}`:mn})]}),(u??0)>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:w("predict.trade.effectiveOdds")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:me})]})]})]}),o==="limit"&&g&&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:w("predict.trade.setExpiration")}),jsxRuntime.jsx(ui$1.StyledSwitch,{size:"sm",color:"primary",isSelected:I,onValueChange:de,"aria-label":w("predict.trade.setExpiration")})]}),I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui$1.Select,{"aria-label":w("predict.trade.setExpiration"),selectedKeys:[B],onSelectionChange:R=>{let Ne=Array.from(R)[0];Ne&&se(Ne);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:ym.map(R=>jsxRuntime.jsx(ui$1.SelectItem,{children:w(km[R])},R))}),B==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui$1.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(Y)?void 0:Y,onValueChange:Ve,minValue:1,step:1,formatOptions:wm,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$1.Select,{"aria-label":"Duration unit",selectedKeys:[z],onSelectionChange:R=>{let Ne=Array.from(R)[0];Ne&&je(Ne);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Sm.map(R=>jsxRuntime.jsx(ui$1.SelectItem,{children:w(Pm[R])},R))})]})]})]}),jsxRuntime.jsx(ui$1.Button,{color:"secondary",fullWidth:true,radius:"lg",size:"lg",isDisabled:ht||st&&!ve&&(P||l||!Oe||f),isLoading:ht||st&&!ve&&(f||P||l),spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),onPress:Tt,children:we})]}),jsxRuntime.jsx(jn,{isOpen:Re.isOpen,onClose:Re.onClose,kycUrl:b})]})}function no({event:e,market:t,variant:r,initialOutcome:n,initialPositionSide:o,chain:i,slippageBps:a,onOutcomeChange:s,onSetupRequired:c,onSuccess:u,oddsFormatter:m,outcomeLabels:l}){let{outcome:f,orderType:d,quantity:p,limitPrice:h,effectivePrice:g,grossReturn:v,estimatedFee:x,estimatedReturn:k,pricePerShare:S,isMarketDataLoading:b,isSubmitting:y,authStatus:M,validation:A,supportsLimitOrder:P,kycRequired:C,needsKyc:I,needsSetup:B,kycUrl:Y,totalShares:z,activeOrderShares:Q,availableShares:q,isAvailableLoading:te,precision:N,expirationEnabled:E,expirationPreset:H,customDuration:J,customDurationUnit:de,setOutcome:se,setOrderType:Ve,setQuantity:je,setLimitPrice:Ge,setSellAll:w,setExpirationEnabled:ft,setExpirationPreset:qe,setCustomDuration:Le,setCustomDurationUnit:Nt,submit:Re}=ma({market:t,initialOutcome:n,initialPositionSide:o,slippageBps:a,onSuccess:u}),Ye=walletConnector.useAuthCallback(Re),ot=react.useCallback(Ie=>{se(Ie),s?.(Ie);},[se,s]),_e=react.useMemo(()=>e?An(e):void 0,[e]),et=react.useMemo(()=>Fn(t,{yesBid:f==="yes"?S:void 0,noBid:f==="no"?S:void 0}),[t,f,S]);return jsxRuntime.jsx(ka,{event:_e,market:et,variant:r,outcome:f,orderType:d,quantity:p,limitPrice:h,effectivePrice:g,grossReturn:v,estimatedFee:x,estimatedReturn:k,isMarketDataLoading:b,isSubmitting:y,authStatus:M,isValid:A.isValid,validationErrors:A.errors,supportsLimitOrder:P,kycRequired:C,needsKyc:I,needsSetup:B,onSetupRequired:c,kycUrl:Y,totalShares:z,activeOrderShares:Q,availableShares:q,isAvailableLoading:te,precision:N,expirationEnabled:E,expirationPreset:H,customDuration:J,customDurationUnit:de,oddsFormatter:m,outcomeLabels:l,onOutcomeChange:ot,onOrderTypeChange:Ve,onQuantityChange:je,onLimitPriceChange:Ge,onSellAll:w,onExpirationEnabledChange:ft,onExpirationPresetChange:qe,onCustomDurationChange:Le,onCustomDurationUnitChange:Nt,onSubmit:Ye})}var li="predict-sell";function Pa({id:e=li}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Im,{...t})})}function Im({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui$1.useScreen();return e?jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{className:o?"":"p-2",children:[jsxRuntime.jsx(no,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,initialPositionSide:e.initialPositionSide,chain:e.chain,slippageBps:e.slippageBps,onSetupRequired:e.onSetupRequired,onSuccess:()=>r(false),variant:"flat"}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:n("common.cancel")})})]})})}):null}var ui=40,so=36,hn=480,pi=hn-so;function Ca({event:e,walletAddress:t,onCancelOrder:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState("positions"),a=react.useMemo(()=>e.markets?.map(l=>l.slug)??[],[e.markets]),{data:s}=reactPredict.usePositionsMulti({kalshi_user:e.source==="kalshi"?t:void 0,polymarket_user:e.source==="polymarket"?t:void 0}),c=react.useMemo(()=>!s?.positions||!t?0:a.length===0?s.positions.length:s.positions.filter(l=>l.market&&a.includes(l.market.slug)).length,[s?.positions,a,t]),m=[{key:"positions",label:c>0?`${n("predict.positions.title")} (${c})`:n("predict.positions.title")},{key:"orders",label:n("predict.openOrders.title")},{key:"trades",label:n("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:m.map(l=>jsxRuntime.jsx("button",{type:"button",onClick:()=>i(l.key),className:ui$1.cn("px-3 py-2 text-sm font-medium transition-colors cursor-pointer",o===l.key?"text-foreground border-b-2 border-primary":"text-neutral hover:text-foreground"),children:l.label},l.key))}),t?jsxRuntime.jsxs("div",{style:{height:hn},children:[o==="positions"&&jsxRuntime.jsx(zm,{source:e.source,walletAddress:t,marketSlugs:a}),o==="orders"&&jsxRuntime.jsx(Um,{source:e.source,walletAddress:t,marketSlugs:a,onCancelOrder:r}),o==="trades"&&jsxRuntime.jsx(Vm,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:hn},children:n("predict.trade.connectWallet")})]})}function zm({source:e,walletAddress:t,marketSlugs:r}){let{t:n}=i18n.useTranslation(),{data:o,isLoading:i}=reactPredict.usePositionsMulti({kalshi_user:e==="kalshi"?t:void 0,polymarket_user:e==="polymarket"?t:void 0}),a=react.useMemo(()=>o?.positions?r.length===0?o.positions:o.positions.filter(s=>s.market&&r.includes(s.market.slug)):[],[o?.positions,r]);return i?jsxRuntime.jsx(fi,{}):a.length===0?jsxRuntime.jsx(mi,{message:n("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:so},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2 whitespace-nowrap",children:n("predict.positions.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.markPrice")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:n("predict.positions.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:n("predict.positions.estSettlement")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:pi},rowComponent:Wm,rowCount:a.length,rowHeight:ui,rowProps:{positions:a,closeLabel:n("predict.positions.close")}})]})}function Wm({index:e,style:t,positions:r,closeLabel:n}){let o=r[e];if(!o)return null;let i=o.pnl??0,a=o.pnl_percent??0,s=o.avg_price??0,c=o.current_price??0,u=i>0?"text-success":i<0?"text-danger":"text-foreground",m=i>0?"+":"",l=o.market?.outcomes?.[0]?.label??o.market?.question??"\u2014",f=o.side,d=o.size,p=o.size*c,h=o.market?.end_at?qm(o.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:l}),jsxRuntime.jsx("span",{className:ui$1.cn("text-[10px] font-medium",f.toLowerCase()==="yes"?"text-primary":"text-secondary"),children:f})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:o.size}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",p.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:oo(s)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:oo(c)}),jsxRuntime.jsxs("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",u),children:[m,"$",Math.abs(i).toFixed(2),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",m,a.toFixed(1),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",d.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:h}),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:n})})]})}function Um({source:e,walletAddress:t,marketSlugs:r,onCancelOrder:n}){let{t:o}=i18n.useTranslation(),{data:i,isLoading:a,fetchNextPage:s,hasNextPage:c}=reactPredict.useInfiniteOrders({source:e,wallet_address:t}),u=reactPredict.useCancelOrder(),m=react.useMemo(()=>{let v=i?.pages?.flatMap(S=>S.items)??[],x=new Set(["live","open","submitted","pending"]),k=v.filter(S=>x.has(S.status));return r.length>0&&(k=k.filter(S=>S.market_id&&r.includes(S.market_id))),k},[i?.pages,r]),l=react.useCallback(v=>{n?n(v.id):u.mutate({source:v.source,id:v.id});},[n,u]),f=m.length,d=f+(c?1:0),p=react.useCallback(v=>v<f,[f]),h=react.useCallback(async()=>{await s();},[s]),g=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:p,loadMoreRows:h,rowCount:d,threshold:5});return a?jsxRuntime.jsx(fi,{}):m.length===0&&!c?jsxRuntime.jsx(mi,{message:o("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:so},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:o("predict.openOrders.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.openOrders.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.openOrders.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.openOrders.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.openOrders.filled")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:o("predict.openOrders.status")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:pi},onRowsRendered:g,rowComponent:$m,rowCount:d,rowHeight:ui,rowProps:{orders:m,itemCount:f,onCancel:l,isCancelling:u.isPending,cancelLabel:o("predict.openOrders.cancel")}})]})}function $m({index:e,style:t,orders:r,itemCount:n,onCancel:o,isCancelling:i,cancelLabel:a}){if(e>=n)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})});let s=r[e];if(!s)return null;let c=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$1.cn("inline-block rounded px-1.5 py-0.5 text-[10px] font-medium",c?"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?oo(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(Km,{status:s.status})}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>o(s),disabled:i,className:"text-[10px] text-danger hover:text-danger/80 cursor-pointer disabled:opacity-50 transition-colors",children:i?jsxRuntime.jsx(ui$1.Spinner,{size:"sm"}):a})})]})}function Km({status:e}){return jsxRuntime.jsx("span",{className:ui$1.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 Vm({source:e,walletAddress:t}){let{t:r}=i18n.useTranslation(),{data:n,isLoading:o,fetchNextPage:i,hasNextPage:a}=reactPredict.useInfiniteTrades({source:e,wallet:t,limit:50}),s=react.useMemo(()=>n?.pages?.flatMap(d=>d.items)??[],[n?.pages]),c=s.length,u=c+(a?1:0),m=react.useCallback(d=>d<c,[c]),l=react.useCallback(async()=>{await i();},[i]),f=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:m,loadMoreRows:l,rowCount:u,threshold:5});return o?jsxRuntime.jsx(fi,{}):s.length===0&&!a?jsxRuntime.jsx(mi,{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:so},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:pi},onRowsRendered:f,rowComponent:jm,rowCount:u,rowHeight:ui,rowProps:{trades:s,itemCount:c}})]})}function jm({index:e,style:t,trades:r,itemCount:n}){if(e>=n)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})});let o=r[e];if(!o)return null;let i=o.side?.toUpperCase()==="BUY",a=Gm(o.timestamp),s=o.price??0,c=o.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$1.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:o.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:o.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:oo(s)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:o.size}),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",children:a})]})}function mi({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:hn},children:e})}function fi(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:hn},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function oo(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function Gm(e){let t=new Date(e*1e3),r=(t.getMonth()+1).toString().padStart(2,"0"),n=t.getDate().toString().padStart(2,"0"),o=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0");return `${r}/${n} ${o}:${i}`}function qm(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}var Ma=`
74
+ `).map((r,n)=>jsxRuntime.jsxs("span",{children:[n>0&&jsxRuntime.jsx("br",{className:"hidden sm:block"}),r,n===0?" ":""]},n))})]}),jsxRuntime.jsx("div",{className:"evt-stat-grid",style:e?{animation:"evtStatsEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:"0.1s"}:{},children:Bp.map((r,n)=>jsxRuntime.jsxs("div",{style:{padding:"14px 16px",background:e?`linear-gradient(to bottom, ${r.gradientFrom}, ${r.gradientTo})`:"rgba(255,255,255,0.02)",borderRight:n%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:n<2?"1px solid rgba(39,39,42,0.4)":"none",...e?{animation:"evtStatCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:`${150+n*60}ms`}:{}},children:[jsxRuntime.jsx("div",{className:"evt-stat-val",style:{fontWeight:700,fontVariantNumeric:"tabular-nums",color:e?r.valueColor:"transparent",display:"flex",alignItems:"center"},children:e?r.format(e[r.key]):jsxRuntime.jsx("div",{style:{height:16,width:56,borderRadius:4,background:"rgba(255,255,255,0.06)",animation:"evtStatCardEnter 0.6s ease-out both",animationDelay:`${n*80}ms`}})}),jsxRuntime.jsx("div",{className:"evt-stat-label",style:{fontWeight:500,color:e?"#71717a":"transparent",marginTop:2,display:"flex",alignItems:"center"},children:e?t(r.labelKey):jsxRuntime.jsx("div",{style:{height:10,width:64,borderRadius:4,background:"rgba(255,255,255,0.04)",animation:"evtStatCardEnter 0.6s ease-out both",animationDelay:`${50+n*80}ms`}})})]},r.key))})]})]})}function Pa({event:e,market:t,position:r,onSuccess:n,onCancel:o}){let{t:i,i18n:s}=i18n.useTranslation(),{mutateAsync:a}=reactPredict.useRedeemPosition(),{start:l}=reactPredict.useTradeResultConfirmation(),{evmAddress:u}=yr(),p=walletConnector.useWallets(),[c,g]=react.useState("idle"),[d,m]=react.useState(null),h=t.provider_meta?.["polymarket.conditionId"],v=t.provider_meta?.["polymarket.negRisk"]??false,f=u??"",y=react.useMemo(()=>Ur(i,s),[s,i]),x=react.useMemo(()=>p.find(U=>U.chainNamespace===types.ChainNamespace.EVM&&U.isConnected),[p]),k=Sa(r.side,t.outcomes),S=t.outcomes?.[k]?.label??r.side,M=t.result!=null?Sa(t.result,t.outcomes):-1,N=(M>=0?t.outcomes?.[M]:void 0)?.label??t.result??"",C=t.result!=null?k===M:true,I=react.useMemo(()=>C?r.size:0,[C,r.size]),D=react.useCallback(async()=>{if(!(!h||!f||!x)){g("pending"),m(null);try{let U=await x.getEip1193Provider();if(!U)throw new Error("EIP-1193 provider unavailable");await a({wallet_address:f,condition_id:h,neg_risk:v,signMessage:async re=>await U.request({method:"personal_sign",params:[re,f]}),signTypedData:async re=>await U.request({method:"eth_signTypedData_v4",params:[f,JSON.stringify(re)]})}),g("confirming");let H=$r({messages:y});H.submitted(),await l({source:r.source,user:f,marketSlug:r.market?.slug??t.slug,eventSlug:r.event?.slug??e?.slug,expectation:"redeem",expectedPayout:I})==="confirmed"?(g("success"),H.completed()):(g("delayed"),H.delayed()),n?.();}catch(U){g("error"),m(U instanceof Error?U.message:i("predict.redeem.error"));}}},[h,f,v,x,a,y,l,r.source,r.market?.slug,r.event?.slug,t.slug,e?.slug,I,n,i]),j=walletConnector.useAuthCallback(D),L=c==="idle"&&!!h&&!!f&&!!x&&r.redeemable;return jsxRuntime.jsxs("div",{className:"flex flex-col gap-4 p-4",children:[jsxRuntime.jsx("div",{className:"text-base font-medium text-white",children:e?.title??t.question}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2 rounded-xl bg-[rgba(39,39,42,0.4)] p-3",children:[jsxRuntime.jsx(lo,{label:i("predict.positions.side"),value:S,valueClassName:C?"text-green-400":"text-red-400"}),t.result!=null&&jsxRuntime.jsx(lo,{label:i("predict.redeem.result"),value:N,valueClassName:"text-green-400"}),jsxRuntime.jsx(lo,{label:i("predict.positions.size"),value:r.size.toFixed(2)}),jsxRuntime.jsx(lo,{label:i("predict.redeem.expectedPayout"),value:`$${I.toFixed(2)}`,valueClassName:I>0?"text-green-400":"text-zinc-400"})]}),!C&&I===0&&jsxRuntime.jsx("p",{className:"text-sm text-zinc-500",children:i("predict.redeem.noWinnings")}),c==="error"&&d&&jsxRuntime.jsx("p",{className:"text-sm text-red-400",children:d}),c==="success"&&jsxRuntime.jsx("p",{className:"text-sm text-green-400",children:i("predict.redeem.success")}),c==="delayed"&&jsxRuntime.jsx("p",{className:"text-sm text-zinc-400",children:i("predict.trade.resultDelayed",{defaultValue:"Your trade was submitted successfully. Confirmation is taking a little longer."})}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-2",children:[c!=="success"&&c!=="delayed"&&jsxRuntime.jsx(ui$1.Button,{color:"success",className:"w-full h-12 rounded-xl text-sm font-semibold",isDisabled:!L,isLoading:c==="pending"||c==="confirming",onPress:j,spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),children:i("predict.redeem.confirm")}),o&&c!=="success"&&c!=="delayed"&&jsxRuntime.jsx("button",{type:"button",onClick:o,className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")}),(c==="success"||c==="delayed")&&o&&jsxRuntime.jsx(ui$1.Button,{className:"w-full h-12 rounded-xl text-sm font-medium",onPress:o,children:i("common.ok")})]})]})}function lo({label:e,value:t,valueClassName:r="text-white"}){return jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm text-zinc-400",children:e}),jsxRuntime.jsx("span",{className:`text-sm font-medium ${r}`,children:t})]})}function Sa(e,t){let r=e.toLowerCase();if(r==="yes")return 0;if(r==="no"||!t)return 1;let n=t.findIndex(o=>o.label.toLowerCase()===r);return n>=0?n:1}var Zp="predict-redeem";function Na({id:e=Zp}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(em,{...t})})}function em({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui$1.useScreen();return e?jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{className:o?"":"p-2",children:[jsxRuntime.jsxs("div",{className:"px-4 pt-4 pb-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold text-white",children:n("predict.redeem.title")}),jsxRuntime.jsx("p",{className:"text-sm text-zinc-400 mt-1",children:n("predict.redeem.description")})]}),jsxRuntime.jsx(Pa,{event:e.event,market:e.market,position:e.position,onSuccess:()=>{setTimeout(()=>r(false),1500);},onCancel:()=>r(false)})]})})}):null}function Si(e){return e?.trim().toLowerCase()??""}function ki(e,t){let r=e.provider_meta?.[t];return typeof r=="string"?r:""}function Ta(e,t){return !!(e&&t&&e.trim().toLowerCase().includes(t))}function Rm(e,t){let r=Si(e.side);if(r==="yes"||r==="no")return r;if(r==="over"||r==="odd")return "yes";if(r==="under"||r==="even")return "no";let n=[t.outcomes?.[0]?.label,ki(t,"polymarket.groupItemTitle"),ki(t,"polymarket.groupItemTitleTrans"),ki(t,"polymarket.group_item_title_trans")],o=[t.outcomes?.[1]?.label];return n.some(i=>Ta(i,r))?"yes":o.some(i=>Ta(i,r))?"no":null}function Ra({market:e,initialOutcome:t="yes",initialPositionSide:r,slippageBps:n=100,onSuccess:o}){let{t:i,i18n:s}=i18n.useTranslation(),a=react.useRef(o);a.current=o;let{status:l}=walletConnector.useAuth(),u=walletConnector.useWallets(),p=reactPredict.usePredictClient(),c=react.useContext(reactPredict.PolymarketContext),g=reactQuery.useQueryClient(),{start:d}=reactPredict.useTradeResultConfirmation(),m=e.source,h=m==="polymarket",v=u.find(E=>E.chainNamespace===types.ChainNamespace.SOLANA&&E.isConnected),f=u.find(E=>E.chainNamespace===types.ChainNamespace.EVM&&E.isConnected&&"switchChain"in E),y=l==="authenticated",x=v?.address,k=f?.address,[b,S]=react.useState(t),[M,B]=react.useState("market"),[N,C]=react.useState(NaN),[I,D]=react.useState(NaN),[j,L]=react.useState(false),[U,H]=react.useState(false),[ee,re]=react.useState(null),[ue,ce]=react.useState(null),[Ae,Xe]=react.useState(false),[Fe,ot]=react.useState(false),[$e,Be]=react.useState("1h"),[P,Je]=react.useState(30),[Te,Ne]=react.useState("minutes"),lt=react.useMemo(()=>Ur(i,s),[s,i]),Se=true,w=react.useCallback(async(E,Ce)=>{let Ee=$r({messages:lt});Ee.submitted(),await d({source:m,user:m==="kalshi"?x:k,kalshiUser:Se?x:void 0,polymarketUser:k,marketSlug:e.slug,eventSlug:e.event_slug,expectation:E,getOrdersHeaders:Ce})==="confirmed"?Ee.completed():Ee.delayed();},[d,Se,k,e.event_slug,e.slug,m,lt,x]),T=react.useMemo(()=>{if(m!=="polymarket")return;let E=e.provider_meta?.["polymarket.clobTokenIds"];return E?(typeof E=="string"?JSON.parse(E):E)[b==="yes"?0:1]:void 0},[m,e.provider_meta,b]),{data:W,isLoading:J}=reactPredict.useTickSize(T),ne=reactPredict.normalizePolymarketTickSize(W?.minimum_tick_size),{data:me,isLoading:ct}=reactPredict.useFeeRate(T),Tt=String(me?.base_fee??0),{data:Rt}=reactPredict.useRebateConfig(),it=Rt?.builder_enabled&&Rt.builder_code?Rt.builder_code:void 0,xt=false,qe=null,qt=false,He,Ze,he;try{let E=yr();Se=E.enableKalshi,xt=E.kalshiKycVerified,qe=E.kalshiKycUrl,qt=E.polymarketSetupVerified,He=E.polymarketSafeAddress,Ze=E.polymarketWalletKind,he=E.polymarketWalletAddress;}catch{}let dt=m==="kalshi"&&!xt,yt=m==="polymarket"&&!qt,ye=react.useCallback(async()=>{if(!f||!c)return null;let E=await f.getEip1193Provider();if(!E)return null;let Ce=Ze==="deposit"&&!!he,Ee=!Ce&&!!He,ze={address:f.address,signatureType:Ce?3:Ee?2:0,signTypedData:async(ft,Zt,Wt,We)=>{let ar=[];"name"in ft&&ar.push({name:"name",type:"string"}),"version"in ft&&ar.push({name:"version",type:"string"}),"chainId"in ft&&ar.push({name:"chainId",type:"uint256"}),"verifyingContract"in ft&&ar.push({name:"verifyingContract",type:"address"}),"salt"in ft&&ar.push({name:"salt",type:"bytes32"});let Hn={EIP712Domain:ar,...Zt};return await E.request({method:"eth_signTypedData_v4",params:[f.address,JSON.stringify({domain:ft,types:Hn,primaryType:Wt,message:We})]})}};return c.credentials??await c.authenticate(ze)},[He,Ze,he,f,c]),{data:et}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:m,outcome:b},{enabled:e.status==="open"}),Re=react.useMemo(()=>{let E=reactPredict.pickBestBid(et,b);if(E!=null&&E>0)return E;let Ce=b==="yes"?0:1,Ee=e.outcomes[Ce];return Ee?.best_bid??Ee?.price??.5},[et,e.outcomes,b]),Lt=m==="kalshi"?x??"":k??"",{data:_,isLoading:Le}=reactPredict.usePositionsMulti({kalshi_user:m==="kalshi"?Lt:void 0,polymarket_user:m==="polymarket"?Lt:void 0},{enabled:!!Lt,refetchInterval:3e4}),Ye=Si(r),nn=r?.trim(),F=react.useMemo(()=>_?_.positions.find(E=>E.market?.slug!==e.slug?false:Ye?Si(E.side)===Ye:Rm(E,e)===b)??null:null,[_,e,e.slug,b,Ye]),_e=nn||F?.side||b,kt=react.useCallback(async()=>{let E=await ye();return E?await reactPredict.buildPolymarketL2Headers(E.address,{apiKey:E.apiKey,secret:E.secret,passphrase:E.passphrase,method:"GET",requestPath:"/data/orders",body:""}):{}},[ye]),{data:Ft,isLoading:on}=reactPredict.useAvailableShares({source:m,user:Lt,market:e.slug,side:_e},m==="polymarket"?{getHeaders:kt}:void 0,{enabled:!!Lt&&!!e.slug,refetchOnMount:"always"}),Ko=e.provider_meta?.["dflow.yesMint"]??"",Vo=e.provider_meta?.["dflow.noMint"]??"",Yt=utils$1.SOLANA_TOKENS.stablecoins.USDC.address,Rr=e.provider_meta?.["dflow.collateralMint"]||"",jo=b==="yes"?Ko:Vo,ut=react.useMemo(()=>m==="polymarket"?reactPredict.getPolymarketSharesPrecision(ne):Ft?.precision??0,[m,ne,Ft?.precision]),_t=Ft?.active_order_shares??0,Lr=m==="polymarket"&&!!F?.size&&(Ft?.total_shares??0)<=0&&(Ft?.available_shares??0)<=0,sn=Lr?F?.size??0:0,_r=Lr?sn:Ft?.total_shares??0,sr=Lr?Math.max(0,sn-_t):Ft?.available_shares??0,Go=on||Le,An=F?.market?.provider_meta,Or=An?.["dflow.outcomeMint"]||jo,Qt=An?.["dflow.collateralMint"]||Rr,fr=Or,gr=Qt||Yt,hr=react.useMemo(()=>isNaN(N)||N<=0?"0":String(Math.round(N*1e6)),[N]),an=m==="kalshi"&&!!fr&&!!gr&&!!x&&hr!=="0",{refetch:ln}=reactPredict.useDFlowQuote({inputMint:fr,outputMint:gr,amount:hr,userPublicKey:x??"",slippageBps:100},{enabled:an}),Ir=react.useMemo(()=>isNaN(N)||N<=0?0:N,[N]),Ot=react.useMemo(()=>reactPredict.walkOrderbook({orderbook:et,outcome:b,side:"sell",sharesNeeded:Ir,slippageBps:n}),[et,b,Ir,n]),O=react.useMemo(()=>Ot.status==="ok"&&Ot.worstPrice!=null&&Ot.worstPrice>0?Ot.worstPrice:Re,[Ot,Re]),Oe=react.useMemo(()=>M==="limit"&&h&&!isNaN(I)?I:O,[M,h,I,O]),Me=react.useMemo(()=>isNaN(N)||N<=0?0:N*Oe,[N,Oe]),It=react.useMemo(()=>m!=="polymarket"?0:Ns({grossReturn:Me,pricePerShare:Oe,feeRateBps:Number(Tt)}),[m,Me,Oe,Tt]),cn=react.useMemo(()=>Math.max(0,Me-It),[Me,It]),Xt=react.useCallback(E=>{S(E),D(NaN),C(NaN),H(false);},[]);react.useEffect(()=>{Xt(t);},[t,Xt]);let Jt=react.useCallback(E=>{B(E);},[]);react.useEffect(()=>{M==="limit"&&D(Math.round(Re*1e4)/1e4);},[M,b]);let pt=react.useCallback(E=>{if(H(false),isNaN(E)){C(NaN);return}C(ke(Math.max(0,E),ut));},[ut]),qo=react.useCallback(()=>{H(true),C(ke(sr,ut));},[sr,ut]),Fn=react.useCallback(E=>{if(isNaN(E)){D(NaN);return}D(Math.round(E*1e4)/1e4);},[]),zt=react.useCallback(()=>{C(NaN),D(NaN),B("market"),H(false),ot(false),Be("1h"),Je(30),Ne("minutes");},[]),Dr=react.useMemo(()=>{let E=[];return isNaN(N)||N<=0?E.push(i("predict.trade.minQuantity",{amount:qn})):N<qn&&E.push(i("predict.trade.minQuantity",{amount:qn})),e.status!=="open"&&E.push(i("predict.trade.marketNotActive")),!isNaN(N)&&N>0&&!U&&N>sr&&E.push(i("predict.trade.insufficientSharesDetail",{total:ke(_r,ut).toFixed(ut),active:ke(_t,ut).toFixed(ut),available:ke(sr,ut).toFixed(ut)})),M==="limit"&&h&&(isNaN(I)||I<.01||I>.99)&&E.push(i("predict.trade.limitPriceRange")),M==="limit"&&h&&Fe&&$e==="custom"&&(isNaN(P)||P<=0)&&E.push(i("predict.trade.expiration.invalidDate")),m==="polymarket"&&M==="market"&&!isNaN(N)&&N>0&&(Ot.status==="insufficient_liquidity"?E.push(i("predict.trade.insufficientLiquidity",{available:ke(Ot.totalAvailable,2)})):Ot.status==="exceeds_slippage"&&E.push(i("predict.trade.priceImpactTooHigh",{impact:(Ot.priceImpactBps/100).toFixed(2),slippage:(n/100).toFixed(2)}))),{isValid:E.length===0,errors:E}},[N,e.status,sr,_r,_t,U,M,h,I,Fe,$e,P,ut,m,Ot,n,i]),{mutateAsync:Ar}=reactPredict.useDFlowSubmit(),{data:vr}=reactPredict.useOrder({id:ee??"",source:m},{enabled:!!ee}),Bn=react.useCallback(async()=>{if(!ue||!x||!v)return;let{cashAmount:E,collateral:Ce}=ue;ce(null);try{let ze=(await p.createDFlowQuote({inputMint:Ce,outputMint:Yt,amount:E,userPublicKey:x,slippageBps:100}))?.transaction;if(!ze)return;let ft=Uint8Array.from(atob(ze),Wt=>Wt.charCodeAt(0)),Zt=await v.signTransaction(ft);await Ar({signedTransaction:btoa(String.fromCharCode(...Zt)),orderContext:{user_public_key:x,input_mint:Ce,output_mint:Yt,amount:E,price:"1",side:"SELL",outcome:"",market_slug:"",slippage_bps:100}});}catch{}},[ue,x,v,p,Ar,Yt]),br=react.useCallback(()=>{g.invalidateQueries({queryKey:["predict","available-shares"]});},[g]);react.useEffect(()=>{if(!vr||!ee)return;let{status:E}=vr;E==="closed"?(re(null),ue?Bn().finally(()=>{L(false),w("sell-market"),br(),zt(),a.current?.();}):(L(false),w("sell-market"),br(),zt(),a.current?.())):(E==="failed"||E==="expired")&&(L(false),re(null),ce(null),ui$1.toast.error(i("predict.trade.submitError")));},[vr,ee,ue,Bn,w,br,zt,i]);let Fr=react.useCallback(async()=>{if(!x||!v)return;if(!fr||!gr){ui$1.toast.error("Missing token mint addresses"),L(false);return}if(!xt){Xe(true),L(false);return}let Ee=(await ln()).data,ze=Ee?.transaction;if(!ze){ui$1.toast.error(i("predict.trade.submitError")),L(false);return}if(Qt&&Qt!==Yt){let We=String(Ee?.outAmount??"");We&&We!=="0"&&ce({cashAmount:We,collateral:Qt});}let ft=Uint8Array.from(atob(ze),We=>We.charCodeAt(0)),Zt=await v.signTransaction(ft),Wt=await Ar({signedTransaction:btoa(String.fromCharCode(...Zt)),orderContext:{user_public_key:x,input_mint:fr,output_mint:gr,amount:hr,price:String(Re),side:"SELL",outcome:b==="yes"?"YES":"NO",market_slug:e.slug,slippage_bps:100}});re(Wt.signature);},[x,v,ln,Ar,fr,gr,hr,Re,b,e.slug,Qt,Yt,i,xt]),Br=react.useCallback(async()=>{if(!f||!c)return;let E=f.chain,Ce=E!==types.Chain.POLYGON;Ce&&await f.switchChain(types.Chain.POLYGON);try{let Ee=await f.getEip1193Provider();if(!Ee){ui$1.toast.error(i("predict.trade.submitError")),L(!1);return}let ze=Ze==="deposit"&&!!he,ft=!ze&&!!He,Zt=ze?he:He,Wt={address:f.address,signatureType:ze?3:ft?2:0,signTypedData:async(Ut,Wn,Xo,Jo)=>{let Hr=[];"name"in Ut&&Hr.push({name:"name",type:"string"}),"version"in Ut&&Hr.push({name:"version",type:"string"}),"chainId"in Ut&&Hr.push({name:"chainId",type:"uint256"}),"verifyingContract"in Ut&&Hr.push({name:"verifyingContract",type:"address"}),"salt"in Ut&&Hr.push({name:"salt",type:"bytes32"});let Zc={EIP712Domain:Hr,...Wn};return await Ee.request({method:"eth_signTypedData_v4",params:[f.address,JSON.stringify({domain:Ut,types:Zc,primaryType:Xo,message:Jo})]})}},We=await ye();if(!We){ui$1.toast.error(i("predict.trade.submitError")),L(!1);return}let ar=b==="yes"?0:1,Hn="",zn=e.provider_meta?.["polymarket.clobTokenIds"];zn&&(Hn=(typeof zn=="string"?JSON.parse(zn):zn)[ar]??"");let cs=e.provider_meta?.["polymarket.negRisk"]??!1,Xc=M==="limit"&&!isNaN(I)?I:O,Jc=Xn(Xc,ne),Yo={tokenId:Hn,price:Jc,size:N,side:"SELL",orderType:M==="limit"?Fe?"GTD":"GTC":"FOK",tickSize:ne,negRisk:cs,...Zt&&{funderAddress:Zt},...it&&{builderCode:it},...M==="limit"&&Fe&&{expiration:Qn($e,P,Te)}},Qo;if(ze)Qo=await reactPredict.buildSignedV2OrderPayload({signer:Wt,depositWalletAddress:Zt,input:Yo,owner:We.apiKey});else {let Ut=reactPredict.buildCtfExchangeDomain(cs),Wn=reactPredict.buildOrderMessage({...Yo,signerAddress:Wt.address,signatureType:Wt.signatureType,feeRateBps:Tt}),Xo=await Wt.signTypedData(Ut,reactPredict.CTF_ORDER_TYPES,"Order",Wn),Jo=reactPredict.buildSignedOrder(Wn,Xo,Yo.orderType);Qo=reactPredict.buildClobPayload(Jo,We.apiKey);}await p.executePolymarketOrder({payload:Qo,l2_api_key:We.apiKey,l2_secret:We.secret,l2_passphrase:We.passphrase,signer_address:We.address,owner:We.apiKey}),br(),w(M==="limit"?"sell-limit":"sell-market",async()=>await reactPredict.buildPolymarketL2Headers(We.address,{apiKey:We.apiKey,secret:We.secret,passphrase:We.passphrase,method:"GET",requestPath:"/data/orders"})),zt(),L(!1),a.current?.();}finally{Ce&&E&&f.switchChain(E).catch(()=>{});}},[f,c,ye,b,e.provider_meta,M,w,I,O,N,p,br,Fe,$e,P,Te,zt,i,ne,Tt,e.slug,He,Ze,he,it]),Dt=react.useCallback(async()=>{if(!(!Dr.isValid||!y)){L(true),re(null),Xe(false);try{m==="kalshi"?await Fr():await Br();}catch(E){let Ce=E instanceof Error?E.message:"",Ee=m==="polymarket"&&Ce?Jn(Ce,i,"sell"):Ce||void 0;ui$1.toast.error(Ee||i("predict.trade.submitError")),L(false);}}},[Dr.isValid,y,m,Fr,Br,i]);return {outcome:b,orderType:M,quantity:N,limitPrice:I,shares:Ir,effectivePrice:Oe,grossReturn:Me,estimatedFee:It,estimatedReturn:cn,pricePerShare:Re,isMarketDataLoading:m==="polymarket"&&(ct||J),isSubmitting:j,authStatus:l,validation:Dr,supportsLimitOrder:h,kycRequired:Ae,needsKyc:dt,needsSetup:yt,kycUrl:qe,totalShares:_r,activeOrderShares:_t,availableShares:sr,isAvailableLoading:Go,isSellAll:U,precision:ut,expirationEnabled:Fe,expirationPreset:$e,customDuration:P,customDurationUnit:Te,setOutcome:Xt,setOrderType:Jt,setQuantity:pt,setLimitPrice:Fn,setSellAll:qo,setExpirationEnabled:ot,setExpirationPreset:Be,setCustomDuration:Je,setCustomDurationUnit:Ne,submit:Dt}}var zm=["5m","1h","12h","24h","eod","custom"],Wm={"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"},Um=["minutes","hours","days"],$m={minutes:"predict.trade.expiration.minutes",hours:"predict.trade.expiration.hours",days:"predict.trade.expiration.days"},Km={maximumFractionDigits:0},bn="-";function Ba({event:e,market:t,variant:r="bordered",outcome:n,orderType:o,quantity:i,limitPrice:s,effectivePrice:a,grossReturn:l,estimatedFee:u,estimatedReturn:p,isMarketDataLoading:c,isSubmitting:g,authStatus:d,isValid:m,validationErrors:h,supportsLimitOrder:v,kycRequired:f,needsKyc:y,needsSetup:x,onSetupRequired:k,kycUrl:b,totalShares:S,activeOrderShares:M,availableShares:B,isAvailableLoading:N,precision:C,expirationEnabled:I,expirationPreset:D,customDuration:j,customDurationUnit:L,oddsFormatter:U,outcomeLabels:H,onOutcomeChange:ee,onOrderTypeChange:re,onQuantityChange:ue,onLimitPriceChange:ce,onSellAll:Ae,onExpirationEnabledChange:Xe,onExpirationPresetChange:Fe,onCustomDurationChange:ot,onCustomDurationUnitChange:$e,onSubmit:Be}){let{t:P}=i18n.useTranslation(),[Je,Te]=react.useState(false),[Ne,lt]=react.useState(true),Se=ui$1.useDisclosure(),[w,T]=react.useState(""),W=react.useRef(false);react.useEffect(()=>{W.current||T(isNaN(i)?"":String(i));},[i]);let[J,ne]=react.useState(""),me=react.useRef(false);react.useEffect(()=>{me.current||(isNaN(s)?ne(""):ne(String(parseFloat((s*100).toFixed(2)))));},[s]);let ct=react.useCallback(_=>{if(_!==""&&!/^\d*\.?\d{0,2}$/.test(_))return;if(ne(_),_===""||_==="."){ce(NaN);return}let Ye=parseFloat(_);isNaN(Ye)||ce(Ye/100);},[ce]),Tt=react.useCallback(_=>{let Le=new RegExp(`^\\d*\\.?\\d{0,${C}}$`);if(_!==""&&!Le.test(_))return;if(T(_),Te(false),_===""||_==="."){ue(NaN);return}let Ye=parseFloat(_);isNaN(Ye)||ue(Ye);},[ue,C]);react.useEffect(()=>{f&&!Se.isOpen&&Se.onOpen();},[f]);let Rt=react.useMemo(()=>{let _=n==="yes"?t.yesBid:t.noBid;return _!=null?parseFloat((Number(_)*100).toFixed(2)):null},[n,t]),it=n==="yes"?t.yesBid:t.noBid,xt=it!=null&&U?U(Number(it)):Rt!=null?`${Rt} \xA2`:null,qe=Number.isFinite(a)?parseFloat((a*100).toFixed(2)):null,qt=Number.isFinite(a)&&U?U(a):qe!=null?`${qe} \xA2`:null,He=!isNaN(i)&&i>0,Ze=He&&i>0?p/i:0,he=Ze>0&&U?U(Ze):Ze>0?`${parseFloat((Ze*100).toFixed(2))} \xA2`:bn,dt=d==="authenticated",yt=d==="authenticating"||d==="deauthenticating",ye=dt&&(y||x),et=react.useCallback(_=>H?.[_]??P(_==="yes"?"predict.trade.yes":"predict.trade.no"),[H,P]),Re=react.useMemo(()=>{if(yt)return P("predict.trade.checkingLogin");if(!dt)return P("predict.trade.loginToTrade");if(y)return P("predict.trade.kycRequired");if(x)return P("predict.trade.setupRequired");if(N)return P("predict.trade.loadingBalance");if(c)return P("predict.trade.loadingMarketData");if(g)return P("predict.trade.submitting");if(f)return P("predict.trade.kycRequired");if(!He)return P("predict.trade.enterAmount");let _=et(n);return `${P("predict.trade.sell")} ${_}`},[yt,dt,y,x,N,c,g,f,He,n,et,P]),Lt=()=>{if(!dt){Te(false),Be();return}if(y){Se.onOpen();return}if(x&&k){Te(false),k();return}if(f){Se.onOpen();return}if(!m){Te(true);return}Te(false),Be();};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:"flex w-full flex-col gap-y-4 p-4",style:r==="bordered"?{borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",transition:"border-color 0.2s"}:void 0,onMouseEnter:_=>{r==="bordered"&&(_.currentTarget.style.borderColor="rgba(63,63,70,0.8)");},onMouseLeave:_=>{r==="bordered"&&(_.currentTarget.style.borderColor="rgba(39,39,42,0.6)");},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.jsx("span",{className:"text-foreground",children:t.yesSubTitle}),jsxRuntime.jsx("span",{className:"text-foreground",children:" \xB7 "}),jsxRuntime.jsxs("span",{className:"text-bearish",children:[P("predict.trade.sell")," ",et(n)]})]})]})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[v?jsxRuntime.jsxs(ui$1.Tabs,{variant:"underlined",selectedKey:o,onSelectionChange:_=>re(_),classNames:{tabList:"gap-x-4",tab:"px-0"},children:[jsxRuntime.jsx(ui$1.Tab,{title:P("predict.trade.market")},"market"),jsxRuntime.jsx(ui$1.Tab,{title:P("predict.trade.limit")},"limit")]}):jsxRuntime.jsx("span",{className:"text-sm font-medium text-foreground",children:P("predict.trade.market")}),o==="limit"&&v?jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Limit price",placeholder:"50",size:"sm",radius:"none",inputMode:"decimal",value:J,onChange:_=>ct(_.target.value),onFocus:()=>{me.current=true;},onBlur:()=>{me.current=false,isNaN(s)?ne(""):ne(String(parseFloat((s*100).toFixed(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"}}):xt!=null&&jsxRuntime.jsx("span",{className:"text-xl font-bold tabular-nums",children:xt})]}),jsxRuntime.jsx("div",{className:"flex gap-x-2",children:["yes","no"].map(_=>{let Le=_==="yes"?t.yesBid:t.noBid;return jsxRuntime.jsx("div",{className:"flex flex-1 flex-col gap-y-1",children:jsxRuntime.jsxs("button",{type:"button",onClick:()=>ee(_),className:`w-full rounded-lg border py-2 text-sm font-medium transition-colors cursor-pointer ${n===_?"border-bearish bg-bearish/10 text-bearish":"border-default-400 text-foreground hover:border-default-500"}`,children:[jsxRuntime.jsx("span",{children:et(_)}),Le!=null&&jsxRuntime.jsx("span",{className:"ml-1 opacity-70",children:U?U(Number(Le)):`${parseFloat((Number(Le)*100).toFixed(2))}\xA2`})]})},_)})}),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("predict.trade.sellContracts")}),jsxRuntime.jsxs("div",{className:"flex items-center gap-x-2",children:[[25,50].map(_=>{let Le=Math.pow(10,C);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{ue(Math.floor(B*_/100*Le)/Le);},className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:[_,"%"]},_)}),jsxRuntime.jsx("button",{type:"button",onClick:Ae,className:"rounded px-1.5 py-0.5 bg-content2 hover:bg-content3 transition-colors cursor-pointer text-neutral-500 hover:text-foreground font-medium",children:P("common.all")})]})]}),jsxRuntime.jsx(ui$1.StyledInput,{"aria-label":"Sell quantity",fullWidth:true,placeholder:"0",radius:"lg",size:"lg",inputMode:"decimal",value:w,onChange:_=>Tt(_.target.value),onFocus:()=>{W.current=true;},onBlur:()=>{W.current=false,T(isNaN(i)?"":String(i));},classNames:{inputWrapper:"bg-content2 data-[hover=true]:bg-content2 group-data-[focus=true]:bg-content2 h-14 min-h-14",input:"text-lg"}}),Je&&h.length>0&&jsxRuntime.jsx("div",{className:"flex flex-col gap-y-0.5",children:h.map(_=>jsxRuntime.jsx("span",{className:"text-xs text-danger",children:_},_))})]}),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:P("predict.trade.totalShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:N?"\u2013":`${ke(S,C).toFixed(C)}${P("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:P("predict.trade.activeOrders")}),jsxRuntime.jsx("span",{className:"tabular-nums text-warning",children:N?"\u2013":M>0?`-${ke(M,C).toFixed(C)}${P("predict.trade.sharesUnit")}`:`0${P("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:P("predict.trade.availableShares")}),jsxRuntime.jsx("span",{className:"tabular-nums text-success font-medium",children:N?"\u2013":`${ke(B,C).toFixed(C)}${P("predict.trade.sharesUnit")}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:P("predict.trade.estReturn")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?`$${p.toFixed(2)}`:"\u2013"})]})]}),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:()=>lt(_=>!_),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$1.ChevronDownIcon,{className:ui$1.cn("h-3.5 w-3.5 transition-transform",Ne&&"rotate-180")})]}),jsxRuntime.jsx("span",{className:"text-foreground font-medium tabular-nums",children:U&&Number.isFinite(a)?qt:qe!=null?P("predict.trade.chance",{percent:qe}):bn})]}),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:P("predict.trade.numContracts")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:!isNaN(i)&&i>0?kr(i):bn})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:P("predict.trade.totalSize")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:He?`$${l.toFixed(2)}`:bn})]}),(u??0)>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:P("predict.trade.estFee")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:`$${(u??0).toFixed(2)}`})]}),jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:P("predict.trade.estReturnAfterFees")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:He?`$${p.toFixed(2)}`:bn})]}),(u??0)>0&&jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{children:P("predict.trade.effectiveOdds")}),jsxRuntime.jsx("span",{className:"tabular-nums text-foreground",children:he})]})]})]}),o==="limit"&&v&&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$1.StyledSwitch,{size:"sm",color:"primary",isSelected:I,onValueChange:Xe,"aria-label":P("predict.trade.setExpiration")})]}),I&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ui$1.Select,{"aria-label":P("predict.trade.setExpiration"),selectedKeys:[D],onSelectionChange:_=>{let Le=Array.from(_)[0];Le&&Fe(Le);},size:"sm",radius:"lg",classNames:{trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:zm.map(_=>jsxRuntime.jsx(ui$1.SelectItem,{children:P(Wm[_])},_))}),D==="custom"&&jsxRuntime.jsxs("div",{className:"flex gap-x-2",children:[jsxRuntime.jsx(ui$1.StyledNumberInput,{"aria-label":"Duration amount",size:"sm",radius:"lg",value:isNaN(j)?void 0:j,onValueChange:ot,minValue:1,step:1,formatOptions:Km,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$1.Select,{"aria-label":"Duration unit",selectedKeys:[L],onSelectionChange:_=>{let Le=Array.from(_)[0];Le&&$e(Le);},size:"sm",radius:"lg",classNames:{base:"w-32",trigger:"bg-content2 data-[hover=true]:bg-content2 min-h-10",value:"text-sm"},children:Um.map(_=>jsxRuntime.jsx(ui$1.SelectItem,{children:P($m[_])},_))})]})]})]}),jsxRuntime.jsx(ui$1.Button,{color:"secondary",fullWidth:true,radius:"lg",size:"lg",isDisabled:yt||dt&&!ye&&(N||c||!He||g),isLoading:yt||dt&&!ye&&(g||N||c),spinner:jsxRuntime.jsx(ui$1.Spinner,{size:"sm",color:"current"}),onPress:Lt,children:Re})]}),jsxRuntime.jsx(eo,{isOpen:Se.isOpen,onClose:Se.onClose,kycUrl:b})]})}function po({event:e,market:t,variant:r,initialOutcome:n,initialPositionSide:o,chain:i,slippageBps:s,onOutcomeChange:a,onSetupRequired:l,onSuccess:u,oddsFormatter:p,outcomeLabels:c}){let{outcome:g,orderType:d,quantity:m,limitPrice:h,effectivePrice:v,grossReturn:f,estimatedFee:y,estimatedReturn:x,pricePerShare:k,isMarketDataLoading:b,isSubmitting:S,authStatus:M,validation:B,supportsLimitOrder:N,kycRequired:C,needsKyc:I,needsSetup:D,kycUrl:j,totalShares:L,activeOrderShares:U,availableShares:H,isAvailableLoading:ee,precision:re,expirationEnabled:ue,expirationPreset:ce,customDuration:Ae,customDurationUnit:Xe,setOutcome:Fe,setOrderType:ot,setQuantity:$e,setLimitPrice:Be,setSellAll:P,setExpirationEnabled:Je,setExpirationPreset:Te,setCustomDuration:Ne,setCustomDurationUnit:lt,submit:Se}=Ra({market:t,initialOutcome:n,initialPositionSide:o,slippageBps:s,onSuccess:u}),w=walletConnector.useAuthCallback(Se),T=react.useCallback(ne=>{Fe(ne),a?.(ne);},[Fe,a]),W=react.useMemo(()=>e?Vn(e):void 0,[e]),J=react.useMemo(()=>jn(t,{yesBid:g==="yes"?k:void 0,noBid:g==="no"?k:void 0}),[t,g,k]);return jsxRuntime.jsx(Ba,{event:W,market:J,variant:r,outcome:g,orderType:d,quantity:m,limitPrice:h,effectivePrice:v,grossReturn:f,estimatedFee:y,estimatedReturn:x,isMarketDataLoading:b,isSubmitting:S,authStatus:M,isValid:B.isValid,validationErrors:B.errors,supportsLimitOrder:N,kycRequired:C,needsKyc:I,needsSetup:D,onSetupRequired:l,kycUrl:j,totalShares:L,activeOrderShares:U,availableShares:H,isAvailableLoading:ee,precision:re,expirationEnabled:ue,expirationPreset:ce,customDuration:Ae,customDurationUnit:Xe,oddsFormatter:p,outcomeLabels:c,onOutcomeChange:T,onOrderTypeChange:ot,onQuantityChange:$e,onLimitPriceChange:Be,onSellAll:P,onExpirationEnabledChange:Je,onExpirationPresetChange:Te,onCustomDurationChange:Ne,onCustomDurationUnitChange:lt,onSubmit:w})}var Ni="predict-sell";function za({id:e=Ni}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Zm,{...t})})}function Zm({params:e,isOpen:t,onOpenChange:r}){let{t:n}=i18n.useTranslation(),{isMobile:o}=ui$1.useScreen();return e?jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:o?"lg":"md",backdrop:"opaque",hideCloseButton:true,classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{className:o?"":"p-2",children:[jsxRuntime.jsx(po,{event:e.event,market:e.market,initialOutcome:e.initialOutcome,initialPositionSide:e.initialPositionSide,chain:e.chain,slippageBps:e.slippageBps,onSetupRequired:e.onSetupRequired,onSuccess:()=>r(false),variant:"flat"}),jsxRuntime.jsx("div",{className:"px-4 pb-4",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>r(false),className:"w-full h-12 rounded-xl text-sm font-medium text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:n("common.cancel")})})]})})}):null}var Ei=40,go=36,kn=480,Ti=kn-go;function $a({event:e,walletAddress:t,onCancelOrder:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState("positions"),s=react.useMemo(()=>e.markets?.map(c=>c.slug)??[],[e.markets]),{data:a}=reactPredict.usePositionsMulti({kalshi_user:e.source==="kalshi"?t:void 0,polymarket_user:e.source==="polymarket"?t:void 0}),l=react.useMemo(()=>!a?.positions||!t?0:s.length===0?a.positions.length:a.positions.filter(c=>c.market&&s.includes(c.market.slug)).length,[a?.positions,s,t]),p=[{key:"positions",label:l>0?`${n("predict.positions.title")} (${l})`:n("predict.positions.title")},{key:"orders",label:n("predict.openOrders.title")},{key:"trades",label:n("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:p.map(c=>jsxRuntime.jsx("button",{type:"button",onClick:()=>i(c.key),className:ui$1.cn("px-3 py-2 text-sm font-medium transition-colors cursor-pointer",o===c.key?"text-foreground border-b-2 border-primary":"text-neutral hover:text-foreground"),children:c.label},c.key))}),t?jsxRuntime.jsxs("div",{style:{height:kn},children:[o==="positions"&&jsxRuntime.jsx(af,{source:e.source,walletAddress:t,marketSlugs:s}),o==="orders"&&jsxRuntime.jsx(cf,{source:e.source,walletAddress:t,marketSlugs:s,onCancelOrder:r}),o==="trades"&&jsxRuntime.jsx(pf,{source:e.source,walletAddress:t})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:kn},children:n("predict.trade.connectWallet")})]})}function af({source:e,walletAddress:t,marketSlugs:r}){let{t:n}=i18n.useTranslation(),{data:o,isLoading:i}=reactPredict.usePositionsMulti({kalshi_user:e==="kalshi"?t:void 0,polymarket_user:e==="polymarket"?t:void 0}),s=react.useMemo(()=>o?.positions?r.length===0?o.positions:o.positions.filter(a=>a.market&&r.includes(a.market.slug)):[],[o?.positions,r]);return i?jsxRuntime.jsx(Li,{}):s.length===0?jsxRuntime.jsx(Ri,{message:n("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:go},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2 whitespace-nowrap",children:n("predict.positions.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.markPrice")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:n("predict.positions.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right whitespace-nowrap",children:n("predict.positions.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right whitespace-nowrap",children:n("predict.positions.estSettlement")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:Ti},rowComponent:lf,rowCount:s.length,rowHeight:Ei,rowProps:{positions:s,closeLabel:n("predict.positions.close")}})]})}function lf({index:e,style:t,positions:r,closeLabel:n}){let o=r[e];if(!o)return null;let i=o.pnl??0,s=o.pnl_percent??0,a=o.avg_price??0,l=o.current_price??0,u=i>0?"text-success":i<0?"text-danger":"text-foreground",p=i>0?"+":"",c=o.market?.outcomes?.[0]?.label??o.market?.question??"\u2014",g=o.side,d=o.size,m=o.size*l,h=o.market?.end_at?gf(o.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:c}),jsxRuntime.jsx("span",{className:ui$1.cn("text-[10px] font-medium",g.toLowerCase()==="yes"?"text-primary":"text-secondary"),children:g})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:o.size}),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 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:mo(a)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:mo(l)}),jsxRuntime.jsxs("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono whitespace-nowrap",u),children:[p,"$",Math.abs(i).toFixed(2),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",p,s.toFixed(1),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground whitespace-nowrap",children:["$",d.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap",children:h}),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:n})})]})}function cf({source:e,walletAddress:t,marketSlugs:r,onCancelOrder:n}){let{t:o}=i18n.useTranslation(),{data:i,isLoading:s,fetchNextPage:a,hasNextPage:l}=reactPredict.useInfiniteOrders({source:e,wallet_address:t}),u=reactPredict.useCancelOrder(),p=react.useMemo(()=>{let f=i?.pages?.flatMap(k=>k.items)??[],y=new Set(["live","open","submitted","pending"]),x=f.filter(k=>y.has(k.status));return r.length>0&&(x=x.filter(k=>k.market_id&&r.includes(k.market_id))),x},[i?.pages,r]),c=react.useCallback(f=>{n?n(f.id):u.mutate({source:f.source,id:f.id});},[n,u]),g=p.length,d=g+(l?1:0),m=react.useCallback(f=>f<g,[g]),h=react.useCallback(async()=>{await a();},[a]),v=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:m,loadMoreRows:h,rowCount:d,threshold:5});return s?jsxRuntime.jsx(Li,{}):p.length===0&&!l?jsxRuntime.jsx(Ri,{message:o("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:go},children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:o("predict.openOrders.side")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.openOrders.outcome")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:o("predict.openOrders.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.openOrders.price")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:o("predict.openOrders.filled")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:o("predict.openOrders.status")}),jsxRuntime.jsx("div",{className:"w-16 shrink-0"})]}),jsxRuntime.jsx(reactWindow.List,{style:{height:Ti},onRowsRendered:v,rowComponent:df,rowCount:d,rowHeight:Ei,rowProps:{orders:p,itemCount:g,onCancel:c,isCancelling:u.isPending,cancelLabel:o("predict.openOrders.cancel")}})]})}function df({index:e,style:t,orders:r,itemCount:n,onCancel:o,isCancelling:i,cancelLabel:s}){if(e>=n)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})});let a=r[e];if(!a)return null;let l=a.side==="BUY";return jsxRuntime.jsxs("div",{style:t,className:"flex items-center border-b border-border/50 text-xs lg:text-sm",children:[jsxRuntime.jsx("div",{className:"w-16 shrink-0 pr-2",children:jsxRuntime.jsx("span",{className:ui$1.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:a.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:a.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-neutral capitalize",children:a.order_type??"limit"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:a.price?mo(parseFloat(a.price)):"\u2014"}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:[a.size_matched??"0","/",a.original_size??"\u2014"]}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 pr-2",children:jsxRuntime.jsx(uf,{status:a.status})}),jsxRuntime.jsx("div",{className:"w-16 shrink-0 text-right",children:jsxRuntime.jsx("button",{type:"button",onClick:()=>o(a),disabled:i,className:"text-[10px] text-danger hover:text-danger/80 cursor-pointer disabled:opacity-50 transition-colors",children:i?jsxRuntime.jsx(ui$1.Spinner,{size:"sm"}):s})})]})}function uf({status:e}){return jsxRuntime.jsx("span",{className:ui$1.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 pf({source:e,walletAddress:t}){let{t:r}=i18n.useTranslation(),{data:n,isLoading:o,fetchNextPage:i,hasNextPage:s}=reactPredict.useInfiniteTrades({source:e,wallet:t,limit:50}),a=react.useMemo(()=>n?.pages?.flatMap(d=>d.items)??[],[n?.pages]),l=a.length,u=l+(s?1:0),p=react.useCallback(d=>d<l,[l]),c=react.useCallback(async()=>{await i();},[i]),g=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:p,loadMoreRows:c,rowCount:u,threshold:5});return o?jsxRuntime.jsx(Li,{}):a.length===0&&!s?jsxRuntime.jsx(Ri,{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:go},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:Ti},onRowsRendered:g,rowComponent:mf,rowCount:u,rowHeight:Ei,rowProps:{trades:a,itemCount:l}})]})}function mf({index:e,style:t,trades:r,itemCount:n}){if(e>=n)return jsxRuntime.jsx("div",{style:t,className:"flex justify-center items-center",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})});let o=r[e];if(!o)return null;let i=o.side?.toUpperCase()==="BUY",s=ff(o.timestamp),a=o.price??0,l=o.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$1.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:o.side})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-foreground capitalize",children:o.outcome??"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:mo(a)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:o.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:s})]})}function Ri({message:e}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:kn},children:e})}function Li(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-2 py-3 animate-pulse",style:{height:kn},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(ui$1.Skeleton,{className:"h-8 w-full rounded-md"},t))})}function mo(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(1)}\xA2`}function ff(e){let t=new Date(e*1e3),r=(t.getMonth()+1).toString().padStart(2,"0"),n=t.getDate().toString().padStart(2,"0"),o=t.getHours().toString().padStart(2,"0"),i=t.getMinutes().toString().padStart(2,"0");return `${r}/${n} ${o}:${i}`}function gf(e){try{return new Date(e).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return "\u2014"}}var Ka=`
75
75
  @keyframes detailShimmer{0%{background-position:200% 0}100%{background-position:-200% 0}}
76
- `,Ta={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:"detailShimmer 1.8s ease-in-out infinite",borderRadius:6};function fe(e){return {...Ta,animationDelay:`${e}ms`}}function vn({marketCount:e=4,showBack:t}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Ma}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:20},children:[t&&jsxRuntime.jsx("div",{style:{height:20}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[jsxRuntime.jsx("div",{style:{...Ta,width:64,height:64,borderRadius:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("div",{style:{...fe(0),height:14,width:48}}),jsxRuntime.jsx("div",{style:{...fe(30),height:14,width:40}}),jsxRuntime.jsx("div",{style:{...fe(60),height:14,width:40}})]}),jsxRuntime.jsx("div",{style:{...fe(80),height:20,width:"80%",maxWidth:384,borderRadius:4}})]})]}),jsxRuntime.jsx("div",{style:{...fe(100),height:16,width:192}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[jsxRuntime.jsx("div",{style:{...fe(120),height:16,width:96}}),jsxRuntime.jsx("div",{style:{...fe(140),height:16,width:80}})]}),jsxRuntime.jsx("div",{style:{...fe(160),height:300,width:"100%",borderRadius:12}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("div",{style:{...fe(180),height:16,width:80}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...fe(200),height:28,width:200,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(220),height:28,width:112,borderRadius:8}})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px 0"},children:jsxRuntime.jsx("div",{style:{...fe(240),height:14,width:56}})}),Array.from({length:e}).map((r,n)=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 0",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("div",{style:{...fe(260+n*40),width:28,height:28,borderRadius:8,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:4},children:[jsxRuntime.jsx("div",{style:{...fe(280+n*40),height:14,width:n%2===0?192:160}}),jsxRuntime.jsx("div",{style:{...fe(300+n*40),height:10,width:64}})]}),jsxRuntime.jsx("div",{style:{...fe(320+n*40),height:16,width:40}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...fe(340+n*40),height:32,width:80,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(360+n*40),height:32,width:80,borderRadius:8}})]})]},n))]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...fe(400),height:16,width:64}}),jsxRuntime.jsx("div",{style:{...fe(420),height:14,width:"100%"}}),jsxRuntime.jsx("div",{style:{...fe(440),height:14,width:"80%"}}),jsxRuntime.jsx("div",{style:{...fe(460),height:14,width:"60%"}})]})]})]})}function Ea(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Ma}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",padding:16},children:[jsxRuntime.jsx("div",{style:{...fe(0),height:40,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(60),height:96,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...fe(120),height:40,width:"100%",borderRadius:8}})]})]})}function ao(e,t){return e?.trim()||t}function lo(e){return ao(e.title_trans,e.title)??e.title}function Ym(e){return ao(e.question_trans,e.question)??e.question}function gi(e){return ao(e.description_trans,e.description)}function Qm(e){return ao(e.label_trans,e.label)??e.label}function qr(e){let t=e.outcomes?.[0];return t?Qm(t):Ym(e)}var Oa="var(--color-bullish)",Da="var(--color-bearish)";function bn(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 Zm(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function ef(e,t){let r=new Float64Array(101),n=new Float64Array(101);for(let d of e){let p=Math.round(d.price*100);p>=0&&p<=100&&(r[p]+=d.quantity);}for(let d of t){let p=Math.round(d.price*100);p>=0&&p<=100&&(n[p]+=d.quantity);}let o=0,i=0,a=new Float64Array(101),s=new Float64Array(101);for(let d=100;d>=0;d--)o+=r[d],i+=r[d]*d/100,a[d]=o,s[d]=i;let c=0,u=0,m=new Float64Array(101),l=new Float64Array(101);for(let d=0;d<=100;d++)c+=n[d],u+=n[d]*d/100,m[d]=c,l[d]=u;let f=Math.max(a[0]??0,m[100]??0);return Array.from({length:101},(d,p)=>{let h=a[p]>0,g=m[p]>0,v=a[p]||m[p],x=r[p]>0||n[p]>0;return {priceCents:p,displayHeight:Zm(v,f),opacity:v>0?x?1:.5:0,isBid:h,isAsk:g,bidCumTotal:a[p],askCumTotal:m[p],bidCumCost:s[p],askCumCost:l[p]}})}function tf({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?Oa:Da,n=e.leftPct>65?void 0:`${e.leftPct}%`,o=e.leftPct>65?`${100-e.leftPct}%`:void 0;return jsxRuntime.jsxs("div",{style:{position:"absolute",top:8,left:n,right:o,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:bn(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",bn(Math.round(e.cumCost))]})]})}var rf=react.memo(function({slot:t,onEnter:r,onLeave:n}){let o=react.useRef(null),i=t.isBid||t.isAsk,a=t.isBid?Oa:t.isAsk?Da:void 0;return jsxRuntime.jsx("div",{style:{position:"absolute",left:`${t.priceCents}%`,width:"1%",height:"100%",boxSizing:"border-box",borderRight:t.priceCents<100?"1px solid transparent":"none",cursor:i?"crosshair":"default"},onMouseEnter:()=>r(t,o.current),onMouseLeave:n,children:i&&jsxRuntime.jsx("div",{ref:o,style:{position:"absolute",bottom:0,left:0,width:"100%",height:`${t.displayHeight*100}%`,backgroundColor:a,opacity:t.opacity}})})}),nf=[0,10,20,30,40,50,60,70,80,90,100];function of(){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:nf.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 Aa({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),n=react.useMemo(()=>ef(e,t),[e,t]),o=react.useMemo(()=>{let l=e.length>0?Math.max(...e.map(d=>d.price)):0,f=t.length>0?Math.min(...t.map(d=>d.price)):1;return Math.round((l+f)/2*100)},[e,t]),i=react.useMemo(()=>n.some(l=>l.isBid||l.isAsk),[n]),[a,s]=react.useState(null),c=react.useRef(null),u=react.useCallback((l,f)=>{c.current&&(c.current.style.filter=""),f?(f.style.filter="brightness(1.5)",c.current=f):c.current=null,l.isBid||l.isAsk?s({priceCents:l.priceCents,isBid:l.isBid,cumTotal:l.isBid?l.bidCumTotal:l.askCumTotal,cumCost:l.isBid?l.bidCumCost:l.askCumCost,leftPct:l.priceCents}):s(null);},[]),m=react.useCallback(()=>{c.current&&(c.current.style.filter="",c.current=null),s(null);},[]);return i?jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",userSelect:"none",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{flex:1,position:"relative",width:"100%",overflow:"hidden"},children:[o>0&&jsxRuntime.jsx("div",{style:{position:"absolute",left:`${o}%`,top:0,bottom:0,width:1,backgroundImage:"repeating-linear-gradient(to bottom, #6b7280 0, #6b7280 4px, transparent 4px, transparent 8px)",zIndex:1,pointerEvents:"none"}}),a&&jsxRuntime.jsx(tf,{info:a}),n.map(l=>jsxRuntime.jsx(rf,{slot:l,onEnter:u,onLeave:m},l.priceCents))]}),jsxRuntime.jsx(of,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function Ua(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function Ba(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-neutral text-xs",children:jsxRuntime.jsx("span",{children:e("predict.orderBook.loading")})})}function $a({market:e,outcome:t="yes",onTradeAction:r,initialViewMode:n="depth",className:o,oddsFormatter:i}){let{t:a}=i18n.useTranslation(),[s,c]=react.useState(n),u=i??Ua,m=e.source,{data:l,isLoading:f,isFetching:d,refetch:p}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:m,outcome:t}),h=react.useMemo(()=>(l?.bids??[]).map(S=>({price:S.price,quantity:S.size})),[l?.bids]),g=react.useMemo(()=>(l?.asks??[]).map(S=>({price:S.price,quantity:S.size})),[l?.asks]),v=react.useMemo(()=>h.length>0?Math.max(...h.map(S=>S.price)):null,[h]),x=react.useMemo(()=>g.length>0?Math.min(...g.map(S=>S.price)):null,[g]),k=react.useMemo(()=>{if(v==null||x==null)return null;let S=(x-v)*100;return Math.round(S*10)/10},[v,x]);return jsxRuntime.jsxs("div",{className:ui$1.cn("flex flex-col",o??"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:k!=null?`${a("predict.orderBook.spread")}: ${Number.isInteger(k)?`${k}\xA2`:`${k.toFixed(1)}\xA2`}`:null}),jsxRuntime.jsxs("span",{className:"flex flex-1 items-center justify-center gap-x-1 whitespace-nowrap",children:[v!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bullish)"},children:[a("predict.trade.bestBid"),": ",u(v)]}),v!=null&&x!=null&&jsxRuntime.jsx("span",{className:"text-neutral",children:"|"}),x!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bearish)"},children:[a("predict.trade.bestAsk"),": ",u(x)]})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",title:s==="depth"?"Orderbook":"Depth chart",onClick:()=>c(S=>S==="depth"?"table":"depth"),className:"flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground",children:s==="depth"?jsxRuntime.jsx(ui$1.OrderbookTableIcon,{className:"h-4 w-4"}):jsxRuntime.jsx(ui$1.OrderbookDepthIcon,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{type:"button",title:"Refresh",onClick:()=>p(),disabled:d,className:ui$1.cn("flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground disabled:cursor-default disabled:opacity-50",d&&"animate-spin"),children:jsxRuntime.jsx(ui$1.RefreshIcon,{className:"h-4 w-4"})})]})]}),jsxRuntime.jsxs("div",{className:"relative flex-1 min-h-0 overflow-hidden",children:[s==="depth"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:f?jsxRuntime.jsx(Ba,{}):jsxRuntime.jsx(Aa,{bids:h,asks:g})}),s==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:f?jsxRuntime.jsx(Ba,{}):jsxRuntime.jsx(uf,{bids:h,asks:g,bestBid:v??void 0,bestAsk:x??void 0,spread:k??void 0,oddsFormatter:i})})]})]})}var vi=4,df=8;function uf({bids:e,asks:t,spread:r,oddsFormatter:n}){let{t:o}=i18n.useTranslation(),[i,a]=react.useState(false),s=i?df:vi,c=t.length>vi||e.length>vi,u=react.useMemo(()=>[...t].sort((d,p)=>d.price-p.price).slice(0,s).reverse(),[t,s]),m=react.useMemo(()=>[...e].sort((d,p)=>p.price-d.price).slice(0,s),[e,s]),l=react.useMemo(()=>{let d=[...u,...m].map(p=>p.quantity);return Math.max(...d,1)},[u,m]);return u.length===0&&m.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:[u.map(d=>jsxRuntime.jsx(Ha,{price:d.price,quantity:d.quantity,side:"ask",maxQty:l,oddsFormatter:n},`ask-${d.price}`)),jsxRuntime.jsxs("div",{className:"relative 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`]}),c&&jsxRuntime.jsx("button",{type:"button",onClick:()=>a(d=>!d),className:"absolute right-2 text-[10px] text-neutral transition-colors cursor-pointer hover:text-foreground",children:o(i?"predict.orderBook.collapse":"predict.orderBook.expand")})]}),m.map(d=>jsxRuntime.jsx(Ha,{price:d.price,quantity:d.quantity,side:"bid",maxQty:l,oddsFormatter:n},`bid-${d.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 Ha({price:e,quantity:t,side:r,maxQty:n,oddsFormatter:o}){let i=r==="ask",a=Math.min(t/n*100,100),s=i?"bg-bearish/10":"bg-bullish/10",c=i?"text-bearish":"text-bullish",u=bn(Math.round(t)),m=Math.round(t*e),l=`$${bn(m)}`;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:`${a}%`}}),jsxRuntime.jsx("span",{className:`relative z-10 ${c}`,children:o?o(e):Ua(e)}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-center",children:u}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-right",children:l})]})}var yi=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}},xn=4,Ka=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function Pf(e,t){let r=new Date(e);return t===le.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function wf(e,t){let r=new Date(e);return t===le.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):t===le.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 ja(e){return `${(e*100).toFixed(2)}%`}var Nf=[{range:le.ONE_DAY,label:"1D"},{range:le.ONE_WEEK,label:"1W"},{range:le.ONE_MONTH,label:"1M"},{range:le.ALL,label:"ALL"}];function Cf({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:Nf.map(({range:r,label:n})=>{let o=r===e;return jsxRuntime.jsx("button",{onClick:()=>t(r),style:{padding:"2px 8px",border:"none",background:"transparent",color:o?"#f9fafb":"#6b7280",fontWeight:o?700:400,fontSize:12,cursor:"pointer",borderRadius:4,letterSpacing:"0.02em",transition:"color 0.15s",userSelect:"none"},children:n},r)})})}function Mf(){let e=react.useRef(null),t=react.useRef(null),r=react.useCallback(o=>{let i=e.current,a=t.current;if(!i||!a)return;let s=i.getBoundingClientRect(),c=(o.clientX-s.left)/s.width*100;a.style.background=`linear-gradient(to right, transparent ${c}%, rgba(0,0,0,0.55) ${c}%)`,a.style.opacity="1";},[]),n=react.useCallback(()=>{t.current&&(t.current.style.opacity="0");},[]);return {wrapperRef:e,overlayRef:t,onMouseMove:r,onMouseLeave:n}}function Tf({active:e,payload:t,label:r,labelMap:n,allSeries:o,range:i}){if(!e||!o?.length)return null;let a=new Map;t?.forEach(c=>a.set(c.dataKey,c));let s=o.map(c=>a.get(c.slug)??{dataKey:c.slug,value:void 0,stroke:c.color,color:c.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"?wf(r,i):r}),s.map(c=>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:c.stroke??c.color,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:"#9ca3af",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:120},children:n.get(c.dataKey)??c.dataKey}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontWeight:700,fontVariantNumeric:"tabular-nums"},children:c.value!=null?ja(c.value):"--"})]},c.dataKey))]})}function Ef({markets:e,selectedSlugs:t,colorMap:r,onToggle:n}){let[o,i]=react.useState(false),a=react.useRef(null);react.useEffect(()=>{if(!o)return;function u(m){a.current&&!a.current.contains(m.target)&&i(false);}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]);let s=t.length>=xn,c=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(u=>jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:r.get(u)??"#6b7280",display:"inline-block"}},u))}),jsxRuntime.jsx("span",{style:{color:"#e5e7eb",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.length===1?(()=>{let u=e.find(m=>m.slug===t[0]);return u?qr(u):"1 market"})():`${t.length} / ${e.length} markets`})]});return jsxRuntime.jsxs("div",{ref:a,style:{position:"relative",display:"inline-block",width:200},children:[jsxRuntime.jsxs("button",{onClick:()=>i(u=>!u),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:[c,jsxRuntime.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{flexShrink:0,transform:o?"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"})})]}),o&&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 ",xn," markets"]}),e.map((u,m)=>{let l=t.includes(u.slug),f=!l&&s,d=l&&t.length===1,p=r.get(u.slug)??"#6b7280",h=u.outcomes.find(v=>v.label.toLowerCase()==="yes")??u.outcomes[0],g=h?.price!=null?`${Math.round(h.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{d||f||n(u.slug);},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"7px 12px",border:"none",background:l?"rgba(255,255,255,0.05)":"transparent",cursor:f||d?"not-allowed":"pointer",opacity:f?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:v=>{!f&&!d&&(v.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:v=>{v.currentTarget.style.background=l?"rgba(255,255,255,0.05)":"transparent";},children:[jsxRuntime.jsx("span",{style:{width:16,height:16,borderRadius:4,border:l?`2px solid ${p}`:"2px solid rgba(255,255,255,0.2)",background:l?`${p}30`:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:l&&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:p,strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:p,flexShrink:0}}),jsxRuntime.jsx("span",{style:{color:l?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:qr(u)}),g&&jsxRuntime.jsx("span",{style:{color:p,fontWeight:700,fontSize:12,flexShrink:0},children:g})]},u.id??`${m}-${u.slug}`)})]})]})}function Lf({series:e,colorMap:t,displayValues:r}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px 24px",padding:"0 2px"},children:e.map(n=>{let o=t.get(n.marketSlug)??"#6b7280",i=r.get(n.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:o,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:n.label}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontSize:14,fontWeight:700,lineHeight:"20px",fontVariantNumeric:"tabular-nums"},children:i!=null?ja(i):"--"})]})]},n.marketSlug)})})}function Rf(e){let t=Math.floor(e.length/2);return e.length%2===1?e[t]:(e[t-1]+e[t])/2}function _f(e,t){if(e.length<=t)return e;let r=[],n=e.length/t;for(let o=0;o<t;o++){let i=Math.floor(o*n),a=Math.min(Math.floor((o+1)*n),e.length),s=e.slice(i,a),c=s.map(u=>u.price).sort((u,m)=>u-m);r.push({timestamp:s[s.length-1].timestamp,price:Rf(c)});}return r}function If(e,t=200){if(e.length===0)return [];let r=e.map(s=>({...s,data:_f(s.data,t)})),n=new Set;r.forEach(s=>s.data.forEach(c=>n.add(c.timestamp)));let o=Array.from(n).sort((s,c)=>s-c),i=r.map(s=>{let c=new Map;return s.data.forEach(u=>c.set(u.timestamp,u.price)),{slug:s.marketSlug,map:c}}),a=new Map;return o.map(s=>{let c={timestamp:s};return i.forEach(({slug:u,map:m})=>{let l=m.get(s);if(l!==void 0)a.set(u,l),c[u]=l;else {let f=a.get(u);f!==void 0&&(c[u]=f);}}),c})}function Ga(e){return jsxRuntime.jsx(yi,{children:jsxRuntime.jsx(Of,{...e})})}function Of({event:e,isLoading:t,className:r,volume:n,fillHeight:o=false}){let i=react.useMemo(()=>{let N=new Set;return (e.markets??[]).filter(E=>N.has(E.slug)?false:(N.add(E.slug),true))},[e.markets]),a=react.useMemo(()=>[...i].sort((N,E)=>{let H=J=>(J.outcomes.find(de=>de.label.toLowerCase()==="yes")??J.outcomes[0])?.price??0;return H(E)-H(N)}),[i]),[s,c]=react.useState(()=>a.slice(0,xn).map(N=>N.slug));react.useEffect(()=>{let N=new Set(i.map(E=>E.slug));c(E=>{let H=E.filter(J=>N.has(J));return H.length===E.length?E:H.length>0?H:a.slice(0,xn).map(J=>J.slug)});},[i,a]);let[u,m]=react.useState(Hn),l=react.useMemo(()=>{let N=new Map;return s.forEach((E,H)=>{N.set(E,Ka[H%Ka.length]);}),N},[s]),f=react.useMemo(()=>i.filter(N=>s.includes(N.slug)),[i,s]),{series:d,isLoading:p}=reactPredict.useMarketHistory(f,u),h=t||p,g=react.useMemo(()=>{if(d.length>0&&d.some(H=>H.data.length>0))return d;let N=Date.now(),E=864e5;return f.map(H=>{let de=(H.outcomes?.find(se=>se.label.toLowerCase()==="yes")??H.outcomes?.[0])?.price??.5;return {marketSlug:H.slug,label:qr(H),data:[{timestamp:N-7*E,price:de},{timestamp:N,price:de}]}})},[d,f]),v=react.useMemo(()=>u===le.ONE_DAY?96:u===le.ONE_WEEK?168:u===le.ONE_MONTH?180:300,[u]),x=react.useMemo(()=>If(g,v),[g,v]),k=react.useMemo(()=>{if(x.length===0)return [0,1];let N=1/0,E=-1/0;if(s.forEach(J=>{x.forEach(de=>{let se=de[J];se!=null&&(se<N&&(N=se),se>E&&(E=se));});}),!isFinite(N))return [0,1];let H=Math.max((E-N)*.15,.05);return [Math.max(0,N-H),Math.min(1,E+H)]},[x,s]),S=react.useMemo(()=>{let N=new Map;return g.forEach(E=>{E.data.length>0&&N.set(E.marketSlug,E.data[E.data.length-1].price);}),N},[g]),b=react.useMemo(()=>{let N=new Map;return g.forEach(E=>N.set(E.marketSlug,E.label)),N},[g]),y=react.useMemo(()=>g.map(N=>({slug:N.marketSlug,color:l.get(N.marketSlug)??"#6b7280"})),[g,l]),{wrapperRef:M,overlayRef:A,onMouseMove:P,onMouseLeave:C}=Mf(),I=react.useCallback(N=>{c(E=>E.includes(N)?E.length<=1?E:E.filter(H=>H!==N):E.length>=xn?E:[...E,N]);},[]),[B,Y]=react.useState(null),z=react.useRef(null),Q=react.useRef(""),q=react.useRef(0),te=!h&&x.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12,...o?{height:"100%",minHeight:0}:null},children:[jsxRuntime.jsx(Lf,{series:g,colorMap:l,displayValues:B??S}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0,...o?{flex:1,minHeight:0}:null},children:[jsxRuntime.jsx("div",{ref:M,style:{width:"100%",userSelect:"none",position:"relative",...o?{flex:1,minHeight:240}:{height:300}},onMouseMove:te?N=>{P(N),cancelAnimationFrame(q.current),q.current=requestAnimationFrame(()=>{Y(z.current);});}:void 0,onMouseLeave:te?()=>{C(),cancelAnimationFrame(q.current),Q.current="",z.current=null,Y(null);}:void 0,children:h?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:A,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:N=>Pf(N,u),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:k,tickFormatter:N=>`${Math.round(N*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:N=>{let E=N;if(E.active&&E.payload?.length){let H=E.payload.map(J=>`${J.dataKey}:${J.value}`).join(",");if(H!==Q.current){Q.current=H;let J=new Map;E.payload.forEach(de=>{de.value!=null&&J.set(de.dataKey,de.value);}),z.current=J;}}return jsxRuntime.jsx(Tf,{...E,labelMap:b,allSeries:y,range:u})},cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),g.map(N=>{let E=l.get(N.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"linear",dataKey:N.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},N.marketSlug)}),B==null&&x.length>0&&g.map(N=>{let E=x[x.length-1],H=E[N.marketSlug];if(H==null)return null;let J=l.get(N.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:E.timestamp,y:H,ifOverflow:"extendDomain",shape:de=>{let{cx:se,cy:Ve}=de;return se==null||Ve==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:se,cy:Ve,r:6,fill:J,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:se,cy:Ve,r:3.5,fill:J})]})}},`pulse-${N.marketSlug}`)})]})})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"6px 8px",marginTop:6},children:[n!=null&&n>0&&jsxRuntime.jsxs("span",{style:{color:"#6b7280",fontSize:12},children:[utils$1.formatAmountInUsd(n)," vol"]}),jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),jsxRuntime.jsx(Cf,{value:u,onChange:m}),a.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(Ef,{markets:a,selectedSlugs:s,colorMap:l,onToggle:I})})]})]})]})}function po(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Ya(e,t){let r=e.outcomes[t==="yes"?0:1];return r?.best_ask??r?.price}function Qf(e){return `${parseFloat((e*100).toFixed(2))}%`}function Qa(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function mo(e){return qr(e)}function Xf(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function yn(e){if(!e)return "\u2014";let t=new Date(e);if(isNaN(t.getTime()))return "\u2014";let r=t.toLocaleString("default",{month:"short"}),n=t.getDate(),o=t.getFullYear(),i=t.getHours().toString().padStart(2,"0"),a=t.getMinutes().toString().padStart(2,"0");return `${r} ${n}, ${o} ${i}:${a}`}function Xa(e){let[t,r]=react.useState(0);if(react.useEffect(()=>{if(!e)return;r(Date.now());let m=setInterval(()=>r(Date.now()),1e3);return ()=>clearInterval(m)},[e]),!e||t===0)return null;let n=new Date(e).getTime();if(isNaN(n))return null;let o=n-t;if(o<=0)return null;let i=Math.floor(o/864e5),a=Math.floor(o%864e5/36e5),s=Math.floor(o%36e5/6e4),c=Math.floor(o%6e4/1e3),u=[];return i>0&&u.push(`${i}d`),u.push(`${String(a).padStart(2,"0")}h`),u.push(`${String(s).padStart(2,"0")}m`),u.push(`${String(c).padStart(2,"0")}s`),u.join(" ")}function Ja(e){if(!e)return null;let t=new Date(e);if(isNaN(t.getTime()))return null;let r=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),o=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0"),a=t.getFullYear(),s=-t.getTimezoneOffset(),c=s>=0?"+":"-",u=String(Math.abs(Math.floor(s/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${a} (${c}${u})`}function rl({event:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{ref:n,isCollapsed:o}=hooks.useScrollCollapse(),i=lo(e),a=react.useMemo(()=>{let f=[...e.markets||[]],d=f.filter(h=>h.status==="open").sort((h,g)=>po(g)-po(h)),p=f.filter(h=>h.status!=="open").sort((h,g)=>po(g)-po(h));return [...d,...p]},[e.markets]),s=e.status==="closed"||e.status==="voided",c=Xa(s?void 0:e.start_at),u=Xa(s?void 0:e.end_at),m=Ja(e.start_at),l=Ja(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:n,className:`sticky top-0 z-30 flex items-center backdrop-blur-md transition-all duration-300 ${o?"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$1.Avatar,{src:e.image_url||void 0,name:i||"Event",radius:"lg",classNames:{base:"bg-transparent"},className:`flex-shrink-0 transition-all duration-300 ${o?"!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:[!o&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e.tags?.slice(0,3).map((f,d)=>jsxRuntime.jsxs(react.Fragment,{children:[d>0&&jsxRuntime.jsx("span",{className:"text-sm text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral truncate",children:f.label})]},f.slug)),jsxRuntime.jsx(tg,{source:e.source})]}),jsxRuntime.jsx("span",{className:`font-semibold truncate transition-all duration-300 ${o?"text-sm lg:text-base":"text-lg lg:text-xl"}`,children:i})]})]}),(c||u||s)&&jsxRuntime.jsx("div",{className:"flex items-center gap-x-2 text-xs lg:text-sm font-mono",children:s?l&&jsxRuntime.jsx("span",{className:"text-neutral",children:r("predict.event.endedAt",{time:l})}):c?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.beginsIn",{time:c})}),m&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:m})]})]}):u?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:r("predict.event.endsIn",{time:u})}),l&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:l})]})]}):null}),jsxRuntime.jsx(Ga,{event:e,volume:e.volume??void 0}),jsxRuntime.jsx(Jf,{markets:a,onTradeAction:t}),jsxRuntime.jsx(eg,{markets:a,event:e})]})}var Za=5;function Jf({markets:e,onTradeAction:t}){let{t:r}=i18n.useTranslation(),{isDesktop:n}=ui$1.useScreen(),[o,i]=react.useState(false),[a,s]=react.useState(null),c=react.useMemo(()=>{let g=new Set;return e.filter(v=>g.has(v.slug)?false:(g.add(v.slug),true))},[e]),u=c.find(g=>g.status==="open")?.slug,[m,l]=react.useState(u?`${u}:yes`:null);if(c.length===0)return null;let f=c.length>Za,d=o?c:c.slice(0,Za),p=g=>{s(v=>v===g?null:g);},h=(g,v,x)=>{l(`${g.slug}:${v}`),n&&s(g.slug),t?.(g,v,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:d.map((g,v)=>{let x=a===g.slug;return jsxRuntime.jsx(Zf,{market:g,activeYes:m===`${g.slug}:yes`,activeNo:m===`${g.slug}:no`,isExpanded:x,onToggleExpand:()=>p(g.slug),onTradeAction:h},g.id??`${v}-${g.slug}`)})})]}),f&&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:r(o?"predict.event.rules.collapse":"predict.event.moreMarketsLabel")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-4 w-4 transition-transform",o&&"rotate-180")})]})]})}function Zf({market:e,activeYes:t,activeNo:r,isExpanded:n,onToggleExpand:o,onTradeAction:i}){let{t:a}=i18n.useTranslation(),s=e.status==="open",c=e.volume?`${utils$1.formatAmountInUsd(e.volume)} vol`:void 0,{data:u}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:e.source,outcome:"yes"},{enabled:s}),{data:m}=reactPredict.useOrderbook({slug:e.slug,source:e.source,outcome:"no"},{enabled:false,refetchInterval:false}),l=reactPredict.pickBestAsk(u,"yes")??Ya(e,"yes")??0,f=reactPredict.pickBestAsk(m,"no")??Ya(e,"no");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:o,role:"button",tabIndex:0,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),o());},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$1.Avatar,{src:e.image_url,name:mo(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:mo(e)}),c&&jsxRuntime.jsx("span",{className:"text-[8px] text-neutral lg:text-xxs",children:c})]})]})}),jsxRuntime.jsx("td",{className:"py-2 text-left text-foreground lg:text-center",children:Qf(l)}),jsxRuntime.jsx("td",{className:"py-2 pr-1 lg:pr-2",children:s?jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",className:ui$1.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 focus-visible:outline-2 focus-visible:outline-primary/40 focus-visible:outline-offset-2",t?"bg-primary text-primary-foreground":"bg-primary/10 text-primary"),onClick:d=>{d.stopPropagation(),i?.(e,"yes","buy");},children:a("predict.market.action.yes",{price:Qa(l)})}),jsxRuntime.jsx("button",{type:"button",className:ui$1.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 focus-visible:outline-2 focus-visible:outline-primary/40 focus-visible:outline-offset-2",r?"bg-secondary text-secondary-foreground":"bg-secondary/10 text-secondary"),onClick:d=>{d.stopPropagation(),i?.(e,"no","buy");},children:f!=null?a("predict.market.action.no",{price:Qa(f)}):a("predict.market.no")})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-end",children:jsxRuntime.jsx("span",{className:ui$1.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")})})})]}),n&&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($a,{market:e,outcome:r?"no":"yes",onTradeAction:i})})})})]})}function eg({markets:e,event:t}){let{t:r}=i18n.useTranslation(),[n,o]=react.useState(false),[i,a]=react.useState(false),[s,c]=react.useState(0),u=e.filter(d=>d.rules&&d.rules.length>0||gi(d));if(u.length===0)return null;let m=u[s]??u[0],l=m.rules&&m.rules.length>0?m.rules.join(`
76
+ `,Va={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:"detailShimmer 1.8s ease-in-out infinite",borderRadius:6};function ve(e){return {...Va,animationDelay:`${e}ms`}}function Sn({marketCount:e=4,showBack:t}){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Ka}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",gap:20},children:[t&&jsxRuntime.jsx("div",{style:{height:20}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[jsxRuntime.jsx("div",{style:{...Va,width:64,height:64,borderRadius:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("div",{style:{...ve(0),height:14,width:48}}),jsxRuntime.jsx("div",{style:{...ve(30),height:14,width:40}}),jsxRuntime.jsx("div",{style:{...ve(60),height:14,width:40}})]}),jsxRuntime.jsx("div",{style:{...ve(80),height:20,width:"80%",maxWidth:384,borderRadius:4}})]})]}),jsxRuntime.jsx("div",{style:{...ve(100),height:16,width:192}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:16},children:[jsxRuntime.jsx("div",{style:{...ve(120),height:16,width:96}}),jsxRuntime.jsx("div",{style:{...ve(140),height:16,width:80}})]}),jsxRuntime.jsx("div",{style:{...ve(160),height:300,width:"100%",borderRadius:12}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[jsxRuntime.jsx("div",{style:{...ve(180),height:16,width:80}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...ve(200),height:28,width:200,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...ve(220),height:28,width:112,borderRadius:8}})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"8px 0"},children:jsxRuntime.jsx("div",{style:{...ve(240),height:14,width:56}})}),Array.from({length:e}).map((r,n)=>jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"10px 0",borderBottom:"1px solid rgba(39,39,42,0.5)"},children:[jsxRuntime.jsx("div",{style:{...ve(260+n*40),width:28,height:28,borderRadius:8,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:4},children:[jsxRuntime.jsx("div",{style:{...ve(280+n*40),height:14,width:n%2===0?192:160}}),jsxRuntime.jsx("div",{style:{...ve(300+n*40),height:10,width:64}})]}),jsxRuntime.jsx("div",{style:{...ve(320+n*40),height:16,width:40}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsx("div",{style:{...ve(340+n*40),height:32,width:80,borderRadius:8}}),jsxRuntime.jsx("div",{style:{...ve(360+n*40),height:32,width:80,borderRadius:8}})]})]},n))]}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:8},children:[jsxRuntime.jsx("div",{style:{...ve(400),height:16,width:64}}),jsxRuntime.jsx("div",{style:{...ve(420),height:14,width:"100%"}}),jsxRuntime.jsx("div",{style:{...ve(440),height:14,width:"80%"}}),jsxRuntime.jsx("div",{style:{...ve(460),height:14,width:"60%"}})]})]})]})}function ja(){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Ka}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:12,borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",padding:16},children:[jsxRuntime.jsx("div",{style:{...ve(0),height:40,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...ve(60),height:96,width:"100%",borderRadius:8}}),jsxRuntime.jsx("div",{style:{...ve(120),height:40,width:"100%",borderRadius:8}})]})]})}var Xa="var(--color-bullish)",Ja="var(--color-bearish)";function Pn(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 bf(e,t){return e<=0||t<=0?0:Math.pow(e/t,.3)}function xf(e,t){let r=new Float64Array(101),n=new Float64Array(101);for(let d of e){let m=Math.round(d.price*100);m>=0&&m<=100&&(r[m]+=d.quantity);}for(let d of t){let m=Math.round(d.price*100);m>=0&&m<=100&&(n[m]+=d.quantity);}let o=0,i=0,s=new Float64Array(101),a=new Float64Array(101);for(let d=100;d>=0;d--)o+=r[d],i+=r[d]*d/100,s[d]=o,a[d]=i;let l=0,u=0,p=new Float64Array(101),c=new Float64Array(101);for(let d=0;d<=100;d++)l+=n[d],u+=n[d]*d/100,p[d]=l,c[d]=u;let g=Math.max(s[0]??0,p[100]??0);return Array.from({length:101},(d,m)=>{let h=s[m]>0,v=p[m]>0,f=s[m]||p[m],y=r[m]>0||n[m]>0;return {priceCents:m,displayHeight:bf(f,g),opacity:f>0?y?1:.5:0,isBid:h,isAsk:v,bidCumTotal:s[m],askCumTotal:p[m],bidCumCost:a[m],askCumCost:c[m]}})}function yf({info:e}){let{t}=i18n.useTranslation(),r=e.isBid?Xa:Ja,n=e.leftPct>65?void 0:`${e.leftPct}%`,o=e.leftPct>65?`${100-e.leftPct}%`:void 0;return jsxRuntime.jsxs("div",{style:{position:"absolute",top:8,left:n,right:o,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:Pn(Math.round(e.cumTotal))})}),jsxRuntime.jsxs("div",{style:{color:r},children:["$",Pn(Math.round(e.cumCost))]})]})}var kf=react.memo(function({slot:t,onEnter:r,onLeave:n}){let o=react.useRef(null),i=t.isBid||t.isAsk,s=t.isBid?Xa:t.isAsk?Ja:void 0;return jsxRuntime.jsx("div",{style:{position:"absolute",left:`${t.priceCents}%`,width:"1%",height:"100%",boxSizing:"border-box",borderRight:t.priceCents<100?"1px solid transparent":"none",cursor:i?"crosshair":"default"},onMouseEnter:()=>r(t,o.current),onMouseLeave:n,children:i&&jsxRuntime.jsx("div",{ref:o,style:{position:"absolute",bottom:0,left:0,width:"100%",height:`${t.displayHeight*100}%`,backgroundColor:s,opacity:t.opacity}})})}),Sf=[0,10,20,30,40,50,60,70,80,90,100];function Pf(){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:Sf.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 Za({bids:e,asks:t}){let{t:r}=i18n.useTranslation(),n=react.useMemo(()=>xf(e,t),[e,t]),o=react.useMemo(()=>{let c=e.length>0?Math.max(...e.map(d=>d.price)):0,g=t.length>0?Math.min(...t.map(d=>d.price)):1;return Math.round((c+g)/2*100)},[e,t]),i=react.useMemo(()=>n.some(c=>c.isBid||c.isAsk),[n]),[s,a]=react.useState(null),l=react.useRef(null),u=react.useCallback((c,g)=>{l.current&&(l.current.style.filter=""),g?(g.style.filter="brightness(1.5)",l.current=g):l.current=null,c.isBid||c.isAsk?a({priceCents:c.priceCents,isBid:c.isBid,cumTotal:c.isBid?c.bidCumTotal:c.askCumTotal,cumCost:c.isBid?c.bidCumCost:c.askCumCost,leftPct:c.priceCents}):a(null);},[]),p=react.useCallback(()=>{l.current&&(l.current.style.filter="",l.current=null),a(null);},[]);return i?jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",width:"100%",height:"100%",userSelect:"none",overflow:"hidden"},children:[jsxRuntime.jsxs("div",{style:{flex:1,position:"relative",width:"100%",overflow:"hidden"},children:[o>0&&jsxRuntime.jsx("div",{style:{position:"absolute",left:`${o}%`,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(yf,{info:s}),n.map(c=>jsxRuntime.jsx(kf,{slot:c,onEnter:u,onLeave:p},c.priceCents))]}),jsxRuntime.jsx(Pf,{})]}):jsxRuntime.jsx("div",{style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",color:"#6b7280",fontSize:13},children:r("predict.orderBook.noData")})}function il(e){let t=e*100,r=Math.round(t*10)/10;return Number.isInteger(r)?`${r}\xA2`:`${r.toFixed(1)}\xA2`}function tl(){let{t:e}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-neutral text-xs",children:jsxRuntime.jsx("span",{children:e("predict.orderBook.loading")})})}function sl({market:e,outcome:t="yes",onTradeAction:r,initialViewMode:n="depth",className:o,oddsFormatter:i}){let{t:s}=i18n.useTranslation(),[a,l]=react.useState(n),u=i??il,p=e.source,{data:c,isLoading:g,isFetching:d,refetch:m}=reactPredict.useRealtimeOrderbook({slug:e.slug,source:p,outcome:t}),h=react.useMemo(()=>(c?.bids??[]).map(k=>({price:k.price,quantity:k.size})),[c?.bids]),v=react.useMemo(()=>(c?.asks??[]).map(k=>({price:k.price,quantity:k.size})),[c?.asks]),f=react.useMemo(()=>h.length>0?Math.max(...h.map(k=>k.price)):null,[h]),y=react.useMemo(()=>v.length>0?Math.min(...v.map(k=>k.price)):null,[v]),x=react.useMemo(()=>{if(f==null||y==null)return null;let k=(y-f)*100;return Math.round(k*10)/10},[f,y]);return jsxRuntime.jsxs("div",{className:ui$1.cn("flex flex-col",o??"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:x!=null?`${s("predict.orderBook.spread")}: ${Number.isInteger(x)?`${x}\xA2`:`${x.toFixed(1)}\xA2`}`:null}),jsxRuntime.jsxs("span",{className:"flex flex-1 items-center justify-center gap-x-1 whitespace-nowrap",children:[f!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bullish)"},children:[s("predict.trade.bestBid"),": ",u(f)]}),f!=null&&y!=null&&jsxRuntime.jsx("span",{className:"text-neutral",children:"|"}),y!=null&&jsxRuntime.jsxs("span",{style:{color:"var(--color-bearish)"},children:[s("predict.trade.bestAsk"),": ",u(y)]})]}),jsxRuntime.jsxs("div",{className:"flex flex-1 items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",title:a==="depth"?"Orderbook":"Depth chart",onClick:()=>l(k=>k==="depth"?"table":"depth"),className:"flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground",children:a==="depth"?jsxRuntime.jsx(ui$1.OrderbookTableIcon,{className:"h-4 w-4"}):jsxRuntime.jsx(ui$1.OrderbookDepthIcon,{className:"h-4 w-4"})}),jsxRuntime.jsx("button",{type:"button",title:"Refresh",onClick:()=>m(),disabled:d,className:ui$1.cn("flex items-center text-neutral transition-colors cursor-pointer hover:text-foreground disabled:cursor-default disabled:opacity-50",d&&"animate-spin"),children:jsxRuntime.jsx(ui$1.RefreshIcon,{className:"h-4 w-4"})})]})]}),jsxRuntime.jsxs("div",{className:"relative flex-1 min-h-0 overflow-hidden",children:[a==="depth"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:g?jsxRuntime.jsx(tl,{}):jsxRuntime.jsx(Za,{bids:h,asks:v})}),a==="table"&&jsxRuntime.jsx(jsxRuntime.Fragment,{children:g?jsxRuntime.jsx(tl,{}):jsxRuntime.jsx(Tf,{bids:h,asks:v,bestBid:f??void 0,bestAsk:y??void 0,spread:x??void 0,oddsFormatter:i})})]})]})}var Oi=4,Ef=8;function Tf({bids:e,asks:t,spread:r,oddsFormatter:n}){let{t:o}=i18n.useTranslation(),[i,s]=react.useState(false),a=i?Ef:Oi,l=t.length>Oi||e.length>Oi,u=react.useMemo(()=>[...t].sort((d,m)=>d.price-m.price).slice(0,a).reverse(),[t,a]),p=react.useMemo(()=>[...e].sort((d,m)=>m.price-d.price).slice(0,a),[e,a]),c=react.useMemo(()=>{let d=[...u,...p].map(m=>m.quantity);return Math.max(...d,1)},[u,p]);return u.length===0&&p.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:[u.map(d=>jsxRuntime.jsx(rl,{price:d.price,quantity:d.quantity,side:"ask",maxQty:c,oddsFormatter:n},`ask-${d.price}`)),jsxRuntime.jsxs("div",{className:"relative 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`]}),l&&jsxRuntime.jsx("button",{type:"button",onClick:()=>s(d=>!d),className:"absolute right-2 text-[10px] text-neutral transition-colors cursor-pointer hover:text-foreground",children:o(i?"predict.orderBook.collapse":"predict.orderBook.expand")})]}),p.map(d=>jsxRuntime.jsx(rl,{price:d.price,quantity:d.quantity,side:"bid",maxQty:c,oddsFormatter:n},`bid-${d.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 rl({price:e,quantity:t,side:r,maxQty:n,oddsFormatter:o}){let i=r==="ask",s=Math.min(t/n*100,100),a=i?"bg-bearish/10":"bg-bullish/10",l=i?"text-bearish":"text-bullish",u=Pn(Math.round(t)),p=Math.round(t*e),c=`$${Pn(p)}`;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 ${a} transition-[width] duration-200`,style:{width:`${s}%`}}),jsxRuntime.jsx("span",{className:`relative z-10 ${l}`,children:o?o(e):il(e)}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-center",children:u}),jsxRuntime.jsx("span",{className:"relative z-10 text-foreground text-right",children:c})]})}var vo=new Map,Di=new Set,ll=0;function vt(e,t){return `${e}:${t}`}function cl(){ll+=1,Di.forEach(e=>e());}function If(e){return Di.add(e),()=>Di.delete(e)}function al(){return ll}function Df(e,t){return e?.bestAsk===t.bestAsk&&e?.bestBid===t.bestBid}function bo(e){return e!=null&&e>0&&Number.isFinite(e)?e:void 0}function Af(e,t,r){if(!e||!t)return;let n={bestAsk:bo(r.bestAsk),bestBid:bo(r.bestBid)};if(n.bestAsk===void 0&&n.bestBid===void 0){xo(e,t);return}let o=vt(e,t);Df(vo.get(o),n)||(vo.set(o,n),cl());}function dl(e,t,r){!e||!t||!r||Af(e,t,{bestAsk:bo(reactPredict.pickBestAsk(r,t)),bestBid:bo(reactPredict.pickBestBid(r,t))});}function xo(e,t){if(!e||!t)return;let r=vt(e,t);vo.delete(r)&&cl();}function ul(e){let t=react.useSyncExternalStore(If,al,al);return react.useMemo(()=>{let r=new Map;for(let n of e){let o=vt(n.slug,n.outcome),i=vo.get(o);i!==void 0&&r.set(o,i);}return r},[e,t])}var Ai=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}},Mn=4,pl=["#22d3ee","#a3e635","#f97316","#f472b6","#a78bfa"];function qf(e,t){let r=new Date(e);return t===$.ONE_HOUR||t===$.SIX_HOURS||t===$.ONE_DAY?r.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:false}):t===$.ALL?r.toLocaleDateString("en-US",{month:"numeric",day:"numeric"}):r.toLocaleDateString("en-US",{month:"short",day:"numeric"})}function Yf(e,t){let r=new Date(e);return t===$.ONE_HOUR||t===$.SIX_HOURS||t===$.ONE_DAY?r.toLocaleTimeString("en-US",{month:t===$.ONE_DAY?"short":void 0,day:t===$.ONE_DAY?"numeric":void 0,hour:"2-digit",minute:"2-digit",hour12:false}):t===$.ONE_MONTH||t===$.ALL?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 ml(e){return `${(e*100).toFixed(2)}%`}function Qf(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function Xf(e,t,r){let n=r*1e3,o=t.map(a=>Qf(a.created_at)).filter(a=>a!=null),i=o.length>0?Math.min(...o):void 0,s=bs[e];if(s!=null){let a=n-s*1e3;return [i!=null?Math.max(i,a):a,n]}return [i??n-7*864e5,n]}function Jf([e,t],r){if(!Number.isFinite(e)||!Number.isFinite(t)||t<=e)return [];let n=5,o=(t-e)/(n-1);return Array.from({length:n},(i,s)=>Math.round(e+o*s))}function Zf(e){switch(e){case $.ONE_HOUR:case $.SIX_HOURS:return 3e4;case $.ONE_DAY:return 6e4;case $.ONE_MONTH:case $.ALL:return 5*6e4;default:return 6e4}}function eg(e){return e.status==="open"||e.status==="pending"}var tg=[{range:$.ONE_HOUR,label:"1h"},{range:$.SIX_HOURS,label:"6h"},{range:$.ONE_DAY,label:"1D"},{range:$.ONE_MONTH,label:"1M"},{range:$.ALL,label:"ALL"}];function rg({value:e,onChange:t}){return jsxRuntime.jsx("div",{style:{display:"flex",alignItems:"center",gap:2},children:tg.map(({range:r,label:n})=>{let o=r===e;return jsxRuntime.jsx("button",{onClick:()=>t(r),style:{padding:"2px 8px",border:"none",background:"transparent",color:o?"#f9fafb":"#6b7280",fontWeight:o?700:400,fontSize:12,cursor:"pointer",borderRadius:4,letterSpacing:"0.02em",transition:"color 0.15s",userSelect:"none"},children:n},r)})})}function ng(){let e=react.useRef(null),t=react.useRef(null),r=react.useCallback(o=>{let i=e.current,s=t.current;if(!i||!s)return;let a=i.getBoundingClientRect(),l=(o.clientX-a.left)/a.width*100;s.style.background=`linear-gradient(to right, transparent ${l}%, rgba(0,0,0,0.55) ${l}%)`,s.style.opacity="1";},[]),n=react.useCallback(()=>{t.current&&(t.current.style.opacity="0");},[]);return {wrapperRef:e,overlayRef:t,onMouseMove:r,onMouseLeave:n}}function og({active:e,payload:t,label:r,labelMap:n,allSeries:o,range:i}){if(!e||!o?.length)return null;let s=new Map;t?.forEach(l=>s.set(l.dataKey,l));let a=o.map(l=>s.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"?Yf(r,i):r}),a.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:n.get(l.dataKey)??l.dataKey}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontWeight:700,fontVariantNumeric:"tabular-nums"},children:l.value!=null?ml(l.value):"--"})]},l.dataKey))]})}function ig({onPayload:e,...t}){let{active:r,label:n,payload:o}=t;return react.useEffect(()=>{r&&e(n,o);},[r,n,e,o]),jsxRuntime.jsx(og,{...t})}function sg({markets:e,selectedSlugs:t,colorMap:r,onToggle:n}){let[o,i]=react.useState(false),s=react.useRef(null);react.useEffect(()=>{if(!o)return;function u(p){s.current&&!s.current.contains(p.target)&&i(false);}return document.addEventListener("mousedown",u),()=>document.removeEventListener("mousedown",u)},[o]);let a=t.length>=Mn,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(u=>jsxRuntime.jsx("span",{style:{width:8,height:8,borderRadius:"50%",background:r.get(u)??"#6b7280",display:"inline-block"}},u))}),jsxRuntime.jsx("span",{style:{color:"#e5e7eb",fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.length===1?(()=>{let u=e.find(p=>p.slug===t[0]);return u?lr(u):"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(u=>!u),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:o?"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"})})]}),o&&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 ",Mn," markets"]}),e.map((u,p)=>{let c=t.includes(u.slug),g=!c&&a,d=c&&t.length===1,m=r.get(u.slug)??"#6b7280",h=u.outcomes.find(f=>f.label.toLowerCase()==="yes")??u.outcomes[0],v=h?.price!=null?`${Math.round(h.price*100)}%`:null;return jsxRuntime.jsxs("button",{onClick:()=>{d||g||n(u.slug);},style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"7px 12px",border:"none",background:c?"rgba(255,255,255,0.05)":"transparent",cursor:g||d?"not-allowed":"pointer",opacity:g?.35:1,textAlign:"left",transition:"background 0.1s"},onMouseEnter:f=>{!g&&!d&&(f.currentTarget.style.background="rgba(255,255,255,0.07)");},onMouseLeave:f=>{f.currentTarget.style.background=c?"rgba(255,255,255,0.05)":"transparent";},children:[jsxRuntime.jsx("span",{style:{width:16,height:16,borderRadius:4,border:c?`2px solid ${m}`:"2px solid rgba(255,255,255,0.2)",background:c?`${m}30`:"transparent",flexShrink:0,display:"flex",alignItems:"center",justifyContent:"center"},children:c&&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:c?"#f9fafb":"#9ca3af",fontSize:12,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:lr(u)}),v&&jsxRuntime.jsx("span",{style:{color:m,fontWeight:700,fontSize:12,flexShrink:0},children:v})]},u.id??`${p}-${u.slug}`)})]})]})}function ag({series:e,colorMap:t,displayValues:r}){return jsxRuntime.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px 24px",padding:"0 2px"},children:e.map(n=>{let o=t.get(n.marketSlug)??"#6b7280",i=r.get(n.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:o,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:n.label}),jsxRuntime.jsx("span",{style:{color:"#f9fafb",fontSize:14,fontWeight:700,lineHeight:"20px",fontVariantNumeric:"tabular-nums"},children:i!=null?ml(i):"--"})]})]},n.marketSlug)})})}function lg(e,t){if(e.length<=t)return e;let r=[],n=e.length/t;for(let o=0;o<t;o++){let i=Math.floor(o*n),s=Math.min(Math.floor((o+1)*n),e.length),a=e.slice(i,s),l=a[a.length-1];l&&r.push(l);}return r}function cg(e,t=200){if(e.length===0)return [];let r=e.map(a=>({...a,data:lg(a.data,t)})),n=new Set;r.forEach(a=>a.data.forEach(l=>n.add(l.timestamp)));let o=Array.from(n).sort((a,l)=>a-l),i=r.map(a=>{let l=new Map;return a.data.forEach(u=>l.set(u.timestamp,u.price)),{slug:a.marketSlug,map:l}}),s=new Map;return o.map(a=>{let l={timestamp:a};return i.forEach(({slug:u,map:p})=>{let c=p.get(a);if(c!==void 0)s.set(u,c),l[u]=c;else {let g=s.get(u);g!==void 0&&(l[u]=g);}}),l})}function fl(e){return jsxRuntime.jsx(Ai,{children:jsxRuntime.jsx(dg,{...e})})}function dg({event:e,isLoading:t,className:r,volume:n,fillHeight:o=false,orderbookQuotes:i}){let s=react.useMemo(()=>{let w=new Set;return (e.markets??[]).filter(T=>w.has(T.slug)?false:(w.add(T.slug),true))},[e.markets]),a=react.useMemo(()=>[...s].sort((w,T)=>{let W=J=>(J.outcomes.find(ne=>ne.label.toLowerCase()==="yes")??J.outcomes[0])?.price??0;return W(T)-W(w)}),[s]),[l,u]=react.useState(()=>a.slice(0,Mn).map(w=>w.slug));react.useEffect(()=>{let w=new Set(s.map(T=>T.slug));u(T=>{let W=T.filter(J=>w.has(J));return W.length===T.length?T:W.length>0?W:a.slice(0,Mn).map(J=>J.slug)});},[s,a]);let[p,c]=react.useState(Gn),g=react.useMemo(()=>{let w=new Map;return l.forEach((T,W)=>{w.set(T,pl[W%pl.length]);}),w},[l]),d=react.useMemo(()=>s.filter(w=>l.includes(w.slug)),[s,l]),m=react.useMemo(()=>d.map(w=>w.slug).join("|"),[d]),[h,v]=react.useState(()=>Math.floor(Date.now()/1e3)),f=react.useMemo(()=>Zf(p),[p]),y=react.useMemo(()=>d.some(eg),[d]);react.useEffect(()=>{v(Math.floor(Date.now()/1e3));},[p,m]),react.useEffect(()=>{if(!y)return;let w=()=>{let W=Math.floor(Date.now()/1e3);v(J=>J===W?J:W);},T=window.setInterval(w,f);return ()=>window.clearInterval(T)},[f,y]);let x=react.useMemo(()=>Xf(p,d,h),[p,d,h]),k=react.useMemo(()=>Jf(x),[x,p]),{series:b,isLoading:S}=reactPredict.useMarketHistory(d,p,{endTs:h}),M=`${p}:${m}`,B=react.useRef(new Map),N=B.current.get(M),C=S&&N!=null&&N.length>0,I=C?N:b;react.useEffect(()=>{!S&&b.length>0&&B.current.set(M,b);},[M,S,b]);let D=!!(t||S&&!C),j=react.useMemo(()=>{let w=new Map;return i&&d.forEach(T=>{let W=i.get(vt(T.slug,"yes"))?.bestAsk;W!=null&&W>0&&Number.isFinite(W)&&w.set(T.slug,W);}),w},[i,d]),L=react.useMemo(()=>I.length>0&&I.some(w=>w.data.length>0)?I.map(w=>{let T=j.get(w.marketSlug);if(T==null||w.data.length===0)return w;let W=w.data[w.data.length-1];if(Math.abs(W.price-T)<1e-6)return w;let J=Math.min(Date.now(),x[1]),ne={timestamp:J,price:T},me=J-W.timestamp<5e3?[...w.data.slice(0,-1),{...W,price:T}]:[...w.data,ne];return {...w,data:me}}):D?[]:d.map(w=>{let T=w.outcomes?.find(J=>J.label.toLowerCase()==="yes")??w.outcomes?.[0],W=j.get(w.slug)??T?.best_ask??T?.best_bid??T?.price??.5;return {marketSlug:w.slug,label:lr(w),data:[{timestamp:x[0],price:W},{timestamp:x[1],price:W}]}}),[I,D,j,d,x]),U=react.useMemo(()=>p===$.ONE_HOUR?80:p===$.SIX_HOURS?400:p===$.ONE_DAY?320:p===$.ONE_MONTH?3e3:2e3,[p]),H=react.useMemo(()=>cg(L,U),[L,U]),ee=react.useMemo(()=>{if(H.length===0)return [0,1];let w=1/0,T=-1/0;if(l.forEach(J=>{H.forEach(ne=>{let me=ne[J];me!=null&&(me<w&&(w=me),me>T&&(T=me));});}),!isFinite(w))return [0,1];let W=Math.max((T-w)*.15,.05);return [Math.max(0,w-W),Math.min(1,T+W)]},[H,l]),re=react.useMemo(()=>{let w=new Map;return L.forEach(T=>{T.data.length>0&&w.set(T.marketSlug,T.data[T.data.length-1].price);}),w},[L]),ue=react.useMemo(()=>{let w=new Map;return L.forEach(T=>w.set(T.marketSlug,T.label)),w},[L]),ce=react.useMemo(()=>L.map(w=>({slug:w.marketSlug,color:g.get(w.marketSlug)??"#6b7280"})),[L,g]),{wrapperRef:Ae,overlayRef:Xe,onMouseMove:Fe,onMouseLeave:ot}=ng(),$e=react.useCallback(w=>{u(T=>T.includes(w)?T.length<=1?T:T.filter(W=>W!==w):T.length>=Mn?T:[...T,w]);},[]),[Be,P]=react.useState(null),Je=react.useRef(""),Te=react.useRef(0),Ne=react.useCallback((w,T)=>{if(!T?.length)return;let W=`${w}:${T.map(ne=>`${ne.dataKey}:${ne.value}`).join(",")}`;if(W===Je.current)return;Je.current=W;let J=new Map;T.forEach(ne=>{ne.value!=null&&J.set(ne.dataKey,ne.value);}),cancelAnimationFrame(Te.current),Te.current=requestAnimationFrame(()=>{P(J);});},[]),lt=react.useCallback(()=>{ot(),cancelAnimationFrame(Te.current),Je.current="",P(null);},[ot]),Se=!D&&H.length>0;return jsxRuntime.jsxs("div",{className:r,style:{display:"flex",flexDirection:"column",gap:12,...o?{height:"100%",minHeight:0}:null},children:[jsxRuntime.jsx(ag,{series:L,colorMap:g,displayValues:Be??re}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:0,...o?{flex:1,minHeight:0}:null},children:[jsxRuntime.jsx("div",{ref:Ae,style:{width:"100%",userSelect:"none",position:"relative",...o?{flex:1,minHeight:240}:{height:300}},onMouseMove:Se?w=>{Fe(w);}:void 0,onMouseLeave:Se?lt:void 0,children:D?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:Xe,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},onMouseLeave:lt,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:x,ticks:k,interval:0,tickFormatter:w=>qf(w,p),axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},minTickGap:70}),jsxRuntime.jsx(recharts.YAxis,{domain:ee,tickFormatter:w=>`${Math.round(w*100)}%`,axisLine:false,tickLine:false,tick:{fill:"#6b7280",fontSize:11},width:40,tickCount:6}),jsxRuntime.jsx(recharts.Tooltip,{content:w=>jsxRuntime.jsx(ig,{...w,labelMap:ue,allSeries:ce,range:p,onPayload:Ne}),cursor:{stroke:"#4b5563",strokeWidth:1,strokeDasharray:"4 4"},wrapperStyle:{zIndex:2},isAnimationActive:false}),L.map(w=>{let T=g.get(w.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.Line,{type:"monotone",dataKey:w.marketSlug,stroke:T,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",dot:false,activeDot:{r:4.5,strokeWidth:2,stroke:"rgba(10,10,10,0.8)",fill:T},connectNulls:true,isAnimationActive:false},w.marketSlug)}),Be==null&&H.length>0&&L.map(w=>{let T=H[H.length-1],W=T[w.marketSlug];if(W==null)return null;let J=g.get(w.marketSlug)??"#6b7280";return jsxRuntime.jsx(recharts.ReferenceDot,{x:T.timestamp,y:W,ifOverflow:"extendDomain",shape:ne=>{let{cx:me,cy:ct}=ne;return me==null||ct==null?jsxRuntime.jsx("g",{}):jsxRuntime.jsxs("g",{children:[jsxRuntime.jsxs("circle",{cx:me,cy:ct,r:6,fill:J,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:ct,r:3.5,fill:J})]})}},`pulse-${w.marketSlug}`)})]})})]})}),jsxRuntime.jsxs("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"6px 8px",marginTop:6},children:[n!=null&&n>0&&jsxRuntime.jsxs("span",{style:{color:"#6b7280",fontSize:12},children:[utils$1.formatAmountInUsd(n)," vol"]}),jsxRuntime.jsx("div",{style:{flex:1,minWidth:0}}),jsxRuntime.jsx(rg,{value:p,onChange:c}),a.length>1&&jsxRuntime.jsx("div",{style:{width:"100%",display:"flex",alignItems:"center"},children:jsxRuntime.jsx(sg,{markets:a,selectedSlugs:l,colorMap:g,onToggle:$e})})]})]})]})}function yo(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function gl(e,t){let r=e.outcomes[t==="yes"?0:1];return r?.best_ask??r?.price}function wg(e){return `${parseFloat((e*100).toFixed(2))}%`}function hl(e){let t=e*100;return t<1&&t>0?"< 1":parseFloat(t.toFixed(2)).toString()}function ko(e){return lr(e)}function Ng(e){switch(e){case "polymarket":return "Polymarket";case "kalshi":return "Kalshi";default:return e}}function Cn(e){if(!e)return "\u2014";let t=new Date(e);if(isNaN(t.getTime()))return "\u2014";let r=t.toLocaleString("default",{month:"short"}),n=t.getDate(),o=t.getFullYear(),i=t.getHours().toString().padStart(2,"0"),s=t.getMinutes().toString().padStart(2,"0");return `${r} ${n}, ${o} ${i}:${s}`}function vl(e){let[t,r]=react.useState(0);if(react.useEffect(()=>{if(!e)return;r(Date.now());let p=setInterval(()=>r(Date.now()),1e3);return ()=>clearInterval(p)},[e]),!e||t===0)return null;let n=new Date(e).getTime();if(isNaN(n))return null;let o=n-t;if(o<=0)return null;let i=Math.floor(o/864e5),s=Math.floor(o%864e5/36e5),a=Math.floor(o%36e5/6e4),l=Math.floor(o%6e4/1e3),u=[];return i>0&&u.push(`${i}d`),u.push(`${String(s).padStart(2,"0")}h`),u.push(`${String(a).padStart(2,"0")}m`),u.push(`${String(l).padStart(2,"0")}s`),u.join(" ")}function bl(e){if(!e)return null;let t=new Date(e);if(isNaN(t.getTime()))return null;let r=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),o=(t.getMonth()+1).toString().padStart(2,"0"),i=t.getDate().toString().padStart(2,"0"),s=t.getFullYear(),a=-t.getTimezoneOffset(),l=a>=0?"+":"-",u=String(Math.abs(Math.floor(a/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${s} (${l}${u})`}function Po({event:e,orderbookQuotes:t,onTradeAction:r}){let{t:n}=i18n.useTranslation(),{ref:o,isCollapsed:i}=hooks.useScrollCollapse(),s=zr(e),a=react.useMemo(()=>{let d=[...e.markets||[]],m=d.filter(v=>v.status==="open").sort((v,f)=>yo(f)-yo(v)),h=d.filter(v=>v.status!=="open").sort((v,f)=>yo(f)-yo(v));return [...m,...h]},[e.markets]),l=e.status==="closed"||e.status==="voided",u=vl(l?void 0:e.start_at),p=vl(l?void 0:e.end_at),c=bl(e.start_at),g=bl(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 ${i?"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$1.Avatar,{src:e.image_url||void 0,name:s||"Event",radius:"lg",classNames:{base:"bg-transparent"},className:`flex-shrink-0 transition-all duration-300 ${i?"!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:[!i&&jsxRuntime.jsxs("div",{className:"flex items-center gap-1.5",children:[e.tags?.slice(0,3).map((d,m)=>jsxRuntime.jsxs(react.Fragment,{children:[m>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(Tg,{source:e.source})]}),jsxRuntime.jsx("span",{className:`font-semibold truncate transition-all duration-300 ${i?"text-sm lg:text-base":"text-lg lg:text-xl"}`,children:s})]})]}),(u||p||l)&&jsxRuntime.jsx("div",{className:"flex items-center gap-x-2 text-xs lg:text-sm font-mono",children:l?g&&jsxRuntime.jsx("span",{className:"text-neutral",children:n("predict.event.endedAt",{time:g})}):u?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:n("predict.event.beginsIn",{time:u})}),c&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:c})]})]}):p?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-foreground",children:n("predict.event.endsIn",{time:p})}),g&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"text-neutral/50",children:"\xB7"}),jsxRuntime.jsx("span",{className:"text-neutral",children:g})]})]}):null}),jsxRuntime.jsx(fl,{event:e,volume:e.volume??void 0,orderbookQuotes:t}),jsxRuntime.jsx(Mg,{markets:a,orderbookQuotes:t,onTradeAction:r}),jsxRuntime.jsx(Eg,{markets:a,event:e})]})}var xl=5;function Mg({markets:e,orderbookQuotes:t,onTradeAction:r}){let{t:n}=i18n.useTranslation(),{isDesktop:o}=ui$1.useScreen(),[i,s]=react.useState(false),[a,l]=react.useState(null),u=react.useMemo(()=>{let f=new Set;return e.filter(y=>f.has(y.slug)?false:(f.add(y.slug),true))},[e]),p=u.find(f=>f.status==="open")?.slug,[c,g]=react.useState(p?`${p}:yes`:null);if(u.length===0)return null;let d=u.length>xl,m=i?u:u.slice(0,xl),h=f=>{l(y=>y===f?null:f);},v=(f,y,x)=>{g(`${f.slug}:${y}`),o&&l(f.slug),r?.(f,y,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:n("predict.market.table.chance")}),jsxRuntime.jsx("th",{})]})}),jsxRuntime.jsx("tbody",{children:m.map((f,y)=>{let x=a===f.slug;return jsxRuntime.jsx(Cg,{market:f,activeYes:c===`${f.slug}:yes`,activeNo:c===`${f.slug}:no`,isExpanded:x,orderbookQuotes:t,onToggleExpand:()=>h(f.slug),onTradeAction:v},f.id??`${y}-${f.slug}`)})})]}),d&&jsxRuntime.jsxs("button",{type:"button",onClick:()=>s(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:n(i?"predict.event.rules.collapse":"predict.event.moreMarketsLabel")}),jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:ui$1.cn("h-4 w-4 transition-transform",i&&"rotate-180")})]})]})}function Cg({market:e,activeYes:t,activeNo:r,isExpanded:n,orderbookQuotes:o,onToggleExpand:i,onTradeAction:s}){let{t:a}=i18n.useTranslation(),l=e.status==="open",u=e.volume?`${utils$1.formatAmountInUsd(e.volume)} vol`:void 0,p=o?.get(vt(e.slug,"yes"))?.bestAsk??gl(e,"yes")??0,c=o?.get(vt(e.slug,"no"))?.bestAsk??gl(e,"no");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:g=>{(g.key==="Enter"||g.key===" ")&&(g.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$1.Avatar,{src:e.image_url,name:ko(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:ko(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:wg(p)}),jsxRuntime.jsx("td",{className:"py-2 pr-1 lg:pr-2",children:l?jsxRuntime.jsxs("div",{className:"flex items-center justify-end gap-x-2",children:[jsxRuntime.jsx("button",{type:"button",className:ui$1.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 focus-visible:outline-2 focus-visible:outline-primary/40 focus-visible:outline-offset-2",t?"bg-primary text-primary-foreground":"bg-primary/10 text-primary"),onClick:g=>{g.stopPropagation(),s?.(e,"yes","buy");},children:a("predict.market.action.yes",{price:hl(p)})}),jsxRuntime.jsx("button",{type:"button",className:ui$1.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 focus-visible:outline-2 focus-visible:outline-primary/40 focus-visible:outline-offset-2",r?"bg-secondary text-secondary-foreground":"bg-secondary/10 text-secondary"),onClick:g=>{g.stopPropagation(),s?.(e,"no","buy");},children:c!=null?a("predict.market.action.no",{price:hl(c)}):a("predict.market.no")})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-end",children:jsxRuntime.jsx("span",{className:ui$1.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")})})})]}),n&&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(sl,{market:e,outcome:r?"no":"yes",onTradeAction:s})})})})]})}function Eg({markets:e,event:t}){let{t:r}=i18n.useTranslation(),[n,o]=react.useState(false),[i,s]=react.useState(false),[a,l]=react.useState(0),u=e.filter(d=>d.rules&&d.rules.length>0||ri(d));if(u.length===0)return null;let p=u[a]??u[0],c=p.rules&&p.rules.length>0?p.rules.join(`
77
77
 
78
- `):gi(m)??"";if(!l)return null;let f=l.length>200&&!n?l.slice(0,200)+"...":l;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")}),u.length>1&&jsxRuntime.jsxs(ui$1.Dropdown,{placement:"bottom-end",classNames:{content:"min-w-36 bg-content1 border border-border"},children:[jsxRuntime.jsx(ui$1.DropdownTrigger,{children:jsxRuntime.jsx(ui$1.Button,{size:"sm",variant:"bordered",radius:"lg",endContent:jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:"h-3.5 w-3.5"}),className:"text-xs text-foreground",children:mo(m)})}),jsxRuntime.jsx(ui$1.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(s)],onAction:d=>{c(Number(d)),o(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:u.map((d,p)=>jsxRuntime.jsx(ui$1.DropdownItem,{className:ui$1.cn(p===s?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:mo(d)},String(p)))})]})]}),jsxRuntime.jsx("div",{className:"text-xs text-foreground/80 lg:text-sm whitespace-pre-wrap",children:f}),l.length>200&&jsxRuntime.jsx("button",{type:"button",onClick:()=>o(d=>!d),className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors self-start",children:r(n?"predict.event.rules.collapse":"predict.event.showMore")}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>a(d=>!d),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$1.ChevronDownIcon,{className:ui$1.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 d=m.status,p=[];return m.created_at&&p.push({label:r("predict.event.timeline.created"),value:yn(m.created_at),isActive:true}),p.push({label:r("predict.event.timeline.open"),value:yn(m.start_at),isActive:d!=="pending"}),d==="voided"?p.push({label:r("predict.event.timeline.voided"),value:yn(m.closed_at??m.end_at),isActive:true}):d==="closed"?p.push({label:r("predict.event.timeline.closed"),value:yn(m.closed_at??m.end_at),isActive:true}):p.push({label:r("predict.event.timeline.close"),value:yn(m.end_at),isActive:false}),p})().map((d,p,h)=>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 ${d.isActive?"border-primary bg-primary":"border-border bg-transparent"}`}),p<h.length-1&&jsxRuntime.jsx("div",{className:"w-px flex-1 bg-border"})]}),jsxRuntime.jsxs("div",{className:`flex flex-col ${p<h.length-1?"pb-4":""}`,children:[jsxRuntime.jsx("span",{className:"text-xs font-medium text-foreground lg:text-sm",children:d.label}),jsxRuntime.jsx("span",{className:"text-xs text-neutral lg:text-sm",children:d.value})]})]},d.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:m.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.source"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:Xf(m.source)})]})]})]})]})}function tg({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$1.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui$1.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}function nl({eventSlug:e,source:t,lang:r,onTradeAction:n}){let{data:o,isLoading:i,error:a}=reactPredict.useEvent({slug:e,source:t,lang:r});return i?jsxRuntime.jsx(vn,{}):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(rl,{event:o,onTradeAction:n})}var sg={kalshi:{label:"KALSHI",color:"#00d492",bgColor:"rgba(0, 212, 146, 0.12)",icon:jsxRuntime.jsx(ui$1.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$1.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}},ag={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function ur(e){return sg[e]??ag}function f2({source:e,className:t}){let r=ur(e);return jsxRuntime.jsxs("span",{className:ui$1.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]})}var il="rgba(39,39,42,0.6)",fg="rgba(63,63,70,0.8)";function gg(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function al({eventSlug:e,source:t,lang:r,limit:n=4,onEventClick:o,onEventHover:i}){let{t:a}=i18n.useTranslation(),{data:s,isLoading:c}=reactPredict.useSimilarEvents({slug:e,source:t,lang:r,limit:n});return c||!s||s.length===0?null:jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-3 mt-6 px-1 lg:px-0",children:[jsxRuntime.jsx("span",{style:{color:"#f4f4f5",fontSize:14,fontWeight:600},children:a("predict.similar.title")}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-2",children:s.map(u=>jsxRuntime.jsx(hg,{event:u,onClick:o,onHover:i},`${u.source}-${u.slug}`))})]})}function hg({event:e,onClick:t,onHover:r}){let{t:n}=i18n.useTranslation(),o=ur(e.source),i=lo(e),a=react.useMemo(()=>gg(e.volume),[e.volume]),s=e.tags?.[0];return jsxRuntime.jsxs("button",{type:"button",onClick:()=>t?.(e),onMouseEnter:c=>{c.currentTarget.style.borderColor=fg,r?.(e);},onMouseLeave:c=>{c.currentTarget.style.borderColor=il;},style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:14,border:`1px solid ${il}`,background:"rgba(24,24,27,0.4)",cursor:"pointer",textAlign:"left",width:"100%",transition:"border-color 0.2s"},className:"group",children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:i[0]||"?",radius:"full",className:"size-9 shrink-0 bg-transparent",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,gap:2},children:[jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:i}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:3,color:o.color,flexShrink:0},children:[o.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",textTransform:"uppercase"},children:o.label})]}),jsxRuntime.jsx("span",{style:{color:"#52525b"},children:"\xB7"}),jsxRuntime.jsxs("span",{style:{color:"#a1a1aa"},children:[a," ",n("predict.event.volume")]}),s&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{style:{color:"#52525b"},children:"\xB7"}),jsxRuntime.jsx("span",{style:{color:"#71717a"},children:s.label})]})]})]}),jsxRuntime.jsx(ui$1.ChevronRightIcon,{width:14,height:14,className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",style:{color:"#71717a"}})]})}function go(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function z2({eventSlug:e,source:t,chain:r,lang:n,walletAddress:o,onSimilarEventClick:i,onSimilarEventHover:a,onBack:s,renderActivitySection:c,onInsufficientBalance:u,onSetupRequired:m,slippageBps:l}){let{t:f}=i18n.useTranslation(),{isDesktop:d}=ui$1.useScreen(),{onOpen:p}=uiScaffold.useAsyncModal(ln),{onOpen:h}=uiScaffold.useAsyncModal(li),{data:g,isLoading:v}=reactPredict.useEvent({slug:e,source:t,lang:n}),x=react.useMemo(()=>{let P=[...g?.markets||[]],C=P.filter(B=>B.status==="open").sort((B,Y)=>go(Y)-go(B)),I=P.filter(B=>B.status!=="open").sort((B,Y)=>go(Y)-go(B));return [...C,...I]},[g?.markets]),[k,S]=react.useState(null),b=react.useCallback((P,C,I)=>{S(B=>({market:P,outcome:C,side:I,version:(B?.version??0)+1})),!d&&g&&(I==="sell"?h({params:{event:g,market:P,initialOutcome:C,chain:r,slippageBps:l,onSetupRequired:m}}):p({params:{event:g,market:P,initialOutcome:C,chain:r,slippageBps:l,onInsufficientBalance:u}}));},[d,g,r,l,p,h,u,m]),y=k?.market??x[0];if(v){let P=!!s;return d?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(vn,{showBack:P})}),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(Ea,{})})})]}):jsxRuntime.jsx(vn,{showBack:P})}let M=k?`${k.market.slug}-${k.version}`:y?.slug??"default",A=k?.side==="sell";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:[s&&jsxRuntime.jsx("div",{className:"flex items-center justify-between",children:jsxRuntime.jsx(ui$1.Button,{as:"a",onPress:s,startContent:jsxRuntime.jsx(ui$1.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:f("common.back")})}),jsxRuntime.jsx(nl,{eventSlug:e,source:t,onTradeAction:b})]}),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:[y&&(A?jsxRuntime.jsx(no,{event:g,market:y,initialOutcome:k?.outcome,chain:r,slippageBps:l,onSetupRequired:m},M):jsxRuntime.jsx(qn,{event:g,market:y,initialOutcome:k?.outcome,chain:r,slippageBps:l,onInsufficientBalance:u},M)),g&&jsxRuntime.jsx(al,{eventSlug:e,source:g.source,lang:n,onEventClick:i,onEventHover:a})]})]}),g&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:c?c({event:g,walletAddress:o}):jsxRuntime.jsx(Ca,{event:g,walletAddress:o})}),jsxRuntime.jsx(Yn,{}),jsxRuntime.jsx(Pa,{}),jsxRuntime.jsx(la,{})]})}function cl(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Lg(e){switch(e){case le.ONE_DAY:return {interval:"15m",limit:96};case le.ONE_WEEK:return {interval:"1h",limit:168};case le.ONE_MONTH:return {interval:"4h",limit:180};case le.ALL:return {interval:"1d",limit:300};default:return {interval:"1h",limit:100}}}var G2=e=>{let{candlestickMarketSlugs:t,chartRange:r=Hn,source:n}=e,o=reactPredict.usePredictClient(),i=react.useMemo(()=>Lg(r),[r]),{data:a,isLoading:s,error:c}=reactPredict.useEvent({slug:e.eventSlug,source:n}),u=react.useMemo(()=>{if(!a?.markets)return [];let p=new Set,h=a.markets.filter(v=>p.has(v.slug)?false:(p.add(v.slug),true));return (t&&t.length>0?t.slice(0,4).map(v=>h.find(x=>x.slug===v)).filter(v=>v!==void 0):[...h].sort((v,x)=>cl(x)-cl(v)).slice(0,4)).map(v=>v.slug)},[t,a?.markets]),m=reactQuery.useQueries({queries:u.map(p=>({queryKey:reactPredict.candlesticksQueryKey(p,i),queryFn:()=>o.listCandlesticks(p,i),enabled:u.length>0}))}),l=m.some(p=>p.isLoading),f=react.useMemo(()=>{let p=new Map;return u.forEach((h,g)=>{let v=m[g]?.error;v&&p.set(h,v);}),p},[u,m]),d=react.useMemo(()=>{let p=new Map;return u.forEach((h,g)=>{let v=m[g]?.data;v&&p.set(h,v);}),p},[u,m]);return {event:a,isEventLoading:s,eventError:c,candlestickParams:i,candlesticks:d,isCandlesticksLoading:l,candlestickErrors:f}};function Pi({comment:e,anonymousLabel:t,isReply:r=false}){let{profile:n}=e,o=n.name||n.pseudonym||t,i=react.useMemo(()=>Og(e.created_at),[e.created_at]);return jsxRuntime.jsxs("div",{className:ui$1.cn("flex gap-x-2.5 px-1 py-3 border-b border-border/40 lg:px-2",r&&"pl-8 lg:pl-9"),children:[jsxRuntime.jsx(Rg,{src:n.profile_image,name:o,className:ui$1.cn("shrink-0",r?"size-6":"size-8 lg:size-7")}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-baseline gap-x-2",children:[jsxRuntime.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:o}),jsxRuntime.jsx("span",{className:"ml-auto shrink-0 text-xs text-neutral",children:i})]}),jsxRuntime.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground/90",children:e.body}),jsxRuntime.jsxs("div",{className:"mt-2 flex items-center gap-x-1 text-neutral",children:[jsxRuntime.jsx(_g,{className:"size-3.5"}),jsxRuntime.jsx("span",{className:"text-xs tabular-nums",children:e.reaction_count})]})]})]})}function Rg({src:e,name:t,className:r}){let n=t.trim().charAt(0).toUpperCase()||"?",o=react.useMemo(()=>Ig(t),[t]);return e?jsxRuntime.jsx("img",{src:e,alt:t,loading:"lazy",className:ui$1.cn("rounded-full object-cover",r)}):jsxRuntime.jsx("span",{className:ui$1.cn("flex items-center justify-center rounded-full text-xs font-semibold text-white",r),style:{backgroundColor:o},"aria-hidden":true,children:n})}function _g({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"})})}function Ig(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return `hsl(${Math.abs(t)%360}, 55%, 45%)`}function Og(e){let t=new Date(e).getTime();if(Number.isNaN(t))return "";let r=Math.max(0,Math.floor((Date.now()-t)/1e3));if(r<60)return "now";let n=Math.floor(r/60);if(n<60)return `${n}m`;let o=Math.floor(n/60);if(o<24)return `${o}h`;let i=Math.floor(o/24);if(i<7)return `${i}d`;let a=Math.floor(i/7);return a<5?`${a}w`:new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"})}var Kg={latest:{order:"createdAt",ascending:false},oldest:{order:"createdAt",ascending:true},mostLiked:{order:"reactionCount",ascending:false}},pl={latest:"predict.comments.sortLatest",oldest:"predict.comments.sortOldest",mostLiked:"predict.comments.sortMostLiked"},Vg=["latest","oldest","mostLiked"],jg=600,Gg=112;function qg({slug:e,source:t,limit:r=20,height:n,className:o}){let{t:i}=i18n.useTranslation(),[a,s]=react.useState("latest"),[c,u]=react.useState(false),m=Kg[a],{data:l,isLoading:f,isFetchingNextPage:d,hasNextPage:p,fetchNextPage:h}=reactPredict.useInfiniteComments({slug:e,source:t,limit:r,order:m.order,ascending:m.ascending,holders_only:c}),g=react.useMemo(()=>l?.pages?.flatMap(C=>C.items)??[],[l?.pages]),v=react.useRef(null),{height:x}=hooks.useResizeObserver({ref:v}),k=n??(x||jg),S=reactWindow.useDynamicRowHeight({defaultRowHeight:Gg,key:`${e}:${t}:${a}:${c}`}),b=g.length,y=b+(p?1:0),M=react.useCallback(C=>C<b,[b]),A=react.useCallback(async()=>{p&&!d&&await h();},[p,d,h]),P=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:M,loadMoreRows:A,rowCount:y,threshold:5});return jsxRuntime.jsxs("div",{className:ui$1.cn("flex h-full w-full flex-col",o),children:[jsxRuntime.jsx(Qg,{sort:a,onSortChange:s,holdersOnly:c,onHoldersOnlyChange:u}),jsxRuntime.jsx("div",{className:"min-h-0 flex-auto overflow-hidden",ref:v,children:f?jsxRuntime.jsx(Xg,{}):g.length===0?jsxRuntime.jsx(Jg,{message:i("predict.comments.empty")}):jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:k},onRowsRendered:P,rowComponent:Yg,rowCount:y,rowHeight:S,rowProps:{comments:g,itemCount:b,anonymousLabel:i("predict.comments.anonymous")},overscanCount:4})})]})}function Yg({index:e,style:t,comments:r,itemCount:n,anonymousLabel:o}){if(e>=n)return jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})});let i=r[e];return i?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(Pi,{comment:i,anonymousLabel:o,isReply:!!i.parent_comment_id})}):null}function Qg({sort:e,onSortChange:t,holdersOnly:r,onHoldersOnlyChange:n}){let{t:o}=i18n.useTranslation(),[i,a]=react.useState(false),s=react.useRef(null);return react.useEffect(()=>{if(!i)return;let c=m=>{s.current&&!s.current.contains(m.target)&&a(false);},u=m=>{m.key==="Escape"&&a(false);};return document.addEventListener("mousedown",c),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",c),document.removeEventListener("keydown",u);}},[i]),jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-2 px-1 py-2 lg:px-2",children:[jsxRuntime.jsxs("div",{ref:s,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>a(c=>!c),className:"inline-flex items-center gap-x-1.5 rounded-lg border border-border bg-content2/40 px-3 py-1.5 text-sm text-foreground transition-colors hover:bg-content2 cursor-pointer",children:[jsxRuntime.jsx(Zg,{className:"size-3.5 text-neutral"}),jsxRuntime.jsx("span",{children:o(pl[e])}),jsxRuntime.jsx(e0,{className:ui$1.cn("size-3.5 text-neutral transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsx("div",{className:"absolute left-0 top-full z-20 mt-1.5 min-w-40 overflow-hidden rounded-xl border border-border bg-content1 p-1 shadow-xl",children:Vg.map(c=>{let u=c===e;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{t(c),a(false);},className:ui$1.cn("flex w-full items-center gap-x-2 rounded-lg px-3 py-2 text-left text-sm transition-colors cursor-pointer",u?"bg-primary/10 text-primary":"text-neutral hover:bg-content2 hover:text-foreground"),children:[jsxRuntime.jsx("span",{className:"flex-1 font-medium",children:o(pl[c])}),u&&jsxRuntime.jsx(ml,{className:"size-4 text-primary"})]},c)})})]}),jsxRuntime.jsxs("button",{type:"button",role:"switch","aria-checked":r,onClick:()=>n(!r),className:ui$1.cn("inline-flex items-center gap-x-1.5 rounded-lg border px-3 py-1.5 text-sm transition-colors cursor-pointer",r?"border-primary/40 bg-primary/10 text-primary":"border-border bg-content2/40 text-neutral hover:text-foreground"),children:[jsxRuntime.jsx("span",{className:ui$1.cn("flex size-4 items-center justify-center rounded border",r?"border-primary bg-primary":"border-neutral"),children:r&&jsxRuntime.jsx(ml,{className:"size-3 text-background"})}),o("predict.comments.holdersOnly")]})]})}function Xg(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-4 px-1 py-3 lg:px-2",children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsxs("div",{className:"flex gap-x-2.5",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"size-8 shrink-0 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1 space-y-2",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3 w-24 rounded"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3 w-full rounded"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3 w-2/3 rounded"})]})]},t))})}function Jg({message:e}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[jsxRuntime.jsx(ui$1.EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsxRuntime.jsx("p",{className:"mt-2 text-sm text-neutral",children:e})]})}function Zg({className:e}){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,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 e0({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function ml({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})}var n0=10,o0=utils.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function yo(){let[e,t]=jotai.useAtom(o0),r=react.useCallback(o=>{let i=o.trim();i&&t(a=>{let s=a.filter(c=>c!==i);return [i,...s].slice(0,n0)});},[t]),n=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:n}}function xl({histories:e,onSelect:t,onClear:r,className:n}){let{t:o}=i18n.useTranslation();return e.length===0?null:jsxRuntime.jsxs("div",{className:ui$1.cn("px-4 pb-4",n),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:o("predict.search.history")}),jsxRuntime.jsx(ui$1.Button,{isIconOnly:true,size:"sm",className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui$1.TrashIcon,{width:20,height:20})})]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:e.map(i=>jsxRuntime.jsx(ui$1.Chip,{size:"sm",variant:"bordered",className:ui$1.cn("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(i),children:i},i))})]})}function yl({onSelect:e,className:t}){let{histories:r,clearHistories:n}=yo();return jsxRuntime.jsx(xl,{className:ui$1.cn(t),histories:r,onSelect:e,onClear:n})}function kl({value:e,onValueChange:t,onClear:r,onEscape:n,className:o}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:o,children:jsxRuntime.jsx(ui$1.StyledInput,{autoFocus:true,variant:"bordered",radius:"lg",value:e,onValueChange:t,placeholder:i("predict.search.placeholder"),classNames:{inputWrapper:["!bg-[rgba(39,39,42,0.6)]","!border-[rgba(63,63,70,0.5)]","data-[hover=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!border-[rgba(63,63,70,0.8)]"].join(" ")},startContent:jsxRuntime.jsx(ui$1.SearchIcon,{width:20,height:20,className:"text-neutral"}),endContent:e?jsxRuntime.jsx(ui$1.Button,{isIconOnly:true,className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui$1.XCloseIcon,{width:20,height:20})}):jsxRuntime.jsx(ui$1.Kbd,{className:"min-w-8 justify-center text-xs text-neutral bg-transparent border border-[rgba(63,63,70,0.5)] rounded-lg cursor-pointer select-none",onMouseDown:a=>{a.preventDefault(),n?.();},children:"Esc"})})})}function w0(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function N0(e){return e.title_trans||e.title}function Sl({event:e,href:t,LinkComponent:r,onSelect:n,onHover:o,className:i}){let{t:a}=i18n.useTranslation(),s=N0(e),c=react.useMemo(()=>w0(e.volume),[e.volume]);return jsxRuntime.jsxs(ui$1.Linkable,{href:t,LinkComponent:r,className:ui$1.cn("group 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:u=>{t&&n&&u.preventDefault(),n?.(e);},onMouseEnter:()=>o?.(e),children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:s||"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 line-clamp-2 group-hover:text-primary transition-colors",children:s}),jsxRuntime.jsx("div",{className:"flex items-center gap-x-2 text-[10px] font-normal text-neutral-500 lg:text-xs",children:jsxRuntime.jsxs("span",{className:"text-neutral-400",children:[c," ",a("predict.event.volume")]})})]}),jsxRuntime.jsx(ui$1.ChevronRightIcon,{width:16,height:16,className:"shrink-0 text-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function Pl({keyword:e="",limit:t,source:r}){let{data:n,isLoading:o,isFetchingNextPage:i,hasNextPage:a,fetchNextPage:s}=reactPredict.useSearchEvents({keyword:e,limit:t,source:r,sort_by:e?void 0:"volume",sort_asc:e?void 0:false},{enabled:true});return {events:react.useMemo(()=>n?.pages.flatMap(u=>u.items).filter(u=>u!=null)??[],[n]),isLoading:o,isFetchingNextPage:i,hasNextPage:a??false,fetchNextPage:s}}var O0=64;function Ml({onSelect:e,getEventHref:t,LinkComponent:r,onHover:n,className:o,...i}){let{events:a,isLoading:s,isFetchingNextPage:c,hasNextPage:u,fetchNextPage:m}=Pl(i),l=react.useRef(null),{height:f}=hooks.useResizeObserver({ref:l}),d=react.useCallback(v=>v<a.length,[a]),p=react.useCallback(async()=>{u&&!c&&await m();},[u,c,m]),h=react.useMemo(()=>u?a.length+1:a.length,[a,u]),g=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:d,loadMoreRows:p,rowCount:h,threshold:5});return s?jsxRuntime.jsx(A0,{className:o}):a.length===0?jsxRuntime.jsx(F0,{className:o}):jsxRuntime.jsx("div",{className:ui$1.cn("w-full h-full flex flex-col",o),children:jsxRuntime.jsx("div",{className:"flex-auto min-h-0",ref:l,children:jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:f},onRowsRendered:g,rowComponent:D0,rowCount:h,rowHeight:O0,rowProps:{events:a,onSelect:e,getEventHref:t,LinkComponent:r,onHover:n},overscanCount:5})})})}function D0({index:e,style:t,events:r,onSelect:n,getEventHref:o,LinkComponent:i,onHover:a}){let s=r[e];return s?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(Sl,{event:s,href:o?.(s),LinkComponent:i,onSelect:n,onHover:a})}):jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})}function A0({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-2 py-16",e),children:[jsxRuntime.jsx(ui$1.Spinner,{size:"sm"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral",children:t("predict.search.loading")})]})}function F0({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui$1.cn("flex flex-col items-center justify-center py-16",e),children:[jsxRuntime.jsx(ui$1.EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsxRuntime.jsx("p",{className:"mt-2 text-sm text-neutral",children:t("predict.search.noResults")})]})}function Rl({onKeywordChange:e}){let[t,r]=react.useState(""),[n,o]=react.useState(""),{addHistory:i}=yo(),a=hooks.useCallbackRef(e),s=hooks.useCallbackRef(i),c=react.useMemo(()=>utils$1.debounce(f=>{o(f),a(f),f&&s(f);},500),[a,s]),u=react.useCallback(f=>{r(f),c(f);},[c]),m=react.useCallback(f=>{c.cancel(),r(f),o(f),a(f),f&&s(f);},[c,a,s]),l=react.useCallback(()=>m(""),[m]);return {text:t,keyword:n,setText:u,setKeyword:m,clearKeyword:l}}function _l({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:n,onHover:o,onEscape:i,source:a}){let{text:s,keyword:c,setText:u,setKeyword:m,clearKeyword:l}=Rl({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(kl,{value:s,onValueChange:u,onClear:l,onEscape:i}),!c&&jsxRuntime.jsx(yl,{onSelect:m}),jsxRuntime.jsx(Ml,{className:"flex-auto min-h-0",keyword:c,onSelect:t,getEventHref:r,LinkComponent:n,onHover:o,source:a})]})}var Ei="predict-search";function HS({id:e=Ei}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Q0,{...t})})}function Q0({params:e,isOpen:t,onOpenChange:r,onResult:n}){let{t:o}=i18n.useTranslation(),{isMobile:i}=ui$1.useScreen(),a=react.useCallback(c=>{n(c);},[n]),s=react.useCallback(()=>{r(false);},[r]);return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:i?"full":"lg",hideCloseButton:true,backdrop:"opaque",radius:"lg",children:jsxRuntime.jsxs(ui$1.ModalContent,{className:"w-full h-full",style:{borderRadius:i?void 0:14,border:i?void 0:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:i?void 0:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},children:[jsxRuntime.jsxs(ui$1.ModalHeader,{className:"sm:hidden flex items-center justify-between pt-4 pb-2",children:[jsxRuntime.jsx("span",{className:"text-base font-semibold",children:o("predict.search.title")}),jsxRuntime.jsx(ui$1.Button,{isIconOnly:true,onPress:()=>r(false),size:"sm",className:"bg-transparent min-w-6 w-6 h-6",children:jsxRuntime.jsx(ui$1.XCloseIcon,{width:20,height:20})})]}),jsxRuntime.jsx(ui$1.ModalBody,{className:"p-4",children:jsxRuntime.jsx(_l,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:a,onEscape:s})})]})})}function qS({onSelectEvent:e,modalParams:t,className:r}){let{t:n}=i18n.useTranslation(),{isDesktop:o}=ui$1.useScreen(),{onOpen:i,onClose:a}=uiScaffold.useAsyncModal(Ei),s=hooks.useCallbackRef(e),c=hooks.useCallbackRef(async()=>{let m=await i({params:t});m&&s(m);}),u=hooks.useCallbackRef(()=>{a();});return react.useEffect(()=>{let m=l=>{let f=document.activeElement,d=!!f&&(f.tagName==="INPUT"||f.tagName==="TEXTAREA"||f.getAttribute("contenteditable")==="true");l.key==="/"&&!d&&(l.preventDefault(),c()),l.key==="Escape"&&(l.preventDefault(),u());};return window.addEventListener("keydown",m),()=>{window.removeEventListener("keydown",m);}},[c,u]),o?jsxRuntime.jsx(ui$1.Button,{size:"sm",radius:"full",onPress:c,variant:"bordered",startContent:jsxRuntime.jsx(ui$1.SearchIcon,{width:16,height:16,className:"text-foreground"}),endContent:jsxRuntime.jsx(ui$1.Kbd,{className:"min-w-6 justify-center text-xs text-foreground bg-content3 rounded-lg",children:"/"}),className:ui$1.cn("w-56 min-w-0 h-8 min-h-0 border-transparent hover:border-border bg-content2 pl-3 pr-1.5 text-neutral",r),children:n("predict.search.placeholder")}):jsxRuntime.jsx(ui$1.Button,{size:"sm",radius:"full",isIconOnly:true,onPress:c,variant:"bordered",className:ui$1.cn("w-8 min-w-0 h-8 min-h-0 border-1 border-border bg-content2",r),children:jsxRuntime.jsx(ui$1.SearchIcon,{width:16,height:16,className:"text-foreground"})})}var Ri=[{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"}],$l=[{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}],zl={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"},Wl={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 oh(e,t){if(!e)return "$5K+";let r=$l.find(n=>n.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function Kl({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:n,minVolume:o,onMinVolumeChange:i,onRefresh:a}){let{t:s}=i18n.useTranslation(),[c,u]=react.useState(false),[m,l]=react.useState(false),[f,d]=react.useState(false),[p,h]=react.useState(false),g=react.useRef(null),v=react.useRef(null),x=Ri.find(b=>b.value===e)??Ri[0],k=react.useCallback(b=>{g.current&&!g.current.contains(b.target)&&u(false),v.current&&!v.current.contains(b.target)&&l(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)),[k]);let S=react.useCallback(()=>{a?.(),h(true),setTimeout(()=>h(false),700);},[a]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
78
+ `):ri(p)??"";if(!c)return null;let g=c.length>200&&!n?c.slice(0,200)+"...":c;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")}),u.length>1&&jsxRuntime.jsxs(ui$1.Dropdown,{placement:"bottom-end",classNames:{content:"min-w-36 bg-content1 border border-border"},children:[jsxRuntime.jsx(ui$1.DropdownTrigger,{children:jsxRuntime.jsx(ui$1.Button,{size:"sm",variant:"bordered",radius:"lg",endContent:jsxRuntime.jsx(ui$1.ChevronDownIcon,{className:"h-3.5 w-3.5"}),className:"text-xs text-foreground",children:ko(p)})}),jsxRuntime.jsx(ui$1.DropdownMenu,{"aria-label":"Select market rules",selectionMode:"single",selectedKeys:[String(a)],onAction:d=>{l(Number(d)),o(false);},classNames:{list:"gap-1"},itemClasses:{base:"rounded-md px-3 h-8"},children:u.map((d,m)=>jsxRuntime.jsx(ui$1.DropdownItem,{className:ui$1.cn(m===a?"bg-content2 text-foreground":"text-neutral","data-[hover=true]:bg-content2 data-[hover=true]:text-foreground"),children:ko(d)},String(m)))})]})]}),jsxRuntime.jsx("div",{className:"text-xs text-foreground/80 lg:text-sm whitespace-pre-wrap",children:g}),c.length>200&&jsxRuntime.jsx("button",{type:"button",onClick:()=>o(d=>!d),className:"text-xs text-neutral hover:text-foreground cursor-pointer transition-colors self-start",children:r(n?"predict.event.rules.collapse":"predict.event.showMore")}),jsxRuntime.jsxs("button",{type:"button",onClick:()=>s(d=>!d),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$1.ChevronDownIcon,{className:ui$1.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 d=p.status,m=[];return p.created_at&&m.push({label:r("predict.event.timeline.created"),value:Cn(p.created_at),isActive:true}),m.push({label:r("predict.event.timeline.open"),value:Cn(p.start_at),isActive:d!=="pending"}),d==="voided"?m.push({label:r("predict.event.timeline.voided"),value:Cn(p.closed_at??p.end_at),isActive:true}):d==="closed"?m.push({label:r("predict.event.timeline.closed"),value:Cn(p.closed_at??p.end_at),isActive:true}):m.push({label:r("predict.event.timeline.close"),value:Cn(p.end_at),isActive:false}),m})().map((d,m,h)=>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 ${d.isActive?"border-primary bg-primary":"border-border bg-transparent"}`}),m<h.length-1&&jsxRuntime.jsx("div",{className:"w-px flex-1 bg-border"})]}),jsxRuntime.jsxs("div",{className:`flex flex-col ${m<h.length-1?"pb-4":""}`,children:[jsxRuntime.jsx("span",{className:"text-xs font-medium text-foreground lg:text-sm",children:d.label}),jsxRuntime.jsx("span",{className:"text-xs text-neutral lg:text-sm",children:d.value})]})]},d.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:p.slug})]}),jsxRuntime.jsxs("span",{children:[jsxRuntime.jsxs("span",{className:"text-neutral",children:[r("predict.event.id.source"),":"]})," ",jsxRuntime.jsx("span",{className:"text-foreground",children:Ng(p.source)})]})]})]})]})}function Tg({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$1.PolymarketIcon,{className:"h-5 w-auto shrink-0"}):jsxRuntime.jsx(ui$1.KalshiIcon,{className:"h-3 w-auto shrink-0"})]})}var Sl="rgba(39,39,42,0.6)",Dg="rgba(63,63,70,0.8)";function Ag(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function wl({eventSlug:e,source:t,lang:r,limit:n=4,onEventClick:o,onEventHover:i}){let{t:s}=i18n.useTranslation(),{data:a,isLoading:l}=reactPredict.useSimilarEvents({slug:e,source:t,lang:r,limit:n});return l||!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("div",{className:"-mx-1 px-1 py-1.5 lg:sticky lg:top-0 lg:z-10 lg:bg-[#0a0a0b]",children:jsxRuntime.jsx("span",{style:{color:"#f4f4f5",fontSize:14,fontWeight:600},children:s("predict.similar.title")})}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 gap-2",children:a.map(u=>jsxRuntime.jsx(Fg,{event:u,onClick:o,onHover:i},`${u.source}-${u.slug}`))})]})}function Fg({event:e,onClick:t,onHover:r}){let{t:n}=i18n.useTranslation(),o=zr(e),i=react.useMemo(()=>Ag(e.volume),[e.volume]);return jsxRuntime.jsxs("button",{type:"button",onClick:()=>t?.(e),onMouseEnter:s=>{s.currentTarget.style.borderColor=Dg,r?.(e);},onMouseLeave:s=>{s.currentTarget.style.borderColor=Sl;},style:{display:"flex",alignItems:"center",gap:10,padding:"10px 12px",borderRadius:14,border:`1px solid ${Sl}`,background:"rgba(24,24,27,0.4)",cursor:"pointer",textAlign:"left",width:"100%",transition:"border-color 0.2s"},className:"group",children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:o[0]||"?",radius:"full",className:"size-9 shrink-0 bg-transparent",imgProps:{className:"object-cover"}}),jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,gap:2},children:[jsxRuntime.jsx("span",{style:{fontSize:13,fontWeight:500,color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:o}),jsxRuntime.jsxs("span",{style:{fontSize:10,color:"#a1a1aa"},children:[i," ",n("predict.event.volume")]})]}),jsxRuntime.jsx(ui$1.ChevronRightIcon,{width:14,height:14,className:"shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",style:{color:"#71717a"}})]})}var Mo=100,Ug=15e3,Co=["yes","no"];function $g(e){return e.source??"polymarket"}function Kg(e){return {market_id:e.market_slug,outcome:e.outcome,bids:e.bids,asks:e.asks,spread:e.spread}}function Vg(e){let t=e.filter(r=>r.status==="open").map(r=>({slug:r.slug,source:$g(r)})).sort((r,n)=>r.slug.localeCompare(n.slug));return JSON.stringify(t)}function jg(e){let t=e.filter(r=>r.status==="open").flatMap(r=>Co.map(n=>({slug:r.slug,outcome:n}))).sort((r,n)=>{let o=r.slug.localeCompare(n.slug);return o!==0?o:r.outcome.localeCompare(n.outcome)});return JSON.stringify(t)}function Ml(e){let t=reactPredict.usePredictClient(),{wsClient:r}=reactPredict.usePredictWsClient(),n=reactQuery.useQueryClient(),o=react.useRef(new Set),i=react.useMemo(()=>Vg(e),[e]),s=react.useMemo(()=>JSON.parse(i),[i]),a=react.useMemo(()=>new Map(s.map(f=>[f.slug,f])),[s]),l=react.useMemo(()=>new Set(s.map(f=>f.slug)),[s]),u=react.useRef(l);u.current=l;let p=react.useRef(a);p.current=a;let c=react.useMemo(()=>jg(e),[e]),g=react.useMemo(()=>JSON.parse(c),[c]),d=ul(g),m=react.useCallback((f,y,x,k)=>{if(!k){xo(f,x);return}let b={...k,market_id:k.market_id||f,outcome:x};n.setQueryData(reactPredict.orderbookQueryKey(f,y,x),b),dl(f,x,b);},[n]),h=react.useCallback(async(f,y)=>{try{let x=f.flatMap(b=>Co.map(S=>({slug:b.slug,source:b.source,outcome:S}))),k=await t.getOrderbooks(x);if(y?.cancelled?.())return;for(let b of k){let S=b.outcome,M=vt(b.slug,S);y?.markSeeded&&o.current.add(M),m(b.slug,b.source,S,b.orderbook);}}catch{if(!y?.markSeeded||y?.cancelled?.())return;for(let x of f)for(let k of Co)o.current.add(vt(x.slug,k));}},[m,t]);react.useEffect(()=>{let f=s.filter(x=>Co.some(k=>!o.current.has(vt(x.slug,k))));if(f.length===0)return;let y=false;return (async()=>{for(let x=0;x<f.length;x+=Mo){if(y)return;await h(f.slice(x,x+Mo),{cancelled:()=>y,markSeeded:true});}})(),()=>{y=true;}},[h,s]),react.useEffect(()=>{if(s.length===0)return;let f=false,y=async()=>{for(let k=0;k<s.length;k+=Mo){if(f)return;await h(s.slice(k,k+Mo),{cancelled:()=>f});}},x=window.setInterval(()=>{y();},Ug);return ()=>{f=true,window.clearInterval(x);}},[h,s]),react.useEffect(()=>{o.current.forEach(f=>{let[y,x]=f.split(":");l.has(y)||(o.current.delete(f),xo(y,x));});},[l]),react.useEffect(()=>{if(r)return r.on("orderbook",f=>{let y=f.data.market_slug,x=f.data.outcome;if(x!=="yes"&&x!=="no"||!u.current.has(y))return;let k=p.current.get(y);k&&m(y,k.source,x,Kg(f.data));})},[m,r]);let v=react.useRef(new Set);return react.useEffect(()=>{if(!r)return;let f=v.current,y=[],x=[];l.forEach(k=>{f.has(k)||y.push(k);}),f.forEach(k=>{l.has(k)||x.push(k);}),y.length>0&&r.subscribe(["orderbook"],y),x.length>0&&r.unsubscribe(["orderbook"],x),v.current=new Set(l);},[l,r]),react.useEffect(()=>{if(r)return ()=>{let f=Array.from(v.current);f.length>0&&r.unsubscribe(["orderbook"],f),v.current=new Set;}},[r]),d}function To(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function Ro(e,t){if(!e.outcomes?.length)return e;let r=false,n=e.outcomes.map((o,i)=>{let s=i===0?"yes":"no",a=t.get(vt(e.slug,s));if(!a)return o;let l=a.bestBid??o.best_bid,u=a.bestAsk??o.best_ask,p=a.bestAsk??o.price;return l===o.best_bid&&u===o.best_ask&&p===o.price?o:(r=true,{...o,best_bid:l,best_ask:u,price:p})});return r?{...e,outcomes:n}:e}function e0(e,t){if(!e.markets?.length||t.size===0)return e;let r=false,n=e.markets.map(o=>{let i=Ro(o,t);return i!==o&&(r=true),i});return r?{...e,markets:n}:e}function wk({eventSlug:e,source:t,chain:r,lang:n,walletAddress:o,onSimilarEventClick:i,onSimilarEventHover:s,onBack:a,renderActivitySection:l,onInsufficientBalance:u,onSetupRequired:p,slippageBps:c}){let{t:g}=i18n.useTranslation(),{isDesktop:d}=ui$1.useScreen(),{onOpen:m}=uiScaffold.useAsyncModal(mn),{onOpen:h}=uiScaffold.useAsyncModal(Ni),{data:v,isLoading:f}=reactPredict.useEvent({slug:e,source:t,lang:n}),y=react.useMemo(()=>{let D=[...v?.markets||[]],j=D.filter(U=>U.status==="open").sort((U,H)=>To(H)-To(U)),L=D.filter(U=>U.status!=="open").sort((U,H)=>To(H)-To(U));return [...j,...L]},[v?.markets]),x=Ml(y),k=react.useMemo(()=>v&&e0(v,x),[v,x]),b=react.useMemo(()=>x.size===0?y:y.map(D=>Ro(D,x)),[y,x]),[S,M]=react.useState(null),B=react.useCallback((D,j,L)=>{let U=b.find(ee=>ee.slug===D.slug)??Ro(D,x),H=k??v;M(ee=>({market:U,outcome:j,side:L,version:(ee?.version??0)+1})),!d&&H&&(L==="sell"?h({params:{event:H,market:U,initialOutcome:j,chain:r,slippageBps:c,onSetupRequired:p}}):m({params:{event:H,market:U,initialOutcome:j,chain:r,slippageBps:c,onInsufficientBalance:u}}));},[d,v,k,b,x,r,c,m,h,u,p]),N=react.useMemo(()=>{let D=S?.market.slug;return D?b.find(j=>j.slug===D)??Ro(S.market,x):b[0]},[b,x,S?.market]);if(f){let D=!!a;return d?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(Sn,{showBack:D})}),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(ja,{})})})]}):jsxRuntime.jsx(Sn,{showBack:D})}if(!v)return jsxRuntime.jsx("div",{className:"flex w-full items-center justify-center py-20 text-danger",children:"Event not found"});let C=S?`${S.market.slug}-${S.version}`:N?.slug??"default",I=S?.side==="sell";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$1.Button,{as:"a",onPress:a,startContent:jsxRuntime.jsx(ui$1.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:g("common.back")})}),jsxRuntime.jsx(Po,{event:k??v,orderbookQuotes:x,onTradeAction:B})]}),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:[N&&(I?jsxRuntime.jsx(po,{event:k??v,market:N,initialOutcome:S?.outcome,chain:r,slippageBps:c,onSetupRequired:p},C):jsxRuntime.jsx(ro,{event:k??v,market:N,initialOutcome:S?.outcome,chain:r,slippageBps:c,onInsufficientBalance:u},C)),v&&jsxRuntime.jsx(wl,{eventSlug:e,source:v.source,lang:n,onEventClick:i,onEventHover:s})]})]}),v&&jsxRuntime.jsx("div",{className:"flex w-full flex-col",children:l?l({event:k??v,walletAddress:o}):jsxRuntime.jsx($a,{event:k??v,walletAddress:o})}),jsxRuntime.jsx(no,{}),jsxRuntime.jsx(za,{}),jsxRuntime.jsx(Na,{})]})}function Rk({eventSlug:e,source:t,lang:r,onTradeAction:n}){let{data:o,isLoading:i,error:s}=reactPredict.useEvent({slug:e,source:t,lang:r});return i?jsxRuntime.jsx(Sn,{}):s||!o?jsxRuntime.jsx("div",{className:"flex w-full items-center justify-center py-20 text-danger",children:s?.message||"Event not found"}):jsxRuntime.jsx(Po,{event:o,onTradeAction:n})}function El(e){return e.outcomes[0]?.best_ask??e.outcomes[0]?.price??0}function s0(e){switch(e){case $.ONE_HOUR:return {interval:"1m",limit:100};case $.SIX_HOURS:return {interval:"5m",limit:72};case $.ONE_DAY:return {interval:"5m",limit:288};case $.ONE_MONTH:return {interval:"1h",limit:720};case $.ALL:return {interval:"1d",limit:300};default:return {interval:"1h",limit:100}}}var Fk=e=>{let{candlestickMarketSlugs:t,chartRange:r=Gn,source:n}=e,o=reactPredict.usePredictClient(),i=react.useMemo(()=>s0(r),[r]),{data:s,isLoading:a,error:l}=reactPredict.useEvent({slug:e.eventSlug,source:n}),u=react.useMemo(()=>{if(!s?.markets)return [];let m=new Set,h=s.markets.filter(f=>m.has(f.slug)?false:(m.add(f.slug),true));return (t&&t.length>0?t.slice(0,4).map(f=>h.find(y=>y.slug===f)).filter(f=>f!==void 0):[...h].sort((f,y)=>El(y)-El(f)).slice(0,4)).map(f=>f.slug)},[t,s?.markets]),p=reactQuery.useQueries({queries:u.map(m=>({queryKey:reactPredict.candlesticksQueryKey(m,i),queryFn:()=>o.listCandlesticks(m,i),enabled:u.length>0}))}),c=p.some(m=>m.isLoading),g=react.useMemo(()=>{let m=new Map;return u.forEach((h,v)=>{let f=p[v]?.error;f&&m.set(h,f);}),m},[u,p]),d=react.useMemo(()=>{let m=new Map;return u.forEach((h,v)=>{let f=p[v]?.data;f&&m.set(h,f);}),m},[u,p]);return {event:s,isEventLoading:a,eventError:l,candlestickParams:i,candlesticks:d,isCandlesticksLoading:c,candlestickErrors:g}};function Hi({comment:e,anonymousLabel:t,isReply:r=false}){let{profile:n}=e,o=n.name||n.pseudonym||t,i=react.useMemo(()=>d0(e.created_at),[e.created_at]);return jsxRuntime.jsxs("div",{className:ui$1.cn("flex gap-x-2.5 px-1 py-3 border-b border-border/40 lg:px-2",r&&"pl-8 lg:pl-9"),children:[jsxRuntime.jsx(a0,{src:n.profile_image,name:o,className:ui$1.cn("shrink-0",r?"size-6":"size-8 lg:size-7")}),jsxRuntime.jsxs("div",{className:"min-w-0 flex-1",children:[jsxRuntime.jsxs("div",{className:"flex items-baseline gap-x-2",children:[jsxRuntime.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:o}),jsxRuntime.jsx("span",{className:"ml-auto shrink-0 text-xs text-neutral",children:i})]}),jsxRuntime.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-sm leading-relaxed text-foreground/90",children:e.body}),jsxRuntime.jsxs("div",{className:"mt-2 flex items-center gap-x-1 text-neutral",children:[jsxRuntime.jsx(l0,{className:"size-3.5"}),jsxRuntime.jsx("span",{className:"text-xs tabular-nums",children:e.reaction_count})]})]})]})}function a0({src:e,name:t,className:r}){let n=t.trim().charAt(0).toUpperCase()||"?",o=react.useMemo(()=>c0(t),[t]);return e?jsxRuntime.jsx("img",{src:e,alt:t,loading:"lazy",className:ui$1.cn("rounded-full object-cover",r)}):jsxRuntime.jsx("span",{className:ui$1.cn("flex items-center justify-center rounded-full text-xs font-semibold text-white",r),style:{backgroundColor:o},"aria-hidden":true,children:n})}function l0({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z"})})}function c0(e){let t=0;for(let n=0;n<e.length;n++)t=e.charCodeAt(n)+((t<<5)-t);return `hsl(${Math.abs(t)%360}, 55%, 45%)`}function d0(e){let t=new Date(e).getTime();if(Number.isNaN(t))return "";let r=Math.max(0,Math.floor((Date.now()-t)/1e3));if(r<60)return "now";let n=Math.floor(r/60);if(n<60)return `${n}m`;let o=Math.floor(n/60);if(o<24)return `${o}h`;let i=Math.floor(o/24);if(i<7)return `${i}d`;let s=Math.floor(i/7);return s<5?`${s}w`:new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric"})}var y0={latest:{order:"createdAt",ascending:false},oldest:{order:"createdAt",ascending:true},mostLiked:{order:"reactionCount",ascending:false}},Ll={latest:"predict.comments.sortLatest",oldest:"predict.comments.sortOldest",mostLiked:"predict.comments.sortMostLiked"},k0=["latest","oldest","mostLiked"],S0=600,P0=112;function w0({slug:e,source:t,limit:r=20,height:n,className:o}){let{t:i}=i18n.useTranslation(),[s,a]=react.useState("latest"),[l,u]=react.useState(false),p=y0[s],{data:c,isLoading:g,isFetchingNextPage:d,hasNextPage:m,fetchNextPage:h}=reactPredict.useInfiniteComments({slug:e,source:t,limit:r,order:p.order,ascending:p.ascending,holders_only:l}),v=react.useMemo(()=>c?.pages?.flatMap(C=>C.items)??[],[c?.pages]),f=react.useRef(null),{height:y}=hooks.useResizeObserver({ref:f}),x=n??(y||S0),k=reactWindow.useDynamicRowHeight({defaultRowHeight:P0,key:`${e}:${t}:${s}:${l}`}),b=v.length,S=b+(m?1:0),M=react.useCallback(C=>C<b,[b]),B=react.useCallback(async()=>{m&&!d&&await h();},[m,d,h]),N=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:M,loadMoreRows:B,rowCount:S,threshold:5});return jsxRuntime.jsxs("div",{className:ui$1.cn("flex h-full w-full flex-col",o),children:[jsxRuntime.jsx(M0,{sort:s,onSortChange:a,holdersOnly:l,onHoldersOnlyChange:u}),jsxRuntime.jsx("div",{className:"min-h-0 flex-auto overflow-hidden",ref:f,children:g?jsxRuntime.jsx(C0,{}):v.length===0?jsxRuntime.jsx(E0,{message:i("predict.comments.empty")}):jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:x},onRowsRendered:N,rowComponent:N0,rowCount:S,rowHeight:k,rowProps:{comments:v,itemCount:b,anonymousLabel:i("predict.comments.anonymous")},overscanCount:4})})]})}function N0({index:e,style:t,comments:r,itemCount:n,anonymousLabel:o}){if(e>=n)return jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})});let i=r[e];return i?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(Hi,{comment:i,anonymousLabel:o,isReply:!!i.parent_comment_id})}):null}function M0({sort:e,onSortChange:t,holdersOnly:r,onHoldersOnlyChange:n}){let{t:o}=i18n.useTranslation(),[i,s]=react.useState(false),a=react.useRef(null);return react.useEffect(()=>{if(!i)return;let l=p=>{a.current&&!a.current.contains(p.target)&&s(false);},u=p=>{p.key==="Escape"&&s(false);};return document.addEventListener("mousedown",l),document.addEventListener("keydown",u),()=>{document.removeEventListener("mousedown",l),document.removeEventListener("keydown",u);}},[i]),jsxRuntime.jsxs("div",{className:"flex items-center justify-between gap-2 px-1 py-2 lg:px-2",children:[jsxRuntime.jsxs("div",{ref:a,className:"relative",children:[jsxRuntime.jsxs("button",{type:"button",onClick:()=>s(l=>!l),className:"inline-flex items-center gap-x-1.5 rounded-lg border border-border bg-content2/40 px-3 py-1.5 text-sm text-foreground transition-colors hover:bg-content2 cursor-pointer",children:[jsxRuntime.jsx(T0,{className:"size-3.5 text-neutral"}),jsxRuntime.jsx("span",{children:o(Ll[e])}),jsxRuntime.jsx(R0,{className:ui$1.cn("size-3.5 text-neutral transition-transform",i&&"rotate-180")})]}),i&&jsxRuntime.jsx("div",{className:"absolute left-0 top-full z-20 mt-1.5 min-w-40 overflow-hidden rounded-xl border border-border bg-content1 p-1 shadow-xl",children:k0.map(l=>{let u=l===e;return jsxRuntime.jsxs("button",{type:"button",onClick:()=>{t(l),s(false);},className:ui$1.cn("flex w-full items-center gap-x-2 rounded-lg px-3 py-2 text-left text-sm transition-colors cursor-pointer",u?"bg-primary/10 text-primary":"text-neutral hover:bg-content2 hover:text-foreground"),children:[jsxRuntime.jsx("span",{className:"flex-1 font-medium",children:o(Ll[l])}),u&&jsxRuntime.jsx(_l,{className:"size-4 text-primary"})]},l)})})]}),jsxRuntime.jsxs("button",{type:"button",role:"switch","aria-checked":r,onClick:()=>n(!r),className:ui$1.cn("inline-flex items-center gap-x-1.5 rounded-lg border px-3 py-1.5 text-sm transition-colors cursor-pointer",r?"border-primary/40 bg-primary/10 text-primary":"border-border bg-content2/40 text-neutral hover:text-foreground"),children:[jsxRuntime.jsx("span",{className:ui$1.cn("flex size-4 items-center justify-center rounded border",r?"border-primary bg-primary":"border-neutral"),children:r&&jsxRuntime.jsx(_l,{className:"size-3 text-background"})}),o("predict.comments.holdersOnly")]})]})}function C0(){return jsxRuntime.jsx("div",{className:"flex flex-col gap-y-4 px-1 py-3 lg:px-2",children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsxs("div",{className:"flex gap-x-2.5",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"size-8 shrink-0 rounded-full"}),jsxRuntime.jsxs("div",{className:"flex-1 space-y-2",children:[jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3 w-24 rounded"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3 w-full rounded"}),jsxRuntime.jsx(ui$1.Skeleton,{className:"h-3 w-2/3 rounded"})]})]},t))})}function E0({message:e}){return jsxRuntime.jsxs("div",{className:"flex flex-col items-center justify-center py-16",children:[jsxRuntime.jsx(ui$1.EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsxRuntime.jsx("p",{className:"mt-2 text-sm text-neutral",children:e})]})}function T0({className:e}){return jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,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 R0({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"m6 9 6 6 6-6"})})}function _l({className:e}){return jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",className:e,fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":true,children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})}var O0=10,I0=utils.atomWithStorage("liberfi:predict_search_histories",[],void 0,{getOnInit:true});function Do(){let[e,t]=jotai.useAtom(I0),r=react.useCallback(o=>{let i=o.trim();i&&t(s=>{let a=s.filter(l=>l!==i);return [i,...a].slice(0,O0)});},[t]),n=react.useCallback(()=>{t([]);},[t]);return {histories:e,addHistory:r,clearHistories:n}}function Bl({histories:e,onSelect:t,onClear:r,className:n}){let{t:o}=i18n.useTranslation();return e.length===0?null:jsxRuntime.jsxs("div",{className:ui$1.cn("px-4 pb-4",n),children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between",children:[jsxRuntime.jsx("span",{className:"text-sm font-medium",children:o("predict.search.history")}),jsxRuntime.jsx(ui$1.Button,{isIconOnly:true,size:"sm",className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui$1.TrashIcon,{width:20,height:20})})]}),jsxRuntime.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:e.map(i=>jsxRuntime.jsx(ui$1.Chip,{size:"sm",variant:"bordered",className:ui$1.cn("text-neutral","border-border border-1","cursor-pointer","hover:opacity-hover"),onClick:()=>t?.(i),children:i},i))})]})}function Hl({onSelect:e,className:t}){let{histories:r,clearHistories:n}=Do();return jsxRuntime.jsx(Bl,{className:ui$1.cn(t),histories:r,onSelect:e,onClear:n})}function zl({value:e,onValueChange:t,onClear:r,onEscape:n,className:o}){let{t:i}=i18n.useTranslation();return jsxRuntime.jsx("div",{className:o,children:jsxRuntime.jsx(ui$1.StyledInput,{autoFocus:true,variant:"bordered",radius:"lg",value:e,onValueChange:t,placeholder:i("predict.search.placeholder"),classNames:{inputWrapper:["!bg-[rgba(39,39,42,0.6)]","!border-[rgba(63,63,70,0.5)]","data-[hover=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!bg-[rgba(39,39,42,1)]","group-data-[focus=true]:!border-[rgba(63,63,70,0.8)]"].join(" ")},startContent:jsxRuntime.jsx(ui$1.SearchIcon,{width:20,height:20,className:"text-neutral"}),endContent:e?jsxRuntime.jsx(ui$1.Button,{isIconOnly:true,className:"bg-transparent min-w-6 w-6 h-6 text-neutral",onPress:r,children:jsxRuntime.jsx(ui$1.XCloseIcon,{width:20,height:20})}):jsxRuntime.jsx(ui$1.Kbd,{className:"min-w-8 justify-center text-xs text-neutral bg-transparent border border-[rgba(63,63,70,0.5)] rounded-lg cursor-pointer select-none",onMouseDown:s=>{s.preventDefault(),n?.();},children:"Esc"})})})}function eh(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function th(e){return e.title_trans||e.title}function Wl({event:e,href:t,LinkComponent:r,onSelect:n,onHover:o,className:i}){let{t:s}=i18n.useTranslation(),a=th(e),l=react.useMemo(()=>eh(e.volume),[e.volume]);return jsxRuntime.jsxs(ui$1.Linkable,{href:t,LinkComponent:r,className:ui$1.cn("group 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:u=>{t&&n&&u.preventDefault(),n?.(e);},onMouseEnter:()=>o?.(e),children:[jsxRuntime.jsx(ui$1.Avatar,{src:e.image_url||void 0,name:a||"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 line-clamp-2 group-hover:text-primary transition-colors",children:a}),jsxRuntime.jsx("div",{className:"flex items-center gap-x-2 text-[10px] font-normal text-neutral-500 lg:text-xs",children:jsxRuntime.jsxs("span",{className:"text-neutral-400",children:[l," ",s("predict.event.volume")]})})]}),jsxRuntime.jsx(ui$1.ChevronRightIcon,{width:16,height:16,className:"shrink-0 text-neutral-500 opacity-0 group-hover:opacity-100 transition-opacity"})]})}function Ul({keyword:e="",limit:t,source:r}){let{data:n,isLoading:o,isFetchingNextPage:i,hasNextPage:s,fetchNextPage:a}=reactPredict.useSearchEvents({keyword:e,limit:t,source:r,sort_by:e?void 0:"volume",sort_asc:e?void 0:false},{enabled:true});return {events:react.useMemo(()=>n?.pages.flatMap(u=>u.items).filter(u=>u!=null)??[],[n]),isLoading:o,isFetchingNextPage:i,hasNextPage:s??false,fetchNextPage:a}}var dh=64;function jl({onSelect:e,getEventHref:t,LinkComponent:r,onHover:n,className:o,...i}){let{events:s,isLoading:a,isFetchingNextPage:l,hasNextPage:u,fetchNextPage:p}=Ul(i),c=react.useRef(null),{height:g}=hooks.useResizeObserver({ref:c}),d=react.useCallback(f=>f<s.length,[s]),m=react.useCallback(async()=>{u&&!l&&await p();},[u,l,p]),h=react.useMemo(()=>u?s.length+1:s.length,[s,u]),v=reactWindowInfiniteLoader.useInfiniteLoader({isRowLoaded:d,loadMoreRows:m,rowCount:h,threshold:5});return a?jsxRuntime.jsx(ph,{className:o}):s.length===0?jsxRuntime.jsx(mh,{className:o}):jsxRuntime.jsx("div",{className:ui$1.cn("w-full h-full flex flex-col",o),children:jsxRuntime.jsx("div",{className:"flex-auto min-h-0",ref:c,children:jsxRuntime.jsx(reactWindow.List,{className:"no-scrollbar",style:{height:g},onRowsRendered:v,rowComponent:uh,rowCount:h,rowHeight:dh,rowProps:{events:s,onSelect:e,getEventHref:t,LinkComponent:r,onHover:n},overscanCount:5})})})}function uh({index:e,style:t,events:r,onSelect:n,getEventHref:o,LinkComponent:i,onHover:s}){let a=r[e];return a?jsxRuntime.jsx("div",{style:t,children:jsxRuntime.jsx(Wl,{event:a,href:o?.(a),LinkComponent:i,onSelect:n,onHover:s})}):jsxRuntime.jsx("div",{style:t,className:"flex items-center justify-center",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})}function ph({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-2 py-16",e),children:[jsxRuntime.jsx(ui$1.Spinner,{size:"sm"}),jsxRuntime.jsx("span",{className:"text-sm text-neutral",children:t("predict.search.loading")})]})}function mh({className:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{className:ui$1.cn("flex flex-col items-center justify-center py-16",e),children:[jsxRuntime.jsx(ui$1.EmptyIcon,{width:28,height:28,className:"text-neutral"}),jsxRuntime.jsx("p",{className:"mt-2 text-sm text-neutral",children:t("predict.search.noResults")})]})}function Ql({onKeywordChange:e}){let[t,r]=react.useState(""),[n,o]=react.useState(""),{addHistory:i}=Do(),s=hooks.useCallbackRef(e),a=hooks.useCallbackRef(i),l=react.useMemo(()=>utils$1.debounce(g=>{o(g),s(g),g&&a(g);},500),[s,a]),u=react.useCallback(g=>{r(g),l(g);},[l]),p=react.useCallback(g=>{l.cancel(),r(g),o(g),s(g),g&&a(g);},[l,s,a]),c=react.useCallback(()=>p(""),[p]);return {text:t,keyword:n,setText:u,setKeyword:p,clearKeyword:c}}function Xl({onKeywordChange:e,onSelectEvent:t,getEventHref:r,LinkComponent:n,onHover:o,onEscape:i,source:s}){let{text:a,keyword:l,setText:u,setKeyword:p,clearKeyword:c}=Ql({onKeywordChange:e});return jsxRuntime.jsxs("div",{className:"w-full h-full flex flex-col gap-3",children:[jsxRuntime.jsx(zl,{value:a,onValueChange:u,onClear:c,onEscape:i}),!l&&jsxRuntime.jsx(Hl,{onSelect:p}),jsxRuntime.jsx(jl,{className:"flex-auto min-h-0",keyword:l,onSelect:t,getEventHref:r,LinkComponent:n,onHover:o,source:s})]})}var Vi="predict-search";function TP({id:e=Vi}){return jsxRuntime.jsx(uiScaffold.AsyncModal,{id:e,children:t=>jsxRuntime.jsx(Mh,{...t})})}function Mh({params:e,isOpen:t,onOpenChange:r,onResult:n}){let{t:o}=i18n.useTranslation(),{isMobile:i}=ui$1.useScreen(),s=react.useCallback(l=>{n(l);},[n]),a=react.useCallback(()=>{r(false);},[r]);return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:t,onOpenChange:r,size:i?"full":"lg",hideCloseButton:true,backdrop:"opaque",radius:"lg",children:jsxRuntime.jsxs(ui$1.ModalContent,{className:"w-full h-full",style:{borderRadius:i?void 0:14,border:i?void 0:"1px solid rgba(39,39,42,1)",background:"rgba(24,24,27,1)",boxShadow:i?void 0:"0 25px 50px -12px rgba(0,0,0,0.5)",overflow:"hidden"},children:[jsxRuntime.jsxs(ui$1.ModalHeader,{className:"sm:hidden flex items-center justify-between pt-4 pb-2",children:[jsxRuntime.jsx("span",{className:"text-base font-semibold",children:o("predict.search.title")}),jsxRuntime.jsx(ui$1.Button,{isIconOnly:true,onPress:()=>r(false),size:"sm",className:"bg-transparent min-w-6 w-6 h-6",children:jsxRuntime.jsx(ui$1.XCloseIcon,{width:20,height:20})})]}),jsxRuntime.jsx(ui$1.ModalBody,{className:"p-4",children:jsxRuntime.jsx(Xl,{getEventHref:e?.getEventHref,LinkComponent:e?.LinkComponent,onHover:e?.onHover,source:e?.source,onSelectEvent:s,onEscape:a})})]})})}function BP({onSelectEvent:e,modalParams:t,className:r}){let{t:n}=i18n.useTranslation(),{isDesktop:o}=ui$1.useScreen(),{onOpen:i,onClose:s}=uiScaffold.useAsyncModal(Vi),a=hooks.useCallbackRef(e),l=hooks.useCallbackRef(async()=>{let p=await i({params:t});p&&a(p);}),u=hooks.useCallbackRef(()=>{s();});return react.useEffect(()=>{let p=c=>{let g=document.activeElement,d=!!g&&(g.tagName==="INPUT"||g.tagName==="TEXTAREA"||g.getAttribute("contenteditable")==="true");c.key==="/"&&!d&&(c.preventDefault(),l()),c.key==="Escape"&&(c.preventDefault(),u());};return window.addEventListener("keydown",p),()=>{window.removeEventListener("keydown",p);}},[l,u]),o?jsxRuntime.jsx(ui$1.Button,{size:"sm",radius:"full",onPress:l,variant:"bordered",startContent:jsxRuntime.jsx(ui$1.SearchIcon,{width:16,height:16,className:"text-foreground"}),endContent:jsxRuntime.jsx(ui$1.Kbd,{className:"min-w-6 justify-center text-xs text-foreground bg-content3 rounded-lg",children:"/"}),className:ui$1.cn("w-56 min-w-0 h-8 min-h-0 border-transparent hover:border-border bg-content2 pl-3 pr-1.5 text-neutral",r),children:n("predict.search.placeholder")}):jsxRuntime.jsx(ui$1.Button,{size:"sm",radius:"full",isIconOnly:true,onPress:l,variant:"bordered",className:ui$1.cn("w-8 min-w-0 h-8 min-h-0 border-1 border-border bg-content2",r),children:jsxRuntime.jsx(ui$1.SearchIcon,{width:16,height:16,className:"text-foreground"})})}var Gi=[{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"}],lc=[{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}],ic={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"},sc={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 Ih(e,t){if(!e)return "$5K+";let r=lc.find(n=>n.value===e);return r?r.labelKey?t(r.labelKey):r.label:`$${e}`}function cc({sortBy:e,onSortChange:t,sortAsc:r,onSortAscChange:n,minVolume:o,onMinVolumeChange:i,onRefresh:s}){let{t:a}=i18n.useTranslation(),[l,u]=react.useState(false),[p,c]=react.useState(false),[g,d]=react.useState(false),[m,h]=react.useState(false),v=react.useRef(null),f=react.useRef(null),y=Gi.find(b=>b.value===e)??Gi[0],x=react.useCallback(b=>{v.current&&!v.current.contains(b.target)&&u(false),f.current&&!f.current.contains(b.target)&&c(false);},[]);react.useEffect(()=>(document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)),[x]);let k=react.useCallback(()=>{s?.(),h(true),setTimeout(()=>h(false),700);},[s]);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
79
79
  @keyframes matchRefreshSpin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
80
80
  .match-refresh-spin{animation:matchRefreshSpin .6s ease-in-out}
81
81
  .match-btn:focus-visible{outline:2px solid #c7ff2e;outline-offset:2px;z-index:10}
82
- `}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:g,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:zl,onMouseEnter:b=>{b.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{u(b=>!b),l(false);},children:[jsxRuntime.jsx(ih,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:s(x.labelKey)}),jsxRuntime.jsx(Ul,{open:c})]}),c&&jsxRuntime.jsx("div",{style:{...Wl,width:224,padding:4},children:Ri.map(b=>{let y=e===b.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:y?"rgba(199,255,46,0.08)":"transparent",color:y?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:M=>{y||(M.currentTarget.style.background="rgba(39,39,42,0.5)",M.currentTarget.style.color="#fff");},onMouseLeave:M=>{y||(M.currentTarget.style.background="transparent",M.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===b.value?n(!r):t(b.value),u(false);},children:[jsxRuntime.jsx("div",{style:{color:y?"#c7ff2e":"#71717a"},children:jsxRuntime.jsx(sh,{type:b.icon})}),jsxRuntime.jsxs("div",{style:{flex:1,textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:500},children:s(b.labelKey)}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#71717a",marginTop:1},children:s(b.descKey)})]}),y&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},b.value)})})]}),i&&jsxRuntime.jsxs("div",{ref:v,style:{position:"relative"},children:[jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:zl,onMouseEnter:b=>{b.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{l(b=>!b),u(false);},children:[jsxRuntime.jsx(ah,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:oh(o,s)}),jsxRuntime.jsx(lh,{onMouseEnter:()=>d(true),onMouseLeave:()=>d(false)}),jsxRuntime.jsx(Ul,{open:m})]}),f&&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:"#c7ff2e",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")})]})]})]}),m&&jsxRuntime.jsxs("div",{style:{...Wl,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:$l.map(b=>{let y=b.value===0?!o:o===b.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:y?"rgba(199,255,46,0.08)":"transparent",color:y?"#c7ff2e":"#a1a1aa",borderRadius:10,transition:"all 0.15s"},onMouseEnter:M=>{y||(M.currentTarget.style.background="rgba(39,39,42,0.5)",M.currentTarget.style.color="#fff");},onMouseLeave:M=>{y||(M.currentTarget.style.background="transparent",M.currentTarget.style.color="#a1a1aa");},onClick:()=>{i?.(b.value===0?void 0:b.value),l(false);},children:[jsxRuntime.jsx("span",{children:b.labelKey?s(b.labelKey):b.label}),y&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},b.value)})})]})]}),a&&jsxRuntime.jsx("button",{type:"button",className:"match-btn",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:b=>{b.currentTarget.style.background="rgba(39,39,42,1)",b.currentTarget.style.color="#fff";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(39,39,42,0.6)",b.currentTarget.style.color="#a1a1aa";},onClick:S,children:jsxRuntime.jsxs("svg",{className:p?"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 ih(){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 sh({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 ah(){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 lh({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 Ul({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 ph(e){return utils$1.formatAmountInUsd(e)}var mh=[{key:"activePairs",labelKey:"predict.matches.stats.activePairs",format:e=>utils$1.formatAmount(e),valueColor:"#c7ff2e",gradientFrom:"rgba(199,255,46,0.18)",gradientTo:"rgba(199,255,46,0.04)",borderColor:"rgba(199,255,46,0.18)"},{key:"maxSpread",labelKey:"predict.matches.stats.maxSpread",format:e=>`${(e*100).toFixed(1)}%`,valueColor:"#f76816",gradientFrom:"rgba(247,104,22,0.18)",gradientTo:"rgba(247,104,22,0.04)",borderColor:"rgba(247,104,22,0.18)"},{key:"highSpreadCount",labelKey:"predict.matches.stats.highSpreadCount",format:e=>utils$1.formatAmount(e),valueColor:"#17c964",gradientFrom:"rgba(23,201,100,0.18)",gradientTo:"rgba(23,201,100,0.04)",borderColor:"rgba(23,201,100,0.18)"},{key:"totalVolume",labelKey:"predict.matches.stats.totalVolume",format:ph,valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)",borderColor:"rgba(245,165,36,0.18)"}];function jl({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
82
+ `}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[jsxRuntime.jsxs("div",{ref:v,style:{position:"relative"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:ic,onMouseEnter:b=>{b.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{u(b=>!b),c(false);},children:[jsxRuntime.jsx(Dh,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:a(y.labelKey)}),jsxRuntime.jsx(ac,{open:l})]}),l&&jsxRuntime.jsx("div",{style:{...sc,width:224,padding:4},children:Gi.map(b=>{let S=e===b.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:S?"rgba(199,255,46,0.08)":"transparent",color:S?"#c7ff2e":"#a1a1aa",borderRadius:10},onMouseEnter:M=>{S||(M.currentTarget.style.background="rgba(39,39,42,0.5)",M.currentTarget.style.color="#fff");},onMouseLeave:M=>{S||(M.currentTarget.style.background="transparent",M.currentTarget.style.color="#a1a1aa");},onClick:()=>{e===b.value?n(!r):t(b.value),u(false);},children:[jsxRuntime.jsx("div",{style:{color:S?"#c7ff2e":"#71717a"},children:jsxRuntime.jsx(Ah,{type:b.icon})}),jsxRuntime.jsxs("div",{style:{flex:1,textAlign:"left"},children:[jsxRuntime.jsx("div",{style:{fontWeight:500},children:a(b.labelKey)}),jsxRuntime.jsx("div",{style:{fontSize:11,color:"#71717a",marginTop:1},children:a(b.descKey)})]}),S&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},b.value)})})]}),i&&jsxRuntime.jsxs("div",{ref:f,style:{position:"relative"},children:[jsxRuntime.jsxs("div",{style:{position:"relative",display:"inline-flex"},children:[jsxRuntime.jsxs("button",{type:"button",className:"match-btn",style:ic,onMouseEnter:b=>{b.currentTarget.style.background="rgba(39,39,42,1)";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(39,39,42,0.6)";},onClick:()=>{c(b=>!b),u(false);},children:[jsxRuntime.jsx(Fh,{}),jsxRuntime.jsx("span",{className:"hidden sm:block",style:{color:"#d4d4d8"},children:Ih(o,a)}),jsxRuntime.jsx(Bh,{onMouseEnter:()=>d(true),onMouseLeave:()=>d(false)}),jsxRuntime.jsx(ac,{open:p})]}),g&&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:"#c7ff2e",flexShrink:0},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z"})}),a("predict.matches.filter.liquidityFilter")]}),jsxRuntime.jsx("p",{style:{color:"#a1a1aa",margin:"0 0 4px"},children:a("predict.matches.filter.tooltipDesc")}),jsxRuntime.jsx("p",{style:{color:"#71717a",fontSize:11,margin:0},children:a("predict.matches.filter.tooltipNote")})]})]})]}),p&&jsxRuntime.jsxs("div",{style:{...sc,right:0,width:176},children:[jsxRuntime.jsx("div",{style:{padding:"8px 12px",borderBottom:"1px solid rgba(39,39,42,1)"},children:jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:"#71717a",textTransform:"uppercase",letterSpacing:"0.05em"},children:a("predict.matches.filter.minVolumeEach")})}),jsxRuntime.jsx("div",{style:{padding:4},children:lc.map(b=>{let S=b.value===0?!o:o===b.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:S?"rgba(199,255,46,0.08)":"transparent",color:S?"#c7ff2e":"#a1a1aa",borderRadius:10,transition:"all 0.15s"},onMouseEnter:M=>{S||(M.currentTarget.style.background="rgba(39,39,42,0.5)",M.currentTarget.style.color="#fff");},onMouseLeave:M=>{S||(M.currentTarget.style.background="transparent",M.currentTarget.style.color="#a1a1aa");},onClick:()=>{i?.(b.value===0?void 0:b.value),c(false);},children:[jsxRuntime.jsx("span",{children:b.labelKey?a(b.labelKey):b.label}),S&&jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M20 6 9 17l-5-5"})})]},b.value)})})]})]}),s&&jsxRuntime.jsx("button",{type:"button",className:"match-btn",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:b=>{b.currentTarget.style.background="rgba(39,39,42,1)",b.currentTarget.style.color="#fff";},onMouseLeave:b=>{b.currentTarget.style.background="rgba(39,39,42,0.6)",b.currentTarget.style.color="#a1a1aa";},onClick:k,children:jsxRuntime.jsxs("svg",{className:m?"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 Dh(){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 Ah({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 Fh(){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 Bh({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 ac({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 Uh(e){return utils$1.formatAmountInUsd(e)}var $h=[{key:"activePairs",labelKey:"predict.matches.stats.activePairs",format:e=>utils$1.formatAmount(e),valueColor:"#c7ff2e",gradientFrom:"rgba(199,255,46,0.18)",gradientTo:"rgba(199,255,46,0.04)",borderColor:"rgba(199,255,46,0.18)"},{key:"maxSpread",labelKey:"predict.matches.stats.maxSpread",format:e=>`${(e*100).toFixed(1)}%`,valueColor:"#f76816",gradientFrom:"rgba(247,104,22,0.18)",gradientTo:"rgba(247,104,22,0.04)",borderColor:"rgba(247,104,22,0.18)"},{key:"highSpreadCount",labelKey:"predict.matches.stats.highSpreadCount",format:e=>utils$1.formatAmount(e),valueColor:"#17c964",gradientFrom:"rgba(23,201,100,0.18)",gradientTo:"rgba(23,201,100,0.04)",borderColor:"rgba(23,201,100,0.18)"},{key:"totalVolume",labelKey:"predict.matches.stats.totalVolume",format:Uh,valueColor:"#f5a524",gradientFrom:"rgba(245,165,36,0.18)",gradientTo:"rgba(245,165,36,0.04)",borderColor:"rgba(245,165,36,0.18)"}];function uc({stats:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:`
83
83
  @keyframes match-live-ping{75%,100%{transform:scale(2.2);opacity:0}}
84
84
  @keyframes match-live-breathe{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.55;transform:scale(.85)}}
85
85
  @keyframes matchStatsEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
@@ -117,21 +117,21 @@
117
117
  .matches-stat-label{font-size:11px;line-height:16px;min-height:16px}
118
118
  @media(min-width:640px){.matches-stat-label{font-size:12px;line-height:18px;min-height:18px}}
119
119
  `}),jsxRuntime.jsxs("div",{className:"matches-hero-outer",style:{display:"flex",marginBottom:0},children:[jsxRuntime.jsxs("div",{className:"matches-hero-left",style:{display:"flex",flexDirection:"column",minWidth:0,flex:1,animation:"matchHeroTitleEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both"},children:[jsxRuntime.jsx("div",{className:"matches-hero-live",style:{display:"flex",marginBottom:16},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(199,255,46,0.12)",padding:"2px 6px",fontSize:10,fontWeight:600,color:"#c7ff2e",textTransform:"uppercase",border:"1px solid rgba(199,255,46,0.22)"},children:t("predict.matches.betaTag")})]})}),jsxRuntime.jsxs("h1",{className:"matches-hero-title",style:{fontFamily:"var(--font-dm-sans, 'DM Sans', sans-serif)",fontSize:46,fontWeight:700,letterSpacing:"-1.2px",lineHeight:1.2,color:"#fff",margin:"0 0 14px"},children:[jsxRuntime.jsxs("span",{style:{color:"#fff"},children:[t("predict.matches.titlePrefix")," "]}),jsxRuntime.jsx("span",{style:{backgroundImage:"linear-gradient(to right, #c7ff2e, #a0e515, #17c964)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text"},children:t("predict.matches.titleHighlight")})]}),jsxRuntime.jsx("p",{className:"matches-hero-subtitle matches-hero-subtitle-text",style:{lineHeight:1.6,color:"#71717a",maxWidth:460},children:String(t("predict.matches.heroSubtitle")).split(`
120
- `).map((r,n)=>jsxRuntime.jsxs("span",{children:[n>0&&jsxRuntime.jsx("br",{className:"hidden sm:block"}),r,n===0?" ":""]},n))})]}),jsxRuntime.jsx("div",{className:"matches-stat-grid",style:{display:"grid",borderRadius:16,border:"1px solid rgba(39,39,42,0.5)",overflow:"hidden",flexShrink:0,backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",...e?{animation:"matchStatsEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:"0.1s"}:{}},children:mh.map((r,n)=>jsxRuntime.jsxs("div",{style:{padding:"16px 20px",background:e?`linear-gradient(to bottom, ${r.gradientFrom}, ${r.gradientTo})`:"rgba(255,255,255,0.02)",borderRight:n%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:n<2?"1px solid rgba(39,39,42,0.4)":"none",...e?{animation:"matchStatCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:`${150+n*60}ms`}:{}},children:[jsxRuntime.jsx("div",{className:"matches-stat-val",style:{fontWeight:700,fontVariantNumeric:"tabular-nums",color:e?r.valueColor:"transparent",display:"flex",alignItems:"center"},children:e?r.format(e[r.key]??0):jsxRuntime.jsx("div",{style:{height:16,width:56,borderRadius:4,background:"rgba(255,255,255,0.06)",animation:"matchStatCardEnter 0.6s ease-out both",animationDelay:`${n*80}ms`}})}),jsxRuntime.jsx("div",{className:"matches-stat-label",style:{fontWeight:500,color:e?"#71717a":"transparent",marginTop:2,display:"flex",alignItems:"center"},children:e?t(r.labelKey):jsxRuntime.jsx("div",{style:{height:10,width:64,borderRadius:4,background:"rgba(255,255,255,0.04)",animation:"matchStatCardEnter 0.6s ease-out both",animationDelay:`${50+n*80}ms`}})})]},r.key))})]})]})}function _i(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function hh(e){return e==null?"narrow":e>=5?"wide":e>=3?"moderate":"narrow"}var Ql={wide:{color:"#f76816",bandFrom:"rgba(247,104,22,0.14)",bandTo:"rgba(247,104,22,0.03)",gaugeActive:"#f76816",gaugeInactive:"rgba(247,104,22,0.15)"},moderate:{color:"#c7ff2e",bandFrom:"rgba(199,255,46,0.12)",bandTo:"rgba(199,255,46,0.02)",gaugeActive:"#c7ff2e",gaugeInactive:"rgba(199,255,46,0.15)"},narrow:{color:"#71717a",bandFrom:"rgba(113,113,122,0.08)",bandTo:"transparent",gaugeActive:"#71717a",gaugeInactive:"rgba(113,113,122,0.12)"}},vh={wide:{border:"rgba(247,104,22,0.4)",shadow:"0 2px 18px rgba(247,104,22,0.35)"},moderate:{border:"rgba(199,255,46,0.5)",shadow:"0 2px 20px rgba(199,255,46,0.45)"},narrow:{border:"rgba(113,113,122,0.5)",shadow:"0 2px 20px rgba(113,113,122,0.35)"}},Gl={liquid_gap:{dot:"#17c964",label:"predict.matches.signalLiquidGap"},active_gap:{dot:"#c7ff2e",label:"predict.matches.signalActiveGap"},stale_gap:{dot:"#f5a524",label:"predict.matches.signalStaleGap"},stale_data:{dot:"#71717a",label:"predict.matches.signalStaleData"}};function bh(e){return e==null?null:e<120?"fresh":e<300?"aging":"stale"}var xh={fresh:"#17c964",aging:"#f5a524",stale:"#71717a"},yh={polymarket:{text:"#50a2ff",icon:"#50a2ff"},kalshi:{text:"#00d492",icon:"#00d492"}},kh={text:"#9ca3af",icon:"#9ca3af"};function Sh(e){return yh[e]??kh}var Ph=`
120
+ `).map((r,n)=>jsxRuntime.jsxs("span",{children:[n>0&&jsxRuntime.jsx("br",{className:"hidden sm:block"}),r,n===0?" ":""]},n))})]}),jsxRuntime.jsx("div",{className:"matches-stat-grid",style:{display:"grid",borderRadius:16,border:"1px solid rgba(39,39,42,0.5)",overflow:"hidden",flexShrink:0,backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",...e?{animation:"matchStatsEnter 0.5s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:"0.1s"}:{}},children:$h.map((r,n)=>jsxRuntime.jsxs("div",{style:{padding:"16px 20px",background:e?`linear-gradient(to bottom, ${r.gradientFrom}, ${r.gradientTo})`:"rgba(255,255,255,0.02)",borderRight:n%2===0?"1px solid rgba(39,39,42,0.4)":"none",borderBottom:n<2?"1px solid rgba(39,39,42,0.4)":"none",...e?{animation:"matchStatCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) both",animationDelay:`${150+n*60}ms`}:{}},children:[jsxRuntime.jsx("div",{className:"matches-stat-val",style:{fontWeight:700,fontVariantNumeric:"tabular-nums",color:e?r.valueColor:"transparent",display:"flex",alignItems:"center"},children:e?r.format(e[r.key]??0):jsxRuntime.jsx("div",{style:{height:16,width:56,borderRadius:4,background:"rgba(255,255,255,0.06)",animation:"matchStatCardEnter 0.6s ease-out both",animationDelay:`${n*80}ms`}})}),jsxRuntime.jsx("div",{className:"matches-stat-label",style:{fontWeight:500,color:e?"#71717a":"transparent",marginTop:2,display:"flex",alignItems:"center"},children:e?t(r.labelKey):jsxRuntime.jsx("div",{style:{height:10,width:64,borderRadius:4,background:"rgba(255,255,255,0.04)",animation:"matchStatCardEnter 0.6s ease-out both",animationDelay:`${50+n*80}ms`}})})]},r.key))})]})]})}var qh={kalshi:{label:"KALSHI",color:"#00d492",bgColor:"rgba(0, 212, 146, 0.12)",icon:jsxRuntime.jsx(ui$1.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$1.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}},Yh={label:"Unknown",color:"rgb(156, 163, 175)",bgColor:"rgba(156, 163, 175, 0.12)",icon:null};function rn(e){return qh[e]??Yh}function lw({source:e,className:t}){let r=rn(e);return jsxRuntime.jsxs("span",{className:ui$1.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 qi(e){return e==null?"-":utils$1.formatAmountInUsd(e)}function Jh(e){return e==null?"narrow":e>=5?"wide":e>=3?"moderate":"narrow"}var hc={wide:{color:"#f76816",bandFrom:"rgba(247,104,22,0.14)",bandTo:"rgba(247,104,22,0.03)",gaugeActive:"#f76816",gaugeInactive:"rgba(247,104,22,0.15)"},moderate:{color:"#c7ff2e",bandFrom:"rgba(199,255,46,0.12)",bandTo:"rgba(199,255,46,0.02)",gaugeActive:"#c7ff2e",gaugeInactive:"rgba(199,255,46,0.15)"},narrow:{color:"#71717a",bandFrom:"rgba(113,113,122,0.08)",bandTo:"transparent",gaugeActive:"#71717a",gaugeInactive:"rgba(113,113,122,0.12)"}},Zh={wide:{border:"rgba(247,104,22,0.4)",shadow:"0 2px 18px rgba(247,104,22,0.35)"},moderate:{border:"rgba(199,255,46,0.5)",shadow:"0 2px 20px rgba(199,255,46,0.45)"},narrow:{border:"rgba(113,113,122,0.5)",shadow:"0 2px 20px rgba(113,113,122,0.35)"}},mc={liquid_gap:{dot:"#17c964",label:"predict.matches.signalLiquidGap"},active_gap:{dot:"#c7ff2e",label:"predict.matches.signalActiveGap"},stale_gap:{dot:"#f5a524",label:"predict.matches.signalStaleGap"},stale_data:{dot:"#71717a",label:"predict.matches.signalStaleData"}};function ev(e){return e==null?null:e<120?"fresh":e<300?"aging":"stale"}var tv={fresh:"#17c964",aging:"#f5a524",stale:"#71717a"},rv={polymarket:{text:"#50a2ff",icon:"#50a2ff"},kalshi:{text:"#00d492",icon:"#00d492"}},nv={text:"#9ca3af",icon:"#9ca3af"};function ov(e){return rv[e]??nv}var iv=`
121
121
  .match-card button:focus-visible,
122
122
  .match-card a:focus-visible,
123
123
  .match-card [role="button"]:focus-visible {
124
124
  outline: 2px solid hsl(var(--heroui-primary) / 0.4);
125
125
  outline-offset: 2px;
126
126
  }
127
- `;function wh({tier:e}){let t=Ql[e],r=e==="wide"?5:e==="moderate"?3:1;return jsxRuntime.jsx("div",{style:{display:"flex",gap:2,alignItems:"center"},children:Array.from({length:5},(n,o)=>jsxRuntime.jsx("div",{style:{width:6,height:10,borderRadius:1.5,background:o<r?t.gaugeActive:t.gaugeInactive,transition:"background 0.2s"}},o))})}function Nh(e){if(Array.isArray(e.legs)&&e.legs.length===2)return [e.legs[0],e.legs[1]];let t=(r,n,o)=>({source:r,event_title:n,event_slug:o?.event_slug??"",market_id:o?.id??0,market_slug:o?.slug??"",question:o?.question??"",status:o?.status??"open",outcomes:o?.outcomes,best_price:o?.outcomes?.[0]?.best_ask??o?.outcomes?.[0]?.price??void 0,vol_24h_usd:o?.volume_24h??void 0});return !e.market_a||!e.market_b?null:[t(e.source_a,e.event_a_title??"",e.market_a),t(e.source_b,e.event_b_title??"",e.market_b)]}function Xl({match:e,onSelectMatch:t,getMatchHref:r,onSelectLeg:n,getLegHref:o,onHover:i,getMarketHref:a,LinkComponent:s}){let{t:c}=i18n.useTranslation(),u=Nh(e);if(!u)return null;let[m,l]=u,f=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,d=hh(f),p=Ql[d],h=m.best_price!=null&&l.best_price!=null?m.best_price<=l.best_price?m.source:l.source:null,g=m.event_title||l.event_title,v=e.signal_tag??"stale_data",x=Gl[v]??Gl.stale_data,k=r?.(e),S=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:Ph}),f!=null&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",background:`linear-gradient(90deg, ${p.bandFrom}, ${p.bandTo})`,borderBottom:"1px solid rgba(39,39,42,0.3)"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:p.color},fill:"none",stroke:"currentColor",strokeWidth:"2.5",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.jsxs("span",{style:{fontSize:15,fontWeight:700,fontVariantNumeric:"tabular-nums",color:p.color},children:[f.toFixed(1),"%"]}),jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:500,color:"rgba(161,161,170,0.7)",textTransform:"uppercase",letterSpacing:"0.06em"},children:c("predict.matches.gap")})]}),jsxRuntime.jsx(wh,{tier:d})]}),jsxRuntime.jsxs("div",{style:{padding:"14px 14px 12px"},children:[jsxRuntime.jsx("h3",{style:{fontSize:13,fontWeight:600,lineHeight:1.4,letterSpacing:"-0.2px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",margin:"0 0 12px"},children:g}),jsxRuntime.jsxs("div",{style:{borderRadius:10,border:"1px solid rgba(39,39,42,0.4)",overflow:"hidden"},children:[jsxRuntime.jsx(ql,{leg:m,isCheaper:h===m.source,externalUrlFallback:a?.(e,m.source),internalHref:o?.(e,m),onSelect:n?()=>n(e,m):void 0,LinkComponent:s}),jsxRuntime.jsx("div",{style:{height:1,background:"rgba(39,39,42,0.3)"}}),jsxRuntime.jsx(ql,{leg:l,isCheaper:h===l.source,externalUrlFallback:a?.(e,l.source),internalHref:o?.(e,l),onSelect:n?()=>n(e,l):void 0,LinkComponent:s})]})]}),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.15)",padding:"8px 14px"},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:11,height:11},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"})]}),_i(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:11,height:11},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"})}),_i(e.combined_volume_24h)," ",c("predict.matches.vol24h")]}),e.age_seconds!=null&&jsxRuntime.jsxs("span",{title:c("predict.matches.updatedAgo",{seconds:e.age_seconds}),style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},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"})]}),Ch(c,e.age_seconds)]})]}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,color:"#52525b"},children:[jsxRuntime.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:x.dot,flexShrink:0}}),c(x.label)]})]})]}),b={display:"block",color:"inherit",textDecoration:"none",borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",cursor:k||t?"pointer":void 0},y=A=>{let P=A.currentTarget,C=vh[d];P.style.borderColor=C.border,P.style.boxShadow=C.shadow,i?.(e);},M=A=>{let P=A.currentTarget;P.style.borderColor="rgba(39,39,42,0.6)",P.style.boxShadow="none";};return k&&s?jsxRuntime.jsx(s,{href:k,className:"group match-card",children:jsxRuntime.jsx("div",{style:b,onMouseEnter:y,onMouseLeave:M,onClick:()=>t?.(e),children:S})}):jsxRuntime.jsx("div",{className:"group match-card",role:t?"button":void 0,tabIndex:t?0:void 0,style:b,onMouseEnter:y,onMouseLeave:M,onClick:()=>t?.(e),onKeyDown:A=>{t&&(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),t(e));},children:S})}function Ch(e,t){if(t<60)return e("predict.matches.ageJustNow");if(t<3600){let n=Math.floor(t/60);return e("predict.matches.ageMinutes",{count:n})}let r=Math.floor(t/3600);return e("predict.matches.ageHours",{count:r})}function ql({leg:e,isCheaper:t,externalUrlFallback:r,internalHref:n,onSelect:o,LinkComponent:i}){let{t:a}=i18n.useTranslation(),s=ur(e.source),c=Sh(e.source),u=e.best_price,m=e.outcomes?.[0]?.label??null,l=e.external_url??r,f=bh(e.age_seconds),d=v=>{v.stopPropagation();},p=!!(n||o),h={display:"flex",alignItems:"center",gap:8,padding:"10px 12px",background:t?"rgba(199,255,46,0.03)":"transparent",cursor:p?"pointer":void 0,color:"inherit",textDecoration:"none"},g=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx("span",{style:{fontSize:10,color:"#c7ff2e",flexShrink:0},children:"\u2605"}):jsxRuntime.jsx("span",{style:{width:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,width:100,flexShrink:0},children:[s.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",color:c.text,textTransform:"uppercase"},children:s.label}),f&&jsxRuntime.jsx("span",{title:e.age_seconds!=null?a("predict.matches.updatedAgo",{seconds:e.age_seconds}):void 0,style:{width:6,height:6,borderRadius:"50%",background:xh[f],flexShrink:0}})]}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[m&&jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:m}),jsxRuntime.jsxs("span",{style:{fontSize:9,color:"#52525b"},children:[_i(e.vol_24h_usd)," ",a("predict.matches.vol24h")]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:3,flexShrink:0},children:[jsxRuntime.jsx("span",{style:{fontSize:18,fontWeight:700,fontVariantNumeric:"tabular-nums",color:t?"#c7ff2e":"#f4f4f5"},children:u!=null?(u*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:9,color:"#71717a"},children:a("predict.matches.centsYes")})]}),l?jsxRuntime.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer","aria-label":a("predict.matches.viewOn",{platform:s.label}),title:a("predict.matches.viewOn",{platform:s.label}),onClick:v=>v.stopPropagation(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,borderRadius:4,color:"#71717a",flexShrink:0},onMouseEnter:v=>{v.currentTarget.style.color="#d4d4d8",v.currentTarget.style.background="rgba(255,255,255,0.05)";},onMouseLeave:v=>{v.currentTarget.style.color="#71717a",v.currentTarget.style.background="transparent";},children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},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"})]})}):jsxRuntime.jsx("span",{style:{width:18,flexShrink:0}})]});return n&&i?jsxRuntime.jsx(i,{href:n,className:"match-card-leg-link",onClick:v=>{d(v),o?.();},children:jsxRuntime.jsx("div",{style:h,children:g})}):p?jsxRuntime.jsx("div",{role:"link",tabIndex:0,style:h,onClick:v=>{d(v),o?.();},onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),d(v),o?.());},children:g}):jsxRuntime.jsx("div",{style:h,children:g})}var rc=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:n,signal:o,onSelectMatch:i,getMatchHref:a,onSelectLeg:s,getLegHref:c,onSelect:u,onHover:m,getMarketHref:l,LinkComponent:f,onStatsChange:d},p){let{t:h}=i18n.useTranslation(),{data:g,hasNextPage:v,fetchNextPage:x,isFetchingNextPage:k,isLoading:S,isPlaceholderData:b,refetch:y}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:n,signal:o,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[M,A]=react.useState(0),[P,C]=react.useState(false);P&&!b?(C(false),A(te=>te+1)):b&&!P&&C(true),react.useImperativeHandle(p,()=>({refetch:()=>{y();}}),[y]);let I=react.useMemo(()=>g?.pages.flatMap(te=>te.items??[])??[],[g]),B=g?.pages[0]?.total,Y=react.useMemo(()=>{let te=0,N=0,E=0;for(let H of I){let J=H.spread??0;J>te&&(te=J),J>=.03&&E++,H.combined_volume!=null&&(N+=H.combined_volume);}return {activePairs:B??I.length,maxSpread:te,highSpreadCount:E,totalVolume:N}},[I,B]);react.useEffect(()=>{Y.activePairs>0&&d?.(Y);},[Y,d]);let z=react.useRef(null),Q=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]);if(react.useEffect(()=>{let te=z.current;if(!te)return;let N=new IntersectionObserver(E=>{E[0]?.isIntersecting&&v&&!k&&x();},{rootMargin:"200px"});return N.observe(te),()=>N.disconnect()},[v,k,x]),react.useEffect(()=>{if(v)return document.documentElement.style.overscrollBehaviorY="none",()=>{document.documentElement.style.overscrollBehaviorY="";}},[v]),S)return jsxRuntime.jsx(Oh,{});if(I.length===0)return 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:h("predict.matches.empty")})});let q=!v&&I.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
127
+ `;function sv({tier:e}){let t=hc[e],r=e==="wide"?5:e==="moderate"?3:1;return jsxRuntime.jsx("div",{style:{display:"flex",gap:2,alignItems:"center"},children:Array.from({length:5},(n,o)=>jsxRuntime.jsx("div",{style:{width:6,height:10,borderRadius:1.5,background:o<r?t.gaugeActive:t.gaugeInactive,transition:"background 0.2s"}},o))})}function av(e){if(Array.isArray(e.legs)&&e.legs.length===2)return [e.legs[0],e.legs[1]];let t=(r,n,o)=>({source:r,event_title:n,event_slug:o?.event_slug??"",market_id:o?.id??0,market_slug:o?.slug??"",question:o?.question??"",status:o?.status??"open",outcomes:o?.outcomes,best_price:o?.outcomes?.[0]?.best_ask??o?.outcomes?.[0]?.price??void 0,vol_24h_usd:o?.volume_24h??void 0});return !e.market_a||!e.market_b?null:[t(e.source_a,e.event_a_title??"",e.market_a),t(e.source_b,e.event_b_title??"",e.market_b)]}function vc({match:e,onSelectMatch:t,getMatchHref:r,onSelectLeg:n,getLegHref:o,onHover:i,getMarketHref:s,LinkComponent:a}){let{t:l}=i18n.useTranslation(),u=av(e);if(!u)return null;let[p,c]=u,g=e.spread_percent!=null?e.spread_percent:e.spread!=null?e.spread*100:null,d=Jh(g),m=hc[d],h=p.best_price!=null&&c.best_price!=null?p.best_price<=c.best_price?p.source:c.source:null,v=p.event_title||c.event_title,f=e.signal_tag??"stale_data",y=mc[f]??mc.stale_data,x=r?.(e),k=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("style",{children:iv}),g!=null&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",background:`linear-gradient(90deg, ${m.bandFrom}, ${m.bandTo})`,borderBottom:"1px solid rgba(39,39,42,0.3)"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:m.color},fill:"none",stroke:"currentColor",strokeWidth:"2.5",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.jsxs("span",{style:{fontSize:15,fontWeight:700,fontVariantNumeric:"tabular-nums",color:m.color},children:[g.toFixed(1),"%"]}),jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:500,color:"rgba(161,161,170,0.7)",textTransform:"uppercase",letterSpacing:"0.06em"},children:l("predict.matches.gap")})]}),jsxRuntime.jsx(sv,{tier:d})]}),jsxRuntime.jsxs("div",{style:{padding:"14px 14px 12px"},children:[jsxRuntime.jsx("h3",{style:{fontSize:13,fontWeight:600,lineHeight:1.4,letterSpacing:"-0.2px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",margin:"0 0 12px"},children:v}),jsxRuntime.jsxs("div",{style:{borderRadius:10,border:"1px solid rgba(39,39,42,0.4)",overflow:"hidden"},children:[jsxRuntime.jsx(fc,{leg:p,isCheaper:h===p.source,externalUrlFallback:s?.(e,p.source),internalHref:o?.(e,p),onSelect:n?()=>n(e,p):void 0,LinkComponent:a}),jsxRuntime.jsx("div",{style:{height:1,background:"rgba(39,39,42,0.3)"}}),jsxRuntime.jsx(fc,{leg:c,isCheaper:h===c.source,externalUrlFallback:s?.(e,c.source),internalHref:o?.(e,c),onSelect:n?()=>n(e,c):void 0,LinkComponent:a})]})]}),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.15)",padding:"8px 14px"},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:11,height:11},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"})]}),qi(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:11,height:11},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"})}),qi(e.combined_volume_24h)," ",l("predict.matches.vol24h")]}),e.age_seconds!=null&&jsxRuntime.jsxs("span",{title:l("predict.matches.updatedAgo",{seconds:e.age_seconds}),style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},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"})]}),lv(l,e.age_seconds)]})]}),jsxRuntime.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,color:"#52525b"},children:[jsxRuntime.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:y.dot,flexShrink:0}}),l(y.label)]})]})]}),b={display:"block",color:"inherit",textDecoration:"none",borderRadius:14,border:"1px solid rgba(39,39,42,0.6)",background:"rgba(24,24,27,0.4)",overflow:"hidden",transition:"all 0.2s",cursor:x||t?"pointer":void 0},S=B=>{let N=B.currentTarget,C=Zh[d];N.style.borderColor=C.border,N.style.boxShadow=C.shadow,i?.(e);},M=B=>{let N=B.currentTarget;N.style.borderColor="rgba(39,39,42,0.6)",N.style.boxShadow="none";};return x&&a?jsxRuntime.jsx(a,{href:x,className:"group match-card",children:jsxRuntime.jsx("div",{style:b,onMouseEnter:S,onMouseLeave:M,onClick:()=>t?.(e),children:k})}):jsxRuntime.jsx("div",{className:"group match-card",role:t?"button":void 0,tabIndex:t?0:void 0,style:b,onMouseEnter:S,onMouseLeave:M,onClick:()=>t?.(e),onKeyDown:B=>{t&&(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),t(e));},children:k})}function lv(e,t){if(t<60)return e("predict.matches.ageJustNow");if(t<3600){let n=Math.floor(t/60);return e("predict.matches.ageMinutes",{count:n})}let r=Math.floor(t/3600);return e("predict.matches.ageHours",{count:r})}function fc({leg:e,isCheaper:t,externalUrlFallback:r,internalHref:n,onSelect:o,LinkComponent:i}){let{t:s}=i18n.useTranslation(),a=rn(e.source),l=ov(e.source),u=e.best_price,p=e.outcomes?.[0]?.label??null,c=e.external_url??r,g=ev(e.age_seconds),d=f=>{f.stopPropagation();},m=!!(n||o),h={display:"flex",alignItems:"center",gap:8,padding:"10px 12px",background:t?"rgba(199,255,46,0.03)":"transparent",cursor:m?"pointer":void 0,color:"inherit",textDecoration:"none"},v=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[t?jsxRuntime.jsx("span",{style:{fontSize:10,color:"#c7ff2e",flexShrink:0},children:"\u2605"}):jsxRuntime.jsx("span",{style:{width:10,flexShrink:0}}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:5,width:100,flexShrink:0},children:[a.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.04em",color:l.text,textTransform:"uppercase"},children:a.label}),g&&jsxRuntime.jsx("span",{title:e.age_seconds!=null?s("predict.matches.updatedAgo",{seconds:e.age_seconds}):void 0,style:{width:6,height:6,borderRadius:"50%",background:tv[g],flexShrink:0}})]}),jsxRuntime.jsxs("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",gap:1},children:[p&&jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p}),jsxRuntime.jsxs("span",{style:{fontSize:9,color:"#52525b"},children:[qi(e.vol_24h_usd)," ",s("predict.matches.vol24h")]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:3,flexShrink:0},children:[jsxRuntime.jsx("span",{style:{fontSize:18,fontWeight:700,fontVariantNumeric:"tabular-nums",color:t?"#c7ff2e":"#f4f4f5"},children:u!=null?(u*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:9,color:"#71717a"},children:s("predict.matches.centsYes")})]}),c?jsxRuntime.jsx("a",{href:c,target:"_blank",rel:"noopener noreferrer","aria-label":s("predict.matches.viewOn",{platform:a.label}),title:s("predict.matches.viewOn",{platform:a.label}),onClick:f=>f.stopPropagation(),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:18,height:18,borderRadius:4,color:"#71717a",flexShrink:0},onMouseEnter:f=>{f.currentTarget.style.color="#d4d4d8",f.currentTarget.style.background="rgba(255,255,255,0.05)";},onMouseLeave:f=>{f.currentTarget.style.color="#71717a",f.currentTarget.style.background="transparent";},children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:11,height:11},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"})]})}):jsxRuntime.jsx("span",{style:{width:18,flexShrink:0}})]});return n&&i?jsxRuntime.jsx(i,{href:n,className:"match-card-leg-link",onClick:f=>{d(f),o?.();},children:jsxRuntime.jsx("div",{style:h,children:v})}):m?jsxRuntime.jsx("div",{role:"link",tabIndex:0,style:h,onClick:f=>{d(f),o?.();},onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),d(f),o?.());},children:v}):jsxRuntime.jsx("div",{style:h,children:v})}var Sc=react.forwardRef(function({sortBy:t,sortAsc:r,minVolume:n,signal:o,onSelectMatch:i,getMatchHref:s,onSelectLeg:a,getLegHref:l,onSelect:u,onHover:p,getMarketHref:c,LinkComponent:g,onStatsChange:d},m){let{t:h}=i18n.useTranslation(),{data:v,hasNextPage:f,fetchNextPage:y,isFetchingNextPage:x,isLoading:k,isPlaceholderData:b,refetch:S}=reactPredict.useInfiniteMatchMarkets({sort_by:t,sort_asc:r,min_volume:n,signal:o,status:"active",limit:20},{placeholderData:reactQuery.keepPreviousData}),[M,B]=react.useState(0),[N,C]=react.useState(false);N&&!b?(C(false),B(ee=>ee+1)):b&&!N&&C(true),react.useImperativeHandle(m,()=>({refetch:()=>{S();}}),[S]);let I=react.useMemo(()=>v?.pages.flatMap(ee=>ee.items??[])??[],[v]),D=v?.pages[0]?.total,j=react.useMemo(()=>{let ee=0,re=0,ue=0;for(let ce of I){let Ae=ce.spread??0;Ae>ee&&(ee=Ae),Ae>=.03&&ue++,ce.combined_volume!=null&&(re+=ce.combined_volume);}return {activePairs:D??I.length,maxSpread:ee,highSpreadCount:ue,totalVolume:re}},[I,D]);react.useEffect(()=>{j.activePairs>0&&d?.(j);},[j,d]);let L=react.useRef(null),U=react.useCallback(()=>{window.scrollTo({top:0,behavior:"smooth"});},[]);if(react.useEffect(()=>{let ee=L.current;if(!ee)return;let re=new IntersectionObserver(ue=>{ue[0]?.isIntersecting&&f&&!x&&y();},{rootMargin:"200px"});return re.observe(ee),()=>re.disconnect()},[f,x,y]),react.useEffect(()=>{if(f)return document.documentElement.style.overscrollBehaviorY="none",()=>{document.documentElement.style.overscrollBehaviorY="";}},[f]),k)return jsxRuntime.jsx(hv,{});if(I.length===0)return 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:h("predict.matches.empty")})});let H=!f&&I.length>0;return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[jsxRuntime.jsx("style",{children:`
128
128
  @media(max-width:1023px){.matches-card-grid{grid-template-columns:1fr!important}}
129
129
  @keyframes matchCardEnter{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
130
- `}),jsxRuntime.jsx("div",{className:"matches-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:16},children:g?.pages.map(te=>te.items?.map((N,E)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${E*35}ms both`},children:jsxRuntime.jsx(Xl,{match:N,onSelectMatch:i,getMatchHref:a,onSelectLeg:s,getLegHref:c,onHover:m,onSelect:u,getMarketHref:l,LinkComponent:f})},`${M}-${N.match_id}-${N.source_a}-${N.market_a?.slug??E}`)))}),jsxRuntime.jsxs("div",{ref:z,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:[jsxRuntime.jsx("style",{children:"@keyframes match-load-spin{to{transform:rotate(360deg)}}"}),k&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[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"})}),h("predict.matches.loadMore")]})]}),q&&jsxRuntime.jsx(Ih,{onScrollToTop:Q})]})});function Ih({onScrollToTop:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,padding:"24px 0"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:16,width:"100%"},children:[jsxRuntime.jsx("div",{style:{height:1,width:64,background:"rgba(82,82,91,0.5)"}}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:500,color:"#71717a"},children:t("predict.matches.endOfList")}),jsxRuntime.jsx("div",{style:{height:1,width:64,background:"rgba(82,82,91,0.5)"}})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:4,fontSize:12,fontWeight:500,color:"#a1a1aa",background:"none",border:"none",cursor:"pointer",padding:0},onClick:e,children:[jsxRuntime.jsxs("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:"M12 19V5"}),jsxRuntime.jsx("path",{d:"m5 12 7-7 7 7"})]}),jsxRuntime.jsx("span",{children:t("predict.matches.backToTop")})]})]})}function Oh(){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, minmax(0, 1fr))",gap:16},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(Dh,{index:t},t))})]})}function Dh({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(n=>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}})]},n))}),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 Wh={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function Uh(){let[e,t]=react.useState("");return react.useEffect(()=>{let r=()=>{let o=new Date;return `${String(o.getHours()).padStart(2,"0")}:${String(o.getMinutes()).padStart(2,"0")}`};t(r());let n=setInterval(()=>t(r()),1e4);return ()=>clearInterval(n)},[]),jsxRuntime.jsx("span",{children:e})}function $h({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:utils$1.formatAmount(e.activePairs)})]}),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(Uh,{})]})]})]})]})}function DP({onSelectMatch:e,getMatchHref:t,onSelectLeg:r,getLegHref:n,onHover:o,onSelect:i,getMarketHref:a,LinkComponent:s,bgImageSrc:c}){let{t:u}=i18n.useTranslation(),[m,l]=react.useState("spread"),[f,d]=react.useState(false),[p,h]=react.useState(void 0),[g,v]=react.useState(),x=react.useRef(null),k=react.useCallback(M=>{l(M);},[]),S=react.useCallback(M=>{d(M);},[]),b=react.useCallback(M=>{react.startTransition(()=>{v(M);});},[]),y=react.useCallback(()=>{x.current?.refetch();},[]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative"},children:[jsxRuntime.jsx("style",{children:`
130
+ `}),jsxRuntime.jsx("div",{className:"matches-card-grid",style:{display:"grid",gridTemplateColumns:"repeat(2, minmax(0, 1fr))",gap:16},children:v?.pages.map(ee=>ee.items?.map((re,ue)=>jsxRuntime.jsx("div",{style:{animation:`matchCardEnter 0.45s cubic-bezier(0.34,1.56,0.64,1) ${ue*35}ms both`},children:jsxRuntime.jsx(vc,{match:re,onSelectMatch:i,getMatchHref:s,onSelectLeg:a,getLegHref:l,onHover:p,onSelect:u,getMarketHref:c,LinkComponent:g})},`${M}-${re.match_id}-${re.source_a}-${re.market_a?.slug??ue}`)))}),jsxRuntime.jsxs("div",{ref:L,style:{display:"flex",flexDirection:"column",alignItems:"center",gap:8,padding:"16px 0",minHeight:1},children:[jsxRuntime.jsx("style",{children:"@keyframes match-load-spin{to{transform:rotate(360deg)}}"}),x&&jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:"#71717a",fontSize:13},children:[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"})}),h("predict.matches.loadMore")]})]}),H&&jsxRuntime.jsx(gv,{onScrollToTop:U})]})});function gv({onScrollToTop:e}){let{t}=i18n.useTranslation();return jsxRuntime.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,padding:"24px 0"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:16,width:"100%"},children:[jsxRuntime.jsx("div",{style:{height:1,width:64,background:"rgba(82,82,91,0.5)"}}),jsxRuntime.jsx("span",{style:{fontSize:12,fontWeight:500,color:"#71717a"},children:t("predict.matches.endOfList")}),jsxRuntime.jsx("div",{style:{height:1,width:64,background:"rgba(82,82,91,0.5)"}})]}),jsxRuntime.jsxs("button",{type:"button",style:{display:"flex",alignItems:"center",gap:4,fontSize:12,fontWeight:500,color:"#a1a1aa",background:"none",border:"none",cursor:"pointer",padding:0},onClick:e,children:[jsxRuntime.jsxs("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:"M12 19V5"}),jsxRuntime.jsx("path",{d:"m5 12 7-7 7 7"})]}),jsxRuntime.jsx("span",{children:t("predict.matches.backToTop")})]})]})}function hv(){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, minmax(0, 1fr))",gap:16},children:Array.from({length:6}).map((e,t)=>jsxRuntime.jsx(vv,{index:t},t))})]})}function vv({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(n=>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}})]},n))}),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 Pv={spread:"predict.matches.topOpportunities",volume:"predict.matches.highestVolume",confidence:"predict.matches.trendingToday"};function wv(){let[e,t]=react.useState("");return react.useEffect(()=>{let r=()=>{let o=new Date;return `${String(o.getHours()).padStart(2,"0")}:${String(o.getMinutes()).padStart(2,"0")}`};t(r());let n=setInterval(()=>t(r()),1e4);return ()=>clearInterval(n)},[]),jsxRuntime.jsx("span",{children:e})}function Nv({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:utils$1.formatAmount(e.activePairs)})]}),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(wv,{})]})]})]})]})}function Tw({onSelectMatch:e,getMatchHref:t,onSelectLeg:r,getLegHref:n,onHover:o,onSelect:i,getMarketHref:s,LinkComponent:a,bgImageSrc:l}){let{t:u}=i18n.useTranslation(),[p,c]=react.useState("spread"),[g,d]=react.useState(false),[m,h]=react.useState(void 0),[v,f]=react.useState(),y=react.useRef(null),x=react.useCallback(M=>{c(M);},[]),k=react.useCallback(M=>{d(M);},[]),b=react.useCallback(M=>{react.startTransition(()=>{f(M);});},[]),S=react.useCallback(()=>{y.current?.refetch();},[]);return jsxRuntime.jsxs("div",{style:{minHeight:"100vh",position:"relative"},children:[jsxRuntime.jsx("style",{children:`
131
131
  @keyframes matchFadeIn{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}
132
132
  .match-fade-in{animation:matchFadeIn .5s ease-out both}
133
133
  .match-fade-in-d1{animation:matchFadeIn .5s ease-out .1s both}
134
134
  .match-fade-in-d2{animation:matchFadeIn .5s ease-out .2s both}
135
- `}),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",zIndex:0,overflow:"hidden"},children:[c&&jsxRuntime.jsx("img",{src:c,alt:"","aria-hidden":"true",style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",objectPosition:"center center",opacity:.3,mixBlendMode:"lighten",maskImage:"linear-gradient(to bottom, black 50%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 50%, transparent 100%)"}}),jsxRuntime.jsx("div",{style:{position:"absolute",inset:0,opacity:.025,backgroundImage:"radial-gradient(circle at 1px 1px, rgb(255 255 255) 1px, transparent 0)",backgroundSize:"20px 20px"}})]}),jsxRuntime.jsx("style",{children:".matches-hero-wrap{padding:40px 16px 32px}@media(min-width:640px){.matches-hero-wrap{padding:48px 24px 40px}}@media(min-width:1024px){.matches-hero-wrap{padding:52px 32px 44px}}"}),jsxRuntime.jsx("div",{className:"match-fade-in matches-hero-wrap",style:{position:"relative",zIndex:2,maxWidth:1152,margin:"0 auto"},children:jsxRuntime.jsx(jl,{stats:g})})]}),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(199,255,46,0.15), rgba(23,201,100,0.15))",border:"1px solid rgba(199,255,46,0.15)",flexShrink:0},children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e"},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:u(Wh[m])}),g&&g.activePairs>0&&jsxRuntime.jsx("p",{className:"hidden sm:block",style:{fontSize:11,color:"#71717a",margin:0},children:u("predict.matches.pairsFound",{count:g.activePairs})})]})]}),jsxRuntime.jsx(Kl,{sortBy:m,onSortChange:k,sortAsc:f,onSortAscChange:S,minVolume:p,onMinVolumeChange:h,onRefresh:y})]})]}),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.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:16,padding:"8px 12px",borderRadius:8,border:"1px solid rgba(39,39,42,0.4)",background:"rgba(24,24,27,0.25)"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#52525b",flexShrink:0},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("p",{style:{fontSize:11,color:"#52525b",lineHeight:1.5,margin:0},children:[jsxRuntime.jsx("span",{style:{color:"#71717a",fontWeight:500},children:u("predict.matches.experimentalFeature")})," \u2014 ",u("predict.matches.disclaimer")]})]}),jsxRuntime.jsx(rc,{ref:x,sortBy:m,sortAsc:f,minVolume:p,onSelectMatch:e,getMatchHref:t,onSelectLeg:r,getLegHref:n,onHover:o,onSelect:i,getMarketHref:a,LinkComponent:s,onStatsChange:b})]}),jsxRuntime.jsx($h,{stats:g})]})}function Oi(e){return e==null?"-":utils$1.formatAmountInUsd(e)}var jh={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"}},Gh={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 qh(e){return jh[e]??Gh}function Yh(e){if(!e.matched_markets?.length)return null;let t=null,r=-1;for(let n of e.matched_markets){let o=n.spread??0;o>r&&(r=o,t=n);}return t}function Qh(e,t){let r=e.entries.find(s=>s.source===(t?.source_a??e.entries[0]?.source)),n=e.entries.find(s=>s.source===(t?.source_b??e.entries[1]?.source)),o=s=>{if(!s?.outcomes?.[0])return {name:null,price:null};let c=s.outcomes[0];return {name:c.label||null,price:c.best_ask??c.price??null}},i=o(t?.market_a),a=o(t?.market_b);return [{source:t?.source_a??r?.source??"unknown",outcomeName:i.name,yesPrice:i.price,volume:r?.event?.volume??null,event:r?.event},{source:t?.source_b??n?.source??"unknown",outcomeName:a.name,yesPrice:a.price,volume:n?.event?.volume??null,event:n?.event}]}function UP({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:n}){let {t:o}=i18n.useTranslation(),i=react.useMemo(()=>Yh(e),[e]),a=e.max_spread!=null?e.max_spread*100:null,[s,c]=react.useMemo(()=>Qh(e,i),[e,i]),u=a!=null&&a>=3;s.yesPrice!=null&&c.yesPrice!=null?s.source==="kalshi"?s.yesPrice>c.yesPrice:c.yesPrice>s.yesPrice:false;let l=s.yesPrice!=null&&c.yesPrice!=null?s.yesPrice<=c.yesPrice?s:c:null,f=l?ur(l.source):null,d=u?"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:p=>{let h=p.currentTarget;h.style.borderColor="rgba(63,63,70,0.6)",h.style.boxShadow="0 10px 15px -3px rgba(0,0,0,0.2)";},onMouseLeave:p=>{let h=p.currentTarget;h.style.borderColor="rgba(39,39,42,0.6)",h.style.boxShadow="none";},children:[a!=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 ${u?"rgba(255,185,0,0.3)":a>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:u?"rgba(255,185,0,0.15)":a>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:u?"#ffb900":a>=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"})}),a.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(ic,{data:s,isCheaper:l===s,onSelect:t,getEventHref:r,LinkComponent:n}),jsxRuntime.jsx(ic,{data:c,isCheaper:l===c,onSelect:t,getEventHref:r,LinkComponent:n})]}),l&&f&&a!=null&&jsxRuntime.jsxs("div",{style:{marginTop:12,padding:"8px 12px",borderRadius:10,display:"flex",alignItems:"center",gap:8,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${d==="amber"?"rgba(255,185,0,0.15)":"rgba(166,132,255,0.15)"}`,background:d==="amber"?"rgba(255,185,0,0.05)":"rgba(166,132,255,0.05)"},onClick:()=>l.event&&t?.(l.event),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:d==="amber"?"#ffb900":"#a684ff"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:d==="amber"?"rgba(255,185,0,0.9)":"rgba(166,132,255,0.9)"},children:o("predict.matches.buyEdge",{platform:l.source.charAt(0).toUpperCase()+l.source.slice(1),spread:a.toFixed(1)})}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,marginLeft:"auto",color:d==="amber"?"rgba(255,185,0,0.5)":"rgba(166,132,255,0.5)"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M5 12h14"}),jsxRuntime.jsx("path",{d:"m12 5 7 7-7 7"})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.2)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),Oi(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"})}),Oi(e.combined_volume_24h)," ",o("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),"%"," ",o("predict.matches.match")]})]})]})}function ic({data:e,isCheaper:t,onSelect:r,getEventHref:n,LinkComponent:o}){let{t:i}=i18n.useTranslation(),a=ur(e.source),s=qh(e.source),c=e.event?n?.(e.event):void 0,u=jsxRuntime.jsxs("div",{style:{borderRadius:14,border:`1px solid ${s.border}`,background:s.bg,padding:12,cursor:c||r?"pointer":void 0,transition:"border-color 0.15s"},onMouseEnter:m=>{m.currentTarget.style.borderColor=s.hoverBorder;},onMouseLeave:m=>{m.currentTarget.style.borderColor=s.border;},onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[a.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.05em",color:s.text,textTransform:"uppercase"},children:a.label}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",marginLeft:"auto"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})]}),e.outcomeName&&jsxRuntime.jsx("div",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:e.outcomeName}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[jsxRuntime.jsx("span",{style:{fontSize:20,fontWeight:700,fontVariantNumeric:"tabular-nums",color:t?s.priceActiveColor:s.priceColor},children:e.yesPrice!=null?(e.yesPrice*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a"},children:i("predict.matches.centsYes")})]}),jsxRuntime.jsxs("div",{style:{fontSize:10,color:"#52525b",marginTop:6},children:[Oi(e.volume)," ",i("predict.matches.volume")]})]});return c&&o?jsxRuntime.jsx(o,{href:c,className:"block",children:u}):u}function ev(e){return utils$1.formatAmountInUsd(e)}function qP({matches:e,total:t}){let{t:r}=i18n.useTranslation(),n=react.useMemo(()=>{let o=0,i=0,a=new Set;for(let s of e){s.max_spread!=null&&s.max_spread>o&&(o=s.max_spread),s.combined_volume!=null&&(i+=s.combined_volume);for(let c of s.entries)a.add(typeof c.source=="string"?c.source:"");}return {count:t??e.length,maxSpread:o,totalVolume:i,platformCount:a.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(wo,{label:r("predict.matches.stats.matchedMarkets"),value:n.count.toLocaleString()}),jsxRuntime.jsx(Di,{}),jsxRuntime.jsx(wo,{label:r("predict.matches.stats.totalVolume"),value:ev(n.totalVolume)}),jsxRuntime.jsx(Di,{}),jsxRuntime.jsx(wo,{label:r("predict.matches.stats.highestSpread"),value:`${(n.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(Di,{}),jsxRuntime.jsx(wo,{label:r("predict.matches.stats.platforms"),value:String(n.platformCount)})]})}function wo({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 Di(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function lc(e){return `${(e*100).toFixed(1)}\xA2`}function tv(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function JP({spread:e,arbProfit:t,className:r}){if(e==null)return null;let n=t!=null&&t>0;return jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center gap-x-2",r),children:[jsxRuntime.jsx("span",{className:ui$1.cn("text-sm font-semibold",tv(e)),children:lc(e)}),n&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",lc(t)]})]})}var Cn=10,av=64,pc=40,No=48;function mc({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState(1),{data:a,isLoading:s,fetchNextPage:c,hasNextPage:u,isFetchingNextPage:m}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:l,isLoading:f,fetchNextPage:d,hasNextPage:p,isFetchingNextPage:h}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),g=s||f,v=m||h,x=u||p,k=react.useMemo(()=>{let B=[];return a?.pages&&B.push(...a.pages.flatMap(Y=>Y.items)),l?.pages&&B.push(...l.pages.flatMap(Y=>Y.items)),B.sort((Y,z)=>(z.timestamp??0)-(Y.timestamp??0)),B},[a,l]),S=Math.max(1,Math.ceil(k.length/Cn)+(x?1:0)),b=(o-1)*Cn,y=k.slice(b,b+Cn),M=react.useCallback(()=>{i(B=>Math.max(1,B-1));},[]),A=react.useCallback(async()=>{o*Cn>=k.length&&x&&(u&&await c(),p&&await d()),i(Y=>Y+1);},[o,k.length,x,u,p,c,d]),P=o>1,C=o*Cn<k.length||x;if(g)return jsxRuntime.jsx(mv,{height:r});if(k.length===0&&!x)return jsxRuntime.jsx(pv,{message:n("predict.profile.noHistory"),height:r});let I=r-pc-No;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:pc},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:n("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.status")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.price")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:n("predict.profile.depositWithdraw")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.fee")}),jsxRuntime.jsx("div",{className:"w-10 shrink-0"})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:I},children:[y.map((B,Y)=>jsxRuntime.jsx(lv,{trade:B},B.id??`${b+Y}`)),v&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})]}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:No},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!P,onClick:M,className:ui$1.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 ",n("predict.profile.previous")]}),Array.from({length:Math.min(S,5)},(B,Y)=>{let z=Y+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>i(z),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",z===o?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:z},z)}),jsxRuntime.jsxs("button",{type:"button",disabled:!C,onClick:A,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",C?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[n("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-No},children:y.map((B,Y)=>jsxRuntime.jsx(cv,{trade:B},B.id??`m-${b+Y}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:No},children:[jsxRuntime.jsx("button",{type:"button",disabled:!P,onClick:M,className:ui$1.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:o}),jsxRuntime.jsx("button",{type:"button",disabled:!C,onClick:A,className:ui$1.cn("text-sm cursor-pointer",C?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function lv({trade:e}){let{t}=i18n.useTranslation(),r=e.type==="REDEEM",n=e.side?.toUpperCase()==="BUY",o=e.price??0,i=e.usd_size??0,a=fc(e.type,t),s=r||n,c=s?"+":"-",u=s?"text-success":"text-foreground",m=e.event?.title??e.market?.question??"\u2014",l=e.event?.image_url,f=e.outcome??"",d=bc(e.timestamp),p=gc(e),h=dv(e),g=uv(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:av},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:[l&&jsxRuntime.jsx("img",{src:l,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:m}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[f&&jsxRuntime.jsx("span",{className:"mr-1",children:f}),jsxRuntime.jsx("span",{children:d})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui$1.cn("text-sm font-medium",r?"text-primary":n?"text-success":"text-danger"),children:t(r?"predict.profile.redeem":n?"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:vc(o)}),jsxRuntime.jsx("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono",u),children:i>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[c,"$",i.toFixed(2)]}):"\u2014"}),jsxRuntime.jsx("div",{className:ui$1.cn("flex-1 pr-2 text-right font-mono",h!==null?h>=0?"text-success":"text-danger":"text-neutral"),children:h!==null?`${h>=0?"+":"-"}$${Math.abs(h).toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-neutral",children:g!==null?`$${g.toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"w-10 shrink-0 text-right",children:p&&jsxRuntime.jsx("a",{href:p,target:"_blank",rel:"noopener noreferrer",className:"text-neutral hover:text-foreground transition-colors","aria-label":"View transaction",children:jsxRuntime.jsx(hc,{})})})]})}function cv({trade:e}){let{t}=i18n.useTranslation(),r=e.type==="REDEEM",n=e.side?.toUpperCase()==="BUY",o=e.price??0,i=e.usd_size??0,a=fc(e.type,t),s=e.event?.title??e.market?.question??"\u2014",c=bc(e.timestamp),u=gc(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:s})]}),jsxRuntime.jsx("span",{className:"text-[11px] text-neutral whitespace-nowrap",children:c})]}),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$1.cn("font-medium",r?"text-primary":n?"text-success":"text-danger"),children:t(r?"predict.profile.redeem":n?"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:vc(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:i>0?`$${i.toFixed(2)}`:"\u2014"})]}),u&&jsxRuntime.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"ml-auto text-neutral hover:text-foreground transition-colors",children:jsxRuntime.jsx(hc,{})})]})]})}function fc(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 gc(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function dv(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 n=parseFloat(r);if(!Number.isNaN(n))return n}}return e.type==="REDEEM"&&e.usd_size!=null?e.usd_size:null}function uv(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 n=parseFloat(r);if(!Number.isNaN(n))return n}}return null}function hc(){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 pv({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function mv({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$1.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function vc(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function bc(e){let t=new Date(e*1e3),r=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),o=t.getDate().toString().padStart(2,"0"),i=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear(),s=t.getTimezoneOffset(),c=s<=0?"+":"-",u=String(Math.abs(Math.floor(s/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${a} (${c}${u})`}var Mn=10,yv=64,yc=40,Co=48;function Sc({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),o=reactPredict.useCancelOrder(),[i,a]=react.useState(1),{data:s,isLoading:c,fetchNextPage:u,hasNextPage:m,isFetchingNextPage:l}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:f,isLoading:d,fetchNextPage:p,hasNextPage:h,isFetchingNextPage:g}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),v=c||d,x=l||g,k=m||h,S=react.useMemo(()=>{let z=[],Q=new Set(["live","open","submitted","pending"]);return s?.pages&&z.push(...s.pages.flatMap(q=>q.items).filter(q=>Q.has(q.status))),f?.pages&&z.push(...f.pages.flatMap(q=>q.items).filter(q=>Q.has(q.status))),z},[s,f]),b=react.useCallback(z=>{o.mutate({source:z.source,id:z.id});},[o]),y=Math.max(1,Math.ceil(S.length/Mn)+(k?1:0)),M=(i-1)*Mn,A=S.slice(M,M+Mn),P=react.useCallback(()=>{a(z=>Math.max(1,z-1));},[]),C=react.useCallback(async()=>{i*Mn>=S.length&&k&&(m&&await u(),h&&await p()),a(Q=>Q+1);},[i,S.length,k,m,h,u,p]),I=i>1,B=i*Mn<S.length||k;if(v)return jsxRuntime.jsx(wv,{height:r});if(S.length===0&&!k)return jsxRuntime.jsx(Pv,{message:n("predict.profile.noOrders"),height:r});let Y=r-yc-Co;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:yc},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:n("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.fillPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.cost")})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:Y},children:[A.map(z=>jsxRuntime.jsx(kv,{order:z,onCancel:b},z.id)),x&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})]}),jsxRuntime.jsx(kc,{className:"hidden lg:flex",currentPage:i,totalPages:y,canGoPrev:I,canGoNext:B,onPrev:P,onNext:C,onPage:a,t:n}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Co},children:A.map(z=>jsxRuntime.jsx(Sv,{order:z,onCancel:b},z.id))}),jsxRuntime.jsx(kc,{className:"lg:hidden",currentPage:i,totalPages:y,canGoPrev:I,canGoNext:B,onPrev:P,onNext:C,onPage:a,t:n,compact:true})]})}function kv({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),n=e.side==="BUY",o=e.price?parseFloat(e.price):0,i=e.in_amount?parseFloat(e.in_amount):o*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:yv},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$1.cn("text-sm font-medium",n?"text-success":"text-danger"),children:r(n?"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:o>0?Pc(o):"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]})}function Sv({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),n=e.side==="BUY",o=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$1.cn("text-xs font-medium px-1.5 py-0.5 rounded",n?"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:o>0?Pc(o):"\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 kc({className:e,currentPage:t,totalPages:r,canGoPrev:n,canGoNext:o,onPrev:i,onNext:a,onPage:s,t:c,compact:u}){return u?jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-3 shrink-0",e),style:{height:Co},children:[jsxRuntime.jsx("button",{type:"button",disabled:!n,onClick:i,className:ui$1.cn("text-sm cursor-pointer",n?"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:!o,onClick:a,className:ui$1.cn("text-sm cursor-pointer",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]}):jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-2 shrink-0",e),style:{height:Co},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!n,onClick:i,className:ui$1.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:["\u2190 ",c("predict.profile.previous")]}),Array.from({length:Math.min(r,5)},(m,l)=>{let f=l+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>s(f),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",f===t?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:f},f)}),jsxRuntime.jsxs("button",{type:"button",disabled:!o,onClick:a,className:ui$1.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:[c("predict.profile.next")," \u2192"]})]})}function Pv({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function wv({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$1.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Pc(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}var zi=10,Tv=64,wc=40,Mo=48;function Nc({positions:e,isLoading:t,listHeight:r,onClosePosition:n,onEventClick:o}){let{t:i}=i18n.useTranslation(),[a,s]=react.useState(1),c=react.useCallback(()=>{for(let h of e)n?.(h);},[e,n]);if(t)return jsxRuntime.jsx(_v,{height:r});if(e.length===0)return jsxRuntime.jsx(Rv,{message:i("predict.profile.noPositions"),height:r});let u=Math.max(1,Math.ceil(e.length/zi)),m=(a-1)*zi,l=e.slice(m,m+zi),f=a>1,d=a<u,p=r-wc-Mo;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:wc},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:i("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.markPrice")}),jsxRuntime.jsxs("div",{className:"flex-[1.5] pr-2 text-right",children:[jsxRuntime.jsx("span",{children:i("predict.profile.pnl")}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",i("predict.profile.pnlExcludeFees"),")"]})]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:i("predict.profile.estSettlement")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:n&&e.length>0&&jsxRuntime.jsx("button",{type:"button",onClick:c,className:"text-xs text-primary hover:text-primary/80 cursor-pointer transition-colors",children:i("predict.profile.closeAll")})})]}),jsxRuntime.jsx("div",{className:"hidden lg:block overflow-y-auto",style:{height:p},children:l.map((h,g)=>jsxRuntime.jsx(Ev,{position:h,onClosePosition:n,onEventClick:o},`${h.source}-${h.market?.slug??m+g}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:Mo},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!f,onClick:()=>s(h=>Math.max(1,h-1)),className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",f?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",i("predict.profile.previous")]}),Array.from({length:Math.min(u,5)},(h,g)=>{let v=g+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>s(v),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",v===a?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:v},v)}),jsxRuntime.jsxs("button",{type:"button",disabled:!d,onClick:()=>s(h=>h+1),className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",d?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[i("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Mo},children:l.map((h,g)=>jsxRuntime.jsx(Lv,{position:h,onClose:n,onEventClick:o},`${h.source}-${h.market?.slug??`m-${m+g}`}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:Mo},children:[jsxRuntime.jsx("button",{type:"button",disabled:!f,onClick:()=>s(h=>Math.max(1,h-1)),className:ui$1.cn("text-sm cursor-pointer",f?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:a}),jsxRuntime.jsx("button",{type:"button",disabled:!d,onClick:()=>s(h=>h+1),className:ui$1.cn("text-sm cursor-pointer",d?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function Ev({position:e,onClosePosition:t,onEventClick:r}){let{t:n}=i18n.useTranslation(),o=e.pnl??0,i=e.pnl_percent??0,a=e.avg_price??0,s=e.current_price??0,c=e.current_value??e.size*s,u=e.size,m=o>0?"text-success":o<0?"text-danger":"text-foreground",l=o>0?"+":"",f=e.event?.title??e.market?.question??"\u2014",d=e.event?.image_url,p=e.side,h=e.market?.outcomes?.[0]?.label??"",g=e.market?.end_at?Iv(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:Tv},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:[d&&jsxRuntime.jsx("img",{src:d,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:f}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[jsxRuntime.jsx("span",{className:ui$1.cn("font-medium",p.toLowerCase()==="yes"?"text-success":"text-danger"),children:p}),h&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1",children:"\xB7"}),jsxRuntime.jsx("span",{children:h})]})]})]})]})}),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:["$",c.toFixed(2)]}),jsxRuntime.jsx("span",{className:"text-[10px] text-neutral",children:n("predict.profile.contracts",{count:kr(e.size)})})]})}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",(e.size*a).toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Wi(a)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Wi(s)}),jsxRuntime.jsxs("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono",m),children:[jsxRuntime.jsxs("span",{children:[l,"$",Math.abs(o).toFixed(2)]}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",l,i.toFixed(2),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",u.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap text-xs",children:g}),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"}),n("predict.profile.close")]})})]})}function Lv({position:e,onClose:t,onEventClick:r}){let{t:n}=i18n.useTranslation(),o=e.pnl??0,i=e.pnl_percent??0,a=e.current_price??0,s=o>0?"text-success":o<0?"text-danger":"text-foreground",c=o>0?"+":"",u=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:u})]}),jsxRuntime.jsx("span",{className:ui$1.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(To,{label:n("predict.profile.totalSize"),value:kr(e.size)}),jsxRuntime.jsx(To,{label:n("predict.profile.markPrice"),value:Wi(a)}),jsxRuntime.jsx(To,{label:n("predict.profile.pnl"),value:`${c}$${Math.abs(o).toFixed(2)} (${c}${i.toFixed(1)}%)`,className:s}),jsxRuntime.jsx(To,{label:n("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:n("predict.profile.close")})})]})}function To({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$1.cn("font-mono text-foreground",r),children:t})]})}function Rv({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function _v({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$1.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Wi(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Iv(e){try{let t=new Date(e),r=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),o=t.getDate().toString().padStart(2,"0"),i=(t.getMonth()+1).toString().padStart(2,"0"),a=t.getFullYear(),s=t.getTimezoneOffset(),c=s<=0?"+":"-",u=String(Math.abs(Math.floor(s/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${a} (${c}${u})`}catch{return "\u2014"}}function Mc({positions:e,trades:t,isLoading:r,positionsValue:n,positionsValueLoading:o}){let{t:i}=i18n.useTranslation(),a=react.useMemo(()=>{let u=0,m=0;for(let h of e)u+=h.realized_pnl??0,m+=h.current_value??h.size*(h.current_price??0);let l=0,f=0,d=0;for(let h of t)l+=h.usd_size??0,h.type==="REDEEM"&&(d++,(h.usd_size??0)>0&&f++);let p=d>0?`${f} / ${d}`:"0 / 0";return {realizedPnl:u,positionsValue:n??m,volume:l,winRateStr:p}},[e,n,t]),s=a.realizedPnl>0?"text-success":a.realizedPnl<0?"text-danger":"text-foreground",c=a.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:i("predict.profile.realizedPnl")}),r?jsxRuntime.jsx(ui$1.Skeleton,{className:"h-14 w-48 rounded-md"}):jsxRuntime.jsxs("span",{className:ui$1.cn("text-5xl font-bold tabular-nums",s),children:[c,"$",Math.abs(a.realizedPnl).toFixed(2)]})]}),jsxRuntime.jsxs("div",{className:"flex items-end gap-8 sm:gap-10",children:[jsxRuntime.jsx($i,{label:i("predict.profile.winRate"),value:a.winRateStr,isLoading:r}),jsxRuntime.jsx($i,{label:i("predict.profile.positions"),value:`$${a.positionsValue.toFixed(2)}`,isLoading:o??r}),jsxRuntime.jsx($i,{label:i("predict.profile.volume"),value:`$${a.volume.toFixed(2)}`,isLoading:r})]})]})}function $i({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$1.Skeleton,{className:"h-6 w-14 rounded-md"}):jsxRuntime.jsx("span",{className:"text-base font-semibold tabular-nums text-foreground",children:t})]})}var Vi=600;function Uv({solanaAddress:e,evmAddress:t,onClosePosition:r,onEventClick:n}){let{t:o}=i18n.useTranslation(),[i,a]=react.useState("positions"),s=!!(e||t),{data:c,isLoading:u}=reactPredict.usePositions({source:"kalshi",user:e??""}),{data:m,isLoading:l}=reactPredict.usePositions({source:"polymarket",user:t??""}),f=react.useMemo(()=>{let C=[];return c?.positions&&C.push(...c.positions),m?.positions&&C.push(...m.positions),C},[c,m]),d=u||l,{data:p,isLoading:h}=reactPredict.usePositionValueMulti({kalshi_user:e||void 0,polymarket_user:t||void 0}),g=react.useMemo(()=>{if(!p)return;let C=Number(p.value);return Number.isFinite(C)?C:void 0},[p?.value]),{data:v,isLoading:x}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:k,isLoading:S}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),b=react.useMemo(()=>[...v?.pages?.flatMap(I=>I.items)??[],...k?.pages?.flatMap(I=>I.items)??[]],[v,k]),y=d||x||S,M=f.length,P=[{key:"positions",label:M>0?`${o("predict.profile.positionsTab")} (${M})`:o("predict.profile.positionsTab")},{key:"orders",label:o("predict.profile.openOrdersTab")},{key:"history",label:o("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(Mc,{positions:f,trades:b,isLoading:y,positionsValue:g,positionsValueLoading:h}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:P.map(C=>jsxRuntime.jsx("button",{type:"button",onClick:()=>a(C.key),className:ui$1.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",i===C.key?"text-foreground border-b-2 border-foreground":"text-neutral hover:text-foreground"),children:C.label},C.key))}),jsxRuntime.jsxs("div",{className:"py-2",children:[i==="positions"&&jsxRuntime.jsx(Nc,{positions:f,isLoading:d,listHeight:Vi,onClosePosition:r,onEventClick:n}),i==="orders"&&jsxRuntime.jsx(Sc,{solanaAddress:e,evmAddress:t,listHeight:Vi}),i==="history"&&jsxRuntime.jsx(mc,{solanaAddress:e,evmAddress:t,listHeight:Vi})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:o("predict.profile.connectWallet")})}function Yw({isOpen:e,onClose:t,safeDeployed:r,tokenApproved:n,onDeployAndApprove:o}){let{t:i}=i18n.useTranslation(),[a,s]=react.useState(false),[c,u]=react.useState(null),[m,l]=react.useState(false),f=r||m,d=n||m,p=f?"done":a?"running":"pending",h=d?"done":f&&a?"running":"pending",g=f&&d,v=react.useCallback(async()=>{u(null),l(false),s(true);try{await o(),l(!0);}catch(b){u(b instanceof Error?b.message:String(b));}finally{s(false);}},[o]),x=[{key:"step1",label:i("predict.setup.step1"),desc:i("predict.setup.step1Desc"),status:p},{key:"step2",label:i("predict.setup.step2"),desc:i("predict.setup.step2Desc"),status:h}],k=()=>{g?t():v();},S=i(g?"predict.setup.done":"predict.setup.setupButton");return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:e,onOpenChange:b=>{b||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.setup.modalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5 space-y-4",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 text-left",children:i("predict.setup.modalDescription")}),jsxRuntime.jsx("div",{className:"space-y-2.5",children:x.map((b,y)=>jsxRuntime.jsxs("div",{className:"flex gap-3 rounded-[10px] border border-zinc-700/50 bg-zinc-800/50 px-3 py-3",children:[jsxRuntime.jsx(Gv,{index:y+1,status:b.status}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-zinc-200",children:b.label}),jsxRuntime.jsx("span",{className:`text-[11px] leading-none ${b.status==="done"?"text-[#c7ff2e]":b.status==="running"?"text-[#c7ff2e]/70":"text-zinc-500"}`,children:b.status==="done"?i("predict.setup.stepComplete"):b.status==="running"?i("predict.setup.stepRunning"):i("predict.setup.stepPending")})]}),jsxRuntime.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:b.desc})]})]},b.key))}),c&&jsxRuntime.jsx("div",{className:"rounded-[10px] bg-red-500/10 border border-red-500/20 px-3 py-2",children:jsxRuntime.jsx("p",{className:"text-xs text-red-400",children:c})}),jsxRuntime.jsx("button",{type:"button",onClick:k,disabled:a,className:g?"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:a?jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",className:"opacity-25"}),jsxRuntime.jsx("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",className:"opacity-75"})]}),i("predict.setup.stepRunning")]}):S}),!g&&jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] text-sm text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")})]})]})})})}function Gv({index:e,status:t}){return t==="done"?jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-[#c7ff2e]/15 shrink-0",children:jsxRuntime.jsx("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:"text-[#c7ff2e]",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}):t==="running"?jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-[#c7ff2e]/10 shrink-0",children:jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4 text-[#c7ff2e]",viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",className:"opacity-25"}),jsxRuntime.jsx("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",className:"opacity-75"})]})}):jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-zinc-700/50 text-xs font-bold text-zinc-400 shrink-0",children:e})}
136
- 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,"eventStatsQueryKey",{enumerable:true,get:function(){return reactPredict.eventStatsQueryKey}});Object.defineProperty(exports,"fetchMatchMarketsPage",{enumerable:true,get:function(){return reactPredict.fetchMatchMarketsPage}});Object.defineProperty(exports,"fetchMatchesPage",{enumerable:true,get:function(){return reactPredict.fetchMatchesPage}});Object.defineProperty(exports,"matchMarketsQueryKey",{enumerable:true,get:function(){return reactPredict.matchMarketsQueryKey}});Object.defineProperty(exports,"matchQueryKey",{enumerable:true,get:function(){return reactPredict.matchQueryKey}});Object.defineProperty(exports,"matchesQueryKey",{enumerable:true,get:function(){return reactPredict.matchesQueryKey}});Object.defineProperty(exports,"useBalance",{enumerable:true,get:function(){return reactPredict.useBalance}});Object.defineProperty(exports,"useCancelOrder",{enumerable:true,get:function(){return reactPredict.useCancelOrder}});Object.defineProperty(exports,"useCandlesticks",{enumerable:true,get:function(){return reactPredict.useCandlesticks}});Object.defineProperty(exports,"useDFlowKYC",{enumerable:true,get:function(){return reactPredict.useDFlowKYC}});Object.defineProperty(exports,"useDFlowQuote",{enumerable:true,get:function(){return reactPredict.useDFlowQuote}});Object.defineProperty(exports,"useDFlowSubmit",{enumerable:true,get:function(){return reactPredict.useDFlowSubmit}});Object.defineProperty(exports,"useEvent",{enumerable:true,get:function(){return reactPredict.useEvent}});Object.defineProperty(exports,"useEventStats",{enumerable:true,get:function(){return reactPredict.useEventStats}});Object.defineProperty(exports,"useEvents",{enumerable:true,get:function(){return reactPredict.useEvents}});Object.defineProperty(exports,"useInfiniteEvents",{enumerable:true,get:function(){return reactPredict.useInfiniteEvents}});Object.defineProperty(exports,"useInfiniteMatchMarkets",{enumerable:true,get:function(){return reactPredict.useInfiniteMatchMarkets}});Object.defineProperty(exports,"useInfiniteMatches",{enumerable:true,get:function(){return reactPredict.useInfiniteMatches}});Object.defineProperty(exports,"useInfiniteOrders",{enumerable:true,get:function(){return reactPredict.useInfiniteOrders}});Object.defineProperty(exports,"useInfiniteTrades",{enumerable:true,get:function(){return reactPredict.useInfiniteTrades}});Object.defineProperty(exports,"useMarket",{enumerable:true,get:function(){return reactPredict.useMarket}});Object.defineProperty(exports,"useMarketHistory",{enumerable:true,get:function(){return reactPredict.useMarketHistory}});Object.defineProperty(exports,"useMarketTrades",{enumerable:true,get:function(){return reactPredict.useMarketTrades}});Object.defineProperty(exports,"useMatch",{enumerable:true,get:function(){return reactPredict.useMatch}});Object.defineProperty(exports,"useOrder",{enumerable:true,get:function(){return reactPredict.useOrder}});Object.defineProperty(exports,"useOrderbook",{enumerable:true,get:function(){return reactPredict.useOrderbook}});Object.defineProperty(exports,"useOrders",{enumerable:true,get:function(){return reactPredict.useOrders}});Object.defineProperty(exports,"usePositionValue",{enumerable:true,get:function(){return reactPredict.usePositionValue}});Object.defineProperty(exports,"usePositionValueMulti",{enumerable:true,get:function(){return reactPredict.usePositionValueMulti}});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,"useRedeemPosition",{enumerable:true,get:function(){return reactPredict.useRedeemPosition}});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=ub;exports.CHART_RANGE_PERIOD=cb;exports.CHART_RANGE_SAMPLE_INTERVAL=db;exports.CandlestickPeriod=Bn;exports.CategoriesSkeleton=Zv;exports.CategoriesUI=Xi;exports.CategoriesWidget=ts;exports.ChartRange=le;exports.CommentItemUI=Pi;exports.DEFAULT_CHART_RANGE=Hn;exports.DEFAULT_FILTER_STATE=cn;exports.DEFAULT_PAGE_SIZE=sn;exports.DEFAULT_PRICE_HISTORY_INTERVAL=gb;exports.EventCommentsWidget=qg;exports.EventDetailPage=z2;exports.EventDetailSkeleton=vn;exports.EventDetailUI=rl;exports.EventDetailWidget=nl;exports.EventItem=Vs;exports.EventMarketDepthChartUI=Aa;exports.EventMarketDetailWidget=$a;exports.EventPriceChart=Ga;exports.EventsFilterUI=Ps;exports.EventsHero=dy;exports.EventsPage=iy;exports.EventsPageSkeleton=Rx;exports.EventsSkeleton=Yo;exports.EventsToolbarUI=Es;exports.EventsUI=Qs;exports.EventsWidget=Js;exports.KycModal=jn;exports.MAX_PRICE_HISTORY_MARKETS=zo;exports.MatchGroupCard=UP;exports.MatchMarketCard=Xl;exports.MatchesFilterBar=Kl;exports.MatchesHero=jl;exports.MatchesPage=DP;exports.MatchesStatsBar=qP;exports.MatchesWidget=rc;exports.ORDER_MAX_PRICE=fb;exports.ORDER_MIN_PRICE=mb;exports.ORDER_MIN_QUANTITY=zn;exports.ORDER_MIN_USDC=Wn;exports.ORDER_PRICE_STEP=pb;exports.POLYMARKET_BUILDER_TAKER_FEE_BPS=ed;exports.POLYMARKET_SPORTS_TAKER_FEE_BPS=td;exports.PREDICT_REDEEM_MODAL_ID=Ip;exports.PREDICT_SEARCH_MODAL_ID=Ei;exports.PREDICT_SELL_MODAL_ID=li;exports.PREDICT_TRADE_MODAL_ID=ln;exports.PRICE_HISTORY_SAMPLE_INTERVAL=hb;exports.PredictRedeemModal=la;exports.PredictSearchModal=HS;exports.PredictSellModal=Pa;exports.PredictTradeModal=Yn;exports.PredictWalletProvider=Qc;exports.PriceHistoryInterval=zr;exports.ProfilePage=Uv;exports.RedeemFormWidget=sa;exports.SORT_PRESETS=Ts;exports.STATIC_CATEGORIES=Bo;exports.SearchEventsButton=qS;exports.SearchHistoryUI=xl;exports.SearchHistoryWidget=yl;exports.SearchInputUI=kl;exports.SearchResultItemUI=Sl;exports.SearchResultListWidget=Ml;exports.SearchWidget=_l;exports.SellFormUI=ka;exports.SellFormWidget=no;exports.SetupModal=Yw;exports.SimilarEventCard=hg;exports.SimilarEventsSection=al;exports.SourceBadge=f2;exports.SpreadIndicator=JP;exports.TradeFormSkeleton=Ea;exports.TradeFormUI=ks;exports.TradeFormWidget=qn;exports.UserActivitySection=Ca;exports.computeMaxBuyAmount=ss;exports.countActiveFilters=qo;exports.createTradeResultToast=Ur;exports.estimatePolymarketBuyFee=as;exports.estimatePolymarketSellFee=ls;exports.fireCelebration=cs;exports.floorToDecimals=be;exports.formatKMB=bn;exports.formatShares=kr;exports.getSourceMeta=ur;exports.parsePolymarketError=Kn;exports.polymarketFeeFactor=Zc;exports.resolveExpiration=Un;exports.resolvePolymarketDisplayFeeRateBps=is;exports.roundToTickSize=$n;exports.useEventDetail=G2;exports.useEventsInfinite=_s;exports.usePredictSearchHistory=yo;exports.usePredictWallet=yr;exports.useSearchResultListScript=Pl;exports.useSearchScript=Rl;exports.useSellForm=ma;exports.useTradeForm=ms;//# sourceMappingURL=index.js.map
135
+ `}),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",zIndex:0,overflow:"hidden"},children:[l&&jsxRuntime.jsx("img",{src:l,alt:"","aria-hidden":"true",style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",objectPosition:"center center",opacity:.3,mixBlendMode:"lighten",maskImage:"linear-gradient(to bottom, black 50%, transparent 100%)",WebkitMaskImage:"linear-gradient(to bottom, black 50%, transparent 100%)"}}),jsxRuntime.jsx("div",{style:{position:"absolute",inset:0,opacity:.025,backgroundImage:"radial-gradient(circle at 1px 1px, rgb(255 255 255) 1px, transparent 0)",backgroundSize:"20px 20px"}})]}),jsxRuntime.jsx("style",{children:".matches-hero-wrap{padding:40px 16px 32px}@media(min-width:640px){.matches-hero-wrap{padding:48px 24px 40px}}@media(min-width:1024px){.matches-hero-wrap{padding:52px 32px 44px}}"}),jsxRuntime.jsx("div",{className:"match-fade-in matches-hero-wrap",style:{position:"relative",zIndex:2,maxWidth:1152,margin:"0 auto"},children:jsxRuntime.jsx(uc,{stats:v})})]}),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(199,255,46,0.15), rgba(23,201,100,0.15))",border:"1px solid rgba(199,255,46,0.15)",flexShrink:0},children:jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:16,height:16,color:"#c7ff2e"},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:u(Pv[p])}),v&&v.activePairs>0&&jsxRuntime.jsx("p",{className:"hidden sm:block",style:{fontSize:11,color:"#71717a",margin:0},children:u("predict.matches.pairsFound",{count:v.activePairs})})]})]}),jsxRuntime.jsx(cc,{sortBy:p,onSortChange:x,sortAsc:g,onSortAscChange:k,minVolume:m,onMinVolumeChange:h,onRefresh:S})]})]}),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.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:16,padding:"8px 12px",borderRadius:8,border:"1px solid rgba(39,39,42,0.4)",background:"rgba(24,24,27,0.25)"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,color:"#52525b",flexShrink:0},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("p",{style:{fontSize:11,color:"#52525b",lineHeight:1.5,margin:0},children:[jsxRuntime.jsx("span",{style:{color:"#71717a",fontWeight:500},children:u("predict.matches.experimentalFeature")})," \u2014 ",u("predict.matches.disclaimer")]})]}),jsxRuntime.jsx(Sc,{ref:y,sortBy:p,sortAsc:g,minVolume:m,onSelectMatch:e,getMatchHref:t,onSelectLeg:r,getLegHref:n,onHover:o,onSelect:i,getMarketHref:s,LinkComponent:a,onStatsChange:b})]}),jsxRuntime.jsx(Nv,{stats:v})]})}function Qi(e){return e==null?"-":utils$1.formatAmountInUsd(e)}var Ev={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"}},Tv={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 Rv(e){return Ev[e]??Tv}function Lv(e){if(!e.matched_markets?.length)return null;let t=null,r=-1;for(let n of e.matched_markets){let o=n.spread??0;o>r&&(r=o,t=n);}return t}function _v(e,t){let r=e.entries.find(a=>a.source===(t?.source_a??e.entries[0]?.source)),n=e.entries.find(a=>a.source===(t?.source_b??e.entries[1]?.source)),o=a=>{if(!a?.outcomes?.[0])return {name:null,price:null};let l=a.outcomes[0];return {name:l.label||null,price:l.best_ask??l.price??null}},i=o(t?.market_a),s=o(t?.market_b);return [{source:t?.source_a??r?.source??"unknown",outcomeName:i.name,yesPrice:i.price,volume:r?.event?.volume??null,event:r?.event},{source:t?.source_b??n?.source??"unknown",outcomeName:s.name,yesPrice:s.price,volume:n?.event?.volume??null,event:n?.event}]}function Aw({group:e,onSelectEntry:t,getEventHref:r,LinkComponent:n}){let {t:o}=i18n.useTranslation(),i=react.useMemo(()=>Lv(e),[e]),s=e.max_spread!=null?e.max_spread*100:null,[a,l]=react.useMemo(()=>_v(e,i),[e,i]),u=s!=null&&s>=3;a.yesPrice!=null&&l.yesPrice!=null?a.source==="kalshi"?a.yesPrice>l.yesPrice:l.yesPrice>a.yesPrice:false;let c=a.yesPrice!=null&&l.yesPrice!=null?a.yesPrice<=l.yesPrice?a:l:null,g=c?rn(c.source):null,d=u?"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:m=>{let h=m.currentTarget;h.style.borderColor="rgba(63,63,70,0.6)",h.style.boxShadow="0 10px 15px -3px rgba(0,0,0,0.2)";},onMouseLeave:m=>{let h=m.currentTarget;h.style.borderColor="rgba(39,39,42,0.6)",h.style.boxShadow="none";},children:[s!=null&&jsxRuntime.jsxs("span",{style:{position:"absolute",top:12,right:12,zIndex:10,display:"inline-flex",alignItems:"center",gap:4,borderRadius:10,padding:"4px 10px",fontSize:12,fontWeight:600,border:`1px solid ${u?"rgba(255,185,0,0.3)":s>=2?"rgba(166,132,255,0.3)":"rgba(156,163,175,0.3)"}`,background:u?"rgba(255,185,0,0.15)":s>=2?"rgba(166,132,255,0.15)":"rgba(156,163,175,0.12)",color:u?"#ffb900":s>=2?"#a684ff":"#9ca3af"},children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),s.toFixed(1),"%"]}),jsxRuntime.jsxs("div",{style:{padding:16},children:[jsxRuntime.jsx("h3",{style:{fontSize:14,fontWeight:600,lineHeight:1.375,letterSpacing:"-0.28px",color:"#f4f4f5",overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",paddingRight:80,margin:"0 0 16px"},children:e.title}),jsxRuntime.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:12},children:[jsxRuntime.jsx(Nc,{data:a,isCheaper:c===a,onSelect:t,getEventHref:r,LinkComponent:n}),jsxRuntime.jsx(Nc,{data:l,isCheaper:c===l,onSelect:t,getEventHref:r,LinkComponent:n})]}),c&&g&&s!=null&&jsxRuntime.jsxs("div",{style:{marginTop:12,padding:"8px 12px",borderRadius:10,display:"flex",alignItems:"center",gap:8,cursor:"pointer",transition:"all 0.15s",border:`1px solid ${d==="amber"?"rgba(255,185,0,0.15)":"rgba(166,132,255,0.15)"}`,background:d==="amber"?"rgba(255,185,0,0.05)":"rgba(166,132,255,0.05)"},onClick:()=>c.event&&t?.(c.event),children:[jsxRuntime.jsx("svg",{viewBox:"0 0 24 24",style:{width:14,height:14,flexShrink:0,color:d==="amber"?"#ffb900":"#a684ff"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:jsxRuntime.jsx("path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"})}),jsxRuntime.jsx("span",{style:{fontSize:11,fontWeight:500,color:d==="amber"?"rgba(255,185,0,0.9)":"rgba(166,132,255,0.9)"},children:o("predict.matches.buyEdge",{platform:c.source.charAt(0).toUpperCase()+c.source.slice(1),spread:s.toFixed(1)})}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12,marginLeft:"auto",color:d==="amber"?"rgba(255,185,0,0.5)":"rgba(166,132,255,0.5)"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M5 12h14"}),jsxRuntime.jsx("path",{d:"m12 5 7 7-7 7"})]})]})]}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",borderTop:"1px solid rgba(39,39,42,0.5)",background:"rgba(39,39,42,0.2)",padding:"10px 16px"},children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,fontSize:10,color:"#71717a"},children:[jsxRuntime.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",style:{width:12,height:12},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M3 3v16a2 2 0 0 0 2 2h16"}),jsxRuntime.jsx("path",{d:"M18 17V9"}),jsxRuntime.jsx("path",{d:"M13 17V5"}),jsxRuntime.jsx("path",{d:"M8 17v-3"})]}),Qi(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"})}),Qi(e.combined_volume_24h)," ",o("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),"%"," ",o("predict.matches.match")]})]})]})}function Nc({data:e,isCheaper:t,onSelect:r,getEventHref:n,LinkComponent:o}){let{t:i}=i18n.useTranslation(),s=rn(e.source),a=Rv(e.source),l=e.event?n?.(e.event):void 0,u=jsxRuntime.jsxs("div",{style:{borderRadius:14,border:`1px solid ${a.border}`,background:a.bg,padding:12,cursor:l||r?"pointer":void 0,transition:"border-color 0.15s"},onMouseEnter:p=>{p.currentTarget.style.borderColor=a.hoverBorder;},onMouseLeave:p=>{p.currentTarget.style.borderColor=a.border;},onClick:()=>e.event&&r?.(e.event),children:[jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:8},children:[s.icon,jsxRuntime.jsx("span",{style:{fontSize:10,fontWeight:600,letterSpacing:"0.05em",color:a.text,textTransform:"uppercase"},children:s.label}),jsxRuntime.jsxs("svg",{viewBox:"0 0 24 24",className:"opacity-0 group-hover:opacity-100 transition-opacity",style:{width:10,height:10,color:"#52525b",marginLeft:"auto"},fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("path",{d:"M7 7h10v10"}),jsxRuntime.jsx("path",{d:"M7 17 17 7"})]})]}),e.outcomeName&&jsxRuntime.jsx("div",{style:{fontSize:10,color:"#71717a",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",marginBottom:8},children:e.outcomeName}),jsxRuntime.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[jsxRuntime.jsx("span",{style:{fontSize:20,fontWeight:700,fontVariantNumeric:"tabular-nums",color:t?a.priceActiveColor:a.priceColor},children:e.yesPrice!=null?(e.yesPrice*100).toFixed(1):"-"}),jsxRuntime.jsx("span",{style:{fontSize:10,color:"#71717a"},children:i("predict.matches.centsYes")})]}),jsxRuntime.jsxs("div",{style:{fontSize:10,color:"#52525b",marginTop:6},children:[Qi(e.volume)," ",i("predict.matches.volume")]})]});return l&&o?jsxRuntime.jsx(o,{href:l,className:"block",children:u}):u}function Av(e){return utils$1.formatAmountInUsd(e)}function Uw({matches:e,total:t}){let{t:r}=i18n.useTranslation(),n=react.useMemo(()=>{let o=0,i=0,s=new Set;for(let a of e){a.max_spread!=null&&a.max_spread>o&&(o=a.max_spread),a.combined_volume!=null&&(i+=a.combined_volume);for(let l of a.entries)s.add(typeof l.source=="string"?l.source:"");}return {count:t??e.length,maxSpread:o,totalVolume:i,platformCount:s.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(Ho,{label:r("predict.matches.stats.matchedMarkets"),value:n.count.toLocaleString()}),jsxRuntime.jsx(Xi,{}),jsxRuntime.jsx(Ho,{label:r("predict.matches.stats.totalVolume"),value:Av(n.totalVolume)}),jsxRuntime.jsx(Xi,{}),jsxRuntime.jsx(Ho,{label:r("predict.matches.stats.highestSpread"),value:`${(n.maxSpread*100).toFixed(1)}\xA2`,valueClassName:"text-green-400"}),jsxRuntime.jsx(Xi,{}),jsxRuntime.jsx(Ho,{label:r("predict.matches.stats.platforms"),value:String(n.platformCount)})]})}function Ho({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 Xi(){return jsxRuntime.jsx("span",{className:"hidden text-neutral-700 sm:inline",children:"|"})}function Ec(e){return `${(e*100).toFixed(1)}\xA2`}function Fv(e){return e>=.05?"text-green-400":e>=.02?"text-yellow-400":"text-neutral-400"}function jw({spread:e,arbProfit:t,className:r}){if(e==null)return null;let n=t!=null&&t>0;return jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center gap-x-2",r),children:[jsxRuntime.jsx("span",{className:ui$1.cn("text-sm font-semibold",Fv(e)),children:Ec(e)}),n&&jsxRuntime.jsxs("span",{className:"text-xs text-green-500/80",children:["+",Ec(t)]})]})}var On=10,$v=64,_c=40,zo=48;function Oc({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),[o,i]=react.useState(1),{data:s,isLoading:a,fetchNextPage:l,hasNextPage:u,isFetchingNextPage:p}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:50}),{data:c,isLoading:g,fetchNextPage:d,hasNextPage:m,isFetchingNextPage:h}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:50}),v=a||g,f=p||h,y=u||m,x=react.useMemo(()=>{let D=[];return s?.pages&&D.push(...s.pages.flatMap(j=>j.items)),c?.pages&&D.push(...c.pages.flatMap(j=>j.items)),D.sort((j,L)=>(L.timestamp??0)-(j.timestamp??0)),D},[s,c]),k=Math.max(1,Math.ceil(x.length/On)+(y?1:0)),b=(o-1)*On,S=x.slice(b,b+On),M=react.useCallback(()=>{i(D=>Math.max(1,D-1));},[]),B=react.useCallback(async()=>{o*On>=x.length&&y&&(u&&await l(),m&&await d()),i(j=>j+1);},[o,x.length,y,u,m,l,d]),N=o>1,C=o*On<x.length||y;if(v)return jsxRuntime.jsx(Yv,{height:r});if(x.length===0&&!y)return jsxRuntime.jsx(qv,{message:n("predict.profile.noHistory"),height:r});let I=r-_c-zo;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:_c},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:n("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.status")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.price")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:n("predict.profile.depositWithdraw")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.pnl")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.fee")}),jsxRuntime.jsx("div",{className:"w-10 shrink-0"})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:I},children:[S.map((D,j)=>jsxRuntime.jsx(Kv,{trade:D},D.id??`${b+j}`)),f&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})]}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:zo},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!N,onClick:M,className:ui$1.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:["\u2190 ",n("predict.profile.previous")]}),Array.from({length:Math.min(k,5)},(D,j)=>{let L=j+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>i(L),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",L===o?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:L},L)}),jsxRuntime.jsxs("button",{type:"button",disabled:!C,onClick:B,className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",C?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[n("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-zo},children:S.map((D,j)=>jsxRuntime.jsx(Vv,{trade:D},D.id??`m-${b+j}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:zo},children:[jsxRuntime.jsx("button",{type:"button",disabled:!N,onClick:M,className:ui$1.cn("text-sm cursor-pointer",N?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:o}),jsxRuntime.jsx("button",{type:"button",disabled:!C,onClick:B,className:ui$1.cn("text-sm cursor-pointer",C?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function Kv({trade:e}){let{t}=i18n.useTranslation(),r=e.type==="REDEEM",n=e.side?.toUpperCase()==="BUY",o=e.price??0,i=e.usd_size??0,s=Ic(e.type,t),a=r||n,l=a?"+":"-",u=a?"text-success":"text-foreground",p=e.event?.title??e.market?.question??"\u2014",c=e.event?.image_url,g=e.outcome??"",d=Bc(e.timestamp),m=Dc(e),h=jv(e),v=Gv(e);return jsxRuntime.jsxs("div",{className:"flex items-center border-b border-border/50 hover:bg-content2/40 transition-colors text-sm",style:{height:$v},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:[c&&jsxRuntime.jsx("img",{src:c,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:[g&&jsxRuntime.jsx("span",{className:"mr-1",children:g}),jsxRuntime.jsx("span",{children:d})]})]})]})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:jsxRuntime.jsx("span",{className:ui$1.cn("text-sm font-medium",r?"text-primary":n?"text-success":"text-danger"),children:t(r?"predict.profile.redeem":n?"predict.profile.buy":"predict.profile.sell")})}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-sm text-foreground",children:s}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:Fc(o)}),jsxRuntime.jsx("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono",u),children:i>0?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[l,"$",i.toFixed(2)]}):"\u2014"}),jsxRuntime.jsx("div",{className:ui$1.cn("flex-1 pr-2 text-right font-mono",h!==null?h>=0?"text-success":"text-danger":"text-neutral"),children:h!==null?`${h>=0?"+":"-"}$${Math.abs(h).toFixed(2)}`:"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-neutral",children:v!==null?`$${v.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(Ac,{})})})]})}function Vv({trade:e}){let{t}=i18n.useTranslation(),r=e.type==="REDEEM",n=e.side?.toUpperCase()==="BUY",o=e.price??0,i=e.usd_size??0,s=Ic(e.type,t),a=e.event?.title??e.market?.question??"\u2014",l=Bc(e.timestamp),u=Dc(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:a})]}),jsxRuntime.jsx("span",{className:"text-[11px] text-neutral whitespace-nowrap",children:l})]}),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$1.cn("font-medium",r?"text-primary":n?"text-success":"text-danger"),children:t(r?"predict.profile.redeem":n?"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:s})]}),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:Fc(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:i>0?`$${i.toFixed(2)}`:"\u2014"})]}),u&&jsxRuntime.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"ml-auto text-neutral hover:text-foreground transition-colors",children:jsxRuntime.jsx(Ac,{})})]})]})}function Ic(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 Dc(e){if(e.tx_hash)return e.source==="polymarket"?`https://polygonscan.com/tx/${e.tx_hash}`:`https://solscan.io/tx/${e.tx_hash}`}function jv(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 n=parseFloat(r);if(!Number.isNaN(n))return n}}return e.type==="REDEEM"&&e.usd_size!=null?e.usd_size:null}function Gv(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 n=parseFloat(r);if(!Number.isNaN(n))return n}}return null}function Ac(){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 qv({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function Yv({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$1.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function Fc(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function Bc(e){let t=new Date(e*1e3),r=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),o=t.getDate().toString().padStart(2,"0"),i=(t.getMonth()+1).toString().padStart(2,"0"),s=t.getFullYear(),a=t.getTimezoneOffset(),l=a<=0?"+":"-",u=String(Math.abs(Math.floor(a/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${s} (${l}${u})`}var In=10,rb=64,zc=40,Wo=48;function Uc({solanaAddress:e,evmAddress:t,listHeight:r}){let{t:n}=i18n.useTranslation(),o=reactPredict.useCancelOrder(),[i,s]=react.useState(1),{data:a,isLoading:l,fetchNextPage:u,hasNextPage:p,isFetchingNextPage:c}=reactPredict.useInfiniteOrders({source:"kalshi",wallet_address:e??""}),{data:g,isLoading:d,fetchNextPage:m,hasNextPage:h,isFetchingNextPage:v}=reactPredict.useInfiniteOrders({source:"polymarket",wallet_address:t??""}),f=l||d,y=c||v,x=p||h,k=react.useMemo(()=>{let L=[],U=new Set(["live","open","submitted","pending"]);return a?.pages&&L.push(...a.pages.flatMap(H=>H.items).filter(H=>U.has(H.status))),g?.pages&&L.push(...g.pages.flatMap(H=>H.items).filter(H=>U.has(H.status))),L},[a,g]),b=react.useCallback(L=>{o.mutate({source:L.source,id:L.id});},[o]),S=Math.max(1,Math.ceil(k.length/In)+(x?1:0)),M=(i-1)*In,B=k.slice(M,M+In),N=react.useCallback(()=>{s(L=>Math.max(1,L-1));},[]),C=react.useCallback(async()=>{i*In>=k.length&&x&&(p&&await u(),h&&await m()),s(U=>U+1);},[i,k.length,x,p,h,u,m]),I=i>1,D=i*In<k.length||x;if(f)return jsxRuntime.jsx(sb,{height:r});if(k.length===0&&!x)return jsxRuntime.jsx(ib,{message:n("predict.profile.noOrders"),height:r});let j=r-zc-Wo;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:zc},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:n("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.action")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2",children:n("predict.profile.type")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.fillPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:n("predict.profile.cost")})]}),jsxRuntime.jsxs("div",{className:"hidden lg:block overflow-y-auto",style:{height:j},children:[B.map(L=>jsxRuntime.jsx(nb,{order:L,onCancel:b},L.id)),y&&jsxRuntime.jsx("div",{className:"flex justify-center items-center py-4",children:jsxRuntime.jsx(ui$1.Spinner,{size:"sm"})})]}),jsxRuntime.jsx(Wc,{className:"hidden lg:flex",currentPage:i,totalPages:S,canGoPrev:I,canGoNext:D,onPrev:N,onNext:C,onPage:s,t:n}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Wo},children:B.map(L=>jsxRuntime.jsx(ob,{order:L,onCancel:b},L.id))}),jsxRuntime.jsx(Wc,{className:"lg:hidden",currentPage:i,totalPages:S,canGoPrev:I,canGoNext:D,onPrev:N,onNext:C,onPage:s,t:n,compact:true})]})}function nb({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),n=e.side==="BUY",o=e.price?parseFloat(e.price):0,i=e.in_amount?parseFloat(e.in_amount):o*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:rb},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$1.cn("text-sm font-medium",n?"text-success":"text-danger"),children:r(n?"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:o>0?$c(o):"\u2014"}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:i>0?`$${i.toFixed(2)}`:"\u2014"})]})}function ob({order:e,onCancel:t}){let{t:r}=i18n.useTranslation(),n=e.side==="BUY",o=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$1.cn("text-xs font-medium px-1.5 py-0.5 rounded",n?"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:o>0?$c(o):"\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 Wc({className:e,currentPage:t,totalPages:r,canGoPrev:n,canGoNext:o,onPrev:i,onNext:s,onPage:a,t:l,compact:u}){return u?jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-3 shrink-0",e),style:{height:Wo},children:[jsxRuntime.jsx("button",{type:"button",disabled:!n,onClick:i,className:ui$1.cn("text-sm cursor-pointer",n?"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:!o,onClick:s,className:ui$1.cn("text-sm cursor-pointer",o?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]}):jsxRuntime.jsxs("div",{className:ui$1.cn("flex items-center justify-center gap-2 shrink-0",e),style:{height:Wo},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!n,onClick:i,className:ui$1.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:["\u2190 ",l("predict.profile.previous")]}),Array.from({length:Math.min(r,5)},(p,c)=>{let g=c+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>a(g),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",g===t?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:g},g)}),jsxRuntime.jsxs("button",{type:"button",disabled:!o,onClick:s,className:ui$1.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:[l("predict.profile.next")," \u2192"]})]})}function ib({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function sb({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$1.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function $c(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}var rs=10,db=64,Kc=40,Uo=48;function Vc({positions:e,isLoading:t,listHeight:r,onClosePosition:n,onEventClick:o}){let{t:i}=i18n.useTranslation(),[s,a]=react.useState(1),l=react.useCallback(()=>{for(let h of e)n?.(h);},[e,n]);if(t)return jsxRuntime.jsx(fb,{height:r});if(e.length===0)return jsxRuntime.jsx(mb,{message:i("predict.profile.noPositions"),height:r});let u=Math.max(1,Math.ceil(e.length/rs)),p=(s-1)*rs,c=e.slice(p,p+rs),g=s>1,d=s<u,m=r-Kc-Uo;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:Kc},children:[jsxRuntime.jsx("div",{className:"flex-[3] min-w-0 pr-2",children:i("predict.profile.event")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.totalSize")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.value")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.avgPrice")}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.markPrice")}),jsxRuntime.jsxs("div",{className:"flex-[1.5] pr-2 text-right",children:[jsxRuntime.jsx("span",{children:i("predict.profile.pnl")}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-1 opacity-60",children:["(",i("predict.profile.pnlExcludeFees"),")"]})]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right",children:i("predict.profile.payoutIfRight")}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right",children:i("predict.profile.estSettlement")}),jsxRuntime.jsx("div",{className:"w-20 shrink-0 text-right",children:n&&e.length>0&&jsxRuntime.jsx("button",{type:"button",onClick:l,className:"text-xs text-primary hover:text-primary/80 cursor-pointer transition-colors",children:i("predict.profile.closeAll")})})]}),jsxRuntime.jsx("div",{className:"hidden lg:block overflow-y-auto",style:{height:m},children:c.map((h,v)=>jsxRuntime.jsx(ub,{position:h,onClosePosition:n,onEventClick:o},`${h.source}-${h.market?.slug??p+v}`))}),jsxRuntime.jsxs("div",{className:"hidden lg:flex items-center justify-center gap-2 shrink-0",style:{height:Uo},children:[jsxRuntime.jsxs("button",{type:"button",disabled:!g,onClick:()=>a(h=>Math.max(1,h-1)),className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",g?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:["\u2190 ",i("predict.profile.previous")]}),Array.from({length:Math.min(u,5)},(h,v)=>{let f=v+1;return jsxRuntime.jsx("button",{type:"button",onClick:()=>a(f),className:ui$1.cn("w-8 h-8 rounded text-sm transition-colors cursor-pointer",f===s?"bg-foreground/10 text-foreground font-medium":"text-neutral hover:text-foreground"),children:f},f)}),jsxRuntime.jsxs("button",{type:"button",disabled:!d,onClick:()=>a(h=>h+1),className:ui$1.cn("text-sm transition-colors cursor-pointer flex items-center gap-1",d?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:[i("predict.profile.next")," \u2192"]})]}),jsxRuntime.jsx("div",{className:"lg:hidden flex flex-col gap-2 overflow-y-auto py-2",style:{height:r-Uo},children:c.map((h,v)=>jsxRuntime.jsx(pb,{position:h,onClose:n,onEventClick:o},`${h.source}-${h.market?.slug??`m-${p+v}`}`))}),jsxRuntime.jsxs("div",{className:"lg:hidden flex items-center justify-center gap-3 shrink-0",style:{height:Uo},children:[jsxRuntime.jsx("button",{type:"button",disabled:!g,onClick:()=>a(h=>Math.max(1,h-1)),className:ui$1.cn("text-sm cursor-pointer",g?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2190"}),jsxRuntime.jsx("span",{className:"text-sm text-foreground tabular-nums",children:s}),jsxRuntime.jsx("button",{type:"button",disabled:!d,onClick:()=>a(h=>h+1),className:ui$1.cn("text-sm cursor-pointer",d?"text-neutral hover:text-foreground":"text-neutral/40 cursor-not-allowed"),children:"\u2192"})]})]})}function ub({position:e,onClosePosition:t,onEventClick:r}){let{t:n}=i18n.useTranslation(),o=e.pnl??0,i=e.pnl_percent??0,s=e.avg_price??0,a=e.current_price??0,l=e.current_value??e.size*a,u=e.size,p=o>0?"text-success":o<0?"text-danger":"text-foreground",c=o>0?"+":"",g=e.event?.title??e.market?.question??"\u2014",d=e.event?.image_url,m=e.side,h=e.market?.outcomes?.[0]?.label??"",v=e.market?.end_at?gb(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:db},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:[d&&jsxRuntime.jsx("img",{src:d,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0"}),jsxRuntime.jsxs("div",{className:"flex flex-col gap-y-0.5 min-w-0",children:[jsxRuntime.jsx("span",{className:"text-foreground truncate font-medium text-sm",children:g}),jsxRuntime.jsxs("span",{className:"text-[11px] text-neutral",children:[jsxRuntime.jsx("span",{className:ui$1.cn("font-medium",m.toLowerCase()==="yes"?"text-success":"text-danger"),children:m}),h&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{className:"mx-1",children:"\xB7"}),jsxRuntime.jsx("span",{children:h})]})]})]})]})}),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:n("predict.profile.contracts",{count:kr(e.size)})})]})}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",(e.size*s).toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:ns(s)}),jsxRuntime.jsx("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:ns(a)}),jsxRuntime.jsxs("div",{className:ui$1.cn("flex-[1.5] pr-2 text-right font-mono",p),children:[jsxRuntime.jsxs("span",{children:[c,"$",Math.abs(o).toFixed(2)]}),jsxRuntime.jsxs("span",{className:"text-[10px] ml-0.5 opacity-70",children:["(",c,i.toFixed(2),"%)"]})]}),jsxRuntime.jsxs("div",{className:"flex-1 pr-2 text-right font-mono text-foreground",children:["$",u.toFixed(2)]}),jsxRuntime.jsx("div",{className:"flex-[1.5] pr-2 text-right text-neutral whitespace-nowrap text-xs",children:v}),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"}),n("predict.profile.close")]})})]})}function pb({position:e,onClose:t,onEventClick:r}){let{t:n}=i18n.useTranslation(),o=e.pnl??0,i=e.pnl_percent??0,s=e.current_price??0,a=o>0?"text-success":o<0?"text-danger":"text-foreground",l=o>0?"+":"",u=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:u})]}),jsxRuntime.jsx("span",{className:ui$1.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($o,{label:n("predict.profile.totalSize"),value:kr(e.size)}),jsxRuntime.jsx($o,{label:n("predict.profile.markPrice"),value:ns(s)}),jsxRuntime.jsx($o,{label:n("predict.profile.pnl"),value:`${l}$${Math.abs(o).toFixed(2)} (${l}${i.toFixed(1)}%)`,className:a}),jsxRuntime.jsx($o,{label:n("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:n("predict.profile.close")})})]})}function $o({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$1.cn("font-mono text-foreground",r),children:t})]})}function mb({message:e,height:t}){return jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral",style:{height:t},children:e})}function fb({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$1.Skeleton,{className:"h-12 w-full rounded-md"},r))})}function ns(e){let t=e*100;return t<1&&t>0?"< 1\xA2":`${t.toFixed(t%1===0?0:1)}\xA2`}function gb(e){try{let t=new Date(e),r=t.getHours().toString().padStart(2,"0"),n=t.getMinutes().toString().padStart(2,"0"),o=t.getDate().toString().padStart(2,"0"),i=(t.getMonth()+1).toString().padStart(2,"0"),s=t.getFullYear(),a=t.getTimezoneOffset(),l=a<=0?"+":"-",u=String(Math.abs(Math.floor(a/60))).padStart(2,"0");return `${r}:${n} ${o}/${i}/${s} (${l}${u})`}catch{return "\u2014"}}function Gc({positions:e,trades:t,isLoading:r,positionsValue:n,positionsValueLoading:o}){let{t:i}=i18n.useTranslation(),s=react.useMemo(()=>{let u=0,p=0;for(let h of e)u+=h.realized_pnl??0,p+=h.current_value??h.size*(h.current_price??0);let c=0,g=0,d=0;for(let h of t)c+=h.usd_size??0,h.type==="REDEEM"&&(d++,(h.usd_size??0)>0&&g++);let m=d>0?`${g} / ${d}`:"0 / 0";return {realizedPnl:u,positionsValue:n??p,volume:c,winRateStr:m}},[e,n,t]),a=s.realizedPnl>0?"text-success":s.realizedPnl<0?"text-danger":"text-foreground",l=s.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:i("predict.profile.realizedPnl")}),r?jsxRuntime.jsx(ui$1.Skeleton,{className:"h-14 w-48 rounded-md"}):jsxRuntime.jsxs("span",{className:ui$1.cn("text-5xl font-bold tabular-nums",a),children:[l,"$",Math.abs(s.realizedPnl).toFixed(2)]})]}),jsxRuntime.jsxs("div",{className:"flex items-end gap-8 sm:gap-10",children:[jsxRuntime.jsx(is,{label:i("predict.profile.winRate"),value:s.winRateStr,isLoading:r}),jsxRuntime.jsx(is,{label:i("predict.profile.positions"),value:`$${s.positionsValue.toFixed(2)}`,isLoading:o??r}),jsxRuntime.jsx(is,{label:i("predict.profile.volume"),value:`$${s.volume.toFixed(2)}`,isLoading:r})]})]})}function is({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$1.Skeleton,{className:"h-6 w-14 rounded-md"}):jsxRuntime.jsx("span",{className:"text-base font-semibold tabular-nums text-foreground",children:t})]})}var as=600;function wb({solanaAddress:e,evmAddress:t,onClosePosition:r,onEventClick:n}){let{t:o}=i18n.useTranslation(),[i,s]=react.useState("positions"),a=!!(e||t),{data:l,isLoading:u}=reactPredict.usePositions({source:"kalshi",user:e??""}),{data:p,isLoading:c}=reactPredict.usePositions({source:"polymarket",user:t??""}),g=react.useMemo(()=>{let C=[];return l?.positions&&C.push(...l.positions),p?.positions&&C.push(...p.positions),C},[l,p]),d=u||c,{data:m,isLoading:h}=reactPredict.usePositionValueMulti({kalshi_user:e||void 0,polymarket_user:t||void 0}),v=react.useMemo(()=>{if(!m)return;let C=Number(m.value);return Number.isFinite(C)?C:void 0},[m?.value]),{data:f,isLoading:y}=reactPredict.useInfiniteTrades({source:"kalshi",wallet:e??"",limit:100}),{data:x,isLoading:k}=reactPredict.useInfiniteTrades({source:"polymarket",wallet:t??"",limit:100}),b=react.useMemo(()=>[...f?.pages?.flatMap(I=>I.items)??[],...x?.pages?.flatMap(I=>I.items)??[]],[f,x]),S=d||y||k,M=g.length,N=[{key:"positions",label:M>0?`${o("predict.profile.positionsTab")} (${M})`:o("predict.profile.positionsTab")},{key:"orders",label:o("predict.profile.openOrdersTab")},{key:"history",label:o("predict.profile.historyTab")}];return a?jsxRuntime.jsxs("div",{className:"flex flex-col max-w-[1280px] mx-auto w-full px-4 max-sm:px-2",children:[jsxRuntime.jsx(Gc,{positions:g,trades:b,isLoading:S,positionsValue:v,positionsValueLoading:h}),jsxRuntime.jsx("div",{className:"flex items-center gap-1 border-b border-border",children:N.map(C=>jsxRuntime.jsx("button",{type:"button",onClick:()=>s(C.key),className:ui$1.cn("px-3 py-3 text-base font-normal transition-colors cursor-pointer whitespace-nowrap",i===C.key?"text-foreground border-b-2 border-foreground":"text-neutral hover:text-foreground"),children:C.label},C.key))}),jsxRuntime.jsxs("div",{className:"py-2",children:[i==="positions"&&jsxRuntime.jsx(Vc,{positions:g,isLoading:d,listHeight:as,onClosePosition:r,onEventClick:n}),i==="orders"&&jsxRuntime.jsx(Uc,{solanaAddress:e,evmAddress:t,listHeight:as}),i==="history"&&jsxRuntime.jsx(Oc,{solanaAddress:e,evmAddress:t,listHeight:as})]})]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center text-sm text-neutral py-24 px-4",children:o("predict.profile.connectWallet")})}function $N({isOpen:e,onClose:t,safeDeployed:r,tokenApproved:n,onDeployAndApprove:o}){let{t:i}=i18n.useTranslation(),[s,a]=react.useState(false),[l,u]=react.useState(null),[p,c]=react.useState(false),g=r||p,d=n||p,m=g?"done":s?"running":"pending",h=d?"done":g&&s?"running":"pending",v=g&&d,f=react.useCallback(async()=>{u(null),c(false),a(true);try{await o(),c(!0);}catch(b){u(b instanceof Error?b.message:String(b));}finally{a(false);}},[o]),y=[{key:"step1",label:i("predict.setup.step1"),desc:i("predict.setup.step1Desc"),status:m},{key:"step2",label:i("predict.setup.step2"),desc:i("predict.setup.step2Desc"),status:h}],x=()=>{v?t():f();},k=i(v?"predict.setup.done":"predict.setup.setupButton");return jsxRuntime.jsx(ui$1.StyledModal,{isOpen:e,onOpenChange:b=>{b||t();},size:"md",classNames:{base:"!bg-[#18181b] !rounded-[14px] !border !border-[rgba(39,39,42,1)] !shadow-[0_25px_50px_-12px_rgba(0,0,0,0.5)]",body:"!p-0"},children:jsxRuntime.jsx(ui$1.ModalContent,{children:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex items-center justify-between px-5 pt-5 pb-4",children:[jsxRuntime.jsx("h3",{className:"text-base font-semibold text-white",children:i("predict.setup.modalTitle")}),jsxRuntime.jsx("button",{type:"button",onClick:t,className:"p-1 rounded-[10px] hover:bg-[rgba(39,39,42,0.5)] text-zinc-400 hover:text-white transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:jsxRuntime.jsxs("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:[jsxRuntime.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsxRuntime.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),jsxRuntime.jsxs("div",{className:"px-5 pb-5 space-y-4",children:[jsxRuntime.jsx("p",{className:"text-[13px] text-zinc-400 text-left",children:i("predict.setup.modalDescription")}),jsxRuntime.jsx("div",{className:"space-y-2.5",children:y.map((b,S)=>jsxRuntime.jsxs("div",{className:"flex gap-3 rounded-[10px] border border-zinc-700/50 bg-zinc-800/50 px-3 py-3",children:[jsxRuntime.jsx(Tb,{index:S+1,status:b.status}),jsxRuntime.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[jsxRuntime.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium text-zinc-200",children:b.label}),jsxRuntime.jsx("span",{className:`text-[11px] leading-none ${b.status==="done"?"text-[#c7ff2e]":b.status==="running"?"text-[#c7ff2e]/70":"text-zinc-500"}`,children:b.status==="done"?i("predict.setup.stepComplete"):b.status==="running"?i("predict.setup.stepRunning"):i("predict.setup.stepPending")})]}),jsxRuntime.jsx("p",{className:"text-xs text-zinc-500 mt-1",children:b.desc})]})]},b.key))}),l&&jsxRuntime.jsx("div",{className:"rounded-[10px] bg-red-500/10 border border-red-500/20 px-3 py-2",children:jsxRuntime.jsx("p",{className:"text-xs text-red-400",children:l})}),jsxRuntime.jsx("button",{type:"button",onClick:x,disabled:s,className:v?"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus":"w-full py-3 rounded-[10px] bg-[#c7ff2e] text-zinc-900 text-sm font-semibold hover:bg-[#c7ff2e]/90 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:s?jsxRuntime.jsxs("span",{className:"inline-flex items-center gap-2",children:[jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",className:"opacity-25"}),jsxRuntime.jsx("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",className:"opacity-75"})]}),i("predict.setup.stepRunning")]}):k}),!v&&jsxRuntime.jsx("button",{type:"button",onClick:t,className:"w-full py-2.5 rounded-[10px] text-sm text-zinc-400 hover:text-white hover:bg-[rgba(39,39,42,0.5)] transition-colors cursor-pointer focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",children:i("common.cancel")})]})]})})})}function Tb({index:e,status:t}){return t==="done"?jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-[#c7ff2e]/15 shrink-0",children:jsxRuntime.jsx("svg",{width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2.5,strokeLinecap:"round",strokeLinejoin:"round",className:"text-[#c7ff2e]",children:jsxRuntime.jsx("polyline",{points:"20 6 9 17 4 12"})})}):t==="running"?jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-[#c7ff2e]/10 shrink-0",children:jsxRuntime.jsxs("svg",{className:"animate-spin h-4 w-4 text-[#c7ff2e]",viewBox:"0 0 24 24",fill:"none",children:[jsxRuntime.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",className:"opacity-25"}),jsxRuntime.jsx("path",{d:"M4 12a8 8 0 018-8",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",className:"opacity-75"})]})}):jsxRuntime.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-zinc-700/50 text-xs font-bold text-zinc-400 shrink-0",children:e})}
136
+ 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,"eventStatsQueryKey",{enumerable:true,get:function(){return reactPredict.eventStatsQueryKey}});Object.defineProperty(exports,"fetchMatchMarketsPage",{enumerable:true,get:function(){return reactPredict.fetchMatchMarketsPage}});Object.defineProperty(exports,"fetchMatchesPage",{enumerable:true,get:function(){return reactPredict.fetchMatchesPage}});Object.defineProperty(exports,"matchMarketsQueryKey",{enumerable:true,get:function(){return reactPredict.matchMarketsQueryKey}});Object.defineProperty(exports,"matchQueryKey",{enumerable:true,get:function(){return reactPredict.matchQueryKey}});Object.defineProperty(exports,"matchesQueryKey",{enumerable:true,get:function(){return reactPredict.matchesQueryKey}});Object.defineProperty(exports,"useBalance",{enumerable:true,get:function(){return reactPredict.useBalance}});Object.defineProperty(exports,"useCancelOrder",{enumerable:true,get:function(){return reactPredict.useCancelOrder}});Object.defineProperty(exports,"useCandlesticks",{enumerable:true,get:function(){return reactPredict.useCandlesticks}});Object.defineProperty(exports,"useDFlowKYC",{enumerable:true,get:function(){return reactPredict.useDFlowKYC}});Object.defineProperty(exports,"useDFlowQuote",{enumerable:true,get:function(){return reactPredict.useDFlowQuote}});Object.defineProperty(exports,"useDFlowSubmit",{enumerable:true,get:function(){return reactPredict.useDFlowSubmit}});Object.defineProperty(exports,"useEvent",{enumerable:true,get:function(){return reactPredict.useEvent}});Object.defineProperty(exports,"useEventStats",{enumerable:true,get:function(){return reactPredict.useEventStats}});Object.defineProperty(exports,"useEvents",{enumerable:true,get:function(){return reactPredict.useEvents}});Object.defineProperty(exports,"useInfiniteEvents",{enumerable:true,get:function(){return reactPredict.useInfiniteEvents}});Object.defineProperty(exports,"useInfiniteMatchMarkets",{enumerable:true,get:function(){return reactPredict.useInfiniteMatchMarkets}});Object.defineProperty(exports,"useInfiniteMatches",{enumerable:true,get:function(){return reactPredict.useInfiniteMatches}});Object.defineProperty(exports,"useInfiniteOrders",{enumerable:true,get:function(){return reactPredict.useInfiniteOrders}});Object.defineProperty(exports,"useInfiniteTrades",{enumerable:true,get:function(){return reactPredict.useInfiniteTrades}});Object.defineProperty(exports,"useMarket",{enumerable:true,get:function(){return reactPredict.useMarket}});Object.defineProperty(exports,"useMarketHistory",{enumerable:true,get:function(){return reactPredict.useMarketHistory}});Object.defineProperty(exports,"useMarketTrades",{enumerable:true,get:function(){return reactPredict.useMarketTrades}});Object.defineProperty(exports,"useMatch",{enumerable:true,get:function(){return reactPredict.useMatch}});Object.defineProperty(exports,"useOrder",{enumerable:true,get:function(){return reactPredict.useOrder}});Object.defineProperty(exports,"useOrderbook",{enumerable:true,get:function(){return reactPredict.useOrderbook}});Object.defineProperty(exports,"useOrders",{enumerable:true,get:function(){return reactPredict.useOrders}});Object.defineProperty(exports,"usePositionValue",{enumerable:true,get:function(){return reactPredict.usePositionValue}});Object.defineProperty(exports,"usePositionValueMulti",{enumerable:true,get:function(){return reactPredict.usePositionValueMulti}});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,"useRedeemPosition",{enumerable:true,get:function(){return reactPredict.useRedeemPosition}});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=bs;exports.CHART_RANGE_FIDELITY_MINUTES=Yb;exports.CHART_RANGE_PERIOD=Gb;exports.CHART_RANGE_SAMPLE_INTERVAL=qb;exports.CandlestickPeriod=dn;exports.CategoriesSkeleton=Db;exports.CategoriesUI=ms;exports.CategoriesWidget=vs;exports.ChartRange=$;exports.CommentItemUI=Hi;exports.DEFAULT_CHART_RANGE=Gn;exports.DEFAULT_FILTER_STATE=fn;exports.DEFAULT_PAGE_SIZE=un;exports.DEFAULT_PRICE_HISTORY_INTERVAL=Zb;exports.EventCommentsWidget=w0;exports.EventDetailPage=wk;exports.EventDetailSkeleton=Sn;exports.EventDetailUI=Po;exports.EventDetailWidget=Rk;exports.EventItem=la;exports.EventMarketDepthChartUI=Za;exports.EventMarketDetailWidget=sl;exports.EventPriceChart=fl;exports.EventsFilterUI=zs;exports.EventsHero=qy;exports.EventsPage=$y;exports.EventsPageSkeleton=gy;exports.EventsSkeleton=pi;exports.EventsToolbarUI=js;exports.EventsUI=ma;exports.EventsWidget=ga;exports.KycModal=eo;exports.MAX_PRICE_HISTORY_MARKETS=ni;exports.MatchGroupCard=Aw;exports.MatchMarketCard=vc;exports.MatchesFilterBar=cc;exports.MatchesHero=uc;exports.MatchesPage=Tw;exports.MatchesStatsBar=Uw;exports.MatchesWidget=Sc;exports.ORDER_MAX_PRICE=Jb;exports.ORDER_MIN_PRICE=Xb;exports.ORDER_MIN_QUANTITY=qn;exports.ORDER_MIN_USDC=Yn;exports.ORDER_PRICE_STEP=Qb;exports.POLYMARKET_BUILDER_TAKER_FEE_BPS=yd;exports.POLYMARKET_SPORTS_TAKER_FEE_BPS=kd;exports.PREDICT_REDEEM_MODAL_ID=Zp;exports.PREDICT_SEARCH_MODAL_ID=Vi;exports.PREDICT_SELL_MODAL_ID=Ni;exports.PREDICT_TRADE_MODAL_ID=mn;exports.PRICE_HISTORY_SAMPLE_INTERVAL=ex;exports.PredictRedeemModal=Na;exports.PredictSearchModal=TP;exports.PredictSellModal=za;exports.PredictTradeModal=no;exports.PredictWalletProvider=hd;exports.PriceHistoryInterval=Wr;exports.ProfilePage=wb;exports.RedeemFormWidget=Pa;exports.SORT_PRESETS=Vs;exports.STATIC_CATEGORIES=Zo;exports.SearchEventsButton=BP;exports.SearchHistoryUI=Bl;exports.SearchHistoryWidget=Hl;exports.SearchInputUI=zl;exports.SearchResultItemUI=Wl;exports.SearchResultListWidget=jl;exports.SearchWidget=Xl;exports.SellFormUI=Ba;exports.SellFormWidget=po;exports.SetupModal=$N;exports.SimilarEventCard=Fg;exports.SimilarEventsSection=wl;exports.SourceBadge=lw;exports.SpreadIndicator=jw;exports.TradeFormSkeleton=ja;exports.TradeFormUI=Bs;exports.TradeFormWidget=ro;exports.UserActivitySection=$a;exports.computeMaxBuyAmount=Ps;exports.countActiveFilters=ui;exports.createTradeResultToast=$r;exports.estimatePolymarketBuyFee=ws;exports.estimatePolymarketSellFee=Ns;exports.fireCelebration=Ms;exports.floorToDecimals=ke;exports.formatKMB=Pn;exports.formatShares=kr;exports.getSourceMeta=rn;exports.parsePolymarketError=Jn;exports.polymarketFeeFactor=xd;exports.resolveExpiration=Qn;exports.resolvePolymarketDisplayFeeRateBps=Ss;exports.roundToTickSize=Xn;exports.useEventDetail=Fk;exports.useEventsInfinite=Ys;exports.usePredictSearchHistory=Do;exports.usePredictWallet=yr;exports.useSearchResultListScript=Ul;exports.useSearchScript=Ql;exports.useSellForm=Ra;exports.useTradeForm=Rs;//# sourceMappingURL=index.js.map
137
137
  //# sourceMappingURL=index.js.map