@beff/aula-cli 0.8.0 → 0.8.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.
Files changed (41) hide show
  1. package/README.md +1 -1
  2. package/dist/src/aula-version-6SX7JIS4.js +55 -0
  3. package/dist/src/{chunk-P5ERWQRZ.js → chunk-CO6PVRRP.js} +1 -1
  4. package/dist/src/{chunk-3T52RRLX.js → chunk-H3SCHOAT.js} +1 -1
  5. package/dist/src/{chunk-SFLLSQQC.js → chunk-L75GJLCT.js} +11 -1
  6. package/dist/src/{chunk-MM5CK3FH.js → chunk-OLAUZCE4.js} +1 -1
  7. package/dist/src/{chunk-OCYYXBFC.js → chunk-Q5GA52JZ.js} +5 -5
  8. package/dist/src/{chunk-RJRTIPDX.js → chunk-S7DEFSFH.js} +13 -13
  9. package/dist/src/{chunk-RRS3SD7K.js → chunk-TYPWU6EF.js} +2 -1
  10. package/dist/src/cli.js +15 -8
  11. package/dist/src/{commands-MPUZFWXF.js → commands-C3ER3SKG.js} +8 -8
  12. package/dist/src/problems-ZPV2ADYA.js +14 -0
  13. package/dist/src/project-MCSMU7LQ.js +12 -0
  14. package/dist/src/{run-FXI6756W.js → run-RSLSQESN.js} +8 -8
  15. package/dist/src/{server-DDZZD235.js → server-X6EO4JBG.js} +6 -6
  16. package/dist/src/{site-QB34UYGW.js → site-BEDOC3S3.js} +6 -6
  17. package/dist/web/app/assets/{3b96b843 → 109a9620}/aula-method.js +1 -1
  18. package/dist/web/app/assets/109a9620/aula.js +1 -0
  19. package/dist/web/app/assets/{3b96b843 → 109a9620}/build-worker.js +1 -1
  20. package/dist/web/app/assets/{3b96b843 → 109a9620}/index.js +2 -2
  21. package/dist/web/app/assets/__vite-browser-external-LEfvJ-Ei.js +1 -0
  22. package/dist/web/app/assets/{aula-voice-worker-OUvhHtjq.js → aula-voice-worker-D4icQuwz.js} +1 -1
  23. package/dist/web/{site/assets/protocol-BnvCw7zV.js → app/assets/protocol-pL5IbzcH.js} +3 -3
  24. package/dist/web/app/assets/{src-CUqPzsYz.js → src-D0RJvTRf.js} +5 -5
  25. package/dist/web/app/index.html +3 -3
  26. package/dist/web/site/assets/{ea493e11 → 998041da}/aula-method.js +1 -1
  27. package/dist/web/site/assets/998041da/aula.js +1 -0
  28. package/dist/web/site/assets/{ea493e11 → 998041da}/build-worker.js +1 -1
  29. package/dist/web/site/assets/{ea493e11 → 998041da}/index.js +2 -2
  30. package/dist/web/site/assets/__vite-browser-external-CKQepNrH.js +1 -0
  31. package/dist/web/site/assets/{aula-voice-worker-CQfH2h75.js → aula-voice-worker-Bj0Mmsvl.js} +1 -1
  32. package/dist/web/{app/assets/protocol-CtrtQiG8.js → site/assets/protocol-DBH1B1P4.js} +3 -3
  33. package/dist/web/site/assets/{src-CPJqNVHd.js → src-Whxqf0pR.js} +5 -5
  34. package/dist/web/site/index.html +3 -3
  35. package/package.json +2 -2
  36. package/dist/src/problems-7MYMBW7E.js +0 -14
  37. package/dist/src/project-B2XEBGUG.js +0 -12
  38. package/dist/web/app/assets/3b96b843/aula.js +0 -1
  39. package/dist/web/app/assets/__vite-browser-external-vebSPdNx.js +0 -1
  40. package/dist/web/site/assets/__vite-browser-external-ZYY1CvYw.js +0 -1
  41. package/dist/web/site/assets/ea493e11/aula.js +0 -1
package/README.md CHANGED
@@ -4,7 +4,7 @@ The `aula` command of [aula](https://github.com/lucasavila00/aula): it runs chap
4
4
 
5
5
  It needs Node 24. Narration (aula-voice) needs only Node. `aula export` needs ffmpeg. Refer to [CLI](https://github.com/lucasavila00/aula/blob/main/docs/agents/cli.md) for the commands and [Getting started](https://github.com/lucasavila00/aula/blob/main/docs/agents/getting-started.md) for the setup.
6
6
 
7
- The package has no model file. The first command that narrates or times a video (`preview`, `timeline`, `export`, `aula web`) downloads the narrator's model into `~/.cache/aula/models/aula-voice/`: the raw model of aula-voice's release [v0.2.0](https://github.com/lucasavila00/aula-voice/releases/tag/v0.2.0) (`model.f16-text-fp32.safetensors` and `config.json`, approximately 21 MB). The CLI checks the SHA-256 of each file, makes the engine's weight file (`aula-voice.avw`) from them, and checks its SHA-256 too. `aula web` narrates in the browser: it serves that file to its page from the same folder. The [model card](https://github.com/lucasavila00/aula-voice/releases/download/v0.2.0/MODEL_CARD.md) has the license of the model, its sources and its training data, and their attribution.
7
+ The package has no model file. The first command that narrates or times a video (`preview`, `timeline`, `export`, `aula web`) downloads the narrator's model into `~/.cache/aula/models/aula-voice/`: the raw model of aula-voice's release [v0.2.1](https://github.com/lucasavila00/aula-voice/releases/tag/v0.2.1) (`model.f16-text-fp32.safetensors` and `config.json`, approximately 21 MB). The CLI checks the SHA-256 of each file, makes the engine's weight file (`aula-voice.avw`) from them, and checks its SHA-256 too. `aula web` narrates in the browser: it serves that file to its page from the same folder. The [model card](https://github.com/lucasavila00/aula-voice/releases/download/v0.2.1/MODEL_CARD.md) has the license of the model, its sources and its training data, and their attribution.
8
8
 
9
9
  ## Licenses
10
10
 
@@ -0,0 +1,55 @@
1
+ import {
2
+ requireMatchingAulaVersion
3
+ } from "./chunk-L75GJLCT.js";
4
+ import "./chunk-S74JLCZK.js";
5
+ import "./chunk-Q5GA52JZ.js";
6
+ import {
7
+ Parsers,
8
+ wrongArgument
9
+ } from "./chunk-TYPWU6EF.js";
10
+
11
+ // src/aula-version.ts
12
+ import { createRequire } from "node:module";
13
+ import path from "node:path";
14
+ import { fileURLToPath } from "node:url";
15
+ var AULA = "@beff/aula";
16
+ function aulaVersionAt(capabilities, fromFile) {
17
+ const require2 = createRequire(fromFile);
18
+ const entry = require2.resolve(AULA);
19
+ let dir = path.dirname(entry);
20
+ for (; ; ) {
21
+ const file = path.join(dir, "package.json");
22
+ if (capabilities.fs.existsSync(file)) {
23
+ const parsed = Parsers.PackageJson.safeParse(JSON.parse(capabilities.fs.readFileSync(file, "utf8")));
24
+ if (parsed.success && parsed.data.name === AULA) {
25
+ const version = parsed.data.version;
26
+ if (typeof version === "string" && version !== "") return version;
27
+ throw wrongArgument(
28
+ `${file} has no version`,
29
+ "align the versions: install the same version of @beff/aula and @beff/aula-cli"
30
+ );
31
+ }
32
+ }
33
+ const parent = path.dirname(dir);
34
+ if (parent === dir) break;
35
+ dir = parent;
36
+ }
37
+ throw wrongArgument(
38
+ `could not find ${AULA}'s package.json from ${entry}`,
39
+ "align the versions: install the same version of @beff/aula and @beff/aula-cli"
40
+ );
41
+ }
42
+ function cliAulaVersion(capabilities) {
43
+ return aulaVersionAt(capabilities, fileURLToPath(import.meta.url));
44
+ }
45
+ function projectAulaVersion(capabilities, folder) {
46
+ return aulaVersionAt(capabilities, path.join(folder, "index.ts"));
47
+ }
48
+ function assertAulaVersion(capabilities, folder) {
49
+ requireMatchingAulaVersion(cliAulaVersion(capabilities), projectAulaVersion(capabilities, folder));
50
+ }
51
+ export {
52
+ assertAulaVersion,
53
+ cliAulaVersion,
54
+ projectAulaVersion
55
+ };
@@ -4,7 +4,7 @@ import {
4
4
  error,
5
5
  projectName,
6
6
  wrongArgument
7
- } from "./chunk-RRS3SD7K.js";
7
+ } from "./chunk-TYPWU6EF.js";
8
8
 
9
9
  // ../aula-project/src/node.ts
10
10
  import path from "node:path";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withSource
3
- } from "./chunk-P5ERWQRZ.js";
3
+ } from "./chunk-CO6PVRRP.js";
4
4
 
5
5
  // src/problems.ts
6
6
  import { loadEngine } from "@beff/aula/run";
@@ -8,7 +8,16 @@ import {
8
8
  isError,
9
9
  linkBundle,
10
10
  wrongArgument
11
- } from "./chunk-RRS3SD7K.js";
11
+ } from "./chunk-TYPWU6EF.js";
12
+
13
+ // ../aula-project/src/aula-version.ts
14
+ function requireMatchingAulaVersion(cli, project) {
15
+ if (cli === project) return;
16
+ throw wrongArgument(
17
+ `the CLI's @beff/aula is ${cli}, but the project has @beff/aula ${project}`,
18
+ "align the versions: install the same version of @beff/aula and @beff/aula-cli"
19
+ );
20
+ }
12
21
 
13
22
  // ../aula-project/src/chapters.ts
14
23
  import { readChapter } from "@beff/aula";
@@ -434,6 +443,7 @@ import { FPS as FPS4 } from "@beff/aula/run";
434
443
  import { estimateNarration } from "@beff/aula/text";
435
444
 
436
445
  export {
446
+ requireMatchingAulaVersion,
437
447
  scriptView,
438
448
  clock,
439
449
  narrationAt,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  host,
3
3
  loadProject
4
- } from "./chunk-P5ERWQRZ.js";
4
+ } from "./chunk-CO6PVRRP.js";
5
5
 
6
6
  // src/project.ts
7
7
  function exists(capabilities, file) {
@@ -283,24 +283,24 @@ var KOKORO_VOCAB = /* @__PURE__ */ new Map([
283
283
  ]);
284
284
 
285
285
  // ../aula-narration/src/aula-voice.ts
286
- var AULA_VOICE_RELEASE = "v0.2.0";
286
+ var AULA_VOICE_RELEASE = "v0.2.1";
287
287
  var RELEASE_URL = `https://github.com/lucasavila00/aula-voice/releases/download/${AULA_VOICE_RELEASE}`;
288
288
  var AULA_VOICE_FILES = {
289
289
  model: {
290
290
  path: "model.f16-text-fp32.safetensors",
291
291
  bytes: 21484448,
292
- sha256: "00dc9a0c9cc1992c8ed16e7a188113d8fec27da919c056a36ffb8b147dbf08dc"
292
+ sha256: "caca7b00f547d3feea506ccd6c534a764d0da2574bd850dd741fa80dd968dc52"
293
293
  },
294
294
  config: {
295
295
  path: "config.json",
296
- bytes: 2214,
297
- sha256: "340eefd2b52b2b3579ff9305414b614cd59437af92952d7815b1dc136e93680d"
296
+ bytes: 2215,
297
+ sha256: "fa0a24abed935cf566d0efd17366af2bd98054b16caf9ccbcb8242e4991bacdc"
298
298
  }
299
299
  };
300
300
  var AULA_VOICE_WEIGHTS = {
301
301
  path: "aula-voice.avw",
302
302
  bytes: 21474688,
303
- sha256: "a1ef7a8c151a975f002d7c4262c5677056e9fc3601a440469aacabc3eeeb1c6b"
303
+ sha256: "98f886dafba9abfb98bbe1c1143ee026d08e579c7926c88501535c543f92212b"
304
304
  };
305
305
  var SERVER_WEIGHTS_PATH = `/models/${AULA_VOICE_WEIGHTS.path}`;
306
306
  var aulaVoiceUrl = (file) => `${RELEASE_URL}/${file.path}`;
@@ -1,3 +1,6 @@
1
+ import {
2
+ createNodeBundler
3
+ } from "./chunk-THQ5Y74K.js";
1
4
  import {
2
5
  VIDEO,
3
6
  assemble,
@@ -6,7 +9,14 @@ import {
6
9
  } from "./chunk-BLKXJGEO.js";
7
10
  import {
8
11
  printDiagnostics
9
- } from "./chunk-3T52RRLX.js";
12
+ } from "./chunk-H3SCHOAT.js";
13
+ import {
14
+ host
15
+ } from "./chunk-OLAUZCE4.js";
16
+ import {
17
+ folderOf,
18
+ nameOf
19
+ } from "./chunk-CO6PVRRP.js";
10
20
  import {
11
21
  chapterIndexes,
12
22
  checkProject,
@@ -26,22 +36,12 @@ import {
26
36
  targetChapters,
27
37
  timelineView,
28
38
  wordNotes
29
- } from "./chunk-SFLLSQQC.js";
30
- import {
31
- createNodeBundler
32
- } from "./chunk-THQ5Y74K.js";
39
+ } from "./chunk-L75GJLCT.js";
33
40
  import {
34
41
  narrateScript,
35
42
  scriptAudio,
36
43
  wav
37
44
  } from "./chunk-S74JLCZK.js";
38
- import {
39
- host
40
- } from "./chunk-MM5CK3FH.js";
41
- import {
42
- folderOf,
43
- nameOf
44
- } from "./chunk-P5ERWQRZ.js";
45
45
  import {
46
46
  ObjectRuntype,
47
47
  OptionalFieldRuntype,
@@ -54,7 +54,7 @@ import {
54
54
  bundle,
55
55
  isError,
56
56
  wrongArgument
57
- } from "./chunk-RRS3SD7K.js";
57
+ } from "./chunk-TYPWU6EF.js";
58
58
 
59
59
  // src/commands.ts
60
60
  import path2 from "node:path";
@@ -981,12 +981,13 @@ var direct_hoist_1 = new AnyRuntype(void 0);
981
981
  var direct_hoist_2 = new TypeofRuntype(void 0, "string");
982
982
  var direct_hoist_3 = new ArrayRuntype(void 0, direct_hoist_2);
983
983
  var direct_hoist_4 = new ObjectRuntype({
984
- "description": "The part of a package.json that aula reads: how a package names its module and its\nworkspace packages."
984
+ "description": "The part of a package.json that aula reads: how a package names its module and its\nworkspace packages, and its version when the CLI compares it to the project's."
985
985
  }, {
986
986
  "exports": new OptionalFieldRuntype(direct_hoist_1),
987
987
  "main": new OptionalFieldRuntype(direct_hoist_2),
988
988
  "module": new OptionalFieldRuntype(direct_hoist_2),
989
989
  "name": new OptionalFieldRuntype(direct_hoist_2),
990
+ "version": new OptionalFieldRuntype(direct_hoist_2),
990
991
  "workspaces": new OptionalFieldRuntype(direct_hoist_3)
991
992
  }, []);
992
993
  Object.assign(namedRuntypes, {
package/dist/src/cli.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  studentWeightFile,
15
15
  timeAulaVoice,
16
16
  tokenBatches
17
- } from "./chunk-OCYYXBFC.js";
17
+ } from "./chunk-Q5GA52JZ.js";
18
18
 
19
19
  // src/cli.ts
20
20
  import { spawn } from "node:child_process";
@@ -280,9 +280,9 @@ var base = Capabilities.create({
280
280
  },
281
281
  spawn
282
282
  });
283
- var { diagnosticsOf, printDiagnostics } = await import("./problems-7MYMBW7E.js");
284
- var { host, loadProject } = await import("./project-B2XEBGUG.js");
285
- var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, siteOptions, webOptions } = await import("./run-FXI6756W.js");
283
+ var { diagnosticsOf, printDiagnostics } = await import("./problems-ZPV2ADYA.js");
284
+ var { host, loadProject } = await import("./project-MCSMU7LQ.js");
285
+ var { USAGE, folderArgs, isHelp, optionsOf, parse, run: run2, siteOptions, webOptions } = await import("./run-RSLSQESN.js");
286
286
  var locks = createLocks(base, path3.join(os.homedir(), ".cache/aula/heavy.lock"));
287
287
  var render = createRender(base, process.execPath);
288
288
  var models = path3.join(os.homedir(), ".cache/aula/models");
@@ -305,7 +305,10 @@ async function main(argv) {
305
305
  }
306
306
  const args = parse(rest, optionsOf(command));
307
307
  if (command === "web") {
308
- const { serve } = await import("./server-DDZZD235.js");
308
+ const { assertAulaVersion } = await import("./aula-version-6SX7JIS4.js");
309
+ const options2 = webOptions(cwd, args);
310
+ assertAulaVersion(capabilities, options2.root);
311
+ const { serve } = await import("./server-X6EO4JBG.js");
309
312
  const stop = new AbortController();
310
313
  for (const signal of ["SIGINT", "SIGTERM"]) process.once(signal, () => stop.abort());
311
314
  const web = Capabilities.create({
@@ -317,21 +320,25 @@ async function main(argv) {
317
320
  return watcher;
318
321
  }
319
322
  });
320
- await serve(Capabilities.extend(capabilities, web), { ...webOptions(cwd, args), stop: stop.signal });
323
+ await serve(Capabilities.extend(capabilities, web), { ...options2, stop: stop.signal });
321
324
  return 0;
322
325
  }
323
326
  if (command === "site") {
324
- const { site } = await import("./site-QB34UYGW.js");
327
+ const { site } = await import("./site-BEDOC3S3.js");
325
328
  const weights = Capabilities.create({ weights: aulaVoiceWeights(base, fetch, models) });
326
329
  return await site(Capabilities.extend(capabilities, weights), siteOptions(cwd, args)) ? 0 : 1;
327
330
  }
328
331
  if (command === "tokens") {
329
- const { tokens, tokensArgs } = await import("./commands-MPUZFWXF.js");
332
+ const { tokens, tokensArgs } = await import("./commands-C3ER3SKG.js");
330
333
  tokensArgs(args.positional);
331
334
  const tokensOf = createTokens();
332
335
  return await tokens(capabilities, tokensOf, createInterface({ input: process.stdin, crlfDelay: Infinity })) ? 0 : 1;
333
336
  }
334
337
  const { folder, rest: after } = folderArgs(cwd, command, args);
338
+ if (command === "check") {
339
+ const { assertAulaVersion } = await import("./aula-version-6SX7JIS4.js");
340
+ assertAulaVersion(capabilities, folder);
341
+ }
335
342
  const only = command === "preview" ? after.slice(1) : command === "check" || command === "timeline" ? after : [];
336
343
  const project = await loadProject(capabilities, cwd, folder, only);
337
344
  return await run2(capabilities, cwd, command, project, after, args.flags) ? 0 : 1;
@@ -7,17 +7,17 @@ import {
7
7
  timeline,
8
8
  tokens,
9
9
  tokensArgs
10
- } from "./chunk-RJRTIPDX.js";
10
+ } from "./chunk-S7DEFSFH.js";
11
+ import "./chunk-THQ5Y74K.js";
11
12
  import "./chunk-BLKXJGEO.js";
12
13
  import "./chunk-2XGNOG2U.js";
13
- import "./chunk-3T52RRLX.js";
14
- import "./chunk-SFLLSQQC.js";
15
- import "./chunk-THQ5Y74K.js";
14
+ import "./chunk-H3SCHOAT.js";
15
+ import "./chunk-OLAUZCE4.js";
16
+ import "./chunk-CO6PVRRP.js";
17
+ import "./chunk-L75GJLCT.js";
16
18
  import "./chunk-S74JLCZK.js";
17
- import "./chunk-OCYYXBFC.js";
18
- import "./chunk-MM5CK3FH.js";
19
- import "./chunk-P5ERWQRZ.js";
20
- import "./chunk-RRS3SD7K.js";
19
+ import "./chunk-Q5GA52JZ.js";
20
+ import "./chunk-TYPWU6EF.js";
21
21
  export {
22
22
  bundle,
23
23
  check,
@@ -0,0 +1,14 @@
1
+ import {
2
+ printDiagnostics
3
+ } from "./chunk-H3SCHOAT.js";
4
+ import "./chunk-CO6PVRRP.js";
5
+ import "./chunk-L75GJLCT.js";
6
+ import "./chunk-S74JLCZK.js";
7
+ import "./chunk-Q5GA52JZ.js";
8
+ import {
9
+ diagnosticsOf
10
+ } from "./chunk-TYPWU6EF.js";
11
+ export {
12
+ diagnosticsOf,
13
+ printDiagnostics
14
+ };
@@ -0,0 +1,12 @@
1
+ import {
2
+ exists,
3
+ host,
4
+ loadProject
5
+ } from "./chunk-OLAUZCE4.js";
6
+ import "./chunk-CO6PVRRP.js";
7
+ import "./chunk-TYPWU6EF.js";
8
+ export {
9
+ exists,
10
+ host,
11
+ loadProject
12
+ };
@@ -5,19 +5,19 @@ import {
5
5
  preview,
6
6
  script,
7
7
  timeline
8
- } from "./chunk-RJRTIPDX.js";
8
+ } from "./chunk-S7DEFSFH.js";
9
+ import "./chunk-THQ5Y74K.js";
9
10
  import "./chunk-BLKXJGEO.js";
10
11
  import "./chunk-2XGNOG2U.js";
11
- import "./chunk-3T52RRLX.js";
12
- import "./chunk-SFLLSQQC.js";
13
- import "./chunk-THQ5Y74K.js";
12
+ import "./chunk-H3SCHOAT.js";
13
+ import "./chunk-OLAUZCE4.js";
14
+ import "./chunk-CO6PVRRP.js";
15
+ import "./chunk-L75GJLCT.js";
14
16
  import "./chunk-S74JLCZK.js";
15
- import "./chunk-OCYYXBFC.js";
16
- import "./chunk-MM5CK3FH.js";
17
- import "./chunk-P5ERWQRZ.js";
17
+ import "./chunk-Q5GA52JZ.js";
18
18
  import {
19
19
  wrongArgument
20
- } from "./chunk-RRS3SD7K.js";
20
+ } from "./chunk-TYPWU6EF.js";
21
21
 
22
22
  // src/run.ts
23
23
  import path from "node:path";
@@ -5,17 +5,17 @@ import {
5
5
  createNodeBundler,
6
6
  nodeTree
7
7
  } from "./chunk-THQ5Y74K.js";
8
+ import {
9
+ exists
10
+ } from "./chunk-OLAUZCE4.js";
11
+ import "./chunk-CO6PVRRP.js";
8
12
  import "./chunk-S74JLCZK.js";
9
13
  import {
10
14
  SERVER_WEIGHTS_PATH
11
- } from "./chunk-OCYYXBFC.js";
12
- import {
13
- exists
14
- } from "./chunk-MM5CK3FH.js";
15
- import "./chunk-P5ERWQRZ.js";
15
+ } from "./chunk-Q5GA52JZ.js";
16
16
  import {
17
17
  bundleWorkspace
18
- } from "./chunk-RRS3SD7K.js";
18
+ } from "./chunk-TYPWU6EF.js";
19
19
 
20
20
  // src/web/server.ts
21
21
  import { once } from "node:events";
@@ -1,7 +1,3 @@
1
- import {
2
- loadBuiltProjects,
3
- workspaceHost
4
- } from "./chunk-SFLLSQQC.js";
5
1
  import {
6
2
  PACKAGE
7
3
  } from "./chunk-A5QHTZKT.js";
@@ -9,16 +5,20 @@ import {
9
5
  createNodeBundler,
10
6
  nodeTree
11
7
  } from "./chunk-THQ5Y74K.js";
8
+ import {
9
+ loadBuiltProjects,
10
+ workspaceHost
11
+ } from "./chunk-L75GJLCT.js";
12
12
  import "./chunk-S74JLCZK.js";
13
13
  import {
14
14
  AULA_VOICE_WEIGHTS
15
- } from "./chunk-OCYYXBFC.js";
15
+ } from "./chunk-Q5GA52JZ.js";
16
16
  import {
17
17
  Problems,
18
18
  bundleWorkspace,
19
19
  projectModules,
20
20
  wrongArgument
21
- } from "./chunk-RRS3SD7K.js";
21
+ } from "./chunk-TYPWU6EF.js";
22
22
 
23
23
  // src/site.ts
24
24
  import os from "node:os";
@@ -1 +1 @@
1
- import{m as e,y as t}from"../src-CUqPzsYz.js";var n=e=>JSON.stringify(e);function r(e){return!/\s/.test(e)&&!e.includes(`://`)&&/[/.]/.test(e)}function i(e,t,i){let a=[],o=(t,n=e.place)=>{a.push({message:t,...n===void 0?{}:{at:n}})};i.mechanism.trim()===``&&o(`the paragraph has no mechanism: name the one mechanism that the viewer must understand`);for(let e of i.sources)r(e)&&!t.exists(e)&&o(`${n(e)}: this path is not a file: correct the path or add the file`);return a}function a(n){let r=t(`paragraph`,n);return({sources:t},n)=>e({mechanism:r,sources:t},n??((e,n)=>i(e,n,{mechanism:r,sources:t})))}export{i as findings,a as paragraph};
1
+ import{m as e,y as t}from"../src-D0RJvTRf.js";var n=e=>JSON.stringify(e);function r(e){return!/\s/.test(e)&&!e.includes(`://`)&&/[/.]/.test(e)}function i(e,t,i){let a=[],o=(t,n=e.place)=>{a.push({message:t,...n===void 0?{}:{at:n}})};i.mechanism.trim()===``&&o(`the paragraph has no mechanism: name the one mechanism that the viewer must understand`);for(let e of i.sources)r(e)&&!t.exists(e)&&o(`${n(e)}: this path is not a file: correct the path or add the file`);return a}function a(n){let r=t(`paragraph`,n);return({sources:t},n)=>e({mechanism:r,sources:t},n??((e,n)=>i(e,n,{mechanism:r,sources:t})))}export{i as findings,a as paragraph};
@@ -0,0 +1 @@
1
+ export{n as checkChapter,r as checkLexicon,i as checkTitle,u as defineChapter,d as defineProject,f as embed,p as isProjectDefinition,t as m,m as paragraph,h as pronounce,o as readChapter,s as renderChapter,g as renderScene,_ as say,v as show,y as tagText}from"../src-D0RJvTRf.js";
@@ -1,2 +1,2 @@
1
- import{r as e,t}from"../rolldown-runtime-BLXQ4ufn.js";import{a as n,d as r,f as i,g as a,h as o,i as s,l as c,n as l,o as u,p as d,u as f}from"../protocol-CtrtQiG8.js";import{S as p,w as m,x as h}from"../src-CUqPzsYz.js";var g=44,_=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,v=new Uint8Array(64),y=new Uint8Array(128);for(let e=0;e<_.length;e++){let t=_.charCodeAt(e);v[e]=t,y[t]=e}function b(e){let t=0,n=0,r=0;do r=y[e.next()],t|=(r&31)<<n,n+=5;while(r&32);return t}function x(e){return e&1?-0x80000000|-(e>>>1):e>>>1}function S(e,t){return e.pos>=t?!1:e.peek()!==g}var ee=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}};function C(e){let{length:t}=e,n=new ee(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i+=x(b(n)),i<u&&(l=!1),u=i,S(n,e)?(a+=x(b(n)),o+=x(b(n)),s+=x(b(n)),S(n,e)?(c+=x(b(n)),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||w(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function w(e){e.sort(te)}function te(e,t){return e[0]-t[0]}var T=e(t(((e,t,n)=>{var r;(function(n,i){typeof e==`object`&&t!==void 0?t.exports=i():typeof r==`function`&&r.amd?r(i):(n=typeof globalThis<`u`?globalThis:n||self,n.resolveURI=i())})(n,(function(){let e=/^[\w+.-]+:\/\//,t=/^([\w+.-]+:)\/\/([^@/#?]*@)?(\[[^\]]+\]|[^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,n=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function r(t){return e.test(t)}function i(e){return e.startsWith(`//`)}function a(e){return e.startsWith(`/`)}function o(e){return e.startsWith(`file:`)}function s(e){return/^[.?#]/.test(e)}function c(e){let n=t.exec(e);return u(n[1],n[2]||``,n[3],n[4]||``,n[5]||`/`,n[6]||``,n[7]||``)}function l(e){let t=n.exec(e),r=t[2];return u(`file:`,``,t[1]||``,``,a(r)?r:`/`+r,t[3]||``,t[4]||``)}function u(e,t,n,r,i,a,o){return{scheme:e,user:t,host:n,port:r,path:i,query:a,hash:o,type:7}}function d(e){if(i(e)){let t=c(`http:`+e);return t.scheme=``,t.type=6,t}if(a(e)){let t=c(`http://foo.com`+e);return t.scheme=``,t.host=``,t.type=5,t}if(o(e))return l(e);if(r(e))return c(e);let t=c(`http://foo.com/`+e);return t.scheme=``,t.host=``,t.type=e?e.startsWith(`?`)?3:e.startsWith(`#`)?2:4:1,t}function f(e){if(e.endsWith(`/..`))return e;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function p(e,t){m(t,t.type),e.path=e.path===`/`?t.path:f(t.path)+e.path}function m(e,t){let n=t<=4,r=e.path.split(`/`),i=1,a=0,o=!1;for(let e=1;e<r.length;e++){let t=r[e];t?(o=!1,t!==`.`&&(t===`..`?a?(o=!0,a--,i--):n&&(r[i++]=t):(r[i++]=t,a++))):o=!0}let s=``;for(let e=1;e<i;e++)s+=`/`+r[e];(!s||o&&!s.endsWith(`/..`))&&(s+=`/`),e.path=s}function h(e,t){if(!e&&!t)return``;let n=d(e),r=n.type;if(t&&r!==7){let e=d(t),i=e.type;switch(r){case 1:n.hash=e.hash;case 2:n.query=e.query;case 3:case 4:p(n,e);case 5:n.user=e.user,n.host=e.host,n.port=e.port;case 6:n.scheme=e.scheme}i>r&&(r=i)}m(n,r);let i=n.query+n.hash;switch(r){case 2:case 3:return i;case 4:{let r=n.path.slice(1);return r?s(t||e)&&!s(r)?`./`+r+i:r+i:i||`.`}case 5:return n.path+i;default:return n.scheme+`//`+n.user+n.host+n.port+n.path+i}}return h}))}))(),1);function ne(e){if(!e)return``;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function re(e,t){let n=ne(e),r=t?t+`/`:``;return e=>(0,T.default)(r+(e||``),n)}var E=0,ie=1,ae=2,oe=3,D=4;function O(e,t){let n=k(e,0);if(n===e.length)return e;t||(e=e.slice());for(let r=n;r<e.length;r=k(e,r+1))e[r]=j(e[r],t);return e}function k(e,t){for(let n=t;n<e.length;n++)if(!A(e[n]))return n;return e.length}function A(e){for(let t=1;t<e.length;t++)if(e[t][E]<e[t-1][E])return!1;return!0}function j(e,t){return t||(e=e.slice()),e.sort(M)}function M(e,t){return e[E]-t[E]}var N=!1;function P(e,t,n,r){for(;n<=r;){let i=n+(r-n>>1),a=e[i][E]-t;if(a===0)return N=!0,i;a<0?n=i+1:r=i-1}return N=!1,n-1}function F(e,t,n){for(let r=n+1;r<e.length&&e[r][E]===t;n=r++);return n}function I(e,t,n){for(let r=n-1;r>=0&&e[r][E]===t;n=r--);return n}function L(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function R(e,t,n,r){let{lastKey:i,lastNeedle:a,lastIndex:o}=n,s=0,c=e.length-1;if(r===i){if(t===a)return N=o!==-1&&e[o][E]===t,o;t>=a?s=o===-1?0:o:c=o}return n.lastKey=r,n.lastNeedle=t,n.lastIndex=P(e,t,s,c)}function z(e){return typeof e==`string`?JSON.parse(e):e}var B="`line` must be greater than 0 (lines start at line 1)",V="`column` must be greater than or equal to 0 (columns start at column 0)",H=class{constructor(e,t){let n=typeof e==`string`;if(!n&&e._decodedMemo)return e;let r=z(e),{version:i,file:a,names:o,sourceRoot:s,sources:c,sourcesContent:l}=r;this.version=i,this.file=a,this.names=o||[],this.sourceRoot=s,this.sources=c,this.sourcesContent=l,this.ignoreList=r.ignoreList||r.x_google_ignoreList||void 0;let u=re(t,s);this.resolvedSources=c.map(u);let{mappings:d}=r;if(typeof d==`string`)this._encoded=d,this._decoded=void 0;else if(Array.isArray(d))this._encoded=void 0,this._decoded=O(d,n);else if(r.sections)throw Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);else throw Error(`invalid source map: ${JSON.stringify(r)}`);this._decodedMemo=L(),this._bySources=void 0,this._bySourceMemos=void 0}};function U(e){return e}function W(e){var t;return(t=U(e))._decoded||(t._decoded=C(U(e)._encoded))}function G(e,t){let{line:n,column:r,bias:i}=t;if(n--,n<0)throw Error(B);if(r<0)throw Error(V);let a=W(e);if(n>=a.length)return K(null,null,null,null);let o=a[n],s=q(o,U(e)._decodedMemo,n,r,i||1);if(s===-1)return K(null,null,null,null);let c=o[s];if(c.length===1)return K(null,null,null,null);let{names:l,resolvedSources:u}=e;return K(u[c[ie]],c[ae]+1,c[oe],c.length===5?l[c[D]]:null)}function K(e,t,n,r){return{source:e,line:t,column:n,name:r}}function q(e,t,n,r,i){let a=R(e,r,t,n);return N?a=(i===-1?F:I)(e,r,a):i===-1&&a++,a===-1||a===e.length?-1:a}var J=new Map;function se(e,t,n){J.set(e,{map:new H(t),prefix:n})}function ce(e,t,n){let r=J.get(e);if(!r)return{file:e,line:t,column:n};let i=G(r.map,{line:t,column:n-1});return i.source===null||i.line===null||i.column===null?{file:e,line:t,column:n}:{file:i.source.startsWith(r.prefix)?i.source.slice(r.prefix.length):i.source,line:i.line,column:i.column+1}}var Y=a(ce);function le(e){let t=0,r=new Map;e.then(e=>{e.addEventListener(`message`,t=>{let i=t.data;if(i.kind===`error`)throw e.close(),new n(`the narrator stopped: ${i.message}`,i.stack);let a=r.get(i.id);r.delete(i.id),a?.(i)}),e.start()});let i=async(n,i)=>{let a=await e;return new Promise(e=>{let o=t++;r.set(o,e),a.postMessage({id:o,kind:n,words:i})})};return{speak:async e=>{let t=await i(`speak`,e);if(t.kind!==`speech`)throw Error(`the narrator answered ${t.kind} to a speech`);return{samples:t.samples,sampleRate:t.sampleRate,words:t.words}},time:async e=>{let t=await i(`time`,e);if(t.kind!==`timing`)throw Error(`the narrator answered ${t.kind} to a clock`);return{samples:t.samples,sampleRate:t.sampleRate,words:t.words}}}}function X(e){let t=0,n=0,a=!1,u=new Map,d=n=>{let r=r=>{let i=t++,{promise:a,resolve:o}=Promise.withResolvers();return u.set(i,o),e.post({kind:`files`,id:i,tree:n,question:r},[]),a};return{bundle:async()=>{let e=await r({kind:`bundle`});if(e.kind!==`bundle`)throw Error(`the page answered ${e.kind} to a question of the bundle`);return e.result},name:async()=>{let e=await r({kind:`name`});if(e.kind!==`name`)throw Error(`the page answered ${e.kind} to a question of the name`);return e.name},read:async e=>{let t=await r({kind:`read`,path:e});if(t.kind!==`read`)throw Error(`the page answered ${t.kind} to a read of ${e}`);return t.text},bytes:async e=>{let t=await r({kind:`bytes`,path:e});if(t.kind!==`bytes`)throw Error(`the page answered ${t.kind} to a read of the bytes of ${e}`);return t.bytes},list:async e=>{let t=await r({kind:`list`,folder:e});if(t.kind!==`list`)throw Error(`the page answered ${t.kind} to a list of ${e}`);return t.names}}},m=async()=>{let t=d(n++),o=new Map,s=new Set,c=e=>{let t=o.get(e);return t===void 0&&s.add(e),t?{size:t.length,read:()=>t}:void 0},[l]=await Promise.all([t.bundle(),p().then(async()=>{await h(),e.post({kind:`stage`,stage:`engine`},[])})]),u;if(l!==null){if(l._tag===`Left`)return e.post({kind:`stage`,stage:`project`},[]),l;u=await f(l.right,i(Y,c),e.modules,e.player)}else{let n=await t.name();if(n===null)return e.post({kind:`stage`,stage:`project`},[]),{_tag:`Right`,right:[]};let a={name:()=>Promise.resolve(n),read:t.read,list:t.list},o=await e.bundler();u=await r(a,i(Y,c),e.modules,o,e.player)}if(e.post({kind:`stage`,stage:`project`},[]),u._tag===`Left`)return u;a||(a=!0,e.post({kind:`narrator`},[]));let m=async e=>{for(;;){s.clear();let n=e(),r=[...s].filter(e=>!o.has(e));if(r.length===0)return n;await Promise.all(r.map(async e=>o.set(e,await t.bytes(e))))}};return{_tag:`Right`,right:u.right.map(e=>{let t=new Set;return{...e,readScript:()=>m(()=>e.script()),readChapter:async n=>{t.has(n)||(await m(()=>e.walk?.(n)),t.add(n))}}})}},g=Promise.withResolvers(),_=o(c.create({voice:le(g.promise),workspace:{projects:m}})),v=[],y=(t,{chapters:n,...r})=>{let i=[],a=[],o=[];n.forEach((e,t)=>{let n=v[t];if(e===n)return;if(!e){i.push([t,void 0]);return}let r=n?.cues.map(e=>e.samples)??[];if(e.animation!==n?.animation){let{animation:n,cues:a,...o}=e,c=a.map(e=>{let t=e.samples?r.indexOf(e.samples):-1;return t===-1?null:t}),l=a.map(({at:e,length:t},n)=>({at:e,length:t,keep:c[n]??null}));i.push([t,{...o,lottie:s(n),cues:l}]),r=c.map(e=>e===null?void 0:r[e])}e.cues.forEach((e,n)=>{if(!e.samples||e.samples===r[n])return;let i=e.samples.slice();o.push(i.buffer),a.push({chapter:t,cue:n,samples:i})})}),v=n;let c={...r,errors:l(r.errors),warnings:l(r.warnings)};e.post({kind:`state`,watch:t,state:c,count:n.length,drawings:i,sounds:a},o)};return t=>{switch(t.kind){case`list`:_.build.list().then(n=>{let r=n._tag===`Left`?{_tag:`Left`,left:l(n.left)}:n;e.post({kind:`listed`,id:t.id,videos:r},[])});return;case`watch`:v=[],_.build.watch(t.name,{changed:e=>{y(t.watch,e)}});return;case`seek`:_.build.seek(t.name,t.place);return;case`halt`:_.halt();return;case`refresh`:_.refresh(t.place);return;case`files`:{let e=u.get(t.id);u.delete(t.id),e?.(t.answer);return}case`narrator`:g.resolve(t.port);return}}}var Z=(e,t=[])=>{self.postMessage(e,{transfer:t})},Q=e=>{let t=u(e,Y);Z({kind:`error`,message:t.message,stack:t.stack.map(e=>` ${e}`).join(`
1
+ import{r as e,t}from"../rolldown-runtime-BLXQ4ufn.js";import{a as n,d as r,f as i,g as a,h as o,i as s,l as c,n as l,o as u,p as d,u as f}from"../protocol-pL5IbzcH.js";import{S as p,w as m,x as h}from"../src-D0RJvTRf.js";var g=44,_=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,v=new Uint8Array(64),y=new Uint8Array(128);for(let e=0;e<_.length;e++){let t=_.charCodeAt(e);v[e]=t,y[t]=e}function b(e){let t=0,n=0,r=0;do r=y[e.next()],t|=(r&31)<<n,n+=5;while(r&32);return t}function x(e){return e&1?-0x80000000|-(e>>>1):e>>>1}function S(e,t){return e.pos>=t?!1:e.peek()!==g}var ee=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}};function C(e){let{length:t}=e,n=new ee(e),r=[],i=0,a=0,o=0,s=0,c=0;do{let e=n.indexOf(`;`),t=[],l=!0,u=0;for(i=0;n.pos<e;){let r;i+=x(b(n)),i<u&&(l=!1),u=i,S(n,e)?(a+=x(b(n)),o+=x(b(n)),s+=x(b(n)),S(n,e)?(c+=x(b(n)),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||w(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function w(e){e.sort(te)}function te(e,t){return e[0]-t[0]}var T=e(t(((e,t,n)=>{var r;(function(n,i){typeof e==`object`&&t!==void 0?t.exports=i():typeof r==`function`&&r.amd?r(i):(n=typeof globalThis<`u`?globalThis:n||self,n.resolveURI=i())})(n,(function(){let e=/^[\w+.-]+:\/\//,t=/^([\w+.-]+:)\/\/([^@/#?]*@)?(\[[^\]]+\]|[^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,n=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function r(t){return e.test(t)}function i(e){return e.startsWith(`//`)}function a(e){return e.startsWith(`/`)}function o(e){return e.startsWith(`file:`)}function s(e){return/^[.?#]/.test(e)}function c(e){let n=t.exec(e);return u(n[1],n[2]||``,n[3],n[4]||``,n[5]||`/`,n[6]||``,n[7]||``)}function l(e){let t=n.exec(e),r=t[2];return u(`file:`,``,t[1]||``,``,a(r)?r:`/`+r,t[3]||``,t[4]||``)}function u(e,t,n,r,i,a,o){return{scheme:e,user:t,host:n,port:r,path:i,query:a,hash:o,type:7}}function d(e){if(i(e)){let t=c(`http:`+e);return t.scheme=``,t.type=6,t}if(a(e)){let t=c(`http://foo.com`+e);return t.scheme=``,t.host=``,t.type=5,t}if(o(e))return l(e);if(r(e))return c(e);let t=c(`http://foo.com/`+e);return t.scheme=``,t.host=``,t.type=e?e.startsWith(`?`)?3:e.startsWith(`#`)?2:4:1,t}function f(e){if(e.endsWith(`/..`))return e;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function p(e,t){m(t,t.type),e.path=e.path===`/`?t.path:f(t.path)+e.path}function m(e,t){let n=t<=4,r=e.path.split(`/`),i=1,a=0,o=!1;for(let e=1;e<r.length;e++){let t=r[e];t?(o=!1,t!==`.`&&(t===`..`?a?(o=!0,a--,i--):n&&(r[i++]=t):(r[i++]=t,a++))):o=!0}let s=``;for(let e=1;e<i;e++)s+=`/`+r[e];(!s||o&&!s.endsWith(`/..`))&&(s+=`/`),e.path=s}function h(e,t){if(!e&&!t)return``;let n=d(e),r=n.type;if(t&&r!==7){let e=d(t),i=e.type;switch(r){case 1:n.hash=e.hash;case 2:n.query=e.query;case 3:case 4:p(n,e);case 5:n.user=e.user,n.host=e.host,n.port=e.port;case 6:n.scheme=e.scheme}i>r&&(r=i)}m(n,r);let i=n.query+n.hash;switch(r){case 2:case 3:return i;case 4:{let r=n.path.slice(1);return r?s(t||e)&&!s(r)?`./`+r+i:r+i:i||`.`}case 5:return n.path+i;default:return n.scheme+`//`+n.user+n.host+n.port+n.path+i}}return h}))}))(),1);function ne(e){if(!e)return``;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function re(e,t){let n=ne(e),r=t?t+`/`:``;return e=>(0,T.default)(r+(e||``),n)}var E=0,ie=1,ae=2,oe=3,D=4;function O(e,t){let n=k(e,0);if(n===e.length)return e;t||(e=e.slice());for(let r=n;r<e.length;r=k(e,r+1))e[r]=j(e[r],t);return e}function k(e,t){for(let n=t;n<e.length;n++)if(!A(e[n]))return n;return e.length}function A(e){for(let t=1;t<e.length;t++)if(e[t][E]<e[t-1][E])return!1;return!0}function j(e,t){return t||(e=e.slice()),e.sort(M)}function M(e,t){return e[E]-t[E]}var N=!1;function P(e,t,n,r){for(;n<=r;){let i=n+(r-n>>1),a=e[i][E]-t;if(a===0)return N=!0,i;a<0?n=i+1:r=i-1}return N=!1,n-1}function F(e,t,n){for(let r=n+1;r<e.length&&e[r][E]===t;n=r++);return n}function I(e,t,n){for(let r=n-1;r>=0&&e[r][E]===t;n=r--);return n}function L(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function R(e,t,n,r){let{lastKey:i,lastNeedle:a,lastIndex:o}=n,s=0,c=e.length-1;if(r===i){if(t===a)return N=o!==-1&&e[o][E]===t,o;t>=a?s=o===-1?0:o:c=o}return n.lastKey=r,n.lastNeedle=t,n.lastIndex=P(e,t,s,c)}function z(e){return typeof e==`string`?JSON.parse(e):e}var B="`line` must be greater than 0 (lines start at line 1)",V="`column` must be greater than or equal to 0 (columns start at column 0)",H=class{constructor(e,t){let n=typeof e==`string`;if(!n&&e._decodedMemo)return e;let r=z(e),{version:i,file:a,names:o,sourceRoot:s,sources:c,sourcesContent:l}=r;this.version=i,this.file=a,this.names=o||[],this.sourceRoot=s,this.sources=c,this.sourcesContent=l,this.ignoreList=r.ignoreList||r.x_google_ignoreList||void 0;let u=re(t,s);this.resolvedSources=c.map(u);let{mappings:d}=r;if(typeof d==`string`)this._encoded=d,this._decoded=void 0;else if(Array.isArray(d))this._encoded=void 0,this._decoded=O(d,n);else if(r.sections)throw Error(`TraceMap passed sectioned source map, please use FlattenMap export instead`);else throw Error(`invalid source map: ${JSON.stringify(r)}`);this._decodedMemo=L(),this._bySources=void 0,this._bySourceMemos=void 0}};function U(e){return e}function W(e){var t;return(t=U(e))._decoded||(t._decoded=C(U(e)._encoded))}function G(e,t){let{line:n,column:r,bias:i}=t;if(n--,n<0)throw Error(B);if(r<0)throw Error(V);let a=W(e);if(n>=a.length)return K(null,null,null,null);let o=a[n],s=q(o,U(e)._decodedMemo,n,r,i||1);if(s===-1)return K(null,null,null,null);let c=o[s];if(c.length===1)return K(null,null,null,null);let{names:l,resolvedSources:u}=e;return K(u[c[ie]],c[ae]+1,c[oe],c.length===5?l[c[D]]:null)}function K(e,t,n,r){return{source:e,line:t,column:n,name:r}}function q(e,t,n,r,i){let a=R(e,r,t,n);return N?a=(i===-1?F:I)(e,r,a):i===-1&&a++,a===-1||a===e.length?-1:a}var J=new Map;function se(e,t,n){J.set(e,{map:new H(t),prefix:n})}function ce(e,t,n){let r=J.get(e);if(!r)return{file:e,line:t,column:n};let i=G(r.map,{line:t,column:n-1});return i.source===null||i.line===null||i.column===null?{file:e,line:t,column:n}:{file:i.source.startsWith(r.prefix)?i.source.slice(r.prefix.length):i.source,line:i.line,column:i.column+1}}var Y=a(ce);function le(e){let t=0,r=new Map;e.then(e=>{e.addEventListener(`message`,t=>{let i=t.data;if(i.kind===`error`)throw e.close(),new n(`the narrator stopped: ${i.message}`,i.stack);let a=r.get(i.id);r.delete(i.id),a?.(i)}),e.start()});let i=async(n,i)=>{let a=await e;return new Promise(e=>{let o=t++;r.set(o,e),a.postMessage({id:o,kind:n,words:i})})};return{speak:async e=>{let t=await i(`speak`,e);if(t.kind!==`speech`)throw Error(`the narrator answered ${t.kind} to a speech`);return{samples:t.samples,sampleRate:t.sampleRate,words:t.words}},time:async e=>{let t=await i(`time`,e);if(t.kind!==`timing`)throw Error(`the narrator answered ${t.kind} to a clock`);return{samples:t.samples,sampleRate:t.sampleRate,words:t.words}}}}function X(e){let t=0,n=0,a=!1,u=new Map,d=n=>{let r=r=>{let i=t++,{promise:a,resolve:o}=Promise.withResolvers();return u.set(i,o),e.post({kind:`files`,id:i,tree:n,question:r},[]),a};return{bundle:async()=>{let e=await r({kind:`bundle`});if(e.kind!==`bundle`)throw Error(`the page answered ${e.kind} to a question of the bundle`);return e.result},name:async()=>{let e=await r({kind:`name`});if(e.kind!==`name`)throw Error(`the page answered ${e.kind} to a question of the name`);return e.name},read:async e=>{let t=await r({kind:`read`,path:e});if(t.kind!==`read`)throw Error(`the page answered ${t.kind} to a read of ${e}`);return t.text},bytes:async e=>{let t=await r({kind:`bytes`,path:e});if(t.kind!==`bytes`)throw Error(`the page answered ${t.kind} to a read of the bytes of ${e}`);return t.bytes},list:async e=>{let t=await r({kind:`list`,folder:e});if(t.kind!==`list`)throw Error(`the page answered ${t.kind} to a list of ${e}`);return t.names}}},m=async()=>{let t=d(n++),o=new Map,s=new Set,c=e=>{let t=o.get(e);return t===void 0&&s.add(e),t?{size:t.length,read:()=>t}:void 0},[l]=await Promise.all([t.bundle(),p().then(async()=>{await h(),e.post({kind:`stage`,stage:`engine`},[])})]),u;if(l!==null){if(l._tag===`Left`)return e.post({kind:`stage`,stage:`project`},[]),l;u=await f(l.right,i(Y,c),e.modules,e.player)}else{let n=await t.name();if(n===null)return e.post({kind:`stage`,stage:`project`},[]),{_tag:`Right`,right:[]};let a={name:()=>Promise.resolve(n),read:t.read,list:t.list},o=await e.bundler();u=await r(a,i(Y,c),e.modules,o,e.player)}if(e.post({kind:`stage`,stage:`project`},[]),u._tag===`Left`)return u;a||(a=!0,e.post({kind:`narrator`},[]));let m=async e=>{for(;;){s.clear();let n=e(),r=[...s].filter(e=>!o.has(e));if(r.length===0)return n;await Promise.all(r.map(async e=>o.set(e,await t.bytes(e))))}};return{_tag:`Right`,right:u.right.map(e=>{let t=new Set;return{...e,readScript:()=>m(()=>e.script()),readChapter:async n=>{t.has(n)||(await m(()=>e.walk?.(n)),t.add(n))}}})}},g=Promise.withResolvers(),_=o(c.create({voice:le(g.promise),workspace:{projects:m}})),v=[],y=(t,{chapters:n,...r})=>{let i=[],a=[],o=[];n.forEach((e,t)=>{let n=v[t];if(e===n)return;if(!e){i.push([t,void 0]);return}let r=n?.cues.map(e=>e.samples)??[];if(e.animation!==n?.animation){let{animation:n,cues:a,...o}=e,c=a.map(e=>{let t=e.samples?r.indexOf(e.samples):-1;return t===-1?null:t}),l=a.map(({at:e,length:t},n)=>({at:e,length:t,keep:c[n]??null}));i.push([t,{...o,lottie:s(n),cues:l}]),r=c.map(e=>e===null?void 0:r[e])}e.cues.forEach((e,n)=>{if(!e.samples||e.samples===r[n])return;let i=e.samples.slice();o.push(i.buffer),a.push({chapter:t,cue:n,samples:i})})}),v=n;let c={...r,errors:l(r.errors),warnings:l(r.warnings)};e.post({kind:`state`,watch:t,state:c,count:n.length,drawings:i,sounds:a},o)};return t=>{switch(t.kind){case`list`:_.build.list().then(n=>{let r=n._tag===`Left`?{_tag:`Left`,left:l(n.left)}:n;e.post({kind:`listed`,id:t.id,videos:r},[])});return;case`watch`:v=[],_.build.watch(t.name,{changed:e=>{y(t.watch,e)}});return;case`seek`:_.build.seek(t.name,t.place);return;case`halt`:_.halt();return;case`refresh`:_.refresh(t.place);return;case`files`:{let e=u.get(t.id);u.delete(t.id),e?.(t.answer);return}case`narrator`:g.resolve(t.port);return}}}var Z=(e,t=[])=>{self.postMessage(e,{transfer:t})},Q=e=>{let t=u(e,Y);Z({kind:`error`,message:t.message,stack:t.stack.map(e=>` ${e}`).join(`
2
2
  `)})};self.addEventListener(`error`,e=>{e.preventDefault(),Q(e.error??Error(e.message))}),self.addEventListener(`unhandledrejection`,e=>{e.preventDefault(),Q(e.reason)});var ue={"@beff/aula":new URL(`./aula.js`,import.meta.url).href,"@beff/aula-method":new URL(`./aula-method.js`,import.meta.url).href},de={load:async({code:e,map:t})=>{let n=URL.createObjectURL(new Blob([e],{type:`text/javascript`}));return se(n,t,d),{url:n,exports:await import(n)}}},$=null;function fe(){return $??=(async()=>{let t=performance.now(),[n,r]=await Promise.all([m(()=>import(`../browser-sNTR4ahh.js`).then(t=>e(t.default,1)),[]),m(()=>import(`../esbuild-D6hmBtXM.js`),[])]);return await n.initialize({wasmURL:r.default,worker:!1}),console.log(`aula: esbuild loaded in ${((performance.now()-t)/1e3).toFixed(1)} s`),n})(),$}var pe=X({post:Z,bundler:fe,modules:de,player:ue});self.addEventListener(`message`,e=>{pe(e.data)});