@andares/pi-toolkits 1.2.0 → 1.2.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/CHANGELOG.md +15 -0
- package/README.md +10 -118
- package/README.zh-CN.md +11 -53
- package/package.json +2 -4
- package/src/features/review-page/assets/index-DPWL_ipb.css +1 -0
- package/src/features/review-page/assets/index-XxrDCe96.js +1 -0
- package/src/features/review-page/assets/index.html +2 -2
- package/src/features/spec/assets.test.ts +16 -1
- package/src/features/spec/index.test.ts +42 -1
- package/src/features/spec/index.ts +1 -1
- package/src/features/spec/server.test.ts +48 -4
- package/src/features/spec/server.ts +10 -0
- package/src/features/talk/index.test.ts +60 -4
- package/src/features/talk/index.ts +64 -4
- package/src/features/talk/server.test.ts +40 -3
- package/src/features/talk/server.ts +22 -1
- package/src/features/uat/index.test.ts +19 -1
- package/src/index.ts +0 -3
- package/src/lib/approval-log.ts +3 -3
- package/src/lib/web-review.test.ts +80 -0
- package/src/lib/web-review.ts +27 -5
- package/src/features/quit-guard/constants.ts +0 -98
- package/src/features/quit-guard/guard.ts +0 -235
- package/src/features/quit-guard/index.ts +0 -368
- package/src/features/quit-guard/killer.test.ts +0 -77
- package/src/features/quit-guard/killer.ts +0 -215
- package/src/features/quit-guard/quit-guard.test.ts +0 -853
- package/src/features/quit-guard/report.ts +0 -212
- package/src/features/quit-guard/store.ts +0 -144
- package/src/features/review-page/assets/index-CrDwcsqI.css +0 -1
- package/src/features/review-page/assets/index-DYxi32gA.js +0 -1
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* quit-guard feature — hang artifact.
|
|
3
|
-
*
|
|
4
|
-
* When the watchdog fires, extension cleanup was cut short. The artifact is
|
|
5
|
-
* the only evidence of what the process was waiting on, so it is written
|
|
6
|
-
* synchronously *before* `process.exit(0)` and never throws: a failed report
|
|
7
|
-
* must not keep the user from getting the prompt back.
|
|
8
|
-
*
|
|
9
|
-
* Contents: the arm/fire timing, the process state (`activeHandles` /
|
|
10
|
-
* `activeRequests` class names from Node's undocumented introspection helpers),
|
|
11
|
-
* and the host's own libuv handle table (`process.report.getReport().libuv`).
|
|
12
|
-
* Together they are enough to tell "waiting on a socket" from "waiting on a
|
|
13
|
-
* thin promise that nobody will ever resolve" — the latter shows up as an
|
|
14
|
-
* empty handle table with pi's extension-shutdown frames missing.
|
|
15
|
-
*
|
|
16
|
-
* Privacy: `argv` and `cwd` are process facts, not conversation data, but they
|
|
17
|
-
* are still credential-adjacent (`pi --api-key …`, a prompt passed as an
|
|
18
|
-
* argument, a path under a private tree). The file is therefore owner-only
|
|
19
|
-
* (0600 in an 0700 directory, matching the approval log) and every argument
|
|
20
|
-
* goes through the same redaction rules the approval log uses.
|
|
21
|
-
*/
|
|
22
|
-
import { mkdirSync, writeFileSync } from "node:fs";
|
|
23
|
-
import { join } from "node:path";
|
|
24
|
-
import { redactText } from "../../lib/approval-log.js";
|
|
25
|
-
|
|
26
|
-
export interface HangReport {
|
|
27
|
-
version: 1;
|
|
28
|
-
kind: "quit-guard";
|
|
29
|
-
/** ISO timestamp of the forced exit. */
|
|
30
|
-
timestamp: string;
|
|
31
|
-
pid: number;
|
|
32
|
-
/** Watchdog deadline that was configured at arm time. */
|
|
33
|
-
timeoutMs: number;
|
|
34
|
-
/** Time actually spent inside the shutdown phase. */
|
|
35
|
-
elapsedMs: number;
|
|
36
|
-
/** The teardown sequence that armed the guard. */
|
|
37
|
-
marker: string;
|
|
38
|
-
uptimeSeconds: number;
|
|
39
|
-
cwd: string;
|
|
40
|
-
/** Process arguments, redacted (see the privacy note above). */
|
|
41
|
-
argv: string[];
|
|
42
|
-
/** Constructor names of handles keeping the event loop alive. */
|
|
43
|
-
activeHandles: string[];
|
|
44
|
-
/** Node's pending-request list (fs, dns, zlib, ... callbacks). */
|
|
45
|
-
activeRequests: string[];
|
|
46
|
-
/**
|
|
47
|
-
* Host libuv handle table (trimmed). Empty but non-null means "nothing is
|
|
48
|
-
* pending that the OS knows about": the process is parked on a promise.
|
|
49
|
-
*/
|
|
50
|
-
libuv: unknown[];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
interface ProcessIntrospection {
|
|
54
|
-
_getActiveHandles?: () => unknown[];
|
|
55
|
-
_getActiveRequests?: () => unknown[];
|
|
56
|
-
report?: { getReport?: () => { libuv?: unknown[] } };
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export interface HangReportInput {
|
|
60
|
-
timeoutMs: number;
|
|
61
|
-
elapsedMs: number;
|
|
62
|
-
marker: string;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
export interface HangReportOptions {
|
|
66
|
-
now?: () => Date;
|
|
67
|
-
pid?: number;
|
|
68
|
-
cwd?: string;
|
|
69
|
-
argv?: string[];
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** Stand-in for `process.cwd()` when the working directory no longer exists. */
|
|
73
|
-
const UNKNOWN_CWD = "<unknown: working directory unavailable>";
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Flags whose *next* argument is a credential. `--api-key` with a bare opaque
|
|
77
|
-
* token is the common shape and matches none of the value-prefix rules, so the
|
|
78
|
-
* pair has to be recognised positionally.
|
|
79
|
-
*/
|
|
80
|
-
const SECRET_ARG =
|
|
81
|
-
/^--?(?:api[-_]?key|key|token|access[-_]?token|refresh[-_]?token|auth[-_]?token|secret|client[-_]?secret|password|passwd)$/i;
|
|
82
|
-
|
|
83
|
-
/** Redact one argument list: flag/value pairs first, then the value patterns. */
|
|
84
|
-
export function redactArgv(argv: readonly string[]): string[] {
|
|
85
|
-
let hideNext = false;
|
|
86
|
-
return argv.map((arg) => {
|
|
87
|
-
if (hideNext) {
|
|
88
|
-
hideNext = false;
|
|
89
|
-
return "[redacted]";
|
|
90
|
-
}
|
|
91
|
-
if (SECRET_ARG.test(arg)) {
|
|
92
|
-
hideNext = true;
|
|
93
|
-
return arg;
|
|
94
|
-
}
|
|
95
|
-
const pair = /^(--?[^=]+)=(.+)$/.exec(arg);
|
|
96
|
-
if (pair && SECRET_ARG.test(pair[1] ?? "")) {
|
|
97
|
-
return `${pair[1]}=[redacted]`;
|
|
98
|
-
}
|
|
99
|
-
return redactText(arg);
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/** Owner-only modes; the file is credential-adjacent, like the approval log. */
|
|
104
|
-
const REPORT_DIR_MODE = 0o700;
|
|
105
|
-
const REPORT_FILE_MODE = 0o600;
|
|
106
|
-
|
|
107
|
-
/** Read a process fact without letting it abort the report. */
|
|
108
|
-
function attempt<T>(read: () => T, fallback: T): T {
|
|
109
|
-
try {
|
|
110
|
-
return read();
|
|
111
|
-
} catch {
|
|
112
|
-
// Every field here is diagnostics; a missing one is better than no report.
|
|
113
|
-
return fallback;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function constructorNames(list: unknown[] | undefined): string[] {
|
|
118
|
-
if (!Array.isArray(list)) return [];
|
|
119
|
-
const names = new Set<string>();
|
|
120
|
-
for (const item of list) {
|
|
121
|
-
const name =
|
|
122
|
-
item && typeof item === "object" && "constructor" in item
|
|
123
|
-
? (item.constructor as { name?: string })?.name
|
|
124
|
-
: undefined;
|
|
125
|
-
names.add(
|
|
126
|
-
typeof name === "string" && name.length > 0
|
|
127
|
-
? name
|
|
128
|
-
: typeof item === "undefined"
|
|
129
|
-
? "undefined"
|
|
130
|
-
: String(typeof item),
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
return [...names].sort((a, b) => a.localeCompare(b));
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/** Show this to whoever has to debug the hang: one line, no prefixes. */
|
|
137
|
-
export function formatHangReportSummary(report: HangReport): string {
|
|
138
|
-
const handles =
|
|
139
|
-
report.activeHandles.length > 0
|
|
140
|
-
? report.activeHandles.join(", ")
|
|
141
|
-
: "none";
|
|
142
|
-
const cwd = report.cwd === UNKNOWN_CWD ? " (cwd unavailable)" : "";
|
|
143
|
-
return `shutdown exceeded ${report.timeoutMs}ms (spent ${report.elapsedMs}ms); handles: ${handles}${cwd}`;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export function collectHangReport(
|
|
147
|
-
input: HangReportInput,
|
|
148
|
-
options: HangReportOptions = {},
|
|
149
|
-
): HangReport {
|
|
150
|
-
// SAFETY: `_getActiveHandles`, `_getActiveRequests`, and `report.getReport`
|
|
151
|
-
// exist on Node's process object but are missing from (or narrower in)
|
|
152
|
-
// @types/node. `ProcessIntrospection` declares them as optional, so every
|
|
153
|
-
// use below is guarded and nothing is called unconditionally.
|
|
154
|
-
const proc = process as unknown as ProcessIntrospection & NodeJS.Process;
|
|
155
|
-
const now = options.now ?? (() => new Date());
|
|
156
|
-
const libuv = attempt(() => {
|
|
157
|
-
const raw = proc.report?.getReport?.();
|
|
158
|
-
return raw && Array.isArray(raw.libuv) ? raw.libuv.slice(0, 200) : [];
|
|
159
|
-
}, [] as unknown[]);
|
|
160
|
-
return {
|
|
161
|
-
version: 1,
|
|
162
|
-
kind: "quit-guard",
|
|
163
|
-
timestamp: now().toISOString(),
|
|
164
|
-
pid: options.pid ?? proc.pid,
|
|
165
|
-
timeoutMs: input.timeoutMs,
|
|
166
|
-
elapsedMs: Math.round(input.elapsedMs),
|
|
167
|
-
marker: input.marker,
|
|
168
|
-
uptimeSeconds: attempt(() => Math.round(proc.uptime()), 0),
|
|
169
|
-
// `process.cwd()` throws ENOENT when the directory was removed during
|
|
170
|
-
// the session (a startup crash pi itself guards against in 1.5.1). The
|
|
171
|
-
// report is written on the exit path, so it must survive that.
|
|
172
|
-
cwd: options.cwd ?? attempt(() => proc.cwd(), UNKNOWN_CWD),
|
|
173
|
-
argv: attempt(
|
|
174
|
-
() => redactArgv(options.argv ?? [...proc.argv]),
|
|
175
|
-
[],
|
|
176
|
-
),
|
|
177
|
-
activeHandles: constructorNames(
|
|
178
|
-
attempt(() => proc._getActiveHandles?.(), [] as unknown[]),
|
|
179
|
-
),
|
|
180
|
-
activeRequests: constructorNames(
|
|
181
|
-
attempt(() => proc._getActiveRequests?.(), [] as unknown[]),
|
|
182
|
-
),
|
|
183
|
-
libuv,
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* Write the report under `dir`. Returns the path, or `undefined` when the
|
|
189
|
-
* filesystem rejected it (read-only home, missing permissions, ...).
|
|
190
|
-
*/
|
|
191
|
-
export function writeHangReport(
|
|
192
|
-
dir: string,
|
|
193
|
-
report: HangReport,
|
|
194
|
-
): string | undefined {
|
|
195
|
-
try {
|
|
196
|
-
mkdirSync(dir, { recursive: true, mode: REPORT_DIR_MODE });
|
|
197
|
-
const stamp = report.timestamp.replace(/[:.]/g, "-");
|
|
198
|
-
const file = join(dir, `quit-hang-${stamp}-${report.pid}.json`);
|
|
199
|
-
writeFileSync(file, `${JSON.stringify(report, null, 2)}\n`, {
|
|
200
|
-
encoding: "utf8",
|
|
201
|
-
mode: REPORT_FILE_MODE,
|
|
202
|
-
});
|
|
203
|
-
return file;
|
|
204
|
-
} catch (error) {
|
|
205
|
-
// pi-lens-ignore: no-console-except-error,console-statement, — deliberate degradation log
|
|
206
|
-
console.warn(
|
|
207
|
-
"[pi-toolkits/quit-guard] Failed to write hang report:",
|
|
208
|
-
error instanceof Error ? error.message : String(error),
|
|
209
|
-
);
|
|
210
|
-
return undefined;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* quit-guard feature — persisted settings store.
|
|
3
|
-
*
|
|
4
|
-
* State lives in `<agent-dir>/pi-toolkits-quit-guard.json` (agent-dir from
|
|
5
|
-
* getAgentDir(), same convention as the favorites/compact/review stores).
|
|
6
|
-
*
|
|
7
|
-
* File shape:
|
|
8
|
-
* {
|
|
9
|
-
* "enabled": true,
|
|
10
|
-
* "timeoutMs": 8000,
|
|
11
|
-
* "report": true
|
|
12
|
-
* }
|
|
13
|
-
*
|
|
14
|
-
* `enabled` (default true) gates the whole watchdog; `timeoutMs` is clamped
|
|
15
|
-
* to [MIN_TIMEOUT_MS, MAX_TIMEOUT_MS]; `report` (default true) writes a JSON
|
|
16
|
-
* artifact under `<agent-dir>/quit-guard/` every time the guard fires.
|
|
17
|
-
*
|
|
18
|
-
* Robustness: a missing file means defaults (and is created on first save),
|
|
19
|
-
* corrupted/unreadable files fall back to defaults with a console.warn, and
|
|
20
|
-
* writes are atomic (tmp + rename) and never throw.
|
|
21
|
-
*/
|
|
22
|
-
import {
|
|
23
|
-
existsSync,
|
|
24
|
-
mkdirSync,
|
|
25
|
-
readFileSync,
|
|
26
|
-
renameSync,
|
|
27
|
-
writeFileSync,
|
|
28
|
-
} from "node:fs";
|
|
29
|
-
import { dirname, join } from "node:path";
|
|
30
|
-
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
31
|
-
import {
|
|
32
|
-
DEFAULT_TIMEOUT_MS,
|
|
33
|
-
MAX_TIMEOUT_MS,
|
|
34
|
-
MIN_TIMEOUT_MS,
|
|
35
|
-
QUIT_GUARD_FILE,
|
|
36
|
-
} from "./constants.js";
|
|
37
|
-
|
|
38
|
-
export interface QuitGuardConfig {
|
|
39
|
-
/** Master switch. When false the guard never arms. */
|
|
40
|
-
enabled: boolean;
|
|
41
|
-
/** Milliseconds allowed between the terminal teardown write and exit. */
|
|
42
|
-
timeoutMs: number;
|
|
43
|
-
/** Write a JSON hang report before forcing exit. */
|
|
44
|
-
report: boolean;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const DEFAULT_CONFIG: QuitGuardConfig = {
|
|
48
|
-
enabled: true,
|
|
49
|
-
timeoutMs: DEFAULT_TIMEOUT_MS,
|
|
50
|
-
report: true,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/** Clamp/round a timeout into the supported range; non-numbers fall back. */
|
|
54
|
-
export function normalizeTimeoutMs(value: unknown): number {
|
|
55
|
-
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
56
|
-
return DEFAULT_TIMEOUT_MS;
|
|
57
|
-
}
|
|
58
|
-
const rounded = Math.round(value);
|
|
59
|
-
if (rounded <= MIN_TIMEOUT_MS) return MIN_TIMEOUT_MS;
|
|
60
|
-
if (rounded >= MAX_TIMEOUT_MS) return MAX_TIMEOUT_MS;
|
|
61
|
-
return rounded;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
/** Coerce an unknown JSON blob into a complete config (defaults for gaps). */
|
|
65
|
-
export function normalizeConfig(input: unknown): QuitGuardConfig {
|
|
66
|
-
const config: QuitGuardConfig = { ...DEFAULT_CONFIG };
|
|
67
|
-
if (!input || typeof input !== "object") return config;
|
|
68
|
-
const raw = input as Partial<QuitGuardConfig>;
|
|
69
|
-
if (typeof raw.enabled === "boolean") config.enabled = raw.enabled;
|
|
70
|
-
if (typeof raw.report === "boolean") config.report = raw.report;
|
|
71
|
-
if (raw.timeoutMs !== undefined) {
|
|
72
|
-
config.timeoutMs = normalizeTimeoutMs(raw.timeoutMs);
|
|
73
|
-
}
|
|
74
|
-
return config;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export class QuitGuardStore {
|
|
78
|
-
private config: QuitGuardConfig = { ...DEFAULT_CONFIG };
|
|
79
|
-
private readonly file: string;
|
|
80
|
-
private loaded = false;
|
|
81
|
-
|
|
82
|
-
constructor(file: string = join(getAgentDir(), QUIT_GUARD_FILE)) {
|
|
83
|
-
this.file = file;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/** Path of the JSON file (also used to derive the report directory). */
|
|
87
|
-
get path(): string {
|
|
88
|
-
return this.file;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
private ensureLoaded(): void {
|
|
92
|
-
if (this.loaded) return;
|
|
93
|
-
this.loaded = true;
|
|
94
|
-
try {
|
|
95
|
-
if (!existsSync(this.file)) return;
|
|
96
|
-
const parsed: unknown = JSON.parse(readFileSync(this.file, "utf8"));
|
|
97
|
-
this.config = normalizeConfig(parsed);
|
|
98
|
-
} catch (error) {
|
|
99
|
-
// pi-lens-ignore: no-console-except-error,console-statement, — deliberate degradation log
|
|
100
|
-
console.warn(
|
|
101
|
-
"[pi-toolkits/quit-guard] Failed to load settings, using defaults:",
|
|
102
|
-
error instanceof Error ? error.message : String(error),
|
|
103
|
-
);
|
|
104
|
-
this.config = { ...DEFAULT_CONFIG };
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/** Current settings (a copy). */
|
|
109
|
-
get(): QuitGuardConfig {
|
|
110
|
-
this.ensureLoaded();
|
|
111
|
-
return { ...this.config };
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/** Merge a patch, normalize it, persist, and return the new settings. */
|
|
115
|
-
update(patch: Partial<QuitGuardConfig>): QuitGuardConfig {
|
|
116
|
-
this.ensureLoaded();
|
|
117
|
-
this.config = normalizeConfig({ ...this.config, ...patch });
|
|
118
|
-
this.save();
|
|
119
|
-
return { ...this.config };
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/** Atomically persist (tmp + rename). Never throws. */
|
|
123
|
-
save(): void {
|
|
124
|
-
try {
|
|
125
|
-
const dir = dirname(this.file);
|
|
126
|
-
if (!existsSync(dir)) {
|
|
127
|
-
mkdirSync(dir, { recursive: true });
|
|
128
|
-
}
|
|
129
|
-
const tmp = `${this.file}.tmp`;
|
|
130
|
-
writeFileSync(
|
|
131
|
-
tmp,
|
|
132
|
-
`${JSON.stringify(this.config, null, 2)}\n`,
|
|
133
|
-
"utf8",
|
|
134
|
-
);
|
|
135
|
-
renameSync(tmp, this.file);
|
|
136
|
-
} catch (error) {
|
|
137
|
-
// pi-lens-ignore: no-console-except-error,console-statement, — deliberate degradation log
|
|
138
|
-
console.warn(
|
|
139
|
-
"[pi-toolkits/quit-guard] Failed to save settings:",
|
|
140
|
-
error instanceof Error ? error.message : String(error),
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
:root{--paper:#fdf9f5;--paper-deep:#f4e7e2;--surface:#fffdfb;--surface-muted:#f6e9e2;--border:#ead8d1;--ink:#2b1a24;--muted:#8a7280;--brand:#e0446b;--brand-2:#f2704f;--accent:#7c5cfc;--success:#0f8a6a;--warning:#c97a15;--danger:#d23b4e;--tint-success:#e7f4ef;--tint-warning:#fbf0dc;--tint-accent:#ede8ff;--tint-danger:#fbe9ea;--tint-blush:#fdf0ec;--tint-paper:#f8ede8;--shadow:0 10px 32px #471b2712;--shadow-soft:0 18px 50px #471b2724;--serif:"P052", "Palatino Linotype", Palatino, "Iowan Old Style", Georgia, "Noto Serif", "Songti SC", serif;--sans:"Ubuntu Sans", "Noto Sans", "Droid Sans Fallback", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;--mono:"Noto Sans Mono", ui-monospace, SFMono-Regular, Menlo, monospace;--footer-h:96px;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light}*{box-sizing:border-box}body{min-height:100vh;color:var(--ink);font:15px/1.65 var(--sans);background:radial-gradient(680px 680px at 108% -6%, #f8b7ad8c, transparent 68%), radial-gradient(620px 620px at -10% 38%, #cbb9ff59, transparent 70%), radial-gradient(460px 460px at 106% 82%, #ffc7a857, transparent 70%), linear-gradient(180deg, var(--paper), var(--paper-deep));background-attachment:fixed;margin:0}.page{max-width:1440px;padding:0 140px calc(var(--footer-h) + 54px);margin:0 auto}.topbar{border-bottom:1px solid #c8a69c8c;padding:26px 0 18px}.masthead{justify-content:space-between;align-items:center;gap:16px;display:flex}.brand{align-items:center;gap:12px;display:flex}.brand-mark{width:32px;height:32px;color:var(--surface);background:linear-gradient(135deg, var(--brand), var(--brand-2));border-radius:10px;place-items:center;display:grid;box-shadow:0 6px 16px #e0446b59}.brand-mark svg{width:17px;height:17px}.eyebrow{letter-spacing:2.2px;text-transform:uppercase;color:var(--muted);font-size:10px;font-weight:700;line-height:1.2;display:inline-block}.top-actions{align-items:center;gap:10px;display:flex}.title-block{margin-top:18px}h1{font-family:var(--serif);letter-spacing:-.8px;color:var(--ink);overflow-wrap:anywhere;margin:0;font-size:clamp(38px,4.2vw,52px);font-weight:400;line-height:1.05}.meta{color:var(--muted);flex-wrap:wrap;align-items:center;gap:10px;margin-top:12px;font-size:12.5px;display:flex}.meta-path{text-overflow:ellipsis;white-space:nowrap;max-width:360px;font-family:var(--mono);font-size:12px;overflow:hidden}.meta-dot{background:#d9c6c0;border-radius:50%;flex:none;width:4px;height:4px}.meta-changed{color:var(--brand);font-weight:600}.readonly{border:1px solid var(--warning);color:var(--warning);border-radius:999px;padding:1px 8px;font-size:11px;line-height:1.5}.history{flex-wrap:wrap;align-items:center;gap:8px;margin-top:22px;display:flex}.history-label{margin-right:4px}.history-summary{color:var(--muted);margin-left:auto;font-size:11.5px}button{font:inherit;cursor:pointer}button:disabled{opacity:.45;cursor:not-allowed}.ghost{border:1px solid var(--border);height:34px;color:var(--ink);background:#fffdfbb8;border-radius:999px;justify-content:center;align-items:center;padding:0 14px;font-size:12.5px;transition:border-color .15s,background .15s;display:inline-flex}.ghost:hover:not(:disabled){background:var(--surface);border-color:#ddbfb5}.ghost:focus-visible,.chip:focus-visible,.add:focus-visible,.rail-note:focus-visible,.btn-feedback:focus-visible,.btn-approve:focus-visible,.primary:focus-visible,.link:focus-visible,.remove:focus-visible{outline:2px solid var(--brand);outline-offset:2px}.lang{min-width:52px}.link{color:var(--brand);font-size:inherit;background:0 0;border:none;padding:0;font-weight:600;text-decoration:underline}.chip{border:1px solid var(--border);height:30px;color:var(--muted);font-family:var(--mono);background:#fffdfb99;border-radius:999px;align-items:center;gap:6px;padding:0 12px;font-size:12px;transition:border-color .15s,background .15s,color .15s;display:inline-flex}.chip:hover{color:var(--ink);border-color:#ddbfb5}.chip.active{background:linear-gradient(100deg, var(--brand), var(--brand-2));color:var(--surface);border-color:#0000;box-shadow:0 6px 14px #e0446b52}.chip-changed{color:var(--warning);font-size:11px}.chip.active .chip-changed{color:#fffdfbd1}.layout{grid-template-columns:minmax(0,748px) 364px;align-items:start;gap:48px;padding-top:28px;display:grid}.reading{flex-direction:column;gap:14px;display:flex}.rail{flex-direction:column;gap:18px;display:flex}.error{color:#8e2433;background:#fbe9ead9;border:1px solid #d23b4e66;border-radius:14px;margin-bottom:14px;padding:12px 16px;font-size:13px}.banner{color:#7a4a0e;background:#fbf0dccc;border:1px solid #c97a1559;border-radius:14px;justify-content:space-between;align-items:center;gap:12px;padding:10px 14px;font-size:12.5px;display:flex}.done{border:1px solid var(--border);background:var(--surface);box-shadow:var(--shadow);border-radius:16px;padding:18px}.done-title{font-family:var(--serif);font-size:20px;line-height:1.3}.done-hint{color:var(--muted);margin-top:4px;font-size:13px}.empty{border:1px dashed var(--border);color:var(--muted);text-align:center;background:#fffdfb99;border-radius:16px;margin:0;padding:22px}.collapsed{border:1px solid var(--border);height:44px;color:var(--muted);background:#fff9f5b3;border-radius:12px;justify-content:center;align-items:center;gap:8px;font-size:12px;display:flex}.global-card{border:1px solid var(--border);background:var(--surface);box-shadow:var(--shadow);border-radius:16px;flex-direction:column;gap:12px;padding:18px 22px;scroll-margin-top:24px;display:flex}.global-head{align-items:center;gap:10px;display:flex}.global-head .add{margin-left:auto}.global-count{background:var(--tint-blush);color:#b72847;border-radius:999px;justify-content:center;align-items:center;min-width:22px;height:20px;padding:0 8px;font-size:11px;font-weight:700;display:inline-flex}.blocks{flex-direction:column;gap:14px;display:flex}.block{border:1px solid var(--border);background:var(--surface);box-shadow:var(--shadow);border-radius:16px;scroll-margin-top:24px;overflow:hidden}.block-bar{width:100%;height:3px}.bar-added{background:linear-gradient(90deg, var(--success), #0f8a6a00)}.bar-modified{background:linear-gradient(90deg, var(--warning), #c97a1500)}.bar-moved{background:linear-gradient(90deg, var(--accent), #7c5cfc00)}.bar-removed{background:linear-gradient(90deg, var(--danger), #d23b4e00)}.bar-unchanged{background:linear-gradient(90deg,#ead8d1e6,#ead8d100)}.block-inner{flex-direction:column;gap:12px;padding:18px 22px 20px;display:flex}.block.is-removed .block-body{opacity:.68}.block-head{align-items:center;gap:10px;min-height:24px;display:flex}.badge{letter-spacing:1.1px;text-transform:uppercase;white-space:nowrap;border-radius:999px;align-items:center;gap:6px;height:22px;padding:0 9px;font-size:10px;font-weight:700;line-height:1;display:inline-flex}.badge .dot{width:5px;height:5px}.badge-added{background:var(--tint-success);color:var(--success)}.badge-modified{background:var(--tint-warning);color:var(--warning)}.badge-moved{background:var(--tint-accent);color:var(--accent)}.badge-removed{background:var(--tint-danger);color:var(--danger)}.badge-unchanged{background:var(--surface-muted);color:var(--muted)}.dot{border-radius:50%;flex:none;width:6px;height:6px;display:inline-block}.badge .dot-added,.dot-added{background:var(--success)}.badge .dot-modified,.dot-modified{background:var(--warning)}.badge .dot-moved,.dot-moved{background:var(--accent)}.badge .dot-removed,.dot-removed{background:var(--danger)}.badge-unchanged .dot{background:var(--muted)}.rail-row .dot-removed{background:#d9c6c0}.dot-change,.dot-brand{background:var(--brand)}.dot-suggest{background:var(--accent)}.dot-question{background:var(--muted)}.block-id{font-family:var(--mono);color:var(--muted);font-size:10.5px;line-height:1}.add{color:var(--muted);background:0 0;border:none;border-radius:8px;margin-left:auto;padding:4px 6px;font-size:11.5px;transition:color .15s,background .15s}.add:hover{background:var(--tint-blush);color:var(--brand)}.block-body{color:var(--ink);overflow-wrap:anywhere;font-size:15px;line-height:1.65}.block-body>:first-child{margin-top:0}.block-body>:last-child{margin-bottom:0}.block-body p{margin:0 0 12px}.block-body h1,.block-body h2,.block-body h3,.block-body h4{font-family:var(--serif);letter-spacing:-.2px;color:var(--ink);margin:8px 0 10px;font-weight:400;line-height:1.25}.block-body h1{font-size:26px}.block-body h2{font-size:23px}.block-body h3{font-size:19px}.block-body h4{font-size:16px}.block-body ul,.block-body ol{margin:0 0 12px;padding-left:22px}.block-body li{margin:4px 0}.block-body code{color:#a9304a;font-family:var(--mono);background:#f1e4de;border-radius:5px;padding:1px 5px;font-size:.9em}.block-body pre{color:#ffe9e2;font-family:var(--mono);background:#2a1a22;border-radius:12px;margin:0 0 12px;padding:14px 16px;font-size:12.5px;line-height:1.6;overflow:auto}.block-body pre code{color:inherit;font-size:inherit;background:0 0;padding:0}.block-body a{color:var(--brand);text-underline-offset:2px;text-decoration:underline}.block-body blockquote{border-left:3px solid var(--border);color:var(--muted);margin:0 0 12px;padding-left:12px}.block-body table{border-collapse:collapse;width:100%;margin:0 0 12px;font-size:13.5px}.block-body th,.block-body td{border:1px solid var(--border);text-align:left;padding:6px 8px}.block-body th{background:var(--surface-muted);font-weight:600}.block-body hr{border:none;border-top:1px solid var(--border);margin:16px 0}.note{background:var(--tint-blush);border:1px solid #f3d3c8;border-radius:12px;align-items:flex-start;gap:10px;padding:11px 12px;font-size:13px;line-height:1.5;display:flex}.note-suggest{background:#f4f0ff;border-color:#dcd2f5}.note-question{border-color:var(--border);background:#f7f1ed}.note-verdict{letter-spacing:1px;text-transform:uppercase;white-space:nowrap;border-radius:999px;flex:none;padding:4px 8px;font-size:9.5px;font-weight:700;line-height:1}.verdict-change{color:#b72847;background:#f8dde2}.verdict-suggest{color:#5b3fc9;background:#ede8ff}.verdict-question{color:#7a5a4c;background:#efe4de}.note-text{white-space:pre-wrap;overflow-wrap:anywhere;flex:1;min-width:0}.remove{color:var(--muted);background:0 0;border:none;padding:0 0 0 4px;font-size:11.5px}.remove:hover{color:var(--danger)}.editor{background:#fffbf8;border:1px solid #ebcbc1;border-radius:14px;flex-direction:column;gap:10px;padding:14px;display:flex}.verdicts{flex-wrap:wrap;align-items:center;gap:8px;display:flex}.verdicts label{border:1px solid var(--border);height:28px;color:var(--muted);cursor:pointer;border-radius:999px;align-items:center;padding:0 12px;font-size:11.5px;transition:border-color .15s,background .15s,color .15s;display:inline-flex;position:relative}.verdicts label input{opacity:0;pointer-events:none;position:absolute}.verdicts label.active{background:var(--brand);color:var(--surface);border-color:#0000;font-weight:600}.editor textarea{resize:vertical;border:1px solid var(--border);background:var(--surface);width:100%;min-height:62px;color:var(--ink);font:inherit;border-radius:10px;outline:none;padding:10px 12px;font-size:13px;line-height:1.5}.editor textarea:focus{border-color:var(--brand);box-shadow:0 0 0 3px #e0446b1f}.editor-actions{justify-content:flex-end;align-items:center;gap:10px;display:flex}.primary{background:linear-gradient(100deg, var(--brand), var(--brand-2));height:32px;color:var(--surface);border:none;border-radius:999px;padding:0 16px;font-size:12px;font-weight:600}.rail-card{border:1px solid var(--border);background:var(--surface);box-shadow:var(--shadow);border-radius:16px;flex-direction:column;gap:12px;padding:20px;display:flex}.rail-big{align-items:flex-end;gap:10px;display:flex}.rail-number{font-family:var(--serif);color:var(--brand);font-size:50px;line-height:1}.rail-caption{color:var(--ink);flex-direction:column;gap:2px;padding-bottom:6px;font-size:12.5px;display:flex}.rail-caption .muted{color:var(--muted);font-size:11px}.rail-breakdown{flex-direction:column;gap:2px;display:flex}.rail-row{height:22px;color:var(--muted);align-items:center;gap:8px;font-size:12.5px;display:flex}.rail-row>span:nth-child(2){text-transform:capitalize}.rail-row b{color:var(--ink);margin-left:auto;font-weight:600}.rail-head{justify-content:space-between;align-items:center;gap:10px;display:flex}.rail-badge{background:var(--tint-blush);color:#b72847;border-radius:999px;justify-content:center;align-items:center;min-width:22px;height:20px;padding:0 8px;font-size:11px;font-weight:700;display:inline-flex}.rail-notes{flex-direction:column;gap:4px;display:flex}.rail-note{text-align:left;background:0 0;border:none;border-radius:10px;align-items:flex-start;gap:8px;width:100%;padding:8px;display:flex}.rail-note:hover{background:#fbf3ee}.rail-note .dot{margin-top:5px}.rail-note-body{flex-direction:column;gap:2px;min-width:0;display:flex}.rail-note-label{color:var(--muted);letter-spacing:.8px;text-transform:uppercase;white-space:nowrap;text-overflow:ellipsis;font-size:10px;overflow:hidden}.rail-note-text{color:var(--ink);-webkit-line-clamp:2;-webkit-box-orient:vertical;font-size:12.5px;line-height:1.45;display:-webkit-box;overflow:hidden}.rail-empty{color:var(--muted);margin:0;font-size:12.5px;line-height:1.5}.footer{z-index:30;width:min(1232px,100vw - 48px);min-height:76px;box-shadow:var(--shadow-soft);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);background:#fffdfbf0;border:1px solid #ebd8d1;border-radius:24px;grid-template-columns:1fr auto 1fr;align-items:center;gap:16px;padding:14px 24px;display:grid;position:fixed;bottom:18px;left:50%;transform:translate(-50%)}.footer-left,.footer-actions{align-items:center;gap:10px;display:flex}.footer-actions{justify-self:end}.footer-center{justify-self:center}.notes-count{background:var(--tint-paper);height:30px;color:var(--muted);white-space:nowrap;border-radius:999px;align-items:center;gap:8px;padding:0 12px;font-size:12px;font-weight:600;display:inline-flex}.notes-count .dot{width:7px;height:7px}.btn-feedback{background:var(--surface);color:#a9304a;border:1px solid #e7c9c1;border-radius:999px;height:44px;padding:0 20px;font-size:13px;font-weight:600;transition:background .15s,border-color .15s}.btn-feedback:hover:not(:disabled){background:#fff7f4;border-color:#d9a99c}.btn-approve{background:linear-gradient(100deg, var(--brand), var(--brand-2));height:44px;color:var(--surface);border:none;border-radius:999px;justify-content:center;align-items:center;gap:8px;padding:0 22px;font-size:13px;font-weight:600;transition:filter .15s,box-shadow .15s;display:inline-flex;box-shadow:0 8px 20px #e0446b61}.btn-approve:hover:not(:disabled){filter:brightness(1.03)}.btn-approve svg{width:15px;height:15px}@media (max-width:1200px){.page{padding:0 64px 150px}.layout{grid-template-columns:minmax(0,1fr) 332px;gap:32px}}@media (max-width:1040px){.page{padding:0 40px 150px}.layout{grid-template-columns:minmax(0,1fr)}}@media (max-width:800px){.history-summary{display:none}.footer{border-radius:20px;grid-template-columns:1fr;gap:8px;padding:12px}.footer-left{flex-wrap:wrap;order:1}.footer-center{order:2;justify-self:start}.footer-actions{order:3;justify-self:stretch}.footer-actions .btn-feedback,.footer-actions .btn-approve{flex:1}}@media (max-width:720px){.page{padding:0 20px 220px}.topbar{padding-top:20px}.block-inner{padding:14px 16px 16px}.global-card{padding:14px 16px}.meta-path{max-width:100%}.footer{width:calc(100vw - 24px);bottom:10px}}.bar-talk{background:linear-gradient(90deg,#e0446b4d,#e0446b00)}.block-talk .block-head{justify-content:space-between}.block-talk .block-id{display:none}.note-talk{align-items:center}.verdict-talk{color:#b72847;background:#f8dde2}.note-input{background:var(--surface);width:100%;min-height:84px;color:var(--ink);font:inherit;resize:vertical;border:1px solid #e7c9c1;border-radius:12px;padding:12px 14px;font-size:13px;line-height:1.55}.note-input:focus{border-color:#e0446b8c;outline:none;box-shadow:0 0 0 3px #e0446b1f}.rail-hint{color:var(--muted);margin:10px 0 14px;font-size:12px;line-height:1.5}.block.is-target{animation:1.2s ease-out target-flash}@keyframes target-flash{0%,55%{box-shadow:0 0 0 3px #e0446b29, var(--shadow);border-color:#e0446bbf}to{border-color:var(--border);box-shadow:var(--shadow)}}.footer-talk{grid-template-columns:auto minmax(0,1fr) auto;align-items:center;gap:18px;padding:14px 20px}.footer-composer{min-width:0}.composer-input{background:var(--surface);width:100%;height:24px;max-height:220px;color:var(--ink);font:inherit;resize:none;border:1px solid #e7c9c1;border-radius:14px;padding:6px 12px;font-size:13.5px;line-height:1.55;transition:border-color .15s,box-shadow .15s,height .12s;display:block;overflow-y:hidden}.composer-input:focus{border-color:#e0446b80;outline:none;box-shadow:0 0 0 3px #e0446b1a}.outline{z-index:40;pointer-events:none;justify-content:flex-end;align-items:center;display:flex;position:fixed;top:40vh;right:max(20px,50vw - 624px)}.outline-bars{pointer-events:auto;cursor:pointer;flex-direction:column;align-items:flex-end;gap:6px;width:16px;display:flex;-webkit-mask-image:linear-gradient(#0000 0,#000 14px calc(100% - 14px),#0000 100%);mask-image:linear-gradient(#0000 0,#000 14px calc(100% - 14px),#0000 100%)}.outline-bars:hover .outline-bar{background:#a06c70bf}.outline-bar{background:#d3b3ac;border-radius:999px;height:2px;transition:background .15s,width .15s}.outline-bar.is-active{background:var(--brand);height:3px}.outline.is-open .outline-bars{opacity:.5}.outline-panel{border:1px solid var(--border);-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px);pointer-events:none;opacity:0;transform-origin:100%;background:#fffdfbf7;border-radius:16px;flex-direction:column;width:292px;max-height:min(60vh,460px);transition:opacity .18s,transform .18s;display:flex;position:absolute;top:50%;right:26px;transform:translateY(-50%)translate(10px)scaleX(.96);box-shadow:0 18px 50px #471b2729}.outline.is-open .outline-panel{pointer-events:auto;opacity:1;transform:translateY(-50%)translate(0)scaleX(1)}.outline-head{justify-content:space-between;align-items:baseline;gap:12px;padding:14px 16px 8px;display:flex}.outline-count{color:var(--muted);font-size:10.5px}.outline-list{overscroll-behavior:contain;flex-direction:column;gap:1px;padding:0 6px 10px;display:flex;overflow-y:auto;-webkit-mask-image:linear-gradient(#0000 0,#000 10px calc(100% - 12px),#0000 100%);mask-image:linear-gradient(#0000 0,#000 10px calc(100% - 12px),#0000 100%)}.outline-row{color:var(--ink);font:inherit;text-align:left;white-space:nowrap;text-overflow:ellipsis;background:0 0;border:none;border-radius:8px;padding:7px 10px;font-size:13px;line-height:1.35;transition:background .12s,color .12s;position:relative;overflow:hidden}.outline-row:hover{color:#b79aa2;background:#e0446b0d}.outline-row.is-active{color:var(--brand);background:#e0446b12;font-weight:600}.outline-row.is-active:before{content:"";background:var(--brand);border-radius:999px;width:2px;position:absolute;top:6px;bottom:6px;left:0}.outline-text{text-overflow:ellipsis;display:block;overflow:hidden}.back-to-top{right:max(20px,50vw - 624px);bottom:calc(var(--footer-h) + 16px);z-index:35;border:1px solid var(--border);color:#a9304a;height:38px;font:inherit;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);cursor:pointer;background:#fffdfbf5;border-radius:999px;align-items:center;gap:8px;padding:0 16px;font-size:12.5px;font-weight:600;animation:.18s ease-out back-to-top-in;display:inline-flex;position:fixed;box-shadow:0 12px 30px #471b2724}.back-to-top svg{width:14px;height:14px}.back-to-top:hover{background:#fff7f4;border-color:#e7c9c1}@keyframes back-to-top-in{0%{opacity:0;transform:translateY(6px)}to{opacity:1;transform:translateY(0)}}@media (max-width:1040px){.outline{display:none}}@media (max-width:800px){.footer-talk{grid-template-columns:1fr;align-items:stretch}.footer-talk .footer-center{justify-self:start}.footer-talk .footer-actions{justify-self:stretch}.footer-talk .btn-approve{flex:1}.back-to-top{right:16px}}@media (prefers-reduced-motion:reduce){.outline-panel,.outline-bar,.composer-input{transition:none}.back-to-top{animation:none}}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var e={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return t(this.context.count)},getNextContextId(){return t(this.context.count++)}};function t(t){let n=String(t),r=n.length-1;return e.context.id+(r?String.fromCharCode(96+r):``)+n}function n(t){e.context=t}var r=(e,t)=>e===t,i=Symbol(`solid-track`),a={equals:r},o=null,s=ne,c=1,l=2,u={owned:null,cleanups:null,context:null,owner:null},d=null,f=null,p=null,m=null,h=null,g=0;function _(e,t){let n=p,r=d,i=e.length===0,a=t===void 0?r:t,o=i?u:{owned:null,cleanups:null,context:a?a.context:null,owner:a},s=i?e:()=>e(v(o));d=o,p=null;try{return F(s,!0)}finally{p=n,d=r}}function v(e){return()=>C(()=>R(e))}function y(e,t){t=t?Object.assign({},a,t):a;let n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0};return[A.bind(n),e=>(typeof e==`function`&&(e=f&&f.running&&f.sources.has(n)?e(n.tValue):e(n.value)),j(n,e))]}function b(e,t,n){M(N(e,t,!1,c))}function x(e,t,n){s=I;let r=N(e,t,!1,c),i=k&&O(k);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),h?h.push(r):M(r)}function S(e,t,n){n=n?Object.assign({},a,n):a;let r=N(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,M(r),A.bind(r)}function C(e){if(p===null)return e();let t=p;p=null;try{return e()}finally{p=t}}function w(e){x(()=>C(e))}function T(e){return d===null||(d.cleanups===null?d.cleanups=[e]:d.cleanups.push(e)),e}var[E,D]=y(!1);function O(e){let t;return d&&d.context&&(t=d.context[e.id])!==void 0?t:e.defaultValue}var k;function A(){let e=f&&f.running;if(this.sources&&(e?this.tState:this.state)){if((e?this.tState:this.state)===c)M(this);else{let e=m;m=null,F(()=>L(this),!1),m=e}}if(p){let e=this.observers;if(!e||e[e.length-1]!==p){let t=e?e.length:0;p.sources?(p.sources.push(this),p.sourceSlots.push(t)):(p.sources=[this],p.sourceSlots=[t]),e?(e.push(p),this.observerSlots.push(p.sources.length-1)):(this.observers=[p],this.observerSlots=[p.sources.length-1])}}return e&&f.sources.has(this)?this.tValue:this.value}function j(e,t,n){let r=f&&f.running&&f.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(f){let r=f.running;(r||!n&&f.sources.has(e))&&(f.sources.add(e),e.tValue=t),r||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&F(()=>{for(let t=0;t<e.observers.length;t+=1){let n=e.observers[t],r=f&&f.running;r&&f.disposed.has(n)||((r?!n.tState:!n.state)&&(n.pure?m.push(n):h.push(n),n.observers&&re(n)),r?n.tState=c:n.state=c)}if(m.length>1e6)throw m=[],Error()},!1)}return t}function M(e){if(!e.fn)return;R(e);let t=g;ee(e,f&&f.running&&f.sources.has(e)?e.tValue:e.value,t),f&&!f.running&&f.sources.has(e)&&queueMicrotask(()=>{F(()=>{f&&(f.running=!0),p=d=e,ee(e,e.tValue,t),p=d=null},!1)})}function ee(e,t,n){let r,i=d,a=p;p=d=e;try{r=e.fn(t)}catch(t){return e.pure&&(f&&f.running?(e.tState=c,e.tOwned&&e.tOwned.forEach(R),e.tOwned=void 0):(e.state=c,e.owned&&e.owned.forEach(R),e.owned=null)),e.updatedAt=n+1,oe(t)}finally{p=a,d=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?j(e,r,!0):f&&f.running&&e.pure?(f.sources.has(e)||(e.value=r),f.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function N(e,t,n,r=c,i){let a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:d,context:d?d.context:null,pure:n};return f&&f.running&&(a.state=0,a.tState=r),d===null||d!==u&&(f&&f.running&&d.pure?d.tOwned?d.tOwned.push(a):d.tOwned=[a]:d.owned?d.owned.push(a):d.owned=[a]),a}function P(e){let t=f&&f.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===l)return L(e);if(e.suspense&&C(e.suspense.inFallback))return e.suspense.effects.push(e);let n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<g);){if(t&&f.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let t=e,i=n[r+1];for(;(t=t.owner)&&t!==i;)if(f.disposed.has(t))return}if((t?e.tState:e.state)===c)M(e);else if((t?e.tState:e.state)===l){let t=m;m=null,F(()=>L(e,n[0]),!1),m=t}}}function F(e,t){if(m)return e();let n=!1;t||(m=[]),h?n=!0:h=[],g++;try{let t=e();return te(n),t}catch(e){n||(h=null),m=null,oe(e)}}function te(e){if(m&&=(ne(m),null),e)return;let t;if(f){if(!f.promises.size&&!f.queue.size){let e=f.sources,n=f.disposed;h.push.apply(h,f.effects),t=f.resolve;for(let e of h)`tState`in e&&(e.state=e.tState),delete e.tState;f=null,F(()=>{for(let e of n)R(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)R(t.owned[e]);t.tOwned&&(t.owned=t.tOwned),delete t.tValue,delete t.tOwned,t.tState=0}D(!1)},!1)}else if(f.running){f.running=!1,f.effects.push.apply(f.effects,h),h=null,D(!0);return}}let n=h;h=null,n.length&&F(()=>s(n),!1),t&&t()}function ne(e){for(let t=0;t<e.length;t++)P(e[t])}function I(t){let r,i=0;for(r=0;r<t.length;r++){let e=t[r];e.user?t[i++]=e:P(e)}if(e.context){if(e.count){e.effects||=[],e.effects.push(...t.slice(0,i));return}n()}for(e.effects&&(e.done||!e.count)&&(t=[...e.effects,...t],i+=e.effects.length,delete e.effects),r=0;r<i;r++)P(t[r])}function L(e,t){let n=f&&f.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){let i=e.sources[r];if(i.sources){let e=n?i.tState:i.state;e===c?i!==t&&(!i.updatedAt||i.updatedAt<g)&&P(i):e===l&&L(i,t)}}}function re(e){let t=f&&f.running;for(let n=0;n<e.observers.length;n+=1){let r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=l:r.state=l,r.pure?m.push(r):h.push(r),r.observers&&re(r))}}function R(e){let t;if(e.sources)for(;e.sources.length;){let t=e.sources.pop(),n=e.sourceSlots.pop(),r=t.observers;if(r&&r.length){let e=r.pop(),i=t.observerSlots.pop();n<r.length&&(e.sourceSlots[i]=n,r[n]=e,t.observerSlots[n]=i)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)R(e.tOwned[t]);delete e.tOwned}if(f&&f.running&&e.pure)ie(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)R(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}f&&f.running?e.tState=0:e.state=0}function ie(e,t){if(t||(e.tState=0,f.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)ie(e.owned[t])}function ae(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function z(e,t,n){try{for(let n of t)n(e)}catch(e){oe(e,n&&n.owner||null)}}function oe(e,t=d){let n=o&&t&&t.context&&t.context[o],r=ae(e);if(!n)throw r;h?h.push({fn(){z(r,n,t)},state:c}):z(r,n,t)}var se=Symbol(`fallback`);function ce(e){for(let t=0;t<e.length;t++)e[t]()}function le(e,t,n={}){let r=[],a=[],o=[],s=0,c=t.length>1?[]:null;return T(()=>ce(o)),()=>{let l=e()||[],u=l.length,d,f;return l[i],C(()=>{let e,t,i,m,h,g,v,y,b;if(u===0)s!==0&&(ce(o),o=[],r=[],a=[],s=0,c&&=[]),n.fallback&&(r=[se],a[0]=_(e=>(o[0]=e,n.fallback())),s=1);else if(s===0){for(a=Array(u),f=0;f<u;f++)r[f]=l[f],a[f]=_(p);s=u}else{for(i=Array(u),m=Array(u),c&&(h=Array(u)),g=0,v=Math.min(s,u);g<v&&r[g]===l[g];g++);for(v=s-1,y=u-1;v>=g&&y>=g&&r[v]===l[y];v--,y--)i[y]=a[v],m[y]=o[v],c&&(h[y]=c[v]);for(e=new Map,t=Array(y+1),f=y;f>=g;f--)b=l[f],d=e.get(b),t[f]=d===void 0?-1:d,e.set(b,f);for(d=g;d<=v;d++)b=r[d],f=e.get(b),f!==void 0&&f!==-1?(i[f]=a[d],m[f]=o[d],c&&(h[f]=c[d]),f=t[f],e.set(b,f)):o[d]();for(f=g;f<u;f++)f in i?(a[f]=i[f],o[f]=m[f],c&&(c[f]=h[f],c[f](f))):a[f]=_(p);a=a.slice(0,s=u),r=l.slice(0)}return a});function p(e){if(o[f]=e,c){let[e,n]=y(f);return c[f]=n,t(l[f],e)}return t(l[f])}}}function B(e,t){return C(()=>e(t||{}))}var ue=e=>`Stale read from <${e}>.`;function V(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return S(le(()=>e.each,e.children,t||void 0))}function H(e){let t=e.keyed,n=S(()=>e.when,void 0,void 0),r=t?n:S(n,void 0,{equals:(e,t)=>!e==!t});return S(()=>{let i=r();if(i){let a=e.children;return typeof a==`function`&&a.length>0?C(()=>a(t?i:()=>{if(!C(r))throw ue(`Show`);return n()})):a}return e.fallback},void 0,void 0)}var U=e=>S(()=>e());function de(e,t,n){let r=n.length,i=t.length,a=r,o=0,s=0,c=t[i-1].nextSibling,l=null;for(;o<i||s<a;){if(t[o]===n[s]){o++,s++;continue}for(;t[i-1]===n[a-1];)i--,a--;if(i===o){let t=a<r?s?n[s-1].nextSibling:n[a-s]:c;for(;s<a;)e.insertBefore(n[s++],t)}else if(a===s)for(;o<i;)(!l||!l.has(t[o]))&&t[o].remove(),o++;else if(t[o]===n[a-1]&&n[s]===t[i-1]){let r=t[--i].nextSibling;e.insertBefore(n[s++],t[o++].nextSibling),e.insertBefore(n[--a],r),t[i]=n[a]}else{if(!l){l=new Map;let e=s;for(;e<a;)l.set(n[e],e++)}let r=l.get(t[o]);if(r!=null){if(s<r&&r<a){let c=o,u=1,d;for(;++c<i&&c<a&&(d=l.get(t[c]))!=null&&d===r+u;)u++;if(u>r-s){let i=t[o];for(;s<r;)e.insertBefore(n[s++],i)}else e.replaceChild(n[s++],t[o++])}else o++}else t[o++].remove()}}}var fe=`_$DX_DELEGATE`;function pe(e,t,n,r={}){let i;return _(r=>{i=r,t===document?e():J(t,e(),!n&&t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function W(e,t,n,r){let i,a=()=>{let t=r?document.createElementNS(`http://www.w3.org/1998/Math/MathML`,`template`):document.createElement(`template`);return t.innerHTML=e,n?t.content.firstChild.firstChild:r?t.firstChild:t.content.firstChild},o=t?()=>C(()=>document.importNode(i||=a(),!0)):()=>(i||=a()).cloneNode(!0);return o.cloneNode=o,o}function G(e,t=window.document){let n=t[fe]||(t[fe]=new Set);for(let r=0,i=e.length;r<i;r++){let i=e[r];n.has(i)||(n.add(i),t.addEventListener(i,ve))}}function K(e,t,n){Y(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function q(e,t){Y(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function me(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){let r=n[0];e.addEventListener(t,n[0]=t=>r.call(e,n[1],t))}else e.addEventListener(t,n,typeof n!=`function`&&n)}function he(e,t,n={}){let r=Object.keys(t||{}),i=Object.keys(n),a,o;for(a=0,o=i.length;a<o;a++){let r=i[a];!r||r===`undefined`||t[r]||(X(e,r,!1),delete n[r])}for(a=0,o=r.length;a<o;a++){let i=r[a],o=!!t[i];!i||i===`undefined`||n[i]===o||!o||(X(e,i,!0),n[i]=o)}return n}function ge(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function _e(e,t,n){return C(()=>e(t,n))}function J(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return ye(e,t,r,n);b(r=>ye(e,t(),r,n),r)}function Y(t){return!!e.context&&!e.done&&(!t||t.isConnected)}function X(e,t,n){let r=t.trim().split(/\s+/);for(let t=0,i=r.length;t<i;t++)e.classList.toggle(r[t],n)}function ve(t){if(e.registry&&e.events&&e.events.find(([e,n])=>n===t))return;let n=t.target,r=`$$${t.type}`,i=t.target,a=t.currentTarget,o=e=>Object.defineProperty(t,"target",{configurable:!0,value:e}),s=()=>{let e=n[r];if(e&&!n.disabled){let i=n[`${r}Data`];if(i===void 0?e.call(n,t):e.call(n,i,t),t.cancelBubble)return}return n.host&&typeof n.host!=`string`&&!n.host._$host&&n.contains(t.target)&&o(n.host),!0},c=()=>{for(;s()&&(n=n._$host||n.parentNode||n.host););};Object.defineProperty(t,"currentTarget",{configurable:!0,get(){return n||document}}),e.registry&&!e.done&&(e.done=_$HY.done=!0);try{if(t.composedPath){let e=t.composedPath();o(e[0]);for(let t=0;t<e.length-2&&(n=e[t],s());t++){if(n._$host){n=n._$host,c();break}if(n.parentNode===a)break}}else c();o(i)}finally{t=n=null}}function ye(e,t,n,r,i){let a=Y(e);if(a){!n&&(n=[...e.childNodes]);let t=[];for(let e=0;e<n.length;e++){let r=n[e];r.nodeType===8&&r.data.slice(0,2)===`!$`?r.remove():t.push(r)}n=t}for(;typeof n==`function`;)n=n();if(t===n)return n;let o=typeof t,s=r!==void 0;if(e=s&&n[0]&&n[0].parentNode||e,o===`string`||o===`number`){if(a||o===`number`&&(t=t.toString(),t===n))return n;if(s){let i=n[0];i&&i.nodeType===3?i.data!==t&&(i.data=t):i=document.createTextNode(t),n=Z(e,n,r,i)}else n=n!==``&&typeof n==`string`?e.firstChild.data=t:e.textContent=t}else if(t==null||o===`boolean`){if(a)return n;n=Z(e,n,r)}else if(o===`function`)return b(()=>{let i=t();for(;typeof i==`function`;)i=i();n=ye(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(be(o,t,n,i))return b(()=>n=ye(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let t=o[0];if(t.parentNode!==e)return n;let i=[t];for(;(t=t.nextSibling)!==r;)i.push(t);return n=i}if(o.length===0){if(n=Z(e,n,r),s)return n}else c?n.length===0?xe(e,o,r):de(e,n,o):(n&&Z(e),xe(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=s?[t]:t;if(Array.isArray(n)){if(s)return n=Z(e,n,r,t);Z(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function be(e,t,n,r){let i=!1;for(let a=0,o=t.length;a<o;a++){let o=t[a],s=n&&n[e.length],c;if(o!=null&&o!==!0&&o!==!1){if((c=typeof o)==`object`&&o.nodeType)e.push(o);else if(Array.isArray(o))i=be(e,o,s)||i;else if(c===`function`){if(r){for(;typeof o==`function`;)o=o();i=be(e,Array.isArray(o)?o:[o],Array.isArray(s)?s:[s])||i}else e.push(o),i=!0}else{let t=String(o);s&&s.nodeType===3&&s.data===t?e.push(s):e.push(document.createTextNode(t))}}}return i}function xe(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function Z(e,t,n,r){if(n===void 0)return e.textContent=``;let i=r||document.createTextNode(``);if(t.length){let r=!1;for(let a=t.length-1;a>=0;a--){let o=t[a];if(i!==o){let t=o.parentNode===e;!r&&!a?t?e.replaceChild(i,o):e.insertBefore(i,n):t&&o.remove()}else r=!0}}else e.insertBefore(i,n);return[i]}var Se=new URLSearchParams(window.location.search).get(`t`)??``;async function Q(e,t={}){let n=await fetch(e,{...t,headers:{...t.body?{"content-type":`application/json`}:{},"x-plan-token":Se,...t.headers??{}}});if(!n.ok)throw Error(`${t.method??`GET`} ${e} → HTTP ${n.status}`);return await n.json()}function Ce(e){return Q(e===void 0?`/api/state`:`/api/state?version=${e}`)}function we(e,t){return Q(`/api/notes`,{method:`POST`,body:JSON.stringify({notes:e,draft:t})})}function Te(e,t){return Q(`/api/continue`,{method:`POST`,body:JSON.stringify({notes:e,message:t})})}function Ee(e,t){return Q(`/api/annotate`,{method:`POST`,body:JSON.stringify({version:e,annotations:t})})}function De(e,t){return Q(`/api/decide`,{method:`POST`,body:JSON.stringify({action:e,version:t})})}function Oe(e){try{return JSON.parse(e.data)}catch{return}}function ke(e){let t=new EventSource(`/api/events?t=${encodeURIComponent(Se)}`);return t.addEventListener(`revision`,t=>{let n=Oe(t);n&&e.onRevision(n.version)}),t.addEventListener(`annotations`,()=>e.onAnnotations()),t.addEventListener(`decided`,t=>{let n=Oe(t);n&&e.onDecided(n)}),t.addEventListener(`refresh`,()=>e.onRefresh?.()),t.addEventListener(`sent`,()=>e.onSent?.()),()=>t.close()}var Ae=`spec:lang`,je=`plan:lang`;function Me(){let e=localStorage.getItem(Ae)??localStorage.getItem(je);return e===`en`||e===`zh`?e:navigator.language.toLowerCase().startsWith(`zh`)?`zh`:`en`}function Ne(e){localStorage.setItem(Ae,e)}var Pe={en:{title:`Spec review`,version:`v{version} of {total}`,changed:`{count} blocks changed`,changedOne:`1 block changed`,noChange:`no changes`,showAll:`Show unchanged`,onlyChanged:`Only changed`,approve:`Approve spec`,deny:`Send feedback`,globalNotes:`Global notes`,globalNotesTitle:`Global notes`,notePlaceholder:`What should change here?`,addNote:`Add note`,save:`Save note`,cancel:`Cancel`,remove:`Remove`,verdictChange:`must change`,verdictSuggest:`suggest`,verdictQuestion:`question`,history:`History`,historySummary:`{count} blocks`,historySummaryOne:`1 block`,back:`Back to latest`,viewingOld:`Read-only: you are viewing v{v}`,readOnly:`Read-only`,approved:`Spec approved`,denied:`Feedback sent`,closing:`Closing this tab…`,closeHint:`You can close this tab now.`,status_unchanged:`unchanged`,status_moved:`moved`,status_modified:`modified`,status_added:`new`,status_removed:`removed`,unchangedHidden:`{count} unchanged blocks hidden`,unchangedHiddenOne:`1 unchanged block hidden`,error:`Something went wrong: {message}`,emptySpec:`This spec is empty.`,noteCount:`{count} notes`,noteCountOne:`1 note`,thisRevision:`This revision`,blocksChanged:`blocks changed`,ofTotal:`of {total} in the spec`,annotations:`Annotations`,noNotesYet:`No notes yet — annotate a block to see it here.`,talkTitle:`Reply notes`,talkHeading:`Last reply`,talkBlocks:`{count} blocks`,talkBlocksOne:`1 block`,talkSentBadge:`sent`,talkSentTitle:`Sent back to pi`,talkNothingToSend:`Write a note or a message first.`,talkNotePlaceholder:`What do you want to say about this part?`,editNote:`Edit note`,yourNote:`your note`,talkAbout:`This reply`,talkAboutBody:`Saved notes and your draft survive a refresh. Continue also includes the open editor, sends once and closes the page.`,talkBlocksLabel:`blocks`,talkChars:`characters`,talkPlaceholder:`Anything else for the agent…`,talkSubmitHint:`Send with Cmd/Ctrl+Enter`,talkContinue:`Continue`},zh:{title:`规格评审`,version:`第 {version} / {total} 版`,changed:`{count} 处改动`,changedOne:`1 处改动`,noChange:`无改动`,showAll:`显示未变块`,onlyChanged:`只看改动`,approve:`批准规格`,deny:`提交意见`,globalNotes:`全局批注`,globalNotesTitle:`全局批注`,notePlaceholder:`这里应该怎么改?`,addNote:`添加批注`,save:`保存批注`,cancel:`取消`,remove:`删除`,verdictChange:`必须改`,verdictSuggest:`建议`,verdictQuestion:`疑问`,history:`历史`,historySummary:`{count} 块`,historySummaryOne:`1 块`,back:`回到最新版`,viewingOld:`只读:正在查看第 {v} 版`,readOnly:`只读`,approved:`规格已批准`,denied:`意见已提交`,closing:`正在关闭标签页…`,closeHint:`现在可以关闭这个标签页了。`,status_unchanged:`未变`,status_moved:`位置移动`,status_modified:`已修改`,status_added:`新增`,status_removed:`已删除`,unchangedHidden:`隐藏了 {count} 个未变块`,unchangedHiddenOne:`隐藏了 1 个未变块`,error:`出错了:{message}`,emptySpec:`spec 是空的。`,noteCount:`{count} 条批注`,noteCountOne:`1 条批注`,thisRevision:`本版`,blocksChanged:`处改动`,ofTotal:`共 {total} 块`,annotations:`批注`,noNotesYet:`还没有批注——在段落上写一条就会出现在这里。`,talkTitle:`回复批注`,talkHeading:`最近一条回复`,talkBlocks:`{count} 块`,talkBlocksOne:`1 块`,talkSentBadge:`已发送`,talkSentTitle:`已发回 pi`,talkNothingToSend:`先写一条批注或一句话。`,talkNotePlaceholder:`这一块你想说什么?`,editNote:`改批注`,yourNote:`你的批注`,talkAbout:`这条回复`,talkAboutBody:`已存批注与输入框草稿刷新后仍在;Continue 也会带上正在编辑的批注,只发一次,然后关页面。`,talkBlocksLabel:`块`,talkChars:`字符`,talkPlaceholder:`还想对 agent 说什么…`,talkSubmitHint:`Cmd/Ctrl+Enter 发送`,talkContinue:`继续`}};function Fe(e,t,n={}){return(Pe[e][t]??t).replace(/\{(\w+)\}/g,(e,t)=>String(n[t]??`{${t}}`))}var Ie=W(`<nav class=outline aria-label=Contents><div class=outline-bars></div><div class=outline-panel><div class=outline-head><span class=eyebrow>CONTENTS</span><span class=outline-count> </span></div><div class=outline-list>`),Le=W(`<span class=outline-bar>`),$=W(`<button type=button class=outline-row><span class=outline-text>`),Re=W(`<button type=button class=back-to-top><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 aria-hidden=true><path d="M12 19V5M6 11l6-6 6 6"></path></svg><span>Back to top`),ze=W(`<textarea class=composer-input rows=1>`);function Be(e,t){let n=[...new Set(t)].sort((e,t)=>e-t).indexOf(e);return n<0?0:Math.min(n,3)}var Ve=[16,13,10,8],He=24;function Ue(e,t,n=He){if(n<=0)return[];if(e.length<=n)return[...e];let r=e.findIndex(e=>e.blockId===t);if(n===1)return[e[r>=0?r:0]];let i=new Set;r>=0&&i.add(r),i.add(0);let a=n-i.size,o=a>1?(e.length-1)/(a-1):0;for(let t=0;t<a;t+=1)i.add(a===1?e.length-1:Math.round(t*o));return[...i].sort((e,t)=>e-t).map(t=>e[t]).filter(e=>e!==void 0)}var We=140;function Ge(){return window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}function Ke(e){let[t,n]=y(!1),[r,i]=y(),a,o,s,c,l=S(()=>e.headings.map(e=>e.level)),u=S(()=>Ue(e.headings,r())),d=e=>Be(e,l());function f(){a!==void 0&&clearTimeout(a),n(!0)}function p(){a!==void 0&&clearTimeout(a),a=setTimeout(()=>n(!1),200)}w(()=>{let t=()=>{let t;for(let n of e.headings){let e=document.getElementById(`block-${n.blockId}`);if(e){if(e.getBoundingClientRect().top<=We)t=n.blockId;else break}}i(t)},n=()=>{c===void 0&&(c=requestAnimationFrame(()=>{c=void 0,t()}))};window.addEventListener(`scroll`,n,{passive:!0}),t(),T(()=>{window.removeEventListener(`scroll`,n),c!==void 0&&cancelAnimationFrame(c)})}),T(()=>{a!==void 0&&clearTimeout(a),o!==void 0&&clearTimeout(o),s?.classList.remove(`is-target`)});function m(t){e.onJump?.(t),requestAnimationFrame(()=>{let e=document.getElementById(`block-${t}`);e&&(e.scrollIntoView({behavior:Ge(),block:`start`}),s?.classList.remove(`is-target`),s=e,e.classList.add(`is-target`),o!==void 0&&clearTimeout(o),o=setTimeout(()=>{e.classList.remove(`is-target`),s===e&&(s=void 0)},1200),i(t),n(!1))})}return B(H,{get when(){return e.headings.length>0},get children(){var n=Ie(),i=n.firstChild,a=i.nextSibling,o=a.firstChild,s=o.firstChild.nextSibling,c=s.firstChild,l=o.nextSibling;return n.addEventListener(`mouseleave`,p),n.addEventListener(`mouseenter`,f),J(i,B(V,{get each(){return u()},children:e=>(()=>{var t=Le();return b(n=>{var i=e.blockId===r(),a=`${Ve[d(e.level)]}px`;return i!==n.e&&t.classList.toggle(`is-active`,n.e=i),a!==n.t&&ge(t,`width`,n.t=a),n},{e:void 0,t:void 0}),t})()})),J(s,()=>e.headings.length,c),J(s,()=>e.headings.length===1?`heading`:`headings`,null),J(l,B(V,{get each(){return e.headings},children:e=>(()=>{var n=$(),i=n.firstChild;return n.$$click=()=>m(e.blockId),J(i,()=>e.text),b(i=>{var a=e.blockId===r(),o=`${10+d(e.level)*14}px`,s=t()?0:-1,c=e.text;return a!==i.e&&n.classList.toggle(`is-active`,i.e=a),o!==i.t&&ge(n,`padding-left`,i.t=o),s!==i.a&&K(n,`tabindex`,i.a=s),c!==i.o&&K(n,`title`,i.o=c),i},{e:void 0,t:void 0,a:void 0,o:void 0}),n})()})),b(e=>{var r=!!t(),o=t(),s=!t();return r!==e.e&&n.classList.toggle(`is-open`,e.e=r),o!==e.t&&K(i,`aria-hidden`,e.t=o),s!==e.a&&K(a,`aria-hidden`,e.a=s),e},{e:void 0,t:void 0,a:void 0}),n}})}function qe(){let[e,t]=y(!1);return w(()=>{let e=window.matchMedia(`(max-width: 1040px)`),n=document.querySelector(`.rail`),r,i=()=>t(window.scrollY>window.innerHeight*.8),a=()=>{if(r?.disconnect(),r=void 0,e.matches||!n){i();return}t(!1),r=new IntersectionObserver(e=>{let n=e.at(-1);n&&t(!n.isIntersecting&&n.boundingClientRect.bottom<=0)},{threshold:0}),r.observe(n)},o=()=>{(e.matches||!n)&&i()};a(),window.addEventListener(`scroll`,o,{passive:!0}),e.addEventListener(`change`,a),T(()=>{r?.disconnect(),window.removeEventListener(`scroll`,o),e.removeEventListener(`change`,a)})}),B(H,{get when(){return e()},get children(){var e=Re();return e.$$click=()=>{window.scrollTo({top:0,behavior:Ge()})},e}})}function Je(){w(()=>{let e=document.querySelector(`.footer`);if(!e)return;let t=()=>{document.documentElement.style.setProperty(`--footer-h`,`${e.getBoundingClientRect().height+18}px`)},n=new ResizeObserver(t);n.observe(e),t(),T(()=>n.disconnect())})}var Ye=220;function Xe(e){let t,n=e=>{if(!t)return;t.style.height=`auto`;let n=Math.min(window.innerHeight*.4,Ye),r=e?Math.min(t.scrollHeight,n):t.scrollHeight;t.style.height=`${Math.max(e?Math.min(r,n):24,24)}px`,t.style.overflowY=e&&t.scrollHeight>n?`auto`:`hidden`};return w(()=>n(document.activeElement===t)),(()=>{var r=ze();return r.$$keydown=t=>{(t.metaKey||t.ctrlKey)&&t.key===`Enter`&&(t.preventDefault(),e.onSubmit())},r.$$input=t=>{e.onInput(t.currentTarget.value),n(!0)},r.addEventListener(`blur`,()=>n(!1)),r.addEventListener(`focus`,()=>n(!0)),_e(e=>{t=e},r),b(t=>{var n=e.placeholder,i=e.disabled,a=e.placeholder,o=e.submitLabel;return n!==t.e&&K(r,`placeholder`,t.e=n),i!==t.t&&(r.disabled=t.t=i),a!==t.a&&K(r,`aria-label`,t.a=a),o!==t.o&&K(r,`title`,t.o=o),t},{e:void 0,t:void 0,a:void 0,o:void 0}),b(()=>r.value=e.value()),r})()}G([`click`,`input`,`keydown`]);var Ze=W(`<span class=readonly>`),Qe=W(`<div class=error>`),$e=W(`<div class=banner><span></span><button class=link>`),et=W(`<div class=done><div class=done-title></div><div class=done-hint>`),tt=W(`<button class=add>+ `),nt=W(`<section id=global-notes class=global-card><div class=global-head><span class=eyebrow></span><span class=global-count>`),rt=W(`<p class=empty>`),it=W(`<div class=collapsed><span></span><button class=link>`),at=W(`<div class=rail-notes>`),ot=W(`<button class=ghost>`),st=W(`<div class=page><header class=topbar><div class=masthead><div class=brand><span class=brand-mark aria-hidden=true><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=1.8><path d="M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8L12 3z"></path><path d="M18.5 15.5l.7 2 2 .7-2 .7-.7 2-.7-2-2-.7 2-.7.7-2z"></path></svg></span><span class=eyebrow></span></div><div class=top-actions><button class="ghost lang"></button></div></div><div class=title-block><h1></h1><div class=meta><span class=meta-path></span><span class=meta-dot aria-hidden=true></span><span class=meta-version></span><span class=meta-dot aria-hidden=true></span><span class=meta-changed></span></div></div><div class=history><span class="eyebrow history-label"></span><span class=history-summary></span></div></header><div class=layout><main class=reading><div class=blocks></div></main><aside class=rail><section class=rail-card><span class=eyebrow></span><div class=rail-big><span class=rail-number></span><div class=rail-caption><span></span><span class=muted></span></div></div><div class=rail-breakdown><div class=rail-row><span class="dot dot-added"aria-hidden=true></span><span></span><b></b></div><div class=rail-row><span class="dot dot-modified"aria-hidden=true></span><span></span><b></b></div><div class=rail-row><span class="dot dot-moved"aria-hidden=true></span><span></span><b></b></div><div class=rail-row><span class="dot dot-removed"aria-hidden=true></span><span></span><b></b></div></div></section><section class=rail-card><div class=rail-head><span class=eyebrow></span><span class=rail-badge></span></div></section></aside></div><footer class=footer><div class=footer-left><button class=ghost> (<!>)</button></div><div class=footer-center><span class=notes-count><span class="dot dot-brand"aria-hidden=true></span></span></div><div class=footer-actions><button class=btn-feedback></button><button class=btn-approve><span></span><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 aria-hidden=true><path d="M5 12h14M13 6l6 6-6 6">`),ct=W(`<span class=chip-changed>+`),lt=W(`<button class=chip><span class=chip-n>v`),ut=W(`<button class=remove>`),dt=W(`<div><span></span><span class=note-text>`),ft=W(`<article class=block><div aria-hidden=true></div><div class=block-inner><div class=block-head><span><span aria-hidden=true></span></span><span class=block-id></span></div><div class=block-body>`),pt=W(`<p class=rail-empty>`),mt=W(`<button class=rail-note><span aria-hidden=true></span><span class=rail-note-body><span class=rail-note-label></span><span class=rail-note-text>`),ht=W(`<div class=editor><div class=verdicts></div><textarea></textarea><div class=editor-actions><button class=ghost></button><button class=primary>`),gt=W(`<label><input type=radio name=verdict>`);function _t(e){let[t,n]=y(Me()),[r,i]=y(e.initial),[a,o]=y(),[s,c]=y(),[l,u]=y(e.initial.decided&&e.initial.decision?e.initial.decision.action:void 0),[d,f]=y(!1),[p,m]=y(),[h,g]=y(``),[_,v]=y(`change`),[C,E]=y(!1),D=(e,n)=>Fe(t(),e,n);Je();async function O(e){try{let t=await Ce(e);if(t.mode!==`spec`)return;i(t),c(void 0),u(t.decided&&t.decision?t.decision.action:void 0)}catch(e){c(e instanceof Error?e.message:String(e))}}w(()=>{T(ke({onRevision:()=>{a()===void 0&&O()},onAnnotations:()=>{a()===void 0&&O()},onDecided:e=>u(e.action)}))}),x(()=>{let e=r()?.slug;document.title=e?`${D(`title`)} — ${e}`:D(`title`)});let k=S(()=>r()?.items??[]),A=e=>e.status??`unchanged`,j=S(()=>k().filter(e=>A(e)!==`unchanged`).length),M=S(()=>!d()&&j()>0),ee=S(()=>M()?k().filter(e=>A(e)===`unchanged`).length:0),N=S(()=>M()?k().filter(e=>A(e)!==`unchanged`):k()),P=S(()=>r()?.history[0]?.n??r()?.version),F=S(()=>{let e=r();return e!==void 0&&e.version!==P()}),te=S(()=>{let e={unchanged:0,moved:0,modified:0,added:0,removed:0};for(let t of k())e[A(t)]+=1;return e}),ne=S(()=>[...r()?.history??[]].reverse()),I=S(()=>r()?.annotations.global??[]),L=S(()=>p()!==void 0&&p().blockId===void 0),re=S(()=>I().length>0||L()),R=e=>r()?.annotations.blocks.find(t=>t.blockId===e)?.annotations??[],ie=S(()=>{let e=r()?.annotations;if(!e)return 0;let t=e.blocks.reduce((e,t)=>e+t.annotations.length,0);return e.global.length+t}),ae=S(()=>{let e=r();if(!e)return[];let t=new Map(e.items.map(e=>[e.id,e.label])),n=e.annotations.global.map((e,t)=>({key:`global-${t}`,label:D(`globalNotesTitle`),annotation:e}));for(let r of e.annotations.blocks){let e=t.get(r.blockId)??r.blockId;r.annotations.forEach((t,i)=>{n.push({key:`${r.blockId}-${i}`,blockId:r.blockId,label:e,annotation:t})})}return n});async function z(e){let t=r();if(!t)return;let n={...t,annotations:e};i(n);try{await Ee(t.version,e)}catch(e){c(e instanceof Error?e.message:String(e)),await O(t.version)}}async function oe(e){let t=h().trim();if(t===``)return;let n=r();if(!n)return;let i={verdict:_(),comment:t},a;if(e===void 0)a={...n.annotations,global:[...n.annotations.global,i]};else{let t=n.annotations.blocks.slice(),r=t.findIndex(t=>t.blockId===e);r===-1?t.push({blockId:e,annotations:[i]}):t[r]={...t[r],annotations:[...t[r].annotations,i]},a={...n.annotations,blocks:t}}m(void 0),g(``),await z(a)}async function se(e,t){let n=r();if(!n)return;let i;i=e===void 0?{...n.annotations,global:n.annotations.global.filter((e,n)=>n!==t)}:{...n.annotations,blocks:n.annotations.blocks.map(n=>n.blockId===e?{...n,annotations:n.annotations.filter((e,n)=>n!==t)}:n).filter(e=>e.annotations.length>0)},await z(i)}function ce(){!F()&&!L()&&(m({blockId:void 0}),g(``),v(`change`)),requestAnimationFrame(()=>{document.getElementById(`global-notes`)?.scrollIntoView({behavior:`smooth`,block:`start`})})}function le(){if(!F()){if(L()){m(void 0);return}ce()}}function ue(e){N().some(t=>t.id===e)||f(!0)}function de(e){let t=e.blockId;N().some(e=>e.id===t)||f(!0),requestAnimationFrame(()=>{document.getElementById(`block-${t}`)?.scrollIntoView({behavior:`smooth`,block:`center`})})}async function fe(e){let t=r();if(t)try{await De(e,t.version),u(e),window.close(),setTimeout(()=>E(!0),300)}catch(e){c(e instanceof Error?e.message:String(e))}}let pe=e=>`badge badge-${e}`,W=e=>`verdict${e[0].toUpperCase()}${e.slice(1)}`,G=e=>`note-verdict verdict-${e}`;return(()=>{var e=st(),i=e.firstChild,c=i.firstChild,u=c.firstChild,y=u.firstChild.nextSibling,x=u.nextSibling.firstChild,S=c.nextSibling,w=S.firstChild,T=w.nextSibling,E=T.firstChild,M=E.nextSibling.nextSibling,z=M.nextSibling.nextSibling,ce=S.nextSibling,me=ce.firstChild,ge=me.nextSibling,_e=i.nextSibling,Y=_e.firstChild,X=Y.firstChild,ve=Y.nextSibling.firstChild,ye=ve.firstChild,be=ye.nextSibling,xe=be.firstChild,Z=xe.nextSibling.firstChild,Se=Z.nextSibling,Q=be.nextSibling.firstChild,Ce=Q.firstChild.nextSibling,we=Ce.nextSibling,Te=Q.nextSibling,Ee=Te.firstChild.nextSibling,De=Ee.nextSibling,Oe=Te.nextSibling,ke=Oe.firstChild.nextSibling,Ae=ke.nextSibling,je=Oe.nextSibling.firstChild.nextSibling,Me=je.nextSibling,Pe=ve.nextSibling,Fe=Pe.firstChild.firstChild,Ie=Fe.nextSibling,Le=_e.nextSibling.firstChild,$=Le.firstChild,Re=$.firstChild,ze=Re.nextSibling;ze.nextSibling;var Be=Le.nextSibling,Ve=Be.firstChild;Ve.firstChild;var He=Be.nextSibling.firstChild,Ue=He.nextSibling,We=Ue.firstChild;return J(y,()=>D(`title`)),x.$$click=()=>{let e=t()===`en`?`zh`:`en`;n(e),Ne(e)},J(x,()=>t()===`en`?`中文`:`EN`),J(w,()=>r()?.slug??`spec`),J(E,()=>r()?.source??`specs/spec.md`),J(M,()=>D(`version`,{version:r()?.version??0,total:r()?.totalVersions??0})),J(z,(()=>{var e=U(()=>j()>0);return()=>e()?D(j()===1?`changedOne`:`changed`,{count:j()}):D(`noChange`)})()),J(T,B(H,{get when(){return F()},get children(){var e=Ze();return J(e,()=>D(`readOnly`)),e}}),null),J(me,()=>D(`history`)),J(ce,B(V,{get each(){return ne()},children:e=>(()=>{var t=lt(),n=t.firstChild;return n.firstChild,t.$$click=()=>{e.n===P()?(o(void 0),O()):(o(e.n),O(e.n))},J(n,()=>e.n,null),J(t,B(H,{get when(){return e.changed>0},get children(){var t=ct();return t.firstChild,J(t,()=>e.changed,null),t}}),null),b(()=>t.classList.toggle(`active`,e.n===r()?.version)),t})()}),ge),J(ge,()=>D(k().length===1?`historySummaryOne`:`historySummary`,{count:k().length})),J(e,B(H,{get when(){return s()},get children(){var e=Qe();return J(e,()=>D(`error`,{message:s()??``})),e}}),_e),J(Y,B(H,{get when(){return F()},get children(){var e=$e(),t=e.firstChild,n=t.nextSibling;return J(t,()=>D(`viewingOld`,{v:a()??r()?.version??0})),n.$$click=()=>{o(void 0),O()},J(n,()=>D(`back`)),e}}),X),J(Y,B(H,{get when(){return l()},get children(){var e=et(),t=e.firstChild,n=t.nextSibling;return J(t,(()=>{var e=U(()=>l()===`approve`);return()=>e()?D(`approved`):D(`denied`)})()),J(n,(()=>{var e=U(()=>!!C());return()=>e()?D(`closeHint`):D(`closing`)})()),e}}),X),J(Y,B(H,{get when(){return re()},get children(){var e=nt(),t=e.firstChild,n=t.firstChild,r=n.nextSibling;return J(n,()=>D(`globalNotesTitle`)),J(r,()=>I().length),J(t,B(H,{get when(){return U(()=>!F())()&&!L()},get children(){var e=tt();return e.firstChild,e.$$click=()=>{m({blockId:void 0}),g(``),v(`change`)},J(e,()=>D(`addNote`),null),e}}),null),J(e,B(V,{get each(){return I()},children:(e,t)=>(()=>{var n=dt(),r=n.firstChild,i=r.nextSibling;return J(r,()=>D(W(e.verdict))),J(i,()=>e.comment),J(n,B(H,{get when(){return!F()},get children(){var e=ut();return e.$$click=()=>void se(void 0,t()),J(e,()=>D(`remove`)),e}}),null),b(t=>{var i=`note note-${e.verdict}`,a=G(e.verdict);return i!==t.e&&q(n,t.e=i),a!==t.t&&q(r,t.t=a),t},{e:void 0,t:void 0}),n})()}),null),J(e,B(H,{get when(){return U(()=>!!L())()&&!F()},get children(){return B(vt,{draft:h,setDraft:g,verdict:_,setVerdict:v,onSave:()=>void oe(void 0),onCancel:()=>m(void 0),t:D})}}),null),e}}),X),J(Y,B(H,{get when(){return U(()=>!!r())()&&r().items.length===0},get children(){var e=rt();return J(e,()=>D(`emptySpec`)),e}}),X),J(Y,B(H,{get when(){return ee()>0},get children(){var e=it(),t=e.firstChild,n=t.nextSibling;return J(t,()=>D(ee()===1?`unchangedHiddenOne`:`unchangedHidden`,{count:ee()})),n.$$click=()=>f(!0),J(n,()=>D(`showAll`)),e}}),X),J(X,B(V,{get each(){return N()},children:e=>(()=>{var t=ft(),n=t.firstChild,r=n.nextSibling,i=r.firstChild,a=i.firstChild,o=a.firstChild,s=a.nextSibling,c=i.nextSibling;return J(a,()=>D(`status_${A(e)}`),null),J(s,()=>e.id),J(i,B(H,{get when(){return!F()},get children(){var t=tt();return t.firstChild,t.$$click=()=>{m({blockId:e.id}),g(``),v(`change`)},J(t,()=>D(`addNote`),null),t}}),null),J(r,B(V,{get each(){return R(e.id)},children:(t,n)=>(()=>{var r=dt(),i=r.firstChild,a=i.nextSibling;return J(i,()=>D(W(t.verdict))),J(a,()=>t.comment),J(r,B(H,{get when(){return!F()},get children(){var t=ut();return t.$$click=()=>void se(e.id,n()),J(t,()=>D(`remove`)),t}}),null),b(e=>{var n=`note note-${t.verdict}`,a=G(t.verdict);return n!==e.e&&q(r,e.e=n),a!==e.t&&q(i,e.t=a),e},{e:void 0,t:void 0}),r})()}),null),J(r,B(H,{get when(){return U(()=>p()?.blockId===e.id)()&&!F()},get children(){return B(vt,{draft:h,setDraft:g,verdict:_,setVerdict:v,onSave:()=>void oe(e.id),onCancel:()=>m(void 0),t:D})}}),null),b(r=>{var i=`block-${e.id}`,s={[`is-`+A(e)]:!0},l=`block-bar bar-${A(e)}`,u=pe(A(e)),d=`dot dot-${A(e)}`,f=e.html;return i!==r.e&&K(t,`id`,r.e=i),r.t=he(t,s,r.t),l!==r.a&&q(n,r.a=l),u!==r.o&&q(a,r.o=u),d!==r.i&&q(o,r.i=d),f!==r.n&&(c.innerHTML=r.n=f),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),t})()})),J(ye,()=>D(`thisRevision`)),J(xe,j),J(Z,()=>D(`blocksChanged`)),J(Se,()=>D(`ofTotal`,{total:k().length})),J(Ce,()=>D(`status_added`)),J(we,()=>te().added),J(Ee,()=>D(`status_modified`)),J(De,()=>te().modified),J(ke,()=>D(`status_moved`)),J(Ae,()=>te().moved),J(je,()=>D(`status_removed`)),J(Me,()=>te().removed),J(Fe,()=>D(`annotations`)),J(Ie,ie),J(Pe,B(H,{get when(){return ae().length>0},get fallback(){return(()=>{var e=pt();return J(e,()=>D(`noNotesYet`)),e})()},get children(){var e=at();return J(e,B(V,{get each(){return ae()},children:e=>(()=>{var t=mt(),n=t.firstChild,r=n.nextSibling.firstChild,i=r.nextSibling;return t.$$click=()=>de(e),J(r,()=>e.label),J(i,()=>e.annotation.comment),b(()=>q(n,`dot dot-${e.annotation.verdict}`)),t})()})),e}}),null),J(Le,B(H,{get when(){return j()>0},get children(){var e=ot();return e.$$click=()=>f(!d()),J(e,(()=>{var e=U(()=>!!d());return()=>e()?D(`onlyChanged`):D(`showAll`)})()),e}}),$),$.$$click=le,J($,()=>D(`globalNotes`),Re),J($,()=>I().length,ze),J(Ve,()=>D(ie()===1?`noteCountOne`:`noteCount`,{count:ie()}),null),He.$$click=()=>void fe(`deny`),J(He,()=>D(`deny`)),Ue.$$click=()=>void fe(`approve`),J(We,()=>D(`approve`)),J(e,B(Ke,{get headings(){return r()?.headings??[]},onJump:ue}),null),J(e,B(qe,{}),null),b(e=>{var t=F(),n=F()||l()!==void 0,r=F()||l()!==void 0;return t!==e.e&&($.disabled=e.e=t),n!==e.t&&(He.disabled=e.t=n),r!==e.a&&(Ue.disabled=e.a=r),e},{e:void 0,t:void 0,a:void 0}),e})()}function vt(e){return(()=>{var t=ht(),n=t.firstChild,r=n.nextSibling,i=r.nextSibling.firstChild,a=i.nextSibling;return J(n,B(V,{each:[`change`,`suggest`,`question`],children:t=>(()=>{var n=gt(),r=n.firstChild;return r.addEventListener(`change`,()=>e.setVerdict(t)),J(n,()=>e.t(`verdict${t[0].toUpperCase()}${t.slice(1)}`),null),b(()=>n.classList.toggle(`active`,e.verdict()===t)),b(()=>r.checked=e.verdict()===t),n})()})),r.$$input=t=>e.setDraft(t.currentTarget.value),me(i,`click`,e.onCancel,!0),J(i,()=>e.t(`cancel`)),me(a,`click`,e.onSave,!0),J(a,()=>e.t(`save`)),b(t=>{var n=e.t(`notePlaceholder`),i=e.draft().trim()===``;return n!==t.e&&K(r,`placeholder`,t.e=n),i!==t.t&&(a.disabled=t.t=i),t},{e:void 0,t:void 0}),b(()=>r.value=e.draft()),t})()}G([`click`,`input`]);var yt=W(`<span class=readonly>`),bt=W(`<div class=error>`),xt=W(`<div class=done><div class=done-title></div><div class=done-hint>`),St=W(`<p class=empty>`),Ct=W(`<div class=rail-notes>`),wt=W(`<div class=page><header class=topbar><div class=masthead><div class=brand><span class=brand-mark aria-hidden=true><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=1.8><title>Reply notes</title><path d="M4 5h16M4 11h16M4 17h9"></path></svg></span><span class=eyebrow></span></div><div class=top-actions><button type=button class="ghost lang"></button></div></div><div class=title-block><h1></h1><div class=meta><span class=meta-path></span><span class=meta-dot aria-hidden=true></span><span class=meta-version></span><span class=meta-dot aria-hidden=true></span><span class=meta-changed></span></div></div></header><div class=layout><main class=reading><div class=blocks></div></main><aside class=rail><section class=rail-card><span class=eyebrow></span><p class=rail-hint></p><div class=rail-breakdown><div class=rail-row><span></span><b></b></div><div class=rail-row><span></span><b></b></div><div class=rail-row><span></span><b></b></div></div></section><section class=rail-card><div class=rail-head><span class=eyebrow></span><span class=rail-badge></span></div></section></aside></div><footer class="footer footer-talk"><div class=footer-center><span class=notes-count><span class="dot dot-brand"aria-hidden=true></span></span></div><div class=footer-composer></div><div class=footer-actions><button type=button class=btn-approve><span></span><svg viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 aria-hidden=true><path d="M5 12h14M13 6l6 6-6 6">`),Tt=W(`<button type=button class=add>`),Et=W(`<div class=block-head><span class=block-id>`),Dt=W(`<button type=button class=remove>`),Ot=W(`<div class="note note-talk"><span class="note-verdict verdict-talk"></span><span class=note-text>`),kt=W(`<div class=editor><textarea class=note-input></textarea><div class=editor-actions><button type=button class=ghost></button><button type=button class=primary>`),At=W(`<article class="block block-talk"><div class="block-bar bar-talk"aria-hidden=true></div><div class=block-inner><div class=block-body>`),jt=W(`<p class=rail-empty>`),Mt=W(`<button type=button class=rail-note><span class="dot dot-brand"aria-hidden=true></span><span class=rail-note-body><span class=rail-note-label></span><span class=rail-note-text>`),Nt=300;function Pt(e){let[t,n]=y(Me()),[r,i]=y(e.initial),[a,o]=y(e.initial.notes),[s,c]=y(e.initial.draft),[l,u]=y(e.initial.sent),[d,f]=y(!1),[p,m]=y(),[h,g]=y(``),[_,v]=y(),[C,E]=y(!1),D,O=(e,n)=>Fe(t(),e,n);Je();let k=S(()=>r().items),A=S(()=>l()||d()),j=S(()=>Object.values(a()).filter(e=>e.trim()!==``).length),M=S(()=>k().map(e=>({id:e.id,label:e.label,text:a()[e.id]??``})).filter(e=>e.text.trim()!==``)),ee=S(()=>{let e=r().reply.at,t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()});async function N(){try{let e=await Ce();if(e.mode!==`talk`)return;i(e),o(e.notes),c(e.draft),u(e.sent),m(void 0),g(``),v(void 0)}catch(e){v(e instanceof Error?e.message:String(e))}}w(()=>{let e=ke({onRevision:()=>void N(),onAnnotations:()=>void N(),onDecided:()=>void 0,onRefresh:()=>void N(),onSent:()=>u(!0)});T(()=>{e(),D!==void 0&&clearTimeout(D)})}),x(()=>{document.title=O(`talkTitle`)});function P(e,t){D!==void 0&&clearTimeout(D),D=setTimeout(()=>{D=void 0,we(e,t).catch(e=>{l()||v(e instanceof Error?e.message:String(e))})},Nt)}function F(e,t){let n={...a()};t.trim()===``?delete n[e]:n[e]=t,o(n),P(n,s())}function te(e){let t={...a()};delete t[e],o(t),p()===e&&m(void 0),P(t,s())}function ne(e){c(e),P(a(),e)}function I(){let e={...a()},t=p();return t!==void 0&&(h().trim()===``?delete e[t]:e[t]=h()),e}async function L(){if(A())return;let e=I();if(!Object.values(e).some(e=>e.trim()!==``)&&s().trim()===``){v(O(`talkNothingToSend`));return}o(e),D!==void 0&&(clearTimeout(D),D=void 0),f(!0);try{await Te(e,s()),u(!0),f(!1),v(void 0),window.close(),setTimeout(()=>E(!0),300)}catch(e){f(!1),v(e instanceof Error?e.message:String(e))}}function re(e){requestAnimationFrame(()=>{document.getElementById(`block-${e}`)?.scrollIntoView({behavior:Ge(),block:`center`})})}return(()=>{var e=wt(),i=e.firstChild,o=i.firstChild,c=o.firstChild,u=c.firstChild.nextSibling,d=c.nextSibling.firstChild,f=o.nextSibling.firstChild,v=f.nextSibling,y=v.firstChild,x=y.nextSibling.nextSibling,S=x.nextSibling.nextSibling,w=i.nextSibling,T=w.firstChild,E=T.firstChild,D=T.nextSibling.firstChild,N=D.firstChild,P=N.nextSibling,I=P.nextSibling.firstChild,R=I.firstChild,ie=R.nextSibling,ae=I.nextSibling,z=ae.firstChild,oe=z.nextSibling,se=ae.nextSibling.firstChild,ce=se.nextSibling,le=D.nextSibling,ue=le.firstChild.firstChild,de=ue.nextSibling,fe=w.nextSibling.firstChild,pe=fe.firstChild;pe.firstChild;var W=fe.nextSibling,G=W.nextSibling.firstChild,q=G.firstChild;return J(u,()=>O(`talkTitle`)),d.$$click=()=>{let e=t()===`en`?`zh`:`en`;n(e),Ne(e)},J(d,()=>t()===`en`?`中文`:`EN`),J(f,()=>O(`talkHeading`)),J(y,ee),J(x,()=>r().reply.model??`—`),J(S,()=>O(k().length===1?`talkBlocksOne`:`talkBlocks`,{count:k().length})),J(v,B(H,{get when(){return l()},get children(){var e=yt();return J(e,()=>O(`talkSentBadge`)),e}}),null),J(e,B(H,{get when(){return _()},get children(){var e=bt();return J(e,()=>O(`error`,{message:_()??``})),e}}),w),J(T,B(H,{get when(){return l()},get children(){var e=xt(),t=e.firstChild,n=t.nextSibling;return J(t,()=>O(`talkSentTitle`)),J(n,(()=>{var e=U(()=>!!C());return()=>e()?O(`closeHint`):O(`closing`)})()),e}}),E),J(T,B(H,{get when(){return k().length===0},get children(){var e=St();return J(e,()=>O(`emptySpec`)),e}}),E),J(E,B(V,{get each(){return k()},children:e=>(()=>{var t=At(),n=t.firstChild.nextSibling,r=n.firstChild;return J(n,B(H,{get when(){return e.kind!==`heading`},get children(){var t=Et(),n=t.firstChild;return J(n,()=>e.id),J(t,B(H,{get when(){return!A()},get children(){var t=Tt();return t.$$click=()=>{if(p()===e.id){m(void 0);return}m(e.id),g(a()[e.id]??``)},J(t,(()=>{var t=U(()=>!!a()[e.id]);return()=>t()?O(`editNote`):`+ ${O(`addNote`)}`})()),t}}),null),t}}),r),J(n,B(H,{get when(){return a()[e.id]},get children(){var t=Ot(),n=t.firstChild,r=n.nextSibling;return J(n,()=>O(`yourNote`)),J(r,()=>a()[e.id]),J(t,B(H,{get when(){return!A()},get children(){var t=Dt();return t.$$click=()=>te(e.id),J(t,()=>O(`remove`)),t}}),null),t}}),null),J(n,B(H,{get when(){return U(()=>p()===e.id)()&&!A()},get children(){var t=kt(),n=t.firstChild,r=n.nextSibling.firstChild,i=r.nextSibling;return n.$$keydown=t=>{(t.metaKey||t.ctrlKey)&&t.key===`Enter`&&(t.preventDefault(),F(e.id,h()),m(void 0))},n.$$input=e=>g(e.currentTarget.value),r.$$click=()=>m(void 0),J(r,()=>O(`cancel`)),i.$$click=()=>{F(e.id,h()),m(void 0)},J(i,()=>O(`save`)),b(e=>{var t=O(`talkNotePlaceholder`),r=h().trim()===``;return t!==e.e&&K(n,`placeholder`,e.e=t),r!==e.t&&(i.disabled=e.t=r),e},{e:void 0,t:void 0}),b(()=>n.value=h()),t}}),null),b(n=>{var i=`block-${e.id}`,a=e.html;return i!==n.e&&K(t,`id`,n.e=i),a!==n.t&&(r.innerHTML=n.t=a),n},{e:void 0,t:void 0}),t})()})),J(N,()=>O(`talkAbout`)),J(P,()=>O(`talkAboutBody`)),J(R,()=>O(`talkBlocksLabel`)),J(ie,()=>k().length),J(z,()=>O(`annotations`)),J(oe,j),J(se,()=>O(`talkChars`)),J(ce,()=>r().reply.chars),J(ue,()=>O(`annotations`)),J(de,j),J(le,B(H,{get when(){return M().length>0},get fallback(){return(()=>{var e=jt();return J(e,()=>O(`noNotesYet`)),e})()},get children(){var e=Ct();return J(e,B(V,{get each(){return M()},children:e=>(()=>{var t=Mt(),n=t.firstChild.nextSibling.firstChild,r=n.nextSibling;return t.$$click=()=>re(e.id),J(n,()=>e.label),J(r,()=>e.text),t})()})),e}}),null),J(pe,()=>O(j()===1?`noteCountOne`:`noteCount`,{count:j()}),null),J(W,B(Xe,{value:s,onInput:ne,onSubmit:()=>void L(),get placeholder(){return O(`talkPlaceholder`)},get submitLabel(){return O(`talkSubmitHint`)},get disabled(){return A()}})),G.$$click=()=>void L(),J(q,()=>O(`talkContinue`)),J(e,B(Ke,{get headings(){return r().headings}}),null),J(e,B(qe,{}),null),b(()=>G.disabled=A()),e})()}G([`click`,`input`,`keydown`]);var Ft=W(`<div class=page><p class=empty>`);function It(){let[e,t]=y(),[n,r]=y();return w(()=>{Ce().then(e=>t(e)).catch(e=>r(e instanceof Error?e.message:String(e)))}),B(H,{get when(){return e()},get fallback(){return(()=>{var e=Ft(),t=e.firstChild;return J(t,()=>n()??`Loading…`),e})()},children:e=>B(H,{get when(){return e().mode===`talk`},get fallback(){return B(_t,{get initial(){return e()}})},get children(){return B(Pt,{get initial(){return e()}})}})})}var Lt=document.getElementById(`root`);Lt&&pe(()=>B(It,{}),Lt);
|