@hostlink/light 2.5.1 → 2.5.3
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/drive.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/light.js +219 -182
- package/dist/light.umd.cjs +8 -8
- package/package.json +1 -1
package/dist/drive.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export type FileFields = {
|
|
|
11
11
|
url?: boolean;
|
|
12
12
|
};
|
|
13
13
|
declare const _default: (index: number, axios: AxiosInstance) => {
|
|
14
|
+
uploadTempFile: (file: File) => Promise<any>;
|
|
14
15
|
folders: {
|
|
15
16
|
list: (path: string, fields?: FolderFields) => Promise<any>;
|
|
16
17
|
create: (path: string) => Promise<any>;
|
package/dist/index.d.ts
CHANGED
|
@@ -9,3 +9,5 @@ export * from './fs';
|
|
|
9
9
|
export { default as createClient } from './createClient';
|
|
10
10
|
export type { LightClient } from './createClient';
|
|
11
11
|
export { default as createCollection } from './createCollection';
|
|
12
|
+
export type { UserFields } from './users';
|
|
13
|
+
export type { RoleFields } from './roles';
|
package/dist/light.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var Yt = Object.defineProperty;
|
|
2
2
|
var Zt = (e, t, r) => t in e ? Yt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
-
var
|
|
3
|
+
var _ = (e, t, r) => Zt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
4
|
import { jsonToGraphQLQuery as Tt, VariableType as K } from "json-to-graphql-query";
|
|
5
5
|
import kt from "axios";
|
|
6
6
|
function Pt(e) {
|
|
@@ -19,14 +19,14 @@ function Nt(e) {
|
|
|
19
19
|
"_"
|
|
20
20
|
).replace(/=/g, "");
|
|
21
21
|
}
|
|
22
|
-
var
|
|
23
|
-
function
|
|
24
|
-
if (t ===
|
|
22
|
+
var p = "copy", O = "convert";
|
|
23
|
+
function F(e, t, r) {
|
|
24
|
+
if (t === p)
|
|
25
25
|
return r;
|
|
26
|
-
if (t ===
|
|
26
|
+
if (t === O)
|
|
27
27
|
return e(r);
|
|
28
28
|
if (t instanceof Array)
|
|
29
|
-
return r.map((n) =>
|
|
29
|
+
return r.map((n) => F(e, t[0], n));
|
|
30
30
|
if (t instanceof Object) {
|
|
31
31
|
const n = {};
|
|
32
32
|
for (const [i, s] of Object.entries(t)) {
|
|
@@ -43,7 +43,7 @@ function D(e, t, r) {
|
|
|
43
43
|
n[i] = null;
|
|
44
44
|
continue;
|
|
45
45
|
}
|
|
46
|
-
n[i] =
|
|
46
|
+
n[i] = F(
|
|
47
47
|
e,
|
|
48
48
|
s.schema,
|
|
49
49
|
r[i]
|
|
@@ -72,44 +72,44 @@ function b(e) {
|
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
var Bt = {
|
|
75
|
-
type: y(
|
|
76
|
-
id: y(
|
|
77
|
-
transports: b(
|
|
75
|
+
type: y(p),
|
|
76
|
+
id: y(O),
|
|
77
|
+
transports: b(p)
|
|
78
78
|
}, qt = {
|
|
79
|
-
appid: b(
|
|
80
|
-
appidExclude: b(
|
|
81
|
-
credProps: b(
|
|
79
|
+
appid: b(p),
|
|
80
|
+
appidExclude: b(p),
|
|
81
|
+
credProps: b(p)
|
|
82
82
|
}, Ut = {
|
|
83
|
-
appid: b(
|
|
84
|
-
appidExclude: b(
|
|
85
|
-
credProps: b(
|
|
83
|
+
appid: b(p),
|
|
84
|
+
appidExclude: b(p),
|
|
85
|
+
credProps: b(p)
|
|
86
86
|
}, tr = {
|
|
87
87
|
publicKey: y({
|
|
88
|
-
rp: y(
|
|
88
|
+
rp: y(p),
|
|
89
89
|
user: y({
|
|
90
|
-
id: y(
|
|
91
|
-
name: y(
|
|
92
|
-
displayName: y(
|
|
90
|
+
id: y(O),
|
|
91
|
+
name: y(p),
|
|
92
|
+
displayName: y(p)
|
|
93
93
|
}),
|
|
94
|
-
challenge: y(
|
|
95
|
-
pubKeyCredParams: y(
|
|
96
|
-
timeout: b(
|
|
94
|
+
challenge: y(O),
|
|
95
|
+
pubKeyCredParams: y(p),
|
|
96
|
+
timeout: b(p),
|
|
97
97
|
excludeCredentials: b([Bt]),
|
|
98
|
-
authenticatorSelection: b(
|
|
99
|
-
attestation: b(
|
|
98
|
+
authenticatorSelection: b(p),
|
|
99
|
+
attestation: b(p),
|
|
100
100
|
extensions: b(qt)
|
|
101
101
|
}),
|
|
102
|
-
signal: b(
|
|
102
|
+
signal: b(p)
|
|
103
103
|
}, rr = {
|
|
104
|
-
type: y(
|
|
105
|
-
id: y(
|
|
106
|
-
rawId: y(
|
|
107
|
-
authenticatorAttachment: b(
|
|
104
|
+
type: y(p),
|
|
105
|
+
id: y(p),
|
|
106
|
+
rawId: y(O),
|
|
107
|
+
authenticatorAttachment: b(p),
|
|
108
108
|
response: y({
|
|
109
|
-
clientDataJSON: y(
|
|
110
|
-
attestationObject: y(
|
|
109
|
+
clientDataJSON: y(O),
|
|
110
|
+
attestationObject: y(O),
|
|
111
111
|
transports: x(
|
|
112
|
-
|
|
112
|
+
p,
|
|
113
113
|
(e) => {
|
|
114
114
|
var t;
|
|
115
115
|
return ((t = e.getTransports) == null ? void 0 : t.call(e)) || [];
|
|
@@ -121,26 +121,26 @@ var Bt = {
|
|
|
121
121
|
(e) => e.getClientExtensionResults()
|
|
122
122
|
)
|
|
123
123
|
}, er = {
|
|
124
|
-
mediation: b(
|
|
124
|
+
mediation: b(p),
|
|
125
125
|
publicKey: y({
|
|
126
|
-
challenge: y(
|
|
127
|
-
timeout: b(
|
|
128
|
-
rpId: b(
|
|
126
|
+
challenge: y(O),
|
|
127
|
+
timeout: b(p),
|
|
128
|
+
rpId: b(p),
|
|
129
129
|
allowCredentials: b([Bt]),
|
|
130
|
-
userVerification: b(
|
|
130
|
+
userVerification: b(p),
|
|
131
131
|
extensions: b(qt)
|
|
132
132
|
}),
|
|
133
|
-
signal: b(
|
|
133
|
+
signal: b(p)
|
|
134
134
|
}, nr = {
|
|
135
|
-
type: y(
|
|
136
|
-
id: y(
|
|
137
|
-
rawId: y(
|
|
138
|
-
authenticatorAttachment: b(
|
|
135
|
+
type: y(p),
|
|
136
|
+
id: y(p),
|
|
137
|
+
rawId: y(O),
|
|
138
|
+
authenticatorAttachment: b(p),
|
|
139
139
|
response: y({
|
|
140
|
-
clientDataJSON: y(
|
|
141
|
-
authenticatorData: y(
|
|
142
|
-
signature: y(
|
|
143
|
-
userHandle: y(
|
|
140
|
+
clientDataJSON: y(O),
|
|
141
|
+
authenticatorData: y(O),
|
|
142
|
+
signature: y(O),
|
|
143
|
+
userHandle: y(O)
|
|
144
144
|
}),
|
|
145
145
|
clientExtensionResults: x(
|
|
146
146
|
Ut,
|
|
@@ -148,20 +148,20 @@ var Bt = {
|
|
|
148
148
|
)
|
|
149
149
|
};
|
|
150
150
|
function ir(e) {
|
|
151
|
-
return
|
|
151
|
+
return F(Pt, tr, e);
|
|
152
152
|
}
|
|
153
153
|
function sr(e) {
|
|
154
|
-
return
|
|
154
|
+
return F(
|
|
155
155
|
Nt,
|
|
156
156
|
rr,
|
|
157
157
|
e
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
160
|
function or(e) {
|
|
161
|
-
return
|
|
161
|
+
return F(Pt, er, e);
|
|
162
162
|
}
|
|
163
163
|
function ar(e) {
|
|
164
|
-
return
|
|
164
|
+
return F(
|
|
165
165
|
Nt,
|
|
166
166
|
nr,
|
|
167
167
|
e
|
|
@@ -181,7 +181,7 @@ async function cr(e) {
|
|
|
181
181
|
}
|
|
182
182
|
const fr = (e) => ({
|
|
183
183
|
login: async (t) => {
|
|
184
|
-
const { app: r } = await
|
|
184
|
+
const { app: r } = await A(e, {
|
|
185
185
|
app: {
|
|
186
186
|
auth: {
|
|
187
187
|
webAuthnRequestOptions: {
|
|
@@ -200,7 +200,7 @@ const fr = (e) => ({
|
|
|
200
200
|
});
|
|
201
201
|
},
|
|
202
202
|
register: async () => {
|
|
203
|
-
const { app: t } = await
|
|
203
|
+
const { app: t } = await A(e, {
|
|
204
204
|
app: {
|
|
205
205
|
auth: {
|
|
206
206
|
webAuthnCreationOptions: !0
|
|
@@ -272,14 +272,14 @@ const fr = (e) => ({
|
|
|
272
272
|
code: r
|
|
273
273
|
});
|
|
274
274
|
},
|
|
275
|
-
granted: async (t) => (await
|
|
275
|
+
granted: async (t) => (await A(e, {
|
|
276
276
|
granted: {
|
|
277
277
|
__args: {
|
|
278
278
|
rights: t
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
})).granted
|
|
282
|
-
}),
|
|
282
|
+
}), pr = (e, t, r) => {
|
|
283
283
|
const n = t, i = e, s = r;
|
|
284
284
|
let o = "list" + t;
|
|
285
285
|
const u = (a) => s[a] ? s[a]() : null;
|
|
@@ -294,11 +294,11 @@ const fr = (e) => ({
|
|
|
294
294
|
},
|
|
295
295
|
gqlFields(a) {
|
|
296
296
|
const c = [];
|
|
297
|
-
for (const
|
|
298
|
-
if (typeof
|
|
299
|
-
const v = u(
|
|
297
|
+
for (const h of a)
|
|
298
|
+
if (typeof h == "string") {
|
|
299
|
+
const v = u(h);
|
|
300
300
|
v && c.push(v.getGQLField());
|
|
301
|
-
} else typeof
|
|
301
|
+
} else typeof h == "object" && c.push(h);
|
|
302
302
|
return c;
|
|
303
303
|
},
|
|
304
304
|
async update(a, c) {
|
|
@@ -312,14 +312,14 @@ const fr = (e) => ({
|
|
|
312
312
|
},
|
|
313
313
|
fields(a) {
|
|
314
314
|
let c = [];
|
|
315
|
-
for (let
|
|
316
|
-
const v = u(
|
|
315
|
+
for (let h of a) {
|
|
316
|
+
const v = u(h);
|
|
317
317
|
v && c.push(v);
|
|
318
318
|
}
|
|
319
319
|
return c;
|
|
320
320
|
},
|
|
321
321
|
async get(a, c) {
|
|
322
|
-
return (await
|
|
322
|
+
return (await A(i, {
|
|
323
323
|
["list" + n]: {
|
|
324
324
|
__args: {
|
|
325
325
|
filters: a
|
|
@@ -334,7 +334,7 @@ const fr = (e) => ({
|
|
|
334
334
|
}))["list" + n].data[0];
|
|
335
335
|
},
|
|
336
336
|
async list(a, c) {
|
|
337
|
-
return (await
|
|
337
|
+
return (await A(i, {
|
|
338
338
|
["list" + n]: {
|
|
339
339
|
__args: {
|
|
340
340
|
filters: a
|
|
@@ -347,12 +347,12 @@ const fr = (e) => ({
|
|
|
347
347
|
}
|
|
348
348
|
};
|
|
349
349
|
};
|
|
350
|
-
function
|
|
350
|
+
function hr(e) {
|
|
351
351
|
e = "<~" + e + "~>";
|
|
352
352
|
var t, r, n, i, s, o = String, u = 255;
|
|
353
353
|
for (e.slice(0, 2) === "<~" && e.slice(-2), e = e.slice(2, -2).replace(/\s/g, "").replace("z", "!!!!!"), t = "uuuuu".slice(e.length % 5 || 5), e += t, n = [], i = 0, s = e.length; s > i; i += 5) r = 52200625 * (e.charCodeAt(i) - 33) + 614125 * (e.charCodeAt(i + 1) - 33) + 7225 * (e.charCodeAt(i + 2) - 33) + 85 * (e.charCodeAt(i + 3) - 33) + (e.charCodeAt(i + 4) - 33), n.push(u & r >> 24, u & r >> 16, u & r >> 8, u & r);
|
|
354
354
|
return function(a, c) {
|
|
355
|
-
for (var
|
|
355
|
+
for (var h = c; h > 0; h--) a.pop();
|
|
356
356
|
}(n, t.length), o.fromCharCode.apply(o, n);
|
|
357
357
|
}
|
|
358
358
|
const W = (e = "") => {
|
|
@@ -374,8 +374,8 @@ const W = (e = "") => {
|
|
|
374
374
|
window.open(r(n), "_blank");
|
|
375
375
|
}
|
|
376
376
|
};
|
|
377
|
-
},
|
|
378
|
-
fromBase85: (e) => W(
|
|
377
|
+
}, po = {
|
|
378
|
+
fromBase85: (e) => W(hr(e)),
|
|
379
379
|
fromBase64: (e) => W(atob(e)),
|
|
380
380
|
fromString: (e) => W(e)
|
|
381
381
|
}, G = (e) => {
|
|
@@ -395,7 +395,7 @@ const W = (e = "") => {
|
|
|
395
395
|
}
|
|
396
396
|
t[r] = G(n);
|
|
397
397
|
}), t);
|
|
398
|
-
}, N = (e) => G(e),
|
|
398
|
+
}, N = (e) => G(e), A = async (e, t) => {
|
|
399
399
|
let r = Tt(N(t));
|
|
400
400
|
const n = await e.post("", {
|
|
401
401
|
query: `{ ${r} }`
|
|
@@ -423,22 +423,22 @@ const f = async (e, t, r = null, n = []) => {
|
|
|
423
423
|
const s = new FormData();
|
|
424
424
|
let o = !1;
|
|
425
425
|
if (r) {
|
|
426
|
-
const c = {},
|
|
426
|
+
const c = {}, h = {}, v = {};
|
|
427
427
|
let l = 0;
|
|
428
|
-
Object.entries(r).forEach(([m,
|
|
429
|
-
if (
|
|
428
|
+
Object.entries(r).forEach(([m, w]) => {
|
|
429
|
+
if (w instanceof Array && yr(w)) {
|
|
430
430
|
o = !0;
|
|
431
431
|
let E = 0;
|
|
432
|
-
|
|
433
|
-
C instanceof File && (c[m] = new K(m),
|
|
432
|
+
w.forEach((C) => {
|
|
433
|
+
C instanceof File && (c[m] = new K(m), h[l] = ["variables." + m + "." + E], s.append(l.toString(), C), l++);
|
|
434
434
|
}), v[m] = "[Upload!]!";
|
|
435
|
-
} else
|
|
436
|
-
C instanceof File ? (c[m][E] = new K(E),
|
|
437
|
-
})) :
|
|
438
|
-
}), i[t].__args = c, i.__variables = v, o && s.append("map", JSON.stringify(
|
|
435
|
+
} else w instanceof File ? (o = !0, c[m] = new K(m), h[l] = ["variables." + m], s.append(l.toString(), w), v[m] = "Upload!", l++) : w instanceof Object && mr(w) ? (o = !0, c[m] = {}, Object.entries(w).forEach(([E, C]) => {
|
|
436
|
+
C instanceof File ? (c[m][E] = new K(E), h[l] = ["variables." + E], s.append(l.toString(), C), v[E] = "Upload!", l++) : c[m][E] = C;
|
|
437
|
+
})) : w !== void 0 && (c[m] = w);
|
|
438
|
+
}), i[t].__args = c, i.__variables = v, o && s.append("map", JSON.stringify(h));
|
|
439
439
|
}
|
|
440
|
-
Object.entries(N(n)).forEach(([c,
|
|
441
|
-
i[t][c] =
|
|
440
|
+
Object.entries(N(n)).forEach(([c, h]) => {
|
|
441
|
+
i[t][c] = h;
|
|
442
442
|
}), Object.entries(i[t]).length === 0 && (i[t] = !0);
|
|
443
443
|
let u = null;
|
|
444
444
|
const a = Tt({ mutation: i });
|
|
@@ -459,7 +459,7 @@ const f = async (e, t, r = null, n = []) => {
|
|
|
459
459
|
mime: !0
|
|
460
460
|
}),
|
|
461
461
|
folders: {
|
|
462
|
-
list: async (t) => (await
|
|
462
|
+
list: async (t) => (await A(e, {
|
|
463
463
|
fsListFolders: {
|
|
464
464
|
__args: {
|
|
465
465
|
path: t
|
|
@@ -473,7 +473,7 @@ const f = async (e, t, r = null, n = []) => {
|
|
|
473
473
|
rename: (t, r) => f(e, "fsRenameFolder", { path: t, name: r })
|
|
474
474
|
},
|
|
475
475
|
files: {
|
|
476
|
-
list: async (t) => (await
|
|
476
|
+
list: async (t) => (await A(e, {
|
|
477
477
|
fsListFiles: {
|
|
478
478
|
__args: {
|
|
479
479
|
path: t
|
|
@@ -487,7 +487,7 @@ const f = async (e, t, r = null, n = []) => {
|
|
|
487
487
|
}
|
|
488
488
|
})).fsListFiles,
|
|
489
489
|
read: async (t) => {
|
|
490
|
-
let r = await
|
|
490
|
+
let r = await A(e, {
|
|
491
491
|
fsFile: {
|
|
492
492
|
__args: {
|
|
493
493
|
path: t
|
|
@@ -550,12 +550,12 @@ const f = async (e, t, r = null, n = []) => {
|
|
|
550
550
|
return a.field && typeof a.field == "function" ? a.field(c) : a.field && typeof a.field == "string" ? c[a.field] : c[this.getName()];
|
|
551
551
|
},
|
|
552
552
|
getFormattedValue(c) {
|
|
553
|
-
const
|
|
554
|
-
return a.format ? a.format(
|
|
553
|
+
const h = this.getValue(c);
|
|
554
|
+
return a.format ? a.format(h) : h;
|
|
555
555
|
}
|
|
556
556
|
});
|
|
557
557
|
}
|
|
558
|
-
r[n] =
|
|
558
|
+
r[n] = pr(t, n, s);
|
|
559
559
|
},
|
|
560
560
|
get(n) {
|
|
561
561
|
return r[n] || this.create(n, {}), r[n];
|
|
@@ -565,7 +565,7 @@ const f = async (e, t, r = null, n = []) => {
|
|
|
565
565
|
list: async (t = {
|
|
566
566
|
name: !0
|
|
567
567
|
}) => {
|
|
568
|
-
const { app: { roles: r } } = await
|
|
568
|
+
const { app: { roles: r } } = await A(e, {
|
|
569
569
|
app: {
|
|
570
570
|
roles: t
|
|
571
571
|
}
|
|
@@ -636,8 +636,8 @@ var Cr = function(t) {
|
|
|
636
636
|
} while (i < this.items.length);
|
|
637
637
|
else if (z(this.items) === "object") {
|
|
638
638
|
var u = Object.keys(this.items), a = function() {
|
|
639
|
-
var
|
|
640
|
-
|
|
639
|
+
var h = u.slice(i, i + t), v = new r.constructor({});
|
|
640
|
+
h.forEach(function(l) {
|
|
641
641
|
return v.put(l, r.items[l]);
|
|
642
642
|
}), n.push(v), i += t;
|
|
643
643
|
};
|
|
@@ -648,10 +648,10 @@ var Cr = function(t) {
|
|
|
648
648
|
n.push(new this.constructor([this.items]));
|
|
649
649
|
return new this.constructor(n);
|
|
650
650
|
};
|
|
651
|
-
function
|
|
652
|
-
return Nr(e) || Pr(e) || Tr(e) ||
|
|
651
|
+
function Dr(e) {
|
|
652
|
+
return Nr(e) || Pr(e) || Tr(e) || Fr();
|
|
653
653
|
}
|
|
654
|
-
function
|
|
654
|
+
function Fr() {
|
|
655
655
|
throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
656
656
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
657
657
|
}
|
|
@@ -677,7 +677,7 @@ function X(e, t) {
|
|
|
677
677
|
}
|
|
678
678
|
var Br = function() {
|
|
679
679
|
var t;
|
|
680
|
-
return new this.constructor((t = []).concat.apply(t,
|
|
680
|
+
return new this.constructor((t = []).concat.apply(t, Dr(this.items)));
|
|
681
681
|
};
|
|
682
682
|
function qr(e, t) {
|
|
683
683
|
return Kr(e) || Rr(e, t) || Mr(e, t) || Ur();
|
|
@@ -688,13 +688,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
688
688
|
}
|
|
689
689
|
function Mr(e, t) {
|
|
690
690
|
if (e) {
|
|
691
|
-
if (typeof e == "string") return
|
|
691
|
+
if (typeof e == "string") return ht(e, t);
|
|
692
692
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
693
693
|
if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set") return Array.from(e);
|
|
694
|
-
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return
|
|
694
|
+
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return ht(e, t);
|
|
695
695
|
}
|
|
696
696
|
}
|
|
697
|
-
function
|
|
697
|
+
function ht(e, t) {
|
|
698
698
|
(t == null || t > e.length) && (t = e.length);
|
|
699
699
|
for (var r = 0, n = new Array(t); r < t; r++)
|
|
700
700
|
n[r] = e[r];
|
|
@@ -897,9 +897,9 @@ var ie = $, se = d, oe = se.isFunction, Wt = function(t, r) {
|
|
|
897
897
|
function t(s, o, u) {
|
|
898
898
|
var a = u[0];
|
|
899
899
|
a instanceof o && (a = a.all());
|
|
900
|
-
for (var c = u.slice(1),
|
|
900
|
+
for (var c = u.slice(1), h = !c.length, v = [], l = 0; l < a.length; l += 1) {
|
|
901
901
|
var m = s.slice();
|
|
902
|
-
m.push(a[l]),
|
|
902
|
+
m.push(a[l]), h ? v.push(m) : v = v.concat(t(m, o, c));
|
|
903
903
|
}
|
|
904
904
|
return v;
|
|
905
905
|
}
|
|
@@ -908,14 +908,14 @@ var ie = $, se = d, oe = se.isFunction, Wt = function(t, r) {
|
|
|
908
908
|
return new this.constructor(t([], this.constructor, [].concat([this.items], n)));
|
|
909
909
|
}, le = function() {
|
|
910
910
|
this.dump(), typeof process < "u" && process.exit(1);
|
|
911
|
-
},
|
|
911
|
+
}, pe = function(t) {
|
|
912
912
|
var r;
|
|
913
913
|
t instanceof this.constructor ? r = t.all() : r = t;
|
|
914
914
|
var n = this.items.filter(function(i) {
|
|
915
915
|
return r.indexOf(i) === -1;
|
|
916
916
|
});
|
|
917
917
|
return new this.constructor(n);
|
|
918
|
-
},
|
|
918
|
+
}, he = function(t) {
|
|
919
919
|
var r = this, n = t;
|
|
920
920
|
t instanceof this.constructor && (n = t.all());
|
|
921
921
|
var i = {};
|
|
@@ -1042,13 +1042,13 @@ function Jt(e) {
|
|
|
1042
1042
|
return !1;
|
|
1043
1043
|
return !0;
|
|
1044
1044
|
}
|
|
1045
|
-
function
|
|
1045
|
+
function De(e, t) {
|
|
1046
1046
|
var r = {};
|
|
1047
1047
|
return Object.keys(t).forEach(function(n) {
|
|
1048
1048
|
e ? e(t[n], n) && (r[n] = t[n]) : Jt(t[n]) || (r[n] = t[n]);
|
|
1049
1049
|
}), r;
|
|
1050
1050
|
}
|
|
1051
|
-
function
|
|
1051
|
+
function Fe(e, t) {
|
|
1052
1052
|
if (e)
|
|
1053
1053
|
return t.filter(e);
|
|
1054
1054
|
for (var r = [], n = 0; n < t.length; n += 1) {
|
|
@@ -1059,7 +1059,7 @@ function De(e, t) {
|
|
|
1059
1059
|
}
|
|
1060
1060
|
var Te = function(t) {
|
|
1061
1061
|
var r = t || !1, n = null;
|
|
1062
|
-
return Array.isArray(this.items) ? n =
|
|
1062
|
+
return Array.isArray(this.items) ? n = Fe(r, this.items) : n = De(r, this.items), new this.constructor(n);
|
|
1063
1063
|
}, Pe = d, J = Pe.isFunction, Ne = function(t, r) {
|
|
1064
1064
|
if (J(t)) {
|
|
1065
1065
|
for (var n = Object.keys(this.items), i = 0; i < n.length; i += 1) {
|
|
@@ -1194,9 +1194,9 @@ var Te = function(t) {
|
|
|
1194
1194
|
return n[n.length - 1];
|
|
1195
1195
|
var i = Object.keys(n);
|
|
1196
1196
|
return n[i[i.length - 1]];
|
|
1197
|
-
},
|
|
1197
|
+
}, pn = function(t, r) {
|
|
1198
1198
|
this.constructor.prototype[t] = r;
|
|
1199
|
-
},
|
|
1199
|
+
}, hn = function() {
|
|
1200
1200
|
var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
1201
1201
|
return new this.constructor(t);
|
|
1202
1202
|
}, yn = function(t) {
|
|
@@ -1295,13 +1295,13 @@ var jn = function(t) {
|
|
|
1295
1295
|
});
|
|
1296
1296
|
};
|
|
1297
1297
|
function In(e, t) {
|
|
1298
|
-
return Tn(e) ||
|
|
1298
|
+
return Tn(e) || Fn(e, t) || Dn(e, t) || Cn();
|
|
1299
1299
|
}
|
|
1300
1300
|
function Cn() {
|
|
1301
1301
|
throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
1302
1302
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
1303
1303
|
}
|
|
1304
|
-
function
|
|
1304
|
+
function Dn(e, t) {
|
|
1305
1305
|
if (e) {
|
|
1306
1306
|
if (typeof e == "string") return vt(e, t);
|
|
1307
1307
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
@@ -1315,7 +1315,7 @@ function vt(e, t) {
|
|
|
1315
1315
|
n[r] = e[r];
|
|
1316
1316
|
return n;
|
|
1317
1317
|
}
|
|
1318
|
-
function
|
|
1318
|
+
function Fn(e, t) {
|
|
1319
1319
|
var r = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
1320
1320
|
if (r != null) {
|
|
1321
1321
|
var n = [], i = !0, s = !1, o, u;
|
|
@@ -1604,8 +1604,8 @@ var Zn = function(t) {
|
|
|
1604
1604
|
Object.keys(n).forEach(function(l) {
|
|
1605
1605
|
var m = l.match(s);
|
|
1606
1606
|
if (m) {
|
|
1607
|
-
var
|
|
1608
|
-
|
|
1607
|
+
var w = m[0];
|
|
1608
|
+
w.split(".").length === o && i.push(n[w]);
|
|
1609
1609
|
}
|
|
1610
1610
|
});
|
|
1611
1611
|
}
|
|
@@ -1613,14 +1613,14 @@ var Zn = function(t) {
|
|
|
1613
1613
|
if (Object.keys(n).forEach(function(l) {
|
|
1614
1614
|
var m = l.match(a);
|
|
1615
1615
|
if (m) {
|
|
1616
|
-
var
|
|
1617
|
-
|
|
1616
|
+
var w = m[0];
|
|
1617
|
+
w.split(".").length === c && u.push(n[w]);
|
|
1618
1618
|
}
|
|
1619
1619
|
}), r !== void 0) {
|
|
1620
|
-
var
|
|
1620
|
+
var h = {};
|
|
1621
1621
|
return this.items.forEach(function(l, m) {
|
|
1622
|
-
|
|
1623
|
-
}), new this.constructor(
|
|
1622
|
+
h[i[m] || ""] = u;
|
|
1623
|
+
}), new this.constructor(h);
|
|
1624
1624
|
}
|
|
1625
1625
|
return new this.constructor([u]);
|
|
1626
1626
|
}
|
|
@@ -1633,17 +1633,17 @@ var Zn = function(t) {
|
|
|
1633
1633
|
return this.map(function(l) {
|
|
1634
1634
|
return T(l, t) !== void 0 ? T(l, t) : null;
|
|
1635
1635
|
});
|
|
1636
|
-
},
|
|
1636
|
+
}, pi = R, Ht = function(t) {
|
|
1637
1637
|
for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++)
|
|
1638
1638
|
n[i - 1] = arguments[i];
|
|
1639
|
-
|
|
1639
|
+
pi(n).forEach(function(s) {
|
|
1640
1640
|
delete t[s];
|
|
1641
1641
|
});
|
|
1642
|
-
}, xt = d,
|
|
1642
|
+
}, xt = d, hi = xt.isArray, yi = xt.isObject, St = Ht, mi = function() {
|
|
1643
1643
|
var t = this, r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1;
|
|
1644
1644
|
if (this.isEmpty())
|
|
1645
1645
|
return null;
|
|
1646
|
-
if (
|
|
1646
|
+
if (hi(this.items))
|
|
1647
1647
|
return r === 1 ? this.items.pop() : new this.constructor(this.items.splice(-r));
|
|
1648
1648
|
if (yi(this.items)) {
|
|
1649
1649
|
var n = Object.keys(this.items);
|
|
@@ -1740,7 +1740,7 @@ function jt(e, t) {
|
|
|
1740
1740
|
}
|
|
1741
1741
|
return r;
|
|
1742
1742
|
}
|
|
1743
|
-
function
|
|
1743
|
+
function D(e) {
|
|
1744
1744
|
for (var t = 1; t < arguments.length; t++) {
|
|
1745
1745
|
var r = arguments[t] != null ? arguments[t] : {};
|
|
1746
1746
|
t % 2 ? jt(Object(r), !0).forEach(function(n) {
|
|
@@ -1756,20 +1756,20 @@ function Ii(e, t, r) {
|
|
|
1756
1756
|
}
|
|
1757
1757
|
var Ci = function(t) {
|
|
1758
1758
|
var r = function n(i, s) {
|
|
1759
|
-
var o =
|
|
1759
|
+
var o = D({}, i), u = Object.keys(D(D({}, i), s));
|
|
1760
1760
|
return u.forEach(function(a) {
|
|
1761
|
-
!Array.isArray(s[a]) && I(s[a]) === "object" ? o[a] = n(i[a], s[a]) : i[a] === void 0 && s[a] !== void 0 ? I(i[a]) === "object" ? o[a] =
|
|
1761
|
+
!Array.isArray(s[a]) && I(s[a]) === "object" ? o[a] = n(i[a], s[a]) : i[a] === void 0 && s[a] !== void 0 ? I(i[a]) === "object" ? o[a] = D({}, s[a]) : o[a] = s[a] : i[a] !== void 0 && s[a] === void 0 ? I(i[a]) === "object" ? o[a] = D({}, i[a]) : o[a] = i[a] : i[a] !== void 0 && s[a] !== void 0 && (I(s[a]) === "object" ? o[a] = D({}, s[a]) : o[a] = s[a]);
|
|
1762
1762
|
}), o;
|
|
1763
1763
|
};
|
|
1764
1764
|
return t ? !Array.isArray(t) && I(t) !== "object" ? new this.constructor(r(this.items, [t])) : t.constructor.name === "Collection" ? new this.constructor(r(this.items, t.all())) : new this.constructor(r(this.items, t)) : this;
|
|
1765
|
-
},
|
|
1765
|
+
}, Di = function() {
|
|
1766
1766
|
var t = [].concat(this.items).reverse();
|
|
1767
1767
|
return new this.constructor(t);
|
|
1768
|
-
}, ut = d,
|
|
1768
|
+
}, ut = d, Fi = ut.isArray, Ti = ut.isObject, Pi = ut.isFunction, Ni = function(t, r) {
|
|
1769
1769
|
var n = this, i, s = function(u, a) {
|
|
1770
1770
|
return Pi(t) ? t(n.items[a], a) : r ? n.items[a] === t : n.items[a] == t;
|
|
1771
1771
|
};
|
|
1772
|
-
return
|
|
1772
|
+
return Fi(this.items) ? i = this.items.findIndex(s) : Ti(this.items) && (i = Object.keys(this.items).find(function(o) {
|
|
1773
1773
|
return s(n.items[o], o);
|
|
1774
1774
|
})), i === void 0 || i < 0 ? !1 : i;
|
|
1775
1775
|
}, Gt = d, Bi = Gt.isArray, qi = Gt.isObject, Ui = Ht, Mi = function() {
|
|
@@ -1851,12 +1851,12 @@ var Ci = function(t) {
|
|
|
1851
1851
|
return Object.keys(this.items).sort().forEach(function(n) {
|
|
1852
1852
|
r[n] = t.items[n];
|
|
1853
1853
|
}), new this.constructor(r);
|
|
1854
|
-
},
|
|
1854
|
+
}, ps = function() {
|
|
1855
1855
|
var t = this, r = {};
|
|
1856
1856
|
return Object.keys(this.items).sort().reverse().forEach(function(n) {
|
|
1857
1857
|
r[n] = t.items[n];
|
|
1858
1858
|
}), new this.constructor(r);
|
|
1859
|
-
},
|
|
1859
|
+
}, hs = function(t, r, n) {
|
|
1860
1860
|
var i = this.slice(t, r);
|
|
1861
1861
|
if (this.items = this.diff(i.all()).all(), Array.isArray(n))
|
|
1862
1862
|
for (var s = 0, o = n.length; s < o; s += 1)
|
|
@@ -1907,7 +1907,7 @@ var gs = function(t) {
|
|
|
1907
1907
|
})), As(this.items) && (i = Object.keys(this.items).reduce(function(o, u) {
|
|
1908
1908
|
return n !== !1 && (n = !s(r.items[u])), n !== !1 && (o[u] = r.items[u]), o;
|
|
1909
1909
|
}, {})), new this.constructor(i);
|
|
1910
|
-
},
|
|
1910
|
+
}, pt = d, Ss = pt.isArray, $s = pt.isObject, js = pt.isFunction, Es = function(t) {
|
|
1911
1911
|
var r = this, n = null, i, s = function(u) {
|
|
1912
1912
|
return u === t;
|
|
1913
1913
|
};
|
|
@@ -1922,7 +1922,7 @@ var gs = function(t) {
|
|
|
1922
1922
|
for (var n = 1; n <= t; n += 1)
|
|
1923
1923
|
this.items.push(r(n));
|
|
1924
1924
|
return this;
|
|
1925
|
-
},
|
|
1925
|
+
}, Ds = function() {
|
|
1926
1926
|
var t = this.constructor;
|
|
1927
1927
|
function r(i, s) {
|
|
1928
1928
|
var o = [];
|
|
@@ -1948,7 +1948,7 @@ function ot(e) {
|
|
|
1948
1948
|
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1949
1949
|
}, ot(e);
|
|
1950
1950
|
}
|
|
1951
|
-
var
|
|
1951
|
+
var Fs = function() {
|
|
1952
1952
|
return ot(this.items) === "object" && !Array.isArray(this.items) ? JSON.stringify(this.all()) : JSON.stringify(this.toArray());
|
|
1953
1953
|
}, Ts = function(t) {
|
|
1954
1954
|
var r = this;
|
|
@@ -2014,7 +2014,7 @@ var Ns = function() {
|
|
|
2014
2014
|
return r(this);
|
|
2015
2015
|
}
|
|
2016
2016
|
return this;
|
|
2017
|
-
},
|
|
2017
|
+
}, Dt = function(t, r) {
|
|
2018
2018
|
if (Array.isArray(this.items) && !this.items.length)
|
|
2019
2019
|
return t(this);
|
|
2020
2020
|
if (!Object.keys(this.items).length)
|
|
@@ -2051,37 +2051,37 @@ var Ns = function() {
|
|
|
2051
2051
|
return new this.constructor(Ws(this.items));
|
|
2052
2052
|
}, Vs = function(t, r, n) {
|
|
2053
2053
|
return t ? r(this, t) : n ? n(this, t) : this;
|
|
2054
|
-
}, Ls = $,
|
|
2054
|
+
}, Ls = $, S = j, Hs = function(t, r, n) {
|
|
2055
2055
|
var i = r, s = n, o = Ls(this.items);
|
|
2056
2056
|
if (r === void 0 || r === !0)
|
|
2057
2057
|
return new this.constructor(o.filter(function(a) {
|
|
2058
|
-
return
|
|
2058
|
+
return S(a, t);
|
|
2059
2059
|
}));
|
|
2060
2060
|
if (r === !1)
|
|
2061
2061
|
return new this.constructor(o.filter(function(a) {
|
|
2062
|
-
return !
|
|
2062
|
+
return !S(a, t);
|
|
2063
2063
|
}));
|
|
2064
2064
|
n === void 0 && (s = r, i = "===");
|
|
2065
2065
|
var u = o.filter(function(a) {
|
|
2066
2066
|
switch (i) {
|
|
2067
2067
|
case "==":
|
|
2068
|
-
return
|
|
2068
|
+
return S(a, t) === Number(s) || S(a, t) === s.toString();
|
|
2069
2069
|
default:
|
|
2070
2070
|
case "===":
|
|
2071
|
-
return
|
|
2071
|
+
return S(a, t) === s;
|
|
2072
2072
|
case "!=":
|
|
2073
2073
|
case "<>":
|
|
2074
|
-
return
|
|
2074
|
+
return S(a, t) !== Number(s) && S(a, t) !== s.toString();
|
|
2075
2075
|
case "!==":
|
|
2076
|
-
return
|
|
2076
|
+
return S(a, t) !== s;
|
|
2077
2077
|
case "<":
|
|
2078
|
-
return
|
|
2078
|
+
return S(a, t) < s;
|
|
2079
2079
|
case "<=":
|
|
2080
|
-
return
|
|
2080
|
+
return S(a, t) <= s;
|
|
2081
2081
|
case ">":
|
|
2082
|
-
return
|
|
2082
|
+
return S(a, t) > s;
|
|
2083
2083
|
case ">=":
|
|
2084
|
-
return
|
|
2084
|
+
return S(a, t) >= s;
|
|
2085
2085
|
}
|
|
2086
2086
|
});
|
|
2087
2087
|
return new this.constructor(u);
|
|
@@ -2096,9 +2096,9 @@ var Ns = function() {
|
|
|
2096
2096
|
return this.filter(function(r) {
|
|
2097
2097
|
return r instanceof t;
|
|
2098
2098
|
});
|
|
2099
|
-
},
|
|
2099
|
+
}, Ft = j, Ys = function(t, r) {
|
|
2100
2100
|
return this.filter(function(n) {
|
|
2101
|
-
return
|
|
2101
|
+
return Ft(n, t) < r[0] || Ft(n, t) > r[r.length - 1];
|
|
2102
2102
|
});
|
|
2103
2103
|
}, Zs = $, ks = j, to = function(t, r) {
|
|
2104
2104
|
var n = Zs(r), i = this.items.filter(function(s) {
|
|
@@ -2145,7 +2145,7 @@ var no = function(t) {
|
|
|
2145
2145
|
var n = Or;
|
|
2146
2146
|
typeof Symbol < "u" && (r.prototype[Symbol.iterator] = n), r.prototype.toJSON = function() {
|
|
2147
2147
|
return this.items;
|
|
2148
|
-
}, r.prototype.all = Sr, r.prototype.average = Rt, r.prototype.avg = Ir, r.prototype.chunk = Cr, r.prototype.collapse = Br, r.prototype.combine = Wr, r.prototype.concat = Qr, r.prototype.contains = Wt, r.prototype.containsOneItem = ae, r.prototype.count = ue, r.prototype.countBy = ce, r.prototype.crossJoin = fe, r.prototype.dd = le, r.prototype.diff =
|
|
2148
|
+
}, r.prototype.all = Sr, r.prototype.average = Rt, r.prototype.avg = Ir, r.prototype.chunk = Cr, r.prototype.collapse = Br, r.prototype.combine = Wr, r.prototype.concat = Qr, r.prototype.contains = Wt, r.prototype.containsOneItem = ae, r.prototype.count = ue, r.prototype.countBy = ce, r.prototype.crossJoin = fe, r.prototype.dd = le, r.prototype.diff = pe, r.prototype.diffAssoc = he, r.prototype.diffKeys = ye, r.prototype.diffUsing = me, r.prototype.doesntContain = de, r.prototype.dump = ve, r.prototype.duplicates = be, r.prototype.each = ge, r.prototype.eachSpread = $e, r.prototype.every = Ee, r.prototype.except = Ce, r.prototype.filter = Te, r.prototype.first = Ne, r.prototype.firstOrFail = Ue, r.prototype.firstWhere = Me, r.prototype.flatMap = Re, r.prototype.flatten = Ke, r.prototype.flip = We, r.prototype.forPage = Je, r.prototype.forget = Ve, r.prototype.get = xe, r.prototype.groupBy = ze, r.prototype.has = Ye, r.prototype.implode = Ze, r.prototype.intersect = ke, r.prototype.intersectByKeys = tn, r.prototype.isEmpty = rn, r.prototype.isNotEmpty = en, r.prototype.join = nn, r.prototype.keyBy = un, r.prototype.keys = cn, r.prototype.last = ln, r.prototype.macro = pn, r.prototype.make = hn, r.prototype.map = yn, r.prototype.mapSpread = wn, r.prototype.mapToDictionary = jn, r.prototype.mapInto = En, r.prototype.mapToGroups = Pn, r.prototype.mapWithKeys = Mn, r.prototype.max = Vn, r.prototype.median = Ln, r.prototype.merge = Hn, r.prototype.mergeRecursive = Gn, r.prototype.min = Zn, r.prototype.mode = kn, r.prototype.nth = ri, r.prototype.only = ni, r.prototype.pad = si, r.prototype.partition = oi, r.prototype.pipe = ai, r.prototype.pluck = li, r.prototype.pop = mi, r.prototype.prepend = di, r.prototype.pull = gi, r.prototype.push = wi, r.prototype.put = Ai, r.prototype.random = Oi, r.prototype.reduce = Si, r.prototype.reject = $i, r.prototype.replace = Ei, r.prototype.replaceRecursive = Ci, r.prototype.reverse = Di, r.prototype.search = Ni, r.prototype.shift = Mi, r.prototype.shuffle = Ki, r.prototype.skip = Vi, r.prototype.skipUntil = Gi, r.prototype.skipWhile = Yi, r.prototype.slice = Zi, r.prototype.sole = rs, r.prototype.some = ns, r.prototype.sort = is, r.prototype.sortDesc = ss, r.prototype.sortBy = cs, r.prototype.sortByDesc = fs, r.prototype.sortKeys = ls, r.prototype.sortKeysDesc = ps, r.prototype.splice = hs, r.prototype.split = ys, r.prototype.sum = bs, r.prototype.take = gs, r.prototype.takeUntil = Os, r.prototype.takeWhile = Es, r.prototype.tap = Is, r.prototype.times = Cs, r.prototype.toArray = Ds, r.prototype.toJson = Fs, r.prototype.transform = Ts, r.prototype.undot = Ns, r.prototype.unless = Bs, r.prototype.unlessEmpty = Ct, r.prototype.unlessNotEmpty = Dt, r.prototype.union = qs, r.prototype.unique = Rs, r.prototype.unwrap = Ks, r.prototype.values = Js, r.prototype.when = Vs, r.prototype.whenEmpty = Dt, r.prototype.whenNotEmpty = Ct, r.prototype.where = Hs, r.prototype.whereBetween = xs, r.prototype.whereIn = zs, r.prototype.whereInstanceOf = Xs, r.prototype.whereNotBetween = Ys, r.prototype.whereNotIn = to, r.prototype.whereNull = ro, r.prototype.whereNotNull = eo, r.prototype.wrap = no, r.prototype.zip = io;
|
|
2149
2149
|
var i = function(o) {
|
|
2150
2150
|
return new r(o);
|
|
2151
2151
|
};
|
|
@@ -2153,6 +2153,7 @@ var no = function(t) {
|
|
|
2153
2153
|
})(Mt);
|
|
2154
2154
|
var so = Mt.exports;
|
|
2155
2155
|
const Qt = /* @__PURE__ */ _r(so), zt = [
|
|
2156
|
+
"flatMap",
|
|
2156
2157
|
"chunk",
|
|
2157
2158
|
"shuffle",
|
|
2158
2159
|
"splice",
|
|
@@ -2160,7 +2161,6 @@ const Qt = /* @__PURE__ */ _r(so), zt = [
|
|
|
2160
2161
|
"map",
|
|
2161
2162
|
"reverse",
|
|
2162
2163
|
"groupBy",
|
|
2163
|
-
"implode",
|
|
2164
2164
|
"keyBy",
|
|
2165
2165
|
"keys",
|
|
2166
2166
|
"mapToDictionary",
|
|
@@ -2170,7 +2170,13 @@ const Qt = /* @__PURE__ */ _r(so), zt = [
|
|
|
2170
2170
|
"skipWhile",
|
|
2171
2171
|
"takeUntil",
|
|
2172
2172
|
"takeWhile",
|
|
2173
|
-
"unique"
|
|
2173
|
+
"unique",
|
|
2174
|
+
"pluck",
|
|
2175
|
+
"push",
|
|
2176
|
+
"only",
|
|
2177
|
+
"pad",
|
|
2178
|
+
"slice",
|
|
2179
|
+
"tap"
|
|
2174
2180
|
], oo = ["forPage", "sortByDesc", "sortBy", "skip", "take", "splice", "whereBetween", "whereIn", "whereNotBetween", "whereNotIn", "first", "where", "whereContains"], ao = [
|
|
2175
2181
|
"avg",
|
|
2176
2182
|
"count",
|
|
@@ -2193,41 +2199,46 @@ const Qt = /* @__PURE__ */ _r(so), zt = [
|
|
|
2193
2199
|
"sort",
|
|
2194
2200
|
"split",
|
|
2195
2201
|
"sum",
|
|
2196
|
-
"toJson"
|
|
2202
|
+
"toJson",
|
|
2203
|
+
"get",
|
|
2204
|
+
"has",
|
|
2205
|
+
"implode",
|
|
2206
|
+
"partition",
|
|
2207
|
+
"sole"
|
|
2197
2208
|
];
|
|
2198
|
-
class
|
|
2209
|
+
class g {
|
|
2199
2210
|
constructor(t, r) {
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2211
|
+
_(this, "data_path", "");
|
|
2212
|
+
_(this, "axios");
|
|
2213
|
+
_(this, "filters");
|
|
2214
|
+
_(this, "steps");
|
|
2215
|
+
_(this, "fields");
|
|
2216
|
+
_(this, "already_limit", !1);
|
|
2217
|
+
_(this, "already_offset", !1);
|
|
2218
|
+
_(this, "limit", null);
|
|
2219
|
+
_(this, "offset", null);
|
|
2220
|
+
_(this, "_sort", null);
|
|
2221
|
+
_(this, "_sortDesc", !1);
|
|
2222
|
+
_(this, "meta", {});
|
|
2212
2223
|
this.axios = r, this.filters = {}, this.steps = [], this.fields = t;
|
|
2213
2224
|
}
|
|
2214
2225
|
}
|
|
2215
|
-
|
|
2226
|
+
g.prototype.dataPath = function(e) {
|
|
2216
2227
|
const t = this.clone();
|
|
2217
2228
|
return t.data_path = e, t;
|
|
2218
2229
|
};
|
|
2219
|
-
|
|
2230
|
+
g.prototype.buildArgs = function() {
|
|
2220
2231
|
let e = {};
|
|
2221
2232
|
return Object.keys(this.filters).length > 0 && (e.filters = this.filters), this._sort && (e.sort = this._sort, this._sortDesc && (e.sort += ":desc")), e;
|
|
2222
2233
|
};
|
|
2223
|
-
|
|
2234
|
+
g.prototype.clone = function() {
|
|
2224
2235
|
const e = Object.create(this);
|
|
2225
2236
|
return e.steps = [...this.steps], e;
|
|
2226
2237
|
};
|
|
2227
2238
|
Qt().macro("whereContains", function(e, t) {
|
|
2228
2239
|
return this.filter((r) => r[e].toLowerCase().includes(t.toLowerCase()));
|
|
2229
2240
|
});
|
|
2230
|
-
|
|
2241
|
+
g.prototype.fetchData = async function() {
|
|
2231
2242
|
let e = {
|
|
2232
2243
|
meta: {
|
|
2233
2244
|
total: !0,
|
|
@@ -2245,12 +2256,12 @@ S.prototype.fetchData = async function() {
|
|
|
2245
2256
|
}
|
|
2246
2257
|
n[u] = {}, n = n[u];
|
|
2247
2258
|
}
|
|
2248
|
-
let o = await
|
|
2259
|
+
let o = await A(this.axios, r);
|
|
2249
2260
|
for (const u of t)
|
|
2250
2261
|
o = o[u];
|
|
2251
2262
|
return this.meta = o.meta, Qt(o.data);
|
|
2252
2263
|
};
|
|
2253
|
-
|
|
2264
|
+
g.prototype.processData = async function() {
|
|
2254
2265
|
let e = null;
|
|
2255
2266
|
for (const t of this.steps) {
|
|
2256
2267
|
if (zt.includes(t.type)) {
|
|
@@ -2265,35 +2276,61 @@ S.prototype.processData = async function() {
|
|
|
2265
2276
|
let n = "==", i = null;
|
|
2266
2277
|
t.args.length == 2 && (i = t.args[1]), t.args.length == 3 && (n = t.args[1], i = t.args[2]), n === "==" && (this.filters[r] = i), n === "<" && (this.filters[r] = { lt: i }), n === "<=" && (this.filters[r] = { lte: i }), n === ">" && (this.filters[r] = { gt: i }), n === ">=" && (this.filters[r] = { gte: i }), n === "!==" && (this.filters[r] = { ne: i });
|
|
2267
2278
|
}
|
|
2268
|
-
t.type === "whereContains" && (e ? e = e.whereContains(...t.args) : this.filters[t.args[0]] = { contains: t.args[1] }), t.type === "whereIn" && (e ? e = e.whereIn(...t.args) : this.filters[t.args[0]] = { in: t.args[1] }), t.type === "whereNotBetween" && (e ? e = e.whereNotBetween(...t.args) : this.filters[t.args[0]] = { notBetween: t.args[1] }), t.type === "whereNotIn" && (e ? e = e.whereNotIn(...t.args) : this.filters[t.args[0]] = { notIn: t.args[1] }), t.type == "whereBetween" && (e ? e = e.whereBetween(...t.args) : this.filters[t.args[0]] = { between: t.args[1] }), t.type === "sortByDesc" && (e ? e = e.sortByDesc(t.args[0]) : this.already_limit || this.already_offset ? (e = await this.fetchData(), e = e.sortByDesc(t.args[0])) : (this._sort = t.args[0], this._sortDesc = !0)), t.type === "sortBy" && (e ? e = e.sortBy(t.args[0]) : this.already_limit || this.already_offset ? (e = await this.fetchData(), e = e.sortBy(t.args[0])) : this._sort = t.args[0]), t.type === "skip" && (e ? e = e.skip(t.args[0]) : this.already_offset || this.already_limit ? (e = await this.fetchData(), e = e.skip(t.args[0])) : this.offset = t.args[0], this.already_offset = !0), t.type === "take" && (e ? e = e.take(...t.args) : this.already_offset || this.already_limit ? (e = await this.fetchData(), e = e.take(t.args[0])) : this.limit = t.args[0], this.already_limit = !0), t.type === "splice" && (e ? e = e.splice(...t.args) : (this.offset = t.args[0], this.limit = t.args[1]), this.already_limit = !0, this.already_offset = !0);
|
|
2279
|
+
t.type === "whereContains" && (e ? e = e.whereContains(...t.args) : this.filters[t.args[0]] = { contains: t.args[1] }), t.type === "whereIn" && (e ? e = e.whereIn(...t.args) : this.filters[t.args[0]] = { in: t.args[1] }), t.type === "whereNotBetween" && (e ? e = e.whereNotBetween(...t.args) : this.filters[t.args[0]] = { notBetween: t.args[1] }), t.type === "whereNotIn" && (e ? e = e.whereNotIn(...t.args) : this.filters[t.args[0]] = { notIn: t.args[1] }), t.type == "whereBetween" && (e ? e = e.whereBetween(...t.args) : this.filters[t.args[0]] = { between: t.args[1] }), t.type === "sortByDesc" && (e ? e = e.sortByDesc(t.args[0]) : this.already_limit || this.already_offset ? (e = await this.fetchData(), e = e.sortByDesc(t.args[0])) : (this._sort = t.args[0], this._sortDesc = !0)), t.type === "sortBy" && (e ? e = e.sortBy(t.args[0]) : this.already_limit || this.already_offset ? (e = await this.fetchData(), e = e.sortBy(t.args[0])) : this._sort = t.args[0]), t.type === "skip" && (e ? e = e.skip(t.args[0]) : this.already_offset || this.already_limit ? (e = await this.fetchData(), e = e.skip(t.args[0])) : this.offset = t.args[0], this.already_offset = !0), t.type === "take" && (e ? e = e.take(...t.args) : this.already_offset || this.already_limit ? (e = await this.fetchData(), e = e.take(t.args[0])) : this.limit = t.args[0], this.already_limit = !0), t.type === "splice" && (e ? e = e.splice(...t.args) : (this.offset = t.args[0], this.limit = t.args[1]), this.already_limit = !0, this.already_offset = !0), t.type === "pop" && (e ? e = e.pop(...t.args) : (e = await this.fetchData(), e.pop(...t.args))), t.type === "prepend" && (e ? e = e.prepend(...t.args) : (e = await this.fetchData(), e.prepend(...t.args)));
|
|
2269
2280
|
}
|
|
2270
2281
|
return e || (e = await this.fetchData()), e;
|
|
2271
2282
|
};
|
|
2272
|
-
|
|
2283
|
+
g.prototype.all = async function() {
|
|
2273
2284
|
return (await this.processData()).all();
|
|
2274
2285
|
};
|
|
2275
2286
|
for (const e of [...zt, ...oo])
|
|
2276
|
-
|
|
2287
|
+
g.prototype[e] = function(...t) {
|
|
2277
2288
|
const r = this.clone();
|
|
2278
2289
|
return r.steps.push({ type: e, args: t }), r;
|
|
2279
2290
|
};
|
|
2280
2291
|
for (const e of ao)
|
|
2281
|
-
|
|
2292
|
+
g.prototype[e] = async function(...t) {
|
|
2282
2293
|
return (await this.clone().processData())[e](...t);
|
|
2283
2294
|
};
|
|
2284
|
-
|
|
2285
|
-
|
|
2295
|
+
g.prototype.average = g.prototype.avg;
|
|
2296
|
+
g.prototype.first = async function() {
|
|
2286
2297
|
return this.take(1), (await this.processData()).first();
|
|
2287
2298
|
};
|
|
2299
|
+
g.prototype.push = function(e) {
|
|
2300
|
+
return this.steps.push({ type: "push", args: [e] }), this;
|
|
2301
|
+
};
|
|
2302
|
+
g.prototype.pop = async function(...e) {
|
|
2303
|
+
const r = (await this.clone().processData()).pop(...e);
|
|
2304
|
+
return this.steps.push({ type: "pop", args: e }), r;
|
|
2305
|
+
};
|
|
2306
|
+
g.prototype.prepend = function(...e) {
|
|
2307
|
+
return this.steps.push({ type: "prepend", args: e }), this;
|
|
2308
|
+
};
|
|
2309
|
+
g.prototype.shift = async function(...e) {
|
|
2310
|
+
const r = (await this.clone().processData()).shift(...e);
|
|
2311
|
+
return this.steps.push({ type: "shift", args: e }), r;
|
|
2312
|
+
};
|
|
2313
|
+
g.prototype.transform = function(...e) {
|
|
2314
|
+
return this.steps.push({ type: "transform", args: e }), this;
|
|
2315
|
+
};
|
|
2288
2316
|
const Xt = (e, t, r) => {
|
|
2289
|
-
const n = new
|
|
2317
|
+
const n = new g(r, t);
|
|
2290
2318
|
return n.data_path = "list" + e, n;
|
|
2291
2319
|
}, uo = (e, t) => ({
|
|
2320
|
+
uploadTempFile: (r) => f(t, "lightDriveUploadTempFile", {
|
|
2321
|
+
index: e,
|
|
2322
|
+
file: r
|
|
2323
|
+
}, {
|
|
2324
|
+
name: !0,
|
|
2325
|
+
path: !0,
|
|
2326
|
+
size: !0,
|
|
2327
|
+
mime: !0
|
|
2328
|
+
}),
|
|
2292
2329
|
folders: {
|
|
2293
2330
|
list: async (r, n = {
|
|
2294
2331
|
name: !0,
|
|
2295
2332
|
path: !0
|
|
2296
|
-
}) => (await
|
|
2333
|
+
}) => (await A(t, {
|
|
2297
2334
|
app: {
|
|
2298
2335
|
drive: {
|
|
2299
2336
|
__args: {
|
|
@@ -2319,7 +2356,7 @@ const Xt = (e, t, r) => {
|
|
|
2319
2356
|
size: !0,
|
|
2320
2357
|
mime: !0,
|
|
2321
2358
|
url: !0
|
|
2322
|
-
}) => (await
|
|
2359
|
+
}) => (await A(t, {
|
|
2323
2360
|
app: {
|
|
2324
2361
|
drive: {
|
|
2325
2362
|
__args: {
|
|
@@ -2340,7 +2377,7 @@ const Xt = (e, t, r) => {
|
|
|
2340
2377
|
size: !0,
|
|
2341
2378
|
mime: !0,
|
|
2342
2379
|
url: !0
|
|
2343
|
-
}) => (await
|
|
2380
|
+
}) => (await A(t, {
|
|
2344
2381
|
app: {
|
|
2345
2382
|
drive: {
|
|
2346
2383
|
__args: {
|
|
@@ -2356,7 +2393,7 @@ const Xt = (e, t, r) => {
|
|
|
2356
2393
|
}
|
|
2357
2394
|
})).app.drive.file,
|
|
2358
2395
|
read: async (r) => {
|
|
2359
|
-
let n = await
|
|
2396
|
+
let n = await A(t, {
|
|
2360
2397
|
app: {
|
|
2361
2398
|
drive: {
|
|
2362
2399
|
__args: {
|
|
@@ -2378,11 +2415,11 @@ const Xt = (e, t, r) => {
|
|
|
2378
2415
|
rename: (r, n) => f(t, "lightDriveRenameFile", { index: e, path: r, name: n }),
|
|
2379
2416
|
move: (r, n) => f(t, "lightDriveMoveFile", { index: e, source: r, destination: n })
|
|
2380
2417
|
}
|
|
2381
|
-
}),
|
|
2418
|
+
}), ho = (e) => {
|
|
2382
2419
|
const t = kt.create({
|
|
2383
2420
|
baseURL: e,
|
|
2384
2421
|
withCredentials: !0
|
|
2385
|
-
}), r = (s, o = null, u = []) => f(t, s, o, u), n = (s) =>
|
|
2422
|
+
}), r = (s, o = null, u = []) => f(t, s, o, u), n = (s) => A(t, s), i = wr(t);
|
|
2386
2423
|
return {
|
|
2387
2424
|
baseURL: e,
|
|
2388
2425
|
axios: t,
|
|
@@ -2408,11 +2445,11 @@ const Xt = (e, t, r) => {
|
|
|
2408
2445
|
};
|
|
2409
2446
|
};
|
|
2410
2447
|
export {
|
|
2411
|
-
|
|
2412
|
-
|
|
2448
|
+
po as File,
|
|
2449
|
+
ho as createClient,
|
|
2413
2450
|
Xt as createCollection,
|
|
2414
2451
|
W as file,
|
|
2415
2452
|
f as mutation,
|
|
2416
|
-
|
|
2453
|
+
A as query,
|
|
2417
2454
|
N as toQuery
|
|
2418
2455
|
};
|
package/dist/light.umd.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
(function(g,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("json-to-graphql-query"),require("axios")):typeof define=="function"&&define.amd?define(["exports","json-to-graphql-query","axios"],w):(g=typeof globalThis<"u"?globalThis:g||self,w(g.light={},g.jsonToGraphqlQuery,g.axios))})(this,function(g,w,T){"use strict";var co=Object.defineProperty;var fo=(g,w,T)=>w in g?co(g,w,{enumerable:!0,configurable:!0,writable:!0,value:T}):g[w]=T;var S=(g,w,T)=>fo(g,typeof w!="symbol"?w+"":w,T);function dt(e){const t="==".slice(0,(4-e.length%4)%4),r=e.replace(/-/g,"+").replace(/_/g,"/")+t,n=atob(r),i=new ArrayBuffer(n.length),s=new Uint8Array(i);for(let o=0;o<n.length;o++)s[o]=n.charCodeAt(o);return i}function vt(e){const t=new Uint8Array(e);let r="";for(const s of t)r+=String.fromCharCode(s);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var l="copy",O="convert";function D(e,t,r){if(t===l)return r;if(t===O)return e(r);if(t instanceof Array)return r.map(n=>D(e,t[0],n));if(t instanceof Object){const n={};for(const[i,s]of Object.entries(t)){if(s.derive){const o=s.derive(r);o!==void 0&&(r[i]=o)}if(!(i in r)){if(s.required)throw new Error(`Missing key: ${i}`);continue}if(r[i]==null){n[i]=null;continue}n[i]=D(e,s.schema,r[i])}return n}}function L(e,t){return{required:!0,schema:e,derive:t}}function y(e){return{required:!0,schema:e}}function v(e){return{required:!1,schema:e}}var bt={type:y(l),id:y(O),transports:v(l)},gt={appid:v(l),appidExclude:v(l),credProps:v(l)},wt={appid:v(l),appidExclude:v(l),credProps:v(l)},Zt={publicKey:y({rp:y(l),user:y({id:y(O),name:y(l),displayName:y(l)}),challenge:y(O),pubKeyCredParams:y(l),timeout:v(l),excludeCredentials:v([bt]),authenticatorSelection:v(l),attestation:v(l),extensions:v(gt)}),signal:v(l)},kt={type:y(l),id:y(l),rawId:y(O),authenticatorAttachment:v(l),response:y({clientDataJSON:y(O),attestationObject:y(O),transports:L(l,e=>{var t;return((t=e.getTransports)==null?void 0:t.call(e))||[]})}),clientExtensionResults:L(wt,e=>e.getClientExtensionResults())},tr={mediation:v(l),publicKey:y({challenge:y(O),timeout:v(l),rpId:v(l),allowCredentials:v([bt]),userVerification:v(l),extensions:v(gt)}),signal:v(l)},rr={type:y(l),id:y(l),rawId:y(O),authenticatorAttachment:v(l),response:y({clientDataJSON:y(O),authenticatorData:y(O),signature:y(O),userHandle:y(O)}),clientExtensionResults:L(wt,e=>e.getClientExtensionResults())};function er(e){return D(dt,Zt,e)}function nr(e){return D(vt,kt,e)}function ir(e){return D(dt,tr,e)}function sr(e){return D(vt,rr,e)}async function or(e){const t=await navigator.credentials.create(e);return t.toJSON=()=>nr(t),t}async function ar(e){const t=await navigator.credentials.get(e);return t.toJSON=()=>sr(t),t}const ur=e=>({login:async t=>{const{app:r}=await A(e,{app:{auth:{webAuthnRequestOptions:{__args:{username:t}}}}}),n=r.auth.webAuthnRequestOptions,i=ir({publicKey:n}),s=await ar(i);await f(e,"webAuthnAssertion",{username:t,assertion:s.toJSON()})},register:async()=>{const{app:t}=await A(e,{app:{auth:{webAuthnCreationOptions:!0}}}),r=er({publicKey:t.auth.webAuthnCreationOptions}),n=await or(r);await f(e,"webAuthnRegister",{registration:n.toJSON()})}}),cr=e=>({WebAuthn:ur(e),google:{unlink:()=>f(e,"lightAuthUnlinkGoogle"),login:t=>f(e,"lightAuthLoginGoogle",{credential:t}),register:t=>f(e,"lightAuthRegisterGoogle",{credential:t})},facebook:{unlink:()=>f(e,"lightAuthUnlinkFacebook"),login:t=>f(e,"lightAuthLoginFacebook",{access_token:t}),register:t=>f(e,"lightAuthRegisterFacebook",{access_token:t})},microsoft:{unlink:()=>f(e,"lightAuthUnlinkMicrosoft"),login:t=>f(e,"lightAuthLoginMicrosoft",{access_token:t}),register:t=>f(e,"lightAuthRegisterMicrosoft",{account_id:t})},login:(t,r,n="")=>f(e,"login",{username:t,password:r,code:n}),logout:()=>f(e,"logout"),changeExpiredPassword:(t,r,n)=>f(e,"changeExpiredPassword",{username:t,old_password:r,new_password:n}),updatePassword:(t,r)=>f(e,"updatePassword",{old_password:t,new_password:r}),resetPassword:(t,r,n)=>f(e,"resetPassword",{username:t,password:r,code:n}),forgetPassword:(t,r)=>f(e,"forgetPassword",{username:t,email:r}),verifyCode(t,r){return f(e,"forgetPasswordVerifyCode",{username:t,code:r})},granted:async t=>(await A(e,{granted:{__args:{rights:t}}})).granted}),fr=(e,t,r)=>{const n=t,i=e,s=r;let o="list"+t;const u=a=>s[a]?s[a]():null;return{field:u,$fields:s,setDataPath(a){return o=a,o},getDataPath(){return o},gqlFields(a){const c=[];for(const p of a)if(typeof p=="string"){const b=u(p);b&&c.push(b.getGQLField())}else typeof p=="object"&&c.push(p);return c},async update(a,c){return await f(i,"update"+n,{id:a,data:c})},async delete(a){return await f(i,"delete"+n,{id:a})},async add(a){return await f(i,"add"+n,{data:a})},fields(a){let c=[];for(let p of a){const b=u(p);b&&c.push(b)}return c},async get(a,c){return(await A(i,{["list"+n]:{__args:{filters:a},data:{__args:{limit:1},...B(c)}}}))["list"+n].data[0]},async list(a,c){return(await A(i,{["list"+n]:{__args:{filters:a},data:{...B(c)}}}))["list"+n].data}}};function lr(e){e="<~"+e+"~>";var t,r,n,i,s,o=String,u=255;for(e.slice(0,2)==="<~"&&e.slice(-2),e=e.slice(2,-2).replace(/\s/g,"").replace("z","!!!!!"),t="uuuuu".slice(e.length%5||5),e+=t,n=[],i=0,s=e.length;s>i;i+=5)r=52200625*(e.charCodeAt(i)-33)+614125*(e.charCodeAt(i+1)-33)+7225*(e.charCodeAt(i+2)-33)+85*(e.charCodeAt(i+3)-33)+(e.charCodeAt(i+4)-33),n.push(u&r>>24,u&r>>16,u&r>>8,u&r);return function(a,c){for(var p=c;p>0;p--)a.pop()}(n,t.length),o.fromCharCode.apply(o,n)}const q=(e="")=>{const t=e,r=(n="application/octet-stream")=>{const i=new Uint8Array(t.length);for(let u=0;u<t.length;u++)i[u]=t.charCodeAt(u);const s=new Blob([i],{type:n});return URL.createObjectURL(s)};return{getContent:()=>t,getURL:r,download:n=>{const i=document.createElement("a");i.download=n,i.href=r(),document.body.appendChild(i),i.click(),document.body.removeChild(i)},open:n=>{window.open(r(n),"_blank")}}},hr={fromBase85:e=>q(lr(e)),fromBase64:e=>q(atob(e)),fromString:e=>q(e)},H=e=>{let t={};return typeof e=="string"?(t[e]=!0,t):e instanceof Array?(e.forEach(r=>{Object.entries(H(r)).forEach(([n,i])=>{t[n]=i})}),t):(Object.entries(e).forEach(([r,n])=>{if(r=="__args"||r=="__aliasFor"||r=="__variables"||r=="__directives"||r=="__all_on"||r=="__name"){t[r]=n;return}if(typeof n=="boolean"){t[r]=n;return}t[r]=H(n)}),t)},B=e=>H(e),A=async(e,t)=>{let r=w.jsonToGraphQLQuery(B(t));const n=await e.post("",{query:`{ ${r} }`});if(n.data.errors)throw new Error(n.data.errors[0].message);return n.data.data};function pr(e){for(let t=0;t<e.length;t++)if(e[t]instanceof File)return!0;return!1}function yr(e){for(let t in e)if(e[t]instanceof File)return!0;return!1}const f=async(e,t,r=null,n=[])=>{let i={[t]:{}};const s=new FormData;let o=!1;if(r){const c={},p={},b={};let h=0;Object.entries(r).forEach(([m,_])=>{if(_ instanceof Array&&pr(_)){o=!0;let F=0;_.forEach(N=>{N instanceof File&&(c[m]=new w.VariableType(m),p[h]=["variables."+m+"."+F],s.append(h.toString(),N),h++)}),b[m]="[Upload!]!"}else _ instanceof File?(o=!0,c[m]=new w.VariableType(m),p[h]=["variables."+m],s.append(h.toString(),_),b[m]="Upload!",h++):_ instanceof Object&&yr(_)?(o=!0,c[m]={},Object.entries(_).forEach(([F,N])=>{N instanceof File?(c[m][F]=new w.VariableType(F),p[h]=["variables."+F],s.append(h.toString(),N),b[F]="Upload!",h++):c[m][F]=N})):_!==void 0&&(c[m]=_)}),i[t].__args=c,i.__variables=b,o&&s.append("map",JSON.stringify(p))}Object.entries(B(n)).forEach(([c,p])=>{i[t][c]=p}),Object.entries(i[t]).length===0&&(i[t]=!0);let u=null;const a=w.jsonToGraphQLQuery({mutation:i});if(o?(s.append("operations",JSON.stringify({query:a})),u=await e.post("",s)):u=await e.post("",{query:a}),u.data.errors)throw new Error(u.data.errors[0].message);return u.data.data[t]},mr=e=>({uploadTempFile:t=>f(e,"fsUploadTempFile",{file:t},{name:!0,path:!0,size:!0,mime:!0}),folders:{list:async t=>(await A(e,{fsListFolders:{__args:{path:t},name:!0,path:!0}})).fsListFolders,create:t=>f(e,"fsCreateFolder",{path:t}),delete:t=>f(e,"fsDeleteFolder",{path:t}),rename:(t,r)=>f(e,"fsRenameFolder",{path:t,name:r})},files:{list:async t=>(await A(e,{fsListFiles:{__args:{path:t},name:!0,path:!0,size:!0,mime:!0,canPreview:!0,imagePath:!0}})).fsListFiles,read:async t=>{let r=await A(e,{fsFile:{__args:{path:t},base64Content:!0}});return window.atob(r.fsFile.base64Content)},write:(t,r)=>f(e,"fsWriteFile",{path:t,content:r}),delete:t=>f(e,"fsDeleteFile",{path:t}),rename:(t,r)=>f(e,"fsRenameFile",{path:t,name:r}),move:(t,r)=>f(e,"fsMoveFile",{source:t,target:r})}}),dr=e=>({get:async t=>(await e({config:{__args:{name:t}}})).config}),vr=e=>({send:(t,r,n)=>f(e,"sendMail",{email:t,subject:r,message:n})}),br=e=>({list:async(t={user_id:!0,username:!0,first_name:!0,last_name:!0,status:!0})=>{const r=mt("Users",e,t);return r.data_path="app.users",r.all()}}),gr=e=>{const t=e,r={};return{create(n,i){r[n]=null;let s={};for(const o of Object.entries(i)){const[u,a]=o;s[u]=()=>({name:a.name?a.name:u,raw:a,getName:()=>a.name?a.name:u,getGQLField:()=>a.gqlField!==void 0?a.gqlField:a.name||u,getRaw(){return a},getValue(c){return a.field&&typeof a.field=="function"?a.field(c):a.field&&typeof a.field=="string"?c[a.field]:c[this.getName()]},getFormattedValue(c){const p=this.getValue(c);return a.format?a.format(p):p}})}r[n]=fr(t,n,s)},get(n){return r[n]||this.create(n,{}),r[n]}}},wr=e=>({list:async(t={name:!0})=>{const{app:{roles:r}}=await A(e,{app:{roles:t}});return r}});function Ar(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var At={exports:{}},_r=function(){var t=this,r=-1;return{next:function(){return r+=1,{value:t.items[r],done:r>=t.items.length}}}},Or=function(){return this.items};function x(e){"@babel/helpers - typeof";return x=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},x(e)}var d={isArray:function(t){return Array.isArray(t)},isObject:function(t){return x(t)==="object"&&Array.isArray(t)===!1&&t!==null},isFunction:function(t){return typeof t=="function"}},Sr=d,$r=Sr.isFunction,_t=function(t){return t===void 0?this.sum()/this.items.length:$r(t)?new this.constructor(this.items).sum(t)/this.items.length:new this.constructor(this.items).pluck(t).sum()/this.items.length},jr=_t,Er=jr;function G(e){"@babel/helpers - typeof";return G=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},G(e)}var Ir=function(t){var r=this,n=[],i=0;if(Array.isArray(this.items))do{var s=this.items.slice(i,i+t),o=new this.constructor(s);n.push(o),i+=t}while(i<this.items.length);else if(G(this.items)==="object"){var u=Object.keys(this.items),a=function(){var p=u.slice(i,i+t),b=new r.constructor({});p.forEach(function(h){return b.put(h,r.items[h])}),n.push(b),i+=t};do a();while(i<u.length)}else n.push(new this.constructor([this.items]));return new this.constructor(n)};function Cr(e){return Pr(e)||Dr(e)||Tr(e)||Fr()}function Fr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
1
|
+
(function(g,w){typeof exports=="object"&&typeof module<"u"?w(exports,require("json-to-graphql-query"),require("axios")):typeof define=="function"&&define.amd?define(["exports","json-to-graphql-query","axios"],w):(g=typeof globalThis<"u"?globalThis:g||self,w(g.light={},g.jsonToGraphqlQuery,g.axios))})(this,function(g,w,F){"use strict";var co=Object.defineProperty;var fo=(g,w,F)=>w in g?co(g,w,{enumerable:!0,configurable:!0,writable:!0,value:F}):g[w]=F;var $=(g,w,F)=>fo(g,typeof w!="symbol"?w+"":w,F);function dt(e){const t="==".slice(0,(4-e.length%4)%4),r=e.replace(/-/g,"+").replace(/_/g,"/")+t,n=atob(r),i=new ArrayBuffer(n.length),s=new Uint8Array(i);for(let o=0;o<n.length;o++)s[o]=n.charCodeAt(o);return i}function vt(e){const t=new Uint8Array(e);let r="";for(const s of t)r+=String.fromCharCode(s);return btoa(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}var l="copy",S="convert";function T(e,t,r){if(t===l)return r;if(t===S)return e(r);if(t instanceof Array)return r.map(n=>T(e,t[0],n));if(t instanceof Object){const n={};for(const[i,s]of Object.entries(t)){if(s.derive){const o=s.derive(r);o!==void 0&&(r[i]=o)}if(!(i in r)){if(s.required)throw new Error(`Missing key: ${i}`);continue}if(r[i]==null){n[i]=null;continue}n[i]=T(e,s.schema,r[i])}return n}}function L(e,t){return{required:!0,schema:e,derive:t}}function y(e){return{required:!0,schema:e}}function v(e){return{required:!1,schema:e}}var bt={type:y(l),id:y(S),transports:v(l)},gt={appid:v(l),appidExclude:v(l),credProps:v(l)},wt={appid:v(l),appidExclude:v(l),credProps:v(l)},Zt={publicKey:y({rp:y(l),user:y({id:y(S),name:y(l),displayName:y(l)}),challenge:y(S),pubKeyCredParams:y(l),timeout:v(l),excludeCredentials:v([bt]),authenticatorSelection:v(l),attestation:v(l),extensions:v(gt)}),signal:v(l)},kt={type:y(l),id:y(l),rawId:y(S),authenticatorAttachment:v(l),response:y({clientDataJSON:y(S),attestationObject:y(S),transports:L(l,e=>{var t;return((t=e.getTransports)==null?void 0:t.call(e))||[]})}),clientExtensionResults:L(wt,e=>e.getClientExtensionResults())},tr={mediation:v(l),publicKey:y({challenge:y(S),timeout:v(l),rpId:v(l),allowCredentials:v([bt]),userVerification:v(l),extensions:v(gt)}),signal:v(l)},rr={type:y(l),id:y(l),rawId:y(S),authenticatorAttachment:v(l),response:y({clientDataJSON:y(S),authenticatorData:y(S),signature:y(S),userHandle:y(S)}),clientExtensionResults:L(wt,e=>e.getClientExtensionResults())};function er(e){return T(dt,Zt,e)}function nr(e){return T(vt,kt,e)}function ir(e){return T(dt,tr,e)}function sr(e){return T(vt,rr,e)}async function or(e){const t=await navigator.credentials.create(e);return t.toJSON=()=>nr(t),t}async function ar(e){const t=await navigator.credentials.get(e);return t.toJSON=()=>sr(t),t}const ur=e=>({login:async t=>{const{app:r}=await _(e,{app:{auth:{webAuthnRequestOptions:{__args:{username:t}}}}}),n=r.auth.webAuthnRequestOptions,i=ir({publicKey:n}),s=await ar(i);await f(e,"webAuthnAssertion",{username:t,assertion:s.toJSON()})},register:async()=>{const{app:t}=await _(e,{app:{auth:{webAuthnCreationOptions:!0}}}),r=er({publicKey:t.auth.webAuthnCreationOptions}),n=await or(r);await f(e,"webAuthnRegister",{registration:n.toJSON()})}}),cr=e=>({WebAuthn:ur(e),google:{unlink:()=>f(e,"lightAuthUnlinkGoogle"),login:t=>f(e,"lightAuthLoginGoogle",{credential:t}),register:t=>f(e,"lightAuthRegisterGoogle",{credential:t})},facebook:{unlink:()=>f(e,"lightAuthUnlinkFacebook"),login:t=>f(e,"lightAuthLoginFacebook",{access_token:t}),register:t=>f(e,"lightAuthRegisterFacebook",{access_token:t})},microsoft:{unlink:()=>f(e,"lightAuthUnlinkMicrosoft"),login:t=>f(e,"lightAuthLoginMicrosoft",{access_token:t}),register:t=>f(e,"lightAuthRegisterMicrosoft",{account_id:t})},login:(t,r,n="")=>f(e,"login",{username:t,password:r,code:n}),logout:()=>f(e,"logout"),changeExpiredPassword:(t,r,n)=>f(e,"changeExpiredPassword",{username:t,old_password:r,new_password:n}),updatePassword:(t,r)=>f(e,"updatePassword",{old_password:t,new_password:r}),resetPassword:(t,r,n)=>f(e,"resetPassword",{username:t,password:r,code:n}),forgetPassword:(t,r)=>f(e,"forgetPassword",{username:t,email:r}),verifyCode(t,r){return f(e,"forgetPasswordVerifyCode",{username:t,code:r})},granted:async t=>(await _(e,{granted:{__args:{rights:t}}})).granted}),fr=(e,t,r)=>{const n=t,i=e,s=r;let o="list"+t;const u=a=>s[a]?s[a]():null;return{field:u,$fields:s,setDataPath(a){return o=a,o},getDataPath(){return o},gqlFields(a){const c=[];for(const h of a)if(typeof h=="string"){const b=u(h);b&&c.push(b.getGQLField())}else typeof h=="object"&&c.push(h);return c},async update(a,c){return await f(i,"update"+n,{id:a,data:c})},async delete(a){return await f(i,"delete"+n,{id:a})},async add(a){return await f(i,"add"+n,{data:a})},fields(a){let c=[];for(let h of a){const b=u(h);b&&c.push(b)}return c},async get(a,c){return(await _(i,{["list"+n]:{__args:{filters:a},data:{__args:{limit:1},...B(c)}}}))["list"+n].data[0]},async list(a,c){return(await _(i,{["list"+n]:{__args:{filters:a},data:{...B(c)}}}))["list"+n].data}}};function lr(e){e="<~"+e+"~>";var t,r,n,i,s,o=String,u=255;for(e.slice(0,2)==="<~"&&e.slice(-2),e=e.slice(2,-2).replace(/\s/g,"").replace("z","!!!!!"),t="uuuuu".slice(e.length%5||5),e+=t,n=[],i=0,s=e.length;s>i;i+=5)r=52200625*(e.charCodeAt(i)-33)+614125*(e.charCodeAt(i+1)-33)+7225*(e.charCodeAt(i+2)-33)+85*(e.charCodeAt(i+3)-33)+(e.charCodeAt(i+4)-33),n.push(u&r>>24,u&r>>16,u&r>>8,u&r);return function(a,c){for(var h=c;h>0;h--)a.pop()}(n,t.length),o.fromCharCode.apply(o,n)}const q=(e="")=>{const t=e,r=(n="application/octet-stream")=>{const i=new Uint8Array(t.length);for(let u=0;u<t.length;u++)i[u]=t.charCodeAt(u);const s=new Blob([i],{type:n});return URL.createObjectURL(s)};return{getContent:()=>t,getURL:r,download:n=>{const i=document.createElement("a");i.download=n,i.href=r(),document.body.appendChild(i),i.click(),document.body.removeChild(i)},open:n=>{window.open(r(n),"_blank")}}},pr={fromBase85:e=>q(lr(e)),fromBase64:e=>q(atob(e)),fromString:e=>q(e)},H=e=>{let t={};return typeof e=="string"?(t[e]=!0,t):e instanceof Array?(e.forEach(r=>{Object.entries(H(r)).forEach(([n,i])=>{t[n]=i})}),t):(Object.entries(e).forEach(([r,n])=>{if(r=="__args"||r=="__aliasFor"||r=="__variables"||r=="__directives"||r=="__all_on"||r=="__name"){t[r]=n;return}if(typeof n=="boolean"){t[r]=n;return}t[r]=H(n)}),t)},B=e=>H(e),_=async(e,t)=>{let r=w.jsonToGraphQLQuery(B(t));const n=await e.post("",{query:`{ ${r} }`});if(n.data.errors)throw new Error(n.data.errors[0].message);return n.data.data};function hr(e){for(let t=0;t<e.length;t++)if(e[t]instanceof File)return!0;return!1}function yr(e){for(let t in e)if(e[t]instanceof File)return!0;return!1}const f=async(e,t,r=null,n=[])=>{let i={[t]:{}};const s=new FormData;let o=!1;if(r){const c={},h={},b={};let p=0;Object.entries(r).forEach(([m,O])=>{if(O instanceof Array&&hr(O)){o=!0;let D=0;O.forEach(N=>{N instanceof File&&(c[m]=new w.VariableType(m),h[p]=["variables."+m+"."+D],s.append(p.toString(),N),p++)}),b[m]="[Upload!]!"}else O instanceof File?(o=!0,c[m]=new w.VariableType(m),h[p]=["variables."+m],s.append(p.toString(),O),b[m]="Upload!",p++):O instanceof Object&&yr(O)?(o=!0,c[m]={},Object.entries(O).forEach(([D,N])=>{N instanceof File?(c[m][D]=new w.VariableType(D),h[p]=["variables."+D],s.append(p.toString(),N),b[D]="Upload!",p++):c[m][D]=N})):O!==void 0&&(c[m]=O)}),i[t].__args=c,i.__variables=b,o&&s.append("map",JSON.stringify(h))}Object.entries(B(n)).forEach(([c,h])=>{i[t][c]=h}),Object.entries(i[t]).length===0&&(i[t]=!0);let u=null;const a=w.jsonToGraphQLQuery({mutation:i});if(o?(s.append("operations",JSON.stringify({query:a})),u=await e.post("",s)):u=await e.post("",{query:a}),u.data.errors)throw new Error(u.data.errors[0].message);return u.data.data[t]},mr=e=>({uploadTempFile:t=>f(e,"fsUploadTempFile",{file:t},{name:!0,path:!0,size:!0,mime:!0}),folders:{list:async t=>(await _(e,{fsListFolders:{__args:{path:t},name:!0,path:!0}})).fsListFolders,create:t=>f(e,"fsCreateFolder",{path:t}),delete:t=>f(e,"fsDeleteFolder",{path:t}),rename:(t,r)=>f(e,"fsRenameFolder",{path:t,name:r})},files:{list:async t=>(await _(e,{fsListFiles:{__args:{path:t},name:!0,path:!0,size:!0,mime:!0,canPreview:!0,imagePath:!0}})).fsListFiles,read:async t=>{let r=await _(e,{fsFile:{__args:{path:t},base64Content:!0}});return window.atob(r.fsFile.base64Content)},write:(t,r)=>f(e,"fsWriteFile",{path:t,content:r}),delete:t=>f(e,"fsDeleteFile",{path:t}),rename:(t,r)=>f(e,"fsRenameFile",{path:t,name:r}),move:(t,r)=>f(e,"fsMoveFile",{source:t,target:r})}}),dr=e=>({get:async t=>(await e({config:{__args:{name:t}}})).config}),vr=e=>({send:(t,r,n)=>f(e,"sendMail",{email:t,subject:r,message:n})}),br=e=>({list:async(t={user_id:!0,username:!0,first_name:!0,last_name:!0,status:!0})=>{const r=mt("Users",e,t);return r.data_path="app.users",r.all()}}),gr=e=>{const t=e,r={};return{create(n,i){r[n]=null;let s={};for(const o of Object.entries(i)){const[u,a]=o;s[u]=()=>({name:a.name?a.name:u,raw:a,getName:()=>a.name?a.name:u,getGQLField:()=>a.gqlField!==void 0?a.gqlField:a.name||u,getRaw(){return a},getValue(c){return a.field&&typeof a.field=="function"?a.field(c):a.field&&typeof a.field=="string"?c[a.field]:c[this.getName()]},getFormattedValue(c){const h=this.getValue(c);return a.format?a.format(h):h}})}r[n]=fr(t,n,s)},get(n){return r[n]||this.create(n,{}),r[n]}}},wr=e=>({list:async(t={name:!0})=>{const{app:{roles:r}}=await _(e,{app:{roles:t}});return r}});function Ar(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var At={exports:{}},_r=function(){var t=this,r=-1;return{next:function(){return r+=1,{value:t.items[r],done:r>=t.items.length}}}},Or=function(){return this.items};function x(e){"@babel/helpers - typeof";return x=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},x(e)}var d={isArray:function(t){return Array.isArray(t)},isObject:function(t){return x(t)==="object"&&Array.isArray(t)===!1&&t!==null},isFunction:function(t){return typeof t=="function"}},Sr=d,$r=Sr.isFunction,_t=function(t){return t===void 0?this.sum()/this.items.length:$r(t)?new this.constructor(this.items).sum(t)/this.items.length:new this.constructor(this.items).pluck(t).sum()/this.items.length},jr=_t,Er=jr;function G(e){"@babel/helpers - typeof";return G=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},G(e)}var Ir=function(t){var r=this,n=[],i=0;if(Array.isArray(this.items))do{var s=this.items.slice(i,i+t),o=new this.constructor(s);n.push(o),i+=t}while(i<this.items.length);else if(G(this.items)==="object"){var u=Object.keys(this.items),a=function(){var h=u.slice(i,i+t),b=new r.constructor({});h.forEach(function(p){return b.put(p,r.items[p])}),n.push(b),i+=t};do a();while(i<u.length)}else n.push(new this.constructor([this.items]));return new this.constructor(n)};function Cr(e){return Pr(e)||Tr(e)||Fr(e)||Dr()}function Dr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Fr(e,t){if(e){if(typeof e=="string")return Q(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Q(e,t)}}function Tr(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Pr(e){if(Array.isArray(e))return Q(e)}function Q(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Nr=function(){var t;return new this.constructor((t=[]).concat.apply(t,Cr(this.items)))};function Br(e,t){return Rr(e)||Ur(e,t)||Mr(e,t)||qr()}function qr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mr(e,t){if(e){if(typeof e=="string")return Ot(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ot(e,t)}}function Ot(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ur(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,s=!1,o,u;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));i=!0);}catch(a){s=!0,u=a}finally{try{!i&&r.return!=null&&r.return()}finally{if(s)throw u}}return n}}function Rr(e){if(Array.isArray(e))return e}function M(e){"@babel/helpers - typeof";return M=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(e)}var Kr=function(t){var r=this,n=t;n instanceof this.constructor&&(n=t.all());var i={};if(Array.isArray(this.items)&&Array.isArray(n))this.items.forEach(function(u,a){i[u]=n[a]});else if(M(this.items)==="object"&&M(n)==="object")Object.keys(this.items).forEach(function(u,a){i[r.items[u]]=n[Object.keys(n)[a]]});else if(Array.isArray(this.items))i[this.items[0]]=n;else if(typeof this.items=="string"&&Array.isArray(n)){var s=n,o=Br(s,1);i[this.items]=o[0]}else typeof this.items=="string"&&(i[this.items]=n);return new this.constructor(i)};function Wr(e){return Hr(e)||Lr(e)||Vr(e)||Jr()}function Jr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4
4
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vr(e,t){if(e){if(typeof e=="string")return z(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return z(e,t)}}function Lr(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Hr(e){if(Array.isArray(e))return z(e)}function z(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var St=function(t){var r;if(Array.isArray(t)){var n;r=[],(n=r).push.apply(n,Wr(t))}else r={},Object.keys(t).forEach(function(i){r[i]=t[i]});return r};function U(e){"@babel/helpers - typeof";return U=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},U(e)}var xr=St,Gr=function(t){var r=t;t instanceof this.constructor?r=t.all():U(t)==="object"&&(r=[],Object.keys(t).forEach(function(i){r.push(t[i])}));var n=xr(this.items);return r.forEach(function(i){U(i)==="object"?Object.keys(i).forEach(function(s){return n.push(i[s])}):n.push(i)}),new this.constructor(n)};function $t(e){return Yr(e)||Xr(e)||zr(e)||Qr()}function Qr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
5
5
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function zr(e,t){if(e){if(typeof e=="string")return X(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return X(e,t)}}function Xr(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Yr(e){if(Array.isArray(e))return X(e)}function X(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var E=function(t){var r=[];return Array.isArray(t)?r.push.apply(r,$t(t)):t.constructor.name==="Collection"?r.push.apply(r,$t(t.all())):Object.keys(t).forEach(function(n){return r.push(t[n])}),r};function Zr(e){return ee(e)||re(e)||te(e)||kr()}function kr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
6
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function te(e,t){if(e){if(typeof e=="string")return Y(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Y(e,t)}}function re(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ee(e){if(Array.isArray(e))return Y(e)}function Y(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var ne=E,ie=d,se=ie.isFunction,jt=function(t,r){if(r!==void 0)return Array.isArray(this.items)?this.items.filter(function(i){return i[t]!==void 0&&i[t]===r}).length>0:this.items[t]!==void 0&&this.items[t]===r;if(se(t))return this.items.filter(function(i,s){return t(i,s)}).length>0;if(Array.isArray(this.items))return this.items.indexOf(t)!==-1;var n=ne(this.items);return n.push.apply(n,Zr(Object.keys(this.items))),n.indexOf(t)!==-1},oe=function(){return this.count()===1},ae=function(){var t=0;return Array.isArray(this.items)&&(t=this.items.length),Math.max(Object.keys(this.items).length,t)},ue=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(r){return r};return new this.constructor(this.items).groupBy(t).map(function(r){return r.count()})},ce=function(){function t(s,o,u){var a=u[0];a instanceof o&&(a=a.all());for(var c=u.slice(1),
|
|
7
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ae(e,t){if(e){if(typeof e=="string")return Z(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Z(e,t)}}function _e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Oe(e){if(Array.isArray(e))return Z(e)}function Z(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Se=function(t){return this.each(function(r,n){t.apply(void 0,ge(r).concat([n]))}),this},$e=E,je=function(t){var r=$e(this.items);return r.every(t)},K=function(t){return Array.isArray(t[0])?t[0]:t},Ee=K,Ie=function(){for(var t=this,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var s=Ee(n);if(Array.isArray(this.items)){var o=this.items.filter(function(a){return s.indexOf(a)===-1});return new this.constructor(o)}var u={};return Object.keys(this.items).forEach(function(a){s.indexOf(a)===-1&&(u[a]=t.items[a])}),new this.constructor(u)};function k(e){"@babel/helpers - typeof";return k=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(e)}function Et(e){if(Array.isArray(e)){if(e.length)return!1}else if(e!=null&&k(e)==="object"){if(Object.keys(e).length)return!1}else if(e)return!1;return!0}function Ce(e,t){var r={};return Object.keys(t).forEach(function(n){e?e(t[n],n)&&(r[n]=t[n]):Et(t[n])||(r[n]=t[n])}),r}function
|
|
6
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function te(e,t){if(e){if(typeof e=="string")return Y(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Y(e,t)}}function re(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ee(e){if(Array.isArray(e))return Y(e)}function Y(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var ne=E,ie=d,se=ie.isFunction,jt=function(t,r){if(r!==void 0)return Array.isArray(this.items)?this.items.filter(function(i){return i[t]!==void 0&&i[t]===r}).length>0:this.items[t]!==void 0&&this.items[t]===r;if(se(t))return this.items.filter(function(i,s){return t(i,s)}).length>0;if(Array.isArray(this.items))return this.items.indexOf(t)!==-1;var n=ne(this.items);return n.push.apply(n,Zr(Object.keys(this.items))),n.indexOf(t)!==-1},oe=function(){return this.count()===1},ae=function(){var t=0;return Array.isArray(this.items)&&(t=this.items.length),Math.max(Object.keys(this.items).length,t)},ue=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(r){return r};return new this.constructor(this.items).groupBy(t).map(function(r){return r.count()})},ce=function(){function t(s,o,u){var a=u[0];a instanceof o&&(a=a.all());for(var c=u.slice(1),h=!c.length,b=[],p=0;p<a.length;p+=1){var m=s.slice();m.push(a[p]),h?b.push(m):b=b.concat(t(m,o,c))}return b}for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return new this.constructor(t([],this.constructor,[].concat([this.items],n)))},fe=function(){this.dump(),typeof process<"u"&&process.exit(1)},le=function(t){var r;t instanceof this.constructor?r=t.all():r=t;var n=this.items.filter(function(i){return r.indexOf(i)===-1});return new this.constructor(n)},pe=function(t){var r=this,n=t;t instanceof this.constructor&&(n=t.all());var i={};return Object.keys(this.items).forEach(function(s){(n[s]===void 0||n[s]!==r.items[s])&&(i[s]=r.items[s])}),new this.constructor(i)},he=function(t){var r;t instanceof this.constructor?r=t.all():r=t;var n=Object.keys(r),i=Object.keys(this.items).filter(function(s){return n.indexOf(s)===-1});return new this.constructor(this.items).only(i)},ye=function(t,r){var n=this.items.filter(function(i){return!(t&&t.some(function(s){return r(i,s)===0}))});return new this.constructor(n)},me=function(t,r){return!this.contains(t,r)},de=function(){return console.log(this),this};function R(e){"@babel/helpers - typeof";return R=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(e)}var ve=function(){var t=this,r=[],n={},i=function(o){return Array.isArray(o)||R(o)==="object"?JSON.stringify(o):o};return Array.isArray(this.items)?this.items.forEach(function(s,o){var u=i(s);r.indexOf(u)===-1?r.push(u):n[o]=s}):R(this.items)==="object"&&Object.keys(this.items).forEach(function(s){var o=i(t.items[s]);r.indexOf(o)===-1?r.push(o):n[s]=t.items[s]}),new this.constructor(n)},be=function(t){var r=!1;if(Array.isArray(this.items))for(var n=this.items.length,i=0;i<n&&!r;i+=1)r=t(this.items[i],i,this.items)===!1;else for(var s=Object.keys(this.items),o=s.length,u=0;u<o&&!r;u+=1){var a=s[u];r=t(this.items[a],a,this.items)===!1}return this};function ge(e){return Oe(e)||_e(e)||Ae(e)||we()}function we(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
7
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ae(e,t){if(e){if(typeof e=="string")return Z(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Z(e,t)}}function _e(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Oe(e){if(Array.isArray(e))return Z(e)}function Z(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Se=function(t){return this.each(function(r,n){t.apply(void 0,ge(r).concat([n]))}),this},$e=E,je=function(t){var r=$e(this.items);return r.every(t)},K=function(t){return Array.isArray(t[0])?t[0]:t},Ee=K,Ie=function(){for(var t=this,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var s=Ee(n);if(Array.isArray(this.items)){var o=this.items.filter(function(a){return s.indexOf(a)===-1});return new this.constructor(o)}var u={};return Object.keys(this.items).forEach(function(a){s.indexOf(a)===-1&&(u[a]=t.items[a])}),new this.constructor(u)};function k(e){"@babel/helpers - typeof";return k=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},k(e)}function Et(e){if(Array.isArray(e)){if(e.length)return!1}else if(e!=null&&k(e)==="object"){if(Object.keys(e).length)return!1}else if(e)return!1;return!0}function Ce(e,t){var r={};return Object.keys(t).forEach(function(n){e?e(t[n],n)&&(r[n]=t[n]):Et(t[n])||(r[n]=t[n])}),r}function De(e,t){if(e)return t.filter(e);for(var r=[],n=0;n<t.length;n+=1){var i=t[n];Et(i)||r.push(i)}return r}var Fe=function(t){var r=t||!1,n=null;return Array.isArray(this.items)?n=De(r,this.items):n=Ce(r,this.items),new this.constructor(n)},Te=d,tt=Te.isFunction,Pe=function(t,r){if(tt(t)){for(var n=Object.keys(this.items),i=0;i<n.length;i+=1){var s=n[i],o=this.items[s];if(t(o,s))return o}return tt(r)?r():r}if(Array.isArray(this.items)&&this.items.length||Object.keys(this.items).length){if(Array.isArray(this.items))return this.items[0];var u=Object.keys(this.items)[0];return this.items[u]}return tt(r)?r():r},Ne=d,Be=Ne.isFunction,qe=function(t,r,n){if(Be(t))return this.first(t,function(){throw new Error("Item not found.")});var i=this.where(t,r,n);if(i.isEmpty())throw new Error("Item not found.");return i.first()},Me=function(t,r,n){return this.where(t,r,n).first()||null},Ue=function(t){return this.map(t).collapse()},It=d,rt=It.isArray,et=It.isObject,Re=function(t){var r=t||1/0,n=!1,i=[],s=function(u){i=[],rt(u)?u.forEach(function(a){rt(a)?i=i.concat(a):et(a)?Object.keys(a).forEach(function(c){i=i.concat(a[c])}):i.push(a)}):Object.keys(u).forEach(function(a){rt(u[a])?i=i.concat(u[a]):et(u[a])?Object.keys(u[a]).forEach(function(c){i=i.concat(u[a][c])}):i.push(u[a])}),n=i.filter(function(a){return et(a)}),n=n.length===0,r-=1};for(s(this.items);!n&&r>0;)s(i);return new this.constructor(i)},Ke=function(){var t=this,r={};return Array.isArray(this.items)?Object.keys(this.items).forEach(function(n){r[t.items[n]]=Number(n)}):Object.keys(this.items).forEach(function(n){r[t.items[n]]=n}),new this.constructor(r)},We=function(t,r){var n=this,i={};return Array.isArray(this.items)?i=this.items.slice(t*r-r,t*r):Object.keys(this.items).slice(t*r-r,t*r).forEach(function(s){i[s]=n.items[s]}),new this.constructor(i)},Je=function(t){return Array.isArray(this.items)?this.items.splice(t,1):delete this.items[t],this},Ve=d,Le=Ve.isFunction,He=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return this.items[t]!==void 0?this.items[t]:Le(r)?r():r!==null?r:null},I=function(t,r){try{return r.split(".").reduce(function(n,i){return n[i]},t)}catch{return t}},nt=I,xe=d,Ge=xe.isFunction,Qe=function(t){var r=this,n={};return this.items.forEach(function(i,s){var o;Ge(t)?o=t(i,s):nt(i,t)||nt(i,t)===0?o=nt(i,t):o="",n[o]===void 0&&(n[o]=new r.constructor([])),n[o].push(i)}),new this.constructor(n)},ze=K,Xe=function(){for(var t=this,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var s=ze(n);return s.filter(function(o){return Object.hasOwnProperty.call(t.items,o)}).length===s.length},Ye=function(t,r){return r===void 0?this.items.join(t):new this.constructor(this.items).pluck(t).all().join(r)},Ze=function(t){var r=t;t instanceof this.constructor&&(r=t.all());var n=this.items.filter(function(i){return r.indexOf(i)!==-1});return new this.constructor(n)},ke=function(t){var r=this,n=Object.keys(t);t instanceof this.constructor&&(n=Object.keys(t.all()));var i={};return Object.keys(this.items).forEach(function(s){n.indexOf(s)!==-1&&(i[s]=r.items[s])}),new this.constructor(i)},tn=function(){return Array.isArray(this.items)?!this.items.length:!Object.keys(this.items).length},rn=function(){return!this.isEmpty()},en=function(t,r){var n=this.values();if(r===void 0)return n.implode(t);var i=n.count();if(i===0)return"";if(i===1)return n.last();var s=n.pop();return n.implode(t)+r+s},nn=I,sn=d,on=sn.isFunction,an=function(t){var r={};return on(t)?this.items.forEach(function(n){r[t(n)]=n}):this.items.forEach(function(n){var i=nn(n,t);r[i||""]=n}),new this.constructor(r)},un=function(){var t=Object.keys(this.items);return Array.isArray(this.items)&&(t=t.map(Number)),new this.constructor(t)},cn=d,Ct=cn.isFunction,fn=function(t,r){var n=this.items;if(Ct(t)&&(n=this.filter(t).all()),Array.isArray(n)&&!n.length||!Object.keys(n).length)return Ct(r)?r():r;if(Array.isArray(n))return n[n.length-1];var i=Object.keys(n);return n[i[i.length-1]]},ln=function(t,r){this.constructor.prototype[t]=r},pn=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return new this.constructor(t)},hn=function(t){var r=this;if(Array.isArray(this.items))return new this.constructor(this.items.map(t));var n={};return Object.keys(this.items).forEach(function(i){n[i]=t(r.items[i],i)}),new this.constructor(n)};function yn(e){return bn(e)||vn(e)||dn(e)||mn()}function mn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
8
8
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dn(e,t){if(e){if(typeof e=="string")return it(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return it(e,t)}}function vn(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function bn(e){if(Array.isArray(e))return it(e)}function it(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var gn=function(t){return this.map(function(r,n){return t.apply(void 0,yn(r).concat([n]))})};function wn(e,t){return Sn(e)||On(e,t)||_n(e,t)||An()}function An(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
9
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _n(e,t){if(e){if(typeof e=="string")return
|
|
10
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cn(e,t){if(e){if(typeof e=="string")return
|
|
11
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nn(e,t){if(e){if(typeof e=="string")return Pt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Pt(e,t)}}function Pt(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Bn(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,s=!1,o,u;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));i=!0);}catch(a){s=!0,u=a}finally{try{!i&&r.return!=null&&r.return()}finally{if(s)throw u}}return n}}function qn(e){if(Array.isArray(e))return e}var Mn=function(t){var r=this,n={};return Array.isArray(this.items)?this.items.forEach(function(i,s){var o=t(i,s),u=
|
|
9
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _n(e,t){if(e){if(typeof e=="string")return Dt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Dt(e,t)}}function Dt(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function On(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,s=!1,o,u;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));i=!0);}catch(a){s=!0,u=a}finally{try{!i&&r.return!=null&&r.return()}finally{if(s)throw u}}return n}}function Sn(e){if(Array.isArray(e))return e}var $n=function(t){var r={};return this.items.forEach(function(n,i){var s=t(n,i),o=wn(s,2),u=o[0],a=o[1];r[u]===void 0?r[u]=[a]:r[u].push(a)}),new this.constructor(r)},jn=function(t){return this.map(function(r,n){return new t(r,n)})};function En(e,t){return Fn(e)||Dn(e,t)||Cn(e,t)||In()}function In(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
10
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Cn(e,t){if(e){if(typeof e=="string")return Ft(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ft(e,t)}}function Ft(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Dn(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,s=!1,o,u;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));i=!0);}catch(a){s=!0,u=a}finally{try{!i&&r.return!=null&&r.return()}finally{if(s)throw u}}return n}}function Fn(e){if(Array.isArray(e))return e}var Tn=function(t){var r={};return this.items.forEach(function(n,i){var s=t(n,i),o=En(s,2),u=o[0],a=o[1];r[u]===void 0?r[u]=[a]:r[u].push(a)}),new this.constructor(r)};function Tt(e,t){return qn(e)||Bn(e,t)||Nn(e,t)||Pn()}function Pn(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
11
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Nn(e,t){if(e){if(typeof e=="string")return Pt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Pt(e,t)}}function Pt(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Bn(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,s=!1,o,u;try{for(r=r.call(e);!(i=(o=r.next()).done)&&(n.push(o.value),!(t&&n.length===t));i=!0);}catch(a){s=!0,u=a}finally{try{!i&&r.return!=null&&r.return()}finally{if(s)throw u}}return n}}function qn(e){if(Array.isArray(e))return e}var Mn=function(t){var r=this,n={};return Array.isArray(this.items)?this.items.forEach(function(i,s){var o=t(i,s),u=Tt(o,2),a=u[0],c=u[1];n[a]=c}):Object.keys(this.items).forEach(function(i){var s=t(r.items[i],i),o=Tt(s,2),u=o[0],a=o[1];n[u]=a}),new this.constructor(n)};function Nt(e){return Wn(e)||Kn(e)||Rn(e)||Un()}function Un(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
12
12
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rn(e,t){if(e){if(typeof e=="string")return st(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return st(e,t)}}function Kn(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Wn(e){if(Array.isArray(e))return st(e)}function st(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Jn=function(t){if(typeof t=="string"){var r=this.items.filter(function(n){return n[t]!==void 0});return Math.max.apply(Math,Nt(r.map(function(n){return n[t]})))}return Math.max.apply(Math,Nt(this.items))},Vn=function(t){var r=this.items.length;return t===void 0?r%2===0?(this.items[r/2-1]+this.items[r/2])/2:this.items[Math.floor(r/2)]:r%2===0?(this.items[r/2-1][t]+this.items[r/2][t])/2:this.items[Math.floor(r/2)][t]},Ln=function(t){var r=t;if(typeof r=="string"&&(r=[r]),Array.isArray(this.items)&&Array.isArray(r))return new this.constructor(this.items.concat(r));var n=JSON.parse(JSON.stringify(this.items));return Object.keys(r).forEach(function(i){n[i]=r[i]}),new this.constructor(n)};function W(e){"@babel/helpers - typeof";return W=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},W(e)}function Bt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function qt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Bt(Object(r),!0).forEach(function(n){Hn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Hn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var xn=function(t){var r=function n(i,s){var o={},u=Object.keys(qt(qt({},i),s));return u.forEach(function(a){i[a]===void 0&&s[a]!==void 0?o[a]=s[a]:i[a]!==void 0&&s[a]===void 0?o[a]=i[a]:i[a]!==void 0&&s[a]!==void 0&&(i[a]===s[a]?o[a]=i[a]:!Array.isArray(i[a])&&W(i[a])==="object"&&!Array.isArray(s[a])&&W(s[a])==="object"?o[a]=n(i[a],s[a]):o[a]=[].concat(i[a],s[a]))}),o};return t?t.constructor.name==="Collection"?new this.constructor(r(this.items,t.all())):new this.constructor(r(this.items,t)):this};function Mt(e){return Xn(e)||zn(e)||Qn(e)||Gn()}function Gn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
13
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qn(e,t){if(e){if(typeof e=="string")return ot(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ot(e,t)}}function zn(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Xn(e){if(Array.isArray(e))return ot(e)}function ot(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Yn=function(t){if(t!==void 0){var r=this.items.filter(function(n){return n[t]!==void 0});return Math.min.apply(Math,Mt(r.map(function(n){return n[t]})))}return Math.min.apply(Math,Mt(this.items))},Zn=function(t){var r=[],n=1;return this.items.length?(this.items.forEach(function(i){var s=r.filter(function(u){return t!==void 0?u.key===i[t]:u.key===i});if(!s.length)t!==void 0?r.push({key:i[t],count:1}):r.push({key:i,count:1});else{s[0].count+=1;var o=s[0].count;o>n&&(n=o)}}),r.filter(function(i){return i.count===n}).map(function(i){return i.key})):null},kn=E,ti=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=kn(this.items),i=n.slice(r).filter(function(s,o){return o%t===0});return new this.constructor(i)},ri=K,ei=function(){for(var t=this,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var s=ri(n);if(Array.isArray(this.items)){var o=this.items.filter(function(a){return s.indexOf(a)!==-1});return new this.constructor(o)}var u={};return Object.keys(this.items).forEach(function(a){s.indexOf(a)!==-1&&(u[a]=t.items[a])}),new this.constructor(u)},ni=St,ii=function(t,r){var n=Math.abs(t),i=this.count();if(n<=i)return this;for(var s=n-i,o=ni(this.items),u=Array.isArray(this.items),a=t<0,c=0;c<s;)u?a?o.unshift(r):o.push(r):o[c]!==void 0?s+=1:o[c]=r,c+=1;return new this.constructor(o)},si=function(t){var r=this,n;return Array.isArray(this.items)?(n=[new this.constructor([]),new this.constructor([])],this.items.forEach(function(i){t(i)===!0?n[0].push(i):n[1].push(i)})):(n=[new this.constructor({}),new this.constructor({})],Object.keys(this.items).forEach(function(i){var s=r.items[i];t(s)===!0?n[0].put(i,s):n[1].put(i,s)})),new this.constructor(n)},oi=function(t){return t(this)},Ut=d,ai=Ut.isArray,ui=Ut.isObject,J=I,ci=function(t){var r={};return t.forEach(function(n,i){function s(o,u){ui(o)?Object.keys(o).forEach(function(a){s(o[a],"".concat(u,".").concat(a))}):ai(o)&&o.forEach(function(a,c){s(a,"".concat(u,".").concat(c))}),r[u]=o}s(n,i)}),r},fi=function(t,r){if(t.indexOf("*")!==-1){var n=ci(this.items),i=[];if(r!==void 0){var s=new RegExp("0.".concat(r),"g"),o="0.".concat(r).split(".").length;Object.keys(n).forEach(function(h){var m=h.match(s);if(m){var _=m[0];_.split(".").length===o&&i.push(n[_])}})}var u=[],a=new RegExp("0.".concat(t),"g"),c="0.".concat(t).split(".").length;if(Object.keys(n).forEach(function(h){var m=h.match(a);if(m){var _=m[0];_.split(".").length===c&&u.push(n[_])}}),r!==void 0){var p={};return this.items.forEach(function(h,m){p[i[m]||""]=u}),new this.constructor(p)}return new this.constructor([u])}if(r!==void 0){var b={};return this.items.forEach(function(h){J(h,t)!==void 0?b[h[r]||""]=J(h,t):b[h[r]||""]=null}),new this.constructor(b)}return this.map(function(h){return J(h,t)!==void 0?J(h,t):null})},li=K,Rt=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];li(n).forEach(function(s){delete t[s]})},Kt=d,hi=Kt.isArray,pi=Kt.isObject,Wt=Rt,yi=function(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;if(this.isEmpty())return null;if(hi(this.items))return r===1?this.items.pop():new this.constructor(this.items.splice(-r));if(pi(this.items)){var n=Object.keys(this.items);if(r===1){var i=n[n.length-1],s=this.items[i];return Wt(this.items,i),s}var o=n.slice(-r),u=o.reduce(function(a,c){return a[c]=t.items[c],a},{});return Wt(this.items,o),new this.constructor(u)}return null},mi=function(t,r){return r!==void 0?this.put(r,t):(this.items.unshift(t),this)},di=d,vi=di.isFunction,bi=function(t,r){var n=this.items[t]||null;return!n&&r!==void 0&&(vi(r)?n=r():n=r),delete this.items[t],n},gi=function(){var t;return(t=this.items).push.apply(t,arguments),this},wi=function(t,r){return this.items[t]=r,this},Ai=E,_i=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=Ai(this.items),n=new this.constructor(r).shuffle();return t!==parseInt(t,10)?n.first():n.take(t)},Oi=function(t,r){var n=this,i=null;return r!==void 0&&(i=r),Array.isArray(this.items)?this.items.forEach(function(s){i=t(i,s)}):Object.keys(this.items).forEach(function(s){i=t(i,n.items[s],s)}),i},Si=function(t){return new this.constructor(this.items).filter(function(r){return!t(r)})};function Jt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function V(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Jt(Object(r),!0).forEach(function(n){$i(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ji=function(t){if(!t)return this;if(Array.isArray(t)){var r=this.items.map(function(s,o){return t[o]||s});return new this.constructor(r)}if(t.constructor.name==="Collection"){var n=V(V({},this.items),t.all());return new this.constructor(n)}var i=V(V({},this.items),t);return new this.constructor(i)};function C(e){"@babel/helpers - typeof";return C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},C(e)}function Vt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function P(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Vt(Object(r),!0).forEach(function(n){Ei(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ei(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ii=function(t){var r=function n(i,s){var o=P({},i),u=Object.keys(P(P({},i),s));return u.forEach(function(a){!Array.isArray(s[a])&&C(s[a])==="object"?o[a]=n(i[a],s[a]):i[a]===void 0&&s[a]!==void 0?C(i[a])==="object"?o[a]=P({},s[a]):o[a]=s[a]:i[a]!==void 0&&s[a]===void 0?C(i[a])==="object"?o[a]=P({},i[a]):o[a]=i[a]:i[a]!==void 0&&s[a]!==void 0&&(C(s[a])==="object"?o[a]=P({},s[a]):o[a]=s[a])}),o};return t?!Array.isArray(t)&&C(t)!=="object"?new this.constructor(r(this.items,[t])):t.constructor.name==="Collection"?new this.constructor(r(this.items,t.all())):new this.constructor(r(this.items,t)):this},Ci=function(){var t=[].concat(this.items).reverse();return new this.constructor(t)},at=d,Fi=at.isArray,Ti=at.isObject,Di=at.isFunction,Pi=function(t,r){var n=this,i,s=function(u,a){return Di(t)?t(n.items[a],a):r?n.items[a]===t:n.items[a]==t};return Fi(this.items)?i=this.items.findIndex(s):Ti(this.items)&&(i=Object.keys(this.items).find(function(o){return s(n.items[o],o)})),i===void 0||i<0?!1:i},Lt=d,Ni=Lt.isArray,Bi=Lt.isObject,qi=Rt,Mi=function(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;if(this.isEmpty())return null;if(Ni(this.items))return r===1?this.items.shift():new this.constructor(this.items.splice(0,r));if(Bi(this.items)){if(r===1){var n=Object.keys(this.items)[0],i=this.items[n];return delete this.items[n],i}var s=Object.keys(this.items),o=s.slice(0,r),u=o.reduce(function(a,c){return a[c]=t.items[c],a},{});return qi(this.items,o),new this.constructor(u)}return null},Ui=E,Ri=function(){var t=Ui(this.items),r,n,i;for(i=t.length;i;i-=1)r=Math.floor(Math.random()*i),n=t[i-1],t[i-1]=t[r],t[r]=n;return this.items=t,this},Ki=d,Wi=Ki.isObject,Ji=function(t){var r=this;return Wi(this.items)?new this.constructor(Object.keys(this.items).reduce(function(n,i,s){return s+1>t&&(n[i]=r.items[i]),n},{})):new this.constructor(this.items.slice(t))},ut=d,Vi=ut.isArray,Li=ut.isObject,Hi=ut.isFunction,xi=function(t){var r=this,n=null,i,s=function(u){return u===t};return Hi(t)&&(s=t),Vi(this.items)&&(i=this.items.filter(function(o){return n!==!0&&(n=s(o)),n})),Li(this.items)&&(i=Object.keys(this.items).reduce(function(o,u){return n!==!0&&(n=s(r.items[u])),n!==!1&&(o[u]=r.items[u]),o},{})),new this.constructor(i)},ct=d,Gi=ct.isArray,Qi=ct.isObject,zi=ct.isFunction,Xi=function(t){var r=this,n=null,i,s=function(u){return u===t};return zi(t)&&(s=t),Gi(this.items)&&(i=this.items.filter(function(o){return n!==!0&&(n=!s(o)),n})),Qi(this.items)&&(i=Object.keys(this.items).reduce(function(o,u){return n!==!0&&(n=!s(r.items[u])),n!==!1&&(o[u]=r.items[u]),o},{})),new this.constructor(i)},Yi=function(t,r){var n=this.items.slice(t);return r!==void 0&&(n=n.slice(0,r)),new this.constructor(n)},Zi=d,ki=Zi.isFunction,ts=function(t,r,n){var i;if(ki(t)?i=this.filter(t):i=this.where(t,r,n),i.isEmpty())throw new Error("Item not found.");if(i.count()>1)throw new Error("Multiple items found.");return i.first()},rs=jt,es=rs,ns=function(t){var r=[].concat(this.items);return t===void 0?this.every(function(n){return typeof n=="number"})?r.sort(function(n,i){return n-i}):r.sort():r.sort(t),new this.constructor(r)},is=function(){return this.sort().reverse()},ss=I,os=d,as=os.isFunction,us=function(t){var r=[].concat(this.items),n=function(s){return as(t)?t(s):ss(s,t)};return r.sort(function(i,s){var o=n(i),u=n(s);return o==null?1:u==null||o<u?-1:o>u?1:0}),new this.constructor(r)},cs=function(t){return this.sortBy(t).reverse()},fs=function(){var t=this,r={};return Object.keys(this.items).sort().forEach(function(n){r[n]=t.items[n]}),new this.constructor(r)},ls=function(){var t=this,r={};return Object.keys(this.items).sort().reverse().forEach(function(n){r[n]=t.items[n]}),new this.constructor(r)},hs=function(t,r,n){var i=this.slice(t,r);if(this.items=this.diff(i.all()).all(),Array.isArray(n))for(var s=0,o=n.length;s<o;s+=1)this.items.splice(t+s,0,n[s]);return i},ps=function(t){for(var r=Math.round(this.items.length/t),n=JSON.parse(JSON.stringify(this.items)),i=[],s=0;s<t;s+=1)i.push(new this.constructor(n.splice(0,r)));return new this.constructor(i)},ys=E,ms=d,ds=ms.isFunction,vs=function(t){var r=ys(this.items),n=0;if(t===void 0)for(var i=0,s=r.length;i<s;i+=1)n+=parseFloat(r[i]);else if(ds(t))for(var o=0,u=r.length;o<u;o+=1)n+=parseFloat(t(r[o]));else for(var a=0,c=r.length;a<c;a+=1)n+=parseFloat(r[a][t]);return parseFloat(n.toPrecision(12))};function ft(e){"@babel/helpers - typeof";return ft=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ft(e)}var bs=function(t){var r=this;if(!Array.isArray(this.items)&&ft(this.items)==="object"){var n=Object.keys(this.items),i;t<0?i=n.slice(t):i=n.slice(0,t);var s={};return n.forEach(function(o){i.indexOf(o)!==-1&&(s[o]=r.items[o])}),new this.constructor(s)}return t<0?new this.constructor(this.items.slice(t)):new this.constructor(this.items.slice(0,t))},lt=d,gs=lt.isArray,ws=lt.isObject,As=lt.isFunction,_s=function(t){var r=this,n=null,i,s=function(u){return u===t};return As(t)&&(s=t),gs(this.items)&&(i=this.items.filter(function(o){return n!==!1&&(n=!s(o)),n})),ws(this.items)&&(i=Object.keys(this.items).reduce(function(o,u){return n!==!1&&(n=!s(r.items[u])),n!==!1&&(o[u]=r.items[u]),o},{})),new this.constructor(i)},ht=d,Os=ht.isArray,Ss=ht.isObject,$s=ht.isFunction,js=function(t){var r=this,n=null,i,s=function(u){return u===t};return $s(t)&&(s=t),Os(this.items)&&(i=this.items.filter(function(o){return n!==!1&&(n=s(o)),n})),Ss(this.items)&&(i=Object.keys(this.items).reduce(function(o,u){return n!==!1&&(n=s(r.items[u])),n!==!1&&(o[u]=r.items[u]),o},{})),new this.constructor(i)},Es=function(t){return t(this),this},Is=function(t,r){for(var n=1;n<=t;n+=1)this.items.push(r(n));return this},Cs=function(){var t=this.constructor;function r(i,s){var o=[];i instanceof t?(i.items.forEach(function(u){return r(u,o)}),s.push(o)):Array.isArray(i)?(i.forEach(function(u){return r(u,o)}),s.push(o)):s.push(i)}if(Array.isArray(this.items)){var n=[];return this.items.forEach(function(i){r(i,n)}),n}return this.values().all()};function pt(e){"@babel/helpers - typeof";return pt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pt(e)}var Fs=function(){return pt(this.items)==="object"&&!Array.isArray(this.items)?JSON.stringify(this.all()):JSON.stringify(this.toArray())},Ts=function(t){var r=this;if(Array.isArray(this.items))this.items=this.items.map(t);else{var n={};Object.keys(this.items).forEach(function(i){n[i]=t(r.items[i],i)}),this.items=n}return this};function Ht(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function xt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ht(Object(r),!0).forEach(function(n){Ds(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ht(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ds(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ps=function(){var t=this;if(Array.isArray(this.items))return this;var r={};return Object.keys(this.items).forEach(function(n){if(n.indexOf(".")!==-1){var i=r;n.split(".").reduce(function(s,o,u,a){return s[o]||(s[o]={}),u===a.length-1&&(s[o]=t.items[n]),s[o]},i),r=xt(xt({},r),i)}else r[n]=t.items[n]}),new this.constructor(r)},Ns=function(t,r,n){t?n(this):r(this)},Gt=function(t,r){if(Array.isArray(this.items)&&this.items.length)return t(this);if(Object.keys(this.items).length)return t(this);if(r!==void 0){if(Array.isArray(this.items)&&!this.items.length)return r(this);if(!Object.keys(this.items).length)return r(this)}return this},Qt=function(t,r){if(Array.isArray(this.items)&&!this.items.length)return t(this);if(!Object.keys(this.items).length)return t(this);if(r!==void 0){if(Array.isArray(this.items)&&this.items.length)return r(this);if(Object.keys(this.items).length)return r(this)}return this},Bs=function(t){var r=this,n=JSON.parse(JSON.stringify(this.items));return Object.keys(t).forEach(function(i){r.items[i]===void 0&&(n[i]=t[i])}),new this.constructor(n)},qs=d,Ms=qs.isFunction,Us=function(t){var r;if(t===void 0)r=this.items.filter(function(u,a,c){return c.indexOf(u)===a});else{r=[];for(var n=[],i=0,s=this.items.length;i<s;i+=1){var o=void 0;Ms(t)?o=t(this.items[i]):o=this.items[i][t],n.indexOf(o)===-1&&(r.push(this.items[i]),n.push(o))}}return new this.constructor(r)},Rs=function(t){return t instanceof this.constructor?t.all():t},Ks=E,Ws=function(){return new this.constructor(Ks(this.items))},Js=function(t,r,n){return t?r(this,t):n?n(this,t):this},Vs=E,$=I,Ls=function(t,r,n){var i=r,s=n,o=Vs(this.items);if(r===void 0||r===!0)return new this.constructor(o.filter(function(a){return $(a,t)}));if(r===!1)return new this.constructor(o.filter(function(a){return!$(a,t)}));n===void 0&&(s=r,i="===");var u=o.filter(function(a){switch(i){case"==":return $(a,t)===Number(s)||$(a,t)===s.toString();default:case"===":return $(a,t)===s;case"!=":case"<>":return $(a,t)!==Number(s)&&$(a,t)!==s.toString();case"!==":return $(a,t)!==s;case"<":return $(a,t)<s;case"<=":return $(a,t)<=s;case">":return $(a,t)>s;case">=":return $(a,t)>=s}});return new this.constructor(u)},Hs=function(t,r){return this.where(t,">=",r[0]).where(t,"<=",r[r.length-1])},xs=E,Gs=I,Qs=function(t,r){var n=xs(r),i=this.items.filter(function(s){return n.indexOf(Gs(s,t))!==-1});return new this.constructor(i)},zs=function(t){return this.filter(function(r){return r instanceof t})},zt=I,Xs=function(t,r){return this.filter(function(n){return zt(n,t)<r[0]||zt(n,t)>r[r.length-1]})},Ys=E,Zs=I,ks=function(t,r){var n=Ys(r),i=this.items.filter(function(s){return n.indexOf(Zs(s,t))===-1});return new this.constructor(i)},to=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.where(t,"===",null)},ro=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.where(t,"!==",null)};function yt(e){"@babel/helpers - typeof";return yt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yt(e)}var eo=function(t){return t instanceof this.constructor?t:yt(t)==="object"?new this.constructor(t):new this.constructor([t])},no=function(t){var r=this,n=t;n instanceof this.constructor&&(n=n.all());var i=this.items.map(function(s,o){return new r.constructor([s,n[o]])});return new this.constructor(i)};(function(e){function t(s){"@babel/helpers - typeof";return t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},t(s)}function r(s){s!==void 0&&!Array.isArray(s)&&t(s)!=="object"?this.items=[s]:s instanceof this.constructor?this.items=s.all():this.items=s||[]}var n=_r;typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=n),r.prototype.toJSON=function(){return this.items},r.prototype.all=Or,r.prototype.average=_t,r.prototype.avg=Er,r.prototype.chunk=Ir,r.prototype.collapse=Nr,r.prototype.combine=Kr,r.prototype.concat=Gr,r.prototype.contains=jt,r.prototype.containsOneItem=oe,r.prototype.count=ae,r.prototype.countBy=ue,r.prototype.crossJoin=ce,r.prototype.dd=fe,r.prototype.diff=le,r.prototype.diffAssoc=he,r.prototype.diffKeys=pe,r.prototype.diffUsing=ye,r.prototype.doesntContain=me,r.prototype.dump=de,r.prototype.duplicates=ve,r.prototype.each=be,r.prototype.eachSpread=Se,r.prototype.every=je,r.prototype.except=Ie,r.prototype.filter=Te,r.prototype.first=Pe,r.prototype.firstOrFail=qe,r.prototype.firstWhere=Me,r.prototype.flatMap=Ue,r.prototype.flatten=Re,r.prototype.flip=Ke,r.prototype.forPage=We,r.prototype.forget=Je,r.prototype.get=He,r.prototype.groupBy=Qe,r.prototype.has=Xe,r.prototype.implode=Ye,r.prototype.intersect=Ze,r.prototype.intersectByKeys=ke,r.prototype.isEmpty=tn,r.prototype.isNotEmpty=rn,r.prototype.join=en,r.prototype.keyBy=an,r.prototype.keys=un,r.prototype.last=fn,r.prototype.macro=ln,r.prototype.make=hn,r.prototype.map=pn,r.prototype.mapSpread=gn,r.prototype.mapToDictionary=$n,r.prototype.mapInto=jn,r.prototype.mapToGroups=Dn,r.prototype.mapWithKeys=Mn,r.prototype.max=Jn,r.prototype.median=Vn,r.prototype.merge=Ln,r.prototype.mergeRecursive=xn,r.prototype.min=Yn,r.prototype.mode=Zn,r.prototype.nth=ti,r.prototype.only=ei,r.prototype.pad=ii,r.prototype.partition=si,r.prototype.pipe=oi,r.prototype.pluck=fi,r.prototype.pop=yi,r.prototype.prepend=mi,r.prototype.pull=bi,r.prototype.push=gi,r.prototype.put=wi,r.prototype.random=_i,r.prototype.reduce=Oi,r.prototype.reject=Si,r.prototype.replace=ji,r.prototype.replaceRecursive=Ii,r.prototype.reverse=Ci,r.prototype.search=Pi,r.prototype.shift=Mi,r.prototype.shuffle=Ri,r.prototype.skip=Ji,r.prototype.skipUntil=xi,r.prototype.skipWhile=Xi,r.prototype.slice=Yi,r.prototype.sole=ts,r.prototype.some=es,r.prototype.sort=ns,r.prototype.sortDesc=is,r.prototype.sortBy=us,r.prototype.sortByDesc=cs,r.prototype.sortKeys=fs,r.prototype.sortKeysDesc=ls,r.prototype.splice=hs,r.prototype.split=ps,r.prototype.sum=vs,r.prototype.take=bs,r.prototype.takeUntil=_s,r.prototype.takeWhile=js,r.prototype.tap=Es,r.prototype.times=Is,r.prototype.toArray=Cs,r.prototype.toJson=Fs,r.prototype.transform=Ts,r.prototype.undot=Ps,r.prototype.unless=Ns,r.prototype.unlessEmpty=Gt,r.prototype.unlessNotEmpty=Qt,r.prototype.union=Bs,r.prototype.unique=Us,r.prototype.unwrap=Rs,r.prototype.values=Ws,r.prototype.when=Js,r.prototype.whenEmpty=Qt,r.prototype.whenNotEmpty=Gt,r.prototype.where=Ls,r.prototype.whereBetween=Hs,r.prototype.whereIn=Qs,r.prototype.whereInstanceOf=zs,r.prototype.whereNotBetween=Xs,r.prototype.whereNotIn=ks,r.prototype.whereNull=to,r.prototype.whereNotNull=ro,r.prototype.wrap=eo,r.prototype.zip=no;var i=function(o){return new r(o)};e.exports=i,e.exports.collect=i,e.exports.default=i,e.exports.Collection=r})(At);var io=At.exports;const Xt=Ar(io),Yt=["chunk","shuffle","splice","sortBy","map","reverse","groupBy","implode","keyBy","keys","mapToDictionary","mapWithKeys","nth","skipUntil","skipWhile","takeUntil","takeWhile","unique"],so=["forPage","sortByDesc","sortBy","skip","take","splice","whereBetween","whereIn","whereNotBetween","whereNotIn","first","where","whereContains"],oo=["avg","count","countBy","dd","each","every","filter","firstWhere","isEmpty","isNotEmpty","last","mapToGroups","max","median","min","mode","contains","sole","sort","split","sum","toJson"];class j{constructor(t,r){S(this,"data_path","");S(this,"axios");S(this,"filters");S(this,"steps");S(this,"fields");S(this,"already_limit",!1);S(this,"already_offset",!1);S(this,"limit",null);S(this,"offset",null);S(this,"_sort",null);S(this,"_sortDesc",!1);S(this,"meta",{});this.axios=r,this.filters={},this.steps=[],this.fields=t}}j.prototype.dataPath=function(e){const t=this.clone();return t.data_path=e,t},j.prototype.buildArgs=function(){let e={};return Object.keys(this.filters).length>0&&(e.filters=this.filters),this._sort&&(e.sort=this._sort,this._sortDesc&&(e.sort+=":desc")),e},j.prototype.clone=function(){const e=Object.create(this);return e.steps=[...this.steps],e},Xt().macro("whereContains",function(e,t){return this.filter(r=>r[e].toLowerCase().includes(t.toLowerCase()))}),j.prototype.fetchData=async function(){let e={meta:{total:!0,key:!0,name:!0}};e.__args=this.buildArgs(),e.data=this.fields,this.already_limit&&(e.data.__args=e.data.__args||{},e.data.__args.limit=this.limit),this.already_offset&&(e.data.__args=e.data.__args||{},e.data.__args.offset=this.offset);const t=this.data_path.split(".");let r={},n=r,i=t[t.length-1];for(const u of t){if(u===i){n[u]=e;break}n[u]={},n=n[u]}let o=await A(this.axios,r);for(const u of t)o=o[u];return this.meta=o.meta,Xt(o.data)},j.prototype.processData=async function(){let e=null;for(const t of this.steps){if(Yt.includes(t.type)){e||(e=await this.fetchData()),e=e[t.type](...t.args);continue}if(t.type==="forPage"&&(e?e=e.forPage(t.args[0],t.args[1]):this.already_limit||this.already_offset?(e=await this.fetchData(),e=e.forPage(t.args[0],t.args[1])):(this.offset=(t.args[0]-1)*t.args[1],this.limit=t.args[1]),this.already_limit=!0,this.already_offset=!0),t.type==="where")if(e)e=e.where(...t.args);else{const r=t.args[0];let n="==",i=null;t.args.length==2&&(i=t.args[1]),t.args.length==3&&(n=t.args[1],i=t.args[2]),n==="=="&&(this.filters[r]=i),n==="<"&&(this.filters[r]={lt:i}),n==="<="&&(this.filters[r]={lte:i}),n===">"&&(this.filters[r]={gt:i}),n===">="&&(this.filters[r]={gte:i}),n==="!=="&&(this.filters[r]={ne:i})}t.type==="whereContains"&&(e?e=e.whereContains(...t.args):this.filters[t.args[0]]={contains:t.args[1]}),t.type==="whereIn"&&(e?e=e.whereIn(...t.args):this.filters[t.args[0]]={in:t.args[1]}),t.type==="whereNotBetween"&&(e?e=e.whereNotBetween(...t.args):this.filters[t.args[0]]={notBetween:t.args[1]}),t.type==="whereNotIn"&&(e?e=e.whereNotIn(...t.args):this.filters[t.args[0]]={notIn:t.args[1]}),t.type=="whereBetween"&&(e?e=e.whereBetween(...t.args):this.filters[t.args[0]]={between:t.args[1]}),t.type==="sortByDesc"&&(e?e=e.sortByDesc(t.args[0]):this.already_limit||this.already_offset?(e=await this.fetchData(),e=e.sortByDesc(t.args[0])):(this._sort=t.args[0],this._sortDesc=!0)),t.type==="sortBy"&&(e?e=e.sortBy(t.args[0]):this.already_limit||this.already_offset?(e=await this.fetchData(),e=e.sortBy(t.args[0])):this._sort=t.args[0]),t.type==="skip"&&(e?e=e.skip(t.args[0]):this.already_offset||this.already_limit?(e=await this.fetchData(),e=e.skip(t.args[0])):this.offset=t.args[0],this.already_offset=!0),t.type==="take"&&(e?e=e.take(...t.args):this.already_offset||this.already_limit?(e=await this.fetchData(),e=e.take(t.args[0])):this.limit=t.args[0],this.already_limit=!0),t.type==="splice"&&(e?e=e.splice(...t.args):(this.offset=t.args[0],this.limit=t.args[1]),this.already_limit=!0,this.already_offset=!0)}return e||(e=await this.fetchData()),e},j.prototype.all=async function(){return(await this.processData()).all()};for(const e of[...Yt,...so])j.prototype[e]=function(...t){const r=this.clone();return r.steps.push({type:e,args:t}),r};for(const e of oo)j.prototype[e]=async function(...t){return(await this.clone().processData())[e](...t)};j.prototype.average=j.prototype.avg,j.prototype.first=async function(){return this.take(1),(await this.processData()).first()};const mt=(e,t,r)=>{const n=new j(r,t);return n.data_path="list"+e,n},ao=(e,t)=>({folders:{list:async(r,n={name:!0,path:!0})=>(await A(t,{app:{drive:{__args:{index:e},folders:{__args:{path:r},...n}}}})).app.drive.folders,create:r=>f(t,"lightDriveCreateFolder",{index:e,path:r}),delete:r=>f(t,"lightDriveDeleteFolder",{index:e,path:r}),rename:(r,n)=>f(t,"lightDriveRenameFolder",{index:e,path:r,name:n})},files:{list:async(r,n={name:!0,path:!0,size:!0,mime:!0,url:!0})=>(await A(t,{app:{drive:{__args:{index:e},files:{__args:{path:r},...n}}}})).app.drive.files,get:async(r,n={name:!0,path:!0,size:!0,mime:!0,url:!0})=>(await A(t,{app:{drive:{__args:{index:e},file:{__args:{path:r},...n}}}})).app.drive.file,read:async r=>{let n=await A(t,{app:{drive:{__args:{index:e},file:{__args:{path:r},base64Content:!0}}}});return window.atob(n.app.drive.file.base64Content)},write:(r,n)=>f(t,"lightDriveWriteFile",{index:e,path:r,content:n}),delete:r=>f(t,"lightDriveDeleteFile",{index:e,path:r}),rename:(r,n)=>f(t,"lightDriveRenameFile",{index:e,path:r,name:n}),move:(r,n)=>f(t,"lightDriveMoveFile",{index:e,source:r,destination:n})}}),uo=e=>{const t=T.create({baseURL:e,withCredentials:!0}),r=(s,o=null,u=[])=>f(t,s,o,u),n=s=>A(t,s),i=gr(t);return{baseURL:e,axios:t,auth:cr(t),mutation:r,query:n,config:dr(n),mail:vr(t),users:br(t),fs:mr(t),models:i,model(s){return i.get(s)},roles:wr(t),collect:(s,o)=>{const u=mt(s,t,o);return u.data_path=i.get(s).getDataPath(),u},drive(s){return ao(s,t)}}};g.File=hr,g.createClient=uo,g.createCollection=mt,g.file=q,g.mutation=f,g.query=A,g.toQuery=B,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
|
13
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qn(e,t){if(e){if(typeof e=="string")return ot(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ot(e,t)}}function zn(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Xn(e){if(Array.isArray(e))return ot(e)}function ot(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Yn=function(t){if(t!==void 0){var r=this.items.filter(function(n){return n[t]!==void 0});return Math.min.apply(Math,Mt(r.map(function(n){return n[t]})))}return Math.min.apply(Math,Mt(this.items))},Zn=function(t){var r=[],n=1;return this.items.length?(this.items.forEach(function(i){var s=r.filter(function(u){return t!==void 0?u.key===i[t]:u.key===i});if(!s.length)t!==void 0?r.push({key:i[t],count:1}):r.push({key:i,count:1});else{s[0].count+=1;var o=s[0].count;o>n&&(n=o)}}),r.filter(function(i){return i.count===n}).map(function(i){return i.key})):null},kn=E,ti=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=kn(this.items),i=n.slice(r).filter(function(s,o){return o%t===0});return new this.constructor(i)},ri=K,ei=function(){for(var t=this,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var s=ri(n);if(Array.isArray(this.items)){var o=this.items.filter(function(a){return s.indexOf(a)!==-1});return new this.constructor(o)}var u={};return Object.keys(this.items).forEach(function(a){s.indexOf(a)!==-1&&(u[a]=t.items[a])}),new this.constructor(u)},ni=St,ii=function(t,r){var n=Math.abs(t),i=this.count();if(n<=i)return this;for(var s=n-i,o=ni(this.items),u=Array.isArray(this.items),a=t<0,c=0;c<s;)u?a?o.unshift(r):o.push(r):o[c]!==void 0?s+=1:o[c]=r,c+=1;return new this.constructor(o)},si=function(t){var r=this,n;return Array.isArray(this.items)?(n=[new this.constructor([]),new this.constructor([])],this.items.forEach(function(i){t(i)===!0?n[0].push(i):n[1].push(i)})):(n=[new this.constructor({}),new this.constructor({})],Object.keys(this.items).forEach(function(i){var s=r.items[i];t(s)===!0?n[0].put(i,s):n[1].put(i,s)})),new this.constructor(n)},oi=function(t){return t(this)},Ut=d,ai=Ut.isArray,ui=Ut.isObject,J=I,ci=function(t){var r={};return t.forEach(function(n,i){function s(o,u){ui(o)?Object.keys(o).forEach(function(a){s(o[a],"".concat(u,".").concat(a))}):ai(o)&&o.forEach(function(a,c){s(a,"".concat(u,".").concat(c))}),r[u]=o}s(n,i)}),r},fi=function(t,r){if(t.indexOf("*")!==-1){var n=ci(this.items),i=[];if(r!==void 0){var s=new RegExp("0.".concat(r),"g"),o="0.".concat(r).split(".").length;Object.keys(n).forEach(function(p){var m=p.match(s);if(m){var O=m[0];O.split(".").length===o&&i.push(n[O])}})}var u=[],a=new RegExp("0.".concat(t),"g"),c="0.".concat(t).split(".").length;if(Object.keys(n).forEach(function(p){var m=p.match(a);if(m){var O=m[0];O.split(".").length===c&&u.push(n[O])}}),r!==void 0){var h={};return this.items.forEach(function(p,m){h[i[m]||""]=u}),new this.constructor(h)}return new this.constructor([u])}if(r!==void 0){var b={};return this.items.forEach(function(p){J(p,t)!==void 0?b[p[r]||""]=J(p,t):b[p[r]||""]=null}),new this.constructor(b)}return this.map(function(p){return J(p,t)!==void 0?J(p,t):null})},li=K,Rt=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];li(n).forEach(function(s){delete t[s]})},Kt=d,pi=Kt.isArray,hi=Kt.isObject,Wt=Rt,yi=function(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;if(this.isEmpty())return null;if(pi(this.items))return r===1?this.items.pop():new this.constructor(this.items.splice(-r));if(hi(this.items)){var n=Object.keys(this.items);if(r===1){var i=n[n.length-1],s=this.items[i];return Wt(this.items,i),s}var o=n.slice(-r),u=o.reduce(function(a,c){return a[c]=t.items[c],a},{});return Wt(this.items,o),new this.constructor(u)}return null},mi=function(t,r){return r!==void 0?this.put(r,t):(this.items.unshift(t),this)},di=d,vi=di.isFunction,bi=function(t,r){var n=this.items[t]||null;return!n&&r!==void 0&&(vi(r)?n=r():n=r),delete this.items[t],n},gi=function(){var t;return(t=this.items).push.apply(t,arguments),this},wi=function(t,r){return this.items[t]=r,this},Ai=E,_i=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=Ai(this.items),n=new this.constructor(r).shuffle();return t!==parseInt(t,10)?n.first():n.take(t)},Oi=function(t,r){var n=this,i=null;return r!==void 0&&(i=r),Array.isArray(this.items)?this.items.forEach(function(s){i=t(i,s)}):Object.keys(this.items).forEach(function(s){i=t(i,n.items[s],s)}),i},Si=function(t){return new this.constructor(this.items).filter(function(r){return!t(r)})};function Jt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function V(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Jt(Object(r),!0).forEach(function(n){$i(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Jt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $i(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ji=function(t){if(!t)return this;if(Array.isArray(t)){var r=this.items.map(function(s,o){return t[o]||s});return new this.constructor(r)}if(t.constructor.name==="Collection"){var n=V(V({},this.items),t.all());return new this.constructor(n)}var i=V(V({},this.items),t);return new this.constructor(i)};function C(e){"@babel/helpers - typeof";return C=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},C(e)}function Vt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function P(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Vt(Object(r),!0).forEach(function(n){Ei(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Vt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ei(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ii=function(t){var r=function n(i,s){var o=P({},i),u=Object.keys(P(P({},i),s));return u.forEach(function(a){!Array.isArray(s[a])&&C(s[a])==="object"?o[a]=n(i[a],s[a]):i[a]===void 0&&s[a]!==void 0?C(i[a])==="object"?o[a]=P({},s[a]):o[a]=s[a]:i[a]!==void 0&&s[a]===void 0?C(i[a])==="object"?o[a]=P({},i[a]):o[a]=i[a]:i[a]!==void 0&&s[a]!==void 0&&(C(s[a])==="object"?o[a]=P({},s[a]):o[a]=s[a])}),o};return t?!Array.isArray(t)&&C(t)!=="object"?new this.constructor(r(this.items,[t])):t.constructor.name==="Collection"?new this.constructor(r(this.items,t.all())):new this.constructor(r(this.items,t)):this},Ci=function(){var t=[].concat(this.items).reverse();return new this.constructor(t)},at=d,Di=at.isArray,Fi=at.isObject,Ti=at.isFunction,Pi=function(t,r){var n=this,i,s=function(u,a){return Ti(t)?t(n.items[a],a):r?n.items[a]===t:n.items[a]==t};return Di(this.items)?i=this.items.findIndex(s):Fi(this.items)&&(i=Object.keys(this.items).find(function(o){return s(n.items[o],o)})),i===void 0||i<0?!1:i},Lt=d,Ni=Lt.isArray,Bi=Lt.isObject,qi=Rt,Mi=function(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;if(this.isEmpty())return null;if(Ni(this.items))return r===1?this.items.shift():new this.constructor(this.items.splice(0,r));if(Bi(this.items)){if(r===1){var n=Object.keys(this.items)[0],i=this.items[n];return delete this.items[n],i}var s=Object.keys(this.items),o=s.slice(0,r),u=o.reduce(function(a,c){return a[c]=t.items[c],a},{});return qi(this.items,o),new this.constructor(u)}return null},Ui=E,Ri=function(){var t=Ui(this.items),r,n,i;for(i=t.length;i;i-=1)r=Math.floor(Math.random()*i),n=t[i-1],t[i-1]=t[r],t[r]=n;return this.items=t,this},Ki=d,Wi=Ki.isObject,Ji=function(t){var r=this;return Wi(this.items)?new this.constructor(Object.keys(this.items).reduce(function(n,i,s){return s+1>t&&(n[i]=r.items[i]),n},{})):new this.constructor(this.items.slice(t))},ut=d,Vi=ut.isArray,Li=ut.isObject,Hi=ut.isFunction,xi=function(t){var r=this,n=null,i,s=function(u){return u===t};return Hi(t)&&(s=t),Vi(this.items)&&(i=this.items.filter(function(o){return n!==!0&&(n=s(o)),n})),Li(this.items)&&(i=Object.keys(this.items).reduce(function(o,u){return n!==!0&&(n=s(r.items[u])),n!==!1&&(o[u]=r.items[u]),o},{})),new this.constructor(i)},ct=d,Gi=ct.isArray,Qi=ct.isObject,zi=ct.isFunction,Xi=function(t){var r=this,n=null,i,s=function(u){return u===t};return zi(t)&&(s=t),Gi(this.items)&&(i=this.items.filter(function(o){return n!==!0&&(n=!s(o)),n})),Qi(this.items)&&(i=Object.keys(this.items).reduce(function(o,u){return n!==!0&&(n=!s(r.items[u])),n!==!1&&(o[u]=r.items[u]),o},{})),new this.constructor(i)},Yi=function(t,r){var n=this.items.slice(t);return r!==void 0&&(n=n.slice(0,r)),new this.constructor(n)},Zi=d,ki=Zi.isFunction,ts=function(t,r,n){var i;if(ki(t)?i=this.filter(t):i=this.where(t,r,n),i.isEmpty())throw new Error("Item not found.");if(i.count()>1)throw new Error("Multiple items found.");return i.first()},rs=jt,es=rs,ns=function(t){var r=[].concat(this.items);return t===void 0?this.every(function(n){return typeof n=="number"})?r.sort(function(n,i){return n-i}):r.sort():r.sort(t),new this.constructor(r)},is=function(){return this.sort().reverse()},ss=I,os=d,as=os.isFunction,us=function(t){var r=[].concat(this.items),n=function(s){return as(t)?t(s):ss(s,t)};return r.sort(function(i,s){var o=n(i),u=n(s);return o==null?1:u==null||o<u?-1:o>u?1:0}),new this.constructor(r)},cs=function(t){return this.sortBy(t).reverse()},fs=function(){var t=this,r={};return Object.keys(this.items).sort().forEach(function(n){r[n]=t.items[n]}),new this.constructor(r)},ls=function(){var t=this,r={};return Object.keys(this.items).sort().reverse().forEach(function(n){r[n]=t.items[n]}),new this.constructor(r)},ps=function(t,r,n){var i=this.slice(t,r);if(this.items=this.diff(i.all()).all(),Array.isArray(n))for(var s=0,o=n.length;s<o;s+=1)this.items.splice(t+s,0,n[s]);return i},hs=function(t){for(var r=Math.round(this.items.length/t),n=JSON.parse(JSON.stringify(this.items)),i=[],s=0;s<t;s+=1)i.push(new this.constructor(n.splice(0,r)));return new this.constructor(i)},ys=E,ms=d,ds=ms.isFunction,vs=function(t){var r=ys(this.items),n=0;if(t===void 0)for(var i=0,s=r.length;i<s;i+=1)n+=parseFloat(r[i]);else if(ds(t))for(var o=0,u=r.length;o<u;o+=1)n+=parseFloat(t(r[o]));else for(var a=0,c=r.length;a<c;a+=1)n+=parseFloat(r[a][t]);return parseFloat(n.toPrecision(12))};function ft(e){"@babel/helpers - typeof";return ft=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ft(e)}var bs=function(t){var r=this;if(!Array.isArray(this.items)&&ft(this.items)==="object"){var n=Object.keys(this.items),i;t<0?i=n.slice(t):i=n.slice(0,t);var s={};return n.forEach(function(o){i.indexOf(o)!==-1&&(s[o]=r.items[o])}),new this.constructor(s)}return t<0?new this.constructor(this.items.slice(t)):new this.constructor(this.items.slice(0,t))},lt=d,gs=lt.isArray,ws=lt.isObject,As=lt.isFunction,_s=function(t){var r=this,n=null,i,s=function(u){return u===t};return As(t)&&(s=t),gs(this.items)&&(i=this.items.filter(function(o){return n!==!1&&(n=!s(o)),n})),ws(this.items)&&(i=Object.keys(this.items).reduce(function(o,u){return n!==!1&&(n=!s(r.items[u])),n!==!1&&(o[u]=r.items[u]),o},{})),new this.constructor(i)},pt=d,Os=pt.isArray,Ss=pt.isObject,$s=pt.isFunction,js=function(t){var r=this,n=null,i,s=function(u){return u===t};return $s(t)&&(s=t),Os(this.items)&&(i=this.items.filter(function(o){return n!==!1&&(n=s(o)),n})),Ss(this.items)&&(i=Object.keys(this.items).reduce(function(o,u){return n!==!1&&(n=s(r.items[u])),n!==!1&&(o[u]=r.items[u]),o},{})),new this.constructor(i)},Es=function(t){return t(this),this},Is=function(t,r){for(var n=1;n<=t;n+=1)this.items.push(r(n));return this},Cs=function(){var t=this.constructor;function r(i,s){var o=[];i instanceof t?(i.items.forEach(function(u){return r(u,o)}),s.push(o)):Array.isArray(i)?(i.forEach(function(u){return r(u,o)}),s.push(o)):s.push(i)}if(Array.isArray(this.items)){var n=[];return this.items.forEach(function(i){r(i,n)}),n}return this.values().all()};function ht(e){"@babel/helpers - typeof";return ht=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ht(e)}var Ds=function(){return ht(this.items)==="object"&&!Array.isArray(this.items)?JSON.stringify(this.all()):JSON.stringify(this.toArray())},Fs=function(t){var r=this;if(Array.isArray(this.items))this.items=this.items.map(t);else{var n={};Object.keys(this.items).forEach(function(i){n[i]=t(r.items[i],i)}),this.items=n}return this};function Ht(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function xt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ht(Object(r),!0).forEach(function(n){Ts(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ht(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ts(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ps=function(){var t=this;if(Array.isArray(this.items))return this;var r={};return Object.keys(this.items).forEach(function(n){if(n.indexOf(".")!==-1){var i=r;n.split(".").reduce(function(s,o,u,a){return s[o]||(s[o]={}),u===a.length-1&&(s[o]=t.items[n]),s[o]},i),r=xt(xt({},r),i)}else r[n]=t.items[n]}),new this.constructor(r)},Ns=function(t,r,n){t?n(this):r(this)},Gt=function(t,r){if(Array.isArray(this.items)&&this.items.length)return t(this);if(Object.keys(this.items).length)return t(this);if(r!==void 0){if(Array.isArray(this.items)&&!this.items.length)return r(this);if(!Object.keys(this.items).length)return r(this)}return this},Qt=function(t,r){if(Array.isArray(this.items)&&!this.items.length)return t(this);if(!Object.keys(this.items).length)return t(this);if(r!==void 0){if(Array.isArray(this.items)&&this.items.length)return r(this);if(Object.keys(this.items).length)return r(this)}return this},Bs=function(t){var r=this,n=JSON.parse(JSON.stringify(this.items));return Object.keys(t).forEach(function(i){r.items[i]===void 0&&(n[i]=t[i])}),new this.constructor(n)},qs=d,Ms=qs.isFunction,Us=function(t){var r;if(t===void 0)r=this.items.filter(function(u,a,c){return c.indexOf(u)===a});else{r=[];for(var n=[],i=0,s=this.items.length;i<s;i+=1){var o=void 0;Ms(t)?o=t(this.items[i]):o=this.items[i][t],n.indexOf(o)===-1&&(r.push(this.items[i]),n.push(o))}}return new this.constructor(r)},Rs=function(t){return t instanceof this.constructor?t.all():t},Ks=E,Ws=function(){return new this.constructor(Ks(this.items))},Js=function(t,r,n){return t?r(this,t):n?n(this,t):this},Vs=E,j=I,Ls=function(t,r,n){var i=r,s=n,o=Vs(this.items);if(r===void 0||r===!0)return new this.constructor(o.filter(function(a){return j(a,t)}));if(r===!1)return new this.constructor(o.filter(function(a){return!j(a,t)}));n===void 0&&(s=r,i="===");var u=o.filter(function(a){switch(i){case"==":return j(a,t)===Number(s)||j(a,t)===s.toString();default:case"===":return j(a,t)===s;case"!=":case"<>":return j(a,t)!==Number(s)&&j(a,t)!==s.toString();case"!==":return j(a,t)!==s;case"<":return j(a,t)<s;case"<=":return j(a,t)<=s;case">":return j(a,t)>s;case">=":return j(a,t)>=s}});return new this.constructor(u)},Hs=function(t,r){return this.where(t,">=",r[0]).where(t,"<=",r[r.length-1])},xs=E,Gs=I,Qs=function(t,r){var n=xs(r),i=this.items.filter(function(s){return n.indexOf(Gs(s,t))!==-1});return new this.constructor(i)},zs=function(t){return this.filter(function(r){return r instanceof t})},zt=I,Xs=function(t,r){return this.filter(function(n){return zt(n,t)<r[0]||zt(n,t)>r[r.length-1]})},Ys=E,Zs=I,ks=function(t,r){var n=Ys(r),i=this.items.filter(function(s){return n.indexOf(Zs(s,t))===-1});return new this.constructor(i)},to=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.where(t,"===",null)},ro=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.where(t,"!==",null)};function yt(e){"@babel/helpers - typeof";return yt=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yt(e)}var eo=function(t){return t instanceof this.constructor?t:yt(t)==="object"?new this.constructor(t):new this.constructor([t])},no=function(t){var r=this,n=t;n instanceof this.constructor&&(n=n.all());var i=this.items.map(function(s,o){return new r.constructor([s,n[o]])});return new this.constructor(i)};(function(e){function t(s){"@babel/helpers - typeof";return t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},t(s)}function r(s){s!==void 0&&!Array.isArray(s)&&t(s)!=="object"?this.items=[s]:s instanceof this.constructor?this.items=s.all():this.items=s||[]}var n=_r;typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=n),r.prototype.toJSON=function(){return this.items},r.prototype.all=Or,r.prototype.average=_t,r.prototype.avg=Er,r.prototype.chunk=Ir,r.prototype.collapse=Nr,r.prototype.combine=Kr,r.prototype.concat=Gr,r.prototype.contains=jt,r.prototype.containsOneItem=oe,r.prototype.count=ae,r.prototype.countBy=ue,r.prototype.crossJoin=ce,r.prototype.dd=fe,r.prototype.diff=le,r.prototype.diffAssoc=pe,r.prototype.diffKeys=he,r.prototype.diffUsing=ye,r.prototype.doesntContain=me,r.prototype.dump=de,r.prototype.duplicates=ve,r.prototype.each=be,r.prototype.eachSpread=Se,r.prototype.every=je,r.prototype.except=Ie,r.prototype.filter=Fe,r.prototype.first=Pe,r.prototype.firstOrFail=qe,r.prototype.firstWhere=Me,r.prototype.flatMap=Ue,r.prototype.flatten=Re,r.prototype.flip=Ke,r.prototype.forPage=We,r.prototype.forget=Je,r.prototype.get=He,r.prototype.groupBy=Qe,r.prototype.has=Xe,r.prototype.implode=Ye,r.prototype.intersect=Ze,r.prototype.intersectByKeys=ke,r.prototype.isEmpty=tn,r.prototype.isNotEmpty=rn,r.prototype.join=en,r.prototype.keyBy=an,r.prototype.keys=un,r.prototype.last=fn,r.prototype.macro=ln,r.prototype.make=pn,r.prototype.map=hn,r.prototype.mapSpread=gn,r.prototype.mapToDictionary=$n,r.prototype.mapInto=jn,r.prototype.mapToGroups=Tn,r.prototype.mapWithKeys=Mn,r.prototype.max=Jn,r.prototype.median=Vn,r.prototype.merge=Ln,r.prototype.mergeRecursive=xn,r.prototype.min=Yn,r.prototype.mode=Zn,r.prototype.nth=ti,r.prototype.only=ei,r.prototype.pad=ii,r.prototype.partition=si,r.prototype.pipe=oi,r.prototype.pluck=fi,r.prototype.pop=yi,r.prototype.prepend=mi,r.prototype.pull=bi,r.prototype.push=gi,r.prototype.put=wi,r.prototype.random=_i,r.prototype.reduce=Oi,r.prototype.reject=Si,r.prototype.replace=ji,r.prototype.replaceRecursive=Ii,r.prototype.reverse=Ci,r.prototype.search=Pi,r.prototype.shift=Mi,r.prototype.shuffle=Ri,r.prototype.skip=Ji,r.prototype.skipUntil=xi,r.prototype.skipWhile=Xi,r.prototype.slice=Yi,r.prototype.sole=ts,r.prototype.some=es,r.prototype.sort=ns,r.prototype.sortDesc=is,r.prototype.sortBy=us,r.prototype.sortByDesc=cs,r.prototype.sortKeys=fs,r.prototype.sortKeysDesc=ls,r.prototype.splice=ps,r.prototype.split=hs,r.prototype.sum=vs,r.prototype.take=bs,r.prototype.takeUntil=_s,r.prototype.takeWhile=js,r.prototype.tap=Es,r.prototype.times=Is,r.prototype.toArray=Cs,r.prototype.toJson=Ds,r.prototype.transform=Fs,r.prototype.undot=Ps,r.prototype.unless=Ns,r.prototype.unlessEmpty=Gt,r.prototype.unlessNotEmpty=Qt,r.prototype.union=Bs,r.prototype.unique=Us,r.prototype.unwrap=Rs,r.prototype.values=Ws,r.prototype.when=Js,r.prototype.whenEmpty=Qt,r.prototype.whenNotEmpty=Gt,r.prototype.where=Ls,r.prototype.whereBetween=Hs,r.prototype.whereIn=Qs,r.prototype.whereInstanceOf=zs,r.prototype.whereNotBetween=Xs,r.prototype.whereNotIn=ks,r.prototype.whereNull=to,r.prototype.whereNotNull=ro,r.prototype.wrap=eo,r.prototype.zip=no;var i=function(o){return new r(o)};e.exports=i,e.exports.collect=i,e.exports.default=i,e.exports.Collection=r})(At);var io=At.exports;const Xt=Ar(io),Yt=["flatMap","chunk","shuffle","splice","sortBy","map","reverse","groupBy","keyBy","keys","mapToDictionary","mapWithKeys","nth","skipUntil","skipWhile","takeUntil","takeWhile","unique","pluck","push","only","pad","slice","tap"],so=["forPage","sortByDesc","sortBy","skip","take","splice","whereBetween","whereIn","whereNotBetween","whereNotIn","first","where","whereContains"],oo=["avg","count","countBy","dd","each","every","filter","firstWhere","isEmpty","isNotEmpty","last","mapToGroups","max","median","min","mode","contains","sole","sort","split","sum","toJson","get","has","implode","partition","sole"];class A{constructor(t,r){$(this,"data_path","");$(this,"axios");$(this,"filters");$(this,"steps");$(this,"fields");$(this,"already_limit",!1);$(this,"already_offset",!1);$(this,"limit",null);$(this,"offset",null);$(this,"_sort",null);$(this,"_sortDesc",!1);$(this,"meta",{});this.axios=r,this.filters={},this.steps=[],this.fields=t}}A.prototype.dataPath=function(e){const t=this.clone();return t.data_path=e,t},A.prototype.buildArgs=function(){let e={};return Object.keys(this.filters).length>0&&(e.filters=this.filters),this._sort&&(e.sort=this._sort,this._sortDesc&&(e.sort+=":desc")),e},A.prototype.clone=function(){const e=Object.create(this);return e.steps=[...this.steps],e},Xt().macro("whereContains",function(e,t){return this.filter(r=>r[e].toLowerCase().includes(t.toLowerCase()))}),A.prototype.fetchData=async function(){let e={meta:{total:!0,key:!0,name:!0}};e.__args=this.buildArgs(),e.data=this.fields,this.already_limit&&(e.data.__args=e.data.__args||{},e.data.__args.limit=this.limit),this.already_offset&&(e.data.__args=e.data.__args||{},e.data.__args.offset=this.offset);const t=this.data_path.split(".");let r={},n=r,i=t[t.length-1];for(const u of t){if(u===i){n[u]=e;break}n[u]={},n=n[u]}let o=await _(this.axios,r);for(const u of t)o=o[u];return this.meta=o.meta,Xt(o.data)},A.prototype.processData=async function(){let e=null;for(const t of this.steps){if(Yt.includes(t.type)){e||(e=await this.fetchData()),e=e[t.type](...t.args);continue}if(t.type==="forPage"&&(e?e=e.forPage(t.args[0],t.args[1]):this.already_limit||this.already_offset?(e=await this.fetchData(),e=e.forPage(t.args[0],t.args[1])):(this.offset=(t.args[0]-1)*t.args[1],this.limit=t.args[1]),this.already_limit=!0,this.already_offset=!0),t.type==="where")if(e)e=e.where(...t.args);else{const r=t.args[0];let n="==",i=null;t.args.length==2&&(i=t.args[1]),t.args.length==3&&(n=t.args[1],i=t.args[2]),n==="=="&&(this.filters[r]=i),n==="<"&&(this.filters[r]={lt:i}),n==="<="&&(this.filters[r]={lte:i}),n===">"&&(this.filters[r]={gt:i}),n===">="&&(this.filters[r]={gte:i}),n==="!=="&&(this.filters[r]={ne:i})}t.type==="whereContains"&&(e?e=e.whereContains(...t.args):this.filters[t.args[0]]={contains:t.args[1]}),t.type==="whereIn"&&(e?e=e.whereIn(...t.args):this.filters[t.args[0]]={in:t.args[1]}),t.type==="whereNotBetween"&&(e?e=e.whereNotBetween(...t.args):this.filters[t.args[0]]={notBetween:t.args[1]}),t.type==="whereNotIn"&&(e?e=e.whereNotIn(...t.args):this.filters[t.args[0]]={notIn:t.args[1]}),t.type=="whereBetween"&&(e?e=e.whereBetween(...t.args):this.filters[t.args[0]]={between:t.args[1]}),t.type==="sortByDesc"&&(e?e=e.sortByDesc(t.args[0]):this.already_limit||this.already_offset?(e=await this.fetchData(),e=e.sortByDesc(t.args[0])):(this._sort=t.args[0],this._sortDesc=!0)),t.type==="sortBy"&&(e?e=e.sortBy(t.args[0]):this.already_limit||this.already_offset?(e=await this.fetchData(),e=e.sortBy(t.args[0])):this._sort=t.args[0]),t.type==="skip"&&(e?e=e.skip(t.args[0]):this.already_offset||this.already_limit?(e=await this.fetchData(),e=e.skip(t.args[0])):this.offset=t.args[0],this.already_offset=!0),t.type==="take"&&(e?e=e.take(...t.args):this.already_offset||this.already_limit?(e=await this.fetchData(),e=e.take(t.args[0])):this.limit=t.args[0],this.already_limit=!0),t.type==="splice"&&(e?e=e.splice(...t.args):(this.offset=t.args[0],this.limit=t.args[1]),this.already_limit=!0,this.already_offset=!0),t.type==="pop"&&(e?e=e.pop(...t.args):(e=await this.fetchData(),e.pop(...t.args))),t.type==="prepend"&&(e?e=e.prepend(...t.args):(e=await this.fetchData(),e.prepend(...t.args)))}return e||(e=await this.fetchData()),e},A.prototype.all=async function(){return(await this.processData()).all()};for(const e of[...Yt,...so])A.prototype[e]=function(...t){const r=this.clone();return r.steps.push({type:e,args:t}),r};for(const e of oo)A.prototype[e]=async function(...t){return(await this.clone().processData())[e](...t)};A.prototype.average=A.prototype.avg,A.prototype.first=async function(){return this.take(1),(await this.processData()).first()},A.prototype.push=function(e){return this.steps.push({type:"push",args:[e]}),this},A.prototype.pop=async function(...e){const r=(await this.clone().processData()).pop(...e);return this.steps.push({type:"pop",args:e}),r},A.prototype.prepend=function(...e){return this.steps.push({type:"prepend",args:e}),this},A.prototype.shift=async function(...e){const r=(await this.clone().processData()).shift(...e);return this.steps.push({type:"shift",args:e}),r},A.prototype.transform=function(...e){return this.steps.push({type:"transform",args:e}),this};const mt=(e,t,r)=>{const n=new A(r,t);return n.data_path="list"+e,n},ao=(e,t)=>({uploadTempFile:r=>f(t,"lightDriveUploadTempFile",{index:e,file:r},{name:!0,path:!0,size:!0,mime:!0}),folders:{list:async(r,n={name:!0,path:!0})=>(await _(t,{app:{drive:{__args:{index:e},folders:{__args:{path:r},...n}}}})).app.drive.folders,create:r=>f(t,"lightDriveCreateFolder",{index:e,path:r}),delete:r=>f(t,"lightDriveDeleteFolder",{index:e,path:r}),rename:(r,n)=>f(t,"lightDriveRenameFolder",{index:e,path:r,name:n})},files:{list:async(r,n={name:!0,path:!0,size:!0,mime:!0,url:!0})=>(await _(t,{app:{drive:{__args:{index:e},files:{__args:{path:r},...n}}}})).app.drive.files,get:async(r,n={name:!0,path:!0,size:!0,mime:!0,url:!0})=>(await _(t,{app:{drive:{__args:{index:e},file:{__args:{path:r},...n}}}})).app.drive.file,read:async r=>{let n=await _(t,{app:{drive:{__args:{index:e},file:{__args:{path:r},base64Content:!0}}}});return window.atob(n.app.drive.file.base64Content)},write:(r,n)=>f(t,"lightDriveWriteFile",{index:e,path:r,content:n}),delete:r=>f(t,"lightDriveDeleteFile",{index:e,path:r}),rename:(r,n)=>f(t,"lightDriveRenameFile",{index:e,path:r,name:n}),move:(r,n)=>f(t,"lightDriveMoveFile",{index:e,source:r,destination:n})}}),uo=e=>{const t=F.create({baseURL:e,withCredentials:!0}),r=(s,o=null,u=[])=>f(t,s,o,u),n=s=>_(t,s),i=gr(t);return{baseURL:e,axios:t,auth:cr(t),mutation:r,query:n,config:dr(n),mail:vr(t),users:br(t),fs:mr(t),models:i,model(s){return i.get(s)},roles:wr(t),collect:(s,o)=>{const u=mt(s,t,o);return u.data_path=i.get(s).getDataPath(),u},drive(s){return ao(s,t)}}};g.File=pr,g.createClient=uo,g.createCollection=mt,g.file=q,g.mutation=f,g.query=_,g.toQuery=B,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|