@aerogel/core 0.0.0-next.d824b40e5d06757cd9f47c9f771d916185df4f05 → 0.0.0-next.ea2e864c719d0a4d01b04729a9b681c0e9c85ea7

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 (192) hide show
  1. package/dist/aerogel-core.css +1 -0
  2. package/dist/aerogel-core.d.ts +2262 -912
  3. package/dist/aerogel-core.js +3561 -0
  4. package/dist/aerogel-core.js.map +1 -0
  5. package/package.json +38 -34
  6. package/src/bootstrap/bootstrap.test.ts +7 -10
  7. package/src/bootstrap/index.ts +43 -15
  8. package/src/bootstrap/options.ts +4 -1
  9. package/src/components/AppLayout.vue +14 -0
  10. package/src/components/{AGAppModals.vue → AppModals.vue} +3 -4
  11. package/src/components/AppOverlays.vue +9 -0
  12. package/src/components/AppToasts.vue +16 -0
  13. package/src/components/contracts/AlertModal.ts +19 -0
  14. package/src/components/contracts/Button.ts +16 -0
  15. package/src/components/contracts/ConfirmModal.ts +48 -0
  16. package/src/components/contracts/DropdownMenu.ts +25 -0
  17. package/src/components/contracts/ErrorReportModal.ts +33 -0
  18. package/src/components/contracts/Input.ts +26 -0
  19. package/src/components/contracts/LoadingModal.ts +26 -0
  20. package/src/components/contracts/Modal.ts +21 -0
  21. package/src/components/contracts/PromptModal.ts +34 -0
  22. package/src/components/contracts/Select.ts +45 -0
  23. package/src/components/contracts/Toast.ts +15 -0
  24. package/src/components/contracts/index.ts +11 -0
  25. package/src/components/headless/HeadlessButton.vue +51 -0
  26. package/src/components/headless/HeadlessInput.vue +59 -0
  27. package/src/components/headless/HeadlessInputDescription.vue +27 -0
  28. package/src/components/headless/{forms/AGHeadlessInputError.vue → HeadlessInputError.vue} +4 -8
  29. package/src/components/headless/HeadlessInputInput.vue +75 -0
  30. package/src/components/headless/HeadlessInputLabel.vue +18 -0
  31. package/src/components/headless/HeadlessInputTextArea.vue +40 -0
  32. package/src/components/headless/HeadlessModal.vue +57 -0
  33. package/src/components/headless/HeadlessModalContent.vue +30 -0
  34. package/src/components/headless/HeadlessModalDescription.vue +12 -0
  35. package/src/components/headless/HeadlessModalOverlay.vue +12 -0
  36. package/src/components/headless/HeadlessModalTitle.vue +12 -0
  37. package/src/components/headless/HeadlessSelect.vue +120 -0
  38. package/src/components/headless/HeadlessSelectError.vue +25 -0
  39. package/src/components/headless/HeadlessSelectLabel.vue +25 -0
  40. package/src/components/headless/HeadlessSelectOption.vue +34 -0
  41. package/src/components/headless/HeadlessSelectOptions.vue +42 -0
  42. package/src/components/headless/HeadlessSelectTrigger.vue +22 -0
  43. package/src/components/headless/HeadlessSelectValue.vue +18 -0
  44. package/src/components/headless/HeadlessSwitch.vue +96 -0
  45. package/src/components/headless/HeadlessToast.vue +18 -0
  46. package/src/components/headless/HeadlessToastAction.vue +13 -0
  47. package/src/components/headless/index.ts +20 -3
  48. package/src/components/index.ts +6 -9
  49. package/src/components/ui/AdvancedOptions.vue +18 -0
  50. package/src/components/ui/AlertModal.vue +17 -0
  51. package/src/components/ui/Button.vue +115 -0
  52. package/src/components/ui/Checkbox.vue +56 -0
  53. package/src/components/ui/ConfirmModal.vue +50 -0
  54. package/src/components/ui/DropdownMenu.vue +32 -0
  55. package/src/components/ui/DropdownMenuOption.vue +22 -0
  56. package/src/components/ui/DropdownMenuOptions.vue +44 -0
  57. package/src/components/ui/EditableContent.vue +82 -0
  58. package/src/components/ui/ErrorLogs.vue +19 -0
  59. package/src/components/ui/ErrorLogsModal.vue +48 -0
  60. package/src/components/ui/ErrorMessage.vue +15 -0
  61. package/src/components/ui/ErrorReportModal.vue +73 -0
  62. package/src/components/{modals/AGErrorReportModalButtons.vue → ui/ErrorReportModalButtons.vue} +38 -29
  63. package/src/components/ui/ErrorReportModalTitle.vue +24 -0
  64. package/src/components/ui/Form.vue +24 -0
  65. package/src/components/ui/Input.vue +56 -0
  66. package/src/components/ui/Link.vue +12 -0
  67. package/src/components/ui/LoadingModal.vue +34 -0
  68. package/src/components/ui/Markdown.vue +97 -0
  69. package/src/components/ui/Modal.vue +131 -0
  70. package/src/components/ui/ModalContext.vue +31 -0
  71. package/src/components/ui/ProgressBar.vue +51 -0
  72. package/src/components/ui/PromptModal.vue +38 -0
  73. package/src/components/ui/Select.vue +27 -0
  74. package/src/components/ui/SelectLabel.vue +21 -0
  75. package/src/components/ui/SelectOption.vue +29 -0
  76. package/src/components/ui/SelectOptions.vue +35 -0
  77. package/src/components/ui/SelectTrigger.vue +29 -0
  78. package/src/components/ui/SettingsModal.vue +15 -0
  79. package/src/components/ui/StartupCrash.vue +31 -0
  80. package/src/components/ui/Switch.vue +11 -0
  81. package/src/components/ui/Toast.vue +46 -0
  82. package/src/components/ui/index.ts +33 -0
  83. package/src/directives/index.ts +13 -5
  84. package/src/directives/measure.ts +46 -0
  85. package/src/errors/Errors.state.ts +1 -1
  86. package/src/errors/Errors.ts +41 -37
  87. package/src/errors/JobCancelledError.ts +3 -0
  88. package/src/errors/index.ts +22 -28
  89. package/src/errors/settings/Debug.vue +39 -0
  90. package/src/errors/settings/index.ts +10 -0
  91. package/src/errors/utils.ts +35 -0
  92. package/src/forms/FormController.test.ts +110 -0
  93. package/src/forms/FormController.ts +246 -0
  94. package/src/forms/index.ts +3 -2
  95. package/src/forms/utils.ts +51 -20
  96. package/src/forms/validation.ts +19 -0
  97. package/src/index.css +73 -0
  98. package/src/{main.ts → index.ts} +3 -0
  99. package/src/jobs/Job.ts +147 -0
  100. package/src/jobs/index.ts +10 -0
  101. package/src/jobs/listeners.ts +3 -0
  102. package/src/jobs/status.ts +4 -0
  103. package/src/lang/DefaultLangProvider.ts +46 -0
  104. package/src/lang/Lang.state.ts +11 -0
  105. package/src/lang/Lang.ts +44 -29
  106. package/src/lang/index.ts +12 -6
  107. package/src/lang/settings/Language.vue +48 -0
  108. package/src/lang/settings/index.ts +10 -0
  109. package/src/plugins/Plugin.ts +1 -1
  110. package/src/plugins/index.ts +10 -7
  111. package/src/services/App.state.ts +39 -7
  112. package/src/services/App.ts +49 -6
  113. package/src/services/Cache.ts +43 -0
  114. package/src/services/Events.test.ts +39 -0
  115. package/src/services/Events.ts +110 -36
  116. package/src/services/Service.ts +154 -49
  117. package/src/services/Storage.ts +20 -0
  118. package/src/services/index.ts +20 -8
  119. package/src/services/store.ts +8 -5
  120. package/src/services/utils.ts +18 -0
  121. package/src/testing/index.ts +26 -0
  122. package/src/testing/setup.ts +11 -0
  123. package/src/ui/UI.state.ts +14 -12
  124. package/src/ui/UI.ts +314 -95
  125. package/src/ui/index.ts +32 -27
  126. package/src/ui/utils.ts +16 -0
  127. package/src/utils/classes.ts +41 -0
  128. package/src/utils/composition/events.ts +4 -5
  129. package/src/utils/composition/forms.ts +20 -4
  130. package/src/utils/composition/persistent.test.ts +33 -0
  131. package/src/utils/composition/persistent.ts +11 -0
  132. package/src/utils/composition/state.test.ts +47 -0
  133. package/src/utils/composition/state.ts +33 -0
  134. package/src/utils/index.ts +5 -0
  135. package/src/utils/markdown.test.ts +50 -0
  136. package/src/utils/markdown.ts +53 -6
  137. package/src/utils/types.ts +3 -0
  138. package/src/utils/vue.ts +38 -123
  139. package/.eslintrc.js +0 -3
  140. package/dist/aerogel-core.cjs.js +0 -2
  141. package/dist/aerogel-core.cjs.js.map +0 -1
  142. package/dist/aerogel-core.esm.js +0 -2
  143. package/dist/aerogel-core.esm.js.map +0 -1
  144. package/dist/virtual.d.ts +0 -11
  145. package/noeldemartin.config.js +0 -5
  146. package/src/components/AGAppLayout.vue +0 -11
  147. package/src/components/AGAppOverlays.vue +0 -37
  148. package/src/components/AGAppSnackbars.vue +0 -13
  149. package/src/components/basic/AGErrorMessage.vue +0 -16
  150. package/src/components/basic/AGLink.vue +0 -9
  151. package/src/components/basic/AGMarkdown.vue +0 -36
  152. package/src/components/basic/index.ts +0 -5
  153. package/src/components/constants.ts +0 -8
  154. package/src/components/forms/AGButton.vue +0 -44
  155. package/src/components/forms/AGCheckbox.vue +0 -35
  156. package/src/components/forms/AGForm.vue +0 -26
  157. package/src/components/forms/AGInput.vue +0 -36
  158. package/src/components/forms/index.ts +0 -6
  159. package/src/components/headless/forms/AGHeadlessButton.vue +0 -51
  160. package/src/components/headless/forms/AGHeadlessInput.ts +0 -8
  161. package/src/components/headless/forms/AGHeadlessInput.vue +0 -54
  162. package/src/components/headless/forms/AGHeadlessInputInput.vue +0 -45
  163. package/src/components/headless/forms/AGHeadlessInputLabel.vue +0 -16
  164. package/src/components/headless/forms/index.ts +0 -6
  165. package/src/components/headless/modals/AGHeadlessModal.ts +0 -7
  166. package/src/components/headless/modals/AGHeadlessModal.vue +0 -88
  167. package/src/components/headless/modals/AGHeadlessModalPanel.vue +0 -28
  168. package/src/components/headless/modals/AGHeadlessModalTitle.vue +0 -13
  169. package/src/components/headless/modals/index.ts +0 -6
  170. package/src/components/headless/snackbars/AGHeadlessSnackbar.vue +0 -10
  171. package/src/components/headless/snackbars/index.ts +0 -25
  172. package/src/components/modals/AGAlertModal.vue +0 -25
  173. package/src/components/modals/AGConfirmModal.vue +0 -30
  174. package/src/components/modals/AGErrorReportModal.ts +0 -20
  175. package/src/components/modals/AGErrorReportModal.vue +0 -62
  176. package/src/components/modals/AGErrorReportModalTitle.vue +0 -25
  177. package/src/components/modals/AGLoadingModal.vue +0 -19
  178. package/src/components/modals/AGModal.ts +0 -10
  179. package/src/components/modals/AGModal.vue +0 -37
  180. package/src/components/modals/AGModalContext.ts +0 -8
  181. package/src/components/modals/AGModalContext.vue +0 -22
  182. package/src/components/modals/AGModalTitle.vue +0 -9
  183. package/src/components/modals/index.ts +0 -23
  184. package/src/components/snackbars/AGSnackbar.vue +0 -42
  185. package/src/components/snackbars/index.ts +0 -3
  186. package/src/directives/initial-focus.ts +0 -11
  187. package/src/forms/Form.test.ts +0 -58
  188. package/src/forms/Form.ts +0 -176
  189. package/src/forms/composition.ts +0 -6
  190. package/src/types/virtual.d.ts +0 -11
  191. package/tsconfig.json +0 -11
  192. package/vite.config.ts +0 -14
@@ -0,0 +1,3561 @@
1
+ var xt = Object.defineProperty;
2
+ var Ct = (t, s, e) => s in t ? xt(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
3
+ var _ = (t, s, e) => Ct(t, typeof s != "symbol" ? s + "" : s, e);
4
+ import { markRaw as P, Comment as kt, Text as St, Static as Mt, inject as se, reactive as de, nextTick as qe, defineComponent as g, computed as u, readonly as me, watchEffect as J, createElementBlock as b, openBlock as c, normalizeClass as k, createCommentVNode as M, createVNode as p, toDisplayString as $, unref as l, mergeProps as H, withCtx as f, createBlock as h, renderSlot as w, createPropsRestProxy as Z, onUnmounted as fe, ref as B, useAttrs as Fe, onMounted as Et, watch as Ee, toRaw as Ht, normalizeProps as re, guardReactiveProps as ne, createTextVNode as A, Fragment as j, renderList as F, provide as ae, resolveDynamicComponent as N, useSlots as He, createElementVNode as y, h as Vt, toRef as Te, useTemplateRef as le, withModifiers as Ue, withDirectives as Oe, vModelCheckbox as Lt, normalizeStyle as It, createApp as Tt, vModelText as Rt } from "vue";
5
+ import { JSError as he, tap as X, MagicObject as Ne, PromisedValue as W, Storage as U, objectOnly as oe, arrayFrom as We, isEmpty as we, objectDeepClone as Pt, fail as K, facade as G, arrayRemove as xe, getEnv as At, updateLocationQueryParameters as zt, forever as Dt, toString as q, isDevelopment as ee, isTesting as Ve, after as Ce, uuid as te, required as jt, isObject as ce, objectWithoutEmpty as Ke, stringMatchAll as Qe, objectWithout as Bt, noop as qt, debounce as Ft, value as Ut, isInstanceOf as Re, stringExcerpt as Ot, arraySorted as Nt, ListenersManager as Wt, toError as Kt, round as Qt } from "@noeldemartin/utils";
6
+ import O from "virtual:aerogel";
7
+ import { createPinia as Jt, setActivePinia as Zt, defineStore as Xt } from "pinia";
8
+ import { SwitchRoot as Gt, SwitchThumb as Yt, Primitive as es, SelectValue as Pe, SelectTrigger as ts, SelectIcon as ss, SelectItem as rs, SelectItemText as ns, SelectPortal as as, SelectContent as ls, SelectViewport as os, SelectRoot as is, Label as cs, useForwardExpose as Le, DialogRoot as us, DialogPortal as ds, DialogContent as ps, DialogDescription as ms, DialogOverlay as fs, DialogTitle as hs, ToastClose as gs, ToastRoot as vs, ToastProvider as bs, ToastViewport as ys, DropdownMenuItem as ws, DropdownMenuContent as _s, DropdownMenuRoot as $s, DropdownMenuTrigger as xs, DropdownMenuPortal as Cs } from "reka-ui";
9
+ import ks from "dompurify";
10
+ import { marked as Ss, Renderer as Ae } from "marked";
11
+ import Ms from "clsx";
12
+ import { cva as Es } from "class-variance-authority";
13
+ import { twMerge as Hs } from "tailwind-merge";
14
+ class ke extends he {
15
+ constructor(s, e) {
16
+ super(`Service '${s}' failed booting`, { cause: e });
17
+ }
18
+ }
19
+ let Ie = null;
20
+ function Je() {
21
+ return Ie ?? Vs();
22
+ }
23
+ function Vs() {
24
+ return X(Jt(), (t) => {
25
+ Ie = t, Zt(t);
26
+ });
27
+ }
28
+ function Ls() {
29
+ return Ie ?? Je();
30
+ }
31
+ function Is(t, s) {
32
+ return Je(), Xt(t, s)();
33
+ }
34
+ function ge(t) {
35
+ var s;
36
+ return s = class extends ve {
37
+ usesStore() {
38
+ return !0;
39
+ }
40
+ getName() {
41
+ return t.name ?? null;
42
+ }
43
+ getInitialState() {
44
+ return typeof t.initialState == "function" ? t.initialState() : Object.entries(t.initialState).reduce((e, [r, n]) => {
45
+ try {
46
+ n = structuredClone(n);
47
+ } catch {
48
+ console.warn(
49
+ `Could not clone '${r}' state from ${this.getName()} service, this may cause problems if you're using multiple instances of the service (for example, in unit tests).
50
+ To fix this problem, declare your initialState as a function instead.`
51
+ );
52
+ }
53
+ return e[r] = n, e;
54
+ }, {});
55
+ }
56
+ getComputedStateDefinition() {
57
+ return t.computed ?? {};
58
+ }
59
+ getStateWatchers() {
60
+ return t.watch ?? {};
61
+ }
62
+ serializePersistedState(e) {
63
+ var r;
64
+ return ((r = t.serialize) == null ? void 0 : r.call(t, e)) ?? e;
65
+ }
66
+ deserializePersistedState(e) {
67
+ var r;
68
+ return ((r = t.restore) == null ? void 0 : r.call(t, e)) ?? e;
69
+ }
70
+ }, _(s, "persist", t.persist ?? []), s;
71
+ }
72
+ var $e;
73
+ let ve = ($e = class extends Ne {
74
+ constructor() {
75
+ super();
76
+ _(this, "_name");
77
+ _(this, "_booted");
78
+ _(this, "_computedStateKeys");
79
+ _(this, "_watchers");
80
+ _(this, "_store");
81
+ const e = this.getComputedStateDefinition();
82
+ this._name = this.getName() ?? new.target.name, this._booted = new W(), this._computedStateKeys = new Set(Object.keys(e)), this._watchers = this.getStateWatchers(), this._store = this.usesStore() && Is(this._name, {
83
+ state: () => this.getInitialState(),
84
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
85
+ getters: e
86
+ });
87
+ }
88
+ get booted() {
89
+ return this._booted;
90
+ }
91
+ static(e) {
92
+ return super.static(e);
93
+ }
94
+ launch() {
95
+ const e = (r) => this._booted.reject(new ke(this._name, r));
96
+ try {
97
+ this.frameworkBoot().then(() => this.boot()).then(() => this._booted.resolve()).catch(e);
98
+ } catch (r) {
99
+ e(r);
100
+ }
101
+ return this._booted;
102
+ }
103
+ hasPersistedState() {
104
+ return U.has(this._name);
105
+ }
106
+ hasState(e) {
107
+ return this._store ? e in this._store.$state || this._computedStateKeys.has(e) : !1;
108
+ }
109
+ getState(e) {
110
+ const r = this._store;
111
+ return e ? r ? r[e] : void 0 : r || {};
112
+ }
113
+ setState(e, r) {
114
+ if (!this._store)
115
+ return;
116
+ const n = typeof e == "string" ? { [e]: r } : e, a = oe(this._store.$state, Object.keys(n));
117
+ Object.assign(this._store.$state, n), this.onStateUpdated(n, a);
118
+ }
119
+ updatePersistedState(e) {
120
+ if (!this._store)
121
+ return;
122
+ const r = We(e), n = oe(this._store.$state, r);
123
+ we(n) || this.onPersistentStateUpdated(n);
124
+ }
125
+ __get(e) {
126
+ return this.hasState(e) ? this.getState(e) : super.__get(e);
127
+ }
128
+ __set(e, r) {
129
+ this.setState({ [e]: r });
130
+ }
131
+ onStateUpdated(e, r) {
132
+ const n = oe(e, this.static("persist"));
133
+ we(n) || this.onPersistentStateUpdated(n);
134
+ for (const a in e) {
135
+ const i = this._watchers[a];
136
+ !i || e[a] === r[a] || i.call(this, e[a], r[a]);
137
+ }
138
+ }
139
+ onPersistentStateUpdated(e) {
140
+ const r = U.get(this._name);
141
+ r && U.set(this._name, {
142
+ ...r,
143
+ ...this.serializePersistedState(Pt(e))
144
+ });
145
+ }
146
+ usesStore() {
147
+ return !1;
148
+ }
149
+ getName() {
150
+ return null;
151
+ }
152
+ getInitialState() {
153
+ return {};
154
+ }
155
+ getComputedStateDefinition() {
156
+ return {};
157
+ }
158
+ getStateWatchers() {
159
+ return {};
160
+ }
161
+ serializePersistedState(e) {
162
+ return e;
163
+ }
164
+ deserializePersistedState(e) {
165
+ return e;
166
+ }
167
+ async frameworkBoot() {
168
+ this.restorePersistedState();
169
+ }
170
+ async boot() {
171
+ }
172
+ restorePersistedState() {
173
+ if (!(!this.usesStore() || we(this.static("persist")))) {
174
+ if (U.has(this._name)) {
175
+ const e = U.require(this._name);
176
+ this.setState(this.deserializePersistedState(e));
177
+ return;
178
+ }
179
+ U.set(this._name, oe(this.getState(), this.static("persist")));
180
+ }
181
+ }
182
+ requireStore() {
183
+ return this._store ? this._store : K(`Failed getting '${this._name}' store`);
184
+ }
185
+ }, _($e, "persist", []), $e);
186
+ const qa = {
187
+ Low: -256,
188
+ Default: 0,
189
+ High: 256
190
+ };
191
+ class Ts extends ve {
192
+ constructor() {
193
+ super(...arguments);
194
+ _(this, "listeners", {});
195
+ }
196
+ async boot() {
197
+ Object.entries(globalThis.__aerogelEvents__ ?? {}).forEach(([e, r]) => (
198
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
199
+ this.on(e, r)
200
+ ));
201
+ }
202
+ async emit(e, r) {
203
+ var a;
204
+ const n = this.listeners[e] ?? { priorities: [], handlers: {} };
205
+ for (const i of n.priorities)
206
+ await Promise.all(((a = n.handlers[i]) == null ? void 0 : a.map((o) => o(r))) ?? []);
207
+ }
208
+ // prettier-ignore
209
+ /* eslint-enable max-len */
210
+ on(e, r, n) {
211
+ const a = typeof r == "function" ? {} : typeof r == "number" ? { priority: r } : r, i = typeof r == "function" ? r : n;
212
+ return this.registerListener(e, a, i), () => this.off(e, i);
213
+ }
214
+ // prettier-ignore
215
+ /* eslint-enable max-len */
216
+ once(e, r, n) {
217
+ let a = null;
218
+ const i = typeof r == "function" ? {} : r, o = typeof r == "function" ? r : n;
219
+ return X(
220
+ () => a && this.off(e, a),
221
+ (d) => {
222
+ a = (...v) => (d(), o(...v)), this.registerListener(e, i, o);
223
+ }
224
+ );
225
+ }
226
+ off(e, r) {
227
+ var i;
228
+ const n = this.listeners[e];
229
+ if (!n)
230
+ return;
231
+ const a = [...n.priorities];
232
+ for (const o of a)
233
+ xe(n.handlers[o] ?? [], r), ((i = n.handlers[o]) == null ? void 0 : i.length) === 0 && (delete n.handlers[o], xe(n.priorities, o));
234
+ n.priorities.length === 0 && delete this.listeners[e];
235
+ }
236
+ registerListener(e, r, n) {
237
+ var d, v, C;
238
+ const a = r.priority ?? 0;
239
+ e in this.listeners || (this.listeners[e] = { priorities: [], handlers: {} });
240
+ const i = ((d = this.listeners[e]) == null ? void 0 : d.priorities) ?? K(`priorities missing for event '${e}'`), o = ((v = this.listeners[e]) == null ? void 0 : v.handlers) ?? K(`handlers missing for event '${e}'`);
241
+ i.includes(a) || (i.push(a), i.sort((m, x) => x - m), o[a] = []), (C = o[a]) == null || C.push(n);
242
+ }
243
+ }
244
+ const I = G(Ts);
245
+ function Fa(t) {
246
+ return t;
247
+ }
248
+ const Rs = ge({
249
+ name: "app",
250
+ initialState: {
251
+ plugins: {},
252
+ instance: null,
253
+ environment: At() ?? "development",
254
+ version: O.version,
255
+ sourceUrl: O.sourceUrl,
256
+ settings: []
257
+ },
258
+ computed: {
259
+ development: (t) => t.environment === "development",
260
+ staging: (t) => t.environment === "staging",
261
+ testing: (t) => t.environment === "test" || t.environment === "testing",
262
+ versionName(t) {
263
+ return this.development ? "dev." + O.sourceHash.toString().substring(0, 7) : this.staging ? "staging." + O.sourceHash.toString().substring(0, 7) : `v${t.version}`;
264
+ },
265
+ versionUrl(t) {
266
+ return t.sourceUrl + (this.development || this.staging ? `/tree/${O.sourceHash}` : `/releases/tag/${this.versionName}`);
267
+ }
268
+ }
269
+ });
270
+ class Ps extends Rs {
271
+ constructor() {
272
+ super(...arguments);
273
+ _(this, "name", O.name);
274
+ _(this, "ready", new W());
275
+ _(this, "mounted", new W());
276
+ }
277
+ isReady() {
278
+ return this.ready.isResolved();
279
+ }
280
+ isMounted() {
281
+ return this.mounted.isResolved();
282
+ }
283
+ addSetting(e) {
284
+ this.settings.push(P(e));
285
+ }
286
+ async whenReady(e) {
287
+ return await this.ready.then(e);
288
+ }
289
+ async reload(e) {
290
+ e && zt(e), location.reload(), await Dt();
291
+ }
292
+ plugin(e) {
293
+ return this.plugins[e] ?? null;
294
+ }
295
+ service(e) {
296
+ var r;
297
+ return ((r = this.instance) == null ? void 0 : r.config.globalProperties[e]) ?? null;
298
+ }
299
+ async boot() {
300
+ I.once("application-ready", () => this.ready.resolve()), I.once("application-mounted", () => this.mounted.resolve());
301
+ }
302
+ }
303
+ const D = G(Ps);
304
+ function Ua(t) {
305
+ return t;
306
+ }
307
+ async function As(t, ...s) {
308
+ D.setState(
309
+ "plugins",
310
+ t.reduce(
311
+ (e, r) => (r.name && (e[r.name] = r), e),
312
+ {}
313
+ )
314
+ ), await Promise.all(t.map((e) => e.install(...s)) ?? []);
315
+ }
316
+ function zs(t) {
317
+ return Object.entries(t.props ?? {}).reduce((s, [e, r]) => s + `${e}="${q(r)}"`, "");
318
+ }
319
+ function Oa(t) {
320
+ return t;
321
+ }
322
+ function Ds(t) {
323
+ const s = se(t);
324
+ return s ? de(s) : void 0;
325
+ }
326
+ function V(t, s) {
327
+ return Ds(t) ?? K(s ?? `Could not resolve '${q(t)}' injection key`);
328
+ }
329
+ function js(t, s) {
330
+ return se(t) ?? K(s ?? `Could not resolve '${q(t)}' injection key`);
331
+ }
332
+ function Ze(t) {
333
+ return typeof t == "string" ? t : t.type === kt ? "" : t.type === St || t.type === Mt ? t.children : t.type === "br" ? `
334
+
335
+ ` : `<${t.type} ${zs(t)}>${Array.from(t.children).map(Ze).join("")}</${t.type}>`;
336
+ }
337
+ const _e = /* @__PURE__ */ new WeakMap(), Bs = {
338
+ mounted(t, { value: s, modifiers: e }) {
339
+ const r = typeof s == "function" ? s : null, n = () => {
340
+ const a = t.getBoundingClientRect();
341
+ e.css && (t.style.setProperty("--width", `${a.width}px`), t.style.setProperty("--height", `${a.height}px`)), r == null || r({ width: a.width, height: a.height });
342
+ };
343
+ e.watch && _e.set(t, X(new ResizeObserver(n)).observe(t)), n();
344
+ },
345
+ unmounted(t) {
346
+ var s;
347
+ (s = _e.get(t)) == null || s.unobserve(t), _e.delete(t);
348
+ }
349
+ }, qs = {
350
+ measure: Bs
351
+ }, Fs = {
352
+ install(t, s) {
353
+ const e = {
354
+ ...qs,
355
+ ...s.directives
356
+ };
357
+ for (const [r, n] of Object.entries(e))
358
+ t.directive(r, n);
359
+ }
360
+ };
361
+ class Us extends ve {
362
+ constructor() {
363
+ super(...arguments);
364
+ _(this, "cache");
365
+ }
366
+ async get(e) {
367
+ return await (await this.open()).match(e) ?? null;
368
+ }
369
+ async store(e, r) {
370
+ await (await this.open()).put(e, r);
371
+ }
372
+ async replace(e, r) {
373
+ const n = await this.open();
374
+ (await n.keys(e)).length !== 0 && await n.put(e, r);
375
+ }
376
+ async open() {
377
+ return this.cache = this.cache ?? X(new W(), (e) => {
378
+ caches.open("app").then((r) => e.resolve(r));
379
+ });
380
+ }
381
+ }
382
+ const Na = G(Us);
383
+ class Os extends ve {
384
+ async purge() {
385
+ await I.emit("purge-storage");
386
+ }
387
+ }
388
+ const Ns = G(Os);
389
+ function Wa(t, s) {
390
+ return {
391
+ ...t,
392
+ ...oe(s, Object.keys(t))
393
+ };
394
+ }
395
+ const Ws = {
396
+ $app: D,
397
+ $events: I,
398
+ $storage: Ns
399
+ };
400
+ async function be(t, s) {
401
+ await Promise.all(
402
+ Object.entries(s).map(async ([e, r]) => {
403
+ await r.launch().catch((n) => {
404
+ var a, i;
405
+ return (i = (a = t.config).errorHandler) == null ? void 0 : i.call(a, n, null, `Failed launching ${e}.`);
406
+ });
407
+ })
408
+ ), Object.assign(t.config.globalProperties, s), (ee() || Ve()) && Object.assign(globalThis, s);
409
+ }
410
+ const Ks = {
411
+ async install(t, s) {
412
+ var r;
413
+ const e = {
414
+ ...Ws,
415
+ ...s.services
416
+ };
417
+ t.use(Ls()), (r = s.settings) == null || r.forEach((n) => D.addSetting(n)), await be(t, e);
418
+ }
419
+ }, Xe = 768, pe = {
420
+ Mobile: "mobile",
421
+ Desktop: "desktop"
422
+ };
423
+ function Ge() {
424
+ return globalThis.innerWidth > Xe ? pe.Desktop : pe.Mobile;
425
+ }
426
+ const Qs = ge({
427
+ name: "ui",
428
+ initialState: {
429
+ modals: [],
430
+ toasts: [],
431
+ layout: Ge()
432
+ },
433
+ computed: {
434
+ desktop: ({ layout: t }) => t === pe.Desktop,
435
+ mobile: ({ layout: t }) => t === pe.Mobile,
436
+ openModals: ({ modals: t }) => t.filter(({ closing: s }) => !s)
437
+ }
438
+ });
439
+ class Js extends Qs {
440
+ constructor() {
441
+ super(...arguments);
442
+ _(this, "modalCallbacks", {});
443
+ _(this, "components", {});
444
+ }
445
+ registerComponent(e, r) {
446
+ this.components[e] = r;
447
+ }
448
+ resolveComponent(e) {
449
+ return this.components[e] ?? null;
450
+ }
451
+ requireComponent(e) {
452
+ return this.resolveComponent(e) ?? K(`UI Component '${e}' is not defined!`);
453
+ }
454
+ alert(e, r) {
455
+ const n = () => typeof r != "string" ? { message: e } : {
456
+ title: e,
457
+ message: r
458
+ };
459
+ this.modal(this.requireComponent("alert-modal"), n());
460
+ }
461
+ // prettier-ignore
462
+ /* eslint-enable max-len */
463
+ async confirm(e, r, n) {
464
+ const i = typeof r != "string" ? {
465
+ ...r ?? {},
466
+ message: e,
467
+ required: !!(r != null && r.required)
468
+ } : {
469
+ ...n ?? {},
470
+ title: e,
471
+ message: r,
472
+ required: !!(n != null && n.required)
473
+ }, o = await this.modalForm(this.requireComponent("confirm-modal"), i), d = typeof o == "object" ? o[0] : o ?? !1, v = typeof o == "object" ? o[1] : Object.entries(i.checkboxes ?? {}).reduce(
474
+ (C, [m, { default: x }]) => ({
475
+ [m]: x ?? !1,
476
+ ...C
477
+ }),
478
+ {}
479
+ );
480
+ for (const [C, m] of Object.entries(i.checkboxes ?? {}))
481
+ if (!(!m.required || v[C]))
482
+ return d && ee() && console.warn(`Confirmed confirm modal was suppressed because required '${C}' checkbox was missing`), [!1, v];
483
+ return "checkboxes" in i ? [d, v] : d;
484
+ }
485
+ async prompt(e, r, n) {
486
+ const a = (n == null ? void 0 : n.trim) ?? !0, i = () => typeof r != "string" ? {
487
+ message: e,
488
+ ...r ?? {}
489
+ } : {
490
+ title: e,
491
+ message: r,
492
+ ...n ?? {}
493
+ }, o = await this.modalForm(this.requireComponent("prompt-modal"), i());
494
+ return (a && typeof o == "string" ? o == null ? void 0 : o.trim() : o) ?? null;
495
+ }
496
+ async loading(e, r) {
497
+ const n = (v) => typeof v == "function" ? Promise.resolve(v()) : v, a = () => typeof e == "string" ? {
498
+ props: { message: e },
499
+ operationPromise: n(r)
500
+ } : typeof e == "function" || e instanceof Promise ? { operationPromise: n(e) } : {
501
+ props: e,
502
+ operationPromise: n(r)
503
+ }, { operationPromise: i, props: o } = a(), d = await this.modal(this.requireComponent("loading-modal"), o);
504
+ try {
505
+ const v = await i;
506
+ return await Ce({ ms: 500 }), v;
507
+ } finally {
508
+ await this.closeModal(d.id);
509
+ }
510
+ }
511
+ toast(e, r = {}) {
512
+ const { component: n, ...a } = r, i = {
513
+ id: te(),
514
+ properties: { message: e, ...a },
515
+ component: P(n ?? this.requireComponent("toast"))
516
+ };
517
+ this.setState("toasts", this.toasts.concat(i));
518
+ }
519
+ async modal(e, r) {
520
+ const n = te(), a = {}, i = {
521
+ id: n,
522
+ closing: !1,
523
+ properties: r ?? {},
524
+ component: P(e),
525
+ beforeClose: new Promise((d) => a.willClose = d),
526
+ afterClose: new Promise((d) => a.hasClosed = d)
527
+ }, o = this.modals.concat(i);
528
+ return this.modalCallbacks[i.id] = a, this.setState({ modals: o }), await qe(), i;
529
+ }
530
+ async modalForm(e, r) {
531
+ return await (await this.modal(e, r)).beforeClose;
532
+ }
533
+ async closeModal(e, r) {
534
+ if (!D.isMounted()) {
535
+ await this.removeModal(e, r);
536
+ return;
537
+ }
538
+ await I.emit("close-modal", { id: e, result: r });
539
+ }
540
+ async closeAllModals() {
541
+ for (; this.modals.length > 0; )
542
+ await this.closeModal(jt(this.modals[this.modals.length - 1]).id);
543
+ }
544
+ async boot() {
545
+ this.watchModalEvents(), this.watchMountedEvent(), this.watchViewportBreakpoints();
546
+ }
547
+ async removeModal(e, r) {
548
+ var n, a;
549
+ this.setState(
550
+ "modals",
551
+ this.modals.filter((i) => i.id !== e)
552
+ ), (a = (n = this.modalCallbacks[e]) == null ? void 0 : n.hasClosed) == null || a.call(n, r), delete this.modalCallbacks[e];
553
+ }
554
+ watchModalEvents() {
555
+ I.on("modal-will-close", ({ modal: { id: e }, result: r }) => {
556
+ var a, i;
557
+ const n = this.modals.find((o) => e === o.id);
558
+ n && (n.closing = !0), (i = (a = this.modalCallbacks[e]) == null ? void 0 : a.willClose) == null || i.call(a, r);
559
+ }), I.on("modal-has-closed", async ({ modal: { id: e }, result: r }) => {
560
+ await this.removeModal(e, r);
561
+ });
562
+ }
563
+ watchMountedEvent() {
564
+ I.once("application-mounted", async () => {
565
+ if (!globalThis.document || !globalThis.getComputedStyle)
566
+ return;
567
+ const e = globalThis.document.getElementById("splash");
568
+ e && (globalThis.getComputedStyle(e).opacity !== "0" && (e.style.opacity = "0", await Ce({ ms: 600 })), e.remove());
569
+ });
570
+ }
571
+ watchViewportBreakpoints() {
572
+ if (!globalThis.matchMedia)
573
+ return;
574
+ globalThis.matchMedia(`(min-width: ${Xe}px)`).addEventListener("change", () => this.setState({ layout: Ge() }));
575
+ }
576
+ }
577
+ const R = G(Js);
578
+ class Zs {
579
+ constructor(s, e) {
580
+ this.locale = s, this.fallbackLocale = e;
581
+ }
582
+ getLocale() {
583
+ return this.locale;
584
+ }
585
+ async setLocale(s) {
586
+ this.locale = s;
587
+ }
588
+ getFallbackLocale() {
589
+ return this.fallbackLocale;
590
+ }
591
+ async setFallbackLocale(s) {
592
+ this.fallbackLocale = s;
593
+ }
594
+ getLocales() {
595
+ return ["en"];
596
+ }
597
+ translate(s) {
598
+ return ee() && console.warn("Lang provider is missing"), s;
599
+ }
600
+ translateWithDefault(s, e) {
601
+ return ee() && console.warn("Lang provider is missing"), e;
602
+ }
603
+ }
604
+ const Xs = ge({
605
+ name: "lang",
606
+ persist: ["locale", "fallbackLocale"],
607
+ initialState: {
608
+ locale: null,
609
+ locales: ["en"],
610
+ fallbackLocale: "en"
611
+ }
612
+ });
613
+ class Gs extends Xs {
614
+ constructor() {
615
+ super();
616
+ _(this, "provider");
617
+ this.provider = new Zs(
618
+ this.getState("locale") ?? this.getBrowserLocale(),
619
+ this.getState("fallbackLocale")
620
+ );
621
+ }
622
+ async setProvider(e) {
623
+ this.provider = e, this.locales = e.getLocales(), await e.setLocale(this.locale ?? this.getBrowserLocale()), await e.setFallbackLocale(this.fallbackLocale);
624
+ }
625
+ translate(e, r) {
626
+ return this.provider.translate(e, r) ?? e;
627
+ }
628
+ translateWithDefault(e, r, n = {}) {
629
+ return this.provider.translateWithDefault(e, r, n);
630
+ }
631
+ getBrowserLocale() {
632
+ const e = this.getState("locales");
633
+ return navigator.languages.find((r) => e.includes(r)) ?? "en";
634
+ }
635
+ async boot() {
636
+ globalThis.document && this.requireStore().$subscribe(
637
+ async () => {
638
+ var e, r;
639
+ await this.provider.setLocale(this.locale ?? this.getBrowserLocale()), await this.provider.setFallbackLocale(this.fallbackLocale), this.locale ? (e = document.querySelector("html")) == null || e.setAttribute("lang", this.locale) : (r = document.querySelector("html")) == null || r.removeAttribute("lang");
640
+ },
641
+ { immediate: !0 }
642
+ );
643
+ }
644
+ }
645
+ const Q = G(Gs), Ye = Q.translate.bind(Q), S = Q.translateWithDefault.bind(Q), Ys = ge({
646
+ name: "errors",
647
+ initialState: {
648
+ logs: [],
649
+ startupErrors: []
650
+ },
651
+ computed: {
652
+ hasErrors: ({ logs: t }) => t.length > 0,
653
+ hasNewErrors: ({ logs: t }) => t.some((s) => !s.seen),
654
+ hasStartupErrors: ({ startupErrors: t }) => t.length > 0
655
+ }
656
+ });
657
+ class er extends Ys {
658
+ constructor() {
659
+ super(...arguments);
660
+ _(this, "forceReporting", !1);
661
+ _(this, "enabled", !0);
662
+ }
663
+ enable() {
664
+ this.enabled = !0;
665
+ }
666
+ disable() {
667
+ this.enabled = !1;
668
+ }
669
+ async inspect(e, r) {
670
+ if (Array.isArray(e) && e.length === 0) {
671
+ R.alert(S("errors.inspectEmpty", "Nothing to inspect!"));
672
+ return;
673
+ }
674
+ const n = Array.isArray(e) ? e[0] : this.isErrorReport(e) ? e : await this.createErrorReport(e), a = Array.isArray(e) ? e : r ?? [n];
675
+ R.modal(R.requireComponent("error-report-modal"), { report: n, reports: a });
676
+ }
677
+ async report(e, r) {
678
+ if (await I.emit("error", { error: e, message: r }), Ve("unit") || (ee() && this.logError(e), !this.enabled))
679
+ throw e;
680
+ if (!D.isMounted()) {
681
+ const i = await this.createStartupErrorReport(e);
682
+ i && this.setState({ startupErrors: this.startupErrors.concat(i) });
683
+ return;
684
+ }
685
+ const n = await this.createErrorReport(e), a = {
686
+ report: n,
687
+ seen: !1,
688
+ date: /* @__PURE__ */ new Date()
689
+ };
690
+ R.toast(
691
+ r ?? S("errors.notice", "Something went wrong, but it's not your fault. Try again!"),
692
+ {
693
+ variant: "danger",
694
+ actions: [
695
+ {
696
+ label: S("errors.viewDetails", "View details"),
697
+ dismiss: !0,
698
+ click: () => R.modal(R.requireComponent("error-report-modal"), { report: n, reports: [n] })
699
+ }
700
+ ]
701
+ }
702
+ ), this.setState({ logs: [a].concat(this.logs) });
703
+ }
704
+ see(e) {
705
+ this.setState({
706
+ logs: this.logs.map((r) => r.report !== e ? r : {
707
+ ...r,
708
+ seen: !0
709
+ })
710
+ });
711
+ }
712
+ seeAll() {
713
+ this.setState({
714
+ logs: this.logs.map((e) => ({
715
+ ...e,
716
+ seen: !0
717
+ }))
718
+ });
719
+ }
720
+ logError(e) {
721
+ console.error(e), ce(e) && e.cause && this.logError(e.cause);
722
+ }
723
+ isErrorReport(e) {
724
+ return ce(e) && "title" in e;
725
+ }
726
+ async createErrorReport(e) {
727
+ return typeof e == "string" ? { title: e } : e instanceof Error || e instanceof he ? this.createErrorReportFromError(e) : ce(e) ? Ke({
728
+ title: q(
729
+ e.name ?? e.title ?? S("errors.unknown", "Unknown Error")
730
+ ),
731
+ description: q(
732
+ e.message ?? e.description ?? S("errors.unknownDescription", "Unknown error object")
733
+ ),
734
+ error: e
735
+ }) : {
736
+ title: S("errors.unknown", "Unknown Error"),
737
+ error: e
738
+ };
739
+ }
740
+ async createStartupErrorReport(e) {
741
+ return e instanceof ke ? e.cause instanceof ke ? null : this.createErrorReport(e.cause) : this.createErrorReport(e);
742
+ }
743
+ createErrorReportFromError(e, r = {}) {
744
+ return {
745
+ title: e.name,
746
+ description: e.message,
747
+ details: e.stack,
748
+ error: e,
749
+ ...r
750
+ };
751
+ }
752
+ }
753
+ const et = G(er), tr = ["for"], sr = /* @__PURE__ */ g({
754
+ inheritAttrs: !1,
755
+ __name: "HeadlessSwitch",
756
+ props: {
757
+ name: {},
758
+ label: {},
759
+ description: {},
760
+ modelValue: {},
761
+ class: {},
762
+ labelClass: {},
763
+ inputClass: {},
764
+ thumbClass: {}
765
+ },
766
+ emits: ["update:modelValue"],
767
+ setup(t, { expose: s, emit: e }) {
768
+ const r = e, n = se("form", null), a = u(() => !n || !t.name ? null : n.errors[t.name] ?? null), i = {
769
+ id: `switch-${te()}`,
770
+ name: u(() => t.name),
771
+ label: u(() => t.label),
772
+ description: u(() => t.description),
773
+ value: u(() => n && t.name ? n.getFieldValue(t.name) : t.modelValue),
774
+ errors: me(a),
775
+ required: u(() => {
776
+ if (!(!t.name || !n))
777
+ return n.getFieldRules(t.name).includes("required");
778
+ }),
779
+ update(o) {
780
+ if (n && t.name) {
781
+ n.setFieldValue(t.name, o);
782
+ return;
783
+ }
784
+ r("update:modelValue", o);
785
+ }
786
+ };
787
+ return s(i), J(() => {
788
+ !t.description && !a.value || console.warn("Errors and description not implemented in <HeadlessSwitch>");
789
+ }), (o, d) => (c(), b("div", {
790
+ class: k(t.class)
791
+ }, [
792
+ o.label ? (c(), b("label", {
793
+ key: 0,
794
+ for: i.id,
795
+ class: k(o.labelClass)
796
+ }, $(o.label), 11, tr)) : M("", !0),
797
+ p(l(Gt), H({
798
+ id: i.id,
799
+ name: o.name,
800
+ "model-value": i.value.value
801
+ }, o.$attrs, {
802
+ class: o.inputClass,
803
+ "onUpdate:modelValue": d[0] || (d[0] = (v) => o.$emit("update:modelValue", v))
804
+ }), {
805
+ default: f(() => [
806
+ p(l(Yt), {
807
+ class: k(o.thumbClass)
808
+ }, null, 8, ["class"])
809
+ ]),
810
+ _: 1
811
+ }, 16, ["id", "name", "model-value", "class"])
812
+ ], 2));
813
+ }
814
+ }), rr = /* @__PURE__ */ g({
815
+ __name: "Switch",
816
+ setup(t) {
817
+ return (s, e) => (c(), h(sr, {
818
+ class: "flex flex-row items-center gap-1",
819
+ "input-class": "disabled:opacity-50 disabled:cursor-not-allowed data-[state=checked]:bg-primary-600 data-[state=unchecked]:bg-gray-200 relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focusdisabled:opacity-50 disabled:cursor-not-allowed :ring-2 focus:ring-primary-600 focus:ring-offset-2 focus:outline-hidden",
820
+ "thumb-class": "data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0 pointer-events-none inline-block size-5 transform rounded-full bg-white shadow-sm ring-0 transition duration-200 ease-in-out"
821
+ }));
822
+ }
823
+ });
824
+ let ie = null;
825
+ function nr() {
826
+ return X(new Ae(), (t) => {
827
+ t.link = function(s) {
828
+ const e = Ae.prototype.link.apply(this, [s]);
829
+ return s.href.startsWith("#") ? e : e.replace("<a", '<a target="_blank"');
830
+ };
831
+ });
832
+ }
833
+ function ar(t) {
834
+ const s = Qe(t, /<a[^>]*href="#action:([^"]+)"[^>]*>([^<]+)<\/a>/g);
835
+ for (const [e, r, n] of s)
836
+ t = t.replace(e, `<button type="button" data-markdown-action="${r}">${n}</button>`);
837
+ return t;
838
+ }
839
+ function lr(t) {
840
+ const s = Qe(t, /<a[^>]*href="#route:([^"]+)"[^>]*>([^<]+)<\/a>/g);
841
+ for (const [e, r, n] of s) {
842
+ const a = (ie == null ? void 0 : ie.resolve(r)) ?? r;
843
+ t = t.replace(e, `<a data-markdown-route="${r}" href="${a}">${n}</a>`);
844
+ }
845
+ return t;
846
+ }
847
+ function or() {
848
+ return ie;
849
+ }
850
+ function Ka(t) {
851
+ ie = t;
852
+ }
853
+ function ir(t) {
854
+ let s = Ss(t, { renderer: nr(), async: !1 });
855
+ return s = cr(s), s = ar(s), s = lr(s), s;
856
+ }
857
+ function cr(t) {
858
+ return ks.sanitize(t, { ADD_ATTR: ["target"] });
859
+ }
860
+ const tt = /* @__PURE__ */ g({
861
+ __name: "HeadlessButton",
862
+ props: {
863
+ class: {},
864
+ disabled: { type: Boolean },
865
+ href: {},
866
+ route: {},
867
+ routeParams: {},
868
+ routeQuery: {},
869
+ size: {},
870
+ submit: { type: Boolean },
871
+ variant: {},
872
+ asChild: { type: Boolean },
873
+ as: {}
874
+ },
875
+ setup(t) {
876
+ const s = u(() => t.as ? { as: t.as } : t.route ? {
877
+ as: R.resolveComponent("router-link") ?? "a",
878
+ to: Ke({
879
+ name: t.route,
880
+ params: t.routeParams,
881
+ query: t.routeQuery
882
+ })
883
+ } : t.href ? {
884
+ as: "a",
885
+ target: "_blank",
886
+ href: t.href
887
+ } : {
888
+ as: "button",
889
+ type: t.submit ? "submit" : "button"
890
+ });
891
+ return (e, r) => (c(), h(l(es), H({
892
+ class: t.class,
893
+ "as-child": e.asChild,
894
+ disabled: e.disabled
895
+ }, s.value), {
896
+ default: f(() => [
897
+ w(e.$slots, "default")
898
+ ]),
899
+ _: 3
900
+ }, 16, ["class", "as-child", "disabled"]));
901
+ }
902
+ });
903
+ function st(t, s) {
904
+ const { baseClasses: e, ...r } = t, { baseClasses: n, ...a } = s, i = Es(n, a);
905
+ return E(i(r), l(e));
906
+ }
907
+ function E(...t) {
908
+ return Hs(Ms(t));
909
+ }
910
+ const z = /* @__PURE__ */ g({
911
+ __name: "Button",
912
+ props: {
913
+ class: {},
914
+ disabled: { type: Boolean },
915
+ href: {},
916
+ route: {},
917
+ routeParams: {},
918
+ routeQuery: {},
919
+ size: {},
920
+ submit: { type: Boolean },
921
+ variant: {},
922
+ asChild: { type: Boolean },
923
+ as: {}
924
+ },
925
+ setup(t) {
926
+ const s = Z(t, ["class", "size", "variant", "disabled"]), e = u(() => st(
927
+ { baseClasses: t.class, variant: t.variant, size: t.size, disabled: t.disabled },
928
+ {
929
+ baseClasses: "focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2",
930
+ variants: {
931
+ variant: {
932
+ default: "bg-primary-600 text-white focus-visible:outline-primary-600",
933
+ secondary: "bg-background text-gray-900 ring-gray-300",
934
+ danger: "bg-red-600 text-white focus-visible:outline-red-600",
935
+ ghost: "bg-transparent",
936
+ outline: "bg-transparent text-primary-600 ring-primary-600",
937
+ link: "text-links"
938
+ },
939
+ size: {
940
+ small: "text-xs min-h-6",
941
+ default: "text-sm min-h-8",
942
+ large: "text-base min-h-10",
943
+ icon: "rounded-full p-2.5"
944
+ },
945
+ disabled: {
946
+ false: null,
947
+ true: "opacity-50 cursor-not-allowed"
948
+ }
949
+ },
950
+ compoundVariants: [
951
+ {
952
+ variant: ["default", "secondary", "danger", "ghost", "outline"],
953
+ class: "flex items-center justify-center gap-1 font-medium"
954
+ },
955
+ {
956
+ variant: ["default", "danger"],
957
+ class: "shadow-sm"
958
+ },
959
+ {
960
+ variant: ["secondary", "outline"],
961
+ class: "ring-1 ring-inset"
962
+ },
963
+ {
964
+ variant: ["default", "secondary", "danger", "ghost", "outline"],
965
+ size: "small",
966
+ class: "rounded px-2 py-1"
967
+ },
968
+ {
969
+ variant: ["default", "secondary", "danger", "ghost", "outline"],
970
+ size: "default",
971
+ class: "rounded-md px-2.5 py-1.5"
972
+ },
973
+ {
974
+ variant: ["default", "secondary", "danger", "ghost", "outline"],
975
+ size: "large",
976
+ class: "rounded-md px-3 py-2"
977
+ },
978
+ {
979
+ variant: "default",
980
+ disabled: !1,
981
+ class: "hover:bg-primary-500"
982
+ },
983
+ {
984
+ variant: ["secondary", "ghost", "outline"],
985
+ disabled: !1,
986
+ class: "hover:bg-gray-50"
987
+ },
988
+ {
989
+ variant: "danger",
990
+ disabled: !1,
991
+ class: "hover:bg-red-500"
992
+ },
993
+ {
994
+ variant: "link",
995
+ disabled: !1,
996
+ class: "hover:underline"
997
+ },
998
+ {
999
+ variant: "link",
1000
+ size: "small",
1001
+ class: "leading-6"
1002
+ },
1003
+ {
1004
+ variant: "link",
1005
+ size: "default",
1006
+ class: "leading-8"
1007
+ },
1008
+ {
1009
+ variant: "link",
1010
+ size: "large",
1011
+ class: "leading-10"
1012
+ }
1013
+ ],
1014
+ defaultVariants: {
1015
+ variant: "default",
1016
+ size: "default",
1017
+ disabled: !1
1018
+ }
1019
+ }
1020
+ ));
1021
+ return (r, n) => (c(), h(tt, H({
1022
+ class: e.value,
1023
+ disabled: r.disabled
1024
+ }, s), {
1025
+ default: f(() => [
1026
+ w(r.$slots, "default")
1027
+ ]),
1028
+ _: 3
1029
+ }, 16, ["class", "disabled"]));
1030
+ }
1031
+ });
1032
+ function ur(t) {
1033
+ return typeof t == "object" && t !== null && "label" in t;
1034
+ }
1035
+ function rt(t, s) {
1036
+ const e = I.on(t, s);
1037
+ fe(() => e());
1038
+ }
1039
+ const dr = {
1040
+ required: (t) => t ? void 0 : "required"
1041
+ }, ue = { ...dr };
1042
+ function Qa(t, s) {
1043
+ ue[t] = s;
1044
+ }
1045
+ function pr(t, s) {
1046
+ var r;
1047
+ const e = (r = ue[s]) == null ? void 0 : r.call(ue, t);
1048
+ return e ? We(e) : [];
1049
+ }
1050
+ const Ja = Symbol(), ze = /* @__PURE__ */ new WeakMap();
1051
+ class mr extends Ne {
1052
+ constructor(e) {
1053
+ super();
1054
+ _(this, "errors");
1055
+ _(this, "_fields");
1056
+ _(this, "_data");
1057
+ _(this, "_submitted");
1058
+ _(this, "_errors");
1059
+ _(this, "_listeners", {});
1060
+ this._fields = e, this._submitted = B(!1), this._data = this.getInitialData(e), this._errors = this.getInitialErrors(e), ze.set(
1061
+ this,
1062
+ u(() => !Object.values(this._errors).some((r) => r !== null))
1063
+ ), this.errors = me(this._errors);
1064
+ }
1065
+ get valid() {
1066
+ var e;
1067
+ return !!((e = ze.get(this)) != null && e.value);
1068
+ }
1069
+ get submitted() {
1070
+ return this._submitted.value;
1071
+ }
1072
+ setFieldValue(e, r) {
1073
+ const n = this._fields[e] ?? K(`Trying to set undefined '${q(e)}' field`);
1074
+ this._data[e] = n.type === "string" && (n.trim ?? !0) ? q(r).trim() : r, this._submitted.value && this.validate();
1075
+ }
1076
+ getFieldValue(e) {
1077
+ return this._data[e];
1078
+ }
1079
+ getFieldRules(e) {
1080
+ var r, n;
1081
+ return ((n = (r = this._fields[e]) == null ? void 0 : r.rules) == null ? void 0 : n.split("|")) ?? [];
1082
+ }
1083
+ data() {
1084
+ return { ...this._data };
1085
+ }
1086
+ validate() {
1087
+ const e = Object.entries(this._fields).reduce(
1088
+ (r, [n, a]) => (r[n] = this.getFieldErrors(n, a), r),
1089
+ {}
1090
+ );
1091
+ return this.resetErrors(e), this.valid;
1092
+ }
1093
+ reset(e = {}) {
1094
+ this._submitted.value = !1, e.keepData || this.resetData(), e.keepErrors || this.resetErrors();
1095
+ }
1096
+ submit() {
1097
+ var r;
1098
+ this._submitted.value = !0;
1099
+ const e = this.validate();
1100
+ return e && ((r = this._listeners.submit) == null || r.forEach((n) => n())), e;
1101
+ }
1102
+ on(e, r) {
1103
+ var n, a;
1104
+ return (n = this._listeners)[e] ?? (n[e] = []), (a = this._listeners[e]) == null || a.push(r), () => this.off(e, r);
1105
+ }
1106
+ off(e, r) {
1107
+ xe(this._listeners[e] ?? [], r);
1108
+ }
1109
+ async focus(e) {
1110
+ var r;
1111
+ await qe(), (r = this._listeners.focus) == null || r.forEach((n) => n(e));
1112
+ }
1113
+ __get(e) {
1114
+ return e in this._fields ? this.getFieldValue(e) : super.__get(e);
1115
+ }
1116
+ __set(e, r) {
1117
+ if (!(e in this._fields)) {
1118
+ super.__set(e, r);
1119
+ return;
1120
+ }
1121
+ this.setFieldValue(e, r);
1122
+ }
1123
+ getFieldErrors(e, r) {
1124
+ var o;
1125
+ const n = [], a = this._data[e], i = ((o = r.rules) == null ? void 0 : o.split("|")) ?? [];
1126
+ for (const d of i)
1127
+ d !== "required" && a == null || n.push(...pr(a, d));
1128
+ return n.length > 0 ? n : null;
1129
+ }
1130
+ getInitialData(e) {
1131
+ if (this.static().isConjuring())
1132
+ return {};
1133
+ const r = Object.entries(e).reduce((n, [a, i]) => (n[a] = i.default ?? null, n), {});
1134
+ return de(r);
1135
+ }
1136
+ getInitialErrors(e) {
1137
+ if (this.static().isConjuring())
1138
+ return {};
1139
+ const r = Object.keys(e).reduce((n, a) => (n[a] = null, n), {});
1140
+ return de(r);
1141
+ }
1142
+ resetData() {
1143
+ for (const [e, r] of Object.entries(this._fields))
1144
+ this._data[e] = r.default ?? null;
1145
+ }
1146
+ resetErrors(e) {
1147
+ Object.keys(this._errors).forEach((r) => delete this._errors[r]), e && Object.assign(this._errors, e);
1148
+ }
1149
+ }
1150
+ function nt(t, s) {
1151
+ const e = se("form", null), r = e == null ? void 0 : e.on("focus", (n) => t.name === n && s());
1152
+ fe(() => r == null ? void 0 : r());
1153
+ }
1154
+ function at(t) {
1155
+ return new mr(t);
1156
+ }
1157
+ function lt() {
1158
+ const t = Fe(), s = u(() => t.class);
1159
+ return [u(() => Bt(t, "class")), s];
1160
+ }
1161
+ function Za(t) {
1162
+ let s = qt;
1163
+ Et(() => s = t()), fe(() => s());
1164
+ }
1165
+ function Xa(t, s) {
1166
+ const e = de(U.get(t) ?? s);
1167
+ return Ee(e, () => U.set(t, Ht(e))), e;
1168
+ }
1169
+ function Ga(t) {
1170
+ const s = B(), e = u(t);
1171
+ return Ee(e, async () => s.value = await e.value, { immediate: !0 }), s;
1172
+ }
1173
+ function Ya(t, s) {
1174
+ const e = s ? t : {}, r = s ?? t, n = B(e.initial ?? null), a = Ft((i) => n.value = i, e.delay ?? 300);
1175
+ return J(() => a(r())), n;
1176
+ }
1177
+ const ot = /* @__PURE__ */ g({
1178
+ __name: "HeadlessSelectValue",
1179
+ setup(t) {
1180
+ const s = V(
1181
+ "select",
1182
+ "<HeadlessSelectValue> must be a child of a <HeadlessSelect>"
1183
+ );
1184
+ return (e, r) => e.$slots.default ? (c(), h(l(Pe), {
1185
+ key: 0,
1186
+ placeholder: l(s).placeholder
1187
+ }, {
1188
+ default: f(() => [
1189
+ w(e.$slots, "default")
1190
+ ]),
1191
+ _: 3
1192
+ }, 8, ["placeholder"])) : (c(), h(l(Pe), {
1193
+ key: 1,
1194
+ placeholder: l(s).placeholder
1195
+ }, null, 8, ["placeholder"]));
1196
+ }
1197
+ }), it = /* @__PURE__ */ g({
1198
+ __name: "HeadlessSelectTrigger",
1199
+ setup(t) {
1200
+ const s = V(
1201
+ "select",
1202
+ "<HeadlessSelectTrigger> must be a child of a <HeadlessSelect>"
1203
+ );
1204
+ return (e, r) => (c(), h(l(ts), {
1205
+ id: l(s).id
1206
+ }, {
1207
+ default: f(() => [
1208
+ w(e.$slots, "default", {}, () => [
1209
+ p(ot, {
1210
+ placeholder: l(s).placeholder
1211
+ }, null, 8, ["placeholder"]),
1212
+ p(l(ss))
1213
+ ])
1214
+ ]),
1215
+ _: 3
1216
+ }, 8, ["id"]));
1217
+ }
1218
+ }), ct = /* @__PURE__ */ g({
1219
+ __name: "HeadlessSelectOption",
1220
+ props: {
1221
+ value: {},
1222
+ disabled: { type: Boolean },
1223
+ textValue: {},
1224
+ asChild: { type: Boolean },
1225
+ as: {}
1226
+ },
1227
+ setup(t) {
1228
+ const s = V(
1229
+ "select",
1230
+ "<HeadlessSelectOption> must be a child of a <HeadlessSelect>"
1231
+ ), e = u(() => {
1232
+ var n;
1233
+ const r = (n = s.options) == null ? void 0 : n.find((a) => a.value === t.value);
1234
+ return r ? r.label : q(t.value);
1235
+ });
1236
+ return (r, n) => (c(), h(l(rs), re(ne(r.$props)), {
1237
+ default: f(() => [
1238
+ p(l(ns), null, {
1239
+ default: f(() => [
1240
+ w(r.$slots, "default", {}, () => [
1241
+ A($(e.value), 1)
1242
+ ])
1243
+ ]),
1244
+ _: 3
1245
+ })
1246
+ ]),
1247
+ _: 3
1248
+ }, 16));
1249
+ }
1250
+ }), ut = /* @__PURE__ */ g({
1251
+ __name: "HeadlessSelectOptions",
1252
+ props: {
1253
+ class: {},
1254
+ innerClass: {}
1255
+ },
1256
+ setup(t) {
1257
+ const s = V(
1258
+ "select",
1259
+ "<HeadlessSelectOptions> must be a child of a <HeadlessSelect>"
1260
+ ), e = u(() => E("min-w-(--reka-select-trigger-width) max-h-(--reka-select-content-available-height)", t.class));
1261
+ return (r, n) => (c(), h(l(as), null, {
1262
+ default: f(() => [
1263
+ p(l(ls), {
1264
+ position: "popper",
1265
+ class: k(e.value),
1266
+ align: l(s).align,
1267
+ side: l(s).side,
1268
+ "side-offset": 4
1269
+ }, {
1270
+ default: f(() => [
1271
+ p(l(os), {
1272
+ class: k(r.innerClass)
1273
+ }, {
1274
+ default: f(() => [
1275
+ w(r.$slots, "default", {}, () => [
1276
+ (c(!0), b(j, null, F(l(s).options ?? [], (a) => (c(), h(ct, {
1277
+ key: a.key,
1278
+ value: a.value
1279
+ }, null, 8, ["value"]))), 128))
1280
+ ])
1281
+ ]),
1282
+ _: 3
1283
+ }, 8, ["class"])
1284
+ ]),
1285
+ _: 3
1286
+ }, 8, ["class", "align", "side"])
1287
+ ]),
1288
+ _: 3
1289
+ }));
1290
+ }
1291
+ }), fr = /* @__PURE__ */ g({
1292
+ inheritAttrs: !1,
1293
+ __name: "HeadlessSelect",
1294
+ props: {
1295
+ as: { default: "div" },
1296
+ options: {},
1297
+ placeholder: {},
1298
+ renderOption: { type: Function },
1299
+ compareOptions: { type: Function, default: (t, s) => t === s },
1300
+ labelClass: {},
1301
+ optionsClass: {},
1302
+ align: {},
1303
+ side: {},
1304
+ name: {},
1305
+ label: {},
1306
+ description: {},
1307
+ modelValue: {}
1308
+ },
1309
+ emits: ["update:modelValue"],
1310
+ setup(t, { expose: s, emit: e }) {
1311
+ const r = e, n = se("form", null), a = u(() => n && t.name ? n.getFieldValue(t.name) : t.modelValue), i = u(() => a.value), o = u(() => !n || !t.name ? null : n.errors[t.name] ?? null), d = u(() => t.options ? t.options.map((m) => ({
1312
+ key: te(),
1313
+ label: t.renderOption ? t.renderOption(m) : ur(m) ? Ut(m.label) : q(m),
1314
+ value: m
1315
+ })) : null), v = {
1316
+ labelClass: t.labelClass,
1317
+ optionsClass: t.optionsClass,
1318
+ align: t.align,
1319
+ side: t.side,
1320
+ value: a,
1321
+ id: `select-${te()}`,
1322
+ name: u(() => t.name),
1323
+ label: u(() => t.label),
1324
+ description: u(() => t.description),
1325
+ placeholder: u(() => t.placeholder ?? S("ui.select", "Select an option")),
1326
+ options: d,
1327
+ selectedOption: u(() => {
1328
+ var m;
1329
+ return (m = d.value) == null ? void 0 : m.find((x) => x.value === t.modelValue);
1330
+ }),
1331
+ errors: me(o),
1332
+ required: u(() => {
1333
+ if (!(!t.name || !n))
1334
+ return n.getFieldRules(t.name).includes("required");
1335
+ }),
1336
+ update(m) {
1337
+ if (n && t.name) {
1338
+ n.setFieldValue(t.name, m);
1339
+ return;
1340
+ }
1341
+ r("update:modelValue", m);
1342
+ }
1343
+ };
1344
+ function C(m) {
1345
+ v.update(m);
1346
+ }
1347
+ return ae("select", v), s(v), (m, x) => (c(), h(l(is), {
1348
+ "model-value": i.value,
1349
+ by: m.compareOptions,
1350
+ "onUpdate:modelValue": x[0] || (x[0] = (L) => C(L))
1351
+ }, {
1352
+ default: f(({ open: L }) => [
1353
+ (c(), h(N(m.as), re(ne(m.$attrs)), {
1354
+ default: f(() => [
1355
+ w(m.$slots, "default", {
1356
+ modelValue: m.modelValue,
1357
+ open: L
1358
+ }, () => [
1359
+ p(it),
1360
+ p(ut)
1361
+ ])
1362
+ ]),
1363
+ _: 2
1364
+ }, 1040))
1365
+ ]),
1366
+ _: 3
1367
+ }, 8, ["model-value", "by"]));
1368
+ }
1369
+ }), De = /* @__PURE__ */ g({
1370
+ __name: "HeadlessSelectLabel",
1371
+ props: {
1372
+ asChild: { type: Boolean },
1373
+ as: {}
1374
+ },
1375
+ setup(t) {
1376
+ const s = V(
1377
+ "select",
1378
+ "<HeadlessSelectLabel> must be a child of a <HeadlessSelect>"
1379
+ ), e = He(), r = u(() => !!(s.label || e.default));
1380
+ return (n, a) => r.value ? (c(), h(l(cs), H({
1381
+ key: 0,
1382
+ for: l(s).id
1383
+ }, n.$props), {
1384
+ default: f(() => [
1385
+ w(n.$slots, "default", {}, () => [
1386
+ A($(l(s).label), 1)
1387
+ ])
1388
+ ]),
1389
+ _: 3
1390
+ }, 16, ["for"])) : M("", !0);
1391
+ }
1392
+ }), dt = /* @__PURE__ */ g({
1393
+ __name: "SelectLabel",
1394
+ props: {
1395
+ class: {}
1396
+ },
1397
+ setup(t) {
1398
+ const s = V("select", "<SelectLabel> must be a child of a <Select>"), e = u(() => E("block text-sm leading-6 font-medium text-gray-900", s.labelClass, t.class));
1399
+ return (r, n) => r.$slots.default ? (c(), h(De, {
1400
+ key: 0,
1401
+ class: k(e.value)
1402
+ }, {
1403
+ default: f(() => [
1404
+ w(r.$slots, "default")
1405
+ ]),
1406
+ _: 3
1407
+ }, 8, ["class"])) : (c(), h(De, {
1408
+ key: 1,
1409
+ class: k(e.value)
1410
+ }, null, 8, ["class"]));
1411
+ }
1412
+ }), je = /* @__PURE__ */ g({
1413
+ __name: "SelectOption",
1414
+ props: {
1415
+ value: {},
1416
+ class: {},
1417
+ innerClass: {}
1418
+ },
1419
+ setup(t) {
1420
+ const s = u(() => E("group p-1 outline-none", t.class)), e = u(() => E(
1421
+ // eslint-disable-next-line vue/max-len
1422
+ "relative flex max-w-[calc(100vw-2rem)] cursor-pointer items-center truncate rounded-md gap-2 px-2 py-1 text-sm select-none *:truncate group-data-[highlighted]:bg-gray-100 group-data-[state=checked]:font-semibold group-data-[state=unchecked]:opacity-50",
1423
+ t.innerClass
1424
+ ));
1425
+ return (r, n) => (c(), h(ct, {
1426
+ class: k(s.value),
1427
+ value: r.value
1428
+ }, {
1429
+ default: f(() => [
1430
+ y("div", {
1431
+ class: k(e.value)
1432
+ }, [
1433
+ w(r.$slots, "default")
1434
+ ], 2)
1435
+ ]),
1436
+ _: 3
1437
+ }, 8, ["class", "value"]));
1438
+ }
1439
+ }), pt = /* @__PURE__ */ g({
1440
+ __name: "SelectOptions",
1441
+ props: {
1442
+ class: {}
1443
+ },
1444
+ setup(t) {
1445
+ const s = V("select", "<SelectOptions> must be a child of a <Select>"), e = u(() => E(
1446
+ "z-50 overflow-auto rounded-lg bg-white text-base shadow-lg ring-1 ring-black/5 focus:outline-hidden",
1447
+ s.optionsClass,
1448
+ t.class
1449
+ ));
1450
+ return (r, n) => (c(), h(ut, {
1451
+ class: k(e.value)
1452
+ }, {
1453
+ default: f(() => {
1454
+ var a;
1455
+ return [
1456
+ (a = l(s).options) != null && a.length ? w(r.$slots, "default", { key: 0 }, () => {
1457
+ var i;
1458
+ return [
1459
+ (c(!0), b(j, null, F(((i = l(s)) == null ? void 0 : i.options) ?? [], (o) => (c(), h(je, {
1460
+ key: o.key,
1461
+ value: o.value
1462
+ }, {
1463
+ default: f(() => [
1464
+ A($(o.label), 1)
1465
+ ]),
1466
+ _: 2
1467
+ }, 1032, ["value"]))), 128))
1468
+ ];
1469
+ }) : w(r.$slots, "default", { key: 1 }, () => [
1470
+ p(je, {
1471
+ disabled: "",
1472
+ value: null
1473
+ }, {
1474
+ default: f(() => [
1475
+ A($(r.$td("ui.selectEmpty", "No options available")), 1)
1476
+ ]),
1477
+ _: 1
1478
+ })
1479
+ ])
1480
+ ];
1481
+ }),
1482
+ _: 3
1483
+ }, 8, ["class"]));
1484
+ }
1485
+ }), hr = {
1486
+ viewBox: "0 0 20 20",
1487
+ width: "1.2em",
1488
+ height: "1.2em"
1489
+ };
1490
+ function gr(t, s) {
1491
+ return c(), b("svg", hr, s[0] || (s[0] = [
1492
+ y("path", {
1493
+ fill: "currentColor",
1494
+ d: "m9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828L5.757 6.586L4.343 8z"
1495
+ }, null, -1)
1496
+ ]));
1497
+ }
1498
+ const vr = P({ name: "zondicons-cheveron-down", render: gr }), mt = /* @__PURE__ */ g({
1499
+ __name: "SelectTrigger",
1500
+ props: {
1501
+ class: {}
1502
+ },
1503
+ setup(t) {
1504
+ const s = V("select", "<SelectTrigger> must be a child of a <Select>"), e = u(() => E(
1505
+ // eslint-disable-next-line vue/max-len
1506
+ "focus:outline-primary-600 data-[state=open]:outline-primary-600 grid w-full cursor-default grid-cols-1 rounded-md bg-white py-1.5 pr-2 pl-3 text-left text-gray-900 outline-1 -outline-offset-1 outline-gray-300 focus:outline-2 focus:-outline-offset-2 sm:text-sm/6",
1507
+ { "mt-1": s.label },
1508
+ t.class
1509
+ ));
1510
+ return (r, n) => (c(), h(it, {
1511
+ class: k(e.value)
1512
+ }, {
1513
+ default: f(() => [
1514
+ p(ot, { class: "col-start-1 row-start-1 truncate pr-6" }),
1515
+ p(l(vr), { class: "col-start-1 row-start-1 size-5 self-center justify-self-end text-gray-500 sm:size-4" })
1516
+ ]),
1517
+ _: 1
1518
+ }, 8, ["class"]));
1519
+ }
1520
+ }), br = /* @__PURE__ */ g({
1521
+ __name: "Select",
1522
+ props: {
1523
+ as: {},
1524
+ options: {},
1525
+ placeholder: {},
1526
+ renderOption: { type: Function },
1527
+ compareOptions: { type: Function },
1528
+ labelClass: {},
1529
+ optionsClass: {},
1530
+ align: {},
1531
+ side: {},
1532
+ name: {},
1533
+ label: {},
1534
+ description: {},
1535
+ modelValue: {}
1536
+ },
1537
+ emits: ["update:modelValue"],
1538
+ setup(t) {
1539
+ const { forwardRef: s } = Le();
1540
+ return (e, r) => (c(), h(fr, H({ ref: l(s) }, e.$props, {
1541
+ "onUpdate:modelValue": r[0] || (r[0] = (n) => e.$emit("update:modelValue", n))
1542
+ }), {
1543
+ default: f(() => [
1544
+ p(dt),
1545
+ w(e.$slots, "default", {}, () => [
1546
+ p(mt),
1547
+ p(pt)
1548
+ ])
1549
+ ]),
1550
+ _: 3
1551
+ }, 16));
1552
+ }
1553
+ }), yr = { class: "grow" }, wr = /* @__PURE__ */ g({
1554
+ __name: "Language",
1555
+ setup(t) {
1556
+ const s = Q.getBrowserLocale(), e = u(() => [null, ...Q.locales]);
1557
+ function r(n) {
1558
+ return (n && O.locales[n]) ?? S("settings.localeDefault", "{locale} (default)", {
1559
+ locale: O.locales[s] ?? s
1560
+ });
1561
+ }
1562
+ return (n, a) => (c(), h(br, {
1563
+ modelValue: n.$lang.locale,
1564
+ "onUpdate:modelValue": a[0] || (a[0] = (i) => n.$lang.locale = i),
1565
+ class: "flex flex-col items-start md:flex-row",
1566
+ as: "div",
1567
+ options: e.value,
1568
+ "render-option": r
1569
+ }, {
1570
+ default: f(() => [
1571
+ y("div", yr, [
1572
+ p(dt, { class: "text-base font-semibold" }, {
1573
+ default: f(() => [
1574
+ A($(n.$td("settings.locale", "Language")), 1)
1575
+ ]),
1576
+ _: 1
1577
+ }),
1578
+ p(T, {
1579
+ "lang-key": "settings.localeDescription",
1580
+ "lang-default": "Choose the application's language.",
1581
+ class: "mt-1 text-sm text-gray-500"
1582
+ })
1583
+ ]),
1584
+ p(z, {
1585
+ variant: "ghost",
1586
+ as: mt,
1587
+ class: "grid w-auto outline-none"
1588
+ }),
1589
+ p(pt)
1590
+ ]),
1591
+ _: 1
1592
+ }, 8, ["modelValue", "options"]));
1593
+ }
1594
+ }), _r = [
1595
+ {
1596
+ priority: 100,
1597
+ component: wr
1598
+ }
1599
+ ], $r = { $lang: Q }, xr = {
1600
+ async install(t) {
1601
+ var s;
1602
+ (s = t.config.globalProperties).$t ?? (s.$t = Ye), t.config.globalProperties.$td = S, _r.forEach((e) => D.addSetting(e)), await be(t, $r);
1603
+ }
1604
+ }, Cr = /* @__PURE__ */ g({
1605
+ __name: "Markdown",
1606
+ props: {
1607
+ as: {},
1608
+ inline: { type: Boolean },
1609
+ langKey: {},
1610
+ langParams: {},
1611
+ langDefault: {},
1612
+ text: {},
1613
+ actions: {}
1614
+ },
1615
+ setup(t) {
1616
+ const s = Fe(), e = He(), r = u(() => e.default ? e.default().map(Ze).join("") : t.text ?? (t.langKey && (t.langDefault ? S(t.langKey, t.langDefault, t.langParams ?? {}) : Ye(t.langKey, t.langParams ?? {})))), n = u(() => {
1617
+ if (!r.value)
1618
+ return null;
1619
+ let o = ir(r.value);
1620
+ return t.inline && (o = o.replace("<p>", "<span>").replace("</p>", "</span>")), o;
1621
+ }), a = () => Vt(t.as ?? (t.inline ? "span" : "div"), {
1622
+ innerHTML: n.value,
1623
+ onClick: i,
1624
+ ...s,
1625
+ class: `${s.class ?? ""} ${t.inline ? "" : "prose"}`
1626
+ });
1627
+ async function i(o) {
1628
+ var v, C;
1629
+ const { target: d } = o;
1630
+ if (Re(d, HTMLElement) && d.dataset.markdownAction) {
1631
+ (C = (v = t.actions) == null ? void 0 : v[d.dataset.markdownAction]) == null || C.call(v);
1632
+ return;
1633
+ }
1634
+ if (Re(d, HTMLAnchorElement) && d.dataset.markdownRoute) {
1635
+ const m = or();
1636
+ m && (o.preventDefault(), m.visit(d.dataset.markdownRoute));
1637
+ return;
1638
+ }
1639
+ }
1640
+ return (o, d) => (c(), h(a));
1641
+ }
1642
+ }), kr = (t, s) => {
1643
+ const e = t.__vccOpts || t;
1644
+ for (const [r, n] of s)
1645
+ e[r] = n;
1646
+ return e;
1647
+ }, T = /* @__PURE__ */ kr(Cr, [["__scopeId", "data-v-8b211cfb"]]), Sr = { class: "mt-4 flex flex-row" }, Mr = { class: "flex-grow" }, Er = {
1648
+ id: "debug-setting",
1649
+ class: "text-base font-semibold"
1650
+ }, Hr = /* @__PURE__ */ g({
1651
+ __name: "Debug",
1652
+ setup(t) {
1653
+ let s = null;
1654
+ const e = B(!1);
1655
+ return J(async () => {
1656
+ if (!e.value) {
1657
+ s == null || s.destroy();
1658
+ return;
1659
+ }
1660
+ s ?? (s = (await import("eruda")).default), s.init();
1661
+ }), (r, n) => (c(), b("div", Sr, [
1662
+ y("div", Mr, [
1663
+ y("h3", Er, $(r.$td("settings.debug", "Debugging")), 1),
1664
+ p(T, {
1665
+ "lang-key": "settings.debugDescription",
1666
+ "lang-default": "Enable debugging with [Eruda](https://eruda.liriliri.io/).",
1667
+ class: "mt-1 text-sm text-gray-500"
1668
+ })
1669
+ ]),
1670
+ p(rr, {
1671
+ modelValue: e.value,
1672
+ "onUpdate:modelValue": n[0] || (n[0] = (a) => e.value = a),
1673
+ "aria-labelledby": "debug-setting"
1674
+ }, null, 8, ["modelValue"])
1675
+ ]));
1676
+ }
1677
+ }), Vr = [
1678
+ {
1679
+ priority: 10,
1680
+ component: Hr
1681
+ }
1682
+ ], ft = [];
1683
+ function el(t) {
1684
+ ft.push(t);
1685
+ }
1686
+ function ht(t) {
1687
+ for (const s of ft) {
1688
+ const e = s(t);
1689
+ if (e)
1690
+ return e;
1691
+ }
1692
+ return typeof t == "string" ? t : t instanceof Error || t instanceof he ? t.message : ce(t) ? q(t.message ?? t.description ?? "Unknown error object") : S("errors.unknown", "Unknown Error");
1693
+ }
1694
+ class Be extends he {
1695
+ }
1696
+ const Lr = { $errors: et }, Ir = (t) => (et.report(t), !0);
1697
+ function Tr(t, s = () => !1) {
1698
+ const e = (r) => s(r) || Ir(r);
1699
+ t.config.errorHandler = e, globalThis.onerror = (r, n, a, i, o) => e(o ?? r), globalThis.onunhandledrejection = (r) => e(r.reason);
1700
+ }
1701
+ const Rr = {
1702
+ async install(t, s) {
1703
+ Tr(t, s.handleError), Vr.forEach((e) => D.addSetting(e)), await be(t, Lr);
1704
+ }
1705
+ }, Pr = {
1706
+ async install() {
1707
+ Ve() && (globalThis.testingRuntime = {
1708
+ on: (...t) => I.on(...t)
1709
+ });
1710
+ }
1711
+ }, Ar = {
1712
+ viewBox: "0 0 20 20",
1713
+ width: "1.2em",
1714
+ height: "1.2em"
1715
+ };
1716
+ function zr(t, s) {
1717
+ return c(), b("svg", Ar, s[0] || (s[0] = [
1718
+ y("path", {
1719
+ fill: "currentColor",
1720
+ d: "M10 8.586L2.929 1.515L1.515 2.929L8.586 10l-7.071 7.071l1.414 1.414L10 11.414l7.071 7.071l1.414-1.414L11.414 10l7.071-7.071l-1.414-1.414z"
1721
+ }, null, -1)
1722
+ ]));
1723
+ }
1724
+ const Dr = P({ name: "zondicons-close", render: zr }), jr = /* @__PURE__ */ g({
1725
+ __name: "HeadlessModal",
1726
+ props: {
1727
+ persistent: { type: Boolean },
1728
+ title: {},
1729
+ titleHidden: { type: Boolean },
1730
+ description: {},
1731
+ descriptionHidden: { type: Boolean }
1732
+ },
1733
+ setup(t, { expose: s }) {
1734
+ const e = B(null), { modal: r } = V(
1735
+ "modal",
1736
+ "could not obtain modal reference from <HeadlessModal>, did you render this component manually? Show it using $ui.modal() instead"
1737
+ );
1738
+ s({ close: i, $content: e });
1739
+ const { forwardRef: n } = Le(), a = B(!1);
1740
+ ae("$modalContentRef", e), rt("close-modal", async ({ id: o, result: d }) => {
1741
+ o === r.id && await i(d);
1742
+ });
1743
+ async function i(o) {
1744
+ a.value || (await I.emit("modal-will-close", { modal: r, result: o }), a.value = !0, await I.emit("modal-has-closed", { modal: r, result: o }));
1745
+ }
1746
+ return (o, d) => (c(), h(l(us), {
1747
+ ref: l(n),
1748
+ open: "",
1749
+ "onUpdate:open": d[0] || (d[0] = (v) => o.persistent || i())
1750
+ }, {
1751
+ default: f(() => [
1752
+ p(l(ds), null, {
1753
+ default: f(() => [
1754
+ w(o.$slots, "default", { close: i })
1755
+ ]),
1756
+ _: 3
1757
+ })
1758
+ ]),
1759
+ _: 3
1760
+ }, 512));
1761
+ }
1762
+ }), gt = /* @__PURE__ */ g({
1763
+ __name: "ModalContext",
1764
+ props: {
1765
+ modal: {},
1766
+ childIndex: {}
1767
+ },
1768
+ setup(t) {
1769
+ const s = t, e = u(() => {
1770
+ const r = {};
1771
+ for (const n in s.modal.properties)
1772
+ r[n] = l(s.modal.properties[n]);
1773
+ return r;
1774
+ });
1775
+ return ae("modal", {
1776
+ modal: Te(s, "modal"),
1777
+ childIndex: Te(s, "childIndex")
1778
+ }), (r, n) => (c(), h(N(r.modal.component), re(ne(e.value)), null, 16));
1779
+ }
1780
+ }), Br = /* @__PURE__ */ g({
1781
+ __name: "HeadlessModalContent",
1782
+ setup(t) {
1783
+ const { childIndex: s = 0 } = V(
1784
+ "modal",
1785
+ "could not obtain modal reference from <HeadlessModalContent>, did you render this component manually? Show it using $ui.modal() instead"
1786
+ ), e = js("$modalContentRef"), r = le("$contentRef"), n = u(() => R.modals[s] ?? null);
1787
+ return J(() => e.value = r.value), (a, i) => (c(), h(l(ps), { ref: "$contentRef" }, {
1788
+ default: f(() => [
1789
+ w(a.$slots, "default"),
1790
+ n.value ? (c(), h(gt, {
1791
+ key: 0,
1792
+ "child-index": l(s) + 1,
1793
+ modal: n.value
1794
+ }, null, 8, ["child-index", "modal"])) : M("", !0)
1795
+ ]),
1796
+ _: 3
1797
+ }, 512));
1798
+ }
1799
+ }), qr = /* @__PURE__ */ g({
1800
+ __name: "HeadlessModalDescription",
1801
+ props: {
1802
+ asChild: { type: Boolean },
1803
+ as: {}
1804
+ },
1805
+ setup(t) {
1806
+ return (s, e) => (c(), h(l(ms), re(ne(s.$props)), {
1807
+ default: f(() => [
1808
+ w(s.$slots, "default")
1809
+ ]),
1810
+ _: 3
1811
+ }, 16));
1812
+ }
1813
+ }), Fr = /* @__PURE__ */ g({
1814
+ __name: "HeadlessModalOverlay",
1815
+ props: {
1816
+ forceMount: { type: Boolean },
1817
+ asChild: { type: Boolean },
1818
+ as: {}
1819
+ },
1820
+ setup(t) {
1821
+ return (s, e) => (c(), h(l(fs), re(ne(s.$props)), {
1822
+ default: f(() => [
1823
+ w(s.$slots, "default")
1824
+ ]),
1825
+ _: 3
1826
+ }, 16));
1827
+ }
1828
+ }), Ur = /* @__PURE__ */ g({
1829
+ __name: "HeadlessModalTitle",
1830
+ props: {
1831
+ asChild: { type: Boolean },
1832
+ as: {}
1833
+ },
1834
+ setup(t) {
1835
+ return (s, e) => (c(), h(l(hs), re(ne(s.$props)), {
1836
+ default: f(() => [
1837
+ w(s.$slots, "default")
1838
+ ]),
1839
+ _: 3
1840
+ }, 16));
1841
+ }
1842
+ }), Or = {
1843
+ key: 0,
1844
+ class: "absolute top-0 right-0 hidden pt-3.5 pr-2.5 sm:block"
1845
+ }, Nr = ["onClick"], Wr = { class: "sr-only" }, Y = /* @__PURE__ */ g({
1846
+ __name: "Modal",
1847
+ props: {
1848
+ persistent: { type: Boolean },
1849
+ title: {},
1850
+ titleHidden: { type: Boolean },
1851
+ description: {},
1852
+ descriptionHidden: { type: Boolean },
1853
+ wrapperClass: { default: "" },
1854
+ class: { default: "" },
1855
+ closeHidden: { type: Boolean }
1856
+ },
1857
+ setup(t, { expose: s }) {
1858
+ const e = Z(t, ["class", "wrapperClass", "title", "titleHidden", "description", "persistent", "closeHidden"]);
1859
+ s({
1860
+ close: async (m) => {
1861
+ var x;
1862
+ return (x = a.value) == null ? void 0 : x.close(m);
1863
+ },
1864
+ $content: u(() => {
1865
+ var m;
1866
+ return (m = a.value) == null ? void 0 : m.$content;
1867
+ })
1868
+ });
1869
+ const { forwardRef: r, currentRef: n } = Le(), a = n, i = V("modal"), o = u(() => !i.modal.closing && i.childIndex === R.openModals.length), d = u(() => t.description ? {} : { "aria-describedby": void 0 }), v = u(() => E("max-h-[90vh] overflow-auto px-4 pb-4", { "pt-4": !t.title || t.titleHidden }, t.class)), C = u(() => E(
1870
+ "isolate fixed top-1/2 left-1/2 z-50 w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2",
1871
+ "overflow-hidden rounded-lg bg-white text-left shadow-xl sm:max-w-lg",
1872
+ "animate-[fade-in_var(--tw-duration)_ease-in-out,grow_var(--tw-duration)_ease-in-out]",
1873
+ "transition-[scale,opacity] will-change-[scale,opacity] duration-300",
1874
+ {
1875
+ "scale-50 opacity-0": !o.value,
1876
+ "scale-100 opacity-100": o.value
1877
+ },
1878
+ t.wrapperClass
1879
+ ));
1880
+ return rt("modal-will-close", async ({ modal: { id: m } }) => {
1881
+ m === i.modal.id && await Ce({ ms: 300 });
1882
+ }), (m, x) => (c(), h(jr, H(e, {
1883
+ ref: (L) => l(r)(L),
1884
+ persistent: m.persistent
1885
+ }), {
1886
+ default: f(({ close: L }) => [
1887
+ p(Fr, {
1888
+ class: k(["fixed inset-0 animate-[fade-in_var(--tw-duration)_ease-in-out] transition-opacity duration-300 will-change-[opacity]", {
1889
+ "bg-black/30": l(i).childIndex === 1,
1890
+ "opacity-0": l(i).childIndex === 1 && l(i).modal.closing
1891
+ }])
1892
+ }, null, 8, ["class"]),
1893
+ p(Br, H(d.value, { class: C.value }), {
1894
+ default: f(() => [
1895
+ !m.persistent && !m.closeHidden ? (c(), b("div", Or, [
1896
+ y("button", {
1897
+ type: "button",
1898
+ class: "clickable z-10 rounded-full p-2.5 text-gray-400 hover:text-gray-500",
1899
+ onClick: (ye) => L()
1900
+ }, [
1901
+ y("span", Wr, $(m.$td("ui.close", "Close")), 1),
1902
+ p(l(Dr), { class: "size-4" })
1903
+ ], 8, Nr)
1904
+ ])) : M("", !0),
1905
+ m.title ? (c(), h(Ur, {
1906
+ key: 1,
1907
+ class: k(["px-4 pt-5 text-base font-semibold text-gray-900", {
1908
+ "sr-only": m.titleHidden,
1909
+ "pb-0": m.description && !m.descriptionHidden,
1910
+ "pb-2": !m.description || m.descriptionHidden
1911
+ }])
1912
+ }, {
1913
+ default: f(() => [
1914
+ p(T, {
1915
+ text: m.title,
1916
+ inline: ""
1917
+ }, null, 8, ["text"])
1918
+ ]),
1919
+ _: 1
1920
+ }, 8, ["class"])) : M("", !0),
1921
+ m.description ? (c(), h(qr, {
1922
+ key: 2,
1923
+ class: k(["px-4 pt-1 pb-2", { "sr-only": m.descriptionHidden }])
1924
+ }, {
1925
+ default: f(() => [
1926
+ p(T, {
1927
+ text: m.description,
1928
+ class: "text-sm leading-6 text-gray-500"
1929
+ }, null, 8, ["text"])
1930
+ ]),
1931
+ _: 1
1932
+ }, 8, ["class"])) : M("", !0),
1933
+ y("div", {
1934
+ class: k(v.value)
1935
+ }, [
1936
+ w(m.$slots, "default", { close: L })
1937
+ ], 2)
1938
+ ]),
1939
+ _: 2
1940
+ }, 1040, ["class"])
1941
+ ]),
1942
+ _: 3
1943
+ }, 16, ["persistent"]));
1944
+ }
1945
+ });
1946
+ function Kr(t) {
1947
+ const s = u(() => t.title ?? S("ui.alert", "Alert")), e = u(() => !t.title);
1948
+ return { renderedTitle: s, titleHidden: e };
1949
+ }
1950
+ const Qr = /* @__PURE__ */ g({
1951
+ __name: "AlertModal",
1952
+ props: {
1953
+ title: {},
1954
+ message: {}
1955
+ },
1956
+ setup(t, { expose: s }) {
1957
+ const e = t, { renderedTitle: r, titleHidden: n } = Kr(e);
1958
+ return s(), (a, i) => (c(), h(Y, {
1959
+ title: l(r),
1960
+ "title-hidden": l(n)
1961
+ }, {
1962
+ default: f(() => [
1963
+ p(T, { text: a.message }, null, 8, ["text"])
1964
+ ]),
1965
+ _: 1
1966
+ }, 8, ["title", "title-hidden"]));
1967
+ }
1968
+ }), vt = /* @__PURE__ */ g({
1969
+ __name: "Form",
1970
+ props: {
1971
+ form: {}
1972
+ },
1973
+ emits: ["submit"],
1974
+ setup(t, { emit: s }) {
1975
+ let e;
1976
+ const r = s;
1977
+ return J((n) => {
1978
+ var a;
1979
+ e == null || e(), e = (a = t.form) == null ? void 0 : a.on("submit", () => r("submit")), n(() => e == null ? void 0 : e());
1980
+ }), ae("form", t.form), (n, a) => (c(), b("form", {
1981
+ onSubmit: a[0] || (a[0] = Ue((i) => {
1982
+ var o;
1983
+ return (o = n.form) == null ? void 0 : o.submit();
1984
+ }, ["prevent"]))
1985
+ }, [
1986
+ w(n.$slots, "default")
1987
+ ], 32));
1988
+ }
1989
+ });
1990
+ function Jr(t) {
1991
+ const s = at(
1992
+ Object.entries(t.checkboxes ?? {}).reduce(
1993
+ (i, [o, d]) => ({
1994
+ [o]: {
1995
+ type: "boolean",
1996
+ default: d.default,
1997
+ required: d.required ? "required" : void 0
1998
+ },
1999
+ ...i
2000
+ }),
2001
+ {}
2002
+ )
2003
+ ), e = u(() => t.title ?? S("ui.confirm", "Confirm")), r = u(() => !t.title), n = u(() => t.acceptText ?? S("ui.accept", "Ok")), a = u(() => t.cancelText ?? S("ui.cancel", "Cancel"));
2004
+ return { form: s, renderedTitle: e, titleHidden: r, renderedAcceptText: n, renderedCancelText: a };
2005
+ }
2006
+ const Zr = {
2007
+ key: 0,
2008
+ class: "mt-4 flex flex-col text-sm text-gray-600"
2009
+ }, Xr = { class: "flex items-center" }, Gr = ["onUpdate:modelValue", "required"], Yr = { class: "ml-1.5" }, en = { class: "mt-4 flex flex-row-reverse gap-2" }, tn = /* @__PURE__ */ g({
2010
+ __name: "ConfirmModal",
2011
+ props: {
2012
+ title: {},
2013
+ message: {},
2014
+ acceptText: {},
2015
+ acceptVariant: {},
2016
+ cancelText: {},
2017
+ cancelVariant: { default: "secondary" },
2018
+ checkboxes: {},
2019
+ actions: {},
2020
+ required: { type: Boolean }
2021
+ },
2022
+ setup(t, { expose: s }) {
2023
+ const e = Z(t, ["cancelVariant"]), { form: r, renderedTitle: n, titleHidden: a, renderedAcceptText: i, renderedCancelText: o } = Jr(e);
2024
+ return s(), (d, v) => (c(), h(Y, {
2025
+ title: l(n),
2026
+ "title-hidden": l(a),
2027
+ persistent: ""
2028
+ }, {
2029
+ default: f(({ close: C }) => [
2030
+ p(vt, {
2031
+ form: l(r),
2032
+ onSubmit: (m) => C([!0, l(r).data()])
2033
+ }, {
2034
+ default: f(() => [
2035
+ p(T, {
2036
+ text: d.message,
2037
+ actions: d.actions
2038
+ }, null, 8, ["text", "actions"]),
2039
+ d.checkboxes ? (c(), b("ul", Zr, [
2040
+ (c(!0), b(j, null, F(d.checkboxes, (m, x) => (c(), b("li", { key: x }, [
2041
+ y("label", Xr, [
2042
+ Oe(y("input", {
2043
+ "onUpdate:modelValue": (L) => l(r)[x] = L,
2044
+ type: "checkbox",
2045
+ required: m.required,
2046
+ class: "border-primary-600 text-primary-600 hover:bg-primary-50 hover:checked:bg-primary-500 focus:ring-primary-600 focus-visible:ring-primary-600 rounded border-2"
2047
+ }, null, 8, Gr), [
2048
+ [Lt, l(r)[x]]
2049
+ ]),
2050
+ y("span", Yr, $(m.label), 1)
2051
+ ])
2052
+ ]))), 128))
2053
+ ])) : M("", !0),
2054
+ y("div", en, [
2055
+ p(z, {
2056
+ variant: d.acceptVariant,
2057
+ submit: ""
2058
+ }, {
2059
+ default: f(() => [
2060
+ A($(l(i)), 1)
2061
+ ]),
2062
+ _: 1
2063
+ }, 8, ["variant"]),
2064
+ d.required ? M("", !0) : (c(), h(z, {
2065
+ key: 0,
2066
+ variant: d.cancelVariant,
2067
+ onClick: (m) => C(!1)
2068
+ }, {
2069
+ default: f(() => [
2070
+ A($(l(o)), 1)
2071
+ ]),
2072
+ _: 2
2073
+ }, 1032, ["variant", "onClick"]))
2074
+ ])
2075
+ ]),
2076
+ _: 2
2077
+ }, 1032, ["form", "onSubmit"])
2078
+ ]),
2079
+ _: 1
2080
+ }, 8, ["title", "title-hidden"]));
2081
+ }
2082
+ }), sn = {
2083
+ viewBox: "0 0 20 20",
2084
+ width: "1.2em",
2085
+ height: "1.2em"
2086
+ };
2087
+ function rn(t, s) {
2088
+ return c(), b("svg", sn, s[0] || (s[0] = [
2089
+ y("path", {
2090
+ fill: "currentColor",
2091
+ d: "M7.05 9.293L6.343 10L12 15.657l1.414-1.414L9.172 10l4.242-4.243L12 4.343z"
2092
+ }, null, -1)
2093
+ ]));
2094
+ }
2095
+ const nn = P({ name: "zondicons-cheveron-left", render: rn }), an = {
2096
+ viewBox: "0 0 20 20",
2097
+ width: "1.2em",
2098
+ height: "1.2em"
2099
+ };
2100
+ function ln(t, s) {
2101
+ return c(), b("svg", an, s[0] || (s[0] = [
2102
+ y("path", {
2103
+ fill: "currentColor",
2104
+ d: "m12.95 10.707l.707-.707L8 4.343L6.586 5.757L10.828 10l-4.242 4.243L8 15.657z"
2105
+ }, null, -1)
2106
+ ]));
2107
+ }
2108
+ const bt = P({ name: "zondicons-cheveron-right", render: ln }), on = {
2109
+ viewBox: "0 0 20 20",
2110
+ width: "1.2em",
2111
+ height: "1.2em"
2112
+ };
2113
+ function cn(t, s) {
2114
+ return c(), b("svg", on, s[0] || (s[0] = [
2115
+ y("path", {
2116
+ fill: "currentColor",
2117
+ d: "M2.93 17.07A10 10 0 1 1 17.07 2.93A10 10 0 0 1 2.93 17.07M9 5v6h2V5zm0 8v2h2v-2z"
2118
+ }, null, -1)
2119
+ ]));
2120
+ }
2121
+ const yt = P({ name: "zondicons-exclamation-solid", render: cn }), un = {
2122
+ viewBox: "0 0 24 24",
2123
+ width: "1.2em",
2124
+ height: "1.2em"
2125
+ };
2126
+ function dn(t, s) {
2127
+ return c(), b("svg", un, s[0] || (s[0] = [
2128
+ y("path", {
2129
+ fill: "currentColor",
2130
+ d: "M20 19V7H4v12zm0-16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2zm-7 14v-2h5v2zm-3.42-4L5.57 9H8.4l3.3 3.3c.39.39.39 1.03 0 1.42L8.42 17H5.59z"
2131
+ }, null, -1)
2132
+ ]));
2133
+ }
2134
+ const pn = P({ name: "mdi-console", render: dn }), mn = {
2135
+ viewBox: "0 0 20 20",
2136
+ width: "1.2em",
2137
+ height: "1.2em"
2138
+ };
2139
+ function fn(t, s) {
2140
+ return c(), b("svg", mn, s[0] || (s[0] = [
2141
+ y("path", {
2142
+ fill: "currentColor",
2143
+ d: "M6 6V2c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-4v4a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8c0-1.1.9-2 2-2zm2 0h4a2 2 0 0 1 2 2v4h4V2H8zM2 8v10h10V8z"
2144
+ }, null, -1)
2145
+ ]));
2146
+ }
2147
+ const hn = P({ name: "zondicons-copy", render: fn }), gn = {
2148
+ viewBox: "0 0 24 24",
2149
+ width: "1.2em",
2150
+ height: "1.2em"
2151
+ };
2152
+ function vn(t, s) {
2153
+ return c(), b("svg", gn, s[0] || (s[0] = [
2154
+ y("path", {
2155
+ fill: "currentColor",
2156
+ d: "M12 2A10 10 0 0 0 2 12c0 4.42 2.87 8.17 6.84 9.5c.5.08.66-.23.66-.5v-1.69c-2.77.6-3.36-1.34-3.36-1.34c-.46-1.16-1.11-1.47-1.11-1.47c-.91-.62.07-.6.07-.6c1 .07 1.53 1.03 1.53 1.03c.87 1.52 2.34 1.07 2.91.83c.09-.65.35-1.09.63-1.34c-2.22-.25-4.55-1.11-4.55-4.92c0-1.11.38-2 1.03-2.71c-.1-.25-.45-1.29.1-2.64c0 0 .84-.27 2.75 1.02c.79-.22 1.65-.33 2.5-.33s1.71.11 2.5.33c1.91-1.29 2.75-1.02 2.75-1.02c.55 1.35.2 2.39.1 2.64c.65.71 1.03 1.6 1.03 2.71c0 3.82-2.34 4.66-4.57 4.91c.36.31.69.92.69 1.85V21c0 .27.16.59.67.5C19.14 20.16 22 16.42 22 12A10 10 0 0 0 12 2"
2157
+ }, null, -1)
2158
+ ]));
2159
+ }
2160
+ const bn = P({ name: "mdi-github", render: vn }), yn = { class: "flex" }, wn = { class: "sr-only" }, _n = /* @__PURE__ */ g({
2161
+ __name: "ErrorReportModalButtons",
2162
+ props: {
2163
+ report: {}
2164
+ },
2165
+ setup(t) {
2166
+ const s = t, e = u(() => s.report.description ? `${s.report.title}: ${s.report.description}` : s.report.title), r = u(() => {
2167
+ if (!D.sourceUrl)
2168
+ return !1;
2169
+ const a = encodeURIComponent(e.value), i = encodeURIComponent(
2170
+ [
2171
+ "[Please, explain here what you were trying to do when this error appeared]",
2172
+ "",
2173
+ "Error details:",
2174
+ "```",
2175
+ Ot(
2176
+ s.report.details ?? "Details missing from report",
2177
+ 1800 - a.length - D.sourceUrl.length
2178
+ ).trim(),
2179
+ "```"
2180
+ ].join(`
2181
+ `)
2182
+ );
2183
+ return `${D.sourceUrl}/issues/new?title=${a}&body=${i}`;
2184
+ }), n = u(() => X(
2185
+ [
2186
+ {
2187
+ id: "clipboard",
2188
+ description: "Copy to clipboard",
2189
+ iconComponent: hn,
2190
+ async click() {
2191
+ await navigator.clipboard.writeText(`${e.value}
2192
+
2193
+ ${s.report.details}`), R.toast(S("errors.copiedToClipboard", "Debug information copied to clipboard"));
2194
+ }
2195
+ },
2196
+ {
2197
+ id: "console",
2198
+ description: "Log to console",
2199
+ iconComponent: pn,
2200
+ click() {
2201
+ const a = s.report.error ?? s.report;
2202
+ window.error = a, console.error(a), R.toast(
2203
+ S(
2204
+ "errors.addedToConsole",
2205
+ "You can now use the **error** variable in the console"
2206
+ )
2207
+ );
2208
+ }
2209
+ }
2210
+ ],
2211
+ (a) => {
2212
+ r.value && a.push({
2213
+ id: "github",
2214
+ description: "Report in GitHub",
2215
+ iconComponent: bn,
2216
+ url: r.value
2217
+ });
2218
+ }
2219
+ ));
2220
+ return (a, i) => (c(), b("div", yn, [
2221
+ (c(!0), b(j, null, F(n.value, (o) => w(a.$slots, "default", H({ ref_for: !0 }, o), () => [
2222
+ p(z, {
2223
+ size: "icon",
2224
+ variant: "ghost",
2225
+ class: "group whitespace-nowrap",
2226
+ href: o.url,
2227
+ title: a.$td(`errors.report_${o.id}`, o.description),
2228
+ onClick: o.click
2229
+ }, {
2230
+ default: f(() => [
2231
+ y("span", wn, $(a.$td(`errors.report_${o.id}`, o.description)), 1),
2232
+ (c(), h(N(o.iconComponent), {
2233
+ class: "size-4",
2234
+ "aria-hidden": "true"
2235
+ }))
2236
+ ]),
2237
+ _: 2
2238
+ }, 1032, ["href", "title", "onClick"])
2239
+ ])), 256))
2240
+ ]));
2241
+ }
2242
+ }), $n = /* @__PURE__ */ g({
2243
+ __name: "ErrorReportModalTitle",
2244
+ props: {
2245
+ report: {},
2246
+ currentReport: {},
2247
+ totalReports: {}
2248
+ },
2249
+ setup(t) {
2250
+ const s = u(() => !t.totalReports || t.totalReports <= 1 ? t.report.title : `${t.report.title} (${t.currentReport}/${t.totalReports})`);
2251
+ return (e, r) => (c(), h(T, {
2252
+ text: s.value,
2253
+ inline: ""
2254
+ }, null, 8, ["text"]));
2255
+ }
2256
+ });
2257
+ function xn(t) {
2258
+ const s = B(t.reports.includes(t.report) ? t.reports.indexOf(t.report) : 0), e = u(() => t.reports[s.value]), r = u(
2259
+ () => {
2260
+ var i;
2261
+ return ((i = e.value.details) == null ? void 0 : i.trim()) || S("errors.detailsEmpty", "This error is missing a stacktrace.");
2262
+ }
2263
+ ), n = S("errors.previousReport", "Show previous report"), a = S("errors.nextReport", "Show next report");
2264
+ return {
2265
+ activeReportIndex: s,
2266
+ details: r,
2267
+ nextReportText: a,
2268
+ previousReportText: n,
2269
+ activeReport: e
2270
+ };
2271
+ }
2272
+ const Cn = { class: "px-4 pt-5 pb-4" }, kn = { class: "flex justify-between gap-4" }, Sn = { class: "flex items-center gap-2" }, Mn = {
2273
+ key: 0,
2274
+ class: "flex gap-0.5"
2275
+ }, En = { class: "-mt-2 max-h-[75vh] overflow-auto bg-red-800/10" }, Hn = ["textContent"], Vn = /* @__PURE__ */ g({
2276
+ __name: "ErrorReportModal",
2277
+ props: {
2278
+ report: {},
2279
+ reports: {}
2280
+ },
2281
+ setup(t, { expose: s }) {
2282
+ const e = t, { activeReportIndex: r, details: n, nextReportText: a, previousReportText: i, activeReport: o } = xn(e);
2283
+ return s(), (d, v) => (c(), h(Y, {
2284
+ title: d.$td("errors.report", "Error report"),
2285
+ "title-hidden": "",
2286
+ "close-hidden": "",
2287
+ class: "p-0",
2288
+ "wrapper-class": "sm:w-auto sm:min-w-lg sm:max-w-[80vw]"
2289
+ }, {
2290
+ default: f(() => [
2291
+ y("div", Cn, [
2292
+ y("h2", kn, [
2293
+ y("div", Sn, [
2294
+ p(l(yt), { class: "size-5 text-red-600" }),
2295
+ p($n, {
2296
+ class: "text-lg leading-6 font-semibold text-gray-900",
2297
+ report: l(o),
2298
+ "current-report": l(r) + 1,
2299
+ "total-reports": d.reports.length
2300
+ }, null, 8, ["report", "current-report", "total-reports"]),
2301
+ d.reports.length > 1 ? (c(), b("span", Mn, [
2302
+ p(z, {
2303
+ size: "icon",
2304
+ variant: "ghost",
2305
+ disabled: l(r) === 0,
2306
+ "aria-label": l(i),
2307
+ title: l(i),
2308
+ onClick: v[0] || (v[0] = (C) => r.value--)
2309
+ }, {
2310
+ default: f(() => [
2311
+ p(l(nn), { class: "size-4" })
2312
+ ]),
2313
+ _: 1
2314
+ }, 8, ["disabled", "aria-label", "title"]),
2315
+ p(z, {
2316
+ size: "icon",
2317
+ variant: "ghost",
2318
+ disabled: l(r) === d.reports.length - 1,
2319
+ "aria-label": l(a),
2320
+ title: l(a),
2321
+ onClick: v[1] || (v[1] = (C) => r.value++)
2322
+ }, {
2323
+ default: f(() => [
2324
+ p(l(bt), { class: "size-4" })
2325
+ ]),
2326
+ _: 1
2327
+ }, 8, ["disabled", "aria-label", "title"])
2328
+ ])) : M("", !0)
2329
+ ]),
2330
+ p(_n, {
2331
+ report: l(o),
2332
+ class: "gap-0.5"
2333
+ }, null, 8, ["report"])
2334
+ ]),
2335
+ l(o).description ? (c(), h(T, {
2336
+ key: 0,
2337
+ text: l(o).description,
2338
+ class: "text-gray-600"
2339
+ }, null, 8, ["text"])) : M("", !0)
2340
+ ]),
2341
+ y("div", En, [
2342
+ y("pre", {
2343
+ class: "p-4 text-xs text-red-800",
2344
+ textContent: $(l(n))
2345
+ }, null, 8, Hn)
2346
+ ])
2347
+ ]),
2348
+ _: 1
2349
+ }, 8, ["title"]));
2350
+ }
2351
+ }), Ln = {
2352
+ viewBox: "0 0 24 24",
2353
+ width: "1.2em",
2354
+ height: "1.2em"
2355
+ };
2356
+ function In(t, s) {
2357
+ return c(), b("svg", Ln, s[0] || (s[0] = [
2358
+ y("path", {
2359
+ fill: "currentColor",
2360
+ d: "M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z",
2361
+ opacity: ".25"
2362
+ }, null, -1),
2363
+ y("path", {
2364
+ fill: "currentColor",
2365
+ d: "M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z"
2366
+ }, [
2367
+ y("animateTransform", {
2368
+ attributeName: "transform",
2369
+ dur: "0.75s",
2370
+ repeatCount: "indefinite",
2371
+ type: "rotate",
2372
+ values: "0 12 12;360 12 12"
2373
+ })
2374
+ ], -1)
2375
+ ]));
2376
+ }
2377
+ const Tn = P({ name: "svg-spinners-90-ring-with-bg", render: In }), Rn = { class: "mt-1 h-2 w-full overflow-hidden rounded-full bg-gray-200" }, Pn = { class: "sr-only" }, An = /* @__PURE__ */ g({
2378
+ __name: "ProgressBar",
2379
+ props: {
2380
+ filledClass: {},
2381
+ progress: {},
2382
+ job: {}
2383
+ },
2384
+ setup(t) {
2385
+ let s;
2386
+ const e = B(0), r = u(() => E("size-full transition-transform duration-500 rounded-r-full ease-linear bg-primary-600", t.filledClass)), n = u(() => typeof t.progress == "number" ? t.progress : e.value);
2387
+ return Ee(
2388
+ () => t.job,
2389
+ () => {
2390
+ s && s(), e.value = t.job ? t.job.progress : 0, s = t.job && t.job.listeners.add({ onUpdated: (a) => e.value = a });
2391
+ },
2392
+ { immediate: !0 }
2393
+ ), fe(() => s && s()), (a, i) => (c(), b("div", Rn, [
2394
+ y("div", {
2395
+ class: k(r.value),
2396
+ style: It(`transform:translateX(-${(1 - n.value) * 100}%)`)
2397
+ }, null, 6),
2398
+ y("span", Pn, $(a.$td("ui.progress", "{progress}% complete", {
2399
+ progress: n.value * 100
2400
+ })), 1)
2401
+ ]));
2402
+ }
2403
+ });
2404
+ function zn(t) {
2405
+ const s = u(() => t.title ?? S("ui.loading", "Loading")), e = u(
2406
+ () => t.message ?? S("ui.loadingInProgress", "Loading in progress...")
2407
+ ), r = u(() => typeof t.progress == "number" || !!t.job), n = u(() => !t.title);
2408
+ return { renderedTitle: s, renderedMessage: e, titleHidden: n, showProgress: r };
2409
+ }
2410
+ const Dn = /* @__PURE__ */ g({
2411
+ __name: "LoadingModal",
2412
+ props: {
2413
+ title: {},
2414
+ message: {},
2415
+ progress: {},
2416
+ job: {}
2417
+ },
2418
+ setup(t, { expose: s }) {
2419
+ const e = t, { renderedTitle: r, renderedMessage: n, titleHidden: a, showProgress: i } = zn(e);
2420
+ return s(), (o, d) => (c(), h(Y, {
2421
+ persistent: "",
2422
+ class: k(["flex", { "flex-col-reverse": l(i), "items-center justify-center gap-2": !l(i) }]),
2423
+ "wrapper-class": "w-auto",
2424
+ title: l(r),
2425
+ "title-hidden": l(a)
2426
+ }, {
2427
+ default: f(() => [
2428
+ l(i) ? (c(), h(An, {
2429
+ key: 0,
2430
+ progress: o.progress,
2431
+ job: o.job,
2432
+ class: "min-w-[min(400px,80vw)]"
2433
+ }, null, 8, ["progress", "job"])) : (c(), h(l(Tn), {
2434
+ key: 1,
2435
+ class: "text-primary-600 mr-1 size-6"
2436
+ })),
2437
+ p(T, { text: l(n) }, null, 8, ["text"])
2438
+ ]),
2439
+ _: 1
2440
+ }, 8, ["title", "title-hidden", "class"]));
2441
+ }
2442
+ }), wt = /* @__PURE__ */ g({
2443
+ __name: "HeadlessInput",
2444
+ props: {
2445
+ name: {},
2446
+ label: {},
2447
+ description: {},
2448
+ modelValue: {},
2449
+ as: { default: "div" }
2450
+ },
2451
+ emits: ["update:modelValue"],
2452
+ setup(t, { expose: s, emit: e }) {
2453
+ const r = e, n = se("form", null), a = u(() => !n || !t.name ? null : n.errors[t.name] ?? null), i = {
2454
+ id: `input-${te()}`,
2455
+ name: u(() => t.name),
2456
+ label: u(() => t.label),
2457
+ description: u(() => t.description),
2458
+ value: u(() => n && t.name ? n.getFieldValue(t.name) : t.modelValue),
2459
+ errors: me(a),
2460
+ required: u(() => {
2461
+ if (!(!t.name || !n))
2462
+ return n.getFieldRules(t.name).includes("required");
2463
+ }),
2464
+ update(o) {
2465
+ if (n && t.name) {
2466
+ n.setFieldValue(t.name, o);
2467
+ return;
2468
+ }
2469
+ r("update:modelValue", o);
2470
+ }
2471
+ };
2472
+ return ae("input", i), s(i), (o, d) => (c(), h(N(o.as), null, {
2473
+ default: f(() => [
2474
+ w(o.$slots, "default")
2475
+ ]),
2476
+ _: 3
2477
+ }));
2478
+ }
2479
+ }), jn = ["for"], Se = /* @__PURE__ */ g({
2480
+ __name: "HeadlessInputLabel",
2481
+ setup(t) {
2482
+ const s = V("input", "<HeadlessInputLabel> must be a child of a <HeadlessInput>"), e = He(), r = u(() => !!(s.label || e.default));
2483
+ return (n, a) => r.value ? (c(), b("label", {
2484
+ key: 0,
2485
+ for: l(s).id
2486
+ }, [
2487
+ w(n.$slots, "default", {}, () => [
2488
+ A($(l(s).label), 1)
2489
+ ])
2490
+ ], 8, jn)) : M("", !0);
2491
+ }
2492
+ }), Bn = ["id", "name", "type", "checked", "required", "aria-invalid", "aria-describedby"], _t = /* @__PURE__ */ g({
2493
+ __name: "HeadlessInputInput",
2494
+ props: {
2495
+ type: { default: "text" }
2496
+ },
2497
+ setup(t) {
2498
+ const s = le("$inputRef"), e = V("input", "<HeadlessInputInput> must be a child of a <HeadlessInput>"), r = u(() => e.name ?? void 0), n = u(() => e.value), a = u(() => {
2499
+ if (t.type === "checkbox")
2500
+ return !!n.value;
2501
+ });
2502
+ function i() {
2503
+ s.value && e.update(o());
2504
+ }
2505
+ function o() {
2506
+ if (!s.value)
2507
+ return null;
2508
+ switch (t.type) {
2509
+ case "checkbox":
2510
+ return s.value.checked;
2511
+ case "date":
2512
+ return s.value.valueAsDate;
2513
+ default:
2514
+ return s.value.value;
2515
+ }
2516
+ }
2517
+ return nt(e, () => {
2518
+ var d;
2519
+ return (d = s.value) == null ? void 0 : d.focus();
2520
+ }), J(() => {
2521
+ if (s.value) {
2522
+ if (t.type === "date" && n.value instanceof Date) {
2523
+ s.value.valueAsDate = n.value;
2524
+ return;
2525
+ }
2526
+ s.value.value = n.value ?? null;
2527
+ }
2528
+ }), (d, v) => (c(), b("input", {
2529
+ id: l(e).id,
2530
+ ref: "$inputRef",
2531
+ name: r.value,
2532
+ type: d.type,
2533
+ checked: a.value,
2534
+ required: l(e).required ?? void 0,
2535
+ "aria-invalid": l(e).errors ? "true" : "false",
2536
+ "aria-describedby": l(e).errors ? `${l(e).id}-error` : l(e).description ? `${l(e).id}-description` : void 0,
2537
+ onInput: i
2538
+ }, null, 40, Bn));
2539
+ }
2540
+ }), qn = /* @__PURE__ */ g({
2541
+ inheritAttrs: !1,
2542
+ __name: "HeadlessInputDescription",
2543
+ setup(t) {
2544
+ const s = V(
2545
+ "input",
2546
+ "<HeadlessInputDescription> must be a child of a <HeadlessInput>"
2547
+ ), e = u(() => typeof s.description == "string" ? s.description : ""), r = u(() => !!s.description);
2548
+ return (n, a) => w(n.$slots, "default", {
2549
+ id: `${l(s).id}-description`
2550
+ }, () => [
2551
+ r.value ? (c(), h(T, H({ key: 0 }, n.$attrs, {
2552
+ id: `${l(s).id}-description`,
2553
+ text: e.value
2554
+ }), null, 16, ["id", "text"])) : M("", !0)
2555
+ ]);
2556
+ }
2557
+ }), Fn = ["id"], Me = /* @__PURE__ */ g({
2558
+ __name: "HeadlessInputError",
2559
+ setup(t) {
2560
+ const s = V("input", "<HeadlessInputError> must be a child of a <HeadlessInput>"), e = u(() => s.errors ? S(`errors.${s.errors[0]}`, `Error: ${s.errors[0]}`) : null);
2561
+ return (r, n) => e.value ? (c(), b("p", {
2562
+ key: 0,
2563
+ id: `${l(s).id}-error`
2564
+ }, $(e.value), 9, Fn)) : M("", !0);
2565
+ }
2566
+ }), Un = {
2567
+ key: 0,
2568
+ class: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3"
2569
+ }, On = /* @__PURE__ */ g({
2570
+ inheritAttrs: !1,
2571
+ __name: "Input",
2572
+ props: {
2573
+ name: {},
2574
+ label: {},
2575
+ description: {},
2576
+ modelValue: {},
2577
+ inputClass: {},
2578
+ wrapperClass: {}
2579
+ },
2580
+ emits: ["update:modelValue"],
2581
+ setup(t) {
2582
+ const s = Z(t, ["label", "inputClass", "wrapperClass"]), e = le("$inputRef"), [r, n] = lt(), a = u(() => E("relative rounded-md shadow-2xs", { "mt-1": t.label }, t.wrapperClass)), i = u(() => {
2583
+ var o, d, v;
2584
+ return E(
2585
+ // eslint-disable-next-line vue/max-len
2586
+ "block w-full rounded-md border-0 py-1.5 ring-1 ring-inset focus:ring-2 focus:ring-inset sm:text-sm sm:leading-6",
2587
+ {
2588
+ "focus:ring-primary-600": !((o = e.value) != null && o.errors),
2589
+ "text-gray-900 shadow-2xs ring-gray-300 placeholder:text-gray-400": !((d = e.value) != null && d.errors),
2590
+ "pr-10 text-red-900 ring-red-300 placeholder:text-red-300 focus:ring-red-500": (v = e.value) == null ? void 0 : v.errors
2591
+ },
2592
+ t.inputClass
2593
+ );
2594
+ });
2595
+ return (o, d) => (c(), h(wt, H({
2596
+ ref: "$inputRef",
2597
+ label: o.label,
2598
+ class: l(n)
2599
+ }, s, {
2600
+ "onUpdate:modelValue": d[0] || (d[0] = (v) => o.$emit("update:modelValue", v))
2601
+ }), {
2602
+ default: f(() => {
2603
+ var v;
2604
+ return [
2605
+ p(Se, { class: "block text-sm leading-6 font-medium text-gray-900" }),
2606
+ y("div", {
2607
+ class: k(a.value)
2608
+ }, [
2609
+ p(_t, H(l(r), { class: i.value }), null, 16, ["class"]),
2610
+ (v = l(e)) != null && v.errors ? (c(), b("div", Un, [
2611
+ p(l(yt), { class: "size-5 text-red-500" })
2612
+ ])) : M("", !0)
2613
+ ], 2),
2614
+ p(qn, { class: "mt-2 text-sm text-gray-600" }),
2615
+ p(Me, { class: "mt-2 text-sm text-red-600" })
2616
+ ];
2617
+ }),
2618
+ _: 1
2619
+ }, 16, ["label", "class"]));
2620
+ }
2621
+ });
2622
+ function tl(t, s = {}) {
2623
+ return {
2624
+ default: t,
2625
+ type: "boolean",
2626
+ rules: s.rules
2627
+ };
2628
+ }
2629
+ function sl(t, s = {}) {
2630
+ return {
2631
+ default: t,
2632
+ type: "date",
2633
+ rules: s.rules
2634
+ };
2635
+ }
2636
+ function rl(t) {
2637
+ return {
2638
+ default: t,
2639
+ type: "boolean",
2640
+ rules: "required"
2641
+ };
2642
+ }
2643
+ function nl(t) {
2644
+ return {
2645
+ default: t,
2646
+ type: "date",
2647
+ rules: "required"
2648
+ };
2649
+ }
2650
+ function al(t) {
2651
+ return {
2652
+ default: t,
2653
+ type: "number",
2654
+ rules: "required"
2655
+ };
2656
+ }
2657
+ function ll(t) {
2658
+ return {
2659
+ default: t,
2660
+ type: "object",
2661
+ rules: "required"
2662
+ };
2663
+ }
2664
+ function Nn(t) {
2665
+ return {
2666
+ default: t,
2667
+ type: "string",
2668
+ rules: "required"
2669
+ };
2670
+ }
2671
+ function ol(t, s = {}) {
2672
+ return {
2673
+ default: t,
2674
+ type: "number",
2675
+ rules: s.rules
2676
+ };
2677
+ }
2678
+ function il(t, s = {}) {
2679
+ return {
2680
+ default: t,
2681
+ type: "object",
2682
+ rules: s.rules
2683
+ };
2684
+ }
2685
+ function cl(t, s = {}) {
2686
+ return {
2687
+ default: t,
2688
+ type: "string",
2689
+ rules: s.rules
2690
+ };
2691
+ }
2692
+ function Wn(t) {
2693
+ const s = at({
2694
+ draft: Nn(t.defaultValue ?? "")
2695
+ }), e = u(() => t.title ?? t.message), r = u(() => t.title ? t.message : null), n = u(() => t.acceptText ?? S("ui.accept", "Ok")), a = u(() => t.cancelText ?? S("ui.cancel", "Cancel"));
2696
+ return { form: s, renderedTitle: e, renderedMessage: r, renderedAcceptText: n, renderedCancelText: a };
2697
+ }
2698
+ const Kn = { class: "mt-4 flex flex-row-reverse gap-2" }, Qn = /* @__PURE__ */ g({
2699
+ __name: "PromptModal",
2700
+ props: {
2701
+ title: {},
2702
+ message: {},
2703
+ label: {},
2704
+ defaultValue: {},
2705
+ placeholder: {},
2706
+ acceptText: {},
2707
+ acceptVariant: {},
2708
+ cancelText: {},
2709
+ cancelVariant: { default: "secondary" }
2710
+ },
2711
+ setup(t, { expose: s }) {
2712
+ const e = Z(t, ["cancelVariant"]), { form: r, renderedTitle: n, renderedMessage: a, renderedAcceptText: i, renderedCancelText: o } = Wn(e);
2713
+ return s(), (d, v) => (c(), h(Y, {
2714
+ title: l(n),
2715
+ persistent: ""
2716
+ }, {
2717
+ default: f(({ close: C }) => [
2718
+ p(vt, {
2719
+ form: l(r),
2720
+ onSubmit: (m) => C(l(r).draft)
2721
+ }, {
2722
+ default: f(() => [
2723
+ l(a) ? (c(), h(T, {
2724
+ key: 0,
2725
+ text: l(a)
2726
+ }, null, 8, ["text"])) : M("", !0),
2727
+ p(On, {
2728
+ name: "draft",
2729
+ class: "mt-2",
2730
+ placeholder: d.placeholder,
2731
+ label: d.label
2732
+ }, null, 8, ["placeholder", "label"]),
2733
+ y("div", Kn, [
2734
+ p(z, {
2735
+ variant: d.acceptVariant,
2736
+ submit: ""
2737
+ }, {
2738
+ default: f(() => [
2739
+ A($(l(i)), 1)
2740
+ ]),
2741
+ _: 1
2742
+ }, 8, ["variant"]),
2743
+ p(z, {
2744
+ variant: d.cancelVariant,
2745
+ onClick: (m) => C()
2746
+ }, {
2747
+ default: f(() => [
2748
+ A($(l(o)), 1)
2749
+ ]),
2750
+ _: 2
2751
+ }, 1032, ["variant", "onClick"])
2752
+ ])
2753
+ ]),
2754
+ _: 2
2755
+ }, 1032, ["form", "onSubmit"])
2756
+ ]),
2757
+ _: 1
2758
+ }, 8, ["title"]));
2759
+ }
2760
+ }), Jn = { class: "grid grow place-items-center" }, Zn = { class: "flex flex-col items-center space-y-6 p-8" }, Xn = { class: "mt-2 text-center text-4xl font-medium text-red-600" }, Gn = { class: "mt-4 flex flex-col space-y-4" }, Yn = /* @__PURE__ */ g({
2761
+ __name: "StartupCrash",
2762
+ setup(t) {
2763
+ return (s, e) => (c(), b("div", Jn, [
2764
+ y("div", Zn, [
2765
+ y("h1", Xn, $(s.$td("startupCrash.title", "Something went wrong!")), 1),
2766
+ p(T, {
2767
+ text: s.$td(
2768
+ "startupCrash.message",
2769
+ `Something failed trying to start the application.
2770
+
2771
+ Here's some things you can do:`
2772
+ ),
2773
+ class: "mt-4 text-center"
2774
+ }, null, 8, ["text"]),
2775
+ y("div", Gn, [
2776
+ p(z, {
2777
+ variant: "danger",
2778
+ onClick: e[0] || (e[0] = (r) => s.$app.reload())
2779
+ }, {
2780
+ default: f(() => [
2781
+ A($(s.$td("startupCrash.reload", "Try again")), 1)
2782
+ ]),
2783
+ _: 1
2784
+ }),
2785
+ p(z, {
2786
+ variant: "danger",
2787
+ onClick: e[1] || (e[1] = (r) => s.$errors.inspect(s.$errors.startupErrors))
2788
+ }, {
2789
+ default: f(() => [
2790
+ A($(s.$td("startupCrash.inspect", "View error details")), 1)
2791
+ ]),
2792
+ _: 1
2793
+ })
2794
+ ])
2795
+ ])
2796
+ ]));
2797
+ }
2798
+ }), $t = /* @__PURE__ */ g({
2799
+ __name: "HeadlessToastAction",
2800
+ props: {
2801
+ action: {}
2802
+ },
2803
+ setup(t) {
2804
+ return (s, e) => (c(), h(N(s.action.dismiss ? l(gs) : "button"), {
2805
+ type: "button",
2806
+ onClick: s.action.click
2807
+ }, {
2808
+ default: f(() => [
2809
+ A($(s.action.label), 1)
2810
+ ]),
2811
+ _: 1
2812
+ }, 8, ["onClick"]));
2813
+ }
2814
+ }), ea = { key: 0 }, ta = /* @__PURE__ */ g({
2815
+ __name: "HeadlessToast",
2816
+ props: {
2817
+ message: {},
2818
+ actions: {},
2819
+ variant: {}
2820
+ },
2821
+ setup(t) {
2822
+ return (s, e) => (c(), h(l(vs), null, {
2823
+ default: f(() => [
2824
+ w(s.$slots, "default", {}, () => [
2825
+ s.message ? (c(), b("span", ea, $(s.message), 1)) : M("", !0),
2826
+ (c(!0), b(j, null, F(s.actions, (r, n) => (c(), h($t, {
2827
+ key: n,
2828
+ action: r
2829
+ }, null, 8, ["action"]))), 128))
2830
+ ])
2831
+ ]),
2832
+ _: 3
2833
+ }));
2834
+ }
2835
+ }), sa = /* @__PURE__ */ g({
2836
+ __name: "Toast",
2837
+ props: {
2838
+ message: {},
2839
+ actions: {},
2840
+ variant: { default: "secondary" },
2841
+ class: {}
2842
+ },
2843
+ setup(t, { expose: s }) {
2844
+ const e = u(() => st(
2845
+ { baseClasses: t.class, variant: t.variant },
2846
+ {
2847
+ baseClasses: "flex items-center gap-2 rounded-md p-2 ring-1 shadow-lg border-gray-200",
2848
+ variants: {
2849
+ variant: {
2850
+ secondary: "bg-gray-900 text-white ring-black",
2851
+ danger: "bg-red-50 text-red-900 ring-red-100"
2852
+ }
2853
+ },
2854
+ defaultVariants: {
2855
+ variant: "secondary"
2856
+ }
2857
+ }
2858
+ ));
2859
+ return s(), (r, n) => (c(), h(ta, {
2860
+ class: k(e.value)
2861
+ }, {
2862
+ default: f(() => [
2863
+ r.message ? (c(), h(T, {
2864
+ key: 0,
2865
+ text: r.message,
2866
+ inline: ""
2867
+ }, null, 8, ["text"])) : M("", !0),
2868
+ (c(!0), b(j, null, F(r.actions, (a, i) => (c(), h(z, {
2869
+ key: i,
2870
+ action: a,
2871
+ variant: r.variant,
2872
+ as: $t
2873
+ }, null, 8, ["action", "variant"]))), 128))
2874
+ ]),
2875
+ _: 1
2876
+ }, 8, ["class"]));
2877
+ }
2878
+ }), ra = { $ui: R }, na = {
2879
+ async install(t, s) {
2880
+ const e = {
2881
+ "alert-modal": Qr,
2882
+ "confirm-modal": tn,
2883
+ "error-report-modal": Vn,
2884
+ "loading-modal": Dn,
2885
+ "prompt-modal": Qn,
2886
+ "startup-crash": Yn,
2887
+ toast: sa,
2888
+ ...s.components
2889
+ };
2890
+ for (const [r, n] of Object.entries(e))
2891
+ R.registerComponent(r, n);
2892
+ await be(t, ra);
2893
+ }
2894
+ };
2895
+ async function aa(t, s = {}) {
2896
+ var r;
2897
+ const e = [Pr, Fs, Rr, xr, Ks, na, ...s.plugins ?? []];
2898
+ D.instance = t, await As(e, t, s), await ((r = s.install) == null ? void 0 : r.call(s, t)), await I.emit("application-ready");
2899
+ }
2900
+ async function ul(t, s = {}) {
2901
+ var r;
2902
+ const e = Tt(t);
2903
+ ee() && (window.$aerogel = e), await aa(e, s), e.mount("#app"), (r = e._container) == null || r.classList.remove("loading"), await I.emit("application-mounted");
2904
+ }
2905
+ const la = { key: 0 }, oa = /* @__PURE__ */ g({
2906
+ __name: "AppModals",
2907
+ setup(t) {
2908
+ const s = u(() => R.modals[0] ?? null);
2909
+ return (e, r) => s.value ? (c(), b("aside", la, [
2910
+ p(gt, {
2911
+ "child-index": 1,
2912
+ modal: s.value
2913
+ }, null, 8, ["modal"])
2914
+ ])) : M("", !0);
2915
+ }
2916
+ }), ia = /* @__PURE__ */ g({
2917
+ __name: "AppToasts",
2918
+ setup(t) {
2919
+ return (s, e) => (c(), h(l(bs), null, {
2920
+ default: f(() => [
2921
+ (c(!0), b(j, null, F(s.$ui.toasts, (r) => (c(), h(N(r.component), H({
2922
+ id: r.id,
2923
+ key: r.id,
2924
+ ref_for: !0
2925
+ }, r.properties), null, 16, ["id"]))), 128)),
2926
+ p(l(ys), { class: "fixed right-0 bottom-0 z-50 flex flex-col items-end space-y-4 px-4 py-6 sm:p-6" })
2927
+ ]),
2928
+ _: 1
2929
+ }));
2930
+ }
2931
+ }), ca = /* @__PURE__ */ g({
2932
+ __name: "AppOverlays",
2933
+ setup(t) {
2934
+ return (s, e) => (c(), b(j, null, [
2935
+ p(oa),
2936
+ p(ia)
2937
+ ], 64));
2938
+ }
2939
+ }), ua = { class: "flex min-h-full flex-col text-base leading-tight font-normal text-gray-900 antialiased" }, dl = /* @__PURE__ */ g({
2940
+ __name: "AppLayout",
2941
+ setup(t) {
2942
+ return (s, e) => (c(), b("div", ua, [
2943
+ s.$errors.hasStartupErrors ? w(s.$slots, "startup-crash", { key: 0 }, () => [
2944
+ (c(), h(N(s.$ui.requireComponent("startup-crash"))))
2945
+ ]) : w(s.$slots, "default", { key: 1 }),
2946
+ p(ca)
2947
+ ]));
2948
+ }
2949
+ }), da = ["id", "name", "value", "required", "aria-invalid", "aria-describedby"], pl = /* @__PURE__ */ g({
2950
+ __name: "HeadlessInputTextArea",
2951
+ setup(t) {
2952
+ const s = le("$textAreaRef"), e = V(
2953
+ "input",
2954
+ "<HeadlessInputTextArea> must be a child of a <HeadlessInput>"
2955
+ ), r = u(() => e.name ?? void 0), n = u(() => e.value);
2956
+ function a() {
2957
+ s.value && e.update(s.value.value);
2958
+ }
2959
+ return nt(e, () => {
2960
+ var i;
2961
+ return (i = s.value) == null ? void 0 : i.focus();
2962
+ }), (i, o) => (c(), b("textarea", {
2963
+ id: l(e).id,
2964
+ ref: "$textAreaRef",
2965
+ name: r.value,
2966
+ value: n.value,
2967
+ required: l(e).required ?? void 0,
2968
+ "aria-invalid": l(e).errors ? "true" : "false",
2969
+ "aria-describedby": l(e).errors ? `${l(e).id}-error` : l(e).description ? `${l(e).id}-description` : void 0,
2970
+ onInput: a
2971
+ }, null, 40, da));
2972
+ }
2973
+ }), pa = { class: "group" }, ma = { class: "-ml-2 flex w-[max-content] items-center rounded-lg py-2 pr-3 pl-1 hover:bg-gray-100 focus-visible:outline focus-visible:outline-gray-700" }, fa = { class: "pt-2 pl-4" }, ml = /* @__PURE__ */ g({
2974
+ __name: "AdvancedOptions",
2975
+ setup(t) {
2976
+ return (s, e) => (c(), b("details", pa, [
2977
+ y("summary", ma, [
2978
+ p(l(bt), { class: "size-6 transition-transform group-open:rotate-90" }),
2979
+ y("span", null, $(s.$td("ui.advancedOptions", "Advanced options")), 1)
2980
+ ]),
2981
+ y("div", fa, [
2982
+ w(s.$slots, "default")
2983
+ ])
2984
+ ]));
2985
+ }
2986
+ }), ha = { class: "flex h-6 items-center" }, fl = /* @__PURE__ */ g({
2987
+ inheritAttrs: !1,
2988
+ __name: "Checkbox",
2989
+ props: {
2990
+ name: {},
2991
+ label: {},
2992
+ description: {},
2993
+ modelValue: {},
2994
+ inputClass: {},
2995
+ labelClass: {}
2996
+ },
2997
+ emits: ["update:modelValue"],
2998
+ setup(t) {
2999
+ const s = Z(t, ["inputClass", "labelClass"]), e = le("$inputRef"), [r, n] = lt(), a = u(() => E("relative flex items-start", n.value)), i = u(() => {
3000
+ var d, v;
3001
+ return E(
3002
+ "size-4 rounded text-primary-600 not-checked:hover:bg-gray-200 checked:hover:text-primary-500 checked:border-0",
3003
+ {
3004
+ "border-gray-300 focus:ring-primary-600": !((d = e.value) != null && d.errors),
3005
+ "border-red-400 border-2 focus:ring-red-600": (v = e.value) == null ? void 0 : v.errors
3006
+ },
3007
+ t.inputClass
3008
+ );
3009
+ }), o = u(() => E("ml-2 text-sm leading-6", t.labelClass));
3010
+ return (d, v) => (c(), h(wt, H({
3011
+ ref: "$inputRef",
3012
+ class: a.value
3013
+ }, s, {
3014
+ "onUpdate:modelValue": v[0] || (v[0] = (C) => d.$emit("update:modelValue", C))
3015
+ }), {
3016
+ default: f(() => [
3017
+ y("div", ha, [
3018
+ p(_t, H(l(r), {
3019
+ type: "checkbox",
3020
+ class: i.value
3021
+ }), null, 16, ["class"])
3022
+ ]),
3023
+ d.$slots.default ? (c(), b("div", {
3024
+ key: 0,
3025
+ class: k(o.value)
3026
+ }, [
3027
+ p(Se, { class: "text-gray-900" }, {
3028
+ default: f(() => [
3029
+ w(d.$slots, "default")
3030
+ ]),
3031
+ _: 3
3032
+ }),
3033
+ p(Me, { class: "text-red-600" })
3034
+ ], 2)) : d.label ? (c(), b("div", {
3035
+ key: 1,
3036
+ class: k(o.value)
3037
+ }, [
3038
+ p(Se, { class: "text-gray-900" }),
3039
+ p(Me, { class: "text-red-600" })
3040
+ ], 2)) : M("", !0)
3041
+ ]),
3042
+ _: 3
3043
+ }, 16, ["class"]));
3044
+ }
3045
+ }), ga = /* @__PURE__ */ g({
3046
+ __name: "DropdownMenuOption",
3047
+ props: {
3048
+ class: {},
3049
+ asChild: { type: Boolean },
3050
+ as: {}
3051
+ },
3052
+ emits: ["select"],
3053
+ setup(t) {
3054
+ const s = Z(t, ["class"]), e = u(() => E(
3055
+ "flex w-full items-center gap-2 rounded-lg px-2 py-2 text-sm text-gray-900 data-[highlighted]:bg-gray-100",
3056
+ t.class
3057
+ ));
3058
+ return (r, n) => (c(), h(l(ws), H({ class: e.value }, s, {
3059
+ onSelect: n[0] || (n[0] = (a) => r.$emit("select"))
3060
+ }), {
3061
+ default: f(() => [
3062
+ w(r.$slots, "default")
3063
+ ]),
3064
+ _: 3
3065
+ }, 16, ["class"]));
3066
+ }
3067
+ }), va = /* @__PURE__ */ g({
3068
+ __name: "DropdownMenuOptions",
3069
+ setup(t) {
3070
+ const s = V(
3071
+ "dropdown-menu",
3072
+ "<DropdownMenuOptions> must be a child of a <DropdownMenu>"
3073
+ );
3074
+ return (e, r) => (c(), h(l(_s), {
3075
+ class: "gap-y-0.5 rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-black/5",
3076
+ align: l(s).align,
3077
+ side: l(s).side
3078
+ }, {
3079
+ default: f(() => [
3080
+ w(e.$slots, "default", {}, () => [
3081
+ (c(!0), b(j, null, F(l(s).options, (n, a) => (c(), h(ga, H(
3082
+ {
3083
+ key: a,
3084
+ as: n.route || n.href ? tt : void 0,
3085
+ class: n.class,
3086
+ ref_for: !0
3087
+ },
3088
+ n.route || n.href ? {
3089
+ href: n.href,
3090
+ route: n.route,
3091
+ routeParams: n.routeParams,
3092
+ routeQuery: n.routeQuery
3093
+ } : {},
3094
+ {
3095
+ onSelect: (i) => {
3096
+ var o;
3097
+ return (o = n.click) == null ? void 0 : o.call(n);
3098
+ }
3099
+ }
3100
+ ), {
3101
+ default: f(() => [
3102
+ A($(n.label), 1)
3103
+ ]),
3104
+ _: 2
3105
+ }, 1040, ["as", "class", "onSelect"]))), 128))
3106
+ ])
3107
+ ]),
3108
+ _: 3
3109
+ }, 8, ["align", "side"]));
3110
+ }
3111
+ }), hl = /* @__PURE__ */ g({
3112
+ __name: "DropdownMenu",
3113
+ props: {
3114
+ align: {},
3115
+ side: {},
3116
+ options: {}
3117
+ },
3118
+ setup(t, { expose: s }) {
3119
+ const e = {
3120
+ align: t.align,
3121
+ side: t.side,
3122
+ options: u(() => {
3123
+ var r;
3124
+ return (r = t.options) == null ? void 0 : r.filter(Boolean);
3125
+ })
3126
+ };
3127
+ return ae("dropdown-menu", e), s(e), (r, n) => (c(), h(l($s), null, {
3128
+ default: f(() => [
3129
+ p(l(xs), null, {
3130
+ default: f(() => [
3131
+ w(r.$slots, "default")
3132
+ ]),
3133
+ _: 3
3134
+ }),
3135
+ p(l(Cs), null, {
3136
+ default: f(() => [
3137
+ w(r.$slots, "options", {}, () => [
3138
+ p(va)
3139
+ ])
3140
+ ]),
3141
+ _: 3
3142
+ })
3143
+ ]),
3144
+ _: 3
3145
+ }));
3146
+ }
3147
+ }), ba = ["aria-hidden"], ya = ["tabindex", "aria-label", "type"], gl = /* @__PURE__ */ g({
3148
+ __name: "EditableContent",
3149
+ props: {
3150
+ type: { default: "text" },
3151
+ contentClass: {},
3152
+ ariaLabel: {},
3153
+ formAriaHidden: { type: Boolean },
3154
+ tabindex: {},
3155
+ text: {},
3156
+ disabled: { type: Boolean }
3157
+ },
3158
+ emits: ["update", "save"],
3159
+ setup(t, { emit: s }) {
3160
+ const e = s, r = le("$inputRef"), n = B(null), a = B(t.text), i = u(() => E("inline whitespace-pre", t.contentClass)), o = u(() => E("invisible whitespace-pre", t.contentClass)), d = u(() => E("absolute inset-0 h-full w-full resize-none border-0 bg-transparent p-0 focus:ring-0", t.contentClass));
3161
+ function v() {
3162
+ n.value = t.text;
3163
+ }
3164
+ function C() {
3165
+ n.value && (t.type !== "number" && a.value.trim().length === 0 && (a.value = n.value, e("update", a.value)), n.value = null, e("save"));
3166
+ }
3167
+ return J(() => a.value = t.text), (m, x) => (c(), b("div", {
3168
+ class: k(["relative", { "pointer-events-none!": m.disabled && !n.value }])
3169
+ }, [
3170
+ n.value ? (c(), b("span", {
3171
+ key: 1,
3172
+ class: k(o.value)
3173
+ }, $(a.value), 3)) : (c(), b("div", {
3174
+ key: 0,
3175
+ class: k(i.value)
3176
+ }, [
3177
+ w(m.$slots, "default")
3178
+ ], 2)),
3179
+ m.type === "number" ? (c(), b("span", {
3180
+ key: 2,
3181
+ class: k(["inline-block transition-[width]", n.value ? "w-5" : "w-0"])
3182
+ }, null, 2)) : M("", !0),
3183
+ y("form", {
3184
+ class: "w-full",
3185
+ "aria-hidden": m.formAriaHidden,
3186
+ onSubmit: x[4] || (x[4] = Ue((L) => {
3187
+ var ye;
3188
+ return (ye = l(r)) == null ? void 0 : ye.blur();
3189
+ }, ["prevent"]))
3190
+ }, [
3191
+ Oe(y("input", {
3192
+ ref: "$inputRef",
3193
+ "onUpdate:modelValue": x[0] || (x[0] = (L) => a.value = L),
3194
+ tabindex: m.tabindex ?? void 0,
3195
+ "aria-label": m.ariaLabel ?? void 0,
3196
+ type: m.type,
3197
+ class: k([
3198
+ d.value,
3199
+ { "opacity-0": !n.value, "appearance-textfield": !n.value && m.type === "number" }
3200
+ ]),
3201
+ onKeyup: x[1] || (x[1] = (L) => m.$emit("update", a.value)),
3202
+ onFocus: x[2] || (x[2] = (L) => v()),
3203
+ onBlur: x[3] || (x[3] = (L) => C())
3204
+ }, null, 42, ya), [
3205
+ [Rt, a.value]
3206
+ ])
3207
+ ], 40, ba)
3208
+ ], 2));
3209
+ }
3210
+ }), wa = {
3211
+ viewBox: "0 0 512 512",
3212
+ width: "1.2em",
3213
+ height: "1.2em"
3214
+ };
3215
+ function _a(t, s) {
3216
+ return c(), b("svg", wa, s[0] || (s[0] = [
3217
+ y("path", {
3218
+ fill: "currentColor",
3219
+ d: "M449.07 399.08L278.64 82.58c-12.08-22.44-44.26-22.44-56.35 0L51.87 399.08A32 32 0 0 0 80 446.25h340.89a32 32 0 0 0 28.18-47.17m-198.6-1.83a20 20 0 1 1 20-20a20 20 0 0 1-20 20m21.72-201.15l-5.74 122a16 16 0 0 1-32 0l-5.74-121.95a21.73 21.73 0 0 1 21.5-22.69h.21a21.74 21.74 0 0 1 21.73 22.7Z"
3220
+ }, null, -1)
3221
+ ]));
3222
+ }
3223
+ const $a = P({ name: "ion-warning", render: _a }), xa = {
3224
+ viewBox: "0 0 20 20",
3225
+ width: "1.2em",
3226
+ height: "1.2em"
3227
+ };
3228
+ function Ca(t, s) {
3229
+ return c(), b("svg", xa, s[0] || (s[0] = [
3230
+ y("path", {
3231
+ fill: "currentColor",
3232
+ d: "M.2 10a11 11 0 0 1 19.6 0A11 11 0 0 1 .2 10m9.8 4a4 4 0 1 0 0-8a4 4 0 0 0 0 8m0-2a2 2 0 1 1 0-4a2 2 0 0 1 0 4"
3233
+ }, null, -1)
3234
+ ]));
3235
+ }
3236
+ const ka = P({ name: "zondicons-view-show", render: Ca }), Sa = { class: "font-medium" }, Ma = ["datetime"], Ea = /* @__PURE__ */ g({
3237
+ __name: "ErrorLogsModal",
3238
+ setup(t) {
3239
+ return (s, e) => (c(), h(Y, {
3240
+ title: s.$td("errors.report", "Errors ({count})", { count: s.$errors.logs.length })
3241
+ }, {
3242
+ default: f(() => [
3243
+ y("ol", null, [
3244
+ (c(!0), b(j, null, F(s.$errors.logs, (r, n) => (c(), b("li", {
3245
+ key: n,
3246
+ class: "mb-2 flex max-w-prose min-w-56 justify-between py-2 last:mb-0"
3247
+ }, [
3248
+ y("div", null, [
3249
+ y("h3", Sa, $(r.report.title), 1),
3250
+ y("time", {
3251
+ datetime: r.date.toISOString(),
3252
+ class: "text-xs text-gray-700"
3253
+ }, $(r.date.toLocaleTimeString()), 9, Ma),
3254
+ p(T, {
3255
+ class: "text-sm text-gray-500",
3256
+ text: r.report.description ?? l(ht)(r.report)
3257
+ }, null, 8, ["text"])
3258
+ ]),
3259
+ p(z, {
3260
+ size: "icon",
3261
+ variant: "ghost",
3262
+ "aria-label": s.$td("errors.viewDetails", "View details"),
3263
+ title: s.$td("errors.viewDetails", "View details"),
3264
+ class: "self-center",
3265
+ onClick: (a) => s.$errors.inspect(
3266
+ r.report,
3267
+ s.$errors.logs.map(({ report: i }) => i)
3268
+ )
3269
+ }, {
3270
+ default: f(() => [
3271
+ p(l(ka), {
3272
+ class: "size-4",
3273
+ "aria-hidden": "true"
3274
+ })
3275
+ ]),
3276
+ _: 2
3277
+ }, 1032, ["aria-label", "title", "onClick"])
3278
+ ]))), 128))
3279
+ ])
3280
+ ]),
3281
+ _: 1
3282
+ }, 8, ["title"]));
3283
+ }
3284
+ }), vl = /* @__PURE__ */ g({
3285
+ __name: "ErrorLogs",
3286
+ setup(t) {
3287
+ return (s, e) => s.$errors.logs.length > 0 ? (c(), h(z, {
3288
+ key: 0,
3289
+ size: "icon",
3290
+ variant: "ghost",
3291
+ title: s.$td("errors.viewLogs", "View error logs"),
3292
+ "aria-label": s.$td("errors.viewLogs", "View error logs"),
3293
+ onClick: e[0] || (e[0] = (r) => s.$ui.modal(Ea))
3294
+ }, {
3295
+ default: f(() => [
3296
+ p(l($a), { class: "size-6 text-red-500" })
3297
+ ]),
3298
+ _: 1
3299
+ }, 8, ["title", "aria-label"])) : M("", !0);
3300
+ }
3301
+ }), bl = /* @__PURE__ */ g({
3302
+ __name: "ErrorMessage",
3303
+ props: {
3304
+ error: {}
3305
+ },
3306
+ setup(t) {
3307
+ const s = u(() => ht(t.error));
3308
+ return (e, r) => (c(), h(T, {
3309
+ text: s.value,
3310
+ inline: ""
3311
+ }, null, 8, ["text"]));
3312
+ }
3313
+ }), yl = /* @__PURE__ */ g({
3314
+ __name: "Link",
3315
+ props: {
3316
+ class: {},
3317
+ disabled: { type: Boolean },
3318
+ href: {},
3319
+ route: {},
3320
+ routeParams: {},
3321
+ routeQuery: {},
3322
+ size: {},
3323
+ submit: { type: Boolean },
3324
+ asChild: { type: Boolean },
3325
+ as: {}
3326
+ },
3327
+ setup(t) {
3328
+ return (s, e) => (c(), h(z, H({ variant: "link" }, s.$props), {
3329
+ default: f(() => [
3330
+ w(s.$slots, "default")
3331
+ ]),
3332
+ _: 3
3333
+ }, 16));
3334
+ }
3335
+ }), wl = /* @__PURE__ */ g({
3336
+ __name: "SettingsModal",
3337
+ setup(t) {
3338
+ const s = u(() => Nt(D.settings, "priority", "desc"));
3339
+ return (e, r) => (c(), h(Y, {
3340
+ title: e.$td("settings.title", "Settings")
3341
+ }, {
3342
+ default: f(() => [
3343
+ (c(!0), b(j, null, F(s.value, (n, a) => (c(), h(N(n.component), { key: a }))), 128))
3344
+ ]),
3345
+ _: 1
3346
+ }, 8, ["title"]));
3347
+ }
3348
+ });
3349
+ class _l {
3350
+ constructor() {
3351
+ _(this, "status");
3352
+ _(this, "_listeners");
3353
+ _(this, "_progress");
3354
+ _(this, "_cancelled");
3355
+ _(this, "_started");
3356
+ _(this, "_completed");
3357
+ this.status = this.getInitialStatus(), this._listeners = new Wt(), this._started = new W(), this._completed = new W();
3358
+ }
3359
+ async start() {
3360
+ this.beforeStart(), this._started.resolve();
3361
+ try {
3362
+ await this.updateProgress(), await this.run(), await this.updateProgress(), this._completed.resolve();
3363
+ } catch (s) {
3364
+ if (s instanceof Be)
3365
+ return;
3366
+ throw X(Kt(s), (e) => {
3367
+ this._completed.reject(e);
3368
+ });
3369
+ }
3370
+ }
3371
+ async cancel() {
3372
+ this._cancelled = new W(), await this._cancelled;
3373
+ }
3374
+ serialize() {
3375
+ return this.serializeStatus(this.status);
3376
+ }
3377
+ get listeners() {
3378
+ return this._listeners;
3379
+ }
3380
+ get progress() {
3381
+ return this._progress ?? 0;
3382
+ }
3383
+ get cancelled() {
3384
+ var s;
3385
+ return !!((s = this._cancelled) != null && s.isResolved());
3386
+ }
3387
+ get started() {
3388
+ return this._started;
3389
+ }
3390
+ get completed() {
3391
+ return this._completed;
3392
+ }
3393
+ getInitialStatus() {
3394
+ return { completed: !1 };
3395
+ }
3396
+ beforeStart() {
3397
+ if (this._started.isResolved()) {
3398
+ if (this._cancelled) {
3399
+ delete this._progress, delete this._cancelled;
3400
+ return;
3401
+ }
3402
+ throw new Error("Job already started!");
3403
+ }
3404
+ }
3405
+ assertNotCancelled() {
3406
+ if (this._cancelled)
3407
+ throw this._cancelled.resolve(), new Be();
3408
+ }
3409
+ calculateCurrentProgress(s) {
3410
+ return s ?? (s = this.status), s.completed ? 1 : s.children ? Qt(
3411
+ s.children.reduce((e, r) => e + this.calculateCurrentProgress(r), 0) / s.children.length,
3412
+ 2
3413
+ ) : 0;
3414
+ }
3415
+ async updateProgress(s) {
3416
+ await (s == null ? void 0 : s(this.status));
3417
+ const e = this.calculateCurrentProgress();
3418
+ e !== this._progress && (this._progress = e, await this._listeners.emit("onUpdated", e));
3419
+ }
3420
+ serializeStatus(s) {
3421
+ return { ...s };
3422
+ }
3423
+ }
3424
+ async function $l(t) {
3425
+ await t.start();
3426
+ }
3427
+ export {
3428
+ ml as AdvancedOptions,
3429
+ Qr as AlertModal,
3430
+ D as App,
3431
+ dl as AppLayout,
3432
+ oa as AppModals,
3433
+ ca as AppOverlays,
3434
+ Ps as AppService,
3435
+ ia as AppToasts,
3436
+ z as Button,
3437
+ Na as Cache,
3438
+ Us as CacheService,
3439
+ fl as Checkbox,
3440
+ tn as ConfirmModal,
3441
+ hl as DropdownMenu,
3442
+ ga as DropdownMenuOption,
3443
+ va as DropdownMenuOptions,
3444
+ gl as EditableContent,
3445
+ vl as ErrorLogs,
3446
+ Ea as ErrorLogsModal,
3447
+ bl as ErrorMessage,
3448
+ Vn as ErrorReportModal,
3449
+ _n as ErrorReportModalButtons,
3450
+ $n as ErrorReportModalTitle,
3451
+ et as Errors,
3452
+ qa as EventListenerPriorities,
3453
+ I as Events,
3454
+ Ts as EventsService,
3455
+ vt as Form,
3456
+ mr as FormController,
3457
+ tt as HeadlessButton,
3458
+ wt as HeadlessInput,
3459
+ qn as HeadlessInputDescription,
3460
+ Me as HeadlessInputError,
3461
+ _t as HeadlessInputInput,
3462
+ Se as HeadlessInputLabel,
3463
+ pl as HeadlessInputTextArea,
3464
+ jr as HeadlessModal,
3465
+ Br as HeadlessModalContent,
3466
+ qr as HeadlessModalDescription,
3467
+ Fr as HeadlessModalOverlay,
3468
+ Ur as HeadlessModalTitle,
3469
+ fr as HeadlessSelect,
3470
+ De as HeadlessSelectLabel,
3471
+ ct as HeadlessSelectOption,
3472
+ ut as HeadlessSelectOptions,
3473
+ it as HeadlessSelectTrigger,
3474
+ ot as HeadlessSelectValue,
3475
+ sr as HeadlessSwitch,
3476
+ ta as HeadlessToast,
3477
+ On as Input,
3478
+ _l as Job,
3479
+ Be as JobCancelledError,
3480
+ Q as Lang,
3481
+ pe as Layouts,
3482
+ yl as Link,
3483
+ Dn as LoadingModal,
3484
+ Xe as MOBILE_BREAKPOINT,
3485
+ T as Markdown,
3486
+ Y as Modal,
3487
+ gt as ModalContext,
3488
+ An as ProgressBar,
3489
+ Qn as PromptModal,
3490
+ br as Select,
3491
+ dt as SelectLabel,
3492
+ je as SelectOption,
3493
+ pt as SelectOptions,
3494
+ mt as SelectTrigger,
3495
+ ve as Service,
3496
+ ke as ServiceBootError,
3497
+ wl as SettingsModal,
3498
+ Yn as StartupCrash,
3499
+ Ns as Storage,
3500
+ rr as Switch,
3501
+ sa as Toast,
3502
+ R as UI,
3503
+ Js as UIService,
3504
+ Ja as __objectType,
3505
+ tl as booleanInput,
3506
+ be as bootServices,
3507
+ ul as bootstrap,
3508
+ aa as bootstrapApplication,
3509
+ E as classes,
3510
+ Ga as computedAsync,
3511
+ Ya as computedDebounce,
3512
+ sl as dateInput,
3513
+ Oa as defineDirective,
3514
+ Qa as defineFormValidationRule,
3515
+ Ua as definePlugin,
3516
+ ge as defineServiceState,
3517
+ Is as defineServiceStore,
3518
+ Fa as defineSettings,
3519
+ $l as dispatch,
3520
+ Ge as getCurrentLayout,
3521
+ ht as getErrorMessage,
3522
+ or as getMarkdownRouter,
3523
+ Ls as getPiniaStore,
3524
+ ur as hasSelectOptionLabel,
3525
+ js as injectOrFail,
3526
+ Ds as injectReactive,
3527
+ V as injectReactiveOrFail,
3528
+ As as installPlugins,
3529
+ ol as numberInput,
3530
+ il as objectInput,
3531
+ Za as onCleanMounted,
3532
+ nt as onFormFocus,
3533
+ Xa as persistent,
3534
+ el as registerErrorHandler,
3535
+ ir as renderMarkdown,
3536
+ Ze as renderVNode,
3537
+ Wa as replaceExisting,
3538
+ rl as requiredBooleanInput,
3539
+ nl as requiredDateInput,
3540
+ al as requiredNumberInput,
3541
+ ll as requiredObjectInput,
3542
+ Nn as requiredStringInput,
3543
+ Vs as resetPiniaStore,
3544
+ cr as safeHtml,
3545
+ Ka as setMarkdownRouter,
3546
+ cl as stringInput,
3547
+ Ye as translate,
3548
+ S as translateWithDefault,
3549
+ Kr as useAlertModal,
3550
+ Jr as useConfirmModal,
3551
+ xn as useErrorReportModal,
3552
+ rt as useEvent,
3553
+ at as useForm,
3554
+ lt as useInputAttrs,
3555
+ zn as useLoadingModal,
3556
+ Wn as usePromptModal,
3557
+ pr as validate,
3558
+ ue as validators,
3559
+ st as variantClasses
3560
+ };
3561
+ //# sourceMappingURL=aerogel-core.js.map