@hostlink/light 2.3.3 → 2.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/light.js +190 -189
- package/dist/light.umd.cjs +11 -11
- package/dist/models.d.ts +3 -2
- package/package.json +1 -1
package/dist/light.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var w = (e, t, r) =>
|
|
4
|
-
import { jsonToGraphQLQuery as
|
|
5
|
-
import
|
|
6
|
-
function
|
|
1
|
+
var Xt = Object.defineProperty;
|
|
2
|
+
var Yt = (e, t, r) => t in e ? Xt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var w = (e, t, r) => Yt(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { jsonToGraphQLQuery as Ft, VariableType as W } from "json-to-graphql-query";
|
|
5
|
+
import Zt from "axios";
|
|
6
|
+
function Dt(e) {
|
|
7
7
|
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);
|
|
8
8
|
for (let o = 0; o < n.length; o++)
|
|
9
9
|
s[o] = n.charCodeAt(o);
|
|
10
10
|
return i;
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function Nt(e) {
|
|
13
13
|
const t = new Uint8Array(e);
|
|
14
14
|
let r = "";
|
|
15
15
|
for (const s of t)
|
|
@@ -59,7 +59,7 @@ function H(e, t) {
|
|
|
59
59
|
derive: t
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function p(e) {
|
|
63
63
|
return {
|
|
64
64
|
required: !0,
|
|
65
65
|
schema: e
|
|
@@ -71,43 +71,43 @@ function b(e) {
|
|
|
71
71
|
schema: e
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
|
-
var
|
|
75
|
-
type:
|
|
76
|
-
id:
|
|
74
|
+
var Bt = {
|
|
75
|
+
type: p(l),
|
|
76
|
+
id: p(A),
|
|
77
77
|
transports: b(l)
|
|
78
|
-
},
|
|
78
|
+
}, qt = {
|
|
79
79
|
appid: b(l),
|
|
80
80
|
appidExclude: b(l),
|
|
81
81
|
credProps: b(l)
|
|
82
|
-
},
|
|
82
|
+
}, xt = {
|
|
83
83
|
appid: b(l),
|
|
84
84
|
appidExclude: b(l),
|
|
85
85
|
credProps: b(l)
|
|
86
|
-
},
|
|
87
|
-
publicKey:
|
|
88
|
-
rp:
|
|
89
|
-
user:
|
|
90
|
-
id:
|
|
91
|
-
name:
|
|
92
|
-
displayName:
|
|
86
|
+
}, kt = {
|
|
87
|
+
publicKey: p({
|
|
88
|
+
rp: p(l),
|
|
89
|
+
user: p({
|
|
90
|
+
id: p(A),
|
|
91
|
+
name: p(l),
|
|
92
|
+
displayName: p(l)
|
|
93
93
|
}),
|
|
94
|
-
challenge:
|
|
95
|
-
pubKeyCredParams:
|
|
94
|
+
challenge: p(A),
|
|
95
|
+
pubKeyCredParams: p(l),
|
|
96
96
|
timeout: b(l),
|
|
97
|
-
excludeCredentials: b([
|
|
97
|
+
excludeCredentials: b([Bt]),
|
|
98
98
|
authenticatorSelection: b(l),
|
|
99
99
|
attestation: b(l),
|
|
100
|
-
extensions: b(
|
|
100
|
+
extensions: b(qt)
|
|
101
101
|
}),
|
|
102
102
|
signal: b(l)
|
|
103
|
-
},
|
|
104
|
-
type:
|
|
105
|
-
id:
|
|
106
|
-
rawId:
|
|
103
|
+
}, tr = {
|
|
104
|
+
type: p(l),
|
|
105
|
+
id: p(l),
|
|
106
|
+
rawId: p(A),
|
|
107
107
|
authenticatorAttachment: b(l),
|
|
108
|
-
response:
|
|
109
|
-
clientDataJSON:
|
|
110
|
-
attestationObject:
|
|
108
|
+
response: p({
|
|
109
|
+
clientDataJSON: p(A),
|
|
110
|
+
attestationObject: p(A),
|
|
111
111
|
transports: H(
|
|
112
112
|
l,
|
|
113
113
|
(e) => {
|
|
@@ -117,69 +117,69 @@ var qt = {
|
|
|
117
117
|
)
|
|
118
118
|
}),
|
|
119
119
|
clientExtensionResults: H(
|
|
120
|
-
|
|
120
|
+
xt,
|
|
121
121
|
(e) => e.getClientExtensionResults()
|
|
122
122
|
)
|
|
123
|
-
},
|
|
123
|
+
}, rr = {
|
|
124
124
|
mediation: b(l),
|
|
125
|
-
publicKey:
|
|
126
|
-
challenge:
|
|
125
|
+
publicKey: p({
|
|
126
|
+
challenge: p(A),
|
|
127
127
|
timeout: b(l),
|
|
128
128
|
rpId: b(l),
|
|
129
|
-
allowCredentials: b([
|
|
129
|
+
allowCredentials: b([Bt]),
|
|
130
130
|
userVerification: b(l),
|
|
131
|
-
extensions: b(
|
|
131
|
+
extensions: b(qt)
|
|
132
132
|
}),
|
|
133
133
|
signal: b(l)
|
|
134
|
-
},
|
|
135
|
-
type:
|
|
136
|
-
id:
|
|
137
|
-
rawId:
|
|
134
|
+
}, er = {
|
|
135
|
+
type: p(l),
|
|
136
|
+
id: p(l),
|
|
137
|
+
rawId: p(A),
|
|
138
138
|
authenticatorAttachment: b(l),
|
|
139
|
-
response:
|
|
140
|
-
clientDataJSON:
|
|
141
|
-
authenticatorData:
|
|
142
|
-
signature:
|
|
143
|
-
userHandle:
|
|
139
|
+
response: p({
|
|
140
|
+
clientDataJSON: p(A),
|
|
141
|
+
authenticatorData: p(A),
|
|
142
|
+
signature: p(A),
|
|
143
|
+
userHandle: p(A)
|
|
144
144
|
}),
|
|
145
145
|
clientExtensionResults: H(
|
|
146
|
-
|
|
146
|
+
xt,
|
|
147
147
|
(e) => e.getClientExtensionResults()
|
|
148
148
|
)
|
|
149
149
|
};
|
|
150
|
-
function
|
|
151
|
-
return P(
|
|
150
|
+
function nr(e) {
|
|
151
|
+
return P(Dt, kt, e);
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function ir(e) {
|
|
154
154
|
return P(
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
Nt,
|
|
156
|
+
tr,
|
|
157
157
|
e
|
|
158
158
|
);
|
|
159
159
|
}
|
|
160
|
-
function
|
|
161
|
-
return P(
|
|
160
|
+
function sr(e) {
|
|
161
|
+
return P(Dt, rr, e);
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function or(e) {
|
|
164
164
|
return P(
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
Nt,
|
|
166
|
+
er,
|
|
167
167
|
e
|
|
168
168
|
);
|
|
169
169
|
}
|
|
170
|
-
async function
|
|
170
|
+
async function ar(e) {
|
|
171
171
|
const t = await navigator.credentials.create(
|
|
172
172
|
e
|
|
173
173
|
);
|
|
174
|
-
return t.toJSON = () =>
|
|
174
|
+
return t.toJSON = () => ir(t), t;
|
|
175
175
|
}
|
|
176
|
-
async function
|
|
176
|
+
async function ur(e) {
|
|
177
177
|
const t = await navigator.credentials.get(
|
|
178
178
|
e
|
|
179
179
|
);
|
|
180
|
-
return t.toJSON = () =>
|
|
180
|
+
return t.toJSON = () => or(t), t;
|
|
181
181
|
}
|
|
182
|
-
const
|
|
182
|
+
const cr = (e) => ({
|
|
183
183
|
login: async (t) => {
|
|
184
184
|
const n = (await O(e, {
|
|
185
185
|
webAuthnRequestOptions: {
|
|
@@ -187,24 +187,24 @@ const fr = (e) => ({
|
|
|
187
187
|
username: t
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
})).webAuthnRequestOptions, i =
|
|
190
|
+
})).webAuthnRequestOptions, i = sr({
|
|
191
191
|
publicKey: n
|
|
192
|
-
}), s = await
|
|
192
|
+
}), s = await ur(i);
|
|
193
193
|
await y(e, "webAuthnAssertion", {
|
|
194
194
|
username: t,
|
|
195
195
|
assertion: s.toJSON()
|
|
196
196
|
});
|
|
197
197
|
},
|
|
198
198
|
register: async () => {
|
|
199
|
-
const t = await O(e, { webAuthnCreationOptions: !0 }), r =
|
|
199
|
+
const t = await O(e, { webAuthnCreationOptions: !0 }), r = nr({
|
|
200
200
|
publicKey: t.webAuthnCreationOptions
|
|
201
|
-
}), n = await
|
|
201
|
+
}), n = await ar(r);
|
|
202
202
|
await y(e, "webAuthnRegister", {
|
|
203
203
|
registration: n.toJSON()
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
|
-
}),
|
|
207
|
-
WebAuthn:
|
|
206
|
+
}), fr = (e) => ({
|
|
207
|
+
WebAuthn: cr(e),
|
|
208
208
|
facebookLogin: (t) => y(e, "facebookLogin", {
|
|
209
209
|
access_token: t
|
|
210
210
|
}),
|
|
@@ -251,7 +251,7 @@ const fr = (e) => ({
|
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
})).granted
|
|
254
|
-
}),
|
|
254
|
+
}), lr = (e, t, r) => {
|
|
255
255
|
const n = t, i = e, s = r;
|
|
256
256
|
let o = "list" + t;
|
|
257
257
|
const u = (a) => s[a] ? s[a]() : null;
|
|
@@ -266,11 +266,11 @@ const fr = (e) => ({
|
|
|
266
266
|
},
|
|
267
267
|
gqlFields(a) {
|
|
268
268
|
const c = [];
|
|
269
|
-
for (const
|
|
270
|
-
if (typeof
|
|
271
|
-
const v = u(
|
|
269
|
+
for (const h of a)
|
|
270
|
+
if (typeof h == "string") {
|
|
271
|
+
const v = u(h);
|
|
272
272
|
v && c.push(v.getGQLField());
|
|
273
|
-
} else typeof
|
|
273
|
+
} else typeof h == "object" && c.push(h);
|
|
274
274
|
return c;
|
|
275
275
|
},
|
|
276
276
|
async update(a, c) {
|
|
@@ -284,8 +284,8 @@ const fr = (e) => ({
|
|
|
284
284
|
},
|
|
285
285
|
fields(a) {
|
|
286
286
|
let c = [];
|
|
287
|
-
for (let
|
|
288
|
-
const v = u(
|
|
287
|
+
for (let h of a) {
|
|
288
|
+
const v = u(h);
|
|
289
289
|
v && c.push(v);
|
|
290
290
|
}
|
|
291
291
|
return c;
|
|
@@ -324,7 +324,7 @@ function hr(e) {
|
|
|
324
324
|
var t, r, n, i, s, o = String, u = 255;
|
|
325
325
|
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);
|
|
326
326
|
return function(a, c) {
|
|
327
|
-
for (var
|
|
327
|
+
for (var h = c; h > 0; h--) a.pop();
|
|
328
328
|
}(n, t.length), o.fromCharCode.apply(o, n);
|
|
329
329
|
}
|
|
330
330
|
const R = (e = "") => {
|
|
@@ -368,7 +368,7 @@ const R = (e = "") => {
|
|
|
368
368
|
t[r] = G(n);
|
|
369
369
|
}), t);
|
|
370
370
|
}, N = (e) => G(e), O = async (e, t) => {
|
|
371
|
-
let r =
|
|
371
|
+
let r = Ft(N(t));
|
|
372
372
|
const n = await e.post("", {
|
|
373
373
|
query: `{ ${r} }`
|
|
374
374
|
});
|
|
@@ -395,25 +395,25 @@ const y = async (e, t, r = null, n = []) => {
|
|
|
395
395
|
const s = new FormData();
|
|
396
396
|
let o = !1;
|
|
397
397
|
if (r) {
|
|
398
|
-
const c = {},
|
|
398
|
+
const c = {}, h = {}, v = {};
|
|
399
399
|
let f = 0;
|
|
400
400
|
Object.entries(r).forEach(([m, g]) => {
|
|
401
401
|
if (g instanceof Array && pr(g)) {
|
|
402
402
|
o = !0;
|
|
403
403
|
let E = 0;
|
|
404
404
|
g.forEach((C) => {
|
|
405
|
-
C instanceof File && (c[m] = new W(m),
|
|
405
|
+
C instanceof File && (c[m] = new W(m), h[f] = ["variables." + m + "." + E], s.append(f.toString(), C), f++);
|
|
406
406
|
}), v[m] = "[Upload!]!";
|
|
407
|
-
} else g instanceof File ? (o = !0, c[m] = new W(m),
|
|
408
|
-
C instanceof File ? (c[m][E] = new W(E),
|
|
407
|
+
} else g instanceof File ? (o = !0, c[m] = new W(m), h[f] = ["variables." + m], s.append(f.toString(), g), v[m] = "Upload!", f++) : g instanceof Object && yr(g) ? (o = !0, c[m] = {}, Object.entries(g).forEach(([E, C]) => {
|
|
408
|
+
C instanceof File ? (c[m][E] = new W(E), h[f] = ["variables." + E], s.append(f.toString(), C), v[E] = "Upload!", f++) : c[m][E] = C;
|
|
409
409
|
})) : g !== void 0 && (c[m] = g);
|
|
410
|
-
}), i[t].__args = c, i.__variables = v, o && s.append("map", JSON.stringify(
|
|
410
|
+
}), i[t].__args = c, i.__variables = v, o && s.append("map", JSON.stringify(h));
|
|
411
411
|
}
|
|
412
|
-
Object.entries(N(n)).forEach(([c,
|
|
413
|
-
i[t][c] =
|
|
412
|
+
Object.entries(N(n)).forEach(([c, h]) => {
|
|
413
|
+
i[t][c] = h;
|
|
414
414
|
}), Object.entries(i[t]).length === 0 && (i[t] = !0);
|
|
415
415
|
let u = null;
|
|
416
|
-
const a =
|
|
416
|
+
const a = Ft({ mutation: i });
|
|
417
417
|
if (o ? (s.append("operations", JSON.stringify({
|
|
418
418
|
query: a
|
|
419
419
|
})), u = await e.post("", s)) : u = await e.post("", {
|
|
@@ -503,34 +503,35 @@ const y = async (e, t, r = null, n = []) => {
|
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
505
|
})).listUser.data
|
|
506
|
-
}), gr = () => {
|
|
507
|
-
const e = {};
|
|
506
|
+
}), gr = (e) => {
|
|
507
|
+
const t = e, r = {};
|
|
508
508
|
return {
|
|
509
|
-
create(
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
509
|
+
create(n, i) {
|
|
510
|
+
r[n] = null;
|
|
511
|
+
let s = {};
|
|
512
|
+
for (const o of Object.entries(i)) {
|
|
513
|
+
const [u, a] = o;
|
|
514
|
+
s[u] = () => ({
|
|
515
|
+
name: a.name ? a.name : u,
|
|
516
|
+
raw: a,
|
|
517
|
+
getName: () => a.name ? a.name : u,
|
|
518
|
+
getGQLField: () => a.gqlField !== void 0 ? a.gqlField : a.name || u,
|
|
518
519
|
getRaw() {
|
|
519
|
-
return
|
|
520
|
+
return a;
|
|
520
521
|
},
|
|
521
|
-
getValue(
|
|
522
|
-
return
|
|
522
|
+
getValue(c) {
|
|
523
|
+
return a.field && typeof a.field == "function" ? a.field(c) : a.field && typeof a.field == "string" ? c[a.field] : c[this.getName()];
|
|
523
524
|
},
|
|
524
|
-
getFormattedValue(
|
|
525
|
-
const
|
|
526
|
-
return
|
|
525
|
+
getFormattedValue(c) {
|
|
526
|
+
const h = this.getValue(c);
|
|
527
|
+
return a.format ? a.format(h) : h;
|
|
527
528
|
}
|
|
528
529
|
});
|
|
529
530
|
}
|
|
530
|
-
|
|
531
|
+
r[n] = lr(t, n, s);
|
|
531
532
|
},
|
|
532
|
-
get(
|
|
533
|
-
return
|
|
533
|
+
get(n) {
|
|
534
|
+
return r[n] || this.create(n, {}), r[n];
|
|
534
535
|
}
|
|
535
536
|
};
|
|
536
537
|
}, wr = (e) => ({
|
|
@@ -543,7 +544,7 @@ const y = async (e, t, r = null, n = []) => {
|
|
|
543
544
|
function Ar(e) {
|
|
544
545
|
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
|
|
545
546
|
}
|
|
546
|
-
var
|
|
547
|
+
var Kt = { exports: {} }, _r = function() {
|
|
547
548
|
var t = this, r = -1;
|
|
548
549
|
return {
|
|
549
550
|
next: function() {
|
|
@@ -583,9 +584,9 @@ var d = {
|
|
|
583
584
|
isFunction: function(t) {
|
|
584
585
|
return typeof t == "function";
|
|
585
586
|
}
|
|
586
|
-
}, Sr = d, $r = Sr.isFunction,
|
|
587
|
+
}, Sr = d, $r = Sr.isFunction, Ut = function(t) {
|
|
587
588
|
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;
|
|
588
|
-
}, jr =
|
|
589
|
+
}, jr = Ut, Er = jr;
|
|
589
590
|
function z(e) {
|
|
590
591
|
"@babel/helpers - typeof";
|
|
591
592
|
return z = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(t) {
|
|
@@ -603,8 +604,8 @@ var Ir = function(t) {
|
|
|
603
604
|
} while (i < this.items.length);
|
|
604
605
|
else if (z(this.items) === "object") {
|
|
605
606
|
var u = Object.keys(this.items), a = function() {
|
|
606
|
-
var
|
|
607
|
-
|
|
607
|
+
var h = u.slice(i, i + t), v = new r.constructor({});
|
|
608
|
+
h.forEach(function(f) {
|
|
608
609
|
return v.put(f, r.items[f]);
|
|
609
610
|
}), n.push(v), i += t;
|
|
610
611
|
};
|
|
@@ -655,13 +656,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
655
656
|
}
|
|
656
657
|
function xr(e, t) {
|
|
657
658
|
if (e) {
|
|
658
|
-
if (typeof e == "string") return
|
|
659
|
+
if (typeof e == "string") return pt(e, t);
|
|
659
660
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
660
661
|
if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set") return Array.from(e);
|
|
661
|
-
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return
|
|
662
|
+
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return pt(e, t);
|
|
662
663
|
}
|
|
663
664
|
}
|
|
664
|
-
function
|
|
665
|
+
function pt(e, t) {
|
|
665
666
|
(t == null || t > e.length) && (t = e.length);
|
|
666
667
|
for (var r = 0, n = new Array(t); r < t; r++)
|
|
667
668
|
n[r] = e[r];
|
|
@@ -744,7 +745,7 @@ function Y(e, t) {
|
|
|
744
745
|
n[r] = e[r];
|
|
745
746
|
return n;
|
|
746
747
|
}
|
|
747
|
-
var
|
|
748
|
+
var Wt = function(t) {
|
|
748
749
|
var r;
|
|
749
750
|
if (Array.isArray(t)) {
|
|
750
751
|
var n;
|
|
@@ -763,7 +764,7 @@ function q(e) {
|
|
|
763
764
|
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
764
765
|
}, q(e);
|
|
765
766
|
}
|
|
766
|
-
var Hr =
|
|
767
|
+
var Hr = Wt, Gr = function(t) {
|
|
767
768
|
var r = t;
|
|
768
769
|
t instanceof this.constructor ? r = t.all() : q(t) === "object" && (r = [], Object.keys(t).forEach(function(i) {
|
|
769
770
|
r.push(t[i]);
|
|
@@ -775,7 +776,7 @@ var Hr = Rt, Gr = function(t) {
|
|
|
775
776
|
}) : n.push(i);
|
|
776
777
|
}), new this.constructor(n);
|
|
777
778
|
};
|
|
778
|
-
function
|
|
779
|
+
function yt(e) {
|
|
779
780
|
return Yr(e) || Xr(e) || zr(e) || Qr();
|
|
780
781
|
}
|
|
781
782
|
function Qr() {
|
|
@@ -804,7 +805,7 @@ function Z(e, t) {
|
|
|
804
805
|
}
|
|
805
806
|
var $ = function(t) {
|
|
806
807
|
var r = [];
|
|
807
|
-
return Array.isArray(t) ? r.push.apply(r,
|
|
808
|
+
return Array.isArray(t) ? r.push.apply(r, yt(t)) : t.constructor.name === "Collection" ? r.push.apply(r, yt(t.all())) : Object.keys(t).forEach(function(n) {
|
|
808
809
|
return r.push(t[n]);
|
|
809
810
|
}), r;
|
|
810
811
|
};
|
|
@@ -835,7 +836,7 @@ function k(e, t) {
|
|
|
835
836
|
n[r] = e[r];
|
|
836
837
|
return n;
|
|
837
838
|
}
|
|
838
|
-
var ne = $, ie = d, se = ie.isFunction,
|
|
839
|
+
var ne = $, ie = d, se = ie.isFunction, Rt = function(t, r) {
|
|
839
840
|
if (r !== void 0)
|
|
840
841
|
return Array.isArray(this.items) ? this.items.filter(function(i) {
|
|
841
842
|
return i[t] !== void 0 && i[t] === r;
|
|
@@ -864,9 +865,9 @@ var ne = $, ie = d, se = ie.isFunction, Jt = function(t, r) {
|
|
|
864
865
|
function t(s, o, u) {
|
|
865
866
|
var a = u[0];
|
|
866
867
|
a instanceof o && (a = a.all());
|
|
867
|
-
for (var c = u.slice(1),
|
|
868
|
+
for (var c = u.slice(1), h = !c.length, v = [], f = 0; f < a.length; f += 1) {
|
|
868
869
|
var m = s.slice();
|
|
869
|
-
m.push(a[f]),
|
|
870
|
+
m.push(a[f]), h ? v.push(m) : v = v.concat(t(m, o, c));
|
|
870
871
|
}
|
|
871
872
|
return v;
|
|
872
873
|
}
|
|
@@ -998,7 +999,7 @@ function rt(e) {
|
|
|
998
999
|
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
999
1000
|
}, rt(e);
|
|
1000
1001
|
}
|
|
1001
|
-
function
|
|
1002
|
+
function Jt(e) {
|
|
1002
1003
|
if (Array.isArray(e)) {
|
|
1003
1004
|
if (e.length)
|
|
1004
1005
|
return !1;
|
|
@@ -1012,7 +1013,7 @@ function Mt(e) {
|
|
|
1012
1013
|
function Ce(e, t) {
|
|
1013
1014
|
var r = {};
|
|
1014
1015
|
return Object.keys(t).forEach(function(n) {
|
|
1015
|
-
e ? e(t[n], n) && (r[n] = t[n]) :
|
|
1016
|
+
e ? e(t[n], n) && (r[n] = t[n]) : Jt(t[n]) || (r[n] = t[n]);
|
|
1016
1017
|
}), r;
|
|
1017
1018
|
}
|
|
1018
1019
|
function Te(e, t) {
|
|
@@ -1020,7 +1021,7 @@ function Te(e, t) {
|
|
|
1020
1021
|
return t.filter(e);
|
|
1021
1022
|
for (var r = [], n = 0; n < t.length; n += 1) {
|
|
1022
1023
|
var i = t[n];
|
|
1023
|
-
|
|
1024
|
+
Jt(i) || r.push(i);
|
|
1024
1025
|
}
|
|
1025
1026
|
return r;
|
|
1026
1027
|
}
|
|
@@ -1056,7 +1057,7 @@ var Pe = function(t) {
|
|
|
1056
1057
|
return this.where(t, r, n).first() || null;
|
|
1057
1058
|
}, Ke = function(t) {
|
|
1058
1059
|
return this.map(t).collapse();
|
|
1059
|
-
},
|
|
1060
|
+
}, Mt = d, M = Mt.isArray, V = Mt.isObject, Ue = function(t) {
|
|
1060
1061
|
var r = t || 1 / 0, n = !1, i = [], s = function(u) {
|
|
1061
1062
|
i = [], M(u) ? u.forEach(function(a) {
|
|
1062
1063
|
M(a) ? i = i.concat(a) : V(a) ? Object.keys(a).forEach(function(c) {
|
|
@@ -1153,10 +1154,10 @@ var Pe = function(t) {
|
|
|
1153
1154
|
}, un = function() {
|
|
1154
1155
|
var t = Object.keys(this.items);
|
|
1155
1156
|
return Array.isArray(this.items) && (t = t.map(Number)), new this.constructor(t);
|
|
1156
|
-
}, cn = d,
|
|
1157
|
+
}, cn = d, mt = cn.isFunction, fn = function(t, r) {
|
|
1157
1158
|
var n = this.items;
|
|
1158
|
-
if (
|
|
1159
|
-
return
|
|
1159
|
+
if (mt(t) && (n = this.filter(t).all()), Array.isArray(n) && !n.length || !Object.keys(n).length)
|
|
1160
|
+
return mt(r) ? r() : r;
|
|
1160
1161
|
if (Array.isArray(n))
|
|
1161
1162
|
return n[n.length - 1];
|
|
1162
1163
|
var i = Object.keys(n);
|
|
@@ -1216,13 +1217,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1216
1217
|
}
|
|
1217
1218
|
function _n(e, t) {
|
|
1218
1219
|
if (e) {
|
|
1219
|
-
if (typeof e == "string") return
|
|
1220
|
+
if (typeof e == "string") return dt(e, t);
|
|
1220
1221
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
1221
1222
|
if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set") return Array.from(e);
|
|
1222
|
-
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return
|
|
1223
|
+
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return dt(e, t);
|
|
1223
1224
|
}
|
|
1224
1225
|
}
|
|
1225
|
-
function
|
|
1226
|
+
function dt(e, t) {
|
|
1226
1227
|
(t == null || t > e.length) && (t = e.length);
|
|
1227
1228
|
for (var r = 0, n = new Array(t); r < t; r++)
|
|
1228
1229
|
n[r] = e[r];
|
|
@@ -1270,13 +1271,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1270
1271
|
}
|
|
1271
1272
|
function Cn(e, t) {
|
|
1272
1273
|
if (e) {
|
|
1273
|
-
if (typeof e == "string") return
|
|
1274
|
+
if (typeof e == "string") return vt(e, t);
|
|
1274
1275
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
1275
1276
|
if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set") return Array.from(e);
|
|
1276
|
-
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return
|
|
1277
|
+
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return vt(e, t);
|
|
1277
1278
|
}
|
|
1278
1279
|
}
|
|
1279
|
-
function
|
|
1280
|
+
function vt(e, t) {
|
|
1280
1281
|
(t == null || t > e.length) && (t = e.length);
|
|
1281
1282
|
for (var r = 0, n = new Array(t); r < t; r++)
|
|
1282
1283
|
n[r] = e[r];
|
|
@@ -1311,7 +1312,7 @@ var Fn = function(t) {
|
|
|
1311
1312
|
r[u] === void 0 ? r[u] = [a] : r[u].push(a);
|
|
1312
1313
|
}), new this.constructor(r);
|
|
1313
1314
|
};
|
|
1314
|
-
function
|
|
1315
|
+
function bt(e, t) {
|
|
1315
1316
|
return qn(e) || Bn(e, t) || Nn(e, t) || Dn();
|
|
1316
1317
|
}
|
|
1317
1318
|
function Dn() {
|
|
@@ -1320,13 +1321,13 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
1320
1321
|
}
|
|
1321
1322
|
function Nn(e, t) {
|
|
1322
1323
|
if (e) {
|
|
1323
|
-
if (typeof e == "string") return
|
|
1324
|
+
if (typeof e == "string") return gt(e, t);
|
|
1324
1325
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
1325
1326
|
if (r === "Object" && e.constructor && (r = e.constructor.name), r === "Map" || r === "Set") return Array.from(e);
|
|
1326
|
-
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return
|
|
1327
|
+
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return gt(e, t);
|
|
1327
1328
|
}
|
|
1328
1329
|
}
|
|
1329
|
-
function
|
|
1330
|
+
function gt(e, t) {
|
|
1330
1331
|
(t == null || t > e.length) && (t = e.length);
|
|
1331
1332
|
for (var r = 0, n = new Array(t); r < t; r++)
|
|
1332
1333
|
n[r] = e[r];
|
|
@@ -1357,14 +1358,14 @@ function qn(e) {
|
|
|
1357
1358
|
var xn = function(t) {
|
|
1358
1359
|
var r = this, n = {};
|
|
1359
1360
|
return Array.isArray(this.items) ? this.items.forEach(function(i, s) {
|
|
1360
|
-
var o = t(i, s), u =
|
|
1361
|
+
var o = t(i, s), u = bt(o, 2), a = u[0], c = u[1];
|
|
1361
1362
|
n[a] = c;
|
|
1362
1363
|
}) : Object.keys(this.items).forEach(function(i) {
|
|
1363
|
-
var s = t(r.items[i], i), o =
|
|
1364
|
+
var s = t(r.items[i], i), o = bt(s, 2), u = o[0], a = o[1];
|
|
1364
1365
|
n[u] = a;
|
|
1365
1366
|
}), new this.constructor(n);
|
|
1366
1367
|
};
|
|
1367
|
-
function
|
|
1368
|
+
function wt(e) {
|
|
1368
1369
|
return Rn(e) || Wn(e) || Un(e) || Kn();
|
|
1369
1370
|
}
|
|
1370
1371
|
function Kn() {
|
|
@@ -1396,11 +1397,11 @@ var Jn = function(t) {
|
|
|
1396
1397
|
var r = this.items.filter(function(n) {
|
|
1397
1398
|
return n[t] !== void 0;
|
|
1398
1399
|
});
|
|
1399
|
-
return Math.max.apply(Math,
|
|
1400
|
+
return Math.max.apply(Math, wt(r.map(function(n) {
|
|
1400
1401
|
return n[t];
|
|
1401
1402
|
})));
|
|
1402
1403
|
}
|
|
1403
|
-
return Math.max.apply(Math,
|
|
1404
|
+
return Math.max.apply(Math, wt(this.items));
|
|
1404
1405
|
}, Mn = function(t) {
|
|
1405
1406
|
var r = this.items.length;
|
|
1406
1407
|
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];
|
|
@@ -1421,7 +1422,7 @@ function K(e) {
|
|
|
1421
1422
|
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1422
1423
|
}, K(e);
|
|
1423
1424
|
}
|
|
1424
|
-
function
|
|
1425
|
+
function At(e, t) {
|
|
1425
1426
|
var r = Object.keys(e);
|
|
1426
1427
|
if (Object.getOwnPropertySymbols) {
|
|
1427
1428
|
var n = Object.getOwnPropertySymbols(e);
|
|
@@ -1431,12 +1432,12 @@ function _t(e, t) {
|
|
|
1431
1432
|
}
|
|
1432
1433
|
return r;
|
|
1433
1434
|
}
|
|
1434
|
-
function
|
|
1435
|
+
function _t(e) {
|
|
1435
1436
|
for (var t = 1; t < arguments.length; t++) {
|
|
1436
1437
|
var r = arguments[t] != null ? arguments[t] : {};
|
|
1437
|
-
t % 2 ?
|
|
1438
|
+
t % 2 ? At(Object(r), !0).forEach(function(n) {
|
|
1438
1439
|
Ln(e, n, r[n]);
|
|
1439
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
1440
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : At(Object(r)).forEach(function(n) {
|
|
1440
1441
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
1441
1442
|
});
|
|
1442
1443
|
}
|
|
@@ -1447,14 +1448,14 @@ function Ln(e, t, r) {
|
|
|
1447
1448
|
}
|
|
1448
1449
|
var Hn = function(t) {
|
|
1449
1450
|
var r = function n(i, s) {
|
|
1450
|
-
var o = {}, u = Object.keys(
|
|
1451
|
+
var o = {}, u = Object.keys(_t(_t({}, i), s));
|
|
1451
1452
|
return u.forEach(function(a) {
|
|
1452
1453
|
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]) && K(i[a]) === "object" && !Array.isArray(s[a]) && K(s[a]) === "object" ? o[a] = n(i[a], s[a]) : o[a] = [].concat(i[a], s[a]));
|
|
1453
1454
|
}), o;
|
|
1454
1455
|
};
|
|
1455
1456
|
return t ? t.constructor.name === "Collection" ? new this.constructor(r(this.items, t.all())) : new this.constructor(r(this.items, t)) : this;
|
|
1456
1457
|
};
|
|
1457
|
-
function
|
|
1458
|
+
function Ot(e) {
|
|
1458
1459
|
return Xn(e) || zn(e) || Qn(e) || Gn();
|
|
1459
1460
|
}
|
|
1460
1461
|
function Gn() {
|
|
@@ -1486,11 +1487,11 @@ var Yn = function(t) {
|
|
|
1486
1487
|
var r = this.items.filter(function(n) {
|
|
1487
1488
|
return n[t] !== void 0;
|
|
1488
1489
|
});
|
|
1489
|
-
return Math.min.apply(Math,
|
|
1490
|
+
return Math.min.apply(Math, Ot(r.map(function(n) {
|
|
1490
1491
|
return n[t];
|
|
1491
1492
|
})));
|
|
1492
1493
|
}
|
|
1493
|
-
return Math.min.apply(Math,
|
|
1494
|
+
return Math.min.apply(Math, Ot(this.items));
|
|
1494
1495
|
}, Zn = function(t) {
|
|
1495
1496
|
var r = [], n = 1;
|
|
1496
1497
|
return this.items.length ? (this.items.forEach(function(i) {
|
|
@@ -1534,7 +1535,7 @@ var Yn = function(t) {
|
|
|
1534
1535
|
return Object.keys(this.items).forEach(function(a) {
|
|
1535
1536
|
s.indexOf(a) !== -1 && (u[a] = t.items[a]);
|
|
1536
1537
|
}), new this.constructor(u);
|
|
1537
|
-
}, ni =
|
|
1538
|
+
}, ni = Wt, ii = function(t, r) {
|
|
1538
1539
|
var n = Math.abs(t), i = this.count();
|
|
1539
1540
|
if (n <= i)
|
|
1540
1541
|
return this;
|
|
@@ -1551,7 +1552,7 @@ var Yn = function(t) {
|
|
|
1551
1552
|
})), new this.constructor(n);
|
|
1552
1553
|
}, oi = function(t) {
|
|
1553
1554
|
return t(this);
|
|
1554
|
-
},
|
|
1555
|
+
}, Vt = d, ai = Vt.isArray, ui = Vt.isObject, F = j, ci = function(t) {
|
|
1555
1556
|
var r = {};
|
|
1556
1557
|
return t.forEach(function(n, i) {
|
|
1557
1558
|
function s(o, u) {
|
|
@@ -1584,10 +1585,10 @@ var Yn = function(t) {
|
|
|
1584
1585
|
g.split(".").length === c && u.push(n[g]);
|
|
1585
1586
|
}
|
|
1586
1587
|
}), r !== void 0) {
|
|
1587
|
-
var
|
|
1588
|
+
var h = {};
|
|
1588
1589
|
return this.items.forEach(function(f, m) {
|
|
1589
|
-
|
|
1590
|
-
}), new this.constructor(
|
|
1590
|
+
h[i[m] || ""] = u;
|
|
1591
|
+
}), new this.constructor(h);
|
|
1591
1592
|
}
|
|
1592
1593
|
return new this.constructor([u]);
|
|
1593
1594
|
}
|
|
@@ -1600,13 +1601,13 @@ var Yn = function(t) {
|
|
|
1600
1601
|
return this.map(function(f) {
|
|
1601
1602
|
return F(f, t) !== void 0 ? F(f, t) : null;
|
|
1602
1603
|
});
|
|
1603
|
-
}, li = U,
|
|
1604
|
+
}, li = U, Lt = function(t) {
|
|
1604
1605
|
for (var r = arguments.length, n = new Array(r > 1 ? r - 1 : 0), i = 1; i < r; i++)
|
|
1605
1606
|
n[i - 1] = arguments[i];
|
|
1606
1607
|
li(n).forEach(function(s) {
|
|
1607
1608
|
delete t[s];
|
|
1608
1609
|
});
|
|
1609
|
-
},
|
|
1610
|
+
}, Ht = d, hi = Ht.isArray, pi = Ht.isObject, St = Lt, yi = function() {
|
|
1610
1611
|
var t = this, r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1;
|
|
1611
1612
|
if (this.isEmpty())
|
|
1612
1613
|
return null;
|
|
@@ -1616,12 +1617,12 @@ var Yn = function(t) {
|
|
|
1616
1617
|
var n = Object.keys(this.items);
|
|
1617
1618
|
if (r === 1) {
|
|
1618
1619
|
var i = n[n.length - 1], s = this.items[i];
|
|
1619
|
-
return
|
|
1620
|
+
return St(this.items, i), s;
|
|
1620
1621
|
}
|
|
1621
1622
|
var o = n.slice(-r), u = o.reduce(function(a, c) {
|
|
1622
1623
|
return a[c] = t.items[c], a;
|
|
1623
1624
|
}, {});
|
|
1624
|
-
return
|
|
1625
|
+
return St(this.items, o), new this.constructor(u);
|
|
1625
1626
|
}
|
|
1626
1627
|
return null;
|
|
1627
1628
|
}, mi = function(t, r) {
|
|
@@ -1649,7 +1650,7 @@ var Yn = function(t) {
|
|
|
1649
1650
|
return !t(r);
|
|
1650
1651
|
});
|
|
1651
1652
|
};
|
|
1652
|
-
function
|
|
1653
|
+
function $t(e, t) {
|
|
1653
1654
|
var r = Object.keys(e);
|
|
1654
1655
|
if (Object.getOwnPropertySymbols) {
|
|
1655
1656
|
var n = Object.getOwnPropertySymbols(e);
|
|
@@ -1662,9 +1663,9 @@ function jt(e, t) {
|
|
|
1662
1663
|
function D(e) {
|
|
1663
1664
|
for (var t = 1; t < arguments.length; t++) {
|
|
1664
1665
|
var r = arguments[t] != null ? arguments[t] : {};
|
|
1665
|
-
t % 2 ?
|
|
1666
|
+
t % 2 ? $t(Object(r), !0).forEach(function(n) {
|
|
1666
1667
|
$i(e, n, r[n]);
|
|
1667
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
1668
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : $t(Object(r)).forEach(function(n) {
|
|
1668
1669
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
1669
1670
|
});
|
|
1670
1671
|
}
|
|
@@ -1697,7 +1698,7 @@ function I(e) {
|
|
|
1697
1698
|
return t && typeof Symbol == "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
1698
1699
|
}, I(e);
|
|
1699
1700
|
}
|
|
1700
|
-
function
|
|
1701
|
+
function jt(e, t) {
|
|
1701
1702
|
var r = Object.keys(e);
|
|
1702
1703
|
if (Object.getOwnPropertySymbols) {
|
|
1703
1704
|
var n = Object.getOwnPropertySymbols(e);
|
|
@@ -1710,9 +1711,9 @@ function Et(e, t) {
|
|
|
1710
1711
|
function T(e) {
|
|
1711
1712
|
for (var t = 1; t < arguments.length; t++) {
|
|
1712
1713
|
var r = arguments[t] != null ? arguments[t] : {};
|
|
1713
|
-
t % 2 ?
|
|
1714
|
+
t % 2 ? jt(Object(r), !0).forEach(function(n) {
|
|
1714
1715
|
Ei(e, n, r[n]);
|
|
1715
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
1716
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : jt(Object(r)).forEach(function(n) {
|
|
1716
1717
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
1717
1718
|
});
|
|
1718
1719
|
}
|
|
@@ -1739,7 +1740,7 @@ var Ii = function(t) {
|
|
|
1739
1740
|
return Ti(this.items) ? i = this.items.findIndex(s) : Pi(this.items) && (i = Object.keys(this.items).find(function(o) {
|
|
1740
1741
|
return s(n.items[o], o);
|
|
1741
1742
|
})), i === void 0 || i < 0 ? !1 : i;
|
|
1742
|
-
},
|
|
1743
|
+
}, Gt = d, Ni = Gt.isArray, Bi = Gt.isObject, qi = Lt, xi = function() {
|
|
1743
1744
|
var t = this, r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1;
|
|
1744
1745
|
if (this.isEmpty())
|
|
1745
1746
|
return null;
|
|
@@ -1794,7 +1795,7 @@ var Ii = function(t) {
|
|
|
1794
1795
|
if (i.count() > 1)
|
|
1795
1796
|
throw new Error("Multiple items found.");
|
|
1796
1797
|
return i.first();
|
|
1797
|
-
}, rs =
|
|
1798
|
+
}, rs = Rt, es = rs, ns = function(t) {
|
|
1798
1799
|
var r = [].concat(this.items);
|
|
1799
1800
|
return t === void 0 ? this.every(function(n) {
|
|
1800
1801
|
return typeof n == "number";
|
|
@@ -1929,7 +1930,7 @@ var Ts = function() {
|
|
|
1929
1930
|
}
|
|
1930
1931
|
return this;
|
|
1931
1932
|
};
|
|
1932
|
-
function
|
|
1933
|
+
function Et(e, t) {
|
|
1933
1934
|
var r = Object.keys(e);
|
|
1934
1935
|
if (Object.getOwnPropertySymbols) {
|
|
1935
1936
|
var n = Object.getOwnPropertySymbols(e);
|
|
@@ -1939,12 +1940,12 @@ function It(e, t) {
|
|
|
1939
1940
|
}
|
|
1940
1941
|
return r;
|
|
1941
1942
|
}
|
|
1942
|
-
function
|
|
1943
|
+
function It(e) {
|
|
1943
1944
|
for (var t = 1; t < arguments.length; t++) {
|
|
1944
1945
|
var r = arguments[t] != null ? arguments[t] : {};
|
|
1945
|
-
t % 2 ?
|
|
1946
|
+
t % 2 ? Et(Object(r), !0).forEach(function(n) {
|
|
1946
1947
|
Fs(e, n, r[n]);
|
|
1947
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) :
|
|
1948
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : Et(Object(r)).forEach(function(n) {
|
|
1948
1949
|
Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(r, n));
|
|
1949
1950
|
});
|
|
1950
1951
|
}
|
|
@@ -1963,13 +1964,13 @@ var Ds = function() {
|
|
|
1963
1964
|
var i = r;
|
|
1964
1965
|
n.split(".").reduce(function(s, o, u, a) {
|
|
1965
1966
|
return s[o] || (s[o] = {}), u === a.length - 1 && (s[o] = t.items[n]), s[o];
|
|
1966
|
-
}, i), r =
|
|
1967
|
+
}, i), r = It(It({}, r), i);
|
|
1967
1968
|
} else
|
|
1968
1969
|
r[n] = t.items[n];
|
|
1969
1970
|
}), new this.constructor(r);
|
|
1970
1971
|
}, Ns = function(t, r, n) {
|
|
1971
1972
|
t ? n(this) : r(this);
|
|
1972
|
-
},
|
|
1973
|
+
}, Ct = function(t, r) {
|
|
1973
1974
|
if (Array.isArray(this.items) && this.items.length)
|
|
1974
1975
|
return t(this);
|
|
1975
1976
|
if (Object.keys(this.items).length)
|
|
@@ -1981,7 +1982,7 @@ var Ds = function() {
|
|
|
1981
1982
|
return r(this);
|
|
1982
1983
|
}
|
|
1983
1984
|
return this;
|
|
1984
|
-
},
|
|
1985
|
+
}, Tt = function(t, r) {
|
|
1985
1986
|
if (Array.isArray(this.items) && !this.items.length)
|
|
1986
1987
|
return t(this);
|
|
1987
1988
|
if (!Object.keys(this.items).length)
|
|
@@ -2063,9 +2064,9 @@ var Ds = function() {
|
|
|
2063
2064
|
return this.filter(function(r) {
|
|
2064
2065
|
return r instanceof t;
|
|
2065
2066
|
});
|
|
2066
|
-
},
|
|
2067
|
+
}, Pt = j, Xs = function(t, r) {
|
|
2067
2068
|
return this.filter(function(n) {
|
|
2068
|
-
return
|
|
2069
|
+
return Pt(n, t) < r[0] || Pt(n, t) > r[r.length - 1];
|
|
2069
2070
|
});
|
|
2070
2071
|
}, Ys = $, Zs = j, ks = function(t, r) {
|
|
2071
2072
|
var n = Ys(r), i = this.items.filter(function(s) {
|
|
@@ -2112,14 +2113,14 @@ var eo = function(t) {
|
|
|
2112
2113
|
var n = _r;
|
|
2113
2114
|
typeof Symbol < "u" && (r.prototype[Symbol.iterator] = n), r.prototype.toJSON = function() {
|
|
2114
2115
|
return this.items;
|
|
2115
|
-
}, r.prototype.all = Or, r.prototype.average =
|
|
2116
|
+
}, r.prototype.all = Or, r.prototype.average = Ut, r.prototype.avg = Er, r.prototype.chunk = Ir, r.prototype.collapse = Nr, r.prototype.combine = Wr, r.prototype.concat = Gr, r.prototype.contains = Rt, 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 = Pe, r.prototype.first = De, r.prototype.firstOrFail = qe, r.prototype.firstWhere = xe, r.prototype.flatMap = Ke, r.prototype.flatten = Ue, r.prototype.flip = We, r.prototype.forPage = Re, r.prototype.forget = Je, r.prototype.get = Le, 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 = Fn, r.prototype.mapWithKeys = xn, r.prototype.max = Jn, r.prototype.median = Mn, r.prototype.merge = Vn, r.prototype.mergeRecursive = Hn, 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 = Di, r.prototype.shift = xi, r.prototype.shuffle = Ui, r.prototype.skip = Ji, r.prototype.skipUntil = Hi, 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 = Ts, r.prototype.transform = Ps, r.prototype.undot = Ds, r.prototype.unless = Ns, r.prototype.unlessEmpty = Ct, r.prototype.unlessNotEmpty = Tt, r.prototype.union = Bs, r.prototype.unique = Ks, r.prototype.unwrap = Us, r.prototype.values = Rs, r.prototype.when = Js, r.prototype.whenEmpty = Tt, r.prototype.whenNotEmpty = Ct, r.prototype.where = Vs, r.prototype.whereBetween = Ls, 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;
|
|
2116
2117
|
var i = function(o) {
|
|
2117
2118
|
return new r(o);
|
|
2118
2119
|
};
|
|
2119
2120
|
e.exports = i, e.exports.collect = i, e.exports.default = i, e.exports.Collection = r;
|
|
2120
|
-
})(
|
|
2121
|
-
var io =
|
|
2122
|
-
const
|
|
2121
|
+
})(Kt);
|
|
2122
|
+
var io = Kt.exports;
|
|
2123
|
+
const Qt = /* @__PURE__ */ Ar(io), zt = [
|
|
2123
2124
|
"chunk",
|
|
2124
2125
|
"shuffle",
|
|
2125
2126
|
"splice",
|
|
@@ -2191,7 +2192,7 @@ S.prototype.clone = function() {
|
|
|
2191
2192
|
const e = Object.create(this);
|
|
2192
2193
|
return e.steps = [...this.steps], e;
|
|
2193
2194
|
};
|
|
2194
|
-
|
|
2195
|
+
Qt().macro("whereContains", function(e, t) {
|
|
2195
2196
|
return this.filter((r) => r[e].toLowerCase().includes(t.toLowerCase()));
|
|
2196
2197
|
});
|
|
2197
2198
|
S.prototype.fetchData = async function() {
|
|
@@ -2215,12 +2216,12 @@ S.prototype.fetchData = async function() {
|
|
|
2215
2216
|
let o = await O(this.axios, r);
|
|
2216
2217
|
for (const u of t)
|
|
2217
2218
|
o = o[u];
|
|
2218
|
-
return this.meta = o.meta,
|
|
2219
|
+
return this.meta = o.meta, Qt(o.data);
|
|
2219
2220
|
};
|
|
2220
2221
|
S.prototype.processData = async function() {
|
|
2221
2222
|
let e = null;
|
|
2222
2223
|
for (const t of this.steps) {
|
|
2223
|
-
if (
|
|
2224
|
+
if (zt.includes(t.type)) {
|
|
2224
2225
|
e || (e = await this.fetchData()), e = e[t.type](...t.args);
|
|
2225
2226
|
continue;
|
|
2226
2227
|
}
|
|
@@ -2239,7 +2240,7 @@ S.prototype.processData = async function() {
|
|
|
2239
2240
|
S.prototype.all = async function() {
|
|
2240
2241
|
return (await this.processData()).all();
|
|
2241
2242
|
};
|
|
2242
|
-
for (const e of [...
|
|
2243
|
+
for (const e of [...zt, ...so])
|
|
2243
2244
|
S.prototype[e] = function(...t) {
|
|
2244
2245
|
const r = this.clone();
|
|
2245
2246
|
return r.steps.push({ type: e, args: t }), r;
|
|
@@ -2253,14 +2254,14 @@ S.prototype.first = async function() {
|
|
|
2253
2254
|
return this.take(1), (await this.processData()).first();
|
|
2254
2255
|
};
|
|
2255
2256
|
const lo = (e) => {
|
|
2256
|
-
const t =
|
|
2257
|
+
const t = Zt.create({
|
|
2257
2258
|
baseURL: e,
|
|
2258
2259
|
withCredentials: !0
|
|
2259
|
-
}), r = (s, o = null, u = []) => y(t, s, o, u), n = (s) => O(t, s), i = gr();
|
|
2260
|
+
}), r = (s, o = null, u = []) => y(t, s, o, u), n = (s) => O(t, s), i = gr(t);
|
|
2260
2261
|
return {
|
|
2261
2262
|
baseURL: e,
|
|
2262
2263
|
axios: t,
|
|
2263
|
-
auth:
|
|
2264
|
+
auth: fr(t),
|
|
2264
2265
|
mutation: r,
|
|
2265
2266
|
query: n,
|
|
2266
2267
|
config: dr(n),
|
|
@@ -2269,11 +2270,11 @@ const lo = (e) => {
|
|
|
2269
2270
|
fs: mr(t),
|
|
2270
2271
|
models: i,
|
|
2271
2272
|
model(s) {
|
|
2272
|
-
return
|
|
2273
|
+
return i.get(s);
|
|
2273
2274
|
},
|
|
2274
2275
|
roles: wr(t),
|
|
2275
2276
|
collect: (s, o) => {
|
|
2276
|
-
const u =
|
|
2277
|
+
const u = i.get(s).getDataPath();
|
|
2277
2278
|
return new S(u, o, t);
|
|
2278
2279
|
}
|
|
2279
2280
|
};
|
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,P){"use strict";var ao=Object.defineProperty;var uo=(g,w,P)=>w in g?ao(g,w,{enumerable:!0,configurable:!0,writable:!0,value:P}):g[w]=P;var S=(g,w,P)=>uo(g,typeof w!="symbol"?w+"":w,P);function mt(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 dt(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 c="copy",_="convert";function F(e,t,r){if(t===c)return r;if(t===_)return e(r);if(t instanceof Array)return r.map(n=>F(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]=F(e,s.schema,r[i])}return n}}function V(e,t){return{required:!0,schema:e,derive:t}}function h(e){return{required:!0,schema:e}}function v(e){return{required:!1,schema:e}}var vt={type:h(c),id:h(_),transports:v(c)},bt={appid:v(c),appidExclude:v(c),credProps:v(c)},gt={appid:v(c),appidExclude:v(c),credProps:v(c)},Zt={publicKey:h({rp:h(c),user:h({id:h(_),name:h(c),displayName:h(c)}),challenge:h(_),pubKeyCredParams:h(c),timeout:v(c),excludeCredentials:v([vt]),authenticatorSelection:v(c),attestation:v(c),extensions:v(bt)}),signal:v(c)},kt={type:h(c),id:h(c),rawId:h(_),authenticatorAttachment:v(c),response:h({clientDataJSON:h(_),attestationObject:h(_),transports:V(c,e=>{var t;return((t=e.getTransports)==null?void 0:t.call(e))||[]})}),clientExtensionResults:V(gt,e=>e.getClientExtensionResults())},tr={mediation:v(c),publicKey:h({challenge:h(_),timeout:v(c),rpId:v(c),allowCredentials:v([vt]),userVerification:v(c),extensions:v(bt)}),signal:v(c)},rr={type:h(c),id:h(c),rawId:h(_),authenticatorAttachment:v(c),response:h({clientDataJSON:h(_),authenticatorData:h(_),signature:h(_),userHandle:h(_)}),clientExtensionResults:V(gt,e=>e.getClientExtensionResults())};function er(e){return F(mt,Zt,e)}function nr(e){return F(dt,kt,e)}function ir(e){return F(mt,tr,e)}function sr(e){return F(dt,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 n=(await O(e,{webAuthnRequestOptions:{__args:{username:t}}})).webAuthnRequestOptions,i=ir({publicKey:n}),s=await ar(i);await p(e,"webAuthnAssertion",{username:t,assertion:s.toJSON()})},register:async()=>{const t=await O(e,{webAuthnCreationOptions:!0}),r=er({publicKey:t.webAuthnCreationOptions}),n=await or(r);await p(e,"webAuthnRegister",{registration:n.toJSON()})}}),fr=e=>({WebAuthn:ur(e),facebookLogin:t=>p(e,"facebookLogin",{access_token:t}),microsoftLogin:t=>p(e,"microsoftLogin",{access_token:t}),googleLogin:t=>p(e,"googleLogin",{credential:t}),login:(t,r,n="")=>p(e,"login",{username:t,password:r,code:n}),logout:()=>p(e,"logout"),changeExpiredPassword:(t,r,n)=>p(e,"changeExpiredPassword",{username:t,old_password:r,new_password:n}),updatePassword:(t,r)=>p(e,"updatePassword",{old_password:t,new_password:r}),resetPassword:(t,r,n)=>p(e,"resetPassword",{username:t,password:r,code:n}),forgetPassword:(t,r)=>p(e,"forgetPassword",{username:t,email:r}),verifyCode(t,r){return p(e,"forgetPasswordVerifyCode",{username:t,code:r})},granted:async t=>(await O(e,{granted:{__args:{rights:t}}})).granted}),wt=(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 f=[];for(const y of a)if(typeof y=="string"){const b=u(y);b&&f.push(b.getGQLField())}else typeof y=="object"&&f.push(y);return f},async update(a,f){return await p(i,"update"+n,{id:a,data:f})},async delete(a){return await p(i,"delete"+n,{id:a})},async add(a){return await p(i,"add"+n,{data:a})},fields(a){let f=[];for(let y of a){const b=u(y);b&&f.push(b)}return f},async get(a,f){return(await O(i,{["list"+n]:{__args:{filters:a},data:{__args:{limit:1},...B(f)}}}))["list"+n].data[0]},async list(a,f){return(await O(i,{["list"+n]:{__args:{filters:a},data:{...B(f)}}}))["list"+n].data}}};function cr(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,f){for(var y=f;y>0;y--)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")}}},lr={fromBase85:e=>q(cr(e)),fromBase64:e=>q(atob(e)),fromString:e=>q(e)},L=e=>{let t={};return typeof e=="string"?(t[e]=!0,t):e instanceof Array?(e.forEach(r=>{Object.entries(L(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]=L(n)}),t)},B=e=>L(e),O=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 pr(e){for(let t in e)if(e[t]instanceof File)return!0;return!1}const p=async(e,t,r=null,n=[])=>{let i={[t]:{}};const s=new FormData;let o=!1;if(r){const f={},y={},b={};let l=0;Object.entries(r).forEach(([m,A])=>{if(A instanceof Array&&hr(A)){o=!0;let T=0;A.forEach(N=>{N instanceof File&&(f[m]=new w.VariableType(m),y[l]=["variables."+m+"."+T],s.append(l.toString(),N),l++)}),b[m]="[Upload!]!"}else A instanceof File?(o=!0,f[m]=new w.VariableType(m),y[l]=["variables."+m],s.append(l.toString(),A),b[m]="Upload!",l++):A instanceof Object&&pr(A)?(o=!0,f[m]={},Object.entries(A).forEach(([T,N])=>{N instanceof File?(f[m][T]=new w.VariableType(T),y[l]=["variables."+T],s.append(l.toString(),N),b[T]="Upload!",l++):f[m][T]=N})):A!==void 0&&(f[m]=A)}),i[t].__args=f,i.__variables=b,o&&s.append("map",JSON.stringify(y))}Object.entries(B(n)).forEach(([f,y])=>{i[t][f]=y}),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]},yr=e=>({uploadTempFile:t=>p(e,"fsUploadTempFile",{file:t},{name:!0,path:!0,size:!0,mime:!0}),folders:{list:async t=>(await O(e,{fsListFolders:{__args:{path:t},name:!0,path:!0}})).fsListFolders,create:t=>p(e,"fsCreateFolder",{path:t}),delete:t=>p(e,"fsDeleteFolder",{path:t}),rename:(t,r)=>p(e,"fsRenameFolder",{path:t,name:r})},files:{list:async t=>(await O(e,{fsListFiles:{__args:{path:t},name:!0,path:!0,size:!0,mime:!0,canPreview:!0,imagePath:!0}})).fsListFiles,read:async t=>{let r=await O(e,{fsFile:{__args:{path:t},base64Content:!0}});return window.atob(r.fsFile.base64Content)},write:(t,r)=>p(e,"fsWriteFile",{path:t,content:r}),delete:t=>p(e,"fsDeleteFile",{path:t}),rename:(t,r)=>p(e,"fsRenameFile",{path:t,name:r}),move:(t,r)=>p(e,"fsMoveFile",{source:t,target:r})}}),mr=e=>({get:async t=>(await e({config:{__args:{name:t}}})).config}),dr=e=>({send:(t,r,n)=>p(e,"sendMail",{email:t,subject:r,message:n})}),vr=e=>({list:async()=>(await O(e,{listUser:{data:{user_id:!0,username:!0,first_name:!0,last_name:!0,status:!0}}})).listUser.data}),br=()=>{const e={};return{create(t,r){e[t]={};for(const n of Object.entries(r)){const[i,s]=n;e[t][i]=()=>({name:s.name?s.name:i,raw:s,getName:()=>s.name?s.name:i,getGQLField:()=>s.gqlField!==void 0?s.gqlField:s.name||i,getRaw(){return s},getValue(o){return s.field&&typeof s.field=="function"?s.field(o):s.field&&typeof s.field=="string"?o[s.field]:o[this.getName()]},getFormattedValue(o){const u=this.getValue(o);return s.format?s.format(u):u}})}return e[t]},get(t){return e[t]}}},gr=e=>({list:async()=>(await O(e,{listRole:{name:!0}})).listRole});function wr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var At={exports:{}},Ar=function(){var t=this,r=-1;return{next:function(){return r+=1,{value:t.items[r],done:r>=t.items.length}}}},_r=function(){return this.items};function H(e){"@babel/helpers - typeof";return H=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},H(e)}var d={isArray:function(t){return Array.isArray(t)},isObject:function(t){return H(t)==="object"&&Array.isArray(t)===!1&&t!==null},isFunction:function(t){return typeof t=="function"}},Or=d,Sr=Or.isFunction,_t=function(t){return t===void 0?this.sum()/this.items.length:Sr(t)?new this.constructor(this.items).sum(t)/this.items.length:new this.constructor(this.items).pluck(t).sum()/this.items.length},$r=_t,jr=$r;function Q(e){"@babel/helpers - typeof";return Q=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},Q(e)}var Er=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(Q(this.items)==="object"){var u=Object.keys(this.items),a=function(){var y=u.slice(i,i+t),b=new r.constructor({});y.forEach(function(l){return b.put(l,r.items[l])}),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 Ir(e){return Fr(e)||Pr(e)||Tr(e)||Cr()}function Cr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
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,P){"use strict";var ao=Object.defineProperty;var uo=(g,w,P)=>w in g?ao(g,w,{enumerable:!0,configurable:!0,writable:!0,value:P}):g[w]=P;var S=(g,w,P)=>uo(g,typeof w!="symbol"?w+"":w,P);function mt(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 dt(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 c="copy",_="convert";function F(e,t,r){if(t===c)return r;if(t===_)return e(r);if(t instanceof Array)return r.map(n=>F(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]=F(e,s.schema,r[i])}return n}}function V(e,t){return{required:!0,schema:e,derive:t}}function p(e){return{required:!0,schema:e}}function v(e){return{required:!1,schema:e}}var vt={type:p(c),id:p(_),transports:v(c)},bt={appid:v(c),appidExclude:v(c),credProps:v(c)},gt={appid:v(c),appidExclude:v(c),credProps:v(c)},Yt={publicKey:p({rp:p(c),user:p({id:p(_),name:p(c),displayName:p(c)}),challenge:p(_),pubKeyCredParams:p(c),timeout:v(c),excludeCredentials:v([vt]),authenticatorSelection:v(c),attestation:v(c),extensions:v(bt)}),signal:v(c)},Zt={type:p(c),id:p(c),rawId:p(_),authenticatorAttachment:v(c),response:p({clientDataJSON:p(_),attestationObject:p(_),transports:V(c,e=>{var t;return((t=e.getTransports)==null?void 0:t.call(e))||[]})}),clientExtensionResults:V(gt,e=>e.getClientExtensionResults())},kt={mediation:v(c),publicKey:p({challenge:p(_),timeout:v(c),rpId:v(c),allowCredentials:v([vt]),userVerification:v(c),extensions:v(bt)}),signal:v(c)},tr={type:p(c),id:p(c),rawId:p(_),authenticatorAttachment:v(c),response:p({clientDataJSON:p(_),authenticatorData:p(_),signature:p(_),userHandle:p(_)}),clientExtensionResults:V(gt,e=>e.getClientExtensionResults())};function rr(e){return F(mt,Yt,e)}function er(e){return F(dt,Zt,e)}function nr(e){return F(mt,kt,e)}function ir(e){return F(dt,tr,e)}async function sr(e){const t=await navigator.credentials.create(e);return t.toJSON=()=>er(t),t}async function or(e){const t=await navigator.credentials.get(e);return t.toJSON=()=>ir(t),t}const ar=e=>({login:async t=>{const n=(await O(e,{webAuthnRequestOptions:{__args:{username:t}}})).webAuthnRequestOptions,i=nr({publicKey:n}),s=await or(i);await y(e,"webAuthnAssertion",{username:t,assertion:s.toJSON()})},register:async()=>{const t=await O(e,{webAuthnCreationOptions:!0}),r=rr({publicKey:t.webAuthnCreationOptions}),n=await sr(r);await y(e,"webAuthnRegister",{registration:n.toJSON()})}}),ur=e=>({WebAuthn:ar(e),facebookLogin:t=>y(e,"facebookLogin",{access_token:t}),microsoftLogin:t=>y(e,"microsoftLogin",{access_token:t}),googleLogin:t=>y(e,"googleLogin",{credential:t}),login:(t,r,n="")=>y(e,"login",{username:t,password:r,code:n}),logout:()=>y(e,"logout"),changeExpiredPassword:(t,r,n)=>y(e,"changeExpiredPassword",{username:t,old_password:r,new_password:n}),updatePassword:(t,r)=>y(e,"updatePassword",{old_password:t,new_password:r}),resetPassword:(t,r,n)=>y(e,"resetPassword",{username:t,password:r,code:n}),forgetPassword:(t,r)=>y(e,"forgetPassword",{username:t,email:r}),verifyCode(t,r){return y(e,"forgetPasswordVerifyCode",{username:t,code:r})},granted:async t=>(await O(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 f=[];for(const h of a)if(typeof h=="string"){const b=u(h);b&&f.push(b.getGQLField())}else typeof h=="object"&&f.push(h);return f},async update(a,f){return await y(i,"update"+n,{id:a,data:f})},async delete(a){return await y(i,"delete"+n,{id:a})},async add(a){return await y(i,"add"+n,{data:a})},fields(a){let f=[];for(let h of a){const b=u(h);b&&f.push(b)}return f},async get(a,f){return(await O(i,{["list"+n]:{__args:{filters:a},data:{__args:{limit:1},...B(f)}}}))["list"+n].data[0]},async list(a,f){return(await O(i,{["list"+n]:{__args:{filters:a},data:{...B(f)}}}))["list"+n].data}}};function cr(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,f){for(var h=f;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")}}},lr={fromBase85:e=>q(cr(e)),fromBase64:e=>q(atob(e)),fromString:e=>q(e)},L=e=>{let t={};return typeof e=="string"?(t[e]=!0,t):e instanceof Array?(e.forEach(r=>{Object.entries(L(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]=L(n)}),t)},B=e=>L(e),O=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 pr(e){for(let t in e)if(e[t]instanceof File)return!0;return!1}const y=async(e,t,r=null,n=[])=>{let i={[t]:{}};const s=new FormData;let o=!1;if(r){const f={},h={},b={};let l=0;Object.entries(r).forEach(([m,A])=>{if(A instanceof Array&&hr(A)){o=!0;let T=0;A.forEach(N=>{N instanceof File&&(f[m]=new w.VariableType(m),h[l]=["variables."+m+"."+T],s.append(l.toString(),N),l++)}),b[m]="[Upload!]!"}else A instanceof File?(o=!0,f[m]=new w.VariableType(m),h[l]=["variables."+m],s.append(l.toString(),A),b[m]="Upload!",l++):A instanceof Object&&pr(A)?(o=!0,f[m]={},Object.entries(A).forEach(([T,N])=>{N instanceof File?(f[m][T]=new w.VariableType(T),h[l]=["variables."+T],s.append(l.toString(),N),b[T]="Upload!",l++):f[m][T]=N})):A!==void 0&&(f[m]=A)}),i[t].__args=f,i.__variables=b,o&&s.append("map",JSON.stringify(h))}Object.entries(B(n)).forEach(([f,h])=>{i[t][f]=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]},yr=e=>({uploadTempFile:t=>y(e,"fsUploadTempFile",{file:t},{name:!0,path:!0,size:!0,mime:!0}),folders:{list:async t=>(await O(e,{fsListFolders:{__args:{path:t},name:!0,path:!0}})).fsListFolders,create:t=>y(e,"fsCreateFolder",{path:t}),delete:t=>y(e,"fsDeleteFolder",{path:t}),rename:(t,r)=>y(e,"fsRenameFolder",{path:t,name:r})},files:{list:async t=>(await O(e,{fsListFiles:{__args:{path:t},name:!0,path:!0,size:!0,mime:!0,canPreview:!0,imagePath:!0}})).fsListFiles,read:async t=>{let r=await O(e,{fsFile:{__args:{path:t},base64Content:!0}});return window.atob(r.fsFile.base64Content)},write:(t,r)=>y(e,"fsWriteFile",{path:t,content:r}),delete:t=>y(e,"fsDeleteFile",{path:t}),rename:(t,r)=>y(e,"fsRenameFile",{path:t,name:r}),move:(t,r)=>y(e,"fsMoveFile",{source:t,target:r})}}),mr=e=>({get:async t=>(await e({config:{__args:{name:t}}})).config}),dr=e=>({send:(t,r,n)=>y(e,"sendMail",{email:t,subject:r,message:n})}),vr=e=>({list:async()=>(await O(e,{listUser:{data:{user_id:!0,username:!0,first_name:!0,last_name:!0,status:!0}}})).listUser.data}),br=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(f){return a.field&&typeof a.field=="function"?a.field(f):a.field&&typeof a.field=="string"?f[a.field]:f[this.getName()]},getFormattedValue(f){const h=this.getValue(f);return a.format?a.format(h):h}})}r[n]=fr(t,n,s)},get(n){return r[n]||this.create(n,{}),r[n]}}},gr=e=>({list:async()=>(await O(e,{listRole:{name:!0}})).listRole});function wr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wt={exports:{}},Ar=function(){var t=this,r=-1;return{next:function(){return r+=1,{value:t.items[r],done:r>=t.items.length}}}},_r=function(){return this.items};function H(e){"@babel/helpers - typeof";return H=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},H(e)}var d={isArray:function(t){return Array.isArray(t)},isObject:function(t){return H(t)==="object"&&Array.isArray(t)===!1&&t!==null},isFunction:function(t){return typeof t=="function"}},Or=d,Sr=Or.isFunction,At=function(t){return t===void 0?this.sum()/this.items.length:Sr(t)?new this.constructor(this.items).sum(t)/this.items.length:new this.constructor(this.items).pluck(t).sum()/this.items.length},$r=At,jr=$r;function Q(e){"@babel/helpers - typeof";return Q=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},Q(e)}var Er=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(Q(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(l){return b.put(l,r.items[l])}),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 Ir(e){return Fr(e)||Pr(e)||Tr(e)||Cr()}function Cr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tr(e,t){if(e){if(typeof e=="string")return G(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 G(e,t)}}function Pr(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Fr(e){if(Array.isArray(e))return G(e)}function G(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 Dr=function(){var t;return new this.constructor((t=[]).concat.apply(t,Ir(this.items)))};function Nr(e,t){return Kr(e)||xr(e,t)||qr(e,t)||Br()}function Br(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qr(e,t){if(e){if(typeof e=="string")return
|
|
4
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rr(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 Jr(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Vr(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
|
|
5
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gr(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 zr(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Xr(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
|
|
6
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function kr(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 te(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function re(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 ee=E,ne=d,ie=ne.isFunction
|
|
7
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function we(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 Ae(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function _e(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 Oe=function(t){return this.each(function(r,n){t.apply(void 0,be(r).concat([n]))}),this},Se=E,$e=function(t){var r=Se(this.items);return r.every(t)},W=function(t){return Array.isArray(t[0])?t[0]:t},je=W,Ee=function(){for(var t=this,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var s=je(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
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qr(e,t){if(e){if(typeof e=="string")return _t(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 _t(e,t)}}function _t(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 xr(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 Kr(e){if(Array.isArray(e))return e}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 Ur=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(x(this.items)==="object"&&x(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=Nr(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 Vr(e)||Jr(e)||Rr(e)||Mr()}function Mr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
4
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rr(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 Jr(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Vr(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 Ot=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 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)}var Lr=Ot,Hr=function(t){var r=t;t instanceof this.constructor?r=t.all():K(t)==="object"&&(r=[],Object.keys(t).forEach(function(i){r.push(t[i])}));var n=Lr(this.items);return r.forEach(function(i){K(i)==="object"?Object.keys(i).forEach(function(s){return n.push(i[s])}):n.push(i)}),new this.constructor(n)};function St(e){return Xr(e)||zr(e)||Gr(e)||Qr()}function Qr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
5
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Gr(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 zr(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Xr(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,St(t)):t.constructor.name==="Collection"?r.push.apply(r,St(t.all())):Object.keys(t).forEach(function(n){return r.push(t[n])}),r};function Yr(e){return re(e)||te(e)||kr(e)||Zr()}function Zr(){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 kr(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 te(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function re(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 ee=E,ne=d,ie=ne.isFunction,$t=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(ie(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=ee(this.items);return n.push.apply(n,Yr(Object.keys(this.items))),n.indexOf(t)!==-1},se=function(){return this.count()===1},oe=function(){var t=0;return Array.isArray(this.items)&&(t=this.items.length),Math.max(Object.keys(this.items).length,t)},ae=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()})},ue=function(){function t(s,o,u){var a=u[0];a instanceof o&&(a=a.all());for(var f=u.slice(1),h=!f.length,b=[],l=0;l<a.length;l+=1){var m=s.slice();m.push(a[l]),h?b.push(m):b=b.concat(t(m,o,f))}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)},ce=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)},le=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)},pe=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)},ye=function(t,r){return!this.contains(t,r)},me=function(){return console.log(this),this};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 de=function(){var t=this,r=[],n={},i=function(o){return Array.isArray(o)||U(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}):U(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)},ve=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 be(e){return _e(e)||Ae(e)||we(e)||ge()}function ge(){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 we(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 Ae(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function _e(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 Oe=function(t){return this.each(function(r,n){t.apply(void 0,be(r).concat([n]))}),this},Se=E,$e=function(t){var r=Se(this.items);return r.every(t)},W=function(t){return Array.isArray(t[0])?t[0]:t},je=W,Ee=function(){for(var t=this,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var s=je(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 jt(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 Ie(e,t){var r={};return Object.keys(t).forEach(function(n){e?e(t[n],n)&&(r[n]=t[n]):jt(t[n])||(r[n]=t[n])}),r}function Ce(e,t){if(e)return t.filter(e);for(var r=[],n=0;n<t.length;n+=1){var i=t[n];jt(i)||r.push(i)}return r}var Te=function(t){var r=t||!1,n=null;return Array.isArray(this.items)?n=Ce(r,this.items):n=Ie(r,this.items),new this.constructor(n)},Pe=d,tt=Pe.isFunction,Fe=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},De=d,Ne=De.isFunction,Be=function(t,r,n){if(Ne(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()},qe=function(t,r,n){return this.where(t,r,n).first()||null},xe=function(t){return this.map(t).collapse()},Et=d,rt=Et.isArray,et=Et.isObject,Ke=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(f){i=i.concat(a[f])}):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(f){i=i.concat(u[a][f])}):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)},Ue=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)},Me=function(t){return Array.isArray(this.items)?this.items.splice(t,1):delete this.items[t],this},Re=d,Je=Re.isFunction,Ve=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return this.items[t]!==void 0?this.items[t]:Je(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,Le=d,He=Le.isFunction,Qe=function(t){var r=this,n={};return this.items.forEach(function(i,s){var o;He(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)},Ge=W,ze=function(){for(var t=this,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var s=Ge(n);return s.filter(function(o){return Object.hasOwnProperty.call(t.items,o)}).length===s.length},Xe=function(t,r){return r===void 0?this.items.join(t):new this.constructor(this.items).pluck(t).all().join(r)},Ye=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)},Ze=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)},ke=function(){return Array.isArray(this.items)?!this.items.length:!Object.keys(this.items).length},tn=function(){return!this.isEmpty()},rn=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},en=I,nn=d,sn=nn.isFunction,on=function(t){var r={};return sn(t)?this.items.forEach(function(n){r[t(n)]=n}):this.items.forEach(function(n){var i=en(n,t);r[i||""]=n}),new this.constructor(r)},an=function(){var t=Object.keys(this.items);return Array.isArray(this.items)&&(t=t.map(Number)),new this.constructor(t)},un=d,It=un.isFunction,fn=function(t,r){var n=this.items;if(It(t)&&(n=this.filter(t).all()),Array.isArray(n)&&!n.length||!Object.keys(n).length)return It(r)?r():r;if(Array.isArray(n))return n[n.length-1];var i=Object.keys(n);return n[i[i.length-1]]},cn=function(t,r){this.constructor.prototype[t]=r},ln=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 pn(e){return vn(e)||dn(e)||mn(e)||yn()}function yn(){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 mn(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 dn(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function vn(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 bn=function(t){return this.map(function(r,n){return t.apply(void 0,pn(r).concat([n]))})};function gn(e,t){return On(e)||_n(e,t)||An(e,t)||wn()}function wn(){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 An(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 In(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 Dn(e,t){if(e){if(typeof e=="string")return
|
|
12
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kn(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 Un(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 Mn=function(t){if(typeof t=="string"){var r=this.items.filter(function(n){return n[t]!==void 0});return Math.max.apply(Math,
|
|
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 Gn(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function zn(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 Xn=function(t){if(t!==void 0){var r=this.items.filter(function(n){return n[t]!==void 0});return Math.min.apply(Math,xt(r.map(function(n){return n[t]})))}return Math.min.apply(Math,xt(this.items))},Yn=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},Zn=E,kn=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=Zn(this.items),i=n.slice(r).filter(function(s,o){return o%t===0});return new this.constructor(i)},ti=W,ri=function(){for(var t=this,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var s=ti(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)},ei=St,ni=function(t,r){var n=Math.abs(t),i=this.count();if(n<=i)return this;for(var s=n-i,o=ei(this.items),u=Array.isArray(this.items),a=t<0,f=0;f<s;)u?a?o.unshift(r):o.push(r):o[f]!==void 0?s+=1:o[f]=r,f+=1;return new this.constructor(o)},ii=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)},si=function(t){return t(this)},Kt=d,oi=Kt.isArray,ai=Kt.isObject,R=I,ui=function(t){var r={};return t.forEach(function(n,i){function s(o,u){ai(o)?Object.keys(o).forEach(function(a){s(o[a],"".concat(u,".").concat(a))}):oi(o)&&o.forEach(function(a,f){s(a,"".concat(u,".").concat(f))}),r[u]=o}s(n,i)}),r},fi=function(t,r){if(t.indexOf("*")!==-1){var n=ui(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(l){var m=l.match(s);if(m){var A=m[0];A.split(".").length===o&&i.push(n[A])}})}var u=[],a=new RegExp("0.".concat(t),"g"),f="0.".concat(t).split(".").length;if(Object.keys(n).forEach(function(l){var m=l.match(a);if(m){var A=m[0];A.split(".").length===f&&u.push(n[A])}}),r!==void 0){var y={};return this.items.forEach(function(l,m){y[i[m]||""]=u}),new this.constructor(y)}return new this.constructor([u])}if(r!==void 0){var b={};return this.items.forEach(function(l){R(l,t)!==void 0?b[l[r]||""]=R(l,t):b[l[r]||""]=null}),new this.constructor(b)}return this.map(function(l){return R(l,t)!==void 0?R(l,t):null})},ci=W,Ut=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];ci(n).forEach(function(s){delete t[s]})},Wt=d,li=Wt.isArray,hi=Wt.isObject,Mt=Ut,pi=function(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;if(this.isEmpty())return null;if(li(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 Mt(this.items,i),s}var o=n.slice(-r),u=o.reduce(function(a,f){return a[f]=t.items[f],a},{});return Mt(this.items,o),new this.constructor(u)}return null},yi=function(t,r){return r!==void 0?this.put(r,t):(this.items.unshift(t),this)},mi=d,di=mi.isFunction,vi=function(t,r){var n=this.items[t]||null;return!n&&r!==void 0&&(di(r)?n=r():n=r),delete this.items[t],n},bi=function(){var t;return(t=this.items).push.apply(t,arguments),this},gi=function(t,r){return this.items[t]=r,this},wi=E,Ai=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=wi(this.items),n=new this.constructor(r).shuffle();return t!==parseInt(t,10)?n.first():n.take(t)},_i=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},Oi=function(t){return new this.constructor(this.items).filter(function(r){return!t(r)})};function Rt(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 J(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Rt(Object(r),!0).forEach(function(n){Si(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Si(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var $i=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=J(J({},this.items),t.all());return new this.constructor(n)}var i=J(J({},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 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 D(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){ji(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 ji(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ei=function(t){var r=function n(i,s){var o=D({},i),u=Object.keys(D(D({},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]=D({},s[a]):o[a]=s[a]:i[a]!==void 0&&s[a]===void 0?C(i[a])==="object"?o[a]=D({},i[a]):o[a]=i[a]:i[a]!==void 0&&s[a]!==void 0&&(C(s[a])==="object"?o[a]=D({},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},Ii=function(){var t=[].concat(this.items).reverse();return new this.constructor(t)},at=d,Ci=at.isArray,Ti=at.isObject,Pi=at.isFunction,Fi=function(t,r){var n=this,i,s=function(u,a){return Pi(t)?t(n.items[a],a):r?n.items[a]===t:n.items[a]==t};return Ci(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},Vt=d,Di=Vt.isArray,Ni=Vt.isObject,Bi=Ut,qi=function(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;if(this.isEmpty())return null;if(Di(this.items))return r===1?this.items.shift():new this.constructor(this.items.splice(0,r));if(Ni(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,f){return a[f]=t.items[f],a},{});return Bi(this.items,o),new this.constructor(u)}return null},xi=E,Ki=function(){var t=xi(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},Ui=d,Wi=Ui.isObject,Mi=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,Ri=ut.isArray,Ji=ut.isObject,Vi=ut.isFunction,Li=function(t){var r=this,n=null,i,s=function(u){return u===t};return Vi(t)&&(s=t),Ri(this.items)&&(i=this.items.filter(function(o){return n!==!0&&(n=s(o)),n})),Ji(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)},ft=d,Hi=ft.isArray,Qi=ft.isObject,Gi=ft.isFunction,zi=function(t){var r=this,n=null,i,s=function(u){return u===t};return Gi(t)&&(s=t),Hi(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)},Xi=function(t,r){var n=this.items.slice(t);return r!==void 0&&(n=n.slice(0,r)),new this.constructor(n)},Yi=d,Zi=Yi.isFunction,ki=function(t,r,n){var i;if(Zi(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()},ts=jt,rs=ts,es=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)},ns=function(){return this.sort().reverse()},is=I,ss=d,os=ss.isFunction,as=function(t){var r=[].concat(this.items),n=function(s){return os(t)?t(s):is(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)},us=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)},cs=function(){var t=this,r={};return Object.keys(this.items).sort().reverse().forEach(function(n){r[n]=t.items[n]}),new this.constructor(r)},ls=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)},ps=E,ys=d,ms=ys.isFunction,ds=function(t){var r=ps(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(ms(t))for(var o=0,u=r.length;o<u;o+=1)n+=parseFloat(t(r[o]));else for(var a=0,f=r.length;a<f;a+=1)n+=parseFloat(r[a][t]);return parseFloat(n.toPrecision(12))};function ct(e){"@babel/helpers - typeof";return ct=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},ct(e)}var vs=function(t){var r=this;if(!Array.isArray(this.items)&&ct(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,bs=lt.isArray,gs=lt.isObject,ws=lt.isFunction,As=function(t){var r=this,n=null,i,s=function(u){return u===t};return ws(t)&&(s=t),bs(this.items)&&(i=this.items.filter(function(o){return n!==!1&&(n=!s(o)),n})),gs(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,_s=ht.isArray,Os=ht.isObject,Ss=ht.isFunction,$s=function(t){var r=this,n=null,i,s=function(u){return u===t};return Ss(t)&&(s=t),_s(this.items)&&(i=this.items.filter(function(o){return n!==!1&&(n=s(o)),n})),Os(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)},js=function(t){return t(this),this},Es=function(t,r){for(var n=1;n<=t;n+=1)this.items.push(r(n));return this},Is=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 Cs=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 Lt(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 Ht(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Lt(Object(r),!0).forEach(function(n){Ps(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Ps(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Fs=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=Ht(Ht({},r),i)}else r[n]=t.items[n]}),new this.constructor(r)},Ds=function(t,r,n){t?n(this):r(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},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},Ns=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)},Bs=d,qs=Bs.isFunction,xs=function(t){var r;if(t===void 0)r=this.items.filter(function(u,a,f){return f.indexOf(u)===a});else{r=[];for(var n=[],i=0,s=this.items.length;i<s;i+=1){var o=void 0;qs(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)},Ks=function(t){return t instanceof this.constructor?t.all():t},Us=E,Ws=function(){return new this.constructor(Us(this.items))},Ms=function(t,r,n){return t?r(this,t):n?n(this,t):this},Rs=E,$=I,Js=function(t,r,n){var i=r,s=n,o=Rs(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)},Vs=function(t,r){return this.where(t,">=",r[0]).where(t,"<=",r[r.length-1])},Ls=E,Hs=I,Qs=function(t,r){var n=Ls(r),i=this.items.filter(function(s){return n.indexOf(Hs(s,t))!==-1});return new this.constructor(i)},Gs=function(t){return this.filter(function(r){return r instanceof t})},zt=I,zs=function(t,r){return this.filter(function(n){return zt(n,t)<r[0]||zt(n,t)>r[r.length-1]})},Xs=E,Ys=I,Zs=function(t,r){var n=Xs(r),i=this.items.filter(function(s){return n.indexOf(Ys(s,t))===-1});return new this.constructor(i)},ks=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.where(t,"===",null)},to=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 ro=function(t){return t instanceof this.constructor?t:yt(t)==="object"?new this.constructor(t):new this.constructor([t])},eo=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=Ar;typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=n),r.prototype.toJSON=function(){return this.items},r.prototype.all=_r,r.prototype.average=_t,r.prototype.avg=jr,r.prototype.chunk=Er,r.prototype.collapse=Dr,r.prototype.combine=Ur,r.prototype.concat=Hr,r.prototype.contains=jt,r.prototype.containsOneItem=se,r.prototype.count=oe,r.prototype.countBy=ae,r.prototype.crossJoin=ue,r.prototype.dd=fe,r.prototype.diff=ce,r.prototype.diffAssoc=le,r.prototype.diffKeys=he,r.prototype.diffUsing=pe,r.prototype.doesntContain=ye,r.prototype.dump=me,r.prototype.duplicates=de,r.prototype.each=ve,r.prototype.eachSpread=Oe,r.prototype.every=$e,r.prototype.except=Ee,r.prototype.filter=Te,r.prototype.first=Fe,r.prototype.firstOrFail=Be,r.prototype.firstWhere=qe,r.prototype.flatMap=xe,r.prototype.flatten=Ke,r.prototype.flip=Ue,r.prototype.forPage=We,r.prototype.forget=Me,r.prototype.get=Ve,r.prototype.groupBy=Qe,r.prototype.has=ze,r.prototype.implode=Xe,r.prototype.intersect=Ye,r.prototype.intersectByKeys=Ze,r.prototype.isEmpty=ke,r.prototype.isNotEmpty=tn,r.prototype.join=rn,r.prototype.keyBy=on,r.prototype.keys=an,r.prototype.last=fn,r.prototype.macro=cn,r.prototype.make=ln,r.prototype.map=hn,r.prototype.mapSpread=bn,r.prototype.mapToDictionary=Sn,r.prototype.mapInto=$n,r.prototype.mapToGroups=Pn,r.prototype.mapWithKeys=qn,r.prototype.max=Mn,r.prototype.median=Rn,r.prototype.merge=Jn,r.prototype.mergeRecursive=Ln,r.prototype.min=Xn,r.prototype.mode=Yn,r.prototype.nth=kn,r.prototype.only=ri,r.prototype.pad=ni,r.prototype.partition=ii,r.prototype.pipe=si,r.prototype.pluck=fi,r.prototype.pop=pi,r.prototype.prepend=yi,r.prototype.pull=vi,r.prototype.push=bi,r.prototype.put=gi,r.prototype.random=Ai,r.prototype.reduce=_i,r.prototype.reject=Oi,r.prototype.replace=$i,r.prototype.replaceRecursive=Ei,r.prototype.reverse=Ii,r.prototype.search=Fi,r.prototype.shift=qi,r.prototype.shuffle=Ki,r.prototype.skip=Mi,r.prototype.skipUntil=Li,r.prototype.skipWhile=zi,r.prototype.slice=Xi,r.prototype.sole=ki,r.prototype.some=rs,r.prototype.sort=es,r.prototype.sortDesc=ns,r.prototype.sortBy=as,r.prototype.sortByDesc=us,r.prototype.sortKeys=fs,r.prototype.sortKeysDesc=cs,r.prototype.splice=ls,r.prototype.split=hs,r.prototype.sum=ds,r.prototype.take=vs,r.prototype.takeUntil=As,r.prototype.takeWhile=$s,r.prototype.tap=js,r.prototype.times=Es,r.prototype.toArray=Is,r.prototype.toJson=Cs,r.prototype.transform=Ts,r.prototype.undot=Fs,r.prototype.unless=Ds,r.prototype.unlessEmpty=Qt,r.prototype.unlessNotEmpty=Gt,r.prototype.union=Ns,r.prototype.unique=xs,r.prototype.unwrap=Ks,r.prototype.values=Ws,r.prototype.when=Ms,r.prototype.whenEmpty=Gt,r.prototype.whenNotEmpty=Qt,r.prototype.where=Js,r.prototype.whereBetween=Vs,r.prototype.whereIn=Qs,r.prototype.whereInstanceOf=Gs,r.prototype.whereNotBetween=zs,r.prototype.whereNotIn=Zs,r.prototype.whereNull=ks,r.prototype.whereNotNull=to,r.prototype.wrap=ro,r.prototype.zip=eo;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 no=At.exports;const Xt=wr(no),Yt=["chunk","shuffle","splice","sortBy","map","reverse","groupBy","implode","keyBy","keys","mapToDictionary","mapWithKeys","nth","skipUntil","skipWhile","takeUntil","takeWhile","unique"],io=["forPage","sortByDesc","sortBy","skip","take","splice","whereBetween","whereIn","whereNotBetween","whereNotIn","first","where","whereContains"],so=["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,n){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.data_path=t,this.axios=n,this.filters={},this.steps=[],this.fields=r}}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 O(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,...io])j.prototype[e]=function(...t){const r=this.clone();return r.steps.push({type:e,args:t}),r};for(const e of so)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 oo=e=>{const t=P.create({baseURL:e,withCredentials:!0}),r=(s,o=null,u=[])=>p(t,s,o,u),n=s=>O(t,s),i=br();return{baseURL:e,axios:t,auth:fr(t),mutation:r,query:n,config:mr(n),mail:dr(t),users:vr(t),fs:yr(t),models:i,model(s){return wt(t,s,i.get(s))},roles:gr(t),collect:(s,o)=>{const u=wt(t,s,i.get(s)).getDataPath();return new j(u,o,t)}}};g.File=lr,g.createClient=oo,g.file=q,g.mutation=p,g.query=O,g.toQuery=B,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
|
9
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function An(e,t){if(e){if(typeof e=="string")return Ct(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 Ct(e,t)}}function Ct(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 _n(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 On(e){if(Array.isArray(e))return e}var Sn=function(t){var r={};return this.items.forEach(function(n,i){var s=t(n,i),o=gn(s,2),u=o[0],a=o[1];r[u]===void 0?r[u]=[a]:r[u].push(a)}),new this.constructor(r)},$n=function(t){return this.map(function(r,n){return new t(r,n)})};function jn(e,t){return Tn(e)||Cn(e,t)||In(e,t)||En()}function En(){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 In(e,t){if(e){if(typeof e=="string")return Tt(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 Tt(e,t)}}function Tt(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 Cn(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 Tn(e){if(Array.isArray(e))return e}var Pn=function(t){var r={};return this.items.forEach(function(n,i){var s=t(n,i),o=jn(s,2),u=o[0],a=o[1];r[u]===void 0?r[u]=[a]:r[u].push(a)}),new this.constructor(r)};function Pt(e,t){return Bn(e)||Nn(e,t)||Dn(e,t)||Fn()}function Fn(){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 Dn(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 Nn(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 Bn(e){if(Array.isArray(e))return e}var qn=function(t){var r=this,n={};return Array.isArray(this.items)?this.items.forEach(function(i,s){var o=t(i,s),u=Pt(o,2),a=u[0],f=u[1];n[a]=f}):Object.keys(this.items).forEach(function(i){var s=t(r.items[i],i),o=Pt(s,2),u=o[0],a=o[1];n[u]=a}),new this.constructor(n)};function Dt(e){return Wn(e)||Un(e)||Kn(e)||xn()}function xn(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
12
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Kn(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 Un(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 Mn=function(t){if(typeof t=="string"){var r=this.items.filter(function(n){return n[t]!==void 0});return Math.max.apply(Math,Dt(r.map(function(n){return n[t]})))}return Math.max.apply(Math,Dt(this.items))},Rn=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]},Jn=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 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)}function Nt(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 Bt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Nt(Object(r),!0).forEach(function(n){Vn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Vn(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ln=function(t){var r=function n(i,s){var o={},u=Object.keys(Bt(Bt({},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])&&M(i[a])==="object"&&!Array.isArray(s[a])&&M(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 qt(e){return zn(e)||Gn(e)||Qn(e)||Hn()}function Hn(){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 Gn(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function zn(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 Xn=function(t){if(t!==void 0){var r=this.items.filter(function(n){return n[t]!==void 0});return Math.min.apply(Math,qt(r.map(function(n){return n[t]})))}return Math.min.apply(Math,qt(this.items))},Yn=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},Zn=E,kn=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=Zn(this.items),i=n.slice(r).filter(function(s,o){return o%t===0});return new this.constructor(i)},ti=W,ri=function(){for(var t=this,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];var s=ti(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)},ei=Ot,ni=function(t,r){var n=Math.abs(t),i=this.count();if(n<=i)return this;for(var s=n-i,o=ei(this.items),u=Array.isArray(this.items),a=t<0,f=0;f<s;)u?a?o.unshift(r):o.push(r):o[f]!==void 0?s+=1:o[f]=r,f+=1;return new this.constructor(o)},ii=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)},si=function(t){return t(this)},xt=d,oi=xt.isArray,ai=xt.isObject,R=I,ui=function(t){var r={};return t.forEach(function(n,i){function s(o,u){ai(o)?Object.keys(o).forEach(function(a){s(o[a],"".concat(u,".").concat(a))}):oi(o)&&o.forEach(function(a,f){s(a,"".concat(u,".").concat(f))}),r[u]=o}s(n,i)}),r},fi=function(t,r){if(t.indexOf("*")!==-1){var n=ui(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(l){var m=l.match(s);if(m){var A=m[0];A.split(".").length===o&&i.push(n[A])}})}var u=[],a=new RegExp("0.".concat(t),"g"),f="0.".concat(t).split(".").length;if(Object.keys(n).forEach(function(l){var m=l.match(a);if(m){var A=m[0];A.split(".").length===f&&u.push(n[A])}}),r!==void 0){var h={};return this.items.forEach(function(l,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(l){R(l,t)!==void 0?b[l[r]||""]=R(l,t):b[l[r]||""]=null}),new this.constructor(b)}return this.map(function(l){return R(l,t)!==void 0?R(l,t):null})},ci=W,Kt=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];ci(n).forEach(function(s){delete t[s]})},Ut=d,li=Ut.isArray,hi=Ut.isObject,Wt=Kt,pi=function(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;if(this.isEmpty())return null;if(li(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,f){return a[f]=t.items[f],a},{});return Wt(this.items,o),new this.constructor(u)}return null},yi=function(t,r){return r!==void 0?this.put(r,t):(this.items.unshift(t),this)},mi=d,di=mi.isFunction,vi=function(t,r){var n=this.items[t]||null;return!n&&r!==void 0&&(di(r)?n=r():n=r),delete this.items[t],n},bi=function(){var t;return(t=this.items).push.apply(t,arguments),this},gi=function(t,r){return this.items[t]=r,this},wi=E,Ai=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,r=wi(this.items),n=new this.constructor(r).shuffle();return t!==parseInt(t,10)?n.first():n.take(t)},_i=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},Oi=function(t){return new this.constructor(this.items).filter(function(r){return!t(r)})};function Mt(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 J(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Mt(Object(r),!0).forEach(function(n){Si(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Si(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var $i=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=J(J({},this.items),t.all());return new this.constructor(n)}var i=J(J({},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 Rt(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 D(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Rt(Object(r),!0).forEach(function(n){ji(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Rt(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ji(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Ei=function(t){var r=function n(i,s){var o=D({},i),u=Object.keys(D(D({},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]=D({},s[a]):o[a]=s[a]:i[a]!==void 0&&s[a]===void 0?C(i[a])==="object"?o[a]=D({},i[a]):o[a]=i[a]:i[a]!==void 0&&s[a]!==void 0&&(C(s[a])==="object"?o[a]=D({},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},Ii=function(){var t=[].concat(this.items).reverse();return new this.constructor(t)},at=d,Ci=at.isArray,Ti=at.isObject,Pi=at.isFunction,Fi=function(t,r){var n=this,i,s=function(u,a){return Pi(t)?t(n.items[a],a):r?n.items[a]===t:n.items[a]==t};return Ci(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},Jt=d,Di=Jt.isArray,Ni=Jt.isObject,Bi=Kt,qi=function(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:1;if(this.isEmpty())return null;if(Di(this.items))return r===1?this.items.shift():new this.constructor(this.items.splice(0,r));if(Ni(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,f){return a[f]=t.items[f],a},{});return Bi(this.items,o),new this.constructor(u)}return null},xi=E,Ki=function(){var t=xi(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},Ui=d,Wi=Ui.isObject,Mi=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,Ri=ut.isArray,Ji=ut.isObject,Vi=ut.isFunction,Li=function(t){var r=this,n=null,i,s=function(u){return u===t};return Vi(t)&&(s=t),Ri(this.items)&&(i=this.items.filter(function(o){return n!==!0&&(n=s(o)),n})),Ji(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)},ft=d,Hi=ft.isArray,Qi=ft.isObject,Gi=ft.isFunction,zi=function(t){var r=this,n=null,i,s=function(u){return u===t};return Gi(t)&&(s=t),Hi(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)},Xi=function(t,r){var n=this.items.slice(t);return r!==void 0&&(n=n.slice(0,r)),new this.constructor(n)},Yi=d,Zi=Yi.isFunction,ki=function(t,r,n){var i;if(Zi(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()},ts=$t,rs=ts,es=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)},ns=function(){return this.sort().reverse()},is=I,ss=d,os=ss.isFunction,as=function(t){var r=[].concat(this.items),n=function(s){return os(t)?t(s):is(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)},us=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)},cs=function(){var t=this,r={};return Object.keys(this.items).sort().reverse().forEach(function(n){r[n]=t.items[n]}),new this.constructor(r)},ls=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)},ps=E,ys=d,ms=ys.isFunction,ds=function(t){var r=ps(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(ms(t))for(var o=0,u=r.length;o<u;o+=1)n+=parseFloat(t(r[o]));else for(var a=0,f=r.length;a<f;a+=1)n+=parseFloat(r[a][t]);return parseFloat(n.toPrecision(12))};function ct(e){"@babel/helpers - typeof";return ct=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},ct(e)}var vs=function(t){var r=this;if(!Array.isArray(this.items)&&ct(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,bs=lt.isArray,gs=lt.isObject,ws=lt.isFunction,As=function(t){var r=this,n=null,i,s=function(u){return u===t};return ws(t)&&(s=t),bs(this.items)&&(i=this.items.filter(function(o){return n!==!1&&(n=!s(o)),n})),gs(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,_s=ht.isArray,Os=ht.isObject,Ss=ht.isFunction,$s=function(t){var r=this,n=null,i,s=function(u){return u===t};return Ss(t)&&(s=t),_s(this.items)&&(i=this.items.filter(function(o){return n!==!1&&(n=s(o)),n})),Os(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)},js=function(t){return t(this),this},Es=function(t,r){for(var n=1;n<=t;n+=1)this.items.push(r(n));return this},Is=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 Cs=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 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 Lt(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){Ps(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 Ps(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Fs=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=Lt(Lt({},r),i)}else r[n]=t.items[n]}),new this.constructor(r)},Ds=function(t,r,n){t?n(this):r(this)},Ht=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},Ns=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)},Bs=d,qs=Bs.isFunction,xs=function(t){var r;if(t===void 0)r=this.items.filter(function(u,a,f){return f.indexOf(u)===a});else{r=[];for(var n=[],i=0,s=this.items.length;i<s;i+=1){var o=void 0;qs(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)},Ks=function(t){return t instanceof this.constructor?t.all():t},Us=E,Ws=function(){return new this.constructor(Us(this.items))},Ms=function(t,r,n){return t?r(this,t):n?n(this,t):this},Rs=E,$=I,Js=function(t,r,n){var i=r,s=n,o=Rs(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)},Vs=function(t,r){return this.where(t,">=",r[0]).where(t,"<=",r[r.length-1])},Ls=E,Hs=I,Qs=function(t,r){var n=Ls(r),i=this.items.filter(function(s){return n.indexOf(Hs(s,t))!==-1});return new this.constructor(i)},Gs=function(t){return this.filter(function(r){return r instanceof t})},Gt=I,zs=function(t,r){return this.filter(function(n){return Gt(n,t)<r[0]||Gt(n,t)>r[r.length-1]})},Xs=E,Ys=I,Zs=function(t,r){var n=Xs(r),i=this.items.filter(function(s){return n.indexOf(Ys(s,t))===-1});return new this.constructor(i)},ks=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null;return this.where(t,"===",null)},to=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 ro=function(t){return t instanceof this.constructor?t:yt(t)==="object"?new this.constructor(t):new this.constructor([t])},eo=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=Ar;typeof Symbol<"u"&&(r.prototype[Symbol.iterator]=n),r.prototype.toJSON=function(){return this.items},r.prototype.all=_r,r.prototype.average=At,r.prototype.avg=jr,r.prototype.chunk=Er,r.prototype.collapse=Dr,r.prototype.combine=Ur,r.prototype.concat=Hr,r.prototype.contains=$t,r.prototype.containsOneItem=se,r.prototype.count=oe,r.prototype.countBy=ae,r.prototype.crossJoin=ue,r.prototype.dd=fe,r.prototype.diff=ce,r.prototype.diffAssoc=le,r.prototype.diffKeys=he,r.prototype.diffUsing=pe,r.prototype.doesntContain=ye,r.prototype.dump=me,r.prototype.duplicates=de,r.prototype.each=ve,r.prototype.eachSpread=Oe,r.prototype.every=$e,r.prototype.except=Ee,r.prototype.filter=Te,r.prototype.first=Fe,r.prototype.firstOrFail=Be,r.prototype.firstWhere=qe,r.prototype.flatMap=xe,r.prototype.flatten=Ke,r.prototype.flip=Ue,r.prototype.forPage=We,r.prototype.forget=Me,r.prototype.get=Ve,r.prototype.groupBy=Qe,r.prototype.has=ze,r.prototype.implode=Xe,r.prototype.intersect=Ye,r.prototype.intersectByKeys=Ze,r.prototype.isEmpty=ke,r.prototype.isNotEmpty=tn,r.prototype.join=rn,r.prototype.keyBy=on,r.prototype.keys=an,r.prototype.last=fn,r.prototype.macro=cn,r.prototype.make=ln,r.prototype.map=hn,r.prototype.mapSpread=bn,r.prototype.mapToDictionary=Sn,r.prototype.mapInto=$n,r.prototype.mapToGroups=Pn,r.prototype.mapWithKeys=qn,r.prototype.max=Mn,r.prototype.median=Rn,r.prototype.merge=Jn,r.prototype.mergeRecursive=Ln,r.prototype.min=Xn,r.prototype.mode=Yn,r.prototype.nth=kn,r.prototype.only=ri,r.prototype.pad=ni,r.prototype.partition=ii,r.prototype.pipe=si,r.prototype.pluck=fi,r.prototype.pop=pi,r.prototype.prepend=yi,r.prototype.pull=vi,r.prototype.push=bi,r.prototype.put=gi,r.prototype.random=Ai,r.prototype.reduce=_i,r.prototype.reject=Oi,r.prototype.replace=$i,r.prototype.replaceRecursive=Ei,r.prototype.reverse=Ii,r.prototype.search=Fi,r.prototype.shift=qi,r.prototype.shuffle=Ki,r.prototype.skip=Mi,r.prototype.skipUntil=Li,r.prototype.skipWhile=zi,r.prototype.slice=Xi,r.prototype.sole=ki,r.prototype.some=rs,r.prototype.sort=es,r.prototype.sortDesc=ns,r.prototype.sortBy=as,r.prototype.sortByDesc=us,r.prototype.sortKeys=fs,r.prototype.sortKeysDesc=cs,r.prototype.splice=ls,r.prototype.split=hs,r.prototype.sum=ds,r.prototype.take=vs,r.prototype.takeUntil=As,r.prototype.takeWhile=$s,r.prototype.tap=js,r.prototype.times=Es,r.prototype.toArray=Is,r.prototype.toJson=Cs,r.prototype.transform=Ts,r.prototype.undot=Fs,r.prototype.unless=Ds,r.prototype.unlessEmpty=Ht,r.prototype.unlessNotEmpty=Qt,r.prototype.union=Ns,r.prototype.unique=xs,r.prototype.unwrap=Ks,r.prototype.values=Ws,r.prototype.when=Ms,r.prototype.whenEmpty=Qt,r.prototype.whenNotEmpty=Ht,r.prototype.where=Js,r.prototype.whereBetween=Vs,r.prototype.whereIn=Qs,r.prototype.whereInstanceOf=Gs,r.prototype.whereNotBetween=zs,r.prototype.whereNotIn=Zs,r.prototype.whereNull=ks,r.prototype.whereNotNull=to,r.prototype.wrap=ro,r.prototype.zip=eo;var i=function(o){return new r(o)};e.exports=i,e.exports.collect=i,e.exports.default=i,e.exports.Collection=r})(wt);var no=wt.exports;const zt=wr(no),Xt=["chunk","shuffle","splice","sortBy","map","reverse","groupBy","implode","keyBy","keys","mapToDictionary","mapWithKeys","nth","skipUntil","skipWhile","takeUntil","takeWhile","unique"],io=["forPage","sortByDesc","sortBy","skip","take","splice","whereBetween","whereIn","whereNotBetween","whereNotIn","first","where","whereContains"],so=["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,n){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.data_path=t,this.axios=n,this.filters={},this.steps=[],this.fields=r}}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},zt().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 O(this.axios,r);for(const u of t)o=o[u];return this.meta=o.meta,zt(o.data)},j.prototype.processData=async function(){let e=null;for(const t of this.steps){if(Xt.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[...Xt,...io])j.prototype[e]=function(...t){const r=this.clone();return r.steps.push({type:e,args:t}),r};for(const e of so)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 oo=e=>{const t=P.create({baseURL:e,withCredentials:!0}),r=(s,o=null,u=[])=>y(t,s,o,u),n=s=>O(t,s),i=br(t);return{baseURL:e,axios:t,auth:ur(t),mutation:r,query:n,config:mr(n),mail:dr(t),users:vr(t),fs:yr(t),models:i,model(s){return i.get(s)},roles:gr(t),collect:(s,o)=>{const u=i.get(s).getDataPath();return new j(u,o,t)}}};g.File=lr,g.createClient=oo,g.file=q,g.mutation=y,g.query=O,g.toQuery=B,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
package/dist/models.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
1
2
|
import { FieldOption } from './model';
|
|
2
|
-
declare const _default: () => {
|
|
3
|
+
declare const _default: (axios: AxiosInstance) => {
|
|
3
4
|
create(name: string, fields: {
|
|
4
5
|
[key: string]: FieldOption;
|
|
5
|
-
}):
|
|
6
|
+
}): void;
|
|
6
7
|
get(name: string): any;
|
|
7
8
|
};
|
|
8
9
|
export default _default;
|