1import{r as f,j as e,__tla as At}from"./vendor-BvzV4098.js";import{f as it,__tla as wt}from"./fetchMarketData-Dpj5Lmev.js";import{f as Rt,t as ut,e as $t}from"./quantLiveData-BWA4PfVL.js";import{u as Mt,W as kt,__tla as Et}from"./widgetDataNav-Bpr3bh_v.js";import{s as X}from"./r0yDataUtils-BWlskG1K.js";import{__tla as Ct}from"./index-DkXTyYOv.js";import{__tla as Lt}from"./jspdf-CfiETrc0.js";import{__tla as Bt}from"./framer-motion-C706ZmUs.js";import"./html2canvas-B0tyYwQk.js";let mt,zt=Promise.all([(()=>{try{return At}catch{}})(),(()=>{try{return wt}catch{}})(),(()=>{try{return Et}catch{}})(),(()=>{try{return Ct}catch{}})(),(()=>{try{return Lt}catch{}})(),(()=>{try{return Bt}catch{}})()]).then(async()=>{const bt=(i,d,s)=>i<d?d:i>s?s:i,ot=i=>typeof i=="number"&&Number.isFinite(i),o=(i,d=2)=>ot(i)?Number(i).toLocaleString("en-US",{minimumFractionDigits:d,maximumFractionDigits:d}):"\u2014",H=(i,d=2)=>(i>=0?"+":"")+o(i,d),tt=i=>i.length?i.reduce((d,s)=>d+s,0)/i.length:0,st=[{a:"AAPL",b:"MSFT",nm:"Mega-Cap Tech"},{a:"NVDA",b:"AMD",nm:"Semis"},{a:"XOM",b:"CVX",nm:"Energy Majors"},{a:"PG",b:"KO",nm:"Staples"},{a:"JPM",b:"GS",nm:"Money-Center Banks"},{a:"TSLA",b:"F",nm:"Autos \xB7 Disc"},{a:"NVDA",b:"NEM",nm:"Semis \xD7 Gold"},{a:"AAPL",b:"XOM",nm:"Tech \xD7 Energy"},{a:"MSFT",b:"DUK",nm:"Tech \xD7 Utility"},{a:"UNH",b:"JNJ",nm:"Healthcare"}];function rt(i,d){const s=Math.min(i.length,d.length);if(s<2)return{mx:0,my:0,vx:0,vy:0,cov:0,corr:0,betaYX:0};const y=i.slice(-s),u=d.slice(-s),R=tt(y),b=tt(u);let v=0,S=0,a=0;for(let c=0;c<s;c++){const B=y[c]-R,I=u[c]-b;v+=B*B,S+=I*I,a+=B*I}const D=Math.sqrt(v*S);return{mx:R,my:b,vx:v/s,vy:S/s,cov:a/s,corr:D>0?a/D:0,betaYX:v>0?a/v:0}}function ht(i,d,s,y=21){const u=ut(d),R=ut(s),b=rt(R,u),v=b.corr,S=b.betaYX,a=v*v,D=Math.sqrt(b.vy)*Math.sqrt(252),c=Math.sqrt(b.vx)*Math.sqrt(252),B=tt(u)*252,I=tt(R)*252,F=[];for(let w=y-1;w<u.length;w++){const T=R.slice(w-y+1,w+1),C=u.slice(w-y+1,w+1);F.push({t:w,c:rt(T,C).corr})}const E=bt(S,.2,3),_=d.map((w,T)=>{const C=s[T];return w>0&&C>0?Math.log(w)-E*Math.log(C):0}),z=tt(_),n=Math.sqrt(tt(_.map(w=>(w-z)**2)))||.01,m=_.map(w=>(w-z)/n),M=$t(_),p=m.length?m.filter(w=>Math.abs(w)>2).length/m.length:0;return{dates:i,priceA:d,priceB:s,ra:u,rb:R,corr:v,beta:S,r2:a,volA:D,volB:c,retA:B,retB:I,roll:F,z:m,zNow:m[m.length-1]??0,hedge:E,hl:M,pctBand:p}}function ft(i){const d=Math.abs(i);return(d>.8?"VERY STRONG":d>.6?"STRONG":d>.4?"MODERATE":d>.2?"WEAK":"NEGLIGIBLE")+(i<0?" NEGATIVE":" POSITIVE")+" CO-MOVEMENT"}function at(i){return ot(i)?i>=1e3?"$"+o(i/1e3,2)+"T":"$"+o(i,0)+"B":"\u2014"}async function gt(i,d,s,y=252){const u=await Rt(i,d,s,y);return u?ht(u.dates,u.pricesA,u.pricesB):null}const t={bg:"#000",panel:"#0a0a0a",bd:"#1b1b1b",bd2:"#242424",grid:"#121212",txt:"#ededed",txt2:"#b7b7b7",mut:"#6b6b6b",mut2:"#4a4a4a",up:"#5ec27e",upb:"#6fe39a",dn:"#d96a6a",dnb:"#ff6868",line:"#ffffff",aclr:"#ededed",bclr:"#5ec27e"},U="ui-monospace, SFMono-Regular, JetBrains Mono, Menlo, Consolas, monospace",yt=[{id:"historical-price-eod-light",provider:"FMP",description:"Daily closes \u2014 log returns, \u03C1, \u03B2, spread z.",endpoint:"/fmp-api-proxy?endpoint=historical-price-eod-light&symbol={TICKER}",cadence:"Daily"},{id:"profile",provider:"FMP",description:"Sector, market cap, beta for fundamentals pane.",endpoint:"/fmp-api-proxy?endpoint=profile&symbol={TICKER}",cadence:"Daily"},{id:"key-metrics-ttm",provider:"FMP",description:"P/E, P/S, margins for pair comparison.",endpoint:"/fmp-api-proxy?endpoint=key-metrics-ttm&symbol={TICKER}",cadence:"Daily"}];async function dt(i){const d=i.trim().toUpperCase();if(!d)return null;const s=await Promise.allSettled([it("profile",{symbol:d}),it("key-metrics-ttm",{symbol:d}),it("income-statement",{symbol:d,period:"annual",limit:2})]),y=s[0].status==="fulfilled"?Array.isArray(s[0].value)?s[0].value[0]:s[0].value:null,u=s[1].status==="fulfilled"?Array.isArray(s[1].value)?s[1].value[0]:s[1].value:null,R=s[2].status==="fulfilled"&&Array.isArray(s[2].value)?s[2].value:[],b=R[0],v=R[1];if(!y)return null;const S=y,a=u||{},D=X(S.mktCap??S.marketCap,0)/1e9,c=X(b==null?void 0:b.revenue,0),B=X(v==null?void 0:v.revenue,c),I=B>0?(c-B)/B*100:0,F=c>0&&(b!=null&&b.operatingIncome)?b.operatingIncome/c*100:X(a.operatingProfitMarginTTM,0)*100;return{symbol:d,name:String(S.companyName||d),sector:String(S.sector||S.industry||"\u2014"),mcap:D,pe
1:X(a.peRatioTTM??S.pe,0),ps:X(a.priceToSalesRatioTTM,0),mgn:F,grw:I,div:X(S.lastDiv??a.dividendYieldTTM,0)*(X(S.lastDiv)>0&&X(S.lastDiv)<1?100:1),beta:X(S.beta??a.beta,1)}}const ct={display:"flex",alignItems:"center",gap:8,padding:"8px 13px",borderRight:`1px solid ${t.bd}`},pt={background:"#0c0c0c",border:`1px solid ${t.bd}`,color:t.txt,fontFamily:U,fontSize:12,padding:"4px 6px",outline:"none",width:72};function vt(i){const[d,s]=f.useState(400);return f.useEffect(()=>{const y=i.current;if(!y)return;const u=new ResizeObserver(R=>{var v;const b=(v=R[0])==null?void 0:v.contentRect.width;b&&b>0&&s(b)});return u.observe(y),s(y.clientWidth||400),()=>u.disconnect()},[i]),d}function St({R:i,tickerA:d,tickerB:s,mode:y,height:u=340}){const R=f.useRef(null),b=f.useRef(null),v=f.useRef(null),S=vt(b),[a,D]=f.useState(null),c=f.useRef([]),B=f.useRef(null);f.useEffect(()=>{const F=b.current;if(!F)return;const E=window.devicePixelRatio||1,_=S,z=u;F.width=_*E,F.height=z*E,F.style.height=z+"px";const n=F.getContext("2d");if(!n)return;n.setTransform(E,0,0,E,0,0),n.clearRect(0,0,_,z),c.current=[];const m=44,M=14,p=12,w=24,T=_-m-M,C=z-p-w;if(y==="scatter"){let x=0;for(let A=0;A<i.ra.length;A++)x=Math.max(x,Math.abs(i.ra[A]),Math.abs(i.rb[A]));x*=1.08;const $=m+T/2,P=p+C/2,q=A=>$+A/x*(T/2),V=A=>P-A/x*(C/2);B.current={type:"scatter"},n.strokeStyle=t.grid,n.lineWidth=1;for(let A=-2;A<=2;A++){const Q=x*A/2.4;n.beginPath(),n.moveTo(q(Q),p),n.lineTo(q(Q),p+C),n.stroke(),n.beginPath(),n.moveTo(m,V(Q)),n.lineTo(m+T,V(Q)),n.stroke()}n.strokeStyle=t.bd2,n.beginPath(),n.moveTo(m,P),n.lineTo(m+T,P),n.moveTo($,p),n.lineTo($,p+C),n.stroke();for(let A=0;A<i.rb.length;A++){const Q=q(i.rb[A]),xt=V(i.ra[A]),Tt=i.ra[A]*i.rb[A]>=0;n.fillStyle=Tt?i.ra[A]>=0?"rgba(94,194,126,.55)":"rgba(217,106,106,.55)":"rgba(150,150,150,.35)",n.beginPath(),n.arc(Q,xt,2.1,0,7),n.fill(),c.current.push({px:Q,py:xt,ra:i.ra[A],rb:i.rb[A],date:i.dates[A+1]||""})}const G=rt(i.rb,i.ra),J=G.mx,r=G.my,j=-x,Y=x,et=r+i.beta*(j-J),lt=r+i.beta*(Y-J);n.strokeStyle=t.line,n.lineWidth=1.6,n.beginPath(),n.moveTo(q(j),V(et)),n.lineTo(q(Y),V(lt)),n.stroke(),n.fillStyle=t.mut,n.font="9px "+U,n.fillText(o(x*100,1)+"%",m+T-30,P-4),n.fillText("ret "+s,m+T-44,p+C+16),n.fillStyle=t.txt2,n.fillText("\u03B2="+o(i.beta,2)+" R\xB2="+o(i.r2,2)+" \u03C1="+o(i.corr,2),m+4,p+11);return}let L,W=null,Z=null,O="";if(y==="norm"){const x=i.priceA.map(P=>i.priceA[0]>0?100*P/i.priceA[0]:100),$=i.priceB.map(P=>i.priceB[0]>0?100*P/i.priceB[0]:100);L={a:x,b:$},O="norm"}else y==="roll"?(L={a:i.roll.map(x=>x.c)},W=0,O="roll"):(L={a:i.z},W=0,Z=[1,2],O="spread");let N=1/0,k=-1/0;const g=x=>x.forEach($=>{Number.isFinite($)&&(N=Math.min(N,$),k=Math.max(k,$))});if(g(L.a),L.b&&g(L.b),O==="roll"&&(N=-1,k=1),O==="spread"){const x=Math.max(3,k,-N);N=-x,k=x}const K=(k-N)*.08||1;N-=K,k+=K;const h=x=>p+C-(x-N)/(k-N)*C,nt=x=>m+x/Math.max(1,L.a.length-1)*T;B.current={type:"ts",padL:m,pw:T,padT:p,ph:C,n:L.a.length,Y:h,xi:nt,tsName:O,R:i},n.strokeStyle=t.grid,n.fillStyle=t.mut,n.font="9px "+U;for(let x=0;x<=4;x++){const $=N+(k-N)*x/4,P=h($);n.beginPath(),n.moveTo(m,P),n.lineTo(m+T,P),n.stroke(),n.fillText(O==="norm"?o($,0):o($,1),4,P+3)}W!==null&&(n.strokeStyle=t.bd2,n.beginPath(),n.moveTo(m,h(0)),n.lineTo(m+T,h(0)),n.stroke()),Z&&[1,2].forEach(x=>{[-x,x].forEach($=>{n.strokeStyle=x===2?"rgba(217,106,106,.4)":"rgba(120,120,120,.3)",n.setLineDash([4,4]),n.beginPath(),n.moveTo(m,h($)),n.lineTo(m+T,h($)),n.stroke(),n.setLineDash([])})});const l=(x,$,P)=>{n.strokeStyle=$,n.lineWidth=P,n.beginPath(),x.forEach((q,V)=>{const G=nt(V),J=h(q);V?n.lineTo(G,J):n.moveTo(G,J)}),n.stroke()};O==="norm"&&L.b?(l(L.b,t.bclr,1.4),l(L.a,t.aclr,1.6)):O==="spread"?l(L.a,t.line,1.4):l(L.a,t.line,1.6)},[i,y,S,u,d,s]);const I=F=>{var Z,O,N;const E=(Z=v.current)==null?void 0:Z.getBoundingClientRect();if(!E)return;const _=F.clientX-E.left,z=F.clientY-E.top,n=v.current;if(!n)return;const m=window.devicePixelRatio||1,M=n.getContext("2d");if(!M)return;if(n.width=S*m,n.height=u*m,M.setTransform(m,0,0,m,0,0),M.clearRect(0,0,S,u),y==="scatter"){let k=null,g=1e9;for(const K of c.current){const h=(K.px-_)**2+(K.py-z)**2;h<g&&(g=h,k=K)}if(!k||g>400){D(null);return}M.strokeStyle="rgba(255,255,255,.5)",M.beginPath(),M.arc(k.px,k.py,4,0,7),M.stroke(),D({x:_,y:z,html:`<div style="color:${t.mut};margin-bottom:4px">${k.date}</div><div>${d}: ${H(k.ra*100,2)}%</div><div>${s}: ${H(k.rb*100,2)}%</div>`});return}const p=B.current;
1if(!p){D(null);return}const w=Math.max(0,Math.min(1,(_-p.padL)/p.pw)),T=Math.round(w*(p.n-1)),C=p.xi(T);M.strokeStyle="rgba(255,255,255,.25)",M.setLineDash([2,3]),M.beginPath(),M.moveTo(C,p.padT),M.lineTo(C,p.padT+p.ph),M.stroke(),M.setLineDash([]);const L=p.R.dates[y==="roll"?((O=p.R.roll[T])==null?void 0:O.t)+1:T+1]||p.R.dates[p.R.dates.length-1]||"";let W="";p.tsName==="norm"?W=`<div>ratio: ${o(p.R.priceA[T+1]/p.R.priceB[T+1],3)}</div>`:p.tsName==="roll"?W=`<div>21d \u03C1: ${o(((N=p.R.roll[T])==null?void 0:N.c)??0,2)}</div>`:W=`<div>spread z: ${H(p.R.z[T+1]??0,2)}\u03C3</div>`,D({x:_,y:z,html:`<div style="color:${t.mut}">${L}</div>${W}`})};return e.jsxs("div",{ref:R,style:{position:"relative",padding:"4px 8px 8px",flex:1,minHeight:u},onMouseMove:I,onMouseLeave:()=>D(null),children:[e.jsx("canvas",{ref:b,style:{display:"block",width:"100%"},height:u}),e.jsx("canvas",{ref:v,style:{position:"absolute",left:8,top:4,width:"100%",pointerEvents:"none"},height:u}),a?e.jsx("div",{style:{position:"absolute",left:Math.min(a.x+14,S-150),top:a.y-10,background:"#0c0c0c",border:`1px solid ${t.bd2}`,padding:"8px 10px",fontSize:10.5,lineHeight:1.7,pointerEvents:"none",zIndex:5,boxShadow:"0 6px 24px rgba(0,0,0,.6)",whiteSpace:"nowrap"},dangerouslySetInnerHTML:{__html:a.html}}):null]})}function jt({k:i,va:d,vb:s,better:y}){let u="",R="";if(y){const v=y==="hi"?d.raw>s.raw:d.raw<s.raw;u=v?"win":"",R=v?"":"win"}const b=t.txt;return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1.3fr 1fr 1fr",padding:"7px 14px",borderBottom:`1px solid ${t.grid}`,fontSize:11},children:[e.jsx("span",{style:{color:t.mut,fontSize:10},children:i}),e.jsx("span",{style:{textAlign:"right",color:u?b:t.txt2},children:d.t}),e.jsx("span",{style:{textAlign:"right",color:R?b:t.txt2},children:s.t})]})}mt=function(){const[i,d]=f.useState(0),[s,y]=f.useState(Date.now()),u=f.useCallback(()=>{d(r=>r+1),y(Date.now())},[]);Mt(u,{debounceMs:8e3});const[R,b]=f.useState("AAPL"),[v,S]=f.useState("MSFT"),[a,D]=f.useState("AAPL"),[c,B]=f.useState("MSFT"),[I,F]=f.useState(252),[E,_]=f.useState("scatter"),[z,n]=f.useState("fund"),[m,M]=f.useState(""),[p,w]=f.useState(!1),[T,C]=f.useState(!1),[L,W]=f.useState(!0),[Z,O]=f.useState("idle"),[N,k]=f.useState(null),[g,K]=f.useState(null),[h,nt]=f.useState(null);f.useEffect(()=>{const r=setTimeout(()=>{D(R.trim().toUpperCase()),B(v.trim().toUpperCase())},400);return()=>clearTimeout(r)},[R,v]),f.useEffect(()=>{const r=window.matchMedia("(max-width:980px)"),j=()=>w(r.matches);return j(),r.addEventListener("change",j),()=>r.removeEventListener("change",j)},[]),f.useEffect(()=>{if(!a||!c)return;let r=!1;W(!0);const j=performance.now();return Promise.all([gt(a,c,it,I),dt(a),dt(c)]).then(([Y,et,lt])=>{if(r)return;k(Y),K(et),nt(lt),C(!!Y);const A=Math.round(performance.now()-j);O(Y?`${a}/${c} \xB7 \u03C1 ${o(Y.corr,2)} \xB7 ${Y.ra.length} obs \xB7 ${A}ms`:`${a}/${c} \xB7 no data \xB7 ${A}ms`)}).catch(()=>{r||(C(!1),k(null),O("fetch error"))}).finally(()=>{r||W(!1)}),()=>{r=!0}},[a,c,I,i]);const l=N,x=st.find(r=>r.a===a&&r.b===c),$={63:"3M",126:"6M",252:"1Y",504:"2Y"}[I]||`${I}D`,P=st.filter(r=>{const j=m.trim().toLowerCase();return!j||r.nm.toLowerCase().includes(j)||r.a.toLowerCase().includes(j)||r.b.toLowerCase().includes(j)}),q=(r,j)=>{b(r),S(j),D(r),B(j)},V=()=>{b(c),S(a),D(c),B(a)},G=(l==null?void 0:l.corr)??0,J=(l==null?void 0:l.zNow)??0;return e.jsx(kt,{title:"Pairs Correlation Terminal",subtitle:"\u03C1 \xB7 \u03B2 \xB7 spread z \xB7 live FMP daily returns",asOf:new Date().toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),sources:yt,onRefresh:u,lastUpdated:s,children:e.jsxs("div",{style:{background:t.bg,color:t.txt,fontFamily:U,fontSize:12,margin:"-4px -2px 0",border:`1px solid ${t.bd}`,display:"flex",flexDirection:"column",minHeight:520,overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:22,height:34,padding:"0 16px",borderBottom:`1px solid ${t.bd}`,flexShrink:0,background:"#020202"},children:[e.jsx("span",{style:{padding:"5px 10px",fontSize:11,letterSpacing:1,color:t.txt,background:"#141414"},children:"CORRELATION"}),e.jsxs("div",{style:{color:t.mut,fontSize:11},children:[e.jsxs("b",{style:{color:t.txt2,fontWeight:500},children:[a," / ",c]})," \xB7 ",e.jsx("b",{style:{color:t.txt2,fontWeight:500},children:$})," DAILY \xB7 \u03C1 ",e.jsx("b",{style:{color:t.txt2,fontWeight:500},children:o(G,2)})]}),e.jsx("span",{style:{flex:1}}),p?null:e.jsxs("div",{style:{color:t.mut2,fontSize:10,letterSpacing:1.5},children:[e.jsx("span",{style:{color:t.mut},children:"/"})," SEARCH \xB7 ",e.jsx("span",{style:{color:t.mut},children:"S"})," SWAP \xB7 ",e.jsx("span",{style:{color:t.mut},children:"\u2191\u2193"})," PAIR"]})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:p?"1fr":"286px 1fr 360px",flex:1,minHeight:0,overflow:p?"auto":"hidden"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",minHeight:0,background:"#030303",borderRight:`1px solid ${t.bd}`},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"9px 14px",borderBottom:`1px solid ${t.bd}`},children:[e.jsx("span",{style:{fontSize:10,letterSpacing:2,color:t.mut},children:"WATCH PAIRS"}
1),e.jsx("span",{style:{fontSize:10,color:t.mut2},children:P.length})]}),e.jsx("div",{style:{padding:"8px 12px",borderBottom:`1px solid ${t.bd}`},children:e.jsx("input",{value:m,onChange:r=>M(r.target.value),placeholder:"filter pairs\u2026",style:{width:"100%",background:"#0c0c0c",border:`1px solid ${t.bd}`,color:t.txt,fontFamily:U,fontSize:11,padding:"7px 9px",outline:"none"}})}),e.jsx("div",{style:{overflowY:"auto",flex:1},children:P.map(r=>{const j=r.a===a&&r.b===c;return e.jsxs("button",{type:"button",onClick:()=>q(r.a,r.b),style:{display:"flex",gap:11,alignItems:"center",padding:"11px 14px",borderBottom:`1px solid ${t.bd}`,cursor:"pointer",background:j?"#0c0c0c":"transparent",border:"none",width:"100%",textAlign:"left",position:"relative",fontFamily:U,color:t.txt},children:[j?e.jsx("span",{style:{position:"absolute",left:0,top:0,bottom:0,width:2,background:t.line}}):null,e.jsxs("span",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{fontSize:12.5},children:[r.a," \xD7 ",r.b]}),e.jsx("div",{style:{fontSize:10,color:t.mut,marginTop:3},children:r.nm})]})]},r.a+r.b)})})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",minHeight:0,overflowY:"auto"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:14,padding:"16px 20px 14px"},children:[e.jsxs("div",{style:{width:46,height:42,borderRadius:7,display:"flex",alignItems:"center",justifyContent:"center",background:"#121212",border:`1px solid ${t.bd2}`,fontSize:11,color:t.txt2},children:[a.slice(0,2),"\xD7",c.slice(0,2)]}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{fontSize:10,letterSpacing:2,color:t.mut,marginBottom:7},children:[((x==null?void 0:x.nm)||((g==null?void 0:g.sector)===(h==null?void 0:h.sector)?g==null?void 0:g.sector:"CROSS-SECTOR")||"PAIR").toUpperCase()," \xB7 ",$," DAILY RETURNS \xB7 ",T?"LIVE FMP":"LOADING"]}),e.jsxs("div",{style:{fontSize:17,lineHeight:1.3},children:["Correlation of ",e.jsx("span",{style:{color:t.aclr},children:a})," \xD7 ",e.jsx("span",{style:{color:t.bclr},children:c})]}),e.jsx("div",{style:{fontSize:10,letterSpacing:2,color:t.mut,marginTop:6},children:l?ft(l.corr):"\u2014"})]}),e.jsxs("div",{style:{textAlign:"right",whiteSpace:"nowrap"},children:[e.jsx("div",{style:{fontSize:40,fontWeight:500,letterSpacing:-1,fontVariantNumeric:"tabular-nums",color:G>.3?t.upb:G<-.3?t.dnb:t.txt},children:o(G,2)}),e.jsxs("div",{style:{fontSize:12,marginTop:7,color:t.mut},children:["\u03B2 ",o((l==null?void 0:l.beta)??0,2)," \xB7 R\xB2 ",o((l==null?void 0:l.r2)??0,2)]})]})]}),e.jsx("div",{style:{display:"grid",gridTemplateColumns:p?"repeat(2,1fr)":"repeat(5,1fr)",borderTop:`1px solid ${t.bd}`,borderBottom:`1px solid ${t.bd}`},children:[["CORRELATION \u03C1",o(G,2),t.txt],["BETA (A\u2192B)",o((l==null?void 0:l.beta)??0,2),t.txt2],["R\xB2",o((l==null?void 0:l.r2)??0,2),t.txt2],["SPREAD Z",H(J,1)+"\u03C3",Math.abs(J)>2?J>0?t.dn:t.up:t.txt2],["HALF-LIFE",l&&Number.isFinite(l.hl)?o(l.hl,0)+"d":"\u2014",t.txt2]].map(([r,j,Y])=>e.jsxs("div",{style:{padding:"12px 16px",borderRight:`1px solid ${t.bd}`},children:[e.jsx("div",{style:{fontSize:9.5,letterSpacing:1.5,color:t.mut,marginBottom:6},children:r}),e.jsx("div",{style:{fontSize:15,color:Y,fontVariantNumeric:"tabular-nums"},children:j})]},r))}),e.jsxs("div",{style:{display:"flex",alignItems:"stretch",flexWrap:"wrap",borderBottom:`1px solid ${t.bd}`},children:[e.jsxs("div",{style:ct,children:[e.jsxs("label",{style:{fontSize:9,letterSpacing:1.2,color:t.mut},children:[e.jsx("span",{style:{color:t.aclr},children:"\u25B2"})," A"]}),e.jsx("input",{style:pt,value:R,onChange:r=>b(r.target.value.toUpperCase()),placeholder:"AAPL"})]}),e.jsx("button",{type:"button",onClick:V,title:"swap A / B",style:{padding:"0 14px",background:"#101010",border:"none",borderRight:`1px solid ${t.bd}`,color:t.mut,fontFamily:U,cursor:"pointer",fontSize:14},children:"\u21C4"}),e.jsxs("div",{style:ct,children:[e.jsxs("label",{style:{fontSize:9,letterSpacing:1.2,color:t.mut},children:[e.jsx("span",{style:{color:t.bclr},children:"\u25BC"})," B"]}
1),e.jsx("input",{style:pt,value:v,onChange:r=>S(r.target.value.toUpperCase()),placeholder:"MSFT"})]}),e.jsx("div",{style:{display:"flex",marginLeft:"auto"},children:[63,126,252,504].map(r=>e.jsx("button",{type:"button",onClick:()=>F(r),style:{padding:"0 13px",display:"flex",alignItems:"center",fontSize:10,letterSpacing:1,color:I===r?t.txt:t.mut,cursor:"pointer",border:"none",borderLeft:`1px solid ${t.bd}`,background:I===r?"#161616":"transparent",fontFamily:U},children:{63:"3M",126:"6M",252:"1Y",504:"2Y"}[r]},r))})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"10px 16px 4px"},children:[e.jsx("span",{style:{fontSize:10,letterSpacing:2,color:t.mut},children:E==="scatter"?`DAILY RETURNS \xB7 ${a} vs ${c} \xB7 OLS FIT`:E==="norm"?`PRICE INDEXED TO 100 \xB7 ${a} / ${c}`:E==="roll"?"ROLLING 21-DAY CORRELATION":"SPREAD Z-SCORE \xB7 \xB11\u03C3 / \xB12\u03C3 BANDS"}),e.jsx("div",{style:{display:"flex",gap:1,marginLeft:"auto"},children:["scatter","norm","roll","spread"].map(r=>e.jsx("button",{type:"button",onClick:()=>_(r),style:{padding:"4px 11px",fontSize:10,letterSpacing:1,color:E===r?t.txt:t.mut,cursor:"pointer",border:`1px solid ${E===r?t.bd2:t.bd}`,background:E===r?"#161616":t.panel,fontFamily:U,textTransform:"uppercase"},children:r},r))})]}),l&&!L?e.jsx(St,{R:l,tickerA:a,tickerB:c,mode:E}):e.jsx("div",{style:{flex:1,minHeight:330,display:"flex",alignItems:"center",justifyContent:"center",color:t.mut},children:L?"Loading FMP series\u2026":"Enter two tickers to analyze"})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",minHeight:0,borderLeft:`1px solid ${t.bd}`,background:"#030303"},children:[e.jsx("div",{style:{display:"flex",borderBottom:`1px solid ${t.bd}`},children:["fund","signal","stats"].map(r=>e.jsx("button",{type:"button",onClick:()=>n(r),style:{flex:1,textAlign:"center",padding:"8px 0",fontSize:10,letterSpacing:1.3,color:z===r?t.txt:t.mut,cursor:"pointer",border:"none",borderRight:`1px solid ${t.bd}`,background:z===r?"#0d0d0d":"transparent",fontFamily:U,textTransform:"uppercase"},children:r==="fund"?"FUNDAMENTALS":r==="signal"?"SIGNAL":"STATS"},r))}),e.jsxs("div",{style:{overflowY:"auto",flex:1},children:[z==="fund"&&g&&h&&l?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1.3fr 1fr 1fr",padding:"9px 14px",borderBottom:`1px solid ${t.bd}`,fontSize:10,letterSpacing:1},children:[e.jsx("span",{style:{color:t.mut},children:"METRIC"}),e.jsx("span",{style:{color:t.aclr,textAlign:"right"},children:a}),e.jsx("span",{style:{color:t.bclr,textAlign:"right"},children:c})]}),[["Sector",{raw:0,t:g.sector},{raw:0,t:h.sector}],["Mkt Cap",{raw:g.mcap,t:at(g.mcap)},{raw:h.mcap,t:at(h.mcap)},"hi"],["P/E",{raw:g.pe,t:o(g.pe,1)+"\xD7"},{raw:h.pe,t:o(h.pe,1)+"\xD7"},"lo"],["P/S",{raw:g.ps,t:o(g.ps,1)+"\xD7"},{raw:h.ps,t:o(h.ps,1)+"\xD7"},"lo"],["EBIT margin",{raw:g.mgn,t:o(g.mgn,0)+"%"},{raw:h.mgn,t:o(h.mgn,0)+"%"},"hi"],["Rev growth",{raw:g.grw,t:H(g.grw,0)+"%"},{raw:h.grw,t:H(h.grw,0)+"%"},"hi"],["Div yield",{raw:g.div,t:o(g.div,1)+"%"},{raw:h.div,t:o(h.div,1)+"%"},"hi"],["Beta (mkt)",{raw:g.beta,t:o(g.beta,2)},{raw:h.beta,t:o(h.beta,2)}],["Ann vol",{raw:l.volA,t:o(l.volA*100,1)+"%"},{raw:l.volB,t:o(l.volB*100,1)+"%"},"lo"],["Ann return",{raw:l.retA,t:H(l.retA*100,1)+"%"},{raw:l.retB,t:H(l.retB*100,1)+"%"},"hi"]].map(r=>e.jsx(jt,{k:r[0],va:r[1],vb:r[2],better:r[3]},r[0]))]}):null,z==="signal"&&l?e.jsxs("div",{children:[(()=>{const r=l.zNow,j=r>2?`SHORT SPREAD \xB7 short ${a} / long ${c}`:r<-2?`LONG SPREAD \xB7 long ${a} / short ${c}`:"NEUTRAL \xB7 inside \xB12\u03C3 band",Y=r>2?t.dn:r<-2?t.up:t.mut,et=Math.max(2,Math.min(98,50+r/3*50));return e.jsxs("div",{style:{padding:16},children:[e.jsxs("div",{style:{fontSize:10,letterSpacing:1.5,color:t.mut,marginBottom:10},children:["CURRENT SPREAD Z-SCORE \xB7 ln(",a,") \u2212 ",o(l.hedge,2),"\xB7ln(",c,")"]}),e.jsxs("div",{style:{fontSize:34,fontWeight:500,color:Y},children:[H(r,2),"\u03C3"]}),e.jsx("div",{style:{fontSize:12,letterSpacing:1,marginTop:8,marginBottom:14,color:Y},children:j}),e.jsxs("div",{style:{height:34,position:"relative",background:"linear-gradient(90deg,rgba(94,194,126,.16),transparent 35%,transparent 65%,rgba(217,106,106,.16))",border:`1px solid ${t.bd}`,marginBottom:6},children:[e.jsx("div",{style:{position:"absolute",left:"50%",top:0,bottom:0,width:1,background:t.bd2}}),e.jsx("div",{style:{position:"absolute",left:`${et}%`,top:-3,bottom:-3,width:2,background:t.line}})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:9,color:t.mut2,marginBottom:16},children:[e.jsx("span",{children:"\u22123\u03C3"}),e.jsx("span",{children:"\u22122\u03C3"}),e.jsx("span",{children:"0"}),e.jsx("span",{children:"+2\u03C3"}),e.jsx("span",{children:"+3\u03C3"})]})]})})(),[["Hedge ratio (\u03B2)",o(l.hedge,2)+"\xD7"],["Half-life",Number.isFinite(l.hl)?o(l.hl,0)+"d":"non-mean-rev"],["% time |z|>2",o(l.pctBand*100,1)+"%"],["Correlation \u03C1",o(l.corr,2)],["R\xB2",o(l.r2,2)],["Tradeable?",l.corr>.5&&Number.isFinite(l.hl)&&l.hl<60?"yes \u2014 co-integrated-ish":"weak basis"]].map(([r,j])=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"7px 16px",borderBottom:`1px solid ${t.grid}`,fontSize:11.5},children:[e.jsx("span",{style:{color:t.mut},children:r}),e.jsx("span",{style:{color:t.txt2},children:j})]},r))]}):null,z==="stats"&&l?e.jsx(e.Fragment,{children:[["Correlation \u03C1 (Pearson)",o(l.corr,3)],["R\xB2",o(l.r2,3)],[`\u03B2 ${a} \u2192 ${c}`,o(l.beta,3)],[`\u03B2 ${c} \u2192 ${a}`,o(l.r2/Math.max(l.beta,1e-9),3)],["Covariance (daily)",o(rt(l.rb,l.ra).cov*1e4,3)+"e-4"],[`Ann vol ${a}`,o(l.volA*100,1)+"%"],[`Ann vol ${c}`,o(l.volB*100,1)+"%"],[`Ann return ${a}`,H(l.retA*100,1)+"%"],[`Ann return ${c}`,H(l.retB*100,1)+"%"],["Diversification",o((1-l.corr)*50,0)+"% benefit"],["Observations",l.ra.length+" daily"]].map(([r,j])=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"7px 16px",borderBottom:`1px solid ${t.grid}`,fontSize:11.5},children:[e.jsx("span",{style:{color:t.mut},children:r}),e.jsx("span",{style:{color:t.txt2},children:j})]},r))}):null]})]})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",height:26,padding:"0 16px",borderTop:`1px solid ${t.bd}`,background:"#020202",fontSize:10,letterSpacing:1,color:t.mut},children:[e.jsxs("span",{children:[e.jsxs("span",{style:{color:t.up},children:["\u25CF ",T?"LIVE":"\u2014"]}),"\xA0\xA0FMP DAILY LOG RETURNS \xB7 OLS \u03B2 \xB7 SPREAD Z"]}),e.jsx("span",{style:{fontVariantNumeric:"tabular-nums"},children:Z})]})]})})}});
1export{zt as __tla,mt 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.