react-semaphor 0.1.524 → 0.1.526

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 (82) hide show
  1. package/dist/brand-studio/index.js +37 -37
  2. package/dist/briefings/index.js +38 -33
  3. package/dist/chunks/{calculated-field-identity-Dy_WpDdo.js → calculated-field-identity-D1ofR4KJ.js} +28 -28
  4. package/dist/chunks/{card-config-utils-CAyjC5Tp.js → card-config-utils-9sv4e-Vb.js} +15 -15
  5. package/dist/chunks/{switch-CWPcwAZ4.js → code-highlight-994tgM9v.js} +6309 -8642
  6. package/dist/chunks/dashboard-CsHvEtjN.js +15 -0
  7. package/dist/chunks/{dashboard-briefing-launcher-CTEyh3FQ.js → dashboard-briefing-launcher-DXz1GhFZ.js} +364 -370
  8. package/dist/chunks/{dashboard-controls-C3KbYzz-.js → dashboard-controls-Df8qOSrs.js} +163 -168
  9. package/dist/chunks/dashboard-json-Xldp0qww.js +65 -0
  10. package/dist/chunks/{edit-dashboard-visual-DqRmfRqN.js → edit-dashboard-visual-COHBqyic.js} +2836 -2829
  11. package/dist/chunks/editor-action-buttons-DahlP57T.js +2071 -0
  12. package/dist/chunks/{index-D9HDUSye.js → index-CbjuruKe.js} +1187 -1018
  13. package/dist/chunks/{matrix-control-sources-B1K7x0SL.js → matrix-control-sources-2VAzGlt8.js} +29 -29
  14. package/dist/chunks/pre-block-Cq1RqhZX.js +3987 -0
  15. package/dist/chunks/report-preferences-dialog-BcH-0lR-.js +1232 -0
  16. package/dist/chunks/search-CJz-QQ0Q.js +24 -0
  17. package/dist/chunks/{selection-reducer-CvCBQbl2.js → selection-reducer-NF5C07yM.js} +25 -46
  18. package/dist/chunks/{index-D7GVxl4a.js → semaphor-ready-indicator-BLRDuLr4.js} +55200 -59783
  19. package/dist/chunks/slider-BYIH4icg.js +877 -0
  20. package/dist/chunks/switch-XaAACBrJ.js +2234 -0
  21. package/dist/dashboard/index.js +1 -1
  22. package/dist/dashboard-authoring/index.js +4 -4
  23. package/dist/data-app-builder/index.js +67 -67
  24. package/dist/data-app-sdk/index.js +33 -32
  25. package/dist/index.js +435 -243
  26. package/dist/style.css +1 -1
  27. package/dist/surfboard/index.js +4 -5
  28. package/dist/types/briefings/index.d.ts +1 -1
  29. package/dist/types/briefings/schedule.d.ts +49 -2
  30. package/dist/types/components/briefings/briefing-author/form-primitives.d.ts +1 -1
  31. package/dist/types/components/briefings/briefing-author/schedule-model.d.ts +12 -2
  32. package/dist/types/components/dashboard/dashboard-container.d.ts +1 -1
  33. package/dist/types/components/dashboard/sheet/layout-change-guard.d.ts +1 -1
  34. package/dist/types/components/dashboard/sheet/sheet-layout.d.ts +1 -1
  35. package/dist/types/components/editor/editor-main/text-card.d.ts +1 -1
  36. package/dist/types/components/editor/editor.d.ts +1 -1
  37. package/dist/types/components/providers/semaphor-context-provider.d.ts +1 -1
  38. package/dist/types/components/providers/theme-provider-context.d.ts +1 -1
  39. package/dist/types/components/providers/theme-provider.d.ts +1 -1
  40. package/dist/types/components/shared/unsaved-changes/use-pristine-snapshot-initializer.d.ts +1 -1
  41. package/dist/types/components/sharing-and-management/hooks/use-groups.d.ts +5 -1
  42. package/dist/types/components/sharing-and-management/hooks/use-unified-users.d.ts +9 -1
  43. package/dist/types/components/sharing-and-management/resource-share-dialog/index.d.ts +1 -1
  44. package/dist/types/components/sharing-and-management/resource-share-dialog/unified/adapter.d.ts +21 -1
  45. package/dist/types/components/sharing-and-management/resource-share-dialog/unified/configs.d.ts +12 -0
  46. package/dist/types/components/sharing-and-management/resource-share-dialog/unified/invite-combobox.d.ts +5 -0
  47. package/dist/types/components/sharing-and-management/resource-share-dialog/unified/share-shape.d.ts +7 -0
  48. package/dist/types/components/sharing-and-management/resource-share-dialog/unified/types.d.ts +2 -0
  49. package/dist/types/components/sharing-and-management/utils/shares-types.d.ts +8 -0
  50. package/dist/types/components/sharing-and-management/utils/types.d.ts +2 -0
  51. package/dist/types/components/surfboard/dashboard-plus.d.ts +1 -1
  52. package/dist/types/components/ui/resizable.d.ts +1 -1
  53. package/dist/types/components/visual/column-display-utils.d.ts +1 -1
  54. package/dist/types/components/visual/kpi-visual/kpi-utils.d.ts +1 -1
  55. package/dist/types/components/visual/settings/color-format.d.ts +1 -1
  56. package/dist/types/components/visual/visual-utils.d.ts +1 -1
  57. package/dist/types/lib/actions/data-point-click-action.d.ts +2 -1
  58. package/dist/types/lib/charts/area-chart.d.ts +1 -1
  59. package/dist/types/lib/charts/bar-chart.d.ts +1 -1
  60. package/dist/types/lib/charts/cartesian-data.d.ts +72 -0
  61. package/dist/types/lib/charts/cartesian-fields.d.ts +60 -0
  62. package/dist/types/lib/charts/chart-utils.d.ts +3 -0
  63. package/dist/types/lib/charts/combo-chart.d.ts +1 -1
  64. package/dist/types/lib/charts/create-chart.d.ts +1 -1
  65. package/dist/types/lib/charts/line-chart.d.ts +1 -1
  66. package/dist/types/lib/charts/shared/category-group-axis-plugin.d.ts +23 -0
  67. package/dist/types/lib/charts/stacked-line-chart.d.ts +2 -0
  68. package/dist/types/lib/charts/types.d.ts +1 -7
  69. package/dist/types/lib/dashboard/normalize-dashboard-for-dirty-check.d.ts +1 -1
  70. package/dist/types/lib/formatters/cartesian-temporal-presentation.d.ts +6 -1
  71. package/dist/types/lib/hooks/explorer/use-schemas.d.ts +1 -1
  72. package/dist/types/lib/hooks/use-dashboard.d.ts +2 -2
  73. package/dist/types/lib/interactions/get-click-context-from-chartjs.d.ts +1 -2
  74. package/dist/types/lib/stores/editor-store.d.ts +1 -2
  75. package/dist/types/lib/stores/table-actions.d.ts +2 -1
  76. package/dist/types/lib/types/token-types.d.ts +0 -12
  77. package/dist/types/lib/utils.d.ts +0 -2
  78. package/package.json +2 -1
  79. package/dist/chunks/dashboard-json-Kc_M7nLP.js +0 -75
  80. package/dist/chunks/editor-action-buttons-s-ByVR9x.js +0 -2019
  81. package/dist/chunks/report-preferences-dialog-RAp0DAuw.js +0 -723
  82. package/dist/types/lib/encrypt-utils.d.ts +0 -9
@@ -0,0 +1,877 @@
1
+ import { jsxs as B, jsx as p, Fragment as fe } from "react/jsx-runtime";
2
+ import * as C from "react";
3
+ import Ue, { useState as pe, useRef as F, useCallback as W, useEffect as Q, forwardRef as ge, useMemo as T, memo as Qe, Suspense as Ye } from "react";
4
+ import { au as Ge, av as oe, aw as $e, ax as je, ay as We, az as Xe, aA as Je, aB as Ze, aC as et, aD as tt, aE as nt, aF as rt, aG as ot, aH as st, aI as at } from "./semaphor-ready-indicator-BLRDuLr4.js";
5
+ import { I as he, J as z, K as k, c as Se, M as it, G as A, H as ve, B as lt, N as ct, O as ut, u as Z, Q as dt, T as ft, U as H, V as mt, W as ye, X as pt, Y as gt } from "./code-highlight-994tgM9v.js";
6
+ import "./x-CXDkqdur.js";
7
+ import "./validators-CsdOtZI6.js";
8
+ import "./matrix-operation-contract-D32U2CSw.js";
9
+ import "../value-format-preferences/index.js";
10
+ import { C as be } from "./switch-XaAACBrJ.js";
11
+ import { u as Ce } from "./pre-block-Cq1RqhZX.js";
12
+ import { u as Ee, r as we, f as Re } from "./editor-action-buttons-DahlP57T.js";
13
+ import { M as ht } from "./selection-reducer-NF5C07yM.js";
14
+ import "./card-config-utils-9sv4e-Vb.js";
15
+ import { P as St, r as vt, g as yt, a as me, b as ee, n as bt, c as Ct } from "./index-CbjuruKe.js";
16
+ import { u as Et } from "./appearance-context-DEYtWinQ.js";
17
+ const fn = Ue.memo(function({
18
+ context: t = "editor"
19
+ } = {}) {
20
+ return /* @__PURE__ */ B(
21
+ "div",
22
+ {
23
+ "data-content": "fields-section",
24
+ className: "flex h-full grow flex-col items-center overflow-hidden",
25
+ children: [
26
+ " ",
27
+ /* @__PURE__ */ p(Ge, { context: t }),
28
+ " "
29
+ ]
30
+ }
31
+ );
32
+ });
33
+ var xe = "Toggle", Pe = C.forwardRef((e, t) => {
34
+ const { pressed: o, defaultPressed: r, onPressedChange: s, ...l } = e, [n, a] = he({
35
+ prop: o,
36
+ onChange: s,
37
+ defaultProp: r ?? !1,
38
+ caller: xe
39
+ });
40
+ return /* @__PURE__ */ p(
41
+ z.button,
42
+ {
43
+ type: "button",
44
+ "aria-pressed": n,
45
+ "data-state": n ? "on" : "off",
46
+ "data-disabled": e.disabled ? "" : void 0,
47
+ ...l,
48
+ ref: t,
49
+ onClick: k(e.onClick, () => {
50
+ e.disabled || a(!n);
51
+ })
52
+ }
53
+ );
54
+ });
55
+ Pe.displayName = xe;
56
+ var De = Pe;
57
+ const wt = it(
58
+ "inline-flex items-center justify-center rounded-control text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",
59
+ {
60
+ variants: {
61
+ variant: {
62
+ default: "bg-transparent",
63
+ outline: "border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"
64
+ },
65
+ size: {
66
+ default: "h-10 px-3",
67
+ sm: "h-9 px-2.5",
68
+ lg: "h-11 px-5"
69
+ }
70
+ },
71
+ defaultVariants: {
72
+ variant: "default",
73
+ size: "default"
74
+ }
75
+ }
76
+ ), Rt = C.forwardRef(({ className: e, variant: t, size: o, ...r }, s) => /* @__PURE__ */ p(
77
+ De,
78
+ {
79
+ ref: s,
80
+ className: Se(wt({ variant: t, size: o, className: e })),
81
+ ...r
82
+ }
83
+ ));
84
+ Rt.displayName = De.displayName;
85
+ function Te({
86
+ storeValue: e,
87
+ defaultValue: t = "",
88
+ onStoreUpdate: o,
89
+ delay: r = 300
90
+ }) {
91
+ const [s, l] = pe(e ?? t), n = F(null), a = F(s), u = F(e), g = F(!1), S = W(() => {
92
+ n.current && (clearTimeout(n.current), n.current = null), g.current && a.current !== (u.current ?? t) && (o(a.current), u.current = a.current);
93
+ }, [t, o]);
94
+ Q(() => {
95
+ if (e !== u.current) {
96
+ n.current && (clearTimeout(n.current), n.current = null);
97
+ const c = e ?? t;
98
+ l(c), a.current = c, u.current = e, g.current = !1;
99
+ }
100
+ }, [e, t]), Q(() => {
101
+ if (g.current)
102
+ return n.current = setTimeout(() => {
103
+ S();
104
+ }, r), () => {
105
+ n.current && (clearTimeout(n.current), n.current = null);
106
+ };
107
+ }, [r, S, s]), Q(() => () => {
108
+ n.current && clearTimeout(n.current);
109
+ }, []);
110
+ const i = W(
111
+ (c) => {
112
+ const b = c ?? t;
113
+ g.current = !0, a.current = b, l(b);
114
+ },
115
+ [t]
116
+ );
117
+ return { value: s, onChange: i, flush: S };
118
+ }
119
+ const xt = 300;
120
+ function Pt({ onExpand: e }, t) {
121
+ const o = A((f) => f.card.sql), r = A((f) => f.sqlGen), s = A((f) => f.card), l = Ee(), { setCardSql: n, setSqlGen: a, setRunSql: u } = ve(), g = T(() => l !== s.type ? { ...s, type: l } : s, [s, l]), { queryKey: S } = oe(g), i = Ce(), c = F(S);
122
+ c.current = S;
123
+ const b = F(r);
124
+ b.current = r;
125
+ const E = W(
126
+ (f) => {
127
+ n(f);
128
+ },
129
+ [n]
130
+ ), {
131
+ value: d,
132
+ onChange: h,
133
+ flush: v
134
+ } = Te({
135
+ storeValue: o,
136
+ defaultValue: "",
137
+ onStoreUpdate: E,
138
+ delay: xt
139
+ });
140
+ Q(() => we(v), [v]);
141
+ function P(f) {
142
+ h(f), ct(b.current) || a({});
143
+ }
144
+ return /* @__PURE__ */ B("div", { className: "relative h-full w-full", children: [
145
+ /* @__PURE__ */ p(
146
+ be,
147
+ {
148
+ ref: t,
149
+ value: d ?? "",
150
+ onValueChange: P,
151
+ language: "sql-jinja",
152
+ embedded: !0,
153
+ hideLineNumbers: !0,
154
+ wrapLines: !0,
155
+ placeholder: "Write your SQL here",
156
+ onKeyDown: (f) => {
157
+ f.key === "Enter" && f.shiftKey && (f.preventDefault(), Re(), setTimeout(() => {
158
+ i.removeQueries({
159
+ queryKey: c.current,
160
+ exact: !0
161
+ }), u(!0);
162
+ }, 0));
163
+ }
164
+ }
165
+ ),
166
+ e ? /* @__PURE__ */ p(
167
+ lt,
168
+ {
169
+ type: "button",
170
+ variant: "ghost",
171
+ size: "icon",
172
+ className: "absolute right-2.5 top-2 z-20 h-7 w-7 bg-background/80 p-0 text-muted-foreground backdrop-blur-sm transition-colors hover:bg-accent hover:text-foreground focus-visible:text-foreground",
173
+ onClick: e,
174
+ "aria-label": "Expand SQL editor",
175
+ title: "Expand SQL editor",
176
+ children: /* @__PURE__ */ p(ht, { className: "h-3.5 w-3.5", strokeWidth: 1.75 })
177
+ }
178
+ ) : null
179
+ ] });
180
+ }
181
+ const mn = ge(Pt), Dt = 300;
182
+ function Tt(e, t) {
183
+ const o = A((E) => E.card.python), r = A((E) => E.card), s = Ee(), { setCardPython: l, setRunSql: n } = ve(), a = T(() => s !== r.type ? { ...r, type: s } : r, [r, s]), { queryKey: u } = oe(a), g = Ce(), S = F(u);
184
+ S.current = u;
185
+ const { value: i, onChange: c, flush: b } = Te({
186
+ storeValue: o,
187
+ defaultValue: St,
188
+ onStoreUpdate: l,
189
+ delay: Dt
190
+ });
191
+ return Q(() => we(b), [b]), /* @__PURE__ */ p(
192
+ be,
193
+ {
194
+ ref: t,
195
+ value: i ?? "",
196
+ onValueChange: c,
197
+ language: "python",
198
+ embedded: !0,
199
+ hideLineNumbers: !0,
200
+ wrapLines: !0,
201
+ className: "[&_.code-editor-pre]:!pt-2 [&_.code-editor-textarea]:!pt-2",
202
+ onKeyDown: (E) => {
203
+ E.key === "Enter" && E.shiftKey && (E.preventDefault(), Re(), setTimeout(() => {
204
+ g.removeQueries({
205
+ queryKey: S.current,
206
+ exact: !0
207
+ }), n(!0);
208
+ }, 0));
209
+ }
210
+ }
211
+ );
212
+ }
213
+ const pn = ge(Tt), It = /* @__PURE__ */ new Set([
214
+ "askForMoreInfo",
215
+ "getAvailableChartTypes",
216
+ "getChartSQLSyntax",
217
+ "getDomainRelationships",
218
+ "getTableColumns",
219
+ "getUserSql",
220
+ "validateCardConfigFormat"
221
+ ]), gn = /* @__PURE__ */ new Set([
222
+ "createChartFromSql",
223
+ "createForecast",
224
+ "generateQueryConfig",
225
+ "getChartDataFromCardConfig",
226
+ "getChartDataFromSqlAndPython",
227
+ "getForecastDataFromSqlAndPython"
228
+ ]), hn = Array.from(
229
+ It
230
+ ).join(", "), Sn = 3, vn = "Self-heal", yn = /* @__PURE__ */ new Set([
231
+ "SQL_PARSE_ERROR",
232
+ "SQL_EXPLAIN_ERROR"
233
+ ]);
234
+ function _t({ card: e }) {
235
+ var ie, le, ce, ue, de;
236
+ const t = $e(), [o, r] = pe({}), { authToken: s } = je(), l = ut(s == null ? void 0 : s.accessToken), { compiledAppearance: n } = Et(), a = T(
237
+ () => We(n),
238
+ [n]
239
+ ), u = A((m) => m.frame), g = A(
240
+ (m) => m.inlineFilterValuesMap[e.id]
241
+ ), S = A(
242
+ (m) => m.actions.setCardInlineFilterValue
243
+ ), i = A(
244
+ (m) => m.actions.removeCardInlineFilterValue
245
+ ), c = e, { getCard: b, manifest: E } = Xe(
246
+ ((ie = c.customCardPreferences) == null ? void 0 : ie.url) || ""
247
+ ), d = (le = E == null ? void 0 : E.visuals) == null ? void 0 : le.find(
248
+ (m) => {
249
+ var D;
250
+ return m.name === ((D = c.customCardPreferences) == null ? void 0 : D.componentName);
251
+ }
252
+ ), h = vt(c, d) ?? "single", v = T(
253
+ () => yt({
254
+ frame: u,
255
+ configCard: c,
256
+ isMultiInputVisual: h === "multiple"
257
+ }),
258
+ [u, c, h]
259
+ ), P = T(() => {
260
+ const m = v.findIndex(
261
+ (D) => (D == null ? void 0 : D.id) === e.id
262
+ );
263
+ return m < 0 ? -1 : me(e, m);
264
+ }, [v, e]), f = T(() => h !== "multiple" || P < 0 ? e.type : ee(
265
+ e,
266
+ P,
267
+ d == null ? void 0 : d.slots
268
+ ) ?? e.type, [h, P, e, d == null ? void 0 : d.slots]), w = T(() => h === "multiple" ? {
269
+ ...e,
270
+ connectionId: void 0,
271
+ dataSource: void 0,
272
+ sql: "",
273
+ python: "",
274
+ config: void 0,
275
+ queryConfig: void 0
276
+ } : f !== e.type ? { ...e, type: f } : e, [e, f, h]), { data: y, effectiveCardConfig: K } = oe(w), O = Je(), Y = Z((m) => m.dashboard.filters), G = Z((m) => m.filterValues), I = Z((m) => m.selectedSheetId), R = T(
277
+ () => Ze({
278
+ card: e,
279
+ sheetId: I || "",
280
+ inlineFilterValues: g,
281
+ setInlineFilterValue: (m) => S(e.id, m),
282
+ removeInlineFilterValue: (m) => i(e.id, m)
283
+ }),
284
+ [
285
+ e,
286
+ I,
287
+ g,
288
+ S,
289
+ i
290
+ ]
291
+ ), { cardFilters: _, cardFilterValues: M } = T(
292
+ () => et({
293
+ card: e,
294
+ transientContexts: O,
295
+ filters: Y,
296
+ filterValues: G,
297
+ selectedSheetId: I
298
+ }),
299
+ [
300
+ e,
301
+ O,
302
+ Y,
303
+ G,
304
+ I
305
+ ]
306
+ ), q = W(
307
+ (m, D) => {
308
+ const j = bt(D);
309
+ r((J) => ({
310
+ ...J,
311
+ [m]: j
312
+ }));
313
+ },
314
+ []
315
+ ), L = (ce = c.customCardPreferences) == null ? void 0 : ce.componentName, N = L ? b(L) : null, V = tt(
316
+ (ue = c.customCardPreferences) == null ? void 0 : ue.settings,
317
+ c
318
+ ), x = T(
319
+ () => Ct(v),
320
+ [v]
321
+ ), $ = T(
322
+ () => x.map(
323
+ (m, D) => ee(
324
+ m,
325
+ D,
326
+ d == null ? void 0 : d.slots
327
+ )
328
+ ),
329
+ [x, d == null ? void 0 : d.slots]
330
+ ), ae = T(
331
+ () => nt(
332
+ h === "multiple" ? rt({
333
+ slotOrderedCards: x,
334
+ multiInputData: o,
335
+ valueFormatPreferences: t
336
+ }) : [
337
+ {
338
+ card: e,
339
+ cardConfig: K,
340
+ columns: y == null ? void 0 : y.columns,
341
+ columnKeyMap: y == null ? void 0 : y.columnKeyMap,
342
+ valueFormatPreferences: t
343
+ }
344
+ ]
345
+ ),
346
+ [
347
+ e,
348
+ y == null ? void 0 : y.columnKeyMap,
349
+ y == null ? void 0 : y.columns,
350
+ K,
351
+ o,
352
+ x,
353
+ h,
354
+ t
355
+ ]
356
+ );
357
+ return L ? /* @__PURE__ */ p("div", { className: "semaphor-custom mb-3 flex grow basis-0 flex-col space-y-2 overflow-y-auto", children: /* @__PURE__ */ B(
358
+ Ye,
359
+ {
360
+ fallback: /* @__PURE__ */ p(fe, {}),
361
+ children: [
362
+ N && h === "single" && /* @__PURE__ */ p(
363
+ N,
364
+ {
365
+ editing: !0,
366
+ params: l,
367
+ theme: a,
368
+ settings: V,
369
+ cardMetadata: ot({
370
+ card: e,
371
+ dataMetadata: y == null ? void 0 : y.metadata
372
+ }),
373
+ onDataChange: q,
374
+ data: (y == null ? void 0 : y.records) || [],
375
+ columns: (y == null ? void 0 : y.columns) || [],
376
+ formatTemporalBucketValue: ae,
377
+ filters: _,
378
+ filterValues: [
379
+ ...M || [],
380
+ ...g || []
381
+ ],
382
+ inlineFilters: R
383
+ }
384
+ ),
385
+ N && h === "multiple" && /* @__PURE__ */ B(fe, { children: [
386
+ v.map((m, D) => {
387
+ if (!m) return null;
388
+ const j = me(m, D), J = ee(
389
+ m,
390
+ j,
391
+ d == null ? void 0 : d.slots
392
+ );
393
+ return /* @__PURE__ */ p(
394
+ st,
395
+ {
396
+ onDataChange: q,
397
+ card: m,
398
+ effectiveCardType: J
399
+ },
400
+ `${m.id}-${j}`
401
+ );
402
+ }),
403
+ /* @__PURE__ */ p("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ p(
404
+ N,
405
+ {
406
+ editing: !0,
407
+ onDataChange: q,
408
+ ...at({
409
+ configCard: c,
410
+ slotOrderedCards: x,
411
+ slotTypes: $,
412
+ multiInputData: o,
413
+ params: l,
414
+ theme: a,
415
+ chartSettings: V,
416
+ filters: _,
417
+ filterValues: [
418
+ ...M || [],
419
+ ...g || []
420
+ ],
421
+ inlineFilters: R,
422
+ formatTemporalBucketValue: ae
423
+ })
424
+ }
425
+ ) })
426
+ ] })
427
+ ]
428
+ },
429
+ (de = c.customCardPreferences) == null ? void 0 : de.componentName
430
+ ) }) : null;
431
+ }
432
+ const bn = Qe(_t);
433
+ var Ie = ["PageUp", "PageDown"], _e = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"], Ne = {
434
+ "from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
435
+ "from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
436
+ "from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
437
+ "from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
438
+ }, U = "Slider", [te, Nt, Mt] = ft(U), [Me] = dt(U, [
439
+ Mt
440
+ ]), [Vt, X] = Me(U), Ve = C.forwardRef(
441
+ (e, t) => {
442
+ const {
443
+ name: o,
444
+ min: r = 0,
445
+ max: s = 100,
446
+ step: l = 1,
447
+ orientation: n = "horizontal",
448
+ disabled: a = !1,
449
+ minStepsBetweenThumbs: u = 0,
450
+ defaultValue: g = [r],
451
+ value: S,
452
+ onValueChange: i = () => {
453
+ },
454
+ onValueCommit: c = () => {
455
+ },
456
+ inverted: b = !1,
457
+ form: E,
458
+ ...d
459
+ } = e, h = C.useRef(/* @__PURE__ */ new Set()), v = C.useRef(0), f = n === "horizontal" ? At : Lt, [w = [], y] = he({
460
+ prop: S,
461
+ defaultProp: g,
462
+ onChange: (R) => {
463
+ var M;
464
+ (M = [...h.current][v.current]) == null || M.focus(), i(R);
465
+ }
466
+ }), K = C.useRef(w);
467
+ function O(R) {
468
+ const _ = qt(w, R);
469
+ I(R, _);
470
+ }
471
+ function Y(R) {
472
+ I(R, v.current);
473
+ }
474
+ function G() {
475
+ const R = K.current[v.current];
476
+ w[v.current] !== R && c(w);
477
+ }
478
+ function I(R, _, { commit: M } = { commit: !1 }) {
479
+ const q = Ut(l), L = Qt(Math.round((R - r) / l) * l + r, q), N = ye(L, [r, s]);
480
+ y((V = []) => {
481
+ const x = Kt(V, N, _);
482
+ if (Ht(x, u * l)) {
483
+ v.current = x.indexOf(N);
484
+ const $ = String(x) !== String(V);
485
+ return $ && M && c(x), $ ? x : V;
486
+ } else
487
+ return V;
488
+ });
489
+ }
490
+ return /* @__PURE__ */ p(
491
+ Vt,
492
+ {
493
+ scope: e.__scopeSlider,
494
+ name: o,
495
+ disabled: a,
496
+ min: r,
497
+ max: s,
498
+ valueIndexToChangeRef: v,
499
+ thumbs: h.current,
500
+ values: w,
501
+ orientation: n,
502
+ form: E,
503
+ children: /* @__PURE__ */ p(te.Provider, { scope: e.__scopeSlider, children: /* @__PURE__ */ p(te.Slot, { scope: e.__scopeSlider, children: /* @__PURE__ */ p(
504
+ f,
505
+ {
506
+ "aria-disabled": a,
507
+ "data-disabled": a ? "" : void 0,
508
+ ...d,
509
+ ref: t,
510
+ onPointerDown: k(d.onPointerDown, () => {
511
+ a || (K.current = w);
512
+ }),
513
+ min: r,
514
+ max: s,
515
+ inverted: b,
516
+ onSlideStart: a ? void 0 : O,
517
+ onSlideMove: a ? void 0 : Y,
518
+ onSlideEnd: a ? void 0 : G,
519
+ onHomeKeyDown: () => !a && I(r, 0, { commit: !0 }),
520
+ onEndKeyDown: () => !a && I(s, w.length - 1, { commit: !0 }),
521
+ onStepKeyDown: ({ event: R, direction: _ }) => {
522
+ if (!a) {
523
+ const L = Ie.includes(R.key) || R.shiftKey && _e.includes(R.key) ? 10 : 1, N = v.current, V = w[N], x = l * L * _;
524
+ I(V + x, N, { commit: !0 });
525
+ }
526
+ }
527
+ }
528
+ ) }) })
529
+ }
530
+ );
531
+ }
532
+ );
533
+ Ve.displayName = U;
534
+ var [Ae, Le] = Me(U, {
535
+ startEdge: "left",
536
+ endEdge: "right",
537
+ size: "width",
538
+ direction: 1
539
+ }), At = C.forwardRef(
540
+ (e, t) => {
541
+ const {
542
+ min: o,
543
+ max: r,
544
+ dir: s,
545
+ inverted: l,
546
+ onSlideStart: n,
547
+ onSlideMove: a,
548
+ onSlideEnd: u,
549
+ onStepKeyDown: g,
550
+ ...S
551
+ } = e, [i, c] = C.useState(null), b = H(t, (f) => c(f)), E = C.useRef(void 0), d = mt(s), h = d === "ltr", v = h && !l || !h && l;
552
+ function P(f) {
553
+ const w = E.current || i.getBoundingClientRect(), y = [0, w.width], O = se(y, v ? [o, r] : [r, o]);
554
+ return E.current = w, O(f - w.left);
555
+ }
556
+ return /* @__PURE__ */ p(
557
+ Ae,
558
+ {
559
+ scope: e.__scopeSlider,
560
+ startEdge: v ? "left" : "right",
561
+ endEdge: v ? "right" : "left",
562
+ direction: v ? 1 : -1,
563
+ size: "width",
564
+ children: /* @__PURE__ */ p(
565
+ Fe,
566
+ {
567
+ dir: d,
568
+ "data-orientation": "horizontal",
569
+ ...S,
570
+ ref: b,
571
+ style: {
572
+ ...S.style,
573
+ "--radix-slider-thumb-transform": "translateX(-50%)"
574
+ },
575
+ onSlideStart: (f) => {
576
+ const w = P(f.clientX);
577
+ n == null || n(w);
578
+ },
579
+ onSlideMove: (f) => {
580
+ const w = P(f.clientX);
581
+ a == null || a(w);
582
+ },
583
+ onSlideEnd: () => {
584
+ E.current = void 0, u == null || u();
585
+ },
586
+ onStepKeyDown: (f) => {
587
+ const y = Ne[v ? "from-left" : "from-right"].includes(f.key);
588
+ g == null || g({ event: f, direction: y ? -1 : 1 });
589
+ }
590
+ }
591
+ )
592
+ }
593
+ );
594
+ }
595
+ ), Lt = C.forwardRef(
596
+ (e, t) => {
597
+ const {
598
+ min: o,
599
+ max: r,
600
+ inverted: s,
601
+ onSlideStart: l,
602
+ onSlideMove: n,
603
+ onSlideEnd: a,
604
+ onStepKeyDown: u,
605
+ ...g
606
+ } = e, S = C.useRef(null), i = H(t, S), c = C.useRef(void 0), b = !s;
607
+ function E(d) {
608
+ const h = c.current || S.current.getBoundingClientRect(), v = [0, h.height], f = se(v, b ? [r, o] : [o, r]);
609
+ return c.current = h, f(d - h.top);
610
+ }
611
+ return /* @__PURE__ */ p(
612
+ Ae,
613
+ {
614
+ scope: e.__scopeSlider,
615
+ startEdge: b ? "bottom" : "top",
616
+ endEdge: b ? "top" : "bottom",
617
+ size: "height",
618
+ direction: b ? 1 : -1,
619
+ children: /* @__PURE__ */ p(
620
+ Fe,
621
+ {
622
+ "data-orientation": "vertical",
623
+ ...g,
624
+ ref: i,
625
+ style: {
626
+ ...g.style,
627
+ "--radix-slider-thumb-transform": "translateY(50%)"
628
+ },
629
+ onSlideStart: (d) => {
630
+ const h = E(d.clientY);
631
+ l == null || l(h);
632
+ },
633
+ onSlideMove: (d) => {
634
+ const h = E(d.clientY);
635
+ n == null || n(h);
636
+ },
637
+ onSlideEnd: () => {
638
+ c.current = void 0, a == null || a();
639
+ },
640
+ onStepKeyDown: (d) => {
641
+ const v = Ne[b ? "from-bottom" : "from-top"].includes(d.key);
642
+ u == null || u({ event: d, direction: v ? -1 : 1 });
643
+ }
644
+ }
645
+ )
646
+ }
647
+ );
648
+ }
649
+ ), Fe = C.forwardRef(
650
+ (e, t) => {
651
+ const {
652
+ __scopeSlider: o,
653
+ onSlideStart: r,
654
+ onSlideMove: s,
655
+ onSlideEnd: l,
656
+ onHomeKeyDown: n,
657
+ onEndKeyDown: a,
658
+ onStepKeyDown: u,
659
+ ...g
660
+ } = e, S = X(U, o);
661
+ return /* @__PURE__ */ p(
662
+ z.span,
663
+ {
664
+ ...g,
665
+ ref: t,
666
+ onKeyDown: k(e.onKeyDown, (i) => {
667
+ i.key === "Home" ? (n(i), i.preventDefault()) : i.key === "End" ? (a(i), i.preventDefault()) : Ie.concat(_e).includes(i.key) && (u(i), i.preventDefault());
668
+ }),
669
+ onPointerDown: k(e.onPointerDown, (i) => {
670
+ const c = i.target;
671
+ c.setPointerCapture(i.pointerId), i.preventDefault(), S.thumbs.has(c) ? c.focus() : r(i);
672
+ }),
673
+ onPointerMove: k(e.onPointerMove, (i) => {
674
+ i.target.hasPointerCapture(i.pointerId) && s(i);
675
+ }),
676
+ onPointerUp: k(e.onPointerUp, (i) => {
677
+ const c = i.target;
678
+ c.hasPointerCapture(i.pointerId) && (c.releasePointerCapture(i.pointerId), l(i));
679
+ })
680
+ }
681
+ );
682
+ }
683
+ ), ke = "SliderTrack", Ke = C.forwardRef(
684
+ (e, t) => {
685
+ const { __scopeSlider: o, ...r } = e, s = X(ke, o);
686
+ return /* @__PURE__ */ p(
687
+ z.span,
688
+ {
689
+ "data-disabled": s.disabled ? "" : void 0,
690
+ "data-orientation": s.orientation,
691
+ ...r,
692
+ ref: t
693
+ }
694
+ );
695
+ }
696
+ );
697
+ Ke.displayName = ke;
698
+ var ne = "SliderRange", Oe = C.forwardRef(
699
+ (e, t) => {
700
+ const { __scopeSlider: o, ...r } = e, s = X(ne, o), l = Le(ne, o), n = C.useRef(null), a = H(t, n), u = s.values.length, g = s.values.map(
701
+ (c) => ze(c, s.min, s.max)
702
+ ), S = u > 1 ? Math.min(...g) : 0, i = 100 - Math.max(...g);
703
+ return /* @__PURE__ */ p(
704
+ z.span,
705
+ {
706
+ "data-orientation": s.orientation,
707
+ "data-disabled": s.disabled ? "" : void 0,
708
+ ...r,
709
+ ref: a,
710
+ style: {
711
+ ...e.style,
712
+ [l.startEdge]: S + "%",
713
+ [l.endEdge]: i + "%"
714
+ }
715
+ }
716
+ );
717
+ }
718
+ );
719
+ Oe.displayName = ne;
720
+ var re = "SliderThumb", qe = C.forwardRef(
721
+ (e, t) => {
722
+ const o = Nt(e.__scopeSlider), [r, s] = C.useState(null), l = H(t, (a) => s(a)), n = C.useMemo(
723
+ () => r ? o().findIndex((a) => a.ref.current === r) : -1,
724
+ [o, r]
725
+ );
726
+ return /* @__PURE__ */ p(Ft, { ...e, ref: l, index: n });
727
+ }
728
+ ), Ft = C.forwardRef(
729
+ (e, t) => {
730
+ const { __scopeSlider: o, index: r, name: s, ...l } = e, n = X(re, o), a = Le(re, o), [u, g] = C.useState(null), S = H(t, (P) => g(P)), i = u ? n.form || !!u.closest("form") : !0, c = pt(u), b = n.values[r], E = b === void 0 ? 0 : ze(b, n.min, n.max), d = Ot(r, n.values.length), h = c == null ? void 0 : c[a.size], v = h ? Bt(h, E, a.direction) : 0;
731
+ return C.useEffect(() => {
732
+ if (u)
733
+ return n.thumbs.add(u), () => {
734
+ n.thumbs.delete(u);
735
+ };
736
+ }, [u, n.thumbs]), /* @__PURE__ */ B(
737
+ "span",
738
+ {
739
+ style: {
740
+ transform: "var(--radix-slider-thumb-transform)",
741
+ position: "absolute",
742
+ [a.startEdge]: `calc(${E}% + ${v}px)`
743
+ },
744
+ children: [
745
+ /* @__PURE__ */ p(te.ItemSlot, { scope: e.__scopeSlider, children: /* @__PURE__ */ p(
746
+ z.span,
747
+ {
748
+ role: "slider",
749
+ "aria-label": e["aria-label"] || d,
750
+ "aria-valuemin": n.min,
751
+ "aria-valuenow": b,
752
+ "aria-valuemax": n.max,
753
+ "aria-orientation": n.orientation,
754
+ "data-orientation": n.orientation,
755
+ "data-disabled": n.disabled ? "" : void 0,
756
+ tabIndex: n.disabled ? void 0 : 0,
757
+ ...l,
758
+ ref: S,
759
+ style: b === void 0 ? { display: "none" } : e.style,
760
+ onFocus: k(e.onFocus, () => {
761
+ n.valueIndexToChangeRef.current = r;
762
+ })
763
+ }
764
+ ) }),
765
+ i && /* @__PURE__ */ p(
766
+ Be,
767
+ {
768
+ name: s ?? (n.name ? n.name + (n.values.length > 1 ? "[]" : "") : void 0),
769
+ form: n.form,
770
+ value: b
771
+ },
772
+ r
773
+ )
774
+ ]
775
+ }
776
+ );
777
+ }
778
+ );
779
+ qe.displayName = re;
780
+ var kt = "RadioBubbleInput", Be = C.forwardRef(
781
+ ({ __scopeSlider: e, value: t, ...o }, r) => {
782
+ const s = C.useRef(null), l = H(s, r), n = gt(t);
783
+ return C.useEffect(() => {
784
+ const a = s.current;
785
+ if (!a) return;
786
+ const u = window.HTMLInputElement.prototype, S = Object.getOwnPropertyDescriptor(u, "value").set;
787
+ if (n !== t && S) {
788
+ const i = new Event("input", { bubbles: !0 });
789
+ S.call(a, t), a.dispatchEvent(i);
790
+ }
791
+ }, [n, t]), /* @__PURE__ */ p(
792
+ z.input,
793
+ {
794
+ style: { display: "none" },
795
+ ...o,
796
+ ref: l,
797
+ defaultValue: t
798
+ }
799
+ );
800
+ }
801
+ );
802
+ Be.displayName = kt;
803
+ function Kt(e = [], t, o) {
804
+ const r = [...e];
805
+ return r[o] = t, r.sort((s, l) => s - l);
806
+ }
807
+ function ze(e, t, o) {
808
+ const l = 100 / (o - t) * (e - t);
809
+ return ye(l, [0, 100]);
810
+ }
811
+ function Ot(e, t) {
812
+ return t > 2 ? `Value ${e + 1} of ${t}` : t === 2 ? ["Minimum", "Maximum"][e] : void 0;
813
+ }
814
+ function qt(e, t) {
815
+ if (e.length === 1) return 0;
816
+ const o = e.map((s) => Math.abs(s - t)), r = Math.min(...o);
817
+ return o.indexOf(r);
818
+ }
819
+ function Bt(e, t, o) {
820
+ const r = e / 2, l = se([0, 50], [0, r]);
821
+ return (r - l(t) * o) * o;
822
+ }
823
+ function zt(e) {
824
+ return e.slice(0, -1).map((t, o) => e[o + 1] - t);
825
+ }
826
+ function Ht(e, t) {
827
+ if (t > 0) {
828
+ const o = zt(e);
829
+ return Math.min(...o) >= t;
830
+ }
831
+ return !0;
832
+ }
833
+ function se(e, t) {
834
+ return (o) => {
835
+ if (e[0] === e[1] || t[0] === t[1]) return t[0];
836
+ const r = (t[1] - t[0]) / (e[1] - e[0]);
837
+ return t[0] + r * (o - e[0]);
838
+ };
839
+ }
840
+ function Ut(e) {
841
+ return (String(e).split(".")[1] || "").length;
842
+ }
843
+ function Qt(e, t) {
844
+ const o = Math.pow(10, t);
845
+ return Math.round(e * o) / o;
846
+ }
847
+ var He = Ve, Yt = Ke, Gt = Oe, $t = qe;
848
+ const jt = C.forwardRef(({ className: e, ...t }, o) => /* @__PURE__ */ B(
849
+ He,
850
+ {
851
+ ref: o,
852
+ className: Se(
853
+ "relative flex w-full touch-none select-none items-center",
854
+ e
855
+ ),
856
+ ...t,
857
+ children: [
858
+ /* @__PURE__ */ p(Yt, { className: "relative h-2 w-full grow overflow-hidden rounded-full bg-secondary", children: /* @__PURE__ */ p(Gt, { className: "absolute h-full bg-primary" }) }),
859
+ /* @__PURE__ */ p($t, { className: "block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" })
860
+ ]
861
+ }
862
+ ));
863
+ jt.displayName = He.displayName;
864
+ export {
865
+ bn as E,
866
+ fn as F,
867
+ hn as I,
868
+ Sn as M,
869
+ pn as P,
870
+ yn as R,
871
+ vn as S,
872
+ Rt as T,
873
+ gn as a,
874
+ It as b,
875
+ mn as c,
876
+ jt as d
877
+ };