screenci 0.0.71 → 0.0.73
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 +13 -13
- package/dist/cli.d.ts +14 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +257 -81
- package/dist/cli.js.map +1 -1
- package/dist/docs/manifest.d.ts +3 -3
- package/dist/docs/manifest.js +1 -1
- package/dist/docs/manifest.js.map +1 -1
- package/dist/docs/video-sources/installation.screenci.js +13 -12
- package/dist/docs/video-sources/installation.screenci.js.map +1 -1
- package/dist/docs/video-sources/landing.screenci.js +16 -9
- package/dist/docs/video-sources/landing.screenci.js.map +1 -1
- package/dist/docs/video-sources/public-urls.screenci.js +16 -9
- package/dist/docs/video-sources/public-urls.screenci.js.map +1 -1
- package/dist/docs/video-sources/studio.screenci.js +42 -27
- package/dist/docs/video-sources/studio.screenci.js.map +1 -1
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/dist/src/asset.d.ts +82 -51
- package/dist/src/asset.d.ts.map +1 -1
- package/dist/src/asset.js +93 -46
- package/dist/src/asset.js.map +1 -1
- package/dist/src/audio.d.ts +6 -24
- package/dist/src/audio.d.ts.map +1 -1
- package/dist/src/audio.js +10 -35
- package/dist/src/audio.js.map +1 -1
- package/dist/src/builder.d.ts +214 -0
- package/dist/src/builder.d.ts.map +1 -0
- package/dist/src/builder.js +212 -0
- package/dist/src/builder.js.map +1 -0
- package/dist/src/config.d.ts +1 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +13 -7
- package/dist/src/config.js.map +1 -1
- package/dist/src/cue.d.ts +40 -123
- package/dist/src/cue.d.ts.map +1 -1
- package/dist/src/cue.js +190 -30
- package/dist/src/cue.js.map +1 -1
- package/dist/src/defaults.d.ts +2 -2
- package/dist/src/defaults.d.ts.map +1 -1
- package/dist/src/defaults.js +2 -2
- package/dist/src/defaults.js.map +1 -1
- package/dist/src/events.d.ts +80 -15
- package/dist/src/events.d.ts.map +1 -1
- package/dist/src/events.js +72 -6
- package/dist/src/events.js.map +1 -1
- package/dist/src/init.d.ts.map +1 -1
- package/dist/src/init.js +80 -39
- package/dist/src/init.js.map +1 -1
- package/dist/src/locales.d.ts +19 -0
- package/dist/src/locales.d.ts.map +1 -0
- package/dist/src/locales.js +60 -0
- package/dist/src/locales.js.map +1 -0
- package/dist/src/localize.d.ts +135 -0
- package/dist/src/localize.d.ts.map +1 -0
- package/dist/src/localize.js +195 -0
- package/dist/src/localize.js.map +1 -0
- package/dist/src/localizeRuntime.d.ts +53 -0
- package/dist/src/localizeRuntime.d.ts.map +1 -0
- package/dist/src/localizeRuntime.js +79 -0
- package/dist/src/localizeRuntime.js.map +1 -0
- package/dist/src/mouse.d.ts.map +1 -1
- package/dist/src/mouse.js +6 -0
- package/dist/src/mouse.js.map +1 -1
- package/dist/src/recordingData.d.ts +5 -4
- package/dist/src/recordingData.d.ts.map +1 -1
- package/dist/src/runtimeContext.d.ts +22 -4
- package/dist/src/runtimeContext.d.ts.map +1 -1
- package/dist/src/runtimeContext.js +11 -0
- package/dist/src/runtimeContext.js.map +1 -1
- package/dist/src/runtimeMode.d.ts +47 -0
- package/dist/src/runtimeMode.d.ts.map +1 -1
- package/dist/src/runtimeMode.js +124 -0
- package/dist/src/runtimeMode.js.map +1 -1
- package/dist/src/screenshot.d.ts +56 -2
- package/dist/src/screenshot.d.ts.map +1 -1
- package/dist/src/screenshot.js +49 -10
- package/dist/src/screenshot.js.map +1 -1
- package/dist/src/stillCapture.d.ts +10 -4
- package/dist/src/stillCapture.d.ts.map +1 -1
- package/dist/src/stillCapture.js +11 -0
- package/dist/src/stillCapture.js.map +1 -1
- package/dist/src/studio.d.ts +55 -22
- package/dist/src/studio.d.ts.map +1 -1
- package/dist/src/studio.js +38 -12
- package/dist/src/studio.js.map +1 -1
- package/dist/src/types.d.ts +20 -7
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/video.d.ts +149 -13
- package/dist/src/video.d.ts.map +1 -1
- package/dist/src/video.js +98 -25
- package/dist/src/video.js.map +1 -1
- package/dist/src/voiceConfig.d.ts +110 -0
- package/dist/src/voiceConfig.d.ts.map +1 -0
- package/dist/src/voiceConfig.js +2 -0
- package/dist/src/voiceConfig.js.map +1 -0
- package/dist/src/voices.d.ts +27 -23
- package/dist/src/voices.d.ts.map +1 -1
- package/dist/src/voices.js +7 -4
- package/dist/src/voices.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/skills/screenci/SKILL.md +51 -47
- package/skills/screenci/references/init.md +1 -1
- package/skills/screenci/references/record.md +6 -6
- package/dist/docs/video-sources/product-pitch.screenci.d.ts +0 -2
- package/dist/docs/video-sources/product-pitch.screenci.d.ts.map +0 -1
- package/dist/docs/video-sources/product-pitch.screenci.js +0 -136
- package/dist/docs/video-sources/product-pitch.screenci.js.map +0 -1
package/dist/src/runtimeMode.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export const SCREENCI_RECORDING_ENV = 'SCREENCI_RECORDING';
|
|
2
2
|
export const SCREENCI_MOCK_RECORD_ENV = 'SCREENCI_MOCK_RECORD';
|
|
3
|
+
export const SCREENCI_LANGUAGES_ENV = 'SCREENCI_LANGUAGES';
|
|
4
|
+
export const SCREENCI_TEXT_OVERRIDES_ENV = 'SCREENCI_TEXT_OVERRIDES';
|
|
5
|
+
export const SCREENCI_RECORD_OPTIONS_ENV = 'SCREENCI_RECORD_OPTIONS';
|
|
3
6
|
export const SCREENCI_DISABLE_RECORDING_TIMINGS_ENV = 'SCREENCI_DISABLE_RECORDING_TIMINGS';
|
|
4
7
|
export const SCREENCI_DEBUG_TIMING_ENV = 'SCREENCI_DEBUG_TIMING';
|
|
5
8
|
/**
|
|
@@ -29,4 +32,125 @@ export function shouldSimulateRecordingTimings(env = process.env) {
|
|
|
29
32
|
export function resolveRecordingTimingDuration(durationMs, env = process.env) {
|
|
30
33
|
return shouldSimulateRecordingTimings(env) ? durationMs : 0;
|
|
31
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* Parse the comma-separated language filter set by `screenci record
|
|
37
|
+
* --languages fi,en`. Returns `null` when unset or empty (meaning "record every
|
|
38
|
+
* declared language"); otherwise the trimmed, de-duplicated list in the order
|
|
39
|
+
* given. The per-language builder intersects this with each video's declared
|
|
40
|
+
* languages so a run never records or renders more than was asked for.
|
|
41
|
+
*/
|
|
42
|
+
export function parseRequestedLanguages(env = process.env) {
|
|
43
|
+
const raw = env[SCREENCI_LANGUAGES_ENV];
|
|
44
|
+
if (raw === undefined)
|
|
45
|
+
return null;
|
|
46
|
+
const seen = new Set();
|
|
47
|
+
const languages = [];
|
|
48
|
+
for (const part of raw.split(',')) {
|
|
49
|
+
const trimmed = part.trim();
|
|
50
|
+
if (trimmed.length === 0 || seen.has(trimmed))
|
|
51
|
+
continue;
|
|
52
|
+
seen.add(trimmed);
|
|
53
|
+
languages.push(trimmed);
|
|
54
|
+
}
|
|
55
|
+
return languages.length > 0 ? languages : null;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Parse Studio text-field overrides injected for a re-record. Because the
|
|
59
|
+
* recording process never reaches the backend, Studio edits are passed in via
|
|
60
|
+
* `SCREENCI_TEXT_OVERRIDES` (a JSON map of language -> field -> value), set by
|
|
61
|
+
* the CLI from the backend before the recording runs. Returns `null` when unset
|
|
62
|
+
* or malformed, so the `text` fixture falls back to the code-declared seed.
|
|
63
|
+
*/
|
|
64
|
+
export function parseTextOverrides(env = process.env) {
|
|
65
|
+
const raw = env[SCREENCI_TEXT_OVERRIDES_ENV];
|
|
66
|
+
if (raw === undefined || raw.trim().length === 0)
|
|
67
|
+
return null;
|
|
68
|
+
try {
|
|
69
|
+
const parsed = JSON.parse(raw);
|
|
70
|
+
if (typeof parsed !== 'object' || parsed === null)
|
|
71
|
+
return null;
|
|
72
|
+
const result = {};
|
|
73
|
+
for (const [language, fields] of Object.entries(parsed)) {
|
|
74
|
+
if (typeof fields !== 'object' || fields === null)
|
|
75
|
+
continue;
|
|
76
|
+
const perLanguage = {};
|
|
77
|
+
for (const [field, value] of Object.entries(fields)) {
|
|
78
|
+
if (typeof value === 'string')
|
|
79
|
+
perLanguage[field] = value;
|
|
80
|
+
}
|
|
81
|
+
result[language] = perLanguage;
|
|
82
|
+
}
|
|
83
|
+
return result;
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const VALID_ASPECT_RATIOS = new Set([
|
|
90
|
+
'16:9',
|
|
91
|
+
'9:16',
|
|
92
|
+
'1:1',
|
|
93
|
+
'4:3',
|
|
94
|
+
'3:4',
|
|
95
|
+
'5:4',
|
|
96
|
+
'4:5',
|
|
97
|
+
]);
|
|
98
|
+
const VALID_QUALITIES = new Set(['720p', '1080p', '1440p', '2160p']);
|
|
99
|
+
const VALID_FPS = new Set([24, 30, 60]);
|
|
100
|
+
/**
|
|
101
|
+
* Parse Studio record-option overrides injected for a re-record. Record options
|
|
102
|
+
* (aspect ratio, quality, fps) change the captured viewport/encode, so Studio
|
|
103
|
+
* edits are fetched by the CLI before recording and passed in via
|
|
104
|
+
* `SCREENCI_RECORD_OPTIONS` (a JSON map of video name -> options). Returns `null`
|
|
105
|
+
* when unset or malformed, so the `recordOptions` fixture keeps the code values.
|
|
106
|
+
* Unknown fields/values are dropped.
|
|
107
|
+
*/
|
|
108
|
+
export function parseRecordOptions(env = process.env) {
|
|
109
|
+
const raw = env[SCREENCI_RECORD_OPTIONS_ENV];
|
|
110
|
+
if (raw === undefined || raw.trim().length === 0)
|
|
111
|
+
return null;
|
|
112
|
+
try {
|
|
113
|
+
const parsed = JSON.parse(raw);
|
|
114
|
+
if (typeof parsed !== 'object' || parsed === null)
|
|
115
|
+
return null;
|
|
116
|
+
const result = {};
|
|
117
|
+
for (const [videoName, options] of Object.entries(parsed)) {
|
|
118
|
+
if (typeof options !== 'object' || options === null)
|
|
119
|
+
continue;
|
|
120
|
+
const o = options;
|
|
121
|
+
const entry = {};
|
|
122
|
+
if (VALID_ASPECT_RATIOS.has(o.aspectRatio)) {
|
|
123
|
+
entry.aspectRatio = o.aspectRatio;
|
|
124
|
+
}
|
|
125
|
+
if (VALID_QUALITIES.has(o.quality)) {
|
|
126
|
+
entry.quality = o.quality;
|
|
127
|
+
}
|
|
128
|
+
if (typeof o.fps === 'number' && VALID_FPS.has(o.fps)) {
|
|
129
|
+
entry.fps = o.fps;
|
|
130
|
+
}
|
|
131
|
+
result[videoName] = entry;
|
|
132
|
+
}
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Merge Studio record-option overrides over the code-declared record options.
|
|
141
|
+
* Only the Studio-owned fields (aspect ratio, quality, fps) are overridden; the
|
|
142
|
+
* rest (encoder, performance, deviceScaleFactor) stay from code. Pure.
|
|
143
|
+
*/
|
|
144
|
+
export function mergeStudioRecordOptions(codeRecordOptions, studio) {
|
|
145
|
+
if (studio === undefined)
|
|
146
|
+
return codeRecordOptions;
|
|
147
|
+
return {
|
|
148
|
+
...codeRecordOptions,
|
|
149
|
+
...(studio.aspectRatio !== undefined && {
|
|
150
|
+
aspectRatio: studio.aspectRatio,
|
|
151
|
+
}),
|
|
152
|
+
...(studio.quality !== undefined && { quality: studio.quality }),
|
|
153
|
+
...(studio.fps !== undefined && { fps: studio.fps }),
|
|
154
|
+
};
|
|
155
|
+
}
|
|
32
156
|
//# sourceMappingURL=runtimeMode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeMode.js","sourceRoot":"","sources":["../../src/runtimeMode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtimeMode.js","sourceRoot":"","sources":["../../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B,GAAG,CAAC,MAAM,CAAC,WAAW,KAAK,SAAS,IAAI;YACtC,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAC;QACF,GAAG,CAAC,MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC;QAChE,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,SAAS,IAAI,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC;KACrD,CAAA;AACH,CAAC"}
|
package/dist/src/screenshot.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { TestType, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, TestDetails, TestInfo } from '@playwright/test';
|
|
2
2
|
import type { RecordOptions, RenderOptions, ScreenCIPage } from './types.js';
|
|
3
|
-
import type {
|
|
3
|
+
import type { StudioDeclaration } from './studio.js';
|
|
4
|
+
import { type OverlayController } from './asset.js';
|
|
4
5
|
import type { CropTarget, CropOptions } from './crop.js';
|
|
6
|
+
import type { VideoBuilder } from './builder.js';
|
|
7
|
+
import type { NormalizedLocalize } from './localize.js';
|
|
8
|
+
import { type TextValues } from './localizeRuntime.js';
|
|
5
9
|
/**
|
|
6
10
|
* The `crop` fixture argument. Call it inside a `screenshot()` body to crop the
|
|
7
11
|
* implicit end-of-body capture to a locator or pixel region. Replaces the
|
|
@@ -10,10 +14,42 @@ import type { CropTarget, CropOptions } from './crop.js';
|
|
|
10
14
|
export type CropFixture = (target: CropTarget, options?: CropOptions) => Promise<void>;
|
|
11
15
|
type ScreenshotFixtureOptions = {
|
|
12
16
|
recordOptions: RecordOptions;
|
|
13
|
-
renderOptions: RenderOptions |
|
|
17
|
+
renderOptions: RenderOptions | undefined;
|
|
18
|
+
/** Active language for this pass; see {@link video} for details. Internal. */
|
|
19
|
+
_screenciLanguage: string | undefined;
|
|
20
|
+
/** Grouping name written to `metadata.videoName`. Internal. */
|
|
21
|
+
_screenciVideoName: string | undefined;
|
|
22
|
+
/** The normalized localize spec, set by `screenshot.localize(...)`. Internal. */
|
|
23
|
+
_screenciLocalize: NormalizedLocalize | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* The studio declaration, set by `screenshot.studio(...)`. Drives the
|
|
26
|
+
* render/record deferral flags and the Studio-managed `text` and `overlays`
|
|
27
|
+
* fixtures. A still is silent, so narration/audio declarations are ignored.
|
|
28
|
+
* Internal.
|
|
29
|
+
*/
|
|
30
|
+
_screenciStudio: StudioDeclaration | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Absolute path of the `.screenci` script that registered this test, captured
|
|
33
|
+
* by the fan-out builder. Asset paths are resolved relative to it, since
|
|
34
|
+
* `testInfo.file` points at the builder module, not the script. Internal.
|
|
35
|
+
*/
|
|
36
|
+
_screenciSourceFile: string | undefined;
|
|
14
37
|
};
|
|
15
38
|
type ScreenshotFixtures = {
|
|
16
39
|
crop: CropFixture;
|
|
40
|
+
/** The language being captured in this pass; `undefined` outside per-language mode. */
|
|
41
|
+
language: string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Injected text field values for the active language, keyed by the field names
|
|
44
|
+
* declared in `screenshot.localize(...)`. A still is silent, so there is no
|
|
45
|
+
* `narration` fixture.
|
|
46
|
+
*/
|
|
47
|
+
text: TextValues;
|
|
48
|
+
/**
|
|
49
|
+
* Overlay controllers for the Studio-managed overlay names declared in
|
|
50
|
+
* `screenshot.studio({ overlays: [...] })`. Empty when none are declared.
|
|
51
|
+
*/
|
|
52
|
+
overlays: Record<string, OverlayController>;
|
|
17
53
|
};
|
|
18
54
|
type ScreenshotType = TestType<PlaywrightTestArgs & PlaywrightTestOptions & ScreenshotFixtureOptions & ScreenshotFixtures & PlaywrightWorkerArgs & PlaywrightWorkerOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
|
|
19
55
|
type ScreenshotArgs = Omit<PlaywrightTestArgs, 'page'> & {
|
|
@@ -60,6 +96,24 @@ interface Screenshot extends ScreenshotCallSignatures {
|
|
|
60
96
|
fixme: Screenshot & ConditionalOverloads;
|
|
61
97
|
fail: Screenshot & ConditionalOverloads;
|
|
62
98
|
slow: Screenshot & ((condition?: boolean, description?: string) => void);
|
|
99
|
+
/**
|
|
100
|
+
* Capture one localized screenshot per declared language. By default each
|
|
101
|
+
* language is captured in its own pass with the browser `locale` set from the
|
|
102
|
+
* language, and the body receives the active `language` and `text` values.
|
|
103
|
+
* Chainable with `.each(...)`.
|
|
104
|
+
*/
|
|
105
|
+
localize: VideoBuilder<ScreenshotArgs>['localize'];
|
|
106
|
+
/**
|
|
107
|
+
* Defer render/record options and declare Studio-managed text and overlays,
|
|
108
|
+
* configured in the ScreenCI web app. Stills are silent, so narration and
|
|
109
|
+
* audio declarations are ignored. Chainable with `.localize(...)` / `.each(...)`.
|
|
110
|
+
*/
|
|
111
|
+
studio: VideoBuilder<ScreenshotArgs>['studio'];
|
|
112
|
+
/**
|
|
113
|
+
* Produce a separate screenshot per variant (viewport, theme, ...). Each
|
|
114
|
+
* variant has its own identity and history. Chainable with `.languages(...)`.
|
|
115
|
+
*/
|
|
116
|
+
each: VideoBuilder<ScreenshotArgs>['each'];
|
|
63
117
|
beforeEach(inner: (args: ScreenshotArgs, testInfo: TestInfo) => Promise<void> | void): void;
|
|
64
118
|
beforeEach(title: string, inner: (args: ScreenshotArgs, testInfo: TestInfo) => Promise<void> | void): void;
|
|
65
119
|
afterEach(inner: (args: ScreenshotArgs, testInfo: TestInfo) => Promise<void> | void): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../src/screenshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,QAAQ,EACR,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,WAAW,EACX,QAAQ,EACT,MAAM,kBAAkB,CAAA;AAGzB,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,E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,cAAc,CAAC,WAAW,CAAC,CAAA;IACtC,QAAQ,EAAE,cAAc,CAAC,UAAU,CAAC,CAAA;IACpC,GAAG,EAAE,cAAc,CAAC,KAAK,CAAC,CAAA;IAC1B,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;IAChC,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IAC5B,IAAI,EAAE,cAAc,CAAC,MAAM,CAAC,CAAA;IAC5B,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAA;IAChC,UAAU,EAAE,cAAc,CAAC,YAAY,CAAC,CAAA;CACzC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,UAAU,EAAiC,UAAU,CAAA"}
|
package/dist/src/screenshot.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { test as base } from '@playwright/test';
|
|
2
2
|
import { mkdir, rm } from 'fs/promises';
|
|
3
3
|
import { join, relative } from 'path';
|
|
4
|
+
import { studioOptionFlags } from './studio.js';
|
|
5
|
+
import { buildStudioOverlays } from './asset.js';
|
|
4
6
|
import { getDimensions } from './dimensions.js';
|
|
5
7
|
import { DEFAULT_VIDEO_OPTIONS, DEFAULT_ASPECT_RATIO, DEFAULT_QUALITY, DEFAULT_SCREENSHOT_DEVICE_SCALE_FACTOR, } from './defaults.js';
|
|
6
8
|
import { EventRecorder } from './events.js';
|
|
@@ -12,12 +14,29 @@ import { buildScreenCIContextOptions, resolveDeviceScaleFactor, } from './contex
|
|
|
12
14
|
import { resolveCrop } from './crop.js';
|
|
13
15
|
import { getRuntimePage, setRuntimeCrop } from './runtimeContext.js';
|
|
14
16
|
import { ScreenciError } from './errors.js';
|
|
15
|
-
import { withActiveRecordingContext } from './video.js';
|
|
17
|
+
import { withActiveRecordingContext, resolveEffectiveRecordOptions, } from './video.js';
|
|
18
|
+
import { createVideoBuilder } from './builder.js';
|
|
19
|
+
import { buildTextDeclaration, buildTextValues, } from './localizeRuntime.js';
|
|
20
|
+
import { parseTextOverrides } from './runtimeMode.js';
|
|
16
21
|
/** File name of the raw page capture written beside `data.json`. */
|
|
17
22
|
const SCREENSHOT_FILE_NAME = 'screenshot.png';
|
|
18
23
|
const _screenshotBase = base.extend({
|
|
19
24
|
recordOptions: [DEFAULT_VIDEO_OPTIONS, { option: true }],
|
|
20
25
|
renderOptions: [undefined, { option: true }],
|
|
26
|
+
_screenciLanguage: [undefined, { option: true }],
|
|
27
|
+
_screenciVideoName: [undefined, { option: true }],
|
|
28
|
+
_screenciLocalize: [undefined, { option: true }],
|
|
29
|
+
_screenciStudio: [undefined, { option: true }],
|
|
30
|
+
_screenciSourceFile: [undefined, { option: true }],
|
|
31
|
+
language: async ({ _screenciLanguage }, use) => {
|
|
32
|
+
await use(_screenciLanguage);
|
|
33
|
+
},
|
|
34
|
+
text: async ({ _screenciLocalize, _screenciStudio, _screenciLanguage }, use) => {
|
|
35
|
+
await use(buildTextValues(_screenciLocalize, _screenciLanguage, parseTextOverrides(), _screenciStudio?.text ?? []));
|
|
36
|
+
},
|
|
37
|
+
overlays: async ({ _screenciStudio }, use) => {
|
|
38
|
+
await use(buildStudioOverlays(_screenciStudio?.overlays ?? []));
|
|
39
|
+
},
|
|
21
40
|
crop: async ({}, use) => {
|
|
22
41
|
await use(async (target, options) => {
|
|
23
42
|
const page = getRuntimePage();
|
|
@@ -37,16 +56,17 @@ const _screenshotBase = base.extend({
|
|
|
37
56
|
await browser.close();
|
|
38
57
|
}
|
|
39
58
|
},
|
|
40
|
-
context: async ({ browser, recordOptions, colorScheme, locale, timezoneId, userAgent, geolocation, permissions, extraHTTPHeaders, httpCredentials, ignoreHTTPSErrors, offline, storageState, baseURL, bypassCSP, acceptDownloads, javaScriptEnabled, hasTouch, isMobile, deviceScaleFactor, }, use) => {
|
|
41
|
-
const
|
|
42
|
-
const
|
|
59
|
+
context: async ({ browser, recordOptions, _screenciStudio, _screenciVideoName, colorScheme, locale, timezoneId, userAgent, geolocation, permissions, extraHTTPHeaders, httpCredentials, ignoreHTTPSErrors, offline, storageState, baseURL, bypassCSP, acceptDownloads, javaScriptEnabled, hasTouch, isMobile, deviceScaleFactor, }, use, testInfo) => {
|
|
60
|
+
const effectiveRecordOptions = resolveEffectiveRecordOptions(recordOptions, _screenciStudio, _screenciVideoName ?? testInfo.title);
|
|
61
|
+
const aspectRatio = effectiveRecordOptions.aspectRatio ?? DEFAULT_ASPECT_RATIO;
|
|
62
|
+
const quality = effectiveRecordOptions.quality ?? DEFAULT_QUALITY;
|
|
43
63
|
const dimensions = getDimensions(aspectRatio, quality);
|
|
44
64
|
const shouldRecord = process.env.SCREENCI_RECORDING === 'true';
|
|
45
65
|
// Screenshots honor deviceScaleFactor for higher-DPI stills.
|
|
46
66
|
const context = await browser.newContext(buildScreenCIContextOptions({
|
|
47
67
|
dimensions,
|
|
48
68
|
applyLocaleDefault: shouldRecord,
|
|
49
|
-
deviceScaleFactor: resolveDeviceScaleFactor(
|
|
69
|
+
deviceScaleFactor: resolveDeviceScaleFactor(effectiveRecordOptions, deviceScaleFactor, DEFAULT_SCREENSHOT_DEVICE_SCALE_FACTOR),
|
|
50
70
|
forwarded: {
|
|
51
71
|
colorScheme,
|
|
52
72
|
locale,
|
|
@@ -75,16 +95,27 @@ const _screenshotBase = base.extend({
|
|
|
75
95
|
await context.close();
|
|
76
96
|
}
|
|
77
97
|
},
|
|
78
|
-
page: async ({ context, recordOptions, renderOptions, deviceScaleFactor }, use, testInfo) => {
|
|
98
|
+
page: async ({ context, recordOptions: codeRecordOptions, renderOptions, deviceScaleFactor, _screenciLanguage, _screenciLocalize, _screenciStudio, _screenciVideoName, _screenciSourceFile, }, use, testInfo) => {
|
|
79
99
|
const shouldRecord = process.env.SCREENCI_RECORDING === 'true';
|
|
80
|
-
const
|
|
100
|
+
const recordOptions = resolveEffectiveRecordOptions(codeRecordOptions, _screenciStudio, _screenciVideoName ?? testInfo.title);
|
|
101
|
+
const recorder = new EventRecorder(renderOptions, recordOptions, studioOptionFlags(_screenciStudio));
|
|
102
|
+
recorder.setActiveLanguage(_screenciLanguage ?? null);
|
|
103
|
+
// Declared `text` fields (and the active language's seeds) emitted once at
|
|
104
|
+
// recording start so the backend/Studio learn them.
|
|
105
|
+
const textDeclaration = buildTextDeclaration(_screenciLocalize, _screenciLanguage, _screenciStudio?.text ?? []);
|
|
106
|
+
const videoName = _screenciVideoName ?? testInfo.title;
|
|
107
|
+
// Asset paths are authored relative to the user's script. Playwright reports
|
|
108
|
+
// `testInfo.file` as the builder module that registered the test, so prefer
|
|
109
|
+
// the script path captured at the call site.
|
|
110
|
+
const testFilePath = _screenciSourceFile ?? testInfo.file;
|
|
81
111
|
if (!shouldRecord) {
|
|
82
112
|
// Preview run (`screenci test`): exercise the body without capturing.
|
|
83
113
|
const page = await context.newPage();
|
|
84
114
|
const runtimeContext = createScreenCIRuntimeContext({
|
|
85
115
|
recorder,
|
|
86
116
|
page,
|
|
87
|
-
testFilePath
|
|
117
|
+
testFilePath,
|
|
118
|
+
captureKind: 'screenshot',
|
|
88
119
|
});
|
|
89
120
|
recorder.start();
|
|
90
121
|
await withActiveRecordingContext({
|
|
@@ -92,6 +123,7 @@ const _screenshotBase = base.extend({
|
|
|
92
123
|
page,
|
|
93
124
|
recorder,
|
|
94
125
|
unendedOverlays: 'autoEnd',
|
|
126
|
+
textDeclaration,
|
|
95
127
|
fn: async () => {
|
|
96
128
|
await use(page);
|
|
97
129
|
},
|
|
@@ -117,8 +149,9 @@ const _screenshotBase = base.extend({
|
|
|
117
149
|
const runtimeContext = createScreenCIRuntimeContext({
|
|
118
150
|
recorder,
|
|
119
151
|
page,
|
|
120
|
-
testFilePath
|
|
152
|
+
testFilePath,
|
|
121
153
|
recordingDir: screenshotDir,
|
|
154
|
+
captureKind: 'screenshot',
|
|
122
155
|
});
|
|
123
156
|
recorder.start();
|
|
124
157
|
try {
|
|
@@ -127,6 +160,7 @@ const _screenshotBase = base.extend({
|
|
|
127
160
|
page,
|
|
128
161
|
recorder,
|
|
129
162
|
unendedOverlays: 'autoEnd',
|
|
163
|
+
textDeclaration,
|
|
130
164
|
fn: async () => {
|
|
131
165
|
await use(page);
|
|
132
166
|
},
|
|
@@ -147,7 +181,7 @@ const _screenshotBase = base.extend({
|
|
|
147
181
|
const configDir = process.env.SCREENCI_CONFIG_DIR ?? process.cwd();
|
|
148
182
|
// The crop (from the `crop` fixture) is a render option, so it goes into
|
|
149
183
|
// renderOptions.screenshot.crop (editable in Studio), not ScreenshotInfo.
|
|
150
|
-
await recorder.writeToFile(screenshotDir,
|
|
184
|
+
await recorder.writeToFile(screenshotDir, videoName, relative(configDir, testFilePath), {
|
|
151
185
|
output: 'screenshot',
|
|
152
186
|
screenshot,
|
|
153
187
|
...(crop !== undefined && { crop }),
|
|
@@ -185,4 +219,9 @@ const _screenshotBase = base.extend({
|
|
|
185
219
|
* ```
|
|
186
220
|
*/
|
|
187
221
|
export const screenshot = _screenshotBase;
|
|
222
|
+
// Attach the chainable fan-out builders, mirroring `video`.
|
|
223
|
+
const _screenshotRootBuilder = createVideoBuilder(_screenshotBase);
|
|
224
|
+
screenshot.localize = _screenshotRootBuilder.localize;
|
|
225
|
+
screenshot.studio = _screenshotRootBuilder.studio;
|
|
226
|
+
screenshot.each = _screenshotRootBuilder.each;
|
|
188
227
|
//# sourceMappingURL=screenshot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"screenshot.js","sourceRoot":"","sources":["../../src/screenshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,IAAI,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAU/C,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAGrC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,sCAAsC,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AAC;YACT,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;QACpB,CAAC;IACH,CAAC;CACF,CAAC,CAAA;AAwHF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,eAAwC,CAAA;AAElE,4DAA4D;AAC5D,MAAM,sBAAsB,GAAG,kBAAkB,CAC/C,eAAsE,CACvE,CAAA;AACD,UAAU,CAAC,QAAQ,GAAG,sBAAsB,CAAC,QAAQ,CAAA;AACrD,UAAU,CAAC,MAAM,GAAG,sBAAsB,CAAC,MAAM,CAAA;AACjD,UAAU,CAAC,IAAI,GAAG,sBAAsB,CAAC,IAAI,CAAA"}
|
|
@@ -2,7 +2,6 @@ import type { Page } from '@playwright/test';
|
|
|
2
2
|
import type { IEventRecorder } from './events.js';
|
|
3
3
|
import type { CropTarget, ScreenshotCropRecord } from './crop.js';
|
|
4
4
|
import type { RecordOptions, RenderOptions } from './types.js';
|
|
5
|
-
import type { StudioRenderOptionsSentinel } from './studio.js';
|
|
6
5
|
/**
|
|
7
6
|
* The screenci-specific options added to `page.screenshot()` inside a `video()`.
|
|
8
7
|
* Everything else is forwarded to Playwright's native screenshot.
|
|
@@ -31,7 +30,7 @@ export type StillCaptureDeps = {
|
|
|
31
30
|
rm: (path: string) => Promise<void>;
|
|
32
31
|
mkdir: (path: string) => Promise<void>;
|
|
33
32
|
};
|
|
34
|
-
makeRecorder?: (renderOptions: RenderOptions |
|
|
33
|
+
makeRecorder?: (renderOptions: RenderOptions | undefined, recordOptions: RecordOptions | undefined) => IEventRecorder;
|
|
35
34
|
};
|
|
36
35
|
/**
|
|
37
36
|
* Write a standalone screenshot recording (its own `.screenci/<title>/` dir with
|
|
@@ -51,7 +50,7 @@ export declare function writeStillRecording(params: {
|
|
|
51
50
|
testFilePath: string | null;
|
|
52
51
|
configDir: string;
|
|
53
52
|
recordOptions: RecordOptions | undefined;
|
|
54
|
-
renderOptions: RenderOptions |
|
|
53
|
+
renderOptions: RenderOptions | undefined;
|
|
55
54
|
deps: StillCaptureDeps;
|
|
56
55
|
}): Promise<Buffer>;
|
|
57
56
|
/**
|
|
@@ -63,6 +62,13 @@ export declare function writeStillRecording(params: {
|
|
|
63
62
|
* Bound only to the `video()` fixture's page (never the `screenshot()` fixture's),
|
|
64
63
|
* so the screenshot fixture's own implicit capture and the overlay rasterizer
|
|
65
64
|
* keep the native behavior.
|
|
65
|
+
*
|
|
66
|
+
* Returns a restore function that reinstalls the native `page.screenshot`. The
|
|
67
|
+
* caller binds the wrapper only around the user's recording body, NOT around the
|
|
68
|
+
* screen recorder's own lifecycle: the recorder captures a baseline frame via
|
|
69
|
+
* `page.screenshot()` when recording starts (and may capture again on
|
|
70
|
+
* pause/finalize), and those internal calls must stay native so they do not leak
|
|
71
|
+
* a spurious `screenshot` still into `.screenci/`.
|
|
66
72
|
*/
|
|
67
|
-
export declare function bindStillCaptureToPage(page: Page): void;
|
|
73
|
+
export declare function bindStillCaptureToPage(page: Page): () => void;
|
|
68
74
|
//# sourceMappingURL=stillCapture.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stillCapture.d.ts","sourceRoot":"","sources":["../../src/stillCapture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAI5C,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,aAAa,CAAA;AAEjE,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAA;AAOjE,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"stillCapture.d.ts","sourceRoot":"","sources":["../../src/stillCapture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAI5C,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,aAAa,CAAA;AAEjE,OAAO,KAAK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3B,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,aAAa,GAAG,SAAS,CAAA;IACxC,aAAa,EAAE,aAAa,GAAG,SAAS,CAAA;IACxC,IAAI,EAAE,gBAAgB,CAAA;CACvB,GAAG,OAAO,CAAC,MAAM,CAAC,CAmDlB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,IAAI,CAyD7D"}
|
package/dist/src/stillCapture.js
CHANGED
|
@@ -75,6 +75,13 @@ export async function writeStillRecording(params) {
|
|
|
75
75
|
* Bound only to the `video()` fixture's page (never the `screenshot()` fixture's),
|
|
76
76
|
* so the screenshot fixture's own implicit capture and the overlay rasterizer
|
|
77
77
|
* keep the native behavior.
|
|
78
|
+
*
|
|
79
|
+
* Returns a restore function that reinstalls the native `page.screenshot`. The
|
|
80
|
+
* caller binds the wrapper only around the user's recording body, NOT around the
|
|
81
|
+
* screen recorder's own lifecycle: the recorder captures a baseline frame via
|
|
82
|
+
* `page.screenshot()` when recording starts (and may capture again on
|
|
83
|
+
* pause/finalize), and those internal calls must stay native so they do not leak
|
|
84
|
+
* a spurious `screenshot` still into `.screenci/`.
|
|
78
85
|
*/
|
|
79
86
|
export function bindStillCaptureToPage(page) {
|
|
80
87
|
const original = page.screenshot.bind(page);
|
|
@@ -115,5 +122,9 @@ export function bindStillCaptureToPage(page) {
|
|
|
115
122
|
});
|
|
116
123
|
};
|
|
117
124
|
page.screenshot = wrapped;
|
|
125
|
+
return () => {
|
|
126
|
+
;
|
|
127
|
+
page.screenshot = original;
|
|
128
|
+
};
|
|
118
129
|
}
|
|
119
130
|
//# sourceMappingURL=stillCapture.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stillCapture.js","sourceRoot":"","sources":["../../src/stillCapture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,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AC;YAC7C,UAAU;YACV,2EAA2E;YAC3E,gEAAgE;YAChE,iBAAiB,EAAE,CAAC;YACpB,GAAG,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,CAAC;YACnC,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,SAAS;YACT,aAAa;YACb,aAAa,EAAE,GAAG,CAAC,aAAa;YAChC,IAAI,EAAE;gBACJ,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,GAAG,iBAAiB,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;aACxE;SACF,CAAC,CAAA;IACJ,CAAC,CAEA;IAAC,IAAkD,CAAC,UAAU,GAAG,OAAO,CAAA;IAEzE,OAAO,GAAG,EAAE;QACV,CAAC;QAAC,IAAmD,CAAC,UAAU,GAAG,QAAQ,CAAA;IAC7E,CAAC,CAAA;AACH,CAAC"}
|
package/dist/src/studio.d.ts
CHANGED
|
@@ -1,33 +1,66 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Studio mode — configure
|
|
3
|
-
* app instead of code.
|
|
2
|
+
* Studio mode — configure render/record options, narration, on-screen text,
|
|
3
|
+
* overlays, and background audio from the ScreenCI web app instead of code.
|
|
4
|
+
* Business tier only.
|
|
4
5
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* voice are filled in on the Studio page.
|
|
8
|
-
* - `renderOptions: 'studio'` defers render options to Studio.
|
|
6
|
+
* Opt in with a single `video.studio({...})` (or `screenshot.studio({...})`)
|
|
7
|
+
* declaration, chainable with `.localize()` / `.each()`:
|
|
9
8
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
*
|
|
9
|
+
* - `renderOptions: true` / `recordOptions: true` defer those option groups to
|
|
10
|
+
* Studio. `recordOptions` (aspect ratio, quality, fps) changes the capture, so
|
|
11
|
+
* it is fetched before recording; `renderOptions` is applied at render.
|
|
12
|
+
* - `narration`, `text`, `overlays`, `audio` are name lists declaring the cues /
|
|
13
|
+
* fields / overlays / tracks whose content is owned by Studio. The matching
|
|
14
|
+
* `narration` / `text` / `overlays` / `audio` fixtures expose typed
|
|
15
|
+
* controllers/values for them.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* which is always an object.
|
|
17
|
+
* On the first upload of a studio-mode video, rendering is held until the video
|
|
18
|
+
* is configured in Studio (the CLI prints a direct link); later uploads reuse
|
|
19
|
+
* the saved configuration automatically.
|
|
21
20
|
*
|
|
22
21
|
* @example
|
|
23
22
|
* ```ts
|
|
24
|
-
* import {
|
|
23
|
+
* import { video } from 'screenci'
|
|
25
24
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* })
|
|
25
|
+
* video
|
|
26
|
+
* .studio({ renderOptions: true, narration: ['intro'], overlays: ['logo'] })
|
|
27
|
+
* .localize({ languages: ['en', 'fi'] })(
|
|
28
|
+
* 'Product demo',
|
|
29
|
+
* async ({ page, narration, overlays }) => {
|
|
30
|
+
* await overlays.logo()
|
|
31
|
+
* await narration.intro()
|
|
32
|
+
* }
|
|
33
|
+
* )
|
|
29
34
|
* ```
|
|
30
35
|
*/
|
|
31
|
-
export type
|
|
32
|
-
|
|
36
|
+
export type StudioDeclaration = {
|
|
37
|
+
/** Defer render options to Studio. Applied at render time. */
|
|
38
|
+
renderOptions?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Defer record options (aspect ratio, quality, fps) to Studio. Fetched before
|
|
41
|
+
* recording, since they change the captured viewport/encode.
|
|
42
|
+
*/
|
|
43
|
+
recordOptions?: boolean;
|
|
44
|
+
/** Studio-managed narration cue names (text and voice configured in Studio). */
|
|
45
|
+
narration?: readonly string[];
|
|
46
|
+
/** Studio-managed on-screen text field names (values configured in Studio). */
|
|
47
|
+
text?: readonly string[];
|
|
48
|
+
/** Studio-managed overlay names (file and placement configured in Studio). */
|
|
49
|
+
overlays?: readonly string[];
|
|
50
|
+
/** Studio-managed background-audio track names (file/volume configured in Studio). */
|
|
51
|
+
audio?: readonly string[];
|
|
52
|
+
};
|
|
53
|
+
/** The studio option groups deferred to render/record. */
|
|
54
|
+
export type StudioOptionFlags = {
|
|
55
|
+
renderOptions: boolean;
|
|
56
|
+
recordOptions: boolean;
|
|
57
|
+
};
|
|
58
|
+
/** Returns the render/record deferral flags for a (possibly absent) declaration. */
|
|
59
|
+
export declare function studioOptionFlags(declaration: StudioDeclaration | undefined): StudioOptionFlags;
|
|
60
|
+
/**
|
|
61
|
+
* Validates a studio declaration against the seeded localize names: each name
|
|
62
|
+
* list is unique and non-empty, and Studio-managed narration/text names are
|
|
63
|
+
* disjoint from the names seeded in `localize()`. Pure; throws on violation.
|
|
64
|
+
*/
|
|
65
|
+
export declare function validateStudioDeclaration(declaration: StudioDeclaration | null, seededNarrationNames: readonly string[], seededTextNames: readonly string[]): void;
|
|
33
66
|
//# sourceMappingURL=studio.d.ts.map
|
package/dist/src/studio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"studio.d.ts","sourceRoot":"","sources":["../../src/studio.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"studio.d.ts","sourceRoot":"","sources":["../../src/studio.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,8DAA8D;IAC9D,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,gFAAgF;IAChF,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC7B,+EAA+E;IAC/E,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACxB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC5B,sFAAsF;IACtF,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAC1B,CAAA;AAED,0DAA0D;AAC1D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,aAAa,EAAE,OAAO,CAAA;IACtB,aAAa,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,oFAAoF;AACpF,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,iBAAiB,GAAG,SAAS,GACzC,iBAAiB,CAKnB;AAmCD;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,WAAW,EAAE,iBAAiB,GAAG,IAAI,EACrC,oBAAoB,EAAE,SAAS,MAAM,EAAE,EACvC,eAAe,EAAE,SAAS,MAAM,EAAE,GACjC,IAAI,CAcN"}
|