@aerogel/core 0.0.0-next.c4825c5cbe0fe3257e478c2a7ec8df27d5a72305 → 0.0.0-next.ce4783d09a83f492e439f8d4c39bc0b4998f4cbf

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