1import{B as v,C as J,j as t,D as Q,E as T,r as E,F as p,R as z,G as j}from"./index-XMYwAgiZ.js";const ee="Market breadth measures the strength of the market by tracking the number of stocks trading above their 20-day EMA, providing insight into overall momentum and potential trend shifts across sectors.";function k(e,r=0,n=100){return Math.max(r,Math.min(n,e))}function W(e){const r=Math.round(k(e));return r<=10?"strongOversold":r<=27?"oversold":r>=90?"strongOverbought":r>=73?"overbought":"neutral"}function V(e,r){switch(e){case"strongOversold":return r("dashboard.breadth.strongOversold","Strong Oversold");case"oversold":return r("popup.breadth.oversold","Oversold");case"strongOverbought":return r("dashboard.breadth.strongOverbought","Strong Overbought");case"overbought":return r("popup.breadth.overbought","Overbought");default:return r("dashboard.breadth.neutral","Neutral")}}const te={Technology:"technology","Basic Materials":"basicMaterials","Communication Services":"communicationServices","Consumer Discretionary":"consumerDiscretionary","Consumer Cyclical":"consumerDiscretionary","Consumer Staples":"consumerStaples","Consumer Defensive":"consumerDefensive",Energy:"energy",Financials:"financials","Financial Services":"financials","Health Care":"healthcare",Healthcare:"healthcare",Industrials:"industrials",Materials:"materials","Real Estate":"realEstate",Utilities:"utilities",NDX100:"ndx100",dow30:"dow30"};function re(e,r,n){const s=te[r];return s?e(`dashboard.breadth.names.${s}`,n):n}function N(e,r){return e==="strongOversold"||e==="oversold"?r.loss:e==="strongOverbought"||e==="overbought"?r.gain:r.fg4}function ne(e,r){const n=e||r;if(!n)return"";if(!/[T\s]\d{1,2}:\d{2}/.test(n))return n.split("T")[0].split(" ")[0];const o=new Date(n);if(!Number.isFinite(o.getTime()))return n;const i=new Date(o.getTime()-5*60*60*1e3),d=i.getUTCFullYear(),b=String(i.getUTCMonth()+1).padStart(2,"0"),u=String(i.getUTCDate()).padStart(2,"0"),w=String(i.getUTCHours()).padStart(2,"0"),m=String(i.getUTCMinutes()).padStart(2,"0");return`${d}-${b}-${u} ${w}:${m}`}function se(e){if(e==null)return"--";const r=Math.abs(e);return r>=1e9?`${(e/1e9).toFixed(1)}B`:r>=1e6?`${(e/1e6).toFixed(1)}M`:r>=1e3?`${(e/1e3).toFixed(1)}K`:e.toFixed(0)}function oe(e){const r=e.split("-");return r.length>=3?`${r[1]}-${r[2]}`:e}function O({T:e,children:r,style:n}){return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,margin:"18px 0 10px",...n},children:[t.jsx("span",{style:{width:3,height:16,borderRadius:2,background:e.blue,flexShrink:0}}),t.jsx("span",{style:{fontSize:13.5,fontWeight:p.w700,color:e.fg1,letterSpacing:0},children:r})]})}function ae({T:e,up:r}){return t.jsx("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",style:{color:e.fg4,transition:"transform 0.2s",transform:r?"rotate(180deg)":"rotate(0deg)"},children:t.jsx("path",{d:"M4 6l4 4 4-4",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})})}function ie(e,r){if(/^#[0-9a-fA-F]{6}$/.test(e)){const s=parseInt(e.slice(1,3),16),o=parseInt(e.slice(3,5),16),i=parseInt(e.slice(5,7),16);return`rgba(${s}, ${o}, ${i}, ${r})`}const n=e.match(/^rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)(?:,\s*[\d.]+)?\s*\)$/);return n?`rgba(${n[1]}, ${n[2]}, ${n[3]}, ${r})`:e}function le({T:e,value:r}){const n=k(r),s=W(n),o=N(s,e);return t.jsx("div",{style:{position:"relative",height:6,display:"flex",alignItems:"center"},children:t.jsx("div",{style:{width:"100%",height:3,borderRadius:999,background:e.bgControl,overflow:"hidden"},children:t.jsx("div",{style:{width:`${n}%`,height:"100%",borderRadius:999,background:o,boxShadow:`0 0 14px 1px ${ie(o,.52)}`,transition:"width 0.25s ease"}})})})}function X({T:e,rows:r}){const{t:n}=v();if(!r.length)return null;const s={padding:"8px 8px",fontSize:13,fontWeight:p.w400,lineHeight:1.35,whiteSpace:"nowrap",borderBottom:`1px solid ${e.hairline}`},o={...s,color:e.fg5,fontSize:11,fontWeight:p.w500,letterSpacing:".04em"};return t.jsx("div",{style:{borderRadius:z.sm,border:`1px solid ${e.hairline}`,background:e.bgCardAlt,overflow:"hidden"},children:t.jsx("div",{style:{overflowX:"auto"},children:t.jsxs("table",{style:{width:"100%",minWidth:640,borderCollapse:"collapse",tableLayout:"fixed"},children:[t.jsxs("colgroup",{children:[t.jsx("col",{style:{width:"32%"}}),t.jsx("col",{style:{width:"42%"}}),t.jsx("col",{style:{width:72}}),t.jsx("col",{style:{width:112}})]}),t.jsx("thead",{children:t.jsxs("tr",{style:{background:e.bgControl},children:[t.jsx("th",{style:{...o,textAlign:"left"},children:n("dashboard.breadth.colName","Name")}),t.jsx("th",{style:{...o,textAlign:"left"},children:n("dashboard.breadth.colBar","Bar")}),t.jsx("th",{style:{...o,textAlign:"right"},children:n("dashboard.breadth.colScore","Score")}),t.jsx("th",{style:{...o,textAlign:"right"},children:n("dashboard.breadth.colStatus","Status")})]})}),t.jsx("tbody",{children:r.map(i=>{const d=k(Math.round(i.value)),b=W(d),u=N(b,e);return t.jsxs("tr",{children:[t.jsx("td",{style:{...s,color:e.fg1,fontSize:13.5,overflow:"hidden",textOverflow:"ellipsis"},children:re(n,i.key,i.label)}),t.jsx("td",{style:s,children:t.jsx(le,{T:e,value:d})}),t.jsx("td",{style:{...s,color:u,textAlign:"right",fontVariantNumeric:"tabular-nums",...j},children:d}),t.jsx("td",{style:{...s,color:u,textAlign:"right"},children:V(b,n)})]},i.key)})})]})})})}function de({T:e}){const{t:r}=v(),[n,s]=E.useState(!1);return t.jsxs("div",{onClick:()=>s(o=>!o),style:{padding:n?"12px 14px":"10px 14px",borderRadius:8,border:`1px solid ${e.hairline}`,background:e.bgCardAlt,cursor:"pointer",userSelect:"none",marginBottom:2},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:n?10:0},children:[t.jsx("span",{style:{fontSize:13,fontWeight:p.w700,color:e.fg1},children:r("dashboard.breadth.notes","Notes")}),t.jsx(ae,{T:e,up:n})]}),n&&t.jsx("div",{style:{fontSize:12.5,color:e.fg2,lineHeight:1.45},children:r("dashboard.breadth.info",ee)})]})}function he({T:e,score:r,label:n,update:s}){const{t:o}=v(),i=W(r),d=N(i,e);return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",gap:12,alignItems:"center",padding:"11px 14px",borderRadius:z.sm,border:`1px solid ${e.hairline}`,background:e.bgCardAlt},children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsx("div",{style:{color:e.fg2,fontSize:12,fontWeight:p.w400,lineHeight:1.25},children:o("dashboard.breadth.spBreadth","æ æ®500 Breadth")}),t.jsx("div",{style:{color:d,fontSize:15,fontWeight:p.w600,lineHeight:1.35,marginTop:2},children:n})]}),t.jsxs("div",{style:{textAlign:"right",minWidth:136},children:[t.jsxs("div",{style:{color:d,fontSize:22,fontWeight:p.w400,lineHeight:1,...j},children:[Math.round(k(r)),t.jsx("span",{style:{color:e.fg4,fontSize:12,fontWeight:p.w400,marginLeft:1},children:"/100"})]}),t.jsx("div",{style:{color:e.fg4,fontSize:12,fontWeight:p.w400,lineHeight:1.25,marginTop:5,...j},children:o("dashboard.breadth.updated","Updated {{date}}").replace("{{date}}",s||"--")})]})]})}function ce({T:e,rows:r}){const{t:n}=v();return t.jsxs("section",{children:[t.jsx(O,{T:e,children:n("dashboard.breadth.majorIndices","Major Indices")}),t.jsx(X,{T:e,rows:r})]})}function ue({T:e,rows:r}){const{t:n}=v();return r.length?t.jsxs("section",{children:[t.jsx(O,{T:e,children:n("dashboard.breadth.sectorBreadth","Sector Breadth")}),t.jsx(X,{T:e,rows:r.map(s=>({key:s.sector,label:s.sector,value:s.normalized}))})]}):null}function U(e,r,n){let s="",o=!1;return e.forEach((i,d)=>
1{if(i==null||!Number.isFinite(i)){o=!1;return}s+=`${o?"L":"M"}${r(d).toFixed(1)},${n(i).toFixed(1)} `,o=!0}),s.trim()}function ge(e){switch(e){case"top-left":return{top:24,left:8};case"top-right":return{top:24,right:8};case"bottom-left":return{bottom:28,left:8};case"bottom-right":return{bottom:28,right:8}}}function xe({T:e,point:r,corner:n}){const{t:s}=v(),o=W(r.breadth);return t.jsxs("div",{style:{position:"absolute",...ge(n),padding:"9px 10px",borderRadius:10,border:`1px solid ${e.hairline}`,background:e.bgCard,color:e.fg2,fontSize:11,lineHeight:1.45,boxShadow:"0 12px 30px rgba(0,0,0,0.18)",pointerEvents:"none",zIndex:1,minWidth:180},children:[t.jsx("div",{style:{color:e.fg1,fontWeight:p.w700,marginBottom:4,...j},children:r.date}),t.jsxs("div",{children:[s("dashboard.breadth.sp500MarketBreadth","æ æ®500 Market Breadth"),": ",r.breadth," (",V(o,s),")"]}),r.close!=null&&t.jsxs("div",{children:[s("dashboard.breadth.sp500Etf","æ æ®500 ETF"),": ",r.close.toFixed(2)]}),r.volume!=null&&t.jsxs("div",{children:[s("dashboard.breadth.volume","Volume"),": ",se(r.volume)]})]})}function be(e,r){return!Number.isFinite(e)||!Number.isFinite(r)||e===0?0:(r-e)/Math.abs(e)*100}function fe(e,r=1){return Number.isFinite(e)?`${e>=0?"+":""}${e.toFixed(r)}%`:"--"}function pe(e,r=0){return Number.isFinite(e)?`${e>=0?"+":""}${e.toFixed(r)}`:"--"}function me(e,r){const n=e.map((y,D)=>{var C;return{date:y.date,breadth:y.value,close:((C=r[D])==null?void 0:C.close)??null}}).filter(y=>y.close!=null&&Number.isFinite(y.close));if(n.length<2)return null;const s=n.slice(-Math.min(20,n.length)),o=s[0],i=s[s.length-1],d=i.breadth-o.breadth,b=be(o.close,i.close),u=5,w=1,m=Math.abs(d)<u?0:d>0?1:-1,S=Math.abs(b)<w?0:b>0?1:-1;let M="mixed";return S>0&&m<0?M="bearishDivergence":S<0&&m>0?M="bullishDivergence":S>0&&m>0?M="alignedUp":S<0&&m<0&&(M="alignedDown"),{state:M,days:s.length,breadthDelta:d,spyDelta:b}}function ye({T:e,timeline:r,spyHistory:n}){const{t:s}=v(),o=E.useMemo(()=>me(r,n),[r,n]);if(!o)return null;const d={bearishDivergence:{label:s("dashboard.breadth.bearishDivergence","Bearish divergence"),tone:e.loss,text:s("dashboard.breadth.bearishDivergenceDesc","The S&P 500 is rising while fewer stocks are participating. For new investors, this means the rally may be narrowing and pullback risk is higher.")},bullishDivergence:{label:s("dashboard.breadth.bullishDivergence","Bullish divergence"),tone:e.gain,text:s("dashboard.breadth.bullishDivergenceDesc","The S&P 500 is falling while more stocks are improving. This can mean selling pressure is easing under the surface.")},alignedUp:{label:s("dashboard.breadth.alignedUp","Healthy confirmation"),tone:e.gain,text:s("dashboard.breadth.alignedUpDesc","The S&P 500 and breadth are both improving. More stocks are joining the move, which is a healthier setup than a narrow rally.")},alignedDown:{label:s("dashboard.breadth.alignedDown","Broad weakness"),tone:e.loss,text:s("dashboard.breadth.alignedDownDesc","The S&P 500 and breadth are both weakening. The decline is broad, so risk remains elevated until participation improves.")},mixed:{label:s("dashboard.breadth.mixedSignal","Mixed signal"),tone:e.fg4,text:s("dashboard.breadth.mixedSignalDesc","Breadth and price are not giving a clear confirmation. Treat the chart as neutral and wait for a stronger direction.")}}[o.state];return t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr) auto",gap:14,alignItems:"center",borderRadius:z.sm,border:`1px solid ${e.hairline}`,background:e.bgCardAlt,padding:"12px 14px",marginBottom:12},children:[t.jsxs("div",{style:{minWidth:0},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:5},children:[t.jsx("span",{style:{width:8,height:8,borderRadius:99,background:d.tone,flexShrink:0}}),t.jsx("span",{style:{color:d.tone,fontSize:13,fontWeight:p.w700},children:d.label}),t.jsx("span",{style:{color:e.fg5,fontSize:11.5,...j},children:s("dashboard.breadth.recentWindow","{{days}} sessions").replace("{{days}}",String(o.days))})]}),t.jsx("div",{style:{color:e.fg2,fontSize:12.5,lineHeight:1.45},children:d.text})]}),t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto auto",columnGap:12,rowGap:4,color:e.fg4,fontSize:11.5,whiteSpace:"nowrap",...j},children:[t.jsx("span",{children:s("dashboard.breadth.breadthChange","Breadth")}),t.jsxs("span",{style:{color:o.breadthDelta>=0?e.gain:e.loss,textAlign:"right"},children:[pe(o.breadthDelta,0)," pts"]}),t.jsx("span",{children:s("dashboard.breadth.spyChange","S&P 500")}),t.jsx("span",{style:{color:o.spyDelta>=0?e.gain:e.loss,textAlign:"right"},children:fe(o.spyDelta,1)})]})]})}function ve({T:e,timeline:r,spyHistory:n}){var I,H;const{t:s}=v(),[o,i]=E.useState(null),d=760,b=280,u=38,w=14,m=28,S=74,y=m+S+52,D=78,C=d-u-w,f=r.length,l=E.useMemo(()=>{const a=n.map(g=>g.close).filter(g=>g!=null&&g>0),h=a.length?Math.min(...a):null,c=a.length?Math.max(...a):null,x=h!=null&&c!=null?Math.max(1,c-h):1,P=Math.max(1,...n.map(g=>g.volume??0)),$=g=>u+(f<=1?0:g/(f-1)*C),B=g=>m+S-k(g)/100*S,A=g=>h==null?y+D:y+D-(g-h)/x*D,F=n.map(g=>g.close);
1return{minClose:h,maxClose:c,maxVolume:P,xFor:$,yBreadth:B,ySpy:A,breadthPath:U(r.map(g=>g.value),$,B),spyPath:U(F,$,A)}},[r,n,f,C]);if(f<2)return null;const _=f<=4?r.map((a,h)=>h):Array.from(new Set([0,Math.floor(f/3),Math.floor(2*f/3),f-1])),L=o==null?null:{date:r[o].date,breadth:r[o].value,close:((I=n[o])==null?void 0:I.close)??null,volume:((H=n[o])==null?void 0:H.volume)??null},R=o==null?null:(()=>{const a=l.xFor(o),h=l.yBreadth(r[o].value),c=a<d/2,x=h<b/2;return c&&x?"bottom-right":!c&&x?"bottom-left":c&&!x?"top-right":"top-left"})(),G=l.spyPath.length>0,K=l.maxClose!=null&&l.minClose!=null?l.maxClose-l.minClose:0,Y=e.fg4,Z=e.fg2,q=e.fg5;return t.jsxs("div",{style:{position:"relative"},children:[L&&R&&t.jsx(xe,{T:e,point:L,corner:R}),t.jsxs("svg",{viewBox:`0 0 ${d} ${b}`,style:{width:"100%",display:"block",overflow:"visible"},onMouseLeave:()=>i(null),onMouseMove:a=>{const h=a.currentTarget.getBoundingClientRect(),c=(a.clientX-h.left)/h.width*d,x=k((c-u)/C,0,1);i(Math.round(x*(f-1)))},children:[t.jsx("text",{x:u+6,y:15,fill:e.fg2,fontSize:8,fontWeight:700,children:s("dashboard.breadth.sp500MarketBreadth","æ æ®500 Market Breadth")}),[0,25,50,75,100].map(a=>t.jsxs("g",{children:[(a===0||a===100)&&t.jsx("line",{x1:u,x2:d-w,y1:l.yBreadth(a),y2:l.yBreadth(a),stroke:e.hairline,strokeWidth:1}),t.jsx("text",{x:u-8,y:l.yBreadth(a)+3.5,fill:e.fg4,fontSize:7,fontWeight:600,textAnchor:"end",style:j,children:a})]},a)),t.jsx("path",{d:l.breadthPath,fill:"none",stroke:Y,strokeWidth:.9,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"}),r.map((a,h)=>{const c=W(a.value),x=c==="overbought"||c==="strongOverbought";if(!x&&!(c==="oversold"||c==="strongOversold"))return null;const $=l.xFor(h),B=l.yBreadth(a.value),A=x?e.gain:e.loss,F=x?-1:1;return t.jsx("path",{d:`M ${$} ${B+F*6} L ${$-5} ${B+F*15} L ${$+5} ${B+F*15} Z`,fill:A,opacity:.9},`${a.date}-${h}`)}),G&&t.jsxs(t.Fragment,{children:[t.jsx("text",{x:u+6,y:y-16,fill:e.fg2,fontSize:8,fontWeight:700,children:s("dashboard.breadth.sp500Etf","æ æ®500 ETF")}),l.maxClose!=null&&l.minClose!=null&&[l.maxClose,(l.maxClose+l.minClose)/2,l.minClose].map((a,h)=>t.jsxs("g",{children:[h!==1&&t.jsx("line",{x1:u,x2:d-w,y1:l.ySpy(a),y2:l.ySpy(a),stroke:e.hairline,strokeWidth:.7,opacity:.45}),t.jsx("text",{x:u-8,y:l.ySpy(a)+3.5,fill:e.fg4,fontSize:7,fontWeight:600,textAnchor:"end",style:j,children:a.toFixed(K<20?1:0)})]},`${a}-${h}`)),n.map((a,h)=>{if(a.volume==null||a.volume<=0)return null;const c=Math.max(2,C/Math.max(1,f)*.55),x=k(a.volume/l.maxVolume*28,1,28);return t.jsx("rect",{x:l.xFor(h)-c/2,y:y+D-x,width:c,height:x,rx:1.5,fill:q,opacity:.24},`${a.date}-volume`)}),t.jsx("path",{d:l.spyPath,fill:"none",stroke:Z,strokeWidth:.9,strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"})]}),_.map(a=>t.jsx("text",{x:l.xFor(a),y:b-8,fill:e.fg4,fontSize:7,fontWeight:600,textAnchor:a===0?"start":a===f-1?"end":"middle",style:j,children:oe(r[a].date)},`x-${a}`)),o!=null&&t.jsx("line",{x1:l.xFor(o),x2:l.xFor(o),y1:m,y2:b-24,stroke:e.fg4,strokeWidth:1,strokeDasharray:"4 4",opacity:.38})]})]})}function je({T:e,timeline:r,spyHistory:n}){const{t:s}=v();return r.length<2?null:t.jsxs("section",{children:[t.jsx(O,{T:e,children:s("dashboard.breadth.historyTrend","History Trend")}),t.jsxs("div",{style:{borderRadius:z.sm,background:e.bgCard,border:`1px solid ${e.hairline}`,padding:12,overflow:"visible",minWidth:0},children:[t.jsx(ye,{T:e,timeline:r,spyHistory:n}),t.jsx(ve,{T:e,timeline:r,spyHistory:n})]})]})}function we({T:e}){const{t:r}=v(),{data:n,isLoading:s,error:o}=J();if(s)return t.jsx(Q,{T:e,rows:8});if(o||!n)return t.jsx(T,{T:e,msg:o?r("dashboard.breadth.loadFailed","Failed to load - {{error}}").replace("{{error}}",o.message):r("dashboard.breadth.noData","No data available")});const i=ne(n.updatedAt,n.latestDate);return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:18,padding:"2px 0 24px"},children:[t.jsx(de,{T:e}),t.jsx(he,{T:e,score:n.score,label:n.label,update:i?`${i} EST`:""}),t.jsx(ce,{T:e,rows:n.marketItems}),t.jsx(ue,{T:e,rows:n.sectorValues}),t.jsx(je,{T:e,timeline:n.timeline,spyHistory:n.spyHistory})]})}export{we 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.