kaizen-agent 1.49.0 → 1.49.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 (67) hide show
  1. package/cli/hermes.ts +5 -2
  2. package/cli/state.test.ts +13 -0
  3. package/cli/state.ts +12 -0
  4. package/cli/versions.test.ts +154 -0
  5. package/cli/versions.ts +272 -0
  6. package/cli/video.test.ts +64 -3
  7. package/cli/video.ts +111 -18
  8. package/cli/web.ts +15 -0
  9. package/package.json +1 -1
  10. package/skills/media/kaizen-video/SKILL.md +20 -2
  11. package/skills/media/kaizen-video/canvas.html +241 -0
  12. package/skills/media/kaizen-video/examples/canvas-film/cat.txt +31 -0
  13. package/skills/media/kaizen-video/examples/canvas-film/film.json +460 -0
  14. package/skills/media/kaizen-video/examples/canvas-film/lines.json +10 -0
  15. package/skills/media/kaizen-video/examples/canvas-film/skip.txt +18 -0
  16. package/skills/media/kaizen-video/examples/canvas-film/talk.txt +23 -0
  17. package/skills/media/kaizen-video/examples/canvas-film/wow.txt +24 -0
  18. package/skills/media/kaizen-video/examples/kaizen-promo/promo.json +17 -0
  19. package/skills/media/kaizen-video/examples/kaizen-promo/record.json +10 -0
  20. package/skills/media/kaizen-video/examples/notula-promo/promo.json +41 -0
  21. package/skills/media/kaizen-video/examples/notula-promo/record.json +135 -0
  22. package/skills/media/kaizen-video/examples/notula-promo/seed.php +20 -0
  23. package/skills/media/kaizen-video/examples/notula-promo/seed.py +38 -0
  24. package/skills/media/kaizen-video/presets/app-promo/CREDITS.txt +2 -0
  25. package/skills/media/kaizen-video/presets/app-promo/README.md +21 -0
  26. package/skills/media/kaizen-video/presets/app-promo/preset.json +7 -0
  27. package/skills/media/kaizen-video/presets/app-promo/template/compositions/end.html +25 -0
  28. package/skills/media/kaizen-video/presets/app-promo/template/compositions/hook.html +19 -0
  29. package/skills/media/kaizen-video/presets/app-promo/template/compositions/name.html +19 -0
  30. package/skills/media/kaizen-video/presets/app-promo/template/compositions/step.html +52 -0
  31. package/skills/media/kaizen-video/presets/app-promo/template/index.html +24 -0
  32. package/skills/media/kaizen-video/presets/film-cinematic-drama/.hidden +1 -0
  33. package/skills/media/kaizen-video/presets/film-explainer-canvas/.hidden +1 -0
  34. package/skills/media/kaizen-video/presets/film-explainer-canvas/CREDITS.txt +3 -0
  35. package/skills/media/kaizen-video/presets/film-explainer-canvas/README.md +7 -0
  36. package/skills/media/kaizen-video/presets/film-explainer-canvas/assets/fonts/InstrumentSerif.ttf +0 -0
  37. package/skills/media/kaizen-video/presets/film-explainer-canvas/assets/fonts/SpaceMono.ttf +0 -0
  38. package/skills/media/kaizen-video/presets/film-explainer-canvas/assets/sfx/boing.wav +0 -0
  39. package/skills/media/kaizen-video/presets/film-explainer-canvas/assets/sfx/ding.wav +0 -0
  40. package/skills/media/kaizen-video/presets/film-explainer-canvas/assets/sfx/ending.wav +0 -0
  41. package/skills/media/kaizen-video/presets/film-explainer-canvas/assets/sfx/pop.wav +0 -0
  42. package/skills/media/kaizen-video/presets/film-explainer-canvas/assets/sfx/reveal.wav +0 -0
  43. package/skills/media/kaizen-video/presets/film-explainer-canvas/assets/sfx/shutter.wav +0 -0
  44. package/skills/media/kaizen-video/presets/film-explainer-canvas/assets/sfx/stamp.wav +0 -0
  45. package/skills/media/kaizen-video/presets/film-explainer-canvas/assets/sfx/tick.wav +0 -0
  46. package/skills/media/kaizen-video/presets/film-explainer-canvas/assets/sfx/whoosh.wav +0 -0
  47. package/skills/media/kaizen-video/presets/film-explainer-canvas/style.json +15 -0
  48. package/skills/media/kaizen-video/presets/film-fun-energetic/.hidden +1 -0
  49. package/skills/media/kaizen-video/presets/film-promo-booth/.hidden +1 -0
  50. package/skills/media/kaizen-video/presets/film-viral-social/.hidden +1 -0
  51. package/skills/media/kaizen-video/presets/tiktok-explainer/index.html +1 -1
  52. package/skills/media/kaizen-video/references/canvas.md +60 -0
  53. package/skills/media/kaizen-video/references/presets.md +31 -0
  54. package/skills/media/kaizen-video/references/promo.md +148 -0
  55. package/skills/media/kaizen-video/references/revisions.md +11 -2
  56. package/skills/media/kaizen-video/scripts/make_film.py +157 -4
  57. package/skills/media/kaizen-video/scripts/make_promo.py +297 -0
  58. package/skills/media/kaizen-video/scripts/make_tiktok.py +34 -6
  59. package/skills/media/kaizen-video/scripts/pixel.py +40 -0
  60. package/skills/media/kaizen-video/scripts/record.mjs +103 -0
  61. package/web/board.html +1 -1
  62. package/web/board.js +1 -1
  63. package/web/notebook.js +1 -1
  64. package/web/term.js +1 -1
  65. package/web/video.html +43 -9
  66. package/web/video.js +67 -56
  67. package/web/video.ts +266 -33
@@ -0,0 +1,297 @@
1
+ """Build (and optionally render) an app-promo video: a product filmed in use, framed in its own devices.
2
+
3
+ python3 scripts/make_promo.py videos/<name> [--render]
4
+
5
+ Run from the project folder. videos/<name>/ holds promo.json (the brief, references/promo.md) and rec/,
6
+ the recordings from record.mjs (or the user's screen recordings with a rec/<clip>.json beside them).
7
+ Writes the HyperFrames project into videos/<name>/promo/, runs `hyperframes check` and snapshots one frame
8
+ per step into promo/check/; with --render it renders, levels the sound to -14 LUFS (true peak -1.5 dBTP)
9
+ and writes output/<name>/<preset>/<name>.mp4 with CREDITS.txt.
10
+
11
+ promo.json: "preset" (default app-promo), "product", "tagline", "cta", "hook" (2-3 lines; the last word
12
+ lands in the accent), "brand" {"logo", "bg", "ink", "accent", "muted", "font"}, "music" (a bundled track
13
+ name, or "none"), "steps": [{"clip", "caption" (*word* is the accent), "from", "to" (seconds of the clip),
14
+ "with" (a second clip on another device, shown together), "punch" ([] for none, or [{"at", "x", "y",
15
+ "zoom", "hold"}] in clip seconds and CSS px)}].
16
+ """
17
+ import html
18
+ import json
19
+ import os
20
+ import re
21
+ import shutil
22
+ import subprocess
23
+ import sys
24
+ from pathlib import Path
25
+
26
+ HF = "hyperframes@0.8.176"
27
+ SKILL = Path(__file__).resolve().parent.parent
28
+
29
+ args = [a for a in sys.argv[1:] if not a.startswith("--")]
30
+ if not args:
31
+ sys.exit(__doc__)
32
+ vdir = Path(args[0])
33
+ render = "--render" in sys.argv
34
+ brief = json.loads((vdir / "promo.json").read_text())
35
+ want = brief.get("preset", "app-promo")
36
+ if not re.fullmatch(r"[A-Za-z0-9][\w.-]*", want) or ".." in want:
37
+ sys.exit(f"preset {want!r}: a folder name, not a path")
38
+ dirs = [Path("presets"), Path(os.environ.get("KAIZEN_VIDEO_PRESETS", Path.home() / ".kaizen/video-presets")), SKILL / "presets"]
39
+ preset = next((d / want for d in dirs if (d / want / "preset.json").exists()), None)
40
+ if not preset:
41
+ sys.exit(f"template preset {want!r} not found (a folder with preset.json)")
42
+ name = vdir.name
43
+ proj = vdir / "promo"
44
+
45
+
46
+ def safe(n, what):
47
+ """A file name from the brief: inside the video folder, never absolute or with '..'."""
48
+ if not n or Path(n).is_absolute() or ".." in Path(n).parts:
49
+ sys.exit(f"{what} {n!r}: give a name inside {vdir}, not a path out of it")
50
+ return n
51
+
52
+
53
+ def clip(c):
54
+ safe(c, "clip")
55
+ meta = vdir / "rec" / f"{c}.json"
56
+ if not meta.exists() or not (vdir / "rec" / f"{c}.mp4").exists():
57
+ sys.exit(f"clip {c!r}: rec/{c}.mp4 and rec/{c}.json are needed (record.mjs makes both)")
58
+ return json.loads(meta.read_text())
59
+
60
+
61
+ # ---- Brand
62
+ B = brief.get("brand", {})
63
+ bg, ink, accent = B.get("bg", "#0c162f"), B.get("ink", "#eef2fa"), B.get("accent", "#6d8cff")
64
+ font = B.get("font", "Inter")
65
+ dark = int(bg.lstrip("#")[:2], 16) + int(bg.lstrip("#")[2:4], 16) + int(bg.lstrip("#")[4:6], 16) < 384
66
+ css = f""":root {{ --bg: {bg}; --ink: {ink}; --accent: {accent}; --font: "{font}";
67
+ --muted: {B.get("muted", f"color-mix(in srgb, {ink} 62%, {bg})")}; --dim: color-mix(in srgb, {ink} 22%, {bg});
68
+ --bezel: color-mix(in srgb, {ink} {14 if dark else 80}%, {bg}); --bezel-edge: color-mix(in srgb, {ink} {24 if dark else 30}%, {bg}); }}"""
69
+ esc = html.escape
70
+
71
+
72
+ def words(text, last_id=None):
73
+ """Words as spans; *word* is the accent; "/" breaks the line."""
74
+ out = []
75
+ for line in text.split("/"):
76
+ ws = line.split()
77
+ out.append(" ".join(f"<span>{'<b>' + esc(w.strip('*')) + '</b>' if w.startswith('*') else esc(w)}</span>" for w in ws))
78
+ s = "<br />".join(out)
79
+ if last_id:
80
+ s = re.sub(r"<span>([^<]*)</span>$", rf'<span id="{last_id}">\1</span>', s)
81
+ return s
82
+
83
+
84
+ def fit(text, size, width=1000):
85
+ return int(min(size, width / max(1, len(text) * 0.58)))
86
+
87
+
88
+ # ---- Device geometry (9:16 frame, 1080 x 1920). Screens keep the recording's aspect.
89
+ def frames(step, sid):
90
+ """HTML for the step's device(s), with its clips and tap marks; returns (html, taps, points)."""
91
+ a = clip(step["clip"])
92
+ b = clip(step["with"]) if step.get("with") else None
93
+ t0, t1 = step.get("from", 0), step.get("to", a["seconds"])
94
+ dur = t1 - t0
95
+ parts, taps, points, conv = [], [], [], []
96
+
97
+ def device(c, meta, box, small=False):
98
+ kind = meta["device"]
99
+ x, y, w = box
100
+ if kind == "tablet": # a phone-style bezel, as wide as the frame's height allows (screen at most 1388 tall)
101
+ sw = min(w - 28, round(1388 * meta["cssW"] / meta["cssH"]))
102
+ w = sw + 28
103
+ x, y = (1080 - w) // 2, 440
104
+ if kind in ("phone", "tablet"):
105
+ sw = w - 28
106
+ sh = round(sw * meta["cssH"] / meta["cssW"])
107
+ ox, oy, k = x + 14, y + 14, sw / meta["cssW"]
108
+ body = (f'<div class="s-phone" style="left:{x}px;top:{y}px;width:{w}px;height:{sh + 28}px">'
109
+ f'<div class="scr" style="width:{sw}px;height:{sh}px">')
110
+ else:
111
+ sh = round(w * meta["cssH"] / meta["cssW"])
112
+ ox, oy, k = x, y + 64, w / meta["cssW"]
113
+ # A web product sits in a browser with its real URL; a native app ("app": the user's recording) in a titled window.
114
+ bar = (f'<i></i><i></i><i></i><span class="ttl">{esc(brief.get("product", ""))}</span>' if kind == "app"
115
+ else f'<i></i><i></i><i></i><span class="url">{esc(brief.get("url", ""))}</span>')
116
+ body = (f'<div class="s-win" style="left:{x}px;top:{y}px;width:{w}px"><div class="bar">{bar}</div>'
117
+ f'<div class="scr" style="width:{w}px;height:{sh}px">')
118
+ conv.append((ox, oy, k))
119
+ vid = f"{sid}-{c}"
120
+ body += (f'<video id="{vid}" class="clip" src="assets/rec/{c}.mp4" muted playsinline data-start="0" '
121
+ f'data-duration="{dur:.3f}" data-media-start="{t0:.3f}" data-track-index="0"></video>')
122
+ for i, tp in enumerate(m for m in meta["taps"] if t0 <= m["t"] < t1):
123
+ tid = f"{vid}-t{i}"
124
+ body += f'<div class="s-tap{" sm" if small else ""}" id="{tid}" style="left:{tp["x"] * k:.0f}px;top:{tp["y"] * k:.0f}px"></div>'
125
+ taps.append([tid, round(tp["t"] - t0, 3)])
126
+ points.append((tp["t"] - t0, ox + tp["x"] * k, oy + tp["y"] * k, kind))
127
+ return body + "</div></div>"
128
+
129
+ if b: # duo: the window large, the phone overlapping at the bottom right, both playing the same task
130
+ win, ph = (a, b) if a["device"] != "phone" else (b, a)
131
+ wc, pc = (step["clip"], step["with"]) if a is win else (step["with"], step["clip"])
132
+ parts.append(device(wc, win, (30, 470, 900)))
133
+ parts.append(device(pc, ph, (690, 860, 360), small=True))
134
+ elif a["device"] == "phone":
135
+ parts.append(device(step["clip"], a, (206, 440, 668)))
136
+ else:
137
+ parts.append(device(step["clip"], a, (40, 560, 1000)))
138
+ # CSS px -> frame px for hand-placed punch-ins: the step's one device, or the phone of a duo (drawn last).
139
+ return f'<div id="{sid}-dev">{"".join(parts)}</div>', taps, points, dur, a["device"] if not b else "duo", conv[-1]
140
+
141
+
142
+ def punches(step, points, dur, dev, conv):
143
+ """Punch in on a tap when the UI then has time to act (the next tap is 1.6 s or more away).
144
+ With two devices on screen only the phone's taps lead, and gently, so the window stays in frame."""
145
+ if "punch" in step:
146
+ ox, oy, k = conv # x/y are CSS px of the step's clip, like the tap log
147
+ return [[p["at"] - step.get("from", 0), round(ox + p["x"] * k), round(oy + p["y"] * k), p.get("zoom", 1.35), p.get("hold", 2.0)] for p in step["punch"]]
148
+ if dev == "duo":
149
+ points = [p for p in points if p[3] == "phone"]
150
+ out, pts = [], sorted(points)
151
+ for i, (t, x, y, kind) in enumerate(pts):
152
+ nxt = pts[i + 1][0] if i + 1 < len(pts) else dur
153
+ gap = nxt - t
154
+ if gap < 1.6 or t < 0.3:
155
+ continue
156
+ z = 1.18 if dev == "duo" else 1.3 if kind == "phone" else 1.7
157
+ out.append([round(t + 0.1, 3), round(x), round(y), z, round(min(2.4, gap - 1.2), 2)])
158
+ return out
159
+
160
+
161
+ # ---- Project
162
+ shutil.rmtree(proj, ignore_errors=True)
163
+ shutil.copytree(preset / "template", proj)
164
+ (proj / "assets/rec").mkdir(parents=True, exist_ok=True)
165
+ (proj / "assets/sfx").mkdir(parents=True, exist_ok=True)
166
+ for f in (vdir / "rec").glob("*.mp4"):
167
+ shutil.copy(f, proj / "assets/rec" / f.name)
168
+ for f in (SKILL / "presets/tiktok-explainer/assets/sfx").glob("*.wav"):
169
+ shutil.copy(f, proj / "assets/sfx" / f.name)
170
+ mark = ""
171
+ if B.get("logo"):
172
+ src = vdir / safe(B["logo"], "brand logo")
173
+ if not src.exists():
174
+ sys.exit(f"brand logo {B['logo']!r} not found in {vdir}")
175
+ shutil.copy(src, proj / "assets" / ("logo" + src.suffix))
176
+ mark = f'<div id="end-mark"><img src="assets/logo{src.suffix}" alt="" /></div>'
177
+
178
+ comp = proj / "compositions"
179
+ step_tpl = (comp / "step.html").read_text()
180
+ (comp / "step.html").unlink()
181
+ product, tagline, cta = brief.get("product", name), brief.get("tagline", ""), brief.get("cta", "")
182
+ hook = brief.get("hook", [])
183
+ hook_text = " / ".join(hook)
184
+ fill = {"HOOK_HTML": words(hook_text, "hook-last"), "HOOK_SIZE": fit(max(hook, key=len) if hook else "x", 150, 900),
185
+ "NAME": esc(product), "NAME_SIZE": fit(product, 230), "END_SIZE": fit(product, 168), "TAGLINE": esc(tagline),
186
+ "CTA": esc(cta), "MARK": mark}
187
+ for f in ("hook.html", "name.html", "end.html"):
188
+ s = (comp / f).read_text()
189
+ for k, v in fill.items():
190
+ s = s.replace("{{" + k + "}}", str(v))
191
+ (comp / f).write_text(s)
192
+
193
+ scenes, sfx, t = [], [], 0.0
194
+ if hook:
195
+ scenes.append(("hook", 0.0, 2.4)); sfx.append(("whoosh", 2.2)); t = 2.4
196
+ scenes.append(("name", t, 1.8)); sfx.append(("whoosh", t + 1.6)); t += 1.8
197
+ prev_dev = None
198
+ steps = brief["steps"]
199
+ for i, st in enumerate(steps):
200
+ sid = f"step{i + 1}"
201
+ body, taps, points, dur, dev, conv = frames(st, sid)
202
+ top = min(int(m) for m in re.findall(r'class="s-(?:phone|win)" style="left:\d+px;top:(\d+)px', body))
203
+ data = {"id": sid, "taps": taps, "punches": punches(st, points, dur, dev, conv), "rise": dev != prev_dev, "dur": round(dur, 3), "last": False, "top": top}
204
+ s = (step_tpl.replace("{{ID}}", sid).replace("{{CAPTION}}", words(st["caption"])).replace("{{FRAMES}}", body)
205
+ .replace("/*DATA*/{}", json.dumps(data)))
206
+ (comp / f"{sid}.html").write_text(s)
207
+ scenes.append((sid, t, dur))
208
+ if dev != prev_dev and prev_dev:
209
+ sfx.append(("whoosh", t - 0.15))
210
+ for k, (_, tt) in enumerate(taps):
211
+ sfx.append(("tick" if k % 2 == 0 else "pop", t + tt - 0.03))
212
+ prev_dev = dev
213
+ t += dur
214
+ scenes.append(("end", t, 3.4)); sfx.append(("reveal", t + 0.05))
215
+ total = round(t + 3.4, 3)
216
+
217
+ music = brief.get("music", "sunny")
218
+ audio = ""
219
+ if music != "none":
220
+ track = SKILL / "assets/music" / f"{music}.mp3"
221
+ if not track.exists():
222
+ sys.exit(f"music {music!r} not found in assets/music")
223
+ shutil.copy(track, proj / "assets/music.mp3")
224
+ audio += f' <audio id="music" src="assets/music.mp3" data-start="0" data-duration="{total}" data-track-index="2" data-volume="0.55" data-fade-out="1.5"></audio>\n'
225
+ for i, (snd, at) in enumerate(sfx):
226
+ d = {"whoosh": 0.6, "tick": 0.06, "pop": 0.18, "reveal": 0.6}[snd]
227
+ audio += f' <audio id="sfx{i}" src="assets/sfx/{snd}.wav" data-start="{max(0, at):.3f}" data-duration="{d}" data-track-index="3" data-volume="0.8"></audio>\n'
228
+ hosts = "\n".join(
229
+ f' <div id="{sid}" data-composition-id="{sid}" data-composition-src="compositions/{sid}.html" data-start="{st:.3f}" '
230
+ f'data-duration="{d:.3f}" data-track-index="1" data-track-kind="graphics" data-width="1080" data-height="1920"></div>'
231
+ for sid, st, d in scenes)
232
+ page = (proj / "index.html").read_text()
233
+ for k, v in {"CSS": css, "DURATION": total, "SCENES": hosts, "AUDIO": audio, "LANG": brief.get("language", "en")}.items():
234
+ page = page.replace("{{" + k + "}}", str(v))
235
+ (proj / "index.html").write_text(page)
236
+
237
+ # SPEC.md: the brief as numbers, for whoever opens the project in HyperFrames Studio.
238
+ spec = [f"GOAL: a viewer sees {product} do {len(steps)} real tasks and knows where to get it ({cta}).",
239
+ f"OUTPUT: HyperFrames, 1080 x 1920, 30 fps; {total} s; preset {preset.name}",
240
+ f"LOOK: ground {bg}, ink {ink}, accent {accent} (one word per caption, the hook's last word, the CTA); {font} 900",
241
+ "MOTION: arrivals expo.out 0.5-0.7 s; camera power2.inOut 0.5 s; captions blur 6px->0, 0.067 s apart, dead still after landing",
242
+ "SHOTS:"] + [f" {sid} {st:.1f}-{st + d:.1f}" for sid, st, d in scenes] + [
243
+ "BANNED: invented UI; glow, grain, particles; breathing loops; fade-and-slide-up; text outside 168-1330 px; a repeated claim"]
244
+ (proj / "SPEC.md").write_text("\n".join(spec) + "\n")
245
+ print(f"preset {preset}\n{len(steps)} steps, {len(sfx)} sounds, {total}s -> {proj}")
246
+
247
+
248
+ def run(*cmd, **kw):
249
+ return subprocess.run(cmd, cwd=proj, **kw)
250
+
251
+
252
+ chk = run("npx", "--yes", HF, "check", capture_output=True, text=True)
253
+ print("\n".join(l for l in chk.stdout.splitlines() if "✗" in l or "Check" in l))
254
+ if chk.returncode:
255
+ sys.exit("hyperframes check failed; see above")
256
+ at = ",".join(f"{st + min(d * 0.6, d - 0.2):.2f}" for sid, st, d in scenes)
257
+ snap = run("npx", "--yes", HF, "snapshot", "--at", at, capture_output=True, text=True)
258
+ m = re.search(r"(\S*contact-sheet[^\s]*\.jpg)", snap.stdout)
259
+ if m:
260
+ (proj / "check").mkdir(exist_ok=True)
261
+ shutil.copy(proj / m.group(1) if not m.group(1).startswith("/") else m.group(1), proj / "check/sheet.jpg")
262
+ print(f"snapshots: {proj / 'check/sheet.jpg'}")
263
+ if not render:
264
+ sys.exit(0)
265
+
266
+ out = Path("output") / name / preset.name
267
+ out.mkdir(parents=True, exist_ok=True)
268
+ raw, final = proj / "render.mp4", out / f"{name}.mp4"
269
+ tmp = proj / ".render-tmp"
270
+ tmp.mkdir(exist_ok=True)
271
+ run("npx", "--yes", HF, "render", "--crf", "18", "-o", str(raw.resolve()), check=True, env={**os.environ, "TMPDIR": str(tmp)})
272
+ shutil.rmtree(tmp, ignore_errors=True)
273
+
274
+
275
+ def loud(f):
276
+ r = subprocess.run(["ffmpeg", "-i", str(f), "-af", "ebur128=peak=true", "-f", "null", "-"], capture_output=True, text=True).stderr
277
+ i = float(re.findall(r"I:\s+(-?[\d.]+) LUFS", r)[-1])
278
+ p = float(re.findall(r"Peak:\s+(-?[\d.]+) dBFS", r)[-1])
279
+ return i, p
280
+
281
+
282
+ # Gain to -14 LUFS, then a limiter for the true peak; one correction pass if the limiter cost loudness.
283
+ gain = -14 - loud(raw)[0]
284
+ for _ in range(2):
285
+ subprocess.run(["ffmpeg", "-v", "error", "-y", "-i", str(raw), "-c:v", "copy", "-af",
286
+ f"volume={gain:.2f}dB,alimiter=limit=0.6:level=false:attack=1:release=60", "-ar", "48000", "-c:a", "aac", "-b:a", "192k", str(final)], check=True)
287
+ i, p = loud(final)
288
+ if abs(i + 14) <= 0.6:
289
+ break
290
+ gain += -14 - i
291
+ print(f"loudness {i} LUFS, true peak {p} dBTP")
292
+ credits = [f.read_text().strip() for f in (vdir / "CREDITS.txt", preset / "CREDITS.txt") if f.exists()]
293
+ if music != "none":
294
+ m2 = re.search(rf"^- {re.escape(music)}\.mp3: (.+)$", (SKILL / "assets/CREDITS.txt").read_text(), re.M)
295
+ credits.append("Music: " + (m2.group(1) if m2 else music))
296
+ (out / "CREDITS.txt").write_text("\n\n".join(credits) + "\n")
297
+ print(f"rendered {final}")
@@ -10,6 +10,10 @@ The preset is found by folder name in ./presets/, then $KAIZEN_VIDEO_PRESETS
10
10
  (default ~/.kaizen/video-presets/), then the skill's bundled presets/. A preset file
11
11
  missing from its folder falls back to the skill's shared assets/, tools/ and
12
12
  hyperframes.json.
13
+
14
+ A film preset (a folder with style.json) works too: the cut footage becomes one full-length footage beat of
15
+ a film in videos/<name>/film-bridge/, its sound the narration and its words the timings, and make_film.py
16
+ builds and renders it in that style (the film's grade, captions, music and loudness; no cards from beats).
13
17
  """
14
18
  import html
15
19
  import os
@@ -33,10 +37,11 @@ proj.mkdir(exist_ok=True)
33
37
  cfg = json.loads((vdir / "config.json").read_text())
34
38
  dirs = [WORK / "presets", Path(os.environ.get("KAIZEN_VIDEO_PRESETS", Path.home() / ".kaizen/video-presets")), SKILL / "presets"]
35
39
  preset = next((d / cfg["preset"] for d in dirs if (d / cfg["preset"] / "index.html").exists()), None)
36
- if not preset:
37
- names = sorted({p.parent.name for d in dirs if d.exists() for p in d.glob("*/index.html")})
40
+ film_style = None if preset else next((d / n for n in (cfg["preset"], "film-" + cfg["preset"]) for d in dirs if (d / n / "style.json").exists()), None)
41
+ if not preset and not film_style:
42
+ names = sorted({p.parent.name for d in dirs if d.exists() for p in [*d.glob("*/index.html"), *d.glob("*/style.json")]})
38
43
  sys.exit(f"preset {cfg['preset']!r} not found in {', '.join(map(str, dirs))}; available: {', '.join(names)}")
39
- print(f"preset {preset}")
44
+ print(f"preset {preset or film_style}")
40
45
  src_of = lambda p: next(f for f in (preset / p, SKILL / p) if f.exists()) # preset file, else the shared one
41
46
  rel = lambda p: (vdir / p).resolve()
42
47
 
@@ -46,9 +51,9 @@ def run(*cmd, **kw):
46
51
 
47
52
 
48
53
  # 1. Preset files and this video's images into the project.
49
- for f in ["package.json", "hyperframes.json"]:
54
+ for f in [] if film_style else ["package.json", "hyperframes.json"]:
50
55
  shutil.copy(src_of(f), proj / f)
51
- for d in ["fonts", "sfx"]:
56
+ for d in [] if film_style else ["fonts", "sfx"]:
52
57
  shutil.rmtree(proj / "assets" / d, ignore_errors=True)
53
58
  for base in (SKILL, preset): # shared assets first, the preset's own on top
54
59
  if (base / "assets" / d).exists():
@@ -87,6 +92,26 @@ for s0, s1, length in segs:
87
92
  cut_duration = offset
88
93
  flat = [w for c in chunks for w in c]
89
94
 
95
+ if film_style:
96
+ # Hand the cut to the film engine: one footage beat as long as the cut, with no lead or tail so the voice stays on the lips.
97
+ bridge = vdir / "film-bridge"
98
+ bridge.mkdir(exist_ok=True)
99
+ src = rel(cfg["video"])
100
+ subprocess.run(["ffmpeg", "-v", "error", "-y", "-i", str(src), "-an", "-vf", "scale=1080:1920:flags=lanczos,fps=30,format=yuv420p",
101
+ "-c:v", "libx264", "-crf", "16", "-g", "30", str(bridge / "footage.mp4")], check=True)
102
+ subprocess.run(["ffmpeg", "-v", "error", "-y", "-i", str(src), "-vn", "-af", "afftdn=nf=-28,deesser=i=0.35", "-b:a", "256k", str(bridge / "v01.mp3")], check=True)
103
+ length = float(subprocess.check_output(["ffprobe", "-v", "error", "-show_entries", "format=duration", "-of", "csv=p=0", str(src)]))
104
+ (bridge / "words.json").write_text(json.dumps({"v01": {"dur": round(length, 3), "offset": 0, "text": " ".join(w["w"] for w in flat), "words": flat}}, ensure_ascii=False))
105
+ (bridge / "lines.json").write_text(json.dumps({"v01": " ".join(w["w"] for w in flat)}, ensure_ascii=False))
106
+ if (vdir / "CREDITS.txt").exists():
107
+ shutil.copy(vdir / "CREDITS.txt", bridge / "CREDITS.txt")
108
+ (bridge / "film.json").write_text(json.dumps({"name": cfg["name"], "preset": film_style.name, "format": "9x16", "language": cfg.get("language", "id"),
109
+ "music": cfg["music"], "style": {"pace": {"lead": 0, "tail": 0}},
110
+ "beats": [{"kind": "footage", "video": "footage.mp4", "vo": "v01"}]}, ensure_ascii=False, indent=1))
111
+ print(f"film preset {film_style.name}: building the cut as a film")
112
+ subprocess.run(["python3", str(SKILL / "scripts/make_film.py"), str(bridge), *(["--render"] if "--render" in sys.argv else [])], check=True, cwd=WORK)
113
+ sys.exit(0)
114
+
90
115
 
91
116
  def at(key, after=0):
92
117
  try:
@@ -103,7 +128,8 @@ if co:
103
128
  else:
104
129
  co_a = co_b = 0.0
105
130
  L = round(co_b - co_a, 3)
106
- beats = sorted(({**{k: v for k, v in b_.items() if k not in ("word", "after")}, "t": round(at(b_["word"], b_.get("after", 0)) + L, 3)}
131
+ # A beat is placed on a spoken word, or at "t" seconds (films bridged from make_film.py).
132
+ beats = sorted(({**{k: v for k, v in b_.items() if k not in ("word", "after")}, "t": round((b_["t"] if "t" in b_ else at(b_["word"], b_.get("after", 0))) + L, 3)}
107
133
  for b_ in cfg["beats"]), key=lambda x: x["t"])
108
134
  shift = lambda w, d: {**w, "s": round(w["s"] + d, 3), "e": round(w["e"] + d, 3)}
109
135
  cold = [[shift(w, -co_a) for w in c if co_a <= w["s"] and w["e"] <= co_b] for c in chunks] if co else []
@@ -179,6 +205,8 @@ page = (preset / "index.html").read_text()
179
205
  for k, v in {"DURATION": duration, "VIDEO_DURATION": video_duration, "VIDEO": "source.mp4", "MUSIC_VOLUME": cfg.get("music_volume", 0.32),
180
206
  "HOOK_1": html.escape(h["line1"]), "HOOK_2": html.escape(h["line2"]), "HOOK_SUB": html.escape(h["sub"])}.items():
181
207
  page = page.replace("{{" + k + "}}", str(v))
208
+ if cfg.get("card") is False: # no real footage behind it (a film bridged from make_film.py): hide the clip card
209
+ page = page.replace("</head>", "<style>#cam { opacity: 0 !important; }</style>\n </head>", 1) # the renderer paints video despite visibility
182
210
  page = page.replace("<!-- SFX:BEGIN -->", "<!-- SFX:BEGIN -->\n" + tags + "\n ")
183
211
  (proj / "index.html").write_text(page)
184
212
 
@@ -0,0 +1,40 @@
1
+ """Pixel art: a text grid and its palette into a crisp PNG, for mascots, icons and scene pictures.
2
+
3
+ python3 scripts/pixel.py <art.txt> <out.png> [--scale N]
4
+
5
+ art.txt: palette lines "X #rrggbb" (or "X #rrggbbaa"), a blank line, then the grid, one character per pixel;
6
+ "." and any character not in the palette are transparent. Rows may differ in length (short rows are padded).
7
+ The grid is upscaled N times (default 32) with nearest-neighbour, so edges stay sharp.
8
+ """
9
+ import sys
10
+ from PIL import Image
11
+
12
+
13
+ def render(text, scale=32):
14
+ head, _, body = text.strip("\n").partition("\n\n")
15
+ pal = {}
16
+ for line in head.splitlines():
17
+ k, v = line.split()
18
+ v = v.lstrip("#")
19
+ pal[k] = tuple(int(v[i:i + 2], 16) for i in range(0, len(v), 2)) + ((255,) if len(v) == 6 else ())
20
+ rows = body.strip("\n").splitlines()
21
+ img = Image.new("RGBA", (max(map(len, rows)), len(rows)), (0, 0, 0, 0))
22
+ for y, r in enumerate(rows):
23
+ for x, ch in enumerate(r):
24
+ if ch in pal:
25
+ img.putpixel((x, y), pal[ch])
26
+ return img.resize((img.width * scale, img.height * scale), Image.NEAREST)
27
+
28
+
29
+ if __name__ == "__main__":
30
+ if sys.argv[1:] == ["--check"]: # self-test
31
+ im = render("R #ff0000\nB #0000ff80\n\nR.\n.B", 2)
32
+ assert im.size == (4, 4) and im.getpixel((0, 0)) == (255, 0, 0, 255) and im.getpixel((2, 0))[3] == 0
33
+ assert im.getpixel((3, 3)) == (0, 0, 255, 128) and im.getpixel((1, 1)) == (255, 0, 0, 255)
34
+ print("ok")
35
+ sys.exit()
36
+ if len(sys.argv) < 3:
37
+ sys.exit(__doc__)
38
+ scale = int(sys.argv[sys.argv.index("--scale") + 1]) if "--scale" in sys.argv else 32
39
+ render(open(sys.argv[1]).read(), scale).save(sys.argv[2])
40
+ print(f"wrote {sys.argv[2]}")
@@ -0,0 +1,103 @@
1
+ // Films a web product in use, for app-promo (references/promo.md).
2
+ //
3
+ // node scripts/record.mjs videos/<name> # reads videos/<name>/record.json
4
+ //
5
+ // record.json: {"url": "http://...", "clips": [{"name": "idea", "device": "phone"|"tablet"|"desktop",
6
+ // "path": "/optional/start/path", "steps": [["wait", ms], ["tap", "css" | "text:Label"], ["type", "css", "text", msPerKey?],
7
+ // ["key", "Enter"], ["scroll", px], ["goto", "/path"]], "prep": [same steps, run before filming starts, e.g. a sign-in]}]}
8
+ // Writes videos/<name>/rec/<clip>.mp4 (30 fps, the device's full pixels) and rec/<clip>.json
9
+ // ({device, cssW, cssH, taps: [{t, x, y}]}, x/y in CSS px of the page, t in seconds of the clip).
10
+ // Frames are full-resolution screenshots taken in a loop while the steps run (Chromium's own screencast
11
+ // is capped at CSS pixels). Point "url" at a sandbox or a demo account: everything on screen is filmed.
12
+ import { createRequire } from "module";
13
+ import { execFileSync } from "child_process";
14
+ import fs from "fs";
15
+ import os from "os";
16
+ import path from "path";
17
+
18
+ const DEVICES = {
19
+ phone: { width: 430, height: 932, deviceScaleFactor: 2.5, isMobile: true, hasTouch: true },
20
+ tablet: { width: 820, height: 1180, deviceScaleFactor: 2, isMobile: true, hasTouch: true },
21
+ desktop: { width: 1440, height: 900, deviceScaleFactor: 2, isMobile: false, hasTouch: false },
22
+ };
23
+
24
+ // puppeteer-core ships with the HyperFrames CLI in the npx cache; find it rather than add a dependency.
25
+ function puppeteer() {
26
+ const root = path.join(os.homedir(), ".npm", "_npx");
27
+ for (const d of fs.existsSync(root) ? fs.readdirSync(root) : []) {
28
+ const m = path.join(root, d, "node_modules", "puppeteer-core");
29
+ if (fs.existsSync(m)) return createRequire(path.join(root, d, "node_modules", "x.js"))("puppeteer-core");
30
+ }
31
+ throw new Error("puppeteer-core not found: run `npx -y hyperframes@0.8.176 --version` once, then retry");
32
+ }
33
+ const chromium = () => ["/usr/bin/chromium", "/usr/bin/chromium-browser", "/usr/bin/google-chrome", "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"].find((p) => fs.existsSync(p))
34
+ || (() => { throw new Error("no Chromium found"); })();
35
+
36
+ const vdir = process.argv[2];
37
+ if (!vdir) { console.error("usage: node record.mjs videos/<name>"); process.exit(2); }
38
+ const spec = JSON.parse(fs.readFileSync(path.join(vdir, "record.json"), "utf8"));
39
+ const out = path.join(vdir, "rec");
40
+ fs.mkdirSync(out, { recursive: true });
41
+ const W = (ms) => new Promise((r) => setTimeout(r, ms));
42
+ const b = await puppeteer().launch({ executablePath: chromium(), args: ["--no-sandbox"] });
43
+
44
+ for (const clip of spec.clips) {
45
+ const dev = DEVICES[clip.device];
46
+ if (!dev) throw new Error(`clip ${clip.name}: unknown device ${clip.device}`);
47
+ const p = await b.newPage();
48
+ await p.setViewport(dev);
49
+ await p.goto(new URL(clip.path || "/", spec.url).href, { waitUntil: "networkidle2" });
50
+ await W(800);
51
+ const taps = [];
52
+ let t0 = Date.now();
53
+ // A visible element by CSS or by its exact text ("text:Add").
54
+ const find = async (q) => {
55
+ const all = q.startsWith("text:") ? await p.$$(`xpath/.//*[self::button or self::a or self::label or @role='tab' or @role='button'][normalize-space()=${JSON.stringify(q.slice(5))}]`) : await p.$$(q);
56
+ for (const e of all) if (await e.evaluate((n) => n.getBoundingClientRect().width > 0)) return e;
57
+ throw new Error(`clip ${clip.name}: nothing visible matches ${q}`);
58
+ };
59
+ const steps = async (list, log) => {
60
+ for (const [op, a, b2, c] of list) {
61
+ if (op === "wait") await W(a);
62
+ else if (op === "tap") {
63
+ const el = await find(a);
64
+ const r = await el.evaluate((e) => { const x = e.getBoundingClientRect(); return { x: x.x + x.width / 2, y: x.y + x.height / 2 }; });
65
+ if (log) taps.push({ t: (Date.now() - t0) / 1000 + 0.35, x: r.x, y: r.y });
66
+ await W(log ? 350 : 0);
67
+ await el.evaluate((e) => e.click());
68
+ } else if (op === "type") { await (await find(a)).focus(); await p.keyboard.type(b2, { delay: log ? (c ?? 55) : 0 }); }
69
+ else if (op === "key") await p.keyboard.press(a);
70
+ else if (op === "scroll") await p.mouse.wheel({ deltaY: a });
71
+ else if (op === "goto") await p.goto(new URL(a, spec.url).href, { waitUntil: "networkidle2" });
72
+ else throw new Error(`clip ${clip.name}: unknown step ${op}`);
73
+ }
74
+ };
75
+ if (clip.prep) { await steps(clip.prep, false); await W(800); }
76
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), `rec-${clip.name}-`));
77
+ const frames = [];
78
+ t0 = Date.now();
79
+ let on = true, n = 0;
80
+ const loop = (async () => {
81
+ while (on) {
82
+ const file = path.join(dir, `${String(n++).padStart(5, "0")}.jpg`);
83
+ const t = (Date.now() - t0) / 1000;
84
+ await p.screenshot({ path: file, type: "jpeg", quality: 90 });
85
+ frames.push({ file, t });
86
+ }
87
+ })();
88
+ await steps(clip.steps, true);
89
+ await W(300);
90
+ on = false;
91
+ await loop;
92
+ await p.close();
93
+ // Variable-rate frames to a 30 fps clip: each frame holds until the next was taken.
94
+ const list = frames.map((f, i) => `file '${f.file}'\nduration ${((frames[i + 1]?.t ?? f.t + 0.5) - f.t).toFixed(4)}`).join("\n") + `\nfile '${frames.at(-1).file}'\n`;
95
+ fs.writeFileSync(path.join(dir, "list.txt"), list);
96
+ const mp4 = path.join(out, `${clip.name}.mp4`);
97
+ execFileSync("ffmpeg", ["-v", "error", "-y", "-f", "concat", "-safe", "0", "-i", path.join(dir, "list.txt"),
98
+ "-vf", "fps=30,crop=trunc(iw/2)*2:trunc(ih/2)*2:0:0,format=yuv420p", "-c:v", "libx264", "-crf", "16", "-g", "15", mp4]);
99
+ fs.writeFileSync(path.join(out, `${clip.name}.json`), JSON.stringify({ device: clip.device, cssW: dev.width, cssH: dev.height, seconds: frames.at(-1).t, taps }, null, 1));
100
+ fs.rmSync(dir, { recursive: true, force: true });
101
+ console.log(`recorded ${mp4}: ${frames.length} frames, ${(frames.length / frames.at(-1).t).toFixed(1)} fps, ${taps.length} taps`);
102
+ }
103
+ await b.close();
package/web/board.html CHANGED
@@ -274,7 +274,7 @@ body.paged #board,body.paged .ftr,body.paged .scrim,body.paged #bq{display:none}
274
274
  body.paged:not(.ice) .hdr,body.ice aside.docked>header{display:none}body.ice #newtop{visibility:hidden}
275
275
  /* The Terminal page: the project bar stays (it picks whose terminals show), the board gives way to the tiles */
276
276
  #terms{display:none}body.termv.paged .hdr{display:flex}body.termv #newtop,body.termv #fbtn{display:none!important}
277
- body.termv #terms{flex:1;min-height:0;display:flex;flex-direction:column;gap:8px;padding:10px 20px 14px 28px}
277
+ body.termv #terms{flex:1;min-height:0;display:flex;flex-direction:column;gap:8px;padding:10px 20px 14px 28px;animation:fi .2s}
278
278
  .tbar{display:flex;flex-wrap:wrap;align-items:center;gap:6px;font-size:12px}#tmodes{display:none}body.termv #tmodes{display:inline-flex}#tmodes button{display:inline-grid;place-items:center;padding:0 8px}#tmodes svg{width:16px;height:16px}.tbar .chip{cursor:pointer;background:none;border:0;font:inherit;font-size:11px}.tbar .chip:hover{color:var(--ink)}.tbar svg{width:12px;height:12px}
279
279
  .tgrid{position:relative;flex:1;min-height:0;display:grid;gap:6px}
280
280
  .tile{display:flex;flex-direction:column;min-width:0;min-height:0;border:1px solid var(--line);border-radius:var(--r-s);background:var(--bg);overflow:hidden}.tile.off{display:none}.tile.drop{outline:2px solid var(--accent);outline-offset:-2px}
package/web/board.js CHANGED
@@ -1,4 +1,4 @@
1
- /* kaizen board c24cf970db99487d -- generated by bun run build:web from web/board/main.ts; do not edit */
1
+ /* kaizen board 1b860dbd5cc99a97 -- generated by bun run build:web from web/board/main.ts; do not edit */
2
2
  (()=>{var a={S:{project:null,projects:[],cards:[],now:Date.now(),all:!1},all:new URLSearchParams(location.search).get("all")!=="0",dir:null,openKey:null,mode:null,modeKey:null,menuKey:null,flash:new Set,tab:"request",lastTab:"request",runDoc:null,clearMenu:!1,sevMenu:!1,wantTerm:null,setQ:"",pageGen:0,PL:[],shown:new Set((()=>{try{return JSON.parse(localStorage.getItem("kz-show"))||[]}catch(e){return[]}})())};var s=(e)=>document.getElementById(e),Fe=(e)=>String(e).replace(/[&<>"]/g,(t)=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t]);class sn{s;constructor(e){this.s=e}toString(){return this.s}}var B=(e)=>new sn(String(e)),Qn=(e)=>e instanceof sn?e.s:Array.isArray(e)?e.map(Qn).join(""):e==null||e===!1?"":Fe(e),h=(e,...t)=>B(e.reduce((n,i,r)=>n+Qn(t[r-1])+i)),E=(e)=>B(`<svg><use href="#i-${e}"/></svg>`),Mt=B('<div aria-busy="true" aria-label="Loading"><span class="skel" style="height:16px;width:35%;margin:20px 0 14px"></span>'+'<span class="skel" style="height:44px;margin-bottom:10px"></span>'.repeat(4)+"</div>"),jt=(e)=>Promise.all(e.map((t)=>new Promise((n)=>{let i=new FileReader;i.onload=()=>n({name:t.name,data:i.result}),i.readAsDataURL(t)})));function _e(e){let t=document.createElement("dialog");return t.className="kz",t.innerHTML=`<form class="inl" method="dialog">${e}</form>`,t.onclose=()=>t.remove(),t.onclick=(n)=>{if(n.target===t)t.close()},document.body.appendChild(t),t.showModal(),t}var Zs=()=>{let e=document.documentElement.dataset.motion;return e?e==="full":!matchMedia("(prefers-reduced-motion: reduce)").matches},Ye=(e)=>Zs()&&document.startViewTransition?document.startViewTransition(e).updateCallbackDone:(e(),Promise.resolve());var Jn;function C(e,t){let n=s("toast");if(n.textContent=e,n.classList.toggle("rep",!!t),t){let i=document.createElement("a");i.href="/issue?"+new URLSearchParams(t),i.target="_blank",i.rel="noopener",i.textContent="Report",n.append(" ",i)}n.classList.add("on"),clearTimeout(Jn),Jn=setTimeout(()=>n.classList.remove("on"),t?8000:4000)}function Le(){try{if(typeof Notification<"u"&&Notification.permission==="default")Notification.requestPermission()}catch(e){}}function on(e,t){try{if(typeof Notification<"u"&&Notification.permission==="granted")new Notification("kaizen",{body:e,icon:"/logo.png",tag:t})}catch(n){}}var Xs="https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.3.0",Yn={tiny:"onnx-community/whisper-tiny",base:"onnx-community/whisper-base",small:"onnx-community/whisper-small","large-v3-turbo":"onnx-community/whisper-large-v3-turbo"},an=null,eo=`import{pipeline}from"${Xs}";let asr=null;
3
3
  onmessage=async e=>{const m=e.data;try{
4
4
  if(m.type==="load"){const prog=p=>{if(p.status==="progress")postMessage({type:"progress",file:p.file,pct:p.progress||0})};
package/web/notebook.js CHANGED
@@ -1,4 +1,4 @@
1
- /* kaizen notebook c24cf970db99487d -- generated by bun run build:web from web/notebook.ts; do not edit */
1
+ /* kaizen notebook 1b860dbd5cc99a97 -- generated by bun run build:web from web/notebook.ts; do not edit */
2
2
  var Ss=[],ua=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map((t)=>t?parseInt(t,36):1);for(let t=0,i=0;t<e.length;t++)(t%2?ua:Ss).push(i=i+e[t])})();function op(e){if(e<768)return!1;for(let t=0,i=Ss.length;;){let n=t+i>>1;if(e<Ss[n])i=n;else if(e>=ua[n])t=n+1;else return!0;if(t==i)return!1}}function ha(e){return e>=127462&&e<=127487}var fa=8205;function da(e,t,i=!0,n=!0){return(i?Oa:lp)(e,t,n)}function Oa(e,t,i){if(t==e.length)return t;if(t&&pa(e.charCodeAt(t))&&ma(e.charCodeAt(t-1)))t--;let n=bs(e,t);t+=ca(n);while(t<e.length){let r=bs(e,t);if(n==fa||r==fa||i&&op(r))t+=ca(r),n=r;else if(ha(r)){let s=0,o=t-2;while(o>=0&&ha(bs(e,o)))s++,o-=2;if(s%2==0)break;else t+=2}else break}return t}function lp(e,t,i){while(t>1){let n=Oa(e,t-2,i);if(n<t)return n;t--}return 0}function bs(e,t){let i=e.charCodeAt(t);if(!ma(i)||t+1==e.length)return i;let n=e.charCodeAt(t+1);if(!pa(n))return i;return(i-55296<<10)+(n-56320)+65536}function pa(e){return e>=56320&&e<57344}function ma(e){return e>=55296&&e<56320}function ca(e){return e<65536?1:2}class _{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=vi(this,e,t);let n=[];if(this.decompose(0,e,n,2),i.length)i.decompose(0,i.length,n,3);return this.decompose(t,this.length,n,1),ft.from(n,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=vi(this,e,t);let i=[];return this.decompose(e,t,i,0),ft.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),n=new wi(this),r=new wi(e);for(let s=t,o=t;;){if(n.next(s),r.next(s),s=0,n.lineBreak!=r.lineBreak||n.done!=r.done||n.value!=r.value)return!1;if(o+=n.value.length,n.done||o>=i)return!0}}iter(e=1){return new wi(this,e)}iterRange(e,t=this.length){return new Ts(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{if(t==null)t=this.lines+1;let n=this.line(e).from;i=this.iterRange(n,Math.max(n,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new As(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw RangeError("A document must have at least one line");if(e.length==1&&!e[0])return _.empty;return e.length<=32?new oe(e):ft.from(oe.split(e,[]))}}class oe extends _{constructor(e,t=ap(e)){super();this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,n){for(let r=0;;r++){let s=this.text[r],o=n+s.length;if((t?i:o)>=e)return new ka(n,o,i,s);n=o+1,i++}}decompose(e,t,i,n){let r=e<=0&&t>=this.length?this:new oe(ga(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(n&1){let s=i.pop(),o=cr(r.text,s.text.slice(),0,r.length);if(o.length<=32)i.push(new oe(o,s.length+r.length));else{let l=o.length>>1;i.push(new oe(o.slice(0,l)),new oe(o.slice(l)))}}else i.push(r)}replace(e,t,i){if(!(i instanceof oe))return super.replace(e,t,i);[e,t]=vi(this,e,t);let n=cr(this.text,cr(i.text,ga(this.text,0,e)),t),r=this.length+i.length-(t-e);if(n.length<=32)return new oe(n,r);return ft.from(oe.split(n,[]),r)}sliceString(e,t=this.length,i=`
3
3
  `){[e,t]=vi(this,e,t);let n="";for(let r=0,s=0;r<=t&&s<this.text.length;s++){let o=this.text[s],l=r+o.length;if(r>e&&s)n+=i;if(e<l&&t>r)n+=o.slice(Math.max(0,e-r),t-r);r=l+1}return n}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],n=-1;for(let r of e)if(i.push(r),n+=r.length+1,i.length==32)t.push(new oe(i,n)),i=[],n=-1;if(n>-1)t.push(new oe(i,n));return t}}class ft extends _{constructor(e,t){super();this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,n){for(let r=0;;r++){let s=this.children[r],o=n+s.length,l=i+s.lines-1;if((t?l:o)>=e)return s.lineInner(e,t,i,n);n=o+1,i=l+1}}decompose(e,t,i,n){for(let r=0,s=0;s<=t&&r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e<=l&&t>=s){let a=n&((s<=e?1:0)|(l>=t?2:0));if(s>=e&&l<=t&&!a)i.push(o);else o.decompose(e-s,t-s,i,a)}s=l+1}}replace(e,t,i){if([e,t]=vi(this,e,t),i.lines<this.lines)for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],o=r+s.length;if(e>=r&&t<=o){let l=s.replace(e-r,t-r,i),a=this.lines-s.lines+l.lines;if(l.lines<a>>4&&l.lines>a>>6){let h=this.children.slice();return h[n]=l,new ft(h,this.length-(t-e)+i.length)}return super.replace(r,o,l)}r=o+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
4
4
  `){[e,t]=vi(this,e,t);let n="";for(let r=0,s=0;r<this.children.length&&s<=t;r++){let o=this.children[r],l=s+o.length;if(s>e&&r)n+=i;if(e<l&&t>s)n+=o.sliceString(e-s,t-s,i);s=l+1}return n}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof ft))return 0;let i=0,[n,r,s,o]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;n+=t,r+=t){if(n==s||r==o)return i;let l=this.children[n],a=e.children[r];if(l!=a)return i+l.scanIdentical(a,t);i+=l.length+1}}static from(e,t=e.reduce((i,n)=>i+n.length+1,-1)){let i=0;for(let u of e)i+=u.lines;if(i<32){let u=[];for(let d of e)d.flatten(u);return new oe(u,t)}let n=Math.max(32,i>>5),r=n<<1,s=n>>1,o=[],l=0,a=-1,h=[];function f(u){let d;if(u.lines>r&&u instanceof ft)for(let O of u.children)f(O);else if(u.lines>s&&(l>s||!l))c(),o.push(u);else if(u instanceof oe&&l&&(d=h[h.length-1])instanceof oe&&u.lines+d.lines<=32)l+=u.lines,a+=u.length+1,h[h.length-1]=new oe(d.text.concat(u.text),d.length+1+u.length);else{if(l+u.lines>n)c();l+=u.lines,a+=u.length+1,h.push(u)}}function c(){if(l==0)return;o.push(h.length==1?h[0]:ft.from(h,a)),a=-1,l=h.length=0}for(let u of e)f(u);return c(),o.length==1?o[0]:new ft(o,t)}}_.empty=new oe([""],0);function ap(e){let t=-1;for(let i of e)t+=i.length+1;return t}function cr(e,t,i=0,n=1e9){for(let r=0,s=0,o=!0;s<e.length&&r<=n;s++){let l=e[s],a=r+l.length;if(a>=i){if(a>n)l=l.slice(0,n-r);if(r<i)l=l.slice(i-r);if(o)t[t.length-1]+=l,o=!1;else t.push(l)}r=a+1}return t}function ga(e,t,i){return cr(e,[""],t,i)}class wi{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof oe?e.text.length:e.children.length)<<1]}nextInner(e,t){this.done=this.lineBreak=!1;for(;;){let i=this.nodes.length-1,n=this.nodes[i],r=this.offsets[i],s=r>>1,o=n instanceof oe?n.text.length:n.children.length;if(s==(t>0?o:0)){if(i==0)return this.done=!0,this.value="",this;if(t>0)this.offsets[i-1]++;this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
package/web/term.js CHANGED
@@ -1,4 +1,4 @@
1
- /* kaizen terminal c24cf970db99487d -- generated by bun run build:web from web/term.ts; do not edit */
1
+ /* kaizen terminal 1b860dbd5cc99a97 -- generated by bun run build:web from web/term.ts; do not edit */
2
2
  (()=>{var{defineProperty:Ao,getOwnPropertyDescriptor:Jh}=Object,Qh=(e,t)=>{for(var i in t)Ao(e,i,{get:t[i],enumerable:!0})},he=(e,t,i,s)=>{for(var r=s>1?void 0:s?Jh(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(s?o(t,i,r):o(r))||r);return s&&r&&Ao(t,i,r),r},P=(e,t)=>(i,s)=>t(i,s,e),Rn="Terminal input",rr={get:()=>Rn,set:(e)=>Rn=e},Dn="Too much output to announce, navigate to rows manually to read",nr={get:()=>Dn,set:(e)=>Dn=e};function el(e){return e.replace(/\r?\n/g,"\r")}function tl(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function il(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function sl(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");Po(r,t,i,s)}}function Po(e,t,i,s){e=el(e),e=tl(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function Oo(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function Tn(e,t,i,s,r){Oo(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function Bt(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function us(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let n=e[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var rl=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=e.charCodeAt(r++);56320<=n&&n<=57343?t[s++]=(this._interim-55296)*1024+n-56320+65536:(t[s++]=this._interim,t[s++]=n),this._interim=0}for(let n=r;n<i;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,s;let a=e.charCodeAt(n);56320<=a&&a<=57343?t[s++]=(o-55296)*1024+a-56320+65536:(t[s++]=o,t[s++]=a);continue}o!==65279&&(t[s++]=o)}return s}},nl=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r,n,o,a,l=0,h=0;if(this.interim[0]){let u=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let v=0,b;for(;(b=this.interim[++v]&63)&&v<4;)f<<=6,f|=b;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,A=E-v;for(;h<A;){if(h>=i)return 0;if(b=e[h++],(b&192)!==128){h--,u=!0;break}else this.interim[v++]=b,f<<=6,f|=b&63}u||(E===2?f<128?h--:t[s++]=f:E===3?f<2048||f>=55296&&f<=57343||f===65279||(t[s++]=f):f<65536||f>1114111||(t[s++]=f)),this.interim.fill(0)}let d=i-4,c=h;for(;c<i;){for(;c<d&&!((r=e[c])&128)&&!((n=e[c+1])&128)&&!((o=e[c+2])&128)&&!((a=e[c+3])&128);)t[s++]=r,t[s++]=n,t[s++]=o,t[s++]=a,c+=4;if(r=e[c++],r<128)t[s++]=r;else if((r&224)===192){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(l=(r&31)<<6|n&63,l<128){c--;continue}t[s++]=l}else if((r&240)===224){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[c++],(o&192)!==128){c--;continue}if(l=(r&15)<<12|(n&63)<<6|o&63,l<2048||l>=55296&&l<=57343||l===65279)continue;t[s++]=l}else if((r&248)===240){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[c++],(o&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=o,s;if(a=e[c++],(a&192)!==128){c--;continue}if(l=(r&7)<<18|(n&63)<<12|(o&63)<<6|a&63,l<65536||l>1114111)continue;t[s++]=l}}return s}},Io="",At=" ",Ri=class e{constructor(){this.fg=0,this.bg=0,this.extended=new ss}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},ss=class e{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Ye=class e extends Ri{constructor(){super(...arguments);this.content=0,this.fg=0,this.bg=0,this.extended=new ss,this.combinedData=""}static fromCharData(t){let i=new e;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Bt(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Bn="di$target",or="di$dependencies",$s=new Map;function ol(e){return e[or]||[]}function xe(e){if($s.has(e))return $s.get(e);let t=function(i,s,r){if(arguments.length!==3)throw Error("@IServiceName-decorator can only be used to decorate a parameter");al(t,i,r)};return t._id=e,$s.set(e,t),t}function al(e,t,i){t[Bn]===t?t[or].push({id:e,index:i}):(t[or]=[{id:e,index:i}],t[Bn]=t)}var Pe=xe("BufferService"),No=xe("CoreMouseService"),Gt=xe("CoreService"),hl=xe("CharsetService"),Pr=xe("InstantiationService"),Fo=xe("LogService"),Oe=xe("OptionsService"),Wo=xe("OscLinkService"),ll=xe("UnicodeService"),Di=xe("DecorationService"),ar=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new Ye,o=i.getTrimmedLength(),a=-1,l=-1,h=!1;for(let d=0;d<o;d++)if(!(l===-1&&!i.hasContent(d))){if(i.loadCell(d,n),n.hasExtendedAttrs()&&n.extended.urlId)if(l===-1){l=d,a=n.extended.urlId;continue}else h=n.extended.urlId!==a;else l!==-1&&(h=!0);if(h||l!==-1&&d===o-1){let c=this._oscLinkService.getLinkData(a)?.uri;if(c){let u={start:{x:l+1,y:e},end:{x:d+(!h&&d===o-1?1:0),y:e}},f=!1;if(!r?.allowNonHttpProtocols)try{let v=new URL(c);["http:","https:"].includes(v.protocol)||(f=!0)}catch{f=!0}f||s.push({text:c,range:u,activate:(v,b)=>r?r.activate(v,b,u):cl(v,b),hover:(v,b)=>r?.hover?.(v,b,u),leave:(v,b)=>r?.leave?.(v,b,u)})}h=!1,n.hasExtendedAttrs()&&n.extended.urlId?(l=d,a=n.extended.urlId):(l=-1,a=-1)}}t(s)}};ar=he([P(0,Pe),P(1,Oe),P(2,Wo)],ar);function cl(e,t){if(confirm(`Do you want to navigate to ${t}?
3
3
 
4
4
  WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var _s=xe("CharSizeService"),gt=xe("CoreBrowserService"),Or=xe("MouseService"),pt=xe("RenderService"),dl=xe("SelectionService"),zo=xe("CharacterJoinerService"),Qt=xe("ThemeService"),Ho=xe("LinkProviderService"),ul=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?An.isErrorNoTelemetry(e)?new An(e.message+`