@dakataa/crud-react 1.0.7 → 1.0.9

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.
@@ -1,33 +1,33 @@
1
- import { jsx as o, jsxs as _, Fragment as P } from "react/jsx-runtime";
2
- import H, { convertObjectToURLSearchParams as An, convertURLSearchParamsToObject as dt, Method as Ve, InterceptEvent as xe, RequestBodyType as ut, convertFormDataToObject as Pn } from "@dakataa/requester";
3
- import * as ie from "react";
4
- import v, { useState as R, memo as Z, useEffect as N, forwardRef as X, useRef as O, useImperativeHandle as ye, useReducer as Y, useId as Ee, useCallback as Ln, Fragment as Oe, Children as On, createRef as Sn } from "react";
5
- import { createPortal as Rn } from "react-dom";
6
- import kn from "lottie-web/build/player/esm/lottie.min.js";
7
- import * as Qe from "@popperjs/core";
8
- class mt {
1
+ import { jsx as r, jsxs as C, Fragment as A } from "react/jsx-runtime";
2
+ import K, { convertObjectToURLSearchParams as Sn, convertURLSearchParamsToObject as pt, convertFormDataToObject as Be, Method as $e, InterceptEvent as Ne, RequestBodyType as ht } from "@dakataa/requester";
3
+ import * as ae from "react";
4
+ import v, { useState as R, memo as X, useEffect as N, forwardRef as de, useRef as S, useImperativeHandle as ue, useReducer as W, useId as Ce, useCallback as kn, Fragment as Se, createElement as et, Children as Dn, createRef as Rn } from "react";
5
+ import { createPortal as Tn } from "react-dom";
6
+ import In from "lottie-web/build/player/esm/lottie.min.js";
7
+ import * as tt from "@popperjs/core";
8
+ class gt {
9
9
  code;
10
10
  detail;
11
11
  trace;
12
- constructor(t = 0, n, r) {
13
- this.code = t, this.detail = n, this.trace = r;
12
+ constructor(t = 0, n, o) {
13
+ this.code = t, this.detail = n, this.trace = o;
14
14
  }
15
15
  }
16
- class Be extends mt {
16
+ class qe extends gt {
17
17
  status = 400;
18
- constructor(t, n, r) {
19
- super(0, n, r), this.status = t;
18
+ constructor(t, n, o) {
19
+ super(0, n, o), this.status = t;
20
20
  }
21
21
  }
22
- const ft = ie.createContext(void 0);
23
- function pt() {
24
- return ie.useContext(ft);
22
+ const bt = ae.createContext(void 0);
23
+ function yt() {
24
+ return ae.useContext(bt);
25
25
  }
26
- function Dn({ ...e }) {
26
+ function jn({ ...e }) {
27
27
  const [t, n] = R(!1);
28
- return /* @__PURE__ */ o(ft.Provider, { value: { defaultPrevented: t, setPreventDefault: n }, children: e.children });
28
+ return /* @__PURE__ */ r(bt.Provider, { value: { defaultPrevented: t, setPreventDefault: n }, children: e.children });
29
29
  }
30
- class Tn extends ie.Component {
30
+ class Fn extends ae.Component {
31
31
  constructor(t) {
32
32
  super(t), this.state = {
33
33
  hasError: !1,
@@ -48,7 +48,7 @@ class Tn extends ie.Component {
48
48
  window.removeEventListener("unhandledrejection", this.promiseRejectionHandler);
49
49
  }
50
50
  static getDerivedStateFromError(t) {
51
- return t instanceof Error && (t = new Be(0, t.message)), {
51
+ return t instanceof Error && (t = new qe(0, t.message)), {
52
52
  hasError: !0,
53
53
  error: t
54
54
  };
@@ -56,11 +56,11 @@ class Tn extends ie.Component {
56
56
  componentDidCatch(t, n) {
57
57
  console.log("error", t);
58
58
  }
59
- componentDidUpdate(t, n, r) {
59
+ componentDidUpdate(t, n, o) {
60
60
  this.state.error?.detail !== n.error?.detail && this.state.hasError && !this.props.defaultPrevented && this.props.fallback instanceof Function && this.props.fallback(this.state.error);
61
61
  }
62
62
  render() {
63
- return this.state.hasError && !this.props.defaultPrevented && this.props.fallback && ie.isValidElement(this.props.fallback) ? ie.cloneElement(
63
+ return this.state.hasError && !this.props.defaultPrevented && this.props.fallback && ae.isValidElement(this.props.fallback) ? ae.cloneElement(
64
64
  this.props.fallback,
65
65
  {
66
66
  error: this.state.error,
@@ -69,28 +69,32 @@ class Tn extends ie.Component {
69
69
  ) : this.props.children;
70
70
  }
71
71
  }
72
- const In = ({ children: e, ...t }) => {
73
- const n = pt();
74
- return /* @__PURE__ */ o(Tn, { ...t, defaultPrevented: n?.defaultPrevented || !1, children: e });
75
- }, ht = ({ children: e, ...t }) => {
76
- const n = pt();
77
- return /* @__PURE__ */ o(Dn, { children: /* @__PURE__ */ o(In, { ...t, parentErrorBoundaryContext: n, children: e }) });
78
- }, gt = Z(({ children: e }) => /* @__PURE__ */ o("div", { className: "crud", children: e })), jn = Z(({ error: e }) => /* @__PURE__ */ o(gt, { children: /* @__PURE__ */ o("main", { children: /* @__PURE__ */ _("div", { className: "content d-flex flex-column", children: [
79
- /* @__PURE__ */ o("h1", { className: "display-1", children: e?.status || e.name || "Error" }),
80
- /* @__PURE__ */ o("p", { className: "text-secondary", children: e?.detail || "Unknown Error" }),
81
- /* @__PURE__ */ o("br", {}),
82
- /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o("a", { className: "btn btn-primary", href: "#", children: "Back to home" }) })
72
+ const Mn = ({ children: e, ...t }) => {
73
+ const n = yt();
74
+ return /* @__PURE__ */ r(Fn, { ...t, defaultPrevented: n?.defaultPrevented || !1, children: e });
75
+ }, vt = ({ children: e, ...t }) => {
76
+ const n = yt();
77
+ return /* @__PURE__ */ r(jn, { children: /* @__PURE__ */ r(Mn, { ...t, parentErrorBoundaryContext: n, children: e }) });
78
+ }, Et = X(({ children: e }) => /* @__PURE__ */ r("div", { className: "crud", children: e })), Un = X(({ error: e }) => /* @__PURE__ */ r(Et, { children: /* @__PURE__ */ r("main", { children: /* @__PURE__ */ C("div", { className: "content d-flex flex-column", children: [
79
+ /* @__PURE__ */ r("h1", { className: "display-1", children: e?.status || e.name || "Error" }),
80
+ /* @__PURE__ */ r("p", { className: "text-secondary", children: e?.detail || "Unknown Error" }),
81
+ /* @__PURE__ */ r("br", {}),
82
+ /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r("a", { className: "btn btn-primary", href: "#", children: "Back to home" }) })
83
83
  ] }) }) }));
84
- var bt = /* @__PURE__ */ ((e) => (e.PROD = "prod", e.DEV = "dev", e.TEST = "test", e))(bt || {});
85
- const vt = v.createContext({
84
+ var Ct = /* @__PURE__ */ ((e) => (e.PROD = "prod", e.DEV = "dev", e.TEST = "test", e))(Ct || {});
85
+ const _t = v.createContext({
86
86
  env: "prod"
87
87
  /* PROD */
88
88
  });
89
- function le() {
90
- return v.useContext(vt);
89
+ function ee() {
90
+ return v.useContext(_t);
91
91
  }
92
- function Fn({ config: e, ...t }) {
93
- return /* @__PURE__ */ o(vt.Provider, { value: e, children: t.children });
92
+ function Vn({ config: e, ...t }) {
93
+ const n = ee();
94
+ return /* @__PURE__ */ r(_t.Provider, { value: {
95
+ ...n || {},
96
+ ...e
97
+ }, children: t.children });
94
98
  }
95
99
  window.history.pushState = new Proxy(window.history.pushState, {
96
100
  apply: (e, t, n) => {
@@ -102,79 +106,79 @@ window.history.replaceState = new Proxy(window.history.replaceState, {
102
106
  e.apply(t, n), window.dispatchEvent(new Event("replacestate"));
103
107
  }
104
108
  });
105
- const Ze = "actions", yt = v.createContext(void 0);
106
- function T() {
107
- const e = v.useContext(yt);
109
+ const nt = "actions", xt = v.createContext(void 0);
110
+ function j() {
111
+ const e = v.useContext(xt);
108
112
  if (!e)
109
113
  throw new Error("UseActions must be used in ActionProvider");
110
- const t = le(), { actions: n, location: r } = e, s = (d, b, p) => n?.filter((x) => x.entity === d && x.name === b && (p === void 0 || x.namespace === p)).shift(), i = (d) => {
114
+ const t = ee(), { actions: n, location: o } = e, s = (d, g, h) => n?.filter((x) => x.entity === d && x.name === g && (h === void 0 || x.namespace === h)).shift(), i = (d) => {
111
115
  if (n)
112
- return n.find((b) => b.route?.path && f(b.route.path, d)) ?? null;
116
+ return n.find((g) => g.route?.path && b(g.route.path, d)) ?? null;
113
117
  }, a = (d) => {
114
- const b = i(d);
115
- if (!b)
116
- return b;
117
- const p = f(b.route?.path || "", d);
118
+ const g = i(d);
119
+ if (!g)
120
+ return g;
121
+ const h = b(g.route?.path || "", d);
118
122
  return {
119
- action: b,
120
- parameters: p?.params,
121
- query: p?.query
123
+ action: g,
124
+ parameters: h?.params,
125
+ query: h?.query
122
126
  };
123
- }, l = (d) => d.replaceAll(new RegExp("{(.*?)}", "gi"), ":$1"), c = (d, b, p) => m(l(d), b, p), u = (d, b, p) => d ? c(d.path, { ...d.defaults || {}, ...b }, p) : "#", g = (d) => {
124
- const b = s(d.action.entity, d.action.name, d.action.namespace);
125
- return u(b?.route, d.parameters, d.query);
126
- }, h = (d, b, p) => u(d, b, p), y = (d) => (t.link?.prefix && (d = "/" + t.link.prefix.replaceAll(new RegExp("^/|/$", "g"), "") + d), d), E = (d) => (t.link?.prefix && (d = d.replace(new RegExp("^/" + t.link.prefix.replace(new RegExp("^/"), "") + "(/)?"), "/")), d), C = (d, b) => {
127
+ }, c = (d) => d.replaceAll(new RegExp("{(.*?)}", "gi"), ":$1"), u = (d, g, h) => l(c(d), g, h), m = (d, g, h) => d ? u(d.path, { ...d.defaults || {}, ...g }, h) : "#", p = (d) => {
128
+ const g = s(d.action.entity, d.action.name, d.action.namespace);
129
+ return m(g?.route, d.parameters, d.query);
130
+ }, f = (d, g, h) => m(d, g, h), y = (d) => (t.link?.prefix && (d = "/" + t.link.prefix.replaceAll(new RegExp("^/|/$", "g"), "") + d), d), E = (d) => (t.link?.prefix && (d = d.replace(new RegExp("^/" + t.link.prefix.replace(new RegExp("^/"), "") + "(/)?"), "/")), d), _ = (d, g) => {
127
131
  try {
128
- b ? history.replaceState(null, "", d) : history.pushState(null, "", d);
132
+ g ? history.replaceState(null, "", d) : history.pushState(null, "", d);
129
133
  } catch {
130
134
  window.location.assign(d);
131
135
  }
132
- }, f = (d, b) => {
133
- const p = new URL(b, r.origin), x = E(p.pathname), w = "^" + d.replace(new RegExp("/[{:](\\w+)}?", "g"), "[/]?(?<$1>[^/]+)?").replace("*", ".*") + "$";
134
- if (!new RegExp(w, "giu").test(x))
136
+ }, b = (d, g) => {
137
+ const h = new URL(g, o.origin), x = E(h.pathname), P = "^" + d.replace(new RegExp("/[{:](\\w+)}?", "g"), "[/]?(?<$1>[^/]+)?").replace("*", ".*") + "$";
138
+ if (!new RegExp(P, "giu").test(x))
135
139
  return null;
136
- const I = x.matchAll(new RegExp(w, "giu"))?.next().value?.groups, oe = dt(p.searchParams);
140
+ const k = x.matchAll(new RegExp(P, "giu"))?.next().value?.groups, F = pt(h.searchParams);
137
141
  return {
138
142
  pathname: x,
139
- params: I,
140
- query: oe,
143
+ params: k,
144
+ query: F,
141
145
  pattern: d
142
146
  };
143
- }, m = (d, b, p) => {
144
- const x = d.replaceAll(new RegExp("[{:](\\w+)}?", "g"), (S, I) => {
145
- const oe = b?.[I];
146
- return oe !== void 0 && delete b?.[I], oe ?? "";
147
- }).replace(new RegExp("/$", "g"), ""), w = new URL(x, r.origin);
148
- return An(p || {}).entries().forEach(([S, I]) => {
149
- w.searchParams.set(S, I);
150
- }), y(w.pathname + w.search);
147
+ }, l = (d, g, h) => {
148
+ const x = d.replaceAll(new RegExp("[{:](\\w+)}?", "g"), (O, k) => {
149
+ const F = g?.[k];
150
+ return F !== void 0 && delete g?.[k], F ?? "";
151
+ }).replace(new RegExp("/$", "g"), ""), P = new URL(x, o.origin);
152
+ return Sn(h || {}).entries().forEach(([O, k]) => {
153
+ P.searchParams.set(O, k);
154
+ }), y(P.pathname + P.search);
151
155
  };
152
156
  return {
153
157
  getAction: s,
154
158
  getActionByPath: i,
155
159
  getOnClickActionByPath: a,
156
- navigate: C,
160
+ navigate: _,
157
161
  actions: n,
158
- location: r,
159
- matchPath: f,
160
- generateRoute: u,
161
- generateRoutePath: c,
162
- crudToReactPathPattern: l,
163
- generateActionLink: g,
164
- generateLink: h,
165
- generatePath: m,
162
+ location: o,
163
+ matchPath: b,
164
+ generateRoute: m,
165
+ generateRoutePath: u,
166
+ crudToReactPathPattern: c,
167
+ generateActionLink: p,
168
+ generateLink: f,
169
+ generatePath: l,
166
170
  internalToExternalPath: y,
167
171
  externalToInternalPath: E
168
172
  };
169
173
  }
170
- function Et(e) {
174
+ function Nt(e) {
171
175
  let t = null;
172
176
  try {
173
- const a = sessionStorage.getItem(Ze);
177
+ const a = sessionStorage.getItem(nt);
174
178
  t = JSON.parse(atob(a || ""));
175
179
  } catch {
176
180
  }
177
- const [n, r] = R(t), [s, i] = R(new URL(document.location.href));
181
+ const [n, o] = R(t), [s, i] = R(new URL(document.location.href));
178
182
  return N(() => {
179
183
  const a = (() => {
180
184
  i(new URL(document.location.href));
@@ -183,446 +187,459 @@ function Et(e) {
183
187
  window.removeEventListener("pushstate", a), window.removeEventListener("replacestate", a), window.removeEventListener("popstate", a);
184
188
  };
185
189
  }, []), N(() => {
186
- t || ce().get({ url: "/_crud/actions" }).then(({ status: a, data: l }) => {
187
- a === 200 && (sessionStorage.setItem(Ze, btoa(JSON.stringify(l))), r(l));
190
+ t || le().get({ url: "/_crud/actions" }).then(({ status: a, data: c }) => {
191
+ a === 200 && (sessionStorage.setItem(nt, btoa(JSON.stringify(c))), o(c));
188
192
  }).catch((a) => {
189
193
  console.log("error", a);
190
194
  }).finally(() => {
191
195
  });
192
- }, []), /* @__PURE__ */ o(yt.Provider, { value: {
196
+ }, []), /* @__PURE__ */ r(xt.Provider, { value: {
193
197
  actions: n,
194
198
  location: s,
195
199
  setLocation: i
196
200
  }, children: e.children });
197
201
  }
198
- function Ro(e) {
199
- return (t) => /* @__PURE__ */ o(Et, { children: /* @__PURE__ */ o(e, { ...t }) });
202
+ function To(e) {
203
+ return (t) => /* @__PURE__ */ r(Nt, { children: /* @__PURE__ */ r(e, { ...t }) });
200
204
  }
201
- var A = /* @__PURE__ */ ((e) => (e.Form = "form", e.Input = "input", e.Money = "money", e.Hidden = "hidden", e.Number = "number", e.Text = "text", e.Tel = "tel", e.Checkbox = "checkbox", e.Radio = "radio", e.Integer = "integer", e.Password = "password", e.Email = "email", e.Choice = "choice", e.Enum = "enum", e.Entity = "entity", e.Collection = "collection", e.Repeated = "repeated", e.Datetime = "datetime", e.Date = "date", e.Time = "time", e.Birthday = "birthday", e))(A || {});
202
- const Ct = v.createContext(void 0);
203
- function de() {
204
- const e = v.useContext(Ct);
205
+ var w = /* @__PURE__ */ ((e) => (e.Form = "form", e.Input = "input", e.Money = "money", e.Hidden = "hidden", e.Number = "number", e.Text = "text", e.Tel = "tel", e.Checkbox = "checkbox", e.Radio = "radio", e.Integer = "integer", e.Password = "password", e.Email = "email", e.Choice = "choice", e.Enum = "enum", e.Entity = "entity", e.Collection = "collection", e.Repeated = "repeated", e.Datetime = "datetime", e.Date = "date", e.Time = "time", e.Currency = "currency", e.Language = "language", e.Birthday = "birthday", e))(w || {});
206
+ const wt = v.createContext(void 0);
207
+ function me() {
208
+ const e = v.useContext(wt);
205
209
  if (!e)
206
210
  throw new Error("useForm must be used in Form");
207
211
  return e;
208
212
  }
209
- const Ce = (e, t = null) => (e?.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").replace(/([a-zA-Z])(?=[A-Z])/g, "$1_") + (t ?? "")).toLowerCase(), _t = X(({
213
+ const _e = (e, t = null) => (e?.replace(/[\[\]]/gi, "_").replace(/_+/gi, "_").replace(/([a-zA-Z])(?=[A-Z])/g, "$1_") + (t ?? "")).toLowerCase(), At = de(({
210
214
  id: e,
211
215
  children: t,
212
216
  data: n,
213
- onError: r,
217
+ onError: o,
214
218
  onBeforeSubmit: s,
215
219
  onSubmit: i,
216
220
  onReset: a,
217
- ...l
218
- }, c) => {
219
- const u = O(null), g = {
221
+ ...c
222
+ }, u) => {
223
+ const m = S(null), p = {
220
224
  response: null,
221
225
  constraints: {},
222
226
  errors: {}
223
- }, h = (m, d) => {
224
- const b = u.current?.elements.namedItem(m);
225
- if (!b) {
226
- console.warn("Cannot Set Value on missing Form Element with name: " + m);
227
+ }, f = (l, d) => {
228
+ const g = m.current?.elements.namedItem(l);
229
+ if (!g) {
230
+ console.warn("Cannot Set Value on missing Form Element with name: " + l);
227
231
  return;
228
232
  }
229
- if (!(b instanceof HTMLInputElement))
230
- throw new Error("Cannot Set Value on missing Form Element with name: " + m);
231
- switch (b.type) {
232
- case A.Checkbox:
233
- case A.Radio: {
234
- d !== null && !(d instanceof Array) && (d = [d]), d?.includes(b.value) && (b.checked = !0);
233
+ if (!(g instanceof HTMLInputElement))
234
+ throw new Error("Cannot Set Value on missing Form Element with name: " + l);
235
+ switch (g.type) {
236
+ case w.Checkbox:
237
+ case w.Radio: {
238
+ d !== null && !(d instanceof Array) && (d = [d]), d?.includes(g.value) && (g.checked = !0);
235
239
  break;
236
240
  }
237
241
  default:
238
242
  if (d instanceof Array)
239
243
  throw new Error("Invalid Value");
240
- b.value = d || "";
244
+ g.value = d || "";
241
245
  }
242
246
  }, y = {
243
- getFormData: () => new FormData(u.current || void 0),
244
- setFormData: (m) => {
245
- [...u.current?.elements || []].forEach((d) => {
246
- const b = m.get(d.name);
247
+ getFormData: () => new FormData(m.current || void 0),
248
+ setFormData: (l) => {
249
+ [...m.current?.elements || []].forEach((d) => {
250
+ const g = l.get(d.name);
247
251
  switch (d.tagName.toLowerCase()) {
248
252
  case "select": {
249
- d.multiple ? [...d.options].forEach((p) => {
250
- p.selected = m.getAll(d.name).includes(p.value);
251
- }) : d.value = b;
253
+ d.multiple ? [...d.options].forEach((h) => {
254
+ h.selected = l.getAll(d.name).includes(h.value);
255
+ }) : d.value = g;
252
256
  break;
253
257
  }
254
258
  default:
255
259
  switch (d.type) {
256
260
  case "checkbox":
257
- d.checked = !!b;
261
+ d.checked = !!g;
258
262
  break;
259
263
  default:
260
- d.value = b;
264
+ d.value = g;
261
265
  break;
262
266
  }
263
267
  }
264
268
  });
265
269
  },
266
- setValue: h,
267
- setValues: (m) => {
268
- Object.keys(m).map((d) => h(d, m[d]));
270
+ setValue: f,
271
+ setValues: (l) => {
272
+ Object.keys(l).map((d) => f(d, l[d]));
269
273
  },
270
- setErrors: (m) => {
271
- const [, d] = C;
272
- d({ action: "errors", payload: m });
274
+ setErrors: (l) => {
275
+ const [, d] = _;
276
+ d({ action: "errors", payload: l });
273
277
  },
274
278
  reset: () => {
275
- u.current?.reset();
279
+ m.current?.reset();
276
280
  },
277
281
  success: () => {
278
- const [, m] = C;
279
- m({ action: "success", payload: !0 });
282
+ const [, l] = _;
283
+ l({ action: "success", payload: !0 });
280
284
  },
281
- submit: () => u.current?.requestSubmit()
285
+ submit: () => m.current?.requestSubmit()
282
286
  };
283
- ye(c, () => y), N(() => {
284
- const m = () => {
287
+ ue(u, () => y), N(() => {
288
+ const l = () => {
285
289
  a && a();
286
- }, d = u?.current;
287
- return d?.addEventListener("reset", m), () => {
288
- d?.removeEventListener("reset", m);
290
+ }, d = m?.current;
291
+ return d?.addEventListener("reset", l), () => {
292
+ d?.removeEventListener("reset", l);
289
293
  };
290
294
  }, []);
291
- const E = (m, d) => {
292
- const b = y.getFormData();
293
- for (const p of d)
294
- if (!p.isValid(b.get(m) || null))
295
- return { valid: !1, message: p.getMessage() };
295
+ const E = (l, d) => {
296
+ const g = y.getFormData();
297
+ for (const h of d)
298
+ if (!h.isValid(g.get(l) || null))
299
+ return { valid: !1, message: h.getMessage() };
296
300
  return { valid: !0, message: null };
297
- }, C = Y((m, d) => {
298
- const { action: b, payload: p } = d;
299
- switch (b) {
301
+ }, _ = W((l, d) => {
302
+ const { action: g, payload: h } = d;
303
+ switch (g) {
300
304
  case "constraints": {
301
- const { name: x, constraints: w } = p;
305
+ const { name: x, constraints: P } = h;
302
306
  return {
303
- ...m,
307
+ ...l,
304
308
  constraints: {
305
- ...m.constraints || {},
306
- [x]: w
309
+ ...l.constraints || {},
310
+ [x]: P
307
311
  }
308
312
  };
309
313
  }
310
314
  case "validate": {
311
- const { valid: x, message: w } = E(p, m.constraints[p] || []), L = m.errors || {}, S = p;
312
- return x ? delete L[S] : L[S] = [...L[S] || [], { message: w || "Error" }], Object.keys(L).length ? {
313
- ...m,
315
+ const { valid: x, message: P } = E(h, l.constraints[h] || []), L = l.errors || {}, O = h;
316
+ return x ? delete L[O] : L[O] = [...L[O] || [], { message: P || "Error" }], Object.keys(L).length ? {
317
+ ...l,
314
318
  errors: L
315
- } : m;
319
+ } : l;
316
320
  }
317
321
  case "response":
318
322
  return {
319
- ...m,
320
- response: p
323
+ ...l,
324
+ response: h
321
325
  };
322
326
  case "errors":
323
327
  return {
324
- ...m,
325
- errors: p || []
328
+ ...l,
329
+ errors: h || []
326
330
  };
327
331
  case "error": {
328
- const x = { ...m.errors, ...p };
332
+ const x = { ...l.errors, ...h };
329
333
  return {
330
- ...m,
334
+ ...l,
331
335
  errors: x
332
336
  };
333
337
  }
334
338
  case "success":
335
339
  return {
336
- ...m,
337
- success: p
340
+ ...l,
341
+ success: h
338
342
  };
339
343
  }
340
- return m;
341
- }, g), f = (m) => {
342
- m.preventDefault();
343
- const [d, b] = C;
344
- let p = {};
345
- for (const [w, L] of Object.entries(d.constraints)) {
346
- const { valid: S, message: I } = E(w, L);
347
- S || (p[w] = [I]);
344
+ return l;
345
+ }, p), b = (l) => {
346
+ l.preventDefault();
347
+ const [d, g] = _;
348
+ let h = {};
349
+ for (const [P, L] of Object.entries(d.constraints)) {
350
+ const { valid: O, message: k } = E(P, L);
351
+ O || (h[P] = [k]);
348
352
  }
349
- if (Object.values(p).length) {
350
- b({ action: "errors", payload: p });
353
+ if (Object.values(h).length) {
354
+ g({ action: "errors", payload: h });
351
355
  return;
352
356
  }
353
- const x = new FormData(u?.current || void 0);
357
+ const x = new FormData(m?.current || void 0);
354
358
  if (s && s(x), i) {
355
359
  i(x);
356
360
  return;
357
361
  }
358
362
  };
359
- return /* @__PURE__ */ o(Ct.Provider, { value: [C, c, u], children: /* @__PURE__ */ o("form", { id: e, ref: u, onSubmit: f, ...l, children: t }) });
360
- }), xt = ({
363
+ return /* @__PURE__ */ r(wt.Provider, { value: [_, u, m], children: /* @__PURE__ */ r("form", { id: e, ref: m, onSubmit: b, ...c, children: t }) });
364
+ }), Pt = ({
361
365
  icon: e,
362
366
  preloader: t,
363
367
  rightIcon: n,
364
- children: r,
368
+ children: o,
365
369
  preload: s = !1
366
- }) => /* @__PURE__ */ _(P, { children: [
367
- s ? t || /* @__PURE__ */ o(P, { children: "*" }) : e,
368
- r,
370
+ }) => /* @__PURE__ */ C(A, { children: [
371
+ s ? t || /* @__PURE__ */ r(A, { children: "*" }) : e,
372
+ o,
369
373
  n
370
- ] }), wt = v.createContext(void 0), Nt = () => v.useContext(wt), At = v.createContext(void 0), Mn = () => v.useContext(At), Un = ({ loader: e, children: t }) => {
371
- const n = Ee();
372
- return /* @__PURE__ */ o(At.Provider, { value: e || n, children: t });
373
- }, Vn = ({ children: e }) => {
374
- const [t, n] = Y((i, a) => {
375
- const [l, c] = a;
374
+ ] }), Lt = v.createContext(void 0), Ot = () => v.useContext(Lt), St = v.createContext(void 0), Bn = () => v.useContext(St), $n = ({ loader: e, children: t }) => {
375
+ const n = Ce();
376
+ return /* @__PURE__ */ r(St.Provider, { value: e || n, children: t });
377
+ }, qn = ({ children: e }) => {
378
+ const [t, n] = W((i, a) => {
379
+ const [c, u] = a;
376
380
  return {
377
381
  ...i,
378
- [l]: c
382
+ [c]: u
379
383
  };
380
- }, {}), r = (i) => {
384
+ }, {}), o = (i) => {
381
385
  n([i, !0]);
382
386
  }, s = (i) => {
383
387
  n([i, !1]);
384
388
  };
385
- return /* @__PURE__ */ o(wt.Provider, { value: {
389
+ return /* @__PURE__ */ r(Lt.Provider, { value: {
386
390
  loaders: t,
387
- startLoading: r,
391
+ startLoading: o,
388
392
  stopLoading: s,
389
393
  isLoading: (i) => t[i] ?? !1
390
394
  }, children: e });
391
- }, ue = X(({
395
+ }, fe = de(({
392
396
  children: e,
393
397
  type: t,
394
398
  form: n,
395
- ...r
399
+ ...o
396
400
  }, s) => {
397
- const { isLoading: i } = Nt() || {}, a = Mn() || n || "form", l = t === "submit" && i?.(a);
398
- return /* @__PURE__ */ o("button", { disabled: l, form: n, ...r, ref: s, children: /* @__PURE__ */ o(xt, { preload: l, ...r, children: e }) });
399
- }), Pt = v.createContext("");
400
- function Lt() {
401
- return v.useContext(Pt);
401
+ const { isLoading: i } = Ot() || {}, a = Bn() || n || "form", c = t === "submit" && i?.(a);
402
+ return /* @__PURE__ */ r("button", { disabled: c, form: n, ...o, ref: s, children: /* @__PURE__ */ r(Pt, { preload: c, ...o, children: e }) });
403
+ }), kt = v.createContext("");
404
+ function Dt() {
405
+ return v.useContext(kt);
402
406
  }
403
- function Bn({ namespace: e, ...t }) {
404
- return /* @__PURE__ */ o(Pt.Provider, { value: e, children: t.children });
407
+ function Hn({ namespace: e, ...t }) {
408
+ return /* @__PURE__ */ r(kt.Provider, { value: e, children: t.children });
405
409
  }
406
- const Ot = v.createContext(void 0);
407
- function $n({ children: e }) {
408
- const [t, n] = Y((r, { key: s, context: i }) => (r = { ...r }, i ? r[s] = i : delete r[s], r), {});
409
- return /* @__PURE__ */ o(Ot.Provider, { value: {
410
- set: (r, s) => n({ key: r, context: s }),
411
- get: (r) => t[r] || null,
412
- unset: (r) => {
413
- n({ key: r });
410
+ const Rt = v.createContext(void 0);
411
+ function Kn({ children: e }) {
412
+ const [t, n] = W((o, { key: s, context: i }) => (o = { ...o }, i ? o[s] = i : delete o[s], o), {});
413
+ return /* @__PURE__ */ r(Rt.Provider, { value: {
414
+ set: (o, s) => n({ key: o, context: s }),
415
+ get: (o) => t[o] || null,
416
+ unset: (o) => {
417
+ n({ key: o });
414
418
  }
415
419
  }, children: e });
416
420
  }
417
- function qn() {
418
- const e = v.useContext(Ot);
421
+ function Gn() {
422
+ const e = v.useContext(Rt);
419
423
  if (!e)
420
424
  throw new Error("UseCurrentActionCollection must be used in CurrentActionCollectionProvider");
421
425
  return e;
422
426
  }
423
- const St = v.createContext(void 0);
424
- function ee() {
425
- const e = v.useContext(St);
427
+ const Tt = v.createContext(void 0);
428
+ function te() {
429
+ const e = v.useContext(Tt);
426
430
  if (!e)
427
431
  throw new Error("UseCurrentAction must be used in CurrentActionProvider");
428
432
  return e;
429
433
  }
430
- function Rt({ action: e, name: t, ...n }) {
431
- const { getAction: r } = T(), { set: s, unset: i } = qn();
434
+ function It({ action: e, name: t, ref: n, ...o }) {
435
+ const { getAction: s } = j(), { set: i, unset: a } = Gn();
432
436
  t ??= [e.action.entity, e.action.name, e.action.namespace].join("-");
433
- const a = r(e.action.entity, e.action.name, e.action.namespace);
434
- if (!a)
435
- throw new Error("Invalid Current Action");
437
+ const c = s(e.action.entity, e.action.name, e.action.namespace);
438
+ if (!c)
439
+ throw console.log("Invalid Action", e), new Error("Invalid Current Action");
436
440
  e = {
437
441
  ...e,
438
- action: a
442
+ action: c
439
443
  };
440
- const [l, c] = R(1), [u, g] = R(e), h = {
441
- action: u,
442
- setAction: g,
443
- refresh: () => {
444
- c(Date.now());
445
- }
444
+ const u = () => {
445
+ p(Date.now());
446
+ };
447
+ ue(n, () => ({
448
+ refresh: u
449
+ }), []);
450
+ const [m, p] = R(1), [f, y] = R(e), E = {
451
+ action: f,
452
+ setAction: y,
453
+ refresh: u
446
454
  };
447
455
  return N(() => {
448
- g({ ...e, query: { ...e.query, _ts: l } });
449
- }, [l]), N(() => {
450
- g(e);
451
- }, [JSON.stringify(e)]), N(() => (s(t, h), () => {
452
- i(t);
453
- }), []), /* @__PURE__ */ o(St.Provider, { value: h, children: /* @__PURE__ */ o(Bn, { namespace: u.action.namespace || "", children: n.children }) });
456
+ y({ ...e, query: { ...e.query, _ts: m } });
457
+ }, [m]), N(() => {
458
+ y(e);
459
+ }, [JSON.stringify(e)]), N(() => (i(t, E), () => {
460
+ a(t);
461
+ }), []), /* @__PURE__ */ r(Tt.Provider, { value: E, children: /* @__PURE__ */ r(Hn, { namespace: f.action.namespace || "", children: o.children }) });
454
462
  }
455
- const ko = ({ path: e, preloader: t }) => {
456
- if (!H.namespace[Je])
457
- throw new mt(500, "Invalid Configuration.");
458
- const { link: n } = le(), { getOnClickActionByPath: r, actions: s } = T(), [i, a] = R(void 0);
463
+ const Io = ({ path: e, preloader: t }) => {
464
+ if (!K.namespace[Ze])
465
+ throw new gt(500, "Invalid Configuration.");
466
+ const { link: n } = ee(), { getOnClickActionByPath: o, actions: s } = j(), [i, a] = R(void 0);
459
467
  return e ??= n?.path ?? location.pathname + location.search, n?.prefix && (e = e.replace(new RegExp("^/" + n.prefix.replace(new RegExp("^/"), "") + "(/)?"), "/")), N(() => {
460
- a(r(e));
468
+ a(o(e));
461
469
  }, [e, JSON.stringify(s)]), N(() => {
462
470
  if (i === null)
463
- throw new Be(404, "Not Found");
464
- }, [i]), i === void 0 ? t ?? /* @__PURE__ */ o(P, { children: "Loading" }) : i === null ? null : /* @__PURE__ */ o(Rt, { action: i, children: /* @__PURE__ */ o(Dt, { children: /* @__PURE__ */ o(yn, { view: i.action.name }) }) });
465
- }, kt = v.createContext(null);
466
- function te() {
467
- return v.useContext(kt);
471
+ throw new qe(404, "Not Found");
472
+ }, [i]), i === void 0 ? t ?? /* @__PURE__ */ r(A, { children: "Loading" }) : i === null ? null : /* @__PURE__ */ r(It, { action: i, children: /* @__PURE__ */ r(Ft, { children: /* @__PURE__ */ r(xn, { view: i.action.name }) }) });
473
+ }, jt = v.createContext(null);
474
+ function ne() {
475
+ return v.useContext(jt);
468
476
  }
469
- const Hn = ({
477
+ const Yn = ({
470
478
  path: e,
471
479
  method: t,
472
480
  body: n,
473
- bodyType: r,
481
+ bodyType: o,
474
482
  loadOnInit: s = !0
475
483
  }) => {
476
- const i = O(s), { navigate: a, externalToInternalPath: l, internalToExternalPath: c } = T(), [u, g] = R(), h = O(null), [y, E] = R(1);
477
- e = l(e);
478
- const C = Ln(() => {
484
+ const i = S(s), { navigate: a, externalToInternalPath: c, internalToExternalPath: u } = j(), [m, p] = R(), f = S(null), [y, E] = R(1), _ = JSON.stringify(n instanceof FormData ? Be(n) : n);
485
+ e = c(e);
486
+ const b = kn(() => {
479
487
  if (!i.current) {
480
488
  i.current = !0;
481
489
  return;
482
490
  }
483
- return h.current = new AbortController(), ce().fetch({
491
+ return f.current = new AbortController(), le().fetch({
484
492
  url: e,
485
- method: t || Ve.GET,
493
+ method: t || $e.GET,
486
494
  body: n,
487
- signal: h.current?.signal
488
- }).then(({ data: m, response: d }) => {
489
- if (d.redirected && !["cors"].includes(d.type)) {
490
- const b = c(new URL(d.url).pathname);
491
- a(b);
495
+ signal: f.current?.signal
496
+ }).then(({ data: d, response: g }) => {
497
+ if (g.redirected && !["cors"].includes(g.type)) {
498
+ const h = u(new URL(g.url).pathname);
499
+ a(h);
492
500
  return;
493
501
  }
494
- if (g({ data: m, response: d }), [401, 403, 404, 500].includes(d.status))
495
- throw new Be(d.status, d.statusText || "Error", m);
502
+ if (p({ data: d, response: g }), [401, 403, 404, 500].includes(g.status))
503
+ throw new qe(g.status, g.statusText || "Error", d);
496
504
  }).finally(() => {
497
505
  }), () => {
498
506
  i.current = s;
499
507
  };
500
- }, [y, e, n, r, t]);
508
+ }, [y, e, _, o, t]);
501
509
  N(() => () => {
502
- f(), i.current = s;
510
+ l(), i.current = s;
503
511
  }, []), N(() => {
504
- C();
505
- }, [y, e, n, r, t]);
506
- const f = () => {
507
- h.current?.abort("canceled"), h.current = null;
512
+ b();
513
+ }, [y, e, _, o, t]);
514
+ const l = () => {
515
+ f.current?.abort("canceled"), f.current = null;
508
516
  };
509
517
  return {
510
518
  url: e,
511
- status: u?.response.status || 0,
512
- results: u?.data,
513
- response: u?.response,
519
+ status: m?.response.status || 0,
520
+ results: m?.data,
521
+ response: m?.response,
514
522
  refresh: () => {
515
523
  E(Date.now());
516
524
  },
517
- cancel: f
525
+ cancel: l
518
526
  };
519
- }, Kn = ({
527
+ }, Wn = ({
520
528
  action: e,
521
529
  loadOnInit: t = !0
522
530
  }) => {
523
- const { generateActionLink: n } = T(), r = n(e);
524
- return Hn({ path: r, method: e.method, body: e.body, bodyType: e.bodyType, loadOnInit: t });
525
- }, Dt = ({ suspense: e, children: t }) => {
526
- const { action: n } = ee(), { generateActionLink: r } = T(), s = te(), i = r(n);
531
+ const { generateActionLink: n } = j(), o = n(e);
532
+ return Yn({ path: o, method: e.method, body: e.body, bodyType: e.bodyType, loadOnInit: t });
533
+ }, Ft = ({ suspense: e, children: t }) => {
534
+ const { action: n } = te(), { generateActionLink: o } = j(), s = ne(), i = o(n);
527
535
  if (s?.url === i)
528
536
  return t;
529
- const a = Kn({
537
+ const a = Wn({
530
538
  action: n
531
539
  });
532
- return e ??= /* @__PURE__ */ o(P, { children: "Data Loading" }), /* @__PURE__ */ o(kt.Provider, { value: a, children: e && !a?.results ? e : t });
540
+ return e ??= /* @__PURE__ */ r(A, { children: "Data Loading" }), /* @__PURE__ */ r(jt.Provider, { value: a, children: e && !a?.results ? e : t });
533
541
  };
534
- function Tt(e) {
535
- return (t) => /* @__PURE__ */ o(Dt, { children: /* @__PURE__ */ o(e, { ...t }) });
542
+ function Mt(e) {
543
+ return (t) => /* @__PURE__ */ r(Ft, { children: /* @__PURE__ */ r(e, { ...t }) });
536
544
  }
537
- const U = ({ children: e, domain: t, properties: n }) => (n ??= {}, Object.keys(n).forEach((r) => {
538
- e = e?.replaceAll(new RegExp(":" + r, "g"), n[r]?.toString() || "");
539
- }), e = e?.replaceAll(new RegExp(":w+", "g"), ""), /* @__PURE__ */ o(P, { children: e })), Do = (e) => {
545
+ const jo = (e) => {
540
546
  const t = new RegExp("(?<=.)[^@\\n](?=[^@\\n]*?@)|(?:(?<=@.)|(?!^)\\G(?=[^@\\n]*$)).(?=.*[^@\\n]\\.)", "i");
541
547
  return e.replace(t, "*");
542
- }, Se = (e) => e.replace(new RegExp("^.{1,1}"), (t) => t.toUpperCase()), Gn = (e) => {
543
- let t = e.replace(new RegExp("[-_]", "gi"), " ").split(new RegExp("(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])"));
544
- const n = t.shift(), r = t.pop();
545
- return t = t.map((s) => s.toLowerCase()), n && t.unshift(Se(n)), r && t.push(Se(r)), t.join(" ");
546
- }, Yn = ({ children: e }) => /* @__PURE__ */ o(P, { children: e }), It = v.createContext(void 0);
547
- function Wn() {
548
- return v.useContext(It);
548
+ }, ke = (e) => e.replace(new RegExp("^.{1,1}"), (t) => t.toUpperCase()), zn = (e) => {
549
+ let t = e?.replace(new RegExp("[-_]", "gi"), " ").split(new RegExp("(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])"));
550
+ if (!t?.length)
551
+ return null;
552
+ const n = t.shift(), o = t.pop();
553
+ return t = t.map((s) => s.toLowerCase()), n && t.unshift(ke(n)), o && t.push(ke(o)), t.join(" ");
554
+ }, Jn = ({ children: e }) => /* @__PURE__ */ r(A, { children: e }), Ut = v.createContext(void 0);
555
+ function Qn() {
556
+ return v.useContext(Ut);
549
557
  }
550
- const F = Z(({ view: e, prefix: t, namespace: n, children: r, props: s, data: i }) => {
551
- const { templates: a } = le(), l = Wn(), [c, u] = R(1), g = O(Yn);
552
- n ??= Lt(), e instanceof Array || (e = [e]), e = e.map((f) => f.split(/[._]/).filter((m) => m).map((m) => Se(m)).join(""));
553
- const h = [
554
- ...e.map((f) => ["crud", n, t, f].filter((m) => m).join("/") + ".tsx"),
555
- ...e.map((f) => ["crud", "general", t, f].filter((m) => m).join("/") + ".tsx")
556
- ], [y, E, C] = h.reduce((f, m) => {
557
- if (f)
558
- return f;
559
- const [, d] = Object.entries(a ?? {}).filter(([p]) => p.endsWith(m)).shift() || [], b = l?.template === m && l?.isImported;
560
- return d !== void 0 ? [m, b, d] : null;
558
+ const U = X(({ view: e, prefix: t, namespace: n, children: o, props: s, data: i }) => {
559
+ const { templates: a } = ee(), c = Qn(), [u, m] = R(1), p = S(Jn);
560
+ n ??= Dt(), e instanceof Array || (e = [e]), e = e.map((b) => b.split(/[._]/).filter((l) => l).map((l) => ke(l)).join(""));
561
+ const f = [
562
+ ...e.map((b) => ["crud", n, t, b].filter((l) => l).join("/") + ".tsx"),
563
+ ...e.map((b) => ["crud", "general", t, b].filter((l) => l).join("/") + ".tsx")
564
+ ], [y, E, _] = f.reduce((b, l) => {
565
+ if (b)
566
+ return b;
567
+ const [, d] = Object.entries(a ?? {}).filter(([h]) => h.endsWith(l)).shift() || [], g = c?.template === l && c?.isImported;
568
+ return d !== void 0 ? [l, g, d] : null;
561
569
  }, null) || [!1, void 0];
562
570
  return N(() => {
563
571
  if (!E) {
564
- if (C === void 0)
572
+ if (_ === void 0)
565
573
  return () => {
566
574
  };
567
- C().then((f) => {
568
- g.current = f.default, u(c + 1);
575
+ _().then((b) => {
576
+ p.current = b.default, m(u + 1);
569
577
  });
570
578
  }
571
- }, []), E || !y ? r : /* @__PURE__ */ o(It.Provider, { value: {
579
+ }, []), E || !y ? o : /* @__PURE__ */ r(Ut.Provider, { value: {
572
580
  template: y,
573
- parent: r,
581
+ parent: o,
574
582
  data: i,
575
583
  view: e,
576
584
  namespace: n,
577
- isImported: !!C
578
- }, children: /* @__PURE__ */ o(g.current, { ...s }) });
579
- }), jt = v.createContext(void 0);
580
- function zn() {
581
- return v.useContext(jt);
585
+ isImported: !!_
586
+ }, children: /* @__PURE__ */ r(p.current, { ...s }) });
587
+ }), D = ({ children: e, domain: t, properties: n, ...o }) => typeof e != "string" ? null : (n ??= {}, Object.keys(n).forEach((s) => {
588
+ e = e?.replaceAll(new RegExp(":" + s, "g"), n[s]?.toString() || "");
589
+ }), e = e?.replaceAll(new RegExp(":w+", "g"), ""), /* @__PURE__ */ r(
590
+ U,
591
+ {
592
+ view: "Translation",
593
+ props: { ...o, domain: t, properties: n },
594
+ children: e
595
+ }
596
+ )), Vt = v.createContext(void 0);
597
+ function Zn() {
598
+ return v.useContext(Vt);
582
599
  }
583
- function Jn({ id: e, view: t, children: n }) {
584
- return /* @__PURE__ */ o(jt.Provider, { value: { id: e, view: t }, children: n });
600
+ function Xn({ id: e, view: t, children: n }) {
601
+ return /* @__PURE__ */ r(Vt.Provider, { value: { id: e, view: t }, children: n });
585
602
  }
586
- const To = ({
603
+ const Fo = ({
587
604
  name: e,
588
605
  optional: t
589
606
  // Stop throwing error when Form View is missing.
590
607
  }) => {
591
- const { form: n } = V(), r = e ? n?.children?.[e] : n;
592
- if (!r) {
608
+ const { form: n } = B(), o = e ? n?.children?.[e] : n;
609
+ if (!o) {
593
610
  if (t)
594
611
  return null;
595
612
  throw new Error("Missing Provided Form View to Form Group" + (e ? ": " + e : ""));
596
613
  }
597
- return /* @__PURE__ */ o(ne, { view: r, children: /* @__PURE__ */ o(me, {}) });
598
- }, Ft = v.createContext(void 0), Mt = () => v.useContext(Ft), Io = ({ children: e, ...t }) => /* @__PURE__ */ o(Ft.Provider, { value: t, children: e }), Re = ({
614
+ return /* @__PURE__ */ r(re, { view: o, children: /* @__PURE__ */ r(pe, {}) });
615
+ }, Bt = v.createContext(void 0), $t = () => v.useContext(Bt), Mo = ({ children: e, ...t }) => /* @__PURE__ */ r(Bt.Provider, { value: t, children: e }), De = ({
599
616
  view: e,
600
617
  className: t
601
618
  }) => {
602
- const r = Mt()?.label || e.label || Gn(e.name || ""), s = ["checkbox", "radio"].includes(e.type || "input");
603
- return /* @__PURE__ */ o(P, { children: s ? /* @__PURE__ */ o(
619
+ const o = $t()?.label || e.label || zn(e.name || "") || "", s = ["checkbox", "radio"].includes(e.type || "input");
620
+ return /* @__PURE__ */ r(A, { children: s ? /* @__PURE__ */ r(
604
621
  "label",
605
622
  {
606
623
  className: t ?? "form-check-label",
607
- htmlFor: e.id || Ce(e.full_name || ""),
624
+ htmlFor: e.id || _e(e.full_name || ""),
608
625
  ...e.label_attr && (e.label_attr instanceof Function ? e.label_attr() : e.label_attr),
609
- children: r
626
+ children: /* @__PURE__ */ r(D, { children: o })
610
627
  }
611
- ) : /* @__PURE__ */ o(
628
+ ) : /* @__PURE__ */ r(
612
629
  "label",
613
630
  {
614
631
  className: t ?? "form-label",
615
632
  ...e.label_attr && (e.label_attr instanceof Function ? e.label_attr() : e.label_attr),
616
- children: r
633
+ children: /* @__PURE__ */ r(D, { children: o })
617
634
  }
618
635
  ) });
619
- }, Qn = ({
636
+ }, er = ({
620
637
  name: e
621
638
  }) => {
622
- const { form: t } = V(), n = e ? t.children?.[e] : t;
639
+ const { form: t } = B(), n = e ? t.children?.[e] : t;
623
640
  if (!n)
624
641
  throw new Error("Missing Form View for FormField" + (e ? ": " + e : ""));
625
- return /* @__PURE__ */ o(P, { children: n.help && /* @__PURE__ */ o(
642
+ return /* @__PURE__ */ r(A, { children: n.help && /* @__PURE__ */ r(
626
643
  "div",
627
644
  {
628
645
  className: "form-text",
@@ -630,60 +647,73 @@ const To = ({
630
647
  children: n.help
631
648
  }
632
649
  ) });
633
- }, Ut = ({ view: e, choice: t }) => /* @__PURE__ */ o(
634
- "option",
635
- {
636
- value: t.value || t.label,
637
- ...t.attr && (t.attr instanceof Function ? t.attr(t) : t.attr),
638
- children: t.label
639
- }
640
- ), Zn = ({ view: e, group: t }) => /* @__PURE__ */ o("optgroup", { label: t.label, children: Object.values(t.choices).map((n, r) => /* @__PURE__ */ o(Ut, { view: e, choice: n }, r)) }), ke = ({
650
+ }, qt = ({ view: e, choice: t }) => {
651
+ const n = t.label instanceof Function ? t.label(t) : t.label;
652
+ return /* @__PURE__ */ r(
653
+ "option",
654
+ {
655
+ value: t.value || n,
656
+ ...t.attr && (t.attr instanceof Function ? t.attr(t) : t.attr),
657
+ children: /* @__PURE__ */ r(D, { children: n })
658
+ }
659
+ );
660
+ }, tr = ({ view: e, group: t }) => /* @__PURE__ */ r("optgroup", { label: t.label, children: Object.values(t.choices).map((n, o) => /* @__PURE__ */ r(qt, { view: e, choice: n }, o)) }), Re = ({
641
661
  view: e,
642
662
  choice: t,
643
663
  choiceValueTransform: n,
644
- choiceLabelTransform: r
664
+ choiceLabelTransform: o
645
665
  }) => {
646
- const s = e.full_name, i = n ? n(t) : t.value, a = r ? r(t) : t.label || i, l = Ce(s || "", i), c = {
647
- id: l,
648
- ...t?.attr && (t?.attr instanceof Function ? t?.attr(t) : t?.attr)
649
- };
650
- return /* @__PURE__ */ _("div", { className: "form-check", children: [
651
- /* @__PURE__ */ o(
666
+ const s = e.full_name, i = n ? n(t) : t.value, a = o ? o(t) : t.label || i, c = _e(s || "", i), u = {
667
+ ...(e.label_attr instanceof Function ? e.label_attr() : e.label_attr) || {}
668
+ }, m = {
669
+ id: c,
670
+ ...(e.choice_attr instanceof Function ? e.choice_attr(e) : e.choice_attr) || {}
671
+ }, p = e.checked instanceof Function ? e.checked(i) : e.checked;
672
+ return /* @__PURE__ */ C(A, { children: [
673
+ /* @__PURE__ */ r(
652
674
  "input",
653
675
  {
654
676
  defaultValue: i,
655
677
  type: e?.multiple ? "checkbox" : "radio",
656
678
  defaultChecked: e?.data?.includes(i),
657
- name: s + (e?.multiple ? "[]" : ""),
658
- id: l,
679
+ name: (s || "") + (e?.multiple ? "[]" : ""),
680
+ id: c,
659
681
  className: "form-check-input",
660
- ...c
682
+ ...m,
683
+ checked: p
661
684
  }
662
685
  ),
663
- /* @__PURE__ */ o(
686
+ /* @__PURE__ */ r(
664
687
  "label",
665
688
  {
666
- htmlFor: c.id,
689
+ htmlFor: m.id,
667
690
  className: "form-check-label",
668
- children: a
691
+ ...u,
692
+ children: /* @__PURE__ */ r(D, { children: a })
669
693
  }
670
694
  )
671
695
  ] });
672
- }, Xn = ({ view: e, group: t, ...n }) => /* @__PURE__ */ _("div", { className: "form-group", children: [
673
- /* @__PURE__ */ o("label", { className: "form-label", children: t.label }),
674
- Object.values(t.choices).map((r, s) => /* @__PURE__ */ o(ke, { view: e, choice: r, ...n }, s))
675
- ] }), er = ({
696
+ }, nr = ({ view: e, group: t, ...n }) => /* @__PURE__ */ C("div", { className: "form-group", children: [
697
+ /* @__PURE__ */ r("label", { className: "form-label", children: t.label }),
698
+ Object.values(t.choices).map((o, s) => /* @__PURE__ */ r(Re, { view: e, choice: o, ...n }, s))
699
+ ] }), rr = ({
676
700
  view: e,
677
701
  constraints: t,
678
702
  className: n,
679
- onChange: r,
703
+ onChange: o,
680
704
  choiceValueTransform: s,
681
705
  choiceLabelTransform: i
682
706
  }) => {
683
707
  t = t || [];
684
- const a = e.full_name, [[l, c], u] = de(), h = !!(l?.errors[a || ""] || []).length, y = btoa(encodeURIComponent(e.full_name + JSON.stringify(e.data)));
708
+ const a = e.full_name, [[c, u], m] = me(), f = !!(c?.errors[a || ""] || []).length, y = {
709
+ ...(e.attr instanceof Function ? e.attr() : e.attr) || {}
710
+ }, E = btoa(encodeURIComponent(e.full_name + JSON.stringify(e.data))), _ = [
711
+ ...(y.class || "").split(" ") || [],
712
+ ...(n || "").split(" ") || [],
713
+ ...f ? ["is-invalid"] : []
714
+ ];
685
715
  N(() => {
686
- c({
716
+ u({
687
717
  action: "constraints",
688
718
  payload: {
689
719
  name: e.full_name,
@@ -691,214 +721,216 @@ const To = ({
691
721
  }
692
722
  });
693
723
  }, []);
694
- const E = (C) => {
695
- c({ action: "validate", payload: e.full_name }), r && r(C);
724
+ const b = (l) => {
725
+ u({ action: "validate", payload: e.full_name }), o && o(l);
696
726
  };
697
- return e?.expanded ? /* @__PURE__ */ _("div", { className: [...h ? ["is-invalid"] : []].join(" "), children: [
698
- typeof e.placeholder == "string" && /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(
699
- ke,
727
+ return e?.expanded ? /* @__PURE__ */ C(A, { children: [
728
+ typeof e.placeholder == "string" && /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(
729
+ Re,
700
730
  {
701
731
  view: e,
702
732
  choice: { label: e.placeholder, value: null }
703
733
  }
704
734
  ) }),
705
735
  Object.values(e.choices || []).map(
706
- (C, f) => /* @__PURE__ */ o(Oe, { children: C.choices !== void 0 ? /* @__PURE__ */ o(
707
- Xn,
736
+ (l, d) => /* @__PURE__ */ r(Se, { children: l.choices !== void 0 ? /* @__PURE__ */ r(
737
+ nr,
708
738
  {
709
739
  view: e,
710
- group: C,
740
+ group: l,
711
741
  choiceLabelTransform: i,
712
742
  choiceValueTransform: s
713
743
  }
714
- ) : /* @__PURE__ */ o(
715
- ke,
744
+ ) : /* @__PURE__ */ r("div", { className: "form-check", ...y, children: /* @__PURE__ */ r(
745
+ Re,
716
746
  {
717
747
  view: e,
718
- choice: C,
748
+ choice: l,
719
749
  choiceLabelTransform: i,
720
750
  choiceValueTransform: s
721
751
  }
722
- ) }, f)
752
+ ) }) }, d)
723
753
  )
724
- ] }) : /* @__PURE__ */ _(
754
+ ] }) : /* @__PURE__ */ C(
725
755
  "select",
726
756
  {
727
757
  name: a,
728
758
  multiple: e.multiple,
729
- "aria-invalid": h,
730
- onChange: (C) => E({
731
- value: (e.multiple ? u?.current?.getFormData().getAll(a) : u?.current?.getFormData().get(a)) || C.target.value
759
+ "aria-invalid": f,
760
+ onChange: (l) => b({
761
+ value: (e.multiple ? m?.current?.getFormData().getAll(a) : m?.current?.getFormData().get(a)) || l.target.value
732
762
  }),
733
- className: [...(n || "").split(" ") || [], "form-control", ...h ? ["is-invalid"] : []].join(" "),
763
+ className: [..._, "form-select"].join(" "),
734
764
  ...e.attr && (e.attr instanceof Function ? e.attr() : e.attr),
735
765
  defaultValue: e.data,
736
766
  children: [
737
- e.placeholder && /* @__PURE__ */ o("option", { value: "", children: e.placeholder }),
738
- Object.values(e.choices || []).map((C, f) => /* @__PURE__ */ o(Oe, { children: C.choices !== void 0 ? /* @__PURE__ */ o(Zn, { view: e, group: C }) : /* @__PURE__ */ o(Ut, { view: e, choice: C }) }, f))
767
+ e.placeholder && /* @__PURE__ */ r("option", { value: "", children: /* @__PURE__ */ r(D, { children: e.placeholder }) }),
768
+ Object.values(e.choices || []).map((l, d) => /* @__PURE__ */ r(Se, { children: l.choices !== void 0 ? /* @__PURE__ */ r(tr, { view: e, group: l }) : /* @__PURE__ */ r(qt, { view: e, choice: l }) }, d))
739
769
  ]
740
770
  },
741
- y
771
+ E
742
772
  );
743
- }, tr = ({
773
+ }, or = ({
744
774
  view: e,
745
775
  constraints: t,
746
- onChange: n
776
+ onChange: n,
777
+ ref: o
747
778
  }) => {
748
- const r = e.full_name, [[s, i]] = de(), a = O(null), l = s?.errors[r || ""] || [];
779
+ const s = e.full_name, [[i, a]] = me(), c = i?.errors[s || ""] || [];
749
780
  N(() => {
750
- i({
781
+ a({
751
782
  action: "constraints",
752
783
  payload: {
753
- name: r,
784
+ name: s,
754
785
  constraints: t || []
755
786
  }
756
787
  });
757
788
  }, []);
758
- const c = (m) => {
759
- i({ action: "validate", payload: r }), n && n(m);
760
- }, g = ["checkbox", "radio"].includes(e.type) ? "form-check-input" : "form-control", h = btoa(encodeURIComponent(r + JSON.stringify(e.data))), y = (e.attr instanceof Function ? e.attr() : e.attr) || {}, E = Mt();
761
- let C = e.type, f = e.data;
762
- if ([A.Date, A.Birthday, A.Datetime].includes(C)) {
763
- const m = f?.date ? new Date(f.date) : null;
764
- if (m) {
765
- const d = m.getTimezoneOffset() * 6e4;
766
- f = new Date(m.getTime() - d).toISOString().split("T").shift();
789
+ const u = (l) => {
790
+ a({ action: "validate", payload: s }), n && n(l);
791
+ }, p = ["checkbox", "radio"].includes(e.type) ? "form-check-input" : "form-control", f = btoa(encodeURIComponent(s + JSON.stringify(e.data))), y = (e.attr instanceof Function ? e.attr() : e.attr) || {}, E = $t();
792
+ let _ = e.type, b = e.data;
793
+ if ([w.Date, w.Birthday, w.Datetime].includes(_)) {
794
+ const l = b?.date ? new Date(b.date) : null;
795
+ if (l) {
796
+ const d = l.getTimezoneOffset() * 6e4;
797
+ b = new Date(l.getTime() - d).toISOString().split("T").shift();
767
798
  }
768
- C = C === A.Datetime ? "datetime-local" : "date";
799
+ _ = _ === w.Datetime ? "datetime-local" : "date";
769
800
  }
770
- return /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(
801
+ return /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(
771
802
  "input",
772
803
  {
773
- ref: a,
804
+ ref: o,
774
805
  id: e.id,
775
- name: r,
776
- type: C,
777
- defaultValue: f,
778
- "aria-invalid": !l.length,
779
- onKeyUp: (m) => c({ value: m.target.value }),
780
- onChange: (m) => c({ value: m.target.value }),
806
+ name: s,
807
+ type: _,
808
+ defaultValue: b,
809
+ "aria-invalid": !c.length,
810
+ onInput: (l) => {
811
+ y.onChange instanceof Function && y.onChange(l), !l.defaultPrevented && u({ value: l.target.value });
812
+ },
781
813
  className: E?.className || [
782
- g,
814
+ p,
783
815
  E?.size ? "form-control-" + E.size : null,
784
816
  E?.extraClassName,
785
- ...l.length ? ["is-invalid"] : []
786
- ].filter((m) => m).join(" "),
817
+ ...c.length ? ["is-invalid"] : []
818
+ ].filter((l) => l).join(" "),
787
819
  defaultChecked: e?.checked,
788
820
  placeholder: E?.placeholder || e?.placeholder || void 0,
789
821
  ...y,
790
822
  ...y.inputmode === "decimal" && { step: "any" }
791
823
  },
792
- h
824
+ f
793
825
  ) });
794
- }, Vt = v.createContext({
826
+ }, Ht = v.createContext({
795
827
  requests: []
796
828
  });
797
- function nr(e) {
798
- const t = v.useContext(Vt);
829
+ function sr(e) {
830
+ const t = v.useContext(Ht);
799
831
  if (t === void 0)
800
832
  throw new Error("UseLoaderIndicator must be within DataLoaderIndicatorProvider");
801
- const { requests: n } = t, { matchPath: r, getActionByPath: s, generateActionLink: i } = T();
833
+ const { requests: n } = t, { matchPath: o, getActionByPath: s, generateActionLink: i } = j();
802
834
  let a = null;
803
835
  if (e) {
804
- const c = s(e?.toString() ?? "");
805
- if (c) {
806
- const u = dt(new URL(e, location.origin).searchParams), { params: g } = r(c.route?.path || "", e) ?? { params: void 0 };
807
- a = i({ action: c, parameters: { ...g, ...u } });
836
+ const u = s(e?.toString() ?? "");
837
+ if (u) {
838
+ const m = pt(new URL(e, location.origin).searchParams), { params: p } = o(u.route?.path || "", e) ?? { params: void 0 };
839
+ a = i({ action: u, parameters: p, query: m });
808
840
  }
809
841
  }
810
842
  return {
811
- isLoading: a ? !!n.filter((c) => c.url === a).length : !1
843
+ isLoading: a ? !!n.filter((u) => u.url === a).length : !1
812
844
  };
813
845
  }
814
- function rr({ ...e }) {
815
- const [t, n] = Y((r, s) => {
816
- const { action: i, requestId: a, url: l } = s, c = new URL(l), u = c.toString().replace(c.origin, "");
817
- switch (r = { requests: r.requests.filter((g) => g.requestId !== a) }, i) {
846
+ function ir({ ...e }) {
847
+ const [t, n] = W((o, s) => {
848
+ const { action: i, requestId: a, url: c } = s, u = new URL(c), m = u.toString().replace(u.origin, "");
849
+ switch (o = { requests: o.requests.filter((p) => p.requestId !== a) }, i) {
818
850
  case "cancel":
819
851
  case "complete":
820
852
  break;
821
853
  default:
822
- r.requests.push({ url: u, requestId: a }), r = { requests: r.requests };
854
+ o.requests.push({ url: m, requestId: a }), o = { requests: o.requests };
823
855
  }
824
- return r;
856
+ return o;
825
857
  }, { requests: [] });
826
858
  return N(() => {
827
- const r = H.on(xe.PRE_REQUEST, (a, l, c) => {
828
- n({ action: "load", requestId: a, url: l.toString() });
829
- }), s = H.on(xe.POST_RESPONSE, (a, l, c, u) => {
830
- n({ action: "complete", requestId: a, url: c.toString() });
831
- }), i = H.on(xe.ERROR, (a, l, c, u) => {
832
- n({ action: "cancel", requestId: a, url: c.toString() });
859
+ const o = K.on(Ne.PRE_REQUEST, (a, c, u) => {
860
+ n({ action: "load", requestId: a, url: c.toString() });
861
+ }), s = K.on(Ne.POST_RESPONSE, (a, c, u, m) => {
862
+ n({ action: "complete", requestId: a, url: u.toString() });
863
+ }), i = K.on(Ne.ERROR, (a, c, u, m) => {
864
+ n({ action: "cancel", requestId: a, url: u.toString() });
833
865
  });
834
866
  return () => {
835
- H.off(r).off(s).off(i);
867
+ K.off(o).off(s).off(i);
836
868
  };
837
- }, []), /* @__PURE__ */ o(Vt.Provider, { value: t, children: e.children });
869
+ }, []), /* @__PURE__ */ r(Ht.Provider, { value: t, children: e.children });
838
870
  }
839
- const j = ({ to: e, children: t, onClick: n, ...r }) => {
840
- const { navigate: s } = T(), i = O(null), [a, l] = R(!1), { isLoading: c } = nr(e?.toString()), u = (h) => {
841
- if (c) {
842
- h.preventDefault(), h.stopPropagation();
871
+ const M = ({ to: e, children: t, onClick: n, ...o }) => {
872
+ const { navigate: s } = j(), i = S(null), [a, c] = R(!1), { isLoading: u } = sr(e?.toString()), m = (f) => {
873
+ if (u) {
874
+ f.preventDefault(), f.stopPropagation();
843
875
  return;
844
876
  }
845
- l(!0), n && n(h), !h.defaultPrevented && e && (h.preventDefault(), s(e.toString()));
877
+ c(!0), n && n(f), !f.defaultPrevented && e && (f.preventDefault(), s(e.toString()));
846
878
  };
847
879
  return N(() => {
848
- a && (c || l(!1));
849
- }, [c]), N(() => (i?.current?.addEventListener("click", u), () => {
850
- i?.current?.removeEventListener("click", u);
851
- }), [e, n]), /* @__PURE__ */ o("a", { ref: i, href: e, ...r, children: /* @__PURE__ */ o(xt, { preload: a && c, ...r, children: t }) });
852
- }, Bt = v.createContext(void 0), $t = () => {
853
- const e = v.useContext(Bt);
880
+ a && (u || c(!1));
881
+ }, [u]), N(() => (i?.current?.addEventListener("click", m), () => {
882
+ i?.current?.removeEventListener("click", m);
883
+ }), [e, n]), /* @__PURE__ */ r("a", { ref: i, href: e, ...o, children: /* @__PURE__ */ r(Pt, { preload: a && u, ...o, children: t }) });
884
+ }, Kt = v.createContext(void 0), Gt = () => {
885
+ const e = v.useContext(Kt);
854
886
  if (!e)
855
887
  throw new Error("UseCollection must be used within a Collection");
856
888
  return e;
857
- }, or = ({
889
+ }, ar = ({
858
890
  view: e
859
891
  }) => {
860
- const t = Object.keys(e.children || []), [n, r] = Y((l, c) => {
861
- const { action: u, value: g } = c;
862
- switch (u) {
892
+ const t = Object.keys(e.children || []), [n, o] = W((c, u) => {
893
+ const { action: m, value: p } = u;
894
+ switch (m) {
863
895
  case "delete": {
864
- if (g && typeof g != "string")
896
+ if (p && typeof p != "string")
865
897
  throw new Error("Invalid value. Should be a string.");
866
- l = [...l.filter((h) => h !== g)];
898
+ c = [...c.filter((f) => f !== p)];
867
899
  break;
868
900
  }
869
901
  case "set": {
870
- if (!(g instanceof Array))
902
+ if (!(p instanceof Array))
871
903
  throw new Error("Invalid value. Should be a array.");
872
- l = g;
904
+ c = p;
873
905
  break;
874
906
  }
875
907
  default: {
876
- if (g && typeof g != "string")
908
+ if (p && typeof p != "string")
877
909
  throw new Error("Invalid value. Should be a string.");
878
- const h = Math.floor(Math.random() * Date.now());
879
- l = [...l, h.toString()];
910
+ const f = Math.floor(Math.random() * Date.now());
911
+ c = [...c, f.toString()];
880
912
  }
881
913
  }
882
- return l;
883
- }, t), s = !!e.prototype, i = () => r({ action: "add" }), a = (l) => {
884
- r({ action: "delete", value: l });
914
+ return c;
915
+ }, t), s = !!e.prototype, i = () => o({ action: "add" }), a = (c) => {
916
+ o({ action: "delete", value: c });
885
917
  };
886
918
  return N(() => {
887
- r({ action: "set", value: t });
888
- }, [JSON.stringify(t)]), /* @__PURE__ */ o(Bt.Provider, { value: {
919
+ o({ action: "set", value: t });
920
+ }, [JSON.stringify(t)]), /* @__PURE__ */ r(Kt.Provider, { value: {
889
921
  addItem: i,
890
922
  removeItem: a,
891
923
  items: n,
892
924
  isPrototype: s
893
- }, children: /* @__PURE__ */ _(
894
- F,
925
+ }, children: /* @__PURE__ */ C(
926
+ U,
895
927
  {
896
928
  prefix: "modify/form",
897
929
  view: [...e.block_prefixes || [], e.name + ".collection"],
898
930
  children: [
899
- /* @__PURE__ */ o(sr, {}),
900
- s && /* @__PURE__ */ o(
901
- j,
931
+ /* @__PURE__ */ r(cr, {}),
932
+ s && /* @__PURE__ */ r(
933
+ M,
902
934
  {
903
935
  onClick: () => i(),
904
936
  className: "btn btn-outline-primary btn-sm",
@@ -909,89 +941,91 @@ const j = ({ to: e, children: t, onClick: n, ...r }) => {
909
941
  },
910
942
  e.full_name
911
943
  ) });
912
- }, sr = () => {
913
- const { items: e } = $t(), { form: t } = V(), n = !!t.prototype, r = (s) => {
944
+ }, cr = () => {
945
+ const { items: e } = Gt(), { form: t } = B(), n = !!t.prototype, o = (s, i) => {
914
946
  if (s.prototype_name) {
915
- const i = s.full_name?.replace("__name__", s.prototype_name || "") || "", a = (s.id || Ce(i)).replace("__name__", s.prototype_name || "");
916
- s.full_name = i, s.id = a, Object.keys(s.children || {}).map((l) => {
917
- const c = s.children?.[l];
918
- c !== void 0 && (c.prototype_name || (c.prototype_name = s.prototype_name, r(c)));
947
+ const a = s.full_name?.replace("__name__", s.prototype_name || "") || "", c = (s.id || _e(a)).replace("__name__", s.prototype_name || ""), u = s.label?.replace("__name__label__", i.toString()) || "";
948
+ s.full_name = a, s.id = c, s.label = s.label?.replace("__name__label__", u), Object.keys(s.children || {}).map((m, p) => {
949
+ const f = s.children?.[m];
950
+ f !== void 0 && (f.prototype_name || (f.prototype_name = s.prototype_name, o(f, p)));
919
951
  }, {});
920
952
  }
921
953
  };
922
- return /* @__PURE__ */ o(P, { children: e.map((s, i) => {
954
+ return /* @__PURE__ */ r(A, { children: e.map((s, i) => {
923
955
  const a = JSON.parse(JSON.stringify(t.children?.[s] ?? (t.prototype || t)));
924
- return a ? (t.children?.[s] === void 0 && (a.prototype_name = s), r(a), /* @__PURE__ */ o(ir, { index: i, view: a, isPrototype: n })) : null;
956
+ return a ? (t.children?.[s] === void 0 && (a.prototype_name = s), o(a, i), /* @__PURE__ */ r(lr, { index: i, view: a, isPrototype: n })) : null;
925
957
  }) });
926
- }, qt = v.createContext(void 0), jo = () => {
927
- const e = v.useContext(qt);
958
+ }, Yt = v.createContext(void 0), Uo = () => {
959
+ const e = v.useContext(Yt);
928
960
  if (!e)
929
961
  throw new Error("UseCollectionItem must be used within a CollectionItem");
930
962
  return e;
931
- }, ir = ({ view: e, index: t, isPrototype: n }) => {
932
- const { removeItem: r } = $t(), { form: s } = Yt() || { form: e }, i = e.prototype_name || e.name || "";
933
- return /* @__PURE__ */ o(ne, { view: e, allowDuplicates: n, children: /* @__PURE__ */ o(qt.Provider, { value: { index: t, removeItem: () => r(i) }, children: /* @__PURE__ */ o(
934
- F,
963
+ }, lr = ({ view: e, index: t, isPrototype: n }) => {
964
+ const { removeItem: o } = Gt(), { form: s } = Qt() || { form: e }, i = e.prototype_name || e.name || "";
965
+ return /* @__PURE__ */ r(re, { view: e, allowDuplicates: n, children: /* @__PURE__ */ r(Yt.Provider, { value: { index: t, removeItem: () => o(i) }, children: /* @__PURE__ */ r(
966
+ U,
935
967
  {
936
968
  prefix: "modify/form",
937
969
  view: [...e.block_prefixes || [], s.name + ".item"],
938
- children: /* @__PURE__ */ _("div", { className: "mb-3", children: [
939
- /* @__PURE__ */ o(Kt, { view: e }),
940
- n && /* @__PURE__ */ o(
941
- j,
970
+ children: /* @__PURE__ */ C("div", { className: "mb-3", children: [
971
+ /* @__PURE__ */ r(zt, { view: e }),
972
+ n && /* @__PURE__ */ r(
973
+ M,
942
974
  {
943
975
  to: "#",
944
- onClick: () => r(i),
976
+ onClick: () => o(i),
945
977
  className: "btn btn-outline-danger btn-sm",
946
- children: /* @__PURE__ */ o(U, { children: "Delete" })
978
+ children: /* @__PURE__ */ r(D, { children: "Delete" })
947
979
  }
948
980
  )
949
981
  ] })
950
982
  }
951
983
  ) }) });
952
- }, Xe = ({ view: e }) => {
984
+ }, rt = ({ view: e, ref: t }) => {
953
985
  switch (e.type) {
954
- case A.Entity:
955
- case A.Choice:
956
- case A.Enum:
957
- return /* @__PURE__ */ o(er, { view: e });
958
- case A.Collection:
959
- return /* @__PURE__ */ o(or, { view: e });
960
- case A.Hidden:
961
- case A.Input:
962
- case A.Money:
963
- case A.Text:
964
- case A.Tel:
965
- case A.Checkbox:
966
- case A.Radio:
967
- case A.Integer:
968
- case A.Number:
969
- case A.Password:
970
- case A.Datetime:
971
- case A.Date:
972
- case A.Birthday:
973
- case A.Time:
974
- case A.Email:
975
- return /* @__PURE__ */ o(tr, { view: e });
976
- case A.Repeated:
977
- case A.Form:
978
- return /* @__PURE__ */ o(me, {});
986
+ case w.Entity:
987
+ case w.Choice:
988
+ case w.Currency:
989
+ case w.Language:
990
+ case w.Enum:
991
+ return /* @__PURE__ */ r(rr, { view: e });
992
+ case w.Collection:
993
+ return /* @__PURE__ */ r(ar, { view: e });
994
+ case w.Hidden:
995
+ case w.Input:
996
+ case w.Money:
997
+ case w.Text:
998
+ case w.Tel:
999
+ case w.Checkbox:
1000
+ case w.Radio:
1001
+ case w.Integer:
1002
+ case w.Number:
1003
+ case w.Password:
1004
+ case w.Datetime:
1005
+ case w.Date:
1006
+ case w.Birthday:
1007
+ case w.Time:
1008
+ case w.Email:
1009
+ return /* @__PURE__ */ r(or, { view: e, ref: t });
1010
+ case w.Repeated:
1011
+ case w.Form:
1012
+ return /* @__PURE__ */ r(pe, {});
979
1013
  default:
980
1014
  throw new Error("Invalid view type: " + e.type);
981
1015
  }
982
- }, et = ({ name: e, options: t }) => {
983
- const { form: n } = V(), r = e ? n.children?.[e] : n;
984
- if (!r)
1016
+ }, ot = ({ name: e, options: t, ref: n }) => {
1017
+ const { form: o } = B(), s = e ? o.children?.[e] : o;
1018
+ if (!s)
985
1019
  throw new Error("Missing Form View for FormField" + (e ? ": " + e : ""));
986
- const s = { ...r, ...t || {} };
987
- return e !== void 0 ? /* @__PURE__ */ o(ne, { view: s, children: /* @__PURE__ */ o(Xe, { view: s }) }) : /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(Xe, { view: s }) });
988
- }, Ht = ({ name: e, className: t }) => {
989
- const [[n]] = de() || {};
1020
+ const i = { ...s, ...t || {} };
1021
+ return e !== void 0 ? /* @__PURE__ */ r(re, { view: i, children: /* @__PURE__ */ r(rt, { view: i, ref: n }) }) : /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(rt, { view: i, ref: n }) });
1022
+ }, Wt = ({ name: e, className: t }) => {
1023
+ const [[n]] = me() || {};
990
1024
  e = e instanceof Array ? e : [e];
991
- const r = [].concat(...e.map((s) => n?.errors[s] || []));
992
- return r.length ? /* @__PURE__ */ o("div", { className: t, children: /* @__PURE__ */ o("ul", { className: "mb-0", children: r.map((s, i) => /* @__PURE__ */ o("li", { children: s.message }, i)) }) }) : null;
993
- }, ar = ({ name: e, className: t }) => {
994
- const { form: n, getRootViewContext: r } = V(), s = e ? (e instanceof Array ? e : [e]).map((i) => {
1025
+ const o = [].concat(...e.map((s) => n?.errors[s] || []));
1026
+ return o.length ? /* @__PURE__ */ r("div", { className: t, children: /* @__PURE__ */ r("ul", { className: "mb-0", children: o.map((s, i) => /* @__PURE__ */ r("li", { children: s.message }, i)) }) }) : null;
1027
+ }, dr = ({ name: e, className: t }) => {
1028
+ const { form: n, getRootViewContext: o } = B(), s = e ? (e instanceof Array ? e : [e]).map((i) => {
995
1029
  const a = i ? n.children?.[i] : n;
996
1030
  if (!a)
997
1031
  throw new Error("Missing Form View for FormError: " + (i || ""));
@@ -999,98 +1033,98 @@ const j = ({ to: e, children: t, onClick: n, ...r }) => {
999
1033
  }) : [n];
1000
1034
  return N(() => {
1001
1035
  s.forEach((i) => {
1002
- i.full_name && r().setRenderedError(i.full_name);
1036
+ i.full_name && o().setRenderedError(i.full_name);
1003
1037
  });
1004
- }, []), /* @__PURE__ */ o(Ht, { name: s.map((i) => i.full_name || ""), className: t });
1005
- }, Kt = ({
1038
+ }, []), /* @__PURE__ */ r(Wt, { name: s.map((i) => i.full_name || ""), className: t });
1039
+ }, zt = ({
1006
1040
  view: e,
1007
1041
  className: t,
1008
1042
  size: n,
1009
- type: r
1043
+ type: o
1010
1044
  }) => {
1011
- const s = [A.Checkbox, A.Radio].includes(e.type);
1012
- return e.type = r || e.type, /* @__PURE__ */ o(P, { children: e.type === A.Hidden ? /* @__PURE__ */ o(et, {}) : /* @__PURE__ */ _(
1045
+ const s = [w.Checkbox, w.Radio].includes(e.type);
1046
+ return e.type = o || e.type, /* @__PURE__ */ r(A, { children: e.type === w.Hidden ? /* @__PURE__ */ r(ot, {}) : /* @__PURE__ */ C(
1013
1047
  "div",
1014
1048
  {
1015
- className: [...t?.split(" ") || [], "mb-3", s && "form-check"].filter((i) => i).join(" "),
1049
+ className: [...t?.split(" ") || [s ? "form-check" : "mb-3"]].filter((i) => i).join(" "),
1016
1050
  ...e.attr && (e.attr instanceof Function ? e.attr() : e.attr),
1017
1051
  children: [
1018
- !s && /* @__PURE__ */ o(Re, { view: e }),
1019
- /* @__PURE__ */ o(et, { size: n }),
1020
- s && /* @__PURE__ */ o(Re, { view: e }),
1021
- /* @__PURE__ */ o(ar, { className: "invalid-feedback" }),
1022
- /* @__PURE__ */ o(Qn, {})
1052
+ !s && /* @__PURE__ */ r(De, { view: e }),
1053
+ /* @__PURE__ */ r(ot, { size: n }),
1054
+ s && /* @__PURE__ */ r(De, { view: e }),
1055
+ /* @__PURE__ */ r(dr, { className: "invalid-feedback" }),
1056
+ /* @__PURE__ */ r(er, {})
1023
1057
  ]
1024
1058
  }
1025
1059
  ) });
1026
- }, me = Z(() => {
1027
- const e = Ee(), { form: t } = V();
1028
- return /* @__PURE__ */ o(Jn, { id: e, view: t, children: /* @__PURE__ */ o(
1029
- F,
1060
+ }, pe = X(() => {
1061
+ const e = Ce(), { form: t } = B();
1062
+ return /* @__PURE__ */ r(Xn, { id: e, view: t, children: /* @__PURE__ */ r(
1063
+ U,
1030
1064
  {
1031
- view: [t.name || "form", ...t.block_prefixes || []],
1065
+ view: [(t.name || "form") + "Field", ...t.block_prefixes || []],
1032
1066
  prefix: "modify/form",
1033
1067
  data: t,
1034
- children: [A.Form, A.Repeated].includes(t?.type) ? Object.values(t.children || []).map((n, r) => /* @__PURE__ */ o(Oe, { children: /* @__PURE__ */ o(ne, { view: n, children: /* @__PURE__ */ o(me, {}) }, r) }, r)) : /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(Kt, { view: t }) })
1068
+ children: [w.Form, w.Repeated].includes(t?.type) ? Object.values(t.children || []).map((n, o) => /* @__PURE__ */ r(Se, { children: /* @__PURE__ */ r(re, { view: n, children: /* @__PURE__ */ r(pe, {}) }, o) }, o)) : /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(zt, { view: t }) })
1035
1069
  }
1036
1070
  ) });
1037
- }), cr = () => /* @__PURE__ */ o(me, {}), lr = ({ className: e }) => {
1038
- const [[t]] = de() || {}, { getRootViewContext: n, getParentViewContext: r, getElements: s } = V(), a = (() => {
1039
- let c = Object.keys(s?.() || []), u = r?.() || null;
1040
- for (; u !== null; )
1041
- c = [
1042
- ...c,
1043
- ...Object.keys(u.getElements?.() || [])
1044
- ], u = u.getParentViewContext();
1045
- return c;
1046
- })(), l = Object.keys(t?.errors || []).filter((c) => a.includes(c)).filter((c) => !n().getRenderedErrors().includes(c));
1047
- return /* @__PURE__ */ o(Ht, { name: l, className: e });
1048
- }, De = v.createContext(void 0), $e = () => {
1049
- const e = v.useContext(De);
1071
+ }), ur = () => /* @__PURE__ */ r(pe, {}), mr = ({ className: e }) => {
1072
+ const [[t]] = me() || {}, { getRootViewContext: n, getParentViewContext: o, getElements: s } = B(), a = (() => {
1073
+ let u = Object.keys(s?.() || []), m = o?.() || null;
1074
+ for (; m !== null; )
1075
+ u = [
1076
+ ...u,
1077
+ ...Object.keys(m.getElements?.() || [])
1078
+ ], m = m.getParentViewContext();
1079
+ return u;
1080
+ })(), c = Object.keys(t?.errors || []).filter((u) => a.includes(u)).filter((u) => !n().getRenderedErrors().includes(u));
1081
+ return /* @__PURE__ */ r(Wt, { name: c, className: e });
1082
+ }, Te = v.createContext(void 0), He = () => {
1083
+ const e = v.useContext(Te);
1050
1084
  if (!e)
1051
1085
  throw new Error("UseTemplate must be used inside Template");
1052
1086
  return e;
1053
- }, dr = ({ name: e, children: t }) => {
1054
- const n = v.useContext(De), [r, s] = Y((i, a) => {
1087
+ }, fr = ({ name: e, children: t }) => {
1088
+ const n = v.useContext(Te), [o, s] = W((i, a) => {
1055
1089
  if (a.template && a.template !== e)
1056
1090
  return n?.dispatch(a), i;
1057
- const l = i[a.block] || [], c = a.element || null;
1091
+ const c = i[a.block] || [], u = a.element || null;
1058
1092
  if (a.action === "set") {
1059
- const u = l.find((g) => g.id === a.id);
1060
- u ? u.element = c : l.push({
1093
+ const m = c.find((p) => p.id === a.id);
1094
+ m ? m.element = u : c.push({
1061
1095
  id: a.id,
1062
- element: c
1096
+ element: u
1063
1097
  });
1064
1098
  } else
1065
- l.filter((u) => u.id === a.id).forEach((u) => {
1066
- u.element = null;
1099
+ c.filter((m) => m.id === a.id).forEach((m) => {
1100
+ m.element = null;
1067
1101
  });
1068
1102
  return {
1069
1103
  ...i,
1070
- [a.block]: l
1104
+ [a.block]: c
1071
1105
  };
1072
1106
  }, {});
1073
- return /* @__PURE__ */ o(De.Provider, { value: {
1107
+ return /* @__PURE__ */ r(Te.Provider, { value: {
1074
1108
  name: e,
1075
- blocks: r,
1076
- getBlock: (i, a) => a && a !== e ? n?.getBlock(i, a) : [...r[i] || []].pop()?.element,
1077
- getParent: (i) => [...r[i] || []].slice(-2).shift()?.element,
1109
+ blocks: o,
1110
+ getBlock: (i, a) => a && a !== e ? n?.getBlock(i, a) : [...o[i] || []].pop()?.element,
1111
+ getParent: (i) => [...o[i] || []].slice(-2).shift()?.element,
1078
1112
  dispatch: s
1079
1113
  }, children: t });
1080
- }, Gt = v.createContext(void 0), k = ({ name: e, template: t, children: n }) => {
1081
- const { getBlock: r } = $e(), s = r(e, t);
1082
- return /* @__PURE__ */ o(Gt.Provider, { value: { name: e, children: n }, children: s === void 0 ? n : s });
1083
- }, q = ({ name: e, template: t, children: n }) => {
1084
- const r = Ee(), { dispatch: s } = $e(), i = () => {
1114
+ }, Jt = v.createContext(void 0), T = ({ name: e, template: t, children: n }) => {
1115
+ const { getBlock: o } = He(), s = o(e, t);
1116
+ return /* @__PURE__ */ r(Jt.Provider, { value: { name: e, children: n }, children: s === void 0 ? n : s });
1117
+ }, H = ({ name: e, template: t, children: n }) => {
1118
+ const o = Ce(), { dispatch: s } = He(), i = () => {
1085
1119
  s({
1086
- id: r,
1120
+ id: o,
1087
1121
  action: "unset",
1088
1122
  template: t,
1089
1123
  block: e
1090
1124
  });
1091
1125
  };
1092
1126
  return N(() => (s({
1093
- id: r,
1127
+ id: o,
1094
1128
  action: "set",
1095
1129
  block: e,
1096
1130
  template: t,
@@ -1100,164 +1134,164 @@ const j = ({ to: e, children: t, onClick: n, ...r }) => {
1100
1134
  }), [n]), N(() => () => {
1101
1135
  i();
1102
1136
  }, []), null;
1103
- }, Fo = () => {
1104
- const { name: e, children: t } = v.useContext(Gt) || {}, { name: n, getParent: r } = $e();
1105
- return (e ? r(e) : null) || t || null;
1137
+ }, Vo = () => {
1138
+ const { name: e, children: t } = v.useContext(Jt) || {}, { name: n, getParent: o } = He();
1139
+ return (e ? o(e) : null) || t || null;
1106
1140
  };
1107
- function _e(e, t) {
1108
- return (n) => /* @__PURE__ */ _(dr, { name: t.name, children: [
1109
- /* @__PURE__ */ o(e, { ...n }),
1141
+ function xe(e, t) {
1142
+ return (n) => /* @__PURE__ */ C(fr, { name: t.name, children: [
1143
+ /* @__PURE__ */ r(e, { ...n }),
1110
1144
  n.children
1111
1145
  ] });
1112
1146
  }
1113
- const qe = v.createContext(void 0), ne = ({ view: e, allowDuplicates: t, children: n }) => {
1114
- const r = Yt(), {
1147
+ const Ke = v.createContext(void 0), re = ({ view: e, allowDuplicates: t, children: n }) => {
1148
+ const o = Qt(), {
1115
1149
  form: s,
1116
1150
  getParentViewContext: i,
1117
1151
  getElements: a,
1118
- allowDuplicates: l,
1119
- unsetRendered: c
1120
- } = r || {}, u = O(a?.() || {}), g = O([]), [, h] = de(), y = (f, m) => {
1121
- const d = f ? f.split(".").reduce((b, p) => b?.children?.[p] || null, e) : e;
1122
- d && (d.data = m, h.current?.setValue(d.full_name, m));
1123
- }, C = {
1152
+ allowDuplicates: c,
1153
+ unsetRendered: u
1154
+ } = o || {}, m = S(a?.() || {}), p = S([]), [, f] = me(), y = Zn(), E = (l, d) => {
1155
+ const g = l ? l.split(".").reduce((h, x) => h?.children?.[x] || null, e) : e;
1156
+ g && (g.data = d, f.current?.setValue(g.full_name, d));
1157
+ }, b = {
1124
1158
  form: e,
1125
- setRendered: (f, m) => {
1126
- f.full_name && u.current[f.full_name] === void 0 && (u.current[f.full_name] = m);
1159
+ setRendered: (l, d) => {
1160
+ l.full_name && m.current[l.full_name] === void 0 && (m.current[l.full_name] = d);
1127
1161
  },
1128
- unsetRendered: (f, m) => {
1129
- f.full_name && u.current[f.full_name] === m && delete u.current[f.full_name], c?.(f, m);
1162
+ unsetRendered: (l, d) => {
1163
+ l.full_name && m.current[l.full_name] === d && delete m.current[l.full_name], u?.(l, d);
1130
1164
  },
1131
- canRender: (f, m) => t ? !0 : zn()?.view.full_name === f.full_name || r?.form.full_name === f.full_name || Object.values(u.current).includes(m),
1132
- setValue: y,
1133
- setValues: (f) => {
1134
- Object.keys(f).map((m) => y(m, f[m]));
1165
+ canRender: (l, d) => t ? !0 : y?.view.full_name === l.full_name || o?.form.full_name === l.full_name || Object.values(m.current).includes(d),
1166
+ setValue: E,
1167
+ setValues: (l) => {
1168
+ Object.keys(l).map((d) => E(d, l[d]));
1135
1169
  },
1136
- getElements: () => u.current,
1170
+ getElements: () => m.current,
1137
1171
  allowDuplicates: t,
1138
- getParentViewContext: () => r || null,
1139
- getRootViewContext: () => r?.getRootViewContext() || r || C,
1140
- setRenderedError: (f) => {
1141
- g.current.includes(f) || g.current.push(f);
1172
+ getParentViewContext: () => o || null,
1173
+ getRootViewContext: () => o?.getRootViewContext() || o || b,
1174
+ setRenderedError: (l) => {
1175
+ p.current.includes(l) || p.current.push(l);
1142
1176
  },
1143
- isRenderedError: (f) => g.current.includes(f),
1144
- getRenderedErrors: () => g.current
1177
+ isRenderedError: (l) => p.current.includes(l),
1178
+ getRenderedErrors: () => p.current
1145
1179
  };
1146
- return /* @__PURE__ */ o(qe.Provider, { value: C, children: /* @__PURE__ */ o(ur, { children: n }) });
1147
- }, ur = ({ children: e }) => {
1148
- const t = Ee(), [n, r] = R(null), { form: s, unsetRendered: i, setRendered: a, canRender: l } = V();
1149
- return N(() => {
1150
- const c = t;
1151
- return a?.(s, c), r(c), () => {
1152
- };
1153
- }, []), !n || !l?.(s, n) ? /* @__PURE__ */ o(P, {}) : /* @__PURE__ */ o(P, { children: e });
1180
+ return /* @__PURE__ */ r(Ke.Provider, { value: b, children: /* @__PURE__ */ r(pr, { children: n }) });
1181
+ }, pr = ({ children: e }) => {
1182
+ const t = Ce(), [n, o] = R(null), { form: s, unsetRendered: i, setRendered: a, canRender: c } = B();
1183
+ return N(() => (a?.(s, t), o(t), () => {
1184
+ i?.(s, t), o(null);
1185
+ }), []), !n || !c?.(s, n) ? /* @__PURE__ */ r(A, {}) : /* @__PURE__ */ r(A, { children: e });
1154
1186
  };
1155
- function V() {
1156
- const e = v.useContext(qe);
1187
+ function B() {
1188
+ const e = v.useContext(Ke);
1157
1189
  if (!e)
1158
1190
  throw new Error("UseFormView must be used within a FormViewProvider.");
1159
1191
  return e;
1160
1192
  }
1161
- function Yt() {
1162
- return v.useContext(qe);
1193
+ function Qt() {
1194
+ return v.useContext(Ke);
1163
1195
  }
1164
- const mr = _e(X(({ onSuccess: e, onError: t, onLoad: n, embedded: r = !1 }, s) => {
1165
- const { navigate: i, generateLink: a, generateActionLink: l } = T(), { action: c, setAction: u } = ee(), g = l(c), [h, y] = R(null), E = O(null), C = te(), { startLoading: f, stopLoading: m } = Nt() || {};
1166
- ye(s, () => ({
1196
+ const hr = xe(de(({ onSuccess: e, onError: t, onLoad: n, embedded: o = !1 }, s) => {
1197
+ const { navigate: i, generateLink: a, generateActionLink: c } = j(), { action: u, setAction: m } = te(), p = c(u), [f, y] = R(null), E = S(null), _ = ne(), { startLoading: b, stopLoading: l } = Ot() || {}, d = S(null), [g, h] = R(null);
1198
+ ue(s, () => ({
1167
1199
  getFormRef: () => E.current
1168
1200
  }));
1169
- const d = (x) => {
1170
- let w = (x.errors || []).reduce((L, S) => {
1171
- const I = S.origin || x.full_name || "";
1172
- return { ...L, [I]: [...L[I] || [], S] };
1201
+ const x = (O) => {
1202
+ let k = (O.errors || []).reduce((F, se) => {
1203
+ const Xe = se.origin || O.full_name || "";
1204
+ return { ...F, [Xe]: [...F[Xe] || [], se] };
1173
1205
  }, {});
1174
- for (let [, L] of Object.entries(x?.children || []))
1175
- w = { ...w, ...d(L) };
1176
- return w;
1177
- }, b = (x) => {
1178
- f?.(p?.full_name || "form"), u({
1179
- ...c,
1180
- method: Ve.POST,
1181
- body: x,
1182
- bodyType: ut.FormData
1183
- });
1206
+ for (let [, F] of Object.entries(O?.children || []))
1207
+ k = { ...k, ...x(F) };
1208
+ return k;
1209
+ }, P = (O) => {
1210
+ b?.(L?.full_name || "form"), d.current = setTimeout(() => l?.(L?.full_name || "form"), 250), h(O);
1184
1211
  };
1185
1212
  N(() => {
1213
+ g && (d.current && clearTimeout(d.current), m({
1214
+ ...u,
1215
+ method: $e.POST,
1216
+ body: g,
1217
+ bodyType: ht.FormData
1218
+ }));
1219
+ }, [g ? JSON.stringify(Be(g)) : null]), N(() => {
1186
1220
  n && n();
1187
1221
  }, []), N(() => {
1188
- const x = C?.results?.form?.modify?.view;
1189
- if (!x)
1222
+ const O = _?.results?.form?.modify?.view;
1223
+ if (!O)
1190
1224
  return;
1191
- const w = C.results, L = d(x);
1192
- if (y(w), m?.(x?.full_name || "form"), E.current?.setErrors(L), !x.submitted || C?.status !== 200 || Object.entries(L).length)
1225
+ const k = _.results, F = x(O);
1226
+ if (y(k), l?.(O?.full_name || "form"), E.current?.setErrors(F), !O.submitted || _?.status !== 200 || Object.entries(F).length)
1193
1227
  return;
1194
1228
  E.current?.success();
1195
- const S = () => {
1196
- w.redirect && !r && i(a(w.redirect.route, { ...c.parameters || {}, ...w.redirect.parameters }), !0);
1229
+ const se = () => {
1230
+ k.redirect && !o && i(a(k.redirect.route, { ...u.parameters || {}, ...k.redirect.parameters }), !0);
1197
1231
  };
1198
- e ? e(w).then(() => S()) : S();
1199
- }, [C?.results]);
1200
- const p = h?.form?.modify?.view;
1201
- if (p)
1202
- return /* @__PURE__ */ o(Un, { loader: p.full_name, children: /* @__PURE__ */ o(
1203
- _t,
1232
+ e ? e(k).then(() => se()) : se();
1233
+ }, [_?.results]);
1234
+ const L = f?.form?.modify?.view;
1235
+ if (L)
1236
+ return /* @__PURE__ */ r($n, { loader: L.full_name, children: /* @__PURE__ */ r(
1237
+ At,
1204
1238
  {
1205
1239
  ref: E,
1206
- id: p.id || "form",
1207
- name: p.name || "form",
1208
- action: g,
1240
+ id: L.id || "form",
1241
+ name: L.name || "form",
1242
+ action: p,
1209
1243
  method: "POST",
1210
- onSubmit: b,
1211
- children: /* @__PURE__ */ o(ne, { view: p, children: /* @__PURE__ */ o(k, { name: "content", children: /* @__PURE__ */ _(
1212
- F,
1244
+ onSubmit: P,
1245
+ children: /* @__PURE__ */ r(re, { view: L, children: /* @__PURE__ */ r(T, { name: "content", children: /* @__PURE__ */ C(
1246
+ U,
1213
1247
  {
1214
- view: p.name || "form",
1248
+ view: L.name || "form",
1215
1249
  prefix: "modify/form",
1216
- data: p,
1250
+ data: L,
1217
1251
  children: [
1218
- /* @__PURE__ */ o(k, { name: "messages", children: Object.keys(h?.messages || {}).map((x, w) => /* @__PURE__ */ o(
1252
+ /* @__PURE__ */ r(T, { name: "messages", children: Object.keys(f?.messages || {}).map((O, k) => /* @__PURE__ */ r(
1219
1253
  "div",
1220
1254
  {
1221
- className: ["alert", "alert-" + x].join(" "),
1222
- children: (h?.messages[x] || ["Item was saved successful."]).join(" ")
1255
+ className: ["alert", "alert-" + O].join(" "),
1256
+ children: (f?.messages[O] || ["Item was saved successful."]).join(" ")
1223
1257
  },
1224
- "alert-" + x
1258
+ "alert-" + O
1225
1259
  )) }),
1226
- /* @__PURE__ */ o(lr, { className: "alert alert-danger" }),
1227
- /* @__PURE__ */ o(cr, {}),
1228
- /* @__PURE__ */ o(k, { name: "actions", children: /* @__PURE__ */ o(ue, { type: "submit", className: "btn btn-primary", children: /* @__PURE__ */ o(U, { children: "Save" }) }) })
1260
+ /* @__PURE__ */ r(mr, { className: "alert alert-danger" }),
1261
+ /* @__PURE__ */ r(ur, {}),
1262
+ /* @__PURE__ */ r(T, { name: "actions", children: /* @__PURE__ */ r(fe, { type: "submit", className: "btn btn-primary", children: /* @__PURE__ */ r(D, { children: "Save" }) }) })
1229
1263
  ]
1230
1264
  },
1231
- p.id || "form"
1265
+ L.id || "form"
1232
1266
  ) }) })
1233
1267
  }
1234
1268
  ) });
1235
- }), { name: "form" }), Wt = _e(X(({
1269
+ }), { name: "form" }), Zt = xe(de(({
1236
1270
  children: e,
1237
1271
  ...t
1238
1272
  }, n) => {
1239
- const { closeModal: r, modal: s } = ze(), {
1273
+ const { closeModal: o, modal: s } = Qe(), {
1240
1274
  open: i = !0,
1241
1275
  animation: a = "fade",
1242
- backdrop: l = !0,
1243
- keyboard: c = !0,
1244
- size: u,
1245
- onClose: g,
1246
- className: h
1276
+ backdrop: c = !0,
1277
+ keyboard: u = !0,
1278
+ size: m,
1279
+ onClose: p,
1280
+ className: f
1247
1281
  } = { ...t, ...s?.props || {} }, [y, E] = R(i);
1248
- ye(n, () => ({
1282
+ ue(n, () => ({
1249
1283
  toggle: () => E(!y),
1250
1284
  open: () => E(!0),
1251
- close: () => b(),
1285
+ close: () => g(),
1252
1286
  isOpen: () => y
1253
1287
  })), N(() => {
1254
1288
  E(i);
1255
1289
  }, [i]);
1256
- const C = (p) => {
1257
- if (c)
1258
- switch (p.key) {
1290
+ const _ = (h) => {
1291
+ if (u)
1292
+ switch (h.key) {
1259
1293
  case "Escape": {
1260
- b();
1294
+ g();
1261
1295
  break;
1262
1296
  }
1263
1297
  }
@@ -1265,76 +1299,76 @@ const mr = _e(X(({ onSuccess: e, onError: t, onLoad: n, embedded: r = !1 }, s) =
1265
1299
  N(() => {
1266
1300
  if (!y)
1267
1301
  return;
1268
- const p = () => {
1269
- f.current?.addEventListener("animationend", x);
1302
+ const h = () => {
1303
+ b.current?.addEventListener("animationend", x);
1270
1304
  }, x = () => {
1271
- f.current?.classList.remove(a), f.current?.removeEventListener("animationstart", p), f.current?.removeEventListener("animationend", x);
1305
+ b.current?.classList.remove(a), b.current?.removeEventListener("animationstart", h), b.current?.removeEventListener("animationend", x);
1272
1306
  };
1273
1307
  return setTimeout(() => {
1274
- f.current?.classList.add("d-block", "show"), m?.current?.classList.add("show");
1275
- }, a ? 100 : 0), document.addEventListener("keydown", C), f.current?.addEventListener("animationstart", p), () => {
1276
- document.removeEventListener("keydown", C), f.current?.removeEventListener("animationstart", p), f.current?.removeEventListener("animationend", x);
1308
+ b.current?.classList.add("d-block", "show"), l?.current?.classList.add("show");
1309
+ }, a ? 100 : 0), document.addEventListener("keydown", _), b.current?.addEventListener("animationstart", h), () => {
1310
+ document.removeEventListener("keydown", _), b.current?.removeEventListener("animationstart", h), b.current?.removeEventListener("animationend", x);
1277
1311
  };
1278
1312
  }, [y]);
1279
- const f = O(null), m = O(null), d = () => {
1280
- E(!1), r?.();
1281
- }, b = () => new Promise((p, x) => {
1313
+ const b = S(null), l = S(null), d = () => {
1314
+ E(!1), o?.();
1315
+ }, g = () => new Promise((h, x) => {
1282
1316
  if (!y)
1283
- return p();
1284
- const w = () => {
1285
- f?.current?.classList.remove("show", "d-block"), p(), d();
1317
+ return h();
1318
+ const P = () => {
1319
+ b?.current?.classList.remove("show", "d-block"), h(), d();
1286
1320
  };
1287
1321
  if (a) {
1288
1322
  const L = setTimeout(() => {
1289
- w();
1323
+ P();
1290
1324
  }, a ? 50 : 0);
1291
- f.current?.addEventListener("animationstart", () => {
1292
- clearTimeout(L), f.current?.removeEventListener("animationend", w), f.current?.addEventListener("animationend", w);
1293
- }), f.current?.classList.add(a, "close");
1325
+ b.current?.addEventListener("animationstart", () => {
1326
+ clearTimeout(L), b.current?.removeEventListener("animationend", P), b.current?.addEventListener("animationend", P);
1327
+ }), b.current?.classList.add(a, "close");
1294
1328
  } else
1295
- w();
1329
+ P();
1296
1330
  });
1297
1331
  return N(() => () => {
1298
- g && g();
1299
- }, []), y && Rn(/* @__PURE__ */ _(P, { children: [
1300
- /* @__PURE__ */ o(
1332
+ p && p();
1333
+ }, []), y && Tn(/* @__PURE__ */ C(A, { children: [
1334
+ /* @__PURE__ */ r(
1301
1335
  "div",
1302
1336
  {
1303
- ref: f,
1304
- className: ["modal", u && "modal-" + u, a && a, h].filter((p) => p).join(" "),
1305
- children: /* @__PURE__ */ o("div", { className: "modal-dialog modal-dialog-centered", role: "document", children: /* @__PURE__ */ _("div", { className: "modal-content", children: [
1306
- /* @__PURE__ */ o(k, { name: "header", children: /* @__PURE__ */ _("div", { className: "modal-header", children: [
1307
- /* @__PURE__ */ o("h5", { className: "modal-title", id: "exampleModalLabel", children: /* @__PURE__ */ o(k, { name: "title", children: "Title" }) }),
1308
- /* @__PURE__ */ o(k, { name: "navigation", children: /* @__PURE__ */ o("nav", { children: e }) }),
1309
- /* @__PURE__ */ o("button", { onClick: b, type: "button", className: "btn-close", "aria-label": "Close" })
1337
+ ref: b,
1338
+ className: ["modal", m && "modal-" + m, a && a, f].filter((h) => h).join(" "),
1339
+ children: /* @__PURE__ */ r("div", { className: "modal-dialog modal-dialog-centered", role: "document", children: /* @__PURE__ */ C("div", { className: "modal-content", children: [
1340
+ /* @__PURE__ */ r(T, { name: "header", children: /* @__PURE__ */ C("div", { className: "modal-header", children: [
1341
+ /* @__PURE__ */ r("h5", { className: "modal-title", id: "exampleModalLabel", children: /* @__PURE__ */ r(T, { name: "title", children: "Title" }) }),
1342
+ /* @__PURE__ */ r(T, { name: "navigation", children: /* @__PURE__ */ r("nav", { children: e }) }),
1343
+ /* @__PURE__ */ r("button", { onClick: g, type: "button", className: "btn-close", "aria-label": "Close" })
1310
1344
  ] }) }),
1311
- /* @__PURE__ */ o("div", { className: "modal-body", children: /* @__PURE__ */ o(k, { name: "content", children: e }) }),
1312
- /* @__PURE__ */ o(k, { name: "footer", children: /* @__PURE__ */ o("div", { className: "modal-footer", children: /* @__PURE__ */ o(k, { name: "actions", children: /* @__PURE__ */ o("button", { onClick: b, type: "button", className: "btn btn-secondary", children: "Close" }) }) }) })
1345
+ /* @__PURE__ */ r("div", { className: "modal-body", children: /* @__PURE__ */ r(T, { name: "content", children: e }) }),
1346
+ /* @__PURE__ */ r(T, { name: "footer", children: /* @__PURE__ */ r("div", { className: "modal-footer", children: /* @__PURE__ */ r(T, { name: "actions", children: /* @__PURE__ */ r("button", { onClick: g, type: "button", className: "btn btn-secondary", children: "Close" }) }) }) })
1313
1347
  ] }) })
1314
1348
  }
1315
1349
  ),
1316
- l && /* @__PURE__ */ o(
1350
+ c && /* @__PURE__ */ r(
1317
1351
  "div",
1318
1352
  {
1319
- ref: m,
1320
- className: ["modal-backdrop", "fade", ...a && ["show"]].filter((p) => p).join(" ")
1353
+ ref: l,
1354
+ className: ["modal-backdrop", "fade", ...a && ["show"]].filter((h) => h).join(" ")
1321
1355
  }
1322
1356
  )
1323
1357
  ] }), document.body);
1324
- }), { name: "modal" }), fr = ({
1358
+ }), { name: "modal" }), gr = ({
1325
1359
  animationData: e,
1326
1360
  path: t,
1327
1361
  options: n,
1328
- width: r,
1362
+ width: o,
1329
1363
  height: s,
1330
1364
  className: i,
1331
1365
  ...a
1332
1366
  }) => {
1333
- const l = O(null);
1367
+ const c = S(null);
1334
1368
  return N(() => {
1335
- if (!l.current)
1369
+ if (!c.current)
1336
1370
  return;
1337
- const c = kn.loadAnimation({
1371
+ const u = In.loadAnimation({
1338
1372
  renderer: "svg",
1339
1373
  loop: !1,
1340
1374
  autoplay: !0,
@@ -1343,29 +1377,29 @@ const mr = _e(X(({ onSuccess: e, onError: t, onLoad: n, embedded: r = !1 }, s) =
1343
1377
  },
1344
1378
  animationData: e,
1345
1379
  path: t,
1346
- container: l.current,
1380
+ container: c.current,
1347
1381
  ...n || {}
1348
1382
  });
1349
1383
  return () => {
1350
- c.destroy();
1384
+ u.destroy();
1351
1385
  };
1352
- }, []), /* @__PURE__ */ o("div", { className: i, ref: l, style: { width: r, height: s } });
1353
- }, zt = v.createContext(void 0);
1354
- var Q = /* @__PURE__ */ ((e) => (e[e.success = 0] = "success", e[e.denied = 1] = "denied", e[e.warning = 2] = "warning", e[e.info = 3] = "info", e[e.confirm = 4] = "confirm", e))(Q || {});
1355
- function He() {
1356
- const e = v.useContext(zt);
1386
+ }, []), /* @__PURE__ */ r("div", { className: i, ref: c, style: { width: o, height: s } });
1387
+ }, Xt = v.createContext(void 0);
1388
+ var Z = /* @__PURE__ */ ((e) => (e[e.success = 0] = "success", e[e.denied = 1] = "denied", e[e.warning = 2] = "warning", e[e.info = 3] = "info", e[e.confirm = 4] = "confirm", e))(Z || {});
1389
+ function Ge() {
1390
+ const e = v.useContext(Xt);
1357
1391
  if (e === void 0)
1358
1392
  throw new Error("UseAlert must be within AlertProvider");
1359
1393
  return e;
1360
1394
  }
1361
- function Jt({ children: e }) {
1362
- const [t, n] = R(), r = O(0), s = O(void 0), [i, a] = R(null);
1395
+ function en({ children: e }) {
1396
+ const [t, n] = R(), o = S(0), s = S(void 0), [i, a] = R(null);
1363
1397
  N(() => {
1364
- r.current += 1;
1398
+ o.current += 1;
1365
1399
  }, [t]);
1366
- const l = /* @__PURE__ */ Object.assign({ "/src/assets/images/alert/denied.json": () => import("./denied-CgoMpaA7.js"), "/src/assets/images/alert/info.json": () => import("./info-D-NzIEYs.js"), "/src/assets/images/alert/success.json": () => import("./success-Bu_BJcf1.js"), "/src/assets/images/alert/warning.json": () => import("./warning-B1nr7TsB.js") }), c = () => {
1400
+ const c = /* @__PURE__ */ Object.assign({ "/src/assets/images/alert/denied.json": () => import("./denied-CgoMpaA7.js"), "/src/assets/images/alert/info.json": () => import("./info-D-NzIEYs.js"), "/src/assets/images/alert/success.json": () => import("./success-Bu_BJcf1.js"), "/src/assets/images/alert/warning.json": () => import("./warning-B1nr7TsB.js") }), u = () => {
1367
1401
  a(null), n(void 0);
1368
- }, u = (h) => {
1402
+ }, m = (f) => {
1369
1403
  let y = {
1370
1404
  title: "Are you confirm?",
1371
1405
  icon: 3,
@@ -1373,7 +1407,7 @@ function Jt({ children: e }) {
1373
1407
  size: "auto",
1374
1408
  allowClose: !1,
1375
1409
  timeoutProgress: !1,
1376
- ...h || {}
1410
+ ...f || {}
1377
1411
  };
1378
1412
  const E = {
1379
1413
  0: "success.json",
@@ -1383,9 +1417,9 @@ function Jt({ children: e }) {
1383
1417
  4: "info.json"
1384
1418
  };
1385
1419
  if (Object.hasOwn(E, y.icon)) {
1386
- const C = E[y.icon], f = Object.keys(l).filter((m) => m.endsWith(C)).pop();
1387
- f && l[f]().then((m) => {
1388
- a(m.default);
1420
+ const _ = E[y.icon], b = Object.keys(c).filter((l) => l.endsWith(_)).pop();
1421
+ b && c[b]().then((l) => {
1422
+ a(l.default);
1389
1423
  });
1390
1424
  }
1391
1425
  !y.actions && !y.timeoutProgress ? y.actions = {
@@ -1397,22 +1431,22 @@ function Jt({ children: e }) {
1397
1431
  label: "Confirm"
1398
1432
  }
1399
1433
  } : setTimeout(() => {
1400
- s.current?.close().finally(c);
1434
+ s.current?.close().finally(u);
1401
1435
  }, y.timeout || 1e3), s.current?.isOpen() ? s.current?.close().finally(() => {
1402
1436
  n(y);
1403
1437
  }) : n(y);
1404
- }, g = (h) => {
1438
+ }, p = (f) => {
1405
1439
  const y = {
1406
- [h]: !0,
1407
- isConfirmed: h === "confirm",
1408
- isCancelled: h === "cancel",
1409
- isDenied: h === "deny"
1440
+ [f]: !0,
1441
+ isConfirmed: f === "confirm",
1442
+ isCancelled: f === "cancel",
1443
+ isDenied: f === "deny"
1410
1444
  };
1411
- t?.onResult && t.onResult(y), s.current?.close().then(c);
1445
+ t?.onResult && t.onResult(y), s.current?.close().then(u);
1412
1446
  };
1413
- return /* @__PURE__ */ _(zt.Provider, { value: { open: u }, children: [
1414
- t && /* @__PURE__ */ _(
1415
- Wt,
1447
+ return /* @__PURE__ */ C(Xt.Provider, { value: { open: m }, children: [
1448
+ t && /* @__PURE__ */ C(
1449
+ Zt,
1416
1450
  {
1417
1451
  size: t.size,
1418
1452
  className: "modal-alert",
@@ -1420,80 +1454,80 @@ function Jt({ children: e }) {
1420
1454
  open: !0,
1421
1455
  ref: s,
1422
1456
  children: [
1423
- /* @__PURE__ */ o(q, { name: "header" }),
1424
- /* @__PURE__ */ o(q, { name: "footer" }),
1425
- /* @__PURE__ */ o(q, { name: "content", children: /* @__PURE__ */ _("div", { className: "d-flex flex-column align-items-center", children: [
1426
- i !== null && /* @__PURE__ */ o(fr, { className: "modal-alert-icon", animationData: i }),
1427
- /* @__PURE__ */ o("h3", { className: "modal-alert-title", children: t.title }),
1428
- !!t.text?.length && /* @__PURE__ */ o("p", { className: "modal-alert-text", children: t.text }),
1429
- t.actions && /* @__PURE__ */ o("div", { className: "d-flex justify-content-center align-items-center", children: Object.keys(t.actions).map((h) => /* @__PURE__ */ o(
1430
- ue,
1457
+ /* @__PURE__ */ r(H, { name: "header" }),
1458
+ /* @__PURE__ */ r(H, { name: "footer" }),
1459
+ /* @__PURE__ */ r(H, { name: "content", children: /* @__PURE__ */ C("div", { className: "d-flex flex-column align-items-center", children: [
1460
+ i !== null && /* @__PURE__ */ r(gr, { className: "modal-alert-icon", animationData: i }),
1461
+ /* @__PURE__ */ r("h3", { className: "modal-alert-title", children: t.title }),
1462
+ !!t.text?.length && /* @__PURE__ */ r("p", { className: "modal-alert-text", children: t.text }),
1463
+ t.actions && /* @__PURE__ */ r("div", { className: "d-flex justify-content-center align-items-center", children: Object.keys(t.actions).map((f) => /* @__PURE__ */ r(
1464
+ fe,
1431
1465
  {
1432
- className: "btn btn-lg mx-2 " + (t.actions?.[h].classList ?? ["btn-primary"]).join(" "),
1433
- onClick: () => g(h),
1434
- children: (t.actions?.[h] ?? null)?.label || h
1466
+ className: "btn btn-lg mx-2 " + (t.actions?.[f].classList ?? ["btn-primary"]).join(" "),
1467
+ onClick: () => p(f),
1468
+ children: (t.actions?.[f] ?? null)?.label || f
1435
1469
  },
1436
- h
1470
+ f
1437
1471
  )) })
1438
1472
  ] }) })
1439
1473
  ]
1440
1474
  },
1441
- r.current
1475
+ o.current
1442
1476
  ),
1443
1477
  e
1444
1478
  ] });
1445
1479
  }
1446
- function Mo(e) {
1447
- return (t) => /* @__PURE__ */ o(Jt, { children: /* @__PURE__ */ o(e, { ...t }) });
1480
+ function Bo(e) {
1481
+ return (t) => /* @__PURE__ */ r(en, { children: /* @__PURE__ */ r(e, { ...t }) });
1448
1482
  }
1449
- const pr = _e(({ children: e }) => {
1450
- const { action: t } = ee(), { getAction: n, generateLink: r } = T(), s = n(t.action.entity, "list", t.action.namespace);
1451
- return /* @__PURE__ */ _("section", { className: "edit", children: [
1452
- /* @__PURE__ */ _("header", { children: [
1453
- /* @__PURE__ */ _("h2", { className: "title", children: [
1454
- s && /* @__PURE__ */ o(j, { to: r(s.route, t.parameters), children: "←" }),
1455
- /* @__PURE__ */ o(k, { name: "title" })
1483
+ const br = xe(({ children: e }) => {
1484
+ const { action: t } = te(), { getAction: n, generateLink: o } = j(), s = n(t.action.entity, "list", t.action.namespace);
1485
+ return /* @__PURE__ */ C("section", { className: "edit", children: [
1486
+ /* @__PURE__ */ C("header", { children: [
1487
+ /* @__PURE__ */ C("h2", { className: "title", children: [
1488
+ s && /* @__PURE__ */ r(M, { to: o(s.route, t.parameters), children: "←" }),
1489
+ /* @__PURE__ */ r(T, { name: "title" })
1456
1490
  ] }),
1457
- /* @__PURE__ */ o("nav", { children: /* @__PURE__ */ o(k, { name: "navigation" }) })
1491
+ /* @__PURE__ */ r("nav", { children: /* @__PURE__ */ r(T, { name: "navigation" }) })
1458
1492
  ] }),
1459
- /* @__PURE__ */ _("main", { children: [
1460
- /* @__PURE__ */ o(k, { name: "content" }),
1461
- /* @__PURE__ */ o(k, { name: "actions" })
1493
+ /* @__PURE__ */ C("main", { children: [
1494
+ /* @__PURE__ */ r(T, { name: "content" }),
1495
+ /* @__PURE__ */ r(T, { name: "actions" })
1462
1496
  ] })
1463
1497
  ] });
1464
- }, { name: "modify" }), tt = Tt(({ template: e, children: t, onSuccess: n, modal: r }) => {
1465
- const { open: s } = He(), { closeModal: i } = ze(), a = te(), l = r ? Wt : e || pr;
1498
+ }, { name: "modify" }), st = Mt(({ template: e, children: t, onSuccess: n, modal: o }) => {
1499
+ const { open: s } = Ge(), { closeModal: i } = Qe(), a = ne(), c = o ? Zt : e || br;
1466
1500
  if (a)
1467
- return /* @__PURE__ */ _(l, { children: [
1468
- /* @__PURE__ */ o(q, { name: "title", children: a?.results?.title || "Title" }),
1469
- /* @__PURE__ */ o(q, { name: "navigation", children: /* @__PURE__ */ o(F, { view: "navigation", prefix: "modify" }) }),
1470
- /* @__PURE__ */ o(q, { name: "content", children: /* @__PURE__ */ o(F, { view: "content", prefix: "modify", children: /* @__PURE__ */ o(
1471
- mr,
1501
+ return /* @__PURE__ */ C(c, { children: [
1502
+ /* @__PURE__ */ r(H, { name: "title", children: /* @__PURE__ */ r(D, { children: a?.results?.title || "Title" }) }),
1503
+ /* @__PURE__ */ r(H, { name: "navigation", children: /* @__PURE__ */ r(U, { view: "navigation", prefix: "modify" }) }),
1504
+ /* @__PURE__ */ r(H, { name: "content", children: /* @__PURE__ */ r(U, { view: "content", prefix: "modify", children: /* @__PURE__ */ r(
1505
+ hr,
1472
1506
  {
1473
- onSuccess: (c) => new Promise((u, g) => {
1507
+ onSuccess: (u) => new Promise((m, p) => {
1474
1508
  i();
1475
- const h = new CustomEvent("success", { detail: c, cancelable: !0 });
1476
- if (n && n(h, c), h.defaultPrevented)
1477
- return g();
1509
+ const f = new CustomEvent("success", { detail: u, cancelable: !0 });
1510
+ if (n && n(f, u), f.defaultPrevented)
1511
+ return p();
1478
1512
  s({
1479
1513
  title: "Success",
1480
- text: Object.values(c.messages?.success ?? []).join(" ") ?? "Item was saved successful!",
1481
- icon: Q.success,
1514
+ text: Object.values(u.messages?.success ?? []).join(" ") ?? "Item was saved successful!",
1515
+ icon: Z.success,
1482
1516
  actions: {
1483
1517
  close: {
1484
1518
  label: "OK"
1485
1519
  }
1486
1520
  },
1487
1521
  onResult: () => {
1488
- u();
1522
+ m();
1489
1523
  }
1490
1524
  });
1491
1525
  }),
1492
- onError: (c) => {
1526
+ onError: (u) => {
1493
1527
  s({
1494
- title: c.status + " " + c.detail,
1495
- text: c.detail,
1496
- icon: Q.denied,
1528
+ title: u.status + " " + u.detail,
1529
+ text: u.detail,
1530
+ icon: Z.denied,
1497
1531
  actions: {
1498
1532
  close: {
1499
1533
  label: "OK"
@@ -1503,103 +1537,103 @@ const pr = _e(({ children: e }) => {
1503
1537
  },
1504
1538
  onLoad: () => {
1505
1539
  },
1506
- embedded: r,
1507
- children: /* @__PURE__ */ o(q, { name: "actions" })
1540
+ embedded: o,
1541
+ children: /* @__PURE__ */ r(H, { name: "actions" })
1508
1542
  }
1509
1543
  ) }) }),
1510
- /* @__PURE__ */ o(q, { name: "actions", children: /* @__PURE__ */ o(
1511
- ue,
1544
+ /* @__PURE__ */ r(H, { name: "actions", children: /* @__PURE__ */ r(
1545
+ fe,
1512
1546
  {
1513
1547
  type: "submit",
1514
1548
  className: "btn btn-primary",
1515
1549
  form: a?.results?.form?.modify?.view.full_name || "modify",
1516
- children: /* @__PURE__ */ o(U, { children: "Submit" })
1550
+ children: /* @__PURE__ */ r(D, { children: "Submit" })
1517
1551
  }
1518
1552
  ) }),
1519
1553
  t
1520
1554
  ] });
1521
1555
  });
1522
- var Ke = /* @__PURE__ */ ((e) => (e.List = "list", e.Object = "object", e.Internal = "internal", e))(Ke || {});
1523
- const Qt = v.createContext(void 0);
1524
- function B() {
1525
- const e = v.useContext(Qt);
1556
+ var Ye = /* @__PURE__ */ ((e) => (e.List = "list", e.Object = "object", e.Internal = "internal", e))(Ye || {});
1557
+ const tn = v.createContext(void 0);
1558
+ function $() {
1559
+ const e = v.useContext(tn);
1526
1560
  if (e === void 0)
1527
1561
  throw new Error("UseList must be within ListProvider");
1528
- const { data: t, onClick: n } = e, r = t?.entity?.primaryColumn, s = (t?.entity?.columns || []).filter((u) => u.visible).filter((u) => u.group !== !1), i = Object.values(t?.action || []), a = i.filter((u) => u.visibility === Ke.Object), l = s.length + (i.length ? 1 : 0), c = t?.entity?.data.items ?? [];
1562
+ const { data: t, onClick: n } = e, o = t?.entity?.primaryColumn, s = (t?.entity?.columns || []).filter((m) => m.visible).filter((m) => m.group !== !1), i = Object.values(t?.action || []), a = i.filter((m) => m.visibility === Ye.Object), c = s.length + (i.length ? 1 : 0), u = t?.entity?.data.items ?? [];
1529
1563
  return {
1530
1564
  data: t,
1531
1565
  columns: s,
1532
1566
  actions: i,
1533
1567
  objectActions: a,
1534
- columnsTotal: l,
1535
- primaryColumn: r,
1536
- items: c,
1568
+ columnsTotal: c,
1569
+ primaryColumn: o,
1570
+ items: u,
1537
1571
  onClick: n
1538
1572
  };
1539
1573
  }
1540
- function hr({ data: e, onClick: t, ...n }) {
1541
- const { results: r } = te() || {};
1542
- return e ??= r, /* @__PURE__ */ o(Qt.Provider, { value: { data: e, onClick: t }, children: n.children });
1574
+ function yr({ data: e, onClick: t, ...n }) {
1575
+ const { results: o } = ne() || {};
1576
+ return e ??= o, /* @__PURE__ */ r(tn.Provider, { value: { data: e, onClick: t }, children: n.children });
1543
1577
  }
1544
- const Zt = v.createContext(void 0);
1545
- function fe() {
1546
- const e = v.useContext(Zt);
1578
+ const nn = v.createContext(void 0);
1579
+ function he() {
1580
+ const e = v.useContext(nn);
1547
1581
  if (e === void 0)
1548
1582
  throw new Error("UseListItem must be within ListItemProvider");
1549
- const { index: t } = e, { data: n, primaryColumn: r } = B();
1583
+ const { index: t } = e, { data: n, primaryColumn: o } = $();
1550
1584
  return {
1551
1585
  index: t,
1552
- id: n?.entity?.data.items[t][r?.field || ""] ?? null,
1586
+ id: n?.entity?.data.items[t][o?.field || ""] ?? null,
1553
1587
  data: n?.entity?.data.items[t] ?? null
1554
1588
  };
1555
1589
  }
1556
- function Xt({ index: e, ...t }) {
1557
- return /* @__PURE__ */ o(Zt.Provider, { value: { index: e }, children: t.children });
1590
+ function rn({ index: e, ...t }) {
1591
+ return /* @__PURE__ */ r(nn.Provider, { value: { index: e }, children: t.children });
1558
1592
  }
1559
- const en = ({ column: e, namespace: t }) => {
1560
- const { data: n } = fe();
1561
- return n && /* @__PURE__ */ o(F, { namespace: t, data: n, prefix: "list", view: e.field, children: n[e.field] !== void 0 && (n[e.field] instanceof Object ? n[e.field] instanceof Array ? n[e.field].join(", ") : JSON.stringify(n[e.field]) : n[e.field]?.toString()) });
1562
- }, tn = v.createContext(void 0);
1563
- function nn() {
1564
- return v.useContext(tn);
1593
+ const on = ({ column: e, namespace: t }) => {
1594
+ const { data: n } = he();
1595
+ return n && /* @__PURE__ */ r(U, { namespace: t, data: n, prefix: "list", view: e.field, children: n[e.field] !== void 0 && (n[e.field] instanceof Object ? n[e.field] instanceof Array ? n[e.field].join(", ") : JSON.stringify(n[e.field]) : /* @__PURE__ */ r(D, { children: n[e.field]?.toString() })) });
1596
+ }, sn = v.createContext(void 0);
1597
+ function an() {
1598
+ return v.useContext(sn);
1565
1599
  }
1566
- function gr({ onClick: e, ...t }) {
1567
- const { data: n, items: r, primaryColumn: s } = B(), i = O([]), a = r.map((m) => m[s?.field || ""] || 0), l = !!a.length && a.reduce((m, d) => m && i.current.includes(d), !0), c = n?.form?.batch?.view?.children?.method?.choices?.reduce((m, d) => {
1568
- const b = d.label instanceof Function ? d.label(d) : d.label, p = d.value instanceof Function ? d.value() : d.value?.toString();
1569
- return { ...m, [p]: b };
1570
- }, {}), u = !!Object.keys(c || {}).length && s, [, g] = R(), h = (m, d = !1) => {
1571
- const b = a[m];
1572
- d ? i.current.push(b) : i.current = i.current.filter((p) => p !== b), g({});
1573
- }, y = (m = !1) => {
1574
- i.current = (m ? i.current.concat(a) : i.current.filter((d) => !a.includes(d))).filter((d, b, p) => p.indexOf(d) === b), g({});
1600
+ function vr({ onClick: e, ...t }) {
1601
+ const { data: n, items: o, primaryColumn: s } = $(), i = S([]), a = o.map((l) => l[s?.field || ""] || 0), c = !!a.length && a.reduce((l, d) => l && i.current.includes(d), !0), u = n?.form?.batch?.view?.children?.method?.choices?.reduce((l, d) => {
1602
+ const g = d.label instanceof Function ? d.label(d) : d.label, h = d.value instanceof Function ? d.value() : d.value?.toString();
1603
+ return { ...l, [h]: g };
1604
+ }, {}), m = !!Object.keys(u || {}).length && s, [, p] = R(), f = (l, d = !1) => {
1605
+ const g = a[l];
1606
+ d ? i.current.push(g) : i.current = i.current.filter((h) => h !== g), p({});
1607
+ }, y = (l = !1) => {
1608
+ i.current = (l ? i.current.concat(a) : i.current.filter((d) => !a.includes(d))).filter((d, g, h) => h.indexOf(d) === g), p({});
1575
1609
  }, E = () => {
1576
- i.current = [], g({});
1577
- }, C = (m) => {
1578
- const d = a[m];
1610
+ i.current = [], p({});
1611
+ }, _ = (l) => {
1612
+ const d = a[l];
1579
1613
  return i.current.includes(d);
1580
- }, f = (m) => new Promise((d, b) => {
1614
+ }, b = (l) => new Promise((d, g) => {
1581
1615
  if (!i)
1582
- return b();
1583
- const p = n?.form.batch.view;
1584
- if (!u || !i.current?.length)
1585
- return b();
1616
+ return g();
1617
+ const h = n?.form.batch.view;
1618
+ if (!m || !i.current?.length)
1619
+ return g();
1586
1620
  const x = new FormData();
1587
- i.current.forEach((w) => {
1588
- x.append(`${p?.children?.ids.full_name}[]`, w.toString());
1589
- }), x.append(p?.children?.method.full_name || "method", m), e(m, i.current, x).then(() => {
1621
+ i.current.forEach((P) => {
1622
+ x.append(`${h?.children?.ids.full_name}[]`, P.toString());
1623
+ }), x.append(h?.children?.method.full_name || "method", l), e(l, i.current, x).then(() => {
1590
1624
  E(), d();
1591
- }).catch(b);
1625
+ }).catch(g);
1592
1626
  });
1593
- return /* @__PURE__ */ o(
1594
- tn.Provider,
1627
+ return /* @__PURE__ */ r(
1628
+ sn.Provider,
1595
1629
  {
1596
1630
  value: {
1597
- actions: c,
1598
- toggle: h,
1631
+ actions: u,
1632
+ toggle: f,
1599
1633
  toggleAll: y,
1600
- isSelected: C,
1601
- isSelectedAll: l,
1602
- executeAction: f,
1634
+ isSelected: _,
1635
+ isSelectedAll: c,
1636
+ executeAction: b,
1603
1637
  selected: i.current,
1604
1638
  clear: E
1605
1639
  },
@@ -1607,12 +1641,12 @@ function gr({ onClick: e, ...t }) {
1607
1641
  }
1608
1642
  );
1609
1643
  }
1610
- const rn = ({ className: e }) => {
1611
- const { index: t } = fe(), n = nn();
1644
+ const cn = ({ className: e }) => {
1645
+ const { index: t } = he(), n = an();
1612
1646
  if (!n)
1613
- return /* @__PURE__ */ o(P, {});
1614
- const { actions: r, toggle: s, isSelected: i } = n;
1615
- return Object.keys(r || {}).length > 0 && /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(
1647
+ return /* @__PURE__ */ r(A, {});
1648
+ const { actions: o, toggle: s, isSelected: i } = n;
1649
+ return Object.keys(o || {}).length > 0 && /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(
1616
1650
  "input",
1617
1651
  {
1618
1652
  checked: i(t),
@@ -1622,210 +1656,216 @@ const rn = ({ className: e }) => {
1622
1656
  onChange: (a) => s(t, a.target.checked)
1623
1657
  }
1624
1658
  ) });
1625
- }, on = ({ column: e, namespace: t }) => /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(F, { namespace: t, data: e, prefix: "list", view: e.field + ".label", children: e.label }) }), sn = ({ children: e, action: t, className: n }) => {
1626
- const { generateActionLink: r } = T(), { onClick: s } = B();
1627
- return /* @__PURE__ */ o(
1628
- j,
1659
+ }, ln = ({ column: e, namespace: t }) => /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(U, { namespace: t, data: e, prefix: "list", view: e.field + ".label", children: /* @__PURE__ */ r(D, { children: e.label }) }) }), dn = ({ children: e, action: t, className: n }) => {
1660
+ const { generateActionLink: o } = j(), { onClick: s } = $();
1661
+ return /* @__PURE__ */ r(
1662
+ M,
1629
1663
  {
1630
1664
  onClick: (i) => {
1631
1665
  s && s(t, i);
1632
1666
  },
1633
1667
  className: n,
1634
- to: r(t),
1635
- children: e ?? t.action.title ?? t.action.name
1668
+ to: o(t),
1669
+ children: e ?? /* @__PURE__ */ r(D, { children: t.action.title ?? t.action.name })
1636
1670
  }
1637
1671
  );
1638
- }, br = ({ permission: e, children: t, id: n }) => {
1639
- const { results: r } = te() || {}, { id: s } = n ? { id: n } : fe();
1640
- if (!(e && !Object.values(r?.entity.acl[e] || []).map((i) => i.toString()).includes(s.toString())))
1641
- return /* @__PURE__ */ o(P, { children: t });
1642
- }, vr = ({ action: e, ...t }) => {
1643
- const { id: n } = fe();
1644
- return /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(br, { permission: e.action.permission, children: /* @__PURE__ */ o(sn, { ...t, action: { ...e, parameters: { ...e.parameters, id: n } } }) }) });
1645
- }, an = ({ namespace: e, routeParams: t }) => {
1646
- const { objectActions: n } = B(), { data: r } = fe();
1647
- return r && /* @__PURE__ */ o(F, { namespace: e, data: r, prefix: "list", view: "object.actions", children: n.map((s, i) => /* @__PURE__ */ o(
1648
- vr,
1672
+ }, Er = ({ permission: e, children: t, id: n }) => {
1673
+ const { results: o } = ne() || {}, { id: s } = n ? { id: n } : he();
1674
+ if (!(e && !Object.values(o?.entity.acl[e] || []).map((i) => i.toString()).includes(s.toString())))
1675
+ return /* @__PURE__ */ r(A, { children: t });
1676
+ }, Cr = ({ action: e, ...t }) => {
1677
+ const { id: n } = he();
1678
+ return /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(Er, { permission: e.action.permission, children: /* @__PURE__ */ r(dn, { ...t, action: { ...e, parameters: { ...e.parameters, id: n } } }) }) });
1679
+ }, un = ({ namespace: e, routeParams: t }) => {
1680
+ const { objectActions: n } = $(), { data: o } = he();
1681
+ return o && /* @__PURE__ */ r(U, { namespace: e, data: o, prefix: "list", view: "object.actions", children: n.map((s, i) => /* @__PURE__ */ r(
1682
+ Cr,
1649
1683
  {
1650
1684
  action: { action: s, parameters: t },
1651
1685
  className: ["btn", "btn-sm", "mb-1", "ms-1", (s.route?.methods ?? []).includes("DELETE") ? "btn-outline-danger" : "btn-outline-secondary"].join(" ")
1652
1686
  },
1653
1687
  i
1654
1688
  )) });
1655
- }, yr = X(({ routeParams: e, namespace: t, tableOptions: n, ...r }, s) => {
1656
- const { columns: i, primaryColumn: a, objectActions: l, columnsTotal: c, items: u, data: g, onClick: h } = B(), { action: y } = ee(), { options: E } = le(), C = {
1689
+ }, _r = ({
1690
+ routeParams: e,
1691
+ namespace: t,
1692
+ options: n,
1693
+ tableOptions: o,
1694
+ ...s
1695
+ }) => {
1696
+ const { columns: i, primaryColumn: a, objectActions: c, columnsTotal: u, items: m, data: p, onClick: f } = $(), { action: y } = te(), { options: E } = ee(), _ = {
1657
1697
  className: "table-responsive",
1658
- ...r,
1698
+ ...s,
1659
1699
  ...E?.GridView || {}
1660
1700
  };
1661
- return n = {
1701
+ return o = {
1662
1702
  className: "table table-striped table-hover",
1663
1703
  ...E?.HTMLTableElement || {},
1664
- ...n || {}
1665
- }, /* @__PURE__ */ o("div", { ...C, children: /* @__PURE__ */ _("table", { ...n, children: [
1666
- /* @__PURE__ */ o("thead", { children: /* @__PURE__ */ _("tr", { children: [
1667
- i.map((f, m) => /* @__PURE__ */ _("th", { children: [
1668
- /* @__PURE__ */ o(on, { column: f, namespace: t }),
1669
- f.sortable && g?.sort?.[f.field] !== void 0 && /* @__PURE__ */ o(
1670
- j,
1671
- {
1672
- onClick: (d) => h && h({
1673
- ...y,
1674
- query: {
1675
- ...y.query,
1676
- sort: { [f.field]: g?.sort[f.field] ? g?.sort[f.field] === "ASC" ? "DESC" : "" : "ASC" }
1677
- }
1678
- }, d),
1679
- className: "btn btn-sm",
1680
- to: "#",
1681
- children: g.sort[f.field] ? g.sort[f.field] === "ASC" ? "⇑" : "⇓" : "⇅"
1682
- }
1683
- )
1684
- ] }, m)),
1685
- a && l.length > 0 && /* @__PURE__ */ o("th", { className: "text-end", children: /* @__PURE__ */ o(U, { children: "Actions" }) })
1704
+ ...o || {}
1705
+ }, /* @__PURE__ */ r("div", { ..._, children: /* @__PURE__ */ C("table", { ...o, children: [
1706
+ /* @__PURE__ */ r("thead", { children: /* @__PURE__ */ C("tr", { children: [
1707
+ i.map((b, l) => /* @__PURE__ */ et("th", { ...b?.view?.header?.attr || {}, key: l }, /* @__PURE__ */ r(ln, { column: b, namespace: t }), b.sortable && p?.sort?.[b.field] !== void 0 && /* @__PURE__ */ r(
1708
+ M,
1709
+ {
1710
+ onClick: (d) => f && f({
1711
+ ...y,
1712
+ query: {
1713
+ ...y.query,
1714
+ sort: { [b.field]: p?.sort[b.field] ? p?.sort[b.field] === "ASC" ? "DESC" : "" : "ASC" }
1715
+ }
1716
+ }, d),
1717
+ className: "btn btn-sm",
1718
+ to: "#",
1719
+ children: p.sort[b.field] ? p.sort[b.field] === "ASC" ? "⇑" : "⇓" : "⇅"
1720
+ }
1721
+ ))),
1722
+ a && c.length > 0 && /* @__PURE__ */ r("th", { className: "text-end", children: /* @__PURE__ */ r(D, { children: "Actions" }) })
1686
1723
  ] }) }),
1687
- /* @__PURE__ */ o("tbody", { children: u.length ? u.map((f, m) => /* @__PURE__ */ o(Xt, { index: m, children: /* @__PURE__ */ _("tr", { children: [
1724
+ /* @__PURE__ */ r("tbody", { children: m.length ? m.map((b, l) => /* @__PURE__ */ r(rn, { index: l, children: /* @__PURE__ */ C("tr", { children: [
1688
1725
  i?.map(
1689
- (d, b) => /* @__PURE__ */ _("td", { children: [
1690
- b === 0 && /* @__PURE__ */ o(rn, { className: "me-2" }),
1691
- /* @__PURE__ */ o(en, { column: d, namespace: t })
1692
- ] }, b)
1726
+ (d, g) => {
1727
+ const h = n?.columns?.[d.field];
1728
+ return d = {
1729
+ ...d,
1730
+ ...h instanceof Function ? h(p?.entity?.data.items[l]) : n?.columns?.[d.field]
1731
+ }, /* @__PURE__ */ et("td", { ...d?.view?.content?.attr || {}, key: g }, g === 0 && /* @__PURE__ */ r(cn, { className: "me-2" }), /* @__PURE__ */ r(on, { column: d, namespace: t }));
1732
+ }
1693
1733
  ),
1694
- a && l.length > 0 && /* @__PURE__ */ o("td", { className: "text-end text-nowrap", children: /* @__PURE__ */ o(an, { routeParams: e, namespace: t }) })
1695
- ] }) }, m)) : /* @__PURE__ */ o("tr", { children: /* @__PURE__ */ o("td", { colSpan: c, children: /* @__PURE__ */ o(U, { children: "Not results found." }) }) }) })
1734
+ a && c.length > 0 && /* @__PURE__ */ r("td", { className: "text-end text-nowrap", children: /* @__PURE__ */ r(un, { routeParams: e, namespace: t }) })
1735
+ ] }) }, l)) : /* @__PURE__ */ r("tr", { children: /* @__PURE__ */ r("td", { colSpan: u, children: /* @__PURE__ */ r(D, { children: "Not results found." }) }) }) })
1696
1736
  ] }) });
1697
- }), se = ({ page: e, active: t = !1, title: n, children: r }) => {
1698
- const { generateActionLink: s } = T(), { onClick: i } = B(), { action: a } = ee(), l = {
1737
+ }, ie = ({ page: e, active: t = !1, title: n, children: o }) => {
1738
+ const { generateActionLink: s } = j(), { onClick: i } = $(), { action: a } = te(), c = {
1699
1739
  ...a,
1700
1740
  query: {
1701
1741
  ...a.query || {},
1702
1742
  page: e.toString()
1703
1743
  }
1704
- }, c = s(l);
1705
- return /* @__PURE__ */ o("li", { className: `page-item ${t ? "active" : ""}`, children: /* @__PURE__ */ o(
1706
- j,
1744
+ }, u = s(c);
1745
+ return /* @__PURE__ */ r("li", { className: `page-item ${t ? "active" : ""}`, children: /* @__PURE__ */ r(
1746
+ M,
1707
1747
  {
1708
- to: c.toString(),
1748
+ to: u.toString(),
1709
1749
  ...i && {
1710
- onClick: (u) => {
1711
- i(l, u);
1750
+ onClick: (m) => {
1751
+ i(c, m);
1712
1752
  }
1713
1753
  },
1714
1754
  className: "page-link",
1715
1755
  title: n,
1716
- children: r || e
1756
+ children: o || e
1717
1757
  }
1718
1758
  ) });
1719
- }, Er = () => {
1720
- const { data: e } = B(), t = e?.entity?.data.meta, n = 1, r = t?.totalPages || 0, s = t?.page || n, i = t?.links, a = !!t?.totalPages;
1721
- return a && /* @__PURE__ */ _("div", { className: "d-flex flex-column justiry-content-center", children: [
1722
- /* @__PURE__ */ _("small", { className: "mb-2", children: [
1759
+ }, xr = () => {
1760
+ const { data: e } = $(), t = e?.entity?.data.meta, n = 1, o = t?.totalPages || 0, s = t?.page || n, i = t?.links, a = !!t?.totalPages;
1761
+ return a && /* @__PURE__ */ C("div", { className: "d-flex flex-column justiry-content-center", children: [
1762
+ /* @__PURE__ */ C("small", { className: "mb-2", children: [
1723
1763
  t.totalResults,
1724
1764
  " Results",
1725
- a && /* @__PURE__ */ _(P, { children: [
1765
+ a && /* @__PURE__ */ C(A, { children: [
1726
1766
  " - Page ",
1727
1767
  s,
1728
1768
  " of ",
1729
1769
  t.totalPages
1730
1770
  ] })
1731
1771
  ] }),
1732
- a && /* @__PURE__ */ o("nav", { "aria-label": "Page navigation", className: "m-auto text-center d-inline", children: /* @__PURE__ */ _("ul", { className: "pagination pagination-sm", children: [
1733
- s > n && /* @__PURE__ */ o(se, { page: s - 1, title: "Go to First Page", children: "«" }),
1734
- t.links[0] !== n && /* @__PURE__ */ _(P, { children: [
1735
- /* @__PURE__ */ o(se, { page: 1, active: n === s }, 1),
1736
- /* @__PURE__ */ o("div", { className: "page-item", children: /* @__PURE__ */ o("a", { className: "page-link", children: "..." }) })
1772
+ a && /* @__PURE__ */ r("nav", { "aria-label": "Page navigation", className: "m-auto text-center d-inline", children: /* @__PURE__ */ C("ul", { className: "pagination pagination-sm", children: [
1773
+ s > n && /* @__PURE__ */ r(ie, { page: s - 1, title: "Go to First Page", children: "«" }),
1774
+ t.links[0] !== n && /* @__PURE__ */ C(A, { children: [
1775
+ /* @__PURE__ */ r(ie, { page: 1, active: n === s }, 1),
1776
+ /* @__PURE__ */ r("div", { className: "page-item", children: /* @__PURE__ */ r("a", { className: "page-link", children: "..." }) })
1737
1777
  ] }),
1738
- (i || []).map((l, c) => /* @__PURE__ */ o(se, { page: l, active: l === s }, c)),
1739
- [...t.links].reverse()[0] !== r && /* @__PURE__ */ _(P, { children: [
1740
- /* @__PURE__ */ o("div", { className: "page-item", children: /* @__PURE__ */ o("a", { className: "page-link", children: "..." }) }),
1741
- /* @__PURE__ */ o(
1742
- se,
1778
+ (i || []).map((c, u) => /* @__PURE__ */ r(ie, { page: c, active: c === s }, u)),
1779
+ [...t.links].reverse()[0] !== o && /* @__PURE__ */ C(A, { children: [
1780
+ /* @__PURE__ */ r("div", { className: "page-item", children: /* @__PURE__ */ r("a", { className: "page-link", children: "..." }) }),
1781
+ /* @__PURE__ */ r(
1782
+ ie,
1743
1783
  {
1744
- page: r,
1745
- active: r === s
1784
+ page: o,
1785
+ active: o === s
1746
1786
  },
1747
- r
1787
+ o
1748
1788
  )
1749
1789
  ] }),
1750
- s < r && /* @__PURE__ */ o(se, { page: t.totalPages, title: "Go to Last Page", children: "»" })
1790
+ s < o && /* @__PURE__ */ r(ie, { page: t.totalPages, title: "Go to Last Page", children: "»" })
1751
1791
  ] }) })
1752
1792
  ] });
1753
- }, $ = /* @__PURE__ */ new Map(), we = {
1793
+ }, q = /* @__PURE__ */ new Map(), we = {
1754
1794
  set(e, t, n) {
1755
- $.has(e) || $.set(e, /* @__PURE__ */ new Map());
1756
- const r = $.get(e);
1757
- if (!r.has(t) && r.size !== 0) {
1758
- console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(r.keys())[0]}.`);
1795
+ q.has(e) || q.set(e, /* @__PURE__ */ new Map());
1796
+ const o = q.get(e);
1797
+ if (!o.has(t) && o.size !== 0) {
1798
+ console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(o.keys())[0]}.`);
1759
1799
  return;
1760
1800
  }
1761
- r.set(t, n);
1801
+ o.set(t, n);
1762
1802
  },
1763
1803
  get(e, t) {
1764
- return $.has(e) && $.get(e).get(t) || null;
1804
+ return q.has(e) && q.get(e).get(t) || null;
1765
1805
  },
1766
1806
  remove(e, t) {
1767
- if (!$.has(e))
1807
+ if (!q.has(e))
1768
1808
  return;
1769
- const n = $.get(e);
1770
- n.delete(t), n.size === 0 && $.delete(e);
1809
+ const n = q.get(e);
1810
+ n.delete(t), n.size === 0 && q.delete(e);
1771
1811
  }
1772
- }, Cr = 1e3, Te = "transitionend", cn = (e) => (e && window.CSS && window.CSS.escape && (e = e.replace(/#([^\s"#']+)/g, (t, n) => `#${CSS.escape(n)}`)), e), _r = (e) => e == null ? `${e}` : Object.prototype.toString.call(e).match(/\s([a-z]+)/i)[1].toLowerCase(), xr = (e) => {
1812
+ }, Nr = 1e3, Ie = "transitionend", mn = (e) => (e && window.CSS && window.CSS.escape && (e = e.replace(/#([^\s"#']+)/g, (t, n) => `#${CSS.escape(n)}`)), e), wr = (e) => e == null ? `${e}` : Object.prototype.toString.call(e).match(/\s([a-z]+)/i)[1].toLowerCase(), Ar = (e) => {
1773
1813
  if (!e)
1774
1814
  return 0;
1775
1815
  let { transitionDuration: t, transitionDelay: n } = window.getComputedStyle(e);
1776
- const r = Number.parseFloat(t), s = Number.parseFloat(n);
1777
- return !r && !s ? 0 : (t = t.split(",")[0], n = n.split(",")[0], (Number.parseFloat(t) + Number.parseFloat(n)) * Cr);
1778
- }, wr = (e) => {
1779
- e.dispatchEvent(new Event(Te));
1780
- }, G = (e) => !e || typeof e != "object" ? !1 : (typeof e.jquery < "u" && (e = e[0]), typeof e.nodeType < "u"), Ie = (e) => G(e) ? e.jquery ? e[0] : e : typeof e == "string" && e.length > 0 ? document.querySelector(cn(e)) : null, ln = (e) => {
1781
- if (!G(e) || e.getClientRects().length === 0)
1816
+ const o = Number.parseFloat(t), s = Number.parseFloat(n);
1817
+ return !o && !s ? 0 : (t = t.split(",")[0], n = n.split(",")[0], (Number.parseFloat(t) + Number.parseFloat(n)) * Nr);
1818
+ }, Pr = (e) => {
1819
+ e.dispatchEvent(new Event(Ie));
1820
+ }, Y = (e) => !e || typeof e != "object" ? !1 : (typeof e.jquery < "u" && (e = e[0]), typeof e.nodeType < "u"), je = (e) => Y(e) ? e.jquery ? e[0] : e : typeof e == "string" && e.length > 0 ? document.querySelector(mn(e)) : null, fn = (e) => {
1821
+ if (!Y(e) || e.getClientRects().length === 0)
1782
1822
  return !1;
1783
1823
  const t = getComputedStyle(e).getPropertyValue("visibility") === "visible", n = e.closest("details:not([open])");
1784
1824
  if (!n)
1785
1825
  return t;
1786
1826
  if (n !== e) {
1787
- const r = e.closest("summary");
1788
- if (r && r.parentNode !== n || r === null)
1827
+ const o = e.closest("summary");
1828
+ if (o && o.parentNode !== n || o === null)
1789
1829
  return !1;
1790
1830
  }
1791
1831
  return t;
1792
- }, je = (e) => !e || e.nodeType !== Node.ELEMENT_NODE || e.classList.contains("disabled") ? !0 : typeof e.disabled < "u" ? e.disabled : e.hasAttribute("disabled") && e.getAttribute("disabled") !== "false", nt = () => {
1793
- }, dn = () => window.jQuery && !document.body.hasAttribute("data-bs-no-jquery") ? window.jQuery : null, Ne = [], Nr = (e) => {
1794
- document.readyState === "loading" ? (Ne.length || document.addEventListener("DOMContentLoaded", () => {
1795
- for (const t of Ne)
1832
+ }, Fe = (e) => !e || e.nodeType !== Node.ELEMENT_NODE || e.classList.contains("disabled") ? !0 : typeof e.disabled < "u" ? e.disabled : e.hasAttribute("disabled") && e.getAttribute("disabled") !== "false", it = () => {
1833
+ }, pn = () => window.jQuery && !document.body.hasAttribute("data-bs-no-jquery") ? window.jQuery : null, Ae = [], Lr = (e) => {
1834
+ document.readyState === "loading" ? (Ae.length || document.addEventListener("DOMContentLoaded", () => {
1835
+ for (const t of Ae)
1796
1836
  t();
1797
- }), Ne.push(e)) : e();
1798
- }, re = () => document.documentElement.dir === "rtl", Ar = (e) => {
1799
- Nr(() => {
1800
- const t = dn();
1837
+ }), Ae.push(e)) : e();
1838
+ }, oe = () => document.documentElement.dir === "rtl", Or = (e) => {
1839
+ Lr(() => {
1840
+ const t = pn();
1801
1841
  if (t) {
1802
- const n = e.NAME, r = t.fn[n];
1803
- t.fn[n] = e.jQueryInterface, t.fn[n].Constructor = e, t.fn[n].noConflict = () => (t.fn[n] = r, e.jQueryInterface);
1842
+ const n = e.NAME, o = t.fn[n];
1843
+ t.fn[n] = e.jQueryInterface, t.fn[n].Constructor = e, t.fn[n].noConflict = () => (t.fn[n] = o, e.jQueryInterface);
1804
1844
  }
1805
1845
  });
1806
- }, Fe = (e, t = [], n = e) => typeof e == "function" ? e.call(...t) : n, Pr = (e, t, n = !0) => {
1846
+ }, Me = (e, t = [], n = e) => typeof e == "function" ? e.call(...t) : n, Sr = (e, t, n = !0) => {
1807
1847
  if (!n) {
1808
- Fe(e);
1848
+ Me(e);
1809
1849
  return;
1810
1850
  }
1811
- const s = xr(t) + 5;
1851
+ const s = Ar(t) + 5;
1812
1852
  let i = !1;
1813
- const a = ({ target: l }) => {
1814
- l === t && (i = !0, t.removeEventListener(Te, a), Fe(e));
1853
+ const a = ({ target: c }) => {
1854
+ c === t && (i = !0, t.removeEventListener(Ie, a), Me(e));
1815
1855
  };
1816
- t.addEventListener(Te, a), setTimeout(() => {
1817
- i || wr(t);
1856
+ t.addEventListener(Ie, a), setTimeout(() => {
1857
+ i || Pr(t);
1818
1858
  }, s);
1819
- }, Lr = (e, t, n, r) => {
1859
+ }, kr = (e, t, n, o) => {
1820
1860
  const s = e.length;
1821
1861
  let i = e.indexOf(t);
1822
- return i === -1 ? !n && r ? e[s - 1] : e[0] : (i += n ? 1 : -1, r && (i = (i + s) % s), e[Math.max(0, Math.min(i, s - 1))]);
1823
- }, Or = /[^.]*(?=\..*)\.|.*/, Sr = /\..*/, Rr = /::\d+$/, Ae = {};
1824
- let rt = 1;
1825
- const un = {
1862
+ return i === -1 ? !n && o ? e[s - 1] : e[0] : (i += n ? 1 : -1, o && (i = (i + s) % s), e[Math.max(0, Math.min(i, s - 1))]);
1863
+ }, Dr = /[^.]*(?=\..*)\.|.*/, Rr = /\..*/, Tr = /::\d+$/, Pe = {};
1864
+ let at = 1;
1865
+ const hn = {
1826
1866
  mouseenter: "mouseover",
1827
1867
  mouseleave: "mouseout"
1828
- }, kr = /* @__PURE__ */ new Set([
1868
+ }, Ir = /* @__PURE__ */ new Set([
1829
1869
  "click",
1830
1870
  "dblclick",
1831
1871
  "mouseup",
@@ -1873,113 +1913,113 @@ const un = {
1873
1913
  "abort",
1874
1914
  "scroll"
1875
1915
  ]);
1876
- function mn(e, t) {
1877
- return t && `${t}::${rt++}` || e.uidEvent || rt++;
1916
+ function gn(e, t) {
1917
+ return t && `${t}::${at++}` || e.uidEvent || at++;
1878
1918
  }
1879
- function fn(e) {
1880
- const t = mn(e);
1881
- return e.uidEvent = t, Ae[t] = Ae[t] || {}, Ae[t];
1919
+ function bn(e) {
1920
+ const t = gn(e);
1921
+ return e.uidEvent = t, Pe[t] = Pe[t] || {}, Pe[t];
1882
1922
  }
1883
- function Dr(e, t) {
1884
- return function n(r) {
1885
- return Ge(r, { delegateTarget: e }), n.oneOff && D.off(e, r.type, t), t.apply(e, [r]);
1923
+ function jr(e, t) {
1924
+ return function n(o) {
1925
+ return We(o, { delegateTarget: e }), n.oneOff && I.off(e, o.type, t), t.apply(e, [o]);
1886
1926
  };
1887
1927
  }
1888
- function Tr(e, t, n) {
1889
- return function r(s) {
1928
+ function Fr(e, t, n) {
1929
+ return function o(s) {
1890
1930
  const i = e.querySelectorAll(t);
1891
1931
  for (let { target: a } = s; a && a !== this; a = a.parentNode)
1892
- for (const l of i)
1893
- if (l === a)
1894
- return Ge(s, { delegateTarget: a }), r.oneOff && D.off(e, s.type, t, n), n.apply(a, [s]);
1932
+ for (const c of i)
1933
+ if (c === a)
1934
+ return We(s, { delegateTarget: a }), o.oneOff && I.off(e, s.type, t, n), n.apply(a, [s]);
1895
1935
  };
1896
1936
  }
1897
- function pn(e, t, n = null) {
1898
- return Object.values(e).find((r) => r.callable === t && r.delegationSelector === n);
1937
+ function yn(e, t, n = null) {
1938
+ return Object.values(e).find((o) => o.callable === t && o.delegationSelector === n);
1899
1939
  }
1900
- function hn(e, t, n) {
1901
- const r = typeof t == "string", s = r ? n : t || n;
1902
- let i = gn(e);
1903
- return kr.has(i) || (i = e), [r, s, i];
1940
+ function vn(e, t, n) {
1941
+ const o = typeof t == "string", s = o ? n : t || n;
1942
+ let i = En(e);
1943
+ return Ir.has(i) || (i = e), [o, s, i];
1904
1944
  }
1905
- function ot(e, t, n, r, s) {
1945
+ function ct(e, t, n, o, s) {
1906
1946
  if (typeof t != "string" || !e)
1907
1947
  return;
1908
- let [i, a, l] = hn(t, n, r);
1909
- t in un && (a = ((C) => function(f) {
1910
- if (!f.relatedTarget || f.relatedTarget !== f.delegateTarget && !f.delegateTarget.contains(f.relatedTarget))
1911
- return C.call(this, f);
1948
+ let [i, a, c] = vn(t, n, o);
1949
+ t in hn && (a = ((_) => function(b) {
1950
+ if (!b.relatedTarget || b.relatedTarget !== b.delegateTarget && !b.delegateTarget.contains(b.relatedTarget))
1951
+ return _.call(this, b);
1912
1952
  })(a));
1913
- const c = fn(e), u = c[l] || (c[l] = {}), g = pn(u, a, i ? n : null);
1914
- if (g) {
1915
- g.oneOff = g.oneOff && s;
1953
+ const u = bn(e), m = u[c] || (u[c] = {}), p = yn(m, a, i ? n : null);
1954
+ if (p) {
1955
+ p.oneOff = p.oneOff && s;
1916
1956
  return;
1917
1957
  }
1918
- const h = mn(a, t.replace(Or, "")), y = i ? Tr(e, n, a) : Dr(e, a);
1919
- y.delegationSelector = i ? n : null, y.callable = a, y.oneOff = s, y.uidEvent = h, u[h] = y, e.addEventListener(l, y, i);
1958
+ const f = gn(a, t.replace(Dr, "")), y = i ? Fr(e, n, a) : jr(e, a);
1959
+ y.delegationSelector = i ? n : null, y.callable = a, y.oneOff = s, y.uidEvent = f, m[f] = y, e.addEventListener(c, y, i);
1920
1960
  }
1921
- function Me(e, t, n, r, s) {
1922
- const i = pn(t[n], r, s);
1961
+ function Ue(e, t, n, o, s) {
1962
+ const i = yn(t[n], o, s);
1923
1963
  i && (e.removeEventListener(n, i, !!s), delete t[n][i.uidEvent]);
1924
1964
  }
1925
- function Ir(e, t, n, r) {
1965
+ function Mr(e, t, n, o) {
1926
1966
  const s = t[n] || {};
1927
1967
  for (const [i, a] of Object.entries(s))
1928
- i.includes(r) && Me(e, t, n, a.callable, a.delegationSelector);
1968
+ i.includes(o) && Ue(e, t, n, a.callable, a.delegationSelector);
1929
1969
  }
1930
- function gn(e) {
1931
- return e = e.replace(Sr, ""), un[e] || e;
1970
+ function En(e) {
1971
+ return e = e.replace(Rr, ""), hn[e] || e;
1932
1972
  }
1933
- const D = {
1934
- on(e, t, n, r) {
1935
- ot(e, t, n, r, !1);
1973
+ const I = {
1974
+ on(e, t, n, o) {
1975
+ ct(e, t, n, o, !1);
1936
1976
  },
1937
- one(e, t, n, r) {
1938
- ot(e, t, n, r, !0);
1977
+ one(e, t, n, o) {
1978
+ ct(e, t, n, o, !0);
1939
1979
  },
1940
- off(e, t, n, r) {
1980
+ off(e, t, n, o) {
1941
1981
  if (typeof t != "string" || !e)
1942
1982
  return;
1943
- const [s, i, a] = hn(t, n, r), l = a !== t, c = fn(e), u = c[a] || {}, g = t.startsWith(".");
1983
+ const [s, i, a] = vn(t, n, o), c = a !== t, u = bn(e), m = u[a] || {}, p = t.startsWith(".");
1944
1984
  if (typeof i < "u") {
1945
- if (!Object.keys(u).length)
1985
+ if (!Object.keys(m).length)
1946
1986
  return;
1947
- Me(e, c, a, i, s ? n : null);
1987
+ Ue(e, u, a, i, s ? n : null);
1948
1988
  return;
1949
1989
  }
1950
- if (g)
1951
- for (const h of Object.keys(c))
1952
- Ir(e, c, h, t.slice(1));
1953
- for (const [h, y] of Object.entries(u)) {
1954
- const E = h.replace(Rr, "");
1955
- (!l || t.includes(E)) && Me(e, c, a, y.callable, y.delegationSelector);
1990
+ if (p)
1991
+ for (const f of Object.keys(u))
1992
+ Mr(e, u, f, t.slice(1));
1993
+ for (const [f, y] of Object.entries(m)) {
1994
+ const E = f.replace(Tr, "");
1995
+ (!c || t.includes(E)) && Ue(e, u, a, y.callable, y.delegationSelector);
1956
1996
  }
1957
1997
  },
1958
1998
  trigger(e, t, n) {
1959
1999
  if (typeof t != "string" || !e)
1960
2000
  return null;
1961
- const r = dn(), s = gn(t), i = t !== s;
1962
- let a = null, l = !0, c = !0, u = !1;
1963
- i && r && (a = r.Event(t, n), r(e).trigger(a), l = !a.isPropagationStopped(), c = !a.isImmediatePropagationStopped(), u = a.isDefaultPrevented());
1964
- const g = Ge(new Event(t, { bubbles: l, cancelable: !0 }), n);
1965
- return u && g.preventDefault(), c && e.dispatchEvent(g), g.defaultPrevented && a && a.preventDefault(), g;
2001
+ const o = pn(), s = En(t), i = t !== s;
2002
+ let a = null, c = !0, u = !0, m = !1;
2003
+ i && o && (a = o.Event(t, n), o(e).trigger(a), c = !a.isPropagationStopped(), u = !a.isImmediatePropagationStopped(), m = a.isDefaultPrevented());
2004
+ const p = We(new Event(t, { bubbles: c, cancelable: !0 }), n);
2005
+ return m && p.preventDefault(), u && e.dispatchEvent(p), p.defaultPrevented && a && a.preventDefault(), p;
1966
2006
  }
1967
2007
  };
1968
- function Ge(e, t = {}) {
1969
- for (const [n, r] of Object.entries(t))
2008
+ function We(e, t = {}) {
2009
+ for (const [n, o] of Object.entries(t))
1970
2010
  try {
1971
- e[n] = r;
2011
+ e[n] = o;
1972
2012
  } catch {
1973
2013
  Object.defineProperty(e, n, {
1974
2014
  configurable: !0,
1975
2015
  get() {
1976
- return r;
2016
+ return o;
1977
2017
  }
1978
2018
  });
1979
2019
  }
1980
2020
  return e;
1981
2021
  }
1982
- function st(e) {
2022
+ function lt(e) {
1983
2023
  if (e === "true")
1984
2024
  return !0;
1985
2025
  if (e === "false")
@@ -1996,31 +2036,31 @@ function st(e) {
1996
2036
  return e;
1997
2037
  }
1998
2038
  }
1999
- function Pe(e) {
2039
+ function Le(e) {
2000
2040
  return e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`);
2001
2041
  }
2002
- const be = {
2042
+ const ve = {
2003
2043
  setDataAttribute(e, t, n) {
2004
- e.setAttribute(`data-bs-${Pe(t)}`, n);
2044
+ e.setAttribute(`data-bs-${Le(t)}`, n);
2005
2045
  },
2006
2046
  removeDataAttribute(e, t) {
2007
- e.removeAttribute(`data-bs-${Pe(t)}`);
2047
+ e.removeAttribute(`data-bs-${Le(t)}`);
2008
2048
  },
2009
2049
  getDataAttributes(e) {
2010
2050
  if (!e)
2011
2051
  return {};
2012
- const t = {}, n = Object.keys(e.dataset).filter((r) => r.startsWith("bs") && !r.startsWith("bsConfig"));
2013
- for (const r of n) {
2014
- let s = r.replace(/^bs/, "");
2015
- s = s.charAt(0).toLowerCase() + s.slice(1), t[s] = st(e.dataset[r]);
2052
+ const t = {}, n = Object.keys(e.dataset).filter((o) => o.startsWith("bs") && !o.startsWith("bsConfig"));
2053
+ for (const o of n) {
2054
+ let s = o.replace(/^bs/, "");
2055
+ s = s.charAt(0).toLowerCase() + s.slice(1), t[s] = lt(e.dataset[o]);
2016
2056
  }
2017
2057
  return t;
2018
2058
  },
2019
2059
  getDataAttribute(e, t) {
2020
- return st(e.getAttribute(`data-bs-${Pe(t)}`));
2060
+ return lt(e.getAttribute(`data-bs-${Le(t)}`));
2021
2061
  }
2022
2062
  };
2023
- class jr {
2063
+ class Ur {
2024
2064
  // Getters
2025
2065
  static get Default() {
2026
2066
  return {};
@@ -2038,51 +2078,51 @@ class jr {
2038
2078
  return t;
2039
2079
  }
2040
2080
  _mergeConfigObj(t, n) {
2041
- const r = G(n) ? be.getDataAttribute(n, "config") : {};
2081
+ const o = Y(n) ? ve.getDataAttribute(n, "config") : {};
2042
2082
  return {
2043
2083
  ...this.constructor.Default,
2044
- ...typeof r == "object" ? r : {},
2045
- ...G(n) ? be.getDataAttributes(n) : {},
2084
+ ...typeof o == "object" ? o : {},
2085
+ ...Y(n) ? ve.getDataAttributes(n) : {},
2046
2086
  ...typeof t == "object" ? t : {}
2047
2087
  };
2048
2088
  }
2049
2089
  _typeCheckConfig(t, n = this.constructor.DefaultType) {
2050
- for (const [r, s] of Object.entries(n)) {
2051
- const i = t[r], a = G(i) ? "element" : _r(i);
2090
+ for (const [o, s] of Object.entries(n)) {
2091
+ const i = t[o], a = Y(i) ? "element" : wr(i);
2052
2092
  if (!new RegExp(s).test(a))
2053
2093
  throw new TypeError(
2054
- `${this.constructor.NAME.toUpperCase()}: Option "${r}" provided type "${a}" but expected type "${s}".`
2094
+ `${this.constructor.NAME.toUpperCase()}: Option "${o}" provided type "${a}" but expected type "${s}".`
2055
2095
  );
2056
2096
  }
2057
2097
  }
2058
2098
  }
2059
- const Fr = "5.3.8";
2060
- class Mr extends jr {
2099
+ const Vr = "5.3.8";
2100
+ class Br extends Ur {
2061
2101
  constructor(t, n) {
2062
- super(), t = Ie(t), t && (this._element = t, this._config = this._getConfig(n), we.set(this._element, this.constructor.DATA_KEY, this));
2102
+ super(), t = je(t), t && (this._element = t, this._config = this._getConfig(n), we.set(this._element, this.constructor.DATA_KEY, this));
2063
2103
  }
2064
2104
  // Public
2065
2105
  dispose() {
2066
- we.remove(this._element, this.constructor.DATA_KEY), D.off(this._element, this.constructor.EVENT_KEY);
2106
+ we.remove(this._element, this.constructor.DATA_KEY), I.off(this._element, this.constructor.EVENT_KEY);
2067
2107
  for (const t of Object.getOwnPropertyNames(this))
2068
2108
  this[t] = null;
2069
2109
  }
2070
2110
  // Private
2071
- _queueCallback(t, n, r = !0) {
2072
- Pr(t, n, r);
2111
+ _queueCallback(t, n, o = !0) {
2112
+ Sr(t, n, o);
2073
2113
  }
2074
2114
  _getConfig(t) {
2075
2115
  return t = this._mergeConfigObj(t, this._element), t = this._configAfterMerge(t), this._typeCheckConfig(t), t;
2076
2116
  }
2077
2117
  // Static
2078
2118
  static getInstance(t) {
2079
- return we.get(Ie(t), this.DATA_KEY);
2119
+ return we.get(je(t), this.DATA_KEY);
2080
2120
  }
2081
2121
  static getOrCreateInstance(t, n = {}) {
2082
2122
  return this.getInstance(t) || new this(t, typeof n == "object" ? n : null);
2083
2123
  }
2084
2124
  static get VERSION() {
2085
- return Fr;
2125
+ return Vr;
2086
2126
  }
2087
2127
  static get DATA_KEY() {
2088
2128
  return `bs.${this.NAME}`;
@@ -2094,7 +2134,7 @@ class Mr extends jr {
2094
2134
  return `${t}${this.EVENT_KEY}`;
2095
2135
  }
2096
2136
  }
2097
- const Le = (e) => {
2137
+ const Oe = (e) => {
2098
2138
  let t = e.getAttribute("data-bs-target");
2099
2139
  if (!t || t === "#") {
2100
2140
  let n = e.getAttribute("href");
@@ -2102,8 +2142,8 @@ const Le = (e) => {
2102
2142
  return null;
2103
2143
  n.includes("#") && !n.startsWith("#") && (n = `#${n.split("#")[1]}`), t = n && n !== "#" ? n.trim() : null;
2104
2144
  }
2105
- return t ? t.split(",").map((n) => cn(n)).join(",") : null;
2106
- }, M = {
2145
+ return t ? t.split(",").map((n) => mn(n)).join(",") : null;
2146
+ }, V = {
2107
2147
  find(e, t = document.documentElement) {
2108
2148
  return [].concat(...Element.prototype.querySelectorAll.call(t, e));
2109
2149
  },
@@ -2115,9 +2155,9 @@ const Le = (e) => {
2115
2155
  },
2116
2156
  parents(e, t) {
2117
2157
  const n = [];
2118
- let r = e.parentNode.closest(t);
2119
- for (; r; )
2120
- n.push(r), r = r.parentNode.closest(t);
2158
+ let o = e.parentNode.closest(t);
2159
+ for (; o; )
2160
+ n.push(o), o = o.parentNode.closest(t);
2121
2161
  return n;
2122
2162
  },
2123
2163
  prev(e, t) {
@@ -2150,28 +2190,28 @@ const Le = (e) => {
2150
2190
  "[tabindex]",
2151
2191
  '[contenteditable="true"]'
2152
2192
  ].map((n) => `${n}:not([tabindex^="-"])`).join(",");
2153
- return this.find(t, e).filter((n) => !je(n) && ln(n));
2193
+ return this.find(t, e).filter((n) => !Fe(n) && fn(n));
2154
2194
  },
2155
2195
  getSelectorFromElement(e) {
2156
- const t = Le(e);
2157
- return t && M.findOne(t) ? t : null;
2196
+ const t = Oe(e);
2197
+ return t && V.findOne(t) ? t : null;
2158
2198
  },
2159
2199
  getElementFromSelector(e) {
2160
- const t = Le(e);
2161
- return t ? M.findOne(t) : null;
2200
+ const t = Oe(e);
2201
+ return t ? V.findOne(t) : null;
2162
2202
  },
2163
2203
  getMultipleElementsFromSelector(e) {
2164
- const t = Le(e);
2165
- return t ? M.find(t) : [];
2204
+ const t = Oe(e);
2205
+ return t ? V.find(t) : [];
2166
2206
  }
2167
- }, it = "dropdown", Ur = "bs.dropdown", W = `.${Ur}`, Ye = ".data-api", Vr = "Escape", at = "Tab", Br = "ArrowUp", ct = "ArrowDown", $r = 2, qr = `hide${W}`, Hr = `hidden${W}`, Kr = `show${W}`, Gr = `shown${W}`, bn = `click${W}${Ye}`, vn = `keydown${W}${Ye}`, Yr = `keyup${W}${Ye}`, J = "show", Wr = "dropup", zr = "dropend", Jr = "dropstart", Qr = "dropup-center", Zr = "dropdown-center", K = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)', Xr = `${K}.${J}`, pe = ".dropdown-menu", eo = ".navbar", to = ".navbar-nav", no = ".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)", ro = re() ? "top-end" : "top-start", oo = re() ? "top-start" : "top-end", so = re() ? "bottom-end" : "bottom-start", io = re() ? "bottom-start" : "bottom-end", ao = re() ? "left-start" : "right-start", co = re() ? "right-start" : "left-start", lo = "top", uo = "bottom", mo = {
2207
+ }, dt = "dropdown", $r = "bs.dropdown", z = `.${$r}`, ze = ".data-api", qr = "Escape", ut = "Tab", Hr = "ArrowUp", mt = "ArrowDown", Kr = 2, Gr = `hide${z}`, Yr = `hidden${z}`, Wr = `show${z}`, zr = `shown${z}`, Cn = `click${z}${ze}`, _n = `keydown${z}${ze}`, Jr = `keyup${z}${ze}`, Q = "show", Qr = "dropup", Zr = "dropend", Xr = "dropstart", eo = "dropup-center", to = "dropdown-center", G = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)', no = `${G}.${Q}`, ge = ".dropdown-menu", ro = ".navbar", oo = ".navbar-nav", so = ".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)", io = oe() ? "top-end" : "top-start", ao = oe() ? "top-start" : "top-end", co = oe() ? "bottom-end" : "bottom-start", lo = oe() ? "bottom-start" : "bottom-end", uo = oe() ? "left-start" : "right-start", mo = oe() ? "right-start" : "left-start", fo = "top", po = "bottom", ho = {
2168
2208
  autoClose: !0,
2169
2209
  boundary: "clippingParents",
2170
2210
  display: "dynamic",
2171
2211
  offset: [0, 2],
2172
2212
  popperConfig: null,
2173
2213
  reference: "toggle"
2174
- }, fo = {
2214
+ }, go = {
2175
2215
  autoClose: "(boolean|string)",
2176
2216
  boundary: "(string|element)",
2177
2217
  display: "string",
@@ -2179,39 +2219,39 @@ const Le = (e) => {
2179
2219
  popperConfig: "(null|object|function)",
2180
2220
  reference: "(string|element|object)"
2181
2221
  };
2182
- let z = class he extends Mr {
2222
+ let J = class be extends Br {
2183
2223
  constructor(t, n) {
2184
- super(t, n), this._popper = null, this._parent = this._element.parentNode, this._menu = M.next(this._element, pe)[0] || M.prev(this._element, pe)[0] || M.findOne(pe, this._parent), this._inNavbar = this._detectNavbar();
2224
+ super(t, n), this._popper = null, this._parent = this._element.parentNode, this._menu = V.next(this._element, ge)[0] || V.prev(this._element, ge)[0] || V.findOne(ge, this._parent), this._inNavbar = this._detectNavbar();
2185
2225
  }
2186
2226
  // Getters
2187
2227
  static get Default() {
2188
- return mo;
2228
+ return ho;
2189
2229
  }
2190
2230
  static get DefaultType() {
2191
- return fo;
2231
+ return go;
2192
2232
  }
2193
2233
  static get NAME() {
2194
- return it;
2234
+ return dt;
2195
2235
  }
2196
2236
  // Public
2197
2237
  toggle() {
2198
2238
  return this._isShown() ? this.hide() : this.show();
2199
2239
  }
2200
2240
  show() {
2201
- if (je(this._element) || this._isShown())
2241
+ if (Fe(this._element) || this._isShown())
2202
2242
  return;
2203
2243
  const t = {
2204
2244
  relatedTarget: this._element
2205
2245
  };
2206
- if (!D.trigger(this._element, Kr, t).defaultPrevented) {
2207
- if (this._createPopper(), "ontouchstart" in document.documentElement && !this._parent.closest(to))
2208
- for (const r of [].concat(...document.body.children))
2209
- D.on(r, "mouseover", nt);
2210
- this._element.focus(), this._element.setAttribute("aria-expanded", !0), this._menu.classList.add(J), this._element.classList.add(J), D.trigger(this._element, Gr, t);
2246
+ if (!I.trigger(this._element, Wr, t).defaultPrevented) {
2247
+ if (this._createPopper(), "ontouchstart" in document.documentElement && !this._parent.closest(oo))
2248
+ for (const o of [].concat(...document.body.children))
2249
+ I.on(o, "mouseover", it);
2250
+ this._element.focus(), this._element.setAttribute("aria-expanded", !0), this._menu.classList.add(Q), this._element.classList.add(Q), I.trigger(this._element, zr, t);
2211
2251
  }
2212
2252
  }
2213
2253
  hide() {
2214
- if (je(this._element) || !this._isShown())
2254
+ if (Fe(this._element) || !this._isShown())
2215
2255
  return;
2216
2256
  const t = {
2217
2257
  relatedTarget: this._element
@@ -2226,44 +2266,44 @@ let z = class he extends Mr {
2226
2266
  }
2227
2267
  // Private
2228
2268
  _completeHide(t) {
2229
- if (!D.trigger(this._element, qr, t).defaultPrevented) {
2269
+ if (!I.trigger(this._element, Gr, t).defaultPrevented) {
2230
2270
  if ("ontouchstart" in document.documentElement)
2231
- for (const r of [].concat(...document.body.children))
2232
- D.off(r, "mouseover", nt);
2233
- this._popper && this._popper.destroy(), this._menu.classList.remove(J), this._element.classList.remove(J), this._element.setAttribute("aria-expanded", "false"), be.removeDataAttribute(this._menu, "popper"), D.trigger(this._element, Hr, t);
2271
+ for (const o of [].concat(...document.body.children))
2272
+ I.off(o, "mouseover", it);
2273
+ this._popper && this._popper.destroy(), this._menu.classList.remove(Q), this._element.classList.remove(Q), this._element.setAttribute("aria-expanded", "false"), ve.removeDataAttribute(this._menu, "popper"), I.trigger(this._element, Yr, t);
2234
2274
  }
2235
2275
  }
2236
2276
  _getConfig(t) {
2237
- if (t = super._getConfig(t), typeof t.reference == "object" && !G(t.reference) && typeof t.reference.getBoundingClientRect != "function")
2238
- throw new TypeError(`${it.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
2277
+ if (t = super._getConfig(t), typeof t.reference == "object" && !Y(t.reference) && typeof t.reference.getBoundingClientRect != "function")
2278
+ throw new TypeError(`${dt.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
2239
2279
  return t;
2240
2280
  }
2241
2281
  _createPopper() {
2242
- if (typeof Qe > "u")
2282
+ if (typeof tt > "u")
2243
2283
  throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org/docs/v2/)");
2244
2284
  let t = this._element;
2245
- this._config.reference === "parent" ? t = this._parent : G(this._config.reference) ? t = Ie(this._config.reference) : typeof this._config.reference == "object" && (t = this._config.reference);
2285
+ this._config.reference === "parent" ? t = this._parent : Y(this._config.reference) ? t = je(this._config.reference) : typeof this._config.reference == "object" && (t = this._config.reference);
2246
2286
  const n = this._getPopperConfig();
2247
- this._popper = Qe.createPopper(t, this._menu, n);
2287
+ this._popper = tt.createPopper(t, this._menu, n);
2248
2288
  }
2249
2289
  _isShown() {
2250
- return this._menu.classList.contains(J);
2290
+ return this._menu.classList.contains(Q);
2251
2291
  }
2252
2292
  _getPlacement() {
2253
2293
  const t = this._parent;
2254
- if (t.classList.contains(zr))
2255
- return ao;
2256
- if (t.classList.contains(Jr))
2257
- return co;
2258
- if (t.classList.contains(Qr))
2259
- return lo;
2260
2294
  if (t.classList.contains(Zr))
2261
2295
  return uo;
2296
+ if (t.classList.contains(Xr))
2297
+ return mo;
2298
+ if (t.classList.contains(eo))
2299
+ return fo;
2300
+ if (t.classList.contains(to))
2301
+ return po;
2262
2302
  const n = getComputedStyle(this._menu).getPropertyValue("--bs-position").trim() === "end";
2263
- return t.classList.contains(Wr) ? n ? oo : ro : n ? io : so;
2303
+ return t.classList.contains(Qr) ? n ? ao : io : n ? lo : co;
2264
2304
  }
2265
2305
  _detectNavbar() {
2266
- return this._element.closest(eo) !== null;
2306
+ return this._element.closest(ro) !== null;
2267
2307
  }
2268
2308
  _getOffset() {
2269
2309
  const { offset: t } = this._config;
@@ -2287,22 +2327,22 @@ let z = class he extends Mr {
2287
2327
  }
2288
2328
  ]
2289
2329
  };
2290
- return (this._inNavbar || this._config.display === "static") && (be.setDataAttribute(this._menu, "popper", "static"), t.modifiers = [{
2330
+ return (this._inNavbar || this._config.display === "static") && (ve.setDataAttribute(this._menu, "popper", "static"), t.modifiers = [{
2291
2331
  name: "applyStyles",
2292
2332
  enabled: !1
2293
2333
  }]), {
2294
2334
  ...t,
2295
- ...Fe(this._config.popperConfig, [void 0, t])
2335
+ ...Me(this._config.popperConfig, [void 0, t])
2296
2336
  };
2297
2337
  }
2298
2338
  _selectMenuItem({ key: t, target: n }) {
2299
- const r = M.find(no, this._menu).filter((s) => ln(s));
2300
- r.length && Lr(r, n, t === ct, !r.includes(n)).focus();
2339
+ const o = V.find(so, this._menu).filter((s) => fn(s));
2340
+ o.length && kr(o, n, t === mt, !o.includes(n)).focus();
2301
2341
  }
2302
2342
  // Static
2303
2343
  static jQueryInterface(t) {
2304
2344
  return this.each(function() {
2305
- const n = he.getOrCreateInstance(this, t);
2345
+ const n = be.getOrCreateInstance(this, t);
2306
2346
  if (typeof t == "string") {
2307
2347
  if (typeof n[t] > "u")
2308
2348
  throw new TypeError(`No method named "${t}"`);
@@ -2311,26 +2351,26 @@ let z = class he extends Mr {
2311
2351
  });
2312
2352
  }
2313
2353
  static clearMenus(t) {
2314
- if (t.button === $r || t.type === "keyup" && t.key !== at)
2354
+ if (t.button === Kr || t.type === "keyup" && t.key !== ut)
2315
2355
  return;
2316
- const n = M.find(Xr);
2317
- for (const r of n) {
2318
- const s = he.getInstance(r);
2356
+ const n = V.find(no);
2357
+ for (const o of n) {
2358
+ const s = be.getInstance(o);
2319
2359
  if (!s || s._config.autoClose === !1)
2320
2360
  continue;
2321
2361
  const i = t.composedPath(), a = i.includes(s._menu);
2322
- if (i.includes(s._element) || s._config.autoClose === "inside" && !a || s._config.autoClose === "outside" && a || s._menu.contains(t.target) && (t.type === "keyup" && t.key === at || /input|select|option|textarea|form/i.test(t.target.tagName)))
2362
+ if (i.includes(s._element) || s._config.autoClose === "inside" && !a || s._config.autoClose === "outside" && a || s._menu.contains(t.target) && (t.type === "keyup" && t.key === ut || /input|select|option|textarea|form/i.test(t.target.tagName)))
2323
2363
  continue;
2324
- const l = { relatedTarget: s._element };
2325
- t.type === "click" && (l.clickEvent = t), s._completeHide(l);
2364
+ const c = { relatedTarget: s._element };
2365
+ t.type === "click" && (c.clickEvent = t), s._completeHide(c);
2326
2366
  }
2327
2367
  }
2328
2368
  static dataApiKeydownHandler(t) {
2329
- const n = /input|textarea/i.test(t.target.tagName), r = t.key === Vr, s = [Br, ct].includes(t.key);
2330
- if (!s && !r || n && !r)
2369
+ const n = /input|textarea/i.test(t.target.tagName), o = t.key === qr, s = [Hr, mt].includes(t.key);
2370
+ if (!s && !o || n && !o)
2331
2371
  return;
2332
2372
  t.preventDefault();
2333
- const i = this.matches(K) ? this : M.prev(this, K)[0] || M.next(this, K)[0] || M.findOne(K, t.delegateTarget.parentNode), a = he.getOrCreateInstance(i);
2373
+ const i = this.matches(G) ? this : V.prev(this, G)[0] || V.next(this, G)[0] || V.findOne(G, t.delegateTarget.parentNode), a = be.getOrCreateInstance(i);
2334
2374
  if (s) {
2335
2375
  t.stopPropagation(), a.show(), a._selectMenuItem(t);
2336
2376
  return;
@@ -2338,52 +2378,54 @@ let z = class he extends Mr {
2338
2378
  a._isShown() && (t.stopPropagation(), a.hide(), i.focus());
2339
2379
  }
2340
2380
  };
2341
- D.on(document, vn, K, z.dataApiKeydownHandler);
2342
- D.on(document, vn, pe, z.dataApiKeydownHandler);
2343
- D.on(document, bn, z.clearMenus);
2344
- D.on(document, Yr, z.clearMenus);
2345
- D.on(document, bn, K, function(e) {
2346
- e.preventDefault(), z.getOrCreateInstance(this).toggle();
2381
+ I.on(document, _n, G, J.dataApiKeydownHandler);
2382
+ I.on(document, _n, ge, J.dataApiKeydownHandler);
2383
+ I.on(document, Cn, J.clearMenus);
2384
+ I.on(document, Jr, J.clearMenus);
2385
+ I.on(document, Cn, G, function(e) {
2386
+ e.preventDefault(), J.getOrCreateInstance(this).toggle();
2347
2387
  });
2348
- Ar(z);
2349
- const ve = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ o(P, { children: e }), ae = ({ children: e, ...t }) => /* @__PURE__ */ o("div", { className: "dropdown-menu", children: e }), We = ({ className: e, children: t, icon: n }) => {
2350
- const r = O(null);
2388
+ Or(J);
2389
+ const Ee = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ r(A, { children: e }), ce = ({ children: e, ...t }) => /* @__PURE__ */ r("div", { className: "dropdown-menu", children: e }), Je = ({ className: e, children: t, autoClose: n, icon: o }) => {
2390
+ const s = S(null);
2351
2391
  N(() => {
2352
- const u = new z(r.current);
2392
+ const p = new J(s.current, {
2393
+ autoClose: n ?? !0
2394
+ });
2353
2395
  return () => {
2354
- u.dispose();
2396
+ p.dispose();
2355
2397
  };
2356
2398
  }, []);
2357
- const s = v.Children.toArray(t).find((u) => v.isValidElement(u) && u.type === ae), i = v.Children.toArray(t).filter((u) => v.isValidElement(u) && u.type === j), a = v.Children.toArray(t).find((u) => v.isValidElement(u) && u.type === ve), l = v.Children.toArray(t).filter((u) => !v.isValidElement(u) || u.type !== j && u.type !== ae && u.type !== ve), c = v.isValidElement(a) ? a.props : {};
2358
- return /* @__PURE__ */ _("div", { className: [...(e || "").split(" "), "dropdown"].filter((u, g, h) => h.indexOf(u) === g).join(" "), children: [
2359
- /* @__PURE__ */ o(ue, { ref: r, "data-bs-toggle": "dropdown", ...c, className: [...(c.className || "").split(" ")].filter((u, g, h) => h.indexOf(u) === g).join(" "), children: c.children ? c.children : l }),
2360
- s || /* @__PURE__ */ o(ae, { children: i })
2399
+ const i = v.Children.toArray(t).find((p) => v.isValidElement(p) && p.type === ce), a = v.Children.toArray(t).filter((p) => v.isValidElement(p) && p.type === M), c = v.Children.toArray(t).find((p) => v.isValidElement(p) && p.type === Ee), u = v.Children.toArray(t).filter((p) => !v.isValidElement(p) || p.type !== M && p.type !== ce && p.type !== Ee), m = v.isValidElement(c) ? c.props : {};
2400
+ return /* @__PURE__ */ C("div", { className: [...(e || "").split(" "), "dropdown"].filter((p, f, y) => y.indexOf(p) === f).join(" "), children: [
2401
+ /* @__PURE__ */ r(fe, { ref: s, "data-bs-toggle": "dropdown", ...m, className: [...(m.className || "").split(" ")].filter((p, f, y) => y.indexOf(p) === f).join(" "), children: m.children ? m.children : u }),
2402
+ i || /* @__PURE__ */ r(ce, { children: a })
2361
2403
  ] });
2362
- }, Ue = (e, t = !0) => (Object.entries(e).map(([n, r]) => (t && r instanceof Object && (r = Ue(r)), [n, r])).filter(([, n]) => n instanceof Object ? !Object.keys(n).length : ["", null, void 0].includes(n)).forEach(([n]) => {
2404
+ }, Ve = (e, t = !0) => (Object.entries(e).map(([n, o]) => (t && o instanceof Object && (o = Ve(o)), [n, o])).filter(([, n]) => n instanceof Object ? !Object.keys(n).length : ["", null, void 0].includes(n)).forEach(([n]) => {
2363
2405
  delete e[n];
2364
- }), e), po = ({ formView: e, onClick: t }) => {
2406
+ }), e), bo = ({ formView: e, onClick: t }) => {
2365
2407
  const n = (s) => {
2366
2408
  if (s.choices !== void 0) {
2367
- const i = s.choices?.reduce((a, l) => [...a, ...l.choices || [l]], []).reduce((a, l) => {
2368
- const c = l.value instanceof Function ? l.value(l) : l.value, u = l.label instanceof Function ? l.label(l) : l.label;
2369
- return { ...a, [c]: u };
2409
+ const i = s.choices?.reduce((a, c) => [...a, ...c.choices || [c]], []).reduce((a, c) => {
2410
+ const u = c.value instanceof Function ? c.value(c) : c.value, m = c.label instanceof Function ? c.label(c) : c.label;
2411
+ return { ...a, [u]: m };
2370
2412
  }, {});
2371
2413
  return s.choices ? Object.values(s.data instanceof Object ? s.data : [s.data]).map((a) => i[a] ?? a).join(", ") : s.data;
2372
2414
  } else if (s.checked !== void 0)
2373
2415
  return s.checked ? "Yes" : "No";
2374
2416
  return s.data;
2375
- }, r = Object.values(e.children || []).filter((s) => s.data !== null);
2376
- return !!r.length && /* @__PURE__ */ o("div", { className: "filters d-flex mb-sm overflow-auto", children: r.filter((s) => s.data !== null).map((s, i) => /* @__PURE__ */ _("div", { className: "filters-item d-flex text-nowrap flex-column me-2 mb-2", children: [
2377
- /* @__PURE__ */ o("small", { className: "mb-2", children: /* @__PURE__ */ o(U, { children: s.label }) }),
2378
- /* @__PURE__ */ _("div", { className: "btn btn-sm btn-primary me-1 mb-1", children: [
2379
- /* @__PURE__ */ o(U, { children: n(s) }),
2380
- t && /* @__PURE__ */ o("span", { onClick: () => t(s.name), className: "ms-2", children: "×" })
2417
+ }, o = Object.values(e.children || []).filter((s) => s.data !== null);
2418
+ return !!o.length && /* @__PURE__ */ r("div", { className: "filters d-flex mb-sm overflow-auto", children: o.filter((s) => s.data !== null).map((s, i) => /* @__PURE__ */ C("div", { className: "filters-item d-flex text-nowrap flex-column me-2 mb-2", children: [
2419
+ /* @__PURE__ */ r("small", { className: "mb-2", children: /* @__PURE__ */ r(D, { children: s.label }) }),
2420
+ /* @__PURE__ */ C("div", { className: "btn btn-sm btn-primary me-1 mb-1", children: [
2421
+ /* @__PURE__ */ r(D, { children: n(s) }),
2422
+ t && /* @__PURE__ */ r("span", { onClick: () => t(s.name), className: "ms-2", children: "×" })
2381
2423
  ] })
2382
2424
  ] }, i)) });
2383
- }, ho = () => {
2384
- const { actions: e, isSelectedAll: t, toggleAll: n, selected: r, executeAction: s, clear: i } = nn() || {};
2385
- return e && /* @__PURE__ */ _("div", { className: "btn-group btn-group-sm mb-2", children: [
2386
- /* @__PURE__ */ o("label", { className: "btn btn-light", children: /* @__PURE__ */ o(
2425
+ }, yo = () => {
2426
+ const { actions: e, isSelectedAll: t, toggleAll: n, selected: o, executeAction: s, clear: i } = an() || {};
2427
+ return e && /* @__PURE__ */ C("div", { className: "btn-group btn-group-sm mb-2", children: [
2428
+ /* @__PURE__ */ r("label", { className: "btn btn-light", children: /* @__PURE__ */ r(
2387
2429
  "input",
2388
2430
  {
2389
2431
  checked: t,
@@ -2391,10 +2433,10 @@ const ve = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ o(P,
2391
2433
  type: "checkbox"
2392
2434
  }
2393
2435
  ) }),
2394
- !!r?.length && /* @__PURE__ */ _(We, { className: "btn btn-sm btn-light", children: [
2395
- /* @__PURE__ */ o(ve, { disabled: !r?.length, className: "bg-transparent border-0", children: !!r?.length && /* @__PURE__ */ o(U, { properties: { number: r?.length }, children: ":number selected" }) }),
2396
- /* @__PURE__ */ o(ae, { children: Object.keys(e).map((a) => /* @__PURE__ */ o(
2397
- j,
2436
+ !!o?.length && /* @__PURE__ */ C(Je, { className: "btn btn-sm btn-light", children: [
2437
+ /* @__PURE__ */ r(Ee, { disabled: !o?.length, className: "bg-transparent border-0", children: !!o?.length && /* @__PURE__ */ r(D, { properties: { number: o?.length }, children: ":number selected" }) }),
2438
+ /* @__PURE__ */ r(ce, { children: Object.keys(e).map((a) => /* @__PURE__ */ r(
2439
+ M,
2398
2440
  {
2399
2441
  to: "#",
2400
2442
  onClick: () => s?.(a),
@@ -2404,55 +2446,55 @@ const ve = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ o(P,
2404
2446
  a
2405
2447
  )) })
2406
2448
  ] }),
2407
- !!r?.length && /* @__PURE__ */ o("button", { title: "Clear selection", onClick: i, className: "btn btn-light", children: "×" })
2449
+ !!o?.length && /* @__PURE__ */ r("button", { title: "Clear selection", onClick: i, className: "btn btn-light", children: "×" })
2408
2450
  ] });
2409
- }, go = Tt(_e(({ embedded: e = !1, title: t, className: n, onAction: r }) => {
2410
- const { action: s, setAction: i } = ee(), { generateActionLink: a, location: l, navigate: c } = T(), u = O(null), { openModal: g } = ze(), { open: h } = He(), y = s.action.entity;
2451
+ }, vo = Mt(xe(({ embedded: e = !1, title: t, className: n, onAction: o }) => {
2452
+ const { action: s, setAction: i } = te(), { generateActionLink: a, location: c, navigate: u } = j(), m = S(null), { openModal: p } = Qe(), { open: f } = Ge(), y = s.action.entity;
2411
2453
  if (!y)
2412
2454
  throw new Error("Invalid Entity");
2413
- const { results: E, refresh: C } = te() || {}, f = Object.values(E?.action ?? []).filter((p) => p.visibility === Ke.List && p.name !== s.action.name), m = ({ newAction: p, excludeFilterParameters: x }) => {
2414
- const w = { ...p ?? s };
2455
+ const { results: E, refresh: _ } = ne() || {}, b = Object.values(E?.action ?? []).filter((h) => h.visibility === Ye.List && h.name !== s.action.name), l = ({ newAction: h, excludeFilterParameters: x }) => {
2456
+ const P = { ...h ?? s };
2415
2457
  if (x?.forEach((L) => {
2416
- delete w.query?.filter?.[L];
2458
+ delete P.query?.filter?.[L];
2417
2459
  }), e)
2418
- i(w);
2460
+ i(P);
2419
2461
  else {
2420
- const L = a(w);
2421
- c(L);
2462
+ const L = a(P);
2463
+ u(L);
2422
2464
  }
2423
- }, d = (p, x, w) => new Promise((L, S) => {
2424
- h({
2465
+ }, d = (h, x, P) => new Promise((L, O) => {
2466
+ f({
2425
2467
  title: "Are you sure?",
2426
- icon: Q.confirm,
2427
- onResult: (I) => {
2428
- I.isConfirmed ? ce().post({
2468
+ icon: Z.confirm,
2469
+ onResult: (k) => {
2470
+ k.isConfirmed ? le().post({
2429
2471
  url: a(s),
2430
- body: w,
2431
- bodyType: ut.FormData
2432
- }).catch((oe) => {
2433
- S();
2472
+ body: P,
2473
+ bodyType: ht.FormData
2474
+ }).catch((F) => {
2475
+ O();
2434
2476
  }).finally(() => {
2435
- C?.(), L();
2436
- }) : S();
2477
+ _?.(), L();
2478
+ }) : O();
2437
2479
  }
2438
2480
  });
2439
- }), b = (p, x) => {
2440
- if (!r?.(p, x)) {
2441
- switch (x?.preventDefault(), p.parameters = { ...p.parameters || {}, ...s.parameters || {} }, p.parameters = Ue(p.parameters), Object.keys(p.parameters).length || (p.parameters = void 0), p.query !== void 0 && (Object.keys(p.query).length || (p.query = void 0)), p.action.name) {
2481
+ }), g = (h, x) => {
2482
+ if (!o?.(h, x)) {
2483
+ switch (x?.preventDefault(), h.parameters = { ...h.parameters || {}, ...s.parameters || {} }, h.parameters = Ve(h.parameters), Object.keys(h.parameters).length || (h.parameters = void 0), h.query !== void 0 && (Object.keys(h.query).length || (h.query = void 0)), h.action.name) {
2442
2484
  case "list":
2443
- return m({ newAction: p });
2485
+ return l({ newAction: h });
2444
2486
  case "delete": {
2445
- h({
2487
+ f({
2446
2488
  title: "Are you sure?",
2447
- icon: Q.confirm,
2448
- onResult: (w) => {
2449
- w.isConfirmed && ce().fetch({
2450
- url: a(p),
2451
- method: Ve.DELETE
2489
+ icon: Z.confirm,
2490
+ onResult: (P) => {
2491
+ P.isConfirmed && le().fetch({
2492
+ url: a(h),
2493
+ method: $e.DELETE
2452
2494
  }).catch((L) => {
2453
2495
  console.log("error", L);
2454
2496
  }).finally(() => {
2455
- C?.();
2497
+ _?.();
2456
2498
  });
2457
2499
  }
2458
2500
  });
@@ -2460,89 +2502,89 @@ const ve = ({ children: e, disabled: t, className: n }) => /* @__PURE__ */ o(P,
2460
2502
  }
2461
2503
  }
2462
2504
  if (e) {
2463
- g({
2464
- action: p,
2505
+ p({
2506
+ action: h,
2465
2507
  props: {
2466
2508
  size: "lg",
2467
2509
  onClose: () => {
2468
- C?.();
2510
+ _?.();
2469
2511
  }
2470
2512
  }
2471
2513
  });
2472
2514
  return;
2473
2515
  }
2474
- m({ newAction: p });
2516
+ l({ newAction: h });
2475
2517
  }
2476
2518
  };
2477
- return /* @__PURE__ */ o(hr, { data: E, onClick: b, children: /* @__PURE__ */ _("section", { className: n || "list", children: [
2478
- /* @__PURE__ */ o(k, { name: "header", children: /* @__PURE__ */ _("header", { className: "content-header d-md-flex mb-3 justify-content-between align-items-center", children: [
2479
- /* @__PURE__ */ o(k, { name: "title", children: t !== !1 && (v.isValidElement(t) ? t : /* @__PURE__ */ o("h2", { children: t ?? E?.title })) }),
2480
- /* @__PURE__ */ _("div", { className: "d-flex align-items-center", children: [
2481
- /* @__PURE__ */ o(k, { name: "actions", children: !!f.length && /* @__PURE__ */ o("div", { className: "btn-group btn-group-sm me-2", children: f.map((p, x) => /* @__PURE__ */ o(
2482
- sn,
2519
+ return /* @__PURE__ */ r(yr, { data: E, onClick: g, children: /* @__PURE__ */ C("section", { className: n || "list", children: [
2520
+ /* @__PURE__ */ r(T, { name: "header", children: /* @__PURE__ */ C("header", { className: "content-header d-flex flex-column flex-md-row gap-3 mb-3 justify-content-between align-items-md-center", children: [
2521
+ /* @__PURE__ */ r(T, { name: "title", children: t !== !1 && (v.isValidElement(t) ? t : /* @__PURE__ */ r("h2", { children: /* @__PURE__ */ r(D, { children: t ?? E?.title }) })) }),
2522
+ /* @__PURE__ */ C("div", { className: "d-flex align-items-center", children: [
2523
+ /* @__PURE__ */ r(T, { name: "actions", children: !!b.length && /* @__PURE__ */ r("div", { className: "btn-group btn-group-sm me-2", children: b.map((h, x) => /* @__PURE__ */ r(
2524
+ dn,
2483
2525
  {
2484
- action: { ...s, action: p },
2526
+ action: { ...s, action: h },
2485
2527
  className: "btn btn-outline-secondary"
2486
2528
  },
2487
2529
  x
2488
2530
  )) }) }),
2489
- E?.form?.filter?.view && /* @__PURE__ */ _("div", { className: "btn-group btn-group-sm", children: [
2490
- /* @__PURE__ */ _(We, { children: [
2491
- /* @__PURE__ */ o(ve, { className: "btn btn-sm dropdown-toggle btn-outline-dark", children: /* @__PURE__ */ o(U, { children: "Filter" }) }),
2492
- /* @__PURE__ */ o(ae, { children: /* @__PURE__ */ o("div", { className: "filter", children: /* @__PURE__ */ _(
2493
- _t,
2531
+ E?.form?.filter?.view && /* @__PURE__ */ C("div", { className: "btn-group btn-group-sm", children: [
2532
+ /* @__PURE__ */ C(Je, { autoClose: "outside", children: [
2533
+ /* @__PURE__ */ r(Ee, { className: "btn btn-sm dropdown-toggle btn-outline-dark", children: /* @__PURE__ */ r(D, { children: "Filter" }) }),
2534
+ /* @__PURE__ */ r(ce, { children: /* @__PURE__ */ r("div", { className: "filter", children: /* @__PURE__ */ C(
2535
+ At,
2494
2536
  {
2495
- id: "filter_" + Ce(y),
2496
- ref: u,
2497
- onSubmit: (p) => b({
2537
+ id: "filter_" + _e(y),
2538
+ ref: m,
2539
+ onSubmit: (h) => g({
2498
2540
  ...s,
2499
- query: Ue(Pn(p))
2541
+ query: Ve(Be(h))
2500
2542
  }),
2501
- onReset: () => b({
2543
+ onReset: () => g({
2502
2544
  ...s,
2503
2545
  query: void 0
2504
2546
  }),
2505
2547
  children: [
2506
- E?.form?.filter && /* @__PURE__ */ o(ne, { view: E.form.filter.view, children: /* @__PURE__ */ o(me, {}) }),
2507
- /* @__PURE__ */ o("button", { className: "btn btn-primary me-2", type: "submit", children: /* @__PURE__ */ o(U, { children: "Submit" }) })
2548
+ E?.form?.filter && /* @__PURE__ */ r(re, { view: E.form.filter.view, children: /* @__PURE__ */ r(pe, {}) }),
2549
+ /* @__PURE__ */ r("button", { className: "btn btn-primary me-2", type: "submit", children: /* @__PURE__ */ r(D, { children: "Submit" }) })
2508
2550
  ]
2509
2551
  }
2510
2552
  ) }) })
2511
2553
  ] }),
2512
- l.searchParams.has("filter") && /* @__PURE__ */ o(ue, { onClick: () => {
2513
- u.current?.reset();
2554
+ c.searchParams.has("filter") && /* @__PURE__ */ r(fe, { onClick: () => {
2555
+ m.current?.reset();
2514
2556
  }, className: "btn btn-outline-dark", children: "x" })
2515
2557
  ] })
2516
2558
  ] })
2517
2559
  ] }) }),
2518
- /* @__PURE__ */ _(gr, { onClick: d, children: [
2519
- E?.form?.filter?.view && /* @__PURE__ */ o(po, { formView: E.form.filter.view, onClick: (p) => m({ excludeFilterParameters: [p] }) }),
2520
- /* @__PURE__ */ o(ho, {}),
2521
- /* @__PURE__ */ _(k, { name: "content", children: [
2522
- /* @__PURE__ */ o(F, { prefix: "list", view: "content", data: E, children: /* @__PURE__ */ o(
2523
- yr,
2560
+ /* @__PURE__ */ C(vr, { onClick: d, children: [
2561
+ E?.form?.filter?.view && /* @__PURE__ */ r(bo, { formView: E.form.filter.view, onClick: (h) => l({ excludeFilterParameters: [h] }) }),
2562
+ /* @__PURE__ */ r(yo, {}),
2563
+ /* @__PURE__ */ C(T, { name: "content", children: [
2564
+ /* @__PURE__ */ r(U, { prefix: "list", view: "content", data: E, children: /* @__PURE__ */ r(
2565
+ _r,
2524
2566
  {
2525
2567
  routeParams: s.parameters
2526
2568
  }
2527
2569
  ) }, "list"),
2528
- /* @__PURE__ */ o(Er, {})
2570
+ /* @__PURE__ */ r(xr, {})
2529
2571
  ] })
2530
2572
  ] })
2531
2573
  ] }) });
2532
- }, { name: "list" })), bo = ({ view: e }) => /* @__PURE__ */ _(P, { children: [
2574
+ }, { name: "list" })), Eo = ({ view: e }) => /* @__PURE__ */ C(A, { children: [
2533
2575
  'View "',
2534
2576
  e,
2535
2577
  '" Not found.'
2536
- ] }), vo = ({ view: e, props: t }) => {
2578
+ ] }), Co = ({ view: e, props: t }) => {
2537
2579
  const n = {
2538
- add: tt,
2539
- edit: tt,
2540
- list: go
2541
- }, r = Lt();
2542
- return /* @__PURE__ */ o(F, { view: e, props: t, children: n[e] !== void 0 ? v.createElement(n[e], t) : /* @__PURE__ */ o(bo, { view: e }) }, r + e);
2543
- }, yn = ({ view: e, namespace: t, props: n }) => /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(vo, { view: e, props: n }) }), En = v.createContext({});
2544
- function ze() {
2545
- const { modal: e, setModal: t } = v.useContext(En);
2580
+ add: st,
2581
+ edit: st,
2582
+ list: vo
2583
+ }, o = Dt();
2584
+ return /* @__PURE__ */ r(U, { view: e, props: t, children: n[e] !== void 0 ? v.createElement(n[e], t) : /* @__PURE__ */ r(Eo, { view: e }) }, o + e);
2585
+ }, xn = ({ view: e, namespace: t, props: n }) => /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(Co, { view: e, props: n }) }), Nn = v.createContext({});
2586
+ function Qe() {
2587
+ const { modal: e, setModal: t } = v.useContext(Nn);
2546
2588
  return {
2547
2589
  modal: e,
2548
2590
  openModal: (n) => {
@@ -2553,296 +2595,297 @@ function ze() {
2553
2595
  }
2554
2596
  };
2555
2597
  }
2556
- function yo(e) {
2557
- const [t, n] = Y((c, u) => {
2558
- const g = [...c];
2559
- return u ? g.push(u) : g.pop(), g;
2560
- }, []), r = t[t.length - 1] ?? null, { open: s } = He(), i = O(0);
2598
+ function _o(e) {
2599
+ const [t, n] = W((m, p) => {
2600
+ const f = [...m];
2601
+ return p ? f.push(p) : f.pop(), f;
2602
+ }, []), o = t[t.length - 1] ?? null, { open: s } = Ge(), i = S(0);
2561
2603
  N(() => {
2562
2604
  i.current += 1;
2563
- }, [r]);
2605
+ }, [o]);
2564
2606
  const a = {
2565
- ...r?.props || {}
2566
- }, l = r ? [
2567
- r.action.action.entity,
2568
- r.action.action.namespace,
2569
- r.action.action.name
2570
- ].filter((c) => c).join("-") : Date.now();
2571
- return /* @__PURE__ */ _(En.Provider, { value: {
2572
- modal: r,
2573
- setModal: (c) => {
2574
- n(c);
2607
+ ...o?.props || {}
2608
+ }, c = (m) => m ? [
2609
+ m.action.action.entity,
2610
+ m.action.action.namespace,
2611
+ m.action.action.name
2612
+ ].filter((p) => p).join("-") : Date.now().toString(), u = c(o);
2613
+ return /* @__PURE__ */ C(Nn.Provider, { value: {
2614
+ modal: o,
2615
+ setModal: (m) => {
2616
+ u !== c(m) && n(m);
2575
2617
  }
2576
2618
  }, children: [
2577
2619
  e.children,
2578
- r && /* @__PURE__ */ o(ht, { preventDefault: !0, fallback: (c) => {
2620
+ o && /* @__PURE__ */ r(vt, { preventDefault: !0, fallback: (m) => {
2579
2621
  n(null), s({
2580
- title: c?.detail ?? "Unknown Error",
2581
- icon: Q.denied,
2622
+ title: m?.detail ?? "Unknown Error",
2623
+ icon: Z.denied,
2582
2624
  actions: {
2583
2625
  close: {
2584
2626
  label: "OK"
2585
2627
  }
2586
2628
  }
2587
2629
  });
2588
- }, children: /* @__PURE__ */ o(Rt, { action: r.action, children: /* @__PURE__ */ o(
2589
- yn,
2630
+ }, children: /* @__PURE__ */ r(It, { action: o.action, children: /* @__PURE__ */ r(
2631
+ xn,
2590
2632
  {
2591
- view: r.action.action.name || "list",
2633
+ view: o.action.action.name || "list",
2592
2634
  props: {
2593
2635
  modal: !0,
2594
2636
  props: a
2595
2637
  }
2596
2638
  }
2597
- ) }, l) })
2639
+ ) }, u) })
2598
2640
  ] });
2599
2641
  }
2600
- const Eo = ({ children: e, config: t }) => /* @__PURE__ */ o(Fn, { config: t, children: /* @__PURE__ */ o(rr, { children: /* @__PURE__ */ o(Vn, { children: /* @__PURE__ */ o(Jt, { children: /* @__PURE__ */ o(yo, { children: e }) }) }) }) });
2601
- let ge = null;
2602
- const Cn = {}, Je = "dakataa_crud", Uo = ({ connection: e, templates: t }) => {
2603
- H.namespace[Je] = e, Cn.templates = t, ge = null;
2604
- }, ce = () => (ge || (ge = H.instance({ namespace: Je })), ge), Vo = ({ children: e, config: t, errorFallback: n }) => {
2605
- const r = Object.assign(Cn.templates ?? {}, t?.templates ?? {});
2606
- return /* @__PURE__ */ o(Et, { children: /* @__PURE__ */ o($n, { children: /* @__PURE__ */ o(ht, { fallback: n ?? /* @__PURE__ */ o(jn, {}), children: /* @__PURE__ */ o(Eo, { config: { ...t || { env: bt.DEV }, templates: r }, children: e }) }) }) });
2607
- }, Co = ({ namespace: e }) => {
2608
- const { columns: t } = B();
2609
- return /* @__PURE__ */ o("div", { className: "card mb-3", children: /* @__PURE__ */ o("div", { className: "card-body", children: /* @__PURE__ */ _("div", { className: "d-flex flex-row gap-3 align-items-start", children: [
2610
- /* @__PURE__ */ o(rn, {}),
2611
- /* @__PURE__ */ o("div", { className: "d-flex flex-column flex-wrap gap-2", children: t.map((n, r) => /* @__PURE__ */ _("div", { className: "d-flex align-items-start", children: [
2612
- /* @__PURE__ */ _("span", { className: "text-secondary me-1", children: [
2613
- /* @__PURE__ */ o(on, { column: n, namespace: e }),
2642
+ const xo = ({ children: e, config: t }) => /* @__PURE__ */ r(Vn, { config: t, children: /* @__PURE__ */ r(ir, { children: /* @__PURE__ */ r(qn, { children: /* @__PURE__ */ r(en, { children: /* @__PURE__ */ r(_o, { children: e }) }) }) }) });
2643
+ let ye = null;
2644
+ const wn = {}, Ze = "dakataa_crud", $o = ({ connection: e, templates: t }) => {
2645
+ K.namespace[Ze] = e, wn.templates = t, ye = null;
2646
+ }, le = () => (ye || (ye = K.instance({ namespace: Ze })), ye), qo = ({ children: e, config: t, errorFallback: n }) => {
2647
+ const o = Object.assign(wn.templates ?? {}, t?.templates ?? {});
2648
+ return /* @__PURE__ */ r(Nt, { children: /* @__PURE__ */ r(Kn, { children: /* @__PURE__ */ r(vt, { fallback: n ?? /* @__PURE__ */ r(Un, {}), children: /* @__PURE__ */ r(xo, { config: { ...t || { env: Ct.DEV }, templates: o }, children: e }) }) }) });
2649
+ }, No = ({ namespace: e }) => {
2650
+ const { columns: t } = $();
2651
+ return /* @__PURE__ */ r("div", { className: "card mb-3", children: /* @__PURE__ */ r("div", { className: "card-body", children: /* @__PURE__ */ C("div", { className: "d-flex flex-row gap-3 align-items-start", children: [
2652
+ /* @__PURE__ */ r(cn, {}),
2653
+ /* @__PURE__ */ r("div", { className: "d-flex flex-column flex-wrap gap-2", children: t.map((n, o) => /* @__PURE__ */ C("div", { className: "d-flex align-items-start", children: [
2654
+ /* @__PURE__ */ C("span", { className: "text-secondary me-1", children: [
2655
+ /* @__PURE__ */ r(ln, { column: n, namespace: e }),
2614
2656
  ":"
2615
2657
  ] }),
2616
- /* @__PURE__ */ o(en, { column: n, namespace: e })
2617
- ] }, r)) }),
2618
- /* @__PURE__ */ o("div", { className: "ms-auto", children: /* @__PURE__ */ o(an, { namespace: e }) })
2658
+ /* @__PURE__ */ r(on, { column: n, namespace: e })
2659
+ ] }, o)) }),
2660
+ /* @__PURE__ */ r("div", { className: "ms-auto", children: /* @__PURE__ */ r(un, { namespace: e }) })
2619
2661
  ] }) }) });
2620
- }, Bo = ({ itemView: e, emptyView: t, namespace: n }) => {
2621
- const { items: r, primaryColumn: s, data: i } = B();
2622
- return !!i && (r.length ? r.map((a, l) => /* @__PURE__ */ o(Xt, { index: l, children: /* @__PURE__ */ o(
2623
- F,
2662
+ }, Ho = ({ itemView: e, emptyView: t, namespace: n }) => {
2663
+ const { items: o, primaryColumn: s, data: i } = $();
2664
+ return !!i && (o.length ? o.map((a, c) => /* @__PURE__ */ r(rn, { index: c, children: /* @__PURE__ */ r(
2665
+ U,
2624
2666
  {
2625
2667
  namespace: n,
2626
2668
  prefix: "list",
2627
2669
  view: "listItem",
2628
- children: e || /* @__PURE__ */ o(Co, { namespace: n })
2670
+ children: e || /* @__PURE__ */ r(No, { namespace: n })
2629
2671
  },
2630
- i?.entity?.data.items[l][s?.field ?? ""]
2631
- ) }, l)) : t === void 0 ? /* @__PURE__ */ o(U, { children: "No results found." }) : t);
2632
- }, $o = ({ name: e }) => {
2633
- const { form: t } = V(), n = e ? t.children?.[e] : t;
2672
+ i?.entity?.data.items[c][s?.field ?? ""]
2673
+ ) }, c)) : t === void 0 ? /* @__PURE__ */ r(D, { children: "No results found." }) : t);
2674
+ }, Ko = ({ name: e }) => {
2675
+ const { form: t } = B(), n = e ? t.children?.[e] : t;
2634
2676
  if (!n)
2635
2677
  throw new Error("Missing Form View for FormLabel" + (e ? ": " + e : ""));
2636
- return /* @__PURE__ */ o(Re, { view: n });
2637
- }, _o = ({ children: e }) => /* @__PURE__ */ o(P, { children: e }), lt = Z(({ name: e, children: t, parent: n, render: r }) => (t = v.Children.toArray((r ? r(n) : t) || []).map((s) => (v.isValidElement(s) && s.type === _o && (s = v.cloneElement(s, { children: n })), s)), /* @__PURE__ */ o(P, { children: t }))), qo = Z(({ name: e, content: t, children: n, data: r }) => {
2638
- const s = v.Children.toArray(t).find((l) => v.isValidElement(l) && l.type === lt && l.props.name === e);
2678
+ return /* @__PURE__ */ r(De, { view: n });
2679
+ }, wo = ({ children: e }) => /* @__PURE__ */ r(A, { children: e }), ft = X(({ name: e, children: t, parent: n, render: o }) => (t = v.Children.toArray((o ? o(n) : t) || []).map((s) => (v.isValidElement(s) && s.type === wo && (s = v.cloneElement(s, { children: n })), s)), /* @__PURE__ */ r(A, { children: t }))), Go = X(({ name: e, content: t, children: n, data: o }) => {
2680
+ const s = v.Children.toArray(t).find((c) => v.isValidElement(c) && c.type === ft && c.props.name === e);
2639
2681
  let i = null;
2640
- s && v.isValidElement(s) && (i = v.cloneElement(s, { parent: n, data: r }));
2641
- const a = v.Children.toArray(n).filter((l) => v.isValidElement(l) && l.type !== lt);
2642
- return /* @__PURE__ */ o(P, { children: i || (a.length ? a : n) });
2643
- }), _n = v.createContext(null), xn = ({ item: e }) => /* @__PURE__ */ o(_n.Provider, { value: e, children: e.parent?.parent ? /* @__PURE__ */ o(xn, { item: e.parent }) : e.parent?.element ? e.parent.element : e.element }), Ho = () => v.useContext(_n)?.element || "Empty", Ko = ({ children: e }) => {
2644
- const t = (l, c) => On.toArray(l).reduce((u, g) => {
2645
- const h = g.props, y = (f) => f?.replace(/\/$/, ""), E = [c?.path, h?.path].filter((f) => f).map((f) => y(f)).join("/"), C = t(h.children, { path: E, element: h.element });
2682
+ s && v.isValidElement(s) && (i = v.cloneElement(s, { parent: n, data: o }));
2683
+ const a = v.Children.toArray(n).filter((c) => v.isValidElement(c) && c.type !== ft);
2684
+ return /* @__PURE__ */ r(A, { children: i || (a.length ? a : n) });
2685
+ }), An = v.createContext(null), Pn = ({ item: e }) => /* @__PURE__ */ r(An.Provider, { value: e, children: e.parent?.parent ? /* @__PURE__ */ r(Pn, { item: e.parent }) : e.parent?.element ? e.parent.element : e.element }), Yo = () => v.useContext(An)?.element || "Empty", Wo = ({ children: e }) => {
2686
+ const t = (c, u) => Dn.toArray(c).reduce((m, p) => {
2687
+ const f = p.props, y = (b) => b?.replace(/\/$/, ""), E = [u?.path, f?.path].filter((b) => b).map((b) => y(b)).join("/"), _ = t(f.children, { path: E, element: f.element });
2646
2688
  return [
2647
- ...u,
2648
- ...C.length ? C : [{
2689
+ ...m,
2690
+ ..._.length ? _ : [{
2649
2691
  path: "/" + E,
2650
- element: h?.element,
2651
- parent: c
2692
+ element: f?.element,
2693
+ parent: u
2652
2694
  }]
2653
2695
  ];
2654
- }, []), n = O(null);
2696
+ }, []), n = S(null);
2655
2697
  n.current === null && (n.current = t(e));
2656
- const { matchPath: r } = T(), s = n.current.filter((l) => l.path && r(l.path, document.location.href)).shift(), [, i] = R(document.location.href), a = () => {
2698
+ const { matchPath: o } = j(), s = n.current.filter((c) => c.path && o(c.path, document.location.href)).shift(), [, i] = R(document.location.href), a = () => {
2657
2699
  i(document.location.href);
2658
2700
  };
2659
2701
  if (N(() => (a(), window.addEventListener("locationchange", a), () => {
2660
2702
  window.removeEventListener("locationchange", a);
2661
2703
  }), []), !!s)
2662
- return /* @__PURE__ */ o(P, { children: /* @__PURE__ */ o(xn, { item: s }) });
2663
- }, Go = (e) => null, wn = v.createContext(null), xo = () => v.useContext(wn), wo = ({ item: e, open: t = !1 }) => {
2664
- const n = !!e.items?.length, { location: r, generateRoute: s } = T(), i = r.pathname.replace(/(.*?)\/?$/i, "$1"), a = s(e.route), l = i.includes(a, 0), [c, u] = v.useState(l), g = xo(), h = O(null), y = O(null), E = "collapse", C = "collapsing", f = {
2665
- toggle: (b) => {
2666
- u(b !== void 0 ? b : !c);
2704
+ return /* @__PURE__ */ r(A, { children: /* @__PURE__ */ r(Pn, { item: s }) });
2705
+ }, zo = (e) => null, Ln = v.createContext(null), Ao = () => v.useContext(Ln), Po = ({ item: e, open: t = !1 }) => {
2706
+ const n = !!e.items?.length, { location: o, generateRoute: s } = j(), i = o.pathname.replace(/(.*?)\/?$/i, "$1"), a = s(e.route), c = i.includes(a, 0), [u, m] = v.useState(c), p = Ao(), f = S(null), y = S(null), E = "collapse", _ = "collapsing", b = {
2707
+ toggle: (g) => {
2708
+ m(g !== void 0 ? g : !u);
2667
2709
  }
2668
- }, m = () => {
2669
- h.current?.classList.remove(C), h.current?.classList.add(E), h.current?.classList.toggle("show", c), h.current?.style.removeProperty("height");
2710
+ }, l = () => {
2711
+ f.current?.classList.remove(_), f.current?.classList.add(E), f.current?.classList.toggle("show", u), f.current?.style.removeProperty("height");
2670
2712
  }, d = () => {
2671
2713
  y.current && (clearTimeout(y.current), y.current = null);
2672
2714
  };
2673
- return N(() => (c && g && g.toggle(!0), h.current?.addEventListener("animationstart", d), h.current?.addEventListener("transitionstart", d), h.current?.addEventListener("animationend", m), h.current?.addEventListener("transitionend", m), h.current?.style.setProperty("height", (c ? 0 : h.current?.scrollHeight) + "px"), h.current?.classList.remove("show"), h.current?.classList.remove(E), h.current?.classList.add(C), setTimeout(() => {
2674
- h.current?.style.setProperty("height", (c ? h.current?.scrollHeight : 0) + "px");
2675
- }, 10), y.current = setTimeout(m, 50), () => {
2676
- d(), h.current?.removeEventListener("animationstart", d), h.current?.removeEventListener("transitionstart", d), h.current?.removeEventListener("animationend", m), h.current?.removeEventListener("transitionend", m);
2677
- }), [c]), N(() => {
2678
- t !== c && u(t);
2679
- }, [t]), /* @__PURE__ */ o(wn.Provider, { value: f, children: /* @__PURE__ */ _("nav", { className: ["item", ...c || l ? ["active"] : []].join(" "), children: [
2680
- /* @__PURE__ */ _(
2681
- j,
2715
+ return N(() => (u && p && p.toggle(!0), f.current?.addEventListener("animationstart", d), f.current?.addEventListener("transitionstart", d), f.current?.addEventListener("animationend", l), f.current?.addEventListener("transitionend", l), f.current?.style.setProperty("height", (u ? 0 : f.current?.scrollHeight) + "px"), f.current?.classList.remove("show"), f.current?.classList.remove(E), f.current?.classList.add(_), setTimeout(() => {
2716
+ f.current?.style.setProperty("height", (u ? f.current?.scrollHeight : 0) + "px");
2717
+ }, 10), y.current = setTimeout(l, 50), () => {
2718
+ d(), f.current?.removeEventListener("animationstart", d), f.current?.removeEventListener("transitionstart", d), f.current?.removeEventListener("animationend", l), f.current?.removeEventListener("transitionend", l);
2719
+ }), [u]), N(() => {
2720
+ t !== u && m(t);
2721
+ }, [t]), /* @__PURE__ */ r(Ln.Provider, { value: b, children: /* @__PURE__ */ C("nav", { className: ["item", ...u || c ? ["active"] : []].join(" "), children: [
2722
+ /* @__PURE__ */ C(
2723
+ M,
2682
2724
  {
2683
2725
  to: n ? "#" : s(e.route),
2684
2726
  ...e.icon && { icon: e.icon },
2685
2727
  ...n && {
2686
2728
  onClick: () => {
2687
- u(!c);
2729
+ m(!u);
2688
2730
  }
2689
2731
  },
2690
2732
  children: [
2691
- /* @__PURE__ */ o("span", { className: "icon" }),
2692
- /* @__PURE__ */ o("span", { className: "title", children: e.title })
2733
+ /* @__PURE__ */ r("span", { className: "icon" }),
2734
+ /* @__PURE__ */ r("span", { className: "title", children: e.title })
2693
2735
  ]
2694
2736
  }
2695
2737
  ),
2696
- n && !!e.items?.length && /* @__PURE__ */ o("nav", { ref: h, className: E, children: /* @__PURE__ */ o(Nn, { items: e.items }) })
2738
+ n && !!e.items?.length && /* @__PURE__ */ r("nav", { ref: f, className: E, children: /* @__PURE__ */ r(On, { items: e.items }) })
2697
2739
  ] }) });
2698
- }, Nn = ({ items: e }) => e.map(
2740
+ }, On = ({ items: e }) => e.map(
2699
2741
  (t) => {
2700
- const n = [parent, t.title].filter((r) => r).join("-").toLowerCase();
2701
- return /* @__PURE__ */ o(wo, { item: t }, n);
2702
- }
2703
- ), No = X(({ items: e, className: t, open: n = !1 }, r) => {
2704
- const s = O(null), [i, a] = v.useState(n);
2705
- r = r || Sn();
2706
- const l = {
2707
- toggle: (c) => {
2708
- a(c !== void 0 ? c : !i);
2742
+ const n = [parent, t.title].filter((o) => o).join("-").toLowerCase();
2743
+ return /* @__PURE__ */ r(Po, { item: t }, n);
2744
+ }
2745
+ ), Lo = de(({ items: e, className: t, open: n = !1 }, o) => {
2746
+ const s = S(null), [i, a] = v.useState(n);
2747
+ o = o || Rn();
2748
+ const c = {
2749
+ toggle: (u) => {
2750
+ a(u !== void 0 ? u : !i);
2709
2751
  }
2710
2752
  };
2711
- return ye(r, () => l), N(() => {
2753
+ return ue(o, () => c), N(() => {
2712
2754
  document.body.classList.toggle("toggle-nav", i);
2713
- const c = (u) => {
2714
- s.current?.contains(u.target) || (a(!1), document.body.removeEventListener("click", c));
2755
+ const u = (m) => {
2756
+ s.current?.contains(m.target) || (a(!1), document.body.removeEventListener("click", u));
2715
2757
  };
2716
2758
  if (i)
2717
- return document.body.addEventListener("click", c), () => {
2718
- document.body.removeEventListener("click", c);
2759
+ return document.body.addEventListener("click", u), () => {
2760
+ document.body.removeEventListener("click", u);
2719
2761
  };
2720
- }, [i]), /* @__PURE__ */ o("nav", { ref: s, children: /* @__PURE__ */ o(Nn, { items: e }) });
2721
- }), Yo = ({ children: e, ...t }) => {
2722
- const n = O(null), [r, s] = R([]);
2762
+ }, [i]), /* @__PURE__ */ r("nav", { ref: s, children: /* @__PURE__ */ r(On, { items: e }) });
2763
+ }), Jo = ({ children: e, ...t }) => {
2764
+ const n = S(null), [o, s] = R([]);
2723
2765
  return N(() => {
2724
- ce().get({
2766
+ le().get({
2725
2767
  url: "/_crud/navigation"
2726
2768
  }).then(({ status: i, data: a }) => {
2727
2769
  i === 200 && s(a);
2728
2770
  });
2729
- }, []), /* @__PURE__ */ _(gt, { children: [
2730
- /* @__PURE__ */ o("header", { children: /* @__PURE__ */ _("div", { className: "wrap", children: [
2731
- /* @__PURE__ */ o("button", { onClick: (i) => n.current?.toggle(), className: "btn btn-mobile", children: /* @__PURE__ */ o("i", {}) }),
2732
- /* @__PURE__ */ o("nav", { className: "first-nav", children: /* @__PURE__ */ o(j, { className: "logo", to: "/", children: "Admin" }) }),
2733
- /* @__PURE__ */ o("nav", { className: "second-nav", children: /* @__PURE__ */ _(We, { className: "user", children: [
2734
- /* @__PURE__ */ o("span", { className: "initials", children: "YL" }),
2735
- /* @__PURE__ */ o(j, { to: "#", children: "Yordan Lazarov" }),
2736
- /* @__PURE__ */ o(j, { to: "#", children: "Logout" })
2771
+ }, []), /* @__PURE__ */ C(Et, { children: [
2772
+ /* @__PURE__ */ r("header", { children: /* @__PURE__ */ C("div", { className: "wrap", children: [
2773
+ /* @__PURE__ */ r("button", { onClick: (i) => n.current?.toggle(), className: "btn btn-mobile", children: /* @__PURE__ */ r("i", {}) }),
2774
+ /* @__PURE__ */ r("nav", { className: "first-nav", children: /* @__PURE__ */ r(M, { className: "logo", to: "/", children: "Admin" }) }),
2775
+ /* @__PURE__ */ r("nav", { className: "second-nav", children: /* @__PURE__ */ C(Je, { className: "user", children: [
2776
+ /* @__PURE__ */ r("span", { className: "initials", children: "YL" }),
2777
+ /* @__PURE__ */ r(M, { to: "#", children: "Yordan Lazarov" }),
2778
+ /* @__PURE__ */ r(M, { to: "#", children: "Logout" })
2737
2779
  ] }) })
2738
2780
  ] }) }),
2739
- /* @__PURE__ */ _("main", { children: [
2740
- !!r.length && /* @__PURE__ */ o("div", { className: "navigation d-print-none", children: /* @__PURE__ */ o(No, { ref: n, items: r }) }),
2741
- /* @__PURE__ */ o("div", { className: "content", children: e })
2781
+ /* @__PURE__ */ C("main", { children: [
2782
+ !!o.length && /* @__PURE__ */ r("div", { className: "navigation d-print-none", children: /* @__PURE__ */ r(Lo, { ref: n, items: o }) }),
2783
+ /* @__PURE__ */ r("div", { className: "content", children: e })
2742
2784
  ] })
2743
2785
  ] });
2744
- }, Wo = ({ currency: e, locale: t, children: n }) => {
2745
- const r = Intl.NumberFormat().resolvedOptions().locale, { currency: s, locale: i } = le();
2746
- e ??= s ?? "EUR", t ??= i ?? r;
2747
- const a = Number(n);
2748
- return /* @__PURE__ */ o(P, { children: !isNaN(a) && a.toLocaleString(t, { style: "currency", currency: e }) });
2786
+ }, Qo = ({ currency: e, locale: t, children: n, precision: o = 2 }) => {
2787
+ const s = Intl.NumberFormat().resolvedOptions().locale, { currency: i, locale: a } = ee();
2788
+ e ??= i ?? "EUR", t ??= a ?? s;
2789
+ const c = Number(n);
2790
+ return /* @__PURE__ */ r(A, { children: !isNaN(c) && c.toLocaleString(t, { style: "currency", currency: e, minimumFractionDigits: o }) });
2749
2791
  };
2750
2792
  export {
2751
- sn as Action,
2752
- Et as ActionProvider,
2753
- Q as AlertIcon,
2754
- Jt as AlertProvider,
2755
- _e as AsTemplate,
2756
- Ht as BaseFormFieldError,
2757
- Kt as BaseFormGroup,
2758
- Qn as BaseFormHelp,
2759
- Re as BaseFormLabel,
2760
- gt as BaseLayout,
2761
- k as Block,
2762
- ue as Button,
2763
- er as Choice,
2764
- Xn as ChoiceGroupOption,
2765
- ke as ChoiceOption,
2766
- or as Collection,
2767
- ir as CollectionItem,
2768
- sr as CollectionList,
2769
- Fn as ConfigProvider,
2770
- Vo as Crud,
2771
- Uo as CrudConfiguration,
2772
- mr as CrudForm,
2773
- ko as CrudLoader,
2774
- Eo as CrudProvider,
2775
- ce as CrudRequester,
2776
- Rt as CurrentActionProvider,
2777
- Dt as DataProvider,
2778
- We as Dropdown,
2779
- ve as DropdownButton,
2780
- ae as DropdownContent,
2781
- F as DynamicView,
2782
- bt as Environment,
2783
- ht as ErrorBoundary,
2784
- mt as Exception,
2785
- q as Extend,
2786
- _t as Form,
2787
- ar as FormError,
2788
- et as FormField,
2789
- me as FormFieldViewLoader,
2790
- To as FormGroup,
2791
- $o as FormLabel,
2792
- cr as FormRest,
2793
- lr as FormRestError,
2794
- Io as FormSetting,
2795
- ne as FormViewProvider,
2796
- A as FormViewTypeEnum,
2797
- Hn as GetData,
2798
- Kn as GetDataByAction,
2799
- yr as GridView,
2800
- Be as HttpException,
2801
- tr as Input,
2802
- br as IsListItemActionGranted,
2803
- vr as ItemAction,
2804
- j as Link,
2805
- go as List,
2806
- Co as ListItem,
2807
- hr as ListProvider,
2808
- Bo as ListView,
2809
- Yo as MainLayout,
2810
- Wt as Modal,
2811
- yo as ModalProvider,
2812
- tt as Modify,
2813
- Wo as Money,
2814
- Ho as Outlet,
2815
- Er as Paginator,
2816
- Fo as Parent,
2817
- Go as Route,
2818
- Ko as Router,
2819
- Zn as SelectGroupOption,
2820
- Ut as SelectOption,
2821
- dr as Template,
2822
- qo as TemplateBlock,
2823
- lt as TemplateExtend,
2824
- _o as TemplateParentBlock,
2825
- U as Translation,
2826
- T as UseActions,
2827
- He as UseAlert,
2828
- $t as UseCollection,
2829
- jo as UseCollectionItem,
2830
- le as UseConfig,
2831
- ee as UseCurrentAction,
2832
- qn as UseCurrentActionCollection,
2833
- te as UseDataProvider,
2834
- de as UseForm,
2835
- Mt as UseFormSettings,
2836
- V as UseFormView,
2837
- B as UseList,
2838
- fe as UseListItem,
2839
- ze as UseModal,
2840
- yn as ViewLoader,
2841
- Ro as WithActionProviderContext,
2842
- Mo as WithAlertProvider,
2843
- Tt as WithDataProvider,
2844
- Se as capitalize,
2845
- Do as maskEmail,
2846
- Ce as nameToId,
2847
- Gn as titlize
2793
+ dn as Action,
2794
+ Nt as ActionProvider,
2795
+ Z as AlertIcon,
2796
+ en as AlertProvider,
2797
+ xe as AsTemplate,
2798
+ Wt as BaseFormFieldError,
2799
+ zt as BaseFormGroup,
2800
+ er as BaseFormHelp,
2801
+ De as BaseFormLabel,
2802
+ Et as BaseLayout,
2803
+ T as Block,
2804
+ fe as Button,
2805
+ rr as Choice,
2806
+ nr as ChoiceGroupOption,
2807
+ Re as ChoiceOption,
2808
+ ar as Collection,
2809
+ lr as CollectionItem,
2810
+ cr as CollectionList,
2811
+ Vn as ConfigProvider,
2812
+ qo as Crud,
2813
+ $o as CrudConfiguration,
2814
+ hr as CrudForm,
2815
+ Io as CrudLoader,
2816
+ xo as CrudProvider,
2817
+ le as CrudRequester,
2818
+ It as CurrentActionProvider,
2819
+ Ft as DataProvider,
2820
+ Je as Dropdown,
2821
+ Ee as DropdownButton,
2822
+ ce as DropdownContent,
2823
+ U as DynamicView,
2824
+ Ct as Environment,
2825
+ vt as ErrorBoundary,
2826
+ gt as Exception,
2827
+ H as Extend,
2828
+ At as Form,
2829
+ dr as FormError,
2830
+ ot as FormField,
2831
+ pe as FormFieldViewLoader,
2832
+ Fo as FormGroup,
2833
+ Ko as FormLabel,
2834
+ ur as FormRest,
2835
+ mr as FormRestError,
2836
+ Mo as FormSetting,
2837
+ re as FormViewProvider,
2838
+ w as FormViewTypeEnum,
2839
+ Yn as GetData,
2840
+ Wn as GetDataByAction,
2841
+ _r as GridView,
2842
+ qe as HttpException,
2843
+ or as Input,
2844
+ Er as IsListItemActionGranted,
2845
+ Cr as ItemAction,
2846
+ M as Link,
2847
+ vo as List,
2848
+ No as ListItem,
2849
+ yr as ListProvider,
2850
+ Ho as ListView,
2851
+ Jo as MainLayout,
2852
+ Zt as Modal,
2853
+ _o as ModalProvider,
2854
+ st as Modify,
2855
+ Qo as Money,
2856
+ Yo as Outlet,
2857
+ xr as Paginator,
2858
+ Vo as Parent,
2859
+ zo as Route,
2860
+ Wo as Router,
2861
+ tr as SelectGroupOption,
2862
+ qt as SelectOption,
2863
+ fr as Template,
2864
+ Go as TemplateBlock,
2865
+ ft as TemplateExtend,
2866
+ wo as TemplateParentBlock,
2867
+ D as Translation,
2868
+ j as UseActions,
2869
+ Ge as UseAlert,
2870
+ Gt as UseCollection,
2871
+ Uo as UseCollectionItem,
2872
+ ee as UseConfig,
2873
+ te as UseCurrentAction,
2874
+ Gn as UseCurrentActionCollection,
2875
+ ne as UseDataProvider,
2876
+ Qn as UseDynamicView,
2877
+ me as UseForm,
2878
+ $t as UseFormSettings,
2879
+ B as UseFormView,
2880
+ $ as UseList,
2881
+ he as UseListItem,
2882
+ Qe as UseModal,
2883
+ xn as ViewLoader,
2884
+ To as WithActionProviderContext,
2885
+ Bo as WithAlertProvider,
2886
+ Mt as WithDataProvider,
2887
+ ke as capitalize,
2888
+ jo as maskEmail,
2889
+ _e as nameToId,
2890
+ zn as titlize
2848
2891
  };