mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-17 04:45:33 -08:00
Render Markdown live in every console answer box
AI Assisted
This commit is contained in:
1 parent
c26759fd88
commit
2acfd8907d
21 files changed
+598
-177
No files matched your search
@@ -177,3 +177,21 @@ export async function stylesOf(locator, props) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
export const styleOf = async (locator, prop) => (await stylesOf(locator, [prop]))[prop];
|
export const styleOf = async (locator, prop) => (await stylesOf(locator, [prop]))[prop];
|
||||||
|
|
||||||
|
// Fills an answer box on the page, whether it is a plain input or a Markdown
|
||||||
|
// field (.md-host). fill() cannot reach the editor inside the field's shadow
|
||||||
|
// root, so the field is driven through its facade: the same "input" path a
|
||||||
|
// keystroke takes (drafts, staging, counters) runs off the assignment.
|
||||||
|
export async function fillBox(locator, text) {
|
||||||
|
const box = locator.first();
|
||||||
|
const isField = await box.evaluate((n) => Boolean(n.field)).catch(() => false);
|
||||||
|
if (!isField) return box.fill(text);
|
||||||
|
await box.evaluate((n, t) => {
|
||||||
|
n.field.value = t;
|
||||||
|
n.field.emitInput();
|
||||||
|
}, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
// The text a box holds: a Markdown field through its facade, a real input
|
||||||
|
// through its value.
|
||||||
|
export const boxValue = (locator) => locator.first().evaluate((n) => (n.field ? n.field.value : n.value));
|
||||||
@@ -22,7 +22,7 @@ import fs from "node:fs";
|
|||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import test from "node:test";
|
import test from "node:test";
|
||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { pageSuite, openSession, drawn, itemCard } from "./page-test-helpers.mjs";
|
import { pageSuite, openSession, drawn, itemCard , boxValue} from "./page-test-helpers.mjs";
|
||||||
import { until, HOME } from "./web-console-test-helpers.mjs";
|
import { until, HOME } from "./web-console-test-helpers.mjs";
|
||||||
|
|
||||||
const suite = pageSuite(test);
|
const suite = pageSuite(test);
|
||||||
@@ -783,7 +783,7 @@ test("the die works on a skill screen and on a finished screen", async (t) => {
|
|||||||
|
|
||||||
test("arrows and space with the window open neither scroll the page nor reach the answer box behind it", async (t) => {
|
test("arrows and space with the window open neither scroll the page nor reach the answer box behind it", async (t) => {
|
||||||
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
||||||
const box = itemCard(s.page, "q1").locator("textarea, input[type=text]").first();
|
const box = itemCard(s.page, "q1").locator(".md-host, input[type=text]").first();
|
||||||
await box.click();
|
await box.click();
|
||||||
await s.page.evaluate(() => {
|
await s.page.evaluate(() => {
|
||||||
window.__leaked = 0;
|
window.__leaked = 0;
|
||||||
@@ -796,7 +796,7 @@ test("arrows and space with the window open neither scroll the page nor reach th
|
|||||||
}
|
}
|
||||||
const after = await s.page.evaluate(() => ({ y: scrollY, main: document.getElementById("main").scrollTop }));
|
const after = await s.page.evaluate(() => ({ y: scrollY, main: document.getElementById("main").scrollTop }));
|
||||||
assert.deepEqual(after, before, "nothing scrolled");
|
assert.deepEqual(after, before, "nothing scrolled");
|
||||||
assert.equal(await box.inputValue(), "", "nothing was typed into the answer box");
|
assert.equal(await boxValue(box), "", "nothing was typed into the answer box");
|
||||||
assert.equal(await s.page.evaluate(() => window.__leaked), 0, "no game key reached the page");
|
assert.equal(await s.page.evaluate(() => window.__leaked), 0, "no game key reached the page");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -905,6 +905,9 @@ test("Ghoul Rush's secondary weapon, with real keys in the window: a double tap
|
|||||||
// The stage code: a practice round in the Foyer, its bag full, straight in.
|
// The stage code: a practice round in the Foyer, its bag full, straight in.
|
||||||
for (const k of ["ArrowUp", "ArrowDown", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "ArrowLeft", "ArrowRight", "s"]) await s.page.keyboard.press(k);
|
for (const k of ["ArrowUp", "ArrowDown", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "ArrowLeft", "ArrowRight", "s"]) await s.page.keyboard.press(k);
|
||||||
await s.page.keyboard.press(" ");
|
await s.page.keyboard.press(" ");
|
||||||
|
// The stage's intro card first: fire only moves it on after a moment.
|
||||||
|
await step(s, 25, 60);
|
||||||
|
await s.page.keyboard.press(" ");
|
||||||
const now = () => s.page.evaluate(() => {
|
const now = () => s.page.evaluate(() => {
|
||||||
const g = window.__ghoul;
|
const g = window.__ghoul;
|
||||||
const r = g.round;
|
const r = g.round;
|
||||||
@@ -1268,9 +1271,9 @@ test("a game with music has its own Music slider, at its default until moved, ke
|
|||||||
await s.page.waitForFunction(() => !document.getElementById("activities-modal").open);
|
await s.page.waitForFunction(() => !document.getElementById("activities-modal").open);
|
||||||
await openActivities(s, "ghoul");
|
await openActivities(s, "ghoul");
|
||||||
assert.equal(await slider.isVisible(), true, "Ghoul Rush has one");
|
assert.equal(await slider.isVisible(), true, "Ghoul Rush has one");
|
||||||
assert.equal(await slider.inputValue(), "65", "at its default");
|
assert.equal(await boxValue(slider), "65", "at its default");
|
||||||
assert.equal(await slider.isDisabled(), false);
|
assert.equal(await slider.isDisabled(), false);
|
||||||
await slider.fill("80");
|
await fillBox(slider, "80");
|
||||||
await s.page.waitForFunction(async () => ((await (await fetch("/looks")).json()).looks || {}).activityMusicGhoul === 80);
|
await s.page.waitForFunction(async () => ((await (await fetch("/looks")).json()).looks || {}).activityMusicGhoul === 80);
|
||||||
assert.equal((await pageLooks(s)).activityMusicDrive, 70, "another game keeps its own");
|
assert.equal((await pageLooks(s)).activityMusicDrive, 70, "another game keeps its own");
|
||||||
await s.page.keyboard.press("Escape");
|
await s.page.keyboard.press("Escape");
|
||||||
@@ -1280,7 +1283,7 @@ test("a game with music has its own Music slider, at its default until moved, ke
|
|||||||
looks.gameMusic = false;
|
looks.gameMusic = false;
|
||||||
});
|
});
|
||||||
await openActivities(s, "ghoul");
|
await openActivities(s, "ghoul");
|
||||||
assert.equal(await slider.inputValue(), "80", "kept");
|
assert.equal(await boxValue(slider), "80", "kept");
|
||||||
assert.equal(await slider.isDisabled(), true, "Play game music off: dimmed");
|
assert.equal(await slider.isDisabled(), true, "Play game music off: dimmed");
|
||||||
assert.match(await s.page.locator("#activities-music").getAttribute("title"), /Play game music/, "and says why");
|
assert.match(await s.page.locator("#activities-music").getAttribute("title"), /Play game music/, "and says why");
|
||||||
});
|
});
|
||||||
@@ -2401,6 +2404,12 @@ test("Ghoul Rush plays in the real window: its board's shape and Planny big enou
|
|||||||
// Enter starts a round and has no release: it must not leave fire on.
|
// Enter starts a round and has no release: it must not leave fire on.
|
||||||
await s.page.keyboard.press("Enter");
|
await s.page.keyboard.press("Enter");
|
||||||
assert.equal(await overlay(s), "", "Enter starts a round");
|
assert.equal(await overlay(s), "", "Enter starts a round");
|
||||||
|
await step(s, 4, 16);
|
||||||
|
assert.equal((await you()).phase, "story", "a run opens on the intro story");
|
||||||
|
// Holding space for a second skips it, and shoots nothing at it.
|
||||||
|
await s.page.keyboard.down(" ");
|
||||||
|
await step(s, 70, 16);
|
||||||
|
await s.page.keyboard.up(" ");
|
||||||
await step(s, 20, 16);
|
await step(s, 20, 16);
|
||||||
let me = await you();
|
let me = await you();
|
||||||
assert.deepEqual([me.fire, me.shots, me.phase], [false, 0, "play"], "the start leaves fire off and shoots nothing");
|
assert.deepEqual([me.fire, me.shots, me.phase], [false, 0, "play"], "the start leaves fire off and shoots nothing");
|
||||||
@@ -2503,10 +2512,10 @@ test("Ghoul Rush plays in the real window: its board's shape and Planny big enou
|
|||||||
}, 5000);
|
}, 5000);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("the server serves the activities' scripts, golf's seventeen, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring's two, Rapids Run's two, Hot Potato's two, Crossing Rush's two, Bounce Road's seven, Ghoul Rush's sixty-six, every game's sound effects and the shared pills included", () => {
|
test("the server serves the activities' scripts, golf's seventeen, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring's two, Rapids Run's two, Hot Potato's two, Crossing Rush's two, Bounce Road's seven, Ghoul Rush's eighty-three, every game's sound effects and the shared pills included", () => {
|
||||||
const server = fs.readFileSync(new URL("../src/web-console/static.mjs", import.meta.url), "utf8");
|
const server = fs.readFileSync(new URL("../src/web-console/static.mjs", import.meta.url), "utf8");
|
||||||
const servable = server.slice(server.indexOf("const SERVABLE = new Set(["), server.indexOf("]);", server.indexOf("const SERVABLE = new Set([")));
|
const servable = server.slice(server.indexOf("const SERVABLE = new Set(["), server.indexOf("]);", server.indexOf("const SERVABLE = new Set([")));
|
||||||
for (const file of ["activities.js", "tones.js", "music.js", "activities/snake.js", "screens/activities.js", "activities/golf.js", "activities/golf-holes.js", "activities/golf-draw.js", "activities/golf-decor.js", "activities/golf-kit.js", "activities/golf-paint.js", "activities/golf-looks.js", "activities/golf-course-pirate.js", "activities/golf-course-cave.js", "activities/golf-course-dino.js", "activities/golf-course-candy.js", "activities/golf-course-space.js", "activities/golf-course-frost.js", "activities/golf-look-dino.js", "activities/golf-look-candy.js", "activities/golf-look-space.js", "activities/golf-look-frost.js", "activities/trails.js", "activities/bugs.js", "activities/drive.js", "activities/stack.js", "activities/bumper.js", "activities/bumper-draw.js", "activities/rapids.js", "activities/rapids-draw.js", "activities/fuse.js", "activities/fuse-draw.js", "activities/hop.js", "activities/hop-draw.js", "activities/bounce.js", "activities/bounce-draw.js", "activities/bounce-roads.js", "activities/bounce-road.js", "activities/bounce-rivals.js", "activities/bounce-scenery.js", "activities/bounce-cars.js", "activities/ghoul.js", "activities/ghoul-draw.js", "activities/ghoul-rooms.js", "activities/ghoul-bones.js", "activities/ghoul-bones-draw.js", "activities/ghoul-graveyard.js", "activities/ghoul-graveyard-draw.js", "activities/ghoul-grounds.js", "activities/ghoul-grounds-draw.js", "activities/ghoul-chapel.js", "activities/ghoul-chapel-draw.js", "activities/ghoul-sanatorium.js", "activities/ghoul-sanatorium-draw.js", "activities/ghoul-village.js", "activities/ghoul-village-draw.js", "activities/ghoul-village-world.js", "activities/ghoul-village-wolf.js", "activities/ghoul-mine.js", "activities/ghoul-mine-draw.js", "activities/ghoul-mine-world.js", "activities/ghoul-mine-tommy.js", "activities/ghoul-cart.js", "activities/ghoul-cart-draw.js", "activities/ghoul-sled.js", "activities/ghoul-sled-draw.js", "activities/ghoul-carnival.js", "activities/ghoul-carnival-draw.js", "activities/ghoul-carnival-world.js", "activities/ghoul-frozen.js", "activities/ghoul-frozen-draw.js", "activities/ghoul-frozen-world.js", "activities/ghoul-flare.js", "activities/ghoul-picker-draw.js", "activities/ghoul-powers.js", "activities/ghoul-arms.js", "activities/ghoul-arms-draw.js", "activities/ghoul-rockets.js", "activities/ghoul-rockets-draw.js", "activities/ghoul-pans.js", "activities/ghoul-sfx-arms.js", "activities/ghoul-run.js", "activities/ghoul-dice.js", "activities/ghoul-dice-draw.js", "activities/ghoul-gameover-draw.js", "activities/ghoul-bonus.js", "activities/ghoul-bonus-draw.js", "activities/ghoul-monsters-draw.js", "activities/pills.js", "activities/snake-sfx.js", "activities/golf-sfx.js", "activities/trails-sfx.js", "activities/bugs-sfx.js", "activities/drive-sfx.js", "activities/stack-sfx.js", "activities/bumper-sfx.js", "activities/rapids-sfx.js", "activities/fuse-sfx.js", "activities/hop-sfx.js", "activities/bounce-sfx.js", "activities/ghoul-sfx.js", "activities/ghoul-sfx-graveyard.js", "activities/ghoul-sfx-grounds.js", "activities/ghoul-sfx-chapel.js", "activities/ghoul-sfx-sanatorium.js", "activities/ghoul-sfx-village.js", "activities/ghoul-sfx-mine.js", "activities/ghoul-sfx-carnival.js", "activities/ghoul-sfx-frozen.js", "activities/ghoul-sfx-sled.js", "activities/ghoul-ride-core.js", "activities/ghoul-ride-scenes.js", "activities/ghoul-ride.js", "activities/ghoul-ride-gfx.js", "activities/ghoul-ride-draw-kinds.js", "activities/ghoul-ride-draw-sets.js", "activities/ghoul-ride-draw-hud.js", "activities/ghoul-ride-draw.js", "activities/ghoul-ride-voices.js", "activities/ghoul-sfx-ride.js"]) {
|
for (const file of ["activities.js", "tones.js", "music.js", "activities/snake.js", "screens/activities.js", "activities/golf.js", "activities/golf-holes.js", "activities/golf-draw.js", "activities/golf-decor.js", "activities/golf-kit.js", "activities/golf-paint.js", "activities/golf-looks.js", "activities/golf-course-pirate.js", "activities/golf-course-cave.js", "activities/golf-course-dino.js", "activities/golf-course-candy.js", "activities/golf-course-space.js", "activities/golf-course-frost.js", "activities/golf-look-dino.js", "activities/golf-look-candy.js", "activities/golf-look-space.js", "activities/golf-look-frost.js", "activities/trails.js", "activities/bugs.js", "activities/drive.js", "activities/stack.js", "activities/bumper.js", "activities/bumper-draw.js", "activities/rapids.js", "activities/rapids-draw.js", "activities/fuse.js", "activities/fuse-draw.js", "activities/hop.js", "activities/hop-draw.js", "activities/bounce.js", "activities/bounce-draw.js", "activities/bounce-roads.js", "activities/bounce-road.js", "activities/bounce-rivals.js", "activities/bounce-scenery.js", "activities/bounce-cars.js", "activities/ghoul.js", "activities/ghoul-draw.js", "activities/ghoul-rooms.js", "activities/ghoul-bones.js", "activities/ghoul-bones-draw.js", "activities/ghoul-graveyard.js", "activities/ghoul-graveyard-draw.js", "activities/ghoul-grounds.js", "activities/ghoul-grounds-draw.js", "activities/ghoul-chapel.js", "activities/ghoul-chapel-draw.js", "activities/ghoul-sanatorium.js", "activities/ghoul-sanatorium-draw.js", "activities/ghoul-village.js", "activities/ghoul-village-draw.js", "activities/ghoul-village-world.js", "activities/ghoul-village-wolf.js", "activities/ghoul-mine.js", "activities/ghoul-mine-draw.js", "activities/ghoul-mine-world.js", "activities/ghoul-mine-tommy.js", "activities/ghoul-cart.js", "activities/ghoul-cart-draw.js", "activities/ghoul-sled.js", "activities/ghoul-sled-draw.js", "activities/ghoul-gurney.js", "activities/ghoul-gurney-draw.js", "activities/ghoul-banister.js", "activities/ghoul-banister-draw.js", "activities/ghoul-sfx-banister.js", "activities/ghoul-hearse.js", "activities/ghoul-hearse-draw.js", "activities/ghoul-wagon.js", "activities/ghoul-wagon-draw.js", "activities/ghoul-pew.js", "activities/ghoul-pew-draw.js", "activities/ghoul-pew-course.js", "activities/ghoul-pew-world.js", "activities/ghoul-mower.js", "activities/ghoul-mower-draw.js", "activities/ghoul-tray.js", "activities/ghoul-tray-draw.js", "activities/ghoul-carnival.js", "activities/ghoul-carnival-draw.js", "activities/ghoul-carnival-world.js", "activities/ghoul-frozen.js", "activities/ghoul-frozen-draw.js", "activities/ghoul-frozen-world.js", "activities/ghoul-flare.js", "activities/ghoul-bog.js", "activities/ghoul-bog-draw.js", "activities/ghoul-bogboat.js", "activities/ghoul-bogboat-draw.js", "activities/ghoul-picker-draw.js", "activities/ghoul-powers.js", "activities/ghoul-arms.js", "activities/ghoul-arms-draw.js", "activities/ghoul-rockets.js", "activities/ghoul-rockets-draw.js", "activities/ghoul-pans.js", "activities/ghoul-sfx-arms.js", "activities/ghoul-run.js", "activities/ghoul-dice.js", "activities/ghoul-dice-draw.js", "activities/ghoul-gameover-draw.js", "activities/ghoul-intros.js", "activities/ghoul-intro-draw.js", "activities/ghoul-boss-intros.js", "activities/ghoul-bossintro-draw.js", "activities/ghoul-story.js", "activities/ghoul-story-draw.js", "activities/ghoul-sfx-story.js", "activities/ghoul-bonus.js", "activities/ghoul-bonus-draw.js", "activities/ghoul-monsters-draw.js", "activities/pills.js", "activities/snake-sfx.js", "activities/golf-sfx.js", "activities/trails-sfx.js", "activities/bugs-sfx.js", "activities/drive-sfx.js", "activities/stack-sfx.js", "activities/bumper-sfx.js", "activities/rapids-sfx.js", "activities/fuse-sfx.js", "activities/hop-sfx.js", "activities/bounce-sfx.js", "activities/ghoul-sfx.js", "activities/ghoul-sfx-graveyard.js", "activities/ghoul-sfx-grounds.js", "activities/ghoul-sfx-chapel.js", "activities/ghoul-sfx-sanatorium.js", "activities/ghoul-sfx-village.js", "activities/ghoul-sfx-mine.js", "activities/ghoul-sfx-carnival.js", "activities/ghoul-sfx-frozen.js", "activities/ghoul-sfx-sled.js", "activities/ghoul-sfx-gurney.js", "activities/ghoul-sfx-hearse.js", "activities/ghoul-sfx-bog.js", "activities/ghoul-sfx-bogboat.js", "activities/ghoul-sfx-wagon.js", "activities/ghoul-sfx-pew.js", "activities/ghoul-sfx-mower.js", "activities/ghoul-sfx-tray.js", "activities/ghoul-ride-core.js", "activities/ghoul-ride-scenes.js", "activities/ghoul-ride.js", "activities/ghoul-ride-gfx.js", "activities/ghoul-ride-draw-kinds.js", "activities/ghoul-ride-draw-sets.js", "activities/ghoul-ride-draw-hud.js", "activities/ghoul-ride-draw.js", "activities/ghoul-ride-voices.js", "activities/ghoul-sfx-ride.js"]) {
|
||||||
assert.ok(servable.includes(`"${file}"`), `SERVABLE includes ${file}`);
|
assert.ok(servable.includes(`"${file}"`), `SERVABLE includes ${file}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
import test from "node:test";
|
import test from "node:test";
|
||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { pageSuite, openSession, itemCard, textOf } from "./page-test-helpers.mjs";
|
import { pageSuite, openSession, itemCard, textOf , fillBox, boxValue} from "./page-test-helpers.mjs";
|
||||||
import { reportedHelper } from "./web-console-test-helpers.mjs";
|
import { reportedHelper } from "./web-console-test-helpers.mjs";
|
||||||
import { readChat } from "../src/web-console/inbox.mjs";
|
import { readChat } from "../src/web-console/inbox.mjs";
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ async function openAsk(s) {
|
|||||||
// Types a question and presses Send in the Ask pane.
|
// Types a question and presses Send in the Ask pane.
|
||||||
async function askQuestion(s, text) {
|
async function askQuestion(s, text) {
|
||||||
const box = s.page.locator("#ask-input");
|
const box = s.page.locator("#ask-input");
|
||||||
await box.fill(text);
|
await fillBox(box, text);
|
||||||
await s.page.locator(".ask-composer").getByRole("button", { name: "Send", exact: true }).click();
|
await s.page.locator(".ask-composer").getByRole("button", { name: "Send", exact: true }).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ test("a Quick question typed in Ask reaches the agent under chat, and the agent'
|
|||||||
assert.match(got.reply, /^Quick question \(\d+\): Where does the export live\?$/m);
|
assert.match(got.reply, /^Quick question \(\d+\): Where does the export live\?$/m);
|
||||||
// The question is in the pane, and the box is empty for the next one.
|
// The question is in the pane, and the box is empty for the next one.
|
||||||
await s.page.locator(".ask-row.person").getByText("Where does the export live?").waitFor();
|
await s.page.locator(".ask-row.person").getByText("Where does the export live?").waitFor();
|
||||||
assert.equal(await s.page.locator("#ask-input").inputValue(), "");
|
assert.equal(await boxValue(s.page.locator("#ask-input")), "");
|
||||||
|
|
||||||
s.post({ chat: { replies: [{ id: "r1", re: asked.seq, conversation: 1, md: "It lives in `exports/`." }] } });
|
s.post({ chat: { replies: [{ id: "r1", re: asked.seq, conversation: 1, md: "It lives in `exports/`." }] } });
|
||||||
const reply = s.page.locator(".ask-row.agent");
|
const reply = s.page.locator(".ask-row.agent");
|
||||||
@@ -120,7 +120,7 @@ test("an empty Ask offers starters, a click only fills the box, and nothing is s
|
|||||||
assert.ok((await starters.count()) >= 1, "no starter questions are offered");
|
assert.ok((await starters.count()) >= 1, "no starter questions are offered");
|
||||||
const first = (await textOf(starters.first())).trim();
|
const first = (await textOf(starters.first())).trim();
|
||||||
await starters.first().click();
|
await starters.first().click();
|
||||||
assert.equal(await box.inputValue(), first, "the starter fills the box");
|
assert.equal(await boxValue(box), first, "the starter fills the box");
|
||||||
assert.equal(s.wait(1).code === 0, false, "a starter click sent something");
|
assert.equal(s.wait(1).code === 0, false, "a starter click sent something");
|
||||||
|
|
||||||
await s.page.locator(".ask-composer").getByRole("button", { name: "Send", exact: true }).click();
|
await s.page.locator(".ask-composer").getByRole("button", { name: "Send", exact: true }).click();
|
||||||
@@ -177,7 +177,7 @@ test("a picture attached to a note uploads, and the send carries it in the note'
|
|||||||
const aside = s.page.locator("#aside");
|
const aside = s.page.locator("#aside");
|
||||||
await aside.locator('input[type="file"]').setInputFiles({ name: "shot.png", mimeType: "image/png", buffer: PNG });
|
await aside.locator('input[type="file"]').setInputFiles({ name: "shot.png", mimeType: "image/png", buffer: PNG });
|
||||||
await aside.locator(".attach-thumb.is-ready").waitFor();
|
await aside.locator(".attach-thumb.is-ready").waitFor();
|
||||||
await aside.locator("#thread-q1").fill("See the screenshot.");
|
await fillBox(aside.locator("#thread-q1"), "See the screenshot.");
|
||||||
|
|
||||||
await s.page.click("#btn-send");
|
await s.page.click("#btn-send");
|
||||||
const got = collect(s);
|
const got = collect(s);
|
||||||
@@ -216,7 +216,7 @@ test("a picture thumbnail opens the picview from the note tray and a sent Ask me
|
|||||||
const comp = s.page.locator(".ask-composer");
|
const comp = s.page.locator(".ask-composer");
|
||||||
await comp.locator('input[type="file"]').setInputFiles({ name: "shot2.png", mimeType: "image/png", buffer: PNG });
|
await comp.locator('input[type="file"]').setInputFiles({ name: "shot2.png", mimeType: "image/png", buffer: PNG });
|
||||||
await comp.locator(".attach-thumb.is-ready").waitFor();
|
await comp.locator(".attach-thumb.is-ready").waitFor();
|
||||||
await box.fill("See the screenshot.");
|
await fillBox(box, "See the screenshot.");
|
||||||
await s.page.locator(".ask-composer").getByRole("button", { name: "Send", exact: true }).click();
|
await s.page.locator(".ask-composer").getByRole("button", { name: "Send", exact: true }).click();
|
||||||
const sent = s.page.locator(".ask-row.person .attach-thumb").last();
|
const sent = s.page.locator(".ask-row.person .attach-thumb").last();
|
||||||
await sent.waitFor();
|
await sent.waitFor();
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import assert from "node:assert/strict";
|
|||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { gitInit } from "./skill-script-helpers.mjs";
|
import { gitInit } from "./skill-script-helpers.mjs";
|
||||||
import { pageSuite, openSession, tempProject, sendAndCollect, itemCard, scrollTopOf, scrollCard, stylesOf, styleOf } from "./page-test-helpers.mjs";
|
import { pageSuite, openSession, tempProject, sendAndCollect, itemCard, scrollTopOf, scrollCard, stylesOf, styleOf , fillBox, boxValue} from "./page-test-helpers.mjs";
|
||||||
|
|
||||||
const suite = pageSuite(test);
|
const suite = pageSuite(test);
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ test("a text answer typed on the page reaches the agent as it was typed", async
|
|||||||
workflow: "plan",
|
workflow: "plan",
|
||||||
payload: { items: [{ id: "q1", kind: "text", title: "What to call it", body: "A short name for the export." }] },
|
payload: { items: [{ id: "q1", kind: "text", title: "What to call it", body: "A short name for the export." }] },
|
||||||
});
|
});
|
||||||
await itemCard(s.page, "q1").locator("textarea, input[type=text]").first().fill("audit-export");
|
await fillBox(itemCard(s.page, "q1").locator(".md-host, input[type=text]").first(), "audit-export");
|
||||||
const got = await sendAndCollect(s);
|
const got = await sendAndCollect(s);
|
||||||
assert.equal(got.type, "submit");
|
assert.equal(got.type, "submit");
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
@@ -39,6 +39,24 @@ test("a text answer typed on the page reaches the agent as it was typed", async
|
|||||||
assert.match(got.reply, /audit-export/);
|
assert.match(got.reply, /audit-export/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("the answer box renders Markdown live, like the Notebook", async (t) => {
|
||||||
|
const s = await openSession(await suite.browser(), {
|
||||||
|
t,
|
||||||
|
workflow: "plan",
|
||||||
|
payload: { items: [{ id: "q1", kind: "text", title: "What to build", body: "Describe it." }] },
|
||||||
|
});
|
||||||
|
const card = itemCard(s.page, "q1");
|
||||||
|
const content = card.locator(".md-host .cm-content");
|
||||||
|
await content.waitFor({ timeout: 15000 });
|
||||||
|
assert.equal(await card.locator("textarea").count(), 0, "the answer box is the Markdown editor, not a textarea");
|
||||||
|
await content.click();
|
||||||
|
await content.pressSequentially("**bold**\nplain");
|
||||||
|
await card.locator(".cm-strong", { hasText: "bold" }).waitFor();
|
||||||
|
assert.equal(await content.innerText(), "bold\nplain", "the marks hide off the cursor's line");
|
||||||
|
const got = await sendAndCollect(s);
|
||||||
|
assert.deepEqual(answerTo(got, "q1"), { text: "**bold**\nplain" });
|
||||||
|
});
|
||||||
|
|
||||||
// The agent's side of one question: settle what came before, post `item`
|
// The agent's side of one question: settle what came before, post `item`
|
||||||
// alone, and wait for its card.
|
// alone, and wait for its card.
|
||||||
async function ask(s, item) {
|
async function ask(s, item) {
|
||||||
@@ -70,7 +88,7 @@ test("every kind of question card sends the answer shape the agent reads", async
|
|||||||
|
|
||||||
card = await ask(s, { id: "c2", kind: "choice", title: "Where it goes", body: "Where?", allowOther: true, options: [opt("A", "Email"), opt("B", "Slack")] });
|
card = await ask(s, { id: "c2", kind: "choice", title: "Where it goes", body: "Where?", allowOther: true, options: [opt("A", "Email"), opt("B", "Slack")] });
|
||||||
await card.getByRole("radio", { name: "Something else, in your own words" }).check();
|
await card.getByRole("radio", { name: "Something else, in your own words" }).check();
|
||||||
await card.locator("textarea").fill("A shared drive");
|
await fillBox(card.locator(".md-host"), "A shared drive");
|
||||||
got = await sendAndCollect(s);
|
got = await sendAndCollect(s);
|
||||||
assert.deepEqual(answerTo(got, "c2"), { text: "A shared drive" });
|
assert.deepEqual(answerTo(got, "c2"), { text: "A shared drive" });
|
||||||
assert.equal(got.reply, "Where it goes: A shared drive");
|
assert.equal(got.reply, "Where it goes: A shared drive");
|
||||||
@@ -78,7 +96,7 @@ test("every kind of question card sends the answer shape the agent reads", async
|
|||||||
card = await ask(s, { id: "m1", kind: "multi", title: "Columns", body: "Which?", options: [opt("1", "Date"), opt("2", "User"), opt("3", "Action")], presets: [{ label: "Date and user", ks: ["1", "2"] }] });
|
card = await ask(s, { id: "m1", kind: "multi", title: "Columns", body: "Which?", options: [opt("1", "Date"), opt("2", "User"), opt("3", "Action")], presets: [{ label: "Date and user", ks: ["1", "2"] }] });
|
||||||
await card.getByRole("button", { name: "Date and user" }).click();
|
await card.getByRole("button", { name: "Date and user" }).click();
|
||||||
await card.getByLabel("Action").check();
|
await card.getByLabel("Action").check();
|
||||||
await card.locator("textarea").fill("and the IP");
|
await fillBox(card.locator(".md-host"), "and the IP");
|
||||||
got = await sendAndCollect(s);
|
got = await sendAndCollect(s);
|
||||||
assert.deepEqual(answerTo(got, "m1"), { ks: ["1", "2", "3"], text: "and the IP" });
|
assert.deepEqual(answerTo(got, "m1"), { ks: ["1", "2", "3"], text: "and the IP" });
|
||||||
assert.equal(got.reply, "Columns: 1, 2, 3; and the IP");
|
assert.equal(got.reply, "Columns: 1, 2, 3; and the IP");
|
||||||
@@ -87,11 +105,11 @@ test("every kind of question card sends the answer shape the agent reads", async
|
|||||||
const field = card.locator("input[type=text]");
|
const field = card.locator("input[type=text]");
|
||||||
// The suggestion is the placeholder without its "For example:" lead-in.
|
// The suggestion is the placeholder without its "For example:" lead-in.
|
||||||
await card.getByRole("button", { name: "Autofill suggestion" }).click();
|
await card.getByRole("button", { name: "Autofill suggestion" }).click();
|
||||||
assert.equal(await field.inputValue(), "audit-export");
|
assert.equal(await boxValue(field), "audit-export");
|
||||||
await field.fill("Audit Export");
|
await fillBox(field, "Audit Export");
|
||||||
await card.getByText("Lowercase letters, digits and hyphens.").waitFor();
|
await card.getByText("Lowercase letters, digits and hyphens.").waitFor();
|
||||||
assert.equal(await s.page.locator("#btn-send").isDisabled(), true, "a value that breaks the pattern is not sendable");
|
assert.equal(await s.page.locator("#btn-send").isDisabled(), true, "a value that breaks the pattern is not sendable");
|
||||||
await field.fill("audit-export");
|
await fillBox(field, "audit-export");
|
||||||
got = await sendAndCollect(s);
|
got = await sendAndCollect(s);
|
||||||
assert.deepEqual(answerTo(got, "t1"), { text: "audit-export" });
|
assert.deepEqual(answerTo(got, "t1"), { text: "audit-export" });
|
||||||
assert.equal(got.reply, "What to call it: audit-export");
|
assert.equal(got.reply, "What to call it: audit-export");
|
||||||
@@ -132,7 +150,7 @@ test("every kind of question card sends the answer shape the agent reads", async
|
|||||||
assert.equal(got.reply, "The steps: no changes");
|
assert.equal(got.reply, "The steps: no changes");
|
||||||
|
|
||||||
card = await ask(s, { id: "l2", kind: "list", title: "The steps again", body: "Reorder or rename.", rows });
|
card = await ask(s, { id: "l2", kind: "list", title: "The steps again", body: "Reorder or rename.", rows });
|
||||||
await card.locator("input[type=text]").first().fill("Read the audit log");
|
await fillBox(card.locator("input[type=text]").first(), "Read the audit log");
|
||||||
got = await sendAndCollect(s);
|
got = await sendAndCollect(s);
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
answerTo(got, "l2").rows.map((r) => [r.id, r.title]),
|
answerTo(got, "l2").rows.map((r) => [r.id, r.title]),
|
||||||
@@ -183,7 +201,7 @@ test("a sign-off card opens its document, and each verdict reaches the agent", a
|
|||||||
|
|
||||||
card = await ask(s, signoff("so2"));
|
card = await ask(s, signoff("so2"));
|
||||||
await card.getByRole("button", { name: "I want changes" }).click();
|
await card.getByRole("button", { name: "I want changes" }).click();
|
||||||
await card.locator("textarea").fill("Keep the header row.");
|
await fillBox(card.locator(".md-host"), "Keep the header row.");
|
||||||
got = await sendAndCollect(s);
|
got = await sendAndCollect(s);
|
||||||
assert.deepEqual(answerTo(got, "so2"), { verdict: "changes", text: "Keep the header row." });
|
assert.deepEqual(answerTo(got, "so2"), { verdict: "changes", text: "Keep the header row." });
|
||||||
});
|
});
|
||||||
@@ -214,15 +232,16 @@ test("a redraw keeps your place: the scroll and the focused field survive an age
|
|||||||
assert.equal(await itemCard(s.page, "q1").evaluate((el) => el.scrollTop), 400);
|
assert.equal(await itemCard(s.page, "q1").evaluate((el) => el.scrollTop), 400);
|
||||||
|
|
||||||
// Typing in its answer box: the box keeps the focus and the caret, and the
|
// Typing in its answer box: the box keeps the focus and the caret, and the
|
||||||
// card stays where it was.
|
// card stays where it was. A Markdown field's own API is on its facade:
|
||||||
const field = itemCard(s.page, "q1").locator("textarea, input[type=text]").first();
|
// document.activeElement is its host, its value and caret on .field.
|
||||||
await field.click();
|
const field = itemCard(s.page, "q1").locator(".md-host").first();
|
||||||
await field.pressSequentially("audit-ex");
|
await field.locator(".cm-content").click();
|
||||||
await field.evaluate((el) => el.setSelectionRange(3, 3));
|
await field.locator(".cm-content").pressSequentially("audit-ex");
|
||||||
|
await field.evaluate((el) => el.field.setSelectionRange(3, 3));
|
||||||
const typingAt = await itemCard(s.page, "q1").evaluate((el) => el.scrollTop);
|
const typingAt = await itemCard(s.page, "q1").evaluate((el) => el.scrollTop);
|
||||||
await unrelatedPost(s, "Audit export, take three");
|
await unrelatedPost(s, "Audit export, take three");
|
||||||
const after = itemCard(s.page, "q1").locator("textarea, input[type=text]").first();
|
const after = itemCard(s.page, "q1").locator(".md-host").first();
|
||||||
assert.deepEqual(await after.evaluate((el) => [el === document.activeElement, el.value, el.selectionStart]), [true, "audit-ex", 3]);
|
assert.deepEqual(await after.evaluate((el) => [el === document.activeElement, el.field.value, el.field.selectionStart]), [true, "audit-ex", 3]);
|
||||||
assert.equal(await itemCard(s.page, "q1").evaluate((el) => el.scrollTop), typingAt);
|
assert.equal(await itemCard(s.page, "q1").evaluate((el) => el.scrollTop), typingAt);
|
||||||
|
|
||||||
// On a doc: the column scrolls.
|
// On a doc: the column scrolls.
|
||||||
@@ -280,7 +299,7 @@ test("an answer typed over several lines reaches the agent under its title, neve
|
|||||||
workflow: "plan",
|
workflow: "plan",
|
||||||
payload: { items: [{ id: "q1", kind: "text", title: "What to call it", body: "A short name for the export." }] },
|
payload: { items: [{ id: "q1", kind: "text", title: "What to call it", body: "A short name for the export." }] },
|
||||||
});
|
});
|
||||||
await itemCard(s.page, "q1").locator("textarea").fill("audit-export\nIdea name: not a heading");
|
await fillBox(itemCard(s.page, "q1").locator(".md-host"), "audit-export\nIdea name: not a heading");
|
||||||
const got = await sendAndCollect(s);
|
const got = await sendAndCollect(s);
|
||||||
assert.equal(answerTo(got, "q1").text, "audit-export\nIdea name: not a heading");
|
assert.equal(answerTo(got, "q1").text, "audit-export\nIdea name: not a heading");
|
||||||
assert.ok(got.reply.includes("What to call it: audit-export\n Idea name: not a heading"), `the second line is not indented under its title: ${JSON.stringify(got.reply)}`);
|
assert.ok(got.reply.includes("What to call it: audit-export\n Idea name: not a heading"), `the second line is not indented under its title: ${JSON.stringify(got.reply)}`);
|
||||||
@@ -456,11 +475,11 @@ test("a list rename is staged as it is typed, so Ctrl+Enter or an agent post nev
|
|||||||
const card = await ask(s, { id: "l1", kind: "list", title: "The steps", body: "Rename.", rows });
|
const card = await ask(s, { id: "l1", kind: "list", title: "The steps", body: "Rename.", rows });
|
||||||
const first = card.locator("input.row-title").first();
|
const first = card.locator("input.row-title").first();
|
||||||
await first.click();
|
await first.click();
|
||||||
await first.fill("Read the audit log");
|
await fillBox(first, "Read the audit log");
|
||||||
// The field is still focused: it has not changed or blurred.
|
// The field is still focused: it has not changed or blurred.
|
||||||
await s.page.waitForFunction(() => document.querySelector("#btn-send:not(:disabled)"));
|
await s.page.waitForFunction(() => document.querySelector("#btn-send:not(:disabled)"));
|
||||||
await unrelatedPost(s, "Steps, take two");
|
await unrelatedPost(s, "Steps, take two");
|
||||||
assert.equal(await itemCard(s.page, "l1").locator("input.row-title").first().inputValue(), "Read the audit log", "the agent post kept the typed name");
|
assert.equal(await boxValue(itemCard(s.page, "l1").locator("input.row-title").first()), "Read the audit log", "the agent post kept the typed name");
|
||||||
await itemCard(s.page, "l1").locator("input.row-title").first().focus();
|
await itemCard(s.page, "l1").locator("input.row-title").first().focus();
|
||||||
await s.page.keyboard.press("Control+Enter");
|
await s.page.keyboard.press("Control+Enter");
|
||||||
const got = s.wait(10);
|
const got = s.wait(10);
|
||||||
@@ -483,11 +502,11 @@ test("a send made before the last collection is never shown as still with the ag
|
|||||||
);
|
);
|
||||||
const lock = card.getByText(/Plan2Code is working on it|Waiting for Plan2Code to pick this up/);
|
const lock = card.getByText(/Plan2Code is working on it|Waiting for Plan2Code to pick this up/);
|
||||||
await lock.waitFor();
|
await lock.waitFor();
|
||||||
assert.equal(await card.locator("textarea").count(), 0, "before the agent collects it, the card is locked");
|
assert.equal(await card.locator(".md-host").count(), 0, "before the agent collects it, the card is locked");
|
||||||
// The agent collects it, leaves the question open and waits again.
|
// The agent collects it, leaves the question open and waits again.
|
||||||
assert.equal(s.wait(10).code, 0);
|
assert.equal(s.wait(10).code, 0);
|
||||||
s.post({ agent: { status: "waiting" } });
|
s.post({ agent: { status: "waiting" } });
|
||||||
await card.locator("textarea").waitFor();
|
await card.locator(".md-host").waitFor();
|
||||||
assert.equal(await lock.count(), 0, "after the collection, it is not shown as sent");
|
assert.equal(await lock.count(), 0, "after the collection, it is not shown as sent");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -509,7 +528,7 @@ test("a note box over the git board grows no box, and the card flows at its own
|
|||||||
await git.page.getByRole("tablist").waitFor();
|
await git.page.getByRole("tablist").waitFor();
|
||||||
const gitCard = itemCard(git.page, "y1");
|
const gitCard = itemCard(git.page, "y1");
|
||||||
await gitCard.waitFor();
|
await gitCard.waitFor();
|
||||||
const note = gitCard.locator("textarea").first();
|
const note = gitCard.locator(".md-host").first();
|
||||||
const gitBox = await note.evaluate((el) => ({ min: el.style.minHeight, height: el.offsetHeight }));
|
const gitBox = await note.evaluate((el) => ({ min: el.style.minHeight, height: el.offsetHeight }));
|
||||||
assert.equal(gitBox.min, "", "no height was filled in for the note box");
|
assert.equal(gitBox.min, "", "no height was filled in for the note box");
|
||||||
assert.ok(gitBox.height < 120, `the note box keeps its ordinary height over the board: ${gitBox.height}`);
|
assert.ok(gitBox.height < 120, `the note box keeps its ordinary height over the board: ${gitBox.height}`);
|
||||||
@@ -517,9 +536,9 @@ test("a note box over the git board grows no box, and the card flows at its own
|
|||||||
|
|
||||||
// The same card away from the board does fill the free height of the card.
|
// The same card away from the board does fill the free height of the card.
|
||||||
const plan = await openSession(await suite.browser(), { t, workflow: "plan", payload: { items: [confirm] } });
|
const plan = await openSession(await suite.browser(), { t, workflow: "plan", payload: { items: [confirm] } });
|
||||||
const planBox = plan.page.locator('[data-item="y1"] textarea').first();
|
const planBox = plan.page.locator('[data-item="y1"] .md-host').first();
|
||||||
await planBox.waitFor();
|
await planBox.waitFor();
|
||||||
await plan.page.waitForFunction(() => document.querySelector('[data-item="y1"] textarea').offsetHeight >= 160);
|
await plan.page.waitForFunction(() => document.querySelector('[data-item="y1"] .md-host').offsetHeight >= 160);
|
||||||
assert.ok((await planBox.evaluate((el) => el.offsetHeight)) > gitBox.height, "away from the board, the note box grows");
|
assert.ok((await planBox.evaluate((el) => el.offsetHeight)) > gitBox.height, "away from the board, the note box grows");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -552,9 +571,9 @@ test("Skip this one on an optional card moves on, and the skip reaches the agent
|
|||||||
await card.getByRole("button", { name: "Skip this one" }).click();
|
await card.getByRole("button", { name: "Skip this one" }).click();
|
||||||
await s.page.waitForFunction(() => document.querySelector("#main [data-item]")?.dataset.item === "q2");
|
await s.page.waitForFunction(() => document.querySelector("#main [data-item]")?.dataset.item === "q2");
|
||||||
assert.equal(await itemCard(s.page, "q3").getByRole("button", { name: "Skip this one" }).count(), 0, "a required card cannot be skipped");
|
assert.equal(await itemCard(s.page, "q3").getByRole("button", { name: "Skip this one" }).count(), 0, "a required card cannot be skipped");
|
||||||
await itemCard(s.page, "q2").locator("textarea").fill("Ana");
|
await fillBox(itemCard(s.page, "q2").locator(".md-host"), "Ana");
|
||||||
await s.page.getByRole("navigation", { name: "Move between the questions waiting" }).getByRole("button", { name: /Next/ }).click();
|
await s.page.getByRole("navigation", { name: "Move between the questions waiting" }).getByRole("button", { name: /Next/ }).click();
|
||||||
await itemCard(s.page, "q3").locator("textarea").fill("Bo");
|
await fillBox(itemCard(s.page, "q3").locator(".md-host"), "Bo");
|
||||||
const got = await sendAndCollect(s);
|
const got = await sendAndCollect(s);
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
got.actions.map(({ i, type, text }) => ({ i, type, text })),
|
got.actions.map(({ i, type, text }) => ({ i, type, text })),
|
||||||
@@ -579,7 +598,7 @@ test("a settled card is a record: your answer in words, the options as marks, an
|
|||||||
const record = card.locator(".answered");
|
const record = card.locator(".answered");
|
||||||
assert.match(await record.innerText(), /Your answer[\s\S]*JSON/i);
|
assert.match(await record.innerText(), /Your answer[\s\S]*JSON/i);
|
||||||
assert.match(await record.innerText(), /Locked\./);
|
assert.match(await record.innerText(), /Locked\./);
|
||||||
assert.equal(await card.locator("input, textarea").count(), 0, "a record has no inputs");
|
assert.equal(await card.locator("input, textarea, .md-host").count(), 0, "a record has no inputs");
|
||||||
});
|
});
|
||||||
|
|
||||||
// What a person sees break: a card still takes edits after Send, or never
|
// What a person sees break: a card still takes edits after Send, or never
|
||||||
@@ -587,15 +606,15 @@ test("a settled card is a record: your answer in words, the options as marks, an
|
|||||||
test("a sent card locks, and the agent's next post on it unlocks it", async (t) => {
|
test("a sent card locks, and the agent's next post on it unlocks it", async (t) => {
|
||||||
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: { items: [three[0]] } });
|
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: { items: [three[0]] } });
|
||||||
const card = itemCard(s.page, "q1");
|
const card = itemCard(s.page, "q1");
|
||||||
await card.locator("textarea").fill("Ana");
|
await fillBox(card.locator(".md-host"), "Ana");
|
||||||
await s.page.click("#btn-send");
|
await s.page.click("#btn-send");
|
||||||
const lock = card.getByText(/Plan2Code is working on it|Waiting for Plan2Code to pick this up/);
|
const lock = card.getByText(/Plan2Code is working on it|Waiting for Plan2Code to pick this up/);
|
||||||
await lock.waitFor();
|
await lock.waitFor();
|
||||||
assert.match(await card.locator(".answered").innerText(), /Sent[\s\S]*Ana/i);
|
assert.match(await card.locator(".answered").innerText(), /Sent[\s\S]*Ana/i);
|
||||||
assert.equal(await card.locator("textarea").count(), 0, "no form while the agent has it");
|
assert.equal(await card.locator(".md-host").count(), 0, "no form while the agent has it");
|
||||||
s.wait(10);
|
s.wait(10);
|
||||||
s.post({ items: [{ id: "q1", status: "reopened", thread: [{ who: "agent", text: "Which Ana?" }] }], agent: { status: "waiting" } });
|
s.post({ items: [{ id: "q1", status: "reopened", thread: [{ who: "agent", text: "Which Ana?" }] }], agent: { status: "waiting" } });
|
||||||
await card.locator("textarea").waitFor();
|
await card.locator(".md-host").waitFor();
|
||||||
assert.equal(await lock.count(), 0, "the next post gives the card back");
|
assert.equal(await lock.count(), 0, "the next post gives the card back");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -607,11 +626,11 @@ test("Something else in your own words replaces the pick, and picking an option
|
|||||||
await card.getByLabel("Email").check();
|
await card.getByLabel("Email").check();
|
||||||
const other = card.getByRole("radio", { name: "Something else, in your own words" });
|
const other = card.getByRole("radio", { name: "Something else, in your own words" });
|
||||||
await other.check();
|
await other.check();
|
||||||
await card.locator("textarea.other-text").fill("A shared drive");
|
await fillBox(card.locator(".md-host.other-text"), "A shared drive");
|
||||||
assert.equal(await card.getByLabel("Email").isChecked(), false, "the options and the other share one group");
|
assert.equal(await card.getByLabel("Email").isChecked(), false, "the options and the other share one group");
|
||||||
await card.getByLabel("Slack").check();
|
await card.getByLabel("Slack").check();
|
||||||
await other.check();
|
await other.check();
|
||||||
assert.equal(await card.locator("textarea.other-text").inputValue(), "A shared drive", "the words survive a switch");
|
assert.equal(await boxValue(card.locator(".md-host.other-text")), "A shared drive", "the words survive a switch");
|
||||||
const got = await sendAndCollect(s);
|
const got = await sendAndCollect(s);
|
||||||
assert.deepEqual(answerTo(got, "c1"), { text: "A shared drive" });
|
assert.deepEqual(answerTo(got, "c1"), { text: "A shared drive" });
|
||||||
});
|
});
|
||||||
@@ -623,10 +642,10 @@ test("Clear on a one-answer question takes back the pick and the words, and a se
|
|||||||
const card = await ask(s, { id: "c1", kind: "choice", title: "Where", body: "Where?", options: [opt("A", "Email"), opt("B", "Slack")] });
|
const card = await ask(s, { id: "c1", kind: "choice", title: "Where", body: "Where?", options: [opt("A", "Email"), opt("B", "Slack")] });
|
||||||
const clear = card.getByRole("button", { name: "Clear your answer to this question" });
|
const clear = card.getByRole("button", { name: "Clear your answer to this question" });
|
||||||
await card.getByRole("radio", { name: "Something else, in your own words" }).check();
|
await card.getByRole("radio", { name: "Something else, in your own words" }).check();
|
||||||
await card.locator("textarea.other-text").fill("A shared drive");
|
await fillBox(card.locator(".md-host.other-text"), "A shared drive");
|
||||||
await clear.click();
|
await clear.click();
|
||||||
await s.page.waitForFunction(() => !document.querySelector("#main .card.is-staged"));
|
await s.page.waitForFunction(() => !document.querySelector("#main .card.is-staged"));
|
||||||
assert.equal(await card.locator("textarea.other-text").inputValue(), "", "the words go too");
|
assert.equal(await boxValue(card.locator(".md-host.other-text")), "", "the words go too");
|
||||||
await card.getByLabel("Slack").check();
|
await card.getByLabel("Slack").check();
|
||||||
await clear.click();
|
await clear.click();
|
||||||
await s.page.waitForFunction(() => !document.querySelector("#main .card.is-staged"));
|
await s.page.waitForFunction(() => !document.querySelector("#main .card.is-staged"));
|
||||||
@@ -642,7 +661,7 @@ test("Clear on a one-answer question takes back the pick and the words, and a se
|
|||||||
test("a note's comment field rides along with the answer, typed before or after the pick", async (t) => {
|
test("a note's comment field rides along with the answer, typed before or after the pick", async (t) => {
|
||||||
const s = await openSession(await suite.browser(), { t, workflow: "plan" });
|
const s = await openSession(await suite.browser(), { t, workflow: "plan" });
|
||||||
let card = await ask(s, { id: "y1", kind: "confirm", title: "Keep going", body: "Carry on?" });
|
let card = await ask(s, { id: "y1", kind: "confirm", title: "Keep going", body: "Carry on?" });
|
||||||
await card.getByLabel("Anything to add?").fill("Only on weekdays.");
|
await fillBox(card.getByLabel("Anything to add?"), "Only on weekdays.");
|
||||||
await card.getByRole("button", { name: "Yes" }).click();
|
await card.getByRole("button", { name: "Yes" }).click();
|
||||||
let got = await sendAndCollect(s);
|
let got = await sendAndCollect(s);
|
||||||
assert.deepEqual(answerTo(got, "y1"), { yes: true, text: "Only on weekdays." });
|
assert.deepEqual(answerTo(got, "y1"), { yes: true, text: "Only on weekdays." });
|
||||||
@@ -650,7 +669,7 @@ test("a note's comment field rides along with the answer, typed before or after
|
|||||||
|
|
||||||
card = await ask(s, { id: "y2", kind: "confirm", title: "And this", body: "Also?" });
|
card = await ask(s, { id: "y2", kind: "confirm", title: "And this", body: "Also?" });
|
||||||
await card.getByRole("button", { name: "No" }).click();
|
await card.getByRole("button", { name: "No" }).click();
|
||||||
await card.getByLabel("Anything to add?").fill("Not this quarter.");
|
await fillBox(card.getByLabel("Anything to add?"), "Not this quarter.");
|
||||||
got = await sendAndCollect(s);
|
got = await sendAndCollect(s);
|
||||||
assert.deepEqual(answerTo(got, "y2"), { yes: false, text: "Not this quarter." });
|
assert.deepEqual(answerTo(got, "y2"), { yes: false, text: "Not this quarter." });
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import test from "node:test";
|
|||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { pageSuite, openSession, tempProject, textOf, itemCard, scrollCard } from "./page-test-helpers.mjs";
|
import { pageSuite, openSession, tempProject, textOf, itemCard, scrollCard , fillBox} from "./page-test-helpers.mjs";
|
||||||
import { until } from "./web-console-test-helpers.mjs";
|
import { until } from "./web-console-test-helpers.mjs";
|
||||||
|
|
||||||
const suite = pageSuite(test);
|
const suite = pageSuite(test);
|
||||||
@@ -296,10 +296,10 @@ test("Publish names a remote only when there is exactly one", async (t) => {
|
|||||||
test("over the git board a note box grows with its text, and the no-repo note only points above when a card is there", async (t) => {
|
test("over the git board a note box grows with its text, and the no-repo note only points above when a card is there", async (t) => {
|
||||||
const s = await openSession(await suite.browser(), { t, workflow: "git", project: gitProject(), payload: READY });
|
const s = await openSession(await suite.browser(), { t, workflow: "git", project: gitProject(), payload: READY });
|
||||||
s.post({ items: [confirmCard], agent: { status: "waiting" } });
|
s.post({ items: [confirmCard], agent: { status: "waiting" } });
|
||||||
const note = itemCard(s.page, "y1").locator("textarea").first();
|
const note = itemCard(s.page, "y1").locator(".md-host").first();
|
||||||
await note.waitFor();
|
await note.waitFor();
|
||||||
const before = await note.evaluate((el) => el.offsetHeight);
|
const before = await note.evaluate((el) => el.offsetHeight);
|
||||||
await note.fill(Array.from({ length: 8 }, (_, n) => `Line ${n + 1} of a longer note.`).join("\n"));
|
await fillBox(note, Array.from({ length: 8 }, (_, n) => `Line ${n + 1} of a longer note.`).join("\n"));
|
||||||
const after = await note.evaluate((el) => el.offsetHeight);
|
const after = await note.evaluate((el) => el.offsetHeight);
|
||||||
assert.ok(after > before + 40, `the note box grew with its text: ${before} to ${after}`);
|
assert.ok(after > before + 40, `the note box grew with its text: ${before} to ${after}`);
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import fs from "node:fs";
|
|||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import test from "node:test";
|
import test from "node:test";
|
||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { pageSuite, openSession, tempProject, textOf, drawn } from "./page-test-helpers.mjs";
|
import { pageSuite, openSession, tempProject, textOf, drawn , fillBox} from "./page-test-helpers.mjs";
|
||||||
import { HOME, cli, until } from "./web-console-test-helpers.mjs";
|
import { HOME, cli, until } from "./web-console-test-helpers.mjs";
|
||||||
import { HELP_TABS } from "../src/web-console/public/help.js";
|
import { HELP_TABS } from "../src/web-console/public/help.js";
|
||||||
import { CATALOG_GROUPS, SKILL_CATALOG } from "../src/web-console/public/answers.js";
|
import { CATALOG_GROUPS, SKILL_CATALOG } from "../src/web-console/public/answers.js";
|
||||||
@@ -151,7 +151,7 @@ test("a click on Help's backdrop closes it, and a click inside it does not", asy
|
|||||||
test("Ctrl+Enter does not send while Help is open, and sends once it is closed", async (t) => {
|
test("Ctrl+Enter does not send while Help is open, and sends once it is closed", async (t) => {
|
||||||
savedLooks(t, { welcomeSeen: true });
|
savedLooks(t, { welcomeSeen: true });
|
||||||
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
||||||
await s.page.locator('[data-item="q1"]').first().locator("textarea, input[type=text]").first().fill("audit-export");
|
await fillBox(s.page.locator('[data-item="q1"]').first().locator(".md-host, input[type=text]").first(), "audit-export");
|
||||||
await openHelp(s);
|
await openHelp(s);
|
||||||
await s.page.keyboard.press("Control+Enter");
|
await s.page.keyboard.press("Control+Enter");
|
||||||
await s.page.keyboard.press("Meta+Enter");
|
await s.page.keyboard.press("Meta+Enter");
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import fs from "node:fs";
|
|||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import test from "node:test";
|
import test from "node:test";
|
||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import { pageSuite, openSession, tempProject, drawn, sendAndCollect, itemCard } from "./page-test-helpers.mjs";
|
import { pageSuite, openSession, tempProject, drawn, sendAndCollect, itemCard , fillBox, boxValue} from "./page-test-helpers.mjs";
|
||||||
import { cli, until, CONSOLE_CLI } from "./web-console-test-helpers.mjs";
|
import { cli, until, CONSOLE_CLI } from "./web-console-test-helpers.mjs";
|
||||||
import { addImage, createTab, deleteTab, listTabs, readNotepad, removeImage, saveNote } from "../src/web-console/notepads.mjs";
|
import { addImage, createTab, deleteTab, listTabs, readNotepad, removeImage, saveNote } from "../src/web-console/notepads.mjs";
|
||||||
|
|
||||||
@@ -139,9 +139,9 @@ for (const c of CASES) {
|
|||||||
assert.equal(sentOf(s.project, tab), null, "Start alone marks nothing");
|
assert.equal(sentOf(s.project, tab), null, "Start alone marks nothing");
|
||||||
|
|
||||||
s.post(BOX);
|
s.post(BOX);
|
||||||
await until(async () => (await boxOf(s).inputValue()) === TEXT, 10000);
|
await until(async () => (await boxValue(boxOf(s))) === TEXT, 10000);
|
||||||
await until(async () => (await readyPictures(s).count()) === 5, 15000);
|
await until(async () => (await readyPictures(s).count()) === 5, 15000);
|
||||||
assert.equal(await boxOf(s).isEditable(), true, "the filled box stays editable");
|
assert.equal(await boxOf(s).locator(".cm-content").isEditable(), true, "the filled box stays editable");
|
||||||
|
|
||||||
// Still nothing for the agent before Send.
|
// Still nothing for the agent before Send.
|
||||||
const result = path.join(s.session, "result.json");
|
const result = path.join(s.session, "result.json");
|
||||||
@@ -167,7 +167,7 @@ test("a pictures-only tab arrives as an empty box with its pictures, and its Sen
|
|||||||
await startWith(s, main, { chip: "Start from scratch", command: "/plan2code-1-plan", tabName: "Shots" });
|
await startWith(s, main, { chip: "Start from scratch", command: "/plan2code-1-plan", tabName: "Shots" });
|
||||||
s.post(BOX);
|
s.post(BOX);
|
||||||
await until(async () => (await readyPictures(s).count()) === 2, 15000);
|
await until(async () => (await readyPictures(s).count()) === 2, 15000);
|
||||||
assert.equal(await boxOf(s).inputValue(), "");
|
assert.equal(await boxValue(boxOf(s)), "");
|
||||||
const got = await sendAndCollect(s);
|
const got = await sendAndCollect(s);
|
||||||
const note = got.actions.find((a) => a.i === "idea" && a.type === "comment");
|
const note = got.actions.find((a) => a.i === "idea" && a.type === "comment");
|
||||||
assert.equal(note && note.images.length, 2, "the pictures go on their own");
|
assert.equal(note && note.images.length, 2, "the pictures go on their own");
|
||||||
@@ -183,7 +183,7 @@ test("a picture deleted between Start and the box is skipped, and the rest still
|
|||||||
const first = readNotepad(s.project, tab).images[0].id;
|
const first = readNotepad(s.project, tab).images[0].id;
|
||||||
removeImage(s.project, tab, first);
|
removeImage(s.project, tab, first);
|
||||||
s.post(BOX);
|
s.post(BOX);
|
||||||
await until(async () => (await boxOf(s).inputValue()) === TEXT, 10000);
|
await until(async () => (await boxValue(boxOf(s))) === TEXT, 10000);
|
||||||
await until(async () => (await readyPictures(s).count()) === 2, 15000);
|
await until(async () => (await readyPictures(s).count()) === 2, 15000);
|
||||||
assert.equal(await itemCard(s.page, "idea").locator(".attach-thumb").count(), 2, "no failed or empty slot for the missing one");
|
assert.equal(await itemCard(s.page, "idea").locator(".attach-thumb").count(), 2, "no failed or empty slot for the missing one");
|
||||||
});
|
});
|
||||||
@@ -194,7 +194,7 @@ test("Back to the dashboard after the box fills takes the box with it, as its di
|
|||||||
const main = await toTheMenu(s);
|
const main = await toTheMenu(s);
|
||||||
await startWith(s, main, { chip: "Start from scratch", command: "/plan2code-0-pathfinder", tabName: "Idea" });
|
await startWith(s, main, { chip: "Start from scratch", command: "/plan2code-0-pathfinder", tabName: "Idea" });
|
||||||
s.post(BOX);
|
s.post(BOX);
|
||||||
await until(async () => (await boxOf(s).inputValue()) === TEXT, 10000);
|
await until(async () => (await boxValue(boxOf(s))) === TEXT, 10000);
|
||||||
await s.page.click("#btn-home");
|
await s.page.click("#btn-home");
|
||||||
await s.page.locator("#home-modal[open]").waitFor();
|
await s.page.locator("#home-modal[open]").waitFor();
|
||||||
await s.page.click("#home-go");
|
await s.page.click("#home-go");
|
||||||
@@ -212,18 +212,18 @@ test("the box is filled once: a redraw or a reload keeps what the person typed,
|
|||||||
await startWith(s, main, { chip: "Start from scratch", command: "/plan2code-0-pathfinder", tabName: "Idea" });
|
await startWith(s, main, { chip: "Start from scratch", command: "/plan2code-0-pathfinder", tabName: "Idea" });
|
||||||
s.post(BOX);
|
s.post(BOX);
|
||||||
await until(async () => (await readyPictures(s).count()) === 3, 15000);
|
await until(async () => (await readyPictures(s).count()) === 3, 15000);
|
||||||
await boxOf(s).fill("My own words now.");
|
await fillBox(boxOf(s), "My own words now.");
|
||||||
|
|
||||||
s.post({ agent: { status: "waiting", activity: "Still here" } });
|
s.post({ agent: { status: "waiting", activity: "Still here" } });
|
||||||
await s.page.reload({ waitUntil: "domcontentloaded" });
|
await s.page.reload({ waitUntil: "domcontentloaded" });
|
||||||
await drawn(s.page);
|
await drawn(s.page);
|
||||||
await boxOf(s).waitFor();
|
await boxOf(s).waitFor();
|
||||||
assert.equal(await boxOf(s).inputValue(), "My own words now.");
|
assert.equal(await boxValue(boxOf(s)), "My own words now.");
|
||||||
await until(async () => (await readyPictures(s).count()) === 3, 5000);
|
await until(async () => (await readyPictures(s).count()) === 3, 5000);
|
||||||
// A second marked box later in the session is left alone.
|
// A second marked box later in the session is left alone.
|
||||||
s.post({ items: [{ id: "idea2", kind: "text", title: "Anything else", fill: "note" }] });
|
s.post({ items: [{ id: "idea2", kind: "text", title: "Anything else", fill: "note" }] });
|
||||||
await s.page.locator("#text-idea2").waitFor();
|
await s.page.locator("#text-idea2").waitFor();
|
||||||
assert.equal(await s.page.locator("#text-idea2").inputValue(), "");
|
assert.equal(await boxValue(s.page.locator("#text-idea2")), "");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("a launch that goes back to the dashboard before Send marks nothing", async (t) => {
|
test("a launch that goes back to the dashboard before Send marks nothing", async (t) => {
|
||||||
@@ -232,7 +232,7 @@ test("a launch that goes back to the dashboard before Send marks nothing", async
|
|||||||
const main = await toTheMenu(s);
|
const main = await toTheMenu(s);
|
||||||
await startWith(s, main, { chip: "Start from scratch", command: "/plan2code-quick-task", tabName: "Idea" });
|
await startWith(s, main, { chip: "Start from scratch", command: "/plan2code-quick-task", tabName: "Idea" });
|
||||||
s.post(BOX);
|
s.post(BOX);
|
||||||
await until(async () => (await boxOf(s).inputValue()) === TEXT, 10000);
|
await until(async () => (await boxValue(boxOf(s))) === TEXT, 10000);
|
||||||
const r = cli(["open", "--resume", s.sid, "--no-open", "--workflow", "dashboard"], { cwd: s.project });
|
const r = cli(["open", "--resume", s.sid, "--no-open", "--workflow", "dashboard"], { cwd: s.project });
|
||||||
assert.equal(r.status, 0, `resume failed: ${r.stderr}`);
|
assert.equal(r.status, 0, `resume failed: ${r.stderr}`);
|
||||||
s.post(MENU);
|
s.post(MENU);
|
||||||
@@ -248,6 +248,6 @@ test("a tab deleted between Start and the box leaves the box empty, with a banne
|
|||||||
deleteTab(s.project, tab);
|
deleteTab(s.project, tab);
|
||||||
s.post(BOX);
|
s.post(BOX);
|
||||||
await s.page.locator("#banner", { hasText: "That Notebook tab is gone; the box starts empty." }).waitFor();
|
await s.page.locator("#banner", { hasText: "That Notebook tab is gone; the box starts empty." }).waitFor();
|
||||||
assert.equal(await boxOf(s).inputValue(), "");
|
assert.equal(await boxValue(boxOf(s)), "");
|
||||||
assert.equal(await readyPictures(s).count(), 0);
|
assert.equal(await readyPictures(s).count(), 0);
|
||||||
});
|
});
|
||||||
@@ -11,7 +11,7 @@ import test from "node:test";
|
|||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { pageSuite, openSession, itemCard, drawn, textOf, tempProject } from "./page-test-helpers.mjs";
|
import { pageSuite, openSession, itemCard, drawn, textOf, tempProject , fillBox, boxValue} from "./page-test-helpers.mjs";
|
||||||
import { cli, until } from "./web-console-test-helpers.mjs";
|
import { cli, until } from "./web-console-test-helpers.mjs";
|
||||||
import { STOP_HANDOFF_REPLY, HOME_REPLY } from "../src/web-console/public/answers.js";
|
import { STOP_HANDOFF_REPLY, HOME_REPLY } from "../src/web-console/public/answers.js";
|
||||||
import { CHAT_OFFLINE_TEXT } from "../src/web-console/public/chat.js";
|
import { CHAT_OFFLINE_TEXT } from "../src/web-console/public/chat.js";
|
||||||
@@ -455,8 +455,8 @@ test("the wrapping-up dialog says Done when the stop lands, and stays until clos
|
|||||||
|
|
||||||
test("a page that loses its server goes offline, and after a resume it shows the session again with the unsent answer still typed", async (t) => {
|
test("a page that loses its server goes offline, and after a resume it shows the session again with the unsent answer still typed", async (t) => {
|
||||||
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
||||||
const field = () => itemCard(s.page, "q1").locator("textarea, input[type=text]").first();
|
const field = () => itemCard(s.page, "q1").locator(".md-host, input[type=text]").first();
|
||||||
await field().fill("audit-export");
|
await fillBox(field(), "audit-export");
|
||||||
// Typed, not sent: the page mirrors it to the server's draft.json, which
|
// Typed, not sent: the page mirrors it to the server's draft.json, which
|
||||||
// is what a page on a new port reads back (localStorage is per origin).
|
// is what a page on a new port reads back (localStorage is per origin).
|
||||||
const draftFile = path.join(s.session, "draft.json");
|
const draftFile = path.join(s.session, "draft.json");
|
||||||
@@ -478,7 +478,7 @@ test("a page that loses its server goes offline, and after a resume it shows the
|
|||||||
await s.page.goto(resumed.url, { waitUntil: "domcontentloaded" });
|
await s.page.goto(resumed.url, { waitUntil: "domcontentloaded" });
|
||||||
await drawn(s.page);
|
await drawn(s.page);
|
||||||
await itemCard(s.page, "q1").getByText("What to call it").first().waitFor();
|
await itemCard(s.page, "q1").getByText("What to call it").first().waitFor();
|
||||||
assert.equal(await field().inputValue(), "audit-export", "the unsent answer was lost across the resume");
|
assert.equal(await boxValue(field()), "audit-export", "the unsent answer was lost across the resume");
|
||||||
assert.equal(await s.page.locator("#planny").evaluate((n) => n.classList.contains("is-gone")), false);
|
assert.equal(await s.page.locator("#planny").evaluate((n) => n.classList.contains("is-gone")), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -528,7 +528,7 @@ test("the quiet, not running and not connected lines offer What to check, openin
|
|||||||
// Answered and sent, never collected, and nobody listening: the saved line.
|
// Answered and sent, never collected, and nobody listening: the saved line.
|
||||||
await s.page.clock.setSystemTime(Date.now());
|
await s.page.clock.setSystemTime(Date.now());
|
||||||
s.post({ agent: { status: "waiting" } });
|
s.post({ agent: { status: "waiting" } });
|
||||||
await itemCard(s.page, "q1").locator("textarea, input[type=text]").first().fill("audit-export");
|
await fillBox(itemCard(s.page, "q1").locator(".md-host, input[type=text]").first(), "audit-export");
|
||||||
await s.page.click("#btn-send");
|
await s.page.click("#btn-send");
|
||||||
await lineSays(s, /^Sent\. Waiting for Plan2Code\./);
|
await lineSays(s, /^Sent\. Waiting for Plan2Code\./);
|
||||||
assert.equal(await whatToCheck(s).count(), 0, "the sent line is plain");
|
assert.equal(await whatToCheck(s).count(), 0, "the sent line is plain");
|
||||||
@@ -551,7 +551,7 @@ test("the quiet, not running and not connected lines offer What to check, openin
|
|||||||
// nothing is listening: the wake-up help shows then, not after three minutes.
|
// nothing is listening: the wake-up help shows then, not after three minutes.
|
||||||
test("answers a waiting agent never collects bring up the saved-and-waiting line after a minute of silence, not before", async (t) => {
|
test("answers a waiting agent never collects bring up the saved-and-waiting line after a minute of silence, not before", async (t) => {
|
||||||
const s = await openSession(await suite.browser(), { t, workflow: "plan", clock: true, payload: PLAN_QUESTION });
|
const s = await openSession(await suite.browser(), { t, workflow: "plan", clock: true, payload: PLAN_QUESTION });
|
||||||
await itemCard(s.page, "q1").locator("textarea, input[type=text]").first().fill("audit-export");
|
await fillBox(itemCard(s.page, "q1").locator(".md-host, input[type=text]").first(), "audit-export");
|
||||||
await s.page.click("#btn-send");
|
await s.page.click("#btn-send");
|
||||||
await lineSays(s, /^Sent\. Waiting for Plan2Code\./);
|
await lineSays(s, /^Sent\. Waiting for Plan2Code\./);
|
||||||
await s.page.clock.fastForward(30_000);
|
await s.page.clock.fastForward(30_000);
|
||||||
@@ -566,7 +566,7 @@ test("answers a waiting agent never collects bring up the saved-and-waiting line
|
|||||||
// longer quiet allowance it gave itself before it went.
|
// longer quiet allowance it gave itself before it went.
|
||||||
test("answers a working agent has not collected bring up the saved-and-waiting line after three minutes, not its long quiet allowance", async (t) => {
|
test("answers a working agent has not collected bring up the saved-and-waiting line after three minutes, not its long quiet allowance", async (t) => {
|
||||||
const s = await openSession(await suite.browser(), { t, workflow: "implement", clock: true, payload: PLAN_QUESTION });
|
const s = await openSession(await suite.browser(), { t, workflow: "implement", clock: true, payload: PLAN_QUESTION });
|
||||||
await itemCard(s.page, "q1").locator("textarea, input[type=text]").first().fill("audit-export");
|
await fillBox(itemCard(s.page, "q1").locator(".md-host, input[type=text]").first(), "audit-export");
|
||||||
await s.page.click("#btn-send");
|
await s.page.click("#btn-send");
|
||||||
await lineSays(s, /^Sent\. Waiting for Plan2Code\./);
|
await lineSays(s, /^Sent\. Waiting for Plan2Code\./);
|
||||||
// Its last word before it went quiet: working, with half an hour to spare.
|
// Its last word before it went quiet: working, with half an hour to spare.
|
||||||
@@ -585,12 +585,12 @@ test("answers a working agent has not collected bring up the saved-and-waiting l
|
|||||||
test("a card sent while the agent answers an Ask message says it is answering, and not running only after ten minutes", async (t) => {
|
test("a card sent while the agent answers an Ask message says it is answering, and not running only after ten minutes", async (t) => {
|
||||||
const s = await openSession(await suite.browser(), { t, workflow: "plan", clock: true, payload: PLAN_QUESTION });
|
const s = await openSession(await suite.browser(), { t, workflow: "plan", clock: true, payload: PLAN_QUESTION });
|
||||||
await s.page.locator("nav").getByRole("button", { name: "Ask", exact: true }).click();
|
await s.page.locator("nav").getByRole("button", { name: "Ask", exact: true }).click();
|
||||||
await s.page.locator("#ask-input").fill("What does the export include?");
|
await fillBox(s.page.locator("#ask-input"), "What does the export include?");
|
||||||
await s.page.locator(".ask-composer").getByRole("button", { name: "Send", exact: true }).click();
|
await s.page.locator(".ask-composer").getByRole("button", { name: "Send", exact: true }).click();
|
||||||
const got = s.wait(10);
|
const got = s.wait(10);
|
||||||
assert.equal(got.code, 0, `the Ask message was not handed over (wait exit ${got.code})`);
|
assert.equal(got.code, 0, `the Ask message was not handed over (wait exit ${got.code})`);
|
||||||
await s.page.locator("#views").getByRole("button", { name: /^Questions/ }).click();
|
await s.page.locator("#views").getByRole("button", { name: /^Questions/ }).click();
|
||||||
await itemCard(s.page, "q1").locator("textarea, input[type=text]").first().fill("audit-export");
|
await fillBox(itemCard(s.page, "q1").locator(".md-host, input[type=text]").first(), "audit-export");
|
||||||
await s.page.click("#btn-send");
|
await s.page.click("#btn-send");
|
||||||
await lineSays(s, /^Plan2Code is answering your Ask message\./);
|
await lineSays(s, /^Plan2Code is answering your Ask message\./);
|
||||||
await s.page.clock.fastForward(70_000);
|
await s.page.clock.fastForward(70_000);
|
||||||
@@ -610,7 +610,7 @@ test("a card sent while the agent answers an Ask message says it is answering, a
|
|||||||
// the real state only showing once the page's own timers catch up.
|
// the real state only showing once the page's own timers catch up.
|
||||||
test("a Send that finds the server gone says so at once, with the reconnect help", async (t) => {
|
test("a Send that finds the server gone says so at once, with the reconnect help", async (t) => {
|
||||||
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
||||||
await itemCard(s.page, "q1").locator("textarea, input[type=text]").first().fill("audit-export");
|
await fillBox(itemCard(s.page, "q1").locator(".md-host, input[type=text]").first(), "audit-export");
|
||||||
await stopServer(s);
|
await stopServer(s);
|
||||||
await s.page.click("#btn-send");
|
await s.page.click("#btn-send");
|
||||||
await s.page.waitForFunction(() => document.getElementById("planny").classList.contains("is-gone"), null, { timeout: 3000 });
|
await s.page.waitForFunction(() => document.getElementById("planny").classList.contains("is-gone"), null, { timeout: 3000 });
|
||||||
@@ -624,7 +624,7 @@ test("a Send the server refuses shows the server's reason", async (t) => {
|
|||||||
await s.page.route("**/submit", (route) =>
|
await s.page.route("**/submit", (route) =>
|
||||||
route.fulfill({ status: 500, contentType: "application/json", body: JSON.stringify({ error: "the disk is full" }) })
|
route.fulfill({ status: 500, contentType: "application/json", body: JSON.stringify({ error: "the disk is full" }) })
|
||||||
);
|
);
|
||||||
await itemCard(s.page, "q1").locator("textarea, input[type=text]").first().fill("audit-export");
|
await fillBox(itemCard(s.page, "q1").locator(".md-host, input[type=text]").first(), "audit-export");
|
||||||
await s.page.click("#btn-send");
|
await s.page.click("#btn-send");
|
||||||
await s.page.waitForFunction(() => /the disk is full/.test(document.getElementById("banner").textContent), null, { timeout: 3000 });
|
await s.page.waitForFunction(() => /the disk is full/.test(document.getElementById("banner").textContent), null, { timeout: 3000 });
|
||||||
assert.match(await s.page.locator("#banner").innerText(), /Nothing was lost/);
|
assert.match(await s.page.locator("#banner").innerText(), /Nothing was lost/);
|
||||||
@@ -635,7 +635,7 @@ test("a Send the server refuses as too large says to remove an attachment, not t
|
|||||||
await s.page.route("**/submit", (route) =>
|
await s.page.route("**/submit", (route) =>
|
||||||
route.fulfill({ status: 413, contentType: "application/json", body: JSON.stringify({ error: "too large" }) })
|
route.fulfill({ status: 413, contentType: "application/json", body: JSON.stringify({ error: "too large" }) })
|
||||||
);
|
);
|
||||||
await itemCard(s.page, "q1").locator("textarea, input[type=text]").first().fill("audit-export");
|
await fillBox(itemCard(s.page, "q1").locator(".md-host, input[type=text]").first(), "audit-export");
|
||||||
await s.page.click("#btn-send");
|
await s.page.click("#btn-send");
|
||||||
await s.page.waitForFunction(() => /remove an attachment/.test(document.getElementById("banner").textContent), null, { timeout: 3000 });
|
await s.page.waitForFunction(() => /remove an attachment/.test(document.getElementById("banner").textContent), null, { timeout: 3000 });
|
||||||
assert.doesNotMatch(await s.page.locator("#banner").innerText(), /try Send again/);
|
assert.doesNotMatch(await s.page.locator("#banner").innerText(), /try Send again/);
|
||||||
@@ -644,7 +644,7 @@ test("a Send the server refuses as too large says to remove an attachment, not t
|
|||||||
test("a Send lost on the way, with the server still up, says the console is there and to send again", async (t) => {
|
test("a Send lost on the way, with the server still up, says the console is there and to send again", async (t) => {
|
||||||
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
||||||
await s.page.route("**/submit", (route) => route.abort());
|
await s.page.route("**/submit", (route) => route.abort());
|
||||||
await itemCard(s.page, "q1").locator("textarea, input[type=text]").first().fill("audit-export");
|
await fillBox(itemCard(s.page, "q1").locator(".md-host, input[type=text]").first(), "audit-export");
|
||||||
await s.page.click("#btn-send");
|
await s.page.click("#btn-send");
|
||||||
await s.page.waitForFunction(() => /console is still up/.test(document.getElementById("banner").textContent), null, { timeout: 3000 });
|
await s.page.waitForFunction(() => /console is still up/.test(document.getElementById("banner").textContent), null, { timeout: 3000 });
|
||||||
assert.equal(await s.page.locator("#planny").evaluate((n) => n.classList.contains("is-gone")), false, "not called gone");
|
assert.equal(await s.page.locator("#planny").evaluate((n) => n.classList.contains("is-gone")), false, "not called gone");
|
||||||
@@ -671,7 +671,7 @@ test("an answered finish offer comes back unanswered on a later finish, once the
|
|||||||
|
|
||||||
test("a finished session never puts a sent answer back on its form", async (t) => {
|
test("a finished session never puts a sent answer back on its form", async (t) => {
|
||||||
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
||||||
await itemCard(s.page, "q1").locator("textarea").fill("audit-export");
|
await fillBox(itemCard(s.page, "q1").locator(".md-host"), "audit-export");
|
||||||
await s.page.click("#btn-send");
|
await s.page.click("#btn-send");
|
||||||
collect(s);
|
collect(s);
|
||||||
// Collected and left open, then the session ends: nothing more can be sent,
|
// Collected and left open, then the session ends: nothing more can be sent,
|
||||||
@@ -686,8 +686,8 @@ test("a finished session never puts a sent answer back on its form", async (t) =
|
|||||||
await itemCard(s.page, "q1").waitFor();
|
await itemCard(s.page, "q1").waitFor();
|
||||||
const mark = q1.locator(".rail-mark");
|
const mark = q1.locator(".rail-mark");
|
||||||
assert.notEqual(await mark.getAttribute("title"), "ready to send", "the sent answer came back on the form");
|
assert.notEqual(await mark.getAttribute("title"), "ready to send", "the sent answer came back on the form");
|
||||||
const box = itemCard(s.page, "q1").locator("textarea");
|
const box = itemCard(s.page, "q1").locator(".md-host");
|
||||||
assert.notEqual((await box.count()) ? await box.inputValue() : "", "audit-export", "the sent answer is back in its box");
|
assert.notEqual((await box.count()) ? await boxValue(box) : "", "audit-export", "the sent answer is back in its box");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("the footer keeps its workspace label on the dashboard, and the label opens the Workspace dialog", async (t) => {
|
test("the footer keeps its workspace label on the dashboard, and the label opens the Workspace dialog", async (t) => {
|
||||||
@@ -735,9 +735,10 @@ test("a workflow page uses its modules: the full footer, the session meter, @ su
|
|||||||
// The @ list is the workspace frame, which can land after the page draws;
|
// The @ list is the workspace frame, which can land after the page draws;
|
||||||
// the footer has one label per width tier once it has.
|
// the footer has one label per width tier once it has.
|
||||||
await s.page.waitForFunction(() => (document.getElementById("footer-where").dataset.key || "").includes("\n"));
|
await s.page.waitForFunction(() => (document.getElementById("footer-where").dataset.key || "").includes("\n"));
|
||||||
const box = itemCard(s.page, "q1").locator("textarea");
|
const box = itemCard(s.page, "q1").locator(".md-host");
|
||||||
await box.click();
|
const ed = box.locator(".cm-content");
|
||||||
await box.pressSequentially("See @");
|
await ed.click();
|
||||||
|
await ed.pressSequentially("See @");
|
||||||
await s.page.locator("#mention-pop").waitFor();
|
await s.page.locator("#mention-pop").waitFor();
|
||||||
assert.match(await textOf(s.page.locator("#mention-pop")), new RegExp(name));
|
assert.match(await textOf(s.page.locator("#mention-pop")), new RegExp(name));
|
||||||
// favicon.js: the person's move puts a bar on the tab icon.
|
// favicon.js: the person's move puts a bar on the tab icon.
|
||||||
@@ -959,7 +960,7 @@ test("under the app, a gone session's review and dashboard fallbacks name the te
|
|||||||
// finish-style stop instead of the way home.
|
// finish-style stop instead of the way home.
|
||||||
test("the top bar's back triangle asks first, then sends __dashboard with the typed answers and the home reply", async (t) => {
|
test("the top bar's back triangle asks first, then sends __dashboard with the typed answers and the home reply", async (t) => {
|
||||||
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_QUESTION });
|
||||||
await itemCard(s.page, "q1").locator("textarea, input[type=text]").first().fill("audit-export");
|
await fillBox(itemCard(s.page, "q1").locator(".md-host, input[type=text]").first(), "audit-export");
|
||||||
await s.page.click("#btn-home");
|
await s.page.click("#btn-home");
|
||||||
const modal = s.page.locator("#home-modal");
|
const modal = s.page.locator("#home-modal");
|
||||||
await modal.waitFor();
|
await modal.waitFor();
|
||||||
@@ -1032,6 +1033,48 @@ test("Back to default in Preferences returns the theme to follow the system and
|
|||||||
assert.equal(await s.page.locator('input[name="looks-theme"][value="system"]').isChecked(), true, "the system choice is ticked again");
|
assert.equal(await s.page.locator('input[name="looks-theme"][value="system"]').isChecked(), true, "the system choice is ticked again");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// What a person sees break: during a build the waiting pane's "follow along"
|
||||||
|
// link must open the phase file tab (phase-N.md), which carries the same task
|
||||||
|
// list plus the rest of the file. An older install's tasks doc arriving
|
||||||
|
// beside it does not take the link back.
|
||||||
|
test("the build's waiting link opens the phase file tab and prefers it over an old tasks list", async (t) => {
|
||||||
|
const s = await openSession(await suite.browser(), {
|
||||||
|
t,
|
||||||
|
workflow: "implement",
|
||||||
|
payload: {
|
||||||
|
headline: { stage: "Phase 3: API endpoints", cleared: 5, total: 11 },
|
||||||
|
docs: [{ id: "phasefile", title: "phase-3.md", blocks: [{ id: "body", state: "settled", md: "# Phase 3: API endpoints\n\n- [x] **Task 3.1:** Register the routes\n- [ ] **Task 3.2:** Add paging" }] }],
|
||||||
|
agent: { status: "working", activity: "Task 6 of 11: deleting a task" },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const main = s.page.locator("#main");
|
||||||
|
const jump = main.locator("button.waiting-jump", { hasText: "phase-3.md" });
|
||||||
|
await jump.waitFor();
|
||||||
|
s.post({ docs: [{ id: "phase", title: "Phase 3 tasks", blocks: [{ id: "tasks", state: "settled", md: "- [x] **Task 3.1:** Register the routes" }] }] });
|
||||||
|
await jump.waitFor();
|
||||||
|
await jump.click();
|
||||||
|
await s.page.locator(".view-tab[aria-current='true']", { hasText: "phase-3.md" }).waitFor();
|
||||||
|
await main.getByRole("heading", { name: "Phase 3: API endpoints" }).waitFor();
|
||||||
|
});
|
||||||
|
|
||||||
|
// What a person sees break: a build still on the old contract keeps its link;
|
||||||
|
// the posted tasks list opens its own tab.
|
||||||
|
test("a build still on the old contract keeps its waiting link on the tasks list", async (t) => {
|
||||||
|
const s = await openSession(await suite.browser(), {
|
||||||
|
t,
|
||||||
|
workflow: "implement",
|
||||||
|
payload: {
|
||||||
|
headline: { stage: "Phase 3: API endpoints", cleared: 5, total: 11 },
|
||||||
|
docs: [{ id: "phase", title: "Phase 3 tasks", blocks: [{ id: "tasks", state: "settled", md: "- [x] **Task 3.1:** Register the routes" }] }],
|
||||||
|
agent: { status: "working", activity: "Task 6 of 11: deleting a task" },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const jump = s.page.locator("#main").locator("button.waiting-jump", { hasText: "Phase 3 tasks" });
|
||||||
|
await jump.waitFor();
|
||||||
|
await jump.click();
|
||||||
|
await s.page.locator(".view-tab[aria-current='true']", { hasText: "Phase 3 tasks" }).waitFor();
|
||||||
|
});
|
||||||
|
|
||||||
// Planny's own spoken line said "close this tab": under the app there is no
|
// Planny's own spoken line said "close this tab": under the app there is no
|
||||||
// tab, only the one window.
|
// tab, only the one window.
|
||||||
test("under the app, Planny's finished line says to close the window, not the tab", async (t) => {
|
test("under the app, Planny's finished line says to close the window, not the tab", async (t) => {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import test from "node:test";
|
|||||||
import assert from "node:assert/strict";
|
import assert from "node:assert/strict";
|
||||||
import fs from "node:fs";
|
import fs from "node:fs";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { pageSuite, openSession, itemCard, textOf } from "./page-test-helpers.mjs";
|
import { pageSuite, openSession, itemCard, textOf , fillBox, boxValue} from "./page-test-helpers.mjs";
|
||||||
import { tempFolder } from "./web-console-test-helpers.mjs";
|
import { tempFolder } from "./web-console-test-helpers.mjs";
|
||||||
|
|
||||||
const suite = pageSuite(test);
|
const suite = pageSuite(test);
|
||||||
@@ -33,7 +33,7 @@ function datasetsFolder() {
|
|||||||
async function addFolderFromDialog(s, dir) {
|
async function addFolderFromDialog(s, dir) {
|
||||||
await s.page.locator("#footer-where").click();
|
await s.page.locator("#footer-where").click();
|
||||||
await s.page.locator("#workspace-modal[open]").waitFor();
|
await s.page.locator("#workspace-modal[open]").waitFor();
|
||||||
await s.page.locator("#workspace-path").fill(dir);
|
await fillBox(s.page.locator("#workspace-path"), dir);
|
||||||
await s.page.locator("#workspace-add").click();
|
await s.page.locator("#workspace-add").click();
|
||||||
await s.page.locator("#workspace-add-msg.is-good").waitFor();
|
await s.page.locator("#workspace-add-msg.is-good").waitFor();
|
||||||
}
|
}
|
||||||
@@ -53,11 +53,11 @@ test("a folder added in Workspace is listed with its @name, and the next send te
|
|||||||
assert.equal(await textOf(added.locator(".ws-path")), dir);
|
assert.equal(await textOf(added.locator(".ws-path")), dir);
|
||||||
assert.equal(await added.locator(".ws-original").count(), 0, "only the first folder is the original");
|
assert.equal(await added.locator(".ws-original").count(), 0, "only the first folder is the original");
|
||||||
assert.equal(await rows.first().locator(".ws-original").count(), 1);
|
assert.equal(await rows.first().locator(".ws-original").count(), 1);
|
||||||
assert.equal(await s.page.locator("#workspace-path").inputValue(), "", "the path box empties after an add");
|
assert.equal(await boxValue(s.page.locator("#workspace-path")), "", "the path box empties after an add");
|
||||||
|
|
||||||
await s.page.locator("#workspace-done").click();
|
await s.page.locator("#workspace-done").click();
|
||||||
await s.page.locator("#workspace-modal[open]").waitFor({ state: "detached" });
|
await s.page.locator("#workspace-modal[open]").waitFor({ state: "detached" });
|
||||||
await itemCard(s.page, "q1").locator("textarea, input[type=text]").first().fill("audit-export");
|
await fillBox(itemCard(s.page, "q1").locator(".md-host, input[type=text]").first(), "audit-export");
|
||||||
await s.page.click("#btn-send");
|
await s.page.click("#btn-send");
|
||||||
const got = s.wait(10);
|
const got = s.wait(10);
|
||||||
assert.equal(got.code, 0, `nothing was sent (wait exit ${got.code})`);
|
assert.equal(got.code, 0, `nothing was sent (wait exit ${got.code})`);
|
||||||
@@ -79,18 +79,19 @@ test("an @ in a note offers the workspace's folders, and picking one writes its
|
|||||||
await s.page.waitForFunction(() => (document.getElementById("footer-where").dataset.key || "").includes("+ 1 folder"));
|
await s.page.waitForFunction(() => (document.getElementById("footer-where").dataset.key || "").includes("+ 1 folder"));
|
||||||
|
|
||||||
const note = s.page.locator("#aside #thread-q1");
|
const note = s.page.locator("#aside #thread-q1");
|
||||||
await note.click();
|
const ed = note.locator(".cm-content");
|
||||||
await note.pressSequentially("Look in @da");
|
await ed.click();
|
||||||
|
await ed.pressSequentially("Look in @da");
|
||||||
const pop = s.page.locator("#mention-pop");
|
const pop = s.page.locator("#mention-pop");
|
||||||
await pop.waitFor();
|
await pop.waitFor();
|
||||||
const options = pop.locator(".mention-opt");
|
const options = pop.locator(".mention-opt");
|
||||||
assert.deepEqual(await options.allTextContents(), ["@datasets"], "only the folder that matches what was typed");
|
assert.deepEqual(await options.allTextContents(), ["@datasets"], "only the folder that matches what was typed");
|
||||||
await options.first().click();
|
await options.first().click();
|
||||||
await pop.waitFor({ state: "detached" });
|
await pop.waitFor({ state: "detached" });
|
||||||
assert.equal(await note.inputValue(), "Look in @datasets ");
|
assert.equal(await boxValue(note), "Look in @datasets ");
|
||||||
|
|
||||||
// A bare @ lists every folder, the project's own first.
|
// A bare @ lists every folder, the project's own first.
|
||||||
await note.pressSequentially("and @");
|
await ed.pressSequentially("and @");
|
||||||
await pop.waitFor();
|
await pop.waitFor();
|
||||||
assert.equal(await pop.locator(".mention-opt").count(), 2);
|
assert.equal(await pop.locator(".mention-opt").count(), 2);
|
||||||
await s.page.keyboard.press("Escape");
|
await s.page.keyboard.press("Escape");
|
||||||
|
|||||||
@@ -44,11 +44,12 @@ export const HEADER =
|
|||||||
.join(", ") +
|
.join(", ") +
|
||||||
" */\n";
|
" */\n";
|
||||||
|
|
||||||
// What the page may import: exactly what notepad-editor.js uses, since an
|
// What the page may import: exactly what notepad-editor.js and md-field.js
|
||||||
// entry export is never tree-shaken. indentWithTab is left out on purpose: it
|
// use, since an entry export is never tree-shaken. indentWithTab is left out
|
||||||
// would trap the Tab key and keyboard users could not leave the editor.
|
// on purpose: it would trap the Tab key and keyboard users could not leave
|
||||||
|
// the editor.
|
||||||
export const ENTRY = `export { Compartment, EditorState } from "@codemirror/state";
|
export const ENTRY = `export { Compartment, EditorState } from "@codemirror/state";
|
||||||
export { Decoration, EditorView, ViewPlugin, WidgetType, keymap } from "@codemirror/view";
|
export { Decoration, EditorView, ViewPlugin, WidgetType, keymap, placeholder } from "@codemirror/view";
|
||||||
export { markdown, markdownLanguage } from "@codemirror/lang-markdown";
|
export { markdown, markdownLanguage } from "@codemirror/lang-markdown";
|
||||||
export { syntaxTree } from "@codemirror/language";
|
export { syntaxTree } from "@codemirror/language";
|
||||||
export { defaultKeymap, history, historyKeymap, redo } from "@codemirror/commands";
|
export { defaultKeymap, history, historyKeymap, redo } from "@codemirror/commands";
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
/* The frame a Markdown field (md-field.js) wears inside its shadow root;
|
||||||
|
linked beside notepad-editor.css, which carries the mark looks. The page's
|
||||||
|
own CSS cannot reach in, so a field's size, border and rounding are set
|
||||||
|
from outside on .md-host, and these rules only fill the host and draw what
|
||||||
|
CodeMirror needs. The chain is flex rather than height: 100%: a percentage
|
||||||
|
of a host whose height comes from min-height is never definite, and an
|
||||||
|
inherited min-height inside a bordered host counts the border twice. The
|
||||||
|
height: auto resets cut notepad-editor.css's height: 100% rules, which this
|
||||||
|
sheet is loaded beside and must never inherit sizing from. */
|
||||||
|
:host { display: flex; flex-direction: column; height: auto; }
|
||||||
|
.md-field { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
|
||||||
|
.cm-editor { flex: 1 1 auto; min-height: 0; height: auto; background: transparent; color: var(--ink); font: inherit; }
|
||||||
|
div.cm-editor.cm-focused { outline: none; }
|
||||||
|
div.cm-editor .cm-scroller { overflow: auto; font-family: inherit; }
|
||||||
|
div.cm-editor .cm-content { padding: 10px 12px; caret-color: var(--accent); }
|
||||||
|
div.cm-editor .cm-cursor { border-left-color: var(--accent); }
|
||||||
|
div.cm-editor .cm-selectionBackground,
|
||||||
|
div.cm-editor.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground { background: color-mix(in srgb, var(--accent) 25%, transparent) !important; }
|
||||||
|
div.cm-editor .cm-line { padding: 0; }
|
||||||
|
.cm-placeholder { color: var(--ink-3); }
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
// Plan2Code Web Console - a Markdown answer field, on CodeMirror 6.
|
||||||
|
//
|
||||||
|
// Every multiline box the person types into (question answers, the
|
||||||
|
// something-else and note fields on cards, the Ask composer and its reply
|
||||||
|
// box, the subagents instruction) is one of these, so Markdown looks like it
|
||||||
|
// does in the Notebook everywhere: marks hide off the cursor's line, bullets
|
||||||
|
// become dots, headings grow. Like notepad-editor.js the editor sits in a
|
||||||
|
// shadow root, where CodeMirror's own <style> element is adopted rather than
|
||||||
|
// refused by the page's style-src 'self' policy. notepad-editor.css carries
|
||||||
|
// the mark looks, md-field.css the field's frame.
|
||||||
|
//
|
||||||
|
// makeMdField returns a facade shaped like the textarea it replaces, so
|
||||||
|
// screens and mention-box.js barely tell the difference: value get/set (set
|
||||||
|
// reports no "input", like a textarea), focus(), selectionStart/End,
|
||||||
|
// setSelectionRange, classList, isConnected, getBoundingClientRect, a
|
||||||
|
// disabled flag, and addEventListener/dispatchEvent for "input", "keydown",
|
||||||
|
// "keyup", "paste", "blur" and "focus". aria-* attributes land on the
|
||||||
|
// editable surface, everything else on the host. field.el is the host div to
|
||||||
|
// append; host.field is the facade itself, so a page test or a helper can
|
||||||
|
// drive it.
|
||||||
|
|
||||||
|
import {
|
||||||
|
Compartment,
|
||||||
|
EditorState,
|
||||||
|
EditorView,
|
||||||
|
defaultKeymap,
|
||||||
|
history,
|
||||||
|
historyKeymap,
|
||||||
|
keymap,
|
||||||
|
markdown,
|
||||||
|
markdownLanguage,
|
||||||
|
placeholder,
|
||||||
|
redo,
|
||||||
|
} from "./vendor/codemirror.esm.js";
|
||||||
|
import { livePreview } from "./notepad-editor.js";
|
||||||
|
|
||||||
|
// These listeners run as the editor's own DOM handlers, before its keymaps:
|
||||||
|
// a preventDefault there (the mention popover's keys, a pure-image paste)
|
||||||
|
// still beats CodeMirror's own handling.
|
||||||
|
const HANDLED = ["keydown", "keyup", "paste", "blur", "focus"];
|
||||||
|
|
||||||
|
export function makeMdField({ id, className, value = "", placeholder: hint, label, disabled = false, maxLength = 0 } = {}) {
|
||||||
|
const host = document.createElement("div");
|
||||||
|
host.className = "md-host" + (className ? " " + className : "");
|
||||||
|
if (id) host.id = id;
|
||||||
|
const root = host.attachShadow({ mode: "open" });
|
||||||
|
const sheets = ["/notepad-editor.css", "/md-field.css"].map((href) => {
|
||||||
|
const link = document.createElement("link");
|
||||||
|
link.rel = "stylesheet";
|
||||||
|
link.href = href;
|
||||||
|
return link;
|
||||||
|
});
|
||||||
|
const mount = document.createElement("div");
|
||||||
|
mount.className = "md-field";
|
||||||
|
root.append(...sheets, mount);
|
||||||
|
|
||||||
|
const listeners = new Map();
|
||||||
|
const fire = (type, event) => {
|
||||||
|
for (const fn of listeners.get(type) ?? []) fn.call(field, event ?? new Event(type));
|
||||||
|
return Boolean(event && event.defaultPrevented);
|
||||||
|
};
|
||||||
|
|
||||||
|
let off = Boolean(disabled);
|
||||||
|
const access = new Compartment();
|
||||||
|
// editable, not only readOnly: a disabled field cannot take the focus,
|
||||||
|
// which is the difference a textarea's own disabled attribute shows.
|
||||||
|
const accessOf = (on) =>
|
||||||
|
on
|
||||||
|
? [
|
||||||
|
EditorState.readOnly.of(true),
|
||||||
|
EditorView.editable.of(false),
|
||||||
|
EditorView.contentAttributes.of({ "aria-disabled": "true" }),
|
||||||
|
]
|
||||||
|
: [];
|
||||||
|
|
||||||
|
const extensions = [
|
||||||
|
history(),
|
||||||
|
keymap.of([{ key: "Mod-Shift-z", run: redo, preventDefault: true }, ...defaultKeymap, ...historyKeymap]),
|
||||||
|
markdown({ base: markdownLanguage }),
|
||||||
|
livePreview,
|
||||||
|
EditorView.lineWrapping,
|
||||||
|
EditorView.contentAttributes.of({ "aria-label": label || "Markdown text", "aria-multiline": "true", spellcheck: "true" }),
|
||||||
|
EditorView.domEventHandlers(Object.fromEntries(HANDLED.map((type) => [type, (event) => fire(type, event)]))),
|
||||||
|
EditorView.updateListener.of((update) => {
|
||||||
|
if (update.docChanged) fire("input");
|
||||||
|
}),
|
||||||
|
...(hint ? [placeholder(hint)] : []),
|
||||||
|
...(maxLength
|
||||||
|
? [
|
||||||
|
EditorState.transactionFilter.of((tr) => {
|
||||||
|
if (!tr.docChanged || tr.newDoc.length <= maxLength) return tr;
|
||||||
|
return {
|
||||||
|
changes: { from: 0, to: tr.startState.doc.length, insert: tr.newDoc.sliceString(0, maxLength) },
|
||||||
|
selection: { anchor: Math.min(tr.newSelection.main.head, maxLength) },
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
]
|
||||||
|
: []),
|
||||||
|
];
|
||||||
|
const stateOf = (text) => EditorState.create({ doc: text, extensions: [...extensions, access.of(accessOf(off))] });
|
||||||
|
const view = new EditorView({ state: stateOf(String(value ?? "")), parent: mount, root });
|
||||||
|
// The stylesheets arrive after the first measure: measure again once they
|
||||||
|
// have, or the lines would keep their unstyled height until the next edit.
|
||||||
|
for (const sheet of sheets) sheet.addEventListener("load", () => view.requestMeasure());
|
||||||
|
|
||||||
|
const field = {
|
||||||
|
el: host,
|
||||||
|
view,
|
||||||
|
get value() {
|
||||||
|
return view.state.doc.toString();
|
||||||
|
},
|
||||||
|
set value(text) {
|
||||||
|
// setState neither reports a change nor keeps the undo steps, exactly
|
||||||
|
// the swap a textarea's value assignment makes. A fresh state parks its
|
||||||
|
// caret at 0; a textarea's collapses to the end, so callers that fill
|
||||||
|
// and focus (Autofill, quick answers, Reset to default) append as they
|
||||||
|
// used to.
|
||||||
|
view.setState(stateOf(String(text ?? "")));
|
||||||
|
view.dispatch({ selection: { anchor: view.state.doc.length } });
|
||||||
|
},
|
||||||
|
get selectionStart() {
|
||||||
|
const m = view.state.selection.main;
|
||||||
|
return Math.min(m.anchor, m.head);
|
||||||
|
},
|
||||||
|
get selectionEnd() {
|
||||||
|
const m = view.state.selection.main;
|
||||||
|
return Math.max(m.anchor, m.head);
|
||||||
|
},
|
||||||
|
setSelectionRange(a, b) {
|
||||||
|
view.dispatch({ selection: { anchor: a, head: b } });
|
||||||
|
},
|
||||||
|
focus() {
|
||||||
|
view.focus();
|
||||||
|
},
|
||||||
|
get disabled() {
|
||||||
|
return off;
|
||||||
|
},
|
||||||
|
set disabled(on) {
|
||||||
|
off = Boolean(on);
|
||||||
|
host.classList.toggle("is-disabled", off);
|
||||||
|
view.dispatch({ effects: access.reconfigure(accessOf(off)) });
|
||||||
|
},
|
||||||
|
get classList() {
|
||||||
|
return host.classList;
|
||||||
|
},
|
||||||
|
get isConnected() {
|
||||||
|
return host.isConnected;
|
||||||
|
},
|
||||||
|
getBoundingClientRect() {
|
||||||
|
return host.getBoundingClientRect();
|
||||||
|
},
|
||||||
|
setAttribute(name, val) {
|
||||||
|
(name.startsWith("aria-") ? view.contentDOM : host).setAttribute(name, val);
|
||||||
|
},
|
||||||
|
removeAttribute(name) {
|
||||||
|
(name.startsWith("aria-") ? view.contentDOM : host).removeAttribute(name);
|
||||||
|
},
|
||||||
|
addEventListener(type, fn) {
|
||||||
|
if (!listeners.has(type)) listeners.set(type, new Set());
|
||||||
|
listeners.get(type).add(fn);
|
||||||
|
},
|
||||||
|
removeEventListener(type, fn) {
|
||||||
|
const set = listeners.get(type);
|
||||||
|
if (set) set.delete(fn);
|
||||||
|
},
|
||||||
|
dispatchEvent(event) {
|
||||||
|
if (listeners.has(event.type)) fire(event.type, event);
|
||||||
|
else host.dispatchEvent(event);
|
||||||
|
return !event.defaultPrevented;
|
||||||
|
},
|
||||||
|
emitInput() {
|
||||||
|
fire("input");
|
||||||
|
},
|
||||||
|
destroy() {
|
||||||
|
listeners.clear();
|
||||||
|
view.destroy();
|
||||||
|
},
|
||||||
|
};
|
||||||
|
if (off) host.classList.add("is-disabled");
|
||||||
|
host.field = field;
|
||||||
|
return field;
|
||||||
|
}
|
||||||
@@ -156,8 +156,9 @@ function build(view) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Redraws on what can change the picture: the text, the selection (which
|
// Redraws on what can change the picture: the text, the selection (which
|
||||||
// lines are active), the lines in view, and the parse catching up.
|
// lines are active), the lines in view, and the parse catching up. Exported:
|
||||||
const livePreview = ViewPlugin.fromClass(
|
// md-field.js puts the same live preview in every answer box.
|
||||||
|
export const livePreview = ViewPlugin.fromClass(
|
||||||
class {
|
class {
|
||||||
constructor(view) {
|
constructor(view) {
|
||||||
this.decorations = build(view);
|
this.decorations = build(view);
|
||||||
|
|||||||
@@ -118,9 +118,9 @@ function askStarters(ss) {
|
|||||||
saveNow();
|
saveNow();
|
||||||
redraw();
|
redraw();
|
||||||
const ta = $("ask-input");
|
const ta = $("ask-input");
|
||||||
if (!ta) return;
|
if (!ta || !ta.field) return;
|
||||||
ta.focus();
|
ta.field.focus();
|
||||||
ta.setSelectionRange(ta.value.length, ta.value.length);
|
ta.field.setSelectionRange(ta.field.value.length, ta.field.value.length);
|
||||||
});
|
});
|
||||||
box.appendChild(b);
|
box.appendChild(b);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import {
|
|||||||
attachTray,
|
attachTray,
|
||||||
} from "../uploads.js";
|
} from "../uploads.js";
|
||||||
import { attachMentions } from "../mention-box.js";
|
import { attachMentions } from "../mention-box.js";
|
||||||
|
import { makeMdField } from "../md-field.js";
|
||||||
import { TEMPLATE_WORKFLOWS, templatesFor, templateSwap } from "../starters.js";
|
import { TEMPLATE_WORKFLOWS, templatesFor, templateSwap } from "../starters.js";
|
||||||
import { looks } from "../looks.js";
|
import { looks } from "../looks.js";
|
||||||
|
|
||||||
@@ -109,13 +110,13 @@ export function markMore() {
|
|||||||
function markGrowBox(card) {
|
function markGrowBox(card) {
|
||||||
if (!card) return;
|
if (!card) return;
|
||||||
const id = card.dataset.item;
|
const id = card.dataset.item;
|
||||||
const areas = [...card.querySelectorAll("textarea")];
|
const areas = [...card.querySelectorAll(".md-host")];
|
||||||
// Not over the git board: the column there flows card and board at natural
|
// Not over the git board: the column there flows card and board at natural
|
||||||
// height, so there is no free height for a box to grow into.
|
// height, so there is no free height for a box to grow into.
|
||||||
const box = isGitBoard()
|
const box = isGitBoard()
|
||||||
? null
|
? null
|
||||||
: areas.find((t) => t.id === "text-" + id) ||
|
: areas.find((t) => t.id === "text-" + id) ||
|
||||||
card.querySelector(".option.is-other.is-picked textarea.other-text") ||
|
card.querySelector(".option.is-other.is-picked .md-host.other-text") ||
|
||||||
areas.find((t) => t.id === "note-" + id);
|
areas.find((t) => t.id === "note-" + id);
|
||||||
// Only a box that stops being the one gives its fill back, so a keystroke
|
// Only a box that stops being the one gives its fill back, so a keystroke
|
||||||
// that re-marks the same box leaves its height alone.
|
// that re-marks the same box leaves its height alone.
|
||||||
@@ -148,7 +149,7 @@ function naturalHeight(card) {
|
|||||||
// handle only ever make it taller: resize: vertical alone cannot hold a floor
|
// handle only ever make it taller: resize: vertical alone cannot hold a floor
|
||||||
// that moves with the window. Below a 160px fill the card scrolls instead.
|
// that moves with the window. Below a 160px fill the card scrolls instead.
|
||||||
export function fitGrowBox() {
|
export function fitGrowBox() {
|
||||||
const box = $("main").querySelector(":scope > .card.has-grow textarea.grow");
|
const box = $("main").querySelector(":scope > .card.has-grow .md-host.grow");
|
||||||
if (!box) return;
|
if (!box) return;
|
||||||
const card = box.closest(".card");
|
const card = box.closest(".card");
|
||||||
const other = naturalHeight(card) - box.offsetHeight;
|
const other = naturalHeight(card) - box.offsetHeight;
|
||||||
@@ -664,15 +665,18 @@ function otherOption(list, item, staged, name) {
|
|||||||
head.appendChild(label);
|
head.appendChild(label);
|
||||||
body.appendChild(head);
|
body.appendChild(head);
|
||||||
|
|
||||||
const ta = el("textarea", "other-text");
|
const ta = makeMdField({
|
||||||
ta.id = id;
|
id,
|
||||||
ta.placeholder = "If none of the above fit, say what does.";
|
className: "other-text",
|
||||||
// A draft survives picking a listed option, so switching back and forth
|
placeholder: "If none of the above fit, say what does.",
|
||||||
// never costs someone the sentence they already wrote.
|
label: "Something else, in your own words",
|
||||||
ta.value = (on && staged.text) || page.local.drafts[id] || "";
|
// A draft survives picking a listed option, so switching back and forth
|
||||||
|
// never costs someone the sentence they already wrote.
|
||||||
|
value: (on && staged.text) || page.local.drafts[id] || "",
|
||||||
|
});
|
||||||
|
|
||||||
// Repaint the row highlights without a full render, which would rebuild this
|
// Repaint the row highlights without a full render, which would rebuild this
|
||||||
// textarea mid-keystroke. Setting the radio marks the rest of the group off
|
// box mid-keystroke. Setting the radio marks the rest of the group off
|
||||||
// by itself; only the `is-picked` classes need saying out loud.
|
// by itself; only the `is-picked` classes need saying out loud.
|
||||||
const pick = (chosen) => {
|
const pick = (chosen) => {
|
||||||
for (const node of list.children) node.classList.toggle("is-picked", node === chosen);
|
for (const node of list.children) node.classList.toggle("is-picked", node === chosen);
|
||||||
@@ -707,7 +711,10 @@ function otherOption(list, item, staged, name) {
|
|||||||
ta.focus();
|
ta.focus();
|
||||||
});
|
});
|
||||||
|
|
||||||
body.appendChild(ta);
|
// htmlFor cannot reach a div the way it reached the textarea: the label's
|
||||||
|
// click hands the field its focus here instead.
|
||||||
|
label.addEventListener("click", () => ta.focus());
|
||||||
|
body.appendChild(ta.el);
|
||||||
li.appendChild(radio);
|
li.appendChild(radio);
|
||||||
li.appendChild(body);
|
li.appendChild(body);
|
||||||
list.appendChild(li);
|
list.appendChild(li);
|
||||||
@@ -725,10 +732,12 @@ function otherField(card, item, staged) {
|
|||||||
const label = el("label", null, "Anything else, in your own words");
|
const label = el("label", null, "Anything else, in your own words");
|
||||||
label.htmlFor = id;
|
label.htmlFor = id;
|
||||||
wrap.appendChild(label);
|
wrap.appendChild(label);
|
||||||
const ta = el("textarea");
|
const ta = makeMdField({
|
||||||
ta.id = id;
|
id,
|
||||||
ta.placeholder = "Optional. This adds to the ones you picked above; it does not replace them.";
|
placeholder: "Optional. This adds to the ones you picked above; it does not replace them.",
|
||||||
ta.value = (staged && staged.text) || page.local.drafts[id] || "";
|
label: "Anything else, in your own words",
|
||||||
|
value: (staged && staged.text) || page.local.drafts[id] || "",
|
||||||
|
});
|
||||||
ta.addEventListener("input", () => {
|
ta.addEventListener("input", () => {
|
||||||
setDraft(id, ta.value);
|
setDraft(id, ta.value);
|
||||||
const cur = page.local.staged[item.id];
|
const cur = page.local.staged[item.id];
|
||||||
@@ -741,7 +750,7 @@ function otherField(card, item, staged) {
|
|||||||
}
|
}
|
||||||
stagedChanged();
|
stagedChanged();
|
||||||
});
|
});
|
||||||
wrap.appendChild(ta);
|
wrap.appendChild(ta.el);
|
||||||
card.appendChild(wrap);
|
card.appendChild(wrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -990,11 +999,20 @@ function buildText(card, item, staged) {
|
|||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
const single = Boolean(pattern);
|
const single = Boolean(pattern);
|
||||||
const input = el(single ? "input" : "textarea");
|
const input = single
|
||||||
if (single) input.type = "text";
|
? el("input")
|
||||||
input.id = id;
|
: makeMdField({
|
||||||
input.placeholder = item.placeholder || "Type here. Plain language is fine.";
|
id,
|
||||||
input.value = (staged && staged.text) || page.local.drafts[id] || "";
|
placeholder: item.placeholder || "Type here. Plain language is fine.",
|
||||||
|
label: item.inputLabel || "Your answer",
|
||||||
|
value: (staged && staged.text) || page.local.drafts[id] || "",
|
||||||
|
});
|
||||||
|
if (single) {
|
||||||
|
input.type = "text";
|
||||||
|
input.id = id;
|
||||||
|
input.placeholder = item.placeholder || "Type here. Plain language is fine.";
|
||||||
|
input.value = (staged && staged.text) || page.local.drafts[id] || "";
|
||||||
|
}
|
||||||
attachMentions(input);
|
attachMentions(input);
|
||||||
|
|
||||||
const err = el("p", "field-error");
|
const err = el("p", "field-error");
|
||||||
@@ -1049,7 +1067,9 @@ function buildText(card, item, staged) {
|
|||||||
if (item.templates === "idea" && TEMPLATE_WORKFLOWS.includes(page.S.workflow)) {
|
if (item.templates === "idea" && TEMPLATE_WORKFLOWS.includes(page.S.workflow)) {
|
||||||
wrap.appendChild(templateRow(item, input, templatesFor(page.S.workflow, looks.role), check));
|
wrap.appendChild(templateRow(item, input, templatesFor(page.S.workflow, looks.role), check));
|
||||||
}
|
}
|
||||||
wrap.appendChild(input);
|
// A Markdown field's host is .el; the single-line input appends as itself.
|
||||||
|
wrap.appendChild(input.el || input);
|
||||||
|
if (!single) label.addEventListener("click", () => input.focus());
|
||||||
// Fresh-idea boxes take files as context, the same ones the note pane holds,
|
// Fresh-idea boxes take files as context, the same ones the note pane holds,
|
||||||
// and so does any box the page fills from a Notebook tab (Revise plan's
|
// and so does any box the page fills from a Notebook tab (Revise plan's
|
||||||
// "What should change"), whose ticked pictures land here.
|
// "What should change"), whose ticked pictures land here.
|
||||||
@@ -1573,10 +1593,12 @@ function commentField(card, item, labelText, required, quickAnswers = []) {
|
|||||||
wrap.appendChild(b);
|
wrap.appendChild(b);
|
||||||
return [b, text];
|
return [b, text];
|
||||||
});
|
});
|
||||||
const ta = el("textarea");
|
const ta = makeMdField({
|
||||||
ta.id = id;
|
id,
|
||||||
ta.placeholder = required ? "Tell Plan2Code what to change." : "Optional.";
|
placeholder: required ? "Tell Plan2Code what to change." : "Optional.",
|
||||||
ta.value = (page.local.staged[item.id] && page.local.staged[item.id].text) || page.local.drafts[id] || "";
|
label: labelText,
|
||||||
|
value: (page.local.staged[item.id] && page.local.staged[item.id].text) || page.local.drafts[id] || "",
|
||||||
|
});
|
||||||
attachMentions(ta);
|
attachMentions(ta);
|
||||||
ta.addEventListener("input", () => {
|
ta.addEventListener("input", () => {
|
||||||
setDraft(id, ta.value);
|
setDraft(id, ta.value);
|
||||||
@@ -1592,11 +1614,12 @@ function commentField(card, item, labelText, required, quickAnswers = []) {
|
|||||||
stageQuiet(item.id, { type: "answer", kind: item.kind, text: ta.value.trim() });
|
stageQuiet(item.id, { type: "answer", kind: item.kind, text: ta.value.trim() });
|
||||||
stagedChanged();
|
stagedChanged();
|
||||||
});
|
});
|
||||||
wrap.appendChild(ta);
|
label.addEventListener("click", () => ta.focus());
|
||||||
|
wrap.appendChild(ta.el);
|
||||||
for (const [b, text] of quicks)
|
for (const [b, text] of quicks)
|
||||||
b.addEventListener("click", () => {
|
b.addEventListener("click", () => {
|
||||||
ta.value = text;
|
ta.value = text;
|
||||||
ta.dispatchEvent(new Event("input", { bubbles: true }));
|
ta.emitInput();
|
||||||
ta.focus();
|
ta.focus();
|
||||||
});
|
});
|
||||||
card.appendChild(wrap);
|
card.appendChild(wrap);
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import {
|
|||||||
unreadDot,
|
unreadDot,
|
||||||
} from "../chat.js";
|
} from "../chat.js";
|
||||||
import { copyButton, el, isMac, textWithCode } from "../render.js";
|
import { copyButton, el, isMac, textWithCode } from "../render.js";
|
||||||
import { isBuild } from "../skills.js";
|
import { isBuild, isAgentless } from "../skills.js";
|
||||||
import { startsClean } from "../hops.js";
|
import { startsClean } from "../hops.js";
|
||||||
import { faviconState, setFavicon } from "../favicon.js";
|
import { faviconState, setFavicon } from "../favicon.js";
|
||||||
import { helperRows, showTab } from "../subagents.js";
|
import { helperRows, showTab } from "../subagents.js";
|
||||||
@@ -73,6 +73,8 @@ import { askOfflineFlipped, askState, declineOpen, renderAside, renderAsk, rende
|
|||||||
import { renderHandoff, renderLoopEnd, renderHomeButton, renderStopButton, renderStopControls, renderStopping, stopInProgress, stopWarning } from "./ending.js";
|
import { renderHandoff, renderLoopEnd, renderHomeButton, renderStopButton, renderStopControls, renderStopping, stopInProgress, stopWarning } from "./ending.js";
|
||||||
import { renderNotepadButton } from "./notepad.js";
|
import { renderNotepadButton } from "./notepad.js";
|
||||||
import { renderActivities } from "./activities.js";
|
import { renderActivities } from "./activities.js";
|
||||||
|
import { renderSetup, setupMoved } from "./setup.js";
|
||||||
|
import { mountAgentsView } from "./agents-view.js";
|
||||||
|
|
||||||
// What the entry needs from the screens at start-up, handed on from here: only
|
// What the entry needs from the screens at start-up, handed on from here: only
|
||||||
// the core imports a screen.
|
// the core imports a screen.
|
||||||
@@ -187,6 +189,11 @@ function settleStaleUploads() {
|
|||||||
// fetched, so a redraw or a reload never fills the box a second time.
|
// fetched, so a redraw or a reload never fills the box a second time.
|
||||||
function fillNoteBox() {
|
function fillNoteBox() {
|
||||||
const ns = page.local.noteSend;
|
const ns = page.local.noteSend;
|
||||||
|
// An agent-less session has nobody to fill a box for; a leftover pick is dropped.
|
||||||
|
if (ns && isAgentless(page.S.workflow)) {
|
||||||
|
page.local.noteSend = null;
|
||||||
|
save();
|
||||||
|
}
|
||||||
if (!ns || isDashboard() || finish() || page.S.workflow !== ns.workflow) return;
|
if (!ns || isDashboard() || finish() || page.S.workflow !== ns.workflow) return;
|
||||||
const item = items().find((i) => i.kind === "text" && i.fill === "note" && i.status === "open");
|
const item = items().find((i) => i.kind === "text" && i.fill === "note" && i.status === "open");
|
||||||
if (!item) return;
|
if (!item) return;
|
||||||
@@ -564,11 +571,13 @@ function scrollRail(where) {
|
|||||||
|
|
||||||
let arrivalBannerTimer = null;
|
let arrivalBannerTimer = null;
|
||||||
|
|
||||||
// Typing in any text field, the question's own or the notes beside it.
|
// Typing in any text field, the question's own or the notes beside it. A
|
||||||
|
// focused Markdown field surfaces as its .md-host (the editor inside its
|
||||||
|
// shadow root is what document.activeElement cannot see).
|
||||||
function typingHere() {
|
function typingHere() {
|
||||||
const a = document.activeElement;
|
const a = document.activeElement;
|
||||||
if (!a) return false;
|
if (!a) return false;
|
||||||
return a.tagName === "TEXTAREA" || (a.tagName === "INPUT" && (a.type === "text" || a.type === "date"));
|
return Boolean(a.field) || a.tagName === "TEXTAREA" || (a.tagName === "INPUT" && (a.type === "text" || a.type === "date"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// The moment the ball comes back.
|
// The moment the ball comes back.
|
||||||
@@ -671,6 +680,18 @@ export function connect() {
|
|||||||
adopt(JSON.parse(e.data));
|
adopt(JSON.parse(e.data));
|
||||||
} catch {}
|
} catch {}
|
||||||
});
|
});
|
||||||
|
// The agent-less setup session's hand-over: the console its pick launched
|
||||||
|
// POSTed /handover, and this page moves itself to that session's url.
|
||||||
|
es.addEventListener("move", (e) => {
|
||||||
|
if (!isAgentless(page.S && page.S.workflow)) return;
|
||||||
|
try {
|
||||||
|
const u = JSON.parse(e.data).url;
|
||||||
|
if (typeof u === "string" && /^http:\/\/(127\.0\.0\.1|localhost):\d+\/s\//.test(u)) {
|
||||||
|
setupMoved(u);
|
||||||
|
location.assign(u);
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
});
|
||||||
es.addEventListener("submitted", (e) => {
|
es.addEventListener("submitted", (e) => {
|
||||||
// Drop only what was actually sent.
|
// Drop only what was actually sent.
|
||||||
//
|
//
|
||||||
@@ -788,12 +809,13 @@ export function render() {
|
|||||||
restoreScroll();
|
restoreScroll();
|
||||||
renderAside();
|
renderAside();
|
||||||
renderFooter();
|
renderFooter();
|
||||||
|
agentlessChrome();
|
||||||
});
|
});
|
||||||
// The box an `@` list belonged to was just redrawn away.
|
// The box an `@` list belonged to was just redrawn away.
|
||||||
if (page.mentionPop && !page.mentionPop.box.isConnected) closeMentions();
|
if (page.mentionPop && !page.mentionPop.box.isConnected) closeMentions();
|
||||||
if (enteringAsk) {
|
if (enteringAsk) {
|
||||||
const box = $("ask-input");
|
const box = $("ask-input");
|
||||||
if (box && !box.disabled) box.focus({ preventScroll: true });
|
if (box && box.field && !box.field.disabled) box.field.focus();
|
||||||
}
|
}
|
||||||
if (switchingTab || tabAdded) replayViewsArrow();
|
if (switchingTab || tabAdded) replayViewsArrow();
|
||||||
if (tabAdded) sound("newTab");
|
if (tabAdded) sound("newTab");
|
||||||
@@ -803,6 +825,19 @@ export function render() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// An agent-less session's top bar is down to Help: every button listed here
|
||||||
|
// either sends to the agent or reports on it, and there is no agent to reach.
|
||||||
|
// Runs after the other renders, which may re-show their button each pass.
|
||||||
|
const AGENTLESS_CHROME = ["meter-pill", "btn-activities", "btn-subagents", "btn-notepad", "btn-home", "btn-stop", "btn-brief"];
|
||||||
|
|
||||||
|
function agentlessChrome() {
|
||||||
|
if (!isAgentless(page.S && page.S.workflow)) return;
|
||||||
|
for (const id of AGENTLESS_CHROME) {
|
||||||
|
const n = $(id);
|
||||||
|
if (n) n.hidden = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// The runway chevrons beside the tabs pulse a few times on load and then rest.
|
// The runway chevrons beside the tabs pulse a few times on load and then rest.
|
||||||
// Moving to another tab, or a new tab turning up, runs them again: clearing
|
// Moving to another tab, or a new tab turning up, runs them again: clearing
|
||||||
// the animation, forcing a reflow, then handing it back restarts it from the
|
// the animation, forcing a reflow, then handing it back restarts it from the
|
||||||
@@ -901,9 +936,12 @@ function restoreMainPlace(place) {
|
|||||||
|
|
||||||
function withFocus(fn) {
|
function withFocus(fn) {
|
||||||
const a = document.activeElement;
|
const a = document.activeElement;
|
||||||
|
// A Markdown field surfaces as its host: its facade (.field) is what keeps
|
||||||
|
// the caret, and what the restore below focuses.
|
||||||
|
const box = a && a.field ? a.field : a;
|
||||||
const keep =
|
const keep =
|
||||||
a && (a.tagName === "TEXTAREA" || a.tagName === "INPUT" || a.tagName === "SELECT") && a.id
|
a && (a.field || a.tagName === "TEXTAREA" || a.tagName === "INPUT" || a.tagName === "SELECT") && a.id
|
||||||
? { id: a.id, start: a.selectionStart, end: a.selectionEnd }
|
? { id: a.id, start: box.selectionStart, end: box.selectionEnd }
|
||||||
: null;
|
: null;
|
||||||
const place = mainPlace();
|
const place = mainPlace();
|
||||||
|
|
||||||
@@ -914,10 +952,11 @@ function withFocus(fn) {
|
|||||||
restoreMainPlace(place);
|
restoreMainPlace(place);
|
||||||
if (keep) {
|
if (keep) {
|
||||||
const n = $(keep.id);
|
const n = $(keep.id);
|
||||||
if (n) {
|
const f = n && (n.field || n);
|
||||||
n.focus();
|
if (f) {
|
||||||
|
f.focus();
|
||||||
try {
|
try {
|
||||||
n.setSelectionRange(keep.start, keep.end);
|
f.setSelectionRange(keep.start, keep.end);
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1094,13 +1133,14 @@ function renderChrome() {
|
|||||||
// done the session is over, and there is one thing left to do elsewhere
|
// done the session is over, and there is one thing left to do elsewhere
|
||||||
// adrift the server is up but nothing is listening at the other end
|
// adrift the server is up but nothing is listening at the other end
|
||||||
// gone no server, eye shut
|
// gone no server, eye shut
|
||||||
|
// setup the agent-less setup page, waving while it waits on a pick
|
||||||
//
|
//
|
||||||
// Each mood is a family: v0 is the plain drawing and the rest are alternates
|
// Each mood is a family: v0 is the plain drawing and the rest are alternates
|
||||||
// (a hop, star-scanning, sparkles, Z's -- see the "mood variants"
|
// (a hop, star-scanning, sparkles, Z's -- see the "mood variants"
|
||||||
// section of app.css). A new variant is rolled only when the mood CHANGES, so
|
// section of app.css). A new variant is rolled only when the mood CHANGES, so
|
||||||
// the once-a-second status tick does not restart his animation every time it
|
// the once-a-second status tick does not restart his animation every time it
|
||||||
// runs, and the same state keeps the same face until the state itself moves.
|
// runs, and the same state keeps the same face until the state itself moves.
|
||||||
const MOOD_VARIANTS = { point: 3, work: 3, happy: 3, done: 2, adrift: 2, gone: 2 };
|
const MOOD_VARIANTS = { point: 3, work: 3, happy: 3, done: 2, adrift: 2, gone: 2, setup: 1 };
|
||||||
|
|
||||||
let moodNow = null;
|
let moodNow = null;
|
||||||
|
|
||||||
@@ -1197,6 +1237,12 @@ export function renderStatus() {
|
|||||||
tellAttention(icon);
|
tellAttention(icon);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// An agent-less session has no agent to report on: the setup page IS the
|
||||||
|
// state, so the dock's line says where it stands and nothing more.
|
||||||
|
if (isAgentless(page.S.workflow)) {
|
||||||
|
return say("setup", page.local.setupStart ? "Starting " + page.local.setupStart.label + "…" : "No agent yet. Pick one below to get started.");
|
||||||
|
}
|
||||||
|
|
||||||
// Before `gone`, deliberately. Once a session has finished, no server is the
|
// Before `gone`, deliberately. Once a session has finished, no server is the
|
||||||
// expected state, and Planny shutting his eye over it reads as a breakage.
|
// expected state, and Planny shutting his eye over it reads as a breakage.
|
||||||
if (finish()) {
|
if (finish()) {
|
||||||
@@ -1358,7 +1404,7 @@ function renderViews() {
|
|||||||
for (const d of docs()) tabs.push({ id: "doc:" + d.id, label: d.title || "Document", count: 0 });
|
for (const d of docs()) tabs.push({ id: "doc:" + d.id, label: d.title || "Document", count: 0 });
|
||||||
// The helpers the agent reported, from the first one on; cleared by a
|
// The helpers the agent reported, from the first one on; cleared by a
|
||||||
// dashboard hop, which sends the person home like the Overview tab does.
|
// dashboard hop, which sends the person home like the Overview tab does.
|
||||||
if (showTab(page.subagentsFrame, page.S.helpers)) {
|
if (showTab(page.subagentsFrame, page.S.helpers) && !isAgentless(page.S.workflow)) {
|
||||||
// From the rows the tab draws, so the badge never counts helpers the
|
// From the rows the tab draws, so the badge never counts helpers the
|
||||||
// working-alone note hides.
|
// working-alone note hides.
|
||||||
const running = helperRows(page.S.helpers).rows.filter((r) => r.state === "running").length;
|
const running = helperRows(page.S.helpers).rows.filter((r) => r.state === "running").length;
|
||||||
@@ -1366,10 +1412,13 @@ function renderViews() {
|
|||||||
} else if (page.view === "subagents") page.view = "questions";
|
} else if (page.view === "subagents") page.view = "questions";
|
||||||
// Always last, on every workflow and after a finish: the Quick question chat.
|
// Always last, on every workflow and after a finish: the Quick question chat.
|
||||||
// The ring left of "Ask" shows exactly when the conversation's own ring does:
|
// The ring left of "Ask" shows exactly when the conversation's own ring does:
|
||||||
// a question the agent picked up and has not answered yet.
|
// a question the agent picked up and has not answered yet. An agent-less
|
||||||
const ask = askState();
|
// session has nobody to ask, so the tab stays off.
|
||||||
const askBusy = ask.view.rows.some((r) => r.working) && ask.send.state !== "offline" && !agentAdrift();
|
if (!isAgentless(page.S.workflow)) {
|
||||||
tabs.push({ id: "ask", label: "Ask", count: 0, dot: page.chatDot, busy: askBusy });
|
const ask = askState();
|
||||||
|
const askBusy = ask.view.rows.some((r) => r.working) && ask.send.state !== "offline" && !agentAdrift();
|
||||||
|
tabs.push({ id: "ask", label: "Ask", count: 0, dot: page.chatDot, busy: askBusy });
|
||||||
|
} else if (page.view === "ask") page.view = "questions";
|
||||||
|
|
||||||
for (const t of tabs) {
|
for (const t of tabs) {
|
||||||
const b = el("button", "view-tab", t.label);
|
const b = el("button", "view-tab", t.label);
|
||||||
@@ -1541,6 +1590,10 @@ function paintMain(main) {
|
|||||||
main.classList.toggle("is-doc", page.view.startsWith("doc:") || isSpecFileView(page.view));
|
main.classList.toggle("is-doc", page.view.startsWith("doc:") || isSpecFileView(page.view));
|
||||||
main.classList.toggle("is-ask", page.view === "ask");
|
main.classList.toggle("is-ask", page.view === "ask");
|
||||||
|
|
||||||
|
// An agent-less session has no questions, docs or board to draw: its whole
|
||||||
|
// pane is the setup screen.
|
||||||
|
if (isAgentless(page.S.workflow)) return renderSetup(main, mountAgentsView);
|
||||||
|
|
||||||
if (page.view.startsWith("doc:")) return renderDoc(main, page.view.slice(4));
|
if (page.view.startsWith("doc:")) return renderDoc(main, page.view.slice(4));
|
||||||
if (isSpecFileView(page.view)) return renderOverview(main, page.view);
|
if (isSpecFileView(page.view)) return renderOverview(main, page.view);
|
||||||
if (page.view === "ask") return renderAsk(main);
|
if (page.view === "ask") return renderAsk(main);
|
||||||
|
|||||||
@@ -70,6 +70,7 @@
|
|||||||
.ask-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
|
.ask-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||||
.ask-about { margin: 0 0 4px; font-size: 11.5px; font-weight: 600; color: var(--accent); }
|
.ask-about { margin: 0 0 4px; font-size: 11.5px; font-weight: 600; color: var(--accent); }
|
||||||
.ask-decision { margin: 0; font-weight: 600; }
|
.ask-decision { margin: 0; font-weight: 600; }
|
||||||
|
.ask-decision.working { display: flex; align-items: center; gap: 8px; }
|
||||||
.ask-waiting { margin: 6px 0 0; font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
|
.ask-waiting { margin: 6px 0 0; font-size: 12px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
|
||||||
.ask-failed { color: var(--warn); }
|
.ask-failed { color: var(--warn); }
|
||||||
|
|
||||||
@@ -94,8 +95,8 @@
|
|||||||
background: var(--panel);
|
background: var(--panel);
|
||||||
}
|
}
|
||||||
.ask-composer.is-dropping { outline: 2px dashed var(--accent); outline-offset: -6px; background: var(--accent-soft); }
|
.ask-composer.is-dropping { outline: 2px dashed var(--accent); outline-offset: -6px; background: var(--accent-soft); }
|
||||||
.ask-composer textarea { min-height: 64px; max-height: 40vh; }
|
.ask-composer .md-host { min-height: 64px; max-height: 40vh; }
|
||||||
.ask-composer textarea:disabled { opacity: 0.6; cursor: not-allowed; }
|
.ask-composer .md-host.is-disabled { opacity: 0.6; cursor: not-allowed; }
|
||||||
.ask-about-chip {
|
.ask-about-chip {
|
||||||
display: inline-flex; align-items: center; gap: 8px;
|
display: inline-flex; align-items: center; gap: 8px;
|
||||||
margin-bottom: 8px; padding: 3px 4px 3px 11px;
|
margin-bottom: 8px; padding: 3px 4px 3px 11px;
|
||||||
|
|||||||
@@ -22,9 +22,10 @@
|
|||||||
min-height: 0;
|
min-height: 0;
|
||||||
}
|
}
|
||||||
/* In the board's card slot a card's boxes cannot fill the column (it flows,
|
/* In the board's card slot a card's boxes cannot fill the column (it flows,
|
||||||
it does not stretch), so a note box grows with what is typed instead, where
|
it does not stretch), so a note box grows with what is typed instead,
|
||||||
the browser can, rather than scrolling inside a 96px box. */
|
rather than scrolling inside a 96px box: an auto-height host does for the
|
||||||
.git-cards > .card textarea { field-sizing: content; max-height: 50vh; }
|
Markdown field what field-sizing did for the textarea. */
|
||||||
|
.git-cards > .card .md-host { min-height: 0; max-height: 50vh; }
|
||||||
/* The card and the pager center themselves with auto inline margins, and a
|
/* The card and the pager center themselves with auto inline margins, and a
|
||||||
grid item with auto margins shrinks to its content, so a short confirm sat
|
grid item with auto margins shrinks to its content, so a short confirm sat
|
||||||
narrow in the middle of the board. In the slot both fill the board's width
|
narrow in the middle of the board. In the slot both fill the board's width
|
||||||
|
|||||||
@@ -367,25 +367,30 @@
|
|||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
textarea, input[type="text"] {
|
textarea, input[type="text"], .md-host {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
font: inherit;
|
font: inherit;
|
||||||
color: var(--ink);
|
color: var(--ink);
|
||||||
background: var(--panel-2);
|
background: var(--panel-2);
|
||||||
border: 1px solid var(--rule-2);
|
border: 1px solid var(--rule-2);
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
padding: 11px 13px;
|
|
||||||
resize: vertical;
|
|
||||||
}
|
}
|
||||||
textarea { min-height: 96px; }
|
textarea, input[type="text"] { padding: 11px 13px; resize: vertical; }
|
||||||
|
/* A Markdown field's size lives on the host (the editor inside fills it), so
|
||||||
|
the shared rules name .md-host wherever a textarea used to sit; its
|
||||||
|
overflow is clipped both so resize: vertical has a box to drag and so the
|
||||||
|
editor's own scroller is the only scroller. */
|
||||||
|
textarea, .md-host { min-height: 96px; }
|
||||||
|
.md-host { resize: vertical; overflow: hidden; }
|
||||||
/* No max-height: the handle can pull the box past the fill, and the card then
|
/* No max-height: the handle can pull the box past the fill, and the card then
|
||||||
scrolls. Its min-height is the fill, written by app.js. */
|
scrolls. Its min-height is the fill, written by app.js. */
|
||||||
textarea.grow { resize: vertical; }
|
textarea.grow, .md-host.grow { resize: vertical; }
|
||||||
/* The border going accent IS the focus signal here, so the page-wide blue
|
/* The border going accent IS the focus signal here, so the page-wide blue
|
||||||
:focus-visible outline comes off: on a bordered field it reads as a second,
|
:focus-visible outline comes off: on a bordered field it reads as a second,
|
||||||
clashing ring. */
|
clashing ring. */
|
||||||
textarea:focus, input[type="text"]:focus { border-color: var(--accent); outline: none; }
|
textarea:focus, input[type="text"]:focus, .md-host:focus-within { border-color: var(--accent); outline: none; }
|
||||||
input[type="text"].invalid { border-color: var(--warn); }
|
input[type="text"].invalid, .md-host.invalid { border-color: var(--warn); }
|
||||||
|
.md-host.is-disabled { opacity: 0.6; cursor: not-allowed; }
|
||||||
|
|
||||||
.field-error { color: var(--warn); font-size: 13px; margin-top: 6px; }
|
.field-error { color: var(--warn); font-size: 13px; margin-top: 6px; }
|
||||||
.field-ok { color: var(--ok); font-size: 13px; margin-top: 6px; }
|
.field-ok { color: var(--ok); font-size: 13px; margin-top: 6px; }
|
||||||
@@ -787,9 +792,10 @@ h4.md-h, h5.md-h, h6.md-h { font-size: 15px; }
|
|||||||
@media (max-width: 720px) {
|
@media (max-width: 720px) {
|
||||||
.looks-row, .looks-row.four { grid-template-columns: 1fr; }
|
.looks-row, .looks-row.four { grid-template-columns: 1fr; }
|
||||||
}
|
}
|
||||||
/* User Preferences itself (not the dialogs borrowing .looks): wider, and only
|
/* User Preferences itself (not the dialogs borrowing .looks): takes the card
|
||||||
the body scrolls, so Back to default and Done never leave the screen. */
|
width the person picked, never wider than the wide preset (1080px), and
|
||||||
.modal.prefs { max-width: 880px; }
|
only the body scrolls, so Back to default and Done never leave the screen. */
|
||||||
|
.modal.prefs { width: min(1080px, var(--card-width), calc(100vw - 32px)); max-width: none; }
|
||||||
.modal.prefs[open] { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
|
.modal.prefs[open] { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
|
||||||
.prefs-body { overflow-y: auto; min-height: 0; flex: 1 1 auto; margin-right: -12px; padding-right: 12px; padding-top: 10px; }
|
.prefs-body { overflow-y: auto; min-height: 0; flex: 1 1 auto; margin-right: -12px; padding-right: 12px; padding-top: 10px; }
|
||||||
/* A line scrolled up under the title fades out rather than being sliced. */
|
/* A line scrolled up under the title fades out rather than being sliced. */
|
||||||
|
|||||||
+15
-15
@@ -1,21 +1,21 @@
|
|||||||
/* CodeMirror 6 (state, view, language, commands, lang-markdown), MIT licence, (c) Marijn Haverbeke and others.
|
/* CodeMirror 6 (state, view, language, commands, lang-markdown), MIT license, (c) Marijn Haverbeke and others.
|
||||||
* https://codemirror.net/ . Bundled by scripts/vendor-codemirror.mjs; do not edit by hand.
|
* https://codemirror.net/ . Bundled by scripts/vendor-codemirror.mjs; do not edit by hand.
|
||||||
* Versions: @codemirror/state 6.7.6, @codemirror/view 6.43.15, @codemirror/language 6.13.1, @codemirror/commands 6.11.1, @codemirror/lang-markdown 6.5.2 */
|
* Versions: @codemirror/state 6.7.6, @codemirror/view 6.43.15, @codemirror/language 6.13.1, @codemirror/commands 6.11.1, @codemirror/lang-markdown 6.5.2 */
|
||||||
var Br=[],Fl=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?Fl:Br).push(t=t+n[e])})();function td(n){if(n<768)return!1;for(let e=0,t=Br.length;;){let i=e+t>>1;if(n<Br[i])t=i;else if(n>=Fl[i])e=i+1;else return!0;if(e==t)return!1}}function Nl(n){return n>=127462&&n<=127487}var Ul=8205;function Hl(n,e,t=!0,i=!0){return(t?Kl:id)(n,e,i)}function Kl(n,e,t){if(e==n.length)return e;e&&Jl(n.charCodeAt(e))&&ea(n.charCodeAt(e-1))&&e--;let i=Dr(n,e);for(e+=Gl(i);e<n.length;){let r=Dr(n,e);if(i==Ul||r==Ul||t&&td(r))e+=Gl(r),i=r;else if(Nl(r)){let s=0,o=e-2;for(;o>=0&&Nl(Dr(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function id(n,e,t){for(;e>1;){let i=Kl(n,e-2,t);if(i<e)return i;e--}return 0}function Dr(n,e){let t=n.charCodeAt(e);if(!ea(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Jl(i)?(t-55296<<10)+(i-56320)+65536:t}function Jl(n){return n>=56320&&n<57344}function ea(n){return n>=55296&&n<56320}function Gl(n){return n<65536?1:2}var j=class n{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=li(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),ri.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=li(this,e,t);let i=[];return this.decompose(e,t,i,0),ri.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new _t(this),s=new _t(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(e=1){return new _t(this,e)}iterRange(e,t=this.length){return new Rn(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Mn(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?n.empty:e.length<=32?new Se(e):ri.from(Se.split(e,[]))}},Se=class n extends j{constructor(e,t=nd(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?i:l)>=e)return new Wr(r,l,i,o);r=l+1,i++}}decompose(e,t,i,r){let s=e<=0&&t>=this.length?this:new n(ta(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=i.pop(),l=An(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new n(l,o.length+s.length));else{let a=l.length>>1;i.push(new n(l.slice(0,a)),new n(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof n))return super.replace(e,t,i);[e,t]=li(this,e,t);let r=An(this.text,An(i.text,ta(this.text,0,e)),t),s=this.length+i.length-(t-e);return r.length<=32?new n(r,s):ri.from(n.split(r,[]),s)}sliceString(e,t=this.length,i=`
|
var Br=[],Hl=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?Hl:Br).push(t=t+n[e])})();function id(n){if(n<768)return!1;for(let e=0,t=Br.length;;){let i=e+t>>1;if(n<Br[i])t=i;else if(n>=Hl[i])e=i+1;else return!0;if(e==t)return!1}}function Ul(n){return n>=127462&&n<=127487}var Gl=8205;function Kl(n,e,t=!0,i=!0){return(t?Jl:nd)(n,e,i)}function Jl(n,e,t){if(e==n.length)return e;e&&ea(n.charCodeAt(e))&&ta(n.charCodeAt(e-1))&&e--;let i=Dr(n,e);for(e+=Fl(i);e<n.length;){let r=Dr(n,e);if(i==Gl||r==Gl||t&&id(r))e+=Fl(r),i=r;else if(Ul(r)){let s=0,o=e-2;for(;o>=0&&Ul(Dr(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function nd(n,e,t){for(;e>1;){let i=Jl(n,e-2,t);if(i<e)return i;e--}return 0}function Dr(n,e){let t=n.charCodeAt(e);if(!ta(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return ea(i)?(t-55296<<10)+(i-56320)+65536:t}function ea(n){return n>=56320&&n<57344}function ta(n){return n>=55296&&n<56320}function Fl(n){return n<65536?1:2}var j=class n{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=li(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),ri.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=li(this,e,t);let i=[];return this.decompose(e,t,i,0),ri.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new _t(this),s=new _t(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(e=1){return new _t(this,e)}iterRange(e,t=this.length){return new jn(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Ln(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?n.empty:e.length<=32?new Se(e):ri.from(Se.split(e,[]))}},Se=class n extends j{constructor(e,t=rd(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?i:l)>=e)return new Wr(r,l,i,o);r=l+1,i++}}decompose(e,t,i,r){let s=e<=0&&t>=this.length?this:new n(ia(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=i.pop(),l=Mn(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new n(l,o.length+s.length));else{let a=l.length>>1;i.push(new n(l.slice(0,a)),new n(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof n))return super.replace(e,t,i);[e,t]=li(this,e,t);let r=Mn(this.text,Mn(i.text,ia(this.text,0,e)),t),s=this.length+i.length-(t-e);return r.length<=32?new n(r,s):ri.from(n.split(r,[]),s)}sliceString(e,t=this.length,i=`
|
||||||
`){[e,t]=li(this,e,t);let r="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(r+=i),e<a&&t>s&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],r=-1;for(let s of e)i.push(s),r+=s.length+1,i.length==32&&(t.push(new n(i,r)),i=[],r=-1);return r>-1&&t.push(new n(i,r)),t}},ri=class n extends j{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,r);r=l+1,i=a+1}}decompose(e,t,i,r){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let h=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=li(this,e,t),i.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let f=this.children.slice();return f[r]=a,new n(f,this.length-(t-e)+i.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
`){[e,t]=li(this,e,t);let r="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(r+=i),e<a&&t>s&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],r=-1;for(let s of e)i.push(s),r+=s.length+1,i.length==32&&(t.push(new n(i,r)),i=[],r=-1);return r>-1&&t.push(new n(i,r)),t}},ri=class n extends j{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,r);r=l+1,i=a+1}}decompose(e,t,i,r){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let h=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=li(this,e,t),i.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let f=this.children.slice();return f[r]=a,new n(f,this.length-(t-e)+i.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
||||||
`){[e,t]=li(this,e,t);let r="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=i),e<a&&t>o&&(r+=l.sliceString(e-o,t-o,i)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof n))return 0;let i=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return i;let a=this.children[r],h=e.children[s];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let O of e)O.flatten(d);return new Se(d,t)}let r=Math.max(32,i>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,f=[];function c(d){let O;if(d.lines>s&&d instanceof n)for(let p of d.children)c(p);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof Se&&a&&(O=f[f.length-1])instanceof Se&&d.lines+O.lines<=32?(a+=d.lines,h+=d.length+1,f[f.length-1]=new Se(O.text.concat(d.text),O.length+1+d.length)):(a+d.lines>r&&u(),a+=d.lines,h+=d.length+1,f.push(d))}function u(){a!=0&&(l.push(f.length==1?f[0]:n.from(f,h)),h=-1,a=f.length=0)}for(let d of e)c(d);return u(),l.length==1?l[0]:new n(l,t)}};j.empty=new Se([""],0);function nd(n){let e=-1;for(let t of n)e+=t.length+1;return e}function An(n,e,t=0,i=1e9){for(let r=0,s=0,o=!0;s<n.length&&r<=i;s++){let l=n[s],a=r+l.length;a>=t&&(a>i&&(l=l.slice(0,i-r)),r<t&&(l=l.slice(t-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function ta(n,e,t){return An(n,[""],e,t)}var _t=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Se?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],s=this.offsets[i],o=s>>1,l=r instanceof Se?r.text.length:r.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
`){[e,t]=li(this,e,t);let r="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=i),e<a&&t>o&&(r+=l.sliceString(e-o,t-o,i)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof n))return 0;let i=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return i;let a=this.children[r],h=e.children[s];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let O of e)O.flatten(d);return new Se(d,t)}let r=Math.max(32,i>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,f=[];function c(d){let O;if(d.lines>s&&d instanceof n)for(let p of d.children)c(p);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof Se&&a&&(O=f[f.length-1])instanceof Se&&d.lines+O.lines<=32?(a+=d.lines,h+=d.length+1,f[f.length-1]=new Se(O.text.concat(d.text),O.length+1+d.length)):(a+d.lines>r&&u(),a+=d.lines,h+=d.length+1,f.push(d))}function u(){a!=0&&(l.push(f.length==1?f[0]:n.from(f,h)),h=-1,a=f.length=0)}for(let d of e)c(d);return u(),l.length==1?l[0]:new n(l,t)}};j.empty=new Se([""],0);function rd(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Mn(n,e,t=0,i=1e9){for(let r=0,s=0,o=!0;s<n.length&&r<=i;s++){let l=n[s],a=r+l.length;a>=t&&(a>i&&(l=l.slice(0,i-r)),r<t&&(l=l.slice(t-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function ia(n,e,t){return Mn(n,[""],e,t)}var _t=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Se?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],s=this.offsets[i],o=s>>1,l=r instanceof Se?r.text.length:r.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
||||||
`,this;e--}else if(r instanceof Se){let a=r.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof Se?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Rn=class{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new _t(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Mn=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(j.prototype[Symbol.iterator]=function(){return this.iter()},_t.prototype[Symbol.iterator]=Rn.prototype[Symbol.iterator]=Mn.prototype[Symbol.iterator]=function(){return this});var Wr=class{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}};function li(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function ie(n,e,t=!0,i=!0){return Hl(n,e,t,i)}function rd(n){return n>=56320&&n<57344}function sd(n){return n>=55296&&n<56320}function ns(n,e){let t=n.charCodeAt(e);if(!sd(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return rd(i)?(t-55296<<10)+(i-56320)+65536:t}function rs(n){return n<65536?1:2}var Vr=/\r\n?|\n/,oe=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(oe||(oe={})),tt=class n{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,r=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,r,s),r+=s):r+=o,i+=s}}iterChangedRanges(e,t=!1){Ir(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new n(e)}composeDesc(e){return this.empty?e:e.empty?this:oa(this,e)}mapDesc(e,t=!1){return e.empty?this:Nr(this,e,t)}mapPos(e,t=-1,i=oe.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=r+l;if(a<0){if(h>e)return s+(e-r);s+=l}else{if(i!=oe.Simple&&h>=e&&(i==oe.TrackDel&&r<e&&h>e||i==oe.TrackBefore&&r<e||i==oe.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==r||t<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let s=this.sections[i++],o=this.sections[i++],l=r+s;if(o>=0&&r<=t&&l>=e)return r<e&&l>t?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new n(e)}static create(e){return new n(e)}},he=class n extends tt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Ir(this,(t,i,r,s,o)=>e=e.replace(r,r+(i-t),o),!1),e}mapDesc(e,t=!1){return Nr(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,s=0;r<t.length;r+=2){let o=t[r],l=t[r+1];if(l>=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;i.length<a;)i.push(j.empty);i.push(o?e.slice(s,s+o):j.empty)}s+=o}return new n(t,i)}compose(e){return this.empty?e:e.empty?this:oa(this,e,!0)}map(e,t=!1){return e.empty?this:Nr(this,e,t,!0)}iterChanges(e,t=!1){Ir(this,e,t)}get desc(){return tt.create(this.sections)}filter(e){let t=[],i=[],r=[],s=new Dt(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++
Line truncated
|
`,this;e--}else if(r instanceof Se){let a=r.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof Se?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},jn=class{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new _t(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Ln=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(j.prototype[Symbol.iterator]=function(){return this.iter()},_t.prototype[Symbol.iterator]=jn.prototype[Symbol.iterator]=Ln.prototype[Symbol.iterator]=function(){return this});var Wr=class{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}};function li(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function ie(n,e,t=!0,i=!0){return Kl(n,e,t,i)}function sd(n){return n>=56320&&n<57344}function od(n){return n>=55296&&n<56320}function ns(n,e){let t=n.charCodeAt(e);if(!od(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return sd(i)?(t-55296<<10)+(i-56320)+65536:t}function rs(n){return n<65536?1:2}var Vr=/\r\n?|\n/,oe=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(oe||(oe={})),tt=class n{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,r=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,r,s),r+=s):r+=o,i+=s}}iterChangedRanges(e,t=!1){Ir(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new n(e)}composeDesc(e){return this.empty?e:e.empty?this:la(this,e)}mapDesc(e,t=!1){return e.empty?this:Nr(this,e,t)}mapPos(e,t=-1,i=oe.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=r+l;if(a<0){if(h>e)return s+(e-r);s+=l}else{if(i!=oe.Simple&&h>=e&&(i==oe.TrackDel&&r<e&&h>e||i==oe.TrackBefore&&r<e||i==oe.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==r||t<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let s=this.sections[i++],o=this.sections[i++],l=r+s;if(o>=0&&r<=t&&l>=e)return r<e&&l>t?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new n(e)}static create(e){return new n(e)}},he=class n extends tt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Ir(this,(t,i,r,s,o)=>e=e.replace(r,r+(i-t),o),!1),e}mapDesc(e,t=!1){return Nr(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,s=0;r<t.length;r+=2){let o=t[r],l=t[r+1];if(l>=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;i.length<a;)i.push(j.empty);i.push(o?e.slice(s,s+o):j.empty)}s+=o}return new n(t,i)}compose(e){return this.empty?e:e.empty?this:la(this,e,!0)}map(e,t=!1){return e.empty?this:Nr(this,e,t,!0)}iterChanges(e,t=!1){Ir(this,e,t)}get desc(){return tt.create(this.sections)}filter(e){let t=[],i=[],r=[],s=new Dt(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++
Line truncated
|
||||||
`}get readOnly(){return this.facet(da)}phrase(e,...t){for(let i of this.facet(n.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>t.length?i:t[s-1]})),e}languageDataAt(e,t,i=-1){let r=[];for(let s of this.facet(aa))for(let o of s(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return Od(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:r}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=ie(t,o,!1);if(s(t.slice(a,o))!=Ce.Word)break;o=a}for(;l<r;){let a=ie(t,l);if(s(t.slice(l,a))!=Ce.Word)break;l=a}return o==l?null:S.range(o+i,l+i)}};V.allowMultipleSelections=Gr;V.tabSize=X.define({combine:n=>n.length?n[0]:4});V.lineSeparator=ha;V.readOnly=da;V.phrases=X.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(r=>n[r]==e[r])}});V.languageData=aa;V.changeFilter=fa;V.transactionFilter=ca;V.transactionExtender=ua;Li.reconfigure=_.define();function zi(n,e,t={}){let i={};for(let r of n)for(let s of Object.keys(r)){let o=r[s],l=i[s];if(l===void 0)i[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,s))i[s]=t[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let r in e)i[r]===void 0&&(i[r]=e[r]);return i}var Xe=class{eq(e){return this==e}range(e,t=e){return Yi.create(e,t,this)}};Xe.prototype.startSide=Xe.prototype.endSide=0;Xe.prototype.point=!1;Xe.prototype.mapMode=oe.TrackDel;function ls(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}var Yi=class n{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new n(e,t,i)}};function es(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}var ts=class n{constructor(e,t,i,r){this.from=e,this.to=t,this.value=i,this.maxPoint=r}get length(){return ni(this.to)}findIndex(e,t,i,r=0){let s=i?this.to:this.from;for(let o=r,l=s.length;;){if(o==l)return o;let a=o+l>>1,h=s[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,t,i,r){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,s);s<o;s++)if(r(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t,i,r,s){let o=[],l=[],a=[],h=-1,f=-1;e:for(let c=0;c<this.value.length;c++){let u=this.value[c],d=this.from[c]+e,O=this.to[c]+e,p,g;if(d==O){let b=t.mapPos(d,u.startSide,u.mapMode);if(b==null||(p=g=b,u.startSide!=u.endSide&&(g=t.mapPos(d,u.endSide),g<p)))continue}else if(p=t.mapPos(d,u.startSide),g=t.mapPos(O,u.endSide),p>g||p==g&&u.startSide>0&&u.endSide<=0)continue;if(!((g-p||u.endSide-u.startSide)<0))if(h<0&&(h=p),u.point&&(f=Math.max(f,g-p)),(p-i||u.startSide-r)>=0)o.push(u),l.push(p-h),a.push(g-h),i=g,r=u.endSide;else{if(p==g)for(let b=o.length;b>0;b--){if((p-(a[b-1]+h)||u.startSide-o[b-1].endSide)>=0){o.splice(b,0,u),l.splice(b,0,p-h),a.splice(b,0,g-h);continue e}if((p-(l[b-1]+h)||u.endSide-o[b-1].startSide)>0)break}s(p,g,u)}}return{mapped:o.length?new n(l,a,o,f):null,pos:h}}},I=class n{constructor(e,t,i,r){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=r}static create(e,t,i,r){return new n(e,t,i,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:r=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(es)),this.isEmpty)return t.length?n.of(t):this;let l=new Yn(this,null,-1).goto(0),a=0,h=[],f=new zt;for(;l.value||a<t.length;)if(a<t.length&&(l.from-t[a].from||l.startSide-t[a].value.startSide)>=0){let c=t[a++];f.addInner(c.from,c.to,c.value,!1)||h.push(c)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(l.chunkIndex)<t[a].from)&&(!o||r>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&f.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||r>l.to||s<l.from||o(l.from,l.to,l.value))&&(f.addInner(l.from,l.to,l.value,!1)||h.push(Yi.create(l.from,l.to,l.value))),l.next());return f.finishInner(this.nextLayer.isEmpty&&!h.length?n.empty:this.nextLayer.update({add:h,filter:o,filterFrom:r,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],r=-1,s,o=(a,h,f)=>{s||(s=new zt),s.addRange(a,h,f,!1)};for(let a=0;a<this.chunk.length;a++){let h=this.chunkPos[a],f=this.chunk[a],c=e.touchesRange(h,h+f.length);if(c===!1)r=Math.max(r,f.maxPoint),t.push(f),i.push(e.mapPos(h));else if(c===!0){let[u,d]=t.length?[ni(i)+ni(t).length,ni(ni(t).value).endSide]:[-1,-1],{mapped:O,pos:p}=f.map(h,e,u,d,o);O&&(r=Math.max(r,O.maxPoint),t.push(O),i.push(p))}}let l=this.nextLayer.map(e);return s&&(l=s.finishInner(l)),t.length==0?l:new n(i,t,l||n.emp
Line truncated
|
`}get readOnly(){return this.facet(Oa)}phrase(e,...t){for(let i of this.facet(n.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,r)=>{if(r=="$")return"$";let s=+(r||1);return!s||s>t.length?i:t[s-1]})),e}languageDataAt(e,t,i=-1){let r=[];for(let s of this.facet(ha))for(let o of s(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return pd(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:r}=this.doc.lineAt(e),s=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=ie(t,o,!1);if(s(t.slice(a,o))!=Ce.Word)break;o=a}for(;l<r;){let a=ie(t,l);if(s(t.slice(l,a))!=Ce.Word)break;l=a}return o==l?null:S.range(o+i,l+i)}};V.allowMultipleSelections=Gr;V.tabSize=X.define({combine:n=>n.length?n[0]:4});V.lineSeparator=fa;V.readOnly=Oa;V.phrases=X.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(r=>n[r]==e[r])}});V.languageData=ha;V.changeFilter=ca;V.transactionFilter=ua;V.transactionExtender=da;Li.reconfigure=z.define();function zi(n,e,t={}){let i={};for(let r of n)for(let s of Object.keys(r)){let o=r[s],l=i[s];if(l===void 0)i[s]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(t,s))i[s]=t[s](l,o);else throw new Error("Config merge conflict for field "+s)}for(let r in e)i[r]===void 0&&(i[r]=e[r]);return i}var Xe=class{eq(e){return this==e}range(e,t=e){return Yi.create(e,t,this)}};Xe.prototype.startSide=Xe.prototype.endSide=0;Xe.prototype.point=!1;Xe.prototype.mapMode=oe.TrackDel;function ls(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}var Yi=class n{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new n(e,t,i)}};function es(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}var ts=class n{constructor(e,t,i,r){this.from=e,this.to=t,this.value=i,this.maxPoint=r}get length(){return ni(this.to)}findIndex(e,t,i,r=0){let s=i?this.to:this.from;for(let o=r,l=s.length;;){if(o==l)return o;let a=o+l>>1,h=s[a]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,t,i,r){for(let s=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,s);s<o;s++)if(r(this.from[s]+e,this.to[s]+e,this.value[s])===!1)return!1}map(e,t,i,r,s){let o=[],l=[],a=[],h=-1,f=-1;e:for(let c=0;c<this.value.length;c++){let u=this.value[c],d=this.from[c]+e,O=this.to[c]+e,p,g;if(d==O){let b=t.mapPos(d,u.startSide,u.mapMode);if(b==null||(p=g=b,u.startSide!=u.endSide&&(g=t.mapPos(d,u.endSide),g<p)))continue}else if(p=t.mapPos(d,u.startSide),g=t.mapPos(O,u.endSide),p>g||p==g&&u.startSide>0&&u.endSide<=0)continue;if(!((g-p||u.endSide-u.startSide)<0))if(h<0&&(h=p),u.point&&(f=Math.max(f,g-p)),(p-i||u.startSide-r)>=0)o.push(u),l.push(p-h),a.push(g-h),i=g,r=u.endSide;else{if(p==g)for(let b=o.length;b>0;b--){if((p-(a[b-1]+h)||u.startSide-o[b-1].endSide)>=0){o.splice(b,0,u),l.splice(b,0,p-h),a.splice(b,0,g-h);continue e}if((p-(l[b-1]+h)||u.endSide-o[b-1].startSide)>0)break}s(p,g,u)}}return{mapped:o.length?new n(l,a,o,f):null,pos:h}}},I=class n{constructor(e,t,i,r){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=r}static create(e,t,i,r){return new n(e,t,i,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:r=0,filterTo:s=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(es)),this.isEmpty)return t.length?n.of(t):this;let l=new zn(this,null,-1).goto(0),a=0,h=[],f=new zt;for(;l.value||a<t.length;)if(a<t.length&&(l.from-t[a].from||l.startSide-t[a].value.startSide)>=0){let c=t[a++];f.addInner(c.from,c.to,c.value,!1)||h.push(c)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(l.chunkIndex)<t[a].from)&&(!o||r>this.chunkEnd(l.chunkIndex)||s<this.chunkPos[l.chunkIndex])&&f.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||r>l.to||s<l.from||o(l.from,l.to,l.value))&&(f.addInner(l.from,l.to,l.value,!1)||h.push(Yi.create(l.from,l.to,l.value))),l.next());return f.finishInner(this.nextLayer.isEmpty&&!h.length?n.empty:this.nextLayer.update({add:h,filter:o,filterFrom:r,filterTo:s}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],r=-1,s,o=(a,h,f)=>{s||(s=new zt),s.addRange(a,h,f,!1)};for(let a=0;a<this.chunk.length;a++){let h=this.chunkPos[a],f=this.chunk[a],c=e.touchesRange(h,h+f.length);if(c===!1)r=Math.max(r,f.maxPoint),t.push(f),i.push(e.mapPos(h));else if(c===!0){let[u,d]=t.length?[ni(i)+ni(t).length,ni(ni(t).value).endSide]:[-1,-1],{mapped:O,pos:p}=f.map(h,e,u,d,o);O&&(r=Math.max(r,O.maxPoint),t.push(O),i.push(p))}}let l=this.nextLayer.map(e);return s&&(l=s.finishInner(l)),t.length==0?l:new n(i,t,l||n.emp
Line truncated
|
||||||
`)}static newName(){let e=ba[ga]||1;return ba[ga]=e+1,"\u037C"+e.toString(36)}static mount(e,t,i){let r=e[as],s=i&&i.nonce;r?s&&r.setNonce(s):r=new hs(e,s),r.mount(Array.isArray(t)?t:[t],e)}},Sa=new Map,hs=class{constructor(e,t){let i=e.ownerDocument||e,r=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let s=Sa.get(i);if(s)return e[as]=s;this.sheet=new r.CSSStyleSheet,Sa.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[as]=this}mount(e,t){let i=this.sheet,r=0,s=0,o=!1;for(let l=0;l<e.length;l++){let a=e[l],h=this.modules.indexOf(a);if(h<s&&h>-1&&(this.modules.splice(h,1),o=!0,s--,h=-1),h==-1){if(this.modules.splice(s++,0,a),o=!0,i)for(let f=0;f<a.rules.length;f++)i.insertRule(a.rules[f],r++)}else{for(;s<h;)r+=this.modules[s++].rules.length;r+=a.rules.length,s++}}if(i)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{if(o){let a="";for(let h=0;h<this.modules.length;h++)a+=this.modules[h].getRules()+`
|
`)}static newName(){let e=Sa[ba]||1;return Sa[ba]=e+1,"\u037C"+e.toString(36)}static mount(e,t,i){let r=e[as],s=i&&i.nonce;r?s&&r.setNonce(s):r=new hs(e,s),r.mount(Array.isArray(t)?t:[t],e)}},Qa=new Map,hs=class{constructor(e,t){let i=e.ownerDocument||e,r=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let s=Qa.get(i);if(s)return e[as]=s;this.sheet=new r.CSSStyleSheet,Qa.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[as]=this}mount(e,t){let i=this.sheet,r=0,s=0,o=!1;for(let l=0;l<e.length;l++){let a=e[l],h=this.modules.indexOf(a);if(h<s&&h>-1&&(this.modules.splice(h,1),o=!0,s--,h=-1),h==-1){if(this.modules.splice(s++,0,a),o=!0,i)for(let f=0;f<a.rules.length;f++)i.insertRule(a.rules[f],r++)}else{for(;s<h;)r+=this.modules[s++].rules.length;r+=a.rules.length,s++}}if(i)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{if(o){let a="";for(let h=0;h<this.modules.length;h++)a+=this.modules[h].getRules()+`
|
||||||
`;this.styleTag.textContent=a}let l=t.head||t;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var nt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ai={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},md=typeof navigator<"u"&&/Mac/.test(navigator.platform),gd=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(te=0;te<10;te++)nt[48+te]=nt[96+te]=String(te);var te;for(te=1;te<=24;te++)nt[te+111]="F"+te;var te;for(te=65;te<=90;te++)nt[te]=String.fromCharCode(te+32),ai[te]=String.fromCharCode(te);var te;for(_n in nt)ai.hasOwnProperty(_n)||(ai[_n]=nt[_n]);var _n;function Qa(n){var e=md&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||gd&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ai:nt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}var fe=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},ps=typeof document<"u"?document:{documentElement:{style:{}}},ms=/Edge\/(\d+)/.exec(fe.userAgent),Ua=/MSIE \d/.test(fe.userAgent),gs=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(fe.userAgent),lr=!!(Ua||gs||ms),ya=!lr&&/gecko\/(\d+)/i.test(fe.userAgent),fs=!lr&&/Chrome\/(\d+)/.exec(fe.userAgent),ka="webkitFontSmoothing"in ps.documentElement.style,bs=!lr&&/Apple Computer/.test(fe.vendor),xa=bs&&(/Mobile\/\w+/.test(fe.userAgent)||fe.maxTouchPoints>2),w={mac:xa||/Mac/.test(fe.platform),windows:/Win/.test(fe.platform),linux:/Linux|X11/.test(fe.platform),ie:lr,ie_version:Ua?ps.documentMode||6:gs?+gs[1]:ms?+ms[1]:0,gecko:ya,gecko_version:ya?+(/Firefox\/(\d+)/.exec(fe.userAgent)||[0,0])[1]:0,chrome:!!fs,chrome_version:fs?+fs[1]:0,ios:xa,android:/Android\b/.test(fe.userAgent),webkit:ka,webkit_version:ka?+(/\bAppleWebKit\/(\d+)/.exec(fe.userAgent)||[0,0])[1]:0,safari:bs,safari_version:bs?+(/\bVersion\/(\d+(\.\d+)?)/.exec(fe.userAgent)||[0,0])[1]:0,tabSize:ps.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function to(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}var Gn=Object.create(null);function io(n,e,t){if(n==e)return!0;n||(n=Gn),e||(e=Gn);let i=Object.keys(n),r=Object.keys(e);if(i.length-0!=r.length-0)return!1;for(let s of i)if(s!=t&&(r.indexOf(s)==-1||n[s]!==e[s]))return!1;return!0}function bd(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function wa(n,e,t){let i=!1;if(e)for(let r in e)t&&r in t||(i=!0,r=="style"?n.style.cssText="":n.removeAttribute(r));if(t)for(let r in t)e&&e[r]==t[r]||(i=!0,r=="style"?n.style.cssText=t[r]:n.setAttribute(r,t[r]));return i}function Sd(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let i=n.attributes[t];e[i.name]=i.value}return e}var Fe=class{eq(e){return!1}updateDOM(e,t,i){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},je=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(je||(je={})),W=class extends Xe{constructor(e,t,i,r){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=r}get heightRelevant(){return!1}static mark(e){return new Fi(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Wt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,r;if(e.isBlockGap)i=-5e8,r=4e8;else{let{start:s,end:o}=Ga(e,t);i=(s?t?-3e8:-1:5e8)-1,r=(o?t?2e8:1:-6e8)+1}return new Wt(e,i,r,t,e.widget||null,!0)}static line(e){return new Hi(e)}static set(e,t=!1){return I.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};W.none=I.empty;var Fi=class n extends W{constructor(e){let{start:t,end:i}=Ga(e);super(t?-1:5e8,i?1:-6e8,null,e),this.taLine truncated
|
`;this.styleTag.textContent=a}let l=t.head||t;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}};var nt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ai={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},gd=typeof navigator<"u"&&/Mac/.test(navigator.platform),bd=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(te=0;te<10;te++)nt[48+te]=nt[96+te]=String(te);var te;for(te=1;te<=24;te++)nt[te+111]="F"+te;var te;for(te=65;te<=90;te++)nt[te]=String.fromCharCode(te+32),ai[te]=String.fromCharCode(te);var te;for(Dn in nt)ai.hasOwnProperty(Dn)||(ai[Dn]=nt[Dn]);var Dn;function ya(n){var e=gd&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||bd&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ai:nt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}var fe=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},ps=typeof document<"u"?document:{documentElement:{style:{}}},ms=/Edge\/(\d+)/.exec(fe.userAgent),Ga=/MSIE \d/.test(fe.userAgent),gs=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(fe.userAgent),lr=!!(Ga||gs||ms),ka=!lr&&/gecko\/(\d+)/i.test(fe.userAgent),fs=!lr&&/Chrome\/(\d+)/.exec(fe.userAgent),xa="webkitFontSmoothing"in ps.documentElement.style,bs=!lr&&/Apple Computer/.test(fe.vendor),wa=bs&&(/Mobile\/\w+/.test(fe.userAgent)||fe.maxTouchPoints>2),w={mac:wa||/Mac/.test(fe.platform),windows:/Win/.test(fe.platform),linux:/Linux|X11/.test(fe.platform),ie:lr,ie_version:Ga?ps.documentMode||6:gs?+gs[1]:ms?+ms[1]:0,gecko:ka,gecko_version:ka?+(/Firefox\/(\d+)/.exec(fe.userAgent)||[0,0])[1]:0,chrome:!!fs,chrome_version:fs?+fs[1]:0,ios:wa,android:/Android\b/.test(fe.userAgent),webkit:xa,webkit_version:xa?+(/\bAppleWebKit\/(\d+)/.exec(fe.userAgent)||[0,0])[1]:0,safari:bs,safari_version:bs?+(/\bVersion\/(\d+(\.\d+)?)/.exec(fe.userAgent)||[0,0])[1]:0,tabSize:ps.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function io(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}var Fn=Object.create(null);function no(n,e,t){if(n==e)return!0;n||(n=Fn),e||(e=Fn);let i=Object.keys(n),r=Object.keys(e);if(i.length-0!=r.length-0)return!1;for(let s of i)if(s!=t&&(r.indexOf(s)==-1||n[s]!==e[s]))return!1;return!0}function Sd(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function $a(n,e,t){let i=!1;if(e)for(let r in e)t&&r in t||(i=!0,r=="style"?n.style.cssText="":n.removeAttribute(r));if(t)for(let r in t)e&&e[r]==t[r]||(i=!0,r=="style"?n.style.cssText=t[r]:n.setAttribute(r,t[r]));return i}function Qd(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let i=n.attributes[t];e[i.name]=i.value}return e}var ze=class{eq(e){return!1}updateDOM(e,t,i){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},je=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(je||(je={})),_=class extends Xe{constructor(e,t,i,r){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=r}get heightRelevant(){return!1}static mark(e){return new Hi(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Wt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,r;if(e.isBlockGap)i=-5e8,r=4e8;else{let{start:s,end:o}=Fa(e,t);i=(s?t?-3e8:-1:5e8)-1,r=(o?t?2e8:1:-6e8)+1}return new Wt(e,i,r,t,e.widget||null,!0)}static line(e){return new Ki(e)}static set(e,t=!1){return I.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};_.none=I.empty;var Hi=class n extends _{constructor(e){let{start:t,end:i}=Fa(e);super(t?-1:5e8,i?1:-6e8,null,e),this.taLine truncated
|
||||||
`,r=n.state.doc.line(r.number+(t?1:-1)),s=n.bidiSpans(r),h=t?S.cursor(r.from,-1):S.cursor(r.to,1)}if(a){if(!a(f))return l}else{if(!i)return h;a=i(f)}l=h}}function eO(n,e,t){let i=n.state.charCategorizer(e),r=i(t);return s=>{let o=i(s);return r==Ce.Space&&(r=o),r==o}}function tO(n,e,t,i){let r=e.head,s=t?1:-1;if(r==(t?n.state.doc.length:0))return S.cursor(r,e.assoc);let o=e.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(r,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),f=n.documentTop;if(h)o==null&&(o=h.left-a.left),l=s<0?h.top:h.bottom;else{let O=n.viewState.lineBlockAt(r);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(r-O.from))),l=(s<0?O.top:O.bottom)+f}let c=a.left+o,u=n.viewState.heightOracle.textHeight>>1,d=i??u;for(let O=0;;O+=u){let p=l+(d+O)*s,g=Rs(n,{x:c,y:p},!1,s);if(t?p>a.bottom:p<a.top)return S.cursor(g.pos,g.assoc);let b=n.coordsAtPos(g.pos,g.assoc),k=b?(b.top+b.bottom)/2:0;if(!b||(t?k>l:k<l))return S.cursor(g.pos,g.assoc,void 0,o)}}function Ui(n,e,t){for(;;){let i=0;for(let r of n)r.between(e-1,e+1,(s,o,l)=>{if(e>s&&e<o){let a=i||t||(e-s<o-e?-1:1);e=a<0?s:o,i=a}});if(!i)return e}}function Ph(n,e){let t=null;for(let i=0;i<e.ranges.length;i++){let r=e.ranges[i],s=null;if(r.empty){let o=Ui(n,r.from,0);o!=r.from&&(s=S.cursor(o,-1))}else{let o=Ui(n,r.from,-1),l=Ui(n,r.to,1);(o!=r.from||l!=r.to)&&(r.undirectional?s=S.undirectionalRange(r.from,r.to):s=S.range(r.from==r.anchor?o:l,r.from==r.head?o:l))}s&&(t||(t=e.ranges.slice()),t[i]=s)}return t?S.create(t,e.mainIndex):e}function ds(n,e,t){let i=Ui(n.state.facet(en).map(r=>r(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:S.cursor(i,i<t.from?1:-1)}var Ae=class{constructor(e,t){this.pos=e,this.assoc=t}};function Rs(n,e,t,i){let r=n.contentDOM.getBoundingClientRect(),s=r.top+n.viewState.paddingTop,{x:o,y:l}=e,a=l-s,h;for(;;){if(a<0)return new Ae(0,1);if(a>n.viewState.docHeight)return new Ae(n.state.doc.length,-1);if(h=n.elementAtHeight(a),i==null)break;if(h.type==je.Text){if(i<0?h.to<n.viewport.from:h.from>n.viewport.to)break;let u=n.docView.coordsAt(i<0?h.from:h.to,i>0?-1:1);if(u&&(i<0?u.top<=a+s:u.bottom>=a+s))break}let c=n.viewState.heightOracle.textHeight/2;a=i>0?h.bottom+c:h.top-c}if(n.viewport.from>=h.to||n.viewport.to<=h.from){if(t)return null;if(h.type==je.Text){let c=Hd(n,r,h,o,l);return new Ae(c,c==h.from?1:-1)}}if(h.type!=je.Text)return a<(h.top+h.bottom)/2?new Ae(h.from,1):new Ae(h.to,-1);let f=n.docView.lineAt(h.from,2);return(!f||f.length!=h.length)&&(f=n.docView.lineAt(h.from,-2)),new Ms(n,o,l,n.textDirectionAt(h.from)).scanTile(f,h.from)}var Ms=class{constructor(e,t,i,r){this.view=e,this.x=t,this.y=i,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:i,spans:r}=this.bidiSpansAt(e);return r[Re.find(r,e-i.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:i,spans:r}=this.bidiSpansAt(e);return r[Re.find(r,e-i.from,-1,t)].dir}bidiIn(e,t){let{spans:i,line:r}=this.bidiSpansAt(e);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+r.from<t)}scan(e,t,i=!1){let r=0,s=e.length-1,o=new Set,l=this.bidiIn(e[0],e[s]),a,h,f=-1,c=1e9,u;e:for(;r<s;){let O=s-r,p=r+s>>1;t:if(o.has(p)){for(let k=1;k<O;k++){let Q=p+k;if(Q>=s&&(Q-=O),!o.has(Q)){p=Q;break t}}break e}o.add(p);let g=t(p),b=0;if(g)for(let k=0;k<g.length;k++){let Q=g[k];if(!(Q.width==0&&g.length>1))if(Q.bottom<this.y)(!a||a.bottom<Q.bottom)&&(a=Q),b=1;else if(Q.top>this.y)(!h||h.top>Q.top)&&(h=Q),b=-1;else{let A=Q.left>this.x?this.x-Q.left:Q.right<this.x?this.x-Q.right:0,$=Math.abs(A);$<c&&(f=p,c=$,u=Q),A&&(b=A<0==(this.baseDir==G.LTR)?-1:1)}}b==-1&&(!l||this.baseDirAt(e[p],1))?s=p:b==1&&(!l||this.baseDirAt(e[p+1],-1))&&(r=p+1)}if(!u){if(!h&&!a)return{i:0,after:!1};let O=a&&(!h||this.y-a.bottom<h.top-this.y)?a:h;return this.y=(O.top+O.bottom)/2,this.scan(e,t,!0)}if(c&&!i){let{top:O,bottom:p}=u;if(a&&a.bottom>(O+O+p)/3)return this.y=a.bottom-1,this.scan(e,t,!0);if(h&&h.top<(O+p+p)/3)return this.y=h.top+1,this.scan(e,t,!0)}let d=(l?this.dirAt(e[f],1):this.baseDir)==G.LTR;return{i:f,after:this.x>(u.left+u.right)/2==d}}scanText(e,t){let i=[];for(let s=0;s<e.length;s=ie(e.text,s))i.push(t+s);i.push(t+e.length);let r=this.scan(i,s=>{let o=i[s]-t,l=i[s+1]-t;return Ji(e.dom,o,l).getClientRects()});return r.after?new Ae(i[r.i+1],-1):new Ae(i[r.i],1)}scanTile(e,t){if(!e.length)return new Ae(t,1);if(e.children.length==1){let l=e.children[0];if(l.isText())return this.scanText(l,t);if(l.isComposite())return this.scanTile(l,t)}let i=[t];for(let l=0,a=t;l<e.children.length;l++)i.push(a+=e.children[l].length);let r=this.scan(i,l=>{let a=e.children[l];return a.flags&48?null:(ne(a.dom)?a.dom:Ji(a.dom,0,a.length)).getClientRects()}),s=e.children[r.i],o=i[r.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):r.after?new Ae(i[r.i+1],-1):new Ae(o,1)}},hi="\uFFFF",js=class{cons
Line truncated
|
`,r=n.state.doc.line(r.number+(t?1:-1)),s=n.bidiSpans(r),h=t?S.cursor(r.from,-1):S.cursor(r.to,1)}if(a){if(!a(f))return l}else{if(!i)return h;a=i(f)}l=h}}function tO(n,e,t){let i=n.state.charCategorizer(e),r=i(t);return s=>{let o=i(s);return r==Ce.Space&&(r=o),r==o}}function iO(n,e,t,i){let r=e.head,s=t?1:-1;if(r==(t?n.state.doc.length:0))return S.cursor(r,e.assoc);let o=e.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(r,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),f=n.documentTop;if(h)o==null&&(o=h.left-a.left),l=s<0?h.top:h.bottom;else{let O=n.viewState.lineBlockAt(r);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(r-O.from))),l=(s<0?O.top:O.bottom)+f}let c=a.left+o,u=n.viewState.heightOracle.textHeight>>1,d=i??u;for(let O=0;;O+=u){let p=l+(d+O)*s,g=Rs(n,{x:c,y:p},!1,s);if(t?p>a.bottom:p<a.top)return S.cursor(g.pos,g.assoc);let b=n.coordsAtPos(g.pos,g.assoc),k=b?(b.top+b.bottom)/2:0;if(!b||(t?k>l:k<l))return S.cursor(g.pos,g.assoc,void 0,o)}}function Gi(n,e,t){for(;;){let i=0;for(let r of n)r.between(e-1,e+1,(s,o,l)=>{if(e>s&&e<o){let a=i||t||(e-s<o-e?-1:1);e=a<0?s:o,i=a}});if(!i)return e}}function vh(n,e){let t=null;for(let i=0;i<e.ranges.length;i++){let r=e.ranges[i],s=null;if(r.empty){let o=Gi(n,r.from,0);o!=r.from&&(s=S.cursor(o,-1))}else{let o=Gi(n,r.from,-1),l=Gi(n,r.to,1);(o!=r.from||l!=r.to)&&(r.undirectional?s=S.undirectionalRange(r.from,r.to):s=S.range(r.from==r.anchor?o:l,r.from==r.head?o:l))}s&&(t||(t=e.ranges.slice()),t[i]=s)}return t?S.create(t,e.mainIndex):e}function ds(n,e,t){let i=Gi(n.state.facet(nn).map(r=>r(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:S.cursor(i,i<t.from?1:-1)}var Ae=class{constructor(e,t){this.pos=e,this.assoc=t}};function Rs(n,e,t,i){let r=n.contentDOM.getBoundingClientRect(),s=r.top+n.viewState.paddingTop,{x:o,y:l}=e,a=l-s,h;for(;;){if(a<0)return new Ae(0,1);if(a>n.viewState.docHeight)return new Ae(n.state.doc.length,-1);if(h=n.elementAtHeight(a),i==null)break;if(h.type==je.Text){if(i<0?h.to<n.viewport.from:h.from>n.viewport.to)break;let u=n.docView.coordsAt(i<0?h.from:h.to,i>0?-1:1);if(u&&(i<0?u.top<=a+s:u.bottom>=a+s))break}let c=n.viewState.heightOracle.textHeight/2;a=i>0?h.bottom+c:h.top-c}if(n.viewport.from>=h.to||n.viewport.to<=h.from){if(t)return null;if(h.type==je.Text){let c=Kd(n,r,h,o,l);return new Ae(c,c==h.from?1:-1)}}if(h.type!=je.Text)return a<(h.top+h.bottom)/2?new Ae(h.from,1):new Ae(h.to,-1);let f=n.docView.lineAt(h.from,2);return(!f||f.length!=h.length)&&(f=n.docView.lineAt(h.from,-2)),new Ms(n,o,l,n.textDirectionAt(h.from)).scanTile(f,h.from)}var Ms=class{constructor(e,t,i,r){this.view=e,this.x=t,this.y=i,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:i,spans:r}=this.bidiSpansAt(e);return r[Re.find(r,e-i.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:i,spans:r}=this.bidiSpansAt(e);return r[Re.find(r,e-i.from,-1,t)].dir}bidiIn(e,t){let{spans:i,line:r}=this.bidiSpansAt(e);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+r.from<t)}scan(e,t,i=!1){let r=0,s=e.length-1,o=new Set,l=this.bidiIn(e[0],e[s]),a,h,f=-1,c=1e9,u;e:for(;r<s;){let O=s-r,p=r+s>>1;t:if(o.has(p)){for(let k=1;k<O;k++){let Q=p+k;if(Q>=s&&(Q-=O),!o.has(Q)){p=Q;break t}}break e}o.add(p);let g=t(p),b=0;if(g)for(let k=0;k<g.length;k++){let Q=g[k];if(!(Q.width==0&&g.length>1))if(Q.bottom<this.y)(!a||a.bottom<Q.bottom)&&(a=Q),b=1;else if(Q.top>this.y)(!h||h.top>Q.top)&&(h=Q),b=-1;else{let A=Q.left>this.x?this.x-Q.left:Q.right<this.x?this.x-Q.right:0,$=Math.abs(A);$<c&&(f=p,c=$,u=Q),A&&(b=A<0==(this.baseDir==G.LTR)?-1:1)}}b==-1&&(!l||this.baseDirAt(e[p],1))?s=p:b==1&&(!l||this.baseDirAt(e[p+1],-1))&&(r=p+1)}if(!u){if(!h&&!a)return{i:0,after:!1};let O=a&&(!h||this.y-a.bottom<h.top-this.y)?a:h;return this.y=(O.top+O.bottom)/2,this.scan(e,t,!0)}if(c&&!i){let{top:O,bottom:p}=u;if(a&&a.bottom>(O+O+p)/3)return this.y=a.bottom-1,this.scan(e,t,!0);if(h&&h.top<(O+p+p)/3)return this.y=h.top+1,this.scan(e,t,!0)}let d=(l?this.dirAt(e[f],1):this.baseDir)==G.LTR;return{i:f,after:this.x>(u.left+u.right)/2==d}}scanText(e,t){let i=[];for(let s=0;s<e.length;s=ie(e.text,s))i.push(t+s);i.push(t+e.length);let r=this.scan(i,s=>{let o=i[s]-t,l=i[s+1]-t;return tn(e.dom,o,l).getClientRects()});return r.after?new Ae(i[r.i+1],-1):new Ae(i[r.i],1)}scanTile(e,t){if(!e.length)return new Ae(t,1);if(e.children.length==1){let l=e.children[0];if(l.isText())return this.scanText(l,t);if(l.isComposite())return this.scanTile(l,t)}let i=[t];for(let l=0,a=t;l<e.children.length;l++)i.push(a+=e.children[l].length);let r=this.scan(i,l=>{let a=e.children[l];return a.flags&48?null:(ne(a.dom)?a.dom:tn(a.dom,0,a.length)).getClientRects()}),s=e.children[r.i],o=i[r.i];return s.isText()?this.scanText(s,o):s.isComposite()?this.scanTile(s,o):r.after?new Ae(i[r.i+1],-1):new Ae(o,1)}},hi="\uFFFF",js=class{cons
Line truncated
|
||||||
`&&n.lineWrapping&&(i&&(i=S.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:j.of([" "])}),t)return ao(n,t,i,o);if(i&&!Es(i,s)){let l=!1,a="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(l=!0),a=n.inputState.lastSelectionOrigin,a=="select.pointer"&&(i=Ph(r.facet(en).map(h=>h(n)),i))),n.dispatch({selection:i,scrollIntoView:l,userEvent:a}),!0}else return!1}function ao(n,e,t,i=-1){if(w.ios&&n.inputState.flushIOSKey(e))return!0;let r=n.state.selection.main;if(w.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&n.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&di(n.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&di(n.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&di(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=rO(n,e,t));return n.state.facet(dh).some(a=>a(n,e.from,e.to,s,l))||n.dispatch(l()),!0}function rO(n,e,t){let i,r=n.state,s=r.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let a=e.from<s.from?-1:1,h=a<0?s.from:s.to,f=Ui(r.facet(en).map(c=>c(n)),h,a);e.from==f&&(o=f)}if(o>-1)i={changes:e,selection:S.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let a=s.from<e.from?r.sliceDoc(s.from,e.from):"",h=s.to>e.to?r.sliceDoc(e.to,s.to):"";i=r.replaceSelection(n.state.toText(a+e.insert.sliceString(0,void 0,n.state.lineBreak)+h))}else{let a=r.changes(e),h=t&&t.main.to<=a.newLength?t.main:void 0;if(r.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let f=n.state.sliceDoc(e.from,e.to),c,u=t&&$h(n,t.main.head);if(u){let O=e.insert.length-(e.to-e.from);c={from:u.from,to:u.to-O}}else c=n.state.doc.lineAt(s.head);let d=s.to-e.to;i=r.changeByRange(O=>{if(O.from==s.from&&O.to==s.to)return{changes:a,range:h||O.map(a)};let p=O.to-d,g=p-f.length;if(n.state.sliceDoc(g,p)!=f||p>=c.from&&g<=c.to)return{range:O};let b=r.changes({from:g,to:p,insert:e.insert}),k=O.to-s.to;return{changes:b,range:h?S.range(Math.max(0,h.anchor+k),Math.max(0,h.head+k)):O.map(b)}})}else i={changes:a,selection:h&&r.selection.replaceRange(h)}}let l="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,l+=".compose",n.inputState.compositionFirstChange&&(l+=".start",n.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:l,scrollIntoView:!0})}function Xh(n,e,t,i){let r=Math.min(n.length,e.length),s=0;for(;s<r&&n.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==r&&n.length==e.length)return null;let o=n.length,l=e.length;for(;o>0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,s-Math.min(o,l));t-=o+a-s}if(o<s&&n.length<e.length){let a=t<=s&&t>=o?s-t:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=t<=s&&t>=l?s-t:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function sO(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:s}=n.observer.selectionRange;return t&&(e.push(new ir(t,i)),(r!=t||s!=i)&&e.push(new ir(r,s))),e}function oO(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t<0||i<0?null:t==i?S.create([S.cursor(i+e,-1)]):S.single(t+e,i+e)}function Es(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}var Ys=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,w.safari&&e.contentDOM.addEventListener("input",()=>null),w.gecko&&yO(e.contentDOM.ownerDocument)}handleEvent(e){!OO(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let r of i.observers)r(this.view,t);for(let r of i.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDef
Line truncated
|
`&&n.lineWrapping&&(i&&(i=S.single(i.main.anchor-1,i.main.head-1)),t={from:s.from,to:s.to,insert:j.of([" "])}),t)return ho(n,t,i,o);if(i&&!Es(i,s)){let l=!1,a="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(l=!0),a=n.inputState.lastSelectionOrigin,a=="select.pointer"&&(i=vh(r.facet(nn).map(h=>h(n)),i))),n.dispatch({selection:i,scrollIntoView:l,userEvent:a}),!0}else return!1}function ho(n,e,t,i=-1){if(w.ios&&n.inputState.flushIOSKey(e))return!0;let r=n.state.selection.main;if(w.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&n.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&di(n.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&di(n.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&di(n.contentDOM,"Delete",46)))return!0;let s=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=sO(n,e,t));return n.state.facet(Oh).some(a=>a(n,e.from,e.to,s,l))||n.dispatch(l()),!0}function sO(n,e,t){let i,r=n.state,s=r.selection.main,o=-1;if(e.from==e.to&&e.from<s.from||e.from>s.to){let a=e.from<s.from?-1:1,h=a<0?s.from:s.to,f=Gi(r.facet(nn).map(c=>c(n)),h,a);e.from==f&&(o=f)}if(o>-1)i={changes:e,selection:S.cursor(e.from+e.insert.length,-1)};else if(e.from>=s.from&&e.to<=s.to&&e.to-e.from>=(s.to-s.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let a=s.from<e.from?r.sliceDoc(s.from,e.from):"",h=s.to>e.to?r.sliceDoc(e.to,s.to):"";i=r.replaceSelection(n.state.toText(a+e.insert.sliceString(0,void 0,n.state.lineBreak)+h))}else{let a=r.changes(e),h=t&&t.main.to<=a.newLength?t.main:void 0;if(r.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=s.to+10&&e.to>=s.to-10){let f=n.state.sliceDoc(e.from,e.to),c,u=t&&Ph(n,t.main.head);if(u){let O=e.insert.length-(e.to-e.from);c={from:u.from,to:u.to-O}}else c=n.state.doc.lineAt(s.head);let d=s.to-e.to;i=r.changeByRange(O=>{if(O.from==s.from&&O.to==s.to)return{changes:a,range:h||O.map(a)};let p=O.to-d,g=p-f.length;if(n.state.sliceDoc(g,p)!=f||p>=c.from&&g<=c.to)return{range:O};let b=r.changes({from:g,to:p,insert:e.insert}),k=O.to-s.to;return{changes:b,range:h?S.range(Math.max(0,h.anchor+k),Math.max(0,h.head+k)):O.map(b)}})}else i={changes:a,selection:h&&r.selection.replaceRange(h)}}let l="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,l+=".compose",n.inputState.compositionFirstChange&&(l+=".start",n.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:l,scrollIntoView:!0})}function Th(n,e,t,i){let r=Math.min(n.length,e.length),s=0;for(;s<r&&n.charCodeAt(s)==e.charCodeAt(s);)s++;if(s==r&&n.length==e.length)return null;let o=n.length,l=e.length;for(;o>0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,s-Math.min(o,l));t-=o+a-s}if(o<s&&n.length<e.length){let a=t<=s&&t>=o?s-t:0;s-=a,l=s+(l-o),o=s}else if(l<s){let a=t<=s&&t>=l?s-t:0;s-=a,o=s+(o-l),l=s}return{from:s,toA:o,toB:l}}function oO(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:s}=n.observer.selectionRange;return t&&(e.push(new ir(t,i)),(r!=t||s!=i)&&e.push(new ir(r,s))),e}function lO(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t<0||i<0?null:t==i?S.create([S.cursor(i+e,-1)]):S.single(t+e,i+e)}function Es(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}var Ys=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,w.safari&&e.contentDOM.addEventListener("input",()=>null),w.gecko&&kO(e.contentDOM.ownerDocument)}handleEvent(e){!pO(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let r of i.observers)r(this.view,t);for(let r of i.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDef
Line truncated
|
||||||
`))};if((w.mac||w.android)&&c.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(c={from:l,to:a,insert:j.of([i.text.replace("."," ")])}),this.pendingContextChange=c,!e.state.readOnly){let u=this.to-this.from+(c.to-c.from+c.insert.length);ao(e,c,S.single(this.toEditorPos(i.selectionStart,u),this.toEditorPos(i.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),c.from<c.to&&!c.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let r=[],s=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o<l;o++){let a=e.coordsForChar(o);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||s||new DOMRect,r.push(s)}t.updateCharacterBounds(i.rangeStart,r)},this.handlers.textformatupdate=i=>{let r=[];for(let s of i.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(s.rangeStart),h=this.toEditorPos(s.rangeEnd);if(a<h){let f=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;r.push(W.mark({attributes:{style:f}}).range(a,h))}}}e.dispatch({effects:gh.of(W.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let r=Ki(i.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,r=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,h)=>{if(i)return;let f=h.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(h)){r=this.pendingContextChange=null,t+=f,this.to+=f;return}else r=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=f,this.to+=f;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),h.toString()),this.to+=f}t+=f}),r&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(i,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},Z=class n{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.clearAnnouncement=-1,this.contentDOM=document.createElement(
Line truncated
|
`))};if((w.mac||w.android)&&c.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(c={from:l,to:a,insert:j.of([i.text.replace("."," ")])}),this.pendingContextChange=c,!e.state.readOnly){let u=this.to-this.from+(c.to-c.from+c.insert.length);ho(e,c,S.single(this.toEditorPos(i.selectionStart,u),this.toEditorPos(i.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),c.from<c.to&&!c.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let r=[],s=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o<l;o++){let a=e.coordsForChar(o);s=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||s||new DOMRect,r.push(s)}t.updateCharacterBounds(i.rangeStart,r)},this.handlers.textformatupdate=i=>{let r=[];for(let s of i.getTextFormats()){let o=s.underlineStyle,l=s.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(s.rangeStart),h=this.toEditorPos(s.rangeEnd);if(a<h){let f=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;r.push(_.mark({attributes:{style:f}}).range(a,h))}}}e.dispatch({effects:bh.of(_.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let r=Ji(i.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,r=this.pendingContextChange;return e.changes.iterChanges((s,o,l,a,h)=>{if(i)return;let f=h.length-(o-s);if(r&&o>=r.to)if(r.from==s&&r.to==o&&r.insert.eq(h)){r=this.pendingContextChange=null,t+=f,this.to+=f;return}else r=null,this.revertPending(e.state);if(s+=t,o+=t,o<=this.from)this.from+=f,this.to+=f;else if(s<this.to){if(s<this.from||o>this.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(o),h.toString()),this.to+=f}t+=f}),r&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(i,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}},Z=class n{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.clearAnnouncement=-1,this.contentDOM=document.createElement(
Line truncated
|
||||||
`+t.scrub(),s=this.advance(r);return s>-1&&s<r.length?this.complete(e,i,s):!1}finish(e,t){return(this.stage==2||this.stage==3)&&On(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,i){return e.addLeafElement(t,Y(y.LinkReference,this.start,this.start+i,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(Df(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(Y(y.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(_f(e,On(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=On(e,this.pos),i=0;if(t>this.pos){let r=zf(e,t,this.start);if(r){let s=Yo(e,r.to-this.start);s>0&&(this.nextStage(r),i=s)}}return i||(i=Yo(e,this.pos)),i>0&&i<e.length?i:-1}else return Yo(e,this.pos)}}};function Yo(n,e){for(;e<n.length;e++){let t=n.charCodeAt(e);if(t==10)break;if(!we(t))return-1}return e}var Vo=class{nextLine(e,t,i){let r=t.depth<e.stack.length?-1:Af(t),s=t.next;if(r<0)return!1;let o=Y(y.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(i,Y(s==61?y.SetextHeading1:y.SetextHeading2,i.start,e.prevLineEnd(),[...e.parser.parseInline(i.content,i.start),o])),!0}finish(){return!1}},Lf={LinkReference(n,e){return e.content.charCodeAt(0)==91?new Wo(e):null},SetextHeading(){return new Vo}},Xp=[(n,e)=>Zf(e)>=0,(n,e)=>Cf(e)>=0,(n,e)=>Xf(e)>=0,(n,e)=>Ko(e,n,!0)>=0,(n,e)=>Jo(e,n,!0)>=0,(n,e)=>Ho(e,n,!0)>=0,(n,e)=>jf(e,n,!0)>=0],Tp={text:"",end:0},Io=class{constructor(e,t,i,r){this.parser=e,this.input=t,this.ranges=r,this.line=new Do,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=$r.create(y.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=i.length?new Go(i,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let i=0;;){let r=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;i<e.markers.length&&(!r||e.markers[i].from<r.end);){let s=e.markers[i++];this.addNode(s.type,s.from,s.to)}if(!r)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let i of this.parser.blockParsers)if(i){let r=i(this,e);if(r!=!1){if(r==!0)return null;e.forward();continue e}}break}if(e.pos==e.text.length)return this.nextLine()?null:this.finish();let t=new zo(this.lineStart+e.pos,e.text.slice(e.pos));for(let i of this.parser.leafBlockParsers)if(i){let r=i(this,t);r&&t.parsers.push(r)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let i of this.parser.endLeafBlock)if(i(this,e,t))break e}for(let i of t.parsers)if(i.nextLine(this,e,t))return null;t.content+=`
|
`+t.scrub(),s=this.advance(r);return s>-1&&s<r.length?this.complete(e,i,s):!1}finish(e,t){return(this.stage==2||this.stage==3)&&mn(t.content,this.pos)==t.content.length?this.complete(e,t,t.content.length):!1}complete(e,t,i){return e.addLeafElement(t,Y(y.LinkReference,this.start,this.start+i,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(Bf(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(Y(y.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(zf(e,mn(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=mn(e,this.pos),i=0;if(t>this.pos){let r=Df(e,t,this.start);if(r){let s=_o(e,r.to-this.start);s>0&&(this.nextStage(r),i=s)}}return i||(i=_o(e,this.pos)),i>0&&i<e.length?i:-1}else return _o(e,this.pos)}}};function _o(n,e){for(;e<n.length;e++){let t=n.charCodeAt(e);if(t==10)break;if(!we(t))return-1}return e}var Io=class{nextLine(e,t,i){let r=t.depth<e.stack.length?-1:Rf(t),s=t.next;if(r<0)return!1;let o=Y(y.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(i,Y(s==61?y.SetextHeading1:y.SetextHeading2,i.start,e.prevLineEnd(),[...e.parser.parseInline(i.content,i.start),o])),!0}finish(){return!1}},Ef={LinkReference(n,e){return e.content.charCodeAt(0)==91?new Vo(e):null},SetextHeading(){return new Io}},Zp=[(n,e)=>Af(e)>=0,(n,e)=>Xf(e)>=0,(n,e)=>Tf(e)>=0,(n,e)=>Jo(e,n,!0)>=0,(n,e)=>el(e,n,!0)>=0,(n,e)=>Ko(e,n,!0)>=0,(n,e)=>Lf(e,n,!0)>=0],Ap={text:"",end:0},No=class{constructor(e,t,i,r){this.parser=e,this.input=t,this.ranges=r,this.line=new Bo,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=$r.create(y.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=i.length?new Fo(i,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let i=0;;){let r=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;i<e.markers.length&&(!r||e.markers[i].from<r.end);){let s=e.markers[i++];this.addNode(s.type,s.from,s.to)}if(!r)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;e:for(;;){for(let i of this.parser.blockParsers)if(i){let r=i(this,e);if(r!=!1){if(r==!0)return null;e.forward();continue e}}break}if(e.pos==e.text.length)return this.nextLine()?null:this.finish();let t=new Do(this.lineStart+e.pos,e.text.slice(e.pos));for(let i of this.parser.leafBlockParsers)if(i){let r=i(this,t);r&&t.parsers.push(r)}e:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let i of this.parser.endLeafBlock)if(i(this,e,t))break e}for(let i of t.parsers)if(i.nextLine(this,e,t))return null;t.content+=`
|
||||||
`+e.scrub();for(let i of e.markers)t.marks.push(i)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=qf(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=Tp;if(t.end=e,e>=this.to)t.text="";else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let i=this.absoluteLineStart,r=this.rangeI;for(;this.ranges[r].to<t.end;){r++;let s=this.ranges[r].from,o=this.lineChunkAt(s);t.end=s+o.length,t.text=t.text.slice(0,this.ranges[r-1].to-i)+o,i=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:i}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=i,e.reset(t);e.depth<this.stack.length;e.depth++){let r=this.stack[e.depth],s=this.parser.skipContextMarkup[r.type];if(!s)throw new Error("Unhandled block context "+y[r.type]);let o=this.line.markers.length;if(!s(r,this,e)){this.line.markers.length>o&&(r.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),i;if(this.input.lineChunks)i=t==`
|
`+e.scrub();for(let i of e.markers)t.marks.push(i)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=Wf(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=Ap;if(t.end=e,e>=this.to)t.text="";else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let i=this.absoluteLineStart,r=this.rangeI;for(;this.ranges[r].to<t.end;){r++;let s=this.ranges[r].from,o=this.lineChunkAt(s);t.end=s+o.length,t.text=t.text.slice(0,this.ranges[r-1].to-i)+o,i=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:i}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=i,e.reset(t);e.depth<this.stack.length;e.depth++){let r=this.stack[e.depth],s=this.parser.skipContextMarkup[r.type];if(!s)throw new Error("Unhandled block context "+y[r.type]);let o=this.line.markers.length;if(!s(r,this,e)){this.line.markers.length>o&&(r.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),i;if(this.input.lineChunks)i=t==`
|
||||||
`?"":t;else{let r=t.indexOf(`
|
`?"":t;else{let r=t.indexOf(`
|
||||||
`);i=r<0?t:t.slice(0,r)}return e+i.length>this.to?i.slice(0,this.to-e):i}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,i=0){this.block=$r.create(e,i,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,i=0){this.startContext(this.parser.getNodeType(e),t,i)}addNode(e,t,i){typeof e=="number"&&(e=new E(this.parser.nodeSet.types[e],Ci,Ci,(i??this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements(Uo(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?Ef(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let i of e.parsers)if(i.finish(this,e))return;let t=Uo(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(y.Paragraph,e.content.length),e.start)}elt(e,t,i,r){return typeof e=="string"?Y(this.parser.getNodeType(e),t,i,r):new vr(e,t)}get buffer(){return new Pr(this.parser.nodeSet)}};function Ef(n,e,t,i,r){let s=n[e].to,o=[],l=[],a=t.from+i;function h(f,c){for(;c?f>=s:f>s;){let u=n[e+1].from-s;i+=u,f+=u,e++,s=n[e].to}}for(let f=t.firstChild;f;f=f.nextSibling){h(f.from+i,!0);let c=f.from+i,u,d=r.get(f.tree);d?u=d:f.to+i>s?(u=Ef(n,e,f,i,r),h(f.to+i,!1)):u=f.toTree(),o.push(u),l.push(c-a)}return h(t.to+i,!1),new E(t.type,o,l,t.to+i-a,t.tree?t.tree.propValues:void 0)}var mn=class n extends xt{constructor(e,t,i,r,s,o,l,a,h){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=i,this.blockNames=r,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=l,this.inlineNames=a,this.wrappers=h,this.nodeTypes=Object.create(null);for(let f of e.types)this.nodeTypes[f.name]=f.id}createParse(e,t,i){let r=new Io(this,e,t,i);for(let s of this.wrappers)r=s(r,e,t,i);return r}configure(e){let t=No(e);if(!t)return this;let{nodeSet:i,skipContextMarkup:r}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),l=this.blockNames.slice(),a=this.inlineParsers.slice(),h=this.inlineNames.slice(),f=this.endLeafBlock.slice(),c=this.wrappers;if(dn(t.defineNodes)){r=Object.assign({},r);let u=i.types.slice(),d;for(let O of t.defineNodes){let{name:p,block:g,composite:b,style:k}=typeof O=="string"?{name:O}:O;if(u.some($=>$.name==p))continue;b&&(r[u.length]=($,P,v)=>b(P,v,$.value));let Q=u.length,A=b?["Block","BlockContext"]:g?Q>=y.ATXHeading1&&Q<=y.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;u.push(J.define({id:Q,name:p,props:A&&[[T.group,A]]})),k&&(d||(d={}),Array.isArray(k)||k instanceof xe?d[p]=k:Object.assign(d,k))}i=new yt(u),d&&(i=i.extend(De(d)))}if(dn(t.props)&&(i=i.extend(...t.props)),dn(t.remove))for(let u of t.remove){let d=this.blockNames.indexOf(u),O=this.inlineNames.indexOf(u);d>-1&&(s[d]=o[d]=void 0),O>-1&&(a[O]=void 0)}if(dn(t.parseBlock))for(let u of t.parseBlock){let d=l.indexOf(u.name);if(d>-1)s[d]=u.parse,o[d]=u.leaf;else{let O=u.before?wr(l,u.before):u.after?wr(l,u.after)+1:l.length-1;s.splice(O,0,u.parse),o.splice(O,0,u.leaf),l.splice(O,0,u.name)}u.endLeaf&&f.push(u.endLeaf)}if(dn(t.parseInline))for(let u of t.parseInline){let d=h.indexOf(u.name);if(d>-1)a[d]=u.parse;else{let O=u.before?wr(h,u.before):u.after?wr(h,u.after)+1:h.length-1;a.splice(O,0,u.parse),h.splice(O,0,u.name)}}return t.wrap&&(c=c.concat(t.wrap)),new n(i,s,o,l,f,r,a,h,c)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let i=new Kt(this,e,t);e:for(let r=t;r<i.end;){let s=i.char(r);for(let o of this.inlineParsers)if(o){let l=o(i,s,r);if(l>=0){r=l;continue e}}r++}return i.resolveMarkers(0)}};function dn(n){return n!=null&&n.length>0}function No(n){if(!Array.isArray(n))return n;if(n.length==0)return null;let e=No(n[0]);if(n.length==1)return e;let t=No(n.slice(1));if(!t||!e)return e||t;let i=(o,l)=>(o||Ci).concat(l||Ci),r=e.wrap,s=t.wrap;return{props:i(e.props,t.props),defineNodes:i(e.defineNodes,t.defineNodes),parseBlock:i(e.parseBlock,t.parseBlock),parseInline:i(e.parseInline,t.parseInline),remove:i(e.remove,t.remove),wrap:r?s?(o,l,a,h)=>r(s(o,l,a,h),l,a,h):r:s}}function wr(n,e){let t=n.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}var Yf=[J.none];for(let n=1,e;e=y[n];n++)Yf[n]=J.define({id:n,name:e,props:n>=y.Escape?[]:[[T.group,n in vf?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var Ci=[],Pr=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,t,i,r=0){return thi
Line truncated
|
`);i=r<0?t:t.slice(0,r)}return e+i.length>this.to?i.slice(0,this.to-e):i}prevLineEnd(){return this.atEnd?this.lineStart:this.lineStart-1}startContext(e,t,i=0){this.block=$r.create(e,i,this.lineStart+t,this.block.hash,this.lineStart+this.line.text.length),this.stack.push(this.block)}startComposite(e,t,i=0){this.startContext(this.parser.getNodeType(e),t,i)}addNode(e,t,i){typeof e=="number"&&(e=new E(this.parser.nodeSet.types[e],Ci,Ci,(i??this.prevLineEnd())-t)),this.block.addChild(e,t-this.block.from)}addElement(e){this.block.addChild(e.toTree(this.parser.nodeSet),e.from-this.block.from)}addLeafElement(e,t){this.addNode(this.buffer.writeElements(Go(t.children,e.marks),-t.from).finish(t.type,t.to-t.from),t.from)}finishContext(){let e=this.stack.pop(),t=this.stack[this.stack.length-1];t.addChild(e.toTree(this.parser.nodeSet),e.from-t.from),this.block=t}finish(){for(;this.stack.length>1;)this.finishContext();return this.addGaps(this.block.toTree(this.parser.nodeSet,this.lineStart))}addGaps(e){return this.ranges.length>1?Yf(this.ranges,0,e.topNode,this.ranges[0].from,this.reusePlaceholders):e}finishLeaf(e){for(let i of e.parsers)if(i.finish(this,e))return;let t=Go(this.parser.parseInline(e.content,e.start),e.marks);this.addNode(this.buffer.writeElements(t,-e.start).finish(y.Paragraph,e.content.length),e.start)}elt(e,t,i,r){return typeof e=="string"?Y(this.parser.getNodeType(e),t,i,r):new vr(e,t)}get buffer(){return new Pr(this.parser.nodeSet)}};function Yf(n,e,t,i,r){let s=n[e].to,o=[],l=[],a=t.from+i;function h(f,c){for(;c?f>=s:f>s;){let u=n[e+1].from-s;i+=u,f+=u,e++,s=n[e].to}}for(let f=t.firstChild;f;f=f.nextSibling){h(f.from+i,!0);let c=f.from+i,u,d=r.get(f.tree);d?u=d:f.to+i>s?(u=Yf(n,e,f,i,r),h(f.to+i,!1)):u=f.toTree(),o.push(u),l.push(c-a)}return h(t.to+i,!1),new E(t.type,o,l,t.to+i-a,t.tree?t.tree.propValues:void 0)}var bn=class n extends xt{constructor(e,t,i,r,s,o,l,a,h){super(),this.nodeSet=e,this.blockParsers=t,this.leafBlockParsers=i,this.blockNames=r,this.endLeafBlock=s,this.skipContextMarkup=o,this.inlineParsers=l,this.inlineNames=a,this.wrappers=h,this.nodeTypes=Object.create(null);for(let f of e.types)this.nodeTypes[f.name]=f.id}createParse(e,t,i){let r=new No(this,e,t,i);for(let s of this.wrappers)r=s(r,e,t,i);return r}configure(e){let t=Uo(e);if(!t)return this;let{nodeSet:i,skipContextMarkup:r}=this,s=this.blockParsers.slice(),o=this.leafBlockParsers.slice(),l=this.blockNames.slice(),a=this.inlineParsers.slice(),h=this.inlineNames.slice(),f=this.endLeafBlock.slice(),c=this.wrappers;if(pn(t.defineNodes)){r=Object.assign({},r);let u=i.types.slice(),d;for(let O of t.defineNodes){let{name:p,block:g,composite:b,style:k}=typeof O=="string"?{name:O}:O;if(u.some($=>$.name==p))continue;b&&(r[u.length]=($,P,v)=>b(P,v,$.value));let Q=u.length,A=b?["Block","BlockContext"]:g?Q>=y.ATXHeading1&&Q<=y.SetextHeading2?["Block","LeafBlock","Heading"]:["Block","LeafBlock"]:void 0;u.push(J.define({id:Q,name:p,props:A&&[[T.group,A]]})),k&&(d||(d={}),Array.isArray(k)||k instanceof xe?d[p]=k:Object.assign(d,k))}i=new yt(u),d&&(i=i.extend(Be(d)))}if(pn(t.props)&&(i=i.extend(...t.props)),pn(t.remove))for(let u of t.remove){let d=this.blockNames.indexOf(u),O=this.inlineNames.indexOf(u);d>-1&&(s[d]=o[d]=void 0),O>-1&&(a[O]=void 0)}if(pn(t.parseBlock))for(let u of t.parseBlock){let d=l.indexOf(u.name);if(d>-1)s[d]=u.parse,o[d]=u.leaf;else{let O=u.before?wr(l,u.before):u.after?wr(l,u.after)+1:l.length-1;s.splice(O,0,u.parse),o.splice(O,0,u.leaf),l.splice(O,0,u.name)}u.endLeaf&&f.push(u.endLeaf)}if(pn(t.parseInline))for(let u of t.parseInline){let d=h.indexOf(u.name);if(d>-1)a[d]=u.parse;else{let O=u.before?wr(h,u.before):u.after?wr(h,u.after)+1:h.length-1;a.splice(O,0,u.parse),h.splice(O,0,u.name)}}return t.wrap&&(c=c.concat(t.wrap)),new n(i,s,o,l,f,r,a,h,c)}getNodeType(e){let t=this.nodeTypes[e];if(t==null)throw new RangeError(`Unknown node type '${e}'`);return t}parseInline(e,t){let i=new Kt(this,e,t);e:for(let r=t;r<i.end;){let s=i.char(r);for(let o of this.inlineParsers)if(o){let l=o(i,s,r);if(l>=0){r=l;continue e}}r++}return i.resolveMarkers(0)}};function pn(n){return n!=null&&n.length>0}function Uo(n){if(!Array.isArray(n))return n;if(n.length==0)return null;let e=Uo(n[0]);if(n.length==1)return e;let t=Uo(n.slice(1));if(!t||!e)return e||t;let i=(o,l)=>(o||Ci).concat(l||Ci),r=e.wrap,s=t.wrap;return{props:i(e.props,t.props),defineNodes:i(e.defineNodes,t.defineNodes),parseBlock:i(e.parseBlock,t.parseBlock),parseInline:i(e.parseInline,t.parseInline),remove:i(e.remove,t.remove),wrap:r?s?(o,l,a,h)=>r(s(o,l,a,h),l,a,h):r:s}}function wr(n,e){let t=n.indexOf(e);if(t<0)throw new RangeError(`Position specified relative to unknown parser ${e}`);return t}var _f=[J.none];for(let n=1,e;e=y[n];n++)_f[n]=J.define({id:n,name:e,props:n>=y.Escape?[]:[[T.group,n in Cf?["Block","BlockContext"]:["Block","LeafBlock"]]],top:e=="Document"});var Ci=[],Pr=class{constructor(e){this.nodeSet=e,this.content=[],this.nodes=[]}write(e,t,i,r=0){return thi
Line truncated
|
||||||
`;)s--;this.fragmentEnd=s?s-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(M.IncludeAnonymous|M.IgnoreMounts),i.firstChild());let r=e+this.fragment.offset;for(;i.to<=r;)if(!i.parent())return!1;for(;;){if(i.from>=r)return this.fragment.from<=t;if(!i.childAfter(r))return!1}}matches(e){let t=this.cursor.tree;for(;t&&t.type.isAnonymous&&t.children[0]instanceof E;)t=t.children[0];return t&&t.prop(T.contextHash)==e}takeNodes(e){let t=this.cursor,i=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,l=e.block.children.length,a=e.lineStart-e.block.from>>2,h=o,f=l;e:for(;;){if(t.to-i>Math.min(r,e.to)||t.type.isAnonymous&&t.tree&&(t.to-t.from>a||!Ap(t.tree))){if(t.type.isAnonymous&&t.firstChild())continue;break}let c=qf(t.from-i,e.ranges);if(t.to-i<=e.ranges[e.rangeI].to)e.addNode(t.tree,c);else{let u=new E(e.parser.nodeSet.types[y.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(u,t.tree),e.addNode(u,c)}for((t.type.isAnonymous||t.type.is("Block"))&&(t.type.isAnonymous||Bf.indexOf(t.type.id)<0?(o=t.to-i,l=e.block.children.length):(o=h,l=f),h=t.to-i,f=e.block.children.length);;){if(t.nextSibling())continue e;if(!t.parent()||!t.type.isAnonymous)break e}}for(;e.block.children.length>l;)e.block.children.pop(),e.block.positions.pop();return o-s}};function Ap(n){for(;n.type.isAnonymous;){let e=n.children[n.children.length-1];if(e instanceof E)n=e;else return!1}return n.type.is("Block")&&Bf.indexOf(n.type.id)<0}function qf(n,e){let t=n;for(let i=1;i<e.length;i++){let r=e[i-1].to,s=e[i].from;r<n&&(t-=s-r)}return t}var Rp=De({"Blockquote/...":m.quote,HorizontalRule:m.contentSeparator,"ATXHeading1/... SetextHeading1/...":m.heading1,"ATXHeading2/... SetextHeading2/...":m.heading2,"ATXHeading3/...":m.heading3,"ATXHeading4/...":m.heading4,"ATXHeading5/...":m.heading5,"ATXHeading6/...":m.heading6,"Comment CommentBlock":m.comment,Escape:m.escape,Entity:m.character,"Emphasis/...":m.emphasis,"StrongEmphasis/...":m.strong,"Link/... Image/...":m.link,"OrderedList/... BulletList/...":m.list,"BlockQuote/...":m.quote,"InlineCode CodeText":m.monospace,"URL Autolink":m.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":m.processingInstruction,"CodeInfo LinkLabel":m.labelName,LinkTitle:m.string,Paragraph:m.content}),Wf=new mn(new yt(Yf).extend(Rp),Object.keys(xr).map(n=>xr[n]),Object.keys(xr).map(n=>Lf[n]),Object.keys(xr),Xp,vf,Object.keys(_o).map(n=>_o[n]),Object.keys(_o),[]);function Mp(n,e,t){let i=[];for(let r=n.firstChild,s=e;;r=r.nextSibling){let o=r?r.from:t;if(o>s&&i.push({from:s,to:o}),!r)break;s=r.to}return i}function Vf(n){let{codeParser:e,htmlParser:t}=n;return{wrap:pr((r,s)=>{let o=r.type.id;if(e&&(o==y.CodeBlock||o==y.FencedCode)){let l="";if(o==y.FencedCode){let h=r.node.getChild(y.CodeInfo);h&&(l=s.read(h.from,h.to))}let a=e(l);if(a)return{parser:a,overlay:h=>h.type.id==y.CodeText,bracketed:o==y.FencedCode}}else if(t&&(o==y.HTMLBlock||o==y.HTMLTag||o==y.CommentBlock))return{parser:t,overlay:Mp(r.node,r.from,r.to)};return null})}}var jp={resolve:"Strikethrough",mark:"StrikethroughMark"},Lp={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":m.strikethrough}},{name:"StrikethroughMark",style:m.processingInstruction}],parseInline:[{name:"Strikethrough",parse(n,e,t){if(e!=126||n.char(t+1)!=126||n.char(t+2)==126)return-1;let i=n.slice(t-1,t),r=n.slice(t+2,t+3),s=/\s|^$/.test(i),o=/\s|^$/.test(r),l=gn.test(i),a=gn.test(r);return n.addDelimiter(jp,t,t+2,!o&&(!a||s||l),!s&&(!l||o||a))},after:"Emphasis"}]};function pn(n,e,t=0,i,r=0){let s=0,o=!0,l=-1,a=-1,h=!1,f=()=>{i.push(n.elt("TableCell",r+l,r+a,n.parser.parseInline(e.slice(l,a),r+l)))};for(let c=t;c<e.length;c++){let u=e.charCodeAt(c);u==124&&!h?((!o||l>-1)&&s++,o=!1,i&&(l>-1&&f(),i.push(n.elt("TableDelimiter",c+r,c+r+1))),l=a=-1):(h||u!=32&&u!=9)&&(l<0&&(l=c),a=c+1),h=!h&&u==92}return l>-1&&(s++,i&&f()),s}function Qf(n,e){for(let t=e;t<n.length;t++){let i=n.charCodeAt(t);if(i==124)return!0;i==92&&t++}return!1}var If=/^[>\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,Xr=class{constructor(){this.rows=null}nextLine(e,t,i){if(this.rows==null){this.rows=!1;let r;if((t.next==45||t.next==58||t.next==124)&&If.test(r=t.text.slice(t.pos))){let s=[];pn(e,i.content,0,s,i.start)==pn(e,r,0)&&(this.rows=[e.elt("TableHeader",i.start,i.start+i.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let r=[];pn(e,t.text,t.pos,r,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,r))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows)),!0):!1}},Ep={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":m.heading}},"TableRow",{name:"TableCell",style:m.content},{name:"TableDelimiter",style:m.processingInstruction}],parseBlock:[{name:"Table",leaf(n,e){return Qf(e.content,0)?new Xr:null},endLeaf(n,e,t){if(t.parsers.some(r
Line truncated
|
`;)s--;this.fragmentEnd=s?s-1:0}let i=this.cursor;i||(i=this.cursor=this.fragment.tree.cursor(M.IncludeAnonymous|M.IgnoreMounts),i.firstChild());let r=e+this.fragment.offset;for(;i.to<=r;)if(!i.parent())return!1;for(;;){if(i.from>=r)return this.fragment.from<=t;if(!i.childAfter(r))return!1}}matches(e){let t=this.cursor.tree;for(;t&&t.type.isAnonymous&&t.children[0]instanceof E;)t=t.children[0];return t&&t.prop(T.contextHash)==e}takeNodes(e){let t=this.cursor,i=this.fragment.offset,r=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,o=s,l=e.block.children.length,a=e.lineStart-e.block.from>>2,h=o,f=l;e:for(;;){if(t.to-i>Math.min(r,e.to)||t.type.isAnonymous&&t.tree&&(t.to-t.from>a||!Mp(t.tree))){if(t.type.isAnonymous&&t.firstChild())continue;break}let c=Wf(t.from-i,e.ranges);if(t.to-i<=e.ranges[e.rangeI].to)e.addNode(t.tree,c);else{let u=new E(e.parser.nodeSet.types[y.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(u,t.tree),e.addNode(u,c)}for((t.type.isAnonymous||t.type.is("Block"))&&(t.type.isAnonymous||qf.indexOf(t.type.id)<0?(o=t.to-i,l=e.block.children.length):(o=h,l=f),h=t.to-i,f=e.block.children.length);;){if(t.nextSibling())continue e;if(!t.parent()||!t.type.isAnonymous)break e}}for(;e.block.children.length>l;)e.block.children.pop(),e.block.positions.pop();return o-s}};function Mp(n){for(;n.type.isAnonymous;){let e=n.children[n.children.length-1];if(e instanceof E)n=e;else return!1}return n.type.is("Block")&&qf.indexOf(n.type.id)<0}function Wf(n,e){let t=n;for(let i=1;i<e.length;i++){let r=e[i-1].to,s=e[i].from;r<n&&(t-=s-r)}return t}var jp=Be({"Blockquote/...":m.quote,HorizontalRule:m.contentSeparator,"ATXHeading1/... SetextHeading1/...":m.heading1,"ATXHeading2/... SetextHeading2/...":m.heading2,"ATXHeading3/...":m.heading3,"ATXHeading4/...":m.heading4,"ATXHeading5/...":m.heading5,"ATXHeading6/...":m.heading6,"Comment CommentBlock":m.comment,Escape:m.escape,Entity:m.character,"Emphasis/...":m.emphasis,"StrongEmphasis/...":m.strong,"Link/... Image/...":m.link,"OrderedList/... BulletList/...":m.list,"BlockQuote/...":m.quote,"InlineCode CodeText":m.monospace,"URL Autolink":m.url,"HeaderMark HardBreak QuoteMark ListMark LinkMark EmphasisMark CodeMark":m.processingInstruction,"CodeInfo LinkLabel":m.labelName,LinkTitle:m.string,Paragraph:m.content}),Vf=new bn(new yt(_f).extend(jp),Object.keys(xr).map(n=>xr[n]),Object.keys(xr).map(n=>Ef[n]),Object.keys(xr),Zp,Cf,Object.keys(zo).map(n=>zo[n]),Object.keys(zo),[]);function Lp(n,e,t){let i=[];for(let r=n.firstChild,s=e;;r=r.nextSibling){let o=r?r.from:t;if(o>s&&i.push({from:s,to:o}),!r)break;s=r.to}return i}function If(n){let{codeParser:e,htmlParser:t}=n;return{wrap:pr((r,s)=>{let o=r.type.id;if(e&&(o==y.CodeBlock||o==y.FencedCode)){let l="";if(o==y.FencedCode){let h=r.node.getChild(y.CodeInfo);h&&(l=s.read(h.from,h.to))}let a=e(l);if(a)return{parser:a,overlay:h=>h.type.id==y.CodeText,bracketed:o==y.FencedCode}}else if(t&&(o==y.HTMLBlock||o==y.HTMLTag||o==y.CommentBlock))return{parser:t,overlay:Lp(r.node,r.from,r.to)};return null})}}var Ep={resolve:"Strikethrough",mark:"StrikethroughMark"},Yp={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":m.strikethrough}},{name:"StrikethroughMark",style:m.processingInstruction}],parseInline:[{name:"Strikethrough",parse(n,e,t){if(e!=126||n.char(t+1)!=126||n.char(t+2)==126)return-1;let i=n.slice(t-1,t),r=n.slice(t+2,t+3),s=/\s|^$/.test(i),o=/\s|^$/.test(r),l=Sn.test(i),a=Sn.test(r);return n.addDelimiter(Ep,t,t+2,!o&&(!a||s||l),!s&&(!l||o||a))},after:"Emphasis"}]};function gn(n,e,t=0,i,r=0){let s=0,o=!0,l=-1,a=-1,h=!1,f=()=>{i.push(n.elt("TableCell",r+l,r+a,n.parser.parseInline(e.slice(l,a),r+l)))};for(let c=t;c<e.length;c++){let u=e.charCodeAt(c);u==124&&!h?((!o||l>-1)&&s++,o=!1,i&&(l>-1&&f(),i.push(n.elt("TableDelimiter",c+r,c+r+1))),l=a=-1):(h||u!=32&&u!=9)&&(l<0&&(l=c),a=c+1),h=!h&&u==92}return l>-1&&(s++,i&&f()),s}function yf(n,e){for(let t=e;t<n.length;t++){let i=n.charCodeAt(t);if(i==124)return!0;i==92&&t++}return!1}var Nf=/^[>\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,Xr=class{constructor(){this.rows=null}nextLine(e,t,i){if(this.rows==null){this.rows=!1;let r;if((t.next==45||t.next==58||t.next==124)&&Nf.test(r=t.text.slice(t.pos))){let s=[];gn(e,i.content,0,s,i.start)==gn(e,r,0)&&(this.rows=[e.elt("TableHeader",i.start,i.start+i.content.length,s),e.elt("TableDelimiter",e.lineStart+t.pos,e.lineStart+t.text.length)])}}else if(this.rows){let r=[];gn(e,t.text,t.pos,r,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+t.pos,e.lineStart+t.text.length,r))}return!1}finish(e,t){return this.rows?(e.addLeafElement(t,e.elt("Table",t.start,t.start+t.content.length,this.rows)),!0):!1}},_p={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":m.heading}},"TableRow",{name:"TableCell",style:m.content},{name:"TableDelimiter",style:m.processingInstruction}],parseBlock:[{name:"Table",leaf(n,e){return yf(e.content,0)?new Xr:null},endLeaf(n,e,t){if(t.parsers.some(r
Line truncated
|
||||||
\${}
|
\${}
|
||||||
} catch (\${error}) {
|
} catch (\${error}) {
|
||||||
\${}
|
\${}
|
||||||
@@ -27,4 +27,4 @@ var Br=[],Fl=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,
|
|||||||
constructor(\${params}) {
|
constructor(\${params}) {
|
||||||
\${}
|
\${}
|
||||||
}
|
}
|
||||||
}`,{label:"class",detail:"definition",type:"keyword"}),de('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),de('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],_g=Dc.concat([de("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),de("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),de("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),Yc=new xi,Bc=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function yn(n){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,n),!0}}var zg=["FunctionDeclaration"],Dg={FunctionDeclaration:yn("function"),ClassDeclaration:yn("class"),ClassExpression:()=>!0,EnumDeclaration:yn("constant"),TypeAliasDeclaration:yn("type"),NamespaceDeclaration:yn("namespace"),VariableDefinition(n,e){n.matchContext(zg)||e(n,"variable")},TypeDefinition(n,e){e(n,"type")},__proto__:null};function qc(n,e){let t=Yc.get(e);if(t)return t;let i=[],r=!0;function s(o,l){let a=n.sliceString(o.from,o.to);i.push({label:a,type:l})}return e.cursor(M.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let l=Dg[o.name];if(l&&l(o,s)||Bc.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of qc(n,o.node))i.push(l);return!1}}),Yc.set(e,i),i}var _c=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Wc=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Bg(n){let e=D(n.state).resolveInner(n.pos,-1);if(Wc.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&_c.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let i=[];for(let r=e;r;r=r.parent)Bc.has(r.name)&&(i=i.concat(qc(n.state.doc,r)));return{options:i,from:t?e.from:n.pos,validFor:_c}}var qe=vt.define({name:"javascript",parser:Ec.configure({props:[ht.add({IfStatement:Pi({except:/^\s*({|else\b)/}),TryStatement:Pi({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:af,SwitchBody:n=>{let e=n.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return n.baseIndent+(t?0:i?1:2)*n.unit},Block:of({closing:"}"}),ArrowFunction:n=>n.baseIndent+n.unit,"TemplateString BlockComment":()=>null,"Statement Property":Pi({except:/^\s*{/}),JSXElement(n){let e=/^\s*<\//.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},JSXEscape(n){let e=/\s*\}/.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},"JSXOpenTag JSXSelfClosingTag"(n){return n.column(n.node.from)+n.unit}}),ft.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":yr,BlockComment(n){return{from:n.from+2,to:n.to-2}},JSXElement(n){let e=n.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=n.lastChild;return{from:e.to,to:t.type.isError?n.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(n){var e;let t=(e=n.firstChild)===null||e===void 0?void 0:e.nextSibling,i=n.lastChild;return!t||t.type.isError?null:{from:t.to,to:i.type.isError?n.to:i.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Vc={test:n=>/^JSX/.test(n.name),facet:an({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Pl=qe.configure({dialect:"ts"},"typescript"),vl=qe.configure({dialect:"jsx",props:[Qr.add(n=>n.isTop?[Vc]:void 0)]}),Cl=qe.configure({dialect:"jsx ts",props:[Qr.add(n=>n.isTop?[Vc]:void 0)]},"typescript"),Ic=n=>({label:n,type:"keyword"}),Nc="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Ic),qg=Nc.concat(["declare","implements","private","protected","public"].map(Ic));function Uc(n={}){let e=n.jsx?n.typescript?Cl:vl:n.typescript?Pl:qe,t=n.typescript?_g.concat(qg):Dc.concat(Nc);return new Be(e,[qe.data.of({autocomplete:df(Wc,uf(t))}),qe.data.of({autocomplete:Bg}),n.jsx?Ig:[]])}function Wg(n){for(;;){if(n.name=="JSXOpenTag"||n.name=="JSXSelfClosingTag"||n.name=="JSXFragmentTag")return n;if(n.name=="JSXEscape"||!n.parent)return null;n=n.parent}}function zc(n,e,t=n.length){for(let i=e?.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return n.sliceString(i.from,Math.min(i.to,t));return""}var Vg=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Ig=Z.inputHandler.of((n,e,t,i,r)=>{if((Vg?n.composing:n.compositionStarted)||n.state.readOnly||e!=t||i!=">"&&i!="/"||!qe.isActiveAt(n.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var h;let{head:f}=a,c=D(o).resolveInner(f-1,-1),u
Line truncated
|
}`,{label:"class",detail:"definition",type:"keyword"}),de('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),de('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Dg=Bc.concat([de("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),de("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),de("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),_c=new xi,qc=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function xn(n){return(e,t)=>{let i=e.node.getChild("VariableDefinition");return i&&t(i,n),!0}}var Bg=["FunctionDeclaration"],qg={FunctionDeclaration:xn("function"),ClassDeclaration:xn("class"),ClassExpression:()=>!0,EnumDeclaration:xn("constant"),TypeAliasDeclaration:xn("type"),NamespaceDeclaration:xn("namespace"),VariableDefinition(n,e){n.matchContext(Bg)||e(n,"variable")},TypeDefinition(n,e){e(n,"type")},__proto__:null};function Wc(n,e){let t=_c.get(e);if(t)return t;let i=[],r=!0;function s(o,l){let a=n.sliceString(o.from,o.to);i.push({label:a,type:l})}return e.cursor(M.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let l=qg[o.name];if(l&&l(o,s)||qc.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of Wc(n,o.node))i.push(l);return!1}}),_c.set(e,i),i}var zc=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Vc=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Wg(n){let e=B(n.state).resolveInner(n.pos,-1);if(Vc.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&zc.test(n.state.sliceDoc(e.from,e.to));if(!t&&!n.explicit)return null;let i=[];for(let r=e;r;r=r.parent)qc.has(r.name)&&(i=i.concat(Wc(n.state.doc,r)));return{options:i,from:t?e.from:n.pos,validFor:zc}}var We=vt.define({name:"javascript",parser:Yc.configure({props:[ft.add({IfStatement:Pi({except:/^\s*({|else\b)/}),TryStatement:Pi({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:hf,SwitchBody:n=>{let e=n.textAfter,t=/^\s*\}/.test(e),i=/^\s*(case|default)\b/.test(e);return n.baseIndent+(t?0:i?1:2)*n.unit},Block:lf({closing:"}"}),ArrowFunction:n=>n.baseIndent+n.unit,"TemplateString BlockComment":()=>null,"Statement Property":Pi({except:/^\s*{/}),JSXElement(n){let e=/^\s*<\//.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},JSXEscape(n){let e=/\s*\}/.test(n.textAfter);return n.lineIndent(n.node.from)+(e?0:n.unit)},"JSXOpenTag JSXSelfClosingTag"(n){return n.column(n.node.from)+n.unit}}),ct.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":yr,BlockComment(n){return{from:n.from+2,to:n.to-2}},JSXElement(n){let e=n.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let t=n.lastChild;return{from:e.to,to:t.type.isError?n.to:t.from}},"JSXSelfClosingTag JSXOpenTag"(n){var e;let t=(e=n.firstChild)===null||e===void 0?void 0:e.nextSibling,i=n.lastChild;return!t||t.type.isError?null:{from:t.to,to:i.type.isError?n.to:i.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),Ic={test:n=>/^JSX/.test(n.name),facet:fn({commentTokens:{block:{open:"{/*",close:"*/}"}}})},vl=We.configure({dialect:"ts"},"typescript"),Cl=We.configure({dialect:"jsx",props:[Qr.add(n=>n.isTop?[Ic]:void 0)]}),Xl=We.configure({dialect:"jsx ts",props:[Qr.add(n=>n.isTop?[Ic]:void 0)]},"typescript"),Nc=n=>({label:n,type:"keyword"}),Uc="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(Nc),Vg=Uc.concat(["declare","implements","private","protected","public"].map(Nc));function Gc(n={}){let e=n.jsx?n.typescript?Xl:Cl:n.typescript?vl:We,t=n.typescript?Dg.concat(Vg):Bc.concat(Uc);return new qe(e,[We.data.of({autocomplete:Of(Vc,df(t))}),We.data.of({autocomplete:Wg}),n.jsx?Ug:[]])}function Ig(n){for(;;){if(n.name=="JSXOpenTag"||n.name=="JSXSelfClosingTag"||n.name=="JSXFragmentTag")return n;if(n.name=="JSXEscape"||!n.parent)return null;n=n.parent}}function Dc(n,e,t=n.length){for(let i=e?.firstChild;i;i=i.nextSibling)if(i.name=="JSXIdentifier"||i.name=="JSXBuiltin"||i.name=="JSXNamespacedName"||i.name=="JSXMemberExpression")return n.sliceString(i.from,Math.min(i.to,t));return""}var Ng=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Ug=Z.inputHandler.of((n,e,t,i,r)=>{if((Ng?n.composing:n.compositionStarted)||n.state.readOnly||e!=t||i!=">"&&i!="/"||!We.isActiveAt(n.state,e,-1))return!1;let s=r(),{state:o}=s,l=o.changeByRange(a=>{var h;let{head:f}=a,c=B(o).resolveInner(f-1,-1),u
Line truncated
|
||||||
@@ -29,6 +29,7 @@ export const SERVABLE = new Set([
|
|||||||
"doc-files.js",
|
"doc-files.js",
|
||||||
"send-state.js",
|
"send-state.js",
|
||||||
"mention-box.js",
|
"mention-box.js",
|
||||||
|
"md-field.js",
|
||||||
"uploads.js",
|
"uploads.js",
|
||||||
"sound.js",
|
"sound.js",
|
||||||
"looks.js",
|
"looks.js",
|
||||||
@@ -70,6 +71,10 @@ export const SERVABLE = new Set([
|
|||||||
"screens/git-host.js",
|
"screens/git-host.js",
|
||||||
"screens/looks.js",
|
"screens/looks.js",
|
||||||
"screens/agents-view.js",
|
"screens/agents-view.js",
|
||||||
|
"screens/agents/agents-data.js",
|
||||||
|
"screens/agents/agents-list-editor.js",
|
||||||
|
"screens/agents/agents-summary.js",
|
||||||
|
"screens/agents/agents-form.js",
|
||||||
"screens/prefs-dialog.js",
|
"screens/prefs-dialog.js",
|
||||||
"screens/cleanup.js",
|
"screens/cleanup.js",
|
||||||
"screens/help-dialog.js",
|
"screens/help-dialog.js",
|
||||||
@@ -77,6 +82,7 @@ export const SERVABLE = new Set([
|
|||||||
"screens/ask.js",
|
"screens/ask.js",
|
||||||
"screens/notepad.js",
|
"screens/notepad.js",
|
||||||
"screens/activities.js",
|
"screens/activities.js",
|
||||||
|
"screens/setup.js",
|
||||||
"activities.js",
|
"activities.js",
|
||||||
"activities/snake.js",
|
"activities/snake.js",
|
||||||
"activities/golf.js",
|
"activities/golf.js",
|
||||||
@@ -140,6 +146,22 @@ export const SERVABLE = new Set([
|
|||||||
"activities/ghoul-cart-draw.js",
|
"activities/ghoul-cart-draw.js",
|
||||||
"activities/ghoul-sled.js",
|
"activities/ghoul-sled.js",
|
||||||
"activities/ghoul-sled-draw.js",
|
"activities/ghoul-sled-draw.js",
|
||||||
|
"activities/ghoul-banister.js",
|
||||||
|
"activities/ghoul-banister-draw.js",
|
||||||
|
"activities/ghoul-hearse.js",
|
||||||
|
"activities/ghoul-hearse-draw.js",
|
||||||
|
"activities/ghoul-wagon.js",
|
||||||
|
"activities/ghoul-wagon-draw.js",
|
||||||
|
"activities/ghoul-gurney.js",
|
||||||
|
"activities/ghoul-gurney-draw.js",
|
||||||
|
"activities/ghoul-pew.js",
|
||||||
|
"activities/ghoul-pew-draw.js",
|
||||||
|
"activities/ghoul-pew-course.js",
|
||||||
|
"activities/ghoul-pew-world.js",
|
||||||
|
"activities/ghoul-mower.js",
|
||||||
|
"activities/ghoul-mower-draw.js",
|
||||||
|
"activities/ghoul-tray.js",
|
||||||
|
"activities/ghoul-tray-draw.js",
|
||||||
"activities/ghoul-carnival.js",
|
"activities/ghoul-carnival.js",
|
||||||
"activities/ghoul-carnival-draw.js",
|
"activities/ghoul-carnival-draw.js",
|
||||||
"activities/ghoul-carnival-world.js",
|
"activities/ghoul-carnival-world.js",
|
||||||
@@ -147,6 +169,10 @@ export const SERVABLE = new Set([
|
|||||||
"activities/ghoul-frozen-draw.js",
|
"activities/ghoul-frozen-draw.js",
|
||||||
"activities/ghoul-frozen-world.js",
|
"activities/ghoul-frozen-world.js",
|
||||||
"activities/ghoul-flare.js",
|
"activities/ghoul-flare.js",
|
||||||
|
"activities/ghoul-bog.js",
|
||||||
|
"activities/ghoul-bog-draw.js",
|
||||||
|
"activities/ghoul-bogboat.js",
|
||||||
|
"activities/ghoul-bogboat-draw.js",
|
||||||
"activities/ghoul-picker-draw.js",
|
"activities/ghoul-picker-draw.js",
|
||||||
"activities/ghoul-powers.js",
|
"activities/ghoul-powers.js",
|
||||||
"activities/ghoul-arms.js",
|
"activities/ghoul-arms.js",
|
||||||
@@ -158,6 +184,13 @@ export const SERVABLE = new Set([
|
|||||||
"activities/ghoul-dice.js",
|
"activities/ghoul-dice.js",
|
||||||
"activities/ghoul-dice-draw.js",
|
"activities/ghoul-dice-draw.js",
|
||||||
"activities/ghoul-gameover-draw.js",
|
"activities/ghoul-gameover-draw.js",
|
||||||
|
"activities/ghoul-intros.js",
|
||||||
|
"activities/ghoul-intro-draw.js",
|
||||||
|
"activities/ghoul-boss-intros.js",
|
||||||
|
"activities/ghoul-bossintro-draw.js",
|
||||||
|
"activities/ghoul-story.js",
|
||||||
|
"activities/ghoul-story-draw.js",
|
||||||
|
"activities/ghoul-sfx-story.js",
|
||||||
"activities/ghoul-bonus.js",
|
"activities/ghoul-bonus.js",
|
||||||
"activities/ghoul-bonus-draw.js",
|
"activities/ghoul-bonus-draw.js",
|
||||||
"activities/ghoul-monsters-draw.js",
|
"activities/ghoul-monsters-draw.js",
|
||||||
@@ -183,6 +216,15 @@ export const SERVABLE = new Set([
|
|||||||
"activities/ghoul-sfx-carnival.js",
|
"activities/ghoul-sfx-carnival.js",
|
||||||
"activities/ghoul-sfx-frozen.js",
|
"activities/ghoul-sfx-frozen.js",
|
||||||
"activities/ghoul-sfx-sled.js",
|
"activities/ghoul-sfx-sled.js",
|
||||||
|
"activities/ghoul-sfx-banister.js",
|
||||||
|
"activities/ghoul-sfx-hearse.js",
|
||||||
|
"activities/ghoul-sfx-bog.js",
|
||||||
|
"activities/ghoul-sfx-bogboat.js",
|
||||||
|
"activities/ghoul-sfx-wagon.js",
|
||||||
|
"activities/ghoul-sfx-gurney.js",
|
||||||
|
"activities/ghoul-sfx-pew.js",
|
||||||
|
"activities/ghoul-sfx-mower.js",
|
||||||
|
"activities/ghoul-sfx-tray.js",
|
||||||
"activities/ghoul-ride-core.js",
|
"activities/ghoul-ride-core.js",
|
||||||
"activities/ghoul-ride-scenes.js",
|
"activities/ghoul-ride-scenes.js",
|
||||||
"activities/ghoul-ride.js",
|
"activities/ghoul-ride.js",
|
||||||
@@ -201,6 +243,7 @@ export const SERVABLE = new Set([
|
|||||||
"notepad.js",
|
"notepad.js",
|
||||||
"notepad-editor.js",
|
"notepad-editor.js",
|
||||||
"notepad-editor.css",
|
"notepad-editor.css",
|
||||||
|
"md-field.css",
|
||||||
"vendor/marked.esm.js",
|
"vendor/marked.esm.js",
|
||||||
"vendor/codemirror.esm.js",
|
"vendor/codemirror.esm.js",
|
||||||
]);
|
]);
|
||||||
@@ -212,7 +255,7 @@ export const SERVABLE = new Set([
|
|||||||
// Layers first, then one file per screen, then responsive and print last so
|
// Layers first, then one file per screen, then responsive and print last so
|
||||||
// its overrides still come after everything they override. The files are not
|
// its overrides still come after everything they override. The files are not
|
||||||
// on SERVABLE: they reach the page only through /app.css.
|
// on SERVABLE: they reach the page only through /app.css.
|
||||||
export const CSS_ORDER = ["tokens.css", "shell.css", "planny.css", "pieces.css", "dashboard.css", "poses.css", "docs.css", "ask.css", "ending.css", "help.css", "looks.css", "prefs.css", "notepad.css", "activities.css", "git.css", "responsive.css"];
|
export const CSS_ORDER = ["tokens.css", "shell.css", "planny.css", "pieces.css", "dashboard.css", "poses.css", "docs.css", "ask.css", "ending.css", "help.css", "looks.css", "prefs.css", "agents.css", "notepad.css", "activities.css", "git.css", "responsive.css"];
|
||||||
|
|
||||||
// The files joined with one newline between them (each file's own last newline
|
// The files joined with one newline between them (each file's own last newline
|
||||||
// is that one), as the server serves them before the accent rules. The test
|
// is that one), as the server serves them before the accent rules. The test
|
||||||
|
|||||||
Reference in new issue
Block a user