@tempots/beatui 0.82.0 → 0.82.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 (173) hide show
  1. package/dist/_commonjsHelpers-DKOUU3wS.cjs +1 -0
  2. package/dist/_commonjsHelpers-DaMA6jEr.js +8 -0
  3. package/dist/auth/index.cjs.js +1 -1
  4. package/dist/auth/index.es.js +63 -1351
  5. package/dist/auth-divider-BqZPH1-z.cjs +1 -0
  6. package/dist/auth-divider-Wr-S16kF.js +1355 -0
  7. package/dist/beatui.css +1347 -0
  8. package/dist/beatui.tailwind.css +1347 -0
  9. package/dist/better-auth/index.cjs.js +1 -0
  10. package/dist/better-auth/index.es.js +754 -0
  11. package/dist/{deep-merge-CiOwVWn8.js → deep-merge-BYm0y62g.js} +34 -33
  12. package/dist/deep-merge-d7sf0xmN.cjs +1 -0
  13. package/dist/duration-input-B9UNmUCh.cjs +1 -0
  14. package/dist/{duration-input-B3vnnwBZ.js → duration-input-DqcJbxKD.js} +23 -22
  15. package/dist/editor-toolbar-group--a-xgsJw.cjs +1 -0
  16. package/dist/editor-toolbar-group-CVpl5mxF.js +31 -0
  17. package/dist/{hls.light.min-Bhrf47iR.cjs → hls.light.min-C6xKDzRR.cjs} +1 -1
  18. package/dist/{hls.light.min-C6VwviEa.js → hls.light.min-hEMf_E8u.js} +1 -1
  19. package/dist/{index-C5YCCgnn.cjs → index-05UbKOYe.cjs} +1 -1
  20. package/dist/{index-ChsRjiIp.cjs → index-Bt7FYl80.cjs} +19 -19
  21. package/dist/{index-DT6-HMMz.js → index-C2Lq1m45.js} +1432 -1462
  22. package/dist/{index-CiAVfKIZ.js → index-lYhXnu6I.js} +1 -1
  23. package/dist/index.cjs.js +4 -4
  24. package/dist/index.es.js +2326 -2680
  25. package/dist/input-container-C6qEIjcA.cjs +1 -0
  26. package/dist/input-container-DiCjOzR2.js +247 -0
  27. package/dist/json-schema/index.cjs.js +1 -1
  28. package/dist/json-schema/index.es.js +33 -32
  29. package/dist/json-schema-display/index.cjs.js +1 -1
  30. package/dist/json-schema-display/index.es.js +1 -1
  31. package/dist/json-structure/index.cjs.js +1 -1
  32. package/dist/json-structure/index.es.js +542 -700
  33. package/dist/lexical/index.cjs.js +46 -0
  34. package/dist/lexical/index.es.js +21370 -0
  35. package/dist/lexical.css +1124 -0
  36. package/dist/menu-CZzRsQP_.js +372 -0
  37. package/dist/menu-ClrU72xH.cjs +1 -0
  38. package/dist/modal-I5srcntN.cjs +1 -0
  39. package/dist/modal-v3u2Fpnd.js +488 -0
  40. package/dist/{notice-CZHWWwOQ.js → notice-BuZvdvZh.js} +48 -47
  41. package/dist/notice-CLDdy1MW.cjs +1 -0
  42. package/dist/{oneof-branch-detection-C8g3eWnx.cjs → oneof-branch-detection-DsM1K5xc.cjs} +1 -1
  43. package/dist/{oneof-branch-detection-BVNoKU9d.js → oneof-branch-detection-Dt8ss9lc.js} +1 -1
  44. package/dist/prosemirror/index.cjs.js +1 -1
  45. package/dist/prosemirror/index.es.js +1 -1
  46. package/dist/session-id-3KiilioY.js +8 -0
  47. package/dist/session-id-B5lJMzbB.cjs +1 -0
  48. package/dist/styles-url-B2dzXrYt.cjs +1 -0
  49. package/dist/styles-url-Cw_mxshe.js +4 -0
  50. package/dist/text-input-B3VBat1k.js +44 -0
  51. package/dist/text-input-Ds8e7Z1G.cjs +1 -0
  52. package/dist/{toolbar-DR2Zd4Oo.js → toolbar-D994_E_s.js} +4 -4
  53. package/dist/toolbar-x0_8lmKu.cjs +1 -0
  54. package/dist/types/better-auth/bridge.d.ts +2 -0
  55. package/dist/types/better-auth/callbacks.d.ts +6 -0
  56. package/dist/types/better-auth/components/authenticated.d.ts +4 -0
  57. package/dist/types/better-auth/components/better-auth-container.d.ts +4 -0
  58. package/dist/types/better-auth/components/better-auth-modal.d.ts +4 -0
  59. package/dist/types/better-auth/components/magic-link-form.d.ts +7 -0
  60. package/dist/types/better-auth/components/passkey-management.d.ts +6 -0
  61. package/dist/types/better-auth/components/passkey-signin.d.ts +12 -0
  62. package/dist/types/better-auth/components/two-factor-setup.d.ts +8 -0
  63. package/dist/types/better-auth/components/two-factor-verify.d.ts +10 -0
  64. package/dist/types/better-auth/i18n/default.d.ts +29 -0
  65. package/dist/types/better-auth/i18n/locales/en.d.ts +28 -0
  66. package/dist/types/better-auth/i18n/translations.d.ts +27 -0
  67. package/dist/types/better-auth/index.d.ts +22 -0
  68. package/dist/types/better-auth/provider.d.ts +6 -0
  69. package/dist/types/better-auth/session.d.ts +14 -0
  70. package/dist/types/better-auth/social-mapping.d.ts +2 -0
  71. package/dist/types/better-auth/types.d.ts +164 -0
  72. package/dist/types/components/auth/auth-container.d.ts +1 -1
  73. package/dist/types/components/auth/social-providers.d.ts +1 -1
  74. package/dist/types/components/auth/types.d.ts +2 -0
  75. package/dist/types/components/editor-toolbar/editor-toolbar-button.d.ts +16 -0
  76. package/dist/types/components/editor-toolbar/editor-toolbar-group.d.ts +9 -0
  77. package/dist/types/components/editor-toolbar/index.d.ts +2 -0
  78. package/dist/types/components/json-structure/controls/control-utils.d.ts +19 -0
  79. package/dist/types/components/json-structure/controls/index.d.ts +1 -0
  80. package/dist/types/components/lexical/bare-editor.d.ts +29 -0
  81. package/dist/types/components/lexical/code/index.d.ts +1 -0
  82. package/dist/types/components/lexical/code/language-selector.d.ts +13 -0
  83. package/dist/types/components/lexical/contextual-editor.d.ts +22 -0
  84. package/dist/types/components/lexical/docked-editor.d.ts +23 -0
  85. package/dist/types/components/lexical/floating/block-handle.d.ts +16 -0
  86. package/dist/types/components/lexical/floating/floating-toolbar.d.ts +12 -0
  87. package/dist/types/components/lexical/floating/index.d.ts +6 -0
  88. package/dist/types/components/lexical/floating/slash-command-palette.d.ts +20 -0
  89. package/dist/types/components/lexical/index.d.ts +8 -0
  90. package/dist/types/components/lexical/lexical-editor-input.d.ts +30 -0
  91. package/dist/types/components/lexical/table/index.d.ts +1 -0
  92. package/dist/types/components/lexical/table/table-controls.d.ts +12 -0
  93. package/dist/types/components/lexical/toolbar/index.d.ts +6 -0
  94. package/dist/types/components/lexical/toolbar/lexical-toolbar.d.ts +12 -0
  95. package/dist/types/components/lexical/toolbar/toolbar-button.d.ts +1 -0
  96. package/dist/types/components/lexical/toolbar/toolbar-group.d.ts +1 -0
  97. package/dist/types/components/lexical/toolbar/toolbar-helpers.d.ts +30 -0
  98. package/dist/types/components/prosemirror/etoolbar-button.d.ts +1 -11
  99. package/dist/types/components/prosemirror/etoolbar-group.d.ts +1 -4
  100. package/dist/types/lexical/commands/index.d.ts +17 -0
  101. package/dist/types/lexical/headless.d.ts +39 -0
  102. package/dist/types/lexical/horizontal-rule-node.d.ts +20 -0
  103. package/dist/types/lexical/index.d.ts +20 -0
  104. package/dist/types/lexical/lazy-loader.d.ts +35 -0
  105. package/dist/types/lexical/nodes.d.ts +29 -0
  106. package/dist/types/lexical/plugins/auto-link.d.ts +7 -0
  107. package/dist/types/lexical/plugins/clipboard.d.ts +11 -0
  108. package/dist/types/lexical/plugins/code-shiki.d.ts +11 -0
  109. package/dist/types/lexical/plugins/code.d.ts +7 -0
  110. package/dist/types/lexical/plugins/dragon.d.ts +6 -0
  111. package/dist/types/lexical/plugins/file-io.d.ts +10 -0
  112. package/dist/types/lexical/plugins/hashtag.d.ts +7 -0
  113. package/dist/types/lexical/plugins/history.d.ts +7 -0
  114. package/dist/types/lexical/plugins/horizontal-rule.d.ts +12 -0
  115. package/dist/types/lexical/plugins/html-io.d.ts +9 -0
  116. package/dist/types/lexical/plugins/index.d.ts +24 -0
  117. package/dist/types/lexical/plugins/link.d.ts +6 -0
  118. package/dist/types/lexical/plugins/list.d.ts +6 -0
  119. package/dist/types/lexical/plugins/mark.d.ts +15 -0
  120. package/dist/types/lexical/plugins/markdown-io.d.ts +13 -0
  121. package/dist/types/lexical/plugins/offset.d.ts +6 -0
  122. package/dist/types/lexical/plugins/overflow.d.ts +7 -0
  123. package/dist/types/lexical/plugins/plain-text.d.ts +6 -0
  124. package/dist/types/lexical/plugins/rich-text.d.ts +6 -0
  125. package/dist/types/lexical/plugins/selection.d.ts +6 -0
  126. package/dist/types/lexical/plugins/slash-commands.d.ts +26 -0
  127. package/dist/types/lexical/plugins/table.d.ts +11 -0
  128. package/dist/types/lexical/plugins/text.d.ts +13 -0
  129. package/dist/types/lexical/plugins/yjs.d.ts +9 -0
  130. package/dist/types/lexical/styles-url.d.ts +2 -0
  131. package/dist/types/lexical/styles.d.ts +2 -0
  132. package/dist/types/lexical/types.d.ts +634 -0
  133. package/dist/types/lexical-i18n/default.d.ts +92 -0
  134. package/dist/types/lexical-i18n/index.d.ts +21 -0
  135. package/dist/types/lexical-i18n/locales/ar.d.ts +91 -0
  136. package/dist/types/lexical-i18n/locales/de.d.ts +91 -0
  137. package/dist/types/lexical-i18n/locales/en.d.ts +91 -0
  138. package/dist/types/lexical-i18n/locales/es.d.ts +91 -0
  139. package/dist/types/lexical-i18n/locales/fa.d.ts +91 -0
  140. package/dist/types/lexical-i18n/locales/fr.d.ts +91 -0
  141. package/dist/types/lexical-i18n/locales/he.d.ts +91 -0
  142. package/dist/types/lexical-i18n/locales/hi.d.ts +91 -0
  143. package/dist/types/lexical-i18n/locales/it.d.ts +91 -0
  144. package/dist/types/lexical-i18n/locales/ja.d.ts +91 -0
  145. package/dist/types/lexical-i18n/locales/ko.d.ts +91 -0
  146. package/dist/types/lexical-i18n/locales/nl.d.ts +91 -0
  147. package/dist/types/lexical-i18n/locales/pl.d.ts +91 -0
  148. package/dist/types/lexical-i18n/locales/pt.d.ts +91 -0
  149. package/dist/types/lexical-i18n/locales/ru.d.ts +91 -0
  150. package/dist/types/lexical-i18n/locales/tr.d.ts +91 -0
  151. package/dist/types/lexical-i18n/locales/ur.d.ts +91 -0
  152. package/dist/types/lexical-i18n/locales/vi.d.ts +91 -0
  153. package/dist/types/lexical-i18n/locales/zh.d.ts +91 -0
  154. package/dist/types/lexical-i18n/translations.d.ts +21 -0
  155. package/dist/use-animated-toggle-ChycsEoj.js +175 -0
  156. package/dist/use-animated-toggle-DR6CyMac.cjs +1 -0
  157. package/dist/{use-form-CgZyrACX.js → use-form-B56E_x5Y.js} +83 -88
  158. package/dist/use-form-Cnp3XQ5X.cjs +2 -0
  159. package/dist/widget-customization-Dk7XcVly.cjs +1 -0
  160. package/dist/{widget-customization-DRA7E9Zf.js → widget-customization-Ds9sicAg.js} +106 -105
  161. package/package.json +48 -3
  162. package/dist/_commonjsHelpers-C6fGbg64.js +0 -6
  163. package/dist/_commonjsHelpers-DwGv2jUC.cjs +0 -1
  164. package/dist/deep-merge-DxZqCkE5.cjs +0 -1
  165. package/dist/duration-input-Dg5SX3lM.cjs +0 -1
  166. package/dist/modal-D2xE47kr.cjs +0 -1
  167. package/dist/modal-hkQD1bqZ.js +0 -655
  168. package/dist/notice-C0SmlheE.cjs +0 -1
  169. package/dist/text-input-CByq5OIo.cjs +0 -1
  170. package/dist/text-input-CFJntP7G.js +0 -287
  171. package/dist/toolbar-TPWYzoiF.cjs +0 -1
  172. package/dist/use-form-JjeKCINk.cjs +0 -2
  173. package/dist/widget-customization-G-QLB1rw.cjs +0 -1
@@ -1,12 +1,8 @@
1
- import { Use as G, coalesce as J, aria as V, attr as c, on as M, html as m, Value as C, Empty as T, computedOf as y, When as A, dataAttr as $, TextNode as Q, prop as k, Fragment as P, emitValue as X, emitValueAsNumber as Y } from "@tempots/dom";
2
- import { B as Z, I as L } from "./translations-Cq8bUKJP.js";
3
- import { B as ee, a as te } from "./text-input-CFJntP7G.js";
4
- import { M as se, L as ne, i as g } from "./stack-BJgsPJ9A.js";
5
- const F = /* @__PURE__ */ new Map();
6
- function j(s) {
7
- const e = F.get(s) ?? 0;
8
- return F.set(s, e + 1), `${s}-${e}`;
9
- }
1
+ import { Use as q, coalesce as G, aria as V, attr as c, on as M, html as m, Value as C, Empty as T, computedOf as y, When as A, dataAttr as P, TextNode as J, prop as k, Fragment as $, emitValue as Q, emitValueAsNumber as X } from "@tempots/dom";
2
+ import { B as Y, I as z } from "./translations-Cq8bUKJP.js";
3
+ import { B as Z, I as ee } from "./input-container-DiCjOzR2.js";
4
+ import { M as te, L as se, i as g } from "./stack-BJgsPJ9A.js";
5
+ import { s as j } from "./session-id-3KiilioY.js";
10
6
  const E = (s, e) => s === e || s !== s && e !== e;
11
7
  function we({
12
8
  size: s = "sm",
@@ -17,9 +13,9 @@ function we({
17
13
  onClick: a,
18
14
  label: o
19
15
  }, ...r) {
20
- return G(Z, (l) => {
21
- const d = J(o, l.$.closeModal);
22
- return ee(
16
+ return q(Y, (l) => {
17
+ const d = G(o, l.$.closeModal);
18
+ return Z(
23
19
  {
24
20
  variant: "text",
25
21
  size: s,
@@ -31,7 +27,7 @@ function we({
31
27
  c.title(d),
32
28
  V.label(d),
33
29
  ...r,
34
- L({ icon: e, size: s ?? "sm" })
30
+ z({ icon: e, size: s ?? "sm" })
35
31
  );
36
32
  });
37
33
  }
@@ -53,7 +49,7 @@ const De = (s) => {
53
49
  }, w = (u) => {
54
50
  C.get(a ?? !1) || (u.key === " " || u.key === "Enter") && (u.preventDefault(), v());
55
51
  };
56
- return te(
52
+ return ee(
57
53
  {
58
54
  baseContainer: !0,
59
55
  growInput: !1,
@@ -87,7 +83,7 @@ const De = (s) => {
87
83
  i != null ? V.labelledby(p) : T,
88
84
  M.keydown(w),
89
85
  t != null ? M.blur(t) : T,
90
- L({
86
+ z({
91
87
  icon: y(
92
88
  e,
93
89
  r,
@@ -103,29 +99,29 @@ const De = (s) => {
103
99
  c.class("bc-checkbox-input__label"),
104
100
  c.id(p),
105
101
  c.for(h),
106
- se(i)
102
+ te(i)
107
103
  ) : T
108
104
  )
109
105
  },
110
106
  M.click(v)
111
107
  );
112
- }, ie = m.span(
108
+ }, ne = m.span(
113
109
  c.class("bc-input-wrapper__required"),
114
110
  " *"
115
111
  );
116
- function re(s) {
112
+ function ie(s) {
117
113
  const e = ["bc-input-wrapper"];
118
114
  return s !== "vertical" && e.push(`bc-input-wrapper--${s}`), e.join(" ");
119
115
  }
120
- function ae(s, e) {
116
+ function re(s, e) {
121
117
  const t = ["bc-input-wrapper__label-text"];
122
118
  return s ? t.push("bc-input-wrapper__label-text--error") : e ? t.push("bc-input-wrapper__label-text--disabled") : t.push("bc-input-wrapper__label-text--default"), t.join(" ");
123
119
  }
124
- function oe(s, e) {
120
+ function ae(s, e) {
125
121
  if (s === "horizontal-fixed" && e != null)
126
122
  return `--input-wrapper-label-width: ${e}`;
127
123
  }
128
- const W = ({
124
+ const L = ({
129
125
  fullWidth: s = !1,
130
126
  required: e,
131
127
  label: t,
@@ -140,19 +136,19 @@ const W = ({
140
136
  layout: p,
141
137
  labelWidth: v
142
138
  }, ...w) => {
143
- const u = d ?? r != null, f = h ?? !1, D = p ?? "vertical", S = j("input-wrapper"), x = a ? `${S}-description` : void 0, O = r != null ? `${S}-error` : void 0, H = y(D)((b) => b !== "vertical"), q = y(
139
+ const u = d ?? r != null, f = h ?? !1, D = p ?? "vertical", S = j("input-wrapper"), x = a ? `${S}-description` : void 0, O = r != null ? `${S}-error` : void 0, H = y(D)((b) => b !== "vertical"), K = y(
144
140
  D,
145
141
  v ?? void 0
146
- )((b, I) => oe(b, I));
142
+ )((b, I) => ae(b, I));
147
143
  return m.div(
148
- c.class(C.map(D, (b) => re(b))),
144
+ c.class(C.map(D, (b) => ie(b))),
149
145
  c.class(
150
146
  C.map(
151
147
  s,
152
148
  (b) => b ? "bc-input-wrapper--full-width" : ""
153
149
  )
154
150
  ),
155
- c.style(q),
151
+ c.style(K),
156
152
  t != null || i != null ? m.div(
157
153
  c.class("bc-input-wrapper__header"),
158
154
  m.div(
@@ -166,7 +162,7 @@ const W = ({
166
162
  u,
167
163
  f
168
164
  )(
169
- (b, I) => ae(
165
+ (b, I) => re(
170
166
  b ?? !1,
171
167
  I ?? !1
172
168
  )
@@ -174,7 +170,7 @@ const W = ({
174
170
  ),
175
171
  t
176
172
  ),
177
- t != null && e ? ie : T
173
+ t != null && e ? ne : T
178
174
  ),
179
175
  // Show description under label when horizontal
180
176
  A(
@@ -191,17 +187,17 @@ const W = ({
191
187
  )
192
188
  )
193
189
  ),
194
- i != null ? ne(i) : T,
190
+ i != null ? se(i) : T,
195
191
  n
196
192
  ) : T,
197
193
  m.div(
198
194
  c.class("bc-input-wrapper__content"),
199
195
  // Add data attributes to help inputs inherit accessibility information
200
- [x, O].filter(Boolean).length > 0 ? $.describedby(
196
+ [x, O].filter(Boolean).length > 0 ? P.describedby(
201
197
  [x, O].filter(Boolean).join(" ")
202
198
  ) : T,
203
- e ? $.required("true") : T,
204
- A(u, () => $.invalid("true")),
199
+ e ? P.required("true") : T,
200
+ A(u, () => P.invalid("true")),
205
201
  o
206
202
  ),
207
203
  // Show description at bottom only when not horizontal
@@ -227,15 +223,15 @@ const W = ({
227
223
  ),
228
224
  ...w
229
225
  );
230
- }, le = (
226
+ }, oe = (
231
227
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
232
228
  ((s, e) => () => {
233
229
  s.markTouched(), e?.();
234
230
  })
235
- ), N = (s, e) => (t) => {
231
+ ), F = (s, e) => (t) => {
236
232
  s.change(t), e?.(t);
237
233
  };
238
- function R(s, e) {
234
+ function W(s, e) {
239
235
  const { controller: t, onBlur: n, onChange: i, id: a, triggerOn: o, ...r } = e;
240
236
  return s({
241
237
  id: a ?? t.name,
@@ -244,20 +240,20 @@ function R(s, e) {
244
240
  hasError: t.errorVisible,
245
241
  name: t.name,
246
242
  ...r,
247
- onInput: o === "input" ? N(t, i) : void 0,
248
- onChange: o !== "input" ? N(t, i) : void 0,
249
- onBlur: le(t, n)
243
+ onInput: o === "input" ? F(t, i) : void 0,
244
+ onChange: o !== "input" ? F(t, i) : void 0,
245
+ onBlur: oe(t, n)
250
246
  });
251
247
  }
252
248
  function Ce(s, { id: e, labelFor: t, ...n }, ...i) {
253
249
  const a = e ?? n.controller.name ?? j("control"), o = t ?? a;
254
- return W(
250
+ return L(
255
251
  {
256
252
  ...n,
257
253
  hasError: n.controller.errorVisible,
258
- error: Q(n.controller.error.map((r) => r ?? "")),
254
+ error: J(n.controller.error.map((r) => r ?? "")),
259
255
  labelFor: o,
260
- content: R(
256
+ content: W(
261
257
  (r) => s({ ...r, id: a }),
262
258
  n
263
259
  )
@@ -265,9 +261,9 @@ function Ce(s, { id: e, labelFor: t, ...n }, ...i) {
265
261
  ...i
266
262
  );
267
263
  }
268
- function ce(s, e) {
264
+ function le(s, e) {
269
265
  const { toInput: t, fromInput: n, controller: i, ...a } = e, o = i.transform(t, n);
270
- return R(s, {
266
+ return W(s, {
271
267
  ...a,
272
268
  controller: o
273
269
  });
@@ -278,11 +274,11 @@ function Te(s, {
278
274
  ...n
279
275
  }, ...i) {
280
276
  const a = e ?? n.controller.name ?? j("control");
281
- return W(
277
+ return L(
282
278
  {
283
279
  ...n,
284
280
  labelFor: t ?? a,
285
- content: ce(s, {
281
+ content: le(s, {
286
282
  ...n,
287
283
  id: a
288
284
  })
@@ -296,15 +292,15 @@ function _e(s) {
296
292
  return n ? Number(n[1]) : t;
297
293
  });
298
294
  }
299
- function he(s) {
295
+ function ce(s) {
300
296
  return typeof s == "number" ? `[${s}]` : `.${s}`;
301
297
  }
302
- function ue(s) {
298
+ function he(s) {
303
299
  if (s.length === 0) return "";
304
300
  const [e, ...t] = s;
305
301
  return [
306
302
  typeof e == "number" ? `[${e}]` : e,
307
- ...t.map(he)
303
+ ...t.map(ce)
308
304
  ].join("");
309
305
  }
310
306
  const Ie = {
@@ -389,7 +385,7 @@ class _ {
389
385
  });
390
386
  }
391
387
  get name() {
392
- return ue(this.path);
388
+ return he(this.path);
393
389
  }
394
390
  onDispose = (e) => {
395
391
  this.#n.push(e);
@@ -420,7 +416,7 @@ class _ {
420
416
  reset = () => {
421
417
  this.change(this.#t.value);
422
418
  };
423
- array = (e = E) => new pe(
419
+ array = (e = E) => new de(
424
420
  this.path,
425
421
  this.change,
426
422
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -429,7 +425,7 @@ class _ {
429
425
  this.parent,
430
426
  e
431
427
  );
432
- object = (e = E) => new de(
428
+ object = (e = E) => new ue(
433
429
  this.path,
434
430
  this.change,
435
431
  this.signal,
@@ -456,7 +452,7 @@ class _ {
456
452
  a
457
453
  );
458
454
  }
459
- class de extends _ {
455
+ class ue extends _ {
460
456
  #e = /* @__PURE__ */ new Map();
461
457
  #s = /* @__PURE__ */ new Map();
462
458
  #t = /* @__PURE__ */ new Map();
@@ -556,7 +552,7 @@ class de extends _ {
556
552
  this.#o.set(this.dirty.value || e);
557
553
  };
558
554
  }
559
- class pe extends _ {
555
+ class de extends _ {
560
556
  #e = new Array();
561
557
  length;
562
558
  #s = /* @__PURE__ */ new Map();
@@ -676,7 +672,7 @@ class pe extends _ {
676
672
  this.#o.set(this.dirty.value || e);
677
673
  };
678
674
  }
679
- function fe(s) {
675
+ function pe(s) {
680
676
  function e(t) {
681
677
  return typeof t == "number" ? t : t.toString();
682
678
  }
@@ -684,9 +680,9 @@ function fe(s) {
684
680
  (t) => typeof t == "object" && t.key != null ? e(t.key) : e(t)
685
681
  );
686
682
  }
687
- function be(s) {
683
+ function fe(s) {
688
684
  const e = s.filter((i) => i.path == null || i.path.length === 0).map((i) => i.message), t = s.filter((i) => i.path != null && i.path.length > 0).reduce((i, a) => {
689
- const o = fe(a.path), r = o.pop();
685
+ const o = pe(a.path), r = o.pop();
690
686
  let l = i;
691
687
  for (const d of o)
692
688
  l.dependencies == null && (l.dependencies = {}), l.dependencies[d] == null && (l.dependencies[d] = {}), l = l.dependencies[d];
@@ -698,7 +694,7 @@ function be(s) {
698
694
  message: n != "" ? n : void 0
699
695
  };
700
696
  }
701
- function me({
697
+ function be({
702
698
  initialValue: s,
703
699
  onChange: e,
704
700
  validate: t,
@@ -741,31 +737,31 @@ function me({
741
737
  l.dispose(), o.dispose(), r.dispose(), d.dispose(), p && clearTimeout(p);
742
738
  }), { controller: u, setStatus: h };
743
739
  }
744
- function U(s) {
745
- return P(c.disabled(s.disabled), c.name(s.name));
740
+ function R(s) {
741
+ return $(c.disabled(s.disabled), c.name(s.name));
746
742
  }
747
743
  function Me(s, {
748
744
  triggerOn: e = "change"
749
745
  } = {}) {
750
- return P(
751
- U(s),
746
+ return $(
747
+ R(s),
752
748
  c.value(s.signal),
753
- (e === "input" ? M.input : M.change)(X(s.change))
749
+ (e === "input" ? M.input : M.change)(Q(s.change))
754
750
  );
755
751
  }
756
752
  function Ee(s, {
757
753
  triggerOn: e = "change"
758
754
  } = {}) {
759
- return P(
760
- U(s),
755
+ return $(
756
+ R(s),
761
757
  c.valueAsNumber(s.signal),
762
758
  (e === "input" ? M.input : M.change)(
763
- Y(s.change)
759
+ X(s.change)
764
760
  )
765
761
  );
766
762
  }
767
- function z(s) {
768
- return s.issues != null ? g.invalid(be(s.issues)) : g.valid;
763
+ function N(s) {
764
+ return s.issues != null ? g.invalid(fe(s.issues)) : g.valid;
769
765
  }
770
766
  async function Se({
771
767
  task: s,
@@ -781,11 +777,11 @@ async function Se({
781
777
  return t.length === 1 && t[0] === "root" ? g.invalid({
782
778
  message: a
783
779
  }) : g.invalid({
784
- dependencies: K(t, a)
780
+ dependencies: U(t, a)
785
781
  });
786
782
  }
787
783
  }
788
- function K(s, e) {
784
+ function U(s, e) {
789
785
  if (s.length === 1)
790
786
  return {
791
787
  [s[0]]: { message: e }
@@ -793,7 +789,7 @@ function K(s, e) {
793
789
  const [t, ...n] = s;
794
790
  return {
795
791
  [t]: {
796
- dependencies: K(n, e)
792
+ dependencies: U(n, e)
797
793
  }
798
794
  };
799
795
  }
@@ -804,11 +800,11 @@ function Ve({
804
800
  validationMode: n,
805
801
  validateDebounceMs: i
806
802
  }) {
807
- const { controller: a, setStatus: o } = me({
803
+ const { controller: a, setStatus: o } = be({
808
804
  initialValue: s,
809
805
  validationMode: n ?? "onTouched",
810
806
  validateDebounceMs: i,
811
- validate: (n ?? "onTouched") === "onSubmit" || e == null ? void 0 : async (h) => z(
807
+ validate: (n ?? "onTouched") === "onSubmit" || e == null ? void 0 : async (h) => N(
812
808
  await e["~standard"].validate(h)
813
809
  )
814
810
  }), r = k(!1), l = a.object();
@@ -817,7 +813,7 @@ function Ve({
817
813
  setStatus: o,
818
814
  submit: async (h) => {
819
815
  if (r.set(!0), h?.preventDefault(), l.markAllTouched(), e != null) {
820
- const v = l.signal.value, w = z(
816
+ const v = l.signal.value, w = N(
821
817
  await e["~standard"].validate(v)
822
818
  );
823
819
  if (o(w), w.type === "invalid") {
@@ -832,33 +828,32 @@ function Ve({
832
828
  };
833
829
  }
834
830
  export {
835
- pe as A,
836
- R as B,
831
+ de as A,
832
+ W as B,
837
833
  we as C,
838
- W as I,
834
+ L as I,
839
835
  Te as M,
840
836
  E as O,
841
- ie as R,
837
+ ne as R,
842
838
  De as a,
843
839
  Ce as b,
844
- N as c,
840
+ F as c,
845
841
  _ as d,
846
842
  B as e,
847
- de as f,
848
- me as g,
849
- ce as h,
850
- ue as i,
843
+ ue as f,
844
+ be as g,
845
+ le as h,
846
+ he as i,
851
847
  Ie as j,
852
- fe as k,
853
- be as l,
854
- le as m,
855
- U as n,
848
+ pe as k,
849
+ fe as l,
850
+ oe as m,
851
+ R as n,
856
852
  Me as o,
857
853
  _e as p,
858
854
  Ee as q,
859
- z as r,
860
- j as s,
855
+ N as s,
861
856
  Se as t,
862
857
  Ve as u,
863
- he as w
858
+ ce as w
864
859
  };
@@ -0,0 +1,2 @@
1
+ "use strict";const t=require("@tempots/dom"),E=require("./translations-B4-Zd2LM.cjs"),j=require("./input-container-C6qEIjcA.cjs"),m=require("./stack-DcZ_u50f.cjs"),_=require("./session-id-B5lJMzbB.cjs"),C=(n,e)=>n===e||n!==n&&e!==e;function G({size:n="sm",icon:e="line-md:close",disabled:s,roundedness:i="full",color:r="base",onClick:o,label:l},...a){return t.Use(E.BeatUII18n,c=>{const d=t.coalesce(l,c.$.closeModal);return j.Button({variant:"text",size:n,roundedness:i,disabled:s,color:r,onClick:o},t.attr.title(d),t.aria.label(d),...a,E.Icon({icon:e,size:n??"sm"}))})}const J=n=>{const{value:e,onBlur:s,onChange:i,placeholder:r,disabled:o,id:l,checkedIcon:a,uncheckedIcon:c,iconSize:d="lg"}=n,h=l??_.sessionId("checkbox"),p=`${h}-label`,g=()=>{if(t.Value.get(o??!1))return;const u=t.Value.get(e);i?.(!u)},y=u=>{t.Value.get(o??!1)||(u.key===" "||u.key==="Enter")&&(u.preventDefault(),g())};return j.InputContainer({baseContainer:!0,growInput:!1,...n,input:t.html.span(t.attr.class("bc-checkbox-input"),t.html.span(t.attr.class("bc-checkbox-input__checkbox"),t.attr.class(t.Value.map(e,u=>u?"bc-checkbox-input__checkbox--checked":"bc-checkbox-input__checkbox--unchecked")),t.attr.class(t.Value.map(o??!1,u=>u?"bc-checkbox-input__checkbox--disabled":"")),t.attr.id(h),t.attr.role("checkbox"),t.attr.tabindex(t.Value.map(o??!1,u=>u?-1:0)),t.aria.checked(e),t.aria.disabled(o),r!=null?t.aria.labelledby(p):t.Empty,t.on.keydown(y),s!=null?t.on.blur(s):t.Empty,E.Icon({icon:t.computedOf(e,a,c)((u,f,v)=>u?f??"akar-icons/check-box-fill":v??"akar-icons/box"),accessibility:"decorative",size:d})),r!=null?t.html.label(t.attr.class("bc-checkbox-input__label"),t.attr.id(p),t.attr.for(h),m.MutedLabel(r)):t.Empty)},t.on.click(g))},P=t.html.span(t.attr.class("bc-input-wrapper__required")," *");function Q(n){const e=["bc-input-wrapper"];return n!=="vertical"&&e.push(`bc-input-wrapper--${n}`),e.join(" ")}function X(n,e){const s=["bc-input-wrapper__label-text"];return n?s.push("bc-input-wrapper__label-text--error"):e?s.push("bc-input-wrapper__label-text--disabled"):s.push("bc-input-wrapper__label-text--default"),s.join(" ")}function Y(n,e){if(n==="horizontal-fixed"&&e!=null)return`--input-wrapper-label-width: ${e}`}const M=({fullWidth:n=!1,required:e,label:s,labelChildren:i,context:r,description:o,content:l,error:a,labelFor:c,hasError:d,disabled:h,layout:p,labelWidth:g},...y)=>{const u=d??a!=null,f=h??!1,v=p??"vertical",D=_.sessionId("input-wrapper"),I=o?`${D}-description`:void 0,V=a!=null?`${D}-error`:void 0,B=t.computedOf(v)(b=>b!=="vertical"),K=t.computedOf(v,g??void 0)((b,w)=>Y(b,w));return t.html.div(t.attr.class(t.Value.map(v,b=>Q(b))),t.attr.class(t.Value.map(n,b=>b?"bc-input-wrapper--full-width":"")),t.attr.style(K),s!=null||r!=null?t.html.div(t.attr.class("bc-input-wrapper__header"),t.html.div(t.attr.class("bc-input-wrapper__label-section"),t.html.label(t.attr.class("bc-input-wrapper__label"),c!=null?t.attr.for(c):t.Empty,t.html.span(t.attr.class(t.computedOf(u,f)((b,w)=>X(b??!1,w??!1))),s),s!=null&&e?P:t.Empty),t.When(t.computedOf(B,o)((b,w)=>b&&w!=null),()=>t.html.div(t.attr.class("bc-input-wrapper__description bc-input-wrapper__description--under-label"),t.attr.id(I),o))),r!=null?m.Label(r):t.Empty,i):t.Empty,t.html.div(t.attr.class("bc-input-wrapper__content"),[I,V].filter(Boolean).length>0?t.dataAttr.describedby([I,V].filter(Boolean).join(" ")):t.Empty,e?t.dataAttr.required("true"):t.Empty,t.When(u,()=>t.dataAttr.invalid("true")),l),t.When(t.computedOf(B,o)((b,w)=>!b&&w!=null),()=>t.html.div(t.attr.class("bc-input-wrapper__description"),t.attr.id(I),o)),t.When(u,()=>t.html.div(t.attr.class("bc-input-wrapper__error"),t.attr.id(V),t.aria.live("polite"),t.attr.role("alert"),a)),...y)},H=((n,e)=>()=>{n.markTouched(),e?.()}),O=(n,e)=>s=>{n.change(s),e?.(s)};function x(n,e){const{controller:s,onBlur:i,onChange:r,id:o,triggerOn:l,...a}=e;return n({id:o??s.name,disabled:s.disabled,value:s.signal,hasError:s.errorVisible,name:s.name,...a,onInput:l==="input"?O(s,r):void 0,onChange:l!=="input"?O(s,r):void 0,onBlur:H(s,i)})}function Z(n,{id:e,labelFor:s,...i},...r){const o=e??i.controller.name??_.sessionId("control"),l=s??o;return M({...i,hasError:i.controller.errorVisible,error:t.TextNode(i.controller.error.map(a=>a??"")),labelFor:l,content:x(a=>n({...a,id:o}),i)},...r)}function F(n,e){const{toInput:s,fromInput:i,controller:r,...o}=e,l=r.transform(s,i);return x(n,{...o,controller:l})}function ee(n,{id:e,labelFor:s,...i},...r){const o=e??i.controller.name??_.sessionId("control");return M({...i,labelFor:s??o,content:F(n,{...i,id:o})},...r)}function te(n){return n.split(".").map(s=>{const i=s.match(/^\[(\d+)\]$/);return i?Number(i[1]):s})}function $(n){return typeof n=="number"?`[${n}]`:`.${n}`}function W(n){if(n.length===0)return"";const[e,...s]=n;return[typeof e=="number"?`[${e}]`:e,...s.map($)].join("")}const se={valid:m.i.valid,invalid(n){return m.i.invalid({message:n})},invalidFields(n){const e={};for(const[s,i]of Object.entries(n))e[s]=typeof i=="string"?{message:i}:i;return m.i.invalid({dependencies:e})},fromError(n){return m.i.invalid(n)}};function T(n){return function(s){if(s.type==="valid")return s;let i=s.error;for(const r of n)if(i=i?.dependencies?.[r],i==null)return m.i.valid;return m.i.invalid(i)}}class k{path;change;signal;status;error;hasError;touched;errorVisible;dirty;dependencyErrors;#e={disabled:t.prop(!1),touched:t.prop(!1)};#s;#t=t.prop(void 0);parent;disabled;#n=[];disabledOrHasErrors;constructor(e,s,i,r,o,l=C){this.path=e,this.change=s,this.signal=i,this.status=r,this.#s=l,this.#t.set(i.value),this.error=r.map(a=>a?.type==="invalid"?a.error?.message:void 0),this.hasError=this.error.map(a=>a!=null),this.touched=this.#e.touched,o.validationMode?this.errorVisible=t.computedOf(this.hasError,this.touched,o.validationMode)((a,c,d)=>d==="eager"?!!a:!!a&&!!c):this.errorVisible=t.computedOf(this.hasError,this.touched)((a,c)=>!!a&&!!c),this.dirty=t.computedOf(this.signal,this.#t)((a,c)=>!this.#s(a,c)),this.dependencyErrors=r.map(a=>a?.type==="invalid"?a.error?.dependencies:void 0),this.parent=o,this.disabled=t.computedOf(this.#e.disabled,o.disabled)((a,c)=>a||c),this.disabledOrHasErrors=t.computedOf(this.disabled,this.hasError)((a,c)=>a||c),this.onDispose(()=>{this.#e.disabled.dispose(),this.#e.touched.dispose(),this.disabled.dispose(),this.error.dispose(),this.errorVisible.dispose(),this.dirty.dispose(),this.#t.dispose(),this.dependencyErrors.dispose(),this.disabledOrHasErrors.dispose()})}get name(){return W(this.path)}onDispose=e=>{this.#n.push(e)};dispose=()=>{for(const e of this.#n)try{e()}catch(s){console.error("Error in dispose callback:",s)}this.#n.length=0};setDisabled=e=>{this.#e.disabled.set(e)};disable=()=>this.setDisabled(!0);enable=()=>this.setDisabled(!1);markTouched=()=>{this.#e.touched.set(!0)};resetTouched=()=>{this.#e.touched.set(!1)};markPristine=()=>{this.#t.set(this.signal.value)};reset=()=>{this.change(this.#t.value)};array=(e=C)=>new q(this.path,this.change,this.signal,this.status,this.parent,e);object=(e=C)=>new N(this.path,this.change,this.signal,this.status,this.parent,e);transform=(e,s,i=[],r=C)=>new k([...this.path,...i],o=>this.change(s(o)),this.signal.map(e,r),this.status.map(T(i)),this.parent,r);asyncTransform=(e,s,i,r=[],o=C)=>new k([...this.path,...r],l=>{s(l).then(a=>this.change(a))},this.signal.mapAsync(e,i,void 0,o),this.status.map(T(r)),this.parent,o)}class N extends k{#e=new Map;#s=new Map;#t=new Map;#n=t.prop(!1);touchedDeep=this.#n;#r=new Map;#i=new Map;#o=t.prop(!1);dirtyDeep=this.#o;#c;#h;#l=()=>{let e=!1;for(const s of this.#s.values())if(s){e=!0;break}this.#n.set(this.touched.value||e)};constructor(e,s,i,r,o,l){super(e,s,i.map(c=>c??{},l),r,o,l),this.#c=this.touched.on(()=>{this.#l()}),this.#h=this.dirty.on(()=>{this.#a()});const a=this.signal.on(()=>this.#a());this.onDispose(()=>{for(const c of this.#e.values())c.dispose();this.#e.clear();for(const c of this.#t.values())c();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const c of this.#i.values())c();this.#i.clear(),this.#r.clear(),this.#o.dispose(),this.#c(),this.#h(),a()})}field=e=>{if(this.#e.has(e))return this.#e.get(e);const s=async l=>{this.change({...this.signal.value,[e]:l})},i=new k([...this.path,e],s,this.signal.map(l=>l[e]),this.status.map(T([e])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e.set(e,i);const r=i.touched.on(l=>{this.#s.set(e,l),this.#l()});this.#t.set(e,r);const o=i.dirty.on(l=>{this.#r.set(e,l),this.#a()});return this.#i.set(e,o),i};markAllTouched=()=>{this.markTouched();const e=this.signal.value;for(const s of Object.keys(e))this.field(s).markTouched();for(const s of this.#e.values())s.markTouched()};markAllPristine=()=>{this.markPristine();const e=this.signal.value;for(const s of Object.keys(e))this.field(s).markPristine?.();for(const s of this.#e.values())s.markPristine?.()};#a=()=>{let e=!1;for(const s of this.#r.values())if(s){e=!0;break}this.#o.set(this.dirty.value||e)}}class q extends k{#e=new Array;length;#s=new Map;#t=new Map;#n=t.prop(!1);touchedDeep=this.#n;#r=new Map;#i=new Map;#o=t.prop(!1);dirtyDeep=this.#o;#c;#h;#l=()=>{let e=!1;for(const s of this.#s.values())if(s){e=!0;break}this.#n.set(this.touched.value||e)};constructor(e,s,i,r,o,l){const a=i.map(h=>h??[],l);super(e,s,a,r,o,l);const c=a.on(h=>{const p=this.#e.length-h.length;p>0&&(this.#e.splice(h.length,p).forEach((g,y)=>{const u=h.length+y;g.dispose(),this.#t.get(u)?.(),this.#t.delete(u),this.#s.delete(u),this.#i.get(u)?.(),this.#i.delete(u),this.#r.delete(u)}),this.#l(),this.#a())});this.length=a.map(h=>h.length),this.#c=this.touched.on(()=>{this.#l()}),this.#h=this.dirty.on(()=>{this.#a()});const d=this.signal.on(()=>this.#a());this.onDispose(()=>{for(const h of this.#e)h.dispose();this.length.dispose(),this.#e.length=0,c(),a.dispose();for(const h of this.#t.values())h();this.#t.clear(),this.#s.clear(),this.#n.dispose();for(const h of this.#i.values())h();this.#i.clear(),this.#r.clear(),this.#o.dispose(),this.#c(),this.#h(),d()})}item=e=>{if(this.#e[e])return this.#e[e];const s=async l=>{const a=this.signal.value.slice();a[e]=l,this.change(a)},i=new k([...this.path,e],s,this.signal.map(l=>l[e]),this.status.map(T([e])),{disabled:this.disabled,validationMode:this.parent.validationMode});this.#e[e]=i;const r=i.touched.on(l=>{this.#s.set(e,l),this.#l()});this.#t.set(e,r);const o=i.dirty.on(l=>{this.#r.set(e,l),this.#a()});return this.#i.set(e,o),i};push=(...e)=>{this.change([...this.signal.value,...e])};pop=()=>{this.splice(this.signal.value.length-1,1)};shift=()=>{this.splice(0,1)};unshift=(...e)=>{this.change([...e,...this.signal.value])};removeAt=e=>{this.splice(e,1)};splice=(e,s)=>{const i=this.signal.value.slice();i.splice(e,s),this.change(i)};move=(e,s,i=1)=>{if(i<1||e===s)return;const r=this.signal.value.slice(),o=r.splice(e,i);r.splice(s,0,...o),this.change(r)};markAllTouched=()=>{this.markTouched();const e=this.signal.value.length;for(let s=0;s<e;s++)this.item(s).markTouched()};markAllPristine=()=>{this.markPristine();const e=this.signal.value.length;for(let s=0;s<e;s++)this.item(s).markPristine?.()};#a=()=>{let e=!1;for(const s of this.#r.values())if(s){e=!0;break}this.#o.set(this.dirty.value||e)}}function z(n){function e(s){return typeof s=="number"?s:s.toString()}return n.map(s=>typeof s=="object"&&s.key!=null?e(s.key):e(s))}function L(n){const e=n.filter(r=>r.path==null||r.path.length===0).map(r=>r.message),s=n.filter(r=>r.path!=null&&r.path.length>0).reduce((r,o)=>{const l=z(o.path),a=l.pop();let c=r;for(const d of l)c.dependencies==null&&(c.dependencies={}),c.dependencies[d]==null&&(c.dependencies[d]={}),c=c.dependencies[d];return c.dependencies==null&&(c.dependencies={}),c.dependencies[a]={message:o.message},r},{}),i=e.join(`
2
+ `);return{...s,message:i!=""?i:void 0}}function R({initialValue:n,onChange:e,validate:s,equals:i,validationMode:r,validateDebounceMs:o}){const l=t.Value.deriveProp(n),a=t.prop(m.i.valid),c=t.prop(!1),d=t.prop(r??"onTouched"),h=f=>{a.set(f)};let p;const g=async f=>{if(s!=null){const v=await s(f);h(v)}},y=async f=>{l.set(f),e?.(f);const v=d.value;if(s!=null){if(v==="onSubmit")return;const D=o??0;D>0?(p&&clearTimeout(p),p=setTimeout(()=>{g(f)},D)):await g(f)}},u=new k([],y,l,a,{disabled:c,validationMode:d},i??C);return u.onDispose(()=>{c.dispose(),l.dispose(),a.dispose(),d.dispose(),p&&clearTimeout(p)}),{controller:u,setStatus:h}}function A(n){return t.Fragment(t.attr.disabled(n.disabled),t.attr.name(n.name))}function ne(n,{triggerOn:e="change"}={}){return t.Fragment(A(n),t.attr.value(n.signal),(e==="input"?t.on.input:t.on.change)(t.emitValue(n.change)))}function ie(n,{triggerOn:e="change"}={}){return t.Fragment(A(n),t.attr.valueAsNumber(n.signal),(e==="input"?t.on.input:t.on.change)(t.emitValueAsNumber(n.change)))}function S(n){return n.issues!=null?m.i.invalid(L(n.issues)):m.i.valid}async function re({task:n,errorMessage:e,errorPath:s=["root"],validation:i}){try{const r=await n();return i!=null?i(r):m.i.valid}catch(r){const o=e??(r instanceof Error?r.message:"Operation failed");return s.length===1&&s[0]==="root"?m.i.invalid({message:o}):m.i.invalid({dependencies:U(s,o)})}}function U(n,e){if(n.length===1)return{[n[0]]:{message:e}};const[s,...i]=n;return{[s]:{dependencies:U(i,e)}}}function ae({initialValue:n={},schema:e,onSubmit:s=async()=>m.i.valid,validationMode:i,validateDebounceMs:r}){const{controller:o,setStatus:l}=R({initialValue:n,validationMode:i??"onTouched",validateDebounceMs:r,validate:(i??"onTouched")==="onSubmit"||e==null?void 0:async h=>S(await e["~standard"].validate(h))}),a=t.prop(!1),c=o.object();return c.onDispose(a.dispose),{controller:c,setStatus:l,submit:async h=>{if(a.set(!0),h?.preventDefault(),c.markAllTouched(),e!=null){const g=c.signal.value,y=S(await e["~standard"].validate(g));if(l(y),y.type==="invalid"){a.set(!1);return}}const p=await s(c.signal.value);a.set(!1),p.type==="invalid"&&l(p)},submitting:a}}exports.ArrayController=q;exports.BaseControl=x;exports.BaseMappedControl=F;exports.CheckboxInput=J;exports.CloseButton=G;exports.Control=Z;exports.Controller=k;exports.ControllerValidation=se;exports.InputWrapper=M;exports.MappedControl=ee;exports.O=C;exports.ObjectController=N;exports.RequiredSymbol=P;exports.connectCommonAttributes=A;exports.connectNumberInput=ie;exports.connectStringInput=ne;exports.convertStandardSchemaIssues=L;exports.convertStandardSchemaPathToPath=z;exports.makeMapValidation=T;exports.makeOnBlurHandler=H;exports.makeOnChangeHandler=O;exports.parsePath=te;exports.pathToString=W;exports.standardSchemaResultToValidation=S;exports.taskToValidation=re;exports.useController=R;exports.useForm=ae;exports.wrapSegment=$;
@@ -0,0 +1 @@
1
+ "use strict";const t=require("@tempots/dom"),F=require("./deep-merge-d7sf0xmN.cjs"),ut=require("./string-B9vVyfq3.cjs"),D=require("./input-container-C6qEIjcA.cjs"),S=require("./text-input-Ds8e7Z1G.cjs"),k=require("./translations-B4-Zd2LM.cjs"),X=require("@tempots/ui"),z=require("./notice-CLDdy1MW.cjs"),pt=require("./session-id-B5lJMzbB.cjs"),dt=require("./utils-DIUEhA-Z.cjs");function q(e){if(typeof e!="string")return!1;const n=e.startsWith("#")?e.slice(1):e;return/^[0-9A-Fa-f]{3}$|^[0-9A-Fa-f]{6}$/.test(n)}function Y(e){if(typeof e!="string")return!1;const n=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,o,s]=r,l=parseInt(a,10),i=parseInt(o,10),c=parseInt(s,10);return l>=0&&l<=255&&i>=0&&i<=255&&c>=0&&c<=255}function G(e){if(typeof e!="string")return!1;const n=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,o,s,l]=r,i=parseInt(a,10),c=parseInt(o,10),u=parseInt(s,10),p=parseFloat(l);return i>=0&&i<=255&&c>=0&&c<=255&&u>=0&&u<=255&&p>=0&&p<=1}function K(e){if(typeof e!="string")return!1;const n=/^hsl\(\s*(\d{1,3})\s*,\s*(\d{1,3})%\s*,\s*(\d{1,3})%\s*\)$/i,r=e.match(n);if(!r)return!1;const[,a,o,s]=r,l=parseInt(a,10),i=parseInt(o,10),c=parseInt(s,10);return l>=0&&l<=360&&i>=0&&i<=100&&c>=0&&c<=100}function gt(e){return q(e)||Y(e)||G(e)||K(e)}function Q(e){if(!q(e))return null;let n=e.startsWith("#")?e.slice(1):e;return n.length===3&&(n=n.split("").map(r=>r+r).join("")),`#${n.toLowerCase()}`}function W(e,n,r){const a=o=>{const s=Math.round(Math.max(0,Math.min(255,o))).toString(16);return s.length===1?"0"+s:s};return`#${a(e)}${a(n)}${a(r)}`}function E(e){const n=Q(e);if(!n)return null;const r=/^#([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16)}:null}function ht(e,n){const r=E(e),a=E(n);if(!r||!a)return null;const o=(u,p,h)=>{const[f,d,y]=[u,p,h].map(I=>(I=I/255,I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4)));return .2126*f+.7152*d+.0722*y},s=o(r.r,r.g,r.b),l=o(a.r,a.g,a.b),i=Math.max(s,l),c=Math.min(s,l);return(i+.05)/(c+.05)}function Z(e){if(!e)return[0,0,0,1];const r=e.trim().match(/^#?([a-fA-F0-9]{3,4}|[a-fA-F0-9]{6}|[a-fA-F0-9]{8})$/);if(r){const u=r[1];if(u.length===8){const p=parseInt(u.slice(0,2),16),h=parseInt(u.slice(2,4),16),f=parseInt(u.slice(4,6),16),d=parseInt(u.slice(6,8),16)/255;return[p,h,f,d]}if(u.length===6)return[parseInt(u.slice(0,2),16),parseInt(u.slice(2,4),16),parseInt(u.slice(4,6),16),1];if(u.length===4){const p=parseInt(u[0]+u[0],16),h=parseInt(u[1]+u[1],16),f=parseInt(u[2]+u[2],16),d=parseInt(u[3]+u[3],16)/255;return[p,h,f,d]}if(u.length===3){const p=parseInt(u[0]+u[0],16),h=parseInt(u[1]+u[1],16),f=parseInt(u[2]+u[2],16);return[p,h,f,1]}}const a=e.match(/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|0?\.\d+)\s*\)$/i);if(a)return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10),parseFloat(a[4])];const o=e.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i);if(o)return[parseInt(o[1],10),parseInt(o[2],10),parseInt(o[3],10),1];const s=e.match(/^hsla?\(\s*([+-]?[\d.]+)(?:deg)?\s*[ ,]?\s*([\d.]+)%\s*[ ,]?\s*([\d.]+)%\s*(?:[/,]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(s){const u=parseFloat(s[1]),p=parseFloat(s[2]),h=parseFloat(s[3]),f=s[4]!=null?parseFloat(s[4]):1,[d,y,I]=j(u,p/100,h/100);return[d,y,I,f]}const l=e.match(/^hwb\(\s*([+-]?[\d.]+)(?:deg)?\s*[, ]\s*([\d.]+)%\s*[, ]\s*([\d.]+)%\s*(?:[/]\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(l){const u=parseFloat(l[1]),p=parseFloat(l[2])/100,h=parseFloat(l[3])/100,f=l[4]!=null?parseFloat(l[4]):1,[d,y,I]=et(u,p,h);return[d,y,I,f]}const i=e.match(/^oklch\(\s*([+-]?[\d.]+%?)\s+([\d.]+)\s+([+-]?[\d.]+)(?:deg)?(?:\s*\/\s*(\d?(?:\.\d+)?))?\s*\)$/i);if(i){const u=i[1],p=parseFloat(i[2]),h=parseFloat(i[3]),f=i[4]!=null?parseFloat(i[4]):1,d=u.endsWith("%")?Math.max(0,Math.min(1,parseFloat(u)/100)):Math.max(0,Math.min(1,parseFloat(u))),[y,I,b]=at(d,p,h);return[y,I,b,f]}const c=E(e);return c?[c.r,c.g,c.b,1]:[0,0,0,1]}function J(e,n,r,a){return`rgba(${Math.round(e)}, ${Math.round(n)}, ${Math.round(r)}, ${Math.max(0,Math.min(1,Math.round(a*100)/100))})`}function tt(e){let n=e+1831565813;return function(){return n=Math.imul(n^n>>>15,n|1),n^=n+Math.imul(n^n>>>7,n|61),((n^n>>>14)>>>0)/4294967296}}function j(e,n,r){e=(e%360+360)%360;const a=(1-Math.abs(2*r-1))*n,o=a*(1-Math.abs(e/60%2-1)),s=r-a/2;let l=0,i=0,c=0;return 0<=e&&e<60?[l,i,c]=[a,o,0]:60<=e&&e<120?[l,i,c]=[o,a,0]:120<=e&&e<180?[l,i,c]=[0,a,o]:180<=e&&e<240?[l,i,c]=[0,o,a]:240<=e&&e<300?[l,i,c]=[o,0,a]:[l,i,c]=[a,0,o],[Math.round((l+s)*255),Math.round((i+s)*255),Math.round((c+s)*255)]}function et(e,n,r){e=(e%360+360)%360;const a=n+r;a>1&&(n/=a,r/=a);const[o,s,l]=j(e,1,.5).map(h=>h/255),i=1-n-r,c=o*i+n,u=s*i+n,p=l*i+n;return[Math.round(c*255),Math.round(u*255),Math.round(p*255)]}function L(e,n,r){e/=255,n/=255,r/=255;const a=Math.max(e,n,r),o=Math.min(e,n,r);let s=0,l=0;const i=(a+o)/2,c=a-o;if(c!==0){switch(l=i>.5?c/(2-a-o):c/(a+o),a){case e:s=(n-r)/c+(n<r?6:0);break;case n:s=(r-e)/c+2;break;default:s=(e-n)/c+4}s*=60}return[Math.round(s),Math.round(l*100),Math.round(i*100)]}function nt(e,n,r){const[a]=L(e,n,r),o=e/255,s=n/255,l=r/255,i=Math.min(o,s,l),c=1-Math.max(o,s,l);return[a,Math.round(i*100),Math.round(c*100)]}function O(e){const n=e/255;return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function U(e){const n=e<=.0031308?12.92*e:1.055*Math.pow(e,.4166666666666667)-.055;return Math.round(Math.max(0,Math.min(1,n))*255)}function at(e,n,r){const a=r*Math.PI/180,o=Math.cos(a)*n,s=Math.sin(a)*n,l=e+.3963377774*o+.2158037573*s,i=e-.1055613458*o-.0638541728*s,c=e-.0894841775*o-1.291485548*s,u=l*l*l,p=i*i*i,h=c*c*c,f=4.0767416621*u-3.3077115913*p+.2309699292*h,d=-1.2684380046*u+2.6097574011*p-.3413193965*h,y=-.0041960863*u-.7034186147*p+1.707614701*h;return[U(f),U(d),U(y)]}function rt(e,n,r){const a=O(e),o=O(n),s=O(r),l=.4122214708*a+.5363325363*o+.0514459929*s,i=.2119034982*a+.6806995451*o+.1073969566*s,c=.0883024619*a+.2817188376*o+.6299787005*s,u=Math.cbrt(l),p=Math.cbrt(i),h=Math.cbrt(c),f=.2104542553*u+.793617785*p-.0040720468*h,d=1.9779984951*u-2.428592205*p+.4505937099*h,y=.0259040371*u+.7827717662*p-.808675766*h,I=Math.sqrt(d*d+y*y);let b=Math.atan2(y,d)*180/Math.PI;return b<0&&(b+=360),[f,I,b]}function R(e,n,r,a,o,s){switch(o){case"hex":if(s){const l=c=>c.toString(16).padStart(2,"0"),i=Math.max(0,Math.min(255,Math.round(a*255)));return`#${l(e)}${l(n)}${l(r)}${l(i)}`}return W(e,n,r);case"rgb":return`rgb(${e}, ${n}, ${r})`;case"rgba":return`rgba(${e}, ${n}, ${r}, ${Math.round(a*100)/100})`;case"hsl":{const[l,i,c]=L(e,n,r);return`hsl(${l}, ${i}%, ${c}%)`}case"hsla":{const[l,i,c]=L(e,n,r);return`hsla(${l}, ${i}%, ${c}%, ${Math.round(a*100)/100})`}case"hwb":{const[l,i,c]=nt(e,n,r);return a<1?`hwb(${l} ${i}% ${c}% / ${Math.round(a*100)/100})`:`hwb(${l} ${i}% ${c}%)`}case"oklch":{const[l,i,c]=rt(e,n,r),u=(Math.round(l*1e3)/1e3).toFixed(3),p=(Math.round(i*1e3)/1e3).toFixed(3),h=(Math.round(c*10)/10).toFixed(1),f=Math.round(a*100)/100;return s||a<1?`oklch(${u} ${p} ${h} / ${f})`:`oklch(${u} ${p} ${h})`}}}function v(e,n){return n?e==="rgb"?"rgba":e==="hsl"?"hsla":e:e==="rgba"?"rgb":e==="hsla"?"hsl":e}async function st(e){return new Promise((n,r)=>{const a=new FileReader;a.readAsDataURL(e),a.onload=()=>{const o=a.result;n(o.split(",")[1])},a.onerror=o=>r(o)})}function mt(e){return Promise.all(e.map(st))}function ft(e){if(e.length>=4){if(e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71)return"image/png";if(e[0]===255&&e[1]===216)return"image/jpeg";if(e[0]===71&&e[1]===73&&e[2]===70)return"image/gif";if(e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e.length>=12&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80)return"image/webp"}try{if(new TextDecoder("utf-8").decode(e.slice(0,256)).includes("<svg"))return"image/svg+xml"}catch{}return"application/octet-stream"}function bt(e){const n=ut.$t(e??""),r=n.length,a=new Uint8Array(r);for(let o=0;o<r;o++)a[o]=n.charCodeAt(o);return a}function ot(e){const{value:n,onChange:r,onInput:a,...o}=e,s=new Map,l=t.Value.toSignal(n).map(p=>p.map((h,f)=>{const d=s.get(h),y=bt(h??""),I=d?.type||ft(y),b=d?.name??`file-${f}`,V=y.buffer.slice(y.byteOffset,y.byteOffset+y.byteLength),m=new Blob([V],{type:I});return new File([m],b,{type:I})})),i=p=>h=>{p&&mt(h).then(f=>{for(const[d,y]of f.entries())s.set(y,{name:h[d].name,type:h[d].type});p(f)})},c=i(r),u=i(a);return F.FilesInput({...o,value:l,onChange:c,onInput:u})}function yt(e){const{value:n,onInput:r,onChange:a,...o}=e;return ot({...o,maxFiles:1,value:t.Value.map(n,s=>s==null?[]:[s]),onChange:s=>{a?.(s[0])},onInput:s=>{r?.(s[0])}})}function It(e,n){const[r,a,o]=e,s=r<<16^a<<8^o,l=tt(s),i=6+Math.floor(l()*5),c=.18+l()*.06,u=[];for(let d=0;d<i;d++){const y=d/i*Math.PI*2,I=n*(1+(l()*2-1)*c),b=Math.cos(y)*I,V=Math.sin(y)*I;u.push({x:b,y:V})}const p=(u[0].x+u[i-1].x)/2,h=(u[0].y+u[i-1].y)/2;let f=`M ${p.toFixed(3)} ${h.toFixed(3)}`;for(let d=0;d<i;d++){const y=u[d],I=u[(d+1)%i],b=(y.x+I.x)/2,V=(y.y+I.y)/2;f+=` Q ${y.x.toFixed(3)} ${y.y.toFixed(3)} ${b.toFixed(3)} ${V.toFixed(3)}`}return f+=" Z",f}const wt=e=>{const{value:n,onBlur:r,onChange:a,onInput:o,displayValue:s,size:l,withAlpha:i}=e,c=t.Value.map(l??32,g=>g),u=t.Value.map(n,g=>Z(g??"#000000")),p=t.Value.map(u,([g,w,x])=>[g,w,x]),h=t.Value.map(u,([,,,g])=>g),f=t.prop(t.Value.get(h)??1),d=t.Value.map(i??!1,g=>g),y=t.Value.map(e.colorTextFormat??"rgb",g=>g),I=t.computedOf(p,f,y,d)(([g,w,x],C,A,T)=>R(g,w,x,C??1,v(A,T),T)),b=t.Value.map(e.colorTextFormat??"hex",g=>g),V=t.Value.map(c,g=>`${-g/2} ${-g/2} ${g} ${g}`),m=t.computedOf(p,c)((g,w)=>It(g,w/2)),_=t.computedOf(p,f,d)(([g,w,x],C,A)=>A||C<1?J(g,w,x,C):W(g,w,x)),M=t.html.div(t.attr.class("bc-color-swatch-input__control"),t.attr.class(t.Value.map(d,g=>g?"bc-color-swatch-input__control--alpha":"")),t.attr.style(t.computedOf(c)(g=>`min-width:${g+2}px;height:${g+2}px`)),t.svg.svg(t.attr.class("bc-color-swatch-input__svg"),t.svgAttr.viewBox(V),t.svg.path(t.svgAttr.d(m),t.svgAttr.fill(_))),t.html.input(t.attr.type("color"),S.CommonInputAttributes(e),t.attr.value(t.Value.map(p,([g,w,x])=>W(g,w,x))),t.attr.class("bc-input bc-color-swatch-input bc-color-swatch-input__native"),r!=null?t.on.blur(r):t.Empty,a!=null?t.on.change(g=>{const w=g.target.value;if(!a)return;const{r:x,g:C,b:A}=E(w)??{r:0,g:0,b:0},T=t.Value.get(f)??1,N=v(t.Value.get(b),t.Value.get(d)),H=R(x,C,A,T,N,t.Value.get(d));a(H)}):t.Empty,o!=null?t.on.input(g=>{const w=g.target.value;if(!o)return;const{r:x,g:C,b:A}=E(w)??{r:0,g:0,b:0},T=t.Value.get(f)??1,N=v(t.Value.get(b),t.Value.get(d)),H=R(x,C,A,T,N,t.Value.get(d));o(H)}):t.Empty)),$=t.When(d,()=>t.html.input(t.attr.type("range"),t.attr.class("bc-color-swatch-input__alpha"),t.attr.min(0),t.attr.max(1),t.attr.step(.01),t.attr.value(t.Value.map(f,g=>String(g??1))),t.attr.disabled(e.disabled),t.on.input(g=>{const w=parseFloat(g.target.value);f.set(w);const[x,C,A]=t.Value.get(p),T=v(t.Value.get(b),t.Value.get(d)),N=R(x,C,A,w,T,t.Value.get(d));o?.(N)}),t.on.change(g=>{const w=parseFloat(g.target.value);f.set(w);const[x,C,A]=t.Value.get(p),T=v(t.Value.get(b),t.Value.get(d)),N=R(x,C,A,w,T,t.Value.get(d));a?.(N)})));return D.InputContainer({baseContainer:!0,...e,growInput:!1,input:M,after:t.Fragment(t.When(s??!1,()=>t.html.span(t.attr.class("bc-color-swatch-input__rgb"),I)),$,e.after)})},Vt=({startEditing:e,value:n,onChange:r,placeholder:a,disabled:o})=>{const s=t.Value.deriveProp(e??!1),l=t.prop(!1),i=t.Value.map(o??!1,c=>c);return t.html.div(t.attr.class("bc-editable-text"),t.attr.class(t.Value.map(i,c=>c?"bc-editable-text--disabled":"")),t.aria.disabled(i),t.When(s,()=>t.html.input(t.attr.placeholder(a),t.attr.value(n),t.attr.class("bc-editable-text__input"),X.AutoSelect(),t.on.keydown(c=>{c.key==="Enter"?s.set(!1):c.key==="Escape"&&(l.set(!0),s.set(!1))}),t.on.blur(t.emitValue(c=>{if(s.set(!1),l.value){l.set(!1);return}r(c)}))),()=>t.html.span(t.on.click(()=>{t.Value.get(i)||s.set(!0)}),t.attr.class("bc-editable-text__display"),t.When(t.Value.map(n,c=>c!=null&&c.trim()!==""),()=>t.html.span(t.attr.class("bc-editable-text__text"),n),()=>t.html.span(t.attr.class("bc-editable-text__placeholder"),a)),t.When(t.Value.map(i,c=>!c),()=>t.html.button(t.attr.type("button"),t.attr.class("bc-editable-text__edit-button"),t.Use(k.BeatUII18n,c=>t.aria.label(c.$.editLabel)),t.on.click(()=>s.set(!0)),k.Icon({icon:"line-md/pencil",color:"neutral"}))))))},$t=e=>{const{value:n,onBlur:r,onChange:a,onInput:o,after:s,disabled:l}=e,i=F.NullableResetAfter(n,l,a??o);return D.InputContainer({...e,input:t.input.date(S.CommonInputAttributes(e),t.attr.valueAsDate(n),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDate(a)):t.Empty,o!=null?t.on.input(t.emitValueAsNullableDate(o)):t.Empty),after:s!=null?t.Fragment(i,s):i})},xt=e=>{const n=e.getFullYear(),r=e.getMonth()+1,a=e.getDate(),o=e.getHours(),s=e.getMinutes(),l=e.getSeconds();return`${n}-${r.toString().padStart(2,"0")}-${a.toString().padStart(2,"0")}T${o.toString().padStart(2,"0")}:${s.toString().padStart(2,"0")}:${l.toString().padStart(2,"0")}`},Mt=e=>{const{value:n,onBlur:r,onChange:a,onInput:o,after:s,disabled:l}=e,i=t.Value.map(n,u=>u!=null?xt(u):null),c=F.NullableResetAfter(n,l,a??o);return D.InputContainer({...e,input:t.input["datetime-local"](S.CommonInputAttributes(e),t.attr.value(t.Value.map(i,u=>u??null)),t.attr.class("bc-input"),r!=null?t.on.blur(t.emitValue(r)):t.Empty,a!=null?t.on.change(t.emitValueAsNullableDateTime(a)):t.Empty,o!=null?t.on.input(t.emitValueAsNullableDateTime(o)):t.Empty),after:s!=null?t.Fragment(c,s):c})},P=e=>typeof e=="string"&&e.trim()===""?null:e,lt=e=>e??"";function B(e){return n=>{const{value:r,onBlur:a,onChange:o,onInput:s,after:l,disabled:i,...c}=n,u=F.NullableResetAfter(r,i,o??s);return e({...c,disabled:i,value:t.Value.map(r,lt),onChange:o!=null?p=>o(P(p)):void 0,onInput:s!=null?p=>s(P(p)):void 0,onBlur:a,after:l!=null?t.Fragment(u,l):u})}}const _t=B(z.EmailInput),Ct=B(S.TextInput),At=B(z.PasswordInput),Tt=B(F.TextArea),Ft=({value:e,onChange:n,onInput:r,onBlur:a,offLabel:o,onLabel:s,disabled:l=!1,size:i="md",id:c,color:u="primary",tabIndex:p=0})=>{const h=c??pt.sessionId("switch");function f(b,V){const m=["bc-switch",`bc-switch--size-${V}`,`bc-switch--${V}`];return b&&m.push("bc-switch--disabled"),m.join(" ")}function d(b){const V=b??"primary",m=new Map,_=k.backgroundValue(V,"solid","light"),M=k.backgroundValue(V,"solid","dark");return m.set("--switch-track-on-bg",_.backgroundColor),m.set("--switch-track-on-label",_.textColor),m.set("--switch-track-on-bg-dark",M.backgroundColor),m.set("--switch-track-on-label-dark",M.textColor),m.set("--switch-track-on-border-dark",k.borderColorValue(V,"dark")),Array.from(m.entries()).map(([$,g])=>`${$}: ${g}`).join("; ")}const y=()=>{t.Value.get(l)||(n?.(!t.Value.get(e)),r?.(!t.Value.get(e)))},I=b=>{t.Value.get(l)||(b.key===" "||b.key==="Enter")&&(b.preventDefault(),y())};return t.html.div(t.attr.class(t.computedOf(l??!1,i)((b,V)=>f(b??!1,V??"md"))),t.attr.style(t.computedOf(u)(b=>d(b))),t.attr.id(h),t.attr.role("switch"),t.attr.tabindex(t.computedOf(l??!1,p)((b,V)=>b?-1:V??0)),t.aria.checked(e),t.aria.disabled(l),t.on.click(y),t.on.keydown(I),a!=null?t.on.blur(a):null,t.html.div(t.attr.class("bc-switch__track"),t.attr.class(t.Value.map(e,b=>b?"bc-switch__track--on":"bc-switch__track--off")),o!=null?t.html.div(t.aria.hidden(!0),t.attr.class("bc-switch__track-label bc-switch__track-label--off"),t.attr.class(t.Value.map(e,b=>b?"bc-switch__track-label--hidden":"bc-switch__track-label--visible")),o):null,s!=null?t.html.div(t.attr.class("bc-switch__track-label bc-switch__track-label--on"),t.attr.class(t.Value.map(e,b=>b?"bc-switch__track-label--visible":"bc-switch__track-label--hidden")),s):null,X.ElementRect(b=>t.Use(k.Locale,({direction:V})=>t.html.div(t.attr.class("bc-switch__thumb"),t.attr.class(t.Value.map(e,m=>m?"bc-switch__thumb--on":"bc-switch__thumb--off")),t.style.transform(t.computedOf(e,b,i,V)((m,{width:_},M,$)=>{const g=(()=>{switch(M){case"xs":return 5;case"sm":return 5.5;case"md":return 6;case"lg":return 7;case"xl":return 8}})(),w=$==="rtl"?`calc((var(--spacing-base) * ${g}) - ${_}px)`:`calc(${_}px - (var(--spacing-base) * ${g}))`;return m?`translateX(${w})`:"translateX(0)"})))))))},kt=B(F.UUIDInput),Nt="line-md:star-alt-filled",St="line-md:star-alt",it=e=>{const{value:n,onChange:r,disabled:a,max:o=5,fullColor:s="yellow",emptyColor:l="neutral",fullIcon:i=Nt,emptyIcon:c=St,size:u="md",onBlur:p,rounding:h=1}=e,f=()=>{const m=t.Value.get(h);return m>0?m:1},d=m=>Math.min(Math.max(m,0),t.Value.get(o)),y=(m,_)=>{if(t.Value.get(a??!1))return;const $=m.currentTarget.getBoundingClientRect(),g=(m.clientX-$.left)/$.width,w=_-1+g,x=f(),C=Math.ceil(w/x)*x,A=d(C);r?.(A)},I=m=>{if(t.Value.get(a??!1))return;const _=f(),M=t.Value.get(n)??0;let $;switch(m.key){case"ArrowRight":case"ArrowUp":$=d(M+_);break;case"ArrowLeft":case"ArrowDown":$=d(M-_);break;case"Home":$=0;break;case"End":$=t.Value.get(o);break;default:return}m.preventDefault(),r?.($)},b=t.Value.map(u,m=>`bc-icon--${m}`),V=({index:m,counter:_})=>t.html.span(t.attr.class("bc-rating-input__icon-container"),t.attr.class(b),k.Icon({icon:c,size:u,color:l,tone:"soft"},t.attr.class("bc-rating-input__icon-empty")),t.html.span(t.attr.class("bc-rating-input__icon-clipper"),t.attr.class(b),t.style.width(t.Value.map(n,M=>{const $=Math.floor(M);return $>m?"100%":$<m?"0%":`${(M-m)*100}%`})),k.Icon({icon:i,size:u,color:s,tone:"soft"},t.attr.class("bc-rating-input__icon-full"))),t.on.click(t.emit(M=>y(M,_),{preventDefault:!0,stopPropagation:!0})));return D.InputContainer({baseContainer:!0,growInput:!1,focusableSelector:'[role="slider"]',...e,input:t.html.div(S.CommonInputAttributes(e),t.attr.class("bc-rating-input"),t.attr.role("slider"),t.attr.tabindex(t.Value.map(a??!1,m=>m?-1:0)),t.aria.disabled(a??!1),t.aria.valuemin(0),t.aria.valuemax(t.Value.map(o,m=>m??0)),t.aria.valuenow(t.Value.map(n,m=>m??0)),t.aria.valuetext(t.computedOf(n,o)((m,_)=>{const M=m??0,$=_??0;return`${String(M)} / ${String($)}`})),t.on.keydown(I),p!=null?t.on.blur(p):null,t.Repeat(o,V))})},Rt=e=>{const{value:n,onChange:r,onInput:a,onBlur:o,after:s,disabled:l,...i}=e,c=F.NullableResetAfter(n,l,r??a);return it({...i,value:t.Value.map(n,u=>u??0),onChange:r,onInput:a,onBlur:o,after:s!=null?t.Fragment(c,s):c})},vt=e=>{const{value:n,step:r,min:a,max:o,onBlur:s,onChange:l,onInput:i}=e;return D.InputContainer({...e,focusableSelector:'input[type="range"]',input:t.html.input(t.attr.type("range"),S.CommonInputAttributes(e),t.attr.min(a),t.attr.max(o),t.attr.step(r),t.attr.valueAsNumber(n),t.attr.class("bc-input bc-slider-input"),s!=null?t.on.blur(t.emitValueAsNumber(s)):t.Empty,l!=null?t.on.change(t.emitValueAsNumber(l)):t.Empty,i!=null?t.on.input(t.emitValueAsNumber(i)):t.Empty)})},Et=e=>{const{value:n,step:r,min:a,max:o,onBlur:s,onChange:l,onInput:i}=e,c=t.Value.map(n,p=>{if(p!=null)return p;const h=a!=null?t.Value.get(a):void 0;return typeof h=="number"?h:0}),u=F.NullableResetAfter(n,e.disabled,l??i);return D.InputContainer({...e,focusableSelector:'input[type="range"]',after:u,input:t.html.input(t.attr.type("range"),S.CommonInputAttributes(e),t.attr.min(a),t.attr.max(o),t.attr.step(r),t.attr.valueAsNumber(c),t.attr.class("bc-input bc-slider-input"),s!=null?t.on.blur(t.emitValueAsNumber(s)):t.Empty,l!=null?t.on.change(t.emitValueAsNumber(p=>{l(p)})):t.Empty,i!=null?t.on.input(t.emitValueAsNumber(p=>{i(p)})):t.Empty)},t.Fragment())},Dt=B(F.UrlInput);class ct{widgets=new Map;typeMapping=new Map;register(n,r){if(this.widgets.set(n,r),r.supportedTypes)for(const a of r.supportedTypes)this.typeMapping.has(a)||this.typeMapping.set(a,[]),this.typeMapping.get(a).push(n),this.typeMapping.get(a).sort((o,s)=>{const l=this.widgets.get(o)?.priority||0;return(this.widgets.get(s)?.priority||0)-l})}unregister(n){const r=this.widgets.get(n);if(r&&(this.widgets.delete(n),r.supportedTypes))for(const a of r.supportedTypes){const o=this.typeMapping.get(a);if(o){const s=o.indexOf(n);s>=0&&o.splice(s,1),o.length===0&&this.typeMapping.delete(a)}}}get(n){return this.widgets.get(n)}getAll(){return new Map(this.widgets)}getForType(n){return(this.typeMapping.get(n)||[]).map(a=>this.widgets.get(a)).filter(Boolean)}findBestWidget(n){const r=dt.resolveWidget(n.definition,n.name);if(r?.widget){const o=this.widgets.get(r.widget);if(o)return{name:r.widget,registration:o,resolved:r}}const a=[];for(const[o,s]of this.widgets.entries())if(s.matcher)try{s.matcher(n)&&a.push({name:o,registration:s,priority:s.priority??0})}catch(l){console.warn(`Error in matcher for widget "${o}":`,l)}if(a.length>0){a.sort((s,l)=>l.priority-s.priority);const o=a[0];return{name:o.name,registration:o.registration,resolved:{widget:o.name,source:"heuristics"}}}if(typeof n.definition=="object"&&n.definition.type){const o=Array.isArray(n.definition.type)?n.definition.type[0]:n.definition.type,s=this.getForType(o);if(s.length>0){const l=this.typeMapping.get(o)[0];return{name:l,registration:s[0],resolved:{widget:l,source:"type-fallback"}}}}return null}}const Bt=new ct;function Ot(e,n,r){return{factory:n,matcher:a=>{const s=a.definition["x:ui"];return s===e||typeof s=="object"&&s!==null&&s.widget===e},displayName:r?.displayName??e,priority:r?.priority??100,...r}}function Ut(e,n,r){return{factory:n,matcher:a=>a.definition.format===e,displayName:r?.displayName??`${e} widget`,priority:r?.priority??75,...r}}function Wt(e,n,r,a){return{factory:r,matcher:o=>{const s=o.definition;return s.type===e&&s.format===n},displayName:a?.displayName??`${e}:${n} widget`,priority:a?.priority??80,...a}}function Lt(e){const n=e?.logPrefix??"WIDGET_DIAG",r=e?.filterFn??(()=>!0);return{factory:()=>null,displayName:"Diagnostic Widget (never matches)",priority:-1e3,matcher:a=>{if(!r(a))return!1;const o=a.definition,s={name:a.name,path:a.path.map(String),type:o?.type,hasRegistry:a.widgetRegistry!==void 0,definition:o};return console.log(`[${n}] name="${s.name??"ROOT"}" path=[${s.path.join(", ")}] type="${s.type??"unknown"}" hasRegistry=${s.hasRegistry}`),e?.onProcess?.(s),!1}}}exports.Base64Input=yt;exports.Base64sInput=ot;exports.ColorSwatchInput=wt;exports.EditableText=Vt;exports.NullableDateInput=$t;exports.NullableDateTimeInput=Mt;exports.NullableEmailInput=_t;exports.NullablePasswordInput=At;exports.NullableRatingInput=Rt;exports.NullableSliderInput=Et;exports.NullableTextArea=Tt;exports.NullableTextInput=Ct;exports.NullableUUIDInput=kt;exports.NullableUrlInput=Dt;exports.RatingInput=it;exports.SliderInput=vt;exports.Switch=Ft;exports.WidgetRegistry=ct;exports.createDiagnosticWidget=Lt;exports.emptyToNull=P;exports.fileToBase64=st;exports.forFormat=Ut;exports.forTypeAndFormat=Wt;exports.forXUI=Ot;exports.formatColor=R;exports.getContrastRatio=ht;exports.globalWidgetRegistry=Bt;exports.hexToRgb=E;exports.hslToRgb=j;exports.hwbToRgb=et;exports.isValidColor=gt;exports.isValidHexColor=q;exports.isValidHslColor=K;exports.isValidRgbColor=Y;exports.isValidRgbaColor=G;exports.linearToSrgb=U;exports.mulberry32=tt;exports.normalizeHexColor=Q;exports.nullToEmpty=lt;exports.oklchToRgb=at;exports.parseAnyColor=Z;exports.resolveEffectiveFormat=v;exports.rgbToHex=W;exports.rgbToHsl=L;exports.rgbToHwb=nt;exports.rgbToOklch=rt;exports.srgbToLinear=O;exports.toRgbaString=J;