1import{A as Y,x as G}from"./index-CjIeyhK0.js";import"./framer-vendor-BQFVqQmJ.js";import"./chart-vendor-D7KebX4S.js";import"./supabase-vendor-DJa18kbt.js";const Z=["SPX","NDX","N225","HSI","DXY","TNX","UST2Y","USDJPY","GOLD","BTC","VIX"].filter(t=>t in Y);let y=0;const K=5*60*1e3;let v=0;const R=2*60*1e3;async function tt(t){const n=Y[t];if(!(n!=null&&n.binanceSymbol)||Date.now()<v)return null;try{const o=`https://api.binance.com/api/v3/ticker/24hr?symbol=${encodeURIComponent(n.binanceSymbol)}`,e=await fetch(o,{signal:AbortSignal.timeout(8e3)});if(!e.ok)return(e.status===429||e.status>=500)&&(v=Date.now()+R),null;const s=await e.json(),a=Number((s==null?void 0:s.lastPrice)??0),i=Number((s==null?void 0:s.priceChangePercent)??0);return!Number.isFinite(a)||a<=0?null:{symbol:t,price:a,change24h:Number.isFinite(i)?i:0,timestamp:Date.now()}}catch{return v=Date.now()+R,null}}async function et(t,n,o){var s,a,i,h;const e=Y[t];if(!(e!=null&&e.yahooSymbol)||!n||Date.now()<y)return null;try{const u=encodeURIComponent(e.yahooSymbol),k=`${n}/functions/v1/yahoo-finance-proxy?symbols=${u}&range=1d&interval=1d`,c=await fetch(k,{headers:G({anonKey:o}),signal:AbortSignal.timeout(12e3)});if(!c.ok)return(c.status>=500||c.status===401||c.status===403)&&(y=Date.now()+K),null;const f=await c.json(),d=(h=(i=(a=(s=f==null?void 0:f.results)==null?void 0:s[e.yahooSymbol])==null?void 0:a.chart)==null?void 0:i.result)==null?void 0:h[0],m=d==null?void 0:d.meta;if(!m)return null;const p=Number(m.regularMarketPrice??m.previousClose??0),C=Number(m.chartPreviousClose??m.previousClose??p),S=C>0?(p-C)/C*100:0;return!Number.isFinite(p)||p<=0?null:{symbol:t,price:p,change24h:Number.isFinite(S)?S:0,timestamp:Date.now()}}catch{return y=Date.now()+K,null}}function _(t,n,o,e){const s=new Date(Date.UTC(t,n,1));let a=0;for(;s.getUTCMonth()===n;){if(s.getUTCDay()===o&&(a+=1,a===e))return new Date(s);s.setUTCDate(s.getUTCDate()+1)}return new Date(Date.UTC(t,n,1))}function F(t,n,o){const e=new Date(Date.UTC(t,n+1,0));for(;e.getUTCDay()!==o;)e.setUTCDate(e.getUTCDate()-1);return new Date(e)}function T(t,n,o){const e=new Date(Date.UTC(t,n,o)),s=e.getUTCDay();return s===6&&e.setUTCDate(e.getUTCDate()-1),s===0&&e.setUTCDate(e.getUTCDate()+1),e}function W(t){const n=t%19,o=Math.floor(t/100),e=t%100,s=Math.floor(o/4),a=o%4,i=Math.floor((o+8)/25),h=Math.floor((o-i+1)/3),u=(19*n+o-s-h+15)%30,k=Math.floor(e/4),c=e%4,f=(32+2*a+2*k-u-c)%7,d=Math.floor((n+11*u+22*f)/451),m=Math.floor((u+f-7*d+114)/31)-1,p=(u+f-7*d+114)%31+1;return new Date(Date.UTC(t,m,p))}function r(t){return t.toISOString().slice(0,10)}function H(t){const n=W(t),o=new Date(n);return o.setUTCDate(o.getUTCDate()-2),new Set([r(T(t,0,1)),r(_(t,0,1,3)),r(_(t,1,1,3)),r(o),r(F(t,4,1)),r(T(t,5,19)),r(T(t,6,4)),r(_(t,8,1,1)),r(_(t,10,4,4)),r(T(t,11,25))])}function Q(t){const n=W(t),o=new Date(n);o.setUTCDate(o.getUTCDate()-2);const e=new Date(n);return e.setUTCDate(e.getUTCDate()+1),new Set([r(T(t,0,1)),r(o),r(e),r(_(t,4,1,1)),r(F(t,4,1)),r(F(t,7,1)),r(T(t,11,25)),r(T(t,11,26))])}function $(t){const n=[new Date(Date.UTC(t,0,1)),_(t,0,1,2),new Date(Date.UTC(t,1,11)),new Date(Date.UTC(t,1,23)),new Date(Date.UTC(t,3,29)),new Date(Date.UTC(t,4,3)),new Date(Date.UTC(t,4,4)),new Date(Date.UTC(t,4,5)),_(t,6,1,3),new Date(Date.UTC(t,7,11)),_(t,8,1,3),_(t,9,1,2),new Date(Date.UTC(t,10,3)),new Date(Date.UTC(t,10,23))];return new Set(n.map(o=>r(o)))}function P(t,n){const o=new Intl.DateTimeFormat("en-GB",{timeZone:n,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1,weekday:"short"}).formatToParts(t),e=Object.fromEntries(o.map(d=>[d.type,d.value])),s={Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6},a=Number(e.year),i=Number(e.month),h=Number(e.day),u=Number(e.hour),k=Number(e.minute),c=s[e.weekday]??0,f=`${String(a).padStart(4,"0")}-${String(i).padStart(2,"0")}-${String(h).padStart(2,"0")}`;return{year:a,month:i,day:h,hour:u,minute:k,weekday:c,dateKey:f}}function E(t,n,o,e,s,a){const i=t*60+n,h=o*60+e,u=s*60+a;return i>=h&&i<=u}function nt(t){const n=P(t,"Asia/Tokyo"),o=P(t,"Europe/London"),e=P(t,"America/Ne
1w_York"),s=n.weekday>=1&&n.weekday<=5&&!$(n.year).has(n.dateKey)&&E(n.hour,n.minute,9,0,15,0),a=o.weekday>=1&&o.weekday<=5&&!Q(o.year).has(o.dateKey)&&E(o.hour,o.minute,8,0,16,30),i=e.weekday>=1&&e.weekday<=5&&!H(e.year).has(e.dateKey)&&E(e.hour,e.minute,9,30,16,0);return s?{kind:"asia",label:"Asia Session (Tokyo Open)",isOpen:!0,detail:"JP market open"}:a?{kind:"europe",label:"Europe Session (London Open)",isOpen:!0,detail:"UK/EU market open"}:i?{kind:"us",label:"US Session (NYSE Open)",isOpen:!0,detail:"US market open"}:{kind:"closed",label:"Global Cash Markets Closed",isOpen:!1,detail:"Holiday/off-hours calendar gate"}}function ot(t,n,o){const e=n.kind,s=S=>t.get(S),a=s("SPX"),i=s("NDX"),h=s("N225"),u=s("HSI"),k=s("DXY"),c=s("TNX"),f=s("UST2Y"),d=s("USDJPY"),m=s("GOLD"),p=s("BTC"),C=s("VIX");return(()=>{const S=(a==null?void 0:a.change24h)??0,g=(i==null?void 0:i.change24h)??0,w=(((h==null?void 0:h.change24h)??0)+((u==null?void 0:u.change24h)??0))/2,U=(k==null?void 0:k.change24h)??0,b=(c==null?void 0:c.change24h)??0,I=(f==null?void 0:f.price)??0,L=(c==null?void 0:c.price)??0,A=L-I,O=L>0&&I>0&&A<0,N=(d==null?void 0:d.change24h)??0,B=(m==null?void 0:m.change24h)??0,X=(p==null?void 0:p.change24h)??0,J=(C==null?void 0:C.price)??0,l=[];if(!n.isOpen)return[];if(e==="asia"&&(w<=-.6&&U>.15&&l.push({id:"asia_to_usa_riskoff",from:"EM_ASIA",to:"USA",score:Math.abs(w)+U,direction:"risk_off",rationale:"Asia equities weak + DXY bid"}),w<=-.5&&N<-.2&&l.push({id:"asia_to_jpy_riskoff",from:"EM_ASIA",to:"JAPAN",score:Math.abs(w)+Math.abs(N),direction:"risk_off",rationale:"JPY strengthening during Asia selloff"}),w<=-.7&&O&&b>=.08&&l.push({id:"asia_to_bonds_curve_riskoff",from:"EM_ASIA",to:"BONDS",score:Math.abs(w)+Math.abs(A)+b,direction:"risk_off",rationale:"Asia risk-off with inversion and rising 10Y pressure"}),w>.5&&U<-.1&&l.push({id:"usa_to_asia_riskon",from:"USA",to:"EM_ASIA",score:w+Math.abs(U),direction:"risk_on",rationale:"Risk appetite rotating into Asia"})),e==="europe"){const D=Math.abs(S)*.45+Math.abs(w)*.55;D>1.1&&U>.12&&l.push({id:"europe_to_usa_riskoff",from:"EUROPE",to:"USA",score:D+U,direction:"risk_off",rationale:"Europe session stress rotating into USD"}),D>1&&B>.2&&l.push({id:"europe_to_gold_riskoff",from:"EUROPE",to:"GOLD",score:D+B,direction:"risk_off",rationale:"Europe stress with safe-haven gold demand"}),O&&b>=.1&&D>.8&&l.push({id:"europe_to_bonds_curve_riskoff",from:"EUROPE",to:"BONDS",score:D+Math.abs(A)+b,direction:"risk_off",rationale:"Curve inversion + rising 10Y drives bond-safety allocation"}),U<-.1&&g>.5&&l.push({id:"europe_to_nasdaq_riskon",from:"EUROPE",to:"NASDAQ",score:Math.abs(U)+g,direction:"risk_on",rationale:"Softer USD with growth appetite"})}return e==="us"&&((S+g)/2<=-.8&&N<-.25&&l.push({id:"usa_to_jpy_riskoff",from:"USA",to:"JAPAN",score:Math.abs((S+g)/2)+Math.abs(N),direction:"risk_off",rationale:"US risk unwind toward JPY"}),O&&b>=.1&&(S<-.5||g<-.7)&&l.push({id:"nasdaq_to_bonds_curve_riskoff",from:"NASDAQ",to:"BONDS",score:Math.abs(g)+Math.abs(A)+b,direction:"risk_off",rationale:"US growth de-risking into UST as curve inverts"}),S>.6&&g>.7&&U<-.12&&b<=0&&l.push({id:"bonds_to_nasdaq_riskon",from:"BONDS",to:"NASDAQ",score:S+g+Math.abs(U),direction:"risk_on",rationale:"US risk rally with easing rates pressure"}),X>1&&g>.6&&J>0&&J<20&&l.push({id:"gold_to_tech_riskon",from:"GOLD",to:"NASDAQ",score:X+g,direction:"risk_on",rationale:"Liquidity rotating from hedges into beta"})),l.sort((D,M)=>M.score-D.score).slice(0,o).map(D=>{const M=D.score>3?"fast":D.score>1.8?"medium":"slow",j=Math.min(6,1.8+D.score*1.1);return{...D,velocity:M,width:j}})})()}export{Z as ROTATION_INPUTS,ot as computeMoneyFlowPaths,tt as fetchFundFlowBinanceQuote,et as fetchFundFlowYahooQuote,nt as getSessionFromMarketCalendar};
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.