@scenar/cli 0.8.0 → 0.9.1
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/example-bundle/assets/index-DlmG1Uh7.js +388 -0
- package/example-bundle/assets/style-BjquDnTE.css +1 -0
- package/example-bundle/index.html +2 -2
- package/example-bundle/pack-manifest.json +9 -9
- package/example-bundle/scenario.json +6 -2
- package/package.json +9 -5
- package/src/__tests__/collect-pack-shots.test.ts +97 -0
- package/src/__tests__/pack-generate-embed-entry.test.ts +68 -3
- package/src/__tests__/pack-manifest.test.ts +17 -0
- package/src/__tests__/read-shots.test.ts +57 -0
- package/src/__tests__/run-shoot.test.ts +319 -0
- package/src/api.d.ts +3 -0
- package/src/api.d.ts.map +1 -1
- package/src/api.js +2 -0
- package/src/api.js.map +1 -1
- package/src/api.ts +5 -0
- package/src/bundle/read-shots.d.ts +28 -0
- package/src/bundle/read-shots.d.ts.map +1 -0
- package/src/bundle/read-shots.js +28 -0
- package/src/bundle/read-shots.js.map +1 -0
- package/src/bundle/read-shots.ts +38 -0
- package/src/commands/shoot.d.ts +3 -0
- package/src/commands/shoot.d.ts.map +1 -0
- package/src/commands/shoot.js +52 -0
- package/src/commands/shoot.js.map +1 -0
- package/src/commands/shoot.ts +72 -0
- package/src/index.d.ts.map +1 -1
- package/src/index.js +2 -0
- package/src/index.js.map +1 -1
- package/src/index.ts +2 -0
- package/src/pack/build.d.ts +33 -1
- package/src/pack/build.d.ts.map +1 -1
- package/src/pack/build.js +35 -10
- package/src/pack/build.js.map +1 -1
- package/src/pack/build.ts +63 -17
- package/src/pack/collect-pack-shots.d.ts +40 -0
- package/src/pack/collect-pack-shots.d.ts.map +1 -0
- package/src/pack/collect-pack-shots.js +59 -0
- package/src/pack/collect-pack-shots.js.map +1 -0
- package/src/pack/collect-pack-shots.ts +76 -0
- package/src/pack/generate-embed-entry.d.ts +18 -0
- package/src/pack/generate-embed-entry.d.ts.map +1 -1
- package/src/pack/generate-embed-entry.js +92 -3
- package/src/pack/generate-embed-entry.js.map +1 -1
- package/src/pack/generate-embed-entry.ts +94 -3
- package/src/pack/pack-manifest.d.ts +12 -3
- package/src/pack/pack-manifest.d.ts.map +1 -1
- package/src/pack/pack-manifest.js +13 -3
- package/src/pack/pack-manifest.js.map +1 -1
- package/src/pack/pack-manifest.ts +13 -2
- package/src/pack/run-pack.d.ts +6 -0
- package/src/pack/run-pack.d.ts.map +1 -1
- package/src/pack/run-pack.js +41 -14
- package/src/pack/run-pack.js.map +1 -1
- package/src/pack/run-pack.ts +55 -14
- package/src/shoot/playwright-browser.d.ts +9 -0
- package/src/shoot/playwright-browser.d.ts.map +1 -0
- package/src/shoot/playwright-browser.js +92 -0
- package/src/shoot/playwright-browser.js.map +1 -0
- package/src/shoot/playwright-browser.ts +121 -0
- package/src/shoot/run-shoot.d.ts +58 -0
- package/src/shoot/run-shoot.d.ts.map +1 -0
- package/src/shoot/run-shoot.js +190 -0
- package/src/shoot/run-shoot.js.map +1 -0
- package/src/shoot/run-shoot.ts +270 -0
- package/src/shoot/types.d.ts +40 -0
- package/src/shoot/types.d.ts.map +1 -0
- package/src/shoot/types.js +2 -0
- package/src/shoot/types.js.map +1 -0
- package/src/shoot/types.ts +40 -0
- package/src/util/load-ts.d.ts +12 -2
- package/src/util/load-ts.d.ts.map +1 -1
- package/src/util/load-ts.js +25 -10
- package/src/util/load-ts.js.map +1 -1
- package/src/util/load-ts.ts +25 -11
- package/tsconfig.tsbuildinfo +1 -1
- package/example-bundle/assets/index-CBaiZ4ek.js +0 -147
- package/example-bundle/assets/style-Ci-h7jik.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-embed-entry.js","sourceRoot":"","sources":["../../../src/pack/generate-embed-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AA+BlC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,kBAAkB,CAA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T,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,2EAA2E;AAC3E,SAAS,OAAO,CAAC,MAAc;IAC7B,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACpC,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK;SACT,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -50,11 +50,31 @@ export interface EmbedEntryInput {
|
|
|
50
50
|
* selector). The default is light, so existing embeds are unaffected; a host can
|
|
51
51
|
* theme-sync simply by framing `…/?theme=dark`.
|
|
52
52
|
*
|
|
53
|
+
* Capture (`?shot`): with a `shot` query param present, the entry mounts
|
|
54
|
+
* `ScenarioCaptureMount` instead of the playback tree — the TimeSource-driven
|
|
55
|
+
* catch-up mount behind `scenar shoot` (DD-02). The driver installs on
|
|
56
|
+
* `window.__scenarShot`; failures surface on `window.__scenarShotError`.
|
|
57
|
+
* `?shot=<name>` additionally auto-walks to that shot, so an author can
|
|
58
|
+
* eyeball any still in a plain browser. When the scenario has narration, the
|
|
59
|
+
* capture branch fetches the manifest itself and fails LOUDLY on error —
|
|
60
|
+
* step durations are narration-driven, so a silent fallback would capture
|
|
61
|
+
* every shot at the wrong time (which is why it must not reuse
|
|
62
|
+
* `useNarrationManifest`, whose fetch failure is silent by design).
|
|
63
|
+
*
|
|
53
64
|
* Pure function, no side effects — the caller writes the result to disk.
|
|
54
65
|
*/
|
|
66
|
+
/**
|
|
67
|
+
* The import specifier the generated entry uses for the scenario's steps
|
|
68
|
+
* module (extensionless — Vite resolves .ts/.tsx). Exported so pack-time
|
|
69
|
+
* tooling (`collect-pack-shots`) loads the very same module the bundle bakes
|
|
70
|
+
* in, rather than re-deriving a path that could drift from it.
|
|
71
|
+
*/
|
|
72
|
+
export function stepsModuleSpecifier(scenarioDir: string): string {
|
|
73
|
+
return `${toPosix(scenarioDir)}/steps`;
|
|
74
|
+
}
|
|
75
|
+
|
|
55
76
|
export function generateEmbedEntry(input: EmbedEntryInput): string {
|
|
56
|
-
const
|
|
57
|
-
const stepsImport = `${scenarioPath}/steps`;
|
|
77
|
+
const stepsImport = stepsModuleSpecifier(input.scenarioDir);
|
|
58
78
|
const renderImport = toPosix(input.renderFilePath).replace(/\.[^.]+$/, "");
|
|
59
79
|
|
|
60
80
|
const lines: string[] = [];
|
|
@@ -74,6 +94,7 @@ export function generateEmbedEntry(input: EmbedEntryInput): string {
|
|
|
74
94
|
"useStepInteractions",
|
|
75
95
|
"ViewportTransformLayer",
|
|
76
96
|
"VIEWPORT_TRANSFORM_IDENTITY",
|
|
97
|
+
"ScenarioCaptureMount",
|
|
77
98
|
];
|
|
78
99
|
if (input.stage) reactImports.push("ScenarioStage");
|
|
79
100
|
if (input.hasNarration) reactImports.push("useNarrationManifest");
|
|
@@ -127,6 +148,16 @@ export function generateEmbedEntry(input: EmbedEntryInput): string {
|
|
|
127
148
|
lines.push(`})();`);
|
|
128
149
|
lines.push(`const _rootClass = _theme === "dark" ? SCENAR_CLASS + " dark" : SCENAR_CLASS;`);
|
|
129
150
|
|
|
151
|
+
// --- Capture mode: ?shot (bare = driver only; ?shot=<name> = auto-walk) ---
|
|
152
|
+
// Read the same way as _theme: once, at module load, outside React. A null
|
|
153
|
+
// value (param absent) means normal playback; "" (bare ?shot) means capture
|
|
154
|
+
// mode without an auto-walk target.
|
|
155
|
+
lines.push(``);
|
|
156
|
+
lines.push(`const _shotParam = (() => {`);
|
|
157
|
+
lines.push(` try { return new URLSearchParams(window.location.search).get("shot"); }`);
|
|
158
|
+
lines.push(` catch { return null; }`);
|
|
159
|
+
lines.push(`})();`);
|
|
160
|
+
|
|
130
161
|
// --- Page canvas: transparent when framed, theme surface when top-level ---
|
|
131
162
|
// The static HTML keeps html/body transparent (see generateEmbedHtml): a
|
|
132
163
|
// framed embed's canvas then shows the *host page's* background through any
|
|
@@ -222,11 +253,71 @@ export function generateEmbedEntry(input: EmbedEntryInput): string {
|
|
|
222
253
|
lines.push(` );`);
|
|
223
254
|
lines.push(`}`);
|
|
224
255
|
|
|
256
|
+
// --- Capture mount (?shot) ---
|
|
257
|
+
// The whole capture tree lives in @scenar/react (ScenarioCaptureMount);
|
|
258
|
+
// this branch only feeds it the same inputs the playback tree gets and
|
|
259
|
+
// wires the window contract `scenar shoot` consumes: the driver on
|
|
260
|
+
// `window.__scenarShot`, failures on `window.__scenarShotError`. The
|
|
261
|
+
// narration manifest is fetched HERE, before mounting, and errors are
|
|
262
|
+
// fatal — shot times are narration-driven, so capturing without the
|
|
263
|
+
// manifest would silently shoot every frame at the wrong moment.
|
|
264
|
+
lines.push(``);
|
|
265
|
+
lines.push(`async function _mountCapture(rootEl: HTMLElement) {`);
|
|
266
|
+
if (input.hasNarration) {
|
|
267
|
+
lines.push(` const _manifestResponse = await fetch("./narration/manifest.json");`);
|
|
268
|
+
lines.push(` if (!_manifestResponse.ok) {`);
|
|
269
|
+
lines.push(` throw new Error(`);
|
|
270
|
+
lines.push(` "capture: failed to fetch ./narration/manifest.json (HTTP " +`);
|
|
271
|
+
lines.push(` _manifestResponse.status + ") — shot times are narration-driven, refusing to capture without it",`);
|
|
272
|
+
lines.push(` );`);
|
|
273
|
+
lines.push(` }`);
|
|
274
|
+
lines.push(` const _captureManifest = await _manifestResponse.json();`);
|
|
275
|
+
} else {
|
|
276
|
+
lines.push(` const _captureManifest = undefined;`);
|
|
277
|
+
}
|
|
278
|
+
lines.push(` createRoot(rootEl).render(`);
|
|
279
|
+
lines.push(` <div className={_rootClass}>`);
|
|
280
|
+
lines.push(` <ScenarioCaptureMount`);
|
|
281
|
+
lines.push(` scenarioId={${JSON.stringify(input.scenarioId)}}`);
|
|
282
|
+
lines.push(` steps={_steps}`);
|
|
283
|
+
lines.push(` renderStep={renderStep}`);
|
|
284
|
+
lines.push(` canonicalWidth={${input.canonicalWidth}}`);
|
|
285
|
+
lines.push(` shellHeight={${input.shellHeight}}`);
|
|
286
|
+
lines.push(` narrationManifest={_captureManifest}`);
|
|
287
|
+
lines.push(` stage={${input.stage ? "true" : "false"}}`);
|
|
288
|
+
lines.push(` providers={${input.providersPath ? "_Providers" : "undefined"}}`);
|
|
289
|
+
lines.push(` onReady={(driver: any) => {`);
|
|
290
|
+
lines.push(` (window as any).__scenarShot = driver;`);
|
|
291
|
+
lines.push(` if (_shotParam) {`);
|
|
292
|
+
lines.push(` const _target = driver.shots.find((s: any) => s.name === _shotParam);`);
|
|
293
|
+
lines.push(` if (!_target) {`);
|
|
294
|
+
lines.push(` (window as any).__scenarShotError =`);
|
|
295
|
+
lines.push(` 'no shot named "' + _shotParam + '" — declared: ' +`);
|
|
296
|
+
lines.push(` (driver.shots.map((s: any) => s.name).join(", ") || "(none)");`);
|
|
297
|
+
lines.push(` return;`);
|
|
298
|
+
lines.push(` }`);
|
|
299
|
+
lines.push(` void driver.walkTo(_target.timeMs);`);
|
|
300
|
+
lines.push(` }`);
|
|
301
|
+
lines.push(` }}`);
|
|
302
|
+
lines.push(` onError={(error: any) => {`);
|
|
303
|
+
lines.push(` (window as any).__scenarShotError = error?.message ?? String(error);`);
|
|
304
|
+
lines.push(` }}`);
|
|
305
|
+
lines.push(` />`);
|
|
306
|
+
lines.push(` </div>,`);
|
|
307
|
+
lines.push(` );`);
|
|
308
|
+
lines.push(`}`);
|
|
309
|
+
|
|
225
310
|
// --- Mount ---
|
|
226
311
|
lines.push(``);
|
|
227
312
|
lines.push(`const _rootEl = document.getElementById("root");`);
|
|
228
313
|
lines.push(`if (!_rootEl) throw new Error("Embed root element #root not found");`);
|
|
229
|
-
lines.push(`
|
|
314
|
+
lines.push(`if (_shotParam !== null) {`);
|
|
315
|
+
lines.push(` _mountCapture(_rootEl).catch((error) => {`);
|
|
316
|
+
lines.push(` (window as any).__scenarShotError = error instanceof Error ? error.message : String(error);`);
|
|
317
|
+
lines.push(` });`);
|
|
318
|
+
lines.push(`} else {`);
|
|
319
|
+
lines.push(` createRoot(_rootEl).render(<_App />);`);
|
|
320
|
+
lines.push(`}`);
|
|
230
321
|
lines.push(``);
|
|
231
322
|
|
|
232
323
|
return lines.join("\n");
|
|
@@ -27,10 +27,19 @@ export declare const SCENARIO_JSON_FILE = "scenario.json";
|
|
|
27
27
|
* `viewport` baked into the bundle: the player reads its steps from the bundled
|
|
28
28
|
* JS, so the full serialized spec is still a follow-up, but `deploy` needs the
|
|
29
29
|
* viewport to derive a correctly-proportioned embed snippet (DD-004). The
|
|
30
|
-
* viewport mirrors `ViewportConfig { width, height }`.
|
|
31
|
-
*
|
|
30
|
+
* viewport mirrors `ViewportConfig { width, height }`.
|
|
31
|
+
*
|
|
32
|
+
* `shots` records the scenario's declared shot names (in step order) when
|
|
33
|
+
* pack could discover them, so tooling — `scenar shoot` first of all — can
|
|
34
|
+
* learn a bundle's shots without booting a browser. The key is written only
|
|
35
|
+
* when the list is known: absent means "unknown", present (even empty) is
|
|
36
|
+
* authoritative. Names only, never times — shot times depend on narration
|
|
37
|
+
* and are derived at the point of use (DD-004's derive-don't-store rule).
|
|
38
|
+
*
|
|
39
|
+
* Validated against the backend rules before writing (which accept the
|
|
40
|
+
* extra `viewport`/`shots` keys).
|
|
32
41
|
*/
|
|
33
|
-
export declare function writeScenarioJson(outDir: string, scenarioId: string, generatorVersion: string, viewport: Viewport): Promise<void>;
|
|
42
|
+
export declare function writeScenarioJson(outDir: string, scenarioId: string, generatorVersion: string, viewport: Viewport, shots?: readonly string[]): Promise<void>;
|
|
34
43
|
/**
|
|
35
44
|
* Walk the build output and produce the pack manifest: one validated entry per
|
|
36
45
|
* file (excluding the manifest itself), with a lowercase-hex SHA-256, byte size,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack-manifest.d.ts","sourceRoot":"","sources":["../../../src/pack/pack-manifest.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,6EAA6E;AAC7E,MAAM,WAAW,QAAQ;IACvB,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yBAAyB;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,+DAA+D;AAC/D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC;CAC5B;AAED,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAElD
|
|
1
|
+
{"version":3,"file":"pack-manifest.d.ts","sourceRoot":"","sources":["../../../src/pack/pack-manifest.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,6EAA6E;AAC7E,MAAM,WAAW,QAAQ;IACvB,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yBAAyB;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,+DAA+D;AAC/D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC;CAC5B;AAED,kFAAkF;AAClF,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAElD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,gBAAgB,EAAE,MAAM,EACxB,QAAQ,EAAE,QAAQ,EAClB,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GACxB,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CA+BjG;AAED,mDAAmD;AACnD,wBAAsB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAM7F;AAiBD,oFAAoF;AACpF,wBAAsB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAQpG"}
|
|
@@ -12,15 +12,25 @@ export const SCENARIO_JSON_FILE = "scenario.json";
|
|
|
12
12
|
* `viewport` baked into the bundle: the player reads its steps from the bundled
|
|
13
13
|
* JS, so the full serialized spec is still a follow-up, but `deploy` needs the
|
|
14
14
|
* viewport to derive a correctly-proportioned embed snippet (DD-004). The
|
|
15
|
-
* viewport mirrors `ViewportConfig { width, height }`.
|
|
16
|
-
*
|
|
15
|
+
* viewport mirrors `ViewportConfig { width, height }`.
|
|
16
|
+
*
|
|
17
|
+
* `shots` records the scenario's declared shot names (in step order) when
|
|
18
|
+
* pack could discover them, so tooling — `scenar shoot` first of all — can
|
|
19
|
+
* learn a bundle's shots without booting a browser. The key is written only
|
|
20
|
+
* when the list is known: absent means "unknown", present (even empty) is
|
|
21
|
+
* authoritative. Names only, never times — shot times depend on narration
|
|
22
|
+
* and are derived at the point of use (DD-004's derive-don't-store rule).
|
|
23
|
+
*
|
|
24
|
+
* Validated against the backend rules before writing (which accept the
|
|
25
|
+
* extra `viewport`/`shots` keys).
|
|
17
26
|
*/
|
|
18
|
-
export async function writeScenarioJson(outDir, scenarioId, generatorVersion, viewport) {
|
|
27
|
+
export async function writeScenarioJson(outDir, scenarioId, generatorVersion, viewport, shots) {
|
|
19
28
|
const content = JSON.stringify({
|
|
20
29
|
schemaVersion: "1",
|
|
21
30
|
id: scenarioId,
|
|
22
31
|
generator: `@scenar/cli pack ${generatorVersion}`,
|
|
23
32
|
viewport: { width: viewport.width, height: viewport.height },
|
|
33
|
+
...(shots !== undefined ? { shots } : {}),
|
|
24
34
|
}, null, 2);
|
|
25
35
|
const error = validateScenarioJson(content);
|
|
26
36
|
if (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack-manifest.js","sourceRoot":"","sources":["../../../src/pack/pack-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EACL,yBAAyB,EACzB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAuB9B,kFAAkF;AAClF,MA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AAC,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,uCAAuC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,OAAO,CAAC,CAAS;IACxB,OAAO,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -41,14 +41,24 @@ export const SCENARIO_JSON_FILE = "scenario.json";
|
|
|
41
41
|
* `viewport` baked into the bundle: the player reads its steps from the bundled
|
|
42
42
|
* JS, so the full serialized spec is still a follow-up, but `deploy` needs the
|
|
43
43
|
* viewport to derive a correctly-proportioned embed snippet (DD-004). The
|
|
44
|
-
* viewport mirrors `ViewportConfig { width, height }`.
|
|
45
|
-
*
|
|
44
|
+
* viewport mirrors `ViewportConfig { width, height }`.
|
|
45
|
+
*
|
|
46
|
+
* `shots` records the scenario's declared shot names (in step order) when
|
|
47
|
+
* pack could discover them, so tooling — `scenar shoot` first of all — can
|
|
48
|
+
* learn a bundle's shots without booting a browser. The key is written only
|
|
49
|
+
* when the list is known: absent means "unknown", present (even empty) is
|
|
50
|
+
* authoritative. Names only, never times — shot times depend on narration
|
|
51
|
+
* and are derived at the point of use (DD-004's derive-don't-store rule).
|
|
52
|
+
*
|
|
53
|
+
* Validated against the backend rules before writing (which accept the
|
|
54
|
+
* extra `viewport`/`shots` keys).
|
|
46
55
|
*/
|
|
47
56
|
export async function writeScenarioJson(
|
|
48
57
|
outDir: string,
|
|
49
58
|
scenarioId: string,
|
|
50
59
|
generatorVersion: string,
|
|
51
60
|
viewport: Viewport,
|
|
61
|
+
shots?: readonly string[],
|
|
52
62
|
): Promise<void> {
|
|
53
63
|
const content = JSON.stringify(
|
|
54
64
|
{
|
|
@@ -56,6 +66,7 @@ export async function writeScenarioJson(
|
|
|
56
66
|
id: scenarioId,
|
|
57
67
|
generator: `@scenar/cli pack ${generatorVersion}`,
|
|
58
68
|
viewport: { width: viewport.width, height: viewport.height },
|
|
69
|
+
...(shots !== undefined ? { shots } : {}),
|
|
59
70
|
},
|
|
60
71
|
null,
|
|
61
72
|
2,
|
package/src/pack/run-pack.d.ts
CHANGED
|
@@ -27,6 +27,12 @@ export interface PackResult {
|
|
|
27
27
|
readonly renderFilePath: string;
|
|
28
28
|
readonly providersPath: string | null;
|
|
29
29
|
readonly hasNarration: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* The declared shot names recorded in scenario.json (empty = the scenario
|
|
32
|
+
* authoritatively declares none), or undefined when the steps module could
|
|
33
|
+
* not be loaded under Node and the shots are unknown.
|
|
34
|
+
*/
|
|
35
|
+
readonly shots?: readonly string[];
|
|
30
36
|
readonly manifest: PackManifest;
|
|
31
37
|
readonly totalBytes: number;
|
|
32
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-pack.d.ts","sourceRoot":"","sources":["../../../src/pack/run-pack.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run-pack.d.ts","sourceRoot":"","sources":["../../../src/pack/run-pack.ts"],"names":[],"mappings":"AAQA,OAAO,EAKL,KAAK,YAAY,EAClB,MAAM,oBAAoB,CAAC;AAS5B,kFAAkF;AAClF,MAAM,WAAW,cAAc;IAC7B,kFAAkF;IAClF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,gFAAgF;IAChF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,+EAA+E;IAC/E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,gDAAgD;IAChD,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C;AAED,wCAAwC;AACxC,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;GAKG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,CAiH1E"}
|
package/src/pack/run-pack.js
CHANGED
|
@@ -3,12 +3,16 @@ import { stat, mkdir, writeFile, rm, readdir, copyFile, access } from "node:fs/p
|
|
|
3
3
|
import { detectRenderExport } from "../render/detect-render-export.js";
|
|
4
4
|
import { resolveProvidersPath } from "../render/resolve-providers.js";
|
|
5
5
|
import { generateEmbedEntry, generateEmbedHtml } from "./generate-embed-entry.js";
|
|
6
|
+
import { collectPackShots } from "./collect-pack-shots.js";
|
|
6
7
|
import { runViteBuild } from "./build.js";
|
|
7
8
|
import { copyEmbedLoader } from "./embed-loader.js";
|
|
8
9
|
import { buildPackManifest, writePackManifest, writeScenarioJson, verifyManifestFilesExist, } from "./pack-manifest.js";
|
|
9
10
|
import { DEFAULT_VIEWPORT } from "./viewport.js";
|
|
10
|
-
/**
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Generator version stamped into scenario.json (kept in sync with the CLI).
|
|
13
|
+
* 0.0.2: scenario.json may carry `shots` (declared shot names, in step order).
|
|
14
|
+
*/
|
|
15
|
+
const PACK_GENERATOR_VERSION = "0.0.2";
|
|
12
16
|
/**
|
|
13
17
|
* Bundle a scenario directory into a self-contained, hosted embed — the pure
|
|
14
18
|
* orchestration behind `scenar pack`, with no process/exit coupling so both the
|
|
@@ -42,7 +46,14 @@ export async function runPack(options) {
|
|
|
42
46
|
onLog(`Providers: ${providersPath ?? "none"}`);
|
|
43
47
|
onLog(`Narration: ${hasNarration ? "yes (manifest found)" : "none"}`);
|
|
44
48
|
onLog(`Output: ${outDir}`);
|
|
45
|
-
// 1.
|
|
49
|
+
// 1. Discover the declared shots by SSR-loading the steps module (same
|
|
50
|
+
// Vite resolution as the build below). Before the build on purpose:
|
|
51
|
+
// authoring errors — bad shot names, no steps array — fail fast here,
|
|
52
|
+
// without paying for a bundle. An import failure is tolerated: the
|
|
53
|
+
// shots are then unknown and scenario.json omits the key.
|
|
54
|
+
const collectedShots = await collectPackShots(scenarioDir);
|
|
55
|
+
onLog(`Shots: ${describeCollectedShots(collectedShots)}`);
|
|
56
|
+
// 2. Generate the browser entry + index.html into the temp dir.
|
|
46
57
|
const stage = options.stage ?? false;
|
|
47
58
|
const entrySource = generateEmbedEntry({
|
|
48
59
|
scenarioDir,
|
|
@@ -59,34 +70,42 @@ export async function runPack(options) {
|
|
|
59
70
|
const entryHtmlPath = join(tempDir, "index.html");
|
|
60
71
|
await writeFile(join(tempDir, entryFileName), entrySource, "utf-8");
|
|
61
72
|
await writeFile(entryHtmlPath, generateEmbedHtml(scenarioId, entryFileName, stage), "utf-8");
|
|
62
|
-
//
|
|
73
|
+
// 3. Build the static bundle with Vite.
|
|
63
74
|
onLog("Bundling embed with Vite...");
|
|
64
75
|
await runViteBuild({ root: tempDir, outDir, entryHtmlPath });
|
|
65
|
-
//
|
|
76
|
+
// 4. Copy the narration manifest + audio. The embed fetches
|
|
66
77
|
// ./narration/manifest.json at runtime and resolves each clip's
|
|
67
78
|
// relative src against it, so both must ship in the bundle.
|
|
68
79
|
if (hasNarration) {
|
|
69
80
|
await copyNarration(scenarioDir, outDir);
|
|
70
81
|
}
|
|
71
|
-
//
|
|
82
|
+
// 5. Write the required scenario.json descriptor, recording the canonical
|
|
72
83
|
// viewport baked into the bundle so `deploy`/`serve`/`publish` can derive
|
|
73
|
-
// a correctly-proportioned embed snippet (DD-004)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
// 4b. Copy the optional <scenar-embed> loader into the bundle as embed.js
|
|
84
|
+
// a correctly-proportioned embed snippet (DD-004), and — when known —
|
|
85
|
+
// the declared shot names so `shoot` and other tooling never boot a
|
|
86
|
+
// browser just to learn a bundle has nothing to capture.
|
|
87
|
+
await writeScenarioJson(outDir, scenarioId, PACK_GENERATOR_VERSION, { width, height: shellHeight }, collectedShots.recorded ? collectedShots.shots : undefined);
|
|
88
|
+
// 5b. Copy the optional <scenar-embed> loader into the bundle as embed.js
|
|
79
89
|
// (sibling of index.html), so the enhanced snippet works on any static
|
|
80
90
|
// host (GitHub Pages, `serve`, the edge) with no extra setup. It lands
|
|
81
91
|
// before the manifest pass below so it ships as a first-class bundle file.
|
|
82
92
|
await copyEmbedLoader(outDir);
|
|
83
|
-
//
|
|
93
|
+
// 6. Compute + write the deploy-facing pack manifest (validates the bundle
|
|
84
94
|
// against the backend allowlist; throws on any violation).
|
|
85
95
|
const manifest = await buildPackManifest(outDir, scenarioId);
|
|
86
96
|
await verifyManifestFilesExist(outDir, manifest);
|
|
87
97
|
await writePackManifest(outDir, manifest);
|
|
88
98
|
const totalBytes = manifest.files.reduce((sum, f) => sum + f.sizeBytes, 0);
|
|
89
|
-
return {
|
|
99
|
+
return {
|
|
100
|
+
scenarioId,
|
|
101
|
+
outDir,
|
|
102
|
+
renderFilePath,
|
|
103
|
+
providersPath,
|
|
104
|
+
hasNarration,
|
|
105
|
+
shots: collectedShots.recorded ? collectedShots.shots : undefined,
|
|
106
|
+
manifest,
|
|
107
|
+
totalBytes,
|
|
108
|
+
};
|
|
90
109
|
}
|
|
91
110
|
finally {
|
|
92
111
|
if (!options.keepTemp) {
|
|
@@ -113,6 +132,14 @@ async function copyNarration(scenarioDir, outDir) {
|
|
|
113
132
|
}
|
|
114
133
|
}
|
|
115
134
|
}
|
|
135
|
+
/** One log-friendly line for the shot discovery outcome. */
|
|
136
|
+
function describeCollectedShots(collected) {
|
|
137
|
+
if (!collected.recorded) {
|
|
138
|
+
// Vite errors can run many lines; the first carries the message.
|
|
139
|
+
return `unknown — steps module not loadable under Node (${collected.reason.split("\n")[0]})`;
|
|
140
|
+
}
|
|
141
|
+
return collected.shots.length === 0 ? "none declared" : collected.shots.join(", ");
|
|
142
|
+
}
|
|
116
143
|
async function fileExists(path) {
|
|
117
144
|
try {
|
|
118
145
|
await access(path);
|
package/src/pack/run-pack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-pack.js","sourceRoot":"","sources":["../../../src/pack/run-pack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAA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rF,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,IAAY;IACpC,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/src/pack/run-pack.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { stat, mkdir, writeFile, rm, readdir, copyFile, access } from "node:fs/p
|
|
|
3
3
|
import { detectRenderExport } from "../render/detect-render-export.js";
|
|
4
4
|
import { resolveProvidersPath } from "../render/resolve-providers.js";
|
|
5
5
|
import { generateEmbedEntry, generateEmbedHtml } from "./generate-embed-entry.js";
|
|
6
|
+
import { collectPackShots, type CollectedPackShots } from "./collect-pack-shots.js";
|
|
6
7
|
import { runViteBuild } from "./build.js";
|
|
7
8
|
import { copyEmbedLoader } from "./embed-loader.js";
|
|
8
9
|
import {
|
|
@@ -14,8 +15,11 @@ import {
|
|
|
14
15
|
} from "./pack-manifest.js";
|
|
15
16
|
import { DEFAULT_VIEWPORT } from "./viewport.js";
|
|
16
17
|
|
|
17
|
-
/**
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Generator version stamped into scenario.json (kept in sync with the CLI).
|
|
20
|
+
* 0.0.2: scenario.json may carry `shots` (declared shot names, in step order).
|
|
21
|
+
*/
|
|
22
|
+
const PACK_GENERATOR_VERSION = "0.0.2";
|
|
19
23
|
|
|
20
24
|
/** Options for {@link runPack}. Paths may be relative; they are resolved here. */
|
|
21
25
|
export interface RunPackOptions {
|
|
@@ -46,6 +50,12 @@ export interface PackResult {
|
|
|
46
50
|
readonly renderFilePath: string;
|
|
47
51
|
readonly providersPath: string | null;
|
|
48
52
|
readonly hasNarration: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* The declared shot names recorded in scenario.json (empty = the scenario
|
|
55
|
+
* authoritatively declares none), or undefined when the steps module could
|
|
56
|
+
* not be loaded under Node and the shots are unknown.
|
|
57
|
+
*/
|
|
58
|
+
readonly shots?: readonly string[];
|
|
49
59
|
readonly manifest: PackManifest;
|
|
50
60
|
readonly totalBytes: number;
|
|
51
61
|
}
|
|
@@ -91,7 +101,15 @@ export async function runPack(options: RunPackOptions): Promise<PackResult> {
|
|
|
91
101
|
onLog(`Narration: ${hasNarration ? "yes (manifest found)" : "none"}`);
|
|
92
102
|
onLog(`Output: ${outDir}`);
|
|
93
103
|
|
|
94
|
-
// 1.
|
|
104
|
+
// 1. Discover the declared shots by SSR-loading the steps module (same
|
|
105
|
+
// Vite resolution as the build below). Before the build on purpose:
|
|
106
|
+
// authoring errors — bad shot names, no steps array — fail fast here,
|
|
107
|
+
// without paying for a bundle. An import failure is tolerated: the
|
|
108
|
+
// shots are then unknown and scenario.json omits the key.
|
|
109
|
+
const collectedShots = await collectPackShots(scenarioDir);
|
|
110
|
+
onLog(`Shots: ${describeCollectedShots(collectedShots)}`);
|
|
111
|
+
|
|
112
|
+
// 2. Generate the browser entry + index.html into the temp dir.
|
|
95
113
|
const stage = options.stage ?? false;
|
|
96
114
|
const entrySource = generateEmbedEntry({
|
|
97
115
|
scenarioDir,
|
|
@@ -109,39 +127,53 @@ export async function runPack(options: RunPackOptions): Promise<PackResult> {
|
|
|
109
127
|
await writeFile(join(tempDir, entryFileName), entrySource, "utf-8");
|
|
110
128
|
await writeFile(entryHtmlPath, generateEmbedHtml(scenarioId, entryFileName, stage), "utf-8");
|
|
111
129
|
|
|
112
|
-
//
|
|
130
|
+
// 3. Build the static bundle with Vite.
|
|
113
131
|
onLog("Bundling embed with Vite...");
|
|
114
132
|
await runViteBuild({ root: tempDir, outDir, entryHtmlPath });
|
|
115
133
|
|
|
116
|
-
//
|
|
134
|
+
// 4. Copy the narration manifest + audio. The embed fetches
|
|
117
135
|
// ./narration/manifest.json at runtime and resolves each clip's
|
|
118
136
|
// relative src against it, so both must ship in the bundle.
|
|
119
137
|
if (hasNarration) {
|
|
120
138
|
await copyNarration(scenarioDir, outDir);
|
|
121
139
|
}
|
|
122
140
|
|
|
123
|
-
//
|
|
141
|
+
// 5. Write the required scenario.json descriptor, recording the canonical
|
|
124
142
|
// viewport baked into the bundle so `deploy`/`serve`/`publish` can derive
|
|
125
|
-
// a correctly-proportioned embed snippet (DD-004)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
143
|
+
// a correctly-proportioned embed snippet (DD-004), and — when known —
|
|
144
|
+
// the declared shot names so `shoot` and other tooling never boot a
|
|
145
|
+
// browser just to learn a bundle has nothing to capture.
|
|
146
|
+
await writeScenarioJson(
|
|
147
|
+
outDir,
|
|
148
|
+
scenarioId,
|
|
149
|
+
PACK_GENERATOR_VERSION,
|
|
150
|
+
{ width, height: shellHeight },
|
|
151
|
+
collectedShots.recorded ? collectedShots.shots : undefined,
|
|
152
|
+
);
|
|
130
153
|
|
|
131
|
-
//
|
|
154
|
+
// 5b. Copy the optional <scenar-embed> loader into the bundle as embed.js
|
|
132
155
|
// (sibling of index.html), so the enhanced snippet works on any static
|
|
133
156
|
// host (GitHub Pages, `serve`, the edge) with no extra setup. It lands
|
|
134
157
|
// before the manifest pass below so it ships as a first-class bundle file.
|
|
135
158
|
await copyEmbedLoader(outDir);
|
|
136
159
|
|
|
137
|
-
//
|
|
160
|
+
// 6. Compute + write the deploy-facing pack manifest (validates the bundle
|
|
138
161
|
// against the backend allowlist; throws on any violation).
|
|
139
162
|
const manifest = await buildPackManifest(outDir, scenarioId);
|
|
140
163
|
await verifyManifestFilesExist(outDir, manifest);
|
|
141
164
|
await writePackManifest(outDir, manifest);
|
|
142
165
|
|
|
143
166
|
const totalBytes = manifest.files.reduce((sum, f) => sum + f.sizeBytes, 0);
|
|
144
|
-
return {
|
|
167
|
+
return {
|
|
168
|
+
scenarioId,
|
|
169
|
+
outDir,
|
|
170
|
+
renderFilePath,
|
|
171
|
+
providersPath,
|
|
172
|
+
hasNarration,
|
|
173
|
+
shots: collectedShots.recorded ? collectedShots.shots : undefined,
|
|
174
|
+
manifest,
|
|
175
|
+
totalBytes,
|
|
176
|
+
};
|
|
145
177
|
} finally {
|
|
146
178
|
if (!options.keepTemp) {
|
|
147
179
|
await rm(tempDir, { recursive: true, force: true }).catch(() => {});
|
|
@@ -168,6 +200,15 @@ async function copyNarration(scenarioDir: string, outDir: string): Promise<void>
|
|
|
168
200
|
}
|
|
169
201
|
}
|
|
170
202
|
|
|
203
|
+
/** One log-friendly line for the shot discovery outcome. */
|
|
204
|
+
function describeCollectedShots(collected: CollectedPackShots): string {
|
|
205
|
+
if (!collected.recorded) {
|
|
206
|
+
// Vite errors can run many lines; the first carries the message.
|
|
207
|
+
return `unknown — steps module not loadable under Node (${collected.reason.split("\n")[0]})`;
|
|
208
|
+
}
|
|
209
|
+
return collected.shots.length === 0 ? "none declared" : collected.shots.join(", ");
|
|
210
|
+
}
|
|
211
|
+
|
|
171
212
|
async function fileExists(path: string): Promise<boolean> {
|
|
172
213
|
try {
|
|
173
214
|
await access(path);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ShotBrowser } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The real {@link ShotBrowser}: Playwright Chromium with the full spike
|
|
4
|
+
* determinism recipe. Playwright is an optional peer dependency (the
|
|
5
|
+
* remotion/echogarden pattern) — loaded lazily so every other command works
|
|
6
|
+
* without it, and failing with install instructions when absent.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createPlaywrightShotBrowser(): Promise<ShotBrowser>;
|
|
9
|
+
//# sourceMappingURL=playwright-browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playwright-browser.d.ts","sourceRoot":"","sources":["../../../src/shoot/playwright-browser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,YAAY,CAAC;AAuB/D;;;;;GAKG;AACH,wBAAsB,2BAA2B,IAAI,OAAO,CAAC,WAAW,CAAC,CA2FxE"}
|