zframes 0.4.1 → 0.5.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.
Files changed (116) hide show
  1. package/README.md +30 -18
  2. package/dist/index.js +170 -10
  3. package/package.json +4 -4
  4. package/runtime/assets/{bitcoin-dominance-BHcykQ8j.js → bitcoin-dominance-DoQXKqiB.js} +1 -1
  5. package/runtime/assets/{breakeven-PNgn_Prq.js → breakeven-C-RPYpuB.js} +1 -1
  6. package/runtime/assets/{breathing-DrPgIS4r.js → breathing-y5-8SC9y.js} +1 -1
  7. package/runtime/assets/{btc-blocks-mJPjO7gs.js → btc-blocks-Sw7Iyo4-.js} +1 -1
  8. package/runtime/assets/{btc-difficulty-D8kmEyQb.js → btc-difficulty-BYmWqBxZ.js} +1 -1
  9. package/runtime/assets/{btc-fees-Cv6K9S1L.js → btc-fees-D8mISVeZ.js} +1 -1
  10. package/runtime/assets/{btc-hashrate-DT6qyeME.js → btc-hashrate-BEJQmdg9.js} +1 -1
  11. package/runtime/assets/{btc-mempool-ftlit90k.js → btc-mempool-1XmL6cRJ.js} +1 -1
  12. package/runtime/assets/{calculator-CYNDBlrv.js → calculator-DXo_2gkF.js} +1 -1
  13. package/runtime/assets/{checklist-DygbP4AG.js → checklist-BdYa9ZOP.js} +1 -1
  14. package/runtime/assets/{clock-D2rGZ-yo.js → clock-D-I4lQmb.js} +1 -1
  15. package/runtime/assets/{coin-movers-DpHOtUMJ.js → coin-movers-DOacvI6E.js} +1 -1
  16. package/runtime/assets/{countdown-DcbUf2-f.js → countdown-BUHtC8Ve.js} +1 -1
  17. package/runtime/assets/{daily-analysis-D3g2BXJd.js → daily-analysis-CfKUC2nL.js} +1 -1
  18. package/runtime/assets/{day-meter-CDmmKsh5.js → day-meter-Bf2cGHVR.js} +1 -1
  19. package/runtime/assets/dex-volume-chart-61eDevFa.js +1 -0
  20. package/runtime/assets/dex-volume-treemap-DlwxBY_b.js +1 -0
  21. package/runtime/assets/{dice-B7dy1iZP.js → dice-Dl2uLedD.js} +1 -1
  22. package/runtime/assets/{dino-game-DLEtJMnt.js → dino-game-Cx4Nc7AZ.js} +1 -1
  23. package/runtime/assets/{divider-CVjQeL0n.js → divider-HYdZwv9D.js} +1 -1
  24. package/runtime/assets/{drawdy-DoJeRpgi.js → drawdy-C42tJRAO.js} +1 -1
  25. package/runtime/assets/editor-BMMobjrE.css +1 -0
  26. package/runtime/assets/editor-COIEaoVd.js +68 -0
  27. package/runtime/assets/{fear-greed-zPvN2LSi.js → fear-greed-BkmVWoHA.js} +1 -1
  28. package/runtime/assets/{filings-feed-CWAGVlAW.js → filings-feed-ChiZiKYE.js} +1 -1
  29. package/runtime/assets/{financial-stress-C5-XFPqY.js → financial-stress-BQJoviQU.js} +1 -1
  30. package/runtime/assets/{flappy-bird-CoKOL9Ib.js → flappy-bird-DphWPPwp.js} +1 -1
  31. package/runtime/assets/{fundamentals-BYjofvJi.js → fundamentals-D20TvQN_.js} +1 -1
  32. package/runtime/assets/funding-heatmap-DxH9NYjL.js +1 -0
  33. package/runtime/assets/{funding-rate-chart-CxBH7hVe.js → funding-rate-chart-BJ2jiIb4.js} +1 -1
  34. package/runtime/assets/fx-board-DXTpvuXF.js +1 -0
  35. package/runtime/assets/{heading-gFm9ZDY1.js → heading-Cr4OaUt7.js} +1 -1
  36. package/runtime/assets/{holiday-calendar-ffNyuPje.js → holiday-calendar-DHK0jzQc.js} +1 -1
  37. package/runtime/assets/{image-D3DwdoU8.js → image-DVddTOkv.js} +1 -1
  38. package/runtime/assets/{index-DRTPEQtR.css → index-BqHx9BjX.css} +1 -1
  39. package/runtime/assets/index-DK7jWlTL.js +1 -0
  40. package/runtime/assets/index-DNLPQoS7.js +936 -0
  41. package/runtime/assets/inflation-pulse-NCyRMTQV.js +1 -0
  42. package/runtime/assets/{journal-log-CcLb4w4A.js → journal-log-C_W9xs_w.js} +1 -1
  43. package/runtime/assets/{journal-open-C0BKFgMk.js → journal-open-CVlbbryx.js} +1 -1
  44. package/runtime/assets/{journal-results-Bpzb4REp.js → journal-results-Bsk6nwKi.js} +1 -1
  45. package/runtime/assets/{journal-score-BUDUgceb.js → journal-score-C6Aj9hWs.js} +1 -1
  46. package/runtime/assets/{journal-ui-CJIuEcIa.js → journal-ui-DgGd2Foc.js} +1 -1
  47. package/runtime/assets/{labor-market-DJihF3Mk.js → labor-market-BvFWS_YO.js} +1 -1
  48. package/runtime/assets/{lightning-stats-BV14FfAY.js → lightning-stats-DyRwU2-5.js} +1 -1
  49. package/runtime/assets/{link-grid-DK3kGS1q.js → link-grid-DxPMWWbo.js} +1 -1
  50. package/runtime/assets/live-tick-9Q3ubPF9.js +1 -0
  51. package/runtime/assets/liveline-bcaEuskN.js +1 -0
  52. package/runtime/assets/market-cap-treemap-LEDlsNnm.js +1 -0
  53. package/runtime/assets/{market-hours-D89LjpUm.js → market-hours-DlTlbyBC.js} +1 -1
  54. package/runtime/assets/{marquee-ByOQSr9Q.js → marquee-Ds-0N_-6.js} +1 -1
  55. package/runtime/assets/mini-line-chart-CHM5UBjJ.js +1 -0
  56. package/runtime/assets/{mining-pools-D6AnoVnf.js → mining-pools-Dg55Tg1-.js} +1 -1
  57. package/runtime/assets/{mover-row-BTeXB98H.js → mover-row-CunANlxa.js} +1 -1
  58. package/runtime/assets/{national-debt-CgI8LSK6.js → national-debt-G2V6-Lef.js} +1 -1
  59. package/runtime/assets/news-feed-RKSA0wsz.js +1 -0
  60. package/runtime/assets/note-CDlwRqhL.js +1 -0
  61. package/runtime/assets/{open-interest-DgDfcYh5.js → open-interest-Bs6LXeca.js} +1 -1
  62. package/runtime/assets/{options-iv-CqDfM4IA.js → options-iv-BClv6xRB.js} +1 -1
  63. package/runtime/assets/{options-oi-strike-CrIT5WTU.js → options-oi-strike-DbhE95-7.js} +1 -1
  64. package/runtime/assets/{options-put-call--RXL3vTA.js → options-put-call-C7tt191v.js} +1 -1
  65. package/runtime/assets/{pomodoro-DZEEQU2X.js → pomodoro-DpIO5pex.js} +1 -1
  66. package/runtime/assets/{portfolio-allocation-DKf6H-m6.js → portfolio-allocation-DqSXNMYF.js} +1 -1
  67. package/runtime/assets/{portfolio-common-CVt117Oi.js → portfolio-common-CCGvaNdA.js} +1 -1
  68. package/runtime/assets/{portfolio-holdings-CHtvm8aL.js → portfolio-holdings-Bxvf91Yo.js} +1 -1
  69. package/runtime/assets/portfolio-value-C6TFZyPZ.js +1 -0
  70. package/runtime/assets/price-chart-D4wf9Yju.js +1 -0
  71. package/runtime/assets/price-compare-B-mjV1jP.js +1 -0
  72. package/runtime/assets/price-liveline-K4S4XpSX.js +1 -0
  73. package/runtime/assets/{price-ticker-BmfARqHc.js → price-ticker-BNDRtpS8.js} +1 -1
  74. package/runtime/assets/protocol-fees-treemap-vjLiXJ6x.js +1 -0
  75. package/runtime/assets/{protocol-tvl-chart-Dl_MwJdU.js → protocol-tvl-chart-Dz8JtyuD.js} +1 -1
  76. package/runtime/assets/protocol-tvl-treemap-BrA0oXqV.js +1 -0
  77. package/runtime/assets/{quote-BjjZrPpM.js → quote-PcP5IX9V.js} +1 -1
  78. package/runtime/assets/{rates-board-B_OYdW_u.js → rates-board-BNAw2Iei.js} +1 -1
  79. package/runtime/assets/{returns-projector-EA7LLxnL.js → returns-projector-BSTPBgMR.js} +1 -1
  80. package/runtime/assets/{risk-reward-xhKH6ouR.js → risk-reward-Dnp2JQr7.js} +1 -1
  81. package/runtime/assets/{rules-card-CrDquc56.js → rules-card-BNInaYxt.js} +1 -1
  82. package/runtime/assets/{session-progress-BquR98Sm.js → session-progress-D1mhPWWM.js} +1 -1
  83. package/runtime/assets/{short-volume-CYxTQG8H.js → short-volume-Dsm5jHLL.js} +1 -1
  84. package/runtime/assets/{snake-9JevhL1w.js → snake-CyxVfmbr.js} +1 -1
  85. package/runtime/assets/{spotify-embed-CNEzG2xL.js → spotify-embed-DcnZGDEz.js} +1 -1
  86. package/runtime/assets/{stopwatch-BuN_qlhH.js → stopwatch-ggIRtWfw.js} +1 -1
  87. package/runtime/assets/top-movers-CanKFls6.js +1 -0
  88. package/runtime/assets/{treasury-auctions-bA-385ON.js → treasury-auctions-BBHz7Mbe.js} +1 -1
  89. package/runtime/assets/treemap-leaf-DNIoJEK-.js +1 -0
  90. package/runtime/assets/tvl-treemap-D-LqgfI7.js +1 -0
  91. package/runtime/assets/{video-CUWN4TBo.js → video-DqWW_aoH.js} +1 -1
  92. package/runtime/assets/{yield-curve-BOvLIfWe.js → yield-curve-Dpm8XDwi.js} +1 -1
  93. package/runtime/index.html +2 -2
  94. package/runtime/assets/dex-volume-chart-C3KHEnoK.js +0 -1
  95. package/runtime/assets/dex-volume-treemap-C-hqWu6U.js +0 -1
  96. package/runtime/assets/editor-CHAAJRb1.css +0 -1
  97. package/runtime/assets/editor-UP2LBUZ9.js +0 -68
  98. package/runtime/assets/funding-heatmap-BhL0jjq8.js +0 -1
  99. package/runtime/assets/fx-board-Cm0_zK03.js +0 -1
  100. package/runtime/assets/index-DbboK5sz.js +0 -820
  101. package/runtime/assets/index-jnySFpSv.js +0 -1
  102. package/runtime/assets/inflation-pulse-GrBWa9Z6.js +0 -1
  103. package/runtime/assets/liveline-C5zt2WuS.js +0 -1
  104. package/runtime/assets/market-cap-treemap-DpuSjWWe.js +0 -1
  105. package/runtime/assets/mini-line-chart-D-i1QqSe.js +0 -1
  106. package/runtime/assets/news-feed-CA8M5V3K.js +0 -1
  107. package/runtime/assets/note-Biu6llug.js +0 -1
  108. package/runtime/assets/portfolio-value-Dj37WMRc.js +0 -1
  109. package/runtime/assets/price-chart-hgZApQaG.js +0 -1
  110. package/runtime/assets/price-compare-BczbPKy-.js +0 -1
  111. package/runtime/assets/price-liveline-Cbor-Nv_.js +0 -1
  112. package/runtime/assets/protocol-fees-treemap-DeSBgGJ9.js +0 -1
  113. package/runtime/assets/protocol-tvl-treemap-Bvgp0EHh.js +0 -1
  114. package/runtime/assets/top-movers-D7sBm6jo.js +0 -1
  115. package/runtime/assets/treemap-leaf-DLQawrx4.js +0 -1
  116. package/runtime/assets/tvl-treemap-jrgafmGj.js +0 -1
@@ -1,68 +0,0 @@
1
- import{r,j as e,c as Es,a as Qt}from"./react-qoZPGuNy.js";import{G as es}from"./gridstack-BxxvPIFU.js";import{t as rt,u as Ts,F as ts,a as Fs,b as Is,c as Ls,d as $s,N as ss,e as as}from"./index-DbboK5sz.js";const rs=[{key:"zframes",label:"zframes",description:"The signature indigo on near-black navy, DM Sans, soft rounded cards — the default look.",theme:{accentHue:242,accentSat:90,baseHue:233,baseSat:20},typography:{fontFamily:"sans",numericStyle:"proportional"},appearance:{radius:18,borderStrength:.22,surfaceOpacity:1,density:1,elevation:1}},{key:"terminal",label:"Terminal",description:"Phosphor green on black, monospaced, fixed-width digits, sharp dense flat cards — a trading-terminal feel.",theme:{accentHue:145,accentSat:85,baseHue:150,baseSat:16},typography:{fontFamily:"mono",numericStyle:"tabular"},appearance:{radius:4,borderStrength:.34,surfaceOpacity:1,density:.85,elevation:.4}},{key:"amber",label:"Amber",description:"Warm amber on charcoal, monospaced, tabular, slightly sharp cards — a retro CRT console.",theme:{accentHue:38,accentSat:95,baseHue:30,baseSat:18},typography:{fontFamily:"mono",numericStyle:"tabular"},appearance:{radius:6,borderStrength:.3,surfaceOpacity:1,density:.9,elevation:.6}},{key:"graphite",label:"Graphite",description:"Near-grayscale slate, faint rims, flat quiet cards, tabular numbers — calm and neutral.",theme:{accentHue:220,accentSat:8,baseHue:220,baseSat:4},typography:{fontFamily:"sans",numericStyle:"tabular"},appearance:{radius:14,borderStrength:.14,surfaceOpacity:1,density:1,elevation:.35}},{key:"synthwave",label:"Synthwave",description:"Hot magenta on deep violet-black, faintly glassy cards floating on a strong glow — vivid and nocturnal.",theme:{accentHue:320,accentSat:88,baseHue:280,baseSat:26},typography:{fontFamily:"sans",numericStyle:"proportional"},appearance:{radius:20,borderStrength:.3,surfaceOpacity:.9,density:1,elevation:1.7}},{key:"editorial",label:"Editorial",description:"A warm serif on soft charcoal-brown, roomy padding, gentle lift — reads like a financial broadsheet.",theme:{accentHue:22,accentSat:60,baseHue:28,baseSat:12},typography:{fontFamily:"serif",numericStyle:"proportional"},appearance:{radius:10,borderStrength:.18,surfaceOpacity:1,density:1.15,elevation:.8}}],Xe=[{key:"aurora",label:"Aurora",description:"The signature zframes scene — a slow indigo aurora drifting over near-black. The default backdrop.",projectId:"YrTzGatwjK7EoFpCSfgZ",swatch:"radial-gradient(120% 120% at 30% 20%, hsl(248 80% 60%) 0%, hsl(250 70% 22%) 45%, hsl(240 40% 6%) 100%)"},{key:"nebula",label:"Nebula",description:"A deeper violet nebula with brighter drifting cores — a touch more energy than Aurora.",projectId:"K42KSY4FXeXhjVOj9RgT",swatch:"radial-gradient(120% 120% at 70% 30%, hsl(280 75% 62%) 0%, hsl(262 65% 26%) 45%, hsl(250 45% 7%) 100%)"},{key:"ember",label:"Ember",description:"Warm ember tones drifting over charcoal.",projectId:"E4221P7lwTy049d7ISxc",swatch:"radial-gradient(120% 120% at 30% 25%, hsl(24 85% 58%) 0%, hsl(12 65% 28%) 45%, hsl(8 40% 7%) 100%)"},{key:"tide",label:"Tide",description:"Cool teal currents on deep blue-black.",projectId:"cYpXuEzDqm4r3fdp4TGx",swatch:"radial-gradient(120% 120% at 70% 25%, hsl(180 70% 55%) 0%, hsl(196 65% 26%) 45%, hsl(205 45% 7%) 100%)"},{key:"verdant",label:"Verdant",description:"Soft green light over near-black.",projectId:"PrFtFGDE5duemLmr2YKQ",swatch:"radial-gradient(120% 120% at 30% 25%, hsl(140 65% 55%) 0%, hsl(152 55% 24%) 45%, hsl(160 40% 6%) 100%)"},{key:"dusk",label:"Dusk",description:"Magenta-pink glow fading into dark.",projectId:"qpoj0wFWmgwRVXmzRMiL",swatch:"radial-gradient(120% 120% at 70% 30%, hsl(320 80% 62%) 0%, hsl(300 60% 28%) 45%, hsl(290 45% 7%) 100%)"}];/**
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 ms=(...t)=>t.filter((a,n,d)=>!!a&&a.trim()!==""&&d.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 Hs=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 Os=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,n,d)=>d?d.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 ns=t=>{const a=Os(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 Ye={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 Ps=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1},Bs=r.createContext({}),Gs=()=>r.useContext(Bs),Ds=r.forwardRef(({color:t,size:a,strokeWidth:n,absoluteStrokeWidth:d,className:v="",children:m,iconNode:h,...u},f)=>{const{size:p=24,strokeWidth:c=2,absoluteStrokeWidth:z=!1,color:N="currentColor",className:g=""}=Gs()??{},C=d??z?Number(n??c)*24/Number(a??p):n??c;return r.createElement("svg",{ref:f,...Ye,width:a??p??Ye.width,height:a??p??Ye.height,stroke:t??N,strokeWidth:C,className:ms("lucide",g,v),...!m&&!Ps(u)&&{"aria-hidden":"true"},...u},[...h.map(([T,A])=>r.createElement(T,A)),...Array.isArray(m)?m:[m]])});/**
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 me=(t,a)=>{const n=r.forwardRef(({className:d,...v},m)=>r.createElement(Ds,{ref:m,iconNode:a,className:ms(`lucide-${Hs(ns(t))}`,`lucide-${t}`,d),...v}));return n.displayName=ns(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 _s=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ws=me("check",_s);/**
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 Us=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],qs=me("chevron-down",Us);/**
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 Ks=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Vs=me("plus",Ks);/**
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 Xs=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],Ys=me("search",Xs);/**
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 Zs=[["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"}]],Js=me("sliders-horizontal",Zs);/**
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 Qs=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ie=me("x",Qs),fs=["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"],hs=new Map(fs.map((t,a)=>[t,a]));function ye(t){const a=t.indexOf(":");return(a===-1?t:t.slice(a+1)).toUpperCase()}function nt(t){return t.includes(":")?"Stock":"Crypto"}function ea(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 ta(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 et(t,a,n=hs.get(t)??1e4){return{symbol:t,ticker:ye(t),kind:nt(t),markPx:a==null?void 0:a.markPx,changePct:a==null?void 0:a.changePct,rank:n}}function ps(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 sa(t){if(!Number.isFinite(t))return"";const a=t;return`${a>=0?"+":""}${a.toFixed(2)}%`}function gs(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function $(t,a){return t!=null&&t.type?Array.isArray(t.type)?t.type.includes(a):t.type===a:!1}function bs(t){const a=t==null?void 0:t.items;return!!a&&$(t,"array")&&$(a,"string")}function aa(t){var a,n,d;try{const m=rt(t.schema,{io:"input"}).properties??{};if($(m.symbol,"string"))return{kind:"single"};if(bs(m.symbols))return{kind:"symbols",minItems:(a=m.symbols)==null?void 0:a.minItems,maxItems:(n=m.symbols)==null?void 0:n.maxItems};const h=m.holdings,u=((d=h==null?void 0:h.items)==null?void 0:d.properties)??{};if($(h,"array")&&$(u.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 ra(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=>gs(n)&&typeof n.symbol=="string"?n.symbol:"").filter(Boolean):[]}const na=new Set(["symbol","symbols","holdings"]);function it(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 ia(t){let a;try{a=rt(t.schema,{io:"input"})}catch{return[]}return Object.entries(a.properties??{}).filter(([n])=>!na.has(n)).map(([n,d])=>({key:n,label:it(n),shape:d}))}const is=["xyz:TSLA","xyz:NVDA","xyz:AAPL","xyz:MSFT","xyz:SP500","xyz:GOLD","xyz:GOOGL","xyz:AMZN"];function la(t,a){return t==="symbol"?is[a%is.length]:t==="url"?"https://":t==="text"?"New note":t==="title"?"Heading":it(t)||"value"}function tt(t,a,n=0){var d;if(t.default!==void 0)return t.default;if(Array.isArray(t.enum)&&t.enum.length)return t.enum[0];if($(t,"string"))return la(a,n);if($(t,"number")||$(t,"integer"))return t.exclusiveMinimum!==void 0?t.exclusiveMinimum+1:t.minimum??0;if($(t,"boolean"))return!1;if($(t,"array")){const v=t.items??{},m=a==="symbols"?"symbol":a;return Array.from({length:t.minItems??0},(h,u)=>tt(v,m,u))}if($(t,"object")){const v={};for(const m of t.required??[]){const h=(d=t.properties)==null?void 0:d[m];h&&(v[m]=tt(h,m,n))}return v}return null}function oa(t){const a=t.schema.safeParse({});if(a.success)return a.data;let n;try{n=rt(t.schema,{io:"input"})}catch{return{}}const d={},v=new Set(n.required??[]);for(const[h,u]of Object.entries(n.properties??{}))v.has(h)&&(d[h]=tt(u,h));const m=t.schema.safeParse(d);return m.success?m.data:d}function ca(t,a){const n=r.useMemo(()=>t.find(f=>f.capabilities.includes("day-stats")),[t]),[d,v]=r.useState({}),[m,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 c={};for(const z of p)z.status==="fulfilled"&&Object.assign(c,z.value);v(c)}).finally(()=>{f||h(!1)}),()=>{f=!0}},[a,n]),{options:r.useMemo(()=>{const f=new Map;return fs.forEach((p,c)=>{f.set(p,et(p,d[p],c))}),Object.entries(d).forEach(([p,c])=>{f.set(p,et(p,c,hs.get(p)??1e4))}),[...f.values()].sort((p,c)=>p.rank!==c.rank?p.rank-c.rank:p.kind!==c.kind?p.kind==="Stock"?-1:1:p.ticker.localeCompare(c.ticker))},[d]),loading:m}}function ua({instance:t,registry:a,instancesRef:n,symbolUniverse:d,accentHue:v,onApply:m,onClose:h}){const u=a.get(t.frame),f=r.useMemo(()=>u?aa(u):null,[u]),p=r.useMemo(()=>u?ia(u):[],[u]),[c,z]=r.useState(()=>({...t.config??{}})),[N,g]=r.useState(null),C=t.id,T=r.useCallback(j=>{if(z(j),u){const ce=u.schema.safeParse(j);if(!ce.success){g(ce.error.issues.map(fe=>`${fe.path.join(".")||"(root)"}: ${fe.message}`).join(`
67
- `));return}}g(null);const E=n.current.get(C);E&&(n.current.set(C,{...E,config:j}),m(C))},[u,C,n,m]);r.useEffect(()=>{const j=E=>{E.key==="Escape"&&h()};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[h]);const A=(j,E)=>T({...c,[j]:E}),y=t.frame.replace(/-/g," ");return e.jsx("div",{className:"zf-dialog-backdrop",style:{"--zf-accent-hue":v},onMouseDown:j=>{j.target===j.currentTarget&&h()},children:e.jsxs("div",{className:"zf-dialog",role:"dialog","aria-modal":"true","aria-label":`Configure ${y}`,children:[e.jsxs("header",{className:"zf-dialog-head",children:[e.jsxs("h3",{className:"zf-dialog-title",children:["Configure · ",y]}),e.jsx("button",{type:"button",className:"zf-dialog-close",onClick:h,"aria-label":"Close",title:"Close",children:e.jsx(Ie,{size:16,"aria-hidden":"true"})})]}),e.jsxs("div",{className:"zf-dialog-body",children:[f&&e.jsx(pa,{control:f,config:c,loading:d.loading,options:d.options,onChangeSymbol:j=>T({...c,symbol:j}),onChangeSymbols:j=>T({...c,symbols:j}),onChangeHoldings:j=>T({...c,holdings:j})}),p.map(j=>e.jsx(da,{field:j,value:c[j.key],onChange:E=>A(j.key,E)},j.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 da({field:t,value:a,onChange:n}){const{key:d,label:v,shape:m}=t,h=`zf-cfg-${d}`,u=m.description;if($(m,"boolean")){const p=typeof a=="boolean"?a:!!m.default;return e.jsxs("label",{className:"zf-checkbox",title:u,children:[e.jsx("input",{type:"checkbox",checked:p,onChange:c=>n(c.target.checked)}),v]})}const f=Array.isArray(m.enum)&&m.enum.every(p=>typeof p=="string")?m.enum:null;if(f&&f.length>0){const p=typeof m.default=="string"?m.default:f[0],c=typeof a=="string"&&f.includes(a)?a:p;return e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:h,title:u,children:v}),e.jsx("select",{id:h,className:"zf-select",value:c,onChange:z=>n(z.target.value),children:f.map(z=>e.jsx("option",{value:z,children:it(z)},z))})]})}return $(m,"integer")||$(m,"number")?e.jsx(ma,{id:h,field:t,value:a,onChange:n}):bs(m)?e.jsx(ha,{id:h,field:t,value:a,onChange:n}):e.jsx(fa,{id:h,field:t,value:a,onChange:n})}function ma({id:t,field:a,value:n,onChange:d}){const{label:v,shape:m}=a,h=m.description,u=typeof m.minimum=="number"?m.minimum:void 0,f=typeof m.maximum=="number"?m.maximum:void 0,p=$(m,"integer"),c=p?1:"any",z=typeof m.default=="number"?m.default:u??0,N=typeof n=="number"&&Number.isFinite(n)?n:void 0;if(u!==void 0&&f!==void 0){const g=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:v}),e.jsx("span",{className:"zf-field-num",children:g})]}),e.jsx("input",{id:t,type:"range",className:"zf-range",min:u,max:f,step:c,value:g,onChange:C=>d(p?Math.round(Number(C.target.value)):Number(C.target.value))})]})}return e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:t,title:h,children:v}),e.jsx("input",{id:t,type:"number",className:"zf-input",min:u,max:f,step:c,value:n==null?"":String(n),onChange:g=>d(g.target.value===""?"":Number(g.target.value))})]})}function fa({id:t,field:a,value:n,onChange:d}){const{key:v,label:m,shape:h}=a,u=h.description,f=typeof n=="string"?n:"",p=typeof h.default=="string"?h.default:"",c=typeof h.default=="string"&&/^#[0-9a-f]{6}$/i.test(h.default)?h.default:null;if(v==="color"||c){const z=/^#[0-9a-f]{6}$/i.test(f)?f:c??"#8b8df9";return e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:t,title:u,children:m}),e.jsxs("div",{className:"zf-color-row",children:[e.jsx("input",{type:"color",className:"zf-color",value:z,"aria-label":`${m} swatch`,onChange:N=>d(N.target.value)}),e.jsx("input",{id:t,className:"zf-input",value:f,placeholder:p,spellCheck:!1,onChange:N=>d(N.target.value)})]})]})}return v==="text"?e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:t,title:u,children:m}),e.jsx("textarea",{id:t,className:"zf-textarea zf-textarea--prose",value:f,placeholder:p,onChange:z=>d(z.target.value)})]}):e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:t,title:u,children:m}),e.jsx("input",{id:t,className:"zf-input",value:f,placeholder:p,spellCheck:!1,onChange:z=>d(z.target.value)})]})}function ha({id:t,field:a,value:n,onChange:d}){const{label:v,shape:m}=a,h=m.description,u=Array.isArray(n)?n.filter(g=>typeof g=="string"):[],[f,p]=r.useState(""),c=typeof m.maxItems=="number"?m.maxItems:void 0,z=c!==void 0&&u.length>=c,N=g=>{const C=g.trim().toUpperCase();p(""),!(!C||u.includes(C)||z)&&d([...u,C])};return e.jsxs("div",{className:"zf-field",children:[e.jsx("label",{htmlFor:t,title:h,children:v}),u.length>0&&e.jsx("div",{className:"zf-taglist",children:u.map(g=>e.jsxs("span",{className:"zf-tag",children:[g,e.jsx("button",{type:"button",className:"zf-symbol-remove","aria-label":`Remove ${g}`,onClick:()=>d(u.filter(C=>C!==g)),children:e.jsx(Ie,{size:12,"aria-hidden":"true"})})]},g))}),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:g=>p(g.target.value),onBlur:()=>N(f),onKeyDown:g=>{g.key==="Enter"||g.key===","?(g.preventDefault(),N(f)):g.key==="Backspace"&&f===""&&u.length>0&&d(u.slice(0,-1))}})]})}function pa({control:t,config:a,loading:n,options:d,onChangeSymbol:v,onChangeSymbols:m,onChangeHoldings:h}){const u=ra(t,a);if(t.kind==="single"){const c=u[0]??"";return e.jsxs("div",{className:"zf-symbol-editor",children:[e.jsx(Ze,{title:"Ticker",detail:c?ye(c):"None",loading:n}),c?e.jsx(at,{symbol:c,option:st(c,d)}):null,e.jsx(Je,{loading:n,options:d,selectedSymbols:c?[c]:[],placeholder:"Search TSLA, BTC...",onSelect:v})]})}if(t.kind==="symbols"){const c=typeof t.maxItems=="number"&&u.length>=t.maxItems;return e.jsxs("div",{className:"zf-symbol-editor",children:[e.jsx(Ze,{title:"Tickers",detail:ls(u.length,t),loading:n}),e.jsx(ga,{symbols:u,options:d,onRemove:z=>m(u.filter(N=>N!==z))}),e.jsx(Je,{disabled:c,loading:n,options:d,selectedSymbols:u,placeholder:c?"Maximum tickers added":"Add ticker",keepOpenOnSelect:!0,onSelect:z=>{u.includes(z)||c||m([...u,z])}})]})}const f=Array.isArray(a.holdings)?a.holdings.filter(gs):[],p=typeof t.maxItems=="number"&&f.length>=t.maxItems;return e.jsxs("div",{className:"zf-symbol-editor",children:[e.jsx(Ze,{title:"Holding tickers",detail:ls(f.length,t),loading:n}),e.jsx("div",{className:"zf-holding-list",children:f.map((c,z)=>{const N=typeof c.symbol=="string"?c.symbol:"";return e.jsxs("div",{className:"zf-holding-row",children:[e.jsxs("div",{className:"zf-holding-main",children:[N?e.jsx(at,{symbol:N,option:st(N,d),compact:!0}):e.jsx("span",{className:"zf-symbol-empty",children:"No ticker"}),typeof c.amount=="number"&&e.jsxs("span",{className:"zf-holding-amount",children:["x ",c.amount]})]}),e.jsx("button",{type:"button",className:"zf-symbol-remove","aria-label":`Remove ${N||"holding"}`,onClick:()=>{h(f.filter((g,C)=>C!==z))},children:e.jsx(Ie,{size:13,"aria-hidden":"true"})})]},`${N}-${z}`)})}),e.jsx(Je,{disabled:p,loading:n,options:d,selectedSymbols:u,placeholder:p?"Maximum holdings added":"Add holding",keepOpenOnSelect:!0,onSelect:c=>{p||h([...f,{symbol:c,amount:1}])}})]})}function Ze({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 ls(t,a){return typeof a.maxItems=="number"?`${t}/${a.maxItems}`:typeof a.minItems=="number"&&t<a.minItems?`${t}/${a.minItems}+`:String(t)}function st(t,a){return a.find(n=>n.symbol===t)??et(t)}function ga({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(d=>e.jsxs("span",{className:"zf-symbol-chip",children:[e.jsx(at,{symbol:d,option:st(d,a),compact:!0}),e.jsx("button",{type:"button",className:"zf-symbol-remove","aria-label":`Remove ${d}`,onClick:()=>n(d),children:e.jsx(Ie,{size:13,"aria-hidden":"true"})})]},d))})}function at({symbol:t,option:a,compact:n=!1}){return e.jsxs("span",{className:n?"zf-selected-symbol is-compact":"zf-selected-symbol",children:[e.jsx(ys,{symbol:t}),e.jsxs("span",{className:"zf-selected-symbol-text",children:[e.jsx("strong",{children:ye(t)}),!n&&e.jsx("em",{children:t})]}),!n&&a.markPx!==void 0&&e.jsx("span",{className:"zf-selected-symbol-price",children:ps(a.markPx)})]})}function Je({disabled:t=!1,loading:a,options:n,selectedSymbols:d,placeholder:v,keepOpenOnSelect:m=!1,onSelect:h}){const[u,f]=r.useState(""),[p,c]=r.useState(!1),z=r.useMemo(()=>new Set(d),[d]),N=r.useMemo(()=>new Set(n.map(y=>y.symbol)),[n]),g=ta(u),C=r.useMemo(()=>{const y=u.trim().toLowerCase();return(y?n.filter(E=>E.ticker.toLowerCase().includes(y)||E.symbol.toLowerCase().includes(y)):n.slice(0,28)).slice().sort((E,ce)=>os(E,y)-os(ce,y)).slice(0,36)},[n,u]),T=r.useMemo(()=>{if(!g)return[];const y=g.includes(":")?[g]:[`xyz:${g}`,g];return y.filter((j,E)=>y.indexOf(j)===E&&!N.has(j)&&!z.has(j))},[N,g,z]),A=y=>{!y||m&&z.has(y)||(h(y),f(""),c(m))};return e.jsxs("div",{className:"zf-symbol-combo",onBlur:y=>{y.currentTarget.contains(y.relatedTarget)||c(!1)},children:[e.jsxs("div",{className:t?"zf-symbol-search is-disabled":"zf-symbol-search",children:[e.jsx(Ys,{size:14,"aria-hidden":"true"}),e.jsx("input",{value:u,disabled:t,placeholder:v,"aria-label":v,role:"combobox","aria-expanded":p,onFocus:()=>c(!0),onChange:y=>{f(y.target.value),c(!0)},onKeyDown:y=>{var j;y.key==="Enter"&&(y.preventDefault(),A(((j=C[0])==null?void 0:j.symbol)??T[0]??g))}}),e.jsx(qs,{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..."}),C.map(y=>{const j=z.has(y.symbol);return e.jsxs("button",{type:"button",className:j?"zf-symbol-option is-selected":"zf-symbol-option",disabled:m&&j,role:"option","aria-selected":j,onMouseDown:E=>{E.preventDefault(),A(y.symbol)},onClick:E=>{E.detail===0&&A(y.symbol)},children:[e.jsx(ys,{symbol:y.symbol}),e.jsxs("span",{className:"zf-symbol-option-main",children:[e.jsx("strong",{children:y.ticker}),e.jsx("em",{children:y.symbol})]}),e.jsxs("span",{className:"zf-symbol-option-meta",children:[e.jsx("span",{children:ps(y.markPx)||y.kind}),y.changePct!==void 0&&e.jsx("span",{className:y.changePct>=0?"zf-symbol-change is-up":"zf-symbol-change is-down",children:sa(y.changePct)})]}),j&&e.jsx(Ws,{size:14,"aria-hidden":"true"})]},y.symbol)}),T.map(y=>e.jsxs("button",{type:"button",className:"zf-symbol-option zf-symbol-option--custom",onMouseDown:j=>{j.preventDefault(),A(y)},onClick:j=>{j.detail===0&&A(y)},children:[e.jsx("span",{className:"zf-symbol-custom-icon",children:e.jsx(Vs,{size:13,"aria-hidden":"true"})}),e.jsxs("span",{className:"zf-symbol-option-main",children:[e.jsx("strong",{children:ye(y)}),e.jsx("em",{children:y})]}),e.jsx("span",{className:"zf-symbol-option-meta",children:e.jsx("span",{children:nt(y)})})]},y)),!a&&C.length===0&&T.length===0&&e.jsx("div",{className:"zf-symbol-menu-status",children:"No matches"})]})]})}function os(t,a){if(!a)return t.rank;const n=t.ticker.toLowerCase(),d=t.symbol.toLowerCase();return n===a||d===a?-40+t.rank/1e4:n.startsWith(a)?-20+t.rank/1e4:d.startsWith(a)?-10+t.rank/1e4:t.rank}function ys({symbol:t}){const a=nt(t).toLowerCase(),[n,d]=r.useState(!1);return r.useEffect(()=>d(!1),[t]),n?e.jsx("span",{className:`zf-symbol-avatar zf-symbol-avatar--${a}`,children:ye(t).slice(0,2)}):e.jsx("img",{className:`zf-symbol-avatar zf-symbol-avatar--logo zf-symbol-avatar--${a}`,src:ea(t),alt:"","aria-hidden":"true",draggable:!1,loading:"lazy",onError:()=>d(!0)})}const ba=24;function cs(t,a){var n;return a==="flow-horizontal"?(n=t.layouts)==null?void 0:n["flow-horizontal"]:t.position}function us(t,a){const n=t.reduce((d,v)=>d+Math.max(1,v.position.w)*Math.min(Math.max(1,v.position.h),a),0);return Math.max(ba,Math.ceil(n/a*1.25)+8)}function ds(t,a,n){var h;const d=new Set,v=(u,f,p,c)=>{for(let z=0;z<p;z++)for(let N=0;N<c;N++){const g=u+z,C=f+N;g>=0&&C>=0&&d.add(`${g},${C}`)}},m=(u,f,p,c)=>{if(u+p>a||f+c>n)return!1;for(let z=0;z<p;z++)for(let N=0;N<c;N++)if(d.has(`${u+z},${f+N}`))return!1;return!0};for(const u of t){const f=(h=u.layouts)==null?void 0:h["flow-horizontal"];f&&v(f.x,f.y,f.w,Math.min(f.h,n))}return t.map(u=>{var z;if((z=u.layouts)!=null&&z["flow-horizontal"])return u;const f=Math.min(Math.max(1,u.position.w),a),p=Math.min(Math.max(1,u.position.h),n);let c={x:0,y:0,w:f,h:p};e:for(let N=0;N<=a-f;N++)for(let g=0;g<=n-p;g++)if(m(N,g,f,p)){c={x:N,y:g,w:f,h:p};break e}return v(c.x,c.y,c.w,c.h),{...u,layouts:{...u.layouts,"flow-horizontal":c}}})}const ya='<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 Qe(t){queueMicrotask(()=>t.unmount())}function va({spec:t,registry:a,onSave:n,customiseButtonTarget:d,onAccentHueChange:v,onAccentSatChange:m,onFontScaleChange:h,onUpColorChange:u,onDownColorChange:f,onModeChange:p,onBackgroundChange:c}){var Kt;const z=Ts(),N=r.useRef(null),g=r.useRef(null),C=r.useRef(!1),T=r.useRef(t.grid.mode),A=r.useRef(new Map),y=r.useRef(new Map),j=r.useRef(new Map),E=r.useRef([]),ce=r.useRef(t.theme.accentHue),fe=r.useRef(t.theme.accentSat),lt=r.useRef(t.theme.baseHue),ot=r.useRef(t.theme.baseSat),ct=r.useRef(t.theme.upColor),ut=r.useRef(t.theme.downColor),dt=r.useRef(t.grid.gap),mt=r.useRef(t.grid.mode),he=r.useRef(null),ft=r.useRef(t.appearance.radius),ht=r.useRef(t.appearance.borderStrength),pt=r.useRef(t.appearance.surfaceOpacity),gt=r.useRef(t.appearance.density),bt=r.useRef(t.appearance.elevation),yt=r.useRef(t.typography.fontFamily),xt=r.useRef(t.typography.numericStyle),zt=r.useRef(t.typography.scale),jt=r.useRef(t.background.type),Nt=r.useRef(t.background.projectId),vt=r.useRef(t.background.opacity),kt=r.useRef(t.background.color),wt=r.useRef(t.background.gradientFrom),St=r.useRef(t.background.gradientTo),Ct=r.useRef(t.background.gradientAngle),Rt=r.useRef(0),[F,Le]=r.useState(!1),xs=ca(z,F),[xa,pe]=r.useState(t.frames.length),[O,xe]=r.useState(t.theme.accentHue),[P,ze]=r.useState(t.theme.accentSat),[G,je]=r.useState(t.theme.baseHue),[D,Ne]=r.useState(t.theme.baseSat),[_,$e]=r.useState(t.theme.upColor),[W,He]=r.useState(t.theme.downColor),[L,At]=r.useState(t.grid.mode),[zs,Mt]=r.useState(!1),[U,Oe]=r.useState(t.grid.gap),[q,ve]=r.useState(t.appearance.radius),[K,ke]=r.useState(t.appearance.borderStrength),[V,we]=r.useState(t.appearance.surfaceOpacity),[X,Se]=r.useState(t.appearance.density),[Y,Ce]=r.useState(t.appearance.elevation),[se,Pe]=r.useState(t.typography.fontFamily),[ae,Be]=r.useState(t.typography.numericStyle),[Z,Ge]=r.useState(t.typography.scale),[B,Et]=r.useState(t.background.type),[re,Tt]=r.useState(t.background.projectId??Xe[0].projectId),[J,De]=r.useState(t.background.opacity),[Q,_e]=r.useState(t.background.color),[ne,Ft]=r.useState(t.background.gradientFrom),[ie,It]=r.useState(t.background.gradientTo),[ee,We]=r.useState(t.background.gradientAngle),js=r.useCallback(s=>{xe(s.theme.accentHue),ze(s.theme.accentSat),je(s.theme.baseHue),Ne(s.theme.baseSat),Pe(s.typography.fontFamily),Be(s.typography.numericStyle),ve(s.appearance.radius),ke(s.appearance.borderStrength),we(s.appearance.surfaceOpacity),Se(s.appearance.density),Ce(s.appearance.elevation)},[]),Lt=((Kt=rs.find(s=>s.theme.accentHue===O&&s.theme.accentSat===P&&s.theme.baseHue===G&&s.theme.baseSat===D&&s.typography.fontFamily===se&&s.typography.numericStyle===ae&&s.appearance.radius===q&&s.appearance.borderStrength===K&&s.appearance.surfaceOpacity===V&&s.appearance.density===X&&s.appearance.elevation===Y))==null?void 0:Kt.key)??null,[le,$t]=r.useState("frames"),[Ue,ue]=r.useState(null),Ht=r.useRef(null);Ht.current=Ue,r.useEffect(()=>{v==null||v(O)},[O,v]),r.useEffect(()=>{m==null||m(P)},[P,m]),r.useEffect(()=>{h==null||h(Z)},[Z,h]),r.useEffect(()=>{u==null||u(_)},[_,u]),r.useEffect(()=>{f==null||f(W)},[W,f]),r.useEffect(()=>{T.current=L,p==null||p(L)},[L,p]),r.useEffect(()=>{c==null||c({...t.background,type:B,projectId:re,opacity:J,color:Q,gradientFrom:ne,gradientTo:ie,gradientAngle:ee})},[B,re,J,Q,ne,ie,ee,t.background,c]),r.useEffect(()=>{var s;(s=g.current)==null||s.margin(U/2)},[U]);const Ot=r.useRef(z);Ot.current=z;const de=r.useRef(a);de.current=a;const Re=r.useMemo(()=>{const s=new Map;for(const l of a.values()){const x=l.category??"other",w=s.get(x);w?w.push(l):s.set(x,[l])}const o=ts.map(l=>l.key),i=ts.map(l=>({key:l.key,label:l.label,description:l.description,frames:s.get(l.key)??[]})),b=[...s.entries()].filter(([l])=>!o.includes(l)).flatMap(([,l])=>l);return b.length&&i.push({key:"other",label:"Other",description:"",frames:b}),i.filter(l=>l.frames.length>0).map(l=>({...l,frames:[...l.frames].sort((x,w)=>x.name.localeCompare(w.name))}))},[a]),[Pt,Ns]=r.useState(()=>new Set(Re[0]?[Re[0].key]:[])),vs=r.useCallback(s=>{Ns(o=>{const i=new Set(o);return i.has(s)?i.delete(s):i.add(s),i})},[]),ge=r.useCallback(s=>s?oa(s):{},[]),Ae=r.useCallback(s=>{let o=`${s}-${++Rt.current}`;for(;A.current.has(o);)o=`${s}-${++Rt.current}`;return o},[]),Me=r.useRef(null),te=r.useCallback(s=>{const o=j.current.get(s),i=A.current.get(s);if(!o||!i)return;let b=y.current.get(s);b||(o.innerHTML="",b=Es.createRoot(o),y.current.set(s,b)),b.render(e.jsx(Fs,{providers:Ot.current,children:e.jsx(Is.Provider,{value:l=>{var x;return(x=Me.current)==null?void 0:x.call(Me,s,l)},children:e.jsx(Ls,{instance:i,registry:de.current,className:"zf-fill"})})}))},[]),ks=r.useCallback((s,o)=>{const i=A.current.get(s);i&&(A.current.set(s,{...i,config:{...i.config,...o}}),te(s))},[te]);Me.current=ks;const Bt=r.useCallback(s=>{const o=g.current;if(!o)return;const i=s.getAttribute("gs-id");if(i){const b=y.current.get(i);b&&Qe(b),y.current.delete(i),j.current.delete(i),A.current.delete(i),Ht.current===i&&ue(null)}o.removeWidget(s,!0),pe(o.getGridItems().length)},[]),oe=r.useCallback(s=>{if(!s.querySelector(".zf-cfg-btn")){const o=document.createElement("button");o.className="zf-cfg-btn",o.type="button",o.title="Edit frame",o.setAttribute("aria-label","Edit frame"),o.innerHTML=ya,o.addEventListener("click",i=>{i.stopPropagation();const b=s.getAttribute("gs-id");b&&ue(b)}),s.appendChild(o)}if(!s.querySelector(".zf-del-btn")){const o=document.createElement("button");o.className="zf-del-btn",o.type="button",o.title="Remove frame",o.innerHTML="&times;",o.addEventListener("click",i=>{i.stopPropagation(),Bt(s)}),s.appendChild(o)}},[Bt]),Gt=r.useCallback(s=>{var o,i;(o=s.querySelector(".zf-cfg-btn"))==null||o.remove(),(i=s.querySelector(".zf-del-btn"))==null||i.remove()},[]),Ee=r.useCallback((s,o=!1)=>{const i=T.current,b=i==="flow-horizontal",l=cs(s,i),x=(l==null?void 0:l.w)??s.position.w,w=(l==null?void 0:l.h)??s.position.h,k=b?Math.min(w,t.grid.rows):w,M=de.current.get(s.frame),S=M==null?void 0:M.layout,R=document.createElement("div");R.className="grid-stack-item",R.setAttribute("gs-id",s.id),R.setAttribute("data-frame",s.frame),o||!l?R.setAttribute("gs-auto-position","true"):(R.setAttribute("gs-x",String(l.x)),R.setAttribute("gs-y",String(l.y))),R.setAttribute("gs-w",String(x)),R.setAttribute("gs-h",String(k)),S!=null&&S.minW&&R.setAttribute("gs-min-w",String(S.minW)),S!=null&&S.minH&&R.setAttribute("gs-min-h",String(S.minH)),S!=null&&S.maxW&&R.setAttribute("gs-max-w",String(S.maxW)),S!=null&&S.maxH&&R.setAttribute("gs-max-h",String(S.maxH));const I=document.createElement("div");return I.className="grid-stack-item-content",R.appendChild(I),j.current.set(s.id,I),R},[t.grid.rows]),be=r.useCallback(s=>{const o=g.current;if(o){y.current.forEach(Qe),y.current.clear(),j.current.clear(),A.current=new Map(s.map(i=>[i.id,i])),o.removeAll(!0),o.el.querySelectorAll(".grid-stack-item").forEach(i=>i.remove()),o.batchUpdate();for(const i of s){const b=Ee(i);o.el.appendChild(b),o.makeWidget(b),te(i.id)}o.batchUpdate(!1),pe(s.length)}},[Ee,te]),Dt=r.useCallback(s=>{var w,k;const o=g.current;if(!o)return;const i=de.current.get(s),b=Ae(s),l={id:b,frame:s,position:{x:0,y:0,w:((w=i==null?void 0:i.layout)==null?void 0:w.w)??4,h:((k=i==null?void 0:i.layout)==null?void 0:k.h)??3},config:ge(i)};A.current.set(b,l);const x=Ee(l,!0);o.el.appendChild(x),o.makeWidget(x),te(b),oe(x),pe(o.getGridItems().length),ue(b)},[Ee,oe,ge,te,Ae]),Te=r.useCallback(()=>{var b,l;const s=typeof window<"u"?window.innerHeight:800,o=((l=(b=N.current)==null?void 0:b.parentElement)==null?void 0:l.getBoundingClientRect().top)??120,i=s-o-56;return Math.max(80,Math.floor(i/t.grid.rows))},[t.grid.rows]),qe=r.useCallback(()=>{const s=g.current;if(!s)return;const o=s.el;s.off("dropped"),s.off("removed"),s.off("drag"),s.off("dragstart"),s.off("dragstop"),document.body.classList.remove("zf-dragging"),y.current.forEach(Qe),y.current.clear(),j.current.clear(),s.destroy(!1),o&&(o.querySelectorAll(".grid-stack-item").forEach(i=>i.remove()),o.style.width="",o.style.height=""),g.current=null},[]),Ke=r.useCallback((s,o)=>{const i=s==="flow-horizontal",b=i?Te():t.grid.rowHeight,l=es.init({column:i?o:t.grid.columns,cellHeight:b,margin:t.grid.gap/2,float:!0,...i?{maxRow:t.grid.rows,minRow:t.grid.rows}:{},animate:!0,acceptWidgets:!0,disableDrag:!0,disableResize:!0},N.current);return l.el.style.width=i?`${o*b}px`:"",l.on("dropped",(x,w,k)=>{var Zt,Jt;const M=k==null?void 0:k.el;if(!M)return;const S=M.querySelector(".grid-stack-item-content"),R=M.getAttribute("data-frame");if(!S||!R)return;const I=M.getAttribute("gs-id")||Ae(R);M.setAttribute("gs-id",I);const H=de.current.get(R),Vt=(k==null?void 0:k.w)??((Zt=H==null?void 0:H.layout)==null?void 0:Zt.w)??4,Xt=(k==null?void 0:k.h)??((Jt=H==null?void 0:H.layout)==null?void 0:Jt.h)??3,Yt={x:(k==null?void 0:k.x)??0,y:(k==null?void 0:k.y)??0,w:Vt,h:Xt},Ms=T.current==="flow-horizontal"?{id:I,frame:R,position:{x:0,y:0,w:Vt,h:Xt},layouts:{"flow-horizontal":Yt},config:ge(H)}:{id:I,frame:R,position:Yt,config:ge(H)};A.current.set(I,Ms),j.current.set(I,S),te(I),oe(M),pe(l.getGridItems().length),ue(I)}),l.on("removed",()=>pe(l.getGridItems().length)),l.on("dragstart",()=>document.body.classList.add("zf-dragging")),l.on("dragstop",()=>document.body.classList.remove("zf-dragging")),i&&l.on("drag",x=>{var R,I,H;const w=(R=N.current)==null?void 0:R.parentElement;if(!w)return;const k=w.getBoundingClientRect(),M=x.clientX??((H=(I=x.touches)==null?void 0:I[0])==null?void 0:H.clientX);if(M==null)return;const S=64;M<k.left+S?w.scrollLeft-=18:M>k.right-S&&(w.scrollLeft+=18)}),l},[Te,t.grid.columns,t.grid.rowHeight,t.grid.rows,t.grid.gap,Ae,ge,te,oe]);r.useEffect(()=>{if(!N.current||C.current)return;C.current=!0;const s=T.current==="flow-horizontal",o=s?us(t.frames,t.grid.rows):t.grid.columns;return g.current=Ke(T.current,o),be(s?ds(t.frames,o,t.grid.rows):t.frames),()=>{qe(),C.current=!1}},[]),r.useEffect(()=>{const s=g.current;s&&(s.enableMove(F),s.enableResize(F),F?s.getGridItems().forEach(oe):s.getGridItems().forEach(Gt))},[F,oe,Gt]),r.useEffect(()=>{const s=g.current;if(!s||T.current!=="flow-horizontal")return;const o=requestAnimationFrame(()=>{const i=Te();s.cellHeight(i),s.el.style.width=`${s.getColumn()*i}px`});return()=>cancelAnimationFrame(o)},[F,Te]),r.useEffect(()=>{!F||le!=="frames"||!g.current||es.setupDragIn(".zf-newwidget",{appendTo:"body",helper:s=>{var S;const i=(s.closest(".zf-newwidget")??s).dataset.frame??"",b=de.current.get(i),l=b==null?void 0:b.layout,x=document.createElement("div");x.className="grid-stack-item",x.setAttribute("data-frame",i),x.setAttribute("gs-w",String((l==null?void 0:l.w)??4)),x.setAttribute("gs-h",String((l==null?void 0:l.h)??3)),l!=null&&l.minW&&x.setAttribute("gs-min-w",String(l.minW)),l!=null&&l.minH&&x.setAttribute("gs-min-h",String(l.minH)),l!=null&&l.maxW&&x.setAttribute("gs-max-w",String(l.maxW)),l!=null&&l.maxH&&x.setAttribute("gs-max-h",String(l.maxH));const w=(S=N.current)==null?void 0:S.closest(".zf-editor");if(w){const R=getComputedStyle(w);for(const I of["--zf-accent-hue","--zf-accent-sat","--font-dmsans"]){const H=R.getPropertyValue(I).trim();H&&x.style.setProperty(I,H)}}const k=i.replace(/-/g," "),M=b!=null&&b.iconUrl?`<img class="zf-drag-ghost-icon" src="${b.iconUrl}" alt="" />`:"";return x.innerHTML=`<div class="grid-stack-item-content zf-drag-ghost" data-frame="${i}">${M}<span class="zf-drag-ghost-name">${k}</span></div>`,x}})},[F,le,Re,Pt]);const Fe=r.useCallback(()=>{const s=g.current,o=[];if(s)for(const i of s.getGridItems()){const b=i.getAttribute("gs-id");if(!b)continue;const l=A.current.get(b);if(!l)continue;const x=i.gridstackNode,w=cs(l,L)??l.position,k={x:(x==null?void 0:x.x)??w.x,y:(x==null?void 0:x.y)??w.y,w:(x==null?void 0:x.w)??w.w,h:(x==null?void 0:x.h)??w.h};o.push(L==="flow-horizontal"?{...l,layouts:{...l.layouts,"flow-horizontal":k}}:{...l,position:k})}return o.sort((i,b)=>i.position.y-b.position.y||i.position.x-b.position.x),{...t,grid:{...t.grid,gap:U,mode:L},background:{...t.background,type:B,projectId:re,opacity:J,color:Q,gradientFrom:ne,gradientTo:ie,gradientAngle:ee},theme:{...t.theme,accentHue:O,accentSat:P,baseHue:G,baseSat:D,upColor:_,downColor:W},typography:{...t.typography,fontFamily:se,numericStyle:ae,scale:Z},appearance:{...t.appearance,radius:q,borderStrength:K,surfaceOpacity:V,density:X,elevation:Y},frames:o}},[t,O,P,G,D,_,W,se,ae,Z,U,L,q,K,V,X,Y,B,re,J,Q,ne,ie,ee]),_t=r.useCallback(s=>{const o=new Blob([`${JSON.stringify(s,null,2)}
68
- `],{type:"application/json"}),i=URL.createObjectURL(o),b=document.createElement("a");b.href=i,b.download="dashboard.json",b.click(),setTimeout(()=>URL.revokeObjectURL(i),0)},[]),ws=r.useCallback(()=>{E.current=Fe().frames,ce.current=O,fe.current=P,lt.current=G,ot.current=D,ct.current=_,ut.current=W,dt.current=U,mt.current=L,ft.current=q,ht.current=K,pt.current=V,gt.current=X,bt.current=Y,yt.current=se,xt.current=ae,zt.current=Z,jt.current=B,Nt.current=re,vt.current=J,kt.current=Q,wt.current=ne,St.current=ie,Ct.current=ee,Le(!0)},[Fe,O,P,G,D,_,W,U,L,q,K,V,X,Y,se,ae,Z,B,re,J,Q,ne,ie,ee]),Ss=r.useCallback(()=>{be(E.current),xe(ce.current),ze(fe.current),je(lt.current),Ne(ot.current),$e(ct.current),He(ut.current),Oe(dt.current),At(mt.current),ve(ft.current),ke(ht.current),we(pt.current),Se(gt.current),Ce(bt.current),Pe(yt.current),Be(xt.current),Ge(zt.current),Et(jt.current),Tt(Nt.current??Xe[0].projectId),De(vt.current),_e(kt.current),Ft(wt.current),It(St.current),We(Ct.current),ue(null),Le(!1)},[be]),Cs=r.useCallback(async()=>{const s=Fe();Le(!1),ue(null),n?await n(s):_t(s)},[Fe,n,_t]),Rs=r.useCallback(()=>{var s;(s=g.current)==null||s.compact(T.current==="flow-horizontal"?"list":"compact")},[]),Wt=r.useCallback(()=>{const s=g.current;if(!s)return;const o=T.current;for(const i of s.getGridItems()){const b=i.getAttribute("gs-id");if(!b)continue;const l=A.current.get(b);if(!l)continue;const x=i.gridstackNode;if(!x)continue;const w={x:x.x??0,y:x.y??0,w:x.w??1,h:x.h??1};A.current.set(b,o==="flow-horizontal"?{...l,layouts:{...l.layouts,"flow-horizontal":w}}:{...l,position:w})}},[]),Ut=r.useCallback(s=>{var b;if(s===T.current)return;const o=()=>{Wt();const l=[...A.current.values()],x=F,w=s==="flow-horizontal",k=w?us(l,t.grid.rows):t.grid.columns;qe(),T.current=s,At(s);const M=Ke(s,k);g.current=M,be(w?ds(l,k,t.grid.rows):l),x&&(M.enableMove(!0),M.enableResize(!0),M.getGridItems().forEach(oe))};if(typeof window<"u"&&((b=window.matchMedia)==null?void 0:b.call(window,"(prefers-reduced-motion: reduce)").matches)){o();return}he.current&&clearTimeout(he.current),Mt(!0),he.current=setTimeout(()=>{o(),requestAnimationFrame(()=>Mt(!1))},150)},[F,Wt,qe,Ke,be,oe,t.grid.rows,t.grid.columns]);r.useEffect(()=>()=>{he.current&&clearTimeout(he.current)},[]);const qt=()=>e.jsx("button",{type:"button",className:"zf-btn zf-btn--icon",onClick:ws,"aria-label":"Customise",title:"Customise",children:e.jsx(Js,{size:18,"aria-hidden":"true"})}),Ve=F&&Ue?A.current.get(Ue):void 0,As=L==="flow-horizontal";return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:$s}),d&&!F?Qt.createPortal(qt(),d):null,e.jsxs("div",{className:F?"zf-editor zf-customise":"zf-editor","data-mode":L,style:{"--zf-accent-hue":O,"--zf-accent-sat":`${P}%`,"--zf-base-hue":G,"--zf-base-sat":`${D}%`,"--zf-up":_,"--zf-down":W,"--zf-font-family":as[se],"--zf-numeric":ss[ae],"--zf-frame-radius":`${q}px`,"--zf-border-alpha":K,"--zf-surface-opacity":V,"--zf-density":X,"--zf-elevation":Y},children:[(F||!d)&&e.jsxs("div",{className:"zf-editor-bar",children:[e.jsx("div",{className:"zf-editor-bar-spacer"}),F?e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"zf-btn zf-btn--ghost",onClick:Rs,title:"Reclaim empty grid space",children:"Tidy"}),e.jsx("button",{type:"button",className:"zf-btn zf-btn--ghost",onClick:Ss,children:"Cancel"}),e.jsx("button",{type:"button",className:"zf-btn zf-btn--primary",onClick:Cs,children:"Save"})]}):qt()]}),e.jsxs("div",{className:"zf-editor-main",children:[e.jsx("div",{className:"zf-editor-grid","data-switching":zs,children:e.jsx("div",{ref:N,className:"grid-stack"})}),e.jsx("aside",{className:"zf-rail","aria-hidden":!F,inert:!F,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":le==="frames",className:le==="frames"?"zf-rail-tab is-active":"zf-rail-tab",onClick:()=>$t("frames"),children:"Frames"}),e.jsx("button",{type:"button",role:"tab","aria-selected":le==="cosmetics",className:le==="cosmetics"?"zf-rail-tab is-active":"zf-rail-tab",onClick:()=>$t("cosmetics"),children:"Cosmetics"})]}),le==="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:rs.map(s=>e.jsxs("button",{type:"button",className:Lt===s.key?"zf-preset is-active":"zf-preset",title:s.description,"aria-pressed":Lt===s.key,onClick:()=>js(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:()=>xe(242),children:"Reset"})]}),e.jsx("input",{type:"range",className:"zf-hue-slider",min:0,max:360,value:O,"aria-label":"Accent hue",onChange:s=>xe(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:[P!==90&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>ze(90),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[P,"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:100,value:P,"aria-label":"Accent saturation",onChange:s=>ze(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(${G} ${D}% 32%)`,boxShadow:"none"}}),"Tint ",G,"°"]}),G!==233&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>je(233),children:"Reset"})]}),e.jsx("input",{type:"range",className:"zf-hue-slider",min:0,max:360,value:G,"aria-label":"Surface tint hue",onChange:s=>je(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:[D!==20&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Ne(20),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":"Surface tint strength",onChange:s=>Ne(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:_,"aria-label":"Gain (up) colour",onChange:s=>$e(s.target.value)}),"Up ",_]}),_.toLowerCase()!=="#3fd08f"&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>$e("#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:W,"aria-label":"Loss (down) colour",onChange:s=>He(s.target.value)}),"Down ",W]}),W.toLowerCase()!=="#ff6b81"&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>He("#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:B===s?"zf-seg-btn is-active":"zf-seg-btn","aria-pressed":B===s,onClick:()=>Et(s),children:s==="none"?"Glow":s==="color"?"Color":s==="gradient"?"Gradient":"Scene"},s))}),B==="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:Q,"aria-label":"Background colour",onChange:s=>_e(s.target.value)}),Q]}),Q.toLowerCase()!=="#0a0a12"&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>_e("#0a0a12"),children:"Reset"})]}),B==="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:ne,"aria-label":"Gradient start colour",onChange:s=>Ft(s.target.value)}),"From ",ne]})}),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:ie,"aria-label":"Gradient end colour",onChange:s=>It(s.target.value)}),"To ",ie]})}),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:[ee!==160&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>We(160),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[ee,"°"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:360,value:ee,"aria-label":"Gradient angle",onChange:s=>We(Number(s.target.value))})]}),B==="unicorn"&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"zf-presets",style:{marginTop:12},role:"group","aria-label":"Background scene",children:Xe.map(s=>e.jsxs("button",{type:"button",className:re===s.projectId?"zf-preset is-active":"zf-preset",title:s.description,"aria-pressed":re===s.projectId,onClick:()=>Tt(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:[J!==.16&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>De(.16),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Math.round(J*100),"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:.6,step:.02,value:J,"aria-label":"Background scene opacity",onChange:s=>De(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:L==="flow-vertical"?"zf-mode-seg-btn is-active":"zf-mode-seg-btn","aria-pressed":L==="flow-vertical",onClick:()=>Ut("flow-vertical"),children:"Vertical"}),e.jsx("button",{type:"button",className:L==="flow-horizontal"?"zf-mode-seg-btn is-active":"zf-mode-seg-btn","aria-pressed":L==="flow-horizontal",onClick:()=>Ut("flow-horizontal"),children:"Horizontal"}),e.jsx("button",{type:"button",className:"zf-mode-seg-btn",disabled:!0,title:"Infinite canvas — coming soon",children:"Canvas"})]}),As&&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:[U!==12&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Oe(12),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[U,"px"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:12,value:U,"aria-label":"Frame gap",onChange:s=>Oe(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:[q!==18&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>ve(18),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[q,"px"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:32,value:q,"aria-label":"Corner radius",onChange:s=>ve(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:[K!==.22&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>ke(.22),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Math.round(K*100),"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:1,step:.01,value:K,"aria-label":"Border strength",onChange:s=>ke(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:[V!==1&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>we(1),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Math.round(V*100),"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:.3,max:1,step:.05,value:V,"aria-label":"Card opacity",onChange:s=>we(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:[X!==1&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Se(1),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Math.round(X*100),"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:.6,max:1.4,step:.05,value:X,"aria-label":"Card density",onChange:s=>Se(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:[Y!==1&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Ce(1),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Y.toFixed(1),"×"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:0,max:2,step:.1,value:Y,"aria-label":"Card elevation",onChange:s=>Ce(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:se===s?"zf-seg-btn is-active":"zf-seg-btn","aria-pressed":se===s,style:{fontFamily:as[s]},onClick:()=>Pe(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:ae===s?"zf-seg-btn is-active":"zf-seg-btn","aria-pressed":ae===s,onClick:()=>Be(s),children:e.jsx("span",{style:{fontVariantNumeric:ss[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:[Z!==1&&e.jsx("button",{type:"button",className:"zf-theme-reset",onClick:()=>Ge(1),children:"Reset"}),e.jsxs("span",{className:"zf-theme-val",children:[Math.round(Z*100),"%"]})]})]}),e.jsx("input",{type:"range",className:"zf-range",min:.85,max:1.25,step:.05,value:Z,"aria-label":"Text size",onChange:s=>Ge(Math.round(Number(s.target.value)*100)/100)})]})]}),le==="frames"&&e.jsxs("section",{children:[e.jsx("h3",{className:"zf-rail-title",children:"Add a frame"}),e.jsx("p",{className:"zf-palette-hint",children:"Open a category, then click a frame to add it — or drag it onto the grid."}),e.jsx("div",{className:"zf-palette-cats",children:Re.map(s=>{const o=Pt.has(s.key);return e.jsxs("div",{className:o?"zf-palette-cat is-open":"zf-palette-cat",children:[e.jsxs("button",{type:"button",className:"zf-palette-cat-header","aria-expanded":o,onClick:()=>vs(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})]}),o&&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(i=>{var b,l,x,w,k,M;return e.jsxs("div",{className:"grid-stack-item zf-newwidget","data-frame":i.name,"gs-w":((b=i.layout)==null?void 0:b.w)??4,"gs-h":((l=i.layout)==null?void 0:l.h)??3,"gs-min-w":(x=i.layout)==null?void 0:x.minW,"gs-min-h":(w=i.layout)==null?void 0:w.minH,"gs-max-w":(k=i.layout)==null?void 0:k.maxW,"gs-max-h":(M=i.layout)==null?void 0:M.maxH,role:"button",tabIndex:0,title:`Drag onto the board, or click to add ${i.name.replace(/-/g," ")}`,onClick:()=>Dt(i.name),onKeyDown:S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),Dt(i.name))},children:[i.iconUrl&&e.jsx("img",{className:"zf-newwidget-icon",src:i.iconUrl,alt:"",loading:"lazy",draggable:!1}),e.jsxs("div",{className:"zf-newwidget-copy",children:[e.jsx("div",{className:"zf-newwidget-name",children:i.name.replace(/-/g," ")}),e.jsx("div",{className:"zf-newwidget-desc",children:i.description})]})]},i.name)})})]})]},s.key)})})]})]})})]})]}),Ve?Qt.createPortal(e.jsx(ua,{instance:Ve,registry:a,instancesRef:A,symbolUniverse:xs,accentHue:O,onApply:s=>te(s),onClose:()=>ue(null)},Ve.id),document.body):null]})}export{va as DashboardEditor};
@@ -1 +0,0 @@
1
- import{r as c,j as i}from"./react-qoZPGuNy.js";import{f as k,R as N,S as L,h as X}from"./index-DbboK5sz.js";import{h as Y}from"./format-CfAcS4D8.js";import{F as D}from"./ui-Bq3RQsdJ.js";import{c as q}from"./utils-DaT-yT0k.js";const B="4px",z=6,G=80,P=24;function K({data:u,className:_,CellComponent:R,getColorValue:g,gap:x=z,showLabels:l=!1,rowLabelWidth:p=G,columnLabelHeight:b=P}){const j=c.useRef(null),[,w]=c.useTransition(),[m,M]=c.useState({width:0,height:0});c.useEffect(()=>{const t=j.current;if(t){const e=new ResizeObserver(()=>{w(()=>{M({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,U=f(T),W=T>=0;return{cell:o,colorValue:T,intensity:U,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:B,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]),$=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:q("h-full w-full",_),ref:j,children:i.jsxs("div",{className:"relative overflow-hidden",style:{height:m.height,width:m.width},children:[O,$,A]})})}const J=K;N.schema;const H=1440*60*1e3,Q=10080*60*1e3;function Z({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:Y(u.rate*100)})})}function V({config:u}){const _=c.useMemo(()=>Date.now()-Q,[]),{history:R,isLoading:g}=L(u.symbols,_),x=c.useMemo(()=>{const l=[];for(const p of u.symbols){const b=R[p]??[],j=new Map;for(const w of b){const m=Math.floor(w.time/H)*H,M=j.get(m)??{sum:0,n:0};M.sum+=w.fundingRate,M.n+=1,j.set(m,M)}for(const[w,{sum:m,n:M}]of j){const v=m/M,C=new Date(w).toLocaleDateString("en-US",{month:"short",day:"numeric"});l.push({id:`${p}-${w}`,row:X(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(J,{data:x,CellComponent:Z,gap:3,showLabels:!0,rowLabelWidth:48,columnLabelHeight:20})}const rt=k({...N,component:V});export{rt as fundingHeatmapFrame};
@@ -1 +0,0 @@
1
- import{j as e}from"./react-qoZPGuNy.js";import{c as x,i as p,a as b}from"./format-CfAcS4D8.js";import{f,ab as d,ac as j}from"./index-DbboK5sz.js";import{F as c}from"./ui-Bq3RQsdJ.js";import{M as u}from"./mini-line-chart-D-i1QqSe.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:b(s.changePct)})]})]},s.symbol)})})]})}const B=f({...d,component:g});export{B as fxBoardFrame};