@aerogel/core 0.0.0-next.9f9564ab9f8da05f60d7868db361edbc5601ee39 → 0.0.0-next.a3d64a2a6fe8f788cc0fdd63d5ad52404d5058d4

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 (211) hide show
  1. package/dist/aerogel-core.css +1 -0
  2. package/dist/aerogel-core.d.ts +2251 -1693
  3. package/dist/aerogel-core.js +3712 -0
  4. package/dist/aerogel-core.js.map +1 -0
  5. package/package.json +32 -37
  6. package/src/bootstrap/bootstrap.test.ts +4 -8
  7. package/src/bootstrap/index.ts +25 -16
  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} +11 -11
  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 -9
  49. package/src/components/ui/AdvancedOptions.vue +18 -0
  50. package/src/components/ui/AlertModal.vue +17 -0
  51. package/src/components/ui/Button.vue +115 -0
  52. package/src/components/ui/Checkbox.vue +56 -0
  53. package/src/components/ui/ConfirmModal.vue +50 -0
  54. package/src/components/ui/DropdownMenu.vue +32 -0
  55. package/src/components/ui/DropdownMenuOption.vue +22 -0
  56. package/src/components/ui/DropdownMenuOptions.vue +44 -0
  57. package/src/components/ui/EditableContent.vue +82 -0
  58. package/src/components/ui/ErrorLogs.vue +19 -0
  59. package/src/components/ui/ErrorLogsModal.vue +48 -0
  60. package/src/components/ui/ErrorMessage.vue +15 -0
  61. package/src/components/ui/ErrorReportModal.vue +73 -0
  62. package/src/components/{modals/AGErrorReportModalButtons.vue → ui/ErrorReportModalButtons.vue} +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/ui/ModalContext.vue +31 -0
  71. package/src/components/ui/ProgressBar.vue +51 -0
  72. package/src/components/ui/PromptModal.vue +38 -0
  73. package/src/components/ui/Select.vue +27 -0
  74. package/src/components/ui/SelectLabel.vue +21 -0
  75. package/src/components/ui/SelectOption.vue +29 -0
  76. package/src/components/ui/SelectOptions.vue +35 -0
  77. package/src/components/ui/SelectTrigger.vue +29 -0
  78. package/src/components/ui/Setting.vue +31 -0
  79. package/src/components/ui/SettingsModal.vue +15 -0
  80. package/src/components/{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 +33 -8
  87. package/src/errors/Errors.state.ts +1 -1
  88. package/src/errors/Errors.ts +29 -27
  89. package/src/errors/JobCancelledError.ts +3 -0
  90. package/src/errors/index.ts +15 -8
  91. package/src/errors/settings/Debug.vue +32 -0
  92. package/src/errors/settings/index.ts +10 -0
  93. package/src/errors/utils.ts +17 -1
  94. package/src/forms/FormController.test.ts +113 -0
  95. package/src/forms/{Form.ts → FormController.ts} +73 -42
  96. package/src/forms/index.ts +3 -3
  97. package/src/forms/utils.ts +65 -24
  98. package/src/forms/validation.ts +50 -0
  99. package/src/index.css +76 -0
  100. package/src/jobs/Job.ts +144 -2
  101. package/src/jobs/index.ts +4 -1
  102. package/src/jobs/listeners.ts +3 -0
  103. package/src/jobs/status.ts +4 -0
  104. package/src/lang/DefaultLangProvider.ts +46 -0
  105. package/src/lang/Lang.state.ts +11 -0
  106. package/src/lang/Lang.ts +40 -17
  107. package/src/lang/index.ts +12 -6
  108. package/src/lang/settings/Language.vue +48 -0
  109. package/src/lang/settings/index.ts +10 -0
  110. package/src/plugins/Plugin.ts +1 -1
  111. package/src/plugins/index.ts +10 -7
  112. package/src/services/App.state.ts +36 -3
  113. package/src/services/App.ts +19 -3
  114. package/src/services/Cache.ts +1 -1
  115. package/src/services/Events.test.ts +8 -8
  116. package/src/services/Events.ts +16 -12
  117. package/src/services/Service.ts +125 -54
  118. package/src/services/Storage.ts +20 -0
  119. package/src/services/index.ts +16 -7
  120. package/src/services/utils.ts +18 -0
  121. package/src/testing/index.ts +8 -3
  122. package/src/testing/setup.ts +11 -0
  123. package/src/ui/UI.state.ts +14 -12
  124. package/src/ui/UI.ts +250 -123
  125. package/src/ui/index.ts +28 -28
  126. package/src/ui/utils.ts +16 -0
  127. package/src/utils/classes.ts +41 -0
  128. package/src/utils/composition/events.ts +4 -6
  129. package/src/utils/composition/forms.ts +20 -4
  130. package/src/utils/composition/persistent.test.ts +33 -0
  131. package/src/utils/composition/persistent.ts +11 -0
  132. package/src/utils/composition/state.test.ts +47 -0
  133. package/src/utils/composition/state.ts +33 -0
  134. package/src/utils/index.ts +5 -1
  135. package/src/utils/markdown.test.ts +50 -0
  136. package/src/utils/markdown.ts +53 -6
  137. package/src/utils/types.ts +3 -0
  138. package/src/utils/vue.ts +38 -132
  139. package/dist/aerogel-core.cjs.js +0 -2
  140. package/dist/aerogel-core.cjs.js.map +0 -1
  141. package/dist/aerogel-core.esm.js +0 -2
  142. package/dist/aerogel-core.esm.js.map +0 -1
  143. package/histoire.config.ts +0 -7
  144. package/noeldemartin.config.js +0 -5
  145. package/postcss.config.js +0 -6
  146. package/src/assets/histoire.css +0 -3
  147. package/src/components/AGAppLayout.vue +0 -16
  148. package/src/components/AGAppOverlays.vue +0 -41
  149. package/src/components/AGAppSnackbars.vue +0 -13
  150. package/src/components/constants.ts +0 -8
  151. package/src/components/forms/AGButton.vue +0 -44
  152. package/src/components/forms/AGCheckbox.vue +0 -41
  153. package/src/components/forms/AGInput.vue +0 -40
  154. package/src/components/forms/AGSelect.story.vue +0 -46
  155. package/src/components/forms/AGSelect.vue +0 -60
  156. package/src/components/forms/index.ts +0 -5
  157. package/src/components/headless/forms/AGHeadlessButton.vue +0 -56
  158. package/src/components/headless/forms/AGHeadlessInput.ts +0 -32
  159. package/src/components/headless/forms/AGHeadlessInput.vue +0 -57
  160. package/src/components/headless/forms/AGHeadlessInputInput.vue +0 -81
  161. package/src/components/headless/forms/AGHeadlessSelect.ts +0 -42
  162. package/src/components/headless/forms/AGHeadlessSelect.vue +0 -77
  163. package/src/components/headless/forms/AGHeadlessSelectButton.vue +0 -24
  164. package/src/components/headless/forms/AGHeadlessSelectLabel.vue +0 -24
  165. package/src/components/headless/forms/AGHeadlessSelectOption.ts +0 -4
  166. package/src/components/headless/forms/AGHeadlessSelectOption.vue +0 -39
  167. package/src/components/headless/forms/AGHeadlessSelectOptions.ts +0 -3
  168. package/src/components/headless/forms/composition.ts +0 -10
  169. package/src/components/headless/forms/index.ts +0 -17
  170. package/src/components/headless/modals/AGHeadlessModal.ts +0 -34
  171. package/src/components/headless/modals/AGHeadlessModal.vue +0 -86
  172. package/src/components/headless/modals/AGHeadlessModalPanel.vue +0 -28
  173. package/src/components/headless/modals/AGHeadlessModalTitle.vue +0 -13
  174. package/src/components/headless/modals/index.ts +0 -4
  175. package/src/components/headless/snackbars/AGHeadlessSnackbar.vue +0 -10
  176. package/src/components/headless/snackbars/index.ts +0 -40
  177. package/src/components/lib/AGErrorMessage.vue +0 -16
  178. package/src/components/lib/AGLink.vue +0 -9
  179. package/src/components/lib/AGMarkdown.vue +0 -41
  180. package/src/components/lib/AGMeasured.vue +0 -15
  181. package/src/components/lib/index.ts +0 -5
  182. package/src/components/modals/AGAlertModal.ts +0 -15
  183. package/src/components/modals/AGAlertModal.vue +0 -14
  184. package/src/components/modals/AGConfirmModal.ts +0 -27
  185. package/src/components/modals/AGConfirmModal.vue +0 -26
  186. package/src/components/modals/AGErrorReportModal.ts +0 -46
  187. package/src/components/modals/AGErrorReportModal.vue +0 -54
  188. package/src/components/modals/AGErrorReportModalTitle.vue +0 -25
  189. package/src/components/modals/AGLoadingModal.ts +0 -23
  190. package/src/components/modals/AGLoadingModal.vue +0 -15
  191. package/src/components/modals/AGModal.ts +0 -10
  192. package/src/components/modals/AGModal.vue +0 -39
  193. package/src/components/modals/AGModalContext.ts +0 -8
  194. package/src/components/modals/AGModalContext.vue +0 -22
  195. package/src/components/modals/AGModalTitle.vue +0 -9
  196. package/src/components/modals/AGPromptModal.ts +0 -30
  197. package/src/components/modals/AGPromptModal.vue +0 -34
  198. package/src/components/modals/index.ts +0 -17
  199. package/src/components/snackbars/AGSnackbar.vue +0 -36
  200. package/src/components/snackbars/index.ts +0 -3
  201. package/src/components/utils.ts +0 -10
  202. package/src/directives/initial-focus.ts +0 -11
  203. package/src/forms/Form.test.ts +0 -58
  204. package/src/forms/composition.ts +0 -6
  205. package/src/main.histoire.ts +0 -1
  206. package/src/utils/tailwindcss.test.ts +0 -26
  207. package/src/utils/tailwindcss.ts +0 -7
  208. package/tailwind.config.js +0 -4
  209. package/tsconfig.json +0 -11
  210. package/vite.config.ts +0 -14
  211. /package/src/{main.ts → index.ts} +0 -0
@@ -0,0 +1,3712 @@
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 Tt, toRef as Pe, useTemplateRef as Y, withModifiers as We, withDirectives as Ke, vModelCheckbox as Lt, normalizeStyle as It, createApp as Rt, vModelText as At } from "vue";
5
+ import { JSError as be, 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 Te, 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 Le = null;
20
+ function Ye() {
21
+ return Le ?? Ts();
22
+ }
23
+ function Ts() {
24
+ return G(Zt(), (t) => {
25
+ Le = t, Xt(t);
26
+ });
27
+ }
28
+ function Ls() {
29
+ return Le ?? 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 Na = {
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 L = ee(Rs);
245
+ function Wa(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
+ L.once("application-ready", () => this.ready.resolve()), L.once("application-mounted", () => this.mounted.resolve());
301
+ }
302
+ }
303
+ const D = ee(Ps);
304
+ function Ka(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 Qa(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 Ja = ee(Os);
383
+ class Ns extends we {
384
+ async purge() {
385
+ await L.emit("purge-storage");
386
+ }
387
+ }
388
+ const Ws = ee(Ns);
389
+ function Za(t, s) {
390
+ return {
391
+ ...t,
392
+ ...oe(s, Object.keys(t))
393
+ };
394
+ }
395
+ const Ks = {
396
+ $app: D,
397
+ $events: L,
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(Ls()), (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 L.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
+ L.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
+ }), L.on("modal-has-closed", async ({ modal: { id: e }, result: r }) => {
573
+ await this.removeModal(e, r);
574
+ });
575
+ }
576
+ watchMountedEvent() {
577
+ L.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 L.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 Xa(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 = L.on(t, s);
980
+ ge(() => e());
981
+ }
982
+ const cr = {
983
+ required: (t) => t ? void 0 : "required"
984
+ };
985
+ function ur(t, s) {
986
+ var e;
987
+ if (t == null)
988
+ return !0;
989
+ switch (s.type) {
990
+ case "string":
991
+ return typeof t == "string";
992
+ case "enum":
993
+ return !!((e = s.values) != null && e.includes(t));
994
+ case "number":
995
+ return typeof t == "number";
996
+ case "boolean":
997
+ return typeof t == "boolean";
998
+ case "date":
999
+ return t instanceof Date;
1000
+ case "object":
1001
+ return typeof t == "object";
1002
+ }
1003
+ }
1004
+ const de = { ...cr };
1005
+ function Ya(t, s) {
1006
+ de[t] = s;
1007
+ }
1008
+ function dr(t, s) {
1009
+ return ur(t, s) ? [] : ["invalid_value"];
1010
+ }
1011
+ function pr(t, s) {
1012
+ var r;
1013
+ const e = (r = de[s]) == null ? void 0 : r.call(de, t);
1014
+ return e ? Je(e) : [];
1015
+ }
1016
+ const Ga = Symbol(), Be = /* @__PURE__ */ new WeakMap();
1017
+ class mr extends Qe {
1018
+ constructor(e) {
1019
+ super();
1020
+ _(this, "errors");
1021
+ _(this, "_fields");
1022
+ _(this, "_data");
1023
+ _(this, "_submitted");
1024
+ _(this, "_errors");
1025
+ _(this, "_listeners", {});
1026
+ this._fields = e, this._submitted = B(!1), this._data = this.getInitialData(e), this._errors = this.getInitialErrors(e), Be.set(
1027
+ this,
1028
+ u(() => !Object.values(this._errors).some((r) => r !== null))
1029
+ ), this.errors = ve(this._errors);
1030
+ }
1031
+ get valid() {
1032
+ var e;
1033
+ return !!((e = Be.get(this)) != null && e.value);
1034
+ }
1035
+ get submitted() {
1036
+ return this._submitted.value;
1037
+ }
1038
+ setFieldValue(e, r) {
1039
+ const n = this._fields[e] ?? Q(`Trying to set undefined '${q(e)}' field`);
1040
+ this._data[e] = n.type === "string" && (n.trim ?? !0) ? q(r).trim() : r, this._submitted.value && this.validate();
1041
+ }
1042
+ getFieldValue(e) {
1043
+ return this._data[e];
1044
+ }
1045
+ getFieldRules(e) {
1046
+ var r, n;
1047
+ return ((n = (r = this._fields[e]) == null ? void 0 : r.rules) == null ? void 0 : n.split("|")) ?? [];
1048
+ }
1049
+ getFieldType(e) {
1050
+ var r;
1051
+ return ((r = this._fields[e]) == null ? void 0 : r.type) ?? null;
1052
+ }
1053
+ data() {
1054
+ return { ...this._data };
1055
+ }
1056
+ validate() {
1057
+ const e = Object.entries(this._fields).reduce(
1058
+ (r, [n, a]) => (r[n] = this.getFieldErrors(n, a), r),
1059
+ {}
1060
+ );
1061
+ return this.resetErrors(e), this.valid;
1062
+ }
1063
+ reset(e = {}) {
1064
+ this._submitted.value = !1, e.keepData || this.resetData(), e.keepErrors || this.resetErrors();
1065
+ }
1066
+ submit() {
1067
+ var r;
1068
+ this._submitted.value = !0;
1069
+ const e = this.validate();
1070
+ return e && ((r = this._listeners.submit) == null || r.forEach((n) => n())), e;
1071
+ }
1072
+ on(e, r) {
1073
+ var n, a;
1074
+ return (n = this._listeners)[e] ?? (n[e] = []), (a = this._listeners[e]) == null || a.push(r), () => this.off(e, r);
1075
+ }
1076
+ off(e, r) {
1077
+ Se(this._listeners[e] ?? [], r);
1078
+ }
1079
+ async focus(e) {
1080
+ var r;
1081
+ await Oe(), (r = this._listeners.focus) == null || r.forEach((n) => n(e));
1082
+ }
1083
+ __get(e) {
1084
+ return e in this._fields ? this.getFieldValue(e) : super.__get(e);
1085
+ }
1086
+ __set(e, r) {
1087
+ if (!(e in this._fields)) {
1088
+ super.__set(e, r);
1089
+ return;
1090
+ }
1091
+ this.setFieldValue(e, r);
1092
+ }
1093
+ getFieldErrors(e, r) {
1094
+ var l;
1095
+ const n = [], a = this._data[e], i = ((l = r.rules) == null ? void 0 : l.split("|")) ?? [];
1096
+ n.push(...dr(a, r));
1097
+ for (const d of i)
1098
+ d !== "required" && a == null || n.push(...pr(a, d));
1099
+ return n.length > 0 ? n : null;
1100
+ }
1101
+ getInitialData(e) {
1102
+ if (this.static().isConjuring())
1103
+ return {};
1104
+ const r = Object.entries(e).reduce((n, [a, i]) => (n[a] = i.default ?? null, n), {});
1105
+ return pe(r);
1106
+ }
1107
+ getInitialErrors(e) {
1108
+ if (this.static().isConjuring())
1109
+ return {};
1110
+ const r = Object.keys(e).reduce((n, a) => (n[a] = null, n), {});
1111
+ return pe(r);
1112
+ }
1113
+ resetData() {
1114
+ for (const [e, r] of Object.entries(this._fields))
1115
+ this._data[e] = r.default ?? null;
1116
+ }
1117
+ resetErrors(e) {
1118
+ Object.keys(this._errors).forEach((r) => delete this._errors[r]), e && Object.assign(this._errors, e);
1119
+ }
1120
+ }
1121
+ function ot(t, s) {
1122
+ const e = Z("form", null), r = e == null ? void 0 : e.on("focus", (n) => t.name === n && s());
1123
+ ge(() => r == null ? void 0 : r());
1124
+ }
1125
+ function it(t) {
1126
+ return new mr(t);
1127
+ }
1128
+ function Ie() {
1129
+ const t = Ne(), s = u(() => t.class);
1130
+ return [u(() => qt(t, "class")), s];
1131
+ }
1132
+ function el(t) {
1133
+ let s = Ft;
1134
+ Ht(() => s = t()), ge(() => s());
1135
+ }
1136
+ function tl(t, s) {
1137
+ const e = pe(U.get(t) ?? s);
1138
+ return Ee(e, () => U.set(t, Vt(e))), e;
1139
+ }
1140
+ function sl(t) {
1141
+ const s = B(), e = u(t);
1142
+ return Ee(e, async () => s.value = await e.value, { immediate: !0 }), s;
1143
+ }
1144
+ function rl(t, s) {
1145
+ const e = s ? t : {}, r = s ?? t, n = B(e.initial ?? null), a = Ut((i) => n.value = i, e.delay ?? 300);
1146
+ return X(() => a(r())), n;
1147
+ }
1148
+ const ct = /* @__PURE__ */ g({
1149
+ __name: "HeadlessSelectValue",
1150
+ setup(t) {
1151
+ const s = V(
1152
+ "select",
1153
+ "<HeadlessSelectValue> must be a child of a <HeadlessSelect>"
1154
+ );
1155
+ return (e, r) => e.$slots.default ? (c(), h(o(je), {
1156
+ key: 0,
1157
+ placeholder: o(s).placeholder
1158
+ }, {
1159
+ default: f(() => [
1160
+ w(e.$slots, "default")
1161
+ ]),
1162
+ _: 3
1163
+ }, 8, ["placeholder"])) : (c(), h(o(je), {
1164
+ key: 1,
1165
+ placeholder: o(s).placeholder
1166
+ }, null, 8, ["placeholder"]));
1167
+ }
1168
+ }), ut = /* @__PURE__ */ g({
1169
+ __name: "HeadlessSelectTrigger",
1170
+ setup(t) {
1171
+ const s = V(
1172
+ "select",
1173
+ "<HeadlessSelectTrigger> must be a child of a <HeadlessSelect>"
1174
+ );
1175
+ return (e, r) => (c(), h(o(as), {
1176
+ id: o(s).id
1177
+ }, {
1178
+ default: f(() => [
1179
+ w(e.$slots, "default", {}, () => [
1180
+ m(ct, {
1181
+ placeholder: o(s).placeholder
1182
+ }, null, 8, ["placeholder"]),
1183
+ m(o(ls))
1184
+ ])
1185
+ ]),
1186
+ _: 3
1187
+ }, 8, ["id"]));
1188
+ }
1189
+ }), dt = /* @__PURE__ */ g({
1190
+ __name: "HeadlessSelectOption",
1191
+ props: {
1192
+ value: {},
1193
+ disabled: { type: Boolean },
1194
+ textValue: {},
1195
+ asChild: { type: Boolean },
1196
+ as: {}
1197
+ },
1198
+ setup(t) {
1199
+ const s = V(
1200
+ "select",
1201
+ "<HeadlessSelectOption> must be a child of a <HeadlessSelect>"
1202
+ ), e = u(() => {
1203
+ var n;
1204
+ const r = (n = s.options) == null ? void 0 : n.find((a) => a.value === t.value);
1205
+ return r ? r.label : q(t.value);
1206
+ });
1207
+ return (r, n) => (c(), h(o(os), ne(ae(r.$props)), {
1208
+ default: f(() => [
1209
+ m(o(is), null, {
1210
+ default: f(() => [
1211
+ w(r.$slots, "default", {}, () => [
1212
+ P(k(e.value), 1)
1213
+ ])
1214
+ ]),
1215
+ _: 3
1216
+ })
1217
+ ]),
1218
+ _: 3
1219
+ }, 16));
1220
+ }
1221
+ }), pt = /* @__PURE__ */ g({
1222
+ __name: "HeadlessSelectOptions",
1223
+ props: {
1224
+ class: {},
1225
+ innerClass: {}
1226
+ },
1227
+ setup(t) {
1228
+ const s = V(
1229
+ "select",
1230
+ "<HeadlessSelectOptions> must be a child of a <HeadlessSelect>"
1231
+ ), e = u(() => E("min-w-(--reka-select-trigger-width) max-h-(--reka-select-content-available-height)", t.class));
1232
+ return (r, n) => (c(), h(o(cs), null, {
1233
+ default: f(() => [
1234
+ m(o(us), {
1235
+ position: "popper",
1236
+ class: C(e.value),
1237
+ align: o(s).align,
1238
+ side: o(s).side,
1239
+ "side-offset": 4
1240
+ }, {
1241
+ default: f(() => [
1242
+ m(o(ds), {
1243
+ class: C(r.innerClass)
1244
+ }, {
1245
+ default: f(() => [
1246
+ w(r.$slots, "default", {}, () => [
1247
+ (c(!0), b(j, null, F(o(s).options ?? [], (a) => (c(), h(dt, {
1248
+ key: a.key,
1249
+ value: a.value
1250
+ }, null, 8, ["value"]))), 128))
1251
+ ])
1252
+ ]),
1253
+ _: 3
1254
+ }, 8, ["class"])
1255
+ ]),
1256
+ _: 3
1257
+ }, 8, ["class", "align", "side"])
1258
+ ]),
1259
+ _: 3
1260
+ }));
1261
+ }
1262
+ }), fr = /* @__PURE__ */ g({
1263
+ inheritAttrs: !1,
1264
+ __name: "HeadlessSelect",
1265
+ props: {
1266
+ as: { default: "div" },
1267
+ options: {},
1268
+ placeholder: {},
1269
+ renderOption: { type: Function },
1270
+ compareOptions: { type: Function, default: (t, s) => t === s },
1271
+ labelClass: {},
1272
+ optionsClass: {},
1273
+ align: {},
1274
+ side: {},
1275
+ name: {},
1276
+ label: {},
1277
+ description: {},
1278
+ modelValue: {}
1279
+ },
1280
+ emits: ["update:modelValue"],
1281
+ setup(t, { expose: s, emit: e }) {
1282
+ 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) => ({
1283
+ key: re(),
1284
+ label: t.renderOption ? t.renderOption(p) : ir(p) ? Ot(p.label) : q(p),
1285
+ value: p
1286
+ })) : null), v = {
1287
+ labelClass: t.labelClass,
1288
+ optionsClass: t.optionsClass,
1289
+ align: t.align,
1290
+ side: t.side,
1291
+ value: a,
1292
+ id: `select-${re()}`,
1293
+ name: u(() => t.name),
1294
+ label: u(() => t.label),
1295
+ description: u(() => t.description),
1296
+ placeholder: u(() => t.placeholder ?? S("ui.select", "Select an option")),
1297
+ options: d,
1298
+ selectedOption: u(() => {
1299
+ var p;
1300
+ return (p = d.value) == null ? void 0 : p.find((x) => x.value === t.modelValue);
1301
+ }),
1302
+ errors: ve(l),
1303
+ required: u(() => {
1304
+ if (!(!t.name || !n))
1305
+ return n.getFieldRules(t.name).includes("required");
1306
+ }),
1307
+ update(p) {
1308
+ if (n && t.name) {
1309
+ n.setFieldValue(t.name, p);
1310
+ return;
1311
+ }
1312
+ r("update:modelValue", p);
1313
+ }
1314
+ };
1315
+ function $(p) {
1316
+ v.update(p);
1317
+ }
1318
+ return le("select", v), s(v), (p, x) => (c(), h(o(ps), {
1319
+ "model-value": i.value,
1320
+ by: p.compareOptions,
1321
+ "onUpdate:modelValue": x[0] || (x[0] = (T) => $(T))
1322
+ }, {
1323
+ default: f(({ open: T }) => [
1324
+ (c(), h(W(p.as), ne(ae(p.$attrs)), {
1325
+ default: f(() => [
1326
+ w(p.$slots, "default", {
1327
+ modelValue: p.modelValue,
1328
+ open: T
1329
+ }, () => [
1330
+ m(ut),
1331
+ m(pt)
1332
+ ])
1333
+ ]),
1334
+ _: 2
1335
+ }, 1040))
1336
+ ]),
1337
+ _: 3
1338
+ }, 8, ["model-value", "by"]));
1339
+ }
1340
+ }), qe = /* @__PURE__ */ g({
1341
+ __name: "HeadlessSelectLabel",
1342
+ props: {
1343
+ asChild: { type: Boolean },
1344
+ as: {}
1345
+ },
1346
+ setup(t) {
1347
+ const s = V(
1348
+ "select",
1349
+ "<HeadlessSelectLabel> must be a child of a <HeadlessSelect>"
1350
+ ), e = He(), r = u(() => !!(s.label || e.default));
1351
+ return (n, a) => r.value ? (c(), h(o(ms), H({
1352
+ key: 0,
1353
+ for: o(s).id
1354
+ }, n.$props), {
1355
+ default: f(() => [
1356
+ w(n.$slots, "default", {}, () => [
1357
+ P(k(o(s).label), 1)
1358
+ ])
1359
+ ]),
1360
+ _: 3
1361
+ }, 16, ["for"])) : M("", !0);
1362
+ }
1363
+ }), mt = /* @__PURE__ */ g({
1364
+ __name: "SelectLabel",
1365
+ props: {
1366
+ class: {}
1367
+ },
1368
+ setup(t) {
1369
+ 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));
1370
+ return (r, n) => r.$slots.default ? (c(), h(qe, {
1371
+ key: 0,
1372
+ class: C(e.value)
1373
+ }, {
1374
+ default: f(() => [
1375
+ w(r.$slots, "default")
1376
+ ]),
1377
+ _: 3
1378
+ }, 8, ["class"])) : (c(), h(qe, {
1379
+ key: 1,
1380
+ class: C(e.value)
1381
+ }, null, 8, ["class"]));
1382
+ }
1383
+ }), Fe = /* @__PURE__ */ g({
1384
+ __name: "SelectOption",
1385
+ props: {
1386
+ value: {},
1387
+ class: {},
1388
+ innerClass: {}
1389
+ },
1390
+ setup(t) {
1391
+ const s = u(() => E("group p-1 outline-none", t.class)), e = u(() => E(
1392
+ // eslint-disable-next-line vue/max-len
1393
+ "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",
1394
+ t.innerClass
1395
+ ));
1396
+ return (r, n) => (c(), h(dt, {
1397
+ class: C(s.value),
1398
+ value: r.value
1399
+ }, {
1400
+ default: f(() => [
1401
+ y("div", {
1402
+ class: C(e.value)
1403
+ }, [
1404
+ w(r.$slots, "default")
1405
+ ], 2)
1406
+ ]),
1407
+ _: 3
1408
+ }, 8, ["class", "value"]));
1409
+ }
1410
+ }), ft = /* @__PURE__ */ g({
1411
+ __name: "SelectOptions",
1412
+ props: {
1413
+ class: {}
1414
+ },
1415
+ setup(t) {
1416
+ const s = V("select", "<SelectOptions> must be a child of a <Select>"), e = u(() => E(
1417
+ "z-50 overflow-auto rounded-lg bg-white text-base shadow-lg ring-1 ring-black/5 focus:outline-hidden",
1418
+ s.optionsClass,
1419
+ t.class
1420
+ ));
1421
+ return (r, n) => (c(), h(pt, {
1422
+ class: C(e.value)
1423
+ }, {
1424
+ default: f(() => {
1425
+ var a;
1426
+ return [
1427
+ (a = o(s).options) != null && a.length ? w(r.$slots, "default", { key: 0 }, () => {
1428
+ var i;
1429
+ return [
1430
+ (c(!0), b(j, null, F(((i = o(s)) == null ? void 0 : i.options) ?? [], (l) => (c(), h(Fe, {
1431
+ key: l.key,
1432
+ value: l.value
1433
+ }, {
1434
+ default: f(() => [
1435
+ P(k(l.label), 1)
1436
+ ]),
1437
+ _: 2
1438
+ }, 1032, ["value"]))), 128))
1439
+ ];
1440
+ }) : w(r.$slots, "default", { key: 1 }, () => [
1441
+ m(Fe, {
1442
+ disabled: "",
1443
+ value: null
1444
+ }, {
1445
+ default: f(() => [
1446
+ P(k(r.$td("ui.selectEmpty", "No options available")), 1)
1447
+ ]),
1448
+ _: 1
1449
+ })
1450
+ ])
1451
+ ];
1452
+ }),
1453
+ _: 3
1454
+ }, 8, ["class"]));
1455
+ }
1456
+ }), hr = {
1457
+ viewBox: "0 0 20 20",
1458
+ width: "1.2em",
1459
+ height: "1.2em"
1460
+ };
1461
+ function gr(t, s) {
1462
+ return c(), b("svg", hr, s[0] || (s[0] = [
1463
+ y("path", {
1464
+ fill: "currentColor",
1465
+ d: "m9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828L5.757 6.586L4.343 8z"
1466
+ }, null, -1)
1467
+ ]));
1468
+ }
1469
+ const vr = A({ name: "zondicons-cheveron-down", render: gr }), ht = /* @__PURE__ */ g({
1470
+ __name: "SelectTrigger",
1471
+ props: {
1472
+ class: {}
1473
+ },
1474
+ setup(t) {
1475
+ const s = V("select", "<SelectTrigger> must be a child of a <Select>"), e = u(() => E(
1476
+ // eslint-disable-next-line vue/max-len
1477
+ "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",
1478
+ { "mt-1": s.label },
1479
+ t.class
1480
+ ));
1481
+ return (r, n) => (c(), h(ut, {
1482
+ class: C(e.value)
1483
+ }, {
1484
+ default: f(() => [
1485
+ m(ct, { class: "col-start-1 row-start-1 truncate pr-6" }),
1486
+ m(o(vr), { class: "col-start-1 row-start-1 size-5 self-center justify-self-end text-gray-500 sm:size-4" })
1487
+ ]),
1488
+ _: 1
1489
+ }, 8, ["class"]));
1490
+ }
1491
+ }), br = /* @__PURE__ */ g({
1492
+ __name: "Select",
1493
+ props: {
1494
+ as: {},
1495
+ options: {},
1496
+ placeholder: {},
1497
+ renderOption: { type: Function },
1498
+ compareOptions: { type: Function },
1499
+ labelClass: {},
1500
+ optionsClass: {},
1501
+ align: {},
1502
+ side: {},
1503
+ name: {},
1504
+ label: {},
1505
+ description: {},
1506
+ modelValue: {}
1507
+ },
1508
+ emits: ["update:modelValue"],
1509
+ setup(t) {
1510
+ const { forwardRef: s } = Te();
1511
+ return (e, r) => (c(), h(fr, H({ ref: o(s) }, e.$props, {
1512
+ "onUpdate:modelValue": r[0] || (r[0] = (n) => e.$emit("update:modelValue", n))
1513
+ }), {
1514
+ default: f(() => [
1515
+ m(mt),
1516
+ w(e.$slots, "default", {}, () => [
1517
+ m(ht),
1518
+ m(ft)
1519
+ ])
1520
+ ]),
1521
+ _: 3
1522
+ }, 16));
1523
+ }
1524
+ }), yr = { class: "grow" }, wr = /* @__PURE__ */ g({
1525
+ __name: "Language",
1526
+ setup(t) {
1527
+ const s = J.getBrowserLocale(), e = u(() => [null, ...J.locales]);
1528
+ function r(n) {
1529
+ return (n && O.locales[n]) ?? S("settings.localeDefault", "{locale} (default)", {
1530
+ locale: O.locales[s] ?? s
1531
+ });
1532
+ }
1533
+ return (n, a) => (c(), h(br, {
1534
+ modelValue: n.$lang.locale,
1535
+ "onUpdate:modelValue": a[0] || (a[0] = (i) => n.$lang.locale = i),
1536
+ class: "flex flex-col items-start md:flex-row",
1537
+ as: "div",
1538
+ options: e.value,
1539
+ "render-option": r
1540
+ }, {
1541
+ default: f(() => [
1542
+ y("div", yr, [
1543
+ m(mt, { class: "text-base font-semibold" }, {
1544
+ default: f(() => [
1545
+ P(k(n.$td("settings.locale", "Language")), 1)
1546
+ ]),
1547
+ _: 1
1548
+ }),
1549
+ m(I, {
1550
+ "lang-key": "settings.localeDescription",
1551
+ "lang-default": "Choose the application's language.",
1552
+ class: "mt-1 text-sm text-gray-500"
1553
+ })
1554
+ ]),
1555
+ m(z, {
1556
+ variant: "ghost",
1557
+ as: ht,
1558
+ class: "grid w-auto outline-none"
1559
+ }),
1560
+ m(ft)
1561
+ ]),
1562
+ _: 1
1563
+ }, 8, ["modelValue", "options"]));
1564
+ }
1565
+ }), $r = [
1566
+ {
1567
+ priority: 100,
1568
+ component: wr
1569
+ }
1570
+ ], _r = { $lang: J }, xr = {
1571
+ async install(t) {
1572
+ var s;
1573
+ (s = t.config.globalProperties).$t ?? (s.$t = st), t.config.globalProperties.$td = S, $r.forEach((e) => D.addSetting(e)), await $e(t, _r);
1574
+ }
1575
+ }, Cr = /* @__PURE__ */ g({
1576
+ __name: "Markdown",
1577
+ props: {
1578
+ as: {},
1579
+ inline: { type: Boolean },
1580
+ langKey: {},
1581
+ langParams: {},
1582
+ langDefault: {},
1583
+ text: {},
1584
+ actions: {}
1585
+ },
1586
+ setup(t) {
1587
+ 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(() => {
1588
+ if (!r.value)
1589
+ return null;
1590
+ let l = lr(r.value);
1591
+ return t.inline && (l = l.replace("<p>", "<span>").replace("</p>", "</span>")), l;
1592
+ }), a = () => Tt(t.as ?? (t.inline ? "span" : "div"), {
1593
+ innerHTML: n.value,
1594
+ onClick: i,
1595
+ ...s,
1596
+ class: `${s.class ?? ""} ${t.inline ? "" : "prose"}`
1597
+ });
1598
+ async function i(l) {
1599
+ var v, $;
1600
+ const { target: d } = l;
1601
+ if (ze(d, HTMLElement) && d.dataset.markdownAction) {
1602
+ ($ = (v = t.actions) == null ? void 0 : v[d.dataset.markdownAction]) == null || $.call(v);
1603
+ return;
1604
+ }
1605
+ if (ze(d, HTMLAnchorElement) && d.dataset.markdownRoute) {
1606
+ const p = ar();
1607
+ p && (l.preventDefault(), p.visit(d.dataset.markdownRoute));
1608
+ return;
1609
+ }
1610
+ }
1611
+ return (l, d) => (c(), h(a));
1612
+ }
1613
+ }), kr = (t, s) => {
1614
+ const e = t.__vccOpts || t;
1615
+ for (const [r, n] of s)
1616
+ e[r] = n;
1617
+ return e;
1618
+ }, I = /* @__PURE__ */ kr(Cr, [["__scopeId", "data-v-8b211cfb"]]), Sr = { class: "flex-grow" }, Mr = ["id"], Er = /* @__PURE__ */ g({
1619
+ __name: "Setting",
1620
+ props: {
1621
+ title: {},
1622
+ titleId: {},
1623
+ description: {},
1624
+ class: {},
1625
+ layout: { default: "horizontal" }
1626
+ },
1627
+ setup(t) {
1628
+ const s = u(() => E(t.class, "flex flex-col justify-center gap-1"));
1629
+ return (e, r) => (c(), b("div", {
1630
+ class: C(["mt-4 flex", { "flex-col": e.layout === "vertical" }])
1631
+ }, [
1632
+ y("div", Sr, [
1633
+ y("h3", {
1634
+ id: e.titleId,
1635
+ class: "text-base font-semibold"
1636
+ }, k(e.title), 9, Mr),
1637
+ e.description ? (c(), h(I, {
1638
+ key: 0,
1639
+ text: e.description,
1640
+ class: "mt-1 text-sm text-gray-500"
1641
+ }, null, 8, ["text"])) : M("", !0)
1642
+ ]),
1643
+ y("div", {
1644
+ class: C(s.value)
1645
+ }, [
1646
+ w(e.$slots, "default")
1647
+ ], 2)
1648
+ ], 2));
1649
+ }
1650
+ }), Hr = ["for"], Vr = /* @__PURE__ */ g({
1651
+ inheritAttrs: !1,
1652
+ __name: "HeadlessSwitch",
1653
+ props: {
1654
+ name: {},
1655
+ label: {},
1656
+ description: {},
1657
+ modelValue: {},
1658
+ class: {},
1659
+ labelClass: {},
1660
+ inputClass: {},
1661
+ thumbClass: {}
1662
+ },
1663
+ emits: ["update:modelValue"],
1664
+ setup(t, { expose: s, emit: e }) {
1665
+ const r = e, n = Z("form", null), a = u(() => !n || !t.name ? null : n.errors[t.name] ?? null), i = {
1666
+ id: `switch-${re()}`,
1667
+ name: u(() => t.name),
1668
+ label: u(() => t.label),
1669
+ description: u(() => t.description),
1670
+ value: u(() => n && t.name ? n.getFieldValue(t.name) : t.modelValue),
1671
+ errors: ve(a),
1672
+ required: u(() => {
1673
+ if (!(!t.name || !n))
1674
+ return n.getFieldRules(t.name).includes("required");
1675
+ }),
1676
+ update(l) {
1677
+ if (n && t.name) {
1678
+ n.setFieldValue(t.name, l);
1679
+ return;
1680
+ }
1681
+ r("update:modelValue", l);
1682
+ }
1683
+ };
1684
+ return s(i), X(() => {
1685
+ !t.description && !a.value || console.warn("Errors and description not implemented in <HeadlessSwitch>");
1686
+ }), (l, d) => (c(), b("div", {
1687
+ class: C(t.class)
1688
+ }, [
1689
+ l.label ? (c(), b("label", {
1690
+ key: 0,
1691
+ for: i.id,
1692
+ class: C(l.labelClass)
1693
+ }, k(l.label), 11, Hr)) : M("", !0),
1694
+ m(o(fs), H({
1695
+ id: i.id,
1696
+ name: l.name,
1697
+ "model-value": i.value.value
1698
+ }, l.$attrs, {
1699
+ class: l.inputClass,
1700
+ "onUpdate:modelValue": d[0] || (d[0] = (v) => l.$emit("update:modelValue", v))
1701
+ }), {
1702
+ default: f(() => [
1703
+ m(o(hs), {
1704
+ class: C(l.thumbClass)
1705
+ }, null, 8, ["class"])
1706
+ ]),
1707
+ _: 1
1708
+ }, 16, ["id", "name", "model-value", "class"])
1709
+ ], 2));
1710
+ }
1711
+ }), Tr = /* @__PURE__ */ g({
1712
+ __name: "Switch",
1713
+ setup(t) {
1714
+ return (s, e) => (c(), h(Vr, {
1715
+ class: "flex flex-row items-center gap-1",
1716
+ "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",
1717
+ "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"
1718
+ }));
1719
+ }
1720
+ }), Lr = /* @__PURE__ */ g({
1721
+ __name: "Debug",
1722
+ setup(t) {
1723
+ let s = null;
1724
+ const e = B(!1);
1725
+ return X(async () => {
1726
+ if (!e.value) {
1727
+ s == null || s.destroy();
1728
+ return;
1729
+ }
1730
+ s ?? (s = (await import("eruda")).default), s.init();
1731
+ }), (r, n) => (c(), h(Er, {
1732
+ "title-id": "debug-setting",
1733
+ title: r.$td("settings.debug", "Debugging"),
1734
+ description: r.$td("settings.debugDescription", "Enable debugging with [Eruda](https://eruda.liriliri.io/).")
1735
+ }, {
1736
+ default: f(() => [
1737
+ m(Tr, {
1738
+ modelValue: e.value,
1739
+ "onUpdate:modelValue": n[0] || (n[0] = (a) => e.value = a),
1740
+ "aria-labelledby": "debug-setting"
1741
+ }, null, 8, ["modelValue"])
1742
+ ]),
1743
+ _: 1
1744
+ }, 8, ["title", "description"]));
1745
+ }
1746
+ }), Ir = [
1747
+ {
1748
+ priority: 10,
1749
+ component: Lr
1750
+ }
1751
+ ], gt = [];
1752
+ function nl(t) {
1753
+ gt.push(t);
1754
+ }
1755
+ function vt(t) {
1756
+ for (const s of gt) {
1757
+ const e = s(t);
1758
+ if (e)
1759
+ return e;
1760
+ }
1761
+ 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");
1762
+ }
1763
+ class Ue extends be {
1764
+ }
1765
+ const Rr = { $errors: rt }, Ar = (t) => (rt.report(t), !0);
1766
+ function Pr(t, s = () => !1) {
1767
+ const e = (r) => s(r) || Ar(r);
1768
+ t.config.errorHandler = e, globalThis.onerror = (r, n, a, i, l) => e(l ?? r), globalThis.onunhandledrejection = (r) => e(r.reason);
1769
+ }
1770
+ const zr = {
1771
+ async install(t, s) {
1772
+ Pr(t, s.handleError), Ir.forEach((e) => D.addSetting(e)), await $e(t, Rr);
1773
+ }
1774
+ }, Dr = {
1775
+ async install() {
1776
+ Ve() && (globalThis.testingRuntime = {
1777
+ on: (...t) => L.on(...t),
1778
+ service: (t) => D.service(t)
1779
+ });
1780
+ }
1781
+ }, jr = {
1782
+ viewBox: "0 0 20 20",
1783
+ width: "1.2em",
1784
+ height: "1.2em"
1785
+ };
1786
+ function Br(t, s) {
1787
+ return c(), b("svg", jr, s[0] || (s[0] = [
1788
+ y("path", {
1789
+ fill: "currentColor",
1790
+ 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"
1791
+ }, null, -1)
1792
+ ]));
1793
+ }
1794
+ const qr = A({ name: "zondicons-close", render: Br }), Fr = /* @__PURE__ */ g({
1795
+ __name: "HeadlessModal",
1796
+ props: {
1797
+ persistent: { type: Boolean },
1798
+ title: {},
1799
+ titleHidden: { type: Boolean },
1800
+ description: {},
1801
+ descriptionHidden: { type: Boolean }
1802
+ },
1803
+ setup(t, { expose: s }) {
1804
+ const e = B(null), { modal: r } = V(
1805
+ "modal",
1806
+ "could not obtain modal reference from <HeadlessModal>, did you render this component manually? Show it using $ui.modal() instead"
1807
+ );
1808
+ s({ close: i, $content: e });
1809
+ const { forwardRef: n } = Te(), a = B(!1);
1810
+ le("$modalContentRef", e), lt("close-modal", async ({ id: l, result: d }) => {
1811
+ l === r.id && await i(d);
1812
+ });
1813
+ async function i(l) {
1814
+ a.value || (await L.emit("modal-will-close", { modal: r, result: l }), a.value = !0, await L.emit("modal-has-closed", { modal: r, result: l }));
1815
+ }
1816
+ return (l, d) => (c(), h(o(gs), {
1817
+ ref: o(n),
1818
+ open: "",
1819
+ "onUpdate:open": d[0] || (d[0] = (v) => l.persistent || i())
1820
+ }, {
1821
+ default: f(() => [
1822
+ m(o(vs), null, {
1823
+ default: f(() => [
1824
+ w(l.$slots, "default", { close: i })
1825
+ ]),
1826
+ _: 3
1827
+ })
1828
+ ]),
1829
+ _: 3
1830
+ }, 512));
1831
+ }
1832
+ }), bt = /* @__PURE__ */ g({
1833
+ __name: "ModalContext",
1834
+ props: {
1835
+ modal: {},
1836
+ childIndex: {}
1837
+ },
1838
+ setup(t) {
1839
+ const s = t, e = u(() => {
1840
+ const r = {};
1841
+ for (const n in s.modal.properties)
1842
+ r[n] = o(s.modal.properties[n]);
1843
+ return r;
1844
+ });
1845
+ return le("modal", {
1846
+ modal: Pe(s, "modal"),
1847
+ childIndex: Pe(s, "childIndex")
1848
+ }), (r, n) => (c(), h(W(r.modal.component), ne(ae(e.value)), null, 16));
1849
+ }
1850
+ }), Ur = /* @__PURE__ */ g({
1851
+ __name: "HeadlessModalContent",
1852
+ setup(t) {
1853
+ const { childIndex: s = 0 } = V(
1854
+ "modal",
1855
+ "could not obtain modal reference from <HeadlessModalContent>, did you render this component manually? Show it using $ui.modal() instead"
1856
+ ), e = Bs("$modalContentRef"), r = Y("$contentRef"), n = u(() => R.modals[s] ?? null);
1857
+ return X(() => e.value = r.value), (a, i) => (c(), h(o(bs), { ref: "$contentRef" }, {
1858
+ default: f(() => [
1859
+ w(a.$slots, "default"),
1860
+ n.value ? (c(), h(bt, {
1861
+ key: 0,
1862
+ "child-index": o(s) + 1,
1863
+ modal: n.value
1864
+ }, null, 8, ["child-index", "modal"])) : M("", !0)
1865
+ ]),
1866
+ _: 3
1867
+ }, 512));
1868
+ }
1869
+ }), Or = /* @__PURE__ */ g({
1870
+ __name: "HeadlessModalDescription",
1871
+ props: {
1872
+ asChild: { type: Boolean },
1873
+ as: {}
1874
+ },
1875
+ setup(t) {
1876
+ return (s, e) => (c(), h(o(ys), ne(ae(s.$props)), {
1877
+ default: f(() => [
1878
+ w(s.$slots, "default")
1879
+ ]),
1880
+ _: 3
1881
+ }, 16));
1882
+ }
1883
+ }), Nr = /* @__PURE__ */ g({
1884
+ __name: "HeadlessModalOverlay",
1885
+ props: {
1886
+ forceMount: { type: Boolean },
1887
+ asChild: { type: Boolean },
1888
+ as: {}
1889
+ },
1890
+ setup(t) {
1891
+ return (s, e) => (c(), h(o(ws), ne(ae(s.$props)), {
1892
+ default: f(() => [
1893
+ w(s.$slots, "default")
1894
+ ]),
1895
+ _: 3
1896
+ }, 16));
1897
+ }
1898
+ }), Wr = /* @__PURE__ */ g({
1899
+ __name: "HeadlessModalTitle",
1900
+ props: {
1901
+ asChild: { type: Boolean },
1902
+ as: {}
1903
+ },
1904
+ setup(t) {
1905
+ return (s, e) => (c(), h(o($s), ne(ae(s.$props)), {
1906
+ default: f(() => [
1907
+ w(s.$slots, "default")
1908
+ ]),
1909
+ _: 3
1910
+ }, 16));
1911
+ }
1912
+ }), Kr = {
1913
+ key: 0,
1914
+ class: "absolute top-0 right-0 hidden pt-3.5 pr-2.5 sm:block"
1915
+ }, Qr = ["onClick"], Jr = { class: "sr-only" }, te = /* @__PURE__ */ g({
1916
+ __name: "Modal",
1917
+ props: {
1918
+ persistent: { type: Boolean },
1919
+ title: {},
1920
+ titleHidden: { type: Boolean },
1921
+ description: {},
1922
+ descriptionHidden: { type: Boolean },
1923
+ wrapperClass: { default: "" },
1924
+ class: { default: "" },
1925
+ closeHidden: { type: Boolean }
1926
+ },
1927
+ setup(t, { expose: s }) {
1928
+ const e = N(t, ["class", "wrapperClass", "title", "titleHidden", "description", "persistent", "closeHidden"]);
1929
+ s({
1930
+ close: async (p) => {
1931
+ var x;
1932
+ return (x = a.value) == null ? void 0 : x.close(p);
1933
+ },
1934
+ $content: u(() => {
1935
+ var p;
1936
+ return (p = a.value) == null ? void 0 : p.$content;
1937
+ })
1938
+ });
1939
+ const { forwardRef: r, currentRef: n } = Te(), a = n, i = V("modal"), l = u(() => !i.modal.closing && i.childIndex === R.openModals.length), d = u(() => t.description ? {} : { "aria-describedby": void 0 }), v = u(() => E("max-h-[90vh] overflow-auto px-4 pb-4", { "pt-4": !t.title || t.titleHidden }, t.class)), $ = u(() => E(
1940
+ "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",
1941
+ "overflow-hidden rounded-lg bg-white text-left shadow-xl sm:max-w-lg",
1942
+ "animate-[fade-in_var(--tw-duration)_ease-in-out,grow_var(--tw-duration)_ease-in-out]",
1943
+ "transition-[scale,opacity] will-change-[scale,opacity] duration-300",
1944
+ {
1945
+ "scale-50 opacity-0": !l.value,
1946
+ "scale-100 opacity-100": l.value
1947
+ },
1948
+ t.wrapperClass
1949
+ ));
1950
+ return lt("modal-will-close", async ({ modal: { id: p } }) => {
1951
+ p === i.modal.id && await ce({ ms: 300 });
1952
+ }), (p, x) => (c(), h(Fr, H(e, {
1953
+ ref: (T) => o(r)(T),
1954
+ persistent: p.persistent
1955
+ }), {
1956
+ default: f(({ close: T }) => [
1957
+ m(Nr, {
1958
+ class: C(["fixed inset-0 animate-[fade-in_var(--tw-duration)_ease-in-out] transition-opacity duration-300 will-change-[opacity]", {
1959
+ "bg-black/30": o(i).childIndex === 1,
1960
+ "opacity-0": o(i).childIndex === 1 && o(i).modal.closing
1961
+ }])
1962
+ }, null, 8, ["class"]),
1963
+ m(Ur, H(d.value, { class: $.value }), {
1964
+ default: f(() => [
1965
+ !p.persistent && !p.closeHidden ? (c(), b("div", Kr, [
1966
+ y("button", {
1967
+ type: "button",
1968
+ class: "clickable z-10 rounded-full p-2.5 text-gray-400 hover:text-gray-500",
1969
+ onClick: (_e) => T()
1970
+ }, [
1971
+ y("span", Jr, k(p.$td("ui.close", "Close")), 1),
1972
+ m(o(qr), { class: "size-4" })
1973
+ ], 8, Qr)
1974
+ ])) : M("", !0),
1975
+ p.title ? (c(), h(Wr, {
1976
+ key: 1,
1977
+ class: C(["px-4 pt-5 text-base font-semibold text-gray-900", {
1978
+ "sr-only": p.titleHidden,
1979
+ "pb-0": p.description && !p.descriptionHidden,
1980
+ "pb-2": !p.description || p.descriptionHidden
1981
+ }])
1982
+ }, {
1983
+ default: f(() => [
1984
+ m(I, {
1985
+ text: p.title,
1986
+ inline: ""
1987
+ }, null, 8, ["text"])
1988
+ ]),
1989
+ _: 1
1990
+ }, 8, ["class"])) : M("", !0),
1991
+ p.description ? (c(), h(Or, {
1992
+ key: 2,
1993
+ class: C(["px-4 pt-1 pb-2", { "sr-only": p.descriptionHidden }])
1994
+ }, {
1995
+ default: f(() => [
1996
+ m(I, {
1997
+ text: p.description,
1998
+ class: "text-sm leading-6 text-gray-500"
1999
+ }, null, 8, ["text"])
2000
+ ]),
2001
+ _: 1
2002
+ }, 8, ["class"])) : M("", !0),
2003
+ y("div", {
2004
+ class: C(v.value)
2005
+ }, [
2006
+ w(p.$slots, "default", { close: T })
2007
+ ], 2)
2008
+ ]),
2009
+ _: 2
2010
+ }, 1040, ["class"])
2011
+ ]),
2012
+ _: 3
2013
+ }, 16, ["persistent"]));
2014
+ }
2015
+ });
2016
+ function Zr(t) {
2017
+ const s = u(() => t.title ?? S("ui.alert", "Alert")), e = u(() => !t.title);
2018
+ return { renderedTitle: s, titleHidden: e };
2019
+ }
2020
+ const Xr = /* @__PURE__ */ g({
2021
+ __name: "AlertModal",
2022
+ props: {
2023
+ title: {},
2024
+ message: {}
2025
+ },
2026
+ setup(t, { expose: s }) {
2027
+ const e = t, { renderedTitle: r, titleHidden: n } = Zr(e);
2028
+ return s(), (a, i) => (c(), h(te, {
2029
+ title: o(r),
2030
+ "title-hidden": o(n)
2031
+ }, {
2032
+ default: f(() => [
2033
+ m(I, { text: a.message }, null, 8, ["text"])
2034
+ ]),
2035
+ _: 1
2036
+ }, 8, ["title", "title-hidden"]));
2037
+ }
2038
+ }), yt = /* @__PURE__ */ g({
2039
+ __name: "Form",
2040
+ props: {
2041
+ form: {}
2042
+ },
2043
+ emits: ["submit"],
2044
+ setup(t, { emit: s }) {
2045
+ let e;
2046
+ const r = s;
2047
+ return X((n) => {
2048
+ var a;
2049
+ e == null || e(), e = (a = t.form) == null ? void 0 : a.on("submit", () => r("submit")), n(() => e == null ? void 0 : e());
2050
+ }), le("form", t.form), (n, a) => (c(), b("form", {
2051
+ onSubmit: a[0] || (a[0] = We((i) => {
2052
+ var l;
2053
+ return (l = n.form) == null ? void 0 : l.submit();
2054
+ }, ["prevent"]))
2055
+ }, [
2056
+ w(n.$slots, "default")
2057
+ ], 32));
2058
+ }
2059
+ });
2060
+ function Yr(t) {
2061
+ const s = it(
2062
+ Object.entries(t.checkboxes ?? {}).reduce(
2063
+ (i, [l, d]) => ({
2064
+ [l]: {
2065
+ type: "boolean",
2066
+ default: d.default,
2067
+ required: d.required ? "required" : void 0
2068
+ },
2069
+ ...i
2070
+ }),
2071
+ {}
2072
+ )
2073
+ ), 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"));
2074
+ return { form: s, renderedTitle: e, titleHidden: r, renderedAcceptText: n, renderedCancelText: a };
2075
+ }
2076
+ const Gr = {
2077
+ key: 0,
2078
+ class: "mt-4 flex flex-col text-sm text-gray-600"
2079
+ }, en = { class: "flex items-center" }, tn = ["onUpdate:modelValue", "required"], sn = { class: "ml-1.5" }, rn = { class: "mt-4 flex flex-row-reverse gap-2" }, nn = /* @__PURE__ */ g({
2080
+ __name: "ConfirmModal",
2081
+ props: {
2082
+ title: {},
2083
+ message: {},
2084
+ acceptText: {},
2085
+ acceptVariant: {},
2086
+ cancelText: {},
2087
+ cancelVariant: { default: "secondary" },
2088
+ checkboxes: {},
2089
+ actions: {},
2090
+ required: { type: Boolean }
2091
+ },
2092
+ setup(t, { expose: s }) {
2093
+ const e = N(t, ["cancelVariant"]), { form: r, renderedTitle: n, titleHidden: a, renderedAcceptText: i, renderedCancelText: l } = Yr(e);
2094
+ return s(), (d, v) => (c(), h(te, {
2095
+ title: o(n),
2096
+ "title-hidden": o(a),
2097
+ persistent: ""
2098
+ }, {
2099
+ default: f(({ close: $ }) => [
2100
+ m(yt, {
2101
+ form: o(r),
2102
+ onSubmit: (p) => $([!0, o(r).data()])
2103
+ }, {
2104
+ default: f(() => [
2105
+ m(I, {
2106
+ text: d.message,
2107
+ actions: d.actions
2108
+ }, null, 8, ["text", "actions"]),
2109
+ d.checkboxes ? (c(), b("ul", Gr, [
2110
+ (c(!0), b(j, null, F(d.checkboxes, (p, x) => (c(), b("li", { key: x }, [
2111
+ y("label", en, [
2112
+ Ke(y("input", {
2113
+ "onUpdate:modelValue": (T) => o(r)[x] = T,
2114
+ type: "checkbox",
2115
+ required: p.required,
2116
+ 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"
2117
+ }, null, 8, tn), [
2118
+ [Lt, o(r)[x]]
2119
+ ]),
2120
+ y("span", sn, k(p.label), 1)
2121
+ ])
2122
+ ]))), 128))
2123
+ ])) : M("", !0),
2124
+ y("div", rn, [
2125
+ m(z, {
2126
+ variant: d.acceptVariant,
2127
+ submit: ""
2128
+ }, {
2129
+ default: f(() => [
2130
+ P(k(o(i)), 1)
2131
+ ]),
2132
+ _: 1
2133
+ }, 8, ["variant"]),
2134
+ d.required ? M("", !0) : (c(), h(z, {
2135
+ key: 0,
2136
+ variant: d.cancelVariant,
2137
+ onClick: (p) => $(!1)
2138
+ }, {
2139
+ default: f(() => [
2140
+ P(k(o(l)), 1)
2141
+ ]),
2142
+ _: 2
2143
+ }, 1032, ["variant", "onClick"]))
2144
+ ])
2145
+ ]),
2146
+ _: 2
2147
+ }, 1032, ["form", "onSubmit"])
2148
+ ]),
2149
+ _: 1
2150
+ }, 8, ["title", "title-hidden"]));
2151
+ }
2152
+ }), an = {
2153
+ viewBox: "0 0 20 20",
2154
+ width: "1.2em",
2155
+ height: "1.2em"
2156
+ };
2157
+ function ln(t, s) {
2158
+ return c(), b("svg", an, s[0] || (s[0] = [
2159
+ y("path", {
2160
+ fill: "currentColor",
2161
+ d: "M7.05 9.293L6.343 10L12 15.657l1.414-1.414L9.172 10l4.242-4.243L12 4.343z"
2162
+ }, null, -1)
2163
+ ]));
2164
+ }
2165
+ const on = A({ name: "zondicons-cheveron-left", render: ln }), cn = {
2166
+ viewBox: "0 0 20 20",
2167
+ width: "1.2em",
2168
+ height: "1.2em"
2169
+ };
2170
+ function un(t, s) {
2171
+ return c(), b("svg", cn, s[0] || (s[0] = [
2172
+ y("path", {
2173
+ fill: "currentColor",
2174
+ d: "m12.95 10.707l.707-.707L8 4.343L6.586 5.757L10.828 10l-4.242 4.243L8 15.657z"
2175
+ }, null, -1)
2176
+ ]));
2177
+ }
2178
+ const wt = A({ name: "zondicons-cheveron-right", render: un }), dn = {
2179
+ viewBox: "0 0 20 20",
2180
+ width: "1.2em",
2181
+ height: "1.2em"
2182
+ };
2183
+ function pn(t, s) {
2184
+ return c(), b("svg", dn, s[0] || (s[0] = [
2185
+ y("path", {
2186
+ fill: "currentColor",
2187
+ d: "M2.93 17.07A10 10 0 1 1 17.07 2.93A10 10 0 0 1 2.93 17.07M9 5v6h2V5zm0 8v2h2v-2z"
2188
+ }, null, -1)
2189
+ ]));
2190
+ }
2191
+ const Re = A({ name: "zondicons-exclamation-solid", render: pn }), mn = {
2192
+ viewBox: "0 0 24 24",
2193
+ width: "1.2em",
2194
+ height: "1.2em"
2195
+ };
2196
+ function fn(t, s) {
2197
+ return c(), b("svg", mn, s[0] || (s[0] = [
2198
+ y("path", {
2199
+ fill: "currentColor",
2200
+ 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"
2201
+ }, null, -1)
2202
+ ]));
2203
+ }
2204
+ const hn = A({ name: "mdi-console", render: fn }), gn = {
2205
+ viewBox: "0 0 20 20",
2206
+ width: "1.2em",
2207
+ height: "1.2em"
2208
+ };
2209
+ function vn(t, s) {
2210
+ return c(), b("svg", gn, s[0] || (s[0] = [
2211
+ y("path", {
2212
+ fill: "currentColor",
2213
+ 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"
2214
+ }, null, -1)
2215
+ ]));
2216
+ }
2217
+ const bn = A({ name: "zondicons-copy", render: vn }), yn = {
2218
+ viewBox: "0 0 24 24",
2219
+ width: "1.2em",
2220
+ height: "1.2em"
2221
+ };
2222
+ function wn(t, s) {
2223
+ return c(), b("svg", yn, s[0] || (s[0] = [
2224
+ y("path", {
2225
+ fill: "currentColor",
2226
+ 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"
2227
+ }, null, -1)
2228
+ ]));
2229
+ }
2230
+ const $n = A({ name: "mdi-github", render: wn }), _n = { class: "flex" }, xn = { class: "sr-only" }, Cn = /* @__PURE__ */ g({
2231
+ __name: "ErrorReportModalButtons",
2232
+ props: {
2233
+ report: {}
2234
+ },
2235
+ setup(t) {
2236
+ const s = t, e = u(() => s.report.description ? `${s.report.title}: ${s.report.description}` : s.report.title), r = u(() => {
2237
+ if (!D.sourceUrl)
2238
+ return !1;
2239
+ const a = encodeURIComponent(e.value), i = encodeURIComponent(
2240
+ [
2241
+ "[Please, explain here what you were trying to do when this error appeared]",
2242
+ "",
2243
+ "Error details:",
2244
+ "```",
2245
+ Nt(
2246
+ s.report.details ?? "Details missing from report",
2247
+ 1800 - a.length - D.sourceUrl.length
2248
+ ).trim(),
2249
+ "```"
2250
+ ].join(`
2251
+ `)
2252
+ );
2253
+ return `${D.sourceUrl}/issues/new?title=${a}&body=${i}`;
2254
+ }), n = u(() => G(
2255
+ [
2256
+ {
2257
+ id: "clipboard",
2258
+ description: "Copy to clipboard",
2259
+ iconComponent: bn,
2260
+ async click() {
2261
+ await navigator.clipboard.writeText(`${e.value}
2262
+
2263
+ ${s.report.details}`), R.toast(S("errors.copiedToClipboard", "Debug information copied to clipboard"));
2264
+ }
2265
+ },
2266
+ {
2267
+ id: "console",
2268
+ description: "Log to console",
2269
+ iconComponent: hn,
2270
+ click() {
2271
+ const a = s.report.error ?? s.report;
2272
+ window.error = a, console.error(a), R.toast(
2273
+ S(
2274
+ "errors.addedToConsole",
2275
+ "You can now use the **error** variable in the console"
2276
+ )
2277
+ );
2278
+ }
2279
+ }
2280
+ ],
2281
+ (a) => {
2282
+ r.value && a.push({
2283
+ id: "github",
2284
+ description: "Report in GitHub",
2285
+ iconComponent: $n,
2286
+ url: r.value
2287
+ });
2288
+ }
2289
+ ));
2290
+ return (a, i) => (c(), b("div", _n, [
2291
+ (c(!0), b(j, null, F(n.value, (l) => w(a.$slots, "default", H({ ref_for: !0 }, l), () => [
2292
+ m(z, {
2293
+ size: "icon",
2294
+ variant: "ghost",
2295
+ class: "group whitespace-nowrap",
2296
+ href: l.url,
2297
+ title: a.$td(`errors.report_${l.id}`, l.description),
2298
+ onClick: l.click
2299
+ }, {
2300
+ default: f(() => [
2301
+ y("span", xn, k(a.$td(`errors.report_${l.id}`, l.description)), 1),
2302
+ (c(), h(W(l.iconComponent), {
2303
+ class: "size-4",
2304
+ "aria-hidden": "true"
2305
+ }))
2306
+ ]),
2307
+ _: 2
2308
+ }, 1032, ["href", "title", "onClick"])
2309
+ ])), 256))
2310
+ ]));
2311
+ }
2312
+ }), kn = /* @__PURE__ */ g({
2313
+ __name: "ErrorReportModalTitle",
2314
+ props: {
2315
+ report: {},
2316
+ currentReport: {},
2317
+ totalReports: {}
2318
+ },
2319
+ setup(t) {
2320
+ const s = u(() => !t.totalReports || t.totalReports <= 1 ? t.report.title : `${t.report.title} (${t.currentReport}/${t.totalReports})`);
2321
+ return (e, r) => (c(), h(I, {
2322
+ text: s.value,
2323
+ inline: ""
2324
+ }, null, 8, ["text"]));
2325
+ }
2326
+ });
2327
+ function Sn(t) {
2328
+ const s = B(t.reports.includes(t.report) ? t.reports.indexOf(t.report) : 0), e = u(() => t.reports[s.value]), r = u(
2329
+ () => {
2330
+ var i;
2331
+ return ((i = e.value.details) == null ? void 0 : i.trim()) || S("errors.detailsEmpty", "This error is missing a stacktrace.");
2332
+ }
2333
+ ), n = S("errors.previousReport", "Show previous report"), a = S("errors.nextReport", "Show next report");
2334
+ return {
2335
+ activeReportIndex: s,
2336
+ details: r,
2337
+ nextReportText: a,
2338
+ previousReportText: n,
2339
+ activeReport: e
2340
+ };
2341
+ }
2342
+ const Mn = { class: "px-4 pt-5 pb-4" }, En = { class: "flex justify-between gap-4" }, Hn = { class: "flex items-center gap-2" }, Vn = {
2343
+ key: 0,
2344
+ class: "flex gap-0.5"
2345
+ }, Tn = { class: "-mt-2 max-h-[75vh] overflow-auto bg-red-800/10" }, Ln = ["textContent"], In = /* @__PURE__ */ g({
2346
+ __name: "ErrorReportModal",
2347
+ props: {
2348
+ report: {},
2349
+ reports: {}
2350
+ },
2351
+ setup(t, { expose: s }) {
2352
+ const e = t, { activeReportIndex: r, details: n, nextReportText: a, previousReportText: i, activeReport: l } = Sn(e);
2353
+ return s(), (d, v) => (c(), h(te, {
2354
+ title: d.$td("errors.report", "Error report"),
2355
+ "title-hidden": "",
2356
+ "close-hidden": "",
2357
+ class: "p-0",
2358
+ "wrapper-class": "sm:w-auto sm:min-w-lg sm:max-w-[80vw]"
2359
+ }, {
2360
+ default: f(() => [
2361
+ y("div", Mn, [
2362
+ y("h2", En, [
2363
+ y("div", Hn, [
2364
+ m(o(Re), { class: "size-5 text-red-600" }),
2365
+ m(kn, {
2366
+ class: "text-lg leading-6 font-semibold text-gray-900",
2367
+ report: o(l),
2368
+ "current-report": o(r) + 1,
2369
+ "total-reports": d.reports.length
2370
+ }, null, 8, ["report", "current-report", "total-reports"]),
2371
+ d.reports.length > 1 ? (c(), b("span", Vn, [
2372
+ m(z, {
2373
+ size: "icon",
2374
+ variant: "ghost",
2375
+ disabled: o(r) === 0,
2376
+ "aria-label": o(i),
2377
+ title: o(i),
2378
+ onClick: v[0] || (v[0] = ($) => r.value--)
2379
+ }, {
2380
+ default: f(() => [
2381
+ m(o(on), { class: "size-4" })
2382
+ ]),
2383
+ _: 1
2384
+ }, 8, ["disabled", "aria-label", "title"]),
2385
+ m(z, {
2386
+ size: "icon",
2387
+ variant: "ghost",
2388
+ disabled: o(r) === d.reports.length - 1,
2389
+ "aria-label": o(a),
2390
+ title: o(a),
2391
+ onClick: v[1] || (v[1] = ($) => r.value++)
2392
+ }, {
2393
+ default: f(() => [
2394
+ m(o(wt), { class: "size-4" })
2395
+ ]),
2396
+ _: 1
2397
+ }, 8, ["disabled", "aria-label", "title"])
2398
+ ])) : M("", !0)
2399
+ ]),
2400
+ m(Cn, {
2401
+ report: o(l),
2402
+ class: "gap-0.5"
2403
+ }, null, 8, ["report"])
2404
+ ]),
2405
+ o(l).description ? (c(), h(I, {
2406
+ key: 0,
2407
+ text: o(l).description,
2408
+ class: "text-gray-600"
2409
+ }, null, 8, ["text"])) : M("", !0)
2410
+ ]),
2411
+ y("div", Tn, [
2412
+ y("pre", {
2413
+ class: "p-4 text-xs text-red-800",
2414
+ textContent: k(o(n))
2415
+ }, null, 8, Ln)
2416
+ ])
2417
+ ]),
2418
+ _: 1
2419
+ }, 8, ["title"]));
2420
+ }
2421
+ }), Rn = {
2422
+ viewBox: "0 0 24 24",
2423
+ width: "1.2em",
2424
+ height: "1.2em"
2425
+ };
2426
+ function An(t, s) {
2427
+ return c(), b("svg", Rn, s[0] || (s[0] = [
2428
+ y("path", {
2429
+ fill: "currentColor",
2430
+ 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",
2431
+ opacity: ".25"
2432
+ }, null, -1),
2433
+ y("path", {
2434
+ fill: "currentColor",
2435
+ 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"
2436
+ }, [
2437
+ y("animateTransform", {
2438
+ attributeName: "transform",
2439
+ dur: "0.75s",
2440
+ repeatCount: "indefinite",
2441
+ type: "rotate",
2442
+ values: "0 12 12;360 12 12"
2443
+ })
2444
+ ], -1)
2445
+ ]));
2446
+ }
2447
+ const Pn = A({ name: "svg-spinners-90-ring-with-bg", render: An }), zn = { class: "mt-1 h-2 w-full overflow-hidden rounded-full bg-gray-200" }, Dn = { class: "sr-only" }, jn = /* @__PURE__ */ g({
2448
+ __name: "ProgressBar",
2449
+ props: {
2450
+ filledClass: {},
2451
+ progress: {},
2452
+ job: {}
2453
+ },
2454
+ setup(t) {
2455
+ let s;
2456
+ 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);
2457
+ return Ee(
2458
+ () => t.job,
2459
+ () => {
2460
+ s && s(), e.value = t.job ? t.job.progress : 0, s = t.job && t.job.listeners.add({ onUpdated: (a) => e.value = a });
2461
+ },
2462
+ { immediate: !0 }
2463
+ ), ge(() => s && s()), (a, i) => (c(), b("div", zn, [
2464
+ y("div", {
2465
+ class: C(r.value),
2466
+ style: It(`transform:translateX(-${(1 - n.value) * 100}%)`)
2467
+ }, null, 6),
2468
+ y("span", Dn, k(a.$td("ui.progress", "{progress}% complete", {
2469
+ progress: n.value * 100
2470
+ })), 1)
2471
+ ]));
2472
+ }
2473
+ });
2474
+ function Bn(t) {
2475
+ const s = u(() => t.title ?? S("ui.loading", "Loading")), e = u(
2476
+ () => t.message ?? S("ui.loadingInProgress", "Loading in progress...")
2477
+ ), r = u(() => typeof t.progress == "number" || !!t.job), n = u(() => !t.title);
2478
+ return { renderedTitle: s, renderedMessage: e, titleHidden: n, showProgress: r };
2479
+ }
2480
+ const qn = /* @__PURE__ */ g({
2481
+ __name: "LoadingModal",
2482
+ props: {
2483
+ title: {},
2484
+ message: {},
2485
+ progress: {},
2486
+ job: {}
2487
+ },
2488
+ setup(t, { expose: s }) {
2489
+ const e = t, { renderedTitle: r, renderedMessage: n, titleHidden: a, showProgress: i } = Bn(e);
2490
+ return s(), (l, d) => (c(), h(te, {
2491
+ persistent: "",
2492
+ class: C(["flex", { "flex-col-reverse": o(i), "items-center justify-center gap-2": !o(i) }]),
2493
+ "wrapper-class": "w-auto",
2494
+ title: o(r),
2495
+ "title-hidden": o(a)
2496
+ }, {
2497
+ default: f(() => [
2498
+ o(i) ? (c(), h(jn, {
2499
+ key: 0,
2500
+ progress: l.progress,
2501
+ job: l.job,
2502
+ class: "min-w-[min(400px,80vw)]"
2503
+ }, null, 8, ["progress", "job"])) : (c(), h(o(Pn), {
2504
+ key: 1,
2505
+ class: "text-primary-600 mr-1 size-6"
2506
+ })),
2507
+ m(I, { text: o(n) }, null, 8, ["text"])
2508
+ ]),
2509
+ _: 1
2510
+ }, 8, ["title", "title-hidden", "class"]));
2511
+ }
2512
+ }), Ae = /* @__PURE__ */ g({
2513
+ __name: "HeadlessInput",
2514
+ props: {
2515
+ name: {},
2516
+ label: {},
2517
+ description: {},
2518
+ modelValue: {},
2519
+ as: { default: "div" }
2520
+ },
2521
+ emits: ["update:modelValue"],
2522
+ setup(t, { expose: s, emit: e }) {
2523
+ const r = e, n = Z("form", null), a = u(() => !n || !t.name ? null : n.errors[t.name] ?? null), i = {
2524
+ id: `input-${re()}`,
2525
+ name: u(() => t.name),
2526
+ label: u(() => t.label),
2527
+ description: u(() => t.description),
2528
+ value: u(() => n && t.name ? n.getFieldValue(t.name) : t.modelValue),
2529
+ errors: ve(a),
2530
+ required: u(() => {
2531
+ if (!(!t.name || !n))
2532
+ return n.getFieldRules(t.name).includes("required");
2533
+ }),
2534
+ update(l) {
2535
+ if (n && t.name) {
2536
+ n.setFieldValue(t.name, l);
2537
+ return;
2538
+ }
2539
+ r("update:modelValue", l);
2540
+ }
2541
+ };
2542
+ return le("input", i), s(i), (l, d) => (c(), h(W(l.as), null, {
2543
+ default: f(() => [
2544
+ w(l.$slots, "default")
2545
+ ]),
2546
+ _: 3
2547
+ }));
2548
+ }
2549
+ }), Fn = ["for"], fe = /* @__PURE__ */ g({
2550
+ __name: "HeadlessInputLabel",
2551
+ setup(t) {
2552
+ const s = V("input", "<HeadlessInputLabel> must be a child of a <HeadlessInput>"), e = He(), r = u(() => !!(s.label || e.default));
2553
+ return (n, a) => r.value ? (c(), b("label", {
2554
+ key: 0,
2555
+ for: o(s).id
2556
+ }, [
2557
+ w(n.$slots, "default", {}, () => [
2558
+ P(k(o(s).label), 1)
2559
+ ])
2560
+ ], 8, Fn)) : M("", !0);
2561
+ }
2562
+ }), Un = ["id", "name", "checked", "type", "required", "aria-invalid", "aria-describedby"], $t = /* @__PURE__ */ g({
2563
+ __name: "HeadlessInputInput",
2564
+ props: {
2565
+ type: {}
2566
+ },
2567
+ setup(t) {
2568
+ 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(() => {
2569
+ if (t.type)
2570
+ return t.type;
2571
+ const $ = (n.value && (r == null ? void 0 : r.getFieldType(n.value))) ?? "";
2572
+ return ["text", "email", "number", "tel", "url"].includes($) ? $ : "text";
2573
+ }), l = u(() => {
2574
+ if (t.type === "checkbox")
2575
+ return !!a.value;
2576
+ });
2577
+ function d() {
2578
+ s.value && e.update(v());
2579
+ }
2580
+ function v() {
2581
+ if (!s.value)
2582
+ return null;
2583
+ switch (t.type) {
2584
+ case "checkbox":
2585
+ return s.value.checked;
2586
+ case "date":
2587
+ return s.value.valueAsDate;
2588
+ default:
2589
+ return s.value.value;
2590
+ }
2591
+ }
2592
+ return ot(e, () => {
2593
+ var $;
2594
+ return ($ = s.value) == null ? void 0 : $.focus();
2595
+ }), X(() => {
2596
+ if (s.value) {
2597
+ if (t.type === "date" && a.value instanceof Date) {
2598
+ s.value.valueAsDate = a.value;
2599
+ return;
2600
+ }
2601
+ s.value.value = a.value ?? null;
2602
+ }
2603
+ }), ($, p) => (c(), b("input", {
2604
+ id: o(e).id,
2605
+ ref: "$inputRef",
2606
+ name: n.value,
2607
+ checked: l.value,
2608
+ type: i.value,
2609
+ required: o(e).required ?? void 0,
2610
+ "aria-invalid": o(e).errors ? "true" : "false",
2611
+ "aria-describedby": o(e).errors ? `${o(e).id}-error` : o(e).description ? `${o(e).id}-description` : void 0,
2612
+ onInput: d
2613
+ }, null, 40, Un));
2614
+ }
2615
+ }), _t = /* @__PURE__ */ g({
2616
+ inheritAttrs: !1,
2617
+ __name: "HeadlessInputDescription",
2618
+ setup(t) {
2619
+ const s = V(
2620
+ "input",
2621
+ "<HeadlessInputDescription> must be a child of a <HeadlessInput>"
2622
+ ), e = u(() => typeof s.description == "string" ? s.description : ""), r = u(() => !!s.description);
2623
+ return (n, a) => w(n.$slots, "default", {
2624
+ id: `${o(s).id}-description`
2625
+ }, () => [
2626
+ r.value ? (c(), h(I, H({ key: 0 }, n.$attrs, {
2627
+ id: `${o(s).id}-description`,
2628
+ text: e.value
2629
+ }), null, 16, ["id", "text"])) : M("", !0)
2630
+ ]);
2631
+ }
2632
+ }), On = ["id"], he = /* @__PURE__ */ g({
2633
+ __name: "HeadlessInputError",
2634
+ setup(t) {
2635
+ 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);
2636
+ return (r, n) => e.value ? (c(), b("p", {
2637
+ key: 0,
2638
+ id: `${o(s).id}-error`
2639
+ }, k(e.value), 9, On)) : M("", !0);
2640
+ }
2641
+ }), Nn = {
2642
+ key: 0,
2643
+ class: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3"
2644
+ }, Wn = /* @__PURE__ */ g({
2645
+ inheritAttrs: !1,
2646
+ __name: "Input",
2647
+ props: {
2648
+ name: {},
2649
+ label: {},
2650
+ description: {},
2651
+ modelValue: {},
2652
+ inputClass: {},
2653
+ wrapperClass: {}
2654
+ },
2655
+ emits: ["update:modelValue"],
2656
+ setup(t) {
2657
+ 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(() => {
2658
+ var l, d, v;
2659
+ return E(
2660
+ // eslint-disable-next-line vue/max-len
2661
+ "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",
2662
+ {
2663
+ "focus:ring-primary-600": !((l = e.value) != null && l.errors),
2664
+ "text-gray-900 shadow-2xs ring-gray-900/10 placeholder:text-gray-400": !((d = e.value) != null && d.errors),
2665
+ "pr-10 text-red-900 ring-red-900/10 placeholder:text-red-300 focus:ring-red-500": (v = e.value) == null ? void 0 : v.errors
2666
+ },
2667
+ t.inputClass
2668
+ );
2669
+ });
2670
+ return (l, d) => (c(), h(Ae, H({
2671
+ ref: "$inputRef",
2672
+ label: l.label,
2673
+ class: o(n)
2674
+ }, s, {
2675
+ "onUpdate:modelValue": d[0] || (d[0] = (v) => l.$emit("update:modelValue", v))
2676
+ }), {
2677
+ default: f(() => {
2678
+ var v;
2679
+ return [
2680
+ m(fe, { class: "block text-sm leading-6 font-medium text-gray-900" }),
2681
+ y("div", {
2682
+ class: C(a.value)
2683
+ }, [
2684
+ m($t, H(o(r), { class: i.value }), null, 16, ["class"]),
2685
+ (v = o(e)) != null && v.errors ? (c(), b("div", Nn, [
2686
+ m(o(Re), { class: "size-5 text-red-500" })
2687
+ ])) : M("", !0)
2688
+ ], 2),
2689
+ m(_t, { class: "mt-2 text-sm text-gray-600" }),
2690
+ m(he, { class: "mt-2 text-sm text-red-600" })
2691
+ ];
2692
+ }),
2693
+ _: 1
2694
+ }, 16, ["label", "class"]));
2695
+ }
2696
+ });
2697
+ function al(t, s = {}) {
2698
+ return {
2699
+ default: t,
2700
+ type: "boolean",
2701
+ rules: s.rules
2702
+ };
2703
+ }
2704
+ function ll(t, s = {}) {
2705
+ return {
2706
+ default: t,
2707
+ type: "date",
2708
+ rules: s.rules
2709
+ };
2710
+ }
2711
+ function ol(t, s, e = {}) {
2712
+ return {
2713
+ default: s,
2714
+ type: "enum",
2715
+ rules: e.rules,
2716
+ values: t
2717
+ };
2718
+ }
2719
+ function il(t) {
2720
+ return {
2721
+ default: t,
2722
+ type: "boolean",
2723
+ rules: "required"
2724
+ };
2725
+ }
2726
+ function cl(t) {
2727
+ return {
2728
+ default: t,
2729
+ type: "date",
2730
+ rules: "required"
2731
+ };
2732
+ }
2733
+ function ul(t, s) {
2734
+ return {
2735
+ default: s,
2736
+ type: "enum",
2737
+ rules: "required",
2738
+ values: t
2739
+ };
2740
+ }
2741
+ function dl(t) {
2742
+ return {
2743
+ default: t,
2744
+ type: "number",
2745
+ rules: "required"
2746
+ };
2747
+ }
2748
+ function pl(t) {
2749
+ return {
2750
+ default: t,
2751
+ type: "object",
2752
+ rules: "required"
2753
+ };
2754
+ }
2755
+ function Kn(t) {
2756
+ return {
2757
+ default: t,
2758
+ type: "string",
2759
+ rules: "required"
2760
+ };
2761
+ }
2762
+ function ml(t, s = {}) {
2763
+ return {
2764
+ default: t,
2765
+ type: "number",
2766
+ rules: s.rules
2767
+ };
2768
+ }
2769
+ function fl(t, s = {}) {
2770
+ return {
2771
+ default: t,
2772
+ type: "object",
2773
+ rules: s.rules
2774
+ };
2775
+ }
2776
+ function hl(t, s = {}) {
2777
+ return {
2778
+ default: t,
2779
+ type: "string",
2780
+ rules: s.rules
2781
+ };
2782
+ }
2783
+ function Qn(t) {
2784
+ const s = it({
2785
+ draft: Kn(t.defaultValue ?? "")
2786
+ }), 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"));
2787
+ return { form: s, renderedTitle: e, renderedMessage: r, renderedAcceptText: n, renderedCancelText: a };
2788
+ }
2789
+ const Jn = { class: "mt-4 flex flex-row-reverse gap-2" }, Zn = /* @__PURE__ */ g({
2790
+ __name: "PromptModal",
2791
+ props: {
2792
+ title: {},
2793
+ message: {},
2794
+ label: {},
2795
+ defaultValue: {},
2796
+ placeholder: {},
2797
+ acceptText: {},
2798
+ acceptVariant: {},
2799
+ cancelText: {},
2800
+ cancelVariant: { default: "secondary" }
2801
+ },
2802
+ setup(t, { expose: s }) {
2803
+ const e = N(t, ["cancelVariant"]), { form: r, renderedTitle: n, renderedMessage: a, renderedAcceptText: i, renderedCancelText: l } = Qn(e);
2804
+ return s(), (d, v) => (c(), h(te, {
2805
+ title: o(n),
2806
+ persistent: ""
2807
+ }, {
2808
+ default: f(({ close: $ }) => [
2809
+ m(yt, {
2810
+ form: o(r),
2811
+ onSubmit: (p) => $(o(r).draft)
2812
+ }, {
2813
+ default: f(() => [
2814
+ o(a) ? (c(), h(I, {
2815
+ key: 0,
2816
+ text: o(a)
2817
+ }, null, 8, ["text"])) : M("", !0),
2818
+ m(Wn, {
2819
+ name: "draft",
2820
+ class: "mt-2",
2821
+ placeholder: d.placeholder,
2822
+ label: d.label
2823
+ }, null, 8, ["placeholder", "label"]),
2824
+ y("div", Jn, [
2825
+ m(z, {
2826
+ variant: d.acceptVariant,
2827
+ submit: ""
2828
+ }, {
2829
+ default: f(() => [
2830
+ P(k(o(i)), 1)
2831
+ ]),
2832
+ _: 1
2833
+ }, 8, ["variant"]),
2834
+ m(z, {
2835
+ variant: d.cancelVariant,
2836
+ onClick: (p) => $()
2837
+ }, {
2838
+ default: f(() => [
2839
+ P(k(o(l)), 1)
2840
+ ]),
2841
+ _: 2
2842
+ }, 1032, ["variant", "onClick"])
2843
+ ])
2844
+ ]),
2845
+ _: 2
2846
+ }, 1032, ["form", "onSubmit"])
2847
+ ]),
2848
+ _: 1
2849
+ }, 8, ["title"]));
2850
+ }
2851
+ }), Xn = { class: "grid grow place-items-center" }, Yn = { class: "flex flex-col items-center space-y-6 p-8" }, Gn = { class: "mt-2 text-center text-4xl font-medium text-red-600" }, ea = { class: "mt-4 flex flex-col space-y-4" }, ta = /* @__PURE__ */ g({
2852
+ __name: "StartupCrash",
2853
+ setup(t) {
2854
+ return (s, e) => (c(), b("div", Xn, [
2855
+ y("div", Yn, [
2856
+ y("h1", Gn, k(s.$td("startupCrash.title", "Something went wrong!")), 1),
2857
+ m(I, {
2858
+ text: s.$td(
2859
+ "startupCrash.message",
2860
+ `Something failed trying to start the application.
2861
+
2862
+ Here's some things you can do:`
2863
+ ),
2864
+ class: "mt-4 text-center"
2865
+ }, null, 8, ["text"]),
2866
+ y("div", ea, [
2867
+ m(z, {
2868
+ variant: "danger",
2869
+ onClick: e[0] || (e[0] = (r) => s.$app.reload())
2870
+ }, {
2871
+ default: f(() => [
2872
+ P(k(s.$td("startupCrash.reload", "Try again")), 1)
2873
+ ]),
2874
+ _: 1
2875
+ }),
2876
+ m(z, {
2877
+ variant: "danger",
2878
+ onClick: e[1] || (e[1] = (r) => s.$errors.inspect(s.$errors.startupErrors))
2879
+ }, {
2880
+ default: f(() => [
2881
+ P(k(s.$td("startupCrash.inspect", "View error details")), 1)
2882
+ ]),
2883
+ _: 1
2884
+ })
2885
+ ])
2886
+ ])
2887
+ ]));
2888
+ }
2889
+ }), xt = /* @__PURE__ */ g({
2890
+ __name: "HeadlessToastAction",
2891
+ props: {
2892
+ action: {}
2893
+ },
2894
+ setup(t) {
2895
+ return (s, e) => (c(), h(W(s.action.dismiss ? o(_s) : "button"), {
2896
+ type: "button",
2897
+ onClick: s.action.click
2898
+ }, {
2899
+ default: f(() => [
2900
+ P(k(s.action.label), 1)
2901
+ ]),
2902
+ _: 1
2903
+ }, 8, ["onClick"]));
2904
+ }
2905
+ }), sa = { key: 0 }, ra = /* @__PURE__ */ g({
2906
+ __name: "HeadlessToast",
2907
+ props: {
2908
+ message: {},
2909
+ actions: {},
2910
+ variant: {}
2911
+ },
2912
+ setup(t) {
2913
+ return (s, e) => (c(), h(o(xs), null, {
2914
+ default: f(() => [
2915
+ w(s.$slots, "default", {}, () => [
2916
+ s.message ? (c(), b("span", sa, k(s.message), 1)) : M("", !0),
2917
+ (c(!0), b(j, null, F(s.actions, (r, n) => (c(), h(xt, {
2918
+ key: n,
2919
+ action: r
2920
+ }, null, 8, ["action"]))), 128))
2921
+ ])
2922
+ ]),
2923
+ _: 3
2924
+ }));
2925
+ }
2926
+ }), na = /* @__PURE__ */ g({
2927
+ __name: "Toast",
2928
+ props: {
2929
+ message: {},
2930
+ actions: {},
2931
+ variant: { default: "secondary" },
2932
+ class: {}
2933
+ },
2934
+ setup(t, { expose: s }) {
2935
+ const e = u(() => at(
2936
+ { baseClasses: t.class, variant: t.variant },
2937
+ {
2938
+ baseClasses: "flex items-center gap-2 rounded-md p-2 ring-1 shadow-lg border-gray-200",
2939
+ variants: {
2940
+ variant: {
2941
+ secondary: "bg-gray-900 text-white ring-black",
2942
+ danger: "bg-red-50 text-red-900 ring-red-100"
2943
+ }
2944
+ },
2945
+ defaultVariants: {
2946
+ variant: "secondary"
2947
+ }
2948
+ }
2949
+ ));
2950
+ return s(), (r, n) => (c(), h(ra, {
2951
+ class: C(e.value)
2952
+ }, {
2953
+ default: f(() => [
2954
+ r.message ? (c(), h(I, {
2955
+ key: 0,
2956
+ text: r.message,
2957
+ inline: ""
2958
+ }, null, 8, ["text"])) : M("", !0),
2959
+ (c(!0), b(j, null, F(r.actions, (a, i) => (c(), h(z, {
2960
+ key: i,
2961
+ action: a,
2962
+ variant: r.variant,
2963
+ as: xt
2964
+ }, null, 8, ["action", "variant"]))), 128))
2965
+ ]),
2966
+ _: 1
2967
+ }, 8, ["class"]));
2968
+ }
2969
+ }), aa = { $ui: R }, la = {
2970
+ async install(t, s) {
2971
+ const e = {
2972
+ "alert-modal": Xr,
2973
+ "confirm-modal": nn,
2974
+ "error-report-modal": In,
2975
+ "loading-modal": qn,
2976
+ "prompt-modal": Zn,
2977
+ "startup-crash": ta,
2978
+ toast: na,
2979
+ ...s.components
2980
+ };
2981
+ for (const [r, n] of Object.entries(e))
2982
+ R.registerComponent(r, n);
2983
+ await $e(t, aa);
2984
+ }
2985
+ };
2986
+ async function oa(t, s = {}) {
2987
+ var r;
2988
+ const e = [Dr, Us, zr, xr, Qs, la, ...s.plugins ?? []];
2989
+ D.instance = t, await zs(e, t, s), await ((r = s.install) == null ? void 0 : r.call(s, t)), await L.emit("application-ready");
2990
+ }
2991
+ async function gl(t, s = {}) {
2992
+ var r;
2993
+ const e = Rt(t);
2994
+ se() && (window.$aerogel = e), await oa(e, s), e.mount("#app"), (r = e._container) == null || r.classList.remove("loading"), await L.emit("application-mounted");
2995
+ }
2996
+ const ia = { key: 0 }, ca = /* @__PURE__ */ g({
2997
+ __name: "AppModals",
2998
+ setup(t) {
2999
+ const s = u(() => R.modals[0] ?? null);
3000
+ return (e, r) => s.value ? (c(), b("aside", ia, [
3001
+ m(bt, {
3002
+ "child-index": 1,
3003
+ modal: s.value
3004
+ }, null, 8, ["modal"])
3005
+ ])) : M("", !0);
3006
+ }
3007
+ }), ua = /* @__PURE__ */ g({
3008
+ __name: "AppToasts",
3009
+ setup(t) {
3010
+ return (s, e) => (c(), h(o(Cs), null, {
3011
+ default: f(() => [
3012
+ (c(!0), b(j, null, F(s.$ui.toasts, (r) => (c(), h(W(r.component), H({
3013
+ id: r.id,
3014
+ key: r.id,
3015
+ ref_for: !0
3016
+ }, r.properties), null, 16, ["id"]))), 128)),
3017
+ 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" })
3018
+ ]),
3019
+ _: 1
3020
+ }));
3021
+ }
3022
+ }), da = /* @__PURE__ */ g({
3023
+ __name: "AppOverlays",
3024
+ setup(t) {
3025
+ return (s, e) => (c(), b(j, null, [
3026
+ m(ca),
3027
+ m(ua)
3028
+ ], 64));
3029
+ }
3030
+ }), pa = { class: "flex min-h-full flex-col text-base leading-tight font-normal text-gray-900 antialiased" }, vl = /* @__PURE__ */ g({
3031
+ __name: "AppLayout",
3032
+ setup(t) {
3033
+ return (s, e) => (c(), b("div", pa, [
3034
+ s.$errors.hasStartupErrors ? w(s.$slots, "startup-crash", { key: 0 }, () => [
3035
+ (c(), h(W(s.$ui.requireComponent("startup-crash"))))
3036
+ ]) : w(s.$slots, "default", { key: 1 }),
3037
+ m(da)
3038
+ ]));
3039
+ }
3040
+ }), ma = ["id", "name", "value", "required", "aria-invalid", "aria-describedby"], fa = /* @__PURE__ */ g({
3041
+ __name: "HeadlessInputTextArea",
3042
+ setup(t) {
3043
+ const s = Y("$textAreaRef"), e = V(
3044
+ "input",
3045
+ "<HeadlessInputTextArea> must be a child of a <HeadlessInput>"
3046
+ ), r = u(() => e.name ?? void 0), n = u(() => e.value);
3047
+ function a() {
3048
+ s.value && e.update(s.value.value);
3049
+ }
3050
+ return ot(e, () => {
3051
+ var i;
3052
+ return (i = s.value) == null ? void 0 : i.focus();
3053
+ }), (i, l) => (c(), b("textarea", {
3054
+ id: o(e).id,
3055
+ ref: "$textAreaRef",
3056
+ name: r.value,
3057
+ value: n.value,
3058
+ required: o(e).required ?? void 0,
3059
+ "aria-invalid": o(e).errors ? "true" : "false",
3060
+ "aria-describedby": o(e).errors ? `${o(e).id}-error` : o(e).description ? `${o(e).id}-description` : void 0,
3061
+ onInput: a
3062
+ }, null, 40, ma));
3063
+ }
3064
+ }), ha = { class: "group" }, ga = { 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" }, va = { class: "pt-2 pl-4" }, bl = /* @__PURE__ */ g({
3065
+ __name: "AdvancedOptions",
3066
+ setup(t) {
3067
+ return (s, e) => (c(), b("details", ha, [
3068
+ y("summary", ga, [
3069
+ m(o(wt), { class: "size-6 transition-transform group-open:rotate-90" }),
3070
+ y("span", null, k(s.$td("ui.advancedOptions", "Advanced options")), 1)
3071
+ ]),
3072
+ y("div", va, [
3073
+ w(s.$slots, "default")
3074
+ ])
3075
+ ]));
3076
+ }
3077
+ }), ba = { class: "flex h-6 items-center" }, yl = /* @__PURE__ */ g({
3078
+ inheritAttrs: !1,
3079
+ __name: "Checkbox",
3080
+ props: {
3081
+ name: {},
3082
+ label: {},
3083
+ description: {},
3084
+ modelValue: {},
3085
+ inputClass: {},
3086
+ labelClass: {}
3087
+ },
3088
+ emits: ["update:modelValue"],
3089
+ setup(t) {
3090
+ const s = N(t, ["inputClass", "labelClass"]), e = Y("$inputRef"), [r, n] = Ie(), a = u(() => E("relative flex items-start", n.value)), i = u(() => {
3091
+ var d, v;
3092
+ return E(
3093
+ "size-4 rounded text-primary-600 not-checked:hover:bg-gray-200 checked:hover:text-primary-500 checked:border-0",
3094
+ {
3095
+ "border-gray-300 focus:ring-primary-600": !((d = e.value) != null && d.errors),
3096
+ "border-red-400 border-2 focus:ring-red-600": (v = e.value) == null ? void 0 : v.errors
3097
+ },
3098
+ t.inputClass
3099
+ );
3100
+ }), l = u(() => E("ml-2 text-sm leading-6", t.labelClass));
3101
+ return (d, v) => (c(), h(Ae, H({
3102
+ ref: "$inputRef",
3103
+ class: a.value
3104
+ }, s, {
3105
+ "onUpdate:modelValue": v[0] || (v[0] = ($) => d.$emit("update:modelValue", $))
3106
+ }), {
3107
+ default: f(() => [
3108
+ y("div", ba, [
3109
+ m($t, H(o(r), {
3110
+ type: "checkbox",
3111
+ class: i.value
3112
+ }), null, 16, ["class"])
3113
+ ]),
3114
+ d.$slots.default ? (c(), b("div", {
3115
+ key: 0,
3116
+ class: C(l.value)
3117
+ }, [
3118
+ m(fe, { class: "text-gray-900" }, {
3119
+ default: f(() => [
3120
+ w(d.$slots, "default")
3121
+ ]),
3122
+ _: 3
3123
+ }),
3124
+ m(he, { class: "text-red-600" })
3125
+ ], 2)) : d.label ? (c(), b("div", {
3126
+ key: 1,
3127
+ class: C(l.value)
3128
+ }, [
3129
+ m(fe, { class: "text-gray-900" }),
3130
+ m(he, { class: "text-red-600" })
3131
+ ], 2)) : M("", !0)
3132
+ ]),
3133
+ _: 3
3134
+ }, 16, ["class"]));
3135
+ }
3136
+ }), ya = /* @__PURE__ */ g({
3137
+ __name: "DropdownMenuOption",
3138
+ props: {
3139
+ class: {},
3140
+ asChild: { type: Boolean },
3141
+ as: {}
3142
+ },
3143
+ emits: ["select"],
3144
+ setup(t) {
3145
+ const s = N(t, ["class"]), e = u(() => E(
3146
+ "flex w-full items-center gap-2 rounded-lg px-2 py-2 text-sm text-gray-900 data-[highlighted]:bg-gray-100",
3147
+ t.class
3148
+ ));
3149
+ return (r, n) => (c(), h(o(Ss), H({ class: e.value }, s, {
3150
+ onSelect: n[0] || (n[0] = (a) => r.$emit("select"))
3151
+ }), {
3152
+ default: f(() => [
3153
+ w(r.$slots, "default")
3154
+ ]),
3155
+ _: 3
3156
+ }, 16, ["class"]));
3157
+ }
3158
+ }), wa = /* @__PURE__ */ g({
3159
+ __name: "DropdownMenuOptions",
3160
+ setup(t) {
3161
+ const s = V(
3162
+ "dropdown-menu",
3163
+ "<DropdownMenuOptions> must be a child of a <DropdownMenu>"
3164
+ );
3165
+ return (e, r) => (c(), h(o(Ms), {
3166
+ class: "gap-y-0.5 rounded-lg bg-white p-1.5 shadow-lg ring-1 ring-black/5",
3167
+ align: o(s).align,
3168
+ side: o(s).side
3169
+ }, {
3170
+ default: f(() => [
3171
+ w(e.$slots, "default", {}, () => [
3172
+ (c(!0), b(j, null, F(o(s).options, (n, a) => (c(), h(ya, H(
3173
+ {
3174
+ key: a,
3175
+ as: n.route || n.href ? nt : void 0,
3176
+ class: n.class,
3177
+ ref_for: !0
3178
+ },
3179
+ n.route || n.href ? {
3180
+ href: n.href,
3181
+ route: n.route,
3182
+ routeParams: n.routeParams,
3183
+ routeQuery: n.routeQuery
3184
+ } : {},
3185
+ {
3186
+ onSelect: (i) => {
3187
+ var l;
3188
+ return (l = n.click) == null ? void 0 : l.call(n);
3189
+ }
3190
+ }
3191
+ ), {
3192
+ default: f(() => [
3193
+ P(k(n.label), 1)
3194
+ ]),
3195
+ _: 2
3196
+ }, 1040, ["as", "class", "onSelect"]))), 128))
3197
+ ])
3198
+ ]),
3199
+ _: 3
3200
+ }, 8, ["align", "side"]));
3201
+ }
3202
+ }), wl = /* @__PURE__ */ g({
3203
+ __name: "DropdownMenu",
3204
+ props: {
3205
+ align: {},
3206
+ side: {},
3207
+ options: {}
3208
+ },
3209
+ setup(t, { expose: s }) {
3210
+ const e = {
3211
+ align: t.align,
3212
+ side: t.side,
3213
+ options: u(() => {
3214
+ var r;
3215
+ return (r = t.options) == null ? void 0 : r.filter(Boolean);
3216
+ })
3217
+ };
3218
+ return le("dropdown-menu", e), s(e), (r, n) => (c(), h(o(Es), null, {
3219
+ default: f(() => [
3220
+ m(o(Hs), null, {
3221
+ default: f(() => [
3222
+ w(r.$slots, "default")
3223
+ ]),
3224
+ _: 3
3225
+ }),
3226
+ m(o(Vs), null, {
3227
+ default: f(() => [
3228
+ w(r.$slots, "options", {}, () => [
3229
+ m(wa)
3230
+ ])
3231
+ ]),
3232
+ _: 3
3233
+ })
3234
+ ]),
3235
+ _: 3
3236
+ }));
3237
+ }
3238
+ }), $a = ["aria-hidden"], _a = ["tabindex", "aria-label", "type"], $l = /* @__PURE__ */ g({
3239
+ __name: "EditableContent",
3240
+ props: {
3241
+ type: { default: "text" },
3242
+ contentClass: {},
3243
+ ariaLabel: {},
3244
+ formAriaHidden: { type: Boolean },
3245
+ tabindex: {},
3246
+ text: {},
3247
+ disabled: { type: Boolean }
3248
+ },
3249
+ emits: ["update", "save"],
3250
+ setup(t, { emit: s }) {
3251
+ 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));
3252
+ function v() {
3253
+ n.value = t.text;
3254
+ }
3255
+ function $() {
3256
+ n.value && (t.type !== "number" && a.value.trim().length === 0 && (a.value = n.value, e("update", a.value)), n.value = null, e("save"));
3257
+ }
3258
+ return X(() => a.value = t.text), (p, x) => (c(), b("div", {
3259
+ class: C(["relative", { "pointer-events-none!": p.disabled && !n.value }])
3260
+ }, [
3261
+ n.value ? (c(), b("span", {
3262
+ key: 1,
3263
+ class: C(l.value)
3264
+ }, k(a.value), 3)) : (c(), b("div", {
3265
+ key: 0,
3266
+ class: C(i.value)
3267
+ }, [
3268
+ w(p.$slots, "default")
3269
+ ], 2)),
3270
+ p.type === "number" ? (c(), b("span", {
3271
+ key: 2,
3272
+ class: C(["inline-block transition-[width]", n.value ? "w-5" : "w-0"])
3273
+ }, null, 2)) : M("", !0),
3274
+ y("form", {
3275
+ class: "w-full",
3276
+ "aria-hidden": p.formAriaHidden,
3277
+ onSubmit: x[4] || (x[4] = We((T) => {
3278
+ var _e;
3279
+ return (_e = o(r)) == null ? void 0 : _e.blur();
3280
+ }, ["prevent"]))
3281
+ }, [
3282
+ Ke(y("input", {
3283
+ ref: "$inputRef",
3284
+ "onUpdate:modelValue": x[0] || (x[0] = (T) => a.value = T),
3285
+ tabindex: p.tabindex ?? void 0,
3286
+ "aria-label": p.ariaLabel ?? void 0,
3287
+ type: p.type,
3288
+ class: C([
3289
+ d.value,
3290
+ { "opacity-0": !n.value, "appearance-textfield": !n.value && p.type === "number" }
3291
+ ]),
3292
+ onKeyup: x[1] || (x[1] = (T) => p.$emit("update", a.value)),
3293
+ onFocus: x[2] || (x[2] = (T) => v()),
3294
+ onBlur: x[3] || (x[3] = (T) => $())
3295
+ }, null, 42, _a), [
3296
+ [At, a.value]
3297
+ ])
3298
+ ], 40, $a)
3299
+ ], 2));
3300
+ }
3301
+ }), xa = {
3302
+ viewBox: "0 0 512 512",
3303
+ width: "1.2em",
3304
+ height: "1.2em"
3305
+ };
3306
+ function Ca(t, s) {
3307
+ return c(), b("svg", xa, s[0] || (s[0] = [
3308
+ y("path", {
3309
+ fill: "currentColor",
3310
+ 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"
3311
+ }, null, -1)
3312
+ ]));
3313
+ }
3314
+ const ka = A({ name: "ion-warning", render: Ca }), Sa = {
3315
+ viewBox: "0 0 20 20",
3316
+ width: "1.2em",
3317
+ height: "1.2em"
3318
+ };
3319
+ function Ma(t, s) {
3320
+ return c(), b("svg", Sa, s[0] || (s[0] = [
3321
+ y("path", {
3322
+ fill: "currentColor",
3323
+ 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"
3324
+ }, null, -1)
3325
+ ]));
3326
+ }
3327
+ const Ea = A({ name: "zondicons-view-show", render: Ma }), Ha = { class: "font-medium" }, Va = ["datetime"], Ta = /* @__PURE__ */ g({
3328
+ __name: "ErrorLogsModal",
3329
+ setup(t) {
3330
+ return (s, e) => (c(), h(te, {
3331
+ title: s.$td("errors.report", "Errors ({count})", { count: s.$errors.logs.length })
3332
+ }, {
3333
+ default: f(() => [
3334
+ y("ol", null, [
3335
+ (c(!0), b(j, null, F(s.$errors.logs, (r, n) => (c(), b("li", {
3336
+ key: n,
3337
+ class: "mb-2 flex max-w-prose min-w-56 justify-between py-2 last:mb-0"
3338
+ }, [
3339
+ y("div", null, [
3340
+ y("h3", Ha, k(r.report.title), 1),
3341
+ y("time", {
3342
+ datetime: r.date.toISOString(),
3343
+ class: "text-xs text-gray-700"
3344
+ }, k(r.date.toLocaleTimeString()), 9, Va),
3345
+ m(I, {
3346
+ class: "text-sm text-gray-500",
3347
+ text: r.report.description ?? o(vt)(r.report)
3348
+ }, null, 8, ["text"])
3349
+ ]),
3350
+ m(z, {
3351
+ size: "icon",
3352
+ variant: "ghost",
3353
+ "aria-label": s.$td("errors.viewDetails", "View details"),
3354
+ title: s.$td("errors.viewDetails", "View details"),
3355
+ class: "self-center",
3356
+ onClick: (a) => s.$errors.inspect(
3357
+ r.report,
3358
+ s.$errors.logs.map(({ report: i }) => i)
3359
+ )
3360
+ }, {
3361
+ default: f(() => [
3362
+ m(o(Ea), {
3363
+ class: "size-4",
3364
+ "aria-hidden": "true"
3365
+ })
3366
+ ]),
3367
+ _: 2
3368
+ }, 1032, ["aria-label", "title", "onClick"])
3369
+ ]))), 128))
3370
+ ])
3371
+ ]),
3372
+ _: 1
3373
+ }, 8, ["title"]));
3374
+ }
3375
+ }), _l = /* @__PURE__ */ g({
3376
+ __name: "ErrorLogs",
3377
+ setup(t) {
3378
+ return (s, e) => s.$errors.logs.length > 0 ? (c(), h(z, {
3379
+ key: 0,
3380
+ size: "icon",
3381
+ variant: "ghost",
3382
+ title: s.$td("errors.viewLogs", "View error logs"),
3383
+ "aria-label": s.$td("errors.viewLogs", "View error logs"),
3384
+ onClick: e[0] || (e[0] = (r) => s.$ui.modal(Ta))
3385
+ }, {
3386
+ default: f(() => [
3387
+ m(o(ka), { class: "size-6 text-red-500" })
3388
+ ]),
3389
+ _: 1
3390
+ }, 8, ["title", "aria-label"])) : M("", !0);
3391
+ }
3392
+ }), xl = /* @__PURE__ */ g({
3393
+ __name: "ErrorMessage",
3394
+ props: {
3395
+ error: {}
3396
+ },
3397
+ setup(t) {
3398
+ const s = u(() => vt(t.error));
3399
+ return (e, r) => (c(), h(I, {
3400
+ text: s.value,
3401
+ inline: ""
3402
+ }, null, 8, ["text"]));
3403
+ }
3404
+ }), Cl = /* @__PURE__ */ g({
3405
+ __name: "Link",
3406
+ props: {
3407
+ class: {},
3408
+ disabled: { type: Boolean },
3409
+ href: {},
3410
+ route: {},
3411
+ routeParams: {},
3412
+ routeQuery: {},
3413
+ size: {},
3414
+ submit: { type: Boolean },
3415
+ asChild: { type: Boolean },
3416
+ as: {}
3417
+ },
3418
+ setup(t) {
3419
+ return (s, e) => (c(), h(z, H({ variant: "link" }, s.$props), {
3420
+ default: f(() => [
3421
+ w(s.$slots, "default")
3422
+ ]),
3423
+ _: 3
3424
+ }, 16));
3425
+ }
3426
+ }), kl = /* @__PURE__ */ g({
3427
+ __name: "SettingsModal",
3428
+ setup(t) {
3429
+ const s = u(() => Wt(D.settings, "priority", "desc"));
3430
+ return (e, r) => (c(), h(te, {
3431
+ title: e.$td("settings.title", "Settings")
3432
+ }, {
3433
+ default: f(() => [
3434
+ (c(!0), b(j, null, F(s.value, (n, a) => (c(), h(W(n.component), { key: a }))), 128))
3435
+ ]),
3436
+ _: 1
3437
+ }, 8, ["title"]));
3438
+ }
3439
+ }), La = {
3440
+ key: 0,
3441
+ class: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3"
3442
+ }, Sl = /* @__PURE__ */ g({
3443
+ inheritAttrs: !1,
3444
+ __name: "TextArea",
3445
+ props: {
3446
+ name: {},
3447
+ label: {},
3448
+ description: {},
3449
+ modelValue: {},
3450
+ inputClass: {},
3451
+ wrapperClass: {}
3452
+ },
3453
+ emits: ["update:modelValue"],
3454
+ setup(t) {
3455
+ 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(() => {
3456
+ var l, d, v;
3457
+ return E(
3458
+ // eslint-disable-next-line vue/max-len
3459
+ "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",
3460
+ {
3461
+ "focus:ring-primary-600": !((l = e.value) != null && l.errors),
3462
+ "text-gray-900 shadow-2xs ring-gray-900/10 placeholder:text-gray-400": !((d = e.value) != null && d.errors),
3463
+ "pr-10 text-red-900 ring-red-900/10 placeholder:text-red-300 focus:ring-red-500": (v = e.value) == null ? void 0 : v.errors
3464
+ },
3465
+ t.inputClass
3466
+ );
3467
+ });
3468
+ return (l, d) => (c(), h(Ae, H({
3469
+ ref: "$inputRef",
3470
+ label: l.label,
3471
+ class: o(n)
3472
+ }, s, {
3473
+ "onUpdate:modelValue": d[0] || (d[0] = (v) => l.$emit("update:modelValue", v))
3474
+ }), {
3475
+ default: f(() => {
3476
+ var v;
3477
+ return [
3478
+ m(fe, { class: "block text-sm leading-6 font-medium text-gray-900" }),
3479
+ y("div", {
3480
+ class: C(a.value)
3481
+ }, [
3482
+ m(fa, H(o(r), { class: i.value }), null, 16, ["class"]),
3483
+ (v = o(e)) != null && v.errors ? (c(), b("div", La, [
3484
+ m(o(Re), { class: "size-5 text-red-500" })
3485
+ ])) : M("", !0)
3486
+ ], 2),
3487
+ m(_t, { class: "mt-2 text-sm text-gray-600" }),
3488
+ m(he, { class: "mt-2 text-sm text-red-600" })
3489
+ ];
3490
+ }),
3491
+ _: 1
3492
+ }, 16, ["label", "class"]));
3493
+ }
3494
+ });
3495
+ class Ml {
3496
+ constructor() {
3497
+ _(this, "status");
3498
+ _(this, "_listeners");
3499
+ _(this, "_progress");
3500
+ _(this, "_cancelled");
3501
+ _(this, "_started");
3502
+ _(this, "_completed");
3503
+ this.status = this.getInitialStatus(), this._listeners = new Kt(), this._started = new K(), this._completed = new K();
3504
+ }
3505
+ async start() {
3506
+ this.beforeStart(), this._started.resolve();
3507
+ try {
3508
+ await this.updateProgress(), await this.run(), await this.updateProgress(), this._completed.resolve();
3509
+ } catch (s) {
3510
+ if (s instanceof Ue)
3511
+ return;
3512
+ throw G(Qt(s), (e) => {
3513
+ this._completed.reject(e);
3514
+ });
3515
+ }
3516
+ }
3517
+ async cancel() {
3518
+ this._cancelled = new K(), await this._cancelled;
3519
+ }
3520
+ serialize() {
3521
+ return this.serializeStatus(this.status);
3522
+ }
3523
+ get listeners() {
3524
+ return this._listeners;
3525
+ }
3526
+ get progress() {
3527
+ return this._progress ?? 0;
3528
+ }
3529
+ get cancelled() {
3530
+ var s;
3531
+ return !!((s = this._cancelled) != null && s.isResolved());
3532
+ }
3533
+ get started() {
3534
+ return this._started;
3535
+ }
3536
+ get completed() {
3537
+ return this._completed;
3538
+ }
3539
+ getInitialStatus() {
3540
+ return { completed: !1 };
3541
+ }
3542
+ beforeStart() {
3543
+ if (this._started.isResolved()) {
3544
+ if (this._cancelled) {
3545
+ delete this._progress, delete this._cancelled;
3546
+ return;
3547
+ }
3548
+ throw new Error("Job already started!");
3549
+ }
3550
+ }
3551
+ assertNotCancelled() {
3552
+ if (this._cancelled)
3553
+ throw this._cancelled.resolve(), new Ue();
3554
+ }
3555
+ calculateCurrentProgress(s) {
3556
+ return s ?? (s = this.status), s.completed ? 1 : s.children ? Jt(
3557
+ s.children.reduce((e, r) => e + this.calculateCurrentProgress(r), 0) / s.children.length,
3558
+ 2
3559
+ ) : 0;
3560
+ }
3561
+ async updateProgress(s) {
3562
+ await (s == null ? void 0 : s(this.status));
3563
+ const e = this.calculateCurrentProgress();
3564
+ e !== this._progress && (this._progress = e, await this._listeners.emit("onUpdated", e));
3565
+ }
3566
+ serializeStatus(s) {
3567
+ return { ...s };
3568
+ }
3569
+ }
3570
+ async function El(t) {
3571
+ await t.start();
3572
+ }
3573
+ export {
3574
+ bl as AdvancedOptions,
3575
+ Xr as AlertModal,
3576
+ D as App,
3577
+ vl as AppLayout,
3578
+ ca as AppModals,
3579
+ da as AppOverlays,
3580
+ Ps as AppService,
3581
+ ua as AppToasts,
3582
+ z as Button,
3583
+ Ja as Cache,
3584
+ Os as CacheService,
3585
+ yl as Checkbox,
3586
+ nn as ConfirmModal,
3587
+ wl as DropdownMenu,
3588
+ ya as DropdownMenuOption,
3589
+ wa as DropdownMenuOptions,
3590
+ $l as EditableContent,
3591
+ _l as ErrorLogs,
3592
+ Ta as ErrorLogsModal,
3593
+ xl as ErrorMessage,
3594
+ In as ErrorReportModal,
3595
+ Cn as ErrorReportModalButtons,
3596
+ kn as ErrorReportModalTitle,
3597
+ rt as Errors,
3598
+ Na as EventListenerPriorities,
3599
+ L as Events,
3600
+ Rs as EventsService,
3601
+ yt as Form,
3602
+ mr as FormController,
3603
+ nt as HeadlessButton,
3604
+ Ae as HeadlessInput,
3605
+ _t as HeadlessInputDescription,
3606
+ he as HeadlessInputError,
3607
+ $t as HeadlessInputInput,
3608
+ fe as HeadlessInputLabel,
3609
+ fa as HeadlessInputTextArea,
3610
+ Fr as HeadlessModal,
3611
+ Ur as HeadlessModalContent,
3612
+ Or as HeadlessModalDescription,
3613
+ Nr as HeadlessModalOverlay,
3614
+ Wr as HeadlessModalTitle,
3615
+ fr as HeadlessSelect,
3616
+ qe as HeadlessSelectLabel,
3617
+ dt as HeadlessSelectOption,
3618
+ pt as HeadlessSelectOptions,
3619
+ ut as HeadlessSelectTrigger,
3620
+ ct as HeadlessSelectValue,
3621
+ Vr as HeadlessSwitch,
3622
+ ra as HeadlessToast,
3623
+ Wn as Input,
3624
+ Ml as Job,
3625
+ Ue as JobCancelledError,
3626
+ J as Lang,
3627
+ me as Layouts,
3628
+ Cl as Link,
3629
+ qn as LoadingModal,
3630
+ et as MOBILE_BREAKPOINT,
3631
+ I as Markdown,
3632
+ te as Modal,
3633
+ bt as ModalContext,
3634
+ jn as ProgressBar,
3635
+ Zn as PromptModal,
3636
+ br as Select,
3637
+ mt as SelectLabel,
3638
+ Fe as SelectOption,
3639
+ ft as SelectOptions,
3640
+ ht as SelectTrigger,
3641
+ we as Service,
3642
+ Me as ServiceBootError,
3643
+ Er as Setting,
3644
+ kl as SettingsModal,
3645
+ ta as StartupCrash,
3646
+ Ws as Storage,
3647
+ Tr as Switch,
3648
+ Sl as TextArea,
3649
+ na as Toast,
3650
+ R as UI,
3651
+ Zs as UIService,
3652
+ Ga as __valueType,
3653
+ al as booleanInput,
3654
+ $e as bootServices,
3655
+ gl as bootstrap,
3656
+ oa as bootstrapApplication,
3657
+ E as classes,
3658
+ sl as computedAsync,
3659
+ rl as computedDebounce,
3660
+ ll as dateInput,
3661
+ Qa as defineDirective,
3662
+ Ya as defineFormValidationRule,
3663
+ Ka as definePlugin,
3664
+ ye as defineServiceState,
3665
+ Is as defineServiceStore,
3666
+ Wa as defineSettings,
3667
+ El as dispatch,
3668
+ ol as enumInput,
3669
+ tt as getCurrentLayout,
3670
+ vt as getErrorMessage,
3671
+ ar as getMarkdownRouter,
3672
+ Ls as getPiniaStore,
3673
+ ir as hasSelectOptionLabel,
3674
+ Bs as injectOrFail,
3675
+ js as injectReactive,
3676
+ V as injectReactiveOrFail,
3677
+ zs as installPlugins,
3678
+ ml as numberInput,
3679
+ fl as objectInput,
3680
+ el as onCleanMounted,
3681
+ ot as onFormFocus,
3682
+ tl as persistent,
3683
+ nl as registerErrorHandler,
3684
+ lr as renderMarkdown,
3685
+ Ge as renderVNode,
3686
+ Za as replaceExisting,
3687
+ il as requiredBooleanInput,
3688
+ cl as requiredDateInput,
3689
+ ul as requiredEnumInput,
3690
+ dl as requiredNumberInput,
3691
+ pl as requiredObjectInput,
3692
+ Kn as requiredStringInput,
3693
+ Ts as resetPiniaStore,
3694
+ or as safeHtml,
3695
+ Xa as setMarkdownRouter,
3696
+ hl as stringInput,
3697
+ st as translate,
3698
+ S as translateWithDefault,
3699
+ Zr as useAlertModal,
3700
+ Yr as useConfirmModal,
3701
+ Sn as useErrorReportModal,
3702
+ lt as useEvent,
3703
+ it as useForm,
3704
+ Ie as useInputAttrs,
3705
+ Bn as useLoadingModal,
3706
+ Qn as usePromptModal,
3707
+ pr as validate,
3708
+ dr as validateType,
3709
+ de as validators,
3710
+ at as variantClasses
3711
+ };
3712
+ //# sourceMappingURL=aerogel-core.js.map