@phantomclient/plugin 0.1.2 → 0.1.4

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.
@@ -6,8 +6,8 @@ class u extends Error {
6
6
  offset;
7
7
  }
8
8
  new TextEncoder();
9
- const Oe = { lt: "<", gt: ">", amp: "&", apos: "'", quot: '"' };
10
- function G(e) {
9
+ const Je = { lt: "<", gt: ">", amp: "&", apos: "'", quot: '"' };
10
+ function Q(e) {
11
11
  if (!e.includes("&")) return e;
12
12
  let t = "", n = 0;
13
13
  for (; n < e.length; ) {
@@ -15,41 +15,41 @@ function G(e) {
15
15
  if (r === -1) break;
16
16
  const i = e.indexOf(";", r + 1);
17
17
  t += e.slice(n, r);
18
- const s = i === -1 ? null : ze(e.slice(r + 1, i));
18
+ const s = i === -1 ? null : Xe(e.slice(r + 1, i));
19
19
  s === null ? (t += "&", n = r + 1) : (t += s, n = i + 1);
20
20
  }
21
21
  return t + e.slice(n);
22
22
  }
23
- function ze(e) {
23
+ function Xe(e) {
24
24
  if (e.startsWith("#")) {
25
25
  const t = e[1] === "x" || e[1] === "X", n = e.slice(t ? 2 : 1);
26
- if (n.length === 0 || !(t ? Ke(n) : Ve(n))) return null;
26
+ if (n.length === 0 || !(t ? Qe(n) : Ye(n))) return null;
27
27
  const r = Number.parseInt(n, t ? 16 : 10);
28
28
  return r <= 1114111 ? String.fromCodePoint(r) : null;
29
29
  }
30
- return Oe[e] ?? null;
30
+ return Je[e] ?? null;
31
31
  }
32
- function Ve(e) {
32
+ function Ye(e) {
33
33
  for (const t of e) if (t < "0" || t > "9") return !1;
34
34
  return !0;
35
35
  }
36
- function Ke(e) {
36
+ function Qe(e) {
37
37
  for (const t of e.toLowerCase()) if (!(t >= "0" && t <= "9" || t >= "a" && t <= "f")) return !1;
38
38
  return !0;
39
39
  }
40
- function V(e) {
40
+ function H(e) {
41
41
  let t = "";
42
42
  for (const n of e) n === "&" ? t += "&amp;" : n === "<" ? t += "&lt;" : n === ">" ? t += "&gt;" : t += n;
43
43
  return t;
44
44
  }
45
- function ee(e, t) {
45
+ function ae(e, t) {
46
46
  let n = "";
47
47
  for (const r of e) r === "&" ? n += "&amp;" : r === "<" ? n += "&lt;" : r === t ? n += t === '"' ? "&quot;" : "&apos;" : n += r;
48
48
  return n;
49
49
  }
50
- class v {
50
+ class g {
51
51
  constructor(t, n, r = "'", i = " ", s = ["", ""]) {
52
- this.name = t, this.quote = r, this.leading = i, this.around = s, this.written = n, this.decoded = G(n);
52
+ this.name = t, this.quote = r, this.leading = i, this.around = s, this.written = n, this.decoded = Q(n);
53
53
  }
54
54
  name;
55
55
  quote;
@@ -58,53 +58,53 @@ class v {
58
58
  written;
59
59
  decoded;
60
60
  static create(t, n, r = "'") {
61
- return new v(t, ee(n, r), r);
61
+ return new g(t, ae(n, r), r);
62
62
  }
63
63
  get value() {
64
64
  return this.decoded;
65
65
  }
66
66
  set value(t) {
67
- this.decoded = t, this.written = ee(t, this.quote);
67
+ this.decoded = t, this.written = ae(t, this.quote);
68
68
  }
69
69
  get raw() {
70
70
  return this.written;
71
71
  }
72
72
  }
73
- class M {
73
+ class B {
74
74
  type = "text";
75
75
  written;
76
76
  decoded;
77
77
  constructor(t) {
78
- this.written = t, this.decoded = G(t);
78
+ this.written = t, this.decoded = Q(t);
79
79
  }
80
80
  static create(t) {
81
- return new M(V(t));
81
+ return new B(H(t));
82
82
  }
83
83
  get value() {
84
84
  return this.decoded;
85
85
  }
86
86
  set value(t) {
87
- this.decoded = t, this.written = V(t);
87
+ this.decoded = t, this.written = H(t);
88
88
  }
89
89
  get raw() {
90
90
  return this.written;
91
91
  }
92
92
  }
93
- class w {
93
+ class S {
94
94
  constructor(t) {
95
95
  this.value = t;
96
96
  }
97
97
  value;
98
98
  type = "cdata";
99
99
  }
100
- class _e {
100
+ class Ze {
101
101
  constructor(t) {
102
102
  this.value = t;
103
103
  }
104
104
  value;
105
105
  type = "comment";
106
106
  }
107
- class We {
107
+ class et {
108
108
  constructor(t, n) {
109
109
  this.target = t, this.content = n;
110
110
  }
@@ -129,7 +129,7 @@ class f {
129
129
  }
130
130
  setAttribute(t, n) {
131
131
  const r = this.attributes.find((i) => i.name === t);
132
- r ? r.value = n : this.attributes.push(v.create(t, n));
132
+ r ? r.value = n : this.attributes.push(g.create(t, n));
133
133
  }
134
134
  removeAttribute(t) {
135
135
  const n = this.attributes.findIndex((r) => r.name === t);
@@ -159,13 +159,13 @@ class f {
159
159
  }
160
160
  set textContent(t) {
161
161
  const n = this.children.some((r) => r.type === "cdata");
162
- this.children = [n ? new w(t) : M.create(t)], this.selfClosing = !1;
162
+ this.children = [n ? new S(t) : B.create(t)], this.selfClosing = !1;
163
163
  }
164
164
  append(...t) {
165
165
  this.children.push(...t), t.length > 0 && (this.selfClosing = !1);
166
166
  }
167
167
  }
168
- class Se {
168
+ class Be {
169
169
  constructor(t) {
170
170
  this.children = t;
171
171
  }
@@ -174,7 +174,7 @@ class Se {
174
174
  return this.children.find((t) => t.type === "element") ?? null;
175
175
  }
176
176
  }
177
- class Ge {
177
+ class tt {
178
178
  constructor(t) {
179
179
  this.input = t;
180
180
  }
@@ -200,7 +200,7 @@ class Ge {
200
200
  }
201
201
  whitespace() {
202
202
  const t = this.index;
203
- for (; !this.done && Qe(this.input.charCodeAt(this.index)); ) this.index++;
203
+ for (; !this.done && st(this.input.charCodeAt(this.index)); ) this.index++;
204
204
  return this.input.slice(t, this.index);
205
205
  }
206
206
  until(t, n) {
@@ -211,65 +211,65 @@ class Ge {
211
211
  }
212
212
  name() {
213
213
  const t = this.index;
214
- for ((this.done || !Ae(this.input.charCodeAt(this.index))) && this.fail("Expected a name"), this.index++; !this.done && Ze(this.input.charCodeAt(this.index)); ) this.index++;
214
+ for ((this.done || !Me(this.input.charCodeAt(this.index))) && this.fail("Expected a name"), this.index++; !this.done && ot(this.input.charCodeAt(this.index)); ) this.index++;
215
215
  return this.input.slice(t, this.index);
216
216
  }
217
217
  fail(t) {
218
218
  throw new u(t, "XML_SYNTAX", this.index);
219
219
  }
220
220
  }
221
- const Xe = 32, Je = 9, He = 10, Ye = 13;
222
- function Qe(e) {
223
- return e === Xe || e === Je || e === He || e === Ye;
221
+ const nt = 32, rt = 9, it = 10, at = 13;
222
+ function st(e) {
223
+ return e === nt || e === rt || e === it || e === at;
224
224
  }
225
- function Ae(e) {
225
+ function Me(e) {
226
226
  return e >= 97 && e <= 122 || e >= 65 && e <= 90 || e === 95 || e === 58 || e > 127;
227
227
  }
228
- function Ze(e) {
229
- return Ae(e) || e >= 48 && e <= 57 || e === 45 || e === 46;
228
+ function ot(e) {
229
+ return Me(e) || e >= 48 && e <= 57 || e === 45 || e === 46;
230
230
  }
231
- const te = 64;
232
- function De(e) {
233
- const t = new Ge(e), n = Ue(t, null, 0);
234
- return n.some((r) => r.type === "element") || t.fail("Expected an element"), new Se(n);
231
+ const se = 64;
232
+ function Pe(e) {
233
+ const t = new tt(e), n = Ee(t, null, 0);
234
+ return n.some((r) => r.type === "element") || t.fail("Expected an element"), new Be(n);
235
235
  }
236
- function Ue(e, t, n) {
236
+ function Ee(e, t, n) {
237
237
  const r = [];
238
238
  for (; !e.done; ) {
239
239
  if (e.startsWith("</")) return t === null && e.fail("Closing tag with nothing open"), r;
240
- e.startsWith("<![CDATA[") ? (e.advance(9), r.push(new w(e.until("]]>", "CDATA section"))), e.advance(3)) : e.startsWith("<!--") ? (e.advance(4), r.push(new _e(e.until("-->", "comment"))), e.advance(3)) : e.startsWith("<?") ? r.push(tt(e)) : e.startsWith("<!") ? e.fail("Document type declarations are not supported") : e.peek() === "<" ? r.push(nt(e, n)) : r.push(et(e));
240
+ e.startsWith("<![CDATA[") ? (e.advance(9), r.push(new S(e.until("]]>", "CDATA section"))), e.advance(3)) : e.startsWith("<!--") ? (e.advance(4), r.push(new Ze(e.until("-->", "comment"))), e.advance(3)) : e.startsWith("<?") ? r.push(ct(e)) : e.startsWith("<!") ? e.fail("Document type declarations are not supported") : e.peek() === "<" ? r.push(mt(e, n)) : r.push(dt(e));
241
241
  }
242
242
  return t !== null && e.fail(`Unclosed element <${t}>`), r;
243
243
  }
244
- function et(e) {
244
+ function dt(e) {
245
245
  const t = e.offset;
246
246
  for (; !e.done && e.peek() !== "<"; ) e.advance();
247
- return new M(e.input.slice(t, e.offset));
247
+ return new B(e.input.slice(t, e.offset));
248
248
  }
249
- function tt(e) {
249
+ function ct(e) {
250
250
  e.expect("<?");
251
251
  const t = e.name(), n = e.until("?>", "processing instruction");
252
- return e.advance(2), new We(t, n);
252
+ return e.advance(2), new et(t, n);
253
253
  }
254
- function nt(e, t) {
255
- t >= te && e.fail(`Elements nested deeper than ${te}`), e.expect("<");
254
+ function mt(e, t) {
255
+ t >= se && e.fail(`Elements nested deeper than ${se}`), e.expect("<");
256
256
  const n = e.name(), r = [];
257
257
  for (; ; ) {
258
258
  const i = e.whitespace();
259
259
  if (e.startsWith("/>")) return e.advance(2), new f(n, { attributes: r, selfClosing: !0, trailing: i });
260
260
  if (e.peek() === ">") {
261
261
  e.advance();
262
- const s = Ue(e, n, t + 1);
262
+ const s = Ee(e, n, t + 1);
263
263
  e.expect("</");
264
264
  const o = e.name();
265
265
  o !== n && e.fail(`Expected </${n}> but found </${o}>`);
266
266
  const d = e.whitespace();
267
267
  return e.expect(">"), new f(n, { attributes: r, children: s, trailing: i, closingTrailing: d });
268
268
  }
269
- e.done && e.fail(`Unterminated tag <${n}>`), i.length === 0 && e.fail("Expected whitespace before an attribute"), r.push(rt(e, i, r));
269
+ e.done && e.fail(`Unterminated tag <${n}>`), i.length === 0 && e.fail("Expected whitespace before an attribute"), r.push(ut(e, i, r));
270
270
  }
271
271
  }
272
- function rt(e, t, n) {
272
+ function ut(e, t, n) {
273
273
  const r = e.name();
274
274
  n.some((m) => m.name === r) && e.fail(`Attribute "${r}" given twice`);
275
275
  const i = e.whitespace();
@@ -277,15 +277,15 @@ function rt(e, t, n) {
277
277
  const s = e.whitespace(), o = e.peek();
278
278
  o !== '"' && o !== "'" && e.fail("Expected a quoted attribute value"), e.advance();
279
279
  const d = e.until(o, "attribute value");
280
- return d.includes("<") && e.fail('"<" is not allowed in an attribute value'), e.advance(), new v(r, d, o, t, [i, s]);
280
+ return d.includes("<") && e.fail('"<" is not allowed in an attribute value'), e.advance(), new g(r, d, o, t, [i, s]);
281
281
  }
282
- function ne(e) {
283
- return e instanceof Se ? e.children.map(K).join("") : K(e);
282
+ function F(e) {
283
+ return e instanceof Be ? e.children.map(J).join("") : J(e);
284
284
  }
285
- function K(e) {
285
+ function J(e) {
286
286
  switch (e.type) {
287
287
  case "element":
288
- return it(e);
288
+ return lt(e);
289
289
  case "text":
290
290
  return e.raw;
291
291
  case "cdata":
@@ -296,34 +296,34 @@ function K(e) {
296
296
  return `<?${e.target}${e.content}?>`;
297
297
  }
298
298
  }
299
- function it(e) {
300
- const t = e.attributes.map(at).join(""), n = `<${e.name}${t}${e.trailing}`;
299
+ function lt(e) {
300
+ const t = e.attributes.map(pt).join(""), n = `<${e.name}${t}${e.trailing}`;
301
301
  if (e.selfClosing && e.children.length === 0) return `${n}/>`;
302
- const r = e.children.map(K).join("");
302
+ const r = e.children.map(J).join("");
303
303
  return `${n}>${r}</${e.name}${e.closingTrailing}>`;
304
304
  }
305
- function at(e) {
305
+ function pt(e) {
306
306
  const [t, n] = e.around, { leading: r, name: i, quote: s, raw: o } = e;
307
307
  return `${r}${i}${t}=${n}${s}${o}${s}`;
308
308
  }
309
- function st(e) {
310
- const t = De(e).root;
309
+ function ht(e) {
310
+ const t = Pe(e).root;
311
311
  if (!t || t.name !== "dataObj") throw new u("Expected a <dataObj> element", "DATA_OBJECT");
312
- return Be(t, {});
312
+ return je(t, {});
313
313
  }
314
- function Be(e, t) {
314
+ function je(e, t) {
315
315
  const n = t;
316
- for (const r of e.elements) if (r.name === "var") n[j(r, "n")] = ot(r);
316
+ for (const r of e.elements) if (r.name === "var") n[L(r, "n")] = gt(r);
317
317
  else if (r.name === "obj") {
318
- const i = j(r, "t");
318
+ const i = L(r, "t");
319
319
  if (i !== "a" && i !== "o") throw new u(`Unknown object kind "${i}"`, "DATA_OBJECT");
320
- n[j(r, "o")] = Be(r, i === "a" ? [] : {});
320
+ n[L(r, "o")] = je(r, i === "a" ? [] : {});
321
321
  }
322
322
  return t;
323
323
  }
324
- function ot(e) {
324
+ function gt(e) {
325
325
  const t = e.textContent;
326
- switch (j(e, "t")) {
326
+ switch (L(e, "t")) {
327
327
  case "s":
328
328
  return t;
329
329
  case "n":
@@ -336,18 +336,18 @@ function ot(e) {
336
336
  throw new u(`Unknown variable type "${e.attribute("t")}"`, "DATA_OBJECT");
337
337
  }
338
338
  }
339
- function j(e, t) {
339
+ function L(e, t) {
340
340
  const n = e.attribute(t);
341
341
  if (n === null) throw new u(`<${e.name}> is missing its "${t}" attribute`, "DATA_OBJECT");
342
342
  return n;
343
343
  }
344
- function dt(e) {
345
- return `<dataObj>${je(e)}</dataObj>`;
344
+ function ft(e) {
345
+ return `<dataObj>${Le(e)}</dataObj>`;
346
346
  }
347
- function je(e) {
348
- return Object.entries(e).map(([t, n]) => n === null ? `<var n='${t}' t='x'></var>` : typeof n == "object" ? `<obj t='${Array.isArray(n) ? "a" : "o"}' o='${t}'>${je(n)}</obj>` : typeof n == "boolean" ? `<var n='${t}' t='b'>${n ? 1 : 0}</var>` : typeof n == "number" ? `<var n='${t}' t='n'>${n}</var>` : `<var n='${t}' t='s'>${V(n)}</var>`).join("");
347
+ function Le(e) {
348
+ return Object.entries(e).map(([t, n]) => n === null ? `<var n='${t}' t='x'></var>` : typeof n == "object" ? `<obj t='${Array.isArray(n) ? "a" : "o"}' o='${t}'>${Le(n)}</obj>` : typeof n == "boolean" ? `<var n='${t}' t='b'>${n ? 1 : 0}</var>` : typeof n == "number" ? `<var n='${t}' t='n'>${n}</var>` : `<var n='${t}' t='s'>${H(n)}</var>`).join("");
349
349
  }
350
- class Le {
350
+ class Oe {
351
351
  constructor(t, n) {
352
352
  this.raw = t, this.direction = n;
353
353
  }
@@ -374,16 +374,16 @@ class Le {
374
374
  this.wasModified = !0;
375
375
  }
376
376
  }
377
- const re = "xt";
378
- class E extends Le {
377
+ const oe = "xt";
378
+ class _ extends Oe {
379
379
  format = "xml";
380
380
  document;
381
381
  constructor(t, n) {
382
- super(t, n), this.document = De(t);
382
+ super(t, n), this.document = Pe(t);
383
383
  }
384
- static create(t, n, r, i, s = []) {
385
- const o = new f("msg", { attributes: [v.create("t", n)], children: [new f("body", { attributes: [v.create("action", r), v.create("r", String(i))], children: [...s] })] });
386
- return new E(ne(o), t);
384
+ static create(t, n, r, i, s = [], o) {
385
+ const d = new f("msg", { attributes: [g.create("t", n), ...o === void 0 ? [] : [g.create("h", o)]], children: [new f("body", { attributes: [g.create("action", r), g.create("r", String(i))], children: [...s] })] });
386
+ return new _(F(d), t);
387
387
  }
388
388
  get element() {
389
389
  return this.document.root.name;
@@ -401,21 +401,33 @@ class E extends Le {
401
401
  return Number.isInteger(n) ? n : null;
402
402
  }
403
403
  get signed() {
404
+ return this.signature !== null;
405
+ }
406
+ get signature() {
404
407
  var t;
405
- return (((t = this.envelope) == null ? void 0 : t.attribute("h")) ?? null) !== null;
408
+ return ((t = this.envelope) == null ? void 0 : t.attribute("h")) ?? null;
409
+ }
410
+ get bodyContent() {
411
+ const t = this.body;
412
+ return t ? t.children.map((n) => F(n)).join("") : "";
413
+ }
414
+ sign(t) {
415
+ const n = this.envelope;
416
+ if (!n) throw new u("Only an envelope carries a signature", "PACKET_FORMAT");
417
+ n.setAttribute("h", t), this.markModified();
406
418
  }
407
419
  get body() {
408
420
  var t;
409
421
  return ((t = this.envelope) == null ? void 0 : t.child("body")) ?? null;
410
422
  }
411
423
  get data() {
412
- return this.type !== re || !this.body ? null : st(this.body.textContent);
424
+ return this.type !== oe || !this.body ? null : ht(this.body.textContent);
413
425
  }
414
426
  set data(t) {
415
- if (this.type !== re || !this.body) throw new u("Only an extension message carries an object", "PACKET_FORMAT");
427
+ if (this.type !== oe || !this.body) throw new u("Only an extension message carries an object", "PACKET_FORMAT");
416
428
  this.edit((n) => {
417
429
  const r = n.root.child("body");
418
- r.children = [new w(dt(t))];
430
+ r.children = [new S(ft(t))];
419
431
  });
420
432
  }
421
433
  edit(t) {
@@ -423,28 +435,28 @@ class E extends Le {
423
435
  t(this.document), this.markModified();
424
436
  }
425
437
  serialize() {
426
- return ne(this.document);
438
+ return F(this.document);
427
439
  }
428
440
  get envelope() {
429
441
  const t = this.document.root;
430
442
  return (t == null ? void 0 : t.name) === "msg" ? t : null;
431
443
  }
432
444
  }
433
- const b = "%", _ = "xt";
434
- class P extends Le {
445
+ const C = "%", X = "xt";
446
+ class $ extends Oe {
435
447
  format = "xt";
436
448
  fields;
437
449
  constructor(t, n) {
438
- super(t, n), this.fields = ct(t, n);
450
+ super(t, n), this.fields = vt(t, n);
439
451
  }
440
452
  static create(t, n, r, i = [], s = "o") {
441
- return new P(ie(t, { extension: s, command: n, room: String(r), args: i.map(String) }), t);
453
+ return new $(de(t, { extension: s, command: n, room: String(r), args: i.map(String) }), t);
442
454
  }
443
455
  get command() {
444
456
  return this.fields.command;
445
457
  }
446
458
  set command(t) {
447
- L(t), this.fields.command = t, this.markModified();
459
+ O(t), this.fields.command = t, this.markModified();
448
460
  }
449
461
  get extension() {
450
462
  return this.fields.extension;
@@ -468,32 +480,32 @@ class P extends Le {
468
480
  setArg(t, n) {
469
481
  if (!Number.isInteger(t) || t < 0 || t > this.fields.args.length) throw new RangeError(`Argument ${t} is outside a message of ${this.length} arguments`);
470
482
  const r = String(n);
471
- L(r), this.fields.args[t] = r, this.markModified();
483
+ O(r), this.fields.args[t] = r, this.markModified();
472
484
  }
473
485
  setArgs(t) {
474
486
  const n = t.map(String);
475
- n.forEach(L), this.fields.args = n, this.markModified();
487
+ n.forEach(O), this.fields.args = n, this.markModified();
476
488
  }
477
489
  serialize() {
478
- return ie(this.direction, this.fields);
490
+ return de(this.direction, this.fields);
479
491
  }
480
492
  }
481
- function ct(e, t) {
482
- if (e.length < 2 || !e.startsWith(b) || !e.endsWith(b)) throw new u('An extension message starts and ends with "%"', "XT_SYNTAX");
483
- const n = e.slice(1, -1).split(b);
484
- if (n[0] !== _) throw new u(`Expected the "xt" handler, found "${n[0]}"`, "XT_SYNTAX", 1);
493
+ function vt(e, t) {
494
+ if (e.length < 2 || !e.startsWith(C) || !e.endsWith(C)) throw new u('An extension message starts and ends with "%"', "XT_SYNTAX");
495
+ const n = e.slice(1, -1).split(C);
496
+ if (n[0] !== X) throw new u(`Expected the "xt" handler, found "${n[0]}"`, "XT_SYNTAX", 1);
485
497
  const r = t === "toServer" ? 4 : 3;
486
498
  if (n.length < r) throw new u(`A message to the ${t === "toServer" ? "server" : "client"} has at least ${r} fields`, "XT_SYNTAX");
487
499
  return t === "toServer" ? { extension: n[1], command: n[2], room: n[3], args: n.slice(4) } : { extension: null, command: n[1], room: n[2], args: n.slice(3) };
488
500
  }
489
- function ie(e, t) {
490
- const n = [...e === "toServer" ? [_, t.extension ?? "o", t.command, t.room] : [_, t.command, t.room], ...t.args];
491
- return n.forEach(L), b + n.map((r) => r + b).join("");
501
+ function de(e, t) {
502
+ const n = [...e === "toServer" ? [X, t.extension ?? "o", t.command, t.room] : [X, t.command, t.room], ...t.args];
503
+ return n.forEach(O), C + n.map((r) => r + C).join("");
492
504
  }
493
- function L(e) {
494
- if (e.includes(b)) throw new u(`An extension message value cannot contain "${b}": ${e}`, "XT_VALUE");
505
+ function O(e) {
506
+ if (e.includes(C)) throw new u(`An extension message value cannot contain "${C}": ${e}`, "XT_VALUE");
495
507
  }
496
- class k {
508
+ class A {
497
509
  constructor(t, n) {
498
510
  this.values = t, this.packet = n;
499
511
  }
@@ -535,7 +547,7 @@ class k {
535
547
  throw new u(`${this.packet}: field "${t}" (${n}) ${r}${s}`, "PACKET_FIELD");
536
548
  }
537
549
  }
538
- class mt {
550
+ class It {
539
551
  written = [];
540
552
  string(t) {
541
553
  return this.written.push(t), this;
@@ -562,49 +574,49 @@ class mt {
562
574
  }
563
575
  }
564
576
  function a(e) {
565
- const { name: t, description: n, direction: r, command: i, extension: s = "o", read: o, write: d } = e, m = (c) => c instanceof P && c.direction === r && c.command === i && (r === "toClient" || c.extension === s);
577
+ const { name: t, description: n, direction: r, command: i, extension: s = "o", read: o, write: d } = e, m = (c) => c instanceof $ && c.direction === r && c.command === i && (r === "toClient" || c.extension === s);
566
578
  return { name: t, description: n, format: "xt", direction: r, command: i, matches: m, decode(c) {
567
- return Ee(m(c), t, c), { ...o(new k(c.args, t)), room: c.room ?? -1 };
579
+ return _e(m(c), t, c), { ...o(new A(c.args, t)), room: c.room ?? -1 };
568
580
  }, encode(c) {
569
- const l = new mt();
570
- return d(l, c), P.create(r, i, c.room, l.values, s);
581
+ const p = new It();
582
+ return d(p, c), $.create(r, i, c.room, p.values, s);
571
583
  } };
572
584
  }
573
- function q(e) {
574
- const { name: t, description: n, direction: r, command: i, type: s, read: o, write: d } = e, m = (c) => c instanceof E && c.direction === r && c.type === s && c.command === i;
585
+ function k(e) {
586
+ const { name: t, description: n, direction: r, command: i, type: s, read: o, write: d } = e, m = (c) => c instanceof _ && c.direction === r && c.type === s && c.command === i;
575
587
  return { name: t, description: n, format: "xml", direction: r, command: i, matches: m, decode(c) {
576
- return Ee(m(c), t, c), { ...o(c), room: c.room ?? -1 };
588
+ return _e(m(c), t, c), { ...o(c), room: c.room ?? -1 };
577
589
  }, encode(c) {
578
- return E.create(r, s, i, c.room, d(c));
590
+ return _.create(r, s, i, c.room, d(c));
579
591
  } };
580
592
  }
581
- function Ee(e, t, n) {
593
+ function _e(e, t, n) {
582
594
  if (!e) throw new TypeError(`A ${n.format} "${n.command}" message ${n.direction} is not ${t}`);
583
595
  }
584
- function ae(e) {
596
+ function ce(e) {
585
597
  return { invId: e.int("invId"), defId: e.int("defId") };
586
598
  }
587
- function se(e, t) {
599
+ function me(e, t) {
588
600
  e.int(t.length).each(t, ({ invId: n, defId: r }) => e.int(n).int(r));
589
601
  }
590
602
  a({ name: "achievement.list-request", description: "The client asks for a player’s achievements.", direction: "toServer", command: "za", read: (e) => ({ userName: e.string("userName"), secondsSinceLastAsked: e.int("secondsSinceLastAsked") }), write: (e, { userName: t, secondsSinceLastAsked: n }) => e.string(t).int(n) }), a({ name: "achievement.set-user-var", description: "The client sets one of the player’s user variables.", direction: "toServer", command: "zs", read: (e) => ({ userVarId: e.int("userVarId"), value: e.int("value"), notify: e.flag("notify") }), write: (e, { userVarId: t, value: n, notify: r }) => e.int(t).int(n).int(r ? 1 : 0) }), a({ name: "achievement.user-vars-request", description: "The client asks for all of the player’s user variables.", direction: "toServer", command: "zg", read: () => ({}), write: () => {
591
603
  } }), a({ name: "achievement.list", description: "The server gives a player’s achievements.", direction: "toClient", command: "za", read: (e) => {
592
604
  const t = e.string("userName"), n = e.int("count");
593
- return { userName: t, archived: n === -1, achievements: e.repeat(Math.max(n, 0), () => ae(e)) };
605
+ return { userName: t, archived: n === -1, achievements: e.repeat(Math.max(n, 0), () => ce(e)) };
594
606
  }, write: (e, { userName: t, archived: n, achievements: r }) => {
595
- e.string(t), n ? e.int(-1) : se(e, r);
596
- } }), a({ name: "achievement.user-var-changed", description: "One of the player’s user variables changed, and any achievements it earned.", direction: "toClient", command: "zs", read: (e) => ({ userVarId: e.int("userVarId"), value: e.number("value"), achievements: e.repeat(e.int("count"), () => ae(e)) }), write: (e, { userVarId: t, value: n, achievements: r }) => {
597
- e.int(t).number(n), se(e, r);
607
+ e.string(t), n ? e.int(-1) : me(e, r);
608
+ } }), a({ name: "achievement.user-var-changed", description: "One of the player’s user variables changed, and any achievements it earned.", direction: "toClient", command: "zs", read: (e) => ({ userVarId: e.int("userVarId"), value: e.number("value"), achievements: e.repeat(e.int("count"), () => ce(e)) }), write: (e, { userVarId: t, value: n, achievements: r }) => {
609
+ e.int(t).number(n), me(e, r);
598
610
  } }), a({ name: "achievement.user-vars", description: "The server gives all of the player’s user variables.", direction: "toClient", command: "zg", read: (e) => ({ userVars: e.repeat(e.int("count"), () => ({ userVarId: e.int("userVarId"), type: e.int("type"), value: e.number("value") })) }), write: (e, { userVars: t }) => e.int(t.length).each(t, ({ userVarId: n, type: r, value: i }) => e.int(n).int(r).number(i)) }), a({ name: "adopt-a-pet.data-request", description: "The client asks for another player’s Adopt a Pet cards.", direction: "toServer", command: "pad", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "adopt-a-pet.data", description: "The server lists a player’s Adopt a Pet cards.", direction: "toClient", command: "pad", read: (e) => {
599
611
  const t = e.flag("success");
600
612
  return t ? { success: t, cards: e.repeat(e.int("count"), () => ({ defId: e.int("defId"), invId: e.int("invId") })) } : { success: t, cards: [] };
601
613
  }, write: (e, { success: t, cards: n }) => {
602
614
  e.flag(t), t && e.int(n.length).each(n, (r) => e.int(r.defId).int(r.invId));
603
615
  } }), a({ name: "adopt-a-pet.count-request", description: "The client asks how many Adopt a Pet cards another player has.", direction: "toServer", command: "padc", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "adopt-a-pet.count", description: "The server says how many Adopt a Pet cards a player has.", direction: "toClient", command: "padc", read: (e) => ({ count: e.int("count") }), write: (e, { count: t }) => e.int(t) }), a({ name: "adopt-a-pet.seen-request", description: "The player marks Adopt a Pet cards as seen.", direction: "toServer", command: "pads", read: (e) => ({ defIds: e.repeat(e.remaining, () => e.int("defId")) }), write: (e, { defIds: t }) => e.each(t, (n) => e.int(n)) });
604
- function Pe(e) {
616
+ function $e(e) {
605
617
  return { lBits: e.int("lBits"), uBits: e.int("uBits"), eBits: e.int("eBits"), name: e.string("petName"), createdTs: e.number("createdTs"), personalityDefId: e.int("personalityDefId"), favoriteFoodDefId: e.int("favoriteFoodDefId"), favoriteToyDefId: e.int("favoriteToyDefId") };
606
618
  }
607
- function Me(e, t) {
619
+ function Re(e, t) {
608
620
  e.int(t.lBits).int(t.uBits).int(t.eBits).string(t.name).number(t.createdTs).int(t.personalityDefId).int(t.favoriteFoodDefId).int(t.favoriteToyDefId);
609
621
  }
610
622
  a({ name: "pet.list-request", description: "The client asks for a player’s pets.", direction: "toServer", command: "pl", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "pet.list", description: "The server lists a player’s pets.", direction: "toClient", command: "pl", read: (e) => {
@@ -618,9 +630,9 @@ a({ name: "pet.list-request", description: "The client asks for a player’s pet
618
630
  const t = e.string("success") === "1";
619
631
  if (!t) return { success: t, userId: -1, activePetInvId: null, pet: null };
620
632
  const n = e.int("userId");
621
- return e.remaining === 1 ? { success: t, userId: n, activePetInvId: e.int("activePetInvId"), pet: null } : { success: t, userId: n, activePetInvId: null, pet: Pe(e) };
633
+ return e.remaining === 1 ? { success: t, userId: n, activePetInvId: e.int("activePetInvId"), pet: null } : { success: t, userId: n, activePetInvId: null, pet: $e(e) };
622
634
  }, write: (e, { success: t, userId: n, activePetInvId: r, pet: i }) => {
623
- if (e.string(t ? "1" : "0"), !!t) if (e.int(n), i) Me(e, i);
635
+ if (e.string(t ? "1" : "0"), !!t) if (e.int(n), i) Re(e, i);
624
636
  else if (r !== null) e.int(r);
625
637
  else throw new u("pet.switched: a success names a pet or an inventory id", "PACKET_FIELD");
626
638
  } }), a({ name: "pet.mastery-display-request", description: "The player shows or hides a pet’s mastery badge.", direction: "toServer", command: "pm", read: (e) => ({ show: e.flag("show"), invId: e.int("invId") }), write: (e, { show: t, invId: n }) => e.flag(t).int(n) }), a({ name: "pet.mastery-displayed", description: "The server says whether a pet’s mastery badge changed.", direction: "toClient", command: "pm", read: (e) => {
@@ -631,8 +643,8 @@ a({ name: "pet.list-request", description: "The client asks for a player’s pet
631
643
  } }), a({ name: "pet.egg-name-request", description: "The player names a newly hatched egg pet from two lists of predefined name parts.", direction: "toServer", command: "pn", read: (e) => ({ invId: e.int("invId"), firstNameLocId: e.int("firstNameLocId"), secondNameLocId: e.int("secondNameLocId") }), write: (e, { invId: t, firstNameLocId: n, secondNameLocId: r }) => e.int(t).int(n).int(r) }), a({ name: "pet.egg-named", description: "The server says whether an egg pet was named.", direction: "toClient", command: "pn", read: (e) => ({ success: e.flag("success"), invId: e.int("invId"), name: e.string("name") }), write: (e, { success: t, invId: n, name: r }) => e.flag(t).int(n).string(r) }), a({ name: "pet.create-request", description: "The player adopts a new pet.", direction: "toServer", command: "pc", read: (e) => ({ shopId: e.int("shopId"), lBits: e.int("lBits"), uBits: e.int("uBits"), eBits: e.int("eBits"), firstNameLocId: e.int("firstNameLocId"), secondNameLocId: e.int("secondNameLocId"), fromRedemption: e.flag("fromRedemption") }), write: (e, t) => e.int(t.shopId).int(t.lBits).int(t.uBits).int(t.eBits).int(t.firstNameLocId).int(t.secondNameLocId).flag(t.fromRedemption) }), a({ name: "pet.created", description: "The server says whether a new pet was adopted.", direction: "toClient", command: "pc", read: (e) => {
632
644
  const t = e.flag("success");
633
645
  if (!t) return { success: t, balance: 0, currencyType: 0, pet: null };
634
- const n = e.int("balance"), r = e.int("currencyType"), i = e.int("invId"), s = e.int("lBits"), o = e.int("uBits"), d = e.int("eBits"), m = e.string("name"), c = e.number("createdTs"), l = e.int("personalityDefId"), g = e.int("favoriteToyDefId"), h = e.int("favoriteFoodDefId"), $ = e.flag("broughtOut");
635
- return { success: t, balance: n, currencyType: r, pet: { invId: i, lBits: s, uBits: o, eBits: d, name: m, createdTs: c, personalityDefId: l, favoriteToyDefId: g, favoriteFoodDefId: h, broughtOut: $ } };
646
+ const n = e.int("balance"), r = e.int("currencyType"), i = e.int("invId"), s = e.int("lBits"), o = e.int("uBits"), d = e.int("eBits"), m = e.string("name"), c = e.number("createdTs"), p = e.int("personalityDefId"), w = e.int("favoriteToyDefId"), I = e.int("favoriteFoodDefId"), R = e.flag("broughtOut");
647
+ return { success: t, balance: n, currencyType: r, pet: { invId: i, lBits: s, uBits: o, eBits: d, name: m, createdTs: c, personalityDefId: p, favoriteToyDefId: w, favoriteFoodDefId: I, broughtOut: R } };
636
648
  }, write: (e, t) => {
637
649
  e.flag(t.success), !(!t.success || !t.pet) && e.int(t.balance).int(t.currencyType).int(t.pet.invId).int(t.pet.lBits).int(t.pet.uBits).int(t.pet.eBits).string(t.pet.name).number(t.pet.createdTs).int(t.pet.personalityDefId).int(t.pet.favoriteToyDefId).int(t.pet.favoriteFoodDefId).flag(t.pet.broughtOut);
638
650
  } }), a({ name: "pet.dismiss-request", description: "The player frees one of their pets.", direction: "toServer", command: "pd", read: (e) => ({ invId: e.int("invId") }), write: (e, { invId: t }) => e.int(t) }), a({ name: "pet.dismissed", description: "The server says whether a pet was freed.", direction: "toClient", command: "pd", read: (e) => ({ success: e.string("success") === "1", invId: e.int("invId") }), write: (e, { success: t, invId: n }) => e.string(t ? "1" : "0").int(n) }), a({ name: "pet.shop-buy-request", description: "The player buys a pet they have not unlocked from a shop.", direction: "toServer", command: "pb", read: (e) => ({ shopId: e.int("shopId"), itemDefId: e.int("itemDefId"), lBits: e.int("lBits"), uBits: e.int("uBits"), eBits: e.int("eBits"), firstNameLocId: e.int("firstNameLocId"), secondNameLocId: e.int("secondNameLocId"), fromRedemption: e.flag("fromRedemption") }), write: (e, t) => e.int(t.shopId).int(t.itemDefId).int(t.lBits).int(t.uBits).int(t.eBits).int(t.firstNameLocId).int(t.secondNameLocId).flag(t.fromRedemption) }), a({ name: "pet.items-request", description: "The player changes what their pet that is out is wearing.", direction: "toServer", command: "pi", read: (e) => ({ cat9: e.int("cat9"), cat10: e.int("cat10"), cat11: e.int("cat11"), enviroType: e.int("enviroType") }), write: (e, { cat9: t, cat10: n, cat11: r, enviroType: i }) => e.int(t).int(n).int(r).int(i) }), a({ name: "pet.items-changed", description: "The server says whether the pet that is out now wears something new.", direction: "toClient", command: "pi", read: (e) => {
@@ -647,23 +659,23 @@ a({ name: "pet.list-request", description: "The client asks for a player’s pet
647
659
  const t = e.int("userId"), n = e.int("count"), r = e.repeat(n, () => ({ x: e.int("x"), y: e.int("y") }));
648
660
  return { userId: t, path: r, teleport: e.flag("teleport") };
649
661
  }) }), write: (e, { avatars: t }) => e.int(t.length).each(t, ({ userId: n, path: r, teleport: i }) => e.int(n).int(r.length).each(r, ({ x: s, y: o }) => e.int(s).int(o)).flag(i)) }), a({ name: "avatar.paint", description: "The player changes their avatar’s colours.", direction: "toServer", command: "ap", read: (e) => ({ colors: [e.int("color1"), e.int("color2"), e.int("color3")], avatarId: e.int("avatarId") }), write: (e, { colors: t, avatarId: n }) => e.int(t[0]).int(t[1]).int(t[2]).int(n) });
650
- function A(e) {
662
+ function M(e) {
651
663
  return [e.int("color1"), e.int("color2"), e.int("color3")];
652
664
  }
653
- function D(e, t) {
665
+ function P(e, t) {
654
666
  e.int(t[0]).int(t[1]).int(t[2]);
655
667
  }
656
- function oe(e) {
668
+ function ue(e) {
657
669
  return e !== void 0 && e.trim() !== "" && Number.isInteger(Number(e));
658
670
  }
659
671
  a({ name: "avatar.paint-result", description: "The server says whether the player’s colours changed.", direction: "toClient", command: "ap", read: (e) => ({ success: e.string("success") === "1", extra: e.rest() }), write: (e, { success: t, extra: n }) => e.string(t ? "1" : "0").raw(n) }), a({ name: "avatar.switch-request", description: "The player switches to another of their avatars.", direction: "toServer", command: "as", read: (e) => ({ perUserAvId: e.int("perUserAvId") }), write: (e, { perUserAvId: t }) => e.int(t) }), a({ name: "avatar.switched", description: "Someone in the room switched avatars.", direction: "toClient", command: "as", read: (e) => {
660
672
  if (!e.flag("success")) return { success: !1, extra: e.rest() };
661
- const t = e.int("userId"), n = { perUserAvId: e.int("perUserAvId"), avInvId: e.int("avInvId"), customAvId: e.int("customAvId"), avTypeId: e.int("avTypeId"), colors: A(e), avName: e.string("avName") };
673
+ const t = e.int("userId"), n = { perUserAvId: e.int("perUserAvId"), avInvId: e.int("avInvId"), customAvId: e.int("customAvId"), avTypeId: e.int("avTypeId"), colors: M(e), avName: e.string("avName") };
662
674
  if (e.remaining === 2) {
663
675
  const i = { activePetInvId: e.int("activePetInvId"), questLevel: e.int("questLevel") };
664
676
  return { success: !0, userId: t, avatar: n, player: i, other: null };
665
677
  }
666
- const r = { pet: Pe(e), questLevel: e.int("questLevel") };
678
+ const r = { pet: $e(e), questLevel: e.int("questLevel") };
667
679
  return { success: !0, userId: t, avatar: n, player: null, other: r };
668
680
  }, write: (e, t) => {
669
681
  if (!t.success) {
@@ -671,12 +683,12 @@ a({ name: "avatar.paint-result", description: "The server says whether the playe
671
683
  return;
672
684
  }
673
685
  const { userId: n, avatar: r, player: i, other: s } = t;
674
- if (e.flag(!0).int(n).int(r.perUserAvId).int(r.avInvId).int(r.customAvId).int(r.avTypeId), D(e, r.colors), e.string(r.avName), i) e.int(i.activePetInvId).int(i.questLevel);
675
- else if (s) Me(e, s.pet), e.int(s.questLevel);
686
+ if (e.flag(!0).int(n).int(r.perUserAvId).int(r.avInvId).int(r.customAvId).int(r.avTypeId), P(e, r.colors), e.string(r.avName), i) e.int(i.activePetInvId).int(i.questLevel);
687
+ else if (s) Re(e, s.pet), e.int(s.questLevel);
676
688
  else throw new u("avatar.switched: a success has a player or an other part", "PACKET_FIELD");
677
689
  } }), a({ name: "avatar.list-request", description: "The client asks for a player’s avatars.", direction: "toServer", command: "al", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "avatar.list", description: "The server lists a player’s avatars.", direction: "toClient", command: "al", read: (e) => {
678
- const t = e.rest(), n = new k(t, "avatar.list"), r = n.string("userName"), i = Number(t[1]);
679
- if (oe(t[1]) && t.length === 2 + i && t.slice(2).every((m) => oe(m))) {
690
+ const t = e.rest(), n = new A(t, "avatar.list"), r = n.string("userName"), i = Number(t[1]);
691
+ if (ue(t[1]) && t.length === 2 + i && t.slice(2).every((m) => ue(m))) {
680
692
  const m = n.int("count");
681
693
  return { own: !1, userName: r, perUserAvIds: n.repeat(m, () => n.int("perUserAvId")) };
682
694
  }
@@ -689,7 +701,7 @@ a({ name: "avatar.paint-result", description: "The server says whether the playe
689
701
  }
690
702
  e.int(t.slotFlags >>> 0).string(t.uuid).int(t.avatars.length).each(t.avatars, (n) => e.int(n.perUserAvId).int(n.avInvId).string(n.avName).int(n.avTypeId).int(n.customAvId));
691
703
  } }), a({ name: "avatar.data-request", description: "The client asks for one of a player’s avatars.", direction: "toServer", command: "ad", read: (e) => ({ userName: e.string("userName"), perUserAvId: e.int("perUserAvId"), items: e.int("items") }), write: (e, { userName: t, perUserAvId: n, items: r }) => e.string(t).int(n).int(r) }), a({ name: "avatar.data", description: "The server describes one of a player’s avatars.", direction: "toClient", command: "ad", read: (e) => {
692
- const t = { userName: e.string("userName"), uuid: e.string("uuid"), nameBarData: e.int("nameBarData"), enviroType: e.int("enviroType"), userNameModeratedFlag: e.int("userNameModeratedFlag"), timeLeftHostingCustomParty: e.int("timeLeftHostingCustomParty"), daysSinceLastLogin: e.int("daysSinceLastLogin"), perUserAvId: e.int("perUserAvId"), avTypeId: e.int("avTypeId"), customAvId: e.int("customAvId"), colors: A(e), avName: e.string("avName"), questLevel: e.int("questLevel") };
704
+ const t = { userName: e.string("userName"), uuid: e.string("uuid"), nameBarData: e.int("nameBarData"), enviroType: e.int("enviroType"), userNameModeratedFlag: e.int("userNameModeratedFlag"), timeLeftHostingCustomParty: e.int("timeLeftHostingCustomParty"), daysSinceLastLogin: e.int("daysSinceLastLogin"), perUserAvId: e.int("perUserAvId"), avTypeId: e.int("avTypeId"), customAvId: e.int("customAvId"), colors: M(e), avName: e.string("avName"), questLevel: e.int("questLevel") };
693
705
  if (e.remaining === 8) {
694
706
  const r = { avInvId: e.int("avInvId"), landPetInvId: e.int("landPetInvId"), oceanPetInvId: e.int("oceanPetInvId"), attackBase: e.int("attackBase"), attackMax: e.int("attackMax"), defenseBase: e.int("defenseBase"), defenseMax: e.int("defenseMax"), healthBase: e.int("healthBase") };
695
707
  return { ...t, player: r, other: null };
@@ -697,7 +709,7 @@ a({ name: "avatar.paint-result", description: "The server says whether the playe
697
709
  const n = { lBits: e.int("lBits"), uBits: e.int("uBits"), eBits: e.int("eBits"), petName: e.string("petName") };
698
710
  return { ...t, player: null, other: n };
699
711
  }, write: (e, t) => {
700
- e.string(t.userName).string(t.uuid).int(t.nameBarData).int(t.enviroType).int(t.userNameModeratedFlag).int(t.timeLeftHostingCustomParty).int(t.daysSinceLastLogin).int(t.perUserAvId).int(t.avTypeId).int(t.customAvId), D(e, t.colors), e.string(t.avName).int(t.questLevel);
712
+ e.string(t.userName).string(t.uuid).int(t.nameBarData).int(t.enviroType).int(t.userNameModeratedFlag).int(t.timeLeftHostingCustomParty).int(t.daysSinceLastLogin).int(t.perUserAvId).int(t.avTypeId).int(t.customAvId), P(e, t.colors), e.string(t.avName).int(t.questLevel);
701
713
  const { player: n, other: r } = t;
702
714
  if (n) e.int(n.avInvId).int(n.landPetInvId).int(n.oceanPetInvId).int(n.attackBase).int(n.attackMax).int(n.defenseBase).int(n.defenseMax).int(n.healthBase);
703
715
  else if (r) e.int(r.lBits).int(r.uBits).int(r.eBits).string(r.petName);
@@ -705,12 +717,12 @@ a({ name: "avatar.paint-result", description: "The server says whether the playe
705
717
  } }), a({ name: "avatar.lookup-request", description: "The client looks a player up by name.", direction: "toServer", command: "ag", read: (e) => ({ userName: e.string("userName"), userLookup: e.flag("userLookup") }), write: (e, { userName: t, userLookup: n }) => e.string(t).flag(n) }), a({ name: "avatar.lookup", description: "The server describes a player looked up by name.", direction: "toClient", command: "ag", read: (e) => {
706
718
  const t = e.string("userName"), n = e.string("uuid"), r = e.int("status");
707
719
  if (r !== 0 && r !== 1) return { userName: t, uuid: n, status: r, avatar: null };
708
- const i = { accountType: e.int("accountType"), isGuide: e.string("isGuide") === "1", daysSinceLastLogin: e.int("daysSinceLastLogin"), perUserAvId: e.int("perUserAvId"), avInvId: e.int("avInvId"), nameBarData: e.int("nameBarData"), avTypeId: e.int("avTypeId"), customAvId: e.int("customAvId"), colors: A(e), avName: e.string("avName"), eyesDefId: e.int("eyesDefId"), patternDefId: e.int("patternDefId"), questLevel: e.int("questLevel") }, s = e.int("count"), o = { userId: e.int("userId"), userNameModeratedFlag: e.int("userNameModeratedFlag"), pet: { lBits: e.int("lBits"), uBits: e.int("uBits"), eBits: e.int("eBits"), name: e.string("petName") }, items: e.repeat(s, () => ({ defId: e.int("defId"), color: e.int("color") })) };
720
+ const i = { accountType: e.int("accountType"), isGuide: e.string("isGuide") === "1", daysSinceLastLogin: e.int("daysSinceLastLogin"), perUserAvId: e.int("perUserAvId"), avInvId: e.int("avInvId"), nameBarData: e.int("nameBarData"), avTypeId: e.int("avTypeId"), customAvId: e.int("customAvId"), colors: M(e), avName: e.string("avName"), eyesDefId: e.int("eyesDefId"), patternDefId: e.int("patternDefId"), questLevel: e.int("questLevel") }, s = e.int("count"), o = { userId: e.int("userId"), userNameModeratedFlag: e.int("userNameModeratedFlag"), pet: { lBits: e.int("lBits"), uBits: e.int("uBits"), eBits: e.int("eBits"), name: e.string("petName") }, items: e.repeat(s, () => ({ defId: e.int("defId"), color: e.int("color") })) };
709
721
  return { userName: t, uuid: n, status: r, avatar: { ...i, ...o } };
710
722
  }, write: (e, { userName: t, uuid: n, status: r, avatar: i }) => {
711
- e.string(t).string(n).int(r), i && (e.int(i.accountType).string(i.isGuide ? "1" : "0").int(i.daysSinceLastLogin).int(i.perUserAvId).int(i.avInvId).int(i.nameBarData).int(i.avTypeId).int(i.customAvId), D(e, i.colors), e.string(i.avName).int(i.eyesDefId).int(i.patternDefId).int(i.questLevel).int(i.items.length).int(i.userId).int(i.userNameModeratedFlag).int(i.pet.lBits).int(i.pet.uBits).int(i.pet.eBits).string(i.pet.name).each(i.items, ({ defId: s, color: o }) => e.int(s).int(o)));
712
- } }), a({ name: "avatar.joined", description: "An avatar appears in the room.", direction: "toClient", command: "ac", read: (e) => ({ userId: e.int("userId"), x: e.int("x"), y: e.int("y"), animation: e.int("animation") >>> 0, userName: e.string("userName"), uuid: e.string("uuid"), perUserAvId: e.int("perUserAvId"), avName: e.string("avName"), avTypeId: e.int("avTypeId"), customAvId: e.int("customAvId"), colors: A(e), questLevel: e.int("questLevel"), details: e.rest() }), write: (e, t) => {
713
- e.int(t.userId).int(t.x).int(t.y).int(t.animation >>> 0).string(t.userName).string(t.uuid).int(t.perUserAvId).string(t.avName).int(t.avTypeId).int(t.customAvId), D(e, t.colors), e.int(t.questLevel).raw(t.details);
723
+ e.string(t).string(n).int(r), i && (e.int(i.accountType).string(i.isGuide ? "1" : "0").int(i.daysSinceLastLogin).int(i.perUserAvId).int(i.avInvId).int(i.nameBarData).int(i.avTypeId).int(i.customAvId), P(e, i.colors), e.string(i.avName).int(i.eyesDefId).int(i.patternDefId).int(i.questLevel).int(i.items.length).int(i.userId).int(i.userNameModeratedFlag).int(i.pet.lBits).int(i.pet.uBits).int(i.pet.eBits).string(i.pet.name).each(i.items, ({ defId: s, color: o }) => e.int(s).int(o)));
724
+ } }), a({ name: "avatar.joined", description: "An avatar appears in the room.", direction: "toClient", command: "ac", read: (e) => ({ userId: e.int("userId"), x: e.int("x"), y: e.int("y"), animation: e.int("animation") >>> 0, userName: e.string("userName"), uuid: e.string("uuid"), perUserAvId: e.int("perUserAvId"), avName: e.string("avName"), avTypeId: e.int("avTypeId"), customAvId: e.int("customAvId"), colors: M(e), questLevel: e.int("questLevel"), details: e.rest() }), write: (e, t) => {
725
+ e.int(t.userId).int(t.x).int(t.y).int(t.animation >>> 0).string(t.userName).string(t.uuid).int(t.perUserAvId).string(t.avName).int(t.avTypeId).int(t.customAvId), P(e, t.colors), e.int(t.questLevel).raw(t.details);
714
726
  } }), a({ name: "avatar.kill-request", description: "The player deletes one of their avatars for good.", direction: "toServer", command: "ak", read: (e) => ({ perUserAvId: e.int("perUserAvId") }), write: (e, { perUserAvId: t }) => e.int(t) }), a({ name: "avatar.killed", description: "The server says whether an avatar was deleted for good.", direction: "toClient", command: "ak", read: (e) => ({ success: e.flag("success"), extra: e.int("extra") }), write: (e, { success: t, extra: n }) => e.flag(t).int(n) }), a({ name: "avatar.left", description: "An avatar leaves the room.", direction: "toClient", command: "ar", read: (e) => {
715
727
  const t = e.int("userId");
716
728
  if (e.remaining === 0) return { userId: t, walkOut: 0, walkTo: null, extra: [] };
@@ -719,17 +731,17 @@ a({ name: "avatar.paint-result", description: "The server says whether the playe
719
731
  }, write: (e, { userId: t, walkOut: n, walkTo: r, extra: i }) => {
720
732
  e.int(t), !(n === 0 && !r && i.length === 0) && (e.int(n), n > 0 && r && e.int(r.x).int(r.y), e.raw(i));
721
733
  } });
722
- function de(e) {
734
+ function le(e) {
723
735
  return [e.int("nameId1"), e.int("nameId2"), e.int("nameId3")];
724
736
  }
725
- function ce(e, t) {
737
+ function pe(e, t) {
726
738
  e.int(t[0]).int(t[1]).int(t[2]);
727
739
  }
728
- a({ name: "avatar.add-request", description: "The player adds a new animal to their account.", direction: "toServer", command: "aa", read: (e) => ({ nameIds: de(e), avTypeId: e.int("avTypeId"), customAvId: e.int("customAvId"), diamondDefId: e.int("diamondDefId"), shopId: e.int("shopId") }), write: (e, { nameIds: t, avTypeId: n, customAvId: r, diamondDefId: i, shopId: s }) => {
729
- ce(e, t), e.int(n).int(r).int(i).int(s);
740
+ a({ name: "avatar.add-request", description: "The player adds a new animal to their account.", direction: "toServer", command: "aa", read: (e) => ({ nameIds: le(e), avTypeId: e.int("avTypeId"), customAvId: e.int("customAvId"), diamondDefId: e.int("diamondDefId"), shopId: e.int("shopId") }), write: (e, { nameIds: t, avTypeId: n, customAvId: r, diamondDefId: i, shopId: s }) => {
741
+ pe(e, t), e.int(n).int(r).int(i).int(s);
730
742
  } }), a({ name: "avatar.added", description: "The server says whether a new animal was added to the account.", direction: "toClient", command: "aa", read: (e) => ({ status: e.int("status"), perUserAvId: e.int("perUserAvId"), avInvId: e.int("avInvId") }), write: (e, { status: t, perUserAvId: n, avInvId: r }) => e.int(t).int(n).int(r) }), a({ name: "avatar.slot-buy-request", description: "The player buys another avatar slot.", direction: "toServer", command: "ab", read: () => ({}), write: () => {
731
- } }), a({ name: "avatar.slot-bought", description: "The server says whether another avatar slot was bought.", direction: "toClient", command: "ab", read: (e) => ({ success: e.flag("success") }), write: (e, { success: t }) => e.flag(t) }), a({ name: "avatar.pending-flag", description: "The client sets one of the account’s pending flags.", direction: "toServer", command: "af", read: (e) => ({ flag: e.int("flag") }), write: (e, { flag: t }) => e.int(t) }), a({ name: "avatar.fast-pass-add-request", description: "The player adds the first animal to an account made without one.", direction: "toServer", command: "afp", read: (e) => ({ avTypeId: e.int("avTypeId"), nameIds: de(e) }), write: (e, { avTypeId: t, nameIds: n }) => {
732
- e.int(t), ce(e, n);
743
+ } }), a({ name: "avatar.slot-bought", description: "The server says whether another avatar slot was bought.", direction: "toClient", command: "ab", read: (e) => ({ success: e.flag("success") }), write: (e, { success: t }) => e.flag(t) }), a({ name: "avatar.pending-flag", description: "The client sets one of the account’s pending flags.", direction: "toServer", command: "af", read: (e) => ({ flag: e.int("flag") }), write: (e, { flag: t }) => e.int(t) }), a({ name: "avatar.fast-pass-add-request", description: "The player adds the first animal to an account made without one.", direction: "toServer", command: "afp", read: (e) => ({ avTypeId: e.int("avTypeId"), nameIds: le(e) }), write: (e, { avTypeId: t, nameIds: n }) => {
744
+ e.int(t), pe(e, n);
733
745
  } }), a({ name: "avatar.fast-pass-added", description: "The server says whether the first animal of an account was added.", direction: "toClient", command: "afp", read: (e) => ({ success: e.flag("success") }), write: (e, { success: t }) => e.flag(t) }), a({ name: "avatar.lookup-by-id-request", description: "The client looks a player up by their id in the room.", direction: "toServer", command: "ags", read: (e) => ({ userId: e.int("userId"), userLookup: e.flag("userLookup") }), write: (e, { userId: t, userLookup: n }) => e.int(t).flag(n) }), a({ name: "avatar.name-bar-changed", description: "Someone in the room changed their name bar.", direction: "toClient", command: "an", read: (e) => ({ userId: e.int("userId"), nameBarData: e.int("nameBarData") }), write: (e, { userId: t, nameBarData: n }) => e.int(t).int(n) }), a({ name: "avatar.ordain-request", description: "The player chooses which of their avatars stay usable without a membership.", direction: "toServer", command: "ao", read: (e) => ({ avInvIds: e.repeat(e.remaining, () => e.int("avInvId")) }), write: (e, { avInvIds: t }) => e.each(t, (n) => e.int(n)) }), a({ name: "avatar.ordained", description: "The server says whether the avatars chosen to stay usable were taken.", direction: "toClient", command: "ao", read: (e) => ({ success: e.flag("success") }), write: (e, { success: t }) => e.flag(t) }), a({ name: "avatar.photo-request", description: "The player pays for a photo booth picture they saved.", direction: "toServer", command: "apb", read: () => ({}), write: () => {
734
746
  } }), a({ name: "avatar.photo-taken", description: "The server says what the player has left after paying for a photo.", direction: "toClient", command: "apb", read: (e) => ({ gems: e.int("gems") }), write: (e, { gems: t }) => e.int(t) }), a({ name: "avatar.photo-check-request", description: "The client asks whether the player can pay for a photo booth picture.", direction: "toServer", command: "apc", read: () => ({}), write: () => {
735
747
  } }), a({ name: "avatar.photo-checked", description: "The server says whether the player can pay for a photo booth picture.", direction: "toClient", command: "apc", read: (e) => ({ gems: e.int("gems") }), write: (e, { gems: t }) => e.int(t) }), a({ name: "buddy.list-request", description: "The player asks for their buddy and blocked lists.", direction: "toServer", command: "bl", read: () => ({}), write: () => {
@@ -738,7 +750,7 @@ a({ name: "avatar.add-request", description: "The player adds a new animal to th
738
750
  const r = e.int("blocked");
739
751
  return { blocked: !0, buddies: [], blockedUserNames: e.repeat(r, () => e.string("userName")) };
740
752
  }
741
- const t = e.repeat(e.int("online"), () => me(e, !0)), n = e.repeat(e.int("offline"), () => me(e, !1));
753
+ const t = e.repeat(e.int("online"), () => he(e, !0)), n = e.repeat(e.int("offline"), () => he(e, !1));
742
754
  return { blocked: !1, buddies: [...t, ...n], blockedUserNames: [] };
743
755
  }, write: (e, { blocked: t, buddies: n, blockedUserNames: r }) => {
744
756
  if (t) {
@@ -746,44 +758,44 @@ a({ name: "avatar.add-request", description: "The player adds a new animal to th
746
758
  return;
747
759
  }
748
760
  const i = n.filter((o) => o.online), s = n.filter((o) => !o.online);
749
- e.string("0").int(i.length), i.forEach((o) => ue(e, o, !0)), e.int(s.length), s.forEach((o) => ue(e, o, !1));
761
+ e.string("0").int(i.length), i.forEach((o) => ge(e, o, !0)), e.int(s.length), s.forEach((o) => ge(e, o, !1));
750
762
  } }), a({ name: "buddy.add-request", description: "The player asks someone to be their buddy.", direction: "toServer", command: "ba", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "buddy.add-result", description: "Someone asks to be a buddy, or the server answers the player’s request.", direction: "toClient", command: "ba", read: (e) => ({ status: e.int("status"), userName: e.string("userName"), userNameModerationFlag: e.int("userNameModerationFlag") }), write: (e, { status: t, userName: n, userNameModerationFlag: r }) => e.int(t).string(n).int(r) }), a({ name: "buddy.confirm", description: "The player accepts or declines a buddy request.", direction: "toServer", command: "bc", read: (e) => ({ userName: e.string("userName"), accept: e.flag("accept") }), write: (e, { userName: t, accept: n }) => e.string(t).flag(n) }), a({ name: "buddy.status", description: "A buddy comes online or goes offline, is added, or is renamed.", direction: "toClient", command: "bs", read: (e) => {
751
763
  const t = e.string("withAvatar") === "1", n = { userName: e.string("userName"), uuid: e.string("uuid"), userNameModerationFlag: e.int("userNameModerationFlag"), online: e.string("online") === "1", accountType: e.int("accountType"), change: e.int("change") };
752
764
  return t ? { withAvatar: t, ...n, newUserName: null, avatarName: e.string("avatarName"), perUserAvatarId: e.int("perUserAvatarId"), partyTimeLeft: e.int("partyTimeLeft") } : { withAvatar: t, ...n, newUserName: e.string("newUserName"), avatarName: null, perUserAvatarId: null, partyTimeLeft: null };
753
765
  }, write: (e, t) => {
754
766
  e.flag(t.withAvatar).string(t.userName).string(t.uuid).int(t.userNameModerationFlag).flag(t.online).int(t.accountType).int(t.change), t.withAvatar ? e.string(t.avatarName ?? "").int(t.perUserAvatarId ?? -1).int(t.partyTimeLeft ?? -1) : e.string(t.newUserName ?? "");
755
767
  } }), a({ name: "buddy.remove-request", description: "The player removes a buddy.", direction: "toServer", command: "bd", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "buddy.removed", description: "A buddy is no longer a buddy.", direction: "toClient", command: "bd", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "buddy.location-request", description: "The player asks where a buddy is.", direction: "toServer", command: "br", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "buddy.location", description: "The server says where a buddy is.", direction: "toClient", command: "br", read: (e) => ({ roomName: e.string("roomName"), displayName: e.string("displayName"), displayNameId: e.int("displayNameId"), locked: e.string("locked") === "1" }), write: (e, { roomName: t, displayName: n, displayNameId: r, locked: i }) => e.string(t).string(n).int(r).flag(i) }), a({ name: "buddy.block-request", description: "The player blocks someone.", direction: "toServer", command: "bb", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "buddy.block-result", description: "The server says whether someone was blocked.", direction: "toClient", command: "bb", read: (e) => ({ userName: e.string("userName"), success: e.string("success") === "1" }), write: (e, { userName: t, success: n }) => e.string(t).flag(n) }), a({ name: "buddy.unblock-request", description: "The player unblocks someone.", direction: "toServer", command: "bu", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "buddy.unblock-result", description: "The server says whether someone was unblocked.", direction: "toClient", command: "bu", read: (e) => ({ userName: e.string("userName"), success: e.string("success") === "1" }), write: (e, { userName: t, success: n }) => e.string(t).flag(n) }), a({ name: "buddy.block-info-request", description: "The player asks whether someone is blocking them.", direction: "toServer", command: "bi", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "buddy.block-info", description: "The server says whether someone is blocking the player.", direction: "toClient", command: "bi", read: (e) => ({ userName: e.string("userName"), blockingPlayer: e.string("blockingPlayer") === "1" }), write: (e, { userName: t, blockingPlayer: n }) => e.string(t).flag(n) });
756
- function me(e, t) {
768
+ function he(e, t) {
757
769
  return { userName: e.string("userName"), uuid: e.string("uuid"), userNameModerationFlag: e.int("userNameModerationFlag"), online: t, accountType: e.int("accountType"), partyTimeLeft: t ? e.int("partyTimeLeft") : null };
758
770
  }
759
- function ue(e, t, n) {
771
+ function ge(e, t, n) {
760
772
  e.string(t.userName).string(t.uuid).int(t.userNameModerationFlag).int(t.accountType), n && e.int(t.partyTimeLeft ?? -1);
761
773
  }
762
- const an = { free: 0, safeChat: 1, emote: 2, action: 3, attachmentEmote: 4, permanentEmote: 5, slide: 6, petAction: 7, blendColor: 8, freeSafeChat: 9, alpha: 10, customAdventure: 11, customPvp: 12 };
763
- q({ name: "chat.public", description: "The player says something in the room.", direction: "toServer", type: "sys", command: "pubMsg", read: (e) => {
774
+ const xn = { free: 0, safeChat: 1, emote: 2, action: 3, attachmentEmote: 4, permanentEmote: 5, slide: 6, petAction: 7, blendColor: 8, freeSafeChat: 9, alpha: 10, customAdventure: 11, customPvp: 12 };
775
+ k({ name: "chat.public", description: "The player says something in the room.", direction: "toServer", type: "sys", command: "pubMsg", read: (e) => {
764
776
  var t, n;
765
- const r = G(((n = (t = e.body) == null ? void 0 : t.child("txt")) == null ? void 0 : n.textContent) ?? ""), i = r.lastIndexOf("%");
777
+ const r = Q(((n = (t = e.body) == null ? void 0 : t.child("txt")) == null ? void 0 : n.textContent) ?? ""), i = r.lastIndexOf("%");
766
778
  if (i === -1) throw new u("chat.public: the text has no kind after it", "PACKET_FIELD");
767
779
  const s = Number(r.slice(i + 1));
768
780
  if (!Number.isInteger(s)) throw new u("chat.public: the kind is not an integer", "PACKET_FIELD");
769
781
  return { text: r.slice(0, i), kind: s };
770
- }, write: ({ text: e, kind: t }) => [new f("txt", { children: [new w(ut(`${e}%${t}`))] })] }), a({ name: "chat.room", description: "Someone in the room said something.", direction: "toClient", command: "uc", read: (e) => ({ userId: e.int("userId"), text: e.string("text"), kind: e.int("kind"), level: e.remaining > 0 ? e.int("level") : null, extra: e.rest() }), write: (e, { userId: t, text: n, kind: r, level: i, extra: s }) => {
782
+ }, write: ({ text: e, kind: t }) => [new f("txt", { children: [new S(yt(`${e}%${t}`))] })] }), a({ name: "chat.room", description: "Someone in the room said something.", direction: "toClient", command: "uc", read: (e) => ({ userId: e.int("userId"), text: e.string("text"), kind: e.int("kind"), level: e.remaining > 0 ? e.int("level") : null, extra: e.rest() }), write: (e, { userId: t, text: n, kind: r, level: i, extra: s }) => {
771
783
  e.int(t).string(n).int(r), i !== null && e.int(i), e.raw(s);
772
784
  } }), a({ name: "chat.moderation", description: "A moderator bans, silences, kicks, warns or messages the player.", direction: "toClient", command: "fd", read: (e) => ({ action: e.string("action"), extra: e.rest() }), write: (e, { action: t, extra: n }) => e.string(t).raw(n) }), a({ name: "facilitator.invis-mode", description: "The server confirms the player's ghost mode.", direction: "toClient", command: "fi", read: (e) => ({ invisible: e.flag("invisible") }), write: (e, { invisible: t }) => e.flag(t) }), a({ name: "facilitator.report-request", description: "The player reports someone.", direction: "toServer", command: "fr", read: (e) => ({ userName: e.string("userName"), reasonId: e.int("reasonId") }), write: (e, { userName: t, reasonId: n }) => e.string(t).int(n) }), a({ name: "facilitator.report-result", description: "The server confirms a report.", direction: "toClient", command: "fr", read: (e) => ({ success: e.flag("success") }), write: (e, { success: t }) => e.flag(t) }), a({ name: "facilitator.report-with-data-request", description: "The player reports someone over something specific they sent.", direction: "toServer", command: "fra", read: (e) => ({ userName: e.string("userName"), reasonId: e.int("reasonId"), dataType: e.int("dataType"), data: e.string("data") }), write: (e, { userName: t, reasonId: n, dataType: r, data: i }) => e.string(t).int(n).int(r).string(i) }), a({ name: "facilitator.report-with-data-result", description: "The server confirms a report with content attached.", direction: "toClient", command: "fra", read: (e) => ({ success: e.flag("success") }), write: (e, { success: t }) => e.flag(t) });
773
- function ut(e) {
785
+ function yt(e) {
774
786
  let t = "";
775
- for (const n of e) t += lt[n] ?? n;
787
+ for (const n of e) t += wt[n] ?? n;
776
788
  return t;
777
789
  }
778
- const lt = { "&": "&amp;", "<": "&lt;", ">": "&gt;", "'": "&apos;", '"': "&quot;" }, le = 100;
790
+ const wt = { "&": "&amp;", "<": "&lt;", ">": "&gt;", "'": "&apos;", '"': "&quot;" }, fe = 100;
779
791
  a({ name: "currency.update", description: "One or more of the player’s balances changed.", direction: "toClient", command: "cu", read: (e) => {
780
- const t = e.int("currency"), n = t === le ? pt(e.string("balances")) : [{ currency: t, amount: e.int("amount") }], r = e.remaining > 0 ? e.int("reason") : null;
792
+ const t = e.int("currency"), n = t === fe ? bt(e.string("balances")) : [{ currency: t, amount: e.int("amount") }], r = e.remaining > 0 ? e.int("reason") : null;
781
793
  return { currency: t, balances: n, reason: r, extra: e.rest() };
782
794
  }, write: (e, { currency: t, balances: n, reason: r, extra: i }) => {
783
795
  var s;
784
- e.int(t), t === le ? e.string(n.map(({ currency: o, amount: d }) => `${o}x${d}`).join(",")) : e.int(((s = n[0]) == null ? void 0 : s.amount) ?? 0), r !== null && e.int(r), e.raw(i);
796
+ e.int(t), t === fe ? e.string(n.map(({ currency: o, amount: d }) => `${o}x${d}`).join(",")) : e.int(((s = n[0]) == null ? void 0 : s.amount) ?? 0), r !== null && e.int(r), e.raw(i);
785
797
  } });
786
- function pt(e) {
798
+ function bt(e) {
787
799
  return e === "" ? [] : e.split(",").map((t) => {
788
800
  const n = t.split("x"), [r = "", i = ""] = n, s = Number(r), o = Number(i), d = r.trim() === "" || i.trim() === "";
789
801
  if (n.length !== 2 || d || !Number.isInteger(s) || !Number.isInteger(o)) throw new u(`currency.update: field "balances" has "${t}", not <currency>x<amount>`, "PACKET_FIELD");
@@ -792,9 +804,9 @@ function pt(e) {
792
804
  }
793
805
  a({ name: "currency.donate", description: "The player donates gems.", direction: "toServer", command: "cd", read: (e) => ({ amount: e.int("amount") }), write: (e, { amount: t }) => e.int(t) }), a({ name: "currency.donate-result", description: "The server says whether the donation went through.", direction: "toClient", command: "cd", read: (e) => ({ success: e.string("result") === "1", extra: e.rest() }), write: (e, { success: t, extra: n }) => e.string(t ? "1" : "0").raw(n) }), a({ name: "currency.exchange", description: "The player exchanges one currency for another at a shop.", direction: "toServer", command: "ce", read: (e) => ({ shopId: e.int("shopId"), exchangeDefId: e.int("exchangeDefId") }), write: (e, { shopId: t, exchangeDefId: n }) => e.int(t).int(n) }), a({ name: "currency.exchange-result", description: "The server says whether the exchange went through.", direction: "toClient", command: "ce", read: (e) => ({ success: e.string("result") === "1", balance: e.remaining > 0 ? e.string("balance") : "", extra: e.rest() }), write: (e, { success: t, balance: n, extra: r }) => e.string(t ? "1" : "0").string(n).raw(r) }), a({ name: "currency.redeem-code", description: "The player redeems a code.", direction: "toServer", command: "grc", read: (e) => ({ code: e.string("code"), captchaQuestion: e.string("captchaQuestion"), captchaAnswer: e.string("captchaAnswer") }), write: (e, { code: t, captchaQuestion: n, captchaAnswer: r }) => e.string(t).string(n).string(r) }), a({ name: "currency.redeem-code-result", description: "The server says what a redeemed code came to.", direction: "toClient", command: "grc", read: (e) => {
794
806
  const t = e.string("result"), n = e.remaining > 0 ? e.string("details") : "", r = e.remaining > 0 ? e.string("hasGiftsElsewhere") === "1" : !1;
795
- return { result: t, details: ht(n), hasGiftsElsewhere: r, extra: e.rest() };
807
+ return { result: t, details: Tt(n), hasGiftsElsewhere: r, extra: e.rest() };
796
808
  }, write: (e, { result: t, details: n, hasGiftsElsewhere: r, extra: i }) => e.string(t).string(n === null ? "" : JSON.stringify(n)).string(r ? "1" : "0").raw(i) });
797
- function ht(e) {
809
+ function Tt(e) {
798
810
  if (e === "") return null;
799
811
  try {
800
812
  return JSON.parse(e);
@@ -817,27 +829,27 @@ a({ name: "currency.membership-redeemed", description: "A membership was redeeme
817
829
  }, write: (e, { denRoomDefId: t, perUserAvId: n, activePetInvId: r, extra: i }) => {
818
830
  e.int(t), n !== null && r !== null && e.int(n).int(r), e.raw(i);
819
831
  } }), a({ name: "den.masterpiece-items-request", description: "The player asks for every masterpiece placed in someone’s den.", direction: "toServer", command: "dmi", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "den.masterpiece-items", description: "The server lists every masterpiece placed in a den.", direction: "toClient", command: "dmi", read: (e) => ({ items: e.repeat(e.int("count"), () => ({ defId: e.int("defId"), invIdx: e.int("invIdx"), version: e.int("version"), approved: e.string("approved") !== "", uniqueImageId: e.string("uniqueImageId"), uniqueImageCreatorDbId: e.int("uniqueImageCreatorDbId"), uniqueImageCreatorUUID: e.string("uniqueImageCreatorUUID") })) }), write: (e, { items: t }) => e.int(t.length).each(t, (n) => e.int(n.defId).int(n.invIdx).int(n.version).string(n.approved ? "1" : "").string(n.uniqueImageId).int(n.uniqueImageCreatorDbId).string(n.uniqueImageCreatorUUID)) }), a({ name: "den.masterpiece-creator-request", description: "The player asks who drew a masterpiece.", direction: "toServer", command: "dmc", read: (e) => ({ denUserName: e.string("denUserName"), uniqueImageId: e.string("uniqueImageId") }), write: (e, { denUserName: t, uniqueImageId: n }) => e.string(t).string(n) }), a({ name: "den.masterpiece-creator", description: "The server names who drew a masterpiece.", direction: "toClient", command: "dmc", read: (e) => ({ creatorName: e.string("creatorName") }), write: (e, { creatorName: t }) => e.string(t) });
820
- function gt(e) {
832
+ function xt(e) {
821
833
  return { baseColor: e.int("baseColor"), patternColor: e.int("patternColor"), patternDefId: e.int("patternDefId"), eyeColor: e.int("eyeColor"), eyeDefId: e.int("eyeDefId") };
822
834
  }
823
- function ft(e, t) {
835
+ function kt(e, t) {
824
836
  e.int(t.baseColor).int(t.patternColor).int(t.patternDefId).int(t.eyeColor).int(t.eyeDefId);
825
837
  }
826
- function vt(e) {
827
- return { ...gt(e), tailInvId: e.int("tailInvId"), legInvId: e.int("legInvId"), backInvId: e.int("backInvId"), neckInvId: e.int("neckInvId"), headInvId: e.int("headInvId") };
838
+ function Nt(e) {
839
+ return { ...xt(e), tailInvId: e.int("tailInvId"), legInvId: e.int("legInvId"), backInvId: e.int("backInvId"), neckInvId: e.int("neckInvId"), headInvId: e.int("headInvId") };
828
840
  }
829
- function It(e, t) {
830
- ft(e, t), e.int(t.tailInvId).int(t.legInvId).int(t.backInvId).int(t.neckInvId).int(t.headInvId);
841
+ function St(e, t) {
842
+ kt(e, t), e.int(t.tailInvId).int(t.legInvId).int(t.backInvId).int(t.neckInvId).int(t.headInvId);
831
843
  }
832
844
  a({ name: "den.items-request", description: "The player asks for every den item they own.", direction: "toServer", command: "di", read: () => ({}), write: () => {
833
845
  } }), a({ name: "den.items", description: "The server lists every den item the player owns.", direction: "toClient", command: "di", read: (e) => ({ activeDenIdx: e.int("activeDenIdx"), itemCount: e.int("itemCount"), petCount: e.int("petCount"), details: e.rest() }), write: (e, { activeDenIdx: t, itemCount: n, petCount: r, details: i }) => e.int(t).int(n).int(r).raw(i) }), a({ name: "den.state", description: "The server says what is placed in the den on screen.", direction: "toClient", command: "ds", read: (e) => ({ itemCount: e.int("itemCount"), petCount: e.int("petCount"), forceReload: e.string("forceReload") === "1", details: e.rest() }), write: (e, { itemCount: t, petCount: n, forceReload: r, details: i }) => e.int(t).int(n).string(r ? "1" : "0").raw(i) });
834
- const pe = { baseColor: 0, patternColor: 0, patternDefId: 0, eyeColor: 0, eyeDefId: 0, tailInvId: 0, legInvId: 0, backInvId: 0, neckInvId: 0, headInvId: 0 };
846
+ const ve = { baseColor: 0, patternColor: 0, patternDefId: 0, eyeColor: 0, eyeDefId: 0, tailInvId: 0, legInvId: 0, backInvId: 0, neckInvId: 0, headInvId: 0 };
835
847
  a({ name: "den.state-save", description: "The player saves changes to their den.", direction: "toServer", command: "ds", read: (e) => ({ changes: e.repeat(e.int("count"), () => {
836
- const t = e.int("refId"), n = e.int("invIdx"), r = e.flag("placed"), i = e.int("x"), s = e.int("y"), o = e.int("flipped"), d = e.string("userNameLink"), m = vt(e), c = Object.keys(pe).every((l) => m[l] === 0);
848
+ const t = e.int("refId"), n = e.int("invIdx"), r = e.flag("placed"), i = e.int("x"), s = e.int("y"), o = e.int("flipped"), d = e.string("userNameLink"), m = Nt(e), c = Object.keys(ve).every((p) => m[p] === 0);
837
849
  return { refId: t, invIdx: n, placed: r, x: i, y: s, flipped: o, userNameLink: d === "off" ? "" : d, mannequin: c ? null : m };
838
850
  }) }), write: (e, { changes: t }) => {
839
851
  e.int(t.length);
840
- for (const n of t) e.int(n.refId).int(n.invIdx).flag(n.placed).int(n.x).int(n.y).int(n.flipped).string(n.userNameLink === "" ? "off" : n.userNameLink), It(e, n.mannequin ?? pe);
852
+ for (const n of t) e.int(n.refId).int(n.invIdx).flag(n.placed).int(n.x).int(n.y).int(n.flipped).string(n.userNameLink === "" ? "off" : n.userNameLink), St(e, n.mannequin ?? ve);
841
853
  } }), a({ name: "den.state-saved", description: "The server says which den items it saved.", direction: "toClient", command: "dss", read: (e) => ({ invIdxs: e.repeat(e.remaining, () => e.int("invIdx")) }), write: (e, { invIdxs: t }) => e.each(t, (n) => e.int(n)) }), a({ name: "den.buy-request", description: "The player buys a den item or a den room.", direction: "toServer", command: "db", read: (e) => {
842
854
  const t = e.string("kind") === "-1", n = e.int("shopId"), r = e.int("defId");
843
855
  return t ? { order: { kind: "den-room", shopId: n, defId: r, denSlot: e.int("denSlot"), diamond: e.flag("diamond") } } : { order: { kind: "den-item", shopId: n, defId: r, version: e.int("version"), diamond: e.flag("diamond"), masterpiece: e.flag("masterpiece"), usingTokens: e.flag("usingTokens"), masterpieceUuid: e.string("masterpieceUuid") } };
@@ -849,10 +861,10 @@ a({ name: "den.state-save", description: "The player saves changes to their den.
849
861
  e.string("0").int(t.shopId).int(t.defId).int(t.version).flag(t.diamond).flag(t.masterpiece).flag(t.usingTokens).string(t.masterpieceUuid);
850
862
  } }), a({ name: "den.buy-result", description: "The server says whether a den item or den room was bought.", direction: "toClient", command: "db", read: (e) => ({ status: e.int("status"), balance: e.string("balance"), unused: e.string("unused"), currencyType: e.int("currencyType"), invIdx: e.int("invIdx"), extra: e.rest() }), write: (e, { status: t, balance: n, unused: r, currencyType: i, invIdx: s, extra: o }) => e.int(t).string(n).string(r).int(i).int(s).raw(o) }), a({ name: "den.recycle-request", description: "The player sells den items or den rooms back to the game.", direction: "toServer", command: "dr", read: (e) => {
851
863
  const t = e.string("kind") === "-1", n = e.string("invIdxs");
852
- return { rooms: t, invIdxs: n === "" ? [] : n.split(",").map(yt) };
864
+ return { rooms: t, invIdxs: n === "" ? [] : n.split(",").map(Ct) };
853
865
  }, write: (e, { rooms: t, invIdxs: n }) => e.string(t ? "-1" : "0").string(n.join(",")) });
854
- function yt(e) {
855
- return new k([e], "den.recycle-request").int("invIdxs");
866
+ function Ct(e) {
867
+ return new A([e], "den.recycle-request").int("invIdxs");
856
868
  }
857
869
  a({ name: "den.recycle-result", description: "The server says which den items or rooms were sold.", direction: "toClient", command: "dr", read: (e) => {
858
870
  const t = e.int("count");
@@ -870,30 +882,30 @@ a({ name: "den.recycle-result", description: "The server says which den items or
870
882
  e.string(t ? "1" : "0"), n !== null && e.int(n);
871
883
  } }), a({ name: "den.eco-consumer-request", description: "The player turns one of the den’s eco items on or off.", direction: "toServer", command: "dEc", read: (e) => ({ invIdx: e.int("invIdx"), online: e.flag("online") }), write: (e, { invIdx: t, online: n }) => e.int(t).flag(n) }), a({ name: "den.eco-consumer-result", description: "The server says which of the den’s eco items are on.", direction: "toClient", command: "dEc", read: (e) => ({ ecoPointsConsumed: e.int("ecoPointsConsumed"), ecoScore: e.int("ecoScore"), consumers: e.repeat(e.int("count"), () => ({ invIdx: e.int("invIdx"), stateId: e.int("stateId") })) }), write: (e, { ecoPointsConsumed: t, ecoScore: n, consumers: r }) => e.int(t).int(n).int(r.length).each(r, ({ invIdx: i, stateId: s }) => e.int(i).int(s)) }), a({ name: "ecard.list-request", description: "The player asks for their jam-a-grams.", direction: "toServer", command: "el", read: (e) => ({ interactive: e.flag("interactive") }), write: (e, { interactive: t }) => e.flag(t) }), a({ name: "ecard.list", description: "The server sends the player’s jam-a-grams.", direction: "toClient", command: "el", read: (e) => {
872
884
  const t = e.int("count");
873
- return { cards: e.repeat(Math.max(t, 0), () => he(e)) };
885
+ return { cards: e.repeat(Math.max(t, 0), () => Ie(e)) };
874
886
  }, write: (e, { cards: t }) => {
875
- e.int(t.length), t.forEach((n) => ge(e, n));
876
- } }), a({ name: "ecard.received", description: "The player receives a jam-a-gram.", direction: "toClient", command: "ep", read: (e) => ({ card: he(e) }), write: (e, { card: t }) => ge(e, t) }), a({ name: "ecard.send", description: "The player sends a jam-a-gram.", direction: "toServer", command: "es", read: (e) => ({ userName: e.string("userName"), cardMediaId: e.int("cardMediaId"), stampMediaId: e.int("stampMediaId"), messageType: e.int("messageType"), message: e.string("message"), type: e.int("type"), giftInvIdx: e.int("giftInvIdx"), specialType: e.int("specialType") }), write: (e, t) => e.string(t.userName).int(t.cardMediaId).int(t.stampMediaId).int(t.messageType).string(t.message).int(t.type).int(t.giftInvIdx).int(t.specialType) }), a({ name: "ecard.send-result", description: "The server says whether a jam-a-gram was sent.", direction: "toClient", command: "es", read: (e) => ({ result: e.int("result") }), write: (e, { result: t }) => e.int(t) }), a({ name: "ecard.read", description: "The player opens a jam-a-gram.", direction: "toServer", command: "er", read: (e) => ({ messageId: e.int("messageId") }), write: (e, { messageId: t }) => e.int(t) }), a({ name: "ecard.read-result", description: "The server says whether a jam-a-gram was marked read.", direction: "toClient", command: "er", read: (e) => ({ messageId: e.int("messageId"), success: e.string("success") === "1" }), write: (e, { messageId: t, success: n }) => e.int(t).flag(n) }), a({ name: "ecard.delete", description: "The player deletes a jam-a-gram.", direction: "toServer", command: "ed", read: (e) => ({ messageId: e.int("messageId") }), write: (e, { messageId: t }) => e.int(t) }), a({ name: "ecard.delete-result", description: "The server says which jam-a-grams were deleted.", direction: "toClient", command: "ed", read: (e) => ({ success: e.string("success") === "1", messageIds: e.repeat(e.int("count"), () => e.int("messageId")) }), write: (e, { success: t, messageIds: n }) => {
887
+ e.int(t.length), t.forEach((n) => ye(e, n));
888
+ } }), a({ name: "ecard.received", description: "The player receives a jam-a-gram.", direction: "toClient", command: "ep", read: (e) => ({ card: Ie(e) }), write: (e, { card: t }) => ye(e, t) }), a({ name: "ecard.send", description: "The player sends a jam-a-gram.", direction: "toServer", command: "es", read: (e) => ({ userName: e.string("userName"), cardMediaId: e.int("cardMediaId"), stampMediaId: e.int("stampMediaId"), messageType: e.int("messageType"), message: e.string("message"), type: e.int("type"), giftInvIdx: e.int("giftInvIdx"), specialType: e.int("specialType") }), write: (e, t) => e.string(t.userName).int(t.cardMediaId).int(t.stampMediaId).int(t.messageType).string(t.message).int(t.type).int(t.giftInvIdx).int(t.specialType) }), a({ name: "ecard.send-result", description: "The server says whether a jam-a-gram was sent.", direction: "toClient", command: "es", read: (e) => ({ result: e.int("result") }), write: (e, { result: t }) => e.int(t) }), a({ name: "ecard.read", description: "The player opens a jam-a-gram.", direction: "toServer", command: "er", read: (e) => ({ messageId: e.int("messageId") }), write: (e, { messageId: t }) => e.int(t) }), a({ name: "ecard.read-result", description: "The server says whether a jam-a-gram was marked read.", direction: "toClient", command: "er", read: (e) => ({ messageId: e.int("messageId"), success: e.string("success") === "1" }), write: (e, { messageId: t, success: n }) => e.int(t).flag(n) }), a({ name: "ecard.delete", description: "The player deletes a jam-a-gram.", direction: "toServer", command: "ed", read: (e) => ({ messageId: e.int("messageId") }), write: (e, { messageId: t }) => e.int(t) }), a({ name: "ecard.delete-result", description: "The server says which jam-a-grams were deleted.", direction: "toClient", command: "ed", read: (e) => ({ success: e.string("success") === "1", messageIds: e.repeat(e.int("count"), () => e.int("messageId")) }), write: (e, { success: t, messageIds: n }) => {
877
889
  e.flag(t).int(n.length), n.forEach((r) => e.int(r));
878
890
  } }), a({ name: "ecard.gift", description: "The player accepts or discards a jam-a-gram’s gift.", direction: "toServer", command: "eg", read: (e) => ({ messageId: e.int("messageId"), accept: e.flag("accept"), option: e.remaining > 0 ? e.int("option") : null }), write: (e, { messageId: t, accept: n, option: r }) => {
879
891
  e.int(t).flag(n), r !== null && e.int(r);
880
892
  } }), a({ name: "ecard.gift-result", description: "The server says whether a jam-a-gram’s gift was accepted or discarded.", direction: "toClient", command: "eg", read: (e) => ({ messageId: e.int("messageId"), success: e.string("success") === "1" }), write: (e, { messageId: t, success: n }) => e.int(t).flag(n) }), a({ name: "ecard.update", description: "The server changes a jam-a-gram’s message.", direction: "toClient", command: "eu", read: (e) => ({ messageId: e.int("messageId"), message: e.string("message") }), write: (e, { messageId: t, message: n }) => e.int(t).string(n) }), a({ name: "ecard.privacy", description: "The player changes who may send them jam-a-grams.", direction: "toServer", command: "ei", read: (e) => ({ setting: e.int("setting") }), write: (e, { setting: t }) => e.int(t) }), a({ name: "ecard.privacy-result", description: "The server says whether the jam-a-gram privacy setting changed.", direction: "toClient", command: "ei", read: (e) => ({ success: e.string("success") === "1" }), write: (e, { success: t }) => e.flag(t) }), a({ name: "ecard.buddy-answer", description: "The player accepts or declines the buddy request a jam-a-gram carries.", direction: "toServer", command: "eb", read: (e) => ({ messageId: e.int("messageId"), accept: e.flag("accept") }), write: (e, { messageId: t, accept: n }) => e.int(t).flag(n) }), a({ name: "ecard.buddy-answer-result", description: "The server answers the player’s reply to a jam-a-gram’s buddy request.", direction: "toClient", command: "eb", read: (e) => ({ result: e.int("result") }), write: (e, { result: t }) => e.int(t) }), a({ name: "ecard.clear-cache", description: "The player asks the server to drop its cached jam-a-gram inbox.", direction: "toServer", command: "ec", read: () => ({}), write: () => {
881
893
  } });
882
- function he(e) {
894
+ function Ie(e) {
883
895
  return { messageId: e.int("messageId"), senderUserName: e.string("senderUserName"), cardMediaId: e.int("cardMediaId"), stampMediaId: e.int("stampMediaId"), read: e.string("read") === "1", message: e.string("message"), type: e.int("type"), giftId: e.int("giftId"), giftColor: e.int("giftColor"), giftName: e.string("giftName"), senderAccountType: e.int("senderAccountType"), senderNameBarData: e.int("senderNameBarData"), secondaryType: e.int("secondaryType"), senderType: e.int("senderType"), userNameModerationFlag: e.int("userNameModerationFlag"), additionalGiftData: e.string("additionalGiftData"), specialType: e.int("specialType") };
884
896
  }
885
- function ge(e, t) {
897
+ function ye(e, t) {
886
898
  e.int(t.messageId).string(t.senderUserName).int(t.cardMediaId).int(t.stampMediaId).flag(t.read).string(t.message).int(t.type).int(t.giftId).int(t.giftColor).string(t.giftName).int(t.senderAccountType).int(t.senderNameBarData).int(t.secondaryType).int(t.senderType).int(t.userNameModerationFlag).string(t.additionalGiftData).int(t.specialType);
887
899
  }
888
900
  a({ name: "item.list-request", description: "The client asks for an avatar’s items.", direction: "toServer", command: "il", read: (e) => ({ userName: e.string("userName"), perUserAvId: e.int("perUserAvId"), full: e.flag("full") }), write: (e, { userName: t, perUserAvId: n, full: r }) => e.string(t).int(n).flag(r) }), a({ name: "item.list", description: "The server lists or changes an avatar’s items.", direction: "toClient", command: "il", read: (e) => {
889
901
  const t = e.string("type");
890
902
  if (t === "-1") return { kind: "failed", extra: e.rest() };
891
903
  if (t === "0" || t === "1") {
892
- const g = { unused: e.string("unused"), perUserAvId: e.int("perUserAvId"), userName: e.string("userName"), eyesDefId: e.int("eyesDefId"), patternDefId: e.int("patternDefId") }, h = e.int("count"), $ = h > 0 && e.remaining === h * 5, Re = e.repeat(h, () => wt(e, $));
893
- return { kind: t === "0" ? "inventory" : "worn", ...g, items: Re };
904
+ const w = { unused: e.string("unused"), perUserAvId: e.int("perUserAvId"), userName: e.string("userName"), eyesDefId: e.int("eyesDefId"), patternDefId: e.int("patternDefId") }, I = e.int("count"), R = I > 0 && e.remaining === I * 5, He = e.repeat(I, () => qt(e, R));
905
+ return { kind: t === "0" ? "inventory" : "worn", ...w, items: He };
894
906
  }
895
- const n = t === "3", r = e.string("wear") === "1", i = e.int("perUserAvId"), s = e.string("userName"), o = e.int("color") >>> 0, d = e.int("added"), m = e.int("removed"), c = e.repeat(d, () => ({ invId: e.int("invId"), defId: e.int("defId") })), l = e.repeat(m, () => e.int("invId"));
896
- return { kind: "changed", wornOnly: n, wear: r, perUserAvId: i, userName: s, color: o, added: c, removed: l };
907
+ const n = t === "3", r = e.string("wear") === "1", i = e.int("perUserAvId"), s = e.string("userName"), o = e.int("color") >>> 0, d = e.int("added"), m = e.int("removed"), c = e.repeat(d, () => ({ invId: e.int("invId"), defId: e.int("defId") })), p = e.repeat(m, () => e.int("invId"));
908
+ return { kind: "changed", wornOnly: n, wear: r, perUserAvId: i, userName: s, color: o, added: c, removed: p };
897
909
  }, write: (e, t) => {
898
910
  if (t.kind === "failed") {
899
911
  e.string("-1").raw(t.extra);
@@ -907,7 +919,7 @@ a({ name: "item.list-request", description: "The client asks for an avatar’s i
907
919
  e.int(n.defId).int(n.invId).int(n.color >>> 0), n.equippedAvatars !== null && e.string(n.equippedAvatars).int(n.denStoreInvId ?? 0);
908
920
  });
909
921
  } });
910
- function wt(e, t) {
922
+ function qt(e, t) {
911
923
  const n = e.int("defId"), r = e.int("invId"), i = e.int("color") >>> 0;
912
924
  return t ? { defId: n, invId: r, color: i, equippedAvatars: e.string("equippedAvatars"), denStoreInvId: e.int("denStoreInvId") } : { defId: n, invId: r, color: i, equippedAvatars: null, denStoreInvId: null };
913
925
  }
@@ -923,23 +935,23 @@ a({ name: "item.use", description: "The player puts items on and takes items off
923
935
  }, write: (e, { gems: t, invIds: n }) => e.int(n.length).int(t).each(n, (r) => e.int(r)) }), a({ name: "item.diamond-bundle-buy", description: "The player buys the bundle shop’s whole bundle for diamonds.", direction: "toServer", command: "id", read: (e) => ({ shopId: e.int("shopId") }), write: (e, { shopId: t }) => e.int(t) }), a({ name: "item.diamond-bundle-buy-result", description: "The server says whether the bundle shop’s whole bundle was bought.", direction: "toClient", command: "id", read: (e) => ({ bought: e.string("bought") === "true", balance: e.remaining > 0 ? e.int("balance") : null, extra: e.rest() }), write: (e, { bought: t, balance: n, extra: r }) => {
924
936
  e.string(t ? "true" : "false"), n !== null && e.int(n), e.raw(r);
925
937
  } }), a({ name: "item.prize", description: "The server offers the player a prize.", direction: "toClient", command: "ip", read: (e) => ({ userVarId: e.int("userVarId"), isClothing: e.string("isClothing") === "1", defId: e.int("defId"), nameStrId: e.int("nameStrId"), descStrId: e.int("descStrId"), color: e.number("color"), extra: e.rest() }), write: (e, { userVarId: t, isClothing: n, defId: r, nameStrId: i, descStrId: s, color: o, extra: d }) => e.int(t).string(n ? "1" : "0").int(r).int(i).int(s).number(o).raw(d) });
926
- const bt = ["hc", "pf", "mo", "as", "ul"];
938
+ const At = ["hc", "pf", "mo", "as", "ul"];
927
939
  a({ name: "minigame.info-request", description: "The client asks the server to describe minigames.", direction: "toServer", command: "mi", read: (e) => ({ gameDefIds: e.repeat(e.remaining, () => e.int("gameDefId")) }), write: (e, { gameDefIds: t }) => e.each(t, (n) => e.int(n)) }), a({ name: "minigame.join", description: "The player asks to play a minigame.", direction: "toServer", command: "mj", read: (e) => ({ gameDefId: e.int("gameDefId"), multiplayer: e.flag("multiplayer"), proModeId: e.int("proModeId"), hostUserId: e.int("hostUserId") }), write: (e, { gameDefId: t, multiplayer: n, proModeId: r, hostUserId: i }) => e.int(t).flag(n).int(r).int(i) }), a({ name: "minigame.start-request", description: "The player starts a waiting minigame now.", direction: "toServer", command: "ms", read: (e) => ({ gameDefId: e.int("gameDefId") }), write: (e, { gameDefId: t }) => e.int(t) }), a({ name: "minigame.leave", description: "The player leaves an in-room minigame.", direction: "toServer", command: "ml", read: () => ({}), write: () => {
928
940
  } }), a({ name: "minigame.send", description: "A minigame sends its own message to the server.", direction: "toServer", command: "mm", read: (e) => ({ gameDefId: e.int("gameDefId"), data: e.rest() }), write: (e, { gameDefId: t, data: n }) => e.int(t).raw(n) }), a({ name: "minigame.pvp", description: "The player challenges, accepts, or turns down a two player game.", direction: "toServer", command: "mp", read: (e) => ({ gameDefId: e.int("gameDefId"), action: e.int("action"), userName: e.remaining > 0 ? e.string("userName") : "" }), write: (e, { gameDefId: t, action: n, userName: r }) => {
929
941
  e.int(t).int(n), r !== "" && e.string(r);
930
942
  } }), a({ name: "minigame.custom-pvp-join", description: "The player joins a two player game another player set up.", direction: "toServer", command: "mcp", read: (e) => ({ gameDefId: e.int("gameDefId"), action: e.int("action"), userName: e.string("userName") }), write: (e, { gameDefId: t, action: n, userName: r }) => e.int(t).int(n).string(r) }), a({ name: "minigame.leaderboard-request", description: "The client asks for a minigame’s leaderboard.", direction: "toServer", command: "mlb", read: (e) => ({ gameDefId: e.int("gameDefId") }), write: (e, { gameDefId: t }) => e.int(t) }), a({ name: "minigame.info", description: "The server describes minigames.", direction: "toClient", command: "mi", read: (e) => ({ games: e.repeat(e.int("count"), () => ({ gameDefId: e.int("gameDefId"), titleStrId: e.int("titleStrId"), extName: e.string("extName"), swfName: e.string("swfName"), minPlayers: e.int("minPlayers"), maxPlayers: e.int("maxPlayers"), maxSpectators: e.int("maxSpectators"), type: e.int("type"), gameCardMediaId: e.int("gameCardMediaId"), gameCountUserVarRef: e.int("gameCountUserVarRef"), custom1UserVarRef: e.int("custom1UserVarRef"), custom2UserVarRef: e.int("custom2UserVarRef"), readyForPvp: e.flag("readyForPvp"), gemMultiplier: e.number("gemMultiplier"), petDefId: e.int("petDefId"), proModeUserVarRefId: e.int("proModeUserVarRefId"), leaderboardUserVarRef: e.int("leaderboardUserVarRef"), gameLibraryIconMediaId: e.int("gameLibraryIconMediaId"), requiredAvatarType: e.int("requiredAvatarType") })) }), write: (e, { games: t }) => e.int(t.length).each(t, (n) => e.int(n.gameDefId).int(n.titleStrId).string(n.extName).string(n.swfName).int(n.minPlayers).int(n.maxPlayers).int(n.maxSpectators).int(n.type).int(n.gameCardMediaId).int(n.gameCountUserVarRef).int(n.custom1UserVarRef).int(n.custom2UserVarRef).flag(n.readyForPvp).number(n.gemMultiplier).int(n.petDefId).int(n.proModeUserVarRefId).int(n.leaderboardUserVarRef).int(n.gameLibraryIconMediaId).int(n.requiredAvatarType)) }), a({ name: "minigame.join-result", description: "The server seats the player in a minigame, or says why not.", direction: "toClient", command: "mj", read: (e) => {
931
943
  if (e.remaining === 0) return { joined: !0, refusal: null, waitingUserIds: [], detail: [] };
932
- const t = e.string("result"), n = bt.find((s) => s === t);
944
+ const t = e.string("result"), n = At.find((s) => s === t);
933
945
  if (n) return { joined: !1, refusal: n, waitingUserIds: [], detail: e.rest() };
934
- const r = new k([t], "minigame.join-result").int("userId"), i = e.repeat(e.remaining, () => e.int("userId"));
946
+ const r = new A([t], "minigame.join-result").int("userId"), i = e.repeat(e.remaining, () => e.int("userId"));
935
947
  return { joined: !0, refusal: null, waitingUserIds: [r, ...i], detail: [] };
936
948
  }, write: (e, t) => {
937
949
  t.joined ? e.each(t.waitingUserIds, (n) => e.int(n)) : e.string(t.refusal).raw(t.detail);
938
950
  } }), a({ name: "minigame.started", description: "The minigame starts, with its players.", direction: "toClient", command: "ms", read: (e) => ({ playerIds: e.repeat(e.int("playerCount"), () => e.int("userId")), data: e.rest() }), write: (e, { playerIds: t, data: n }) => e.int(t.length).each(t, (r) => e.int(r)).raw(n) });
939
- function U(e, t, n) {
951
+ function E(e, t, n) {
940
952
  return a({ name: e, description: n, direction: "toClient", command: t, read: (r) => ({ data: r.rest() }), write: (r, { data: i }) => r.raw(i) });
941
953
  }
942
- U("minigame.message", "mm", "A minigame’s own message from the server."), U("minigame.left", "ml", "A player left the minigame."), U("minigame.ended", "me", "The minigame ended."), U("minigame.room-removed", "mr", "The minigame’s room was removed."), a({ name: "minigame.pvp-invite", description: "A player challenges the player to a two player game, or turns them down.", direction: "toClient", command: "mp", read: (e) => {
954
+ E("minigame.message", "mm", "A minigame’s own message from the server."), E("minigame.left", "ml", "A player left the minigame."), E("minigame.ended", "me", "The minigame ended."), E("minigame.room-removed", "mr", "The minigame’s room was removed."), a({ name: "minigame.pvp-invite", description: "A player challenges the player to a two player game, or turns them down.", direction: "toClient", command: "mp", read: (e) => {
943
955
  const t = e.int("gameDefId"), n = e.int("action");
944
956
  return n !== 0 ? { gameDefId: t, action: n, userName: "", nameVisible: !1, extra: e.rest() } : { gameDefId: t, action: n, userName: e.string("userName"), nameVisible: e.int("nameVisible") > 0, extra: e.rest() };
945
957
  }, write: (e, { gameDefId: t, action: n, userName: r, nameVisible: i, extra: s }) => {
@@ -952,13 +964,13 @@ U("minigame.message", "mm", "A minigame’s own message from the server."), U("m
952
964
  }, write: (e, { gameDefId: t, allTime: n, thisWeek: r, buddies: i }) => {
953
965
  if (e.int(t), t !== -1) for (const s of [n, r, i]) e.int(s.length).each(s, ({ name: o, score: d }) => e.string(o).number(d));
954
966
  } }), a({ name: "minigame.gems", description: "The server hands out the serial the next gem award is folded with.", direction: "toClient", command: "mg", read: (e) => ({ serial: e.int("serial"), forScore: e.remaining > 0 ? e.int("forScore") === 1 : !1 }), write: (e, { serial: t, forScore: n }) => e.int(t).int(n ? 1 : 0) }), a({ name: "minigame.pet-mastery", description: "The server hands out the serial the next pet mastery award is folded with.", direction: "toClient", command: "ma", read: (e) => ({ serial: e.int("serial"), showPopup: e.remaining > 0 ? e.string("showPopup") === "1" : !1 }), write: (e, { serial: t, showPopup: n }) => e.int(t).string(n ? "1" : "0") });
955
- function fe(e) {
967
+ function we(e) {
956
968
  return { amountSum: e.number("amountSum"), gameSum: e.number("gameSum"), checkSum: e.number("checkSum") };
957
969
  }
958
- function ve(e, { amountSum: t, gameSum: n, checkSum: r }) {
970
+ function be(e, { amountSum: t, gameSum: n, checkSum: r }) {
959
971
  return e.number(t).number(n).number(r);
960
972
  }
961
- a({ name: "minigame.gem-award", description: "A minigame awards the player gems.", direction: "toServer", command: "mg", read: (e) => fe(e), write: (e, t) => ve(e, t) }), a({ name: "minigame.pet-mastery-award", description: "A minigame awards the active pet mastery points.", direction: "toServer", command: "ma", read: (e) => fe(e), write: (e, t) => ve(e, t) }), a({ name: "minigame.score", description: "A minigame reports the player’s score.", direction: "toServer", command: "msv", read: (e) => ({ mainSum: e.number("mainSum"), valueSum: e.number("valueSum"), numSum: e.number("numSum"), varRefSum: e.number("varRefSum"), gameSum: e.number("gameSum") }), write: (e, { mainSum: t, valueSum: n, numSum: r, varRefSum: i, gameSum: s }) => e.number(t).number(n).number(r).number(i).number(s) }), a({ name: "party.list-request", description: "The player asks which parties are on.", direction: "toServer", command: "sl", read: () => ({}), write: () => {
973
+ a({ name: "minigame.gem-award", description: "A minigame awards the player gems.", direction: "toServer", command: "mg", read: (e) => we(e), write: (e, t) => be(e, t) }), a({ name: "minigame.pet-mastery-award", description: "A minigame awards the active pet mastery points.", direction: "toServer", command: "ma", read: (e) => we(e), write: (e, t) => be(e, t) }), a({ name: "minigame.score", description: "A minigame reports the player’s score.", direction: "toServer", command: "msv", read: (e) => ({ mainSum: e.number("mainSum"), valueSum: e.number("valueSum"), numSum: e.number("numSum"), varRefSum: e.number("varRefSum"), gameSum: e.number("gameSum") }), write: (e, { mainSum: t, valueSum: n, numSum: r, varRefSum: i, gameSum: s }) => e.number(t).number(n).number(r).number(i).number(s) }), a({ name: "party.list-request", description: "The player asks which parties are on.", direction: "toServer", command: "sl", read: () => ({}), write: () => {
962
974
  } }), a({ name: "party.list", description: "The server lists Animal Jam’s parties.", direction: "toClient", command: "sl", read: (e) => ({ unread: e.string("unread"), parties: e.repeat(e.int("count"), () => ({ defId: e.int("defId"), secondsToStart: e.number("secondsToStart"), secondsToEnd: e.number("secondsToEnd") })) }), write: (e, { unread: t, parties: n }) => e.string(t).int(n.length).each(n, (r) => e.int(r.defId).number(r.secondsToStart).number(r.secondsToEnd)) }), a({ name: "party.join-request", description: "The player asks to join a party.", direction: "toServer", command: "sj", read: (e) => ({ defId: e.int("defId") }), write: (e, { defId: t }) => e.int(t) }), a({ name: "party.join-result", description: "The server says a party could not be joined.", direction: "toClient", command: "sj", read: (e) => {
963
975
  const t = e.flag("joined"), n = !t && e.remaining > 0 ? e.string("reason") : null;
964
976
  return { joined: t, reason: n, extra: e.rest() };
@@ -979,9 +991,9 @@ a({ name: "minigame.gem-award", description: "A minigame awards the player gems.
979
991
  } }), a({ name: "party.custom-node-request", description: "The player asks which server a hosted party is on.", direction: "toServer", command: "spn", read: (e) => ({ creatorUuid: e.string("creatorUuid") }), write: (e, { creatorUuid: t }) => e.string(t) }), a({ name: "party.custom-host-request", description: "The player asks to host a party of their own.", direction: "toServer", command: "scp", read: (e) => ({ defId: e.int("defId"), nameStrIds: [e.int("nameStrId1"), e.int("nameStrId2"), e.int("nameStrId3")], audioDefId: e.int("audioDefId") }), write: (e, { defId: t, nameStrIds: n, audioDefId: r }) => e.int(t).int(n[0]).int(n[1]).int(n[2]).int(r) }), a({ name: "party.custom-hosting-request", description: "The player asks whether someone is hosting a party.", direction: "toServer", command: "sphp", read: (e) => ({ creatorUuid: e.string("creatorUuid") }), write: (e, { creatorUuid: t }) => e.string(t) }), a({ name: "party.custom-hosting", description: "The server says how long someone has left hosting a party.", direction: "toClient", command: "sphp", read: (e) => ({ secondsLeft: e.int("secondsLeft"), extra: e.rest() }), write: (e, { secondsLeft: t, extra: n }) => e.int(t).raw(n) }), a({ name: "party.masterpieces-request", description: "The player asks for the bulletin board’s masterpieces.", direction: "toServer", command: "sm", read: () => ({}), write: () => {
980
992
  } }), a({ name: "party.masterpieces", description: "The server gives the bulletin board’s masterpieces.", direction: "toClient", command: "sm", read: (e) => {
981
993
  const t = e.string("pool");
982
- return { json: t, pool: Tt(t) };
994
+ return { json: t, pool: Dt(t) };
983
995
  }, write: (e, { json: t }) => e.string(t) });
984
- function Tt(e) {
996
+ function Dt(e) {
985
997
  if (e === "") return [];
986
998
  let t;
987
999
  try {
@@ -989,9 +1001,9 @@ function Tt(e) {
989
1001
  } catch {
990
1002
  throw new u(`party.masterpieces: field "pool" is not JSON ("${e}")`, "PACKET_FIELD");
991
1003
  }
992
- return (Ie(t) && Array.isArray(t.pool) ? t.pool : []).filter(Ie).map((n) => ({ frameId: Number(n.frameId) || 0, resourceId: Number(n.resourceId) || 0, userName: typeof n.userName == "string" ? n.userName : "", creatorDbId: Number(n.creatorDBId) || 0, creatorUuid: typeof n.creatorId == "string" ? n.creatorId : "", raw: n }));
1004
+ return (Te(t) && Array.isArray(t.pool) ? t.pool : []).filter(Te).map((n) => ({ frameId: Number(n.frameId) || 0, resourceId: Number(n.resourceId) || 0, userName: typeof n.userName == "string" ? n.userName : "", creatorDbId: Number(n.creatorDBId) || 0, creatorUuid: typeof n.creatorId == "string" ? n.creatorId : "", raw: n }));
993
1005
  }
994
- function Ie(e) {
1006
+ function Te(e) {
995
1007
  return typeof e == "object" && e !== null && !Array.isArray(e);
996
1008
  }
997
1009
  a({ name: "party.custom-host-result", description: "The server says whether the player may host a party.", direction: "toClient", command: "scp", read: (e) => {
@@ -1011,26 +1023,26 @@ a({ name: "party.custom-host-result", description: "The server says whether the
1011
1023
  }, write: (e, { found: t, party: n, extra: r }) => {
1012
1024
  e.string(t ? "1" : "0"), t && n && e.string(n.creatorUuid).string(n.node), e.raw(r);
1013
1025
  } }), a({ name: "newspaper.page-seen-request", description: "The player marks a newspaper page seen.", direction: "toServer", command: "nps", read: (e) => ({ defId: e.int("defId") }), write: (e, { defId: t }) => e.int(t) }), a({ name: "newspaper.page-seen", description: "The server confirms a newspaper page was marked seen.", direction: "toClient", command: "nps", read: (e) => ({ defId: e.int("defId"), timeSeen: e.int("timeSeen") }), write: (e, { defId: t, timeSeen: n }) => e.int(t).int(n) });
1014
- const C = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1015
- function xt(e) {
1026
+ const D = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
1027
+ function Ut(e) {
1016
1028
  const t = e.replace(/[\s=]/g, ""), n = new Uint8Array(Math.floor(t.length * 3 / 4));
1017
1029
  let r = 0, i = 0, s = 0;
1018
1030
  for (const o of t) {
1019
- const d = C.indexOf(o);
1031
+ const d = D.indexOf(o);
1020
1032
  if (d === -1) throw new u(`"${o}" is not a Base64 character`, "PACKET_FIELD");
1021
1033
  r = r << 6 | d, i += 6, i >= 8 && (i -= 8, n[s++] = r >> i & 255);
1022
1034
  }
1023
1035
  return n.subarray(0, s);
1024
1036
  }
1025
- function Nt(e) {
1037
+ function Bt(e) {
1026
1038
  let t = "";
1027
1039
  for (let n = 0; n < e.length; n += 3) {
1028
1040
  const r = e[n], i = e[n + 1], s = e[n + 2], o = r << 16 | (i ?? 0) << 8 | (s ?? 0);
1029
- t += C[o >> 18 & 63] + C[o >> 12 & 63], t += i === void 0 ? "=" : C[o >> 6 & 63], t += s === void 0 ? "=" : C[o & 63];
1041
+ t += D[o >> 18 & 63] + D[o >> 12 & 63], t += i === void 0 ? "=" : D[o >> 6 & 63], t += s === void 0 ? "=" : D[o & 63];
1030
1042
  }
1031
1043
  return t;
1032
1044
  }
1033
- class kt {
1045
+ class Mt {
1034
1046
  constructor(t) {
1035
1047
  this.bytes = t;
1036
1048
  }
@@ -1062,7 +1074,7 @@ class kt {
1062
1074
  throw new u(t, "PACKET_FIELD", this.position);
1063
1075
  }
1064
1076
  }
1065
- class qt {
1077
+ class Pt {
1066
1078
  bytes = [];
1067
1079
  writeShort(t) {
1068
1080
  return this.bytes.push(t >> 8 & 255, t & 255), this;
@@ -1080,7 +1092,7 @@ class qt {
1080
1092
  return Uint8Array.from(this.bytes);
1081
1093
  }
1082
1094
  }
1083
- function Ct(e) {
1095
+ function Et(e) {
1084
1096
  const t = Math.max(1, Math.ceil(e.length / 65535)), n = new Uint8Array(2 + t * 5 + e.length + 4);
1085
1097
  n[0] = 120, n[1] = 1;
1086
1098
  let r = 2;
@@ -1093,11 +1105,11 @@ function Ct(e) {
1093
1105
  const o = (s << 16 | i) >>> 0;
1094
1106
  return n[r++] = o >>> 24, n[r++] = o >>> 16 & 255, n[r++] = o >>> 8 & 255, n[r] = o & 255, n;
1095
1107
  }
1096
- function St(e) {
1097
- return e.length < 2 && p("A zlib stream has a two byte header"), ((e[0] & 15) !== 8 || (e[0] << 8 | e[1]) % 31 !== 0) && p("Not a zlib stream of deflate data"), e[1] & 32 && p("A zlib stream with a preset dictionary cannot be read"), Et(e.subarray(2));
1108
+ function jt(e) {
1109
+ return e.length < 2 && v("A zlib stream has a two byte header"), ((e[0] & 15) !== 8 || (e[0] << 8 | e[1]) % 31 !== 0) && v("Not a zlib stream of deflate data"), e[1] & 32 && v("A zlib stream with a preset dictionary cannot be read"), Gt(e.subarray(2));
1098
1110
  }
1099
- const At = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], ye = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258], Dt = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], we = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577], Ut = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13];
1100
- function S(e) {
1111
+ const Lt = [16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15], xe = [3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258], Ot = [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0], ke = [1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577], _t = [0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13];
1112
+ function U(e) {
1101
1113
  const t = new Uint16Array(16);
1102
1114
  for (let i = 0; i < e.length; i++) t[e[i]]++;
1103
1115
  t[0] = 0;
@@ -1110,15 +1122,15 @@ function S(e) {
1110
1122
  }
1111
1123
  return { counts: t, symbols: r };
1112
1124
  }
1113
- let F = null;
1114
- function Bt() {
1115
- if (!F) {
1125
+ let G = null;
1126
+ function $t() {
1127
+ if (!G) {
1116
1128
  const e = new Uint8Array(288);
1117
- e.fill(8, 0, 144), e.fill(9, 144, 256), e.fill(7, 256, 280), e.fill(8, 280, 288), F = { literals: S(e), distances: S(new Uint8Array(30).fill(5)) };
1129
+ e.fill(8, 0, 144), e.fill(9, 144, 256), e.fill(7, 256, 280), e.fill(8, 280, 288), G = { literals: U(e), distances: U(new Uint8Array(30).fill(5)) };
1118
1130
  }
1119
- return F;
1131
+ return G;
1120
1132
  }
1121
- class jt {
1133
+ class Rt {
1122
1134
  constructor(t) {
1123
1135
  this.bytes = t;
1124
1136
  }
@@ -1127,7 +1139,7 @@ class jt {
1127
1139
  bitBuffer = 0;
1128
1140
  bitCount = 0;
1129
1141
  bits(t) {
1130
- for (; this.bitCount < t; ) this.position >= this.bytes.length && p("The deflate data ends early"), this.bitBuffer |= this.bytes[this.position++] << this.bitCount, this.bitCount += 8;
1142
+ for (; this.bitCount < t; ) this.position >= this.bytes.length && v("The deflate data ends early"), this.bitBuffer |= this.bytes[this.position++] << this.bitCount, this.bitCount += 8;
1131
1143
  const n = this.bitBuffer & (1 << t) - 1;
1132
1144
  return this.bitBuffer >>>= t, this.bitCount -= t, n;
1133
1145
  }
@@ -1135,7 +1147,7 @@ class jt {
1135
1147
  this.bitBuffer = 0, this.bitCount = 0;
1136
1148
  }
1137
1149
  byte() {
1138
- return this.position >= this.bytes.length && p("The deflate data ends early"), this.bytes[this.position++];
1150
+ return this.position >= this.bytes.length && v("The deflate data ends early"), this.bytes[this.position++];
1139
1151
  }
1140
1152
  decode(t) {
1141
1153
  let n = 0, r = 0, i = 0;
@@ -1145,10 +1157,10 @@ class jt {
1145
1157
  if (i - n < o) return t.symbols[r + i - n];
1146
1158
  r += o, n = n + o << 1, i <<= 1;
1147
1159
  }
1148
- return p("The deflate data holds a code that is not in its table");
1160
+ return v("The deflate data holds a code that is not in its table");
1149
1161
  }
1150
1162
  }
1151
- class Lt {
1163
+ class Ft {
1152
1164
  bytes = new Uint8Array(1024);
1153
1165
  length = 0;
1154
1166
  push(t) {
@@ -1159,8 +1171,8 @@ class Lt {
1159
1171
  this.bytes[this.length++] = t;
1160
1172
  }
1161
1173
  }
1162
- function Et(e) {
1163
- const t = new jt(e), n = new Lt();
1174
+ function Gt(e) {
1175
+ const t = new Rt(e), n = new Ft();
1164
1176
  let r = !1;
1165
1177
  for (; !r; ) {
1166
1178
  r = t.bits(1) === 1;
@@ -1168,22 +1180,22 @@ function Et(e) {
1168
1180
  if (i === 0) {
1169
1181
  t.align();
1170
1182
  const s = t.byte() | t.byte() << 8, o = t.byte() | t.byte() << 8;
1171
- (s ^ 65535) !== o && p("A stored deflate block has a bad length");
1183
+ (s ^ 65535) !== o && v("A stored deflate block has a bad length");
1172
1184
  for (let d = 0; d < s; d++) n.push(t.byte());
1173
1185
  } else if (i === 1) {
1174
- const { literals: s, distances: o } = Bt();
1175
- be(t, n, s, o);
1186
+ const { literals: s, distances: o } = $t();
1187
+ Ne(t, n, s, o);
1176
1188
  } else if (i === 2) {
1177
- const { literals: s, distances: o } = Pt(t);
1178
- be(t, n, s, o);
1179
- } else p("A deflate block has the reserved type 3");
1189
+ const { literals: s, distances: o } = Wt(t);
1190
+ Ne(t, n, s, o);
1191
+ } else v("A deflate block has the reserved type 3");
1180
1192
  }
1181
1193
  return n.bytes.slice(0, n.length);
1182
1194
  }
1183
- function Pt(e) {
1195
+ function Wt(e) {
1184
1196
  const t = e.bits(5) + 257, n = e.bits(5) + 1, r = e.bits(4) + 4, i = new Uint8Array(19);
1185
- for (let m = 0; m < r; m++) i[At[m]] = e.bits(3);
1186
- const s = S(i), o = new Uint8Array(t + n);
1197
+ for (let m = 0; m < r; m++) i[Lt[m]] = e.bits(3);
1198
+ const s = U(i), o = new Uint8Array(t + n);
1187
1199
  let d = 0;
1188
1200
  for (; d < o.length; ) {
1189
1201
  const m = e.decode(s);
@@ -1191,12 +1203,12 @@ function Pt(e) {
1191
1203
  o[d++] = m;
1192
1204
  continue;
1193
1205
  }
1194
- let c, l = 0;
1195
- m === 16 ? (d === 0 && p("A deflate block repeats a code length before giving one"), l = o[d - 1], c = 3 + e.bits(2)) : m === 17 ? c = 3 + e.bits(3) : c = 11 + e.bits(7), d + c > o.length && p("A deflate block has too many code lengths"), o.fill(l, d, d + c), d += c;
1206
+ let c, p = 0;
1207
+ m === 16 ? (d === 0 && v("A deflate block repeats a code length before giving one"), p = o[d - 1], c = 3 + e.bits(2)) : m === 17 ? c = 3 + e.bits(3) : c = 11 + e.bits(7), d + c > o.length && v("A deflate block has too many code lengths"), o.fill(p, d, d + c), d += c;
1196
1208
  }
1197
- return { literals: S(o.subarray(0, t)), distances: S(o.subarray(t)) };
1209
+ return { literals: U(o.subarray(0, t)), distances: U(o.subarray(t)) };
1198
1210
  }
1199
- function be(e, t, n, r) {
1211
+ function Ne(e, t, n, r) {
1200
1212
  for (; ; ) {
1201
1213
  const i = e.decode(n);
1202
1214
  if (i < 256) t.push(i);
@@ -1204,27 +1216,27 @@ function be(e, t, n, r) {
1204
1216
  if (i === 256) return;
1205
1217
  {
1206
1218
  const s = i - 257;
1207
- s >= ye.length && p("A deflate block has a bad length code");
1208
- const o = ye[s] + e.bits(Dt[s]), d = e.decode(r);
1209
- d >= we.length && p("A deflate block has a bad distance code");
1210
- const m = we[d] + e.bits(Ut[d]);
1211
- m > t.length && p("A deflate block points before its start");
1219
+ s >= xe.length && v("A deflate block has a bad length code");
1220
+ const o = xe[s] + e.bits(Ot[s]), d = e.decode(r);
1221
+ d >= ke.length && v("A deflate block has a bad distance code");
1222
+ const m = ke[d] + e.bits(_t[d]);
1223
+ m > t.length && v("A deflate block points before its start");
1212
1224
  for (let c = 0; c < o; c++) t.push(t.bytes[t.length - m]);
1213
1225
  }
1214
1226
  }
1215
1227
  }
1216
1228
  }
1217
- function p(e) {
1229
+ function v(e) {
1218
1230
  throw new u(e, "PACKET_FIELD");
1219
1231
  }
1220
- const Mt = 200, $e = 16, $t = [11, 23], Ft = { setState: 1 }, I = { denItem: 1, clothing: 2, gems: 3, crystals: 4 };
1232
+ const Vt = 200, Fe = 16, zt = [11, 23], Kt = { setState: 1 }, x = { denItem: 1, clothing: 2, gems: 3, crystals: 4 };
1221
1233
  a({ name: "quest.join", description: "The player joins or creates a public adventure.", direction: "toServer", command: "qj", read: (e) => ({ roomName: e.string("roomName"), scriptDefId: e.int("scriptDefId"), difficulty: e.int("difficulty"), reserved: e.int("reserved") }), write: (e, { roomName: t, scriptDefId: n, difficulty: r, reserved: i }) => e.string(t).int(n).int(r).int(i) }), a({ name: "quest.create-private", description: "The player creates a private adventure to host.", direction: "toServer", command: "qjc", read: (e) => ({ roomName: e.string("roomName"), scriptDefId: e.int("scriptDefId"), difficulty: e.int("difficulty") }), write: (e, { roomName: t, scriptDefId: n, difficulty: r }) => e.string(t).int(n).int(r) }), a({ name: "quest.join-private", description: "The player joins a private adventure another player hosts.", direction: "toServer", command: "qjp", read: (e) => ({ roomName: e.string("roomName"), hostUserName: e.string("hostUserName") }), write: (e, { roomName: t, hostUserName: n }) => e.string(t).string(n) }), a({ name: "quest.join-buddy", description: "The player joins the adventure a buddy is in.", direction: "toServer", command: "qjf", read: (e) => ({ roomName: e.string("roomName"), buddyUserName: e.string("buddyUserName") }), write: (e, { roomName: t, buddyUserName: n }) => e.string(t).string(n) }), a({ name: "quest.join-cancel", description: "The player leaves an adventure lobby before it starts.", direction: "toServer", command: "qjx", read: () => ({}), write: () => {
1222
1234
  } }), a({ name: "quest.kick", description: "The host removes a player from a private adventure lobby.", direction: "toServer", command: "qjk", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "quest.start", description: "The player starts the adventure they are waiting in.", direction: "toServer", command: "qs", read: (e) => ({ roomName: e.string("roomName") }), write: (e, { roomName: t }) => e.string(t) }), a({ name: "quest.exit", description: "The player leaves the adventure.", direction: "toServer", command: "qx", read: (e) => ({ exitType: e.string("exitType") }), write: (e, { exitType: t }) => e.string(t) }), a({ name: "quest.actor-trigger", description: "The player sets off an adventure actor, such as a treasure chest.", direction: "toServer", command: "qat", read: (e) => ({ actorId: e.string("actorId"), value: e.int("value") }), write: (e, { actorId: t, value: n }) => e.string(t).int(n) }), a({ name: "quest.treasure-choice", description: "The player keeps or turns down a treasure chest’s prize.", direction: "toServer", command: "qatt", read: (e) => ({ actorId: e.string("actorId"), keep: e.flag("keep") }), write: (e, { actorId: t, keep: n }) => e.string(t).flag(n) }), a({ name: "quest.pick-up", description: "The player picks up an item in an adventure.", direction: "toServer", command: "qpup", read: (e) => ({ actorId: e.string("actorId"), userId: e.int("userId") }), write: (e, { actorId: t, userId: n }) => e.string(t).int(n) });
1223
- function Te(e, t, n) {
1235
+ function Se(e, t, n) {
1224
1236
  return a({ name: e, description: n, direction: "toServer", command: t, read: (r) => ({ index: r.int("index"), belowGoal: r.flag("belowGoal"), discarded: r.flag("discarded") }), write: (r, { index: i, belowGoal: s, discarded: o }) => r.int(i).flag(s).flag(o) });
1225
1237
  }
1226
- Te("quest.gift-choice", "qpgift", "The player picks a gift on an adventure’s reward screen."), Te("quest.player-gift-choice", "qpgiftplr", "The player picks a gift on their own reward screen."), a({ name: "quest.gifts-done", description: "The player finished picking an adventure’s gifts.", direction: "toServer", command: "qpgiftdone", read: (e) => ({ done: e.flag("done") }), write: (e, { done: t }) => e.flag(t) });
1227
- function R(e, t, n, r) {
1238
+ Se("quest.gift-choice", "qpgift", "The player picks a gift on an adventure’s reward screen."), Se("quest.player-gift-choice", "qpgiftplr", "The player picks a gift on their own reward screen."), a({ name: "quest.gifts-done", description: "The player finished picking an adventure’s gifts.", direction: "toServer", command: "qpgiftdone", read: (e) => ({ done: e.flag("done") }), write: (e, { done: t }) => e.flag(t) });
1239
+ function W(e, t, n, r) {
1228
1240
  return a({ name: e, description: n, direction: "toClient", command: t, read: (i) => {
1229
1241
  const s = i.flag("joined");
1230
1242
  return s ? { joined: s, status: i.string("status"), scriptDefId: i.int("scriptDefId"), difficulty: r && i.remaining > 0 ? i.int("difficulty") : null, extra: i.rest(), refusal: null } : { joined: s, refusal: i.string("refusal"), extra: i.rest() };
@@ -1232,84 +1244,84 @@ function R(e, t, n, r) {
1232
1244
  i.flag(s.joined), s.joined ? (i.string(s.status).int(s.scriptDefId), s.difficulty !== null && i.int(s.difficulty)) : i.string(s.refusal), i.raw(s.extra);
1233
1245
  } });
1234
1246
  }
1235
- R("quest.join-result", "qj", "The server says whether the player joined a public adventure.", !0), R("quest.create-private-result", "qjc", "The server says whether the player’s private adventure was created.", !1), R("quest.join-private-result", "qjp", "The server says whether the player joined a private adventure.", !0), a({ name: "quest.waiting", description: "The players waiting in the adventure lobby changed.", direction: "toClient", command: "qw", read: (e) => ({ userIds: e.repeat(e.remaining, () => e.int("userId")) }), write: (e, { userIds: t }) => e.each(t, (n) => e.int(n)) }), a({ name: "quest.join-cancelled", description: "The server confirms the player left the adventure lobby.", direction: "toClient", command: "qjx", read: (e) => ({ extra: e.rest() }), write: (e, { extra: t }) => e.raw(t) }), a({ name: "quest.started", description: "The adventure starts, with every actor in it.", direction: "toClient", command: "qs", read: (e) => {
1247
+ W("quest.join-result", "qj", "The server says whether the player joined a public adventure.", !0), W("quest.create-private-result", "qjc", "The server says whether the player’s private adventure was created.", !1), W("quest.join-private-result", "qjp", "The server says whether the player joined a private adventure.", !0), a({ name: "quest.waiting", description: "The players waiting in the adventure lobby changed.", direction: "toClient", command: "qw", read: (e) => ({ userIds: e.repeat(e.remaining, () => e.int("userId")) }), write: (e, { userIds: t }) => e.each(t, (n) => e.int(n)) }), a({ name: "quest.join-cancelled", description: "The server confirms the player left the adventure lobby.", direction: "toClient", command: "qjx", read: (e) => ({ extra: e.rest() }), write: (e, { extra: t }) => e.raw(t) }), a({ name: "quest.started", description: "The adventure starts, with every actor in it.", direction: "toClient", command: "qs", read: (e) => {
1236
1248
  const t = e.int("scriptDefId"), n = e.int("playerCount"), r = e.int("actorCount");
1237
1249
  if (r < 0) return { scriptDefId: t, playerCount: n, started: !1, timestamp: "", actors: [], extra: e.rest() };
1238
- const i = e.string("timestamp"), s = e.repeat(r, () => Rt(e));
1250
+ const i = e.string("timestamp"), s = e.repeat(r, () => Ht(e));
1239
1251
  return { scriptDefId: t, playerCount: n, started: !0, timestamp: i, actors: s, extra: e.rest() };
1240
1252
  }, write: (e, { scriptDefId: t, playerCount: n, started: r, timestamp: i, actors: s, extra: o }) => {
1241
- e.int(t).int(n), r ? e.int(s.length).string(i).each(s, (d) => Ot(e, d)) : e.int(-1), e.raw(o);
1253
+ e.int(t).int(n), r ? e.int(s.length).string(i).each(s, (d) => Jt(e, d)) : e.int(-1), e.raw(o);
1242
1254
  } });
1243
- function Rt(e) {
1244
- const t = e.string("actorId"), n = e.int("type"), r = n === $e, i = r ? e.string("defName") : null, s = r ? null : e.int("defId");
1255
+ function Ht(e) {
1256
+ const t = e.string("actorId"), n = e.int("type"), r = n === Fe, i = r ? e.string("defName") : null, s = r ? null : e.int("defId");
1245
1257
  return { actorId: t, type: n, defId: s, defName: i, state: e.int("state"), visible: e.int("visible") === 1, requireClick: e.int("requireClick") === 1, pathName: e.string("pathName"), swfState: e.string("swfState") };
1246
1258
  }
1247
- function Ot(e, t) {
1248
- e.string(t.actorId).int(t.type), t.type === $e ? e.string(t.defName ?? "") : e.int(t.defId ?? 0), e.int(t.state).int(t.visible ? 1 : 0).int(t.requireClick ? 1 : 0).string(t.pathName).string(t.swfState);
1259
+ function Jt(e, t) {
1260
+ e.string(t.actorId).int(t.type), t.type === Fe ? e.string(t.defName ?? "") : e.int(t.defId ?? 0), e.int(t.state).int(t.visible ? 1 : 0).int(t.requireClick ? 1 : 0).string(t.pathName).string(t.swfState);
1249
1261
  }
1250
1262
  a({ name: "quest.treasure", description: "A treasure chest offers the player its prize.", direction: "toClient", command: "qatt", read: (e) => ({ actorId: e.string("actorId"), prize: e.int("prize"), value: e.int("value"), color: e.int("color"), popup: e.int("popup") }), write: (e, { actorId: t, prize: n, value: r, color: i, popup: s }) => e.string(t).int(n).int(r).int(i).int(s) }), a({ name: "quest.xp", description: "The player earned adventure experience.", direction: "toClient", command: "quxp", read: (e) => ({ earned: e.int("earned"), totalXp: e.int("totalXp"), previousLevel: e.int("previousLevel"), level: e.int("level"), levelProgress: e.number("levelProgress"), actorId: e.string("actorId") }), write: (e, { earned: t, totalXp: n, previousLevel: r, level: i, levelProgress: s, actorId: o }) => e.int(t).int(n).int(r).int(i).number(s).string(o) }), a({ name: "quest.level-up", description: "A player in the adventure levelled up.", direction: "toClient", command: "qulu", read: (e) => ({ userId: e.int("userId"), level: e.int("level") }), write: (e, { userId: t, level: n }) => e.int(t).int(n) }), a({ name: "quest.player-left", description: "A player left the adventure.", direction: "toClient", command: "qplq", read: (e) => ({ userId: e.int("userId"), avatarName: e.string("avatarName") }), write: (e, { userId: t, avatarName: n }) => e.int(t).string(n) });
1251
- function xe(e, t, n) {
1263
+ function Ce(e, t, n) {
1252
1264
  return a({ name: e, description: n, direction: "toClient", command: t, read: (r) => {
1253
1265
  const i = r.int("count"), s = r.int("popupType"), o = r.repeat(i, () => ({ prize: r.int("prize"), value: r.int("value"), color: r.int("color") }));
1254
1266
  return { popupType: s, gifts: o };
1255
1267
  }, write: (r, { popupType: i, gifts: s }) => r.int(s.length).int(i).each(s, ({ prize: o, value: d, color: m }) => r.int(o).int(d).int(m)) });
1256
1268
  }
1257
- xe("quest.rewards", "qpgift", "The adventure’s reward screen opens with its gifts."), xe("quest.player-rewards", "qpgiftplr", "The player’s own reward screen opens with its gifts."), a({ name: "quest.award", description: "The adventure awards a stat or achievement.", direction: "toClient", command: "qaward", read: (e) => ({ userVarId: e.int("userVarId"), value: e.int("value") }), write: (e, { userVarId: t, value: n }) => e.int(t).int(n) }), a({ name: "quest.exit-by-type", description: "The server sends the player out of the adventure.", direction: "toClient", command: "qxt", read: (e) => ({ exitType: e.string("exitType") }), write: (e, { exitType: t }) => e.string(t) }), a({ name: "quest.bundle", description: "Several adventure messages packed into one.", direction: "toClient", command: "qqm", read: (e) => {
1258
- const t = e.string("payload"), n = new kt(St(xt(t))), r = n.readShort();
1269
+ Ce("quest.rewards", "qpgift", "The adventure’s reward screen opens with its gifts."), Ce("quest.player-rewards", "qpgiftplr", "The player’s own reward screen opens with its gifts."), a({ name: "quest.award", description: "The adventure awards a stat or achievement.", direction: "toClient", command: "qaward", read: (e) => ({ userVarId: e.int("userVarId"), value: e.int("value") }), write: (e, { userVarId: t, value: n }) => e.int(t).int(n) }), a({ name: "quest.exit-by-type", description: "The server sends the player out of the adventure.", direction: "toClient", command: "qxt", read: (e) => ({ exitType: e.string("exitType") }), write: (e, { exitType: t }) => e.string(t) }), a({ name: "quest.bundle", description: "Several adventure messages packed into one.", direction: "toClient", command: "qqm", read: (e) => {
1270
+ const t = e.string("payload"), n = new Mt(jt(Ut(t))), r = n.readShort();
1259
1271
  return { messages: Array.from({ length: Math.max(0, r) }, () => {
1260
1272
  const i = n.readShort(), s = n.readUTF(), o = Array.from({ length: Math.max(0, i - 1) }, () => n.readUTF());
1261
1273
  return { command: s, args: o };
1262
1274
  }), extra: e.rest() };
1263
1275
  }, write: (e, { messages: t, extra: n }) => {
1264
- const r = new qt().writeShort(t.length);
1276
+ const r = new Pt().writeShort(t.length);
1265
1277
  for (const { command: i, args: s } of t) r.writeShort(s.length + 1).writeUTF(i), s.forEach((o) => r.writeUTF(o));
1266
- e.string(Nt(Ct(r.toBytes()))).raw(n);
1278
+ e.string(Bt(Et(r.toBytes()))).raw(n);
1267
1279
  } }), a({ name: "quest.actor-spawned", description: "An actor appears in the adventure, such as dropped treasure.", direction: "toClient", command: "qspn", read: (e) => {
1268
1280
  const t = e.string("spawnedFrom"), n = e.string("actorId"), r = e.int("type"), i = e.int("defId");
1269
1281
  let s = null, o = null;
1270
- if (r === Mt) {
1282
+ if (r === Vt) {
1271
1283
  const d = e.int("subType");
1272
- s = { subType: d, denDefId: null, itemDefId: null, color: null, amount: null }, d === I.denItem ? s.denDefId = e.int("denDefId") : d === I.clothing ? (s.itemDefId = e.int("itemDefId"), s.color = e.int("color")) : (d === I.gems || d === I.crystals) && (s.amount = e.int("amount"));
1273
- } else $t.includes(r) && (o = { x: e.number("spawnOffsetX"), y: e.number("spawnOffsetY") });
1284
+ s = { subType: d, denDefId: null, itemDefId: null, color: null, amount: null }, d === x.denItem ? s.denDefId = e.int("denDefId") : d === x.clothing ? (s.itemDefId = e.int("itemDefId"), s.color = e.int("color")) : (d === x.gems || d === x.crystals) && (s.amount = e.int("amount"));
1285
+ } else zt.includes(r) && (o = { x: e.number("spawnOffsetX"), y: e.number("spawnOffsetY") });
1274
1286
  return { spawnedFrom: t, actorId: n, type: r, defId: i, dropped: s, spawnOffset: o, extra: e.rest() };
1275
1287
  }, write: (e, { spawnedFrom: t, actorId: n, type: r, defId: i, dropped: s, spawnOffset: o, extra: d }) => {
1276
- e.string(t).string(n).int(r).int(i), s ? (e.int(s.subType), s.subType === I.denItem ? e.int(s.denDefId ?? 0) : s.subType === I.clothing ? e.int(s.itemDefId ?? 0).int(s.color ?? 0) : (s.subType === I.gems || s.subType === I.crystals) && e.int(s.amount ?? 0)) : o && e.number(o.x).number(o.y), e.raw(d);
1288
+ e.string(t).string(n).int(r).int(i), s ? (e.int(s.subType), s.subType === x.denItem ? e.int(s.denDefId ?? 0) : s.subType === x.clothing ? e.int(s.itemDefId ?? 0).int(s.color ?? 0) : (s.subType === x.gems || s.subType === x.crystals) && e.int(s.amount ?? 0)) : o && e.number(o.x).number(o.y), e.raw(d);
1277
1289
  } }), a({ name: "quest.actor-moved", description: "An adventure actor moved.", direction: "toClient", command: "qau", read: (e) => ({ actorId: e.string("actorId"), x: e.int("x"), y: e.int("y"), velocity: e.int("velocity"), seekType: e.int("seekType"), nearestX: e.int("nearestX"), nearestY: e.int("nearestY") }), write: (e, { actorId: t, x: n, y: r, velocity: i, seekType: s, nearestX: o, nearestY: d }) => e.string(t).int(n).int(r).int(i).int(s).int(o).int(d) }), a({ name: "quest.actor-position-report", description: "The client reports where an adventure actor it moves is.", direction: "toServer", command: "qau", read: (e) => ({ actorId: e.string("actorId"), x: e.int("x"), y: e.int("y"), velocity: e.int("velocity"), seekType: e.int("seekType"), nearestX: e.int("nearestX"), nearestY: e.int("nearestY") }), write: (e, { actorId: t, x: n, y: r, velocity: i, seekType: s, nearestX: o, nearestY: d }) => e.string(t).int(n).int(r).int(i).int(s).int(o).int(d) }), a({ name: "quest.actor-seek", description: "An adventure actor starts seeking a player, path or plant.", direction: "toClient", command: "qas", read: (e) => ({ actorId: e.string("actorId"), seekType: e.int("seekType"), userId: e.int("userId") }), write: (e, { actorId: t, seekType: n, userId: r }) => e.string(t).int(n).int(r) }), a({ name: "quest.actor-seek-request", description: "The client asks for an adventure actor to seek.", direction: "toServer", command: "qas", read: (e) => ({ actorId: e.string("actorId"), seekType: e.int("seekType") }), write: (e, { actorId: t, seekType: n }) => e.string(t).int(n) }), a({ name: "quest.actor-untrigger", description: "The player left an adventure actor’s area.", direction: "toServer", command: "qaut", read: (e) => ({ actorId: e.string("actorId") }), write: (e, { actorId: t }) => e.string(t) }), a({ name: "quest.actor-health", description: "An adventure actor was hit, or missed.", direction: "toClient", command: "qahs", read: (e) => {
1278
1290
  const t = e.string("actorId"), n = e.int("healthPercent"), r = n === -1, i = !r && e.remaining > 0 ? e.int("damage") : null, s = i !== null && e.remaining > 0 ? e.int("fierce") === 1 : null;
1279
1291
  return { actorId: t, healthPercent: n, missed: r, damage: i, fierce: s, extra: e.rest() };
1280
1292
  }, write: (e, { actorId: t, healthPercent: n, damage: r, fierce: i, extra: s }) => {
1281
1293
  e.string(t).int(n), r !== null && (e.int(r), i !== null && e.int(i ? 1 : 0)), e.raw(s);
1282
1294
  } }), a({ name: "quest.actor-died", description: "An adventure actor was defeated or used up.", direction: "toClient", command: "qad", read: (e) => ({ actorId: e.string("actorId"), damage: e.int("damage"), moved: e.string("moved") === "1", x: e.int("x"), y: e.int("y"), otherActorId: e.string("otherActorId") }), write: (e, { actorId: t, damage: n, moved: r, x: i, y: s, otherActorId: o }) => e.string(t).int(n).flag(r).int(i).int(s).string(o) }), a({ name: "quest.actor-restored", description: "An adventure actor came back.", direction: "toClient", command: "qrestore", read: (e) => ({ actorId: e.string("actorId"), healthPercent: e.int("healthPercent") }), write: (e, { actorId: t, healthPercent: n }) => e.string(t).int(n) });
1283
- function Ne(e, t, n, r) {
1295
+ function qe(e, t, n, r) {
1284
1296
  return a({ name: e, description: n, direction: "toClient", command: t, read: (i) => {
1285
1297
  const s = i.int("command");
1286
- if (s !== Ft.setState || i.remaining < 2) return { command: s, actorId: null, state: null, visible: null, requireClick: null, args: i.rest() };
1287
- const o = i.string("actorId"), d = i.int("state"), m = !r && i.remaining >= 2, c = m ? i.string("visible") === "1" : null, l = m ? i.string("requireClick") === "1" : null;
1288
- return { command: s, actorId: o, state: d, visible: c, requireClick: l, args: i.rest() };
1298
+ if (s !== Kt.setState || i.remaining < 2) return { command: s, actorId: null, state: null, visible: null, requireClick: null, args: i.rest() };
1299
+ const o = i.string("actorId"), d = i.int("state"), m = !r && i.remaining >= 2, c = m ? i.string("visible") === "1" : null, p = m ? i.string("requireClick") === "1" : null;
1300
+ return { command: s, actorId: o, state: d, visible: c, requireClick: p, args: i.rest() };
1289
1301
  }, write: (i, s) => {
1290
1302
  i.int(s.command), s.actorId !== null && s.state !== null && (i.string(s.actorId).int(s.state), s.visible !== null && s.requireClick !== null && i.flag(s.visible).flag(s.requireClick)), i.raw(s.args);
1291
1303
  } });
1292
1304
  }
1293
- Ne("quest.command", "qcmd", "The adventure’s script tells the client to do something, such as change an actor.", !1), Ne("quest.variable", "qcmdVT", "The adventure’s script sets one of its variables.", !0), a({ name: "quest.actor-swf-state", description: "An adventure actor’s animation changes state.", direction: "toClient", command: "qswfs", read: (e) => ({ actorId: e.string("actorId"), swfState: e.string("swfState") }), write: (e, { actorId: t, swfState: n }) => e.string(t).string(n) }), a({ name: "quest.actor-path", description: "An adventure actor walks another path.", direction: "toClient", command: "qsp", read: (e) => ({ actorId: e.string("actorId"), pathName: e.string("pathName") }), write: (e, { actorId: t, pathName: n }) => e.string(t).string(n) }), a({ name: "quest.actor-icon", description: "An adventure actor’s icon shows or hides.", direction: "toClient", command: "qicon", read: (e) => ({ actorId: e.string("actorId"), showing: e.string("showing") === "1" }), write: (e, { actorId: t, showing: n }) => e.string(t).flag(n) }), a({ name: "quest.moved-items", description: "Where players moved the adventure’s items.", direction: "toClient", command: "qmi", read: (e) => ({ items: e.repeat(Math.floor(e.remaining / 5), () => ({ actorId: e.string("actorId"), innerRadius: e.int("innerRadius"), outerRadius: e.int("outerRadius"), x: e.number("x"), y: e.number("y") })), extra: e.rest() }), write: (e, { items: t, extra: n }) => e.each(t, (r) => e.string(r.actorId).int(r.innerRadius).int(r.outerRadius).number(r.x).number(r.y)).raw(n) });
1294
- const T = { askToDrop: 0, pickedUp: 1, droppedAt: 3, placedAt: 4 };
1305
+ qe("quest.command", "qcmd", "The adventure’s script tells the client to do something, such as change an actor.", !1), qe("quest.variable", "qcmdVT", "The adventure’s script sets one of its variables.", !0), a({ name: "quest.actor-swf-state", description: "An adventure actor’s animation changes state.", direction: "toClient", command: "qswfs", read: (e) => ({ actorId: e.string("actorId"), swfState: e.string("swfState") }), write: (e, { actorId: t, swfState: n }) => e.string(t).string(n) }), a({ name: "quest.actor-path", description: "An adventure actor walks another path.", direction: "toClient", command: "qsp", read: (e) => ({ actorId: e.string("actorId"), pathName: e.string("pathName") }), write: (e, { actorId: t, pathName: n }) => e.string(t).string(n) }), a({ name: "quest.actor-icon", description: "An adventure actor’s icon shows or hides.", direction: "toClient", command: "qicon", read: (e) => ({ actorId: e.string("actorId"), showing: e.string("showing") === "1" }), write: (e, { actorId: t, showing: n }) => e.string(t).flag(n) }), a({ name: "quest.moved-items", description: "Where players moved the adventure’s items.", direction: "toClient", command: "qmi", read: (e) => ({ items: e.repeat(Math.floor(e.remaining / 5), () => ({ actorId: e.string("actorId"), innerRadius: e.int("innerRadius"), outerRadius: e.int("outerRadius"), x: e.number("x"), y: e.number("y") })), extra: e.rest() }), write: (e, { items: t, extra: n }) => e.each(t, (r) => e.string(r.actorId).int(r.innerRadius).int(r.outerRadius).number(r.x).number(r.y)).raw(n) });
1306
+ const q = { askToDrop: 0, pickedUp: 1, droppedAt: 3, placedAt: 4 };
1295
1307
  a({ name: "quest.pick-up-result", description: "The server says what came of picking up an adventure item.", direction: "toClient", command: "qpup", read: (e) => {
1296
1308
  const t = e.int("result"), n = { result: t, heldItem: null, actorId: null, userId: null, x: null, y: null, innerRadius: null, outerRadius: null, dropperUserId: null };
1297
- if (t === T.askToDrop) return { ...n, heldItem: e.string("heldItem"), extra: e.rest() };
1298
- if (t !== T.pickedUp && t !== T.droppedAt && t !== T.placedAt) return { ...n, extra: e.rest() };
1309
+ if (t === q.askToDrop) return { ...n, heldItem: e.string("heldItem"), extra: e.rest() };
1310
+ if (t !== q.pickedUp && t !== q.droppedAt && t !== q.placedAt) return { ...n, extra: e.rest() };
1299
1311
  const r = { ...n, actorId: e.string("actorId"), userId: e.int("userId") };
1300
- return t !== T.pickedUp && (r.x = e.number("x"), r.y = e.number("y")), t === T.placedAt && (r.innerRadius = e.int("innerRadius"), r.outerRadius = e.int("outerRadius"), r.dropperUserId = e.int("dropperUserId")), { ...r, extra: e.rest() };
1312
+ return t !== q.pickedUp && (r.x = e.number("x"), r.y = e.number("y")), t === q.placedAt && (r.innerRadius = e.int("innerRadius"), r.outerRadius = e.int("outerRadius"), r.dropperUserId = e.int("dropperUserId")), { ...r, extra: e.rest() };
1301
1313
  }, write: (e, t) => {
1302
1314
  e.int(t.result), t.heldItem !== null && e.string(t.heldItem), t.actorId !== null && e.string(t.actorId).int(t.userId ?? 0), t.x !== null && t.y !== null && e.number(t.x).number(t.y), t.innerRadius !== null && e.int(t.innerRadius).int(t.outerRadius ?? 0).int(t.dropperUserId ?? 0), e.raw(t.extra);
1303
1315
  } }), a({ name: "quest.give-item", description: "The server hands the player an adventure item to pick up.", direction: "toClient", command: "qgi", read: (e) => ({ actorId: e.string("actorId") }), write: (e, { actorId: t }) => e.string(t) });
1304
- function ke(e, t, n, r) {
1316
+ function Ae(e, t, n, r) {
1305
1317
  return a({ name: e, description: n, direction: "toClient", command: t, read: (i) => {
1306
- const s = i.int("userId"), o = i.int("healthPercent"), d = i.int("change"), m = i.int("health"), c = i.int("maxHealth"), l = r && i.remaining >= 2, g = l ? i.int("x") : null, h = l ? i.int("y") : null;
1307
- return { userId: s, healthPercent: o, change: d, health: m, maxHealth: c, x: g, y: h, extra: i.rest() };
1308
- }, write: (i, { userId: s, healthPercent: o, change: d, health: m, maxHealth: c, x: l, y: g, extra: h }) => {
1309
- i.int(s).int(o).int(d).int(m).int(c), l !== null && g !== null && i.int(l).int(g), i.raw(h);
1318
+ const s = i.int("userId"), o = i.int("healthPercent"), d = i.int("change"), m = i.int("health"), c = i.int("maxHealth"), p = r && i.remaining >= 2, w = p ? i.int("x") : null, I = p ? i.int("y") : null;
1319
+ return { userId: s, healthPercent: o, change: d, health: m, maxHealth: c, x: w, y: I, extra: i.rest() };
1320
+ }, write: (i, { userId: s, healthPercent: o, change: d, health: m, maxHealth: c, x: p, y: w, extra: I }) => {
1321
+ i.int(s).int(o).int(d).int(m).int(c), p !== null && w !== null && i.int(p).int(w), i.raw(I);
1310
1322
  } });
1311
1323
  }
1312
- ke("quest.health", "quhp", "A player’s health in the adventure changed.", !1), ke("quest.respawned", "qrspn", "A player came back to life in the adventure.", !0), a({ name: "quest.player-dead", description: "A player in the adventure was defeated.", direction: "toClient", command: "qpd", read: (e) => ({ userId: e.int("userId") }), write: (e, { userId: t }) => e.int(t) }), a({ name: "quest.crystals", description: "The crystals the player gathered in the adventure changed.", direction: "toClient", command: "qporbs", read: (e) => ({ crystals: e.int("crystals") }), write: (e, { crystals: t }) => e.int(t) }), a({ name: "quest.exited", description: "The server answers the player leaving the adventure.", direction: "toClient", command: "qx", read: (e) => ({ extra: e.rest() }), write: (e, { extra: t }) => e.raw(t) }), a({ name: "quest.seed-given", description: "The player’s seed count changed.", direction: "toClient", command: "qseed", read: (e) => ({ defId: e.int("defId"), count: e.int("count"), max: e.int("max") }), write: (e, { defId: t, count: n, max: r }) => e.int(t).int(n).int(r) }), a({ name: "quest.seed-planted", description: "A seed was planted in the adventure, or refused.", direction: "toClient", command: "qps", read: (e) => {
1324
+ Ae("quest.health", "quhp", "A player’s health in the adventure changed.", !1), Ae("quest.respawned", "qrspn", "A player came back to life in the adventure.", !0), a({ name: "quest.player-dead", description: "A player in the adventure was defeated.", direction: "toClient", command: "qpd", read: (e) => ({ userId: e.int("userId") }), write: (e, { userId: t }) => e.int(t) }), a({ name: "quest.crystals", description: "The crystals the player gathered in the adventure changed.", direction: "toClient", command: "qporbs", read: (e) => ({ crystals: e.int("crystals") }), write: (e, { crystals: t }) => e.int(t) }), a({ name: "quest.exited", description: "The server answers the player leaving the adventure.", direction: "toClient", command: "qx", read: (e) => ({ extra: e.rest() }), write: (e, { extra: t }) => e.raw(t) }), a({ name: "quest.seed-given", description: "The player’s seed count changed.", direction: "toClient", command: "qseed", read: (e) => ({ defId: e.int("defId"), count: e.int("count"), max: e.int("max") }), write: (e, { defId: t, count: n, max: r }) => e.int(t).int(n).int(r) }), a({ name: "quest.seed-planted", description: "A seed was planted in the adventure, or refused.", direction: "toClient", command: "qps", read: (e) => {
1313
1325
  const t = { planted: e.flag("planted"), userName: e.string("userName"), plant: null };
1314
1326
  return t.planted ? { ...t, plant: { actorName: e.string("actorName"), defId: e.int("defId"), x: e.int("x"), y: e.int("y"), launcherUserId: e.int("launcherUserId") } } : t;
1315
1327
  }, write: (e, { planted: t, userName: n, plant: r }) => {
@@ -1318,10 +1330,10 @@ ke("quest.health", "quhp", "A player’s health in the adventure changed.", !1),
1318
1330
  const t = e.int("avatarRefId");
1319
1331
  return { avatarRefId: t === -1 ? null : t, userId: e.int("userId") };
1320
1332
  }, write: (e, { avatarRefId: t, userId: n }) => e.int(t ?? -1).int(n) }), a({ name: "quest.actor-attack", description: "The client says an adventure actor, or the player, was hit.", direction: "toServer", command: "qaa", read: (e) => ({ actorId: e.string("actorId"), playerHit: e.flag("playerHit"), weaponDefId: e.int("weaponDefId"), x: e.int("x"), y: e.int("y") }), write: (e, { actorId: t, playerHit: n, weaponDefId: r, x: i, y: s }) => e.string(t).flag(n).int(r).int(i).int(s) }), a({ name: "quest.attack-player", description: "The client says an adventure phantom it moves attacks a player.", direction: "toServer", command: "qap", read: (e) => ({ actorId: e.string("actorId"), userId: e.int("userId"), weaponDefId: e.int("weaponDefId"), color: e.int("color") }), write: (e, { actorId: t, userId: n, weaponDefId: r, color: i }) => e.string(t).int(n).int(r).int(i) }), a({ name: "quest.player-attacked", description: "An adventure actor attacks a player.", direction: "toClient", command: "qap", read: (e) => ({ actorId: e.string("actorId"), userId: e.int("userId"), weaponDefId: e.int("weaponDefId"), color: e.int("color") }), write: (e, { actorId: t, userId: n, weaponDefId: r, color: i }) => e.string(t).int(n).int(r).int(i) }), a({ name: "quest.beam-zap", description: "The client says an adventure beam caught the player.", direction: "toServer", command: "qbzap", read: (e) => ({ actorId: e.string("actorId"), userId: e.int("userId") }), write: (e, { actorId: t, userId: n }) => e.string(t).int(n) }), a({ name: "quest.beam-zapped", description: "An adventure beam zaps.", direction: "toClient", command: "qbzap", read: (e) => ({ actorId: e.string("actorId"), userId: e.int("userId") }), write: (e, { actorId: t, userId: n }) => e.string(t).int(n) }), a({ name: "quest.phantom-zap", description: "The client says a phantom’s touch caught the player.", direction: "toServer", command: "qpzap", read: (e) => ({ actorId: e.string("actorId"), userId: e.int("userId"), x: e.int("x"), y: e.int("y") }), write: (e, { actorId: t, userId: n, x: r, y: i }) => e.string(t).int(n).int(r).int(i) }), a({ name: "quest.phantom-zapped", description: "An adventure phantom zaps a player.", direction: "toClient", command: "qpzap", read: (e) => ({ actorId: e.string("actorId"), userId: e.int("userId") }), write: (e, { actorId: t, userId: n }) => e.string(t).int(n) }), a({ name: "quest.phantom-attack-destructible", description: "The client says a phantom’s attack caught a destructible actor.", direction: "toServer", command: "qpad", read: (e) => ({ phantomActorId: e.string("phantomActorId"), destructibleActorId: e.string("destructibleActorId") }), write: (e, { phantomActorId: t, destructibleActorId: n }) => e.string(t).string(n) }), a({ name: "quest.player-heal", description: "The client says the player’s healing weapon landed on a player.", direction: "toServer", command: "qph", read: (e) => ({ weaponDefId: e.int("weaponDefId"), userId: e.int("userId") }), write: (e, { weaponDefId: t, userId: n }) => e.int(t).int(n) });
1321
- function B(e, t, n, r) {
1322
- return a({ name: e, description: r, direction: n, command: t, read: (i) => ({ weaponDefId: i.int("weaponDefId"), x: i.int("x"), y: i.int("y"), actorId: i.string("actorId"), userId: i.int("userId"), color: i.int("color") }), write: (i, { weaponDefId: s, x: o, y: d, actorId: m, userId: c, color: l }) => i.int(s).int(o).int(d).string(m).int(c).int(l) });
1333
+ function j(e, t, n, r) {
1334
+ return a({ name: e, description: r, direction: n, command: t, read: (i) => ({ weaponDefId: i.int("weaponDefId"), x: i.int("x"), y: i.int("y"), actorId: i.string("actorId"), userId: i.int("userId"), color: i.int("color") }), write: (i, { weaponDefId: s, x: o, y: d, actorId: m, userId: c, color: p }) => i.int(s).int(o).int(d).string(m).int(c).int(p) });
1323
1335
  }
1324
- B("quest.projectile-launch", "qp", "toServer", "The client says the player threw a weapon in an adventure."), B("quest.projectile-launched", "qp", "toClient", "A player or actor threw a weapon in the adventure."), B("quest.swipe", "qm", "toServer", "The client says the player swung a weapon in an adventure."), B("quest.swiped", "qm", "toClient", "A player or actor swung a weapon in the adventure."), a({ name: "quest.respawn-request", description: "The player asks to come back to life in the adventure.", direction: "toServer", command: "qprr", read: (e) => ({ reserved: e.int("reserved"), x: e.int("x"), y: e.int("y") }), write: (e, { reserved: t, x: n, y: r }) => e.int(t).int(n).int(r) }), a({ name: "quest.respawn-granted", description: "The server lets the player come back to life in the adventure.", direction: "toClient", command: "qprr", read: (e) => ({ extra: e.rest() }), write: (e, { extra: t }) => e.raw(t) }), a({ name: "quest.answer", description: "The player answers a question the adventure asked.", direction: "toServer", command: "qaskr", read: (e) => ({ actorName: e.string("actorName"), actorState: e.int("actorState"), yes: e.flag("yes") }), write: (e, { actorName: t, actorState: n, yes: r }) => e.string(t).int(n).flag(r) }), a({ name: "quest.minigame-done", description: "A minigame an adventure launched is over.", direction: "toServer", command: "qmgc", read: (e) => ({ actorName: e.string("actorName"), actorState: e.int("actorState"), result: e.int("result") }), write: (e, { actorName: t, actorState: n, result: r }) => e.string(t).int(n).int(r) }), a({ name: "quest.full-room-minigame-done", description: "A minigame an adventure room played together is over.", direction: "toServer", command: "qfrmgdone", read: (e) => ({ roomName: e.string("roomName"), result: e.int("result") }), write: (e, { roomName: t, result: n }) => e.string(t).int(n) }), a({ name: "quest.clone", description: "The player asks for the adventure again.", direction: "toServer", command: "qcq", read: () => ({}), write: () => {
1336
+ j("quest.projectile-launch", "qp", "toServer", "The client says the player threw a weapon in an adventure."), j("quest.projectile-launched", "qp", "toClient", "A player or actor threw a weapon in the adventure."), j("quest.swipe", "qm", "toServer", "The client says the player swung a weapon in an adventure."), j("quest.swiped", "qm", "toClient", "A player or actor swung a weapon in the adventure."), a({ name: "quest.respawn-request", description: "The player asks to come back to life in the adventure.", direction: "toServer", command: "qprr", read: (e) => ({ reserved: e.int("reserved"), x: e.int("x"), y: e.int("y") }), write: (e, { reserved: t, x: n, y: r }) => e.int(t).int(n).int(r) }), a({ name: "quest.respawn-granted", description: "The server lets the player come back to life in the adventure.", direction: "toClient", command: "qprr", read: (e) => ({ extra: e.rest() }), write: (e, { extra: t }) => e.raw(t) }), a({ name: "quest.answer", description: "The player answers a question the adventure asked.", direction: "toServer", command: "qaskr", read: (e) => ({ actorName: e.string("actorName"), actorState: e.int("actorState"), yes: e.flag("yes") }), write: (e, { actorName: t, actorState: n, yes: r }) => e.string(t).int(n).flag(r) }), a({ name: "quest.minigame-done", description: "A minigame an adventure launched is over.", direction: "toServer", command: "qmgc", read: (e) => ({ actorName: e.string("actorName"), actorState: e.int("actorState"), result: e.int("result") }), write: (e, { actorName: t, actorState: n, result: r }) => e.string(t).int(n).int(r) }), a({ name: "quest.full-room-minigame-done", description: "A minigame an adventure room played together is over.", direction: "toServer", command: "qfrmgdone", read: (e) => ({ roomName: e.string("roomName"), result: e.int("result") }), write: (e, { roomName: t, result: n }) => e.string(t).int(n) }), a({ name: "quest.clone", description: "The player asks for the adventure again.", direction: "toServer", command: "qcq", read: () => ({}), write: () => {
1325
1337
  } }), a({ name: "quest.moved-items-request", description: "The client asks where players moved the adventure’s items.", direction: "toServer", command: "qmi", read: () => ({}), write: () => {
1326
1338
  } }), a({ name: "quest.drop-item", description: "The player drops the adventure item they carry.", direction: "toServer", command: "qdroppup", read: (e) => ({ x: e.int("x"), y: e.int("y"), actorId: e.string("actorId"), userId: e.int("userId") }), write: (e, { x: t, y: n, actorId: r, userId: i }) => e.int(t).int(n).string(r).int(i) }), a({ name: "quest.plant-seed", description: "The player plants a seed in the adventure.", direction: "toServer", command: "qps", read: (e) => ({ defId: e.int("defId"), x: e.int("x"), y: e.int("y") }), write: (e, { defId: t, x: n, y: r }) => e.int(t).int(n).int(r) }), a({ name: "quest.eat-phantom", description: "The client says a plant bit a phantom.", direction: "toServer", command: "qep", read: (e) => ({ plantActorId: e.string("plantActorId"), phantomActorId: e.string("phantomActorId"), x: e.int("x"), y: e.int("y") }), write: (e, { plantActorId: t, phantomActorId: n, x: r, y: i }) => e.string(t).string(n).int(r).int(i) }), a({ name: "quest.plant-ate-report", description: "The client says a plant started eating.", direction: "toServer", command: "qpa", read: (e) => ({ plantActorId: e.string("plantActorId"), phantomActorId: e.string("phantomActorId") }), write: (e, { plantActorId: t, phantomActorId: n }) => e.string(t).string(n) }), a({ name: "quest.side-scroll-report", description: "The client says where the player is in a side scrolling adventure.", direction: "toServer", command: "qssau", read: (e) => ({ x: e.int("x"), y: e.int("y"), flags: e.int("flags") }), write: (e, { x: t, y: n, flags: r }) => e.int(t).int(n).int(r) }), a({ name: "quest.side-scroll-moved", description: "A player moved in a side scrolling adventure.", direction: "toClient", command: "qssau", read: (e) => ({ userId: e.int("userId"), x: e.number("x"), y: e.number("y"), extra: e.rest() }), write: (e, { userId: t, x: n, y: r, extra: i }) => e.int(t).number(n).number(r).raw(i) }), a({ name: "quest.player-room-change", description: "A player went to another room of the adventure.", direction: "toClient", command: "qrc", read: (e) => ({ userId: e.int("userId"), roomName: e.string("roomName"), x: e.int("x"), y: e.int("y") }), write: (e, { userId: t, roomName: n, x: r, y: i }) => e.int(t).string(n).int(r).int(i) }), a({ name: "quest.torch", description: "A torch in the adventure is lit or put out.", direction: "toClient", command: "qtorch", read: (e) => {
1327
1339
  const t = e.int("target"), n = e.int("lit") === 1, r = t === 0;
@@ -1330,42 +1342,49 @@ B("quest.projectile-launch", "qp", "toServer", "The client says the player threw
1330
1342
  e.int(t).int(n ? 1 : 0), r !== null ? e.string(r) : e.int(i ?? 0);
1331
1343
  } }), a({ name: "quest.play-swf", description: "The adventure plays a film over the screen.", direction: "toClient", command: "qplayswf", read: (e) => ({ mediaId: e.int("mediaId") }), write: (e, { mediaId: t }) => e.int(t) }), a({ name: "quest.play-swf-done", description: "The client says the adventure’s film finished.", direction: "toServer", command: "qplayswf", read: () => ({}), write: () => {
1332
1344
  } }), a({ name: "quest.preload-swf", description: "The adventure loads a film ahead of playing it.", direction: "toClient", command: "qpreloadswf", read: (e) => ({ mediaId: e.int("mediaId") }), write: (e, { mediaId: t }) => e.int(t) }), a({ name: "quest.fade", description: "The adventure fades the screen out, or back in.", direction: "toClient", command: "qfade", read: (e) => ({ fadeIn: e.string("fadeIn") === "1" }), write: (e, { fadeIn: t }) => e.flag(t) }), a({ name: "quest.shake", description: "The adventure shakes the room.", direction: "toClient", command: "qshake", read: (e) => ({ milliseconds: e.number("milliseconds") }), write: (e, { milliseconds: t }) => e.number(t) }), a({ name: "quest.sound", description: "The adventure plays a sound.", direction: "toClient", command: "qsnd", read: (e) => ({ name: e.string("name") }), write: (e, { name: t }) => e.string(t) }), a({ name: "quest.voice-over", description: "The adventure plays a voice over with its subtitle.", direction: "toClient", command: "qsndVO", read: (e) => ({ name: e.string("name"), subtitle: e.string("subtitle") }), write: (e, { name: t, subtitle: n }) => e.string(t).string(n) }), a({ name: "quest.music", description: "The adventure changes its music.", direction: "toClient", command: "qmusic", read: (e) => ({ name: e.string("name") }), write: (e, { name: t }) => e.string(t) }), a({ name: "quest.media-library", description: "The adventure loads a pack of its sounds.", direction: "toClient", command: "qmlib", read: (e) => ({ mediaId: e.int("mediaId") }), write: (e, { mediaId: t }) => e.int(t) }), a({ name: "quest.sound-pack", description: "The adventure loads a pack of its sounds.", direction: "toClient", command: "qsndpk", read: (e) => ({ mediaId: e.int("mediaId") }), write: (e, { mediaId: t }) => e.int(t) }), a({ name: "quest.post-uri", description: "The adventure records a page view for analytics.", direction: "toClient", command: "qposturi", read: (e) => ({ uri: e.string("uri") }), write: (e, { uri: t }) => e.string(t) }), a({ name: "room.join-request", description: "The player asks to join a room.", direction: "toServer", command: "rj", read: (e) => ({ target: e.string("target"), confirmLanguageChange: e.flag("confirmLanguageChange"), invisible: e.flag("invisible"), joinType: e.string("joinType") }), write: (e, { target: t, confirmLanguageChange: n, invisible: r, joinType: i }) => e.string(t).flag(n).flag(r).string(i) });
1333
- const zt = 8;
1345
+ const Xt = 8;
1334
1346
  a({ name: "room.join-result", description: "The server says whether the player joined, and describes the room.", direction: "toClient", command: "rj", read: (e) => {
1335
1347
  const t = e.flag("joined");
1336
1348
  if (!t) {
1337
1349
  const i = e.remaining > 0 ? e.string("error") : null;
1338
1350
  return { joined: t, joinedRoom: null, details: null, error: i, extra: e.rest() };
1339
1351
  }
1340
- const n = { name: e.string("name"), id: e.int("id"), users: e.int("users"), maxUsers: e.int("maxUsers"), spectators: e.int("spectators"), maxSpectators: e.int("maxSpectators"), isPrivate: e.flag("isPrivate"), isGame: e.flag("isGame"), isLimbo: e.flag("isLimbo") }, r = e.remaining >= zt ? Vt(e) : null;
1352
+ const n = { name: e.string("name"), id: e.int("id"), users: e.int("users"), maxUsers: e.int("maxUsers"), spectators: e.int("spectators"), maxSpectators: e.int("maxSpectators"), isPrivate: e.flag("isPrivate"), isGame: e.flag("isGame"), isLimbo: e.flag("isLimbo") }, r = e.remaining >= Xt ? Yt(e) : null;
1341
1353
  return { joined: t, joinedRoom: n, details: r, error: null, extra: e.rest() };
1342
1354
  }, write: (e, { joined: t, joinedRoom: n, details: r, error: i, extra: s }) => {
1343
1355
  e.flag(t), t && n ? (e.string(n.name).int(n.id).int(n.users).int(n.maxUsers).int(n.spectators).int(n.maxSpectators).flag(n.isPrivate).flag(n.isGame).flag(n.isLimbo), r && (e.flag(r.isTemp).flag(r.isSubRoom).string(r.displayName).int(r.displayNameId).int(r.perUserAvId).int(r.activePetInvId).int(r.language).int(r.customMusicDef), r.shardId !== null && e.int(r.shardId))) : !t && i !== null && e.string(i), e.raw(s);
1344
1356
  } });
1345
- function Vt(e) {
1357
+ function Yt(e) {
1346
1358
  return { isTemp: e.flag("isTemp"), isSubRoom: e.flag("isSubRoom"), displayName: e.string("displayName"), displayNameId: e.int("displayNameId"), perUserAvId: e.int("perUserAvId"), activePetInvId: e.int("activePetInvId"), language: e.int("language"), customMusicDef: e.int("customMusicDef"), shardId: e.remaining > 0 ? e.int("shardId") : null };
1347
1359
  }
1348
1360
  a({ name: "room.properties", description: "The server says which room to load, and how.", direction: "toClient", command: "rp", read: (e) => ({ pathName: e.string("pathName"), environmentType: e.int("environmentType"), roomType: e.int("roomType"), secondaryDefId: e.int("secondaryDefId"), zoom: e.int("zoom"), roomDefId: e.int("roomDefId"), customData: e.remaining > 0 ? e.string("customData") : null }), write: (e, t) => {
1349
1361
  e.string(t.pathName).int(t.environmentType).int(t.roomType).int(t.secondaryDefId).int(t.zoom).int(t.roomDefId), t.customData !== null && e.string(t.customData);
1350
- } }), a({ name: "room.leave-request", description: "The player leaves an in room game’s room.", direction: "toServer", command: "rl", read: (e) => ({ roomId: e.int("roomId") }), write: (e, { roomId: t }) => e.int(t) }), a({ name: "room.list", description: "The server lists the rooms the client knows.", direction: "toClient", command: "rl", read: (e) => ({ rooms: e.repeat(e.int("count"), () => ({ id: e.int("id"), name: e.string("name"), maxUsers: e.int("maxUsers"), isTemp: e.flag("isTemp"), isGame: e.flag("isGame"), users: e.int("users") })) }), write: (e, { rooms: t }) => e.int(t.length).each(t, (n) => e.int(n.id).string(n.name).int(n.maxUsers).flag(n.isTemp).flag(n.isGame).int(n.users)) }), a({ name: "room.ffm-request", description: "The player asks for their first five minutes room.", direction: "toServer", command: "rf", read: () => ({}), write: () => {
1351
- } }), a({ name: "room.ffm-result", description: "The server says whether the first five minutes room is ready.", direction: "toClient", command: "rf", read: (e) => ({ ready: e.string("ready") === "1", extra: e.rest() }), write: (e, { ready: t, extra: n }) => e.string(t ? "1" : "0").raw(n) }), q({ name: "session.version-check", description: "The client says which SmartFox version it speaks.", direction: "toServer", type: "sys", command: "verChk", read: (e) => {
1362
+ } }), a({ name: "room.leave-request", description: "The player leaves an in room game’s room.", direction: "toServer", command: "rl", read: (e) => ({ roomId: e.int("roomId") }), write: (e, { roomId: t }) => e.int(t) }), a({ name: "room.list", description: "The server lists the rooms the client knows.", direction: "toClient", command: "rl", read: (e) => ({ rooms: e.repeat(e.int("count"), () => ({ id: e.int("id"), name: e.string("name"), maxUsers: e.int("maxUsers"), isTemp: e.flag("isTemp"), isGame: e.flag("isGame"), users: e.int("users") })) }), write: (e, { rooms: t }) => e.int(t.length).each(t, (n) => e.int(n.id).string(n.name).int(n.maxUsers).flag(n.isTemp).flag(n.isGame).int(n.users)) }), k({ name: "room.list-sys", description: "SmartFox lists every room on the world as the connection opens.", direction: "toClient", type: "sys", command: "rmList", read: (e) => {
1363
+ var t, n;
1364
+ return { rooms: (((n = (t = e.body) == null ? void 0 : t.child("rmList")) == null ? void 0 : n.childrenNamed("rm")) ?? []).map((r) => {
1365
+ var i;
1366
+ return { id: Number.parseInt(r.attribute("id") ?? "", 10) || 0, name: ((i = r.child("n")) == null ? void 0 : i.textContent) ?? "", maxUsers: Number.parseInt(r.attribute("maxu") ?? "", 10) || 0, isTemp: r.attribute("temp") === "1", isGame: r.attribute("game") === "1", users: Number.parseInt(r.attribute("ucnt") ?? "", 10) || 0 };
1367
+ }) };
1368
+ }, write: ({ rooms: e }) => [new f("rmList", { children: e.map((t) => new f("rm", { attributes: [g.create("id", String(t.id)), g.create("priv", "0"), g.create("temp", t.isTemp ? "1" : "0"), g.create("game", t.isGame ? "1" : "0"), g.create("ucnt", String(t.users)), g.create("maxu", String(t.maxUsers)), g.create("maxs", "0")], children: [new f("n", { children: [new B(t.name)] })] })) })] }), a({ name: "room.ffm-request", description: "The player asks for their first five minutes room.", direction: "toServer", command: "rf", read: () => ({}), write: () => {
1369
+ } }), a({ name: "room.ffm-result", description: "The server says whether the first five minutes room is ready.", direction: "toClient", command: "rf", read: (e) => ({ ready: e.string("ready") === "1", extra: e.rest() }), write: (e, { ready: t, extra: n }) => e.string(t ? "1" : "0").raw(n) }), k({ name: "session.version-check", description: "The client says which SmartFox version it speaks.", direction: "toServer", type: "sys", command: "verChk", read: (e) => {
1352
1370
  var t, n;
1353
1371
  return { version: ((n = (t = e.body) == null ? void 0 : t.child("ver")) == null ? void 0 : n.attribute("v")) ?? "" };
1354
- }, write: ({ version: e }) => [new f("ver", { attributes: [v.create("v", e)], selfClosing: !0, trailing: " " })] }), q({ name: "session.random-key-request", description: "The client asks for the key it signs its login with.", direction: "toServer", type: "sys", command: "rndK", read: () => ({}), write: () => [] }), q({ name: "session.random-key", description: "The server gives the key the login is signed with.", direction: "toClient", type: "sys", command: "rndK", read: (e) => {
1372
+ }, write: ({ version: e }) => [new f("ver", { attributes: [g.create("v", e)], selfClosing: !0, trailing: " " })] }), k({ name: "session.api-ok", description: "The server accepts the SmartFox version the client speaks.", direction: "toClient", type: "sys", command: "apiOK", read: () => ({}), write: () => [] }), k({ name: "session.api-obsolete", description: "The server refuses the SmartFox version the client speaks.", direction: "toClient", type: "sys", command: "apiKO", read: () => ({}), write: () => [] }), k({ name: "session.random-key-request", description: "The client asks for the key it signs its login with.", direction: "toServer", type: "sys", command: "rndK", read: () => ({}), write: () => [] }), k({ name: "session.random-key", description: "The server gives the key the login is signed with.", direction: "toClient", type: "sys", command: "rndK", read: (e) => {
1355
1373
  var t, n;
1356
1374
  return { key: ((n = (t = e.body) == null ? void 0 : t.child("k")) == null ? void 0 : n.textContent) ?? "" };
1357
- }, write: ({ key: e }) => [new f("k", { children: [new w(e)] })] }), q({ name: "session.login", description: "The client signs in to a zone with its auth token.", direction: "toServer", type: "sys", command: "login", read: (e) => {
1375
+ }, write: ({ key: e }) => [new f("k", { children: [new S(e)] })] }), k({ name: "session.login", description: "The client signs in to a zone with its auth token.", direction: "toServer", type: "sys", command: "login", read: (e) => {
1358
1376
  var t, n, r;
1359
1377
  const i = (t = e.body) == null ? void 0 : t.child("login");
1360
1378
  return { zone: (i == null ? void 0 : i.attribute("z")) ?? "", nick: ((n = i == null ? void 0 : i.child("nick")) == null ? void 0 : n.textContent) ?? "", password: ((r = i == null ? void 0 : i.child("pword")) == null ? void 0 : r.textContent) ?? "" };
1361
- }, write: ({ zone: e, nick: t, password: n }) => [new f("login", { attributes: [v.create("z", e)], children: [new f("nick", { children: [new w(t)] }), new f("pword", { children: [new w(n)] })] })] }), a({ name: "session.email-activation-request", description: "The player asks for the email that activates their email address to be sent.", direction: "toServer", command: "ves", read: (e) => ({ email: e.string("email") }), write: (e, { email: t }) => e.string(t) }), a({ name: "session.email-activation-result", description: "The server says whether the activation email was sent.", direction: "toClient", command: "ves", read: (e) => ({ sent: e.string("sent") === "1" }), write: (e, { sent: t }) => e.string(t ? "1" : "0") }), a({ name: "session.email-validated", description: "The account’s email address was validated.", direction: "toClient", command: "vea", read: () => ({}), write: () => {
1379
+ }, write: ({ zone: e, nick: t, password: n }) => [new f("login", { attributes: [g.create("z", e)], children: [new f("nick", { children: [new S(t)] }), new f("pword", { children: [new S(n)] })] })] }), a({ name: "session.keep-alive", description: "The client says it is still there.", direction: "toServer", command: "ka", read: () => ({}), write: () => {
1380
+ } }), a({ name: "session.email-activation-request", description: "The player asks for the email that activates their email address to be sent.", direction: "toServer", command: "ves", read: (e) => ({ email: e.string("email") }), write: (e, { email: t }) => e.string(t) }), a({ name: "session.email-activation-result", description: "The server says whether the activation email was sent.", direction: "toClient", command: "ves", read: (e) => ({ sent: e.string("sent") === "1" }), write: (e, { sent: t }) => e.string(t ? "1" : "0") }), a({ name: "session.email-validated", description: "The account’s email address was validated.", direction: "toClient", command: "vea", read: () => ({}), write: () => {
1362
1381
  } });
1363
- const y = { clothing: 1e3, denItems: 1030, denRooms: 1040, currencyExchange: 1051, diamondShop: 1054, combined: 1060 }, Kt = [y.clothing, y.denItems, y.denRooms, y.currencyExchange, y.diamondShop];
1382
+ const N = { clothing: 1e3, denItems: 1030, denRooms: 1040, currencyExchange: 1051, diamondShop: 1054, combined: 1060 }, Qt = [N.clothing, N.denItems, N.denRooms, N.currencyExchange, N.diamondShop];
1364
1383
  a({ name: "shop.list-request", description: "The player asks for a shop’s contents.", direction: "toServer", command: "gl", read: (e) => ({ listId: e.int("listId") }), write: (e, { listId: t }) => e.int(t) }), a({ name: "shop.list", description: "The server sends a shop’s contents.", direction: "toClient", command: "gl", read: (e) => {
1365
- const t = e.int("listId"), n = e.int("listType"), r = Kt.indexOf(n) !== -1;
1366
- if (!r && n !== y.combined) return { kind: "other", listId: t, listType: n, body: e.rest() };
1367
- const i = { listId: t, listType: n, titleStrId: e.string("titleStrId"), unused: e.string("unused"), diamondBundle: e.string("diamondBundle") !== "", diamondCost: W(e.string("diamondCost")) }, s = e.int("count");
1368
- return r ? { ...i, kind: "items", defIds: e.repeat(s, () => e.int("defId")) } : { ...i, kind: "combined", groups: _t(e, s) };
1384
+ const t = e.int("listId"), n = e.int("listType"), r = Qt.indexOf(n) !== -1;
1385
+ if (!r && n !== N.combined) return { kind: "other", listId: t, listType: n, body: e.rest() };
1386
+ const i = { listId: t, listType: n, titleStrId: e.string("titleStrId"), unused: e.string("unused"), diamondBundle: e.string("diamondBundle") !== "", diamondCost: Y(e.string("diamondCost")) }, s = e.int("count");
1387
+ return r ? { ...i, kind: "items", defIds: e.repeat(s, () => e.int("defId")) } : { ...i, kind: "combined", groups: Zt(e, s) };
1369
1388
  }, write: (e, t) => {
1370
1389
  if (e.int(t.listId).int(t.listType), t.kind === "other") {
1371
1390
  e.raw(t.body);
@@ -1377,12 +1396,12 @@ a({ name: "shop.list-request", description: "The player asks for a shop’s cont
1377
1396
  }
1378
1397
  e.int(t.groups.length), t.groups.length !== 0 && (e.string(t.groups.map((n) => n.listType).join(",")).string(t.groups.map((n) => n.defIds.length).join(",")), t.groups.forEach((n) => n.defIds.forEach((r) => e.int(r))));
1379
1398
  } });
1380
- function _t(e, t) {
1399
+ function Zt(e, t) {
1381
1400
  if (t === 0) return [];
1382
1401
  const n = e.string("groupTypes").split(","), r = e.string("groupCounts").split(",");
1383
- return n.map((i, s) => ({ listType: W(i), defIds: e.repeat(W(r[s] ?? ""), () => e.int("defId")) }));
1402
+ return n.map((i, s) => ({ listType: Y(i), defIds: e.repeat(Y(r[s] ?? ""), () => e.int("defId")) }));
1384
1403
  }
1385
- function W(e) {
1404
+ function Y(e) {
1386
1405
  const t = Number(e);
1387
1406
  return Number.isInteger(t) ? t : 0;
1388
1407
  }
@@ -1409,17 +1428,17 @@ a({ name: "shop.den-shop-update-request", description: "The player adds, reprice
1409
1428
  e.int(t.status), t.status === 1 && e.string(t.ownerUserName).int(t.storeInvId).raw(t.rest);
1410
1429
  } }), a({ name: "trade.list-request", description: "The player asks for someone’s trade list.", direction: "toServer", command: "tl", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "trade.list", description: "The server sends someone’s trade list.", direction: "toClient", command: "tl", read: (e) => ({ userName: e.string("userName"), clothing: e.repeat(e.int("clothing"), () => ({ defId: e.int("defId"), invIdx: e.int("invIdx"), color: e.int("color") })), den: e.repeat(e.int("den"), () => {
1411
1430
  const t = e.int("defId"), n = e.int("invIdx");
1412
- return { defId: t, invIdx: n, ...X(e) };
1431
+ return { defId: t, invIdx: n, ...Z(e) };
1413
1432
  }), pets: e.repeat(e.int("pets"), () => {
1414
- const t = e.int("defId"), n = e.int("invIdx"), r = e.number("createdAt"), i = H(e), s = e.string("name");
1415
- return { defId: t, invIdx: n, createdAt: r, bits: i, name: s, ...Q(e) };
1433
+ const t = e.int("defId"), n = e.int("invIdx"), r = e.number("createdAt"), i = te(e), s = e.string("name");
1434
+ return { defId: t, invIdx: n, createdAt: r, bits: i, name: s, ...re(e) };
1416
1435
  }) }), write: (e, { userName: t, clothing: n, den: r, pets: i }) => {
1417
1436
  e.string(t).int(n.length), n.forEach((s) => e.int(s.defId).int(s.invIdx ?? -1).int(s.color)), e.int(r.length), r.forEach((s) => {
1418
- e.int(s.defId).int(s.invIdx ?? -1), J(e, s);
1437
+ e.int(s.defId).int(s.invIdx ?? -1), ee(e, s);
1419
1438
  }), e.int(i.length), i.forEach((s) => {
1420
- e.int(s.defId).int(s.invIdx).number(s.createdAt), Y(e, s), e.string(s.name), Z(e, s);
1439
+ e.int(s.defId).int(s.invIdx).number(s.createdAt), ne(e, s), e.string(s.name), ie(e, s);
1421
1440
  });
1422
- } }), a({ name: "trade.list-change", description: "The player changes their trade list.", direction: "toServer", command: "ts", read: (e) => ({ removed: e.repeat(e.int("removed"), () => O(e)), added: e.repeat(e.int("added"), () => O(e)) }), write: (e, { removed: t, added: n }) => {
1441
+ } }), a({ name: "trade.list-change", description: "The player changes their trade list.", direction: "toServer", command: "ts", read: (e) => ({ removed: e.repeat(e.int("removed"), () => V(e)), added: e.repeat(e.int("added"), () => V(e)) }), write: (e, { removed: t, added: n }) => {
1423
1442
  e.int(t.length), t.forEach((r) => e.int(r.itemType).int(r.invIdx)), e.int(n.length), n.forEach((r) => e.int(r.itemType).int(r.invIdx));
1424
1443
  } }), a({ name: "trade.busy", description: "The player starts or stops being busy with a trade.", direction: "toServer", command: "tb", read: (e) => ({ busy: e.flag("busy") }), write: (e, { busy: t }) => e.flag(t) }), a({ name: "trade.action", description: "The player asks for a trade, answers one, withdraws or confirms.", direction: "toServer", command: "ti", read: (e) => {
1425
1444
  const t = e.int("action");
@@ -1456,10 +1475,10 @@ a({ name: "shop.den-shop-update-request", description: "The player adds, reprice
1456
1475
  const t = e.int("status");
1457
1476
  switch (t) {
1458
1477
  case 0:
1459
- return { kind: "offer", status: 0, offer: Wt(e) };
1478
+ return { kind: "offer", status: 0, offer: en(e) };
1460
1479
  case 1: {
1461
1480
  if (e.int("stage") === 0) return { kind: "confirm", status: 1 };
1462
- const n = e.repeat(e.int("received"), () => Xt(e)), r = e.repeat(e.int("removed"), () => O(e));
1481
+ const n = e.repeat(e.int("received"), () => nn(e)), r = e.repeat(e.int("removed"), () => V(e));
1463
1482
  return { kind: "completed", status: 1, received: n, removed: r, extra: e.rest() };
1464
1483
  }
1465
1484
  case 6:
@@ -1472,13 +1491,13 @@ a({ name: "shop.den-shop-update-request", description: "The player adds, reprice
1472
1491
  }, write: (e, t) => {
1473
1492
  switch (e.int(t.status), t.kind) {
1474
1493
  case "offer":
1475
- Gt(e, t.offer);
1494
+ tn(e, t.offer);
1476
1495
  return;
1477
1496
  case "confirm":
1478
1497
  e.int(0);
1479
1498
  return;
1480
1499
  case "completed":
1481
- e.int(1).int(t.received.length), t.received.forEach((n) => Jt(e, n)), e.int(t.removed.length), t.removed.forEach((n) => e.int(n.itemType).int(n.invIdx)), e.raw(t.extra);
1500
+ e.int(1).int(t.received.length), t.received.forEach((n) => rn(e, n)), e.int(t.removed.length), t.removed.forEach((n) => e.int(n.itemType).int(n.invIdx)), e.raw(t.extra);
1482
1501
  return;
1483
1502
  case "closed":
1484
1503
  e.raw(t.extra);
@@ -1491,70 +1510,70 @@ a({ name: "shop.den-shop-update-request", description: "The player adds, reprice
1491
1510
  return;
1492
1511
  }
1493
1512
  } });
1494
- function Wt(e) {
1513
+ function en(e) {
1495
1514
  const t = e.string("userName"), n = e.int("userNameModerationFlag"), r = e.int("wantedKind"), i = e.int("wantedInvIdx"), s = e.int("clothing"), o = e.int("den"), d = e.int("pets");
1496
- return { userName: t, userNameModerationFlag: n, wantedKind: r, wantedInvIdx: i, offered: { clothing: e.repeat(s, () => ({ defId: e.int("defId"), color: e.int("color"), invIdx: null })), den: e.repeat(o, () => ({ defId: e.int("defId"), invIdx: null, ...X(e) })), pets: e.repeat(d, () => {
1497
- const m = e.number("createdAt"), c = e.int("defId"), l = e.int("invIdx"), g = H(e), h = Q(e);
1498
- return { defId: c, invIdx: l, createdAt: m, bits: g, name: e.string("name"), ...h };
1515
+ return { userName: t, userNameModerationFlag: n, wantedKind: r, wantedInvIdx: i, offered: { clothing: e.repeat(s, () => ({ defId: e.int("defId"), color: e.int("color"), invIdx: null })), den: e.repeat(o, () => ({ defId: e.int("defId"), invIdx: null, ...Z(e) })), pets: e.repeat(d, () => {
1516
+ const m = e.number("createdAt"), c = e.int("defId"), p = e.int("invIdx"), w = te(e), I = re(e);
1517
+ return { defId: c, invIdx: p, createdAt: m, bits: w, name: e.string("name"), ...I };
1499
1518
  }) } };
1500
1519
  }
1501
- function Gt(e, t) {
1520
+ function tn(e, t) {
1502
1521
  const { clothing: n, den: r, pets: i } = t.offered;
1503
1522
  e.string(t.userName).int(t.userNameModerationFlag).int(t.wantedKind).int(t.wantedInvIdx).int(n.length).int(r.length).int(i.length), n.forEach((s) => e.int(s.defId).int(s.color)), r.forEach((s) => {
1504
- e.int(s.defId), J(e, s);
1523
+ e.int(s.defId), ee(e, s);
1505
1524
  }), i.forEach((s) => {
1506
- e.number(s.createdAt).int(s.defId).int(s.invIdx), Y(e, s), Z(e, s), e.string(s.name);
1525
+ e.number(s.createdAt).int(s.defId).int(s.invIdx), ne(e, s), ie(e, s), e.string(s.name);
1507
1526
  });
1508
1527
  }
1509
- function Xt(e) {
1528
+ function nn(e) {
1510
1529
  const t = e.int("type");
1511
1530
  switch (t) {
1512
1531
  case 0:
1513
1532
  return { type: "clothing", defId: e.int("defId"), invIdx: e.int("invIdx"), color: e.int("color") };
1514
1533
  case 1: {
1515
1534
  const n = e.int("invIdx");
1516
- return { type: "den", defId: e.int("defId"), invIdx: n, ...X(e) };
1535
+ return { type: "den", defId: e.int("defId"), invIdx: n, ...Z(e) };
1517
1536
  }
1518
1537
  case 2: {
1519
- const n = e.number("createdAt"), r = e.int("invIdx"), i = e.int("defId"), s = H(e), o = Q(e);
1538
+ const n = e.number("createdAt"), r = e.int("invIdx"), i = e.int("defId"), s = te(e), o = re(e);
1520
1539
  return { type: "pet", defId: i, invIdx: r, createdAt: n, bits: s, name: e.string("name"), ...o };
1521
1540
  }
1522
1541
  default:
1523
1542
  throw new u(`trade.result: unknown received item type ${t}`, "PACKET_FIELD");
1524
1543
  }
1525
1544
  }
1526
- function Jt(e, t) {
1545
+ function rn(e, t) {
1527
1546
  switch (t.type) {
1528
1547
  case "clothing":
1529
1548
  e.int(0).int(t.defId).int(t.invIdx ?? -1).int(t.color);
1530
1549
  return;
1531
1550
  case "den":
1532
- e.int(1).int(t.invIdx ?? -1).int(t.defId), J(e, t);
1551
+ e.int(1).int(t.invIdx ?? -1).int(t.defId), ee(e, t);
1533
1552
  return;
1534
1553
  case "pet":
1535
- e.int(2).number(t.createdAt).int(t.invIdx).int(t.defId), Y(e, t), Z(e, t), e.string(t.name);
1554
+ e.int(2).number(t.createdAt).int(t.invIdx).int(t.defId), ne(e, t), ie(e, t), e.string(t.name);
1536
1555
  return;
1537
1556
  }
1538
1557
  }
1539
- function O(e) {
1558
+ function V(e) {
1540
1559
  return { itemType: e.int("itemType"), invIdx: e.int("invIdx") };
1541
1560
  }
1542
- function X(e) {
1561
+ function Z(e) {
1543
1562
  return { version: e.int("version"), approved: e.string("approved") === "true", uniqueImageId: e.string("uniqueImageId"), creatorDbId: e.int("creatorDbId"), creatorUuid: e.string("creatorUuid") };
1544
1563
  }
1545
- function J(e, t) {
1564
+ function ee(e, t) {
1546
1565
  e.int(t.version).string(t.approved ? "true" : "false").string(t.uniqueImageId).int(t.creatorDbId).string(t.creatorUuid);
1547
1566
  }
1548
- function H(e) {
1567
+ function te(e) {
1549
1568
  return [e.int("bits1"), e.int("bits2"), e.int("bits3")];
1550
1569
  }
1551
- function Y(e, t) {
1570
+ function ne(e, t) {
1552
1571
  e.int(t.bits[0]).int(t.bits[1]).int(t.bits[2]);
1553
1572
  }
1554
- function Q(e) {
1573
+ function re(e) {
1555
1574
  return { traitDefId: e.int("traitDefId"), toyDefId: e.int("toyDefId"), foodDefId: e.int("foodDefId") };
1556
1575
  }
1557
- function Z(e, t) {
1576
+ function ie(e, t) {
1558
1577
  e.int(t.traitDefId).int(t.toyDefId).int(t.foodDefId);
1559
1578
  }
1560
1579
  a({ name: "world.room-count-request", description: "The player asks how many are in each room.", direction: "toServer", command: "rc", read: () => ({}), write: () => {
@@ -1563,7 +1582,7 @@ a({ name: "world.room-count-request", description: "The player asks how many are
1563
1582
  const z = 4;
1564
1583
  a({ name: "world.shard-list", description: "The server lists the shards on each server node.", direction: "toClient", command: "rm", read: (e) => {
1565
1584
  const t = e.rest(), n = t[0];
1566
- return n !== void 0 && Fe(n) ? { status: new k(t, "world.shard-list").int("status"), nodes: [] } : { status: null, nodes: Ht(t) };
1585
+ return n !== void 0 && Ge(n) ? { status: new A(t, "world.shard-list").int("status"), nodes: [] } : { status: null, nodes: an(t) };
1567
1586
  }, write: (e, { status: t, nodes: n }) => {
1568
1587
  if (t !== null) {
1569
1588
  e.int(t);
@@ -1571,21 +1590,21 @@ a({ name: "world.shard-list", description: "The server lists the shards on each
1571
1590
  }
1572
1591
  e.each(n, ({ host: r, shards: i }) => e.string(r).each(i, (s) => e.int(s.id).int(s.language).int(s.population).int(s.buddies)));
1573
1592
  } });
1574
- function Ht(e) {
1593
+ function an(e) {
1575
1594
  const t = [];
1576
1595
  let n = 0;
1577
1596
  for (; n < e.length; ) {
1578
1597
  const r = e[n++];
1579
1598
  let i = n;
1580
- for (; i < e.length && Fe(e[i]); ) i++;
1599
+ for (; i < e.length && Ge(e[i]); ) i++;
1581
1600
  const s = i - n;
1582
1601
  if (s % z !== 0) throw new u(`world.shard-list: node "${r}" has ${s} numbers, not shards of ${z}`, "PACKET_FIELD");
1583
- const o = new k(e.slice(n, i), "world.shard-list"), d = o.repeat(s / z, () => ({ id: o.int("id"), language: o.int("language"), population: o.int("population"), buddies: o.int("buddies") }));
1602
+ const o = new A(e.slice(n, i), "world.shard-list"), d = o.repeat(s / z, () => ({ id: o.int("id"), language: o.int("language"), population: o.int("population"), buddies: o.int("buddies") }));
1584
1603
  t.push({ host: r, shards: d }), n = i;
1585
1604
  }
1586
1605
  return t;
1587
1606
  }
1588
- function Fe(e) {
1607
+ function Ge(e) {
1589
1608
  return e.trim() !== "" && Number.isFinite(Number(e));
1590
1609
  }
1591
1610
  a({ name: "world.node-hop-request", description: "The player asks to move off a server that is shutting down.", direction: "toServer", command: "nd", read: () => ({}), write: () => {
@@ -1595,12 +1614,12 @@ a({ name: "world.node-hop-request", description: "The player asks to move off a
1595
1614
  }, write: (e, { result: t, token: n, read: r, write: i, userName: s, extra: o }) => {
1596
1615
  e.string(t), t === "1" && e.string(n ?? "").string(r ? "1" : "0").string(i ? "1" : "0").string(s ?? ""), e.raw(o);
1597
1616
  } }), a({ name: "player-wall.settings-set-request", description: "The player sets who may post on their wall.", direction: "toServer", command: "wss", read: (e) => ({ setting: e.int("setting") }), write: (e, { setting: t }) => e.int(t) }), a({ name: "player-wall.settings-set-result", description: "The server says whether it kept who may post on the player’s wall.", direction: "toClient", command: "wss", read: (e) => ({ ok: e.string("ok") === "1", extra: e.rest() }), write: (e, { ok: t, extra: n }) => e.string(t ? "1" : "0").raw(n) }), a({ name: "player-wall.settings-request", description: "The player asks who may post on someone’s wall.", direction: "toServer", command: "wsg", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "player-wall.settings", description: "The server says who may post on a wall.", direction: "toClient", command: "wsg", read: (e) => ({ setting: e.int("setting"), extra: e.rest() }), write: (e, { setting: t, extra: n }) => e.int(t).raw(n) }), a({ name: "player-wall.parameters-request", description: "The player changes how their wall looks.", direction: "toServer", command: "wps", read: (e) => ({ changes: e.string("changes") }), write: (e, { changes: t }) => e.string(t) }), a({ name: "player-wall.parameters-result", description: "The server says whether it kept how the player’s wall looks.", direction: "toClient", command: "wps", read: (e) => ({ ok: e.string("ok") === "1", extra: e.rest() }), write: (e, { ok: t, extra: n }) => e.string(t ? "1" : "0").raw(n) }), a({ name: "player-wall.visit-request", description: "The player counts a visit to someone’s wall.", direction: "toServer", command: "wci", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "player-wall.visit-result", description: "The server says whether a visit to a wall was counted.", direction: "toClient", command: "wci", read: (e) => ({ ok: e.string("ok") === "1", extra: e.rest() }), write: (e, { ok: t, extra: n }) => e.string(t ? "1" : "0").raw(n) }), a({ name: "resource-array.get-request", description: "The player asks how many have liked a masterpiece or a wall.", direction: "toServer", command: "crg", read: (e) => ({ resourceType: e.string("resourceType"), resourceId: e.string("resourceId"), userUuid: e.string("userUuid"), report: e.string("report") === "report" }), write: (e, { resourceType: t, resourceId: n, userUuid: r, report: i }) => e.string(t).string(n).string(r).string(i ? "report" : "") }), a({ name: "resource-array.get", description: "The server says how many have liked a masterpiece or a wall.", direction: "toClient", command: "crg", read: (e) => ({ ok: e.string("ok") === "1", liked: e.remaining > 0 ? e.string("liked") === "1" : !1, count: e.remaining > 0 ? e.int("count") : 0, extra: e.rest() }), write: (e, { ok: t, liked: n, count: r, extra: i }) => e.string(t ? "1" : "0").string(n ? "1" : "0").int(r).raw(i) }), a({ name: "resource-array.put-request", description: "The player likes a masterpiece or a wall.", direction: "toServer", command: "crp", read: (e) => {
1598
- const t = e.string("resourceType"), n = e.string("resourceId"), r = e.string("userUuid"), i = e.remaining > 0 ? e.string("detail") : null, s = e.remaining > 0 ? Yt(e.string("creator")) : null;
1617
+ const t = e.string("resourceType"), n = e.string("resourceId"), r = e.string("userUuid"), i = e.remaining > 0 ? e.string("detail") : null, s = e.remaining > 0 ? sn(e.string("creator")) : null;
1599
1618
  return { resourceType: t, resourceId: n, userUuid: r, detail: i, creator: s, extra: e.rest() };
1600
1619
  }, write: (e, { resourceType: t, resourceId: n, userUuid: r, detail: i, creator: s, extra: o }) => {
1601
1620
  e.string(t).string(n).string(r), (i !== null || s !== null) && e.string(i ?? ""), s !== null && e.string(`${s.version},${s.creatorUuid},${s.creatorDbId}`), e.raw(o);
1602
1621
  } });
1603
- function Yt(e) {
1622
+ function sn(e) {
1604
1623
  const t = e.split(","), [n = "", r = "", i = ""] = t, s = Number(n), o = Number(i);
1605
1624
  if (t.length !== 3 || n.trim() === "" || i.trim() === "" || !Number.isInteger(s) || !Number.isInteger(o)) throw new u(`resource-array.put-request: field "creator" has "${e}", not <version>,<creatorUUID>,<creatorDbId>`, "PACKET_FIELD");
1606
1625
  return { version: s, creatorUuid: r, creatorDbId: o };
@@ -1609,59 +1628,102 @@ a({ name: "resource-array.put", description: "The server says whether a like was
1609
1628
  } }), a({ name: "referral.code", description: "The server sends the player’s refer a friend code.", direction: "toClient", command: "refc", read: (e) => ({ status: e.int("status"), code: e.remaining > 0 ? e.string("code") : null }), write: (e, { status: t, code: n }) => {
1610
1629
  e.int(t), n !== null && e.string(n);
1611
1630
  } }), a({ name: "referral.has-associate-request", description: "The player asks whether they have named who referred them.", direction: "toServer", command: "refh", read: () => ({}), write: () => {
1612
- } }), a({ name: "referral.has-associate", description: "The server says whether the player has named who referred them.", direction: "toClient", command: "refh", read: (e) => ({ status: e.int("status") }), write: (e, { status: t }) => e.int(t) }), a({ name: "referral.associate", description: "The player names who referred them.", direction: "toServer", command: "refa", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "referral.associate-result", description: "The server says whether the player’s referrer was recorded.", direction: "toClient", command: "refa", read: (e) => ({ status: e.int("status") }), write: (e, { status: t }) => e.int(t) }), a({ name: "referral.list-request", description: "The player asks for the players who joined with their code.", direction: "toServer", command: "refr", read: (e) => ({ page: e.int("page"), pageSize: e.int("pageSize") }), write: (e, { page: t, pageSize: n }) => e.int(t).int(n) }), a({ name: "referral.list", description: "The server sends the players who joined with the player’s code.", direction: "toClient", command: "refr", read: (e) => ({ status: e.int("status"), referrals: e.remaining > 0 ? Qt(e.string("referrals")) : null }), write: (e, { status: t, referrals: n }) => {
1613
- e.int(t), n !== null && e.string(Zt(n));
1631
+ } }), a({ name: "referral.has-associate", description: "The server says whether the player has named who referred them.", direction: "toClient", command: "refh", read: (e) => ({ status: e.int("status") }), write: (e, { status: t }) => e.int(t) }), a({ name: "referral.associate", description: "The player names who referred them.", direction: "toServer", command: "refa", read: (e) => ({ userName: e.string("userName") }), write: (e, { userName: t }) => e.string(t) }), a({ name: "referral.associate-result", description: "The server says whether the player’s referrer was recorded.", direction: "toClient", command: "refa", read: (e) => ({ status: e.int("status") }), write: (e, { status: t }) => e.int(t) }), a({ name: "referral.list-request", description: "The player asks for the players who joined with their code.", direction: "toServer", command: "refr", read: (e) => ({ page: e.int("page"), pageSize: e.int("pageSize") }), write: (e, { page: t, pageSize: n }) => e.int(t).int(n) }), a({ name: "referral.list", description: "The server sends the players who joined with the player’s code.", direction: "toClient", command: "refr", read: (e) => ({ status: e.int("status"), referrals: e.remaining > 0 ? on(e.string("referrals")) : null }), write: (e, { status: t, referrals: n }) => {
1632
+ e.int(t), n !== null && e.string(dn(n));
1614
1633
  } });
1615
- function Qt(e) {
1634
+ function on(e) {
1616
1635
  let t;
1617
1636
  try {
1618
1637
  t = JSON.parse(e);
1619
1638
  } catch {
1620
1639
  throw new u(`referral.list: field "referrals" is not JSON ("${e}")`, "PACKET_FIELD");
1621
1640
  }
1622
- const n = qe(t) ? t.referrals : null;
1623
- return Array.isArray(n) ? n.filter(qe).map((r) => ({ userName: typeof r.name == "string" ? r.name : String(r.name ?? ""), moderatedUserName: "moderatedUserName" in r && r.moderatedUserName !== null ? String(r.moderatedUserName) : null, nameBarData: "namebarData" in r ? Number(r.namebarData) || 0 : null, accountType: typeof r.account_type == "string" ? r.account_type : "" })) : [];
1641
+ const n = De(t) ? t.referrals : null;
1642
+ return Array.isArray(n) ? n.filter(De).map((r) => ({ userName: typeof r.name == "string" ? r.name : String(r.name ?? ""), moderatedUserName: "moderatedUserName" in r && r.moderatedUserName !== null ? String(r.moderatedUserName) : null, nameBarData: "namebarData" in r ? Number(r.namebarData) || 0 : null, accountType: typeof r.account_type == "string" ? r.account_type : "" })) : [];
1624
1643
  }
1625
- function Zt(e) {
1644
+ function dn(e) {
1626
1645
  return JSON.stringify({ referrals: e.map((t) => ({ name: t.userName, ...t.moderatedUserName === null ? {} : { moderatedUserName: t.moderatedUserName }, ...t.nameBarData === null ? {} : { namebarData: t.nameBarData }, account_type: t.accountType })) });
1627
1646
  }
1628
- function qe(e) {
1647
+ function De(e) {
1629
1648
  return typeof e == "object" && e !== null && !Array.isArray(e);
1630
1649
  }
1631
- const en = { roomManager: "room.RoomManagerWorld" }, tn = { none: 0, game: 1, denVolume: 2, splash: 3, storePet: 4, socialGroup: 5, socialEmoticon: 6, guiAction: 7, recycleAccessory: 8, recycleDenItem: 9, triggerWalkIn: 11, genericList: 12, clickEmoticon: 13, air: 14, dynamicCollision: 15, dynamicAir: 16, dynamicPhantomAir: 17, plant: 18, stealth: 19, adventureInteract: 20, darkSoft: 21, darkHard: 22, fallingPhantom: 23 };
1632
- Object.fromEntries(Object.entries(tn).map(([e, t]) => [t, e]));
1633
- function nn(e) {
1650
+ const cn = { roomManager: "room.RoomManagerWorld" }, mn = { none: 0, game: 1, denVolume: 2, splash: 3, storePet: 4, socialGroup: 5, socialEmoticon: 6, guiAction: 7, recycleAccessory: 8, recycleDenItem: 9, triggerWalkIn: 11, genericList: 12, clickEmoticon: 13, air: 14, dynamicCollision: 15, dynamicAir: 16, dynamicPhantomAir: 17, plant: 18, stealth: 19, adventureInteract: 20, darkSoft: 21, darkHard: 22, fallingPhantom: 23 };
1651
+ Object.fromEntries(Object.entries(mn).map(([e, t]) => [t, e]));
1652
+ function un(e) {
1634
1653
  return typeof e == "number" ? e : Number(e) || 0;
1635
1654
  }
1636
- const Ce = { behind: "room_bkg_main", players: "room_avatars", front: "room_fg", over: "room_super_fg", chat: "room_chat", interface: "gui" };
1637
- function sn(e) {
1638
- const t = e.definition(en.roomManager).at("instance", "layerManager"), n = Object.keys(Ce);
1655
+ const Ue = { behind: "room_bkg_main", players: "room_avatars", front: "room_fg", over: "room_super_fg", chat: "room_chat", interface: "gui" };
1656
+ function kn(e) {
1657
+ const t = e.definition(cn.roomManager).at("instance", "layerManager"), n = Object.keys(Ue);
1639
1658
  return Promise.all(n.map(async (r) => {
1640
- const i = Ce[r], s = t.at(i), [o, d] = await Promise.all([s.at("visible").get().catch(() => null), s.at("numChildren").get().catch(() => null)]);
1641
- return { name: r, layer: i, ready: typeof d == "number", children: nn(d), visible: o === !0, place: s };
1659
+ const i = Ue[r], s = t.at(i), [o, d] = await Promise.all([s.at("visible").get().catch(() => null), s.at("numChildren").get().catch(() => null)]);
1660
+ return { name: r, layer: i, ready: typeof d == "number", children: un(d), visible: o === !0, place: s };
1642
1661
  }));
1643
1662
  }
1644
- const rn = [[0, 31], [127, 159], [173, 173], [8203, 8204], [8206, 8207], [8232, 8238], [8288, 8303], [65279, 65279]];
1645
- new RegExp(`[${rn.map(([e, t]) => `${String.fromCharCode(e)}-${String.fromCharCode(t)}`).join("")}]`, "g");
1646
- const x = { shopManager: "shop.ShopManager", shopWindow: "shop.Shop" };
1647
- `${N(x.shopManager)}`, `${N(x.shopWindow)}`, `${N(x.shopWindow)}`, `${N(x.shopWindow)}`, `${N(x.shopWindow)}`, `${N(x.shopWindow)}`;
1648
- function N(e) {
1663
+ const ln = [[0, 31], [127, 159], [173, 173], [8203, 8204], [8206, 8207], [8232, 8238], [8288, 8303], [65279, 65279]];
1664
+ new RegExp(`[${ln.map(([e, t]) => `${String.fromCharCode(e)}-${String.fromCharCode(t)}`).join("")}]`, "g");
1665
+ const pn = { time: "sort1", tail: "sort2", legs: "sort3", back: "sort4", neck: "sort5", head: "sort6" }, We = [{ category: "all", button: "norm", list: "_allNormalDenItems" }, { category: "themes", button: "theme", list: "_themeItems" }, { category: "pets", button: "pet", list: "_petItems" }, { category: "toys", button: "toy", list: "_toyItems" }, { category: "plants", button: "plant", list: "_plantItems" }, { category: "furniture", button: "furniture", list: "_furnitureItems" }, { category: "walls", button: "wall", list: "_wallItems" }];
1666
+ Object.fromEntries(We.map(({ category: e, button: t }) => [e, `_denEditor.${t}BtnUp.visible`]));
1667
+ const hn = { colorsTabDnBtn: { button: "tab", tab: "colors" }, patternTabDnBtn: { button: "tab", tab: "patterns" }, eyesTabDnBtn: { button: "tab", tab: "eyes" } }, gn = { clothesBtnDown: { button: "clothes" }, clothesBtnUp: { button: "clothes" }, tradeBtnDown: { button: "trade" }, tradeBtnUp: { button: "trade" } };
1668
+ Object.fromEntries(Object.entries(pn).map(([e, t]) => [t, { button: "sortBy", sort: e }])), { ...hn, ...gn };
1669
+ const fn = Object.fromEntries(We.map(({ category: e, button: t }) => [`${t}BtnDn`, { button: "tab", category: e }]));
1670
+ ({ ...fn }, { ...Object.fromEntries([1, 2, 3, 4, 5, 6].map((e) => [`win${e}`, { button: "eye" }])), ...Object.fromEntries([1, 2, 3].map((e) => [`lBtn${e}`, { button: "traitPrevious" }])), ...Object.fromEntries([1, 2, 3].map((e) => [`rBtn${e}`, { button: "traitNext" }])) });
1671
+ const vn = { avatarSwitcher: { field: "_avtSwitcher", open: { call: "openAvatarChoose", args: [] }, close: { kind: "destroy" }, hooks: { open: "gui.AvatarSwitcher.init", close: "gui.AvatarSwitcher.destroy" } }, codeRedemption: { field: "_codeRedemptionPopup", open: { call: "openCodeRedemptionPopup", args: [] }, close: { kind: "destroy" }, hooks: { open: "gameRedemption.CodeRedemptionPopup.init", close: "gameRedemption.CodeRedemptionPopup.destroy" } }, dailySpinInfo: { field: "_diamondSpinInfoPopup", onStage: !0, open: { call: "openDailySpinInfoPopup", args: [] }, close: { kind: "handler", call: "onDiamondSpinInfoClose" }, hooks: { open: "gui.GuiManager.onDiamondSpinInfoLoaded", close: "gui.GuiManager.onDiamondSpinInfoClose" } }, demotionMessage: { field: "_demotionMessage", open: { call: "initDemotionMessage", args: [null] }, close: { kind: "destroy" }, hooks: { open: "gui.DemotionMessages.init", close: "gui.DemotionMessages.destroy" } }, denSwitcher: { field: "_denSwitcher", open: { call: "openDenRoomSwitcher", args: [] }, close: { kind: "destroy" }, hooks: { open: "gui.DenSwitcher.init", close: "gui.DenSwitcher.destroy" } }, diamondShopInfo: { field: "_diamondShopInfoPopup", onStage: !0, open: { call: "openDiamondShopInfo", args: [] }, close: { kind: "handler", call: "onDiamondInfoClose" }, hooks: { open: "gui.GuiManager.onDiamondInfoLoaded", close: "gui.GuiManager.onDiamondInfoClose" } }, eBookChooser: { field: "_eBookChooser", open: null, close: { kind: "destroy" }, hooks: { open: "gui.EBookChooser.init", close: "gui.EBookChooser.destroy" } }, holidayBanner: { field: "_holidayBanner", open: { call: "openHolidayBanner", args: [] }, close: { kind: "call", call: "onCloseHolidayBanner", args: [null] }, hooks: { open: "gui.GuiManager.onHolidayBannerLoaded", close: "gui.GuiManager.onCloseHolidayBanner" } }, jammerCentral: { field: "_jammerCentral", open: { call: "openJammerCentral", args: [] }, close: { kind: "destroy" }, hooks: { open: "gui.BulletinBoard.init", close: "gui.BulletinBoard.destroy" } }, joinGames: { field: "_joinGamesPopup", open: { call: "openJoinGamesPopup", args: [] }, close: { kind: "call", call: "closeJoinGamesPopup", args: [] }, hooks: { open: "gui.GameJoinPopup.<constructor>", close: "gui.GameJoinPopup.destroy" } }, journeyBook: { field: "_pageFlip", open: { call: "openJourneyBook", args: [] }, close: { kind: "destroy" }, hooks: { open: "gui.PageFlip.init", close: "gui.PageFlip.destroy" } }, masterpiecePreview: { field: "_masterpiecePreview", open: null, close: { kind: "call", call: "closeMasterpiecePreview", args: [] }, hooks: { open: "gui.MasterpiecePreview.<constructor>", close: "gui.MasterpiecePreview.destroy" } }, museumDonation: { field: "_museumDonation", open: { call: "openMuseumDonation", args: [] }, close: { kind: "destroy" }, hooks: { open: "gui.MuseumDonation.init", close: "gui.MuseumDonation.destroy" } }, petInventory: { field: "_petInventory", open: null, close: { kind: "destroy" }, hooks: { open: "gui.PetInventory.init", close: "gui.PetInventory.destroy" } }, photoBooth: { field: "_photoBooth", open: { call: "openPhotoBooth", args: [] }, close: { kind: "destroy" }, hooks: { open: "gui.PhotoBooth.init", close: "gui.PhotoBooth.destroy" } }, playerEngagement: { field: "_playerEngagement", open: { call: "initPlayerEngagement", args: [null] }, close: { kind: "call", call: "closePlayerEngagement", args: [!1] }, hooks: { open: "gui.PlayerEngagement.init", close: "gui.PlayerEngagement.destroy" } }, reportAPlayer: { field: "_reportAPlayer", open: null, close: { kind: "call", call: "onReportAPlayerClose", args: [!1] }, hooks: { open: "gui.ReportAPlayer.init", close: "gui.ReportAPlayer.destroy" } }, serverSelector: { field: null, open: null, close: { kind: "static", call: "destroy", args: [] }, hooks: { open: "gui.ServerSelector.init", close: "gui.ServerSelector.destroy" } }, settings: { field: "_mySettings", open: null, close: { kind: "destroy" }, hooks: { open: "gui.MySettings.init", close: "gui.MySettings.destroy" } }, startupPopups: { field: "_startupPopups", open: { call: "initMessagePopups", args: [] }, close: { kind: "destroy" }, hooks: { open: "gui.StartupPopups.init", close: "gui.StartupPopups.destroy" } } };
1672
+ Object.keys(vn).sort();
1673
+ function l(e, t, n) {
1674
+ return Object.entries(n).flatMap(([r, i]) => i.map((s) => ({ screen: e, action: r, hook: `${t}.${s}` })));
1675
+ }
1676
+ const In = [...l("achievements", "gui.AchievementViewer", { press: ["winMouseDown"], over: ["winMouseOver"], out: ["winMouseOut"] }), ...l("adventure", "quest.QuestManager", { press: ["adventureMouseDown", "onSelectPlayer"] }), ...l("avatarEditor", "gui.AvatarEditor", { press: ["winMouseClick", "onNamebarBadgeIconDown"], over: ["winMouseOver", "onNamebarBadgeIconOver"], out: ["winMouseOut", "onNamebarBadgeIconOut"], membersOnly: ["memberOnlyDown"] }), ...l("avatarSwitcher", "gui.AvatarSwitcher", { press: ["onItemWindowDown"], over: ["onItemWindowOver"], out: ["onItemWindowOut"] }), ...l("bradyExpeditions", "game.bradyExpeditions.BradyExpeditions", { press: ["chapterSelectDown"] }), ...l("buddyCard", "buddy.BuddyCard", { press: ["winMouseClick", "sideMenuMouseDown"], over: ["winMouseOver", "sideMenuMouseOver"], out: ["winMouseOut", "winMouseSideOut"] }), ...l("buddyList", "buddy.BuddyList", { press: ["buddyListClickOnBuddyHandler", "worldBuddyListClickOnBuddyHandler"], over: ["buddyListOverBuddyHandler"], out: ["buddyListOutBuddyHandler"] }), ...l("chatHistory", "gui.ChatHistory", { press: ["onRepeatChatSelected"] }), ...l("denEditor", "gui.DenEditor", { press: ["winMouseDown"], over: ["winMouseOver"], out: ["winMouseOut"], membersOnly: ["memberOnlyDown", "memberOnlyDownAudio"] }), ...l("denSwitcher", "gui.DenSwitcher", { press: ["onItemWindowDown"], over: ["onItemWindowOver"], out: ["onItemWindowOut"] }), ...l("fashionShow", "game.fashionShow.FashionShowAvatarEditor", { press: ["winMouseClick"], over: ["winMouseOver"], out: ["winMouseOut"] }), ...l("itemSelect", "gui.DenAndClothesItemSelect", { press: ["winMouseDown"], over: ["winMouseOver"], out: ["winMouseOut"] }), ...l("jamAGramInbox", "gui.ECardInbox", { press: ["windowMouseDown"], over: ["windowMouseOver"], out: ["windowMouseOut"] }), ...l("jamAGramWriter", "gui.ECardCreation", { press: ["clickOnBuddyHandler", "eCardBtnDownHandler", "stampBtnDownHandler"], over: ["stampBtnOverHandler"], out: ["stampBtnOutHandler"] }), ...l("joinGames", "gui.GameJoinPopup", { press: ["onIconDown"], over: ["onIconOver"], out: ["onIconOut"] }), ...l("newspaper", "newspaper.NewspaperPopup", { press: ["onIconDown"] }), ...l("parties", "Party.PartyPopup", { press: ["ajWinMouseDown", "customWinMouseDown"] }), ...l("petCreator", "gui.PetCreator", { press: ["chooseMouseDown"], over: ["chooseMouseOver"], out: ["chooseMouseOut"] }), ...l("petInventory", "gui.PetInventory", { press: ["winMouseDown"], over: ["winMouseOver"], out: ["winMouseOut"] }), ...l("playerWall", "playerWall.PlayerWallGui", { press: ["onDecorMouseDown", "onMasterpieceMouseDown", "onNotificationDown", "onSelectPattern", "onStickerMouseDown"] }), ...l("privateAdventure", "gui.PrivateAdventureJoin", { press: ["onWindowDown"], over: ["onWindowOver"], out: ["onWindowOut"] }), ...l("recycle", "gui.RecycleItems", { press: ["onItemWindowDown"], over: ["onItemRollOver"], out: ["onItemRollOut"] }), ...l("referAFriend", "buddy.ReferAFriend", { press: ["referralListClickOnReferralHandler"] }), ...l("serverSelector", "gui.ServerSelector", { press: ["winMouseDown"] }), ...l("shop", "shop.Shop", { press: ["clickOnCharmBuddyHandler"] }), ...l("trade", "gui.TradeManager", { press: ["winMouseDown"], over: ["winMouseOver"], out: ["winMouseOut"] }), ...l("volumeSelector", "gui.VolumeSelector", { press: ["winMouseDown", "adventureMouseDown"] })];
1677
+ [...new Set(In.map(({ screen: e }) => e))].sort();
1678
+ const Ve = { type: ["itemType"], defId: ["defId"], invId: ["invIdx"], name: ["name"], color: ["color"], version: ["version"], recycleValue: ["recycleValue"], membersOnly: ["isMemberOnly"], approved: ["isApproved"], inDenShop: ["isInDenShop"] }, yn = [...ze(["currItem"], Ve), { name: "index", path: ["index"] }, { name: "label", path: ["cir", "currentFrameLabel"] }, { name: "drawn", path: ["_isCurrItemLoaded"] }];
1679
+ yn.map(({ name: e, path: t }) => ({ name: e, path: ["currentTarget", ...t] })), { ...Object.fromEntries(ze(["_currItem"], Ve).map(({ name: e, path: t }) => [e, t])) };
1680
+ function ze(e, t) {
1681
+ return Object.entries(t).map(([n, r]) => ({ name: n, path: [...e, ...r] }));
1682
+ }
1683
+ const K = ["_joinGamePopup", "leaderboards_popup"], wn = 10;
1684
+ [...["thisWeekDown", "buddiesDown", "allTimeDown", "bx", "thisWeekUp", "allTimeUp", "buddiesUp"].map((e) => [...K, e]), ...Array.from({ length: wn + 1 }, (e, t) => [[...K, `p${t + 1}`], [...K, `s${t + 1}`]]).flat()];
1685
+ const b = { itemComm: "item.ItemXtCommManager", shopManager: "shop.ShopManager", shopWindow: "shop.Shop" };
1686
+ `${y(b.shopManager)}`, `${y(b.itemComm)}`, `${y(b.shopWindow)}`, `${y(b.shopWindow)}`, `${y(b.shopWindow)}`, `${y(b.shopWindow)}`, `${y(b.shopWindow)}`, `${y(b.shopManager)}`, `${y(b.shopManager)}`, `${y(b.shopManager)}`, h("shop.Shop._shop"), h("shop.Shop._currShopItemArray"), h("shop.Shop._itemColorsArray"), h("shop.Shop._denItemColorsArray"), h("shop.Shop._itemOffset"), h("shop.Shop._shopNameId"), h("shop.Shop._itemToBuy"), h("shop.Shop._bItemsPurchased"), h("shop.Shop._isMember"), h("shop.Shop._isDenAudioList"), h("shop.Shop._isCombinedCurrencyStore"), h("shop.Shop._isDenSaleShopOwner"), h("shop.Shop._appendString"), h("shop.Shop._recyclePopup"), h("shop.Shop._playerAvatar"), h("shop.Shop._denPreviewManager"), T("gui.DenPreviewManager._buyAndBackBtns"), T("shop.ShopWithPreview._lastItemAdded"), T("shop.BundleShop._bundleShop"), T("shop.BundleShop._diamondCost"), T("shop.BundleShop._shopItemArray"), T("shop.ItemSoldPopup._soldPopup"), T("shop.ItemSoldPopup._shopItem"), T("shop.ItemSoldPopup._soldAmount"), T("shop.ItemSoldPopup._currencyType"), T("shop.ItemSoldPopup._passback");
1687
+ function h(e) {
1688
+ return Ke("protected", e);
1689
+ }
1690
+ function T(e) {
1691
+ return Ke("private", e);
1692
+ }
1693
+ function Ke(e, t) {
1694
+ const n = t.lastIndexOf(".");
1695
+ return `phantom:${e}:${y(t.slice(0, n))}::${t.slice(n + 1)}`;
1696
+ }
1697
+ function y(e) {
1649
1698
  return e.replace(/\./g, ":");
1650
1699
  }
1651
- new Set(Object.values(y));
1652
- class on extends Error {
1700
+ h("collection.BaseTypedCollection.typedItems"), new Set(Object.values(N));
1701
+ const bn = { autoServerTravel: { bit: "SETTINGS_AUTO_SERVER_TRAVEL", fallback: 3, inverted: !1 }, buddyRequests: { bit: "SETTINGS_BUDDY_REQUESTS", fallback: 0, inverted: !1 }, chatPrediction: { bit: "SETTINGS_CHAT_PREDICTION", fallback: 7, inverted: !1 }, denPlayerIcon: { bit: "SETTINGS_DEN_PLAYER_ICON", fallback: 5, inverted: !1 }, doorBell: { bit: "SETTINGS_DOOR_BELL", fallback: 2, inverted: !0 }, gameInvites: { bit: "SETTINGS_GAME_INVITES", fallback: 1, inverted: !1 }, jammerWallIcon: { bit: "SETTINGS_JAMMER_WALL_ICON", fallback: 6, inverted: !1 }, usernameBadge: { bit: "SETTINGS_USERNAME_BADGE", fallback: 4, inverted: !0 } };
1702
+ Object.keys(bn).sort();
1703
+ class Tn extends Error {
1653
1704
  constructor(t, n) {
1654
1705
  super(n), this.code = t, this.name = "PluginError";
1655
1706
  }
1656
1707
  code;
1657
1708
  }
1709
+ class Nn extends Tn {
1710
+ constructor(t, n = []) {
1711
+ super("NOT_READY", t), this.waitingFor = n, this.name = "NotReady";
1712
+ }
1713
+ waitingFor;
1714
+ }
1715
+ function Sn(e) {
1716
+ return (e == null ? void 0 : e.code) === "NOT_READY";
1717
+ }
1658
1718
  export {
1659
- an as C,
1660
- Le as M,
1719
+ xn as C,
1720
+ Oe as M,
1721
+ Nn as N,
1661
1722
  u as P,
1662
- b as X,
1663
- P as a,
1664
- E as b,
1665
- on as c,
1666
- sn as r
1723
+ C as X,
1724
+ $ as a,
1725
+ _ as b,
1726
+ Tn as c,
1727
+ Sn as i,
1728
+ kn as r
1667
1729
  };