PageSourceSearch

https://techmalak.com/assets/js/index-DNah3J3D.js

js techmalak.com collected 2026-09-24 23:51:57 UTC 33,335 bytes, 3 lines download raw bytes

1import{l as T,q as R,j as e}from"./main-BGrMPGSc.js";import{a as r}from"./router-vendor-CnMLpzFH.js";import{s as $}from"./supabase-Bp7AwA7Z.js";import{c as je}from"./coingecko.service-tLr4T1dp.js";import{u as we}from"./useAggregatedStats-CUWDfHLu.js";import{T as Ne,a as h,b as p,c as u}from"./tooltip-EMGG5TTP.js";import{M as le}from"./markdown-renderer-Bxj9iodb.js";import{P as ye}from"./index-1odnOtpu.js";import{n as ve,b as _e,C as ke,c as Ce}from"./NewsRow-Dh-7bYFM.js";import{R as se}from"./refresh-cw-9lKPlj--.js";import{F as ze,S as Se}from"./shield-alert-D9SoEejE.js";import{c as P}from"./createLucideIcon-KzH94YZI.js";import{T as Me}from"./trending-up-DyxEII2u.js";import{T as $e}from"./trending-down-CcCmdbvT.js";import{T as ne}from"./triangle-alert-DM87r9Zj.js";import{R as Te}from"./radar-C4CodhAw.js";import{C as Ae,a as ae}from"./chevron-right-CHzOXTEV.js";import{A as Ie}from"./activity-CQZWPfj4.js";import{C as De}from"./chart-column-zuPlvq0W.js";import"./ui-vendor-mBAqIvvt.js";import"./trades.service-BsLQbNzY.js";import"./positions.service-ChUSNdSH.js";import"./identity-BO7qecp5.js";import"./countableUnits-BMyNdwA4.js";import"./walletImportVenues-BsyK_Mx7.js";import"./psychology.service-u4uxUXSL.js";import"./trader-profile.types-CXczdUNV.js";import"./xpAward-Ci8jbt00.js";import"./profileProvenance-CwVNrr59.js";import"./xpCurve-Bznhpah6.js";import"./utils-CQQBCEZ3.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};n.SENTRY_RELEASE={id:"c2fa0ad612596b597e7066496a65ae647c4e0b42"};var d=new n.Error().stack;d&&(n._sentryDebugIds=n._sentryDebugIds||{}
1,n._sentryDebugIds[d]="0cf30f1a-7c97-45de-a50b-108080b13327",n._sentryDebugIdIdentifier="sentry-dbid-0cf30f1a-7c97-45de-a50b-108080b13327")}catch{}})();const Fe=[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]],Pe=P("book-marked",Fe);const Ee=[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]],Le=P("book-plus",Ee);const Ue=[["path",{d:"M5 21v-6",key:"1hz6c0"}],["path",{d:"M12 21V9",key:"uvy0l4"}],["path",{d:"M19 21V3",key:"11j9sm"}]],Re=P("chart-no-axes-column-increasing",Ue);const Be=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],He=P("loader-circle",Be);const Ge=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],ie=P("star",Ge);function re(n){return Number.isFinite(n)?n>=1e12?`$${(n/1e12).toFixed(2)}T`:n>=1e9?`$${(n/1e9).toFixed(1)}B`:n>=1e6?`$${(n/1e6).toFixed(1)}M`:`$${n.toFixed(0)}`:"—"}function Oe(n){return Number.isFinite(n)?`${n>=0?"+":""}${n.toFixed(2)}%`:"—"}const K=ve;function Ve(n){const d=Date.now(),b=new Date(n).getTime(),m=Math.floor((d-b)/6e4);if(m<5)return"Just now";if(m<15)return"5 minutes ago";if(m<30)return"15 minutes ago";if(m<60)return"30 minutes ago";const f=Math.floor(m/60);if(f<24)return`${f} hour${f>1?"s":""} ago`;const _=Math.floor(f/24);return`${_} day${_>1?"s":""} ago`}const We={bullets:[{label:"Awaiting Analysis",body:"Malak AI pipeline will populate this with live market synthesis."},{label:"RSS Feed Active",body:"Articles are flowing from 7 sources. Intelligence analysis coming soon."},{label:"Pipeline Status",body:"news-rss-discover is live. news-intelligence-analyze is next."}],sentiment:{bull_pct:50,bear_pct:50,confidence:0,label:"Pending"},trending_narratives:[],updated_at:"pending"},B=_e,F=20;function Ct(){const[n,d]=r.useState([]),[b,m]=r.useState(!0),[f,_]=r.useState(!1),[E,k]=r.useState(null),[L,A]=r.useState(0),[l,oe]=r.useState({highImpact:!1,watchlist:!1,bullish:!1,bearish:!1,focus:!1}),[g,ce]=r.useState(!0),[j,Y]=r.useState(We),[C,de]=r.useState([]),[x,U]=r.useState(0),[H,me]=r.useState(!1),G=r.useRef(null),{stats:c}=we(),[z,xe]=r.useState(null);r.useEffect(()=>{(async()=>{const{data:{user:t}}=await $.auth.getUser();if(!t)return;const{data:a}=await $.from("user_favorites").select("symbol").eq("user_id",t.id);a&&de(a.map(s=>s.symbol.toUpperCase()))})()},[]);const I=r.useCallback(async(t=!1)=>{try{t?_(!0):m(!0),k(null);const{data:a,error:s,count:i}=await $.from("news_articles").select("id, title, url, source_name, source_domain, published_at, impact_level, impact_keywords, tokens, categories, gemini_takeaway, gemini_confidence, confirms_or_contradicts, has_full_content, created_at, image_url",{count:"exact"}).order("published_at",{ascending:!1}).limit(100);s?(T.error("[News] Failed to fetch articles:",s.message),k("Failed to load articles. Please try again.")):a&&(d(a),A(i||a.length))}catch(a){T.error("[News] Unexpected error fetching articles:",a),k("Connection error. Please check your network.")}finally{m(!1),_(!1)}},[]),O=r.useCallback(async()=>{try{const{data:t,error:a}=await $.from("news_intelligence").select("*").eq("is_current",!0).limit(1);if(a){T.error("[News] Intelligence fetch error:",a.message);return}const s=t?.[0];if(s){let o=[];try{o=typeof s.trending_narratives=="string"?JSON.parse(s.trending_narratives):s.trending_narratives||[]}catch{o=[]}const N=[{label:s.bullet_1_label,body:s.bullet_1_body},{label:s.bullet_2_label,body:s.bullet_2_body},{label:s.bullet_3_label,body:s.bullet_3_body}].filter((y,v,M)=>y.label&&M.findIndex(J=>J.label===y.label)===v);Y({bullets:N,sentiment:{bull_pct:s.market_sentiment_bull,bear_pct:s.market_sentiment_bear,confidence:s.sentiment_confidence,label:s.sentiment_label},trending_narratives:o,updated_at:K(s.generated_at)});return}const{data:i}=await $.from("news_intelligence").select("*").order("generated_at",{ascending:!1}).limit(3);
1if(i&&i.length>0){const o=Math.round(i.reduce((v,M)=>v+(M.market_sentiment_bull||50),0)/i.length),N=Math.round(i.reduce((v,M)=>v+(M.sentiment_confidence||0),0)/i.length),y=i[0];Y({bullets:[{label:y.bullet_1_label,body:y.bullet_1_body},{label:y.bullet_2_label,body:y.bullet_2_body},{label:y.bullet_3_label,body:y.bullet_3_body}].filter((v,M,J)=>v.label&&J.findIndex(ge=>ge.label===v.label)===M),sentiment:{bull_pct:o,bear_pct:100-o,confidence:N,label:o>60?"Bullish Bias":o<40?"Bearish Bias":"Neutral"},trending_narratives:[],updated_at:K(i[0].generated_at)})}}catch(t){T.error("[News] Unexpected error fetching intelligence:",t)}},[]),V=r.useCallback(async()=>{try{const t=await je.getGlobalMetrics();if(!t.success||!t.data){T.warn("[News] Global market fetch returned no data:",t.error);return}const a=t.data;xe({totalMarketCapUsd:a.totalMarketCap??0,marketCapChangePct24h:a.marketCapChangePct24h??0,totalVolumeUsd:a.totalVolume24h??0,btcDominance:a.btcDominance??0,ethDominance:a.ethDominance??0,updatedAt:a.lastUpdated||new Date().toISOString()})}catch(t){T.error("[News] Global market fetch failed:",t)}},[]);r.useEffect(()=>{I(),O(),V();const t=$.channel("news_articles_realtime").on("postgres_changes",{event:"INSERT",schema:"public",table:"news_articles"},s=>{const i=s.new;d(o=>[i,...o].slice(0,100)),A(o=>o+1)}).on("postgres_changes",{event:"UPDATE",schema:"public",table:"news_articles"},s=>{const i=s.new;d(o=>o.map(N=>N.id===i.id?{...N,...i}:N))}).subscribe();G.current=t;const a=setInterval(()=>{I(),O(),V()},300*1e3);return()=>{clearInterval(a),G.current&&$.removeChannel(G.current)}},[I,O,V]);const w=r.useMemo(()=>{if(!c||c.total_trades===0)return null;const t=c.win_rate,a=c.current_streak>0?Math.min(c.current_streak*5,20):Math.max(c.current_streak*5,-20),s=c.total_pnl>0?10:c.total_pnl<0?-10:0;return Math.max(0,Math.min(100,Math.round(t+a+s)))},[c]),he=w===null?"No Data":w>70?"Strongly Bullish":w>55?"Slightly Bullish":w>45?"Neutral":w>30?"Slightly Bearish":"Strongly Bearish",W=(w??50)-j.sentiment.bull_pct,pe=Math.abs(W)>15,Z=(c?.symbols_traded?.[0]?.toUpperCase()||"BTC").replace(/\/(USD|USDT|USDC|BUSD|EUR|GBP)$/i,"").replace(/(USDT|USDC|BUSD|USD)$/i,""),ue=t=>{oe(a=>{const s={...a,[t]:!a[t]};return t==="bullish"&&s.bullish&&(s.bearish=!1),t==="bearish"&&s.bearish&&(s.bullish=!1),s}),U(0)},be=r.useCallback(t=>{d(a=>a.map(s=>s.id===t?{...s,is_linked:!s.is_linked}:s))},[]),D=n.filter(t=>!(l.highImpact&&t.impact_level!=="high"||l.watchlist&&(C.length===0||!(t.tokens||[]).map(s=>s.toUpperCase()).some(s=>C.includes(s)))||l.bullish&&(!t.confirms_or_contradicts||t.confirms_or_contradicts==="contradicts")||l.bearish&&t.confirms_or_contradicts!=="contradicts"||l.focus&&!(t.tokens||[]).map(s=>s.toUpperCase()).includes(Z))),S=Math.ceil(D.length/F),Q=D.slice(x*F,(x+1)*F),X=r.useMemo(()=>{const t={};for(const s of n)for(const i of s.categories||[])t[i]=(t[i]||0)+1;const a=n.length||1;return Object.entries(t).map(([s,i])=>({tag:`#${s}`,score:Math.round(i/a*100)})).sort((s,i)=>i.score-s.score).slice(0,5)},[n]),q=r.useMemo(()=>{const t={};for(const a of n)for(const s of a.tokens||[])t[s]=(t[s]||0)+1;return Object.entries(t).map(([a,s])=>({symbol:a,count:s,color:B[a]||R[3]})).sort((a,s)=>s.count-a.count).slice(0,6)},[n]),ee=r.useMemo(()=>{const t=new Array(24).fill(0),a=Date.now(),s=a-1440*60*1e3;for(const i of n){const o=new Date(i.published_at).getTime();if(o>=s){const N=Math.floor((a-o)/36e5);t[23-Math.min(N,23)]++}}return t},[n]),fe=r.useMemo(()=>{const t=[];let a="";for(const s of Q){const i=Ve(s.published_at);i!==a?(a=i,t.push({label:i,articles:[s]})):t[t.length-1].articles.push(s)}return t},[Q]),te=X.length>0?X:j.trending_narratives;return e.jsx(Ne,{delayDuration:200,children:e.jsxs("div",{className:"bg-bg-page relative min-h-screen flex flex-col",suppressHydrationWarning:!0,children:[e.jsx(ye,{}),e.jsxs("div",{className:"relative z-10 w-full max-w-[1800px] mx-auto px-4 sm:px-6 py-6 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between mb-5",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-2 h-2 bg-brand-primary rounded-full relative",children:e.jsx("div",{className:"absolute inset-[-4px] rounded-full bg-brand-primary/30 animate-ping"})}),e.jsx("h1",{className:"font-['Poppins'] text-[26px] font-bold text-white tracking-tight",children:"Intelligence Hub"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("button",{onClick:()=>ce(t=>!t),className:"tap-target-mobile flex items-center gap-1.5 px-3 py-2 rounded-xl bg-white/[0.04] border border-white/[0.06] text-zinc-400 hover:text-white text-xs transition cursor-pointer",children:[e.jsx("span",{className:`relative inline-flex h-3.5 w-6 shrink-0 items-center rounded-full transition-colors duration-200 ${g?"bg-brand-primary":"bg-zinc-700"}`,children:e.jsx("span",{className:`inline-block h-2.5 w-2.5 rounded-full bg-white shadow-sm transition-transform duration-200 ${g?"translate-x-3":"translate-x-0.5"}`})}),e.jsx("span",{className:"font-mono text-tiny-plus hidden sm:inline",children:"Tooltips"})]}),e.jsxs("button",{onClick:()=>I(!0),className:"tap-target-mobile flex items-center gap-2 px-3.5 py-2 rounded-xl bg-white/[0.04] border border-white/[0.06] text-zinc-400 hover:text-white text-sm transition",children:[e.jsx(se,{className:`w-3.5 h-3.5 ${f?"animate-spin":""}`}),e.jsx("span",{className:"hidden sm:inline",children:"Refresh"})]})]})]}),e.jsx("div",{className:"mb-5 bg-black/40 backdrop-blur-xl border border-white/[0.05] rounded-card py-2.5 px-4 overflow-hidden",children:e.jsxs("div",{className:"whitespace-nowrap inline-block animate-[ticker_35s_linear_infinite]",children:[n.filter(t=>t.impact_level==="high").slice(0,5).map((t,a)=>e.jsxs("span",{className:"mr-8",children:[e.jsx("span",{className:"text-error/80 mr-2 text-tiny font-mono font-semibold",children:"HIGH"}),e.jsx("span",{className:"text-zinc-300 text-xs font-mono",children:t.title.length>80?t.title.slice(0,80)+"...":t.title}),a<4&&e.jsx("span",{className:"text-zinc-700 mx-4",children:"|"})]},t.id)),n.filter(t=>t.impact_level==="high").slice(0,5).map((t,a)=>e.jsxs("span",{className:"mr-8",children:[e.jsx("span",{className:"text-error/80 mr-2 text-tiny font-mono font-semibold",children:"HIGH"}),e.jsx("span",{className:"text-zinc-300 text-xs font-mono",children:t.title.length>80?t.title.slice(0,80)+"...":t.title}),a<4&&e.jsx("span",{className:"text-zinc-700 mx-4",children:"|"})]},`dup-${t.id}`))]})}),e.jsx("div",{className:"flex flex-wrap items-center gap-2.5 mb-5",children:e.jsx("div",{className:"flex flex-wrap gap-2",children:[{key:"highImpact",label:"High Impact",icon:e.jsx(ze,{className:"w-3.5 h-3.5"}),tip:"Show only articles flagged as high-impact — SEC rulings, ETF filings, major hacks, institutional moves."},{key:"watchlist",label:C.length>0?`Watchlist (${C.length})`:"Watchlist",icon:e.jsx(ie,{className:"w-3.5 h-3.5"}),tip:`Filter to news mentioning your favorite tokens.${C.length>0?` Tracking: ${C.join(", ")}.`:" Add tokens on Favorites to use this."}`},{key:"bullish",label:"Bullish",icon:e.jsx(Me,{className:"w-3.5 h-3.5"}),tip:"Show only articles where Malak AI confirmed a bullish or trend-confirming signal."},{key:"bearish",label:"Bearish",icon:e.jsx($e,{className:"w-3.5 h-3.5"}),tip:"Show only articles where Malak AI detected a bearish or trend-contradicting signal."},{key:"focus",label:"Focus",icon:e.jsx(ke,{className:"w-3.5 h-3.5"}),tip:`Narrow the feed to news about your most-traded token (${Z}).`}].map(t=>e.jsxs(h,{open:g?void 0:!1,children:[e.jsx(p,{asChild:!0,children:e.jsxs("button",{onClick:()=>ue(t.key),className:`tap-target-mobile flex items-center gap-2 px-3.5 py-2 rounded-control border text-xs font-medium transition cursor-pointer ${l[t.key]?"bg-brand-primary/12 border-brand-primary/40 text-brand-primary":"border-white/[0.06] text-zinc-500 hover:border-brand-primary/40 hover:text-brand-primary"}`,children:[t.icon," ",t.label]})}),e.jsx(u,{side:"bottom",className:"max-w-[240px] text-center text-xs",children:e.jsx("p",{children:t.tip})})]},t.key))})}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-[1fr_320px] gap-px bg-white/[0.03] border border-white/[0.05] rounded-card overflow-hidden",children:[e.jsxs("div",{className:"col-span-full flex flex-wrap bg-bg-2",children:[e.jsxs("div",{className:"flex-1 min-w-[130px] p-4 border-r border-white/[0.04] transition hover:bg-white/[0.01]",children:[e.jsxs(h,{open:g?void 0:!1,children:[e.jsx(p,{asChild:!0,children:e.jsx("div",{className:"text-tiny text-zinc-500 font-mono uppercase tracking-wider mb-1.5 cursor-help",children:"Total Crypto Market Cap"})}),e.jsx(u,{side:"bottom",className:"max-w-[260px] text-center text-xs",children:e.jsx("p",{children:"Aggregate USD market capitalization of all tracked cryptocurrencies. Source: CoinGecko /global (free public endpoint)."})})]}),z?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex items-baseline gap-2 flex-wrap",children:[e.jsx("span",{className:"text-lg font-semibold text-zinc-100 font-poppins",children:re(z.totalMarketCapUsd)}),e.jsxs("span",{className:`text-xs font-mono px-1.5 py-0.5 rounded ${z.marketCapChangePct24h>=0?"text-pos bg-pos/10":"text-neg bg-neg/10"}`,children:[z.marketCapChangePct24h>=0?"▲":"▼"," ",Oe(z.marketCapChangePct24h)]})]})}):e.jsxs("div",{className:"space-y-2 animate-pulse",children:[e.jsx("div",{className:"h-5 w-24 rounded bg-zinc-800/60"}),e.jsx("div",{className:"h-2 w-32 rounded bg-zinc-800/40"})]})]}),e.jsxs("div",{className:"flex-1 min-w-[130px] p-4 border-r border-white/[0.04] transition hover:bg-white/[0.01]",children:[e.jsxs(h,{open:g?void 0:!1,children:[e.jsx(p,{asChild:!0,children:e.jsx("div",{className:"text-tiny text-zinc-500 font-mono uppercase tracking-wider mb-1.5 cursor-help",children:"24h Volume"})}),e.jsx(u,{side:"bottom",className:"max-w-[260px] text-center text-xs",children:e.jsx("p",{children:"Total 24h USD trading volume across all tracked cryptocurrencies. Source: CoinGecko /global."})})]}),z?e.jsx("div",{className:"flex items-baseline gap-2",children:e.jsx("span",{className:"text-lg font-semibold text-zinc-100 font-poppins",children:re(z.totalVolumeUsd)})}):e.jsx("div",{className:"space-y-2 animate-pulse",children:e.jsx("div",{className:"h-5 w-20 rounded bg-zinc-800/60"})})]}),e.jsxs("div",{className:"flex-1 min-w-[130px] p-4 border-r border-white/[0.04] transition hover:bg-white/[0.01]",children:[e.jsxs(h,{open:g?void 0:!1,children:[e.jsx(p,{asChild:!0,children:e.jsx("div",{className:"text-tiny text-zinc-500 font-mono uppercase tracking-wider mb-1.5 cursor-help",children:"News Sentiment"})}),e.jsx(u,{side:"bottom",className:"max-w-[240px] text-center text-xs",children:e.jsx("p",{children:"Decay-weighted average of Malak AI article analyses in the last 24 hours. Based on news content only — not price action. 4-hour half-life."})})]}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsxs("span",{className:`text-lg font-semibold ${j.sentiment.bull_pct>55?"text-pos":j.sentiment.bull_pct<45?"text-neg":"text-zinc-300"}`,children:[j.sentiment.bull_pct,"% Bull"]}),e.jsxs("span",{className:"text-xs text-zinc-600",children:["/ ",j.sentiment.bear_pct,"% Bear"]})]}),e.jsx("div",{className:"mt-2.5 w-full h-1.5 rounded-full bg-zinc-800/60 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-gradient-to-r from-neg via-warn to-pos transition-all duration-1000",style:{width:`${j.sentiment.bull_pct}%`}})})]}),e.jsxs("div",{className:"flex-1 min-w-[150px] p-4 border-r border-white/[0.04] transition hover:bg-white/[0.01]",children:[e.jsxs(h,{open:g?void 0:!1,children:[e.jsx(p,{asChild:!0,children:e.jsx("div",{className:"text-tiny text-zinc-500 font-mono uppercase tracking-wider mb-1.5 cursor-help",children:"Your Sentiment"})}),e.jsx(u,{side:"bottom",className:"max-w-[240px] text-center text-xs",children:e.jsx("p",{children:"Derived from your trading journal — win rate, streak, and P&L direction. Compared against News Sentiment to detect bias."})})]}),e.jsx("div",{className:`text-lg font-semibold ${w===null?"text-zinc-500":w>55?"text-pos":w<45?"text-neg":"text-zinc-300"}`,children:he}),e.jsx("div",{className:"text-xs text-zinc-500 mt-1 font-mono",children:c&&c.total_trades>0?`${c.win_rate?.toFixed(0)??0}% WR · ${c.current_streak??0} streak · ${c.total_pnl>=0?"+":""}
1$${Math.abs(c.total_pnl??0).toLocaleString(void 0,{minimumFractionDigits:0,maximumFractionDigits:0})}`:"No trades yet"})]}),e.jsxs("div",{className:"flex-1 min-w-[150px] p-4 transition hover:bg-white/[0.01]",children:[e.jsxs(h,{open:g?void 0:!1,children:[e.jsx(p,{asChild:!0,children:e.jsx("div",{className:"text-tiny text-zinc-500 font-mono uppercase tracking-wider mb-1.5 cursor-help",children:"Bias Alert"})}),e.jsx(u,{side:"bottom",className:"max-w-[240px] text-center text-xs",children:e.jsx("p",{children:"Fires when your journal sentiment diverges more than 15% from news sentiment. Watch for confirmation bias or fear-driven exits."})})]}),pe?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{className:"w-4 h-4 text-warn"}),e.jsx("span",{className:"text-lg font-semibold text-warn",children:"Active"})]}),e.jsxs("div",{className:"text-xs text-zinc-500 mt-1",children:[Math.round(Math.abs(W)),"% more ",W>0?"bullish":"bearish"," than market"]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-lg font-semibold text-zinc-500",children:"Clear"}),e.jsx("div",{className:"text-xs text-zinc-600 mt-1",children:"Sentiment aligned with market"})]})]})]}),e.jsxs("div",{className:"bg-bg-2",children:[e.jsx("div",{className:"p-4",children:e.jsxs("div",{className:"relative bg-black/40 backdrop-blur-xl border border-white/[0.05] rounded-card p-4 overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 rounded-card pointer-events-none",style:{background:"linear-gradient(90deg, transparent, color-mix(in srgb, var(--color-brand-primary) 20%, transparent), transparent)",backgroundSize:"200% 100%",animation:"shimmer 4s ease infinite"}}),e.jsxs("div",{className:"relative z-10",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-3",children:[e.jsx("div",{className:"w-6 h-6 rounded-lg bg-gradient-to-br from-brand-from to-brand-primary flex items-center justify-center",children:e.jsx(Te,{className:"w-3.5 h-3.5 text-white"})}),e.jsx("span",{className:"font-['Poppins'] text-sm font-semibold text-white",children:"Malak AI Synthesis"}),e.jsxs("span",{className:"text-tiny text-zinc-600 font-mono ml-auto",children:["Updated ",j.updated_at]})]}),e.jsx("div",{className:"space-y-2",children:j.bullets.map((t,a)=>e.jsxs("div",{className:"flex gap-3 text-xs-plus leading-relaxed",children:[e.jsx("span",{className:"text-brand-primary font-mono text-xs mt-0.5 shrink-0",children:String(a+1).padStart(2,"0")}),e.jsxs("div",{className:"text-zinc-400",children:[e.jsx("span",{className:"text-zinc-200 font-medium",children:t.label})," — ",e.jsx(le,{inline:!0,content:t.body})]})]},a))})]})]})}),b?e.jsx("div",{className:"flex items-center justify-center py-20",children:e.jsx(He,{className:"w-5 h-5 text-zinc-600 animate-spin"})}):E?e.jsxs("div",{className:"text-center py-16 px-4",children:[e.jsx(ne,{className:"w-5 h-5 text-error mx-auto mb-2"}),e.jsx("p",{className:"text-xs text-error font-mono mb-3",children:E}),e.jsxs("button",{onClick:()=>I(),className:"px-3 py-1.5 text-tiny font-mono bg-error/15 text-error border border-error/30 rounded-lg hover:bg-error/25 transition-colors",children:[e.jsx(se,{className:"w-3 h-3 inline mr-1"})," Retry"]})]}):D.length===0?e.jsx("div",{className:"text-center py-16 px-4",children:l.watchlist&&C.length===0?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-5 h-5 text-zinc-600 mx-auto mb-2"}),e.jsx("p",{className:"text-xs text-zinc-500 font-mono mb-1",children:"No watchlist tokens set"}),e.jsx("p",{className:"text-tiny text-zinc-600",children:"Add tokens to your favorites to filter the feed"})]}):e.jsx("p",{className:"text-xs text-zinc-600 font-mono",children:"No articles match current filters"})}):e.jsx(e.Fragment,{children:fe.map((t,a)=>e.jsxs("div",{children:[e.jsx("div",{className:"font-mono text-tiny text-zinc-600 uppercase tracking-[0.1em] px-5 pt-3 pb-1",children:t.label}),t.articles.map(s=>e.jsx(qe,{article:s,onToggleLink:be,showTooltips:g},s.id))]},a))}),S>1&&e.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-t border-white/[0.04]",children:[e.jsxs("span",{className:"text-xs text-zinc-600 font-mono",children:[x*F+1,"–",Math.min((x+1)*F,D.length)," of ",D.length]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>U(t=>Math.max(0,t-1)),disabled:x===0,className:"tap-target-mobile-overlay p-1.5 rounded-lg bg-white/[0.03] text-zinc-600 disabled:opacity-30 disabled:cursor-not-allowed hover:text-white transition",children:e.jsx(Ae,{className:"w-4 h-4"})}),Array.from({length:Math.min(S,5)},(t,a)=>{let s=a;return S>5&&(x<3?s=a:x>S-4?s=S-5+a:s=x-2+a),e.jsx("button",{onClick:()=>U(s),className:`tap-target-mobile px-2.5 py-1.5 rounded-lg text-xs font-mono transition ${x===s?"bg-brand-primary/12 text-brand-primary font-medium":"bg-white/[0.03] text-zinc-500 hover:text-white"}`,children:s+1},s)}),e.jsx("button",{onClick:()=>U(t=>Math.min(S-1,t+1)),disabled:x>
1=S-1,className:"tap-target-mobile-overlay p-1.5 rounded-lg bg-white/[0.03] text-zinc-500 disabled:opacity-30 disabled:cursor-not-allowed hover:text-white transition",children:e.jsx(ae,{className:"w-4 h-4"})})]})]})]}),e.jsxs("div",{className:`bg-bg-2 lg:sticky lg:top-[65px] lg:self-start lg:max-h-[calc(100dvh-65px)] overflow-y-auto border-l border-white/[0.04] transition-transform duration-300
2                    ${H?"fixed top-0 right-0 bottom-0 w-[320px] z-50 shadow-[-10px_0_40px_rgba(0,0,0,0.5)]":"hidden lg:block"}
3                `,style:H?{maxHeight:"100dvh"}:void 0,children:[H&&e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-white/[0.04]",children:[e.jsx("span",{className:"text-sm font-semibold text-white",children:"Intelligence Panel"}),e.jsx("button",{onClick:()=>me(!1),className:"p-2 rounded-lg bg-white/[0.04] text-zinc-400",children:e.jsx(ae,{className:"w-4 h-4"})})]}),e.jsxs("div",{className:"p-4 border-b border-white/[0.04] transition hover:bg-white/[0.005]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3.5",children:[e.jsx(Ie,{className:"w-4 h-4 text-brand-primary"}),e.jsx("span",{className:"font-['Poppins'] text-xs-plus font-semibold text-white",children:"Trending Narratives"})]}),e.jsx("div",{className:"space-y-3",children:te.length===0?e.jsx("p",{className:"text-xs text-zinc-600 font-mono",children:"No narratives yet"}):te.map((t,a)=>e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("span",{className:"text-xs text-zinc-300 min-w-[80px]",children:t.tag}),e.jsx("div",{className:"flex-1 h-1 rounded-full bg-zinc-800/60 overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full bg-brand-primary transition-all duration-700",style:{width:`${t.score}%`,opacity:1-a*.15}})}),e.jsxs("span",{className:"text-tiny-plus font-mono text-zinc-500 w-8 text-right",children:[t.score,"%"]})]},t.tag))})]}),e.jsxs("div",{className:"p-4 border-b border-white/[0.04] transition hover:bg-white/[0.005]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3.5",children:[e.jsx(De,{className:"w-4 h-4 text-brand-primary"}),e.jsx("span",{className:"font-['Poppins'] text-xs-plus font-semibold text-white",children:"Token Mentions"})]}),e.jsx("div",{className:"space-y-3",children:q.length===0?e.jsx("p",{className:"text-xs text-zinc-600 font-mono",children:"No token mentions yet"}):q.map(t=>e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"w-7 h-7 rounded-full flex items-center justify-center text-tiny font-bold",style:{background:`${t.color}18`,color:t.color},children:t.symbol[0]}),e.jsx("span",{className:"text-xs font-medium text-zinc-200 w-10",children:t.symbol}),e.jsx("div",{className:"flex-1 h-1 rounded-full bg-zinc-800/60",children:e.jsx("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${Math.min(t.count/(q[0]?.count||1)*100,100)}%`,backgroundColor:t.color}})}),e.jsx("span",{className:"text-tiny-plus font-mono text-zinc-500 w-6 text-right",children:t.count})]},t.symbol))})]}),e.jsxs("div",{className:"p-4 transition hover:bg-white/[0.005]",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3.5",children:[e.jsx(Re,{className:"w-4 h-4 text-brand-primary"}),e.jsx("span",{className:"font-['Poppins'] text-xs-plus font-semibold text-white",children:"24h Volume"}),e.jsxs("span",{className:"text-tiny font-mono text-zinc-600 ml-auto",children:[L," total"]})]}),e.jsx("div",{className:"flex items-end gap-[2px] h-14",children:ee.map((t,a)=>{const s=Math.max(...ee,1),i=t/s*100;return e.jsx("div",{className:"flex-1 rounded-sm bg-brand-primary",style:{height:`${Math.max(i,4)}%`,opacity:.2+i/100*.8}},a)})}),e.jsx("div",{className:"flex justify-between mt-2",children:["12am","6am","12pm","now"].map(t=>e.jsx("span",{className:"text-label-xs font-mono text-zinc-600",children:t},t))})]})]})]})]})]})})}function qe({article:n,onToggleLink:d,showTooltips:b}){const[m,f]=r.useState(!1),_=(n.categories||[]).some(l=>l.toLowerCase().includes("regulation")||l.toLowerCase().includes("sec")),E=n.impact_level==="high"?"border-l-error":n.impact_level==="medium"?"border-l-warning":"border-l-zinc-700",k=n.confirms_or_c
3ontradicts==="confirms"?{text:`↑ Confirms · ${n.gemini_confidence??""}%`,cls:"bg-pos/[0.06] text-pos border-pos/[0.12]"}:n.confirms_or_contradicts==="contradicts"?{text:`↓ Contradicts · ${n.gemini_confidence??""}%`,cls:"bg-neg/[0.06] text-neg border-neg/[0.12]"}:n.confirms_or_contradicts==="neutral"?{text:`— Neutral · ${n.gemini_confidence??""}%`,cls:"bg-zinc-500/[0.06] text-zinc-400 border-zinc-500/[0.12]"}:null,L={high:"bg-error/10 text-error font-semibold",medium:"bg-warning/10 text-warning font-semibold",low:"bg-zinc-700/40 text-zinc-500 font-semibold"},A={high:"High Impact — matched keywords like SEC, ETF, hack, or institutional moves. Scraped by Firecrawl for full AI analysis.",medium:"Medium Impact — mentions partnerships, funding rounds, TVL changes, or staking activity.",low:"Low Impact — general crypto news. Not scraped by Firecrawl to conserve credits."};return e.jsxs("div",{className:`border-l-2 ${E} px-5 py-4 cursor-pointer group transition-all duration-200 hover:bg-white/[0.015] relative`,onMouseEnter:()=>f(!0),onMouseLeave:()=>f(!1),children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx(Ce,{src:n.image_url,title:n.title}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2 flex-wrap",children:[_&&e.jsxs(e.Fragment,{children:[e.jsx(Se,{className:"w-3.5 h-3.5 text-brand-primary"}),e.jsx("span",{className:"text-tiny font-mono font-bold text-brand-primary uppercase tracking-wider",children:"Regulatory Change"}),e.jsx("span",{className:"text-zinc-700",children:"·"})]}),e.jsx("span",{className:"text-tiny-plus text-zinc-500",children:n.source_name}),e.jsx("span",{className:"text-zinc-700",children:"·"}),e.jsx("span",{className:"text-tiny-plus text-zinc-600 font-mono",children:K(n.published_at)}),e.jsxs(h,{open:b?void 0:!1,children:[e.jsx(p,{asChild:!0,children:e.jsx("span",{className:`text-tiny px-1.5 py-0.5 rounded-md font-mono cursor-help ${L[n.impact_level]||L.low}`,children:n.impact_level==="medium"?"MED":n.impact_level.toUpperCase()})}),e.jsx(u,{side:"bottom",className:"max-w-[240px] text-center text-xs",children:e.jsx("p",{children:A[n.impact_level]||A.low})})]}),n.has_full_content&&e.jsxs(h,{open:b?void 0:!1,children:[e.jsx(p,{asChild:!0,children:e.jsx("span",{className:"text-tiny px-1.5 py-0.5 rounded-md bg-info/[0.08] text-info font-mono cursor-help",children:"FULL"})}),e.jsx(u,{side:"bottom",className:"max-w-[240px] text-center text-xs",children:e.jsx("p",{children:"Full article scraped and analyzed. Malak AI read the complete text — higher confidence."})})]})]}),e.jsx("h3",{className:`text-sm-plus font-medium leading-snug mb-2 transition ${n.impact_level==="low"?"text-zinc-400 group-hover:text-zinc-200":"text-zinc-100 group-hover:text-white"}`,onClick:()=>{try{const l=new URL(n.url);["http:","https:"].includes(l.protocol)&&window.open(n.url,"_blank","noopener,noreferrer")}catch{}},children:n.title}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[k&&e.jsxs(h,{open:b?void 0:!1,children:[e.jsx(p,{asChild:!0,children:e.jsx("span",{className:`text-tiny-plus px-2 py-0.5 rounded-lg font-mono border cursor-help ${k.cls}`,children:k.text})}),e.jsx(u,{side:"bottom",className:"max-w-[240px] text-center text-xs",children:e.jsx("p",{children:n.confirms_or_contradicts==="contradicts"?"Malak AI determined this news contradicts the current market trend. This is a risk signal.":n.confirms_or_contradicts==="confirms"?"Malak AI confirmed this news supports the current market trend.":"Malak AI found this news neither bullish nor bearish."})})]}),(n.tokens||[]).map(l=>e.jsx("span",{className:"text-tiny-plus px-1.5 py-0.5 rounded-lg font-medium border",style:{background:`${B[l]||R[3]}10`,color:B[l]||R[3],borderColor:`${B[l]||R[3]}18`},children:l},l)),(n.categories||[]).length>0&&e.jsx("span",{className:"text-tiny-plus text-zinc-600",children:(n.categories||[]).map(l=>`#${l}`).join(" ")})]})]}),e.jsx("div",{className:"flex flex-col gap-1.5 shrink-0",children:e.jsxs(h,{open:b?void 0:!1,children:[e.jsx(p,{asChild:!0,children:e.jsx("button",{onClick:l=>{l.stopPropagation(),d(n.id)},className:`tap-target-mobile-overlay p-1.5 rounded-lg transition ${n.is_linked?"text-brand-primary bg-brand-primary/10":"text-zinc-600 hover:text-brand-primary hover:bg-white/[0.04] opacity-0 group-hover:opacity-100"}`,children:n.is_linked?e.jsx(Pe,{className:"w-4 h-4"}):e.jsx(Le,{className:"w-4 h-4"})})}),e.jsx(u,{side:"left",className:"max-w-[200px] text-center text-xs",children:e.jsx("p",{children:n.is_linked?"Linked to journal. Click to unlink.":"Link to your trade journal."})})]})})]}),n.gemini_takeaway&&m&&e.jsxs("div",{className:"absolute left-full top-0 ml-2 w-72 bg-zinc-900/95 backdrop-blur-sm border border-zinc-700/50 rounded-xl p-4 shadow-xl z-50 animate-in fade-in slide-in-from-left-1 duration-200 pointer-events-none",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-brand-primary rounded-full"}),e.jsx("span",{className:"text-tiny font-mono font-bold text-brand-primary uppercase tracking-widest",children:"Malak AI Takeaway"})]}),e.jsxs("div",{className:"text-xs text-zinc-300 leading-relaxed mb-3",children:['"',e.jsx(le,{inline:!0,content:n.gemini_takeaway}),'"']}),e.jsxs("div",{className:"flex items-center justify-between text-tiny font-mono text-zinc-500",children:[e.jsxs("span",{children:["Confidence: ",e.jsxs("span",{className:"text-info",children:[n.gemini_confidence,"%"]})]}),e.jsxs("span",{children:["Impact: ",e.jsx("span",{className:"text-error",children:n.impact_level})]})]})]})]})}export{Ce as NewsThumbnail,Ct as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.