@mjsz-vbr-elements/core 2.30.2 → 2.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,554 +0,0 @@
1
- /**
2
- * name: @mjsz-vbr-elements/core
3
- * version: v2.30.2 - 24/10/2025, 19:34:53
4
- * (c) 2025
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 G } from "./constants.js";
9
- import { E as f, L as _, H as g, G as m, _ as p, w as v, x as O, M as R, C as o, N, O as b, P as U, Q as j, R as k, D as $, S as H, T as X, U as q, V as Y, W as K, f as h, c as M, B as S, J, F as Q, b as V, a as Z } from "./datetime-D600LvsU.js";
10
- var z = /* @__PURE__ */ f(function(e, r) {
11
- if (e === r)
12
- return r;
13
- function n(c, l) {
14
- if (c > l != l > c)
15
- return l > c ? l : c;
16
- }
17
- var a = n(e, r);
18
- if (a !== void 0)
19
- return a;
20
- var s = n(typeof e, typeof r);
21
- if (s !== void 0)
22
- return s === typeof e ? e : r;
23
- var u = _(e), i = n(u, _(r));
24
- return i !== void 0 && i === u ? e : r;
25
- }), w = /* @__PURE__ */ f(function(e, r) {
26
- return g(m(e), r);
27
- }), ee = /* @__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
- }), D = typeof Symbol < "u" ? Symbol.iterator : "@@iterator";
30
- function te(t, e, r) {
31
- return function(a, s, u) {
32
- if (ee(u))
33
- return t(a, s, u);
34
- if (u == null)
35
- return s;
36
- if (typeof u["fantasy-land/reduce"] == "function")
37
- return e(a, s, u, "fantasy-land/reduce");
38
- if (u[D] != null)
39
- return r(a, s, u[D]());
40
- if (typeof u.next == "function")
41
- return r(a, s, u);
42
- if (typeof u.reduce == "function")
43
- return e(a, s, u, "reduce");
44
- throw new TypeError("reduce: list must be array or iterable");
45
- };
46
- }
47
- function re(t, e, r) {
48
- for (var n = 0, a = r.length; n < a; ) {
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 ne = /* @__PURE__ */ f(function(e, r) {
58
- return R(e.length, function() {
59
- return e.apply(r, arguments);
60
- });
61
- });
62
- function ae(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](ne(t["@@transducer/step"], t), e));
74
- }
75
- var C = /* @__PURE__ */ te(re, se, ae), ue = /* @__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 E(t) {
88
- return new ue(t);
89
- }
90
- var P = /* @__PURE__ */ o(function(t, e, r) {
91
- return C(typeof t == "function" ? E(t) : t, e, r);
92
- }), I = /* @__PURE__ */ p(function(e) {
93
- return function() {
94
- return e;
95
- };
96
- }), ie = /* @__PURE__ */ p(function(e) {
97
- return N(P(z, 0, w("length", e)), function() {
98
- for (var r = 0, n = e.length; r < n; ) {
99
- if (e[r].apply(this, arguments))
100
- return !0;
101
- r += 1;
102
- }
103
- return !1;
104
- });
105
- }), y = /* @__PURE__ */ o(function(e, r, n) {
106
- var a = e(r), s = e(n);
107
- return a < s ? -1 : a > s ? 1 : 0;
108
- }), oe = /* @__PURE__ */ p(function(e) {
109
- return N(e.length, e);
110
- });
111
- function ce(t, e, r) {
112
- if (b(t) && v(r)) {
113
- var n = t < 0 ? r.length + t : t, a = [].concat(r);
114
- return a[n] = e, a;
115
- }
116
- var s = {};
117
- for (var u in r)
118
- s[u] = r[u];
119
- return s[t] = e, s;
120
- }
121
- var le = /* @__PURE__ */ p(function(e) {
122
- return e == null;
123
- }), fe = /* @__PURE__ */ o(function t(e, r, n) {
124
- if (e.length === 0)
125
- return r;
126
- var a = e[0];
127
- if (e.length > 1) {
128
- var s = U(a, n);
129
- (le(s) || typeof s != "object") && (s = b(e[1]) ? [] : {}), r = t(Array.prototype.slice.call(e, 1), r, s);
130
- }
131
- return ce(a, r, n);
132
- }), pe = /* @__PURE__ */ o(function(e, r, n) {
133
- return fe([e], r, n);
134
- });
135
- function me(t) {
136
- 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" : ""));
137
- }
138
- function L(t, e, r) {
139
- if (r || (r = new de()), he(t))
140
- return t;
141
- var n = function(s) {
142
- var u = r.get(t);
143
- if (u)
144
- return u;
145
- r.set(t, s);
146
- for (var i in t)
147
- Object.prototype.hasOwnProperty.call(t, i) && (s[i] = t[i]);
148
- return s;
149
- };
150
- switch (j(t)) {
151
- case "Object":
152
- return n(Object.create(Object.getPrototypeOf(t)));
153
- case "Array":
154
- return n(Array(t.length));
155
- case "Date":
156
- return new Date(t.valueOf());
157
- case "RegExp":
158
- return me(t);
159
- case "Int8Array":
160
- case "Uint8Array":
161
- case "Uint8ClampedArray":
162
- case "Int16Array":
163
- case "Uint16Array":
164
- case "Int32Array":
165
- case "Uint32Array":
166
- case "Float32Array":
167
- case "Float64Array":
168
- case "BigInt64Array":
169
- case "BigUint64Array":
170
- return t.slice();
171
- default:
172
- return t;
173
- }
174
- }
175
- function he(t) {
176
- var e = typeof t;
177
- return t == null || e != "object" && e != "function";
178
- }
179
- var de = /* @__PURE__ */ function() {
180
- function t() {
181
- this.map = {}, this.length = 0;
182
- }
183
- return t.prototype.set = function(e, r) {
184
- var n = this.hash(e), a = this.map[n];
185
- a || (this.map[n] = a = []), a.push([e, r]), this.length += 1;
186
- }, t.prototype.hash = function(e) {
187
- var r = [];
188
- for (var n in e)
189
- r.push(Object.prototype.toString.call(e[n]));
190
- return r.join();
191
- }, t.prototype.get = function(e) {
192
- if (this.length <= 180) {
193
- for (var r in this.map)
194
- for (var u = this.map[r], n = 0; n < u.length; n += 1) {
195
- var a = u[n];
196
- if (a[0] === e)
197
- return a[1];
198
- }
199
- return;
200
- }
201
- var s = this.hash(e), u = this.map[s];
202
- if (u)
203
- for (var n = 0; n < u.length; n += 1) {
204
- var a = u[n];
205
- if (a[0] === e)
206
- return a[1];
207
- }
208
- }, t;
209
- }();
210
- function ye(t, e) {
211
- return function() {
212
- return e.call(this, t.apply(this, arguments));
213
- };
214
- }
215
- function T(t, e) {
216
- return function() {
217
- var r = arguments.length;
218
- if (r === 0)
219
- return e();
220
- var n = arguments[r - 1];
221
- return v(n) || typeof n[t] != "function" ? e.apply(this, arguments) : n[t].apply(n, Array.prototype.slice.call(arguments, 0, r - 1));
222
- };
223
- }
224
- var ge = /* @__PURE__ */ o(/* @__PURE__ */ T("slice", function(e, r, n) {
225
- return Array.prototype.slice.call(n, e, r);
226
- })), ve = /* @__PURE__ */ p(/* @__PURE__ */ T("tail", /* @__PURE__ */ ge(1, 1 / 0)));
227
- function d() {
228
- if (arguments.length === 0)
229
- throw new Error("pipe requires at least one argument");
230
- return R(arguments[0].length, P(ye, arguments[0], ve(arguments)));
231
- }
232
- var Ne = /* @__PURE__ */ p(function(e) {
233
- return O(e) ? e.split("").reverse().join("") : Array.prototype.slice.call(e, 0).reverse();
234
- });
235
- function B() {
236
- if (arguments.length === 0)
237
- throw new Error("compose requires at least one argument");
238
- return d.apply(this, Ne(arguments));
239
- }
240
- var Te = /* @__PURE__ */ function() {
241
- function t(e, r, n, a) {
242
- this.valueFn = e, this.valueAcc = r, this.keyFn = n, this.xf = a, this.inputs = {};
243
- }
244
- return t.prototype["@@transducer/init"] = k.init, t.prototype["@@transducer/result"] = function(e) {
245
- var r;
246
- for (r in this.inputs)
247
- if ($(r, this.inputs) && (e = this.xf["@@transducer/step"](e, this.inputs[r]), e["@@transducer/reduced"])) {
248
- e = e["@@transducer/value"];
249
- break;
250
- }
251
- return this.inputs = null, this.xf["@@transducer/result"](e);
252
- }, t.prototype["@@transducer/step"] = function(e, r) {
253
- var n = this.keyFn(r);
254
- return this.inputs[n] = this.inputs[n] || [n, L(this.valueAcc)], this.inputs[n][1] = this.valueFn(this.inputs[n][1], r), e;
255
- }, t;
256
- }();
257
- function _e(t, e, r) {
258
- return function(n) {
259
- return new Te(t, e, r, n);
260
- };
261
- }
262
- var Se = /* @__PURE__ */ H(4, [], /* @__PURE__ */ X([], _e, function(e, r, n, a) {
263
- var s = E(function(u, i) {
264
- var c = n(i), l = e($(c, u) ? u[c] : L(r), i);
265
- return l && l["@@transducer/reduced"] ? q(u) : (u[c] = l, u);
266
- });
267
- return C(s, {}, a);
268
- })), De = /* @__PURE__ */ o(function(e, r, n) {
269
- var a = e(r), s = e(n);
270
- return a > s ? -1 : a < s ? 1 : 0;
271
- }), Ie = /* @__PURE__ */ f(/* @__PURE__ */ T("groupBy", /* @__PURE__ */ Se(function(t, e) {
272
- return t.push(e), t;
273
- }, []))), Ae = /* @__PURE__ */ o(function(e, r, n) {
274
- return N(Math.max(e.length, r.length, n.length), function() {
275
- return e.apply(this, arguments) ? r.apply(this, arguments) : n.apply(this, arguments);
276
- });
277
- }), Oe = /* @__PURE__ */ f(Y), Re = /* @__PURE__ */ f(function(e, r) {
278
- return function(n) {
279
- return function(a) {
280
- return g(function(s) {
281
- return r(s, a);
282
- }, n(e(a)));
283
- };
284
- };
285
- }), be = /* @__PURE__ */ p(function(e) {
286
- return Re(m(e), pe(e));
287
- }), W = function(t) {
288
- return {
289
- value: t,
290
- map: function(e) {
291
- return W(e(t));
292
- }
293
- };
294
- }, $e = /* @__PURE__ */ o(function(e, r, n) {
295
- return e(function(a) {
296
- return W(r(a));
297
- })(n).value;
298
- }), Me = /* @__PURE__ */ o(function(e, r, n) {
299
- return n.replace(e, r);
300
- }), Ce = /* @__PURE__ */ f(function(e, r) {
301
- return Array.prototype.slice.call(r, 0).sort(e);
302
- }), x = /* @__PURE__ */ f(function(e, r) {
303
- return Array.prototype.slice.call(r, 0).sort(function(n, a) {
304
- for (var s = 0, u = 0; s === 0 && u < e.length; )
305
- s = e[u](n, a), u += 1;
306
- return s;
307
- });
308
- }), A = /* @__PURE__ */ K(0, "toLowerCase");
309
- function Ue(t, e = "body") {
310
- if (!t)
311
- return;
312
- if (typeof e != "string") {
313
- e?.append(t);
314
- return;
315
- }
316
- document.querySelector(e)?.append(t);
317
- }
318
- function je(t, e = () => ({})) {
319
- return t.slice().sort((r, n) => {
320
- const a = e(r), s = e(n);
321
- if (a === null || s === null)
322
- return 0;
323
- const u = a.compareDocumentPosition(s);
324
- return u & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : u & Node.DOCUMENT_POSITION_PRECEDING ? 1 : 0;
325
- });
326
- }
327
- function ke(t = []) {
328
- return {
329
- result: [...t],
330
- filteredRowsLength: 0,
331
- isFiltered: !1,
332
- value() {
333
- return {
334
- rows: this.result,
335
- totalItems: this.isFiltered ? this.filteredRowsLength : t.length,
336
- currentItems: this.currentItems
337
- };
338
- },
339
- filter(e, r = [], n = !1) {
340
- if (e) {
341
- const a = r.map(
342
- (i) => n ? d(J(i), S(e)) : d(m(i), A, Oe(A(e)))
343
- ), s = oe((i) => i.name ? $e(be("name"), Me(",", ""), i) : i), u = Q(d(s, ie([...a])), this.result);
344
- this.isFiltered = !0, this.filteredRowsLength = u.length, this.result = u;
345
- }
346
- return this;
347
- },
348
- sorted(e) {
349
- if (!e.sortTarget)
350
- return this;
351
- if (e.orders[0].direction === F)
352
- return this;
353
- const r = Ae(S(G), I(y), I(De));
354
- return this.result = x(e.orders.map((n) => B(r(n.direction), m)(n.target)))(this.result), this;
355
- },
356
- addIndex(e = null) {
357
- return this.result.reduce((r, n, a) => {
358
- const s = r[r.length - 1] || [], u = e && s[e] === n[e];
359
- return n.index = u ? s.index : a + 1, n.indexClass = u ? "is-duplicated" : null, r.push(n), r;
360
- }, []), this;
361
- },
362
- addContinuousIndex() {
363
- return this.result = this.result.map((e, r) => ({
364
- ...e,
365
- index: r + 1
366
- })), this;
367
- },
368
- pagination(e, r) {
369
- if (!r)
370
- return this;
371
- e = Number(e), r = Number(r);
372
- const n = (e - 1) * r, a = n + r;
373
- return this.result = this.result.slice(n, a), this;
374
- },
375
- more(e, r) {
376
- return this.result = this.result.slice(Number(e), Number(r)), this;
377
- },
378
- playerName() {
379
- return this.result = this.result.map((e) => ({
380
- ...e,
381
- name: xe(e)
382
- })), this;
383
- },
384
- teamName() {
385
- return this.result = this.result.map((e) => ({
386
- ...e,
387
- teamName: e.team.longName
388
- })), this;
389
- },
390
- schedule(e = "", r = "hu") {
391
- return this.result = this.result.map((n) => ({
392
- ...n,
393
- gameResult: `${n.homeTeamScore}-${n.awayTeamScore}`,
394
- gameDateDate: h(n.gameDate, "L dddd", e, r),
395
- gameDateTime: h(n.gameDate, "HH:mm", e, r)
396
- })), this;
397
- },
398
- gameDateFilter(e) {
399
- return e === null ? this : (this.result = this.result.filter((r) => new Date(r.gameDate).getMonth() === e), this);
400
- },
401
- convertTimes(e = []) {
402
- return this.result = this.result.map((r) => (e.map((n) => r[n] ? r[`${n}Sec`] = M(r[n]) : r), r)), this;
403
- },
404
- groupByDays() {
405
- return this.currentItems = this.result.length, this.result = Ie((e) => h(e.gameDate, "YYYY-MM-DD"))(this.result), this;
406
- },
407
- slice(e = 3) {
408
- return this.result = this.result.slice(0, e), this;
409
- }
410
- };
411
- }
412
- const He = (t, ...e) => g(B(...e))(t);
413
- function Xe(t) {
414
- return {
415
- ...t,
416
- ...t.lastName && t.firstName && { name: `${t.lastName} ${t.firstName}` },
417
- ...t.player?.playerId && { name: `${t.player.lastName} ${t.player.firstName}` },
418
- ...t.player?.id && { name: `${t.player.lastName} ${t.player.firstName}` },
419
- ...t.player?.nationality && {
420
- name: t.player?.nationality.includes("hu") ? `${t.player.lastName} ${t.player.firstName}` : `${t.player.lastName}, ${t.player.firstName}`
421
- },
422
- ...t.nationality && {
423
- name: t.nationality.includes("hu") ? `${t.lastName} ${t.firstName}` : `${t.lastName}, ${t.firstName}`
424
- }
425
- };
426
- }
427
- function qe(t) {
428
- return {
429
- ...t,
430
- ...t?.team?.id && { teamName: t.team.longName }
431
- };
432
- }
433
- function Ye(t = "", e = "hu") {
434
- return (r) => ({
435
- ...r,
436
- gameDateDate: h(r.gameDate, "L dddd", t, e),
437
- gameDateTime: h(r.gameDate, "HH:mm", t, e)
438
- });
439
- }
440
- function Ke(t) {
441
- return (e) => ({
442
- ...e,
443
- gameResult: Be(e)
444
- });
445
- }
446
- function Je(t) {
447
- return {
448
- ...t,
449
- opponent: Le(t)
450
- };
451
- }
452
- function Qe(t) {
453
- return {
454
- ...t,
455
- resultType: We(t)
456
- };
457
- }
458
- function Ve(t) {
459
- return {
460
- ...t,
461
- rowClasses: t.optional ? "is-optional" : ""
462
- };
463
- }
464
- function Ze(t = []) {
465
- return (e) => ({
466
- ...e,
467
- [t]: e[t]?.toUpperCase()
468
- });
469
- }
470
- function ze(t = []) {
471
- return (e) => (t.map((r) => e[r] ? e[`${r}Sec`] = M(e[r]) : e), e);
472
- }
473
- function we(t = []) {
474
- return (e) => (t.map((r) => e[r] ? e[`${r}Min`] = V(e[r]) : e), e);
475
- }
476
- function et(t = []) {
477
- return (e) => (t.map((r) => e[`${r}Min`] = Z(e[r])), e);
478
- }
479
- function tt(t) {
480
- return {
481
- ...t,
482
- periodResults: t.result?.match(/\(.*?\)/)?.[0] ?? ""
483
- };
484
- }
485
- const Ee = (t, e) => new Date(t.gameDate).getTime() - new Date(e.gameDate).getTime(), rt = x([Ee, y(m("id")), y(m("gameId"))]), Pe = (t) => (e, r) => e[t].localeCompare(r[t], "hu"), nt = Ce(Pe("name"));
486
- function Le(t) {
487
- return [t.isHomeGame ? null : "@", t.opponent?.shortName].join(" ");
488
- }
489
- function Be(t) {
490
- let e = t?.homeTeamScore, r = t?.awayTeamScore;
491
- return t.isHomeGame || (e = t?.awayTeamScore, r = t?.homeTeamScore), [e, r].join(":");
492
- }
493
- function We(t) {
494
- const e = t.gameResult.split(":"), r = e[0] > e[1], n = e[0] < e[1];
495
- return r && t.isOvertime ? "OTW" : r && t.isShootout ? "SOW" : r ? "W" : n && t.isOvertime ? "OTL" : n && t.isShootout ? "SOL" : n ? "L" : "D";
496
- }
497
- function at(t) {
498
- return t.map((e) => ({
499
- phaseId: e.phaseId,
500
- phaseName: Object.values({
501
- phaseName: e.phaseName,
502
- ...e.phaseType?.phaseTypeName && e.phaseType.phaseTypeName !== e.phaseName && {
503
- phaseTypeName: e.phaseType.phaseTypeName
504
- },
505
- ...e.phaseSubType?.phaseSubTypeName && { phaseSubTypeName: e.phaseSubType.phaseSubTypeName }
506
- }).join("-")
507
- }));
508
- }
509
- function xe(t) {
510
- return t.player ? t.player.nationality.includes("hu") ? `${t.player.lastName} ${t.player.firstName}` : `${t.player.lastName}, ${t.player.firstName}` : `${t.lastName} ${t.firstName}`;
511
- }
512
- class st extends Error {
513
- constructor(e, r = {}) {
514
- const { key: n, cause: a } = r;
515
- super(e), this.name = "WidgetError", this.key = n, this.cause = a;
516
- }
517
- }
518
- const ut = {
519
- message: "Undefined Column name Message",
520
- options: {
521
- key: "undefined-column",
522
- cause: {}
523
- }
524
- }, it = {
525
- message: "Invalid season name",
526
- options: {
527
- key: "invalid-season-name",
528
- cause: {}
529
- }
530
- };
531
- export {
532
- it as I,
533
- ut as U,
534
- st as W,
535
- Ke as a,
536
- Je as b,
537
- ke as c,
538
- Qe as d,
539
- ze as e,
540
- we as f,
541
- Ye as g,
542
- et as h,
543
- tt as i,
544
- rt as j,
545
- at as k,
546
- nt as l,
547
- Ue as m,
548
- je as n,
549
- Xe as p,
550
- He as r,
551
- Ve as s,
552
- qe as t,
553
- Ze as u
554
- };