@hostlink/light 3.0.5 → 3.0.6

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.
package/dist/light.js CHANGED
@@ -1,103 +1,131 @@
1
- import { jsonToGraphQLQuery as M, VariableType as b } from "json-to-graphql-query";
2
- import H from "axios";
1
+ import { jsonToGraphQLQuery as B, VariableType as b } from "json-to-graphql-query";
2
+ import X from "axios";
3
3
  import S from "collect.js";
4
- function E(t) {
4
+ function U(t) {
5
5
  if (t === null || typeof t != "object")
6
6
  return !1;
7
7
  const e = Object.getPrototypeOf(t);
8
8
  return e !== null && e !== Object.prototype && Object.getPrototypeOf(e) !== null || Symbol.iterator in t ? !1 : Symbol.toStringTag in t ? Object.prototype.toString.call(t) === "[object Module]" : !0;
9
9
  }
10
- function v(t, e, r = ".", o) {
11
- if (!E(e))
12
- return v(t, {}, r, o);
10
+ function v(t, e, r = ".", n) {
11
+ if (!U(e))
12
+ return v(t, {}, r, n);
13
13
  const i = Object.assign({}, e);
14
- for (const u in t) {
15
- if (u === "__proto__" || u === "constructor")
14
+ for (const h in t) {
15
+ if (h === "__proto__" || h === "constructor")
16
16
  continue;
17
- const l = t[u];
18
- l != null && (o && o(i, u, l, r) || (Array.isArray(l) && Array.isArray(i[u]) ? i[u] = [...l, ...i[u]] : E(l) && E(i[u]) ? i[u] = v(
17
+ const l = t[h];
18
+ l != null && (n && n(i, h, l, r) || (Array.isArray(l) && Array.isArray(i[h]) ? i[h] = [...l, ...i[h]] : U(l) && U(i[h]) ? i[h] = v(
19
19
  l,
20
- i[u],
21
- (r ? `${r}.` : "") + u.toString(),
22
- o
23
- ) : i[u] = l));
20
+ i[h],
21
+ (r ? `${r}.` : "") + h.toString(),
22
+ n
23
+ ) : i[h] = l));
24
24
  }
25
25
  return i;
26
26
  }
27
- function X(t) {
27
+ function Y(t) {
28
28
  return (...e) => (
29
29
  // eslint-disable-next-line unicorn/no-array-reduce
30
- e.reduce((r, o) => v(r, o, "", t), {})
30
+ e.reduce((r, n) => v(r, n, "", t), {})
31
31
  );
32
32
  }
33
- const F = X();
33
+ const F = Y();
34
34
  let j = null;
35
- const Y = (t) => {
35
+ const Z = (t) => {
36
36
  j = t;
37
- }, N = () => {
37
+ }, M = () => {
38
38
  if (!j)
39
39
  throw new Error("Api client not initialized. Call setApiClient() first.");
40
40
  return j;
41
- }, Nt = () => j;
42
- function C(t) {
41
+ }, Jt = () => j;
42
+ function D(t) {
43
43
  for (let e = 0; e < t.length; e++)
44
44
  if (t[e] instanceof File)
45
45
  return !0;
46
46
  return !1;
47
47
  }
48
- function B(t) {
48
+ function N(t) {
49
49
  for (let e in t)
50
- if (t[e] instanceof File || t[e] instanceof Array && C(t[e]))
50
+ if (t[e] instanceof File || t[e] instanceof Array && D(t[e]))
51
51
  return !0;
52
52
  return !1;
53
53
  }
54
- function J(t, e, r, o, i) {
54
+ function V(t) {
55
+ t = "<~" + t + "~>";
56
+ var e, r, n, i, h, l = String, u = 255;
57
+ for (t.slice(0, 2) === "<~" && t.slice(-2), t = t.slice(2, -2).replace(/\s/g, "").replace("z", "!!!!!"), e = "uuuuu".slice(t.length % 5 || 5), t += e, n = [], i = 0, h = t.length; h > i; i += 5) r = 52200625 * (t.charCodeAt(i) - 33) + 614125 * (t.charCodeAt(i + 1) - 33) + 7225 * (t.charCodeAt(i + 2) - 33) + 85 * (t.charCodeAt(i + 3) - 33) + (t.charCodeAt(i + 4) - 33), n.push(u & r >> 24, u & r >> 16, u & r >> 8, u & r);
58
+ return (function(s, o) {
59
+ for (var c = o; c > 0; c--) s.pop();
60
+ })(n, e.length), l.fromCharCode.apply(l, n);
61
+ }
62
+ const J = (t = "") => {
63
+ const e = t, r = (n = "application/octet-stream") => {
64
+ const i = new Uint8Array(e.length);
65
+ for (let u = 0; u < e.length; u++)
66
+ i[u] = e.charCodeAt(u);
67
+ const h = new Blob([i], { type: n });
68
+ return URL.createObjectURL(h);
69
+ };
70
+ return {
71
+ getContent: () => e,
72
+ getURL: r,
73
+ download: (n) => {
74
+ const i = document.createElement("a");
75
+ i.download = n, i.href = r(), document.body.appendChild(i), i.click(), document.body.removeChild(i);
76
+ },
77
+ open: (n) => {
78
+ window.open(r(n), "_blank");
79
+ }
80
+ };
81
+ }, Lt = (t) => J(atob(t)), Qt = (t) => J(V(t));
82
+ function L(t, e, r, n, i) {
55
83
  if (!(!t || typeof t != "object"))
56
- for (let u in t) {
57
- const l = t[u];
84
+ for (let h in t) {
85
+ const l = t[h];
58
86
  if (l && typeof l == "object") {
59
87
  if ("__args" in l) {
60
- const h = l.__args, s = {};
61
- Object.entries(h).forEach(([n, c]) => {
62
- if (c instanceof Array && C(c)) {
63
- s[n] = new b(n);
88
+ const u = l.__args, s = {};
89
+ Object.entries(u).forEach(([o, c]) => {
90
+ if (c instanceof Array && D(c)) {
91
+ s[o] = new b(o);
64
92
  let a = 0;
65
- c.forEach((f) => {
66
- f instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + n + "." + a), o.append(i.current.toString(), f), i.current++, a++);
67
- }), e[n] = "[Upload!]!";
68
- } else c instanceof File ? (s[n] = new b(n), r[i.current] = ["variables." + n], o.append(i.current.toString(), c), e[n] = "Upload!", i.current++) : c instanceof Object && B(c) ? (s[n] = {}, Object.entries(c).forEach(([a, f]) => {
69
- if (f instanceof Array && C(f)) {
70
- s[n][a] = new b(a);
71
- let g = 0;
72
- f.forEach((_) => {
73
- _ instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + a + "." + g), o.append(i.current.toString(), _), i.current++, g++);
93
+ c.forEach((p) => {
94
+ p instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + o + "." + a), n.append(i.current.toString(), p), i.current++, a++);
95
+ }), e[o] = "[Upload!]!";
96
+ } else c instanceof File ? (s[o] = new b(o), r[i.current] = ["variables." + o], n.append(i.current.toString(), c), e[o] = "Upload!", i.current++) : c instanceof Object && N(c) ? (s[o] = {}, Object.entries(c).forEach(([a, p]) => {
97
+ if (p instanceof Array && D(p)) {
98
+ s[o][a] = new b(a);
99
+ let d = 0;
100
+ p.forEach((_) => {
101
+ _ instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + a + "." + d), n.append(i.current.toString(), _), i.current++, d++);
74
102
  }), e[a] = "[Upload!]!";
75
- } else f instanceof File ? (s[n][a] = new b(a), r[i.current] = ["variables." + a], o.append(i.current.toString(), f), e[a] = "Upload!", i.current++) : s[n][a] = f;
76
- })) : c != null && (s[n] = c);
103
+ } else p instanceof File ? (s[o][a] = new b(a), r[i.current] = ["variables." + a], n.append(i.current.toString(), p), e[a] = "Upload!", i.current++) : s[o][a] = p;
104
+ })) : c != null && (s[o] = c);
77
105
  }), l.__args = s;
78
106
  }
79
- J(l, e, r, o, i);
107
+ L(l, e, r, n, i);
80
108
  }
81
109
  }
82
110
  }
83
111
  const y = async (t) => {
84
- const e = N(), r = t, o = new FormData();
112
+ const e = M(), r = t, n = new FormData();
85
113
  let i = !1;
86
- const u = {}, l = {};
87
- J(r, u, l, o, { current: 0 }), i = Object.keys(u).length > 0, i && (r.__variables = u);
114
+ const h = {}, l = {};
115
+ L(r, h, l, n, { current: 0 }), i = Object.keys(h).length > 0, i && (r.__variables = h);
88
116
  let s = null;
89
- const c = M({ query: r });
90
- if (i ? (o.append("map", JSON.stringify(l)), o.append("operations", JSON.stringify({
117
+ const c = B({ query: r });
118
+ if (i ? (n.append("map", JSON.stringify(l)), n.append("operations", JSON.stringify({
91
119
  query: c
92
- })), s = await e.axios.post("", o)) : s = await e.axios.post("", {
120
+ })), s = await e.axios.post("", n)) : s = await e.axios.post("", {
93
121
  query: c
94
122
  }), s.data.errors)
95
123
  throw new Error(s.data.errors[0].message);
96
124
  return s.data.data;
97
125
  };
98
126
  function k(t, e) {
99
- let r, o = [], i, u;
100
- const l = (s) => !s || typeof s != "object" ? !1 : Object.values(s).some((n) => n && typeof n == "object" && Object.keys(n).some((c) => c.startsWith("_"))), h = () => o.length === 0 ? (o.unshift({}), o[0]) : (l(o[0]) && o.unshift({}), o[0]);
127
+ let r, n = [], i, h;
128
+ const l = (s) => !s || typeof s != "object" ? !1 : Object.values(s).some((o) => o && typeof o == "object" && Object.keys(o).some((c) => c.startsWith("_"))), u = () => n.length === 0 ? (n.unshift({}), n[0]) : (l(n[0]) && n.unshift({}), n[0]);
101
129
  return {
102
130
  first() {
103
131
  return this.fetchFirst();
@@ -106,43 +134,43 @@ function k(t, e) {
106
134
  return this.fetch();
107
135
  },
108
136
  async fetchFirst() {
109
- const n = await this.limit(1).fetch();
110
- return Array.isArray(n) && n.length > 0 ? n[0] : null;
137
+ const o = await this.limit(1).fetch();
138
+ return Array.isArray(o) && o.length > 0 ? o[0] : null;
111
139
  },
112
140
  async fetchWithMeta() {
113
- let n = await y(this.toQuery(!0));
114
- if (u) {
115
- const c = u.split(".");
141
+ let o = await y(this.toQuery(!0));
142
+ if (h) {
143
+ const c = h.split(".");
116
144
  for (const a of c)
117
- n = n[a];
118
- return n;
145
+ o = o[a];
146
+ return o;
119
147
  }
120
- return n[`list${t}`];
148
+ return o[`list${t}`];
121
149
  },
122
150
  async fetch() {
123
- let n = await y(this.toQuery());
124
- if (u) {
125
- const c = u.split(".");
151
+ let o = await y(this.toQuery());
152
+ if (h) {
153
+ const c = h.split(".");
126
154
  for (const a of c)
127
- n = n[a];
128
- return n.data;
155
+ o = o[a];
156
+ return o.data;
129
157
  }
130
- return n[`list${t}`].data;
158
+ return o[`list${t}`].data;
131
159
  },
132
160
  dataPath(s) {
133
- return s && typeof s == "string" && (u = s), this;
161
+ return s && typeof s == "string" && (h = s), this;
134
162
  },
135
163
  sort(s) {
136
164
  return s && typeof s == "string" && (i = s), this;
137
165
  },
138
166
  filters(s) {
139
- return s && typeof s == "object" && (o = [s]), this;
167
+ return s && typeof s == "object" && (n = [s]), this;
140
168
  },
141
169
  // where can be called as:
142
170
  // where('key', value) -> exact match
143
171
  // where('key', '>', value) -> operator-based (>, <, >=, <=, !=, in, contains)
144
- where(s, n, c) {
145
- const a = (f, g, _) => {
172
+ where(s, o, c) {
173
+ const a = (p, d, _) => {
146
174
  const O = {
147
175
  ">": "_gt",
148
176
  "<": "_lt",
@@ -151,41 +179,41 @@ function k(t, e) {
151
179
  "!=": "_ne",
152
180
  in: "_in",
153
181
  contains: "_contains"
154
- }[g];
155
- O && o.push({ [f]: { [O]: _ } });
182
+ }[d];
183
+ O && n.push({ [p]: { [O]: _ } });
156
184
  };
157
185
  if (c !== void 0)
158
- a(s, String(n), c);
186
+ a(s, String(o), c);
159
187
  else {
160
- const f = h(), g = F(f, { [s]: n });
161
- o[0] = g;
188
+ const p = u(), d = F(p, { [s]: o });
189
+ n[0] = d;
162
190
  }
163
191
  return this;
164
192
  },
165
193
  // whereContains adds a _contains filter for a specific field
166
194
  // If the same field is used multiple times, it merges them into an array
167
- whereContains(s, n) {
195
+ whereContains(s, o) {
168
196
  if (s && typeof s == "string") {
169
- const c = h(), a = { _contains: n };
170
- c[s] ? Array.isArray(c[s]) ? c[s].push(a) : c[s] = [c[s], a] : c[s] = [a], o[0] = c;
197
+ const c = u(), a = { _contains: o };
198
+ c[s] ? Array.isArray(c[s]) ? c[s].push(a) : c[s] = [c[s], a] : c[s] = [a], n[0] = c;
171
199
  }
172
200
  return this;
173
201
  },
174
202
  // ...existing code...
175
203
  // whereIn adds an _in filter for a specific field
176
204
  // If the same field is used multiple times, it merges them into an array
177
- whereIn(s, n) {
178
- if (s && typeof s == "string" && Array.isArray(n)) {
179
- const c = h(), a = { _in: n };
180
- c[s] ? Array.isArray(c[s]) ? c[s].push(a) : c[s] = [c[s], a] : c[s] = [a], o[0] = c;
205
+ whereIn(s, o) {
206
+ if (s && typeof s == "string" && Array.isArray(o)) {
207
+ const c = u(), a = { _in: o };
208
+ c[s] ? Array.isArray(c[s]) ? c[s].push(a) : c[s] = [c[s], a] : c[s] = [a], n[0] = c;
181
209
  }
182
210
  return this;
183
211
  },
184
212
  // whereBetween adds a _between filter for a specific field
185
- whereBetween(s, n, c) {
213
+ whereBetween(s, o, c) {
186
214
  if (s && typeof s == "string") {
187
- const a = h(), f = { _between: [n, c] };
188
- a[s] ? Array.isArray(a[s]) ? a[s].push(f) : a[s] = [a[s], f] : a[s] = f, o[0] = a;
215
+ const a = u(), p = { _between: [o, c] };
216
+ a[s] ? Array.isArray(a[s]) ? a[s].push(p) : a[s] = [a[s], p] : a[s] = p, n[0] = a;
189
217
  }
190
218
  return this;
191
219
  },
@@ -198,23 +226,23 @@ function k(t, e) {
198
226
  return typeof s == "number" && Number.isFinite(s) && (r = F(r || {}, { offset: s })), this;
199
227
  },
200
228
  toQuery(s = !1) {
201
- let n;
202
- const c = o.length > 0 && Object.keys(o[0] || {}).length > 0, a = c ? 1 : 0, f = o.length > a;
203
- c && f ? n = o : f ? n = o.slice(a) : c && (n = o[0]);
204
- const g = F(
229
+ let o;
230
+ const c = n.length > 0 && Object.keys(n[0] || {}).length > 0, a = c ? 1 : 0, p = n.length > a;
231
+ c && p ? o = n : p ? o = n.slice(a) : c && (o = n[0]);
232
+ const d = F(
205
233
  i ? { sort: i } : {},
206
- n ? { filters: n } : {}
234
+ o ? { filters: o } : {}
207
235
  ), _ = {
208
236
  data: {
209
237
  ...e
210
238
  }
211
239
  };
212
- if (r && (_.data.__args = r), Object.keys(g).length > 0 && (_.__args = g), s && (_.meta = {
240
+ if (r && (_.data.__args = r), Object.keys(d).length > 0 && (_.__args = d), s && (_.meta = {
213
241
  total: !0,
214
242
  key: !0,
215
243
  name: !0
216
- }), u) {
217
- const w = u.split(".");
244
+ }), h) {
245
+ const w = h.split(".");
218
246
  let O = _;
219
247
  for (let P = w.length - 1; P >= 0; P--)
220
248
  O = {
@@ -228,13 +256,13 @@ function k(t, e) {
228
256
  }
229
257
  };
230
258
  }
231
- const Z = (t, e = {}) => {
232
- const r = t, o = e;
259
+ const I = (t, e = {}) => {
260
+ const r = t, n = e;
233
261
  let i = "list" + t;
234
- const u = (l) => o[l] ? o[l] : null;
262
+ const h = (l) => n[l] ? n[l] : null;
235
263
  return {
236
- field: u,
237
- $fields: o,
264
+ field: h,
265
+ $fields: n,
238
266
  setDataPath(l) {
239
267
  return i = l, i;
240
268
  },
@@ -242,91 +270,91 @@ const Z = (t, e = {}) => {
242
270
  return i;
243
271
  },
244
272
  gqlFields(l) {
245
- let h = {};
273
+ let u = {};
246
274
  for (const s of l)
247
275
  if (typeof s == "string") {
248
- const n = u(s);
249
- n && (h = F(h, n.gqlField ? typeof n.gqlField == "string" ? { [n.gqlField]: !0 } : n.gqlField : { [n.name || s]: !0 }));
250
- } else typeof s == "object" && (h = F(h, s));
251
- return h;
276
+ const o = h(s);
277
+ o && (u = F(u, o.gqlField ? typeof o.gqlField == "string" ? { [o.gqlField]: !0 } : o.gqlField : { [o.name || s]: !0 }));
278
+ } else typeof s == "object" && (u = F(u, s));
279
+ return u;
252
280
  },
253
- update(l, h) {
254
- return p({
281
+ update(l, u) {
282
+ return f({
255
283
  ["update" + r]: {
256
- __args: { id: l, data: h }
284
+ __args: { id: l, data: u }
257
285
  }
258
286
  }).then((s) => s["update" + r]);
259
287
  },
260
288
  async delete(l) {
261
- return p({
289
+ return f({
262
290
  ["delete" + r]: {
263
291
  __args: { id: l }
264
292
  }
265
- }).then((h) => h["delete" + r]);
293
+ }).then((u) => u["delete" + r]);
266
294
  },
267
295
  add(l) {
268
- return p({
296
+ return f({
269
297
  ["add" + r]: {
270
298
  __args: { data: l }
271
299
  }
272
- }).then((h) => h["add" + r]);
300
+ }).then((u) => u["add" + r]);
273
301
  },
274
302
  fields(l) {
275
- let h = [];
303
+ let u = [];
276
304
  for (let s of l) {
277
- const n = u(s);
278
- n && h.push(n);
305
+ const o = h(s);
306
+ o && u.push(o);
279
307
  }
280
- return h;
308
+ return u;
281
309
  },
282
- async get(l, h) {
283
- const s = (await Promise.resolve().then(() => St)).default, n = s(r, kt(h));
310
+ async get(l, u) {
311
+ const s = (await Promise.resolve().then(() => qt)).default, o = s(r, Ut(u));
284
312
  for (const [c, a] of Object.entries(l))
285
- n.where(c, "==", a);
286
- return await n.first();
313
+ o.where(c, "==", a);
314
+ return await o.first();
287
315
  },
288
316
  list(l) {
289
- let h = l;
317
+ let u = l;
290
318
  const s = {};
291
319
  Object.entries(l).forEach(([a]) => {
292
- o[a] && (s[a] = o[a], o[a].gqlField && (delete h[a], h = F(h, o[a].gqlField)), o[a].gql && (h = F(h, o[a].gql), delete h[a]));
320
+ n[a] && (s[a] = n[a], n[a].gqlField && (delete u[a], u = F(u, n[a].gqlField)), n[a].gql && (u = F(u, n[a].gql), delete u[a]));
293
321
  });
294
- const n = k(r, h).dataPath(i), c = n.fetch.bind(n);
322
+ const o = k(r, u).dataPath(i), c = o.fetch.bind(o);
295
323
  return {
296
- ...n,
324
+ ...o,
297
325
  async fetch() {
298
- return (await c()).map((f) => {
299
- const g = { ...f };
326
+ return (await c()).map((p) => {
327
+ const d = { ...p };
300
328
  return Object.entries(s).forEach(([_, w]) => {
301
- w.format && typeof w.format == "function" && (g[_] = w.format(f));
302
- }), g;
329
+ w.format && typeof w.format == "function" && (d[_] = w.format(p));
330
+ }), d;
303
331
  });
304
332
  },
305
333
  async fetchFirst() {
306
- const f = await n.fetchFirst.bind(n)();
307
- if (!f) return f;
308
- const g = { ...f };
334
+ const p = await o.fetchFirst.bind(o)();
335
+ if (!p) return p;
336
+ const d = { ...p };
309
337
  return Object.entries(s).forEach(([_, w]) => {
310
- w.format && typeof w.format == "function" && (g[_] = w.format(f));
311
- }), g;
338
+ w.format && typeof w.format == "function" && (d[_] = w.format(p));
339
+ }), d;
312
340
  }
313
341
  };
314
342
  }
315
343
  };
316
- }, A = {}, L = (t, e) => {
317
- const r = Z(t, e);
344
+ }, A = {}, Q = (t, e) => {
345
+ const r = I(t, e);
318
346
  return A[t] = r, r;
319
- }, U = (t) => A[t] ? A[t] : L(t, {}), Bt = (t) => !!A[t], Jt = () => Object.keys(A), Lt = () => {
347
+ }, E = (t) => A[t] ? A[t] : Q(t, {}), Tt = (t) => !!A[t], $t = () => Object.keys(A), Gt = () => {
320
348
  Object.keys(A).forEach((t) => delete A[t]);
321
- }, Qt = (t) => {
349
+ }, Rt = (t) => {
322
350
  Object.entries(t).forEach(([e, r]) => {
323
- L(e, r);
351
+ Q(e, r);
324
352
  });
325
- }, Tt = () => y({
353
+ }, Wt = () => y({
326
354
  app: {
327
355
  permissions: !0
328
356
  }
329
- }).then((t) => t.app.permissions), Q = async () => {
357
+ }).then((t) => t.app.permissions), T = async () => {
330
358
  const { app: t } = await y({
331
359
  app: {
332
360
  auth: {
@@ -335,7 +363,7 @@ const Z = (t, e = {}) => {
335
363
  }
336
364
  }), e = t.auth.webAuthnRequestOptions, r = PublicKeyCredential.parseRequestOptionsFromJSON(e);
337
365
  return await navigator.credentials.get({ publicKey: r });
338
- }, T = async () => {
366
+ }, $ = async () => {
339
367
  const { app: t } = await y({
340
368
  app: {
341
369
  auth: {
@@ -344,31 +372,31 @@ const Z = (t, e = {}) => {
344
372
  }
345
373
  }), e = PublicKeyCredential.parseCreationOptionsFromJSON(t.auth.webAuthnCreationOptions);
346
374
  return await navigator.credentials.create({ publicKey: e });
347
- }, V = async () => {
348
- const t = await Q();
349
- return await p({
375
+ }, K = async () => {
376
+ const t = await T();
377
+ return await f({
350
378
  webAuthnAssertion: {
351
379
  __args: {
352
380
  assertion: t.toJSON()
353
381
  }
354
382
  }
355
383
  }).then((e) => e.webAuthnAssertion);
356
- }, I = async () => {
357
- const t = await T();
358
- return await p({
384
+ }, x = async () => {
385
+ const t = await $();
386
+ return await f({
359
387
  webAuthnRegister: {
360
388
  __args: {
361
389
  registration: t.toJSON()
362
390
  }
363
391
  }
364
392
  }).then((e) => e.webAuthnRegister);
365
- }, K = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
393
+ }, tt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
366
394
  __proto__: null,
367
- assertion: Q,
368
- attestation: T,
369
- login: V,
370
- register: I
371
- }, Symbol.toStringTag, { value: "Module" })), x = (t = W) => y({ my: t }).then((e) => e.my), tt = (t, e, r = "") => p({ login: { __args: { username: t, password: e, code: r } } }).then((o) => o.login), et = () => p({ logout: !0 }).then((t) => t.logout), rt = (t, e, r) => p({ changeExpiredPassword: { __args: { username: t, old_password: e, new_password: r } } }).then((o) => o.changeExpiredPassword), st = (t, e) => p({ changeUserPassword: { __args: { old_password: t, new_password: e } } }).then((r) => r.changeUserPassword), nt = (t, e, r) => p({ resetPassword: { __args: { jwt: t, password: e, code: r } } }).then((o) => o.resetPassword), ot = (t, e) => p({ forgetPassword: { __args: { username: t, email: e } } }).then((r) => r.forgetPassword), it = (t, e) => p({ forgetPasswordVerifyCode: { __args: { jwt: t, code: e } } }).then((r) => r.forgetPasswordVerifyCode), at = (t) => y({
395
+ assertion: T,
396
+ attestation: $,
397
+ login: K,
398
+ register: x
399
+ }, Symbol.toStringTag, { value: "Module" })), et = (t = W) => y({ my: t }).then((e) => e.my), rt = (t, e, r = "") => f({ login: { __args: { username: t, password: e, code: r } } }).then((n) => n.login), st = () => f({ logout: !0 }).then((t) => t.logout), nt = (t, e, r) => f({ changeExpiredPassword: { __args: { username: t, old_password: e, new_password: r } } }).then((n) => n.changeExpiredPassword), ot = (t, e) => f({ changeUserPassword: { __args: { old_password: t, new_password: e } } }).then((r) => r.changeUserPassword), it = (t, e, r) => f({ resetPassword: { __args: { jwt: t, password: e, code: r } } }).then((n) => n.resetPassword), at = (t, e) => f({ forgetPassword: { __args: { username: t, email: e } } }).then((r) => r.forgetPassword), ct = (t, e) => f({ forgetPasswordVerifyCode: { __args: { jwt: t, code: e } } }).then((r) => r.forgetPasswordVerifyCode), lt = (t) => y({
372
400
  my: {
373
401
  granted: {
374
402
  __args: {
@@ -376,7 +404,7 @@ const Z = (t, e = {}) => {
376
404
  }
377
405
  }
378
406
  }
379
- }).then((e) => e.my.granted), ct = (t) => y({
407
+ }).then((e) => e.my.granted), ut = (t) => y({
380
408
  my: {
381
409
  grantedRights: {
382
410
  __args: {
@@ -384,40 +412,40 @@ const Z = (t, e = {}) => {
384
412
  }
385
413
  }
386
414
  }
387
- }).then((e) => e.my.grantedRights), lt = () => ({
388
- getCurrentUser: x,
389
- webAuthn: K,
415
+ }).then((e) => e.my.grantedRights), ht = () => ({
416
+ getCurrentUser: et,
417
+ webAuthn: tt,
390
418
  google: {
391
- unlink: () => p({ lightAuthUnlinkGoogle: !0 }).then((t) => t.lightAuthUnlinkGoogle),
392
- login: (t) => p({ lightAuthLoginGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthLoginGoogle),
393
- register: (t) => p({ lightAuthRegisterGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthRegisterGoogle)
419
+ unlink: () => f({ lightAuthUnlinkGoogle: !0 }).then((t) => t.lightAuthUnlinkGoogle),
420
+ login: (t) => f({ lightAuthLoginGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthLoginGoogle),
421
+ register: (t) => f({ lightAuthRegisterGoogle: { __args: { credential: t } } }).then((e) => e.lightAuthRegisterGoogle)
394
422
  },
395
423
  facebook: {
396
- unlink: () => p({ lightAuthUnlinkFacebook: !0 }).then((t) => t.lightAuthUnlinkFacebook),
397
- login: (t) => p({ lightAuthLoginFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginFacebook),
398
- register: (t) => p({ lightAuthRegisterFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthRegisterFacebook)
424
+ unlink: () => f({ lightAuthUnlinkFacebook: !0 }).then((t) => t.lightAuthUnlinkFacebook),
425
+ login: (t) => f({ lightAuthLoginFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginFacebook),
426
+ register: (t) => f({ lightAuthRegisterFacebook: { __args: { access_token: t } } }).then((e) => e.lightAuthRegisterFacebook)
399
427
  },
400
428
  microsoft: {
401
- unlink: () => p({ lightAuthUnlinkMicrosoft: !0 }).then((t) => t.lightAuthUnlinkMicrosoft),
402
- login: (t) => p({ lightAuthLoginMicrosoft: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginMicrosoft),
403
- register: (t) => p({ lightAuthRegisterMicrosoft: { __args: { account_id: t } } }).then((e) => e.lightAuthRegisterMicrosoft)
429
+ unlink: () => f({ lightAuthUnlinkMicrosoft: !0 }).then((t) => t.lightAuthUnlinkMicrosoft),
430
+ login: (t) => f({ lightAuthLoginMicrosoft: { __args: { access_token: t } } }).then((e) => e.lightAuthLoginMicrosoft),
431
+ register: (t) => f({ lightAuthRegisterMicrosoft: { __args: { account_id: t } } }).then((e) => e.lightAuthRegisterMicrosoft)
404
432
  },
405
- login: tt,
406
- logout: et,
407
- changeExpiredPassword: rt,
408
- updatePassword: st,
409
- resetPassword: nt,
410
- forgetPassword: ot,
411
- verifyCode: it,
412
- grantedRights: ct,
413
- isGranted: at
414
- }), $ = {
433
+ login: rt,
434
+ logout: st,
435
+ changeExpiredPassword: nt,
436
+ updatePassword: ot,
437
+ resetPassword: it,
438
+ forgetPassword: at,
439
+ verifyCode: ct,
440
+ grantedRights: ut,
441
+ isGranted: lt
442
+ }), G = {
415
443
  name: !0,
416
444
  path: !0,
417
445
  size: !0,
418
446
  mime: !0,
419
447
  url: !0
420
- }, ut = (t, e, r = $) => y({
448
+ }, pt = (t, e, r = G) => y({
421
449
  app: {
422
450
  drive: {
423
451
  __args: { index: t },
@@ -427,7 +455,7 @@ const Z = (t, e = {}) => {
427
455
  }
428
456
  }
429
457
  }
430
- }).then((o) => o.app.drive.files), ht = (t, e) => y({
458
+ }).then((n) => n.app.drive.files), ft = (t, e) => y({
431
459
  app: {
432
460
  drive: {
433
461
  __args: {
@@ -442,7 +470,7 @@ const Z = (t, e = {}) => {
442
470
  }
443
471
  }
444
472
  }).then((r) => r.app.drive?.file?.base64Content), m = (t) => ({
445
- list: (e, r = $) => ut(t, e, r),
473
+ list: (e, r = G) => pt(t, e, r),
446
474
  get: (e, r = {
447
475
  name: !0,
448
476
  path: !0,
@@ -463,9 +491,9 @@ const Z = (t, e = {}) => {
463
491
  }
464
492
  }
465
493
  }
466
- }).then((o) => o.app.drive.file),
494
+ }).then((n) => n.app.drive.file),
467
495
  readFileAsBase64(e) {
468
- return ht(t, e);
496
+ return ft(t, e);
469
497
  },
470
498
  read: async (e) => {
471
499
  let r = await y({
@@ -487,14 +515,14 @@ const Z = (t, e = {}) => {
487
515
  throw new Error(`File not found or cannot read content: ${e}`);
488
516
  return typeof window < "u" && window.atob ? window.atob(r.app.drive.file.base64Content) : r.app.drive.file.base64Content;
489
517
  },
490
- write: (e, r) => p({ lightDriveWriteFile: { __args: { index: t, path: e, content: r } } }).then((o) => o.lightDriveWriteFile),
491
- delete: (e) => p({ lightDriveDeleteFile: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFile),
492
- rename: (e, r) => p({ lightDriveRenameFile: { __args: { index: t, path: e, name: r } } }).then((o) => o.lightDriveRenameFile),
493
- move: (e, r) => p({ lightDriveMoveFile: { __args: { index: t, source: e, destination: r } } }).then((o) => o.lightDriveMoveFile)
494
- }), G = {
518
+ write: (e, r) => f({ lightDriveWriteFile: { __args: { index: t, path: e, content: r } } }).then((n) => n.lightDriveWriteFile),
519
+ delete: (e) => f({ lightDriveDeleteFile: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFile),
520
+ rename: (e, r) => f({ lightDriveRenameFile: { __args: { index: t, path: e, name: r } } }).then((n) => n.lightDriveRenameFile),
521
+ move: (e, r) => f({ lightDriveMoveFile: { __args: { index: t, source: e, destination: r } } }).then((n) => n.lightDriveMoveFile)
522
+ }), R = {
495
523
  name: !0,
496
524
  path: !0
497
- }, ft = (t, e, r = G) => y({
525
+ }, dt = (t, e, r = R) => y({
498
526
  app: {
499
527
  drive: {
500
528
  __args: { index: t },
@@ -504,19 +532,19 @@ const Z = (t, e = {}) => {
504
532
  }
505
533
  }
506
534
  }
507
- }).then((o) => o.app.drive.folders), D = (t) => ({
508
- list: (e, r = G) => ft(t, e, r),
509
- create: (e) => p({ lightDriveCreateFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveCreateFolder),
510
- delete: (e) => p({ lightDriveDeleteFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFolder),
511
- rename: (e, r) => p({ lightDriveRenameFolder: { __args: { index: t, path: e, name: r } } }).then((o) => o.lightDriveRenameFolder)
512
- }), $t = () => y({
535
+ }).then((n) => n.app.drive.folders), C = (t) => ({
536
+ list: (e, r = R) => dt(t, e, r),
537
+ create: (e) => f({ lightDriveCreateFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveCreateFolder),
538
+ delete: (e) => f({ lightDriveDeleteFolder: { __args: { index: t, path: e } } }).then((r) => r.lightDriveDeleteFolder),
539
+ rename: (e, r) => f({ lightDriveRenameFolder: { __args: { index: t, path: e, name: r } } }).then((n) => n.lightDriveRenameFolder)
540
+ }), zt = () => y({
513
541
  app: {
514
542
  drives: {
515
543
  index: !0,
516
544
  name: !0
517
545
  }
518
546
  }
519
- }).then((t) => t.app.drives), pt = (t) => ({
547
+ }).then((t) => t.app.drives), gt = (t) => ({
520
548
  listFiles: m(t).list,
521
549
  getFile: m(t).get,
522
550
  readFile: m(t).read,
@@ -524,11 +552,11 @@ const Z = (t, e = {}) => {
524
552
  deleteFile: m(t).delete,
525
553
  renameFile: m(t).rename,
526
554
  moveFile: m(t).move,
527
- listFolders: D(t).list,
528
- createFolder: D(t).create,
529
- deleteFolder: D(t).delete,
530
- renameFolder: D(t).rename,
531
- uploadTempFile: (e) => p({
555
+ listFolders: C(t).list,
556
+ createFolder: C(t).create,
557
+ deleteFolder: C(t).delete,
558
+ renameFolder: C(t).rename,
559
+ uploadTempFile: (e) => f({
532
560
  lightDriveUploadTempFile: {
533
561
  __args: { index: t, file: e },
534
562
  name: !0,
@@ -537,7 +565,7 @@ const Z = (t, e = {}) => {
537
565
  mime: !0
538
566
  }
539
567
  }).then((r) => r.lightDriveUploadTempFile),
540
- folders: D(t),
568
+ folders: C(t),
541
569
  files: m(t)
542
570
  }), W = {
543
571
  user_id: !0,
@@ -545,24 +573,24 @@ const Z = (t, e = {}) => {
545
573
  first_name: !0,
546
574
  last_name: !0,
547
575
  status: !0
548
- }, gt = (t) => p({
576
+ }, _t = (t) => f({
549
577
  addUser: {
550
578
  __args: t
551
579
  }
552
- }).then((e) => e.addUser), dt = (t) => p({
580
+ }).then((e) => e.addUser), yt = (t) => f({
553
581
  deleteUser: {
554
582
  __args: { id: t }
555
583
  }
556
- }).then((e) => e.deleteUser), _t = (t = W) => k("Users", t).dataPath("app.listUser").fetch(), yt = (t, e) => p({
584
+ }).then((e) => e.deleteUser), wt = (t = W) => k("Users", t).dataPath("app.listUser").fetch(), mt = (t, e) => f({
557
585
  updateUser: {
558
586
  __args: { id: t, data: e }
559
587
  }
560
- }).then((r) => r.updateUser), wt = () => ({
561
- list: _t,
562
- create: gt,
563
- delete: dt,
564
- update: yt
565
- }), mt = (t) => y({
588
+ }).then((r) => r.updateUser), bt = () => ({
589
+ list: wt,
590
+ create: _t,
591
+ delete: yt,
592
+ update: mt
593
+ }), Ft = (t) => y({
566
594
  app: {
567
595
  listConfig: {
568
596
  __args: {
@@ -576,13 +604,13 @@ const Z = (t, e = {}) => {
576
604
  }
577
605
  }
578
606
  }
579
- }).then((e) => e.app.listConfig.data[0]?.value), bt = {
607
+ }).then((e) => e.app.listConfig.data[0]?.value), At = {
580
608
  name: !0
581
- }, Ft = (t = bt) => y({
609
+ }, Ot = (t = At) => y({
582
610
  app: {
583
611
  roles: t
584
612
  }
585
- }).then((e) => e.app.roles), At = (t, e) => p({
613
+ }).then((e) => e.app.roles), Ct = (t, e) => f({
586
614
  addRole: {
587
615
  __args: {
588
616
  data: {
@@ -591,78 +619,78 @@ const Z = (t, e = {}) => {
591
619
  }
592
620
  }
593
621
  }
594
- }).then((r) => r.addRole), Ot = (t) => p({
622
+ }).then((r) => r.addRole), Dt = (t) => f({
595
623
  deleteRole: {
596
624
  __args: { name: t }
597
625
  }
598
- }).then((e) => e.deleteRole), Dt = () => ({
599
- list: Ft,
600
- create: At,
601
- delete: Ot
626
+ }).then((e) => e.deleteRole), jt = () => ({
627
+ list: Ot,
628
+ create: Ct,
629
+ delete: Dt
602
630
  });
603
- function z(t, e, r, o, i) {
631
+ function z(t, e, r, n, i) {
604
632
  if (!(!t || typeof t != "object"))
605
- for (let u in t) {
606
- const l = t[u];
633
+ for (let h in t) {
634
+ const l = t[h];
607
635
  if (l && typeof l == "object") {
608
636
  if ("__args" in l) {
609
- const h = l.__args, s = {};
610
- Object.entries(h).forEach(([n, c]) => {
611
- if (c instanceof Array && C(c)) {
612
- s[n] = new b(n);
637
+ const u = l.__args, s = {};
638
+ Object.entries(u).forEach(([o, c]) => {
639
+ if (c instanceof Array && D(c)) {
640
+ s[o] = new b(o);
613
641
  let a = 0;
614
- c.forEach((f) => {
615
- f instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + n + "." + a), o.append(i.current.toString(), f), i.current++, a++);
616
- }), e[n] = "[Upload!]!";
617
- } else c instanceof File ? (s[n] = new b(n), r[i.current] = ["variables." + n], o.append(i.current.toString(), c), e[n] = "Upload!", i.current++) : c instanceof Object && B(c) ? (s[n] = {}, Object.entries(c).forEach(([a, f]) => {
618
- if (f instanceof Array && C(f)) {
619
- s[n][a] = new b(a);
620
- let g = 0;
621
- f.forEach((_) => {
622
- _ instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + a + "." + g), o.append(i.current.toString(), _), i.current++, g++);
642
+ c.forEach((p) => {
643
+ p instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + o + "." + a), n.append(i.current.toString(), p), i.current++, a++);
644
+ }), e[o] = "[Upload!]!";
645
+ } else c instanceof File ? (s[o] = new b(o), r[i.current] = ["variables." + o], n.append(i.current.toString(), c), e[o] = "Upload!", i.current++) : c instanceof Object && N(c) ? (s[o] = {}, Object.entries(c).forEach(([a, p]) => {
646
+ if (p instanceof Array && D(p)) {
647
+ s[o][a] = new b(a);
648
+ let d = 0;
649
+ p.forEach((_) => {
650
+ _ instanceof File && (r[i.current] || (r[i.current] = []), r[i.current].push("variables." + a + "." + d), n.append(i.current.toString(), _), i.current++, d++);
623
651
  }), e[a] = "[Upload!]!";
624
- } else f instanceof File ? (s[n][a] = new b(a), r[i.current] = ["variables." + a], o.append(i.current.toString(), f), e[a] = "Upload!", i.current++) : s[n][a] = f;
625
- })) : c != null && (s[n] = c);
652
+ } else p instanceof File ? (s[o][a] = new b(a), r[i.current] = ["variables." + a], n.append(i.current.toString(), p), e[a] = "Upload!", i.current++) : s[o][a] = p;
653
+ })) : c != null && (s[o] = c);
626
654
  }), l.__args = s;
627
655
  }
628
- z(l, e, r, o, i);
656
+ z(l, e, r, n, i);
629
657
  }
630
658
  }
631
659
  }
632
- const p = async (t) => {
633
- const r = N().axios, o = t, i = new FormData();
634
- let u = !1;
635
- const l = {}, h = {};
636
- z(o, l, h, i, { current: 0 }), u = Object.keys(l).length > 0, u && (o.__variables = l);
637
- let n = null;
638
- const a = M({ mutation: o });
639
- if (u ? (i.append("map", JSON.stringify(h)), i.append("operations", JSON.stringify({
660
+ const f = async (t) => {
661
+ const r = M().axios, n = t, i = new FormData();
662
+ let h = !1;
663
+ const l = {}, u = {};
664
+ z(n, l, u, i, { current: 0 }), h = Object.keys(l).length > 0, h && (n.__variables = l);
665
+ let o = null;
666
+ const a = B({ mutation: n });
667
+ if (h ? (i.append("map", JSON.stringify(u)), i.append("operations", JSON.stringify({
640
668
  query: a
641
- })), n = await r.post("", i)) : n = await r.post("", {
669
+ })), o = await r.post("", i)) : o = await r.post("", {
642
670
  query: a
643
- }), n.data.errors)
644
- throw new Error(n.data.errors[0].message);
645
- return n.data.data;
646
- }, Ct = (t, e, r) => p({ sendMail: { __args: { email: t, subject: e, message: r } } }).then((o) => o.sendMail), jt = {
647
- send: Ct
671
+ }), o.data.errors)
672
+ throw new Error(o.data.errors[0].message);
673
+ return o.data.data;
674
+ }, kt = (t, e, r) => f({ sendMail: { __args: { email: t, subject: e, message: r } } }).then((n) => n.sendMail), Pt = {
675
+ send: kt
648
676
  }, q = (t) => {
649
677
  let e = {};
650
678
  return typeof t == "string" ? (e[t] = !0, e) : t instanceof Array ? (t.forEach((r) => {
651
- Object.entries(q(r)).forEach(([o, i]) => {
652
- e[o] = i;
679
+ Object.entries(q(r)).forEach(([n, i]) => {
680
+ e[n] = i;
653
681
  });
654
- }), e) : (Object.entries(t).forEach(([r, o]) => {
682
+ }), e) : (Object.entries(t).forEach(([r, n]) => {
655
683
  if (r == "__args" || r == "__aliasFor" || r == "__variables" || r == "__directives" || r == "__all_on" || r == "__name") {
656
- e[r] = o;
684
+ e[r] = n;
657
685
  return;
658
686
  }
659
- if (typeof o == "boolean") {
660
- e[r] = o;
687
+ if (typeof n == "boolean") {
688
+ e[r] = n;
661
689
  return;
662
690
  }
663
- e[r] = q(o);
691
+ e[r] = q(n);
664
692
  }), e);
665
- }, kt = (t) => q(t), Pt = "list", Et = [
693
+ }, Ut = (t) => q(t), Et = "list", St = [
666
694
  "flatMap",
667
695
  "chunk",
668
696
  "shuffle",
@@ -688,7 +716,7 @@ const p = async (t) => {
688
716
  "slice",
689
717
  "tap",
690
718
  "sort"
691
- ], Ut = [
719
+ ], vt = [
692
720
  "avg",
693
721
  "count",
694
722
  "countBy",
@@ -716,7 +744,7 @@ const p = async (t) => {
716
744
  "implode",
717
745
  "partition"
718
746
  ];
719
- class d {
747
+ class g {
720
748
  _batchData = null;
721
749
  data_path = "";
722
750
  filters;
@@ -733,7 +761,7 @@ class d {
733
761
  this.filters = {}, this.steps = [], this.fields = e;
734
762
  }
735
763
  }
736
- d.prototype.getQueryPayload = function() {
764
+ g.prototype.getQueryPayload = function() {
737
765
  let t = {
738
766
  meta: {
739
767
  total: !0,
@@ -747,26 +775,26 @@ d.prototype.getQueryPayload = function() {
747
775
  steps: this.steps
748
776
  };
749
777
  };
750
- d.prototype.dataPath = function(t) {
778
+ g.prototype.dataPath = function(t) {
751
779
  const e = this.clone();
752
780
  return e.data_path = t, e;
753
781
  };
754
- d.prototype.buildArgs = function() {
782
+ g.prototype.buildArgs = function() {
755
783
  let t = {};
756
784
  return Object.keys(this.filters).length > 0 && (t.filters = this.filters), this._sort && (t.sort = this._sort, this._sortDesc && (t.sort += ":desc")), t;
757
785
  };
758
- d.prototype.clone = function() {
786
+ g.prototype.clone = function() {
759
787
  const t = Object.create(this);
760
788
  return t.steps = JSON.parse(JSON.stringify(this.steps)), t.filters = JSON.parse(JSON.stringify(this.filters)), t.fields = JSON.parse(JSON.stringify(this.fields)), t;
761
789
  };
762
790
  S().macro("whereContains", function(t, e) {
763
791
  return this.filter((r) => r[t].toLowerCase().includes(e.toLowerCase()));
764
792
  });
765
- d.prototype.fetchData = async function() {
793
+ g.prototype.fetchData = async function() {
766
794
  try {
767
795
  if (this._batchData) {
768
- const h = this._batchData;
769
- return this.meta = h.meta, S(h.data);
796
+ const u = this._batchData;
797
+ return this.meta = u.meta, S(u.data);
770
798
  }
771
799
  let t = {
772
800
  meta: {
@@ -777,55 +805,55 @@ d.prototype.fetchData = async function() {
777
805
  };
778
806
  t.__args = this.buildArgs(), t.data = this.fields, this.already_limit && (t.data.__args = t.data.__args || {}, t.data.__args.limit = this.limit), this.already_offset && (t.data.__args = t.data.__args || {}, t.data.__args.offset = this.offset);
779
807
  const e = this.data_path.split(".");
780
- let r = {}, o = r, i = e[e.length - 1];
781
- for (const h of e) {
782
- if (h === i) {
783
- o[h] = t;
808
+ let r = {}, n = r, i = e[e.length - 1];
809
+ for (const u of e) {
810
+ if (u === i) {
811
+ n[u] = t;
784
812
  break;
785
813
  }
786
- o[h] = {}, o = o[h];
814
+ n[u] = {}, n = n[u];
787
815
  }
788
816
  let l = await y(r);
789
- for (const h of e)
790
- l = l[h];
817
+ for (const u of e)
818
+ l = l[u];
791
819
  return this.meta = l.meta, S(l.data);
792
820
  } catch (t) {
793
821
  throw console.error("Error fetching collection data:", t), t;
794
822
  }
795
823
  };
796
- d.prototype.processData = async function() {
824
+ g.prototype.processData = async function() {
797
825
  let t = await this.fetchData();
798
826
  for (const e of this.steps)
799
827
  t = t[e.type](...e.args);
800
828
  return t;
801
829
  };
802
- d.prototype.all = async function() {
830
+ g.prototype.all = async function() {
803
831
  return (await this.processData()).all();
804
832
  };
805
- for (const t of Et)
806
- d.prototype[t] = function(...e) {
833
+ for (const t of St)
834
+ g.prototype[t] = function(...e) {
807
835
  const r = this.clone();
808
836
  return r.steps.push({ type: t, args: e }), r;
809
837
  };
810
- for (const t of Ut)
811
- d.prototype[t] = async function(...e) {
838
+ for (const t of vt)
839
+ g.prototype[t] = async function(...e) {
812
840
  return (await this.clone().processData())[t](...e);
813
841
  };
814
- d.prototype.average = d.prototype.avg;
815
- d.prototype.first = async function() {
842
+ g.prototype.average = g.prototype.avg;
843
+ g.prototype.first = async function() {
816
844
  return this.take(1), (await this.processData()).first();
817
845
  };
818
- d.prototype._handleBatchData = function(t, e) {
846
+ g.prototype._handleBatchData = function(t, e) {
819
847
  return this._batchData ? (this.steps.push({ type: t, args: e }), this) : null;
820
848
  };
821
- d.prototype.where = function(...t) {
849
+ g.prototype.where = function(...t) {
822
850
  const e = this._handleBatchData("where", t);
823
851
  if (e) return e;
824
852
  if (t.length === 2)
825
853
  this.filters[t[0]] = t[1];
826
854
  else if (t.length === 3) {
827
- const r = t[0], o = t[1], i = t[2];
828
- switch (o) {
855
+ const r = t[0], n = t[1], i = t[2];
856
+ switch (n) {
829
857
  case "==":
830
858
  this.filters[r] = i;
831
859
  break;
@@ -845,175 +873,180 @@ d.prototype.where = function(...t) {
845
873
  this.filters[r] = { ne: i };
846
874
  break;
847
875
  default:
848
- throw new Error(`Unsupported operator: ${o}`);
876
+ throw new Error(`Unsupported operator: ${n}`);
849
877
  }
850
878
  }
851
879
  return this;
852
880
  };
853
- d.prototype.whereContains = function(t, e) {
881
+ g.prototype.whereContains = function(t, e) {
854
882
  const r = this._handleBatchData("whereContains", [t, e]);
855
883
  return r || (this.filters[t] = { contains: e }, this);
856
884
  };
857
- d.prototype.forPage = function(t, e) {
885
+ g.prototype.forPage = function(t, e) {
858
886
  return t = Math.max(1, t), this.already_limit ? (this.steps.push({ type: "forPage", args: [t, e] }), this) : (this.limit = e, this.offset = (t - 1) * e, this.already_limit = !0, this.already_offset = !0, this);
859
887
  };
860
- d.prototype.whereIn = function(t, e) {
888
+ g.prototype.whereIn = function(t, e) {
861
889
  const r = this._handleBatchData("whereIn", [t, e]);
862
890
  return r || (this.filters[t] = { in: e }, this);
863
891
  };
864
- d.prototype.whereNotIn = function(t, e) {
892
+ g.prototype.whereNotIn = function(t, e) {
865
893
  const r = this._handleBatchData("whereNotIn", [t, e]);
866
894
  return r || (this.filters[t] = { nin: e }, this);
867
895
  };
868
- d.prototype.whereNotBetween = function(t, e) {
896
+ g.prototype.whereNotBetween = function(t, e) {
869
897
  const r = this._handleBatchData("whereNotBetween", [t, e]);
870
898
  return r || (this.filters[t] = { notBetween: e }, this);
871
899
  };
872
- d.prototype.whereBetween = function(t, e) {
900
+ g.prototype.whereBetween = function(t, e) {
873
901
  const r = this._handleBatchData("whereBetween", [t, e]);
874
902
  return r || (this.filters[t] = { between: e }, this);
875
903
  };
876
- d.prototype.sortBy = function(t) {
904
+ g.prototype.sortBy = function(t) {
877
905
  return this.steps.push({ type: "sortBy", args: [t] }), typeof t == "string" && (this._sort = t), this;
878
906
  };
879
- d.prototype.sortByDesc = function(t) {
907
+ g.prototype.sortByDesc = function(t) {
880
908
  return this.steps.push({ type: "sortByDesc", args: [t] }), typeof t == "string" && (this._sort = t, this._sortDesc = !0), this;
881
909
  };
882
- d.prototype.skip = function(t) {
910
+ g.prototype.skip = function(t) {
883
911
  if (t < 0)
884
912
  throw new Error("Offset must be non-negative");
885
913
  return this.already_offset && this.steps.push({ type: "skip", args: [t] }), this.offset = t, this.already_offset = !0, this;
886
914
  };
887
- d.prototype.take = function(t) {
915
+ g.prototype.take = function(t) {
888
916
  if (t < 0)
889
917
  throw new Error("Length must be non-negative");
890
918
  return this.already_limit ? (this.steps.push({ type: "take", args: [t] }), this) : (this.limit = t, this.already_limit = !0, this);
891
919
  };
892
- d.prototype.splice = function(t, e) {
920
+ g.prototype.splice = function(t, e) {
893
921
  return this.steps.push({ type: "splice", args: [t, e] }), this.offset = t, this.limit = e, this.already_limit = !0, this.already_offset = !0, this;
894
922
  };
895
- const R = (t, e) => {
896
- const r = new d(e);
897
- return r.data_path = Pt + t, r;
898
- }, St = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
923
+ const H = (t, e) => {
924
+ const r = new g(e);
925
+ return r.data_path = Et + t, r;
926
+ }, qt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
899
927
  __proto__: null,
900
- default: R
901
- }, Symbol.toStringTag, { value: "Module" })), Gt = (t) => {
928
+ default: H
929
+ }, Symbol.toStringTag, { value: "Module" })), Ht = (t) => {
902
930
  const e = typeof window > "u";
903
931
  let r = [];
904
- const o = H.create({
932
+ const n = X.create({
905
933
  baseURL: t,
906
934
  withCredentials: !0
907
935
  });
908
- e && (o.interceptors.request.use((u) => (u.withCredentials = !0, r.length > 0 && (u.headers.Cookie = r.join("; ")), u)), o.interceptors.response.use((u) => {
909
- if (u.headers["set-cookie"]) {
910
- const l = u.headers["set-cookie"].map((s) => s.split(";")[0]), h = /* @__PURE__ */ new Map();
936
+ e && (n.interceptors.request.use((h) => (h.withCredentials = !0, r.length > 0 && (h.headers.Cookie = r.join("; ")), h)), n.interceptors.response.use((h) => {
937
+ if (h.headers["set-cookie"]) {
938
+ const l = h.headers["set-cookie"].map((s) => s.split(";")[0]), u = /* @__PURE__ */ new Map();
911
939
  r.forEach((s) => {
912
- const n = s.split("=")[0];
913
- h.set(n, s);
940
+ const o = s.split("=")[0];
941
+ u.set(o, s);
914
942
  }), l.forEach((s) => {
915
- const n = s.split("=")[0];
916
- h.set(n, s);
917
- }), r = Array.from(h.values());
943
+ const o = s.split("=")[0];
944
+ u.set(o, s);
945
+ }), r = Array.from(u.values());
918
946
  }
919
- return u;
947
+ return h;
920
948
  }));
921
949
  const i = {
922
- post: o.post,
950
+ post: n.post,
923
951
  baseURL: t,
924
- axios: o,
925
- auth: lt(),
926
- mutation: p,
952
+ axios: n,
953
+ auth: ht(),
954
+ mutation: f,
927
955
  query: y,
928
- config: mt,
929
- mail: jt,
930
- users: wt(),
931
- model(u) {
932
- return U(u);
956
+ config: Ft,
957
+ mail: Pt,
958
+ users: bt(),
959
+ model(h) {
960
+ return E(h);
933
961
  },
934
- roles: Dt(),
935
- collect: (u, l) => {
936
- const h = R(u, l);
937
- return h.data_path = U(u).getDataPath(), h;
962
+ roles: jt(),
963
+ collect: (h, l) => {
964
+ const u = H(h, l);
965
+ return u.data_path = E(h).getDataPath(), u;
938
966
  },
939
- list: (u, l) => k(u, l).dataPath(U(u).getDataPath()),
940
- drive: pt,
941
- async collects(u) {
942
- const l = {}, h = {};
943
- for (const n in u) {
944
- const c = u[n].getQueryPayload();
945
- h[n] = c.data_path, l[n] = {};
967
+ list: (h, l) => k(h, l).dataPath(E(h).getDataPath()),
968
+ drive: gt,
969
+ async collects(h) {
970
+ const l = {}, u = {};
971
+ for (const o in h) {
972
+ const c = h[o].getQueryPayload();
973
+ u[o] = c.data_path, l[o] = {};
946
974
  const a = c.data_path.split(".");
947
- let f = a[a.length - 1], g = l[n];
975
+ let p = a[a.length - 1], d = l[o];
948
976
  for (const _ of a) {
949
- if (_ === f) {
950
- g[_] = c.query;
977
+ if (_ === p) {
978
+ d[_] = c.query;
951
979
  break;
952
980
  }
953
- g[_] = g[_] || {};
981
+ d[_] = d[_] || {};
954
982
  }
955
- l[n].__aliasFor = a[0];
983
+ l[o].__aliasFor = a[0];
956
984
  }
957
985
  const s = await y(l);
958
- for (const n in u) {
959
- const c = h[n].split(".");
960
- let a = c[c.length - 1], f = s[n];
961
- for (const g of c) {
962
- if (g === a) {
963
- u[n]._batchData = s[n][g];
986
+ for (const o in h) {
987
+ const c = u[o].split(".");
988
+ let a = c[c.length - 1], p = s[o];
989
+ for (const d of c) {
990
+ if (d === a) {
991
+ h[o]._batchData = s[o][d];
964
992
  break;
965
993
  }
966
- f[g] = f[g] || {};
994
+ p[d] = p[d] || {};
967
995
  }
968
996
  }
969
- return u;
997
+ return h;
970
998
  }
971
999
  };
972
- return Y(i), i;
973
- }, Wt = k;
1000
+ return Z(i), i;
1001
+ }, Xt = k;
974
1002
  export {
975
- lt as auth,
976
- rt as changeExpiredPassword,
977
- Lt as clearModels,
978
- Gt as createClient,
979
- R as createCollection,
1003
+ D as arrayHasFile,
1004
+ ht as auth,
1005
+ nt as changeExpiredPassword,
1006
+ Gt as clearModels,
1007
+ Ht as createClient,
1008
+ H as createCollection,
1009
+ Lt as createFileFromBase64,
1010
+ Qt as createFileFromBase85,
1011
+ J as createFileFromString,
980
1012
  k as createList,
981
- At as createRole,
982
- gt as createUser,
1013
+ Ct as createRole,
1014
+ _t as createUser,
983
1015
  W as defaultUserFields,
984
- L as defineModel,
985
- Qt as defineModels,
986
- Ot as deleteRole,
987
- dt as deleteUser,
988
- ot as forgetPassword,
989
- N as getApiClient,
990
- Nt as getApiClientOptional,
991
- mt as getConfig,
992
- x as getCurrentUser,
993
- pt as getDrive,
994
- ct as getGrantedRights,
995
- U as getModel,
996
- Bt as hasModel,
997
- at as isGranted,
998
- Wt as list,
999
- $t as listDrives,
1000
- ut as listFiles,
1001
- ft as listFolders,
1002
- Jt as listModels,
1003
- Tt as listPermissions,
1004
- Ft as listRoles,
1005
- _t as listUsers,
1006
- tt as login,
1007
- et as logout,
1008
- p as mutation,
1016
+ Q as defineModel,
1017
+ Rt as defineModels,
1018
+ Dt as deleteRole,
1019
+ yt as deleteUser,
1020
+ at as forgetPassword,
1021
+ M as getApiClient,
1022
+ Jt as getApiClientOptional,
1023
+ Ft as getConfig,
1024
+ et as getCurrentUser,
1025
+ gt as getDrive,
1026
+ ut as getGrantedRights,
1027
+ E as getModel,
1028
+ Tt as hasModel,
1029
+ lt as isGranted,
1030
+ Xt as list,
1031
+ zt as listDrives,
1032
+ pt as listFiles,
1033
+ dt as listFolders,
1034
+ $t as listModels,
1035
+ Wt as listPermissions,
1036
+ Ot as listRoles,
1037
+ wt as listUsers,
1038
+ rt as login,
1039
+ st as logout,
1040
+ f as mutation,
1041
+ N as objectHasFile,
1009
1042
  y as query,
1010
- ht as readFileAsBase64,
1011
- nt as resetPassword,
1012
- Ct as sendMail,
1013
- Y as setApiClient,
1014
- kt as toQuery,
1015
- st as updatePassword,
1016
- yt as updateUser,
1017
- it as verifyCode,
1018
- K as webAuthn
1043
+ ft as readFileAsBase64,
1044
+ it as resetPassword,
1045
+ kt as sendMail,
1046
+ Z as setApiClient,
1047
+ Ut as toQuery,
1048
+ ot as updatePassword,
1049
+ mt as updateUser,
1050
+ ct as verifyCode,
1051
+ tt as webAuthn
1019
1052
  };