1import{r as s,j as e}from"./metal-fx-C6GZ_SKA.js";import{j as L,S as _,d as u,R as j,h as B}from"./shared-OtDZU4QY.js";import{fm as P}from"./index-D1yBc__G.js";import"./motion-BHwmuFpx.js";const C=224.15,G=231.4,F=228.02,i=(r,a=2)=>r.toLocaleString("en-US",{minimumFractionDigits:a,maximumFractionDigits:a});function c({label:r,children:a,hint:f,caps:o=!0}){return e.jsxs("div",{className:"flex min-w-0 flex-col justify-center gap-0.5",title:f,children:[e.jsx("span",{className:`truncate text-[8.5px] text-foreground/30 ${o?"uppercase tracking-[0.1em]":""}`,children:r}),e.jsx("span",{className:"truncate text-[11.5px] tabular-nums text-foreground/80",children:a})]})}function K({symbol:r="AAPL",quote:a="USD",monogram:f=r.slice(0,2),mid:o=F,low:p=C,high:b=G,flush:d=!1,range:E=!0,caps:l=!0}={}){const v=P(),[n,M]=s.useState(o),m=s.useRef(o),[N,D]=s.useState(null),[w,$]=s.useState(o*(227.94/F)),[h,U]=s.useState(.0042),[S,A]=s.useState(1902);s.useEffect(()=>{if(L())return;let y=20260819;const x=()=>(y=y*48271%2147483647)/2147483647,T=setInterval(()=>{M(t=>+(t*(1+(x()-.5)*7e-4)).toFixed(2)),$(t=>+(t*(1+(x()-.5)*5e-4)).toFixed(2)),x()<.2&&U(t=>+(t+(x()-.5)*.0012).toFixed(4))},v?2400:1100),I=setInterval(()=>A(t=>t>0?t-1:3600),1e3);return()=>{clearInterval(T),clearInterval(I)}},[v]),s.useEffect(()=>{n!==m.current&&D(n>m.current),m.current=n},[n]);const g=+(n-w).toFixed(2),k=Math.min(1,Math.max(0,(n-p)/(b-p))),R=`${String(Math.floor(S/60)).padStart(2,"0")}:${String(S%60).padStart(2,"0")}`;return e.jsxs("div",{className:`flex w-full items-stretch gap-3.5 overflow-x-auto px-3.5 py-2 ${d?"":"max-w-[720px] rounded-lg border border-foreground
1/[0.04]"}`,style:{background:d?void 0:"var(--surface)",boxShadow:d?void 0:"inset 0 1px 0 0 color-mix(in srgb, var(--foreground) 4%, transparent)",fontFamily:_},children:[e.jsxs("div",{className:"flex shrink-0 items-center gap-2.5 border-e border-foreground/[0.05] pe-4",children:[!d&&e.jsx("span",{className:"grid h-7 w-7 place-items-center rounded-full text-[10px] font-semibold text-[var(--background)]",style:{background:"linear-gradient(160deg, color-mix(in srgb, var(--chart-1) 45%, white), var(--chart-1))"},children:f}),e.jsxs("div",{className:"flex flex-col justify-center gap-0.5",children:[e.jsxs("span",{className:"text-[11.5px] font-medium text-foreground/85",children:[r," / ",a]}),e.jsx("span",{className:"text-[13px] font-semibold tabular-nums",style:{color:N===null?"var(--foreground)":N?u:j},children:i(n)})]})]}),e.jsx(c,{caps:l,label:"Index",hint:"oracle / spot reference",children:i(w)}),e.jsx(c,{caps:l,label:"Basis",hint:"basis = mark â index",children:e.jsxs("span",{style:{color:g>=0?u:j},children:[g>=0?"+":"â",i(Math.abs(g))]})}),e.jsx(c,{caps:l,label:"Funding / 1h",hint:"next funding window countdown",children:e.jsxs("span",{className:"flex items-baseline gap-1.5",children:[e.jsxs("span",{style:{color:h>=0?u:j},children:[h>=0?"+":"",h.toFixed(4),"%"]}),e.jsx("span",{className:"text-[10px] text-foreground/35",children:R})]})}),e.jsx(c,{caps:l,label:"24h vol",hint:"shares traded, rolling 24h",children:"54.2M"}),e.jsx(c,{caps:l,label:"Open interest",hint:"notional of contracts still open",children:"$1.9B"}),E&&e.jsxs("div",{className:"flex min-w-[120px] flex-1 flex-col justify-center gap-1",children:[e.jsxs("div",{className:`flex justify-between text-[8.5px] text-foreground/30 ${l?"uppercase tracking-[0.08em]":""}`,children:[e.jsx("span",{children:i(p)}),e.jsx("span",{style:{color:B},children:"24h range"}),e.jsx("span",{children:i(b)})]}),e.jsxs("div",{className:"relative h-[3px] rounded-full bg-foreground
1/[0.07]",children:[e.jsx("span",{className:"absolute inset-y-0 left-0 rounded-full",style:{width:`${k*100}%`,background:`color-mix(in srgb, ${u} 45%, transparent)`}}),e.jsx("span",{className:"absolute top-1/2 h-[7px] w-[2px] -translate-y-1/2 rounded-full",style:{left:`calc(${k*100}% - 1px)`,background:"var(--foreground)"}})]})]})]})}function J(){return e.jsx("div",{className:"flex min-h-[200px] w-full items-center justify-center p-6",children:e.jsx(K,{})})}export{J as Demo,K 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.