playlight-sdk 0.2.0 → 0.2.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.
package/dist/playlight-sdk.es.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
1
2
|
var __typeError = (msg) => {
|
|
2
3
|
throw TypeError(msg);
|
|
3
4
|
};
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
7
|
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
8
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
5
9
|
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
10
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
6
11
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
7
|
-
var _a, _PlayLightAPI_instances,
|
|
12
|
+
var _e2, _t2, _n, _ResizeObserverSingleton_instances, r_fn, _a, _PlayLightAPI_instances, o_fn, _b, _PlaylightSDK_instances, s_fn, _c;
|
|
8
13
|
const t = false;
|
|
9
14
|
var n = Array.isArray, o = Array.prototype.indexOf, s = Array.from, i = Object.defineProperty, a = Object.getOwnPropertyDescriptor, l = Object.getOwnPropertyDescriptors, c = Object.prototype, u = Array.prototype, d = Object.getPrototypeOf;
|
|
10
15
|
function is_function(e2) {
|
|
@@ -29,24 +34,24 @@ function safe_equals(e2) {
|
|
|
29
34
|
return !safe_not_equal(e2, this.v);
|
|
30
35
|
}
|
|
31
36
|
let M = false;
|
|
32
|
-
const
|
|
37
|
+
const I = Symbol();
|
|
33
38
|
function lifecycle_outside_component(e2) {
|
|
34
39
|
throw new Error("https://svelte.dev/e/lifecycle_outside_component");
|
|
35
40
|
}
|
|
36
|
-
let
|
|
41
|
+
let T = null;
|
|
37
42
|
function set_component_context(e2) {
|
|
38
|
-
|
|
43
|
+
T = e2;
|
|
39
44
|
}
|
|
40
45
|
function push(e2, t2 = false, n2) {
|
|
41
|
-
|
|
42
|
-
p:
|
|
46
|
+
T = {
|
|
47
|
+
p: T,
|
|
43
48
|
c: null,
|
|
44
49
|
e: null,
|
|
45
50
|
m: false,
|
|
46
51
|
s: e2,
|
|
47
52
|
x: null,
|
|
48
53
|
l: null
|
|
49
|
-
}, M && !t2 && (
|
|
54
|
+
}, M && !t2 && (T.l = {
|
|
50
55
|
s: null,
|
|
51
56
|
u: null,
|
|
52
57
|
r1: [],
|
|
@@ -54,7 +59,7 @@ function push(e2, t2 = false, n2) {
|
|
|
54
59
|
});
|
|
55
60
|
}
|
|
56
61
|
function pop(e2) {
|
|
57
|
-
const t2 =
|
|
62
|
+
const t2 = T;
|
|
58
63
|
if (null !== t2) {
|
|
59
64
|
const e3 = t2.e;
|
|
60
65
|
if (null !== e3) {
|
|
@@ -69,12 +74,12 @@ function pop(e2) {
|
|
|
69
74
|
set_active_effect(n2), set_active_reaction(o2);
|
|
70
75
|
}
|
|
71
76
|
}
|
|
72
|
-
|
|
77
|
+
T = t2.p, t2.m = true;
|
|
73
78
|
}
|
|
74
79
|
return {};
|
|
75
80
|
}
|
|
76
81
|
function is_runes() {
|
|
77
|
-
return !M || null !==
|
|
82
|
+
return !M || null !== T && null === T.l;
|
|
78
83
|
}
|
|
79
84
|
function source(e2, t2) {
|
|
80
85
|
return {
|
|
@@ -96,7 +101,7 @@ function mutable_source(e2, t2 = false) {
|
|
|
96
101
|
const n2 = source(e2);
|
|
97
102
|
return t2 || (n2.equals = safe_equals), // bind the signal to the component context, in case we need to
|
|
98
103
|
// track updates to trigger beforeUpdate/afterUpdate callbacks
|
|
99
|
-
M && null !==
|
|
104
|
+
M && null !== T && null !== T.l && ((_a2 = T.l).s ?? (_a2.s = [])).push(n2), n2;
|
|
100
105
|
}
|
|
101
106
|
function mutable_state(e2, t2 = false) {
|
|
102
107
|
return /* @__PURE__ */ push_derived_source(/* @__PURE__ */ mutable_source(e2, t2));
|
|
@@ -186,7 +191,7 @@ function proxy(e2, t2 = null, o2) {
|
|
|
186
191
|
},
|
|
187
192
|
deleteProperty(e3, t3) {
|
|
188
193
|
var n2 = l2.get(t3);
|
|
189
|
-
if (void 0 === n2) t3 in e3 && l2.set(t3, source(
|
|
194
|
+
if (void 0 === n2) t3 in e3 && l2.set(t3, source(I));
|
|
190
195
|
else {
|
|
191
196
|
if (f2 && "string" == typeof t3) {
|
|
192
197
|
var o3 = (
|
|
@@ -195,7 +200,7 @@ function proxy(e2, t2 = null, o2) {
|
|
|
195
200
|
), s3 = Number(t3);
|
|
196
201
|
Number.isInteger(s3) && s3 < o3.v && set(o3, s3);
|
|
197
202
|
}
|
|
198
|
-
set(n2,
|
|
203
|
+
set(n2, I), update_version(p2);
|
|
199
204
|
}
|
|
200
205
|
return true;
|
|
201
206
|
},
|
|
@@ -205,10 +210,10 @@ function proxy(e2, t2 = null, o2) {
|
|
|
205
210
|
var s3 = l2.get(n2), c2 = n2 in t3;
|
|
206
211
|
if (
|
|
207
212
|
// create a source, but only if it's an own property and not a prototype property
|
|
208
|
-
void 0 !== s3 || c2 && !((_a2 = a(t3, n2)) == null ? void 0 : _a2.writable) || (s3 = source(proxy(c2 ? t3[n2] :
|
|
213
|
+
void 0 !== s3 || c2 && !((_a2 = a(t3, n2)) == null ? void 0 : _a2.writable) || (s3 = source(proxy(c2 ? t3[n2] : I, i2)), l2.set(n2, s3)), void 0 !== s3
|
|
209
214
|
) {
|
|
210
215
|
var u2 = get$1(s3);
|
|
211
|
-
return u2 ===
|
|
216
|
+
return u2 === I ? void 0 : u2;
|
|
212
217
|
}
|
|
213
218
|
return Reflect.get(t3, n2, o3);
|
|
214
219
|
},
|
|
@@ -219,7 +224,7 @@ function proxy(e2, t2 = null, o2) {
|
|
|
219
224
|
o3 && (n2.value = get$1(o3));
|
|
220
225
|
} else if (void 0 === n2) {
|
|
221
226
|
var s3 = l2.get(t3), i3 = s3 == null ? void 0 : s3.v;
|
|
222
|
-
if (void 0 !== s3 && i3 !==
|
|
227
|
+
if (void 0 !== s3 && i3 !== I) return {
|
|
223
228
|
enumerable: true,
|
|
224
229
|
configurable: true,
|
|
225
230
|
value: i3,
|
|
@@ -231,8 +236,8 @@ function proxy(e2, t2 = null, o2) {
|
|
|
231
236
|
has(e3, t3) {
|
|
232
237
|
var _a2;
|
|
233
238
|
if (t3 === k) return true;
|
|
234
|
-
var n2 = l2.get(t3), o3 = void 0 !== n2 && n2.v !==
|
|
235
|
-
if ((void 0 !== n2 || null !== R && (!o3 || ((_a2 = a(e3, t3)) == null ? void 0 : _a2.writable))) && (void 0 === n2 && (n2 = source(o3 ? proxy(e3[t3], i2) :
|
|
239
|
+
var n2 = l2.get(t3), o3 = void 0 !== n2 && n2.v !== I || Reflect.has(e3, t3);
|
|
240
|
+
if ((void 0 !== n2 || null !== R && (!o3 || ((_a2 = a(e3, t3)) == null ? void 0 : _a2.writable))) && (void 0 === n2 && (n2 = source(o3 ? proxy(e3[t3], i2) : I), l2.set(t3, n2)), get$1(n2) === I)) return false;
|
|
236
241
|
return o3;
|
|
237
242
|
},
|
|
238
243
|
set(e3, t3, n2, o3) {
|
|
@@ -241,12 +246,12 @@ function proxy(e2, t2 = null, o2) {
|
|
|
241
246
|
if (f2 && "length" === t3) for (var u2 = n2; u2 < /** @type {Source<number>} */
|
|
242
247
|
s3.v; u2 += 1) {
|
|
243
248
|
var d2 = l2.get(u2 + "");
|
|
244
|
-
void 0 !== d2 ? set(d2,
|
|
249
|
+
void 0 !== d2 ? set(d2, I) : u2 in e3 && // If the item exists in the original, we need to create a uninitialized source,
|
|
245
250
|
// else a later read of the property would result in a source being created with
|
|
246
251
|
// the value of the original item at that index.
|
|
247
|
-
(d2 = source(
|
|
252
|
+
(d2 = source(I), l2.set(u2 + "", d2));
|
|
248
253
|
}
|
|
249
|
-
void 0 === s3 ? c2 && !((_a2 = a(e3, t3)) == null ? void 0 : _a2.writable) || (set(s3 = source(void 0), proxy(n2, i2)), l2.set(t3, s3)) : (c2 = s3.v !==
|
|
254
|
+
void 0 === s3 ? c2 && !((_a2 = a(e3, t3)) == null ? void 0 : _a2.writable) || (set(s3 = source(void 0), proxy(n2, i2)), l2.set(t3, s3)) : (c2 = s3.v !== I, set(s3, proxy(n2, i2)));
|
|
250
255
|
var _2 = Reflect.getOwnPropertyDescriptor(e3, t3);
|
|
251
256
|
if ((_2 == null ? void 0 : _2.set) && _2.set.call(o3, n2), !c2) {
|
|
252
257
|
if (f2 && "string" == typeof t3) {
|
|
@@ -264,9 +269,9 @@ function proxy(e2, t2 = null, o2) {
|
|
|
264
269
|
get$1(p2);
|
|
265
270
|
var t3 = Reflect.ownKeys(e3).filter((e4) => {
|
|
266
271
|
var t4 = l2.get(e4);
|
|
267
|
-
return void 0 === t4 || t4.v !==
|
|
272
|
+
return void 0 === t4 || t4.v !== I;
|
|
268
273
|
});
|
|
269
|
-
for (var [n2, o3] of l2) o3.v ===
|
|
274
|
+
for (var [n2, o3] of l2) o3.v === I || n2 in e3 || t3.push(n2);
|
|
270
275
|
return t3;
|
|
271
276
|
},
|
|
272
277
|
setPrototypeOf() {
|
|
@@ -280,17 +285,17 @@ function proxy(e2, t2 = null, o2) {
|
|
|
280
285
|
function update_version(e2, t2 = 1) {
|
|
281
286
|
set(e2, e2.v + t2);
|
|
282
287
|
}
|
|
283
|
-
var q, P, D,
|
|
288
|
+
var O, q, P, D, W;
|
|
284
289
|
function create_text(e2 = "") {
|
|
285
290
|
return document.createTextNode(e2);
|
|
286
291
|
}
|
|
287
292
|
// @__NO_SIDE_EFFECTS__
|
|
288
293
|
function get_first_child(e2) {
|
|
289
|
-
return
|
|
294
|
+
return D.call(e2);
|
|
290
295
|
}
|
|
291
296
|
// @__NO_SIDE_EFFECTS__
|
|
292
297
|
function get_next_sibling(e2) {
|
|
293
|
-
return
|
|
298
|
+
return W.call(e2);
|
|
294
299
|
}
|
|
295
300
|
function child(e2, t2) {
|
|
296
301
|
return /* @__PURE__ */ get_first_child(e2);
|
|
@@ -323,7 +328,7 @@ function derived(e2) {
|
|
|
323
328
|
R.f |= x
|
|
324
329
|
);
|
|
325
330
|
return {
|
|
326
|
-
ctx:
|
|
331
|
+
ctx: T,
|
|
327
332
|
deps: null,
|
|
328
333
|
effects: null,
|
|
329
334
|
equals,
|
|
@@ -401,7 +406,7 @@ function validate_effect(e2) {
|
|
|
401
406
|
}
|
|
402
407
|
function create_effect(e2, t2, n2, o2 = true) {
|
|
403
408
|
var s2 = R, i2 = {
|
|
404
|
-
ctx:
|
|
409
|
+
ctx: T,
|
|
405
410
|
deps: null,
|
|
406
411
|
nodes_start: null,
|
|
407
412
|
nodes_end: null,
|
|
@@ -439,10 +444,10 @@ function teardown(e2) {
|
|
|
439
444
|
return set_signal_status(t2, h), t2.teardown = e2, t2;
|
|
440
445
|
}
|
|
441
446
|
function user_effect(e2) {
|
|
442
|
-
if (validate_effect(), !(null !== R && !!(R.f & f) && null !==
|
|
447
|
+
if (validate_effect(), !(null !== R && !!(R.f & f) && null !== T && !T.m)) return effect(e2);
|
|
443
448
|
var t2 = (
|
|
444
449
|
/** @type {ComponentContext} */
|
|
445
|
-
|
|
450
|
+
T
|
|
446
451
|
);
|
|
447
452
|
(t2.e ?? (t2.e = [])).push({
|
|
448
453
|
fn: e2,
|
|
@@ -456,7 +461,7 @@ function effect(e2) {
|
|
|
456
461
|
function legacy_pre_effect(e2, t2) {
|
|
457
462
|
var n2 = (
|
|
458
463
|
/** @type {ComponentContextLegacy} */
|
|
459
|
-
|
|
464
|
+
T
|
|
460
465
|
), o2 = {
|
|
461
466
|
effect: null,
|
|
462
467
|
ran: false
|
|
@@ -470,7 +475,7 @@ function legacy_pre_effect(e2, t2) {
|
|
|
470
475
|
function legacy_pre_effect_reset() {
|
|
471
476
|
var e2 = (
|
|
472
477
|
/** @type {ComponentContextLegacy} */
|
|
473
|
-
|
|
478
|
+
T
|
|
474
479
|
);
|
|
475
480
|
render_effect(() => {
|
|
476
481
|
if (get$1(e2.l.r2)) {
|
|
@@ -581,21 +586,21 @@ function resume_children(e2, t2) {
|
|
|
581
586
|
if (null !== e2.transitions) for (const n3 of e2.transitions) (n3.is_global || t2) && n3.in();
|
|
582
587
|
}
|
|
583
588
|
}
|
|
584
|
-
let
|
|
589
|
+
let z = [], E = [];
|
|
585
590
|
function run_micro_tasks() {
|
|
586
|
-
var e2 =
|
|
587
|
-
|
|
591
|
+
var e2 = z;
|
|
592
|
+
z = [], run_all(e2);
|
|
588
593
|
}
|
|
589
594
|
function queue_micro_task(e2) {
|
|
590
|
-
0 ===
|
|
595
|
+
0 === z.length && queueMicrotask(run_micro_tasks), z.push(e2);
|
|
591
596
|
}
|
|
592
597
|
function flush_tasks() {
|
|
593
|
-
|
|
594
|
-
var e2 =
|
|
595
|
-
|
|
598
|
+
z.length > 0 && run_micro_tasks(), E.length > 0 && function run_idle_tasks() {
|
|
599
|
+
var e2 = E;
|
|
600
|
+
E = [], run_all(e2);
|
|
596
601
|
}();
|
|
597
602
|
}
|
|
598
|
-
let
|
|
603
|
+
let j = false, N = false, B = null, A = false, L = false;
|
|
599
604
|
function set_is_destroying_effect(e2) {
|
|
600
605
|
L = e2;
|
|
601
606
|
}
|
|
@@ -645,14 +650,14 @@ function check_dirtiness(e2) {
|
|
|
645
650
|
return false;
|
|
646
651
|
}
|
|
647
652
|
function handle_error(e2, t2, n2, o2) {
|
|
648
|
-
if (
|
|
649
|
-
if (null === n2 && (
|
|
653
|
+
if (j) {
|
|
654
|
+
if (null === n2 && (j = false), /**
|
|
650
655
|
* @param {Effect} effect
|
|
651
656
|
*/
|
|
652
657
|
function should_rethrow_error(e3) {
|
|
653
658
|
return !(e3.f & $ || null !== e3.parent && e3.parent.f & _);
|
|
654
659
|
}(t2)) throw e2;
|
|
655
|
-
} else null !== n2 && (
|
|
660
|
+
} else null !== n2 && (j = true), function propagate_error(e3, t3) {
|
|
656
661
|
for (var n3 = t3; null !== n3; ) {
|
|
657
662
|
if (n3.f & _) try {
|
|
658
663
|
return void n3.fn(e3);
|
|
@@ -661,7 +666,7 @@ function handle_error(e2, t2, n2, o2) {
|
|
|
661
666
|
}
|
|
662
667
|
n3 = n3.parent;
|
|
663
668
|
}
|
|
664
|
-
throw
|
|
669
|
+
throw j = false, e3;
|
|
665
670
|
}(e2, t2);
|
|
666
671
|
}
|
|
667
672
|
function schedule_possible_effect_self_invalidation(e2, t2, n2 = true) {
|
|
@@ -681,9 +686,9 @@ function schedule_possible_effect_self_invalidation(e2, t2, n2 = true) {
|
|
|
681
686
|
}
|
|
682
687
|
function update_reaction(e2) {
|
|
683
688
|
var _a2;
|
|
684
|
-
var t2 = V, n2 = K, o2 = Y, s2 = F, i2 = Q, a2 = U, l2 =
|
|
689
|
+
var t2 = V, n2 = K, o2 = Y, s2 = F, i2 = Q, a2 = U, l2 = T, c2 = H, u2 = e2.f;
|
|
685
690
|
V = /** @type {null | Value[]} */
|
|
686
|
-
null, K = 0, Y = null, Q = !!(u2 & g) && (H || !
|
|
691
|
+
null, K = 0, Y = null, Q = !!(u2 & g) && (H || !A || null === F), F = 96 & u2 ? null : e2, U = null, set_component_context(e2.ctx), H = false, J++;
|
|
687
692
|
try {
|
|
688
693
|
var d2 = (
|
|
689
694
|
/** @type {Function} */
|
|
@@ -742,8 +747,8 @@ function update_effect(e2) {
|
|
|
742
747
|
var n2 = e2.f;
|
|
743
748
|
if (!(n2 & $)) {
|
|
744
749
|
set_signal_status(e2, h);
|
|
745
|
-
var o2 = R, s2 =
|
|
746
|
-
R = e2,
|
|
750
|
+
var o2 = R, s2 = T, i2 = A;
|
|
751
|
+
R = e2, A = true;
|
|
747
752
|
try {
|
|
748
753
|
16 & n2 ? function destroy_block_effect_children(e3) {
|
|
749
754
|
for (var t2 = e3.first; null !== t2; ) {
|
|
@@ -758,7 +763,7 @@ function update_effect(e2) {
|
|
|
758
763
|
} catch (t2) {
|
|
759
764
|
handle_error(t2, e2, o2, s2 || e2.ctx);
|
|
760
765
|
} finally {
|
|
761
|
-
|
|
766
|
+
A = i2, R = o2;
|
|
762
767
|
}
|
|
763
768
|
}
|
|
764
769
|
}
|
|
@@ -768,15 +773,15 @@ function infinite_loop_guard() {
|
|
|
768
773
|
throw new Error("https://svelte.dev/e/effect_update_depth_exceeded");
|
|
769
774
|
}();
|
|
770
775
|
} catch (e2) {
|
|
771
|
-
if (null ===
|
|
772
|
-
handle_error(e2,
|
|
776
|
+
if (null === B) throw e2;
|
|
777
|
+
handle_error(e2, B, null);
|
|
773
778
|
}
|
|
774
779
|
}
|
|
775
780
|
function flush_queued_root_effects() {
|
|
776
|
-
var e2 =
|
|
781
|
+
var e2 = A;
|
|
777
782
|
try {
|
|
778
783
|
var t2 = 0;
|
|
779
|
-
for (
|
|
784
|
+
for (A = true; G.length > 0; ) {
|
|
780
785
|
t2++ > 1e3 && infinite_loop_guard();
|
|
781
786
|
var n2 = G, o2 = n2.length;
|
|
782
787
|
G = [];
|
|
@@ -785,7 +790,7 @@ function flush_queued_root_effects() {
|
|
|
785
790
|
}
|
|
786
791
|
}
|
|
787
792
|
} finally {
|
|
788
|
-
|
|
793
|
+
N = false, A = e2, B = null;
|
|
789
794
|
}
|
|
790
795
|
}
|
|
791
796
|
function flush_queued_effects(e2) {
|
|
@@ -811,8 +816,8 @@ function flush_queued_effects(e2) {
|
|
|
811
816
|
}
|
|
812
817
|
}
|
|
813
818
|
function schedule_effect(e2) {
|
|
814
|
-
|
|
815
|
-
for (var t2 =
|
|
819
|
+
N || (N = true, queueMicrotask(flush_queued_root_effects));
|
|
820
|
+
for (var t2 = B = e2; null !== t2.parent; ) {
|
|
816
821
|
var n2 = (t2 = t2.parent).f;
|
|
817
822
|
if (96 & n2) {
|
|
818
823
|
if (!(n2 & h)) return;
|
|
@@ -852,7 +857,7 @@ async function tick() {
|
|
|
852
857
|
await Promise.resolve(), // By calling flushSync we guarantee that any pending state changes are applied after one tick.
|
|
853
858
|
// TODO look into whether we can make flushing subsequent updates synchronously in the future.
|
|
854
859
|
function flushSync(e2) {
|
|
855
|
-
for (flush_tasks(); G.length > 0; )
|
|
860
|
+
for (flush_tasks(); G.length > 0; ) N = true, flush_queued_root_effects(), flush_tasks();
|
|
856
861
|
}();
|
|
857
862
|
}
|
|
858
863
|
function get$1(e2) {
|
|
@@ -1103,7 +1108,7 @@ function template(e2, t2) {
|
|
|
1103
1108
|
/* @__PURE__ */ get_first_child(n2)));
|
|
1104
1109
|
var t3 = (
|
|
1105
1110
|
/** @type {TemplateNode} */
|
|
1106
|
-
s2 ||
|
|
1111
|
+
s2 || P ? document.importNode(n2, true) : n2.cloneNode(true)
|
|
1107
1112
|
);
|
|
1108
1113
|
o2 ? assign_nodes(
|
|
1109
1114
|
/** @type {TemplateNode} */
|
|
@@ -1166,11 +1171,11 @@ function mount(e2, t2) {
|
|
|
1166
1171
|
* where these globals are not available while avoiding a separate server entry point
|
|
1167
1172
|
*/
|
|
1168
1173
|
function init_operations() {
|
|
1169
|
-
if (void 0 ===
|
|
1170
|
-
|
|
1174
|
+
if (void 0 === O) {
|
|
1175
|
+
O = window, q = document, P = /Firefox/.test(navigator.userAgent);
|
|
1171
1176
|
var e4 = Element.prototype, t4 = Node.prototype;
|
|
1172
|
-
|
|
1173
|
-
|
|
1177
|
+
D = a(t4, "firstChild").get, // @ts-ignore
|
|
1178
|
+
W = a(t4, "nextSibling").get, // the following assignments improve perf of lookups on DOM nodes
|
|
1174
1179
|
// @ts-expect-error
|
|
1175
1180
|
e4.__click = void 0, // @ts-expect-error
|
|
1176
1181
|
e4.__className = void 0, // @ts-expect-error
|
|
@@ -1218,7 +1223,7 @@ function mount(e2, t2) {
|
|
|
1218
1223
|
var s2 = n2 ?? t3.appendChild(create_text());
|
|
1219
1224
|
return branch(() => {
|
|
1220
1225
|
l2 && (push({}), /** @type {ComponentContext} */
|
|
1221
|
-
|
|
1226
|
+
T.c = l2);
|
|
1222
1227
|
i2 && // We can't spread the object or else we'd lose the state proxy stuff, if it is one
|
|
1223
1228
|
/** @type {any} */
|
|
1224
1229
|
(o2.$$events = i2), ae = c2, // @ts-expect-error the public typings are not what the actual function looks like
|
|
@@ -1243,7 +1248,7 @@ function mount(e2, t2) {
|
|
|
1243
1248
|
const le = /* @__PURE__ */ new Map();
|
|
1244
1249
|
let ce = /* @__PURE__ */ new WeakMap();
|
|
1245
1250
|
function if_block(e2, t2, [n2, o2] = [0, 0]) {
|
|
1246
|
-
var s2 = e2, i2 = null, a2 = null, l2 =
|
|
1251
|
+
var s2 = e2, i2 = null, a2 = null, l2 = I, c2 = false;
|
|
1247
1252
|
const set_branch = (e3, t3 = true) => {
|
|
1248
1253
|
c2 = true, update_branch(t3, e3);
|
|
1249
1254
|
}, update_branch = (e3, t3) => {
|
|
@@ -1300,10 +1305,10 @@ function each(e2, t2, o2, i2, a2, l2 = null) {
|
|
|
1300
1305
|
if (x2.length < k2.length) {
|
|
1301
1306
|
var C2, S2 = k2[0];
|
|
1302
1307
|
w2 = S2.prev;
|
|
1303
|
-
var M2 = x2[0],
|
|
1308
|
+
var M2 = x2[0], I2 = x2[x2.length - 1];
|
|
1304
1309
|
for (C2 = 0; C2 < x2.length; C2 += 1) move(x2[C2], S2, n3);
|
|
1305
1310
|
for (C2 = 0; C2 < k2.length; C2 += 1) c3.delete(k2[C2]);
|
|
1306
|
-
link(t3, M2.prev,
|
|
1311
|
+
link(t3, M2.prev, I2.next), link(t3, w2, M2), link(t3, I2, S2), $2 = S2, w2 = I2, _2 -= 1, x2 = [], k2 = [];
|
|
1307
1312
|
} else
|
|
1308
1313
|
c3.delete(p3), move(p3, $2, n3), link(t3, p3.prev, p3.next), link(t3, p3, null === w2 ? t3.first : w2.next), link(t3, w2, p3), w2 = p3;
|
|
1309
1314
|
continue;
|
|
@@ -1321,14 +1326,14 @@ function each(e2, t2, o2, i2, a2, l2 = null) {
|
|
|
1321
1326
|
) : n3, t3, w2, null === w2 ? t3.first : w2.next, d3, f3, _2, o3, i3, l3), m2.set(f3, w2), x2 = [], k2 = [], $2 = w2.next;
|
|
1322
1327
|
}
|
|
1323
1328
|
if (null !== $2 || void 0 !== c3) {
|
|
1324
|
-
for (var
|
|
1325
|
-
$2.e.f & y ||
|
|
1326
|
-
var
|
|
1327
|
-
if (
|
|
1328
|
-
var
|
|
1329
|
+
for (var T2 = void 0 === c3 ? [] : s(c3); null !== $2; )
|
|
1330
|
+
$2.e.f & y || T2.push($2), $2 = $2.next;
|
|
1331
|
+
var O2 = T2.length;
|
|
1332
|
+
if (O2 > 0) {
|
|
1333
|
+
var q2 = 4 & i3 && 0 === h2 ? n3 : null;
|
|
1329
1334
|
if (g2) {
|
|
1330
|
-
for (_2 = 0; _2 <
|
|
1331
|
-
for (_2 = 0; _2 <
|
|
1335
|
+
for (_2 = 0; _2 < O2; _2 += 1) (_c2 = T2[_2].a) == null ? void 0 : _c2.measure();
|
|
1336
|
+
for (_2 = 0; _2 < O2; _2 += 1) (_d = T2[_2].a) == null ? void 0 : _d.fix();
|
|
1332
1337
|
}
|
|
1333
1338
|
!function pause_effects(e5, t4, n4, o4) {
|
|
1334
1339
|
for (var s2 = [], i4 = t4.length, a4 = 0; a4 < i4; a4++) pause_children(t4[a4].e, s2, true);
|
|
@@ -1352,7 +1357,7 @@ function each(e2, t2, o2, i2, a2, l2 = null) {
|
|
|
1352
1357
|
l4 || (o4.delete(s3.k), link(e5, s3.prev, s3.next)), destroy_effect(s3.e, !l4);
|
|
1353
1358
|
}
|
|
1354
1359
|
});
|
|
1355
|
-
}(t3,
|
|
1360
|
+
}(t3, T2, q2, m2);
|
|
1356
1361
|
}
|
|
1357
1362
|
}
|
|
1358
1363
|
g2 && queue_micro_task(() => {
|
|
@@ -1822,6 +1827,49 @@ function is_numberlike_input(e2) {
|
|
|
1822
1827
|
function to_number(e2) {
|
|
1823
1828
|
return "" === e2 ? null : +e2;
|
|
1824
1829
|
}
|
|
1830
|
+
const _ResizeObserverSingleton = class _ResizeObserverSingleton {
|
|
1831
|
+
/** @param {ResizeObserverOptions} options */
|
|
1832
|
+
constructor(e2) {
|
|
1833
|
+
__privateAdd(this, _ResizeObserverSingleton_instances);
|
|
1834
|
+
/** */
|
|
1835
|
+
__privateAdd(this, _e2, /* @__PURE__ */ new WeakMap());
|
|
1836
|
+
/** @type {ResizeObserver | undefined} */
|
|
1837
|
+
__privateAdd(this, _t2);
|
|
1838
|
+
/** @type {ResizeObserverOptions} */
|
|
1839
|
+
__privateAdd(this, _n);
|
|
1840
|
+
__privateSet(this, _n, e2);
|
|
1841
|
+
}
|
|
1842
|
+
/**
|
|
1843
|
+
* @param {Element} element
|
|
1844
|
+
* @param {(entry: ResizeObserverEntry) => any} listener
|
|
1845
|
+
*/
|
|
1846
|
+
observe(e2, t2) {
|
|
1847
|
+
var n2 = __privateGet(this, _e2).get(e2) || /* @__PURE__ */ new Set();
|
|
1848
|
+
return n2.add(t2), __privateGet(this, _e2).set(e2, n2), __privateMethod(this, _ResizeObserverSingleton_instances, r_fn).call(this).observe(e2, __privateGet(this, _n)), () => {
|
|
1849
|
+
var n3 = __privateGet(this, _e2).get(e2);
|
|
1850
|
+
n3.delete(t2), 0 === n3.size && (__privateGet(this, _e2).delete(e2), /** @type {ResizeObserver} */
|
|
1851
|
+
__privateGet(this, _t2).unobserve(e2));
|
|
1852
|
+
};
|
|
1853
|
+
}
|
|
1854
|
+
};
|
|
1855
|
+
_e2 = new WeakMap();
|
|
1856
|
+
_t2 = new WeakMap();
|
|
1857
|
+
_n = new WeakMap();
|
|
1858
|
+
_ResizeObserverSingleton_instances = new WeakSet();
|
|
1859
|
+
r_fn = function() {
|
|
1860
|
+
return __privateGet(this, _t2) ?? __privateSet(this, _t2, new ResizeObserver(
|
|
1861
|
+
/** @param {any} entries */
|
|
1862
|
+
(e2) => {
|
|
1863
|
+
for (var t2 of e2) for (var n2 of (_ResizeObserverSingleton.entries.set(t2.target, t2), __privateGet(this, _e2).get(t2.target) || [])) n2(t2);
|
|
1864
|
+
}
|
|
1865
|
+
));
|
|
1866
|
+
};
|
|
1867
|
+
/** @static */
|
|
1868
|
+
__publicField(_ResizeObserverSingleton, "entries", /* @__PURE__ */ new WeakMap());
|
|
1869
|
+
let ResizeObserverSingleton = _ResizeObserverSingleton;
|
|
1870
|
+
var me = new ResizeObserverSingleton({
|
|
1871
|
+
box: "border-box"
|
|
1872
|
+
});
|
|
1825
1873
|
function is_bound_this(e2, t2) {
|
|
1826
1874
|
return e2 === t2 || (e2 == null ? void 0 : e2[k]) === t2;
|
|
1827
1875
|
}
|
|
@@ -1845,7 +1893,7 @@ function bind_this(e2 = {}, t2, n2, o2) {
|
|
|
1845
1893
|
function init(e2 = false) {
|
|
1846
1894
|
const t2 = (
|
|
1847
1895
|
/** @type {ComponentContextLegacy} */
|
|
1848
|
-
|
|
1896
|
+
T
|
|
1849
1897
|
), n2 = t2.l.u;
|
|
1850
1898
|
if (!n2) return;
|
|
1851
1899
|
let props = () => deep_read_state(t2.s);
|
|
@@ -1891,17 +1939,17 @@ function subscribe_to_store(e2, t2, n2) {
|
|
|
1891
1939
|
));
|
|
1892
1940
|
return o2.unsubscribe ? () => o2.unsubscribe() : o2;
|
|
1893
1941
|
}
|
|
1894
|
-
const
|
|
1942
|
+
const be = [];
|
|
1895
1943
|
function writable(e2, t2 = noop) {
|
|
1896
1944
|
let n2 = null;
|
|
1897
1945
|
const o2 = /* @__PURE__ */ new Set();
|
|
1898
1946
|
function set2(t3) {
|
|
1899
1947
|
if (safe_not_equal(e2, t3) && (e2 = t3, n2)) {
|
|
1900
|
-
const t4 = !
|
|
1901
|
-
for (const t5 of o2) t5[1](),
|
|
1948
|
+
const t4 = !be.length;
|
|
1949
|
+
for (const t5 of o2) t5[1](), be.push(t5, e2);
|
|
1902
1950
|
if (t4) {
|
|
1903
|
-
for (let e3 = 0; e3 <
|
|
1904
|
-
|
|
1951
|
+
for (let e3 = 0; e3 < be.length; e3 += 2) be[e3][0](be[e3 + 1]);
|
|
1952
|
+
be.length = 0;
|
|
1905
1953
|
}
|
|
1906
1954
|
}
|
|
1907
1955
|
}
|
|
@@ -1929,14 +1977,14 @@ function get(e2) {
|
|
|
1929
1977
|
let t2;
|
|
1930
1978
|
return subscribe_to_store(e2, (e3) => t2 = e3)(), t2;
|
|
1931
1979
|
}
|
|
1932
|
-
let
|
|
1980
|
+
let ye = false, $e = Symbol();
|
|
1933
1981
|
function store_get(e2, t2, n2) {
|
|
1934
1982
|
const o2 = n2[t2] ?? (n2[t2] = {
|
|
1935
1983
|
store: null,
|
|
1936
1984
|
source: /* @__PURE__ */ mutable_source(void 0),
|
|
1937
1985
|
unsubscribe: noop
|
|
1938
1986
|
});
|
|
1939
|
-
if (o2.store !== e2 && !(
|
|
1987
|
+
if (o2.store !== e2 && !($e in n2)) if (o2.unsubscribe(), o2.store = e2 ?? null, null == e2) o2.source.v = void 0, // see synchronous callback comment below
|
|
1940
1988
|
o2.unsubscribe = noop;
|
|
1941
1989
|
else {
|
|
1942
1990
|
var s2 = true;
|
|
@@ -1948,7 +1996,7 @@ function store_get(e2, t2, n2) {
|
|
|
1948
1996
|
) : set(o2.source, e3);
|
|
1949
1997
|
}), s2 = false;
|
|
1950
1998
|
}
|
|
1951
|
-
return e2 &&
|
|
1999
|
+
return e2 && $e in n2 ? get(e2) : get$1(o2.source);
|
|
1952
2000
|
}
|
|
1953
2001
|
function store_set(e2, t2) {
|
|
1954
2002
|
return e2.set(t2), t2;
|
|
@@ -1960,14 +2008,14 @@ function setup_stores() {
|
|
|
1960
2008
|
for (var t2 in e2) {
|
|
1961
2009
|
e2[t2].unsubscribe();
|
|
1962
2010
|
}
|
|
1963
|
-
i(e2,
|
|
2011
|
+
i(e2, $e, {
|
|
1964
2012
|
enumerable: false,
|
|
1965
2013
|
value: true
|
|
1966
2014
|
});
|
|
1967
2015
|
});
|
|
1968
2016
|
}];
|
|
1969
2017
|
}
|
|
1970
|
-
const
|
|
2018
|
+
const we = {
|
|
1971
2019
|
get(e2, t2) {
|
|
1972
2020
|
if (!e2.exclude.includes(t2)) return get$1(e2.version), t2 in e2.special ? e2.special[t2]() : e2.props[t2];
|
|
1973
2021
|
},
|
|
@@ -2003,9 +2051,9 @@ function legacy_rest_props(e2, t2) {
|
|
|
2003
2051
|
exclude: t2,
|
|
2004
2052
|
special: {},
|
|
2005
2053
|
version: source(0)
|
|
2006
|
-
},
|
|
2054
|
+
}, we);
|
|
2007
2055
|
}
|
|
2008
|
-
const
|
|
2056
|
+
const xe = {
|
|
2009
2057
|
get(e2, t2) {
|
|
2010
2058
|
let n2 = e2.props.length;
|
|
2011
2059
|
for (; n2--; ) {
|
|
@@ -2053,17 +2101,17 @@ const we = {
|
|
|
2053
2101
|
function spread_props(...e2) {
|
|
2054
2102
|
return new Proxy({
|
|
2055
2103
|
props: e2
|
|
2056
|
-
},
|
|
2104
|
+
}, xe);
|
|
2057
2105
|
}
|
|
2058
2106
|
function prop(e2, t2, n2, o2) {
|
|
2059
2107
|
var _a2;
|
|
2060
2108
|
var s2, i2 = !!(1 & n2), l2 = !M || !!(2 & n2), c2 = !!(8 & n2), u2 = !!(16 & n2), d2 = false;
|
|
2061
2109
|
c2 ? [s2, d2] = function capture_store_binding(e3) {
|
|
2062
|
-
var t3 =
|
|
2110
|
+
var t3 = ye;
|
|
2063
2111
|
try {
|
|
2064
|
-
return
|
|
2112
|
+
return ye = false, [e3(), ye];
|
|
2065
2113
|
} finally {
|
|
2066
|
-
|
|
2114
|
+
ye = t3;
|
|
2067
2115
|
}
|
|
2068
2116
|
}(() => (
|
|
2069
2117
|
/** @type {V} */
|
|
@@ -2129,7 +2177,7 @@ function prop(e2, t2, n2, o2) {
|
|
|
2129
2177
|
};
|
|
2130
2178
|
}
|
|
2131
2179
|
function onMount(e2) {
|
|
2132
|
-
null ===
|
|
2180
|
+
null === T && lifecycle_outside_component(), M && null !== T.l ? (
|
|
2133
2181
|
/**
|
|
2134
2182
|
* Legacy-mode: Init callbacks object for onMount/beforeUpdate/afterUpdate
|
|
2135
2183
|
* @param {ComponentContext} context
|
|
@@ -2144,7 +2192,7 @@ function onMount(e2) {
|
|
|
2144
2192
|
b: [],
|
|
2145
2193
|
m: []
|
|
2146
2194
|
});
|
|
2147
|
-
}(
|
|
2195
|
+
}(T).m.push(e2)
|
|
2148
2196
|
) : user_effect(() => {
|
|
2149
2197
|
const t2 = untrack(e2);
|
|
2150
2198
|
if ("function" == typeof t2) return t2;
|
|
@@ -2174,7 +2222,7 @@ function onMount(e2) {
|
|
|
2174
2222
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
2175
2223
|
*
|
|
2176
2224
|
*/
|
|
2177
|
-
const
|
|
2225
|
+
const ke = {
|
|
2178
2226
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2179
2227
|
width: 24,
|
|
2180
2228
|
height: 24,
|
|
@@ -2185,13 +2233,13 @@ const xe = {
|
|
|
2185
2233
|
"stroke-linecap": "round",
|
|
2186
2234
|
"stroke-linejoin": "round"
|
|
2187
2235
|
};
|
|
2188
|
-
var
|
|
2236
|
+
var Ce = /* @__PURE__ */ ns_template("<svg><!><!></svg>");
|
|
2189
2237
|
function Icon$1(e2, t2) {
|
|
2190
2238
|
const n2 = legacy_rest_props(t2, ["children", "$$slots", "$$events", "$$legacy"]), o2 = legacy_rest_props(n2, ["name", "color", "size", "strokeWidth", "absoluteStrokeWidth", "iconNode"]);
|
|
2191
2239
|
push(t2, false);
|
|
2192
2240
|
let s2 = prop(t2, "name", 8, void 0), i2 = prop(t2, "color", 8, "currentColor"), a2 = prop(t2, "size", 8, 24), l2 = prop(t2, "strokeWidth", 8, 2), c2 = prop(t2, "absoluteStrokeWidth", 8, false), u2 = prop(t2, "iconNode", 24, () => []);
|
|
2193
2241
|
init();
|
|
2194
|
-
var d2 =
|
|
2242
|
+
var d2 = Ce();
|
|
2195
2243
|
let f2;
|
|
2196
2244
|
var p2 = child(d2);
|
|
2197
2245
|
each(p2, 1, u2, index, (e3, t3) => {
|
|
@@ -2235,7 +2283,7 @@ function Icon$1(e2, t2) {
|
|
|
2235
2283
|
}));
|
|
2236
2284
|
}), append(e3, n3);
|
|
2237
2285
|
}), slot(sibling(p2), t2, "default", {}, null), template_effect((e3, t3) => f2 = set_attributes(d2, f2, {
|
|
2238
|
-
...
|
|
2286
|
+
...ke,
|
|
2239
2287
|
...o2,
|
|
2240
2288
|
width: a2(),
|
|
2241
2289
|
height: a2(),
|
|
@@ -2320,16 +2368,16 @@ function scale(e2, { delay: t2 = 0, duration: n2 = 400, easing: o2 = cubic_out,
|
|
|
2320
2368
|
`
|
|
2321
2369
|
};
|
|
2322
2370
|
}
|
|
2323
|
-
var on_click$
|
|
2371
|
+
var on_click$4 = (e2, t2) => {
|
|
2324
2372
|
var _a2;
|
|
2325
2373
|
(_a2 = t2.onClick) == null ? void 0 : _a2.call(t2);
|
|
2326
|
-
},
|
|
2374
|
+
}, Se = /* @__PURE__ */ template('<button id="floating playlight button" aria-label="Open Playlight Discovery"><p class="z-2 flex items-center overflow-hidden svelte-1j97rta"><!> <span class="mr-0.25 inline-block font-bold text-md svelte-1j97rta">More Games</span></p> <div class="bg-background absolute bottom-0 left-0 h-full w-0 transition-all duration-300 group-hover:w-full svelte-1j97rta"></div></button>');
|
|
2327
2375
|
function FloatingButton(e2, t2) {
|
|
2328
2376
|
push(t2, true);
|
|
2329
2377
|
let n2 = prop(t2, "position", 3, "bottom-right"), o2 = prop(t2, "visible", 3, true);
|
|
2330
2378
|
var s2 = comment(), i2 = first_child(s2), consequent = (e3) => {
|
|
2331
|
-
var o3 =
|
|
2332
|
-
o3.__click = [on_click$
|
|
2379
|
+
var o3 = Se();
|
|
2380
|
+
o3.__click = [on_click$4, t2];
|
|
2333
2381
|
var s3 = child(o3);
|
|
2334
2382
|
!function Gamepad(e4, t3) {
|
|
2335
2383
|
const n3 = legacy_rest_props(t3, ["children", "$$slots", "$$events", "$$legacy"]);
|
|
@@ -2382,20 +2430,20 @@ function FloatingButton(e2, t2) {
|
|
|
2382
2430
|
}), append(e2, s2), pop();
|
|
2383
2431
|
}
|
|
2384
2432
|
delegate(["click"]);
|
|
2385
|
-
var
|
|
2433
|
+
var Me = /* @__PURE__ */ ns_template('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"></path></svg>'), Ie = /* @__PURE__ */ ns_template('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>'), Te = /* @__PURE__ */ ns_template('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" height="20" width="20"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd"></path></svg>'), Oe = /* @__PURE__ */ ns_template('<svg viewBox="0 0 64 64" fill="currentColor" height="20" width="20" xmlns="http://www.w3.org/2000/svg"><path d="M32.427,7.987c2.183,0.124 4,1.165 5.096,3.281l17.936,36.208c1.739,3.66 -0.954,8.585 -5.373,8.656l-36.119,0c-4.022,-0.064 -7.322,-4.631 -5.352,-8.696l18.271,-36.207c0.342,-0.65 0.498,-0.838 0.793,-1.179c1.186,-1.375 2.483,-2.111 4.748,-2.063Zm-0.295,3.997c-0.687,0.034 -1.316,0.419 -1.659,1.017c-6.312,11.979 -12.397,24.081 -18.301,36.267c-0.546,1.225 0.391,2.797 1.762,2.863c12.06,0.195 24.125,0.195 36.185,0c1.325,-0.064 2.321,-1.584 1.769,-2.85c-5.793,-12.184 -11.765,-24.286 -17.966,-36.267c-0.366,-0.651 -0.903,-1.042 -1.79,-1.03Z"></path><path d="M33.631,40.581l-3.348,0l-0.368,-16.449l4.1,0l-0.384,16.449Zm-3.828,5.03c0,-0.609 0.197,-1.113 0.592,-1.514c0.396,-0.4 0.935,-0.601 1.618,-0.601c0.684,0 1.223,0.201 1.618,0.601c0.395,0.401 0.593,0.905 0.593,1.514c0,0.587 -0.193,1.078 -0.577,1.473c-0.385,0.395 -0.929,0.593 -1.634,0.593c-0.705,0 -1.249,-0.198 -1.634,-0.593c-0.384,-0.395 -0.576,-0.886 -0.576,-1.473Z"></path></svg>');
|
|
2386
2434
|
function Icon(e2, t2) {
|
|
2387
2435
|
let n2 = prop(t2, "type", 8, "success");
|
|
2388
2436
|
var o2 = comment(), s2 = first_child(o2), consequent = (e3) => {
|
|
2389
|
-
append(e3,
|
|
2437
|
+
append(e3, Me());
|
|
2390
2438
|
}, alternate = (e3, t3) => {
|
|
2391
2439
|
var consequent_1 = (e4) => {
|
|
2392
|
-
append(e4,
|
|
2440
|
+
append(e4, Ie());
|
|
2393
2441
|
}, alternate_1 = (e4, t4) => {
|
|
2394
2442
|
var consequent_2 = (e5) => {
|
|
2395
2443
|
append(e5, Te());
|
|
2396
2444
|
}, alternate_2 = (e5, t5) => {
|
|
2397
2445
|
var consequent_3 = (e6) => {
|
|
2398
|
-
append(e6,
|
|
2446
|
+
append(e6, Oe());
|
|
2399
2447
|
}, alternate_3 = (e6) => {
|
|
2400
2448
|
};
|
|
2401
2449
|
if_block(e5, (e6) => {
|
|
@@ -2441,15 +2489,15 @@ function clientWritable(e2) {
|
|
|
2441
2489
|
}
|
|
2442
2490
|
};
|
|
2443
2491
|
}
|
|
2444
|
-
let
|
|
2445
|
-
const
|
|
2492
|
+
let We = 0;
|
|
2493
|
+
const ze = function createToastState() {
|
|
2446
2494
|
const e2 = clientWritable([]), t2 = clientWritable([]);
|
|
2447
2495
|
function addToast(t3) {
|
|
2448
2496
|
e2.update((e3) => [t3, ...e3]);
|
|
2449
2497
|
}
|
|
2450
2498
|
function create(t3) {
|
|
2451
2499
|
var _a2;
|
|
2452
|
-
const { message: n2, ...o2 } = t3, s2 = "number" == typeof (t3 == null ? void 0 : t3.id) || t3.id && ((_a2 = t3.id) == null ? void 0 : _a2.length) > 0 ? t3.id :
|
|
2500
|
+
const { message: n2, ...o2 } = t3, s2 = "number" == typeof (t3 == null ? void 0 : t3.id) || t3.id && ((_a2 = t3.id) == null ? void 0 : _a2.length) > 0 ? t3.id : We++, i2 = void 0 === t3.dismissable || t3.dismissable, a2 = void 0 === t3.type ? "default" : t3.type, l2 = get(e2).find((e3) => e3.id === s2);
|
|
2453
2501
|
return l2 ? e2.update((e3) => e3.map((e4) => e4.id === s2 ? {
|
|
2454
2502
|
...e4,
|
|
2455
2503
|
...t3,
|
|
@@ -2586,7 +2634,7 @@ const Ee = function createToastState() {
|
|
|
2586
2634
|
}), n2;
|
|
2587
2635
|
},
|
|
2588
2636
|
custom: function custom(e3, t3) {
|
|
2589
|
-
const n2 = (t3 == null ? void 0 : t3.id) ||
|
|
2637
|
+
const n2 = (t3 == null ? void 0 : t3.id) || We++;
|
|
2590
2638
|
return create({
|
|
2591
2639
|
component: e3,
|
|
2592
2640
|
id: n2,
|
|
@@ -2607,23 +2655,23 @@ const Ee = function createToastState() {
|
|
|
2607
2655
|
heights: t2
|
|
2608
2656
|
};
|
|
2609
2657
|
}();
|
|
2610
|
-
const
|
|
2611
|
-
return
|
|
2658
|
+
const Ee = function toastFunction(e2, t2) {
|
|
2659
|
+
return ze.create({
|
|
2612
2660
|
message: e2,
|
|
2613
2661
|
...t2
|
|
2614
2662
|
});
|
|
2615
|
-
},
|
|
2616
|
-
success:
|
|
2617
|
-
info:
|
|
2618
|
-
warning:
|
|
2619
|
-
error:
|
|
2620
|
-
custom:
|
|
2621
|
-
message:
|
|
2622
|
-
promise:
|
|
2623
|
-
dismiss:
|
|
2624
|
-
loading:
|
|
2663
|
+
}, je = Object.assign(Ee, {
|
|
2664
|
+
success: ze.success,
|
|
2665
|
+
info: ze.info,
|
|
2666
|
+
warning: ze.warning,
|
|
2667
|
+
error: ze.error,
|
|
2668
|
+
custom: ze.custom,
|
|
2669
|
+
message: ze.message,
|
|
2670
|
+
promise: ze.promise,
|
|
2671
|
+
dismiss: ze.dismiss,
|
|
2672
|
+
loading: ze.loading
|
|
2625
2673
|
});
|
|
2626
|
-
var
|
|
2674
|
+
var Ne = /* @__PURE__ */ template('<button aria-label="Close toast" data-close-button=""><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></button>'), Be = /* @__PURE__ */ template('<div data-icon=""><!> <!></div>'), Ae = /* @__PURE__ */ template('<div data-title=""><!></div>'), Le = /* @__PURE__ */ template('<div data-description=""><!></div>'), Ge = /* @__PURE__ */ template('<button data-button="" data-cancel=""> </button>'), Fe = /* @__PURE__ */ template('<button data-button=""> </button>'), He = /* @__PURE__ */ template('<!> <div data-content=""><!> <!></div> <!> <!>', 1), Re = /* @__PURE__ */ template('<li aria-atomic="true" role="status" data-sonner-toast=""><!> <!></li>');
|
|
2627
2675
|
function Toast(e2, t2) {
|
|
2628
2676
|
const n2 = legacy_rest_props(t2, ["children", "$$slots", "$$events", "$$legacy"]);
|
|
2629
2677
|
push(t2, false);
|
|
@@ -2642,15 +2690,15 @@ function Toast(e2, t2) {
|
|
|
2642
2690
|
default: "",
|
|
2643
2691
|
info: "",
|
|
2644
2692
|
loading: ""
|
|
2645
|
-
}, { toasts: b2, heights: y2, removeHeight: $2, setHeight: w2, remove: x2 } =
|
|
2646
|
-
let k2 = prop(t2, "toast", 9), C2 = prop(t2, "index", 9), S2 = prop(t2, "expanded", 9), M2 = prop(t2, "invert", 13),
|
|
2693
|
+
}, { toasts: b2, heights: y2, removeHeight: $2, setHeight: w2, remove: x2 } = ze;
|
|
2694
|
+
let k2 = prop(t2, "toast", 9), C2 = prop(t2, "index", 9), S2 = prop(t2, "expanded", 9), M2 = prop(t2, "invert", 13), I2 = prop(t2, "position", 9), T2 = prop(t2, "visibleToasts", 9), O2 = prop(t2, "expandByDefault", 9), q2 = prop(t2, "closeButton", 9), P2 = prop(t2, "interacting", 9), D2 = prop(t2, "cancelButtonStyle", 9, ""), W2 = prop(t2, "actionButtonStyle", 9, ""), z2 = prop(t2, "duration", 9, 4e3), E2 = prop(t2, "descriptionClass", 9, ""), j2 = prop(t2, "classes", 29, () => ({})), N2 = prop(t2, "unstyled", 9, false), B2 = mutable_state(false, true), A2 = mutable_state(false, true), L2 = mutable_state(false, true), G2 = mutable_state(false, true), F2 = mutable_state(0, true), H2 = mutable_state(0, true), R2 = mutable_state(void 0, true), U2 = mutable_state(0, true), V2 = 0, K2 = 0, Y2 = null;
|
|
2647
2695
|
function deleteToast() {
|
|
2648
|
-
set(
|
|
2696
|
+
set(A2, true), // Save the offset for the exit swipe animation
|
|
2649
2697
|
set(F2, get$1(U2)), $2(k2().id), setTimeout(() => {
|
|
2650
2698
|
x2(k2().id);
|
|
2651
2699
|
}, 200);
|
|
2652
2700
|
}
|
|
2653
|
-
let Z2 = mutable_state(void 0, true), J2 = mutable_state(k2().duration ||
|
|
2701
|
+
let Z2 = mutable_state(void 0, true), J2 = mutable_state(k2().duration || z2() || 4e3, true);
|
|
2654
2702
|
function startTimer() {
|
|
2655
2703
|
V2 = (/* @__PURE__ */ new Date()).getTime(), // Let the toast know it has started
|
|
2656
2704
|
set(Z2, setTimeout(() => {
|
|
@@ -2660,21 +2708,21 @@ function Toast(e2, t2) {
|
|
|
2660
2708
|
}
|
|
2661
2709
|
let Q2 = mutable_state(void 0, true);
|
|
2662
2710
|
onMount(() => {
|
|
2663
|
-
set(
|
|
2711
|
+
set(B2, true);
|
|
2664
2712
|
const e3 = get$1(R2).getBoundingClientRect().height;
|
|
2665
2713
|
return set(H2, e3), w2({
|
|
2666
2714
|
toastId: k2().id,
|
|
2667
2715
|
height: e3
|
|
2668
2716
|
}), () => $2(k2().id);
|
|
2669
|
-
}), legacy_pre_effect(() => deep_read_state(
|
|
2670
|
-
|
|
2717
|
+
}), legacy_pre_effect(() => deep_read_state(j2()), () => {
|
|
2718
|
+
j2({
|
|
2671
2719
|
...m2,
|
|
2672
|
-
...
|
|
2720
|
+
...j2()
|
|
2673
2721
|
});
|
|
2674
2722
|
}), legacy_pre_effect(() => deep_read_state(C2()), () => {
|
|
2675
2723
|
set(i2, 0 === C2());
|
|
2676
|
-
}), legacy_pre_effect(() => (deep_read_state(C2()), deep_read_state(
|
|
2677
|
-
set(a2, C2() + 1 <=
|
|
2724
|
+
}), legacy_pre_effect(() => (deep_read_state(C2()), deep_read_state(T2())), () => {
|
|
2725
|
+
set(a2, C2() + 1 <= T2());
|
|
2678
2726
|
}), legacy_pre_effect(() => deep_read_state(k2()), () => {
|
|
2679
2727
|
set(l2, k2().title);
|
|
2680
2728
|
}), legacy_pre_effect(() => deep_read_state(k2()), () => {
|
|
@@ -2687,8 +2735,8 @@ function Toast(e2, t2) {
|
|
|
2687
2735
|
set(f2, k2().descriptionClass || "");
|
|
2688
2736
|
}), legacy_pre_effect(() => ($heights(), deep_read_state(k2())), () => {
|
|
2689
2737
|
set(p2, $heights().findIndex((e3) => e3.toastId === k2().id) || 0);
|
|
2690
|
-
}), legacy_pre_effect(() => deep_read_state(
|
|
2691
|
-
set(_2,
|
|
2738
|
+
}), legacy_pre_effect(() => deep_read_state(I2()), () => {
|
|
2739
|
+
set(_2, I2().split("-"));
|
|
2692
2740
|
}), legacy_pre_effect(() => ($heights(), get$1(p2)), () => {
|
|
2693
2741
|
set(g2, $heights().reduce((e3, t3, n3) => (
|
|
2694
2742
|
// Calculate offset up untill current toast
|
|
@@ -2703,9 +2751,9 @@ function Toast(e2, t2) {
|
|
|
2703
2751
|
}), legacy_pre_effect(() => (get$1(l2), get$1(c2)), () => {
|
|
2704
2752
|
get$1(l2), get$1(c2), // Listen to height changes
|
|
2705
2753
|
async function updateHeights() {
|
|
2706
|
-
if (!get$1(
|
|
2754
|
+
if (!get$1(B2)) return;
|
|
2707
2755
|
let e3;
|
|
2708
|
-
await tick(), e3 = S2() ||
|
|
2756
|
+
await tick(), e3 = S2() || O2() ? 1 : 1 - 0.05 * C2(), get$1(R2).style.setProperty("height", "auto");
|
|
2709
2757
|
const t3 = get$1(R2).offsetHeight, n3 = get$1(R2).getBoundingClientRect().height, o3 = Math.round(100 * (n3 / e3 + Number.EPSILON)) / 100;
|
|
2710
2758
|
let s3;
|
|
2711
2759
|
get$1(R2).style.removeProperty("height"), // Use scaledRectHeight as it's more precise
|
|
@@ -2714,20 +2762,20 @@ function Toast(e2, t2) {
|
|
|
2714
2762
|
height: s3
|
|
2715
2763
|
});
|
|
2716
2764
|
}();
|
|
2717
|
-
}), legacy_pre_effect(() => (deep_read_state(k2()), get$1(Z2), deep_read_state(
|
|
2765
|
+
}), legacy_pre_effect(() => (deep_read_state(k2()), get$1(Z2), deep_read_state(z2())), () => {
|
|
2718
2766
|
k2().updated && // if the toast has been updated after the initial render,
|
|
2719
2767
|
// we want to reset the timer and set the remaining time to the
|
|
2720
2768
|
// new duration
|
|
2721
|
-
(clearTimeout(get$1(Z2)), set(J2, k2().duration ||
|
|
2769
|
+
(clearTimeout(get$1(Z2)), set(J2, k2().duration || z2() || 4e3), startTimer());
|
|
2722
2770
|
}), legacy_pre_effect(() => (deep_read_state(k2()), get$1(u2)), () => {
|
|
2723
2771
|
set(h2, k2().promise && "loading" === get$1(u2) || k2().duration === Number.POSITIVE_INFINITY);
|
|
2724
|
-
}), legacy_pre_effect(() => (get$1(h2), deep_read_state(S2()), deep_read_state(
|
|
2772
|
+
}), legacy_pre_effect(() => (get$1(h2), deep_read_state(S2()), deep_read_state(P2()), get$1(Z2)), () => {
|
|
2725
2773
|
var e3;
|
|
2726
2774
|
!function store_unsub(e4, t3, n3) {
|
|
2727
2775
|
let o3 = n3[t3];
|
|
2728
2776
|
return o3 && o3.store !== e4 && // Don't reset store yet, so that store_get above can resubscribe to new store if necessary
|
|
2729
2777
|
(o3.unsubscribe(), o3.unsubscribe = noop), e4;
|
|
2730
|
-
}(set(Q2, (e3 = () => (get$1(h2) || (S2() ||
|
|
2778
|
+
}(set(Q2, (e3 = () => (get$1(h2) || (S2() || P2() ? (
|
|
2731
2779
|
// If toast's duration changes, it will be out of sync with the
|
|
2732
2780
|
// remainingAtTimeout, so we know we need to restart the timer
|
|
2733
2781
|
// with the new duration
|
|
@@ -2747,16 +2795,16 @@ function Toast(e2, t2) {
|
|
|
2747
2795
|
}), legacy_pre_effect(() => deep_read_state(k2()), () => {
|
|
2748
2796
|
k2().delete && deleteToast();
|
|
2749
2797
|
}), legacy_pre_effect_reset(), init(true);
|
|
2750
|
-
var ee2 =
|
|
2798
|
+
var ee2 = Re();
|
|
2751
2799
|
let te2;
|
|
2752
2800
|
set_attribute(ee2, "tabindex", 0);
|
|
2753
2801
|
var ne2 = child(ee2), consequent = (e3) => {
|
|
2754
|
-
var t3 =
|
|
2802
|
+
var t3 = Ne();
|
|
2755
2803
|
template_effect((e4) => {
|
|
2756
2804
|
set_attribute(t3, "data-disabled", get$1(v2)), set_class(t3, 1, e4);
|
|
2757
2805
|
}, [() => {
|
|
2758
2806
|
var _a2, _b2, _c2;
|
|
2759
|
-
return clsx(cn((_a2 =
|
|
2807
|
+
return clsx(cn((_a2 = j2()) == null ? void 0 : _a2.closeButton, (_c2 = (_b2 = k2()) == null ? void 0 : _b2.classes) == null ? void 0 : _c2.closeButton));
|
|
2760
2808
|
}], derived_safe_equal), event("click", t3, function(...e4) {
|
|
2761
2809
|
var _a2;
|
|
2762
2810
|
(_a2 = get$1(v2) ? void 0 : () => {
|
|
@@ -2766,7 +2814,7 @@ function Toast(e2, t2) {
|
|
|
2766
2814
|
}), append(e3, t3);
|
|
2767
2815
|
};
|
|
2768
2816
|
if_block(ne2, (e3) => {
|
|
2769
|
-
|
|
2817
|
+
q2() && !k2().component && e3(consequent);
|
|
2770
2818
|
});
|
|
2771
2819
|
var re2 = sibling(ne2, 2), consequent_1 = (e3) => {
|
|
2772
2820
|
var t3 = comment();
|
|
@@ -2778,8 +2826,8 @@ function Toast(e2, t2) {
|
|
|
2778
2826
|
}));
|
|
2779
2827
|
}), append(e3, t3);
|
|
2780
2828
|
}, alternate = (e3) => {
|
|
2781
|
-
var n3 =
|
|
2782
|
-
var n4 =
|
|
2829
|
+
var n3 = He(), o3 = first_child(n3), consequent_8 = (e4) => {
|
|
2830
|
+
var n4 = Be(), o4 = child(n4), consequent_2 = (e5) => {
|
|
2783
2831
|
var n5 = comment();
|
|
2784
2832
|
slot(first_child(n5), t2, "loading-icon", {}, null), append(e5, n5);
|
|
2785
2833
|
};
|
|
@@ -2832,7 +2880,7 @@ function Toast(e2, t2) {
|
|
|
2832
2880
|
("default" !== get$1(u2) || k2().icon || k2().promise) && e4(consequent_8);
|
|
2833
2881
|
});
|
|
2834
2882
|
var s3 = sibling(o3, 2), i3 = child(s3), consequent_10 = (e4) => {
|
|
2835
|
-
var t3 =
|
|
2883
|
+
var t3 = Ae(), n4 = child(t3), consequent_9 = (e5) => {
|
|
2836
2884
|
var t4 = comment();
|
|
2837
2885
|
component(first_child(t4), () => k2().title, (e6, t5) => {
|
|
2838
2886
|
t5(e6, spread_props(() => k2().componentProps));
|
|
@@ -2845,14 +2893,14 @@ function Toast(e2, t2) {
|
|
|
2845
2893
|
"string" != typeof k2().title ? e5(consequent_9) : e5(alternate_5, false);
|
|
2846
2894
|
}), template_effect((e5) => set_class(t3, 1, e5), [() => {
|
|
2847
2895
|
var _a2, _b2, _c2;
|
|
2848
|
-
return clsx(cn((_a2 =
|
|
2896
|
+
return clsx(cn((_a2 = j2()) == null ? void 0 : _a2.title, (_c2 = (_b2 = k2()) == null ? void 0 : _b2.classes) == null ? void 0 : _c2.title));
|
|
2849
2897
|
}], derived_safe_equal), append(e4, t3);
|
|
2850
2898
|
};
|
|
2851
2899
|
if_block(i3, (e4) => {
|
|
2852
2900
|
k2().title && e4(consequent_10);
|
|
2853
2901
|
});
|
|
2854
2902
|
var a3 = sibling(i3, 2), consequent_12 = (e4) => {
|
|
2855
|
-
var t3 =
|
|
2903
|
+
var t3 = Le(), n4 = child(t3), consequent_11 = (e5) => {
|
|
2856
2904
|
var t4 = comment();
|
|
2857
2905
|
component(first_child(t4), () => k2().description, (e6, t5) => {
|
|
2858
2906
|
t5(e6, spread_props(() => k2().componentProps));
|
|
@@ -2865,19 +2913,19 @@ function Toast(e2, t2) {
|
|
|
2865
2913
|
"string" != typeof k2().description ? e5(consequent_11) : e5(alternate_6, false);
|
|
2866
2914
|
}), template_effect((e5) => set_class(t3, 1, e5), [() => {
|
|
2867
2915
|
var _a2, _b2;
|
|
2868
|
-
return clsx(cn(
|
|
2916
|
+
return clsx(cn(E2(), get$1(f2), (_a2 = j2()) == null ? void 0 : _a2.description, (_b2 = k2().classes) == null ? void 0 : _b2.description));
|
|
2869
2917
|
}], derived_safe_equal), append(e4, t3);
|
|
2870
2918
|
};
|
|
2871
2919
|
if_block(a3, (e4) => {
|
|
2872
2920
|
k2().description && e4(consequent_12);
|
|
2873
2921
|
});
|
|
2874
2922
|
var l3 = sibling(s3, 2), consequent_13 = (e4) => {
|
|
2875
|
-
var t3 =
|
|
2923
|
+
var t3 = Ge(), n4 = child(t3);
|
|
2876
2924
|
template_effect((e5) => {
|
|
2877
|
-
set_style(t3,
|
|
2925
|
+
set_style(t3, D2()), set_class(t3, 1, e5), set_text(n4, k2().cancel.label);
|
|
2878
2926
|
}, [() => {
|
|
2879
2927
|
var _a2, _b2, _c2;
|
|
2880
|
-
return clsx(cn((_a2 =
|
|
2928
|
+
return clsx(cn((_a2 = j2()) == null ? void 0 : _a2.cancelButton, (_c2 = (_b2 = k2()) == null ? void 0 : _b2.classes) == null ? void 0 : _c2.cancelButton));
|
|
2881
2929
|
}], derived_safe_equal), event("click", t3, () => {
|
|
2882
2930
|
var _a2;
|
|
2883
2931
|
deleteToast(), ((_a2 = k2().cancel) == null ? void 0 : _a2.onClick) && k2().cancel.onClick();
|
|
@@ -2887,12 +2935,12 @@ function Toast(e2, t2) {
|
|
|
2887
2935
|
k2().cancel && e4(consequent_13);
|
|
2888
2936
|
});
|
|
2889
2937
|
var c3 = sibling(l3, 2), consequent_14 = (e4) => {
|
|
2890
|
-
var t3 =
|
|
2938
|
+
var t3 = Fe(), n4 = child(t3);
|
|
2891
2939
|
template_effect((e5) => {
|
|
2892
|
-
set_style(t3,
|
|
2940
|
+
set_style(t3, W2()), set_class(t3, 1, e5), set_text(n4, k2().action.label);
|
|
2893
2941
|
}, [() => {
|
|
2894
2942
|
var _a2, _b2, _c2;
|
|
2895
|
-
return clsx(cn((_a2 =
|
|
2943
|
+
return clsx(cn((_a2 = j2()) == null ? void 0 : _a2.actionButton, (_c2 = (_b2 = k2()) == null ? void 0 : _b2.classes) == null ? void 0 : _c2.actionButton));
|
|
2896
2944
|
}], derived_safe_equal), event("click", t3, (e5) => {
|
|
2897
2945
|
var _a2;
|
|
2898
2946
|
(_a2 = k2().action) == null ? void 0 : _a2.onClick(e5), e5.defaultPrevented || deleteToast();
|
|
@@ -2906,17 +2954,17 @@ function Toast(e2, t2) {
|
|
|
2906
2954
|
k2().component ? e3(consequent_1) : e3(alternate, false);
|
|
2907
2955
|
}), bind_this(ee2, (e3) => set(R2, e3), () => get$1(R2)), template_effect((e3, t3, s3) => {
|
|
2908
2956
|
var _a2;
|
|
2909
|
-
set_attribute(ee2, "aria-live", k2().important ? "assertive" : "polite"), set_class(ee2, 1, e3), set_attribute(ee2, "data-styled", !(k2().component || ((_a2 = k2()) == null ? void 0 : _a2.unstyled) ||
|
|
2957
|
+
set_attribute(ee2, "aria-live", k2().important ? "assertive" : "polite"), set_class(ee2, 1, e3), set_attribute(ee2, "data-styled", !(k2().component || ((_a2 = k2()) == null ? void 0 : _a2.unstyled) || N2())), set_attribute(ee2, "data-mounted", get$1(B2)), set_attribute(ee2, "data-promise", t3), set_attribute(ee2, "data-removed", get$1(A2)), set_attribute(ee2, "data-visible", get$1(a2)), set_attribute(ee2, "data-y-position", get$1(_2)[0]), set_attribute(ee2, "data-x-position", get$1(_2)[1]), set_attribute(ee2, "data-index", C2()), set_attribute(ee2, "data-front", get$1(i2)), set_attribute(ee2, "data-swiping", get$1(L2)), set_attribute(ee2, "data-type", get$1(u2)), set_attribute(ee2, "data-invert", M2()), set_attribute(ee2, "data-swipe-out", get$1(G2)), set_attribute(ee2, "data-expanded", s3), te2 = set_style(ee2, `${n2.style} ${k2().style}`, te2, {
|
|
2910
2958
|
"--index": C2(),
|
|
2911
2959
|
"--toasts-before": C2(),
|
|
2912
2960
|
"--z-index": store_get(b2, "$toasts", o2).length - C2(),
|
|
2913
|
-
"--offset": `${get$1(
|
|
2961
|
+
"--offset": `${get$1(A2) ? get$1(F2) : get$1(U2)}px`,
|
|
2914
2962
|
"--initial-height": `${get$1(H2)}px`
|
|
2915
2963
|
});
|
|
2916
2964
|
}, [() => {
|
|
2917
|
-
var _a2, _b2, _c2, _d,
|
|
2918
|
-
return clsx(cn(n2.class, get$1(d2), (_a2 =
|
|
2919
|
-
}, () => Boolean(k2().promise), () => Boolean(S2() ||
|
|
2965
|
+
var _a2, _b2, _c2, _d, _e3, _f;
|
|
2966
|
+
return clsx(cn(n2.class, get$1(d2), (_a2 = j2()) == null ? void 0 : _a2.toast, (_c2 = (_b2 = k2()) == null ? void 0 : _b2.classes) == null ? void 0 : _c2.toast, (_d = j2()) == null ? void 0 : _d[get$1(u2)], (_f = (_e3 = k2()) == null ? void 0 : _e3.classes) == null ? void 0 : _f[get$1(u2)]));
|
|
2967
|
+
}, () => Boolean(k2().promise), () => Boolean(S2() || O2() && get$1(B2))], derived_safe_equal), event("pointerdown", ee2, function onPointerDown(e3) {
|
|
2920
2968
|
if (get$1(v2)) return;
|
|
2921
2969
|
set(F2, get$1(U2));
|
|
2922
2970
|
const t3 = e3.target;
|
|
@@ -2939,7 +2987,7 @@ function Toast(e2, t2) {
|
|
|
2939
2987
|
(Y2 = null);
|
|
2940
2988
|
}), append(e2, ee2), pop(), s2();
|
|
2941
2989
|
}
|
|
2942
|
-
var
|
|
2990
|
+
var Ue = /* @__PURE__ */ template("<ol></ol>"), Ve = /* @__PURE__ */ template('<section class="svelte-1fo5d1m"></section>');
|
|
2943
2991
|
function Toaster(e2, t2) {
|
|
2944
2992
|
const n2 = legacy_rest_props(t2, ["children", "$$slots", "$$events", "$$legacy"]), o2 = legacy_rest_props(n2, ["invert", "theme", "position", "hotkey", "containerAriaLabel", "richColors", "expand", "duration", "visibleToasts", "closeButton", "toastOptions", "offset", "dir"]);
|
|
2945
2993
|
push(t2, false);
|
|
@@ -2951,24 +2999,24 @@ function Toaster(e2, t2) {
|
|
|
2951
2999
|
return "auto" !== e3 && e3 ? e3 : window.getComputedStyle(document.documentElement).direction;
|
|
2952
3000
|
}
|
|
2953
3001
|
let d2 = prop(t2, "invert", 8, false), f2 = prop(t2, "theme", 8, "light"), p2 = prop(t2, "position", 8, "bottom-right"), _2 = prop(t2, "hotkey", 24, () => ["altKey", "KeyT"]), g2 = prop(t2, "containerAriaLabel", 8, "Notifications"), v2 = prop(t2, "richColors", 8, false), h2 = prop(t2, "expand", 8, false), m2 = prop(t2, "duration", 8, 4e3), b2 = prop(t2, "visibleToasts", 8, 3), y2 = prop(t2, "closeButton", 8, false), $2 = prop(t2, "toastOptions", 24, () => ({})), w2 = prop(t2, "offset", 8, null), x2 = prop(t2, "dir", 24, getDocumentDirection);
|
|
2954
|
-
const { toasts: k2, heights: C2, reset: S2 } =
|
|
2955
|
-
let M2 = mutable_state(false),
|
|
3002
|
+
const { toasts: k2, heights: C2, reset: S2 } = ze;
|
|
3003
|
+
let M2 = mutable_state(false), I2 = mutable_state(false), O2 = mutable_state(function getInitialTheme(e3) {
|
|
2956
3004
|
return "system" !== e3 ? e3 : "undefined" != typeof window && window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? c2 : u2;
|
|
2957
|
-
}(f2())),
|
|
3005
|
+
}(f2())), q2 = mutable_state(), P2 = null, D2 = false;
|
|
2958
3006
|
function handleBlur(e3) {
|
|
2959
|
-
|
|
3007
|
+
D2 && !e3.currentTarget.contains(e3.relatedTarget) && (D2 = false, P2 && (P2.focus({
|
|
2960
3008
|
preventScroll: true
|
|
2961
|
-
}),
|
|
3009
|
+
}), P2 = null));
|
|
2962
3010
|
}
|
|
2963
3011
|
function handleFocus(e3) {
|
|
2964
|
-
|
|
3012
|
+
D2 || (D2 = true, P2 = e3.relatedTarget);
|
|
2965
3013
|
}
|
|
2966
3014
|
!function onDestroy(e3) {
|
|
2967
|
-
null ===
|
|
3015
|
+
null === T && lifecycle_outside_component(), onMount(() => () => untrack(e3));
|
|
2968
3016
|
}(() => {
|
|
2969
|
-
get$1(
|
|
3017
|
+
get$1(q2) && P2 && (P2.focus({
|
|
2970
3018
|
preventScroll: true
|
|
2971
|
-
}),
|
|
3019
|
+
}), P2 = null, D2 = false);
|
|
2972
3020
|
}), onMount(() => {
|
|
2973
3021
|
S2();
|
|
2974
3022
|
const handleKeydown = (e3) => {
|
|
@@ -2976,7 +3024,7 @@ function Toaster(e2, t2) {
|
|
|
2976
3024
|
_2().every((t3) => (
|
|
2977
3025
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2978
3026
|
e3[t3] || e3.code === t3
|
|
2979
|
-
)) && (set(M2, true), (_a2 = get$1(
|
|
3027
|
+
)) && (set(M2, true), (_a2 = get$1(q2)) == null ? void 0 : _a2.focus()), "Escape" !== e3.code || document.activeElement !== get$1(q2) && !((_b2 = get$1(q2)) == null ? void 0 : _b2.contains(document.activeElement)) || set(M2, false);
|
|
2980
3028
|
};
|
|
2981
3029
|
return document.addEventListener("keydown", handleKeydown), () => {
|
|
2982
3030
|
document.removeEventListener("keydown", handleKeydown);
|
|
@@ -2997,17 +3045,17 @@ function Toaster(e2, t2) {
|
|
|
2997
3045
|
k2.set(t3);
|
|
2998
3046
|
}
|
|
2999
3047
|
}), legacy_pre_effect(() => deep_read_state(f2()), () => {
|
|
3000
|
-
if ("system" !== f2() && set(
|
|
3048
|
+
if ("system" !== f2() && set(O2, f2()), "undefined" != typeof window) {
|
|
3001
3049
|
"system" === f2() && // check if current preference is dark
|
|
3002
3050
|
(window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? (
|
|
3003
3051
|
// it's currently dark
|
|
3004
|
-
set(
|
|
3052
|
+
set(O2, c2)
|
|
3005
3053
|
) : (
|
|
3006
3054
|
// it's not dark
|
|
3007
|
-
set(
|
|
3055
|
+
set(O2, u2)
|
|
3008
3056
|
));
|
|
3009
3057
|
const e3 = window.matchMedia("(prefers-color-scheme: dark)"), changeHandler = ({ matches: e4 }) => {
|
|
3010
|
-
set(
|
|
3058
|
+
set(O2, e4 ? c2 : u2);
|
|
3011
3059
|
};
|
|
3012
3060
|
"addEventListener" in e3 ? e3.addEventListener("change", changeHandler) : (
|
|
3013
3061
|
// @ts-expect-error deprecated API
|
|
@@ -3015,10 +3063,10 @@ function Toaster(e2, t2) {
|
|
|
3015
3063
|
);
|
|
3016
3064
|
}
|
|
3017
3065
|
}), legacy_pre_effect_reset(), init();
|
|
3018
|
-
var
|
|
3019
|
-
var i3 =
|
|
3066
|
+
var W2 = comment(), z2 = first_child(W2), consequent = (e3) => {
|
|
3067
|
+
var i3 = Ve();
|
|
3020
3068
|
set_attribute(i3, "tabindex", -1), each(i3, 5, () => get$1(a2), index, (e4, i4, a3, l3) => {
|
|
3021
|
-
var c3 =
|
|
3069
|
+
var c3 = Ue();
|
|
3022
3070
|
let u3;
|
|
3023
3071
|
each(c3, 7, () => $toasts().filter((e5) => !e5.position && 0 === a3 || e5.position === get$1(i4)), (e5) => e5.id, (e5, n3, o3, s3) => {
|
|
3024
3072
|
const a4 = /* @__PURE__ */ derived_safe_equal(() => {
|
|
@@ -3054,7 +3102,7 @@ function Toaster(e2, t2) {
|
|
|
3054
3102
|
return y2();
|
|
3055
3103
|
},
|
|
3056
3104
|
get interacting() {
|
|
3057
|
-
return get$1(
|
|
3105
|
+
return get$1(I2);
|
|
3058
3106
|
},
|
|
3059
3107
|
get position() {
|
|
3060
3108
|
return get$1(i4);
|
|
@@ -3132,13 +3180,13 @@ function Toaster(e2, t2) {
|
|
|
3132
3180
|
}
|
|
3133
3181
|
}
|
|
3134
3182
|
});
|
|
3135
|
-
}), bind_this(c3, (e5) => set(
|
|
3183
|
+
}), bind_this(c3, (e5) => set(q2, e5), () => get$1(q2)), template_effect((e5, t3, i5) => {
|
|
3136
3184
|
var _a2;
|
|
3137
3185
|
u3 = set_attributes(c3, u3, {
|
|
3138
3186
|
tabIndex: -1,
|
|
3139
3187
|
class: n2.class,
|
|
3140
3188
|
"data-sonner-toaster": true,
|
|
3141
|
-
"data-theme": get$1(
|
|
3189
|
+
"data-theme": get$1(O2),
|
|
3142
3190
|
"data-rich-colors": v2(),
|
|
3143
3191
|
dir: e5,
|
|
3144
3192
|
"data-y-position": t3,
|
|
@@ -3153,114 +3201,114 @@ function Toaster(e2, t2) {
|
|
|
3153
3201
|
}
|
|
3154
3202
|
}, "svelte-1fo5d1m"), c3.dir = c3.dir;
|
|
3155
3203
|
}, [() => "auto" === x2() ? getDocumentDirection() : x2(), () => get$1(i4).split("-")[0], () => get$1(i4).split("-")[1]], derived_safe_equal), event("blur", c3, handleBlur), event("focus", c3, handleFocus), event("mouseenter", c3, () => set(M2, true)), event("mousemove", c3, () => set(M2, true)), event("mouseleave", c3, () => {
|
|
3156
|
-
get$1(
|
|
3157
|
-
}), event("pointerdown", c3, () => set(
|
|
3204
|
+
get$1(I2) || set(M2, false);
|
|
3205
|
+
}), event("pointerdown", c3, () => set(I2, true)), event("pointerup", c3, () => set(I2, false)), append(e4, c3);
|
|
3158
3206
|
}), template_effect(() => set_attribute(i3, "aria-label", `${g2()} ${get$1(l2)}`)), append(e3, i3);
|
|
3159
3207
|
};
|
|
3160
|
-
if_block(
|
|
3208
|
+
if_block(z2, (e3) => {
|
|
3161
3209
|
$toasts().length > 0 && e3(consequent);
|
|
3162
|
-
}), append(e2,
|
|
3210
|
+
}), append(e2, W2), pop(), i2();
|
|
3163
3211
|
}
|
|
3164
|
-
const
|
|
3165
|
-
var on_click$
|
|
3212
|
+
const Ke = writable(false), Ye = writable("https://sdk.playlight.dev");
|
|
3213
|
+
var on_click$3 = (e2, t2, n2, o2) => {
|
|
3166
3214
|
var _a2;
|
|
3167
3215
|
get$1(t2) && !get$1(n2) || ((_a2 = o2.onClick) == null ? void 0 : _a2.call(o2, o2.game.id), window.open("https://" + o2.game.domain, "_blank", "noopener"));
|
|
3168
|
-
},
|
|
3216
|
+
}, Ze = /* @__PURE__ */ template('<div><p class="text-primary font-bold uppercase">New</p></div>'), Je = /* @__PURE__ */ template('<video playsinline="" loop preload="auto"></video>', 2), on_click_1$3 = (t2, n2) => {
|
|
3169
3217
|
var _a2;
|
|
3170
3218
|
e.stopPropagation(), (_a2 = n2.onClick) == null ? void 0 : _a2.call(n2, n2.game.id), window.open("https://" + n2.game.domain, "_blank", "noopener");
|
|
3171
|
-
},
|
|
3219
|
+
}, Xe = /* @__PURE__ */ template("<button>Play</button>"), Qe = /* @__PURE__ */ template('<div class="bg-background/75 text-foreground absolute right-0 bottom-0 left-0 z-11 flex max-h-1/3 flex-col overflow-hidden backdrop-blur-xl"><div class="hide-scrollbar h-full w-full overflow-y-auto p-3 svelte-rulnq9"><h3 class="mb-2 truncate text-center text-lg font-bold"> </h3> <p class="text-muted-foreground mb-4 text-center text-sm text-balance"> </p></div> <div class="fade-mask bg-background/75 pointer-events-none absolute right-0 bottom-0 left-0 h-8 svelte-rulnq9"></div></div>'), et = /* @__PURE__ */ template('<div role="button" tabindex="0"><!> <!> <img alt="cover" loading="eager"> <!> <!> <img alt="game logo" loading="eager"></div>');
|
|
3172
3220
|
function GameCard(e2, t2) {
|
|
3173
3221
|
push(t2, true);
|
|
3174
3222
|
const [n2, o2] = setup_stores();
|
|
3175
|
-
let s2, i2 =
|
|
3223
|
+
let s2, i2 = prop(t2, "compact", 3, false), a2 = state(false), l2 = state(false), c2 = state(void 0), u2 = state(false), d2 = state(false), f2 = state(false), p2 = state(false), _2 = state(void 0);
|
|
3176
3224
|
function handleMouseEnter() {
|
|
3177
|
-
get$1(
|
|
3225
|
+
get$1(a2) || get$1(p2) || function playSound(e3, t3 = 1) {
|
|
3178
3226
|
try {
|
|
3179
3227
|
const n3 = new Audio(e3);
|
|
3180
3228
|
n3.volume = t3, n3.play();
|
|
3181
3229
|
} catch (e4) {
|
|
3182
3230
|
console.error("Error playing sound:", e4);
|
|
3183
3231
|
}
|
|
3184
|
-
}(store_get(
|
|
3232
|
+
}(store_get(Ye, "$projectUrl", n2) + "/static/sounds/hover-selection.ogg", 0.25), set(a2, true), clearTimeout(s2), s2 = setTimeout(() => set(l2, true), 300), get$1(c2) && t2.game.cover_video_url && get$1(c2).play().catch((e3) => console.error("Video play error:", e3));
|
|
3185
3233
|
}
|
|
3186
3234
|
function handleMouseLeave() {
|
|
3187
|
-
get$1(
|
|
3235
|
+
get$1(p2) || (setUnhovered(), get$1(c2) && get$1(u2) && get$1(c2).pause());
|
|
3188
3236
|
}
|
|
3189
3237
|
function setUnhovered() {
|
|
3190
|
-
set(
|
|
3238
|
+
set(a2, false), clearTimeout(s2), set(l2, false);
|
|
3191
3239
|
}
|
|
3192
3240
|
user_effect(() => {
|
|
3193
|
-
set(
|
|
3241
|
+
set(p2, "ontouchstart" in window);
|
|
3194
3242
|
});
|
|
3195
|
-
var
|
|
3196
|
-
event("touchstart",
|
|
3197
|
-
get$1(
|
|
3198
|
-
}, void 0, true),
|
|
3199
|
-
var
|
|
3200
|
-
var t3 =
|
|
3243
|
+
var g2 = et();
|
|
3244
|
+
event("touchstart", O, () => set(p2, true), void 0, true), event("touchstart", q, (e3) => {
|
|
3245
|
+
get$1(_2) && !get$1(_2).contains(e3.target) && setUnhovered();
|
|
3246
|
+
}, void 0, true), g2.__touchstart = handleMouseEnter, g2.__click = [on_click$3, p2, l2, t2];
|
|
3247
|
+
var v2 = child(g2), consequent = (e3) => {
|
|
3248
|
+
var t3 = Ze();
|
|
3201
3249
|
let n3;
|
|
3202
|
-
template_effect((e4) => n3 = set_class(t3, 1, "bg-background absolute top-4 right-4 z-
|
|
3203
|
-
"opacity-0": get$1(
|
|
3250
|
+
template_effect((e4) => n3 = set_class(t3, 1, "bg-background absolute top-4 right-4 z-12 px-2 py-0.5 transition-opacity select-none", null, n3, e4), [() => ({
|
|
3251
|
+
"opacity-0": get$1(a2)
|
|
3204
3252
|
})]), append(e3, t3);
|
|
3205
3253
|
};
|
|
3206
|
-
if_block(
|
|
3254
|
+
if_block(v2, (e3) => {
|
|
3207
3255
|
var _a2;
|
|
3208
3256
|
(function isNewGame(e4) {
|
|
3209
3257
|
const t3 = /* @__PURE__ */ new Date();
|
|
3210
3258
|
return t3.setDate(t3.getDate() - 7), new Date(e4) > t3;
|
|
3211
3259
|
})((_a2 = t2.game) == null ? void 0 : _a2.created_at) && e3(consequent);
|
|
3212
3260
|
});
|
|
3213
|
-
var
|
|
3214
|
-
var n3 =
|
|
3261
|
+
var h2 = sibling(v2, 2), consequent_1 = (e3) => {
|
|
3262
|
+
var n3 = Je();
|
|
3215
3263
|
let o3;
|
|
3216
|
-
n3.muted = true, bind_this(n3, (e4) => set(
|
|
3264
|
+
n3.muted = true, bind_this(n3, (e4) => set(c2, e4), () => get$1(c2)), template_effect((e4) => {
|
|
3217
3265
|
set_attribute(n3, "src", t2.game.cover_video_url), o3 = set_class(n3, 1, "absolute top-0 left-0 z-5 h-full w-full object-cover opacity-0", null, o3, e4);
|
|
3218
3266
|
}, [() => ({
|
|
3219
|
-
"opacity-100": get$1(
|
|
3267
|
+
"opacity-100": get$1(a2) && get$1(u2) && t2.game.cover_video_url
|
|
3220
3268
|
})]), event("loadeddata", n3, () => {
|
|
3221
|
-
set(
|
|
3269
|
+
set(u2, true);
|
|
3222
3270
|
}), append(e3, n3);
|
|
3223
3271
|
};
|
|
3224
|
-
if_block(
|
|
3272
|
+
if_block(h2, (e3) => {
|
|
3225
3273
|
t2.game.cover_video_url && e3(consequent_1);
|
|
3226
3274
|
});
|
|
3227
|
-
var
|
|
3228
|
-
let
|
|
3229
|
-
var
|
|
3230
|
-
var n3 =
|
|
3275
|
+
var m2 = sibling(h2, 2);
|
|
3276
|
+
let b2;
|
|
3277
|
+
var y2 = sibling(m2, 2), consequent_2 = (e3) => {
|
|
3278
|
+
var n3 = Xe();
|
|
3231
3279
|
let o3;
|
|
3232
|
-
n3.__click = [on_click_1$
|
|
3233
|
-
"opacity-0": get$1(
|
|
3280
|
+
n3.__click = [on_click_1$3, t2], template_effect((e4) => o3 = set_class(n3, 1, "bg-foreground text-background hover:bg-foreground/90 absolute right-4 bottom-4 z-15 flex items-center justify-center rounded-sm px-3 py-1 font-bold uppercase transition-all", null, o3, e4), [() => ({
|
|
3281
|
+
"opacity-0": get$1(a2)
|
|
3234
3282
|
})]), append(e3, n3);
|
|
3235
3283
|
};
|
|
3236
|
-
if_block(
|
|
3237
|
-
get$1(
|
|
3284
|
+
if_block(y2, (e3) => {
|
|
3285
|
+
get$1(p2) && e3(consequent_2);
|
|
3238
3286
|
});
|
|
3239
|
-
var
|
|
3240
|
-
var n3 =
|
|
3287
|
+
var $2 = sibling(y2, 2), consequent_3 = (e3) => {
|
|
3288
|
+
var n3 = Qe(), o3 = child(n3), s3 = child(o3), i3 = child(s3), a3 = child(sibling(s3, 2));
|
|
3241
3289
|
template_effect(() => {
|
|
3242
3290
|
set_text(i3, t2.game.name), set_text(a3, t2.game.description || "No description.");
|
|
3243
3291
|
}), transition(3, n3, () => slide), append(e3, n3);
|
|
3244
3292
|
};
|
|
3245
|
-
if_block(
|
|
3246
|
-
get$1(
|
|
3293
|
+
if_block($2, (e3) => {
|
|
3294
|
+
get$1(a2) && e3(consequent_3);
|
|
3247
3295
|
});
|
|
3248
|
-
var
|
|
3249
|
-
let
|
|
3250
|
-
bind_this(
|
|
3251
|
-
set_class(
|
|
3296
|
+
var w2 = sibling($2, 2);
|
|
3297
|
+
let x2;
|
|
3298
|
+
bind_this(g2, (e3) => set(_2, e3), () => get$1(_2)), template_effect((e3, n3) => {
|
|
3299
|
+
set_class(g2, 1, `bg-background highlight-border group relative mt-5 mb-[calc(3dvh+1.5vw)] flex aspect-[2/3] h-1/2 max-h-[75vh] cursor-pointer flex-col shadow-xl transition hover:outline-2 lg:h-3/7 ${(get$1(d2) ? "" : "animate-pulse") ?? ""} ${(i2() ? "min-h-62" : "min-h-92") ?? ""}`, "svelte-rulnq9"), set_attribute(m2, "src", t2.game.cover_image_url), b2 = set_class(m2, 1, "prevent-image-select absolute top-0 left-0 z-10 h-full w-full object-cover opacity-0 transition svelte-rulnq9", null, b2, e3), set_attribute(w2, "src", t2.game.logo_url), x2 = set_class(w2, 1, "prevent-image-select absolute right-0 -bottom-[18%] left-0 z-10 mx-auto aspect-square w-1/5 rounded-full object-center opacity-0 transition group-hover:outline-2 svelte-rulnq9", null, x2, n3);
|
|
3252
3300
|
}, [() => ({
|
|
3253
|
-
"opacity-100": get$1(
|
|
3301
|
+
"opacity-100": get$1(d2) && (!get$1(a2) || !get$1(u2) || !t2.game.cover_video_url)
|
|
3254
3302
|
}), () => ({
|
|
3255
|
-
"opacity-100": get$1(
|
|
3256
|
-
})]), event("mouseenter",
|
|
3257
|
-
set(u2, true);
|
|
3258
|
-
}), event("load", $2, () => {
|
|
3303
|
+
"opacity-100": get$1(f2)
|
|
3304
|
+
})]), event("mouseenter", g2, handleMouseEnter), event("focus", g2, handleMouseEnter), event("mouseleave", g2, handleMouseLeave), event("blur", g2, handleMouseLeave), event("load", m2, () => {
|
|
3259
3305
|
set(d2, true);
|
|
3260
|
-
}),
|
|
3306
|
+
}), event("load", w2, () => {
|
|
3307
|
+
set(f2, true);
|
|
3308
|
+
}), append(e2, g2), pop(), o2();
|
|
3261
3309
|
}
|
|
3262
3310
|
delegate(["touchstart", "click"]);
|
|
3263
|
-
const
|
|
3311
|
+
const tt = new (_b = class {
|
|
3264
3312
|
constructor() {
|
|
3265
3313
|
__privateAdd(this, _PlayLightAPI_instances);
|
|
3266
3314
|
this.baseUrl = "https://api.playlight.dev/platform", this.cachedCategories = null, this.currentGame = null;
|
|
@@ -3286,7 +3334,7 @@ const et = new (_b = class {
|
|
|
3286
3334
|
}
|
|
3287
3335
|
return await o2.json();
|
|
3288
3336
|
} catch (e3) {
|
|
3289
|
-
|
|
3337
|
+
je.error("Error: " + e3), console.error("Playlight API error:", e3);
|
|
3290
3338
|
}
|
|
3291
3339
|
}
|
|
3292
3340
|
// Get all categories
|
|
@@ -3298,19 +3346,19 @@ const et = new (_b = class {
|
|
|
3298
3346
|
// Get game suggestions, optionally filtered by category
|
|
3299
3347
|
async getSuggestions(e2 = null, t2 = 1) {
|
|
3300
3348
|
let n2 = "/suggestions";
|
|
3301
|
-
return e2 && (n2 += "/" + e2), t2 && (n2 += "?page=" + t2), n2 += "&without=" + __privateMethod(this, _PlayLightAPI_instances,
|
|
3349
|
+
return e2 && (n2 += "/" + e2), t2 && (n2 += "?page=" + t2), n2 += "&without=" + __privateMethod(this, _PlayLightAPI_instances, o_fn).call(this), await this.request(n2);
|
|
3302
3350
|
}
|
|
3303
3351
|
// Get game suggestions, optionally filtered by category
|
|
3304
3352
|
async getCurrentGameInfo() {
|
|
3305
3353
|
if (this.currentGame) return this.currentGame;
|
|
3306
|
-
let e2 = "/game-by-domain/" + __privateMethod(this, _PlayLightAPI_instances,
|
|
3354
|
+
let e2 = "/game-by-domain/" + __privateMethod(this, _PlayLightAPI_instances, o_fn).call(this);
|
|
3307
3355
|
return this.currentGame = await this.request(e2), this.currentGame ? {
|
|
3308
3356
|
...this.currentGame
|
|
3309
3357
|
} : void 0;
|
|
3310
3358
|
}
|
|
3311
3359
|
// Track discovery overlay open
|
|
3312
3360
|
async trackOpen() {
|
|
3313
|
-
const e2 = __privateMethod(this, _PlayLightAPI_instances,
|
|
3361
|
+
const e2 = __privateMethod(this, _PlayLightAPI_instances, o_fn).call(this);
|
|
3314
3362
|
await this.request("/event/open", {
|
|
3315
3363
|
method: "POST",
|
|
3316
3364
|
body: JSON.stringify({
|
|
@@ -3320,7 +3368,7 @@ const et = new (_b = class {
|
|
|
3320
3368
|
}
|
|
3321
3369
|
// Track game click (pass id of the game that was clicked on)
|
|
3322
3370
|
async trackClick(e2) {
|
|
3323
|
-
const t2 = __privateMethod(this, _PlayLightAPI_instances,
|
|
3371
|
+
const t2 = __privateMethod(this, _PlayLightAPI_instances, o_fn).call(this);
|
|
3324
3372
|
await this.request("/event/click", {
|
|
3325
3373
|
method: "POST",
|
|
3326
3374
|
body: JSON.stringify({
|
|
@@ -3336,7 +3384,7 @@ const et = new (_b = class {
|
|
|
3336
3384
|
});
|
|
3337
3385
|
return (o2 == null ? void 0 : o2.success) || false;
|
|
3338
3386
|
}
|
|
3339
|
-
}, _PlayLightAPI_instances = new WeakSet(),
|
|
3387
|
+
}, _PlayLightAPI_instances = new WeakSet(), o_fn = function() {
|
|
3340
3388
|
const e2 = window.location.hostname;
|
|
3341
3389
|
return e2.startsWith("www.") ? e2.substring(4) : e2;
|
|
3342
3390
|
}, _b)();
|
|
@@ -3370,11 +3418,11 @@ function flip(e2, { from: t2, to: n2 }, o2 = {}) {
|
|
|
3370
3418
|
css: (e3, t3) => `transform: ${c2} translate(${t3 * b2}px, ${t3 * y2}px) scale(${e3 + t3 * $2}, ${e3 + t3 * w2});`
|
|
3371
3419
|
};
|
|
3372
3420
|
}
|
|
3373
|
-
var on_click$
|
|
3421
|
+
var on_click$2 = (e2, t2, n2) => {
|
|
3374
3422
|
set(t2, ""), set(n2, !get$1(n2));
|
|
3375
|
-
},
|
|
3423
|
+
}, nt = /* @__PURE__ */ template('<div class="text-muted-foreground animate-pulse p-4 text-center">Loading...</div>'), rt = /* @__PURE__ */ template('<div class="text-muted-foreground p-4 text-center">No categories found.</div>'), on_click_1$2 = (e2, t2, n2, o2) => {
|
|
3376
3424
|
t2(n2), set(o2, false);
|
|
3377
|
-
},
|
|
3425
|
+
}, ot = /* @__PURE__ */ template("<button> </button>"), st = /* @__PURE__ */ template('<div class="space-y-1 p-1"></div>'), it = /* @__PURE__ */ template('<div class="bg-background/85 fixed left-1/2 z-50 mt-24 w-30 w-full max-w-xs -translate-x-1/2 transform border shadow-lg backdrop-blur-xl"><div class="border-b p-3"><div class="relative"><div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-1"><!></div> <input type="text" placeholder="Search categories..." class="w-full border-0 p-1 pl-10 text-white focus:ring-0 focus:outline-none"></div></div> <div class="max-h-60 overflow-y-auto"><!></div></div>'), at = /* @__PURE__ */ template('<div class="flex w-full flex-col py-2"><h1 class="mb-0! py-2 text-center text-2xl font-bold text-white drop-shadow-xl lg:text-4xl"><span> </span> <button class="group mx-1 inline-flex cursor-pointer items-center bg-white px-3 py-1 text-background transition hover:rotate-5"><span class="truncate max-w-[40vw] text-2xl font-bold text-background lg:text-4xl"> </span> <!></button> <span>games?</span></h1> <!></div>');
|
|
3378
3426
|
function Navigation(e2, t2) {
|
|
3379
3427
|
push(t2, true);
|
|
3380
3428
|
let n2, o2 = prop(t2, "categories", 19, () => []), s2 = prop(t2, "selectedCategory", 15), i2 = state(false), a2 = /* @__PURE__ */ derived(() => s2() || (o2().length > 0 ? o2()[0] : "...")), l2 = state(""), c2 = state(void 0), u2 = /* @__PURE__ */ derived(() => get$1(l2) ? o2().filter((e3) => e3.toLowerCase().includes(get$1(l2).toLowerCase())) : o2());
|
|
@@ -3385,12 +3433,12 @@ function Navigation(e2, t2) {
|
|
|
3385
3433
|
for (e3 = Math.floor(Math.random() * (d2 == null ? void 0 : d2.length)); e3 == f2; ) e3 = Math.floor(Math.random() * (d2 == null ? void 0 : d2.length));
|
|
3386
3434
|
set(p2, proxy(d2[e3])), f2 = e3;
|
|
3387
3435
|
});
|
|
3388
|
-
var _2 =
|
|
3389
|
-
event("click",
|
|
3436
|
+
var _2 = at();
|
|
3437
|
+
event("click", q, function handleClickOutside(e3) {
|
|
3390
3438
|
get$1(c2) && !get$1(c2).contains(e3.target) && n2 && !n2.contains(e3.target) && set(i2, false);
|
|
3391
3439
|
});
|
|
3392
3440
|
var g2 = child(_2), v2 = child(g2), h2 = child(v2), m2 = sibling(v2, 2);
|
|
3393
|
-
m2.__click = [on_click$
|
|
3441
|
+
m2.__click = [on_click$2, l2, i2];
|
|
3394
3442
|
var b2 = child(m2), y2 = child(b2), $2 = sibling(b2, 2);
|
|
3395
3443
|
const w2 = /* @__PURE__ */ derived(() => get$1(i2) ? "rotate-180 transform" : "");
|
|
3396
3444
|
!function Chevron_down(e3, t3) {
|
|
@@ -3417,7 +3465,7 @@ function Navigation(e2, t2) {
|
|
|
3417
3465
|
}
|
|
3418
3466
|
}), bind_this(m2, (e3) => n2 = e3, () => n2);
|
|
3419
3467
|
var x2 = sibling(g2, 2), consequent_2 = (e3) => {
|
|
3420
|
-
var t3 =
|
|
3468
|
+
var t3 = it(), n3 = child(t3), a3 = child(n3), d3 = child(a3);
|
|
3421
3469
|
!function Search(e4, t4) {
|
|
3422
3470
|
const n4 = legacy_rest_props(t4, ["children", "$$slots", "$$events", "$$legacy"]);
|
|
3423
3471
|
Icon$1(e4, spread_props({
|
|
@@ -3444,15 +3492,15 @@ function Navigation(e2, t2) {
|
|
|
3444
3492
|
class: "text-muted-foreground"
|
|
3445
3493
|
});
|
|
3446
3494
|
var f3 = sibling(d3, 2), p3 = child(sibling(n3, 2)), consequent = (e4) => {
|
|
3447
|
-
append(e4,
|
|
3495
|
+
append(e4, nt());
|
|
3448
3496
|
}, alternate = (e4, t4) => {
|
|
3449
3497
|
var consequent_1 = (e5) => {
|
|
3450
|
-
append(e5,
|
|
3498
|
+
append(e5, rt());
|
|
3451
3499
|
}, alternate_1 = (e5) => {
|
|
3452
|
-
var t5 =
|
|
3500
|
+
var t5 = st();
|
|
3453
3501
|
each(t5, 28, () => get$1(u2), (e6) => e6, (e6, t6) => {
|
|
3454
|
-
var n4 =
|
|
3455
|
-
n4.__click = [on_click_1$
|
|
3502
|
+
var n4 = ot();
|
|
3503
|
+
n4.__click = [on_click_1$2, s2, t6, i2];
|
|
3456
3504
|
var o3 = child(n4);
|
|
3457
3505
|
template_effect(() => {
|
|
3458
3506
|
set_class(n4, 1, `w-full cursor-pointer px-4 py-2 text-left transition-colors ${(s2() != t6 ? "hover:bg-muted-foreground/20" : "") ?? ""} ${(s2() == t6 ? "bg-white text-background" : "text-white") ?? ""}`), set_text(o3, t6);
|
|
@@ -3559,7 +3607,7 @@ function Navigation(e2, t2) {
|
|
|
3559
3607
|
})), append(e2, _2), pop();
|
|
3560
3608
|
}
|
|
3561
3609
|
delegate(["click"]);
|
|
3562
|
-
var
|
|
3610
|
+
var lt = /* @__PURE__ */ template('<div class="-mx-10 mt-5 flex h-1/2 max-h-[75vh] min-h-92 w-10 flex-col lg:h-3/7"><div class="flex h-full items-center justify-center"><div class="flex h-full w-full flex-col items-center justify-between py-6"><div class="bg-muted-foreground min-[1920px]:h-1/4 h-1/5 w-px"></div> <div class="text-muted-foreground origin-center -rotate-90 transform text-sm whitespace-nowrap select-none">From other categories</div> <div class="bg-muted-foreground h-1/5 w-px min-[1920px]:h-1/4"></div></div></div></div>');
|
|
3563
3611
|
function restore(e2, t2, n2, o2, s2, i2) {
|
|
3564
3612
|
set(t2, false), set(n2, true), set(o2, 250), set(s2, 0), i2(250, 0, 250, (e3, t3, n3) => {
|
|
3565
3613
|
set(o2, e3 * (1 - n3)), set(s2, proxy(n3));
|
|
@@ -3571,9 +3619,9 @@ async function toggleLike(e2, t2, n2, o2) {
|
|
|
3571
3619
|
const s2 = !get$1(n2);
|
|
3572
3620
|
set(n2, !get$1(n2)), set(o2, get$1(o2) + (s2 ? 1 : -1)), // Save to localStorage
|
|
3573
3621
|
s2 ? localStorage.setItem(`playlight_${t2.currentGame.id}_liked`, "true") : localStorage.removeItem(`playlight_${t2.currentGame.id}_liked`);
|
|
3574
|
-
await
|
|
3622
|
+
await tt.toggleLike(t2.currentGame.id, s2) || set(o2, get$1(o2) + (s2 ? -1 : 1));
|
|
3575
3623
|
}
|
|
3576
|
-
var
|
|
3624
|
+
var ct = /* @__PURE__ */ template('<div class="bg-background/85 fixed bottom-4 left-4 z-2 flex touch-none flex-wrap items-center gap-1 border-1 p-4 text-start shadow-lg backdrop-blur-xl max-sm:right-4 sm:w-72" role="button" tabindex="0"><div class="w-full"><p class="text-muted-foreground text-sm select-none">Currently playing</p></div> <div class="flex w-full items-center gap-2"><img alt="logo"> <p class="text-foreground max-w-2/3 truncate text-lg font-bold"> </p> <div class="mt-0.5 ml-auto flex items-center gap-2"><p class="text-muted-foreground text-sm"> </p> <button class="text-muted-foreground cursor-pointer transition hover:text-white"><!></button></div></div></div>'), ut = /* @__PURE__ */ template('<div class="fixed bottom-0 z-3 shadow-xl max-sm:right-4 max-sm:left-4 sm:left-4 sm:w-72"><button class="bg-background/85 hover:bg-background/95 w-full rounded-t-md border px-4 py-1.5 backdrop-blur-sm transition" aria-label="Show game display"><div class="bg-muted-foreground mx-auto h-px w-16"></div></button></div>'), dt = /* @__PURE__ */ template("<!> <!>", 1);
|
|
3577
3625
|
function CurrentGameDisplay(e2, t2) {
|
|
3578
3626
|
var _a2;
|
|
3579
3627
|
push(t2, true);
|
|
@@ -3608,8 +3656,8 @@ function CurrentGameDisplay(e2, t2) {
|
|
|
3608
3656
|
var _a3, _b2;
|
|
3609
3657
|
((_a3 = t2.currentGame) == null ? void 0 : _a3.id) && (set(c2, null !== localStorage.getItem(`playlight_${t2.currentGame.id}_liked`)), set(u2, proxy(((_b2 = t2.currentGame) == null ? void 0 : _b2.likes) || 0)));
|
|
3610
3658
|
});
|
|
3611
|
-
var f2 =
|
|
3612
|
-
var o3 =
|
|
3659
|
+
var f2 = dt(), p2 = first_child(f2), consequent = (e3) => {
|
|
3660
|
+
var o3 = ct();
|
|
3613
3661
|
o3.__mousedown = startDrag, o3.__mousemove = drag, o3.__mouseup = endDrag, o3.__touchstart = startDrag, o3.__touchmove = drag, o3.__touchend = endDrag;
|
|
3614
3662
|
var s3 = sibling(child(o3), 2), l3 = child(s3);
|
|
3615
3663
|
let d3;
|
|
@@ -3655,7 +3703,7 @@ function CurrentGameDisplay(e2, t2) {
|
|
|
3655
3703
|
t2.currentGame && get$1(o2) && e3(consequent);
|
|
3656
3704
|
});
|
|
3657
3705
|
var _2 = sibling(p2, 2), consequent_1 = (e3) => {
|
|
3658
|
-
var t3 =
|
|
3706
|
+
var t3 = ut(), n3 = child(t3);
|
|
3659
3707
|
n3.__mousedown = [restore, s2, o2, i2, a2, animate2], n3.__touchstart = [restore, s2, o2, i2, a2, animate2], transition(3, n3, () => fly, () => ({
|
|
3660
3708
|
delay: 150,
|
|
3661
3709
|
y: 30
|
|
@@ -3666,26 +3714,26 @@ function CurrentGameDisplay(e2, t2) {
|
|
|
3666
3714
|
}), append(e2, f2), pop();
|
|
3667
3715
|
}
|
|
3668
3716
|
function closeDiscoveryOnEmptyClick(e2, t2) {
|
|
3669
|
-
e2.target === e2.currentTarget && store_set(
|
|
3717
|
+
e2.target === e2.currentTarget && store_set(Ke, false);
|
|
3670
3718
|
}
|
|
3671
3719
|
delegate(["mousedown", "mousemove", "mouseup", "touchstart", "touchmove", "touchend", "click"]);
|
|
3672
|
-
var on_click = (e2, t2) => {
|
|
3720
|
+
var on_click$1 = (e2, t2) => {
|
|
3673
3721
|
localStorage.getItem("playlight_exit_intent_disabled_by_user") ? localStorage.removeItem("playlight_exit_intent_disabled_by_user") : localStorage.setItem("playlight_exit_intent_disabled_by_user", true), set(t2, !get$1(t2));
|
|
3674
|
-
},
|
|
3722
|
+
}, ft = /* @__PURE__ */ template('<button class="cursor-pointer truncate text-sm text-nowrap opacity-50 transition hover:opacity-25 max-md:hidden"><p class="bg-background/50 text-primary p-1 px-2 text-sm"> </p></button>'), on_click_1$1 = (e2, t2) => store_set(Ke, false), pt = /* @__PURE__ */ template('<div class="flex h-4/5 items-center justify-center gap-4"><!></div>'), _t = /* @__PURE__ */ template('<div class="text-muted-foreground flex h-4/5 items-center justify-center gap-4"><p>No games found that match the filter.</p></div>'), gt = /* @__PURE__ */ template("<!> <!>", 1), vt = /* @__PURE__ */ template('<div class="mx-auto flex h-full flex-wrap content-start justify-center gap-10 lg:max-w-4/5"><!> <div class="flex h-10 w-full justify-center"><!></div></div>'), ht = /* @__PURE__ */ template('<div class="bg-background/75 fixed inset-0 top-0 right-0 bottom-0 left-0 z-99999 flex flex-col justify-center text-white backdrop-blur-md" id="playlight-discovery"><div class="pointer-events-none ml-2 flex items-center justify-between p-4"><img alt="logo" class="w-50 pointer-events-none"> <div class="mt-4 mr-2 flex items-center justify-evenly gap-8 overflow-hidden md:mr-4"><!> <button class="cursor-pointer text-white transition hover:opacity-50"><!></button></div></div> <div class="mx-auto p-2 px-5"><!></div> <!> <div class="mask-fade no-scrollbar relative h-full w-full overflow-y-auto p-4 svelte-12skmk8"><!></div> <a href="https://playlight.dev" target="_blank" class="text-muted-foreground fixed right-4 bottom-4 flex items-center gap-1 text-sm transition hover:text-white">Join Playlight <!></a></div>');
|
|
3675
3723
|
function DiscoveryOverlay(e2, t2) {
|
|
3676
3724
|
push(t2, true);
|
|
3677
|
-
const [n2, o2] = setup_stores(), $discoveryOpen = () => store_get(
|
|
3725
|
+
const [n2, o2] = setup_stores(), $discoveryOpen = () => store_get(Ke, "$discoveryOpen", n2);
|
|
3678
3726
|
let s2, i2 = prop(t2, "showIntentToggle", 3, true), a2 = state(true), l2 = state(void 0), c2 = state(true), u2 = state(false), d2 = state(void 0), f2 = state(proxy([])), p2 = state(proxy([])), _2 = state(1), g2 = state(true), v2 = state(void 0), h2 = state(false);
|
|
3679
3727
|
async function fetchGames() {
|
|
3680
3728
|
if (!(get$1(c2) && get$1(_2) > 1 || get$1(u2))) try {
|
|
3681
3729
|
1 === get$1(_2) ? set(c2, true) : set(u2, true);
|
|
3682
|
-
const e3 = get$1(h2) ? null : get$1(l2), t3 = await
|
|
3730
|
+
const e3 = get$1(h2) ? null : get$1(l2), t3 = await tt.getSuggestions(e3, get$1(_2)), n3 = (t3 == null ? void 0 : t3.games) || [], o3 = n3.filter((e4) => !get$1(f2).some((t4) => t4.id === e4.id));
|
|
3683
3731
|
set(f2, proxy([...get$1(f2), ...o3])), n3.length < 10 ? !get$1(h2) && get$1(l2) ? (
|
|
3684
3732
|
// Try with all games
|
|
3685
3733
|
(set(h2, true), set(_2, 1), setTimeout(() => fetchGames(), 100))
|
|
3686
3734
|
) : set(g2, false) : set(_2, get$1(_2) + 1);
|
|
3687
3735
|
} catch (e3) {
|
|
3688
|
-
console.error(e3),
|
|
3736
|
+
console.error(e3), je.error("Failed to load games: " + e3);
|
|
3689
3737
|
} finally {
|
|
3690
3738
|
set(c2, false), set(u2, false), // For Chrome: manually check if element is still in view and should trigger another load
|
|
3691
3739
|
get$1(g2) && get$1(v2) && setTimeout(() => {
|
|
@@ -3702,9 +3750,9 @@ function DiscoveryOverlay(e2, t2) {
|
|
|
3702
3750
|
}, {
|
|
3703
3751
|
rootMargin: "200px"
|
|
3704
3752
|
}), () => s2 == null ? void 0 : s2.disconnect())), onMount(async () => {
|
|
3705
|
-
set(d2, proxy(await
|
|
3706
|
-
var _a2, _b2, _c2, _d,
|
|
3707
|
-
set(p2, proxy(await
|
|
3753
|
+
set(d2, proxy(await tt.getCurrentGameInfo())), await async function fetchCategories() {
|
|
3754
|
+
var _a2, _b2, _c2, _d, _e3, _f, _g;
|
|
3755
|
+
set(p2, proxy(await tt.getCategories())), !get$1(l2) && ((_a2 = get$1(p2)) == null ? void 0 : _a2.length) > 0 && set(l2, proxy(((_b2 = get$1(d2)) == null ? void 0 : _b2.category) && ((_d = get$1(p2)) == null ? void 0 : _d.includes((_c2 = get$1(d2)) == null ? void 0 : _c2.category)) ? (_e3 = get$1(d2)) == null ? void 0 : _e3.category : (_g = get$1(p2)) == null ? void 0 : _g[((_f = get$1(p2)) == null ? void 0 : _f.length) - 1]));
|
|
3708
3756
|
}();
|
|
3709
3757
|
}), user_effect(() => {
|
|
3710
3758
|
get$1(l2) && (set(f2, proxy([])), set(_2, 1), set(g2, true), set(h2, false), set(c2, true), // Delay fetch to prevent rapid requests
|
|
@@ -3714,13 +3762,13 @@ function DiscoveryOverlay(e2, t2) {
|
|
|
3714
3762
|
}), user_effect(() => {
|
|
3715
3763
|
get$1(v2) && s2 && s2.observe(get$1(v2));
|
|
3716
3764
|
});
|
|
3717
|
-
var m2 =
|
|
3718
|
-
event("keydown",
|
|
3719
|
-
"Escape" == e3.key && store_set(
|
|
3765
|
+
var m2 = ht();
|
|
3766
|
+
event("keydown", q, (e3) => {
|
|
3767
|
+
"Escape" == e3.key && store_set(Ke, false);
|
|
3720
3768
|
}), m2.__click = [closeDiscoveryOnEmptyClick, $discoveryOpen];
|
|
3721
3769
|
var b2 = child(m2), y2 = child(b2), $2 = child(sibling(y2, 2)), consequent = (e3) => {
|
|
3722
|
-
var t3 =
|
|
3723
|
-
t3.__click = [on_click, a2];
|
|
3770
|
+
var t3 = ft();
|
|
3771
|
+
t3.__click = [on_click$1, a2];
|
|
3724
3772
|
var n3 = child(t3), o3 = child(n3);
|
|
3725
3773
|
template_effect(() => set_text(o3, get$1(a2) ? "Don't show on exit" : "Do show on exit")), append(e3, t3);
|
|
3726
3774
|
};
|
|
@@ -3728,7 +3776,7 @@ function DiscoveryOverlay(e2, t2) {
|
|
|
3728
3776
|
i2() && e3(consequent);
|
|
3729
3777
|
});
|
|
3730
3778
|
var w2 = sibling($2, 2);
|
|
3731
|
-
w2.__click = [on_click_1, $discoveryOpen], function X(e3, t3) {
|
|
3779
|
+
w2.__click = [on_click_1$1, $discoveryOpen], function X(e3, t3) {
|
|
3732
3780
|
const n3 = legacy_rest_props(t3, ["children", "$$slots", "$$events", "$$legacy"]);
|
|
3733
3781
|
Icon$1(e3, spread_props({
|
|
3734
3782
|
name: "x"
|
|
@@ -3771,7 +3819,7 @@ function DiscoveryOverlay(e2, t2) {
|
|
|
3771
3819
|
var C2 = sibling(k2, 2);
|
|
3772
3820
|
C2.__click = [closeDiscoveryOnEmptyClick, $discoveryOpen];
|
|
3773
3821
|
var S2 = child(C2), consequent_1 = (e3) => {
|
|
3774
|
-
var t3 =
|
|
3822
|
+
var t3 = pt();
|
|
3775
3823
|
Loader_circle(child(t3), {
|
|
3776
3824
|
class: "animate-spin opacity-75",
|
|
3777
3825
|
size: 50,
|
|
@@ -3779,15 +3827,15 @@ function DiscoveryOverlay(e2, t2) {
|
|
|
3779
3827
|
}), append(e3, t3);
|
|
3780
3828
|
}, alternate = (e3, t3) => {
|
|
3781
3829
|
var consequent_2 = (e4) => {
|
|
3782
|
-
append(e4,
|
|
3830
|
+
append(e4, _t());
|
|
3783
3831
|
}, alternate_1 = (e4) => {
|
|
3784
|
-
var t4 =
|
|
3832
|
+
var t4 = vt(), n3 = child(t4);
|
|
3785
3833
|
each(n3, 17, () => get$1(f2), index, (e5, t5, n4) => {
|
|
3786
|
-
var o4 =
|
|
3834
|
+
var o4 = gt();
|
|
3787
3835
|
const s4 = /* @__PURE__ */ derived(() => get$1(f2).findIndex((e6) => e6.category !== get$1(l2)));
|
|
3788
3836
|
var i3 = first_child(o4), consequent_3 = (e6) => {
|
|
3789
3837
|
!function GameCategorySeperator(e7) {
|
|
3790
|
-
append(e7,
|
|
3838
|
+
append(e7, lt());
|
|
3791
3839
|
}(e6);
|
|
3792
3840
|
};
|
|
3793
3841
|
if_block(i3, (e6) => {
|
|
@@ -3796,7 +3844,7 @@ function DiscoveryOverlay(e2, t2) {
|
|
|
3796
3844
|
get game() {
|
|
3797
3845
|
return get$1(t5);
|
|
3798
3846
|
},
|
|
3799
|
-
onClick: () =>
|
|
3847
|
+
onClick: () => tt.trackClick(get$1(t5).id)
|
|
3800
3848
|
}), append(e5, o4);
|
|
3801
3849
|
});
|
|
3802
3850
|
var o3 = sibling(n3, 2), s3 = child(o3), consequent_4 = (e5) => {
|
|
@@ -3840,29 +3888,29 @@ function DiscoveryOverlay(e2, t2) {
|
|
|
3840
3888
|
}));
|
|
3841
3889
|
}(sibling(child(M2)), {
|
|
3842
3890
|
size: 14
|
|
3843
|
-
}), template_effect(() => set_attribute(y2, "src", store_get(
|
|
3891
|
+
}), template_effect(() => set_attribute(y2, "src", store_get(Ye, "$projectUrl", n2) + "/static/images/logo-white-small.png")), transition(3, m2, () => blur, () => ({
|
|
3844
3892
|
duration: 250
|
|
3845
3893
|
})), append(e2, m2), pop(), o2();
|
|
3846
3894
|
}
|
|
3847
3895
|
delegate(["click"]);
|
|
3848
|
-
var
|
|
3896
|
+
var mt = /* @__PURE__ */ template('<div class="fixed top-0 right-0 left-0 h-4"></div>');
|
|
3849
3897
|
delegate(["mouseover"]);
|
|
3850
|
-
var
|
|
3898
|
+
var bt = /* @__PURE__ */ template("<!> <!> <!> <!>", 1);
|
|
3851
3899
|
function App(e2, t2) {
|
|
3852
3900
|
push(t2, true);
|
|
3853
|
-
const [n2, o2] = setup_stores(), $discoveryOpen = () => store_get(
|
|
3901
|
+
const [n2, o2] = setup_stores(), $discoveryOpen = () => store_get(Ke, "$discoveryOpen", n2), $config = () => store_get(t2.config, "$config", n2);
|
|
3854
3902
|
function openDiscovery() {
|
|
3855
|
-
store_set(
|
|
3903
|
+
store_set(Ke, true), tt.trackOpen();
|
|
3856
3904
|
}
|
|
3857
3905
|
let s2;
|
|
3858
|
-
|
|
3906
|
+
Ke.subscribe((e3) => {
|
|
3859
3907
|
try {
|
|
3860
3908
|
e3 ? (s2 = document.body.style.overflow, document.body.style.overflow = "hidden") : document.body.style.overflow = s2;
|
|
3861
3909
|
} catch (e4) {
|
|
3862
3910
|
console.error("Failed to toggle body overflow style:", e4);
|
|
3863
3911
|
}
|
|
3864
3912
|
});
|
|
3865
|
-
var i2 =
|
|
3913
|
+
var i2 = bt(), a2 = first_child(i2);
|
|
3866
3914
|
const l2 = /* @__PURE__ */ derived(() => {
|
|
3867
3915
|
var _a2, _b2;
|
|
3868
3916
|
return (_b2 = (_a2 = $config()) == null ? void 0 : _a2.button) == null ? void 0 : _b2.position;
|
|
@@ -3901,8 +3949,8 @@ function App(e2, t2) {
|
|
|
3901
3949
|
!function ExitIntentDetector(e3, t3) {
|
|
3902
3950
|
push(t3, true);
|
|
3903
3951
|
let n3, o3, s3 = prop(t3, "enabled", 3, true), i3 = false;
|
|
3904
|
-
var a3 =
|
|
3905
|
-
event("mousemove",
|
|
3952
|
+
var a3 = mt();
|
|
3953
|
+
event("mousemove", O, function trackMouse(e4) {
|
|
3906
3954
|
i3 || setTimeout(() => i3 = true, 250), n3.contains(e4.target) || (o3 = Date.now());
|
|
3907
3955
|
}), a3.__mouseover = function handleBarTrigger() {
|
|
3908
3956
|
s3() && !localStorage.getItem("playlight_exit_intent_disabled_by_user") && i3 && // Trigger exit intent
|
|
@@ -3920,7 +3968,7 @@ function App(e2, t2) {
|
|
|
3920
3968
|
}
|
|
3921
3969
|
}), Toaster(sibling(d2, 2), {}), append(e2, i2), pop(), o2();
|
|
3922
3970
|
}
|
|
3923
|
-
const
|
|
3971
|
+
const yt = {
|
|
3924
3972
|
button: {
|
|
3925
3973
|
position: "bottom-right",
|
|
3926
3974
|
visible: true
|
|
@@ -3929,11 +3977,11 @@ const bt = {
|
|
|
3929
3977
|
enabled: true
|
|
3930
3978
|
}
|
|
3931
3979
|
};
|
|
3932
|
-
let
|
|
3933
|
-
...
|
|
3980
|
+
let $t = {
|
|
3981
|
+
...yt
|
|
3934
3982
|
};
|
|
3935
3983
|
function initializeConfig(e2 = {}) {
|
|
3936
|
-
return
|
|
3984
|
+
return $t = deepMerge(yt, e2), $t;
|
|
3937
3985
|
}
|
|
3938
3986
|
function deepMerge(e2, t2) {
|
|
3939
3987
|
const n2 = {
|
|
@@ -3950,20 +3998,197 @@ function deepMerge(e2, t2) {
|
|
|
3950
3998
|
function isObject(e2) {
|
|
3951
3999
|
return e2 && "object" == typeof e2 && !Array.isArray(e2);
|
|
3952
4000
|
}
|
|
3953
|
-
|
|
4001
|
+
var wt = /* @__PURE__ */ template("<button><!></button>");
|
|
4002
|
+
function Button(e2, t2) {
|
|
4003
|
+
var n2 = wt();
|
|
4004
|
+
n2.__click = function(...e3) {
|
|
4005
|
+
var _a2;
|
|
4006
|
+
(_a2 = t2.onclick) == null ? void 0 : _a2.apply(this, e3);
|
|
4007
|
+
}, function snippet(e3, t3, ...n3) {
|
|
4008
|
+
var o2, s2 = e3, i2 = noop;
|
|
4009
|
+
block(() => {
|
|
4010
|
+
i2 !== (i2 = t3()) && (o2 && (destroy_effect(o2), o2 = null), o2 = branch(() => (
|
|
4011
|
+
/** @type {SnippetFn} */
|
|
4012
|
+
i2(s2, ...n3)
|
|
4013
|
+
)));
|
|
4014
|
+
}, w);
|
|
4015
|
+
}(child(n2), () => t2.children ?? noop), template_effect(() => set_class(n2, 1, `bg-foreground hover:bg-background hover:text-primary text-md cursor-pointer px-3 py-2 font-bold uppercase transition $${t2.class ?? ""}`)), append(e2, n2);
|
|
4016
|
+
}
|
|
4017
|
+
delegate(["click"]);
|
|
4018
|
+
var xt = /* @__PURE__ */ template('<div class="flex h-62 w-full items-center justify-center"><!></div>'), kt = /* @__PURE__ */ template('<div class="snap-center px-2"><!></div>'), Ct = /* @__PURE__ */ template('<!> <div class="bg-background/85 my-auto mr-3 ml-2 flex min-w-40 snap-center flex-wrap items-center justify-center gap-4 p-4 pb-6 shadow-xl backdrop-blur-xl"><p class="text-foreground w-full text-center text-lg font-semibold">Fancy more?</p> <!></div>', 1), on_click = (e2, t2, n2) => get$1(t2).scrollBy({
|
|
4019
|
+
left: 2 * -get$1(n2),
|
|
4020
|
+
behavior: "smooth"
|
|
4021
|
+
}), St = /* @__PURE__ */ template('<button class="bg-background/85 hover:bg-foreground hover:text-background text-foreground absolute top-1/2 left-2 z-20 -translate-y-1/2 transform border p-1 shadow-xl backdrop-blur-xl transition"><!></button>'), on_click_1 = (e2, t2, n2) => get$1(t2).scrollBy({
|
|
4022
|
+
left: 2 * get$1(n2),
|
|
4023
|
+
behavior: "smooth"
|
|
4024
|
+
}), Mt = /* @__PURE__ */ template('<button class="bg-background/85 hover:bg-foreground hover:text-background text-foreground absolute top-1/2 right-2 z-20 -translate-y-1/2 transform border p-1 shadow-xl backdrop-blur-xl transition"><!></button>'), It = /* @__PURE__ */ template("<!> <!>", 1), Tt = /* @__PURE__ */ template('<div class="playlight-sdk-container svelte-hgmfs5"><div class="h-full w-full px-3"><div class="fade-edges-mask no-scrollbar relative flex h-full w-full snap-x gap-2 overflow-x-auto svelte-hgmfs5"><!></div> <!></div></div>');
|
|
4025
|
+
function WidgetCarousel(e2, t2) {
|
|
4026
|
+
push(t2, true);
|
|
4027
|
+
const [n2, o2] = setup_stores();
|
|
4028
|
+
let s2 = state(true), i2 = state(proxy([])), a2 = state(proxy([])), l2 = state(void 0), c2 = state(void 0), u2 = state(0), d2 = state(false), f2 = state(true);
|
|
4029
|
+
onMount(async () => {
|
|
4030
|
+
var _a2, _b2, _c2, _d;
|
|
4031
|
+
if (set(a2, proxy(await tt.getCategories())), ((_a2 = get$1(a2)) == null ? void 0 : _a2.length) > 0) {
|
|
4032
|
+
const e3 = await tt.getCurrentGameInfo();
|
|
4033
|
+
set(l2, proxy((e3 == null ? void 0 : e3.category) && ((_b2 = get$1(a2)) == null ? void 0 : _b2.includes(e3 == null ? void 0 : e3.category)) ? e3 == null ? void 0 : e3.category : (_d = get$1(a2)) == null ? void 0 : _d[((_c2 = get$1(a2)) == null ? void 0 : _c2.length) - 1]));
|
|
4034
|
+
}
|
|
4035
|
+
await async function fetchGames() {
|
|
4036
|
+
try {
|
|
4037
|
+
set(s2, true);
|
|
4038
|
+
let e3 = await tt.getSuggestions(get$1(l2), 1), t3 = (e3 == null ? void 0 : e3.games) || [];
|
|
4039
|
+
if (t3.length < 10 && get$1(l2)) {
|
|
4040
|
+
const e4 = await tt.getSuggestions(null, 1), n3 = ((e4 == null ? void 0 : e4.games) || []).filter((e5) => !t3.some((t4) => t4.id === e5.id));
|
|
4041
|
+
t3 = [...t3, ...n3];
|
|
4042
|
+
}
|
|
4043
|
+
set(i2, proxy(t3.slice(0, 10)));
|
|
4044
|
+
} catch (e3) {
|
|
4045
|
+
console.error("Failed to load games for widget:", e3);
|
|
4046
|
+
} finally {
|
|
4047
|
+
set(s2, false);
|
|
4048
|
+
}
|
|
4049
|
+
}();
|
|
4050
|
+
});
|
|
4051
|
+
var p2 = Tt(), _2 = child(p2), g2 = child(_2), v2 = child(g2), consequent = (e3) => {
|
|
4052
|
+
var t3 = xt();
|
|
4053
|
+
Loader_circle(child(t3), {
|
|
4054
|
+
class: "animate-spin opacity-75",
|
|
4055
|
+
size: 30,
|
|
4056
|
+
strokeWidth: 2.5
|
|
4057
|
+
}), append(e3, t3);
|
|
4058
|
+
}, alternate = (e3) => {
|
|
4059
|
+
var t3 = Ct(), n3 = first_child(t3);
|
|
4060
|
+
each(n3, 17, () => get$1(i2), index, (e4, t4) => {
|
|
4061
|
+
var n4 = kt();
|
|
4062
|
+
GameCard(child(n4), {
|
|
4063
|
+
get game() {
|
|
4064
|
+
return get$1(t4);
|
|
4065
|
+
},
|
|
4066
|
+
compact: true,
|
|
4067
|
+
onClick: () => tt.trackClick(get$1(t4).id)
|
|
4068
|
+
}), function bind_element_size(e5, t5, n5) {
|
|
4069
|
+
var o4 = me.observe(e5, () => n5(e5[t5]));
|
|
4070
|
+
effect(() => (
|
|
4071
|
+
// The update could contain reads which should be ignored
|
|
4072
|
+
(untrack(() => n5(e5[t5])), o4)
|
|
4073
|
+
));
|
|
4074
|
+
}(n4, "clientWidth", (e5) => set(u2, e5)), append(e4, n4);
|
|
4075
|
+
});
|
|
4076
|
+
var o3 = sibling(n3, 2);
|
|
4077
|
+
Button(sibling(child(o3), 2), {
|
|
4078
|
+
onclick: () => {
|
|
4079
|
+
store_set(Ke, true), tt.trackOpen();
|
|
4080
|
+
},
|
|
4081
|
+
children: (e4, t4) => {
|
|
4082
|
+
append(e4, text("See all"));
|
|
4083
|
+
}
|
|
4084
|
+
}), append(e3, t3);
|
|
4085
|
+
};
|
|
4086
|
+
if_block(v2, (e3) => {
|
|
4087
|
+
get$1(s2) ? e3(consequent) : e3(alternate, false);
|
|
4088
|
+
}), bind_this(g2, (e3) => set(c2, e3), () => get$1(c2));
|
|
4089
|
+
var h2 = sibling(g2, 2), consequent_3 = (e3) => {
|
|
4090
|
+
var t3 = It(), n3 = first_child(t3), consequent_1 = (e4) => {
|
|
4091
|
+
var t4 = St();
|
|
4092
|
+
t4.__click = [on_click, c2, u2], function Chevron_left(e5, t5) {
|
|
4093
|
+
const n4 = legacy_rest_props(t5, ["children", "$$slots", "$$events", "$$legacy"]);
|
|
4094
|
+
Icon$1(e5, spread_props({
|
|
4095
|
+
name: "chevron-left"
|
|
4096
|
+
}, () => n4, {
|
|
4097
|
+
iconNode: [["path", {
|
|
4098
|
+
d: "m15 18-6-6 6-6"
|
|
4099
|
+
}]],
|
|
4100
|
+
children: (e6, n5) => {
|
|
4101
|
+
var o4 = comment();
|
|
4102
|
+
slot(first_child(o4), t5, "default", {}, null), append(e6, o4);
|
|
4103
|
+
},
|
|
4104
|
+
$$slots: {
|
|
4105
|
+
default: true
|
|
4106
|
+
}
|
|
4107
|
+
}));
|
|
4108
|
+
}(child(t4), {
|
|
4109
|
+
size: 22,
|
|
4110
|
+
strokeWidth: 2.25
|
|
4111
|
+
}), transition(3, t4, () => blur), append(e4, t4);
|
|
4112
|
+
};
|
|
4113
|
+
if_block(n3, (e4) => {
|
|
4114
|
+
get$1(d2) && e4(consequent_1);
|
|
4115
|
+
});
|
|
4116
|
+
var o3 = sibling(n3, 2), consequent_2 = (e4) => {
|
|
4117
|
+
var t4 = Mt();
|
|
4118
|
+
t4.__click = [on_click_1, c2, u2], function Chevron_right(e5, t5) {
|
|
4119
|
+
const n4 = legacy_rest_props(t5, ["children", "$$slots", "$$events", "$$legacy"]);
|
|
4120
|
+
Icon$1(e5, spread_props({
|
|
4121
|
+
name: "chevron-right"
|
|
4122
|
+
}, () => n4, {
|
|
4123
|
+
iconNode: [["path", {
|
|
4124
|
+
d: "m9 18 6-6-6-6"
|
|
4125
|
+
}]],
|
|
4126
|
+
children: (e6, n5) => {
|
|
4127
|
+
var o4 = comment();
|
|
4128
|
+
slot(first_child(o4), t5, "default", {}, null), append(e6, o4);
|
|
4129
|
+
},
|
|
4130
|
+
$$slots: {
|
|
4131
|
+
default: true
|
|
4132
|
+
}
|
|
4133
|
+
}));
|
|
4134
|
+
}(child(t4), {
|
|
4135
|
+
size: 22,
|
|
4136
|
+
strokeWidth: 2.25
|
|
4137
|
+
}), transition(3, t4, () => blur), append(e4, t4);
|
|
4138
|
+
};
|
|
4139
|
+
if_block(o3, (e4) => {
|
|
4140
|
+
get$1(f2) && e4(consequent_2);
|
|
4141
|
+
}), append(e3, t3);
|
|
4142
|
+
};
|
|
4143
|
+
if_block(h2, (e3) => {
|
|
4144
|
+
get$1(i2).length > 0 && e3(consequent_3);
|
|
4145
|
+
}), event("scroll", g2, (e3) => {
|
|
4146
|
+
set(d2, e3.target.scrollLeft > 20), set(f2, e3.target.scrollLeft < e3.target.scrollWidth - e3.target.clientWidth - 20);
|
|
4147
|
+
}), append(e2, p2), pop(), o2();
|
|
4148
|
+
}
|
|
4149
|
+
function initWidgets() {
|
|
4150
|
+
try {
|
|
4151
|
+
const e2 = document.querySelectorAll(".playlight-widget-carousel");
|
|
4152
|
+
e2.length > 0 && e2.forEach((e3) => {
|
|
4153
|
+
e3.dataset.playlightInitialized || (e3.dataset.playlightInitialized = "true", // Mount the carousel widget
|
|
4154
|
+
mount(WidgetCarousel, {
|
|
4155
|
+
target: e3
|
|
4156
|
+
}));
|
|
4157
|
+
});
|
|
4158
|
+
} catch (e2) {
|
|
4159
|
+
console.error("Playlight error occurred initializing and mounting carousel widget:", e2);
|
|
4160
|
+
}
|
|
4161
|
+
}
|
|
4162
|
+
delegate(["click"]);
|
|
4163
|
+
const Ot = new /**
|
|
4164
|
+
* The PlaylightSDK class
|
|
4165
|
+
*/
|
|
4166
|
+
(_c = class {
|
|
3954
4167
|
constructor() {
|
|
3955
4168
|
__privateAdd(this, _PlaylightSDK_instances);
|
|
3956
|
-
this.container = null, this.
|
|
4169
|
+
this.container = null, this.isInitialized = false, this.config = writable(null), this.api = tt;
|
|
3957
4170
|
}
|
|
3958
4171
|
/**
|
|
3959
4172
|
* Initialize Playlight
|
|
3960
4173
|
* @param {Object} [userConfig] - The playlight configuration object
|
|
3961
4174
|
*/
|
|
3962
4175
|
async init(e2 = {}) {
|
|
3963
|
-
return "undefined" == typeof window ? console.error("Playlight cannot run on the server, as it depends on browser APIs.") : this.isInitialized ? (console.warn("Playlight SDK already initialized!"), void (document.getElementById("playlight-sdk-container") || __privateMethod(this, _PlaylightSDK_instances,
|
|
4176
|
+
return "undefined" == typeof window ? console.error("Playlight cannot run on the server, as it depends on browser APIs.") : this.isInitialized ? (console.warn("Playlight SDK already initialized!"), void (document.getElementById("playlight-sdk-container") || __privateMethod(this, _PlaylightSDK_instances, s_fn).call(this))) : (
|
|
3964
4177
|
// Initialize configuration with defaults and user overrides
|
|
3965
|
-
(this.setConfig(e2), __privateMethod(this, _PlaylightSDK_instances,
|
|
3966
|
-
//
|
|
4178
|
+
(this.setConfig(e2), __privateMethod(this, _PlaylightSDK_instances, s_fn).call(this), // Create container and mount app
|
|
4179
|
+
// Widgets
|
|
4180
|
+
initWidgets(), function setupWidgetObserver() {
|
|
4181
|
+
try {
|
|
4182
|
+
new MutationObserver(() => {
|
|
4183
|
+
initWidgets();
|
|
4184
|
+
}).observe(document.body, {
|
|
4185
|
+
childList: true,
|
|
4186
|
+
subtree: true
|
|
4187
|
+
});
|
|
4188
|
+
} catch (e3) {
|
|
4189
|
+
console.error("Playlight error occurred setting up widget observer:", e3);
|
|
4190
|
+
}
|
|
4191
|
+
}(), // Fetch current game info to cache it
|
|
3967
4192
|
await this.api.getCurrentGameInfo(), void (this.isInitialized = true))
|
|
3968
4193
|
);
|
|
3969
4194
|
}
|
|
@@ -3972,7 +4197,7 @@ const $t = new (_c = class {
|
|
|
3972
4197
|
* @param {boolean} [value=true] - Whether to show the discovery
|
|
3973
4198
|
*/
|
|
3974
4199
|
setDiscovery(e2 = true) {
|
|
3975
|
-
this.isInitialized && (
|
|
4200
|
+
this.isInitialized && (Ke.set(e2), e2 && tt.trackOpen());
|
|
3976
4201
|
}
|
|
3977
4202
|
/**
|
|
3978
4203
|
* Update the configuration
|
|
@@ -3986,10 +4211,10 @@ const $t = new (_c = class {
|
|
|
3986
4211
|
* Mount the Svelte app to the playlight container
|
|
3987
4212
|
* @private
|
|
3988
4213
|
*/
|
|
3989
|
-
|
|
4214
|
+
s_fn = function() {
|
|
3990
4215
|
try {
|
|
3991
4216
|
this.container = document.createElement("div"), this.container.id = "playlight-sdk-container", this.container.className = "playlight-sdk-container", document.body.appendChild(this.container), // Mount (client-side alternative to render)
|
|
3992
|
-
|
|
4217
|
+
mount(App, {
|
|
3993
4218
|
target: this.container,
|
|
3994
4219
|
props: {
|
|
3995
4220
|
config: this.config
|
|
@@ -3999,8 +4224,8 @@ t_fn = function() {
|
|
|
3999
4224
|
console.error("Playlight error occured during mount:", e2);
|
|
4000
4225
|
}
|
|
4001
4226
|
}, _c)();
|
|
4002
|
-
"undefined" != typeof window && (window.playlightSDK =
|
|
4227
|
+
"undefined" != typeof window && (window.playlightSDK = Ot);
|
|
4003
4228
|
export {
|
|
4004
|
-
|
|
4229
|
+
Ot as default
|
|
4005
4230
|
};
|
|
4006
4231
|
//# sourceMappingURL=playlight-sdk.es.js.map
|