@aerogel/core 0.0.0-next.a68f133e2c9a1ae9ba84b4e2e42df909289e5fba → 0.0.0-next.abea39863ad0f7c484b8b1f365870e43e9bdd0ba

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