PageSourceSearch

https://tradeintelx.com/assets/NewsTickerWidget-DD9p7Wr8.js

js tradeintelx.com collected 2026-10-02 01:48:18 UTC 6,761 bytes, 1 lines download raw bytes

1import{o as A}from"./rolldown-runtime-ChpBd9eV.js";import{Cn as $,Dn as f,Ka as M,Pa as _,Tn as S,ba as g,jt as m,on as I,rn as F,wa as R,wn as C}from"./chat-page-C-flp553.js";import{bt as D}from"./education-page-Buqr-MLV.js";var l=A(M(),1),e=_(),B=({className:x=""})=>{const[r,j]=(0,l.useState)([]),[E,P]=(0,l.useState)([]),[N,u]=(0,l.useState)(!0),[h,p]=(0,l.useState)(null),[o,b]=(0,l.useState)(0),[n,w]=(0,l.useState)(!0);(0,l.useEffect)(()=>{d();const s=setInterval(d,900*1e3);return()=>clearInterval(s)},[]),(0,l.useEffect)(()=>{if(!n||r.length===0)return;const s=setInterval(()=>{b(t=>(t+1)%r.length)},8e3);return()=>clearInterval(s)},[r.length,n]);const d=async()=>{try{u(!0);const s=await D("marketaux","/news/all",{symbols:"AAPL,MSFT,TSLA,NVDA",limit:14,language:"en",filter_entities:"true"}).catch(()=>({ok:!1,body:{}}));j([...((s.ok?s.body:{data:[]}).data||[]).slice(0,14).map(t=>({id:t.uuid||Math.random(),title:t.title,description:t.description||t.snippet,url:t.url,publishedAt:t.published_at,source:t.source||"MarketAux",image:t.image_url,sentiment:t.entities?.[0]?.sentiment||"neutral",type:"market",symbols:t.entities?.map(i=>i.symbol).filter(Boolean)||[]}))].sort((t,i)=>new Date(i.publishedAt)-new Date(t.publishedAt))),p(null)}catch(s){console.error("Error fetching news:",s),p(s.message)}finally{u(!1)}},v=s=>{switch(s){case"positive":return"text-green-400";case"negative":return"text-red-400";default:return"text-slate-400"}},y=s=>{switch(s){case"positive":return(0,e.jsx)($,{className:"w-3 h-3"});case"negative":return(0,e.jsx)(C,{className:"w-3 h-3"});default:return null}},k=s=>{const t=new Date,i=new Date(s),c=Math.floor((t-i)/(1e3*60));return c<60?`${c}m ago`:c<1440?`${Math.floor(c/60)}h ago`:`${Math.floor(c/1440)}d ago`};if(N)return(0,e.jsxs)("div",{className:`bg-slate-900/60 backdrop-blur-xl border border-slate-700/50 rounded-2xl p-4 ${x}`,children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,e.jsx)(m,{className:"w-4 h-4 text-purple-400"}),(0,e.jsx)("h3",{className:"text-sm font-semibold text-white",children:"Market News"})]}),(0,e.jsx)("div",{className:"space-y-3",children:[...Array(3)].map((s,t)=>(0,e.jsxs)("div",{className:"animate-pulse",children:[(0,e.jsx)("div",{className:"h-3 bg-slate-700 rounded w-full mb-2"}),(0,e.jsx)("div",{className:"h-2 bg-slate-800 rounded w-3/4"})]},t))})]});if(h||r.length===0)return(0,e.jsxs)("div",{className:`bg-slate-900/60 backdrop-blur-xl border border-slate-700/50 rounded-2xl p-4 ${x}`,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(m,{className:"w-4 h-4 text-purple-400"}),(0,e.jsx)("h3",{className:"text-sm font-semibold text-white",children:"Market News"})]}),(0,e.jsx)("button",{onClick:d,className:"p-1 hover:bg-slate-700/50 rounded-lg transition-colors",children:(0,e.jsx)(f,{className:"w-3 h-3 text-slate-400"})})]}),(0,e.jsx)("div",{className:"text-center py-4",children:(0,e.jsx)("p",{className:"text-xs text-slate-400",children:h?"Failed to load news":"No news available"})})]});const a=r[o];return(0,e.jsxs)("div",{className:`bg-slate-900/60 backdrop-blur-xl border border-slate-700/50 rounded-2xl overflow-hidden ${x}`,children:[(0,e.jsxs)("div",{className:"flex items-center justify-between p-4 border-b border-slate-700/50",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(m,{className:"w-4 h-4 text-purple-400"}),(0,e.jsx)("h3",{className:"text-sm font-semibold text-white",children:"Market News"}),(0,e.jsxs)("span",{className:"text-xs text-slate-400",children:[o+1,"/",r.length]})]}),(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)("button",{onClick:()=>w(!n),className:`p-1 rounded text-xs ${n?"text-blue-400 bg-blue-400/20":"text-slate-400 hover:text-white"}`,children:n?"Auto":"Manual"}),(0,e.jsx)("button",{onClick:d,className:"p-1 hover:bg-slate-700/50 rounded-lg transition-colors",children:(0,e.jsx)(f,{className:"w-3 h-3 text-slate-400"})})]})]}),(0,e.jsx)(R,{mode:"wait",children:(0,e.jsx)(g.div,{initial:{opacity:0,x:20}
1,animate:{opacity:1,x:0},exit:{opacity:0,x:-20},transition:{duration:.3},className:"p-4",children:a&&(0,e.jsxs)("div",{className:"space-y-3",children:[(0,e.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,e.jsx)("span",{className:`px-2 py-0.5 rounded-full text-xs font-medium ${a.type==="market"?"bg-blue-500/20 text-blue-400":"bg-purple-500/20 text-purple-400"}`,children:a.type==="market"?"Market":"Business"}),a.sentiment!=="neutral"&&(0,e.jsxs)("div",{className:`flex items-center gap-1 ${v(a.sentiment)}`,children:[y(a.sentiment),(0,e.jsx)("span",{className:"text-xs",children:a.sentiment})]})]}),(0,e.jsx)("h4",{className:"text-sm font-medium text-white leading-tight line-clamp-3",children:a.title})]}),a.image&&(0,e.jsx)("img",{src:a.image,alt:"",className:"w-16 h-12 object-cover rounded-lg bg-slate-800",onError:s=>{s.target.style.display="none"}})]}),a.description&&(0,e.jsx)("p",{className:"text-xs text-slate-300 line-clamp-3",children:a.description}),a.symbols&&a.symbols.length>0&&(0,e.jsx)("div",{className:"flex flex-wrap gap-1",children:a.symbols.slice(0,3).map(s=>(0,e.jsx)("span",{className:"px-2 py-0.5 bg-slate-700/50 rounded text-xs text-slate-300",children:s},s))}),(0,e.jsxs)("div",{className:"flex items-center justify-between pt-2",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-400",children:[(0,e.jsx)(F,{className:"w-3 h-3"}),(0,e.jsx)("span",{children:k(a.publishedAt)}),(0,e.jsx)("span",{children:"•"}),(0,e.jsx)("span",{children:a.source})]}),(0,e.jsxs)("a",{href:a.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-400 hover:text-blue-300 transition-colors",children:["Read",(0,e.jsx)(S,{className:"w-3 h-3"})]})]})]})},o)}),(0,e.jsxs)("div",{className:"flex items-center justify-center gap-1 p-3 border-t border-slate-700/50",children:[r.slice(0,8).map((s,t)=>(0,e.jsx)("button",{onClick:()=>b(t),className:`w-1.5 h-1.5 rounded-full transition-all ${t===o?"bg-blue-400":"bg-slate-600 hover:bg-slate-500"}`},t)),r.length>8&&(0,e.jsxs)("div",{className:"flex items-center gap-1 ml-2",children:[(0,e.jsx)(I,{className:"w-3 h-3 text-slate-400"}),(0,e.jsxs)("span",{className:"text-xs text-slate-400",children:["+",r.length-8]})]})]}),n&&(0,e.jsx)("div",{className:"h-0.5 bg-slate-700",children:(0,e.jsx)(g.div,{className:"h-full bg-blue-400",initial:{width:"0%"},animate:{width:"100%"},transition:{duration:8,ease:"linear",repeat:1/0}})})]})};export{B 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.