@puzzmo/sdk 1.0.38 → 1.0.40

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/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { t as e } from "./objectSpread2-COovHPnD.js";
2
2
  import { t } from "./asyncToGenerator-Dn36a-ch.js";
3
- var n = function() {
3
+ import { t as n } from "./objectWithoutProperties-BVU0RRck.js";
4
+ var r = function() {
4
5
  var n = t(function* (t, n, r, i) {
5
6
  try {
6
7
  let a = e(e({}, t), {}, {
@@ -22,7 +23,7 @@ var n = function() {
22
23
  return n.apply(this, arguments);
23
24
  };
24
25
  }();
25
- const r = (e) => {
26
+ const i = (e) => {
26
27
  let t = {
27
28
  context: e,
28
29
  updateCount: 0,
@@ -35,31 +36,31 @@ const r = (e) => {
35
36
  }
36
37
  };
37
38
  return {
38
- trackEvent: (e, r) => {
39
+ trackEvent: (e, n) => {
39
40
  let i = ((/* @__PURE__ */ new Date()).getTime() - t.startTime.getTime()) / 1e3;
40
41
  switch (e) {
41
42
  case "READY_GAME_LOADED":
42
- t.tracked.pageView || (n(t.context, "page_view"), t.tracked.pageView = !0);
43
+ t.tracked.pageView || (r(t.context, "page_view"), t.tracked.pageView = !0);
43
44
  break;
44
45
  case "UPLOAD_NEW_GAME_STATE":
45
- t.updateCount++, t.updateCount > 2 && !t.tracked.gameplayActive && (n(t.context, "gameplay_active"), t.tracked.gameplayActive = !0), i > 30 && !t.tracked.active30s && (n(t.context, "active_30s"), t.tracked.active30s = !0);
46
+ t.updateCount++, t.updateCount > 2 && !t.tracked.gameplayActive && (r(t.context, "gameplay_active"), t.tracked.gameplayActive = !0), i > 30 && !t.tracked.active30s && (r(t.context, "active_30s"), t.tracked.active30s = !0);
46
47
  break;
47
48
  case "GAME_COMPLETED":
48
- !t.tracked.completed && r != null && r.input && (n(t.context, "completed", {}, r.input.elapsedTimeSecs), t.tracked.completed = !0);
49
+ !t.tracked.completed && n != null && n.input && (r(t.context, "completed", {}, n.input.elapsedTimeSecs), t.tracked.completed = !0);
49
50
  break;
50
51
  }
51
52
  },
52
53
  trackLinkClick: (e) => {
53
- n(t.context, "link_click", e);
54
+ r(t.context, "link_click", e);
54
55
  }
55
56
  };
56
- }, i = (e) => {
57
- if (!u(e)) return null;
58
- let t = o();
59
- if (!t.enabled) return null;
60
- let n = s(e, t.apiRoot);
61
- return n ? r(n) : null;
62
57
  }, a = (e) => {
58
+ if (!d(e)) return null;
59
+ let t = s();
60
+ if (!t.enabled) return null;
61
+ let n = c(e, t.apiRoot);
62
+ return n ? i(n) : null;
63
+ }, o = (e) => {
63
64
  if (typeof document > "u") return () => {};
64
65
  let t = (t) => {
65
66
  var n, r;
@@ -75,7 +76,7 @@ const r = (e) => {
75
76
  return document.addEventListener("click", t), () => document.removeEventListener("click", t);
76
77
  };
77
78
  /** Picks the events endpoint, and disables analytics entirely on localhost (dev + simulator). */
78
- var o = () => {
79
+ var s = () => {
79
80
  if (typeof window > "u" || !window.location) return {
80
81
  apiRoot: "",
81
82
  enabled: !1
@@ -88,8 +89,8 @@ var o = () => {
88
89
  apiRoot: e.includes("staging") ? "https://api-staging.puzzmo.com/" : "https://api.puzzmo.com/",
89
90
  enabled: !0
90
91
  };
91
- }, s = (e, t) => {
92
- var n, r, i, a, o, s, l, u, f, p, m;
92
+ }, c = (e, t) => {
93
+ var n, r, i, a, o, s, c, u, d, p, m;
93
94
  let h = e == null || (n = e.startOrFindGameplay) == null ? void 0 : n.gamePlayed;
94
95
  if (!h) return null;
95
96
  let g = h.puzzle, _ = (r = e == null ? void 0 : e.hostContext) == null ? [] : r;
@@ -98,28 +99,28 @@ var o = () => {
98
99
  puzzleID: g.id,
99
100
  gameplayOwnerID: h.ownerID || (e == null || (o = e.userState) == null ? void 0 : o.id) || "unknown",
100
101
  apiRoot: t,
101
- userType: c(e == null || (s = e.currentUser) == null ? void 0 : s.type),
102
- runtimeType: d(_),
103
- userID: e == null || (l = e.currentUser) == null ? void 0 : l.id,
102
+ userType: l(e == null || (s = e.currentUser) == null ? void 0 : s.type),
103
+ runtimeType: f(_),
104
+ userID: e == null || (c = e.currentUser) == null ? void 0 : c.id,
104
105
  teamSlug: ((u = g.team) == null ? void 0 : u.slug) || void 0,
105
- partnerSlug: ((f = _.find((e) => (e == null ? void 0 : e.type) === "embed")) == null || (f = f.partner) == null ? void 0 : f.slug) || void 0,
106
+ partnerSlug: ((d = _.find((e) => (e == null ? void 0 : e.type) === "embed")) == null || (d = d.partner) == null ? void 0 : d.slug) || void 0,
106
107
  dailyDateKey: (p = g.mostRecentDaily) == null || (p = p.daily) == null ? void 0 : p.dateKey,
107
108
  embedID: ((m = _.find((e) => (e == null ? void 0 : e.type) === "embed")) == null ? void 0 : m.embedID) || void 0
108
109
  };
109
- }, c = (e) => !e || e === "Unverified" ? "anon" : e === "Paid" ? "paid" : "user", l = 512, u = (e) => {
110
+ }, l = (e) => !e || e === "Unverified" ? "anon" : e === "Paid" ? "paid" : "user", u = 512, d = (e) => {
110
111
  var t, n;
111
112
  let r = e == null || (t = e.startOrFindGameplay) == null || (t = t.gamePlayed) == null || (t = t.puzzle) == null ? void 0 : t.game, i = r == null ? void 0 : r.flagsArr;
112
- return ((Array.isArray(i) ? (n = i[0]) == null ? 0 : n : typeof i == "number" ? i : 0) & l) === l;
113
- }, d = (e) => {
113
+ return ((Array.isArray(i) ? (n = i[0]) == null ? 0 : n : typeof i == "number" ? i : 0) & u) === u;
114
+ }, f = (e) => {
114
115
  if (e.find((e) => (e == null ? void 0 : e.type) === "embed")) return "iframe";
115
116
  let t = e.find((e) => (e == null ? void 0 : e.type) === "app");
116
117
  return (t == null ? void 0 : t.host) === "__embed" ? "simple_embed" : (t == null ? void 0 : t.host) === "app-embed" ? "app_embed" : (t == null ? void 0 : t.host) === "ios-app" ? "ios_native" : "puzzmo_com";
117
- };
118
- function f(e) {
118
+ }, p = ["inputString"];
119
+ function m(e) {
119
120
  let t = e >= 3600 * 1e3;
120
121
  return new Date(e).toISOString().slice(t ? 11 : 14, -1).split(".")[0];
121
122
  }
122
- function p(e = 0, t = 0) {
123
+ function h(e = 0, t = 0) {
123
124
  let n = e, r = t, i = 0, a, o, s, c = () => {
124
125
  var e;
125
126
  if (o === void 0) return n + r;
@@ -163,11 +164,11 @@ function p(e = 0, t = 0) {
163
164
  isRunning: () => o !== void 0 && s === void 0,
164
165
  display: () => {
165
166
  let e = c() - r;
166
- return [f(Math.max(0, e)), r === 0 ? "" : f(r)];
167
+ return [m(Math.max(0, e)), r === 0 ? "" : m(r)];
167
168
  }
168
169
  };
169
170
  }
170
- function m() {
171
+ function g() {
171
172
  let e = /* @__PURE__ */ new Map();
172
173
  return typeof window < "u" && window.addEventListener("message", (t) => {
173
174
  var n;
@@ -196,126 +197,136 @@ function m() {
196
197
  })
197
198
  };
198
199
  }
199
- var h = m();
200
+ var _ = g();
200
201
  /** Creates a Puzzmo SDK instance for communicating with the Puzzmo host */
201
- const g = (n = {}) => {
202
- var r;
203
- let o = null, s = null, c = () => {
202
+ const v = (r = {}) => {
203
+ var i;
204
+ let s = null, c = null, l = () => {
204
205
  var e;
205
- return o == null || (e = o.startOrFindGameplay) == null ? void 0 : e.gamePlayed;
206
- }, l = () => {
207
- var e, t;
208
- return (e = (t = c()) == null ? void 0 : t.id) == null ? null : e;
206
+ return s == null || (e = s.startOrFindGameplay) == null ? void 0 : e.gamePlayed;
209
207
  }, u = () => {
210
208
  var e, t;
211
- return (e = (t = c()) == null ? void 0 : t.puzzle.puzzle) == null ? null : e;
209
+ return (e = (t = l()) == null ? void 0 : t.id) == null ? null : e;
212
210
  }, d = () => {
213
211
  var e, t;
214
- return (e = (t = c()) == null ? void 0 : t.boardState) == null ? null : e;
212
+ return (e = (t = l()) == null ? void 0 : t.puzzle.puzzle) == null ? null : e;
215
213
  }, f = () => {
216
- var e;
217
- return (e = o == null ? void 0 : o.theme) == null ? null : e;
214
+ var e, t;
215
+ return (e = (t = l()) == null ? void 0 : t.boardState) == null ? null : e;
218
216
  }, m = () => {
217
+ var e;
218
+ return (e = s == null ? void 0 : s.theme) == null ? null : e;
219
+ }, g = () => {
219
220
  var e, t;
220
- return (e = (t = c()) == null ? void 0 : t.completed) == null ? !1 : e;
221
- }, g = /* @__PURE__ */ new Map(), v = null, y = null, b = !1, x = (e, t) => {
222
- b || y == null || y.trackEvent(e, t);
223
- }, S = p(), C = null, w = null, T = () => {
224
- C || (C = setInterval(() => {
225
- if (S.isPaused()) return;
226
- let [e, t] = S.display();
227
- h.sendMessage("TIMER_TICK", { display: [e, t] });
228
- }, 500), w = setInterval(() => {
229
- S.isPaused() || h.sendMessage("TIMER_SYNC", Math.floor(S.timeWithoutPenaltySecs()));
221
+ return (e = (t = l()) == null ? void 0 : t.completed) == null ? !1 : e;
222
+ }, v = /* @__PURE__ */ new Map(), b = null, x = null, S = !1, C = (e, t) => {
223
+ S || x == null || x.trackEvent(e, t);
224
+ }, w = h(), T = null, E = null, D = () => {
225
+ T || (T = setInterval(() => {
226
+ if (w.isPaused()) return;
227
+ let [e, t] = w.display();
228
+ _.sendMessage("TIMER_TICK", { display: [e, t] });
229
+ }, 500), E = setInterval(() => {
230
+ w.isPaused() || _.sendMessage("TIMER_SYNC", Math.floor(w.timeWithoutPenaltySecs()));
230
231
  }, 1e4));
231
- }, E = () => {
232
- C && (clearInterval(C), C = null), w && (clearInterval(w), w = null);
233
- }, D = (e, t) => {
234
- let n = g.get(e);
232
+ }, O = () => {
233
+ T && (clearInterval(T), T = null), E && (clearInterval(E), E = null);
234
+ }, k = (e, t) => {
235
+ let n = v.get(e);
235
236
  n && n.forEach((e) => e(t));
236
237
  };
237
- h.onMessage("START_GAME", () => {
238
- S._init(), T(), D("start");
238
+ _.onMessage("START_GAME", () => {
239
+ w._init(), D(), k("start");
239
240
  });
240
- let O = () => {
241
- let e = S.isPaused();
242
- S._pause(), S.isPaused() !== e && D("pause");
243
- }, k = () => {
244
- let e = S.isPaused();
245
- S._resume(), S.isPaused() !== e && D("resume");
241
+ let A = () => {
242
+ let e = w.isPaused();
243
+ w._pause(), w.isPaused() !== e && k("pause");
244
+ }, j = () => {
245
+ let e = w.isPaused();
246
+ w._resume(), w.isPaused() !== e && k("resume");
246
247
  };
247
- h.onMessage("PAUSE_GAME", O), h.onMessage("RESUME_GAME", k), h.onMessage("SETTINGS_UPDATE", (t) => {
248
- v = e(e({}, v), t), D("settingsUpdate", v);
249
- }), h.onMessage("KEYBOARD_KEY_PRESS", (e) => D("keyboardKeyPress", e)), h.onMessage("KEYBOARD_CURSOR_CHANGE", (e) => D("keyboardCursorChange", e)), h.onMessage("KEYBOARD_CURSOR_END", () => D("keyboardCursorEnd")), h.onMessage("RETRY_PUZZLE", () => {
250
- S._reset(), E(), D("retry");
251
- }), h.onMessage("READY_DATA", (e) => {
252
- var t, n, r;
253
- let c = e;
254
- o = c, v === null && (v = (t = (n = c.userState) == null ? void 0 : n.gameSettings) == null ? {} : t);
255
- let l = (r = c.startOrFindGameplay) == null ? void 0 : r.gamePlayed;
256
- if (l) {
257
- var u, d;
258
- let e = ((u = l.elapsedTimeSecs) == null ? 0 : u) * 1e3, t = ((d = l.additionalTimeAddedSecs) == null ? 0 : d) * 1e3;
259
- S._reset(e, t);
248
+ _.onMessage("PAUSE_GAME", A), _.onMessage("RESUME_GAME", j), _.onMessage("SETTINGS_UPDATE", (t) => {
249
+ b = e(e({}, b), t), k("settingsUpdate", b);
250
+ }), _.onMessage("KEYBOARD_KEY_PRESS", (e) => k("keyboardKeyPress", e)), _.onMessage("KEYBOARD_CURSOR_CHANGE", (e) => k("keyboardCursorChange", e)), _.onMessage("KEYBOARD_CURSOR_END", () => k("keyboardCursorEnd")), _.onMessage("RETRY_PUZZLE", () => {
251
+ w._reset(), O(), k("retry");
252
+ }), _.onMessage("READY_DATA", (e) => {
253
+ var t;
254
+ let n = e;
255
+ s = n;
256
+ let r = (t = n.startOrFindGameplay) == null ? void 0 : t.gamePlayed;
257
+ if (b === null) {
258
+ var i, l, u;
259
+ let e = r == null || (i = r.puzzle) == null || (i = i.game) == null ? void 0 : i.slug, t = e ? (l = n.userState) == null || (l = l.gameSettings) == null ? void 0 : l[e] : null;
260
+ if (typeof t == "string") try {
261
+ t = JSON.parse(t);
262
+ } catch (e) {
263
+ t = null;
264
+ }
265
+ b = (u = t) == null ? {} : u;
266
+ }
267
+ if (r) {
268
+ var d, f;
269
+ let e = ((d = r.elapsedTimeSecs) == null ? 0 : d) * 1e3, t = ((f = r.additionalTimeAddedSecs) == null ? 0 : f) * 1e3;
270
+ w._reset(e, t);
260
271
  }
261
- if (!y) {
262
- var f;
263
- y = i(c), b = (f = l == null ? void 0 : l.completed) == null ? !1 : f, y && a((e) => y.trackLinkClick(e));
272
+ if (!x) {
273
+ var p;
274
+ x = a(n), S = (p = r == null ? void 0 : r.completed) == null ? !1 : p, x && o((e) => x.trackLinkClick(e));
264
275
  }
265
- s && (s(c), s = null);
276
+ c && (c(n), c = null);
266
277
  });
267
- let A = {
268
- timeMs: () => S.timeMs(),
269
- timeSecs: () => S.timeSecs(),
270
- addedTimeMs: () => S.addedTimeMs(),
271
- addedTimeSecs: () => S.addedTimeSecs(),
272
- timeWithoutPenaltySecs: () => S.timeWithoutPenaltySecs(),
273
- display: () => S.display(),
274
- addPenalty: (e) => S.addPenalty(e),
275
- isPaused: () => S.isPaused(),
276
- isRunning: () => S.isRunning(),
277
- pause: O,
278
- resume: k
279
- }, j = {
280
- send: (e, t) => h.sendMessage(e, t),
281
- on: (e, t) => h.onMessage(e, t),
282
- timer: A,
283
- bootstrap: () => o
284
- }, M = {};
285
- for (let e of (r = n.plugins) == null ? [] : r) M[e.name] = e.setup(j);
278
+ let M = {
279
+ timeMs: () => w.timeMs(),
280
+ timeSecs: () => w.timeSecs(),
281
+ addedTimeMs: () => w.addedTimeMs(),
282
+ addedTimeSecs: () => w.addedTimeSecs(),
283
+ timeWithoutPenaltySecs: () => w.timeWithoutPenaltySecs(),
284
+ display: () => w.display(),
285
+ addPenalty: (e) => w.addPenalty(e),
286
+ isPaused: () => w.isPaused(),
287
+ isRunning: () => w.isRunning(),
288
+ pause: A,
289
+ resume: j
290
+ }, N = {
291
+ send: (e, t) => _.sendMessage(e, t),
292
+ on: (e, t) => _.onMessage(e, t),
293
+ timer: M,
294
+ bootstrap: () => s
295
+ }, P = {};
296
+ for (let e of (i = r.plugins) == null ? [] : i) P[e.name] = e.setup(N);
286
297
  return {
287
- timer: A,
288
- plugins: M,
298
+ timer: M,
299
+ plugins: P,
289
300
  gameReady: function() {
290
301
  var e = t(function* () {
291
302
  var e;
292
- if (h.sendMessage("READY", {}), u()) {
293
- let e = d();
303
+ if (_.sendMessage("READY", {}), d()) {
304
+ let e = f();
294
305
  return {
295
- puzzleString: u(),
306
+ puzzleString: d(),
296
307
  inputString: e,
297
308
  boardState: e,
298
- theme: f(),
299
- completed: m(),
300
- readyData: o
309
+ theme: m(),
310
+ completed: g(),
311
+ readyData: s
301
312
  };
302
313
  }
303
- let t = (e = n.timeout) == null ? 5e3 : e;
314
+ let t = (e = r.timeout) == null ? 5e3 : e;
304
315
  yield new Promise((e, n) => {
305
- s = e, setTimeout(() => {
306
- s && (s = null, n(/* @__PURE__ */ Error(`Timeout waiting for READY_DATA after ${t}ms`)));
316
+ c = e, setTimeout(() => {
317
+ c && (c = null, n(/* @__PURE__ */ Error(`Timeout waiting for READY_DATA after ${t}ms`)));
307
318
  }, t);
308
319
  });
309
- let r = u();
310
- if (!r) throw Error("READY_DATA received but no puzzle data found");
311
- let i = d();
320
+ let n = d();
321
+ if (!n) throw Error("READY_DATA received but no puzzle data found");
322
+ let i = f();
312
323
  return {
313
- puzzleString: r,
324
+ puzzleString: n,
314
325
  inputString: i,
315
326
  boardState: i,
316
- theme: f(),
317
- completed: m(),
318
- readyData: o
327
+ theme: m(),
328
+ completed: g(),
329
+ readyData: s
319
330
  };
320
331
  });
321
332
  return function() {
@@ -323,69 +334,69 @@ const g = (n = {}) => {
323
334
  };
324
335
  }(),
325
336
  gameLoaded: (e = {}) => {
326
- h.sendMessage("READY_GAME_LOADED", {
337
+ _.sendMessage("READY_GAME_LOADED", {
327
338
  state: e,
328
339
  gameRuntimeContract: "1.0",
329
340
  embedRuntimeContract: "1.0"
330
- }), x("READY_GAME_LOADED");
341
+ }), C("READY_GAME_LOADED");
331
342
  },
332
- on: (e, t) => (g.has(e) || g.set(e, /* @__PURE__ */ new Set()), g.get(e).add(t), () => {
343
+ on: (e, t) => (v.has(e) || v.set(e, /* @__PURE__ */ new Set()), v.get(e).add(t), () => {
333
344
  var n;
334
- (n = g.get(e)) == null || n.delete(t);
345
+ (n = v.get(e)) == null || n.delete(t);
335
346
  }),
336
347
  off: (e, t) => {
337
348
  var n;
338
- (n = g.get(e)) == null || n.delete(t);
349
+ (n = v.get(e)) == null || n.delete(t);
339
350
  },
340
351
  updateGameState: (e, t) => {
341
352
  var n, r;
342
- let i = l();
343
- i && (h.sendMessage("UPLOAD_NEW_GAME_STATE", {
353
+ let i = u();
354
+ i && (_.sendMessage("UPLOAD_NEW_GAME_STATE", {
344
355
  id: i,
345
356
  input: {
346
357
  boardState: e,
347
- elapsedTimeSecs: (n = t == null ? void 0 : t.elapsedTimeSecs) == null ? S.timeWithoutPenaltySecs() : n,
348
- additionalTimeAddedSecs: (r = t == null ? void 0 : t.additionalTimeAddedSecs) == null ? S.addedTimeSecs() : r,
358
+ elapsedTimeSecs: (n = t == null ? void 0 : t.elapsedTimeSecs) == null ? w.timeWithoutPenaltySecs() : n,
359
+ additionalTimeAddedSecs: (r = t == null ? void 0 : t.additionalTimeAddedSecs) == null ? w.addedTimeSecs() : r,
349
360
  collabUserReferences: []
350
361
  }
351
- }), x("UPLOAD_NEW_GAME_STATE"));
362
+ }), C("UPLOAD_NEW_GAME_STATE"));
352
363
  },
353
- gameCompleted: (t, n) => {
354
- var r, i, a, o, s;
355
- S._conclude(), E();
356
- let c = e(e({}, t), {}, {
357
- elapsedTimeSecs: (r = t.elapsedTimeSecs) == null ? S.timeWithoutPenaltySecs() : r,
358
- additionalTimeAddedSecs: (i = t.additionalTimeAddedSecs) == null ? S.addedTimeSecs() : i
359
- }), u = (a = n == null ? void 0 : n.deeds) == null ? [] : a;
360
- u.push({
364
+ gameCompleted: (t, r) => {
365
+ var i, a, o, s, c;
366
+ w._conclude(), O();
367
+ let { inputString: l } = t, d = e(e({}, n(t, p)), {}, {
368
+ boardState: l == null ? t.boardState : l,
369
+ elapsedTimeSecs: (i = t.elapsedTimeSecs) == null ? w.timeWithoutPenaltySecs() : i,
370
+ additionalTimeAddedSecs: (a = t.additionalTimeAddedSecs) == null ? w.addedTimeSecs() : a
371
+ }), f = (o = r == null ? void 0 : r.deeds) == null ? [] : o;
372
+ f.push({
361
373
  id: "points",
362
374
  value: t.pointsAwarded
363
- }), u.push({
375
+ }), f.push({
364
376
  id: "time",
365
- value: Math.round((o = c.elapsedTimeSecs) == null ? 0 : o) + Math.round((s = c.additionalTimeAddedSecs) == null ? 0 : s)
377
+ value: Math.round((s = d.elapsedTimeSecs) == null ? 0 : s) + Math.round((c = d.additionalTimeAddedSecs) == null ? 0 : c)
366
378
  });
367
- let d = l();
368
- d && (h.sendMessage("GAME_COMPLETED", {
369
- id: d,
370
- input: c,
371
- config: n
372
- }), x("GAME_COMPLETED", { input: c }));
379
+ let m = u();
380
+ m && (_.sendMessage("GAME_COMPLETED", {
381
+ id: m,
382
+ input: d,
383
+ config: r
384
+ }), C("GAME_COMPLETED", { input: d }));
373
385
  },
374
- showCompletionScreen: (e, t, n = !0) => {
375
- h.sendMessage("SHOW_GAME_COMPLETE_SCREEN", {
386
+ showCompletionScreen: (e) => {
387
+ _.sendMessage("SHOW_GAME_COMPLETE_SCREEN", {
376
388
  results: e,
377
- showRetry: n,
378
- gameplay: t
389
+ showRetry: !0
379
390
  });
380
391
  },
381
392
  hitCheckpoint: (e, t, n) => {
382
393
  var r;
383
- if (!l()) return;
384
- let i = (r = d()) == null ? "" : r, a = {
385
- elapsedTimeSecs: S.timeWithoutPenaltySecs(),
386
- additionalTimeAddedSecs: S.addedTimeSecs()
394
+ if (!u()) return;
395
+ let i = (r = f()) == null ? "" : r, a = {
396
+ elapsedTimeSecs: w.timeWithoutPenaltySecs(),
397
+ additionalTimeAddedSecs: w.addedTimeSecs()
387
398
  };
388
- h.sendMessage("HIT_CHECKPOINT", {
399
+ _.sendMessage("HIT_CHECKPOINT", {
389
400
  checkpointName: e,
390
401
  gameplay: {
391
402
  inputStr: i,
@@ -396,22 +407,22 @@ const g = (n = {}) => {
396
407
  });
397
408
  },
398
409
  settings: {
399
- initialize: (t) => (v = e(e({}, _(t)), v), h.sendMessage("INITIALIZE_SETTINGS", {
410
+ initialize: (t) => (b = e(e({}, y(t)), b), _.sendMessage("INITIALIZE_SETTINGS", {
400
411
  components: t,
401
- settings: v
402
- }), v),
412
+ settings: b
413
+ }), b),
403
414
  get: () => {
404
415
  var e;
405
- return (e = v) == null ? {} : e;
416
+ return (e = b) == null ? {} : e;
406
417
  },
407
- update: (t) => (v = e(e({}, v), t), h.sendMessage("UPDATE_SETTINGS_FROM_EMBED", { settings: v }), v)
418
+ update: (t) => (b = e(e({}, b), t), _.sendMessage("UPDATE_SETTINGS_FROM_EMBED", { settings: b }), b)
408
419
  },
409
420
  keyboard: {
410
421
  show: (e) => {
411
- h.sendMessage("KEYBOARD_UPDATE_CONFIG", e);
422
+ _.sendMessage("KEYBOARD_UPDATE_CONFIG", e);
412
423
  },
413
424
  hide: () => {
414
- h.sendMessage("KEYBOARD_UPDATE_CONFIG", {
425
+ _.sendMessage("KEYBOARD_UPDATE_CONFIG", {
415
426
  layout: [],
416
427
  symbols: {},
417
428
  highlight: [],
@@ -422,13 +433,13 @@ const g = (n = {}) => {
422
433
  });
423
434
  }
424
435
  },
425
- _hostAPI: h
436
+ _hostAPI: _
426
437
  };
427
438
  };
428
439
  /** Walks settings UI components (recursing into split groups) collecting name → defaultValue pairs */
429
- function _(e) {
440
+ function y(e) {
430
441
  let t = {};
431
- for (let n of e) n.type === "split" ? Object.assign(t, _(n.content)) : "name" in n && (t[n.name] = n.defaultValue);
442
+ for (let n of e) n.type === "split" ? Object.assign(t, y(n.content)) : "name" in n && (t[n.name] = n.defaultValue);
432
443
  return t;
433
444
  }
434
445
  /**
@@ -443,7 +454,7 @@ function _(e) {
443
454
  * // Extend with dynamic disabled letters
444
455
  * sdk.keyboard.show({ ...defaultKeyboardConfig, disabled: usedLetters })
445
456
  */
446
- const v = {
457
+ const b = {
447
458
  layout: [
448
459
  "qwertyuiop",
449
460
  "asdfghjkl",
@@ -461,11 +472,11 @@ const v = {
461
472
  supportsDragCursor: !1
462
473
  };
463
474
  /** Custom error class for workshop import failures */
464
- var y = class extends Error {
475
+ var x = class extends Error {
465
476
  constructor(e, t, n) {
466
477
  super(t), this.type = e, this.originalError = n, this.name = "EditorImportError";
467
478
  }
468
479
  };
469
- export { y as EditorImportError, g as createPuzzmoSDK, v as defaultKeyboardConfig };
480
+ export { x as EditorImportError, v as createPuzzmoSDK, b as defaultKeyboardConfig };
470
481
 
471
482
  //# sourceMappingURL=index.js.map