demoman 0.9.4 → 0.9.6

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.
@@ -22493,32 +22493,6 @@
22493
22493
  }
22494
22494
  return moves;
22495
22495
  }
22496
- function insideOnly(a, b, w, filmWidth, inset) {
22497
- const k = b.width / filmWidth;
22498
- const x0 = w.x * k + inset;
22499
- const y0 = w.y * k + inset;
22500
- const x1 = (w.x + w.width) * k - inset;
22501
- const y1 = (w.y + w.height) * k - inset;
22502
- const r = Math.max(0, w.radius * k - inset);
22503
- const rgba = new Uint8ClampedArray(a.rgba);
22504
- for (let y = 0; y < b.height; y++) {
22505
- const cy = y + 0.5;
22506
- if (cy < y0 || cy > y1)
22507
- continue;
22508
- for (let x = 0; x < b.width; x++) {
22509
- const cx = x + 0.5;
22510
- if (cx < x0 || cx > x1)
22511
- continue;
22512
- const dx = cx < x0 + r ? x0 + r - cx : cx > x1 - r ? cx - (x1 - r) : 0;
22513
- const dy = cy < y0 + r ? y0 + r - cy : cy > y1 - r ? cy - (y1 - r) : 0;
22514
- if (dx > 0 && dy > 0 && dx * dx + dy * dy > r * r)
22515
- continue;
22516
- const p = (y * b.width + x) * 4;
22517
- rgba.set(b.rgba.subarray(p, p + 4), p);
22518
- }
22519
- }
22520
- return { width: b.width, height: b.height, rgba };
22521
- }
22522
22496
  function changedShare(a, b, look) {
22523
22497
  const moves = blockMoves(a, b, look.block);
22524
22498
  let changed = 0;
@@ -22843,125 +22817,8 @@
22843
22817
  ctx.drawImage(source, 0, 0, width, height);
22844
22818
  return { width, height, rgba: ctx.getImageData(0, 0, width, height).data };
22845
22819
  }
22846
- async function pictureReader(url, type, width) {
22847
- if (type === "image/gif") {
22848
- const res = await fetch(url);
22849
- if (!res.ok)
22850
- throw new Error(`${url} answered ${res.status}`);
22851
- const decoder = new ImageDecoder({ data: await res.arrayBuffer(), type });
22852
- try {
22853
- await decoder.tracks.ready;
22854
- const count = decoder.tracks.selectedTrack?.frameCount ?? 0;
22855
- if (count === 0)
22856
- throw new Error(`${url} has no frames`);
22857
- const ends = [];
22858
- let w = 0;
22859
- let h = 0;
22860
- let end = 0;
22861
- for (let i = 0; i < count; i++) {
22862
- const { image } = await decoder.decode({ frameIndex: i });
22863
- w = image.displayWidth;
22864
- h = image.displayHeight;
22865
- end += (image.duration ?? 0) / 1e6;
22866
- ends.push(end);
22867
- image.close();
22868
- }
22869
- const frame2 = Math.min(...ends.map((e, i) => e - (ends[i - 1] ?? 0)).filter((d) => d > 0));
22870
- const indexAt = (t) => {
22871
- const i = ends.findIndex((e) => t < e);
22872
- return i < 0 ? count - 1 : i;
22873
- };
22874
- const drawnAt = async (i) => {
22875
- const { image } = await decoder.decode({ frameIndex: i });
22876
- try {
22877
- return drawnOf(image, w, h, width);
22878
- } finally {
22879
- image.close();
22880
- }
22881
- };
22882
- return {
22883
- width: w,
22884
- height: h,
22885
- length: end,
22886
- frame: frame2,
22887
- at: async (times) => {
22888
- const out = [];
22889
- for (const t of times)
22890
- out.push(await drawnAt(indexAt(t)));
22891
- return out;
22892
- },
22893
- close: () => decoder.close()
22894
- };
22895
- } catch (error) {
22896
- decoder.close();
22897
- throw error;
22898
- }
22899
- }
22900
- const input = new Input({
22901
- source: new UrlSource(url, { getRetryDelay: () => null }),
22902
- formats: ALL_FORMATS
22903
- });
22904
- const track = await input.getPrimaryVideoTrack();
22905
- if (track === null)
22906
- throw new Error(`${url} has no video track`);
22907
- if (!await track.canDecode()) {
22908
- throw new Error(`${url}'s video track (${track.codec ?? "unknown codec"}) cannot be decoded in this browser`);
22909
- }
22910
- const length = await input.computeDuration();
22911
- const rate = (await track.computePacketStats()).averagePacketRate;
22912
- const frame = rate > 0 ? 1 / rate : 1 / 30;
22913
- const at = async (times) => {
22914
- const drawn = [];
22915
- for await (const wrapped of new CanvasSink(track).canvasesAtTimestamps(times)) {
22916
- const t = times[drawn.length];
22917
- if (!wrapped)
22918
- throw new Error(`no frame decoded at ${t.toFixed(3)}s`);
22919
- const c = wrapped.canvas;
22920
- drawn.push(drawnOf(c, c.width, c.height, width));
22921
- }
22922
- return drawn;
22923
- };
22924
- return {
22925
- width: track.displayWidth,
22926
- height: track.displayHeight,
22927
- length,
22928
- frame,
22929
- at,
22930
- close: () => input.dispose()
22931
- };
22932
- }
22933
- async function screensDiff(urlA, urlB, type, msA, msB, windows, o) {
22934
- try {
22935
- const ra = await blamed("a", urlA, type, o.width);
22936
- try {
22937
- const rb = await blamed("b", urlB, type, o.width);
22938
- try {
22939
- return await diffOf(ra, rb, msA, msB, windows, o);
22940
- } finally {
22941
- rb.close();
22942
- }
22943
- } finally {
22944
- ra.close();
22945
- }
22946
- } catch (error) {
22947
- if (error instanceof Unreadable)
22948
- return { unreadable: error.side, error: error.message };
22949
- throw error;
22950
- }
22951
- }
22952
- async function imagesDiff(urlsA, urlsB, sizeA, sizeB, windows, o) {
22953
- const file = (size) => ({
22954
- ...size,
22955
- length: 0,
22956
- frame: 0
22957
- });
22958
- const answer = {
22959
- a: file(sizeA),
22960
- b: file(sizeB),
22961
- changed: []
22962
- };
22963
- if (sizeA.width !== sizeB.width || sizeA.height !== sizeB.height)
22964
- return answer;
22820
+ async function imagesDiff(urlsA, urlsB, looks) {
22821
+ const answer = { changed: [] };
22965
22822
  const read = async (side, url) => {
22966
22823
  try {
22967
22824
  const res = await fetch(url);
@@ -22969,7 +22826,7 @@
22969
22826
  throw new Error(`answered ${res.status}`);
22970
22827
  const bitmap = await createImageBitmap(await res.blob());
22971
22828
  try {
22972
- return drawnOf(bitmap, bitmap.width, bitmap.height, o.width);
22829
+ return drawnOf(bitmap, bitmap.width, bitmap.height, bitmap.width);
22973
22830
  } finally {
22974
22831
  bitmap.close();
22975
22832
  }
@@ -22980,10 +22837,10 @@
22980
22837
  try {
22981
22838
  for (const [i, urlA] of urlsA.entries()) {
22982
22839
  const da = await read("a", urlA);
22983
- const gb = await read("b", urlsB[i]);
22984
- const w = windows[i] ?? null;
22985
- const db = w === null ? gb : insideOnly(da, gb, w, sizeB.width, o.inset);
22986
- answer.changed.push(o.looks.map((look) => changedShare(da, db, look)));
22840
+ const db = await read("b", urlsB[i]);
22841
+ if (da.width !== db.width || da.height !== db.height)
22842
+ throw new Error(`${urlA} is ${da.width}x${da.height} and ${urlsB[i]} ${db.width}x${db.height}: images of two sizes are not compared`);
22843
+ answer.changed.push(looks.map((look) => changedShare(da, db, look)));
22987
22844
  }
22988
22845
  } catch (error) {
22989
22846
  if (error instanceof Unreadable)
@@ -22999,48 +22856,6 @@
22999
22856
  this.side = side;
23000
22857
  }
23001
22858
  };
23002
- async function blamed(side, url, type, width) {
23003
- const blame = (p) => p.catch((error) => {
23004
- throw new Unreadable(side, error);
23005
- });
23006
- const r = await blame(pictureReader(url, type, width));
23007
- return {
23008
- ...r,
23009
- at: (times) => blame(r.at(times))
23010
- };
23011
- }
23012
- async function diffOf(ra, rb, msA, msB, windows, o) {
23013
- const file = (r) => ({
23014
- width: r.width,
23015
- height: r.height,
23016
- length: r.length,
23017
- frame: r.frame
23018
- });
23019
- const answer = {
23020
- a: file(ra),
23021
- b: file(rb),
23022
- changed: []
23023
- };
23024
- if (ra.width !== rb.width || ra.height !== rb.height)
23025
- return answer;
23026
- const within = (r, ms) => ms / 1e3 < r.length;
23027
- const keep = msA.map((a, i) => within(ra, a) && within(rb, msB[i]) ? i : -1);
23028
- const ids = keep.filter((i) => i >= 0);
23029
- const ga = await ra.at(ids.map((i) => msA[i] / 1e3));
23030
- const gb = await rb.at(ids.map((i) => msB[i] / 1e3));
23031
- for (const i of msA.keys()) {
23032
- const k = ids.indexOf(i);
23033
- if (k < 0) {
23034
- answer.changed.push(null);
23035
- continue;
23036
- }
23037
- const da = ga[k];
23038
- const w = windows[i] ?? null;
23039
- const db = w === null ? gb[k] : insideOnly(da, gb[k], w, rb.width, o.inset);
23040
- answer.changed.push(o.looks.map((look) => changedShare(da, db, look)));
23041
- }
23042
- return answer;
23043
- }
23044
22859
  function meanAbsoluteDifference(a, b) {
23045
22860
  let sum = 0;
23046
22861
  for (let p = 0; p < a.length; p += 4) {
@@ -23049,7 +22864,6 @@
23049
22864
  return sum / (a.length / 4 * 3);
23050
22865
  }
23051
22866
  var entry = {
23052
- screensDiff,
23053
22867
  imagesDiff,
23054
22868
  decodeFrame,
23055
22869
  readCrops,
@@ -15416,6 +15416,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15416
15416
  pressMs: external_exports.number().nonnegative(),
15417
15417
  releaseMs: external_exports.number().nonnegative()
15418
15418
  });
15419
+ var PageScreenSchema = external_exports.object({
15420
+ after: external_exports.number().int().min(0),
15421
+ sourceTimeMs: external_exports.number(),
15422
+ ref: external_exports.string(),
15423
+ width: external_exports.number().int().positive(),
15424
+ height: external_exports.number().int().positive(),
15425
+ heldAnimations: external_exports.number().int().min(0),
15426
+ waitedMs: external_exports.number().min(0),
15427
+ unsettled: external_exports.string().optional()
15428
+ }).refine((s) => s.ref !== "" || s.unsettled !== void 0, {
15429
+ message: 'a page screen with no bytes (ref "") must say why in `unsettled`',
15430
+ path: ["unsettled"]
15431
+ });
15419
15432
  var ViewportTransformSchema = external_exports.object({
15420
15433
  sourceTimeMs: external_exports.number().nonnegative(),
15421
15434
  scale: external_exports.number().positive(),
@@ -15440,7 +15453,12 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15440
15453
  /** The longest single hold within `roomMs` (a settle or the camera's
15441
15454
  * room, not a wait for the page to go quiet): what the film check may
15442
15455
  * take for Demoman's pacing inside one still stretch. */
15443
- roomHeldMs: external_exports.number().nonnegative().optional()
15456
+ roomHeldMs: external_exports.number().nonnegative().optional(),
15457
+ /** Where the walk set off for this step, in source time. */
15458
+ approachSourceTimeMs: external_exports.number().min(0).optional(),
15459
+ /** When this step's approach scroll ended, in source time: continuous
15460
+ * recording, and only when the approach scrolled. */
15461
+ scrollEndSourceTimeMs: external_exports.number().min(0).optional()
15444
15462
  }).superRefine((marker, ctx) => {
15445
15463
  if (marker.actEndSourceTimeMs !== void 0 && marker.actEndSourceTimeMs < marker.sourceTimeMs) {
15446
15464
  ctx.addIssue({
@@ -15541,7 +15559,27 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15541
15559
  // A native drag's picture could not be drawn in the page (the element
15542
15560
  // the page named for it was gone, or copying it threw). The drag still
15543
15561
  // ran; the film shows the card jump to its drop instead of travelling.
15544
- "dragPictureMissing"
15562
+ "dragPictureMissing",
15563
+ // A step's page had not settled when the cap ran out (requests in
15564
+ // flight, an animation running, the DOM still changing) or showed a
15565
+ // caret it would not hide: the page's own doing. The video is
15566
+ // unaffected; refresh cannot compare that screen. The note names the
15567
+ // step and the conditions.
15568
+ "stepUnsettled",
15569
+ // As `stepUnsettled`, but at least one condition was this machine's:
15570
+ // the first paint never came, the settle probe or the page screen
15571
+ // failed, requests could not be watched. Recording again may change
15572
+ // it, so refresh does (DEM-55); the note names the step and the
15573
+ // conditions, the page's beside the machine's.
15574
+ "stepSettleFailed",
15575
+ // A step's settle left out a request open since more than a request cap
15576
+ // before the step began (a long poll): its own step waited for it. The
15577
+ // screen counts as settled; the note names the step and how many.
15578
+ "requestNotWaited",
15579
+ // A page screen's hold (caret hidden, endless animations held) could not
15580
+ // be undone after the capture: the video after that step may show no
15581
+ // caret and frozen spinners. About the video, so not forgiven.
15582
+ "pageHoldNotReleased"
15545
15583
  ]),
15546
15584
  note: external_exports.string()
15547
15585
  });
@@ -15603,6 +15641,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
15603
15641
  // 2026-10-11 carries none, and identity is what they were drawn as.
15604
15642
  // See `ViewportTransformSchema`.
15605
15643
  viewportTransforms: external_exports.array(ViewportTransformSchema).optional(),
15644
+ // Optional, and absent is none: a sampled replay, a capture, and every
15645
+ // bundle written before 2026-11-10 carry none.
15646
+ pageScreens: external_exports.array(PageScreenSchema).optional(),
15606
15647
  markers: external_exports.array(MarkerSchema),
15607
15648
  degradations: external_exports.array(DegradationSchema),
15608
15649
  /**
@@ -16074,7 +16115,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16074
16115
  * own edit. The record that write-back reads, never inferred from the
16075
16116
  * scale's value. Absent when the scale was the default.
16076
16117
  */
16077
- scaleSetBy: external_exports.enum(["script", "author"]).optional()
16118
+ scaleSetBy: external_exports.enum(["script", "author"]).optional(),
16119
+ /**
16120
+ * How the camera reaches this zoom, decided once at record time from the
16121
+ * beat plan: `pan` slides from the zoom before it, `return` pulls back to
16122
+ * full frame first. Absent: the renderer's own clock (every earlier take).
16123
+ */
16124
+ arrives: external_exports.enum(["pan", "return"]).optional()
16078
16125
  });
16079
16126
  var ZoomSkipped = external_exports.union([
16080
16127
  external_exports.object({
@@ -16361,6 +16408,24 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
16361
16408
  anchors: external_exports.array(Anchor),
16362
16409
  actions: external_exports.array(Action),
16363
16410
  camera: external_exports.array(CameraEvent),
16411
+ /**
16412
+ * The take's pauses, planned rather than measured: one beat per action,
16413
+ * in order. Absent on every take recorded before the plan existed.
16414
+ */
16415
+ pacing: external_exports.object({
16416
+ beats: external_exports.array(external_exports.object({
16417
+ beforeActionId: external_exports.string().min(1),
16418
+ /** Dead air before the action. */
16419
+ restMs: external_exports.number().min(0),
16420
+ /** How long the walk to the action takes. */
16421
+ arriveMs: external_exports.number().min(0),
16422
+ /** Dead air from the approach scroll's end to the journey's
16423
+ * start. Only on a step whose approach scrolled. */
16424
+ afterScrollMs: external_exports.number().min(0).optional()
16425
+ })),
16426
+ /** Dead air after the last action's motion. */
16427
+ tailMs: external_exports.number().min(0)
16428
+ }).optional(),
16364
16429
  /** See `ZoomSkipped`. */
16365
16430
  zoomsSkipped: external_exports.array(ZoomSkipped).optional(),
16366
16431
  edits: external_exports.object({