@puzzmo/sdk 1.0.32 → 1.0.34
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/README.md +3 -3
- package/dist/{createSimulator-COj3lAeu.js → createSimulator-CxuhQLO3.js} +461 -296
- package/dist/createSimulator-CxuhQLO3.js.map +1 -0
- package/dist/{createSimulator-DIT36V1k.cjs → createSimulator-DK8Pd9vS.cjs} +56 -35
- package/dist/createSimulator-DK8Pd9vS.cjs.map +1 -0
- package/dist/fonts.cjs +2 -2
- package/dist/fonts.cjs.map +1 -1
- package/dist/fonts.d.ts +15 -13
- package/dist/fonts.d.ts.map +1 -1
- package/dist/fonts.js +9 -7
- package/dist/fonts.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/simulator/createSimulator.d.ts.map +1 -1
- package/dist/simulator/index.cjs +1 -1
- package/dist/simulator/index.d.ts +1 -1
- package/dist/simulator/index.d.ts.map +1 -1
- package/dist/simulator/index.js +1 -1
- package/dist/simulator/normalizeThumbnail.d.ts +11 -0
- package/dist/simulator/normalizeThumbnail.d.ts.map +1 -0
- package/dist/simulator/standalone.cjs +1 -1
- package/dist/simulator/standalone.js +1 -1
- package/dist/simulator/state.d.ts +3 -1
- package/dist/simulator/state.d.ts.map +1 -1
- package/dist/simulator/types.d.ts +22 -1
- package/dist/simulator/types.d.ts.map +1 -1
- package/dist/simulator/views/DataView.d.ts.map +1 -1
- package/dist/simulator/views/HostView.d.ts +9 -0
- package/dist/simulator/views/HostView.d.ts.map +1 -0
- package/dist/simulator/views/ThumbView.d.ts.map +1 -1
- package/dist/simulator/views/index.d.ts +1 -0
- package/dist/simulator/views/index.d.ts.map +1 -1
- package/dist/types.d.ts +39 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.d.ts +22 -2
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +3 -2
- package/dist/vite.js.map +1 -1
- package/package.json +1 -1
- package/dist/createSimulator-COj3lAeu.js.map +0 -1
- package/dist/createSimulator-DIT36V1k.cjs.map +0 -1
|
@@ -314,9 +314,26 @@ var r = {
|
|
|
314
314
|
fixturePuzzle: "simulator-fixture-puzzle",
|
|
315
315
|
renderHost: "simulator-render-host",
|
|
316
316
|
renderContext: "simulator-render-context",
|
|
317
|
-
gameSettings: "simulator-game-settings"
|
|
317
|
+
gameSettings: "simulator-game-settings",
|
|
318
|
+
hostContext: "simulator-host-context"
|
|
318
319
|
};
|
|
320
|
+
/** The Host tab's persisted `hostContext` override, or null when the tab hasn't set one. */
|
|
319
321
|
function i() {
|
|
322
|
+
let e = localStorage.getItem(r.hostContext);
|
|
323
|
+
if (!e) return null;
|
|
324
|
+
try {
|
|
325
|
+
let t = JSON.parse(e);
|
|
326
|
+
if (Array.isArray(t)) return t;
|
|
327
|
+
} catch (e) {}
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
function a(e) {
|
|
331
|
+
localStorage.setItem(r.hostContext, JSON.stringify(e));
|
|
332
|
+
}
|
|
333
|
+
function o() {
|
|
334
|
+
localStorage.removeItem(r.hostContext);
|
|
335
|
+
}
|
|
336
|
+
function s() {
|
|
320
337
|
let e = localStorage.getItem(r.gameSettings);
|
|
321
338
|
if (!e) return {};
|
|
322
339
|
try {
|
|
@@ -325,7 +342,7 @@ function i() {
|
|
|
325
342
|
} catch (e) {}
|
|
326
343
|
return {};
|
|
327
344
|
}
|
|
328
|
-
function
|
|
345
|
+
function c() {
|
|
329
346
|
let e = localStorage.getItem(r.theme);
|
|
330
347
|
if (e) {
|
|
331
348
|
let t = n.find((t) => t.name === e);
|
|
@@ -333,16 +350,16 @@ function a() {
|
|
|
333
350
|
}
|
|
334
351
|
return n[0];
|
|
335
352
|
}
|
|
336
|
-
function
|
|
353
|
+
function l(e) {
|
|
337
354
|
var t;
|
|
338
355
|
let n = localStorage.getItem(r.tab);
|
|
339
356
|
return n && e.includes(n) ? n : (t = e[0]) == null ? "ctrl" : t;
|
|
340
357
|
}
|
|
341
|
-
function
|
|
358
|
+
function u(e) {
|
|
342
359
|
let t = localStorage.getItem(r.collapsed);
|
|
343
360
|
return t === null ? e : t === "true";
|
|
344
361
|
}
|
|
345
|
-
function
|
|
362
|
+
function d() {
|
|
346
363
|
let e = localStorage.getItem(r.renderHost);
|
|
347
364
|
return e && [
|
|
348
365
|
"game",
|
|
@@ -350,7 +367,7 @@ function c() {
|
|
|
350
367
|
"opengraph"
|
|
351
368
|
].includes(e) ? e : "game";
|
|
352
369
|
}
|
|
353
|
-
function
|
|
370
|
+
function f() {
|
|
354
371
|
let e = localStorage.getItem(r.renderContext);
|
|
355
372
|
if (e && [
|
|
356
373
|
"preview",
|
|
@@ -359,49 +376,55 @@ function l() {
|
|
|
359
376
|
"timeline"
|
|
360
377
|
].includes(e)) return e;
|
|
361
378
|
}
|
|
362
|
-
function
|
|
363
|
-
var
|
|
364
|
-
let
|
|
379
|
+
function p(e, t, n) {
|
|
380
|
+
var a, o, p;
|
|
381
|
+
let m = localStorage.getItem(r.fixtureCategory), h = localStorage.getItem(r.fixturePuzzle), g = i();
|
|
365
382
|
return {
|
|
366
|
-
|
|
383
|
+
hostContext: (a = g == null ? e.hostContext : g) == null ? [{
|
|
384
|
+
type: "app",
|
|
385
|
+
layout: "desktop",
|
|
386
|
+
host: null
|
|
387
|
+
}] : a,
|
|
388
|
+
hostContextIsOverridden: g !== null,
|
|
389
|
+
isCollapsed: u((o = e.collapsed) == null ? !0 : o),
|
|
367
390
|
isPaused: !1,
|
|
368
391
|
hasStarted: !1,
|
|
369
|
-
activeTab:
|
|
392
|
+
activeTab: l(n),
|
|
370
393
|
puzzleData: null,
|
|
371
394
|
originalPuzzle: "",
|
|
372
395
|
currentInputStr: "",
|
|
373
396
|
completionData: null,
|
|
374
|
-
selectedTheme:
|
|
375
|
-
selectedCategory:
|
|
376
|
-
selectedPuzzle:
|
|
377
|
-
renderHost:
|
|
378
|
-
renderContext:
|
|
379
|
-
gameSettings:
|
|
397
|
+
selectedTheme: c(),
|
|
398
|
+
selectedCategory: m && t.includes(m) ? m : (p = t[0]) == null ? null : p,
|
|
399
|
+
selectedPuzzle: h == null ? null : h,
|
|
400
|
+
renderHost: d(),
|
|
401
|
+
renderContext: f(),
|
|
402
|
+
gameSettings: s(),
|
|
380
403
|
settingsComponents: null
|
|
381
404
|
};
|
|
382
405
|
}
|
|
383
|
-
function
|
|
406
|
+
function m(e) {
|
|
384
407
|
localStorage.setItem(r.gameSettings, JSON.stringify(e));
|
|
385
408
|
}
|
|
386
|
-
function
|
|
409
|
+
function h() {
|
|
387
410
|
localStorage.removeItem(r.gameSettings);
|
|
388
411
|
}
|
|
389
|
-
function
|
|
412
|
+
function g(e) {
|
|
390
413
|
localStorage.setItem(r.collapsed, String(e));
|
|
391
414
|
}
|
|
392
|
-
function
|
|
415
|
+
function ee(e) {
|
|
393
416
|
localStorage.setItem(r.tab, e);
|
|
394
417
|
}
|
|
395
|
-
function
|
|
418
|
+
function te(e) {
|
|
396
419
|
localStorage.setItem(r.theme, e);
|
|
397
420
|
}
|
|
398
|
-
function
|
|
421
|
+
function _(e) {
|
|
399
422
|
localStorage.setItem(r.fixtureCategory, e);
|
|
400
423
|
}
|
|
401
|
-
function
|
|
424
|
+
function v(e) {
|
|
402
425
|
localStorage.setItem(r.fixturePuzzle, e);
|
|
403
426
|
}
|
|
404
|
-
function
|
|
427
|
+
function ne() {
|
|
405
428
|
localStorage.removeItem(r.fixturePuzzle);
|
|
406
429
|
}
|
|
407
430
|
function y(e) {
|
|
@@ -410,7 +433,7 @@ function y(e) {
|
|
|
410
433
|
function b(e) {
|
|
411
434
|
e ? localStorage.setItem(r.renderContext, e) : localStorage.removeItem(r.renderContext);
|
|
412
435
|
}
|
|
413
|
-
function
|
|
436
|
+
function re(e) {
|
|
414
437
|
let t = [];
|
|
415
438
|
return {
|
|
416
439
|
log(n, r, i) {
|
|
@@ -435,13 +458,13 @@ function ee(e) {
|
|
|
435
458
|
}
|
|
436
459
|
};
|
|
437
460
|
}
|
|
438
|
-
function
|
|
461
|
+
function ie(e, t, n) {
|
|
439
462
|
console.log("Simulator sending:", e, t), n == null || n.log(e, t, "out"), window.postMessage({
|
|
440
463
|
type: e,
|
|
441
464
|
data: t
|
|
442
465
|
}, "*");
|
|
443
466
|
}
|
|
444
|
-
function
|
|
467
|
+
function ae(e, t) {
|
|
445
468
|
let n = (n) => {
|
|
446
469
|
var r, i, a;
|
|
447
470
|
if (!(!(n == null || (r = n.data) == null) && r.type)) return;
|
|
@@ -451,7 +474,7 @@ function ne(e, t) {
|
|
|
451
474
|
return window.addEventListener("message", n), () => window.removeEventListener("message", n);
|
|
452
475
|
}
|
|
453
476
|
/** Parse fixture imports into a structured format: { category: { filename: data } } */
|
|
454
|
-
function
|
|
477
|
+
function oe(e) {
|
|
455
478
|
let t = /* @__PURE__ */ new Map();
|
|
456
479
|
console.log("Simulator: Parsing fixtures", Object.keys(e));
|
|
457
480
|
for (let [o, s] of Object.entries(e)) {
|
|
@@ -470,7 +493,7 @@ function re(e) {
|
|
|
470
493
|
}), t;
|
|
471
494
|
}
|
|
472
495
|
/** Render fixture selector HTML */
|
|
473
|
-
function
|
|
496
|
+
function x(e, t) {
|
|
474
497
|
return e.length === 0 ? "" : `
|
|
475
498
|
<div class="simulator-fixtures">
|
|
476
499
|
<div class="simulator-field">
|
|
@@ -487,7 +510,7 @@ function ie(e, t) {
|
|
|
487
510
|
`;
|
|
488
511
|
}
|
|
489
512
|
/** Update puzzle select options based on selected category */
|
|
490
|
-
function
|
|
513
|
+
function S(e, t, n, r) {
|
|
491
514
|
let i = t.get(n);
|
|
492
515
|
if (!i) return null;
|
|
493
516
|
let a = Array.from(i.keys()), o = r;
|
|
@@ -498,11 +521,11 @@ function x(e, t, n, r) {
|
|
|
498
521
|
return e.innerHTML = a.map((e) => `<option value="${e}" ${e === o ? "selected" : ""}>${e}</option>`).join(""), o;
|
|
499
522
|
}
|
|
500
523
|
/** Get puzzle data from fixtures */
|
|
501
|
-
function
|
|
524
|
+
function C(e, t, n) {
|
|
502
525
|
var r, i;
|
|
503
526
|
return !t || !n || (r = (i = e.get(t)) == null ? void 0 : i.get(n)) == null ? null : r;
|
|
504
527
|
}
|
|
505
|
-
function
|
|
528
|
+
function se() {
|
|
506
529
|
return {
|
|
507
530
|
id: "ctrl",
|
|
508
531
|
label: "Ctrl",
|
|
@@ -517,19 +540,19 @@ function ae() {
|
|
|
517
540
|
selectedCategory: e.state.selectedCategory,
|
|
518
541
|
selectedPuzzle: e.state.selectedPuzzle
|
|
519
542
|
}), e.fixtures && e.fixtureCategories.length > 0 && i) {
|
|
520
|
-
i.innerHTML =
|
|
543
|
+
i.innerHTML = x(e.fixtureCategories, e.state.selectedCategory);
|
|
521
544
|
let t = e.getElement("#simulator-fixture-category"), n = e.getElement("#simulator-fixture-puzzle");
|
|
522
545
|
if (t && n && e.state.selectedCategory) {
|
|
523
|
-
e.state.selectedPuzzle =
|
|
524
|
-
let r =
|
|
546
|
+
e.state.selectedPuzzle = S(n, e.fixtures, e.state.selectedCategory, e.state.selectedPuzzle);
|
|
547
|
+
let r = C(e.fixtures, e.state.selectedCategory, e.state.selectedPuzzle);
|
|
525
548
|
console.log("Simulator: Loading fixture puzzle", {
|
|
526
549
|
category: e.state.selectedCategory,
|
|
527
550
|
puzzle: e.state.selectedPuzzle,
|
|
528
551
|
hasPuzzleData: !!r
|
|
529
|
-
}), r && (e.state.puzzleData = r, e.state.originalPuzzle = r, e.state.selectedCategory &&
|
|
530
|
-
console.log("Simulator: Category changed, reloading...", t.value),
|
|
552
|
+
}), r && (e.state.puzzleData = r, e.state.originalPuzzle = r, e.state.selectedCategory && _(e.state.selectedCategory), e.state.selectedPuzzle && v(e.state.selectedPuzzle)), t.addEventListener("change", () => {
|
|
553
|
+
console.log("Simulator: Category changed, reloading...", t.value), _(t.value), ne(), window.location.reload();
|
|
531
554
|
}), n.addEventListener("change", () => {
|
|
532
|
-
console.log("Simulator: Puzzle changed, reloading...", n.value),
|
|
555
|
+
console.log("Simulator: Puzzle changed, reloading...", n.value), v(n.value), window.location.reload();
|
|
533
556
|
});
|
|
534
557
|
}
|
|
535
558
|
}
|
|
@@ -547,9 +570,49 @@ function ae() {
|
|
|
547
570
|
}
|
|
548
571
|
};
|
|
549
572
|
}
|
|
550
|
-
|
|
573
|
+
/**
|
|
574
|
+
* Coerces a thumbnail render result into a `ThumbnailResult`. New game bundles return the object
|
|
575
|
+
* directly; bundles still built against the old `renderThumbnail(): string` contract return a bare
|
|
576
|
+
* SVG string, so we parse the dimensions out of it (falling back to a square).
|
|
577
|
+
*
|
|
578
|
+
* Inlined here (rather than shared with the rest of the monorepo) because the SDK ships to OSS and
|
|
579
|
+
* must stay self-contained.
|
|
580
|
+
*/
|
|
581
|
+
function w(e) {
|
|
582
|
+
var t;
|
|
583
|
+
if (typeof e != "string") return e;
|
|
584
|
+
let n = (t = T(e)) == null ? {
|
|
585
|
+
width: 800,
|
|
586
|
+
height: 800
|
|
587
|
+
} : t;
|
|
588
|
+
return {
|
|
589
|
+
svg: e,
|
|
590
|
+
width: n.width,
|
|
591
|
+
height: n.height
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
/** Reads an SVG's intrinsic size from its `viewBox` (preferred) or its `width`/`height` attributes. */
|
|
595
|
+
function T(e) {
|
|
596
|
+
var t, n, r, i;
|
|
597
|
+
let a = e.indexOf("<svg");
|
|
598
|
+
if (a === -1) return;
|
|
599
|
+
let o = e.indexOf(">", a), s = o === -1 ? e.slice(a) : e.slice(a, o + 1), c = /viewBox\s*=\s*["']\s*[-\d.]+[\s,]+[-\d.]+[\s,]+([\d.]+)[\s,]+([\d.]+)/i.exec(s);
|
|
600
|
+
if (c) {
|
|
601
|
+
let e = parseFloat(c[1]), t = parseFloat(c[2]);
|
|
602
|
+
if (e > 0 && t > 0) return {
|
|
603
|
+
width: e,
|
|
604
|
+
height: t
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
let l = parseFloat((t = (n = /\bwidth\s*=\s*["']\s*([\d.]+)(?:px)?\s*["']/i.exec(s)) == null ? void 0 : n[1]) == null ? "" : t), u = parseFloat((r = (i = /\bheight\s*=\s*["']\s*([\d.]+)(?:px)?\s*["']/i.exec(s)) == null ? void 0 : i[1]) == null ? "" : r);
|
|
608
|
+
if (l > 0 && u > 0) return {
|
|
609
|
+
width: l,
|
|
610
|
+
height: u
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
var E = "simulator-saved-states";
|
|
551
614
|
/** Find thumbnail function on globalThis (looks for functions ending in "Thumbnail") */
|
|
552
|
-
function
|
|
615
|
+
function D() {
|
|
553
616
|
let e = globalThis;
|
|
554
617
|
for (let t of Object.keys(e)) if (t.endsWith("Thumbnail") && typeof e[t] == "function") return {
|
|
555
618
|
name: t,
|
|
@@ -558,8 +621,8 @@ function w() {
|
|
|
558
621
|
return null;
|
|
559
622
|
}
|
|
560
623
|
/** Generate a small thumbnail SVG for a given input string */
|
|
561
|
-
function
|
|
562
|
-
let n =
|
|
624
|
+
function O(e, t) {
|
|
625
|
+
let n = D();
|
|
563
626
|
if (!n) return "";
|
|
564
627
|
try {
|
|
565
628
|
var r;
|
|
@@ -569,19 +632,19 @@ function T(e, t) {
|
|
|
569
632
|
strict: !0,
|
|
570
633
|
renderHost: "game"
|
|
571
634
|
};
|
|
572
|
-
return n.fn(i, t, a);
|
|
635
|
+
return w(n.fn(i, t, a)).svg;
|
|
573
636
|
} catch (e) {
|
|
574
637
|
return "";
|
|
575
638
|
}
|
|
576
639
|
}
|
|
577
|
-
var
|
|
578
|
-
function
|
|
640
|
+
var k = [];
|
|
641
|
+
function A(e, t = 8) {
|
|
579
642
|
let n = 14 * t + 8 + 4;
|
|
580
643
|
e.style.height = "auto";
|
|
581
644
|
let r = Math.min(Math.max(e.scrollHeight, 40), n);
|
|
582
645
|
e.style.height = `${r}px`;
|
|
583
646
|
}
|
|
584
|
-
function
|
|
647
|
+
function ce() {
|
|
585
648
|
let e = "", t = "";
|
|
586
649
|
return {
|
|
587
650
|
id: "data",
|
|
@@ -599,102 +662,102 @@ function oe() {
|
|
|
599
662
|
let i = n.getElement(".data-view-container");
|
|
600
663
|
i == null || i.querySelectorAll(".data-subtab-content").forEach((e) => {
|
|
601
664
|
e.classList.toggle("active", e.id === `data-subtab-${t}`);
|
|
602
|
-
}), t === "edit" ?
|
|
665
|
+
}), t === "edit" ? F(n) : t === "history" ? M(n) : t === "saves" && N(n);
|
|
603
666
|
});
|
|
604
667
|
});
|
|
605
668
|
let i = n.getElement("#simulator-puzzle"), a = n.getElement("#simulator-input"), o = n.getElement("#simulator-puzzle-reset"), s = n.getElement("#simulator-puzzle-apply"), c = n.getElement("#simulator-input-reset"), l = n.getElement("#simulator-input-apply"), u = n.getElement("#simulator-start"), d = n.getElement("#simulator-pause");
|
|
606
669
|
setTimeout(() => {
|
|
607
|
-
i && n.state.originalPuzzle && (i.value = n.state.originalPuzzle, e = n.state.originalPuzzle,
|
|
670
|
+
i && n.state.originalPuzzle && (i.value = n.state.originalPuzzle, e = n.state.originalPuzzle, A(i)), a && n.state.currentInputStr && (a.value = n.state.currentInputStr, t = n.state.currentInputStr, A(a));
|
|
608
671
|
}, 0), i == null || i.addEventListener("input", () => {
|
|
609
|
-
|
|
672
|
+
A(i);
|
|
610
673
|
let t = i.value !== e;
|
|
611
674
|
s && (s.disabled = !t);
|
|
612
675
|
}), a == null || a.addEventListener("input", () => {
|
|
613
|
-
|
|
676
|
+
A(a);
|
|
614
677
|
let e = a.value !== t;
|
|
615
678
|
l && (l.disabled = !e);
|
|
616
679
|
}), o == null || o.addEventListener("click", () => {
|
|
617
|
-
i && (i.value = n.state.originalPuzzle, e = n.state.originalPuzzle,
|
|
680
|
+
i && (i.value = n.state.originalPuzzle, e = n.state.originalPuzzle, A(i), s && (s.disabled = !0));
|
|
618
681
|
}), s == null || s.addEventListener("click", () => {
|
|
619
682
|
i && (n.state.puzzleData = i.value, n.state.originalPuzzle = i.value, e = i.value, n.sendToGame("RETRY_PUZZLE", {}), n.state.hasStarted = !1, n.state.isPaused = !1, d && (d.disabled = !0, d.textContent = "Pause"), u && (u.textContent = "Start"), n.updateStatus("Puzzle updated", "ready"), s.disabled = !0);
|
|
620
683
|
}), c == null || c.addEventListener("click", () => {
|
|
621
|
-
a && (a.value = t,
|
|
684
|
+
a && (a.value = t, A(a), l && (l.disabled = !0));
|
|
622
685
|
}), l == null || l.addEventListener("click", () => {
|
|
623
686
|
a && (n.state.currentInputStr = a.value, t = a.value, console.log("Simulator: Input string updated (game restart required to apply)"), n.updateStatus("Input stored", "ready"), l.disabled = !0);
|
|
624
687
|
});
|
|
625
688
|
let f = n.getElement("#simulator-history-clear");
|
|
626
689
|
f == null || f.addEventListener("click", () => {
|
|
627
|
-
|
|
690
|
+
k = [], M(n);
|
|
628
691
|
});
|
|
629
692
|
let p = n.getElement("#simulator-save-name"), m = n.getElement("#simulator-save-btn");
|
|
630
693
|
m == null || m.addEventListener("click", () => {
|
|
631
694
|
if (!p || !p.value.trim()) return;
|
|
632
|
-
let e =
|
|
695
|
+
let e = j(), t = {
|
|
633
696
|
name: p.value.trim(),
|
|
634
697
|
puzzleStr: n.state.originalPuzzle,
|
|
635
698
|
inputStr: n.state.currentInputStr,
|
|
636
699
|
timestamp: Date.now()
|
|
637
700
|
};
|
|
638
|
-
e.push(t), localStorage.setItem(
|
|
639
|
-
}),
|
|
701
|
+
e.push(t), localStorage.setItem(E, JSON.stringify(e)), p.value = "", N(n);
|
|
702
|
+
}), N(n);
|
|
640
703
|
},
|
|
641
704
|
onActivate(n) {
|
|
642
|
-
e = n.state.originalPuzzle, t = n.state.currentInputStr,
|
|
705
|
+
e = n.state.originalPuzzle, t = n.state.currentInputStr, F(n), M(n);
|
|
643
706
|
},
|
|
644
707
|
onMessage(e, n, r) {
|
|
645
708
|
var i, a;
|
|
646
709
|
let o = r.getElement("#simulator-input"), s = r.getElement("#simulator-input-apply"), c = (i = n == null || (a = n.input) == null ? void 0 : a.boardState) == null ? n == null ? void 0 : n.boardState : i;
|
|
647
710
|
if (e === "UPLOAD_NEW_GAME_STATE" && c) {
|
|
648
|
-
if (r.state.currentInputStr = c,
|
|
649
|
-
|
|
711
|
+
if (r.state.currentInputStr = c, k.length === 0 || k[k.length - 1].value !== c) {
|
|
712
|
+
k.push({
|
|
650
713
|
value: c,
|
|
651
714
|
timestamp: Date.now()
|
|
652
|
-
}),
|
|
715
|
+
}), k.length > 100 && (k = k.slice(-100));
|
|
653
716
|
let e = r.getElement("#data-subtab-history");
|
|
654
|
-
e != null && e.classList.contains("active") &&
|
|
717
|
+
e != null && e.classList.contains("active") && M(r);
|
|
655
718
|
}
|
|
656
|
-
o && (o.value = r.state.currentInputStr, t = r.state.currentInputStr,
|
|
719
|
+
o && (o.value = r.state.currentInputStr, t = r.state.currentInputStr, A(o), s && (s.disabled = !0));
|
|
657
720
|
}
|
|
658
721
|
}
|
|
659
722
|
};
|
|
660
723
|
}
|
|
661
|
-
function
|
|
724
|
+
function j() {
|
|
662
725
|
try {
|
|
663
|
-
let e = localStorage.getItem(
|
|
726
|
+
let e = localStorage.getItem(E);
|
|
664
727
|
return e ? JSON.parse(e) : [];
|
|
665
728
|
} catch (e) {
|
|
666
729
|
return [];
|
|
667
730
|
}
|
|
668
731
|
}
|
|
669
|
-
function
|
|
732
|
+
function M(e) {
|
|
670
733
|
let t = e.getElement("#simulator-history-list");
|
|
671
734
|
if (t) {
|
|
672
|
-
if (t.style.setProperty("--history-thumb-bg", e.state.selectedTheme.a_bg),
|
|
735
|
+
if (t.style.setProperty("--history-thumb-bg", e.state.selectedTheme.a_bg), k.length === 0) {
|
|
673
736
|
t.innerHTML = "<div class=\"simulator-empty\">No history yet</div>";
|
|
674
737
|
return;
|
|
675
738
|
}
|
|
676
|
-
t.innerHTML = [...
|
|
677
|
-
let r =
|
|
739
|
+
t.innerHTML = [...k].reverse().map((t, n) => {
|
|
740
|
+
let r = k.length - 1 - n, i = new Date(t.timestamp).toLocaleTimeString(), a = t.value.length > 60 ? t.value.slice(0, 60) + "..." : t.value;
|
|
678
741
|
return `
|
|
679
742
|
<div class="history-item" data-history-idx="${r}">
|
|
680
|
-
<div class="history-item-thumb">${
|
|
743
|
+
<div class="history-item-thumb">${O(e, t.value)}</div>
|
|
681
744
|
<div class="history-item-content">
|
|
682
745
|
<div class="history-item-header">
|
|
683
746
|
<span class="history-item-num">#${r + 1}</span>
|
|
684
747
|
<span class="history-item-time">${i}</span>
|
|
685
748
|
<button class="simulator-btn tiny history-restore-btn" data-history-idx="${r}">Restore</button>
|
|
686
749
|
</div>
|
|
687
|
-
<div class="history-item-preview">${
|
|
750
|
+
<div class="history-item-preview">${P(a)}</div>
|
|
688
751
|
</div>
|
|
689
752
|
</div>
|
|
690
753
|
`;
|
|
691
754
|
}).join(""), t.querySelectorAll(".history-restore-btn").forEach((t) => {
|
|
692
755
|
t.addEventListener("click", (t) => {
|
|
693
|
-
let n = parseInt(t.target.getAttribute("data-history-idx") || "0"), r =
|
|
756
|
+
let n = parseInt(t.target.getAttribute("data-history-idx") || "0"), r = k[n];
|
|
694
757
|
if (r) {
|
|
695
758
|
e.state.currentInputStr = r.value;
|
|
696
759
|
let t = e.getElement("#simulator-input");
|
|
697
|
-
t && (t.value = r.value,
|
|
760
|
+
t && (t.value = r.value, A(t)), e.updateStatus("Input restored from history", "ready");
|
|
698
761
|
let n = e.getElement(".data-subtab[data-subtab=\"edit\"]");
|
|
699
762
|
n == null || n.click();
|
|
700
763
|
}
|
|
@@ -702,10 +765,10 @@ function k(e) {
|
|
|
702
765
|
});
|
|
703
766
|
}
|
|
704
767
|
}
|
|
705
|
-
function
|
|
768
|
+
function N(e) {
|
|
706
769
|
let t = e.getElement("#simulator-saves-list");
|
|
707
770
|
if (!t) return;
|
|
708
|
-
let n =
|
|
771
|
+
let n = j();
|
|
709
772
|
if (n.length === 0) {
|
|
710
773
|
t.innerHTML = "<div class=\"simulator-empty\">No saved states</div>";
|
|
711
774
|
return;
|
|
@@ -715,7 +778,7 @@ function A(e) {
|
|
|
715
778
|
return `
|
|
716
779
|
<div class="save-item">
|
|
717
780
|
<div class="save-item-header">
|
|
718
|
-
<span class="save-item-name">${
|
|
781
|
+
<span class="save-item-name">${P(e.name)}</span>
|
|
719
782
|
<span class="save-item-time">${i} ${a}</span>
|
|
720
783
|
</div>
|
|
721
784
|
<div class="save-item-actions">
|
|
@@ -730,7 +793,7 @@ function A(e) {
|
|
|
730
793
|
if (r) {
|
|
731
794
|
e.state.puzzleData = r.puzzleStr, e.state.originalPuzzle = r.puzzleStr, e.state.currentInputStr = r.inputStr;
|
|
732
795
|
let t = e.getElement("#simulator-puzzle"), n = e.getElement("#simulator-input");
|
|
733
|
-
t && (t.value = r.puzzleStr,
|
|
796
|
+
t && (t.value = r.puzzleStr, A(t)), n && (n.value = r.inputStr, A(n)), e.updateStatus(`Loaded: ${r.name}`, "ready");
|
|
734
797
|
let i = e.getElement(".data-subtab[data-subtab=\"edit\"]");
|
|
735
798
|
i == null || i.click();
|
|
736
799
|
}
|
|
@@ -738,21 +801,21 @@ function A(e) {
|
|
|
738
801
|
}), t.querySelectorAll(".save-delete-btn").forEach((t) => {
|
|
739
802
|
t.addEventListener("click", (t) => {
|
|
740
803
|
let r = parseInt(t.target.getAttribute("data-save-idx") || "0"), i = n.filter((e, t) => t !== r);
|
|
741
|
-
localStorage.setItem(
|
|
804
|
+
localStorage.setItem(E, JSON.stringify(i)), N(e);
|
|
742
805
|
});
|
|
743
806
|
});
|
|
744
807
|
}
|
|
745
|
-
function
|
|
808
|
+
function P(e) {
|
|
746
809
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
747
810
|
}
|
|
748
|
-
function
|
|
811
|
+
function F(e) {
|
|
749
812
|
let t = e.getElement("#simulator-puzzle"), n = e.getElement("#simulator-input"), r = e.getElement("#simulator-puzzle-apply"), i = e.getElement("#simulator-input-apply");
|
|
750
|
-
t && e.state.originalPuzzle && (t.value = e.state.originalPuzzle,
|
|
813
|
+
t && e.state.originalPuzzle && (t.value = e.state.originalPuzzle, A(t), r && (r.disabled = !0)), n && (n.value = e.state.currentInputStr, A(n), i && (i.disabled = !0));
|
|
751
814
|
}
|
|
752
|
-
function
|
|
815
|
+
function I(e) {
|
|
753
816
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
754
817
|
}
|
|
755
|
-
function
|
|
818
|
+
function le() {
|
|
756
819
|
let e = 0;
|
|
757
820
|
return {
|
|
758
821
|
id: "msgs",
|
|
@@ -779,7 +842,7 @@ function se() {
|
|
|
779
842
|
<span class="simulator-msg-type">${t.direction === "out" ? "→" : "←"} ${t.type}</span>
|
|
780
843
|
<span class="simulator-msg-time">${t.time}</span>
|
|
781
844
|
</div>
|
|
782
|
-
${a ? `<div class="simulator-msg-data">${
|
|
845
|
+
${a ? `<div class="simulator-msg-data">${I(a)}</div>` : ""}
|
|
783
846
|
`;
|
|
784
847
|
let o = i.querySelector(".simulator-msg-data");
|
|
785
848
|
for (o && o.addEventListener("click", () => {
|
|
@@ -790,7 +853,7 @@ function se() {
|
|
|
790
853
|
}
|
|
791
854
|
};
|
|
792
855
|
}
|
|
793
|
-
function
|
|
856
|
+
function ue() {
|
|
794
857
|
return {
|
|
795
858
|
id: "done",
|
|
796
859
|
label: "Done",
|
|
@@ -827,7 +890,7 @@ function ce() {
|
|
|
827
890
|
}
|
|
828
891
|
};
|
|
829
892
|
}
|
|
830
|
-
function
|
|
893
|
+
function de() {
|
|
831
894
|
let e = [], t = () => (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", { hour12: !1 }), n = (e) => {
|
|
832
895
|
let { checkpointName: t, augConfig: n, time: r } = e, i = n == null ? void 0 : n.deeds;
|
|
833
896
|
return `
|
|
@@ -878,7 +941,7 @@ function le() {
|
|
|
878
941
|
};
|
|
879
942
|
}
|
|
880
943
|
/** Find thumbnail function on globalThis (looks for functions ending in "Thumbnail") */
|
|
881
|
-
function
|
|
944
|
+
function L() {
|
|
882
945
|
let e = globalThis;
|
|
883
946
|
for (let t of Object.keys(e)) if (t.endsWith("Thumbnail") && typeof e[t] == "function") return {
|
|
884
947
|
name: t,
|
|
@@ -886,7 +949,7 @@ function P() {
|
|
|
886
949
|
};
|
|
887
950
|
return null;
|
|
888
951
|
}
|
|
889
|
-
function
|
|
952
|
+
function fe() {
|
|
890
953
|
return {
|
|
891
954
|
id: "thumb",
|
|
892
955
|
label: "Thumb",
|
|
@@ -911,7 +974,7 @@ function ue() {
|
|
|
911
974
|
updatePreview: (e) => {
|
|
912
975
|
let t = e.getElement("#simulator-thumb-preview"), n = e.getElement("#simulator-thumb-fn");
|
|
913
976
|
t == null || t.style.setProperty("--sim-thumb-bg", e.state.selectedTheme.g_bg);
|
|
914
|
-
let r =
|
|
977
|
+
let r = L();
|
|
915
978
|
if (!r) {
|
|
916
979
|
t && (t.innerHTML = "<span class=\"simulator-empty\">No thumbnail function found</span>"), n && (n.textContent = "");
|
|
917
980
|
return;
|
|
@@ -925,7 +988,7 @@ function ue() {
|
|
|
925
988
|
strict: !0,
|
|
926
989
|
renderHost: e.state.renderHost,
|
|
927
990
|
renderContext: e.state.renderContext
|
|
928
|
-
}, o = r.fn(n, e.state.currentInputStr, a);
|
|
991
|
+
}, { svg: o } = w(r.fn(n, e.state.currentInputStr, a));
|
|
929
992
|
t && (t.innerHTML = o);
|
|
930
993
|
} catch (e) {
|
|
931
994
|
console.error("Simulator: Thumbnail error", e), t && (t.innerHTML = `<span class="simulator-empty">Error: ${e}</span>`);
|
|
@@ -934,7 +997,7 @@ function ue() {
|
|
|
934
997
|
};
|
|
935
998
|
}
|
|
936
999
|
/** Generate theme preview HTML showing key colors */
|
|
937
|
-
function
|
|
1000
|
+
function R(e) {
|
|
938
1001
|
let t = [
|
|
939
1002
|
e.key,
|
|
940
1003
|
e.subBrand,
|
|
@@ -945,7 +1008,7 @@ function F(e) {
|
|
|
945
1008
|
].map((e) => `<div class="simulator-theme-preview-cell" style="background: ${e}"></div>`).join("");
|
|
946
1009
|
return `<div class="simulator-theme-preview" style="background: ${e.g_bg}">${t}</div>`;
|
|
947
1010
|
}
|
|
948
|
-
function
|
|
1011
|
+
function pe() {
|
|
949
1012
|
return {
|
|
950
1013
|
id: "theme",
|
|
951
1014
|
label: "Theme",
|
|
@@ -957,49 +1020,154 @@ function de() {
|
|
|
957
1020
|
t && n.forEach((n) => {
|
|
958
1021
|
let r = document.createElement("div");
|
|
959
1022
|
r.className = `simulator-theme-item${n.name === e.state.selectedTheme.name ? " selected" : ""}`, r.innerHTML = `
|
|
960
|
-
${
|
|
1023
|
+
${R(n)}
|
|
961
1024
|
<div class="simulator-theme-name">${n.name}</div>
|
|
962
1025
|
<div class="simulator-theme-type">${n.type}</div>
|
|
963
1026
|
`, r.addEventListener("click", () => {
|
|
964
|
-
console.log("Simulator: Theme changed, reloading...", n.name),
|
|
1027
|
+
console.log("Simulator: Theme changed, reloading...", n.name), te(n.name), window.location.reload();
|
|
965
1028
|
}), t.appendChild(r);
|
|
966
1029
|
});
|
|
967
1030
|
}
|
|
968
1031
|
};
|
|
969
1032
|
}
|
|
970
|
-
var
|
|
971
|
-
|
|
972
|
-
|
|
1033
|
+
var me = [
|
|
1034
|
+
{
|
|
1035
|
+
name: "app (desktop)",
|
|
1036
|
+
context: [{
|
|
1037
|
+
type: "app",
|
|
1038
|
+
layout: "desktop",
|
|
1039
|
+
host: null
|
|
1040
|
+
}]
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
1043
|
+
name: "app (mobile)",
|
|
1044
|
+
context: [{
|
|
1045
|
+
type: "app",
|
|
1046
|
+
layout: "mobile",
|
|
1047
|
+
host: null
|
|
1048
|
+
}]
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
name: "app (ios)",
|
|
1052
|
+
context: [{
|
|
1053
|
+
type: "app",
|
|
1054
|
+
layout: "mobile",
|
|
1055
|
+
host: "ios-app"
|
|
1056
|
+
}]
|
|
1057
|
+
},
|
|
1058
|
+
{
|
|
1059
|
+
name: "embed",
|
|
1060
|
+
context: [{ type: "embed" }]
|
|
1061
|
+
},
|
|
1062
|
+
{
|
|
1063
|
+
name: "embed (no UI)",
|
|
1064
|
+
context: [{
|
|
1065
|
+
type: "embed",
|
|
1066
|
+
noUI: !0
|
|
1067
|
+
}]
|
|
1068
|
+
},
|
|
1069
|
+
{
|
|
1070
|
+
name: "sandbox",
|
|
1071
|
+
context: [{ type: "sandbox" }]
|
|
1072
|
+
}
|
|
1073
|
+
];
|
|
1074
|
+
/**
|
|
1075
|
+
* Host tab — edit the `hostContext` array the simulator sends in READY_DATA, so host-context
|
|
1076
|
+
* dependent features (embed settings, sandbox mode, mobile layout, …) can be exercised locally.
|
|
1077
|
+
* The bootstrap is only read at game boot, so applying a change persists it to localStorage and
|
|
1078
|
+
* restarts (reloads) the page — the same flow as the Theme tab.
|
|
1079
|
+
*/
|
|
1080
|
+
function he(e = []) {
|
|
1081
|
+
let t = [...me, ...e];
|
|
1082
|
+
return {
|
|
1083
|
+
id: "host",
|
|
1084
|
+
label: "Host",
|
|
1085
|
+
render() {
|
|
1086
|
+
return `
|
|
1087
|
+
<style>
|
|
1088
|
+
#simulator-tab-host .host-note { opacity: 0.5; font-size: 10px; margin: 4px 0 8px; }
|
|
1089
|
+
#simulator-tab-host .host-error { color: #f66; font-size: 11px; margin-top: 6px; white-space: pre-wrap; }
|
|
1090
|
+
#simulator-tab-host .host-actions { display: flex; gap: 6px; margin-top: 8px; }
|
|
1091
|
+
#simulator-tab-host .simulator-textarea { min-height: 140px; font-family: monospace; }
|
|
1092
|
+
</style>
|
|
1093
|
+
<div class="simulator-section">
|
|
1094
|
+
<div class="simulator-section-title">Host Context</div>
|
|
1095
|
+
<div class="host-note" id="host-source"></div>
|
|
1096
|
+
<select class="simulator-select" id="host-presets">
|
|
1097
|
+
<option value="">Preset…</option>
|
|
1098
|
+
${t.map((e, t) => `<option value="${t}">${ge(e.name)}</option>`).join("")}
|
|
1099
|
+
</select>
|
|
1100
|
+
<textarea class="simulator-textarea" id="host-json" spellcheck="false"></textarea>
|
|
1101
|
+
<div class="host-actions">
|
|
1102
|
+
<button class="simulator-btn primary" id="host-apply">Apply & Restart</button>
|
|
1103
|
+
<button class="simulator-btn subtle" id="host-reset">Reset</button>
|
|
1104
|
+
</div>
|
|
1105
|
+
<div class="host-error" id="host-error"></div>
|
|
1106
|
+
</div>
|
|
1107
|
+
`;
|
|
1108
|
+
},
|
|
1109
|
+
bind(e) {
|
|
1110
|
+
var n, r;
|
|
1111
|
+
let i = e.getElement("#host-json"), s = e.getElement("#host-presets"), c = e.getElement("#host-error"), l = e.getElement("#host-source");
|
|
1112
|
+
!i || !s || !c || !l || (i.value = JSON.stringify(e.state.hostContext, null, 2), l.textContent = e.state.hostContextIsOverridden ? "Using this tab's override. Changes apply on restart." : "Using the vite config / default context. Changes apply on restart.", s.addEventListener("change", () => {
|
|
1113
|
+
let e = t[Number(s.value)];
|
|
1114
|
+
e && (i.value = JSON.stringify(e.context, null, 2));
|
|
1115
|
+
}), (n = e.getElement("#host-apply")) == null || n.addEventListener("click", () => {
|
|
1116
|
+
let e;
|
|
1117
|
+
try {
|
|
1118
|
+
e = JSON.parse(i.value);
|
|
1119
|
+
} catch (e) {
|
|
1120
|
+
c.textContent = `Invalid JSON: ${e.message}`;
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
if (!Array.isArray(e) || !e.every((e) => e && typeof e == "object" && typeof e.type == "string")) {
|
|
1124
|
+
c.textContent = "hostContext must be an array of { type: string, ... } objects";
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
console.log("Simulator: hostContext changed, reloading...", e), a(e), window.location.reload();
|
|
1128
|
+
}), (r = e.getElement("#host-reset")) == null || r.addEventListener("click", () => {
|
|
1129
|
+
o(), window.location.reload();
|
|
1130
|
+
}));
|
|
1131
|
+
}
|
|
1132
|
+
};
|
|
1133
|
+
}
|
|
1134
|
+
/** Minimal HTML-escape so preset names can't break the simulator markup. */
|
|
1135
|
+
function ge(e) {
|
|
1136
|
+
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1137
|
+
}
|
|
1138
|
+
var z = "puzzmo_sim_api_mode", B = "http://localhost:8911", _e = "https://api.puzzmo.com", V = () => localStorage.getItem(z) === "dev" ? "dev" : "prod", ve = (e) => {
|
|
1139
|
+
localStorage.setItem(z, e);
|
|
1140
|
+
}, H = null, ye = function() {
|
|
973
1141
|
var e = t(function* () {
|
|
974
|
-
if (
|
|
1142
|
+
if (H !== null) return H;
|
|
975
1143
|
try {
|
|
976
|
-
let e = new AbortController(), t = setTimeout(() => e.abort(), 1e3), n = yield fetch(`${
|
|
977
|
-
return clearTimeout(t),
|
|
1144
|
+
let e = new AbortController(), t = setTimeout(() => e.abort(), 1e3), n = yield fetch(`${B}/healthz`, { signal: e.signal });
|
|
1145
|
+
return clearTimeout(t), H = n.ok, H;
|
|
978
1146
|
} catch (e) {
|
|
979
|
-
return
|
|
1147
|
+
return H = !1, !1;
|
|
980
1148
|
}
|
|
981
1149
|
});
|
|
982
1150
|
return function() {
|
|
983
1151
|
return e.apply(this, arguments);
|
|
984
1152
|
};
|
|
985
|
-
}(),
|
|
986
|
-
apiURL:
|
|
1153
|
+
}(), U = () => ({
|
|
1154
|
+
apiURL: V() === "dev" ? B : _e,
|
|
987
1155
|
clientID: "protosdk:oauthclient",
|
|
988
1156
|
redirectUri: `${window.location.origin}/oauth/callback`
|
|
989
|
-
}),
|
|
1157
|
+
}), be = () => {
|
|
990
1158
|
let e = new Uint8Array(32);
|
|
991
1159
|
return crypto.getRandomValues(e), Array.from(e, (e) => e.toString(16).padStart(2, "0")).join("");
|
|
992
|
-
},
|
|
993
|
-
let e = localStorage.getItem(
|
|
1160
|
+
}, W = "puzzmo_sim_oauth_token", G = "puzzmo_sim_oauth_refresh_token", xe = (e) => localStorage.setItem(W, e), Se = (e) => localStorage.setItem(G, e), K = () => {
|
|
1161
|
+
let e = localStorage.getItem(W);
|
|
994
1162
|
return e && `${e.substring(0, 20)}`, e;
|
|
995
|
-
},
|
|
996
|
-
localStorage.removeItem(
|
|
997
|
-
},
|
|
998
|
-
let e =
|
|
1163
|
+
}, q = () => localStorage.getItem(G), J = () => {
|
|
1164
|
+
localStorage.removeItem(W), localStorage.removeItem(G);
|
|
1165
|
+
}, Ce = () => {
|
|
1166
|
+
let e = U(), t = be();
|
|
999
1167
|
sessionStorage.setItem("oauth_state", t), sessionStorage.setItem("oauth_return_url", window.location.href);
|
|
1000
1168
|
let n = new URL(`${e.apiURL}/oauth/auth`);
|
|
1001
1169
|
n.searchParams.set("client_id", e.clientID), n.searchParams.set("response_type", "code"), n.searchParams.set("redirect_uri", e.redirectUri), n.searchParams.set("state", t), window.location.href = n.toString();
|
|
1002
|
-
},
|
|
1170
|
+
}, we = (e) => {
|
|
1003
1171
|
try {
|
|
1004
1172
|
let t = e.split(".");
|
|
1005
1173
|
if (t.length !== 3) return !0;
|
|
@@ -1008,11 +1176,11 @@ var I = "puzzmo_sim_api_mode", L = "http://localhost:8911", R = "https://api.puz
|
|
|
1008
1176
|
} catch (e) {
|
|
1009
1177
|
return !0;
|
|
1010
1178
|
}
|
|
1011
|
-
},
|
|
1179
|
+
}, Te = function() {
|
|
1012
1180
|
var e = t(function* () {
|
|
1013
|
-
let e =
|
|
1181
|
+
let e = q();
|
|
1014
1182
|
if (!e) return !1;
|
|
1015
|
-
let t =
|
|
1183
|
+
let t = U();
|
|
1016
1184
|
try {
|
|
1017
1185
|
let n = new URLSearchParams({
|
|
1018
1186
|
grant_type: "refresh_token",
|
|
@@ -1026,9 +1194,9 @@ var I = "puzzmo_sim_api_mode", L = "http://localhost:8911", R = "https://api.puz
|
|
|
1026
1194
|
if (!r.ok) return r.statusText, !1;
|
|
1027
1195
|
let i = yield r.json(), a = i.access_token || i.accessToken;
|
|
1028
1196
|
if (!a) return !1;
|
|
1029
|
-
|
|
1197
|
+
xe(a);
|
|
1030
1198
|
let o = i.refresh_token || i.refreshToken;
|
|
1031
|
-
return o &&
|
|
1199
|
+
return o && Se(o), !0;
|
|
1032
1200
|
} catch (e) {
|
|
1033
1201
|
return !1;
|
|
1034
1202
|
}
|
|
@@ -1036,9 +1204,9 @@ var I = "puzzmo_sim_api_mode", L = "http://localhost:8911", R = "https://api.puz
|
|
|
1036
1204
|
return function() {
|
|
1037
1205
|
return e.apply(this, arguments);
|
|
1038
1206
|
};
|
|
1039
|
-
}(),
|
|
1207
|
+
}(), Ee = function() {
|
|
1040
1208
|
var e = t(function* (e, t) {
|
|
1041
|
-
let n =
|
|
1209
|
+
let n = U(), r = sessionStorage.getItem("oauth_state");
|
|
1042
1210
|
if (!r || r !== t) return null;
|
|
1043
1211
|
sessionStorage.removeItem("oauth_state");
|
|
1044
1212
|
try {
|
|
@@ -1060,13 +1228,13 @@ var I = "puzzmo_sim_api_mode", L = "http://localhost:8911", R = "https://api.puz
|
|
|
1060
1228
|
return function(t, n) {
|
|
1061
1229
|
return e.apply(this, arguments);
|
|
1062
1230
|
};
|
|
1063
|
-
}(),
|
|
1231
|
+
}(), De = function() {
|
|
1064
1232
|
var e = t(function* (e, t = {}) {
|
|
1065
|
-
let n =
|
|
1233
|
+
let n = U(), r = K();
|
|
1066
1234
|
if (!r) throw Error("Not authenticated");
|
|
1067
|
-
if (
|
|
1068
|
-
if (r =
|
|
1069
|
-
} else throw
|
|
1235
|
+
if (we(r)) if (yield Te()) {
|
|
1236
|
+
if (r = K(), !r) throw Error("Token refresh succeeded but no token available");
|
|
1237
|
+
} else throw J(), Error("Session expired. Please log in again.");
|
|
1070
1238
|
let i = yield fetch(`${n.apiURL}/graphql`, {
|
|
1071
1239
|
method: "POST",
|
|
1072
1240
|
headers: {
|
|
@@ -1085,7 +1253,7 @@ var I = "puzzmo_sim_api_mode", L = "http://localhost:8911", R = "https://api.puz
|
|
|
1085
1253
|
return function(t) {
|
|
1086
1254
|
return e.apply(this, arguments);
|
|
1087
1255
|
};
|
|
1088
|
-
}(),
|
|
1256
|
+
}(), Oe = (e) => {
|
|
1089
1257
|
try {
|
|
1090
1258
|
let t = e.split(".");
|
|
1091
1259
|
return t.length, t.length === 3 ? JSON.parse(atob(t[1])) : null;
|
|
@@ -1093,15 +1261,15 @@ var I = "puzzmo_sim_api_mode", L = "http://localhost:8911", R = "https://api.puz
|
|
|
1093
1261
|
return null;
|
|
1094
1262
|
}
|
|
1095
1263
|
};
|
|
1096
|
-
function
|
|
1264
|
+
function ke() {
|
|
1097
1265
|
let e = !1;
|
|
1098
1266
|
return {
|
|
1099
1267
|
id: "auth",
|
|
1100
1268
|
label: "Auth",
|
|
1101
1269
|
render() {
|
|
1102
|
-
let e =
|
|
1270
|
+
let e = K(), t = !!e, n = V(), r = n === "dev" ? B : _e, i = `<button class="simulator-btn tiny" id="auth-dev-toggle" style="display: none;">${n === "dev" ? "Using Dev" : "Dev"}</button>`;
|
|
1103
1271
|
if (t) {
|
|
1104
|
-
let t =
|
|
1272
|
+
let t = Oe(e), n = t != null && t.exp ? (/* @__PURE__ */ new Date(t.exp * 1e3)).toLocaleString() : "Unknown", a = !!q(), o = a ? Oe(q()) : null, s = o != null && o.exp ? (/* @__PURE__ */ new Date(o.exp * 1e3)).toLocaleString() : null;
|
|
1105
1273
|
return `
|
|
1106
1274
|
<div class="simulator-section">
|
|
1107
1275
|
<div class="simulator-section-title auth-title-row">
|
|
@@ -1142,7 +1310,7 @@ function Se() {
|
|
|
1142
1310
|
</div>
|
|
1143
1311
|
<p class="auth-description">
|
|
1144
1312
|
Login with your Puzzmo account to make authenticated API requests.
|
|
1145
|
-
${n === "dev" ? `<br><strong>Using local dev server:</strong> ${
|
|
1313
|
+
${n === "dev" ? `<br><strong>Using local dev server:</strong> ${B}` : ""}
|
|
1146
1314
|
</p>
|
|
1147
1315
|
<div class="simulator-row">
|
|
1148
1316
|
<button class="simulator-btn primary" id="auth-login">Login with Puzzmo</button>
|
|
@@ -1153,21 +1321,21 @@ function Se() {
|
|
|
1153
1321
|
},
|
|
1154
1322
|
bind(n) {
|
|
1155
1323
|
let r = n.getElement("#auth-login"), i = n.getElement("#auth-logout"), a = n.getElement("#auth-refresh"), o = n.getElement("#auth-test-api"), s = n.getElement("#auth-api-result"), c = n.getElement("#auth-dev-toggle");
|
|
1156
|
-
e ?
|
|
1157
|
-
e && c && (c.style.display = "",
|
|
1324
|
+
e ? H && c && (c.style.display = "", V() === "dev" && c.classList.add("active")) : (e = !0, ye().then((e) => {
|
|
1325
|
+
e && c && (c.style.display = "", V() === "dev" && c.classList.add("active"));
|
|
1158
1326
|
})), c == null || c.addEventListener("click", () => {
|
|
1159
|
-
|
|
1327
|
+
ve(V() === "dev" ? "prod" : "dev"), J(), window.location.reload();
|
|
1160
1328
|
}), r == null || r.addEventListener("click", () => {
|
|
1161
|
-
|
|
1329
|
+
Ce();
|
|
1162
1330
|
}), i == null || i.addEventListener("click", () => {
|
|
1163
|
-
|
|
1331
|
+
J(), window.location.reload();
|
|
1164
1332
|
}), a == null || a.addEventListener("click", t(function* () {
|
|
1165
|
-
a.disabled = !0, a.textContent = "Refreshing...", (yield
|
|
1333
|
+
a.disabled = !0, a.textContent = "Refreshing...", (yield Te()) ? window.location.reload() : (a.textContent = "Refresh Failed", a.disabled = !1);
|
|
1166
1334
|
})), o == null || o.addEventListener("click", t(function* () {
|
|
1167
1335
|
if (s) {
|
|
1168
1336
|
s.innerHTML = "<div class=\"loading\">Loading...</div>";
|
|
1169
1337
|
try {
|
|
1170
|
-
let t = yield
|
|
1338
|
+
let t = yield De("\n query {\n currentUser {\n id\n username\n usernameID\n name\n }\n }\n ");
|
|
1171
1339
|
if (t.errors) {
|
|
1172
1340
|
var e;
|
|
1173
1341
|
s.innerHTML = `<div class="error">Error: ${((e = t.errors[0]) == null ? void 0 : e.message) || "Unknown error"}</div>`;
|
|
@@ -1189,13 +1357,13 @@ function Se() {
|
|
|
1189
1357
|
if (n && r) {
|
|
1190
1358
|
let t = e.getElement("#auth-status");
|
|
1191
1359
|
t && (t.innerHTML = "<span class=\"indicator waiting\"></span><span>Exchanging code...</span>");
|
|
1192
|
-
let i = yield
|
|
1360
|
+
let i = yield Ee(n, r);
|
|
1193
1361
|
if (window.history.replaceState({}, "", window.location.pathname), i) {
|
|
1194
1362
|
let e = i.access_token || i.accessToken;
|
|
1195
1363
|
if (e) {
|
|
1196
|
-
|
|
1364
|
+
xe(e);
|
|
1197
1365
|
let t = i.refresh_token || i.refreshToken;
|
|
1198
|
-
t &&
|
|
1366
|
+
t && Se(t);
|
|
1199
1367
|
}
|
|
1200
1368
|
window.location.reload();
|
|
1201
1369
|
} else {
|
|
@@ -1207,9 +1375,9 @@ function Se() {
|
|
|
1207
1375
|
}
|
|
1208
1376
|
};
|
|
1209
1377
|
}
|
|
1210
|
-
var
|
|
1211
|
-
localStorage.removeItem(
|
|
1212
|
-
},
|
|
1378
|
+
var Ae = "puzzmo_sim_api_mode", je = "http://localhost:8911", Me = "https://api.puzzmo.com", Y = "puzzmo_sim_oauth_token", X = "puzzmo_sim_oauth_refresh_token", Ne = () => localStorage.getItem(Ae) === "dev" ? "dev" : "prod", Pe = () => localStorage.getItem(Y), Fe = () => localStorage.getItem(X), Ie = (e) => localStorage.setItem(Y, e), Le = (e) => localStorage.setItem(X, e), Re = () => {
|
|
1379
|
+
localStorage.removeItem(Y), localStorage.removeItem(X);
|
|
1380
|
+
}, ze = (e) => {
|
|
1213
1381
|
try {
|
|
1214
1382
|
let t = e.split(".");
|
|
1215
1383
|
if (t.length !== 3) return !0;
|
|
@@ -1218,11 +1386,11 @@ var Ce = "puzzmo_sim_api_mode", we = "http://localhost:8911", Te = "https://api.
|
|
|
1218
1386
|
} catch (e) {
|
|
1219
1387
|
return !0;
|
|
1220
1388
|
}
|
|
1221
|
-
},
|
|
1389
|
+
}, Be = function() {
|
|
1222
1390
|
var e = t(function* () {
|
|
1223
|
-
let e =
|
|
1391
|
+
let e = Fe();
|
|
1224
1392
|
if (!e) return !1;
|
|
1225
|
-
let t =
|
|
1393
|
+
let t = Ne() === "dev" ? je : Me;
|
|
1226
1394
|
try {
|
|
1227
1395
|
let n = new URLSearchParams({
|
|
1228
1396
|
grant_type: "refresh_token",
|
|
@@ -1236,9 +1404,9 @@ var Ce = "puzzmo_sim_api_mode", we = "http://localhost:8911", Te = "https://api.
|
|
|
1236
1404
|
if (!r.ok) return !1;
|
|
1237
1405
|
let i = yield r.json(), a = i.access_token || i.accessToken;
|
|
1238
1406
|
if (!a) return !1;
|
|
1239
|
-
|
|
1407
|
+
Ie(a);
|
|
1240
1408
|
let o = i.refresh_token || i.refreshToken;
|
|
1241
|
-
return o &&
|
|
1409
|
+
return o && Le(o), !0;
|
|
1242
1410
|
} catch (e) {
|
|
1243
1411
|
return !1;
|
|
1244
1412
|
}
|
|
@@ -1246,13 +1414,13 @@ var Ce = "puzzmo_sim_api_mode", we = "http://localhost:8911", Te = "https://api.
|
|
|
1246
1414
|
return function() {
|
|
1247
1415
|
return e.apply(this, arguments);
|
|
1248
1416
|
};
|
|
1249
|
-
}(),
|
|
1417
|
+
}(), Ve = function() {
|
|
1250
1418
|
var e = t(function* (e, t = {}) {
|
|
1251
|
-
let n =
|
|
1419
|
+
let n = Ne() === "dev" ? je : Me, r = Pe();
|
|
1252
1420
|
if (!r) throw Error("Not authenticated");
|
|
1253
|
-
if (
|
|
1254
|
-
if (r =
|
|
1255
|
-
} else throw
|
|
1421
|
+
if (ze(r)) if (yield Be()) {
|
|
1422
|
+
if (r = Pe(), !r) throw Error("Token refresh succeeded but no token available");
|
|
1423
|
+
} else throw Re(), Error("Session expired. Please log in again.");
|
|
1256
1424
|
let i = yield fetch(`${n}/graphql`, {
|
|
1257
1425
|
method: "POST",
|
|
1258
1426
|
headers: {
|
|
@@ -1271,19 +1439,19 @@ var Ce = "puzzmo_sim_api_mode", we = "http://localhost:8911", Te = "https://api.
|
|
|
1271
1439
|
return function(t) {
|
|
1272
1440
|
return e.apply(this, arguments);
|
|
1273
1441
|
};
|
|
1274
|
-
}(),
|
|
1442
|
+
}(), He = "\n query GameFeaturesQuery($slug: ID!) {\n game(id: $slug) {\n id\n slug\n displayName\n featuresArr\n gameFeatures {\n slug\n title\n features {\n featureID\n title\n isEnabled\n }\n }\n }\n }\n", Ue = "\n mutation ToggleFeatureMutation($gameSlug: ID!, $input: UpdateGameInput!) {\n updateGame(id: $gameSlug, input: $input) {\n id\n featuresArr\n gameFeatures {\n slug\n title\n features {\n featureID\n title\n isEnabled\n }\n }\n }\n }\n", We = (e, t) => {
|
|
1275
1443
|
let n = t - 1, r = Math.floor(n / 31), i = n % 31, a = [...e];
|
|
1276
1444
|
for (; a.length <= r;) a.push(0);
|
|
1277
1445
|
return a[r] = a[r] ^ 1 << i, a;
|
|
1278
1446
|
};
|
|
1279
|
-
const
|
|
1280
|
-
function
|
|
1447
|
+
const Ge = () => !!Pe();
|
|
1448
|
+
function Ke() {
|
|
1281
1449
|
let n = null, r = !1, i = null, a = function() {
|
|
1282
1450
|
var e = t(function* (e) {
|
|
1283
1451
|
r = !0, i = null;
|
|
1284
1452
|
try {
|
|
1285
1453
|
var t;
|
|
1286
|
-
let r = yield
|
|
1454
|
+
let r = yield Ve(He, { slug: e });
|
|
1287
1455
|
if (r.errors) {
|
|
1288
1456
|
var a;
|
|
1289
1457
|
i = ((a = r.errors[0]) == null ? void 0 : a.message) || "Unknown error", n = null;
|
|
@@ -1300,10 +1468,10 @@ function Re() {
|
|
|
1300
1468
|
}(), o = function() {
|
|
1301
1469
|
var r = t(function* (t) {
|
|
1302
1470
|
if (!n) return;
|
|
1303
|
-
let r =
|
|
1471
|
+
let r = We(n.featuresArr, t);
|
|
1304
1472
|
try {
|
|
1305
1473
|
var i;
|
|
1306
|
-
let t = yield
|
|
1474
|
+
let t = yield Ve(Ue, {
|
|
1307
1475
|
gameSlug: n.slug,
|
|
1308
1476
|
input: { featuresArr: r }
|
|
1309
1477
|
});
|
|
@@ -1351,7 +1519,7 @@ function Re() {
|
|
|
1351
1519
|
id: "features",
|
|
1352
1520
|
label: "Features",
|
|
1353
1521
|
render() {
|
|
1354
|
-
return
|
|
1522
|
+
return Ge() ? `
|
|
1355
1523
|
<div class="features-view-container">
|
|
1356
1524
|
<div class="simulator-section">
|
|
1357
1525
|
<div class="simulator-section-title">Game Features</div>
|
|
@@ -1392,7 +1560,7 @@ function Re() {
|
|
|
1392
1560
|
e && (yield d(e));
|
|
1393
1561
|
})), i == null || i.addEventListener("keypress", (e) => {
|
|
1394
1562
|
e.key === "Enter" && (r == null || r.click());
|
|
1395
|
-
}), console.log("[FeaturesView] bind called, ctx.gameSlug:", e.gameSlug, "slugInput:", i), e.gameSlug && i && (i.value = e.gameSlug,
|
|
1563
|
+
}), console.log("[FeaturesView] bind called, ctx.gameSlug:", e.gameSlug, "slugInput:", i), e.gameSlug && i && (i.value = e.gameSlug, Ge() && !n && d(e.gameSlug)), u();
|
|
1396
1564
|
},
|
|
1397
1565
|
onActivate(e) {
|
|
1398
1566
|
let t = e.getElement("#simulator-tab-features");
|
|
@@ -1401,7 +1569,7 @@ function Re() {
|
|
|
1401
1569
|
};
|
|
1402
1570
|
}
|
|
1403
1571
|
/** Renders a single keyboard key as an HTML button string */
|
|
1404
|
-
var
|
|
1572
|
+
var qe = (e, t) => {
|
|
1405
1573
|
var n, r;
|
|
1406
1574
|
let i = (n = t.symbols[e]) == null ? e : n, a = t.disabled.includes(e), o = t.highlight.includes(e), s = t.xl.includes(e), c = t.l.includes(e), l = (r = t.flexGrowSymbols) == null ? void 0 : r.includes(e);
|
|
1407
1575
|
return `<button class="${[
|
|
@@ -1412,9 +1580,9 @@ var ze = (e, t) => {
|
|
|
1412
1580
|
c ? "l" : "",
|
|
1413
1581
|
l ? "grow" : ""
|
|
1414
1582
|
].filter(Boolean).join(" ")}" data-key="${e}" ${a ? "disabled" : ""}>${i}</button>`;
|
|
1415
|
-
},
|
|
1416
|
-
function
|
|
1417
|
-
let e = null, t = () => e ?
|
|
1583
|
+
}, Je = (e) => `<div class="sim-kb">${e.layout.filter((e) => e != null).map((t) => `<div class="sim-kb-row">${[...t].map((t) => qe(t, e)).join("")}</div>`).join("")}</div>`;
|
|
1584
|
+
function Ye() {
|
|
1585
|
+
let e = null, t = () => e ? Je(e) : "<div class=\"sim-kb-empty\">No keyboard config received from game yet.<br>The game calls <code>sdk.keyboard.show(config)</code> to display a keyboard.</div>";
|
|
1418
1586
|
return {
|
|
1419
1587
|
id: "kbd",
|
|
1420
1588
|
label: "Kbd",
|
|
@@ -1428,19 +1596,19 @@ function Ve() {
|
|
|
1428
1596
|
`;
|
|
1429
1597
|
},
|
|
1430
1598
|
bind(e) {
|
|
1431
|
-
|
|
1599
|
+
Xe(e);
|
|
1432
1600
|
},
|
|
1433
1601
|
onMessage(n, r, i) {
|
|
1434
1602
|
var a;
|
|
1435
1603
|
if (n !== "KEYBOARD_UPDATE_CONFIG") return;
|
|
1436
1604
|
e = !(!(r == null || (a = r.layout) == null) && a.length) || r.layout.every((e) => !e) ? null : r;
|
|
1437
1605
|
let o = i.getElement("#sim-kb-content");
|
|
1438
|
-
o && (o.innerHTML = t(),
|
|
1606
|
+
o && (o.innerHTML = t(), Xe(i)), i.updateBadge("kbd", void 0);
|
|
1439
1607
|
}
|
|
1440
1608
|
};
|
|
1441
1609
|
}
|
|
1442
1610
|
/** Attach click handlers to all rendered keys */
|
|
1443
|
-
function
|
|
1611
|
+
function Xe(e) {
|
|
1444
1612
|
var t;
|
|
1445
1613
|
let n = (t = e.getElement("#sim-kb-content")) == null ? void 0 : t.querySelectorAll(".sim-kb-key");
|
|
1446
1614
|
n == null || n.forEach((t) => {
|
|
@@ -1455,15 +1623,15 @@ function He(e) {
|
|
|
1455
1623
|
* change values (persisted to localStorage and pushed to the game as SETTINGS_UPDATE, matching the
|
|
1456
1624
|
* production host) and reflects UPDATE_SETTINGS_FROM_EMBED writes coming from the game.
|
|
1457
1625
|
*/
|
|
1458
|
-
function
|
|
1626
|
+
function Ze() {
|
|
1459
1627
|
let t = (e) => {
|
|
1460
1628
|
let t = e.state.settingsComponents;
|
|
1461
|
-
return !t || t.length === 0 ? "<div class=\"sim-settings-empty\">No settings registered by the game yet.<br>The game calls <code>sdk.settings.initialize(components)</code> to describe its settings UI.</div>" : `<div class="sim-settings-form">${t.map((t) =>
|
|
1629
|
+
return !t || t.length === 0 ? "<div class=\"sim-settings-empty\">No settings registered by the game yet.<br>The game calls <code>sdk.settings.initialize(components)</code> to describe its settings UI.</div>" : `<div class="sim-settings-form">${t.map((t) => Qe(t, e.state.gameSettings)).join("")}</div><div class="sim-settings-actions"><button class="simulator-btn tiny" id="sim-settings-reset">Reset to defaults</button></div>`;
|
|
1462
1630
|
}, n = (e) => {
|
|
1463
1631
|
let n = e.getElement("#sim-settings-content");
|
|
1464
1632
|
n && (n.innerHTML = t(e), i(e));
|
|
1465
1633
|
}, r = (e) => {
|
|
1466
|
-
|
|
1634
|
+
m(e.state.gameSettings), e.sendToGame("SETTINGS_UPDATE", e.state.gameSettings);
|
|
1467
1635
|
}, i = (t) => {
|
|
1468
1636
|
var i;
|
|
1469
1637
|
let a = t.getElement("#sim-settings-content");
|
|
@@ -1479,7 +1647,7 @@ function Ue() {
|
|
|
1479
1647
|
});
|
|
1480
1648
|
}), (i = a.querySelector("#sim-settings-reset")) == null || i.addEventListener("click", () => {
|
|
1481
1649
|
var e;
|
|
1482
|
-
|
|
1650
|
+
h(), t.state.gameSettings = $e((e = t.state.settingsComponents) == null ? [] : e), r(t), n(t);
|
|
1483
1651
|
}));
|
|
1484
1652
|
};
|
|
1485
1653
|
return {
|
|
@@ -1494,21 +1662,21 @@ function Ue() {
|
|
|
1494
1662
|
onMessage(t, r, i) {
|
|
1495
1663
|
if (t === "INITIALIZE_SETTINGS") {
|
|
1496
1664
|
var a;
|
|
1497
|
-
i.state.settingsComponents = (a = r == null ? void 0 : r.components) == null ? [] : a, i.state.gameSettings = e(e({}, r == null ? void 0 : r.settings), i.state.gameSettings),
|
|
1665
|
+
i.state.settingsComponents = (a = r == null ? void 0 : r.components) == null ? [] : a, i.state.gameSettings = e(e({}, r == null ? void 0 : r.settings), i.state.gameSettings), m(i.state.gameSettings), n(i);
|
|
1498
1666
|
return;
|
|
1499
1667
|
}
|
|
1500
|
-
t === "UPDATE_SETTINGS_FROM_EMBED" && (i.state.gameSettings = e(e({}, i.state.gameSettings), r == null ? void 0 : r.settings),
|
|
1668
|
+
t === "UPDATE_SETTINGS_FROM_EMBED" && (i.state.gameSettings = e(e({}, i.state.gameSettings), r == null ? void 0 : r.settings), m(i.state.gameSettings), n(i));
|
|
1501
1669
|
}
|
|
1502
1670
|
};
|
|
1503
1671
|
}
|
|
1504
1672
|
/** Renders a single settings UI component as HTML, reading its current value from `settings` */
|
|
1505
|
-
function
|
|
1673
|
+
function Qe(e, t) {
|
|
1506
1674
|
switch (e.type) {
|
|
1507
1675
|
case "title": return `<div class="sim-settings-heading">${Q(e.value)}</div>`;
|
|
1508
1676
|
case "subtitle": return `<div class="sim-settings-subheading">${Q(e.value)}</div>`;
|
|
1509
1677
|
case "paragraph": return `<p class="sim-settings-paragraph">${Q(e.value)}</p>`;
|
|
1510
1678
|
case "separator": return "<div class=\"simulator-divider\"></div>";
|
|
1511
|
-
case "split": return `<div class="sim-settings-split">${e.content.map((e) =>
|
|
1679
|
+
case "split": return `<div class="sim-settings-split">${e.content.map((e) => Qe(e, t)).join("")}</div>`;
|
|
1512
1680
|
case "boolean": {
|
|
1513
1681
|
var n;
|
|
1514
1682
|
let r = ((n = t[e.name]) == null ? e.defaultValue : n) ? "checked" : "", i = e.subtitle ? `<div class="sim-settings-subtitle">${Q(e.subtitle)}</div>` : "";
|
|
@@ -1576,9 +1744,9 @@ function Z(e) {
|
|
|
1576
1744
|
return `<span class="simulator-label">${Q(e.title)}</span>${t}`;
|
|
1577
1745
|
}
|
|
1578
1746
|
/** Collects name → defaultValue pairs from components, recursing into split groups */
|
|
1579
|
-
function
|
|
1747
|
+
function $e(e) {
|
|
1580
1748
|
let t = {};
|
|
1581
|
-
for (let n of e) n.type === "split" ? Object.assign(t,
|
|
1749
|
+
for (let n of e) n.type === "split" ? Object.assign(t, $e(n.content)) : "name" in n && (t[n.name] = n.defaultValue);
|
|
1582
1750
|
return t;
|
|
1583
1751
|
}
|
|
1584
1752
|
function Q(e) {
|
|
@@ -1622,34 +1790,35 @@ var $ = null;
|
|
|
1622
1790
|
* Fixtures are loaded as raw strings and passed to the game verbatim (any text format works; the game parses it).
|
|
1623
1791
|
* This will show dropdowns in the Ctrl tab to select category and puzzle.
|
|
1624
1792
|
*/
|
|
1625
|
-
function
|
|
1793
|
+
function et(e = {}) {
|
|
1626
1794
|
var n, r, i;
|
|
1627
1795
|
if (console.log("[Simulator] createSimulator called with config:", {
|
|
1628
1796
|
slug: e.slug,
|
|
1629
1797
|
hasFixtures: !!e.fixtures
|
|
1630
1798
|
}), $) return e.fixtures && (console.log("[Simulator] Instance already exists, updating fixtures"), $.updateFixtures(e.fixtures)), $;
|
|
1631
|
-
let a = (n = e.autoStart) == null ? !0 : n, o = e.fixtures ?
|
|
1632
|
-
|
|
1633
|
-
oe(),
|
|
1634
|
-
c,
|
|
1799
|
+
let a = (n = e.autoStart) == null ? !0 : n, o = e.fixtures ? oe(e.fixtures) : null, s = o ? Array.from(o.keys()).sort() : [], c = le(), l = fe(), u = [
|
|
1800
|
+
se(),
|
|
1635
1801
|
ce(),
|
|
1636
|
-
|
|
1637
|
-
|
|
1802
|
+
c,
|
|
1803
|
+
ue(),
|
|
1638
1804
|
de(),
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1805
|
+
l,
|
|
1806
|
+
pe(),
|
|
1807
|
+
he(e.hostContextPresets),
|
|
1808
|
+
ke(),
|
|
1809
|
+
Ke(),
|
|
1810
|
+
Ye(),
|
|
1811
|
+
Ze(),
|
|
1643
1812
|
...(r = e.views) == null ? [] : r
|
|
1644
|
-
],
|
|
1813
|
+
], d = u.map((e) => e.id), f = p(e, s, d), m = {
|
|
1645
1814
|
pause: "<svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" fill=\"currentColor\"><rect x=\"1\" y=\"1\" width=\"3\" height=\"8\"/><rect x=\"6\" y=\"1\" width=\"3\" height=\"8\"/></svg>",
|
|
1646
1815
|
play: "<svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" fill=\"currentColor\"><polygon points=\"2,1 9,5 2,9\"/></svg>",
|
|
1647
1816
|
retry: "<svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" fill=\"currentColor\"><path d=\"M5 1C2.8 1 1 2.8 1 5s1.8 4 4 4c1.8 0 3.3-1.2 3.8-2.8H7.5c-.4.9-1.3 1.5-2.5 1.5-1.5 0-2.7-1.2-2.7-2.7S3.5 2.3 5 2.3c.7 0 1.4.3 1.9.8L5.5 4.5H9V1L7.6 2.4C6.9 1.5 5.9 1 5 1z\"/></svg>",
|
|
1648
1817
|
cog: "<svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" fill=\"currentColor\"><path d=\"M9.5 5.8l-.8-.5c0-.2.1-.5.1-.8s0-.5-.1-.8l.8-.5c.1-.1.2-.2.1-.4l-.8-1.4c-.1-.1-.2-.2-.4-.1l-1 .3c-.3-.3-.7-.5-1.1-.6L6.1.2C6.1.1 6 0 5.8 0H4.2c-.2 0-.3.1-.3.2l-.2 1c-.4.1-.7.3-1.1.6l-1-.3c-.2 0-.3 0-.4.1l-.8 1.4c-.1.2 0 .3.1.4l.8.5c0 .2-.1.5-.1.8s0 .5.1.8l-.8.5c-.1.1-.2.2-.1.4l.8 1.4c.1.1.2.2.4.1l1-.3c.3.3.7.5 1.1.6l.2 1c0 .1.1.2.3.2h1.6c.2 0 .3-.1.3-.2l.2-1c.4-.1.7-.3 1.1-.6l1 .3c.2 0 .3 0 .4-.1l.8-1.4c.1-.2 0-.3-.1-.4zM5 6.5c-.8 0-1.5-.7-1.5-1.5S4.2 3.5 5 3.5 6.5 4.2 6.5 5 5.8 6.5 5 6.5z\"/></svg>",
|
|
1649
1818
|
minimize: "<svg width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" fill=\"currentColor\"><rect x=\"1\" y=\"4\" width=\"8\" height=\"2\"/></svg>",
|
|
1650
1819
|
expand: "<svg width=\"8\" height=\"8\" viewBox=\"0 0 8 8\" fill=\"currentColor\"><polygon points=\"1,1 7,4 1,7\"/></svg>"
|
|
1651
|
-
},
|
|
1652
|
-
|
|
1820
|
+
}, h = document.createElement("div");
|
|
1821
|
+
h.id = "simulator", h.innerHTML = `
|
|
1653
1822
|
<style>
|
|
1654
1823
|
:root {
|
|
1655
1824
|
--sim-bg: #1a1a2e;
|
|
@@ -2886,15 +3055,15 @@ function Ke(e = {}) {
|
|
|
2886
3055
|
border-top: 2px solid var(--sim-border);
|
|
2887
3056
|
}
|
|
2888
3057
|
</style>
|
|
2889
|
-
<div id="simulator-panel" class="${
|
|
3058
|
+
<div id="simulator-panel" class="${f.isCollapsed ? "collapsed" : ""}">
|
|
2890
3059
|
<div id="simulator-header">
|
|
2891
3060
|
<span id="simulator-title">PUZZMO SIMULATOR</span>
|
|
2892
3061
|
<span class="header-sep">|</span>
|
|
2893
3062
|
<div id="simulator-timer">--:--</div>
|
|
2894
3063
|
<span class="header-sep">|</span>
|
|
2895
3064
|
<div id="simulator-header-controls">
|
|
2896
|
-
<button id="simulator-header-pause" class="header-icon-btn" title="Pause" disabled>${
|
|
2897
|
-
<button id="simulator-header-retry" class="header-icon-btn" title="Retry" disabled>${
|
|
3065
|
+
<button id="simulator-header-pause" class="header-icon-btn" title="Pause" disabled>${m.pause}</button>
|
|
3066
|
+
<button id="simulator-header-retry" class="header-icon-btn" title="Retry" disabled>${m.retry}</button>
|
|
2898
3067
|
</div>
|
|
2899
3068
|
<span class="header-sep">|</span>
|
|
2900
3069
|
<div id="simulator-header-status">
|
|
@@ -2902,106 +3071,106 @@ function Ke(e = {}) {
|
|
|
2902
3071
|
<span id="simulator-header-status-text">Waiting...</span>
|
|
2903
3072
|
</div>
|
|
2904
3073
|
<span class="header-spacer"></span>
|
|
2905
|
-
<button id="simulator-header-settings" class="header-icon-btn" title="Settings">${
|
|
2906
|
-
<button id="simulator-toggle" class="header-icon-btn" title="Minimize">${
|
|
3074
|
+
<button id="simulator-header-settings" class="header-icon-btn" title="Settings">${m.cog}</button>
|
|
3075
|
+
<button id="simulator-toggle" class="header-icon-btn" title="Minimize">${m.minimize}</button>
|
|
2907
3076
|
</div>
|
|
2908
3077
|
<div id="simulator-body">
|
|
2909
3078
|
<div id="simulator-tabs">
|
|
2910
|
-
${
|
|
3079
|
+
${u.filter((e) => e.id !== "auth").map((e) => `<button class="simulator-tab" data-tab="${e.id}">${e.label}<span class="simulator-tab-badge" data-badge="${e.id}"></span></button>`).join("")}
|
|
2911
3080
|
</div>
|
|
2912
3081
|
<div id="simulator-content" class="hidden">
|
|
2913
|
-
${
|
|
3082
|
+
${u.map((e) => `<div id="simulator-tab-${e.id}" class="simulator-tab-content">${e.render()}</div>`).join("")}
|
|
2914
3083
|
</div>
|
|
2915
3084
|
</div>
|
|
2916
3085
|
</div>
|
|
2917
|
-
`, document.body.appendChild(
|
|
2918
|
-
let
|
|
2919
|
-
|
|
2920
|
-
},
|
|
2921
|
-
let n =
|
|
2922
|
-
n && (n.textContent = e), r && (r.className = `indicator ${t}`, r.textContent = i),
|
|
2923
|
-
},
|
|
2924
|
-
t && t !== "0" ?
|
|
2925
|
-
},
|
|
3086
|
+
`, document.body.appendChild(h);
|
|
3087
|
+
let te = h.querySelector("#simulator-panel"), _ = h.querySelector("#simulator-header"), v = h.querySelector("#simulator-header-indicator"), ne = h.querySelector("#simulator-header-status-text"), y = h.querySelector("#simulator-header-pause"), b = h.querySelector("#simulator-header-retry"), x = h.querySelector("#simulator-header-settings"), S = h.querySelector("#simulator-toggle"), C = h.querySelector("#simulator-timer"), w = h.querySelector("#simulator-tabs"), T = h.querySelector("#simulator-content"), E = (e) => h.querySelector(e), D = (e) => {
|
|
3088
|
+
y.innerHTML = e ? m.play : m.pause, y.title = e ? "Resume" : "Pause";
|
|
3089
|
+
}, O = (e, t) => {
|
|
3090
|
+
let n = E("#simulator-status .text"), r = E("#simulator-status .indicator"), i = t === "complete" ? "✓" : "";
|
|
3091
|
+
n && (n.textContent = e), r && (r.className = `indicator ${t}`, r.textContent = i), v.className = t, v.textContent = i, ne.textContent = e;
|
|
3092
|
+
}, k = (e, t) => {
|
|
3093
|
+
t && t !== "0" ? C.innerHTML = `${e}<span class="penalty">+${t}</span>` : C.textContent = e;
|
|
3094
|
+
}, A = (e) => {
|
|
2926
3095
|
var t;
|
|
2927
|
-
|
|
3096
|
+
f.activeTab = e, T.classList.remove("hidden"), ee(e), w.querySelectorAll(".simulator-tab").forEach((t) => {
|
|
2928
3097
|
t.classList.toggle("active", t.getAttribute("data-tab") === e);
|
|
2929
|
-
}),
|
|
3098
|
+
}), h.querySelectorAll(".simulator-tab-content").forEach((t) => {
|
|
2930
3099
|
t.classList.toggle("active", t.id === `simulator-tab-${e}`);
|
|
2931
|
-
}),
|
|
2932
|
-
let n =
|
|
2933
|
-
n == null || (t = n.onActivate) == null || t.call(n,
|
|
2934
|
-
},
|
|
2935
|
-
|
|
2936
|
-
},
|
|
2937
|
-
l.updatePreview(
|
|
2938
|
-
},
|
|
3100
|
+
}), x.classList.toggle("active", e === "auth");
|
|
3101
|
+
let n = u.find((t) => t.id === e);
|
|
3102
|
+
n == null || (t = n.onActivate) == null || t.call(n, L);
|
|
3103
|
+
}, j = (e) => {
|
|
3104
|
+
f.isCollapsed = e, te.classList.toggle("collapsed", e), g(e), e ? (T.classList.add("hidden"), w.querySelectorAll(".simulator-tab").forEach((e) => e.classList.remove("active"))) : A(f.activeTab);
|
|
3105
|
+
}, M = () => {
|
|
3106
|
+
l.updatePreview(L);
|
|
3107
|
+
}, N = function() {
|
|
2939
3108
|
var e = t(function* () {
|
|
2940
3109
|
var e, t;
|
|
2941
|
-
if (
|
|
3110
|
+
if (f.puzzleData) return f.puzzleData;
|
|
2942
3111
|
if (!o || o.size === 0) throw Error("No fixtures configured. Add puzzle fixture files (.json or .toml) to a fixtures directory and pass fixturesGlob to the simulator.");
|
|
2943
|
-
let n = (e =
|
|
3112
|
+
let n = (e = f.selectedCategory) == null ? s[0] : e, r = n ? o.get(n) : void 0;
|
|
2944
3113
|
if (!r || r.size === 0) throw Error(`No puzzles found in fixture category "${n}"`);
|
|
2945
|
-
let i = (t =
|
|
3114
|
+
let i = (t = f.selectedPuzzle) == null ? r.keys().next().value : t, a = i ? r.get(i) : void 0;
|
|
2946
3115
|
if (!a) throw Error(`Puzzle "${i}" not found in category "${n}"`);
|
|
2947
|
-
|
|
3116
|
+
f.puzzleData = a, console.log("Simulator: Puzzle loaded from fixtures", {
|
|
2948
3117
|
category: n,
|
|
2949
3118
|
puzzle: i
|
|
2950
|
-
}),
|
|
2951
|
-
let c =
|
|
2952
|
-
return c && (c.value =
|
|
3119
|
+
}), f.originalPuzzle = a;
|
|
3120
|
+
let c = E("#simulator-puzzle");
|
|
3121
|
+
return c && (c.value = f.originalPuzzle), f.activeTab === "thumb" && M(), f.puzzleData;
|
|
2953
3122
|
});
|
|
2954
3123
|
return function() {
|
|
2955
3124
|
return e.apply(this, arguments);
|
|
2956
3125
|
};
|
|
2957
|
-
}(),
|
|
2958
|
-
c.addLogEntry(e,
|
|
2959
|
-
}),
|
|
2960
|
-
|
|
2961
|
-
},
|
|
2962
|
-
let n =
|
|
3126
|
+
}(), P = re((e) => {
|
|
3127
|
+
c.addLogEntry(e, L);
|
|
3128
|
+
}), F = (e, t) => {
|
|
3129
|
+
ie(e, t, P);
|
|
3130
|
+
}, I = (e, t) => {
|
|
3131
|
+
let n = h.querySelector(`[data-badge="${e}"]`);
|
|
2963
3132
|
n && (n.textContent = t && t > 0 ? String(t) : "");
|
|
2964
|
-
},
|
|
2965
|
-
state:
|
|
2966
|
-
getElement:
|
|
2967
|
-
sendToGame:
|
|
2968
|
-
logMessage:
|
|
2969
|
-
loadPuzzle:
|
|
2970
|
-
updateStatus:
|
|
2971
|
-
updateTimer:
|
|
2972
|
-
setCollapsed:
|
|
2973
|
-
switchTab:
|
|
2974
|
-
updateThumbnail:
|
|
2975
|
-
updateBadge:
|
|
3133
|
+
}, L = {
|
|
3134
|
+
state: f,
|
|
3135
|
+
getElement: E,
|
|
3136
|
+
sendToGame: F,
|
|
3137
|
+
logMessage: P.log,
|
|
3138
|
+
loadPuzzle: N,
|
|
3139
|
+
updateStatus: O,
|
|
3140
|
+
updateTimer: k,
|
|
3141
|
+
setCollapsed: j,
|
|
3142
|
+
switchTab: A,
|
|
3143
|
+
updateThumbnail: M,
|
|
3144
|
+
updateBadge: I,
|
|
2976
3145
|
fixtures: o,
|
|
2977
3146
|
fixtureCategories: s,
|
|
2978
3147
|
gameSlug: (i = e.slug) == null ? null : i
|
|
2979
3148
|
};
|
|
2980
|
-
console.log("[Simulator] Context created with gameSlug:",
|
|
3149
|
+
console.log("[Simulator] Context created with gameSlug:", L.gameSlug), u.forEach((e) => e.bind(L)), w.querySelectorAll(".simulator-tab").forEach((e) => {
|
|
2981
3150
|
e.addEventListener("click", () => {
|
|
2982
3151
|
let t = e.getAttribute("data-tab");
|
|
2983
|
-
|
|
3152
|
+
A(t), I(t, 0);
|
|
2984
3153
|
});
|
|
2985
|
-
}), w.addEventListener("click", (e) => {
|
|
2986
|
-
e.stopPropagation(), N(!0);
|
|
2987
|
-
}), x.addEventListener("click", (e) => {
|
|
2988
|
-
e.stopPropagation(), h.isPaused ? (L("RESUME_GAME", {}), h.isPaused = !1, k(!1), A("Running", "ready")) : (L("PAUSE_GAME", {}), h.isPaused = !0, k(!0), A("Paused", "paused"));
|
|
2989
|
-
let t = O("#simulator-pause");
|
|
2990
|
-
t && (t.textContent = h.isPaused ? "Resume" : "Pause");
|
|
2991
3154
|
}), S.addEventListener("click", (e) => {
|
|
2992
|
-
e.stopPropagation(),
|
|
2993
|
-
let t = O("#simulator-pause"), n = O("#simulator-start");
|
|
2994
|
-
t && (t.disabled = !0, t.textContent = "Pause"), n && (n.textContent = "Start");
|
|
2995
|
-
}), C.addEventListener("click", (e) => {
|
|
2996
|
-
e.stopPropagation(), h.isCollapsed && N(!1), M("auth");
|
|
3155
|
+
e.stopPropagation(), j(!0);
|
|
2997
3156
|
}), y.addEventListener("click", (e) => {
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3157
|
+
e.stopPropagation(), f.isPaused ? (F("RESUME_GAME", {}), f.isPaused = !1, D(!1), O("Running", "ready")) : (F("PAUSE_GAME", {}), f.isPaused = !0, D(!0), O("Paused", "paused"));
|
|
3158
|
+
let t = E("#simulator-pause");
|
|
3159
|
+
t && (t.textContent = f.isPaused ? "Resume" : "Pause");
|
|
3160
|
+
}), b.addEventListener("click", (e) => {
|
|
3161
|
+
e.stopPropagation(), F("RETRY_PUZZLE", {}), f.hasStarted = !1, f.isPaused = !1, D(!1), y.disabled = !0, O("Ready to retry", "ready");
|
|
3162
|
+
let t = E("#simulator-pause"), n = E("#simulator-start");
|
|
3163
|
+
t && (t.disabled = !0, t.textContent = "Pause"), n && (n.textContent = "Start");
|
|
3164
|
+
}), x.addEventListener("click", (e) => {
|
|
3165
|
+
e.stopPropagation(), f.isCollapsed && j(!1), A("auth");
|
|
3166
|
+
}), _.addEventListener("click", (e) => {
|
|
3167
|
+
f.isCollapsed && e.target !== S && j(!1);
|
|
3168
|
+
}), f.isCollapsed || A(f.activeTab);
|
|
3169
|
+
let R = new URLSearchParams(window.location.search);
|
|
3170
|
+
(R.has("code") || R.has("error")) && (j(!1), A("auth"));
|
|
3171
|
+
let me = (e) => ({
|
|
3003
3172
|
userState: {
|
|
3004
|
-
gameSettings:
|
|
3173
|
+
gameSettings: f.gameSettings,
|
|
3005
3174
|
id: "simulator-user",
|
|
3006
3175
|
ownerID: "simulator-owner"
|
|
3007
3176
|
},
|
|
@@ -3016,7 +3185,7 @@ function Ke(e = {}) {
|
|
|
3016
3185
|
},
|
|
3017
3186
|
startOrFindGameplay: { gamePlayed: {
|
|
3018
3187
|
additionalTimeAddedSecs: 0,
|
|
3019
|
-
boardState:
|
|
3188
|
+
boardState: f.currentInputStr,
|
|
3020
3189
|
combinedTimeSecs: 0,
|
|
3021
3190
|
completed: !1,
|
|
3022
3191
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -3038,49 +3207,45 @@ function Ke(e = {}) {
|
|
|
3038
3207
|
mostRecentDaily: null
|
|
3039
3208
|
}
|
|
3040
3209
|
} },
|
|
3041
|
-
theme:
|
|
3042
|
-
hostContext:
|
|
3043
|
-
type: "app",
|
|
3044
|
-
layout: "desktop",
|
|
3045
|
-
host: null
|
|
3046
|
-
}],
|
|
3210
|
+
theme: f.selectedTheme,
|
|
3211
|
+
hostContext: f.hostContext,
|
|
3047
3212
|
appRuntimeContract: "1.0"
|
|
3048
|
-
}),
|
|
3213
|
+
}), ge = function() {
|
|
3049
3214
|
var e = t(function* () {
|
|
3050
|
-
|
|
3215
|
+
O("Loading puzzle...", "waiting");
|
|
3051
3216
|
try {
|
|
3052
|
-
let e =
|
|
3053
|
-
|
|
3217
|
+
let e = me(yield N());
|
|
3218
|
+
O("Sending READY_DATA...", "waiting"), F("READY_DATA", e), O("Waiting for game to load...", "waiting");
|
|
3054
3219
|
} catch (e) {
|
|
3055
|
-
|
|
3220
|
+
O(`Error: ${e}`, "paused");
|
|
3056
3221
|
}
|
|
3057
3222
|
});
|
|
3058
3223
|
return function() {
|
|
3059
3224
|
return e.apply(this, arguments);
|
|
3060
3225
|
};
|
|
3061
|
-
}(),
|
|
3062
|
-
console.log("Simulator: Game loaded, ready to start"),
|
|
3226
|
+
}(), z = () => {
|
|
3227
|
+
console.log("Simulator: Game loaded, ready to start"), b.disabled = !1, u.forEach((e) => {
|
|
3063
3228
|
var t;
|
|
3064
|
-
return (t = e.onMessage) == null ? void 0 : t.call(e, "READY_GAME_LOADED", void 0,
|
|
3065
|
-
}), a && !
|
|
3066
|
-
let e =
|
|
3067
|
-
e == null || e.click(),
|
|
3229
|
+
return (t = e.onMessage) == null ? void 0 : t.call(e, "READY_GAME_LOADED", void 0, L);
|
|
3230
|
+
}), a && !f.hasStarted && setTimeout(() => {
|
|
3231
|
+
let e = E("#simulator-start");
|
|
3232
|
+
e == null || e.click(), y.disabled = !1, f.hasStarted = !0, O("Running", "ready");
|
|
3068
3233
|
}, 100);
|
|
3069
3234
|
};
|
|
3070
|
-
return
|
|
3235
|
+
return ae((e, t) => {
|
|
3071
3236
|
var n, r;
|
|
3072
3237
|
if (e === "READY") {
|
|
3073
|
-
console.log("Simulator: Received READY from game"),
|
|
3238
|
+
console.log("Simulator: Received READY from game"), ge();
|
|
3074
3239
|
return;
|
|
3075
3240
|
}
|
|
3076
3241
|
if (e === "READY_GAME_LOADED") {
|
|
3077
|
-
|
|
3242
|
+
z();
|
|
3078
3243
|
return;
|
|
3079
3244
|
}
|
|
3080
3245
|
if (e === "TIMER_TICK") {
|
|
3081
3246
|
if (t != null && t.display) {
|
|
3082
3247
|
let [e, n] = t.display;
|
|
3083
|
-
|
|
3248
|
+
k(e, n);
|
|
3084
3249
|
}
|
|
3085
3250
|
return;
|
|
3086
3251
|
}
|
|
@@ -3089,30 +3254,30 @@ function Ke(e = {}) {
|
|
|
3089
3254
|
console.log("Simulator: Sidebar update", t);
|
|
3090
3255
|
return;
|
|
3091
3256
|
}
|
|
3092
|
-
|
|
3257
|
+
u.forEach((n) => {
|
|
3093
3258
|
var r;
|
|
3094
|
-
return (r = n.onMessage) == null ? void 0 : r.call(n, e, t,
|
|
3259
|
+
return (r = n.onMessage) == null ? void 0 : r.call(n, e, t, L);
|
|
3095
3260
|
});
|
|
3096
3261
|
let i = (n = t == null || (r = t.input) == null ? void 0 : r.boardState) == null ? t == null ? void 0 : t.boardState : n;
|
|
3097
|
-
e === "UPLOAD_NEW_GAME_STATE" && i && (
|
|
3098
|
-
},
|
|
3262
|
+
e === "UPLOAD_NEW_GAME_STATE" && i && (f.currentInputStr = i, f.activeTab === "thumb" && M(), console.log("Simulator: Game state uploaded", t)), e === "GAME_COMPLETED" && (console.log("Simulator: Game completed!", t), y.disabled = !0, f.hasStarted = !1, O("Completed!", "complete"));
|
|
3263
|
+
}, P), console.log("Simulator initialized"), $ = {
|
|
3099
3264
|
updateFixtures: (e) => {
|
|
3100
|
-
o =
|
|
3265
|
+
o = oe(e), s = Array.from(o.keys()).sort(), L.fixtures = o, L.fixtureCategories = s;
|
|
3101
3266
|
let t = localStorage.getItem("simulator-fixture-category");
|
|
3102
|
-
if (!
|
|
3267
|
+
if (!f.selectedCategory || !s.includes(f.selectedCategory)) {
|
|
3103
3268
|
var n;
|
|
3104
|
-
|
|
3269
|
+
f.selectedCategory = t && s.includes(t) ? t : (n = s[0]) == null ? null : n;
|
|
3105
3270
|
}
|
|
3106
|
-
let r =
|
|
3107
|
-
r == null || r.bind(
|
|
3271
|
+
let r = u.find((e) => e.id === "ctrl");
|
|
3272
|
+
r == null || r.bind(L), console.log("Simulator: Fixtures updated", {
|
|
3108
3273
|
categories: s,
|
|
3109
|
-
selectedCategory:
|
|
3274
|
+
selectedCategory: f.selectedCategory
|
|
3110
3275
|
});
|
|
3111
3276
|
},
|
|
3112
|
-
sendToGame:
|
|
3113
|
-
loadPuzzle:
|
|
3277
|
+
sendToGame: F,
|
|
3278
|
+
loadPuzzle: N
|
|
3114
3279
|
}, $;
|
|
3115
3280
|
}
|
|
3116
|
-
export {
|
|
3281
|
+
export { et as t };
|
|
3117
3282
|
|
|
3118
|
-
//# sourceMappingURL=createSimulator-
|
|
3283
|
+
//# sourceMappingURL=createSimulator-CxuhQLO3.js.map
|