@fairfox/polly 0.71.0 → 0.73.0

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.
Files changed (45) hide show
  1. package/dist/src/client/index.js +2 -2
  2. package/dist/src/client/index.js.map +2 -2
  3. package/dist/src/elysia/index.js +464 -4
  4. package/dist/src/elysia/index.js.map +6 -4
  5. package/dist/src/peer.d.ts +2 -0
  6. package/dist/src/peer.js +468 -4
  7. package/dist/src/peer.js.map +8 -5
  8. package/dist/src/polly-ui/ActionInput.d.ts +12 -2
  9. package/dist/src/polly-ui/ActionSelect.d.ts +36 -0
  10. package/dist/src/polly-ui/Button.d.ts +4 -0
  11. package/dist/src/polly-ui/Cluster.d.ts +36 -0
  12. package/dist/src/polly-ui/Code.d.ts +18 -0
  13. package/dist/src/polly-ui/Surface.d.ts +12 -1
  14. package/dist/src/polly-ui/Text.d.ts +43 -0
  15. package/dist/src/polly-ui/index.css +320 -194
  16. package/dist/src/polly-ui/index.d.ts +5 -1
  17. package/dist/src/polly-ui/index.js +533 -284
  18. package/dist/src/polly-ui/index.js.map +14 -8
  19. package/dist/src/polly-ui/internal/dispatch-action.d.ts +13 -0
  20. package/dist/src/polly-ui/internal/passthrough.d.ts +25 -0
  21. package/dist/src/polly-ui/markdown.js +3 -3
  22. package/dist/src/polly-ui/markdown.js.map +2 -2
  23. package/dist/src/polly-ui/styles.css +345 -194
  24. package/dist/src/polly-ui/theme.css +1 -0
  25. package/dist/src/shared/lib/peer-repo-server.d.ts +18 -0
  26. package/dist/src/shared/lib/sweep-sealed.d.ts +111 -0
  27. package/dist/tools/quality/src/cli.js +6 -2
  28. package/dist/tools/quality/src/cli.js.map +3 -3
  29. package/dist/tools/quality/src/index.js +6 -2
  30. package/dist/tools/quality/src/index.js.map +3 -3
  31. package/dist/tools/test/src/browser/run.js +89 -49
  32. package/dist/tools/test/src/browser/run.js.map +6 -5
  33. package/dist/tools/test/src/browser/runner-core.d.ts +32 -0
  34. package/dist/tools/test/src/e2e-mesh/index.js +193 -171
  35. package/dist/tools/test/src/e2e-mesh/index.js.map +4 -4
  36. package/dist/tools/test/src/visual/index.js +270 -251
  37. package/dist/tools/test/src/visual/index.js.map +5 -5
  38. package/dist/tools/verify/specs/tla/MeshSeed.cfg +27 -0
  39. package/dist/tools/verify/specs/tla/MeshSeed.tla +179 -0
  40. package/dist/tools/verify/specs/tla/README.md +11 -1
  41. package/dist/tools/verify/src/cli.js +136 -51
  42. package/dist/tools/verify/src/cli.js.map +9 -7
  43. package/dist/tools/visualize/src/cli.js +72 -2
  44. package/dist/tools/visualize/src/cli.js.map +5 -5
  45. package/package.json +3 -2
@@ -11487,7 +11487,7 @@ var init_zlib = __esm(() => {
11487
11487
  export_default = import_browserify_zlib.default;
11488
11488
  });
11489
11489
 
11490
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/chunkstream.js
11490
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/chunkstream.js
11491
11491
  var require_chunkstream = __commonJS((exports, module) => {
11492
11492
  var util = (init_util(), __toCommonJS(exports_util));
11493
11493
  var Stream = require_stream();
@@ -11619,7 +11619,7 @@ var require_chunkstream = __commonJS((exports, module) => {
11619
11619
  };
11620
11620
  });
11621
11621
 
11622
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/interlace.js
11622
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/interlace.js
11623
11623
  var require_interlace = __commonJS((exports) => {
11624
11624
  var imagePasses = [
11625
11625
  {
@@ -11692,7 +11692,7 @@ var require_interlace = __commonJS((exports) => {
11692
11692
  };
11693
11693
  });
11694
11694
 
11695
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/paeth-predictor.js
11695
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/paeth-predictor.js
11696
11696
  var require_paeth_predictor = __commonJS((exports, module) => {
11697
11697
  module.exports = function paethPredictor(left, above, upLeft) {
11698
11698
  let paeth = left + above - upLeft;
@@ -11709,7 +11709,7 @@ var require_paeth_predictor = __commonJS((exports, module) => {
11709
11709
  };
11710
11710
  });
11711
11711
 
11712
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/filter-parse.js
11712
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/filter-parse.js
11713
11713
  var require_filter_parse = __commonJS((exports, module) => {
11714
11714
  var interlaceUtils = require_interlace();
11715
11715
  var paethPredictor = require_paeth_predictor();
@@ -11844,7 +11844,7 @@ var require_filter_parse = __commonJS((exports, module) => {
11844
11844
  };
11845
11845
  });
11846
11846
 
11847
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/filter-parse-async.js
11847
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/filter-parse-async.js
11848
11848
  var require_filter_parse_async = __commonJS((exports, module) => {
11849
11849
  var util = (init_util(), __toCommonJS(exports_util));
11850
11850
  var ChunkStream = require_chunkstream();
@@ -11867,7 +11867,7 @@ var require_filter_parse_async = __commonJS((exports, module) => {
11867
11867
  util.inherits(FilterAsync, ChunkStream);
11868
11868
  });
11869
11869
 
11870
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/constants.js
11870
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/constants.js
11871
11871
  var require_constants2 = __commonJS((exports, module) => {
11872
11872
  module.exports = {
11873
11873
  PNG_SIGNATURE: [137, 80, 78, 71, 13, 10, 26, 10],
@@ -11894,7 +11894,7 @@ var require_constants2 = __commonJS((exports, module) => {
11894
11894
  };
11895
11895
  });
11896
11896
 
11897
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/crc.js
11897
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/crc.js
11898
11898
  var require_crc = __commonJS((exports, module) => {
11899
11899
  var crcTable = [];
11900
11900
  (function() {
@@ -11931,7 +11931,7 @@ var require_crc = __commonJS((exports, module) => {
11931
11931
  };
11932
11932
  });
11933
11933
 
11934
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/parser.js
11934
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/parser.js
11935
11935
  var require_parser = __commonJS((exports, module) => {
11936
11936
  var constants2 = require_constants2();
11937
11937
  var CrcCalculator = require_crc();
@@ -12148,7 +12148,7 @@ var require_parser = __commonJS((exports, module) => {
12148
12148
  };
12149
12149
  });
12150
12150
 
12151
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/bitmapper.js
12151
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/bitmapper.js
12152
12152
  var require_bitmapper = __commonJS((exports) => {
12153
12153
  var interlaceUtils = require_interlace();
12154
12154
  var pixelBppMapper = [
@@ -12359,7 +12359,7 @@ var require_bitmapper = __commonJS((exports) => {
12359
12359
  };
12360
12360
  });
12361
12361
 
12362
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/format-normaliser.js
12362
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/format-normaliser.js
12363
12363
  var require_format_normaliser = __commonJS((exports, module) => {
12364
12364
  function dePalette(indata, outdata, width, height, palette) {
12365
12365
  let pxPos = 0;
@@ -12435,7 +12435,7 @@ var require_format_normaliser = __commonJS((exports, module) => {
12435
12435
  };
12436
12436
  });
12437
12437
 
12438
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/parser-async.js
12438
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/parser-async.js
12439
12439
  var require_parser_async = __commonJS((exports, module) => {
12440
12440
  var util = (init_util(), __toCommonJS(exports_util));
12441
12441
  var zlib = (init_zlib(), __toCommonJS(exports_zlib));
@@ -12557,7 +12557,7 @@ var require_parser_async = __commonJS((exports, module) => {
12557
12557
  };
12558
12558
  });
12559
12559
 
12560
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/bitpacker.js
12560
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/bitpacker.js
12561
12561
  var require_bitpacker = __commonJS((exports, module) => {
12562
12562
  var constants2 = require_constants2();
12563
12563
  module.exports = function(dataIn, width, height, options) {
@@ -12686,7 +12686,7 @@ var require_bitpacker = __commonJS((exports, module) => {
12686
12686
  };
12687
12687
  });
12688
12688
 
12689
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/filter-pack.js
12689
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/filter-pack.js
12690
12690
  var require_filter_pack = __commonJS((exports, module) => {
12691
12691
  var paethPredictor = require_paeth_predictor();
12692
12692
  function filterNone(pxData, pxPos, byteWidth, rawData, rawPos) {
@@ -12825,7 +12825,7 @@ var require_filter_pack = __commonJS((exports, module) => {
12825
12825
  };
12826
12826
  });
12827
12827
 
12828
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/packer.js
12828
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/packer.js
12829
12829
  var require_packer = __commonJS((exports, module) => {
12830
12830
  var constants2 = require_constants2();
12831
12831
  var CrcStream = require_crc();
@@ -12913,7 +12913,7 @@ var require_packer = __commonJS((exports, module) => {
12913
12913
  };
12914
12914
  });
12915
12915
 
12916
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/packer-async.js
12916
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/packer-async.js
12917
12917
  var require_packer_async = __commonJS((exports, module) => {
12918
12918
  var util = (init_util(), __toCommonJS(exports_util));
12919
12919
  var Stream = require_stream();
@@ -12946,7 +12946,7 @@ var require_packer_async = __commonJS((exports, module) => {
12946
12946
  };
12947
12947
  });
12948
12948
 
12949
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/sync-inflate.js
12949
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/sync-inflate.js
12950
12950
  var require_sync_inflate = __commonJS((exports, module) => {
12951
12951
  var assert2 = (init_assert(), __toCommonJS(exports_assert)).ok;
12952
12952
  var zlib = (init_zlib(), __toCommonJS(exports_zlib));
@@ -13065,7 +13065,7 @@ var require_sync_inflate = __commonJS((exports, module) => {
13065
13065
  exports.inflateSync = inflateSync;
13066
13066
  });
13067
13067
 
13068
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/sync-reader.js
13068
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/sync-reader.js
13069
13069
  var require_sync_reader = __commonJS((exports, module) => {
13070
13070
  var SyncReader = module.exports = function(buffer) {
13071
13071
  this._buffer = buffer;
@@ -13099,7 +13099,7 @@ var require_sync_reader = __commonJS((exports, module) => {
13099
13099
  };
13100
13100
  });
13101
13101
 
13102
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/filter-parse-sync.js
13102
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/filter-parse-sync.js
13103
13103
  var require_filter_parse_sync = __commonJS((exports) => {
13104
13104
  var SyncReader = require_sync_reader();
13105
13105
  var Filter = require_filter_parse();
@@ -13119,7 +13119,7 @@ var require_filter_parse_sync = __commonJS((exports) => {
13119
13119
  };
13120
13120
  });
13121
13121
 
13122
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/parser-sync.js
13122
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/parser-sync.js
13123
13123
  var require_parser_sync = __commonJS((exports, module) => {
13124
13124
  var hasSyncZlib = true;
13125
13125
  var zlib = (init_zlib(), __toCommonJS(exports_zlib));
@@ -13205,7 +13205,7 @@ var require_parser_sync = __commonJS((exports, module) => {
13205
13205
  };
13206
13206
  });
13207
13207
 
13208
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/packer-sync.js
13208
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/packer-sync.js
13209
13209
  var require_packer_sync = __commonJS((exports, module) => {
13210
13210
  var hasSyncZlib = true;
13211
13211
  var zlib = (init_zlib(), __toCommonJS(exports_zlib));
@@ -13238,7 +13238,7 @@ var require_packer_sync = __commonJS((exports, module) => {
13238
13238
  };
13239
13239
  });
13240
13240
 
13241
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/png-sync.js
13241
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/png-sync.js
13242
13242
  var require_png_sync = __commonJS((exports) => {
13243
13243
  var parse = require_parser_sync();
13244
13244
  var pack = require_packer_sync();
@@ -13250,7 +13250,7 @@ var require_png_sync = __commonJS((exports) => {
13250
13250
  };
13251
13251
  });
13252
13252
 
13253
- // ../../node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/png.js
13253
+ // node_modules/.bun/pngjs@7.0.0/node_modules/pngjs/lib/png.js
13254
13254
  var require_png = __commonJS((exports) => {
13255
13255
  var util = (init_util(), __toCommonJS(exports_util));
13256
13256
  var Stream = require_stream();
@@ -13374,232 +13374,25 @@ var require_png = __commonJS((exports) => {
13374
13374
  };
13375
13375
  });
13376
13376
 
13377
- // tools/test/src/visual/compare.ts
13378
- var {readFileSync, writeFileSync} = (() => ({}));
13379
-
13380
- // ../../node_modules/.bun/pixelmatch@7.2.0/node_modules/pixelmatch/index.js
13381
- function pixelmatch(img1, img2, output, width, height, options = {}) {
13382
- const {
13383
- threshold = 0.1,
13384
- alpha = 0.1,
13385
- aaColor = [255, 255, 0],
13386
- diffColor = [255, 0, 0],
13387
- checkerboard = true,
13388
- includeAA,
13389
- diffColorAlt,
13390
- diffMask
13391
- } = options;
13392
- if (!isPixelData(img1) || !isPixelData(img2) || output && !isPixelData(output))
13393
- throw new Error("Image data: Uint8Array, Uint8ClampedArray or Buffer expected.");
13394
- if (img1.length !== img2.length || output && output.length !== img1.length)
13395
- throw new Error(`Image sizes do not match. Image 1 size: ${img1.length}, image 2 size: ${img2.length}`);
13396
- if (img1.length !== width * height * 4)
13397
- throw new Error(`Image data size does not match width/height. Expecting ${width * height * 4}. Got ${img1.length}`);
13398
- const len = width * height;
13399
- const a32 = new Uint32Array(img1.buffer, img1.byteOffset, len);
13400
- const b32 = new Uint32Array(img2.buffer, img2.byteOffset, len);
13401
- let identical = true;
13402
- for (let i = 0;i < len; i++) {
13403
- if (a32[i] !== b32[i]) {
13404
- identical = false;
13405
- break;
13406
- }
13407
- }
13408
- if (identical) {
13409
- if (output && !diffMask) {
13410
- for (let i = 0, pos = 0;i < len; i++, pos += 4)
13411
- drawGrayPixel(img1, pos, alpha, output);
13412
- }
13413
- return 0;
13414
- }
13415
- const maxDelta = 35215 * threshold * threshold;
13416
- const [aaR, aaG, aaB] = aaColor;
13417
- const [diffR, diffG, diffB] = diffColor;
13418
- const [altR, altG, altB] = diffColorAlt || diffColor;
13419
- let diff = 0;
13420
- for (let i = 0, pos = 0;i < len; i++, pos += 4) {
13421
- const delta = a32[i] === b32[i] ? 0 : colorDelta(img1, img2, pos, pos, checkerboard);
13422
- if (Math.abs(delta) > maxDelta) {
13423
- const x = i % width;
13424
- const y = i / width | 0;
13425
- const isExcludedAA = !includeAA && (antialiased(img1, x, y, width, height, a32, b32, checkerboard) || antialiased(img2, x, y, width, height, b32, a32, checkerboard));
13426
- if (isExcludedAA) {
13427
- if (output && !diffMask)
13428
- drawPixel(output, pos, aaR, aaG, aaB);
13429
- } else {
13430
- if (output) {
13431
- if (delta < 0) {
13432
- drawPixel(output, pos, altR, altG, altB);
13433
- } else {
13434
- drawPixel(output, pos, diffR, diffG, diffB);
13435
- }
13436
- }
13437
- diff++;
13438
- }
13439
- } else if (output && !diffMask) {
13440
- drawGrayPixel(img1, pos, alpha, output);
13441
- }
13442
- }
13443
- return diff;
13444
- }
13445
- function isPixelData(arr) {
13446
- return ArrayBuffer.isView(arr) && arr.BYTES_PER_ELEMENT === 1;
13447
- }
13448
- function antialiased(img, x1, y1, width, height, a32, b32, checkerboard) {
13449
- const x0 = Math.max(x1 - 1, 0);
13450
- const y0 = Math.max(y1 - 1, 0);
13451
- const x2 = Math.min(x1 + 1, width - 1);
13452
- const y2 = Math.min(y1 + 1, height - 1);
13453
- const pos4 = (y1 * width + x1) * 4;
13454
- const cr = img[pos4];
13455
- const cg = img[pos4 + 1];
13456
- const cb = img[pos4 + 2];
13457
- const ca = img[pos4 + 3];
13458
- let zeroes = x1 === x0 || x1 === x2 || y1 === y0 || y1 === y2 ? 1 : 0;
13459
- let min = 0;
13460
- let max = 0;
13461
- let minX = 0;
13462
- let minY = 0;
13463
- let maxX = 0;
13464
- let maxY = 0;
13465
- for (let x = x0;x <= x2; x++) {
13466
- for (let y = y0;y <= y2; y++) {
13467
- if (x === x1 && y === y1)
13468
- continue;
13469
- const delta = brightnessDelta(img, pos4, (y * width + x) * 4, cr, cg, cb, ca, checkerboard);
13470
- if (delta === 0) {
13471
- zeroes++;
13472
- if (zeroes > 2)
13473
- return false;
13474
- } else if (delta < min) {
13475
- min = delta;
13476
- minX = x;
13477
- minY = y;
13478
- } else if (delta > max) {
13479
- max = delta;
13480
- maxX = x;
13481
- maxY = y;
13482
- }
13483
- }
13484
- }
13485
- if (min === 0 || max === 0)
13486
- return false;
13487
- return hasManySiblings(a32, minX, minY, width, height) && hasManySiblings(b32, minX, minY, width, height) || hasManySiblings(a32, maxX, maxY, width, height) && hasManySiblings(b32, maxX, maxY, width, height);
13488
- }
13489
- function hasManySiblings(img, x1, y1, width, height) {
13490
- const x0 = Math.max(x1 - 1, 0);
13491
- const y0 = Math.max(y1 - 1, 0);
13492
- const x2 = Math.min(x1 + 1, width - 1);
13493
- const y2 = Math.min(y1 + 1, height - 1);
13494
- const val = img[y1 * width + x1];
13495
- let zeroes = x1 === x0 || x1 === x2 || y1 === y0 || y1 === y2 ? 1 : 0;
13496
- for (let x = x0;x <= x2; x++) {
13497
- for (let y = y0;y <= y2; y++) {
13498
- if (x === x1 && y === y1)
13499
- continue;
13500
- zeroes += +(val === img[y * width + x]);
13501
- if (zeroes > 2)
13502
- return true;
13503
- }
13504
- }
13505
- return false;
13506
- }
13507
- function colorDelta(img1, img2, k, m, checkerboard) {
13508
- const r1 = img1[k];
13509
- const g1 = img1[k + 1];
13510
- const b1 = img1[k + 2];
13511
- const a1 = img1[k + 3];
13512
- const r2 = img2[m];
13513
- const g2 = img2[m + 1];
13514
- const b2 = img2[m + 2];
13515
- const a2 = img2[m + 3];
13516
- let dr = r1 - r2;
13517
- let dg = g1 - g2;
13518
- let db = b1 - b2;
13519
- const da = a1 - a2;
13520
- if (a1 < 255 || a2 < 255) {
13521
- let rb = 255, gb = 255, bb = 255;
13522
- if (checkerboard) {
13523
- rb = 48 + 159 * (k % 2);
13524
- gb = 48 + 159 * ((k / 1.618033988749895 | 0) % 2);
13525
- bb = 48 + 159 * ((k / 2.618033988749895 | 0) % 2);
13526
- }
13527
- dr = (r1 * a1 - r2 * a2 - rb * da) / 255;
13528
- dg = (g1 * a1 - g2 * a2 - gb * da) / 255;
13529
- db = (b1 * a1 - b2 * a2 - bb * da) / 255;
13530
- }
13531
- const y = dr * 0.29889531 + dg * 0.58662247 + db * 0.11448223;
13532
- const i = dr * 0.59597799 - dg * 0.2741761 - db * 0.32180189;
13533
- const q = dr * 0.21147017 - dg * 0.52261711 + db * 0.31114694;
13534
- const delta = 0.5053 * y * y + 0.299 * i * i + 0.1957 * q * q;
13535
- return y > 0 ? -delta : delta;
13536
- }
13537
- function brightnessDelta(img, k, m, r1, g1, b1, a1, checkerboard) {
13538
- const r2 = img[m];
13539
- const g2 = img[m + 1];
13540
- const b2 = img[m + 2];
13541
- const a2 = img[m + 3];
13542
- let dr = r1 - r2;
13543
- let dg = g1 - g2;
13544
- let db = b1 - b2;
13545
- const da = a1 - a2;
13546
- if (!dr && !dg && !db && !da)
13547
- return 0;
13548
- if (a1 < 255 || a2 < 255) {
13549
- let rb = 255, gb = 255, bb = 255;
13550
- if (checkerboard) {
13551
- rb = 48 + 159 * (k % 2);
13552
- gb = 48 + 159 * ((k / 1.618033988749895 | 0) % 2);
13553
- bb = 48 + 159 * ((k / 2.618033988749895 | 0) % 2);
13554
- }
13555
- dr = (r1 * a1 - r2 * a2 - rb * da) / 255;
13556
- dg = (g1 * a1 - g2 * a2 - gb * da) / 255;
13557
- db = (b1 * a1 - b2 * a2 - bb * da) / 255;
13558
- }
13559
- return dr * 0.29889531 + dg * 0.58662247 + db * 0.11448223;
13560
- }
13561
- function drawPixel(output, pos, r, g, b) {
13562
- output[pos] = r;
13563
- output[pos + 1] = g;
13564
- output[pos + 2] = b;
13565
- output[pos + 3] = 255;
13566
- }
13567
- function drawGrayPixel(img, i, alpha, output) {
13568
- const val = 255 + (img[i] * 0.29889531 + img[i + 1] * 0.58662247 + img[i + 2] * 0.11448223 - 255) * alpha * img[i + 3] / 255;
13569
- drawPixel(output, i, val, val, val);
13570
- }
13571
-
13572
- // tools/test/src/visual/compare.ts
13573
- var import_pngjs = __toESM(require_png(), 1);
13574
- function compareImages(baselinePath, actualPath, diffPath, options = {}) {
13575
- const threshold = options.threshold ?? 0.1;
13576
- const mismatchRatio = options.mismatchRatio ?? 0.001;
13577
- const includeAA = options.includeAA ?? false;
13578
- const baseline = import_pngjs.PNG.sync.read(readFileSync(baselinePath));
13579
- const actual = import_pngjs.PNG.sync.read(readFileSync(actualPath));
13580
- if (baseline.width !== actual.width || baseline.height !== actual.height) {
13581
- throw new Error(`Image dimensions differ: baseline ${baseline.width}x${baseline.height}, actual ${actual.width}x${actual.height}`);
13582
- }
13583
- const { width, height } = baseline;
13584
- const diff = new import_pngjs.PNG({ width, height });
13585
- const diffPixels = pixelmatch(baseline.data, actual.data, diff.data, width, height, {
13586
- threshold,
13587
- includeAA
13588
- });
13589
- const totalPixels = width * height;
13590
- const ratio = diffPixels / totalPixels;
13591
- const match2 = ratio <= mismatchRatio;
13592
- let diffPngPath;
13593
- if (!match2) {
13594
- writeFileSync(diffPath, import_pngjs.PNG.sync.write(diff));
13595
- diffPngPath = diffPath;
13596
- }
13597
- return { match: match2, diffPixels, totalPixels, ratio, diffPngPath };
13598
- }
13599
- // tools/test/src/visual/harness.ts
13600
- var {existsSync, mkdirSync, writeFileSync: writeFileSync2} = (() => ({}));
13601
-
13602
13377
  // node:path
13378
+ var exports_path = {};
13379
+ __export(exports_path, {
13380
+ sep: () => sep,
13381
+ resolve: () => resolve,
13382
+ relative: () => relative,
13383
+ posix: () => posix,
13384
+ parse: () => parse,
13385
+ normalize: () => normalize,
13386
+ join: () => join,
13387
+ isAbsolute: () => isAbsolute,
13388
+ format: () => format2,
13389
+ extname: () => extname,
13390
+ dirname: () => dirname,
13391
+ delimiter: () => delimiter,
13392
+ default: () => path_default,
13393
+ basename: () => basename,
13394
+ _makeLong: () => _makeLong
13395
+ });
13603
13396
  function assertPath(path) {
13604
13397
  if (typeof path !== "string")
13605
13398
  throw TypeError("Path must be a string. Received " + JSON.stringify(path));
@@ -13915,11 +13708,237 @@ function parse(path) {
13915
13708
  ret.dir = "/";
13916
13709
  return ret;
13917
13710
  }
13918
- var sep = "/";
13919
- var delimiter = ":";
13920
- var posix = ((p) => (p.posix = p, p))({ resolve, normalize, isAbsolute, join, relative, _makeLong, dirname, basename, extname, format: format2, parse, sep, delimiter, win32: null, posix: null });
13711
+ var sep = "/", delimiter = ":", posix, path_default;
13712
+ var init_path = __esm(() => {
13713
+ posix = ((p) => (p.posix = p, p))({ resolve, normalize, isAbsolute, join, relative, _makeLong, dirname, basename, extname, format: format2, parse, sep, delimiter, win32: null, posix: null });
13714
+ path_default = posix;
13715
+ });
13716
+
13717
+ // tools/test/src/visual/compare.ts
13718
+ var {readFileSync, writeFileSync} = (() => ({}));
13719
+
13720
+ // node_modules/.bun/pixelmatch@7.2.0/node_modules/pixelmatch/index.js
13721
+ function pixelmatch(img1, img2, output, width, height, options = {}) {
13722
+ const {
13723
+ threshold = 0.1,
13724
+ alpha = 0.1,
13725
+ aaColor = [255, 255, 0],
13726
+ diffColor = [255, 0, 0],
13727
+ checkerboard = true,
13728
+ includeAA,
13729
+ diffColorAlt,
13730
+ diffMask
13731
+ } = options;
13732
+ if (!isPixelData(img1) || !isPixelData(img2) || output && !isPixelData(output))
13733
+ throw new Error("Image data: Uint8Array, Uint8ClampedArray or Buffer expected.");
13734
+ if (img1.length !== img2.length || output && output.length !== img1.length)
13735
+ throw new Error(`Image sizes do not match. Image 1 size: ${img1.length}, image 2 size: ${img2.length}`);
13736
+ if (img1.length !== width * height * 4)
13737
+ throw new Error(`Image data size does not match width/height. Expecting ${width * height * 4}. Got ${img1.length}`);
13738
+ const len = width * height;
13739
+ const a32 = new Uint32Array(img1.buffer, img1.byteOffset, len);
13740
+ const b32 = new Uint32Array(img2.buffer, img2.byteOffset, len);
13741
+ let identical = true;
13742
+ for (let i = 0;i < len; i++) {
13743
+ if (a32[i] !== b32[i]) {
13744
+ identical = false;
13745
+ break;
13746
+ }
13747
+ }
13748
+ if (identical) {
13749
+ if (output && !diffMask) {
13750
+ for (let i = 0, pos = 0;i < len; i++, pos += 4)
13751
+ drawGrayPixel(img1, pos, alpha, output);
13752
+ }
13753
+ return 0;
13754
+ }
13755
+ const maxDelta = 35215 * threshold * threshold;
13756
+ const [aaR, aaG, aaB] = aaColor;
13757
+ const [diffR, diffG, diffB] = diffColor;
13758
+ const [altR, altG, altB] = diffColorAlt || diffColor;
13759
+ let diff = 0;
13760
+ for (let i = 0, pos = 0;i < len; i++, pos += 4) {
13761
+ const delta = a32[i] === b32[i] ? 0 : colorDelta(img1, img2, pos, pos, checkerboard);
13762
+ if (Math.abs(delta) > maxDelta) {
13763
+ const x = i % width;
13764
+ const y = i / width | 0;
13765
+ const isExcludedAA = !includeAA && (antialiased(img1, x, y, width, height, a32, b32, checkerboard) || antialiased(img2, x, y, width, height, b32, a32, checkerboard));
13766
+ if (isExcludedAA) {
13767
+ if (output && !diffMask)
13768
+ drawPixel(output, pos, aaR, aaG, aaB);
13769
+ } else {
13770
+ if (output) {
13771
+ if (delta < 0) {
13772
+ drawPixel(output, pos, altR, altG, altB);
13773
+ } else {
13774
+ drawPixel(output, pos, diffR, diffG, diffB);
13775
+ }
13776
+ }
13777
+ diff++;
13778
+ }
13779
+ } else if (output && !diffMask) {
13780
+ drawGrayPixel(img1, pos, alpha, output);
13781
+ }
13782
+ }
13783
+ return diff;
13784
+ }
13785
+ function isPixelData(arr) {
13786
+ return ArrayBuffer.isView(arr) && arr.BYTES_PER_ELEMENT === 1;
13787
+ }
13788
+ function antialiased(img, x1, y1, width, height, a32, b32, checkerboard) {
13789
+ const x0 = Math.max(x1 - 1, 0);
13790
+ const y0 = Math.max(y1 - 1, 0);
13791
+ const x2 = Math.min(x1 + 1, width - 1);
13792
+ const y2 = Math.min(y1 + 1, height - 1);
13793
+ const pos4 = (y1 * width + x1) * 4;
13794
+ const cr = img[pos4];
13795
+ const cg = img[pos4 + 1];
13796
+ const cb = img[pos4 + 2];
13797
+ const ca = img[pos4 + 3];
13798
+ let zeroes = x1 === x0 || x1 === x2 || y1 === y0 || y1 === y2 ? 1 : 0;
13799
+ let min = 0;
13800
+ let max = 0;
13801
+ let minX = 0;
13802
+ let minY = 0;
13803
+ let maxX = 0;
13804
+ let maxY = 0;
13805
+ for (let x = x0;x <= x2; x++) {
13806
+ for (let y = y0;y <= y2; y++) {
13807
+ if (x === x1 && y === y1)
13808
+ continue;
13809
+ const delta = brightnessDelta(img, pos4, (y * width + x) * 4, cr, cg, cb, ca, checkerboard);
13810
+ if (delta === 0) {
13811
+ zeroes++;
13812
+ if (zeroes > 2)
13813
+ return false;
13814
+ } else if (delta < min) {
13815
+ min = delta;
13816
+ minX = x;
13817
+ minY = y;
13818
+ } else if (delta > max) {
13819
+ max = delta;
13820
+ maxX = x;
13821
+ maxY = y;
13822
+ }
13823
+ }
13824
+ }
13825
+ if (min === 0 || max === 0)
13826
+ return false;
13827
+ return hasManySiblings(a32, minX, minY, width, height) && hasManySiblings(b32, minX, minY, width, height) || hasManySiblings(a32, maxX, maxY, width, height) && hasManySiblings(b32, maxX, maxY, width, height);
13828
+ }
13829
+ function hasManySiblings(img, x1, y1, width, height) {
13830
+ const x0 = Math.max(x1 - 1, 0);
13831
+ const y0 = Math.max(y1 - 1, 0);
13832
+ const x2 = Math.min(x1 + 1, width - 1);
13833
+ const y2 = Math.min(y1 + 1, height - 1);
13834
+ const val = img[y1 * width + x1];
13835
+ let zeroes = x1 === x0 || x1 === x2 || y1 === y0 || y1 === y2 ? 1 : 0;
13836
+ for (let x = x0;x <= x2; x++) {
13837
+ for (let y = y0;y <= y2; y++) {
13838
+ if (x === x1 && y === y1)
13839
+ continue;
13840
+ zeroes += +(val === img[y * width + x]);
13841
+ if (zeroes > 2)
13842
+ return true;
13843
+ }
13844
+ }
13845
+ return false;
13846
+ }
13847
+ function colorDelta(img1, img2, k, m, checkerboard) {
13848
+ const r1 = img1[k];
13849
+ const g1 = img1[k + 1];
13850
+ const b1 = img1[k + 2];
13851
+ const a1 = img1[k + 3];
13852
+ const r2 = img2[m];
13853
+ const g2 = img2[m + 1];
13854
+ const b2 = img2[m + 2];
13855
+ const a2 = img2[m + 3];
13856
+ let dr = r1 - r2;
13857
+ let dg = g1 - g2;
13858
+ let db = b1 - b2;
13859
+ const da = a1 - a2;
13860
+ if (a1 < 255 || a2 < 255) {
13861
+ let rb = 255, gb = 255, bb = 255;
13862
+ if (checkerboard) {
13863
+ rb = 48 + 159 * (k % 2);
13864
+ gb = 48 + 159 * ((k / 1.618033988749895 | 0) % 2);
13865
+ bb = 48 + 159 * ((k / 2.618033988749895 | 0) % 2);
13866
+ }
13867
+ dr = (r1 * a1 - r2 * a2 - rb * da) / 255;
13868
+ dg = (g1 * a1 - g2 * a2 - gb * da) / 255;
13869
+ db = (b1 * a1 - b2 * a2 - bb * da) / 255;
13870
+ }
13871
+ const y = dr * 0.29889531 + dg * 0.58662247 + db * 0.11448223;
13872
+ const i = dr * 0.59597799 - dg * 0.2741761 - db * 0.32180189;
13873
+ const q = dr * 0.21147017 - dg * 0.52261711 + db * 0.31114694;
13874
+ const delta = 0.5053 * y * y + 0.299 * i * i + 0.1957 * q * q;
13875
+ return y > 0 ? -delta : delta;
13876
+ }
13877
+ function brightnessDelta(img, k, m, r1, g1, b1, a1, checkerboard) {
13878
+ const r2 = img[m];
13879
+ const g2 = img[m + 1];
13880
+ const b2 = img[m + 2];
13881
+ const a2 = img[m + 3];
13882
+ let dr = r1 - r2;
13883
+ let dg = g1 - g2;
13884
+ let db = b1 - b2;
13885
+ const da = a1 - a2;
13886
+ if (!dr && !dg && !db && !da)
13887
+ return 0;
13888
+ if (a1 < 255 || a2 < 255) {
13889
+ let rb = 255, gb = 255, bb = 255;
13890
+ if (checkerboard) {
13891
+ rb = 48 + 159 * (k % 2);
13892
+ gb = 48 + 159 * ((k / 1.618033988749895 | 0) % 2);
13893
+ bb = 48 + 159 * ((k / 2.618033988749895 | 0) % 2);
13894
+ }
13895
+ dr = (r1 * a1 - r2 * a2 - rb * da) / 255;
13896
+ dg = (g1 * a1 - g2 * a2 - gb * da) / 255;
13897
+ db = (b1 * a1 - b2 * a2 - bb * da) / 255;
13898
+ }
13899
+ return dr * 0.29889531 + dg * 0.58662247 + db * 0.11448223;
13900
+ }
13901
+ function drawPixel(output, pos, r, g, b) {
13902
+ output[pos] = r;
13903
+ output[pos + 1] = g;
13904
+ output[pos + 2] = b;
13905
+ output[pos + 3] = 255;
13906
+ }
13907
+ function drawGrayPixel(img, i, alpha, output) {
13908
+ const val = 255 + (img[i] * 0.29889531 + img[i + 1] * 0.58662247 + img[i + 2] * 0.11448223 - 255) * alpha * img[i + 3] / 255;
13909
+ drawPixel(output, i, val, val, val);
13910
+ }
13921
13911
 
13912
+ // tools/test/src/visual/compare.ts
13913
+ var import_pngjs = __toESM(require_png(), 1);
13914
+ function compareImages(baselinePath, actualPath, diffPath, options = {}) {
13915
+ const threshold = options.threshold ?? 0.1;
13916
+ const mismatchRatio = options.mismatchRatio ?? 0.001;
13917
+ const includeAA = options.includeAA ?? false;
13918
+ const baseline = import_pngjs.PNG.sync.read(readFileSync(baselinePath));
13919
+ const actual = import_pngjs.PNG.sync.read(readFileSync(actualPath));
13920
+ if (baseline.width !== actual.width || baseline.height !== actual.height) {
13921
+ throw new Error(`Image dimensions differ: baseline ${baseline.width}x${baseline.height}, actual ${actual.width}x${actual.height}`);
13922
+ }
13923
+ const { width, height } = baseline;
13924
+ const diff = new import_pngjs.PNG({ width, height });
13925
+ const diffPixels = pixelmatch(baseline.data, actual.data, diff.data, width, height, {
13926
+ threshold,
13927
+ includeAA
13928
+ });
13929
+ const totalPixels = width * height;
13930
+ const ratio = diffPixels / totalPixels;
13931
+ const match2 = ratio <= mismatchRatio;
13932
+ let diffPngPath;
13933
+ if (!match2) {
13934
+ writeFileSync(diffPath, import_pngjs.PNG.sync.write(diff));
13935
+ diffPngPath = diffPath;
13936
+ }
13937
+ return { match: match2, diffPixels, totalPixels, ratio, diffPngPath };
13938
+ }
13922
13939
  // tools/test/src/visual/harness.ts
13940
+ init_path();
13941
+ var {existsSync, mkdirSync, writeFileSync: writeFileSync2} = (() => ({}));
13923
13942
  var UPDATE_ENV = "POLLY_VISUAL_UPDATE";
13924
13943
  var CI_ENV = "CI";
13925
13944
  function isUpdateMode() {
@@ -14017,4 +14036,4 @@ export {
14017
14036
  assertSafeUpdateMode
14018
14037
  };
14019
14038
 
14020
- //# debugId=CD6C9BD84374D6F964756E2164756E21
14039
+ //# debugId=FE6BF93D8946345F64756E2164756E21