@tempots/beatui 0.19.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/{2019-D0n7sHsB.js → 2019-B4Mw3glM.js} +2 -2
  2. package/dist/{2019-CfIF9XVA.cjs → 2019-u0Cs1ZdE.cjs} +1 -1
  3. package/dist/{2020-D1ziwonq.cjs → 2020-BcwEHv2O.cjs} +1 -1
  4. package/dist/{2020-BkXWq9F8.js → 2020-BvFyb4Gy.js} +2 -2
  5. package/dist/{ar-DYmDITuw.cjs → ar-DyhaQaJU.cjs} +1 -1
  6. package/dist/{ar-CMndb3tf.js → ar-RkpJ2n6w.js} +1 -1
  7. package/dist/auth/index.cjs.js +1 -1
  8. package/dist/auth/index.es.js +646 -651
  9. package/dist/beatui.css +1 -1
  10. package/dist/{de-Cgy7XJBg.js → de-BdSVR4Zm.js} +1 -1
  11. package/dist/{de-ClQgQrXM.cjs → de-CnZ4Ik2a.cjs} +1 -1
  12. package/dist/{es-j0qszDAW.js → es-B_Qn5EUy.js} +1 -1
  13. package/dist/{es-BN5Mihv0.cjs → es-ZKraCneL.cjs} +1 -1
  14. package/dist/{fa-BUQvM0nj.cjs → fa-D2p_ch4Q.cjs} +1 -1
  15. package/dist/{fa-COUp2ofv.js → fa-jBaLjqfG.js} +1 -1
  16. package/dist/{fr-B5Ar6QcE.js → fr-B0KaMM2j.js} +1 -1
  17. package/dist/{fr-CwvsJDIZ.cjs → fr-CBeo42lQ.cjs} +1 -1
  18. package/dist/{he-HZvvmFUB.cjs → he-BmqEF3o-.cjs} +1 -1
  19. package/dist/{he-D5HTHvKh.js → he-DjeYjcW7.js} +1 -1
  20. package/dist/{hi-Cnr1RtgA.cjs → hi-BAfIFl1n.cjs} +1 -1
  21. package/dist/{hi-Bcc7iEXp.js → hi-DxBQV0uz.js} +1 -1
  22. package/dist/index-4NoQLiJo.cjs +2 -0
  23. package/dist/{index-DSvEBuy-.cjs → index-9UO7Pd64.cjs} +1 -1
  24. package/dist/{index-tuwLQMCb.js → index-B001qopB.js} +3 -3
  25. package/dist/{index-ykojBEwT.js → index-BIUeLQJ1.js} +4 -4
  26. package/dist/{index-FEy4Hwnx.cjs → index-BInDdLXi.cjs} +1 -1
  27. package/dist/{index-BUKtbimR.cjs → index-BWiQR9j3.cjs} +1 -1
  28. package/dist/{index-Dben4dbo.js → index-BX_AooS9.js} +2 -2
  29. package/dist/{index-CRfUh74G.cjs → index-Blq-MoAk.cjs} +1 -1
  30. package/dist/{index-rWglN8IQ.js → index-BnaafQ9o.js} +1 -1
  31. package/dist/{index-BJfVmi_X.js → index-BnbEC2zq.js} +2 -2
  32. package/dist/{index-CHgx0rFt.js → index-C4jYy0NW.js} +2 -2
  33. package/dist/{index-B-d5blto.js → index-C4xio93t.js} +3 -3
  34. package/dist/{index-CFo2nnaI.js → index-C5l1mFuD.js} +2 -2
  35. package/dist/{index-BYk56bqR.cjs → index-CDYYXcsk.cjs} +2 -2
  36. package/dist/{index-CIfx_bs7.cjs → index-CJM_lW9n.cjs} +1 -1
  37. package/dist/{index-D0-d-xdJ.js → index-CaNnYmEs.js} +6 -6
  38. package/dist/{index-BZHMnjr6.cjs → index-CaOzAsWD.cjs} +1 -1
  39. package/dist/{index-BF4pXHo-.js → index-CdvplJG6.js} +4 -4
  40. package/dist/{index-CUs1c8a9.js → index-ClvbjqJL.js} +8 -8
  41. package/dist/{index-DgUJYXoy.cjs → index-CpB78PPQ.cjs} +1 -1
  42. package/dist/{index-B16dbwxM.cjs → index-CpKAa22o.cjs} +1 -1
  43. package/dist/{index-DJ-avKHU.js → index-CpMCZBAl.js} +2 -2
  44. package/dist/{index-2DKUYRWr.js → index-Cs_PxtnZ.js} +1 -1
  45. package/dist/{index-DxG_avr8.cjs → index-CvRJPSEv.cjs} +1 -1
  46. package/dist/{index-DD-MOsCa.js → index-D5nWhHZv.js} +2 -2
  47. package/dist/{index-Cohec4rB.cjs → index-D7o5LhMm.cjs} +1 -1
  48. package/dist/{index-DYIv5X6N.js → index-DC5Cn-TM.js} +2 -2
  49. package/dist/{index-CKRuo2DB.js → index-DCpnqWRN.js} +3 -3
  50. package/dist/{index-BirEb-BA.js → index-DOlgncMG.js} +2178 -2193
  51. package/dist/{index-kk6qFeC5.cjs → index-DOyppfix.cjs} +1 -1
  52. package/dist/{index-DjNMMz5-.cjs → index-DXUQTPON.cjs} +1 -1
  53. package/dist/{index-C9XAXTDx.cjs → index-DdlxwtnE.cjs} +1 -1
  54. package/dist/{index-_OaxQJX1.js → index-DhJIuRg9.js} +4 -4
  55. package/dist/{index-Bg1QLlyj.js → index-DiV6JJiS.js} +3 -3
  56. package/dist/{index-DD8_efWr.cjs → index-Dl-wY6fc.cjs} +1 -1
  57. package/dist/{index-BguvTLHu.cjs → index-DlaVE6S2.cjs} +1 -1
  58. package/dist/index-JHbFZFZF.cjs +8 -0
  59. package/dist/{index-dsitEt8M.cjs → index-Jt6D3QJ7.cjs} +1 -1
  60. package/dist/{index-85k3bgcY.cjs → index-KcBlGDqr.cjs} +1 -1
  61. package/dist/{index-dV4F3c70.js → index-MyVoESdk.js} +3 -3
  62. package/dist/{index-DC4nzG_w.js → index-NysVuvZA.js} +5 -5
  63. package/dist/{index-D-Rzl363.cjs → index-RGCDszX8.cjs} +1 -1
  64. package/dist/{index-CoBM7UvE.js → index-c-O5R5i2.js} +2 -2
  65. package/dist/{index-C4UzgyIA.cjs → index-cjtIcxwt.cjs} +1 -1
  66. package/dist/{index-faGepKVA.js → index-fnMeddEM.js} +2 -2
  67. package/dist/{index-DV7tB1MN.cjs → index-uR3OZ_8K.cjs} +1 -1
  68. package/dist/index.cjs.js +25 -25
  69. package/dist/index.es.js +2248 -2264
  70. package/dist/index.esm-DJRz9AE-.cjs +1 -0
  71. package/dist/{index.esm-CSotgpVw.js → index.esm-DPNh6inz.js} +410 -420
  72. package/dist/{it-CTCKFU5g.js → it-B4qZsicu.js} +1 -1
  73. package/dist/{it-B7KeOLBm.cjs → it-CzKrFTFY.cjs} +1 -1
  74. package/dist/{ja-BGoETTZv.js → ja-BnCSmhkg.js} +1 -1
  75. package/dist/{ja-0ldomgID.cjs → ja-i_9MZ1j0.cjs} +1 -1
  76. package/dist/json-schema/index.cjs.js +1 -1
  77. package/dist/json-schema/index.es.js +1 -1
  78. package/dist/{ko-C4WEkArz.cjs → ko-CF9il-Az.cjs} +1 -1
  79. package/dist/{ko-xHeRs9LU.js → ko-D_gGkjrC.js} +1 -1
  80. package/dist/milkdown/index.cjs.js +1 -1
  81. package/dist/milkdown/index.es.js +1 -1
  82. package/dist/{milkdown-input-BbbZJGDl.js → milkdown-input-CYme9OBn.js} +14757 -14822
  83. package/dist/milkdown-input-KjtVqDzi.cjs +941 -0
  84. package/dist/modal-B-f3LBKr.cjs +1 -0
  85. package/dist/modal-BItfEmu0.js +600 -0
  86. package/dist/monaco/index.cjs.js +2 -2
  87. package/dist/monaco/index.es.js +114 -116
  88. package/dist/{nl-ey2Li7DF.js → nl-CsLCWUFF.js} +1 -1
  89. package/dist/{nl-D-y231ZO.cjs → nl-DfWlqR6T.cjs} +1 -1
  90. package/dist/notice-B7JqE59s.cjs +1 -0
  91. package/dist/notice-CmmpobJd.js +2415 -0
  92. package/dist/{pl-Bf0QaCGx.js → pl-Bsmj1KbZ.js} +1 -1
  93. package/dist/{pl-G6e4Mybr.cjs → pl-wK2sgv7l.cjs} +1 -1
  94. package/dist/{pt-D-_KxA9g.js → pt-BR_NuRJS.js} +1 -1
  95. package/dist/{pt-CD2Eqazl.cjs → pt-DAQIuOPW.cjs} +1 -1
  96. package/dist/{ru-CKh2xgqC.cjs → ru-BnoiCxrw.cjs} +1 -1
  97. package/dist/{ru-Dzbl29K2.js → ru-CiQ_qKD_.js} +1 -1
  98. package/dist/timer-BdH4cK6a.cjs +1 -0
  99. package/dist/timer-CQlK5LhW.js +47 -0
  100. package/dist/{tr-BbpC5gzM.cjs → tr-Bme5PfaE.cjs} +1 -1
  101. package/dist/{tr-yMHT8n7z.js → tr-Q9xP1nE4.js} +1 -1
  102. package/dist/translations-ClgoCEFC.js +1969 -0
  103. package/dist/{translations-DbN-OSLv.js → translations-D4hFMU4P.js} +1 -1
  104. package/dist/translations-DRBh70w8.cjs +2 -0
  105. package/dist/{translations-CXE8Z_Ac.cjs → translations-lnK_6RdU.cjs} +1 -1
  106. package/dist/{ur-kkik6-_r.cjs → ur-B4b39hNV.cjs} +1 -1
  107. package/dist/{ur-CdQA0epV.js → ur-CGTjSoJt.js} +1 -1
  108. package/dist/{vi-A8UmZU3L.js → vi-BF3HTFU9.js} +1 -1
  109. package/dist/{vi-1xtFXJc0.cjs → vi-CSpW181L.cjs} +1 -1
  110. package/dist/{zh-D0nnvX8T.js → zh-BreM8U2w.js} +1 -1
  111. package/dist/{zh-DC_SsXdk.cjs → zh-PeL8FN2c.cjs} +1 -1
  112. package/package.json +6 -6
  113. package/dist/index-B66rNs5i.cjs +0 -2
  114. package/dist/index-DXFKCiah.cjs +0 -8
  115. package/dist/index.esm-8xolKogd.cjs +0 -1
  116. package/dist/milkdown-input-C-Muq7PQ.cjs +0 -941
  117. package/dist/modal-nbZW44XS.js +0 -614
  118. package/dist/modal-wbG_oGOr.cjs +0 -1
  119. package/dist/notice-CIPcSfD5.js +0 -2432
  120. package/dist/notice-Cq02YHoN.cjs +0 -1
  121. package/dist/timer-CcMCjYrq.cjs +0 -1
  122. package/dist/timer-CkgWORR9.js +0 -42
  123. package/dist/translations-DBtfTNnM.js +0 -2005
  124. package/dist/translations-EQ1qPZ0_.cjs +0 -2
@@ -1,2005 +0,0 @@
1
- var He = Object.defineProperty;
2
- var De = (e) => {
3
- throw TypeError(e);
4
- };
5
- var Ue = (e, s, t) => s in e ? He(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
6
- var h = (e, s, t) => Ue(e, typeof s != "symbol" ? s + "" : s, t), _e = (e, s, t) => s.has(e) || De("Cannot " + t);
7
- var o = (e, s, t) => (_e(e, s, "read from private field"), t ? t.call(e) : s.get(e)), v = (e, s, t) => s.has(e) ? De("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(e) : s.set(e, t), z = (e, s, t, n) => (_e(e, s, "write to private field"), n ? n.call(e, t) : s.set(e, t), t);
8
- import { makeProviderMark as Me, localStorageProp as Ee, computedOf as T, Use as he, html as m, attr as u, When as M, Fragment as P, aria as E, coalesce as Se, style as fe, prop as $, on as S, OnDispose as Pe, Value as x, WithElement as Ge, Empty as k, dataAttr as ke, input as Ae, emitValue as B, emitValueAsNumber as ze } from "@tempots/dom";
9
- import { WhenInViewport as We, Query as Ke, ElementRect as Je } from "@tempots/ui";
10
- function Te(e, {
11
- units: s = ["B", "KB", "MB", "GB", "TB"],
12
- decimalPlaces: t = 0,
13
- locale: n
14
- } = {}) {
15
- if (e === 0 || e === 0n)
16
- return new Intl.NumberFormat(n, {
17
- style: "unit",
18
- unit: "byte",
19
- unitDisplay: "short",
20
- maximumFractionDigits: 0
21
- }).format(0).replace("byte", s[0]);
22
- let r, a;
23
- if (typeof e == "bigint") {
24
- let c = e < 0n ? -e : e;
25
- for (r = 0; c >= 1024n && r < s.length - 1; )
26
- c = c / 1024n, r++;
27
- a = Number(e) / Math.pow(1024, r);
28
- } else
29
- r = Math.floor(Math.log(Math.abs(e)) / Math.log(1024)), r = Math.min(r, s.length - 1), a = e / Math.pow(1024, r);
30
- return new Intl.NumberFormat(n, {
31
- style: "unit",
32
- unit: "byte",
33
- unitDisplay: "short",
34
- minimumFractionDigits: r === 0 ? 0 : t,
35
- maximumFractionDigits: r === 0 ? 0 : t
36
- }).format(a).replace("byte", s[r]);
37
- }
38
- const Ce = /* @__PURE__ */ new Map();
39
- function xe(e) {
40
- const s = Ce.get(e) ?? 0;
41
- return Ce.set(e, s + 1), `${e}-${s}`;
42
- }
43
- const _ = {
44
- /**
45
- * Creates a loading state.
46
- * @param previousValue - The previous value.
47
- * @returns A loading state.
48
- * @public
49
- */
50
- notAsked: { type: "NotAsked" },
51
- /**
52
- * Creates a loading state.
53
- * @param previousValue - The previous value.
54
- * @returns A loading state.
55
- * @public
56
- */
57
- loading(e = void 0) {
58
- return { type: "Loading", previousValue: e };
59
- },
60
- /**
61
- * Creates a successful state.
62
- * @param value - The value.
63
- * @returns A successful state.
64
- * @public
65
- */
66
- success(e) {
67
- return { type: "AsyncSuccess", value: e };
68
- },
69
- /**
70
- * Creates a failure state.
71
- * @param error - The error.
72
- * @returns A failure state.
73
- * @public
74
- */
75
- failure(e) {
76
- return { type: "AsyncFailure", error: e };
77
- },
78
- /**
79
- * Checks if the result is a success.
80
- * @param r - The result.
81
- * @returns `true` if the result is a success; otherwise, `false`.
82
- * @public
83
- */
84
- isSuccess(e) {
85
- return e.type === "AsyncSuccess";
86
- },
87
- /**
88
- * Checks if the result is a failure.
89
- * @param r - The result.
90
- * @returns `true` if the result is a failure; otherwise, `false`.
91
- * @public
92
- */
93
- isFailure(e) {
94
- return e.type === "AsyncFailure";
95
- },
96
- /**
97
- * Checks if the result is a not-asked.
98
- * @param r - The result.
99
- * @returns `true` if the result is not-asked; otherwise, `false`.
100
- * @public
101
- */
102
- isNotAsked(e) {
103
- return e.type === "NotAsked";
104
- },
105
- /**
106
- * Checks if the result is a loading.
107
- * @param r - The result.
108
- * @returns `true` if the result is loading; otherwise, `false`.
109
- * @public
110
- */
111
- isLoading(e) {
112
- return e.type === "Loading";
113
- },
114
- /**
115
- * Gets the value if the result is a success; otherwise, returns the alternative value.
116
- * @param r - The result.
117
- * @param alt - The alternative value.
118
- * @returns The value if the result is a success; otherwise, the alternative value.
119
- * @public
120
- */
121
- getOrElse(e, s) {
122
- return _.isSuccess(e) ? e.value : s;
123
- },
124
- /**
125
- * Gets the value if the result is a success; otherwise, returns the value from the alternative function.
126
- * @param r - The result.
127
- * @param altf - The alternative function.
128
- * @returns The value if the result is a success; otherwise, the value from the alternative
129
- * @public
130
- * function.
131
- */
132
- getOrElseLazy(e, s) {
133
- return _.isSuccess(e) ? e.value : s();
134
- },
135
- /**
136
- * Gets the value if the result is a success; otherwise, returns `null`.
137
- * @param r - The result.
138
- * @returns The value if the result is a success; otherwise, `null`.
139
- * @public
140
- */
141
- getOrNull(e) {
142
- return _.isSuccess(e) ? e.value : null;
143
- },
144
- /**
145
- * Gets the value if the result is a success; otherwise, returns `undefined`.
146
- * @param r - The result.
147
- * @returns The value if the result is a success; otherwise, `undefined`.
148
- * @public
149
- */
150
- getOrUndefined(e) {
151
- return _.isSuccess(e) ? e.value : void 0;
152
- },
153
- /**
154
- * Gets the value of a `AsyncResult` if it is a `Success`, otherwise it throws the error contained in the `Failure`.
155
- * @param r - The `AsyncResult` to get the value from.
156
- * @returns The value of the `AsyncResult` if it is a `Success`.
157
- */
158
- getUnsafe: (e) => {
159
- if (_.isSuccess(e))
160
- return e.value;
161
- throw _.isFailure(e) ? e.error : new Error("Cannot get value from a not-asked or loading result");
162
- },
163
- /**
164
- * Based on the state of the result, it picks the appropriate function to call and returns the result.
165
- * @param success - The function to call if the result is a success.
166
- * @param failure - The function to call if the result is a failure.
167
- * @param loading - The function to call if the result is loading.
168
- * @param notAsked - The function to call if the result is not-asked.
169
- * @returns The result of calling the appropriate function based on the state of the result.
170
- * @public
171
- */
172
- match: (e, {
173
- success: s,
174
- failure: t,
175
- loading: n,
176
- notAsked: r = n
177
- }) => _.isSuccess(e) ? s(e.value) : _.isFailure(e) ? t(e.error) : _.isNotAsked(e) ? r() : n(e.previousValue),
178
- /**
179
- * When the result is a success, it applies the function to the value.
180
- *
181
- * @param r - The result.
182
- * @param apply - The function to apply.
183
- * @returns The result that was passed in.
184
- * @public
185
- */
186
- whenSuccess: (e, s) => (_.isSuccess(e) && s(e.value), e),
187
- /**
188
- * When the result is a failure, it applies the function to the error.
189
- *
190
- * @param r - The result.
191
- * @param apply - The function to apply.
192
- * @returns The result that was passed in.
193
- * @public
194
- */
195
- whenFailure: (e, s) => (_.isFailure(e) && s(e.error), e),
196
- /**
197
- * Compares two results for equality.
198
- * @param r1 - The first result.
199
- * @param r2 - The second result.
200
- * @param options - The options to use for comparison. By default, uses strict equality.
201
- * @returns `true` if the results are equal, `false` otherwise.
202
- */
203
- equals: (e, s, t = {
204
- valueEquals: (n, r) => n === r,
205
- errorEquals: (n, r) => n === r
206
- }) => e.type === "AsyncSuccess" && s.type === "AsyncSuccess" ? t.valueEquals(e.value, s.value) : e.type === "AsyncFailure" && s.type === "AsyncFailure" ? t.errorEquals(e.error, s.error) : e.type === "Loading" && s.type === "Loading" ? t.valueEquals(e.previousValue, s.previousValue) : e.type === "NotAsked" && s.type === "NotAsked",
207
- /**
208
- * Combines multiple results into a single result.
209
- * @param results - The results to combine.
210
- * @returns A single result that is a success if all the input results are successes, otherwise a failure.
211
- */
212
- all: (e) => {
213
- const s = [];
214
- for (const t of e)
215
- if (_.isSuccess(t))
216
- s.push(t.value);
217
- else
218
- return t;
219
- return _.success(s);
220
- },
221
- /**
222
- * Converts a Promise to an AsyncResult.
223
- * @param p - The Promise to convert.
224
- * @returns A Promise that resolves to an AsyncResult.
225
- */
226
- ofPromise: async (e) => {
227
- try {
228
- const s = await e;
229
- return _.success(s);
230
- } catch (s) {
231
- return _.failure(s instanceof Error ? s : new Error(String(s)));
232
- }
233
- }
234
- }, W = (e, s) => e === s || e !== e && s !== s, C = {
235
- /**
236
- * Creates a valid `Validation`.
237
- * @returns A `Validation` that is `Valid`.
238
- */
239
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
240
- valid: { type: "valid" },
241
- /**
242
- * Creates an invalid `Validation`.
243
- * @param error - The error associated with the invalid value.
244
- * @returns A `Validation` that is `Invalid`.
245
- */
246
- invalid(e) {
247
- return { type: "invalid", error: e };
248
- },
249
- /**
250
- * Checks if a `Validation` is `Valid`.
251
- * @param r - The `Validation` to check.
252
- * @returns `true` if the `Validation` is `Valid`, otherwise `false`.
253
- */
254
- isValid(e) {
255
- return e.type === "valid";
256
- },
257
- /**
258
- * Checks if a `Validation` is `Invalid`.
259
- * @param r - The `Validation` to check.
260
- * @returns `true` if the `Validation` is `Invalid`, otherwise `false`.
261
- */
262
- isInvalid(e) {
263
- return e.type === "invalid";
264
- },
265
- /**
266
- * Maps the value of a `Validation` to a new value.
267
- * @param r - The `Validation` to map.
268
- * @param valid - The mapping function for a valid value.
269
- * @param invalid - The mapping function for an invalid value.
270
- * @returns The mapped value.
271
- */
272
- match: (e, s, t) => C.isValid(e) ? s() : t(e.error),
273
- /**
274
- * Maps the value of a `Validation` to a new `Validation`.
275
- * @param validation - The `Validation` to map.
276
- * @param value - The value to map.
277
- * @returns A new `Validation` with the mapped value.
278
- */
279
- toResult: (e, s) => C.match(
280
- e,
281
- () => y.success(s),
282
- (t) => y.failure(t)
283
- ),
284
- /**
285
- * Execute a function when the `Validation` is valid.
286
- *
287
- * @param r - The `Validation` to check.
288
- * @param apply - The function to execute when the `Validation` is valid.
289
- * @returns The `Validation` object.
290
- */
291
- whenValid: (e, s) => (C.isValid(e) && s(), e),
292
- /**
293
- * Execute a function when the `Validation` is invalid.
294
- *
295
- * @param r - The `Validation` to check.
296
- * @param apply - The function to execute when the `Validation` is invalid.
297
- * @returns The `Validation` object.
298
- */
299
- whenInvalid: (e, s) => (C.isInvalid(e) && s(e.error), e)
300
- }, y = {
301
- /**
302
- * Creates a successful `Result`.
303
- * @param value - The value to wrap in a `Success` type.
304
- * @returns A `Result` that is a `Success`.
305
- * @public
306
- */
307
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
308
- success(e) {
309
- return { type: "Success", value: e };
310
- },
311
- /**
312
- * Creates a failure `Result`.
313
- * @param error - The error to wrap in a `Failure` type.
314
- * @returns A `Result` that is a `Failure`.
315
- * @public
316
- */
317
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
318
- failure(e) {
319
- return { type: "Failure", error: e };
320
- },
321
- /**
322
- * Maps the value of a `Result` to a new value.
323
- * @param r - The `Result` to map.
324
- * @param f - The mapping function.
325
- * @returns A new `Result` with the mapped value.
326
- * @public
327
- */
328
- map: (e, s) => e.type === "Success" ? y.success(s(e.value)) : e,
329
- /**
330
- * Maps the value of a `Result` to a new `Result`.
331
- * @param r - The `Result` to map.
332
- * @param f - The mapping function.
333
- * @returns A new `Result` with the mapped value.
334
- * @public
335
- */
336
- flatMap: (e, s) => e.type === "Success" ? s(e.value) : e,
337
- /**
338
- * Converts a `Result` to an `AsyncResult`.
339
- * @param r - The `Result` to convert.
340
- * @returns An `AsyncResult` that is equivalent to the input `Result`.
341
- * @public
342
- */
343
- toAsync(e) {
344
- return y.match(
345
- e,
346
- (s) => _.success(s),
347
- (s) => _.failure(s)
348
- );
349
- },
350
- /**
351
- * Converts a `Result` to a `Validation`.
352
- * @param r - The `Result` to convert.
353
- * @returns A `Validation` that is equivalent to the input `Result`.
354
- * @public
355
- */
356
- toValidation(e) {
357
- return y.match(
358
- e,
359
- () => C.valid,
360
- (s) => C.invalid(s)
361
- );
362
- },
363
- /**
364
- * Checks if a `Result` is a success.
365
- * @param r - The `Result` to check.
366
- * @returns `true` if the `Result` is a `Success`, `false` otherwise.
367
- * @public
368
- */
369
- isSuccess(e) {
370
- return e.type === "Success";
371
- },
372
- /**
373
- * Checks if a `Result` is a failure.
374
- * @param r - The `Result` to check.
375
- * @returns `true` if the `Result` is a `Failure`, `false` otherwise.
376
- * @public
377
- */
378
- isFailure(e) {
379
- return e.type === "Failure";
380
- },
381
- /**
382
- * Gets the value of a `Result` if it is a `Success`, otherwise returns the provided default value.
383
- * @param r - The `Result` to get the value from.
384
- * @param alt - The default value to return if the `Result` is a `Failure`.
385
- * @returns The value of the `Result` if it is a `Success`, otherwise the default value.
386
- * @public
387
- */
388
- getOrElse(e, s) {
389
- return y.isSuccess(e) ? e.value : s;
390
- },
391
- /**
392
- * Gets the value of a `Result` if it is a `Success`, otherwise returns the result of the provided function.
393
- * @param r - The `Result` to get the value from.
394
- * @param altf - The function to call if the `Result` is a `Failure`.
395
- * @returns The value of the `Result` if it is a `Success`, otherwise the result of the function.
396
- * @public
397
- */
398
- getOrElseLazy(e, s) {
399
- return y.isSuccess(e) ? e.value : s();
400
- },
401
- /**
402
- * Gets the value of a `Result` if it is a `Success`, otherwise returns `null`.
403
- * @param r - The `Result` to get the value from.
404
- * @returns The value of the `Result` if it is a `Success`, otherwise `null`.
405
- * @public
406
- */
407
- getOrNull(e) {
408
- return y.isSuccess(e) ? e.value : null;
409
- },
410
- /**
411
- * Gets the value of a `Result` if it is a `Success`, otherwise returns `undefined`.
412
- * @param r - The `Result` to get the value from.
413
- * @returns The value of the `Result` if it is a `Success`, otherwise `undefined`.
414
- * @public
415
- */
416
- getOrUndefined(e) {
417
- return y.isSuccess(e) ? e.value : void 0;
418
- },
419
- /**
420
- * Gets the value of a `Result` if it is a `Success`, otherwise it throws the error contained in the `Failure`.
421
- * @param r - The `Result` to get the value from.
422
- * @returns The value of the `Result` if it is a `Success`.
423
- */
424
- getUnsafe: (e) => {
425
- if (y.isSuccess(e))
426
- return e.value;
427
- throw e.error;
428
- },
429
- /**
430
- * Based on the state of the result, it picks the appropriate function to call and returns the result.
431
- * @param success - The function to call if the result is a success.
432
- * @param failure - The function to call if the result is a failure.
433
- * @returns The result of calling the appropriate function based on the state of the result.
434
- * @public
435
- */
436
- match: (e, s, t) => y.isSuccess(e) ? s(e.value) : t(e.error),
437
- /**
438
- * Calls the provided function if the result is a success.
439
- * @param apply - The function to call if the result is a success.
440
- * @returns A function that takes a `Result` and calls the provided function if the result is a success.
441
- * @public
442
- */
443
- whenSuccess: (e, s) => (y.isSuccess(e) && s(e.value), e),
444
- whenFailure: (e, s) => (y.isFailure(e) && s(e.error), e),
445
- /**
446
- * Combines two results into a single result.
447
- * @param r1 - The first result.
448
- * @param r2 - The second result.
449
- * @param combineV - The function to combine two values.
450
- * @param combineE - The function to combine two errors.
451
- * @returns The combined result.
452
- * @public
453
- */
454
- combine: (e, s, t, n) => y.match(
455
- e,
456
- (r) => y.match(
457
- s,
458
- (a) => y.success(t(r, a)),
459
- (a) => y.failure(a)
460
- ),
461
- (r) => y.match(
462
- s,
463
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
464
- (a) => y.failure(r),
465
- (a) => y.failure(n(r, a))
466
- )
467
- ),
468
- /**
469
- * Compares two results for equality.
470
- * @param r1 - The first result.
471
- * @param r2 - The second result.
472
- * @param options - The options to use for comparison. By default, uses strict equality.
473
- * @returns `true` if the results are equal, `false` otherwise.
474
- */
475
- equals: (e, s, t = {
476
- valueEquals: (n, r) => n === r,
477
- errorEquals: (n, r) => n === r
478
- }) => e.type === "Success" && s.type === "Success" ? t.valueEquals(e.value, s.value) : e.type === "Failure" && s.type === "Failure" ? t.errorEquals(e.error, s.error) : !1,
479
- /**
480
- * Combines multiple results into a single result.
481
- * @param results - The results to combine.
482
- * @returns A single result that is a success if all the input results are successes, otherwise a failure.
483
- */
484
- all: (e) => {
485
- const s = [];
486
- for (const t of e)
487
- if (y.isSuccess(t))
488
- s.push(t.value);
489
- else
490
- return t;
491
- return y.success(s);
492
- }
493
- }, Le = {
494
- loadingExtended: "Loading, please wait",
495
- loadingShort: "Loading...",
496
- locale: "Locale",
497
- iconDescription: "Icon",
498
- loadingIcon: "Loading icon",
499
- failedToLoadIcon: "Failed to load icon",
500
- editLabel: "Edit",
501
- selectOne: "Select one",
502
- selectMany: "Select many",
503
- noResults: "No results",
504
- passwordPlaceholderText: "Secret Password",
505
- togglePasswordVisibility: "Toggle password visibility",
506
- toggleMenu: "Toggle menu",
507
- toggleAside: "Toggle aside",
508
- mainNavigation: "Main navigation",
509
- sidebar: "Sidebar",
510
- closeDrawer: "Close drawer",
511
- closeModal: "Close modal",
512
- confirm: "Confirm",
513
- cancel: "Cancel",
514
- addLabel: "Add",
515
- removeItem: "Remove item",
516
- // languages
517
- currentLocale: "English",
518
- ar: "Arabic",
519
- de: "German",
520
- en: "English",
521
- es: "Spanish",
522
- fr: "French",
523
- hi: "Hindi",
524
- it: "Italian",
525
- ja: "Japanese",
526
- ko: "Korean",
527
- nl: "Dutch",
528
- pl: "Polish",
529
- pt: "Portuguese",
530
- ru: "Russian",
531
- tr: "Turkish",
532
- vi: "Vietnamese",
533
- zh: "Chinese",
534
- he: "Hebrew",
535
- fa: "Persian",
536
- ur: "Urdu",
537
- // input
538
- emailPlaceholderText: "Enter your email",
539
- incrementValue: "Increment value",
540
- decrementValue: "Decrement value",
541
- // drop zone
542
- dropZoneInstructions: (e) => e ? "Click to choose or drag files here, or press Enter or Space to open file selector" : "Drag files here",
543
- // size
544
- fileSizeUnits: ["Bytes", "KB", "MB", "GB", "TB"],
545
- // file input
546
- removeFile: "Remove file",
547
- clearAllFiles: "Clear all files",
548
- // inputs reset
549
- clearValue: "Reset",
550
- unknownType: "Unknown type",
551
- filesInputInstructions: (e, s, t) => {
552
- let n = e == null || e > 1 ? "Click to choose or drag files here" : "Click to choose or drag a file here";
553
- if (e || s) {
554
- const r = [];
555
- if (e != null && e > 1 && r.push(`up to ${e} files`), s && t) {
556
- const a = Te(s, {
557
- units: t
558
- });
559
- r.push(`max ${a} each`);
560
- }
561
- r.length > 0 && (n += ` (${r.join(", ")})`);
562
- } else if (s && t) {
563
- const r = Te(s, {
564
- units: t
565
- });
566
- n += ` (max ${r})`;
567
- }
568
- return n;
569
- }
570
- }, Qe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
571
- __proto__: null,
572
- default: Le
573
- }, Symbol.toStringTag, { value: "Module" })), Ye = Le, Ze = "en", Xe = (e, s, t) => {
574
- const n = e[s];
575
- return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((r, a) => {
576
- (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
577
- a.bind(
578
- null,
579
- new Error(
580
- "Unknown variable dynamic import: " + s + (s.split("/").length !== t ? ". Note that variables only represent file names one level deep." : "")
581
- )
582
- )
583
- );
584
- });
585
- }, et = /* @__PURE__ */ new Set([
586
- "ar",
587
- // Arabic
588
- "he",
589
- // Hebrew
590
- "fa",
591
- // Persian/Farsi
592
- "ur",
593
- // Urdu
594
- "ps",
595
- // Pashto
596
- "sd",
597
- // Sindhi
598
- "ku",
599
- // Kurdish
600
- "dv",
601
- // Divehi/Maldivian
602
- "yi",
603
- // Yiddish
604
- "ji",
605
- // Yiddish (alternative code)
606
- "iw",
607
- // Hebrew (deprecated, but still used)
608
- "in"
609
- // Indonesian (deprecated, but sometimes confused)
610
- ]);
611
- function Oe(e) {
612
- if (!e) return "ltr";
613
- const s = e.split(/[-_]/)[0].toLowerCase();
614
- return et.has(s) ? "rtl" : "ltr";
615
- }
616
- function tt(e, s) {
617
- return e === "auto" ? Oe(s) : e;
618
- }
619
- function Ot(e) {
620
- return `b-${e}`;
621
- }
622
- function Vt(e) {
623
- return Oe(e) === "rtl";
624
- }
625
- function Bt(e) {
626
- return e === "ltr" ? "rtl" : "ltr";
627
- }
628
- const st = {
629
- ltr: {
630
- "inline-start": "left",
631
- "inline-end": "right",
632
- "block-start": "top",
633
- "block-end": "bottom"
634
- },
635
- rtl: {
636
- "inline-start": "right",
637
- "inline-end": "left",
638
- "block-start": "top",
639
- "block-end": "bottom"
640
- }
641
- };
642
- function jt(e, s) {
643
- return st[s][e];
644
- }
645
- const nt = {
646
- mark: Me("Locale"),
647
- create: (e) => {
648
- const s = Ee({
649
- defaultValue: navigator.language ?? "en-US",
650
- key: "beatui-locale"
651
- }), t = Ee({
652
- defaultValue: "auto",
653
- key: "beatui-direction-preference"
654
- }), n = T(
655
- s,
656
- t
657
- )(
658
- (a, l) => tt(l, a)
659
- );
660
- return {
661
- value: {
662
- locale: s,
663
- setLocale: (a) => s.set(a),
664
- direction: n,
665
- directionPreference: t,
666
- setDirectionPreference: (a) => t.set(a)
667
- },
668
- dispose: () => {
669
- s.dispose(), t.dispose(), n.dispose();
670
- }
671
- };
672
- }
673
- }, rt = "bui-icons", me = /* @__PURE__ */ new Map(), Ve = (() => {
674
- try {
675
- return typeof indexedDB < "u" && indexedDB !== null;
676
- } catch {
677
- return !1;
678
- }
679
- })();
680
- function at() {
681
- return Ve ? new Promise((e, s) => {
682
- const t = indexedDB.open(rt, 1);
683
- t.onupgradeneeded = function(n) {
684
- const r = n.target.result;
685
- r.objectStoreNames.contains("icons") || r.createObjectStore("icons");
686
- }, t.onsuccess = function() {
687
- e(t.result);
688
- }, t.onerror = function() {
689
- s(t.error);
690
- };
691
- }) : Promise.reject(new Error("IndexedDB not available"));
692
- }
693
- const be = Ve ? at() : null;
694
- function it(e, s) {
695
- return new Promise(async (t, n) => {
696
- try {
697
- if (be) {
698
- const a = (await be).transaction("icons", "readwrite");
699
- a.objectStore("icons").put(s, e), a.oncomplete = t, a.onerror = n;
700
- } else
701
- me.set(e, s), t(void 0);
702
- } catch {
703
- me.set(e, s), t(void 0);
704
- }
705
- });
706
- }
707
- function ot(e) {
708
- return new Promise(async (s, t) => {
709
- try {
710
- if (be) {
711
- const l = (await be).transaction("icons", "readonly").objectStore("icons").get(e);
712
- l.onsuccess = function() {
713
- s(l.result);
714
- }, l.onerror = t;
715
- } else
716
- s(me.get(e) || null);
717
- } catch {
718
- s(me.get(e) || null);
719
- }
720
- });
721
- }
722
- async function lt(e) {
723
- const s = `https://api.iconify.design/${e}.svg`;
724
- return fetch(s).then((t) => {
725
- if (t.status === 200)
726
- return t.text();
727
- throw new Error(`Failed to load icon: ${e}`);
728
- });
729
- }
730
- async function ct(e) {
731
- const s = e.replace(":", "/"), t = await ot(s);
732
- if (t)
733
- return t;
734
- const n = await lt(s);
735
- return await it(s, n), n;
736
- }
737
- function ut(e, s) {
738
- const t = ["bc-icon", `bc-icon--${e}`];
739
- return s && t.push(`bu-fg-${s}`), t.join(" ");
740
- }
741
- function ae({ icon: e, size: s = "md", color: t, title: n, accessibility: r = "auto" }, ...a) {
742
- const l = T(
743
- r,
744
- n
745
- )((i, c) => i === "decorative" ? !1 : i === "informative" ? !0 : c != null && c !== "");
746
- return he(
747
- pe,
748
- (i) => m.span(
749
- u.class("bu-content-box"),
750
- u.class(
751
- T(
752
- s,
753
- t
754
- )((c, p) => ut(c ?? "md", p))
755
- ),
756
- // Add accessibility attributes based on icon type
757
- M(
758
- l,
759
- () => P(
760
- u.role("img"),
761
- E.label(Se(n, i.$.iconDescription))
762
- ),
763
- () => E.hidden(!0)
764
- ),
765
- We(
766
- { once: !0 },
767
- () => Ke({
768
- request: e,
769
- load: ({ request: c }) => ct(c),
770
- convertError: String,
771
- success: ({ value: c }) => m.span(
772
- fe.width("100%"),
773
- fe.height("100%"),
774
- u.innerHTML(c)
775
- ),
776
- pending: () => m.span(
777
- u.class("animate-spin"),
778
- // Loading state accessibility
779
- M(
780
- l,
781
- () => P(u.role("img"), E.label(i.$.loadingIcon)),
782
- () => E.hidden(!0)
783
- ),
784
- "↻"
785
- ),
786
- failure: ({ error: c }) => m.span(
787
- u.title(c),
788
- u.class("text-red-500"),
789
- // Error state accessibility
790
- M(
791
- l,
792
- () => P(u.role("img"), E.label(i.$.failedToLoadIcon)),
793
- () => E.hidden(!0)
794
- ),
795
- "🚫"
796
- )
797
- })
798
- ),
799
- ...a
800
- )
801
- );
802
- }
803
- function dt(e, s, t, n, r, a) {
804
- const l = [
805
- "bc-button",
806
- `bu-text-${s}`,
807
- `bc-control--padding-${s}`,
808
- `bu-rounded-${n}`
809
- ];
810
- switch (a && l.push("bc-button--loading"), e) {
811
- case "filled":
812
- l.push(`bu-bg-${t}`), r || l.push(`hover:bu-bg-${t}`);
813
- break;
814
- case "light":
815
- l.push(`bu-bg-light-${t}`), r || l.push(`hover:bu-bg-light-${t}`);
816
- break;
817
- case "outline":
818
- l.push(`bu-border--${t}`), r || l.push(`hover:bu-bg-light-${t}`);
819
- break;
820
- case "default":
821
- l.push("bu-bg-light-neutral"), l.push(`bu-text-${t}`), r || l.push("hover:bu-bg-light-base");
822
- break;
823
- case "text":
824
- l.push("bu-bg-inherit"), l.push(`bu-text-${t}`), r || l.push("hover:bu-underline");
825
- break;
826
- }
827
- return l.join(" ");
828
- }
829
- function ht({
830
- type: e = "button",
831
- disabled: s,
832
- loading: t,
833
- variant: n = "filled",
834
- size: r = "md",
835
- color: a = "base",
836
- roundedness: l = "sm",
837
- onClick: i = () => {
838
- }
839
- }, ...c) {
840
- const p = $(null);
841
- return he(
842
- pe,
843
- (f) => m.button(
844
- u.type(e),
845
- u.disabled(
846
- T(
847
- s,
848
- t
849
- )((d, g) => d || g)
850
- ),
851
- // Add ARIA attributes for accessibility
852
- E.busy(t ?? !1),
853
- M(t ?? !1, () => E.label(f.$.loadingExtended)),
854
- u.class(
855
- T(
856
- n,
857
- r,
858
- a,
859
- l,
860
- s,
861
- t
862
- )(
863
- (d, g, w, A, b, I) => dt(
864
- d ?? "filled",
865
- g ?? "md",
866
- w ?? "base",
867
- A ?? "sm",
868
- b,
869
- I
870
- )
871
- )
872
- ),
873
- M(
874
- t ?? !1,
875
- () => P(
876
- fe.width(
877
- p.map((d) => d == null ? "" : `${d.width}px`)
878
- ),
879
- fe.height(
880
- p.map((d) => d == null ? "" : `${d.height}px`)
881
- ),
882
- ae({ icon: "line-md:loading-twotone-loop", size: r ?? "md" }),
883
- // Hidden live region for screen reader announcements
884
- m.span(
885
- u.class("sr-only"),
886
- E.live("polite"),
887
- f.$.loadingExtended
888
- )
889
- ),
890
- () => P(S.click(i), ...c)
891
- ),
892
- M(
893
- t != null,
894
- () => Je(
895
- (d) => Pe(
896
- d.on((g) => {
897
- x.get(t ?? !1) || p.set(g);
898
- })
899
- )
900
- )
901
- )
902
- )
903
- );
904
- }
905
- function Nt({
906
- size: e = "sm",
907
- icon: s = "line-md:close",
908
- disabled: t,
909
- roundedness: n = "full",
910
- color: r = "base",
911
- onClick: a,
912
- label: l
913
- }, ...i) {
914
- return he(pe, (c) => {
915
- const p = Se(l, c.$.closeModal);
916
- return ht(
917
- {
918
- variant: "text",
919
- size: e,
920
- roundedness: n,
921
- disabled: t,
922
- color: r,
923
- onClick: a
924
- },
925
- u.title(p),
926
- E.label(p),
927
- ...i,
928
- ae({ icon: s, size: e ?? "sm" })
929
- );
930
- });
931
- }
932
- function pt(e, s, t) {
933
- const n = [
934
- e ? "bc-base-input-container" : "bc-input-container"
935
- ];
936
- return s ? n.push(
937
- e ? "bc-base-input-container--disabled" : "bc-input-container--disabled"
938
- ) : n.push(
939
- e ? "bc-base-input-container--default" : "bc-input-container--default"
940
- ), t && n.push("bc-input-container--error"), n.join(" ");
941
- }
942
- const ye = ({
943
- baseContainer: e,
944
- disabled: s,
945
- input: t,
946
- before: n,
947
- after: r,
948
- hasError: a,
949
- focusableSelector: l = "input, select, textarea",
950
- growInput: i = !0
951
- }, ...c) => {
952
- const p = x.map(s ?? !1, (f) => f);
953
- return m.div(
954
- Ge((f) => {
955
- const d = () => {
956
- const g = f.querySelector(l);
957
- g == null || g.focus();
958
- };
959
- return f.addEventListener("click", d), Pe(() => f.removeEventListener("click", d));
960
- }),
961
- u.class(
962
- T(
963
- e,
964
- p,
965
- a ?? !1
966
- )(
967
- (f, d, g) => pt(
968
- f ?? !1,
969
- d ?? !1,
970
- g ?? !1
971
- )
972
- )
973
- ),
974
- n != null ? m.span(u.class("bc-input-container__before"), n) : null,
975
- m.div(
976
- u.class("bc-input-container__input"),
977
- u.class(
978
- x.map(
979
- i,
980
- (f) => f ? "bc-input-container__input--grow" : ""
981
- )
982
- ),
983
- t
984
- ),
985
- r != null ? m.span(u.class("bc-input-container__after"), r) : null,
986
- ...c
987
- );
988
- };
989
- function we(e) {
990
- return `bc-label bc-label--${e}`;
991
- }
992
- const Ft = (...e) => m.span(u.class(we("emphasis")), ...e), ft = (...e) => m.span(u.class(we("default")), ...e), mt = (...e) => m.span(u.class(we("muted")), ...e), qt = (...e) => m.span(u.class(we("error")), ...e), Rt = (e) => {
993
- const { value: s, onBlur: t, onChange: n, placeholder: r, disabled: a, id: l } = e, i = l ?? xe("checkbox"), c = `${i}-label`, p = () => {
994
- if (x.get(a ?? !1)) return;
995
- const d = x.get(s);
996
- n == null || n(!d);
997
- }, f = (d) => {
998
- x.get(a ?? !1) || (d.key === " " || d.key === "Enter") && (d.preventDefault(), p());
999
- };
1000
- return ye(
1001
- {
1002
- baseContainer: !0,
1003
- growInput: !1,
1004
- ...e,
1005
- input: m.span(
1006
- u.class("bc-checkbox-input"),
1007
- m.span(
1008
- u.class("bc-checkbox-input__checkbox"),
1009
- u.class(
1010
- x.map(
1011
- s,
1012
- (d) => d ? "bc-checkbox-input__checkbox--checked" : ""
1013
- )
1014
- ),
1015
- u.class(
1016
- x.map(
1017
- a ?? !1,
1018
- (d) => d ? "bc-checkbox-input__checkbox--disabled" : ""
1019
- )
1020
- ),
1021
- u.id(i),
1022
- u.role("checkbox"),
1023
- u.tabindex(
1024
- x.map(
1025
- a ?? !1,
1026
- (d) => d ? -1 : 0
1027
- )
1028
- ),
1029
- E.checked(s),
1030
- E.disabled(a),
1031
- r != null ? E.labelledby(c) : k,
1032
- S.keydown(f),
1033
- t != null ? S.blur(t) : k
1034
- ),
1035
- r != null ? m.label(
1036
- u.class("bc-checkbox-input__label"),
1037
- u.id(c),
1038
- u.for(i),
1039
- mt(r)
1040
- ) : k
1041
- )
1042
- },
1043
- S.click(p)
1044
- );
1045
- }, Ie = ({
1046
- autocomplete: e,
1047
- autofocus: s,
1048
- class: t,
1049
- disabled: n,
1050
- name: r,
1051
- placeholder: a,
1052
- id: l,
1053
- required: i,
1054
- hasError: c
1055
- }) => P(
1056
- u.autocomplete(e),
1057
- u.autofocus(s),
1058
- u.class(t),
1059
- u.disabled(n),
1060
- u.name(r ?? l),
1061
- u.placeholder(a),
1062
- u.id(l),
1063
- E.required(i),
1064
- c != null ? E.invalid(
1065
- c ?? !1
1066
- ) : null
1067
- ), bt = m.span(
1068
- u.class("bc-input-wrapper__required"),
1069
- " *"
1070
- );
1071
- function vt(e) {
1072
- const s = ["bc-input-wrapper"];
1073
- return e && s.push("bc-input-wrapper--horizontal"), s.join(" ");
1074
- }
1075
- function gt(e, s) {
1076
- const t = ["bc-input-wrapper__label-text"];
1077
- return e ? t.push("bc-input-wrapper__label-text--error") : s ? t.push("bc-input-wrapper__label-text--disabled") : t.push("bc-input-wrapper__label-text--default"), t.join(" ");
1078
- }
1079
- const Be = ({
1080
- required: e,
1081
- label: s,
1082
- context: t,
1083
- description: n,
1084
- content: r,
1085
- error: a,
1086
- labelFor: l,
1087
- hasError: i,
1088
- disabled: c,
1089
- horizontal: p
1090
- }, ...f) => {
1091
- const d = i ?? a != null, g = c ?? !1, w = p ?? !1, A = xe("input-wrapper"), b = n ? `${A}-description` : void 0, I = a != null ? `${A}-error` : void 0;
1092
- return m.div(
1093
- u.class(
1094
- x.map(w, (D) => vt(D))
1095
- ),
1096
- s != null || t != null ? m.div(
1097
- u.class("bc-input-wrapper__header"),
1098
- m.div(
1099
- u.class("bc-input-wrapper__label-section"),
1100
- m.label(
1101
- u.class("bc-input-wrapper__label"),
1102
- l != null ? u.for(l) : k,
1103
- m.span(
1104
- u.class(
1105
- T(
1106
- d,
1107
- g
1108
- )(
1109
- (D, j) => gt(
1110
- D ?? !1,
1111
- j ?? !1
1112
- )
1113
- )
1114
- ),
1115
- s
1116
- ),
1117
- s != null && e ? bt : k
1118
- ),
1119
- // Show description under label when horizontal
1120
- M(
1121
- T(
1122
- w,
1123
- n
1124
- )((D, j) => D && j != null),
1125
- () => m.div(
1126
- u.class(
1127
- "bc-input-wrapper__description bc-input-wrapper__description--under-label"
1128
- ),
1129
- u.id(b),
1130
- n
1131
- )
1132
- )
1133
- ),
1134
- t != null ? ft(t) : k
1135
- ) : k,
1136
- m.div(
1137
- u.class("bc-input-wrapper__content"),
1138
- // Add data attributes to help inputs inherit accessibility information
1139
- [b, I].filter(Boolean).length > 0 ? ke.describedby(
1140
- [b, I].filter(Boolean).join(" ")
1141
- ) : k,
1142
- e ? ke.required("true") : k,
1143
- M(d, () => ke.invalid("true")),
1144
- r
1145
- ),
1146
- // Show description at bottom only when not horizontal
1147
- M(
1148
- T(
1149
- w,
1150
- n
1151
- )((D, j) => !D && j != null),
1152
- () => m.div(
1153
- u.class("bc-input-wrapper__description"),
1154
- u.id(b),
1155
- n
1156
- )
1157
- ),
1158
- a != null ? M(
1159
- d,
1160
- () => m.div(
1161
- u.class("bc-input-wrapper__error"),
1162
- u.id(I),
1163
- E.live("polite"),
1164
- // Announce errors to screen readers
1165
- u.role("alert"),
1166
- // Mark as alert for immediate attention
1167
- a
1168
- )
1169
- ) : null,
1170
- ...f
1171
- );
1172
- };
1173
- function Ht(...e) {
1174
- return m.div(u.class("bc-group"), ...e);
1175
- }
1176
- function Ut(...e) {
1177
- return m.div(u.class("bc-stack"), ...e);
1178
- }
1179
- const Gt = (e) => {
1180
- const s = {
1181
- name: "email",
1182
- autocomplete: "email",
1183
- ...e
1184
- }, {
1185
- value: t,
1186
- before: n,
1187
- onBlur: r,
1188
- onChange: a,
1189
- onInput: l,
1190
- placeholder: i
1191
- } = s, c = n ?? ae({
1192
- icon: "line-md:email",
1193
- size: "sm",
1194
- color: "neutral"
1195
- });
1196
- return he(
1197
- pe,
1198
- (p) => ye({
1199
- ...e,
1200
- before: c,
1201
- input: Ae.email(
1202
- Ie(s),
1203
- u.placeholder(Se(i, p.$.emailPlaceholderText)),
1204
- u.value(t),
1205
- u.class("bc-input"),
1206
- r != null ? S.blur(B(r)) : k,
1207
- a != null ? S.change(B(a)) : k,
1208
- l != null ? S.input(B(l)) : k
1209
- )
1210
- })
1211
- );
1212
- }, zt = (e) => {
1213
- const { value: s, onBlur: t, onChange: n, onInput: r } = e;
1214
- return ye({
1215
- ...e,
1216
- input: Ae.text(
1217
- Ie(e),
1218
- u.value(s),
1219
- u.class("bc-input"),
1220
- t != null ? S.blur(B(t)) : k,
1221
- n != null ? S.change(B(n)) : k,
1222
- r != null ? S.input(B(r)) : k
1223
- )
1224
- });
1225
- }, Wt = (e) => {
1226
- const {
1227
- value: s,
1228
- onBlur: t,
1229
- onChange: n,
1230
- onInput: r,
1231
- before: a,
1232
- after: l,
1233
- hasError: i,
1234
- disabled: c,
1235
- autocomplete: p,
1236
- placeholder: f,
1237
- ...d
1238
- } = e, g = {
1239
- name: "password",
1240
- disabled: c,
1241
- ...d
1242
- }, w = $(!0), A = T(
1243
- w,
1244
- p
1245
- )((b, I) => b ? I ?? "current-password" : "off");
1246
- return he(pe, (b) => {
1247
- const I = T(
1248
- b.$.passwordPlaceholderText,
1249
- w,
1250
- f
1251
- )((j, qe, Re) => qe ? "•••••••••••••••" : Re ?? j), D = m.button(
1252
- u.class("bc-input-container__password-toggle bu-text-light-gray"),
1253
- E.label(b.$.togglePasswordVisibility),
1254
- S.click(() => w.update((j) => !j)),
1255
- M(
1256
- w,
1257
- () => ae({ icon: "line-md:watch" }),
1258
- () => ae({ icon: "line-md:watch-off" })
1259
- )
1260
- );
1261
- return ye({
1262
- before: a,
1263
- disabled: c,
1264
- hasError: i,
1265
- input: m.input(
1266
- Ie({
1267
- ...g,
1268
- autocomplete: A,
1269
- placeholder: I
1270
- }),
1271
- M(
1272
- w,
1273
- () => P(u.type("password")),
1274
- () => P(u.type("text"))
1275
- ),
1276
- u.class("bc-input"),
1277
- u.value(s),
1278
- t != null ? S.blur(B(t)) : k,
1279
- n != null ? S.change(B(n)) : k,
1280
- r != null ? S.input(B(r)) : k
1281
- ),
1282
- after: l != null ? P(D, l) : D
1283
- });
1284
- });
1285
- }, yt = (
1286
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1287
- (e, s) => () => {
1288
- e.markTouched(), s == null || s();
1289
- }
1290
- ), wt = (e, s) => (t) => {
1291
- e.change(t), s == null || s(t);
1292
- };
1293
- function je(e, s) {
1294
- const { controller: t, onBlur: n, onChange: r, ...a } = s;
1295
- return e({
1296
- id: t.name,
1297
- disabled: t.disabled,
1298
- value: t.value,
1299
- hasError: t.errorVisible,
1300
- ...a,
1301
- onChange: wt(t, r),
1302
- onBlur: yt(t, n)
1303
- });
1304
- }
1305
- function Kt(e, s, ...t) {
1306
- return Be(
1307
- {
1308
- ...s,
1309
- content: je(
1310
- e,
1311
- s
1312
- )
1313
- },
1314
- ...t
1315
- );
1316
- }
1317
- function kt(e, s) {
1318
- const { toInput: t, fromInput: n, controller: r, ...a } = s, l = r.transform(t, n);
1319
- return je(e, {
1320
- ...a,
1321
- controller: l
1322
- });
1323
- }
1324
- function Jt(e, s, ...t) {
1325
- return Be(
1326
- {
1327
- ...s,
1328
- content: kt(e, s)
1329
- },
1330
- ...t
1331
- );
1332
- }
1333
- function Qt(e) {
1334
- return e.split(".").map((t) => {
1335
- const n = t.match(/^\[(\d+)\]$/);
1336
- return n ? Number(n[1]) : t;
1337
- });
1338
- }
1339
- function St(e) {
1340
- return typeof e == "number" ? `[${e}]` : `.${e}`;
1341
- }
1342
- function It(e) {
1343
- if (e.length === 0) return "";
1344
- const [s, ...t] = e;
1345
- return [
1346
- typeof s == "number" ? `[${s}]` : s,
1347
- ...t.map(St)
1348
- ].join("");
1349
- }
1350
- function ve(e) {
1351
- return function(t) {
1352
- var r;
1353
- if (t.type === "valid") return t;
1354
- let n = t.error;
1355
- for (const a of e)
1356
- if (n = (r = n == null ? void 0 : n.dependencies) == null ? void 0 : r[a], n == null) return C.valid;
1357
- return C.invalid(n);
1358
- };
1359
- }
1360
- var L, ie, N, K;
1361
- const ge = class ge {
1362
- constructor(s, t, n, r, a, l = W) {
1363
- h(this, "path");
1364
- h(this, "change");
1365
- h(this, "value");
1366
- h(this, "status");
1367
- h(this, "error");
1368
- h(this, "hasError");
1369
- h(this, "touched");
1370
- h(this, "errorVisible");
1371
- h(this, "dirty");
1372
- h(this, "dependencyErrors");
1373
- v(this, L, {
1374
- disabled: $(!1),
1375
- touched: $(!1)
1376
- });
1377
- v(this, ie);
1378
- v(this, N, $(void 0));
1379
- h(this, "parent");
1380
- h(this, "disabled");
1381
- v(this, K, []);
1382
- h(this, "disabledOrHasErrors");
1383
- h(this, "onDispose", (s) => {
1384
- o(this, K).push(s);
1385
- });
1386
- h(this, "dispose", () => {
1387
- for (const s of o(this, K))
1388
- try {
1389
- s();
1390
- } catch (t) {
1391
- console.error("Error in dispose callback:", t);
1392
- }
1393
- o(this, K).length = 0;
1394
- });
1395
- h(this, "setDisabled", (s) => {
1396
- o(this, L).disabled.set(s);
1397
- });
1398
- h(this, "disable", () => this.setDisabled(!0));
1399
- h(this, "enable", () => this.setDisabled(!1));
1400
- h(this, "markTouched", () => {
1401
- o(this, L).touched.set(!0);
1402
- });
1403
- h(this, "resetTouched", () => {
1404
- o(this, L).touched.set(!1);
1405
- });
1406
- h(this, "markPristine", () => {
1407
- o(this, N).set(this.value.value);
1408
- });
1409
- h(this, "reset", () => {
1410
- this.change(o(this, N).value);
1411
- });
1412
- h(this, "array", (s = W) => new _t(
1413
- this.path,
1414
- this.change,
1415
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1416
- this.value,
1417
- this.status,
1418
- this.parent,
1419
- s
1420
- ));
1421
- h(this, "object", (s = W) => new Dt(
1422
- this.path,
1423
- this.change,
1424
- this.value,
1425
- this.status,
1426
- this.parent,
1427
- s
1428
- ));
1429
- h(this, "transform", (s, t, n = [], r = W) => new ge(
1430
- [...this.path, ...n],
1431
- (a) => this.change(t(a)),
1432
- this.value.map(s, r),
1433
- this.status.map(ve(n)),
1434
- this.parent,
1435
- r
1436
- ));
1437
- h(this, "asyncTransform", (s, t, n, r = [], a = W) => new ge(
1438
- [...this.path, ...r],
1439
- (l) => {
1440
- t(l).then((i) => this.change(i));
1441
- },
1442
- this.value.mapAsync(s, n, void 0, a),
1443
- this.status.map(ve(r)),
1444
- this.parent,
1445
- a
1446
- ));
1447
- this.path = s, this.change = t, this.value = n, this.status = r, z(this, ie, l), o(this, N).set(n.value), this.error = r.map(
1448
- (i) => {
1449
- var c;
1450
- return (i == null ? void 0 : i.type) === "invalid" ? (c = i.error) == null ? void 0 : c.message : void 0;
1451
- }
1452
- ), this.hasError = this.error.map((i) => i != null), this.touched = o(this, L).touched, a.validationMode ? this.errorVisible = T(
1453
- this.hasError,
1454
- this.touched,
1455
- a.validationMode
1456
- )((i, c, p) => p === "continuous" ? !!i : !!i && !!c) : this.errorVisible = T(
1457
- this.hasError,
1458
- this.touched
1459
- )((i, c) => !!i && !!c), this.dirty = T(
1460
- this.value,
1461
- o(this, N)
1462
- )((i, c) => !o(this, ie).call(this, i, c)), this.dependencyErrors = r.map(
1463
- (i) => {
1464
- var c;
1465
- return (i == null ? void 0 : i.type) === "invalid" ? (c = i.error) == null ? void 0 : c.dependencies : void 0;
1466
- }
1467
- ), this.parent = a, this.disabled = T(
1468
- o(this, L).disabled,
1469
- a.disabled
1470
- )((i, c) => i || c), this.disabledOrHasErrors = T(
1471
- this.disabled,
1472
- this.hasError
1473
- )((i, c) => i || c), this.onDispose(() => {
1474
- o(this, L).disabled.dispose(), o(this, L).touched.dispose(), this.disabled.dispose(), this.error.dispose(), this.errorVisible.dispose(), this.dirty.dispose(), o(this, N).dispose(), this.dependencyErrors.dispose(), this.disabledOrHasErrors.dispose();
1475
- });
1476
- }
1477
- get name() {
1478
- return It(this.path);
1479
- }
1480
- };
1481
- L = new WeakMap(), ie = new WeakMap(), N = new WeakMap(), K = new WeakMap();
1482
- let G = ge;
1483
- var O, J, Q, Y, Z, X, ee, oe, le, ce, te;
1484
- class Dt extends G {
1485
- constructor(t, n, r, a, l, i) {
1486
- super(
1487
- t,
1488
- n,
1489
- r.map((p) => p ?? {}, i),
1490
- a,
1491
- l,
1492
- i
1493
- );
1494
- v(this, O, /* @__PURE__ */ new Map());
1495
- v(this, J, /* @__PURE__ */ new Map());
1496
- v(this, Q, /* @__PURE__ */ new Map());
1497
- v(this, Y, $(!1));
1498
- h(this, "touchedDeep", o(this, Y));
1499
- v(this, Z, /* @__PURE__ */ new Map());
1500
- v(this, X, /* @__PURE__ */ new Map());
1501
- v(this, ee, $(!1));
1502
- h(this, "dirtyDeep", o(this, ee));
1503
- v(this, oe);
1504
- v(this, le);
1505
- v(this, ce, () => {
1506
- let t = !1;
1507
- for (const n of o(this, J).values())
1508
- if (n) {
1509
- t = !0;
1510
- break;
1511
- }
1512
- o(this, Y).set(this.touched.value || t);
1513
- });
1514
- h(this, "field", (t) => {
1515
- if (o(this, O).has(t))
1516
- return o(this, O).get(t);
1517
- const n = async (i) => {
1518
- this.change({
1519
- ...this.value.value,
1520
- [t]: i
1521
- });
1522
- }, r = new G(
1523
- [...this.path, t],
1524
- n,
1525
- this.value.map((i) => i[t]),
1526
- this.status.map(ve([t])),
1527
- {
1528
- disabled: this.disabled,
1529
- // propagate validationMode to children if present
1530
- validationMode: this.parent.validationMode
1531
- }
1532
- );
1533
- o(this, O).set(t, r);
1534
- const a = r.touched.on((i) => {
1535
- o(this, J).set(t, i), o(this, ce).call(this);
1536
- });
1537
- o(this, Q).set(t, a);
1538
- const l = r.dirty.on((i) => {
1539
- o(this, Z).set(t, i), o(this, te).call(this);
1540
- });
1541
- return o(this, X).set(t, l), r;
1542
- });
1543
- h(this, "markAllTouched", () => {
1544
- this.markTouched();
1545
- const t = this.value.value;
1546
- for (const n of Object.keys(t))
1547
- this.field(n).markTouched();
1548
- for (const n of o(this, O).values())
1549
- n.markTouched();
1550
- });
1551
- h(this, "markAllPristine", () => {
1552
- var n, r, a;
1553
- this.markPristine();
1554
- const t = this.value.value;
1555
- for (const l of Object.keys(t))
1556
- (r = (n = this.field(l)).markPristine) == null || r.call(n);
1557
- for (const l of o(this, O).values())
1558
- (a = l.markPristine) == null || a.call(l);
1559
- });
1560
- v(this, te, () => {
1561
- let t = !1;
1562
- for (const n of o(this, Z).values())
1563
- if (n) {
1564
- t = !0;
1565
- break;
1566
- }
1567
- o(this, ee).set(this.dirty.value || t);
1568
- });
1569
- z(this, oe, this.touched.on(() => {
1570
- o(this, ce).call(this);
1571
- })), z(this, le, this.dirty.on(() => {
1572
- o(this, te).call(this);
1573
- }));
1574
- const c = this.value.on(() => o(this, te).call(this));
1575
- this.onDispose(() => {
1576
- for (const p of o(this, O).values())
1577
- p.dispose();
1578
- o(this, O).clear();
1579
- for (const p of o(this, Q).values()) p();
1580
- o(this, Q).clear(), o(this, J).clear(), o(this, Y).dispose();
1581
- for (const p of o(this, X).values()) p();
1582
- o(this, X).clear(), o(this, Z).clear(), o(this, ee).dispose(), o(this, oe).call(this), o(this, le).call(this), c();
1583
- });
1584
- }
1585
- }
1586
- O = new WeakMap(), J = new WeakMap(), Q = new WeakMap(), Y = new WeakMap(), Z = new WeakMap(), X = new WeakMap(), ee = new WeakMap(), oe = new WeakMap(), le = new WeakMap(), ce = new WeakMap(), te = new WeakMap();
1587
- var V, R, F, se, H, q, ne, ue, de, re, U;
1588
- class _t extends G {
1589
- constructor(t, n, r, a, l, i) {
1590
- const c = r.map((d) => d ?? [], i);
1591
- super(t, n, c, a, l, i);
1592
- v(this, V, new Array());
1593
- h(this, "length");
1594
- v(this, R, /* @__PURE__ */ new Map());
1595
- v(this, F, /* @__PURE__ */ new Map());
1596
- v(this, se, $(!1));
1597
- h(this, "touchedDeep", o(this, se));
1598
- v(this, H, /* @__PURE__ */ new Map());
1599
- v(this, q, /* @__PURE__ */ new Map());
1600
- v(this, ne, $(!1));
1601
- h(this, "dirtyDeep", o(this, ne));
1602
- v(this, ue);
1603
- v(this, de);
1604
- v(this, re, () => {
1605
- let t = !1;
1606
- for (const n of o(this, R).values())
1607
- if (n) {
1608
- t = !0;
1609
- break;
1610
- }
1611
- o(this, se).set(this.touched.value || t);
1612
- });
1613
- h(this, "item", (t) => {
1614
- if (o(this, V)[t])
1615
- return o(this, V)[t];
1616
- const n = async (i) => {
1617
- const c = this.value.value.slice();
1618
- c[t] = i, this.change(c);
1619
- }, r = new G(
1620
- [...this.path, t],
1621
- n,
1622
- this.value.map((i) => i[t]),
1623
- this.status.map(ve([t])),
1624
- {
1625
- disabled: this.disabled,
1626
- validationMode: this.parent.validationMode
1627
- }
1628
- );
1629
- o(this, V)[t] = r;
1630
- const a = r.touched.on((i) => {
1631
- o(this, R).set(t, i), o(this, re).call(this);
1632
- });
1633
- o(this, F).set(t, a);
1634
- const l = r.dirty.on((i) => {
1635
- o(this, H).set(t, i), o(this, U).call(this);
1636
- });
1637
- return o(this, q).set(t, l), r;
1638
- });
1639
- h(this, "push", (...t) => {
1640
- this.change([...this.value.value, ...t]);
1641
- });
1642
- h(this, "pop", () => {
1643
- this.splice(this.value.value.length - 1, 1);
1644
- });
1645
- h(this, "shift", () => {
1646
- this.splice(0, 1);
1647
- });
1648
- h(this, "unshift", (...t) => {
1649
- this.change([...t, ...this.value.value]);
1650
- });
1651
- h(this, "removeAt", (t) => {
1652
- this.splice(t, 1);
1653
- });
1654
- h(this, "splice", (t, n) => {
1655
- const r = this.value.value.slice();
1656
- r.splice(t, n), this.change(r);
1657
- });
1658
- h(this, "move", (t, n, r = 1) => {
1659
- if (r < 1 || t === n) return;
1660
- const a = this.value.value.slice(), l = a.splice(t, r);
1661
- a.splice(n, 0, ...l), this.change(a);
1662
- });
1663
- h(this, "markAllTouched", () => {
1664
- this.markTouched();
1665
- const t = this.value.value.length;
1666
- for (let n = 0; n < t; n++)
1667
- this.item(n).markTouched();
1668
- });
1669
- h(this, "markAllPristine", () => {
1670
- var n, r;
1671
- this.markPristine();
1672
- const t = this.value.value.length;
1673
- for (let a = 0; a < t; a++)
1674
- (r = (n = this.item(a)).markPristine) == null || r.call(n);
1675
- });
1676
- v(this, U, () => {
1677
- let t = !1;
1678
- for (const n of o(this, H).values())
1679
- if (n) {
1680
- t = !0;
1681
- break;
1682
- }
1683
- o(this, ne).set(this.dirty.value || t);
1684
- });
1685
- const p = c.on((d) => {
1686
- const g = o(this, V).length - d.length;
1687
- g > 0 && (o(this, V).splice(d.length, g).forEach((w, A) => {
1688
- const b = d.length + A;
1689
- w.dispose();
1690
- const I = o(this, F).get(b);
1691
- I == null || I(), o(this, F).delete(b), o(this, R).delete(b);
1692
- const D = o(this, q).get(b);
1693
- D == null || D(), o(this, q).delete(b), o(this, H).delete(b);
1694
- }), o(this, re).call(this), o(this, U).call(this));
1695
- });
1696
- this.length = c.map((d) => d.length), z(this, ue, this.touched.on(() => {
1697
- o(this, re).call(this);
1698
- })), z(this, de, this.dirty.on(() => {
1699
- o(this, U).call(this);
1700
- }));
1701
- const f = this.value.on(() => o(this, U).call(this));
1702
- this.onDispose(() => {
1703
- for (const d of o(this, V))
1704
- d.dispose();
1705
- this.length.dispose(), o(this, V).length = 0, p(), c.dispose();
1706
- for (const d of o(this, F).values()) d();
1707
- o(this, F).clear(), o(this, R).clear(), o(this, se).dispose();
1708
- for (const d of o(this, q).values()) d();
1709
- o(this, q).clear(), o(this, H).clear(), o(this, ne).dispose(), o(this, ue).call(this), o(this, de).call(this), f();
1710
- });
1711
- }
1712
- }
1713
- V = new WeakMap(), R = new WeakMap(), F = new WeakMap(), se = new WeakMap(), H = new WeakMap(), q = new WeakMap(), ne = new WeakMap(), ue = new WeakMap(), de = new WeakMap(), re = new WeakMap(), U = new WeakMap();
1714
- function Et(e) {
1715
- function s(t) {
1716
- return typeof t == "number" ? t : t.toString();
1717
- }
1718
- return e.map(
1719
- (t) => typeof t == "object" && t.key != null ? s(t.key) : s(t)
1720
- );
1721
- }
1722
- function Tt(e) {
1723
- const s = e.filter((r) => r.path == null || r.path.length === 0).map((r) => r.message), t = e.filter((r) => r.path != null && r.path.length > 0).reduce((r, a) => {
1724
- const l = Et(a.path), i = l.pop();
1725
- let c = r;
1726
- for (const p of l)
1727
- c.dependencies == null && (c.dependencies = {}), c.dependencies[p] == null && (c.dependencies[p] = {}), c = c.dependencies[p];
1728
- return c.dependencies == null && (c.dependencies = {}), c.dependencies[i] = { message: a.message }, r;
1729
- }, {}), n = s.join(`
1730
- `);
1731
- return {
1732
- ...t,
1733
- message: n != "" ? n : void 0
1734
- };
1735
- }
1736
- function Ct({
1737
- initialValue: e,
1738
- onChange: s,
1739
- validate: t,
1740
- equals: n,
1741
- validationMode: r,
1742
- validateDebounceMs: a
1743
- }) {
1744
- const l = x.deriveProp(e), i = $(C.valid), c = $(!1), p = $(r ?? "touchedOrSubmit"), f = (b) => {
1745
- i.set(b);
1746
- };
1747
- let d;
1748
- const g = async (b) => {
1749
- if (t != null) {
1750
- const I = await t(b);
1751
- f(I);
1752
- }
1753
- }, w = async (b) => {
1754
- l.set(b), s == null || s(b);
1755
- const I = p.value;
1756
- if (t != null) {
1757
- if (I === "onSubmit")
1758
- return;
1759
- const D = a ?? 0;
1760
- D > 0 ? (d && clearTimeout(d), d = setTimeout(() => {
1761
- g(b);
1762
- }, D)) : await g(b);
1763
- }
1764
- }, A = new G(
1765
- [],
1766
- w,
1767
- l,
1768
- i,
1769
- {
1770
- disabled: c,
1771
- validationMode: p
1772
- },
1773
- n ?? W
1774
- );
1775
- return A.onDispose(() => {
1776
- c.dispose(), l.dispose(), i.dispose(), p.dispose(), d && clearTimeout(d);
1777
- }), { controller: A, setStatus: f };
1778
- }
1779
- function Ne(e) {
1780
- return P(u.disabled(e.disabled), u.name(e.name));
1781
- }
1782
- function Yt(e, {
1783
- triggerOn: s = "change"
1784
- } = {}) {
1785
- return P(
1786
- Ne(e),
1787
- u.value(e.value),
1788
- (s === "input" ? S.input : S.change)(B(e.change))
1789
- );
1790
- }
1791
- function Zt(e, {
1792
- triggerOn: s = "change"
1793
- } = {}) {
1794
- return P(
1795
- Ne(e),
1796
- u.valueAsNumber(e.value),
1797
- (s === "input" ? S.input : S.change)(
1798
- ze(e.change)
1799
- )
1800
- );
1801
- }
1802
- function $e(e) {
1803
- return e.issues != null ? C.invalid(Tt(e.issues)) : C.valid;
1804
- }
1805
- async function Xt({
1806
- task: e,
1807
- errorMessage: s,
1808
- errorPath: t = ["root"],
1809
- validation: n
1810
- }) {
1811
- try {
1812
- const r = await e();
1813
- return n != null ? n(r) : C.valid;
1814
- } catch (r) {
1815
- const a = s ?? (r instanceof Error ? r.message : "Operation failed");
1816
- return t.length === 1 && t[0] === "root" ? C.invalid({
1817
- message: a
1818
- }) : C.invalid({
1819
- dependencies: Fe(t, a)
1820
- });
1821
- }
1822
- }
1823
- function Fe(e, s) {
1824
- if (e.length === 1)
1825
- return {
1826
- [e[0]]: { message: s }
1827
- };
1828
- const [t, ...n] = e;
1829
- return {
1830
- [t]: {
1831
- dependencies: Fe(n, s)
1832
- }
1833
- };
1834
- }
1835
- function es({
1836
- initialValue: e = {},
1837
- schema: s,
1838
- submit: t = async () => C.valid,
1839
- validationMode: n,
1840
- validateDebounceMs: r
1841
- }) {
1842
- const { controller: a, setStatus: l } = Ct({
1843
- initialValue: e,
1844
- validationMode: n ?? "touchedOrSubmit",
1845
- validateDebounceMs: r,
1846
- validate: (n ?? "touchedOrSubmit") === "onSubmit" ? void 0 : async (f) => $e(
1847
- await s["~standard"].validate(f)
1848
- )
1849
- }), i = $(!1), c = a.object();
1850
- return c.onDispose(i.dispose), {
1851
- controller: c,
1852
- setStatus: l,
1853
- onSubmit: async (f) => {
1854
- if (i.set(!0), f.preventDefault(), c.markAllTouched(), (n ?? "touchedOrSubmit") === "onSubmit") {
1855
- const g = c.value.value, w = $e(
1856
- await s["~standard"].validate(g)
1857
- );
1858
- if (l(w), w.type === "invalid") {
1859
- i.set(!1);
1860
- return;
1861
- }
1862
- }
1863
- const d = await t(c.value.value);
1864
- i.set(!1), d.type === "invalid" && l(d);
1865
- },
1866
- submitting: i
1867
- };
1868
- }
1869
- function $t(e) {
1870
- const s = e.split("-"), t = [e];
1871
- return s.length > 1 && t.push(s[0]), t;
1872
- }
1873
- function Mt({
1874
- locale: e,
1875
- defaultLocale: s = "en-US",
1876
- defaultMessages: t,
1877
- localeLoader: n
1878
- }) {
1879
- const r = $(s), a = $(t), l = e.on(async (i) => {
1880
- if (i === r.value) return;
1881
- r.set(i);
1882
- const c = $t(i);
1883
- for (const p of c)
1884
- try {
1885
- const f = await n(p);
1886
- if (
1887
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1888
- typeof f.default == "object" && Object.keys(f).length === 1
1889
- ) {
1890
- console.error(
1891
- "It appears that you are trying to load a translation module without referencing the default export. Please use `(await import(...)).default` in your loader function."
1892
- );
1893
- return;
1894
- }
1895
- if (i === r.value) {
1896
- a.set(f);
1897
- return;
1898
- }
1899
- } catch {
1900
- continue;
1901
- }
1902
- console.warn(`No locale found for "'${e}", using fallback`), i === r.value && a.set(t);
1903
- });
1904
- return {
1905
- /** Clean up all resources and event listeners */
1906
- dispose: () => {
1907
- l(), r.dispose(), a.dispose();
1908
- },
1909
- /** Translation functions that return reactive signals */
1910
- t: a
1911
- };
1912
- }
1913
- function Pt({
1914
- defaultLocale: e,
1915
- defaultMessages: s,
1916
- localeLoader: t,
1917
- providerName: n = "I18nProvider"
1918
- }) {
1919
- return {
1920
- mark: Me(n),
1921
- create: (r, a) => {
1922
- const {
1923
- value: { locale: l }
1924
- } = a.getProvider(nt.mark), { t: i, dispose: c } = Mt({
1925
- locale: l,
1926
- defaultMessages: s,
1927
- defaultLocale: e,
1928
- localeLoader: t
1929
- });
1930
- return {
1931
- value: i,
1932
- dispose: c
1933
- };
1934
- }
1935
- };
1936
- }
1937
- const pe = Pt({
1938
- defaultLocale: Ze,
1939
- defaultMessages: Ye,
1940
- localeLoader: async (e) => (await Xe(/* @__PURE__ */ Object.assign({ "./locales/ar.ts": () => import("./ar-CMndb3tf.js"), "./locales/de.ts": () => import("./de-Cgy7XJBg.js"), "./locales/en.ts": () => Promise.resolve().then(() => Qe), "./locales/es.ts": () => import("./es-j0qszDAW.js"), "./locales/fa.ts": () => import("./fa-COUp2ofv.js"), "./locales/fr.ts": () => import("./fr-B5Ar6QcE.js"), "./locales/he.ts": () => import("./he-D5HTHvKh.js"), "./locales/hi.ts": () => import("./hi-Bcc7iEXp.js"), "./locales/it.ts": () => import("./it-CTCKFU5g.js"), "./locales/ja.ts": () => import("./ja-BGoETTZv.js"), "./locales/ko.ts": () => import("./ko-xHeRs9LU.js"), "./locales/nl.ts": () => import("./nl-ey2Li7DF.js"), "./locales/pl.ts": () => import("./pl-Bf0QaCGx.js"), "./locales/pt.ts": () => import("./pt-D-_KxA9g.js"), "./locales/ru.ts": () => import("./ru-Dzbl29K2.js"), "./locales/tr.ts": () => import("./tr-yMHT8n7z.js"), "./locales/ur.ts": () => import("./ur-CdQA0epV.js"), "./locales/vi.ts": () => import("./vi-A8UmZU3L.js"), "./locales/zh.ts": () => import("./zh-D0nnvX8T.js") }), `./locales/${e}.ts`, 3)).default,
1941
- providerName: "BeatUII18n"
1942
- });
1943
- export {
1944
- Mt as $,
1945
- St as A,
1946
- pe as B,
1947
- Nt as C,
1948
- It as D,
1949
- Gt as E,
1950
- Dt as F,
1951
- Ht as G,
1952
- _t as H,
1953
- ae as I,
1954
- Et as J,
1955
- Tt as K,
1956
- ft as L,
1957
- Jt as M,
1958
- Ct as N,
1959
- W as O,
1960
- Wt as P,
1961
- Ne as Q,
1962
- bt as R,
1963
- Ut as S,
1964
- zt as T,
1965
- Yt as U,
1966
- Zt as V,
1967
- $e as W,
1968
- Ft as X,
1969
- mt as Y,
1970
- qt as Z,
1971
- Xe as _,
1972
- ht as a,
1973
- Oe as a0,
1974
- tt as a1,
1975
- Ot as a2,
1976
- Vt as a3,
1977
- Bt as a4,
1978
- st as a5,
1979
- jt as a6,
1980
- C as b,
1981
- Rt as c,
1982
- Kt as d,
1983
- ye as e,
1984
- Te as f,
1985
- Ie as g,
1986
- yt as h,
1987
- wt as i,
1988
- Be as j,
1989
- Ye as k,
1990
- nt as l,
1991
- Pt as m,
1992
- G as n,
1993
- ve as o,
1994
- je as p,
1995
- dt as q,
1996
- Ze as r,
1997
- xe as s,
1998
- Xt as t,
1999
- es as u,
2000
- Ve as v,
2001
- it as w,
2002
- ot as x,
2003
- kt as y,
2004
- Qt as z
2005
- };