@tempots/beatui 0.87.3 → 0.87.4

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 (145) hide show
  1. package/dist/{ar-DjMvIww5.js → ar-Dn7AkNO5.js} +1 -1
  2. package/dist/auth/index.cjs.js +1 -1
  3. package/dist/auth/index.es.js +1 -1
  4. package/dist/{auth-divider-BIefTDoO.js → auth-divider-BZPM2Xd3.js} +101 -103
  5. package/dist/{auth-divider-V_Se6Qhe.cjs → auth-divider-Cj-xJxF_.cjs} +1 -1
  6. package/dist/better-auth/index.cjs.js +1 -1
  7. package/dist/better-auth/index.es.js +12 -12
  8. package/dist/{colors-BmLYKmoH.js → colors-CatA-RXf.js} +9 -9
  9. package/dist/{de-wChFYqM4.js → de-QYhBiWv7.js} +1 -1
  10. package/dist/deep-merge-BmxkFFi1.cjs +1 -0
  11. package/dist/{deep-merge-BRqRzEQs.js → deep-merge-D076XcC5.js} +152 -156
  12. package/dist/{duration-input-BDEb1Bb7.js → duration-input-6RN16H08.js} +5 -5
  13. package/dist/{duration-input-BtFL5Vjx.cjs → duration-input-CJU-yeKk.cjs} +1 -1
  14. package/dist/{editor-toolbar-group-CwCCGzEC.js → editor-toolbar-group-DRCbXeQP.js} +6 -3
  15. package/dist/{es-CmPF3IGl.js → es-Ba31pZAd.js} +1 -1
  16. package/dist/{fa-D696e75R.js → fa-DvLjl_Ha.js} +1 -1
  17. package/dist/{fr-B0jeX1Hx.js → fr-D64yBpAp.js} +1 -1
  18. package/dist/{he-SgAsIYJA.js → he-DHZGEQ7C.js} +1 -1
  19. package/dist/{hi-s9oiIihq.js → hi-CeAXVCvp.js} +1 -1
  20. package/dist/{index-CaWDj1Vg.cjs → index-BIGCKfNz.cjs} +10 -10
  21. package/dist/{index-DdqGL9Jk.js → index-BTITknMc.js} +701 -684
  22. package/dist/{index-qa82MK4Z.cjs → index-Bso_SkEn.cjs} +1 -1
  23. package/dist/{index-B0t-nt7i.js → index-DWDC-qRY.js} +4 -4
  24. package/dist/{index-D2_J_-XS.js → index-rHnH2IGb.js} +77 -77
  25. package/dist/index.cjs.js +2 -2
  26. package/dist/index.es.js +1015 -1018
  27. package/dist/{index.esm-ChUrm4xR.js → index.esm-By0m3ki1.js} +3 -3
  28. package/dist/{input-container-DhUiLmXE.js → input-container-BTyCOubf.js} +1 -1
  29. package/dist/{it-Dc4IMciD.js → it-Im0KgKWL.js} +1 -1
  30. package/dist/{ja-D2t2g5xj.js → ja-lliCbC19.js} +1 -1
  31. package/dist/json-schema/index.cjs.js +1 -1
  32. package/dist/json-schema/index.es.js +97 -103
  33. package/dist/json-schema-display/index.cjs.js +1 -1
  34. package/dist/json-schema-display/index.es.js +15 -15
  35. package/dist/json-structure/index.cjs.js +1 -1
  36. package/dist/json-structure/index.es.js +349 -351
  37. package/dist/{ko-BRylA5JZ.js → ko-B9W4RBBs.js} +1 -1
  38. package/dist/lexical/index.cjs.js +5 -12
  39. package/dist/lexical/index.es.js +54 -84
  40. package/dist/{menu-Ui4lUPHM.js → menu-CV85y3Xf.js} +1 -1
  41. package/dist/{modal-Dkje8L_l.js → modal-CD3DwAlD.js} +5 -5
  42. package/dist/{modal-Coenk8Fy.cjs → modal-jJMS0ZlW.cjs} +1 -1
  43. package/dist/monaco/index.es.js +1 -1
  44. package/dist/{nl-Dh7LUWAn.js → nl-ba5SyHsw.js} +1 -1
  45. package/dist/notice-9lpZ-VDn.cjs +1 -0
  46. package/dist/{notice-BmkckDsD.js → notice-Cc26kgiB.js} +26 -28
  47. package/dist/{oneof-branch-detection-Vov_e3kI.cjs → oneof-branch-detection-BsGhMslW.cjs} +6 -6
  48. package/dist/{oneof-branch-detection-BED_n2MT.js → oneof-branch-detection-DiAtgGQH.js} +1740 -1734
  49. package/dist/{pl-XEG-p1Q9.js → pl-DCiJAZWC.js} +1 -1
  50. package/dist/prosemirror/index.cjs.js +1 -1
  51. package/dist/prosemirror/index.es.js +1 -1
  52. package/dist/{pt-DYsDA2sZ.js → pt-Df5bAGWA.js} +1 -1
  53. package/dist/{ru-BTKBykp-.js → ru-Dg-c670Y.js} +1 -1
  54. package/dist/stack-4VUGISn6.cjs +1 -0
  55. package/dist/{stack-BJgsPJ9A.js → stack-Bm-UZosx.js} +145 -139
  56. package/dist/tailwind/preset.es.js +2 -2
  57. package/dist/tailwind/vite-plugin.es.js +1 -1
  58. package/dist/{text-input-BZmAB3_o.js → text-input-Cux5iiUC.js} +5 -5
  59. package/dist/{theme-BzpMLdvH.js → theme-kQZEeusG.js} +4 -4
  60. package/dist/{toolbar-Pdj-F80l.js → toolbar-DYmKrtic.js} +1 -1
  61. package/dist/{tr-Cp8ZCUic.js → tr-Dhpiq0u_.js} +1 -1
  62. package/dist/{translations-BGblCUBj.js → translations-BLlzvZgw.js} +30 -30
  63. package/dist/{translations-jUYta1_1.js → translations-COSDzhvR.js} +1 -1
  64. package/dist/types/auth-i18n/translations.d.ts +2 -2
  65. package/dist/types/beatui-i18n/translations.d.ts +2 -2
  66. package/dist/types/better-auth/components/authenticated.d.ts +2 -2
  67. package/dist/types/better-auth/components/better-auth-container.d.ts +1 -1
  68. package/dist/types/better-auth/i18n/translations.d.ts +2 -2
  69. package/dist/types/better-auth/provider.d.ts +2 -2
  70. package/dist/types/components/auth/auth-container.d.ts +1 -1
  71. package/dist/types/components/auth/auth-email-prop.d.ts +1 -1
  72. package/dist/types/components/beatui.d.ts +1 -1
  73. package/dist/types/components/button/button.d.ts +1 -1
  74. package/dist/types/components/content/native-pdf-preview.d.ts +1 -1
  75. package/dist/types/components/content/pdfjs-preview.d.ts +1 -1
  76. package/dist/types/components/data/icon.d.ts +1 -1
  77. package/dist/types/components/data/page-drop-zone.d.ts +1 -1
  78. package/dist/types/components/data/unstyled-drop-zone.d.ts +1 -1
  79. package/dist/types/components/editor-toolbar/editor-toolbar-button.d.ts +1 -1
  80. package/dist/types/components/editor-toolbar/editor-toolbar-group.d.ts +1 -1
  81. package/dist/types/components/form/control/control.d.ts +2 -2
  82. package/dist/types/components/form/control/ensure-control.d.ts +1 -1
  83. package/dist/types/components/form/control/list-control.d.ts +1 -1
  84. package/dist/types/components/form/controller/color-controller.d.ts +4 -4
  85. package/dist/types/components/form/input/appearance-selector.d.ts +2 -2
  86. package/dist/types/components/form/input/base64-input.d.ts +1 -1
  87. package/dist/types/components/form/input/base64s-input.d.ts +1 -1
  88. package/dist/types/components/form/input/combobox-tags-input.d.ts +1 -1
  89. package/dist/types/components/form/input/email-input.d.ts +1 -1
  90. package/dist/types/components/form/input/file-input.d.ts +1 -1
  91. package/dist/types/components/form/input/files-input.d.ts +1 -1
  92. package/dist/types/components/form/input/input-options.d.ts +1 -1
  93. package/dist/types/components/form/input/list-input.d.ts +1 -1
  94. package/dist/types/components/form/input/nullable-base64-input.d.ts +1 -1
  95. package/dist/types/components/form/input/nullable-plain-date-input.d.ts +12 -12
  96. package/dist/types/components/form/input/nullable-plain-date-time-input.d.ts +12 -12
  97. package/dist/types/components/form/input/nullable-plain-time-input.d.ts +12 -12
  98. package/dist/types/components/form/input/nullable-plain-year-month-input.d.ts +12 -12
  99. package/dist/types/components/form/input/password-input.d.ts +1 -1
  100. package/dist/types/components/form/input/plain-date-input.d.ts +12 -12
  101. package/dist/types/components/form/input/plain-date-time-input.d.ts +12 -12
  102. package/dist/types/components/form/input/plain-time-input.d.ts +12 -12
  103. package/dist/types/components/form/input/plain-year-month-input.d.ts +12 -12
  104. package/dist/types/components/form/input/select-tags-input.d.ts +3 -3
  105. package/dist/types/components/form/use-form.d.ts +3 -3
  106. package/dist/types/components/i18n/locale-direction.d.ts +1 -1
  107. package/dist/types/components/i18n/locale-selector.d.ts +1 -1
  108. package/dist/types/components/i18n/locale.d.ts +1 -1
  109. package/dist/types/components/i18n/make-i18nprovider.d.ts +2 -2
  110. package/dist/types/components/layout/app-shell.d.ts +1 -1
  111. package/dist/types/components/lexical/code/language-selector.d.ts +1 -1
  112. package/dist/types/components/lexical/floating/block-handle.d.ts +1 -1
  113. package/dist/types/components/lexical/floating/floating-toolbar.d.ts +1 -1
  114. package/dist/types/components/lexical/floating/slash-command-palette.d.ts +1 -1
  115. package/dist/types/components/lexical/table/table-controls.d.ts +1 -1
  116. package/dist/types/components/lexical/toolbar/lexical-toolbar.d.ts +1 -1
  117. package/dist/types/components/lexical/toolbar/toolbar-helpers.d.ts +2 -2
  118. package/dist/types/components/media/pdf-page-viewer.d.ts +1 -1
  119. package/dist/types/components/misc/notification-provider.d.ts +2 -2
  120. package/dist/types/components/navigation/link/button-link.d.ts +1 -1
  121. package/dist/types/components/navigation/link/link.d.ts +1 -1
  122. package/dist/types/components/navigation/link/navigation-link.d.ts +1 -1
  123. package/dist/types/components/navigation/pagination.d.ts +1 -1
  124. package/dist/types/components/navigation/sidebar/sidebar.d.ts +2 -2
  125. package/dist/types/components/navigation/toolbar/toolbar.d.ts +1 -1
  126. package/dist/types/components/prosemirror/link-control.d.ts +1 -1
  127. package/dist/types/components/prosemirror/prosemirror-toolbar.d.ts +1 -1
  128. package/dist/types/components/prosemirror/utils.d.ts +2 -2
  129. package/dist/types/components/theme/theme.d.ts +2 -2
  130. package/dist/types/i18n/translate.d.ts +1 -1
  131. package/dist/types/utils/delay-signal.d.ts +1 -1
  132. package/dist/types/utils/use-animated-toggle.d.ts +22 -22
  133. package/dist/{ur-DkIYJxsF.js → ur-Lr1p8f9y.js} +1 -1
  134. package/dist/{use-animated-toggle-89fKlXxy.js → use-animated-toggle-C7PTmnZi.js} +7 -7
  135. package/dist/{use-form-BSvvERhX.js → use-form-BfzX3bwL.js} +13 -13
  136. package/dist/{use-form-B_mCauP0.cjs → use-form-i97PToWB.cjs} +1 -1
  137. package/dist/{vi-DKw6PBja.js → vi-jozfaxSj.js} +1 -1
  138. package/dist/widget-customization-BZqPoojo.cjs +1 -0
  139. package/dist/{widget-customization-DFr3ycD7.js → widget-customization-fMNSVtuP.js} +29 -29
  140. package/dist/{zh-CaKHseXJ.js → zh-BBYKq49d.js} +1 -1
  141. package/package.json +35 -31
  142. package/dist/deep-merge-CvN7Xvd1.cjs +0 -1
  143. package/dist/notice-DMK7dx9a.cjs +0 -1
  144. package/dist/stack-DcZ_u50f.cjs +0 -1
  145. package/dist/widget-customization-BASfRpF7.cjs +0 -1
@@ -1,5 +1,5 @@
1
1
  import { html as n, attr as o } from "@tempots/dom";
2
- const r = {
2
+ const e = {
3
3
  /**
4
4
  * Creates a loading state.
5
5
  * @param previousValue - The previous value.
@@ -71,53 +71,59 @@ const r = {
71
71
  return s.type === "Loading";
72
72
  },
73
73
  /**
74
- * Gets the value if the result is a success; otherwise, returns the alternative value.
74
+ * Gets the value if the result is a success or loading with a previous value; otherwise, returns the alternative value.
75
75
  * @param r - The result.
76
76
  * @param alt - The alternative value.
77
- * @returns The value if the result is a success; otherwise, the alternative value.
77
+ * @returns The value if the result is a success or loading with previous value; otherwise, the alternative value.
78
78
  * @public
79
79
  */
80
- getOrElse(s, e) {
81
- return r.isSuccess(s) ? s.value : e;
80
+ getOrElse(s, r) {
81
+ return e.isSuccess(s) ? s.value : e.isLoading(s) && s.previousValue !== void 0 ? s.previousValue : r;
82
82
  },
83
83
  /**
84
- * Gets the value if the result is a success; otherwise, returns the value from the alternative function.
84
+ * Gets the value if the result is a success or loading with a previous value; otherwise, returns the value from the alternative function.
85
85
  * @param r - The result.
86
86
  * @param altf - The alternative function.
87
- * @returns The value if the result is a success; otherwise, the value from the alternative
87
+ * @returns The value if the result is a success or loading with previous value; otherwise, the value from the alternative function.
88
88
  * @public
89
- * function.
90
89
  */
91
- getOrElseLazy(s, e) {
92
- return r.isSuccess(s) ? s.value : e();
90
+ getOrElseLazy(s, r) {
91
+ return e.isSuccess(s) ? s.value : e.isLoading(s) && s.previousValue !== void 0 ? s.previousValue : r();
93
92
  },
94
93
  /**
95
- * Gets the value if the result is a success; otherwise, returns `null`.
94
+ * Gets the value if the result is a success or loading with a previous value; otherwise, returns `null`.
96
95
  * @param r - The result.
97
- * @returns The value if the result is a success; otherwise, `null`.
96
+ * @returns The value if the result is a success or loading with previous value; otherwise, `null`.
98
97
  * @public
99
98
  */
100
99
  getOrNull(s) {
101
- return r.isSuccess(s) ? s.value : null;
100
+ return e.isSuccess(s) ? s.value : e.isLoading(s) && s.previousValue !== void 0 ? s.previousValue : null;
102
101
  },
103
102
  /**
104
- * Gets the value if the result is a success; otherwise, returns `undefined`.
103
+ * Gets the value if the result is a success or loading with a previous value; otherwise, returns `undefined`.
105
104
  * @param r - The result.
106
- * @returns The value if the result is a success; otherwise, `undefined`.
105
+ * @returns The value if the result is a success or loading with previous value; otherwise, `undefined`.
107
106
  * @public
108
107
  */
109
108
  getOrUndefined(s) {
110
- return r.isSuccess(s) ? s.value : void 0;
109
+ if (e.isSuccess(s))
110
+ return s.value;
111
+ if (e.isLoading(s) && s.previousValue !== void 0)
112
+ return s.previousValue;
111
113
  },
112
114
  /**
113
- * Gets the value of a `AsyncResult` if it is a `Success`, otherwise it throws the error contained in the `Failure`.
115
+ * Gets the value of a `AsyncResult` if it is a `Success` or loading with a previous value, otherwise it throws the error contained in the `Failure`.
114
116
  * @param r - The `AsyncResult` to get the value from.
115
- * @returns The value of the `AsyncResult` if it is a `Success`.
117
+ * @returns The value of the `AsyncResult` if it is a `Success` or loading with previous value.
116
118
  */
117
119
  getUnsafe: (s) => {
118
- if (r.isSuccess(s))
120
+ if (e.isSuccess(s))
119
121
  return s.value;
120
- throw r.isFailure(s) ? s.error : new Error("Cannot get value from a not-asked or loading result");
122
+ if (e.isLoading(s) && s.previousValue !== void 0)
123
+ return s.previousValue;
124
+ throw e.isFailure(s) ? s.error : new Error(
125
+ "Cannot get value from a not-asked or loading result without previous value"
126
+ );
121
127
  },
122
128
  /**
123
129
  * Based on the state of the result, it picks the appropriate function to call and returns the result.
@@ -129,11 +135,11 @@ const r = {
129
135
  * @public
130
136
  */
131
137
  match: (s, {
132
- success: e,
138
+ success: r,
133
139
  failure: u,
134
- loading: i,
135
- notAsked: l = i
136
- }) => r.isSuccess(s) ? e(s.value) : r.isFailure(s) ? u(s.error) : r.isNotAsked(s) ? l() : i(s.previousValue),
140
+ loading: l,
141
+ notAsked: c = l
142
+ }) => e.isSuccess(s) ? r(s.value) : e.isFailure(s) ? u(s.error) : e.isNotAsked(s) ? c() : l(s.previousValue),
137
143
  /**
138
144
  * Executes side effects based on the state of the result.
139
145
  * Unlike `match`, all handlers are optional, allowing you to react only to specific states.
@@ -143,19 +149,19 @@ const r = {
143
149
  * @returns The result that was passed in, allowing for chaining.
144
150
  * @public
145
151
  */
146
- effect: (s, e) => {
152
+ effect: (s, r) => {
147
153
  switch (s.type) {
148
154
  case "AsyncSuccess":
149
- e.success ? e.success(s.value) : e.else?.();
155
+ r.success ? r.success(s.value) : r.else?.();
150
156
  break;
151
157
  case "AsyncFailure":
152
- e.failure ? e.failure(s.error) : e.else?.();
158
+ r.failure ? r.failure(s.error) : r.else?.();
153
159
  break;
154
160
  case "Loading":
155
- e.loading ? e.loading(s.previousValue) : e.else?.();
161
+ r.loading ? r.loading(s.previousValue) : r.else?.();
156
162
  break;
157
163
  case "NotAsked":
158
- e.notAsked ? e.notAsked() : e.else?.();
164
+ r.notAsked ? r.notAsked() : r.else?.();
159
165
  break;
160
166
  }
161
167
  return s;
@@ -168,7 +174,7 @@ const r = {
168
174
  * @returns The result that was passed in.
169
175
  * @public
170
176
  */
171
- whenSuccess: (s, e) => (r.isSuccess(s) && e(s.value), s),
177
+ whenSuccess: (s, r) => (e.isSuccess(s) && r(s.value), s),
172
178
  /**
173
179
  * When the result is a failure, it applies the function to the error.
174
180
  *
@@ -177,7 +183,7 @@ const r = {
177
183
  * @returns The result that was passed in.
178
184
  * @public
179
185
  */
180
- whenFailure: (s, e) => (r.isFailure(s) && e(s.error), s),
186
+ whenFailure: (s, r) => (e.isFailure(s) && r(s.error), s),
181
187
  /**
182
188
  * Compares two results for equality.
183
189
  * @param r1 - The first result.
@@ -185,23 +191,23 @@ const r = {
185
191
  * @param options - The options to use for comparison. By default, uses strict equality.
186
192
  * @returns `true` if the results are equal, `false` otherwise.
187
193
  */
188
- equals: (s, e, u = {
189
- valueEquals: (i, l) => i === l,
190
- errorEquals: (i, l) => i === l
191
- }) => s.type === "AsyncSuccess" && e.type === "AsyncSuccess" ? u.valueEquals(s.value, e.value) : s.type === "AsyncFailure" && e.type === "AsyncFailure" ? u.errorEquals(s.error, e.error) : s.type === "Loading" && e.type === "Loading" ? u.valueEquals(s.previousValue, e.previousValue) : s.type === "NotAsked" && e.type === "NotAsked",
194
+ equals: (s, r, u = {
195
+ valueEquals: (l, c) => l === c,
196
+ errorEquals: (l, c) => l === c
197
+ }) => s.type === "AsyncSuccess" && r.type === "AsyncSuccess" ? u.valueEquals(s.value, r.value) : s.type === "AsyncFailure" && r.type === "AsyncFailure" ? u.errorEquals(s.error, r.error) : s.type === "Loading" && r.type === "Loading" ? u.valueEquals(s.previousValue, r.previousValue) : s.type === "NotAsked" && r.type === "NotAsked",
192
198
  /**
193
199
  * Combines multiple results into a single result.
194
200
  * @param results - The results to combine.
195
201
  * @returns A single result that is a success if all the input results are successes, otherwise a failure.
196
202
  */
197
203
  all: (s) => {
198
- const e = [];
204
+ const r = [];
199
205
  for (const u of s)
200
- if (r.isSuccess(u))
201
- e.push(u.value);
206
+ if (e.isSuccess(u))
207
+ r.push(u.value);
202
208
  else
203
209
  return u;
204
- return r.success(e);
210
+ return e.success(r);
205
211
  },
206
212
  /**
207
213
  * Converts a Promise to an AsyncResult.
@@ -210,10 +216,10 @@ const r = {
210
216
  */
211
217
  ofPromise: async (s) => {
212
218
  try {
213
- const e = await s;
214
- return r.success(e);
215
- } catch (e) {
216
- return r.failure(e instanceof Error ? e : new Error(String(e)));
219
+ const r = await s;
220
+ return e.success(r);
221
+ } catch (r) {
222
+ return e.failure(r instanceof Error ? r : new Error(String(r)));
217
223
  }
218
224
  },
219
225
  /**
@@ -225,17 +231,17 @@ const r = {
225
231
  * @returns A new `AsyncResult` with the mapped value if successful, otherwise the original state.
226
232
  * @public
227
233
  */
228
- map: (s, e) => {
234
+ map: (s, r) => {
229
235
  switch (s.type) {
230
236
  case "AsyncSuccess":
231
- return r.success(e(s.value));
237
+ return e.success(r(s.value));
232
238
  case "NotAsked":
233
- return r.notAsked;
239
+ return e.notAsked;
234
240
  case "AsyncFailure":
235
- return r.failure(s.error);
241
+ return e.failure(s.error);
236
242
  case "Loading":
237
- return r.loading(
238
- s.previousValue != null ? e(s.previousValue) : void 0
243
+ return e.loading(
244
+ s.previousValue != null ? r(s.previousValue) : void 0
239
245
  );
240
246
  }
241
247
  },
@@ -247,16 +253,16 @@ const r = {
247
253
  * @returns The result of the mapping function if successful, otherwise the original state.
248
254
  * @public
249
255
  */
250
- flatMap: (s, e) => {
256
+ flatMap: (s, r) => {
251
257
  switch (s.type) {
252
258
  case "AsyncSuccess":
253
- return e(s.value);
259
+ return r(s.value);
254
260
  case "NotAsked":
255
- return r.notAsked;
261
+ return e.notAsked;
256
262
  case "AsyncFailure":
257
- return r.failure(s.error);
263
+ return e.failure(s.error);
258
264
  case "Loading":
259
- return r.loading();
265
+ return e.loading();
260
266
  }
261
267
  },
262
268
  /**
@@ -267,16 +273,16 @@ const r = {
267
273
  * @returns A new `AsyncResult` with the mapped error if failed, otherwise the original state.
268
274
  * @public
269
275
  */
270
- mapError: (s, e) => {
276
+ mapError: (s, r) => {
271
277
  switch (s.type) {
272
278
  case "AsyncSuccess":
273
- return r.success(s.value);
279
+ return e.success(s.value);
274
280
  case "NotAsked":
275
- return r.notAsked;
281
+ return e.notAsked;
276
282
  case "AsyncFailure":
277
- return r.failure(e(s.error));
283
+ return e.failure(r(s.error));
278
284
  case "Loading":
279
- return r.loading(s.previousValue);
285
+ return e.loading(s.previousValue);
280
286
  }
281
287
  },
282
288
  /**
@@ -287,16 +293,16 @@ const r = {
287
293
  * @returns The result of the recovery function if failed, otherwise the original state.
288
294
  * @public
289
295
  */
290
- flatMapError: (s, e) => {
296
+ flatMapError: (s, r) => {
291
297
  switch (s.type) {
292
298
  case "AsyncSuccess":
293
- return r.success(s.value);
299
+ return e.success(s.value);
294
300
  case "NotAsked":
295
- return r.notAsked;
301
+ return e.notAsked;
296
302
  case "AsyncFailure":
297
- return e(s.error);
303
+ return r(s.error);
298
304
  case "Loading":
299
- return r.loading(s.previousValue);
305
+ return e.loading(s.previousValue);
300
306
  }
301
307
  },
302
308
  /**
@@ -333,16 +339,16 @@ const r = {
333
339
  * @returns A successful `AsyncResult` with the alternative value if failed, otherwise the original state.
334
340
  * @public
335
341
  */
336
- recover: (s, e) => {
342
+ recover: (s, r) => {
337
343
  switch (s.type) {
338
344
  case "AsyncSuccess":
339
- return r.success(s.value);
345
+ return e.success(s.value);
340
346
  case "NotAsked":
341
- return r.notAsked;
347
+ return e.notAsked;
342
348
  case "AsyncFailure":
343
- return r.success(e(s.error));
349
+ return e.success(r(s.error));
344
350
  case "Loading":
345
- return r.loading(s.previousValue);
351
+ return e.loading(s.previousValue);
346
352
  }
347
353
  },
348
354
  /**
@@ -353,7 +359,7 @@ const r = {
353
359
  * @returns A new `AsyncResult` with the result of applying the function to the value.
354
360
  * @public
355
361
  */
356
- ap: (s, e) => r.isSuccess(s) && r.isSuccess(e) ? r.success(s.value(e.value)) : r.isFailure(s) ? r.failure(s.error) : r.isFailure(e) ? r.failure(e.error) : r.isLoading(s) || r.isLoading(e) ? r.loading() : r.notAsked,
362
+ ap: (s, r) => e.isSuccess(s) && e.isSuccess(r) ? e.success(s.value(r.value)) : e.isFailure(s) ? e.failure(s.error) : e.isFailure(r) ? e.failure(r.error) : e.isLoading(s) || e.isLoading(r) ? e.loading() : e.notAsked,
357
363
  /**
358
364
  * Maps two `AsyncResult` values using a function.
359
365
  * @param r1 - The first `AsyncResult`.
@@ -362,7 +368,7 @@ const r = {
362
368
  * @returns A new `AsyncResult` with the result of applying the function to both values.
363
369
  * @public
364
370
  */
365
- map2: (s, e, u) => r.isSuccess(s) && r.isSuccess(e) ? r.success(u(s.value, e.value)) : r.isFailure(s) ? r.failure(s.error) : r.isFailure(e) ? r.failure(e.error) : r.isLoading(s) || r.isLoading(e) ? r.loading() : r.notAsked,
371
+ map2: (s, r, u) => e.isSuccess(s) && e.isSuccess(r) ? e.success(u(s.value, r.value)) : e.isFailure(s) ? e.failure(s.error) : e.isFailure(r) ? e.failure(r.error) : e.isLoading(s) || e.isLoading(r) ? e.loading() : e.notAsked,
366
372
  /**
367
373
  * Maps three `AsyncResult` values using a function.
368
374
  * @param r1 - The first `AsyncResult`.
@@ -372,8 +378,8 @@ const r = {
372
378
  * @returns A new `AsyncResult` with the result of applying the function to all three values.
373
379
  * @public
374
380
  */
375
- map3: (s, e, u, i) => r.isSuccess(s) && r.isSuccess(e) && r.isSuccess(u) ? r.success(i(s.value, e.value, u.value)) : r.isFailure(s) ? r.failure(s.error) : r.isFailure(e) ? r.failure(e.error) : r.isFailure(u) ? r.failure(u.error) : r.isLoading(s) || r.isLoading(e) || r.isLoading(u) ? r.loading() : r.notAsked
376
- }, c = {
381
+ map3: (s, r, u, l) => e.isSuccess(s) && e.isSuccess(r) && e.isSuccess(u) ? e.success(l(s.value, r.value, u.value)) : e.isFailure(s) ? e.failure(s.error) : e.isFailure(r) ? e.failure(r.error) : e.isFailure(u) ? e.failure(u.error) : e.isLoading(s) || e.isLoading(r) || e.isLoading(u) ? e.loading() : e.notAsked
382
+ }, i = {
377
383
  /**
378
384
  * Creates a valid `Validation`.
379
385
  * @returns A `Validation` that is `Valid`.
@@ -411,16 +417,16 @@ const r = {
411
417
  * @param invalid - The mapping function for an invalid value.
412
418
  * @returns The mapped value.
413
419
  */
414
- match: (s, e, u) => c.isValid(s) ? e() : u(s.error),
420
+ match: (s, r, u) => i.isValid(s) ? r() : u(s.error),
415
421
  /**
416
422
  * Maps the value of a `Validation` to a new `Validation`.
417
423
  * @param validation - The `Validation` to map.
418
424
  * @param value - The value to map.
419
425
  * @returns A new `Validation` with the mapped value.
420
426
  */
421
- toResult: (s, e) => c.match(
427
+ toResult: (s, r) => i.match(
422
428
  s,
423
- () => a.success(e),
429
+ () => a.success(r),
424
430
  (u) => a.failure(u)
425
431
  ),
426
432
  /**
@@ -432,7 +438,7 @@ const r = {
432
438
  * @returns The validation that was passed in, allowing for chaining.
433
439
  * @public
434
440
  */
435
- effect: (s, e) => (s.type === "valid" ? e.valid ? e.valid() : e.else?.() : e.invalid ? e.invalid(s.error) : e.else?.(), s),
441
+ effect: (s, r) => (s.type === "valid" ? r.valid ? r.valid() : r.else?.() : r.invalid ? r.invalid(s.error) : r.else?.(), s),
436
442
  /**
437
443
  * Execute a function when the `Validation` is valid.
438
444
  *
@@ -440,7 +446,7 @@ const r = {
440
446
  * @param apply - The function to execute when the `Validation` is valid.
441
447
  * @returns The `Validation` object.
442
448
  */
443
- whenValid: (s, e) => (c.isValid(s) && e(), s),
449
+ whenValid: (s, r) => (i.isValid(s) && r(), s),
444
450
  /**
445
451
  * Execute a function when the `Validation` is invalid.
446
452
  *
@@ -448,7 +454,7 @@ const r = {
448
454
  * @param apply - The function to execute when the `Validation` is invalid.
449
455
  * @returns The `Validation` object.
450
456
  */
451
- whenInvalid: (s, e) => (c.isInvalid(s) && e(s.error), s),
457
+ whenInvalid: (s, r) => (i.isInvalid(s) && r(s.error), s),
452
458
  /**
453
459
  * Maps the error of an invalid `Validation` to a new error using the provided function.
454
460
  * For valid validations, the validation is preserved unchanged.
@@ -457,7 +463,7 @@ const r = {
457
463
  * @returns A new `Validation` with the mapped error if invalid, otherwise the original valid.
458
464
  * @public
459
465
  */
460
- mapError: (s, e) => s.type === "invalid" ? c.invalid(e(s.error)) : s,
466
+ mapError: (s, r) => s.type === "invalid" ? i.invalid(r(s.error)) : s,
461
467
  /**
462
468
  * Maps the error of an invalid `Validation` to a new `Validation` using the provided function.
463
469
  * This allows recovery from errors by returning a valid validation.
@@ -466,7 +472,7 @@ const r = {
466
472
  * @returns The result of the recovery function if invalid, otherwise the original valid.
467
473
  * @public
468
474
  */
469
- flatMapError: (s, e) => s.type === "invalid" ? e(s.error) : s,
475
+ flatMapError: (s, r) => s.type === "invalid" ? r(s.error) : s,
470
476
  /**
471
477
  * Combines two validations. Both must be valid for the result to be valid.
472
478
  * If both are invalid, errors are combined using the provided function.
@@ -476,7 +482,7 @@ const r = {
476
482
  * @returns A combined validation.
477
483
  * @public
478
484
  */
479
- combine: (s, e, u) => c.isValid(s) && c.isValid(e) ? c.valid : c.isInvalid(s) && c.isInvalid(e) ? c.invalid(u(s.error, e.error)) : c.isInvalid(s) ? s : e,
485
+ combine: (s, r, u) => i.isValid(s) && i.isValid(r) ? i.valid : i.isInvalid(s) && i.isInvalid(r) ? i.invalid(u(s.error, r.error)) : i.isInvalid(s) ? s : r,
480
486
  /**
481
487
  * Combines multiple validations into a single validation.
482
488
  * All must be valid for the result to be valid.
@@ -486,10 +492,10 @@ const r = {
486
492
  * @public
487
493
  */
488
494
  all: (s) => {
489
- for (const e of s)
490
- if (c.isInvalid(e))
491
- return e;
492
- return c.valid;
495
+ for (const r of s)
496
+ if (i.isInvalid(r))
497
+ return r;
498
+ return i.valid;
493
499
  },
494
500
  /**
495
501
  * Combines multiple validations, accumulating all errors.
@@ -500,10 +506,10 @@ const r = {
500
506
  * @public
501
507
  */
502
508
  allErrors: (s) => {
503
- const e = [];
509
+ const r = [];
504
510
  for (const u of s)
505
- c.isInvalid(u) && e.push(u.error);
506
- return e.length > 0 ? c.invalid(e) : c.valid;
511
+ i.isInvalid(u) && r.push(u.error);
512
+ return r.length > 0 ? i.invalid(r) : i.valid;
507
513
  },
508
514
  /**
509
515
  * Compares two validations for equality.
@@ -513,7 +519,7 @@ const r = {
513
519
  * @returns `true` if the validations are equal, `false` otherwise.
514
520
  * @public
515
521
  */
516
- equals: (s, e, u = (i, l) => i === l) => s.type === "valid" && e.type === "valid" ? !0 : s.type === "invalid" && e.type === "invalid" ? u(s.error, e.error) : !1,
522
+ equals: (s, r, u = (l, c) => l === c) => s.type === "valid" && r.type === "valid" ? !0 : s.type === "invalid" && r.type === "invalid" ? u(s.error, r.error) : !1,
517
523
  /**
518
524
  * Recovers from an invalid validation by returning a valid validation.
519
525
  * @param v - The `Validation` to recover from.
@@ -521,7 +527,7 @@ const r = {
521
527
  * @public
522
528
  */
523
529
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
524
- recover: (s) => c.valid,
530
+ recover: (s) => i.valid,
525
531
  /**
526
532
  * Gets the error if the validation is invalid, otherwise returns undefined.
527
533
  * @param v - The validation to get the error from.
@@ -529,7 +535,7 @@ const r = {
529
535
  * @public
530
536
  */
531
537
  getError: (s) => {
532
- if (c.isInvalid(s))
538
+ if (i.isInvalid(s))
533
539
  return s.error;
534
540
  },
535
541
  /**
@@ -539,7 +545,7 @@ const r = {
539
545
  * @returns The error if invalid, otherwise the default error.
540
546
  * @public
541
547
  */
542
- getErrorOrElse: (s, e) => c.isInvalid(s) ? s.error : e
548
+ getErrorOrElse: (s, r) => i.isInvalid(s) ? s.error : r
543
549
  }, a = {
544
550
  /**
545
551
  * Creates a successful `Result`.
@@ -568,7 +574,7 @@ const r = {
568
574
  * @returns A new `Result` with the mapped value.
569
575
  * @public
570
576
  */
571
- map: (s, e) => s.type === "Success" ? a.success(e(s.value)) : s,
577
+ map: (s, r) => s.type === "Success" ? a.success(r(s.value)) : s,
572
578
  /**
573
579
  * Maps the value of a `Result` to a new `Result`.
574
580
  * @param r - The `Result` to map.
@@ -576,7 +582,7 @@ const r = {
576
582
  * @returns A new `Result` with the mapped value.
577
583
  * @public
578
584
  */
579
- flatMap: (s, e) => s.type === "Success" ? e(s.value) : s,
585
+ flatMap: (s, r) => s.type === "Success" ? r(s.value) : s,
580
586
  /**
581
587
  * Converts a `Result` to an `AsyncResult`.
582
588
  * @param r - The `Result` to convert.
@@ -586,8 +592,8 @@ const r = {
586
592
  toAsync(s) {
587
593
  return a.match(
588
594
  s,
589
- (e) => r.success(e),
590
- (e) => r.failure(e)
595
+ (r) => e.success(r),
596
+ (r) => e.failure(r)
591
597
  );
592
598
  },
593
599
  /**
@@ -599,8 +605,8 @@ const r = {
599
605
  toValidation(s) {
600
606
  return a.match(
601
607
  s,
602
- () => c.valid,
603
- (e) => c.invalid(e)
608
+ () => i.valid,
609
+ (r) => i.invalid(r)
604
610
  );
605
611
  },
606
612
  /**
@@ -628,8 +634,8 @@ const r = {
628
634
  * @returns The value of the `Result` if it is a `Success`, otherwise the default value.
629
635
  * @public
630
636
  */
631
- getOrElse(s, e) {
632
- return a.isSuccess(s) ? s.value : e;
637
+ getOrElse(s, r) {
638
+ return a.isSuccess(s) ? s.value : r;
633
639
  },
634
640
  /**
635
641
  * Gets the value of a `Result` if it is a `Success`, otherwise returns the result of the provided function.
@@ -638,8 +644,8 @@ const r = {
638
644
  * @returns The value of the `Result` if it is a `Success`, otherwise the result of the function.
639
645
  * @public
640
646
  */
641
- getOrElseLazy(s, e) {
642
- return a.isSuccess(s) ? s.value : e();
647
+ getOrElseLazy(s, r) {
648
+ return a.isSuccess(s) ? s.value : r();
643
649
  },
644
650
  /**
645
651
  * Gets the value of a `Result` if it is a `Success`, otherwise returns `null`.
@@ -676,7 +682,7 @@ const r = {
676
682
  * @returns The result of calling the appropriate function based on the state of the result.
677
683
  * @public
678
684
  */
679
- match: (s, e, u) => a.isSuccess(s) ? e(s.value) : u(s.error),
685
+ match: (s, r, u) => a.isSuccess(s) ? r(s.value) : u(s.error),
680
686
  /**
681
687
  * Executes side effects based on the state of the result.
682
688
  * Unlike `match`, all handlers are optional, allowing you to react only to specific states.
@@ -686,21 +692,21 @@ const r = {
686
692
  * @returns The result that was passed in, allowing for chaining.
687
693
  * @public
688
694
  */
689
- effect: (s, e) => (s.type === "Success" ? e.success ? e.success(s.value) : e.else?.() : e.failure ? e.failure(s.error) : e.else?.(), s),
695
+ effect: (s, r) => (s.type === "Success" ? r.success ? r.success(s.value) : r.else?.() : r.failure ? r.failure(s.error) : r.else?.(), s),
690
696
  /**
691
697
  * Calls the provided function if the result is a success.
692
698
  * @param apply - The function to call if the result is a success.
693
699
  * @returns A function that takes a `Result` and calls the provided function if the result is a success.
694
700
  * @public
695
701
  */
696
- whenSuccess: (s, e) => (a.isSuccess(s) && e(s.value), s),
702
+ whenSuccess: (s, r) => (a.isSuccess(s) && r(s.value), s),
697
703
  /**
698
704
  * Calls the provided function if the result is a failure.
699
705
  * @param apply - The function to call if the result is a failure.
700
706
  * @returns The result that was passed in.
701
707
  * @public
702
708
  */
703
- whenFailure: (s, e) => (a.isFailure(s) && e(s.error), s),
709
+ whenFailure: (s, r) => (a.isFailure(s) && r(s.error), s),
704
710
  /**
705
711
  * Combines two results into a single result.
706
712
  * @param r1 - The first result.
@@ -710,18 +716,18 @@ const r = {
710
716
  * @returns The combined result.
711
717
  * @public
712
718
  */
713
- combine: (s, e, u, i) => a.match(
719
+ combine: (s, r, u, l) => a.match(
714
720
  s,
715
- (l) => a.match(
716
- e,
717
- (t) => a.success(u(l, t)),
721
+ (c) => a.match(
722
+ r,
723
+ (t) => a.success(u(c, t)),
718
724
  (t) => a.failure(t)
719
725
  ),
720
- (l) => a.match(
721
- e,
726
+ (c) => a.match(
727
+ r,
722
728
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
723
- (t) => a.failure(l),
724
- (t) => a.failure(i(l, t))
729
+ (t) => a.failure(c),
730
+ (t) => a.failure(l(c, t))
725
731
  )
726
732
  ),
727
733
  /**
@@ -731,23 +737,23 @@ const r = {
731
737
  * @param options - The options to use for comparison. By default, uses strict equality.
732
738
  * @returns `true` if the results are equal, `false` otherwise.
733
739
  */
734
- equals: (s, e, u = {
735
- valueEquals: (i, l) => i === l,
736
- errorEquals: (i, l) => i === l
737
- }) => s.type === "Success" && e.type === "Success" ? u.valueEquals(s.value, e.value) : s.type === "Failure" && e.type === "Failure" ? u.errorEquals(s.error, e.error) : !1,
740
+ equals: (s, r, u = {
741
+ valueEquals: (l, c) => l === c,
742
+ errorEquals: (l, c) => l === c
743
+ }) => s.type === "Success" && r.type === "Success" ? u.valueEquals(s.value, r.value) : s.type === "Failure" && r.type === "Failure" ? u.errorEquals(s.error, r.error) : !1,
738
744
  /**
739
745
  * Combines multiple results into a single result.
740
746
  * @param results - The results to combine.
741
747
  * @returns A single result that is a success if all the input results are successes, otherwise a failure.
742
748
  */
743
749
  all: (s) => {
744
- const e = [];
750
+ const r = [];
745
751
  for (const u of s)
746
752
  if (a.isSuccess(u))
747
- e.push(u.value);
753
+ r.push(u.value);
748
754
  else
749
755
  return u;
750
- return a.success(e);
756
+ return a.success(r);
751
757
  },
752
758
  /**
753
759
  * Maps the error of a failed `Result` to a new error using the provided function.
@@ -757,7 +763,7 @@ const r = {
757
763
  * @returns A new `Result` with the mapped error if failed, otherwise the original success.
758
764
  * @public
759
765
  */
760
- mapError: (s, e) => s.type === "Failure" ? a.failure(e(s.error)) : s,
766
+ mapError: (s, r) => s.type === "Failure" ? a.failure(r(s.error)) : s,
761
767
  /**
762
768
  * Maps the error of a failed `Result` to a new `Result` using the provided function.
763
769
  * This allows recovery from errors by returning a new successful result.
@@ -766,7 +772,7 @@ const r = {
766
772
  * @returns The result of the recovery function if failed, otherwise the original success.
767
773
  * @public
768
774
  */
769
- flatMapError: (s, e) => s.type === "Failure" ? e(s.error) : s,
775
+ flatMapError: (s, r) => s.type === "Failure" ? r(s.error) : s,
770
776
  /**
771
777
  * Recovers from a failure by providing an alternative value.
772
778
  * @param r - The `Result` to recover from.
@@ -774,7 +780,7 @@ const r = {
774
780
  * @returns A successful `Result` with the alternative value if failed, otherwise the original success.
775
781
  * @public
776
782
  */
777
- recover: (s, e) => s.type === "Failure" ? { type: "Success", value: e(s.error) } : s,
783
+ recover: (s, r) => s.type === "Failure" ? { type: "Success", value: r(s.error) } : s,
778
784
  /**
779
785
  * Applies a function wrapped in a `Result` to a value wrapped in a `Result`.
780
786
  * Useful for applying multiple arguments to a function in a safe way.
@@ -783,7 +789,7 @@ const r = {
783
789
  * @returns A new `Result` with the result of applying the function to the value.
784
790
  * @public
785
791
  */
786
- ap: (s, e) => a.isSuccess(s) && a.isSuccess(e) ? a.success(s.value(e.value)) : a.isFailure(s) ? a.failure(s.error) : a.failure(e.error),
792
+ ap: (s, r) => a.isSuccess(s) && a.isSuccess(r) ? a.success(s.value(r.value)) : a.isFailure(s) ? a.failure(s.error) : a.failure(r.error),
787
793
  /**
788
794
  * Maps two `Result` values using a function.
789
795
  * @param r1 - The first `Result`.
@@ -792,7 +798,7 @@ const r = {
792
798
  * @returns A new `Result` with the result of applying the function to both values.
793
799
  * @public
794
800
  */
795
- map2: (s, e, u) => a.isSuccess(s) && a.isSuccess(e) ? a.success(u(s.value, e.value)) : a.isFailure(s) ? a.failure(s.error) : a.failure(e.error),
801
+ map2: (s, r, u) => a.isSuccess(s) && a.isSuccess(r) ? a.success(u(s.value, r.value)) : a.isFailure(s) ? a.failure(s.error) : a.failure(r.error),
796
802
  /**
797
803
  * Maps three `Result` values using a function.
798
804
  * @param r1 - The first `Result`.
@@ -802,7 +808,7 @@ const r = {
802
808
  * @returns A new `Result` with the result of applying the function to all three values.
803
809
  * @public
804
810
  */
805
- map3: (s, e, u, i) => a.isSuccess(s) && a.isSuccess(e) && a.isSuccess(u) ? a.success(i(s.value, e.value, u.value)) : a.isFailure(s) ? a.failure(s.error) : a.isFailure(e) ? a.failure(e.error) : a.failure(u.error),
811
+ map3: (s, r, u, l) => a.isSuccess(s) && a.isSuccess(r) && a.isSuccess(u) ? a.success(l(s.value, r.value, u.value)) : a.isFailure(s) ? a.failure(s.error) : a.isFailure(r) ? a.failure(r.error) : a.failure(u.error),
806
812
  /**
807
813
  * Converts a Promise to a Result.
808
814
  * @param p - The Promise to convert.
@@ -811,10 +817,10 @@ const r = {
811
817
  */
812
818
  ofPromise: async (s) => {
813
819
  try {
814
- const e = await s;
815
- return a.success(e);
816
- } catch (e) {
817
- return a.failure(e instanceof Error ? e : new Error(String(e)));
820
+ const r = await s;
821
+ return a.success(r);
822
+ } catch (r) {
823
+ return a.failure(r instanceof Error ? r : new Error(String(r)));
818
824
  }
819
825
  },
820
826
  /**
@@ -833,7 +839,7 @@ const r = {
833
839
  * @returns A Result containing the value if not null/undefined, otherwise a failure.
834
840
  * @public
835
841
  */
836
- fromNullable: (s, e) => s == null ? a.failure(e) : a.success(s),
842
+ fromNullable: (s, r) => s == null ? a.failure(r) : a.success(s),
837
843
  /**
838
844
  * Converts a nullable value to a Result using a lazy error function.
839
845
  * @param value - The nullable value.
@@ -841,7 +847,7 @@ const r = {
841
847
  * @returns A Result containing the value if not null/undefined, otherwise a failure.
842
848
  * @public
843
849
  */
844
- fromNullableLazy: (s, e) => s == null ? a.failure(e()) : a.success(s),
850
+ fromNullableLazy: (s, r) => s == null ? a.failure(r()) : a.success(s),
845
851
  /**
846
852
  * Wraps a function that may throw into a function that returns a Result.
847
853
  * @param f - The function that may throw.
@@ -851,15 +857,15 @@ const r = {
851
857
  tryCatch: (s) => {
852
858
  try {
853
859
  return a.success(s());
854
- } catch (e) {
855
- return a.failure(e instanceof Error ? e : new Error(String(e)));
860
+ } catch (r) {
861
+ return a.failure(r instanceof Error ? r : new Error(String(r)));
856
862
  }
857
863
  }
858
864
  };
859
- function d(s) {
865
+ function v(s) {
860
866
  return `bc-label bc-label--${s}`;
861
867
  }
862
- const p = (...s) => n.span(o.class(d("emphasis")), ...s), y = (...s) => n.span(o.class(d("default")), ...s), f = (...s) => n.span(o.class(d("muted")), ...s), S = (...s) => n.span(o.class(d("danger")), ...s);
868
+ const p = (...s) => n.span(o.class(v("emphasis")), ...s), y = (...s) => n.span(o.class(v("default")), ...s), f = (...s) => n.span(o.class(v("muted")), ...s), S = (...s) => n.span(o.class(v("danger")), ...s);
863
869
  function g(...s) {
864
870
  return n.div(o.class("bc-stack"), ...s);
865
871
  }
@@ -869,5 +875,5 @@ export {
869
875
  y as L,
870
876
  f as M,
871
877
  g as S,
872
- c as i
878
+ i
873
879
  };