@aerogel/core 0.0.0-next.c29ffcd25bffdbed37ecce3aac1ba14cde3e9d39 → 0.0.0-next.c3236837f7f8fc319a4a56022accb32757b3db89

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