@beff/aula-cli 0.6.0 → 0.6.2
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/dist/src/aula-render.core.wasm +0 -0
- package/dist/src/{chunk-2NMVSQG4.js → chunk-3MPFI4UE.js} +17 -0
- package/dist/src/{chunk-DQ2NGXNI.js → chunk-6CZECZIX.js} +1 -1
- package/dist/src/{chunk-EQ3DVZV5.js → chunk-7C6QW2TD.js} +1 -1
- package/dist/src/{chunk-2TQ4F6GS.js → chunk-EB67KE2S.js} +14 -14
- package/dist/src/chunk-EZROW2IP.js +127 -0
- package/dist/src/{chunk-5VYKT646.js → chunk-J7LNPVU2.js} +5 -4
- package/dist/src/{chunk-YBHISJLN.js → chunk-LSXILCMB.js} +132 -16
- package/dist/src/{chunk-6LC3WXJ7.js → chunk-PLBRKNMD.js} +20 -5
- package/dist/src/cli.js +23 -13
- package/dist/src/{commands-IECUGFP2.js → commands-7MTNNJKO.js} +8 -8
- package/dist/src/problems-CCUJW4H4.js +14 -0
- package/dist/src/project-PF77AQKF.js +12 -0
- package/dist/src/{run-ASNQVEK4.js → run-VCOTEL37.js} +8 -8
- package/dist/src/{server-YQYW4FT4.js → server-5W36J7WM.js} +4 -4
- package/dist/src/{site-SVNNSF72.js → site-NA5QNSHF.js} +74 -24
- package/dist/web/app/assets/{32426b96 → 3cdff963}/aula-method.js +1 -1
- package/dist/web/app/assets/{32426b96 → 3cdff963}/aula.js +1 -1
- package/dist/web/app/assets/{32426b96 → 3cdff963}/build-worker.js +2 -2
- package/dist/web/app/assets/3cdff963/index.js +53 -0
- package/dist/web/app/assets/__vite-browser-external-CTDtqMqs.js +1 -0
- package/dist/web/app/assets/{aula-voice-worker-BG_u7zxq.js → aula-voice-worker-C7UeMloK.js} +2 -2
- package/dist/web/app/assets/{aula.core5-CPBL2gnc.wasm → aula.core5-DVDCNzCV.wasm} +0 -0
- package/dist/web/{site/assets/index-Dcly6eU3.css → app/assets/index-BirjmJbl.css} +1 -1
- package/dist/web/app/assets/{protocol-n-0ok9fE.js → protocol-C3MGnf_t.js} +4 -4
- package/dist/web/app/assets/{src-KAOnACo0.js → src-CTZjQYUv.js} +2 -2
- package/dist/web/app/index.html +27 -4
- package/dist/web/site/assets/__vite-browser-external-D1sFDdqr.js +1 -0
- package/dist/web/site/assets/{aula-voice-worker-BefmgHnb.js → aula-voice-worker-DHEZKCCg.js} +2 -2
- package/dist/web/site/assets/{aula.core5-CPBL2gnc.wasm → aula.core5-DVDCNzCV.wasm} +0 -0
- package/dist/web/site/assets/{e2472609 → fbc21d75}/aula-method.js +1 -1
- package/dist/web/site/assets/{e2472609 → fbc21d75}/aula.js +1 -1
- package/dist/web/site/assets/{e2472609 → fbc21d75}/build-worker.js +2 -2
- package/dist/web/site/assets/fbc21d75/index.js +53 -0
- package/dist/web/{app/assets/index-DtOukfzG.css → site/assets/index-BirjmJbl.css} +1 -1
- package/dist/web/site/assets/{protocol-FHUBS3VF.js → protocol-CzWPeNPI.js} +4 -4
- package/dist/web/site/assets/{src-BOEiwkOC.js → src-1_dQqt80.js} +2 -2
- package/dist/web/site/index.html +27 -4
- package/package.json +2 -2
- package/dist/src/chunk-JVCECTG2.js +0 -77
- package/dist/src/problems-U4QXN6RO.js +0 -14
- package/dist/src/project-WS7P5VIH.js +0 -12
- package/dist/web/app/assets/32426b96/index.js +0 -52
- package/dist/web/app/assets/__vite-browser-external-FFXyTDbk.js +0 -1
- package/dist/web/site/assets/__vite-browser-external-BFOz4dSd.js +0 -1
- package/dist/web/site/assets/e2472609/index.js +0 -52
|
@@ -5,19 +5,19 @@ import {
|
|
|
5
5
|
preview,
|
|
6
6
|
script,
|
|
7
7
|
timeline
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-EB67KE2S.js";
|
|
9
|
+
import "./chunk-6CZECZIX.js";
|
|
10
10
|
import "./chunk-BLKXJGEO.js";
|
|
11
11
|
import "./chunk-2XGNOG2U.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-7C6QW2TD.js";
|
|
13
|
+
import "./chunk-LSXILCMB.js";
|
|
14
14
|
import "./chunk-S74JLCZK.js";
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
17
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-PLBRKNMD.js";
|
|
16
|
+
import "./chunk-J7LNPVU2.js";
|
|
17
|
+
import "./chunk-EZROW2IP.js";
|
|
18
18
|
import {
|
|
19
19
|
wrongArgument
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-3MPFI4UE.js";
|
|
21
21
|
|
|
22
22
|
// src/run.ts
|
|
23
23
|
import path from "node:path";
|
|
@@ -4,12 +4,12 @@ import {
|
|
|
4
4
|
import "./chunk-S74JLCZK.js";
|
|
5
5
|
import {
|
|
6
6
|
SERVER_WEIGHTS_PATH
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PLBRKNMD.js";
|
|
8
8
|
import {
|
|
9
9
|
exists
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-J7LNPVU2.js";
|
|
11
|
+
import "./chunk-EZROW2IP.js";
|
|
12
|
+
import "./chunk-3MPFI4UE.js";
|
|
13
13
|
|
|
14
14
|
// src/web/server.ts
|
|
15
15
|
import { once } from "node:events";
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
diskTree,
|
|
3
3
|
packageFiles
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import
|
|
4
|
+
} from "./chunk-6CZECZIX.js";
|
|
5
|
+
import {
|
|
6
|
+
loadProjects,
|
|
7
|
+
workspaceHost
|
|
8
|
+
} from "./chunk-LSXILCMB.js";
|
|
6
9
|
import {
|
|
7
10
|
PACKAGE
|
|
8
11
|
} from "./chunk-A5QHTZKT.js";
|
|
9
12
|
import "./chunk-S74JLCZK.js";
|
|
10
13
|
import {
|
|
11
14
|
AULA_VOICE_WEIGHTS
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-PLBRKNMD.js";
|
|
13
16
|
import {
|
|
14
17
|
Problems,
|
|
18
|
+
pathsTree,
|
|
15
19
|
projectModules,
|
|
16
20
|
wrongArgument
|
|
17
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-3MPFI4UE.js";
|
|
18
22
|
|
|
19
23
|
// src/site.ts
|
|
24
|
+
import os from "node:os";
|
|
20
25
|
import path from "node:path";
|
|
21
|
-
import { fileURLToPath } from "node:url";
|
|
26
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
22
27
|
import { fault } from "@beff/aula/errors";
|
|
28
|
+
import { v8Frames } from "@beff/aula/run";
|
|
23
29
|
var PAGE = new URL("web/site/", PACKAGE);
|
|
24
30
|
var PAGE_FOLDER = fileURLToPath(PAGE);
|
|
25
31
|
var WRITTEN = ["index.html", "assets", "tree", "tree.json", AULA_VOICE_WEIGHTS.path];
|
|
@@ -50,30 +56,65 @@ async function differs(capabilities, files, at, source) {
|
|
|
50
56
|
const [a, b] = await Promise.all([capabilities.fs.readFile(kept), capabilities.fs.readFile(source)]);
|
|
51
57
|
return !sameBytes(new Uint8Array(a), new Uint8Array(b));
|
|
52
58
|
}
|
|
53
|
-
|
|
59
|
+
var METHOD_STUB = "export const findings = () => [];\nexport const paragraph = () => () => ({});\n";
|
|
60
|
+
async function packages(capabilities, esbuild, folder, modules) {
|
|
54
61
|
const root = path.parse(folder).root;
|
|
55
62
|
const home = path.relative(root, folder).split(path.sep).join("/");
|
|
56
63
|
const tree = diskTree(capabilities, root);
|
|
57
64
|
const files = /* @__PURE__ */ new Map();
|
|
58
|
-
const
|
|
65
|
+
for (const { module } of modules) {
|
|
66
|
+
const own = path.posix.dirname(module);
|
|
67
|
+
const project = own === "." ? home : `${home}/${own}`;
|
|
68
|
+
const found = await packageFiles(esbuild, tree, project);
|
|
69
|
+
if (found._tag === "Left") throw new Problems(found.left);
|
|
70
|
+
const apart = /* @__PURE__ */ new Set();
|
|
71
|
+
for (const [at, from] of found.right) {
|
|
72
|
+
if (await differs(capabilities, files, at, path.join(root, from))) apart.add(packageOf(at));
|
|
73
|
+
}
|
|
74
|
+
for (const [at, from] of found.right) {
|
|
75
|
+
files.set(apart.has(packageOf(at)) ? `${own}/${at}` : at, path.join(root, from));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return files;
|
|
79
|
+
}
|
|
80
|
+
async function listVideos(capabilities, esbuild, name, paths, files) {
|
|
81
|
+
const tree = pathsTree(paths, async (at) => {
|
|
82
|
+
const from = files.get(at);
|
|
83
|
+
return from === void 0 ? null : capabilities.fs.readFile(from, "utf8");
|
|
84
|
+
});
|
|
85
|
+
const workspace = {
|
|
86
|
+
name: () => Promise.resolve(name),
|
|
87
|
+
read: (at) => tree.read(at),
|
|
88
|
+
list: (folder) => tree.list(folder)
|
|
89
|
+
};
|
|
90
|
+
const scratch = await capabilities.fs.mkdtemp(path.join(os.tmpdir(), "aula-site-videos-"));
|
|
91
|
+
let count = 0;
|
|
59
92
|
try {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
93
|
+
const method = path.join(scratch, "aula-method.mjs");
|
|
94
|
+
await capabilities.fs.writeFile(method, METHOD_STUB);
|
|
95
|
+
const player = {
|
|
96
|
+
"@beff/aula": import.meta.resolve("@beff/aula"),
|
|
97
|
+
"@beff/aula-method": pathToFileURL(method).href
|
|
98
|
+
};
|
|
99
|
+
const modules = {
|
|
100
|
+
load: async ({ code }) => {
|
|
101
|
+
count += 1;
|
|
102
|
+
const file = path.join(scratch, `bundle-${String(count)}.mjs`);
|
|
103
|
+
await capabilities.fs.writeFile(file, code);
|
|
104
|
+
const url = pathToFileURL(file).href;
|
|
105
|
+
return { url, exports: await import(url) };
|
|
71
106
|
}
|
|
72
|
-
}
|
|
107
|
+
};
|
|
108
|
+
const loaded = await loadProjects(workspace, workspaceHost(v8Frames), modules, esbuild, player);
|
|
109
|
+
if (loaded._tag === "Left") throw new Problems(loaded.left);
|
|
110
|
+
return loaded.right.map(({ name: projectName, title, section }) => ({
|
|
111
|
+
name: projectName,
|
|
112
|
+
title,
|
|
113
|
+
...section === void 0 ? {} : { section }
|
|
114
|
+
}));
|
|
73
115
|
} finally {
|
|
74
|
-
await
|
|
116
|
+
await capabilities.fs.rm(scratch, { recursive: true, force: true });
|
|
75
117
|
}
|
|
76
|
-
return files;
|
|
77
118
|
}
|
|
78
119
|
async function pageFiles(capabilities) {
|
|
79
120
|
if (!capabilities.fs.existsSync(new URL("index.html", PAGE))) {
|
|
@@ -106,7 +147,17 @@ async function site(capabilities, options) {
|
|
|
106
147
|
}
|
|
107
148
|
const own = await walk(capabilities, folder);
|
|
108
149
|
const files = new Map(own.map((file) => [file, path.join(folder, file)]));
|
|
109
|
-
|
|
150
|
+
const folderName = path.basename(folder);
|
|
151
|
+
const esbuild = await import("esbuild-wasm");
|
|
152
|
+
let paths;
|
|
153
|
+
let videos;
|
|
154
|
+
try {
|
|
155
|
+
for (const [at, from] of await packages(capabilities, esbuild, folder, listed.right)) files.set(at, from);
|
|
156
|
+
paths = [...files.keys()].toSorted();
|
|
157
|
+
videos = await listVideos(capabilities, esbuild, folderName, paths, files);
|
|
158
|
+
} finally {
|
|
159
|
+
await esbuild.stop();
|
|
160
|
+
}
|
|
110
161
|
const weights = await capabilities.weights();
|
|
111
162
|
const page = await pageFiles(capabilities);
|
|
112
163
|
const html = pageHtml(await capabilities.fs.readFile(path.join(PAGE_FOLDER, "index.html"), "utf8"), title, base);
|
|
@@ -121,11 +172,10 @@ async function site(capabilities, options) {
|
|
|
121
172
|
};
|
|
122
173
|
for (const file of page) if (file !== "index.html") await copy(path.join(PAGE_FOLDER, file), path.join(out, file));
|
|
123
174
|
for (const [at, from] of files) await copy(from, path.join(out, "tree", at));
|
|
124
|
-
const paths = [...files.keys()].toSorted();
|
|
125
175
|
await capabilities.fs.writeFile(path.join(out, "index.html"), html);
|
|
126
176
|
await capabilities.fs.writeFile(
|
|
127
177
|
path.join(out, "tree.json"),
|
|
128
|
-
JSON.stringify({ name:
|
|
178
|
+
JSON.stringify({ name: folderName, files: paths, videos })
|
|
129
179
|
);
|
|
130
180
|
await capabilities.fs.writeFile(path.join(out, AULA_VOICE_WEIGHTS.path), weights);
|
|
131
181
|
capabilities.log.out(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e,y as t}from"../src-
|
|
1
|
+
import{m as e,y as t}from"../src-CTZjQYUv.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 +1 @@
|
|
|
1
|
-
export{t as checkChapter,n as checkLexicon,r as checkTitle,u as defineChapter,d as defineProject,f as embed,p as isProjectDefinition,c as m,m as paragraph,h as pronounce,a as readChapter,o as renderChapter,g as renderScene,_ as say,v as show,y as tagText}from"../src-
|
|
1
|
+
export{t as checkChapter,n as checkLexicon,r as checkTitle,u as defineChapter,d as defineProject,f as embed,p as isProjectDefinition,c as m,m as paragraph,h as pronounce,a as readChapter,o as renderChapter,g as renderScene,_ as say,v as show,y as tagText}from"../src-CTZjQYUv.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e,t}from"../rolldown-runtime-BLXQ4ufn.js";import{a as n,d as r,f as i,h as a,i as o,l as s,m as c,n as l,o as u,u as d}from"../protocol-
|
|
1
|
+
import{r as e,t}from"../rolldown-runtime-BLXQ4ufn.js";import{a as n,d as r,f as i,h as a,i as o,l as s,m as c,n as l,o as u,u as d}from"../protocol-C3MGnf_t.js";var f=e(t(((e,t)=>{(e=>{var t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.prototype.hasOwnProperty,a=(e,n)=>{for(var r in n)t(e,r,{get:n[r],enumerable:!0})},o=(e,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(let c of r(a))!i.call(e,c)&&c!==o&&t(e,c,{get:()=>a[c],enumerable:!(s=n(a,c))||s.enumerable});return e},s=e=>o(t({},`__esModule`,{value:!0}),e),c=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),l={};a(l,{analyzeMetafile:()=>be,analyzeMetafileSync:()=>we,build:()=>ge,buildSync:()=>xe,context:()=>_e,default:()=>je,formatMessages:()=>ye,formatMessagesSync:()=>Ce,initialize:()=>ke,stop:()=>Te,transform:()=>ve,transformSync:()=>Se,version:()=>he}),e.exports=s(l);function u(e){let t=e=>{if(e===null)n.write8(0);else if(typeof e==`boolean`)n.write8(1),n.write8(+e);else if(typeof e==`number`)n.write8(2),n.write32(e|0);else if(typeof e==`string`)n.write8(3),n.write(p(e));else if(e instanceof Uint8Array)n.write8(4),n.write(e);else if(e instanceof Array){n.write8(5),n.write32(e.length);for(let n of e)t(n)}else{let r=Object.keys(e);n.write8(6),n.write32(r.length);for(let i of r)n.write(p(i)),t(e[i])}},n=new f;return n.write32(0),n.write32(e.id<<1|!e.isRequest),t(e.value),_(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function d(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return m(n.read());case 4:return n.read();case 5:{let e=n.read32(),r=[];for(let n=0;n<e;n++)r.push(t());return r}case 6:{let e=n.read32(),r={};for(let i=0;i<e;i++)r[m(n.read())]=t();return r}default:throw Error(`Invalid packet`)}},n=new f(e),r=n.read32(),i=!(r&1);r>>>=1;let a=t();if(n.ptr!==e.length)throw Error(`Invalid packet`);return{id:r,isRequest:i,value:a}}var f=class{constructor(e=new Uint8Array(1024)){this.buf=e,this.len=0,this.ptr=0}_write(e){if(this.len+e>this.buf.length){let t=new Uint8Array((this.len+e)*2);t.set(this.buf),this.buf=t}return this.len+=e,this.len-e}write8(e){let t=this._write(1);this.buf[t]=e}write32(e){let t=this._write(4);_(this.buf,e,t)}write(e){let t=this._write(4+e.length);_(this.buf,e.length,t),this.buf.set(e,t+4)}_read(e){if(this.ptr+e>this.buf.length)throw Error(`Invalid packet`);return this.ptr+=e,this.ptr-e}read8(){return this.buf[this._read(1)]}read32(){return g(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),n=this._read(t.length);return t.set(this.buf.subarray(n,n+e)),t}},p,m,h;if(typeof TextEncoder<`u`&&typeof TextDecoder<`u`){let e=new TextEncoder,t=new TextDecoder;p=t=>e.encode(t),m=e=>t.decode(e),h=`new TextEncoder().encode("")`}else if(typeof Buffer<`u`)p=e=>Buffer.from(e),m=e=>{let{buffer:t,byteOffset:n,byteLength:r}=e;return Buffer.from(t,n,r).toString()},h=`Buffer.from("")`;else throw Error(`No UTF-8 codec found`);if(!(p(``)instanceof Uint8Array))throw Error(`Invariant violation: "${h} instanceof Uint8Array" is incorrectly false
|
|
2
2
|
|
|
3
3
|
This indicates that your JavaScript environment is broken. You cannot use
|
|
4
4
|
esbuild in this environment because esbuild relies on this invariant. This
|
|
@@ -692,5 +692,5 @@ ${n}:${r}:${i}: ERROR: ${e.pluginName?`[plugin: ${e.pluginName}] `:``}${e.text}`
|
|
|
692
692
|
})(postMessage)`],{type:`text/javascript`});r=new Worker(URL.createObjectURL(e))}else{let e=(e=>{var t=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())});let n,r={};for(let e=self;e;e=Object.getPrototypeOf(e))for(let t of Object.getOwnPropertyNames(e))t in r||Object.defineProperty(r,t,{get:()=>self[t]});(()=>{let e=()=>{let e=Error(`not implemented`);return e.code=`ENOSYS`,e};if(!r.fs){let t=``;r.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1,O_DIRECTORY:-1},writeSync(e,n){t+=i.decode(n);let r=t.lastIndexOf(`
|
|
693
693
|
`);return r!=-1&&(console.log(t.substring(0,r)),t=t.substring(r+1)),n.length},write(t,n,r,i,a,o){r!==0||i!==n.length||a!==null?o(e()):o(null,this.writeSync(t,n))},chmod(t,n,r){r(e())},chown(t,n,r,i){i(e())},close(t,n){n(e())},fchmod(t,n,r){r(e())},fchown(t,n,r,i){i(e())},fstat(t,n){n(e())},fsync(e,t){t(null)},ftruncate(t,n,r){r(e())},lchown(t,n,r,i){i(e())},link(t,n,r){r(e())},lstat(t,n){n(e())},mkdir(t,n,r){r(e())},open(t,n,r,i){i(e())},read(t,n,r,i,a,o){o(e())},readdir(t,n){n(e())},readlink(t,n){n(e())},rename(t,n,r){r(e())},rmdir(t,n){n(e())},stat(t,n){n(e())},symlink(t,n,r){r(e())},truncate(t,n,r){r(e())},unlink(t,n){n(e())},utimes(t,n,r,i){i(e())}}}if(r.process||={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw e()},pid:-1,ppid:-1,umask(){throw e()},cwd(){throw e()},chdir(){throw e()}},r.path||={resolve(...e){return e.join(`/`)}},!r.crypto)throw Error(`globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)`);if(!r.performance)throw Error(`globalThis.performance is not available, polyfill required (performance.now only)`);if(!r.TextEncoder)throw Error(`globalThis.TextEncoder is not available, polyfill required`);if(!r.TextDecoder)throw Error(`globalThis.TextDecoder is not available, polyfill required`);let n=new TextEncoder(`utf-8`),i=new TextDecoder(`utf-8`);r.Go=class{constructor(){this.argv=[`js`],this.env={},this.exit=e=>{e!==0&&console.warn(`exit code:`,e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;let e=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},t=e=>this.mem.getUint32(e+0,!0)+this.mem.getInt32(e+4,!0)*4294967296,a=e=>{let t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;let n=this.mem.getUint32(e,!0);return this._values[n]},o=(e,t)=>{let n=0x7ff80000;if(typeof t==`number`&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,n,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let r=this._ids.get(t);r===void 0&&(r=this._idPool.pop(),r===void 0&&(r=this._values.length),this._values[r]=t,this._goRefCounts[r]=0,this._ids.set(t,r)),this._goRefCounts[r]++;let i=0;switch(typeof t){case`object`:t!==null&&(i=1);break;case`string`:i=2;break;case`symbol`:i=3;break;case`function`:i=4}this.mem.setUint32(e+4,n|i,!0),this.mem.setUint32(e,r,!0)},s=e=>{let n=t(e+0),r=t(e+8);return new Uint8Array(this._inst.exports.mem.buffer,n,r)},c=e=>{let n=t(e+0),r=t(e+8),i=Array(r);for(let e=0;e<r;e++)i[e]=a(n+e*8);return i},l=e=>{let n=t(e+0),r=t(e+8);return i.decode(new DataView(this._inst.exports.mem.buffer,n,r))},u=(e,t)=>(this._inst.exports.testExport0(),this._inst.exports.testExport(e,t)),d=Date.now()-performance.now();this.importObject={_gotest:{add:(e,t)=>e+t,callExport:u},gojs:{"runtime.wasmExit":e=>{e>>>=0;let t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e>>>=0;let n=t(e+8),i=t(e+16),a=this.mem.getInt32(e+24,!0);r.fs.writeSync(n,new Uint8Array(this._inst.exports.mem.buffer,i,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":t=>{t>>>=0,e(t+8,(d+performance.now())*1e6)},"runtime.walltime":t=>{t>>>=0;let n=new Date().getTime();e(t+8,n/1e3),this.mem.setInt32(t+16,n%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;let n=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(n,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(n);)console.warn(`scheduleTimeoutEvent: missed timeout event`),this._resume()},t(e+8))),this.mem.setInt32(e+16,n,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;let t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(s(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;let t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){let e=this._values[t];this._values[t]=null,this._ids.delete(e),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,o(e+24,l(e+8))},"syscall/js.valueGet":e=>{e>>>=0;let t=Reflect.get(a(e+8),l(e+16));e=this._inst.exports.getsp()>>>0,o(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(a(e+8),l(e+16),a(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(a(e+8),l(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,o(e+24,Reflect.get(a(e+8),t(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(a(e+8),t(e+16),a(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{let t=a(e+8),n=Reflect.get(t,l(e+16)),r=c(e+32),i=Reflect.apply(n,t,r);e=this._inst.exports.getsp()>>>0,o(e+56,i),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,o(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{let t=a(e+8),n=c(e+16),r=Reflect.apply(t,void 0,n);e=this._inst.exports.getsp()>>>0,o(e+40,r),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{let t=a(e+8),n=c(e+16),r=Reflect.construct(t,n);e=this._inst.exports.getsp()>>>0,o(e+40,r),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,o(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":t=>{t>>>=0,e(t+16,parseInt(a(t+8).length))},"syscall/js.valuePrepareString":t=>{t>>>=0;let r=n.encode(String(a(t+8)));o(t+16,r),e(t+24,r.length)},"syscall/js.valueLoadString":e=>{e>>>=0;let t=a(e+8);s(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,+(a(e+8)instanceof a(e+16)))},"syscall/js.copyBytesToGo":t=>{t>>>=0;let n=s(t+8),r=a(t+32);if(!(r instanceof Uint8Array||r instanceof Uint8ClampedArray)){this.mem.setUint8(t+48,0);return}let i=r.subarray(0,n.length);n.set(i),e(t+40,i.length),this.mem.setUint8(t+48,1)},"syscall/js.copyBytesToJS":t=>{t>>>=0;let n=a(t+8),r=s(t+16);if(!(n instanceof Uint8Array||n instanceof Uint8ClampedArray)){this.mem.setUint8(t+48,0);return}let i=r.subarray(0,n.length);n.set(i),e(t+40,i.length),this.mem.setUint8(t+48,1)},debug:e=>{console.log(e)}}}}run(e){return t(this,null,function*(){if(!(e instanceof WebAssembly.Instance))throw Error(`Go.run: WebAssembly.Instance expected`);this._inst=e,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,r,this],this._goRefCounts=Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[r,5],[this,6]]),this._idPool=[],this.exited=!1;let t=4096,i=e=>{let r=t,i=n.encode(e+`\0`);return new Uint8Array(this.mem.buffer,t,i.length).set(i),t+=i.length,t%8!=0&&(t+=8-t%8),r},a=this.argv.length,o=[];this.argv.forEach(e=>{o.push(i(e))}),o.push(0),Object.keys(this.env).sort().forEach(e=>{o.push(i(`${e}=${this.env[e]}`))}),o.push(0);let s=t;if(o.forEach(e=>{this.mem.setUint32(t,e,!0),this.mem.setUint32(t+4,0,!0),t+=8}),t>=12288)throw Error(`total length of command line and environment variables exceeds limit`);this._inst.exports.run(a,s),this.exited&&this._resolveExitPromise(),yield this._exitPromise})}_resume(){if(this.exited)throw Error(`Go program has already exited`);this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(e){let t=this;return function(){let n={id:e,this:this,args:arguments};return t._pendingEvent=n,t._resume(),n.result}}}})(),n=({data:t})=>{let a=new TextDecoder,o=r.fs,s=``;o.writeSync=(t,n)=>{if(t===1)e(n);else if(t===2){s+=a.decode(n);let e=s.split(`
|
|
694
694
|
`);e.length>1&&console.log(e.slice(0,-1).join(`
|
|
695
|
-
`)),s=e[e.length-1]}else throw Error(`Bad write`);return n.length};let c=[],l,u=0;n=({data:e})=>(e.length>0&&(c.push(e),l&&l()),d),o.read=(e,t,n,r,i,a)=>{if(e!==0||n!==0||r!==t.length||i!==null)throw Error(`Bad read`);if(c.length===0){l=()=>o.read(e,t,n,r,i,a);return}let s=c[0],d=Math.max(0,Math.min(r,s.length-u));t.set(s.subarray(u,u+d),n),u+=d,u===s.length&&(c.shift(),u=0),a(null,d)};let d=new r.Go;return d.argv=[``,`--service=0.28.2`],i(t,d).then(t=>{e(null),d.run(t)},t=>{e(t)}),d};function i(e,n){return t(this,null,function*(){if(e instanceof WebAssembly.Module)return WebAssembly.instantiate(e,n.importObject);let t=yield fetch(e);if(!t.ok)throw Error(`Failed to download ${JSON.stringify(e)}`);if(`instantiateStreaming`in WebAssembly&&/^application\/wasm($|;)/i.test(t.headers.get(`Content-Type`)||``))return(yield WebAssembly.instantiateStreaming(t,n.importObject)).instance;let r=yield t.arrayBuffer();return(yield WebAssembly.instantiate(r,n.importObject)).instance})}return e=>n(e)})(e=>r.onmessage({data:e})),t;r={onmessage:null,postMessage:n=>setTimeout(()=>{try{t=e({data:n})}catch(e){i(e)}}),terminate(){if(t)for(let e of t._scheduledTimeouts.values())clearTimeout(e)}}}let o,s,c=new Promise((e,t)=>{o=e,s=t});r.onmessage=({data:e})=>{r.onmessage=({data:e})=>u(e),e?s(e):o()},r.postMessage(t||new URL(e,location.href).toString());let{readFromStdout:u,service:d}=K({writeToStdin(e){r.postMessage(e)},isSync:!1,hasFS:!1,esbuild:l});yield c,Ee=()=>{r.terminate(),$=void 0,Ee=void 0,De=void 0},De={build:e=>new Promise((t,n)=>{a.then(n),d.buildOrContext({callName:`build`,refs:null,options:e,isTTY:!1,defaultWD:`/`,callback:(e,r)=>e?n(e):t(r)})}),context:e=>new Promise((t,n)=>{a.then(n),d.buildOrContext({callName:`context`,refs:null,options:e,isTTY:!1,defaultWD:`/`,callback:(e,r)=>e?n(e):t(r)})}),transform:(e,t)=>new Promise((n,r)=>{a.then(r),d.transform({callName:`transform`,refs:null,input:e,options:t||{},isTTY:!1,fs:{readFile(e,t){t(Error(`Internal error`),null)},writeFile(e,t){t(null)}},callback:(e,t)=>e?r(e):n(t)})}),formatMessages:(e,t)=>new Promise((n,r)=>{a.then(r),d.formatMessages({callName:`formatMessages`,refs:null,messages:e,options:t,callback:(e,t)=>e?r(e):n(t)})}),analyzeMetafile:(e,t)=>new Promise((n,r)=>{a.then(r),d.analyzeMetafile({callName:`analyzeMetafile`,refs:null,metafile:typeof e==`string`?e:JSON.stringify(e),options:t,callback:(e,t)=>e?r(e):n(t)})})}}),je=l})(typeof t==`object`?t:{set exports(e){(typeof self<`u`?self:this).esbuild=e}})}))(),1),p=`/assets/esbuild-BaXVPFT2.wasm`,m=44,h=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,g=new Uint8Array(64),_=new Uint8Array(128);for(let e=0;e<h.length;e++){let t=h.charCodeAt(e);g[e]=t,_[t]=e}function v(e){let t=0,n=0,r=0;do r=_[e.next()],t|=(r&31)<<n,n+=5;while(r&32);return t}function y(e){return e&1?-0x80000000|-(e>>>1):e>>>1}function b(e,t){return e.pos>=t?!1:e.peek()!==m}var x=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 S(e){let{length:t}=e,n=new x(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+=y(v(n)),i<u&&(l=!1),u=i,b(n,e)?(a+=y(v(n)),o+=y(v(n)),s+=y(v(n)),b(n,e)?(c+=y(v(n)),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||C(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function C(e){e.sort(w)}function w(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 E(e){if(!e)return``;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function D(e,t){let n=E(e),r=t?t+`/`:``;return e=>(0,T.default)(r+(e||``),n)}var O=0,k=1,A=2,j=3,M=4;function N(e,t){let n=P(e,0);if(n===e.length)return e;t||(e=e.slice());for(let r=n;r<e.length;r=P(e,r+1))e[r]=F(e[r],t);return e}function P(e,t){for(let n=t;n<e.length;n++)if(!ee(e[n]))return n;return e.length}function ee(e){for(let t=1;t<e.length;t++)if(e[t][O]<e[t-1][O])return!1;return!0}function F(e,t){return t||(e=e.slice()),e.sort(I)}function I(e,t){return e[O]-t[O]}var L=!1;function te(e,t,n,r){for(;n<=r;){let i=n+(r-n>>1),a=e[i][O]-t;if(a===0)return L=!0,i;a<0?n=i+1:r=i-1}return L=!1,n-1}function ne(e,t,n){for(let r=n+1;r<e.length&&e[r][O]===t;n=r++);return n}function re(e,t,n){for(let r=n-1;r>=0&&e[r][O]===t;n=r--);return n}function R(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function z(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 L=o!==-1&&e[o][O]===t,o;t>=a?s=o===-1?0:o:c=o}return n.lastKey=r,n.lastNeedle=t,n.lastIndex=te(e,t,s,c)}function B(e){return typeof e==`string`?JSON.parse(e):e}var V="`line` must be greater than 0 (lines start at line 1)",ie="`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=B(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=D(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=N(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=R(),this._bySources=void 0,this._bySourceMemos=void 0}};function U(e){return e}function ae(e){var t;return(t=U(e))._decoded||(t._decoded=S(U(e)._encoded))}function W(e,t){let{line:n,column:r,bias:i}=t;if(n--,n<0)throw Error(V);if(r<0)throw Error(ie);let a=ae(e);if(n>=a.length)return G(null,null,null,null);let o=a[n],s=K(o,U(e)._decodedMemo,n,r,i||1);if(s===-1)return G(null,null,null,null);let c=o[s];if(c.length===1)return G(null,null,null,null);let{names:l,resolvedSources:u}=e;return G(u[c[k]],c[A]+1,c[j],c.length===5?l[c[M]]:null)}function G(e,t,n,r){return{source:e,line:t,column:n,name:r}}function K(e,t,n,r,i){let a=z(e,r,t,n);return L?a=(i===-1?ne:re)(e,r,a):i===-1&&a++,a===-1||a===e.length?-1:a}var oe=new Map;function se(e,t,n){oe.set(e,{map:new H(t),prefix:n})}function ce(e,t,n){let r=oe.get(e);if(!r)return{file:e,line:t,column:n};let i=W(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 q=a(ce);function J(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 le(e){let t=0,n=new Map,i=r=>{let i=t++,{promise:a,resolve:o}=Promise.withResolvers();return n.set(i,o),e.post({kind:`files`,id:i,question:r},[]),a},a={name:async()=>{let e=await i({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 i({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 i({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 i({kind:`list`,folder:e});if(t.kind!==`list`)throw Error(`the page answered ${t.kind} to a list of ${e}`);return t.names}},u=async()=>{let t=await a.name();if(t===null)return{_tag:`Right`,right:[]};let n={name:()=>Promise.resolve(t),read:a.read,list:a.list},i=new Map,o=new Set,s=await d(n,r(q,e=>{let t=i.get(e);return t===void 0&&o.add(e),t?{size:t.length,read:()=>t}:void 0}),e.modules,await e.esbuild(),e.player);return s._tag===`Left`?s:{_tag:`Right`,right:s.right.map(e=>({...e,ready:async()=>{for(;;){o.clear(),e.script(),e.walk?.();let t=[...o].filter(e=>!i.has(e));if(t.length===0)return;await Promise.all(t.map(async e=>i.set(e,await a.bytes(e))))}}}))}},f=Promise.withResolvers(),p=c(s.create({voice:J(f.promise),workspace:{projects:u}})),m=[],h=(t,{chapters:n,...r})=>{let i=[],a=[],s=[];n.forEach((e,t)=>{let n=m[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,...s}=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,{...s,lottie:o(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();s.push(i.buffer),a.push({chapter:t,cue:n,samples:i})})}),m=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},s)};return t=>{switch(t.kind){case`list`:p.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`:m=[],p.build.watch(t.name,{changed:e=>{h(t.watch,e)}});return;case`seek`:p.build.seek(t.name,t.place);return;case`halt`:p.halt();return;case`refresh`:p.refresh(t.place);return;case`files`:{let e=n.get(t.id);n.delete(t.id),e?.(t.answer);return}case`narrator`:f.resolve(t.port);return}}}var Y=(e,t=[])=>{self.postMessage(e,{transfer:t})},X=e=>{let t=u(e,q);Y({kind:`error`,message:t.message,stack:t.stack.map(e=>` ${e}`).join(`
|
|
695
|
+
`)),s=e[e.length-1]}else throw Error(`Bad write`);return n.length};let c=[],l,u=0;n=({data:e})=>(e.length>0&&(c.push(e),l&&l()),d),o.read=(e,t,n,r,i,a)=>{if(e!==0||n!==0||r!==t.length||i!==null)throw Error(`Bad read`);if(c.length===0){l=()=>o.read(e,t,n,r,i,a);return}let s=c[0],d=Math.max(0,Math.min(r,s.length-u));t.set(s.subarray(u,u+d),n),u+=d,u===s.length&&(c.shift(),u=0),a(null,d)};let d=new r.Go;return d.argv=[``,`--service=0.28.2`],i(t,d).then(t=>{e(null),d.run(t)},t=>{e(t)}),d};function i(e,n){return t(this,null,function*(){if(e instanceof WebAssembly.Module)return WebAssembly.instantiate(e,n.importObject);let t=yield fetch(e);if(!t.ok)throw Error(`Failed to download ${JSON.stringify(e)}`);if(`instantiateStreaming`in WebAssembly&&/^application\/wasm($|;)/i.test(t.headers.get(`Content-Type`)||``))return(yield WebAssembly.instantiateStreaming(t,n.importObject)).instance;let r=yield t.arrayBuffer();return(yield WebAssembly.instantiate(r,n.importObject)).instance})}return e=>n(e)})(e=>r.onmessage({data:e})),t;r={onmessage:null,postMessage:n=>setTimeout(()=>{try{t=e({data:n})}catch(e){i(e)}}),terminate(){if(t)for(let e of t._scheduledTimeouts.values())clearTimeout(e)}}}let o,s,c=new Promise((e,t)=>{o=e,s=t});r.onmessage=({data:e})=>{r.onmessage=({data:e})=>u(e),e?s(e):o()},r.postMessage(t||new URL(e,location.href).toString());let{readFromStdout:u,service:d}=K({writeToStdin(e){r.postMessage(e)},isSync:!1,hasFS:!1,esbuild:l});yield c,Ee=()=>{r.terminate(),$=void 0,Ee=void 0,De=void 0},De={build:e=>new Promise((t,n)=>{a.then(n),d.buildOrContext({callName:`build`,refs:null,options:e,isTTY:!1,defaultWD:`/`,callback:(e,r)=>e?n(e):t(r)})}),context:e=>new Promise((t,n)=>{a.then(n),d.buildOrContext({callName:`context`,refs:null,options:e,isTTY:!1,defaultWD:`/`,callback:(e,r)=>e?n(e):t(r)})}),transform:(e,t)=>new Promise((n,r)=>{a.then(r),d.transform({callName:`transform`,refs:null,input:e,options:t||{},isTTY:!1,fs:{readFile(e,t){t(Error(`Internal error`),null)},writeFile(e,t){t(null)}},callback:(e,t)=>e?r(e):n(t)})}),formatMessages:(e,t)=>new Promise((n,r)=>{a.then(r),d.formatMessages({callName:`formatMessages`,refs:null,messages:e,options:t,callback:(e,t)=>e?r(e):n(t)})}),analyzeMetafile:(e,t)=>new Promise((n,r)=>{a.then(r),d.analyzeMetafile({callName:`analyzeMetafile`,refs:null,metafile:typeof e==`string`?e:JSON.stringify(e),options:t,callback:(e,t)=>e?r(e):n(t)})})}}),je=l})(typeof t==`object`?t:{set exports(e){(typeof self<`u`?self:this).esbuild=e}})}))(),1),p=`/assets/esbuild-BaXVPFT2.wasm`,m=44,h=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,g=new Uint8Array(64),_=new Uint8Array(128);for(let e=0;e<h.length;e++){let t=h.charCodeAt(e);g[e]=t,_[t]=e}function v(e){let t=0,n=0,r=0;do r=_[e.next()],t|=(r&31)<<n,n+=5;while(r&32);return t}function y(e){return e&1?-0x80000000|-(e>>>1):e>>>1}function b(e,t){return e.pos>=t?!1:e.peek()!==m}var x=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 S(e){let{length:t}=e,n=new x(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+=y(v(n)),i<u&&(l=!1),u=i,b(n,e)?(a+=y(v(n)),o+=y(v(n)),s+=y(v(n)),b(n,e)?(c+=y(v(n)),r=[i,a,o,s,c]):r=[i,a,o,s]):r=[i],t.push(r),n.pos++}l||C(t),r.push(t),n.pos=e+1}while(n.pos<=t);return r}function C(e){e.sort(w)}function w(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 E(e){if(!e)return``;let t=e.lastIndexOf(`/`);return e.slice(0,t+1)}function D(e,t){let n=E(e),r=t?t+`/`:``;return e=>(0,T.default)(r+(e||``),n)}var O=0,k=1,A=2,j=3,M=4;function N(e,t){let n=P(e,0);if(n===e.length)return e;t||(e=e.slice());for(let r=n;r<e.length;r=P(e,r+1))e[r]=F(e[r],t);return e}function P(e,t){for(let n=t;n<e.length;n++)if(!ee(e[n]))return n;return e.length}function ee(e){for(let t=1;t<e.length;t++)if(e[t][O]<e[t-1][O])return!1;return!0}function F(e,t){return t||(e=e.slice()),e.sort(I)}function I(e,t){return e[O]-t[O]}var L=!1;function te(e,t,n,r){for(;n<=r;){let i=n+(r-n>>1),a=e[i][O]-t;if(a===0)return L=!0,i;a<0?n=i+1:r=i-1}return L=!1,n-1}function ne(e,t,n){for(let r=n+1;r<e.length&&e[r][O]===t;n=r++);return n}function re(e,t,n){for(let r=n-1;r>=0&&e[r][O]===t;n=r--);return n}function R(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}function z(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 L=o!==-1&&e[o][O]===t,o;t>=a?s=o===-1?0:o:c=o}return n.lastKey=r,n.lastNeedle=t,n.lastIndex=te(e,t,s,c)}function B(e){return typeof e==`string`?JSON.parse(e):e}var V="`line` must be greater than 0 (lines start at line 1)",ie="`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=B(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=D(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=N(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=R(),this._bySources=void 0,this._bySourceMemos=void 0}};function U(e){return e}function ae(e){var t;return(t=U(e))._decoded||(t._decoded=S(U(e)._encoded))}function W(e,t){let{line:n,column:r,bias:i}=t;if(n--,n<0)throw Error(V);if(r<0)throw Error(ie);let a=ae(e);if(n>=a.length)return G(null,null,null,null);let o=a[n],s=K(o,U(e)._decodedMemo,n,r,i||1);if(s===-1)return G(null,null,null,null);let c=o[s];if(c.length===1)return G(null,null,null,null);let{names:l,resolvedSources:u}=e;return G(u[c[k]],c[A]+1,c[j],c.length===5?l[c[M]]:null)}function G(e,t,n,r){return{source:e,line:t,column:n,name:r}}function K(e,t,n,r,i){let a=z(e,r,t,n);return L?a=(i===-1?ne:re)(e,r,a):i===-1&&a++,a===-1||a===e.length?-1:a}var oe=new Map;function se(e,t,n){oe.set(e,{map:new H(t),prefix:n})}function ce(e,t,n){let r=oe.get(e);if(!r)return{file:e,line:t,column:n};let i=W(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 q=a(ce);function J(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 le(e){let t=0,n=0,i=!1,a=new Map,u=n=>{let r=r=>{let i=t++,{promise:o,resolve:s}=Promise.withResolvers();return a.set(i,s),e.post({kind:`files`,id:i,tree:n,question:r},[]),o};return{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}}},f=async()=>{let t=u(n++),a=await t.name();if(a===null)return{_tag:`Right`,right:[]};let o={name:()=>Promise.resolve(a),read:t.read,list:t.list},s=new Map,c=new Set,l=e=>{let t=s.get(e);return t===void 0&&c.add(e),t?{size:t.length,read:()=>t}:void 0},f=await e.esbuild();e.post({kind:`stage`,stage:`esbuild`},[]);let p=await d(o,r(q,l),e.modules,f,e.player,()=>{e.post({kind:`stage`,stage:`engine`},[])});if(e.post({kind:`stage`,stage:`project`},[]),p._tag===`Left`)return p;i||(i=!0,e.post({kind:`narrator`},[]));let m=async e=>{for(;;){c.clear();let n=e(),r=[...c].filter(e=>!s.has(e));if(r.length===0)return n;await Promise.all(r.map(async e=>s.set(e,await t.bytes(e))))}};return{_tag:`Right`,right:p.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))}}})}},p=Promise.withResolvers(),m=c(s.create({voice:J(p.promise),workspace:{projects:f}})),h=[],g=(t,{chapters:n,...r})=>{let i=[],a=[],s=[];n.forEach((e,t)=>{let n=h[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,...s}=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,{...s,lottie:o(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();s.push(i.buffer),a.push({chapter:t,cue:n,samples:i})})}),h=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},s)};return t=>{switch(t.kind){case`list`:m.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`:h=[],m.build.watch(t.name,{changed:e=>{g(t.watch,e)}});return;case`seek`:m.build.seek(t.name,t.place);return;case`halt`:m.halt();return;case`refresh`:m.refresh(t.place);return;case`files`:{let e=a.get(t.id);a.delete(t.id),e?.(t.answer);return}case`narrator`:p.resolve(t.port);return}}}var Y=(e,t=[])=>{self.postMessage(e,{transfer:t})},X=e=>{let t=u(e,q);Y({kind:`error`,message:t.message,stack:t.stack.map(e=>` ${e}`).join(`
|
|
696
696
|
`)})};self.addEventListener(`error`,e=>{e.preventDefault(),X(e.error??Error(e.message))}),self.addEventListener(`unhandledrejection`,e=>{e.preventDefault(),X(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},Z={load:async({code:e,map:t})=>{let n=URL.createObjectURL(new Blob([e],{type:`text/javascript`}));return se(n,t,i),{url:n,exports:await import(n)}}},Q=null,de=le({post:Y,esbuild:async()=>(Q??=(async()=>{let e=performance.now();await f.initialize({wasmURL:p,worker:!1}),console.log(`aula: esbuild loaded in ${((performance.now()-e)/1e3).toFixed(1)} s`)})(),await Q,f),modules:Z,player:ue});self.addEventListener(`message`,e=>{de(e.data)});
|