@aerogel/core 0.0.0-next.bde642c4a8096c5fc3d5e676c2115da23f4bf1d8 → 0.0.0-next.c2e6acc000e97a1020c2e232678563c53884dd0e

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