@aerogel/core 0.0.0-next.b18f4e0acd39431045c2f444c711303890143193 → 0.0.0-next.b3caf219a503ce9b8c65ef1463132c9507f56c0a

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