@testivai/witness 2.4.0 → 2.6.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.
- package/README.md +9 -2
- package/dist/baselines/store.d.ts +31 -0
- package/dist/baselines/store.d.ts.map +1 -1
- package/dist/baselines/store.js +38 -1
- package/dist/baselines/store.js.map +1 -1
- package/dist/bin/testivai.js +2 -0
- package/dist/bin/testivai.js.map +1 -1
- package/dist/capture/element-map.d.ts +23 -2
- package/dist/capture/element-map.d.ts.map +1 -1
- package/dist/capture/element-map.js +102 -4
- package/dist/capture/element-map.js.map +1 -1
- package/dist/capture/environment.d.ts +243 -0
- package/dist/capture/environment.d.ts.map +1 -0
- package/dist/capture/environment.js +403 -0
- package/dist/capture/environment.js.map +1 -0
- package/dist/capture/health-limits.d.ts +14 -0
- package/dist/capture/health-limits.d.ts.map +1 -0
- package/dist/capture/health-limits.js +17 -0
- package/dist/capture/health-limits.js.map +1 -0
- package/dist/capture/health.d.ts +124 -0
- package/dist/capture/health.d.ts.map +1 -0
- package/dist/capture/health.js +327 -0
- package/dist/capture/health.js.map +1 -0
- package/dist/capture/native-app.d.ts +77 -0
- package/dist/capture/native-app.d.ts.map +1 -0
- package/dist/capture/native-app.js +172 -0
- package/dist/capture/native-app.js.map +1 -0
- package/dist/capture/shard.d.ts +17 -0
- package/dist/capture/shard.d.ts.map +1 -1
- package/dist/capture/shard.js +8 -1
- package/dist/capture/shard.js.map +1 -1
- package/dist/commands/approve.d.ts.map +1 -1
- package/dist/commands/approve.js +20 -0
- package/dist/commands/approve.js.map +1 -1
- package/dist/commands/env.d.ts +37 -0
- package/dist/commands/env.d.ts.map +1 -0
- package/dist/commands/env.js +113 -0
- package/dist/commands/env.js.map +1 -0
- package/dist/commands/merge-captures.d.ts.map +1 -1
- package/dist/commands/merge-captures.js +10 -0
- package/dist/commands/merge-captures.js.map +1 -1
- package/dist/config/local-config.d.ts +27 -0
- package/dist/config/local-config.d.ts.map +1 -1
- package/dist/config/local-config.js +1 -0
- package/dist/config/local-config.js.map +1 -1
- package/dist/config/validate-config.d.ts.map +1 -1
- package/dist/config/validate-config.js +22 -0
- package/dist/config/validate-config.js.map +1 -1
- package/dist/diff/attribution.d.ts +16 -2
- package/dist/diff/attribution.d.ts.map +1 -1
- package/dist/diff/attribution.js +5 -4
- package/dist/diff/attribution.js.map +1 -1
- package/dist/diff/dom-diff.d.ts.map +1 -1
- package/dist/diff/dom-diff.js +7 -1
- package/dist/diff/dom-diff.js.map +1 -1
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -1
- package/dist/index.js.map +1 -1
- package/dist/report/anchor.d.ts +18 -0
- package/dist/report/anchor.d.ts.map +1 -0
- package/dist/report/anchor.js +51 -0
- package/dist/report/anchor.js.map +1 -0
- package/dist/report/compare.d.ts +18 -1
- package/dist/report/compare.d.ts.map +1 -1
- package/dist/report/compare.js +107 -16
- package/dist/report/compare.js.map +1 -1
- package/dist/report/environment.d.ts +101 -0
- package/dist/report/environment.d.ts.map +1 -0
- package/dist/report/environment.js +354 -0
- package/dist/report/environment.js.map +1 -0
- package/dist/report/generator.d.ts +20 -2
- package/dist/report/generator.d.ts.map +1 -1
- package/dist/report/generator.js +46 -6
- package/dist/report/generator.js.map +1 -1
- package/dist/report/health.d.ts +115 -0
- package/dist/report/health.d.ts.map +1 -0
- package/dist/report/health.js +279 -0
- package/dist/report/health.js.map +1 -0
- package/dist/report/index.d.ts +9 -2
- package/dist/report/index.d.ts.map +1 -1
- package/dist/report/index.js +25 -1
- package/dist/report/index.js.map +1 -1
- package/dist/report/results.d.ts +73 -1
- package/dist/report/results.d.ts.map +1 -1
- package/dist/report/shift-check.d.ts +40 -0
- package/dist/report/shift-check.d.ts.map +1 -0
- package/dist/report/shift-check.js +109 -0
- package/dist/report/shift-check.js.map +1 -0
- package/dist/report/template.d.ts +28 -1
- package/dist/report/template.d.ts.map +1 -1
- package/dist/report/template.js +179 -16
- package/dist/report/template.js.map +1 -1
- package/dist/report/thumbnail.d.ts +76 -0
- package/dist/report/thumbnail.d.ts.map +1 -0
- package/dist/report/thumbnail.js +166 -0
- package/dist/report/thumbnail.js.map +1 -0
- package/dist/report/validate.d.ts +53 -0
- package/dist/report/validate.d.ts.map +1 -0
- package/dist/report/validate.js +383 -0
- package/dist/report/validate.js.map +1 -0
- package/dist/standalone/run.d.ts +39 -1
- package/dist/standalone/run.d.ts.map +1 -1
- package/dist/standalone/run.js +142 -3
- package/dist/standalone/run.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/capture/environment.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoHH,kDAQC;AAGD,4BAYC;AAsBD,wDAyBC;AAUD,oDAiBC;AAuBD,0DA0BC;AAMD,0DAQC;AA2BD,4CAYC;AAuBD,0DAoBC;AAiBD,oDAaC;AAOD,0CAQC;AAkBD,oEAWC;AAGD,0DAMC;AAvbD,uCAAyB;AACzB,uCAAyB;AAkFzB;;;;GAIG;AACU,QAAA,eAAe,GAAG;IAC7B,6DAA6D;IAC7D,aAAa,EAAE,eAAe;IAC9B,sDAAsD;IACtD,oBAAoB,EAAE,sBAAsB;IAC5C,2DAA2D;IAC3D,kBAAkB,EAAE,oBAAoB;IACxC,+EAA+E;IAC/E,iBAAiB,EAAE,mBAAmB;IACtC,mDAAmD;IACnD,kBAAkB,EAAE,oBAAoB;IACxC,2FAA2F;IAC3F,aAAa,EAAE,eAAe;CACtB,CAAC;AAIE,QAAA,oBAAoB,GAAiC,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAEjG,+EAA+E;AAE/E;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,IAAY;IAC9C,MAAM,MAAM,GAA2B,EAAE,CAAC;IAC1C,KAAK,MAAM,IAAI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,KAAK,OAAO,EAAE,CAAC;IACpH,OAAO,GAAG,WAAW,KAAK,QAAQ,EAAE,CAAC;AACvC,CAAC;AAED,kFAAkF;AAClF,SAAgB,uBAAuB,CAAC,IAAY;IAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACrC,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC/C,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,IAAI,CAAC;IAC/C,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;AACtG,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The caps on what a capture's health record keeps. On their own so the
|
|
3
|
+
* report side (report/health.ts, bundled by the GitHub Action) can read them
|
|
4
|
+
* without pulling in the in-page probe.
|
|
5
|
+
*/
|
|
6
|
+
export declare const HEALTH_LIMITS: {
|
|
7
|
+
/** Entries kept per list. */
|
|
8
|
+
readonly list: 10;
|
|
9
|
+
/** Characters kept of a URL (host and path). */
|
|
10
|
+
readonly url: 200;
|
|
11
|
+
/** Longest family, weight, style or error text accepted. */
|
|
12
|
+
readonly text: 200;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=health-limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-limits.d.ts","sourceRoot":"","sources":["../../src/capture/health-limits.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,aAAa;IACxB,6BAA6B;;IAE7B,gDAAgD;;IAEhD,4DAA4D;;CAEpD,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HEALTH_LIMITS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The caps on what a capture's health record keeps. On their own so the
|
|
6
|
+
* report side (report/health.ts, bundled by the GitHub Action) can read them
|
|
7
|
+
* without pulling in the in-page probe.
|
|
8
|
+
*/
|
|
9
|
+
exports.HEALTH_LIMITS = {
|
|
10
|
+
/** Entries kept per list. */
|
|
11
|
+
list: 10,
|
|
12
|
+
/** Characters kept of a URL (host and path). */
|
|
13
|
+
url: 200,
|
|
14
|
+
/** Longest family, weight, style or error text accepted. */
|
|
15
|
+
text: 200,
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=health-limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health-limits.js","sourceRoot":"","sources":["../../src/capture/health-limits.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,aAAa,GAAG;IAC3B,6BAA6B;IAC7B,IAAI,EAAE,EAAE;IACR,gDAAgD;IAChD,GAAG,EAAE,GAAG;IACR,4DAA4D;IAC5D,IAAI,EAAE,GAAG;CACD,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Capture health — what failed to load when the page was captured.
|
|
3
|
+
*
|
|
4
|
+
* A web font that failed and fell back to a system font, or a stylesheet that
|
|
5
|
+
* answered 404, can leave the DOM identical and the computed styles matching:
|
|
6
|
+
* the style digest hashes the DECLARED font-family (STYLE_PROPS in
|
|
7
|
+
* capture/element-map.ts), not the font that rendered. The pixel diff is then
|
|
8
|
+
* a few glyphs spread over the page, the shape render noise takes, and used
|
|
9
|
+
* to read "likely render noise" and pass under noiseAutoPass. Recording what
|
|
10
|
+
* failed to load, per capture, lets the compare call it what it is: an
|
|
11
|
+
* unhealthy capture (report/health.ts words it).
|
|
12
|
+
*
|
|
13
|
+
* The probe is evaluated in the page AFTER the capture, so it sees what
|
|
14
|
+
* loaded. Adapters record its result as `health` in the capture's
|
|
15
|
+
* metadata.json (approving freezes it into the baseline's). An adapter that
|
|
16
|
+
* does not run the probe writes no `health`: that reads as "not checked",
|
|
17
|
+
* never as healthy or unhealthy.
|
|
18
|
+
*
|
|
19
|
+
* No Node dependencies: the GitHub Action bundles the validator.
|
|
20
|
+
*/
|
|
21
|
+
import { HEALTH_LIMITS } from './health-limits';
|
|
22
|
+
/** The request groups, by what was requested. */
|
|
23
|
+
export declare const RESOURCE_TYPES: readonly ["css", "font", "img", "script", "other"];
|
|
24
|
+
export type ResourceType = (typeof RESOURCE_TYPES)[number];
|
|
25
|
+
/** Requests of one type that failed: how many, and the first few. */
|
|
26
|
+
export interface ResourceFailures {
|
|
27
|
+
count: number;
|
|
28
|
+
/** Host and path (never the query string), and the HTTP status: 0 when the request failed without one (`error` says why). */
|
|
29
|
+
entries: Array<{
|
|
30
|
+
url: string;
|
|
31
|
+
status: number;
|
|
32
|
+
error?: string;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
export interface CaptureHealth {
|
|
36
|
+
fonts: {
|
|
37
|
+
/** document.fonts.status after the capture; 'unavailable' without the Font Loading API. */
|
|
38
|
+
status: 'loaded' | 'loading' | 'unavailable';
|
|
39
|
+
/** Every FontFace whose status is 'error' (the first HEALTH_LIMITS.list). */
|
|
40
|
+
failed: Array<{
|
|
41
|
+
family: string;
|
|
42
|
+
weight: string;
|
|
43
|
+
style: string;
|
|
44
|
+
}>;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* `<link rel=stylesheet>` elements that failed: no sheet (failed or blocked),
|
|
48
|
+
* or a request that answered 400 or more (Chromium gives a failed
|
|
49
|
+
* stylesheet an empty sheet, so a null sheet alone misses a 404).
|
|
50
|
+
*/
|
|
51
|
+
stylesheets: {
|
|
52
|
+
failed: number;
|
|
53
|
+
urls: string[];
|
|
54
|
+
};
|
|
55
|
+
/** `<img>` elements that finished without an image (complete, naturalWidth 0). */
|
|
56
|
+
images: {
|
|
57
|
+
broken: number;
|
|
58
|
+
urls: string[];
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Requests that answered 400 or more (Resource Timing responseStatus,
|
|
62
|
+
* Chromium 109+), by type; 'unavailable' when the browser does not report
|
|
63
|
+
* statuses. An adapter that watches the network adds what it saw
|
|
64
|
+
* (mergeResourceFailures), cross-origin requests included.
|
|
65
|
+
*/
|
|
66
|
+
resources: {
|
|
67
|
+
status: 'checked' | 'unavailable';
|
|
68
|
+
failed: Partial<Record<ResourceType, ResourceFailures>>;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
export { HEALTH_LIMITS };
|
|
72
|
+
/**
|
|
73
|
+
* One self-contained in-page expression (no imports, no closures, ES5) that
|
|
74
|
+
* reports what failed to load. Each part is read on its own, so one missing
|
|
75
|
+
* API never loses the rest; a part whose API is missing says 'unavailable'
|
|
76
|
+
* where it can, never "loaded". URLs are recorded as host and path only: a
|
|
77
|
+
* query string can carry tokens.
|
|
78
|
+
*
|
|
79
|
+
* A failed request is grouped by what it was: a fetch() or XHR is 'other'
|
|
80
|
+
* whatever its extension (the page never applied it); a request a <link>
|
|
81
|
+
* started is 'css' when a <link rel=stylesheet> names it, else by its
|
|
82
|
+
* extension (a 404 `<link rel=preload as=image>` is not a stylesheet); any
|
|
83
|
+
* other request by its extension, then by what started it.
|
|
84
|
+
*/
|
|
85
|
+
export declare const HEALTH_PROBE_EXPRESSION: string;
|
|
86
|
+
/**
|
|
87
|
+
* The favicon the browser asks the site root for by itself when the page
|
|
88
|
+
* names none: not an asset of the page, so its 404 is not recorded.
|
|
89
|
+
*/
|
|
90
|
+
export declare function isBrowserFaviconRequest(url: string): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* A URL as health records it: host and path, no scheme, query or fragment (a
|
|
93
|
+
* query string can carry tokens). A data: or blob: URL is named by its scheme
|
|
94
|
+
* only; anything that is not a URL is ''. Same rule as the probe's.
|
|
95
|
+
*/
|
|
96
|
+
export declare function hostPath(href: string): string;
|
|
97
|
+
/**
|
|
98
|
+
* Validate a health block: the probe's result, or `health` read back from a
|
|
99
|
+
* metadata.json or a results.json. Returns a normalized copy (unknown fields
|
|
100
|
+
* dropped, lists capped), or null for anything malformed: a block that cannot
|
|
101
|
+
* be trusted is "not checked", never healthy. Never throws.
|
|
102
|
+
*/
|
|
103
|
+
export declare function parseHealth(raw: unknown): CaptureHealth | null;
|
|
104
|
+
/** One failed request seen on the network: the full URL (recorded as host and path), its type and status (0 with `error` when there was no response). */
|
|
105
|
+
export interface ResourceFailure {
|
|
106
|
+
url: string;
|
|
107
|
+
type: ResourceType;
|
|
108
|
+
status: number;
|
|
109
|
+
error?: string;
|
|
110
|
+
}
|
|
111
|
+
/** A CDP Network resource type ("Stylesheet", "Font"…) as a probe group. */
|
|
112
|
+
export declare function resourceTypeFromCdp(type: string | undefined): ResourceType;
|
|
113
|
+
/**
|
|
114
|
+
* Add what an adapter saw on the network (failed requests, cross-origin ones
|
|
115
|
+
* included, which Resource Timing reports without a status) to a probe's
|
|
116
|
+
* result, in the same shape. A request already recorded is not counted again;
|
|
117
|
+
* a status replaces a failure recorded without one. The network's type is the
|
|
118
|
+
* request's destination, so a request the probe grouped by another type (an
|
|
119
|
+
* extensionless `<link rel=preload as=image>` reads 'other' in the page) moves
|
|
120
|
+
* to the network's. Watching the network means the requests were checked, so
|
|
121
|
+
* `resources.status` becomes 'checked'. Returns a new block.
|
|
122
|
+
*/
|
|
123
|
+
export declare function mergeResourceFailures(health: CaptureHealth, failures: ResourceFailure[]): CaptureHealth;
|
|
124
|
+
//# sourceMappingURL=health.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/capture/health.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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ACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAM5D;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ7C;AAuED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,GAAG,IAAI,CAM9D;AAID,yJAAyJ;AACzJ,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,YAAY,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,4EAA4E;AAC5E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,YAAY,CAa1E;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,eAAe,EAAE,GAAG,aAAa,CA8BvG"}
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Capture health — what failed to load when the page was captured.
|
|
4
|
+
*
|
|
5
|
+
* A web font that failed and fell back to a system font, or a stylesheet that
|
|
6
|
+
* answered 404, can leave the DOM identical and the computed styles matching:
|
|
7
|
+
* the style digest hashes the DECLARED font-family (STYLE_PROPS in
|
|
8
|
+
* capture/element-map.ts), not the font that rendered. The pixel diff is then
|
|
9
|
+
* a few glyphs spread over the page, the shape render noise takes, and used
|
|
10
|
+
* to read "likely render noise" and pass under noiseAutoPass. Recording what
|
|
11
|
+
* failed to load, per capture, lets the compare call it what it is: an
|
|
12
|
+
* unhealthy capture (report/health.ts words it).
|
|
13
|
+
*
|
|
14
|
+
* The probe is evaluated in the page AFTER the capture, so it sees what
|
|
15
|
+
* loaded. Adapters record its result as `health` in the capture's
|
|
16
|
+
* metadata.json (approving freezes it into the baseline's). An adapter that
|
|
17
|
+
* does not run the probe writes no `health`: that reads as "not checked",
|
|
18
|
+
* never as healthy or unhealthy.
|
|
19
|
+
*
|
|
20
|
+
* No Node dependencies: the GitHub Action bundles the validator.
|
|
21
|
+
*/
|
|
22
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
+
exports.HEALTH_PROBE_EXPRESSION = exports.HEALTH_LIMITS = exports.RESOURCE_TYPES = void 0;
|
|
24
|
+
exports.isBrowserFaviconRequest = isBrowserFaviconRequest;
|
|
25
|
+
exports.hostPath = hostPath;
|
|
26
|
+
exports.parseHealth = parseHealth;
|
|
27
|
+
exports.resourceTypeFromCdp = resourceTypeFromCdp;
|
|
28
|
+
exports.mergeResourceFailures = mergeResourceFailures;
|
|
29
|
+
const health_limits_1 = require("./health-limits");
|
|
30
|
+
Object.defineProperty(exports, "HEALTH_LIMITS", { enumerable: true, get: function () { return health_limits_1.HEALTH_LIMITS; } });
|
|
31
|
+
/** The request groups, by what was requested. */
|
|
32
|
+
exports.RESOURCE_TYPES = ['css', 'font', 'img', 'script', 'other'];
|
|
33
|
+
/**
|
|
34
|
+
* One self-contained in-page expression (no imports, no closures, ES5) that
|
|
35
|
+
* reports what failed to load. Each part is read on its own, so one missing
|
|
36
|
+
* API never loses the rest; a part whose API is missing says 'unavailable'
|
|
37
|
+
* where it can, never "loaded". URLs are recorded as host and path only: a
|
|
38
|
+
* query string can carry tokens.
|
|
39
|
+
*
|
|
40
|
+
* A failed request is grouped by what it was: a fetch() or XHR is 'other'
|
|
41
|
+
* whatever its extension (the page never applied it); a request a <link>
|
|
42
|
+
* started is 'css' when a <link rel=stylesheet> names it, else by its
|
|
43
|
+
* extension (a 404 `<link rel=preload as=image>` is not a stylesheet); any
|
|
44
|
+
* other request by its extension, then by what started it.
|
|
45
|
+
*/
|
|
46
|
+
exports.HEALTH_PROBE_EXPRESSION = `(function () {
|
|
47
|
+
var LIMIT = ${health_limits_1.HEALTH_LIMITS.list};
|
|
48
|
+
var MAX = ${health_limits_1.HEALTH_LIMITS.url};
|
|
49
|
+
var out = {};
|
|
50
|
+
var base;
|
|
51
|
+
try { base = document.baseURI || undefined; } catch (e) {}
|
|
52
|
+
function where(href) {
|
|
53
|
+
try {
|
|
54
|
+
var u = new URL(String(href), base);
|
|
55
|
+
if (u.protocol === 'http:' || u.protocol === 'https:' || u.protocol === 'file:') return (u.host + u.pathname).slice(0, MAX);
|
|
56
|
+
return u.protocol;
|
|
57
|
+
} catch (e) { return ''; }
|
|
58
|
+
}
|
|
59
|
+
var sheetHrefs = {};
|
|
60
|
+
function kindOf(url, initiator) {
|
|
61
|
+
if (initiator === 'fetch' || initiator === 'xmlhttprequest' || initiator === 'beacon') return 'other';
|
|
62
|
+
if (initiator === 'link' && sheetHrefs[url]) return 'css';
|
|
63
|
+
var m = /\\.([a-z0-9]+)$/i.exec(url);
|
|
64
|
+
var ext = m ? m[1].toLowerCase() : '';
|
|
65
|
+
if (/^(woff2?|ttf|otf|eot)$/.test(ext)) return 'font';
|
|
66
|
+
if (ext === 'css') return 'css';
|
|
67
|
+
if (/^(png|jpe?g|gif|webp|avif|svg|ico|bmp)$/.test(ext)) return 'img';
|
|
68
|
+
if (/^m?js$/.test(ext)) return 'script';
|
|
69
|
+
if (ext) return 'other';
|
|
70
|
+
if (initiator === 'img' || initiator === 'image' || initiator === 'input') return 'img';
|
|
71
|
+
if (initiator === 'script') return 'script';
|
|
72
|
+
return 'other';
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
var set = document.fonts;
|
|
76
|
+
if (set && typeof set.status === 'string' && typeof set.forEach === 'function') {
|
|
77
|
+
var faces = [];
|
|
78
|
+
set.forEach(function (face) {
|
|
79
|
+
if (face && face.status === 'error' && faces.length < LIMIT) {
|
|
80
|
+
faces.push({
|
|
81
|
+
family: String(face.family).replace(/^\\s*["']|["']\\s*$/g, '').slice(0, MAX),
|
|
82
|
+
weight: String(face.weight).slice(0, MAX),
|
|
83
|
+
style: String(face.style).slice(0, MAX)
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
out.fonts = { status: set.status === 'loaded' ? 'loaded' : 'loading', failed: faces };
|
|
88
|
+
} else {
|
|
89
|
+
out.fonts = { status: 'unavailable', failed: [] };
|
|
90
|
+
}
|
|
91
|
+
} catch (e) { out.fonts = { status: 'unavailable', failed: [] }; }
|
|
92
|
+
var statusByUrl = {};
|
|
93
|
+
try {
|
|
94
|
+
var timed = typeof performance !== 'undefined' && performance && typeof performance.getEntriesByType === 'function' ? performance.getEntriesByType('resource') : [];
|
|
95
|
+
for (var t = 0; t < timed.length; t++) {
|
|
96
|
+
if (typeof timed[t].responseStatus === 'number') statusByUrl[timed[t].name] = timed[t].responseStatus;
|
|
97
|
+
}
|
|
98
|
+
} catch (e) {}
|
|
99
|
+
try {
|
|
100
|
+
var links = document.querySelectorAll('link[rel]');
|
|
101
|
+
var sheetsFailed = 0, sheetUrls = [];
|
|
102
|
+
for (var i = 0; i < links.length; i++) {
|
|
103
|
+
var link = links[i];
|
|
104
|
+
var rel = ' ' + String(link.getAttribute('rel') || '').toLowerCase().replace(/\\s+/g, ' ') + ' ';
|
|
105
|
+
if (rel.indexOf(' stylesheet ') === -1) continue;
|
|
106
|
+
if (link.getAttribute('href')) sheetHrefs[where(link.href)] = true;
|
|
107
|
+
if (rel.indexOf(' alternate ') !== -1) continue;
|
|
108
|
+
if (link.disabled || !link.getAttribute('href')) continue;
|
|
109
|
+
if (!link.sheet || statusByUrl[link.href] >= 400) {
|
|
110
|
+
sheetsFailed++;
|
|
111
|
+
if (sheetUrls.length < LIMIT) sheetUrls.push(where(link.href));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
out.stylesheets = { failed: sheetsFailed, urls: sheetUrls };
|
|
115
|
+
} catch (e) {}
|
|
116
|
+
try {
|
|
117
|
+
var imgs = document.images, broken = 0, imageUrls = [];
|
|
118
|
+
for (var j = 0; j < imgs.length; j++) {
|
|
119
|
+
var img = imgs[j];
|
|
120
|
+
var src = img.currentSrc || img.src || '';
|
|
121
|
+
if (!src) continue;
|
|
122
|
+
if (img.complete && img.naturalWidth === 0) {
|
|
123
|
+
broken++;
|
|
124
|
+
if (imageUrls.length < LIMIT) imageUrls.push(where(src));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
out.images = { broken: broken, urls: imageUrls };
|
|
128
|
+
} catch (e) {}
|
|
129
|
+
try {
|
|
130
|
+
var timing = typeof PerformanceResourceTiming !== 'undefined' ? PerformanceResourceTiming : null;
|
|
131
|
+
var perf = typeof performance !== 'undefined' ? performance : null;
|
|
132
|
+
if (!timing || !timing.prototype || !('responseStatus' in timing.prototype) || !perf || typeof perf.getEntriesByType !== 'function') {
|
|
133
|
+
out.resources = { status: 'unavailable', failed: {} };
|
|
134
|
+
} else {
|
|
135
|
+
var failed = {}, seen = {};
|
|
136
|
+
var entries = perf.getEntriesByType('resource');
|
|
137
|
+
for (var k = 0; k < entries.length; k++) {
|
|
138
|
+
var entry = entries[k];
|
|
139
|
+
var status = entry.responseStatus;
|
|
140
|
+
if (typeof status !== 'number' || status < 400) continue;
|
|
141
|
+
var url = where(entry.name);
|
|
142
|
+
if (entry.initiatorType === 'other' && url.indexOf('/') === url.length - 12 && url.slice(-12) === '/favicon.ico') continue;
|
|
143
|
+
var type = kindOf(url, entry.initiatorType);
|
|
144
|
+
if (seen[type + ' ' + url]) continue;
|
|
145
|
+
seen[type + ' ' + url] = true;
|
|
146
|
+
var group = failed[type] || (failed[type] = { count: 0, entries: [] });
|
|
147
|
+
group.count++;
|
|
148
|
+
if (group.entries.length < LIMIT) group.entries.push({ url: url, status: status });
|
|
149
|
+
}
|
|
150
|
+
out.resources = { status: 'checked', failed: failed };
|
|
151
|
+
}
|
|
152
|
+
} catch (e) { out.resources = { status: 'unavailable', failed: {} }; }
|
|
153
|
+
return out;
|
|
154
|
+
})()`;
|
|
155
|
+
/**
|
|
156
|
+
* The favicon the browser asks the site root for by itself when the page
|
|
157
|
+
* names none: not an asset of the page, so its 404 is not recorded.
|
|
158
|
+
*/
|
|
159
|
+
function isBrowserFaviconRequest(url) {
|
|
160
|
+
try {
|
|
161
|
+
return new URL(url).pathname === '/favicon.ico';
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* A URL as health records it: host and path, no scheme, query or fragment (a
|
|
169
|
+
* query string can carry tokens). A data: or blob: URL is named by its scheme
|
|
170
|
+
* only; anything that is not a URL is ''. Same rule as the probe's.
|
|
171
|
+
*/
|
|
172
|
+
function hostPath(href) {
|
|
173
|
+
try {
|
|
174
|
+
const u = new URL(href);
|
|
175
|
+
if (u.protocol === 'http:' || u.protocol === 'https:' || u.protocol === 'file:')
|
|
176
|
+
return (u.host + u.pathname).slice(0, health_limits_1.HEALTH_LIMITS.url);
|
|
177
|
+
return u.protocol;
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
return '';
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// ── Validation ──────────────────────────────────────────────────────────────
|
|
184
|
+
class Malformed extends Error {
|
|
185
|
+
}
|
|
186
|
+
const isRecord = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
187
|
+
function record(v) {
|
|
188
|
+
if (!isRecord(v))
|
|
189
|
+
throw new Malformed();
|
|
190
|
+
return v;
|
|
191
|
+
}
|
|
192
|
+
function count(v) {
|
|
193
|
+
if (typeof v !== 'number' || !Number.isInteger(v) || v < 0)
|
|
194
|
+
throw new Malformed();
|
|
195
|
+
return v;
|
|
196
|
+
}
|
|
197
|
+
function text(v, max) {
|
|
198
|
+
if (typeof v !== 'string' || v.length > max)
|
|
199
|
+
throw new Malformed();
|
|
200
|
+
return v;
|
|
201
|
+
}
|
|
202
|
+
function oneOf(v, allowed) {
|
|
203
|
+
if (typeof v !== 'string' || !allowed.includes(v))
|
|
204
|
+
throw new Malformed();
|
|
205
|
+
return v;
|
|
206
|
+
}
|
|
207
|
+
/** A list, capped at HEALTH_LIMITS.list (longer lists are cut, not rejected). */
|
|
208
|
+
function list(v, item) {
|
|
209
|
+
if (!Array.isArray(v))
|
|
210
|
+
throw new Malformed();
|
|
211
|
+
return v.slice(0, health_limits_1.HEALTH_LIMITS.list).map(item);
|
|
212
|
+
}
|
|
213
|
+
function readFailures(v) {
|
|
214
|
+
const g = record(v);
|
|
215
|
+
return {
|
|
216
|
+
count: count(g.count),
|
|
217
|
+
entries: list(g.entries, (e) => {
|
|
218
|
+
const entry = record(e);
|
|
219
|
+
const out = { url: text(entry.url, health_limits_1.HEALTH_LIMITS.url), status: count(entry.status) };
|
|
220
|
+
if (entry.error !== undefined)
|
|
221
|
+
out.error = text(entry.error, health_limits_1.HEALTH_LIMITS.text);
|
|
222
|
+
return out;
|
|
223
|
+
}),
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
function readHealthBlock(raw) {
|
|
227
|
+
const h = record(raw);
|
|
228
|
+
const fonts = record(h.fonts);
|
|
229
|
+
const stylesheets = record(h.stylesheets);
|
|
230
|
+
const images = record(h.images);
|
|
231
|
+
const resources = record(h.resources);
|
|
232
|
+
const failed = {};
|
|
233
|
+
for (const [type, group] of Object.entries(record(resources.failed))) {
|
|
234
|
+
failed[oneOf(type, exports.RESOURCE_TYPES)] = readFailures(group);
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
fonts: {
|
|
238
|
+
status: oneOf(fonts.status, ['loaded', 'loading', 'unavailable']),
|
|
239
|
+
failed: list(fonts.failed, (f) => {
|
|
240
|
+
const face = record(f);
|
|
241
|
+
return { family: text(face.family, health_limits_1.HEALTH_LIMITS.text), weight: text(face.weight, health_limits_1.HEALTH_LIMITS.text), style: text(face.style, health_limits_1.HEALTH_LIMITS.text) };
|
|
242
|
+
}),
|
|
243
|
+
},
|
|
244
|
+
stylesheets: { failed: count(stylesheets.failed), urls: list(stylesheets.urls, (u) => text(u, health_limits_1.HEALTH_LIMITS.url)) },
|
|
245
|
+
images: { broken: count(images.broken), urls: list(images.urls, (u) => text(u, health_limits_1.HEALTH_LIMITS.url)) },
|
|
246
|
+
resources: { status: oneOf(resources.status, ['checked', 'unavailable']), failed },
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Validate a health block: the probe's result, or `health` read back from a
|
|
251
|
+
* metadata.json or a results.json. Returns a normalized copy (unknown fields
|
|
252
|
+
* dropped, lists capped), or null for anything malformed: a block that cannot
|
|
253
|
+
* be trusted is "not checked", never healthy. Never throws.
|
|
254
|
+
*/
|
|
255
|
+
function parseHealth(raw) {
|
|
256
|
+
try {
|
|
257
|
+
return readHealthBlock(raw);
|
|
258
|
+
}
|
|
259
|
+
catch {
|
|
260
|
+
return null;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
/** A CDP Network resource type ("Stylesheet", "Font"…) as a probe group. */
|
|
264
|
+
function resourceTypeFromCdp(type) {
|
|
265
|
+
switch (type) {
|
|
266
|
+
case 'Stylesheet':
|
|
267
|
+
return 'css';
|
|
268
|
+
case 'Font':
|
|
269
|
+
return 'font';
|
|
270
|
+
case 'Image':
|
|
271
|
+
return 'img';
|
|
272
|
+
case 'Script':
|
|
273
|
+
return 'script';
|
|
274
|
+
default:
|
|
275
|
+
return 'other';
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Add what an adapter saw on the network (failed requests, cross-origin ones
|
|
280
|
+
* included, which Resource Timing reports without a status) to a probe's
|
|
281
|
+
* result, in the same shape. A request already recorded is not counted again;
|
|
282
|
+
* a status replaces a failure recorded without one. The network's type is the
|
|
283
|
+
* request's destination, so a request the probe grouped by another type (an
|
|
284
|
+
* extensionless `<link rel=preload as=image>` reads 'other' in the page) moves
|
|
285
|
+
* to the network's. Watching the network means the requests were checked, so
|
|
286
|
+
* `resources.status` becomes 'checked'. Returns a new block.
|
|
287
|
+
*/
|
|
288
|
+
function mergeResourceFailures(health, failures) {
|
|
289
|
+
const failed = {};
|
|
290
|
+
for (const [type, group] of Object.entries(health.resources.failed)) {
|
|
291
|
+
failed[type] = { count: group.count, entries: group.entries.map((e) => ({ ...e })) };
|
|
292
|
+
}
|
|
293
|
+
for (const failure of failures) {
|
|
294
|
+
const url = hostPath(failure.url);
|
|
295
|
+
if (!url)
|
|
296
|
+
continue;
|
|
297
|
+
let entry = { url, status: failure.status };
|
|
298
|
+
if (failure.status === 0 && failure.error)
|
|
299
|
+
entry.error = failure.error.slice(0, health_limits_1.HEALTH_LIMITS.text);
|
|
300
|
+
for (const [type, other] of Object.entries(failed)) {
|
|
301
|
+
if (type === failure.type)
|
|
302
|
+
continue;
|
|
303
|
+
const at = other.entries.findIndex((e) => e.url === url);
|
|
304
|
+
if (at === -1)
|
|
305
|
+
continue;
|
|
306
|
+
const [moved] = other.entries.splice(at, 1);
|
|
307
|
+
other.count--;
|
|
308
|
+
if (other.count === 0)
|
|
309
|
+
delete failed[type];
|
|
310
|
+
if (failure.status === 0 && moved.status > 0)
|
|
311
|
+
entry = moved;
|
|
312
|
+
}
|
|
313
|
+
const group = failed[failure.type] ?? { count: 0, entries: [] };
|
|
314
|
+
failed[failure.type] = group;
|
|
315
|
+
const known = group.entries.findIndex((e) => e.url === url);
|
|
316
|
+
if (known !== -1) {
|
|
317
|
+
if (group.entries[known].status === 0 && failure.status > 0)
|
|
318
|
+
group.entries[known] = entry;
|
|
319
|
+
continue;
|
|
320
|
+
}
|
|
321
|
+
group.count++;
|
|
322
|
+
if (group.entries.length < health_limits_1.HEALTH_LIMITS.list)
|
|
323
|
+
group.entries.push(entry);
|
|
324
|
+
}
|
|
325
|
+
return { ...health, resources: { status: 'checked', failed } };
|
|
326
|
+
}
|
|
327
|
+
//# sourceMappingURL=health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../src/capture/health.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AAwKH,0DAMC;AAOD,4BA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,CAAC;QACD,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,6BAAa,CAAC,IAAI;YAAE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native app captures (experimental): what an Appium session's capabilities
|
|
3
|
+
* say about the device a native screen was captured on.
|
|
4
|
+
*
|
|
5
|
+
* A native screen has no page, so nothing is measured in it: the device, its
|
|
6
|
+
* OS, its screen and the status bar come from the capabilities. Appium answers
|
|
7
|
+
* a new session with unprefixed keys (`platformVersion`, `deviceModel`) and
|
|
8
|
+
* keeps what was asked for under `desired`; a session started with W3C keys
|
|
9
|
+
* has them prefixed (`appium:deviceName`). Every reader here accepts both.
|
|
10
|
+
* Whatever the capabilities do not say is left out, never guessed.
|
|
11
|
+
*
|
|
12
|
+
* The Android readings are what Appium 3.9 + UiAutomator2 8.7 returned on an
|
|
13
|
+
* Android 14 emulator; the iOS ones follow XCUITest's documented
|
|
14
|
+
* capabilities and are not verified on a simulator in this repository's CI.
|
|
15
|
+
*/
|
|
16
|
+
import { type CaptureEnvironment, type DeviceEnvironment, type HostEnvironment } from './environment';
|
|
17
|
+
/** android / ios, or null for anything else (a desktop browser, no capabilities). */
|
|
18
|
+
export declare function mobilePlatform(capabilities: unknown): 'android' | 'ios' | null;
|
|
19
|
+
/** Whether the session names a browser (a mobile or desktop browser session). */
|
|
20
|
+
export declare function namesBrowser(capabilities: unknown): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* An Appium session started on an app: Android or iOS, no browser, and an
|
|
23
|
+
* `app`, `appPackage` or `bundleId`. A mobile session that names neither is
|
|
24
|
+
* decided by its current context (the adapter asks).
|
|
25
|
+
*/
|
|
26
|
+
export declare function isNativeAppCapabilities(capabilities: unknown): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The device from the capabilities. The name is the one the session asked for:
|
|
29
|
+
* on Android, Appium puts the device serial (`emulator-5554`) in the
|
|
30
|
+
* deviceName it returns.
|
|
31
|
+
*/
|
|
32
|
+
export declare function nativeAppDevice(capabilities: unknown): DeviceEnvironment;
|
|
33
|
+
/**
|
|
34
|
+
* The snapshot key for a device, `<platform>-<device>-<osMajor>`: the model
|
|
35
|
+
* the device reports, else the name the session asked for, and the OS major
|
|
36
|
+
* version. A part the capabilities do not give is left out.
|
|
37
|
+
*/
|
|
38
|
+
export declare function nativeAppVariant(device: DeviceEnvironment): string;
|
|
39
|
+
/**
|
|
40
|
+
* The status bar's height in screenshot pixels from the session's
|
|
41
|
+
* capabilities (UiAutomator2 returns `viewportRect` and `statBarHeight`), or
|
|
42
|
+
* null. UiAutomator2 reads it once, when the session starts, from a resource
|
|
43
|
+
* of its own server app, so it can be short (63 px for a 136 px bar on an
|
|
44
|
+
* Android 14 emulator) and does not follow a rotation: on Android the
|
|
45
|
+
* adapters prefer the window manager's frame (`statusBarFromSystemBars`).
|
|
46
|
+
*/
|
|
47
|
+
export declare function statusBarFromCapabilities(capabilities: unknown): number | null;
|
|
48
|
+
/**
|
|
49
|
+
* The top of a viewport rectangle (`mobile: viewportRect`), or null. On
|
|
50
|
+
* UiAutomator2 its top is the session-start reading above; on XCUITest it is
|
|
51
|
+
* the iOS source.
|
|
52
|
+
*/
|
|
53
|
+
export declare function statusBarFromViewportRect(rect: unknown): number | null;
|
|
54
|
+
/**
|
|
55
|
+
* The bottom of the status bar's window frame in screenshot pixels, from
|
|
56
|
+
* Appium's Android `mobile: getSystemBars` (`{ statusBar: { visible, x, y,
|
|
57
|
+
* width, height }, navigationBar }`, read from the window manager when it is
|
|
58
|
+
* called), or null when the bar is not visible, the driver found none
|
|
59
|
+
* (it answers a zero frame), or the answer is not that shape.
|
|
60
|
+
*/
|
|
61
|
+
export declare function statusBarFromSystemBars(bars: unknown): number | null;
|
|
62
|
+
export interface AppiumEnvironmentInput {
|
|
63
|
+
capabilities: unknown;
|
|
64
|
+
adapter: CaptureEnvironment['adapter'];
|
|
65
|
+
framework: {
|
|
66
|
+
name: string;
|
|
67
|
+
version: string | null;
|
|
68
|
+
};
|
|
69
|
+
host?: HostEnvironment;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* The environment block of a native app capture: the machine the tests ran on
|
|
73
|
+
* (`os`), `browser.name: "native-app"` so every reader of the contract still
|
|
74
|
+
* reads it, the device, and the pixel ratio as the device scale.
|
|
75
|
+
*/
|
|
76
|
+
export declare function appiumEnvironment(input: AppiumEnvironmentInput): CaptureEnvironment;
|
|
77
|
+
//# sourceMappingURL=native-app.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-app.d.ts","sourceRoot":"","sources":["../../src/capture/native-app.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,KAAK,kBAAkB,EAEvB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AAuBvB,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,YAAY,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,GAAG,IAAI,CAI9E;AAED,iFAAiF;AACjF,wBAAgB,YAAY,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAG3D;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAItE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,OAAO,GAAG,iBAAiB,CAiBxE;AAWD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAQlE;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,OAAO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