@andares/pi-toolkits 1.2.3 → 1.2.4
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 +7 -23
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/package.json +1 -1
- package/src/features/init/audit-uat.test.ts +5 -1
- package/src/features/review/index.ts +5 -25
- package/src/features/review/review.test.ts +7 -10
- package/src/features/review-page/assets/{index-DXhJJ5ZT.js → index-DIRz72Vd.js} +1 -1
- package/src/features/review-page/assets/index.html +1 -1
- package/src/features/spec/index.test.ts +4 -13
- package/src/features/spec/index.ts +5 -6
- package/src/index.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,9 +11,14 @@ renames that heading to the version being published and refuses an empty section
|
|
|
11
11
|
|
|
12
12
|
<!-- Notes for the next release go here; `pnpm release` renames this heading. -->
|
|
13
13
|
|
|
14
|
-
## 1.2.
|
|
14
|
+
## 1.2.4 — 2026-11-28
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
- **ask-review / ask-spec** — the retired command spellings `/third-review` and `/ask-plan` are no longer registered; use `/ask-review` and `/ask-spec`. An autostart entry still spelled the old way is skipped with a warning instead of being sent to the model as chat.
|
|
17
|
+
- **spec** — a new note starts as `suggest` and the verdict pills read `suggest` / `must change` / `question`, so writing the everyday note no longer means undoing a default of `must change`.
|
|
18
|
+
- **release** — `pnpm release` now validates every release material before it runs a single gate: uncommitted work, an empty `## Unreleased`, a `package.json` without `CHANGELOG.md`, or a tag that already exists for the target version each stop it in seconds with a list of what to fix, instead of surfacing after the two-minute test run.
|
|
19
|
+
- **changelog** — released sections no longer keep the "notes for the next release go here" comment that used to be promoted along with them.
|
|
20
|
+
|
|
21
|
+
## 1.2.3 — 2026-11-26
|
|
17
22
|
|
|
18
23
|
- **spec/talk** — the contents panel keeps every heading row at its full height (a document with ~19 headings no longer squashes the rows into each other) and scrolls to the section you are reading when it opens.
|
|
19
24
|
- **talk** — when a new reply replaces the snapshot, a draft still waiting to be saved belongs to the old reply and is dropped, so it no longer lands in the new one.
|
|
@@ -21,8 +26,6 @@ renames that heading to the version being published and refuses an empty section
|
|
|
21
26
|
|
|
22
27
|
## 1.2.2 — 2026-11-26
|
|
23
28
|
|
|
24
|
-
<!-- Notes for the next release go here; `pnpm release` renames this heading. -->
|
|
25
|
-
|
|
26
29
|
- **release** — `pnpm release` now treats a green `publish` workflow run as the release's success criterion and stops there: no more polling npm for the version and its attestation, just a summary with the tag, the run URL, the Release URL and a package-page link. Every child process it spawns has a deadline (ssh included), so the wait can no longer sit silently on a dead connection.
|
|
27
30
|
- **quit-guard** — removed: `/quit-guard`, its settings file and the hang reports are gone. Force-exiting a hung shutdown never fixed the hang and hid the real cause, so pi is left to hang instead.
|
|
28
31
|
|
|
@@ -30,20 +33,14 @@ renames that heading to the version being published and refuses an empty section
|
|
|
30
33
|
|
|
31
34
|
- **spec/talk** — both pages have a confirmed **Close** action that stops the review server without sending a decision or a reply, including a closed-state fallback when the server is already gone.
|
|
32
35
|
|
|
33
|
-
<!-- Notes for the next release go here; `pnpm release` renames this heading. -->
|
|
34
|
-
|
|
35
36
|
## 1.2.0 — 2026-11-26
|
|
36
37
|
|
|
37
38
|
- **talk** — `/ask-talk` opens the agent's last reply in the review page: one note per block plus a composer, and `Continue` sends just the notes and your message back — the reply itself is not re-quoted.
|
|
38
39
|
- **spec** — the review page gets a contents strip at the reading column's edge: point at it to open a heading index, click a heading to jump; it follows the section you are reading.
|
|
39
40
|
- **spec** — a `Back to top` button appears once the right-hand column has scrolled out of view, and stays above the footer.
|
|
40
41
|
|
|
41
|
-
<!-- Notes for the next release go here; `pnpm release` renames this heading. -->
|
|
42
|
-
|
|
43
42
|
## 1.1.0 — 2026-11-25
|
|
44
43
|
|
|
45
|
-
<!-- Notes for the next release go here; `pnpm release` renames this heading. -->
|
|
46
|
-
|
|
47
44
|
- **spec** — running `/ask-spec` without arguments while a spec review is active now leaves the phase; `/ask-spec off` still works.
|
|
48
45
|
- **spec** — after feedback, the next submitted revision starts a new review server and opens a new window instead of printing a dead URL; reopening a closed review restarts it, and the revision history is preserved.
|
|
49
46
|
- **keep** — `/keep-quit` marks the current session unfinished and quits in one step; `/keep-load` lists that backlog, already-loaded rows dimmed but still selectable, and `/keep-drop` (or `ctrl+r` in the list) removes one.
|
|
@@ -53,8 +50,6 @@ renames that heading to the version being published and refuses an empty section
|
|
|
53
50
|
|
|
54
51
|
## 1.0.2 — 2026-11-24
|
|
55
52
|
|
|
56
|
-
<!-- Notes for the next release go here; `pnpm release` renames this heading. -->
|
|
57
|
-
|
|
58
53
|
- **host compatibility** — verified against every published pi release from 0.99.0 through 1.6.0 (window 1.3–1.6); the declared range stays `pi >= 0.99.0` with no upper bound, and the package loads cleanly on 1.6.0.
|
|
59
54
|
|
|
60
55
|
## 1.0.1 — 2026-11-17
|
|
@@ -64,8 +59,6 @@ renames that heading to the version being published and refuses an empty section
|
|
|
64
59
|
- **spec review page** — the decision bar now carries *Only changed* and *Global notes* on the left and the total note count in the middle, with the explanatory footer text removed.
|
|
65
60
|
- **ask-spec** — existing `<agent-dir>/ask-plan/` review histories are migrated to `<agent-dir>/ask-spec/` on first use.
|
|
66
61
|
|
|
67
|
-
<!-- Notes for the next release go here; `pnpm release` renames this heading. -->
|
|
68
|
-
|
|
69
62
|
## 1.0.0 — 2026-11-15
|
|
70
63
|
|
|
71
64
|
- **quit-guard** — a forced exit can no longer be defeated by a deadlock inside `process.exit` itself: after the report is written, a same-loop SIGKILL timer and then an independent worker thread guarantee the process ends (real hang observed 2026-11-13, process stuck 18 min with the pty already deleted).
|
|
@@ -76,8 +69,6 @@ renames that heading to the version being published and refuses an empty section
|
|
|
76
69
|
- **ask** — phase guards: ask refuses to start on top of a plan review or the UAT page, a review exits ask mode and refuses while a plan is under review, and `/ask-init` refuses mutating runs while another phase owns the tree.
|
|
77
70
|
- **init** — the audit now distinguishes a stale framework file from a hand edit, reports a missing workflow block, and treats bare legacy paths as a warning once the legacy directories are gone.
|
|
78
71
|
|
|
79
|
-
<!-- Notes for the next release go here; `pnpm release` renames this heading. -->
|
|
80
|
-
|
|
81
72
|
## 0.14.0 — 2026-11-13
|
|
82
73
|
|
|
83
74
|
- **whats-new** — the first interactive `pi` start after an upgrade shows what changed since the version you last ran, once, without registering a slash command.
|
|
@@ -109,10 +100,3 @@ renames that heading to the version being published and refuses an empty section
|
|
|
109
100
|
- permission — a capped rolling JSONL approval log records each ask, its parsed units and your answer; `pnpm approval-report` turns it into rule candidates.
|
|
110
101
|
|
|
111
102
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
package/README.md
CHANGED
|
@@ -291,7 +291,7 @@ After a development task is done, type the `/ask-review` command to summon **a d
|
|
|
291
291
|
|
|
292
292
|
<a name="spec"></a>
|
|
293
293
|
|
|
294
|
-
`/ask-spec [topic]` opens a spec-review phase: the agent explores the code, asks what it cannot infer, and writes a spec — no code changes while the spec is under review. Then it calls `spec_submit`, the review opens in **your browser**, and you annotate it **paragraph by paragraph**: every blank-line-separated block can carry notes, and every note comes back to the agent as its next message. `/ask-plan`
|
|
294
|
+
`/ask-spec [topic]` opens a spec-review phase: the agent explores the code, asks what it cannot infer, and writes a spec — no code changes while the spec is under review. Then it calls `spec_submit`, the review opens in **your browser**, and you annotate it **paragraph by paragraph**: every blank-line-separated block can carry notes, and every note comes back to the agent as its next message. The pre-rename `/ask-plan` alias was removed.
|
|
295
295
|
|
|
296
296
|
- **Blocks are the unit of review.** Each paragraph is one block, with a badge telling you what changed since the previous round: `new`, `modified`, `moved`, `removed`. Unchanged blocks collapse, so a three-line edit does not look like a rewrite. Fenced code blocks stay whole.
|
|
297
297
|
- **Two levels of notes.** On a block, or global. Nothing finer — no text ranges to re-anchor after an edit.
|
package/README.zh-CN.md
CHANGED
|
@@ -291,7 +291,7 @@ run = ["/ask-perm allow allow allow ask"]
|
|
|
291
291
|
|
|
292
292
|
<a name="spec"></a>
|
|
293
293
|
|
|
294
|
-
`/ask-spec [主题]` 进入规格评审期:模型先调研、把代码里看不出来的问题问清楚,然后写一份 spec——评审期间不改代码。写完调用 `spec_submit
|
|
294
|
+
`/ask-spec [主题]` 进入规格评审期:模型先调研、把代码里看不出来的问题问清楚,然后写一份 spec——评审期间不改代码。写完调用 `spec_submit`,评审页在**你的浏览器**里打开,你**逐段**批注:每个空行分隔的块都可以挂批注,批注会作为下一条消息回到模型。改名前的 `/ask-plan` 别名已移除。
|
|
295
295
|
|
|
296
296
|
- **块是评审单位。** 每个空行分隔的段落是一块,徽标告诉你相对上一版改了什么:`new`、`modified`、`moved`、`removed`。未变的块会折叠,三行小改不会看起来像整篇重写;围栏代码块保持完整。
|
|
297
297
|
- **两级批注。** 段落级,或全局;没有更细的文本范围批注,改完不需要重新锚定。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andares/pi-toolkits",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"description": "Integrated toolkit extension for pi — ask mode (read-only Q&A), browser-reviewed planning, reply notes in the browser (/ask-talk), an acceptance ledger with a browser page, session-scoped permission checks, model favorites, prompt stash, third-party code review, session autostart, a dedicated compaction model, an agent memory framework (/ask-init), a session backlog (/keep-quit, /keep-load, /keep-drop), and release notes on the first start after an upgrade",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -6,6 +6,7 @@ import { audit } from "./audit.js";
|
|
|
6
6
|
import { stateToToml } from "./apply.js";
|
|
7
7
|
import { detect } from "./detect.js";
|
|
8
8
|
import { AUDIT_CODES, CONTRACT_FILE, UAT_CONTRACT_FILE } from "./spec.js";
|
|
9
|
+
import { isoMinute } from "../uat/records.js";
|
|
9
10
|
import { installedProject, remove } from "./test-helpers.js";
|
|
10
11
|
|
|
11
12
|
const roots: string[] = [];
|
|
@@ -64,8 +65,11 @@ describe("UAT audit findings", () => {
|
|
|
64
65
|
|
|
65
66
|
it("warns about a recent non-canonical change record", () => {
|
|
66
67
|
const root = installed();
|
|
68
|
+
// "Recent" is a 14-day window from now, so the fixture date has to move
|
|
69
|
+
// with the clock — a hardcoded day silently turned this green test red
|
|
70
|
+
// once the window passed it (2026-11-27).
|
|
67
71
|
writeFileSync(
|
|
68
|
-
join(root, ".agents/implementations
|
|
72
|
+
join(root, ".agents/implementations", `${isoMinute(new Date()).slice(0, 10)}_handwritten.md`),
|
|
69
73
|
"# Handwritten\n\nno time\n",
|
|
70
74
|
"utf8",
|
|
71
75
|
);
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* (full tool access — this is check AND fix, not a read-only audit), runs a
|
|
7
7
|
* review turn, and the session then stays on that model (no auto-restore).
|
|
8
8
|
*
|
|
9
|
-
* Trigger: the /ask-review slash command
|
|
9
|
+
* Trigger: the /ask-review slash command (the old `/third-review` spelling was
|
|
10
10
|
* a compatibility alias (same handler, same state, no separate behaviour).
|
|
11
11
|
* Bare-message keyword matching was deliberately removed — a plain
|
|
12
12
|
* "ask-review" message goes to the model as ordinary text, so an accidental
|
|
@@ -52,20 +52,6 @@ import { getReviewStore, type ReviewStore } from "./store.js";
|
|
|
52
52
|
*/
|
|
53
53
|
export const REVIEW_COMMAND = "ask-review";
|
|
54
54
|
|
|
55
|
-
/**
|
|
56
|
-
* Compatibility alias, registered on purpose and delegating to the same
|
|
57
|
-
* runner. Why it exists: older session notes, muscle memory and autostart
|
|
58
|
-
* configs (`/third-review` in `.pi/autostart.toml`) keep working across the
|
|
59
|
-
* rename — a renamed command that silently disappears would turn those config
|
|
60
|
-
* entries into plain chat messages sent to the model.
|
|
61
|
-
*
|
|
62
|
-
* **Slated for removal**: this is a deprecation shuttle, not a permanent
|
|
63
|
-
* second name. It is deliberately absent from every external doc. Delete it
|
|
64
|
-
* (`/third-review` constant + its `registerCommand` block + the registration
|
|
65
|
-
* test case) once the old spelling has been unused for a release or two.
|
|
66
|
-
*/
|
|
67
|
-
export const REVIEW_COMMAND_ALIAS = "third-review";
|
|
68
|
-
|
|
69
55
|
/**
|
|
70
56
|
* Let the user pick a review model with the /model-style picker and persist
|
|
71
57
|
* the choice. Returns the picked model, or undefined when cancelled.
|
|
@@ -196,10 +182,10 @@ export function createReviewRunner(
|
|
|
196
182
|
export function registerReview(pi: ExtensionAPI): void {
|
|
197
183
|
const runReview = createReviewRunner(pi);
|
|
198
184
|
|
|
199
|
-
// Slash-command
|
|
200
|
-
// the model picker and the review turn.
|
|
201
|
-
//
|
|
202
|
-
//
|
|
185
|
+
// Slash-command trigger. The handler awaits the runner, which may block on
|
|
186
|
+
// the model picker and the review turn. The pre-rename `/third-review`
|
|
187
|
+
// alias was removed 2026-11-27 (the name had been out of the docs since the
|
|
188
|
+
// `/ask-*` rename; a second entry point was only teaching the old spelling).
|
|
203
189
|
pi.registerCommand(REVIEW_COMMAND, {
|
|
204
190
|
description:
|
|
205
191
|
"Pick the review model (defaults to the configured one) and review the just-completed work (check + fix)",
|
|
@@ -208,12 +194,6 @@ export function registerReview(pi: ExtensionAPI): void {
|
|
|
208
194
|
},
|
|
209
195
|
});
|
|
210
196
|
|
|
211
|
-
pi.registerCommand(REVIEW_COMMAND_ALIAS, {
|
|
212
|
-
description: "Same as /ask-review (compatibility alias)",
|
|
213
|
-
handler: async (_args: string, ctx: ExtensionContext) => {
|
|
214
|
-
await runReview(ctx);
|
|
215
|
-
},
|
|
216
|
-
});
|
|
217
197
|
|
|
218
198
|
// Configuration has no command of its own: every /ask-review opens the
|
|
219
199
|
// picker with the current default preselected, so "view" and "change" both
|
|
@@ -37,7 +37,6 @@ import {
|
|
|
37
37
|
pickReviewModel,
|
|
38
38
|
registerReview,
|
|
39
39
|
REVIEW_COMMAND,
|
|
40
|
-
REVIEW_COMMAND_ALIAS,
|
|
41
40
|
} from "./index.js";
|
|
42
41
|
import {
|
|
43
42
|
modelKey,
|
|
@@ -498,7 +497,7 @@ describe("createReviewRunner", () => {
|
|
|
498
497
|
// ─── command registration ──────────────────────────────────────
|
|
499
498
|
|
|
500
499
|
describe("registerReview", () => {
|
|
501
|
-
it("registers /ask-review
|
|
500
|
+
it("registers /ask-review only, with the retired alias gone", async () => {
|
|
502
501
|
type RegisteredCommand = {
|
|
503
502
|
description: string;
|
|
504
503
|
handler: (args: string, ctx: ExtensionContext) => Promise<unknown>;
|
|
@@ -515,23 +514,21 @@ describe("registerReview", () => {
|
|
|
515
514
|
|
|
516
515
|
registerReview(pi);
|
|
517
516
|
|
|
518
|
-
//
|
|
519
|
-
//
|
|
517
|
+
// One name only. `/third-review` was removed 2026-11-27 (崔总): it had
|
|
518
|
+
// been absent from the docs since the rename, so the second entry point
|
|
519
|
+
// only taught the old spelling. An autostart entry still using it is
|
|
520
|
+
// skipped by the pre-flight instead of being sent to the model.
|
|
520
521
|
expect(REVIEW_COMMAND).toBe("ask-review");
|
|
521
|
-
expect(
|
|
522
|
-
expect(
|
|
522
|
+
expect([...commands.keys()]).toEqual([REVIEW_COMMAND]);
|
|
523
|
+
expect(commands.has("third-review")).toBe(false);
|
|
523
524
|
|
|
524
525
|
// `review-model` was removed 2026-11-10: every /ask-review already opens
|
|
525
526
|
// the picker with the configured model preselected, so a second command
|
|
526
527
|
// was a second way to do the same thing. Keep it gone.
|
|
527
528
|
expect(commands.has("review-model")).toBe(false);
|
|
528
529
|
|
|
529
|
-
// Both entry points reach the same runner: same picker, same guards, same
|
|
530
|
-
// review turn — the alias is a name, not a second implementation.
|
|
531
530
|
const { ctx } = fakeCtx({ customResult: MODELS[0] });
|
|
532
531
|
await commands.get(REVIEW_COMMAND)?.handler("", ctx);
|
|
533
532
|
expect(pi.sendUserMessage).toHaveBeenCalledTimes(1);
|
|
534
|
-
await commands.get(REVIEW_COMMAND_ALIAS)?.handler("", ctx);
|
|
535
|
-
expect(pi.sendUserMessage).toHaveBeenCalledTimes(2);
|
|
536
533
|
});
|
|
537
534
|
});
|
|
@@ -1 +1 @@
|
|
|
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=I,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(()=>z(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[k.bind(n),e=>(typeof e==`function`&&(e=f&&f.running&&f.sources.has(n)?e(n.tValue):e(n.value)),A(n,e))]}function b(e,t,n){j(N(e,t,!1,c))}function x(e,t,n){s=L;let r=N(e,t,!1,c),i=O&&ee(O);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),h?h.push(r):j(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,j(r),k.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 ee(e){let t;return d&&d.context&&(t=d.context[e.id])!==void 0?t:e.defaultValue}var O;function k(){let e=f&&f.running;if(this.sources&&(e?this.tState:this.state)){if((e?this.tState:this.state)===c)j(this);else{let e=m;m=null,F(()=>R(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 A(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&&ne(n)),r?n.tState=c:n.state=c)}if(m.length>1e6)throw m=[],Error()},!1)}return t}function j(e){if(!e.fn)return;z(e);let t=g;M(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,M(e,e.tValue,t),p=d=null},!1)})}function M(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(z),e.tOwned=void 0):(e.state=c,e.owned&&e.owned.forEach(z),e.owned=null)),e.updatedAt=n+1,ae(t)}finally{p=a,d=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?A(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 R(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)j(e);else if((t?e.tState:e.state)===l){let t=m;m=null,F(()=>R(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,ae(e)}}function te(e){if(m&&=(I(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)z(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)z(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 I(e){for(let t=0;t<e.length;t++)P(e[t])}function L(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 R(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&&R(i,t)}}}function ne(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&&ne(r))}}function z(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--)z(e.tOwned[t]);delete e.tOwned}if(f&&f.running&&e.pure)B(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)z(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 B(e,t){if(t||(e.tState=0,f.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)B(e.owned[t])}function re(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function ie(e,t,n){try{for(let n of t)n(e)}catch(e){ae(e,n&&n.owner||null)}}function ae(e,t=d){let n=o&&t&&t.context&&t.context[o],r=re(e);if(!n)throw r;h?h.push({fn(){ie(r,n,t)},state:c}):ie(r,n,t)}var oe=Symbol(`fallback`);function V(e){for(let t=0;t<e.length;t++)e[t]()}function se(e,t,n={}){let r=[],a=[],o=[],s=0,c=t.length>1?[]:null;return T(()=>V(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&&(V(o),o=[],r=[],a=[],s=0,c&&=[]),n.fallback&&(r=[oe],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 H(e,t){return C(()=>e(t||{}))}var ce=e=>`Stale read from <${e}>.`;function U(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return S(se(()=>e.each,e.children,t||void 0))}function W(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 ce(`Show`);return n()})):a}return e.fallback},void 0,void 0)}var G=e=>S(()=>e());function le(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 ue=`_$DX_DELEGATE`;function de(e,t,n,r={}){let i;return _(r=>{i=r,t===document?e():Y(t,e(),!n&&t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function K(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 fe(e,t=window.document){let n=t[ue]||(t[ue]=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,X))}}function q(e,t,n){_e(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function J(e,t){_e(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function pe(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 me(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]||(ve(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||(ve(e,i,!0),n[i]=o)}return n}function he(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function ge(e,t,n){return C(()=>e(t,n))}function Y(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return Z(e,t,r,n);b(r=>Z(e,t(),r,n),r)}function _e(t){return!!e.context&&!e.done&&(!t||t.isConnected)}function ve(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 X(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 Z(e,t,n,r,i){let a=_e(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=Q(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=Q(e,n,r)}else if(o===`function`)return b(()=>{let i=t();for(;typeof i==`function`;)i=i();n=Z(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(ye(o,t,n,i))return b(()=>n=Z(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=Q(e,n,r),s)return n}else c?n.length===0?be(e,o,r):le(e,n,o):(n&&Q(e),be(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=Q(e,n,r,t);Q(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function ye(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=ye(e,o,s)||i;else if(c===`function`){if(r){for(;typeof o==`function`;)o=o();i=ye(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 be(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function Q(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 xe=new URLSearchParams(window.location.search).get(`t`)??``;async function $(e,t={}){let n=await fetch(e,{...t,headers:{...t.body?{"content-type":`application/json`}:{},"x-plan-token":xe,...t.headers??{}}});if(!n.ok)throw Error(`${t.method??`GET`} ${e} → HTTP ${n.status}`);return await n.json()}function Se(e){return $(e===void 0?`/api/state`:`/api/state?version=${e}`)}function Ce(e,t){return $(`/api/notes`,{method:`POST`,body:JSON.stringify({notes:e,draft:t})})}function we(e,t){return $(`/api/continue`,{method:`POST`,body:JSON.stringify({notes:e,message:t})})}function Te(){let e=new AbortController,t=setTimeout(()=>e.abort(),3e3);return $(`/api/close`,{method:`POST`,signal:e.signal}).finally(()=>clearTimeout(t))}function Ee(e,t){return $(`/api/annotate`,{method:`POST`,body:JSON.stringify({version:e,annotations:t})})}function De(e,t){return $(`/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(xe)}`);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.`,closePage:`Close`,closePageHint:`Close this page without sending anything to the agent`,closePageConfirm:`Close this page and stop its review server? Nothing will be sent to the agent.`,closePageDone:`Page closed`,closePageServerClosed:`The review server is closed. Nothing was sent to the agent.`,closePageUnreachable:`The review server could not be reached. Nothing was sent to the agent.`,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`,talkUntitled:`Untitled session`,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:`现在可以关闭这个标签页了。`,closePage:`关闭`,closePageHint:`关闭此页面,不向 agent 发送任何信息`,closePageConfirm:`关闭此页面并停止它的评审服务吗?不会向 agent 发送任何信息。`,closePageDone:`页面已关闭`,closePageServerClosed:`评审服务已关闭,没有向 agent 发送任何信息。`,closePageUnreachable:`无法连接评审服务;没有向 agent 发送任何信息。`,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:`回复批注`,talkUntitled:`未命名会话`,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=K(`<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=K(`<span class=outline-bar>`),Re=K(`<button type=button class=outline-row><span class=outline-text>`),ze=K(`<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`),Be=K(`<button type=button class="ghost close-page">`),Ve=K(`<div class="page page-closed"><main class=manual-close-notice role=status><div class=done><div class=done-title></div><div class=done-hint></div><div class=done-hint>`),He=K(`<textarea class=composer-input rows=1>`);function Ue(e,t){let n=[...new Set(t)].sort((e,t)=>e-t).indexOf(e);return n<0?0:Math.min(n,3)}var We=[16,13,10,8],Ge=24,Ke=14;function qe(e,t,n=Ge){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 Je=140;function Ye(){return window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}function Xe(e){let[t,n]=y(!1),[r,i]=y(),a,o,s,c,l,u,d=S(()=>e.headings.map(e=>e.level)),f=S(()=>qe(e.headings,r())),p=e=>Ue(e,d());function m(){a!==void 0&&clearTimeout(a),n(!0)}function h(){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<=Je)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`)}),x(()=>{let e=r(),t=l;if(!t||e===void 0)return;let n=f().findIndex(t=>t.blockId===e),i=t.children[n];if(!i)return;let a=t.getBoundingClientRect(),o=i.getBoundingClientRect();o.top<a.top?t.scrollTop-=a.top-o.top:o.bottom>a.bottom&&(t.scrollTop+=o.bottom-a.bottom)}),x(()=>{if(!t())return;let n=u,i=r();if(!n||i===void 0)return;let a=e.headings.findIndex(e=>e.blockId===i),o=a>=0?n.children[a]:void 0;if(!o)return;let s=n.getBoundingClientRect(),c=o.getBoundingClientRect(),l=getComputedStyle(n),d=s.top+Number.parseFloat(l.paddingTop)+Ke,f=s.bottom-Number.parseFloat(l.paddingBottom)-Ke;c.top<d?n.scrollTop-=d-c.top:c.bottom>f&&(n.scrollTop+=c.bottom-f)});function g(t){e.onJump?.(t),requestAnimationFrame(()=>{let e=document.getElementById(`block-${t}`);e&&(e.scrollIntoView({behavior:Ye(),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 H(W,{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,d=o.nextSibling;return n.addEventListener(`mouseleave`,h),n.addEventListener(`mouseenter`,m),ge(e=>l=e,i),Y(i,H(U,{get each(){return f()},children:e=>(()=>{var t=Le();return b(n=>{var i=e.blockId===r(),a=`${We[p(e.level)]}px`;return i!==n.e&&t.classList.toggle(`is-active`,n.e=i),a!==n.t&&he(t,`width`,n.t=a),n},{e:void 0,t:void 0}),t})()})),Y(s,()=>e.headings.length,c),Y(s,()=>e.headings.length===1?`heading`:`headings`,null),ge(e=>u=e,d),Y(d,H(U,{get each(){return e.headings},children:e=>(()=>{var n=Re(),i=n.firstChild;return n.$$click=()=>g(e.blockId),Y(i,()=>e.text),b(i=>{var a=e.blockId===r(),o=`${10+p(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&&he(n,`padding-left`,i.t=o),s!==i.a&&q(n,`tabindex`,i.a=s),c!==i.o&&q(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&&q(i,`aria-hidden`,e.t=o),s!==e.a&&q(a,`aria-hidden`,e.a=s),e},{e:void 0,t:void 0,a:void 0}),n}})}function Ze(){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)})}),H(W,{get when(){return e()},get children(){var e=ze();return e.$$click=()=>{window.scrollTo({top:0,behavior:Ye()})},e}})}function Qe(){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())})}function $e(e){let[t,n]=y(!1),r=t=>Fe(e.lang,t);async function i(){let t=!1;try{await Te(),t=!0}catch{}e.onClosed(t),window.close()}return(()=>{var e=Be();return e.$$click=()=>{t()||!window.confirm(r(`closePageConfirm`))||(n(!0),i())},Y(e,()=>r(`closePage`)),b(n=>{var i=t(),a=r(`closePageHint`);return i!==n.e&&(e.disabled=n.e=i),a!==n.t&&q(e,`title`,n.t=a),n},{e:void 0,t:void 0}),e})()}function et(e){let t=t=>Fe(e.lang,t);return(()=>{var n=Ve(),r=n.firstChild.firstChild.firstChild,i=r.nextSibling,a=i.nextSibling;return Y(r,()=>t(`closePageDone`)),Y(i,(()=>{var n=G(()=>!!e.serverClosed);return()=>n()?t(`closePageServerClosed`):t(`closePageUnreachable`)})()),Y(a,()=>t(`closeHint`)),n})()}var tt=220;function nt(e){let t=getComputedStyle(e),n=e=>Number.parseFloat(e)||0,r=Number.parseFloat(t.lineHeight),i=Number.parseFloat(t.fontSize),a=Number.isFinite(r)?r:i*1.5,o=n(t.borderTopWidth)+n(t.borderBottomWidth);return{oneLine:a+(n(t.paddingTop)+n(t.paddingBottom))+o,border:o}}function rt(e){let t,n=e=>{if(!t)return;let{oneLine:n,border:r}=nt(t),i=Math.min(window.innerHeight*.4,tt);t.style.height=`auto`;let a=t.scrollHeight+r,o=e?Math.min(a,i):n;t.style.height=`${Math.max(o,n)}px`,t.style.overflowY=e&&a>i?`auto`:`hidden`};return w(()=>n(document.activeElement===t)),(()=>{var r=He();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)),ge(e=>{t=e},r),b(t=>{var n=e.placeholder,i=e.disabled,a=e.placeholder,o=e.submitLabel;return n!==t.e&&q(r,`placeholder`,t.e=n),i!==t.t&&(r.disabled=t.t=i),a!==t.a&&q(r,`aria-label`,t.a=a),o!==t.o&&q(r,`title`,t.o=o),t},{e:void 0,t:void 0,a:void 0,o:void 0}),b(()=>r.value=e.value()),r})()}fe([`click`,`input`,`keydown`]);var it=K(`<span class=readonly>`),at=K(`<div class=error>`),ot=K(`<div class=banner><span></span><button class=link>`),st=K(`<div class=done><div class=done-title></div><div class=done-hint>`),ct=K(`<button class=add>+ `),lt=K(`<section id=global-notes class=global-card><div class=global-head><span class=eyebrow></span><span class=global-count>`),ut=K(`<p class=empty>`),dt=K(`<div class=collapsed><span></span><button class=link>`),ft=K(`<div class=rail-notes>`),pt=K(`<button class=ghost>`),mt=K(`<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">`),ht=K(`<span class=chip-changed>+`),gt=K(`<button class=chip><span class=chip-n>v`),_t=K(`<button class=remove>`),vt=K(`<div><span></span><span class=note-text>`),yt=K(`<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>`),bt=K(`<p class=rail-empty>`),xt=K(`<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>`),St=K(`<div class=editor><div class=verdicts></div><textarea></textarea><div class=editor-actions><button class=ghost></button><button class=primary>`),Ct=K(`<label><input type=radio name=verdict>`);function wt(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,ee]=y(),O,k=(e,n)=>Fe(t(),e,n);Qe();async function A(e){try{let t=await Se(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(()=>{O=ke({onRevision:()=>{a()===void 0&&A()},onAnnotations:()=>{a()===void 0&&A()},onDecided:e=>u(e.action)}),T(()=>{O?.(),O=void 0})}),x(()=>{let e=r()?.slug;document.title=e?`${k(`title`)} — ${e}`:k(`title`)});let j=S(()=>r()?.items??[]),M=e=>e.status??`unchanged`,N=S(()=>j().filter(e=>M(e)!==`unchanged`).length),P=S(()=>!d()&&N()>0),F=S(()=>P()?j().filter(e=>M(e)===`unchanged`).length:0),te=S(()=>P()?j().filter(e=>M(e)!==`unchanged`):j()),I=S(()=>r()?.history[0]?.n??r()?.version),L=S(()=>{let e=r();return e!==void 0&&e.version!==I()}),R=S(()=>{let e={unchanged:0,moved:0,modified:0,added:0,removed:0};for(let t of j())e[M(t)]+=1;return e}),ne=S(()=>[...r()?.history??[]].reverse()),z=S(()=>r()?.annotations.global??[]),B=S(()=>p()!==void 0&&p().blockId===void 0),re=S(()=>z().length>0||B()),ie=e=>r()?.annotations.blocks.find(t=>t.blockId===e)?.annotations??[],ae=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}),oe=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:k(`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 V(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 A(t.version)}}async function se(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 V(a)}async function ce(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 V(i)}function le(){!L()&&!B()&&(m({blockId:void 0}),g(``),v(`change`)),requestAnimationFrame(()=>{document.getElementById(`global-notes`)?.scrollIntoView({behavior:`smooth`,block:`start`})})}function ue(){if(!L()){if(B()){m(void 0);return}le()}}function de(e){te().some(t=>t.id===e)||f(!0)}function K(e){let t=e.blockId;te().some(e=>e.id===t)||f(!0),requestAnimationFrame(()=>{document.getElementById(`block-${t}`)?.scrollIntoView({behavior:`smooth`,block:`center`})})}function fe(e){O?.(),O=void 0,ee(e)}async function pe(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 he=e=>`badge badge-${e}`,ge=e=>`verdict${e[0].toUpperCase()}${e.slice(1)}`,_e=e=>`note-verdict verdict-${e}`;return H(W,{get when(){return D()===void 0},get fallback(){return H(et,{get lang(){return t()},get serverClosed(){return D()===!0}})},get children(){var e=mt(),i=e.firstChild,c=i.firstChild,u=c.firstChild,y=u.firstChild.nextSibling,x=u.nextSibling,S=x.firstChild,w=c.nextSibling,T=w.firstChild,E=T.nextSibling,D=E.firstChild,ee=D.nextSibling.nextSibling,O=ee.nextSibling.nextSibling,P=w.nextSibling,V=P.firstChild,le=V.nextSibling,ve=i.nextSibling,X=ve.firstChild,Z=X.firstChild,ye=X.nextSibling.firstChild,be=ye.firstChild,Q=be.nextSibling,xe=Q.firstChild,$=xe.nextSibling.firstChild,Se=$.nextSibling,Ce=Q.nextSibling.firstChild,we=Ce.firstChild.nextSibling,Te=we.nextSibling,Ee=Ce.nextSibling,De=Ee.firstChild.nextSibling,Oe=De.nextSibling,ke=Ee.nextSibling,Ae=ke.firstChild.nextSibling,je=Ae.nextSibling,Me=ke.nextSibling.firstChild.nextSibling,Pe=Me.nextSibling,Fe=ye.nextSibling,Ie=Fe.firstChild.firstChild,Le=Ie.nextSibling,Re=ve.nextSibling.firstChild,ze=Re.firstChild,Be=ze.firstChild,Ve=Be.nextSibling;Ve.nextSibling;var He=Re.nextSibling,Ue=He.firstChild;Ue.firstChild;var We=He.nextSibling.firstChild,Ge=We.nextSibling,Ke=Ge.firstChild;return Y(y,()=>k(`title`)),S.$$click=()=>{let e=t()===`en`?`zh`:`en`;n(e),Ne(e)},Y(S,()=>t()===`en`?`中文`:`EN`),Y(x,H($e,{get lang(){return t()},onClosed:fe}),null),Y(T,()=>r()?.slug??`spec`),Y(D,()=>r()?.source??`specs/spec.md`),Y(ee,()=>k(`version`,{version:r()?.version??0,total:r()?.totalVersions??0})),Y(O,(()=>{var e=G(()=>N()>0);return()=>e()?k(N()===1?`changedOne`:`changed`,{count:N()}):k(`noChange`)})()),Y(E,H(W,{get when(){return L()},get children(){var e=it();return Y(e,()=>k(`readOnly`)),e}}),null),Y(V,()=>k(`history`)),Y(P,H(U,{get each(){return ne()},children:e=>(()=>{var t=gt(),n=t.firstChild;return n.firstChild,t.$$click=()=>{e.n===I()?(o(void 0),A()):(o(e.n),A(e.n))},Y(n,()=>e.n,null),Y(t,H(W,{get when(){return e.changed>0},get children(){var t=ht();return t.firstChild,Y(t,()=>e.changed,null),t}}),null),b(()=>t.classList.toggle(`active`,e.n===r()?.version)),t})()}),le),Y(le,()=>k(j().length===1?`historySummaryOne`:`historySummary`,{count:j().length})),Y(e,H(W,{get when(){return s()},get children(){var e=at();return Y(e,()=>k(`error`,{message:s()??``})),e}}),ve),Y(X,H(W,{get when(){return L()},get children(){var e=ot(),t=e.firstChild,n=t.nextSibling;return Y(t,()=>k(`viewingOld`,{v:a()??r()?.version??0})),n.$$click=()=>{o(void 0),A()},Y(n,()=>k(`back`)),e}}),Z),Y(X,H(W,{get when(){return l()},get children(){var e=st(),t=e.firstChild,n=t.nextSibling;return Y(t,(()=>{var e=G(()=>l()===`approve`);return()=>e()?k(`approved`):k(`denied`)})()),Y(n,(()=>{var e=G(()=>!!C());return()=>e()?k(`closeHint`):k(`closing`)})()),e}}),Z),Y(X,H(W,{get when(){return re()},get children(){var e=lt(),t=e.firstChild,n=t.firstChild,r=n.nextSibling;return Y(n,()=>k(`globalNotesTitle`)),Y(r,()=>z().length),Y(t,H(W,{get when(){return G(()=>!L())()&&!B()},get children(){var e=ct();return e.firstChild,e.$$click=()=>{m({blockId:void 0}),g(``),v(`change`)},Y(e,()=>k(`addNote`),null),e}}),null),Y(e,H(U,{get each(){return z()},children:(e,t)=>(()=>{var n=vt(),r=n.firstChild,i=r.nextSibling;return Y(r,()=>k(ge(e.verdict))),Y(i,()=>e.comment),Y(n,H(W,{get when(){return!L()},get children(){var e=_t();return e.$$click=()=>void ce(void 0,t()),Y(e,()=>k(`remove`)),e}}),null),b(t=>{var i=`note note-${e.verdict}`,a=_e(e.verdict);return i!==t.e&&J(n,t.e=i),a!==t.t&&J(r,t.t=a),t},{e:void 0,t:void 0}),n})()}),null),Y(e,H(W,{get when(){return G(()=>!!B())()&&!L()},get children(){return H(Tt,{draft:h,setDraft:g,verdict:_,setVerdict:v,onSave:()=>void se(void 0),onCancel:()=>m(void 0),t:k})}}),null),e}}),Z),Y(X,H(W,{get when(){return G(()=>!!r())()&&r().items.length===0},get children(){var e=ut();return Y(e,()=>k(`emptySpec`)),e}}),Z),Y(X,H(W,{get when(){return F()>0},get children(){var e=dt(),t=e.firstChild,n=t.nextSibling;return Y(t,()=>k(F()===1?`unchangedHiddenOne`:`unchangedHidden`,{count:F()})),n.$$click=()=>f(!0),Y(n,()=>k(`showAll`)),e}}),Z),Y(Z,H(U,{get each(){return te()},children:e=>(()=>{var t=yt(),n=t.firstChild,r=n.nextSibling,i=r.firstChild,a=i.firstChild,o=a.firstChild,s=a.nextSibling,c=i.nextSibling;return Y(a,()=>k(`status_${M(e)}`),null),Y(s,()=>e.id),Y(i,H(W,{get when(){return!L()},get children(){var t=ct();return t.firstChild,t.$$click=()=>{m({blockId:e.id}),g(``),v(`change`)},Y(t,()=>k(`addNote`),null),t}}),null),Y(r,H(U,{get each(){return ie(e.id)},children:(t,n)=>(()=>{var r=vt(),i=r.firstChild,a=i.nextSibling;return Y(i,()=>k(ge(t.verdict))),Y(a,()=>t.comment),Y(r,H(W,{get when(){return!L()},get children(){var t=_t();return t.$$click=()=>void ce(e.id,n()),Y(t,()=>k(`remove`)),t}}),null),b(e=>{var n=`note note-${t.verdict}`,a=_e(t.verdict);return n!==e.e&&J(r,e.e=n),a!==e.t&&J(i,e.t=a),e},{e:void 0,t:void 0}),r})()}),null),Y(r,H(W,{get when(){return G(()=>p()?.blockId===e.id)()&&!L()},get children(){return H(Tt,{draft:h,setDraft:g,verdict:_,setVerdict:v,onSave:()=>void se(e.id),onCancel:()=>m(void 0),t:k})}}),null),b(r=>{var i=`block-${e.id}`,s={[`is-`+M(e)]:!0},l=`block-bar bar-${M(e)}`,u=he(M(e)),d=`dot dot-${M(e)}`,f=e.html;return i!==r.e&&q(t,`id`,r.e=i),r.t=me(t,s,r.t),l!==r.a&&J(n,r.a=l),u!==r.o&&J(a,r.o=u),d!==r.i&&J(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})()})),Y(be,()=>k(`thisRevision`)),Y(xe,N),Y($,()=>k(`blocksChanged`)),Y(Se,()=>k(`ofTotal`,{total:j().length})),Y(we,()=>k(`status_added`)),Y(Te,()=>R().added),Y(De,()=>k(`status_modified`)),Y(Oe,()=>R().modified),Y(Ae,()=>k(`status_moved`)),Y(je,()=>R().moved),Y(Me,()=>k(`status_removed`)),Y(Pe,()=>R().removed),Y(Ie,()=>k(`annotations`)),Y(Le,ae),Y(Fe,H(W,{get when(){return oe().length>0},get fallback(){return(()=>{var e=bt();return Y(e,()=>k(`noNotesYet`)),e})()},get children(){var e=ft();return Y(e,H(U,{get each(){return oe()},children:e=>(()=>{var t=xt(),n=t.firstChild,r=n.nextSibling.firstChild,i=r.nextSibling;return t.$$click=()=>K(e),Y(r,()=>e.label),Y(i,()=>e.annotation.comment),b(()=>J(n,`dot dot-${e.annotation.verdict}`)),t})()})),e}}),null),Y(Re,H(W,{get when(){return N()>0},get children(){var e=pt();return e.$$click=()=>f(!d()),Y(e,(()=>{var e=G(()=>!!d());return()=>e()?k(`onlyChanged`):k(`showAll`)})()),e}}),ze),ze.$$click=ue,Y(ze,()=>k(`globalNotes`),Be),Y(ze,()=>z().length,Ve),Y(Ue,()=>k(ae()===1?`noteCountOne`:`noteCount`,{count:ae()}),null),We.$$click=()=>void pe(`deny`),Y(We,()=>k(`deny`)),Ge.$$click=()=>void pe(`approve`),Y(Ke,()=>k(`approve`)),Y(e,H(Xe,{get headings(){return r()?.headings??[]},onJump:de}),null),Y(e,H(Ze,{}),null),b(e=>{var t=L(),n=L()||l()!==void 0,r=L()||l()!==void 0;return t!==e.e&&(ze.disabled=e.e=t),n!==e.t&&(We.disabled=e.t=n),r!==e.a&&(Ge.disabled=e.a=r),e},{e:void 0,t:void 0,a:void 0}),e}})}function Tt(e){return(()=>{var t=St(),n=t.firstChild,r=n.nextSibling,i=r.nextSibling.firstChild,a=i.nextSibling;return Y(n,H(U,{each:[`change`,`suggest`,`question`],children:t=>(()=>{var n=Ct(),r=n.firstChild;return r.addEventListener(`change`,()=>e.setVerdict(t)),Y(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),pe(i,`click`,e.onCancel,!0),Y(i,()=>e.t(`cancel`)),pe(a,`click`,e.onSave,!0),Y(a,()=>e.t(`save`)),b(t=>{var n=e.t(`notePlaceholder`),i=e.draft().trim()===``;return n!==t.e&&q(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})()}fe([`click`,`input`]);var Et=K(`<span class=readonly>`),Dt=K(`<div class=error>`),Ot=K(`<div class=done><div class=done-title></div><div class=done-hint>`),kt=K(`<p class=empty>`),At=K(`<div class=rail-notes>`),jt=K(`<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">`),Mt=K(`<button type=button class=add>`),Nt=K(`<div class=block-head><span class=block-id>`),Pt=K(`<button type=button class=remove>`),Ft=K(`<div class="note note-talk"><span class="note-verdict verdict-talk"></span><span class=note-text>`),It=K(`<div class=editor><textarea class=note-input></textarea><div class=editor-actions><button type=button class=ghost></button><button type=button class=primary>`),Lt=K(`<article class="block block-talk"><div class="block-bar bar-talk"aria-hidden=true></div><div class=block-inner><div class=block-body>`),Rt=K(`<p class=rail-empty>`),zt=K(`<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>`),Bt=300;function Vt(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,ee]=y(),O,k,A=(e,n)=>Fe(t(),e,n);Qe();let j=S(()=>r().items),M=S(()=>l()||d()),N=S(()=>Object.values(a()).filter(e=>e.trim()!==``).length),P=S(()=>j().map(e=>({id:e.id,label:e.label,text:a()[e.id]??``})).filter(e=>e.text.trim()!==``)),F=S(()=>{let e=r().reply.at,t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}),te=S(()=>{let e=r().title?.trim();return e!==void 0&&e!==``?e:A(`talkUntitled`)});async function I(){k!==void 0&&(clearTimeout(k),k=void 0);try{let e=await Se();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(()=>{O=ke({onRevision:()=>void I(),onAnnotations:()=>void I(),onDecided:()=>void 0,onRefresh:()=>void I(),onSent:()=>u(!0)}),T(()=>{O?.(),O=void 0,k!==void 0&&clearTimeout(k)})}),x(()=>{document.title=te()});function L(e){O?.(),O=void 0,k!==void 0&&(clearTimeout(k),k=void 0),ee(e)}function R(e,t){k!==void 0&&clearTimeout(k),k=setTimeout(()=>{k=void 0,Ce(e,t).catch(e=>{l()||v(e instanceof Error?e.message:String(e))})},Bt)}function ne(e,t){let n={...a()};t.trim()===``?delete n[e]:n[e]=t,o(n),R(n,s())}function z(e){let t={...a()};delete t[e],o(t),p()===e&&m(void 0),R(t,s())}function B(e){c(e),R(a(),e)}function re(){let e={...a()},t=p();return t!==void 0&&(h().trim()===``?delete e[t]:e[t]=h()),e}async function ie(){if(M())return;let e=re();if(!Object.values(e).some(e=>e.trim()!==``)&&s().trim()===``){v(A(`talkNothingToSend`));return}o(e),k!==void 0&&(clearTimeout(k),k=void 0),f(!0);try{await we(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 ae(e){requestAnimationFrame(()=>{document.getElementById(`block-${e}`)?.scrollIntoView({behavior:Ye(),block:`center`})})}return H(W,{get when(){return D()===void 0},get fallback(){return H(et,{get lang(){return t()},get serverClosed(){return D()===!0}})},get children(){var e=jt(),i=e.firstChild,o=i.firstChild,c=o.firstChild,u=c.firstChild.nextSibling,d=c.nextSibling,f=d.firstChild,v=o.nextSibling.firstChild,y=v.nextSibling,x=y.firstChild,S=x.nextSibling.nextSibling,w=S.nextSibling.nextSibling,T=i.nextSibling,E=T.firstChild,D=E.firstChild,ee=E.nextSibling.firstChild,O=ee.firstChild,k=O.nextSibling,I=k.nextSibling.firstChild,R=I.firstChild,re=R.nextSibling,oe=I.nextSibling,V=oe.firstChild,se=V.nextSibling,ce=oe.nextSibling.firstChild,le=ce.nextSibling,ue=ee.nextSibling,de=ue.firstChild.firstChild,K=de.nextSibling,fe=T.nextSibling.firstChild,J=fe.firstChild;J.firstChild;var pe=fe.nextSibling,me=pe.nextSibling.firstChild,he=me.firstChild;return Y(u,()=>A(`talkTitle`)),f.$$click=()=>{let e=t()===`en`?`zh`:`en`;n(e),Ne(e)},Y(f,()=>t()===`en`?`中文`:`EN`),Y(d,H($e,{get lang(){return t()},onClosed:L}),null),Y(v,te),Y(x,F),Y(S,()=>r().reply.model??`—`),Y(w,()=>A(j().length===1?`talkBlocksOne`:`talkBlocks`,{count:j().length})),Y(y,H(W,{get when(){return l()},get children(){var e=Et();return Y(e,()=>A(`talkSentBadge`)),e}}),null),Y(e,H(W,{get when(){return _()},get children(){var e=Dt();return Y(e,()=>A(`error`,{message:_()??``})),e}}),T),Y(E,H(W,{get when(){return l()},get children(){var e=Ot(),t=e.firstChild,n=t.nextSibling;return Y(t,()=>A(`talkSentTitle`)),Y(n,(()=>{var e=G(()=>!!C());return()=>e()?A(`closeHint`):A(`closing`)})()),e}}),D),Y(E,H(W,{get when(){return j().length===0},get children(){var e=kt();return Y(e,()=>A(`emptySpec`)),e}}),D),Y(D,H(U,{get each(){return j()},children:e=>(()=>{var t=Lt(),n=t.firstChild.nextSibling,r=n.firstChild;return Y(n,H(W,{get when(){return e.kind!==`heading`},get children(){var t=Nt(),n=t.firstChild;return Y(n,()=>e.id),Y(t,H(W,{get when(){return!M()},get children(){var t=Mt();return t.$$click=()=>{if(p()===e.id){m(void 0);return}m(e.id),g(a()[e.id]??``)},Y(t,(()=>{var t=G(()=>!!a()[e.id]);return()=>t()?A(`editNote`):`+ ${A(`addNote`)}`})()),t}}),null),t}}),r),Y(n,H(W,{get when(){return a()[e.id]},get children(){var t=Ft(),n=t.firstChild,r=n.nextSibling;return Y(n,()=>A(`yourNote`)),Y(r,()=>a()[e.id]),Y(t,H(W,{get when(){return!M()},get children(){var t=Pt();return t.$$click=()=>z(e.id),Y(t,()=>A(`remove`)),t}}),null),t}}),null),Y(n,H(W,{get when(){return G(()=>p()===e.id)()&&!M()},get children(){var t=It(),n=t.firstChild,r=n.nextSibling.firstChild,i=r.nextSibling;return n.$$keydown=t=>{(t.metaKey||t.ctrlKey)&&t.key===`Enter`&&(t.preventDefault(),ne(e.id,h()),m(void 0))},n.$$input=e=>g(e.currentTarget.value),r.$$click=()=>m(void 0),Y(r,()=>A(`cancel`)),i.$$click=()=>{ne(e.id,h()),m(void 0)},Y(i,()=>A(`save`)),b(e=>{var t=A(`talkNotePlaceholder`),r=h().trim()===``;return t!==e.e&&q(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&&q(t,`id`,n.e=i),a!==n.t&&(r.innerHTML=n.t=a),n},{e:void 0,t:void 0}),t})()})),Y(O,()=>A(`talkAbout`)),Y(k,()=>A(`talkAboutBody`)),Y(R,()=>A(`talkBlocksLabel`)),Y(re,()=>j().length),Y(V,()=>A(`annotations`)),Y(se,N),Y(ce,()=>A(`talkChars`)),Y(le,()=>r().reply.chars),Y(de,()=>A(`annotations`)),Y(K,N),Y(ue,H(W,{get when(){return P().length>0},get fallback(){return(()=>{var e=Rt();return Y(e,()=>A(`noNotesYet`)),e})()},get children(){var e=At();return Y(e,H(U,{get each(){return P()},children:e=>(()=>{var t=zt(),n=t.firstChild.nextSibling.firstChild,r=n.nextSibling;return t.$$click=()=>ae(e.id),Y(n,()=>e.label),Y(r,()=>e.text),t})()})),e}}),null),Y(J,()=>A(N()===1?`noteCountOne`:`noteCount`,{count:N()}),null),Y(pe,H(rt,{value:s,onInput:B,onSubmit:()=>void ie(),get placeholder(){return A(`talkPlaceholder`)},get submitLabel(){return A(`talkSubmitHint`)},get disabled(){return M()}})),me.$$click=()=>void ie(),Y(he,()=>A(`talkContinue`)),Y(e,H(Xe,{get headings(){return r().headings}}),null),Y(e,H(Ze,{}),null),b(()=>me.disabled=M()),e}})}fe([`click`,`input`,`keydown`]);var Ht=K(`<div class=page><p class=empty>`);function Ut(){let[e,t]=y(),[n,r]=y();return w(()=>{Se().then(e=>t(e)).catch(e=>r(e instanceof Error?e.message:String(e)))}),H(W,{get when(){return e()},get fallback(){return(()=>{var e=Ht(),t=e.firstChild;return Y(t,()=>n()??`Loading…`),e})()},children:e=>H(W,{get when(){return e().mode===`talk`},get fallback(){return H(wt,{get initial(){return e()}})},get children(){return H(Vt,{get initial(){return e()}})}})})}var Wt=document.getElementById(`root`);Wt&&de(()=>H(Ut,{}),Wt);
|
|
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=I,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(()=>z(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[k.bind(n),e=>(typeof e==`function`&&(e=f&&f.running&&f.sources.has(n)?e(n.tValue):e(n.value)),A(n,e))]}function b(e,t,n){j(N(e,t,!1,c))}function x(e,t,n){s=L;let r=N(e,t,!1,c),i=O&&ee(O);i&&(r.suspense=i),(!n||!n.render)&&(r.user=!0),h?h.push(r):j(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,j(r),k.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 ee(e){let t;return d&&d.context&&(t=d.context[e.id])!==void 0?t:e.defaultValue}var O;function k(){let e=f&&f.running;if(this.sources&&(e?this.tState:this.state)){if((e?this.tState:this.state)===c)j(this);else{let e=m;m=null,F(()=>R(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 A(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&&ne(n)),r?n.tState=c:n.state=c)}if(m.length>1e6)throw m=[],Error()},!1)}return t}function j(e){if(!e.fn)return;z(e);let t=g;M(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,M(e,e.tValue,t),p=d=null},!1)})}function M(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(z),e.tOwned=void 0):(e.state=c,e.owned&&e.owned.forEach(z),e.owned=null)),e.updatedAt=n+1,ae(t)}finally{p=a,d=i}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&`observers`in e?A(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 R(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)j(e);else if((t?e.tState:e.state)===l){let t=m;m=null,F(()=>R(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,ae(e)}}function te(e){if(m&&=(I(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)z(e);for(let t of e){if(t.value=t.tValue,t.owned)for(let e=0,n=t.owned.length;e<n;e++)z(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 I(e){for(let t=0;t<e.length;t++)P(e[t])}function L(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 R(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&&R(i,t)}}}function ne(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&&ne(r))}}function z(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--)z(e.tOwned[t]);delete e.tOwned}if(f&&f.running&&e.pure)B(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)z(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 B(e,t){if(t||(e.tState=0,f.disposed.add(e)),e.owned)for(let t=0;t<e.owned.length;t++)B(e.owned[t])}function re(e){return e instanceof Error?e:Error(typeof e==`string`?e:`Unknown error`,{cause:e})}function ie(e,t,n){try{for(let n of t)n(e)}catch(e){ae(e,n&&n.owner||null)}}function ae(e,t=d){let n=o&&t&&t.context&&t.context[o],r=re(e);if(!n)throw r;h?h.push({fn(){ie(r,n,t)},state:c}):ie(r,n,t)}var oe=Symbol(`fallback`);function V(e){for(let t=0;t<e.length;t++)e[t]()}function se(e,t,n={}){let r=[],a=[],o=[],s=0,c=t.length>1?[]:null;return T(()=>V(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&&(V(o),o=[],r=[],a=[],s=0,c&&=[]),n.fallback&&(r=[oe],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 H(e,t){return C(()=>e(t||{}))}var ce=e=>`Stale read from <${e}>.`;function U(e){let t=`fallback`in e&&{fallback:()=>e.fallback};return S(se(()=>e.each,e.children,t||void 0))}function W(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 ce(`Show`);return n()})):a}return e.fallback},void 0,void 0)}var G=e=>S(()=>e());function le(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 ue=`_$DX_DELEGATE`;function de(e,t,n,r={}){let i;return _(r=>{i=r,t===document?e():Y(t,e(),!n&&t.firstChild?null:void 0,n)},r.owner),()=>{i(),t.textContent=``}}function K(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 fe(e,t=window.document){let n=t[ue]||(t[ue]=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,X))}}function q(e,t,n){_e(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function J(e,t){_e(e)||(t==null?e.removeAttribute(`class`):e.className=t)}function pe(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 me(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]||(ve(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||(ve(e,i,!0),n[i]=o)}return n}function he(e,t,n){n==null?e.style.removeProperty(t):e.style.setProperty(t,n)}function ge(e,t,n){return C(()=>e(t,n))}function Y(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!=`function`)return Z(e,t,r,n);b(r=>Z(e,t(),r,n),r)}function _e(t){return!!e.context&&!e.done&&(!t||t.isConnected)}function ve(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 X(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 Z(e,t,n,r,i){let a=_e(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=Q(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=Q(e,n,r)}else if(o===`function`)return b(()=>{let i=t();for(;typeof i==`function`;)i=i();n=Z(e,i,n,r)}),()=>n;else if(Array.isArray(t)){let o=[],c=n&&Array.isArray(n);if(ye(o,t,n,i))return b(()=>n=Z(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=Q(e,n,r),s)return n}else c?n.length===0?be(e,o,r):le(e,n,o):(n&&Q(e),be(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=Q(e,n,r,t);Q(e,n,null,t)}else n==null||n===``||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}return n}function ye(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=ye(e,o,s)||i;else if(c===`function`){if(r){for(;typeof o==`function`;)o=o();i=ye(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 be(e,t,n=null){for(let r=0,i=t.length;r<i;r++)e.insertBefore(t[r],n)}function Q(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 xe=new URLSearchParams(window.location.search).get(`t`)??``;async function $(e,t={}){let n=await fetch(e,{...t,headers:{...t.body?{"content-type":`application/json`}:{},"x-plan-token":xe,...t.headers??{}}});if(!n.ok)throw Error(`${t.method??`GET`} ${e} → HTTP ${n.status}`);return await n.json()}function Se(e){return $(e===void 0?`/api/state`:`/api/state?version=${e}`)}function Ce(e,t){return $(`/api/notes`,{method:`POST`,body:JSON.stringify({notes:e,draft:t})})}function we(e,t){return $(`/api/continue`,{method:`POST`,body:JSON.stringify({notes:e,message:t})})}function Te(){let e=new AbortController,t=setTimeout(()=>e.abort(),3e3);return $(`/api/close`,{method:`POST`,signal:e.signal}).finally(()=>clearTimeout(t))}function Ee(e,t){return $(`/api/annotate`,{method:`POST`,body:JSON.stringify({version:e,annotations:t})})}function De(e,t){return $(`/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(xe)}`);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.`,closePage:`Close`,closePageHint:`Close this page without sending anything to the agent`,closePageConfirm:`Close this page and stop its review server? Nothing will be sent to the agent.`,closePageDone:`Page closed`,closePageServerClosed:`The review server is closed. Nothing was sent to the agent.`,closePageUnreachable:`The review server could not be reached. Nothing was sent to the agent.`,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`,talkUntitled:`Untitled session`,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:`现在可以关闭这个标签页了。`,closePage:`关闭`,closePageHint:`关闭此页面,不向 agent 发送任何信息`,closePageConfirm:`关闭此页面并停止它的评审服务吗?不会向 agent 发送任何信息。`,closePageDone:`页面已关闭`,closePageServerClosed:`评审服务已关闭,没有向 agent 发送任何信息。`,closePageUnreachable:`无法连接评审服务;没有向 agent 发送任何信息。`,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:`回复批注`,talkUntitled:`未命名会话`,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=K(`<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=K(`<span class=outline-bar>`),Re=K(`<button type=button class=outline-row><span class=outline-text>`),ze=K(`<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`),Be=K(`<button type=button class="ghost close-page">`),Ve=K(`<div class="page page-closed"><main class=manual-close-notice role=status><div class=done><div class=done-title></div><div class=done-hint></div><div class=done-hint>`),He=K(`<textarea class=composer-input rows=1>`);function Ue(e,t){let n=[...new Set(t)].sort((e,t)=>e-t).indexOf(e);return n<0?0:Math.min(n,3)}var We=[16,13,10,8],Ge=24,Ke=14;function qe(e,t,n=Ge){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 Je=140;function Ye(){return window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`}function Xe(e){let[t,n]=y(!1),[r,i]=y(),a,o,s,c,l,u,d=S(()=>e.headings.map(e=>e.level)),f=S(()=>qe(e.headings,r())),p=e=>Ue(e,d());function m(){a!==void 0&&clearTimeout(a),n(!0)}function h(){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<=Je)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`)}),x(()=>{let e=r(),t=l;if(!t||e===void 0)return;let n=f().findIndex(t=>t.blockId===e),i=t.children[n];if(!i)return;let a=t.getBoundingClientRect(),o=i.getBoundingClientRect();o.top<a.top?t.scrollTop-=a.top-o.top:o.bottom>a.bottom&&(t.scrollTop+=o.bottom-a.bottom)}),x(()=>{if(!t())return;let n=u,i=r();if(!n||i===void 0)return;let a=e.headings.findIndex(e=>e.blockId===i),o=a>=0?n.children[a]:void 0;if(!o)return;let s=n.getBoundingClientRect(),c=o.getBoundingClientRect(),l=getComputedStyle(n),d=s.top+Number.parseFloat(l.paddingTop)+Ke,f=s.bottom-Number.parseFloat(l.paddingBottom)-Ke;c.top<d?n.scrollTop-=d-c.top:c.bottom>f&&(n.scrollTop+=c.bottom-f)});function g(t){e.onJump?.(t),requestAnimationFrame(()=>{let e=document.getElementById(`block-${t}`);e&&(e.scrollIntoView({behavior:Ye(),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 H(W,{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,d=o.nextSibling;return n.addEventListener(`mouseleave`,h),n.addEventListener(`mouseenter`,m),ge(e=>l=e,i),Y(i,H(U,{get each(){return f()},children:e=>(()=>{var t=Le();return b(n=>{var i=e.blockId===r(),a=`${We[p(e.level)]}px`;return i!==n.e&&t.classList.toggle(`is-active`,n.e=i),a!==n.t&&he(t,`width`,n.t=a),n},{e:void 0,t:void 0}),t})()})),Y(s,()=>e.headings.length,c),Y(s,()=>e.headings.length===1?`heading`:`headings`,null),ge(e=>u=e,d),Y(d,H(U,{get each(){return e.headings},children:e=>(()=>{var n=Re(),i=n.firstChild;return n.$$click=()=>g(e.blockId),Y(i,()=>e.text),b(i=>{var a=e.blockId===r(),o=`${10+p(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&&he(n,`padding-left`,i.t=o),s!==i.a&&q(n,`tabindex`,i.a=s),c!==i.o&&q(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&&q(i,`aria-hidden`,e.t=o),s!==e.a&&q(a,`aria-hidden`,e.a=s),e},{e:void 0,t:void 0,a:void 0}),n}})}function Ze(){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)})}),H(W,{get when(){return e()},get children(){var e=ze();return e.$$click=()=>{window.scrollTo({top:0,behavior:Ye()})},e}})}function Qe(){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())})}function $e(e){let[t,n]=y(!1),r=t=>Fe(e.lang,t);async function i(){let t=!1;try{await Te(),t=!0}catch{}e.onClosed(t),window.close()}return(()=>{var e=Be();return e.$$click=()=>{t()||!window.confirm(r(`closePageConfirm`))||(n(!0),i())},Y(e,()=>r(`closePage`)),b(n=>{var i=t(),a=r(`closePageHint`);return i!==n.e&&(e.disabled=n.e=i),a!==n.t&&q(e,`title`,n.t=a),n},{e:void 0,t:void 0}),e})()}function et(e){let t=t=>Fe(e.lang,t);return(()=>{var n=Ve(),r=n.firstChild.firstChild.firstChild,i=r.nextSibling,a=i.nextSibling;return Y(r,()=>t(`closePageDone`)),Y(i,(()=>{var n=G(()=>!!e.serverClosed);return()=>n()?t(`closePageServerClosed`):t(`closePageUnreachable`)})()),Y(a,()=>t(`closeHint`)),n})()}var tt=220;function nt(e){let t=getComputedStyle(e),n=e=>Number.parseFloat(e)||0,r=Number.parseFloat(t.lineHeight),i=Number.parseFloat(t.fontSize),a=Number.isFinite(r)?r:i*1.5,o=n(t.borderTopWidth)+n(t.borderBottomWidth);return{oneLine:a+(n(t.paddingTop)+n(t.paddingBottom))+o,border:o}}function rt(e){let t,n=e=>{if(!t)return;let{oneLine:n,border:r}=nt(t),i=Math.min(window.innerHeight*.4,tt);t.style.height=`auto`;let a=t.scrollHeight+r,o=e?Math.min(a,i):n;t.style.height=`${Math.max(o,n)}px`,t.style.overflowY=e&&a>i?`auto`:`hidden`};return w(()=>n(document.activeElement===t)),(()=>{var r=He();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)),ge(e=>{t=e},r),b(t=>{var n=e.placeholder,i=e.disabled,a=e.placeholder,o=e.submitLabel;return n!==t.e&&q(r,`placeholder`,t.e=n),i!==t.t&&(r.disabled=t.t=i),a!==t.a&&q(r,`aria-label`,t.a=a),o!==t.o&&q(r,`title`,t.o=o),t},{e:void 0,t:void 0,a:void 0,o:void 0}),b(()=>r.value=e.value()),r})()}fe([`click`,`input`,`keydown`]);var it=K(`<span class=readonly>`),at=K(`<div class=error>`),ot=K(`<div class=banner><span></span><button class=link>`),st=K(`<div class=done><div class=done-title></div><div class=done-hint>`),ct=K(`<button class=add>+ `),lt=K(`<section id=global-notes class=global-card><div class=global-head><span class=eyebrow></span><span class=global-count>`),ut=K(`<p class=empty>`),dt=K(`<div class=collapsed><span></span><button class=link>`),ft=K(`<div class=rail-notes>`),pt=K(`<button class=ghost>`),mt=K(`<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">`),ht=K(`<span class=chip-changed>+`),gt=K(`<button class=chip><span class=chip-n>v`),_t=K(`<button class=remove>`),vt=K(`<div><span></span><span class=note-text>`),yt=K(`<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>`),bt=K(`<p class=rail-empty>`),xt=K(`<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>`),St=K(`<div class=editor><div class=verdicts></div><textarea></textarea><div class=editor-actions><button class=ghost></button><button class=primary>`),Ct=K(`<label><input type=radio name=verdict>`),wt=[`suggest`,`change`,`question`],Tt=wt[0];function Et(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(Tt),[C,E]=y(!1),[D,ee]=y(),O,k=(e,n)=>Fe(t(),e,n);Qe();async function A(e){try{let t=await Se(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(()=>{O=ke({onRevision:()=>{a()===void 0&&A()},onAnnotations:()=>{a()===void 0&&A()},onDecided:e=>u(e.action)}),T(()=>{O?.(),O=void 0})}),x(()=>{let e=r()?.slug;document.title=e?`${k(`title`)} — ${e}`:k(`title`)});let j=S(()=>r()?.items??[]),M=e=>e.status??`unchanged`,N=S(()=>j().filter(e=>M(e)!==`unchanged`).length),P=S(()=>!d()&&N()>0),F=S(()=>P()?j().filter(e=>M(e)===`unchanged`).length:0),te=S(()=>P()?j().filter(e=>M(e)!==`unchanged`):j()),I=S(()=>r()?.history[0]?.n??r()?.version),L=S(()=>{let e=r();return e!==void 0&&e.version!==I()}),R=S(()=>{let e={unchanged:0,moved:0,modified:0,added:0,removed:0};for(let t of j())e[M(t)]+=1;return e}),ne=S(()=>[...r()?.history??[]].reverse()),z=S(()=>r()?.annotations.global??[]),B=S(()=>p()!==void 0&&p().blockId===void 0),re=S(()=>z().length>0||B()),ie=e=>r()?.annotations.blocks.find(t=>t.blockId===e)?.annotations??[],ae=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}),oe=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:k(`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 V(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 A(t.version)}}async function se(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 V(a)}async function ce(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 V(i)}function le(){!L()&&!B()&&(m({blockId:void 0}),g(``),v(Tt)),requestAnimationFrame(()=>{document.getElementById(`global-notes`)?.scrollIntoView({behavior:`smooth`,block:`start`})})}function ue(){if(!L()){if(B()){m(void 0);return}le()}}function de(e){te().some(t=>t.id===e)||f(!0)}function K(e){let t=e.blockId;te().some(e=>e.id===t)||f(!0),requestAnimationFrame(()=>{document.getElementById(`block-${t}`)?.scrollIntoView({behavior:`smooth`,block:`center`})})}function fe(e){O?.(),O=void 0,ee(e)}async function pe(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 he=e=>`badge badge-${e}`,ge=e=>`verdict${e[0].toUpperCase()}${e.slice(1)}`,_e=e=>`note-verdict verdict-${e}`;return H(W,{get when(){return D()===void 0},get fallback(){return H(et,{get lang(){return t()},get serverClosed(){return D()===!0}})},get children(){var e=mt(),i=e.firstChild,c=i.firstChild,u=c.firstChild,y=u.firstChild.nextSibling,x=u.nextSibling,S=x.firstChild,w=c.nextSibling,T=w.firstChild,E=T.nextSibling,D=E.firstChild,ee=D.nextSibling.nextSibling,O=ee.nextSibling.nextSibling,P=w.nextSibling,V=P.firstChild,le=V.nextSibling,ve=i.nextSibling,X=ve.firstChild,Z=X.firstChild,ye=X.nextSibling.firstChild,be=ye.firstChild,Q=be.nextSibling,xe=Q.firstChild,$=xe.nextSibling.firstChild,Se=$.nextSibling,Ce=Q.nextSibling.firstChild,we=Ce.firstChild.nextSibling,Te=we.nextSibling,Ee=Ce.nextSibling,De=Ee.firstChild.nextSibling,Oe=De.nextSibling,ke=Ee.nextSibling,Ae=ke.firstChild.nextSibling,je=Ae.nextSibling,Me=ke.nextSibling.firstChild.nextSibling,Pe=Me.nextSibling,Fe=ye.nextSibling,Ie=Fe.firstChild.firstChild,Le=Ie.nextSibling,Re=ve.nextSibling.firstChild,ze=Re.firstChild,Be=ze.firstChild,Ve=Be.nextSibling;Ve.nextSibling;var He=Re.nextSibling,Ue=He.firstChild;Ue.firstChild;var We=He.nextSibling.firstChild,Ge=We.nextSibling,Ke=Ge.firstChild;return Y(y,()=>k(`title`)),S.$$click=()=>{let e=t()===`en`?`zh`:`en`;n(e),Ne(e)},Y(S,()=>t()===`en`?`中文`:`EN`),Y(x,H($e,{get lang(){return t()},onClosed:fe}),null),Y(T,()=>r()?.slug??`spec`),Y(D,()=>r()?.source??`specs/spec.md`),Y(ee,()=>k(`version`,{version:r()?.version??0,total:r()?.totalVersions??0})),Y(O,(()=>{var e=G(()=>N()>0);return()=>e()?k(N()===1?`changedOne`:`changed`,{count:N()}):k(`noChange`)})()),Y(E,H(W,{get when(){return L()},get children(){var e=it();return Y(e,()=>k(`readOnly`)),e}}),null),Y(V,()=>k(`history`)),Y(P,H(U,{get each(){return ne()},children:e=>(()=>{var t=gt(),n=t.firstChild;return n.firstChild,t.$$click=()=>{e.n===I()?(o(void 0),A()):(o(e.n),A(e.n))},Y(n,()=>e.n,null),Y(t,H(W,{get when(){return e.changed>0},get children(){var t=ht();return t.firstChild,Y(t,()=>e.changed,null),t}}),null),b(()=>t.classList.toggle(`active`,e.n===r()?.version)),t})()}),le),Y(le,()=>k(j().length===1?`historySummaryOne`:`historySummary`,{count:j().length})),Y(e,H(W,{get when(){return s()},get children(){var e=at();return Y(e,()=>k(`error`,{message:s()??``})),e}}),ve),Y(X,H(W,{get when(){return L()},get children(){var e=ot(),t=e.firstChild,n=t.nextSibling;return Y(t,()=>k(`viewingOld`,{v:a()??r()?.version??0})),n.$$click=()=>{o(void 0),A()},Y(n,()=>k(`back`)),e}}),Z),Y(X,H(W,{get when(){return l()},get children(){var e=st(),t=e.firstChild,n=t.nextSibling;return Y(t,(()=>{var e=G(()=>l()===`approve`);return()=>e()?k(`approved`):k(`denied`)})()),Y(n,(()=>{var e=G(()=>!!C());return()=>e()?k(`closeHint`):k(`closing`)})()),e}}),Z),Y(X,H(W,{get when(){return re()},get children(){var e=lt(),t=e.firstChild,n=t.firstChild,r=n.nextSibling;return Y(n,()=>k(`globalNotesTitle`)),Y(r,()=>z().length),Y(t,H(W,{get when(){return G(()=>!L())()&&!B()},get children(){var e=ct();return e.firstChild,e.$$click=()=>{m({blockId:void 0}),g(``),v(Tt)},Y(e,()=>k(`addNote`),null),e}}),null),Y(e,H(U,{get each(){return z()},children:(e,t)=>(()=>{var n=vt(),r=n.firstChild,i=r.nextSibling;return Y(r,()=>k(ge(e.verdict))),Y(i,()=>e.comment),Y(n,H(W,{get when(){return!L()},get children(){var e=_t();return e.$$click=()=>void ce(void 0,t()),Y(e,()=>k(`remove`)),e}}),null),b(t=>{var i=`note note-${e.verdict}`,a=_e(e.verdict);return i!==t.e&&J(n,t.e=i),a!==t.t&&J(r,t.t=a),t},{e:void 0,t:void 0}),n})()}),null),Y(e,H(W,{get when(){return G(()=>!!B())()&&!L()},get children(){return H(Dt,{draft:h,setDraft:g,verdict:_,setVerdict:v,onSave:()=>void se(void 0),onCancel:()=>m(void 0),t:k})}}),null),e}}),Z),Y(X,H(W,{get when(){return G(()=>!!r())()&&r().items.length===0},get children(){var e=ut();return Y(e,()=>k(`emptySpec`)),e}}),Z),Y(X,H(W,{get when(){return F()>0},get children(){var e=dt(),t=e.firstChild,n=t.nextSibling;return Y(t,()=>k(F()===1?`unchangedHiddenOne`:`unchangedHidden`,{count:F()})),n.$$click=()=>f(!0),Y(n,()=>k(`showAll`)),e}}),Z),Y(Z,H(U,{get each(){return te()},children:e=>(()=>{var t=yt(),n=t.firstChild,r=n.nextSibling,i=r.firstChild,a=i.firstChild,o=a.firstChild,s=a.nextSibling,c=i.nextSibling;return Y(a,()=>k(`status_${M(e)}`),null),Y(s,()=>e.id),Y(i,H(W,{get when(){return!L()},get children(){var t=ct();return t.firstChild,t.$$click=()=>{m({blockId:e.id}),g(``),v(Tt)},Y(t,()=>k(`addNote`),null),t}}),null),Y(r,H(U,{get each(){return ie(e.id)},children:(t,n)=>(()=>{var r=vt(),i=r.firstChild,a=i.nextSibling;return Y(i,()=>k(ge(t.verdict))),Y(a,()=>t.comment),Y(r,H(W,{get when(){return!L()},get children(){var t=_t();return t.$$click=()=>void ce(e.id,n()),Y(t,()=>k(`remove`)),t}}),null),b(e=>{var n=`note note-${t.verdict}`,a=_e(t.verdict);return n!==e.e&&J(r,e.e=n),a!==e.t&&J(i,e.t=a),e},{e:void 0,t:void 0}),r})()}),null),Y(r,H(W,{get when(){return G(()=>p()?.blockId===e.id)()&&!L()},get children(){return H(Dt,{draft:h,setDraft:g,verdict:_,setVerdict:v,onSave:()=>void se(e.id),onCancel:()=>m(void 0),t:k})}}),null),b(r=>{var i=`block-${e.id}`,s={[`is-`+M(e)]:!0},l=`block-bar bar-${M(e)}`,u=he(M(e)),d=`dot dot-${M(e)}`,f=e.html;return i!==r.e&&q(t,`id`,r.e=i),r.t=me(t,s,r.t),l!==r.a&&J(n,r.a=l),u!==r.o&&J(a,r.o=u),d!==r.i&&J(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})()})),Y(be,()=>k(`thisRevision`)),Y(xe,N),Y($,()=>k(`blocksChanged`)),Y(Se,()=>k(`ofTotal`,{total:j().length})),Y(we,()=>k(`status_added`)),Y(Te,()=>R().added),Y(De,()=>k(`status_modified`)),Y(Oe,()=>R().modified),Y(Ae,()=>k(`status_moved`)),Y(je,()=>R().moved),Y(Me,()=>k(`status_removed`)),Y(Pe,()=>R().removed),Y(Ie,()=>k(`annotations`)),Y(Le,ae),Y(Fe,H(W,{get when(){return oe().length>0},get fallback(){return(()=>{var e=bt();return Y(e,()=>k(`noNotesYet`)),e})()},get children(){var e=ft();return Y(e,H(U,{get each(){return oe()},children:e=>(()=>{var t=xt(),n=t.firstChild,r=n.nextSibling.firstChild,i=r.nextSibling;return t.$$click=()=>K(e),Y(r,()=>e.label),Y(i,()=>e.annotation.comment),b(()=>J(n,`dot dot-${e.annotation.verdict}`)),t})()})),e}}),null),Y(Re,H(W,{get when(){return N()>0},get children(){var e=pt();return e.$$click=()=>f(!d()),Y(e,(()=>{var e=G(()=>!!d());return()=>e()?k(`onlyChanged`):k(`showAll`)})()),e}}),ze),ze.$$click=ue,Y(ze,()=>k(`globalNotes`),Be),Y(ze,()=>z().length,Ve),Y(Ue,()=>k(ae()===1?`noteCountOne`:`noteCount`,{count:ae()}),null),We.$$click=()=>void pe(`deny`),Y(We,()=>k(`deny`)),Ge.$$click=()=>void pe(`approve`),Y(Ke,()=>k(`approve`)),Y(e,H(Xe,{get headings(){return r()?.headings??[]},onJump:de}),null),Y(e,H(Ze,{}),null),b(e=>{var t=L(),n=L()||l()!==void 0,r=L()||l()!==void 0;return t!==e.e&&(ze.disabled=e.e=t),n!==e.t&&(We.disabled=e.t=n),r!==e.a&&(Ge.disabled=e.a=r),e},{e:void 0,t:void 0,a:void 0}),e}})}function Dt(e){return(()=>{var t=St(),n=t.firstChild,r=n.nextSibling,i=r.nextSibling.firstChild,a=i.nextSibling;return Y(n,H(U,{each:wt,children:t=>(()=>{var n=Ct(),r=n.firstChild;return r.addEventListener(`change`,()=>e.setVerdict(t)),Y(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),pe(i,`click`,e.onCancel,!0),Y(i,()=>e.t(`cancel`)),pe(a,`click`,e.onSave,!0),Y(a,()=>e.t(`save`)),b(t=>{var n=e.t(`notePlaceholder`),i=e.draft().trim()===``;return n!==t.e&&q(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})()}fe([`click`,`input`]);var Ot=K(`<span class=readonly>`),kt=K(`<div class=error>`),At=K(`<div class=done><div class=done-title></div><div class=done-hint>`),jt=K(`<p class=empty>`),Mt=K(`<div class=rail-notes>`),Nt=K(`<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">`),Pt=K(`<button type=button class=add>`),Ft=K(`<div class=block-head><span class=block-id>`),It=K(`<button type=button class=remove>`),Lt=K(`<div class="note note-talk"><span class="note-verdict verdict-talk"></span><span class=note-text>`),Rt=K(`<div class=editor><textarea class=note-input></textarea><div class=editor-actions><button type=button class=ghost></button><button type=button class=primary>`),zt=K(`<article class="block block-talk"><div class="block-bar bar-talk"aria-hidden=true></div><div class=block-inner><div class=block-body>`),Bt=K(`<p class=rail-empty>`),Vt=K(`<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>`),Ht=300;function Ut(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,ee]=y(),O,k,A=(e,n)=>Fe(t(),e,n);Qe();let j=S(()=>r().items),M=S(()=>l()||d()),N=S(()=>Object.values(a()).filter(e=>e.trim()!==``).length),P=S(()=>j().map(e=>({id:e.id,label:e.label,text:a()[e.id]??``})).filter(e=>e.text.trim()!==``)),F=S(()=>{let e=r().reply.at,t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}),te=S(()=>{let e=r().title?.trim();return e!==void 0&&e!==``?e:A(`talkUntitled`)});async function I(){k!==void 0&&(clearTimeout(k),k=void 0);try{let e=await Se();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(()=>{O=ke({onRevision:()=>void I(),onAnnotations:()=>void I(),onDecided:()=>void 0,onRefresh:()=>void I(),onSent:()=>u(!0)}),T(()=>{O?.(),O=void 0,k!==void 0&&clearTimeout(k)})}),x(()=>{document.title=te()});function L(e){O?.(),O=void 0,k!==void 0&&(clearTimeout(k),k=void 0),ee(e)}function R(e,t){k!==void 0&&clearTimeout(k),k=setTimeout(()=>{k=void 0,Ce(e,t).catch(e=>{l()||v(e instanceof Error?e.message:String(e))})},Ht)}function ne(e,t){let n={...a()};t.trim()===``?delete n[e]:n[e]=t,o(n),R(n,s())}function z(e){let t={...a()};delete t[e],o(t),p()===e&&m(void 0),R(t,s())}function B(e){c(e),R(a(),e)}function re(){let e={...a()},t=p();return t!==void 0&&(h().trim()===``?delete e[t]:e[t]=h()),e}async function ie(){if(M())return;let e=re();if(!Object.values(e).some(e=>e.trim()!==``)&&s().trim()===``){v(A(`talkNothingToSend`));return}o(e),k!==void 0&&(clearTimeout(k),k=void 0),f(!0);try{await we(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 ae(e){requestAnimationFrame(()=>{document.getElementById(`block-${e}`)?.scrollIntoView({behavior:Ye(),block:`center`})})}return H(W,{get when(){return D()===void 0},get fallback(){return H(et,{get lang(){return t()},get serverClosed(){return D()===!0}})},get children(){var e=Nt(),i=e.firstChild,o=i.firstChild,c=o.firstChild,u=c.firstChild.nextSibling,d=c.nextSibling,f=d.firstChild,v=o.nextSibling.firstChild,y=v.nextSibling,x=y.firstChild,S=x.nextSibling.nextSibling,w=S.nextSibling.nextSibling,T=i.nextSibling,E=T.firstChild,D=E.firstChild,ee=E.nextSibling.firstChild,O=ee.firstChild,k=O.nextSibling,I=k.nextSibling.firstChild,R=I.firstChild,re=R.nextSibling,oe=I.nextSibling,V=oe.firstChild,se=V.nextSibling,ce=oe.nextSibling.firstChild,le=ce.nextSibling,ue=ee.nextSibling,de=ue.firstChild.firstChild,K=de.nextSibling,fe=T.nextSibling.firstChild,J=fe.firstChild;J.firstChild;var pe=fe.nextSibling,me=pe.nextSibling.firstChild,he=me.firstChild;return Y(u,()=>A(`talkTitle`)),f.$$click=()=>{let e=t()===`en`?`zh`:`en`;n(e),Ne(e)},Y(f,()=>t()===`en`?`中文`:`EN`),Y(d,H($e,{get lang(){return t()},onClosed:L}),null),Y(v,te),Y(x,F),Y(S,()=>r().reply.model??`—`),Y(w,()=>A(j().length===1?`talkBlocksOne`:`talkBlocks`,{count:j().length})),Y(y,H(W,{get when(){return l()},get children(){var e=Ot();return Y(e,()=>A(`talkSentBadge`)),e}}),null),Y(e,H(W,{get when(){return _()},get children(){var e=kt();return Y(e,()=>A(`error`,{message:_()??``})),e}}),T),Y(E,H(W,{get when(){return l()},get children(){var e=At(),t=e.firstChild,n=t.nextSibling;return Y(t,()=>A(`talkSentTitle`)),Y(n,(()=>{var e=G(()=>!!C());return()=>e()?A(`closeHint`):A(`closing`)})()),e}}),D),Y(E,H(W,{get when(){return j().length===0},get children(){var e=jt();return Y(e,()=>A(`emptySpec`)),e}}),D),Y(D,H(U,{get each(){return j()},children:e=>(()=>{var t=zt(),n=t.firstChild.nextSibling,r=n.firstChild;return Y(n,H(W,{get when(){return e.kind!==`heading`},get children(){var t=Ft(),n=t.firstChild;return Y(n,()=>e.id),Y(t,H(W,{get when(){return!M()},get children(){var t=Pt();return t.$$click=()=>{if(p()===e.id){m(void 0);return}m(e.id),g(a()[e.id]??``)},Y(t,(()=>{var t=G(()=>!!a()[e.id]);return()=>t()?A(`editNote`):`+ ${A(`addNote`)}`})()),t}}),null),t}}),r),Y(n,H(W,{get when(){return a()[e.id]},get children(){var t=Lt(),n=t.firstChild,r=n.nextSibling;return Y(n,()=>A(`yourNote`)),Y(r,()=>a()[e.id]),Y(t,H(W,{get when(){return!M()},get children(){var t=It();return t.$$click=()=>z(e.id),Y(t,()=>A(`remove`)),t}}),null),t}}),null),Y(n,H(W,{get when(){return G(()=>p()===e.id)()&&!M()},get children(){var t=Rt(),n=t.firstChild,r=n.nextSibling.firstChild,i=r.nextSibling;return n.$$keydown=t=>{(t.metaKey||t.ctrlKey)&&t.key===`Enter`&&(t.preventDefault(),ne(e.id,h()),m(void 0))},n.$$input=e=>g(e.currentTarget.value),r.$$click=()=>m(void 0),Y(r,()=>A(`cancel`)),i.$$click=()=>{ne(e.id,h()),m(void 0)},Y(i,()=>A(`save`)),b(e=>{var t=A(`talkNotePlaceholder`),r=h().trim()===``;return t!==e.e&&q(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&&q(t,`id`,n.e=i),a!==n.t&&(r.innerHTML=n.t=a),n},{e:void 0,t:void 0}),t})()})),Y(O,()=>A(`talkAbout`)),Y(k,()=>A(`talkAboutBody`)),Y(R,()=>A(`talkBlocksLabel`)),Y(re,()=>j().length),Y(V,()=>A(`annotations`)),Y(se,N),Y(ce,()=>A(`talkChars`)),Y(le,()=>r().reply.chars),Y(de,()=>A(`annotations`)),Y(K,N),Y(ue,H(W,{get when(){return P().length>0},get fallback(){return(()=>{var e=Bt();return Y(e,()=>A(`noNotesYet`)),e})()},get children(){var e=Mt();return Y(e,H(U,{get each(){return P()},children:e=>(()=>{var t=Vt(),n=t.firstChild.nextSibling.firstChild,r=n.nextSibling;return t.$$click=()=>ae(e.id),Y(n,()=>e.label),Y(r,()=>e.text),t})()})),e}}),null),Y(J,()=>A(N()===1?`noteCountOne`:`noteCount`,{count:N()}),null),Y(pe,H(rt,{value:s,onInput:B,onSubmit:()=>void ie(),get placeholder(){return A(`talkPlaceholder`)},get submitLabel(){return A(`talkSubmitHint`)},get disabled(){return M()}})),me.$$click=()=>void ie(),Y(he,()=>A(`talkContinue`)),Y(e,H(Xe,{get headings(){return r().headings}}),null),Y(e,H(Ze,{}),null),b(()=>me.disabled=M()),e}})}fe([`click`,`input`,`keydown`]);var Wt=K(`<div class=page><p class=empty>`);function Gt(){let[e,t]=y(),[n,r]=y();return w(()=>{Se().then(e=>t(e)).catch(e=>r(e instanceof Error?e.message:String(e)))}),H(W,{get when(){return e()},get fallback(){return(()=>{var e=Wt(),t=e.firstChild;return Y(t,()=>n()??`Loading…`),e})()},children:e=>H(W,{get when(){return e().mode===`talk`},get fallback(){return H(Et,{get initial(){return e()}})},get children(){return H(Ut,{get initial(){return e()}})}})})}var Kt=document.getElementById(`root`);Kt&&de(()=>H(Gt,{}),Kt);
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<meta name="robots" content="noindex" />
|
|
7
7
|
<title>Spec review</title>
|
|
8
|
-
<script type="module" crossorigin src="/index-
|
|
8
|
+
<script type="module" crossorigin src="/index-DIRz72Vd.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/index-CvBI723K.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
@@ -16,7 +16,7 @@ import type { GateHub, GateVerdict } from "../../lib/gates.js";
|
|
|
16
16
|
import { setPermissionControl, type PermissionControl } from "../../lib/permission-control.js";
|
|
17
17
|
import { setAskControl } from "../../lib/ask-control.js";
|
|
18
18
|
import { LEGACY_SPEC_PHASE_TOOL } from "../../lib/phases.js";
|
|
19
|
-
import { registerSpec, SPEC_COMMAND,
|
|
19
|
+
import { registerSpec, SPEC_COMMAND, SPEC_SUBMIT_TOOL } from "./index.js";
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Distinct port per server, never reused inside this file.
|
|
@@ -212,19 +212,10 @@ describe("ask-spec command", () => {
|
|
|
212
212
|
expect(h.notify).toHaveBeenCalledWith(expect.stringContaining("specs/ask-spec-work.md"), "info");
|
|
213
213
|
});
|
|
214
214
|
|
|
215
|
-
it("
|
|
215
|
+
it("registers only /ask-spec — the /ask-plan alias is gone", () => {
|
|
216
216
|
const h = harness();
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
expect(primary).toBeDefined();
|
|
220
|
-
expect(alias).toBeDefined();
|
|
221
|
-
expect(alias!.handler).toBe(primary!.handler);
|
|
222
|
-
});
|
|
223
|
-
|
|
224
|
-
it("runs the same flow through the alias", async () => {
|
|
225
|
-
const h = harness();
|
|
226
|
-
await h.commands.get(SPEC_COMMAND_ALIAS)!.handler("legacy topic", h.ctx);
|
|
227
|
-
expect(h.sendUserMessage).toHaveBeenCalledWith(expect.stringContaining("Task: legacy topic"));
|
|
217
|
+
expect(h.commands.get(SPEC_COMMAND)).toBeDefined();
|
|
218
|
+
expect(h.commands.has("ask-plan")).toBe(false);
|
|
228
219
|
});
|
|
229
220
|
|
|
230
221
|
it("defaults the spec file to specs/spec.md without a topic", async () => {
|
|
@@ -46,7 +46,6 @@ import {
|
|
|
46
46
|
} from "./store.js";
|
|
47
47
|
|
|
48
48
|
export const SPEC_COMMAND = "ask-spec";
|
|
49
|
-
export const SPEC_COMMAND_ALIAS = "ask-plan";
|
|
50
49
|
export const SPEC_SUBMIT_TOOL = SPEC_PHASE_TOOL;
|
|
51
50
|
|
|
52
51
|
/** Files the spec-review phase may write: project markdown, nothing else. */
|
|
@@ -342,11 +341,11 @@ export function registerSpec(pi: ExtensionAPI, gates: GateHub, options: SpecOpti
|
|
|
342
341
|
},
|
|
343
342
|
};
|
|
344
343
|
|
|
345
|
-
// `/ask-plan`
|
|
346
|
-
//
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
344
|
+
// One name only. The pre-rename `/ask-plan` alias was removed 2026-11-27
|
|
345
|
+
// (it had been undocumented since the rename; autostart entries still
|
|
346
|
+
// spelled that way are skipped by the pre-flight and reported, so they are
|
|
347
|
+
// not sent to the model as chat).
|
|
348
|
+
pi.registerCommand(SPEC_COMMAND, specCommand);
|
|
350
349
|
|
|
351
350
|
// ── Tool ───────────────────────────────────────────────────────────────
|
|
352
351
|
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - ask — read-only Q&A mode (/ask)
|
|
9
9
|
* - favorites — model favorites (ctrl+A/ctrl+J in /model, favorites-only cycling)
|
|
10
10
|
* - stash — prompt stash (ctrl+alt+y swap / double-press stash-and-clear)
|
|
11
|
-
* - review — third-party code review with a configured review model (/ask-review
|
|
11
|
+
* - review — third-party code review with a configured review model (/ask-review)
|
|
12
12
|
* - compact — dedicated compact model for /compact + auto-compact summaries
|
|
13
13
|
* - autostart — replay project-declared slash commands at session start (/add-dir persistence)
|
|
14
14
|
* - permission — session-scoped boundary permission checks (/ask-perm)
|