@aerogel/core 0.0.0-next.7f6ed5a1f91688a86bf5ede2adc465e4fd6cfdea → 0.0.0-next.8323c60b905020dcb3bd9d4b0bc8d9b6529e1082

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