@iankibetsh/sh-tailwind 0.1.0

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 (40) hide show
  1. package/README.md +177 -0
  2. package/dist/sh-tailwind.cjs.js +1 -0
  3. package/dist/sh-tailwind.es.js +3695 -0
  4. package/package.json +56 -0
  5. package/src/components/actions/ShConfirmAction.vue +78 -0
  6. package/src/components/actions/ShSilentAction.vue +66 -0
  7. package/src/components/actions/ShSpinner.vue +6 -0
  8. package/src/components/form/ShForm.vue +272 -0
  9. package/src/components/form/ShFormSteps.vue +30 -0
  10. package/src/components/form/inputs/DateInput.vue +29 -0
  11. package/src/components/form/inputs/EmailInput.vue +27 -0
  12. package/src/components/form/inputs/NumberInput.vue +32 -0
  13. package/src/components/form/inputs/PasswordInput.vue +47 -0
  14. package/src/components/form/inputs/PhoneInput.vue +190 -0
  15. package/src/components/form/inputs/SelectInput.vue +50 -0
  16. package/src/components/form/inputs/ShSuggest.vue +198 -0
  17. package/src/components/form/inputs/TextAreaInput.vue +27 -0
  18. package/src/components/form/inputs/TextInput.vue +26 -0
  19. package/src/components/overlay/ShDialog.vue +143 -0
  20. package/src/components/overlay/ShDialogBtn.vue +41 -0
  21. package/src/components/overlay/ShDialogForm.vue +80 -0
  22. package/src/components/overlay/ShDrawer.vue +129 -0
  23. package/src/components/overlay/ShDrawerBtn.vue +40 -0
  24. package/src/components/table/ShTable.vue +472 -0
  25. package/src/components/table/ShTablePagination.vue +96 -0
  26. package/src/composables/useDialog.js +68 -0
  27. package/src/composables/useScrollLock.js +19 -0
  28. package/src/data/countries.js +1474 -0
  29. package/src/index.js +45 -0
  30. package/src/plugin/ShTailwind.js +36 -0
  31. package/src/table/localQuery.js +60 -0
  32. package/src/table/tableCache.js +116 -0
  33. package/src/table/useTableData.js +125 -0
  34. package/src/theme/defaultTheme.js +148 -0
  35. package/src/theme/keys.js +3 -0
  36. package/src/theme/useTheme.js +11 -0
  37. package/src/utils/deepMerge.js +19 -0
  38. package/src/utils/normalizeField.js +61 -0
  39. package/src/utils/normalizeOptions.js +18 -0
  40. package/src/utils/strings.js +11 -0
@@ -0,0 +1,3695 @@
1
+ import { ShCore as e, getShConfig as t, shApis as n, shRepo as r, shStorage as i, useUserStore as a } from "@iankibetsh/sh-core";
2
+ import { Fragment as o, Teleport as s, Transition as c, computed as l, createBlock as u, createCommentVNode as d, createElementBlock as f, createElementVNode as p, createSlots as m, createTextVNode as h, createVNode as g, getCurrentInstance as _, inject as v, mergeProps as y, nextTick as b, normalizeClass as x, normalizeStyle as S, onBeforeUnmount as C, onMounted as w, onScopeDispose as T, openBlock as E, provide as D, reactive as ee, ref as O, renderList as k, renderSlot as A, resolveDynamicComponent as j, toDisplayString as M, unref as N, vModelCheckbox as P, vModelDynamic as F, vModelSelect as I, vModelText as L, vShow as R, watch as z, withCtx as B, withDirectives as V, withModifiers as H } from "vue";
3
+ //#region src/theme/defaultTheme.js
4
+ var U = {
5
+ form: {
6
+ form: "space-y-4",
7
+ group: "space-y-1",
8
+ label: "block text-sm font-medium text-gray-700 dark:text-gray-200",
9
+ required: "text-red-500",
10
+ input: "block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/30 disabled:cursor-not-allowed disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100",
11
+ inputInvalid: "block w-full rounded-md border border-red-500 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm placeholder:text-gray-400 focus:border-red-500 focus:outline-none focus:ring-2 focus:ring-red-500/30 dark:bg-gray-800 dark:text-gray-100",
12
+ helper: "text-xs text-gray-500 dark:text-gray-400",
13
+ error: "text-xs text-red-600",
14
+ errorTitle: "rounded-md bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-950 dark:text-red-300",
15
+ nav: "flex items-center justify-end gap-3 pt-2",
16
+ submitBtn: "inline-flex items-center justify-center gap-2 rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500/40 disabled:cursor-not-allowed disabled:opacity-60",
17
+ prevBtn: "inline-flex items-center justify-center gap-2 rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-gray-300 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200",
18
+ nextBtn: "inline-flex items-center justify-center gap-2 rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500/40",
19
+ steps: {
20
+ wrapper: "mb-6 flex items-start",
21
+ step: "relative flex flex-1 flex-col items-center gap-1",
22
+ circle: "z-10 flex size-9 items-center justify-center rounded-full border-2 border-gray-300 bg-white text-sm font-semibold text-gray-500 dark:border-gray-600 dark:bg-gray-800",
23
+ circleActive: "z-10 flex size-9 items-center justify-center rounded-full border-2 border-blue-600 bg-blue-600 text-sm font-semibold text-white",
24
+ circleDone: "z-10 flex size-9 items-center justify-center rounded-full border-2 border-emerald-500 bg-emerald-500 text-sm font-semibold text-white",
25
+ title: "text-xs text-gray-600 dark:text-gray-300",
26
+ titleActive: "text-xs font-semibold text-blue-600",
27
+ connector: "absolute top-4 right-1/2 -z-0 h-0.5 w-full bg-gray-200 dark:bg-gray-700",
28
+ connectorDone: "absolute top-4 right-1/2 -z-0 h-0.5 w-full bg-emerald-500"
29
+ }
30
+ },
31
+ inputs: {
32
+ select: "block w-full appearance-none rounded-md border border-gray-300 bg-white px-3 py-2 pr-8 text-sm text-gray-900 shadow-sm focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/30 disabled:opacity-50 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100",
33
+ passwordWrapper: "relative",
34
+ passwordToggle: "absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600 dark:hover:text-gray-300",
35
+ suggest: {
36
+ wrapper: "relative",
37
+ badges: "mb-1 flex flex-wrap gap-1",
38
+ badge: "inline-flex items-center gap-1 rounded-full bg-gray-200 px-2 py-0.5 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-200",
39
+ badgeRemove: "cursor-pointer text-gray-500 hover:text-red-600",
40
+ dropdown: "absolute z-20 mt-1 max-h-60 w-full overflow-auto rounded-md border border-gray-200 bg-white py-1 shadow-lg dark:border-gray-700 dark:bg-gray-800",
41
+ option: "cursor-pointer px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700",
42
+ optionActive: "cursor-pointer bg-blue-50 px-3 py-2 text-sm text-blue-700 dark:bg-gray-700 dark:text-blue-300",
43
+ empty: "px-3 py-2 text-sm text-gray-400"
44
+ },
45
+ phone: {
46
+ wrapper: "relative flex items-stretch rounded-md border border-gray-300 bg-white shadow-sm focus-within:border-blue-500 focus-within:ring-2 focus-within:ring-blue-500/30 dark:border-gray-600 dark:bg-gray-800",
47
+ trigger: "flex shrink-0 cursor-pointer items-center gap-1.5 rounded-l-md border-r border-gray-200 bg-gray-50 px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 focus:outline-none dark:border-gray-600 dark:bg-gray-700 dark:text-gray-200 dark:hover:bg-gray-600",
48
+ flag: "text-base leading-none",
49
+ dial: "text-sm font-medium text-gray-600 dark:text-gray-300",
50
+ chevron: "size-3.5 text-gray-400",
51
+ input: "block w-full rounded-r-md border-0 bg-transparent px-3 py-2 text-sm text-gray-900 placeholder:text-gray-400 focus:outline-none focus:ring-0 dark:text-gray-100",
52
+ dropdown: "absolute left-0 top-full z-20 mt-1 w-72 overflow-hidden rounded-lg border border-gray-200 bg-white shadow-lg dark:border-gray-700 dark:bg-gray-800",
53
+ search: "block w-full border-0 border-b border-gray-100 bg-transparent px-3 py-2.5 text-sm text-gray-900 placeholder:text-gray-400 focus:outline-none focus:ring-0 dark:border-gray-700 dark:text-gray-100",
54
+ list: "max-h-60 overflow-y-auto py-1",
55
+ option: "flex w-full cursor-pointer items-center gap-2.5 px-3 py-2 text-left text-sm text-gray-700 hover:bg-gray-100 dark:text-gray-200 dark:hover:bg-gray-700",
56
+ optionActive: "flex w-full cursor-pointer items-center gap-2.5 bg-blue-50 px-3 py-2 text-left text-sm text-blue-700 dark:bg-gray-700 dark:text-blue-300",
57
+ optionName: "flex-1 truncate",
58
+ optionDial: "text-xs text-gray-400",
59
+ empty: "px-3 py-3 text-center text-sm text-gray-400"
60
+ }
61
+ },
62
+ dialog: {
63
+ backdrop: "fixed inset-0 bg-black/50",
64
+ wrapper: "fixed inset-0 flex items-center justify-center overflow-y-auto p-4",
65
+ panel: "relative flex max-h-[90vh] w-full flex-col rounded-xl bg-white shadow-xl outline-none dark:bg-gray-900",
66
+ header: "flex items-center justify-between border-b border-gray-100 px-5 py-3.5 dark:border-gray-800",
67
+ title: "text-base font-semibold text-gray-900 dark:text-gray-100",
68
+ closeBtn: "rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 focus:outline-none dark:hover:bg-gray-800",
69
+ body: "overflow-y-auto px-5 py-4",
70
+ footer: "flex justify-end gap-2 border-t border-gray-100 px-5 py-3 dark:border-gray-800",
71
+ sizes: {
72
+ sm: "max-w-sm",
73
+ md: "max-w-lg",
74
+ lg: "max-w-2xl",
75
+ xl: "max-w-4xl",
76
+ full: "h-[95vh] max-w-[95vw]"
77
+ }
78
+ },
79
+ drawer: {
80
+ backdrop: "fixed inset-0 bg-black/50",
81
+ panel: "fixed flex flex-col bg-white shadow-xl outline-none dark:bg-gray-900",
82
+ header: "flex items-center justify-between border-b border-gray-100 px-5 py-3.5 dark:border-gray-800",
83
+ title: "text-base font-semibold text-gray-900 dark:text-gray-100",
84
+ closeBtn: "rounded-md p-1 text-gray-400 hover:bg-gray-100 hover:text-gray-600 focus:outline-none dark:hover:bg-gray-800",
85
+ body: "flex-1 overflow-y-auto px-5 py-4",
86
+ sizes: {
87
+ sm: "max-w-xs",
88
+ md: "max-w-md",
89
+ lg: "max-w-lg",
90
+ xl: "max-w-2xl",
91
+ full: "max-w-full"
92
+ },
93
+ sizesVertical: {
94
+ sm: "max-h-48",
95
+ md: "max-h-72",
96
+ lg: "max-h-96",
97
+ xl: "max-h-[60vh]",
98
+ full: "max-h-full"
99
+ }
100
+ },
101
+ table: {
102
+ wrapper: "space-y-3",
103
+ toolbar: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between",
104
+ search: "block w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm text-gray-900 shadow-sm placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-500/30 md:max-w-xs dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100",
105
+ exactLabel: "inline-flex items-center gap-1.5 text-xs text-gray-500",
106
+ rangeWrapper: "flex items-center gap-2",
107
+ rangeInput: "rounded-md border border-gray-300 px-2 py-1.5 text-sm text-gray-700 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200",
108
+ offline: "flex items-center gap-2 rounded-md border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-700 dark:border-amber-700 dark:bg-amber-950 dark:text-amber-300",
109
+ container: "hidden overflow-x-auto rounded-lg border border-gray-200 md:block dark:border-gray-700",
110
+ table: "w-full min-w-full divide-y divide-gray-200 text-sm dark:divide-gray-700",
111
+ thead: "bg-gray-50 dark:bg-gray-800",
112
+ th: "px-4 py-2.5 text-left text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400",
113
+ sortBtn: "inline-flex cursor-pointer items-center gap-1 uppercase hover:text-gray-800 dark:hover:text-gray-200",
114
+ tbody: "divide-y divide-gray-100 bg-white dark:divide-gray-800 dark:bg-gray-900",
115
+ tr: "",
116
+ trClickable: "cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800",
117
+ td: "px-4 py-2.5 text-gray-700 dark:text-gray-200",
118
+ money: "font-semibold text-emerald-600",
119
+ empty: "px-4 py-10 text-center text-sm text-gray-400",
120
+ error: "rounded-md bg-red-50 px-4 py-3 text-sm text-red-700 dark:bg-red-950 dark:text-red-300",
121
+ loading: "flex justify-center px-4 py-10 text-gray-400",
122
+ actionsCell: "whitespace-nowrap px-4 py-2.5 text-right",
123
+ actionBtn: "ml-3 inline-flex cursor-pointer items-center gap-1 text-sm text-blue-600 hover:underline first:ml-0",
124
+ checkbox: "size-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500",
125
+ cards: "space-y-3 md:hidden",
126
+ card: "rounded-lg border border-gray-200 bg-white p-4 dark:border-gray-700 dark:bg-gray-900",
127
+ cardLabel: "text-xs font-semibold uppercase tracking-wide text-gray-400",
128
+ cardValue: "mb-2 text-sm text-gray-700 dark:text-gray-200",
129
+ pagination: {
130
+ wrapper: "flex flex-col items-center justify-between gap-3 md:flex-row",
131
+ info: "text-xs text-gray-500",
132
+ perPage: "rounded-md border border-gray-300 px-2 py-1 text-xs text-gray-600 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-300",
133
+ pages: "flex items-center gap-1",
134
+ pageBtn: "inline-flex size-8 cursor-pointer items-center justify-center rounded-md border border-gray-300 text-xs text-gray-600 hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-40 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",
135
+ pageBtnActive: "inline-flex size-8 items-center justify-center rounded-md border border-blue-600 bg-blue-600 text-xs font-semibold text-white",
136
+ ellipsis: "px-1 text-xs text-gray-400",
137
+ loadMore: "inline-flex items-center justify-center gap-2 rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 disabled:opacity-60 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200"
138
+ },
139
+ multiBar: "fixed bottom-5 left-1/2 z-40 flex min-w-80 -translate-x-1/2 items-center justify-between gap-4 rounded-xl border border-gray-200 bg-white p-3 shadow-lg dark:border-gray-700 dark:bg-gray-900",
140
+ multiCount: "inline-flex items-center justify-center rounded-full bg-blue-600 px-2 py-0.5 text-xs font-semibold text-white",
141
+ multiBtn: "inline-flex items-center justify-center gap-1 rounded-md border border-blue-200 px-3 py-1.5 text-xs font-medium text-blue-700 hover:bg-blue-50 dark:border-blue-800 dark:text-blue-300"
142
+ },
143
+ buttons: {
144
+ primary: "inline-flex items-center justify-center gap-2 rounded-md bg-blue-600 px-4 py-2 text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500/40 disabled:opacity-60",
145
+ secondary: "inline-flex items-center justify-center gap-2 rounded-md border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200",
146
+ danger: "inline-flex items-center justify-center gap-2 rounded-md bg-red-600 px-4 py-2 text-sm font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500/40",
147
+ link: "inline-flex cursor-pointer items-center gap-1 text-sm text-blue-600 hover:underline"
148
+ }
149
+ }, W = Symbol("sh-tw-theme"), te = Symbol("sh-tw-components"), ne = Symbol("sh-dialog-context"), G = (e) => typeof e == "object" && !!e && !Array.isArray(e);
150
+ function K(e, t) {
151
+ if (!G(e)) return t ?? e;
152
+ let n = { ...e };
153
+ return G(t) && Object.keys(t).forEach((r) => {
154
+ G(e[r]) && G(t[r]) ? n[r] = K(e[r], t[r]) : n[r] = t[r];
155
+ }), n;
156
+ }
157
+ //#endregion
158
+ //#region src/plugin/ShTailwind.js
159
+ var re = { install(t, n = {}) {
160
+ e.install(t, n);
161
+ let r = K(U, n.theme ?? {});
162
+ t.provide(W, r), t.provide(te, n.formComponents ?? {}), t.provide("formComponents", n.formComponents ?? {}), t.provide("shFormElementClasses", {
163
+ formGroup: r.form.group,
164
+ formLabel: r.form.label,
165
+ formControl: r.form.input,
166
+ helperText: r.form.helper,
167
+ invalidFeedback: r.form.error,
168
+ formErrorTitle: r.form.errorTitle,
169
+ actionBtn: r.form.submitBtn
170
+ });
171
+ } }, ie = (e = {}) => ({ install: (t) => re.install(t, e) });
172
+ //#endregion
173
+ //#region src/theme/useTheme.js
174
+ function q(e, t = null) {
175
+ let n = v(W, U);
176
+ return l(() => K(n[e] ?? U[e], N(t) ?? {}));
177
+ }
178
+ //#endregion
179
+ //#region src/composables/useScrollLock.js
180
+ var J = 0;
181
+ function ae() {
182
+ if (++J === 1) {
183
+ let e = window.innerWidth - document.documentElement.clientWidth;
184
+ e > 0 && (document.body.style.paddingRight = `${e}px`), document.body.style.overflow = "hidden";
185
+ }
186
+ }
187
+ function oe() {
188
+ J > 0 && --J === 0 && (document.body.style.overflow = "", document.body.style.paddingRight = "");
189
+ }
190
+ //#endregion
191
+ //#region src/composables/useDialog.js
192
+ var se = 50, Y = [];
193
+ function ce({ isStatic: e, onClose: t, onOpen: n } = {}) {
194
+ let r = O(!1), i = O(se), a = null, o = {}, s = (t) => {
195
+ t.key === "Escape" && Y[Y.length - 1] === o && (e?.() || l("escape"));
196
+ };
197
+ function c() {
198
+ r.value || (a = document.activeElement, i.value = se + Y.length * 10, Y.push(o), r.value = !0, ae(), document.addEventListener("keydown", s), n?.());
199
+ }
200
+ function l(e = "api") {
201
+ if (!r.value) return;
202
+ r.value = !1;
203
+ let n = Y.indexOf(o);
204
+ n >= 0 && Y.splice(n, 1), oe(), document.removeEventListener("keydown", s), a?.focus?.(), t?.(e);
205
+ }
206
+ function u() {
207
+ e?.() || l("backdrop");
208
+ }
209
+ return T(() => {
210
+ r.value && l("unmount");
211
+ }), {
212
+ isOpen: r,
213
+ zIndex: i,
214
+ show: c,
215
+ close: l,
216
+ onBackdrop: u
217
+ };
218
+ }
219
+ //#endregion
220
+ //#region src/utils/strings.js
221
+ var le = (e) => String(e ?? "").replace(/[_-]+/g, " ").replace(/([a-z\d])([A-Z])/g, "$1 $2").trim().split(/\s+/).map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" "), ue = {
222
+ password: "password",
223
+ pin: "password",
224
+ password_confirmation: "password",
225
+ message: "textarea",
226
+ description: "textarea",
227
+ comments: "textarea",
228
+ notes: "textarea",
229
+ email: "email",
230
+ phone: "phone",
231
+ phone_number: "phone",
232
+ age: "number",
233
+ date: "date"
234
+ };
235
+ function X(e) {
236
+ if (e.type) return e.type;
237
+ if (e.component) return "custom";
238
+ if (e.options) return e.multiple || e.allowCustom ? "suggest" : "select";
239
+ let t = e.name ?? "";
240
+ return ue[t] ? ue[t] : /_email$/.test(t) ? "email" : /_phone$/.test(t) ? "phone" : /(_at|_date|_on)$/.test(t) ? "date" : "text";
241
+ }
242
+ function de(e, t = {}) {
243
+ return (e ?? []).map((e) => {
244
+ let n = typeof e == "string" ? { name: e } : { ...e };
245
+ return n.name = n.name ?? n.field, n.name ? (n.type = X(n), n.label !== !1 && (n.label = n.label ?? le(n.name)), n.placeholder = n.placeholder ?? "", n.helper = n.helper ?? "", n.required = !!n.required, n.value = n.value ?? t?.[n.name] ?? null, n) : (console.warn("[sh-tailwind] form field without a name was skipped", e), null);
246
+ }).filter(Boolean);
247
+ }
248
+ //#endregion
249
+ //#region src/components/form/ShFormSteps.vue
250
+ var fe = {
251
+ key: 0,
252
+ xmlns: "http://www.w3.org/2000/svg",
253
+ class: "size-4",
254
+ fill: "none",
255
+ viewBox: "0 0 24 24",
256
+ stroke: "currentColor",
257
+ "stroke-width": "2.5"
258
+ }, pe = {
259
+ __name: "ShFormSteps",
260
+ props: {
261
+ steps: {
262
+ type: Array,
263
+ required: !0
264
+ },
265
+ current: {
266
+ type: Number,
267
+ default: 0
268
+ }
269
+ },
270
+ setup(e) {
271
+ let t = q("form");
272
+ return (n, r) => (E(), f("div", { class: x(N(t).steps.wrapper) }, [(E(!0), f(o, null, k(e.steps, (n, i) => (E(), f("div", {
273
+ key: i,
274
+ class: x(N(t).steps.step)
275
+ }, [
276
+ i > 0 ? (E(), f("div", {
277
+ key: 0,
278
+ class: x(i <= e.current ? N(t).steps.connectorDone : N(t).steps.connector)
279
+ }, null, 2)) : d("", !0),
280
+ p("div", { class: x(i < e.current ? N(t).steps.circleDone : i === e.current ? N(t).steps.circleActive : N(t).steps.circle) }, [i < e.current ? (E(), f("svg", fe, [...r[0] ||= [p("path", {
281
+ "stroke-linecap": "round",
282
+ "stroke-linejoin": "round",
283
+ d: "M4.5 12.75l6 6 9-13.5"
284
+ }, null, -1)]])) : (E(), f(o, { key: 1 }, [h(M(i + 1), 1)], 64))], 2),
285
+ p("span", { class: x(i === e.current ? N(t).steps.titleActive : N(t).steps.title) }, M(n.title), 3)
286
+ ], 2))), 128))], 2));
287
+ }
288
+ }, me = (e, t) => {
289
+ let n = e.__vccOpts || e;
290
+ for (let [e, r] of t) n[e] = r;
291
+ return n;
292
+ }, he = {}, ge = {
293
+ class: "animate-spin",
294
+ xmlns: "http://www.w3.org/2000/svg",
295
+ fill: "none",
296
+ viewBox: "0 0 24 24"
297
+ };
298
+ function _e(e, t) {
299
+ return E(), f("svg", ge, [...t[0] ||= [p("circle", {
300
+ class: "opacity-25",
301
+ cx: "12",
302
+ cy: "12",
303
+ r: "10",
304
+ stroke: "currentColor",
305
+ "stroke-width": "4"
306
+ }, null, -1), p("path", {
307
+ class: "opacity-75",
308
+ fill: "currentColor",
309
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
310
+ }, null, -1)]]);
311
+ }
312
+ var ve = /*#__PURE__*/ me(he, [["render", _e]]), ye = ["placeholder", "disabled"], Z = {
313
+ __name: "TextInput",
314
+ props: {
315
+ modelValue: [String, Number],
316
+ placeholder: String,
317
+ isInvalid: Boolean,
318
+ disabled: Boolean
319
+ },
320
+ emits: ["update:modelValue", "clearValidationErrors"],
321
+ setup(e, { emit: t }) {
322
+ let n = e, r = t, i = l({
323
+ get: () => n.modelValue,
324
+ set: (e) => r("update:modelValue", e)
325
+ });
326
+ return (t, n) => V((E(), f("input", {
327
+ "onUpdate:modelValue": n[0] ||= (e) => i.value = e,
328
+ type: "text",
329
+ placeholder: e.placeholder,
330
+ disabled: e.disabled,
331
+ onFocus: n[1] ||= (e) => r("clearValidationErrors")
332
+ }, null, 40, ye)), [[L, i.value]]);
333
+ }
334
+ }, be = [
335
+ "rows",
336
+ "placeholder",
337
+ "disabled"
338
+ ], xe = {
339
+ __name: "TextAreaInput",
340
+ props: {
341
+ modelValue: [String, Number],
342
+ placeholder: String,
343
+ isInvalid: Boolean,
344
+ disabled: Boolean,
345
+ rows: {
346
+ type: [Number, String],
347
+ default: 3
348
+ }
349
+ },
350
+ emits: ["update:modelValue", "clearValidationErrors"],
351
+ setup(e, { emit: t }) {
352
+ let n = e, r = t, i = l({
353
+ get: () => n.modelValue,
354
+ set: (e) => r("update:modelValue", e)
355
+ });
356
+ return (t, n) => V((E(), f("textarea", {
357
+ "onUpdate:modelValue": n[0] ||= (e) => i.value = e,
358
+ rows: e.rows,
359
+ placeholder: e.placeholder,
360
+ disabled: e.disabled,
361
+ onFocus: n[1] ||= (e) => r("clearValidationErrors")
362
+ }, null, 40, be)), [[L, i.value]]);
363
+ }
364
+ }, Q = ["placeholder", "disabled"], Se = {
365
+ __name: "EmailInput",
366
+ props: {
367
+ modelValue: String,
368
+ placeholder: String,
369
+ isInvalid: Boolean,
370
+ disabled: Boolean
371
+ },
372
+ emits: ["update:modelValue", "clearValidationErrors"],
373
+ setup(e, { emit: t }) {
374
+ let n = e, r = t, i = l({
375
+ get: () => n.modelValue,
376
+ set: (e) => r("update:modelValue", e)
377
+ });
378
+ return (t, n) => V((E(), f("input", {
379
+ "onUpdate:modelValue": n[0] ||= (e) => i.value = e,
380
+ type: "email",
381
+ autocomplete: "email",
382
+ placeholder: e.placeholder,
383
+ disabled: e.disabled,
384
+ onFocus: n[1] ||= (e) => r("clearValidationErrors")
385
+ }, null, 40, Q)), [[L, i.value]]);
386
+ }
387
+ }, Ce = [
388
+ "type",
389
+ "autocomplete",
390
+ "placeholder",
391
+ "disabled"
392
+ ], we = {
393
+ key: 0,
394
+ xmlns: "http://www.w3.org/2000/svg",
395
+ class: "size-4",
396
+ fill: "none",
397
+ viewBox: "0 0 24 24",
398
+ stroke: "currentColor",
399
+ "stroke-width": "1.5"
400
+ }, $ = {
401
+ key: 1,
402
+ xmlns: "http://www.w3.org/2000/svg",
403
+ class: "size-4",
404
+ fill: "none",
405
+ viewBox: "0 0 24 24",
406
+ stroke: "currentColor",
407
+ "stroke-width": "1.5"
408
+ }, Te = /*@__PURE__*/ Object.assign({ inheritAttrs: !1 }, {
409
+ __name: "PasswordInput",
410
+ props: {
411
+ modelValue: String,
412
+ placeholder: String,
413
+ isInvalid: Boolean,
414
+ disabled: Boolean,
415
+ autocomplete: {
416
+ type: String,
417
+ default: "current-password"
418
+ }
419
+ },
420
+ emits: ["update:modelValue", "clearValidationErrors"],
421
+ setup(e, { emit: t }) {
422
+ let n = e, r = t, i = q("inputs"), a = O(!1), o = l({
423
+ get: () => n.modelValue,
424
+ set: (e) => r("update:modelValue", e)
425
+ });
426
+ return (t, n) => (E(), f("div", { class: x(N(i).passwordWrapper) }, [V(p("input", y(t.$attrs, {
427
+ "onUpdate:modelValue": n[0] ||= (e) => o.value = e,
428
+ type: a.value ? "text" : "password",
429
+ autocomplete: e.autocomplete,
430
+ placeholder: e.placeholder,
431
+ disabled: e.disabled,
432
+ class: "pr-9",
433
+ onFocus: n[1] ||= (e) => r("clearValidationErrors")
434
+ }), null, 16, Ce), [[F, o.value]]), p("button", {
435
+ type: "button",
436
+ class: x(N(i).passwordToggle),
437
+ tabindex: "-1",
438
+ onClick: n[2] ||= (e) => a.value = !a.value
439
+ }, [a.value ? (E(), f("svg", $, [...n[4] ||= [p("path", {
440
+ "stroke-linecap": "round",
441
+ "stroke-linejoin": "round",
442
+ d: "M3.98 8.22A10.48 10.48 0 002.04 11.68a1.01 1.01 0 000 .64C3.42 16.49 7.36 19.5 12 19.5c.99 0 1.95-.14 2.86-.39M6.23 6.23A10.45 10.45 0 0112 4.5c4.64 0 8.57 3.01 9.96 7.18.07.21.07.43 0 .64a10.5 10.5 0 01-4.19 5.45M6.23 6.23L3 3m3.23 3.23l3.65 3.65m7.89 7.89L21 21m-3.23-3.23l-3.65-3.65m0 0a3 3 0 10-4.24-4.24m4.24 4.24L9.88 9.88"
443
+ }, null, -1)]])) : (E(), f("svg", we, [...n[3] ||= [p("path", {
444
+ "stroke-linecap": "round",
445
+ "stroke-linejoin": "round",
446
+ d: "M2.04 12.32a1.01 1.01 0 010-.64C3.42 7.51 7.36 4.5 12 4.5c4.64 0 8.57 3.01 9.96 7.18.07.21.07.43 0 .64C20.58 16.49 16.64 19.5 12 19.5c-4.64 0-8.57-3.01-9.96-7.18z"
447
+ }, null, -1), p("path", {
448
+ "stroke-linecap": "round",
449
+ "stroke-linejoin": "round",
450
+ d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z"
451
+ }, null, -1)]]))], 2)], 2));
452
+ }
453
+ }), Ee = [
454
+ "min",
455
+ "max",
456
+ "step",
457
+ "placeholder",
458
+ "disabled"
459
+ ], De = {
460
+ __name: "NumberInput",
461
+ props: {
462
+ modelValue: [String, Number],
463
+ placeholder: String,
464
+ isInvalid: Boolean,
465
+ disabled: Boolean,
466
+ min: [Number, String],
467
+ max: [Number, String],
468
+ step: [Number, String]
469
+ },
470
+ emits: ["update:modelValue", "clearValidationErrors"],
471
+ setup(e, { emit: t }) {
472
+ let n = e, r = t, i = l({
473
+ get: () => n.modelValue,
474
+ set: (e) => r("update:modelValue", e)
475
+ });
476
+ return (t, n) => V((E(), f("input", {
477
+ "onUpdate:modelValue": n[0] ||= (e) => i.value = e,
478
+ type: "number",
479
+ min: e.min,
480
+ max: e.max,
481
+ step: e.step,
482
+ placeholder: e.placeholder,
483
+ disabled: e.disabled,
484
+ onFocus: n[1] ||= (e) => r("clearValidationErrors")
485
+ }, null, 40, Ee)), [[L, i.value]]);
486
+ }
487
+ }, Oe = [
488
+ "type",
489
+ "min",
490
+ "max",
491
+ "disabled"
492
+ ], ke = {
493
+ __name: "DateInput",
494
+ props: {
495
+ modelValue: String,
496
+ isInvalid: Boolean,
497
+ disabled: Boolean,
498
+ withTime: Boolean,
499
+ min: String,
500
+ max: String
501
+ },
502
+ emits: ["update:modelValue", "clearValidationErrors"],
503
+ setup(e, { emit: t }) {
504
+ let n = e, r = t, i = l({
505
+ get: () => n.modelValue,
506
+ set: (e) => r("update:modelValue", e)
507
+ });
508
+ return (t, n) => V((E(), f("input", {
509
+ "onUpdate:modelValue": n[0] ||= (e) => i.value = e,
510
+ type: e.withTime ? "datetime-local" : "date",
511
+ min: e.min,
512
+ max: e.max,
513
+ disabled: e.disabled,
514
+ onFocus: n[1] ||= (e) => r("clearValidationErrors")
515
+ }, null, 40, Oe)), [[F, i.value]]);
516
+ }
517
+ };
518
+ //#endregion
519
+ //#region src/utils/normalizeOptions.js
520
+ function Ae(e) {
521
+ return Array.isArray(e) ? e.map((e) => {
522
+ if (e == null) return null;
523
+ if (typeof e != "object") return {
524
+ id: e,
525
+ label: String(e)
526
+ };
527
+ let t = e.id ?? e.key ?? e.value ?? e.name;
528
+ return {
529
+ id: t,
530
+ label: e.label ?? e.name ?? e.option ?? e.value ?? String(t),
531
+ raw: e
532
+ };
533
+ }).filter(Boolean) : [];
534
+ }
535
+ //#endregion
536
+ //#region src/components/form/inputs/SelectInput.vue
537
+ var je = ["disabled"], Me = {
538
+ value: null,
539
+ disabled: ""
540
+ }, Ne = ["value"], Pe = {
541
+ __name: "SelectInput",
542
+ props: {
543
+ modelValue: [String, Number],
544
+ placeholder: String,
545
+ isInvalid: Boolean,
546
+ disabled: Boolean,
547
+ options: Array,
548
+ url: String
549
+ },
550
+ emits: ["update:modelValue", "clearValidationErrors"],
551
+ setup(e, { emit: t }) {
552
+ let r = e, i = t, a = O([]), s = O(!1), c = l(() => Ae(r.options ?? a.value)), u = l({
553
+ get: () => r.modelValue,
554
+ set: (e) => i("update:modelValue", e)
555
+ });
556
+ return w(() => {
557
+ !r.options && r.url && (s.value = !0, n.doGet(r.url, { all: 1 }).then((e) => {
558
+ a.value = Array.isArray(e.data) ? e.data : e.data?.data ?? [];
559
+ }).finally(() => {
560
+ s.value = !1;
561
+ }));
562
+ }), (t, n) => V((E(), f("select", {
563
+ "onUpdate:modelValue": n[0] ||= (e) => u.value = e,
564
+ disabled: e.disabled || s.value,
565
+ onFocus: n[1] ||= (e) => i("clearValidationErrors")
566
+ }, [p("option", Me, M(s.value ? "Loading..." : e.placeholder || "Select..."), 1), (E(!0), f(o, null, k(c.value, (e) => (E(), f("option", {
567
+ key: e.id,
568
+ value: e.id
569
+ }, M(e.label), 9, Ne))), 128))], 40, je)), [[I, u.value]]);
570
+ }
571
+ }, Fe = [
572
+ {
573
+ name: "Afghanistan",
574
+ dialCode: "+93",
575
+ isoCode: "AF",
576
+ flag: "https://www.countryflags.io/AF/flat/64.png"
577
+ },
578
+ {
579
+ name: "Aland Islands",
580
+ dialCode: "+358",
581
+ isoCode: "AX",
582
+ flag: "https://www.countryflags.io/AX/flat/64.png"
583
+ },
584
+ {
585
+ name: "Albania",
586
+ dialCode: "+355",
587
+ isoCode: "AL",
588
+ flag: "https://www.countryflags.io/AL/flat/64.png"
589
+ },
590
+ {
591
+ name: "Algeria",
592
+ dialCode: "+213",
593
+ isoCode: "DZ",
594
+ flag: "https://www.countryflags.io/DZ/flat/64.png"
595
+ },
596
+ {
597
+ name: "AmericanSamoa",
598
+ dialCode: "+1684",
599
+ isoCode: "AS",
600
+ flag: "https://www.countryflags.io/AS/flat/64.png"
601
+ },
602
+ {
603
+ name: "Andorra",
604
+ dialCode: "+376",
605
+ isoCode: "AD",
606
+ flag: "https://www.countryflags.io/AD/flat/64.png"
607
+ },
608
+ {
609
+ name: "Angola",
610
+ dialCode: "+244",
611
+ isoCode: "AO",
612
+ flag: "https://www.countryflags.io/AO/flat/64.png"
613
+ },
614
+ {
615
+ name: "Anguilla",
616
+ dialCode: "+1264",
617
+ isoCode: "AI",
618
+ flag: "https://www.countryflags.io/AI/flat/64.png"
619
+ },
620
+ {
621
+ name: "Antarctica",
622
+ dialCode: "+672",
623
+ isoCode: "AQ",
624
+ flag: "https://www.countryflags.io/AQ/flat/64.png"
625
+ },
626
+ {
627
+ name: "Antigua and Barbuda",
628
+ dialCode: "+1268",
629
+ isoCode: "AG",
630
+ flag: "https://www.countryflags.io/AG/flat/64.png"
631
+ },
632
+ {
633
+ name: "Argentina",
634
+ dialCode: "+54",
635
+ isoCode: "AR",
636
+ flag: "https://www.countryflags.io/AR/flat/64.png"
637
+ },
638
+ {
639
+ name: "Armenia",
640
+ dialCode: "+374",
641
+ isoCode: "AM",
642
+ flag: "https://www.countryflags.io/AM/flat/64.png"
643
+ },
644
+ {
645
+ name: "Aruba",
646
+ dialCode: "+297",
647
+ isoCode: "AW",
648
+ flag: "https://www.countryflags.io/AW/flat/64.png"
649
+ },
650
+ {
651
+ name: "Ascension Island",
652
+ dialCode: "+247",
653
+ isoCode: "AC",
654
+ flag: "https://cdn.kcak11.com/flags/AC_64.png"
655
+ },
656
+ {
657
+ name: "Australia",
658
+ dialCode: "+61",
659
+ isoCode: "AU",
660
+ flag: "https://www.countryflags.io/AU/flat/64.png"
661
+ },
662
+ {
663
+ name: "Austria",
664
+ dialCode: "+43",
665
+ isoCode: "AT",
666
+ flag: "https://www.countryflags.io/AT/flat/64.png"
667
+ },
668
+ {
669
+ name: "Azerbaijan",
670
+ dialCode: "+994",
671
+ isoCode: "AZ",
672
+ flag: "https://www.countryflags.io/AZ/flat/64.png"
673
+ },
674
+ {
675
+ name: "Bahamas",
676
+ dialCode: "+1242",
677
+ isoCode: "BS",
678
+ flag: "https://www.countryflags.io/BS/flat/64.png"
679
+ },
680
+ {
681
+ name: "Bahrain",
682
+ dialCode: "+973",
683
+ isoCode: "BH",
684
+ flag: "https://www.countryflags.io/BH/flat/64.png"
685
+ },
686
+ {
687
+ name: "Bangladesh",
688
+ dialCode: "+880",
689
+ isoCode: "BD",
690
+ flag: "https://www.countryflags.io/BD/flat/64.png"
691
+ },
692
+ {
693
+ name: "Barbados",
694
+ dialCode: "+1246",
695
+ isoCode: "BB",
696
+ flag: "https://www.countryflags.io/BB/flat/64.png"
697
+ },
698
+ {
699
+ name: "Belarus",
700
+ dialCode: "+375",
701
+ isoCode: "BY",
702
+ flag: "https://www.countryflags.io/BY/flat/64.png"
703
+ },
704
+ {
705
+ name: "Belgium",
706
+ dialCode: "+32",
707
+ isoCode: "BE",
708
+ flag: "https://www.countryflags.io/BE/flat/64.png"
709
+ },
710
+ {
711
+ name: "Belize",
712
+ dialCode: "+501",
713
+ isoCode: "BZ",
714
+ flag: "https://www.countryflags.io/BZ/flat/64.png"
715
+ },
716
+ {
717
+ name: "Benin",
718
+ dialCode: "+229",
719
+ isoCode: "BJ",
720
+ flag: "https://www.countryflags.io/BJ/flat/64.png"
721
+ },
722
+ {
723
+ name: "Bermuda",
724
+ dialCode: "+1441",
725
+ isoCode: "BM",
726
+ flag: "https://www.countryflags.io/BM/flat/64.png"
727
+ },
728
+ {
729
+ name: "Bhutan",
730
+ dialCode: "+975",
731
+ isoCode: "BT",
732
+ flag: "https://www.countryflags.io/BT/flat/64.png"
733
+ },
734
+ {
735
+ name: "Bolivia",
736
+ dialCode: "+591",
737
+ isoCode: "BO",
738
+ flag: "https://www.countryflags.io/BO/flat/64.png"
739
+ },
740
+ {
741
+ name: "Bosnia and Herzegovina",
742
+ dialCode: "+387",
743
+ isoCode: "BA",
744
+ flag: "https://www.countryflags.io/BA/flat/64.png"
745
+ },
746
+ {
747
+ name: "Botswana",
748
+ dialCode: "+267",
749
+ isoCode: "BW",
750
+ flag: "https://www.countryflags.io/BW/flat/64.png"
751
+ },
752
+ {
753
+ name: "Brazil",
754
+ dialCode: "+55",
755
+ isoCode: "BR",
756
+ flag: "https://www.countryflags.io/BR/flat/64.png"
757
+ },
758
+ {
759
+ name: "British Indian Ocean Territory",
760
+ dialCode: "+246",
761
+ isoCode: "IO",
762
+ flag: "https://www.countryflags.io/IO/flat/64.png"
763
+ },
764
+ {
765
+ name: "Brunei Darussalam",
766
+ dialCode: "+673",
767
+ isoCode: "BN",
768
+ flag: "https://www.countryflags.io/BN/flat/64.png"
769
+ },
770
+ {
771
+ name: "Bulgaria",
772
+ dialCode: "+359",
773
+ isoCode: "BG",
774
+ flag: "https://www.countryflags.io/BG/flat/64.png"
775
+ },
776
+ {
777
+ name: "Burkina Faso",
778
+ dialCode: "+226",
779
+ isoCode: "BF",
780
+ flag: "https://www.countryflags.io/BF/flat/64.png"
781
+ },
782
+ {
783
+ name: "Burundi",
784
+ dialCode: "+257",
785
+ isoCode: "BI",
786
+ flag: "https://www.countryflags.io/BI/flat/64.png"
787
+ },
788
+ {
789
+ name: "Cambodia",
790
+ dialCode: "+855",
791
+ isoCode: "KH",
792
+ flag: "https://www.countryflags.io/KH/flat/64.png"
793
+ },
794
+ {
795
+ name: "Cameroon",
796
+ dialCode: "+237",
797
+ isoCode: "CM",
798
+ flag: "https://www.countryflags.io/CM/flat/64.png"
799
+ },
800
+ {
801
+ name: "Canada",
802
+ dialCode: "+1",
803
+ isoCode: "CA",
804
+ flag: "https://www.countryflags.io/CA/flat/64.png"
805
+ },
806
+ {
807
+ name: "Cape Verde",
808
+ dialCode: "+238",
809
+ isoCode: "CV",
810
+ flag: "https://www.countryflags.io/CV/flat/64.png"
811
+ },
812
+ {
813
+ name: "Cayman Islands",
814
+ dialCode: "+1345",
815
+ isoCode: "KY",
816
+ flag: "https://www.countryflags.io/KY/flat/64.png"
817
+ },
818
+ {
819
+ name: "Central African Republic",
820
+ dialCode: "+236",
821
+ isoCode: "CF",
822
+ flag: "https://www.countryflags.io/CF/flat/64.png"
823
+ },
824
+ {
825
+ name: "Chad",
826
+ dialCode: "+235",
827
+ isoCode: "TD",
828
+ flag: "https://www.countryflags.io/TD/flat/64.png"
829
+ },
830
+ {
831
+ name: "Chile",
832
+ dialCode: "+56",
833
+ isoCode: "CL",
834
+ flag: "https://www.countryflags.io/CL/flat/64.png"
835
+ },
836
+ {
837
+ name: "China",
838
+ dialCode: "+86",
839
+ isoCode: "CN",
840
+ flag: "https://www.countryflags.io/CN/flat/64.png"
841
+ },
842
+ {
843
+ name: "Christmas Island",
844
+ dialCode: "+61",
845
+ isoCode: "CX",
846
+ flag: "https://www.countryflags.io/CX/flat/64.png"
847
+ },
848
+ {
849
+ name: "Cocos (Keeling) Islands",
850
+ dialCode: "+61",
851
+ isoCode: "CC",
852
+ flag: "https://www.countryflags.io/CC/flat/64.png"
853
+ },
854
+ {
855
+ name: "Colombia",
856
+ dialCode: "+57",
857
+ isoCode: "CO",
858
+ flag: "https://www.countryflags.io/CO/flat/64.png"
859
+ },
860
+ {
861
+ name: "Comoros",
862
+ dialCode: "+269",
863
+ isoCode: "KM",
864
+ flag: "https://www.countryflags.io/KM/flat/64.png"
865
+ },
866
+ {
867
+ name: "Congo",
868
+ dialCode: "+242",
869
+ isoCode: "CG",
870
+ flag: "https://www.countryflags.io/CG/flat/64.png"
871
+ },
872
+ {
873
+ name: "Cook Islands",
874
+ dialCode: "+682",
875
+ isoCode: "CK",
876
+ flag: "https://www.countryflags.io/CK/flat/64.png"
877
+ },
878
+ {
879
+ name: "Costa Rica",
880
+ dialCode: "+506",
881
+ isoCode: "CR",
882
+ flag: "https://www.countryflags.io/CR/flat/64.png"
883
+ },
884
+ {
885
+ name: "Croatia",
886
+ dialCode: "+385",
887
+ isoCode: "HR",
888
+ flag: "https://www.countryflags.io/HR/flat/64.png"
889
+ },
890
+ {
891
+ name: "Cuba",
892
+ dialCode: "+53",
893
+ isoCode: "CU",
894
+ flag: "https://www.countryflags.io/CU/flat/64.png"
895
+ },
896
+ {
897
+ name: "Cyprus",
898
+ dialCode: "+357",
899
+ isoCode: "CY",
900
+ flag: "https://www.countryflags.io/CY/flat/64.png"
901
+ },
902
+ {
903
+ name: "Czech Republic",
904
+ dialCode: "+420",
905
+ isoCode: "CZ",
906
+ flag: "https://www.countryflags.io/CZ/flat/64.png"
907
+ },
908
+ {
909
+ name: "Democratic Republic of the Congo",
910
+ dialCode: "+243",
911
+ isoCode: "CD",
912
+ flag: "https://www.countryflags.io/CD/flat/64.png"
913
+ },
914
+ {
915
+ name: "Denmark",
916
+ dialCode: "+45",
917
+ isoCode: "DK",
918
+ flag: "https://www.countryflags.io/DK/flat/64.png"
919
+ },
920
+ {
921
+ name: "Djibouti",
922
+ dialCode: "+253",
923
+ isoCode: "DJ",
924
+ flag: "https://www.countryflags.io/DJ/flat/64.png"
925
+ },
926
+ {
927
+ name: "Dominica",
928
+ dialCode: "+1767",
929
+ isoCode: "DM",
930
+ flag: "https://www.countryflags.io/DM/flat/64.png"
931
+ },
932
+ {
933
+ name: "Dominican Republic",
934
+ dialCode: "+1849",
935
+ isoCode: "DO",
936
+ flag: "https://www.countryflags.io/DO/flat/64.png"
937
+ },
938
+ {
939
+ name: "Ecuador",
940
+ dialCode: "+593",
941
+ isoCode: "EC",
942
+ flag: "https://www.countryflags.io/EC/flat/64.png"
943
+ },
944
+ {
945
+ name: "Egypt",
946
+ dialCode: "+20",
947
+ isoCode: "EG",
948
+ flag: "https://www.countryflags.io/EG/flat/64.png"
949
+ },
950
+ {
951
+ name: "El Salvador",
952
+ dialCode: "+503",
953
+ isoCode: "SV",
954
+ flag: "https://www.countryflags.io/SV/flat/64.png"
955
+ },
956
+ {
957
+ name: "Equatorial Guinea",
958
+ dialCode: "+240",
959
+ isoCode: "GQ",
960
+ flag: "https://www.countryflags.io/GQ/flat/64.png"
961
+ },
962
+ {
963
+ name: "Eritrea",
964
+ dialCode: "+291",
965
+ isoCode: "ER",
966
+ flag: "https://www.countryflags.io/ER/flat/64.png"
967
+ },
968
+ {
969
+ name: "Estonia",
970
+ dialCode: "+372",
971
+ isoCode: "EE",
972
+ flag: "https://www.countryflags.io/EE/flat/64.png"
973
+ },
974
+ {
975
+ name: "Eswatini",
976
+ dialCode: "+268",
977
+ isoCode: "SZ",
978
+ flag: "https://www.countryflags.io/SZ/flat/64.png"
979
+ },
980
+ {
981
+ name: "Ethiopia",
982
+ dialCode: "+251",
983
+ isoCode: "ET",
984
+ flag: "https://www.countryflags.io/ET/flat/64.png"
985
+ },
986
+ {
987
+ name: "Falkland Islands (Malvinas)",
988
+ dialCode: "+500",
989
+ isoCode: "FK",
990
+ flag: "https://www.countryflags.io/FK/flat/64.png"
991
+ },
992
+ {
993
+ name: "Faroe Islands",
994
+ dialCode: "+298",
995
+ isoCode: "FO",
996
+ flag: "https://www.countryflags.io/FO/flat/64.png"
997
+ },
998
+ {
999
+ name: "Fiji",
1000
+ dialCode: "+679",
1001
+ isoCode: "FJ",
1002
+ flag: "https://www.countryflags.io/FJ/flat/64.png"
1003
+ },
1004
+ {
1005
+ name: "Finland",
1006
+ dialCode: "+358",
1007
+ isoCode: "FI",
1008
+ flag: "https://www.countryflags.io/FI/flat/64.png"
1009
+ },
1010
+ {
1011
+ name: "France",
1012
+ dialCode: "+33",
1013
+ isoCode: "FR",
1014
+ flag: "https://www.countryflags.io/FR/flat/64.png"
1015
+ },
1016
+ {
1017
+ name: "French Guiana",
1018
+ dialCode: "+594",
1019
+ isoCode: "GF",
1020
+ flag: "https://www.countryflags.io/GF/flat/64.png"
1021
+ },
1022
+ {
1023
+ name: "French Polynesia",
1024
+ dialCode: "+689",
1025
+ isoCode: "PF",
1026
+ flag: "https://www.countryflags.io/PF/flat/64.png"
1027
+ },
1028
+ {
1029
+ name: "Gabon",
1030
+ dialCode: "+241",
1031
+ isoCode: "GA",
1032
+ flag: "https://www.countryflags.io/GA/flat/64.png"
1033
+ },
1034
+ {
1035
+ name: "Gambia",
1036
+ dialCode: "+220",
1037
+ isoCode: "GM",
1038
+ flag: "https://www.countryflags.io/GM/flat/64.png"
1039
+ },
1040
+ {
1041
+ name: "Georgia",
1042
+ dialCode: "+995",
1043
+ isoCode: "GE",
1044
+ flag: "https://www.countryflags.io/GE/flat/64.png"
1045
+ },
1046
+ {
1047
+ name: "Germany",
1048
+ dialCode: "+49",
1049
+ isoCode: "DE",
1050
+ flag: "https://www.countryflags.io/DE/flat/64.png"
1051
+ },
1052
+ {
1053
+ name: "Ghana",
1054
+ dialCode: "+233",
1055
+ isoCode: "GH",
1056
+ flag: "https://www.countryflags.io/GH/flat/64.png"
1057
+ },
1058
+ {
1059
+ name: "Gibraltar",
1060
+ dialCode: "+350",
1061
+ isoCode: "GI",
1062
+ flag: "https://www.countryflags.io/GI/flat/64.png"
1063
+ },
1064
+ {
1065
+ name: "Greece",
1066
+ dialCode: "+30",
1067
+ isoCode: "GR",
1068
+ flag: "https://www.countryflags.io/GR/flat/64.png"
1069
+ },
1070
+ {
1071
+ name: "Greenland",
1072
+ dialCode: "+299",
1073
+ isoCode: "GL",
1074
+ flag: "https://www.countryflags.io/GL/flat/64.png"
1075
+ },
1076
+ {
1077
+ name: "Grenada",
1078
+ dialCode: "+1473",
1079
+ isoCode: "GD",
1080
+ flag: "https://www.countryflags.io/GD/flat/64.png"
1081
+ },
1082
+ {
1083
+ name: "Guadeloupe",
1084
+ dialCode: "+590",
1085
+ isoCode: "GP",
1086
+ flag: "https://www.countryflags.io/GP/flat/64.png"
1087
+ },
1088
+ {
1089
+ name: "Guam",
1090
+ dialCode: "+1671",
1091
+ isoCode: "GU",
1092
+ flag: "https://www.countryflags.io/GU/flat/64.png"
1093
+ },
1094
+ {
1095
+ name: "Guatemala",
1096
+ dialCode: "+502",
1097
+ isoCode: "GT",
1098
+ flag: "https://www.countryflags.io/GT/flat/64.png"
1099
+ },
1100
+ {
1101
+ name: "Guernsey",
1102
+ dialCode: "+44",
1103
+ isoCode: "GG",
1104
+ flag: "https://www.countryflags.io/GG/flat/64.png"
1105
+ },
1106
+ {
1107
+ name: "Guinea",
1108
+ dialCode: "+224",
1109
+ isoCode: "GN",
1110
+ flag: "https://www.countryflags.io/GN/flat/64.png"
1111
+ },
1112
+ {
1113
+ name: "Guinea-Bissau",
1114
+ dialCode: "+245",
1115
+ isoCode: "GW",
1116
+ flag: "https://www.countryflags.io/GW/flat/64.png"
1117
+ },
1118
+ {
1119
+ name: "Guyana",
1120
+ dialCode: "+592",
1121
+ isoCode: "GY",
1122
+ flag: "https://www.countryflags.io/GY/flat/64.png"
1123
+ },
1124
+ {
1125
+ name: "Haiti",
1126
+ dialCode: "+509",
1127
+ isoCode: "HT",
1128
+ flag: "https://www.countryflags.io/HT/flat/64.png"
1129
+ },
1130
+ {
1131
+ name: "Holy See (Vatican City State)",
1132
+ dialCode: "+379",
1133
+ isoCode: "VA",
1134
+ flag: "https://www.countryflags.io/VA/flat/64.png"
1135
+ },
1136
+ {
1137
+ name: "Honduras",
1138
+ dialCode: "+504",
1139
+ isoCode: "HN",
1140
+ flag: "https://www.countryflags.io/HN/flat/64.png"
1141
+ },
1142
+ {
1143
+ name: "Hong Kong",
1144
+ dialCode: "+852",
1145
+ isoCode: "HK",
1146
+ flag: "https://www.countryflags.io/HK/flat/64.png"
1147
+ },
1148
+ {
1149
+ name: "Hungary",
1150
+ dialCode: "+36",
1151
+ isoCode: "HU",
1152
+ flag: "https://www.countryflags.io/HU/flat/64.png"
1153
+ },
1154
+ {
1155
+ name: "Iceland",
1156
+ dialCode: "+354",
1157
+ isoCode: "IS",
1158
+ flag: "https://www.countryflags.io/IS/flat/64.png"
1159
+ },
1160
+ {
1161
+ name: "India",
1162
+ dialCode: "+91",
1163
+ isoCode: "IN",
1164
+ flag: "https://www.countryflags.io/IN/flat/64.png"
1165
+ },
1166
+ {
1167
+ name: "Indonesia",
1168
+ dialCode: "+62",
1169
+ isoCode: "ID",
1170
+ flag: "https://www.countryflags.io/ID/flat/64.png"
1171
+ },
1172
+ {
1173
+ name: "Iran",
1174
+ dialCode: "+98",
1175
+ isoCode: "IR",
1176
+ flag: "https://www.countryflags.io/IR/flat/64.png"
1177
+ },
1178
+ {
1179
+ name: "Iraq",
1180
+ dialCode: "+964",
1181
+ isoCode: "IQ",
1182
+ flag: "https://www.countryflags.io/IQ/flat/64.png"
1183
+ },
1184
+ {
1185
+ name: "Ireland",
1186
+ dialCode: "+353",
1187
+ isoCode: "IE",
1188
+ flag: "https://www.countryflags.io/IE/flat/64.png"
1189
+ },
1190
+ {
1191
+ name: "Isle of Man",
1192
+ dialCode: "+44",
1193
+ isoCode: "IM",
1194
+ flag: "https://www.countryflags.io/IM/flat/64.png"
1195
+ },
1196
+ {
1197
+ name: "Israel",
1198
+ dialCode: "+972",
1199
+ isoCode: "IL",
1200
+ flag: "https://www.countryflags.io/IL/flat/64.png"
1201
+ },
1202
+ {
1203
+ name: "Italy",
1204
+ dialCode: "+39",
1205
+ isoCode: "IT",
1206
+ flag: "https://www.countryflags.io/IT/flat/64.png"
1207
+ },
1208
+ {
1209
+ name: "Ivory Coast / Cote d'Ivoire",
1210
+ dialCode: "+225",
1211
+ isoCode: "CI",
1212
+ flag: "https://www.countryflags.io/CI/flat/64.png"
1213
+ },
1214
+ {
1215
+ name: "Jamaica",
1216
+ dialCode: "+1876",
1217
+ isoCode: "JM",
1218
+ flag: "https://www.countryflags.io/JM/flat/64.png"
1219
+ },
1220
+ {
1221
+ name: "Japan",
1222
+ dialCode: "+81",
1223
+ isoCode: "JP",
1224
+ flag: "https://www.countryflags.io/JP/flat/64.png"
1225
+ },
1226
+ {
1227
+ name: "Jersey",
1228
+ dialCode: "+44",
1229
+ isoCode: "JE",
1230
+ flag: "https://www.countryflags.io/JE/flat/64.png"
1231
+ },
1232
+ {
1233
+ name: "Jordan",
1234
+ dialCode: "+962",
1235
+ isoCode: "JO",
1236
+ flag: "https://www.countryflags.io/JO/flat/64.png"
1237
+ },
1238
+ {
1239
+ name: "Kazakhstan",
1240
+ dialCode: "+77",
1241
+ isoCode: "KZ",
1242
+ flag: "https://www.countryflags.io/KZ/flat/64.png"
1243
+ },
1244
+ {
1245
+ name: "Kenya",
1246
+ dialCode: "+254",
1247
+ isoCode: "KE",
1248
+ flag: "https://www.countryflags.io/KE/flat/64.png"
1249
+ },
1250
+ {
1251
+ name: "Kiribati",
1252
+ dialCode: "+686",
1253
+ isoCode: "KI",
1254
+ flag: "https://www.countryflags.io/KI/flat/64.png"
1255
+ },
1256
+ {
1257
+ name: "Korea, Democratic People's Republic of Korea",
1258
+ dialCode: "+850",
1259
+ isoCode: "KP",
1260
+ flag: "https://www.countryflags.io/KP/flat/64.png"
1261
+ },
1262
+ {
1263
+ name: "Korea, Republic of South Korea",
1264
+ dialCode: "+82",
1265
+ isoCode: "KR",
1266
+ flag: "https://www.countryflags.io/KR/flat/64.png"
1267
+ },
1268
+ {
1269
+ name: "Kosovo",
1270
+ dialCode: "+383",
1271
+ isoCode: "XK",
1272
+ flag: "https://www.countryflags.io/XK/flat/64.png"
1273
+ },
1274
+ {
1275
+ name: "Kuwait",
1276
+ dialCode: "+965",
1277
+ isoCode: "KW",
1278
+ flag: "https://www.countryflags.io/KW/flat/64.png"
1279
+ },
1280
+ {
1281
+ name: "Kyrgyzstan",
1282
+ dialCode: "+996",
1283
+ isoCode: "KG",
1284
+ flag: "https://www.countryflags.io/KG/flat/64.png"
1285
+ },
1286
+ {
1287
+ name: "Laos",
1288
+ dialCode: "+856",
1289
+ isoCode: "LA",
1290
+ flag: "https://www.countryflags.io/LA/flat/64.png"
1291
+ },
1292
+ {
1293
+ name: "Latvia",
1294
+ dialCode: "+371",
1295
+ isoCode: "LV",
1296
+ flag: "https://www.countryflags.io/LV/flat/64.png"
1297
+ },
1298
+ {
1299
+ name: "Lebanon",
1300
+ dialCode: "+961",
1301
+ isoCode: "LB",
1302
+ flag: "https://www.countryflags.io/LB/flat/64.png"
1303
+ },
1304
+ {
1305
+ name: "Lesotho",
1306
+ dialCode: "+266",
1307
+ isoCode: "LS",
1308
+ flag: "https://www.countryflags.io/LS/flat/64.png"
1309
+ },
1310
+ {
1311
+ name: "Liberia",
1312
+ dialCode: "+231",
1313
+ isoCode: "LR",
1314
+ flag: "https://www.countryflags.io/LR/flat/64.png"
1315
+ },
1316
+ {
1317
+ name: "Libya",
1318
+ dialCode: "+218",
1319
+ isoCode: "LY",
1320
+ flag: "https://www.countryflags.io/LY/flat/64.png"
1321
+ },
1322
+ {
1323
+ name: "Liechtenstein",
1324
+ dialCode: "+423",
1325
+ isoCode: "LI",
1326
+ flag: "https://www.countryflags.io/LI/flat/64.png"
1327
+ },
1328
+ {
1329
+ name: "Lithuania",
1330
+ dialCode: "+370",
1331
+ isoCode: "LT",
1332
+ flag: "https://www.countryflags.io/LT/flat/64.png"
1333
+ },
1334
+ {
1335
+ name: "Luxembourg",
1336
+ dialCode: "+352",
1337
+ isoCode: "LU",
1338
+ flag: "https://www.countryflags.io/LU/flat/64.png"
1339
+ },
1340
+ {
1341
+ name: "Macau",
1342
+ dialCode: "+853",
1343
+ isoCode: "MO",
1344
+ flag: "https://www.countryflags.io/MO/flat/64.png"
1345
+ },
1346
+ {
1347
+ name: "Madagascar",
1348
+ dialCode: "+261",
1349
+ isoCode: "MG",
1350
+ flag: "https://www.countryflags.io/MG/flat/64.png"
1351
+ },
1352
+ {
1353
+ name: "Malawi",
1354
+ dialCode: "+265",
1355
+ isoCode: "MW",
1356
+ flag: "https://www.countryflags.io/MW/flat/64.png"
1357
+ },
1358
+ {
1359
+ name: "Malaysia",
1360
+ dialCode: "+60",
1361
+ isoCode: "MY",
1362
+ flag: "https://www.countryflags.io/MY/flat/64.png"
1363
+ },
1364
+ {
1365
+ name: "Maldives",
1366
+ dialCode: "+960",
1367
+ isoCode: "MV",
1368
+ flag: "https://www.countryflags.io/MV/flat/64.png"
1369
+ },
1370
+ {
1371
+ name: "Mali",
1372
+ dialCode: "+223",
1373
+ isoCode: "ML",
1374
+ flag: "https://www.countryflags.io/ML/flat/64.png"
1375
+ },
1376
+ {
1377
+ name: "Malta",
1378
+ dialCode: "+356",
1379
+ isoCode: "MT",
1380
+ flag: "https://www.countryflags.io/MT/flat/64.png"
1381
+ },
1382
+ {
1383
+ name: "Marshall Islands",
1384
+ dialCode: "+692",
1385
+ isoCode: "MH",
1386
+ flag: "https://www.countryflags.io/MH/flat/64.png"
1387
+ },
1388
+ {
1389
+ name: "Martinique",
1390
+ dialCode: "+596",
1391
+ isoCode: "MQ",
1392
+ flag: "https://www.countryflags.io/MQ/flat/64.png"
1393
+ },
1394
+ {
1395
+ name: "Mauritania",
1396
+ dialCode: "+222",
1397
+ isoCode: "MR",
1398
+ flag: "https://www.countryflags.io/MR/flat/64.png"
1399
+ },
1400
+ {
1401
+ name: "Mauritius",
1402
+ dialCode: "+230",
1403
+ isoCode: "MU",
1404
+ flag: "https://www.countryflags.io/MU/flat/64.png"
1405
+ },
1406
+ {
1407
+ name: "Mayotte",
1408
+ dialCode: "+262",
1409
+ isoCode: "YT",
1410
+ flag: "https://www.countryflags.io/YT/flat/64.png"
1411
+ },
1412
+ {
1413
+ name: "Mexico",
1414
+ dialCode: "+52",
1415
+ isoCode: "MX",
1416
+ flag: "https://www.countryflags.io/MX/flat/64.png"
1417
+ },
1418
+ {
1419
+ name: "Micronesia, Federated States of Micronesia",
1420
+ dialCode: "+691",
1421
+ isoCode: "FM",
1422
+ flag: "https://www.countryflags.io/FM/flat/64.png"
1423
+ },
1424
+ {
1425
+ name: "Moldova",
1426
+ dialCode: "+373",
1427
+ isoCode: "MD",
1428
+ flag: "https://www.countryflags.io/MD/flat/64.png"
1429
+ },
1430
+ {
1431
+ name: "Monaco",
1432
+ dialCode: "+377",
1433
+ isoCode: "MC",
1434
+ flag: "https://www.countryflags.io/MC/flat/64.png"
1435
+ },
1436
+ {
1437
+ name: "Mongolia",
1438
+ dialCode: "+976",
1439
+ isoCode: "MN",
1440
+ flag: "https://www.countryflags.io/MN/flat/64.png"
1441
+ },
1442
+ {
1443
+ name: "Montenegro",
1444
+ dialCode: "+382",
1445
+ isoCode: "ME",
1446
+ flag: "https://www.countryflags.io/ME/flat/64.png"
1447
+ },
1448
+ {
1449
+ name: "Montserrat",
1450
+ dialCode: "+1664",
1451
+ isoCode: "MS",
1452
+ flag: "https://www.countryflags.io/MS/flat/64.png"
1453
+ },
1454
+ {
1455
+ name: "Morocco",
1456
+ dialCode: "+212",
1457
+ isoCode: "MA",
1458
+ flag: "https://www.countryflags.io/MA/flat/64.png"
1459
+ },
1460
+ {
1461
+ name: "Mozambique",
1462
+ dialCode: "+258",
1463
+ isoCode: "MZ",
1464
+ flag: "https://www.countryflags.io/MZ/flat/64.png"
1465
+ },
1466
+ {
1467
+ name: "Myanmar",
1468
+ dialCode: "+95",
1469
+ isoCode: "MM",
1470
+ flag: "https://www.countryflags.io/MM/flat/64.png"
1471
+ },
1472
+ {
1473
+ name: "Namibia",
1474
+ dialCode: "+264",
1475
+ isoCode: "NA",
1476
+ flag: "https://www.countryflags.io/NA/flat/64.png"
1477
+ },
1478
+ {
1479
+ name: "Nauru",
1480
+ dialCode: "+674",
1481
+ isoCode: "NR",
1482
+ flag: "https://www.countryflags.io/NR/flat/64.png"
1483
+ },
1484
+ {
1485
+ name: "Nepal",
1486
+ dialCode: "+977",
1487
+ isoCode: "NP",
1488
+ flag: "https://www.countryflags.io/NP/flat/64.png"
1489
+ },
1490
+ {
1491
+ name: "Netherlands",
1492
+ dialCode: "+31",
1493
+ isoCode: "NL",
1494
+ flag: "https://www.countryflags.io/NL/flat/64.png"
1495
+ },
1496
+ {
1497
+ name: "Netherlands Antilles",
1498
+ dialCode: "+599",
1499
+ isoCode: "AN",
1500
+ flag: "https://www.countryflags.io/AN/flat/64.png"
1501
+ },
1502
+ {
1503
+ name: "New Caledonia",
1504
+ dialCode: "+687",
1505
+ isoCode: "NC",
1506
+ flag: "https://www.countryflags.io/NC/flat/64.png"
1507
+ },
1508
+ {
1509
+ name: "New Zealand",
1510
+ dialCode: "+64",
1511
+ isoCode: "NZ",
1512
+ flag: "https://www.countryflags.io/NZ/flat/64.png"
1513
+ },
1514
+ {
1515
+ name: "Nicaragua",
1516
+ dialCode: "+505",
1517
+ isoCode: "NI",
1518
+ flag: "https://www.countryflags.io/NI/flat/64.png"
1519
+ },
1520
+ {
1521
+ name: "Niger",
1522
+ dialCode: "+227",
1523
+ isoCode: "NE",
1524
+ flag: "https://www.countryflags.io/NE/flat/64.png"
1525
+ },
1526
+ {
1527
+ name: "Nigeria",
1528
+ dialCode: "+234",
1529
+ isoCode: "NG",
1530
+ flag: "https://www.countryflags.io/NG/flat/64.png"
1531
+ },
1532
+ {
1533
+ name: "Niue",
1534
+ dialCode: "+683",
1535
+ isoCode: "NU",
1536
+ flag: "https://www.countryflags.io/NU/flat/64.png"
1537
+ },
1538
+ {
1539
+ name: "Norfolk Island",
1540
+ dialCode: "+672",
1541
+ isoCode: "NF",
1542
+ flag: "https://www.countryflags.io/NF/flat/64.png"
1543
+ },
1544
+ {
1545
+ name: "North Macedonia",
1546
+ dialCode: "+389",
1547
+ isoCode: "MK",
1548
+ flag: "https://www.countryflags.io/MK/flat/64.png"
1549
+ },
1550
+ {
1551
+ name: "Northern Mariana Islands",
1552
+ dialCode: "+1670",
1553
+ isoCode: "MP",
1554
+ flag: "https://www.countryflags.io/MP/flat/64.png"
1555
+ },
1556
+ {
1557
+ name: "Norway",
1558
+ dialCode: "+47",
1559
+ isoCode: "NO",
1560
+ flag: "https://www.countryflags.io/NO/flat/64.png"
1561
+ },
1562
+ {
1563
+ name: "Oman",
1564
+ dialCode: "+968",
1565
+ isoCode: "OM",
1566
+ flag: "https://www.countryflags.io/OM/flat/64.png"
1567
+ },
1568
+ {
1569
+ name: "Pakistan",
1570
+ dialCode: "+92",
1571
+ isoCode: "PK",
1572
+ flag: "https://www.countryflags.io/PK/flat/64.png"
1573
+ },
1574
+ {
1575
+ name: "Palau",
1576
+ dialCode: "+680",
1577
+ isoCode: "PW",
1578
+ flag: "https://www.countryflags.io/PW/flat/64.png"
1579
+ },
1580
+ {
1581
+ name: "Palestine",
1582
+ dialCode: "+970",
1583
+ isoCode: "PS",
1584
+ flag: "https://www.countryflags.io/PS/flat/64.png"
1585
+ },
1586
+ {
1587
+ name: "Panama",
1588
+ dialCode: "+507",
1589
+ isoCode: "PA",
1590
+ flag: "https://www.countryflags.io/PA/flat/64.png"
1591
+ },
1592
+ {
1593
+ name: "Papua New Guinea",
1594
+ dialCode: "+675",
1595
+ isoCode: "PG",
1596
+ flag: "https://www.countryflags.io/PG/flat/64.png"
1597
+ },
1598
+ {
1599
+ name: "Paraguay",
1600
+ dialCode: "+595",
1601
+ isoCode: "PY",
1602
+ flag: "https://www.countryflags.io/PY/flat/64.png"
1603
+ },
1604
+ {
1605
+ name: "Peru",
1606
+ dialCode: "+51",
1607
+ isoCode: "PE",
1608
+ flag: "https://www.countryflags.io/PE/flat/64.png"
1609
+ },
1610
+ {
1611
+ name: "Philippines",
1612
+ dialCode: "+63",
1613
+ isoCode: "PH",
1614
+ flag: "https://www.countryflags.io/PH/flat/64.png"
1615
+ },
1616
+ {
1617
+ name: "Pitcairn",
1618
+ dialCode: "+872",
1619
+ isoCode: "PN",
1620
+ flag: "https://www.countryflags.io/PN/flat/64.png"
1621
+ },
1622
+ {
1623
+ name: "Poland",
1624
+ dialCode: "+48",
1625
+ isoCode: "PL",
1626
+ flag: "https://www.countryflags.io/PL/flat/64.png"
1627
+ },
1628
+ {
1629
+ name: "Portugal",
1630
+ dialCode: "+351",
1631
+ isoCode: "PT",
1632
+ flag: "https://www.countryflags.io/PT/flat/64.png"
1633
+ },
1634
+ {
1635
+ name: "Puerto Rico",
1636
+ dialCode: "+1939",
1637
+ isoCode: "PR",
1638
+ flag: "https://www.countryflags.io/PR/flat/64.png"
1639
+ },
1640
+ {
1641
+ name: "Qatar",
1642
+ dialCode: "+974",
1643
+ isoCode: "QA",
1644
+ flag: "https://www.countryflags.io/QA/flat/64.png"
1645
+ },
1646
+ {
1647
+ name: "Reunion",
1648
+ dialCode: "+262",
1649
+ isoCode: "RE",
1650
+ flag: "https://www.countryflags.io/RE/flat/64.png"
1651
+ },
1652
+ {
1653
+ name: "Romania",
1654
+ dialCode: "+40",
1655
+ isoCode: "RO",
1656
+ flag: "https://www.countryflags.io/RO/flat/64.png"
1657
+ },
1658
+ {
1659
+ name: "Russia",
1660
+ dialCode: "+7",
1661
+ isoCode: "RU",
1662
+ flag: "https://www.countryflags.io/RU/flat/64.png"
1663
+ },
1664
+ {
1665
+ name: "Rwanda",
1666
+ dialCode: "+250",
1667
+ isoCode: "RW",
1668
+ flag: "https://www.countryflags.io/RW/flat/64.png"
1669
+ },
1670
+ {
1671
+ name: "Saint Barthelemy",
1672
+ dialCode: "+590",
1673
+ isoCode: "BL",
1674
+ flag: "https://www.countryflags.io/BL/flat/64.png"
1675
+ },
1676
+ {
1677
+ name: "Saint Helena, Ascension and Tristan Da Cunha",
1678
+ dialCode: "+290",
1679
+ isoCode: "SH",
1680
+ flag: "https://www.countryflags.io/SH/flat/64.png"
1681
+ },
1682
+ {
1683
+ name: "Saint Kitts and Nevis",
1684
+ dialCode: "+1869",
1685
+ isoCode: "KN",
1686
+ flag: "https://www.countryflags.io/KN/flat/64.png"
1687
+ },
1688
+ {
1689
+ name: "Saint Lucia",
1690
+ dialCode: "+1758",
1691
+ isoCode: "LC",
1692
+ flag: "https://www.countryflags.io/LC/flat/64.png"
1693
+ },
1694
+ {
1695
+ name: "Saint Martin",
1696
+ dialCode: "+590",
1697
+ isoCode: "MF",
1698
+ flag: "https://www.countryflags.io/MF/flat/64.png"
1699
+ },
1700
+ {
1701
+ name: "Saint Pierre and Miquelon",
1702
+ dialCode: "+508",
1703
+ isoCode: "PM",
1704
+ flag: "https://www.countryflags.io/PM/flat/64.png"
1705
+ },
1706
+ {
1707
+ name: "Saint Vincent and the Grenadines",
1708
+ dialCode: "+1784",
1709
+ isoCode: "VC",
1710
+ flag: "https://www.countryflags.io/VC/flat/64.png"
1711
+ },
1712
+ {
1713
+ name: "Samoa",
1714
+ dialCode: "+685",
1715
+ isoCode: "WS",
1716
+ flag: "https://www.countryflags.io/WS/flat/64.png"
1717
+ },
1718
+ {
1719
+ name: "San Marino",
1720
+ dialCode: "+378",
1721
+ isoCode: "SM",
1722
+ flag: "https://www.countryflags.io/SM/flat/64.png"
1723
+ },
1724
+ {
1725
+ name: "Sao Tome and Principe",
1726
+ dialCode: "+239",
1727
+ isoCode: "ST",
1728
+ flag: "https://www.countryflags.io/ST/flat/64.png"
1729
+ },
1730
+ {
1731
+ name: "Saudi Arabia",
1732
+ dialCode: "+966",
1733
+ isoCode: "SA",
1734
+ flag: "https://www.countryflags.io/SA/flat/64.png"
1735
+ },
1736
+ {
1737
+ name: "Senegal",
1738
+ dialCode: "+221",
1739
+ isoCode: "SN",
1740
+ flag: "https://www.countryflags.io/SN/flat/64.png"
1741
+ },
1742
+ {
1743
+ name: "Serbia",
1744
+ dialCode: "+381",
1745
+ isoCode: "RS",
1746
+ flag: "https://www.countryflags.io/RS/flat/64.png"
1747
+ },
1748
+ {
1749
+ name: "Seychelles",
1750
+ dialCode: "+248",
1751
+ isoCode: "SC",
1752
+ flag: "https://www.countryflags.io/SC/flat/64.png"
1753
+ },
1754
+ {
1755
+ name: "Sierra Leone",
1756
+ dialCode: "+232",
1757
+ isoCode: "SL",
1758
+ flag: "https://www.countryflags.io/SL/flat/64.png"
1759
+ },
1760
+ {
1761
+ name: "Singapore",
1762
+ dialCode: "+65",
1763
+ isoCode: "SG",
1764
+ flag: "https://www.countryflags.io/SG/flat/64.png"
1765
+ },
1766
+ {
1767
+ name: "Sint Maarten",
1768
+ dialCode: "+1721",
1769
+ isoCode: "SX",
1770
+ flag: "https://www.countryflags.io/SX/flat/64.png"
1771
+ },
1772
+ {
1773
+ name: "Slovakia",
1774
+ dialCode: "+421",
1775
+ isoCode: "SK",
1776
+ flag: "https://www.countryflags.io/SK/flat/64.png"
1777
+ },
1778
+ {
1779
+ name: "Slovenia",
1780
+ dialCode: "+386",
1781
+ isoCode: "SI",
1782
+ flag: "https://www.countryflags.io/SI/flat/64.png"
1783
+ },
1784
+ {
1785
+ name: "Solomon Islands",
1786
+ dialCode: "+677",
1787
+ isoCode: "SB",
1788
+ flag: "https://www.countryflags.io/SB/flat/64.png"
1789
+ },
1790
+ {
1791
+ name: "Somalia",
1792
+ dialCode: "+252",
1793
+ isoCode: "SO",
1794
+ flag: "https://www.countryflags.io/SO/flat/64.png"
1795
+ },
1796
+ {
1797
+ name: "South Africa",
1798
+ dialCode: "+27",
1799
+ isoCode: "ZA",
1800
+ flag: "https://www.countryflags.io/ZA/flat/64.png"
1801
+ },
1802
+ {
1803
+ name: "South Georgia and the South Sandwich Islands",
1804
+ dialCode: "+500",
1805
+ isoCode: "GS",
1806
+ flag: "https://www.countryflags.io/GS/flat/64.png"
1807
+ },
1808
+ {
1809
+ name: "South Sudan",
1810
+ dialCode: "+211",
1811
+ isoCode: "SS",
1812
+ flag: "https://www.countryflags.io/SS/flat/64.png"
1813
+ },
1814
+ {
1815
+ name: "Spain",
1816
+ dialCode: "+34",
1817
+ isoCode: "ES",
1818
+ flag: "https://www.countryflags.io/ES/flat/64.png"
1819
+ },
1820
+ {
1821
+ name: "Sri Lanka",
1822
+ dialCode: "+94",
1823
+ isoCode: "LK",
1824
+ flag: "https://www.countryflags.io/LK/flat/64.png"
1825
+ },
1826
+ {
1827
+ name: "Sudan",
1828
+ dialCode: "+249",
1829
+ isoCode: "SD",
1830
+ flag: "https://www.countryflags.io/SD/flat/64.png"
1831
+ },
1832
+ {
1833
+ name: "Suriname",
1834
+ dialCode: "+597",
1835
+ isoCode: "SR",
1836
+ flag: "https://www.countryflags.io/SR/flat/64.png"
1837
+ },
1838
+ {
1839
+ name: "Svalbard and Jan Mayen",
1840
+ dialCode: "+47",
1841
+ isoCode: "SJ",
1842
+ flag: "https://www.countryflags.io/SJ/flat/64.png"
1843
+ },
1844
+ {
1845
+ name: "Sweden",
1846
+ dialCode: "+46",
1847
+ isoCode: "SE",
1848
+ flag: "https://www.countryflags.io/SE/flat/64.png"
1849
+ },
1850
+ {
1851
+ name: "Switzerland",
1852
+ dialCode: "+41",
1853
+ isoCode: "CH",
1854
+ flag: "https://www.countryflags.io/CH/flat/64.png"
1855
+ },
1856
+ {
1857
+ name: "Syrian Arab Republic",
1858
+ dialCode: "+963",
1859
+ isoCode: "SY",
1860
+ flag: "https://www.countryflags.io/SY/flat/64.png"
1861
+ },
1862
+ {
1863
+ name: "Taiwan",
1864
+ dialCode: "+886",
1865
+ isoCode: "TW",
1866
+ flag: "https://www.countryflags.io/TW/flat/64.png"
1867
+ },
1868
+ {
1869
+ name: "Tajikistan",
1870
+ dialCode: "+992",
1871
+ isoCode: "TJ",
1872
+ flag: "https://www.countryflags.io/TJ/flat/64.png"
1873
+ },
1874
+ {
1875
+ name: "Tanzania, United Republic of Tanzania",
1876
+ dialCode: "+255",
1877
+ isoCode: "TZ",
1878
+ flag: "https://www.countryflags.io/TZ/flat/64.png"
1879
+ },
1880
+ {
1881
+ name: "Thailand",
1882
+ dialCode: "+66",
1883
+ isoCode: "TH",
1884
+ flag: "https://www.countryflags.io/TH/flat/64.png"
1885
+ },
1886
+ {
1887
+ name: "Timor-Leste",
1888
+ dialCode: "+670",
1889
+ isoCode: "TL",
1890
+ flag: "https://www.countryflags.io/TL/flat/64.png"
1891
+ },
1892
+ {
1893
+ name: "Togo",
1894
+ dialCode: "+228",
1895
+ isoCode: "TG",
1896
+ flag: "https://www.countryflags.io/TG/flat/64.png"
1897
+ },
1898
+ {
1899
+ name: "Tokelau",
1900
+ dialCode: "+690",
1901
+ isoCode: "TK",
1902
+ flag: "https://www.countryflags.io/TK/flat/64.png"
1903
+ },
1904
+ {
1905
+ name: "Tonga",
1906
+ dialCode: "+676",
1907
+ isoCode: "TO",
1908
+ flag: "https://www.countryflags.io/TO/flat/64.png"
1909
+ },
1910
+ {
1911
+ name: "Trinidad and Tobago",
1912
+ dialCode: "+1868",
1913
+ isoCode: "TT",
1914
+ flag: "https://www.countryflags.io/TT/flat/64.png"
1915
+ },
1916
+ {
1917
+ name: "Tunisia",
1918
+ dialCode: "+216",
1919
+ isoCode: "TN",
1920
+ flag: "https://www.countryflags.io/TN/flat/64.png"
1921
+ },
1922
+ {
1923
+ name: "Turkey",
1924
+ dialCode: "+90",
1925
+ isoCode: "TR",
1926
+ flag: "https://www.countryflags.io/TR/flat/64.png"
1927
+ },
1928
+ {
1929
+ name: "Turkmenistan",
1930
+ dialCode: "+993",
1931
+ isoCode: "TM",
1932
+ flag: "https://www.countryflags.io/TM/flat/64.png"
1933
+ },
1934
+ {
1935
+ name: "Turks and Caicos Islands",
1936
+ dialCode: "+1649",
1937
+ isoCode: "TC",
1938
+ flag: "https://www.countryflags.io/TC/flat/64.png"
1939
+ },
1940
+ {
1941
+ name: "Tuvalu",
1942
+ dialCode: "+688",
1943
+ isoCode: "TV",
1944
+ flag: "https://www.countryflags.io/TV/flat/64.png"
1945
+ },
1946
+ {
1947
+ name: "Uganda",
1948
+ dialCode: "+256",
1949
+ isoCode: "UG",
1950
+ flag: "https://www.countryflags.io/UG/flat/64.png"
1951
+ },
1952
+ {
1953
+ name: "Ukraine",
1954
+ dialCode: "+380",
1955
+ isoCode: "UA",
1956
+ flag: "https://www.countryflags.io/UA/flat/64.png"
1957
+ },
1958
+ {
1959
+ name: "United Arab Emirates",
1960
+ dialCode: "+971",
1961
+ isoCode: "AE",
1962
+ flag: "https://www.countryflags.io/AE/flat/64.png"
1963
+ },
1964
+ {
1965
+ name: "United Kingdom",
1966
+ dialCode: "+44",
1967
+ isoCode: "GB",
1968
+ flag: "https://www.countryflags.io/GB/flat/64.png"
1969
+ },
1970
+ {
1971
+ name: "United States",
1972
+ dialCode: "+1",
1973
+ isoCode: "US",
1974
+ flag: "https://www.countryflags.io/US/flat/64.png"
1975
+ },
1976
+ {
1977
+ name: "Uruguay",
1978
+ dialCode: "+598",
1979
+ isoCode: "UY",
1980
+ flag: "https://www.countryflags.io/UY/flat/64.png"
1981
+ },
1982
+ {
1983
+ name: "Uzbekistan",
1984
+ dialCode: "+998",
1985
+ isoCode: "UZ",
1986
+ flag: "https://www.countryflags.io/UZ/flat/64.png"
1987
+ },
1988
+ {
1989
+ name: "Vanuatu",
1990
+ dialCode: "+678",
1991
+ isoCode: "VU",
1992
+ flag: "https://www.countryflags.io/VU/flat/64.png"
1993
+ },
1994
+ {
1995
+ name: "Venezuela, Bolivarian Republic of Venezuela",
1996
+ dialCode: "+58",
1997
+ isoCode: "VE",
1998
+ flag: "https://www.countryflags.io/VE/flat/64.png"
1999
+ },
2000
+ {
2001
+ name: "Vietnam",
2002
+ dialCode: "+84",
2003
+ isoCode: "VN",
2004
+ flag: "https://www.countryflags.io/VN/flat/64.png"
2005
+ },
2006
+ {
2007
+ name: "Virgin Islands, British",
2008
+ dialCode: "+1284",
2009
+ isoCode: "VG",
2010
+ flag: "https://www.countryflags.io/VG/flat/64.png"
2011
+ },
2012
+ {
2013
+ name: "Virgin Islands, U.S.",
2014
+ dialCode: "+1340",
2015
+ isoCode: "VI",
2016
+ flag: "https://www.countryflags.io/VI/flat/64.png"
2017
+ },
2018
+ {
2019
+ name: "Wallis and Futuna",
2020
+ dialCode: "+681",
2021
+ isoCode: "WF",
2022
+ flag: "https://www.countryflags.io/WF/flat/64.png"
2023
+ },
2024
+ {
2025
+ name: "Yemen",
2026
+ dialCode: "+967",
2027
+ isoCode: "YE",
2028
+ flag: "https://www.countryflags.io/YE/flat/64.png"
2029
+ },
2030
+ {
2031
+ name: "Zambia",
2032
+ dialCode: "+260",
2033
+ isoCode: "ZM",
2034
+ flag: "https://www.countryflags.io/ZM/flat/64.png"
2035
+ },
2036
+ {
2037
+ name: "Zimbabwe",
2038
+ dialCode: "+263",
2039
+ isoCode: "ZW",
2040
+ flag: "https://www.countryflags.io/ZW/flat/64.png"
2041
+ }
2042
+ ], Ie = ["disabled", "aria-expanded"], Le = ["placeholder", "disabled"], Re = [
2043
+ "aria-selected",
2044
+ "onPointerdown",
2045
+ "onMouseenter"
2046
+ ], ze = /*@__PURE__*/ Object.assign({ inheritAttrs: !1 }, {
2047
+ __name: "PhoneInput",
2048
+ props: {
2049
+ modelValue: String,
2050
+ placeholder: {
2051
+ type: String,
2052
+ default: "712345678"
2053
+ },
2054
+ isInvalid: Boolean,
2055
+ disabled: Boolean,
2056
+ countryCode: {
2057
+ type: String,
2058
+ default: "KE"
2059
+ },
2060
+ detectCountry: Boolean
2061
+ },
2062
+ emits: ["update:modelValue", "clearValidationErrors"],
2063
+ setup(e, { emit: t }) {
2064
+ let r = e, i = t, a = q("inputs"), s = O(null), c = O(null), u = O(""), m = O(!1), h = O(""), g = O(-1), _ = O(Fe.find((e) => e.isoCode === r.countryCode.toUpperCase()) ?? Fe[0]), v = (e) => String(e ?? "").toUpperCase().split("").map((e) => String.fromCodePoint(127462 + e.charCodeAt(0) - 65)).join(""), y = l(() => {
2065
+ let e = h.value.trim().toLowerCase();
2066
+ return e ? Fe.filter((t) => t.name.toLowerCase().includes(e) || t.dialCode.includes(e) || t.isoCode.toLowerCase().includes(e)) : Fe;
2067
+ }), S = async () => {
2068
+ r.disabled || (m.value = !m.value, m.value && (h.value = "", g.value = -1, await b(), c.value?.focus()));
2069
+ }, T = (e) => {
2070
+ _.value = e, m.value = !1, ee();
2071
+ }, D = (e) => {
2072
+ if (e.key === "ArrowDown") e.preventDefault(), g.value = Math.min(g.value + 1, y.value.length - 1);
2073
+ else if (e.key === "ArrowUp") e.preventDefault(), g.value = Math.max(g.value - 1, 0);
2074
+ else if (e.key === "Enter") {
2075
+ e.preventDefault();
2076
+ let t = y.value[Math.max(g.value, 0)];
2077
+ t && T(t);
2078
+ } else e.key === "Escape" && (m.value = !1);
2079
+ }, ee = () => {
2080
+ let e = (u.value || "").replace(/^0/, "");
2081
+ i("update:modelValue", e ? _.value.dialCode + e : "");
2082
+ }, A = (e) => {
2083
+ if (!e) {
2084
+ u.value = "";
2085
+ return;
2086
+ }
2087
+ let t = Fe.find((t) => e.startsWith(t.dialCode));
2088
+ t ? (_.value = t, u.value = e.replace(t.dialCode, "")) : u.value = e;
2089
+ };
2090
+ z(() => r.modelValue, A);
2091
+ let j = (e) => {
2092
+ s.value && !s.value.contains(e.target) && (m.value = !1);
2093
+ };
2094
+ return w(() => {
2095
+ document.addEventListener("pointerdown", j), A(r.modelValue), r.detectCountry && !r.modelValue && n.doGet("sh-country-code").then((e) => {
2096
+ let t = e.data?.countryCode, n = t && Fe.find((e) => e.isoCode === t.toUpperCase());
2097
+ n && (_.value = n);
2098
+ }).catch(() => {});
2099
+ }), C(() => {
2100
+ document.removeEventListener("pointerdown", j);
2101
+ }), (t, n) => (E(), f("div", {
2102
+ ref_key: "root",
2103
+ ref: s,
2104
+ class: x([N(a).phone.wrapper, e.isInvalid ? "border-red-500 focus-within:ring-red-500/30" : ""])
2105
+ }, [
2106
+ p("button", {
2107
+ type: "button",
2108
+ class: x(N(a).phone.trigger),
2109
+ disabled: e.disabled,
2110
+ "aria-haspopup": "listbox",
2111
+ "aria-expanded": m.value,
2112
+ onClick: S
2113
+ }, [
2114
+ p("span", { class: x(N(a).phone.flag) }, M(v(_.value.isoCode)), 3),
2115
+ p("span", { class: x(N(a).phone.dial) }, M(_.value.dialCode), 3),
2116
+ (E(), f("svg", {
2117
+ xmlns: "http://www.w3.org/2000/svg",
2118
+ class: x(N(a).phone.chevron),
2119
+ fill: "none",
2120
+ viewBox: "0 0 24 24",
2121
+ stroke: "currentColor",
2122
+ "stroke-width": "2"
2123
+ }, [...n[4] ||= [p("path", {
2124
+ "stroke-linecap": "round",
2125
+ "stroke-linejoin": "round",
2126
+ d: "M19.5 8.25l-7.5 7.5-7.5-7.5"
2127
+ }, null, -1)]], 2))
2128
+ ], 10, Ie),
2129
+ V(p("input", {
2130
+ "onUpdate:modelValue": n[0] ||= (e) => u.value = e,
2131
+ type: "tel",
2132
+ class: x(N(a).phone.input),
2133
+ placeholder: e.placeholder,
2134
+ disabled: e.disabled,
2135
+ onInput: ee,
2136
+ onFocus: n[1] ||= (e) => i("clearValidationErrors")
2137
+ }, null, 42, Le), [[L, u.value]]),
2138
+ m.value ? (E(), f("div", {
2139
+ key: 0,
2140
+ class: x(N(a).phone.dropdown)
2141
+ }, [V(p("input", {
2142
+ ref_key: "searchEl",
2143
+ ref: c,
2144
+ "onUpdate:modelValue": n[2] ||= (e) => h.value = e,
2145
+ type: "text",
2146
+ class: x(N(a).phone.search),
2147
+ placeholder: "Search country or code...",
2148
+ onKeydown: D,
2149
+ onInput: n[3] ||= (e) => g.value = 0
2150
+ }, null, 34), [[L, h.value]]), p("div", {
2151
+ class: x(N(a).phone.list),
2152
+ role: "listbox"
2153
+ }, [(E(!0), f(o, null, k(y.value, (e, t) => (E(), f("button", {
2154
+ key: e.isoCode,
2155
+ type: "button",
2156
+ role: "option",
2157
+ "aria-selected": e.isoCode === _.value.isoCode,
2158
+ class: x(t === g.value ? N(a).phone.optionActive : N(a).phone.option),
2159
+ onPointerdown: H((t) => T(e), ["prevent"]),
2160
+ onMouseenter: (e) => g.value = t
2161
+ }, [
2162
+ p("span", { class: x(N(a).phone.flag) }, M(v(e.isoCode)), 3),
2163
+ p("span", { class: x(N(a).phone.optionName) }, M(e.name), 3),
2164
+ p("span", { class: x(N(a).phone.optionDial) }, M(e.dialCode), 3)
2165
+ ], 42, Re))), 128)), y.value.length ? d("", !0) : (E(), f("p", {
2166
+ key: 0,
2167
+ class: x(N(a).phone.empty)
2168
+ }, "No country matches \"" + M(h.value) + "\"", 3))], 2)], 2)) : d("", !0)
2169
+ ], 2));
2170
+ }
2171
+ }), Be = ["onClick"], Ve = ["placeholder", "disabled"], He = ["onPointerdown", "onMouseenter"], Ue = /*@__PURE__*/ Object.assign({ inheritAttrs: !1 }, {
2172
+ __name: "ShSuggest",
2173
+ props: {
2174
+ modelValue: [
2175
+ String,
2176
+ Number,
2177
+ Array
2178
+ ],
2179
+ placeholder: {
2180
+ type: String,
2181
+ default: "Type to search..."
2182
+ },
2183
+ isInvalid: Boolean,
2184
+ disabled: Boolean,
2185
+ options: Array,
2186
+ url: String,
2187
+ multiple: Boolean,
2188
+ allowCustom: Boolean,
2189
+ optionTemplate: [Object, Function]
2190
+ },
2191
+ emits: ["update:modelValue", "clearValidationErrors"],
2192
+ setup(e, { emit: t }) {
2193
+ let r = e, i = t, a = q("inputs"), s = O(null), c = O(""), m = O(!1), g = O(!1), _ = O(-1), v = O([]), b = O([]), S = l(() => {
2194
+ let e = Ae(r.options ?? v.value), t = new Set(b.value.map((e) => e.id)), n = e.filter((e) => !t.has(e.id));
2195
+ if (r.options && c.value) {
2196
+ let e = c.value.toLowerCase();
2197
+ n = n.filter((t) => t.label.toLowerCase().includes(e));
2198
+ }
2199
+ return n;
2200
+ }), T = null, D = () => {
2201
+ r.url && (clearTimeout(T), T = setTimeout(() => {
2202
+ g.value = !0, n.doGet(r.url, {
2203
+ all: 1,
2204
+ filter_value: c.value
2205
+ }).then((e) => {
2206
+ v.value = Array.isArray(e.data) ? e.data : e.data?.data ?? [];
2207
+ }).finally(() => {
2208
+ g.value = !1;
2209
+ });
2210
+ }, 300));
2211
+ }, ee = () => {
2212
+ r.multiple ? i("update:modelValue", b.value.map((e) => e.id)) : i("update:modelValue", b.value[0]?.id ?? null);
2213
+ }, A = (e) => {
2214
+ r.multiple ? b.value.push(e) : (b.value = [e], m.value = !1), c.value = "", _.value = -1, ee();
2215
+ }, P = (e) => {
2216
+ b.value = b.value.filter((t) => t.id !== e.id), ee();
2217
+ }, F = () => {
2218
+ !r.allowCustom || !c.value || A({
2219
+ id: c.value,
2220
+ label: c.value
2221
+ });
2222
+ }, I = () => {
2223
+ m.value = !0, i("clearValidationErrors"), r.url && D();
2224
+ }, R = (e) => {
2225
+ e.key === "ArrowDown" ? (e.preventDefault(), m.value = !0, _.value = Math.min(_.value + 1, S.value.length - 1)) : e.key === "ArrowUp" ? (e.preventDefault(), _.value = Math.max(_.value - 1, 0)) : e.key === "Enter" ? (e.preventDefault(), _.value >= 0 && S.value[_.value] ? A(S.value[_.value]) : F()) : e.key === "Escape" ? m.value = !1 : e.key === "Backspace" && !c.value && b.value.length && P(b.value[b.value.length - 1]);
2226
+ }, B = () => {
2227
+ let e = r.modelValue;
2228
+ if (e == null || e === "") return;
2229
+ let t = Array.isArray(e) ? e : [e], n = Ae(r.options ?? v.value);
2230
+ b.value = t.map((e) => n.find((t) => t.id === e) ?? {
2231
+ id: e,
2232
+ label: String(e)
2233
+ });
2234
+ }, U = (e) => {
2235
+ s.value && !s.value.contains(e.target) && (m.value = !1);
2236
+ };
2237
+ return z(() => r.options, B), w(() => {
2238
+ document.addEventListener("pointerdown", U), B(), r.url && !r.options && D();
2239
+ }), C(() => {
2240
+ document.removeEventListener("pointerdown", U), clearTimeout(T);
2241
+ }), (t, n) => (E(), f("div", {
2242
+ ref_key: "root",
2243
+ ref: s,
2244
+ class: x(N(a).suggest.wrapper)
2245
+ }, [
2246
+ e.multiple && b.value.length ? (E(), f("div", {
2247
+ key: 0,
2248
+ class: x(N(a).suggest.badges)
2249
+ }, [(E(!0), f(o, null, k(b.value, (e) => (E(), f("span", {
2250
+ key: e.id,
2251
+ class: x(N(a).suggest.badge)
2252
+ }, [h(M(e.label) + " ", 1), p("span", {
2253
+ class: x(N(a).suggest.badgeRemove),
2254
+ onClick: (t) => P(e)
2255
+ }, "×", 10, Be)], 2))), 128))], 2)) : d("", !0),
2256
+ V(p("input", y(t.$attrs, {
2257
+ "onUpdate:modelValue": n[0] ||= (e) => c.value = e,
2258
+ type: "text",
2259
+ placeholder: !e.multiple && b.value.length ? b.value[0].label : e.placeholder,
2260
+ disabled: e.disabled,
2261
+ autocomplete: "off",
2262
+ onInput: I,
2263
+ onKeydown: R,
2264
+ onFocus: n[1] ||= (e) => {
2265
+ m.value = !0, i("clearValidationErrors");
2266
+ }
2267
+ }), null, 16, Ve), [[L, c.value]]),
2268
+ m.value && !e.disabled ? (E(), f("div", {
2269
+ key: 1,
2270
+ class: x(N(a).suggest.dropdown)
2271
+ }, [g.value ? (E(), f("div", {
2272
+ key: 0,
2273
+ class: x(N(a).suggest.empty)
2274
+ }, "Searching...", 2)) : S.value.length ? (E(!0), f(o, { key: 1 }, k(S.value, (t, n) => (E(), f("div", {
2275
+ key: t.id,
2276
+ class: x(n === _.value ? N(a).suggest.optionActive : N(a).suggest.option),
2277
+ onPointerdown: H((e) => A(t), ["prevent"]),
2278
+ onMouseenter: (e) => _.value = n
2279
+ }, [e.optionTemplate ? (E(), u(j(e.optionTemplate), {
2280
+ key: 0,
2281
+ option: t.raw ?? t
2282
+ }, null, 8, ["option"])) : (E(), f(o, { key: 1 }, [h(M(t.label), 1)], 64))], 42, He))), 128)) : e.allowCustom && c.value ? (E(), f("div", {
2283
+ key: 2,
2284
+ class: x(N(a).suggest.option),
2285
+ onPointerdown: H(F, ["prevent"])
2286
+ }, " Use \"" + M(c.value) + "\" ", 35)) : (E(), f("div", {
2287
+ key: 3,
2288
+ class: x(N(a).suggest.empty)
2289
+ }, "No matches", 2))], 2)) : d("", !0)
2290
+ ], 2));
2291
+ }
2292
+ }), We = ["onUpdate:modelValue"], Ge = ["innerHTML"], Ke = ["disabled"], qe = {
2293
+ __name: "ShForm",
2294
+ props: {
2295
+ action: {
2296
+ type: String,
2297
+ required: !0
2298
+ },
2299
+ method: {
2300
+ type: String,
2301
+ default: "post"
2302
+ },
2303
+ fields: {
2304
+ type: Array,
2305
+ required: !0
2306
+ },
2307
+ currentData: Object,
2308
+ steps: Array,
2309
+ submitLabel: {
2310
+ type: String,
2311
+ default: "Submit"
2312
+ },
2313
+ successMessage: String,
2314
+ retainData: Boolean,
2315
+ preSubmit: Function,
2316
+ hiddenId: {
2317
+ type: Boolean,
2318
+ default: !0
2319
+ },
2320
+ classes: Object,
2321
+ disabled: Boolean
2322
+ },
2323
+ emits: [
2324
+ "success",
2325
+ "error",
2326
+ "fieldChanged",
2327
+ "preSubmit",
2328
+ "formSubmitted",
2329
+ "formError"
2330
+ ],
2331
+ setup(e, { emit: t }) {
2332
+ let i = e, a = t, s = q("form", l(() => i.classes)), c = q("inputs"), m = v(te, {}), g = v(ne, null), _ = {
2333
+ text: Z,
2334
+ textarea: xe,
2335
+ email: Se,
2336
+ password: Te,
2337
+ number: De,
2338
+ date: ke,
2339
+ select: Pe,
2340
+ phone: ze,
2341
+ suggest: Ue
2342
+ }, b = O([]), S = ee({}), C = O(!1), w = O(0), T = O(!1), D = () => {
2343
+ let e = de(i.fields, i.currentData);
2344
+ i.hiddenId && i.currentData?.id && !e.some((e) => e.name === "id") && e.push({
2345
+ name: "id",
2346
+ type: "hidden",
2347
+ value: i.currentData.id
2348
+ }), b.value = e;
2349
+ };
2350
+ D(), z(() => i.currentData, () => {
2351
+ T.value || D();
2352
+ }, { deep: !0 }), z(() => i.fields, D);
2353
+ let P = l(() => i.steps?.length ? i.steps.map((e) => ({
2354
+ title: e.title ?? "",
2355
+ fields: b.value.filter((t) => (e.fields ?? []).includes(t.name) || t.type === "hidden")
2356
+ })) : [{
2357
+ title: "",
2358
+ fields: b.value
2359
+ }]), F = l(() => w.value >= P.value.length - 1), I = (e) => e.component ?? m[e.type] ?? _[e.type] ?? _.text, B = (e) => S[e.name] ? s.value.inputInvalid : e.type === "select" ? c.value.select : s.value.input, U = (e) => ({
2360
+ placeholder: e.placeholder || void 0,
2361
+ disabled: i.disabled || e.disabled,
2362
+ ...e.type === "select" || e.type === "suggest" ? {
2363
+ options: Array.isArray(e.options) ? e.options : void 0,
2364
+ url: Array.isArray(e.options) ? void 0 : e.options?.url,
2365
+ multiple: e.multiple,
2366
+ allowCustom: e.allowCustom,
2367
+ optionTemplate: e.optionTemplate
2368
+ } : {},
2369
+ ...e.type === "number" ? {
2370
+ min: e.min,
2371
+ max: e.max,
2372
+ step: e.step
2373
+ } : {},
2374
+ ...e.type === "textarea" ? { rows: e.rows } : {},
2375
+ ...e.type === "date" ? {
2376
+ withTime: e.withTime,
2377
+ min: e.min,
2378
+ max: e.max
2379
+ } : {},
2380
+ ...e.type === "phone" ? {
2381
+ countryCode: e.countryCode,
2382
+ detectCountry: e.detectCountry
2383
+ } : {},
2384
+ ...e.props ?? {}
2385
+ }), W = (e, t) => {
2386
+ T.value = !0, delete S[e.name];
2387
+ let n = G();
2388
+ a("fieldChanged", e.name, t, n);
2389
+ }, G = () => {
2390
+ let e = {};
2391
+ return b.value.forEach((t) => {
2392
+ t.value !== null && t.value !== void 0 && (e[t.name] = t.value);
2393
+ }), e;
2394
+ }, K = () => {
2395
+ b.value.forEach((e) => {
2396
+ e.type !== "hidden" && (e.value = null);
2397
+ }), T.value = !1;
2398
+ }, re = () => {
2399
+ let e = Object.keys(S);
2400
+ if (!e.length || !i.steps?.length) return;
2401
+ let t = P.value.findIndex((t) => t.fields.some((t) => e.includes(t.name)));
2402
+ t >= 0 && (w.value = t);
2403
+ }, ie = async () => {
2404
+ if (!F.value) {
2405
+ w.value++;
2406
+ return;
2407
+ }
2408
+ Object.keys(S).forEach((e) => delete S[e]);
2409
+ let e = G();
2410
+ if (i.preSubmit) {
2411
+ let t = await i.preSubmit(e);
2412
+ if (t === !1) return;
2413
+ t && typeof t == "object" && (e = t);
2414
+ }
2415
+ a("preSubmit", e);
2416
+ let t = {
2417
+ post: n.doPost,
2418
+ put: n.doPut,
2419
+ patch: n.doPatch,
2420
+ delete: n.doDelete
2421
+ }[i.method.toLowerCase()] ?? n.doPost;
2422
+ C.value = !0;
2423
+ try {
2424
+ let n = await t(i.action, e);
2425
+ i.successMessage && r.showToast(i.successMessage), a("success", n.data), a("formSubmitted", n.data), i.retainData || (K(), w.value = 0), g?.requestClose?.("success");
2426
+ } catch (e) {
2427
+ if (e.response?.status === 422) {
2428
+ let t = e.response.data?.errors ?? {};
2429
+ Object.keys(t).forEach((e) => {
2430
+ let n = t[e];
2431
+ S[e] = Array.isArray(n) ? n[0] : n;
2432
+ }), re();
2433
+ } else r.showToast(e.response?.data?.message ?? e.message ?? "Request failed", "error");
2434
+ a("error", e), a("formError", e);
2435
+ } finally {
2436
+ C.value = !1;
2437
+ }
2438
+ };
2439
+ return (t, n) => (E(), f("form", {
2440
+ class: x(N(s).form),
2441
+ onSubmit: H(ie, ["prevent"])
2442
+ }, [
2443
+ P.value.length > 1 ? (E(), u(pe, {
2444
+ key: 0,
2445
+ steps: P.value,
2446
+ current: w.value
2447
+ }, null, 8, ["steps", "current"])) : d("", !0),
2448
+ (E(!0), f(o, null, k(P.value, (e, t) => V((E(), f("div", {
2449
+ key: t,
2450
+ class: "space-y-4"
2451
+ }, [(E(!0), f(o, null, k(e.fields, (e) => (E(), f("div", {
2452
+ key: e.name,
2453
+ class: x(e.type === "hidden" ? "" : N(s).group)
2454
+ }, [e.type === "hidden" ? V((E(), f("input", {
2455
+ key: 0,
2456
+ "onUpdate:modelValue": (t) => e.value = t,
2457
+ type: "hidden"
2458
+ }, null, 8, We)), [[L, e.value]]) : (E(), f(o, { key: 1 }, [
2459
+ e.label ? (E(), f("label", {
2460
+ key: 0,
2461
+ class: x(N(s).label)
2462
+ }, [h(M(e.label) + " ", 1), e.required ? (E(), f("span", {
2463
+ key: 0,
2464
+ class: x(N(s).required)
2465
+ }, "*", 2)) : d("", !0)], 2)) : d("", !0),
2466
+ (E(), u(j(I(e)), y({
2467
+ modelValue: e.value,
2468
+ "onUpdate:modelValue": (t) => e.value = t
2469
+ }, { ref_for: !0 }, U(e), {
2470
+ "is-invalid": !!S[e.name],
2471
+ class: [B(e), e.class],
2472
+ "onUpdate:modelValue": (t) => W(e, t),
2473
+ onClearValidationErrors: (t) => delete S[e.name]
2474
+ }), null, 16, [
2475
+ "modelValue",
2476
+ "onUpdate:modelValue",
2477
+ "is-invalid",
2478
+ "class",
2479
+ "onClearValidationErrors"
2480
+ ])),
2481
+ e.helper ? (E(), f("p", {
2482
+ key: 1,
2483
+ class: x(N(s).helper),
2484
+ innerHTML: e.helper
2485
+ }, null, 10, Ge)) : d("", !0),
2486
+ S[e.name] ? (E(), f("p", {
2487
+ key: 2,
2488
+ class: x(N(s).error)
2489
+ }, M(S[e.name]), 3)) : d("", !0)
2490
+ ], 64))], 2))), 128))], 512)), [[R, w.value === t]])), 128)),
2491
+ A(t.$slots, "default"),
2492
+ p("div", { class: x(N(s).nav) }, [w.value > 0 ? (E(), f("button", {
2493
+ key: 0,
2494
+ type: "button",
2495
+ class: x(N(s).prevBtn),
2496
+ onClick: n[0] ||= (e) => w.value--
2497
+ }, " Back ", 2)) : d("", !0), p("button", {
2498
+ type: "submit",
2499
+ class: x(F.value ? N(s).submitBtn : N(s).nextBtn),
2500
+ disabled: C.value || e.disabled
2501
+ }, [C.value ? (E(), u(ve, {
2502
+ key: 0,
2503
+ class: "size-4"
2504
+ })) : d("", !0), h(" " + M(F.value ? e.submitLabel : "Next"), 1)], 10, Ke)], 2)
2505
+ ], 34));
2506
+ }
2507
+ }, Je = {
2508
+ __name: "ShDialog",
2509
+ props: {
2510
+ open: Boolean,
2511
+ title: String,
2512
+ size: {
2513
+ type: String,
2514
+ default: "md"
2515
+ },
2516
+ static: Boolean,
2517
+ hideClose: Boolean,
2518
+ retainOnSuccess: Boolean,
2519
+ classes: Object
2520
+ },
2521
+ emits: [
2522
+ "update:open",
2523
+ "opened",
2524
+ "closed"
2525
+ ],
2526
+ setup(e, { expose: t, emit: n }) {
2527
+ let r = e, i = n, a = q("dialog", l(() => r.classes)), o = O(null), m = O(!1), h = O(!1), _ = O(!1), v = ce({
2528
+ isStatic: () => r.static,
2529
+ onClose: () => i("update:open", !1)
2530
+ }), y = () => {
2531
+ m.value = !0, v.show(), requestAnimationFrame(() => {
2532
+ h.value = !0;
2533
+ }), r.open || i("update:open", !0);
2534
+ }, b = (e) => {
2535
+ h.value = !1, v.close(e);
2536
+ }, C = () => {
2537
+ if (r.static) {
2538
+ _.value = !0, setTimeout(() => {
2539
+ _.value = !1;
2540
+ }, 150);
2541
+ return;
2542
+ }
2543
+ b("backdrop");
2544
+ };
2545
+ return z(() => r.open, (e) => {
2546
+ e ? y() : h.value && b("prop");
2547
+ }, { immediate: !0 }), z(v.isOpen, (e) => {
2548
+ !e && h.value && (h.value = !1);
2549
+ }), D(ne, {
2550
+ close: () => b("context"),
2551
+ requestClose: (e) => {
2552
+ if (e === "success") {
2553
+ if (r.retainOnSuccess) return;
2554
+ setTimeout(() => b("success"), 600);
2555
+ return;
2556
+ }
2557
+ b(e);
2558
+ }
2559
+ }), t({
2560
+ show: y,
2561
+ close: b
2562
+ }), (t, n) => (E(), u(s, { to: "body" }, [m.value ? (E(), f("div", {
2563
+ key: 0,
2564
+ class: "fixed inset-0",
2565
+ style: S({ zIndex: N(v).zIndex.value })
2566
+ }, [g(c, {
2567
+ "enter-active-class": "transition-opacity duration-200 ease-out",
2568
+ "enter-from-class": "opacity-0",
2569
+ "enter-to-class": "opacity-100",
2570
+ "leave-active-class": "transition-opacity duration-150 ease-in",
2571
+ "leave-from-class": "opacity-100",
2572
+ "leave-to-class": "opacity-0"
2573
+ }, {
2574
+ default: B(() => [V(p("div", {
2575
+ class: x(N(a).backdrop),
2576
+ onClick: C
2577
+ }, null, 2), [[R, h.value]])]),
2578
+ _: 1
2579
+ }), g(c, {
2580
+ "enter-active-class": "transition duration-200 ease-out",
2581
+ "enter-from-class": "opacity-0 scale-95 translate-y-2",
2582
+ "enter-to-class": "opacity-100 scale-100 translate-y-0",
2583
+ "leave-active-class": "transition duration-150 ease-in",
2584
+ "leave-from-class": "opacity-100 scale-100",
2585
+ "leave-to-class": "opacity-0 scale-95",
2586
+ onAfterEnter: n[1] ||= (e) => {
2587
+ o.value?.focus(), i("opened");
2588
+ },
2589
+ onAfterLeave: n[2] ||= (e) => {
2590
+ m.value = !1, i("closed");
2591
+ }
2592
+ }, {
2593
+ default: B(() => [V(p("div", {
2594
+ class: x(N(a).wrapper),
2595
+ onClick: H(C, ["self"])
2596
+ }, [p("div", {
2597
+ ref_key: "panel",
2598
+ ref: o,
2599
+ tabindex: "-1",
2600
+ role: "dialog",
2601
+ "aria-modal": "true",
2602
+ class: x([
2603
+ N(a).panel,
2604
+ N(a).sizes[e.size] ?? N(a).sizes.md,
2605
+ _.value ? "scale-[1.02] transition-transform duration-150" : ""
2606
+ ])
2607
+ }, [
2608
+ e.title || t.$slots.title || !e.hideClose ? (E(), f("header", {
2609
+ key: 0,
2610
+ class: x(N(a).header)
2611
+ }, [A(t.$slots, "title", {}, () => [p("h3", { class: x(N(a).title) }, M(e.title), 3)]), e.hideClose ? d("", !0) : (E(), f("button", {
2612
+ key: 0,
2613
+ type: "button",
2614
+ class: x(N(a).closeBtn),
2615
+ "aria-label": "Close",
2616
+ onClick: n[0] ||= (e) => b("button")
2617
+ }, [...n[3] ||= [p("svg", {
2618
+ xmlns: "http://www.w3.org/2000/svg",
2619
+ class: "size-5",
2620
+ fill: "none",
2621
+ viewBox: "0 0 24 24",
2622
+ stroke: "currentColor",
2623
+ "stroke-width": "1.5"
2624
+ }, [p("path", {
2625
+ "stroke-linecap": "round",
2626
+ "stroke-linejoin": "round",
2627
+ d: "M6 18L18 6M6 6l12 12"
2628
+ })], -1)]], 2))], 2)) : d("", !0),
2629
+ p("div", { class: x(N(a).body) }, [A(t.$slots, "default", { close: b })], 2),
2630
+ t.$slots.footer ? (E(), f("footer", {
2631
+ key: 1,
2632
+ class: x(N(a).footer)
2633
+ }, [A(t.$slots, "footer", { close: b })], 2)) : d("", !0)
2634
+ ], 2)], 2), [[R, h.value]])]),
2635
+ _: 3
2636
+ })], 4)) : d("", !0)]));
2637
+ }
2638
+ }, Ye = {
2639
+ __name: "ShDrawer",
2640
+ props: {
2641
+ open: Boolean,
2642
+ title: String,
2643
+ position: {
2644
+ type: String,
2645
+ default: "end"
2646
+ },
2647
+ size: {
2648
+ type: String,
2649
+ default: "md"
2650
+ },
2651
+ static: Boolean,
2652
+ hideClose: Boolean,
2653
+ classes: Object
2654
+ },
2655
+ emits: [
2656
+ "update:open",
2657
+ "opened",
2658
+ "closed"
2659
+ ],
2660
+ setup(e, { expose: t, emit: n }) {
2661
+ let r = e, i = n, a = q("drawer", l(() => r.classes)), o = O(null), m = O(!1), h = O(!1), _ = {
2662
+ start: {
2663
+ panel: "inset-y-0 left-0 h-full w-full",
2664
+ hidden: "-translate-x-full"
2665
+ },
2666
+ end: {
2667
+ panel: "inset-y-0 right-0 h-full w-full",
2668
+ hidden: "translate-x-full"
2669
+ },
2670
+ top: {
2671
+ panel: "inset-x-0 top-0 w-full",
2672
+ hidden: "-translate-y-full"
2673
+ },
2674
+ bottom: {
2675
+ panel: "inset-x-0 bottom-0 w-full",
2676
+ hidden: "translate-y-full"
2677
+ }
2678
+ }, v = l(() => _[r.position] ?? _.end), y = l(() => ["top", "bottom"].includes(r.position)), b = l(() => y.value ? a.value.sizesVertical[r.size] ?? a.value.sizesVertical.md : a.value.sizes[r.size] ?? a.value.sizes.md), C = ce({
2679
+ isStatic: () => r.static,
2680
+ onClose: () => i("update:open", !1)
2681
+ }), w = () => {
2682
+ m.value = !0, C.show(), requestAnimationFrame(() => {
2683
+ h.value = !0;
2684
+ }), r.open || i("update:open", !0);
2685
+ }, T = (e) => {
2686
+ h.value = !1, C.close(e);
2687
+ };
2688
+ return z(() => r.open, (e) => {
2689
+ e ? w() : h.value && T("prop");
2690
+ }, { immediate: !0 }), z(C.isOpen, (e) => {
2691
+ !e && h.value && (h.value = !1);
2692
+ }), D(ne, {
2693
+ close: () => T("context"),
2694
+ requestClose: (e) => T(e)
2695
+ }), t({
2696
+ show: w,
2697
+ close: T
2698
+ }), (t, n) => (E(), u(s, { to: "body" }, [m.value ? (E(), f("div", {
2699
+ key: 0,
2700
+ class: "fixed inset-0",
2701
+ style: S({ zIndex: N(C).zIndex.value })
2702
+ }, [g(c, {
2703
+ "enter-active-class": "transition-opacity duration-200 ease-out",
2704
+ "enter-from-class": "opacity-0",
2705
+ "enter-to-class": "opacity-100",
2706
+ "leave-active-class": "transition-opacity duration-150 ease-in",
2707
+ "leave-from-class": "opacity-100",
2708
+ "leave-to-class": "opacity-0"
2709
+ }, {
2710
+ default: B(() => [V(p("div", {
2711
+ class: x(N(a).backdrop),
2712
+ onClick: n[0] ||= (...e) => N(C).onBackdrop && N(C).onBackdrop(...e)
2713
+ }, null, 2), [[R, h.value]])]),
2714
+ _: 1
2715
+ }), g(c, {
2716
+ "enter-active-class": "transition-transform duration-250 ease-out",
2717
+ "enter-from-class": v.value.hidden,
2718
+ "enter-to-class": "translate-x-0 translate-y-0",
2719
+ "leave-active-class": "transition-transform duration-200 ease-in",
2720
+ "leave-from-class": "translate-x-0 translate-y-0",
2721
+ "leave-to-class": v.value.hidden,
2722
+ onAfterEnter: n[2] ||= (e) => {
2723
+ o.value?.focus(), i("opened");
2724
+ },
2725
+ onAfterLeave: n[3] ||= (e) => {
2726
+ m.value = !1, i("closed");
2727
+ }
2728
+ }, {
2729
+ default: B(() => [V(p("div", {
2730
+ ref_key: "panel",
2731
+ ref: o,
2732
+ tabindex: "-1",
2733
+ role: "dialog",
2734
+ "aria-modal": "true",
2735
+ class: x([
2736
+ N(a).panel,
2737
+ v.value.panel,
2738
+ b.value
2739
+ ])
2740
+ }, [e.title || t.$slots.title || !e.hideClose ? (E(), f("header", {
2741
+ key: 0,
2742
+ class: x(N(a).header)
2743
+ }, [A(t.$slots, "title", {}, () => [p("h3", { class: x(N(a).title) }, M(e.title), 3)]), e.hideClose ? d("", !0) : (E(), f("button", {
2744
+ key: 0,
2745
+ type: "button",
2746
+ class: x(N(a).closeBtn),
2747
+ "aria-label": "Close",
2748
+ onClick: n[1] ||= (e) => T("button")
2749
+ }, [...n[4] ||= [p("svg", {
2750
+ xmlns: "http://www.w3.org/2000/svg",
2751
+ class: "size-5",
2752
+ fill: "none",
2753
+ viewBox: "0 0 24 24",
2754
+ stroke: "currentColor",
2755
+ "stroke-width": "1.5"
2756
+ }, [p("path", {
2757
+ "stroke-linecap": "round",
2758
+ "stroke-linejoin": "round",
2759
+ d: "M6 18L18 6M6 6l12 12"
2760
+ })], -1)]], 2))], 2)) : d("", !0), p("div", { class: x(N(a).body) }, [A(t.$slots, "default", { close: T })], 2)], 2), [[R, h.value]])]),
2761
+ _: 3
2762
+ }, 8, ["enter-from-class", "leave-to-class"])], 4)) : d("", !0)]));
2763
+ }
2764
+ }, Xe = {
2765
+ __name: "ShDialogBtn",
2766
+ props: {
2767
+ title: String,
2768
+ size: {
2769
+ type: String,
2770
+ default: "md"
2771
+ },
2772
+ static: Boolean,
2773
+ hideClose: Boolean,
2774
+ btnClass: String,
2775
+ classes: Object
2776
+ },
2777
+ emits: ["opened", "closed"],
2778
+ setup(e) {
2779
+ let t = q("buttons"), n = O(!1);
2780
+ return (r, i) => (E(), f(o, null, [p("button", {
2781
+ type: "button",
2782
+ class: x(e.btnClass ?? N(t).secondary),
2783
+ onClick: i[0] ||= (e) => n.value = !0
2784
+ }, [A(r.$slots, "trigger", {}, () => [i[4] ||= h("Open", -1)])], 2), g(Je, {
2785
+ open: n.value,
2786
+ "onUpdate:open": i[1] ||= (e) => n.value = e,
2787
+ title: e.title,
2788
+ size: e.size,
2789
+ static: e.static,
2790
+ "hide-close": e.hideClose,
2791
+ classes: e.classes,
2792
+ onOpened: i[2] ||= (e) => r.$emit("opened"),
2793
+ onClosed: i[3] ||= (e) => r.$emit("closed")
2794
+ }, m({
2795
+ default: B(({ close: e }) => [A(r.$slots, "default", { close: e })]),
2796
+ _: 2
2797
+ }, [r.$slots.footer ? {
2798
+ name: "footer",
2799
+ fn: B(({ close: e }) => [A(r.$slots, "footer", { close: e })]),
2800
+ key: "0"
2801
+ } : void 0]), 1032, [
2802
+ "open",
2803
+ "title",
2804
+ "size",
2805
+ "static",
2806
+ "hide-close",
2807
+ "classes"
2808
+ ])], 64));
2809
+ }
2810
+ }, Ze = {
2811
+ __name: "ShDrawerBtn",
2812
+ props: {
2813
+ title: String,
2814
+ position: {
2815
+ type: String,
2816
+ default: "end"
2817
+ },
2818
+ size: {
2819
+ type: String,
2820
+ default: "md"
2821
+ },
2822
+ static: Boolean,
2823
+ hideClose: Boolean,
2824
+ btnClass: String,
2825
+ classes: Object
2826
+ },
2827
+ emits: ["opened", "closed"],
2828
+ setup(e) {
2829
+ let t = q("buttons"), n = O(!1);
2830
+ return (r, i) => (E(), f(o, null, [p("button", {
2831
+ type: "button",
2832
+ class: x(e.btnClass ?? N(t).secondary),
2833
+ onClick: i[0] ||= (e) => n.value = !0
2834
+ }, [A(r.$slots, "trigger", {}, () => [i[4] ||= h("Open", -1)])], 2), g(Ye, {
2835
+ open: n.value,
2836
+ "onUpdate:open": i[1] ||= (e) => n.value = e,
2837
+ title: e.title,
2838
+ position: e.position,
2839
+ size: e.size,
2840
+ static: e.static,
2841
+ "hide-close": e.hideClose,
2842
+ classes: e.classes,
2843
+ onOpened: i[2] ||= (e) => r.$emit("opened"),
2844
+ onClosed: i[3] ||= (e) => r.$emit("closed")
2845
+ }, {
2846
+ default: B(({ close: e }) => [A(r.$slots, "default", { close: e })]),
2847
+ _: 3
2848
+ }, 8, [
2849
+ "open",
2850
+ "title",
2851
+ "position",
2852
+ "size",
2853
+ "static",
2854
+ "hide-close",
2855
+ "classes"
2856
+ ])], 64));
2857
+ }
2858
+ }, Qe = {
2859
+ __name: "ShDialogForm",
2860
+ props: {
2861
+ title: String,
2862
+ size: {
2863
+ type: String,
2864
+ default: "md"
2865
+ },
2866
+ static: Boolean,
2867
+ retainDialog: Boolean,
2868
+ btnClass: String,
2869
+ dialogClasses: Object,
2870
+ action: {
2871
+ type: String,
2872
+ required: !0
2873
+ },
2874
+ method: {
2875
+ type: String,
2876
+ default: "post"
2877
+ },
2878
+ fields: {
2879
+ type: Array,
2880
+ required: !0
2881
+ },
2882
+ currentData: Object,
2883
+ steps: Array,
2884
+ submitLabel: {
2885
+ type: String,
2886
+ default: "Submit"
2887
+ },
2888
+ successMessage: String,
2889
+ retainData: Boolean,
2890
+ preSubmit: Function,
2891
+ hiddenId: {
2892
+ type: Boolean,
2893
+ default: !0
2894
+ },
2895
+ classes: Object
2896
+ },
2897
+ emits: [
2898
+ "success",
2899
+ "error",
2900
+ "fieldChanged",
2901
+ "opened",
2902
+ "closed"
2903
+ ],
2904
+ setup(e, { expose: t, emit: n }) {
2905
+ let r = e, i = n, a = q("buttons"), s = O(!1), c = l(() => JSON.stringify(r.currentData ?? {})), d = (e) => {
2906
+ i("success", e);
2907
+ };
2908
+ return t({
2909
+ show: () => {
2910
+ s.value = !0;
2911
+ },
2912
+ close: () => {
2913
+ s.value = !1;
2914
+ }
2915
+ }), (t, n) => (E(), f(o, null, [p("button", {
2916
+ type: "button",
2917
+ class: x(e.btnClass ?? N(a).primary),
2918
+ onClick: n[0] ||= (e) => s.value = !0
2919
+ }, [A(t.$slots, "trigger", {}, () => [h(M(e.title ?? "Open form"), 1)])], 2), g(Je, {
2920
+ open: s.value,
2921
+ "onUpdate:open": n[3] ||= (e) => s.value = e,
2922
+ title: e.title,
2923
+ size: e.size,
2924
+ static: e.static,
2925
+ "retain-on-success": e.retainDialog,
2926
+ classes: e.dialogClasses,
2927
+ onOpened: n[4] ||= (e) => t.$emit("opened"),
2928
+ onClosed: n[5] ||= (e) => t.$emit("closed")
2929
+ }, {
2930
+ default: B(() => [(E(), u(qe, {
2931
+ key: c.value,
2932
+ action: e.action,
2933
+ method: e.method,
2934
+ fields: e.fields,
2935
+ "current-data": e.currentData,
2936
+ steps: e.steps,
2937
+ "submit-label": e.submitLabel,
2938
+ "success-message": e.successMessage,
2939
+ "retain-data": e.retainData,
2940
+ "pre-submit": e.preSubmit,
2941
+ "hidden-id": e.hiddenId,
2942
+ classes: e.classes,
2943
+ onSuccess: d,
2944
+ onError: n[1] ||= (e) => t.$emit("error", e),
2945
+ onFieldChanged: n[2] ||= (e, n, r) => t.$emit("fieldChanged", e, n, r)
2946
+ }, {
2947
+ default: B(() => [A(t.$slots, "default")]),
2948
+ _: 3
2949
+ }, 8, [
2950
+ "action",
2951
+ "method",
2952
+ "fields",
2953
+ "current-data",
2954
+ "steps",
2955
+ "submit-label",
2956
+ "success-message",
2957
+ "retain-data",
2958
+ "pre-submit",
2959
+ "hidden-id",
2960
+ "classes"
2961
+ ]))]),
2962
+ _: 3
2963
+ }, 8, [
2964
+ "open",
2965
+ "title",
2966
+ "size",
2967
+ "static",
2968
+ "retain-on-success",
2969
+ "classes"
2970
+ ])], 64));
2971
+ }
2972
+ }, $e = "sh_tw_table_cache", et = "pages", tt = "rows", nt = 1, rt = 3e3, it = null;
2973
+ function at() {
2974
+ return it || (it = new Promise((e, t) => {
2975
+ let n = indexedDB.open($e, nt);
2976
+ n.onupgradeneeded = (e) => {
2977
+ let t = e.target.result;
2978
+ t.objectStoreNames.contains(et) || t.createObjectStore(et), t.objectStoreNames.contains(tt) || t.createObjectStore(tt);
2979
+ }, n.onsuccess = (t) => e(t.target.result), n.onerror = (e) => t(e.target.error);
2980
+ }), it);
2981
+ }
2982
+ function ot() {
2983
+ try {
2984
+ let e = i.getItem("user");
2985
+ return e?.id ? `u${e.id}_` : "";
2986
+ } catch {
2987
+ return "";
2988
+ }
2989
+ }
2990
+ function st(e, t, n) {
2991
+ return at().then((r) => new Promise((i, a) => {
2992
+ let o = n(r.transaction(e, t).objectStore(e));
2993
+ o.onsuccess = () => i(o.result), o.onerror = () => a(o.error);
2994
+ })).catch((e) => {
2995
+ console.error("[sh-tailwind] table cache error", e);
2996
+ });
2997
+ }
2998
+ async function ct(e) {
2999
+ return (await st(et, "readonly", (t) => t.get(ot() + e)))?.response ?? null;
3000
+ }
3001
+ function lt(e, t) {
3002
+ return st(et, "readwrite", (n) => n.put({
3003
+ response: t,
3004
+ timestamp: Date.now()
3005
+ }, ot() + e));
3006
+ }
3007
+ async function ut(e) {
3008
+ return (await st(tt, "readonly", (t) => t.get(ot() + e)))?.rows ?? [];
3009
+ }
3010
+ async function dt(e, t) {
3011
+ if (!Array.isArray(t) || !t.length) return;
3012
+ let n = await ut(e), r = /* @__PURE__ */ new Map();
3013
+ n.forEach((e) => {
3014
+ e && e.id !== void 0 && r.set(e.id, e);
3015
+ }), t.forEach((e) => {
3016
+ e && e.id !== void 0 && r.set(e.id, e);
3017
+ });
3018
+ let i = [...r.values()];
3019
+ return i.length > rt && (i = i.slice(i.length - rt)), st(tt, "readwrite", (t) => t.put({
3020
+ rows: i,
3021
+ timestamp: Date.now()
3022
+ }, ot() + e));
3023
+ }
3024
+ async function ft() {
3025
+ await st(et, "readwrite", (e) => e.clear()), await st(tt, "readwrite", (e) => e.clear());
3026
+ }
3027
+ var pt = {
3028
+ getPage: ct,
3029
+ setPage: lt,
3030
+ getRows: ut,
3031
+ mergeRows: dt,
3032
+ clear: ft
3033
+ };
3034
+ //#endregion
3035
+ //#region src/table/localQuery.js
3036
+ function mt(e, t) {
3037
+ return !e || !t || typeof t != "string" ? "" : t.split(".").reduce((e, t) => e ? e[t] : "", e);
3038
+ }
3039
+ function ht(e, t, n, r = 0) {
3040
+ if (e == null) return !1;
3041
+ if (typeof e == "object") return r > 2 ? !1 : Object.values(e).some((e) => ht(e, t, n, r + 1));
3042
+ let i = String(e).toLowerCase();
3043
+ return n ? i === t : i.includes(t);
3044
+ }
3045
+ function gt(e, { search: t, exact: n, orderBy: r, orderMethod: i, page: a, perPage: o } = {}) {
3046
+ let s = e;
3047
+ if (t) {
3048
+ let r = String(t).toLowerCase();
3049
+ s = e.filter((e) => ht(e, r, !!n));
3050
+ }
3051
+ if (r) {
3052
+ let e = i === "asc" ? 1 : -1;
3053
+ s = [...s].sort((t, n) => {
3054
+ let i = mt(t, r), a = mt(n, r);
3055
+ return typeof i == "number" && typeof a == "number" ? (i - a) * e : String(i ?? "").localeCompare(String(a ?? ""), void 0, { numeric: !0 }) * e;
3056
+ });
3057
+ }
3058
+ let c = s.length, l = Math.max(1, Number(o) || 10), u = Math.max(1, Math.ceil(c / l)), d = Math.min(Math.max(1, Number(a) || 1), u), f = (d - 1) * l;
3059
+ return {
3060
+ data: s.slice(f, f + l),
3061
+ total: c,
3062
+ per_page: l,
3063
+ current_page: d,
3064
+ last_page: u,
3065
+ from: c === 0 ? 0 : f + 1
3066
+ };
3067
+ }
3068
+ //#endregion
3069
+ //#region src/table/useTableData.js
3070
+ function _t({ query: e, cacheEnabled: t = () => !1, networkTimeout: r = () => 1e4 }) {
3071
+ let i = O([]), a = O(null), o = O("loading"), s = O(""), c = O(!1), l = O(!1), u = 0, d = (e, t) => e + "|" + JSON.stringify(t), f = (e, { append: t = !1 } = {}) => {
3072
+ t ? i.value.push(...e.data ?? []) : i.value = e.data ?? [], a.value = {
3073
+ total: e.total ?? i.value.length,
3074
+ per_page: e.per_page,
3075
+ current_page: e.current_page ?? 1,
3076
+ last_page: e.last_page ?? 1,
3077
+ from: e.from ?? 1
3078
+ }, o.value = "done";
3079
+ };
3080
+ return {
3081
+ records: i,
3082
+ meta: a,
3083
+ status: o,
3084
+ error: s,
3085
+ offline: c,
3086
+ fromCache: l,
3087
+ load: async ({ append: a = !1 } = {}) => {
3088
+ let p = ++u, { endpoint: m, params: h } = e(), g = d(m, h), _ = !!t(), v = !1;
3089
+ if (i.value.length || (o.value = "loading"), _ && !a) {
3090
+ let e = await pt.getPage(g);
3091
+ e && p === u && (f(e), l.value = !0, v = !0);
3092
+ }
3093
+ try {
3094
+ let e = await n.doGet(m, h, { timeout: r() });
3095
+ if (p !== u) return;
3096
+ let t = e.data?.data ?? e.data;
3097
+ return f(t, { append: a }), c.value = !1, l.value = !1, s.value = "", _ && (pt.setPage(g, t), pt.mergeRows(m, t.data)), t;
3098
+ } catch (e) {
3099
+ if (p !== u) return;
3100
+ if (e.response) {
3101
+ v || (o.value = "error", s.value = `${e.response.status}: ${e.response.statusText} (${m})`);
3102
+ return;
3103
+ }
3104
+ if (c.value = !0, v) return;
3105
+ if (_) {
3106
+ let e = await pt.getRows(m);
3107
+ if (p !== u) return;
3108
+ if (e.length) {
3109
+ f(gt(e, {
3110
+ search: h.filter_value,
3111
+ exact: h.exact,
3112
+ orderBy: h.order_by,
3113
+ orderMethod: h.order_method,
3114
+ page: h.page,
3115
+ perPage: h.per_page
3116
+ }), { append: !1 }), l.value = !0;
3117
+ return;
3118
+ }
3119
+ }
3120
+ o.value = "error", s.value = "You appear to be offline and there is no cached data yet";
3121
+ }
3122
+ }
3123
+ };
3124
+ }
3125
+ //#endregion
3126
+ //#region src/components/table/ShTablePagination.vue
3127
+ var vt = ["value"], yt = ["value"], bt = ["disabled"], xt = ["disabled"], St = ["onClick"], Ct = ["disabled"], wt = {
3128
+ __name: "ShTablePagination",
3129
+ props: {
3130
+ meta: {
3131
+ type: Object,
3132
+ required: !0
3133
+ },
3134
+ perPage: Number,
3135
+ mode: {
3136
+ type: String,
3137
+ default: "pages"
3138
+ },
3139
+ loading: Boolean,
3140
+ theme: {
3141
+ type: Object,
3142
+ required: !0
3143
+ }
3144
+ },
3145
+ emits: [
3146
+ "page",
3147
+ "perPage",
3148
+ "loadMore"
3149
+ ],
3150
+ setup(e, { emit: t }) {
3151
+ let n = e, r = t, i = l(() => Math.min(n.meta.current_page * n.meta.per_page, n.meta.total)), a = l(() => {
3152
+ let e = n.meta.last_page, t = n.meta.current_page;
3153
+ if (e <= 7) return Array.from({ length: e }, (e, t) => t + 1);
3154
+ let r = [1];
3155
+ t > 3 && r.push("...");
3156
+ for (let n = Math.max(2, t - 1); n <= Math.min(e - 1, t + 1); n++) r.push(n);
3157
+ return t < e - 2 && r.push("..."), r.push(e), r;
3158
+ });
3159
+ return (t, n) => (E(), f("div", { class: x(e.theme.wrapper) }, [p("div", { class: x(e.theme.info) }, [h(" Showing " + M(i.value) + " of " + M(e.meta.total) + " ", 1), p("select", {
3160
+ value: e.perPage,
3161
+ class: x([e.theme.perPage, "ml-2"]),
3162
+ onChange: n[0] ||= (e) => r("perPage", Number(e.target.value))
3163
+ }, [(E(), f(o, null, k([
3164
+ 10,
3165
+ 20,
3166
+ 30,
3167
+ 50,
3168
+ 100
3169
+ ], (e) => p("option", {
3170
+ key: e,
3171
+ value: e
3172
+ }, M(e) + " / page", 9, yt)), 64))], 42, vt)], 2), e.mode === "loadMore" ? (E(), f("button", {
3173
+ key: 0,
3174
+ type: "button",
3175
+ class: x(e.theme.loadMore),
3176
+ disabled: e.loading || e.meta.current_page >= e.meta.last_page,
3177
+ onClick: n[1] ||= (e) => r("loadMore")
3178
+ }, M(e.meta.current_page >= e.meta.last_page ? "All loaded" : "Load more"), 11, bt)) : (E(), f("div", {
3179
+ key: 1,
3180
+ class: x(e.theme.pages)
3181
+ }, [
3182
+ p("button", {
3183
+ type: "button",
3184
+ class: x(e.theme.pageBtn),
3185
+ disabled: e.meta.current_page <= 1,
3186
+ "aria-label": "Previous page",
3187
+ onClick: n[2] ||= (t) => r("page", e.meta.current_page - 1)
3188
+ }, " ‹ ", 10, xt),
3189
+ (E(!0), f(o, null, k(a.value, (t, n) => (E(), f(o, { key: n }, [t === "..." ? (E(), f("span", {
3190
+ key: 0,
3191
+ class: x(e.theme.ellipsis)
3192
+ }, "…", 2)) : (E(), f("button", {
3193
+ key: 1,
3194
+ type: "button",
3195
+ class: x(t === e.meta.current_page ? e.theme.pageBtnActive : e.theme.pageBtn),
3196
+ onClick: (e) => r("page", t)
3197
+ }, M(t), 11, St))], 64))), 128)),
3198
+ p("button", {
3199
+ type: "button",
3200
+ class: x(e.theme.pageBtn),
3201
+ disabled: e.meta.current_page >= e.meta.last_page,
3202
+ "aria-label": "Next page",
3203
+ onClick: n[3] ||= (t) => r("page", e.meta.current_page + 1)
3204
+ }, " › ", 10, Ct)
3205
+ ], 2))], 2));
3206
+ }
3207
+ }, Tt = {
3208
+ key: 0,
3209
+ class: "flex w-full items-center gap-3 md:w-auto"
3210
+ }, Et = ["placeholder"], Dt = ["checked"], Ot = ["onClick"], kt = { key: 0 }, At = { key: 0 }, jt = ["colspan"], Mt = ["onClick"], Nt = ["checked", "onChange"], Pt = ["innerHTML"], Ft = ["onClick"], It = ["onClick"], Lt = ["checked", "onChange"], Rt = ["innerHTML"], zt = ["onClick"], Bt = { class: "text-sm text-gray-700 dark:text-gray-200" }, Vt = { class: "flex items-center gap-2" }, Ht = ["onClick"], Ut = {
3211
+ __name: "ShTable",
3212
+ props: {
3213
+ endpoint: {
3214
+ type: String,
3215
+ required: !0
3216
+ },
3217
+ columns: {
3218
+ type: Array,
3219
+ required: !0
3220
+ },
3221
+ actions: {
3222
+ type: Array,
3223
+ default: () => []
3224
+ },
3225
+ multiActions: {
3226
+ type: Array,
3227
+ default: () => []
3228
+ },
3229
+ searchable: {
3230
+ type: Boolean,
3231
+ default: !0
3232
+ },
3233
+ searchPlaceholder: {
3234
+ type: String,
3235
+ default: "Search"
3236
+ },
3237
+ hasRange: Boolean,
3238
+ perPage: Number,
3239
+ sortBy: String,
3240
+ sortMethod: {
3241
+ type: String,
3242
+ default: "desc"
3243
+ },
3244
+ paginationStyle: String,
3245
+ rowLink: String,
3246
+ cache: {
3247
+ type: Boolean,
3248
+ default: null
3249
+ },
3250
+ networkTimeout: {
3251
+ type: Number,
3252
+ default: 1e4
3253
+ },
3254
+ reload: [
3255
+ Number,
3256
+ String,
3257
+ Boolean
3258
+ ],
3259
+ emptyMessage: {
3260
+ type: String,
3261
+ default: "No records found"
3262
+ },
3263
+ classes: Object
3264
+ },
3265
+ emits: [
3266
+ "rowClick",
3267
+ "loaded",
3268
+ "action"
3269
+ ],
3270
+ setup(e, { expose: s, emit: c }) {
3271
+ let m = e, v = c, y = q("table", l(() => m.classes)), b = a(), S = _()?.appContext.config.globalProperties.$router ?? null, w = (e) => {
3272
+ S ? S.push(e) : window.location.href = e;
3273
+ }, T = l(() => m.columns.map((e) => {
3274
+ let t = typeof e == "string" ? { name: e } : { ...e };
3275
+ return t.label = t.label ?? le(t.name.split(".").pop()), t.sortable = t.sortable ?? !t.component, t;
3276
+ }).filter((e) => e.show ? e.show() : !0)), D = () => `sh_table_per_page_${typeof window < "u" ? window.location.pathname : "server"}_${m.endpoint}`.replace(/[^a-z0-9]+/gi, "_").toLowerCase(), ee = () => {
3277
+ let e = Number(i.getItem(D()));
3278
+ return e > 0 ? e : Number(m.perPage ?? t("tablePerPage", 10));
3279
+ }, F = O(1), I = O(ee()), R = O(""), B = O(!1), U = O(m.sortBy), W = O(m.sortMethod), te = O(null), ne = O(null), G = O(""), K = O(""), re = l(() => m.paginationStyle ?? t("tablePaginationStyle", "pages")), ie = l(() => m.cache === null ? !!t("enableTableCache", !1) : m.cache), { records: J, meta: ae, status: oe, error: se, offline: Y, fromCache: ce, load: ue } = _t({
3280
+ query: () => {
3281
+ let e = {
3282
+ order_by: U.value,
3283
+ order_method: W.value,
3284
+ per_page: I.value,
3285
+ page: F.value,
3286
+ filter_value: R.value,
3287
+ paginated: !0,
3288
+ from: te.value,
3289
+ to: ne.value,
3290
+ exact: B.value || null
3291
+ };
3292
+ return Object.keys(e).forEach((t) => {
3293
+ (e[t] === null || e[t] === "" || e[t] === void 0) && delete e[t];
3294
+ }), {
3295
+ endpoint: m.endpoint,
3296
+ params: e
3297
+ };
3298
+ },
3299
+ cacheEnabled: () => ie.value,
3300
+ networkTimeout: () => m.networkTimeout
3301
+ }), X = async ({ append: e = !1 } = {}) => {
3302
+ let t = await ue({ append: e });
3303
+ t && v("loaded", t);
3304
+ };
3305
+ X();
3306
+ let de = null, fe = () => {
3307
+ clearTimeout(de), de = setTimeout(() => {
3308
+ F.value = 1, X();
3309
+ }, 500);
3310
+ };
3311
+ C(() => clearTimeout(de));
3312
+ let pe = (e) => {
3313
+ if (!e) return null;
3314
+ let [t, n, r] = e.split("-");
3315
+ return `${n}/${r}/${t}`;
3316
+ }, me = () => {
3317
+ te.value = pe(G.value), ne.value = pe(K.value), F.value = 1, X();
3318
+ }, he = (e) => {
3319
+ e.sortable && (U.value === e.name ? W.value = W.value === "desc" ? "asc" : "desc" : (U.value = e.name, W.value = "desc"), X());
3320
+ }, ge = (e) => {
3321
+ F.value = e, X();
3322
+ }, _e = (e) => {
3323
+ I.value = e, F.value = 1, i.setItem(D(), e), X();
3324
+ }, ye = () => {
3325
+ F.value++, X({ append: !0 });
3326
+ };
3327
+ z(() => m.reload, () => X()), z(() => m.endpoint, () => {
3328
+ F.value = 1, I.value = ee(), X();
3329
+ });
3330
+ let Z = (e, t) => {
3331
+ let n = mt(e, t.name);
3332
+ if (n == null || n === "") return "";
3333
+ switch (t.format) {
3334
+ case "date": return r.formatDate(n, "ll");
3335
+ case "datetime": return r.formatDate(n);
3336
+ case "number": return r.formatNumber(n);
3337
+ case "money": return r.formatNumber(n, 2);
3338
+ default: return n;
3339
+ }
3340
+ }, be = (e) => !e.permission || b.isAllowedTo(e.permission), xe = (e) => m.actions.filter((t) => be(t) && (t.show ? t.show(e) : !0)), Q = l(() => m.multiActions.filter(be)), Se = (e, t) => String(e).replace(/\{(.*?)\}/g, (e, n) => mt(t, n)), Ce = async (e, t) => {
3341
+ if (e.handler) return e.handler(t);
3342
+ if (e.emit) {
3343
+ v("action", e.emit, t), v(e.emit, t);
3344
+ return;
3345
+ }
3346
+ if (e.link) return w(Se(e.link, t));
3347
+ if (e.url) {
3348
+ let i = Se(e.url, t);
3349
+ if (e.confirm) {
3350
+ let t = await r.runPlainRequest(i, e.confirm, e.label, e.data);
3351
+ t.isConfirmed && t.value?.success ? (r.showToast(t.value.response?.message ?? "Action successful"), X()) : t.isConfirmed && r.showToast(e.failMessage ?? "Action failed", "error");
3352
+ return;
3353
+ }
3354
+ try {
3355
+ let t = await n.doPost(i, e.data);
3356
+ r.showToast(t.data?.message ?? "Action successful"), X();
3357
+ } catch (e) {
3358
+ r.showToast(e.response?.data?.message ?? "Action failed", "error");
3359
+ }
3360
+ }
3361
+ }, we = (e) => {
3362
+ v("rowClick", e), m.rowLink && w(Se(m.rowLink, e));
3363
+ }, $ = O([]), Te = l(() => J.value.length > 0 && $.value.length === J.value.length), Ee = () => {
3364
+ $.value = Te.value ? [] : J.value.map((e) => e.id);
3365
+ }, De = (e) => {
3366
+ let t = $.value.indexOf(e);
3367
+ t > -1 ? $.value.splice(t, 1) : $.value.push(e);
3368
+ }, Oe = (e) => {
3369
+ let t = J.value.filter((e) => $.value.includes(e.id));
3370
+ e.handler?.(t), $.value = [];
3371
+ }, ke = l(() => T.value.length + +!!Q.value.length + +!!m.actions.length);
3372
+ return s({
3373
+ reload: () => X(),
3374
+ records: J
3375
+ }), (t, n) => (E(), f("div", { class: x(N(y).wrapper) }, [
3376
+ e.searchable || e.hasRange ? (E(), f("div", {
3377
+ key: 0,
3378
+ class: x(N(y).toolbar)
3379
+ }, [e.searchable ? (E(), f("div", Tt, [V(p("input", {
3380
+ "onUpdate:modelValue": n[0] ||= (e) => R.value = e,
3381
+ type: "search",
3382
+ placeholder: e.searchPlaceholder,
3383
+ class: x(N(y).search),
3384
+ onInput: fe
3385
+ }, null, 42, Et), [[L, R.value]]), R.value.length > 1 ? (E(), f("label", {
3386
+ key: 0,
3387
+ class: x(N(y).exactLabel)
3388
+ }, [V(p("input", {
3389
+ "onUpdate:modelValue": n[1] ||= (e) => B.value = e,
3390
+ type: "checkbox",
3391
+ class: x(N(y).checkbox),
3392
+ onChange: n[2] ||= (e) => X()
3393
+ }, null, 34), [[P, B.value]]), n[10] ||= h(" Exact ", -1)], 2)) : d("", !0)])) : d("", !0), e.hasRange ? (E(), f("div", {
3394
+ key: 1,
3395
+ class: x(N(y).rangeWrapper)
3396
+ }, [
3397
+ V(p("input", {
3398
+ "onUpdate:modelValue": n[3] ||= (e) => G.value = e,
3399
+ type: "date",
3400
+ class: x(N(y).rangeInput),
3401
+ onChange: me
3402
+ }, null, 34), [[L, G.value]]),
3403
+ n[11] ||= p("span", { class: "text-xs text-gray-400" }, "to", -1),
3404
+ V(p("input", {
3405
+ "onUpdate:modelValue": n[4] ||= (e) => K.value = e,
3406
+ type: "date",
3407
+ class: x(N(y).rangeInput),
3408
+ onChange: me
3409
+ }, null, 34), [[L, K.value]])
3410
+ ], 2)) : d("", !0)], 2)) : d("", !0),
3411
+ N(Y) ? (E(), f("div", {
3412
+ key: 1,
3413
+ class: x(N(y).offline)
3414
+ }, [...n[12] ||= [p("svg", {
3415
+ xmlns: "http://www.w3.org/2000/svg",
3416
+ class: "size-4",
3417
+ fill: "none",
3418
+ viewBox: "0 0 24 24",
3419
+ stroke: "currentColor",
3420
+ "stroke-width": "1.5"
3421
+ }, [p("path", {
3422
+ "stroke-linecap": "round",
3423
+ "stroke-linejoin": "round",
3424
+ d: "M12 9v3.75m0 3.75h.008v.008H12v-.008zM3.34 17.25h17.32c1.16 0 1.88-1.25 1.3-2.25L13.3 4.5c-.58-1-2.02-1-2.6 0L2.04 15c-.58 1 .14 2.25 1.3 2.25z"
3425
+ })], -1), p("span", null, "You appear to be offline — showing cached results. Search and pagination run on cached data.", -1)]], 2)) : d("", !0),
3426
+ N(oe) === "error" && !N(J).length ? (E(), f("div", {
3427
+ key: 2,
3428
+ class: x(N(y).error)
3429
+ }, M(N(se)), 3)) : N(oe) === "loading" && !N(J).length ? (E(), f("div", {
3430
+ key: 3,
3431
+ class: x(N(y).loading)
3432
+ }, [g(ve, { class: "size-6" })], 2)) : (E(), f(o, { key: 4 }, [
3433
+ p("div", { class: x(N(y).container) }, [p("table", { class: x(N(y).table) }, [p("thead", { class: x(N(y).thead) }, [p("tr", null, [
3434
+ Q.value.length ? (E(), f("th", {
3435
+ key: 0,
3436
+ class: x([N(y).th, "w-10"])
3437
+ }, [p("input", {
3438
+ type: "checkbox",
3439
+ class: x(N(y).checkbox),
3440
+ checked: Te.value,
3441
+ onChange: Ee
3442
+ }, null, 42, Dt)], 2)) : d("", !0),
3443
+ (E(!0), f(o, null, k(T.value, (e) => (E(), f("th", {
3444
+ key: e.name,
3445
+ class: x(N(y).th)
3446
+ }, [e.sortable ? (E(), f("a", {
3447
+ key: 0,
3448
+ class: x(N(y).sortBtn),
3449
+ onClick: (t) => he(e)
3450
+ }, [h(M(e.label) + " ", 1), U.value === e.name ? (E(), f("span", kt, M(W.value === "desc" ? "↓" : "↑"), 1)) : d("", !0)], 10, Ot)) : (E(), f(o, { key: 1 }, [h(M(e.label), 1)], 64))], 2))), 128)),
3451
+ e.actions.length ? (E(), f("th", {
3452
+ key: 1,
3453
+ class: x([N(y).th, "text-right"])
3454
+ }, "Actions", 2)) : d("", !0)
3455
+ ])], 2), p("tbody", { class: x(N(y).tbody) }, [N(J).length ? d("", !0) : (E(), f("tr", At, [p("td", {
3456
+ colspan: ke.value,
3457
+ class: x(N(y).empty)
3458
+ }, [A(t.$slots, "empty", {}, () => [h(M(e.emptyMessage), 1)])], 10, jt)])), (E(!0), f(o, null, k(N(J), (r, i) => (E(), f("tr", {
3459
+ key: r.id ?? i,
3460
+ class: x([N(y).tr, e.rowLink ? N(y).trClickable : ""]),
3461
+ onClick: (e) => we(r)
3462
+ }, [
3463
+ Q.value.length ? (E(), f("td", {
3464
+ key: 0,
3465
+ class: x(N(y).td),
3466
+ onClick: n[5] ||= H(() => {}, ["stop"])
3467
+ }, [p("input", {
3468
+ type: "checkbox",
3469
+ class: x(N(y).checkbox),
3470
+ checked: $.value.includes(r.id),
3471
+ onChange: (e) => De(r.id)
3472
+ }, null, 42, Nt)], 2)) : d("", !0),
3473
+ (E(!0), f(o, null, k(T.value, (e) => (E(), f("td", {
3474
+ key: e.name,
3475
+ class: x([N(y).td, e.class])
3476
+ }, [A(t.$slots, `cell-${e.name}`, {
3477
+ row: r,
3478
+ value: Z(r, e),
3479
+ index: i
3480
+ }, () => [e.component ? (E(), u(j(e.component), {
3481
+ key: 0,
3482
+ row: r,
3483
+ value: N(mt)(r, e.name)
3484
+ }, null, 8, ["row", "value"])) : e.format === "money" ? (E(), f("span", {
3485
+ key: 1,
3486
+ class: x(N(y).money)
3487
+ }, M(Z(r, e)), 3)) : (E(), f("span", {
3488
+ key: 2,
3489
+ innerHTML: Z(r, e)
3490
+ }, null, 8, Pt))])], 2))), 128)),
3491
+ e.actions.length ? (E(), f("td", {
3492
+ key: 1,
3493
+ class: x(N(y).actionsCell),
3494
+ onClick: n[6] ||= H(() => {}, ["stop"])
3495
+ }, [A(t.$slots, "actions", { row: r }, () => [(E(!0), f(o, null, k(xe(r), (e) => (E(), f("a", {
3496
+ key: e.label,
3497
+ class: x([N(y).actionBtn, e.class]),
3498
+ onClick: (t) => Ce(e, r)
3499
+ }, M(e.label), 11, Ft))), 128))])], 2)) : d("", !0)
3500
+ ], 10, Mt))), 128))], 2)], 2)], 2),
3501
+ p("div", { class: x(N(y).cards) }, [N(J).length ? d("", !0) : (E(), f("p", {
3502
+ key: 0,
3503
+ class: x(N(y).empty)
3504
+ }, [A(t.$slots, "empty", {}, () => [h(M(e.emptyMessage), 1)])], 2)), (E(!0), f(o, null, k(N(J), (r, i) => (E(), f("div", {
3505
+ key: r.id ?? i,
3506
+ class: x([N(y).card, e.rowLink ? N(y).trClickable : ""]),
3507
+ onClick: (e) => we(r)
3508
+ }, [
3509
+ Q.value.length ? (E(), f("label", {
3510
+ key: 0,
3511
+ class: x([N(y).exactLabel, "mb-2"]),
3512
+ onClick: n[7] ||= H(() => {}, ["stop"])
3513
+ }, [p("input", {
3514
+ type: "checkbox",
3515
+ class: x(N(y).checkbox),
3516
+ checked: $.value.includes(r.id),
3517
+ onChange: (e) => De(r.id)
3518
+ }, null, 42, Lt), n[13] ||= h(" Select ", -1)], 2)) : d("", !0),
3519
+ (E(!0), f(o, null, k(T.value, (e) => (E(), f(o, { key: e.name }, [p("p", { class: x(N(y).cardLabel) }, M(e.label), 3), p("div", { class: x(N(y).cardValue) }, [A(t.$slots, `cell-${e.name}`, {
3520
+ row: r,
3521
+ value: Z(r, e),
3522
+ index: i
3523
+ }, () => [e.component ? (E(), u(j(e.component), {
3524
+ key: 0,
3525
+ row: r,
3526
+ value: N(mt)(r, e.name)
3527
+ }, null, 8, ["row", "value"])) : e.format === "money" ? (E(), f("span", {
3528
+ key: 1,
3529
+ class: x(N(y).money)
3530
+ }, M(Z(r, e)), 3)) : (E(), f("span", {
3531
+ key: 2,
3532
+ innerHTML: Z(r, e)
3533
+ }, null, 8, Rt))])], 2)], 64))), 128)),
3534
+ e.actions.length ? (E(), f("div", {
3535
+ key: 1,
3536
+ class: "mt-2",
3537
+ onClick: n[8] ||= H(() => {}, ["stop"])
3538
+ }, [A(t.$slots, "actions", { row: r }, () => [(E(!0), f(o, null, k(xe(r), (e) => (E(), f("a", {
3539
+ key: e.label,
3540
+ class: x([N(y).actionBtn, e.class]),
3541
+ onClick: (t) => Ce(e, r)
3542
+ }, M(e.label), 11, zt))), 128))])])) : d("", !0)
3543
+ ], 10, It))), 128))], 2),
3544
+ N(ae) && N(J).length ? (E(), u(wt, {
3545
+ key: 0,
3546
+ meta: N(ae),
3547
+ "per-page": I.value,
3548
+ mode: re.value,
3549
+ loading: N(oe) === "loading",
3550
+ theme: N(y).pagination,
3551
+ onPage: ge,
3552
+ onPerPage: _e,
3553
+ onLoadMore: ye
3554
+ }, null, 8, [
3555
+ "meta",
3556
+ "per-page",
3557
+ "mode",
3558
+ "loading",
3559
+ "theme"
3560
+ ])) : d("", !0)
3561
+ ], 64)),
3562
+ $.value.length && Q.value.length ? (E(), f("div", {
3563
+ key: 5,
3564
+ class: x(N(y).multiBar)
3565
+ }, [p("div", Bt, [p("span", { class: x(N(y).multiCount) }, M($.value.length), 3), n[14] ||= h(" selected ", -1)]), p("div", Vt, [(E(!0), f(o, null, k(Q.value, (e) => (E(), f("button", {
3566
+ key: e.label,
3567
+ type: "button",
3568
+ class: x([N(y).multiBtn, e.class]),
3569
+ onClick: (t) => Oe(e)
3570
+ }, M(e.label), 11, Ht))), 128)), p("button", {
3571
+ type: "button",
3572
+ class: x(N(y).multiBtn),
3573
+ onClick: n[9] ||= (e) => $.value = []
3574
+ }, "Cancel", 2)])], 2)) : d("", !0)
3575
+ ], 2));
3576
+ }
3577
+ }, Wt = {
3578
+ __name: "ShConfirmAction",
3579
+ props: {
3580
+ url: {
3581
+ type: String,
3582
+ required: !0
3583
+ },
3584
+ data: Object,
3585
+ title: String,
3586
+ message: String,
3587
+ loadingMessage: {
3588
+ type: String,
3589
+ default: "Processing..."
3590
+ },
3591
+ successMessage: {
3592
+ type: String,
3593
+ default: "Action Successful"
3594
+ },
3595
+ failMessage: {
3596
+ type: String,
3597
+ default: "Action failed"
3598
+ },
3599
+ tag: {
3600
+ type: String,
3601
+ default: "button"
3602
+ },
3603
+ btnClass: String
3604
+ },
3605
+ emits: [
3606
+ "success",
3607
+ "failed",
3608
+ "canceled",
3609
+ "actionSuccessful",
3610
+ "actionFailed",
3611
+ "actionCanceled"
3612
+ ],
3613
+ setup(e, { emit: t }) {
3614
+ let n = e, i = t, a = q("buttons"), s = O(!1), c = (e) => {
3615
+ s.value = !1, i("actionSuccessful", e), i("success", e), (n.successMessage || e?.message) && r.showToast(e?.message ?? n.successMessage);
3616
+ }, l = (e) => {
3617
+ s.value = !1, i("actionFailed", e), i("failed", e), (n.failMessage || e?.value?.message) && r.showToast(e?.value?.message ?? n.failMessage, "error");
3618
+ };
3619
+ function d() {
3620
+ s.value = !0, r.runPlainRequest(n.url, n.message, n.title, n.data).then((e) => {
3621
+ e.isConfirmed ? e.value?.success ? c(e.value.response) : l(e) : (s.value = !1, i("actionCanceled"), i("canceled"));
3622
+ }).catch((e) => {
3623
+ l(e);
3624
+ });
3625
+ }
3626
+ return (t, n) => (E(), u(j(e.tag), {
3627
+ class: x([e.btnClass ?? N(a).link, s.value ? "pointer-events-none opacity-60" : ""]),
3628
+ onClick: d
3629
+ }, {
3630
+ default: B(() => [s.value ? (E(), f(o, { key: 0 }, [g(ve, { class: "size-4" }), p("span", null, M(e.loadingMessage), 1)], 64)) : A(t.$slots, "default", { key: 1 })]),
3631
+ _: 3
3632
+ }, 8, ["class"]));
3633
+ }
3634
+ }, Gt = {
3635
+ __name: "ShSilentAction",
3636
+ props: {
3637
+ url: {
3638
+ type: String,
3639
+ required: !0
3640
+ },
3641
+ data: Object,
3642
+ method: {
3643
+ type: String,
3644
+ default: "POST"
3645
+ },
3646
+ loadingMessage: {
3647
+ type: String,
3648
+ default: "Processing"
3649
+ },
3650
+ successMessage: {
3651
+ type: String,
3652
+ default: "Action Successful"
3653
+ },
3654
+ failMessage: {
3655
+ type: String,
3656
+ default: "Action failed"
3657
+ },
3658
+ disableSuccessMessage: Boolean,
3659
+ tag: {
3660
+ type: String,
3661
+ default: "button"
3662
+ },
3663
+ btnClass: String
3664
+ },
3665
+ emits: [
3666
+ "success",
3667
+ "failed",
3668
+ "actionSuccessful",
3669
+ "actionFailed"
3670
+ ],
3671
+ setup(e, { emit: t }) {
3672
+ let i = e, a = t, s = q("buttons"), c = O(!1), l = {
3673
+ GET: n.doGet,
3674
+ POST: n.doPost,
3675
+ PUT: n.doPut,
3676
+ DELETE: n.doDelete
3677
+ };
3678
+ function d() {
3679
+ c.value = !0, (l[i.method.toUpperCase()] ?? n.doPost)(i.url, i.data).then((e) => {
3680
+ c.value = !1, a("actionSuccessful", e), a("success", e), i.disableSuccessMessage || r.showToast(e.data?.message ?? i.successMessage);
3681
+ }).catch((e) => {
3682
+ c.value = !1, a("actionFailed", e), a("failed", e), r.showToast(e?.message ?? i.failMessage, "error");
3683
+ });
3684
+ }
3685
+ return (t, n) => (E(), u(j(e.tag), {
3686
+ class: x([e.btnClass ?? N(s).link, c.value ? "pointer-events-none opacity-60" : ""]),
3687
+ onClick: d
3688
+ }, {
3689
+ default: B(() => [c.value ? (E(), f(o, { key: 0 }, [g(ve, { class: "size-4" }), p("span", null, M(e.loadingMessage), 1)], 64)) : A(t.$slots, "default", { key: 1 })]),
3690
+ _: 3
3691
+ }, 8, ["class"]));
3692
+ }
3693
+ };
3694
+ //#endregion
3695
+ export { ke as DateInput, Se as EmailInput, De as NumberInput, Te as PasswordInput, ze as PhoneInput, ne as SH_DIALOG_CONTEXT, te as SH_TW_COMPONENTS, W as SH_TW_THEME, Pe as SelectInput, Wt as ShConfirmAction, Je as ShDialog, Xe as ShDialogBtn, Qe as ShDialogForm, Ye as ShDrawer, Ze as ShDrawerBtn, qe as ShForm, pe as ShFormSteps, Gt as ShSilentAction, ve as ShSpinner, Ue as ShSuggest, Ut as ShTable, wt as ShTablePagination, re as ShTailwind, xe as TextAreaInput, Z as TextInput, ft as clearTableCache, Fe as countries, ie as createShTailwind, U as defaultTheme, gt as localQuery, pt as shTableCache, ce as useDialog, _t as useTableData, q as useTheme };