@alfadocs/ui-kit-debug 0.50.0 → 0.50.1

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 (38) hide show
  1. package/dist/_chunks/{bishop-score-2MzAz8NE.js → bishop-score-CMQxsdy4.js} +2 -2
  2. package/dist/_chunks/{bishop-score-2MzAz8NE.js.map → bishop-score-CMQxsdy4.js.map} +1 -1
  3. package/dist/_chunks/{bmi-calculator-DdylQzT6.js → bmi-calculator-DuUneHuZ.js} +2 -2
  4. package/dist/_chunks/{bmi-calculator-DdylQzT6.js.map → bmi-calculator-DuUneHuZ.js.map} +1 -1
  5. package/dist/_chunks/{cycle-calculator-oOkj5wlB.js → cycle-calculator-vTtZZAmn.js} +2 -2
  6. package/dist/_chunks/{cycle-calculator-oOkj5wlB.js.map → cycle-calculator-vTtZZAmn.js.map} +1 -1
  7. package/dist/_chunks/{due-date-calculator-DykajWzh.js → due-date-calculator-CUm5KJbf.js} +2 -2
  8. package/dist/_chunks/{due-date-calculator-DykajWzh.js.map → due-date-calculator-CUm5KJbf.js.map} +1 -1
  9. package/dist/_chunks/{fetal-weight-Da-B4P4k.js → fetal-weight-Xf8-ZoDy.js} +2 -2
  10. package/dist/_chunks/{fetal-weight-Da-B4P4k.js.map → fetal-weight-Xf8-ZoDy.js.map} +1 -1
  11. package/dist/_chunks/{gestational-age-calculator-Bc55hq6t.js → gestational-age-calculator-830KJql3.js} +2 -2
  12. package/dist/_chunks/{gestational-age-calculator-Bc55hq6t.js.map → gestational-age-calculator-830KJql3.js.map} +1 -1
  13. package/dist/_chunks/{hcg-doubling-DAnpbale.js → hcg-doubling-kVOpDfny.js} +2 -2
  14. package/dist/_chunks/{hcg-doubling-DAnpbale.js.map → hcg-doubling-kVOpDfny.js.map} +1 -1
  15. package/dist/_chunks/insert-result-njqBthzT.js +742 -0
  16. package/dist/_chunks/insert-result-njqBthzT.js.map +1 -0
  17. package/dist/_chunks/{pregnancy-dating-48Gfvod1.js → pregnancy-dating-DT_244bG.js} +2 -2
  18. package/dist/_chunks/{pregnancy-dating-48Gfvod1.js.map → pregnancy-dating-DT_244bG.js.map} +1 -1
  19. package/dist/_chunks/{pregnancy-weight-gain-CCGrvarh.js → pregnancy-weight-gain-BMRBeA8V.js} +2 -2
  20. package/dist/_chunks/{pregnancy-weight-gain-CCGrvarh.js.map → pregnancy-weight-gain-BMRBeA8V.js.map} +1 -1
  21. package/dist/_chunks/{unit-converter-jWp3Z85y.js → unit-converter-BQ6lEYvd.js} +2 -2
  22. package/dist/_chunks/{unit-converter-jWp3Z85y.js.map → unit-converter-BQ6lEYvd.js.map} +1 -1
  23. package/dist/agent-catalog.json +1 -1
  24. package/dist/components/_shared/insert-result.d.ts.map +1 -1
  25. package/dist/components/bishop-score/index.js +1 -1
  26. package/dist/components/bmi-calculator/index.js +1 -1
  27. package/dist/components/cycle-calculator/index.js +1 -1
  28. package/dist/components/due-date-calculator/index.js +1 -1
  29. package/dist/components/fetal-weight/index.js +1 -1
  30. package/dist/components/gestational-age-calculator/index.js +1 -1
  31. package/dist/components/hcg-doubling/index.js +1 -1
  32. package/dist/components/pregnancy-dating/index.js +1 -1
  33. package/dist/components/pregnancy-weight-gain/index.js +1 -1
  34. package/dist/components/unit-converter/index.js +1 -1
  35. package/dist/index.js +11 -11
  36. package/package.json +1 -1
  37. package/dist/_chunks/insert-result-DNdi_JYW.js +0 -683
  38. package/dist/_chunks/insert-result-DNdi_JYW.js.map +0 -1
@@ -1,683 +0,0 @@
1
- import { jsxs as G, jsx as g } from "react/jsx-runtime";
2
- import { forwardRef as it, useRef as Lt } from "react";
3
- import { useTranslation as Tt } from "react-i18next";
4
- import { c as Mt } from "./index-D2ZczOXr.js";
5
- import { B as It } from "./button-DD_0Xdmr.js";
6
- import { L as Ct } from "./layers-pzGcbLPj.js";
7
- import { I as Bt } from "./image-C6RM5hfF.js";
8
- import { c as Et } from "./createLucideIcon-CrFbzy84.js";
9
- /**
10
- * @license lucide-react v1.8.0 - ISC
11
- *
12
- * This source code is licensed under the ISC license.
13
- * See the LICENSE file in the root directory of this source tree.
14
- */
15
- const At = [
16
- ["path", { d: "M12 4v16", key: "1654pz" }],
17
- ["path", { d: "M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2", key: "e0r10z" }],
18
- ["path", { d: "M9 20h6", key: "s66wpe" }]
19
- ], _t = Et("type", At), St = 15, J = 40, Yt = [18.5, 25, 30];
20
- function bn() {
21
- return {
22
- bands: [
23
- { upTo: 18.5, colorToken: "--info" },
24
- { upTo: 25, colorToken: "--success" },
25
- { upTo: 30, colorToken: "--warning-readable" },
26
- { upTo: J, colorToken: "--destructive" }
27
- ],
28
- min: St,
29
- max: J,
30
- ticks: [...Yt]
31
- };
32
- }
33
- const P = 14, U = 12, Nt = U / 2, Q = 18, Gt = 12, Ht = 16;
34
- function S(t, n, i, a, r) {
35
- if (i <= n) return a;
36
- const s = (t - n) / (i - n);
37
- return a + s * (r - a);
38
- }
39
- function lt(t, { width: n, height: i }) {
40
- const a = P, r = n - P, s = Q + Gt, e = Q, c = s + U + Ht;
41
- let u = t.min;
42
- const d = t.bands.map((l) => {
43
- const L = Math.max(t.min, Math.min(u, t.max)), y = Math.max(t.min, Math.min(l.upTo, t.max));
44
- u = l.upTo;
45
- const b = S(L, t.min, t.max, a, r), T = S(y, t.min, t.max, a, r);
46
- return { x: b, w: Math.max(0, T - b), colorToken: l.colorToken };
47
- }), f = S(t.value, t.min, t.max, a, r), p = t.value < t.min ? "start" : t.value > t.max ? "end" : null, v = Math.min(r, Math.max(a, f)), h = (t.ticks ?? []).filter((l) => l >= t.min && l <= t.max).map((l) => ({
48
- x: S(l, t.min, t.max, a, r),
49
- value: l
50
- })), $ = t.categoryLabel ? t.rangeLabel ? `${t.categoryLabel} (${t.rangeLabel})` : t.categoryLabel : "";
51
- return {
52
- width: n,
53
- height: i,
54
- barStart: a,
55
- barEnd: r,
56
- barY: s,
57
- barH: U,
58
- barRadius: Nt,
59
- bands: d,
60
- marker: {
61
- x: v,
62
- clampedStart: a,
63
- clampedEnd: r,
64
- overflow: p
65
- },
66
- ticks: h,
67
- valueLabelY: e,
68
- tickLabelY: c,
69
- valueLabel: t.valueLabel,
70
- summaryLabel: $,
71
- ariaLabel: t.ariaLabel
72
- };
73
- }
74
- const o = (t) => Math.round(t * 100) / 100, B = (t) => t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
75
- function ct(t, n, i, a, r, s) {
76
- const e = t + i, c = n + a, u = s > 0 ? `A${s} ${s} 0 0 1 ${o(e)} ${o(n + s)}` : "", d = s > 0 ? `A${s} ${s} 0 0 1 ${o(e - s)} ${o(c)}` : "", f = r > 0 ? `A${r} ${r} 0 0 1 ${o(t)} ${o(c - r)}` : "", p = r > 0 ? `A${r} ${r} 0 0 1 ${o(t + r)} ${o(n)}` : "";
77
- return `M${o(t + r)} ${o(n)} H${o(e - s)} ${u} V${o(
78
- c - s
79
- )} ${d} H${o(t + r)} ${f} V${o(n + r)} ${p} Z`;
80
- }
81
- function Rt(t, n) {
82
- const { resolve: i, font: a, fg: r, muted: s, track: e } = n, c = B(a), u = `<rect x="${o(t.barStart)}" y="${o(
83
- t.barY
84
- )}" width="${o(t.barEnd - t.barStart)}" height="${t.barH}" rx="${t.barRadius}" fill="${e}"/>`, d = t.bands.length, f = t.bands.map((m, x) => {
85
- const I = i(m.colorToken), _ = x === 0 ? t.barRadius : 0, wt = x === d - 1 ? t.barRadius : 0;
86
- return `<path d="${ct(
87
- m.x,
88
- t.barY,
89
- m.w,
90
- t.barH,
91
- _,
92
- wt
93
- )}" fill="${I}"/>`;
94
- }).join(""), p = t.barY + t.barH, v = p + 4, h = t.ticks.map((m) => {
95
- const x = `<line x1="${o(m.x)}" y1="${o(p)}" x2="${o(
96
- m.x
97
- )}" y2="${o(v)}" stroke="${e}" stroke-width="1"/>`, I = `<text x="${o(
98
- m.x
99
- )}" y="${o(t.tickLabelY)}" text-anchor="middle" font-family="${c}" font-size="9" fill="${s}">${B(
100
- String(m.value)
101
- )}</text>`;
102
- return x + I;
103
- }).join(""), $ = o(t.marker.x), l = t.barY - 3, L = t.barY + t.barH + 3, y = `<line x1="${$}" y1="${o(l)}" x2="${$}" y2="${o(
104
- L
105
- )}" stroke="${r}" stroke-width="2" stroke-linecap="round"/>`, b = t.barY - 4, T = `<polygon points="${$},${o(t.barY + 1)} ${o(
106
- t.marker.x - 4
107
- )},${o(b)} ${o(t.marker.x + 4)},${o(b)}" fill="${r}"/>`;
108
- let M = "";
109
- if (t.marker.overflow) {
110
- const m = t.barY + t.barH / 2;
111
- if (t.marker.overflow === "start") {
112
- const x = t.barStart - 2;
113
- M = `<polyline points="${o(x + 5)},${o(m - 4)} ${o(
114
- x
115
- )},${o(m)} ${o(x + 5)},${o(
116
- m + 4
117
- )}" fill="none" stroke="${r}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>`;
118
- } else {
119
- const x = t.barEnd + 2;
120
- M = `<polyline points="${o(x - 5)},${o(m - 4)} ${o(
121
- x
122
- )},${o(m)} ${o(x - 5)},${o(
123
- m + 4
124
- )}" fill="none" stroke="${r}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>`;
125
- }
126
- }
127
- const C = `<text x="${o(
128
- t.barStart
129
- )}" y="${o(t.valueLabelY)}" font-family="${c}" font-size="13" font-weight="700" fill="${r}">${B(
130
- t.valueLabel
131
- )}</text>`, R = t.summaryLabel ? `<text x="${o(t.barEnd)}" y="${o(
132
- t.valueLabelY
133
- )}" text-anchor="end" font-family="${c}" font-size="10" fill="${s}">${B(
134
- t.summaryLabel
135
- )}</text>` : "", D = `<title>${B(t.ariaLabel)}</title>`;
136
- return `<g role="img" aria-label="${B(
137
- t.ariaLabel
138
- )}">${D}${u}${f}${h}${y}${T}${M}${C}${R}</g>`;
139
- }
140
- const Dt = 260, V = 64;
141
- function Ot(t) {
142
- return `var(${t})`;
143
- }
144
- const Pt = it(
145
- function({ model: n, width: i = Dt, height: a = V, className: r }, s) {
146
- const e = lt(n, { width: i, height: a }), c = e.barY + e.barH, u = c + 4, d = e.barY - 3, f = e.barY + e.barH + 3, p = e.barY - 4, v = e.bands.length, h = e.barY + e.barH / 2;
147
- return /* @__PURE__ */ G(
148
- "svg",
149
- {
150
- ref: s,
151
- "data-component": "banded-gauge",
152
- direction: "ltr",
153
- role: "img",
154
- "aria-label": e.ariaLabel,
155
- width: i,
156
- height: a,
157
- viewBox: `0 0 ${i} ${a}`,
158
- className: ["ds:[font-family:var(--font-sans)]", r].filter(Boolean).join(" "),
159
- children: [
160
- /* @__PURE__ */ g("title", { children: e.ariaLabel }),
161
- /* @__PURE__ */ g(
162
- "rect",
163
- {
164
- x: o(e.barStart),
165
- y: o(e.barY),
166
- width: o(e.barEnd - e.barStart),
167
- height: e.barH,
168
- rx: e.barRadius,
169
- className: "ds:fill-[color:var(--muted)]"
170
- }
171
- ),
172
- e.bands.map(($, l) => /* @__PURE__ */ g(
173
- "path",
174
- {
175
- d: ct(
176
- $.x,
177
- e.barY,
178
- $.w,
179
- e.barH,
180
- l === 0 ? e.barRadius : 0,
181
- l === v - 1 ? e.barRadius : 0
182
- ),
183
- fill: Ot($.colorToken)
184
- },
185
- `${$.colorToken}-${l}`
186
- )),
187
- e.ticks.map(($) => /* @__PURE__ */ G("g", { children: [
188
- /* @__PURE__ */ g(
189
- "line",
190
- {
191
- x1: o($.x),
192
- y1: o(c),
193
- x2: o($.x),
194
- y2: o(u),
195
- strokeWidth: 1,
196
- className: "ds:stroke-[color:var(--border)]"
197
- }
198
- ),
199
- /* @__PURE__ */ g(
200
- "text",
201
- {
202
- x: o($.x),
203
- y: o(e.tickLabelY),
204
- textAnchor: "middle",
205
- fontSize: 9,
206
- className: "ds:fill-[color:var(--muted-foreground)]",
207
- children: $.value
208
- }
209
- )
210
- ] }, $.value)),
211
- /* @__PURE__ */ g(
212
- "line",
213
- {
214
- x1: o(e.marker.x),
215
- y1: o(d),
216
- x2: o(e.marker.x),
217
- y2: o(f),
218
- strokeWidth: 2,
219
- strokeLinecap: "round",
220
- className: "ds:stroke-[color:var(--foreground)]"
221
- }
222
- ),
223
- /* @__PURE__ */ g(
224
- "polygon",
225
- {
226
- points: `${o(e.marker.x)},${o(e.barY + 1)} ${o(
227
- e.marker.x - 4
228
- )},${o(p)} ${o(e.marker.x + 4)},${o(p)}`,
229
- className: "ds:fill-[color:var(--foreground)]"
230
- }
231
- ),
232
- e.marker.overflow === "start" ? /* @__PURE__ */ g(
233
- "polyline",
234
- {
235
- points: `${o(e.barStart + 3)},${o(h - 4)} ${o(
236
- e.barStart - 2
237
- )},${o(h)} ${o(e.barStart + 3)},${o(h + 4)}`,
238
- fill: "none",
239
- strokeWidth: 2,
240
- strokeLinecap: "round",
241
- strokeLinejoin: "round",
242
- className: "ds:stroke-[color:var(--foreground)]"
243
- }
244
- ) : null,
245
- e.marker.overflow === "end" ? /* @__PURE__ */ g(
246
- "polyline",
247
- {
248
- points: `${o(e.barEnd - 3)},${o(h - 4)} ${o(
249
- e.barEnd + 2
250
- )},${o(h)} ${o(e.barEnd - 3)},${o(h + 4)}`,
251
- fill: "none",
252
- strokeWidth: 2,
253
- strokeLinecap: "round",
254
- strokeLinejoin: "round",
255
- className: "ds:stroke-[color:var(--foreground)]"
256
- }
257
- ) : null,
258
- /* @__PURE__ */ g(
259
- "text",
260
- {
261
- x: o(e.barStart),
262
- y: o(e.valueLabelY),
263
- fontSize: 13,
264
- fontWeight: 700,
265
- className: "ds:fill-[color:var(--foreground)]",
266
- children: e.valueLabel
267
- }
268
- ),
269
- e.summaryLabel ? /* @__PURE__ */ g(
270
- "text",
271
- {
272
- x: o(e.barEnd),
273
- y: o(e.valueLabelY),
274
- textAnchor: "end",
275
- fontSize: 10,
276
- className: "ds:fill-[color:var(--muted-foreground)]",
277
- children: e.summaryLabel
278
- }
279
- ) : null
280
- ]
281
- }
282
- );
283
- }
284
- );
285
- Pt.displayName = "BandedGauge";
286
- const Ut = 24, ut = 18, Y = 12, dt = {
287
- activity: '<path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"/>',
288
- scale: '<path d="M12 3v18"/><path d="m19 8 3 8a5 5 0 0 1-6 0zV7"/><path d="M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1"/><path d="m5 8 3 8a5 5 0 0 1-6 0zV7"/><path d="M7 21h10"/>',
289
- ruler: '<path d="M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z"/><path d="m14.5 12.5 2-2"/><path d="m11.5 9.5 2-2"/><path d="m8.5 6.5 2-2"/><path d="m17.5 15.5 2-2"/>',
290
- calendar: '<path d="M8 2v4"/><path d="M16 2v4"/><rect width="18" height="18" x="3" y="4" rx="2"/><path d="M3 10h18"/>',
291
- "calendar-heart": '<path d="M12.127 22H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v5.125"/><path d="M14.62 18.8A2.25 2.25 0 1 1 18 15.836a2.25 2.25 0 1 1 3.38 2.966l-2.626 2.856a.998.998 0 0 1-1.507 0z"/><path d="M16 2v4"/><path d="M3 10h18"/><path d="M8 2v4"/>',
292
- baby: '<path d="M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5"/><path d="M15 12h.01"/><path d="M19.38 6.813A9 9 0 0 1 20.8 10.2a2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1"/><path d="M9 12h.01"/>',
293
- heart: '<path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/>',
294
- droplets: '<path d="M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z"/><path d="M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97"/>',
295
- clock: '<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>',
296
- tag: '<path d="M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"/><circle cx="7.5" cy="7.5" r=".5" fill="currentColor"/>',
297
- "trending-up": '<path d="M16 7h6v6"/><path d="m22 7-8.5 8.5-5-5L2 17"/>',
298
- percent: '<line x1="19" x2="5" y1="5" y2="19"/><circle cx="6.5" cy="6.5" r="2.5"/><circle cx="17.5" cy="17.5" r="2.5"/>'
299
- };
300
- function ft(t) {
301
- return Object.prototype.hasOwnProperty.call(dt, t);
302
- }
303
- function tt(t, n, i, a, r) {
304
- if (!ft(t)) return "";
305
- const s = r / Ut;
306
- return `<g transform="translate(${i} ${a}) scale(${s})" fill="none" color="${n}" stroke="${n}" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">${dt[t]}</g>`;
307
- }
308
- function A(t) {
309
- return t.variant === "banded";
310
- }
311
- const Ft = ["fg", "muted", "accent", "border", "bg"], j = "--primary", K = 380, $t = (t) => t.trim().replace(/^--/, "");
312
- function zt(t) {
313
- return `ds:text-[color:var(${t})]`;
314
- }
315
- function ht(t) {
316
- return t.highlightToken ?? j;
317
- }
318
- function O(t) {
319
- const n = /* @__PURE__ */ new Set();
320
- if (t.highlight) {
321
- const a = t.highlightToken ?? j;
322
- n.add(a), n.add(`${a}-foreground`);
323
- }
324
- const i = ht(t);
325
- if (n.add(i), t.gauge)
326
- if (A(t.gauge))
327
- for (const a of t.gauge.bands) n.add(a.colorToken);
328
- else
329
- n.add(t.gauge.colorToken);
330
- return [...n];
331
- }
332
- function F(t, n = []) {
333
- const i = {
334
- fg: "currentColor",
335
- muted: "currentColor",
336
- accent: "currentColor",
337
- border: "currentColor",
338
- bg: "transparent",
339
- font: "sans-serif",
340
- tokens: {}
341
- };
342
- if (!t) return i;
343
- const a = (s) => {
344
- const e = t.querySelector(`[data-k="${s}"]`);
345
- return e && getComputedStyle(e).color || "currentColor";
346
- }, r = {};
347
- for (const s of n) {
348
- const e = t.querySelector(
349
- `[data-token="${$t(s)}"]`
350
- );
351
- if (e) {
352
- const c = getComputedStyle(e).color;
353
- c && (r[s] = c);
354
- }
355
- }
356
- return {
357
- fg: a("fg"),
358
- muted: a("muted"),
359
- accent: a("accent"),
360
- border: a("border"),
361
- bg: a("bg"),
362
- font: getComputedStyle(t).fontFamily || "sans-serif",
363
- tokens: r
364
- };
365
- }
366
- function H(t, n, i) {
367
- var a;
368
- return n ? ((a = t.tokens) == null ? void 0 : a[n]) ?? i : i;
369
- }
370
- const k = (t) => t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
371
- function pt(t) {
372
- const n = [t.title];
373
- t.highlight && n.push(t.highlight);
374
- for (const i of t.fields) n.push(`• ${i.label}: ${i.value}`);
375
- return n.join(`
376
- `);
377
- }
378
- function bt(t) {
379
- const n = t.fields.map((a) => `<li>${k(a.label)}: ${k(a.value)}</li>`).join(""), i = t.highlight ? `<p><strong>${k(t.highlight)}</strong></p>` : "";
380
- return `<p><strong>${k(t.title)}</strong></p>${i}<ul>${n}</ul>`;
381
- }
382
- const w = 20, E = w + 18, N = 22, Wt = 10, z = 22, nt = 16, et = 12, Xt = 12, mt = 34, W = 9, X = (mt + W) * 2, Vt = 16, at = ut, jt = 6;
383
- function q(t, n) {
384
- const i = n !== void 0 ? n : t.brand;
385
- return typeof i == "string" ? i : !1;
386
- }
387
- function Kt(t) {
388
- if (typeof t.fraction == "number")
389
- return Math.min(1, Math.max(0, t.fraction));
390
- const n = parseFloat(t.value);
391
- return Number.isFinite(n) && typeof t.max == "number" && t.max > 0 ? Math.min(1, Math.max(0, n / t.max)) : 1;
392
- }
393
- function gt(t, n) {
394
- const i = !!t.highlight, a = E + Wt, r = (i ? a + N + nt : E + nt) + z - 6, s = r + Math.max(0, t.fields.length - 1) * z, e = t.gauge && A(t.gauge), d = t.gauge && !A(t.gauge) ? (i ? a : E) + X : 0, f = e ? s + Vt : null, p = f !== null ? f + V : 0, v = Math.max(s, d, p), h = n ? v + et + Xt - 4 : v, $ = Math.round(h + (n ? et : w));
395
- return {
396
- hasChip: i,
397
- chipY: a,
398
- firstFieldY: r,
399
- fieldsEndY: s,
400
- bandedGaugeY: f,
401
- footerY: h,
402
- height: $
403
- };
404
- }
405
- function xt(t, n) {
406
- return gt(t, n !== !1).height;
407
- }
408
- function qt(t, n, i, a, r) {
409
- const s = mt, e = 2 * Math.PI * s, c = Kt(t), u = H(n, t.colorToken, n.accent), d = typeof t.segments == "number" && t.segments > 1 ? t.segments : 0, f = d ? 3 : 0, p = d ? e / d - f : e, v = d ? `${p} ${f}` : "", h = `${e * c} ${e}`, $ = `transform="rotate(-90 ${a} ${r})"`, l = k(
410
- t.label ? `${t.value} — ${t.label}` : t.value
411
- ), L = `<circle cx="${a}" cy="${r}" r="${s}" fill="none" stroke="${n.border}" stroke-width="${W}"${v ? ` stroke-dasharray="${v}"` : ""} ${$}/>`, y = `<circle cx="${a}" cy="${r}" r="${s}" fill="none" stroke="${u}" stroke-width="${W}" stroke-linecap="round" stroke-dasharray="${h}" ${$}/>`, b = `<text x="${a}" y="${r + 1}" text-anchor="middle" dominant-baseline="middle" font-family="${i}" font-size="16" font-weight="700" fill="${n.fg}">${k(
412
- t.value
413
- )}</text>`, T = t.label ? `<text x="${a}" y="${r + 15}" text-anchor="middle" dominant-baseline="middle" font-family="${i}" font-size="9" fill="${n.muted}">${k(
414
- t.label
415
- )}</text>` : "";
416
- return `<g role="img" aria-label="${l}"><title>${l}</title>${L}${y}${b}${T}</g>`;
417
- }
418
- function Zt(t, n, i, a) {
419
- const r = w - P, s = i - 2 * r, e = lt(
420
- {
421
- value: t.value,
422
- bands: t.bands,
423
- min: t.min,
424
- max: t.max,
425
- valueLabel: t.valueLabel,
426
- categoryLabel: t.categoryLabel,
427
- rangeLabel: t.rangeLabel,
428
- ariaLabel: t.ariaLabel,
429
- ticks: t.ticks
430
- },
431
- { width: s, height: V }
432
- ), c = Rt(e, {
433
- resolve: (u) => H(n, u, n.accent),
434
- // Raw theme font — buildBandedGaugeSvgString escapes it once. Passing the
435
- // card's already-escaped `font` here would double-escape and break it.
436
- font: n.font,
437
- fg: n.fg,
438
- muted: n.muted,
439
- track: n.border
440
- });
441
- return `<g transform="translate(${r} ${a})">${c}</g>`;
442
- }
443
- function ot(t) {
444
- const n = t.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)/i);
445
- return n ? [Number(n[1]), Number(n[2]), Number(n[3])] : null;
446
- }
447
- function rt([t, n, i]) {
448
- const a = (r) => {
449
- const s = r / 255;
450
- return s <= 0.03928 ? s / 12.92 : ((s + 0.055) / 1.055) ** 2.4;
451
- };
452
- return 0.2126 * a(t) + 0.7152 * a(n) + 0.0722 * a(i);
453
- }
454
- function Jt(t, n) {
455
- const i = ot(t), a = ot(n);
456
- if (!i || !a) return 0;
457
- const r = rt(i), s = rt(a);
458
- return (Math.max(r, s) + 0.05) / (Math.min(r, s) + 0.05);
459
- }
460
- function Qt(t, n, i, a) {
461
- const r = t.highlight, s = t.highlightToken ?? j, e = H(n, s, n.accent), c = Jt(n.bg, e) >= 3 ? n.bg : n.fg, u = Math.round(r.length * 7.2 + 28), d = w + u / 2, f = a + N / 2 + 1;
462
- return `<rect x="${w}" y="${a}" width="${u}" height="${N}" rx="${N / 2}" fill="${e}"/><text x="${d}" y="${f}" text-anchor="middle" dominant-baseline="middle" font-family="${i}" font-size="12" font-weight="600" fill="${c}">${k(
463
- r
464
- )}</text>`;
465
- }
466
- function Z(t, n, i = !1) {
467
- const a = K, r = gt(t, i !== !1), s = r.height, e = k(n.font), c = ht(t), u = H(n, c, n.accent), d = t.icon ? tt(
468
- t.icon,
469
- u,
470
- a - w - at,
471
- E - at + 2,
472
- ut
473
- ) : "", f = w + Y + jt, p = t.fields.map((b, T) => {
474
- const M = r.firstFieldY + T * z, C = T === 0, R = C ? 14 : 13, D = C ? 700 : 500, m = C ? u : n.fg, x = M - 4;
475
- let I;
476
- if (b.icon && ft(b.icon)) {
477
- const _ = u;
478
- I = tt(
479
- b.icon,
480
- _,
481
- w,
482
- x - Y / 2,
483
- Y
484
- );
485
- } else
486
- I = `<circle cx="${w + Y / 2}" cy="${x}" r="2" fill="${n.muted}"/>`;
487
- return `${I}<text x="${f}" y="${M}" font-family="${e}" font-size="13"><tspan fill="${n.muted}">${k(
488
- b.label
489
- )}: </tspan><tspan font-size="${R}" font-weight="${D}" fill="${m}">${k(
490
- b.value
491
- )}</tspan></text>`;
492
- }).join(""), v = r.hasChip ? Qt(t, n, e, r.chipY) : "";
493
- let h = "";
494
- t.gauge && (A(t.gauge) && r.bandedGaugeY !== null ? h = Zt(t.gauge, n, a, r.bandedGaugeY) : A(t.gauge) || (h = qt(
495
- t.gauge,
496
- n,
497
- e,
498
- a - w - X / 2,
499
- (r.hasChip ? r.chipY : E) + X / 2
500
- )));
501
- const $ = i !== !1 ? `<text x="${w}" y="${r.footerY}" font-family="${e}" font-size="10" font-weight="500" fill="${n.muted}">${k(
502
- i
503
- )}</text>` : "", l = `<text x="${w}" y="${E}" font-family="${e}" font-size="16" font-weight="700" fill="${n.fg}">${k(
504
- t.title
505
- )}</text>`, L = `<rect x="0.5" y="0.5" width="${a - 1}" height="${s - 1}" rx="12" fill="${n.bg}"/>`, y = `<rect x="0.5" y="0.5" width="${a - 1}" height="${s - 1}" rx="12" fill="none" stroke="${n.border}"/>`;
506
- return `<svg xmlns="http://www.w3.org/2000/svg" width="${a}" height="${s}" viewBox="0 0 ${a} ${s}" role="img" aria-label="${k(
507
- t.title
508
- )}">${L}${l}${d}${v}${h}${p}${$}${y}</svg>`;
509
- }
510
- function tn() {
511
- var t;
512
- return typeof navigator < "u" && typeof ((t = navigator.clipboard) == null ? void 0 : t.write) == "function" && typeof ClipboardItem < "u";
513
- }
514
- function vt(t, n, i) {
515
- return new Promise((a, r) => {
516
- const s = new Image();
517
- s.decoding = "async", s.onload = () => {
518
- const e = document.createElement("canvas");
519
- e.width = n, e.height = i;
520
- const c = e.getContext("2d");
521
- if (!c) {
522
- r(new Error("2D canvas context unavailable"));
523
- return;
524
- }
525
- c.drawImage(s, 0, 0, n, i), e.toBlob((u) => {
526
- u ? a(u) : r(new Error("canvas.toBlob produced no PNG"));
527
- }, "image/png");
528
- }, s.onerror = () => r(new Error("SVG failed to decode as an image")), s.src = t;
529
- });
530
- }
531
- function kt() {
532
- const t = typeof window < "u" && typeof window.devicePixelRatio == "number" ? window.devicePixelRatio : 1;
533
- return Math.max(2, t);
534
- }
535
- async function mn(t, n = {}) {
536
- return (await yt(t, n)).dataUri;
537
- }
538
- async function yt(t, n = {}) {
539
- const { colours: i, scale: a = kt() } = n, r = i ?? F(null), s = q(t, n.brand), e = Z(t, r, s), c = `data:image/svg+xml,${encodeURIComponent(e)}`, u = K, d = xt(t, s), f = await vt(
540
- c,
541
- Math.round(u * a),
542
- Math.round(d * a)
543
- );
544
- return { dataUri: await nn(f), width: u, height: d };
545
- }
546
- function nn(t) {
547
- return new Promise((n, i) => {
548
- const a = new FileReader();
549
- a.onload = () => n(String(a.result)), a.onerror = () => i(a.error ?? new Error("FileReader error")), a.readAsDataURL(t);
550
- });
551
- }
552
- async function en(t, n, i) {
553
- const a = pt(n), r = new Blob([a], { type: "text/plain" });
554
- if (t === "text")
555
- return new ClipboardItem({ "text/plain": r });
556
- const s = q(n, void 0), e = Z(n, i, s), c = `data:image/svg+xml,${encodeURIComponent(e)}`, u = kt(), d = await vt(
557
- c,
558
- Math.round(K * u),
559
- Math.round(xt(n, s) * u)
560
- );
561
- if (t === "image")
562
- return new ClipboardItem({ "image/png": d, "text/plain": r });
563
- const f = new Blob([bt(n)], { type: "text/html" });
564
- return new ClipboardItem({
565
- "text/html": f,
566
- "image/png": d,
567
- "text/plain": r
568
- });
569
- }
570
- const an = Mt(
571
- "ds:inline-flex ds:items-center ds:gap-[var(--spacing-xs)]",
572
- {
573
- variants: {
574
- variant: {
575
- insert: "",
576
- copy: ""
577
- }
578
- },
579
- defaultVariants: { variant: "insert" }
580
- }
581
- ), on = ["text", "image", "text-image"], rn = {
582
- text: /* @__PURE__ */ g(_t, { "aria-hidden": !0 }),
583
- image: /* @__PURE__ */ g(Bt, { "aria-hidden": !0 }),
584
- "text-image": /* @__PURE__ */ g(Ct, { "aria-hidden": !0 })
585
- }, st = {
586
- insert: {
587
- text: "insert.text",
588
- image: "insert.image",
589
- "text-image": "insert.textImage"
590
- },
591
- copy: {
592
- text: "insert.copyText",
593
- image: "insert.copyImage",
594
- "text-image": "insert.copyTextImage"
595
- }
596
- }, sn = it(
597
- function({
598
- card: n,
599
- variant: i = "insert",
600
- onInsert: a,
601
- onCopy: r,
602
- onError: s,
603
- size: e = "sm",
604
- intent: c = "primary"
605
- }, u) {
606
- const { t: d } = Tt(), f = Lt(null), p = (l) => {
607
- const L = pt(n), y = bt(n);
608
- let b = "", T = "";
609
- const M = l === "text" ? null : F(f.current, O(n));
610
- return M && (b = Z(n, M, q(n, void 0)), T = `data:image/svg+xml,${encodeURIComponent(b)}`), { mode: l, text: L, html: y, svg: b, imageDataUri: T, pngDataUri: () => M ? yt(n, { colours: M }) : Promise.resolve({ dataUri: "", width: 0, height: 0 }) };
611
- }, $ = i === "copy" ? (l) => {
612
- if (!tn()) {
613
- s == null || s(new Error("Clipboard write unavailable in this context"));
614
- return;
615
- }
616
- const L = F(
617
- f.current,
618
- O(n)
619
- );
620
- (async () => {
621
- try {
622
- const y = await en(l, n, L);
623
- await navigator.clipboard.write([y]), r == null || r(l);
624
- } catch (y) {
625
- s == null || s(y);
626
- }
627
- })();
628
- } : (l) => {
629
- a == null || a(p(l));
630
- };
631
- return /* @__PURE__ */ G(
632
- "div",
633
- {
634
- ref: u,
635
- "data-component": "insert-result",
636
- "data-variant": i,
637
- className: an({ variant: i }),
638
- children: [
639
- /* @__PURE__ */ G("span", { ref: f, "aria-hidden": !0, className: "ds:sr-only", children: [
640
- Ft.map((l) => /* @__PURE__ */ g(
641
- "span",
642
- {
643
- "data-k": l,
644
- className: l === "fg" ? "ds:text-foreground" : l === "muted" ? "ds:text-muted-foreground" : l === "accent" ? "ds:text-[color:var(--primary)]" : l === "border" ? "ds:text-[color:var(--border)]" : "ds:text-[color:var(--card)]"
645
- },
646
- l
647
- )),
648
- O(n).map((l) => /* @__PURE__ */ g(
649
- "span",
650
- {
651
- "data-token": $t(l),
652
- className: zt(l)
653
- },
654
- l
655
- ))
656
- ] }),
657
- on.map((l) => /* @__PURE__ */ g(
658
- It,
659
- {
660
- type: "button",
661
- intent: c,
662
- size: e,
663
- startIcon: rn[l],
664
- "aria-label": d(st[i][l]),
665
- onClick: () => $(l),
666
- children: d(st[i][l])
667
- },
668
- l
669
- ))
670
- ]
671
- }
672
- );
673
- }
674
- );
675
- sn.displayName = "InsertButton";
676
- export {
677
- Pt as B,
678
- sn as I,
679
- mn as a,
680
- bn as b,
681
- yt as s
682
- };
683
- //# sourceMappingURL=insert-result-DNdi_JYW.js.map