zframes 0.5.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE +6 -2
- package/dist/index.js +614 -10
- package/package.json +2 -2
- package/runtime/assets/{bitcoin-dominance-CtnczH5N.js → bitcoin-dominance-CweHlZx7.js} +1 -1
- package/runtime/assets/{breakeven-zbCEQ5ag.js → breakeven-CG9rKwgE.js} +1 -1
- package/runtime/assets/{breathing-6Wmy_hqF.js → breathing-cDundHq6.js} +1 -1
- package/runtime/assets/{btc-blocks-D1xOLm2L.js → btc-blocks-Do_nySHd.js} +1 -1
- package/runtime/assets/{btc-difficulty-BTbKIqrl.js → btc-difficulty-vNbz5uRo.js} +1 -1
- package/runtime/assets/{btc-fees-5Geh2TSa.js → btc-fees-BmADLsmK.js} +1 -1
- package/runtime/assets/{btc-hashrate-DZfnxUsi.js → btc-hashrate-Wx2RAG-5.js} +1 -1
- package/runtime/assets/{btc-mempool-8oOMDiaW.js → btc-mempool-CTwbkMUR.js} +1 -1
- package/runtime/assets/{calculator-D91iI7KM.js → calculator-mvv6XpQC.js} +1 -1
- package/runtime/assets/{checklist-DNrOJw0w.js → checklist-CuEw3GpE.js} +1 -1
- package/runtime/assets/{clock-BzAIAbhU.js → clock-Cjnwi03W.js} +1 -1
- package/runtime/assets/{coin-movers-99W2EABZ.js → coin-movers-Bcx1XR0F.js} +1 -1
- package/runtime/assets/{countdown-ZAJmbykg.js → countdown-Cdi5gSSu.js} +1 -1
- package/runtime/assets/cycle-shared-BOGcJDzT.js +1 -0
- package/runtime/assets/cycle-signals-CS629ZDc.js +1 -0
- package/runtime/assets/{daily-analysis-CS5MqofA.js → daily-analysis-DX8bVq85.js} +1 -1
- package/runtime/assets/{day-meter-DzBvLcpd.js → day-meter-DDfTuhms.js} +1 -1
- package/runtime/assets/defi-revenue-CpeAGwhb.js +1 -0
- package/runtime/assets/{dex-volume-chart-BfnczfAT.js → dex-volume-chart-sHIuJACJ.js} +1 -1
- package/runtime/assets/{dex-volume-treemap-CLyIrkgU.js → dex-volume-treemap-rSTrzz7O.js} +1 -1
- package/runtime/assets/{dice-CAvRf0md.js → dice-BrFORdjN.js} +1 -1
- package/runtime/assets/{dino-game-gsyCpJ-0.js → dino-game-BOV8mV1d.js} +1 -1
- package/runtime/assets/{divider-DCTu-qNh.js → divider-C33tH1RU.js} +1 -1
- package/runtime/assets/{drawdy-CZWCFtog.js → drawdy-BIb36JN9.js} +1 -1
- package/runtime/assets/dxy-CRifEdp_.js +1 -0
- package/runtime/assets/editor-CZoWRTJC.css +1 -0
- package/runtime/assets/editor-Dnp1eXvY.js +68 -0
- package/runtime/assets/etf-flows-BV10E2R-.js +1 -0
- package/runtime/assets/etf-flows-chart-DHu8mkXm.js +1 -0
- package/runtime/assets/eth-staking-BqWeJq6F.js +1 -0
- package/runtime/assets/eth-supply-CF-MgHjn.js +1 -0
- package/runtime/assets/{fear-greed-DOcPswrx.js → fear-greed-DuDR56h2.js} +1 -1
- package/runtime/assets/{filings-feed-Cs--DpYl.js → filings-feed-BpfO2yF6.js} +1 -1
- package/runtime/assets/{financial-stress-BqnxLk2O.js → financial-stress-BfYJdlry.js} +1 -1
- package/runtime/assets/{flappy-bird-DaasqVGg.js → flappy-bird-Dbb2UQBv.js} +1 -1
- package/runtime/assets/{fundamentals-GseULnsD.js → fundamentals-CUnqjF--.js} +1 -1
- package/runtime/assets/funding-comparison-CMKxW1n-.js +1 -0
- package/runtime/assets/{funding-heatmap-2RvVLTPN.js → funding-heatmap-CZWnYF8Y.js} +1 -1
- package/runtime/assets/{funding-rate-chart-DCRKHp6g.js → funding-rate-chart-C-tpwid_.js} +1 -1
- package/runtime/assets/{fx-board-CVW6VmbY.js → fx-board-YAy44m5d.js} +1 -1
- package/runtime/assets/{heading-BaRMJq2t.js → heading-uIVBEE7K.js} +1 -1
- package/runtime/assets/{holiday-calendar-2OBfwbh-.js → holiday-calendar-DCj83hi2.js} +1 -1
- package/runtime/assets/{image-CuTXEV7Q.js → image-CITPAmp0.js} +1 -1
- package/runtime/assets/index-Bx7RmzY8.js +1 -0
- package/runtime/assets/index-CrmTiZaB.css +1 -0
- package/runtime/assets/index-DyvZokhk.js +1097 -0
- package/runtime/assets/indicators-CogwjDn9.js +1 -0
- package/runtime/assets/{inflation-pulse-B8E9uzQB.js → inflation-pulse-Bqa3-cuC.js} +1 -1
- package/runtime/assets/{journal-log-7APM_99k.js → journal-log-Bgjia8cQ.js} +1 -1
- package/runtime/assets/{journal-open-CcdGuysA.js → journal-open-Bm5gwWXz.js} +1 -1
- package/runtime/assets/{journal-results-CUTn4-kq.js → journal-results-cEWe2pbe.js} +1 -1
- package/runtime/assets/{journal-score-C31dg2yL.js → journal-score-vmfF-9bK.js} +1 -1
- package/runtime/assets/{journal-ui-C5ueSjZx.js → journal-ui-ApBNIq5_.js} +1 -1
- package/runtime/assets/{labor-market-DgvDQtFo.js → labor-market-azDXD-dR.js} +1 -1
- package/runtime/assets/{lightning-stats-CiUlm-e_.js → lightning-stats-nkyh2dOX.js} +1 -1
- package/runtime/assets/{link-grid-DlsY59eq.js → link-grid-BEo4b54T.js} +1 -1
- package/runtime/assets/ma-multiplier-BllDQMF5.js +1 -0
- package/runtime/assets/macro-calendar-Ck0dJk4p.js +1 -0
- package/runtime/assets/{market-cap-treemap-6vqLUgVk.js → market-cap-treemap-AxE2EYPO.js} +1 -1
- package/runtime/assets/{market-hours-BArlXOQB.js → market-hours-BSwXtU8c.js} +1 -1
- package/runtime/assets/{marquee-2Di2SqI2.js → marquee-1Zr5qDJP.js} +1 -1
- package/runtime/assets/mayer-multiple-DpBJNd4d.js +1 -0
- package/runtime/assets/{mining-pools-Bg02wm2V.js → mining-pools-B-jxdTot.js} +1 -1
- package/runtime/assets/{mover-row-C8040L85.js → mover-row-Dg96EIqq.js} +1 -1
- package/runtime/assets/mvrv-Dx_S0TwE.js +1 -0
- package/runtime/assets/{national-debt-BS57WjA3.js → national-debt-BKVBHaqm.js} +1 -1
- package/runtime/assets/{news-feed-oBCTiuoo.js → news-feed-C9itZmyp.js} +1 -1
- package/runtime/assets/{note-BLWlz52v.js → note-BtCnmuMo.js} +1 -1
- package/runtime/assets/nupl-aIjkc57m.js +1 -0
- package/runtime/assets/{open-interest-DxMqZcmu.js → open-interest-C0ulogv6.js} +1 -1
- package/runtime/assets/{options-iv-CgIIFdpN.js → options-iv-CdUder3x.js} +1 -1
- package/runtime/assets/{options-oi-strike-blRp4kmB.js → options-oi-strike-CvCZnMCR.js} +1 -1
- package/runtime/assets/{options-put-call-CyOwXBVQ.js → options-put-call-FuaDHJ-S.js} +1 -1
- package/runtime/assets/pi-cycle-BuCnLnIJ.js +1 -0
- package/runtime/assets/{pomodoro-BKJlh-bz.js → pomodoro-DDBVVcSR.js} +1 -1
- package/runtime/assets/{portfolio-allocation-Cat1vq2_.js → portfolio-allocation-DAnQk_h_.js} +1 -1
- package/runtime/assets/{portfolio-common-DeyRfuNV.js → portfolio-common-Bi16i0aA.js} +1 -1
- package/runtime/assets/{portfolio-holdings-DDDhMMFL.js → portfolio-holdings-MyAinCzt.js} +1 -1
- package/runtime/assets/{portfolio-value-D9qrGeZp.js → portfolio-value-BPURwKf8.js} +1 -1
- package/runtime/assets/prediction-markets-Bzy51qnV.js +1 -0
- package/runtime/assets/{price-chart-CQJNOBtu.js → price-chart-BOCD8ka3.js} +1 -1
- package/runtime/assets/{price-compare-DqBiHd7S.js → price-compare-DZlF-qhZ.js} +1 -1
- package/runtime/assets/{price-liveline-BlVGC2-R.js → price-liveline-Bl7qCd5-.js} +1 -1
- package/runtime/assets/{price-ticker-QdVoVaQh.js → price-ticker-D2W4T02y.js} +1 -1
- package/runtime/assets/{protocol-fees-treemap-39F-aE33.js → protocol-fees-treemap-DiIt4bfo.js} +1 -1
- package/runtime/assets/{protocol-tvl-chart-DZOgbMZu.js → protocol-tvl-chart-CmzANiR7.js} +1 -1
- package/runtime/assets/{protocol-tvl-treemap-DusQ6xL2.js → protocol-tvl-treemap-BjNPrrtL.js} +1 -1
- package/runtime/assets/puell-multiple-BGrJX43r.js +1 -0
- package/runtime/assets/{quote-Di049ggj.js → quote-CRM3bfI7.js} +1 -1
- package/runtime/assets/{rates-board-Dm3tb6-P.js → rates-board-Cb9rV0_-.js} +1 -1
- package/runtime/assets/realized-price-CYlrFa0m.js +1 -0
- package/runtime/assets/reserve-risk-Be98XUsD.js +1 -0
- package/runtime/assets/{returns-projector-BiMx_kSw.js → returns-projector-D67a_yvC.js} +1 -1
- package/runtime/assets/{risk-reward-1Q_Kt75s.js → risk-reward-C7WMz2od.js} +1 -1
- package/runtime/assets/rsi-momentum-IglnulkJ.js +1 -0
- package/runtime/assets/{rules-card-BkAX9PEq.js → rules-card-DJs3fDVN.js} +1 -1
- package/runtime/assets/scene-uwfOGek1.js +1 -0
- package/runtime/assets/sector-performance-DVMaleLY.js +1 -0
- package/runtime/assets/sector-treemap-B681nSi6.js +1 -0
- package/runtime/assets/{session-progress-D_1dzPzM.js → session-progress-CZO3LqUi.js} +1 -1
- package/runtime/assets/{short-volume-U-uFonb2.js → short-volume-l8_9Yoh3.js} +1 -1
- package/runtime/assets/{snake-Dp4E3Dcv.js → snake-CifbTGlZ.js} +1 -1
- package/runtime/assets/sopr-Dw_oz-mC.js +1 -0
- package/runtime/assets/{spotify-embed-Cw95WZjV.js → spotify-embed-BA0m1IRb.js} +1 -1
- package/runtime/assets/stablecoin-chains-Dd2LqqqY.js +1 -0
- package/runtime/assets/stablecoin-supply-DM4ogL4V.js +1 -0
- package/runtime/assets/{stopwatch-B2_iDkKK.js → stopwatch-Co72v-7u.js} +1 -1
- package/runtime/assets/{top-movers--vCUiTII.js → top-movers-CLmC2TNu.js} +1 -1
- package/runtime/assets/{treasury-auctions-BpzYivLg.js → treasury-auctions-Dl9fiRgf.js} +1 -1
- package/runtime/assets/{treemap-leaf-DNIoJEK-.js → treemap-leaf-Dn31k9S9.js} +1 -1
- package/runtime/assets/trending-coins-Cpx9T6cG.js +1 -0
- package/runtime/assets/{tvl-treemap-BYgD9bNy.js → tvl-treemap-e610jE8k.js} +1 -1
- package/runtime/assets/{video-D-nBm697.js → video-CeKjM-cE.js} +1 -1
- package/runtime/assets/volume-profile-CiMFsIBu.js +1 -0
- package/runtime/assets/{yield-curve-8IsrMS_9.js → yield-curve-DkB0u2_Q.js} +1 -1
- package/runtime/assets/yield-scanner-BP90untT.js +1 -0
- package/runtime/index.html +2 -2
- package/runtime/assets/editor-BMMobjrE.css +0 -1
- package/runtime/assets/editor-Ckt9OQ98.js +0 -68
- package/runtime/assets/index-BqHx9BjX.css +0 -1
- package/runtime/assets/index-CH54P4Cn.js +0 -936
- package/runtime/assets/index-DK7jWlTL.js +0 -1
- package/runtime/assets/unicorn-scene-DcohHRPZ.js +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import{r,j as e,c as Os,a as is}from"./react-qoZPGuNy.js";import{G as ls}from"./gridstack-BxxvPIFU.js";import{t as pt,u as Gs,B as we,T as cs,F as os,a as Ds,b as _s,c as Ws,d as Us,N as us,e as ms}from"./index-DyvZokhk.js";function qs(t){const a=t.trim().toLowerCase();return a?a.split(/\s+/):[]}function Ks(t,a,n){if(n.length===0)return!0;const m=`${t.label} ${t.description??""} ${t.name} ${a}`.toLowerCase();return n.every(j=>m.includes(j))}/**
|
|
2
|
+
* @license lucide-react v1.21.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const ys=(...t)=>t.filter((a,n,m)=>!!a&&a.trim()!==""&&m.indexOf(a)===n).join(" ").trim();/**
|
|
7
|
+
* @license lucide-react v1.21.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const Vs=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
12
|
+
* @license lucide-react v1.21.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const Xs=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,n,m)=>m?m.toUpperCase():n.toLowerCase());/**
|
|
17
|
+
* @license lucide-react v1.21.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const ds=t=>{const a=Xs(t);return a.charAt(0).toUpperCase()+a.slice(1)};/**
|
|
22
|
+
* @license lucide-react v1.21.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/var lt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
27
|
+
* @license lucide-react v1.21.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const Ys=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1},Zs=r.createContext({}),Js=()=>r.useContext(Zs),Qs=r.forwardRef(({color:t,size:a,strokeWidth:n,absoluteStrokeWidth:m,className:j="",children:d,iconNode:h,...o},f)=>{const{size:p=24,strokeWidth:u=2,absoluteStrokeWidth:z=!1,color:N="currentColor",className:x=""}=Js()??{},R=m??z?Number(n??u)*24/Number(a??p):n??u;return r.createElement("svg",{ref:f,...lt,width:a??p??lt.width,height:a??p??lt.height,stroke:t??N,strokeWidth:R,className:ys("lucide",x,j),...!d&&!Ys(o)&&{"aria-hidden":"true"},...o},[...h.map(([T,w])=>r.createElement(T,w)),...Array.isArray(d)?d:[d]])});/**
|
|
32
|
+
* @license lucide-react v1.21.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const ye=(t,a)=>{const n=r.forwardRef(({className:m,...j},d)=>r.createElement(Qs,{ref:d,iconNode:a,className:ys(`lucide-${Vs(ds(t))}`,`lucide-${t}`,m),...j}));return n.displayName=ds(t),n};/**
|
|
37
|
+
* @license lucide-react v1.21.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const ea=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],ta=ye("check",ea);/**
|
|
42
|
+
* @license lucide-react v1.21.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/const sa=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],aa=ye("chevron-down",sa);/**
|
|
47
|
+
* @license lucide-react v1.21.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/const ra=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],na=ye("plus",ra);/**
|
|
52
|
+
* @license lucide-react v1.21.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const ia=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],zs=ye("search",ia);/**
|
|
57
|
+
* @license lucide-react v1.21.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/const la=[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]],ca=ye("sliders-horizontal",la);/**
|
|
62
|
+
* @license lucide-react v1.21.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/const oa=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ge=ye("x",oa),js=["xyz:XYZ100","xyz:SP500","xyz:NVDA","xyz:TSLA","xyz:AAPL","xyz:MSFT","xyz:GOOGL","xyz:META","xyz:AMZN","xyz:MU","xyz:AMD","xyz:AVGO","xyz:ARM","xyz:TSM","xyz:SKHX","xyz:MSTR","xyz:COIN","xyz:HOOD","xyz:PLTR","xyz:SPCX","xyz:GOLD","xyz:SILVER","xyz:CL","xyz:BRENTOIL","xyz:COPPER","xyz:EUR","xyz:JPY","xyz:SMH","BTC","ETH","SOL","HYPE","BNB","XRP","DOGE","LINK","AVAX","SUI"],Ns=new Map(js.map((t,a)=>[t,a]));function Se(t){const a=t.indexOf(":");return(a===-1?t:t.slice(a+1)).toUpperCase()}function gt(t){return t.includes(":")?"Stock":"Crypto"}function ua(t){const a=t.indexOf(":");if(a!==-1){const n=t.slice(a+1);return`https://assets.parqet.com/logos/symbol/${encodeURIComponent(n)}?format=png`}return`https://assets.coincap.io/assets/icons/${t.toLowerCase()}@2x.png`}function ma(t){const a=t.trim().replace(/\s+/g,"");if(!a)return"";const n=a.indexOf(":");return n===-1?a.toUpperCase():`${a.slice(0,n).toLowerCase()}:${a.slice(n+1).toUpperCase()}`}function mt(t,a,n=Ns.get(t)??1e4){return{symbol:t,ticker:Se(t),kind:gt(t),markPx:a==null?void 0:a.markPx,changePct:a==null?void 0:a.changePct,rank:n}}function vs(t){if(!Number.isFinite(t))return"";const a=t;return a>=1e3?`$${a.toLocaleString(void 0,{maximumFractionDigits:0})}`:a>=100?`$${a.toFixed(2)}`:a>=1?`$${a.toFixed(3)}`:`$${a.toPrecision(3)}`}function da(t){if(!Number.isFinite(t))return"";const a=t;return`${a>=0?"+":""}${a.toFixed(2)}%`}function ks(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function H(t,a){return t!=null&&t.type?Array.isArray(t.type)?t.type.includes(a):t.type===a:!1}function ws(t){const a=t==null?void 0:t.items;return!!a&&H(t,"array")&&H(a,"string")}function fa(t){var a,n,m;try{const d=pt(t.schema,{io:"input"}).properties??{};if(H(d.symbol,"string"))return{kind:"single"};if(ws(d.symbols))return{kind:"symbols",minItems:(a=d.symbols)==null?void 0:a.minItems,maxItems:(n=d.symbols)==null?void 0:n.maxItems};const h=d.holdings,o=((m=h==null?void 0:h.items)==null?void 0:m.properties)??{};if(H(h,"array")&&H(o.symbol,"string"))return{kind:"holdings",minItems:h==null?void 0:h.minItems,maxItems:h==null?void 0:h.maxItems}}catch{}return t.name==="price-chart"?{kind:"single"}:["price-liveline","price-ticker","funding-rate-chart","funding-heatmap","price-compare"].includes(t.name)?{kind:"symbols"}:null}function ha(t,a){return t.kind==="single"?typeof a.symbol=="string"&&a.symbol?[a.symbol]:[]:t.kind==="symbols"?Array.isArray(a.symbols)?a.symbols.filter(n=>typeof n=="string"):[]:Array.isArray(a.holdings)?a.holdings.map(n=>ks(n)&&typeof n.symbol=="string"?n.symbol:"").filter(Boolean):[]}const pa=new Set(["symbol","symbols","holdings"]);function xt(t){const a=t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim();return a?a.charAt(0).toUpperCase()+a.slice(1):t}function ga(t){let a;try{a=pt(t.schema,{io:"input"})}catch{return[]}return Object.entries(a.properties??{}).filter(([n])=>!pa.has(n)).map(([n,m])=>({key:n,label:xt(n),shape:m}))}const fs=["xyz:TSLA","xyz:NVDA","xyz:AAPL","xyz:MSFT","xyz:SP500","xyz:GOLD","xyz:GOOGL","xyz:AMZN"];function xa(t,a){return t==="symbol"?fs[a%fs.length]:t==="url"?"https://":t==="text"?"New note":t==="title"?"Heading":xt(t)||"value"}function dt(t,a,n=0){var m;if(t.default!==void 0)return t.default;if(Array.isArray(t.enum)&&t.enum.length)return t.enum[0];if(H(t,"string"))return xa(a,n);if(H(t,"number")||H(t,"integer"))return t.exclusiveMinimum!==void 0?t.exclusiveMinimum+1:t.minimum??0;if(H(t,"boolean"))return!1;if(H(t,"array")){const j=t.items??{},d=a==="symbols"?"symbol":a;return Array.from({length:t.minItems??0},(h,o)=>dt(j,d,o))}if(H(t,"object")){const j={};for(const d of t.required??[]){const h=(m=t.properties)==null?void 0:m[d];h&&(j[d]=dt(h,d,n))}return j}return null}function ba(t){const a=t.schema.safeParse({});if(a.success)return a.data;let n;try{n=pt(t.schema,{io:"input"})}catch{return{}}const m={},j=new Set(n.required??[]);for(const[h,o]of Object.entries(n.properties??{}))j.has(h)&&(m[h]=dt(o,h));const d=t.schema.safeParse(m);return d.success?d.data:m}function ya(t,a){const n=r.useMemo(()=>t.find(f=>f.capabilities.includes("day-stats")),[t]),[m,j]=r.useState({}),[d,h]=r.useState(!1);return r.useEffect(()=>{if(!a||!(n!=null&&n.getDayStats)){h(!1);return}let f=!1;return h(!0),Promise.allSettled([n.getDayStats(),n.getDayStats(["xyz:*"])]).then(p=>{if(f)return;const u={};for(const z of p)z.status==="fulfilled"&&Object.assign(u,z.value);j(u)}).finally(()=>{f||h(!1)}),()=>{f=!0}},[a,n]),{options:r.useMemo(()=>{const f=new Map;return js.forEach((p,u)=>{f.set(p,mt(p,m[p],u))}),Object.entries(m).forEach(([p,u])=>{f.set(p,mt(p,u,Ns.get(p)??1e4))}),[...f.values()].sort((p,u)=>p.rank!==u.rank?p.rank-u.rank:p.kind!==u.kind?p.kind==="Stock"?-1:1:p.ticker.localeCompare(u.ticker))},[m]),loading:d}}function za({instance:t,registry:a,instancesRef:n,symbolUniverse:m,accentHue:j,onApply:d,onClose:h}){const o=a.get(t.frame),f=r.useMemo(()=>o?fa(o):null,[o]),p=r.useMemo(()=>o?ga(o):[],[o]),[u,z]=r.useState(()=>({...t.config??{}})),[N,x]=r.useState(null),[R,T]=r.useState(t.title??""),w=t.id,b=r.useCallback(S=>{if(z(S),o){const ce=o.schema.safeParse(S);if(!ce.success){x(ce.error.issues.map(ze=>`${ze.path.join(".")||"(root)"}: ${ze.message}`).join(`
|
|
67
|
+
`));return}}x(null);const P=n.current.get(w);P&&(n.current.set(w,{...P,config:S}),d(w))},[o,w,n,d]),A=r.useCallback(S=>{T(S);const P=n.current.get(w);if(!P)return;const ce=S.trim();n.current.set(w,{...P,title:ce===""?void 0:ce}),d(w)},[w,n,d]);r.useEffect(()=>{const S=P=>{P.key==="Escape"&&h()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[h]);const I=(S,P)=>b({...u,[S]:P}),le=(o==null?void 0:o.label)??t.frame.replace(/-/g," ");return e.jsx("div",{className:"zf-dialog-backdrop",style:{"--zf-accent-hue":j},onMouseDown:S=>{S.target===S.currentTarget&&h()},children:e.jsxs("div",{className:"zf-dialog",role:"dialog","aria-modal":"true","aria-label":`Configure ${le}`,children:[e.jsxs("header",{className:"zf-dialog-head",children:[e.jsxs("h3",{className:"zf-dialog-title",children:["Configure · ",le]}),e.jsx("button",{type:"button",className:"zf-dialog-close",onClick:h,"aria-label":"Close",title:"Close",children:e.jsx(Ge,{size:16,"aria-hidden":"true"})})]}),e.jsxs("div",{className:"zf-dialog-body",children:[(o==null?void 0:o.chrome)!=="bare"&&e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:"zf-instance-title",title:"Card title shown in the frame's chrome.",children:"Title"}),e.jsx("input",{id:"zf-instance-title",className:"zf-input",value:R,placeholder:o!=null&&o.titleContent?"Auto (live)":le,spellCheck:!1,onChange:S=>A(S.target.value)}),e.jsx("p",{className:"zf-field-hint",children:"Leave blank to use the frame’s default."})]}),f&&e.jsx(wa,{control:f,config:u,loading:m.loading,options:m.options,onChangeSymbol:S=>b({...u,symbol:S}),onChangeSymbols:S=>b({...u,symbols:S}),onChangeHoldings:S=>b({...u,holdings:S})}),p.map(S=>e.jsx(ja,{field:S,value:u[S.key],onChange:P=>I(S.key,P)},S.key)),!f&&p.length===0&&e.jsx("p",{className:"zf-rail-empty",children:"This frame has no settings."}),N&&e.jsx("div",{className:"zf-config-error",children:N})]}),e.jsx("footer",{className:"zf-dialog-foot",children:e.jsx("button",{type:"button",className:"zf-btn zf-btn--primary",onClick:h,children:"Done"})})]})})}function ja({field:t,value:a,onChange:n}){const{key:m,label:j,shape:d}=t,h=`zf-cfg-${m}`,o=d.description;if(H(d,"boolean")){const p=typeof a=="boolean"?a:!!d.default;return e.jsxs("label",{className:"zf-checkbox",title:o,children:[e.jsx("input",{type:"checkbox",checked:p,onChange:u=>n(u.target.checked)}),j]})}const f=Array.isArray(d.enum)&&d.enum.every(p=>typeof p=="string")?d.enum:null;if(f&&f.length>0){const p=typeof d.default=="string"?d.default:f[0],u=typeof a=="string"&&f.includes(a)?a:p;return e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:h,title:o,children:j}),e.jsx("select",{id:h,className:"zf-select",value:u,onChange:z=>n(z.target.value),children:f.map(z=>e.jsx("option",{value:z,children:xt(z)},z))})]})}return H(d,"integer")||H(d,"number")?e.jsx(Na,{id:h,field:t,value:a,onChange:n}):ws(d)?e.jsx(ka,{id:h,field:t,value:a,onChange:n}):e.jsx(va,{id:h,field:t,value:a,onChange:n})}function Na({id:t,field:a,value:n,onChange:m}){const{label:j,shape:d}=a,h=d.description,o=typeof d.minimum=="number"?d.minimum:void 0,f=typeof d.maximum=="number"?d.maximum:void 0,p=H(d,"integer"),u=p?1:"any",z=typeof d.default=="number"?d.default:o??0,N=typeof n=="number"&&Number.isFinite(n)?n:void 0;if(o!==void 0&&f!==void 0){const x=N??z;return e.jsxs("div",{className:"zf-field",children:[e.jsxs("div",{className:"zf-field-row",children:[e.jsx("label",{htmlFor:t,title:h,children:j}),e.jsx("span",{className:"zf-field-num",children:x})]}),e.jsx("input",{id:t,type:"range",className:"zf-range",min:o,max:f,step:u,value:x,onChange:R=>m(p?Math.round(Number(R.target.value)):Number(R.target.value))})]})}return e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:t,title:h,children:j}),e.jsx("input",{id:t,type:"number",className:"zf-input",min:o,max:f,step:u,value:n==null?"":String(n),onChange:x=>m(x.target.value===""?"":Number(x.target.value))})]})}function va({id:t,field:a,value:n,onChange:m}){const{key:j,label:d,shape:h}=a,o=h.description,f=typeof n=="string"?n:"",p=typeof h.default=="string"?h.default:"",u=typeof h.default=="string"&&/^#[0-9a-f]{6}$/i.test(h.default)?h.default:null;if(j==="color"||u){const z=/^#[0-9a-f]{6}$/i.test(f)?f:u??"#8b8df9";return e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:t,title:o,children:d}),e.jsxs("div",{className:"zf-color-row",children:[e.jsx("input",{type:"color",className:"zf-color",value:z,"aria-label":`${d} swatch`,onChange:N=>m(N.target.value)}),e.jsx("input",{id:t,className:"zf-input",value:f,placeholder:p,spellCheck:!1,onChange:N=>m(N.target.value)})]})]})}return j==="text"?e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:t,title:o,children:d}),e.jsx("textarea",{id:t,className:"zf-textarea zf-textarea--prose",value:f,placeholder:p,onChange:z=>m(z.target.value)})]}):e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:t,title:o,children:d}),e.jsx("input",{id:t,className:"zf-input",value:f,placeholder:p,spellCheck:!1,onChange:z=>m(z.target.value)})]})}function ka({id:t,field:a,value:n,onChange:m}){const{label:j,shape:d}=a,h=d.description,o=Array.isArray(n)?n.filter(x=>typeof x=="string"):[],[f,p]=r.useState(""),u=typeof d.maxItems=="number"?d.maxItems:void 0,z=u!==void 0&&o.length>=u,N=x=>{const R=x.trim().toUpperCase();p(""),!(!R||o.includes(R)||z)&&m([...o,R])};return e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:t,title:h,children:j}),o.length>0&&e.jsx("div",{className:"zf-taglist",children:o.map(x=>e.jsxs("span",{className:"zf-tag",children:[x,e.jsx("button",{type:"button",className:"zf-symbol-remove","aria-label":`Remove ${x}`,onClick:()=>m(o.filter(R=>R!==x)),children:e.jsx(Ge,{size:12,"aria-hidden":"true"})})]},x))}),e.jsx("input",{id:t,className:"zf-input",value:f,disabled:z,spellCheck:!1,placeholder:z?"Maximum reached":"Type a code, Enter to add",onChange:x=>p(x.target.value),onBlur:()=>N(f),onKeyDown:x=>{x.key==="Enter"||x.key===","?(x.preventDefault(),N(f)):x.key==="Backspace"&&f===""&&o.length>0&&m(o.slice(0,-1))}})]})}function wa({control:t,config:a,loading:n,options:m,onChangeSymbol:j,onChangeSymbols:d,onChangeHoldings:h}){const o=ha(t,a);if(t.kind==="single"){const u=o[0]??"";return e.jsxs("div",{className:"zf-symbol-editor",children:[e.jsx(ct,{title:"Ticker",detail:u?Se(u):"None",loading:n}),u?e.jsx(ht,{symbol:u,option:ft(u,m)}):null,e.jsx(ot,{loading:n,options:m,selectedSymbols:u?[u]:[],placeholder:"Search TSLA, BTC...",onSelect:j})]})}if(t.kind==="symbols"){const u=typeof t.maxItems=="number"&&o.length>=t.maxItems;return e.jsxs("div",{className:"zf-symbol-editor",children:[e.jsx(ct,{title:"Tickers",detail:hs(o.length,t),loading:n}),e.jsx(Sa,{symbols:o,options:m,onRemove:z=>d(o.filter(N=>N!==z))}),e.jsx(ot,{disabled:u,loading:n,options:m,selectedSymbols:o,placeholder:u?"Maximum tickers added":"Add ticker",keepOpenOnSelect:!0,onSelect:z=>{o.includes(z)||u||d([...o,z])}})]})}const f=Array.isArray(a.holdings)?a.holdings.filter(ks):[],p=typeof t.maxItems=="number"&&f.length>=t.maxItems;return e.jsxs("div",{className:"zf-symbol-editor",children:[e.jsx(ct,{title:"Holding tickers",detail:hs(f.length,t),loading:n}),e.jsx("div",{className:"zf-holding-list",children:f.map((u,z)=>{const N=typeof u.symbol=="string"?u.symbol:"";return e.jsxs("div",{className:"zf-holding-row",children:[e.jsxs("div",{className:"zf-holding-main",children:[N?e.jsx(ht,{symbol:N,option:ft(N,m),compact:!0}):e.jsx("span",{className:"zf-symbol-empty",children:"No ticker"}),typeof u.amount=="number"&&e.jsxs("span",{className:"zf-holding-amount",children:["x ",u.amount]})]}),e.jsx("button",{type:"button",className:"zf-symbol-remove","aria-label":`Remove ${N||"holding"}`,onClick:()=>{h(f.filter((x,R)=>R!==z))},children:e.jsx(Ge,{size:13,"aria-hidden":"true"})})]},`${N}-${z}`)})}),e.jsx(ot,{disabled:p,loading:n,options:m,selectedSymbols:o,placeholder:p?"Maximum holdings added":"Add holding",keepOpenOnSelect:!0,onSelect:u=>{p||h([...f,{symbol:u,amount:1}])}})]})}function ct({title:t,detail:a,loading:n}){return e.jsxs("div",{className:"zf-symbol-head",children:[e.jsxs("div",{children:[e.jsx("div",{className:"zf-symbol-label",children:t}),e.jsx("div",{className:"zf-symbol-detail",children:a})]}),e.jsx("span",{className:n?"zf-symbol-source is-loading":"zf-symbol-source",children:n?"Loading":"Live list"})]})}function hs(t,a){return typeof a.maxItems=="number"?`${t}/${a.maxItems}`:typeof a.minItems=="number"&&t<a.minItems?`${t}/${a.minItems}+`:String(t)}function ft(t,a){return a.find(n=>n.symbol===t)??mt(t)}function Sa({symbols:t,options:a,onRemove:n}){return t.length===0?e.jsx("div",{className:"zf-symbol-empty",children:"No tickers selected"}):e.jsx("div",{className:"zf-symbol-chips",children:t.map(m=>e.jsxs("span",{className:"zf-symbol-chip",children:[e.jsx(ht,{symbol:m,option:ft(m,a),compact:!0}),e.jsx("button",{type:"button",className:"zf-symbol-remove","aria-label":`Remove ${m}`,onClick:()=>n(m),children:e.jsx(Ge,{size:13,"aria-hidden":"true"})})]},m))})}function ht({symbol:t,option:a,compact:n=!1}){return e.jsxs("span",{className:n?"zf-selected-symbol is-compact":"zf-selected-symbol",children:[e.jsx(Ss,{symbol:t}),e.jsxs("span",{className:"zf-selected-symbol-text",children:[e.jsx("strong",{children:Se(t)}),!n&&e.jsx("em",{children:t})]}),!n&&a.markPx!==void 0&&e.jsx("span",{className:"zf-selected-symbol-price",children:vs(a.markPx)})]})}function ot({disabled:t=!1,loading:a,options:n,selectedSymbols:m,placeholder:j,keepOpenOnSelect:d=!1,onSelect:h}){const[o,f]=r.useState(""),[p,u]=r.useState(!1),z=r.useMemo(()=>new Set(m),[m]),N=r.useMemo(()=>new Set(n.map(b=>b.symbol)),[n]),x=ma(o),R=r.useMemo(()=>{const b=o.trim().toLowerCase();return(b?n.filter(I=>I.ticker.toLowerCase().includes(b)||I.symbol.toLowerCase().includes(b)):n.slice(0,28)).slice().sort((I,le)=>ps(I,b)-ps(le,b)).slice(0,36)},[n,o]),T=r.useMemo(()=>{if(!x)return[];const b=x.includes(":")?[x]:[`xyz:${x}`,x];return b.filter((A,I)=>b.indexOf(A)===I&&!N.has(A)&&!z.has(A))},[N,x,z]),w=b=>{!b||d&&z.has(b)||(h(b),f(""),u(d))};return e.jsxs("div",{className:"zf-symbol-combo",onBlur:b=>{b.currentTarget.contains(b.relatedTarget)||u(!1)},children:[e.jsxs("div",{className:t?"zf-symbol-search is-disabled":"zf-symbol-search",children:[e.jsx(zs,{size:14,"aria-hidden":"true"}),e.jsx("input",{value:o,disabled:t,placeholder:j,"aria-label":j,role:"combobox","aria-expanded":p,onFocus:()=>u(!0),onChange:b=>{f(b.target.value),u(!0)},onKeyDown:b=>{var A;b.key==="Enter"&&(b.preventDefault(),w(((A=R[0])==null?void 0:A.symbol)??T[0]??x))}}),e.jsx(aa,{size:14,"aria-hidden":"true"})]}),p&&!t&&e.jsxs("div",{className:"zf-symbol-menu",role:"listbox",children:[a&&e.jsx("div",{className:"zf-symbol-menu-status",children:"Loading live universe..."}),R.map(b=>{const A=z.has(b.symbol);return e.jsxs("button",{type:"button",className:A?"zf-symbol-option is-selected":"zf-symbol-option",disabled:d&&A,role:"option","aria-selected":A,onMouseDown:I=>{I.preventDefault(),w(b.symbol)},onClick:I=>{I.detail===0&&w(b.symbol)},children:[e.jsx(Ss,{symbol:b.symbol}),e.jsxs("span",{className:"zf-symbol-option-main",children:[e.jsx("strong",{children:b.ticker}),e.jsx("em",{children:b.symbol})]}),e.jsxs("span",{className:"zf-symbol-option-meta",children:[e.jsx("span",{children:vs(b.markPx)||b.kind}),b.changePct!==void 0&&e.jsx("span",{className:b.changePct>=0?"zf-symbol-change is-up":"zf-symbol-change is-down",children:da(b.changePct)})]}),A&&e.jsx(ta,{size:14,"aria-hidden":"true"})]},b.symbol)}),T.map(b=>e.jsxs("button",{type:"button",className:"zf-symbol-option zf-symbol-option--custom",onMouseDown:A=>{A.preventDefault(),w(b)},onClick:A=>{A.detail===0&&w(b)},children:[e.jsx("span",{className:"zf-symbol-custom-icon",children:e.jsx(na,{size:13,"aria-hidden":"true"})}),e.jsxs("span",{className:"zf-symbol-option-main",children:[e.jsx("strong",{children:Se(b)}),e.jsx("em",{children:b})]}),e.jsx("span",{className:"zf-symbol-option-meta",children:e.jsx("span",{children:gt(b)})})]},b)),!a&&R.length===0&&T.length===0&&e.jsx("div",{className:"zf-symbol-menu-status",children:"No matches"})]})]})}function ps(t,a){if(!a)return t.rank;const n=t.ticker.toLowerCase(),m=t.symbol.toLowerCase();return n===a||m===a?-40+t.rank/1e4:n.startsWith(a)?-20+t.rank/1e4:m.startsWith(a)?-10+t.rank/1e4:t.rank}function Ss({symbol:t}){const a=gt(t).toLowerCase(),[n,m]=r.useState(!1);return r.useEffect(()=>m(!1),[t]),n?e.jsx("span",{className:`zf-symbol-avatar zf-symbol-avatar--${a}`,children:Se(t).slice(0,2)}):e.jsx("img",{className:`zf-symbol-avatar zf-symbol-avatar--logo zf-symbol-avatar--${a}`,src:ua(t),alt:"","aria-hidden":"true",draggable:!1,loading:"lazy",onError:()=>m(!0)})}const Ca=24;function gs(t,a){var n;return a==="flow-horizontal"?(n=t.layouts)==null?void 0:n["flow-horizontal"]:t.position}function xs(t,a){const n=t.reduce((m,j)=>m+Math.max(1,j.position.w)*Math.min(Math.max(1,j.position.h),a),0);return Math.max(Ca,Math.ceil(n/a*1.25)+8)}function bs(t,a,n){var h;const m=new Set,j=(o,f,p,u)=>{for(let z=0;z<p;z++)for(let N=0;N<u;N++){const x=o+z,R=f+N;x>=0&&R>=0&&m.add(`${x},${R}`)}},d=(o,f,p,u)=>{if(o+p>a||f+u>n)return!1;for(let z=0;z<p;z++)for(let N=0;N<u;N++)if(m.has(`${o+z},${f+N}`))return!1;return!0};for(const o of t){const f=(h=o.layouts)==null?void 0:h["flow-horizontal"];f&&j(f.x,f.y,f.w,Math.min(f.h,n))}return t.map(o=>{var z;if((z=o.layouts)!=null&&z["flow-horizontal"])return o;const f=Math.min(Math.max(1,o.position.w),a),p=Math.min(Math.max(1,o.position.h),n);let u={x:0,y:0,w:f,h:p};e:for(let N=0;N<=a-f;N++)for(let x=0;x<=n-p;x++)if(d(N,x,f,p)){u={x:N,y:x,w:f,h:p};break e}return j(u.x,u.y,u.w,u.h),{...o,layouts:{...o.layouts,"flow-horizontal":u}}})}const Ra='<svg xmlns="http://www.w3.org/2000/svg" width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z"/></svg>';function ut(t){queueMicrotask(()=>t.unmount())}function Ta({spec:t,registry:a,onSave:n,customiseButtonTarget:m,onAccentHueChange:j,onAccentSatChange:d,onFontScaleChange:h,onUpColorChange:o,onDownColorChange:f,onModeChange:p,onBackgroundChange:u}){const z=Gs(),N=r.useRef(null),x=r.useRef(null),R=r.useRef(!1),T=r.useRef(t.grid.mode),w=r.useRef(new Map),b=r.useRef(new Map),A=r.useRef(new Map),I=r.useRef([]),le=r.useRef(t.theme.accentHue),S=r.useRef(t.theme.accentSat),P=r.useRef(t.theme.baseHue),ce=r.useRef(t.theme.baseSat),ze=r.useRef(t.theme.upColor),bt=r.useRef(t.theme.downColor),yt=r.useRef(t.grid.gap),zt=r.useRef(t.grid.paddingX),De=r.useRef(t.grid.mode),je=r.useRef(null),jt=r.useRef(t.appearance.radius),Nt=r.useRef(t.appearance.borderStrength),vt=r.useRef(t.appearance.surfaceOpacity),kt=r.useRef(t.appearance.density),wt=r.useRef(t.appearance.elevation),St=r.useRef(t.typography.fontFamily),Ct=r.useRef(t.typography.numericStyle),Rt=r.useRef(t.typography.scale),At=r.useRef(t.background.type),Mt=r.useRef(t.background.projectId),Et=r.useRef(t.background.opacity),Tt=r.useRef(t.background.color),Lt=r.useRef(t.background.gradientFrom),Ft=r.useRef(t.background.gradientTo),It=r.useRef(t.background.gradientAngle),$t=r.useRef(0),[L,_e]=r.useState(!1),Cs=ya(z,L),[Rs,Ne]=r.useState(t.frames.length),[O,Ce]=r.useState(t.theme.accentHue),[D,Re]=r.useState(t.theme.accentSat),[_,Ae]=r.useState(t.theme.baseHue),[W,Me]=r.useState(t.theme.baseSat),[U,We]=r.useState(t.theme.upColor),[q,Ue]=r.useState(t.theme.downColor),[$,Ht]=r.useState(t.grid.mode),[As,Pt]=r.useState(!1),[Q,qe]=r.useState(t.grid.gap),[oe,Ke]=r.useState(t.grid.paddingX),[K,Ee]=r.useState(t.appearance.radius),[V,Te]=r.useState(t.appearance.borderStrength),[X,Le]=r.useState(t.appearance.surfaceOpacity),[Y,Fe]=r.useState(t.appearance.density),[Z,Ie]=r.useState(t.appearance.elevation),[ee,Ve]=r.useState(t.typography.fontFamily),[te,Xe]=r.useState(t.typography.numericStyle),[se,Ye]=r.useState(t.typography.scale),[G,Ze]=r.useState(t.background.type),[J,Je]=r.useState(t.background.projectId??we[0].projectId),[ae,Qe]=r.useState(t.background.opacity),[re,et]=r.useState(t.background.color),[ue,Bt]=r.useState(t.background.gradientFrom),[me,Ot]=r.useState(t.background.gradientTo),[ne,tt]=r.useState(t.background.gradientAngle),Ms=r.useCallback(s=>{Ce(s.theme.accentHue),Re(s.theme.accentSat),Ae(s.theme.baseHue),Me(s.theme.baseSat),Ve(s.typography.fontFamily),Xe(s.typography.numericStyle),Ee(s.appearance.radius),Te(s.appearance.borderStrength),Le(s.appearance.surfaceOpacity),Fe(s.appearance.density),Ie(s.appearance.elevation);const i=we.find(l=>l.key===s.scene);i&&(Ze("unicorn"),Je(i.projectId))},[]),Gt=r.useMemo(()=>{var s;return((s=cs.find(i=>{var l;return i.theme.accentHue===O&&i.theme.accentSat===D&&i.theme.baseHue===_&&i.theme.baseSat===W&&i.typography.fontFamily===ee&&i.typography.numericStyle===te&&i.appearance.radius===K&&i.appearance.borderStrength===V&&i.appearance.surfaceOpacity===X&&i.appearance.density===Y&&i.appearance.elevation===Z&&G==="unicorn"&&((l=we.find(g=>g.key===i.scene))==null?void 0:l.projectId)===J}))==null?void 0:s.key)??null},[O,D,_,W,ee,te,K,V,X,Y,Z,G,J]),[de,Dt]=r.useState("frames"),[st,he]=r.useState(null),_t=r.useRef(null);_t.current=st,r.useEffect(()=>{j==null||j(O)},[O,j]),r.useEffect(()=>{d==null||d(D)},[D,d]),r.useEffect(()=>{h==null||h(se)},[se,h]),r.useEffect(()=>{o==null||o(U)},[U,o]),r.useEffect(()=>{f==null||f(q)},[q,f]),r.useEffect(()=>{T.current=$,p==null||p($)},[$,p]),r.useEffect(()=>{u==null||u({...t.background,type:G,projectId:J,opacity:ae,color:re,gradientFrom:ue,gradientTo:me,gradientAngle:ne})},[G,J,ae,re,ue,me,ne,t.background,u]),r.useEffect(()=>{var s;(s=x.current)==null||s.margin(Q/2)},[Q]);const Wt=r.useRef(z);Wt.current=z;const pe=r.useRef(a);pe.current=a;const ge=r.useMemo(()=>{const s=new Map;for(const c of a.values()){const y=c.category??"other",k=s.get(y);k?k.push(c):s.set(y,[c])}const i=os.map(c=>c.key),l=os.map(c=>({key:c.key,label:c.label,description:c.description,frames:s.get(c.key)??[]})),g=[...s.entries()].filter(([c])=>!i.includes(c)).flatMap(([,c])=>c);return g.length&&l.push({key:"other",label:"Other",description:"",frames:g}),l.filter(c=>c.frames.length>0).map(c=>({...c,frames:[...c.frames].sort((y,k)=>y.name.localeCompare(k.name))}))},[a]),[xe,at]=r.useState(""),$e=r.useMemo(()=>qs(xe),[xe]),Ut=$e.length>0,qt=r.useMemo(()=>$e.length===0?ge:ge.map(s=>({...s,frames:s.frames.filter(i=>Ks(i,s.label,$e))})).filter(s=>s.frames.length>0),[ge,$e]),[Kt,Es]=r.useState(()=>new Set(ge[0]?[ge[0].key]:[])),Ts=r.useCallback(s=>{Es(i=>{const l=new Set(i);return l.has(s)?l.delete(s):l.add(s),l})},[]),ve=r.useCallback(s=>s?ba(s):{},[]),He=r.useCallback(s=>{let i=`${s}-${++$t.current}`;for(;w.current.has(i);)i=`${s}-${++$t.current}`;return i},[]),Pe=r.useRef(null),ie=r.useCallback(s=>{const i=A.current.get(s),l=w.current.get(s);if(!i||!l)return;let g=b.current.get(s);g||(i.innerHTML="",g=Os.createRoot(i),b.current.set(s,g)),g.render(e.jsx(Ds,{providers:Wt.current,children:e.jsx(_s.Provider,{value:c=>{var y;return(y=Pe.current)==null?void 0:y.call(Pe,s,c)},children:e.jsx(Ws,{instance:l,registry:pe.current,className:"zf-fill"})})}))},[]),Ls=r.useCallback((s,i)=>{const l=w.current.get(s);l&&(w.current.set(s,{...l,config:{...l.config,...i}}),ie(s))},[ie]);Pe.current=Ls;const Vt=r.useCallback(s=>{const i=x.current;if(!i)return;const l=s.getAttribute("gs-id");if(l){const g=b.current.get(l);g&&ut(g),b.current.delete(l),A.current.delete(l),w.current.delete(l),_t.current===l&&he(null)}i.removeWidget(s,!0),Ne(i.getGridItems().length)},[]),fe=r.useCallback(s=>{if(!s.querySelector(".zf-cfg-btn")){const i=document.createElement("button");i.className="zf-cfg-btn",i.type="button",i.title="Edit frame",i.setAttribute("aria-label","Edit frame"),i.innerHTML=Ra,i.addEventListener("click",l=>{l.stopPropagation();const g=s.getAttribute("gs-id");g&&he(g)}),s.appendChild(i)}if(!s.querySelector(".zf-del-btn")){const i=document.createElement("button");i.className="zf-del-btn",i.type="button",i.title="Remove frame",i.innerHTML="×",i.addEventListener("click",l=>{l.stopPropagation(),Vt(s)}),s.appendChild(i)}},[Vt]),Xt=r.useCallback(s=>{var i,l;(i=s.querySelector(".zf-cfg-btn"))==null||i.remove(),(l=s.querySelector(".zf-del-btn"))==null||l.remove()},[]),Be=r.useCallback((s,i=!1)=>{const l=T.current,g=l==="flow-horizontal",c=gs(s,l),y=(c==null?void 0:c.w)??s.position.w,k=(c==null?void 0:c.h)??s.position.h,v=g?Math.min(k,t.grid.rows):k,E=pe.current.get(s.frame),C=E==null?void 0:E.layout,M=document.createElement("div");M.className="grid-stack-item",M.setAttribute("gs-id",s.id),M.setAttribute("data-frame",s.frame),i||!c?M.setAttribute("gs-auto-position","true"):(M.setAttribute("gs-x",String(c.x)),M.setAttribute("gs-y",String(c.y))),M.setAttribute("gs-w",String(y)),M.setAttribute("gs-h",String(v)),C!=null&&C.minW&&M.setAttribute("gs-min-w",String(C.minW)),C!=null&&C.minH&&M.setAttribute("gs-min-h",String(C.minH)),C!=null&&C.maxW&&M.setAttribute("gs-max-w",String(C.maxW)),C!=null&&C.maxH&&M.setAttribute("gs-max-h",String(C.maxH));const F=document.createElement("div");return F.className="grid-stack-item-content",M.appendChild(F),A.current.set(s.id,F),M},[t.grid.rows]),ke=r.useCallback(s=>{const i=x.current;if(i){b.current.forEach(ut),b.current.clear(),A.current.clear(),w.current=new Map(s.map(l=>[l.id,l])),i.removeAll(!0),i.el.querySelectorAll(".grid-stack-item").forEach(l=>l.remove()),i.batchUpdate();for(const l of s){const g=Be(l);i.el.appendChild(g),i.makeWidget(g),ie(l.id)}i.batchUpdate(!1),Ne(s.length)}},[Be,ie]),Yt=r.useCallback(s=>{var k,v;const i=x.current;if(!i)return;const l=pe.current.get(s),g=He(s),c={id:g,frame:s,position:{x:0,y:0,w:((k=l==null?void 0:l.layout)==null?void 0:k.w)??4,h:((v=l==null?void 0:l.layout)==null?void 0:v.h)??3},config:ve(l)};w.current.set(g,c);const y=Be(c,!0);i.el.appendChild(y),i.makeWidget(y),ie(g),fe(y),Ne(i.getGridItems().length),he(g)},[Be,fe,ve,ie,He]),Oe=r.useCallback(()=>{var g,c;const s=typeof window<"u"?window.innerHeight:800,i=((c=(g=N.current)==null?void 0:g.parentElement)==null?void 0:c.getBoundingClientRect().top)??120,l=s-i-56;return Math.max(80,Math.floor(l/t.grid.rows))},[t.grid.rows]),rt=r.useCallback(()=>{const s=x.current;if(!s)return;const i=s.el;s.off("dropped"),s.off("removed"),s.off("drag"),s.off("dragstart"),s.off("dragstop"),document.body.classList.remove("zf-dragging"),b.current.forEach(ut),b.current.clear(),A.current.clear(),s.destroy(!1),i&&(i.querySelectorAll(".grid-stack-item").forEach(l=>l.remove()),i.style.width="",i.style.height=""),x.current=null},[]),nt=r.useCallback((s,i)=>{const l=s==="flow-horizontal",g=l?Oe():t.grid.rowHeight,c=ls.init({column:l?i:t.grid.columns,cellHeight:g,margin:t.grid.gap/2,float:!0,...l?{maxRow:t.grid.rows,minRow:t.grid.rows}:{},animate:!0,acceptWidgets:!0,disableDrag:!0,disableResize:!0},N.current);return c.el.style.width=l?`${i*g}px`:"",c.on("dropped",(y,k,v)=>{var rs,ns;const E=v==null?void 0:v.el;if(!E)return;const C=E.querySelector(".grid-stack-item-content"),M=E.getAttribute("data-frame");if(!C||!M)return;const F=E.getAttribute("gs-id")||He(M);E.setAttribute("gs-id",F);const B=pe.current.get(M),ts=(v==null?void 0:v.w)??((rs=B==null?void 0:B.layout)==null?void 0:rs.w)??4,ss=(v==null?void 0:v.h)??((ns=B==null?void 0:B.layout)==null?void 0:ns.h)??3,as={x:(v==null?void 0:v.x)??0,y:(v==null?void 0:v.y)??0,w:ts,h:ss},Bs=T.current==="flow-horizontal"?{id:F,frame:M,position:{x:0,y:0,w:ts,h:ss},layouts:{"flow-horizontal":as},config:ve(B)}:{id:F,frame:M,position:as,config:ve(B)};w.current.set(F,Bs),A.current.set(F,C),ie(F),fe(E),Ne(c.getGridItems().length),he(F)}),c.on("removed",()=>Ne(c.getGridItems().length)),c.on("dragstart",()=>document.body.classList.add("zf-dragging")),c.on("dragstop",()=>document.body.classList.remove("zf-dragging")),l&&c.on("drag",y=>{var M,F,B;const k=(M=N.current)==null?void 0:M.parentElement;if(!k)return;const v=k.getBoundingClientRect(),E=y.clientX??((B=(F=y.touches)==null?void 0:F[0])==null?void 0:B.clientX);if(E==null)return;const C=64;E<v.left+C?k.scrollLeft-=18:E>v.right-C&&(k.scrollLeft+=18)}),c},[Oe,t.grid.columns,t.grid.rowHeight,t.grid.rows,t.grid.gap,He,ve,ie,fe]);r.useEffect(()=>{if(!N.current||R.current)return;R.current=!0;const s=T.current==="flow-horizontal",i=s?xs(t.frames,t.grid.rows):t.grid.columns;return x.current=nt(T.current,i),ke(s?bs(t.frames,i,t.grid.rows):t.frames),()=>{rt(),R.current=!1}},[]),r.useEffect(()=>{const s=x.current;s&&(s.enableMove(L),s.enableResize(L),L?s.getGridItems().forEach(fe):s.getGridItems().forEach(Xt))},[L,fe,Xt]),r.useEffect(()=>{const s=x.current;if(!s||T.current!=="flow-horizontal")return;const i=requestAnimationFrame(()=>{const l=Oe();s.cellHeight(l),s.el.style.width=`${s.getColumn()*l}px`});return()=>cancelAnimationFrame(i)},[L,Oe]),r.useEffect(()=>{!L||de!=="frames"||!x.current||ls.setupDragIn(".zf-newwidget",{appendTo:"body",helper:s=>{var C;const l=(s.closest(".zf-newwidget")??s).dataset.frame??"",g=pe.current.get(l),c=g==null?void 0:g.layout,y=document.createElement("div");y.className="grid-stack-item",y.setAttribute("data-frame",l),y.setAttribute("gs-w",String((c==null?void 0:c.w)??4)),y.setAttribute("gs-h",String((c==null?void 0:c.h)??3)),c!=null&&c.minW&&y.setAttribute("gs-min-w",String(c.minW)),c!=null&&c.minH&&y.setAttribute("gs-min-h",String(c.minH)),c!=null&&c.maxW&&y.setAttribute("gs-max-w",String(c.maxW)),c!=null&&c.maxH&&y.setAttribute("gs-max-h",String(c.maxH));const k=(C=N.current)==null?void 0:C.closest(".zf-editor");if(k){const M=getComputedStyle(k);for(const F of["--zf-accent-hue","--zf-accent-sat","--font-dmsans"]){const B=M.getPropertyValue(F).trim();B&&y.style.setProperty(F,B)}}const v=l.replace(/-/g," "),E=g!=null&&g.iconUrl?`<img class="zf-drag-ghost-icon" src="${g.iconUrl}" alt="" />`:"";return y.innerHTML=`<div class="grid-stack-item-content zf-drag-ghost" data-frame="${l}">${E}<span class="zf-drag-ghost-name">${v}</span></div>`,y}})},[L,de,ge,Kt]);const be=r.useCallback(()=>{const s=x.current,i=[];if(s)for(const l of s.getGridItems()){const g=l.getAttribute("gs-id");if(!g)continue;const c=w.current.get(g);if(!c)continue;const y=l.gridstackNode,k=gs(c,$)??c.position,v={x:(y==null?void 0:y.x)??k.x,y:(y==null?void 0:y.y)??k.y,w:(y==null?void 0:y.w)??k.w,h:(y==null?void 0:y.h)??k.h};i.push($==="flow-horizontal"?{...c,layouts:{...c.layouts,"flow-horizontal":v}}:{...c,position:v})}return i.sort((l,g)=>l.position.y-g.position.y||l.position.x-g.position.x),{...t,grid:{...t.grid,gap:Q,paddingX:oe,mode:$},background:{...t.background,type:G,projectId:J,opacity:ae,color:re,gradientFrom:ue,gradientTo:me,gradientAngle:ne},theme:{...t.theme,accentHue:O,accentSat:D,baseHue:_,baseSat:W,upColor:U,downColor:q},typography:{...t.typography,fontFamily:ee,numericStyle:te,scale:se},appearance:{...t.appearance,radius:K,borderStrength:V,surfaceOpacity:X,density:Y,elevation:Z},frames:i}},[t,O,D,_,W,U,q,ee,te,se,Q,oe,$,K,V,X,Y,Z,G,J,ae,re,ue,me,ne]),Zt=r.useCallback(s=>{const i=new Blob([`${JSON.stringify(s,null,2)}
|
|
68
|
+
`],{type:"application/json"}),l=URL.createObjectURL(i),g=document.createElement("a");g.href=l,g.download="dashboard.json",g.click(),setTimeout(()=>URL.revokeObjectURL(l),0)},[]),Fs=r.useCallback(()=>{I.current=be().frames,le.current=O,S.current=D,P.current=_,ce.current=W,ze.current=U,bt.current=q,yt.current=Q,zt.current=oe,De.current=$,jt.current=K,Nt.current=V,vt.current=X,kt.current=Y,wt.current=Z,St.current=ee,Ct.current=te,Rt.current=se,At.current=G,Mt.current=J,Et.current=ae,Tt.current=re,Lt.current=ue,Ft.current=me,It.current=ne,_e(!0)},[be,O,D,_,W,U,q,Q,oe,$,K,V,X,Y,Z,ee,te,se,G,J,ae,re,ue,me,ne]),Is=r.useCallback(()=>{(De.current!==T.current||JSON.stringify(be().frames)!==JSON.stringify(I.current))&&ke(I.current),Ce(le.current),Re(S.current),Ae(P.current),Me(ce.current),We(ze.current),Ue(bt.current),qe(yt.current),Ke(zt.current),Ht(De.current),Ee(jt.current),Te(Nt.current),Le(vt.current),Fe(kt.current),Ie(wt.current),Ve(St.current),Xe(Ct.current),Ye(Rt.current),Ze(At.current),Je(Mt.current??we[0].projectId),Qe(Et.current),et(Tt.current),Bt(Lt.current),Ot(Ft.current),tt(It.current),he(null),_e(!1)},[ke,be]),$s=r.useCallback(async()=>{const s=be();_e(!1),he(null),n?await n(s):Zt(s)},[be,n,Zt]),Hs=r.useCallback(()=>{var s;(s=x.current)==null||s.compact(T.current==="flow-horizontal"?"list":"compact")},[]),Jt=r.useCallback(()=>{const s=x.current;if(!s)return;const i=T.current;for(const l of s.getGridItems()){const g=l.getAttribute("gs-id");if(!g)continue;const c=w.current.get(g);if(!c)continue;const y=l.gridstackNode;if(!y)continue;const k={x:y.x??0,y:y.y??0,w:y.w??1,h:y.h??1};w.current.set(g,i==="flow-horizontal"?{...c,layouts:{...c.layouts,"flow-horizontal":k}}:{...c,position:k})}},[]),Qt=r.useCallback(s=>{var g;if(s===T.current)return;const i=()=>{Jt();const c=[...w.current.values()],y=L,k=s==="flow-horizontal",v=k?xs(c,t.grid.rows):t.grid.columns;rt(),T.current=s,Ht(s);const E=nt(s,v);x.current=E,ke(k?bs(c,v,t.grid.rows):c),y&&(E.enableMove(!0),E.enableResize(!0),E.getGridItems().forEach(fe))};if(typeof window<"u"&&((g=window.matchMedia)==null?void 0:g.call(window,"(prefers-reduced-motion: reduce)").matches)){i();return}je.current&&clearTimeout(je.current),Pt(!0),je.current=setTimeout(()=>{i(),requestAnimationFrame(()=>Pt(!1))},150)},[L,Jt,rt,nt,ke,fe,t.grid.rows,t.grid.columns]);r.useEffect(()=>()=>{je.current&&clearTimeout(je.current)},[]);const es=()=>e.jsx("button",{type:"button",className:"zf-btn zf-btn--icon",onClick:Fs,"aria-label":"Customise",title:"Customise",children:e.jsx(ca,{size:18,"aria-hidden":"true"})}),it=L&&st?w.current.get(st):void 0,Ps=$==="flow-horizontal";return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:Us}),m&&!L?is.createPortal(es(),m):null,e.jsxs("div",{className:L?"zf-editor zf-customise":"zf-editor","data-mode":$,"data-wiggle":L&&Rs>12?"off":void 0,style:{"--zf-accent-hue":O,"--zf-accent-sat":`${D}%`,"--zf-base-hue":_,"--zf-base-sat":`${W}%`,"--zf-up":U,"--zf-down":q,"--zf-font-family":ms[ee],"--zf-numeric":us[te],"--zf-frame-radius":`${K}px`,"--zf-border-alpha":V,"--zf-surface-opacity":X,"--zf-density":Y,"--zf-elevation":Z,"--zf-pad-x":`${oe}px`},children:[(L||!m)&&e.jsxs("div",{className:"zf-editor-bar",children:[e.jsx("div",{className:"zf-editor-bar-spacer"}),L?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"zf-btn zf-btn--ghost",onClick:Hs,title:"Reclaim empty grid space",children:"Tidy"}),e.jsx("button",{type:"button",className:"zf-btn zf-btn--ghost",onClick:Is,children:"Cancel"}),e.jsx("button",{type:"button",className:"zf-btn zf-btn--primary",onClick:$s,children:"Save"})]}):es()]}),e.jsxs("div",{className:"zf-editor-main",children:[e.jsx("div",{className:"zf-editor-grid","data-switching":As,children:e.jsx("div",{ref:N,className:"grid-stack"})}),e.jsx("aside",{className:"zf-rail","aria-hidden":!L,inert:!L,children:e.jsxs("div",{className:"zf-rail-inner",children:[e.jsxs("div",{className:"zf-rail-tabs",role:"tablist","aria-label":"Customise",children:[e.jsx("button",{type:"button",role:"tab","aria-selected":de==="frames",className:de==="frames"?"zf-rail-tab is-active":"zf-rail-tab",onClick:()=>Dt("frames"),children:"Frames"}),e.jsx("button",{type:"button",role:"tab","aria-selected":de==="cosmetics",className:de==="cosmetics"?"zf-rail-tab is-active":"zf-rail-tab",onClick:()=>Dt("cosmetics"),children:"Cosmetics"})]}),de==="cosmetics"&&e.jsxs(e.Fragment,{children:[e.jsxs("section",{className:"zf-theme",children:[e.jsx("h3",{className:"zf-rail-title",style:{margin:0},children:"Presets"}),e.jsx("div",{className:"zf-presets",children:cs.map(s=>e.jsxs("button",{type:"button",className:Gt===s.key?"zf-preset is-active":"zf-preset",title:s.description,"aria-pressed":Gt===s.key,onClick:()=>Ms(s),children:[e.jsx("span",{className:"zf-preset-swatch",style:{background:`linear-gradient(135deg, hsl(${s.theme.baseHue} ${s.theme.baseSat}% 16%) 0 52%, hsl(${s.theme.accentHue} ${s.theme.accentSat}% 62%) 52% 100%)`}}),e.jsx("span",{className:"zf-preset-label",children:s.label})]},s.key))})]}),e.jsxs("section",{className:"zf-theme",children:[e.jsx("h3",{className:"zf-rail-title",style:{margin:0},children:"Accent"}),e.jsxs("div",{className:"zf-theme-row",style:{margin:"10px 0 0"},children:[e.jsxs("span",{className:"zf-theme-val",children:[e.jsx("span",{className:"zf-theme-swatch"}),"Hue ",O,"°"]}),O!==242&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Ce(242),children:"Reset"})]}),e.jsx("input",{type:"range",className:"zf-hue-slider",min:0,max:360,value:O,"aria-label":"Accent hue",onChange:s=>Ce(Number(s.target.value))}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Saturation"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[D!==90&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Re(90),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[D,"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:100,value:D,"aria-label":"Accent saturation",onChange:s=>Re(Number(s.target.value))})]}),e.jsxs("section",{className:"zf-theme",children:[e.jsx("h3",{className:"zf-rail-title",children:"Surface"}),e.jsxs("div",{className:"zf-theme-row",style:{margin:"10px 0 0"},children:[e.jsxs("span",{className:"zf-theme-val",children:[e.jsx("span",{className:"zf-theme-swatch",style:{background:`hsl(${_} ${W}% 32%)`,boxShadow:"none"}}),"Tint ",_,"°"]}),_!==233&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Ae(233),children:"Reset"})]}),e.jsx("input",{type:"range",className:"zf-hue-slider",min:0,max:360,value:_,"aria-label":"Surface tint hue",onChange:s=>Ae(Number(s.target.value))}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Tint strength"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[W!==20&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Me(20),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[W,"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:100,value:W,"aria-label":"Surface tint strength",onChange:s=>Me(Number(s.target.value))})]}),e.jsxs("section",{className:"zf-theme",children:[e.jsx("h3",{className:"zf-rail-title",children:"Gain / Loss"}),e.jsxs("div",{className:"zf-theme-row",style:{margin:"10px 0 0"},children:[e.jsxs("label",{className:"zf-theme-val",children:[e.jsx("input",{type:"color",className:"zf-color",value:U,"aria-label":"Gain (up) colour",onChange:s=>We(s.target.value)}),"Up ",U]}),U.toLowerCase()!=="#3fd08f"&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>We("#3fd08f"),children:"Reset"})]}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:9},children:[e.jsxs("label",{className:"zf-theme-val",children:[e.jsx("input",{type:"color",className:"zf-color",value:q,"aria-label":"Loss (down) colour",onChange:s=>Ue(s.target.value)}),"Down ",q]}),q.toLowerCase()!=="#ff6b81"&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Ue("#ff6b81"),children:"Reset"})]})]}),e.jsxs("section",{className:"zf-theme",children:[e.jsx("h3",{className:"zf-rail-title",children:"Background"}),e.jsx("div",{className:"zf-seg",role:"group","aria-label":"Background style",children:["none","color","gradient","unicorn"].map(s=>e.jsx("button",{type:"button",className:G===s?"zf-seg-btn is-active":"zf-seg-btn","aria-pressed":G===s,onClick:()=>Ze(s),children:s==="none"?"Glow":s==="color"?"Color":s==="gradient"?"Gradient":"Scene"},s))}),G==="color"&&e.jsxs("div",{className:"zf-theme-row",style:{marginTop:12},children:[e.jsxs("label",{className:"zf-theme-val",children:[e.jsx("input",{type:"color",className:"zf-color",value:re,"aria-label":"Background colour",onChange:s=>et(s.target.value)}),re]}),re.toLowerCase()!=="#0a0a12"&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>et("#0a0a12"),children:"Reset"})]}),G==="gradient"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"zf-theme-row",style:{marginTop:12},children:e.jsxs("label",{className:"zf-theme-val",children:[e.jsx("input",{type:"color",className:"zf-color",value:ue,"aria-label":"Gradient start colour",onChange:s=>Bt(s.target.value)}),"From ",ue]})}),e.jsx("div",{className:"zf-theme-row",style:{marginTop:9},children:e.jsxs("label",{className:"zf-theme-val",children:[e.jsx("input",{type:"color",className:"zf-color",value:me,"aria-label":"Gradient end colour",onChange:s=>Ot(s.target.value)}),"To ",me]})}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Angle"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[ne!==160&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>tt(160),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[ne,"°"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:360,value:ne,"aria-label":"Gradient angle",onChange:s=>tt(Number(s.target.value))})]}),G==="unicorn"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"zf-presets",style:{marginTop:12},role:"group","aria-label":"Background scene",children:we.map(s=>e.jsxs("button",{type:"button",className:J===s.projectId?"zf-preset is-active":"zf-preset",title:s.description,"aria-pressed":J===s.projectId,onClick:()=>Je(s.projectId),children:[e.jsx("span",{className:"zf-preset-swatch",style:{background:s.swatch}}),e.jsx("span",{className:"zf-preset-label",children:s.label})]},s.key))}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Opacity"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[ae!==.16&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Qe(.16),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Math.round(ae*100),"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:.6,step:.02,value:ae,"aria-label":"Background scene opacity",onChange:s=>Qe(Math.round(Number(s.target.value)*100)/100)})]})]}),e.jsxs("section",{className:"zf-theme",children:[e.jsx("h3",{className:"zf-rail-title",children:"Layout"}),e.jsx("div",{className:"zf-theme-row",children:e.jsx("span",{className:"zf-theme-val",children:"Direction"})}),e.jsxs("div",{className:"zf-mode-seg",role:"group","aria-label":"Dashboard layout direction",children:[e.jsx("button",{type:"button",className:$==="flow-vertical"?"zf-mode-seg-btn is-active":"zf-mode-seg-btn","aria-pressed":$==="flow-vertical",onClick:()=>Qt("flow-vertical"),children:"Vertical"}),e.jsx("button",{type:"button",className:$==="flow-horizontal"?"zf-mode-seg-btn is-active":"zf-mode-seg-btn","aria-pressed":$==="flow-horizontal",onClick:()=>Qt("flow-horizontal"),children:"Horizontal"})]}),Ps&&e.jsx("p",{className:"zf-mode-seg-hint",children:"Rows fill the height; the board scrolls sideways. Arrange it freely — this layout is saved separately from Vertical."}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Frame gap"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[Q!==12&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>qe(12),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Q,"px"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:12,value:Q,"aria-label":"Frame gap",onChange:s=>qe(Number(s.target.value))}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Side padding"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[oe!==0&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Ke(0),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[oe,"px"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:96,step:4,value:oe,"aria-label":"Grid side padding",onChange:s=>Ke(Number(s.target.value))})]}),e.jsxs("section",{className:"zf-theme",children:[e.jsx("h3",{className:"zf-rail-title",children:"Appearance"}),e.jsxs("div",{className:"zf-theme-row",children:[e.jsx("span",{className:"zf-theme-val",children:"Corner radius"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[K!==18&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Ee(18),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[K,"px"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:32,value:K,"aria-label":"Corner radius",onChange:s=>Ee(Number(s.target.value))}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Border"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[V!==.22&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Te(.22),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Math.round(V*100),"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:1,step:.01,value:V,"aria-label":"Border strength",onChange:s=>Te(Math.round(Number(s.target.value)*100)/100)}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Card opacity"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[X!==1&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Le(1),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Math.round(X*100),"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:.3,max:1,step:.05,value:X,"aria-label":"Card opacity",onChange:s=>Le(Math.round(Number(s.target.value)*100)/100)}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Density"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[Y!==1&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Fe(1),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Math.round(Y*100),"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:.6,max:1.4,step:.05,value:Y,"aria-label":"Card density",onChange:s=>Fe(Math.round(Number(s.target.value)*100)/100)}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Elevation"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[Z!==1&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Ie(1),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Z.toFixed(1),"×"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:2,step:.1,value:Z,"aria-label":"Card elevation",onChange:s=>Ie(Math.round(Number(s.target.value)*10)/10)})]}),e.jsxs("section",{className:"zf-theme",children:[e.jsx("h3",{className:"zf-rail-title",children:"Typography"}),e.jsx("div",{className:"zf-theme-row",children:e.jsx("span",{className:"zf-theme-val",children:"Font"})}),e.jsx("div",{className:"zf-seg",role:"group","aria-label":"Font family",children:["sans","mono","serif"].map(s=>e.jsx("button",{type:"button",className:ee===s?"zf-seg-btn is-active":"zf-seg-btn","aria-pressed":ee===s,style:{fontFamily:ms[s]},onClick:()=>Ve(s),children:s==="sans"?"Sans":s==="mono"?"Mono":"Serif"},s))}),e.jsx("div",{className:"zf-theme-row",style:{marginTop:13},children:e.jsx("span",{className:"zf-theme-val",children:"Numbers"})}),e.jsx("div",{className:"zf-seg",role:"group","aria-label":"Numeric style",children:["proportional","tabular"].map(s=>e.jsx("button",{type:"button",className:te===s?"zf-seg-btn is-active":"zf-seg-btn","aria-pressed":te===s,onClick:()=>Xe(s),children:e.jsx("span",{style:{fontVariantNumeric:us[s]},children:s==="proportional"?"Normal 1,071":"Tabular 1,071"})},s))}),e.jsxs("div",{className:"zf-theme-row",style:{marginTop:13},children:[e.jsx("span",{className:"zf-theme-val",children:"Text size"}),e.jsxs("span",{className:"zf-theme-knob-end",children:[se!==1&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Ye(1),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Math.round(se*100),"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:.85,max:1.25,step:.05,value:se,"aria-label":"Text size",onChange:s=>Ye(Math.round(Number(s.target.value)*100)/100)})]})]}),de==="frames"&&e.jsxs("section",{children:[e.jsx("h3",{className:"zf-rail-title",children:"Add a frame"}),e.jsx("p",{className:"zf-palette-hint",children:"Search, or open a category, then click a frame to add it — or drag it onto the grid."}),e.jsxs("div",{className:"zf-palette-search",children:[e.jsx(zs,{size:14,"aria-hidden":"true"}),e.jsx("input",{type:"text",value:xe,placeholder:"Search frames…","aria-label":"Search frames",autoComplete:"off",spellCheck:!1,onChange:s=>at(s.target.value),onKeyDown:s=>{s.key==="Escape"&&xe&&(s.preventDefault(),at(""))}}),xe&&e.jsx("button",{type:"button",className:"zf-palette-search-clear","aria-label":"Clear search",onClick:()=>at(""),children:e.jsx("svg",{viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:"M4 4l8 8M12 4l-8 8",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"zf-palette-cats",children:[Ut&&qt.length===0&&e.jsxs("p",{className:"zf-palette-empty",children:["No frames match “",xe.trim(),"”."]}),qt.map(s=>{const i=Ut||Kt.has(s.key);return e.jsxs("div",{className:i?"zf-palette-cat is-open":"zf-palette-cat",children:[e.jsxs("button",{type:"button",className:"zf-palette-cat-header","aria-expanded":i,onClick:()=>Ts(s.key),children:[e.jsx("svg",{className:"zf-palette-cat-chevron",viewBox:"0 0 16 16","aria-hidden":"true",children:e.jsx("path",{d:"M6 4l4 4-4 4",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{className:"zf-palette-cat-label",children:s.label}),e.jsx("span",{className:"zf-palette-cat-count",children:s.frames.length})]}),i&&e.jsxs("div",{className:"zf-palette-cat-body",children:[s.description&&e.jsx("p",{className:"zf-palette-cat-desc",children:s.description}),e.jsx("div",{className:"zf-palette",children:s.frames.map(l=>{var g,c,y,k,v,E;return e.jsxs("div",{className:"grid-stack-item zf-newwidget","data-frame":l.name,"gs-w":((g=l.layout)==null?void 0:g.w)??4,"gs-h":((c=l.layout)==null?void 0:c.h)??3,"gs-min-w":(y=l.layout)==null?void 0:y.minW,"gs-min-h":(k=l.layout)==null?void 0:k.minH,"gs-max-w":(v=l.layout)==null?void 0:v.maxW,"gs-max-h":(E=l.layout)==null?void 0:E.maxH,role:"button",tabIndex:0,title:`Drag onto the board, or click to add ${l.label}`,onClick:()=>Yt(l.name),onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),Yt(l.name))},children:[l.iconUrl&&e.jsx("img",{className:"zf-newwidget-icon",src:l.iconUrl,alt:"",loading:"lazy",draggable:!1}),e.jsxs("div",{className:"zf-newwidget-copy",children:[e.jsx("div",{className:"zf-newwidget-name",children:l.label}),e.jsx("div",{className:"zf-newwidget-desc",children:l.description})]})]},l.name)})})]})]},s.key)})]})]})]})})]})]}),it?is.createPortal(e.jsx(za,{instance:it,registry:a,instancesRef:w,symbolUniverse:Cs,accentHue:O,onApply:s=>ie(s),onClose:()=>he(null)},it.id),document.body):null]})}export{Ta as DashboardEditor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as s}from"./react-qoZPGuNy.js";import{c as a,f as o}from"./format-CfAcS4D8.js";import{M as d}from"./metric-row-BVVhjsjK.js";import{f as m,bz as n,bA as x}from"./index-DyvZokhk.js";import{F as r,s as p}from"./ui-Bq3RQsdJ.js";n.schema;const i=e=>e>=0?`+${o(e)}`:o(e);function u({config:e}){const{flows:l,isLoading:c}=x(e.asset);if(c)return s.jsx(r,{loading:!0,children:"loading ETF flows…"});if(!l)return s.jsx(r,{children:"ETF flows unavailable"});const f=l.issuers.slice(0,e.limit);return s.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-2",children:[s.jsxs("div",{children:[s.jsxs("div",{className:"caption text-soft",children:[e.asset.toUpperCase()," spot ETF · net flow",l.date?` · ${l.date}`:""]}),s.jsx("div",{className:"metric-lg leading-none",style:{color:a(l.dailyTotalNetInflow)},children:i(l.dailyTotalNetInflow)})]}),s.jsx("div",{className:`${p} flex flex-col`,children:f.map(t=>s.jsx(d,{label:t.ticker,meta:t.institute,value:s.jsx("span",{style:{color:a(t.dailyNetInflow)},children:i(t.dailyNetInflow)})},t.ticker))})]})}const g=m({...n,component:u});export{g as etfFlowsFrame};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as f,j as s}from"./react-qoZPGuNy.js";import{f as c}from"./format-CfAcS4D8.js";import{f as h,bI as l,bA as d}from"./index-DyvZokhk.js";import{F as n}from"./ui-Bq3RQsdJ.js";import{a as r,C}from"./chart-utils-BYIZMM9J.js";import{M}from"./index-Bx7RmzY8.js";import"./d3-xK4fOkBU.js";import"./utils-DaT-yT0k.js";const F={"1M":{ms:30*864e5,timeframe:r["1M"]},"3M":{ms:90*864e5,timeframe:r["3M"]},"6M":{ms:180*864e5,timeframe:r.YTD}};l.schema;function w({config:t}){const{ms:o,timeframe:u}=F[t.lookback],m=f.useMemo(()=>Date.now()-o,[o]),{flows:e,isLoading:p}=d(t.asset),i=f.useMemo(()=>[{id:t.asset,name:`${t.asset.toUpperCase()} net flow`,color:C[0],data:((e==null?void 0:e.history)??[]).filter(a=>a.time>=m).map(a=>({date:new Date(a.time).toISOString(),value:a.value}))}],[e,t.asset,m]);return p?s.jsx(n,{loading:!0,children:"loading ETF flows…"}):i[0].data.length===0?s.jsx(n,{children:"ETF flows unavailable"}):s.jsx(M,{series:i,timeframe:u,height:220,formatValue:c})}const I=h({...l,component:w});export{I as etfFlowsChartFrame};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t}from"./react-qoZPGuNy.js";import{M as e,Z as a}from"./cycle-shared-BOGcJDzT.js";import{U as n,b as s}from"./format-CfAcS4D8.js";import{f as p,bw as m,bv as l}from"./index-DyvZokhk.js";import{F as i}from"./ui-Bq3RQsdJ.js";import"./indicators-CogwjDn9.js";import"./mini-line-chart-CHM5UBjJ.js";import"./d3-xK4fOkBU.js";import"./utils-DaT-yT0k.js";function u(){const{supply:r,isLoading:o}=l();return o?t.jsx(i,{loading:!0,children:"loading staking APR…"}):r?t.jsx(e,{caption:"ETH Staking APR",headline:s(r.stakingAprPct),headlineColor:n,zone:{label:"validator yield",color:a},sub:"issuance + MEV + tips",sparkline:[],sparkColor:a}):t.jsx(i,{children:"no ETH data yet"})}const b=p({...m,component:u});export{b as ethStakingFrame};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e}from"./react-qoZPGuNy.js";import{M as s}from"./cycle-shared-BOGcJDzT.js";import{U as p,D as l}from"./format-CfAcS4D8.js";import{f as u,bu as m,bv as y}from"./index-DyvZokhk.js";import{F as a}from"./ui-Bq3RQsdJ.js";import"./indicators-CogwjDn9.js";import"./mini-line-chart-CHM5UBjJ.js";import"./d3-xK4fOkBU.js";import"./utils-DaT-yT0k.js";const n=r=>`${Math.round(r).toLocaleString("en-US")} ETH/yr`;function c(){const{supply:r,isLoading:i}=y();if(i)return e.jsx(a,{loading:!0,children:"loading ETH supply…"});if(!r)return e.jsx(a,{children:"no ETH data yet"});const t=r.supplyGrowthYearlyPct,o=t<=0?p:l;return e.jsx(s,{caption:"ETH Net Supply Growth · yr",headline:`${t>=0?"+":""}${t.toFixed(2)}%`,headlineColor:o,zone:{label:t<=0?"Deflationary":"Inflationary",color:o},sub:`burn ${n(r.burnRateYearlyEth)} · issue ${n(r.issuanceRateYearlyEth)}`,sparkline:r.history,sparkColor:o})}const F=u({...m,component:c});export{F as ethSupplyFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e}from"./react-qoZPGuNy.js";import{f as u,C as l,D as m}from"./index-
|
|
1
|
+
import{r as c,j as e}from"./react-qoZPGuNy.js";import{f as u,C as l,D as m}from"./index-DyvZokhk.js";import{F as i}from"./ui-Bq3RQsdJ.js";import{M as p}from"./mini-line-chart-CHM5UBjJ.js";import"./d3-xK4fOkBU.js";import"./utils-DaT-yT0k.js";l.schema;function x(r){return r<=25?"#F21553":r<=45?"#F97316":r<=55?"#F59E0B":r<=75?"#84CC16":"#25A78D"}function f({config:r}){const{points:s,isLoading:o}=m(r.sparklineDays),t=s[0],d=c.useMemo(()=>[...s].reverse().map(n=>({date:new Date(n.time).toISOString(),value:n.value})),[s]);if(o)return e.jsx(i,{loading:!0,children:"loading index…"});if(!t)return e.jsx(i,{children:"no sentiment data yet"});const a=x(t.value);return e.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2.5",children:[e.jsx("div",{className:"metric-xl leading-none",style:{color:a,textShadow:`0 0 28px ${a}55`},children:t.value}),e.jsx("div",{className:"body-sm rounded-full px-2.5 py-0.5 font-semibold uppercase tracking-wide",style:{color:a,background:`${a}1f`,border:`1px solid ${a}33`},children:t.classification}),e.jsxs("div",{className:"relative w-full max-w-[180px] overflow-hidden rounded-xl",children:[e.jsx("div",{className:"h-[11px] w-full opacity-40",style:{background:"linear-gradient(90deg, #FF1F5F 4.89%, #464646 34.15%, #464646 69.98%, #81FE90 100%)"}}),e.jsx("div",{className:"absolute left-0 top-0 h-full w-full",style:{background:"repeating-linear-gradient(to right, var(--color-background-terminal), var(--color-background-terminal) 2px, transparent 2px, transparent 3px)"}}),e.jsx("div",{className:"absolute top-1/2 h-3 w-[3px] -translate-x-1/2 -translate-y-1/2 rounded-xs",style:{left:`${t.value}%`,background:a}})]}),e.jsx(p,{data:d,width:150,height:30,color:a}),e.jsxs("div",{className:"caption text-soft",children:["crypto fear & greed · ",r.sparklineDays,"d"]})]})}const b=u({...l,component:f});export{b as fearGreedFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as t}from"./react-qoZPGuNy.js";import{f,E as p,G as h,h as u,A as F}from"./index-
|
|
1
|
+
import{r as x,j as t}from"./react-qoZPGuNy.js";import{f,E as p,G as h,h as u,A as F}from"./index-DyvZokhk.js";import{F as j}from"./feed-row-mVg1d5Zj.js";import{t as b}from"./format-CfAcS4D8.js";import{F as a,s as y}from"./ui-Bq3RQsdJ.js";p.schema;const n={"10-K":"Annual report","10-Q":"Quarterly report","8-K":"Material event","20-F":"Annual report (foreign)","40-F":"Annual report (foreign)","6-K":"Foreign interim report","S-1":"Registration","S-3":"Registration","S-4":"Registration (M&A)","DEF 14A":"Proxy statement",DEFA14A:"Proxy materials","SC 13D":"Activist stake","SC 13G":"Passive stake",SD:"Specialized disclosure",3:"Initial insider ownership",4:"Insider transaction",5:"Annual insider ownership",144:"Proposed insider sale","11-K":"Employee benefit plan"},A=/^(10-K|10-Q|8-K|20-F|40-F|6-K|S-|F-|424|DEF |DEFA|DEFM|11-K|SC 13|25)/i,E=/^(3|4|5|144)(\/A)?$/;function l(e){return e.replace(/^SCHEDULE /i,"SC ").trim()}function S(e,s){return s==="all"?!0:s==="insider"?E.test(e):A.test(e)}function D(e){const s=l(e.form);if(n[s])return n[s];const r=s.replace(/\/A$/,"");return r!==s&&n[r]?`${n[r]} (amended)`:e.description&&e.description.toUpperCase()!==e.form.toUpperCase()?e.description:s}function N({filing:e}){return t.jsx(j,{href:e.url,titleAttr:e.form,leading:t.jsx("span",{className:"caption text-strong inline-flex w-16 shrink-0 justify-center truncate rounded bg-white/[0.06] px-1.5 py-1 font-bold",children:l(e.form)}),title:D(e),subtitle:e.reportDate?`period ${e.reportDate}`:e.items?`items ${e.items}`:e.accessionNumber,meta:e.filingDate?b(new Date(e.filingDate).getTime()):void 0})}function v({config:e}){const{data:s,isLoading:r}=h(e.symbol),m=x.useMemo(()=>((s==null?void 0:s.filings)??[]).filter(i=>S(l(i.form),e.forms)).slice(0,e.count),[s==null?void 0:s.filings,e.forms,e.count]);if(r)return t.jsx(a,{loading:!0,children:"loading SEC filings…"});if(!s)return t.jsxs(a,{children:["no SEC data for “",u(e.symbol),"”"]});const o=s.tickers[0],c=e.symbol.includes(":")?e.symbol:o?`xyz:${o}`:null,d=[s.exchanges[0],s.category].filter(Boolean).join(" · ");return t.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[c&&t.jsx(F,{symbol:c,size:22}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"body-sm text-strong truncate font-semibold",children:s.name||o||u(e.symbol)}),d&&t.jsx("div",{className:"caption text-soft truncate",children:d})]})]}),t.jsx("div",{className:"caption text-soft shrink-0 text-right",children:"filings"})]}),t.jsx("div",{className:y,children:m.length>0?m.map(i=>t.jsx(N,{filing:i},i.accessionNumber)):t.jsxs(a,{children:["no ",e.forms==="all"?"":`${e.forms} `,"filings yet"]})})]})}const k=f({...p,component:v});export{k as filingsFeedFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e}from"./react-qoZPGuNy.js";import{D as m,U as x}from"./format-CfAcS4D8.js";import{f as h,J as l,K as u}from"./index-
|
|
1
|
+
import{r as c,j as e}from"./react-qoZPGuNy.js";import{D as m,U as x}from"./format-CfAcS4D8.js";import{f as h,J as l,K as u}from"./index-DyvZokhk.js";import{F as r}from"./ui-Bq3RQsdJ.js";import{M as f}from"./mini-line-chart-CHM5UBjJ.js";import"./d3-xK4fOkBU.js";import"./utils-DaT-yT0k.js";l.schema;function n(t){return t>0?m:x}function p(t){return t>=2.5?"high stress":t>=1?"elevated":t>-1?"near average":"below average"}function j({config:t}){const{stress:s,isLoading:d}=u(),o=c.useMemo(()=>((s==null?void 0:s.trend)??[]).slice(-t.trendDays).map(a=>({date:new Date(a.time).toISOString(),value:a.value})),[t.trendDays,s==null?void 0:s.trend]);if(d)return e.jsx(r,{loading:!0,children:"loading stress index…"});if(!s)return e.jsx(r,{children:"no stress-index data yet"});const i=n(s.value);return e.jsxs("div",{className:"flex h-full min-h-0 flex-col justify-center gap-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"caption text-soft uppercase",children:"OFR FSI"}),e.jsx("div",{className:"body-sm text-normal",children:s.date})]}),e.jsx("div",{className:"caption text-soft text-right",children:"daily"})]}),e.jsxs("div",{className:"flex items-end justify-between gap-3",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"metric-xl leading-none",style:{color:i,textShadow:`0 0 24px ${i}44`},children:[s.value>0?"+":"",s.value.toFixed(2)]}),e.jsx("div",{className:"caption text-soft mt-1",children:p(s.value)})]}),e.jsxs("div",{className:"caption text-soft max-w-[46%] text-right leading-snug",children:["0 = long-run average",e.jsx("br",{}),"higher = more stress"]})]}),e.jsx(f,{data:o,width:210,height:42,color:i}),t.showCategories&&s.categories.length>0&&e.jsx("div",{className:"grid grid-cols-2 gap-1.5 border-t border-white/[0.08] pt-2",children:s.categories.map(a=>e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"caption text-soft truncate",children:a.label}),e.jsxs("span",{className:"body-sm font-bold tabular-nums",style:{color:n(a.value)},children:[a.value>0?"+":"",a.value.toFixed(2)]})]},a.label))})]})}const y=h({...l,component:j});export{y as financialStressFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as x}from"./react-qoZPGuNy.js";import{a as F,d as _,G as I}from"./game-ui-Dy_QYsPr.js";import{f as O,aB as v}from"./index-
|
|
1
|
+
import{r as i,j as x}from"./react-qoZPGuNy.js";import{a as F,d as _,G as I}from"./game-ui-Dy_QYsPr.js";import{f as O,aB as v}from"./index-DyvZokhk.js";import"./format-CfAcS4D8.js";const L=.225,j=-3.6,b=52,A=132,z=210,U=1.3,C=64,p=12,M=28,N=28,R={bird:"rgba(255, 255, 255, 0.95)",eye:"rgba(0, 0, 0, 0.8)",pipe:"hsla(160, 64%, 40%, 0.9)",ground:"rgba(255, 255, 255, 0.1)"};function B(t,r,f,d){t.save(),t.translate(C,r),t.rotate(Math.max(-.5,Math.min(.9,f*.06))),t.fillStyle=R.bird,t.beginPath(),t.arc(0,0,p,0,Math.PI*2),t.fill(),t.fillStyle=d,t.fillRect(-p+2,0,10,5),t.fillStyle=R.eye,t.beginPath(),t.arc(5,-4,2,0,Math.PI*2),t.fill(),t.restore()}function V(t,r,f,d,y,h){r.clearRect(0,0,t.width,t.height);const c=t.height-M;r.fillStyle=R.ground,r.fillRect(0,c,t.width,2),B(r,t.height/2,0,h),r.textAlign="center",f==="idle"?(r.fillStyle=I.text,r.font='bold 14px "DM Sans", sans-serif',r.fillText("Press SPACE or tap to fly",t.width/2,t.height/2-40)):(r.fillStyle=I.gameOver,r.font='bold 20px "DM Sans", sans-serif',r.fillText("GAME OVER",t.width/2,t.height/2-50),r.fillStyle=I.text,r.font='bold 14px "DM Sans", sans-serif',r.fillText(`Score: ${d}`,t.width/2,t.height/2-22),r.fillStyle=I.textSoft,r.fillText("Press SPACE or tap to retry",t.width/2,t.height/2+6)),r.textAlign="left",_(t,r,d,y,h)}function X(){const t=i.useRef(null),r=i.useRef(null),[f,d]=i.useState("idle"),[y,h]=i.useState(0),[c,H]=i.useState(()=>{if(typeof window<"u"){const e=localStorage.getItem("zframes-flappy-bird-high-score");return e?parseInt(e,10):0}return 0}),[,k]=i.useState(!1),u=i.useRef(0),g=i.useRef(c),E=i.useRef(f),m=i.useRef(F(null));i.useEffect(()=>{g.current=c,c>0&&localStorage.setItem("zframes-flappy-bird-high-score",String(c))},[c]),i.useEffect(()=>{E.current=f},[f]);const w=i.useRef({birdY:0,birdVel:0,pipes:[],frameCount:0}),G=i.useCallback(e=>{const n=e.height-M,a=N,l=n-N-A;return a+Math.random()*Math.max(0,l-a)},[]),T=i.useCallback(()=>{const e=t.current;e&&(w.current={birdY:e.height/2,birdVel:0,pipes:[{x:e.width+60,gapY:G(e),passed:!1}],frameCount:0},u.current=0,h(0))},[G]),P=i.useCallback(()=>{var e;if((e=r.current)==null||e.focus(),E.current!=="playing"){T(),d("playing");return}w.current.birdVel=j},[T]);return i.useEffect(()=>{const e=a=>{const l=a.target;l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.isContentEditable||(a.code==="Space"||a.code==="ArrowUp")&&(a.preventDefault(),P())},n=r.current;if(n)return n.addEventListener("keydown",e),()=>n.removeEventListener("keydown",e)},[P]),i.useLayoutEffect(()=>{const e=t.current;if(!e)return;const n=()=>{const l=e.parentElement;if(l&&l.clientWidth>0&&l.clientHeight>0){e.width=l.clientWidth,e.height=l.clientHeight,m.current=F(e);const S=e.getContext("2d");E.current!=="playing"&&(w.current.birdY=e.height/2,S&&V(e,S,E.current,u.current,g.current,m.current)),k(Y=>!Y)}};n();const a=new ResizeObserver(n);return a.observe(e.parentElement),()=>a.disconnect()},[]),i.useEffect(()=>{if(f!=="playing")return;const e=t.current,n=e==null?void 0:e.getContext("2d");if(!e||!n)return;let a;const l=e.height-M,S=()=>{u.current>g.current&&(g.current=u.current,H(u.current)),d("gameover")},Y=()=>{const o=w.current;n.clearRect(0,0,e.width,e.height),o.birdVel+=L,o.birdY+=o.birdVel,o.pipes=o.pipes.filter(s=>s.x>-b),o.pipes.forEach(s=>s.x-=U);const D=o.pipes[o.pipes.length-1];if((!D||D.x<e.width-z)&&o.pipes.push({x:e.width,gapY:G(e),passed:!1}),o.birdY-p<=0||o.birdY+p>=l){S();return}for(const s of o.pipes){if(C+p>s.x&&C-p<s.x+b&&(o.birdY-p<s.gapY||o.birdY+p>s.gapY+A)){S();return}!s.passed&&s.x+b<C&&(s.passed=!0,u.current+=1,h(u.current))}n.fillStyle=R.pipe;for(const s of o.pipes)n.fillRect(s.x,0,b,s.gapY),n.fillRect(s.x,s.gapY+A,b,l-(s.gapY+A));n.fillStyle=R.ground,n.fillRect(0,l,e.width,2),B(n,o.birdY,o.birdVel,m.current),_(e,n,u.current,g.current,m.current),o.frameCount++,a=requestAnimationFrame(Y)};return a=requestAnimationFrame(Y),()=>cancelAnimationFrame(a)},[f]),i.useEffect(()=>{if(f==="playing")return;const e=t.current,n=e==null?void 0:e.getContext("2d");!e||!n||V(e,n,f,y,c,m.current)},[f,y,c]),x.jsx("div",{ref:r,tabIndex:0,className:"relative h-full w-full cursor-pointer select-none overflow-hidden outline-none",onClick:P,onTouchStart:P,role:"application","aria-label":"Flappy bird game. Press space or tap to flap.",children:x.jsx("canvas",{ref:t,className:"h-full w-full"})})}const Q=O({...v,component:X});export{Q as flappyBirdFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s}from"./react-qoZPGuNy.js";import{f as c,H as r,I as o,h as i}from"./index-
|
|
1
|
+
import{j as s}from"./react-qoZPGuNy.js";import{f as c,H as r,I as o,h as i}from"./index-DyvZokhk.js";import{d as m,e as d,f}from"./format-CfAcS4D8.js";import{F as n,s as u}from"./ui-Bq3RQsdJ.js";r.schema;function x(a){return a.unit==="USD/shares"?m(a.value):a.unit==="shares"?d(a.value):f(a.value)}function h({config:a}){const{data:t,isLoading:l}=o(a.symbol);return l?s.jsx(n,{loading:!0,children:"loading SEC financials…"}):!t||t.metrics.length===0?s.jsxs(n,{children:["no SEC financials for “",i(a.symbol),"”"]}):s.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"body-sm text-strong truncate font-semibold",children:t.entityName||i(a.symbol)}),s.jsx("div",{className:"caption text-soft truncate",children:"SEC EDGAR · XBRL company facts"})]}),s.jsx("div",{className:"caption text-soft shrink-0 text-right",children:"on filing"})]}),s.jsx("div",{className:`grid grid-cols-2 content-start gap-2 ${u}`,children:t.metrics.map(e=>s.jsxs("div",{className:"rounded bg-white/[0.04] px-3 py-2",children:[s.jsx("div",{className:"caption text-soft truncate",children:e.label}),s.jsx("div",{className:"metric-sm text-strong",children:x(e)}),s.jsx("div",{className:"caption text-soft truncate",children:e.fiscalPeriod})]},e.label))})]})}const N=c({...r,component:h});export{N as fundamentalsFrame};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as o}from"./react-qoZPGuNy.js";import{b as a}from"./format-CfAcS4D8.js";import{M as l}from"./metric-row-BVVhjsjK.js";import{f as d,bs as r,bt as u}from"./index-DyvZokhk.js";import{F as e,s as f}from"./ui-Bq3RQsdJ.js";r.schema;function p({config:t}){const{comparison:m,isLoading:c}=u(),s=m.slice(0,t.limit);return c?o.jsx(e,{loading:!0,children:"loading funding…"}):s.length===0?o.jsx(e,{children:"no funding data yet"}):o.jsx("div",{className:`${f} flex flex-col`,children:s.map(n=>o.jsx(l,{label:n.coin,meta:n.venues.map(i=>`${i.venue.slice(0,3)} ${a(i.annualizedPct,1)}`).join(" · "),value:`${a(n.spreadPct,1)} sprd`},n.coin))})}const C=d({...r,component:p});export{C as fundingComparisonFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as k,r as c,j as i}from"./react-qoZPGuNy.js";import{f as L,S as N,U as X,h as Y}from"./index-
|
|
1
|
+
import{R as k,r as c,j as i}from"./react-qoZPGuNy.js";import{f as L,S as N,U as X,h as Y}from"./index-DyvZokhk.js";import{h as q}from"./format-CfAcS4D8.js";import{F as D}from"./ui-Bq3RQsdJ.js";import{c as B}from"./utils-DaT-yT0k.js";const z="4px",G=6,P=80,K=24;function J({data:u,className:_,CellComponent:R,getColorValue:g,gap:x=G,showLabels:l=!1,rowLabelWidth:p=P,columnLabelHeight:b=K}){const j=c.useRef(null),[,M]=c.useTransition(),[m,w]=c.useState({width:0,height:0});c.useEffect(()=>{const t=j.current;if(t){const e=new ResizeObserver(()=>{M(()=>{w({width:t.offsetWidth,height:t.offsetHeight})})});return e.observe(t),()=>{e.disconnect()}}},[]);const{uniqueRows:v,uniqueColumns:I,rowToIndex:C,columnToIndex:E}=c.useMemo(()=>{const t=new Set,e=new Set,n=[],r=[];for(const s of u)t.has(s.row)||(t.add(s.row),n.push(s.row)),e.has(s.column)||(e.add(s.column),r.push(s.column));const a=new Map(n.map((s,f)=>[s,f])),d=new Map(r.map((s,f)=>[s,f]));return{uniqueRows:n,uniqueColumns:r,rowToIndex:a,columnToIndex:d}},[u]),h=c.useMemo(()=>{const t=l?p:0,e=l?b:0;return{x:t,y:e,width:Math.max(0,m.width-t),height:Math.max(0,m.height-e)}},[m,l,p,b]),y=c.useMemo(()=>{const t=I.length,e=v.length,n=t>0?Math.max(0,(h.width-x*(t-1))/t):0,r=e>0?Math.max(0,(h.height-x*(e-1))/e):0;return{cellWidth:n,cellHeight:r,columnX:s=>s*(n+x),rowY:s=>s*(r+x)}},[v.length,I.length,h,x]),S=c.useMemo(()=>{const t=u.map(o=>g?g(o):o.value),e=t.filter(o=>o>=0),n=t.filter(o=>o<0),r=e.length>0?Math.min(...e):0,a=e.length>0?Math.max(...e):0,d=n.length>0?Math.min(...n):0,s=n.length>0?Math.max(...n):0,f=o=>o<0?s===d?1:(o-s)/(d-s):a===r?1:(o-r)/(a-r);return u.map(o=>{const T=g?g(o):o.value,$=f(T),W=T>=0;return{cell:o,colorValue:T,intensity:$,isPositive:W}})},[u,g]),F=(t,e)=>{if(e){const a=Math.round(34+t*16);return`hsl(152 ${Math.round(42+t*20)}% ${a}%)`}const n=Math.round(36+t*15);return`hsl(350 ${Math.round(48+t*22)}% ${n}%)`},A=c.useMemo(()=>{const{cellWidth:t,cellHeight:e,columnX:n,rowY:r}=y;return t<=0||e<=0?null:S.map(({cell:a,intensity:d,isPositive:s})=>{const f=C.get(a.row),o=E.get(a.column);if(f===void 0||o===void 0)return null;const T=F(d,s);return i.jsx("div",{className:"group absolute cursor-pointer border border-transparent hover:bg-[radial-gradient(146.13%_118.42%_at_50%_-15.5%,rgba(255,255,255,0.1)_0%,rgba(255,255,255,0)_99.59%)] hover:bg-gradient-to-t",style:{left:h.x+n(o),top:h.y+r(f),width:t,height:e,borderRadius:z,backgroundColor:T},children:i.jsx(R,{width:t,height:e,data:a,rowIndex:f,columnIndex:o,colorIntensity:d,isPositive:s})},a.id)})},[S,y,h,C,E,R]),O=c.useMemo(()=>{if(!l)return null;const{cellHeight:t,rowY:e}=y;return v.map((n,r)=>i.jsx("div",{className:"absolute flex items-center justify-end pr-2 text-xs text-white/60",style:{left:0,top:h.y+e(r),width:p,height:t},children:i.jsx("span",{className:"truncate",children:n})},`row-${n}`))},[l,v,y,h,p]),U=c.useMemo(()=>{if(!l)return null;const{cellWidth:t,columnX:e}=y;return I.map((n,r)=>i.jsx("div",{className:"absolute flex items-end justify-center pb-1 text-xs text-white/60",style:{left:h.x+e(r),top:0,width:t,height:b},children:i.jsx("span",{className:"truncate",children:n})},`col-${n}`))},[l,I,y,h,b]);return i.jsx("div",{className:B("h-full w-full",_),ref:j,children:i.jsxs("div",{className:"relative overflow-hidden",style:{height:m.height,width:m.width},children:[O,U,A]})})}const Q=k.memo(J);N.schema;const H=1440*60*1e3,Z=10080*60*1e3;function V({data:u,width:_}){return _<44?null:i.jsx("div",{className:"flex h-full w-full items-center justify-center",children:i.jsx("span",{className:"caption text-normal tabular-nums",children:q(u.rate*100)})})}function tt({config:u}){const _=c.useMemo(()=>Date.now()-Z,[]),{history:R,isLoading:g}=X(u.symbols,_),x=c.useMemo(()=>{const l=[];for(const p of u.symbols){const b=R[p]??[],j=new Map;for(const M of b){const m=Math.floor(M.time/H)*H,w=j.get(m)??{sum:0,n:0};w.sum+=M.fundingRate,w.n+=1,j.set(m,w)}for(const[M,{sum:m,n:w}]of j){const v=m/w,C=new Date(M).toLocaleDateString("en-US",{month:"short",day:"numeric"});l.push({id:`${p}-${M}`,row:Y(p),column:C,value:v*1e4,rate:v})}}return l},[R,u.symbols]);return g?i.jsx(D,{loading:!0,children:"loading funding…"}):x.length===0?i.jsx(D,{children:"no funding data"}):i.jsx(Q,{data:x,CellComponent:V,gap:3,showLabels:!0,rowLabelWidth:48,columnLabelHeight:20})}const ct=L({...N,component:tt});export{ct as fundingHeatmapFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as a}from"./react-qoZPGuNy.js";import{f as l,V as d,U as C,h as M}from"./index-
|
|
1
|
+
import{r as o,j as a}from"./react-qoZPGuNy.js";import{f as l,V as d,U as C,h as M}from"./index-DyvZokhk.js";import{h as R}from"./format-CfAcS4D8.js";import{F as f}from"./ui-Bq3RQsdJ.js";import{a as r,C as u}from"./chart-utils-BYIZMM9J.js";import{M as S}from"./index-Bx7RmzY8.js";import"./d3-xK4fOkBU.js";import"./utils-DaT-yT0k.js";const x={"24h":{ms:1440*60*1e3,timeframe:r["24h"]},"7D":{ms:10080*60*1e3,timeframe:r["7D"]},"1M":{ms:720*60*60*1e3,timeframe:r["1M"]}};d.schema;function F({config:e}){const{ms:s,timeframe:h}=x[e.lookback],c=o.useMemo(()=>Date.now()-s,[s]),{history:m,isLoading:p}=C(e.symbols,c),i=o.useMemo(()=>e.symbols.map((t,g)=>({id:t,name:M(t),color:u[g%u.length],data:(m[t]??[]).map(n=>({date:new Date(n.time).toISOString(),value:n.fundingRate*100}))})),[e.symbols,m]);return p?a.jsx(f,{loading:!0,children:"loading funding rates…"}):i.every(t=>t.data.length===0)?a.jsx(f,{children:"no funding data yet"}):a.jsx(S,{series:i,timeframe:h,height:250,formatValue:R})}const I=l({...d,component:F});export{I as fundingRateChartFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./react-qoZPGuNy.js";import{c as x,i as p,a as f}from"./format-CfAcS4D8.js";import{f as b,ad as d,ae as j}from"./index-
|
|
1
|
+
import{j as e}from"./react-qoZPGuNy.js";import{c as x,i as p,a as f}from"./format-CfAcS4D8.js";import{f as b,ad as d,ae as j}from"./index-DyvZokhk.js";import{F as c}from"./ui-Bq3RQsdJ.js";import{M as u}from"./mini-line-chart-CHM5UBjJ.js";import"./d3-xK4fOkBU.js";import"./utils-DaT-yT0k.js";d.schema;function g({config:a}){var n,o;const{rates:t,isLoading:h}=j(a.base,a.symbols);if(h)return e.jsx(c,{loading:!0,children:"loading FX rates…"});if(!t.length)return e.jsx(c,{children:"no FX data yet"});const r=(o=(n=t[0])==null?void 0:n.history.at(-1))==null?void 0:o.time;return e.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("div",{className:"caption text-soft uppercase",children:"FX rates"}),e.jsxs("div",{className:"body-sm text-normal",children:["1 ",a.base.toUpperCase()," buys"]})]}),e.jsx("div",{className:"caption text-soft text-right",children:r?new Date(r).toLocaleDateString("en-US",{month:"short",day:"numeric"}):"ECB daily"})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:t.map(s=>{const i=x(s.changePct),l=s.history.map(m=>({date:new Date(m.time).toISOString(),value:m.value}));return e.jsxs("div",{className:"flex items-center gap-3 border-b border-white/[0.06] py-1.5 last:border-b-0",children:[e.jsx("span",{className:"body-sm w-9 font-bold text-strong",children:s.symbol}),e.jsx("div",{className:"flex-1"}),a.showSparkline&&l.length>1&&e.jsx(u,{data:l,width:72,height:20,color:i}),e.jsxs("span",{className:"whitespace-nowrap text-right tabular-nums",children:[e.jsx("span",{className:"body-sm text-strong",children:p(s.rate)}),e.jsx("span",{className:"caption ml-2 font-bold",style:{color:i},children:f(s.changePct)})]})]},s.symbol)})})]})}const B=b({...d,component:g});export{B as fxBoardFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./react-qoZPGuNy.js";import{f as l,W as s}from"./index-
|
|
1
|
+
import{j as e}from"./react-qoZPGuNy.js";import{f as l,W as s}from"./index-DyvZokhk.js";s.schema;function n({config:a}){return e.jsxs("div",{className:"flex h-full w-full items-end gap-3 pb-2",children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"h-[5px] w-[5px] shrink-0 rounded-full",style:{background:"var(--color-highlight)",boxShadow:"0 0 8px var(--color-highlight)"}}),e.jsx("h2",{className:"body-md text-strong font-extrabold uppercase leading-none tracking-[0.14em]",children:a.title})]}),a.subtitle&&e.jsx("p",{className:"caption text-soft pl-[13px] leading-none",children:a.subtitle})]}),e.jsx("span",{className:"mb-[5px] h-px flex-1",style:{background:"linear-gradient(90deg, rgba(255,255,255,0.16), rgba(255,255,255,0.02) 65%, transparent)"}})]})}const i=l({...s,component:n});export{i as headingFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as n}from"./react-qoZPGuNy.js";import{E as d,a as u,n as h}from"./market-data-CvmpLFSo.js";import{M as f}from"./metric-row-BVVhjsjK.js";import{f as x,
|
|
1
|
+
import{j as n}from"./react-qoZPGuNy.js";import{E as d,a as u,n as h}from"./market-data-CvmpLFSo.js";import{M as f}from"./metric-row-BVVhjsjK.js";import{f as x,bL as m}from"./index-DyvZokhk.js";import{F as i,s as p}from"./ui-Bq3RQsdJ.js";m.schema;function y(e,o){const[t,a,s]=e.split("-").map(Number),[l,r,c]=o.split("-").map(Number);return Math.round((Date.UTC(l,r-1,c)-Date.UTC(t,a-1,s))/864e5)}function b(e){const[o,t,a]=e.split("-").map(Number);return new Date(Date.UTC(o,t-1,a)).toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric",timeZone:"UTC"})}function C(e){return e<=0?"today":e===1?"tomorrow":`in ${e}d`}function j({config:e}){var l;if(!d[e.exchange])return n.jsx(i,{children:"unknown exchange"});const t=(l=u(e.exchange))==null?void 0:l.ymd,a=h(e.exchange,e.count),s=e.label.trim();return!t||a.length===0?n.jsx(i,{children:"no upcoming holidays on file"}):n.jsxs("div",{className:"flex h-full w-full flex-col",children:[s&&n.jsx("div",{className:"caption text-soft mb-1 shrink-0 uppercase tracking-[0.12em]",children:s}),n.jsx("div",{className:`min-h-0 flex-1 ${p}`,children:a.map(r=>n.jsx(f,{label:b(r),value:C(y(t,r))},r))})]})}const k=x({...m,component:j});export{k as holidayCalendarFrame};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,j as e}from"./react-qoZPGuNy.js";import{f as l,X as o}from"./index-
|
|
1
|
+
import{r as s,j as e}from"./react-qoZPGuNy.js";import{f as l,X as o}from"./index-DyvZokhk.js";import{F as i}from"./ui-Bq3RQsdJ.js";o.schema;function n({config:a}){const[t,r]=s.useState("loading");return s.useEffect(()=>r("loading"),[a.url]),t==="error"?e.jsx(i,{children:"image unavailable"}):e.jsxs("div",{className:"relative flex h-full w-full items-center justify-center overflow-hidden rounded-md",children:[t==="loading"&&e.jsx("div",{className:"absolute inset-0 z-10",children:e.jsx(i,{loading:!0,children:"loading image…"})}),e.jsx("img",{src:a.url,alt:a.alt,className:`h-full w-full transition-opacity duration-300 ${t==="loaded"?"opacity-100":"opacity-0"}`,style:{objectFit:a.fit},onLoad:()=>r("loaded"),onError:()=>r("error")})]})}const c=l({...o,component:n});export{c as imageFrame};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as b,j as s,R as ut}from"./react-qoZPGuNy.js";import{l as ct,h as mt,c as pt,e as ft,i as lt,j as nt,d as ht,f as gt,k as xt,s as X,n as J,q as vt,r as yt,t as wt,u as st,v as kt}from"./d3-xK4fOkBU.js";import{c as F}from"./utils-DaT-yT0k.js";import{c as bt,f as jt}from"./chart-utils-BYIZMM9J.js";const O={top:20,right:110,bottom:40,left:50},tt={sm:640},R={height:400,yAxisPadding:15,fontSize:12},rt={rectHeight:22,paddingX:4},St={offsetX:80},Y={ticks:6,opacity:.05,color:"#FFFFFF"},$={xTicks:5,xSubTicks:36,yTicks:5,tickSize:10,subTickSize:6,tickColor:"#404146",domainColor:"#FFFFFF",domainOpacity:.05,textOpacity:.5},at=1e12,ot=1e9,Z=1e6,U=t=>t==null?"-":t===0?"0":t<.001?Mt(t):t<1||t<10?parseFloat(t.toPrecision(4)).toString():t<Z?t.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:2}):t>at?`${(t/at).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}T`:t>ot?`${(t/ot).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}B`:t>Z?`${(t/Z).toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}M`:t.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0}),Nt=t=>{const n=["₀","₁","₂","₃","₄","₅","₆","₇","₈","₉"];return t.toString().split("").map(e=>n[parseInt(e)]).join("")},Mt=t=>{const n=t<0,i=Math.abs(t).toFixed(20).replace(/\.?0+$/,""),l=i.match(/^0\.0+/);if(l){const u=l[0].length-2,a=i.slice(l[0].length).slice(0,3).replace(/0+$/,""),o=`0.${Nt(u)}${a}`;return n?`-${o}`:o}return Number.isInteger(t)?String(t):String(Math.round(t*100)/100)};let P;const Ct=t=>(P===void 0&&(P=typeof document<"u"?document.createElement("canvas").getContext("2d"):null,P&&(P.font=`700 ${R.fontSize}px "DM Sans", sans-serif`)),P?P.measureText(t).width:t.length*R.fontSize*.62),Tt=({width:t,height:n=R.height,yDomain:e,formatValue:i,containerRef:l})=>{const[u,r]=b.useState(t);b.useLayoutEffect(()=>{const f=()=>{if(l.current){const M=l.current.getBoundingClientRect();r(N=>N!==void 0&&Math.abs(N-M.width)<.5?N:M.width)}};f();const w=typeof ResizeObserver<"u"?new ResizeObserver(f):null;return w&&l.current&&w.observe(l.current),window.addEventListener("resize",f),()=>{w==null||w.disconnect(),window.removeEventListener("resize",f)}},[l]);const a=f=>{const[w,M]=f.domain(),N=5;let y=0;for(let L=0;L<N;L++){const S=w+(M-w)/(N-1)*L,z=i?i(S):U(S);y=Math.max(y,Ct(z))}return Math.ceil(y)+R.yAxisPadding};let o=u??null;if(!o&&l.current){const f=l.current.getBoundingClientRect();f.width>0&&(o=f.width)}o=o||t||null;const c=n-O.top-O.bottom,g=ct().domain(e).range([c,0]),x=o&&o>0?a(g):null,p=o&&o>0&&x&&x>0?o-x-(o>640?O.right:20):null;return{width:o,height:n,innerWidth:p,innerHeight:c,dynamicLeftMargin:x}},Lt=t=>{const n=b.useMemo(()=>{const r=new Set;return t.forEach(a=>{a.seriesGroup&&r.add(a.seriesGroup)}),Array.from(r)},[t]),[e,i]=b.useState(()=>new Set(n));b.useEffect(()=>{i(r=>{const a=new Set(r);return n.forEach(o=>{a.has(o)||a.add(o)}),a})},[n]);const l=b.useMemo(()=>t.filter(r=>r.seriesGroup?e.has(r.seriesGroup):!0),[t,e]);return{seriesGroups:n,visibleGroups:e,filteredSeries:l,toggleGroup:r=>{i(a=>{const o=new Set(a);return o.has(r)?o.delete(r):o.add(r),o})}}},$t=t=>({seriesColors:b.useMemo(()=>t.reduce((e,i)=>(e[i.id]=i.color,e),{}),[t]),isColorLoading:!1}),Dt=({group:t,isVisible:n,onClick:e})=>s.jsxs("button",{onClick:e,className:F("flex cursor-pointer items-center justify-center gap-2 text-xs font-semibold",n?"text-white":"text-white/30"),children:[s.jsx("div",{className:F("h-3 w-3",n?"bg-white/80":"bg-white/30")}),t]}),Ft=Dt,Et=(t,n)=>jt(t,n),it=(t,n)=>{const e=parseInt(t.slice(1,3),16),i=parseInt(t.slice(3,5),16),l=parseInt(t.slice(5,7),16);return`rgba(${e}, ${i}, ${l}, ${n})`},zt=t=>{const n=t.flatMap(e=>e.data);return bt(n)},At=t=>{const n=new Set;return t.forEach(e=>{e.data.forEach(i=>n.add(i.date))}),Array.from(n).sort()},It=(t,n)=>t.map(e=>{const i={};return n.forEach(l=>{const u=l.data.find(r=>r.date===e);i[l.id]=u?u.value:0}),{date:new Date(e),values:i}}),Gt=(t,n,e)=>{const i=n.invert(t),l=mt(o=>o.date).left,u=l(e,i,1),r=e[u-1],a=e[u];return!r||!a?null:i.getTime()-r.date.getTime()>a.date.getTime()-i.getTime()?a:r},Q=(t,n)=>{const e=n===t,i=n!==null&&n!==t;return e?1:i?.3:1},Ot=({legendItems:t,containerWidth:n,hoveredSeriesId:e,onSeriesHover:i,onLabelClick:l,unitPrefix:u,unitSuffix:r,legendRef:a})=>n&&n>tt.sm?s.jsx("div",{className:F("pointer-events-none absolute left-0 top-0 w-full flex-wrap items-center gap-2 max-sm:overflow-hidden"),children:t.map(c=>s.jsx("div",{className:F("pointer-events-auto absolute flex h-[22px] w-fit cursor-pointer items-center justify-center gap-1 rounded-[11px] px-[5px] py-1 transition-opacity duration-200 ease-out"),style:{left:`${c.left}px`,top:`${c.top}px`,backgroundColor:it(c.color,.3),opacity:Q(c.id,e)},onClick:()=>l==null?void 0:l(c.id),onPointerEnter:g=>{g.preventDefault(),g.stopPropagation(),i(c.id)},onPointerLeave:g=>{g.preventDefault(),g.stopPropagation(),i(null)},children:s.jsxs("div",{className:"relative flex select-none items-center justify-center gap-1",children:[c.seriesData.iconImageUrl&&s.jsx("div",{className:"size-4 rounded-full",children:s.jsx("img",{src:c.seriesData.iconImageUrl,width:16,height:16,alt:c.seriesData.name,className:"size-4 rounded-full",draggable:!1})}),s.jsxs("div",{className:"text-normal relative flex items-center justify-center whitespace-nowrap text-[11px] font-semibold leading-4",children:[s.jsx("span",{className:F("mr-1 max-w-12 truncate",c.seriesData.iconImageUrl?"max-w-10":"max-w-12"),children:c.displayText}),u&&s.jsx("span",{className:"mr-0.5 [&_svg]:!text-white/70",children:u}),s.jsx("span",{children:c.value}),r&&s.jsx("span",{children:r})]})]})},c.id))}):s.jsx("div",{className:F("pointer-events-none left-0 top-0 flex w-full flex-wrap items-center gap-1 max-sm:overflow-hidden"),ref:a,children:t.map(c=>s.jsx("div",{className:F("pointer-events-auto flex h-[22px] w-fit min-w-[112px] cursor-pointer items-center gap-1 rounded-[11px] px-[5px] py-1 transition-opacity duration-200 ease-out"),style:{backgroundColor:it(c.color,.3),opacity:Q(c.id,e)},onClick:()=>l==null?void 0:l(c.id),onPointerEnter:g=>{g.preventDefault(),g.stopPropagation(),i(c.id)},onPointerLeave:g=>{g.preventDefault(),g.stopPropagation(),i(null)},children:s.jsxs("div",{className:"relative flex select-none items-center gap-1",children:[c.seriesData.iconImageUrl&&s.jsx("div",{className:"size-4 rounded-full",children:s.jsx("img",{src:c.seriesData.iconImageUrl,width:16,height:16,alt:c.seriesData.name,className:"size-4 rounded-full",draggable:!1})}),s.jsxs("div",{className:"text-normal relative flex items-center whitespace-nowrap text-[11px] font-semibold leading-none",children:[s.jsx("span",{className:F("mr-1 max-w-12 truncate",c.seriesData.iconImageUrl?"max-w-10":"max-w-12"),children:c.displayText}),s.jsx("span",{"data-legend-value":c.id,children:c.value}),r&&s.jsx("span",{children:r})]})]})},c.id))}),Wt=Ot,Ht=({containerWidth:t,tooltipRef:n,series:e,seriesColors:i,unitPrefix:l,unitSuffix:u})=>t&&t>tt.sm?s.jsx("div",{ref:n,className:"pointer-events-none absolute left-0 top-0 z-50 rounded-md bg-slate-700 px-6 py-3 text-xs text-white opacity-0 transition-opacity duration-300",children:s.jsxs("div",{className:"flex flex-col gap-3",children:[s.jsx("div",{className:"body-md font-semibold text-white/50","data-tooltip-date":!0}),s.jsx("div",{className:"grid grid-cols-[auto_1fr] gap-x-3 gap-y-1.5",children:e.map(a=>s.jsxs(ut.Fragment,{children:[s.jsxs("span",{className:"text-soft flex max-w-[126px] items-center gap-1",children:[s.jsx("div",{className:"h-full w-0.5 rounded-full",style:{backgroundColor:i[a.id]}}),a.iconImageUrl&&s.jsx("img",{src:a.iconImageUrl,width:20,height:20,alt:a.name,className:"rounded-full"}),s.jsx("span",{className:"text-normal body-sm font-bold capitalize",children:a.name})]}),s.jsxs("div",{className:"font-dmsans text-normal flex flex-row items-center font-bold",children:[s.jsx("div",{className:"mr-1",children:l}),s.jsx("span",{className:"text-normal text-right text-xs font-bold","data-tooltip-value":a.id}),u]})]},a.id))})]})}):s.jsx("div",{ref:n,className:"pointer-events-none absolute left-0 top-0 z-50 min-w-[130px] rounded-md bg-slate-700 px-2 py-1 text-xs text-white opacity-0 transition-opacity duration-300 ease-out",children:s.jsx("div",{className:"flex flex-col items-center justify-center gap-3",children:s.jsx("div",{className:"caption font-semibold text-white/50","data-tooltip-date":!0})})}),Bt=Ht,Pt=(t,n,e,i)=>{const l=pt().domain(ft(t,r=>r.date)).range([0,e]),u=ct().domain(n).range([i,0]);return{xScale:l,yScale:u}},Xt=(t,n,e)=>{const[i,l]=n.domain(),u=[];for(let r=0;r<Y.ticks;r++){const a=i+(l-i)/(Y.ticks-1)*r;u.push(a)}t.append("g").attr("class","grid").call(lt(n).tickValues(u).tickSize(-e).tickFormat(()=>"")).call(r=>r.select(".domain").remove()).selectAll("line").attr("stroke",Y.color).attr("stroke-opacity",Y.opacity)},Ut=(t,n,e,i,l,u,r)=>{const o=r!==void 0?Math.max(2,Math.min($.xTicks,Math.floor(r/72))):$.xTicks,c=n.ticks(o),g=Math.max(1,Math.ceil(c.length/o)),x=c.filter((S,z)=>z%g===0),p=t.append("g").attr("transform",`translate(0,${i})`).call(nt(n).tickValues(x).tickSize($.tickSize).tickFormat(S=>S instanceof Date?Et(S.toISOString(),l):String(S))).style("font-size","12px").style("font-weight","700").style("font-family","var(--font-manrope)");p.select(".domain").attr("stroke",$.domainColor).attr("stroke-width",1).attr("stroke-opacity",$.domainOpacity),p.selectAll(".tick line").attr("stroke",$.tickColor).attr("transform","translate(0, 4)"),p.selectAll(".tick text").attr("dy","1.2em").style("fill",$.domainColor).style("opacity",$.textOpacity);const f=t.append("g").attr("transform",`translate(0,${i})`).call(nt(n).ticks($.xSubTicks).tickSize($.subTickSize).tickFormat(()=>""));f.select(".domain").remove(),f.selectAll(".tick line").attr("stroke",$.tickColor).attr("transform","translate(0, 4)");const[w,M]=e.domain(),N=[],y=5;for(let S=0;S<y;S++){const z=w+(M-w)/(y-1)*S;N.push(z)}const L=t.append("g").call(lt(e).tickValues(N).tickSize($.yTicks).tickFormat(S=>u?u(S):U(S))).style("font-size","12px").style("color",$.domainColor).style("font-family","var(--font-dmsans)").style("opacity",$.textOpacity).style("font-weight","700");L.select(".domain").attr("stroke","none"),L.selectAll(".tick line").attr("stroke","none")},_t=(t,n,e,i,l,u=!0)=>{const r=ht().x(a=>i(a.date)).y(a=>l(a.value)).curve(gt);n.forEach(a=>{const o=a.data.map(p=>({date:new Date(p.date),value:p.value})),c=e[a.id],g=t.append("path").datum(o).attr("fill","none").attr("stroke",c).attr("stroke-width",1.2).attr("opacity",1).attr("data-series-id",a.id).attr("d",r);if(!u){g.attr("stroke-dasharray",null).attr("stroke-dashoffset",null);return}const x=g.node().getTotalLength();g.attr("stroke-dasharray",x+" "+x).attr("stroke-dashoffset",x),g.transition("draw").duration(1200).ease(xt).attr("stroke-dashoffset",0).on("end",function(){X(this).attr("stroke-dasharray",null)})})},Vt=({g:t,containerWidth:n,innerWidth:e,innerHeight:i,xScale:l,yScale:u,combinedData:r,filteredSeries:a,tooltipRef:o,containerRef:c,legendRef:g,highestValue:x,formatValue:p})=>{var A;const f=t.append("line").attr("class","hover-line").attr("stroke","white").attr("stroke-width",1).attr("stroke-dasharray","4,4").attr("stroke-opacity",.6).attr("x1",0).attr("y1",0).attr("x2",0).attr("y2",i).attr("opacity",0),w=t.append("g").attr("class","hover-dots");let M=!0,N=((A=c.current)==null?void 0:A.getBoundingClientRect().width)||e,y=0,L=0;const S=h=>{M?(f.attr("x1",h-.75),f.attr("x2",h-.75),f.transition().duration(150).ease(J).attr("opacity",1),M=!1):f.transition().duration(100).ease(st).attr("x1",h-.75).attr("x2",h-.75).attr("opacity",1)},z=(h,d)=>{const j=w.selectAll("g.hover-circle-group").data(a.filter(v=>h.values[v.id]!==void 0));j.exit().remove();const C=j.enter().append("g").attr("class","hover-circle-group").style("opacity",0);C.append("circle").attr("class","hover-dot-glow").attr("r",9).attr("fill","white").attr("fill-opacity",.18),C.append("circle").attr("class","hover-dot-core").attr("r",4.5).attr("fill","white").attr("stroke","rgba(10, 12, 20, 0.55)").attr("stroke-width",1.5),C.attr("transform",v=>{const T=h.values[v.id];return`translate(${d}, ${u(T)}) scale(0.5)`}).style("opacity",1).transition().duration(200).ease(kt).attr("transform",v=>{const T=h.values[v.id];return`translate(${d}, ${u(T)}) scale(1)`}),j.transition().duration(100).ease(st).attr("transform",v=>{const T=h.values[v.id];return`translate(${d}, ${u(T)})`})},E=(h,d)=>{o.current&&y===0&&L===0&&(y=o.current.getBoundingClientRect().height,L=o.current.getBoundingClientRect().width);let m=h+St.offsetX;return m+L>N&&(m=h-L),m<0&&(m=0),{x:m,y:d-y/2+20}},q=h=>{let m=h-65+O.left;const j=u(x);return h+130/2>N-O.left&&(m=N-130),m<0&&(m=0),{x:m,y:j}},G=(h,d)=>{if(!o.current)return;const m=o.current.querySelector("[data-tooltip-date]");m&&m.textContent!==h&&(m.textContent=h),a.forEach(j=>{var D;const C=d[j.id];if(C===void 0)return;const v=(D=o.current)==null?void 0:D.querySelector(`[data-tooltip-value="${j.id}"]`),T=p?p(C):U(C);v&&v.textContent!==T&&(v.textContent=T)})},W=h=>{if(!o.current)return;const d=o.current.querySelector("[data-tooltip-date]");d&&d.textContent!==h&&(d.textContent=h)},H=h=>{g.current&&a.forEach(d=>{var C;const m=h[d.id];if(m===void 0)return;const j=(C=g.current)==null?void 0:C.querySelector(`[data-legend-value="${d.id}"]`);if(j){const v=p?p(m):U(m);j.textContent=v}})},k=(h,d)=>{o.current&&(o.current.style.opacity="1",o.current.style.transform=`translate3d(${h}px, ${d}px, 0)`)},_=h=>{const m=window.TouchEvent&&h instanceof TouchEvent?h.touches[0]:h,[j,C]=yt(m,t.node()),v=Gt(j,l,r);if(!v)return;const T=l(v.date),D=wt("%b %d, %Y - %H:%M")(v.date);if(n>tt.sm){const I=E(j,C);k(I.x,I.y),G(D,v.values)}else{const I=q(j);k(I.x,I.y),W(D),H(v.values)}S(T),z(v,T)},B=()=>{f.transition().duration(150).ease(J).attr("opacity",0),M=!0,o.current&&(o.current.style.opacity="0"),w.selectAll("g").transition().duration(150).ease(vt).style("opacity",0).attr("transform",(h,d,m)=>{const C=X(m[d]).attr("transform"),v=C.match(/translate\(([^,]+),\s*([^)]+)\)/);if(v){const T=parseFloat(v[1]),D=parseFloat(v[2]);return`translate(${T}, ${D}) scale(0.3)`}return C}).remove()},V=new ResizeObserver(()=>{c.current&&(N=c.current.getBoundingClientRect().width)});return c.current&&V.observe(c.current),{onMouseMove:_,onMouseLeave:B,destroy:()=>V.disconnect()}},Yt=(t,n,{xScale:e,yScale:i},l,u,r)=>{const a=rt.rectHeight,o=rt.paddingX,c=[];return t.forEach(x=>{const p=x.data.map(f=>({date:new Date(f.date),value:f.value}));if(p.length>0){const f=p[p.length-1],w=e(f.date)+8,M=i(f.value),N=w-o;let y=M-a/2;const L=c.findLast(S=>y+a>=S.top&&y<=S.bottom);L&&(y=L.top+a),c.push({top:y,bottom:y+a,id:x.id,left:N})}}),c.reverse().reduce((x,p)=>{const f=x.find(w=>p.top+a>=w.top&&p.top<=w.bottom&&w.id!==p.id);return f&&(p.top=f.top-a),[p,...x]},[]),c.map(x=>{var M,N;const p=t.find(y=>y.id===x.id);if(!p)return null;const f=n[x.id],w=r?r(((M=p.data.at(-1))==null?void 0:M.value)??0):U(((N=p.data.at(-1))==null?void 0:N.value)??0);return{id:x.id,left:x.left+l,top:x.top+u,seriesData:p,color:f,value:w,displayText:p.name}}).filter(Boolean)},Rt=({className:t})=>s.jsx("div",{className:F("relative size-8",t),children:s.jsx("div",{className:"absolute left-1/2 top-1/2 flex size-12 -translate-x-1/2 -translate-y-1/2 items-center justify-center",children:s.jsxs("div",{className:"relative h-6 w-full",children:[Array.from({length:5}).map((n,e)=>s.jsx("div",{className:"absolute size-1.5 rounded-full will-change-transform",style:{left:`${e/6*100}%`,animation:`dnaStrand1Move 2s infinite ease-in-out ${-e*.2}s, dnaStrand1Scale 2s infinite ease-in-out ${-e*.2}s, dnaStrand1Color 2s infinite ease-in-out ${-e*.2}s`}},`strand1-${e}`)),Array.from({length:5}).map((n,e)=>s.jsx("div",{className:"absolute size-1.5 rounded-full",style:{left:`${e/6*100}%`,animation:`dnaStrand2Move 2s infinite ease-in-out ${-e*.2}s, dnaStrand2Scale 2s infinite ease-in-out ${-e*.2}s, dnaStrand2Color 2s infinite ease-in-out ${-e*.2}s`}},`strand2-${e}`))]})})}),qt=({series:t,width:n,height:e=400,timeframe:i,className:l,isLoading:u=!1,formatValue:r,unitPrefix:a,unitSuffix:o,onLabelClick:c})=>{const g=b.useRef(null),x=b.useRef(null),p=b.useRef(null),f=b.useRef(null),w=b.useRef(!1),[M,N]=b.useState(null),y=b.useMemo(()=>[...t].sort((d,m)=>{const j=d.data.length>0?d.data[d.data.length-1].value:0;return(m.data.length>0?m.data[m.data.length-1].value:0)-j}),[t]),L=b.useCallback(d=>{N(d)},[]),{seriesGroups:S,visibleGroups:z,filteredSeries:E,toggleGroup:q}=Lt(y),{seriesColors:G,isColorLoading:W}=$t(y),H=b.useMemo(()=>zt(y),[y]),k=Tt({width:n,height:e,yDomain:H,formatValue:r,containerRef:x}),_=b.useMemo(()=>At(y),[y]),B=b.useMemo(()=>It(_,y),[_,y]),V=b.useMemo(()=>Math.max(...E.map(d=>d.data.map(m=>m.value)).flat().filter(d=>d!==void 0)),[E]),A=b.useMemo(()=>!k.innerWidth||!k.innerHeight?null:Pt(B,H,k.innerWidth,k.innerHeight),[B,H,k.innerWidth,k.innerHeight]),h=b.useMemo(()=>!A||!k.dynamicLeftMargin?[]:Yt(E,G,A,k.dynamicLeftMargin,O.top,r),[A,k.dynamicLeftMargin,E,G,r]);return b.useEffect(()=>{if(!g.current||t.length===0||W||!A||k.width===null||k.innerWidth===null||k.dynamicLeftMargin===null)return;const d=X(g.current),{innerWidth:m,innerHeight:j,dynamicLeftMargin:C}=k;d.selectAll("*").remove();const{xScale:v,yScale:T}=A,D=d.append("g").attr("transform",`translate(${C},${O.top})`);Xt(D,T,m),Ut(D,v,T,j,i,r,m),_t(D,E,G,v,T,!w.current),w.current=!0;const{onMouseMove:I,onMouseLeave:et,destroy:dt}=Vt({g:D,containerWidth:k.width,innerWidth:m,innerHeight:k.innerHeight,xScale:v,yScale:T,combinedData:B,filteredSeries:E,tooltipRef:p,containerRef:x,legendRef:f,highestValue:V,formatValue:r}),K=D.append("rect").attr("class","overlay").attr("width",m).attr("height",j).attr("fill","transparent").style("cursor","crosshair").style("pointer-events","all");return K.on("mousemove",I).on("mouseleave",et).on("touchstart",I).on("touchmove",I).on("touchend",et),K.raise(),()=>{dt(),K.on("mousemove",null).on("mouseleave",null).on("touchstart",null).on("touchmove",null).on("touchend",null),d.selectAll("*").interrupt(),d.selectAll("*").remove()}},[B,H,t.length,E,A,k.innerWidth,k.innerHeight,k.dynamicLeftMargin,e,i,W,G,r]),b.useEffect(()=>{if(!g.current||t.length===0||W)return;X(g.current).select("g").selectAll("path[data-series-id]").transition().duration(200).ease(J).attr("opacity",function(){const j=X(this).attr("data-series-id");return Q(j,M)})},[M,t,G,W]),!u&&t.length===0?s.jsx("div",{className:F("relative w-full",l),children:s.jsx("div",{className:F("mx-auto flex w-full items-center justify-center text-sm text-gray-400"),style:{height:e},children:"No data available"})}):s.jsx("div",{ref:x,className:F("relative w-full",l),style:{width:n,minHeight:e},children:u?s.jsx(Rt,{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2"}):s.jsxs(s.Fragment,{children:[S.length>0&&s.jsx("div",{className:"mb-3 flex flex-wrap items-center justify-center gap-2",children:S.map(d=>s.jsx(Ft,{group:d,isVisible:z.has(d),onClick:()=>q(d)},d))}),k.width!==null&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"relative z-20",children:s.jsx(Wt,{legendRef:f,legendItems:h,containerWidth:k.width,hoveredSeriesId:M,onSeriesHover:L,onLabelClick:c,unitPrefix:a,unitSuffix:o})}),s.jsxs("div",{className:"relative select-none",children:[s.jsx("svg",{ref:g,width:k.width,height:e,className:"relative z-0",style:{maxWidth:"100%",width:"100%",display:"block",overflow:"visible"}}),s.jsx("div",{className:"z-10",children:s.jsx(Bt,{containerWidth:k.width,tooltipRef:p,series:E,seriesColors:G,unitPrefix:a,unitSuffix:o})})]})]})]})})},te=b.memo(qt);export{te as M};
|