@modlock/modlock 0.1.89 → 0.1.91

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -16258,1973 +16258,2270 @@ function endServiceCall(event) {
16258
16258
  done(event.payload);
16259
16259
  }
16260
16260
 
16261
- // js/src/item-id.ts
16262
- function itemId(name) {
16263
- const m = 1540483477;
16264
- const data = new TextEncoder().encode(name);
16265
- const byte = (at3) => data[at3] ?? 0;
16266
- let h = (826366246 ^ data.length) >>> 0;
16267
- let i = 0;
16268
- for (; data.length - i >= 4; i += 4) {
16269
- let k = (byte(i) | byte(i + 1) << 8 | byte(i + 2) << 16 | byte(i + 3) << 24) >>> 0;
16270
- k = Math.imul(k, m) >>> 0;
16271
- k = (k ^ k >>> 24) >>> 0;
16272
- k = Math.imul(k, m) >>> 0;
16273
- h = Math.imul(h, m) >>> 0;
16274
- h = (h ^ k) >>> 0;
16275
- }
16276
- const rest = data.length - i;
16277
- if (rest >= 3) h = (h ^ byte(i + 2) << 16) >>> 0;
16278
- if (rest >= 2) h = (h ^ byte(i + 1) << 8) >>> 0;
16279
- if (rest >= 1) {
16280
- h = (h ^ byte(i)) >>> 0;
16281
- h = Math.imul(h, m) >>> 0;
16282
- }
16283
- h = (h ^ h >>> 13) >>> 0;
16284
- h = Math.imul(h, m) >>> 0;
16285
- return (h ^ h >>> 15) >>> 0;
16261
+ // js/src/format.ts
16262
+ var format_exports = {};
16263
+ __export(format_exports, {
16264
+ clip: () => clip,
16265
+ clock: () => clock,
16266
+ count: () => count,
16267
+ grouped: () => grouped,
16268
+ ordinal: () => ordinal,
16269
+ percent: () => percent,
16270
+ stopwatch: () => stopwatch
16271
+ });
16272
+ function clock(seconds) {
16273
+ const whole = Math.max(0, Math.ceil(seconds));
16274
+ return `${Math.floor(whole / 60)}:${String(whole % 60).padStart(2, "0")}`;
16286
16275
  }
16287
-
16288
- // js/src/ui.ts
16289
- function jsx(type, props, key) {
16290
- const named = key === void 0 ? void 0 : String(key);
16291
- if (typeof type === "function") {
16292
- return { type: fragment, props: { children: type(props) }, key: named };
16276
+ function stopwatch(seconds) {
16277
+ const hundredths = Math.max(0, Math.floor(seconds * 100));
16278
+ const minutes = Math.floor(hundredths / 6e3);
16279
+ const rest = hundredths % 6e3 / 100;
16280
+ return `${minutes}:${rest.toFixed(2).padStart(5, "0")}`;
16281
+ }
16282
+ function percent(part, whole) {
16283
+ if (!(whole > 0)) {
16284
+ return "-";
16293
16285
  }
16294
- return { type, props, key: named };
16286
+ return `${Math.round(Math.max(0, Math.min(part / whole, 1)) * 100)}%`;
16295
16287
  }
16296
- var fragment = "fragment";
16297
- var jsxs = jsx;
16298
- function Fragment(props) {
16299
- return props.children;
16288
+ function grouped(value) {
16289
+ return String(Math.round(value)).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
16300
16290
  }
16301
- function show(player, root) {
16302
- views.set(player.slot, { ...view(player), root });
16303
- return draw(player);
16291
+ function ordinal(place2) {
16292
+ const tens = place2 % 100;
16293
+ const suffix = tens >= 11 && tens <= 13 ? "th" : ["th", "st", "nd", "rd"][place2 % 10] ?? "th";
16294
+ return `${place2}${suffix}`;
16304
16295
  }
16305
- function hideHud(player, parts) {
16306
- views.set(player.slot, { ...view(player), hud: parts });
16307
- return draw(player);
16296
+ function count(number, thing, plural = `${thing}s`) {
16297
+ return `${grouped(number)} ${number === 1 ? thing : plural}`;
16308
16298
  }
16309
- function freeCursor(player, free) {
16310
- const current = view(player);
16311
- views.set(player.slot, {
16312
- ...current,
16313
- cursor: free,
16314
- asks: free ? current.asks + 1 : current.asks
16315
- });
16316
- return draw(player);
16299
+ function clip(text2, width) {
16300
+ if (text2.length <= width) return text2;
16301
+ const cut = text2.slice(0, width - 1);
16302
+ const space = cut.lastIndexOf(" ");
16303
+ return `${(space > 0 ? cut.slice(0, space) : cut).trimEnd()}\u2026`;
16317
16304
  }
16318
- function abilityBarPresses(player, onPress) {
16319
- views.set(player.slot, {
16320
- ...view(player),
16321
- bar: onPress ? { handler: onPress } : void 0
16322
- });
16323
- return draw(player);
16305
+
16306
+ // js/src/theme.ts
16307
+ var theme_exports = {};
16308
+ __export(theme_exports, {
16309
+ emptyPip: () => emptyPip,
16310
+ fpsReadoutBottom: () => fpsReadoutBottom,
16311
+ motion: () => motion,
16312
+ objectiveBarBottom: () => objectiveBarBottom,
16313
+ pillEdge: () => pillEdge,
16314
+ pipRings: () => pipRings,
16315
+ pipShapes: () => pipShapes,
16316
+ plate: () => plate,
16317
+ shades: () => shades,
16318
+ sizes: () => sizes,
16319
+ sounds: () => sounds,
16320
+ teamBarBottom: () => teamBarBottom,
16321
+ teamTones: () => teamTones,
16322
+ tones: () => tones,
16323
+ types: () => types
16324
+ });
16325
+ var tones = {
16326
+ text: "#ffefd7",
16327
+ muted: "#bfb3a1",
16328
+ // The accent marks the player's own choices.
16329
+ accent: "#fd736d",
16330
+ // Text on an accent fill.
16331
+ onAccent: "#070709",
16332
+ amber: "#d4860b",
16333
+ sapphire: "#4d75c3",
16334
+ // The gas of a closing arena.
16335
+ gas: "#3ee08f",
16336
+ // Done, under par, ready and live: a step darker than gas, so status text
16337
+ // and tags sit calmer on the plates.
16338
+ success: "#36c47f",
16339
+ danger: "#ff410d",
16340
+ gold: "#ebc934"
16341
+ };
16342
+ var teamTones = {
16343
+ 2: "amber",
16344
+ 3: "sapphire"
16345
+ };
16346
+ var shades = {
16347
+ /** offWhite at about half strength: idle navigation and secondary text. */
16348
+ quiet: "#ffefd78c",
16349
+ /** offWhite at the popup button's 44%: idle pill borders. */
16350
+ faint: "#ffefd770",
16351
+ /** offWhite at about 40%: counts, placeholders and offline players. */
16352
+ dim: "#6b675d",
16353
+ /** offWhite at 13%: hairlines between sections and plate edges. */
16354
+ hairline: "#2b2a24",
16355
+ /** offBlack: text on light fills, and the backdrop's hue. */
16356
+ ink: "#10130d",
16357
+ /** The menu backdrop: an opaque offBlack that hides the stock menu. */
16358
+ backdrop: "#0b0d09",
16359
+ /** The backdrop at 95%, under a panel the player reads over the game. */
16360
+ veil: "#0b0d09f2",
16361
+ /** offWhite at 4%: a plate on the backdrop. */
16362
+ plate: "#151611",
16363
+ /** offWhite at 8%: a row or stat inside a plate. */
16364
+ raised: "#1e1f19",
16365
+ /** offWhite at 13%: a hovered or joined row. */
16366
+ lit: "#2b2a24",
16367
+ /** The full-strength fill of a lit primary button. */
16368
+ white: "#ffffff",
16369
+ /** No fill or border, where a state turns one off. */
16370
+ clear: "#00000000"
16371
+ };
16372
+ var sizes = {
16373
+ /** control is the height of panel buttons and fields. */
16374
+ control: 32,
16375
+ /** rowControl is the height of a button inside a list row. */
16376
+ rowControl: 28,
16377
+ /** row is the height of one list row. */
16378
+ row: 32,
16379
+ /** radius rounds buttons, fields and tags. */
16380
+ radius: 4,
16381
+ /** panelRadius rounds panels. */
16382
+ panelRadius: 8
16383
+ };
16384
+ var types = {
16385
+ display: { face: "block", size: 46, uppercase: true },
16386
+ title: { face: "block", size: 26, uppercase: true },
16387
+ body: { face: "body", size: 17, uppercase: false },
16388
+ label: { face: "block", size: 15, uppercase: true },
16389
+ caption: { face: "body", size: 14, uppercase: false }
16390
+ };
16391
+ var plate = {
16392
+ color: "#000000e0",
16393
+ radius: 5,
16394
+ /** padding is [vertical, horizontal] in pixels. */
16395
+ padding: [10, 18]
16396
+ };
16397
+ var pillEdge = "#ffefd71a";
16398
+ var pipShapes = {
16399
+ round: { width: 18, height: 18, radius: 9 },
16400
+ tick: { width: 7, height: 18, radius: 2 }
16401
+ };
16402
+ var pipRings = { empty: "#ffefd72e", filled: "#10130de6" };
16403
+ var emptyPip = "#00000000";
16404
+ var teamBarBottom = 84;
16405
+ var objectiveBarBottom = 220;
16406
+ var fpsReadoutBottom = 68;
16407
+ var sounds = {
16408
+ hover: "UI.MainMenu.Hover",
16409
+ press: "UI.MainMenu.Activate"
16410
+ };
16411
+ var motion = { hover: 0.15, meter: 0.25 };
16412
+
16413
+ // js/src/hud.ts
16414
+ function element(type, style, children, key) {
16415
+ return { type, props: { style, children }, key };
16324
16416
  }
16325
- function abilityDisplay(viewer, rows = []) {
16326
- views.set(viewer.slot, { ...view(viewer), display: rows.slice(0, 64) });
16327
- return draw(viewer);
16417
+ function arriving(component, from) {
16418
+ return {
16419
+ ...component,
16420
+ props: {
16421
+ ...component.props,
16422
+ style: {
16423
+ transition: { seconds: 0.25, easing: "out" },
16424
+ ...component.props.style
16425
+ },
16426
+ enter: { opacity: 0, ...from },
16427
+ exit: { opacity: 0 }
16428
+ }
16429
+ };
16328
16430
  }
16329
- function displayRows(viewer, rows) {
16330
- if (rows.length === 0) return [];
16331
- const names = new Map(players().map((c) => [c.player.slot, c.name]));
16332
- return rows.map((row2) => {
16333
- const hero = row2.player.pawn()?.hero;
16334
- return {
16335
- player: row2.player.slot,
16336
- // A Steam name is at most 32 characters, within the host's 128 bytes.
16337
- name: (names.get(row2.player.slot) ?? "").slice(0, 32),
16338
- hero: heroes.find((each) => each.id === hero)?.name ?? "",
16339
- own: row2.player.slot === viewer.slot,
16340
- abilities: row2.abilities.slice(0, 4).map((shown) => ({
16341
- ability: shown?.name ? itemId(shown.name) : 0,
16342
- image: shown?.image ?? "",
16343
- upgrades: shown?.upgrades ?? 0
16344
- }))
16345
- };
16346
- });
16431
+ function Text(props) {
16432
+ const type = types[props.role];
16433
+ return element(
16434
+ "label",
16435
+ {
16436
+ face: type.face,
16437
+ fontSize: type.size,
16438
+ uppercase: type.uppercase,
16439
+ shadow: !props.plated,
16440
+ color: tones[props.tone ?? (props.role === "label" ? "muted" : "text")],
16441
+ horizontalAlign: "center",
16442
+ textAlign: "center",
16443
+ ...props.style
16444
+ },
16445
+ props.children
16446
+ );
16347
16447
  }
16348
- var abilityBarNode = /^ability:([0-3])$/;
16349
- function cursorFree(player) {
16350
- const pawn = player.pawn();
16351
- if (pawn === void 0) return void 0;
16352
- return readField(
16353
- pawn.entity,
16354
- "CCitadelPlayer_MovementServices",
16355
- "m_bHasFreeCursor",
16356
- "bool"
16448
+ function Plate(props) {
16449
+ return element(
16450
+ "panel",
16451
+ {
16452
+ flow: props.flow ?? "down",
16453
+ horizontalAlign: "center",
16454
+ background: plate.color,
16455
+ borderRadius: plate.radius,
16456
+ padding: plate.padding,
16457
+ ...props.style
16458
+ },
16459
+ props.children
16357
16460
  );
16358
16461
  }
16359
- function sheet(path) {
16360
- if (!path.endsWith(".css") || !path.split("/").every((part) => sheetPart.test(part) && part !== "..")) {
16361
- return false;
16362
- }
16363
- if (sheets.includes(path)) {
16364
- return true;
16365
- }
16366
- sheets.push(path);
16367
- for (const current of views.values()) {
16368
- draw(current.player);
16369
- }
16370
- return true;
16462
+ function Pill(props) {
16463
+ return element(
16464
+ "panel",
16465
+ {
16466
+ flow: props.flow ?? "right",
16467
+ horizontalAlign: "center",
16468
+ background: plate.color,
16469
+ borderRadius: 50,
16470
+ borderWidth: 2,
16471
+ borderColor: pillEdge,
16472
+ padding: [3, 6],
16473
+ ...props.style
16474
+ },
16475
+ props.children
16476
+ );
16371
16477
  }
16372
- var sheetPart = /^[\w.-]+$/;
16373
- var sheets = [];
16374
- function route(player, name, value) {
16375
- const routes = new Map(view(player).routes);
16376
- const encoded = value === void 0 ? void 0 : JSON.stringify(value);
16377
- if (!routeName.test(name) || value !== void 0 && encoded === void 0) {
16378
- return false;
16379
- }
16380
- if (encoded === void 0) {
16381
- routes.delete(name);
16382
- } else {
16383
- routes.set(name, encoded);
16384
- }
16385
- views.set(player.slot, { ...view(player), routes });
16386
- return draw(player);
16478
+ function Pips(props) {
16479
+ const shape = pipShapes[props.shape ?? "round"];
16480
+ const lit = (index) => props.mirror ? index >= props.total - props.filled : index < props.filled;
16481
+ return element(
16482
+ "panel",
16483
+ { flow: "right", verticalAlign: "center", ...props.style },
16484
+ Array.from(
16485
+ { length: props.total },
16486
+ (_, index) => element(
16487
+ "panel",
16488
+ {
16489
+ width: shape.width,
16490
+ height: shape.height,
16491
+ borderRadius: shape.radius,
16492
+ margin: [0, 2],
16493
+ background: lit(index) ? tones[props.tone] : emptyPip,
16494
+ borderWidth: 2,
16495
+ borderColor: lit(index) ? pipRings.filled : pipRings.empty
16496
+ },
16497
+ void 0,
16498
+ `pip-${index}`
16499
+ )
16500
+ )
16501
+ );
16387
16502
  }
16388
- var routeName = /^[\w.-]+$/;
16389
- function hide(player) {
16390
- views.delete(player.slot);
16391
- screens.delete(player.slot);
16392
- return send(player.slot, { reset: true });
16503
+ function Tag(props) {
16504
+ const filled = props.fill === "filled";
16505
+ return element(
16506
+ "label",
16507
+ {
16508
+ face: "block",
16509
+ fontSize: 12,
16510
+ letterSpacing: 1,
16511
+ uppercase: true,
16512
+ color: filled ? tones.onAccent : tones[props.tone],
16513
+ background: filled ? tones[props.tone] : void 0,
16514
+ borderWidth: 1,
16515
+ borderColor: tones[props.tone],
16516
+ borderRadius: sizes.radius,
16517
+ padding: [4, 8],
16518
+ verticalAlign: "center",
16519
+ ...props.style
16520
+ },
16521
+ props.children
16522
+ );
16393
16523
  }
16394
- function toast(player, text2, seconds = 4) {
16395
- const current = view(player);
16396
- const notice = { id: nextNotice++, text: text2, until: now2 + seconds };
16397
- views.set(player.slot, {
16398
- ...current,
16399
- notices: [...current.notices, notice].slice(-maxNotices)
16400
- });
16401
- return draw(player);
16524
+ function Banner(props) {
16525
+ const banner = element(
16526
+ "panel",
16527
+ {
16528
+ flow: "down",
16529
+ horizontalAlign: "center",
16530
+ margin: [20, 0, 0, 0],
16531
+ ...props.style
16532
+ },
16533
+ [
16534
+ Text({ role: "title", tone: props.tone, children: props.title }),
16535
+ props.detail && Text({ role: "caption", tone: "muted", children: props.detail })
16536
+ ]
16537
+ );
16538
+ return arriving(banner, { scale: 0.92 });
16402
16539
  }
16403
- function uiSound(player, sound, options = {}) {
16404
- const current = view(player);
16405
- const cue = { number: nextCue++, sound, seconds: options.seconds ?? 0 };
16406
- views.set(player.slot, {
16407
- ...current,
16408
- cues: [...current.cues, cue].slice(-maxCues)
16540
+ function TopStrip(props) {
16541
+ const block2 = [
16542
+ props.heading && Text({
16543
+ role: "label",
16544
+ style: { letterSpacing: 1 },
16545
+ children: props.heading
16546
+ }),
16547
+ Pill({ style: { margin: [4, 0, 0, 0] }, children: props.children })
16548
+ ];
16549
+ const line2 = props.line && Text({
16550
+ role: "label",
16551
+ tone: props.lineTone ?? "text",
16552
+ style: { margin: [4, 0, 0, 0], fontSize: 18, letterSpacing: 1 },
16553
+ children: props.line
16409
16554
  });
16410
- return draw(player);
16555
+ const column = (top, children) => element(
16556
+ "panel",
16557
+ { flow: "down", horizontalAlign: "center", margin: [top, 0, 0, 0] },
16558
+ children
16559
+ );
16560
+ if (!props.keepTeamBar) return column(14, [...block2, line2]);
16561
+ return element("panel", { width: "fill", height: "fill" }, [
16562
+ column(teamBarBottom, block2),
16563
+ line2 && column(objectiveBarBottom, line2)
16564
+ ]);
16411
16565
  }
16412
- function press(player, node, action = "", payload = "") {
16413
- if (action !== "") {
16414
- const pressed2 = screens.get(player.slot)?.actions.get(node);
16415
- if (pressed2) {
16416
- let value = void 0;
16417
- try {
16418
- value = payload === "" ? void 0 : JSON.parse(payload);
16419
- } catch {
16420
- value = void 0;
16421
- }
16422
- pressed2.handler(player, action, value);
16423
- }
16424
- return;
16425
- }
16426
- const bar = abilityBarNode.exec(node);
16427
- if (bar) {
16428
- views.get(player.slot)?.bar?.handler(player, Number(bar[1]));
16429
- return;
16430
- }
16431
- const pressed = screens.get(player.slot)?.presses.get(node);
16432
- if (pressed) {
16433
- pressed.handler(player);
16434
- }
16566
+ function Score2(props) {
16567
+ const [near, far] = props.tones ?? ["accent", "text"];
16568
+ const side = (points, tone) => Text({
16569
+ role: "title",
16570
+ tone,
16571
+ plated: true,
16572
+ style: { margin: [0, 10], horizontalAlign: void 0 },
16573
+ children: `${points}`
16574
+ });
16575
+ return element("panel", { flow: "right", verticalAlign: "center" }, [
16576
+ side(props.points[0], near),
16577
+ Text({
16578
+ role: "title",
16579
+ tone: "muted",
16580
+ plated: true,
16581
+ style: { horizontalAlign: void 0 },
16582
+ children: ":"
16583
+ }),
16584
+ side(props.points[1], far)
16585
+ ]);
16435
16586
  }
16436
- function change(player, node, value) {
16437
- if (typeof value === "object" && value !== null) {
16438
- screens.get(player.slot)?.wheels.get(node)?.handler(player, value);
16439
- return;
16440
- }
16441
- const changed = screens.get(player.slot)?.changes.get(node);
16442
- if (changed) {
16443
- changed.handler(player, value);
16444
- }
16587
+ var rosterRows = 6;
16588
+ var rosterName = 24;
16589
+ var portraitSize = 44;
16590
+ var badgeSize = 18;
16591
+ var portraits = new Map(heroes.map((hero) => [hero.id, hero.portrait]));
16592
+ function rosterKey(rows) {
16593
+ return rows.slice(0, rosterRows).map(
16594
+ (row2) => `${row2.self ? "*" : ""}${row2.selected ? "+" : ""}${row2.onPress ? ">" : ""}${row2.name} ${row2.hero} ${row2.activity} ${row2.steamId ?? ""}`
16595
+ ).join("\n");
16445
16596
  }
16446
- function tick(seconds) {
16447
- now2 = seconds;
16448
- for (const current of views.values()) {
16449
- if (!current.notices.some((notice) => notice.until <= now2)) {
16450
- continue;
16451
- }
16452
- current.notices = current.notices.filter((notice) => notice.until > now2);
16453
- draw(current.player);
16454
- }
16597
+ function Roster(props) {
16598
+ if (props.rows.length === 0) return null;
16599
+ return element(
16600
+ "panel",
16601
+ {
16602
+ width: "fit",
16603
+ height: "fit",
16604
+ flow: "down",
16605
+ horizontalAlign: "right",
16606
+ verticalAlign: "top",
16607
+ margin: [props.top ?? fpsReadoutBottom, 24, 0, 0]
16608
+ },
16609
+ props.rows.slice(0, rosterRows).map(rosterRow)
16610
+ );
16455
16611
  }
16456
- var views = /* @__PURE__ */ new Map();
16457
- var now2 = 0;
16458
- var nextNotice = 0;
16459
- var nextCue = 1;
16460
- var maxCues = 8;
16461
- var maxNotices = 4;
16462
- var noticeMotion = {
16463
- enter: { opacity: 0, translate: [-16, 0] },
16464
- exit: { opacity: 0 },
16465
- transition: { seconds: 0.25, easing: "out" }
16466
- };
16467
- function view(player) {
16468
- return views.get(player.slot) ?? {
16469
- player,
16470
- root: void 0,
16471
- hud: [],
16472
- cursor: false,
16473
- asks: 0,
16474
- routes: /* @__PURE__ */ new Map(),
16475
- cues: [],
16476
- bar: void 0,
16477
- display: [],
16478
- notices: []
16479
- };
16480
- }
16481
- function draw(player) {
16482
- const current = view(player);
16483
- const root = [
16484
- current.root,
16485
- current.notices.length !== 0 && notices(current.notices)
16486
- ];
16487
- const previous = screens.get(player.slot);
16488
- const hud = current.hud.map((part) => hudParts[part]);
16489
- const display = displayRows(player, current.display);
16490
- const next = render(
16491
- previous,
16492
- root,
16493
- hud,
16494
- current.cursor,
16495
- current.asks,
16496
- current.routes,
16497
- current.cues,
16498
- current.bar !== void 0,
16499
- display
16612
+ function rosterRow(row2, index) {
16613
+ const right = { horizontalAlign: "right", textAlign: "right" };
16614
+ const text2 = element(
16615
+ "panel",
16616
+ { flow: "down", verticalAlign: "center", margin: [0, 12, 0, 0] },
16617
+ [
16618
+ Text({
16619
+ role: "label",
16620
+ tone: "text",
16621
+ style: right,
16622
+ children: clip(row2.name.toUpperCase(), rosterName)
16623
+ }),
16624
+ Text({
16625
+ role: "caption",
16626
+ tone: "muted",
16627
+ style: { ...right, margin: [1, 0, 0, 0] },
16628
+ children: row2.activity
16629
+ })
16630
+ ]
16631
+ );
16632
+ const src = portraits.get(row2.hero);
16633
+ const badge = row2.steamId === void 0 ? false : avatarBadge(row2.steamId);
16634
+ const image = src === void 0 ? false : portraitImage(src);
16635
+ const portrait = element(
16636
+ "panel",
16637
+ {
16638
+ width: portraitSize,
16639
+ height: portraitSize,
16640
+ padding: 1,
16641
+ verticalAlign: "center",
16642
+ background: row2.self || row2.selected ? tones.accent : shades.dim
16643
+ },
16644
+ element(
16645
+ "panel",
16646
+ { width: "100%", height: "100%", background: shades.raised },
16647
+ [image, badge]
16648
+ )
16500
16649
  );
16501
- const change2 = diff(previous, next);
16502
- if (change2 && !send(player.slot, change2)) {
16503
- const whole = render(
16504
- void 0,
16505
- root,
16506
- hud,
16507
- current.cursor,
16508
- current.asks,
16509
- current.routes,
16510
- current.cues,
16511
- current.bar !== void 0,
16512
- display
16513
- );
16514
- if (!send(player.slot, diff(void 0, whole))) {
16515
- screens.delete(player.slot);
16516
- return false;
16517
- }
16518
- screens.set(player.slot, whole);
16519
- return true;
16520
- }
16521
- screens.set(player.slot, next);
16522
- return true;
16523
- }
16524
- function notices(stack) {
16525
16650
  const style = {
16526
- width: "fit",
16527
- height: "fit",
16528
- flow: "down",
16529
- horizontalAlign: "left",
16530
- verticalAlign: "bottom",
16531
- margin: [0, 0, 260, 24],
16532
- transition: noticeMotion.transition
16651
+ flow: "right",
16652
+ horizontalAlign: "right",
16653
+ margin: [0, 0, 8, 0]
16533
16654
  };
16534
- const labels = stack.map(
16535
- (notice) => jsx(
16536
- "label",
16537
- {
16538
- style: {
16539
- horizontalAlign: "left",
16540
- margin: [4, 0, 0, 0],
16541
- padding: [5, 10],
16542
- background: "#101418d8",
16543
- color: "#f2f2f2",
16544
- fontSize: 16,
16545
- borderRadius: 4,
16546
- transition: noticeMotion.transition
16547
- },
16548
- enter: noticeMotion.enter,
16549
- exit: noticeMotion.exit,
16550
- children: notice.text
16655
+ const line2 = row2.onPress ? {
16656
+ type: "button",
16657
+ props: {
16658
+ style: {
16659
+ ...style,
16660
+ borderRadius: sizes.radius,
16661
+ transition: motion.hover
16551
16662
  },
16552
- notice.id
16553
- )
16554
- );
16555
- return jsx("panel", { style, exit: noticeMotion.exit, children: labels });
16663
+ hover: { background: shades.raised },
16664
+ hoverSound: sounds.hover,
16665
+ sound: sounds.press,
16666
+ onPress: row2.onPress,
16667
+ children: [text2, portrait]
16668
+ },
16669
+ key: `row-${index}`
16670
+ } : element("panel", style, [text2, portrait], `row-${index}`);
16671
+ return arriving(line2, { translate: [16, 0] });
16556
16672
  }
16557
- var screens = /* @__PURE__ */ new Map();
16558
- function render(previous, root, hud, cursor, asks, routes, cues, bar, display) {
16559
- const layout = new Layout(previous);
16560
- layout.add({
16561
- id: "",
16562
- kind: 0 /* PANEL */,
16563
- children: place(layout, root, "/"),
16564
- hideHud: [...hud],
16565
- freeCursor: cursor,
16566
- freeCursorAsks: asks,
16567
- sheets: [...sheets],
16568
- cues: [...cues],
16569
- abilityBarPresses: bar,
16570
- abilityDisplay: [...display]
16571
- });
16572
- for (const [name, data] of routes) {
16573
- layout.add({ id: `route:${name}`, kind: 5 /* ROUTE */, route: name, data });
16574
- }
16575
- return layout.screen;
16673
+ function portraitImage(src) {
16674
+ return {
16675
+ type: "image",
16676
+ props: { src, style: { width: "100%", height: "100%" } }
16677
+ };
16576
16678
  }
16577
- var Layout = class {
16578
- screen;
16579
- previous;
16580
- /** The layout continues previous's id counter and keeps its ids. */
16581
- constructor(previous) {
16582
- this.previous = previous;
16583
- this.screen = {
16584
- nodes: /* @__PURE__ */ new Map(),
16585
- ids: /* @__PURE__ */ new Map(),
16586
- presses: /* @__PURE__ */ new Map(),
16587
- changes: /* @__PURE__ */ new Map(),
16588
- actions: /* @__PURE__ */ new Map(),
16589
- wheels: /* @__PURE__ */ new Map(),
16590
- next: previous?.next ?? 0
16591
- };
16592
- }
16593
- /** add records a node. */
16594
- add(node) {
16595
- const value = node.steamId === void 0 ? node : { ...node, steamId: String(node.steamId) };
16596
- const encoded = JSON.stringify(value);
16597
- this.screen.nodes.set(node.id, { node, encoded });
16598
- }
16599
- /** id returns the node id for the element at place. */
16600
- id(place2) {
16601
- let found = this.previous?.ids.get(place2);
16602
- if (found === void 0) {
16603
- found = (this.screen.next++).toString(36);
16679
+ function avatarBadge(steamId) {
16680
+ return {
16681
+ type: "avatar",
16682
+ props: {
16683
+ steamId,
16684
+ style: {
16685
+ width: badgeSize,
16686
+ height: badgeSize,
16687
+ horizontalAlign: "left",
16688
+ verticalAlign: "bottom",
16689
+ borderRadius: badgeSize / 2,
16690
+ borderWidth: 1,
16691
+ borderColor: shades.dim
16692
+ }
16604
16693
  }
16605
- this.screen.ids.set(place2, found);
16606
- return found;
16694
+ };
16695
+ }
16696
+ var actionLooks = {
16697
+ primary: {
16698
+ idle: { background: tones.text },
16699
+ hover: { background: shades.white },
16700
+ text: shades.ink
16701
+ },
16702
+ secondary: {
16703
+ idle: {
16704
+ background: shades.raised,
16705
+ borderWidth: 1,
16706
+ borderColor: shades.faint
16707
+ },
16708
+ hover: { background: shades.lit, borderColor: tones.text },
16709
+ text: tones.text
16710
+ },
16711
+ quiet: {
16712
+ idle: { background: shades.clear },
16713
+ hover: { background: shades.raised },
16714
+ text: shades.quiet
16607
16715
  }
16608
16716
  };
16609
- function place(layout, child, at3) {
16610
- if (child === null || child === void 0 || typeof child === "boolean") {
16611
- return [];
16612
- }
16613
- if (isList(child)) {
16614
- return child.flatMap((item2, index) => {
16615
- const key = isElement(item2) ? item2.key : void 0;
16616
- return place(
16617
- layout,
16618
- item2,
16619
- key === void 0 ? `${at3},${index}` : `${at3},=${key}`
16620
- );
16621
- });
16622
- }
16623
- if (!isElement(child)) {
16624
- const node2 = {
16625
- id: layout.id(at3),
16626
- kind: 1 /* LABEL */,
16627
- text: String(child)
16628
- };
16629
- layout.add(node2);
16630
- return [node2.id];
16631
- }
16632
- if (child.type === fragment) {
16633
- return place(layout, child.props.children, `${at3}>`);
16634
- }
16635
- const props = child.props;
16636
- const node = {
16637
- id: layout.id(at3),
16638
- style: wireStyle(props.style),
16639
- hover: wireStyle(props.hover),
16640
- tooltip: props.tooltip,
16641
- item: props.item ? itemId(props.item) : void 0,
16642
- ability: props.ability?.name ? itemId(props.ability.name) : void 0,
16643
- abilityPlayer: props.ability?.name ? props.ability.player.slot : void 0,
16644
- hoverSound: props.hoverSound,
16645
- enter: wireStyle(props.enter),
16646
- exit: wireStyle(props.exit),
16647
- cycle: cycle(props.cycle),
16648
- classes: classes(props.class)
16649
- };
16650
- switch (child.type) {
16651
- case "label":
16652
- node.kind = 1 /* LABEL */;
16653
- node.text = text(props.children);
16654
- node.token = props.token;
16655
- node.variables = variables(props.variables);
16656
- break;
16657
- case "avatar":
16658
- node.kind = 8 /* AVATAR */;
16659
- node.steamId = props.steamId;
16660
- break;
16661
- case "entry":
16662
- case "slider":
16663
- case "toggle":
16664
- case "dropdown":
16665
- input(layout, node, child.type, props);
16666
- break;
16667
- case "image":
16668
- node.kind = 2 /* IMAGE */;
16669
- node.image = props.src ?? "";
16670
- node.scaling = scaling(props.scaling);
16671
- break;
16672
- case "hero":
16673
- node.kind = 6 /* HERO_IMAGE */;
16674
- node.hero = props.hero;
16675
- node.heroLook = props.look === void 0 ? void 0 : looks[props.look];
16676
- node.scaling = scaling(props.scaling);
16677
- break;
16678
- case "button":
16679
- node.kind = 3 /* BUTTON */;
16680
- node.sound = props.sound;
16681
- node.disabled = props.disabled;
16682
- if (props.onPress && !props.disabled) {
16683
- layout.screen.presses.set(node.id, { handler: props.onPress });
16684
- }
16685
- node.children = place(layout, props.children, `${at3}/`);
16686
- break;
16687
- case "layout":
16688
- node.kind = 4 /* LAYOUT */;
16689
- node.layout = props.src ?? "";
16690
- node.data = props.data === void 0 ? "" : JSON.stringify(props.data) ?? "";
16691
- if (props.onAction) {
16692
- layout.screen.actions.set(node.id, { handler: props.onAction });
16693
- }
16694
- break;
16695
- default:
16696
- node.kind = 0 /* PANEL */;
16697
- node.children = place(layout, props.children, `${at3}/`);
16698
- }
16699
- layout.add(node);
16700
- return [node.id];
16701
- }
16702
- function classes(names) {
16703
- const list = (names ?? "").split(" ").filter((name) => name !== "");
16704
- return list.length === 0 ? void 0 : list;
16705
- }
16706
- function input(layout, node, kind, props) {
16707
- node.kind = 7 /* INPUT */;
16708
- node.disabled = props.disabled;
16709
- if (props.onChange && !props.disabled) {
16710
- layout.screen.changes.set(node.id, { handler: props.onChange });
16711
- }
16712
- switch (kind) {
16713
- case "entry":
16714
- node.input = {
16715
- case: "textEntry",
16716
- value: {
16717
- text: String(props.value ?? ""),
16718
- placeholder: props.placeholder,
16719
- maxLength: props.maxLength
16720
- }
16721
- };
16722
- break;
16723
- case "slider":
16724
- if (props.onWheel && !props.disabled) {
16725
- layout.screen.wheels.set(node.id, { handler: props.onWheel });
16726
- }
16727
- node.input = {
16728
- case: "slider",
16729
- value: {
16730
- value: Number(props.value ?? 0),
16731
- min: props.min,
16732
- max: props.max,
16733
- step: props.step,
16734
- wheel: !!props.onWheel && !props.disabled
16735
- }
16736
- };
16737
- break;
16738
- case "toggle":
16739
- node.text = text(props.children);
16740
- node.input = { case: "toggle", value: { on: props.on } };
16741
- break;
16742
- case "dropdown":
16743
- node.input = {
16744
- case: "dropdown",
16745
- value: {
16746
- options: [...props.options ?? []],
16747
- selected: props.selected
16748
- }
16749
- };
16750
- }
16751
- }
16752
- function variables(value) {
16753
- if (!value) {
16754
- return void 0;
16755
- }
16756
- const encoded = {};
16757
- for (const [name, filled] of Object.entries(value)) {
16758
- encoded[name] = String(filled);
16759
- }
16760
- return encoded;
16761
- }
16762
- function cycle(value) {
16763
- if (!value) {
16764
- return void 0;
16765
- }
16717
+ function Action(props) {
16718
+ const look = actionLooks[props.kind ?? "secondary"];
16719
+ const label = element(
16720
+ "label",
16721
+ {
16722
+ face: "block",
16723
+ fontSize: 16,
16724
+ uppercase: true,
16725
+ letterSpacing: 1,
16726
+ color: look.text,
16727
+ horizontalAlign: "center",
16728
+ verticalAlign: "center",
16729
+ noWrap: true
16730
+ },
16731
+ props.children
16732
+ );
16766
16733
  return {
16767
- style: wireStyle(value.style),
16768
- seconds: value.seconds,
16769
- count: value.count
16734
+ type: "button",
16735
+ props: {
16736
+ style: {
16737
+ height: sizes.control,
16738
+ padding: [0, 14],
16739
+ borderRadius: sizes.radius,
16740
+ transition: motion.hover,
16741
+ ...look.idle,
16742
+ ...props.disabled ? { opacity: 0.4 } : {},
16743
+ ...props.style
16744
+ },
16745
+ hover: props.disabled ? void 0 : look.hover,
16746
+ hoverSound: props.disabled ? void 0 : sounds.hover,
16747
+ sound: sounds.press,
16748
+ disabled: props.disabled,
16749
+ onPress: props.onPress,
16750
+ children: label
16751
+ }
16770
16752
  };
16771
16753
  }
16772
- function diff(previous, next) {
16773
- const set = [...next.nodes.values()].filter(
16774
- ({ node, encoded }) => previous?.nodes.get(node.id)?.encoded !== encoded
16775
- ).map(({ node }) => node);
16776
- const removed = [...previous?.nodes.keys() ?? []].filter(
16777
- (id) => !next.nodes.has(id)
16754
+ function Meter(props) {
16755
+ const height = props.height ?? 8;
16756
+ const value = Math.min(1, Math.max(0, props.value));
16757
+ return element(
16758
+ "panel",
16759
+ {
16760
+ width: props.width ?? 160,
16761
+ height,
16762
+ background: shades.raised,
16763
+ borderRadius: height / 2,
16764
+ overflow: "clip",
16765
+ ...props.style
16766
+ },
16767
+ // The fill scales rather than resizes, so it eases without layout work.
16768
+ element("panel", {
16769
+ width: "100%",
16770
+ height: "100%",
16771
+ background: tones[props.tone ?? "accent"],
16772
+ scale: [value, 1],
16773
+ origin: [0, 50],
16774
+ transition: motion.meter
16775
+ })
16778
16776
  );
16779
- if (previous && set.length === 0 && removed.length === 0) {
16780
- return void 0;
16781
- }
16782
- return { reset: !previous, set, removed };
16783
16777
  }
16784
- function send(slot, change2) {
16785
- return call("Ui", UiRequest.toBinary({ player: slot, change: change2 })) !== void 0;
16786
- }
16787
- function isElement(child) {
16788
- return typeof child === "object" && child !== null && !Array.isArray(child);
16778
+
16779
+ // js/src/chat.ts
16780
+ var lineWidth = 40;
16781
+ var lines = /* @__PURE__ */ new Map();
16782
+ var shown;
16783
+ function showChatLines(options = {}) {
16784
+ shown = options;
16785
+ }
16786
+ function chatShown() {
16787
+ return shown !== void 0;
16788
+ }
16789
+ function hearChat(line2, now4) {
16790
+ if (!shown) return false;
16791
+ const text2 = line2.text.trim();
16792
+ if (text2 === "" || text2.startsWith("/")) return false;
16793
+ const team = line2.all ? 0 : line2.player.pawn()?.team ?? 0;
16794
+ lines.set(line2.player.slot, {
16795
+ speaker: line2.player,
16796
+ text: `\u201C${clip(text2, lineWidth)}\u201D`,
16797
+ team,
16798
+ until: now4 + (shown.seconds ?? 6)
16799
+ });
16800
+ return true;
16789
16801
  }
16790
- function isList(child) {
16791
- return Array.isArray(child);
16802
+ function expireChat(now4) {
16803
+ let expired = false;
16804
+ for (const [slot, line2] of lines) {
16805
+ if (now4 >= line2.until) {
16806
+ lines.delete(slot);
16807
+ expired = true;
16808
+ }
16809
+ }
16810
+ return expired;
16811
+ }
16812
+ function forgetChat(slot) {
16813
+ return lines.delete(slot);
16814
+ }
16815
+ function chatLines(viewer) {
16816
+ if (lines.size === 0) return void 0;
16817
+ const team = viewer.pawn()?.team ?? 0;
16818
+ const readable = [];
16819
+ for (const line2 of lines.values()) {
16820
+ if (line2.team === 0 || line2.team === team) readable.push(line2);
16821
+ }
16822
+ readable.sort((a, b) => b.until - a.until);
16823
+ return Roster({
16824
+ top: shown?.top,
16825
+ rows: readable.map((line2) => {
16826
+ const speaker = connection(line2.speaker);
16827
+ return {
16828
+ name: speaker?.name ?? "",
16829
+ hero: line2.speaker.pawn()?.hero ?? 0,
16830
+ activity: line2.text,
16831
+ steamId: speaker && !speaker.bot ? speaker.steamId : void 0
16832
+ };
16833
+ })
16834
+ });
16792
16835
  }
16793
- function text(children) {
16794
- if (children === null || children === void 0 || typeof children === "boolean") {
16795
- return "";
16796
- }
16797
- if (isList(children)) {
16798
- return children.map(text).join("");
16836
+
16837
+ // js/src/bystander.ts
16838
+ var bystanderStates = [
16839
+ "MODIFIER_STATE_IMMOBILIZED",
16840
+ "MODIFIER_STATE_DISARMED",
16841
+ "MODIFIER_STATE_MELEE_DISABLED",
16842
+ "MODIFIER_STATE_SILENCED",
16843
+ "MODIFIER_STATE_INVULNERABLE",
16844
+ "MODIFIER_STATE_TECH_UNTARGETABLE_BY_ENEMIES",
16845
+ "MODIFIER_STATE_TECH_UNTARGETABLE_BY_TEAMMATES",
16846
+ "MODIFIER_STATE_DISPLACEMENT_IMMUNE",
16847
+ "MODIFIER_STATE_IGNORE_BULLETS",
16848
+ "MODIFIER_STATE_IGNORE_MELEE",
16849
+ "MODIFIER_STATE_IN_ABILITY_DISABLE_ZOOM"
16850
+ ];
16851
+ function holdBystander(entity, active = true) {
16852
+ let held = true;
16853
+ for (const state of bystanderStates) {
16854
+ held = holdModifierState(entity, state, active) && held;
16799
16855
  }
16800
- return isElement(children) ? "" : String(children);
16856
+ return held;
16801
16857
  }
16802
- var aligns = {
16803
- left: 0 /* START */,
16804
- top: 0 /* START */,
16805
- center: 1 /* CENTER */,
16806
- right: 2 /* END */,
16807
- bottom: 2 /* END */
16808
- };
16809
- function align(value) {
16810
- return value === void 0 ? void 0 : aligns[value];
16858
+ var parkedStates = [
16859
+ "MODIFIER_STATE_DO_NOT_DRAW_MODEL",
16860
+ "MODIFIER_STATE_UNIT_STATUS_HIDDEN",
16861
+ "MODIFIER_STATE_INVISIBLE_ON_MINIMAP",
16862
+ "MODIFIER_STATE_IGNORE_OUT_OF_PLAY_AREA_CHECK"
16863
+ ];
16864
+ var parkHeight = 4e3;
16865
+ function spectateFrom(player, position, facing, park) {
16866
+ const pawn = player.pawn();
16867
+ if (pawn === void 0 || pawn.hero === 0) return void 0;
16868
+ const stood = pawn.position;
16869
+ const faced = pawn.eyeAngles;
16870
+ hideParked(pawn.entity, true);
16871
+ player.teleport(park ?? { ...stood, z: stood.z + parkHeight }, faced, {
16872
+ x: 0,
16873
+ y: 0,
16874
+ z: 0
16875
+ });
16876
+ player.freeze(true);
16877
+ player.freeCamera(position, facing);
16878
+ return (restore = true) => {
16879
+ player.unwatch();
16880
+ player.freeze(false);
16881
+ if (restore) player.teleport(stood, faced, { x: 0, y: 0, z: 0 });
16882
+ hideParked(pawn.entity, false);
16883
+ };
16811
16884
  }
16812
- var hudParts = {
16813
- levelUp: 1 /* LEVEL_UP */,
16814
- ownHealth: 2 /* OWN_HEALTH */,
16815
- topBar: 3 /* TOP_BAR */,
16816
- ammo: 4 /* AMMO */,
16817
- souls: 5 /* SOULS */,
16818
- minimap: 6 /* MINIMAP */,
16819
- abilities: 7 /* ABILITIES */,
16820
- status: 8 /* STATUS */,
16821
- stats: 9 /* STATS */,
16822
- heroPicker: 10 /* HERO_PICKER */,
16823
- brokerCountdown: 11 /* BROKER_COUNTDOWN */,
16824
- all: 12 /* ALL */
16825
- };
16826
- var faces = {
16827
- body: 1 /* BODY */,
16828
- block: 2 /* BLOCK */,
16829
- serif: 3 /* SERIF */
16830
- };
16831
- var looks = {
16832
- small: 0 /* SMALL */,
16833
- card: 1 /* CARD */,
16834
- icon: 2 /* ICON */,
16835
- vertical: 3 /* VERTICAL */,
16836
- topBar: 4 /* TOP_BAR */,
16837
- minimap: 5 /* MINIMAP */
16838
- };
16839
- var scalings = {
16840
- fit: 1 /* FIT */,
16841
- cover: 2 /* COVER */,
16842
- stretch: 3 /* STRETCH */,
16843
- fitWidth: 4 /* FIT_WIDTH */,
16844
- fitHeight: 5 /* FIT_HEIGHT */,
16845
- none: 6 /* NONE */
16846
- };
16847
- function scaling(value) {
16848
- return value === void 0 ? void 0 : scalings[value];
16849
- }
16850
- var flows = {
16851
- down: 1 /* DOWN */,
16852
- right: 2 /* RIGHT */,
16853
- downWrap: 3 /* DOWN_WRAP */,
16854
- rightWrap: 4 /* RIGHT_WRAP */
16855
- };
16856
- var overflows = {
16857
- squish: 1 /* SQUISH */,
16858
- clip: 2 /* CLIP */,
16859
- scroll: 3 /* SCROLL */,
16860
- show: 4 /* SHOW */
16861
- };
16862
- function overflow(value) {
16863
- return value === void 0 ? void 0 : overflows[value];
16885
+ function hideParked(entity, active) {
16886
+ holdBystander(entity, active);
16887
+ for (const state of parkedStates) holdModifierState(entity, state, active);
16864
16888
  }
16865
- var shapes = {
16866
- down: 0 /* DOWN */,
16867
- right: 1 /* RIGHT */,
16868
- up: 2 /* UP */,
16869
- left: 3 /* LEFT */,
16870
- radial: 4 /* RADIAL */
16871
- };
16872
- var weights = {
16873
- thin: 1 /* THIN */,
16874
- light: 2 /* LIGHT */,
16875
- normal: 3 /* NORMAL */,
16876
- medium: 4 /* MEDIUM */,
16877
- semiBold: 5 /* SEMI_BOLD */,
16878
- bold: 6 /* BOLD */,
16879
- black: 7 /* BLACK */
16880
- };
16881
- var textOverflows = {
16882
- ellipsis: 1 /* ELLIPSIS */,
16883
- shrink: 2 /* SHRINK */,
16884
- clip: 3 /* CLIP */
16885
- };
16886
- var decorations = {
16887
- underline: 1 /* UNDERLINE */,
16888
- strike: 2 /* STRIKE */
16889
- };
16890
- var easings = {
16891
- out: 0 /* EASE_OUT */,
16892
- in: 1 /* EASE_IN */,
16893
- inOut: 2 /* EASE_IN_OUT */,
16894
- linear: 3 /* LINEAR */
16889
+
16890
+ // js/src/strays.ts
16891
+ var strayGraceSeconds = 3;
16892
+ var strayRespawnTime = 1e9;
16893
+ var strayBlow = 1e6;
16894
+ var Strays = class {
16895
+ /** since maps each stray pawn to when it was first seen with no player. */
16896
+ since = /* @__PURE__ */ new Map();
16897
+ /**
16898
+ * gone holds the controller handles strays name that no longer resolve. A
16899
+ * handle carries its entity's serial, so it never resolves again, and each
16900
+ * failed read logs on the host: a sweep reads it once.
16901
+ */
16902
+ gone = /* @__PURE__ */ new Set();
16903
+ sweptAt = -Infinity;
16904
+ /**
16905
+ * sweep lays down each hero pawn that has belonged to no player for
16906
+ * strayGraceSeconds, at most once a second. The game sets a dead pawn's
16907
+ * respawn when it dies, so the hold repeats on each sweep.
16908
+ */
16909
+ sweep(now4) {
16910
+ if (now4 - this.sweptAt < 1) {
16911
+ return;
16912
+ }
16913
+ this.sweptAt = now4;
16914
+ const held = /* @__PURE__ */ new Set();
16915
+ for (const { player } of players()) {
16916
+ const pawn = player.pawn();
16917
+ if (pawn) {
16918
+ held.add(pawn.entity);
16919
+ }
16920
+ }
16921
+ const since = /* @__PURE__ */ new Map();
16922
+ const gone = /* @__PURE__ */ new Set();
16923
+ for (const entity of findEntities("player")) {
16924
+ if (held.has(entity) || ownHero(entity, this.gone, gone)) {
16925
+ continue;
16926
+ }
16927
+ const first = this.since.get(entity) ?? now4;
16928
+ since.set(entity, first);
16929
+ if (now4 - first >= strayGraceSeconds) {
16930
+ layDown(entity);
16931
+ }
16932
+ }
16933
+ this.since = since;
16934
+ this.gone = gone;
16935
+ }
16895
16936
  };
16896
- function wireStyle(style) {
16897
- if (!style) {
16898
- return void 0;
16937
+ function ownHero(entity, known2, seen) {
16938
+ const controller = readField(
16939
+ entity,
16940
+ "CBasePlayerPawn",
16941
+ "m_hController",
16942
+ "handle"
16943
+ );
16944
+ if (typeof controller !== "number") {
16945
+ return false;
16899
16946
  }
16900
- return {
16901
- width: length(style.width),
16902
- height: length(style.height),
16903
- flow: style.flow === void 0 ? void 0 : flows[style.flow],
16904
- horizontalAlign: align(style.horizontalAlign),
16905
- verticalAlign: align(style.verticalAlign),
16906
- margin: edges(style.margin),
16907
- padding: edges(style.padding),
16908
- background: color(style.background),
16909
- color: color(style.color),
16910
- fontSize: style.fontSize,
16911
- bold: style.bold,
16912
- textAlign: align(style.textAlign),
16913
- borderRadius: style.borderRadius,
16914
- opacity: style.opacity,
16915
- face: style.face === void 0 ? void 0 : faces[style.face],
16916
- uppercase: style.uppercase,
16917
- letterSpacing: style.letterSpacing,
16918
- shadow: style.shadow,
16919
- borderWidth: style.borderWidth,
16920
- borderColor: color(style.borderColor),
16921
- x: length(style.x),
16922
- y: length(style.y),
16923
- minWidth: length(style.minWidth),
16924
- maxWidth: length(style.maxWidth),
16925
- minHeight: length(style.minHeight),
16926
- maxHeight: length(style.maxHeight),
16927
- zIndex: style.zIndex,
16928
- overflowX: overflow(style.overflowX ?? style.overflow),
16929
- overflowY: overflow(style.overflowY ?? style.overflow),
16930
- gradient: gradient(style.gradient),
16931
- boxShadow: shadow(style.boxShadow),
16932
- textShadow: shadow(style.textShadow),
16933
- tint: color(style.tint),
16934
- saturation: style.saturation,
16935
- brightness: style.brightness,
16936
- contrast: style.contrast,
16937
- blur: style.blur,
16938
- italic: style.italic,
16939
- weight: style.weight === void 0 ? void 0 : weights[style.weight],
16940
- lineHeight: style.lineHeight,
16941
- noWrap: style.noWrap,
16942
- textOverflow: style.textOverflow === void 0 ? void 0 : textOverflows[style.textOverflow],
16943
- decoration: style.decoration === void 0 ? void 0 : decorations[style.decoration],
16944
- transform: transform(style),
16945
- transition: transition(style.transition)
16946
- };
16947
- }
16948
- function gradient(value) {
16949
- if (!value) {
16950
- return void 0;
16947
+ if (known2.has(controller)) {
16948
+ seen.add(controller);
16949
+ return false;
16951
16950
  }
16952
- const last = Math.max(1, value.colors.length - 1);
16953
- return {
16954
- shape: value.shape === void 0 ? void 0 : shapes[value.shape],
16955
- stops: value.colors.map((each, index) => ({
16956
- at: value.at?.[index] ?? index / last,
16957
- color: color(each)
16958
- }))
16959
- };
16960
- }
16961
- function shadow(value) {
16962
- if (!value) {
16963
- return void 0;
16951
+ const connected = readField(
16952
+ controller,
16953
+ "CBasePlayerController",
16954
+ "m_iConnected",
16955
+ "int32"
16956
+ );
16957
+ if (connected === 3 || connected === 4) {
16958
+ return false;
16964
16959
  }
16965
- return {
16966
- x: value.x,
16967
- y: value.y,
16968
- blur: value.blur,
16969
- spread: value.spread,
16970
- color: color(value.color),
16971
- inset: value.inset
16972
- };
16973
- }
16974
- function transform(style) {
16975
- const { translate, scale: scale2, rotate, origin } = style;
16976
- if (!translate && scale2 === void 0 && rotate === void 0 && !origin) {
16977
- return void 0;
16960
+ const hero = readField(
16961
+ controller,
16962
+ "CCitadelPlayerController",
16963
+ "m_hHeroPawn",
16964
+ "handle"
16965
+ );
16966
+ if (connected === void 0 && hero === void 0) {
16967
+ seen.add(controller);
16978
16968
  }
16979
- const scales = typeof scale2 === "number" ? [scale2, scale2] : scale2;
16980
- return {
16981
- translateX: translate?.[0],
16982
- translateY: translate?.[1],
16983
- scaleX: scales?.[0],
16984
- scaleY: scales?.[1],
16985
- rotate,
16986
- originX: origin?.[0],
16987
- originY: origin?.[1]
16988
- };
16969
+ return hero === entity;
16989
16970
  }
16990
- function transition(value) {
16991
- if (value === void 0) {
16992
- return void 0;
16993
- }
16994
- if (typeof value === "number") {
16995
- return { seconds: value };
16971
+ function layDown(entity) {
16972
+ holdBystander(entity, false);
16973
+ const health = readField(entity, "CBaseEntity", "m_iHealth", "int32");
16974
+ if (typeof health === "number" && health > 0) {
16975
+ damage({ victim: entity, amount: strayBlow });
16976
+ log(`laid down a stray hero pawn ${entity}`);
16996
16977
  }
16997
- return {
16998
- seconds: value.seconds,
16999
- delay: value.delay,
17000
- easing: value.easing === void 0 ? void 0 : easings[value.easing]
17001
- };
16978
+ writeField(
16979
+ entity,
16980
+ "CCitadelPlayerPawn",
16981
+ "m_flRespawnTime",
16982
+ "float32",
16983
+ strayRespawnTime
16984
+ );
17002
16985
  }
17003
- function length(value) {
17004
- if (value === void 0) {
17005
- return void 0;
16986
+
16987
+ // js/src/stragglers.ts
16988
+ var stragglerConnectSeconds = 120;
16989
+ var Stragglers = class {
16990
+ connectSeconds;
16991
+ strays;
16992
+ /** joining maps each connecting human's slot to its generation and when it was first seen. */
16993
+ joining = /* @__PURE__ */ new Map();
16994
+ /** kicked holds the generation each slot had when this kicked it. */
16995
+ kicked = /* @__PURE__ */ new Map();
16996
+ sweptAt = -Infinity;
16997
+ constructor(options = {}) {
16998
+ this.connectSeconds = options.connectSeconds ?? stragglerConnectSeconds;
16999
+ this.strays = options.heroes === false ? void 0 : new Strays();
17006
17000
  }
17007
- if (typeof value === "number") {
17008
- return { value: { case: "pixels", value } };
17001
+ /**
17002
+ * sweep kicks each human connecting for longer than connectSeconds, once
17003
+ * per connection, and lays down heroes no player holds, at most once a
17004
+ * second.
17005
+ */
17006
+ sweep(now4) {
17007
+ this.strays?.sweep(now4);
17008
+ if (now4 - this.sweptAt < 1) {
17009
+ return;
17010
+ }
17011
+ this.sweptAt = now4;
17012
+ if (this.connectSeconds <= 0) {
17013
+ return;
17014
+ }
17015
+ const joining = /* @__PURE__ */ new Map();
17016
+ for (const connection2 of players()) {
17017
+ if (connection2.bot || connection2.ready) {
17018
+ continue;
17019
+ }
17020
+ const slot = connection2.player.slot;
17021
+ const seen = this.joining.get(slot);
17022
+ const since = seen?.generation === connection2.generation ? seen.since : now4;
17023
+ joining.set(slot, { generation: connection2.generation, since });
17024
+ if (now4 - since < this.connectSeconds) {
17025
+ continue;
17026
+ }
17027
+ if (this.kicked.get(slot) === connection2.generation) {
17028
+ continue;
17029
+ }
17030
+ this.kicked.set(slot, connection2.generation);
17031
+ const name = connection2.name;
17032
+ if (name === "" || name.includes('"')) {
17033
+ log(`slot ${slot} stuck joining, but its name cannot be kicked`);
17034
+ continue;
17035
+ }
17036
+ log(`kicked ${name}: still joining after ${this.connectSeconds} s`);
17037
+ serverCommand(`kick "${name}"`);
17038
+ }
17039
+ this.joining = joining;
17009
17040
  }
17010
- if (value === "fit") {
17011
- return { value: { case: "fitChildren", value: true } };
17041
+ };
17042
+
17043
+ // js/src/item-id.ts
17044
+ function itemId(name) {
17045
+ const m = 1540483477;
17046
+ const data = new TextEncoder().encode(name);
17047
+ const byte = (at3) => data[at3] ?? 0;
17048
+ let h = (826366246 ^ data.length) >>> 0;
17049
+ let i = 0;
17050
+ for (; data.length - i >= 4; i += 4) {
17051
+ let k = (byte(i) | byte(i + 1) << 8 | byte(i + 2) << 16 | byte(i + 3) << 24) >>> 0;
17052
+ k = Math.imul(k, m) >>> 0;
17053
+ k = (k ^ k >>> 24) >>> 0;
17054
+ k = Math.imul(k, m) >>> 0;
17055
+ h = Math.imul(h, m) >>> 0;
17056
+ h = (h ^ k) >>> 0;
17012
17057
  }
17013
- if (value === "fill") {
17014
- return { value: { case: "fill", value: 1 } };
17058
+ const rest = data.length - i;
17059
+ if (rest >= 3) h = (h ^ byte(i + 2) << 16) >>> 0;
17060
+ if (rest >= 2) h = (h ^ byte(i + 1) << 8) >>> 0;
17061
+ if (rest >= 1) {
17062
+ h = (h ^ byte(i)) >>> 0;
17063
+ h = Math.imul(h, m) >>> 0;
17015
17064
  }
17016
- return { value: { case: "percent", value: Number.parseFloat(value) } };
17065
+ h = (h ^ h >>> 13) >>> 0;
17066
+ h = Math.imul(h, m) >>> 0;
17067
+ return (h ^ h >>> 15) >>> 0;
17017
17068
  }
17018
- function edges(value) {
17019
- if (value === void 0) {
17020
- return void 0;
17021
- }
17022
- if (typeof value === "number") {
17023
- return { top: value, right: value, bottom: value, left: value };
17024
- }
17025
- if (value.length === 2) {
17026
- return { top: value[0], right: value[1], bottom: value[0], left: value[1] };
17069
+
17070
+ // js/src/ui.ts
17071
+ function jsx(type, props, key) {
17072
+ const named = key === void 0 ? void 0 : String(key);
17073
+ if (typeof type === "function") {
17074
+ return { type: fragment, props: { children: type(props) }, key: named };
17027
17075
  }
17028
- return { top: value[0], right: value[1], bottom: value[2], left: value[3] };
17076
+ return { type, props, key: named };
17029
17077
  }
17030
- function color(value) {
17031
- const hex = value?.replace(/^#/, "");
17032
- if (!hex || !/^[0-9a-f]{6}([0-9a-f]{2})?$/i.test(hex)) {
17033
- return void 0;
17034
- }
17035
- return Number.parseInt(hex.length === 6 ? `${hex}ff` : hex, 16) >>> 0;
17078
+ var fragment = "fragment";
17079
+ var jsxs = jsx;
17080
+ function Fragment(props) {
17081
+ return props.children;
17036
17082
  }
17037
-
17038
- // js/src/vector.ts
17039
- var vector_exports = {};
17040
- __export(vector_exports, {
17041
- add: () => add,
17042
- aimAt: () => aimAt,
17043
- at: () => at,
17044
- distance: () => distance,
17045
- dot: () => dot,
17046
- flatDistance: () => flatDistance,
17047
- forward: () => forward,
17048
- length: () => length2,
17049
- lerp: () => lerp2,
17050
- level: () => level,
17051
- normalize: () => normalize,
17052
- scale: () => scale,
17053
- sub: () => sub,
17054
- toward: () => toward,
17055
- yawToward: () => yawToward
17056
- });
17057
- function at(x, y, z) {
17058
- return { x, y, z };
17083
+ function show(player, root) {
17084
+ views.set(player.slot, { ...view(player), root });
17085
+ return draw(player);
17059
17086
  }
17060
- function add(a, b) {
17061
- return { x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
17087
+ function hideHud(player, parts) {
17088
+ views.set(player.slot, { ...view(player), hud: parts });
17089
+ return draw(player);
17062
17090
  }
17063
- function sub(a, b) {
17064
- return { x: a.x - b.x, y: a.y - b.y, z: a.z - b.z };
17091
+ function hideHudForAll(parts) {
17092
+ everyoneHud = parts;
17093
+ drawAll();
17065
17094
  }
17066
- function scale(a, s) {
17067
- return { x: a.x * s, y: a.y * s, z: a.z * s };
17095
+ function freeCursor(player, free) {
17096
+ const current = view(player);
17097
+ views.set(player.slot, {
17098
+ ...current,
17099
+ cursor: free,
17100
+ asks: free ? current.asks + 1 : current.asks
17101
+ });
17102
+ return draw(player);
17068
17103
  }
17069
- function dot(a, b) {
17070
- return a.x * b.x + a.y * b.y + a.z * b.z;
17104
+ function abilityBarPresses(player, onPress) {
17105
+ views.set(player.slot, {
17106
+ ...view(player),
17107
+ bar: onPress ? { handler: onPress } : void 0
17108
+ });
17109
+ return draw(player);
17071
17110
  }
17072
- function length2(a) {
17073
- return Math.hypot(a.x, a.y, a.z);
17111
+ function abilityDisplay(viewer, rows = []) {
17112
+ views.set(viewer.slot, { ...view(viewer), display: rows.slice(0, 64) });
17113
+ return draw(viewer);
17074
17114
  }
17075
- function normalize(a) {
17076
- const size = length2(a);
17077
- return size > 0 ? scale(a, 1 / size) : { x: 1, y: 0, z: 0 };
17115
+ function displayRows(viewer, rows) {
17116
+ if (rows.length === 0) return [];
17117
+ const names = new Map(players().map((c) => [c.player.slot, c.name]));
17118
+ return rows.map((row2) => {
17119
+ const hero = row2.player.pawn()?.hero;
17120
+ return {
17121
+ player: row2.player.slot,
17122
+ // A Steam name is at most 32 characters, within the host's 128 bytes.
17123
+ name: (names.get(row2.player.slot) ?? "").slice(0, 32),
17124
+ hero: heroes.find((each) => each.id === hero)?.name ?? "",
17125
+ own: row2.player.slot === viewer.slot,
17126
+ abilities: row2.abilities.slice(0, 4).map((shown2) => ({
17127
+ ability: shown2?.name ? itemId(shown2.name) : 0,
17128
+ image: shown2?.image ?? "",
17129
+ upgrades: shown2?.upgrades ?? 0
17130
+ }))
17131
+ };
17132
+ });
17078
17133
  }
17079
- function lerp2(a, b, t) {
17080
- return {
17081
- x: a.x + (b.x - a.x) * t,
17082
- y: a.y + (b.y - a.y) * t,
17083
- z: a.z + (b.z - a.z) * t
17084
- };
17134
+ var abilityBarNode = /^ability:([0-3])$/;
17135
+ function cursorFree(player) {
17136
+ const pawn = player.pawn();
17137
+ if (pawn === void 0) return void 0;
17138
+ return readField(
17139
+ pawn.entity,
17140
+ "CCitadelPlayer_MovementServices",
17141
+ "m_bHasFreeCursor",
17142
+ "bool"
17143
+ );
17085
17144
  }
17086
- function distance(a, b) {
17087
- return Math.hypot(a.x - b.x, a.y - b.y, a.z - b.z);
17145
+ function sheet(path) {
17146
+ if (!path.endsWith(".css") || !path.split("/").every((part) => sheetPart.test(part) && part !== "..")) {
17147
+ return false;
17148
+ }
17149
+ if (sheets.includes(path)) {
17150
+ return true;
17151
+ }
17152
+ sheets.push(path);
17153
+ for (const current of views.values()) {
17154
+ draw(current.player);
17155
+ }
17156
+ return true;
17088
17157
  }
17089
- function flatDistance(a, b) {
17090
- return Math.hypot(a.x - b.x, a.y - b.y);
17158
+ var sheetPart = /^[\w.-]+$/;
17159
+ var sheets = [];
17160
+ function route(player, name, value) {
17161
+ const routes = new Map(view(player).routes);
17162
+ const encoded = value === void 0 ? void 0 : JSON.stringify(value);
17163
+ if (!routeName.test(name) || value !== void 0 && encoded === void 0) {
17164
+ return false;
17165
+ }
17166
+ if (encoded === void 0) {
17167
+ routes.delete(name);
17168
+ } else {
17169
+ routes.set(name, encoded);
17170
+ }
17171
+ views.set(player.slot, { ...view(player), routes });
17172
+ return draw(player);
17091
17173
  }
17092
- function toward(from, to) {
17093
- const span = distance(from, to);
17094
- return span > 0 ? scale(sub(to, from), 1 / span) : { x: 0, y: 0, z: 0 };
17174
+ var routeName = /^[\w.-]+$/;
17175
+ function hide(player) {
17176
+ views.delete(player.slot);
17177
+ screens.delete(player.slot);
17178
+ if (!send(player.slot, { reset: true })) return false;
17179
+ return everyoneHud.length === 0 || draw(player);
17095
17180
  }
17096
- function yawToward(from, to) {
17097
- return Math.atan2(to.y - from.y, to.x - from.x) * 180 / Math.PI;
17181
+ function joined(player) {
17182
+ if (everyoneHud.length !== 0) draw(player);
17098
17183
  }
17099
- function level(yaw) {
17100
- return { pitch: 0, yaw, roll: 0 };
17184
+ function left(player) {
17185
+ views.delete(player.slot);
17186
+ screens.delete(player.slot);
17187
+ if (forgetChat(player.slot)) drawAll();
17101
17188
  }
17102
- function aimAt(from, to) {
17103
- const across = flatDistance(from, to);
17104
- return {
17105
- pitch: -Math.atan2(to.z - from.z, across) * 180 / Math.PI,
17106
- yaw: yawToward(from, to),
17107
- roll: 0
17108
- };
17109
- }
17110
- function forward(angles2) {
17111
- const pitch = angles2.pitch * Math.PI / 180;
17112
- const yaw = angles2.yaw * Math.PI / 180;
17113
- return {
17114
- x: Math.cos(pitch) * Math.cos(yaw),
17115
- y: Math.cos(pitch) * Math.sin(yaw),
17116
- z: -Math.sin(pitch)
17117
- };
17118
- }
17119
-
17120
- // js/src/bits.ts
17121
- var Buttons = {
17122
- /** attack is the primary fire button. */
17123
- attack: 1n,
17124
- /**
17125
- * jump is the jump key, Space by default (IN_MANTLE). Blocking it stops the
17126
- * native jump and mantle; the jumping client still predicts the jump and is
17127
- * corrected.
17128
- */
17129
- jump: 1n << 48n,
17130
- /** crouch is the crouch key, Ctrl by default. */
17131
- crouch: 1n << 2n,
17132
- /** dash is the dash key, Shift by default. */
17133
- dash: 1n << 16n,
17134
- /** use is the interact key. */
17135
- use: 1n << 5n,
17136
- /** altFire is the zoom and alternate fire button, right mouse by default. */
17137
- altFire: 1n << 11n,
17138
- /** reload is the reload key. */
17139
- reload: 1n << 13n,
17140
- /** melee is the light melee key, Q by default. */
17141
- melee: 1n << 32n,
17142
- /** ability1 to ability3 are the hero's first three ability keys. */
17143
- ability1: 1n << 33n,
17144
- ability2: 1n << 34n,
17145
- ability3: 1n << 35n,
17146
- /** ultimate is the hero's ultimate ability key, the fourth. */
17147
- ultimate: 1n << 36n,
17148
- /** parry is the melee parry button. */
17149
- parry: 1n << 42n
17150
- };
17151
- var Layers = {
17152
- /** solid is the world and solid objects. */
17153
- solid: 1n << 0n,
17154
- /** hitbox is the hit boxes of heroes and units. */
17155
- hitbox: 1n << 1n,
17156
- /** trigger is invisible volumes that react to touch. */
17157
- trigger: 1n << 2n,
17158
- /** playerClip is walls that only stop heroes. */
17159
- playerClip: 1n << 4n,
17160
- /** player is player-controlled heroes. */
17161
- player: 1n << 18n,
17162
- /** npc is units that are not players. */
17163
- npc: 1n << 19n,
17164
- /** staticLevel is the map's built geometry, foliage included. */
17165
- staticLevel: 1n << 30n,
17166
- /** hero, trooper and building are those units' bodies. */
17167
- hero: 1n << 37n,
17168
- trooper: 1n << 38n,
17169
- building: 1n << 40n
17170
- };
17171
-
17172
- // js/src/curve.ts
17173
- var curve_exports = {};
17174
- __export(curve_exports, {
17175
- chain: () => chain,
17176
- durationOf: () => durationOf,
17177
- ease: () => ease,
17178
- hold: () => hold,
17179
- keyframes: () => keyframes,
17180
- line: () => line,
17181
- orbit: () => orbit,
17182
- pingPong: () => pingPong,
17183
- repeat: () => repeat,
17184
- reverse: () => reverse,
17185
- shaped: () => shaped,
17186
- through: () => through,
17187
- valueAt: () => valueAt,
17188
- wave: () => wave
17189
- });
17190
- var ease = {
17191
- /** linear moves at an even pace. */
17192
- linear: shaped((t) => t, {}),
17193
- /** bias is the game's bias curve; see LerpShape. */
17194
- bias: (b) => shaped((t) => bias(t, b), { bias: b }),
17195
- /** gain is the game's gain curve; see LerpShape. */
17196
- gain: (g) => shaped((t) => gain(t, g), { gain: g }),
17197
- /** in starts slow and speeds up. */
17198
- in: shaped((t) => t * t * t),
17199
- /** out starts fast and slows to a stop. */
17200
- out: shaped((t) => 1 - (1 - t) ** 3),
17201
- /** inOut starts and ends slow. */
17202
- inOut: shaped((t) => t < 0.5 ? 4 * t * t * t : 1 - (2 - 2 * t) ** 3 / 2),
17203
- /** sine starts and ends slow, more gently than inOut. */
17204
- sine: shaped((t) => (1 - Math.cos(Math.PI * t)) / 2),
17205
- /** back passes its end a little and settles back onto it. */
17206
- back: shaped((t) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2),
17207
- /** elastic overshoots its end and rings down onto it. */
17208
- elastic: shaped(
17209
- (t) => t <= 0 || t >= 1 ? t : 2 ** (-10 * t) * Math.sin((t * 10 - 0.75) * 2 * Math.PI / 3) + 1
17210
- ),
17211
- /** bounce drops onto its end and bounces to rest. */
17212
- bounce: shaped((t) => {
17213
- const k = 7.5625;
17214
- if (t < 1 / 2.75) return k * t * t;
17215
- if (t < 2 / 2.75) return k * (t - 1.5 / 2.75) ** 2 + 0.75;
17216
- if (t < 2.5 / 2.75) return k * (t - 2.25 / 2.75) ** 2 + 0.9375;
17217
- return k * (t - 2.625 / 2.75) ** 2 + 0.984375;
17218
- })
17219
- };
17220
- function shaped(at3, lerp3) {
17221
- return { at: at3, lerp: lerp3 };
17189
+ function heard(line2) {
17190
+ if (hearChat(line2, now2)) drawAll();
17222
17191
  }
17223
- function line(from, to, duration, shape = ease.linear) {
17224
- return [{ duration, lerp: shape.lerp, at: (u) => mix(from, to, shape.at(u)) }];
17225
- }
17226
- function hold(value, duration) {
17227
- return [{ duration, lerp: {}, at: () => value }];
17228
- }
17229
- function keyframes(keys, options = {}) {
17230
- const spans = [];
17231
- const [first] = keys;
17232
- if (first && first.at > 0) spans.push(...hold(first.value, first.at));
17233
- keys.forEach((to, i) => {
17234
- const from = keys[i - 1];
17235
- if (!from || to.at <= from.at) return;
17236
- const duration = to.at - from.at;
17237
- const shape = to.ease ?? ease.linear;
17238
- if (!options.smooth) {
17239
- spans.push(...line(from.value, to.value, duration, shape));
17240
- return;
17241
- }
17242
- const before2 = keys[i - 2]?.value ?? from.value;
17243
- const after2 = keys[i + 1]?.value ?? to.value;
17244
- spans.push({
17245
- duration,
17246
- at: (u) => spline(before2, from.value, to.value, after2, shape.at(u))
17247
- });
17192
+ function toast(player, text2, seconds = 4) {
17193
+ const current = view(player);
17194
+ const notice = { id: nextNotice++, text: text2, until: now2 + seconds };
17195
+ views.set(player.slot, {
17196
+ ...current,
17197
+ notices: [...current.notices, notice].slice(-maxNotices)
17248
17198
  });
17249
- return spans;
17199
+ return draw(player);
17250
17200
  }
17251
- function through(points, options) {
17252
- let at3 = 0;
17253
- let last = points[0];
17254
- const keys = points.map((value) => {
17255
- if (last !== void 0) at3 += distance2(last, value) / options.speed;
17256
- last = value;
17257
- return { at: at3, value, ease: options.ease };
17201
+ function uiSound(player, sound, options = {}) {
17202
+ const current = view(player);
17203
+ const cue = { number: nextCue++, sound, seconds: options.seconds ?? 0 };
17204
+ views.set(player.slot, {
17205
+ ...current,
17206
+ cues: [...current.cues, cue].slice(-maxCues)
17258
17207
  });
17259
- return keyframes(keys, options);
17208
+ return draw(player);
17260
17209
  }
17261
- function orbit(options) {
17262
- const { center, radius, duration } = options;
17263
- const turns = options.turns ?? 1;
17264
- const start2 = (options.start ?? 0) * Math.PI / 180;
17265
- const rise = options.rise ?? 0;
17266
- const shape = options.ease ?? ease.linear;
17267
- return [
17268
- {
17269
- duration,
17270
- at: (u) => {
17271
- const t = shape.at(u);
17272
- const angle = start2 + t * turns * 2 * Math.PI;
17273
- return {
17274
- x: center.x + radius * Math.cos(angle),
17275
- y: center.y + radius * Math.sin(angle),
17276
- z: center.z + rise * t
17277
- };
17210
+ function press(player, node, action = "", payload = "") {
17211
+ if (action !== "") {
17212
+ const pressed2 = screens.get(player.slot)?.actions.get(node);
17213
+ if (pressed2) {
17214
+ let value = void 0;
17215
+ try {
17216
+ value = payload === "" ? void 0 : JSON.parse(payload);
17217
+ } catch {
17218
+ value = void 0;
17278
17219
  }
17220
+ pressed2.handler(player, action, value);
17279
17221
  }
17280
- ];
17281
- }
17282
- function wave(options) {
17283
- const { amplitude, frequency, duration, decay } = options;
17284
- return [
17285
- {
17286
- duration,
17287
- at: (u) => amplitude * (decay ? 1 - u : 1) * Math.sin(2 * Math.PI * frequency * duration * u)
17288
- }
17289
- ];
17290
- }
17291
- function chain(...curves) {
17292
- return curves.flat();
17293
- }
17294
- function reverse(curve) {
17295
- return curve.map((span) => ({
17296
- duration: span.duration,
17297
- lerp: span.lerp?.bias === void 0 ? span.lerp : void 0,
17298
- at: (u) => span.at(1 - u)
17299
- })).reverse();
17300
- }
17301
- function repeat(curve, times) {
17302
- return Array.from({ length: Math.max(0, times) }, () => curve).flat();
17303
- }
17304
- function pingPong(curve) {
17305
- return chain(curve, reverse(curve));
17222
+ return;
17223
+ }
17224
+ const bar = abilityBarNode.exec(node);
17225
+ if (bar) {
17226
+ views.get(player.slot)?.bar?.handler(player, Number(bar[1]));
17227
+ return;
17228
+ }
17229
+ const pressed = screens.get(player.slot)?.presses.get(node);
17230
+ if (pressed) {
17231
+ pressed.handler(player);
17232
+ }
17306
17233
  }
17307
- function durationOf(curve) {
17308
- return curve.reduce((sum, span) => sum + Math.max(0, span.duration), 0);
17234
+ function change(player, node, value) {
17235
+ if (typeof value === "object" && value !== null) {
17236
+ screens.get(player.slot)?.wheels.get(node)?.handler(player, value);
17237
+ return;
17238
+ }
17239
+ const changed = screens.get(player.slot)?.changes.get(node);
17240
+ if (changed) {
17241
+ changed.handler(player, value);
17242
+ }
17309
17243
  }
17310
- function valueAt(curve, seconds) {
17311
- let left2 = seconds;
17312
- for (const span of curve) {
17313
- if (span.duration <= 0) continue;
17314
- if (left2 <= span.duration) return span.at(Math.max(0, left2) / span.duration);
17315
- left2 -= span.duration;
17244
+ function tick(seconds) {
17245
+ now2 = seconds;
17246
+ if (expireChat(now2)) drawAll();
17247
+ for (const current of views.values()) {
17248
+ if (!current.notices.some((notice) => notice.until <= now2)) {
17249
+ continue;
17250
+ }
17251
+ current.notices = current.notices.filter((notice) => notice.until > now2);
17252
+ draw(current.player);
17316
17253
  }
17317
- return curve.at(-1)?.at(1);
17318
17254
  }
17319
- function bias(t, b) {
17320
- return t ** (Math.log(b) / Math.log(0.5));
17321
- }
17322
- function gain(t, g) {
17323
- return t < 0.5 ? bias(2 * t, 1 - g) / 2 : 1 - bias(2 - 2 * t, 1 - g) / 2;
17324
- }
17325
- function mix(a, b, t) {
17326
- if (typeof a === "number" && typeof b === "number") return a + (b - a) * t;
17327
- const [p, q] = [vector2(a), vector2(b)];
17328
- return {
17329
- x: p.x + (q.x - p.x) * t,
17330
- y: p.y + (q.y - p.y) * t,
17331
- z: p.z + (q.z - p.z) * t
17255
+ var views = /* @__PURE__ */ new Map();
17256
+ var everyoneHud = [];
17257
+ var now2 = 0;
17258
+ var nextNotice = 0;
17259
+ var nextCue = 1;
17260
+ var maxCues = 8;
17261
+ var maxNotices = 4;
17262
+ var noticeMotion = {
17263
+ enter: { opacity: 0, translate: [-16, 0] },
17264
+ exit: { opacity: 0 },
17265
+ transition: { seconds: 0.25, easing: "out" }
17266
+ };
17267
+ function view(player) {
17268
+ return views.get(player.slot) ?? {
17269
+ player,
17270
+ root: void 0,
17271
+ hud: [],
17272
+ cursor: false,
17273
+ asks: 0,
17274
+ routes: /* @__PURE__ */ new Map(),
17275
+ cues: [],
17276
+ bar: void 0,
17277
+ display: [],
17278
+ notices: []
17332
17279
  };
17333
17280
  }
17334
- function spline(p0, p1, p2, p3, t) {
17335
- const f = (a2, b2, c2, d2) => 0.5 * (2 * b2 + (c2 - a2) * t + (2 * a2 - 5 * b2 + 4 * c2 - d2) * t * t + (3 * b2 - a2 - 3 * c2 + d2) * t * t * t);
17336
- if (typeof p0 === "number" && typeof p1 === "number" && typeof p2 === "number" && typeof p3 === "number") {
17337
- return f(p0, p1, p2, p3);
17281
+ function draw(player) {
17282
+ const current = view(player);
17283
+ const root = [
17284
+ current.root,
17285
+ chatLines(player),
17286
+ current.notices.length !== 0 && notices(current.notices)
17287
+ ];
17288
+ const previous = screens.get(player.slot);
17289
+ const hud = hiddenParts(current.hud);
17290
+ const display = displayRows(player, current.display);
17291
+ const next = render(
17292
+ previous,
17293
+ root,
17294
+ hud,
17295
+ current.cursor,
17296
+ current.asks,
17297
+ current.routes,
17298
+ current.cues,
17299
+ current.bar !== void 0,
17300
+ display
17301
+ );
17302
+ const change2 = diff(previous, next);
17303
+ if (change2 && !send(player.slot, change2)) {
17304
+ const whole = render(
17305
+ void 0,
17306
+ root,
17307
+ hud,
17308
+ current.cursor,
17309
+ current.asks,
17310
+ current.routes,
17311
+ current.cues,
17312
+ current.bar !== void 0,
17313
+ display
17314
+ );
17315
+ if (!send(player.slot, diff(void 0, whole))) {
17316
+ screens.delete(player.slot);
17317
+ return false;
17318
+ }
17319
+ screens.set(player.slot, whole);
17320
+ return true;
17338
17321
  }
17339
- const [a, b, c, d] = [vector2(p0), vector2(p1), vector2(p2), vector2(p3)];
17340
- return {
17341
- x: f(a.x, b.x, c.x, d.x),
17342
- y: f(a.y, b.y, c.y, d.y),
17343
- z: f(a.z, b.z, c.z, d.z)
17344
- };
17322
+ screens.set(player.slot, next);
17323
+ return true;
17345
17324
  }
17346
- function distance2(a, b) {
17347
- if (typeof a === "number" && typeof b === "number") return Math.abs(b - a);
17348
- const [p, q] = [vector2(a), vector2(b)];
17349
- return Math.hypot(q.x - p.x, q.y - p.y, q.z - p.z);
17325
+ function drawAll() {
17326
+ for (const { player } of players()) {
17327
+ draw(player);
17328
+ }
17350
17329
  }
17351
- function vector2(value) {
17352
- return typeof value === "number" ? { x: value, y: 0, z: 0 } : value;
17330
+ function hiddenParts(own) {
17331
+ const parts = [];
17332
+ for (const part of everyoneHud) parts.push(hudParts[part]);
17333
+ for (const part of own) {
17334
+ const wire = hudParts[part];
17335
+ if (!parts.includes(wire)) parts.push(wire);
17336
+ }
17337
+ return parts;
17353
17338
  }
17354
-
17355
- // js/src/camera.ts
17356
- function setOrbitCamera(player, enabled) {
17357
- const pawn = player.pawn();
17358
- if (!pawn?.entity) return false;
17359
- const flag = writeField(
17360
- pawn.entity,
17361
- "CCitadelPlayerPawn",
17362
- "m_bInHideoutZone",
17363
- "bool",
17364
- enabled
17365
- );
17366
- const zoom = holdModifierState(
17367
- pawn.entity,
17368
- "MODIFIER_STATE_HIDEOUT_ZONE",
17369
- enabled
17339
+ function notices(stack) {
17340
+ const style = {
17341
+ width: "fit",
17342
+ height: "fit",
17343
+ flow: "down",
17344
+ horizontalAlign: "left",
17345
+ verticalAlign: "bottom",
17346
+ margin: [0, 0, 260, 24],
17347
+ transition: noticeMotion.transition
17348
+ };
17349
+ const labels = stack.map(
17350
+ (notice) => jsx(
17351
+ "label",
17352
+ {
17353
+ style: {
17354
+ horizontalAlign: "left",
17355
+ margin: [4, 0, 0, 0],
17356
+ padding: [5, 10],
17357
+ background: "#101418d8",
17358
+ color: "#f2f2f2",
17359
+ fontSize: 16,
17360
+ borderRadius: 4,
17361
+ transition: noticeMotion.transition
17362
+ },
17363
+ enter: noticeMotion.enter,
17364
+ exit: noticeMotion.exit,
17365
+ children: notice.text
17366
+ },
17367
+ notice.id
17368
+ )
17370
17369
  );
17371
- if (enabled) return flag && zoom;
17372
- const orbit2 = fireInput(pawn.entity, "RemoveModifier", {
17373
- text: "modifier_citadel_orbit_camera"
17374
- });
17375
- return flag && zoom && orbit2;
17370
+ return jsx("panel", { style, exit: noticeMotion.exit, children: labels });
17376
17371
  }
17377
- var moves = 0;
17378
- function playCamera(player, options) {
17379
- const tracks = [];
17380
- for (const [param, curve] of Object.entries(options.tracks)) {
17381
- if (curve) tracks.push({ param, curve });
17372
+ var screens = /* @__PURE__ */ new Map();
17373
+ function render(previous, root, hud, cursor, asks, routes, cues, bar, display) {
17374
+ const layout = new Layout(previous);
17375
+ layout.add({
17376
+ id: "",
17377
+ kind: 0 /* PANEL */,
17378
+ children: place(layout, root, "/"),
17379
+ hideHud: [...hud],
17380
+ freeCursor: cursor,
17381
+ freeCursorAsks: asks,
17382
+ sheets: [...sheets],
17383
+ cues: [...cues],
17384
+ abilityBarPresses: bar,
17385
+ abilityDisplay: [...display]
17386
+ });
17387
+ for (const [name, data] of routes) {
17388
+ layout.add({ id: `route:${name}`, kind: 5 /* ROUTE */, route: name, data });
17382
17389
  }
17383
- return playTracks(player, options, tracks);
17390
+ return layout.screen;
17384
17391
  }
17385
- function playTracks(player, options, tracks) {
17386
- const context = options.context ?? `modlock.camera.${++moves}`;
17387
- const length3 = Math.max(0, ...tracks.map((track) => durationOf(track.curve)));
17388
- const send2 = (delay) => tracks.every(
17389
- ({ param, curve }) => sendCurve(player, { ...options, context, param, delay }, curve)
17390
- );
17391
- let timer;
17392
- const stop = () => {
17393
- timer?.cancel();
17394
- return player.clearCamera(context);
17395
- };
17396
- let sent = send2(options.delay);
17397
- if (sent && options.loop && length3 > 0) {
17398
- sent = send2(void 0);
17399
- timer = every(length3, () => {
17400
- if (!send2(void 0)) stop();
17392
+ var Layout = class {
17393
+ screen;
17394
+ previous;
17395
+ /** The layout continues previous's id counter and keeps its ids. */
17396
+ constructor(previous) {
17397
+ this.previous = previous;
17398
+ this.screen = {
17399
+ nodes: /* @__PURE__ */ new Map(),
17400
+ ids: /* @__PURE__ */ new Map(),
17401
+ presses: /* @__PURE__ */ new Map(),
17402
+ changes: /* @__PURE__ */ new Map(),
17403
+ actions: /* @__PURE__ */ new Map(),
17404
+ wheels: /* @__PURE__ */ new Map(),
17405
+ next: previous?.next ?? 0
17406
+ };
17407
+ }
17408
+ /** add records a node. */
17409
+ add(node) {
17410
+ const value = node.steamId === void 0 ? node : { ...node, steamId: String(node.steamId) };
17411
+ const encoded = JSON.stringify(value);
17412
+ this.screen.nodes.set(node.id, { node, encoded });
17413
+ }
17414
+ /** id returns the node id for the element at place. */
17415
+ id(place2) {
17416
+ let found = this.previous?.ids.get(place2);
17417
+ if (found === void 0) {
17418
+ found = (this.screen.next++).toString(36);
17419
+ }
17420
+ this.screen.ids.set(place2, found);
17421
+ return found;
17422
+ }
17423
+ };
17424
+ function place(layout, child, at3) {
17425
+ if (child === null || child === void 0 || typeof child === "boolean") {
17426
+ return [];
17427
+ }
17428
+ if (isList(child)) {
17429
+ return child.flatMap((item2, index) => {
17430
+ const key = isElement(item2) ? item2.key : void 0;
17431
+ return place(
17432
+ layout,
17433
+ item2,
17434
+ key === void 0 ? `${at3},${index}` : `${at3},=${key}`
17435
+ );
17401
17436
  });
17402
17437
  }
17403
- if (!sent) {
17404
- stop();
17405
- return void 0;
17438
+ if (!isElement(child)) {
17439
+ const node2 = {
17440
+ id: layout.id(at3),
17441
+ kind: 1 /* LABEL */,
17442
+ text: String(child)
17443
+ };
17444
+ layout.add(node2);
17445
+ return [node2.id];
17406
17446
  }
17407
- return {
17408
- context,
17409
- duration: options.loop ? Infinity : (options.delay ?? 0) + length3,
17410
- cancel: stop
17411
- };
17412
- }
17413
- function cameraPulse(player, options) {
17414
- const { param, by, ease: shape = ease.linear } = options;
17415
- const rest = zero2(by);
17416
- const curve = chain(
17417
- line(rest, by, options.in, shape),
17418
- hold(by, options.hold),
17419
- reverse(line(rest, by, options.out, shape))
17420
- );
17421
- return playTracks(player, { ...options, relative: true }, [{ param, curve }]);
17422
- }
17423
- function cameraShake(player, options) {
17424
- const { amplitude, duration } = options;
17425
- const curve = wave({
17426
- amplitude,
17427
- duration,
17428
- frequency: options.frequency ?? 8,
17429
- decay: true
17430
- });
17431
- const param = options.param ?? "horizontalOffset";
17432
- return playTracks(player, { ...options, relative: true }, [{ param, curve }]);
17433
- }
17434
- function sendCurve(player, options, curve) {
17435
- const { context, param, relative, priority, target } = options;
17436
- const rate = options.rate ?? 30;
17437
- let delay = options.delay;
17438
- const lerp3 = (start2, end, duration, shape = {}) => {
17439
- const sent = player.moveCamera({
17440
- context,
17441
- param,
17442
- motion: { lerp: { start: start2, end, duration, ...shape } },
17443
- delay,
17444
- relative,
17445
- priority,
17446
- target
17447
- });
17448
- delay = void 0;
17449
- return sent;
17447
+ if (child.type === fragment) {
17448
+ return place(layout, child.props.children, `${at3}>`);
17449
+ }
17450
+ const props = child.props;
17451
+ const node = {
17452
+ id: layout.id(at3),
17453
+ style: wireStyle(props.style),
17454
+ hover: wireStyle(props.hover),
17455
+ tooltip: props.tooltip,
17456
+ item: props.item ? itemId(props.item) : void 0,
17457
+ ability: props.ability?.name ? itemId(props.ability.name) : void 0,
17458
+ abilityPlayer: props.ability?.name ? props.ability.player.slot : void 0,
17459
+ hoverSound: props.hoverSound,
17460
+ enter: wireStyle(props.enter),
17461
+ exit: wireStyle(props.exit),
17462
+ cycle: cycle(props.cycle),
17463
+ classes: classes(props.class)
17450
17464
  };
17451
- return curve.every((span) => {
17452
- if (span.duration <= 0) return true;
17453
- if (span.lerp) {
17454
- return lerp3(span.at(0), span.at(1), span.duration, span.lerp);
17455
- }
17456
- const steps = Math.max(1, Math.ceil(span.duration * rate));
17457
- for (let i = 0; i < steps; i++) {
17458
- const sent = lerp3(
17459
- span.at(i / steps),
17460
- span.at((i + 1) / steps),
17461
- span.duration / steps
17462
- );
17463
- if (!sent) return false;
17464
- }
17465
- return true;
17466
- });
17465
+ switch (child.type) {
17466
+ case "label":
17467
+ node.kind = 1 /* LABEL */;
17468
+ node.text = text(props.children);
17469
+ node.token = props.token;
17470
+ node.variables = variables(props.variables);
17471
+ break;
17472
+ case "avatar":
17473
+ node.kind = 8 /* AVATAR */;
17474
+ node.steamId = props.steamId;
17475
+ break;
17476
+ case "entry":
17477
+ case "slider":
17478
+ case "toggle":
17479
+ case "dropdown":
17480
+ input(layout, node, child.type, props);
17481
+ break;
17482
+ case "image":
17483
+ node.kind = 2 /* IMAGE */;
17484
+ node.image = props.src ?? "";
17485
+ node.scaling = scaling(props.scaling);
17486
+ break;
17487
+ case "hero":
17488
+ node.kind = 6 /* HERO_IMAGE */;
17489
+ node.hero = props.hero;
17490
+ node.heroLook = props.look === void 0 ? void 0 : looks[props.look];
17491
+ node.scaling = scaling(props.scaling);
17492
+ break;
17493
+ case "button":
17494
+ node.kind = 3 /* BUTTON */;
17495
+ node.sound = props.sound;
17496
+ node.disabled = props.disabled;
17497
+ if (props.onPress && !props.disabled) {
17498
+ layout.screen.presses.set(node.id, { handler: props.onPress });
17499
+ }
17500
+ node.children = place(layout, props.children, `${at3}/`);
17501
+ break;
17502
+ case "layout":
17503
+ node.kind = 4 /* LAYOUT */;
17504
+ node.layout = props.src ?? "";
17505
+ node.data = props.data === void 0 ? "" : JSON.stringify(props.data) ?? "";
17506
+ if (props.onAction) {
17507
+ layout.screen.actions.set(node.id, { handler: props.onAction });
17508
+ }
17509
+ break;
17510
+ default:
17511
+ node.kind = 0 /* PANEL */;
17512
+ node.children = place(layout, props.children, `${at3}/`);
17513
+ }
17514
+ layout.add(node);
17515
+ return [node.id];
17467
17516
  }
17468
- function zero2(value) {
17469
- return typeof value === "number" ? 0 : { x: 0, y: 0, z: 0 };
17517
+ function classes(names) {
17518
+ const list = (names ?? "").split(" ").filter((name) => name !== "");
17519
+ return list.length === 0 ? void 0 : list;
17470
17520
  }
17471
-
17472
- // js/src/format.ts
17473
- var format_exports = {};
17474
- __export(format_exports, {
17475
- clip: () => clip,
17476
- clock: () => clock,
17477
- count: () => count,
17478
- grouped: () => grouped,
17479
- ordinal: () => ordinal,
17480
- percent: () => percent,
17481
- stopwatch: () => stopwatch
17482
- });
17483
- function clock(seconds) {
17484
- const whole = Math.max(0, Math.ceil(seconds));
17485
- return `${Math.floor(whole / 60)}:${String(whole % 60).padStart(2, "0")}`;
17521
+ function input(layout, node, kind, props) {
17522
+ node.kind = 7 /* INPUT */;
17523
+ node.disabled = props.disabled;
17524
+ if (props.onChange && !props.disabled) {
17525
+ layout.screen.changes.set(node.id, { handler: props.onChange });
17526
+ }
17527
+ switch (kind) {
17528
+ case "entry":
17529
+ node.input = {
17530
+ case: "textEntry",
17531
+ value: {
17532
+ text: String(props.value ?? ""),
17533
+ placeholder: props.placeholder,
17534
+ maxLength: props.maxLength
17535
+ }
17536
+ };
17537
+ break;
17538
+ case "slider":
17539
+ if (props.onWheel && !props.disabled) {
17540
+ layout.screen.wheels.set(node.id, { handler: props.onWheel });
17541
+ }
17542
+ node.input = {
17543
+ case: "slider",
17544
+ value: {
17545
+ value: Number(props.value ?? 0),
17546
+ min: props.min,
17547
+ max: props.max,
17548
+ step: props.step,
17549
+ wheel: !!props.onWheel && !props.disabled
17550
+ }
17551
+ };
17552
+ break;
17553
+ case "toggle":
17554
+ node.text = text(props.children);
17555
+ node.input = { case: "toggle", value: { on: props.on } };
17556
+ break;
17557
+ case "dropdown":
17558
+ node.input = {
17559
+ case: "dropdown",
17560
+ value: {
17561
+ options: [...props.options ?? []],
17562
+ selected: props.selected
17563
+ }
17564
+ };
17565
+ }
17486
17566
  }
17487
- function stopwatch(seconds) {
17488
- const hundredths = Math.max(0, Math.floor(seconds * 100));
17489
- const minutes = Math.floor(hundredths / 6e3);
17490
- const rest = hundredths % 6e3 / 100;
17491
- return `${minutes}:${rest.toFixed(2).padStart(5, "0")}`;
17567
+ function variables(value) {
17568
+ if (!value) {
17569
+ return void 0;
17570
+ }
17571
+ const encoded = {};
17572
+ for (const [name, filled] of Object.entries(value)) {
17573
+ encoded[name] = String(filled);
17574
+ }
17575
+ return encoded;
17492
17576
  }
17493
- function percent(part, whole) {
17494
- if (!(whole > 0)) {
17495
- return "-";
17577
+ function cycle(value) {
17578
+ if (!value) {
17579
+ return void 0;
17496
17580
  }
17497
- return `${Math.round(Math.max(0, Math.min(part / whole, 1)) * 100)}%`;
17581
+ return {
17582
+ style: wireStyle(value.style),
17583
+ seconds: value.seconds,
17584
+ count: value.count
17585
+ };
17498
17586
  }
17499
- function grouped(value) {
17500
- return String(Math.round(value)).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
17587
+ function diff(previous, next) {
17588
+ const set = [...next.nodes.values()].filter(
17589
+ ({ node, encoded }) => previous?.nodes.get(node.id)?.encoded !== encoded
17590
+ ).map(({ node }) => node);
17591
+ const removed = [...previous?.nodes.keys() ?? []].filter(
17592
+ (id) => !next.nodes.has(id)
17593
+ );
17594
+ if (previous && set.length === 0 && removed.length === 0) {
17595
+ return void 0;
17596
+ }
17597
+ return { reset: !previous, set, removed };
17501
17598
  }
17502
- function ordinal(place2) {
17503
- const tens = place2 % 100;
17504
- const suffix = tens >= 11 && tens <= 13 ? "th" : ["th", "st", "nd", "rd"][place2 % 10] ?? "th";
17505
- return `${place2}${suffix}`;
17599
+ function send(slot, change2) {
17600
+ return call("Ui", UiRequest.toBinary({ player: slot, change: change2 })) !== void 0;
17506
17601
  }
17507
- function count(number, thing, plural = `${thing}s`) {
17508
- return `${grouped(number)} ${number === 1 ? thing : plural}`;
17602
+ function isElement(child) {
17603
+ return typeof child === "object" && child !== null && !Array.isArray(child);
17509
17604
  }
17510
- function clip(text2, width) {
17511
- if (text2.length <= width) return text2;
17512
- const cut = text2.slice(0, width - 1);
17513
- const space = cut.lastIndexOf(" ");
17514
- return `${(space > 0 ? cut.slice(0, space) : cut).trimEnd()}\u2026`;
17605
+ function isList(child) {
17606
+ return Array.isArray(child);
17515
17607
  }
17516
-
17517
- // js/src/items.gen.ts
17518
- var itemTable = [
17519
- { name: "upgrade_ability_power_shard", id: 630839635, slot: "spirit", tier: 4, active: true, imbue: true, icon: "file://{images}/upgrades/mods_tech/echo_shard.psd" },
17520
- { name: "upgrade_ability_refresher", id: 677738769, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/refresher_module.psd" },
17521
- { name: "upgrade_absorbing_armor", id: 3028234315, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_medallion.psd" },
17522
- { name: "upgrade_acolytes_glove", id: 465043967, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/acolytes_glove.psd" },
17523
- { name: "upgrade_active_reload", id: 381961617, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/deployable_bullet_shield.psd" },
17524
- { name: "upgrade_aerial_assault", id: 271801138, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/springy_boots.psd" },
17525
- { name: "upgrade_aoe_root", id: 1152158042, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/area_immobilize.psd" },
17526
- { name: "upgrade_aprounds", id: 673001892, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/armor_breaking_bullets.psd" },
17527
- { name: "upgrade_arcane_extension", id: 2951612397, slot: "spirit", tier: 2, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/duration_extender.psd" },
17528
- { name: "upgrade_arcane_surge", id: 1150006784, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_surge.psd" },
17529
- { name: "upgrade_arctic_blast", id: 3812615317, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/ice_blast.psd" },
17530
- { name: "upgrade_auto_cleanse", id: 951866250, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/items/vitality/indomitable.psd" },
17531
- { name: "upgrade_banshee_slugs", id: 3884003354, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/banshee_slugs.psd" },
17532
- { name: "upgrade_berserker", id: 1414319208, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/berserker.psd" },
17533
- { name: "upgrade_blitz_bullets", id: 4104549924, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus.psd" },
17534
- { name: "upgrade_boundless_spirit", id: 2519598785, slot: "spirit", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/boundless_spirit.psd" },
17535
- { name: "upgrade_boxing_glove", id: 1252627263, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/boxing_glove.psd" },
17536
- { name: "upgrade_bullet_armor_reduction_aura", id: 2481177645, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_armor_reduction_aura.psd" },
17537
- { name: "upgrade_bullet_resist_shredder", id: 2971868509, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/bullet_resist_shredder.psd" },
17538
- { name: "upgrade_bulletshredimbue", id: 3294954488, slot: "weapon", tier: 3, active: false, imbue: true, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus.psd" },
17539
- { name: "upgrade_burst_fire", id: 2739107182, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus_plus.psd" },
17540
- { name: "upgrade_capacitor", id: 710436191, slot: "weapon", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/electrified_bullets.psd" },
17541
- { name: "upgrade_cardio_calibrator", id: 2447176615, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/sprint_booster.psd" },
17542
- { name: "upgrade_celestial_guidance", id: 3729138568, slot: "vitality", tier: 5, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/debuff_reducer.psd" },
17543
- { name: "upgrade_chain_lightning", id: 811521119, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/electrified_bullets.psd" },
17544
- { name: "upgrade_cheat_death", id: 3361811174, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/torment_aura.psd" },
17545
- { name: "upgrade_chonky", id: 3585132399, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/revitalizer.psd" },
17546
- { name: "upgrade_clip_size", id: 1548066885, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/clip_size.psd" },
17547
- { name: "upgrade_cloaking_device_active", id: 1798666702, slot: "weapon", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/cloaking_device.psd" },
17548
- { name: "upgrade_close_quarter_combat", id: 2095565695, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/point_blank.psd" },
17549
- { name: "upgrade_close_range", id: 1342610602, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/close_range.psd" },
17550
- { name: "upgrade_cold_front", id: 1976391348, slot: "spirit", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/ice_blast.psd" },
17551
- { name: "upgrade_colossus", id: 2407781327, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/colossus.psd" },
17552
- { name: "upgrade_containment", id: 1813726886, slot: "spirit", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/immobilize.psd" },
17553
- { name: "upgrade_cooldown_reduction", id: 3261353684, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/spiritual_flow.psd" },
17554
- { name: "upgrade_counterspell", id: 1414025773, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/hud/modifiers/icon_parry.svg" },
17555
- { name: "upgrade_crackshot", id: 395867183, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/explosive_bullets.psd" },
17556
- { name: "upgrade_critshot", id: 1396247347, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/crit_damage.psd" },
17557
- { name: "upgrade_crushing_fists", id: 800008313, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/melee_charge.psd" },
17558
- { name: "upgrade_damage_recycler", id: 865846625, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/leech.psd" },
17559
- { name: "upgrade_debuff_reducer", id: 1047818222, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/debuff_reducer.psd" },
17560
- { name: "upgrade_deflecting_armor", id: 3491236900, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_medallion.psd" },
17561
- { name: "upgrade_disarm", id: 2645639421, slot: "spirit", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/disarm.psd" },
17562
- { name: "upgrade_discord", id: 2417568017, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/rupture.psd" },
17563
- { name: "upgrade_divine_barrier", id: 1662311306, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/savior.psd" },
17564
- { name: "upgrade_diviners_kevlar", id: 2820116164, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
17565
- { name: "upgrade_dps_aura", id: 2108215830, slot: "weapon", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/bullet_damage_aura.psd" },
17566
- { name: "upgrade_eldritch_shot", id: 3568217437, slot: "weapon", tier: 5, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/explosive_bullets.psd" },
17567
- { name: "upgrade_endurance", id: 2829638276, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/endurance.psd" },
17568
- { name: "upgrade_escalating_exposure", id: 3005970438, slot: "spirit", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/escalating_exposure.psd" },
17569
- { name: "upgrade_ethereal_bullets", id: 3919289022, slot: "spirit", tier: 4, active: false, imbue: true, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus.psd" },
17570
- { name: "upgrade_extra_charge", id: 3776945997, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/extra_charge.psd" },
17571
- { name: "upgrade_fervor", id: 339443430, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/fervor.psd" },
17572
- { name: "upgrade_fleetfoot_boots", id: 3403085434, slot: "weapon", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/fleetfoot_boots.psd" },
17573
- { name: "upgrade_focus_lens", id: 2142980412, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/focused_silence.psd" },
17574
- { name: "upgrade_fury_trance", id: 1409190604, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/vampiric_burst.psd" },
17575
- { name: "upgrade_glass_cannon", id: 365620721, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/glass_cannon.psd" },
17576
- { name: "upgrade_glitch", id: 2617435668, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/glitch.psd" },
17577
- { name: "upgrade_goose_egg", id: 2462046703, slot: "spirit", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/tech_damage.psd" },
17578
- { name: "upgrade_greater_withering_whip", id: 2061878743, slot: "spirit", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/disarm.psd" },
17579
- { name: "upgrade_grit", id: 1672893796, slot: "vitality", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
17580
- { name: "upgrade_guardian_ward", id: 857669956, slot: "vitality", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/savior.psd" },
17581
- { name: "upgrade_headhunter", id: 4053935515, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/headhunter.psd" },
17582
- { name: "upgrade_headshot_booster", id: 2010028405, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/headshot_booster.psd" },
17583
- { name: "upgrade_headshot_booster2", id: 1770441818, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/headshot_booster.psd" },
17584
- { name: "upgrade_healbane", id: 2603935618, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/healbane.psd" },
17585
- { name: "upgrade_healbuff", id: 1427630806, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/aura_icon.psd" },
17586
- { name: "upgrade_healing_booster", id: 2566692615, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/healing_booster.psd" },
17587
- { name: "upgrade_health", id: 3633614685, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/health.psd" },
17588
- { name: "upgrade_health_nova", id: 2956256701, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/health_nova.psd" },
17589
- { name: "upgrade_health_regen_aura", id: 3321728133, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/health_regen_aura.psd" },
17590
- { name: "upgrade_health_stealing_magic", id: 876563814, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/health_stealing_tech.psd" },
17591
- { name: "upgrade_health_stimpak", id: 1710079648, slot: "vitality", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/stimpak.psd" },
17592
- { name: "upgrade_high_velocity_mag", id: 3077079169, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/high_velocity_mag.psd" },
17593
- { name: "upgrade_hollow_point_rounds", id: 2678489038, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/hollow_point.psd" },
17594
- { name: "upgrade_icarus_wings", id: 1736094134, slot: "vitality", tier: 5, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/sprint_booster.psd" },
17595
- { name: "upgrade_imbued_duration_extender", id: 2717651715, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_persistance.psd" },
17596
- { name: "upgrade_improved_bullet_armor", id: 3140772621, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/improved_bullet_armor.psd" },
17597
- { name: "upgrade_improved_spirit", id: 968099481, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/tech_damage.psd" },
17598
- { name: "upgrade_improved_stamina", id: 4139877411, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/improved_stamina.psd" },
17599
- { name: "upgrade_infinite_rounds", id: 3269957497, slot: "weapon", tier: 5, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/armor_breaking_bullets.psd" },
17600
- { name: "upgrade_infuser", id: 1797283378, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/infuser.psd" },
17601
- { name: "upgrade_inhibitor", id: 2037039379, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/inhibitor.psd" },
17602
- { name: "upgrade_intensifying_clip", id: 2407033488, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/auto_reloader.psd" },
17603
- { name: "upgrade_juggernaut", id: 1250307611, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/items/vitality/juggernaut.psd" },
17604
- { name: "upgrade_kinetic_sash", id: 3977876567, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/kinetic_sash.psd" },
17605
- { name: "upgrade_lifestrike_gauntlets", id: 1437614329, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/lifestrike_gauntlets.psd" },
17606
- { name: "upgrade_long_range", id: 3331811235, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/long_range.psd" },
17607
- { name: "upgrade_magic_burst", id: 1998374645, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/magic_burst.psd" },
17608
- { name: "upgrade_magic_carpet", id: 2800629741, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/hud/abilities/kelvin/ice_path.psd" },
17609
- { name: "upgrade_magic_reach", id: 754480263, slot: "spirit", tier: 1, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/tech_range.psd" },
17610
- { name: "upgrade_magic_shield", id: 3970837787, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/tech_shield_pulse.psd" },
17611
- { name: "upgrade_magic_shock", id: 2121044373, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/magic_shock.psd" },
17612
- { name: "upgrade_magic_slow", id: 1102081447, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/slowing_tech.psd" },
17613
- { name: "upgrade_magic_storm", id: 1292979587, slot: "spirit", tier: 3, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/magic_storm.psd" },
17614
- { name: "upgrade_magic_tempo", id: 380806748, slot: "spirit", tier: 2, active: false, imbue: true, icon: "file://{images}/upgrades/mods_utility/advanced_recharge.psd" },
17615
- { name: "upgrade_magic_vulnerability", id: 2081037738, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/tech_vulnerability.psd" },
17616
- { name: "upgrade_medic_bullets", id: 3862866912, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/medic_bullets.psd" },
17617
- { name: "upgrade_melee_charge", id: 26002154, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/melee_charge.psd" },
17618
- { name: "upgrade_melee_rebuttal", id: 4204808176, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/hud/modifiers/icon_parry.svg" },
17619
- { name: "upgrade_metal_skin", id: 1378931225, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/metal_skin.psd" },
17620
- { name: "upgrade_mystic_regeneration", id: 1439347412, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/endurance.psd" },
17621
- { name: "upgrade_mystic_reverb", id: 3577481646, slot: "spirit", tier: 4, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/magic_reverb.psd" },
17622
- { name: "upgrade_mystical_piano", id: 2054088113, slot: "spirit", tier: 5, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/knockdown.psd" },
17623
- { name: "upgrade_non_player_bonus", id: 1009965641, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/reaper_rounds.psd" },
17624
- { name: "upgrade_nullification_aura", id: 3949773228, slot: "vitality", tier: 5, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_armor_reduction_aura.psd" },
17625
- { name: "upgrade_omnicharge_pendant", id: 424779525, slot: "spirit", tier: 5, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/rapid_recharge.psd" },
17626
- { name: "upgrade_personal_rejuvenator", id: 2329546537, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/rebirth.psd" },
17627
- { name: "upgrade_phantom_strike", id: 1371725689, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/phantom_strike.psd" },
17628
- { name: "upgrade_prism_blast", id: 1132564516, slot: "spirit", tier: 5, active: true, imbue: false, icon: "file://{images}/items/spirit/ethereal_shift.psd" },
17629
- { name: "upgrade_pristine_emblem", id: 2064029594, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/pristine_emblem.psd" },
17630
- { name: "upgrade_proc_silence", id: 1113837674, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/emp_bullets.psd" },
17631
- { name: "upgrade_quick_silver", id: 84321454, slot: "spirit", tier: 2, active: false, imbue: true, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus.psd" },
17632
- { name: "upgrade_rapid_recharge", id: 787198704, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/rapid_recharge.psd" },
17633
- { name: "upgrade_rapid_rounds", id: 668299740, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/rapid_rounds.psd" },
17634
- { name: "upgrade_rebirth", id: 4003032160, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/rebirth.psd" },
17635
- { name: "upgrade_rechargingbullets", id: 1763073141, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_medallion.psd" },
17636
- { name: "upgrade_reduce_debuff_duration", id: 3731635960, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/debuff_remover.psd" },
17637
- { name: "upgrade_regenerating_bullet_shield", id: 1235347618, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
17638
- { name: "upgrade_reinforcing_casings", id: 2463960640, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_armor_plus.psd" },
17639
- { name: "upgrade_rescue_beam", id: 1804594021, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/medic_beam.psd" },
17640
- { name: "upgrade_resonant_healing", id: 2947183272, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/boundless_spirit.psd" },
17641
- { name: "upgrade_restorative_locket", id: 2059712766, slot: "vitality", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/restorative_locket.psd" },
17642
- { name: "upgrade_return_fire", id: 3361075077, slot: "vitality", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/return_fire.psd" },
17643
- { name: "upgrade_ricochet", id: 2480592370, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/ricochet.psd" },
17644
- { name: "upgrade_rocket_booster", id: 600033864, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/hud/abilities/lash/lash_death_slam.psd" },
17645
- { name: "upgrade_rocket_boots", id: 3830846077, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/springy_boots.psd" },
17646
- { name: "upgrade_rupture", id: 3144988365, slot: "spirit", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/rupture.psd" },
17647
- { name: "upgrade_self_bubble", id: 2533252781, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/items/spirit/ethereal_shift.psd" },
17648
- { name: "upgrade_sharpshooter", id: 2152872419, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/longshot.psd" },
17649
- { name: "upgrade_shrink_ray", id: 4121584236, slot: "spirit", tier: 5, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/stimpak.psd" },
17650
- { name: "upgrade_siphon_bullets", id: 1282141666, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/siphon_bullets.psd" },
17651
- { name: "upgrade_slowing_bullets", id: 393974127, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/slowing_bullets.psd" },
17652
- { name: "upgrade_soaring_spirit", id: 7409189, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/soaring_spirit.psd" },
17653
- { name: "upgrade_spellslinger_headshots", id: 4075861416, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/spellslinger_headshots.psd" },
17654
- { name: "upgrade_spirit_bubble", id: 112198670, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
17655
- { name: "upgrade_spirit_burn", id: 343572757, slot: "spirit", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/escalating_exposure.psd" },
17656
- { name: "upgrade_spirit_sap", id: 1219329868, slot: "spirit", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/focused_silence.psd" },
17657
- { name: "upgrade_spirit_snatch", id: 3190916303, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/spirit_snatch.psd" },
17658
- { name: "upgrade_split_shot", id: 3647584222, slot: "weapon", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/titanic_magazine.psd" },
17659
- { name: "upgrade_sprint_booster", id: 3399065363, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/sprint_booster.psd" },
17660
- { name: "upgrade_superior_stamina", id: 334300056, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/superior_stamina.psd" },
17661
- { name: "upgrade_suppressor", id: 1925087134, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/weapon_jammer.psd" },
17662
- { name: "upgrade_surging_power", id: 1055679805, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/vampiric_burst.psd" },
17663
- { name: "upgrade_target_stun", id: 1254091416, slot: "spirit", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/knockdown.psd" },
17664
- { name: "upgrade_targeted_silence", id: 619484391, slot: "spirit", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/targeted_silence.psd" },
17665
- { name: "upgrade_tech_damage_pulse", id: 395944548, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/torment_aura.psd" },
17666
- { name: "upgrade_tech_defense_shredders", id: 1144549437, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/tech_resist_shredder.psd" },
17667
- { name: "upgrade_tech_overflow", id: 2226497419, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/magic_overflow.psd" },
17668
- { name: "upgrade_tech_purge", id: 2163598980, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/tech_purge.psd" },
17669
- { name: "upgrade_tech_range", id: 1193964439, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/spiritual_dominion.psd" },
17670
- { name: "upgrade_thermal_detonator", id: 1932939246, slot: "weapon", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/thermal_detonator.psd" },
17671
- { name: "upgrade_titan_round", id: 2356412290, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/titanic_magazine.psd" },
17672
- { name: "upgrade_toxic_bullets", id: 3696726732, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/serrated_bullets.psd" },
17673
- { name: "upgrade_trophy_collector", id: 3074274290, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/sprint_booster.psd" },
17674
- { name: "upgrade_ultimate_burst", id: 493591231, slot: "spirit", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/adrenaline_rush.psd" },
17675
- { name: "upgrade_unstoppable", id: 3357231760, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/unstoppable.psd" },
17676
- { name: "upgrade_vampire", id: 499683006, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/health_stealing_bullets.psd" },
17677
- { name: "upgrade_veil_walker", id: 865958998, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/veil_walker.psd" },
17678
- { name: "upgrade_vex_barrier", id: 1644605047, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/last_stand.psd" },
17679
- { name: "upgrade_warp_stone", id: 3270001687, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/warp_stone.psd" },
17680
- { name: "upgrade_weapon_shielding", id: 805079544, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
17681
- { name: "upgrade_weighted_shots", id: 3791587546, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/improved_bullet_armor.psd" },
17682
- { name: "upgrade_withering_whip", id: 2922054143, slot: "spirit", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/slowing_tech.psd" }
17683
- ];
17684
-
17685
- // js/src/items.ts
17686
- var items = itemTable;
17687
- function item(name) {
17688
- return byName.get(name);
17608
+ function text(children) {
17609
+ if (children === null || children === void 0 || typeof children === "boolean") {
17610
+ return "";
17611
+ }
17612
+ if (isList(children)) {
17613
+ return children.map(text).join("");
17614
+ }
17615
+ return isElement(children) ? "" : String(children);
17689
17616
  }
17690
- var byName = new Map(items.map((each) => [each.name, each]));
17691
-
17692
- // js/src/hook.ts
17693
- var hookAbility = "citadel_ability_hook";
17694
- var hookUpgrades = 15;
17695
- var Hook = class {
17696
- constructor(read, cooldownSeconds = 0) {
17697
- this.read = read;
17698
- this.cooldownSeconds = cooldownSeconds;
17617
+ var aligns = {
17618
+ left: 0 /* START */,
17619
+ top: 0 /* START */,
17620
+ center: 1 /* CENTER */,
17621
+ right: 2 /* END */,
17622
+ bottom: 2 /* END */
17623
+ };
17624
+ function align(value) {
17625
+ return value === void 0 ? void 0 : aligns[value];
17626
+ }
17627
+ var hudParts = {
17628
+ levelUp: 1 /* LEVEL_UP */,
17629
+ ownHealth: 2 /* OWN_HEALTH */,
17630
+ topBar: 3 /* TOP_BAR */,
17631
+ ammo: 4 /* AMMO */,
17632
+ souls: 5 /* SOULS */,
17633
+ minimap: 6 /* MINIMAP */,
17634
+ abilities: 7 /* ABILITIES */,
17635
+ status: 8 /* STATUS */,
17636
+ stats: 9 /* STATS */,
17637
+ heroPicker: 10 /* HERO_PICKER */,
17638
+ brokerCountdown: 11 /* BROKER_COUNTDOWN */,
17639
+ all: 12 /* ALL */
17640
+ };
17641
+ var faces = {
17642
+ body: 1 /* BODY */,
17643
+ block: 2 /* BLOCK */,
17644
+ serif: 3 /* SERIF */
17645
+ };
17646
+ var looks = {
17647
+ small: 0 /* SMALL */,
17648
+ card: 1 /* CARD */,
17649
+ icon: 2 /* ICON */,
17650
+ vertical: 3 /* VERTICAL */,
17651
+ topBar: 4 /* TOP_BAR */,
17652
+ minimap: 5 /* MINIMAP */
17653
+ };
17654
+ var scalings = {
17655
+ fit: 1 /* FIT */,
17656
+ cover: 2 /* COVER */,
17657
+ stretch: 3 /* STRETCH */,
17658
+ fitWidth: 4 /* FIT_WIDTH */,
17659
+ fitHeight: 5 /* FIT_HEIGHT */,
17660
+ none: 6 /* NONE */
17661
+ };
17662
+ function scaling(value) {
17663
+ return value === void 0 ? void 0 : scalings[value];
17664
+ }
17665
+ var flows = {
17666
+ down: 1 /* DOWN */,
17667
+ right: 2 /* RIGHT */,
17668
+ downWrap: 3 /* DOWN_WRAP */,
17669
+ rightWrap: 4 /* RIGHT_WRAP */
17670
+ };
17671
+ var overflows = {
17672
+ squish: 1 /* SQUISH */,
17673
+ clip: 2 /* CLIP */,
17674
+ scroll: 3 /* SCROLL */,
17675
+ show: 4 /* SHOW */
17676
+ };
17677
+ function overflow(value) {
17678
+ return value === void 0 ? void 0 : overflows[value];
17679
+ }
17680
+ var shapes = {
17681
+ down: 0 /* DOWN */,
17682
+ right: 1 /* RIGHT */,
17683
+ up: 2 /* UP */,
17684
+ left: 3 /* LEFT */,
17685
+ radial: 4 /* RADIAL */
17686
+ };
17687
+ var weights = {
17688
+ thin: 1 /* THIN */,
17689
+ light: 2 /* LIGHT */,
17690
+ normal: 3 /* NORMAL */,
17691
+ medium: 4 /* MEDIUM */,
17692
+ semiBold: 5 /* SEMI_BOLD */,
17693
+ bold: 6 /* BOLD */,
17694
+ black: 7 /* BLACK */
17695
+ };
17696
+ var textOverflows = {
17697
+ ellipsis: 1 /* ELLIPSIS */,
17698
+ shrink: 2 /* SHRINK */,
17699
+ clip: 3 /* CLIP */
17700
+ };
17701
+ var decorations = {
17702
+ underline: 1 /* UNDERLINE */,
17703
+ strike: 2 /* STRIKE */
17704
+ };
17705
+ var easings = {
17706
+ out: 0 /* EASE_OUT */,
17707
+ in: 1 /* EASE_IN */,
17708
+ inOut: 2 /* EASE_IN_OUT */,
17709
+ linear: 3 /* LINEAR */
17710
+ };
17711
+ function wireStyle(style) {
17712
+ if (!style) {
17713
+ return void 0;
17699
17714
  }
17700
- read;
17701
- cooldownSeconds;
17702
- /** thrownAt is the start of the latest cooldown counted as a throw. */
17703
- thrownAt = 0;
17704
- /** reset forgets the throws counted so far, for a thrower in a new world. */
17705
- reset() {
17706
- this.thrownAt = 0;
17715
+ return {
17716
+ width: length(style.width),
17717
+ height: length(style.height),
17718
+ flow: style.flow === void 0 ? void 0 : flows[style.flow],
17719
+ horizontalAlign: align(style.horizontalAlign),
17720
+ verticalAlign: align(style.verticalAlign),
17721
+ margin: edges(style.margin),
17722
+ padding: edges(style.padding),
17723
+ background: color(style.background),
17724
+ color: color(style.color),
17725
+ fontSize: style.fontSize,
17726
+ bold: style.bold,
17727
+ textAlign: align(style.textAlign),
17728
+ borderRadius: style.borderRadius,
17729
+ opacity: style.opacity,
17730
+ face: style.face === void 0 ? void 0 : faces[style.face],
17731
+ uppercase: style.uppercase,
17732
+ letterSpacing: style.letterSpacing,
17733
+ shadow: style.shadow,
17734
+ borderWidth: style.borderWidth,
17735
+ borderColor: color(style.borderColor),
17736
+ x: length(style.x),
17737
+ y: length(style.y),
17738
+ minWidth: length(style.minWidth),
17739
+ maxWidth: length(style.maxWidth),
17740
+ minHeight: length(style.minHeight),
17741
+ maxHeight: length(style.maxHeight),
17742
+ zIndex: style.zIndex,
17743
+ overflowX: overflow(style.overflowX ?? style.overflow),
17744
+ overflowY: overflow(style.overflowY ?? style.overflow),
17745
+ gradient: gradient(style.gradient),
17746
+ boxShadow: shadow(style.boxShadow),
17747
+ textShadow: shadow(style.textShadow),
17748
+ tint: color(style.tint),
17749
+ saturation: style.saturation,
17750
+ brightness: style.brightness,
17751
+ contrast: style.contrast,
17752
+ blur: style.blur,
17753
+ italic: style.italic,
17754
+ weight: style.weight === void 0 ? void 0 : weights[style.weight],
17755
+ lineHeight: style.lineHeight,
17756
+ noWrap: style.noWrap,
17757
+ textOverflow: style.textOverflow === void 0 ? void 0 : textOverflows[style.textOverflow],
17758
+ decoration: style.decoration === void 0 ? void 0 : decorations[style.decoration],
17759
+ transform: transform(style),
17760
+ transition: transition(style.transition)
17761
+ };
17762
+ }
17763
+ function gradient(value) {
17764
+ if (!value) {
17765
+ return void 0;
17707
17766
  }
17708
- /**
17709
- * update reads the thrower's hook at game time now, keeps it fully upgraded
17710
- * and sets the length of any cooldown a throw started. It reports nothing
17711
- * for a hero without the hook. A caller that already read this frame's
17712
- * abilities passes them to avoid another read.
17713
- */
17714
- update(player, now4, abilities = player.abilities()) {
17715
- const ability = abilities.find((a) => a.name === hookAbility);
17716
- if (!ability) {
17717
- return void 0;
17718
- }
17719
- const victim = this.victim(ability.entity);
17720
- if ((ability.upgrades & hookUpgrades) !== hookUpgrades) {
17721
- player.setAbility({ ability: hookAbility, upgrades: hookUpgrades });
17722
- }
17723
- if (ability.cooldownEnd <= now4) {
17724
- return { victim, thrown: false };
17725
- }
17726
- const thrown = ability.cooldownStart > this.thrownAt;
17727
- if (thrown) {
17728
- this.thrownAt = ability.cooldownStart;
17729
- }
17730
- this.setCooldown(player, ability);
17731
- return { victim, thrown };
17767
+ const last = Math.max(1, value.colors.length - 1);
17768
+ return {
17769
+ shape: value.shape === void 0 ? void 0 : shapes[value.shape],
17770
+ stops: value.colors.map((each, index) => ({
17771
+ at: value.at?.[index] ?? index / last,
17772
+ color: color(each)
17773
+ }))
17774
+ };
17775
+ }
17776
+ function shadow(value) {
17777
+ if (!value) {
17778
+ return void 0;
17732
17779
  }
17733
- /** victim is the hero the hook entity holds, or undefined while it holds none. */
17734
- victim(hookEntity) {
17735
- const victim = this.read(
17736
- hookEntity,
17737
- "CCitadel_Ability_Hook",
17738
- "m_hHookVictim",
17739
- "handle"
17740
- );
17741
- return typeof victim === "number" ? victim : void 0;
17780
+ return {
17781
+ x: value.x,
17782
+ y: value.y,
17783
+ blur: value.blur,
17784
+ spread: value.spread,
17785
+ color: color(value.color),
17786
+ inset: value.inset
17787
+ };
17788
+ }
17789
+ function transform(style) {
17790
+ const { translate, scale: scale2, rotate, origin } = style;
17791
+ if (!translate && scale2 === void 0 && rotate === void 0 && !origin) {
17792
+ return void 0;
17793
+ }
17794
+ const scales = typeof scale2 === "number" ? [scale2, scale2] : scale2;
17795
+ return {
17796
+ translateX: translate?.[0],
17797
+ translateY: translate?.[1],
17798
+ scaleX: scales?.[0],
17799
+ scaleY: scales?.[1],
17800
+ rotate,
17801
+ originX: origin?.[0],
17802
+ originY: origin?.[1]
17803
+ };
17804
+ }
17805
+ function transition(value) {
17806
+ if (value === void 0) {
17807
+ return void 0;
17808
+ }
17809
+ if (typeof value === "number") {
17810
+ return { seconds: value };
17811
+ }
17812
+ return {
17813
+ seconds: value.seconds,
17814
+ delay: value.delay,
17815
+ easing: value.easing === void 0 ? void 0 : easings[value.easing]
17816
+ };
17817
+ }
17818
+ function length(value) {
17819
+ if (value === void 0) {
17820
+ return void 0;
17821
+ }
17822
+ if (typeof value === "number") {
17823
+ return { value: { case: "pixels", value } };
17824
+ }
17825
+ if (value === "fit") {
17826
+ return { value: { case: "fitChildren", value: true } };
17827
+ }
17828
+ if (value === "fill") {
17829
+ return { value: { case: "fill", value: 1 } };
17830
+ }
17831
+ return { value: { case: "percent", value: Number.parseFloat(value) } };
17832
+ }
17833
+ function edges(value) {
17834
+ if (value === void 0) {
17835
+ return void 0;
17836
+ }
17837
+ if (typeof value === "number") {
17838
+ return { top: value, right: value, bottom: value, left: value };
17839
+ }
17840
+ if (value.length === 2) {
17841
+ return { top: value[0], right: value[1], bottom: value[0], left: value[1] };
17742
17842
  }
17743
- /** setCooldown ends the cooldown cooldownSeconds after the hook's throw. */
17744
- setCooldown(player, ability) {
17745
- if (this.cooldownSeconds <= 0) {
17746
- player.refreshAbility(hookAbility);
17747
- return;
17748
- }
17749
- const cooldownEnd = ability.cooldownStart + this.cooldownSeconds;
17750
- if (cooldownEnd !== ability.cooldownEnd) {
17751
- player.setAbility({ ability: hookAbility, cooldownEnd });
17752
- }
17843
+ return { top: value[0], right: value[1], bottom: value[2], left: value[3] };
17844
+ }
17845
+ function color(value) {
17846
+ const hex = value?.replace(/^#/, "");
17847
+ if (!hex || !/^[0-9a-f]{6}([0-9a-f]{2})?$/i.test(hex)) {
17848
+ return void 0;
17753
17849
  }
17754
- };
17850
+ return Number.parseInt(hex.length === 6 ? `${hex}ff` : hex, 16) >>> 0;
17851
+ }
17755
17852
 
17756
- // js/src/theme.ts
17757
- var theme_exports = {};
17758
- __export(theme_exports, {
17759
- emptyPip: () => emptyPip,
17760
- fpsReadoutBottom: () => fpsReadoutBottom,
17761
- motion: () => motion,
17762
- objectiveBarBottom: () => objectiveBarBottom,
17763
- pillEdge: () => pillEdge,
17764
- pipRings: () => pipRings,
17765
- pipShapes: () => pipShapes,
17766
- plate: () => plate,
17767
- shades: () => shades,
17768
- sizes: () => sizes,
17769
- sounds: () => sounds,
17770
- teamBarBottom: () => teamBarBottom,
17771
- teamTones: () => teamTones,
17772
- tones: () => tones,
17773
- types: () => types
17853
+ // js/src/vector.ts
17854
+ var vector_exports = {};
17855
+ __export(vector_exports, {
17856
+ add: () => add,
17857
+ aimAt: () => aimAt,
17858
+ at: () => at,
17859
+ distance: () => distance,
17860
+ dot: () => dot,
17861
+ flatDistance: () => flatDistance,
17862
+ forward: () => forward,
17863
+ length: () => length2,
17864
+ lerp: () => lerp2,
17865
+ level: () => level,
17866
+ normalize: () => normalize,
17867
+ scale: () => scale,
17868
+ sub: () => sub,
17869
+ toward: () => toward,
17870
+ yawToward: () => yawToward
17774
17871
  });
17775
- var tones = {
17776
- text: "#ffefd7",
17777
- muted: "#bfb3a1",
17778
- // The accent marks the player's own choices.
17779
- accent: "#fd736d",
17780
- // Text on an accent fill.
17781
- onAccent: "#070709",
17782
- amber: "#d4860b",
17783
- sapphire: "#4d75c3",
17784
- // The gas of a closing arena.
17785
- gas: "#3ee08f",
17786
- // Done, under par, ready and live: a step darker than gas, so status text
17787
- // and tags sit calmer on the plates.
17788
- success: "#36c47f",
17789
- danger: "#ff410d",
17790
- gold: "#ebc934"
17791
- };
17792
- var teamTones = {
17793
- 2: "amber",
17794
- 3: "sapphire"
17795
- };
17796
- var shades = {
17797
- /** offWhite at about half strength: idle navigation and secondary text. */
17798
- quiet: "#ffefd78c",
17799
- /** offWhite at the popup button's 44%: idle pill borders. */
17800
- faint: "#ffefd770",
17801
- /** offWhite at about 40%: counts, placeholders and offline players. */
17802
- dim: "#6b675d",
17803
- /** offWhite at 13%: hairlines between sections and plate edges. */
17804
- hairline: "#2b2a24",
17805
- /** offBlack: text on light fills, and the backdrop's hue. */
17806
- ink: "#10130d",
17807
- /** The menu backdrop: an opaque offBlack that hides the stock menu. */
17808
- backdrop: "#0b0d09",
17809
- /** The backdrop at 95%, under a panel the player reads over the game. */
17810
- veil: "#0b0d09f2",
17811
- /** offWhite at 4%: a plate on the backdrop. */
17812
- plate: "#151611",
17813
- /** offWhite at 8%: a row or stat inside a plate. */
17814
- raised: "#1e1f19",
17815
- /** offWhite at 13%: a hovered or joined row. */
17816
- lit: "#2b2a24",
17817
- /** The full-strength fill of a lit primary button. */
17818
- white: "#ffffff",
17819
- /** No fill or border, where a state turns one off. */
17820
- clear: "#00000000"
17821
- };
17822
- var sizes = {
17823
- /** control is the height of panel buttons and fields. */
17824
- control: 32,
17825
- /** rowControl is the height of a button inside a list row. */
17826
- rowControl: 28,
17827
- /** row is the height of one list row. */
17828
- row: 32,
17829
- /** radius rounds buttons, fields and tags. */
17830
- radius: 4,
17831
- /** panelRadius rounds panels. */
17832
- panelRadius: 8
17833
- };
17834
- var types = {
17835
- display: { face: "block", size: 46, uppercase: true },
17836
- title: { face: "block", size: 26, uppercase: true },
17837
- body: { face: "body", size: 17, uppercase: false },
17838
- label: { face: "block", size: 15, uppercase: true },
17839
- caption: { face: "body", size: 14, uppercase: false }
17840
- };
17841
- var plate = {
17842
- color: "#000000e0",
17843
- radius: 5,
17844
- /** padding is [vertical, horizontal] in pixels. */
17845
- padding: [10, 18]
17872
+ function at(x, y, z) {
17873
+ return { x, y, z };
17874
+ }
17875
+ function add(a, b) {
17876
+ return { x: a.x + b.x, y: a.y + b.y, z: a.z + b.z };
17877
+ }
17878
+ function sub(a, b) {
17879
+ return { x: a.x - b.x, y: a.y - b.y, z: a.z - b.z };
17880
+ }
17881
+ function scale(a, s) {
17882
+ return { x: a.x * s, y: a.y * s, z: a.z * s };
17883
+ }
17884
+ function dot(a, b) {
17885
+ return a.x * b.x + a.y * b.y + a.z * b.z;
17886
+ }
17887
+ function length2(a) {
17888
+ return Math.hypot(a.x, a.y, a.z);
17889
+ }
17890
+ function normalize(a) {
17891
+ const size = length2(a);
17892
+ return size > 0 ? scale(a, 1 / size) : { x: 1, y: 0, z: 0 };
17893
+ }
17894
+ function lerp2(a, b, t) {
17895
+ return {
17896
+ x: a.x + (b.x - a.x) * t,
17897
+ y: a.y + (b.y - a.y) * t,
17898
+ z: a.z + (b.z - a.z) * t
17899
+ };
17900
+ }
17901
+ function distance(a, b) {
17902
+ return Math.hypot(a.x - b.x, a.y - b.y, a.z - b.z);
17903
+ }
17904
+ function flatDistance(a, b) {
17905
+ return Math.hypot(a.x - b.x, a.y - b.y);
17906
+ }
17907
+ function toward(from, to) {
17908
+ const span = distance(from, to);
17909
+ return span > 0 ? scale(sub(to, from), 1 / span) : { x: 0, y: 0, z: 0 };
17910
+ }
17911
+ function yawToward(from, to) {
17912
+ return Math.atan2(to.y - from.y, to.x - from.x) * 180 / Math.PI;
17913
+ }
17914
+ function level(yaw) {
17915
+ return { pitch: 0, yaw, roll: 0 };
17916
+ }
17917
+ function aimAt(from, to) {
17918
+ const across = flatDistance(from, to);
17919
+ return {
17920
+ pitch: -Math.atan2(to.z - from.z, across) * 180 / Math.PI,
17921
+ yaw: yawToward(from, to),
17922
+ roll: 0
17923
+ };
17924
+ }
17925
+ function forward(angles2) {
17926
+ const pitch = angles2.pitch * Math.PI / 180;
17927
+ const yaw = angles2.yaw * Math.PI / 180;
17928
+ return {
17929
+ x: Math.cos(pitch) * Math.cos(yaw),
17930
+ y: Math.cos(pitch) * Math.sin(yaw),
17931
+ z: -Math.sin(pitch)
17932
+ };
17933
+ }
17934
+
17935
+ // js/src/bits.ts
17936
+ var Buttons = {
17937
+ /** attack is the primary fire button. */
17938
+ attack: 1n,
17939
+ /**
17940
+ * jump is the jump key, Space by default (IN_MANTLE). Blocking it stops the
17941
+ * native jump and mantle; the jumping client still predicts the jump and is
17942
+ * corrected.
17943
+ */
17944
+ jump: 1n << 48n,
17945
+ /** crouch is the crouch key, Ctrl by default. */
17946
+ crouch: 1n << 2n,
17947
+ /** dash is the dash key, Shift by default. */
17948
+ dash: 1n << 16n,
17949
+ /** use is the interact key. */
17950
+ use: 1n << 5n,
17951
+ /** altFire is the zoom and alternate fire button, right mouse by default. */
17952
+ altFire: 1n << 11n,
17953
+ /** reload is the reload key. */
17954
+ reload: 1n << 13n,
17955
+ /** melee is the light melee key, Q by default. */
17956
+ melee: 1n << 32n,
17957
+ /** ability1 to ability3 are the hero's first three ability keys. */
17958
+ ability1: 1n << 33n,
17959
+ ability2: 1n << 34n,
17960
+ ability3: 1n << 35n,
17961
+ /** ultimate is the hero's ultimate ability key, the fourth. */
17962
+ ultimate: 1n << 36n,
17963
+ /** parry is the melee parry button. */
17964
+ parry: 1n << 42n
17846
17965
  };
17847
- var pillEdge = "#ffefd71a";
17848
- var pipShapes = {
17849
- round: { width: 18, height: 18, radius: 9 },
17850
- tick: { width: 7, height: 18, radius: 2 }
17966
+ var Layers = {
17967
+ /** solid is the world and solid objects. */
17968
+ solid: 1n << 0n,
17969
+ /** hitbox is the hit boxes of heroes and units. */
17970
+ hitbox: 1n << 1n,
17971
+ /** trigger is invisible volumes that react to touch. */
17972
+ trigger: 1n << 2n,
17973
+ /** playerClip is walls that only stop heroes. */
17974
+ playerClip: 1n << 4n,
17975
+ /** player is player-controlled heroes. */
17976
+ player: 1n << 18n,
17977
+ /** npc is units that are not players. */
17978
+ npc: 1n << 19n,
17979
+ /** staticLevel is the map's built geometry, foliage included. */
17980
+ staticLevel: 1n << 30n,
17981
+ /** hero, trooper and building are those units' bodies. */
17982
+ hero: 1n << 37n,
17983
+ trooper: 1n << 38n,
17984
+ building: 1n << 40n
17851
17985
  };
17852
- var pipRings = { empty: "#ffefd72e", filled: "#10130de6" };
17853
- var emptyPip = "#00000000";
17854
- var teamBarBottom = 84;
17855
- var objectiveBarBottom = 220;
17856
- var fpsReadoutBottom = 68;
17857
- var sounds = {
17858
- hover: "UI.MainMenu.Hover",
17859
- press: "UI.MainMenu.Activate"
17986
+
17987
+ // js/src/curve.ts
17988
+ var curve_exports = {};
17989
+ __export(curve_exports, {
17990
+ chain: () => chain,
17991
+ durationOf: () => durationOf,
17992
+ ease: () => ease,
17993
+ hold: () => hold,
17994
+ keyframes: () => keyframes,
17995
+ line: () => line,
17996
+ orbit: () => orbit,
17997
+ pingPong: () => pingPong,
17998
+ repeat: () => repeat,
17999
+ reverse: () => reverse,
18000
+ shaped: () => shaped,
18001
+ through: () => through,
18002
+ valueAt: () => valueAt,
18003
+ wave: () => wave
18004
+ });
18005
+ var ease = {
18006
+ /** linear moves at an even pace. */
18007
+ linear: shaped((t) => t, {}),
18008
+ /** bias is the game's bias curve; see LerpShape. */
18009
+ bias: (b) => shaped((t) => bias(t, b), { bias: b }),
18010
+ /** gain is the game's gain curve; see LerpShape. */
18011
+ gain: (g) => shaped((t) => gain(t, g), { gain: g }),
18012
+ /** in starts slow and speeds up. */
18013
+ in: shaped((t) => t * t * t),
18014
+ /** out starts fast and slows to a stop. */
18015
+ out: shaped((t) => 1 - (1 - t) ** 3),
18016
+ /** inOut starts and ends slow. */
18017
+ inOut: shaped((t) => t < 0.5 ? 4 * t * t * t : 1 - (2 - 2 * t) ** 3 / 2),
18018
+ /** sine starts and ends slow, more gently than inOut. */
18019
+ sine: shaped((t) => (1 - Math.cos(Math.PI * t)) / 2),
18020
+ /** back passes its end a little and settles back onto it. */
18021
+ back: shaped((t) => 1 + 2.70158 * (t - 1) ** 3 + 1.70158 * (t - 1) ** 2),
18022
+ /** elastic overshoots its end and rings down onto it. */
18023
+ elastic: shaped(
18024
+ (t) => t <= 0 || t >= 1 ? t : 2 ** (-10 * t) * Math.sin((t * 10 - 0.75) * 2 * Math.PI / 3) + 1
18025
+ ),
18026
+ /** bounce drops onto its end and bounces to rest. */
18027
+ bounce: shaped((t) => {
18028
+ const k = 7.5625;
18029
+ if (t < 1 / 2.75) return k * t * t;
18030
+ if (t < 2 / 2.75) return k * (t - 1.5 / 2.75) ** 2 + 0.75;
18031
+ if (t < 2.5 / 2.75) return k * (t - 2.25 / 2.75) ** 2 + 0.9375;
18032
+ return k * (t - 2.625 / 2.75) ** 2 + 0.984375;
18033
+ })
17860
18034
  };
17861
- var motion = { hover: 0.15, meter: 0.25 };
17862
-
17863
- // js/src/hud.ts
17864
- function element(type, style, children, key) {
17865
- return { type, props: { style, children }, key };
18035
+ function shaped(at3, lerp3) {
18036
+ return { at: at3, lerp: lerp3 };
17866
18037
  }
17867
- function arriving(component, from) {
17868
- return {
17869
- ...component,
17870
- props: {
17871
- ...component.props,
17872
- style: {
17873
- transition: { seconds: 0.25, easing: "out" },
17874
- ...component.props.style
17875
- },
17876
- enter: { opacity: 0, ...from },
17877
- exit: { opacity: 0 }
18038
+ function line(from, to, duration, shape = ease.linear) {
18039
+ return [{ duration, lerp: shape.lerp, at: (u) => mix(from, to, shape.at(u)) }];
18040
+ }
18041
+ function hold(value, duration) {
18042
+ return [{ duration, lerp: {}, at: () => value }];
18043
+ }
18044
+ function keyframes(keys, options = {}) {
18045
+ const spans = [];
18046
+ const [first] = keys;
18047
+ if (first && first.at > 0) spans.push(...hold(first.value, first.at));
18048
+ keys.forEach((to, i) => {
18049
+ const from = keys[i - 1];
18050
+ if (!from || to.at <= from.at) return;
18051
+ const duration = to.at - from.at;
18052
+ const shape = to.ease ?? ease.linear;
18053
+ if (!options.smooth) {
18054
+ spans.push(...line(from.value, to.value, duration, shape));
18055
+ return;
17878
18056
  }
17879
- };
18057
+ const before2 = keys[i - 2]?.value ?? from.value;
18058
+ const after2 = keys[i + 1]?.value ?? to.value;
18059
+ spans.push({
18060
+ duration,
18061
+ at: (u) => spline(before2, from.value, to.value, after2, shape.at(u))
18062
+ });
18063
+ });
18064
+ return spans;
17880
18065
  }
17881
- function Text(props) {
17882
- const type = types[props.role];
17883
- return element(
17884
- "label",
17885
- {
17886
- face: type.face,
17887
- fontSize: type.size,
17888
- uppercase: type.uppercase,
17889
- shadow: !props.plated,
17890
- color: tones[props.tone ?? (props.role === "label" ? "muted" : "text")],
17891
- horizontalAlign: "center",
17892
- textAlign: "center",
17893
- ...props.style
17894
- },
17895
- props.children
17896
- );
18066
+ function through(points, options) {
18067
+ let at3 = 0;
18068
+ let last = points[0];
18069
+ const keys = points.map((value) => {
18070
+ if (last !== void 0) at3 += distance2(last, value) / options.speed;
18071
+ last = value;
18072
+ return { at: at3, value, ease: options.ease };
18073
+ });
18074
+ return keyframes(keys, options);
17897
18075
  }
17898
- function Plate(props) {
17899
- return element(
17900
- "panel",
18076
+ function orbit(options) {
18077
+ const { center, radius, duration } = options;
18078
+ const turns = options.turns ?? 1;
18079
+ const start2 = (options.start ?? 0) * Math.PI / 180;
18080
+ const rise = options.rise ?? 0;
18081
+ const shape = options.ease ?? ease.linear;
18082
+ return [
17901
18083
  {
17902
- flow: props.flow ?? "down",
17903
- horizontalAlign: "center",
17904
- background: plate.color,
17905
- borderRadius: plate.radius,
17906
- padding: plate.padding,
17907
- ...props.style
17908
- },
17909
- props.children
17910
- );
18084
+ duration,
18085
+ at: (u) => {
18086
+ const t = shape.at(u);
18087
+ const angle = start2 + t * turns * 2 * Math.PI;
18088
+ return {
18089
+ x: center.x + radius * Math.cos(angle),
18090
+ y: center.y + radius * Math.sin(angle),
18091
+ z: center.z + rise * t
18092
+ };
18093
+ }
18094
+ }
18095
+ ];
17911
18096
  }
17912
- function Pill(props) {
17913
- return element(
17914
- "panel",
18097
+ function wave(options) {
18098
+ const { amplitude, frequency, duration, decay } = options;
18099
+ return [
17915
18100
  {
17916
- flow: props.flow ?? "right",
17917
- horizontalAlign: "center",
17918
- background: plate.color,
17919
- borderRadius: 50,
17920
- borderWidth: 2,
17921
- borderColor: pillEdge,
17922
- padding: [3, 6],
17923
- ...props.style
17924
- },
17925
- props.children
17926
- );
18101
+ duration,
18102
+ at: (u) => amplitude * (decay ? 1 - u : 1) * Math.sin(2 * Math.PI * frequency * duration * u)
18103
+ }
18104
+ ];
17927
18105
  }
17928
- function Pips(props) {
17929
- const shape = pipShapes[props.shape ?? "round"];
17930
- const lit = (index) => props.mirror ? index >= props.total - props.filled : index < props.filled;
17931
- return element(
17932
- "panel",
17933
- { flow: "right", verticalAlign: "center", ...props.style },
17934
- Array.from(
17935
- { length: props.total },
17936
- (_, index) => element(
17937
- "panel",
17938
- {
17939
- width: shape.width,
17940
- height: shape.height,
17941
- borderRadius: shape.radius,
17942
- margin: [0, 2],
17943
- background: lit(index) ? tones[props.tone] : emptyPip,
17944
- borderWidth: 2,
17945
- borderColor: lit(index) ? pipRings.filled : pipRings.empty
17946
- },
17947
- void 0,
17948
- `pip-${index}`
17949
- )
17950
- )
17951
- );
18106
+ function chain(...curves) {
18107
+ return curves.flat();
17952
18108
  }
17953
- function Tag(props) {
17954
- const filled = props.fill === "filled";
17955
- return element(
17956
- "label",
17957
- {
17958
- face: "block",
17959
- fontSize: 12,
17960
- letterSpacing: 1,
17961
- uppercase: true,
17962
- color: filled ? tones.onAccent : tones[props.tone],
17963
- background: filled ? tones[props.tone] : void 0,
17964
- borderWidth: 1,
17965
- borderColor: tones[props.tone],
17966
- borderRadius: sizes.radius,
17967
- padding: [4, 8],
17968
- verticalAlign: "center",
17969
- ...props.style
17970
- },
17971
- props.children
17972
- );
18109
+ function reverse(curve) {
18110
+ return curve.map((span) => ({
18111
+ duration: span.duration,
18112
+ lerp: span.lerp?.bias === void 0 ? span.lerp : void 0,
18113
+ at: (u) => span.at(1 - u)
18114
+ })).reverse();
18115
+ }
18116
+ function repeat(curve, times) {
18117
+ return Array.from({ length: Math.max(0, times) }, () => curve).flat();
18118
+ }
18119
+ function pingPong(curve) {
18120
+ return chain(curve, reverse(curve));
18121
+ }
18122
+ function durationOf(curve) {
18123
+ return curve.reduce((sum, span) => sum + Math.max(0, span.duration), 0);
18124
+ }
18125
+ function valueAt(curve, seconds) {
18126
+ let left3 = seconds;
18127
+ for (const span of curve) {
18128
+ if (span.duration <= 0) continue;
18129
+ if (left3 <= span.duration) return span.at(Math.max(0, left3) / span.duration);
18130
+ left3 -= span.duration;
18131
+ }
18132
+ return curve.at(-1)?.at(1);
18133
+ }
18134
+ function bias(t, b) {
18135
+ return t ** (Math.log(b) / Math.log(0.5));
18136
+ }
18137
+ function gain(t, g) {
18138
+ return t < 0.5 ? bias(2 * t, 1 - g) / 2 : 1 - bias(2 - 2 * t, 1 - g) / 2;
18139
+ }
18140
+ function mix(a, b, t) {
18141
+ if (typeof a === "number" && typeof b === "number") return a + (b - a) * t;
18142
+ const [p, q] = [vector2(a), vector2(b)];
18143
+ return {
18144
+ x: p.x + (q.x - p.x) * t,
18145
+ y: p.y + (q.y - p.y) * t,
18146
+ z: p.z + (q.z - p.z) * t
18147
+ };
18148
+ }
18149
+ function spline(p0, p1, p2, p3, t) {
18150
+ const f = (a2, b2, c2, d2) => 0.5 * (2 * b2 + (c2 - a2) * t + (2 * a2 - 5 * b2 + 4 * c2 - d2) * t * t + (3 * b2 - a2 - 3 * c2 + d2) * t * t * t);
18151
+ if (typeof p0 === "number" && typeof p1 === "number" && typeof p2 === "number" && typeof p3 === "number") {
18152
+ return f(p0, p1, p2, p3);
18153
+ }
18154
+ const [a, b, c, d] = [vector2(p0), vector2(p1), vector2(p2), vector2(p3)];
18155
+ return {
18156
+ x: f(a.x, b.x, c.x, d.x),
18157
+ y: f(a.y, b.y, c.y, d.y),
18158
+ z: f(a.z, b.z, c.z, d.z)
18159
+ };
17973
18160
  }
17974
- function Banner(props) {
17975
- const banner = element(
17976
- "panel",
17977
- {
17978
- flow: "down",
17979
- horizontalAlign: "center",
17980
- margin: [20, 0, 0, 0],
17981
- ...props.style
17982
- },
17983
- [
17984
- Text({ role: "title", tone: props.tone, children: props.title }),
17985
- props.detail && Text({ role: "caption", tone: "muted", children: props.detail })
17986
- ]
17987
- );
17988
- return arriving(banner, { scale: 0.92 });
18161
+ function distance2(a, b) {
18162
+ if (typeof a === "number" && typeof b === "number") return Math.abs(b - a);
18163
+ const [p, q] = [vector2(a), vector2(b)];
18164
+ return Math.hypot(q.x - p.x, q.y - p.y, q.z - p.z);
17989
18165
  }
17990
- function TopStrip(props) {
17991
- const block2 = [
17992
- props.heading && Text({
17993
- role: "label",
17994
- style: { letterSpacing: 1 },
17995
- children: props.heading
17996
- }),
17997
- Pill({ style: { margin: [4, 0, 0, 0] }, children: props.children })
17998
- ];
17999
- const line2 = props.line && Text({
18000
- role: "label",
18001
- tone: props.lineTone ?? "text",
18002
- style: { margin: [4, 0, 0, 0], fontSize: 18, letterSpacing: 1 },
18003
- children: props.line
18004
- });
18005
- const column = (top, children) => element(
18006
- "panel",
18007
- { flow: "down", horizontalAlign: "center", margin: [top, 0, 0, 0] },
18008
- children
18009
- );
18010
- if (!props.keepTeamBar) return column(14, [...block2, line2]);
18011
- return element("panel", { width: "fill", height: "fill" }, [
18012
- column(teamBarBottom, block2),
18013
- line2 && column(objectiveBarBottom, line2)
18014
- ]);
18166
+ function vector2(value) {
18167
+ return typeof value === "number" ? { x: value, y: 0, z: 0 } : value;
18015
18168
  }
18016
- function Score2(props) {
18017
- const [near, far] = props.tones ?? ["accent", "text"];
18018
- const side = (points, tone) => Text({
18019
- role: "title",
18020
- tone,
18021
- plated: true,
18022
- style: { margin: [0, 10], horizontalAlign: void 0 },
18023
- children: `${points}`
18169
+
18170
+ // js/src/camera.ts
18171
+ function setOrbitCamera(player, enabled) {
18172
+ const pawn = player.pawn();
18173
+ if (!pawn?.entity) return false;
18174
+ const flag = writeField(
18175
+ pawn.entity,
18176
+ "CCitadelPlayerPawn",
18177
+ "m_bInHideoutZone",
18178
+ "bool",
18179
+ enabled
18180
+ );
18181
+ const zoom = holdModifierState(
18182
+ pawn.entity,
18183
+ "MODIFIER_STATE_HIDEOUT_ZONE",
18184
+ enabled
18185
+ );
18186
+ if (enabled) return flag && zoom;
18187
+ const orbit2 = fireInput(pawn.entity, "RemoveModifier", {
18188
+ text: "modifier_citadel_orbit_camera"
18024
18189
  });
18025
- return element("panel", { flow: "right", verticalAlign: "center" }, [
18026
- side(props.points[0], near),
18027
- Text({
18028
- role: "title",
18029
- tone: "muted",
18030
- plated: true,
18031
- style: { horizontalAlign: void 0 },
18032
- children: ":"
18033
- }),
18034
- side(props.points[1], far)
18035
- ]);
18190
+ return flag && zoom && orbit2;
18036
18191
  }
18037
- var rosterRows = 6;
18038
- var rosterName = 24;
18039
- var portraitSize = 44;
18040
- var badgeSize = 18;
18041
- var portraits = new Map(heroes.map((hero) => [hero.id, hero.portrait]));
18042
- function rosterKey(rows) {
18043
- return rows.slice(0, rosterRows).map(
18044
- (row2) => `${row2.self ? "*" : ""}${row2.selected ? "+" : ""}${row2.onPress ? ">" : ""}${row2.name} ${row2.hero} ${row2.activity} ${row2.steamId ?? ""}`
18045
- ).join("\n");
18192
+ var moves = 0;
18193
+ function playCamera(player, options) {
18194
+ const tracks = [];
18195
+ for (const [param, curve] of Object.entries(options.tracks)) {
18196
+ if (curve) tracks.push({ param, curve });
18197
+ }
18198
+ return playTracks(player, options, tracks);
18046
18199
  }
18047
- function Roster(props) {
18048
- if (props.rows.length === 0) return null;
18049
- return element(
18050
- "panel",
18051
- {
18052
- width: "fit",
18053
- height: "fit",
18054
- flow: "down",
18055
- horizontalAlign: "right",
18056
- verticalAlign: "top",
18057
- margin: [props.top ?? fpsReadoutBottom, 24, 0, 0]
18058
- },
18059
- props.rows.slice(0, rosterRows).map(rosterRow)
18200
+ function playTracks(player, options, tracks) {
18201
+ const context = options.context ?? `modlock.camera.${++moves}`;
18202
+ const length3 = Math.max(0, ...tracks.map((track) => durationOf(track.curve)));
18203
+ const send2 = (delay) => tracks.every(
18204
+ ({ param, curve }) => sendCurve(player, { ...options, context, param, delay }, curve)
18060
18205
  );
18206
+ let timer;
18207
+ const stop = () => {
18208
+ timer?.cancel();
18209
+ return player.clearCamera(context);
18210
+ };
18211
+ let sent = send2(options.delay);
18212
+ if (sent && options.loop && length3 > 0) {
18213
+ sent = send2(void 0);
18214
+ timer = every(length3, () => {
18215
+ if (!send2(void 0)) stop();
18216
+ });
18217
+ }
18218
+ if (!sent) {
18219
+ stop();
18220
+ return void 0;
18221
+ }
18222
+ return {
18223
+ context,
18224
+ duration: options.loop ? Infinity : (options.delay ?? 0) + length3,
18225
+ cancel: stop
18226
+ };
18061
18227
  }
18062
- function rosterRow(row2, index) {
18063
- const right = { horizontalAlign: "right", textAlign: "right" };
18064
- const text2 = element(
18065
- "panel",
18066
- { flow: "down", verticalAlign: "center", margin: [0, 12, 0, 0] },
18067
- [
18068
- Text({
18069
- role: "label",
18070
- tone: "text",
18071
- style: right,
18072
- children: clip(row2.name.toUpperCase(), rosterName)
18073
- }),
18074
- Text({
18075
- role: "caption",
18076
- tone: "muted",
18077
- style: { ...right, margin: [1, 0, 0, 0] },
18078
- children: row2.activity
18079
- })
18080
- ]
18081
- );
18082
- const src = portraits.get(row2.hero);
18083
- const badge = row2.steamId === void 0 ? false : avatarBadge(row2.steamId);
18084
- const image = src === void 0 ? false : portraitImage(src);
18085
- const portrait = element(
18086
- "panel",
18087
- {
18088
- width: portraitSize,
18089
- height: portraitSize,
18090
- padding: 1,
18091
- verticalAlign: "center",
18092
- background: row2.self || row2.selected ? tones.accent : shades.dim
18093
- },
18094
- element(
18095
- "panel",
18096
- { width: "100%", height: "100%", background: shades.raised },
18097
- [image, badge]
18098
- )
18228
+ function cameraPulse(player, options) {
18229
+ const { param, by, ease: shape = ease.linear } = options;
18230
+ const rest = zero2(by);
18231
+ const curve = chain(
18232
+ line(rest, by, options.in, shape),
18233
+ hold(by, options.hold),
18234
+ reverse(line(rest, by, options.out, shape))
18099
18235
  );
18100
- const style = {
18101
- flow: "right",
18102
- horizontalAlign: "right",
18103
- margin: [0, 0, 8, 0]
18236
+ return playTracks(player, { ...options, relative: true }, [{ param, curve }]);
18237
+ }
18238
+ function cameraShake(player, options) {
18239
+ const { amplitude, duration } = options;
18240
+ const curve = wave({
18241
+ amplitude,
18242
+ duration,
18243
+ frequency: options.frequency ?? 8,
18244
+ decay: true
18245
+ });
18246
+ const param = options.param ?? "horizontalOffset";
18247
+ return playTracks(player, { ...options, relative: true }, [{ param, curve }]);
18248
+ }
18249
+ function sendCurve(player, options, curve) {
18250
+ const { context, param, relative, priority, target } = options;
18251
+ const rate = options.rate ?? 30;
18252
+ let delay = options.delay;
18253
+ const lerp3 = (start2, end, duration, shape = {}) => {
18254
+ const sent = player.moveCamera({
18255
+ context,
18256
+ param,
18257
+ motion: { lerp: { start: start2, end, duration, ...shape } },
18258
+ delay,
18259
+ relative,
18260
+ priority,
18261
+ target
18262
+ });
18263
+ delay = void 0;
18264
+ return sent;
18104
18265
  };
18105
- const line2 = row2.onPress ? {
18106
- type: "button",
18107
- props: {
18108
- style: {
18109
- ...style,
18110
- borderRadius: sizes.radius,
18111
- transition: motion.hover
18112
- },
18113
- hover: { background: shades.raised },
18114
- hoverSound: sounds.hover,
18115
- sound: sounds.press,
18116
- onPress: row2.onPress,
18117
- children: [text2, portrait]
18118
- },
18119
- key: `row-${index}`
18120
- } : element("panel", style, [text2, portrait], `row-${index}`);
18121
- return arriving(line2, { translate: [16, 0] });
18266
+ return curve.every((span) => {
18267
+ if (span.duration <= 0) return true;
18268
+ if (span.lerp) {
18269
+ return lerp3(span.at(0), span.at(1), span.duration, span.lerp);
18270
+ }
18271
+ const steps = Math.max(1, Math.ceil(span.duration * rate));
18272
+ for (let i = 0; i < steps; i++) {
18273
+ const sent = lerp3(
18274
+ span.at(i / steps),
18275
+ span.at((i + 1) / steps),
18276
+ span.duration / steps
18277
+ );
18278
+ if (!sent) return false;
18279
+ }
18280
+ return true;
18281
+ });
18282
+ }
18283
+ function zero2(value) {
18284
+ return typeof value === "number" ? 0 : { x: 0, y: 0, z: 0 };
18122
18285
  }
18123
- function portraitImage(src) {
18124
- return {
18125
- type: "image",
18126
- props: { src, style: { width: "100%", height: "100%" } }
18127
- };
18286
+
18287
+ // js/src/items.gen.ts
18288
+ var itemTable = [
18289
+ { name: "upgrade_ability_power_shard", id: 630839635, slot: "spirit", tier: 4, active: true, imbue: true, icon: "file://{images}/upgrades/mods_tech/echo_shard.psd" },
18290
+ { name: "upgrade_ability_refresher", id: 677738769, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/refresher_module.psd" },
18291
+ { name: "upgrade_absorbing_armor", id: 3028234315, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_medallion.psd" },
18292
+ { name: "upgrade_acolytes_glove", id: 465043967, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/acolytes_glove.psd" },
18293
+ { name: "upgrade_active_reload", id: 381961617, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/deployable_bullet_shield.psd" },
18294
+ { name: "upgrade_aerial_assault", id: 271801138, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/springy_boots.psd" },
18295
+ { name: "upgrade_aoe_root", id: 1152158042, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/area_immobilize.psd" },
18296
+ { name: "upgrade_aprounds", id: 673001892, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/armor_breaking_bullets.psd" },
18297
+ { name: "upgrade_arcane_extension", id: 2951612397, slot: "spirit", tier: 2, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/duration_extender.psd" },
18298
+ { name: "upgrade_arcane_surge", id: 1150006784, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_surge.psd" },
18299
+ { name: "upgrade_arctic_blast", id: 3812615317, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/ice_blast.psd" },
18300
+ { name: "upgrade_auto_cleanse", id: 951866250, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/items/vitality/indomitable.psd" },
18301
+ { name: "upgrade_banshee_slugs", id: 3884003354, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/banshee_slugs.psd" },
18302
+ { name: "upgrade_berserker", id: 1414319208, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/berserker.psd" },
18303
+ { name: "upgrade_blitz_bullets", id: 4104549924, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus.psd" },
18304
+ { name: "upgrade_boundless_spirit", id: 2519598785, slot: "spirit", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/boundless_spirit.psd" },
18305
+ { name: "upgrade_boxing_glove", id: 1252627263, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/boxing_glove.psd" },
18306
+ { name: "upgrade_bullet_armor_reduction_aura", id: 2481177645, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_armor_reduction_aura.psd" },
18307
+ { name: "upgrade_bullet_resist_shredder", id: 2971868509, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/bullet_resist_shredder.psd" },
18308
+ { name: "upgrade_bulletshredimbue", id: 3294954488, slot: "weapon", tier: 3, active: false, imbue: true, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus.psd" },
18309
+ { name: "upgrade_burst_fire", id: 2739107182, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus_plus.psd" },
18310
+ { name: "upgrade_capacitor", id: 710436191, slot: "weapon", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/electrified_bullets.psd" },
18311
+ { name: "upgrade_cardio_calibrator", id: 2447176615, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/sprint_booster.psd" },
18312
+ { name: "upgrade_celestial_guidance", id: 3729138568, slot: "vitality", tier: 5, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/debuff_reducer.psd" },
18313
+ { name: "upgrade_chain_lightning", id: 811521119, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/electrified_bullets.psd" },
18314
+ { name: "upgrade_cheat_death", id: 3361811174, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/torment_aura.psd" },
18315
+ { name: "upgrade_chonky", id: 3585132399, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/revitalizer.psd" },
18316
+ { name: "upgrade_clip_size", id: 1548066885, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/clip_size.psd" },
18317
+ { name: "upgrade_cloaking_device_active", id: 1798666702, slot: "weapon", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/cloaking_device.psd" },
18318
+ { name: "upgrade_close_quarter_combat", id: 2095565695, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/point_blank.psd" },
18319
+ { name: "upgrade_close_range", id: 1342610602, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/close_range.psd" },
18320
+ { name: "upgrade_cold_front", id: 1976391348, slot: "spirit", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/ice_blast.psd" },
18321
+ { name: "upgrade_colossus", id: 2407781327, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/colossus.psd" },
18322
+ { name: "upgrade_containment", id: 1813726886, slot: "spirit", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/immobilize.psd" },
18323
+ { name: "upgrade_cooldown_reduction", id: 3261353684, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/spiritual_flow.psd" },
18324
+ { name: "upgrade_counterspell", id: 1414025773, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/hud/modifiers/icon_parry.svg" },
18325
+ { name: "upgrade_crackshot", id: 395867183, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/explosive_bullets.psd" },
18326
+ { name: "upgrade_critshot", id: 1396247347, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/crit_damage.psd" },
18327
+ { name: "upgrade_crushing_fists", id: 800008313, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/melee_charge.psd" },
18328
+ { name: "upgrade_damage_recycler", id: 865846625, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/leech.psd" },
18329
+ { name: "upgrade_debuff_reducer", id: 1047818222, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/debuff_reducer.psd" },
18330
+ { name: "upgrade_deflecting_armor", id: 3491236900, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_medallion.psd" },
18331
+ { name: "upgrade_disarm", id: 2645639421, slot: "spirit", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/disarm.psd" },
18332
+ { name: "upgrade_discord", id: 2417568017, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/rupture.psd" },
18333
+ { name: "upgrade_divine_barrier", id: 1662311306, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/savior.psd" },
18334
+ { name: "upgrade_diviners_kevlar", id: 2820116164, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
18335
+ { name: "upgrade_dps_aura", id: 2108215830, slot: "weapon", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/bullet_damage_aura.psd" },
18336
+ { name: "upgrade_eldritch_shot", id: 3568217437, slot: "weapon", tier: 5, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/explosive_bullets.psd" },
18337
+ { name: "upgrade_endurance", id: 2829638276, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/endurance.psd" },
18338
+ { name: "upgrade_escalating_exposure", id: 3005970438, slot: "spirit", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/escalating_exposure.psd" },
18339
+ { name: "upgrade_ethereal_bullets", id: 3919289022, slot: "spirit", tier: 4, active: false, imbue: true, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus.psd" },
18340
+ { name: "upgrade_extra_charge", id: 3776945997, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/extra_charge.psd" },
18341
+ { name: "upgrade_fervor", id: 339443430, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/fervor.psd" },
18342
+ { name: "upgrade_fleetfoot_boots", id: 3403085434, slot: "weapon", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/fleetfoot_boots.psd" },
18343
+ { name: "upgrade_focus_lens", id: 2142980412, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/focused_silence.psd" },
18344
+ { name: "upgrade_fury_trance", id: 1409190604, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/vampiric_burst.psd" },
18345
+ { name: "upgrade_glass_cannon", id: 365620721, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/glass_cannon.psd" },
18346
+ { name: "upgrade_glitch", id: 2617435668, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/glitch.psd" },
18347
+ { name: "upgrade_goose_egg", id: 2462046703, slot: "spirit", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/tech_damage.psd" },
18348
+ { name: "upgrade_greater_withering_whip", id: 2061878743, slot: "spirit", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/disarm.psd" },
18349
+ { name: "upgrade_grit", id: 1672893796, slot: "vitality", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
18350
+ { name: "upgrade_guardian_ward", id: 857669956, slot: "vitality", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/savior.psd" },
18351
+ { name: "upgrade_headhunter", id: 4053935515, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/headhunter.psd" },
18352
+ { name: "upgrade_headshot_booster", id: 2010028405, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/headshot_booster.psd" },
18353
+ { name: "upgrade_headshot_booster2", id: 1770441818, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/headshot_booster.psd" },
18354
+ { name: "upgrade_healbane", id: 2603935618, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/healbane.psd" },
18355
+ { name: "upgrade_healbuff", id: 1427630806, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/aura_icon.psd" },
18356
+ { name: "upgrade_healing_booster", id: 2566692615, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/healing_booster.psd" },
18357
+ { name: "upgrade_health", id: 3633614685, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/health.psd" },
18358
+ { name: "upgrade_health_nova", id: 2956256701, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/health_nova.psd" },
18359
+ { name: "upgrade_health_regen_aura", id: 3321728133, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/health_regen_aura.psd" },
18360
+ { name: "upgrade_health_stealing_magic", id: 876563814, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/health_stealing_tech.psd" },
18361
+ { name: "upgrade_health_stimpak", id: 1710079648, slot: "vitality", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/stimpak.psd" },
18362
+ { name: "upgrade_high_velocity_mag", id: 3077079169, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/high_velocity_mag.psd" },
18363
+ { name: "upgrade_hollow_point_rounds", id: 2678489038, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/hollow_point.psd" },
18364
+ { name: "upgrade_icarus_wings", id: 1736094134, slot: "vitality", tier: 5, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/sprint_booster.psd" },
18365
+ { name: "upgrade_imbued_duration_extender", id: 2717651715, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_persistance.psd" },
18366
+ { name: "upgrade_improved_bullet_armor", id: 3140772621, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/improved_bullet_armor.psd" },
18367
+ { name: "upgrade_improved_spirit", id: 968099481, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/tech_damage.psd" },
18368
+ { name: "upgrade_improved_stamina", id: 4139877411, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/improved_stamina.psd" },
18369
+ { name: "upgrade_infinite_rounds", id: 3269957497, slot: "weapon", tier: 5, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/armor_breaking_bullets.psd" },
18370
+ { name: "upgrade_infuser", id: 1797283378, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/infuser.psd" },
18371
+ { name: "upgrade_inhibitor", id: 2037039379, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/inhibitor.psd" },
18372
+ { name: "upgrade_intensifying_clip", id: 2407033488, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/auto_reloader.psd" },
18373
+ { name: "upgrade_juggernaut", id: 1250307611, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/items/vitality/juggernaut.psd" },
18374
+ { name: "upgrade_kinetic_sash", id: 3977876567, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/kinetic_sash.psd" },
18375
+ { name: "upgrade_lifestrike_gauntlets", id: 1437614329, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/lifestrike_gauntlets.psd" },
18376
+ { name: "upgrade_long_range", id: 3331811235, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/long_range.psd" },
18377
+ { name: "upgrade_magic_burst", id: 1998374645, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/magic_burst.psd" },
18378
+ { name: "upgrade_magic_carpet", id: 2800629741, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/hud/abilities/kelvin/ice_path.psd" },
18379
+ { name: "upgrade_magic_reach", id: 754480263, slot: "spirit", tier: 1, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/tech_range.psd" },
18380
+ { name: "upgrade_magic_shield", id: 3970837787, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/tech_shield_pulse.psd" },
18381
+ { name: "upgrade_magic_shock", id: 2121044373, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/magic_shock.psd" },
18382
+ { name: "upgrade_magic_slow", id: 1102081447, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/slowing_tech.psd" },
18383
+ { name: "upgrade_magic_storm", id: 1292979587, slot: "spirit", tier: 3, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/magic_storm.psd" },
18384
+ { name: "upgrade_magic_tempo", id: 380806748, slot: "spirit", tier: 2, active: false, imbue: true, icon: "file://{images}/upgrades/mods_utility/advanced_recharge.psd" },
18385
+ { name: "upgrade_magic_vulnerability", id: 2081037738, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/tech_vulnerability.psd" },
18386
+ { name: "upgrade_medic_bullets", id: 3862866912, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/medic_bullets.psd" },
18387
+ { name: "upgrade_melee_charge", id: 26002154, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/melee_charge.psd" },
18388
+ { name: "upgrade_melee_rebuttal", id: 4204808176, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/hud/modifiers/icon_parry.svg" },
18389
+ { name: "upgrade_metal_skin", id: 1378931225, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/metal_skin.psd" },
18390
+ { name: "upgrade_mystic_regeneration", id: 1439347412, slot: "spirit", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/endurance.psd" },
18391
+ { name: "upgrade_mystic_reverb", id: 3577481646, slot: "spirit", tier: 4, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/magic_reverb.psd" },
18392
+ { name: "upgrade_mystical_piano", id: 2054088113, slot: "spirit", tier: 5, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/knockdown.psd" },
18393
+ { name: "upgrade_non_player_bonus", id: 1009965641, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/reaper_rounds.psd" },
18394
+ { name: "upgrade_nullification_aura", id: 3949773228, slot: "vitality", tier: 5, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_armor_reduction_aura.psd" },
18395
+ { name: "upgrade_omnicharge_pendant", id: 424779525, slot: "spirit", tier: 5, active: false, imbue: true, icon: "file://{images}/upgrades/mods_tech/rapid_recharge.psd" },
18396
+ { name: "upgrade_personal_rejuvenator", id: 2329546537, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/rebirth.psd" },
18397
+ { name: "upgrade_phantom_strike", id: 1371725689, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/phantom_strike.psd" },
18398
+ { name: "upgrade_prism_blast", id: 1132564516, slot: "spirit", tier: 5, active: true, imbue: false, icon: "file://{images}/items/spirit/ethereal_shift.psd" },
18399
+ { name: "upgrade_pristine_emblem", id: 2064029594, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/pristine_emblem.psd" },
18400
+ { name: "upgrade_proc_silence", id: 1113837674, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/emp_bullets.psd" },
18401
+ { name: "upgrade_quick_silver", id: 84321454, slot: "spirit", tier: 2, active: false, imbue: true, icon: "file://{images}/upgrades/mods_weapon/fire_rate_plus.psd" },
18402
+ { name: "upgrade_rapid_recharge", id: 787198704, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/rapid_recharge.psd" },
18403
+ { name: "upgrade_rapid_rounds", id: 668299740, slot: "weapon", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/rapid_rounds.psd" },
18404
+ { name: "upgrade_rebirth", id: 4003032160, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/rebirth.psd" },
18405
+ { name: "upgrade_rechargingbullets", id: 1763073141, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/arcane_medallion.psd" },
18406
+ { name: "upgrade_reduce_debuff_duration", id: 3731635960, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/debuff_remover.psd" },
18407
+ { name: "upgrade_regenerating_bullet_shield", id: 1235347618, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
18408
+ { name: "upgrade_reinforcing_casings", id: 2463960640, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_armor_plus.psd" },
18409
+ { name: "upgrade_rescue_beam", id: 1804594021, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/medic_beam.psd" },
18410
+ { name: "upgrade_resonant_healing", id: 2947183272, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/boundless_spirit.psd" },
18411
+ { name: "upgrade_restorative_locket", id: 2059712766, slot: "vitality", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/restorative_locket.psd" },
18412
+ { name: "upgrade_return_fire", id: 3361075077, slot: "vitality", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/return_fire.psd" },
18413
+ { name: "upgrade_ricochet", id: 2480592370, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/ricochet.psd" },
18414
+ { name: "upgrade_rocket_booster", id: 600033864, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/hud/abilities/lash/lash_death_slam.psd" },
18415
+ { name: "upgrade_rocket_boots", id: 3830846077, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_utility/springy_boots.psd" },
18416
+ { name: "upgrade_rupture", id: 3144988365, slot: "spirit", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/rupture.psd" },
18417
+ { name: "upgrade_self_bubble", id: 2533252781, slot: "spirit", tier: 4, active: true, imbue: false, icon: "file://{images}/items/spirit/ethereal_shift.psd" },
18418
+ { name: "upgrade_sharpshooter", id: 2152872419, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/longshot.psd" },
18419
+ { name: "upgrade_shrink_ray", id: 4121584236, slot: "spirit", tier: 5, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/stimpak.psd" },
18420
+ { name: "upgrade_siphon_bullets", id: 1282141666, slot: "vitality", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/siphon_bullets.psd" },
18421
+ { name: "upgrade_slowing_bullets", id: 393974127, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/slowing_bullets.psd" },
18422
+ { name: "upgrade_soaring_spirit", id: 7409189, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/soaring_spirit.psd" },
18423
+ { name: "upgrade_spellslinger_headshots", id: 4075861416, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/spellslinger_headshots.psd" },
18424
+ { name: "upgrade_spirit_bubble", id: 112198670, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
18425
+ { name: "upgrade_spirit_burn", id: 343572757, slot: "spirit", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/escalating_exposure.psd" },
18426
+ { name: "upgrade_spirit_sap", id: 1219329868, slot: "spirit", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/focused_silence.psd" },
18427
+ { name: "upgrade_spirit_snatch", id: 3190916303, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/spirit_snatch.psd" },
18428
+ { name: "upgrade_split_shot", id: 3647584222, slot: "weapon", tier: 2, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/titanic_magazine.psd" },
18429
+ { name: "upgrade_sprint_booster", id: 3399065363, slot: "vitality", tier: 1, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/sprint_booster.psd" },
18430
+ { name: "upgrade_superior_stamina", id: 334300056, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/superior_stamina.psd" },
18431
+ { name: "upgrade_suppressor", id: 1925087134, slot: "spirit", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/weapon_jammer.psd" },
18432
+ { name: "upgrade_surging_power", id: 1055679805, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/vampiric_burst.psd" },
18433
+ { name: "upgrade_target_stun", id: 1254091416, slot: "spirit", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/knockdown.psd" },
18434
+ { name: "upgrade_targeted_silence", id: 619484391, slot: "spirit", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/targeted_silence.psd" },
18435
+ { name: "upgrade_tech_damage_pulse", id: 395944548, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/torment_aura.psd" },
18436
+ { name: "upgrade_tech_defense_shredders", id: 1144549437, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/tech_resist_shredder.psd" },
18437
+ { name: "upgrade_tech_overflow", id: 2226497419, slot: "weapon", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/magic_overflow.psd" },
18438
+ { name: "upgrade_tech_purge", id: 2163598980, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/tech_purge.psd" },
18439
+ { name: "upgrade_tech_range", id: 1193964439, slot: "spirit", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_tech/spiritual_dominion.psd" },
18440
+ { name: "upgrade_thermal_detonator", id: 1932939246, slot: "weapon", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/thermal_detonator.psd" },
18441
+ { name: "upgrade_titan_round", id: 2356412290, slot: "weapon", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/titanic_magazine.psd" },
18442
+ { name: "upgrade_toxic_bullets", id: 3696726732, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/serrated_bullets.psd" },
18443
+ { name: "upgrade_trophy_collector", id: 3074274290, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/sprint_booster.psd" },
18444
+ { name: "upgrade_ultimate_burst", id: 493591231, slot: "spirit", tier: 4, active: false, imbue: false, icon: "file://{images}/upgrades/mods_weapon/adrenaline_rush.psd" },
18445
+ { name: "upgrade_unstoppable", id: 3357231760, slot: "vitality", tier: 4, active: true, imbue: false, icon: "file://{images}/upgrades/mods_armor/unstoppable.psd" },
18446
+ { name: "upgrade_vampire", id: 499683006, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/health_stealing_bullets.psd" },
18447
+ { name: "upgrade_veil_walker", id: 865958998, slot: "vitality", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_utility/veil_walker.psd" },
18448
+ { name: "upgrade_vex_barrier", id: 1644605047, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/last_stand.psd" },
18449
+ { name: "upgrade_warp_stone", id: 3270001687, slot: "vitality", tier: 3, active: true, imbue: false, icon: "file://{images}/upgrades/mods_weapon/warp_stone.psd" },
18450
+ { name: "upgrade_weapon_shielding", id: 805079544, slot: "vitality", tier: 2, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/bullet_shield.psd" },
18451
+ { name: "upgrade_weighted_shots", id: 3791587546, slot: "weapon", tier: 3, active: false, imbue: false, icon: "file://{images}/upgrades/mods_armor/improved_bullet_armor.psd" },
18452
+ { name: "upgrade_withering_whip", id: 2922054143, slot: "spirit", tier: 1, active: true, imbue: false, icon: "file://{images}/upgrades/mods_tech/slowing_tech.psd" }
18453
+ ];
18454
+
18455
+ // js/src/items.ts
18456
+ var items = itemTable;
18457
+ function item(name) {
18458
+ return byName.get(name);
18128
18459
  }
18129
- function avatarBadge(steamId) {
18130
- return {
18131
- type: "avatar",
18132
- props: {
18133
- steamId,
18134
- style: {
18135
- width: badgeSize,
18136
- height: badgeSize,
18137
- horizontalAlign: "left",
18138
- verticalAlign: "bottom",
18139
- borderRadius: badgeSize / 2,
18140
- borderWidth: 1,
18141
- borderColor: shades.dim
18142
- }
18460
+ var byName = new Map(items.map((each) => [each.name, each]));
18461
+
18462
+ // js/src/hook.ts
18463
+ var hookAbility = "citadel_ability_hook";
18464
+ var hookUpgrades = 15;
18465
+ var Hook = class {
18466
+ constructor(read, cooldownSeconds = 0) {
18467
+ this.read = read;
18468
+ this.cooldownSeconds = cooldownSeconds;
18469
+ }
18470
+ read;
18471
+ cooldownSeconds;
18472
+ /** thrownAt is the start of the latest cooldown counted as a throw. */
18473
+ thrownAt = 0;
18474
+ /** reset forgets the throws counted so far, for a thrower in a new world. */
18475
+ reset() {
18476
+ this.thrownAt = 0;
18477
+ }
18478
+ /**
18479
+ * update reads the thrower's hook at game time now, keeps it fully upgraded
18480
+ * and sets the length of any cooldown a throw started. It reports nothing
18481
+ * for a hero without the hook. A caller that already read this frame's
18482
+ * abilities passes them to avoid another read.
18483
+ */
18484
+ update(player, now4, abilities = player.abilities()) {
18485
+ const ability = abilities.find((a) => a.name === hookAbility);
18486
+ if (!ability) {
18487
+ return void 0;
18143
18488
  }
18144
- };
18145
- }
18146
- var actionLooks = {
18147
- primary: {
18148
- idle: { background: tones.text },
18149
- hover: { background: shades.white },
18150
- text: shades.ink
18151
- },
18152
- secondary: {
18153
- idle: {
18154
- background: shades.raised,
18155
- borderWidth: 1,
18156
- borderColor: shades.faint
18157
- },
18158
- hover: { background: shades.lit, borderColor: tones.text },
18159
- text: tones.text
18160
- },
18161
- quiet: {
18162
- idle: { background: shades.clear },
18163
- hover: { background: shades.raised },
18164
- text: shades.quiet
18489
+ const victim = this.victim(ability.entity);
18490
+ if ((ability.upgrades & hookUpgrades) !== hookUpgrades) {
18491
+ player.setAbility({ ability: hookAbility, upgrades: hookUpgrades });
18492
+ }
18493
+ if (ability.cooldownEnd <= now4) {
18494
+ return { victim, thrown: false };
18495
+ }
18496
+ const thrown = ability.cooldownStart > this.thrownAt;
18497
+ if (thrown) {
18498
+ this.thrownAt = ability.cooldownStart;
18499
+ }
18500
+ this.setCooldown(player, ability);
18501
+ return { victim, thrown };
18502
+ }
18503
+ /** victim is the hero the hook entity holds, or undefined while it holds none. */
18504
+ victim(hookEntity) {
18505
+ const victim = this.read(
18506
+ hookEntity,
18507
+ "CCitadel_Ability_Hook",
18508
+ "m_hHookVictim",
18509
+ "handle"
18510
+ );
18511
+ return typeof victim === "number" ? victim : void 0;
18165
18512
  }
18166
- };
18167
- function Action(props) {
18168
- const look = actionLooks[props.kind ?? "secondary"];
18169
- const label = element(
18170
- "label",
18171
- {
18172
- face: "block",
18173
- fontSize: 16,
18174
- uppercase: true,
18175
- letterSpacing: 1,
18176
- color: look.text,
18177
- horizontalAlign: "center",
18178
- verticalAlign: "center",
18179
- noWrap: true
18180
- },
18181
- props.children
18182
- );
18183
- return {
18184
- type: "button",
18185
- props: {
18186
- style: {
18187
- height: sizes.control,
18188
- padding: [0, 14],
18189
- borderRadius: sizes.radius,
18190
- transition: motion.hover,
18191
- ...look.idle,
18192
- ...props.disabled ? { opacity: 0.4 } : {},
18193
- ...props.style
18194
- },
18195
- hover: props.disabled ? void 0 : look.hover,
18196
- hoverSound: props.disabled ? void 0 : sounds.hover,
18197
- sound: sounds.press,
18198
- disabled: props.disabled,
18199
- onPress: props.onPress,
18200
- children: label
18513
+ /** setCooldown ends the cooldown cooldownSeconds after the hook's throw. */
18514
+ setCooldown(player, ability) {
18515
+ if (this.cooldownSeconds <= 0) {
18516
+ player.refreshAbility(hookAbility);
18517
+ return;
18201
18518
  }
18202
- };
18203
- }
18204
- function Meter(props) {
18205
- const height = props.height ?? 8;
18206
- const value = Math.min(1, Math.max(0, props.value));
18207
- return element(
18208
- "panel",
18209
- {
18210
- width: props.width ?? 160,
18211
- height,
18212
- background: shades.raised,
18213
- borderRadius: height / 2,
18214
- overflow: "clip",
18215
- ...props.style
18216
- },
18217
- // The fill scales rather than resizes, so it eases without layout work.
18218
- element("panel", {
18219
- width: "100%",
18220
- height: "100%",
18221
- background: tones[props.tone ?? "accent"],
18222
- scale: [value, 1],
18223
- origin: [0, 50],
18224
- transition: motion.meter
18225
- })
18226
- );
18227
- }
18519
+ const cooldownEnd = ability.cooldownStart + this.cooldownSeconds;
18520
+ if (cooldownEnd !== ability.cooldownEnd) {
18521
+ player.setAbility({ ability: hookAbility, cooldownEnd });
18522
+ }
18523
+ }
18524
+ };
18228
18525
 
18229
18526
  // js/src/frameclock.ts
18230
18527
  var now3 = () => performance.now();
@@ -18428,7 +18725,7 @@ function strip(plane, { text: text2, side, up, pitch, color: color2, made }) {
18428
18725
  const yaw = plane.yaw * 180 / Math.PI - 90;
18429
18726
  for (const dx of [-1, 1]) {
18430
18727
  for (const dy of [-1, 1]) {
18431
- const shown = createText({
18728
+ const shown2 = createText({
18432
18729
  text: text2,
18433
18730
  position: at2(
18434
18731
  plane,
@@ -18443,7 +18740,7 @@ function strip(plane, { text: text2, side, up, pitch, color: color2, made }) {
18443
18740
  align: pitch === 90 ? "left" : "center",
18444
18741
  verticalAlign: "center"
18445
18742
  });
18446
- if (shown) made.objects.push(shown);
18743
+ if (shown2) made.objects.push(shown2);
18447
18744
  }
18448
18745
  }
18449
18746
  }
@@ -18600,188 +18897,13 @@ function leaderboard(players2, standing, rows, viewer) {
18600
18897
  const ranked = [...players2].sort(
18601
18898
  (a, b) => standing(b).wins - standing(a).wins || standing(b).rating - standing(a).rating
18602
18899
  );
18603
- const shown = ranked.slice(0, rows);
18604
- if (viewer !== void 0 && shown.length > 0 && players2.includes(viewer) && !shown.includes(viewer)) {
18605
- shown[shown.length - 1] = viewer;
18606
- }
18607
- return shown;
18608
- }
18609
-
18610
- // js/src/bystander.ts
18611
- var bystanderStates = [
18612
- "MODIFIER_STATE_IMMOBILIZED",
18613
- "MODIFIER_STATE_DISARMED",
18614
- "MODIFIER_STATE_MELEE_DISABLED",
18615
- "MODIFIER_STATE_SILENCED",
18616
- "MODIFIER_STATE_INVULNERABLE",
18617
- "MODIFIER_STATE_TECH_UNTARGETABLE_BY_ENEMIES",
18618
- "MODIFIER_STATE_TECH_UNTARGETABLE_BY_TEAMMATES",
18619
- "MODIFIER_STATE_DISPLACEMENT_IMMUNE",
18620
- "MODIFIER_STATE_IGNORE_BULLETS",
18621
- "MODIFIER_STATE_IGNORE_MELEE",
18622
- "MODIFIER_STATE_IN_ABILITY_DISABLE_ZOOM"
18623
- ];
18624
- function holdBystander(entity, active = true) {
18625
- let held = true;
18626
- for (const state of bystanderStates) {
18627
- held = holdModifierState(entity, state, active) && held;
18628
- }
18629
- return held;
18630
- }
18631
-
18632
- // js/src/strays.ts
18633
- var strayGraceSeconds = 3;
18634
- var strayRespawnTime = 1e9;
18635
- var strayBlow = 1e6;
18636
- var Strays = class {
18637
- /** since maps each stray pawn to when it was first seen with no player. */
18638
- since = /* @__PURE__ */ new Map();
18639
- /**
18640
- * gone holds the controller handles strays name that no longer resolve. A
18641
- * handle carries its entity's serial, so it never resolves again, and each
18642
- * failed read logs on the host: a sweep reads it once.
18643
- */
18644
- gone = /* @__PURE__ */ new Set();
18645
- sweptAt = -Infinity;
18646
- /**
18647
- * sweep lays down each hero pawn that has belonged to no player for
18648
- * strayGraceSeconds, at most once a second. The game sets a dead pawn's
18649
- * respawn when it dies, so the hold repeats on each sweep.
18650
- */
18651
- sweep(now4) {
18652
- if (now4 - this.sweptAt < 1) {
18653
- return;
18654
- }
18655
- this.sweptAt = now4;
18656
- const held = /* @__PURE__ */ new Set();
18657
- for (const { player } of players()) {
18658
- const pawn = player.pawn();
18659
- if (pawn) {
18660
- held.add(pawn.entity);
18661
- }
18662
- }
18663
- const since = /* @__PURE__ */ new Map();
18664
- const gone = /* @__PURE__ */ new Set();
18665
- for (const entity of findEntities("player")) {
18666
- if (held.has(entity) || ownHero(entity, this.gone, gone)) {
18667
- continue;
18668
- }
18669
- const first = this.since.get(entity) ?? now4;
18670
- since.set(entity, first);
18671
- if (now4 - first >= strayGraceSeconds) {
18672
- layDown(entity);
18673
- }
18674
- }
18675
- this.since = since;
18676
- this.gone = gone;
18677
- }
18678
- };
18679
- function ownHero(entity, known2, seen) {
18680
- const controller = readField(
18681
- entity,
18682
- "CBasePlayerPawn",
18683
- "m_hController",
18684
- "handle"
18685
- );
18686
- if (typeof controller !== "number") {
18687
- return false;
18688
- }
18689
- if (known2.has(controller)) {
18690
- seen.add(controller);
18691
- return false;
18692
- }
18693
- const connected = readField(
18694
- controller,
18695
- "CBasePlayerController",
18696
- "m_iConnected",
18697
- "int32"
18698
- );
18699
- if (connected === 3 || connected === 4) {
18700
- return false;
18701
- }
18702
- const hero = readField(
18703
- controller,
18704
- "CCitadelPlayerController",
18705
- "m_hHeroPawn",
18706
- "handle"
18707
- );
18708
- if (connected === void 0 && hero === void 0) {
18709
- seen.add(controller);
18710
- }
18711
- return hero === entity;
18712
- }
18713
- function layDown(entity) {
18714
- holdBystander(entity, false);
18715
- const health = readField(entity, "CBaseEntity", "m_iHealth", "int32");
18716
- if (typeof health === "number" && health > 0) {
18717
- damage({ victim: entity, amount: strayBlow });
18718
- log(`laid down a stray hero pawn ${entity}`);
18900
+ const shown2 = ranked.slice(0, rows);
18901
+ if (viewer !== void 0 && shown2.length > 0 && players2.includes(viewer) && !shown2.includes(viewer)) {
18902
+ shown2[shown2.length - 1] = viewer;
18719
18903
  }
18720
- writeField(
18721
- entity,
18722
- "CCitadelPlayerPawn",
18723
- "m_flRespawnTime",
18724
- "float32",
18725
- strayRespawnTime
18726
- );
18904
+ return shown2;
18727
18905
  }
18728
18906
 
18729
- // js/src/stragglers.ts
18730
- var stragglerConnectSeconds = 120;
18731
- var Stragglers = class {
18732
- connectSeconds;
18733
- strays;
18734
- /** joining maps each connecting human's slot to its generation and when it was first seen. */
18735
- joining = /* @__PURE__ */ new Map();
18736
- /** kicked holds the generation each slot had when this kicked it. */
18737
- kicked = /* @__PURE__ */ new Map();
18738
- sweptAt = -Infinity;
18739
- constructor(options = {}) {
18740
- this.connectSeconds = options.connectSeconds ?? stragglerConnectSeconds;
18741
- this.strays = options.heroes === false ? void 0 : new Strays();
18742
- }
18743
- /**
18744
- * sweep kicks each human connecting for longer than connectSeconds, once
18745
- * per connection, and lays down heroes no player holds, at most once a
18746
- * second.
18747
- */
18748
- sweep(now4) {
18749
- this.strays?.sweep(now4);
18750
- if (now4 - this.sweptAt < 1) {
18751
- return;
18752
- }
18753
- this.sweptAt = now4;
18754
- if (this.connectSeconds <= 0) {
18755
- return;
18756
- }
18757
- const joining = /* @__PURE__ */ new Map();
18758
- for (const connection2 of players()) {
18759
- if (connection2.bot || connection2.ready) {
18760
- continue;
18761
- }
18762
- const slot = connection2.player.slot;
18763
- const seen = this.joining.get(slot);
18764
- const since = seen?.generation === connection2.generation ? seen.since : now4;
18765
- joining.set(slot, { generation: connection2.generation, since });
18766
- if (now4 - since < this.connectSeconds) {
18767
- continue;
18768
- }
18769
- if (this.kicked.get(slot) === connection2.generation) {
18770
- continue;
18771
- }
18772
- this.kicked.set(slot, connection2.generation);
18773
- const name = connection2.name;
18774
- if (name === "" || name.includes('"')) {
18775
- log(`slot ${slot} stuck joining, but its name cannot be kicked`);
18776
- continue;
18777
- }
18778
- log(`kicked ${name}: still joining after ${this.connectSeconds} s`);
18779
- serverCommand(`kick "${name}"`);
18780
- }
18781
- this.joining = joining;
18782
- }
18783
- };
18784
-
18785
18907
  // js/src/probe.ts
18786
18908
  var ProbeRun = class {
18787
18909
  /**
@@ -20062,7 +20184,7 @@ function start(known2) {
20062
20184
  known2.started = ++requests;
20063
20185
  return known2.started;
20064
20186
  }
20065
- var left = "the player left; their Player no longer names a connection, and the slot may hold another player";
20187
+ var left2 = "the player left; their Player no longer names a connection, and the slot may hold another player";
20066
20188
  function generation(player) {
20067
20189
  const held = connection(player);
20068
20190
  if (held === void 0 || held.player !== player || !held.generation) {
@@ -20074,7 +20196,7 @@ function load(player, type, known2) {
20074
20196
  const request = start(known2);
20075
20197
  const live2 = generation(player);
20076
20198
  if (live2 === void 0) {
20077
- settle2(known2, request, unavailable(type, left));
20199
+ settle2(known2, request, unavailable(type, left2));
20078
20200
  return;
20079
20201
  }
20080
20202
  callServiceLater(
@@ -20123,7 +20245,7 @@ var persist = {
20123
20245
  const request = start(known2);
20124
20246
  const live2 = generation(player);
20125
20247
  if (live2 === void 0) {
20126
- settle2(known2, request, unavailable(type, left));
20248
+ settle2(known2, request, unavailable(type, left2));
20127
20249
  continue;
20128
20250
  }
20129
20251
  pending.push({ player, known: known2, request, generation: live2 });
@@ -20179,8 +20301,8 @@ var persist = {
20179
20301
  }
20180
20302
  const live2 = generation(player);
20181
20303
  if (live2 === void 0) {
20182
- log(`persist ${type} update: ${left}`);
20183
- done?.(void 0, left);
20304
+ log(`persist ${type} update: ${left2}`);
20305
+ done?.(void 0, left2);
20184
20306
  return;
20185
20307
  }
20186
20308
  const known2 = entry(player, type);
@@ -21001,6 +21123,9 @@ function respawned(player) {
21001
21123
  handler(player, pawn);
21002
21124
  }
21003
21125
  }
21126
+ function sweepStragglers(options = {}) {
21127
+ stragglers ??= new Stragglers(options);
21128
+ }
21004
21129
  function onFrame(handler) {
21005
21130
  frames.push(handler);
21006
21131
  }
@@ -21090,6 +21215,7 @@ var launches = [];
21090
21215
  var impacts = [];
21091
21216
  var landeds = [];
21092
21217
  var settingChanges = [];
21218
+ var stragglers;
21093
21219
  var handlers = {
21094
21220
  start(event) {
21095
21221
  for (const handler of starts) {
@@ -21099,8 +21225,8 @@ var handlers = {
21099
21225
  frames: true,
21100
21226
  damage: damages.length !== 0,
21101
21227
  damaged: damageds.length !== 0,
21102
- chat: chats.length !== 0,
21103
- joins: joins.length !== 0 || leaves.length !== 0,
21228
+ chat: chats.length !== 0 || chatShown(),
21229
+ joins: true,
21104
21230
  casts: abilityCasts.length !== 0,
21105
21231
  kills: kills.length !== 0,
21106
21232
  heals: heals.length !== 0,
@@ -21119,6 +21245,7 @@ var handlers = {
21119
21245
  tick(event.timeSeconds);
21120
21246
  advance(event.timeSeconds);
21121
21247
  advancePuppets(event.timeSeconds);
21248
+ stragglers?.sweep(event.timeSeconds);
21122
21249
  frameCount++;
21123
21250
  for (const handler of frames) {
21124
21251
  handler(event);
@@ -21137,6 +21264,7 @@ var handlers = {
21137
21264
  },
21138
21265
  chat(event) {
21139
21266
  after(0, () => {
21267
+ heard(event);
21140
21268
  for (const handler of chats) {
21141
21269
  handler(event);
21142
21270
  }
@@ -21260,14 +21388,18 @@ var handlers = {
21260
21388
  },
21261
21389
  // A join and a leave run at once, so the leaving player's hero still reads.
21262
21390
  playerJoined(event) {
21391
+ joined(event.connection.player);
21263
21392
  for (const handler of joins) {
21264
21393
  handler(event);
21265
21394
  }
21266
21395
  },
21396
+ // The library forgets what it showed a player who left once the mod has
21397
+ // heard the leave.
21267
21398
  playerLeft(event) {
21268
21399
  for (const handler of leaves) {
21269
21400
  handler(event);
21270
21401
  }
21402
+ if (event.disconnected) left(event.connection.player);
21271
21403
  }
21272
21404
  };
21273
21405
  serveEvents((call2) => serveMod(handlers, call2));
@@ -21361,6 +21493,7 @@ export {
21361
21493
  heroes,
21362
21494
  hide,
21363
21495
  hideHud,
21496
+ hideHudForAll,
21364
21497
  holdBystander,
21365
21498
  holdEntityModifier,
21366
21499
  holdMatchClock,
@@ -21406,6 +21539,8 @@ export {
21406
21539
  onSpawn,
21407
21540
  onStart,
21408
21541
  onWorld,
21542
+ parkHeight,
21543
+ parkedStates,
21409
21544
  pause,
21410
21545
  persist,
21411
21546
  playCamera,
@@ -21446,16 +21581,19 @@ export {
21446
21581
  settle,
21447
21582
  sheet,
21448
21583
  show,
21584
+ showChatLines,
21449
21585
  showEntityOnlyTo,
21450
21586
  showEntityToAll,
21451
21587
  silenceVoice,
21452
21588
  spawnNpc,
21589
+ spectateFrom,
21453
21590
  startRift,
21454
21591
  startServiceCall,
21455
21592
  startingRating,
21456
21593
  stopSound,
21457
21594
  stragglerConnectSeconds,
21458
21595
  strayGraceSeconds,
21596
+ sweepStragglers,
21459
21597
  theme_exports as theme,
21460
21598
  ticksPerSecond,
21461
21599
  toast,