@mjsz-vbr-elements/core 2.1.4 → 2.1.5

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.
@@ -0,0 +1,120 @@
1
+ /**
2
+ * name: @mjsz-vbr-elements/core
3
+ * version: v2.1.5 - 16/12/2023, 17:02:50
4
+ * (c) 2023
5
+ * description: Data visualization for MJSZ VBR
6
+ * author: Ákos Stegner <akos.stegner@gmail.com>
7
+ */
8
+ import { j as _, k as x, n as c, l as y } from "./useSort-cf4549f9.js";
9
+ import { c as Z, i as k, u as H, b as Q, a as U, d as Y, e as q, f as ee, g as te, v as ne } from "./useSort-cf4549f9.js";
10
+ import { unref as u, ref as v, watch as g } from "vue";
11
+ import { VBR_API_BASE_URL as S } from "./constants.js";
12
+ import { E as I, H as b, p as E, G as w, z as B, w as P, i as V } from "./datetime-2fb02df2.js";
13
+ var D = /* @__PURE__ */ function() {
14
+ function t(e, n) {
15
+ this.xf = n, this.f = e, this.idx = -1, this.found = !1;
16
+ }
17
+ return t.prototype["@@transducer/init"] = I.init, t.prototype["@@transducer/result"] = function(e) {
18
+ return this.found || (e = this.xf["@@transducer/step"](e, -1)), this.xf["@@transducer/result"](e);
19
+ }, t.prototype["@@transducer/step"] = function(e, n) {
20
+ return this.idx += 1, this.f(n) && (this.found = !0, e = b(this.xf["@@transducer/step"](e, this.idx))), e;
21
+ }, t;
22
+ }();
23
+ function A(t) {
24
+ return function(e) {
25
+ return new D(t, e);
26
+ };
27
+ }
28
+ var C = /* @__PURE__ */ E(
29
+ /* @__PURE__ */ w([], A, function(e, n) {
30
+ for (var r = 0, i = n.length; r < i; ) {
31
+ if (e(n[r]))
32
+ return r;
33
+ r += 1;
34
+ }
35
+ return -1;
36
+ })
37
+ );
38
+ const O = C;
39
+ var R = /* @__PURE__ */ B(function(e, n, r) {
40
+ return e(P(n, r));
41
+ });
42
+ const T = R, $ = async (t, e, n) => {
43
+ const r = `${S}${u(t)}?${j(n)}`;
44
+ return new Promise((i, s) => {
45
+ fetch(r, {
46
+ method: "GET",
47
+ cache: "no-cache",
48
+ headers: {
49
+ "Content-Type": "application/json",
50
+ "X-API-KEY": G(e)
51
+ }
52
+ }).then((a) => a.json()).then((a) => {
53
+ if (a.error)
54
+ return s(a);
55
+ i(a.data);
56
+ }).catch((a) => {
57
+ s(a);
58
+ });
59
+ });
60
+ }, j = (t) => Object.keys(t).map((e) => e + "=" + t[e]).join("&"), G = (t) => {
61
+ var e;
62
+ return t || ((e = window.__MJSZ_VBR_WIDGET__) != null && e.apiKey ? window.__MJSZ_VBR_WIDGET__.apiKey : {}.NODE_ENV !== "production" ? "dd8adf5fdb738b3741fa579b5ede5ce69b681f62" : "");
63
+ }, X = (t = {}) => {
64
+ const { initial: e = 1, items: n = [], limit: r, auto: i = !1 } = t, s = v(u(e)), a = (o) => V(o, "day");
65
+ return _(n, () => {
66
+ if (!i)
67
+ return;
68
+ const o = O(T(a, "gameDate"))(u(n));
69
+ s.value = o === -1 ? 1 : Math.floor(o / r) + 1;
70
+ }), {
71
+ page: s,
72
+ change: (o) => {
73
+ s.value = o;
74
+ }
75
+ };
76
+ }, z = ({ options: t = {}, transform: e = (i) => i, onError: n = c, onSuccess: r = c }) => {
77
+ const { path: i, apiKey: s, params: a, resetOnExecute: f = !1, immediate: d = !1 } = t, {
78
+ state: o,
79
+ error: p,
80
+ isLoading: h,
81
+ execute: l
82
+ } = x(() => $(i, s, u(a)).then((m) => e(m)), [], {
83
+ immediate: d,
84
+ resetOnExecute: f,
85
+ onError: n,
86
+ onSuccess: r
87
+ });
88
+ return {
89
+ state: o,
90
+ error: p,
91
+ isLoading: h,
92
+ execute: l
93
+ };
94
+ };
95
+ function F(t = !1, e = c, n = c) {
96
+ const r = y();
97
+ g(r, (i) => {
98
+ if (u(t)) {
99
+ if (i === "visible")
100
+ return e();
101
+ n();
102
+ }
103
+ });
104
+ }
105
+ export {
106
+ Z as createI18n,
107
+ $ as fetchVBRData,
108
+ k as i18n,
109
+ H as useColumns,
110
+ Q as useError,
111
+ U as useErrorProvider,
112
+ Y as useI18n,
113
+ q as useLazyLoadingState,
114
+ ee as useMainClass,
115
+ X as usePage,
116
+ z as useServices,
117
+ te as useSort,
118
+ F as useVisibilityChange,
119
+ ne as validateColumnsName
120
+ };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * name: @mjsz-vbr-elements/core
3
+ * version: v2.1.5 - 16/12/2023, 17:02:50
4
+ * (c) 2023
5
+ * description: Data visualization for MJSZ VBR
6
+ * author: Ákos Stegner <akos.stegner@gmail.com>
7
+ */
8
+ const e = "https://api.icehockey.hu/vbr", t = "https://www.jegkorongszovetseg.hu/event/game/{gameId}", s = "https://jegkorongszovetseg.hu/assets/images/player_blank.png", a = "https://www.ersteliga.hu/stats/player/?playerId={player.playerId}&championshipId={championshipId}", o = "https://www.ersteliga.hu/stats/team/?teamId={team.id}&championshipId={championshipId}", E = "https://api.icehockey.hu/static/api/flag", n = "original", _ = "descend", p = "ascend", A = (/* @__PURE__ */ new Map()).set("hu", "hu-hu").set("en", "hu-gb"), h = (/* @__PURE__ */ new Map()).set("Europe/Budapest", { countryLabelKey: "hungary", timezone: "Europe/Budapest" }).set("Europe/Bucharest", { countryLabelKey: "romania", timezone: "Europe/Bucharest" }), c = 1e3 * 60 * 5, L = 1e3;
9
+ export {
10
+ h as AVAILABLE_TIMEZONES_BY_COUNTRY,
11
+ t as DEFAULT_EXTERNAL_GAME_URL,
12
+ a as DEFAULT_EXTERNAL_PLAYER_URL,
13
+ o as DEFAULT_EXTERNAL_TEAM_URL,
14
+ s as DEFAULT_PORTRAIT_IMAGE_URL,
15
+ E as FLAG_BASE_URL,
16
+ L as LAZY_LOADING_STATE_DELAY,
17
+ A as LOCALE_FOR_LANG,
18
+ c as REFRESH_DELAY,
19
+ p as SORT_STATE_ASCEND,
20
+ _ as SORT_STATE_DESCEND,
21
+ n as SORT_STATE_ORIGINAL,
22
+ e as VBR_API_BASE_URL
23
+ };
@@ -0,0 +1,528 @@
1
+ /**
2
+ * name: @mjsz-vbr-elements/core
3
+ * version: v2.1.5 - 16/12/2023, 17:02:50
4
+ * (c) 2023
5
+ * description: Data visualization for MJSZ VBR
6
+ * author: Ákos Stegner <akos.stegner@gmail.com>
7
+ */
8
+ import { SORT_STATE_ORIGINAL as F, SORT_STATE_ASCEND as j } from "./constants.js";
9
+ import { p as f, v as N, q as g, w as h, _ as p, j as v, k as O, x as b, z as c, A as _, B as M, C as T, D as G, E as U, F as H, G as k, H as q, I as X, J as K, n as D, r as Y, K as J, f as m, c as E, b as Q, a as V } from "./datetime-2fb02df2.js";
10
+ var Z = /* @__PURE__ */ f(function(e, r) {
11
+ if (e === r)
12
+ return r;
13
+ function n(o, l) {
14
+ if (o > l != l > o)
15
+ return l > o ? l : o;
16
+ }
17
+ var s = n(e, r);
18
+ if (s !== void 0)
19
+ return s;
20
+ var a = n(typeof e, typeof r);
21
+ if (a !== void 0)
22
+ return a === typeof e ? e : r;
23
+ var u = N(e), i = n(u, N(r));
24
+ return i !== void 0 && i === u ? e : r;
25
+ }), z = /* @__PURE__ */ f(function(e, r) {
26
+ return g(h(e), r);
27
+ }), w = /* @__PURE__ */ p(function(e) {
28
+ return v(e) ? !0 : !e || typeof e != "object" || O(e) ? !1 : e.length === 0 ? !0 : e.length > 0 ? e.hasOwnProperty(0) && e.hasOwnProperty(e.length - 1) : !1;
29
+ }), S = typeof Symbol < "u" ? Symbol.iterator : "@@iterator";
30
+ function ee(t, e, r) {
31
+ return function(s, a, u) {
32
+ if (w(u))
33
+ return t(s, a, u);
34
+ if (u == null)
35
+ return a;
36
+ if (typeof u["fantasy-land/reduce"] == "function")
37
+ return e(s, a, u, "fantasy-land/reduce");
38
+ if (u[S] != null)
39
+ return r(s, a, u[S]());
40
+ if (typeof u.next == "function")
41
+ return r(s, a, u);
42
+ if (typeof u.reduce == "function")
43
+ return e(s, a, u, "reduce");
44
+ throw new TypeError("reduce: list must be array or iterable");
45
+ };
46
+ }
47
+ function te(t, e, r) {
48
+ for (var n = 0, s = r.length; n < s; ) {
49
+ if (e = t["@@transducer/step"](e, r[n]), e && e["@@transducer/reduced"]) {
50
+ e = e["@@transducer/value"];
51
+ break;
52
+ }
53
+ n += 1;
54
+ }
55
+ return t["@@transducer/result"](e);
56
+ }
57
+ var re = /* @__PURE__ */ f(function(e, r) {
58
+ return b(e.length, function() {
59
+ return e.apply(r, arguments);
60
+ });
61
+ });
62
+ function ne(t, e, r) {
63
+ for (var n = r.next(); !n.done; ) {
64
+ if (e = t["@@transducer/step"](e, n.value), e && e["@@transducer/reduced"]) {
65
+ e = e["@@transducer/value"];
66
+ break;
67
+ }
68
+ n = r.next();
69
+ }
70
+ return t["@@transducer/result"](e);
71
+ }
72
+ function se(t, e, r, n) {
73
+ return t["@@transducer/result"](r[n](re(t["@@transducer/step"], t), e));
74
+ }
75
+ var x = /* @__PURE__ */ ee(te, se, ne), ae = /* @__PURE__ */ function() {
76
+ function t(e) {
77
+ this.f = e;
78
+ }
79
+ return t.prototype["@@transducer/init"] = function() {
80
+ throw new Error("init not implemented on XWrap");
81
+ }, t.prototype["@@transducer/result"] = function(e) {
82
+ return e;
83
+ }, t.prototype["@@transducer/step"] = function(e, r) {
84
+ return this.f(e, r);
85
+ }, t;
86
+ }();
87
+ function B(t) {
88
+ return new ae(t);
89
+ }
90
+ var ue = /* @__PURE__ */ c(function(t, e, r) {
91
+ return x(typeof t == "function" ? B(t) : t, e, r);
92
+ });
93
+ const C = ue;
94
+ var ie = /* @__PURE__ */ p(function(e) {
95
+ return function() {
96
+ return e;
97
+ };
98
+ });
99
+ const I = ie;
100
+ var ce = /* @__PURE__ */ p(function(e) {
101
+ return _(C(Z, 0, z("length", e)), function() {
102
+ for (var r = 0, n = e.length; r < n; ) {
103
+ if (e[r].apply(this, arguments))
104
+ return !0;
105
+ r += 1;
106
+ }
107
+ return !1;
108
+ });
109
+ });
110
+ const oe = ce;
111
+ var le = /* @__PURE__ */ c(function(e, r, n) {
112
+ var s = e(r), a = e(n);
113
+ return s < a ? -1 : s > a ? 1 : 0;
114
+ });
115
+ const y = le;
116
+ function fe(t, e, r) {
117
+ if (M(t) && v(r)) {
118
+ var n = [].concat(r);
119
+ return n[t] = e, n;
120
+ }
121
+ var s = {};
122
+ for (var a in r)
123
+ s[a] = r[a];
124
+ return s[t] = e, s;
125
+ }
126
+ var pe = /* @__PURE__ */ p(function(e) {
127
+ return e == null;
128
+ }), he = /* @__PURE__ */ c(function t(e, r, n) {
129
+ if (e.length === 0)
130
+ return r;
131
+ var s = e[0];
132
+ if (e.length > 1) {
133
+ var a = !pe(n) && T(s, n) && typeof n[s] == "object" ? n[s] : M(e[1]) ? [] : {};
134
+ r = t(Array.prototype.slice.call(e, 1), r, a);
135
+ }
136
+ return fe(s, r, n);
137
+ }), me = /* @__PURE__ */ c(function(e, r, n) {
138
+ return he([e], r, n);
139
+ });
140
+ function de(t) {
141
+ return new RegExp(t.source, t.flags ? t.flags : (t.global ? "g" : "") + (t.ignoreCase ? "i" : "") + (t.multiline ? "m" : "") + (t.sticky ? "y" : "") + (t.unicode ? "u" : "") + (t.dotAll ? "s" : ""));
142
+ }
143
+ function $(t, e, r) {
144
+ if (r || (r = new ge()), ye(t))
145
+ return t;
146
+ var n = function(a) {
147
+ var u = r.get(t);
148
+ if (u)
149
+ return u;
150
+ r.set(t, a);
151
+ for (var i in t)
152
+ Object.prototype.hasOwnProperty.call(t, i) && (a[i] = e ? $(t[i], !0, r) : t[i]);
153
+ return a;
154
+ };
155
+ switch (G(t)) {
156
+ case "Object":
157
+ return n(Object.create(Object.getPrototypeOf(t)));
158
+ case "Array":
159
+ return n([]);
160
+ case "Date":
161
+ return new Date(t.valueOf());
162
+ case "RegExp":
163
+ return de(t);
164
+ case "Int8Array":
165
+ case "Uint8Array":
166
+ case "Uint8ClampedArray":
167
+ case "Int16Array":
168
+ case "Uint16Array":
169
+ case "Int32Array":
170
+ case "Uint32Array":
171
+ case "Float32Array":
172
+ case "Float64Array":
173
+ case "BigInt64Array":
174
+ case "BigUint64Array":
175
+ return t.slice();
176
+ default:
177
+ return t;
178
+ }
179
+ }
180
+ function ye(t) {
181
+ var e = typeof t;
182
+ return t == null || e != "object" && e != "function";
183
+ }
184
+ var ge = /* @__PURE__ */ function() {
185
+ function t() {
186
+ this.map = {}, this.length = 0;
187
+ }
188
+ return t.prototype.set = function(e, r) {
189
+ const n = this.hash(e);
190
+ let s = this.map[n];
191
+ s || (this.map[n] = s = []), s.push([e, r]), this.length += 1;
192
+ }, t.prototype.hash = function(e) {
193
+ let r = [];
194
+ for (var n in e)
195
+ r.push(Object.prototype.toString.call(e[n]));
196
+ return r.join();
197
+ }, t.prototype.get = function(e) {
198
+ if (this.length <= 180) {
199
+ for (const s in this.map) {
200
+ const a = this.map[s];
201
+ for (let u = 0; u < a.length; u += 1) {
202
+ const i = a[u];
203
+ if (i[0] === e)
204
+ return i[1];
205
+ }
206
+ }
207
+ return;
208
+ }
209
+ const r = this.hash(e), n = this.map[r];
210
+ if (n)
211
+ for (let s = 0; s < n.length; s += 1) {
212
+ const a = n[s];
213
+ if (a[0] === e)
214
+ return a[1];
215
+ }
216
+ }, t;
217
+ }();
218
+ function ve(t, e) {
219
+ return function() {
220
+ return e.call(this, t.apply(this, arguments));
221
+ };
222
+ }
223
+ function A(t, e) {
224
+ return function() {
225
+ var r = arguments.length;
226
+ if (r === 0)
227
+ return e();
228
+ var n = arguments[r - 1];
229
+ return v(n) || typeof n[t] != "function" ? e.apply(this, arguments) : n[t].apply(n, Array.prototype.slice.call(arguments, 0, r - 1));
230
+ };
231
+ }
232
+ var _e = /* @__PURE__ */ c(
233
+ /* @__PURE__ */ A("slice", function(e, r, n) {
234
+ return Array.prototype.slice.call(n, e, r);
235
+ })
236
+ ), Te = /* @__PURE__ */ p(
237
+ /* @__PURE__ */ A(
238
+ "tail",
239
+ /* @__PURE__ */ _e(1, 1 / 0)
240
+ )
241
+ );
242
+ const $e = Te;
243
+ function d() {
244
+ if (arguments.length === 0)
245
+ throw new Error("pipe requires at least one argument");
246
+ return b(arguments[0].length, C(ve, arguments[0], $e(arguments)));
247
+ }
248
+ var Ae = /* @__PURE__ */ p(function(e) {
249
+ return O(e) ? e.split("").reverse().join("") : Array.prototype.slice.call(e, 0).reverse();
250
+ });
251
+ const Ne = Ae;
252
+ function L() {
253
+ if (arguments.length === 0)
254
+ throw new Error("compose requires at least one argument");
255
+ return d.apply(this, Ne(arguments));
256
+ }
257
+ var De = /* @__PURE__ */ p(function(e) {
258
+ return _(e.length, e);
259
+ });
260
+ const Se = De;
261
+ var Ie = /* @__PURE__ */ function() {
262
+ function t(e, r, n, s) {
263
+ this.valueFn = e, this.valueAcc = r, this.keyFn = n, this.xf = s, this.inputs = {};
264
+ }
265
+ return t.prototype["@@transducer/init"] = U.init, t.prototype["@@transducer/result"] = function(e) {
266
+ var r;
267
+ for (r in this.inputs)
268
+ if (T(r, this.inputs) && (e = this.xf["@@transducer/step"](e, this.inputs[r]), e["@@transducer/reduced"])) {
269
+ e = e["@@transducer/value"];
270
+ break;
271
+ }
272
+ return this.inputs = null, this.xf["@@transducer/result"](e);
273
+ }, t.prototype["@@transducer/step"] = function(e, r) {
274
+ var n = this.keyFn(r);
275
+ return this.inputs[n] = this.inputs[n] || [n, $(this.valueAcc, !1)], this.inputs[n][1] = this.valueFn(this.inputs[n][1], r), e;
276
+ }, t;
277
+ }();
278
+ function Re(t, e, r) {
279
+ return function(n) {
280
+ return new Ie(t, e, r, n);
281
+ };
282
+ }
283
+ var Oe = /* @__PURE__ */ H(
284
+ 4,
285
+ [],
286
+ /* @__PURE__ */ k([], Re, function(e, r, n, s) {
287
+ var a = B(function(u, i) {
288
+ var o = n(i), l = e(T(o, u) ? u[o] : $(r, !1), i);
289
+ return l && l["@@transducer/reduced"] ? q(u) : (u[o] = l, u);
290
+ });
291
+ return x(a, {}, s);
292
+ })
293
+ ), be = /* @__PURE__ */ c(function(e, r, n) {
294
+ var s = e(r), a = e(n);
295
+ return s > a ? -1 : s < a ? 1 : 0;
296
+ });
297
+ const Me = be;
298
+ var Ee = /* @__PURE__ */ f(
299
+ /* @__PURE__ */ A(
300
+ "groupBy",
301
+ /* @__PURE__ */ Oe(function(t, e) {
302
+ return t.push(e), t;
303
+ }, [])
304
+ )
305
+ );
306
+ const xe = Ee;
307
+ var Be = /* @__PURE__ */ c(function(e, r, n) {
308
+ return _(Math.max(e.length, r.length, n.length), function() {
309
+ return e.apply(this, arguments) ? r.apply(this, arguments) : n.apply(this, arguments);
310
+ });
311
+ });
312
+ const Ce = Be;
313
+ var Le = /* @__PURE__ */ f(X);
314
+ const Pe = Le;
315
+ var We = /* @__PURE__ */ f(function(e, r) {
316
+ return function(n) {
317
+ return function(s) {
318
+ return g(function(a) {
319
+ return r(a, s);
320
+ }, n(e(s)));
321
+ };
322
+ };
323
+ }), Fe = /* @__PURE__ */ p(function(e) {
324
+ return We(h(e), me(e));
325
+ });
326
+ const je = Fe;
327
+ var P = function(t) {
328
+ return {
329
+ value: t,
330
+ map: function(e) {
331
+ return P(e(t));
332
+ }
333
+ };
334
+ }, Ge = /* @__PURE__ */ c(function(e, r, n) {
335
+ return e(function(s) {
336
+ return P(r(s));
337
+ })(n).value;
338
+ });
339
+ const Ue = Ge;
340
+ var He = /* @__PURE__ */ c(function(e, r, n) {
341
+ return n.replace(e, r);
342
+ });
343
+ const ke = He;
344
+ var qe = /* @__PURE__ */ f(function(e, r) {
345
+ return Array.prototype.slice.call(r, 0).sort(e);
346
+ });
347
+ const Xe = qe;
348
+ var Ke = /* @__PURE__ */ f(function(e, r) {
349
+ return Array.prototype.slice.call(r, 0).sort(function(n, s) {
350
+ for (var a = 0, u = 0; a === 0 && u < e.length; )
351
+ a = e[u](n, s), u += 1;
352
+ return a;
353
+ });
354
+ });
355
+ const W = Ke;
356
+ var Ye = /* @__PURE__ */ K(0, "toLowerCase");
357
+ const R = Ye, tt = (t, e = "body") => {
358
+ if (!t)
359
+ return;
360
+ if (typeof e != "string") {
361
+ e == null || e.append(t);
362
+ return;
363
+ }
364
+ const r = document.querySelector(e);
365
+ r == null || r.append(t);
366
+ };
367
+ class rt extends Error {
368
+ constructor(e, r = {}) {
369
+ const { key: n, cause: s } = r;
370
+ super(e), this.name = "WidgetError", this.key = n, this.cause = s;
371
+ }
372
+ }
373
+ const nt = {
374
+ message: "Undefined Column name Message",
375
+ options: {
376
+ key: "undefined-column",
377
+ cause: {}
378
+ }
379
+ }, st = {
380
+ message: "Invalid season name",
381
+ options: {
382
+ key: "invalid-season-name",
383
+ cause: {}
384
+ }
385
+ }, at = (t = []) => ({
386
+ result: [...t],
387
+ filteredRowsLength: 0,
388
+ isFiltered: !1,
389
+ value() {
390
+ return {
391
+ rows: this.result,
392
+ totalItems: this.filteredRowsLength,
393
+ totalItems: this.isFiltered ? this.filteredRowsLength : t.length
394
+ };
395
+ },
396
+ filter(e, r = [], n = !1) {
397
+ if (e) {
398
+ const s = r.map(
399
+ (i) => n ? d(Y(i), D(e)) : d(h(i), R, Pe(R(e)))
400
+ ), a = Se((i) => i.name ? Ue(je("name"), ke(",", ""), i) : i), u = J(d(a, oe([...s])), this.result);
401
+ this.isFiltered = !0, this.filteredRowsLength = u.length, this.result = u;
402
+ }
403
+ return this;
404
+ },
405
+ sorted(e) {
406
+ if (!e.sortTarget)
407
+ return this;
408
+ if (e.orders[0].direction === F)
409
+ return this;
410
+ const r = Ce(D(j), I(y), I(Me));
411
+ return this.result = W(e.orders.map((n) => L(r(n.direction), h)(n.target)))(this.result), this;
412
+ },
413
+ addIndex(e = null) {
414
+ return this.result.reduce((r, n, s) => {
415
+ const a = r[r.length - 1] || [], u = e && a[e] === n[e];
416
+ return n.index = u ? a.index : s + 1, n.indexClass = u ? "is-duplicated" : null, r.push(n), r;
417
+ }, []), this;
418
+ },
419
+ addContinuousIndex() {
420
+ return this.result = this.result.map((e, r) => ({
421
+ ...e,
422
+ index: r + 1
423
+ })), this;
424
+ },
425
+ pagination(e, r) {
426
+ if (!r)
427
+ return this;
428
+ e = Number(e), r = Number(r);
429
+ const n = (e - 1) * r, s = n + r;
430
+ return this.result = this.result.slice(n, s), this;
431
+ },
432
+ playerName() {
433
+ return this.result = this.result.map((e) => ({
434
+ ...e,
435
+ name: `${e.lastName} ${e.firstName}`
436
+ })), this;
437
+ },
438
+ teamName() {
439
+ return this.result = this.result.map((e) => ({
440
+ ...e,
441
+ teamName: e.team.longName
442
+ })), this;
443
+ },
444
+ schedule(e = "", r = "hu") {
445
+ return this.result = this.result.map((n) => ({
446
+ ...n,
447
+ gameResult: `${n.homeTeamScore}-${n.awayTeamScore}`,
448
+ gameDateDate: m(n.gameDate, "L dddd", e, r),
449
+ gameDateTime: m(n.gameDate, "HH:mm", e, r)
450
+ })), this;
451
+ },
452
+ gameDateFilter(e) {
453
+ return e === null ? this : (this.result = this.result.filter((r) => new Date(r.gameDate).getMonth() == e), this);
454
+ },
455
+ convertTimes(e = []) {
456
+ return this.result = this.result.map((r) => (e.map((n) => r[n] ? r[`${n}Sec`] = E(r[n]) : r), r)), this;
457
+ },
458
+ groupByDays() {
459
+ return this.result = xe((e) => m(e.gameDate, "YYYY-MM-DD"))(this.result), this;
460
+ }
461
+ }), ut = (t, ...e) => g(L(...e))(t), it = (t) => {
462
+ var e, r, n;
463
+ return {
464
+ ...t,
465
+ ...t.lastName && t.firstName && { name: `${t.lastName} ${t.firstName}` },
466
+ ...((e = t.player) == null ? void 0 : e.playerId) && { name: `${t.player.lastName} ${t.player.firstName}` },
467
+ ...((r = t.player) == null ? void 0 : r.nationality) && {
468
+ name: (n = t.player) != null && n.nationality.includes("hu") ? `${t.player.lastName} ${t.player.firstName}` : `${t.player.lastName}, ${t.player.firstName}`
469
+ }
470
+ };
471
+ }, ct = (t) => {
472
+ var e;
473
+ return {
474
+ ...t,
475
+ ...((e = t == null ? void 0 : t.team) == null ? void 0 : e.id) && { teamName: t.team.longName }
476
+ };
477
+ }, ot = (t = "", e = "hu") => (r) => ({
478
+ ...r,
479
+ gameDateDate: m(r.gameDate, "L dddd", t, e),
480
+ gameDateTime: m(r.gameDate, "HH:mm", t, e)
481
+ }), lt = (t) => (e) => ({
482
+ ...e,
483
+ gameResult: Ze(e)
484
+ }), ft = (t) => ({
485
+ ...t,
486
+ opponent: Ve(t)
487
+ }), pt = (t) => ({
488
+ ...t,
489
+ resultType: ze(t)
490
+ }), ht = (t = []) => (e) => {
491
+ var r;
492
+ return {
493
+ ...e,
494
+ [t]: (r = e[t]) == null ? void 0 : r.toUpperCase()
495
+ };
496
+ }, mt = (t = []) => (e) => (t.map((r) => e[r] ? e[`${r}Sec`] = E(e[r]) : e), e), dt = (t = []) => (e) => (t.map((r) => e[r] ? e[`${r}Min`] = Q(e[r]) : e), e), yt = (t = []) => (e) => (t.map((r) => e[`${r}Min`] = V(e[r])), e), Je = (t, e) => new Date(t.gameDate).getTime() - new Date(e.gameDate).getTime(), gt = W([Je, y(h("id")), y(h("gameId"))]), Qe = (t) => (e, r) => e[t].localeCompare(r[t], "hu"), vt = Xe(Qe("name"));
497
+ function Ve(t) {
498
+ var e;
499
+ return [t.isHomeGame ? null : "@", (e = t.opponent) == null ? void 0 : e.shortName].join(" ");
500
+ }
501
+ function Ze(t, e) {
502
+ let r = t == null ? void 0 : t.homeTeamScore, n = t == null ? void 0 : t.awayTeamScore;
503
+ return t.isHomeGame || (r = t == null ? void 0 : t.awayTeamScore, n = t == null ? void 0 : t.homeTeamScore), [r, n].join(":");
504
+ }
505
+ function ze(t) {
506
+ const e = t.gameResult.split(":"), r = e[0] > e[1], n = e[0] < e[1];
507
+ return r && t.isOvertime ? "OTW" : r && t.isShootout ? "SOW" : r ? "W" : n && t.isOvertime ? "OTL" : n && t.isShootout ? "SOL" : n ? "L" : "D";
508
+ }
509
+ export {
510
+ st as I,
511
+ nt as U,
512
+ rt as W,
513
+ lt as a,
514
+ ft as b,
515
+ at as c,
516
+ pt as d,
517
+ mt as e,
518
+ dt as f,
519
+ ot as g,
520
+ yt as h,
521
+ tt as i,
522
+ vt as l,
523
+ it as p,
524
+ ut as r,
525
+ gt as s,
526
+ ct as t,
527
+ ht as u
528
+ };