PageSourceSearch

https://pivotzilla.com/assets/SquaredTiming-UkKxQeDk.js

js pivotzilla.com collected 2026-10-05 23:19:07 UTC 35,406 bytes, 46 lines download raw bytes

1import{j as e,r as l}from"./query-D-1Fd3VD.js";import{g as $e,s as Me,ay as qe,G as oe,P as De,B as T,K as P,E as z,m as Pe,h as Re,az as Fe,aA as Oe,aB as Ue,a1 as ue,a2 as pe,aC as Ie,aD as ze,aE as Ge,aF as Be}from"./index-CiuSZZkR.js";import{p as V,s as Ye,a as We,D as Ke,F as Ze,b as He,c as Ve}from"./prelude-BYy4H2qT.js";import{c as Qe}from"./clipboard-B207ZX-_.js";import{A as Je}from"./AlertBox-wR2MCYHn.js";import"./react-vendor-BFQkvBUU.js";import"./firebase-BcC49jKU.js";import"./analytics-CYLNOODP.js";const v={label:"0.00, 0.00 (Crypto default)",lat:0,lon:0,tz:"UTC"},Q=[v,{label:"Chicago",lat:41.8781,lon:-87.6298,tz:"America/Chicago"},{label:"New York",lat:40.7128,lon:-74.006,tz:"America/New_York"},{label:"São Paulo",lat:-23.5505,lon:-46.6333,tz:"America/Sao_Paulo"},{label:"London",lat:51.5074,lon:-.1278,tz:"Europe/London"},{label:"Zurich",lat:47.3769,lon:8.5417,tz:"Europe/Zurich"},{label:"Frankfurt",lat:50.1109,lon:8.6821,tz:"Europe/Berlin"},{label:"Dubai",lat:25.2048,lon:55.2708,tz:"Asia/Dubai"},{label:"Mumbai",lat:19.076,lon:72.8777,tz:"Asia/Kolkata"},{label:"Singapore",lat:1.3521,lon:103.8198,tz:"Asia/Singapore"},{label:"Hong Kong",lat:22.3193,lon:114.1694,tz:"Asia/Hong_Kong"},{label:"Shanghai",lat:31.2304,lon:121.4737,tz:"Asia/Shanghai"},{label:"Tokyo",lat:35.6762,lon:139.6503,tz:"Asia/Tokyo"},{label:"Sydney",lat:-33.8688,lon:151.2093,tz:"Australia/Sydney"}],Xe={ESUSD:"Chicago",XAUUSD:"New York",SPYUSD:"New York"};function et(t){const n=Xe[t];return n?Q.find(s=>s.label===n)??v:v}function tt(t,n){const s=t.getTime()-n.getTime();if(s<=0)return"now";const r=Math.round(s/6e4),c=Math.floor(r/1440),d=Math.floor(r%1440/60),h=r%60;return c>0?`in ${c}d ${d}h`:d>0?`in ${d}h ${h}m`:`in ${h}m`}function at(t,n){return`${Math.max(1,Math.round((n.getTime()-t.getTime())/6e4))} min`}const st=864e5,xe=["SUN","MON","TUE","WED","THU","FRI","SAT"];function nt(t,n){const s=Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()),r=Date.UTC(n.getUTCFullYear(),n.getUTCMonth(),n.getUTCDate());return Math.round((s-r)/st)}function le(t){return t.toISOString().slice(0,10)}function rt(t){const n=String(t.getUTCDate()).padStart(2,"0");return`${xe[t.getUTCDay()]} ${n}`}function ot(t,n){const s=nt(t,n);if(s===0)return"Today";if(s===1)return"Tomorrow";if(s===-1)return"Yesterday";const r=xe[t.getUTCDay()];return`${r[0]}${r.slice(1).toLowerCase()} ${t.getUTCDate()}`}function lt(t){return t==="P"?"Price ladder":t==="D"?"Anniversary":t==="G"?"Degree grid":t==="D72"?"72° steps":t==="D180"?"Opposition":t}function it(t,n,s){const r=new Date(n);if(Number.isNaN(r.getTime()))return t;const c=t==="top"?"high":t==="bottom"?"low":t,d=r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hourCycle:"h23",timeZone:"UTC"});if(r.toISOString().slice(0,10)===s.toISOString().slice(0,10))return`${c} ${d}`;const g=r.toLocaleDateString([],{weekday:"short",timeZone:"UTC"});return`${c} ${g} ${d}`}function ct(t){if(!t)return null;const n=new Date(t);return Number.isNaN(n.getTime())?null:`updated ${n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hourCycle:"h23",timeZone:"UTC"})} UTC`}function dt(t){return t.category==="price-time"?"price":t.category==="timing"?"time":"other"}function ht(t){return t<=0?0:Math.max(1,Math.ceil(t/3))}function mt(t){const n=ht(t.length);if(n>=t.length)return t;const s=new Set(t.map((r,c)=>({i:c,s:r.strength})).sort((r,c)=>c.s-r.s||r.i-c.i).slice(0,n).map(r=>r.i));return t.filter((r,c)=>s.has(c))}function ut(t,n){const s=n.ladder==="all"?t:t.filter(r=>dt(r)===n.ladder);return n.topRated?mt(s):s}const ge=1.15,be=.95;function fe(t){return t>=ge?"strong":t<be?"soft":"neutral"}const G={strong:"#D8B45F",neutral:"#8E909C",soft:"#5C4B2E"},ye={strong:3,neutral:2,soft:1};function ie(t){return t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hourCycle:"h23",timeZone:"UTC"})}function pt({window:t,rank:n,now:s,isNext:r,index:c=0}){const d=t.end.getTime()<s.getTime(),h=t.provenance??[],g=fe(t.strength),_=ye[g],E=r?"border-border-focus shadow-glow-cyan":d?"border-border-subtle opacity-55":g==="strong"?"border-brass-soft shadow-glow-brass hover:border-brass-muted":"border-border-subtle hover:border-border-strong",y=r?"bg-cyan-signal":d?"bg-ash-soft":"bg-brass-muted";return e.jsxs("div",{"data-testid":"sky-window","data-next":r?"true":void 0,"data-strength":g,className:["relative block w-full overflow-hidden rounded-lg border bg-bg-surface py-4 pl-6 pr-5","transition-all duration-fast ease-standard animate-rise",d?"":"hover:-translate-y-
1px",E].filter(Boolean).join(" "),style:{animationDelay:`${Math.min(c,12)*45}ms`},children:[e.jsx("span",{"aria-hidden":"true",className:`absolute inset-y-0 left-0 w-[2px] ${y}`}),e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[e.jsx("span",{className:`font-mono text-micro tabular-nums ${r?"text-cyan-signal":"text-text-muted"}`,children:String(n).padStart(2,"0")}),e.jsx("span",{className:"font-mono text-small uppercase tracking-data text-text-secondary",children:rt(t.start)}),e.jsxs("span",{className:"font-mono text-h3 tracking-data text-text-primary",children:[ie(t.start),e.jsx("span",{className:"text-text-muted",children:"–"}),ie(t.end),e.jsx("span",{className:"ml-1 text-micro text-text-muted",children:"UTC"})]}),r&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded-pill border border-cyan-muted/40 bg-cyan-soft/30 px-2 py-[1px] font-mono text-micro uppercase tracking-data text-cyan-signal",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-pill bg-cyan-signal motion-safe:animate-pulse"}),"Next"]}),e.jsx("span",{className:`ml-auto font-mono text-small tabular-nums ${r?"text-cyan-signal":d?"text-text-muted":"text-brass-base"}`,children:d?"passed":tt(t.start,s)})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[e.jsx("span",{className:"rounded-sm border border-brass-soft bg-brass-soft/10 px-2 py-[2px] font-mono text-micro uppercase tracking-data text-brass-base",children:t.category}),e.jsxs("span",{className:"font-mono text-micro text-text-muted",children:["· ",at(t.start,t.end)]}),e.jsx("span",{className:"ml-auto font-mono text-small tracking-data text-atomic-base","aria-label":`quality ${t.quality}`,children:"◆".repeat(_)})]}),h.length>0&&e.jsx("ul",{"data-testid":"sky-window-provenance",className:"mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 border-t border-border-subtle pt-2",children:h.map(p=>e.jsxs("li",{className:"font-mono text-micro text-text-muted",children:[e.jsx("span",{className:"text-text-secondary",children:lt(p.ladder)})," rung ",e.jsx("span",{className:"tabular-nums text-text-secondary",children:p.rung})," ← ",it(p.anchor.kind,p.anchor.t,s)]},`${p.ladder}-${p.rung}-${p.anchor.kind}-${p.anchor.t}`))})]})}function C({children:t}){return e.jsx("h3",{className:"mb-1 mt-4 font-body text-small font-medium tracking-tight text-text-primary",children:t})}function f({children:t}){return e.jsx("p",{className:"m-0 mt-1.5 max-w-[74ch] font-body text-small leading-snug text-text-secondary",children:t})}function xt(){return e.jsxs("details",{"data-testid":"sky-squares-guide",className:"group mb-5 rounded-md border border-border-subtle bg-bg-raised px-4 py-3",children:[e.jsxs("summary",{className:"cursor-pointer list-none",children:[e.jsxs("span",{className:"flex items-baseline justify-between gap-3",children:[e.jsx("span",{className:"font-body text-small font-medium tracking-tight text-text-primary",children:"How to use Sky Squares"}),e.jsxs("span",{className:"shrink-0 font-mono text-micro uppercase tracking-data text-cyan-signal",children:[e.jsx("span",{className:"group-open:hidden",children:"Read →"}),e.jsx("span",{className:"hidden group-open:inline",children:"Close"})]})]}),e.jsxs("span",{className:"mt-1.5 block max-w-[74ch] font-body text-small leading-snug text-text-secondary",children:["Moments worth watching, built from where the sky stood when the market last turned. Windows are bands, not points — and they say ",e.jsx("em",{children:"when to look"}),", never what to do."]})]}),e.jsxs("div",{className:"mt-4 border-t border-border-subtle pt-3",children:[e.jsx(C,{children:"Why your location changes everything"}),e.jsxs(f,{children:["The Ascendant — the degree rising on the eastern horizon, the fastest-moving angle in the sky — depends on where you stand. Two observers at the same instant see different degrees rising, so changing the location moves ",e.jsx("em",{children:"every"})," window. There is no universal answer: pick the exchange you consider the asset’s home, or your own position, and stay consistent. Jumping between locations produces boards you cannot compare."]}),e.jsx(C,{children:"The two ladders"}),e.jsxs(f,{children:[e.jsx("strong",{className:"text-text-primary",children:"Price (P)"}
1)," converts the anchor’s price to a degree on a circle, then marks each point where the Ascendant has swept a multiple of it — the price itself sets the angular step. It asks: ",e.jsx("em",{children:"when does time catch up with this price?"})]}),e.jsxs(f,{children:[e.jsx("strong",{className:"text-text-primary",children:"Time (D)"})," uses the Ascendant’s own position at the anchor instant as the step, and price never enters. This is the classical anniversary family. It asks: ",e.jsx("em",{children:"when does the clock come back to this moment?"})]}),e.jsx(C,{children:"Linear or √ Wheel"}),e.jsxs(f,{children:["This changes ",e.jsx("strong",{className:"text-text-primary",children:"only"})," how a price becomes a degree, on the P ladder. It has no effect on D windows.",e.jsx("strong",{className:"text-text-primary",children:" Linear"})," maps price into the circle proportionally, treating the price scale as flat.",e.jsx("strong",{className:"text-text-primary",children:" √ Wheel"})," takes the square root first, in the Square of Nine manner, so prices far apart in dollars can sit close together in degrees."]}),e.jsxs(f,{children:["Neither is correct — they are two defensible answers to a question the literature leaves open, and they ",e.jsx("em",{children:"will"})," disagree. Run both. Where they agree you have a moment robust to the conversion choice; where they disagree, the choice is doing the work rather than the market. If you only use one, use Linear: it assumes less."]}),e.jsx(C,{children:"Reading a window"}),e.jsxs(f,{children:[e.jsx("strong",{className:"text-text-primary",children:"Strength"})," is how well the rest of the sky supports that instant — supporting transits, the Moon’s position, and whether the Moon is void of course. ",e.jsx("strong",{className:"text-text-primary",children:"Quality"})," counts how many independent methods land on the same window."," ",e.jsx("strong",{className:"text-text-primary",children:"Provenance"})," names the ladder, the rung and the pivot the window descends from. That last line is the one that matters:"," ",e.jsx("strong",{className:"text-text-primary",children:"if the anchor it names is not a pivot you would have marked on your own chart, discount the window."})]}),e.jsx(C,{children:"Filters"}),e.jsxs(f,{children:[e.jsx("strong",{className:"text-text-primary",children:"Price / Time"})," show one ladder alone. A ladder selection can empty the board, and that is normal — the two rarely fire at the same moment, so on many days one has nothing to say."," ",e.jsx("strong",{className:"text-text-primary",children:"Top rated"})," keeps the strongest third of what is on screen. It always cuts, including on a quiet week when many windows share a Strength — on a flat week treat it as “show me fewer”, not a ranking."," ",e.jsx("strong",{className:"text-text-primary",children:"Confirmed only"})," hides windows the surrounding sky does not support."]}),e.jsx(C,{children:"If the board looks short or empty"}),e.jsx(f,{children:"The surface caps how much of the week it may cover — if windows blanketed the week, a window containing a pivot would mean nothing — so a short board is that working. If it says the anchors are stale, the pivot pool is behind and the surface is holding windows back rather than showing them wrong; stale anchors give precisely-wrong times, not vaguer ones. “Not generated yet” clears at the next refresh."}),e.jsx(C,{children:"A workflow that works"}),e.jsx(f,{children:"Fix your location and leave it alone. Run Linear, then √ Wheel, and note where they agree. Turn on Confirmed only to see which survive the sky check. Read the provenance on the survivors and find each named pivot on your own chart. Treat what remains as where to pay attention — then apply your own read of price."}),e.jsx("p",{className:"m-0 mt-4 max-w-[74ch] border-t border-border-subtle pt-3 font-mono text-micro leading-relaxed tracking-data text-text-muted",children:"A timing tool, in the same category as a Gann fan or a Fibonacci grid — a structure you overlay to organise attention. Not predictive, and no hit rate is claimed, because none has been established. Windows carry no direction and no size. A window with nothing happening in it is the normal case."})]})]})}const gt=[{tier:"strong",label:"Strong",blurb:`confirmation is amplifying this moment (×${ge} or more)`},{tier:"neutral",label:"Neutral",blurb:"nothing for it, nothing against it — the baseline"},{tier:"soft",label:"Soft",blurb:`confirmation is damping it (below ×${be})`}];function bt(){return e.jsxs("section",{"data-testid":"sky-strength-legend","aria-label":"Strength legend",className:"my-3 rounded-lg border border-border-subtle bg-bg-surface px-4 py-3",children:[e.jsx("h2",{className:"mb-2 font-mono text-micro uppercase tracking-data text-text-muted",children:"Reading the strength"}),e.jsx("ul",{className:"m-0 grid list-none gap-y-2 p-0 sm:grid-cols-3 sm:gap-x-4",children:gt.map(({tier:t,label:n,blurb:s})=>e.jsxs("li",{className:"flex items-start gap-2.5",children:[e.jsx("span",{"aria-hidden":"true",className:"mt-1 h-3 w-[3px] shrink-0 rounded-pill",style:{backgroundColor:G[t]}}),e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"font-mono text-micro uppercase tracking-data text-text-primary",children:n}),e.jsx("span",{"aria-hidden":"true",className:"ml-2 font-mono text-micro text-brass-muted",children:"◆".repeat(ye[t])}),e.jsx("span",{className:"block font-body text-small leading-snug text-text-secondary",children:s})]})]},t))}),e.jsx("p",{className:"mt-2.5 mb-0 max-w-[68ch] font-body text-small leading-snug text-text-secondary",children:"Every window is the same kind of event — the tier weights it, it does not change the geometry. Colours are the exported chart’s defaults and can be changed in the indicator’s own settings."})]})}function ft(t){return t>0?10**(4-Math.floor(Math.log10(t))):1}const ce=fe;function de({windows:t,anchor:n=null}){const s=[],r={soft:0,neutral:1,strong:2},c=V(t.map(m=>m.start.getTime())),d=V(t.map(m=>
1r[ce(m.strength)]));s.push("    if show_windows and array.size(_w_ms) > 0","        for _i = 0 to array.size(_w_ms) - 1","            _ms = array.get(_w_ms, _i)","            if f_vis(_ms)","                _tr = array.get(_w_tier, _i)","                _col = _tr == 2 ? c_strong : _tr == 0 ? c_soft : c_neutral","                _wd = _tr == 2 ? 2 : 1","                array.push(_sq_lines, line.new(x1=_ms, x2=_ms, y1=close, y2=close, xloc=xloc.bar_time, extend=extend.both, color=_col, width=_wd))","                if _tr == 2",'                    array.push(_sq_labels, label.new(x=_ms, y=_phi, xloc=xloc.bar_time, text="◆", color=color.new(c_strong, 80), textcolor=c_strong, style=label.style_label_down, size=size.tiny))'),s.push("    if show_levels and _lvl_px > 0",'        _st = lvl_step == "360" ? 1.0 : lvl_step == "180" ? 0.5 : 0.25',"        _rt = math.sqrt(_lvl_px * _lvl_s)","        for _k = 1 to lvl_count","            _up = math.pow(_rt + _k * _st, 2) / _lvl_s","            _dn = math.pow(math.max(_rt - _k * _st, 0.0), 2) / _lvl_s","            array.push(_sq_lines, line.new(x1=bar_index - 1, x2=bar_index, y1=_up, y2=_up, extend=extend.both, color=c_levels, width=1, style=line.style_dotted))","            if _dn > 0","                array.push(_sq_lines, line.new(x1=bar_index - 1, x2=bar_index, y1=_dn, y2=_dn, extend=extend.both, color=c_levels, width=1, style=line.style_dotted))");const h=t.map(m=>({ms:m.start.getTime(),txt:Ye(`squared window (${ce(m.strength)})`)})),g=h.length?Math.max(...h.map(m=>m.ms)):0,_=V(h.map(m=>m.ms)),E=We(h.map(m=>m.txt)),y=n&&n.price>0?n.price:0,p=y>0?ft(y):1;return s.unshift(...Ve("Sky Squares")),s.unshift("    for _ln in _sq_lines","        line.delete(_ln)","    array.clear(_sq_lines)","    for _lb in _sq_labels","        label.delete(_lb)","    array.clear(_sq_labels)"),{script:`//@version=6
2indicator("PivotZilla · Sky Squares", overlay=true, max_lines_count=500, max_labels_count=500)
3${Ke}
4// Best timeframe: 1m–1h intraday; higher tfs auto-thin.
5show_windows = input.bool(true, "Squared windows", group="Layers")
6// Density — clamps the drawable range to a bar budget that scales with the tf.
7lookahead_days = input.int(14, "Look ahead (days)", minval=1, group="Density")
8lookback_days  = input.int(7,  "Look back (days)",  minval=1, group="Density")
9// Alerts — create ONE "Any alert() function call" alert in TradingView.
10alert_lead_hours = input.int(6,    "Alert lead time (hours)", minval=1, group="Alerts")
11alert_windows    = input.bool(true, "Alert: squared windows", group="Alerts")
12show_levels = input.bool(${n?"true":"false"}, "Square-of-9 price levels", group="Layers")
13lvl_step    = input.string("90", "Rung spacing (degrees)", options=["360", "180", "90"], group="Levels")
14lvl_count   = input.int(6, "Rungs each side", minval=1, maxval=24, group="Levels")
15c_levels    = input.color(#6E7681, "Level lines", group="Colours")
16c_strong  = input.color(${G.strong}, "Strong (confirmed)", group="Colours")
17c_neutral = input.color(${G.neutral}, "Neutral", group="Colours")
18c_soft    = input.color(${G.soft}, "Soft", group="Colours")
19${Ze}
20// Baked window starts for alerting + the staleness horizon (last window).
21_stale_ms = ${g}
22var int[]    _al_ms   = ${_}
23var string[] _al_txt  = ${E}
24var bool[]   _al_done = array.new_bool(${h.length}, false)
25${He({msgPrefix:"PivotZilla Sky Squares · ",onExpr:"alert_windows"})}
26// Top of the visible range, for placing the strong-window markers near the top.
27_phi = ta.highest(high, 250)
28// Track every drawn line/label so each frame can delete the previous set (see the
29// clear loop at the top of the islast body) — without this, closed intraday bars
30// pile up doubled/tripled markers.
31var line[]  _sq_lines  = array.new_line()
32var label[] _sq_labels = array.new_label()
33// Baked window geometry: start instant + strength tier (0 soft, 1 neutral,
34// 2 strong). Drawn by the loop below so the islast body stays constant-size.
35var int[] _w_ms   = ${c}
36var int[] _w_tier = ${d}
37// Reference price for the level ladder, plus its auto scale. Rungs are
38// (sqrt(p*s) +- n*step)^2 / s, computed on the chart so the spacing and count
39// inputs stay live. 0 means no reference was available and the layer is off.
40_lvl_px = ${y}
41_lvl_s  = ${p}
42if barstate.islast
43${s.join(`
44`)}
45`,lineCount:s.length}}const he="Above the Arctic Circle the Ascendant swings back and forth across a limited arc of the zodiac instead of sweeping the full circle each day, so many Square-of-9 rungs are never reached from here. The windows below are the ones that genuinely occur — a short list is expected at this latitude.",yt=["auto",2,4,6,8,10],wt="BTCUSD",jt=Fe.map(t=>({id:t,label:P[t].shortLabel}));function u({active:t,onClick:n,compact:s=!1,children:r}){return e.jsx("button",{type:"button","aria-pressed":t,onClick:n,className:`${s?Oe:Ue} ${t?ue:pe}`,children:r})}function me({active:t,onClick:n,children:s}){return e.jsxs("button",{type:"button","aria-pressed":t,onClick:n,className:`${Ie} ${t?ue:pe} inline-flex items-center gap-2`,children:[e.jsx("span",{"aria-hidden":"true",className:`${ze} ${t?Ge:Be}`}),s]})}function A({label:t,hint:n,children:s}){return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("span",{className:"flex items-baseline gap-1.5 font-mono text-micro uppercase tracking-data text-text-muted",children:[t,n?e.jsx("span",{className:"font-body normal-case tracking-normal opacity-60",children:n}):null]}),e.jsx("div",{role:"group","aria-label":t,className:"flex flex-wrap items-center gap-1",children:s})]})}function Lt(){const{isPro:t,isPaid:n}=$e(),[s,r]=l.useState("BTCUSD"),[c,d]=l.useState("linear"),[h,g]=l.useState("upcoming"),[_,E]=l.useState(1),[y,p]=l.useState(!1),[w,m]=l.useState("all"),[B,we]=l.useState(!1),[Y,je]=l.useState("auto"),[j,W]=l.useState(null),[R,M]=l.useState("preset"),[N,J]=l.useState(v),[X,F]=l.useState(!1),[k,ee]=l.useState({lat:"",lon:""});l.useEffect(()=>{X||J(et(s))},[s,X]);const[te,ae]=l.useState(!1),[b,ve]=l.useState(null),_e=()=>{navigator.geolocation?.getCurrentPosition(a=>{ve({lat:a.coords.latitude,lon:a.coords.longitude}),M("local"),F(!0)},()=>M("preset"))},L=l.useMemo(()=>{if(!t)return{location:"Null Island",lat:void 0,lon:void 0,label:v.label};if(R==="local"&&b)return{location:"Custom",lat:b.lat,lon:b.lon,label:`📍 ${b.lat.toFixed(2)}, ${b.lon.toFixed(2)}`};if(R==="manual"){const a=Number(k.lat),o=Number(k.lon);return Number.isFinite(a)&&Number.isFinite(o)&&k.lat!==""&&k.lon!==""?{location:"Custom",lat:a,lon:o,label:`Manual ${a}, ${o}`}:{location:"Null Island",lat:void 0,lon:void 0,label:v.label}}return N===v?{location:"Null Island",lat:void 0,lon:void 0,label:N.label}:{location:"Custom",lat:N.lat,lon:N.lon,label:N.label}},[t,R,b,k,N]),K=L.lat!==void 0&&Math.abs(L.lat)>Me,$=!t&&!Pe(s),se=$||!n&&s!==wt,Ne=h==="past"?_:0,ke=t&&Y!=="auto"?Y:void 0,i=qe({asset:s,location:L.location,lat:L.lat,lon:L.lon,pMode:c,lookbackDays:Ne,confirmedOnly:y,anchors:ke,enabled:!se}),Se=i.error instanceof oe&&i.error.status===404,Te=i.error instanceof oe&&i.error.status===503,[O,Ce]=l.useState(()=>new Date);l.useEffect(()=>{const a=setInterval(()=>Ce(new Date),6e4);return()=>clearInterval(a)},[]);const q=l.useMemo(()=>i.data?.windows??[],[i.data]),ne=l.useMemo(()=>ct(i.data?.anchors_asof??null),[i.data]),Z=l.useMemo(()=>{const a=i.data?.anchors_used,o=i.data?.anchors_available;return typeof a!="number"||typeof o!="number"?null:a<o?{used:a,available:o}:null},[i.data]),H=l.useMemo(()=>{const a=i.data?.ladder_depth,o=i.data?.ladder_depth_max;return typeof a!="number"||typeof o!="number"?null:a<o?{depth:a,max:o}:null},[i.data]),S=l.useMemo(()=>ut(q,{ladder:w,topRated:B}),[q,w,B]),Ae=l.useMemo(()=>S.reduce((a,o)=>o.end.getTime()<O.getTime()?a:a===null||o.start.getTime()<a.start.getTime()?o:a,null),[S,O]),U=l.useMemo(()=>{const a=new Map;for(const o of S){const D=le(o.start);a.has(D)||a.set(D,o.start)}return[...a.entries()].sort((o,D)=>o[0].localeCompare(D[0]))},[S]);l.useEffect(()=>{j!==null&&!U.some(([a])=>a===j)&&W(null)},[U,j]);const x=l.useMemo(()=>j===null?S:S.filter(a=>le(a.start)===j),[S,j]),Ee=q.length>0&&x.length===0,Le=l.useMemo(()=>x.length?de({windows:x}).script:"",[x]),re=async()=>{if(!x.length)return;let a=null;try{const I=(await Re.getSkySquaresAnchors(s)).anchors[0];I&&I.price>0&&(a={price:I.price,kind:I.kind})}catch{}const o=de({windows:x,anchor:a}).script;await Qe(o)&&(ae(!0),setTimeout(()=>ae(!1),2e3))};return e.jsxs(De,{width:"screen",children:[e.jsx("h1",{className:"font-mono text-h1",children:"Sky Squares"}),e.jsx("p",{className:"mt-1 max-w-[60ch] font-body text-small text-text-secondary",children:"The Ascendant timed to your pivots’ price wheel — and something older deciding which moments carry weight. A descriptive timing lens, not a prediction."}),e.jsx("div",{className:"mt-4",children:e.jsx(xt,{})}
45),e.jsxs("section",{className:"my-4 rounded-lg border border-border-subtle bg-bg-surface px-4 py-3.5","aria-label":"Controls",children:[e.jsxs("div",{className:"flex flex-wrap items-start gap-x-8 gap-y-4",children:[e.jsx(A,{label:"Asset",children:jt.map(a=>e.jsx(u,{active:s===a.id,onClick:()=>r(a.id),children:a.label},a.id))}),e.jsxs(A,{label:"Price wheel",hint:"price → degree",children:[e.jsx(u,{active:c==="linear",onClick:()=>d("linear"),children:"Linear"}),e.jsx(u,{active:c==="root",onClick:()=>d("root"),children:"√ Wheel"})]}),e.jsxs(A,{label:"Window",children:[e.jsx(u,{active:h==="upcoming",onClick:()=>g("upcoming"),children:"Upcoming"}),e.jsx(u,{active:h==="past",onClick:()=>g("past"),children:"Past"}),h==="past"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":"true",className:"mx-1 h-5 w-px bg-border-subtle"}),e.jsx(u,{active:_===1,onClick:()=>E(1),children:"24h"}),e.jsx(u,{active:_===7,onClick:()=>E(7),children:"7d"})]})]})]}),e.jsx("div",{className:"my-3.5 h-px bg-border-strong"}),e.jsxs("div",{className:"flex flex-wrap items-start gap-x-8 gap-y-4",children:[e.jsxs(A,{label:"Ladder",hint:"which construction",children:[e.jsx(u,{active:w==="all",onClick:()=>m("all"),children:"All"}),e.jsx(u,{active:w==="price",onClick:()=>m("price"),children:"Price"}),e.jsx(u,{active:w==="time",onClick:()=>m("time"),children:"Time"})]}),e.jsx(A,{label:"Anchors",hint:"pivots projected from",children:yt.map(a=>e.jsx(u,{active:Y===a,onClick:()=>je(a),children:a==="auto"?"Auto":a},String(a)))}),e.jsxs(A,{label:"Filters",hint:"on / off",children:[e.jsx(me,{active:B,onClick:()=>we(a=>!a),children:"Top rated"}),e.jsx(me,{active:y,onClick:()=>p(a=>!a),children:"Confirmed only"})]})]}),U.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"my-3.5 h-px bg-border-strong"}),e.jsxs(A,{label:"Day",children:[e.jsx(u,{compact:!0,active:j===null,onClick:()=>W(null),children:"All"}),U.map(([a,o])=>e.jsx(u,{compact:!0,active:j===a,onClick:()=>W(a),children:ot(o,O)},a))]})]})]}),t?e.jsxs("section",{className:"my-4 rounded-lg border border-border-subtle bg-bg-surface px-4 py-3","aria-label":"Location",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-x-5 gap-y-3",children:[e.jsxs("label",{className:"flex items-center gap-2 font-mono text-micro uppercase tracking-data text-text-muted",children:["Preset",e.jsx("select",{value:N.label,onChange:a=>{J(Q.find(o=>o.label===a.target.value)??v),M("preset"),F(!0)},className:"rounded-md border border-brass-soft bg-bg-page px-2.5 py-1.5 font-mono text-small normal-case tracking-normal text-text-primary focus:border-cyan-muted focus:outline-none",children:Q.map(a=>e.jsx("option",{value:a.label,children:a.label},a.label))})]}),e.jsx(T,{type:"button",variant:"secondary",onClick:_e,children:R==="local"&&b?`📍 ${b.lat.toFixed(2)}, ${b.lon.toFixed(2)}`:"Use my location"}),e.jsxs("label",{className:"flex items-center gap-2 font-mono text-micro uppercase tracking-data text-text-muted",children:["Custom",e.jsx("input",{"aria-label":"Manual latitude",placeholder:"lat",inputMode:"decimal",value:k.lat,onChange:a=>{ee(o=>({...o,lat:a.target.value})),M("manual"),F(!0)},className:"w-16 rounded-md border border-border-subtle bg-bg-page px-2 py-1.5 font-mono text-small text-text-primary placeholder:text-text-muted focus:border-cyan-muted focus:outline-none"}),e.jsx("input",{"aria-label":"Manual longitude",placeholder:"lon",inputMode:"decimal",value:k.lon,onChange:a=>{ee(o=>({...o,lon:a.target.value})),M("manual"),F(!0)},className:"w-16 rounded-md border border-border-subtle bg-bg-page px-2 py-1.5 font-mono text-small text-text-primary placeholder:text-text-muted focus:border-cyan-muted focus:outline-none"})]})]}),e.jsxs("p",{className:"mt-2.5 border-t border-border-subtle pt-2.5 font-mono text-micro tracking-data text-text-muted",children:["Computing for ",e.jsx("span",{className:"text-brass-base",children:L.label})]})]}):e.jsxs("div",{className:"my-4 flex items-center gap-2.5 rounded-lg border border-border-subtle bg-bg-surface px-4 py-3 font-body text-small text-text-muted",children:[e.jsx("span",{"aria-hidden":"true",className:"text-brass-muted",children:"◇"}
45),"Location is fixed to ",e.jsx("span",{className:"text-text-secondary",children:"Null Island (0,0)"})," on the free tier — Ascendant unlocks New York, London, Mumbai, and custom coordinates."]}),se?e.jsx("section",{className:"my-4","aria-label":$?"Gold locked":"Asset locked",children:e.jsxs("div",{className:"relative overflow-hidden rounded-xl border border-brass-soft bg-bg-surface shadow-glow-brass",children:[e.jsx("div",{"aria-hidden":"true",className:"space-y-2 p-4 blur-[3px]",style:{opacity:.5},children:[0,1,2,3].map(a=>e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border-subtle bg-bg-page p-3",children:[e.jsx("span",{className:"h-2.5 w-20 rounded-pill bg-border-strong"}),e.jsx("span",{className:"h-2.5 w-16 rounded-pill bg-border-subtle"}),e.jsx("span",{className:"ml-auto h-2.5 w-8 rounded-pill bg-brass-soft"})]},a))}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center px-6 text-center",children:[e.jsx("p",{className:"font-mono text-h3 font-semibold uppercase text-text-primary",children:$?`${P[s].displayName} is an Ascendant asset`:`${P[s].displayName} squares out on Pro`}),e.jsx("p",{className:"mt-2 max-w-[44ch] font-body text-small text-text-secondary",children:$?`Metals square out too — unlock the full ranked ladder for ${P[s].displayName}, with your own location and the √ Square-of-9 wheel mode.`:`${P[s].displayName} squares the same way BTC does. Pro opens every crypto on this board; Ascendant adds the metals, your own location and the √ Square-of-9 wheel.`}),e.jsx(T,{to:$?"/upgrade?from=squared-timing-gold":"/upgrade?from=squared-timing-asset",variant:"marketing",className:"mt-4",children:$?"Unlock Sky Squares →":"Open every crypto →"})]})]})}):i.isError?Se?e.jsx(z,{variant:"quiet-day",title:"Squared windows aren't published yet",body:"The anchor set refreshes hourly at five past the hour — check back shortly."}):Te?e.jsx(z,{variant:"quiet-day",title:"Squared windows are paused",body:"The anchors behind these windows are out of date, so they're being held back rather than shown wrong. This usually clears within the hour.",actions:e.jsx(T,{type:"button",variant:"secondary",onClick:()=>void i.refetch(),children:"Retry"})}):e.jsx(z,{variant:"error",actions:e.jsx(T,{type:"button",variant:"secondary",onClick:()=>void i.refetch(),children:"Retry"})}):i.isLoading||!i.data?e.jsx("p",{className:"my-6 font-body text-text-secondary",children:"Computing squared windows…"}):i.data.windows.length===0?e.jsx(z,{variant:"quiet-day",title:K?"No squared windows at this latitude":"No squared windows in the next 7 days",body:K?he:void 0}):e.jsxs(e.Fragment,{children:[K?e.jsx(Je,{tone:"info",role:"note","aria-label":"polar latitude note",children:e.jsxs("p",{className:"m-0 font-body text-small leading-snug text-text-secondary",children:[e.jsx("strong",{className:"text-text-primary",children:"Polar latitude."})," ",he]})}):null,e.jsx(bt,{}),e.jsxs("section",{className:"my-4","aria-label":"Squared windows",children:[e.jsxs("div",{className:"mb-2 flex flex-wrap items-baseline justify-between gap-x-4 gap-y-2 border-b border-border-subtle pb-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h2",{className:"font-mono text-micro uppercase tracking-data text-text-muted",children:"Ranked windows"}),t&&x.length>0&&e.jsx(T,{type:"button",variant:"secondary",onClick:re,children:te?"✓ Pine copied":"Copy Pine"})]}),e.jsxs("span",{className:"font-mono text-micro tracking-data text-text-muted",children:[x.length,q.length!==x.length?e.jsxs(e.Fragment,{children:[" of ",q.length]}):null," · ",c==="root"?"√ wheel":"linear",Z?e.jsxs(e.Fragment,{children:[" · ",e.jsxs("span",{title:"The occupancy ceiling trimmed the weakest anchors from this board. The surface caps how much of the week it may cover, and this instrument's pool was over that cap.",children:[Z.used," of ",Z.available," anchors"]})]}):null,H?e.jsxs(e.Fragment,{children:[" · ",e.jsxs("span",{title:"The occupancy ceiling shortened the ladder rather than dropping anchors, so every turning point is still on the board but each projects less far ahead. The furthest rungs are the most extrapolated, so they give way first.",children:[H.depth," of ",H.max," rungs"]})]}):null,i.data?.coverage_pct!==null&&i.data?.coverage_pct!==void 0?e.jsxs(e.Fragment,{children:[" · ",e.jsxs("span",{title:"Share of the next 7 days covered by these windows. More anchors means more windows, but also more of the week covered — a window means less when it covers more.",children:[i.data.coverage_pct.toFixed(1),"% of week"]})]}):null,ne?e.jsxs(e.Fragment,{children:[" · ",e.jsx("span",{title:"These windows are projected from recent swing highs and lows, re-selected every hour. The set can change between refreshes.",children:ne})]}):null]})]}),Ee?e.jsx("p",{className:"my-4 max-w-[52ch] font-body text-small text-text-secondary",children:w==="time"?"No anniversary windows on this board. Anniversary rungs are sparser than price rungs, so a board with none is normal — clear the filter to see the price windows.":w==="price"?"No price windows on this board. Clear the filter to see the anniversary windows.":"Nothing matches the current filters."}):e.jsx("div",{className:"space-y-2",children:x.map((a,o)=>e.jsx(pt,{window:a,rank:o+1,now:O,isNext:a===Ae,index:o},a.start.toISOString()))})]}),t&&x.length>0&&e.jsxs("section",{className:"my-4","aria-label":"Pine export",children:[e.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-3",children:[e.jsx("h2",{className:"font-mono text-micro uppercase tracking-data text-text-muted",children:"Pine export"}),e.jsx(T,{type:"button",variant:"cta",onClick:re,children:te?"✓ Pine copied":"Copy Pine"})]}),e.jsx("textarea",{readOnly:!0,"aria-label":"Sky Squares Pine script",value:Le,onFocus:a=>a.currentTarget.select(),spellCheck:!1,className:"h-40 w-full resize-y rounded-lg border border-border-subtle bg-bg-page p-3 font-mono text-micro text-text-primary"}),e.jsx("p",{className:"mt-1 font-body text-small text-text-secondary",children:"Paste into the TradingView Pine Editor. Baked to your current selection; works on every timeframe."})]}),i.data.gated>0&&e.jsx("section",{className:"my-4",children:e.jsxs("div",{className:"relative overflow-hidden rounded-xl border border-brass-soft bg-bg-surface shadow-glow-brass",children:[e.jsx("div",{"aria-hidden":"true",className:"space-y-2 p-4 blur-[3px]",style:{opacity:.5},children:[0,1,2,3].map(a=>e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border-subtle bg-bg-page p-3",children:[e.jsx("span",{className:"h-2.5 w-20 rounded-pill bg-border-strong"}),e.jsx("span",{className:"h-2.5 w-16 rounded-pill bg-border-subtle"}),e.jsx("span",{className:"ml-auto h-2.5 w-8 rounded-pill bg-brass-soft"})]},a))}),e.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center px-6 text-center",children:[e.jsxs("p",{className:"font-mono text-h3 font-semibold uppercase text-text-primary",children:[i.data.gated," more windows with Ascendant"]}),e.jsx("p",{className:"mt-2 max-w-[44ch] font-body text-small text-text-secondary",children:"Ascendant surfaces the full ranked ladder — with your own location and the √ Square-of-9 wheel mode."}),e.jsx(T,{to:"/upgrade?from=squared-timing",variant:"marketing",className:"mt-4",children:"Unlock Sky Squares →"})]})]})})]})]})}export{Lt as default};
46//# sourceMappingURL=SquaredTiming-UkKxQeDk.js.map

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.