PageSourceSearch

https://p5js.ai/assets/EvolutionLifelineLanes-AXiYEJVs.js

js p5js.ai collected 2026-10-05 15:01:37 UTC 5,451 bytes, 4 lines download raw bytes

1import{j as r}from"./ui-components-BtUj-H_s.js";import{e as v}from"./react-vendor-3a3SXJxo.js";import{c0 as T,a0 as M}from"./index-C0f3njKd.js";import{u as $}from"./useNarrativeStore-BFngAG9F.js";import"./utils-ChGh4OsY.js";const Y=60,h=38,g=200,E=16,x=28,f=24,S=1100,b=["#f87171","#38bdf8","#22d3ee","#a78bfa","#fbbf24","#22c55e","#ec4899","#f97316","#94a3b8","#06b6d4","#84cc16","#e879f9"];function m(a){if(!a)return null;const l=new Date(a+"T00:00:00Z").getTime();return Number.isFinite(l)?l:null}function P(){const[a]=v.useState(Y),l=T(`/api/security/network-timeline?days=${a}`),u=$(e=>e.selectedNetworkId),y=$(e=>e.setSelectedNetworkId),d=l.data?.networks||[],D=l.data?.absorption_events||[],t=v.useMemo(()=>{if(d.length===0)return null;const e=864e5,s=Math.floor(Date.now()/e)*e+e,o=s-a*e,n=d.map(i=>Math.max(1,...(i.daily_counts||[]).map(c=>c.n))),p=S-g-E,j=x+f+d.length*h;return{innerW:p,H:j,xAt:i=>g+(i-o)/(s-o)*p,laneYTop:i=>x+i*h,laneYBot:i=>x+(i+1)*h-4,yMaxPerLane:n,tStart:o,tEnd:s}},[d,a]),k=l.data?._errors||[];return r.jsxs("div",{className:"rounded-md border border-ide-border bg-ide-panel p-3",children:[r.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[r.jsx(M,{size:14,className:"text-ide-accent"}),r.jsx("div",{className:"text-[12px] font-semibold text-ide-text",children:"Network lifeline lanes"}),r.jsxs("span",{className:"text-[10px] font-mono text-ide-textMuted",children:["(last ",a,"d · log-scaled daily volume per network)"]}),u&&r.jsx("button",{type:"button",className:"ml-auto rounded border border-ide-border bg-ide-panelDeep px-2 py-0.5 text-[10px] text-ide-textMuted hover:text-ide-text",onClick:()=>y(null),children:"clear selection"})]}),l.error&&r.jsxs("div",{className:"rounded border border-ide-error/40 bg-ide-error/10 px-3 py-2 text-[11px] text-ide-error",children:["Failed to load: ",r.jsx("span",{className:"font-mono",children:String(l.error?.message||l.error)})]}),k.length>0&&r.jsxs("div",{className:"mb-2 rounded border border-ide-warning/40 bg-ide-warning/10 px-2 py-1 text-[10px] text-ide-warning",children:[k.length," sub-query failure",k.length===1?"":"s"," — partial data."]}),d.length===0&&!l.loading&&!l.error&&r.jsx("div",{className:"text-[11px] text-ide-textDim italic",children:"No network lanes have any traffic in the window."}),t&&d.length>0&&r.jsxs("svg",{viewBox:`0 0 ${S} ${t.H}`,className:"h-auto w-full select-none",role:"img","aria-label":"Network lifelines",children:[Array.from({length:Math.floor(a/7)+1},(e,s)=>{const o=t.xAt(t.tStart+s*7*864e5);return r.jsx("line",{x1:o,y1:x,x2:o,y2:t.H-f,stroke:"rgba(255,255,255,0.055)",strokeWidth:1},`grid-${s}`)}),d.map((e,s)=>{const o=u&&u!==e.id?.25:1;return r.jsxs("g",{opacity:o,children:[r.jsxs("text",{x:g-6,y:t.laneYTop(s)+h/2+3,textAnchor:"end",className:`cursor-pointer ${u===e.id?"fill-ide-text":"fill-ide-textMuted"}`,fontSize:"10",fontFamily:"monospace",onClick:()=>y(u===e.id?null:e.id),children:[r.jsx("title",{children:`${e.label}
2first=${e.first_seen||"—"}
3peak=${e.peak_at||"—"} (n=${e.peak_count})
4last=${e.last_seen||"—"}`}),e.label.length>28?e.label.slice(0,27)+"…":e.label]}),r.jsx("rect",{x:g,y:t.laneYTop(s),width:t.innerW,height:h-4,fill:"rgba(255,255,255,0.02)",stroke:"rgba(255,255,255,0.04)",onClick:()=>y(u===e.id?null:e.id),style:{cursor:"pointer"}}),(()=>{const n=e.daily_counts||[];if(n.length===0)return null;const p=Math.max(1,...n.map(c=>Math.log10(c.n+1))),j=h-8,N=c=>t.laneYBot(s)-Math.log10(c+1)/p*j,A=n.map(c=>{const _=m(c.day);return _?`${t.xAt(_)},${N(c.n)}`:null}).filter(Boolean);if(A.length===0)return null;const w=m(n[0].day),i=m(n[n.length-1].day);return r.jsx("polyline",{points:`${t.xAt(w)},${t.laneYBot(s)} ${A.join(" ")} ${t.xAt(i)},${t.laneYBot(s)}`,fill:b[e.lane_index%b.length]+"AA",stroke:b[e.lane_index%b.length],strokeWidth:.6})})(),e.first_seen&&(()=>{const n=m(e.first_seen);return!n||n<t.tStart?null:r.jsx("circle",{cx:t.xAt(n),cy:t.laneYTop(s)+4,r:2.5,fill:"#22c55e"})})(),e.peak_at&&(()=>{const n=m(e.peak_at);return!n||n<t.tStart?null:r.jsx("circle",{cx:t.xAt(n),cy:t.laneYTop(s)+4,r:3,fill:"#fbbf24",stroke:"#0f172a",strokeWidth:1})})()]},e.id)}),D.map((e,s)=>{const o=new Date(e.occurred_at).getTime();if(!Number.isFinite(o)||o<t.tStart||o>t.tEnd)return null;const n=t.xAt(o);return r.jsxs("g",{children:[r.jsx("line",{x1:n,y1:x,x2:n,y2:t.H-f,stroke:"#f87171",strokeWidth:1,strokeDasharray:"3 3",opacity:.6}),r.jsxs("text",{x:n+3,y:x-4,textAnchor:"start",className:"fill-ide-error",fontSize:"9",fontFamily:"monospace",transform:`rotate(-22 ${n+3} ${x-4})`,children:[r.jsx("title",{children:e.narrative}),e.label.length>32?e.label.slice(0,31)+"…":e.label]})]},s)}),Array.from({length:Math.floor(a/7)+1},(e,s)=>{const o=t.tStart+s*7*864e5,n=t.xAt(o),p=new Date(o).toISOString().slice(5,10);return r.jsxs("g",{children:[r.jsx("line",{x1:n,y1:t.H-f,x2:n,y2:t.H-f+4,stroke:"rgba(255,255,255,0.35)",strokeWidth:1}),r.jsx("text",{x:n,y:t.H-8,fontSize:"9",textAnchor:"middle",fill:"rgba(255,255,255,0.5)",fontFamily:"monospace",children:p})]},s)})]}),r.jsxs("div",{className:"mt-2 text-[10px] leading-snug text-ide-textDim",children:[r.jsx("span",{className:"text-ide-success",children:"●"})," first seen · ",r.jsx("span",{className:"text-ide-warning",children:"●"})," peak. Dashed red verticals = absorption events (router deploy, .206 collapse, Channel-A first echo). Click a lane label to pin the network across all tabs."]})]})}export{P 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.